[hdf4] 02/08: Imported Upstream version 4.2.10

Johan Van de Wauw johanvdw-guest at moszumanska.debian.org
Thu Aug 14 20:23:42 UTC 2014


This is an automated email from the git hooks/post-receive script.

johanvdw-guest pushed a commit to branch master
in repository hdf4.

commit 165bbe6ca3f125ee8b651f0b6b01fc08755bb7f8
Author: Johan Van de Wauw <johan.vandewauw at gmail.com>
Date:   Thu Aug 14 21:22:00 2014 +0200

    Imported Upstream version 4.2.10
---
 CMakeFilters.cmake                                |    160 +
 CMakeInstallation.cmake                           |    358 +
 CMakeLists.txt                                    |    603 +
 COPYING                                           |     57 +
 CTestConfig.cmake                                 |     32 +
 MANIFEST                                          |   1068 +
 Makefile                                          |     36 +
 Makefile.am                                       |     29 +
 Makefile.dist                                     |     36 +
 Makefile.in                                       |    878 +
 README.txt                                        |     90 +
 UserMacros.cmake                                  |     22 +
 aclocal.m4                                        |   9569 ++
 bin/chkmanifest                                   |    169 +
 bin/cmakehdf4                                     |    379 +
 bin/compile                                       |     99 +
 bin/config.guess                                  |   1529 +
 bin/config.sub                                    |   1658 +
 bin/depcomp                                       |    472 +
 bin/deploy                                        |     56 +
 bin/h4vers                                        |    478 +
 bin/install-sh                                    |    520 +
 bin/locate_sw                                     |    282 +
 bin/ltmain.sh                                     |   9655 ++
 bin/missing                                       |    336 +
 bin/mkinstalldirs                                 |    111 +
 bin/newer                                         |     45 +
 bin/reconfigure                                   |    106 +
 bin/release                                       |    282 +
 bin/runtest                                       |    893 +
 bin/snapshot                                      |    489 +
 bin/yodconfigure                                  |     77 +
 config/BlankForm                                  |    160 +
 config/aix                                        |    160 +
 config/apple                                      |    119 +
 config/cmake/CPack.Info.plist.in                  |     32 +
 config/cmake/CTestCustom.cmake                    |    101 +
 config/cmake/CheckTypeSize.cmake                  |     48 +
 config/cmake/ConfigureChecks.cmake                |    365 +
 config/cmake/FindHDF4.cmake.in                    |     82 +
 config/cmake/FindMPI.cmake                        |    628 +
 config/cmake/FindSZIP.cmake                       |    179 +
 config/cmake/HDF4Macros.cmake                     |     32 +
 config/cmake/HDF4UseFortran.cmake                 |    121 +
 config/cmake/HDF4_Examples.cmake.in               |    118 +
 config/cmake/HDFLibMacros.cmake                   |    350 +
 config/cmake/HDFMacros.cmake                      |    187 +
 config/cmake/HDFTests.c                           |    490 +
 config/cmake/NSIS.InstallOptions.ini.in           |     37 +
 config/cmake/NSIS.template.in                     |    974 +
 config/cmake/UserMacros/Windows_MT.cmake          |     41 +
 config/cmake/cacheinit.cmake                      |     68 +
 config/cmake/h4config.h.in                        |    143 +
 config/cmake/hdf.gif                              |    Bin 0 -> 1016 bytes
 config/cmake/hdf4-config-version.cmake.in         |     27 +
 config/cmake/hdf4-config.cmake.build.in           |     61 +
 config/cmake/hdf4-config.cmake.install.in         |     71 +
 config/cmake/libhdf4.settings.cmake.in            |     38 +
 config/cmake/mccacheinit.cmake                    |     71 +
 config/cmake/runTest.cmake                        |    182 +
 config/commence.am                                |     43 +
 config/conclude.am                                |    178 +
 config/examples.am                                |    105 +
 config/freebsd                                    |    160 +
 config/i686-pc-cygwin                             |    175 +
 config/linux-gnu                                  |    245 +
 config/powerpc-apple                              |    172 +
 config/powerpc-ibm-aix5.x                         |    160 +
 config/powerpc64-linux-gnu                        |    152 +
 config/solaris2.x                                 |    186 +
 config/x86_64-pc-cygwin                           |    175 +
 configure                                         |  26579 ++++
 configure.ac                                      |   1030 +
 hdf/CMakeLists.txt                                |     12 +
 hdf/Makefile.am                                   |     30 +
 hdf/Makefile.in                                   |    645 +
 hdf/examples/AN_create_annotation.c               |    117 +
 hdf/examples/AN_get_annotation_info.c             |    107 +
 hdf/examples/AN_read_annotation.c                 |     92 +
 hdf/examples/CMakeLists.txt                       |     52 +
 hdf/examples/CMakeTests.cmake                     |     45 +
 hdf/examples/GR_create_and_write_image.c          |     85 +
 hdf/examples/GR_get_attribute.c                   |    141 +
 hdf/examples/GR_image_info.c                      |    100 +
 hdf/examples/GR_modify_image.c                    |    130 +
 hdf/examples/GR_read_chunks.c                     |     89 +
 hdf/examples/GR_read_image.c                      |    134 +
 hdf/examples/GR_read_palette.c                    |     81 +
 hdf/examples/GR_set_attribute.c                   |     76 +
 hdf/examples/GR_write_chunks.c                    |     95 +
 hdf/examples/GR_write_palette.c                   |    108 +
 hdf/examples/Makefile.am                          |     98 +
 hdf/examples/Makefile.in                          |    763 +
 hdf/examples/README                               |     22 +
 hdf/examples/VD_create_onefield_vdatas.c          |     68 +
 hdf/examples/VD_create_vdatas.c                   |    116 +
 hdf/examples/VD_get_vdata_info.c                  |     74 +
 hdf/examples/VD_locate_vdata.c                    |     82 +
 hdf/examples/VD_read_from_vdata.c                 |     88 +
 hdf/examples/VD_read_mixed_vdata.c                |     94 +
 hdf/examples/VD_set_get_vdata_attr.c              |    131 +
 hdf/examples/VD_write_mixed_vdata.c               |    115 +
 hdf/examples/VD_write_mixed_vdata_struct.c        |    154 +
 hdf/examples/VD_write_to_vdata.c                  |     96 +
 hdf/examples/VG_add_sds_to_vgroup.c               |     82 +
 hdf/examples/VG_create_vgroup.c                   |     57 +
 hdf/examples/VG_get_vgroup_info.c                 |    103 +
 hdf/examples/VG_insert_vdatas_to_vgroup.c         |    150 +
 hdf/examples/VG_set_get_vgroup_attr.c             |    106 +
 hdf/examples/VG_vgroup_contents.c                 |    104 +
 hdf/examples/run-all-ex.sh                        |     38 +
 hdf/examples/run-c-ex.sh                          |    172 +
 hdf/fortran/CMakeLists.txt                        |    123 +
 hdf/fortran/CMakeTests.cmake                      |    115 +
 hdf/fortran/Makefile.am                           |     20 +
 hdf/fortran/Makefile.in                           |    641 +
 hdf/fortran/examples/AN_create_annotation.f       |    125 +
 hdf/fortran/examples/AN_get_annotation_info.f     |    121 +
 hdf/fortran/examples/AN_read_annotation.f         |     82 +
 hdf/fortran/examples/CMakeLists.txt               |     94 +
 hdf/fortran/examples/CMakeTests.cmake             |     49 +
 hdf/fortran/examples/GR_create_and_write_image.f  |     92 +
 hdf/fortran/examples/GR_get_attribute.f           |     99 +
 hdf/fortran/examples/GR_image_info.f              |     90 +
 hdf/fortran/examples/GR_modify_image.f            |    133 +
 hdf/fortran/examples/GR_read_image.f              |    136 +
 hdf/fortran/examples/GR_read_palette.f            |     84 +
 hdf/fortran/examples/GR_set_attribute.f           |     97 +
 hdf/fortran/examples/GR_write_palette.f           |    116 +
 hdf/fortran/examples/Makefile.am                  |     89 +
 hdf/fortran/examples/Makefile.in                  |    755 +
 hdf/fortran/examples/VD_create_onefield_vdatas.f  |     79 +
 hdf/fortran/examples/VD_create_vdatas.f           |    106 +
 hdf/fortran/examples/VD_get_vdata_info.f          |     88 +
 hdf/fortran/examples/VD_locate_vdata.f            |     87 +
 hdf/fortran/examples/VD_read_from_vdata.f         |     93 +
 hdf/fortran/examples/VD_read_mixed_vdata.f        |    106 +
 hdf/fortran/examples/VD_set_get_vdata_attr.f      |    134 +
 hdf/fortran/examples/VD_write_mixed_vdata.f       |    126 +
 hdf/fortran/examples/VD_write_to_vdata.f          |    106 +
 hdf/fortran/examples/VG_add_sds_to_vgroup.f       |     91 +
 hdf/fortran/examples/VG_create_vgroup.f           |     61 +
 hdf/fortran/examples/VG_get_vgroup_info.f         |     97 +
 hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f |    167 +
 hdf/fortran/examples/VG_set_get_vgroup_attr.f     |    106 +
 hdf/fortran/examples/VG_vgroup_contents.f         |    102 +
 hdf/fortran/examples/run-fortran-ex.sh            |    162 +
 hdf/fortran/hdf_fortrandll.def                    |    338 +
 hdf/src/.indent.pro                               |      1 +
 hdf/src/CMakeLists.txt                            |    162 +
 hdf/src/H4api_adpt.h                              |    220 +
 hdf/src/Makefile.am                               |     63 +
 hdf/src/Makefile.in                               |    832 +
 hdf/src/atom.c                                    |    685 +
 hdf/src/atom.h                                    |    303 +
 hdf/src/bitvect.c                                 |    530 +
 hdf/src/bitvect.h                                 |    388 +
 hdf/src/cdeflate.c                                |    796 +
 hdf/src/cdeflate.h                                |    103 +
 hdf/src/cnbit.c                                   |    823 +
 hdf/src/cnbit.h                                   |    112 +
 hdf/src/cnone.c                                   |    344 +
 hdf/src/cnone.h                                   |     89 +
 hdf/src/crle.c                                    |    716 +
 hdf/src/crle.h                                    |    127 +
 hdf/src/cskphuff.c                                |    793 +
 hdf/src/cskphuff.h                                |    105 +
 hdf/src/cszip.c                                   |   1086 +
 hdf/src/cszip.h                                   |    120 +
 hdf/src/df.h                                      |    215 +
 hdf/src/df24.c                                    |    517 +
 hdf/src/df24f.c                                   |    437 +
 hdf/src/df24ff.f                                  |    241 +
 hdf/src/dfan.c                                    |   1742 +
 hdf/src/dfan.h                                    |     65 +
 hdf/src/dfanf.c                                   |    458 +
 hdf/src/dfanff.f                                  |    402 +
 hdf/src/dfcomp.c                                  |    354 +
 hdf/src/dfconv.c                                  |    543 +
 hdf/src/dfconvrt.h                                |    101 +
 hdf/src/dff.c                                     |    439 +
 hdf/src/dfff.f                                    |     81 +
 hdf/src/dffunc.inc                                |    705 +
 hdf/src/dfgr.c                                    |   1653 +
 hdf/src/dfgr.h                                    |     74 +
 hdf/src/dfgroup.c                                 |    339 +
 hdf/src/dfi.h                                     |    151 +
 hdf/src/dfimcomp.c                                |   1119 +
 hdf/src/dfjpeg.c                                  |    316 +
 hdf/src/dfknat.c                                  |    325 +
 hdf/src/dfkswap.c                                 |    440 +
 hdf/src/dfp.c                                     |    569 +
 hdf/src/dfpf.c                                    |    236 +
 hdf/src/dfpff.f                                   |    285 +
 hdf/src/dfr8.c                                    |   1685 +
 hdf/src/dfr8f.c                                   |    431 +
 hdf/src/dfr8ff.f                                  |    337 +
 hdf/src/dfrig.h                                   |     74 +
 hdf/src/dfrle.c                                   |    170 +
 hdf/src/dfsd.c                                    |   5755 +
 hdf/src/dfsd.h                                    |    139 +
 hdf/src/dfsdf.c                                   |   1639 +
 hdf/src/dfsdff.f                                  |    625 +
 hdf/src/dfstubs.c                                 |   1451 +
 hdf/src/dfstubs.h                                 |     76 +
 hdf/src/dfufp2i.c                                 |    702 +
 hdf/src/dfufp2i.h                                 |     87 +
 hdf/src/dfufp2if.c                                |     43 +
 hdf/src/dfufp2iff.f                               |     95 +
 hdf/src/dfunjpeg.c                                |    375 +
 hdf/src/dfutil.c                                  |     83 +
 hdf/src/dfutilf.c                                 |     68 +
 hdf/src/dynarray.c                                |    353 +
 hdf/src/dynarray.h                                |    157 +
 hdf/src/glist.c                                   |   1195 +
 hdf/src/glist.h                                   |    670 +
 hdf/src/h4config.h.in                             |    139 +
 hdf/src/hbitio.c                                  |    965 +
 hdf/src/hbitio.h                                  |     85 +
 hdf/src/hblocks.c                                 |   2031 +
 hdf/src/hbuffer.c                                 |    640 +
 hdf/src/hchunks.c                                 |   4358 +
 hdf/src/hchunks.h                                 |    317 +
 hdf/src/hcomp.c                                   |   2009 +
 hdf/src/hcomp.h                                   |    147 +
 hdf/src/hcompi.h                                  |    115 +
 hdf/src/hcompri.c                                 |    560 +
 hdf/src/hconv.h                                   |    159 +
 hdf/src/hdatainfo.c                               |   1186 +
 hdf/src/hdatainfo.h                               |     68 +
 hdf/src/hdf.h                                     |    172 +
 hdf/src/hdf.inc                                   |    467 +
 hdf/src/hdfalloc.c                                |    290 +
 hdf/src/hdfi.h                                    |   1308 +
 hdf/src/herr.c                                    |    321 +
 hdf/src/herr.h                                    |    485 +
 hdf/src/herrf.c                                   |    125 +
 hdf/src/hextelt.c                                 |   1457 +
 hdf/src/hfile.c                                   |   4395 +
 hdf/src/hfile.h                                   |    928 +
 hdf/src/hfiledd.c                                 |   2333 +
 hdf/src/hfilef.c                                  |    291 +
 hdf/src/hfileff.f                                 |    197 +
 hdf/src/hkit.c                                    |    347 +
 hdf/src/hkit.h                                    |    167 +
 hdf/src/hlimits.h                                 |    288 +
 hdf/src/hntdefs.h                                 |    226 +
 hdf/src/hproto.h                                  |   1971 +
 hdf/src/hproto_fortran.h                          |   1696 +
 hdf/src/hqueue.h                                  |    257 +
 hdf/src/htags.h                                   |    137 +
 hdf/src/linklist.c                                |    500 +
 hdf/src/linklist.h                                |    211 +
 hdf/src/maldebug.c                                |    660 +
 hdf/src/maldebug.h                                |     62 +
 hdf/src/mcache.c                                  |   1342 +
 hdf/src/mcache.h                                  |    216 +
 hdf/src/mfan.c                                    |   2281 +
 hdf/src/mfan.h                                    |    363 +
 hdf/src/mfanf.c                                   |    503 +
 hdf/src/mfgr.c                                    |   6678 ++
 hdf/src/mfgr.h                                    |    147 +
 hdf/src/mfgrf.c                                   |   1318 +
 hdf/src/mfgrff.f                                  |    416 +
 hdf/src/mstdio.c                                  |    348 +
 hdf/src/mstdio.h                                  |     89 +
 hdf/src/patchlevel.h                              |      2 +
 hdf/src/src.inc                                   |    136 +
 hdf/src/tbbt.c                                    |   1038 +
 hdf/src/tbbt.h                                    |    326 +
 hdf/src/trace.h                                   |      6 +
 hdf/src/vattr.c                                   |   1701 +
 hdf/src/vattr.h                                   |     34 +
 hdf/src/vattrf.c                                  |    364 +
 hdf/src/vattrff.f                                 |    135 +
 hdf/src/vconv.c                                   |    494 +
 hdf/src/vg.c                                      |   1796 +
 hdf/src/vg.h                                      |     73 +
 hdf/src/vgf.c                                     |   1627 +
 hdf/src/vgff.f                                    |    892 +
 hdf/src/vgint.h                                   |    306 +
 hdf/src/vgp.c                                     |   3656 +
 hdf/src/vhi.c                                     |    211 +
 hdf/src/vio.c                                     |   1598 +
 hdf/src/vparse.c                                  |    181 +
 hdf/src/vrw.c                                     |    802 +
 hdf/src/vsfld.c                                   |   1151 +
 hdf/test/CMakeLists.txt                           |     83 +
 hdf/test/CMakeTests.cmake                         |    193 +
 hdf/test/Makefile.am                              |     62 +
 hdf/test/Makefile.in                              |    874 +
 hdf/test/README                                   |     52 +
 hdf/test/an.c                                     |    334 +
 hdf/test/anfile.c                                 |    156 +
 hdf/test/bitio.c                                  |    445 +
 hdf/test/blocks.c                                 |    312 +
 hdf/test/buffer.c                                 |    567 +
 hdf/test/chunks.c                                 |   2514 +
 hdf/test/comp.c                                   |    486 +
 hdf/test/conv.c                                   |    713 +
 hdf/test/egchi.res                                |     49 +
 hdf/test/egfhi.f                                  |    152 +
 hdf/test/egfhi.res                                |     61 +
 hdf/test/extelt.c                                 |    495 +
 hdf/test/file.c                                   |    242 +
 hdf/test/file1.c                                  |    241 +
 hdf/test/forsupf.c                                |    105 +
 hdf/test/forsupff.f                               |    326 +
 hdf/test/fortest.c                                |    235 +
 hdf/test/fortest.h                                |     36 +
 hdf/test/fortest.inc                              |     51 +
 hdf/test/fortest.sav                              |    734 +
 hdf/test/fortestF.f                               |    299 +
 hdf/test/gentest.c                                |    207 +
 hdf/test/litend.c                                 |    735 +
 hdf/test/macros.c                                 |    188 +
 hdf/test/man.c                                    |    961 +
 hdf/test/manf.f                                   |    598 +
 hdf/test/mgr.c                                    |   4093 +
 hdf/test/mgrf.f                                   |   1610 +
 hdf/test/mgrf_sunOS.f                             |   1464 +
 hdf/test/nbit.c                                   |   1144 +
 hdf/test/rig.c                                    |   2007 +
 hdf/test/sdmms.c                                  |    461 +
 hdf/test/sdnmms.c                                 |    473 +
 hdf/test/sdstr.c                                  |    144 +
 hdf/test/slab.c                                   |   2874 +
 hdf/test/slabwf.f                                 |    533 +
 hdf/test/t24f.f                                   |    248 +
 hdf/test/tanf.f                                   |    234 +
 hdf/test/tanfilef.f                               |    210 +
 hdf/test/tattdatainfo.c                           |    676 +
 hdf/test/tbv.c                                    |    231 +
 hdf/test/tdatainfo.c                              |   1574 +
 hdf/test/tdatainfo.h                              |     35 +
 hdf/test/tdfr8.c                                  |    229 +
 hdf/test/tdupimgs.c                               |    174 +
 hdf/test/test_files/8bit.dat                      |    Bin 0 -> 1662 bytes
 hdf/test/test_files/README                        |      4 +
 hdf/test/test_files/bitio.dat                     |    Bin 0 -> 4390 bytes
 hdf/test/test_files/gr_r24.dat                    |    Bin 0 -> 567 bytes
 hdf/test/test_files/greyjpeg.dat                  |    Bin 0 -> 2746 bytes
 hdf/test/test_files/grtdfui83.hdf                 |    Bin 0 -> 2603 bytes
 hdf/test/test_files/jpeg.dat                      |    Bin 0 -> 2996 bytes
 hdf/test/test_files/litend.dat                    |    Bin 0 -> 2600 bytes
 hdf/test/test_files/nbit.dat                      |    Bin 0 -> 3366 bytes
 hdf/test/test_files/tmgr.dat                      |    Bin 0 -> 13960 bytes
 hdf/test/test_files/tvattr.dat                    |    Bin 0 -> 2256 bytes
 hdf/test/testhdf.c                                |    315 +
 hdf/test/tmgrattr.c                               |    488 +
 hdf/test/tmgrcomp.c                               |   1039 +
 hdf/test/tpf.f                                    |    232 +
 hdf/test/tproto.h                                 |     60 +
 hdf/test/tr8f.f                                   |    275 +
 hdf/test/tree.c                                   |    151 +
 hdf/test/tsdmmsf.f                                |    321 +
 hdf/test/tsdnmmsf.f                               |    283 +
 hdf/test/tsdnntf.f                                |    262 +
 hdf/test/tsdntf.f                                 |    249 +
 hdf/test/tsdstrf.f                                |    132 +
 hdf/test/tstubsf.f                                |    424 +
 hdf/test/tszip.c                                  |   1153 +
 hdf/test/tusejpegfuncs.c                          |    236 +
 hdf/test/tutils.c                                 |     91 +
 hdf/test/tutils.h                                 |    139 +
 hdf/test/tv1.res                                  |     50 +
 hdf/test/tv2.res                                  |     14 +
 hdf/test/tvattr.c                                 |    855 +
 hdf/test/tvattrf.f                                |    327 +
 hdf/test/tvnameclass.c                            |    372 +
 hdf/test/tvset.c                                  |   3530 +
 hdf/test/tvsetf.f                                 |   1033 +
 hdf/test/tvsfpack.c                               |    335 +
 hdf/test/vers.c                                   |     45 +
 hdf/util/CMakeLists.txt                           |    211 +
 hdf/util/CMakeTests.cmake                         |    486 +
 hdf/util/HELINK.OPT                               |      2 +
 hdf/util/MacProjects/PalToHDF.project.hqx         |    871 +
 hdf/util/MacProjects/R8ToHDF.project.hqx          |   1001 +
 hdf/util/MacProjects/RISToHDF.project.hqx         |    964 +
 hdf/util/MacProjects/fp2hdf.project.hqx           |    780 +
 hdf/util/MacProjects/hdf24to8.project.hqx         |    780 +
 hdf/util/MacProjects/hdfcomp.project.hqx          |    807 +
 hdf/util/MacProjects/hdfed.project.hqx            |    780 +
 hdf/util/MacProjects/hdfls.project.hqx            |    780 +
 hdf/util/MacProjects/hdfpack.project.hqx          |    817 +
 hdf/util/MacProjects/hdftoR8.project.hqx          |    870 +
 hdf/util/MacProjects/hdftopal.project.hqx         |    981 +
 hdf/util/MacProjects/vshow.project.hqx            |    807 +
 hdf/util/Makefile.am                              |    137 +
 hdf/util/Makefile.in                              |   1130 +
 hdf/util/README                                   |     45 +
 hdf/util/README.TST                               |    436 +
 hdf/util/README.fp2hdf                            |     19 +
 hdf/util/README.fp2hdf.test                       |     63 +
 hdf/util/decompress.c                             |    316 +
 hdf/util/fp2hdf.c                                 |   2286 +
 hdf/util/fp2hdf.input1                            |     49 +
 hdf/util/fp2hdf.input1-32                         |     37 +
 hdf/util/fp2hdf.out1                              |    242 +
 hdf/util/fp2hdf.out1-32                           |    184 +
 hdf/util/fp2hdf.out2                              |    123 +
 hdf/util/fp2hdf.out2-32                           |    101 +
 hdf/util/fp2hdf.test                              |    128 +
 hdf/util/fp2hdf.test.result                       |     47 +
 hdf/util/fptest.c                                 |    271 +
 hdf/util/getopt.c                                 |    757 +
 hdf/util/getopt1.c                                |    187 +
 hdf/util/gif.h                                    |    163 +
 hdf/util/gif2hdf.c                                |    119 +
 hdf/util/gif2mem.c                                |    358 +
 hdf/util/gifread.c                                |    427 +
 hdf/util/h4cc.in                                  |    246 +
 hdf/util/h4fc.in                                  |    213 +
 hdf/util/h4redeploy.in                            |    166 +
 hdf/util/hdf24to8.c                               |    352 +
 hdf/util/hdf2gif.c                                |    365 +
 hdf/util/hdf2jpeg.c                               |    377 +
 hdf/util/hdf8to24.c                               |    354 +
 hdf/util/hdfcomp.c                                |    245 +
 hdf/util/hdfcomp.out1                             |     70 +
 hdf/util/hdfcomp.out1.1                           |     35 +
 hdf/util/hdfcomp.out1.2                           |     35 +
 hdf/util/hdfed-w.out1                             |    104 +
 hdf/util/hdfed.input1                             |     17 +
 hdf/util/hdfed.out1                               |    104 +
 hdf/util/hdfgifwr.c                               |    533 +
 hdf/util/hdfls.c                                  |    624 +
 hdf/util/hdfpack.c                                |    657 +
 hdf/util/hdfpack.out1                             |     40 +
 hdf/util/hdfpack.out1.1                           |     22 +
 hdf/util/hdfpack.out1.2                           |     18 +
 hdf/util/hdfrseq.c                                |    706 +
 hdf/util/hdftopal.c                               |     96 +
 hdf/util/hdftor8.c                                |    397 +
 hdf/util/hdftor8.out1                             |     48 +
 hdf/util/hdfunpac.c                               |    218 +
 hdf/util/he.h                                     |    193 +
 hdf/util/he_cntrl.c                               |   1740 +
 hdf/util/he_disp.c                                |    410 +
 hdf/util/he_file.c                                |    620 +
 hdf/util/he_main.c                                |   1277 +
 hdf/util/he_proto.h                               |    309 +
 hdf/util/jpeg2hdf.c                               |    570 +
 hdf/util/jpeg2hdf.out1                            |     20 +
 hdf/util/paltohdf.c                               |     96 +
 hdf/util/r8tohdf.c                                |    199 +
 hdf/util/ristosds.c                               |    211 +
 hdf/util/ristosds.input1                          |     11 +
 hdf/util/ristosds.out1                            |     10 +
 hdf/util/testfiles/README                         |     64 +
 hdf/util/testfiles/SunWheel.gif                   |    Bin 0 -> 14627 bytes
 hdf/util/testfiles/bttrfly.gif                    |    Bin 0 -> 12687 bytes
 hdf/util/testfiles/fp2hdf/h100x100                |    Bin 0 -> 41054 bytes
 hdf/util/testfiles/fp2hdf/h100x100h               |    Bin 0 -> 41054 bytes
 hdf/util/testfiles/fp2hdf/h100x100hv              |    Bin 0 -> 41054 bytes
 hdf/util/testfiles/fp2hdf/h60x75                  |    Bin 0 -> 18794 bytes
 hdf/util/testfiles/fp2hdf/h60x75n                 |    Bin 0 -> 15248 bytes
 hdf/util/testfiles/fp2hdf/h60x75v                 |    Bin 0 -> 18794 bytes
 hdf/util/testfiles/fp2hdf/pal.hdf                 |    Bin 0 -> 970 bytes
 hdf/util/testfiles/fp2hdf/t100x100                |      6 +
 hdf/util/testfiles/head.r24                       |    Bin 0 -> 259026 bytes
 hdf/util/testfiles/head.r8                        |      1 +
 hdf/util/testfiles/jet2.hdf                       |    Bin 0 -> 121010 bytes
 hdf/util/testfiles/jpeg_img.jpg                   |    Bin 0 -> 2922 bytes
 hdf/util/testfiles/ntcheck.hdf                    |    Bin 0 -> 3066 bytes
 hdf/util/testfiles/palette.raw                    |    Bin 0 -> 768 bytes
 hdf/util/testfiles/skull.hdf                      |    Bin 0 -> 804543 bytes
 hdf/util/testfiles/storm110.hdf                   |    Bin 0 -> 3487 bytes
 hdf/util/testfiles/storm110.raw                   |      1 +
 hdf/util/testfiles/storm120.hdf                   |    Bin 0 -> 3487 bytes
 hdf/util/testfiles/storm120.raw                   |      1 +
 hdf/util/testfiles/storm130.hdf                   |    Bin 0 -> 3487 bytes
 hdf/util/testfiles/storm130.raw                   |      1 +
 hdf/util/testfiles/storm140.raw                   |      1 +
 hdf/util/testfiles/test.cdf                       |    Bin 0 -> 11795 bytes
 hdf/util/testfiles/test.hdf                       |    Bin 0 -> 30275 bytes
 hdf/util/testfiles/tvattr.hdf                     |    Bin 0 -> 2256 bytes
 hdf/util/testutil.sh.in                           |    432 +
 hdf/util/vcompat.c                                |     43 +
 hdf/util/vmake.c                                  |    613 +
 hdf/util/vshow.c                                  |    810 +
 hdf/util/writehdf.c                               |    215 +
 libhdf4.settings.in                               |     38 +
 m4/libtool.m4                                     |   7982 ++
 m4/ltoptions.m4                                   |    384 +
 m4/ltsugar.m4                                     |    123 +
 m4/ltversion.m4                                   |     23 +
 m4/lt~obsolete.m4                                 |     98 +
 man/Makefile.am                                   |      3 +
 man/Makefile.in                                   |    525 +
 man/gr_chunk.3                                    |    244 +
 man/hdf.1                                         |    173 +
 man/hdfunpac.1                                    |     27 +
 mfhdf/CMakeLists.txt                              |     21 +
 mfhdf/COPYRIGHT                                   |     31 +
 mfhdf/FAQ                                         |    581 +
 mfhdf/Makefile.am                                 |     35 +
 mfhdf/Makefile.in                                 |    647 +
 mfhdf/README                                      |    123 +
 mfhdf/THANKS                                      |     78 +
 mfhdf/build.bat                                   |      1 +
 mfhdf/dumper/CMakeLists.txt                       |     63 +
 mfhdf/dumper/CMakeTests.cmake                     |    401 +
 mfhdf/dumper/Makefile.am                          |     35 +
 mfhdf/dumper/Makefile.in                          |    806 +
 mfhdf/dumper/README                               |     21 +
 mfhdf/dumper/TEST                                 |     65 +
 mfhdf/dumper/hdp.c                                |    455 +
 mfhdf/dumper/hdp.h                                |    617 +
 mfhdf/dumper/hdp.mak                              |    241 +
 mfhdf/dumper/hdp.txt                              |    243 +
 mfhdf/dumper/hdp_dump.c                           |    579 +
 mfhdf/dumper/hdp_gr.c                             |   1387 +
 mfhdf/dumper/hdp_list.c                           |   1250 +
 mfhdf/dumper/hdp_rig.c                            |    711 +
 mfhdf/dumper/hdp_sds.c                            |   1468 +
 mfhdf/dumper/hdp_util.c                           |   1004 +
 mfhdf/dumper/hdp_vd.c                             |   1109 +
 mfhdf/dumper/hdp_vg.c                             |   1624 +
 mfhdf/dumper/show.c                               |    684 +
 mfhdf/dumper/testfiles/Example6.hdf               |    Bin 0 -> 2615 bytes
 mfhdf/dumper/testfiles/IMCOMP.hdf                 |    Bin 0 -> 1155 bytes
 mfhdf/dumper/testfiles/Image_with_Palette.hdf     |    Bin 0 -> 2537 bytes
 mfhdf/dumper/testfiles/LongDataset.hdf            |    Bin 0 -> 3555 bytes
 mfhdf/dumper/testfiles/Roy.nc                     |    Bin 0 -> 4020 bytes
 mfhdf/dumper/testfiles/SDSlongname.hdf            |    Bin 0 -> 3203 bytes
 mfhdf/dumper/testfiles/Tables.hdf                 |    Bin 0 -> 711 bytes
 mfhdf/dumper/testfiles/Tables_External_File       |    Bin 0 -> 75 bytes
 mfhdf/dumper/testfiles/VGlongname.hdf             |    Bin 0 -> 753 bytes
 mfhdf/dumper/testfiles/ctxtr2r.hdf                |    Bin 0 -> 434 bytes
 mfhdf/dumper/testfiles/dumpgr-1.out               |    145 +
 mfhdf/dumper/testfiles/dumpgr-10.out              |    150 +
 mfhdf/dumper/testfiles/dumpgr-11.out              |    145 +
 mfhdf/dumper/testfiles/dumpgr-12.out              |     97 +
 mfhdf/dumper/testfiles/dumpgr-13.out              |     82 +
 mfhdf/dumper/testfiles/dumpgr-14.out              |     34 +
 mfhdf/dumper/testfiles/dumpgr-15.out              |     30 +
 mfhdf/dumper/testfiles/dumpgr-16.out              |      1 +
 mfhdf/dumper/testfiles/dumpgr-17.out              |     19 +
 mfhdf/dumper/testfiles/dumpgr-18.out              |     97 +
 mfhdf/dumper/testfiles/dumpgr-19.out              |     95 +
 mfhdf/dumper/testfiles/dumpgr-2.out               |    103 +
 mfhdf/dumper/testfiles/dumpgr-20.out              |     27 +
 mfhdf/dumper/testfiles/dumpgr-3.out               |     19 +
 mfhdf/dumper/testfiles/dumpgr-4.out               |     19 +
 mfhdf/dumper/testfiles/dumpgr-5.out               |    105 +
 mfhdf/dumper/testfiles/dumpgr-6.out               |      5 +
 mfhdf/dumper/testfiles/dumpgr-7.out               |      0
 mfhdf/dumper/testfiles/dumpgr-8.out               |      0
 mfhdf/dumper/testfiles/dumpgr-9.out               |    148 +
 mfhdf/dumper/testfiles/dumprig-1.out              |     91 +
 mfhdf/dumper/testfiles/dumprig-2.out              |     60 +
 mfhdf/dumper/testfiles/dumprig-3.out              |     32 +
 mfhdf/dumper/testfiles/dumprig-4.out              |     91 +
 mfhdf/dumper/testfiles/dumprig-5.out              |     60 +
 mfhdf/dumper/testfiles/dumprig-6.out              |     48 +
 mfhdf/dumper/testfiles/dumpsds-1.out              |    114 +
 mfhdf/dumper/testfiles/dumpsds-10.out             |    125 +
 mfhdf/dumper/testfiles/dumpsds-11.out             |    119 +
 mfhdf/dumper/testfiles/dumpsds-12.out             |     17 +
 mfhdf/dumper/testfiles/dumpsds-13.out             |     34 +
 mfhdf/dumper/testfiles/dumpsds-14.out             |     49 +
 mfhdf/dumper/testfiles/dumpsds-15.out             |    100 +
 mfhdf/dumper/testfiles/dumpsds-15szip.out         |    116 +
 mfhdf/dumper/testfiles/dumpsds-16.out             |    297 +
 mfhdf/dumper/testfiles/dumpsds-17.out             |    297 +
 mfhdf/dumper/testfiles/dumpsds-18.out             |    108 +
 mfhdf/dumper/testfiles/dumpsds-2.out              |     26 +
 mfhdf/dumper/testfiles/dumpsds-3.out              |     64 +
 mfhdf/dumper/testfiles/dumpsds-4.out              |      1 +
 mfhdf/dumper/testfiles/dumpsds-5.out              |     64 +
 mfhdf/dumper/testfiles/dumpsds-6.out              |     64 +
 mfhdf/dumper/testfiles/dumpsds-7.out              |     11 +
 mfhdf/dumper/testfiles/dumpsds-8.out              |    111 +
 mfhdf/dumper/testfiles/dumpsds-9.out              |    130 +
 mfhdf/dumper/testfiles/dumpvd-1.out               |  12144 ++
 mfhdf/dumper/testfiles/dumpvd-10.out              |    234 +
 mfhdf/dumper/testfiles/dumpvd-11.out              |     11 +
 mfhdf/dumper/testfiles/dumpvd-12.out              |     11 +
 mfhdf/dumper/testfiles/dumpvd-13.out              |     20 +
 mfhdf/dumper/testfiles/dumpvd-14.out              |     50 +
 mfhdf/dumper/testfiles/dumpvd-2.out               |     72 +
 mfhdf/dumper/testfiles/dumpvd-3.out               |     59 +
 mfhdf/dumper/testfiles/dumpvd-4.out               |     23 +
 mfhdf/dumper/testfiles/dumpvd-5.out               |     86 +
 mfhdf/dumper/testfiles/dumpvd-6.out               |    144 +
 mfhdf/dumper/testfiles/dumpvd-7.out               |     40 +
 mfhdf/dumper/testfiles/dumpvd-8.out               |     20 +
 mfhdf/dumper/testfiles/dumpvd-9.out               |     12 +
 mfhdf/dumper/testfiles/dumpvg-1.out               |     38 +
 mfhdf/dumper/testfiles/dumpvg-10.out              |     68 +
 mfhdf/dumper/testfiles/dumpvg-11.out              |     59 +
 mfhdf/dumper/testfiles/dumpvg-12.out              |     83 +
 mfhdf/dumper/testfiles/dumpvg-13.out              |     18 +
 mfhdf/dumper/testfiles/dumpvg-14.out              |    138 +
 mfhdf/dumper/testfiles/dumpvg-15.out              |    214 +
 mfhdf/dumper/testfiles/dumpvg-16.out              |     42 +
 mfhdf/dumper/testfiles/dumpvg-17.out              |     79 +
 mfhdf/dumper/testfiles/dumpvg-2.out               |     38 +
 mfhdf/dumper/testfiles/dumpvg-3.out               |     29 +
 mfhdf/dumper/testfiles/dumpvg-4.out               |     17 +
 mfhdf/dumper/testfiles/dumpvg-5.out               |     38 +
 mfhdf/dumper/testfiles/dumpvg-6.out               |    100 +
 mfhdf/dumper/testfiles/dumpvg-7.out               |    108 +
 mfhdf/dumper/testfiles/dumpvg-8.out               |    108 +
 mfhdf/dumper/testfiles/dumpvg-9.out               |     93 +
 mfhdf/dumper/testfiles/grtdfi322.hdf              |    Bin 0 -> 1678 bytes
 mfhdf/dumper/testfiles/grtdfui162.hdf             |    Bin 0 -> 2447 bytes
 mfhdf/dumper/testfiles/grtdfui82.hdf              |    Bin 0 -> 2332 bytes
 mfhdf/dumper/testfiles/grtdfui83.hdf              |    Bin 0 -> 2603 bytes
 mfhdf/dumper/testfiles/grtdfui84.hdf              |    Bin 0 -> 2447 bytes
 mfhdf/dumper/testfiles/list-1.out                 |     21 +
 mfhdf/dumper/testfiles/list-10.out                |     54 +
 mfhdf/dumper/testfiles/list-2.out                 |     39 +
 mfhdf/dumper/testfiles/list-3.out                 |     39 +
 mfhdf/dumper/testfiles/list-4.out                 |     42 +
 mfhdf/dumper/testfiles/list-5.out                 |      5 +
 mfhdf/dumper/testfiles/list-6.out                 |      7 +
 mfhdf/dumper/testfiles/list-7.out                 |     85 +
 mfhdf/dumper/testfiles/list-8.out                 |     39 +
 mfhdf/dumper/testfiles/list-9.out                 |     51 +
 mfhdf/dumper/testfiles/manySDSs.c                 |     72 +
 mfhdf/dumper/testfiles/sds1_dim1_samename.hdf     |    Bin 0 -> 3126 bytes
 mfhdf/dumper/testfiles/sds2_dim1_samename.hdf     |    Bin 0 -> 3354 bytes
 mfhdf/dumper/testfiles/sds_compressed.hdf         |    Bin 0 -> 3945 bytes
 mfhdf/dumper/testfiles/sds_empty_many.hdf         |    Bin 0 -> 21708 bytes
 mfhdf/dumper/testfiles/star.hdf                   |    Bin 0 -> 174066 bytes
 mfhdf/dumper/testfiles/swf32.hdf                  |    Bin 0 -> 573 bytes
 mfhdf/dumper/testfiles/swf32_fileattr.hdf         |    Bin 0 -> 25796 bytes
 mfhdf/dumper/testfiles/swi16.hdf                  |    Bin 0 -> 488 bytes
 mfhdf/dumper/testfiles/swi8.hdf                   |    Bin 0 -> 452 bytes
 mfhdf/dumper/testfiles/tdata.hdf                  |    Bin 0 -> 7190 bytes
 mfhdf/dumper/testfiles/tdf24.hdf                  |    Bin 0 -> 2137 bytes
 mfhdf/dumper/testfiles/tdfr8f.hdf                 |    Bin 0 -> 67111 bytes
 mfhdf/dumper/testfiles/test.hdf                   |    Bin 0 -> 1062 bytes
 mfhdf/dumper/testfiles/tvattr.hdf                 |    Bin 0 -> 2256 bytes
 mfhdf/dumper/testfiles/tvset.hdf                  |    Bin 0 -> 75925 bytes
 mfhdf/dumper/testfiles/vslongname.c               |     86 +
 mfhdf/dumper/testfiles/vslongname.hdf             |    Bin 0 -> 639 bytes
 mfhdf/dumper/testhdp.sh.in                        |    410 +
 mfhdf/examples/CMakeLists.txt                     |     39 +
 mfhdf/examples/CMakeTests.cmake                   |     31 +
 mfhdf/examples/Makefile.am                        |     62 +
 mfhdf/examples/Makefile.in                        |    727 +
 mfhdf/examples/SD_alter_sds_values.c              |     56 +
 mfhdf/examples/SD_chunking_example.c              |    295 +
 mfhdf/examples/SD_compress_sds.c                  |     87 +
 mfhdf/examples/SD_create_sds.c                    |     50 +
 mfhdf/examples/SD_dimscale_vs_sds.c               |     59 +
 mfhdf/examples/SD_find_sds_by_name.c              |     76 +
 mfhdf/examples/SD_get_attr.c                      |    156 +
 mfhdf/examples/SD_get_info.c                      |     68 +
 mfhdf/examples/SD_mv_sds_to_external.c            |     41 +
 mfhdf/examples/SD_read_from_sds.c                 |     64 +
 mfhdf/examples/SD_read_subsets.c                  |    127 +
 mfhdf/examples/SD_set_attr.c                      |     76 +
 mfhdf/examples/SD_set_get_dim_info.c              |    149 +
 mfhdf/examples/SD_unlimited_sds.c                 |    119 +
 mfhdf/examples/SD_write_slab.c                    |     94 +
 mfhdf/examples/SD_write_to_sds.c                  |     65 +
 mfhdf/examples/testexamples.sh.in                 |     18 +
 mfhdf/fortran/CMakeLists.txt                      |    114 +
 mfhdf/fortran/CMakeTests.cmake                    |    162 +
 mfhdf/fortran/Makefile.am                         |     89 +
 mfhdf/fortran/Makefile.in                         |    989 +
 mfhdf/fortran/common.inc                          |    147 +
 mfhdf/fortran/depend                              |     31 +
 mfhdf/fortran/examples/CMakeLists.txt             |     76 +
 mfhdf/fortran/examples/CMakeTests.cmake           |     34 +
 mfhdf/fortran/examples/Makefile.am                |     62 +
 mfhdf/fortran/examples/Makefile.in                |    728 +
 mfhdf/fortran/examples/SD_alter_sds_values.f      |     71 +
 mfhdf/fortran/examples/SD_chunking_example.f      |    289 +
 mfhdf/fortran/examples/SD_compress_sds.f          |     95 +
 mfhdf/fortran/examples/SD_create_sds.f            |     54 +
 mfhdf/fortran/examples/SD_dimscale_vs_sds.f       |     68 +
 mfhdf/fortran/examples/SD_find_sds_by_name.f      |     82 +
 mfhdf/fortran/examples/SD_get_attr.f              |    125 +
 mfhdf/fortran/examples/SD_get_info.f              |     71 +
 mfhdf/fortran/examples/SD_mv_sds_to_external.f    |     50 +
 mfhdf/fortran/examples/SD_read_from_sds.f         |     72 +
 mfhdf/fortran/examples/SD_read_subsets.f          |    125 +
 mfhdf/fortran/examples/SD_set_attr.f              |     82 +
 mfhdf/fortran/examples/SD_set_get_dim_info.f      |    147 +
 mfhdf/fortran/examples/SD_unlimited_sds.f         |    115 +
 mfhdf/fortran/examples/SD_write_slab.f            |    101 +
 mfhdf/fortran/examples/SD_write_to_sds.f          |     79 +
 mfhdf/fortran/ftest.f.in                          |   1418 +
 mfhdf/fortran/hdftest.f                           |   2630 +
 mfhdf/fortran/hdftest1.f                          |    457 +
 mfhdf/fortran/hdftst.sav                          |     12 +
 mfhdf/fortran/jackets.c.in                        |   2215 +
 mfhdf/fortran/mffunc.inc                          |    134 +
 mfhdf/fortran/mfhdf_fortrandll.def                |     71 +
 mfhdf/fortran/mfsdf.c                             |   3074 +
 mfhdf/fortran/mfsdf.h                             |    188 +
 mfhdf/fortran/mfsdff.f                            |    806 +
 mfhdf/fortran/netcdf.inc.in                       |    147 +
 mfhdf/fortran/test_nc.cdl                         |     42 +
 mfhdf/fortran/test_nc.nc                          |    Bin 0 -> 736 bytes
 mfhdf/fortran/testfortran.sh.in                   |    112 +
 mfhdf/fortran/tszip.f                             |    403 +
 mfhdf/hdfimport/CMakeLists.txt                    |     60 +
 mfhdf/hdfimport/CMakeTests.cmake                  |    320 +
 mfhdf/hdfimport/Makefile.am                       |     38 +
 mfhdf/hdfimport/Makefile.in                       |    824 +
 mfhdf/hdfimport/SDSfloat2.hdf                     |    Bin 0 -> 3116 bytes
 mfhdf/hdfimport/SDSfloat3.hdf                     |    Bin 0 -> 3451 bytes
 mfhdf/hdfimport/crtSDSfloats.c                    |    112 +
 mfhdf/hdfimport/gen_sds_floats.c                  |    112 +
 mfhdf/hdfimport/hdfimport-w.out2                  |     69 +
 mfhdf/hdfimport/hdfimport.c                       |   3710 +
 mfhdf/hdfimport/hdfimport.input1                  |     49 +
 mfhdf/hdfimport/hdfimport.out1                    |    736 +
 mfhdf/hdfimport/hdfimport.out2                    |     69 +
 mfhdf/hdfimport/hdfimport.out3                    |     36 +
 mfhdf/hdfimport/hdfimporttest.c                   |    472 +
 mfhdf/hdfimport/testfiles/SDSfloat2.tst           |     18 +
 mfhdf/hdfimport/testfiles/SDSfloat3.tst           |     18 +
 mfhdf/hdfimport/testfiles/cb16i2.tst              |     49 +
 mfhdf/hdfimport/testfiles/cb16i3.tst              |     59 +
 mfhdf/hdfimport/testfiles/cb32i2.tst              |     49 +
 mfhdf/hdfimport/testfiles/cb32i3.tst              |     59 +
 mfhdf/hdfimport/testfiles/cb32r2.tst              |     49 +
 mfhdf/hdfimport/testfiles/cb32r3.tst              |     59 +
 mfhdf/hdfimport/testfiles/cb64r2-n.tst            |     49 +
 mfhdf/hdfimport/testfiles/cb64r2.tst              |     49 +
 mfhdf/hdfimport/testfiles/cb64r2_ris.tst          |     65 +
 mfhdf/hdfimport/testfiles/cb64r3-n.tst            |     59 +
 mfhdf/hdfimport/testfiles/cb64r3.tst              |     59 +
 mfhdf/hdfimport/testfiles/ctxtr2.tst              |     49 +
 mfhdf/hdfimport/testfiles/ctxtr2_ris.tst          |     23 +
 mfhdf/hdfimport/testfiles/ctxtr3.tst              |     59 +
 mfhdf/hdfimport/testutil.sh.in                    |    172 +
 mfhdf/hdiff/CMakeLists.txt                        |     66 +
 mfhdf/hdiff/CMakeTests.cmake                      |    232 +
 mfhdf/hdiff/Makefile.am                           |     52 +
 mfhdf/hdiff/Makefile.in                           |    840 +
 mfhdf/hdiff/hdiff.c                               |    492 +
 mfhdf/hdiff/hdiff.h                               |    199 +
 mfhdf/hdiff/hdiff_array.c                         |    747 +
 mfhdf/hdiff/hdiff_dim.c                           |    537 +
 mfhdf/hdiff/hdiff_dim.h                           |     61 +
 mfhdf/hdiff/hdiff_gattr.c                         |    127 +
 mfhdf/hdiff/hdiff_gr.c                            |    305 +
 mfhdf/hdiff/hdiff_list.c                          |   1534 +
 mfhdf/hdiff/hdiff_list.h                          |    127 +
 mfhdf/hdiff/hdiff_main.c                          |    181 +
 mfhdf/hdiff/hdiff_mattbl.c                        |    127 +
 mfhdf/hdiff/hdiff_mattbl.h                        |     62 +
 mfhdf/hdiff/hdiff_misc.c                          |    277 +
 mfhdf/hdiff/hdiff_sds.c                           |    629 +
 mfhdf/hdiff/hdiff_table.c                         |    166 +
 mfhdf/hdiff/hdiff_table.h                         |     63 +
 mfhdf/hdiff/hdiff_vs.c                            |    444 +
 mfhdf/hdiff/hdifftst.c                            |    723 +
 mfhdf/hdiff/testfiles/hdiff_01.txt                |     21 +
 mfhdf/hdiff/testfiles/hdiff_02.txt                |      5 +
 mfhdf/hdiff/testfiles/hdiff_03.txt                |      7 +
 mfhdf/hdiff/testfiles/hdiff_04.txt                |     17 +
 mfhdf/hdiff/testfiles/hdiff_05.txt                |     15 +
 mfhdf/hdiff/testfiles/hdiff_06.txt                |     29 +
 mfhdf/hdiff/testfiles/hdiff_06w.txt               |     29 +
 mfhdf/hdiff/testfiles/hdiff_07.txt                |      5 +
 mfhdf/hdiff/testfiles/hdiff_08.txt                |      5 +
 mfhdf/hdiff/testfiles/hdiff_09.txt                |     12 +
 mfhdf/hdiff/testfiles/hdiff_10.txt                |     13 +
 mfhdf/hdiff/testfiles/hdiff_11.txt                |     44 +
 mfhdf/hdiff/testfiles/hdiff_12.txt                |      7 +
 mfhdf/hdiff/testfiles/hdiff_13.txt                |     32 +
 mfhdf/hdiff/testfiles/hdiff_14.txt                |      8 +
 mfhdf/hdiff/testfiles/hdiff_15.txt                |     19 +
 mfhdf/hdiff/testfiles/hdifftst1.hdf               |    Bin 0 -> 3992 bytes
 mfhdf/hdiff/testfiles/hdifftst2.hdf               |    Bin 0 -> 3992 bytes
 mfhdf/hdiff/testfiles/hdifftst3.hdf               |    Bin 0 -> 1074414 bytes
 mfhdf/hdiff/testfiles/hdifftst4.hdf               |    Bin 0 -> 1074414 bytes
 mfhdf/hdiff/testfiles/hdifftst5.hdf               |    Bin 0 -> 2966 bytes
 mfhdf/hdiff/testfiles/hdifftst6.hdf               |    Bin 0 -> 2966 bytes
 mfhdf/hdiff/testfiles/hdifftst7.hdf               |    Bin 0 -> 364 bytes
 mfhdf/hdiff/testhdiff.sh.in                       |    177 +
 mfhdf/hrepack/CMakeLists.txt                      |     69 +
 mfhdf/hrepack/CMakeTests.cmake                    |    101 +
 mfhdf/hrepack/Makefile.am                         |     66 +
 mfhdf/hrepack/Makefile.in                         |   1036 +
 mfhdf/hrepack/hrepack.c                           |    464 +
 mfhdf/hrepack/hrepack.h                           |     93 +
 mfhdf/hrepack/hrepack_all.sh.in                   |     12 +
 mfhdf/hrepack/hrepack_an.c                        |    287 +
 mfhdf/hrepack/hrepack_an.h                        |     63 +
 mfhdf/hrepack/hrepack_check.c                     |    297 +
 mfhdf/hrepack/hrepack_dim.c                       |    926 +
 mfhdf/hrepack/hrepack_dim.h                       |     58 +
 mfhdf/hrepack/hrepack_gr.c                        |    665 +
 mfhdf/hrepack/hrepack_gr.h                        |     49 +
 mfhdf/hrepack/hrepack_list.c                      |   1497 +
 mfhdf/hrepack/hrepack_lsttable.c                  |    228 +
 mfhdf/hrepack/hrepack_lsttable.h                  |     76 +
 mfhdf/hrepack/hrepack_main.c                      |    202 +
 mfhdf/hrepack/hrepack_opttable.c                  |    277 +
 mfhdf/hrepack/hrepack_opttable.h                  |     43 +
 mfhdf/hrepack/hrepack_parse.c                     |    526 +
 mfhdf/hrepack/hrepack_parse.h                     |     45 +
 mfhdf/hrepack/hrepack_sds.c                       |   1063 +
 mfhdf/hrepack/hrepack_sds.h                       |     56 +
 mfhdf/hrepack/hrepack_utils.c                     |    550 +
 mfhdf/hrepack/hrepack_utils.h                     |     54 +
 mfhdf/hrepack/hrepack_vg.c                        |     76 +
 mfhdf/hrepack/hrepack_vg.h                        |     55 +
 mfhdf/hrepack/hrepack_vs.c                        |    337 +
 mfhdf/hrepack/hrepack_vs.h                        |     52 +
 mfhdf/hrepack/hrepacktst.c                        |   3473 +
 mfhdf/hrepack/image24pixel.txt                    | 101475 ++++++++++++++++
 mfhdf/hrepack/image24plane.txt                    | 101475 ++++++++++++++++
 mfhdf/hrepack/image8.txt                          | 120006 +++++++++++++++++++
 mfhdf/hrepack/info.txt                            |      1 +
 mfhdf/hrepack/pal_rgb.h                           |    279 +
 mfhdf/libsrc/CMakeLists.txt                       |    108 +
 mfhdf/libsrc/Makefile.am                          |     63 +
 mfhdf/libsrc/Makefile.in                          |    748 +
 mfhdf/libsrc/alloc.h                              |     66 +
 mfhdf/libsrc/array.c                              |    668 +
 mfhdf/libsrc/attr.c                               |    584 +
 mfhdf/libsrc/cdf.c                                |   3698 +
 mfhdf/libsrc/depend                               |    298 +
 mfhdf/libsrc/dim.c                                |    369 +
 mfhdf/libsrc/error.c                              |    183 +
 mfhdf/libsrc/error.h                              |     31 +
 mfhdf/libsrc/file.c                               |   1176 +
 mfhdf/libsrc/globdef.c                            |     50 +
 mfhdf/libsrc/hdf2netcdf.h                         |     73 +
 mfhdf/libsrc/hdfnctest.c                          |     47 +
 mfhdf/libsrc/hdfsds.c                             |   1840 +
 mfhdf/libsrc/iarray.c                             |    133 +
 mfhdf/libsrc/local_nc.h                           |    800 +
 mfhdf/libsrc/mfdatainfo.c                         |    916 +
 mfhdf/libsrc/mfdatainfo.h                         |     47 +
 mfhdf/libsrc/mfhdf.h                              |    500 +
 mfhdf/libsrc/mfhdfi.h                             |     28 +
 mfhdf/libsrc/mfprivate.h                          |     48 +
 mfhdf/libsrc/mfsd.c                               |   7907 ++
 mfhdf/libsrc/netcdf.h.in                          |    579 +
 mfhdf/libsrc/nssdc.c                              |    902 +
 mfhdf/libsrc/putget.c                             |   2777 +
 mfhdf/libsrc/putgetg.c                            |    270 +
 mfhdf/libsrc/sharray.c                            |    116 +
 mfhdf/libsrc/string.c                             |    233 +
 mfhdf/libsrc/var.c                                |    924 +
 mfhdf/libsrc/xdrposix.c                           |    688 +
 mfhdf/libsrc/xdrstdio.c                           |    347 +
 mfhdf/ncdump/CMakeLists.txt                       |     61 +
 mfhdf/ncdump/CMakeTests.cmake                     |     76 +
 mfhdf/ncdump/Makefile.am                          |     39 +
 mfhdf/ncdump/Makefile.in                          |    888 +
 mfhdf/ncdump/depend                               |     28 +
 mfhdf/ncdump/dumplib.c                            |    231 +
 mfhdf/ncdump/dumplib.h                            |     96 +
 mfhdf/ncdump/ncdump.1                             |    171 +
 mfhdf/ncdump/ncdump.c                             |    741 +
 mfhdf/ncdump/ncdump.h                             |     89 +
 mfhdf/ncdump/test0.cdl                            |     47 +
 mfhdf/ncdump/testncdump.sh.in                     |    123 +
 mfhdf/ncdump/vardata.c                            |    597 +
 mfhdf/ncdump/vardata.h                            |     31 +
 mfhdf/ncgen/CMakeLists.txt                        |     71 +
 mfhdf/ncgen/CMakeTests.cmake                      |    144 +
 mfhdf/ncgen/Makefile.am                           |    107 +
 mfhdf/ncgen/Makefile.in                           |    963 +
 mfhdf/ncgen/README                                |     19 +
 mfhdf/ncgen/close.c                               |     55 +
 mfhdf/ncgen/depend                                |     42 +
 mfhdf/ncgen/escapes.c                             |     92 +
 mfhdf/ncgen/generate.c                            |   1066 +
 mfhdf/ncgen/generic.h                             |     13 +
 mfhdf/ncgen/genlib.c                              |     96 +
 mfhdf/ncgen/genlib.h                              |     92 +
 mfhdf/ncgen/getfill.c                             |    131 +
 mfhdf/ncgen/init.c                                |     42 +
 mfhdf/ncgen/load.c                                |    525 +
 mfhdf/ncgen/main.c                                |    121 +
 mfhdf/ncgen/ncgen.1                               |    361 +
 mfhdf/ncgen/ncgen.h                               |     53 +
 mfhdf/ncgen/ncgen.l                               |    170 +
 mfhdf/ncgen/ncgen.y                               |    740 +
 mfhdf/ncgen/ncgentab.c                            |   2409 +
 mfhdf/ncgen/ncgentab.h                            |     95 +
 mfhdf/ncgen/ncgenyy.c                             |   1962 +
 mfhdf/ncgen/test0.cdl                             |     40 +
 mfhdf/ncgen/testncgen.sh.in                       |    140 +
 mfhdf/nctest/CMakeLists.txt                       |     70 +
 mfhdf/nctest/CMakeTests.cmake                     |     19 +
 mfhdf/nctest/Makefile.am                          |     37 +
 mfhdf/nctest/Makefile.in                          |    778 +
 mfhdf/nctest/README                               |     37 +
 mfhdf/nctest/add.c                                |    217 +
 mfhdf/nctest/add.h                                |     65 +
 mfhdf/nctest/atttests.c                           |   1377 +
 mfhdf/nctest/cdftests.c                           |    784 +
 mfhdf/nctest/depend                               |    293 +
 mfhdf/nctest/dimtests.c                           |    407 +
 mfhdf/nctest/driver.c                             |    152 +
 mfhdf/nctest/emalloc.c                            |     63 +
 mfhdf/nctest/emalloc.h                            |     30 +
 mfhdf/nctest/error.c                              |     78 +
 mfhdf/nctest/error.h                              |     59 +
 mfhdf/nctest/misctest.c                           |     64 +
 mfhdf/nctest/msoft.mk                             |    196 +
 mfhdf/nctest/nctest.def                           |     62 +
 mfhdf/nctest/nctest.lnk                           |      5 +
 mfhdf/nctest/nctest.mak                           |    370 +
 mfhdf/nctest/nctest.project.hqx                   |    649 +
 mfhdf/nctest/rec.c                                |    618 +
 mfhdf/nctest/slabs.c                              |    463 +
 mfhdf/nctest/test_unlim.cdl                       |     31 +
 mfhdf/nctest/test_unlim.nc                        |    Bin 0 -> 488 bytes
 mfhdf/nctest/testcdf.h                            |     67 +
 mfhdf/nctest/tests.h                              |    132 +
 mfhdf/nctest/val.c                                |    251 +
 mfhdf/nctest/val.h                                |     51 +
 mfhdf/nctest/vardef.c                             |    306 +
 mfhdf/nctest/varget.c                             |    147 +
 mfhdf/nctest/varget_unlim.c                       |    168 +
 mfhdf/nctest/vargetg.c                            |    154 +
 mfhdf/nctest/varput.c                             |    153 +
 mfhdf/nctest/varputg.c                            |    156 +
 mfhdf/nctest/vartests.c                           |    673 +
 mfhdf/nctest/vputget.c                            |    135 +
 mfhdf/nctest/vputgetg.c                           |    180 +
 mfhdf/test/CMakeLists.txt                         |    112 +
 mfhdf/test/CMakeTests.cmake                       |    134 +
 mfhdf/test/Makefile.am                            |     45 +
 mfhdf/test/Makefile.in                            |    806 +
 mfhdf/test/cdftest.c                              |    704 +
 mfhdf/test/cdftest.mak                            |    153 +
 mfhdf/test/gen_sds_szipped.c                      |    128 +
 mfhdf/test/hdfnctest.c                            |     53 +
 mfhdf/test/hdftest.c                              |   1660 +
 mfhdf/test/hdftest.h                              |     51 +
 mfhdf/test/sds_szipped.dat                        |    Bin 0 -> 3090 bytes
 mfhdf/test/smallslice.0000.nc                     |    Bin 0 -> 1128 bytes
 mfhdf/test/tattdatainfo.c                         |   1109 +
 mfhdf/test/tattributes.c                          |    292 +
 mfhdf/test/tchunk.c                               |   1661 +
 mfhdf/test/tcomp.c                                |    845 +
 mfhdf/test/tcoordvar.c                            |    654 +
 mfhdf/test/tdatainfo.c                            |   1783 +
 mfhdf/test/tdatasizes.c                           |    628 +
 mfhdf/test/tdim.c                                 |    792 +
 mfhdf/test/temptySDSs.c                           |    583 +
 mfhdf/test/test1.nc                               |    Bin 0 -> 852 bytes
 mfhdf/test/testmfhdf.sh.in                        |    106 +
 mfhdf/test/testout.sav                            |     21 +
 mfhdf/test/tfile.c                                |    392 +
 mfhdf/test/tmixed_apis.c                          |    562 +
 mfhdf/test/tncunlim.c                             |    876 +
 mfhdf/test/tncvargetfill.c                        |    745 +
 mfhdf/test/tnetcdf.c                              |    242 +
 mfhdf/test/trank0.c                               |    164 +
 mfhdf/test/tsd.c                                  |     86 +
 mfhdf/test/tsdsprops.c                            |    773 +
 mfhdf/test/tszip.c                                |   1477 +
 mfhdf/test/tunlim.c                               |    749 +
 mfhdf/test/tutils.c                               |     56 +
 mfhdf/util/getopt.c                               |     78 +
 mfhdf/util/msoft.mk                               |     21 +
 mfhdf/util/win32utl.mak                           |    140 +
 mfhdf/xdr/CMakeLists.txt                          |     50 +
 mfhdf/xdr/Makefile.am                             |     22 +
 mfhdf/xdr/Makefile.in                             |    841 +
 mfhdf/xdr/NOTICE.h                                |     28 +
 mfhdf/xdr/README                                  |     76 +
 mfhdf/xdr/byteordr.c                              |     72 +
 mfhdf/xdr/depend                                  |     50 +
 mfhdf/xdr/htonl.mar                               |      9 +
 mfhdf/xdr/msoft.mk                                |     64 +
 mfhdf/xdr/ntohl.mar                               |      9 +
 mfhdf/xdr/test_xdr.sav                            |    Bin 0 -> 28228 bytes
 mfhdf/xdr/testout.sav                             |     22 +
 mfhdf/xdr/types.h                                 |     50 +
 mfhdf/xdr/win32xdr.mak                            |    190 +
 mfhdf/xdr/xdr.c                                   |    551 +
 mfhdf/xdr/xdr.def                                 |     24 +
 mfhdf/xdr/xdr.h                                   |    254 +
 mfhdf/xdr/xdrarray.c                              |    126 +
 mfhdf/xdr/xdrfloat.c                              |    301 +
 mfhdf/xdr/xdrlib.project.hqx                      |   2016 +
 mfhdf/xdr/xdrstdio.c                              |    176 +
 mfhdf/xdr/xdrtest.c                               |    375 +
 mfhdf/xdr/xdrtest.cyg                             |     22 +
 mfhdf/xdr/xdrtest.mak                             |    149 +
 mfhdf/xdr/xdrtest.opt                             |      1 +
 mfhdf/xdr/xdrtest.out                             |     22 +
 mfhdf/xdr/xdrtest.project.hqx                     |    515 +
 move-if-change                                    |     15 +
 release_notes/HISTORY.txt                         |   5321 +
 release_notes/INSTALL                             |    192 +
 release_notes/INSTALL_CMake.txt                   |    930 +
 release_notes/INSTALL_CYGWIN.txt                  |    161 +
 release_notes/INSTALL_WINDOWS.txt                 |     16 +
 release_notes/RELEASE.txt                         |    298 +
 release_notes/USING_CMake_Examples.txt            |     96 +
 release_notes/USING_HDF4_CMake.txt                |    285 +
 release_notes/USING_HDF4_VS.txt                   |     86 +
 release_notes/bugs_fixed.txt                      |    345 +
 release_notes/misc_docs.txt                       |   3525 +
 upstream/HDF4.2r4.tar.gz                          |    Bin 3914118 -> 0 bytes
 1006 files changed, 747577 insertions(+)

diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
new file mode 100644
index 0000000..b2845f7
--- /dev/null
+++ b/CMakeFilters.cmake
@@ -0,0 +1,160 @@
+
+#-----------------------------------------------------------------------------
+# Options for HDF4 Filters
+#-----------------------------------------------------------------------------
+
+INCLUDE (ExternalProject)
+OPTION (HDF4_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO SVN TGZ)" "NO")
+IF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  OPTION (JPEG_USE_EXTERNAL "Use External Library Building for JPEG" 1)
+  OPTION (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1)
+  OPTION (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1)
+  IF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+    SET (JPEG_URL ${JPEG_SVN_URL})
+    SET (ZLIB_URL ${ZLIB_SVN_URL})
+    SET (SZIP_URL ${SZIP_SVN_URL})
+  ELSEIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+    IF (NOT TGZPATH)
+      SET (TGZPATH ${HDF4_SOURCE_DIR})
+    ENDIF (NOT TGZPATH)
+    SET (JPEG_URL ${TGZPATH}/${JPEG_TGZ_NAME})
+    SET (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
+    SET (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME})
+  ELSE (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+    SET (JPEG_USE_EXTERNAL 0)
+    SET (ZLIB_USE_EXTERNAL 0)
+    SET (SZIP_USE_EXTERNAL 0)
+  ENDIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ENDIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+
+#-----------------------------------------------------------------------------
+# Option for LibJpeg support
+#-----------------------------------------------------------------------------
+OPTION (HDF4_ENABLE_JPEG_LIB_SUPPORT "Enable libjpeg" ON)
+IF (HDF4_ENABLE_JPEG_LIB_SUPPORT)
+  IF (NOT H4_JPEGLIB_HEADER)
+    IF (NOT JPEG_USE_EXTERNAL)
+      FIND_PACKAGE (JPEG NAMES ${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+      IF (NOT JPEG_FOUND)
+        FIND_PACKAGE (JPEG) # Legacy find
+      ENDIF (NOT JPEG_FOUND)
+    ENDIF (NOT JPEG_USE_EXTERNAL)
+    IF (JPEG_FOUND)
+      SET (H4_HAVE_JPEGLIB_H 1)
+      SET (H4_HAVE_LIBJPEG 1)
+      SET (H4_JPEGLIB_HEADER "jpeglib.h")
+      SET (JPEG_INCLUDE_DIR_GEN ${JPEG_INCLUDE_DIR})
+      SET (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR})
+    ELSE (JPEG_FOUND)
+      IF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+        # May need to build JPEG with PIC on x64 machines with gcc
+        # Need to use CMAKE_ANSI_CFLAGS define so that compiler test works
+        IF (BUILD_JPEG_WITH_PIC)
+          SET (JPEG_CMAKE_C_FLAGS "-fPIC")
+        ELSE (BUILD_JPEG_WITH_PIC)
+          IF (DEFINED CMAKE_ANSI_CFLAGS)
+            SET (JPEG_CMAKE_C_FLAGS ${CMAKE_ANSI_CFLAGS})
+          ELSE (DEFINED CMAKE_ANSI_CFLAGS)
+            SET (JPEG_CMAKE_C_FLAGS " ")
+          ENDIF (DEFINED CMAKE_ANSI_CFLAGS)
+        ENDIF (BUILD_JPEG_WITH_PIC)
+
+        EXTERNAL_JPEG_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE} ${JPEG_CMAKE_C_FLAGS})
+        SET (H4_HAVE_JPEGLIB_H 1)
+        SET (H4_HAVE_LIBJPEG 1)
+        SET (H4_JPEGLIB_HEADER "jpeglib.h")
+        MESSAGE (STATUS "JPEGLIB is built")
+      ELSE (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+        MESSAGE (FATAL_ERROR " JPEGLib is Required for JPEGLib support in HDF4")
+      ENDIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+    ENDIF (JPEG_FOUND)
+  ELSE (NOT H4_JPEGLIB_HEADER)
+    # This project is being called from within another and JPEGLib is already configured
+    SET (H4_HAVE_JPEGLIB_H 1)
+  ENDIF (NOT H4_JPEGLIB_HEADER)
+  SET (LINK_LIBS ${LINK_LIBS} ${JPEG_LIBRARY})
+  INCLUDE_DIRECTORIES (${JPEG_INCLUDE_DIRS})
+  MESSAGE (STATUS "JPEGLIB is ON")
+ENDIF (HDF4_ENABLE_JPEG_LIB_SUPPORT)
+
+#-----------------------------------------------------------------------------
+# Option for ZLib support
+#-----------------------------------------------------------------------------
+OPTION (HDF4_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON)
+IF (HDF4_ENABLE_Z_LIB_SUPPORT)
+  IF (NOT H4_ZLIB_HEADER)
+    IF (NOT ZLIB_USE_EXTERNAL)
+      FIND_PACKAGE (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+      IF (NOT ZLIB_FOUND)
+        FIND_PACKAGE (ZLIB) # Legacy find
+      ENDIF (NOT ZLIB_FOUND)
+    ENDIF (NOT ZLIB_USE_EXTERNAL)
+    IF (ZLIB_FOUND)
+      SET (H4_HAVE_FILTER_DEFLATE 1)
+      SET (H4_HAVE_ZLIB_H 1)
+      SET (H4_HAVE_LIBZ 1)
+      SET (H4_ZLIB_HEADER "zlib.h")
+      SET (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
+      SET (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
+    ELSE (ZLIB_FOUND)
+      IF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+        EXTERNAL_ZLIB_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE})
+        SET (H4_HAVE_FILTER_DEFLATE 1)
+        SET (H4_HAVE_ZLIB_H 1)
+        SET (H4_HAVE_LIBZ 1)
+        MESSAGE (STATUS "Filter ZLIB is built")
+      ELSE (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+        MESSAGE (FATAL_ERROR " ZLib is Required for ZLib support in HDF4")
+      ENDIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+    ENDIF (ZLIB_FOUND)
+  ELSE (NOT H4_ZLIB_HEADER)
+    # This project is being called from within another and ZLib is already configured
+    SET (H4_HAVE_FILTER_DEFLATE 1)
+    SET (H4_HAVE_ZLIB_H 1)
+    SET (H4_HAVE_LIBZ 1)
+  ENDIF (NOT H4_ZLIB_HEADER)
+  SET (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES})
+  INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
+  MESSAGE (STATUS "Filter ZLIB is ON")
+ENDIF (HDF4_ENABLE_Z_LIB_SUPPORT)
+
+#-----------------------------------------------------------------------------
+# Option for SzLib support
+#-----------------------------------------------------------------------------
+OPTION (HDF4_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF)
+SET (SZIP_INFO "disabled")
+IF (HDF4_ENABLE_SZIP_SUPPORT)
+  OPTION (HDF4_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
+  IF (NOT SZIP_USE_EXTERNAL)
+    FIND_PACKAGE (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+    IF (NOT SZIP_FOUND)
+      FIND_PACKAGE (SZIP) # Legacy find
+    ENDIF (NOT SZIP_FOUND)
+  ENDIF (NOT SZIP_USE_EXTERNAL)
+  IF (SZIP_FOUND)
+    SET (H4_HAVE_FILTER_SZIP 1)
+    SET (H4_HAVE_SZLIB_H 1)
+    SET (H4_HAVE_LIBSZ 1)
+    SET (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
+    SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
+  ELSE (SZIP_FOUND)
+    IF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+      EXTERNAL_SZIP_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE} ${HDF4_ENABLE_SZIP_ENCODING})
+      SET (H4_HAVE_FILTER_SZIP 1)
+      SET (H4_HAVE_SZLIB_H 1)
+      SET (H4_HAVE_LIBSZ 1)
+      MESSAGE (STATUS "Filter SZIP is built")
+    ELSE (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+      MESSAGE (FATAL_ERROR "SZIP is Required for SZIP support in HDF4")
+    ENDIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  ENDIF (SZIP_FOUND)
+  SET (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
+  INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
+  MESSAGE (STATUS "Filter SZIP is ON")
+  IF (HDF4_ENABLE_SZIP_ENCODING)
+    SET (H4_HAVE_SZIP_ENCODER 1)
+    SET (SZIP_INFO "enabled with encoder")
+  ELSE (HDF4_ENABLE_SZIP_ENCODING)
+    SET (SZIP_INFO "enabled with decoder only")
+  ENDIF (HDF4_ENABLE_SZIP_ENCODING)
+ENDIF (HDF4_ENABLE_SZIP_SUPPORT)
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake
new file mode 100644
index 0000000..9cc99e3
--- /dev/null
+++ b/CMakeInstallation.cmake
@@ -0,0 +1,358 @@
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_INSTALL_NO_DEVELOPMENT)
+  INSTALL (
+      FILES ${PROJECT_BINARY_DIR}/h4config.h
+      DESTINATION ${HDF4_INSTALL_INCLUDE_DIR}
+      COMPONENT headers
+  )
+ENDIF (NOT HDF4_INSTALL_NO_DEVELOPMENT)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  INSTALL (
+      EXPORT ${HDF4_EXPORTED_TARGETS}
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      FILE ${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Export all exported targets to the build tree for use by parent project
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  EXPORT (
+      TARGETS ${HDF4_LIBRARIES_TO_EXPORT} ${HDF4_LIB_DEPENDENCIES}
+      FILE ${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
+  )
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Configure the hdf4-config.cmake file for the build directory
+#-----------------------------------------------------------------------------
+SET (HDF4_INCLUDES_BUILD_TIME
+    ${HDF4_HDF_SOURCE_DIR}
+    ${HDF4_MFHDF_SOURCE_DIR}
+    ${HDF4_MFHDF_XDR_DIR}
+    ${HDF4_BINARY_DIR}
+)
+SET (HDF4_VERSION_STRING @HDF4_PACKAGE_VERSION@)
+SET (HDF4_VERSION_MAJOR  @HDF4_PACKAGE_VERSION_MAJOR@)
+SET (HDF4_VERSION_MINOR  @HDF4_PACKAGE_VERSION_MINOR@)
+
+CONFIGURE_FILE (
+    ${HDF4_RESOURCES_DIR}/hdf4-config.cmake.build.in 
+    ${HDF4_BINARY_DIR}/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY
+)
+
+#-----------------------------------------------------------------------------
+# Configure the FindHDF4.cmake file for the install directory
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  CONFIGURE_FILE (
+      ${HDF4_RESOURCES_DIR}/FindHDF4.cmake.in 
+      ${HDF4_BINARY_DIR}/CMakeFiles/FindHDF4${HDF_PACKAGE_EXT}.cmake @ONLY
+  )
+  INSTALL (
+      FILES ${HDF4_BINARY_DIR}/CMakeFiles/FindHDF4${HDF_PACKAGE_EXT}.cmake
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+
+#-----------------------------------------------------------------------------
+# Configure the HDF4-config.cmake file for the install directory
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  CONFIGURE_FILE (
+      ${HDF4_RESOURCES_DIR}/hdf4-config.cmake.install.in
+      ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY
+  )
+  INSTALL (
+      FILES ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Configure the hdf4-config-version .cmake file for the install directory
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  CONFIGURE_FILE (
+      ${HDF4_RESOURCES_DIR}/hdf4-config-version.cmake.in
+      ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY
+  )
+  INSTALL (
+      FILES ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      COMPONENT configinstall
+  )
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Configure the libhdf4.settings file for the lib info
+#-----------------------------------------------------------------------------
+IF (H4_WORDS_BIGENDIAN)
+  SET (BYTESEX big-endian)
+ELSE (H4_WORDS_BIGENDIAN)
+  SET (BYTESEX little-endian)
+ENDIF (H4_WORDS_BIGENDIAN)
+CONFIGURE_FILE (
+    ${HDF4_RESOURCES_DIR}/libhdf4.settings.cmake.in 
+    ${HDF4_BINARY_DIR}/libhdf4.settings @ONLY
+)
+INSTALL (
+    FILES ${HDF4_BINARY_DIR}/libhdf4.settings
+    DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+    COMPONENT libraries
+)
+
+#-----------------------------------------------------------------------------
+# Configure the HDF4_Examples.cmake file and the examples
+#-----------------------------------------------------------------------------
+OPTION (HDF4_PACK_EXAMPLES  "Package the HDF4 Library Examples Compressed File" OFF)
+IF (HDF4_PACK_EXAMPLES)
+  CONFIGURE_FILE (
+      ${HDF4_RESOURCES_DIR}/HDF4_Examples.cmake.in 
+      ${HDF4_BINARY_DIR}/HDF4_Examples.cmake @ONLY
+  )
+  INSTALL (
+      FILES ${HDF4_BINARY_DIR}/HDF4_Examples.cmake
+      DESTINATION ${HDF4_INSTALL_DATA_DIR}
+      COMPONENT hdfdocuments
+  )
+  IF (EXISTS "${HDF4_EXAMPLES_COMPRESSED_DIR}/${HDF4_EXAMPLES_COMPRESSED}")
+    INSTALL (
+        FILES
+            ${HDF4_EXAMPLES_COMPRESSED_DIR}/${HDF4_EXAMPLES_COMPRESSED}
+            ${HDF4_SOURCE_DIR}/release_notes/USING_CMake_Examples.txt
+        DESTINATION ${HDF4_INSTALL_DATA_DIR}
+        COMPONENT hdfdocuments
+    )
+  ENDIF (EXISTS "${HDF4_EXAMPLES_COMPRESSED_DIR}/${HDF4_EXAMPLES_COMPRESSED}")
+ENDIF (HDF4_PACK_EXAMPLES)
+
+#-----------------------------------------------------------------------------
+# Add Document File(s) to CMake Install
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  INSTALL (
+      FILES
+          ${HDF4_SOURCE_DIR}/COPYING
+      DESTINATION ${HDF4_INSTALL_DATA_DIR}
+      COMPONENT hdfdocuments
+  )
+  IF (EXISTS "${HDF4_SOURCE_DIR}/release_notes" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/release_notes")
+    SET (release_files
+        ${HDF4_SOURCE_DIR}/release_notes/USING_HDF4_CMake.txt
+        ${HDF4_SOURCE_DIR}/release_notes/RELEASE.txt
+    )
+    IF (WIN32 AND NOT CYGWIN)
+      SET (release_files
+          ${release_files}
+          ${HDF4_SOURCE_DIR}/release_notes/USING_HDF4_VS.txt
+      )
+    ENDIF (WIN32 AND NOT CYGWIN)
+    IF (HDF5_PACK_INSTALL_DOCS)
+      SET (release_files
+          ${release_files}
+          ${HDF4_SOURCE_DIR}/release_notes/INSTALL_CMake.txt
+          ${HDF4_SOURCE_DIR}/release_notes/HISTORY.txt
+          ${HDF4_SOURCE_DIR}/release_notes/INSTALL
+      )
+      IF (WIN32)
+        IF (NOT CYGWIN)
+          SET (release_files
+              ${release_files}
+              ${HDF5_SOURCE_DIR}/release_notes/INSTALL_Windows.txt
+          )
+        ELSE (NOT CYGWIN)
+          SET (release_files
+              ${release_files}
+              ${HDF5_SOURCE_DIR}/release_notes/INSTALL_Cygwin.txt
+          )
+        ENDIF (NOT CYGWIN)
+      ENDIF (WIN32)
+    ENDIF (HDF5_PACK_INSTALL_DOCS)
+    INSTALL (
+        FILES ${release_files}
+        DESTINATION ${HDF4_INSTALL_DATA_DIR}
+        COMPONENT hdfdocuments
+    )
+  ENDIF (EXISTS "${HDF4_SOURCE_DIR}/release_notes" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/release_notes")
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Set the cpack variables
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
+  SET (CPACK_PACKAGE_VENDOR "HDF_Group")
+  SET (CPACK_PACKAGE_NAME "${HDF4_PACKAGE_NAME}")
+  SET (CPACK_PACKAGE_VERSION "${HDF4_PACKAGE_VERSION}")
+  SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF4_PACKAGE_VERSION_MAJOR}")
+  SET (CPACK_PACKAGE_VERSION_MINOR "${HDF4_PACKAGE_VERSION_MINOR}")
+  SET (CPACK_PACKAGE_VERSION_PATCH "")
+  SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
+  SET (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_notes/RELEASE.txt")
+  SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
+  SET (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_notes/RELEASE.txt")
+  SET (CPACK_PACKAGE_RELOCATABLE TRUE)
+
+  SET (CPACK_GENERATOR "TGZ") 
+  IF (WIN32)
+    LIST (APPEND CPACK_GENERATOR "NSIS") 
+    # Installers for 32- vs. 64-bit CMake:
+    #  - Root install directory (displayed to end user at installer-run time)
+    #  - "NSIS package/display name" (text used in the installer GUI)
+    #  - Registry key used to store info about the installation
+    IF (CMAKE_CL_64)
+      SET (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
+      SET (CPACK_NSIS_PACKAGE_NAME "${HDF4_PACKAGE_STRING} (Win64)")
+      SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${HDF4_PACKAGE_STRING}-${LIB_TYPE} (Win64)")
+    ELSE (CMAKE_CL_64)
+      SET (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
+      SET (CPACK_NSIS_PACKAGE_NAME "${HDF4_PACKAGE_STRING}")
+      SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${HDF4_PACKAGE_STRING}-${LIB_TYPE}")
+    ENDIF (CMAKE_CL_64)
+    SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}")
+    SET (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${LIB_TYPE}")
+    SET (CPACK_MONOLITHIC_INSTALL ON)
+    SET (CPACK_NSIS_CONTACT "${HDF4_PACKAGE_BUGREPORT}")
+    SET (CPACK_NSIS_MODIFY_PATH ON)
+  ELSEIF (APPLE)
+    LIST (APPEND CPACK_GENERATOR "DragNDrop") 
+    SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
+    SET (CPACK_PACKAGE_DEFAULT_LOCATION "/opt/${CPACK_PACKAGE_NAME}")
+    SET (CPACK_PACKAGING_INSTALL_PREFIX "/")
+    SET (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
+    SET (CPACK_PACKAGE_ICON "${HDF4_RESOURCES_DIR}/hdf.gif")
+    SET (CPACK_SET_DESTDIR TRUE) # Required when packaging, and set CMAKE_INSTALL_PREFIX to "/".
+
+    IF (HDF4_PACK_MACOSX_BUNDLE)
+      LIST (APPEND CPACK_GENERATOR "Bundle")
+      SET (CPACK_BUNDLE_NAME "${HDF4_PACKAGE_STRING}")
+      SET (CPACK_BUNDLE_LOCATION "/")    # make sure CMAKE_INSTALL_PREFIX ends in /
+      SET (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/")
+      SET (CPACK_BUNDLE_ICON "${HDF4_RESOURCES_DIR}/hdf.gif")
+      SET (CPACK_BUNDLE_PLIST "${HDF4_BINARY_DIR}/CMakeFiles/Info.plist")
+      SET (CPACK_APPLE_GUI_INFO_STRING "Hierarchical Data Format (HDF) Software Library and Utilities")
+      SET (CPACK_APPLE_GUI_COPYRIGHT "Copyright © 2006-2014 by The HDF Group. All rights reserved.")
+      SET (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}")
+      #-----------------------------------------------------------------------------
+      # Configure the Info.plist file for the install bundle
+      #-----------------------------------------------------------------------------
+      CONFIGURE_FILE (
+          ${HDF4_RESOURCES_DIR}/CPack.Info.plist.in
+          ${HDF4_BINARY_DIR}/CMakeFiles/Info.plist @ONLY
+      )
+    ENDIF (HDF4_PACK_MACOSX_BUNDLE)
+  ELSE (WIN32)
+    LIST (APPEND CPACK_GENERATOR "STGZ") 
+    SET (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}")
+    SET (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
+
+    SET (CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
+    SET (CPACK_DEBIAN_PACKAGE_MAINTAINER "${HDF4_PACKAGE_BUGREPORT}")
+    
+    SET (CPACK_RPM_COMPONENT_INSTALL ON)
+    SET (CPACK_RPM_PACKAGE_RELOCATABLE ON)
+    SET (CPACK_RPM_PACKAGE_LICENSE "BSD-style")
+    SET (CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
+    SET (CPACK_RPM_PACKAGE_URL "${HDF4_PACKAGE_URL}")
+  ENDIF (WIN32)
+
+  INCLUDE(InstallRequiredSystemLibraries)
+
+  SET (CPACK_INSTALL_CMAKE_PROJECTS "${HDF4_BINARY_DIR};HDF4;ALL;/")
+  
+  IF (HDF4_PACKAGE_EXTLIBS)
+    IF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+      IF (JPEG_FOUND AND JPEG_USE_EXTERNAL)
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;libraries;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;headers;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;configinstall;/")
+      ENDIF (JPEG_FOUND AND JPEG_USE_EXTERNAL)
+      IF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;headers;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;configinstall;/")
+      ENDIF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
+      IF (SZIP_FOUND AND SZIP_USE_EXTERNAL)
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;headers;/")
+        SET (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;configinstall;/")
+      ENDIF (SZIP_FOUND AND SZIP_USE_EXTERNAL)
+    ENDIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  ENDIF (HDF4_PACKAGE_EXTLIBS)
+
+  INCLUDE (CPack)
+
+  #-----------------------------------------------------------------------------
+  # Now list the cpack commands
+  #-----------------------------------------------------------------------------
+  CPACK_ADD_COMPONENT (applications 
+      DISPLAY_NAME "HDF4 Applications" 
+      DEPENDS libraries
+      GROUP Applications
+  )
+  CPACK_ADD_COMPONENT (libraries 
+      DISPLAY_NAME "HDF4 Libraries"
+      GROUP Runtime
+  )
+  CPACK_ADD_COMPONENT (headers 
+      DISPLAY_NAME "HDF4 Headers" 
+      DEPENDS libraries
+      GROUP Development
+  )
+  CPACK_ADD_COMPONENT (hdfdocuments 
+      DISPLAY_NAME "HDF4 Documents"
+      GROUP Documents
+  )
+  CPACK_ADD_COMPONENT (configinstall 
+      DISPLAY_NAME "HDF4 CMake files" 
+      DEPENDS libraries
+      GROUP Development
+  )
+
+  IF (HDF4_BUILD_FORTRAN)
+    CPACK_ADD_COMPONENT (fortlibraries 
+        DISPLAY_NAME "HDF4 Fortran Libraries" 
+        DEPENDS libraries
+        GROUP Runtime
+    )
+  ENDIF (HDF4_BUILD_FORTRAN)
+
+  IF (HDF4_BUILD_TOOLS)
+    CPACK_ADD_COMPONENT (toolsapplications 
+        DISPLAY_NAME "HDF4 Tools Applications" 
+        DEPENDS libraries
+        GROUP Applications
+    )
+    CPACK_ADD_COMPONENT (toolsheaders 
+        DISPLAY_NAME "HDF4 Tools Headers" 
+        DEPENDS libraries
+        GROUP Development
+    )
+  ENDIF (HDF4_BUILD_TOOLS)
+
+  IF (HDF4_BUILD_UTILS)
+    CPACK_ADD_COMPONENT (utilsapplications 
+        DISPLAY_NAME "HDF4 Utility Applications" 
+        DEPENDS libraries
+        GROUP Applications
+    )
+    CPACK_ADD_COMPONENT (utilsheaders 
+        DISPLAY_NAME "HDF4 Utility Headers" 
+        DEPENDS libraries
+        GROUP Development
+    )
+  ENDIF (HDF4_BUILD_UTILS)
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
+  
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..ba2cf13
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,603 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4 C CXX)
+
+#-----------------------------------------------------------------------------
+# Instructions for use : Normal Build
+#
+# For standard build of HDF4 libraries,tests and tools. 
+# Run cmake using the HDF4 source tree to generate a build tree.
+# Enable/Disable options according to requirements and
+# set CMAKE_INSTALL_PREFIX to the required install path.
+# Make install can be used to install all components for system-wide use.
+#
+#-----------------------------------------------------------------------------
+# Instructions for use : Sub-Project Build
+#
+# To include HDF4 as a sub-project within another project. 
+# Set HDF4_EXTERNALLY_CONFIGURED to 1 in the parent project and
+# supply values for the following variables...
+#
+# HDF4_EXPORTED_TARGETS :
+#   Set this to the name of the targets variable which controls exports
+#   If unset (because parent project does not support/use the 
+#   INSTALL (EXPORT target...) syntax), then targets are not configured 
+#   for export during install.
+#
+# HDF4_LIB_DEPENDENCIES :
+#   If the build of HDF4 libs is being customized, then rules for the
+#   dependencies of the HDF4 libs may be 'incomplete', add additional
+#   dependencies to this variable so that external projects pick them up
+#
+# HDF4_EXTERNAL_LIB_PREFIX :
+#   If the parent project needs to install hdf libraries, but avoid 
+#   name conflicts with system versions, then a prefix may be added
+#   to ensure that the correct versions configured are used.
+#
+# Consider this example, it builds its own zlib
+# library and tells HDF4 to add it as a dependency - this ensures that
+# any project making use of this build of HDF4 will use the correct zlib
+#
+#   # Tell hdf4 that we are manually overriding certain settings
+#   SET (HDF4_EXTERNALLY_CONFIGURED 1)
+#   # Avoid duplicating names of installed libraries
+#   SET (HDF4_EXTERNAL_LIB_PREFIX "prj")
+#   # Targets linking to the HDF4 libs need to know their names
+#   # if they are changed in the sub project, they should be here too
+#   SET (HDF4_LIB_NAME "prjhdf4")
+#   SET (HDF4_MF_LIB_NAME "prjhdf4_mf")
+#   SET (HDF4_LIBRARY "${HDF4_LIB_NAME};${HDF4_MF_LIB_NAME}")
+#   # Export configuration to this export variable
+#   SET (HDF4_EXPORTED_TARGETS "project-targets")
+#
+#   # Setup all necessary overrides for zlib so that HDF4 uses our
+#   # internally compiled zlib rather than any other version
+#   IF (HDF4_ENABLE_Z_LIB_SUPPORT)
+#    # We must tell the main HDF4 library that it depends on our zlib 
+#     SET (HDF4_LIB_DEPENDENCIES prjzlib)    
+#     # Override the zlib header file
+#     IF (PRJ_USE_SYSTEM_ZLIB)
+#       SET (H4_ZLIB_HEADER "zlib.h")
+#     ELSE (PRJ_USE_SYSTEM_ZLIB)
+#      SET (H4_ZLIB_HEADER "prj_zlib.h")
+#       # Set vars that FindZlib would have set if used in sub project
+#       SET (ZLIB_INCLUDE_DIRS "${PRJ_ZLIB_INCLUDE_DIRS}")
+#       SET (ZLIB_LIBRARIES prjzlib)
+#     ENDIF (PRJ_USE_SYSTEM_ZLIB)
+#  ENDIF (HDF4_ENABLE_Z_LIB_SUPPORT)
+#   
+#   # Add the sub project
+#   ADD_SUBDIRECTORY (Utilities/hdf4.2.5)
+#   # Add the HDF4 dirs to our include path
+#   SET (HDF4_INCLUDE_DIR 
+#       ${PROJECT_SOURCE_DIR}/Utilities/hdf4.2.5/hdf/src
+#       ${PROJECT_BINARY_DIR}/Utilities/hdf4.2.5
+#       ${PROJECT_SOURCE_DIR}/Utilities/hdf4.2.5/mfhdf/libsrc
+#   )
+#
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Allow Visual Studio solution directories
+#-----------------------------------------------------------------------------
+# Provide a way for Visual Studio Express users to turn OFF the new FOLDER
+# organization feature. Default to ON for non-Express users. Express users must
+# explicitly turn off this option to build HDF5 in the Express IDE...
+#
+OPTION (HDF4_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
+MARK_AS_ADVANCED (HDF4_USE_FOLDERS)
+IF (HDF4_USE_FOLDERS)
+  SET_PROPERTY (GLOBAL PROPERTY USE_FOLDERS ON)
+ENDIF (HDF4_USE_FOLDERS)
+OPTION (HDF4_NO_PACKAGES "CPACK - Disable packaging" OFF)
+MARK_AS_ADVANCED (HDF4_NO_PACKAGES)
+
+#-----------------------------------------------------------------------------
+# Set the core names of all the libraries
+#-----------------------------------------------------------------------------
+SET (HDF4_LIB_CORENAME              "hdf4")
+SET (HDF4_SRC_LIB_CORENAME          "hdf")
+SET (HDF4_SRC_FCSTUB_LIB_CORENAME   "hdf_fcstub")
+SET (HDF4_SRC_FORTRAN_LIB_CORENAME  "hdf_fortran")
+SET (HDF4_MF_LIB_CORENAME           "mfhdf")
+SET (HDF4_MF_XDR_LIB_CORENAME       "xdr")
+SET (HDF4_HDF_TEST_LIB_CORENAME     "hdf_test")
+SET (HDF4_HDF_TEST_FCSTUB_LIB_CORENAME     "hdf_test_fcstub")
+SET (HDF4_MF_FCSTUB_LIB_CORENAME    "mfhdf_fcstub")
+SET (HDF4_MF_FORTRAN_LIB_CORENAME   "mfhdf_fortran")
+SET (HDF4_MF_TEST_LIB_CORENAME      "mf_test")
+SET (HDF4_TOOLS_LIB_CORENAME        "h4tools")
+
+#-----------------------------------------------------------------------------
+# Set the true names of all the libraries if customized by external project
+#-----------------------------------------------------------------------------
+SET (HDF4_LIB_NAME              "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_LIB_CORENAME}")
+SET (HDF4_SRC_LIB_NAME          "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_LIB_CORENAME}")
+SET (HDF4_SRC_FCSTUB_LIB_NAME   "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FCSTUB_LIB_CORENAME}")
+SET (HDF4_SRC_FORTRAN_LIB_NAME  "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FORTRAN_LIB_CORENAME}")
+SET (HDF4_MF_LIB_NAME           "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_LIB_CORENAME}")
+SET (HDF4_MF_XDR_LIB_NAME       "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_XDR_LIB_CORENAME}")
+SET (HDF4_HDF_TEST_LIB_NAME     "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_HDF_TEST_LIB_CORENAME}")
+SET (HDF4_HDF_TEST_FCSTUB_LIB_NAME     "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_HDF_TEST_FCSTUB_LIB_CORENAME}")
+SET (HDF4_MF_FCSTUB_LIB_NAME    "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_FCSTUB_LIB_CORENAME}")
+SET (HDF4_MF_FORTRAN_LIB_NAME   "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_FORTRAN_LIB_CORENAME}")
+SET (HDF4_MF_TEST_LIB_NAME      "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_TEST_LIB_CORENAME}")
+SET (HDF4_TOOLS_LIB_NAME        "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_TOOLS_LIB_CORENAME}")
+
+#-----------------------------------------------------------------------------
+# Set the target names of all the libraries
+#-----------------------------------------------------------------------------
+SET (HDF4_LIB_TARGET              ${HDF4_LIB_CORENAME})
+SET (HDF4_SRC_LIB_TARGET          ${HDF4_SRC_LIB_CORENAME})
+SET (HDF4_SRC_FCSTUB_LIB_TARGET   ${HDF4_SRC_FCSTUB_LIB_CORENAME})
+SET (HDF4_SRC_FORTRAN_LIB_TARGET  ${HDF4_SRC_FORTRAN_LIB_CORENAME})
+SET (HDF4_MF_LIB_TARGET           ${HDF4_MF_LIB_CORENAME})
+SET (HDF4_MF_XDR_LIB_TARGET       ${HDF4_MF_XDR_LIB_CORENAME})
+SET (HDF4_HDF_TEST_LIB_TARGET     ${HDF4_HDF_TEST_LIB_CORENAME})
+SET (HDF4_HDF_TEST_FCSTUB_LIB_TARGET     ${HDF4_HDF_TEST_FCSTUB_LIB_CORENAME})
+SET (HDF4_MF_FCSTUB_LIB_TARGET    ${HDF4_MF_FCSTUB_LIB_CORENAME})
+SET (HDF4_MF_FORTRAN_LIB_TARGET   ${HDF4_MF_FORTRAN_LIB_CORENAME})
+SET (HDF4_MF_TEST_LIB_TARGET      ${HDF4_MF_TEST_LIB_CORENAME})
+SET (HDF4_TOOLS_LIB_TARGET        ${HDF4_TOOLS_LIB_CORENAME})
+
+#-----------------------------------------------------------------------------
+# Define some CMake variables for use later in the project
+#-----------------------------------------------------------------------------
+SET (HDF4_RESOURCES_DIR       ${HDF4_SOURCE_DIR}/config/cmake)
+SET (HDF4_HDFSOURCE_DIR       ${HDF4_SOURCE_DIR}/hdf/src)
+SET (HDF4_HDF_TESTSOURCE_DIR  ${HDF4_SOURCE_DIR}/hdf/test)
+SET (HDF4_MFHDFSOURCE_DIR     ${HDF4_SOURCE_DIR}/mfhdf/libsrc)
+SET (HDF4_MFHDF_TEST_DIR      ${HDF4_SOURCE_DIR}/mfhdf/test)
+SET (HDF4_MFHDF_FORTRAN_DIR   ${HDF4_SOURCE_DIR}/mfhdf/fortran)
+SET (HDF4_MFHDF_XDR_DIR       ${HDF4_SOURCE_DIR}/mfhdf/xdr)
+
+IF (NOT HDF4_INSTALL_BIN_DIR)
+  SET (HDF4_INSTALL_BIN_DIR bin)
+  SET (HDF4_INSTALL_UTILS_BIN_DIR ${HDF4_INSTALL_BIN_DIR}) #${HDF4_INSTALL_BIN_DIR}/utils
+  SET (HDF4_INSTALL_TOOLS_BIN_DIR ${HDF4_INSTALL_BIN_DIR}) #${HDF4_INSTALL_BIN_DIR}/tools
+ENDIF (NOT HDF4_INSTALL_BIN_DIR)
+IF (NOT HDF4_INSTALL_LIB_DIR)
+  SET (HDF4_INSTALL_LIB_DIR lib)
+ENDIF (NOT HDF4_INSTALL_LIB_DIR)
+IF (NOT HDF4_INSTALL_INCLUDE_DIR)
+  SET (HDF4_INSTALL_INCLUDE_DIR include)
+ENDIF (NOT HDF4_INSTALL_INCLUDE_DIR)
+IF (NOT HDF4_INSTALL_DATA_DIR)
+  IF (NOT WIN32)
+    SET (HDF4_INSTALL_DATA_DIR share)
+    SET (HDF4_INSTALL_CMAKE_DIR share/cmake)
+  ELSE (NOT WIN32)
+    SET (HDF4_INSTALL_DATA_DIR ".")
+    SET (HDF4_INSTALL_CMAKE_DIR cmake)
+  ENDIF (NOT WIN32)
+ENDIF (NOT HDF4_INSTALL_DATA_DIR)
+
+#-----------------------------------------------------------------------------
+# parse the full version number from hfile.h and include in H4_VERS_INFO
+#-----------------------------------------------------------------------------
+FILE (READ ${HDF4_HDFSOURCE_DIR}/hfile.h _hfile_h_contents)
+STRING (REGEX REPLACE ".*#define[ \t]+LIBVER_MAJOR[ \t]+([0-9]*).*$"
+    "\\1" H4_VERS_MAJOR ${_hfile_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+LIBVER_MINOR[ \t]+([0-9]*).*$"
+    "\\1" H4_VERS_MINOR ${_hfile_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+LIBVER_RELEASE[ \t]+([0-9]*).*$"
+    "\\1" H4_VERS_RELEASE ${_hfile_h_contents})
+STRING (REGEX REPLACE ".*#define[ \t]+LIBVER_SUBRELEASE[ \t]+\"([0-9A-Za-z.]*)\".*$"
+    "\\1" H4_VERS_SUBRELEASE ${_hfile_h_contents})
+#MESSAGE (STATUS "VERSION: ${H4_VERS_MAJOR}.${H4_VERS_MINOR}.${H4_VERS_RELEASE}-${H4_VERS_SUBRELEASE}")
+
+#-----------------------------------------------------------------------------
+# Basic HDF4 stuff here
+#-----------------------------------------------------------------------------
+SET (HDF4_PACKAGE "hdf4")
+SET (HDF4_PACKAGE_NAME "HDF")
+SET (HDF4_PACKAGE_VERSION "${H4_VERS_MAJOR}.${H4_VERS_MINOR}.${H4_VERS_RELEASE}")
+SET (HDF4_PACKAGE_VERSION_MAJOR "${H4_VERS_MAJOR}.${H4_VERS_MINOR}")
+SET (HDF4_PACKAGE_VERSION_MINOR "${H4_VERS_RELEASE}")
+SET (HDF4_PACKAGE_VERSION_STRING "${HDF4_PACKAGE_VERSION}-${H4_VERS_SUBRELEASE}")
+SET (HDF4_PACKAGE_STRING "${HDF4_PACKAGE_NAME} ${HDF4_PACKAGE_VERSION_STRING}")
+SET (HDF5_PACKAGE_TARNAME "${HDF4_PACKAGE}${HDF_PACKAGE_EXT}")
+SET (HDF4_PACKAGE_URL "http://www.hdfgroup.org")
+SET (HDF4_PACKAGE_BUGREPORT "help at hdfgroup.org")
+
+#-----------------------------------------------------------------------------
+# Include some macros for reusable code
+#-----------------------------------------------------------------------------
+INCLUDE (${HDF4_RESOURCES_DIR}/HDFMacros.cmake)
+INCLUDE (${HDF4_RESOURCES_DIR}/HDFLibMacros.cmake)
+INCLUDE (${HDF4_RESOURCES_DIR}/HDF4Macros.cmake)
+
+#-----------------------------------------------------------------------------
+# Setup output Directories
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY
+      ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables."
+  )
+  SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
+      ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries"
+  )
+  SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
+      ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries."
+  )
+  SET (CMAKE_Fortran_MODULE_DIRECTORY
+      ${PROJECT_BINARY_DIR}/bin/fortran CACHE PATH "Single Directory for all fortran modules."
+  )
+ELSE (NOT HDF4_EXTERNALLY_CONFIGURED)
+  # if we are externally configured, but the project uses old cmake scripts
+  # this may not be set and utilities like Hdetect will fail
+  IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+    SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
+  ENDIF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Targets built within this project are exported at Install time for use
+# by other projects using FindHDF4.
+#-----------------------------------------------------------------------------
+IF (NOT HDF4_EXPORTED_TARGETS)
+  SET (HDF4_EXPORTED_TARGETS "hdf4-targets")
+ENDIF (NOT HDF4_EXPORTED_TARGETS)
+
+#-----------------------------------------------------------------------------
+# To include a library in the list exported by the project AT BUILD TIME,
+# add it to this variable. This is NOT used by Make Install, but for projects
+# which include hdf4 as a sub-project within their build tree
+#-----------------------------------------------------------------------------
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "")
+SET (EXTERNAL_HEADER_LIST "")
+SET (EXTERNAL_LIBRARY_LIST "")
+SET (EXTERNAL_LIBRARYDLL_LIST "")
+
+#-----------------------------------------------------------------------------
+# Run all the CMake configuration tests for our build environment
+#-----------------------------------------------------------------------------
+INCLUDE (${HDF4_RESOURCES_DIR}/ConfigureChecks.cmake)
+
+#-----------------------------------------------------------------------------
+# Option to Build Shared/Static libs, default is static
+#-----------------------------------------------------------------------------
+OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
+SET (LIB_TYPE STATIC)
+SET (H4_ENABLE_SHARED_LIB NO)
+SET (H4_ENABLE_STATIC_LIB NO)
+IF (BUILD_SHARED_LIBS)
+  SET (LIB_TYPE SHARED)
+  SET (H4_BUILT_AS_DYNAMIC_LIB 1)
+  SET (H4_ENABLE_SHARED_LIB YES)
+ELSE (BUILD_SHARED_LIBS)
+  SET (H4_BUILT_AS_STATIC_LIB 1)
+  SET (H4_ENABLE_STATIC_LIB YES)
+  IF (NOT WIN32)
+    # should this be a user setting : Everyone uses it anyway ?
+    ADD_DEFINITIONS (-DPIC)
+    IF (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+      ADD_DEFINITIONS (-KPIC)
+    ENDIF (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+  ENDIF (NOT WIN32)
+ENDIF (BUILD_SHARED_LIBS)
+
+ADD_DEFINITIONS (-DBIG_LONGS -DSWAP)
+ADD_DEFINITIONS (-DHAVE_CONFIG_H)
+
+#-----------------------------------------------------------------------------
+# Temporary disable optimization flag
+#-----------------------------------------------------------------------------
+IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR CYGWIN)
+  FOREACH (flag_var
+      CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+      CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+      CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+      CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+    IF (${flag_var} MATCHES "O3")
+      STRING (REGEX REPLACE "O3" "O0" ${flag_var} "${${flag_var}}")
+    ENDIF (${flag_var} MATCHES "O3")
+  ENDFOREACH (flag_var)
+ENDIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR CYGWIN)
+
+#-----------------------------------------------------------------------------
+# Option to use code coverage
+#-----------------------------------------------------------------------------
+OPTION (HDF4_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF)
+IF (HDF4_ENABLE_COVERAGE)
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+    SET (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")   
+ENDIF (HDF4_ENABLE_COVERAGE)
+
+#-----------------------------------------------------------------------------
+# Option to use deprecated public API symbols
+#-----------------------------------------------------------------------------
+OPTION (HDF4_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON)
+IF (HDF4_ENABLE_DEPRECATED_SYMBOLS)
+  SET (H4_NO_DEPRECATED_SYMBOLS 0)   
+ELSE (HDF4_ENABLE_DEPRECATED_SYMBOLS)
+  SET (H4_NO_DEPRECATED_SYMBOLS 1)   
+ENDIF (HDF4_ENABLE_DEPRECATED_SYMBOLS)
+
+#-----------------------------------------------------------------------------
+# Include the main src and config directories
+#-----------------------------------------------------------------------------
+SET (HDF4_INCLUDE_DIRECTORIES
+    ${HDF4_HDFSOURCE_DIR} 
+    ${HDF4_MFHDFSOURCE_DIR} 
+    ${HDF4_SOURCE_DIR} 
+    ${HDF4_BINARY_DIR}
+    ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+)
+INCLUDE_DIRECTORIES (${HDF4_INCLUDE_DIRECTORIES} )
+
+#-----------------------------------------------------------------------------
+# When building utility executables that generate other (source) files :
+# we make use of the following variables defined in the root CMakeLists.
+# Certain systems may add /Debug or /Release to output paths
+# and we need to call the executable from inside the CMake configuration
+#-----------------------------------------------------------------------------
+SET (EXE_EXT "")
+IF (WIN32)
+  SET (EXE_EXT ".exe")
+  IF (NOT CYGWIN)
+    ADD_DEFINITIONS (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1)
+    ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS)
+    ADD_DEFINITIONS (-D_CONSOLE)
+  ENDIF (NOT CYGWIN)
+ENDIF (WIN32)
+
+IF (MSVC)
+  SET (CMAKE_MFC_FLAG 0)
+  SET (WIN_COMPILE_FLAGS "")
+  SET (WIN_LINK_FLAGS "")
+ENDIF (MSVC)
+
+SET (MAKE_SYSTEM)
+IF (CMAKE_BUILD_TOOL MATCHES "make")
+  SET (MAKE_SYSTEM 1)
+ENDIF (CMAKE_BUILD_TOOL MATCHES "make")
+
+SET (CFG_INIT "/${CMAKE_CFG_INTDIR}")
+IF (MAKE_SYSTEM)
+  SET (CFG_INIT "")
+ENDIF (MAKE_SYSTEM)
+
+#-----------------------------------------------------------------------------
+# Add some definitions for Debug Builds
+#-----------------------------------------------------------------------------
+IF (CMAKE_BUILD_TYPE MATCHES Debug)
+  #-- NMake Makefiles will overwhelm the console with warnings if -Wall is used.
+  IF (NOT WIN32)
+    ADD_DEFINITIONS (-Wall)
+  ENDIF (NOT WIN32)
+ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
+
+#-----------------------------------------------------------------------------
+# Compiler specific flags : Shouldn't there be compiler tests for these
+#-----------------------------------------------------------------------------
+IF (CMAKE_COMPILER_IS_GNUCC)
+  IF (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -finline-functions -fno-common")
+  ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99 -fomit-frame-pointer -finline-functions -fno-common")
+  ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
+ENDIF (CMAKE_COMPILER_IS_GNUCC)
+IF (CMAKE_COMPILER_IS_GNUCXX)
+  IF (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -finline-functions -fno-common")
+  ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
+    SET (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions -fno-common")
+  ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
+ENDIF (CMAKE_COMPILER_IS_GNUCXX)
+
+#-----------------------------------------------------------------------------
+# Option to allow the user to disable compiler warnings
+#-----------------------------------------------------------------------------
+OPTION (HDF4_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF)
+IF (HDF4_DISABLE_COMPILER_WARNINGS)
+  # MSVC uses /w to suppress warnings.  It also complains if another
+  # warning level is given, so remove it.
+  IF (MSVC)
+    SET (HDF4_WARNINGS_BLOCKED 1)
+    STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w")
+    STRING (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w")
+  ENDIF (MSVC)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-D_CRT_SECURE_NO_WARNINGS)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  # Borland uses -w- to suppress warnings.
+  IF (BORLAND)
+    SET (HDF4_WARNINGS_BLOCKED 1)
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-")
+  ENDIF (BORLAND)
+
+  # Most compilers use -w to suppress warnings.
+  IF (NOT HDF4_WARNINGS_BLOCKED)
+    SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
+    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
+  ENDIF (NOT HDF4_WARNINGS_BLOCKED)
+ENDIF (HDF4_DISABLE_COMPILER_WARNINGS)
+
+#-----------------------------------------------------------------------------
+# This is in here to help some of the GCC based IDES like Eclipse
+# and code blocks parse the compiler errors and warnings better.
+#-----------------------------------------------------------------------------
+IF (CMAKE_COMPILER_IS_GNUCC)
+  SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
+ENDIF (CMAKE_COMPILER_IS_GNUCC)
+IF (CMAKE_COMPILER_IS_GNUCXX)
+  SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
+ENDIF (CMAKE_COMPILER_IS_GNUCXX)
+
+#-----------------------------------------------------------------------------
+# Option to Enable MPI Parallel
+#-----------------------------------------------------------------------------
+SET (CMAKE_MODULE_PATH ${HDF4_RESOURCES_DIR} ${CMAKE_MODULE_PATH})
+OPTION (HDF4_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF)
+IF (HDF4_ENABLE_PARALLEL)
+  INCLUDE (FindMPI)
+  INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_PATH})
+  IF (MPI_C_FOUND)
+    SET (H4_HAVE_PARALLEL 1)
+    # MPI checks, only do these if MPI_C_FOUND is true, otherwise they always fail
+    # and once set, they are cached as false and not regenerated
+    SET (CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" )
+    CHECK_FUNCTION_EXISTS (MPI_File_get_size H4_HAVE_MPI_GET_SIZE) 
+    # Used by Fortran + MPI
+    CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h"  H4_HAVE_MPI_MULTI_LANG_Comm)
+    CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h"  H4_HAVE_MPI_MULTI_LANG_Info)
+  ELSE (MPI_C_FOUND)
+    MESSAGE (STATUS "Parallel libraries not found")
+  ENDIF (MPI_C_FOUND)
+ENDIF (HDF4_ENABLE_PARALLEL)
+
+# Parallel IO usage requires MPI to be Linked and Included
+IF (H4_HAVE_PARALLEL)
+  SET (LINK_LIBS ${LINK_LIBS} ${MPI_C_LIBRARIES})
+  IF (MPI_C_LINK_FLAGS)
+    SET (CMAKE_EXE_LINKER_FLAGS ${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS})
+  ENDIF (MPI_C_LINK_FLAGS)
+ENDIF (H4_HAVE_PARALLEL)
+
+#-----------------------------------------------------------------------------
+# Include user macros
+#-----------------------------------------------------------------------------
+INCLUDE (UserMacros.cmake)
+
+INCLUDE (CMakeFilters.cmake)
+
+#-----------------------------------------------------------------------------
+# Option for external libraries on windows
+#-----------------------------------------------------------------------------
+OPTION (HDF4_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF)
+IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  IF (HDF4_PACKAGE_EXTLIBS)
+    SET (HDF4_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
+    IF (HDF4_ENABLE_JPEG_LIB_SUPPORT AND JPEG_FOUND)
+      PACKAGE_JPEG_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT})
+    ENDIF (HDF4_ENABLE_JPEG_LIB_SUPPORT AND JPEG_FOUND)
+
+    IF (HDF4_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
+      PACKAGE_ZLIB_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT})
+    ENDIF (HDF4_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
+    
+    IF (HDF4_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
+      PACKAGE_SZIP_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT})
+    ENDIF (HDF4_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
+  ENDIF (HDF4_PACKAGE_EXTLIBS)
+ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+
+#-----------------------------------------------------------------------------
+# Option to build HDF4 xdr Library
+#-----------------------------------------------------------------------------
+OPTION (HDF4_BUILD_XDR_LIB  "Build HDF4 XDR Library" OFF)
+IF (WIN32 AND NOT CYGWIN)
+  SET (HDF4_BUILD_XDR_LIB ON CACHE BOOL "Build HDF4 XDR Library" FORCE)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/mfhdf/xdr ${PROJECT_BINARY_DIR}/xdr)
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+#-----------------------------------------------------------------------------
+# Add the HDF4 Library Target to the build
+#-----------------------------------------------------------------------------
+ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/hdf/src    ${PROJECT_BINARY_DIR}/hdf/src )
+ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/mfhdf/libsrc   ${PROJECT_BINARY_DIR}/mfhdf/libsrc)
+
+IF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+  IF (JPEG_FOUND AND JPEG_USE_EXTERNAL)
+    ADD_DEPENDENCIES (${HDF4_SRC_LIB_TARGET} JPEG)
+  ENDIF (JPEG_FOUND AND JPEG_USE_EXTERNAL)
+  IF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
+    ADD_DEPENDENCIES (${HDF4_SRC_LIB_TARGET} ZLIB)
+  ENDIF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
+  IF (SZIP_FOUND AND SZIP_USE_EXTERNAL)
+    ADD_DEPENDENCIES (${HDF4_SRC_LIB_TARGET} SZIP)
+  ENDIF (SZIP_FOUND AND SZIP_USE_EXTERNAL)
+ENDIF (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+
+IF (HDF4_BUILD_XDR_LIB)
+  ADD_DEPENDENCIES (${HDF4_MF_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+#-----------------------------------------------------------------------------
+# Dashboard and Testing Settings
+#-----------------------------------------------------------------------------
+OPTION (BUILD_TESTING "Build HDF4 Unit Testing" OFF)
+IF (BUILD_TESTING)
+  SET (DART_TESTING_TIMEOUT 1200
+      CACHE INTEGER
+      "Timeout in seconds for each test (default 1200=20minutes)"
+  )
+  ENABLE_TESTING ()
+  INCLUDE (CTest)
+  IF (NOT HDF4_EXTERNALLY_CONFIGURED)
+    IF (EXISTS "${HDF4_SOURCE_DIR}/hdf/test" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/hdf/test")
+      ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/hdf/test   ${PROJECT_BINARY_DIR}/hdf/test)
+    ENDIF (EXISTS "${HDF4_SOURCE_DIR}/hdf/test" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/hdf/test")
+    IF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/test" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/test")
+      ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/mfhdf/test ${PROJECT_BINARY_DIR}/mfhdf/test)
+    ENDIF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/test" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/test")
+  ENDIF (NOT HDF4_EXTERNALLY_CONFIGURED)
+  INCLUDE (${HDF4_SOURCE_DIR}/CTestConfig.cmake)
+  CONFIGURE_FILE (${HDF4_RESOURCES_DIR}/CTestCustom.cmake ${HDF4_BINARY_DIR}/CTestCustom.ctest @ONLY)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Option to build Fortran bindings/tests/examples
+# Make sure this appears before the CONFIGURE_FILE step
+# so that fortran name mangling is detected before writing H4config.h
+#-----------------------------------------------------------------------------
+# Set default name mangling : overridden by Fortran detection in fortran dir
+SET (H4_F77_FUNC "H4_F77_FUNC(name,NAME) name ## _")
+SET (H4_F77_FUNC_ "H4_F77_FUNC_(name,NAME) name ## __")
+IF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/fortran" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/fortran")
+  OPTION (HDF4_BUILD_FORTRAN "Build FORTRAN support" ON)
+  IF (HDF4_BUILD_FORTRAN)
+    IF (WIN32 AND NOT CYGWIN)
+      SET (H4_F77_FUNC "H4_F77_FUNC(name,NAME) NAME")
+      SET (H4_F77_FUNC_ "H4_F77_FUNC_(name,NAME) NAME")
+    ENDIF (WIN32 AND NOT CYGWIN)
+    INCLUDE (${HDF4_RESOURCES_DIR}/HDF4UseFortran.cmake)
+    ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/mfhdf/fortran ${PROJECT_BINARY_DIR}/mfhdf/fortran)
+    ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/hdf/fortran ${PROJECT_BINARY_DIR}/hdf/fortran)
+  ENDIF (HDF4_BUILD_FORTRAN)
+ENDIF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/fortran" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/fortran")
+
+IF (MSVC)
+  SET (H4_HDSETVBUF "HDsetvbuf(F,S,M,Z) (((Z)>1)?setvbuf(F,S,M,Z):setvbuf(F,S,M,2))")
+ELSE (MSVC)
+  SET (H4_HDSETVBUF "NOP")
+ENDIF (MSVC)
+
+#-----------------------------------------------------------------------------
+# Library utilities
+#-----------------------------------------------------------------------------
+ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/hdf   ${PROJECT_BINARY_DIR}/hdf)
+ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/mfhdf ${PROJECT_BINARY_DIR}/mfhdf)
+
+#-----------------------------------------------------------------------------
+# Option to build HDF4 Examples
+#-----------------------------------------------------------------------------
+IF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/examples" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/examples")
+  OPTION (HDF4_BUILD_EXAMPLES  "Build HDF4 Examples" OFF)
+  IF (HDF4_BUILD_EXAMPLES)
+    IF (HDF4_BUILD_FORTRAN)
+      IF (EXISTS "${HDF4_SOURCE_DIR}/hdf/fortran/examples" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/hdf/fortran/examples")
+        ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/hdf/fortran/examples     ${PROJECT_BINARY_DIR}/hdf/fortran/examples)
+      ENDIF (EXISTS "${HDF4_SOURCE_DIR}/hdf/fortran/examples" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/hdf/fortran/examples")
+      IF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/fortran/examples" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/fortran/examples")
+        ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/mfhdf/fortran/examples     ${PROJECT_BINARY_DIR}/mfhdf/fortran/examples)
+      ENDIF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/fortran/examples" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/fortran/examples")
+    ENDIF (HDF4_BUILD_FORTRAN)
+
+    ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/hdf/examples    ${PROJECT_BINARY_DIR}/hdf/examples)
+    ADD_SUBDIRECTORY (${HDF4_SOURCE_DIR}/mfhdf/examples    ${PROJECT_BINARY_DIR}/mfhdf/examples)
+  ENDIF (HDF4_BUILD_EXAMPLES)
+ENDIF (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/examples" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/examples")
+
+#-----------------------------------------------------------------------------
+# Generate the H4config.h file containing user settings needed by compilation
+#-----------------------------------------------------------------------------
+CONFIGURE_FILE (${HDF4_RESOURCES_DIR}/h4config.h.in      ${PROJECT_BINARY_DIR}/h4config.h @ONLY)
+
+INCLUDE (CMakeInstallation.cmake)
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..8c2b95e
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,57 @@
+
+Copyright Notice and License Terms for 
+Hierarchical Data Format (HDF) Software Library and Utilities
+---------------------------------------------------------------------------
+
+Hierarchical Data Format (HDF) Software Library and Utilities
+Copyright 2006-2014 by The HDF Group.
+
+NCSA Hierarchical Data Format (HDF) Software Library and Utilities
+Copyright 1988-2006 by the Board of Trustees of the University of Illinois.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted for any purpose (including commercial purposes) 
+provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, 
+   this list of conditions, and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, 
+   this list of conditions, and the following disclaimer in the documentation 
+   and/or materials provided with the distribution.
+
+3. In addition, redistributions of modified forms of the source or binary 
+   code must carry prominent notices stating that the original code was 
+   changed and the date of the change.
+
+4. All publications or advertising materials mentioning features or use of 
+   this software are asked, but not required, to acknowledge that it was 
+   developed by The HDF Group and by the National Center for Supercomputing 
+   Applications at the University of Illinois at Urbana-Champaign and 
+   credit the contributors.
+
+5. Neither the name of The HDF Group, the name of the University, nor the 
+   name of any Contributor may be used to endorse or promote products derived 
+   from this software without specific prior written permission from The HDF
+   Group, the University, or the Contributor, respectively.
+
+DISCLAIMER:
+THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS "AS IS" 
+WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED.  In no event 
+shall The HDF Group or the Contributors be liable for any damages suffered 
+by the users arising out of the use of this software, even if advised of 
+the possibility of such damage. 
+
+---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+
+Contributors:   National Center for Supercomputing Applications (NCSA) at
+the University of Illinois, Fortner Software, Unidata Program Center (netCDF), 
+The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler (gzip), 
+and Digital Equipment Corporation (DEC).
+
+---------------------------------------------------------------------------
+
+
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
new file mode 100644
index 0000000..4731570
--- /dev/null
+++ b/CTestConfig.cmake
@@ -0,0 +1,32 @@
+## This file should be placed in the root directory of your project.
+## Then modify the CMakeLists.txt file in the root directory of your
+## project to incorporate the testing dashboard.
+## # The following are required to uses Dart and the Cdash dashboard
+##   ENABLE_TESTING()
+##   INCLUDE(CTest)
+SET (CTEST_PROJECT_NAME "HDF4")
+SET (CTEST_NIGHTLY_START_TIME "18:00:00 CST")
+
+SET (CTEST_DROP_METHOD "http")
+IF (CDASH_LOCAL)
+  SET (CTEST_DROP_SITE "72.36.68.252")
+  SET (CTEST_DROP_LOCATION "/submit.php?project=HDF4")
+ELSE (CDASH_LOCAL)
+  SET (CTEST_DROP_SITE "cdash.hdfgroup.uiuc.edu")
+  SET (CTEST_DROP_LOCATION "/submit.php?project=HDF4")
+ENDIF (CDASH_LOCAL)
+SET (CTEST_DROP_SITE_CDASH TRUE)
+
+SET (UPDATE_TYPE svn)
+
+SET (VALGRIND_COMMAND "/usr/bin/valgrind")
+SET (VALGRIND_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe")
+
+SET (CTEST_TEST_TIMEOUT 3600 CACHE STRING 
+    "Maximum time allowed before CTest will kill the test.") 
+SET (DART_TESTING_TIMEOUT 3600 CACHE STRING 
+    "Maximum time allowed before CTest will kill the test." FORCE)
+
+SET(CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING
+    "How long to wait between timed-out CTest submissions.")
+    
\ No newline at end of file
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..3d285a4
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,1068 @@
+#------------------------------------------------------------------------------
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF.  The full HDF 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
+# http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have
+# access to either file, you may request a copy from help at hdfgroup.org.
+#------------------------------------------------------------------------------
+#
+# This is the list of files that are part of HDF4 source distribution.
+# All files have a `./' prefix and appear in lexicographic order.
+# Lines that end with _DO_NOT_DISTRIBUTE_ will not be included in a
+# release.  Blank lines and comments are ignored.  Comments must start
+# in column one with a '#'.
+#------------------------------------------------------------------------------
+
+
+./MANIFEST
+./COPYING
+./Makefile.am
+./Makefile.in
+./Makefile.dist
+./README.txt
+./aclocal.m4
+./configure
+./configure.ac
+./libhdf4.settings.in
+./move-if-change
+
+./m4/ltsugar.m4
+./m4/libtool.m4
+./m4/ltversion.m4
+./m4/lt~obsolete.m4
+./m4/ltoptions.m4
+
+./bin/chkmanifest
+./bin/cmakehdf4
+./bin/compile
+./bin/config.guess
+./bin/config.sub
+./bin/depcomp
+./bin/deploy
+./bin/install-sh
+./bin/locate_sw
+./bin/ltmain.sh
+./bin/missing
+./bin/mkinstalldirs
+./bin/newer
+./bin/reconfigure
+./bin/runtest
+./bin/snapshot
+./bin/timekeeper      _DO_NOT_DISTRIBUTE_
+./bin/yodconfigure
+./bin/h4vers
+./bin/release
+
+./config/BlankForm
+./config/aix
+./config/apple
+./config/commence.am
+./config/conclude.am
+./config/examples.am
+./config/freebsd
+./config/i686-pc-cygwin
+./config/linux-gnu
+./config/powerpc64-linux-gnu
+./config/powerpc-apple
+./config/powerpc-ibm-aix5.x
+./config/solaris2.x
+./config/x86_64-pc-cygwin
+
+./hdf/Makefile.am
+./hdf/Makefile.in
+
+./hdf/examples/AN_create_annotation.c
+./hdf/examples/AN_get_annotation_info.c
+./hdf/examples/AN_read_annotation.c
+./hdf/examples/GR_create_and_write_image.c
+./hdf/examples/GR_get_attribute.c
+./hdf/examples/GR_image_info.c
+./hdf/examples/GR_modify_image.c
+./hdf/examples/GR_read_chunks.c
+./hdf/examples/GR_read_image.c
+./hdf/examples/GR_read_palette.c
+./hdf/examples/GR_set_attribute.c
+./hdf/examples/GR_write_chunks.c
+./hdf/examples/GR_write_palette.c
+./hdf/examples/Makefile.am
+./hdf/examples/Makefile.in
+./hdf/examples/README
+./hdf/examples/run-all-ex.sh
+./hdf/examples/run-c-ex.sh
+./hdf/examples/VD_create_onefield_vdatas.c
+./hdf/examples/VD_create_vdatas.c
+./hdf/examples/VD_get_vdata_info.c
+./hdf/examples/VD_locate_vdata.c
+./hdf/examples/VD_read_from_vdata.c
+./hdf/examples/VD_read_mixed_vdata.c
+./hdf/examples/VD_set_get_vdata_attr.c
+./hdf/examples/VD_write_mixed_vdata.c
+./hdf/examples/VD_write_mixed_vdata_struct.c
+./hdf/examples/VD_write_to_vdata.c
+./hdf/examples/VG_add_sds_to_vgroup.c
+./hdf/examples/VG_create_vgroup.c
+./hdf/examples/VG_get_vgroup_info.c
+./hdf/examples/VG_insert_vdatas_to_vgroup.c
+./hdf/examples/VG_set_get_vgroup_attr.c
+./hdf/examples/VG_vgroup_contents.c
+
+./hdf/fortran/Makefile.am
+./hdf/fortran/Makefile.in
+./hdf/fortran/hdf_fortrandll.def
+
+./hdf/fortran/examples/AN_create_annotation.f
+./hdf/fortran/examples/AN_get_annotation_info.f
+./hdf/fortran/examples/AN_read_annotation.f
+./hdf/fortran/examples/GR_create_and_write_image.f
+./hdf/fortran/examples/GR_get_attribute.f
+./hdf/fortran/examples/GR_image_info.f
+./hdf/fortran/examples/GR_modify_image.f
+./hdf/fortran/examples/GR_read_image.f
+./hdf/fortran/examples/GR_read_palette.f
+./hdf/fortran/examples/GR_set_attribute.f
+./hdf/fortran/examples/GR_write_palette.f
+./hdf/fortran/examples/Makefile.am
+./hdf/fortran/examples/Makefile.in
+./hdf/fortran/examples/run-fortran-ex.sh
+./hdf/fortran/examples/VD_create_onefield_vdatas.f
+./hdf/fortran/examples/VD_create_vdatas.f
+./hdf/fortran/examples/VD_get_vdata_info.f
+./hdf/fortran/examples/VD_locate_vdata.f
+./hdf/fortran/examples/VD_read_from_vdata.f
+./hdf/fortran/examples/VD_read_mixed_vdata.f
+./hdf/fortran/examples/VD_set_get_vdata_attr.f
+./hdf/fortran/examples/VD_write_mixed_vdata.f
+./hdf/fortran/examples/VD_write_to_vdata.f
+./hdf/fortran/examples/VG_add_sds_to_vgroup.f
+./hdf/fortran/examples/VG_create_vgroup.f
+./hdf/fortran/examples/VG_get_vgroup_info.f
+./hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f
+./hdf/fortran/examples/VG_set_get_vgroup_attr.f
+./hdf/fortran/examples/VG_vgroup_contents.f
+
+./hdf/src/Makefile.am
+./hdf/src/Makefile.in
+./hdf/src/atom.c
+./hdf/src/atom.h
+./hdf/src/bitvect.c
+./hdf/src/bitvect.h
+./hdf/src/cdeflate.c
+./hdf/src/cdeflate.h
+./hdf/src/cnbit.c
+./hdf/src/cnbit.h
+./hdf/src/cnone.c
+./hdf/src/cnone.h
+./hdf/src/crle.c
+./hdf/src/crle.h
+./hdf/src/cskphuff.c
+./hdf/src/cskphuff.h
+./hdf/src/cszip.c
+./hdf/src/cszip.h
+./hdf/src/df24.c
+./hdf/src/df24f.c
+./hdf/src/df24ff.f
+./hdf/src/dfan.c
+./hdf/src/dfanf.c
+./hdf/src/dfanff.f
+./hdf/src/dfan.h
+./hdf/src/dfcomp.c
+./hdf/src/dfconv.c
+./hdf/src/dfconvrt.h
+./hdf/src/dff.c
+./hdf/src/dfff.f
+./hdf/src/dffunc.inc
+./hdf/src/dfgr.c
+./hdf/src/dfgr.h
+./hdf/src/dfgroup.c
+./hdf/src/df.h
+./hdf/src/dfi.h
+./hdf/src/dfimcomp.c
+./hdf/src/dfjpeg.c
+./hdf/src/dfknat.c
+./hdf/src/dfkswap.c
+./hdf/src/dfp.c
+./hdf/src/dfpf.c
+./hdf/src/dfpff.f
+./hdf/src/dfr8.c
+./hdf/src/dfr8f.c
+./hdf/src/dfr8ff.f
+./hdf/src/dfrig.h
+./hdf/src/dfrle.c
+./hdf/src/dfsd.c
+./hdf/src/dfsdf.c
+./hdf/src/dfsdff.f
+./hdf/src/dfsd.h
+./hdf/src/dfstubs.c
+./hdf/src/dfstubs.h
+./hdf/src/dfufp2i.c
+./hdf/src/dfufp2if.c
+./hdf/src/dfufp2iff.f
+./hdf/src/dfufp2i.h
+./hdf/src/dfunjpeg.c
+./hdf/src/dfutil.c
+./hdf/src/dfutilf.c
+./hdf/src/dynarray.c
+./hdf/src/dynarray.h
+./hdf/src/glist.c
+./hdf/src/glist.h
+./hdf/src/H4api_adpt.h
+./hdf/src/h4config.h.in
+./hdf/src/hbitio.c
+./hdf/src/hbitio.h
+./hdf/src/hblocks.c
+./hdf/src/hbuffer.c
+./hdf/src/hchunks.c
+./hdf/src/hchunks.h
+./hdf/src/hcomp.c
+./hdf/src/hcomp.h
+./hdf/src/hcompi.h
+./hdf/src/hcompri.c
+./hdf/src/hconv.h
+./hdf/src/hdatainfo.c
+./hdf/src/hdatainfo.h
+./hdf/src/hdfalloc.c
+./hdf/src/hdf.h
+./hdf/src/hdfi.h
+./hdf/src/hdf.inc
+./hdf/src/herr.c
+./hdf/src/herrf.c
+./hdf/src/herr.h
+./hdf/src/hextelt.c
+./hdf/src/hfile.c
+./hdf/src/hfiledd.c
+./hdf/src/hfilef.c
+./hdf/src/hfileff.f
+./hdf/src/hfile.h
+./hdf/src/hkit.c
+./hdf/src/hkit.h
+./hdf/src/hlimits.h
+./hdf/src/hntdefs.h
+./hdf/src/hproto.h
+./hdf/src/hproto_fortran.h
+./hdf/src/hqueue.h
+./hdf/src/htags.h
+./hdf/src/.indent.pro
+./hdf/src/linklist.c
+./hdf/src/linklist.h
+./hdf/src/maldebug.c
+./hdf/src/maldebug.h
+./hdf/src/mcache.c
+./hdf/src/mcache.h
+./hdf/src/mfan.c
+./hdf/src/mfanf.c
+./hdf/src/mfan.h
+./hdf/src/mfgr.c
+./hdf/src/mfgrf.c
+./hdf/src/mfgrff.f
+./hdf/src/mfgr.h
+./hdf/src/mstdio.c
+./hdf/src/mstdio.h
+./hdf/src/patchlevel.h
+./hdf/src/src.inc
+./hdf/src/tbbt.c
+./hdf/src/tbbt.h
+./hdf/src/trace.h
+./hdf/src/vattr.c
+./hdf/src/vattrf.c
+./hdf/src/vattrff.f
+./hdf/src/vattr.h
+./hdf/src/vconv.c
+./hdf/src/vg.c
+./hdf/src/vgf.c
+./hdf/src/vgff.f
+./hdf/src/vg.h
+./hdf/src/vgint.h
+./hdf/src/vgp.c
+./hdf/src/vhi.c
+./hdf/src/vio.c
+./hdf/src/vparse.c
+./hdf/src/vrw.c
+./hdf/src/vsfld.c
+
+./hdf/test/Makefile.am
+./hdf/test/Makefile.in
+./hdf/test/README
+./hdf/test/test_files/8bit.dat
+./hdf/test/an.c
+./hdf/test/anfile.c
+./hdf/test/bitio.c
+./hdf/test/test_files/bitio.dat
+./hdf/test/blocks.c
+./hdf/test/buffer.c
+./hdf/test/chunks.c
+./hdf/test/comp.c
+./hdf/test/conv.c
+./hdf/test/egchi.res
+./hdf/test/egfhi.f
+./hdf/test/egfhi.res
+./hdf/test/extelt.c
+./hdf/test/file1.c
+./hdf/test/file.c
+./hdf/test/forsupf.c
+./hdf/test/forsupff.f
+./hdf/test/fortest.c
+./hdf/test/fortestF.f
+./hdf/test/fortest.h
+./hdf/test/fortest.inc
+./hdf/test/fortest.sav
+./hdf/test/gentest.c
+./hdf/test/test_files/greyjpeg.dat
+./hdf/test/test_files/gr_r24.dat
+./hdf/test/test_files/jpeg.dat
+./hdf/test/litend.c
+./hdf/test/test_files/litend.dat
+./hdf/test/macros.c
+./hdf/test/man.c
+./hdf/test/manf.f
+./hdf/test/mgr.c
+./hdf/test/mgrf.f
+./hdf/test/mgrf_sunOS.f
+./hdf/test/nbit.c
+./hdf/test/test_files/nbit.dat
+./hdf/test/rig.c
+./hdf/test/sdmms.c
+./hdf/test/sdnmms.c
+./hdf/test/sdstr.c
+./hdf/test/slab.c
+./hdf/test/slabwf.f
+./hdf/test/t24f.f
+./hdf/test/tanf.f
+./hdf/test/tanfilef.f
+./hdf/test/tbv.c
+./hdf/test/tdatainfo.c
+./hdf/test/tdatainfo.h
+./hdf/test/tattdatainfo.c
+./hdf/test/tdfr8.c
+./hdf/test/tdupimgs.c
+./hdf/test/testhdf.c
+./hdf/test/test_files/tmgr.dat
+./hdf/test/tmgrattr.c
+./hdf/test/tmgrcomp.c
+./hdf/test/tpf.f
+./hdf/test/tproto.h
+./hdf/test/tr8f.f
+./hdf/test/tree.c
+./hdf/test/tsdmmsf.f
+./hdf/test/tsdnmmsf.f
+./hdf/test/tsdnntf.f
+./hdf/test/tsdntf.f
+./hdf/test/tsdstrf.f
+./hdf/test/tstubsf.f
+./hdf/test/tszip.c
+./hdf/test/tusejpegfuncs.c
+./hdf/test/tutils.c
+./hdf/test/tutils.h
+./hdf/test/tv1.res
+./hdf/test/tv2.res
+./hdf/test/tvattr.c
+./hdf/test/test_files/README
+./hdf/test/test_files/grtdfui83.hdf
+./hdf/test/test_files/tvattr.dat
+./hdf/test/tvattrf.f
+./hdf/test/tvnameclass.c
+./hdf/test/tvset.c
+./hdf/test/tvsetf.f
+./hdf/test/tvsfpack.c
+./hdf/test/vers.c
+
+./hdf/util/HELINK.OPT
+./hdf/util/Makefile.am
+./hdf/util/Makefile.in
+./hdf/util/README
+./hdf/util/README.fp2hdf
+./hdf/util/README.fp2hdf.test
+./hdf/util/README.TST
+./hdf/util/decompress.c
+./hdf/util/fp2hdf.c
+./hdf/util/fp2hdf.input1
+./hdf/util/fp2hdf.input1-32
+./hdf/util/fp2hdf.out1
+./hdf/util/fp2hdf.out1-32
+./hdf/util/fp2hdf.out2
+./hdf/util/fp2hdf.out2-32
+./hdf/util/fp2hdf.test
+./hdf/util/fp2hdf.test.result
+./hdf/util/fptest.c
+./hdf/util/getopt1.c
+./hdf/util/getopt.c
+./hdf/util/gif2hdf.c
+./hdf/util/gif2mem.c
+./hdf/util/gif.h
+./hdf/util/gifread.c
+./hdf/util/h4cc.in
+./hdf/util/h4fc.in
+./hdf/util/h4redeploy.in
+./hdf/util/hdf24to8.c
+./hdf/util/hdf2gif.c
+./hdf/util/hdf2jpeg.c
+./hdf/util/hdf8to24.c
+./hdf/util/hdfcomp.c
+./hdf/util/hdfcomp.out1
+./hdf/util/hdfcomp.out1.1
+./hdf/util/hdfcomp.out1.2
+./hdf/util/hdfed.input1
+./hdf/util/hdfed.out1
+./hdf/util/hdfed-w.out1
+./hdf/util/hdfgifwr.c
+./hdf/util/hdfls.c
+./hdf/util/hdfpack.c
+./hdf/util/hdfpack.out1
+./hdf/util/hdfpack.out1.1
+./hdf/util/hdfpack.out1.2
+./hdf/util/hdfrseq.c
+./hdf/util/hdftopal.c
+./hdf/util/hdftor8.c
+./hdf/util/hdftor8.out1
+./hdf/util/hdfunpac.c
+./hdf/util/he_cntrl.c
+./hdf/util/he_disp.c
+./hdf/util/he_file.c
+./hdf/util/he.h
+./hdf/util/he_main.c
+./hdf/util/he_proto.h
+./hdf/util/jpeg2hdf.c
+./hdf/util/jpeg2hdf.out1
+./hdf/util/paltohdf.c
+./hdf/util/r8tohdf.c
+./hdf/util/ristosds.c
+./hdf/util/ristosds.input1
+./hdf/util/ristosds.out1
+./hdf/util/testutil.sh.in
+./hdf/util/vcompat.c
+./hdf/util/vmake.c
+./hdf/util/vshow.c
+./hdf/util/writehdf.c
+
+./hdf/util/MacProjects/PalToHDF.project.hqx
+./hdf/util/MacProjects/R8ToHDF.project.hqx
+./hdf/util/MacProjects/RISToHDF.project.hqx
+./hdf/util/MacProjects/fp2hdf.project.hqx
+./hdf/util/MacProjects/hdf24to8.project.hqx
+./hdf/util/MacProjects/hdfcomp.project.hqx
+./hdf/util/MacProjects/hdfed.project.hqx
+./hdf/util/MacProjects/hdfls.project.hqx
+./hdf/util/MacProjects/hdfpack.project.hqx
+./hdf/util/MacProjects/hdftopal.project.hqx
+./hdf/util/MacProjects/hdftoR8.project.hqx
+./hdf/util/MacProjects/vshow.project.hqx
+
+./hdf/util/testfiles/README
+./hdf/util/testfiles/SunWheel.gif
+./hdf/util/testfiles/bttrfly.gif
+./hdf/util/testfiles/head.r24
+./hdf/util/testfiles/head.r8
+./hdf/util/testfiles/jet2.hdf
+./hdf/util/testfiles/jpeg_img.jpg
+./hdf/util/testfiles/ntcheck.hdf
+./hdf/util/testfiles/palette.raw
+./hdf/util/testfiles/skull.hdf
+./hdf/util/testfiles/storm110.hdf
+./hdf/util/testfiles/storm110.raw
+./hdf/util/testfiles/storm120.hdf
+./hdf/util/testfiles/storm120.raw
+./hdf/util/testfiles/storm130.hdf
+./hdf/util/testfiles/storm130.raw
+./hdf/util/testfiles/storm140.raw
+./hdf/util/testfiles/test.cdf
+./hdf/util/testfiles/test.hdf
+./hdf/util/testfiles/tvattr.hdf
+
+./hdf/util/testfiles/fp2hdf/h100x100
+./hdf/util/testfiles/fp2hdf/h100x100h
+./hdf/util/testfiles/fp2hdf/h100x100hv
+./hdf/util/testfiles/fp2hdf/h60x75
+./hdf/util/testfiles/fp2hdf/h60x75n
+./hdf/util/testfiles/fp2hdf/h60x75v
+./hdf/util/testfiles/fp2hdf/pal.hdf
+./hdf/util/testfiles/fp2hdf/t100x100
+
+./man/Makefile.am
+./man/Makefile.in
+./man/gr_chunk.3
+./man/hdf.1
+./man/hdfunpac.1
+
+./mfhdf/COPYRIGHT
+./mfhdf/FAQ
+./mfhdf/Makefile.am
+./mfhdf/Makefile.in
+./mfhdf/README
+./mfhdf/THANKS
+./mfhdf/build.bat
+
+./mfhdf/dumper/Makefile.am
+./mfhdf/dumper/Makefile.in
+./mfhdf/dumper/README
+./mfhdf/dumper/TEST
+./mfhdf/dumper/hdp.c
+./mfhdf/dumper/hdp_dump.c
+./mfhdf/dumper/hdp_gr.c
+./mfhdf/dumper/hdp.h
+./mfhdf/dumper/hdp_list.c
+./mfhdf/dumper/hdp.mak
+./mfhdf/dumper/hdp_rig.c
+./mfhdf/dumper/hdp_sds.c
+./mfhdf/dumper/hdp.txt
+./mfhdf/dumper/hdp_util.c
+./mfhdf/dumper/hdp_vd.c
+./mfhdf/dumper/hdp_vg.c
+./mfhdf/dumper/show.c
+./mfhdf/dumper/testhdp.sh.in
+
+./mfhdf/dumper/testfiles/Example6.hdf
+./mfhdf/dumper/testfiles/Image_with_Palette.hdf
+./mfhdf/dumper/testfiles/IMCOMP.hdf
+./mfhdf/dumper/testfiles/LongDataset.hdf
+./mfhdf/dumper/testfiles/Roy.nc
+./mfhdf/dumper/testfiles/SDSlongname.hdf
+./mfhdf/dumper/testfiles/Tables.hdf
+./mfhdf/dumper/testfiles/Tables_External_File
+./mfhdf/dumper/testfiles/VGlongname.hdf
+./mfhdf/dumper/testfiles/ctxtr2r.hdf
+./mfhdf/dumper/testfiles/dumpgr-10.out
+./mfhdf/dumper/testfiles/dumpgr-11.out
+./mfhdf/dumper/testfiles/dumpgr-12.out
+./mfhdf/dumper/testfiles/dumpgr-13.out
+./mfhdf/dumper/testfiles/dumpgr-14.out
+./mfhdf/dumper/testfiles/dumpgr-15.out
+./mfhdf/dumper/testfiles/dumpgr-16.out
+./mfhdf/dumper/testfiles/dumpgr-17.out
+./mfhdf/dumper/testfiles/dumpgr-18.out
+./mfhdf/dumper/testfiles/dumpgr-19.out
+./mfhdf/dumper/testfiles/dumpgr-20.out
+./mfhdf/dumper/testfiles/dumpgr-1.out
+./mfhdf/dumper/testfiles/dumpgr-2.out
+./mfhdf/dumper/testfiles/dumpgr-3.out
+./mfhdf/dumper/testfiles/dumpgr-4.out
+./mfhdf/dumper/testfiles/dumpgr-5.out
+./mfhdf/dumper/testfiles/dumpgr-6.out
+./mfhdf/dumper/testfiles/dumpgr-7.out
+./mfhdf/dumper/testfiles/dumpgr-8.out
+./mfhdf/dumper/testfiles/dumpgr-9.out
+./mfhdf/dumper/testfiles/dumprig-1.out
+./mfhdf/dumper/testfiles/dumprig-2.out
+./mfhdf/dumper/testfiles/dumprig-3.out
+./mfhdf/dumper/testfiles/dumprig-4.out
+./mfhdf/dumper/testfiles/dumprig-5.out
+./mfhdf/dumper/testfiles/dumprig-6.out
+./mfhdf/dumper/testfiles/dumpsds-1.out
+./mfhdf/dumper/testfiles/dumpsds-2.out
+./mfhdf/dumper/testfiles/dumpsds-3.out
+./mfhdf/dumper/testfiles/dumpsds-4.out
+./mfhdf/dumper/testfiles/dumpsds-5.out
+./mfhdf/dumper/testfiles/dumpsds-6.out
+./mfhdf/dumper/testfiles/dumpsds-7.out
+./mfhdf/dumper/testfiles/dumpsds-8.out
+./mfhdf/dumper/testfiles/dumpsds-9.out
+./mfhdf/dumper/testfiles/dumpsds-10.out
+./mfhdf/dumper/testfiles/dumpsds-11.out
+./mfhdf/dumper/testfiles/dumpsds-12.out
+./mfhdf/dumper/testfiles/dumpsds-13.out
+./mfhdf/dumper/testfiles/dumpsds-14.out
+./mfhdf/dumper/testfiles/dumpsds-15.out
+./mfhdf/dumper/testfiles/dumpsds-15szip.out
+./mfhdf/dumper/testfiles/dumpsds-16.out
+./mfhdf/dumper/testfiles/dumpsds-17.out
+./mfhdf/dumper/testfiles/dumpsds-18.out
+./mfhdf/dumper/testfiles/dumpvd-10.out
+./mfhdf/dumper/testfiles/dumpvd-11.out
+./mfhdf/dumper/testfiles/dumpvd-12.out
+./mfhdf/dumper/testfiles/dumpvd-13.out
+./mfhdf/dumper/testfiles/dumpvd-14.out
+./mfhdf/dumper/testfiles/dumpvd-1.out
+./mfhdf/dumper/testfiles/dumpvd-2.out
+./mfhdf/dumper/testfiles/dumpvd-3.out
+./mfhdf/dumper/testfiles/dumpvd-4.out
+./mfhdf/dumper/testfiles/dumpvd-5.out
+./mfhdf/dumper/testfiles/dumpvd-6.out
+./mfhdf/dumper/testfiles/dumpvd-7.out
+./mfhdf/dumper/testfiles/dumpvd-8.out
+./mfhdf/dumper/testfiles/dumpvd-9.out
+./mfhdf/dumper/testfiles/dumpvg-10.out
+./mfhdf/dumper/testfiles/dumpvg-11.out
+./mfhdf/dumper/testfiles/dumpvg-12.out
+./mfhdf/dumper/testfiles/dumpvg-13.out
+./mfhdf/dumper/testfiles/dumpvg-14.out
+./mfhdf/dumper/testfiles/dumpvg-15.out
+./mfhdf/dumper/testfiles/dumpvg-16.out
+./mfhdf/dumper/testfiles/dumpvg-17.out
+./mfhdf/dumper/testfiles/dumpvg-1.out
+./mfhdf/dumper/testfiles/dumpvg-2.out
+./mfhdf/dumper/testfiles/dumpvg-3.out
+./mfhdf/dumper/testfiles/dumpvg-4.out
+./mfhdf/dumper/testfiles/dumpvg-5.out
+./mfhdf/dumper/testfiles/dumpvg-6.out
+./mfhdf/dumper/testfiles/dumpvg-7.out
+./mfhdf/dumper/testfiles/dumpvg-8.out
+./mfhdf/dumper/testfiles/dumpvg-9.out
+./mfhdf/dumper/testfiles/grtdfi322.hdf
+./mfhdf/dumper/testfiles/grtdfui162.hdf
+./mfhdf/dumper/testfiles/grtdfui82.hdf
+./mfhdf/dumper/testfiles/grtdfui83.hdf
+./mfhdf/dumper/testfiles/grtdfui84.hdf
+./mfhdf/dumper/testfiles/list-10.out
+./mfhdf/dumper/testfiles/list-1.out
+./mfhdf/dumper/testfiles/list-2.out
+./mfhdf/dumper/testfiles/list-3.out
+./mfhdf/dumper/testfiles/list-4.out
+./mfhdf/dumper/testfiles/list-5.out
+./mfhdf/dumper/testfiles/list-6.out
+./mfhdf/dumper/testfiles/list-7.out
+./mfhdf/dumper/testfiles/list-8.out
+./mfhdf/dumper/testfiles/list-9.out
+./mfhdf/dumper/testfiles/manySDSs.c
+./mfhdf/dumper/testfiles/sds_compressed.hdf
+./mfhdf/dumper/testfiles/sds_empty_many.hdf
+./mfhdf/dumper/testfiles/sds1_dim1_samename.hdf
+./mfhdf/dumper/testfiles/sds2_dim1_samename.hdf
+./mfhdf/dumper/testfiles/swf32.hdf
+./mfhdf/dumper/testfiles/swi16.hdf
+./mfhdf/dumper/testfiles/swi8.hdf
+./mfhdf/dumper/testfiles/tdf24.hdf
+./mfhdf/dumper/testfiles/test.hdf
+./mfhdf/dumper/testfiles/tvattr.hdf
+./mfhdf/dumper/testfiles/star.hdf
+./mfhdf/dumper/testfiles/swf32_fileattr.hdf
+./mfhdf/dumper/testfiles/tdata.hdf
+./mfhdf/dumper/testfiles/tdfr8f.hdf
+./mfhdf/dumper/testfiles/tvset.hdf
+./mfhdf/dumper/testfiles/vslongname.c
+./mfhdf/dumper/testfiles/vslongname.hdf
+
+./mfhdf/examples/Makefile.am
+./mfhdf/examples/Makefile.in
+./mfhdf/examples/SD_alter_sds_values.c
+./mfhdf/examples/SD_chunking_example.c
+./mfhdf/examples/SD_compress_sds.c
+./mfhdf/examples/SD_create_sds.c
+./mfhdf/examples/SD_dimscale_vs_sds.c
+./mfhdf/examples/SD_find_sds_by_name.c
+./mfhdf/examples/SD_get_attr.c
+./mfhdf/examples/SD_get_info.c
+./mfhdf/examples/SD_mv_sds_to_external.c
+./mfhdf/examples/SD_read_from_sds.c
+./mfhdf/examples/SD_read_subsets.c
+./mfhdf/examples/SD_set_attr.c
+./mfhdf/examples/SD_set_get_dim_info.c
+./mfhdf/examples/SD_unlimited_sds.c
+./mfhdf/examples/SD_write_slab.c
+./mfhdf/examples/SD_write_to_sds.c
+./mfhdf/examples/testexamples.sh.in
+
+
+./mfhdf/fortran/Makefile.am
+./mfhdf/fortran/Makefile.in
+./mfhdf/fortran/mfhdf_fortrandll.def
+./mfhdf/fortran/common.inc
+./mfhdf/fortran/depend
+./mfhdf/fortran/ftest.f.in
+./mfhdf/fortran/hdftest.f
+./mfhdf/fortran/hdftest1.f
+./mfhdf/fortran/hdftst.sav
+./mfhdf/fortran/jackets.c.in
+./mfhdf/fortran/mffunc.inc
+./mfhdf/fortran/mfsdf.c
+./mfhdf/fortran/mfsdf.h
+./mfhdf/fortran/mfsdff.f
+./mfhdf/fortran/netcdf.inc.in
+./mfhdf/fortran/test_nc.cdl
+./mfhdf/fortran/test_nc.nc
+./mfhdf/fortran/tszip.f
+./mfhdf/fortran/testfortran.sh.in
+
+./mfhdf/fortran/examples/Makefile.am
+./mfhdf/fortran/examples/Makefile.in
+./mfhdf/fortran/examples/SD_write_to_sds.f
+./mfhdf/fortran/examples/SD_read_from_sds.f
+./mfhdf/fortran/examples/SD_get_attr.f
+./mfhdf/fortran/examples/SD_create_sds.f
+./mfhdf/fortran/examples/SD_chunking_example.f
+./mfhdf/fortran/examples/SD_read_subsets.f
+./mfhdf/fortran/examples/SD_find_sds_by_name.f
+./mfhdf/fortran/examples/SD_set_attr.f
+./mfhdf/fortran/examples/SD_get_info.f
+./mfhdf/fortran/examples/SD_write_slab.f
+./mfhdf/fortran/examples/SD_set_get_dim_info.f
+./mfhdf/fortran/examples/SD_mv_sds_to_external.f
+./mfhdf/fortran/examples/SD_alter_sds_values.f
+./mfhdf/fortran/examples/SD_dimscale_vs_sds.f
+./mfhdf/fortran/examples/SD_unlimited_sds.f
+./mfhdf/fortran/examples/SD_compress_sds.f
+
+./mfhdf/hdfimport/Makefile.am
+./mfhdf/hdfimport/Makefile.in
+./mfhdf/hdfimport/SDSfloat2.hdf
+./mfhdf/hdfimport/SDSfloat3.hdf
+./mfhdf/hdfimport/crtSDSfloats.c
+./mfhdf/hdfimport/hdfimport.c
+./mfhdf/hdfimport/hdfimport.input1
+./mfhdf/hdfimport/hdfimport.out1
+./mfhdf/hdfimport/hdfimport.out2
+./mfhdf/hdfimport/hdfimport-w.out2
+./mfhdf/hdfimport/hdfimport.out3
+./mfhdf/hdfimport/hdfimporttest.c
+./mfhdf/hdfimport/testutil.sh.in
+./mfhdf/hdfimport/gen_sds_floats.c
+./mfhdf/hdfimport/testfiles/cb16i2.tst
+./mfhdf/hdfimport/testfiles/cb16i3.tst
+./mfhdf/hdfimport/testfiles/cb32i2.tst
+./mfhdf/hdfimport/testfiles/cb32i3.tst
+./mfhdf/hdfimport/testfiles/cb32r2.tst
+./mfhdf/hdfimport/testfiles/cb32r3.tst
+./mfhdf/hdfimport/testfiles/cb64r2_ris.tst
+./mfhdf/hdfimport/testfiles/cb64r2.tst
+./mfhdf/hdfimport/testfiles/cb64r2-n.tst
+./mfhdf/hdfimport/testfiles/cb64r3.tst
+./mfhdf/hdfimport/testfiles/cb64r3-n.tst
+./mfhdf/hdfimport/testfiles/ctxtr2_ris.tst
+./mfhdf/hdfimport/testfiles/ctxtr2.tst
+./mfhdf/hdfimport/testfiles/ctxtr3.tst
+./mfhdf/hdfimport/testfiles/SDSfloat2.tst
+./mfhdf/hdfimport/testfiles/SDSfloat3.tst
+
+
+./mfhdf/hdiff/Makefile.am
+./mfhdf/hdiff/Makefile.in
+./mfhdf/hdiff/hdiff.c
+./mfhdf/hdiff/hdiff.h
+./mfhdf/hdiff/hdiff_array.c
+./mfhdf/hdiff/hdiff_gattr.c
+./mfhdf/hdiff/hdiff_gr.c
+./mfhdf/hdiff/hdiff_list.c
+./mfhdf/hdiff/hdiff_list.h
+./mfhdf/hdiff/hdiff_main.c
+./mfhdf/hdiff/hdiff_misc.c
+./mfhdf/hdiff/hdiff_sds.c
+./mfhdf/hdiff/hdiff_table.c
+./mfhdf/hdiff/hdiff_table.h
+./mfhdf/hdiff/hdiff_vs.c
+./mfhdf/hdiff/hdifftst.c
+./mfhdf/hdiff/testhdiff.sh.in
+./mfhdf/hdiff/hdiff_mattbl.c
+./mfhdf/hdiff/hdiff_mattbl.h
+
+
+
+./mfhdf/hdiff/testfiles/hdiff_01.txt
+./mfhdf/hdiff/testfiles/hdiff_02.txt
+./mfhdf/hdiff/testfiles/hdiff_03.txt
+./mfhdf/hdiff/testfiles/hdiff_04.txt
+./mfhdf/hdiff/testfiles/hdiff_05.txt
+./mfhdf/hdiff/testfiles/hdiff_06.txt
+./mfhdf/hdiff/testfiles/hdiff_06w.txt
+./mfhdf/hdiff/testfiles/hdiff_07.txt
+./mfhdf/hdiff/testfiles/hdiff_08.txt
+./mfhdf/hdiff/testfiles/hdiff_09.txt
+./mfhdf/hdiff/testfiles/hdiff_10.txt
+./mfhdf/hdiff/testfiles/hdiff_11.txt
+./mfhdf/hdiff/testfiles/hdiff_12.txt
+./mfhdf/hdiff/testfiles/hdiff_13.txt
+./mfhdf/hdiff/testfiles/hdifftst1.hdf
+./mfhdf/hdiff/testfiles/hdifftst2.hdf
+./mfhdf/hdiff/testfiles/hdifftst3.hdf
+./mfhdf/hdiff/testfiles/hdifftst4.hdf
+./mfhdf/hdiff/testfiles/hdifftst5.hdf
+./mfhdf/hdiff/testfiles/hdifftst6.hdf
+./mfhdf/hdiff/hdiff_dim.c
+./mfhdf/hdiff/hdiff_dim.h
+./mfhdf/hdiff/testfiles/hdiff_14.txt
+./mfhdf/hdiff/testfiles/hdifftst7.hdf
+./mfhdf/hdiff/testfiles/hdiff_15.txt
+
+
+
+./mfhdf/hrepack/Makefile.am
+./mfhdf/hrepack/Makefile.in
+./mfhdf/hrepack/hrepack.c
+./mfhdf/hrepack/hrepack.h
+./mfhdf/hrepack/hrepack_all.sh.in
+./mfhdf/hrepack/hrepack_an.c
+./mfhdf/hrepack/hrepack_an.h
+./mfhdf/hrepack/hrepack_check.c
+./mfhdf/hrepack/hrepack_gr.c
+./mfhdf/hrepack/hrepack_gr.h
+./mfhdf/hrepack/hrepack_list.c
+./mfhdf/hrepack/hrepack_lsttable.c
+./mfhdf/hrepack/hrepack_lsttable.h
+./mfhdf/hrepack/hrepack_main.c
+./mfhdf/hrepack/hrepack_opttable.c
+./mfhdf/hrepack/hrepack_opttable.h
+./mfhdf/hrepack/hrepack_parse.c
+./mfhdf/hrepack/hrepack_parse.h
+./mfhdf/hrepack/hrepack_sds.c
+./mfhdf/hrepack/hrepack_sds.h
+./mfhdf/hrepack/hrepack_utils.c
+./mfhdf/hrepack/hrepack_utils.h
+./mfhdf/hrepack/hrepack_vg.c
+./mfhdf/hrepack/hrepack_vg.h
+./mfhdf/hrepack/hrepack_vs.c
+./mfhdf/hrepack/hrepack_vs.h
+./mfhdf/hrepack/hrepack_dim.c
+./mfhdf/hrepack/hrepack_dim.h
+./mfhdf/hrepack/image24pixel.txt
+./mfhdf/hrepack/image24plane.txt
+./mfhdf/hrepack/image8.txt
+./mfhdf/hrepack/info.txt
+./mfhdf/hrepack/pal_rgb.h
+./mfhdf/hrepack/hrepacktst.c
+
+
+./mfhdf/libsrc/Makefile.am
+./mfhdf/libsrc/Makefile.in
+./mfhdf/libsrc/alloc.h
+./mfhdf/libsrc/array.c
+./mfhdf/libsrc/attr.c
+./mfhdf/libsrc/cdf.c
+./mfhdf/libsrc/depend
+./mfhdf/libsrc/dim.c
+./mfhdf/libsrc/error.c
+./mfhdf/libsrc/error.h
+./mfhdf/libsrc/file.c
+./mfhdf/libsrc/globdef.c
+./mfhdf/libsrc/hdf2netcdf.h
+./mfhdf/libsrc/hdfnctest.c
+./mfhdf/libsrc/hdfsds.c
+./mfhdf/libsrc/iarray.c
+./mfhdf/libsrc/local_nc.h
+./mfhdf/libsrc/mfdatainfo.c
+./mfhdf/libsrc/mfdatainfo.h
+./mfhdf/libsrc/mfhdf.h
+./mfhdf/libsrc/mfhdfi.h
+./mfhdf/libsrc/mfprivate.h
+./mfhdf/libsrc/mfsd.c
+./mfhdf/libsrc/netcdf.h.in
+./mfhdf/libsrc/nssdc.c
+./mfhdf/libsrc/putget.c
+./mfhdf/libsrc/putgetg.c
+./mfhdf/libsrc/sharray.c
+./mfhdf/libsrc/string.c
+./mfhdf/libsrc/var.c
+./mfhdf/libsrc/xdrposix.c
+./mfhdf/libsrc/xdrstdio.c
+
+./mfhdf/ncdump/Makefile.am
+./mfhdf/ncdump/Makefile.in
+./mfhdf/ncdump/depend
+./mfhdf/ncdump/dumplib.c
+./mfhdf/ncdump/dumplib.h
+./mfhdf/ncdump/ncdump.1
+./mfhdf/ncdump/ncdump.c
+./mfhdf/ncdump/ncdump.h
+./mfhdf/ncdump/test0.cdl
+./mfhdf/ncdump/testncdump.sh.in
+./mfhdf/ncdump/vardata.c
+./mfhdf/ncdump/vardata.h
+
+./mfhdf/ncgen/Makefile.am
+./mfhdf/ncgen/Makefile.in
+./mfhdf/ncgen/README
+./mfhdf/ncgen/close.c
+./mfhdf/ncgen/depend
+./mfhdf/ncgen/escapes.c
+./mfhdf/ncgen/generate.c
+./mfhdf/ncgen/generic.h
+./mfhdf/ncgen/genlib.c
+./mfhdf/ncgen/genlib.h
+./mfhdf/ncgen/getfill.c
+./mfhdf/ncgen/init.c
+./mfhdf/ncgen/load.c
+./mfhdf/ncgen/main.c
+./mfhdf/ncgen/ncgenyy.c
+./mfhdf/ncgen/ncgentab.c
+./mfhdf/ncgen/ncgentab.h
+./mfhdf/ncgen/ncgen.1
+./mfhdf/ncgen/ncgen.h
+./mfhdf/ncgen/ncgen.l
+./mfhdf/ncgen/ncgen.y
+./mfhdf/ncgen/test0.cdl
+./mfhdf/ncgen/testncgen.sh.in
+./mfhdf/nctest/Makefile.am
+./mfhdf/nctest/Makefile.in
+./mfhdf/nctest/README
+./mfhdf/nctest/add.c
+./mfhdf/nctest/add.h
+./mfhdf/nctest/atttests.c
+./mfhdf/nctest/cdftests.c
+./mfhdf/nctest/depend
+./mfhdf/nctest/dimtests.c
+./mfhdf/nctest/driver.c
+./mfhdf/nctest/emalloc.c
+./mfhdf/nctest/emalloc.h
+./mfhdf/nctest/error.c
+./mfhdf/nctest/error.h
+./mfhdf/nctest/misctest.c
+./mfhdf/nctest/msoft.mk
+./mfhdf/nctest/nctest.def
+./mfhdf/nctest/nctest.lnk
+./mfhdf/nctest/nctest.mak
+./mfhdf/nctest/nctest.project.hqx
+./mfhdf/nctest/rec.c
+./mfhdf/nctest/slabs.c
+./mfhdf/nctest/test_unlim.cdl
+./mfhdf/nctest/test_unlim.nc
+./mfhdf/nctest/testcdf.h
+./mfhdf/nctest/tests.h
+./mfhdf/nctest/val.c
+./mfhdf/nctest/val.h
+./mfhdf/nctest/vardef.c
+./mfhdf/nctest/varget_unlim.c
+./mfhdf/nctest/varget.c
+./mfhdf/nctest/vargetg.c
+./mfhdf/nctest/varput.c
+./mfhdf/nctest/varputg.c
+./mfhdf/nctest/vartests.c
+./mfhdf/nctest/vputget.c
+./mfhdf/nctest/vputgetg.c
+
+./mfhdf/test/Makefile.am
+./mfhdf/test/Makefile.in
+./mfhdf/test/cdftest.c
+./mfhdf/test/cdftest.mak
+./mfhdf/test/gen_sds_szipped.c
+./mfhdf/test/hdfnctest.c
+./mfhdf/test/hdftest.c
+./mfhdf/test/hdftest.h
+./mfhdf/test/sds_szipped.dat
+./mfhdf/test/smallslice.0000.nc
+./mfhdf/test/tattdatainfo.c
+./mfhdf/test/tattributes.c
+./mfhdf/test/tchunk.c
+./mfhdf/test/tcomp.c
+./mfhdf/test/tcoordvar.c
+./mfhdf/test/tdatainfo.c
+./mfhdf/test/tdatasizes.c
+./mfhdf/test/tdim.c
+./mfhdf/test/temptySDSs.c
+./mfhdf/test/test1.nc
+./mfhdf/test/testout.sav
+./mfhdf/test/testmfhdf.sh.in
+./mfhdf/test/tfile.c
+./mfhdf/test/tmixed_apis.c
+./mfhdf/test/tncunlim.c
+./mfhdf/test/tncvargetfill.c
+./mfhdf/test/tnetcdf.c
+./mfhdf/test/trank0.c
+./mfhdf/test/tsd.c
+./mfhdf/test/tsdsprops.c
+./mfhdf/test/tszip.c
+./mfhdf/test/tunlim.c
+./mfhdf/test/tutils.c
+
+./mfhdf/util/getopt.c
+./mfhdf/util/msoft.mk
+./mfhdf/util/win32utl.mak
+
+./mfhdf/xdr/Makefile.am
+./mfhdf/xdr/Makefile.in
+./mfhdf/xdr/NOTICE.h
+./mfhdf/xdr/README
+./mfhdf/xdr/byteordr.c
+./mfhdf/xdr/depend
+./mfhdf/xdr/htonl.mar
+./mfhdf/xdr/msoft.mk
+./mfhdf/xdr/ntohl.mar
+./mfhdf/xdr/testout.sav
+./mfhdf/xdr/test_xdr.sav
+./mfhdf/xdr/types.h
+./mfhdf/xdr/win32xdr.mak
+./mfhdf/xdr/xdrarray.c
+./mfhdf/xdr/xdr.c
+./mfhdf/xdr/xdrfloat.c
+./mfhdf/xdr/xdr.h
+./mfhdf/xdr/xdrlib.project.hqx
+./mfhdf/xdr/xdrstdio.c
+./mfhdf/xdr/xdrtest.c
+./mfhdf/xdr/xdrtest.cyg
+./mfhdf/xdr/xdrtest.mak
+./mfhdf/xdr/xdrtest.opt
+./mfhdf/xdr/xdrtest.out
+./mfhdf/xdr/xdrtest.project.hqx
+
+./mfhdf/ncdump/CMakeLists.txt
+./mfhdf/ncdump/CMakeTests.cmake
+./mfhdf/hdfimport/CMakeLists.txt
+./mfhdf/hdfimport/CMakeTests.cmake
+./mfhdf/hdiff/CMakeLists.txt
+./mfhdf/hdiff/CMakeTests.cmake
+./mfhdf/hrepack/CMakeLists.txt
+./mfhdf/hrepack/CMakeTests.cmake
+./mfhdf/examples/CMakeLists.txt
+./mfhdf/examples/CMakeTests.cmake
+./mfhdf/xdr/xdr.def
+./mfhdf/xdr/CMakeLists.txt
+./mfhdf/libsrc/CMakeLists.txt
+./mfhdf/CMakeLists.txt
+./mfhdf/dumper/CMakeLists.txt
+./mfhdf/dumper/CMakeTests.cmake
+./mfhdf/nctest/CMakeLists.txt
+./mfhdf/nctest/CMakeTests.cmake
+./mfhdf/test/CMakeLists.txt
+./mfhdf/test/CMakeTests.cmake
+./mfhdf/ncgen/CMakeLists.txt
+./mfhdf/ncgen/CMakeTests.cmake
+./mfhdf/fortran/examples/CMakeLists.txt
+./mfhdf/fortran/examples/CMakeTests.cmake
+./mfhdf/fortran/CMakeLists.txt
+./mfhdf/fortran/CMakeTests.cmake
+./hdf/examples/CMakeLists.txt
+./hdf/examples/CMakeTests.cmake
+./hdf/CMakeLists.txt
+./hdf/test/CMakeLists.txt
+./hdf/test/CMakeTests.cmake
+./hdf/util/CMakeLists.txt
+./hdf/util/CMakeTests.cmake
+./hdf/fortran/examples/CMakeLists.txt
+./hdf/fortran/examples/CMakeTests.cmake
+./hdf/fortran/CMakeLists.txt
+./hdf/fortran/CMakeTests.cmake
+./hdf/src/CMakeLists.txt
+./CTestConfig.cmake
+./CMakeLists.txt
+./CMakeFilters.cmake
+./CMakeInstallation.cmake
+./UserMacros.cmake
+
+./config/cmake/ConfigureChecks.cmake
+./config/cmake/CTestCustom.cmake
+./config/cmake/runTest.cmake
+./config/cmake/HDFMacros.cmake
+./config/cmake/HDFLibMacros.cmake
+./config/cmake/CheckTypeSize.cmake
+./config/cmake/h4config.h.in
+./config/cmake/HDFTests.c
+./config/cmake/FindHDF4.cmake.in
+./config/cmake/FindSZIP.cmake
+./config/cmake/FindMPI.cmake
+./config/cmake/cacheinit.cmake
+./config/cmake/mccacheinit.cmake
+./config/cmake/HDF4Macros.cmake
+./config/cmake/HDF4UseFortran.cmake
+./config/cmake/HDF4_Examples.cmake.in
+./config/cmake/hdf4-config.cmake.build.in
+./config/cmake/hdf4-config.cmake.install.in
+./config/cmake/hdf4-config-version.cmake.in
+./config/cmake/CPack.Info.plist.in
+./config/cmake/hdf.gif
+./config/cmake/libhdf4.settings.cmake.in
+./config/cmake/NSIS.template.in
+./config/cmake/NSIS.InstallOptions.ini.in
+
+# CMake-specific User Files
+./config/cmake/UserMacros/Windows_MT.cmake
+
+./release_notes/HISTORY.txt
+./release_notes/RELEASE.txt
+./release_notes/INSTALL
+./release_notes/INSTALL_CYGWIN.txt
+./release_notes/INSTALL_WINDOWS.txt
+./release_notes/bugs_fixed.txt
+./release_notes/misc_docs.txt
+./release_notes/INSTALL_CMake.txt
+./release_notes/USING_HDF4_VS.txt
+./release_notes/USING_HDF4_CMake.txt
+./release_notes/USING_CMake_Examples.txt
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6bbb361
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+# Top-level distributed Makefile 			       -*- makefile -*-
+
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF.  The full HDF 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      
+# http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have 
+# access to either file, you may request a copy from help at hdfgroup.org.     
+
+
+# This Makefile is a stub (copied from Makefile.dist) which will run
+# configure and then invoke the same target in the new Makefile created
+# by configure.
+
+# Uncomment this variable if your make(1) doesn't set it automatically.
+#
+#MAKE=make
+
+
+SHELL=/bin/sh
+
+all lib progs check test _test install uninstall dep depend: _config
+	$(MAKE) $@
+
+clean mostlyclean distclean maintainer-clean TAGS: _config
+	$(MAKE) $@
+
+_config:
+	sh configure
+
+.PHONY: all lib progs test install uninstall dep depend clean mostlyclean     \
+	distclean maintainer-clean _config
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..e146a28
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,29 @@
+#############################################################################
+##                      Subdirectories to build in                         ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+SUBDIRS = hdf mfhdf man
+# install libhdf4.settings in lib directory
+settingsdir = $(libdir)
+settings_DATA = libhdf4.settings
+
+# 'make install' will now install examples, the same as 'make install-all'.
+# 'make-install-all' will be redundant but will still work.
+install: install-recursive install-examples
+uninstall: uninstall-recursive uninstall-examples
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in hdf mfhdf; do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
diff --git a/Makefile.dist b/Makefile.dist
new file mode 100644
index 0000000..6bbb361
--- /dev/null
+++ b/Makefile.dist
@@ -0,0 +1,36 @@
+# Top-level distributed Makefile 			       -*- makefile -*-
+
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF.  The full HDF 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      
+# http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have 
+# access to either file, you may request a copy from help at hdfgroup.org.     
+
+
+# This Makefile is a stub (copied from Makefile.dist) which will run
+# configure and then invoke the same target in the new Makefile created
+# by configure.
+
+# Uncomment this variable if your make(1) doesn't set it automatically.
+#
+#MAKE=make
+
+
+SHELL=/bin/sh
+
+all lib progs check test _test install uninstall dep depend: _config
+	$(MAKE) $@
+
+clean mostlyclean distclean maintainer-clean TAGS: _config
+	$(MAKE) $@
+
+_config:
+	sh configure
+
+.PHONY: all lib progs test install uninstall dep depend clean mostlyclean     \
+	distclean maintainer-clean _config
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..546c708
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,878 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/libhdf4.settings.in \
+	$(top_srcdir)/bin/config.guess $(top_srcdir)/bin/config.sub \
+	$(top_srcdir)/bin/install-sh $(top_srcdir)/bin/ltmain.sh \
+	$(top_srcdir)/bin/missing $(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am $(top_srcdir)/configure \
+	COPYING bin/compile bin/config.guess bin/config.sub \
+	bin/depcomp bin/install-sh bin/ltmain.sh bin/missing \
+	bin/mkinstalldirs
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = libhdf4.settings
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(settingsdir)"
+DATA = $(settings_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	cscope distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+SUBDIRS = hdf mfhdf man
+# install libhdf4.settings in lib directory
+settingsdir = $(libdir)
+settings_DATA = libhdf4.settings
+all: all-recursive
+
+.SUFFIXES:
+am--refresh: Makefile
+	@:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	$(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+libhdf4.settings: $(top_builddir)/config.status $(srcdir)/libhdf4.settings.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool config.lt
+install-settingsDATA: $(settings_DATA)
+	@$(NORMAL_INSTALL)
+	@list='$(settings_DATA)'; test -n "$(settingsdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(settingsdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(settingsdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(settingsdir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(settingsdir)" || exit $$?; \
+	done
+
+uninstall-settingsDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(settings_DATA)'; test -n "$(settingsdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(settingsdir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+cscopelist-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscope: cscope.files
+	test ! -s cscope.files \
+	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+
+clean-cscope:
+	-rm -f cscope.files
+
+cscope.files: clean-cscope cscopelist-recursive cscopelist
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	test -d "$(distdir)" || mkdir "$(distdir)"
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+		am__skip_mode_fix=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	-test -n "$(am__skip_mode_fix)" \
+	|| find "$(distdir)" -type d ! -perm -755 \
+		-exec chmod u+rwx,go+rx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__post_remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+	$(am__post_remove_distdir)
+
+dist-lzip: distdir
+	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+	$(am__post_remove_distdir)
+
+dist-xz: distdir
+	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+	$(am__post_remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__post_remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__post_remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__post_remove_distdir)
+
+dist dist-all:
+	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+	$(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lz*) \
+	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+	*.tar.xz*) \
+	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir)
+	chmod u+w $(distdir)
+	mkdir $(distdir)/_build $(distdir)/_inst
+	chmod a-w $(distdir)
+	test -d $(distdir)/_build || exit 0; \
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && am__cwd=`pwd` \
+	  && $(am__cd) $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+	  && cd "$$am__cwd" \
+	  || exit 1
+	$(am__post_remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+	@test -n '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: trying to run $@ with an empty' \
+	       '$$(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	$(am__cd) '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(settingsdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-settingsDATA
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-settingsDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+	cscopelist-recursive ctags-recursive install-am install-strip \
+	tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am am--refresh check check-am clean clean-cscope \
+	clean-generic clean-libtool cscope cscopelist \
+	cscopelist-recursive ctags ctags-recursive dist dist-all \
+	dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \
+	dist-zip distcheck distclean distclean-generic \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-settingsDATA install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-settingsDATA
+
+
+# 'make install' will now install examples, the same as 'make install-all'.
+# 'make-install-all' will be redundant but will still work.
+install: install-recursive install-examples
+uninstall: uninstall-recursive uninstall-examples
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in hdf mfhdf; do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..2351cd2
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,90 @@
+HDF version 4.2.10 released on 2014-02-09
+===================================================
+
+Obtaining the latest version of HDF4
+------------------------------------
+ The most recent version of the distribution can be obtained from
+ the The HDF Group's FTP site:
+
+     ftp://ftp.hdfgroup.org/HDF/HDF_Current/
+
+
+Source Distribution Layout
+--------------------------
+ The top level of the source code distribution contains the following 
+ subdirectories:
+
+   bin    -- Scripts for maintenance.
+
+   config -- Configuration files to be used by configure script.
+
+   hdf    -- The source code for the HDF 'base library', the multi-file 
+             annotation interface, the multi-file raster image interface, 
+             HDF command line utilities, and a test suite. 
+             Please see the README in each directory for further 
+             information on each package. 
+
+   mfhdf  -- The netCDF(mfhdf) part of the HDF/mfhdf distribution and
+             additional HDF utilities, such as hdp, hrepack, hdfimport, etc.
+
+   man    -- An incomplete set of man page(s) for HDF.
+
+   release_notes -- 
+             Installation instructions for UNIX and Windows.
+             Descriptions of new features and bug fixes in this release.
+             Files in this sub-directory can be used as supplemental 
+             documentation for HDF. 
+             These files are also available on the THG FTP server: 
+             ftp://ftp.hdfgroup.org/HDF/HDF_Current/src/unpacked/release_notes
+
+   windows-- Removed 4/2013.
+
+
+Third Party Software Requirements
+---------------------------------
+ 1. JPEG distribution release 6b(libjpeg.a).  You may download the software
+    from http://www.hdfgroup.org/release4/obtain.html.
+
+ 2. ZLIB 1.1.4(libz.a) or later  distribution.  You may download the software
+    from the http://www.gzip.org/ site.
+
+
+
+System Requirements
+-------------------
+ To build the HDF library from source, you need:
+
+   * C and Fortran compilers. For a list of the supported compilers,
+     see release_notes/RELEASE.txt file.
+
+
+Configuring/Testing/Installing 
+------------------------------
+ See the INSTALL file for instructions on configuring, testing, 
+ and installing this software on Unix and non-UNIX systems.
+
+
+DOCUMENTATION/FAQ/HELP
+----------------------
+ The HDF documentation can be found on the THG FTP server and on 
+ the THG website:
+
+      http://hdfgroup.org/doc.html
+      ftp://ftp.hdfgroup.org/HDF/Documentation  
+
+ The HDF home page is at:
+
+      http://hdfgroup.org
+
+ An FAQ is available on the FTP server and as under "Information about 
+ HDF" on the website.
+
+      http://hdfgroup.org/products/hdf4/index.html
+
+ If you have any questions or comments, or would like to be added to 
+ or removed from our hdfnews email list, contact information and other 
+ resource information can be found on the HDF Support page:
+
+     http://hdfgroup.org/services/support.html
+
+
diff --git a/UserMacros.cmake b/UserMacros.cmake
new file mode 100644
index 0000000..4c680ed
--- /dev/null
+++ b/UserMacros.cmake
@@ -0,0 +1,22 @@
+########################################################
+#  Include file for user options
+########################################################
+
+#-----------------------------------------------------------------------------
+#------------------- E X A M P L E   B E G I N--------------------------------
+#-----------------------------------------------------------------------------
+# Option to Build with User Defined Values
+#-----------------------------------------------------------------------------
+MACRO (MACRO_USER_DEFINED_LIBS)
+  SET (USER_DEFINED_VALUE "FALSE")
+ENDMACRO (MACRO_USER_DEFINED_LIBS)
+
+#-------------------------------------------------------------------------------
+OPTION (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF)
+IF (BUILD_USER_DEFINED_LIBS)
+  MACRO_USER_DEFINED_LIBS ()
+ENDIF (BUILD_USER_DEFINED_LIBS)
+#-----------------------------------------------------------------------------
+#------------------- E X A M P L E   E N D -----------------------------------
+#-----------------------------------------------------------------------------
+ 
\ No newline at end of file
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..5172af3
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,9569 @@
+# generated automatically by aclocal 1.12.3 -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.12'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.12.3], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.12.3])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named 'Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running 'make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+[$0: two- and three-arguments forms are deprecated.  For more info, see:
+http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+			     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+		  [_AM_DEPENDENCIES([CC])],
+		  [m4_define([AC_PROG_CC],
+			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+		  [_AM_DEPENDENCIES([CXX])],
+		  [m4_define([AC_PROG_CXX],
+			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+		  [_AM_DEPENDENCIES([OBJC])],
+		  [m4_define([AC_PROG_OBJC],
+			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+dnl Support for Objective C++ was only introduced in Autoconf 2.65,
+dnl but we still cater to Autoconf 2.62.
+m4_ifdef([AC_PROG_OBJCXX],
+[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+		  [_AM_DEPENDENCIES([OBJCXX])],
+		  [m4_define([AC_PROG_OBJCXX],
+			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless 'enable' is passed literally.
+# For symmetry, 'disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t at _MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+      am_maintainer_other[ make rules and dependencies not useful
+      (and sometimes confusing) to the casual installer])],
+    [USE_MAINTAINER_MODE=$enableval],
+    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
+    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$[*]" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$[*]" != "X $srcdir/configure conftest.file" \
+	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment])
+     fi
+     if test "$[2]" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of '-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool at gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Go],			[_LT_LANG(GO)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[23]].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux # correct to gnu/linux during the next big refactor
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t at _DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+        *Intel*\ [[CF]]*Compiler*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
+	*Portland\ Group*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
+
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
+
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
+
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
+
diff --git a/bin/chkmanifest b/bin/chkmanifest
new file mode 100755
index 0000000..69cd728
--- /dev/null
+++ b/bin/chkmanifest
@@ -0,0 +1,169 @@
+#!/bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+
+# Check that all the files in MANIFEST exist and that (if this is a
+# SVN checkout) that all the SVN-managed files appear in the
+# MANIFEST.
+
+verbose=yes
+MANIFEST=/tmp/HD_MANIFEST.$$
+SVNENTRY=/tmp/HD_SVNENTRY.$$
+
+# function definitions
+
+GETSVNENTRIES_13 ()
+# Purpose: Extract filenames from the svn v1.3.* entries file
+# $1: directory name in which the svn entries is.
+# steps:
+# 1. remove all single line entries so that step 2 does not fail on them. 
+# 2. merge all multiple lines entries into single lines.
+# 3. remove all non file entries.
+# 4. insert a blank line because some entries files has no kind="file"
+#    entry and ed does not like to do g on an empty file.
+# 5. remove everything except the file name.
+# 6. remove all blank lines, including the inserted one.
+{
+cp $1/entries $SVNENTRY
+chmod u+w $SVNENTRY	# entries file is not writable.
+ed - $SVNENTRY <<EOF
+g/^<.*>$/d
+g/^</.,/>$/j
+v/kind="file"/d
+a
+
+.
+g/.*name="/s///
+g/".*/s///
+g/^$/d
+w
+q
+EOF
+cat $SVNENTRY
+rm $SVNENTRY
+}
+
+GETSVNENTRIES_14 ()
+# Purpose: Extract filenames from the svn v1.4.* entries file
+# $1: directory name in which the svn entries is.
+# steps:
+# 1. all valid files are followed by a line containing "file" only.
+# 2. find them by looking for "file" first, then mark its preceding line as
+#    wanted.
+# 3. remove all non-marked line.
+# 4. insert a blank line because some entries files has no kind="file"
+#    entry and ed does not like to do g on an empty file.
+# 5. remove the marks.
+{
+cp $1/entries $SVNENTRY
+chmod u+w $SVNENTRY	# entries file is not writable.
+ed - $SVNENTRY <<EOF
+g/^file$/-s/^/%WANTED%/
+v/%WANTED%/d
+a
+
+.
+g/^%WANTED%/s///
+w
+q
+EOF
+cat $SVNENTRY
+rm $SVNENTRY
+}
+
+
+# Main
+test "$verbose" && echo "   Checking MANIFEST..." 1>&2
+# clean up $MANIFEST file when exits
+trap "rm -f $MANIFEST" 0
+
+# First make sure i am in the directory in which there is an MANIFEST file
+# and then do the checking from there.  Will try the following,
+# current directory, parent directory, the directory this command resides.
+if [ -f MANIFEST ]; then
+    continue
+elif [ -f ../MANIFEST ]; then
+    cd ..
+else
+    commanddir=`dirname $0`
+    if [ -d "$commanddir" -a -f $commanddir/MANIFEST ]; then
+	cd $commanddir
+	continue
+    else
+	echo MANIFEST file not found. Abort.
+	exit 1
+    fi
+fi
+
+# Check for duplicate entries.  This can be done at any time, but it may as
+# well be sooner so that if something else fails the presence of duplicates
+# will already be known.
+errcode=0
+DUPLICATES=`perl -ne 's/#.*//; next if /^\s*$/; if ($uniq{$_}++) { print $_; }' MANIFEST`
+if [ "$DUPLICATES" ]; then
+   cat 1>&2 <<EOF
+These entries appear more than once in the MANIFEST:
+$DUPLICATES
+Please remove the duplicate lines and try again.
+
+EOF
+errcode=1
+fi
+
+# Copy the manifest file to get a list of file names.
+grep '^\.' MANIFEST | expand | cut -f1 -d' ' >$MANIFEST
+
+for file in `cat $MANIFEST`; do
+    if [ ! -f $file ]; then
+       echo "- $file"
+       fail=yes
+    fi
+done
+
+# Inspect the .svn/entries to figure out what version of svn file entry is
+# used.
+# The following algorithm is formed via reverse engineering.
+# I don't know what the official svn format is if such a specification exists.
+# Algorithm:
+# If the first line of the file has 'xml version="1.0"' in it, it is created
+# by svn 1.3 or older; else if it has '^file$' in it, it is created by svn 1.4.
+svn_entry_file=.svn/entries
+if head -1 $svn_entry_file | grep 'xml version="1.0"' > /dev/null 2>&1;then
+    getsvnentries=GETSVNENTRIES_13
+elif grep '^file$' $svn_entry_file > /dev/null 2>&1; then
+    getsvnentries=GETSVNENTRIES_14
+else
+    echo "Unknown svn entries format. Aborted"
+    exit 1
+fi
+
+for svn in `find . -type d -name .svn -print`; do
+    path=`echo $svn |sed 's/\/.svn//'`
+    for file in `$getsvnentries $svn`; do
+	if (grep ^$path/$file$ $MANIFEST >/dev/null); then
+	    :
+	else
+	    echo "+ $path/$file"
+	    fail=yes
+	fi
+    done
+done
+
+if [ "X$fail" = "Xyes" ]; then
+    cat 1>&2 <<EOF
+The MANIFEST is out of date. Files marked with a minus sign (-) no
+longer exist; files marked with a plus sign (+) are SVN-managed but do
+not appear in the MANIFEST.  Please remedy the situation and try again.
+EOF
+    exit 1
+fi
+
+if [ $errcode -gt 0 ]; then
+    exit $errcode
+fi
+
+test "$verbose" && echo "   The MANIFEST is up to date." 1>&2
+exit 0
diff --git a/bin/cmakehdf4 b/bin/cmakehdf4
new file mode 100755
index 0000000..f7b6ac5
--- /dev/null
+++ b/bin/cmakehdf4
@@ -0,0 +1,379 @@
+#! /bin/sh
+# Build and Test HDF4 using cmake.
+# Author: Allen Byrne
+#         Albert Cheng
+# Creation Date: Nov 2012
+# Modified:
+#	Changed to use the quick steps described in INSTALL_CMake.txt. (AKC 2014/1/7)
+
+# Copyright: The HDF Group, 2012-14
+
+# Debug Print: remove the comment hash if you want DPRINT to do echo
+DPRINT=:
+#DPRINT=echo
+
+# use the ctest scripting method if --script is given
+if [ "$1" != "--script" ]; then
+# variable names
+# The "extra" number is the step number and easier to see all logfiles in
+# the sorted order of steps
+progname=`basename $0`	# program name
+configlog="#${progname}_1config.log"
+makelog="#${progname}_2build.log"
+testlog="#${progname}_3test.log"
+packlog="#${progname}_4pack.log"
+installlog="#${progname}_5install.log"
+srcdir="../hdf4"	# expected source directory
+exit_code=0
+
+#=============
+# Function definitions
+#=============
+
+# Show user help page
+HELP()
+{
+    echo "Usage: $progname [--script]"
+    echo "  --script: Use the ctest scripting method of $progname"
+    echo ""
+}
+
+# Display a time stamp
+TIMESTAMP()
+{
+    echo "=====" "`date`" "====="
+}
+
+
+# Do one step bracketed with time stamps
+# The '< /dev/null' is needed to prevent some applications like MPI
+# jobs blocked for reading when they read stdin unnecessary.
+# $1 is banner message to be displayed.
+# $2 is command to run
+# $3 is logfile name for saving output from the command
+STEP()
+{
+    banner="$1"
+    command="$2"
+    logfile="$3"
+
+    echo "$banner" with output saved in $logfile
+    (TIMESTAMP; nerror=0 ;
+	echo "eval $command"
+	eval $command || nerror=1 ;
+	TIMESTAMP; exit $nerror) < /dev/null >> "$logfile" 2>&1
+    if [ $? -ne 0 ]; then
+	echo "error in '$banner'.  $progname aborted."
+	exit 1
+    fi
+}
+
+
+#==========
+# main
+#==========
+
+# Show a start time stamp/hdf4
+TIMESTAMP
+
+# Always display the help page
+HELP
+
+# Verify there is a valid hdf4 source directory present
+if [ ! -d $srcdir ]; then
+    echo $srcdir not found. Aborted.
+    exit 1
+fi
+
+# figure out version information
+vers=bin/h4vers
+if [ ! -x $srcdir/$vers ]; then
+    echo $srcdir/$vers not found or not executable. Aborted.
+    exit 1
+fi
+version=`cd $srcdir; $vers`
+if [ $? != 0 ]; then
+    echo $vers failed. Aborted.
+    exit 1
+fi
+echo Running Cmake for HDF4-${version} ...
+
+#      4. Configure the C library, tools and tests with this command:
+STEP "Configure..." "cmake -C ../hdf4/config/cmake/cacheinit.cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH="." -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" -DHDF4_PACKAGE_EXTLIBS:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON -DHDF4_BUILD_UTILS:BOOL=ON -DBUILD_TESTING:BOOL=ON ../hdf4" $configlog
+      
+#      5. Build the C library, tools and tests with this command:
+STEP "Build the library, tools and tests, ..." "cmake --build . --config Release" $makelog
+      
+#      6. Test the C library and tools with this command:
+STEP "Test the library and tools..." "ctest . -C Release" $testlog
+      
+#      7. Create an install image with this command:
+STEP "Create an install image..." "cpack -C Release CPackConfig.cmake" $packlog
+      
+#      8. Install with this command:
+STEP "Install..." "./HDF-4.2.10-Linux.sh --skip-license" $installlog
+# save the last exit code
+exit_code=$?
+
+# Show a closing time stamp
+TIMESTAMP
+exit $exit_code
+
+else
+# ---------------
+# older version
+# ---------------
+
+# variable names
+progname=`basename $0`	# program name
+cminfile="cmakemin.$$" # Cmake minimum file
+cfgfile=$progname.$$	# configure file
+ctest_log=ctest.log    # output of ctest script
+install_log=install.log  # output of installation
+$DPRINT $cfgfile
+
+# Remove temporary generated files if exit 0
+trap "rm -f $cminfile $cfgfile" 0
+
+#=============
+# Function definitions
+#=============
+TIMESTAMP()
+{
+    echo "=====" "`date`" "====="
+}
+
+
+#==========
+# main
+#==========
+# Show a start time stamp
+TIMESTAMP
+
+# Explain what and where log files are.
+cat <<EOF
+$ctest_log: output of ctest script.
+$install_log: output of installation
+Log files will be stored in Testing/Temporary:
+    LastConfigure_<timestamp>.log: output of configure
+    LastBuild_<timestamp>.log: output of build
+    LastTest_<timestamp>.log: output of testing
+    LastTestsFailed_<timestamp>.log: list of failed tests
+
+EOF
+
+# First generate the two needed input files, the $cimnfile and $cfgfile.
+# Then use ctest to use the two input files.
+
+#==========
+# create the configure file
+#==========
+# Create the cmake minimum required file to be used by the following
+# configure file. Though not absolute needed, it is better to generate
+# this file before the configure file.  Quote the EOF to preven substitution
+# in the text.
+#==========
+#==========
+cat > $cfgfile <<'EOF'
+cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+########################################################
+# This dashboard is maintained by The HDF Group
+# For any comments please contact cdashhelp at hdfgroup.org
+#
+########################################################
+
+set (CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
+set (CTEST_SOURCE_DIRECTORY "../hdf4")
+set (CTEST_BINARY_DIRECTORY ".")
+set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
+set (CTEST_BUILD_CONFIGURATION "Release")
+set (CTEST_MAX_N 8)
+
+# -- CDash variables
+set (LOCAL_NO_SUBMIT TRUE)	# No CDash submit.
+set (MODEL "Experimental")
+set (CDASH_LOCAL TRUE)
+set (SITE_BUILDNAME_SUFFIX "cmakehdf4")
+
+# -- URL set for internal check, default is to not update
+set (LOCAL_SKIP_UPDATE TRUE)
+set (REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf4/trunk")
+# -- Standard build options  
+set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY} -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF4_PACKAGE_EXTLIBS:BOOL=ON")
+
+# Use multiple CPU cores to build
+include(ProcessorCount)
+ProcessorCount(N)
+if(NOT N EQUAL 0)
+  if(N GREATER ${CTEST_MAX_N})
+    set(N ${CTEST_MAX_N})
+  endif(N GREATER ${CTEST_MAX_N})
+  set(CTEST_BUILD_FLAGS -j${N})
+  set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
+endif()
+
+# -----------------------------------------------------------  
+# -- Get environment
+# -----------------------------------------------------------  
+  ## -- set hostname
+  ## --------------------------
+  find_program (HOSTNAME_CMD NAMES hostname)
+  exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
+  set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}")
+  find_program (UNAME NAMES uname)
+  macro (getuname name flag)
+    exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
+  endmacro (getuname)
+
+  getuname (osname -s)
+  getuname (osrel  -r)
+  getuname (cpu    -m)
+
+  if (SITE_BUILDNAME_SUFFIX)
+    set (CTEST_BUILD_NAME  "${osname}-${osrel}-${cpu}-${SITE_BUILDNAME_SUFFIX}")
+  else (SITE_BUILDNAME_SUFFIX)
+    set (CTEST_BUILD_NAME  "${osname}-${osrel}-${cpu}")
+  endif (SITE_BUILDNAME_SUFFIX)
+# -----------------------------------------------------------  
+  
+set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
+ 
+#-----------------------------------------------------------------------------
+# MAC machines need special option
+#-----------------------------------------------------------------------------
+if (APPLE)
+  # Compiler choice
+  execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
+  SET(ENV{CC} "${XCODE_CC}")
+  SET(ENV{CXX} "${XCODE_CXX}")
+  # Shared fortran is not supported, build static 
+  set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_JPEG_WITH_PIC:BOOL=ON -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
+  set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
+endif (APPLE)
+
+
+# -----------------------------------------------------------  
+find_package (Subversion)
+set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}")
+# -- Only clean build folder if LOCAL_CLEAR_BUILD is set  
+if (LOCAL_CLEAR_BUILD)
+  set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
+  ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY})
+endif (LOCAL_CLEAR_BUILD)
+
+#-----------------------------------------------------------------------------
+# Send the main script as a note.
+list (APPEND CTEST_NOTES_FILES
+  "${CMAKE_CURRENT_LIST_FILE}"
+  "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake"
+  )
+
+# Check for required variables.
+foreach (req
+    CTEST_CMAKE_GENERATOR
+    CTEST_SITE
+    CTEST_BUILD_NAME
+    )
+  if (NOT DEFINED ${req})
+    message(FATAL_ERROR "The containing script must set ${req}")
+  endif (NOT DEFINED ${req})
+endforeach (req)
+
+## -- set output to english
+set($ENV{LC_MESSAGES}  "en_EN")
+ 
+#-----------------------------------------------------------------------------
+# Initialize the CTEST commands
+#------------------------------
+SET (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
+SET (CTEST_CONFIGURE_COMMAND
+    "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"")
+
+# Print summary information.
+foreach (v
+    CTEST_SITE
+    CTEST_BUILD_NAME
+    CTEST_SOURCE_DIRECTORY
+    CTEST_BINARY_DIRECTORY
+    CTEST_CMAKE_GENERATOR
+    CTEST_BUILD_CONFIGURATION
+    CTEST_CONFIGURE_COMMAND
+    CTEST_SCRIPT_DIRECTORY
+    )
+  set (vars "${vars}  ${v}=[${${v}}]\n")
+endforeach (v)
+message ("Dashboard script configuration:\n${vars}\n")
+
+CTEST_START (${MODEL} TRACK ${MODEL})
+if (NOT LOCAL_SKIP_UPDATE)
+  CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}")
+endif (NOT LOCAL_SKIP_UPDATE)
+CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+if(NOT res STREQUAL "0")
+  message (FATAL_ERROR "Configure FAILED")
+endif()
+message ("Configure DONE")
+CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}")
+if (NOT LOCAL_NO_SUBMIT)
+  CTEST_SUBMIT (PARTS Update Configure Notes)
+endif (NOT LOCAL_NO_SUBMIT)
+CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res)
+if (NOT LOCAL_NO_SUBMIT)
+  CTEST_SUBMIT (PARTS Build)
+endif (NOT LOCAL_NO_SUBMIT)
+if(NOT res STREQUAL "0")
+  message (FATAL_ERROR "Build FAILED")
+endif()
+message ("build DONE")
+if (NOT LOCAL_SKIP_TEST)
+  CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
+  if (NOT LOCAL_NO_SUBMIT)
+    CTEST_SUBMIT (PARTS Test)
+  endif (NOT LOCAL_NO_SUBMIT)
+  if(NOT res STREQUAL "0")
+    message (FATAL_ERROR "Test FAILED")
+  endif()
+  message ("test DONE")
+endif (NOT LOCAL_SKIP_TEST)
+if(NOT LOCAL_MEMCHECK_TEST)
+  ##-----------------------------------------------
+  ## Package the product
+  ##-----------------------------------------------
+  execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V
+    WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
+    RESULT_VARIABLE cpackResult
+    OUTPUT_VARIABLE cpackLog
+    ERROR_VARIABLE cpackLog.err
+  )
+  file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}")
+endif(NOT LOCAL_MEMCHECK_TEST)
+#-----------------------------------------------------------------------------
+
+message ("DONE")
+EOF
+
+
+# Run ctest
+ctest -S $cfgfile -C Release -V -O $ctest_log
+exit_code=$?
+if [ $exit_code = 0 ]; then
+    echo CTest script completed without error
+else
+    echo Error encountered CTest script
+fi
+# Using HDF-*.sh because actual name is unavailable
+install_sh=HDF-*.sh
+echo installing with $install_sh ...
+./$install_sh --skip-license > $install_log
+exit_code=$?
+if [ $exit_code = 0 ]; then
+    echo Complete without error
+else
+    echo Error encountered
+fi
+TIMESTAMP
+exit $exit_code
+
+fi
+
diff --git a/bin/compile b/bin/compile
new file mode 100755
index 0000000..9bb997a
--- /dev/null
+++ b/bin/compile
@@ -0,0 +1,99 @@
+#! /bin/sh
+
+# Wrapper for compilers which do not understand `-c -o'.
+
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey at cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Usage:
+# compile PROGRAM [ARGS]...
+# `-o FOO.o' is removed from the args passed to the actual compile.
+
+prog=$1
+shift
+
+ofile=
+cfile=
+args=
+while test $# -gt 0; do
+   case "$1" in
+    -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we do something ugly here.
+       ofile=$2
+       shift
+       case "$ofile" in
+	*.o | *.obj)
+	   ;;
+	*)
+	   args="$args -o $ofile"
+	   ofile=
+	   ;;
+       esac
+       ;;
+    *.c)
+       cfile=$1
+       args="$args $1"
+       ;;
+    *)
+       args="$args $1"
+       ;;
+   esac
+   shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+   # If no `-o' option was seen then we might have been invoked from a
+   # pattern rule where we don't need one.  That is ok -- this is a
+   # normal compilation that the losing compiler can handle.  If no
+   # `.c' file was seen then we are probably linking.  That is also
+   # ok.
+   exec "$prog" $args
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
+while true; do
+   if mkdir $lockdir > /dev/null 2>&1; then
+      break
+   fi
+   sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir $lockdir; exit 1" 1 2 15
+
+# Run the compile.
+"$prog" $args
+status=$?
+
+if test -f "$cofile"; then
+   mv "$cofile" "$ofile"
+fi
+
+rmdir $lockdir
+exit $status
diff --git a/bin/config.guess b/bin/config.guess
new file mode 100755
index 0000000..159b1dc
--- /dev/null
+++ b/bin/config.guess
@@ -0,0 +1,1529 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
+
+timestamp='2008-01-23'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[456])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+    echo ${UNAME_MACHINE}-pc-cygwin
+    exit ;;
+    x*:CYGWIN*:*)
+    echo ${UNAME_MACHINE}-pc-cygwin
+    exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes at openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/bin/config.sub b/bin/config.sub
new file mode 100755
index 0000000..6759825
--- /dev/null
+++ b/bin/config.sub
@@ -0,0 +1,1658 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
+
+timestamp='2008-01-16'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/bin/depcomp b/bin/depcomp
new file mode 100755
index 0000000..aea3d00
--- /dev/null
+++ b/bin/depcomp
@@ -0,0 +1,472 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+if test -z "$depfile"; then
+   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
+   dir=`echo "$object" | sed 's,/.*$,/,'`
+   if test "$dir" = "$object"; then
+      dir=
+   fi
+   # FIXME: should be _deps on DOS.
+   depfile="$dir.deps/$base"
+fi
+
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      tmpdepfile1="$dir.libs/$base.lo.d"
+      tmpdepfile2="$dir.libs/$base.d"
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1="$dir$base.o.d"
+      tmpdepfile2="$dir$base.d"
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
diff --git a/bin/deploy b/bin/deploy
new file mode 100755
index 0000000..a5db4b3
--- /dev/null
+++ b/bin/deploy
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF.  The full HDF copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING.  COPYING can be found at the root
+# of the source code distribution tree.  If you do not have
+# access to the file, you may request a copy from hdfhelp at ncsa.uiuc.edu.
+#
+# Deploy the HDF4 binary.
+#
+# Programmer: Albert Cheng
+# Created Date: 2005/04/07
+#
+# Modifications
+
+# Function definitions
+#
+# Print Usage page
+USAGE()
+{
+cat << EOF
+Usage: $0 <dir>
+   Install the binary to directory <dir>
+
+Examples:
+
+    $ bin/deploy /usr/local/hdf4
+    ....
+
+EOF
+
+}
+
+
+# Variables
+
+if [ $# != 1 ]; then
+    USAGE
+    exit 1
+fi
+
+installdir=$1
+# create installdir if it does not exist yet.
+if [ -d $installdir ] || mkdir $installdir ; then
+    ${MAKE:-gmake} install prefix=$installdir && \
+        ( cd $installdir/bin; ./h4redeploy -force)
+    exit $?
+else
+    echo $installdir is not a valid directory
+    USAGE
+    exit 1
+fi
+
diff --git a/bin/h4vers b/bin/h4vers
new file mode 100755
index 0000000..0daa4bb
--- /dev/null
+++ b/bin/h4vers
@@ -0,0 +1,478 @@
+#! /bin/sh
+perl -x -S $0 "$@"
+exit
+
+#! perl
+require 5.003;
+use strict;
+
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF.  The full HDF 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      
+# http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have 
+# access to either file, you may request a copy from help at hdfgroup.org.     
+#
+#
+# Robb Matzke <matzke at llnl.gov>
+# 17 July 1998
+#
+# HDF4 alterations 
+# Larry Knox <lrknox at hdfgroup.org>
+# 25 September 2009
+
+### Purpose
+# Increments the hdf4 version number by changing the value of
+# constants in the hdf/src/hfile.h file.  The new version number is
+# printed on the standard output. An alternate source file name can be
+# specified as an argument.  In any case, the original file is saved
+# by appending a tilde `~' to the name.
+
+### Usage:
+# h4vers [OPTIONS] [FILE]
+
+# Without options this program only displays the current version and
+# doesn't modify any files or create backups.  The default is to print
+# The space and parentheses around A are only printed if A is not empty.
+#
+# The `-s VERSION' switch will set the version as specified.  If the
+# string contains a dotted triple then it will be used as the version
+# number, otherwise up to three numbers will be read from the end of
+# the string and used as the major version, minor version, and release
+# number.  If any numbers are missing then zero is assumed.  This
+# allows versions to be specified like `-s "version 4.2 release 4"' or
+# `-s hdf4-4.2.4.tar.bz2'.  If the new version is less than the old
+# version then a warning message is generated on standard error. The
+# annotation string, A, is set only if it appears immediately after the
+# third number, separated by a dash (e.g., `1.2.3-pre1') or in parentheses
+# (e.g., `version 1.2 release 3 (pre1)').
+#
+# The `-i [major|minor|release|annot|last]' option increments the major
+# number, minor number, release number, or annotation string. The `last'
+# switch increments the annotation string if present, otherwise the
+# release number. If the release number is incremented then the annotation
+# string is cleared.  If the minor number is incremented then the release
+# number is set to zero and the annotation string is cleared; if the major
+# number is incremented then the minor and release numbers are set to zero
+# and the annotation string is cleared.
+#
+# If a file is specified then that file is used instead of
+# ./hfile.h or ./hdf/src/hfile.h.
+#
+# If the version number is changed (either `-s' or `-i' was used on
+# the command line) then the first line of the README.txt and 
+# release_notes/RELEASE.txt two levels above the hfile.h file are also 
+# modified so it looks something like: This is hdf4-1.2.3-pre1 currently 
+# under development. The AC_INIT macro in configure.in will also change 
+# in this case to be something like: AC_INIT([HDF4], [hdf4-1.2.3-pre1], 
+# [help at hdfgroup.org]).
+#
+#Following paragraph from h5vers does not apply for HDF4?
+# Whenever the version changes, this script will increment the revision
+# field in HDF5's libtool shared library version in config/lt_vers.am,
+# which is included in src/Makefile.am.  Incrementing the revision field
+# indicates that the source code has changed since the last version
+# (which it probably has).
+##############################################################################
+
+
+sub getvers {
+  local ($_) = @_;
+  my (@vers);
+
+  ($vers[0]) = /^\#\s*define\s+LIBVER_MAJOR\s+(\d+)/m;
+  ($vers[1]) = /^\#\s*define\s+LIBVER_MINOR\s+(\d+)/m;
+  ($vers[2]) = /^\#\s*define\s+LIBVER_RELEASE\s+(\d+)/m;
+  ($vers[3]) = /^\#\s*define\s+LIBVER_SUBRELEASE\s+\"([^\"]*)\"/m;
+  ($vers[4]) =  /^\#\s*define\s+LIBVER_STRING\s+\"([^\"]*\d+)\"/m;
+  #The above gets the entire string, below would get just the date portion.
+  #($vers[4]) =  /^\#\s*define\s+LIBVER_STRING\s+\"[^\"]*,(.*,\s+\d+)\"/m;
+  return @vers;
+}
+
+sub setvers {
+  my ($contents, @vers) = @_;
+  my @months = ('January', 'February', 'March', 'April', 'May', 'June', 'July',
+                'August', 'September', 'October', 'November', 'December');
+  my @date = (localtime(time));
+  $_[0] =~ s/^(\#\s*define\s+LIBVER_MAJOR\s+)\d+/$1$vers[0]/m;
+  $_[0] =~ s/^(\#\s*define\s+LIBVER_MINOR\s+)\d+/$1$vers[1]/m;
+  $_[0] =~ s/^(\#\s*define\s+LIBVER_RELEASE\s+)\d+/$1$vers[2]/m;
+  $_[0] =~ s/^(\#\s*define\s+LIBVER_SUBRELEASE\s+\")[^\"]*/$1$vers[3]/m;
+  $_[0] =~ s/^(\#\s*define\s+LIBVER_STRING\s+\")[^\"]*/
+            sprintf("%sHDF Version %d.%d Release %d%s%s, %s %d, %d", $1, @vers[0,1,2],
+	    $vers[3]?"-":"", $vers[3], $months[@date[4]], @date[3], 1900+ at date[5])/me;
+  my $stringlength = 25 + 32 + length $months[@date[4]] + 2 + 6;
+  die "Version string too long:  $stringlength characters." unless $stringlength < 81;
+  #printf("HDF Version %d.%d Release %d%s%s, %s %d, %d\n", @vers[0,1,2],
+  #	    $vers[3]?"-":"", $vers[3], $months[@date[4]], @date[3], 1900+ at date[5]);
+  return $_[0];
+}
+
+sub usage {
+  my ($prog) = $0 =~ /([^\/]+)$/;
+  print STDERR <<EOF;
+Usage: $prog [OPTS] [FILE]
+    -i major|minor|release|annot
+        Increment specified version component and set following components
+        to zero.
+    -s VERSION
+        Set the version as specified. The version number can be embedded in
+        some other string such as \"hdf4-1.1.0-pre1.tar.bz2\" or even
+        \"this is HDF4 library version 1.1 release 0 (pre1)\" for convenience.
+    -v
+        Instead of displaying only a dotted triple version number a line such
+        as \"version 1.1 release 0 (pre1)\" will be printed.
+    FILE
+        The name of the file that contains version information.  This is
+        seldom necessary since files hfile.h, hdf/src/hfile.h, 
+        src/hfile.h, and ../hdf/src/hfile.h are automatically checked.
+EOF
+  exit 1;
+}
+
+# Parse arguments
+my ($verbose, $set, $inc, $file, $rc);
+my (@files) = ("hdf/src/hfile.h", "../hdf/src/hfile.h", "src/hfile.h", "hfile.h");
+while ($_ = shift) {
+  $_ eq "-s" && do {
+    die "-s switch needs a version number\n" unless @ARGV;
+    $set = shift;
+    next;
+  };
+
+  $_ eq "-i" && do {
+    if (@ARGV && $ARGV[0]=~/^(major|minor|release|annot)$/) {
+      $inc = shift;
+    } else {
+      $inc = "last";
+    }
+    next;
+  };
+
+  $_ eq "-v" && do {
+    $verbose = 1;
+    next;
+  };
+
+  /^-(h|\?|-?help)$/ && usage;
+  /^-/ && die "unrecognized option: $_\n";
+  die "only one file name can be specified\n" if $file;
+  $file = $_;
+}
+die "mutually exclusive options given\n" if $set && $inc;
+
+#print "file is $file.\n";
+#print "File array is ", @files;
+
+# Determine file to use as hfile.h, README.txt,
+# release_notes/RELEASE.txt, configure.in, windows/hdf/src/hfile.h.
+# The README.txt, release_notes/RELEASE.txt, configure.ac, 
+# and windows/hdf/src/hfile.h files are always in the directory 
+# two levels above hfile.h.
+unless ($file) {
+  for (@files) {
+    ($file=$_,last) if -f $_;
+  }
+}
+#print "file is $file.\n";
+
+die "unable to find source file $file\n" unless defined $file;
+die "unable to read file: $file\n" unless -r $file;
+# config/lt_vers.am - HDF4 doesn't have this at present
+#my $LT_VERS = $file;
+#$LT_VERS =~ s/[^\/]*$/..\/config\/lt_vers.am/;
+#die "unable to read file: $LT_VERS\n" unless -r $file;
+# README.txt
+my $README = $file;
+$README =~ s/[^\/]*$/..\/..\/README.txt/;
+die "unable to read file: $README\n" unless -r $file;
+# release_notes/RELEASE.txt
+my $RELEASE = $file;
+$RELEASE =~ s/[^\/]*$/..\/..\/release_notes\/RELEASE.txt/;
+die "unable to read file: $RELEASE\n" unless -r $file;
+#print $RELEASE, "\n";
+# man/hdf.1
+my $MANHDF1 = $file;
+$MANHDF1 =~ s/[^\/]*$/..\/..\/man\/hdf.1/;
+die "unable to read file: $MANHDF1\n" unless -r $file;
+#print $MANHDF1, "\n";
+# configure.in
+my $CONFIGURE = $file;
+$CONFIGURE =~ s/[^\/]*$/..\/..\/configure.ac/;
+die "unable to read file: $CONFIGURE\n" unless -r $file;
+
+# Get the current version number.
+open FILE, $file or die "unable to open $file: $!\n";
+my ($contents) = join "", <FILE>;
+close FILE;
+my (@curver) = getvers $contents;
+
+#print "Contents:  $contents\n";
+
+#print "curver", @curver, "\n";
+
+# Determine the new version number.
+my @newver; #new version
+if ($set) {
+  if ($set =~ /(\d+)\.(\d+)\.(\d+)(-([a-zA-Z]\w*))?/) {
+    @newver = ($1, $2, $3, $5);
+  } elsif ($set =~ /(\d+)\D+(\d+)\D+(\d+)(\s*\(([a-zA-Z]\w*)\))?\D*$/) {
+    @newver = ($1, $2, $3, $5);
+  } elsif ($set =~ /(\d+)\D+(\d+)\D*$/) {
+    @newver = ($1, $2, 0, "");
+  } elsif ($set =~ /(\d+)\D*$/) {
+    @newver = ($1, 0, 0, "");
+  } else {
+    die "illegal version number specified: $set\n";
+  }
+} elsif ($inc) {
+  $inc = $curver[3] eq "" ? 'release' : 'annot' if $inc eq 'last';
+  if ($inc eq "major") {
+    $newver[0] = $curver[0]+1;
+    @newver[1,2,3] = (0,0,"");
+  } elsif ($inc eq "minor") {
+    $newver[0] = $curver[0];
+    $newver[1] = $curver[1]+1;
+    @newver[2,3] = (0,"");
+  } elsif ($inc eq "release") {
+    @newver[0,1] = @curver[0,1];
+    $newver[2] = $curver[2]+1;
+    $newver[3] = "";
+  } elsif ($inc eq "annot") {
+    @newver[0,1,2] = @curver[0,1,2];
+    $newver[3] = $curver[3];
+    $newver[3] =~ s/(\d+)\D*$/$1+1/e or
+      die "Annotation \"".$newver[3]."\" cannot be incremented.\n";
+  } else {
+    die "unknown increment field: $inc\n";
+  }
+} else {
+  # Nothing to do but print result
+  $README = "";
+  $RELEASE = "";
+  $CONFIGURE = "";
+  $MANHDF1 = "";
+  @newver = @curver;
+}
+
+# Note if the version increased or decreased
+my $version_increased="";
+# Print a warning if the version got smaller (don't check annot field)
+if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] <
+    $curver[0]*1000000 + $curver[1]*1000 + $curver[2]) {
+  printf STDERR "Warning: version decreased from %d.%d.%d to %d.%d.%d\n",
+    @curver[0,1,2], @newver[0,1,2];
+}
+if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] >
+    $curver[0]*1000000 + $curver[1]*1000 + $curver[2]) {
+  $version_increased="true";
+}
+
+# Update the version number if it changed.
+if ($newver[0]!=$curver[0] ||
+    $newver[1]!=$curver[1] ||
+    $newver[2]!=$curver[2] ||
+    $newver[3]ne$curver[3]) {
+  setvers $contents, @newver or die "unable to set version\n";
+  rename $file, "$file~" or die "unable to save backup file\n";
+  open FILE, ">$file" or die "unable to open $file but backup saved!\n";
+  print FILE $contents;
+  close FILE;
+}
+
+# Update the libtool shared library version in src/Makefile.am if
+# the version number has increased.
+#if ($LT_VERS && $version_increased) {
+#  open FILE, $LT_VERS or die "$LT_VERS: $!\n";
+#  my ($contentsy) = join "", <FILE>;
+#  close FILE;
+
+#  local($_) = $contentsy;
+
+#  my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m;
+#  my $new_lt_revision = $lt_revision+1;
+#  ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m;
+
+#  open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n";
+#  print FILE $contentsy;
+#  close FILE;
+#}
+
+# Update the README file
+if ($README) {
+  open FILE, $README or die "$README: $!\n";
+  my @contents = <FILE>;
+  close FILE;
+  $contents[0] = sprintf("HDF version %d.%d.%d%s %s",
+			 @newver[0,1,2],
+			 $newver[3] eq "" ? "" : "-".$newver[3],
+			 "currently under development\n");
+  open FILE, ">$README" or die "$README: $!\n";
+  print FILE @contents;
+  close FILE;
+}
+
+# Update the release_notes/RELEASE.txt file
+if ($RELEASE) {
+  open FILE, $RELEASE or die "$RELEASE: $!\n";
+  my @contents = <FILE>;
+  close FILE;
+  $contents[0] = sprintf("HDF version %d.%d.%d%s %s",
+			 @newver[0,1,2],
+			 $newver[3] eq "" ? "" : "-".$newver[3],
+			 "currently under development\n");
+  open FILE, ">$RELEASE" or die "$RELEASE: $!\n";
+  print FILE @contents;
+  close FILE;
+}
+
+# Update the man/hdf.1 file
+# There are currently 2 occurrences of the version string in the man/hdf.1 file.
+# Since they aren't the top line of the file we search rewrite the file line by
+# line, searching for the current major.minor.release version string, and replacing
+# it with the new one.  In case someone changes the version string manually or it 
+# otherwise gets out of sync, or another match is found that should not be updated, 
+# we will track the changes in this file, issue an error message and exit at if
+# the number of changes is different than the 2 expected. 
+
+if ($MANHDF1) {
+  my $expected_updates = 2;
+  my $man_hdf1_updates = 0;
+  my $verstr = sprintf("%d.%d.%d", @curver[0,1,2]);
+  open FILE, $MANHDF1 or die "$MANHDF1: $!\n";
+  my @contents = <FILE>;
+  close FILE;
+  my @months = ('January', 'February', 'March', 'April', 'May', 'June', 'July',
+                'August', 'September', 'October', 'November', 'December');
+  my @date = (localtime(time));
+  my $newverstr = sprintf("%d.%d.%d-%d", @newver[0,1,2,3]);
+  my $newverstr = sprintf("%d.%d.%d%s %s",
+                          @newver[0,1,2,],
+                          $newver[3] eq "" ? "" : "-".$newver[3]." currently under development");
+  my $newverline = sprintf(".TH HDF 1 \"%s %d\" \"THG HDF %d.%d.%d%s\"",
+                           $months[@date[4]], 1900+ at date[5],
+                           @newver[0,1,2,],
+                           $newver[3] eq "" ? "" : "-".$newver[3]);
+
+  open FILE, ">$MANHDF1" or die "$MANHDF1: $!\n";
+  foreach my $line (@contents) {
+    if ($line =~ m/THG HDF $verstr/) {
+      # match "THG HDF major.minor.release" in the second line, replace the line with the new line that has
+      # the current month and year and the updated version.
+      print FILE $newverline, "\n";
+      $man_hdf1_updates += 1;
+    } elsif ($line =~ m/^$verstr\s*$/ || $line =~ m/^$verstr-[a-z]{2,5}\d{1,3}\s*$/ || $line =~ m/^$verstr\scurrently under development\s*$/  || $line =~ m/^$verstr-[a-z]{2,5}\d{1,3}\scurrently under development$\s*/) {
+      # match the line further down that has just the version string, and replace it with the updated version string.
+      # this will match "major.minor.release" or "major.minor.release-subrelease" or  "major.minor.release currently 
+      # under development" or "major.minor.release-subrelease currently under development" (all followed by 
+      # any number of spaces), provided that the subrelease
+      # string is 2-5 letters and 1-3 digits.  This should not match any line with text before or after the version.
+      print FILE $newverstr, "\n";
+      $man_hdf1_updates += 1;
+    } else {
+      print FILE $line;
+    }   
+  }  
+  close FILE;
+  if ($man_hdf1_updates != $expected_updates) {
+    printf "ERROR: $expected_updates version updates were expected in $MANHDF1, but $man_hdf1_updates occurred.  Please check the changes to the $MANHDF1 file and correct the problem.\n";
+    exit 1;
+  }
+}
+
+sub gen_configure {
+  my ($name, $conf) = @_;
+
+  open FILE, $conf or die "$conf: $!\n";
+  my @contents = <FILE>;
+  close FILE;
+
+  for (my $i = 0; $i < $#contents; ++$i) {
+    if ($contents[$i] =~ /^AC_INIT/) {
+      $contents[$i] = sprintf("AC_INIT([$name], [%d.%d.%d%s], [help\@hdfgroup.org])\n",
+                              @newver[0,1,2],
+                              $newver[3] eq "" ? "" : "-".$newver[3]);
+      last;
+    }
+  }
+
+  open FILE, ">$conf" or die "$conf: $!\n";
+  print FILE @contents;
+  close FILE;
+
+  $conf =~ /^(.*?)\/?configure.ac$/;
+
+  if ($1) {
+    $rc = system("cd $1 && bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache");
+  } else {
+    $rc = system("bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache");
+  }
+  if ($rc) {
+    printf("bin/reconfigure failed with exit code %d. Aborted.\n", $rc);
+    exit 1;
+  }
+}
+
+# Update the configure.ac files and regenerate them
+gen_configure("HDF", $CONFIGURE) if $CONFIGURE;
+    
+sub gen_h5pubconf {
+    my ($name, $pubconf, @vers) = @_;
+
+    my $namelc = lc($name);
+    my $nameuc = uc($name);
+
+    open FILE, $pubconf or die "$pubconf: $!\n";
+    my @contents = <FILE>;
+    close FILE;
+
+    for (my $i = 0; $i < $#contents; ++$i) {
+        if ($contents[$i] =~ /\#\s*define\s+H4_PACKAGE\s+/) {
+            $contents[$i] = "\#define H4_PACKAGE \"$namelc\"\n";
+        } elsif ($contents[$i] =~ /\#\s*define\s+H4_PACKAGE_NAME\s+/) {
+            $contents[$i] = "\#define H4_PACKAGE_NAME \"$nameuc\"\n";
+        } elsif ($contents[$i] =~ /\#\s*define\s+H4_PACKAGE_STRING\s+/) {
+            $contents[$i] = sprintf("\#define H4_PACKAGE_STRING \"$nameuc %d.%d.%d%s\"\n",
+                                    @vers[0,1,2],
+                                    $newver[3] eq "" ? "" : "-".$newver[3]);
+        } elsif ($contents[$i] =~ /\#\s*define\s+H4_PACKAGE_TARNAME\s+/) {
+            $contents[$i] = "\#define H4_PACKAGE_TARNAME \"$namelc\"\n";
+        } elsif ($contents[$i] =~ /\#\s*define\s+H4_PACKAGE_VERSION\s+/) {
+            $contents[$i] = sprintf("\#define H4_PACKAGE_VERSION \"%d.%d.%d%s\"\n",
+                                    @vers[0,1,2],
+                                    $newver[3] eq "" ? "" : "-".$newver[3]);
+        } elsif ($contents[$i] =~ /\#\s*define\s+H4_VERSION\s+/) {
+            $contents[$i] = sprintf("\#define H4_VERSION \"%d.%d.%d%s\"\n",
+                                    @vers[0,1,2],
+                                    $newver[3] eq "" ? "" : "-".$newver[3]);
+        }
+    }
+
+    open FILE, ">$pubconf" or die "$pubconf: $!\n";
+    print FILE @contents;
+    close FILE;
+}
+
+# Print the new version number
+if ($verbose) {
+  #printf("Version %d.%d Release %d%s\n", @newver[0,1,2],
+  #	 $newver[3] eq "" ? "" : " (".$newver[3].")");
+  printf("%s\n", $newver[4]);
+} else {
+  printf("%d.%d.%d%s\n", @newver[0,1,2],
+	 $newver[3] eq "" ? "" : "-".$newver[3]);
+}
+
+exit 0;
+
+# Because the first line of this file looks like a Bourne shell script, we
+# must tell XEmacs explicitly that this is really a perl script.
+#
+# Local Variables:
+# mode:perl
+# End:
diff --git a/bin/install-sh b/bin/install-sh
new file mode 100755
index 0000000..6781b98
--- /dev/null
+++ b/bin/install-sh
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+	shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+	shift;;
+
+    -o) chowncmd="$chownprog $2"
+	shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+	shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dst_arg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dst_arg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix='/';;
+	-*) prefix='./';;
+	*)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/bin/locate_sw b/bin/locate_sw
new file mode 100755
index 0000000..bb291a6
--- /dev/null
+++ b/bin/locate_sw
@@ -0,0 +1,282 @@
+#!/bin/sh
+# Try to locate the software as named in argument.
+# This is a sequential search of all possible locations of the software.
+# Usage: locate_sw <SW-Name>
+# It prints a string showing the paths leading to the include, lib and bin
+# directory of the software, separated by colons.  E.g., if the software is
+# located in /usr/sdt/*, it prints
+# /usr/sdt/include:/usr/sdt/lib:/usr/sdt/bin
+# Any component that is not found will be returned as an empty string. E.g.,
+# if somehow the header files of the software are not found, it prints
+# :/usr/sdt/lib;/usr/sdt/bin
+
+# Function definitions
+USAGE()
+{
+    echo "Usage: locate_sw <SW-Name>"
+    echo "    where <SW-Name> can be hdf4, hdf5, zlib"
+    echo "    It prints the paths leading the header files (include),"
+    echo "    library (lib), and tools (bin).   E.g.,"
+    echo "    /usr/sdt/include:/usr/sdt/lib:/usr/sdt/bin"
+    echo "    Any component that is not found will be returned as an empty string. E.g.,"
+    echo "    if somehow the header files of the software are not found, it prints"
+    echo "    :/usr/sdt/lib;/usr/sdt/bin"
+    echo "Exit code: 0 if software located; otherwise non-zero"
+}
+
+# locate hdf4 software
+locate_hdf4()
+{
+# this default is the best guess of locating hdf4 software
+swpaths_defaults="/usr/ncsa /usr/sdt /usr/local"
+swpaths=
+
+case "$OSname" in
+    SunOS)
+        case "$OSrelease" in
+            5.7)
+               swpaths="/afs/ncsa/packages/hdf/SunOS_5.7"
+               ;;
+	    *)
+            # use default
+	       ;;
+        esac
+        ;;
+    HP-UX)
+        case "$OSrelease" in
+	   B.11.00)
+	        swpaths="/afs/ncsa/packages/hdf/HPUX_11.00"
+               ;;
+           *)
+           # use default
+              ;;
+        esac
+	;;
+    IRIX)
+	swpaths="/afs/ncsa/packages/hdf/IRIX_6.5"
+	;;
+    IRIX64)
+	case "$CC" in
+	cc|"")	#default cc
+	    abi=`cc -show_defaults 2>&1 | grep 'default abi'`
+	    case $abi in
+	    *-n32)
+		swpaths="/afs/ncsa/packages/hdf/IRIX64-n32_6.5"
+		;;
+	    *-64)
+		swpaths="/afs/ncsa/packages/hdf/IRIX64_6.5"
+		;;
+	    *)
+		swpaths="/afs/ncsa/packages/hdf/IRIX64_6.5"
+		;;
+	    esac	# $abi
+	    ;;
+	*-n32)
+	    swpaths="/afs/ncsa/packages/hdf/IRIX64-n32_6.5"
+	    ;;
+	*)
+	    swpaths="/afs/ncsa/packages/hdf/IRIX64_6.5"
+	    ;;
+	esac
+	;;
+    Linux)
+	swpaths="/afs/ncsa/packages/hdf/Linux"
+	;;
+    OSF1)
+	swpaths="/afs/ncsa/packages/hdf/OSF1_V4.0"
+	;;
+    *)
+	# just use the defaults
+	;;
+esac
+
+# Check if the hdf4 software is actually available.
+# Accept the directory only if needed .h, .a and tools are found
+# in the same place.  That way, they are more likely to be of the
+# same version.
+# 
+swpaths="$swpaths $swpaths_defaults"
+for sw in $swpaths; do
+    if [ -r $sw/include/hdf.h -a -r $sw/lib/libdf.a -a -r $sw/bin/hdp ]; then
+	SW_inc=$sw/include
+	SW_lib=$sw/lib
+	SW_bin=$sw/bin
+	SW_Location=$sw
+	break
+    fi
+done
+}
+
+# locate hdf5 software
+locate_hdf5()
+{
+# this default is the best guess of locating hdf5 software
+swpaths_defaults="/usr/ncsa /usr/sdt /usr/local"
+swpaths=
+
+case "$OSname" in
+    SunOS)
+        case "$OSrelease" in
+            5.7)
+               swpaths="/afs/ncsa/packages/hdf5/SunOS_5.7"
+               ;;
+	    *)
+            # use default
+	       ;;
+        esac
+        ;;
+    HP-UX)
+        case "$OSrelease" in
+	   B.11.00)
+	        swpaths="/afs/ncsa/packages/hdf5/HPUX_11.00"
+               ;;
+           *)
+           # use default
+              ;;
+        esac
+	;;
+    IRIX)
+	swpaths="/afs/ncsa/packages/hdf5/IRIX_6.5"
+	;;
+    IRIX64)
+	case "$CC" in
+	cc|"")	#default cc
+	    abi=`cc -show_defaults 2>&1 | grep 'default abi'`
+	    case $abi in
+	    *-n32)
+		swpaths="/afs/ncsa/packages/hdf5/IRIX64-n32_6.5"
+		;;
+	    *-64)
+		#swpaths="/afs/ncsa/packages/hdf5/IRIX64_6.5"
+                swpaths="/afs/ncsa/packages/hdf5/5-1.4.3-irix64"
+		;;
+	    *)
+		#swpaths="/afs/ncsa/packages/hdf5/IRIX64_6.5"
+                swpaths="/afs/ncsa/packages/hdf5/5-1.4.3-irix64"  
+		;;
+	    esac	# $abi
+	    ;;
+	*-n32)
+	    swpaths="/afs/ncsa/packages/hdf5/IRIX64-n32_6.5"
+	    ;;
+	*)
+	    #swpaths="/afs/ncsa/packages/hdf5/IRIX64_6.5"
+            swpaths="/afs/ncsa/packages/hdf5/5-1.4.3-irix64"
+	    ;;
+	esac
+	;;
+    Linux)
+	swpaths="/afs/ncsa/packages/hdf5/Linux"
+	;;
+    FreeBSD)
+        swpaths="/afs/ncsa/packages/hdf5/FreeBSD"
+        ;;
+    OSF1)
+	swpaths="/afs/ncsa/packages/hdf5/OSF1_V4.0"
+	;;
+    *)
+	# just use the defaults
+	;;
+esac
+
+# Check if the hdf5 software is actually available.
+# Accept the directory only if needed .h, .a and tools are found
+# in the same place.  That way, they are more likely to be of the
+# same version.
+# 
+swpaths="$swpaths $swpaths_defaults"
+for sw in $swpaths; do
+    if [ -r $sw/include/hdf5.h -a -r $sw/lib/libhdf5.a -a -r $sw/bin/h5dump ]; then
+	SW_inc=$sw/include
+	SW_lib=$sw/lib
+	SW_bin=$sw/bin
+	SW_Location=$sw
+	break
+    fi
+done
+}
+
+# locate zlib software
+locate_zlib()
+{
+# this default is the best guess of locating zlib software
+swpaths_defaults="/usr /usr/local /usr/ncsa /usr/sdt"
+swpaths=
+
+
+# Check if the zlib software is actually available.
+# Accept the directory only if needed .h, .a and tools are found
+# in the same place.  That way, they are more likely to be of the
+# same version.
+# Don't know something specific to check the bin directory.  Maybe gzip?
+# Just make sure it exists.
+# 
+swpaths="$swpaths $swpaths_defaults"
+for sw in $swpaths; do
+    if [ -r $sw/include/zlib.h -a	\
+	    \( -r $sw/lib/libz.a -o -r $sw/lib/libz.so \) -a -d $cw/bin ]; then
+	SW_inc=$sw/include
+	SW_lib=$sw/lib
+	SW_bin=$sw/bin
+	SW_Location=$sw
+	break
+    fi
+done
+
+# if none found, try HDF4 software which contains a version of zlib.
+if [ x-$SW_Location = x- ]; then
+    locate_hdf4
+fi
+
+}
+
+# Main
+#
+# Options
+#
+if [ $# -lt 1 ]; then
+    USAGE
+    exit 1
+fi
+
+if [ "$1" = -h ]; then
+    USAGE
+    exit 0
+fi
+
+SW=$1
+shift
+
+# locations of the software seeked.
+SW_inc=			# include place
+SW_lib=			# library place
+SW_bin=			# binary place
+SW_Location=		# parent directory of all the above
+
+OSname=`uname -s`
+OSrelease=`uname -r`
+
+case $SW in
+hdf4|hdf)
+    locate_hdf4
+    ;;
+hdf5)
+    locate_hdf5
+    ;;
+zlib)
+    locate_zlib
+    ;;
+*)
+    echo "unknown software ($SW)"
+    USAGE
+    exit 1
+    ;;
+esac
+
+# show the results located, separated by commas.
+if [ -n "${SW_inc}" -a -n "${SW_lib}" -a -n "${SW_bin}" ]; then
+    echo ${SW_inc},${SW_lib},${SW_bin}
+    exit 0
+else
+    exit 1
+fi
diff --git a/bin/ltmain.sh b/bin/ltmain.sh
new file mode 100755
index 0000000..63ae69d
--- /dev/null
+++ b/bin/ltmain.sh
@@ -0,0 +1,9655 @@
+
+# libtool (GNU libtool) 2.4.2
+# Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --no-warn            don't display warning messages
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#         host-triplet:	$host
+#         shell:		$SHELL
+#         compiler:		$LTCC
+#         compiler flags:		$LTCFLAGS
+#         linker:		$LD (gnu? $with_gnu_ld)
+#         $progname:	(GNU libtool) 2.4.2
+#         automake:	$automake_version
+#         autoconf:	$autoconf_version
+#
+# Report bugs to <bug-libtool at gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION=2.4.2
+TIMESTAMP=""
+package_revision=1.3337
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+          save_$lt_var=\$$lt_var
+          $lt_var=C
+	  export $lt_var
+	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+	fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+    # Extract subdirectory from the argument.
+    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+    case ${2} in
+      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+    esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+		s@/\./@/@g
+		t dotsl
+		s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
+
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=$func_dirname_result
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=${PATH_SEPARATOR-:}
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/$bs4/&\\
+/g
+  s/^$bs2$dollar/$bs&/
+  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+  s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+    # bash bug again:
+    :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+	# list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+	IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+	my_arg=`$ECHO "$1" | $SED \
+	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$lt_user_locale
+	    $my_cmd"
+      my_status=$?
+      eval "$lt_safe_locale"
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+    ;;
+  * )
+    func_tr_sh_result=$1
+    ;;
+  esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $opt_debug
+
+    $SED -n '/(C)/!b go
+	:more
+	/\./!{
+	  N
+	  s/\n# / /
+	  b more
+	}
+	:go
+	/^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+	s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
+        s/^# //
+	s/^# *$//
+	s/\$progname/'$progname'/
+	p
+    }' < "$progpath"
+    echo
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+	:print
+        s/^# //
+	s/^# *$//
+	s*\$progname*'$progname'*
+	s*\$host*'"$host"'*
+	s*\$SHELL*'"$SHELL"'*
+	s*\$LTCC*'"$LTCC"'*
+	s*\$LTCFLAGS*'"$LTCFLAGS"'*
+	s*\$LD*'"$LD"'*
+	s/\$with_gnu_ld/'"$with_gnu_ld"'/
+	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+	p
+	d
+     }
+     /^# .* home page:/b print
+     /^# General help using/b print
+     ' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    $opt_debug
+
+    func_error "missing argument for $1."
+    exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+    my_sed_long_arg='1s/^--[^=]*=//'
+
+    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+    eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+    func_quote_for_eval "${2}"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+    func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+	taglist="$taglist $tagname"
+
+	# Evaluate the configuration.  Be careful to quote the path
+	# and the sed script, to avoid splitting on whitespace, but
+	# also don't use non-portable quotes within backquotes within
+	# quotes we have to do it in 2 steps:
+	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+	eval "$extractedcf"
+      else
+	func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+  shift; set dummy --mode clean ${1+"$@"}; shift
+  ;;
+compile|compil|compi|comp|com|co|c)
+  shift; set dummy --mode compile ${1+"$@"}; shift
+  ;;
+execute|execut|execu|exec|exe|ex|e)
+  shift; set dummy --mode execute ${1+"$@"}; shift
+  ;;
+finish|finis|fini|fin|fi|f)
+  shift; set dummy --mode finish ${1+"$@"}; shift
+  ;;
+install|instal|insta|inst|ins|in|i)
+  shift; set dummy --mode install ${1+"$@"}; shift
+  ;;
+link|lin|li|l)
+  shift; set dummy --mode link ${1+"$@"}; shift
+  ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+  shift; set dummy --mode uninstall ${1+"$@"}; shift
+  ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly.  This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+  # this just eases exit handling
+  while test $# -gt 0; do
+    opt="$1"
+    shift
+    case $opt in
+      --debug|-x)	opt_debug='set -x'
+			func_echo "enabling shell trace mode"
+			$opt_debug
+			;;
+      --dry-run|--dryrun|-n)
+			opt_dry_run=:
+			;;
+      --config)
+			opt_config=:
+func_config
+			;;
+      --dlopen|-dlopen)
+			optarg="$1"
+			opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+			shift
+			;;
+      --preserve-dup-deps)
+			opt_preserve_dup_deps=:
+			;;
+      --features)
+			opt_features=:
+func_features
+			;;
+      --finish)
+			opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+			;;
+      --help)
+			opt_help=:
+			;;
+      --help-all)
+			opt_help_all=:
+opt_help=': help-all'
+			;;
+      --mode)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_mode="$optarg"
+case $optarg in
+  # Valid mode arguments:
+  clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+  # Catch anything else as an error
+  *) func_error "invalid argument for $opt"
+     exit_cmd=exit
+     break
+     ;;
+esac
+			shift
+			;;
+      --no-silent|--no-quiet)
+			opt_silent=false
+func_append preserve_args " $opt"
+			;;
+      --no-warning|--no-warn)
+			opt_warning=false
+func_append preserve_args " $opt"
+			;;
+      --no-verbose)
+			opt_verbose=false
+func_append preserve_args " $opt"
+			;;
+      --silent|--quiet)
+			opt_silent=:
+func_append preserve_args " $opt"
+        opt_verbose=false
+			;;
+      --verbose|-v)
+			opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+			;;
+      --tag)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+			shift
+			;;
+
+      -\?|-h)		func_usage				;;
+      --help)		func_help				;;
+      --version)	func_version				;;
+
+      # Separate optargs to long options:
+      --*=*)
+			func_split_long_opt "$opt"
+			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+			shift
+			;;
+
+      # Separate non-argument short options:
+      -\?*|-h*|-n*|-v*)
+			func_split_short_opt "$opt"
+			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+			shift
+			;;
+
+      --)		break					;;
+      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
+      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
+    esac
+  done
+
+  # Validate options:
+
+  # save first non-option argument
+  if test "$#" -gt 0; then
+    nonopt="$opt"
+    shift
+  fi
+
+  # preserve --debug
+  test "$opt_debug" = : || func_append preserve_args " --debug"
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+      ;;
+  esac
+
+  $opt_help || {
+    # Sanity checks first:
+    func_check_version_match
+
+    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+      func_fatal_configuration "not configured to build any kind of library"
+    fi
+
+    # Darwin sucks
+    eval std_shrext=\"$shrext_cmds\"
+
+    # Only execute mode is allowed to have -dlopen flags.
+    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+      func_error "unrecognized option \`-dlopen'"
+      $ECHO "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Change the help message to a mode-specific one.
+    generic_help="$help"
+    help="Try \`$progname --help --mode=$opt_mode' for more information."
+  }
+
+
+  # Bail if the options were screwed
+  $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+	for lalib_p_l in 1 2 3 4
+	do
+	    read lalib_p_line
+	    case "$lalib_p_line" in
+		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+	    esac
+	done
+	exec 0<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval cmd=\"$cmd\"
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)	. "$1" ;;
+    *)		. "./$1" ;;
+    esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result="=$func_stripname_result"
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	func_append_quoted CC_quoted "$arg"
+      done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	      # Double-quote args containing other shell metacharacters.
+	      func_append_quoted CC_quoted "$arg"
+	    done
+	    CC_expanded=`func_echo_all $CC`
+	    CC_quoted_expanded=`func_echo_all $CC_quoted`
+	    case "$@ " in
+	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  func_echo "unable to infer tagged configuration"
+	  func_fatal_error "specify a tag with \`--tag'"
+#	else
+#	  func_verbose "using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "${write_libobj}"
+    }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+  $opt_debug
+  func_convert_core_file_wine_to_w32_result="$1"
+  if test -n "$1"; then
+    # Unfortunately, winepath does not exit with a non-zero error code, so we
+    # are forced to check the contents of stdout. On the other hand, if the
+    # command is not found, the shell will set an exit code of 127 and print
+    # *an error message* to stdout. So we must check for both error code of
+    # zero AND non-empty stdout, which explains the odd construction:
+    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$lt_sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $opt_debug
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=""
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $opt_debug
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $opt_debug
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $opt_debug
+  if test -z "$2" && test -n "$1" ; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  \`$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result="$1"
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $opt_debug
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  \`$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result="$3"
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $opt_debug
+  case $4 in
+  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $opt_debug
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $opt_debug
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $opt_debug
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  test -n "$libobj" && \
+	    func_fatal_error "you cannot specify \`-o' more than once"
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-pie | -fpie | -fPIE)
+          func_append pie_flag " $arg"
+	  continue
+	  ;;
+
+	-shared | -static | -prefer-pic | -prefer-non-pic)
+	  func_append later " $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  func_stripname '-Wc,' '' "$arg"
+	  args=$func_stripname_result
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+	  for arg in $args; do
+	    IFS="$save_ifs"
+	    func_append_quoted lastarg "$arg"
+	  done
+	  IFS="$save_ifs"
+	  func_stripname ' ' '' "$lastarg"
+	  lastarg=$func_stripname_result
+
+	  # Add the arguments to base_compile.
+	  func_append base_compile " $lastarg"
+	  continue
+	  ;;
+
+	*)
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_append_quoted base_compile "$lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+	func_basename "$srcfile"
+	libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	continue
+	;;
+
+      -static)
+	build_libtool_libs=no
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname="$func_basename_result"
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+      func_append removelist " $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    func_append removelist " $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	func_append command " -o $lobj"
+      fi
+
+      func_show_eval_locale "$command"	\
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	func_show_eval '$MV "$output_obj" "$lobj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+	suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile$pie_flag"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	func_append command " -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      func_append command "$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	func_show_eval '$MV "$output_obj" "$obj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+	removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $opt_mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$opt_mode'"
+        ;;
+    esac
+
+    echo
+    $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	echo
+	func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+	H
+	d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $opt_dlopen; do
+      test -f "$file" \
+	|| func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+	func_source "$file"
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && \
+	    func_warning "\`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  func_append dir "/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+	;;
+
+      *)
+	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -* | *.la | *.lo ) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if func_ltwrapper_script_p "$file"; then
+	  func_source "$file"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	elif func_ltwrapper_executable_p "$file"; then
+	  func_ltwrapper_scriptname "$file"
+	  func_source "$func_ltwrapper_scriptname_result"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_append_quoted args "$file"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+	      else
+		$lt_unset $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+	echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libs=
+    libdirs=
+    admincmds=
+
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+	func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+	if func_lalib_unsafe_p "$opt"; then
+	  func_append libs " $opt"
+	else
+	  func_warning "\`$opt' is not a valid libtool archive"
+	fi
+
+      else
+	func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+	    > $tmpdir/tmp-la
+	  mv -f $tmpdir/tmp-la $lib
+	done
+        ${RM}r "$tmpdir"
+      fi
+    fi
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $opt_dry_run || eval "$cmds" || func_append admincmds "
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+	$ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+	echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+	echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+	libdir=LIBDIR
+	eval flag=\"$hardcode_libdir_flag_spec\"
+
+	$ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+	$ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      fi
+      echo
+
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+	solaris2.[6789]|solaris2.1[0-9])
+	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	  echo "pages."
+	  ;;
+	*)
+	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
+	  ;;
+      esac
+      echo "----------------------------------------------------------------------"
+    fi
+    exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       case $nonopt in *shtool*) :;; *) false;; esac; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    no_mode=:
+    for arg
+    do
+      arg2=
+      if test -n "$dest"; then
+	func_append files " $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+	if $install_cp; then :; else
+	  prev=$arg
+	fi
+	;;
+      -g | -m | -o)
+	prev=$arg
+	;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	    arg2=$install_override_mode
+	    no_mode=false
+	  fi
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+	func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+	func_quote_for_eval "$install_override_mode"
+	func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	func_fatal_help "no file or destination specified"
+      else
+	func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir="$func_dirname_result"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+	func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  func_fatal_help "\`$destdir' must be an absolute directory name"
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	func_append staticlibs " $file"
+	;;
+
+      *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$file' is not a valid libtool archive"
+
+	library_names=
+	old_library=
+	relink_command=
+	func_source "$file"
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) func_append current_libdirs " $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) func_append future_libdirs " $libdir" ;;
+	  esac
+	fi
+
+	func_dirname "$file" "/" ""
+	dir="$func_dirname_result"
+	func_append dir "$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  test "$inst_prefix_dir" = "$destdir" && \
+	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  func_warning "relinking \`$file'"
+	  func_show_eval "$relink_command" \
+	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names; shift
+	if test -n "$1"; then
+	  realname="$1"
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+	      'exit $?'
+	  tstripme="$stripme"
+	  case $host_os in
+	  cygwin* | mingw* | pw32* | cegcc*)
+	    case $realname in
+	    *.dll.a)
+	      tstripme=""
+	      ;;
+	    esac
+	    ;;
+	  esac
+	  if test -n "$tstripme" && test -n "$striplib"; then
+	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      test "$linkname" != "$realname" \
+		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  func_execute_cmds "$postinstall_cmds" 'exit $?'
+	fi
+
+	# Install the pseudo-library for information purposes.
+	func_basename "$file"
+	name="$func_basename_result"
+	instname="$dir/$name"i
+	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  func_lo2o "$destfile"
+	  staticdest=$func_lo2o_result
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	test -n "$destfile" && \
+	  func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  func_lo2o "$file"
+	  staticobj=$func_lo2o_result
+	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      func_stripname '' '.exe' "$file"
+	      file=$func_stripname_result
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin* | *mingw*)
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      wrapper=$func_ltwrapper_scriptname_result
+	    else
+	      func_stripname '' '.exe' "$file"
+	      wrapper=$func_stripname_result
+	    fi
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if func_ltwrapper_script_p "$wrapper"; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  func_source "$wrapper"
+
+	  # Check the variables that should have been set.
+	  test -z "$generated_by_libtool_version" && \
+	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      func_source "$lib"
+	    fi
+	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      func_warning "\`$lib' has not been installed in \`$libdir'"
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  func_source "$wrapper"
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    $opt_dry_run || {
+	      if test "$finalize" = yes; then
+	        tmpdir=`func_mktempdir`
+		func_basename "$file$stripped_ext"
+		file="$func_basename_result"
+	        outputname="$tmpdir/$file"
+	        # Replace the output file specification.
+	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+	        $opt_silent || {
+	          func_quote_for_expand "$relink_command"
+		  eval "func_echo $func_quote_for_expand_result"
+	        }
+	        if eval "$relink_command"; then :
+	          else
+		  func_error "error: relink \`$file' with the above command before installing it"
+		  $opt_dry_run || ${RM}r "$tmpdir"
+		  continue
+	        fi
+	        file="$outputname"
+	      else
+	        func_warning "cannot relink \`$file'"
+	      fi
+	    }
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    func_stripname '' '.exe' "$destfile"
+	    destfile=$func_stripname_result
+	    ;;
+	  esac
+	  ;;
+	esac
+	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+	$opt_dry_run || if test -n "$outputname"; then
+	  ${RM}r "$tmpdir"
+	fi
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+      tool_oldlib=$func_to_tool_file_result
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	my_dlsyms="${my_outputname}S.c"
+      else
+	func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+	# Discover the nlist of each of the dlfiles.
+	nlist="$output_objdir/${my_outputname}.nm"
+
+	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+	# Parse the name list into a source file.
+	func_verbose "creating $output_objdir/$my_dlsyms"
+
+	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+	if test "$dlself" = yes; then
+	  func_verbose "generating symbol list for \`$output'"
+
+	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+	  # Add our own program objects to the symbol list.
+	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	  for progfile in $progfiles; do
+	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -n "$exclude_expsyms"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  if test -n "$export_symbols_regex"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  # Prepare the list of exported symbols
+	  if test -z "$export_symbols"; then
+	    export_symbols="$output_objdir/$outputname.exp"
+	    $opt_dry_run || {
+	      $RM $export_symbols
+	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	      case $host in
+	      *cygwin* | *mingw* | *cegcc* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+	        ;;
+	      esac
+	    }
+	  else
+	    $opt_dry_run || {
+	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	      case $host in
+	        *cygwin* | *mingw* | *cegcc* )
+	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+	          ;;
+	      esac
+	    }
+	  fi
+	fi
+
+	for dlprefile in $dlprefiles; do
+	  func_verbose "extracting global C symbols from \`$dlprefile'"
+	  func_basename "$dlprefile"
+	  name="$func_basename_result"
+          case $host in
+	    *cygwin* | *mingw* | *cegcc* )
+	      # if an import library, we need to obtain dlname
+	      if func_win32_import_lib_p "$dlprefile"; then
+	        func_tr_sh "$dlprefile"
+	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
+	        dlprefile_dlbasename=""
+	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+	          # Use subshell, to avoid clobbering current variable values
+	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+	          if test -n "$dlprefile_dlname" ; then
+	            func_basename "$dlprefile_dlname"
+	            dlprefile_dlbasename="$func_basename_result"
+	          else
+	            # no lafile. user explicitly requested -dlpreopen <import library>.
+	            $sharedlib_from_linklib_cmd "$dlprefile"
+	            dlprefile_dlbasename=$sharedlib_from_linklib_result
+	          fi
+	        fi
+	        $opt_dry_run || {
+	          if test -n "$dlprefile_dlbasename" ; then
+	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+	          else
+	            func_warning "Could not compute DLL name from $name"
+	            eval '$ECHO ": $name " >> "$nlist"'
+	          fi
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+	        }
+	      else # not an import lib
+	        $opt_dry_run || {
+	          eval '$ECHO ": $name " >> "$nlist"'
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	        }
+	      fi
+	    ;;
+	    *)
+	      $opt_dry_run || {
+	        eval '$ECHO ": $name " >> "$nlist"'
+	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	      }
+	    ;;
+          esac
+	done
+
+	$opt_dry_run || {
+	  # Make sure we have at least an empty file.
+	  test -f "$nlist" || : > "$nlist"
+
+	  if test -n "$exclude_expsyms"; then
+	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	    $MV "$nlist"T "$nlist"
+	  fi
+
+	  # Try sorting and uniquifying the output.
+	  if $GREP -v "^: " < "$nlist" |
+	      if sort -k 3 </dev/null >/dev/null 2>&1; then
+		sort -k 3
+	      else
+		sort +2
+	      fi |
+	      uniq > "$nlist"S; then
+	    :
+	  else
+	    $GREP -v "^: " < "$nlist" > "$nlist"S
+	  fi
+
+	  if test -f "$nlist"S; then
+	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+	  else
+	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	  fi
+
+	  echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },"
+
+	  case $need_lib_prefix in
+	  no)
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  *)
+	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  esac
+	  echo >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	} # !$opt_dry_run
+
+	pic_flag_for_symtable=
+	case "$compile_command " in
+	*" -static "*) ;;
+	*)
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+	  *-*-hpux*)
+	    pic_flag_for_symtable=" $pic_flag"  ;;
+	  *)
+	    if test "X$my_pic_p" != Xno; then
+	      pic_flag_for_symtable=" $pic_flag"
+	    fi
+	    ;;
+	  esac
+	  ;;
+	esac
+	symtab_cflags=
+	for arg in $LTCFLAGS; do
+	  case $arg in
+	  -pie | -fpie | -fPIE) ;;
+	  *) func_append symtab_cflags " $arg" ;;
+	  esac
+	done
+
+	# Now compile the dynamic symbol file.
+	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+	# Clean up the generated files.
+	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+	# Transform the symbol file into the correct name.
+	symfileobj="$output_objdir/${my_outputname}S.$objext"
+	case $host in
+	*cygwin* | *mingw* | *cegcc* )
+	  if test -f "$output_objdir/$my_outputname.def"; then
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	  else
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  fi
+	  ;;
+	*)
+	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  ;;
+	esac
+	;;
+      *)
+	func_fatal_error "unknown suffix for \`$my_dlsyms'"
+	;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      func_to_tool_file "$1" func_convert_file_msys_to_w32
+      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+	$SED -n -e '
+	    1,100{
+		/ I /{
+		    s,.*,import,
+		    p
+		    q
+		}
+	    }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $opt_debug
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $opt_debug
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[	 ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive which possess that section. Heuristic: eliminate
+    # all those which have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $opt_debug
+  if func_cygming_gnu_implib_p "$1" ; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1" ; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=""
+  fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+		   'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  func_arith $extracted_serial + 1
+	  extracted_serial=$func_arith_result
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+	func_verbose "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	$opt_dry_run || {
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename "$darwin_archive"`
+	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+	  if test -n "$darwin_arches"; then
+	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+	      $LIPO -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    $RM -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	} # !$opt_dry_run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+	func_emit_wrapper_arg1=${1-no}
+
+	$ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+  done
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+	  $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$ECHO \"\$relink_command_output\" >&2
+	$RM \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+	else
+	  $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# fixup the dll searchpath if we need to.
+	#
+	# Fix the DLL searchpath if we need to.  Do this before prepending
+	# to shlibpath, because on Windows, both are PATH and uninstalled
+	# libraries must come first.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	$ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+      func_exec_program \${1+\"\$@\"}
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+	cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+*/
+EOF
+	    cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+	    cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_path "$temp_rpath"
+	      cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test -n "$dllsearchpath"; then
+              func_to_host_path "$dllsearchpath:"
+	      cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test "$fast_install" = yes; then
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+	    else
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+	    fi
+
+
+	    cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int  newargc;
+  char *tmp_pathspec;
+  char *actual_cwrapper_path;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
+  intptr_t rval = 127;
+
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  newargz = XMALLOC (char *, argc + 1);
+
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strcmp (argv[i], dumpscript_opt) == 0)
+	{
+EOF
+	    case "$host" in
+	      *mingw* | *cygwin* )
+		# make stdout use "unix" line endings
+		echo "          setmode(1,_O_BINARY);"
+		;;
+	      esac
+
+	    cat <<"EOF"
+	  lt_dump_script (stdout);
+	  return 0;
+	}
+      if (strcmp (argv[i], debug_opt) == 0)
+	{
+          lt_debug = 1;
+          continue;
+	}
+      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+		    "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
+
+EOF
+	    cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+	    cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+  tmp_pathspec = find_executable (argv[0]);
+  if (tmp_pathspec == NULL)
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+		  tmp_pathspec);
+
+  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+		  actual_cwrapper_path);
+  XFREE (tmp_pathspec);
+
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(main) libtool target name: %s\n",
+		  target_name);
+EOF
+
+	    cat <<EOF
+  newargz[0] =
+    XMALLOC (char, (strlen (actual_cwrapper_path) +
+		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
+EOF
+
+	    cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
+
+	    case $host_os in
+	      mingw*)
+	    cat <<"EOF"
+  {
+    char* p;
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+	*p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+      {
+	*p = '/';
+      }
+  }
+EOF
+	    ;;
+	    esac
+
+	    cat <<"EOF"
+  XFREE (target_name);
+  XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
+     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+     because on Windows, both *_VARNAMEs are PATH but uninstalled
+     libraries must come first. */
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+		  nonnull (lt_argv_zero));
+  for (i = 0; i < newargc; i++)
+    {
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+		      i, nonnull (newargz[i]));
+    }
+
+EOF
+
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+  /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  if (rval == -1)
+    {
+      /* failed to start process */
+      lt_debugprintf (__FILE__, __LINE__,
+		      "(main) failed to launch target \"%s\": %s\n",
+		      lt_argv_zero, nonnull (strerror (errno)));
+      return 127;
+    }
+  return rval;
+EOF
+		;;
+	      *)
+		cat <<"EOF"
+  execv (lt_argv_zero, newargz);
+  return rval; /* =127, but avoids unused variable warning */
+EOF
+		;;
+	    esac
+
+	    cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void *p = (void *) malloc (num);
+  if (!p)
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+			  string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable (const char *path)
+{
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char *concat_name;
+
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+	return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+	{
+	  concat_name = xstrdup (wrapper);
+	  if (check_executable (concat_name))
+	    return concat_name;
+	  XFREE (concat_name);
+	}
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+	has_slash = 1;
+	break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+	{
+	  for (p = path; *p; p = p_next)
+	    {
+	      const char *q;
+	      size_t p_len;
+	      for (q = p; *q; q++)
+		if (IS_PATH_SEPARATOR (*q))
+		  break;
+	      p_len = q - p;
+	      p_next = (*q == '\0' ? q : q + 1);
+	      if (p_len == 0)
+		{
+		  /* empty path: current directory */
+		  if (getcwd (tmp, LT_PATHMAX) == NULL)
+		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
+		  tmp_len = strlen (tmp);
+		  concat_name =
+		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, tmp, tmp_len);
+		  concat_name[tmp_len] = '/';
+		  strcpy (concat_name + tmp_len + 1, wrapper);
+		}
+	      else
+		{
+		  concat_name =
+		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, p, p_len);
+		  concat_name[p_len] = '/';
+		  strcpy (concat_name + p_len + 1, wrapper);
+		}
+	      if (check_executable (concat_name))
+		return concat_name;
+	      XFREE (concat_name);
+	    }
+	}
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      lt_debugprintf (__FILE__, __LINE__,
+		      "checking path component for symlinks: %s\n",
+		      tmp_pathspec);
+      if (lstat (tmp_pathspec, &s) == 0)
+	{
+	  if (S_ISLNK (s.st_mode) != 0)
+	    {
+	      has_symlinks = 1;
+	      break;
+	    }
+
+	  /* search backwards for last DIR_SEPARATOR */
+	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    p--;
+	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    {
+	      /* no more DIR_SEPARATORS left */
+	      break;
+	    }
+	  *p = '\0';
+	}
+      else
+	{
+	  lt_fatal (__FILE__, __LINE__,
+		    "error accessing file \"%s\": %s",
+		    tmp_pathspec, nonnull (strerror (errno)));
+	}
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal (__FILE__, __LINE__,
+		"could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (strcmp (str, pat) == 0)
+	*str = '\0';
+    }
+  return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+	       int line, const char *mode,
+	       const char *message, va_list ap)
+{
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+  va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+EOF
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+	new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+	{
+	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+	  size_t length;
+	  unsigned int backslashes;
+	  const char *s;
+	  char *quoted_string;
+	  char *p;
+
+	  length = 0;
+	  backslashes = 0;
+	  if (quote_around)
+	    length++;
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		length += backslashes + 1;
+	      length++;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    length += backslashes + 1;
+
+	  quoted_string = XMALLOC (char, length + 1);
+
+	  p = quoted_string;
+	  backslashes = 0;
+	  if (quote_around)
+	    *p++ = '"';
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		{
+		  unsigned int j;
+		  for (j = backslashes + 1; j > 0; j--)
+		    *p++ = '\\';
+		}
+	      *p++ = c;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    {
+	      unsigned int j;
+	      for (j = backslashes; j > 0; j--)
+		*p++ = '\\';
+	      *p++ = '"';
+	    }
+	  *p = '\0';
+
+	  new_argv[i] = quoted_string;
+	}
+      else
+	new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+		;;
+	    esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+	    func_emit_wrapper yes |
+	      $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/  fputs ("\1", f);/p
+g
+D'
+            cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    bindir=
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	break
+	;;
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    func_warning "complete static linking is impossible in this configuration"
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  func_append compile_command " @OUTPUT@"
+	  func_append finalize_command " @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	bindir)
+	  bindir="$arg"
+	  prev=
+	  continue
+	  ;;
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    func_append compile_command " @SYMFILE@"
+	    func_append finalize_command " @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      func_append dlfiles " $arg"
+	    else
+	      func_append dlprefiles " $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  test -f "$arg" \
+	    || func_fatal_error "symbol file \`$arg' does not exist"
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	framework)
+	  case $host in
+	    *-*-darwin*)
+	      case "$deplibs " in
+		*" $qarg.ltframework "*) ;;
+		*) func_append deplibs " $qarg.ltframework" # this is fixed later
+		   ;;
+	      esac
+	      ;;
+	  esac
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat "$save_arg"`
+	    do
+#	      func_append moreargs " $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if func_lalib_unsafe_p "$arg"; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		func_source "$arg"
+
+		if test -z "$pic_object" ||
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none &&
+		   test "$non_pic_object" = none; then
+		  func_fatal_error "cannot find name of object for \`$arg'"
+		fi
+
+		# Extract subdirectory from the argument.
+		func_dirname "$arg" "/" ""
+		xdir="$func_dirname_result"
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      func_append dlfiles " $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    func_append dlprefiles " $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  func_append libobjs " $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  func_append non_pic_objects " $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if $opt_dry_run; then
+		  # Extract subdirectory from the argument.
+		  func_dirname "$arg" "/" ""
+		  xdir="$func_dirname_result"
+
+		  func_lo2o "$arg"
+		  pic_object=$xdir$objdir/$func_lo2o_result
+		  non_pic_object=$xdir$func_lo2o_result
+		  func_append libobjs " $pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+	        else
+		  func_fatal_error "\`$arg' is not a valid libtool object"
+		fi
+	      fi
+	    done
+	  else
+	    func_fatal_error "link input file \`$arg' does not exist"
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    func_fatal_error "only absolute run-paths are allowed"
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) func_append rpath " $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) func_append xrpath " $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	shrext)
+	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	weak)
+	  func_append weak_libs " $arg"
+	  prev=
+	  continue
+	  ;;
+	xcclinker)
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xcompiler)
+	  func_append compiler_flags " $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $wl$qarg"
+	  prev=
+	  func_append compile_command " $wl$qarg"
+	  func_append finalize_command " $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  # See comment for -static flag below, for more details.
+	  func_append compile_command " $link_static_flag"
+	  func_append finalize_command " $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -bindir)
+	prev=bindir
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  func_fatal_error "more than one -exported-symbols argument is not allowed"
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework)
+	prev=framework
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  func_append compile_command " $arg"
+	  func_append finalize_command " $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	func_stripname "-L" '' "$arg"
+	if test -z "$func_stripname_result"; then
+	  if test "$#" -gt 0; then
+	    func_fatal_error "require no space between \`-L' and \`$1'"
+	  else
+	    func_fatal_error "need path for \`-L' option"
+	  fi
+	fi
+	func_resolve_sysroot "$func_stripname_result"
+	dir=$func_resolve_sysroot_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  test -z "$absdir" && \
+	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "* | *" $arg "*)
+	  # Will only happen for absolute or sysroot arguments
+	  ;;
+	*)
+	  # Preserve sysroot, but never include relative directories
+	  case $dir in
+	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+	    *) func_append deplibs " -L$dir" ;;
+	  esac
+	  func_append lib_search_path " $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  ::) dllsearchpath=$dir;;
+	  *) func_append dllsearchpath ":$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    func_append deplibs " System.ltframework"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	func_append deplibs " $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot|--sysroot)
+	func_append compiler_flags " $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	prev=xcompiler
+	continue
+	;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+	func_append compiler_flags " $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	case "$new_inherited_linker_flags " in
+	    *" $arg "*) ;;
+	    * ) func_append new_inherited_linker_flags " $arg" ;;
+	esac
+	continue
+	;;
+
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # and Darwin in order for the loader to find any dlls it needs.
+	  func_warning "\`-no-install' is ignored for $host"
+	  func_warning "assuming \`-no-fast-install' instead"
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	func_stripname '-R' '' "$arg"
+	dir=$func_stripname_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	=*)
+	  func_stripname '=' '' "$dir"
+	  dir=$lt_sysroot$func_stripname_result
+	  ;;
+	*)
+	  func_fatal_error "only absolute run-paths are allowed"
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) func_append xrpath " $dir" ;;
+	esac
+	continue
+	;;
+
+      -shared)
+	# The effects of -shared are defined in a previous loop.
+	continue
+	;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -weak)
+        prev=weak
+	continue
+	;;
+
+      -Wc,*)
+	func_stripname '-Wc,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  func_append arg " $func_quote_for_eval_result"
+	  func_append compiler_flags " $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Wl,*)
+	func_stripname '-Wl,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  func_append arg " $wl$func_quote_for_eval_result"
+	  func_append compiler_flags " $wl$func_quote_for_eval_result"
+	  func_append linker_flags " $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # -msg_* for osf cc
+      -msg_*)
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        func_append compiler_flags " $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      *.$objext)
+	# A standard object.
+	func_append objs " $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if func_lalib_unsafe_p "$arg"; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  func_source "$arg"
+
+	  if test -z "$pic_object" ||
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none &&
+	     test "$non_pic_object" = none; then
+	    func_fatal_error "cannot find name of object for \`$arg'"
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  func_dirname "$arg" "/" ""
+	  xdir="$func_dirname_result"
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		func_append dlfiles " $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      func_append dlprefiles " $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    func_append libobjs " $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    func_append non_pic_objects " $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if $opt_dry_run; then
+	    # Extract subdirectory from the argument.
+	    func_dirname "$arg" "/" ""
+	    xdir="$func_dirname_result"
+
+	    func_lo2o "$arg"
+	    pic_object=$xdir$objdir/$func_lo2o_result
+	    non_pic_object=$xdir$func_lo2o_result
+	    func_append libobjs " $pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  else
+	    func_fatal_error "\`$arg' is not a valid libtool object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	func_append deplibs " $arg"
+	func_append old_deplibs " $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	func_resolve_sysroot "$arg"
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  func_append dlfiles " $func_resolve_sysroot_result"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  func_append dlprefiles " $func_resolve_sysroot_result"
+	  prev=
+	else
+	  func_append deplibs " $func_resolve_sysroot_result"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_preserve_dup_deps ; then
+	case "$libs " in
+	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	esac
+      fi
+      func_append libs " $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+	  esac
+	  func_append pre_post_deps " $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+	passes="conv dlpreopen link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+	## FIXME: Find the place where the list is rebuilt in the wrong
+	##        order, and fix it there properly
+        tmp_deplibs=
+	for deplib in $deplibs; do
+	  tmp_deplibs="$deplib $tmp_deplibs"
+	done
+	deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+	# Collect and forward deplibs of preopened libtool libs
+	for lib in $dlprefiles; do
+	  # Ignore non-libtool-libs
+	  dependency_libs=
+	  func_resolve_sysroot "$lib"
+	  case $lib in
+	  *.la)	func_source "$func_resolve_sysroot_result" ;;
+	  esac
+
+	  # Collect preopened libtool deplibs, except any this library
+	  # has declared as weak libs
+	  for deplib in $dependency_libs; do
+	    func_basename "$deplib"
+            deplib_base=$func_basename_result
+	    case " $weak_libs " in
+	    *" $deplib_base "*) ;;
+	    *) func_append deplibs " $deplib" ;;
+	    esac
+	  done
+	done
+	libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    func_append compiler_flags " $deplib"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    func_warning "\`-l' is ignored for archives/objects"
+	    continue
+	  fi
+	  func_stripname '-l' '' "$deplib"
+	  name=$func_stripname_result
+	  if test "$linkmode" = lib; then
+	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+	  else
+	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+	  fi
+	  for searchdir in $searchdirs; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if func_lalib_p "$lib"; then
+		  library_names=
+		  old_library=
+		  func_source "$lib"
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    func_dirname "$lib" "" "."
+		    ladir="$func_dirname_result"
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+		;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	*.ltframework)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    func_stripname '-L' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    func_stripname '-L' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    ;;
+	  *)
+	    func_warning "\`-L' is ignored for archives/objects"
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    func_stripname '-R' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    dir=$func_resolve_sysroot_result
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) func_append xrpath " $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la)
+	  func_resolve_sysroot "$deplib"
+	  lib=$func_resolve_sysroot_result
+	  ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    # Linking convenience modules into shared libraries is allowed,
+	    # but linking other static libraries is non-portable.
+	    case " $dlpreconveniencelibs " in
+	    *" $deplib "*) ;;
+	    *)
+	      valid_a_lib=no
+	      case $deplibs_check_method in
+		match_pattern*)
+		  set dummy $deplibs_check_method; shift
+		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		    valid_a_lib=yes
+		  fi
+		;;
+		pass_all)
+		  valid_a_lib=yes
+		;;
+	      esac
+	      if test "$valid_a_lib" != yes; then
+		echo
+		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because the file extensions .$libext of this argument makes me believe"
+		echo "*** that it is just a static archive that I should not use here."
+	      else
+		echo
+		$ECHO "*** Warning: Linking the shared library $output against the"
+		$ECHO "*** static library $deplib is not portable!"
+		deplibs="$deplib $deplibs"
+	      fi
+	      ;;
+	    esac
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      func_append newdlprefiles " $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      func_append newdlfiles " $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+	fi
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$lib" \
+	  || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+	func_dirname "$lib" "" "."
+	ladir="$func_dirname_result"
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	inherited_linker_flags=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	func_source "$lib"
+
+	# Convert "-framework foo" to "foo.ltframework"
+	if test -n "$inherited_linker_flags"; then
+	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+	    case " $new_inherited_linker_flags " in
+	      *" $tmp_inherited_linker_flag "*) ;;
+	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+	    esac
+	  done
+	fi
+	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && func_append dlfiles " $dlopen"
+	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      func_fatal_error "cannot find name of link library for \`$lib'"
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    func_append convenience " $ladir/$objdir/$old_library"
+	    func_append old_convenience " $ladir/$objdir/$old_library"
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    func_fatal_error "\`$lib' is not a convenience library"
+	  fi
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    deplibs="$deplib $deplibs"
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $deplib"
+	  done
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	if test -n "$old_library" &&
+	   { test "$prefer_static_libs" = yes ||
+	     test "$prefer_static_libs,$installed" = "built,no"; }; then
+	  linklib=$old_library
+	else
+	  for l in $old_library $library_names; do
+	    linklib="$l"
+	  done
+	fi
+	if test -z "$linklib"; then
+	  func_fatal_error "cannot find name of link library for \`$lib'"
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    func_append dlprefiles " $lib $dependency_libs"
+	  else
+	    func_append newdlfiles " $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    func_warning "cannot determine absolute directory name of \`$ladir'"
+	    func_warning "passing it literally to the linker, although it might fail"
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	func_basename "$lib"
+	laname="$func_basename_result"
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    func_warning "library \`$lib' was moved."
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$lt_sysroot$libdir"
+	    absdir="$lt_sysroot$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    func_append notinst_path " $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    func_append notinst_path " $abs_ladir"
+	  fi
+	fi # $installed = yes
+	func_stripname 'lib' '.la' "$laname"
+	name=$func_stripname_result
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir" && test "$linkmode" = prog; then
+	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+	  fi
+	  case "$host" in
+	    # special handling for platforms with PE-DLLs.
+	    *cygwin* | *mingw* | *cegcc* )
+	      # Linker will automatically link against shared library if both
+	      # static and shared are present.  Therefore, ensure we extract
+	      # symbols from the import library if a shared library is present
+	      # (otherwise, the dlopen module name will be incorrect).  We do
+	      # this by putting the import library name into $newdlprefiles.
+	      # We recover the dlopen module name by 'saving' the la file
+	      # name in a special purpose variable, and (later) extracting the
+	      # dlname from the la file.
+	      if test -n "$dlname"; then
+	        func_tr_sh "$dir/$linklib"
+	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+	        func_append newdlprefiles " $dir/$linklib"
+	      else
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      fi
+	    ;;
+	    * )
+	      # Prefer using a static library (so that no silly _DYNAMIC symbols
+	      # are required to link).
+	      if test -n "$old_library"; then
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      # Otherwise, use the dlname, so that lt_dlopen finds it.
+	      elif test -n "$dlname"; then
+	        func_append newdlprefiles " $dir/$dlname"
+	      else
+	        func_append newdlprefiles " $dir/$linklib"
+	      fi
+	    ;;
+	  esac
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  func_append newlib_search_path " $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) func_stripname '-L' '' "$deplib"
+	         func_resolve_sysroot "$func_stripname_result"
+	         func_append newlib_search_path " $func_resolve_sysroot_result"
+		 ;;
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath:" in
+	      *"$absdir:"*) ;;
+	      *) func_append temp_rpath "$absdir:" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) func_append compile_rpath " $absdir" ;;
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append finalize_rpath " $libdir" ;;
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc*)
+	      # No point in relinking DLLs because paths are not encoded
+	      func_append notinst_deplibs " $lib"
+	      need_relink=no
+	    ;;
+	  *)
+	    if test "$installed" = no; then
+	      func_append notinst_deplibs " $lib"
+	      need_relink=yes
+	    fi
+	    ;;
+	  esac
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on some
+	  # systems (darwin).  Don't bleat about dlopened modules though!
+	  dlopenmodule=""
+	  for dlpremoduletest in $dlprefiles; do
+	    if test "X$dlpremoduletest" = "X$lib"; then
+	      dlopenmodule="$dlpremoduletest"
+	      break
+	    fi
+	  done
+	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+	    echo
+	    if test "$linkmode" = prog; then
+	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $ECHO "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) func_append compile_rpath " $absdir" ;;
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append finalize_rpath " $libdir" ;;
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    shift
+	    realname="$1"
+	    shift
+	    libname=`eval "\\$ECHO \"$libname_spec\""`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw* | *cegcc*)
+	        func_arith $current - $age
+		major=$func_arith_result
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    func_basename "$soroot"
+	    soname="$func_basename_result"
+	    func_stripname 'lib' '.dll' "$soname"
+	    newlib=libimp-$func_stripname_result.a
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      func_verbose "extracting exported symbol list from \`$soname'"
+	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      func_verbose "generating import library for \`$soname'"
+	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a (non-dlopened) module then we can not
+		    # link against it, someone is ignoring the earlier warnings
+		    if /usr/bin/file -L $add 2> /dev/null |
+			 $GREP ": [^:]* bundle" >/dev/null ; then
+		      if test "X$dlopenmodule" != "X$lib"; then
+			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
+			if test -z "$old_library" ; then
+			  echo
+			  echo "*** And there doesn't seem to be a static archive available"
+			  echo "*** The link will probably fail, sorry"
+			else
+			  add="$dir/$old_library"
+			fi
+		      elif test -n "$old_library"; then
+			add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes &&
+	         test "$hardcode_direct_absolute" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$absdir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      func_append add_dir " -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      func_fatal_configuration "unsupported hardcode properties"
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes &&
+		 test "$hardcode_minus_L" != yes &&
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) func_append finalize_shlibpath "$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes &&
+	       test "$hardcode_direct_absolute" = no; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) func_append finalize_shlibpath "$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+		add="$inst_prefix_dir$libdir/$linklib"
+	      else
+		add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    func_append add_dir " -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    echo
+	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) func_stripname '-R' '' "$libdir"
+	           temp_xrpath=$func_stripname_result
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) func_append xrpath " $temp_xrpath";;
+		   esac;;
+	      *) func_append temp_deplibs " $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  func_append newlib_search_path " $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $func_resolve_sysroot_result"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      path=
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+	        func_resolve_sysroot "$deplib"
+	        deplib=$func_resolve_sysroot_result
+	        func_dirname "$deplib" "" "."
+		dir=$func_dirname_result
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    func_warning "cannot determine absolute directory name of \`$dir'"
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if $GREP "^installed=no" $deplib > /dev/null; then
+		case $host in
+		*-*-darwin*)
+		  depdepl=
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$absdir/$objdir/$depdepl" ; then
+		      depdepl="$absdir/$objdir/$depdepl"
+		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+		      path=
+		    fi
+		  fi
+		  ;;
+		*)
+		  path="-L$absdir/$objdir"
+		  ;;
+		esac
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  test -z "$libdir" && \
+		    func_fatal_error "\`$deplib' is not a valid libtool archive"
+		  test "$absdir" != "$libdir" && \
+		    func_warning "\`$deplib' seems to be moved"
+
+		  path="-L$absdir"
+		fi
+		;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      if test "$pass" = link; then
+	if test "$linkmode" = "prog"; then
+	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+	else
+	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	fi
+      fi
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) func_append lib_search_path " $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) func_append tmp_libs " $deplib" ;;
+	      esac
+	      ;;
+	    *) func_append tmp_libs " $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  func_append tmp_libs " $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+	func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      func_append objs "$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	func_stripname 'lib' '.la' "$outputname"
+	name=$func_stripname_result
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	test "$module" = no && \
+	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  func_stripname '' '.la' "$outputname"
+	  name=$func_stripname_result
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  func_stripname '' '.la' "$outputname"
+	  libname=$func_stripname_result
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+	else
+	  echo
+	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+	  $ECHO "*** objects $objs is not portable!"
+	  func_append libobjs " $objs"
+	fi
+      fi
+
+      test "$dlself" != no && \
+	func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+	func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	test -n "$vinfo" && \
+	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+	test -n "$release" && \
+	  func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	shift
+	IFS="$save_ifs"
+
+	test -n "$7" && \
+	  func_fatal_help "too many parameters to \`-version-info'"
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$1"
+	  number_minor="$2"
+	  number_revision="$3"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  # correct linux to gnu/linux during the next big refactor
+	  darwin|linux|osf|windows|none)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|qnx|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_minor"
+	    lt_irix_increment=no
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$1"
+	  revision="$2"
+	  age="$3"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "CURRENT \`$current' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "REVISION \`$revision' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "AGE \`$age' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  func_arith $current + 1
+	  minor_current=$func_arith_result
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	irix | nonstopux)
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    func_arith $current - $age
+	  else
+	    func_arith $current - $age + 1
+	  fi
+	  major=$func_arith_result
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    func_arith $revision - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux) # correct to gnu/linux during the next big refactor
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    func_arith $current - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  func_append verstring ":${current}.0"
+	  ;;
+
+	qnx)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  func_arith $current - $age
+	  major=$func_arith_result
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  func_fatal_configuration "unknown library version type \`$version_type'"
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    func_warning "undefined symbols not allowed in $host shared libraries"
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      func_append libobjs " $symfileobj"
+      test "X$libobjs" = "X " && libobjs=
+
+      if test "$opt_mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$ECHO "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext | *.gcno)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+		 then
+		   continue
+		 fi
+	       fi
+	       func_append removelist " $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	test -n "$removelist" && \
+	  func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	func_append oldlibs " $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  func_replace_sysroot "$libdir"
+	  func_append temp_xrpath " -R$func_replace_sysroot_result"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_rpath " $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) func_append dlfiles " $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) func_append dlprefiles " $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    func_append deplibs " System.ltframework"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      func_append deplibs " -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $opt_dry_run || $RM conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $opt_dry_run || $RM conftest
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    func_append newdeplibs " $i"
+		    i=""
+		    ;;
+		  esac
+		fi
+		if test -n "$i" ; then
+		  libname=`eval "\\$ECHO \"$libname_spec\""`
+		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		  set dummy $deplib_matches; shift
+		  deplib_match=$1
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    func_append newdeplibs " $i"
+		  else
+		    droppeddeps=yes
+		    echo
+		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which I believe you do not have"
+		    echo "*** because a test_compile did reveal that the linker did not use it for"
+		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+		;;
+	      *)
+		func_append newdeplibs " $i"
+		;;
+	      esac
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		$opt_dry_run || $RM conftest
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      func_append newdeplibs " $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval "\\$ECHO \"$libname_spec\""`
+		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		    set dummy $deplib_matches; shift
+		    deplib_match=$1
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      func_append newdeplibs " $i"
+		    else
+		      droppeddeps=yes
+		      echo
+		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		      echo "*** I have the capability to make that library automatically link in when"
+		      echo "*** you link to this library.  But I can only do this if you have a"
+		      echo "*** shared version of the library, which you do not appear to have"
+		      echo "*** because a test_compile did reveal that the linker did not use this one"
+		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  echo
+		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+		  echo "*** make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
+		fi
+		;;
+	      *)
+		func_append newdeplibs " $i"
+		;;
+	      esac
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method; shift
+	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  func_append newdeplibs " $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		if test -n "$file_magic_glob"; then
+		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+		else
+		  libnameglob=$libname
+		fi
+		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  if test "$want_nocaseglob" = yes; then
+		    shopt -s nocaseglob
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		    $nocaseglob
+		  else
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		  fi
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null |
+			 $GREP " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+			 $SED -e 10q |
+			 $EGREP "$file_magic_regex" > /dev/null; then
+			func_append newdeplibs " $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      func_append newdeplibs " $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method; shift
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  func_append newdeplibs " $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+		       $EGREP "$match_pattern_regex" > /dev/null; then
+		      func_append newdeplibs " $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      func_append newdeplibs " $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+	    done
+	  fi
+	  case $tmp_deplibs in
+	  *[!\	\ ]*)
+	    echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	    ;;
+	  esac
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library with the System framework
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+	*-*-darwin*)
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    func_append new_libs " -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) func_append new_libs " $deplib" ;;
+	  esac
+	  ;;
+	*) func_append new_libs " $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	# Remove ${wl} instances when linking with ld.
+	# FIXME: should test the right _cmds variable.
+	case $archive_cmds in
+	  *\$LD\ *) wl= ;;
+        esac
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		func_replace_sysroot "$libdir"
+		libdir=$func_replace_sysroot_result
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		func_append dep_rpath " $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append perm_rpath " $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      func_append rpath "$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	shift
+	realname="$1"
+	shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  func_append linknames " $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	test "X$libobjs" = "X " && libobjs=
+
+	delfiles=
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+	  export_symbols="$output_objdir/$libname.uexp"
+	  func_append delfiles " $export_symbols"
+	fi
+
+	orig_export_symbols=
+	case $host_os in
+	cygwin* | mingw* | cegcc*)
+	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+	    # exporting using user supplied symfile
+	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	      # and it's NOT already a .def file. Must figure out
+	      # which of the given symbols are data symbols and tag
+	      # them as such. So, trigger use of export_symbols_cmds.
+	      # export_symbols gets reassigned inside the "prepare
+	      # the list of exported symbols" if statement, so the
+	      # include_expsyms logic still works.
+	      orig_export_symbols="$export_symbols"
+	      export_symbols=
+	      always_export_symbols=yes
+	    fi
+	  fi
+	  ;;
+	esac
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    func_verbose "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $opt_dry_run || $RM $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd1 in $cmds; do
+	      IFS="$save_ifs"
+	      # Take the normal branch if the nm_file_list_spec branch
+	      # doesn't work or if tool conversion is not needed.
+	      case $nm_file_list_spec~$to_tool_file_cmd in
+		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+		  try_normal_branch=yes
+		  eval cmd=\"$cmd1\"
+		  func_len " $cmd"
+		  len=$func_len_result
+		  ;;
+		*)
+		  try_normal_branch=no
+		  ;;
+	      esac
+	      if test "$try_normal_branch" = yes \
+		 && { test "$len" -lt "$max_cmd_len" \
+		      || test "$max_cmd_len" -le -1; }
+	      then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      elif test -n "$nm_file_list_spec"; then
+		func_basename "$output"
+		output_la=$func_basename_result
+		save_libobjs=$libobjs
+		save_output=$output
+		output=${output_objdir}/${output_la}.nm
+		func_to_tool_file "$output"
+		libobjs=$nm_file_list_spec$func_to_tool_file_result
+		func_append delfiles " $output"
+		func_verbose "creating $NM input file list: $output"
+		for obj in $save_libobjs; do
+		  func_to_tool_file "$obj"
+		  $ECHO "$func_to_tool_file_result"
+		done > "$output"
+		eval cmd=\"$cmd1\"
+		func_show_eval "$cmd" 'exit $?'
+		output=$save_output
+		libobjs=$save_libobjs
+		skipped_export=false
+	      else
+		# The command line is too long to execute in one step.
+		func_verbose "using reloadable object file for export list..."
+		skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  tmp_export_symbols="$export_symbols"
+	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	fi
+
+	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+	  # The given exports_symbols file has to be filtered, so filter it.
+	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	  # 's' commands which not all seds can handle. GNU sed should be fine
+	  # though. Also, the filter scales superlinearly with the number of
+	  # global variables. join(1) would be nice here, but unfortunately
+	  # isn't a blessed tool.
+	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	  export_symbols=$output_objdir/$libname.def
+	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+	  case " $convenience " in
+	  *" $test_deplib "*) ;;
+	  *)
+	    func_append tmp_deplibs " $test_deplib"
+	    ;;
+	  esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec" &&
+	    test "$compiler_needs_object" = yes &&
+	    test -z "$libobjs"; then
+	    # extract the archives, so we have objects to list.
+	    # TODO: could optimize this to just extract one archive.
+	    whole_archive_flag_spec=
+	  fi
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    func_append generated " $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    func_append libobjs " $func_extract_archives_result"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  func_append linker_flags " $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$opt_mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    eval test_cmds=\"$archive_expsym_cmds\"
+	    cmds=$archive_expsym_cmds
+	  else
+	    eval test_cmds=\"$archive_cmds\"
+	    cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   func_len " $test_cmds" &&
+	   len=$func_len_result &&
+	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise
+	  # or, if using GNU ld and skipped_export is not :, use a linker
+	  # script.
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  func_basename "$output"
+	  output_la=$func_basename_result
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  last_robj=
+	  k=1
+
+	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+	    output=${output_objdir}/${output_la}.lnkscript
+	    func_verbose "creating GNU ld script: $output"
+	    echo 'INPUT (' > $output
+	    for obj in $save_libobjs
+	    do
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
+	    done
+	    echo ')' >> $output
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$func_to_tool_file_result
+	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+	    output=${output_objdir}/${output_la}.lnk
+	    func_verbose "creating linker input file list: $output"
+	    : > $output
+	    set x $save_libobjs
+	    shift
+	    firstobj=
+	    if test "$compiler_needs_object" = yes; then
+	      firstobj="$1 "
+	      shift
+	    fi
+	    for obj
+	    do
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
+	    done
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+	  else
+	    if test -n "$save_libobjs"; then
+	      func_verbose "creating reloadable object files..."
+	      output=$output_objdir/$output_la-${k}.$objext
+	      eval test_cmds=\"$reload_cmds\"
+	      func_len " $test_cmds"
+	      len0=$func_len_result
+	      len=$len0
+
+	      # Loop over the list of objects to be linked.
+	      for obj in $save_libobjs
+	      do
+		func_len " $obj"
+		func_arith $len + $func_len_result
+		len=$func_arith_result
+		if test "X$objlist" = X ||
+		   test "$len" -lt "$max_cmd_len"; then
+		  func_append objlist " $obj"
+		else
+		  # The command $test_cmds is almost too long, add a
+		  # command to the queue.
+		  if test "$k" -eq 1 ; then
+		    # The first file doesn't have a previous command to add.
+		    reload_objs=$objlist
+		    eval concat_cmds=\"$reload_cmds\"
+		  else
+		    # All subsequent reloadable object files will link in
+		    # the last one created.
+		    reload_objs="$objlist $last_robj"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+		  fi
+		  last_robj=$output_objdir/$output_la-${k}.$objext
+		  func_arith $k + 1
+		  k=$func_arith_result
+		  output=$output_objdir/$output_la-${k}.$objext
+		  objlist=" $obj"
+		  func_len " $last_robj"
+		  func_arith $len0 + $func_len_result
+		  len=$func_arith_result
+		fi
+	      done
+	      # Handle the remaining objects by creating one last
+	      # reloadable object file.  All subsequent reloadable object
+	      # files will link in the last one created.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      reload_objs="$objlist $last_robj"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+	      if test -n "$last_robj"; then
+	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+	      fi
+	      func_append delfiles " $output"
+
+	    else
+	      output=
+	    fi
+
+	    if ${skipped_export-false}; then
+	      func_verbose "generating symbol list for \`$libname.la'"
+	      export_symbols="$output_objdir/$libname.exp"
+	      $opt_dry_run || $RM $export_symbols
+	      libobjs=$output
+	      # Append the command to create the export file.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+	      if test -n "$last_robj"; then
+		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+	      fi
+	    fi
+
+	    test -n "$save_libobjs" &&
+	      func_verbose "creating a temporary reloadable object file: $output"
+
+	    # Loop through the commands generated above and execute them.
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $concat_cmds; do
+	      IFS="$save_ifs"
+	      $opt_silent || {
+		  func_quote_for_expand "$cmd"
+		  eval "func_echo $func_quote_for_expand_result"
+	      }
+	      $opt_dry_run || eval "$cmd" || {
+		lt_exit=$?
+
+		# Restore the uninstalled library and exit
+		if test "$opt_mode" = relink; then
+		  ( cd "$output_objdir" && \
+		    $RM "${realname}T" && \
+		    $MV "${realname}U" "$realname" )
+		fi
+
+		exit $lt_exit
+	      }
+	    done
+	    IFS="$save_ifs"
+
+	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+
+          if ${skipped_export-false}; then
+	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	      tmp_export_symbols="$export_symbols"
+	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	    fi
+
+	    if test -n "$orig_export_symbols"; then
+	      # The given exports_symbols file has to be filtered, so filter it.
+	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	      # 's' commands which not all seds can handle. GNU sed should be fine
+	      # though. Also, the filter scales superlinearly with the number of
+	      # global variables. join(1) would be nice here, but unfortunately
+	      # isn't a blessed tool.
+	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	      export_symbols=$output_objdir/$libname.def
+	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	    fi
+	  fi
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	      cmds=$archive_expsym_cmds
+	    else
+	      cmds=$archive_cmds
+	    fi
+	  fi
+	fi
+
+	if test -n "$delfiles"; then
+	  # Append the command to remove temporary files to $cmds.
+	  eval cmds=\"\$cmds~\$RM $delfiles\"
+	fi
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  func_append libobjs " $func_extract_archives_result"
+	  test "X$libobjs" = "X " && libobjs=
+	fi
+
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $opt_silent || {
+	    func_quote_for_expand "$cmd"
+	    eval "func_echo $func_quote_for_expand_result"
+	  }
+	  $opt_dry_run || eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$opt_mode" = relink; then
+	      ( cd "$output_objdir" && \
+	        $RM "${realname}T" && \
+		$MV "${realname}U" "$realname" )
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$opt_mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      func_show_eval '${RM}r "$gentop"'
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+	test -n "$objs$old_deplibs" && \
+	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+	libobj=$output
+	func_lo2o "$libobj"
+	obj=$func_lo2o_result
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # If we're not building shared, we need to use non_pic_objs
+      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+	func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) func_stripname '' '.exe' "$output"
+	          output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+	&& test "$dlopen_self" = unknown \
+	&& test "$dlopen_self_static" = unknown && \
+	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+	# Don't allow lazy linking, it breaks C++ global constructors
+	# But is supposedly fixed on 10.4 or later (yay!).
+	if test "$tagname" = CXX ; then
+	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	    10.[0123])
+	      func_append compile_command " ${wl}-bind_at_load"
+	      func_append finalize_command " ${wl}-bind_at_load"
+	    ;;
+	  esac
+	fi
+	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    func_append new_libs " -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) func_append new_libs " $deplib" ;;
+	  esac
+	  ;;
+	*) func_append new_libs " $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_rpath " $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    func_append rpath " $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append perm_rpath " $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  ::) dllsearchpath=$libdir;;
+	  *) func_append dllsearchpath ":$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    func_append rpath " $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_perm_rpath " $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+	func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+	# Replace the output file specification.
+	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	exit_status=0
+	func_show_eval "$link_command" 'exit_status=$?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
+	# Delete the generated files.
+	if test -f "$output_objdir/${outputname}S.${objext}"; then
+	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    func_append rpath "$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    func_append rpath "$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$opt_dry_run || $RM $output
+	# Link the executable and exit
+	func_show_eval "$link_command" 'exit $?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	func_warning "this platform does not like uninstalled shared libraries"
+	func_warning "\`$output' will be relinked during installation"
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      if test -n "$postlink_cmds"; then
+	func_to_tool_file "$output_objdir/$outputname"
+	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    func_quote_for_eval "$var_value"
+	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) func_stripname '' '.exe' "$output"
+	         output=$func_stripname_result ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    func_stripname '' '.exe' "$outputname"
+	    outputname=$func_stripname_result ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    func_dirname_and_basename "$output" "" "."
+	    output_name=$func_basename_result
+	    output_path=$func_dirname_result
+	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
+	    cwrapper="$output_path/$output_name.exe"
+	    $RM $cwrappersource $cwrapper
+	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_cwrapperexe_src > $cwrappersource
+
+	    # The wrapper executable is built using the $host compiler,
+	    # because it contains $host paths and files. If cross-
+	    # compiling, it, like the target executable, must be
+	    # executed on the $host or under an emulation environment.
+	    $opt_dry_run || {
+	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+	      $STRIP $cwrapper
+	    }
+
+	    # Now, create the wrapper script for func_source use:
+	    func_ltwrapper_scriptname $cwrapper
+	    $RM $func_ltwrapper_scriptname_result
+	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+	    $opt_dry_run || {
+	      # note: this script will not be executed, so do not chmod.
+	      if test "x$build" = "x$host" ; then
+		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+	      else
+		func_emit_wrapper no > $func_ltwrapper_scriptname_result
+	      fi
+	    }
+	  ;;
+	  * )
+	    $RM $output
+	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_wrapper no > $output
+	    chmod +x $output
+	  ;;
+	esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save $symfileobj"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	  if test "$preload" = yes && test -f "$symfileobj"; then
+	    func_append oldobjs " $symfileobj"
+	  fi
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	func_append generated " $gentop"
+
+	func_extract_archives $gentop $addlibs
+	func_append oldobjs " $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	cmds=$old_archive_from_new_cmds
+      else
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  func_append oldobjs " $func_extract_archives_result"
+	fi
+
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      func_basename "$obj"
+	      $ECHO "$func_basename_result"
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  echo "copying selected object files to avoid basename conflicts..."
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+	  func_mkdir_p "$gentop"
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    func_basename "$obj"
+	    objbase="$func_basename_result"
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		func_arith $counter + 1
+		counter=$func_arith_result
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      func_append oldobjs " $gentop/$newobj"
+	      ;;
+	    *) func_append oldobjs " $obj" ;;
+	    esac
+	  done
+	fi
+	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+	tool_oldlib=$func_to_tool_file_result
+	eval cmds=\"$old_archive_cmds\"
+
+	func_len " $cmds"
+	len=$func_len_result
+	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	elif test -n "$archiver_list_spec"; then
+	  func_verbose "using command file archive linking..."
+	  for obj in $oldobjs
+	  do
+	    func_to_tool_file "$obj"
+	    $ECHO "$func_to_tool_file_result"
+	  done > $output_objdir/$libname.libcmd
+	  func_to_tool_file "$output_objdir/$libname.libcmd"
+	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  func_verbose "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  eval test_cmds=\"$old_archive_cmds\"
+	  func_len " $test_cmds"
+	  len0=$func_len_result
+	  len=$len0
+	  for obj in $save_oldobjs
+	  do
+	    func_len " $obj"
+	    func_arith $len + $func_len_result
+	    len=$func_arith_result
+	    func_append objlist " $obj"
+	    if test "$len" -lt "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+		RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	      len=$len0
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  func_quote_for_eval "$var_value"
+	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		func_basename "$deplib"
+		name="$func_basename_result"
+		func_resolve_sysroot "$deplib"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$deplib' is not a valid libtool archive"
+		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      -L*)
+		func_stripname -L '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -L$func_replace_sysroot_result"
+		;;
+	      -R*)
+		func_stripname -R '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -R$func_replace_sysroot_result"
+		;;
+	      *) func_append newdependency_libs " $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+
+	    for lib in $dlfiles; do
+	      case $lib in
+	      *.la)
+	        func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      *) func_append newdlfiles " $lib" ;;
+	      esac
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+	      *.la)
+		# Only pass preopened files to the pseudo-archive (for
+		# eventual linking with the app. that links it) if we
+		# didn't already link the preopened objects directly into
+		# the library:
+		func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      esac
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      func_append newdlfiles " $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      func_append newdlprefiles " $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $RM $output
+	  # place dlname in correct position for cygwin
+	  # In fact, it would be nice if we could use this code for all target
+	  # systems that can't hard-code library paths into their executables
+	  # and that have no shared library path variable independent of PATH,
+	  # but it turns out we can't easily determine that from inspecting
+	  # libtool variables, so we have to hard-code the OSs to which it
+	  # applies here; at the moment, that means platforms that use the PE
+	  # object format with DLL files.  See the long comment at the top of
+	  # tests/bindir.at for full details.
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+	      # If a -bindir argument was supplied, place the dll there.
+	      if test "x$bindir" != x ;
+	      then
+		func_relative_path "$install_libdir" "$bindir"
+		tdlname=$func_relative_path_result$dlname
+	      else
+		# Otherwise fall back on heuristic.
+		tdlname=../bin/$dlname
+	      fi
+	      ;;
+	  esac
+	  $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $ECHO >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) func_append RM " $arg"; rmforce=yes ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+	odir="$objdir"
+      else
+	odir="$dir/$objdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$opt_mode" = uninstall && odir="$dir"
+
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test "$opt_mode" = clean; then
+	case " $rmdirs " in
+	  *" $odir "*) ;;
+	  *) func_append rmdirs " $odir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+	 { test -h "$file"; } >/dev/null 2>&1 ||
+	 test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if func_lalib_p "$file"; then
+	  func_source $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    func_append rmfiles " $odir/$n"
+	  done
+	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+	  case "$opt_mode" in
+	  clean)
+	    case " $library_names " in
+	    *" $dlname "*) ;;
+	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+	    esac
+	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if func_lalib_p "$file"; then
+
+	  # Read the .lo file
+	  func_source $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" &&
+	     test "$pic_object" != none; then
+	    func_append rmfiles " $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" &&
+	     test "$non_pic_object" != none; then
+	    func_append rmfiles " $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$opt_mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    func_stripname '' '.exe' "$file"
+	    file=$func_stripname_result
+	    func_stripname '' '.exe' "$name"
+	    noexename=$func_stripname_result
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    func_append rmfiles " $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if func_ltwrapper_p "$file"; then
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      relink_command=
+	      func_source $func_ltwrapper_scriptname_result
+	      func_append rmfiles " $func_ltwrapper_scriptname_result"
+	    else
+	      relink_command=
+	      func_source $dir/$noexename
+	    fi
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      func_append rmfiles " $odir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      func_append rmfiles " $odir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/bin/missing b/bin/missing
new file mode 100755
index 0000000..6a37006
--- /dev/null
+++ b/bin/missing
@@ -0,0 +1,336 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing 0.4 - GNU automake"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal*)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1Help2man' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+       # We have makeinfo, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  tar)
+    shift
+    if test -n "$run"; then
+      echo 1>&2 "ERROR: \`tar' requires --run"
+      exit 1
+    fi
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case "$firstarg" in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case "$firstarg" in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/bin/mkinstalldirs b/bin/mkinstalldirs
new file mode 100755
index 0000000..d2d5f21
--- /dev/null
+++ b/bin/mkinstalldirs
@@ -0,0 +1,111 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman at prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+  case $1 in
+    -h | --help | --h*)         # -h for help
+      echo "$usage" 1>&2
+      exit 0
+      ;;
+    -m)                         # -m PERM arg
+      shift
+      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+      dirmode=$1
+      shift
+      ;;
+    --)                         # stop option processing
+      shift
+      break
+      ;;
+    -*)                         # unknown option
+      echo "$usage" 1>&2
+      exit 1
+      ;;
+    *)                          # first non-opt arg
+      break
+      ;;
+  esac
+done
+
+for file
+do
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
+
+case $# in
+  0) exit 0 ;;
+esac
+
+case $dirmode in
+  '')
+    if mkdir -p -- . 2>/dev/null; then
+      echo "mkdir -p -- $*"
+      exec mkdir -p -- "$@"
+    fi
+    ;;
+  *)
+    if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+      echo "mkdir -m $dirmode -p -- $*"
+      exec mkdir -m "$dirmode" -p -- "$@"
+    fi
+    ;;
+esac
+
+for file
+do
+  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  shift
+
+  pathcomp=
+  for d
+  do
+    pathcomp="$pathcomp$d"
+    case $pathcomp in
+      -*) pathcomp=./$pathcomp ;;
+    esac
+
+    if test ! -d "$pathcomp"; then
+      echo "mkdir $pathcomp"
+
+      mkdir "$pathcomp" || lasterr=$?
+
+      if test ! -d "$pathcomp"; then
+  	errstatus=$lasterr
+      else
+  	if test ! -z "$dirmode"; then
+	  echo "chmod $dirmode $pathcomp"
+    	  lasterr=""
+  	  chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+  	  if test ! -z "$lasterr"; then
+  	    errstatus=$lasterr
+  	  fi
+  	fi
+      fi
+    fi
+
+    pathcomp="$pathcomp/"
+  done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# End:
+# mkinstalldirs ends here
diff --git a/bin/newer b/bin/newer
new file mode 100755
index 0000000..8ed9f87
--- /dev/null
+++ b/bin/newer
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Copyright by The HDF Group.
+# 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://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have
+# access to either file, you may request a copy from help at hdfgroup.org.
+#
+# Compare the modification time of file argument 1 against other file arguments.
+# Return true (0) if argument 1 is newer than all others, otherwise return
+# false (1).  If any of the argument is not a file, return false (1).
+#
+# Programmer: Albert Cheng
+# Created Date: 2005/07/06
+# Modification:
+#    Albert Cheng 2005/8/30
+#    Changed from two arguments to mulitple arguments.
+
+if test $# -lt 2; then
+    exit 1
+fi
+if test ! -f $1; then
+    exit 1
+fi
+f1=$1
+shift
+
+for f in $*; do
+    if test ! -f $f; then
+	exit 1
+    fi
+    if test X = X`find $f1 -newer $f -print`; then
+	exit 1
+    fi
+done
+
+# passed all tests.  Must be a file newer than all others.
+exit 0
diff --git a/bin/reconfigure b/bin/reconfigure
new file mode 100755
index 0000000..0aa0cc7
--- /dev/null
+++ b/bin/reconfigure
@@ -0,0 +1,106 @@
+#! /bin/sh
+#
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+
+# A script to run the GNU autotools to regenerate files for HDF4.
+# If the paths of the autotools are not specified by the user, they
+# are hardcoded to point to their locations on HDF5 Linux machines.
+# Users can specify the locations of the autotools with the following
+# variables:
+# AUTOCONF, AUTOMAKE, ACLOCAL, AUTOHEADER should be the path to the
+# corresponding tools.
+# LIBTOOL_DIR should be the path to the base libtool directory;
+# $LIBTOOL_DIR/bin/libtool should invoke libtool, while
+# $LIBTOOL_DIR/share/aclocal needs to be included by aclocal.
+# Be very careful when specifying these tools manually!  There are a lot
+# of versions that can get confused (not even counting the m4 utility)!
+
+# HDF4 currently uses the following versions of the autotools:
+AUTOCONF_VERSION="autoconf (GNU Autoconf) 2.69"
+AUTOMAKE_VERSION="automake (GNU automake) 1.12.3"
+AUTOHEADER_VERSION="autoheader (GNU Autoconf) 2.69"
+ACLOCAL_VERSION="aclocal (GNU automake) 1.12.3"
+LIBTOOL_VERSION="(GNU libtool) 2.4.2"
+M4_VERSION="m4 (GNU M4) 1.4.16"
+
+#
+# When upgrading automake's version, don't forget to also update its
+# helper utilities, especially depcomp.
+
+# If the user has defined environment variables pointing to the autotools,
+# use those (but check their versions first!).  Otherwise, assume that
+# we're running on an HDF Group machine with access to the autotools 
+# in mnt/hdf/packages.
+if test -z ${AUTOCONF}; then
+  AUTOCONF=/mnt/hdf/packages/autoconf/autoconf-2.69/bin/autoconf
+fi
+if test -z ${AUTOMAKE}; then
+  AUTOMAKE=/mnt/hdf/packages/automake/automake-1.12.3/bin/automake-1.12
+fi
+if test -z ${AUTOHEADER}; then
+  AUTOHEADER=/mnt/hdf/packages/autoconf/autoconf-2.69/bin/autoheader
+fi
+if test -z ${ACLOCAL}; then
+  ACLOCAL=/mnt/hdf/packages/automake/automake-1.12.3/bin/aclocal-1.12
+fi
+if test -z ${LIBTOOL}; then
+  LIBTOOL=/mnt/hdf/packages/libtool/libtool-2.4.2/bin/libtool
+fi
+if test -z ${M4}; then
+  M4=/mnt/hdf/packages/m4/m4-1.4.16/bin/m4
+fi
+
+# Check version numbers of all autotools against the "correct" versions
+AC_VERS=`${AUTOCONF} --version 2>&1 | grep "^${AUTOCONF_VERSION}"`
+if test -z "${AC_VERS}"; then
+   echo "${AUTOCONF} version is not ${AUTOCONF_VERSION}"
+   exit 1
+fi
+AM_VERS=`${AUTOMAKE} --version 2>&1 | grep "^${AUTOMAKE_VERSION}"`
+if test -z "${AM_VERS}"; then
+   echo "${AUTOMAKE} version is not ${AUTOMAKE_VERSION}"
+   exit 1
+fi
+AH_VERS=`${AUTOHEADER} --version 2>&1 | grep "^${AUTOHEADER_VERSION}"`
+if test -z "${AH_VERS}"; then
+   echo "${AUTOHEADER} version is not ${AUTOHEADER_VERSION}"
+   exit 1
+fi
+AL_VERS=`${ACLOCAL} --version 2>&1 | grep "^${ACLOCAL_VERSION}"`
+if test -z "${AL_VERS}"; then
+   echo "${ACLOCAL} version is not ${ACLOCAL_VERSION}"
+   exit 1
+fi
+LT_VERS=`${LIBTOOL} --version 2>&1 | grep "${LIBTOOL_VERSION}"`
+if test -z "${LT_VERS}"; then
+   echo "${LIBTOOL} version is not ${LIBTOOL_VERSION}"
+   exit 1
+fi
+M4_VERS=`${M4} --version 2>&1 | grep "${M4_VERSION}"`
+if test -z "${M4_VERS}"; then
+   echo "${M4} version is not ${M4_VERSION}"
+   exit 1
+fi
+
+# Make sure that the tools are in the path.
+AUTOCONF_DIR=`dirname ${AUTOCONF}`
+LIBTOOL_DIR=`dirname ${LIBTOOL}`
+M4_DIR=`dirname ${M4}`
+PATH=${AUTOCONF_DIR}:${M4_DIR}:$PATH
+
+# Run autoconf/automake commands in order
+  echo ${ACLOCAL} -I ${LIBTOOL_DIR}/../share/aclocal
+  ${ACLOCAL} -I ${LIBTOOL_DIR}/../share/aclocal || exit 1
+
+  echo ${AUTOHEADER}
+  ${AUTOHEADER} || exit 1
+
+  echo ${AUTOMAKE} --add-missing
+  ${AUTOMAKE} --add-missing || exit 1
+
+  echo ${AUTOCONF}
+  ${AUTOCONF} || exit 1
+
+exit 0
diff --git a/bin/release b/bin/release
new file mode 100755
index 0000000..adfbf2a
--- /dev/null
+++ b/bin/release
@@ -0,0 +1,282 @@
+#!/bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF4.  The full HDF4 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 HDF4 document set and
+# is linked from the top-level documents page.  It can also be found at
+# http://hdfgroup.org/HDF4/doc/Copyright.html.  If you do not have
+# access to either file, you may request a copy from help at hdfgroup.org.
+#
+
+# Make a release of hdf4.
+#
+# Programmer: Robb Matzke
+# Creation date: on or before 1998-01-29.
+#
+# Modifications
+#   Robb Matzke, 1999-07-16
+#   The SunOS 5.6 sed *must* have slashes as delimiters. I changed things like
+#   `sed s+/CVS++' to `sed 's/\/CVS//'
+#
+#   Albert Cheng, 1999-10-26
+#   Moved the MANIFEST checking to a separate command file so that
+#   it can be invoked individually.
+#
+#   Albert Cheng, 2004-08-14
+#   Added the --private option.
+#
+#   James Laird, 2005-09-07
+#   Added the md5 method.
+
+# Function definitions
+#
+# Print Usage page
+USAGE()
+{
+cat << EOF
+Usage: $0 [--nocheck] [-d <dir>] [-h] <methods> ...
+   -d DIR	The name of the directory where the releas(es) should be
+                placed.  By default, the directory is ./releases
+
+   --nocheck	Ignore errors in MANIFEST file.
+         
+   --private	Make a private release with today's date in version information.
+         
+The other command-line options are the names of the programs to use
+for compressing the resulting tar archive (if none are given then
+"tar md5" is assumed):
+
+    tar		-- use tar and don't do any compressing.
+    compress	-- use compress and append ".Z" to the output name.
+    gzip	-- use gzip with "-9" and append ".gz" to the output name.
+    bzip2       -- use bzip2 with "-9" and append ".bz2" to the output name.
+    md5         -- produce a md5 checksum in addition to the archive.
+
+Examples:
+
+    $ release
+    releases/hdf-4.2.4.tar
+    releases/hdf-4.2.4.tar.md5
+
+    $ release gzip
+    releases/hdf-4.2.4.tar.gz
+
+    $ release -d /tmp tar compress gzip bzip2 md5
+    /tmp/hdf-4.2.4.tar
+    /tmp/hdf-4.2.4.tar.Z
+    /tmp/hdf-4.2.4.tar.gz
+    /tmp/hdf-4.2.4.tar.bz2
+    /tmp/hdf-4.2.4.tar.md5
+
+EOF
+
+}
+
+# This command must be run at the top level of the hdf4 source directory.
+# Verify this requirement.
+if [ ! \( -f configure -a -f bin/release \) ]; then
+    echo "$0 must be run at the top level of the hdf4 source directory"
+    exit 1
+fi
+
+# Defaults
+DEST=releases
+VERS=`perl bin/h4vers`
+VERS_OLD=
+test "$VERS" || exit 1
+verbose=yes
+check=yes
+release_date=`date +%F`
+today=`date +%Y%m%d`
+pmode='no'
+tmpdir="../#release_tmp.$$"	# tmp work directory
+
+# artifacts from hdf5, not currently used for hdf4
+#DOC_URL=http://svn.hdfgroup.uiuc.edu/hdf4doc/trunk
+#CPPLUS_RM_NAME=cpplus_RM
+
+# Restore previous Version information
+RESTORE_VERSION()
+{
+    if [ X-${VERS_OLD} != X- ]; then
+	echo restoring version information back to $VERS_OLD
+# configure/libtool to be considered after initial release script works
+#	rm -f config/lt_vers.am
+#	cp $tmpdir/lt_vers.am config/lt_vers.am
+	bin/h4vers -s $VERS_OLD
+	VERS_OLD=
+    fi
+}
+
+
+# Command-line arguments
+while [ -n "$1" ]; do
+    arg=$1
+    shift
+    case "$arg" in
+	-d)
+	    DEST=$1
+	    shift
+	    ;;
+	--nocheck)
+	    check=no
+	    ;;
+	-h)
+	    USAGE
+	    exit 0
+	    ;;
+	--private)
+	    pmode=yes
+	    ;;
+	-*)
+	    echo "Unknown switch: $arg" 1>&2
+	    USAGE
+	    exit 1
+	    ;;
+	*)
+	    methods="$methods $arg"
+	    ;;
+    esac
+done
+
+# Default methods are tar and md5
+if [ "X$methods" = "X" ]; then
+    methods="tar md5"
+fi
+
+# Create the temporay work directory.
+if mkdir $tmpdir; then
+    echo "temporary work directory for release.  "\
+         "Can be deleted after release completes." > $tmpdir/README
+else
+    echo "Failed to mkdir tmpdir($tmpdir)"
+    exit 1
+fi
+
+# setup restoration in case of abort.
+trap RESTORE_VERSION 0
+
+if [ X$pmode = Xyes ]; then
+    VERS_OLD=$VERS
+    # Copy old version of config/lt_vers.am, since it's hard to
+    # "undo" changes to it.
+# configure - later
+#    cp config/lt_vers.am $tmpdir
+    # Set version information to m.n.r-of$today.
+    # (h4vers does not correctly handle just m.n.r-$today.)
+    VERS=`echo $VERS | sed -e s/-.*//`-of$today
+    echo Private release of $VERS
+    bin/h4vers -s $VERS
+fi
+
+# Store hdf4-$VERS ("hdf-4.2.4", e.g.) to a variable to avoid typos
+HDF4_VERS=hdf-$VERS
+
+test "$verbose" && echo "Releasing $HDF4_VERS to $DEST" 1>&2
+if [ ! -d $DEST ]; then
+    echo "   Destination directory $DEST does not exist" 1>&2
+    exit 1
+fi
+
+# Check the validity of the MANIFEST file.
+bin/chkmanifest || fail=yes
+if [ "X$fail" = "Xyes" ]; then
+    if [ $check = yes ]; then
+        exit 1
+    else
+	echo "Continuing anyway..."
+    fi
+fi
+
+# Create a manifest that contains only files for distribution.
+MANIFEST=$tmpdir/H4_MANIFEST
+grep '^\.' MANIFEST | grep -v _DO_NOT_DISTRIBUTE_ >$MANIFEST
+
+# Prepare the source tree for a release.
+ln -s `pwd` $tmpdir/$HDF4_VERS || exit 1
+mv Makefile $tmpdir/Makefile.x 2>/dev/null #might fail
+# Save a backup copy of Makefile if exists.
+test -f Makefile && mv Makefile $tmpdir/Makefile.x
+cp -p Makefile.dist Makefile
+
+# Update README.txt and release_notes/RELEASE.txt with release information in
+# line 1.
+for f in README.txt release_notes/RELEASE.txt; do
+    echo "HDF version $VERS released on $release_date" >$f.x
+    sed -e 1d $f >>$f.x
+    mv $f.x $f
+    # Make sure new files are of the right access mode
+    chmod 644 $f
+done
+
+# Create the tar file
+test "$verbose" && echo "   Running tar..." 1>&2
+( \
+    cd $tmpdir; \
+    tar cf $HDF4_VERS.tar $HDF4_VERS/Makefile \
+	`sed 's/^\.\//hdf-'$VERS'\//' $MANIFEST` || exit 1 \
+)
+
+# Compress
+for comp in $methods; do
+    case $comp in
+	tar)
+	    cp -p $tmpdir/$HDF4_VERS.tar $DEST/$HDF4_VERS.tar
+	    ;;
+	compress)
+	    test "$verbose" && echo "   Running compress..." 1>&2
+	    compress -c <$tmpdir/$HDF4_VERS.tar >$DEST/$HDF4_VERS.tar.Z
+	    ;;
+	gzip)
+	    test "$verbose" && echo "   Running gzip..." 1>&2
+	    gzip -9 <$tmpdir/$HDF4_VERS.tar >$DEST/$HDF4_VERS.tar.gz
+	    ;;
+	bzip2)
+	    test "$verbose" && echo "   Running bzip2..." 1>&2
+	    bzip2 -9 <$tmpdir/$HDF4_VERS.tar >$DEST/$HDF4_VERS.tar.bz2
+	    ;;
+	md5)
+	    test "$verbose" && echo "   Creating checksum..." 1>&2
+	    (cd $tmpdir; md5sum $HDF4_VERS.tar ) > $DEST/$HDF4_VERS.tar.md5
+	    ;;
+# doc option from hdf5 - not supported for hdf4
+#	doc)
+#	    test "$verbose" && echo "   Creating docs..." 1>&2
+#	    # Check out docs from svn repo
+#	    (cd $tmpdir; svn co $DOC_URL > /dev/null) || exit 1
+#	    # Create doxygen C++ RM
+#	    (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1
+#	    # Replace version of C++ RM with just-created version
+#	    rm -rf $tmpdir/trunk/html/$CPPLUS_RM_NAME
+#	    mv c++/src/$CPPLUS_RM_NAME $tmpdir/trunk/html/$CPPLUS_RM_NAME
+#	    # Compress the docs and move them to the release area
+#	    mv $tmpdir/trunk $tmpdir/${HDF4_VERS}_docs
+#	    (cd $tmpdir && tar cf ${HDF4_VERS}_docs.tar ${HDF4_VERS}_docs)
+#	    mv $tmpdir/${HDF4_VERS}_docs.tar $DEST
+#	    ;;
+    esac
+done
+
+# Copy the RELEASE.txt to the release area.
+cp release_notes/RELEASE.txt $DEST/$HDF4_VERS-RELEASE.txt
+
+# Restore previous Makefile if existed.
+rm -f Makefile
+test -f $tmpdir/Makefile.x && mv $tmpdir/Makefile.x Makefile
+
+# Restore OLD version information, then no need for trap.
+if [ X$pmode = Xyes ]; then
+    RESTORE_VERSION
+    trap 0
+fi
+
+# Remove temporary things
+rm -rf $tmpdir
+
+exit 0
diff --git a/bin/runtest b/bin/runtest
new file mode 100755
index 0000000..ecd1521
--- /dev/null
+++ b/bin/runtest
@@ -0,0 +1,893 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF.  The full HDF copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING.  COPYING can be found at the root
+# of the source code distribution tree.  If you do not have
+# access to the file, you may request a copy from help at hdfgroup.org.
+#
+# run the hdf4/bin/snapshot
+# Usage:
+#	runtest		run the test for the local host
+#	runtest <hostname>	run the test for <hostname>
+#	runtest -all		run the test for all predefined hosts
+#
+# Assumptions in knowing where to find the right scripts to execute.
+# 1. assume we are at the top level of the hdf4 source.  So, bin/* are
+#    where the script files are.
+# 2. after the cvs update is completed, we can go to the snapshot area
+#    hdf4 source tree and use the bin/* there.
+# 3. Cannot use the snapshot area scripts from the beginning because
+#    for one, the current directory is renamed as previous right after
+#    a snapshot release; and for another, some scripts may be changed
+#    by the cvs update while it is being used.
+
+# local setup
+DEBUGMODE=""
+test -n "$DEBUGMODE" && echo "******** DEBUGMODE is $DEBUGMODE ************"
+WHEREAMI='pwd'
+CMD=
+
+# the name of this program
+PROGNAME="bin/runtest $DEBUGMODE"
+
+# Setup
+HOSTNAME=`hostname | cut -f1 -d.`	# no domain part
+TODAY=`date +%m%d%a`
+WEEKDAY=`date +%a`
+H4VER=			# default to current CVS version
+H4VERSTR=		# default to current CVS version
+
+# Default to do checkout (only once) and test, no release.
+# Will run test only if there is significant differences from previous version.
+# If srcdir is not used, don't launched multiple tests
+SNAPSHOT="${DEBUGMODE:+echo }bin/snapshot"
+SRCDIR="srcdir"
+# Default standard Snaptest commands
+SNAPCMD="$SRCDIR test clean"
+# Default Standard snaptest command options
+STANDARD_OPT=""
+ENABLE_PARALLEL="--enable-parallel"
+CONFIGNAME=$HOSTNAME	# Name used in the SNAPTESTCFG file
+
+# test host defaults as local host.
+TESTHOST=""
+
+#################################
+# Function definitions
+#################################
+
+# Print messages to stdout
+# Use this to show output heading to stdout
+PRINT()
+{
+    echo "$*"
+}
+
+# Show seconds since midnight.
+# This is used to calculate seconds elapsed
+SecOfDay()
+{
+    set `date '+%H %M %S'`
+    t_sec=`expr $1 \* 3600 + $2 \* 60 + $3`
+    echo $t_sec
+}
+
+# Calculated the elapsed time (in seconds) between the first
+# and second time.  If second time is smaller than the first,
+# we assume the clock has passed midnight and calculate appropriately.
+ElapsedTime()
+{
+    if [ $2 -lt $1 ]; then
+	t_sec=`expr 3600 \* 24 - $1 + $2`
+    else
+	t_sec=`expr $2 - $1`
+    fi
+    echo `expr $t_sec / 60`m `expr $t_sec % 60`s
+}
+
+# Report errors
+# $1--an error message to be printed
+REPORT_ERR()
+{
+    ERRMSG=$1
+    # print it with a banner shifted right a bit
+    PRINT "	*************************************"
+    PRINT "	`date`"
+    PRINT "	$ERRMSG"
+    PRINT "	*************************************"
+    # report it in the FAILED-LOG file too
+    PRINT "$ERRMSG" >> $FAILEDLOG
+}
+
+#
+# Report results of the last test done
+REPORT_RESULT()
+{
+    if [ $retcode -eq 0 ]; then
+	if [ $skiptest = yes ]; then
+	    PRINT "SKIPPED ${HOSTNAME}: $TEST_TYPE" | tee -a $SKIPPEDLOG
+	else
+	    PRINT "PASSED ${HOSTNAME}: $TEST_TYPE" | tee -a $PASSEDLOG
+	fi
+    else
+	# test failed.
+	REPORT_ERR "****FAILED ${HOSTNAME}: $TEST_TYPE****"
+    fi
+}
+
+# Print a blank line
+PRINT_BLANK()
+{
+    PRINT
+}
+
+# Print test trailer
+PRINT_TEST_TRAILER()
+{
+    PRINT "*** finished $TEST_TYPE tests for $HOSTNAME ***"
+    date; EndTime=`SecOfDay`
+    PRINT Total time = `ElapsedTime $StartTime $EndTime`
+    PRINT_BLANK
+}
+
+# Print trailer summary
+PRINT_TRAILER()
+{
+    PRINT "*** finished tests in $HOSTNAME ***"
+    date; TotalEndTime=`SecOfDay`
+    PRINT "${HOSTNAME}: Ran $n_test $runtest_type, Grand total test time = " \
+          "`ElapsedTime $TotalStartTime $TotalEndTime`" | tee -a $TIMELOG
+    PRINT_BLANK
+}
+
+# Figure out which remote command to use to reach a host.
+# Try ssh first, then rsh since fewer machines support rsh exec.
+# $1--hostname to reach.
+CHECK_RSH()
+{
+    # Figure out how to use ping command in this host.
+    # Some hosts use "ping host count", some use "ping -c count host".
+    # Test "ping -c 3 -w 5" since it has timeout feature.
+    # Test "ping -c ..." style before "ping host 3" because some machines
+    # that recognize -c treat 'ping localhost 3' as to ping host '3'.
+    if [ -z "$PING" ]; then
+	if ping -c 3 -w 5 localhost >/dev/null 2>&1; then
+	    PING='ping -c 3 -w 5'
+	    PINGCOUNT=
+	elif ping -c 3 localhost >/dev/null 2>&1; then
+	    PING='ping -c 3'
+	    PINGCOUNT=
+	elif ping localhost 3 >/dev/null 2>&1; then
+	    PING=ping
+	    PINGCOUNT=3
+	else	# don't know how to use ping.
+	    PING=no_ping
+	    PINGCOUNT=
+	fi
+    fi
+    #
+    host=$1
+    # Try remote command with host if it responds to ping.
+    # Still try it if we don't know how to do ping.
+    if [ no_ping = "$PING" ] || $PING $host $PINGCOUNT >/dev/null 2>&1; then
+	if ssh $host -n hostname >/dev/null 2>&1; then
+	    RSH=ssh
+	elif rsh $host -n hostname >/dev/null 2>&1; then
+	    RSH=rsh
+	else
+	    PRINT cannot remote command with $host
+	    RSH="NoRemoteCommand"
+	fi
+    else
+	RSH="NotReachable"
+    fi
+}
+
+
+# Wait for a file for at most number of minutes
+# $1--the file
+# $2--number of minutes
+# WAIT_STATUS set to:
+#	-1 if errors encountered
+#	0  if file found within time limit
+#	1  if file not found within time limit
+WAITFOR()
+{
+    wait_file=$1
+    nminutes=$2
+    if [ -z "$wait_file" -o ! "$nminutes" -ge 0 ]
+    then
+	PRINT "errors in argument of WAITFOR(): wait_file($1) or nminutes($2)"
+	WAIT_STATUS=-1
+	return
+    fi
+    while [ ! -f $wait_file ]; do
+	if [ $nminutes -gt 0 ]; then
+	    PRINT "Wait For $wait_file to appear"
+	    sleep 60			#sleep 1 minute
+	else
+	    WAIT_STATUS=1
+	    return
+	fi
+	nminutes=`expr $nminutes - 1`
+    done
+    WAIT_STATUS=0
+    return
+}
+
+
+# Wait till a file disappears for at most number of minutes.
+# Useful to wait till a lock is removed by another process.
+# $1--the file
+# $2--number of minutes
+# WAIT_STATUS set to:
+#	-1 if errors encountered
+#	0  if file disappears within time limit
+#	1  if file has not disappeared within time limit
+WAITTILL()
+{
+    wait_file=$1
+    nminutes=$2
+    if [ -z "$wait_file" -o ! "$nminutes" -ge 0 ]
+    then
+	PRINT "errors in argument of WAITTILL(): wait_file($1) or nminutes($2)"
+	WAIT_STATUS=-1
+	return
+    fi
+    while [ -f $wait_file ]; do
+	if [ $nminutes -gt 0 ]; then
+	    PRINT "Wait till $wait_file has disappeared"
+	    sleep 60			#sleep 1 minute
+	else
+	    WAIT_STATUS=1
+	    return
+	fi
+	nminutes=`expr $nminutes - 1`
+    done
+    WAIT_STATUS=0
+    return
+}
+
+
+# Run one snapshot test
+# $*--Types of test being run
+RUNSNAPTEST()
+{
+    SNAPCMD_OPT="$STANDARD_OPT"		# snapshot test option
+    SRCDIRNAME=""
+    # restore CC, PATH in case they were changed in the last test.
+    CC="$CC_SAVED"
+    PATH=$PATH_SAVED
+    export PATH			# DEC OSF1 needs to export PATH explicitly
+    TEST_TYPE=$*
+    retcode=0
+    skiptest=no
+    date
+    PRINT "*** starting $TEST_TYPE tests in $HOSTNAME ***"
+    PRINT "Uname -a: `uname -a`"
+
+    # Parse the test type and set options accordingly.
+    # See comments of SNAPTEST_CONFIG_PARSE().
+    while [ $# -gt 0 ]; do
+	case $1 in
+	    -n32) # want -n32 option
+		SRCDIRNAME=${SRCDIRNAME}-n32
+		CC="cc -n32"
+		export CC
+		;;
+	    parallel) # want parallel test
+		SNAPCMD_OPT="$SNAPCMD_OPT $ENABLE_PARALLEL"
+		SRCDIRNAME=${SRCDIRNAME}-pp
+		;;
+	    standard) # standard test
+		;;
+	    --*)
+		# option for configure
+		SNAPCMD_OPT="$SNAPCMD_OPT $1"
+		;;
+	    op-configure)
+		# option for configure
+		SNAPCMD_OPT="$SNAPCMD_OPT $1 $2"
+		shift
+		;;
+	    op-snapshot)
+		# option for snapshot
+		shift
+		SNAPCMD_OPT="$SNAPCMD_OPT $1"
+		;;
+	    setenv)
+		# set environment variable
+		shift
+		eval $1="$2"
+		export $1
+		shift
+		;;
+	    setenvN)
+		# set environment variable with $1 values
+		# e.g., setenvN 3 x a b c is same as setenv x="a b c".
+		# a kludge now--the extra single quotes are needed
+		# else eval complains.
+		shift
+		envN=$1
+		shift
+		envname=$1
+		envalue=
+		while test $envN -gt 0; do
+		    shift
+		    envalue="$envalue $1"
+		    envN=`expr $envN - 1`
+		done
+		eval $envname="'$envalue'"
+		export $envname
+		;;
+	    skip)
+		# skip this test
+		skiptest=yes
+		;;
+	    deploy)
+		# deploy the built binary.
+		shift
+		SNAPCMD_OPT="$SNAPCMD_OPT deploy $1"
+		;;
+	    deploydir)
+		# default directory for deployment.
+		shift
+		SNAPCMD_OPT="$SNAPCMD_OPT deploydir $1"
+		;;
+	    *) # unknown test
+		PRINT "$0: unknown type of test ($1)"
+		retcode=1
+		;;
+	esac
+	shift
+    done
+
+    if [ $retcode -ne 0 -o $skiptest = yes ]; then
+	errcode=$retcode 
+	return $retcode
+    fi
+
+    # Track down the zlib software
+    ans=`$SNAPYARD/current/bin/locate_sw zlib`
+    if [ $? = 0 ]; then
+	Z_INC=`echo $ans | cut -f1 -d,`
+	Z_LIB=`echo $ans | cut -f2 -d,`
+	SNAPCMD_OPT="$SNAPCMD_OPT zlib $Z_INC,$Z_LIB"
+    else
+	# cannot locate zlib software.
+	# continue the test, maybe configure can find it.
+	:
+    fi
+
+    if [ -n "${SRCDIRNAME}" ]; then
+	SNAPCMD_OPT="$SNAPCMD_OPT srcdirname ${SRCDIRNAME}"
+    fi
+
+    # Setup log file name to save test output
+    THIS_MINUTE=`date +%H%M`
+    LOGFILE=${LOGBASENAME}${SRCDIRNAME}_${TODAY}_${THIS_MINUTE}
+    PRINT "Running snapshot with output saved in"
+    PRINT "   $LOGFILE"
+    (date; PRINT Hostname=$HOSTNAME) >> $LOGFILE
+
+    (
+    cd $SNAPYARD/current
+    $SNAPSHOT $SNAPCMD $SNAPCMD_OPT
+    ) >> $LOGFILE 2>&1
+    retcode=$?
+    [ $retcode -ne 0 ] && errcode=$retcode
+
+    date >> $LOGFILE
+    if [ $retcode -ne 0 ]; then
+        # Dump the first 10 lines and the last 30 lines of the LOGFILE.
+        ( ntail=30
+	    echo =========================
+	    echo "Dumping logfile of ${HOSTNAME}: $TEST_TYPE"
+	    echo "Last $ntail lines of $LOGFILE"
+	    echo =========================
+	    tail -$ntail $LOGFILE
+            echo =========================
+            echo Dumping done
+            echo =========================
+	    echo ""
+	) >> $FAILEDDETAIL
+    fi
+}
+
+TIMELIMIT_PARSE()
+{
+    # Function returns timeparam for timekeeper via standard out -
+    # any debug statements should be 'echo "Debug string" >&2' or timekeeper
+    # will declare timeparam to be non-numeric and ignore it.
+    while read x y ; do
+        # Scan for entry for this weekday.
+        xd=`echo $x | cut -f1 -d/`
+        if [ "$xd" = ${WEEKDAY} ]; then
+            # strip away the weekday/ part.
+            timeparam=`echo $x | cut -f2 -d/`
+            break
+        fi
+        case "$x" in
+           '' | '#'*)
+                # blank or comment lines.  Continue.
+                ;;
+            ???/*)
+                # Ignore any entry not of this weekday.
+                ;;
+            *)
+                timeparam="$x"
+                ;;
+        esac
+    done
+    echo $timeparam
+    return
+}
+
+# configuration parsing.
+# Taking configuration from input.
+# This should be invoke with configure file as stdin.
+# Syntax of the configure file:
+#    All lines started with the # are comment lines and are ignored.
+#    Blank lines are ignored too.
+#    Each config line starts with a "Scope" followed by test types.
+#
+# Scope can be:
+#    standard ...          # what the standard test types are.
+#    <host>: <test>        Do <test> for <host> 
+#    all: <test>           Do <test> for all hosts. 
+#    <weekday>/...         Use this scope if the <weekday> matches.
+#                          <weekday> can be {Mon,Tue,Wed,Thu,Fri,Sat,Sun}
+#    If no <host>: input for a <host>, the standard test is used.
+#
+# Test types:
+#    standard		tests defined in standard scope.
+#    -n32		-n32 mode.  Apply to 64/32 bit OS such as IRIX64.
+#    parallel		parallel mode.
+#    op-configure <option>	configure option
+#    op-snapshot <option>	snapshot option
+#    --*		configure option
+#    setenv <name> <value>	set environment variable <name> to <value>
+#    setenvN) <N> <name> <value> ...
+#		        set environment variable with <N> values
+#		        e.g., setenvN 3 x a b c is same as setenv x="a b c".
+#    skip		skip this test
+#    deploy <name>	deploy the built binary at directory <name>.
+#    deploydir <name>   use <name> as the default directory for deployment.
+SNAPTEST_CONFIG_PARSE()
+{
+    while read x y ; do
+	# Scan for entry for this weekday.
+	xd=`echo $x | cut -f1 -d/`
+	if [ "$xd" = ${WEEKDAY} ]; then
+	    # strip away the weekday/ part.
+	    x=`echo $x | cut -f2 -d/`
+	fi
+	case "$x" in
+	    '' | '#'*)
+		# blank or comment lines.  Continue.
+	    	;;
+	    ???/*)
+		# Ignore any entry not of this weekday.
+		;;
+	    standard)
+		#standard configuration
+		STANDARD_OPT="$y"
+		;;
+	    all: | ${CONFIGNAME}:)
+		# types of test for all hosts or this host
+		if [ -n "$TEST_TYPES" ]; then
+		    TEST_TYPES="$TEST_TYPES ; $y"
+		else
+		    TEST_TYPES="$y"
+		fi
+		;;
+	    *:)	# ignore types of test for other hosts
+		;;
+	    *)	# unknown configuration option
+		PRINT $x $y
+		PRINT "***Unknown configuration option. Ignored.***"
+		;;
+	esac
+    done
+}
+
+# Snap Test configuration parsing.
+# If TEST_TYPES is not set, set it to do the "standard" test.
+SNAPTEST_CONFIG()
+{
+    TEST_TYPES=
+    STANDARD_OPT=
+    if [ -f $SNAPTESTCFG ]; then
+	SNAPTEST_CONFIG_PARSE < $SNAPTESTCFG
+    fi
+    TEST_TYPES=${TEST_TYPES:-'standard'}
+}
+
+
+# Show usage page
+USAGE()
+{
+cat <<EOF
+Usage: runtest [-h] [-debug] [-r<version>] [-all] [-nocvs] [-nodiff] [<host> ...]
+    -h
+	print this help page
+    -debug
+	turn on debug mode
+    -r<version>
+	do runtest for <version>
+    -all
+	launch tests for all pre-defined testing hosts
+    -nocvs
+	do not do cvs commands
+    -nodiff
+	do not do diff commands
+    -setup
+        setup the directory structure for snapshot test
+    -configname <name>
+	use <name> as hostname in the parsing of the snaptest configure file
+    <host>
+	launch tests for <host>
+    
+-all and <host> are contradictory and whichever is specified last, is
+the one to take effect.  If neither are given, do the test for the
+local host.
+EOF
+}
+
+
+# Verify if directory ($1) exists.  If not, create it.
+CHECK_DIR()
+{
+   dir=$1
+   if test ! -e $1; then
+      echo mkdir $1
+      mkdir $1
+      errcode=$?
+   elif test ! -d $1; then
+      echo $1 is not a directory
+      errcode=1
+   fi
+}
+
+
+################################
+# Main
+################################
+################################
+# Set up global variables
+################################
+retcode=0		       # error code of individula task
+errcode=0		       # error code of the whole test
+skiptest=no		       # if test is skipped
+CC_SAVED="$CC"		       # CC & PATH maybe changed within a test.
+PATH_SAVED=$PATH	       # These save the original values.
+timelimit=150                  # default time limit (minutes) for the timekeeper
+
+################################
+# Parse options
+################################
+while [ $# -gt 0 ]; do
+    case "$1" in
+	-h) # help--show usage
+	    USAGE
+	    exit 0
+	    ;;
+	-debug*)
+	    # set debug mode
+	    DEBUGMODE="$1"
+	    SNAPSHOT="echo bin/snapshot"
+	    PROGNAME="$PROGNAME $DEBUGMODE"
+	    PRINT "******** DEBUGMODE is $DEBUGMODE ************"
+	    ;;
+	-r*)
+	    # version string
+	    H4VER="$1"
+	    ;;
+	-all)
+	    # Test all hosts.
+	    TESTHOST=-all
+	    ;;
+	-nocvs)
+	    # do not do cvs commands.
+	    NOCVS=nocvs
+	    ;;
+	-nodiff)
+	    # do not do diff commands.
+	    NODIFF=nodiff
+	    ;;
+	-configname)
+	    # use <name> as hostname in the parsing of the snaptest configure file.
+	    shift
+	    CONFIGNAME=$1
+	    ;;
+	-setup)
+	    # setup the directory structure for snapshot test.
+	    CMD=setup
+	    ;;
+	-*) # Unknow option
+	    PRINT "Unknown option ($1)"
+	    USAGE
+	    exit 1
+	    ;;
+	*)
+	    TESTHOST=$*
+	    break
+	    ;;
+    esac
+    shift
+done
+
+# setup H4VER if not set yet
+if [ -z "$H4VER" -a -f bin/snapshot_version ]
+then
+    . bin/snapshot_version
+fi
+
+if [ -n "$H4VER" ]
+then
+    H4VERSION=hdf4_`echo $H4VER | sed -e s/-r// -e s/\\\./_/g`
+    PROGNAME="$PROGNAME $H4VER"
+else
+    H4VERSION=hdf4
+fi
+
+#################################
+# Setup snapshot test directories
+#################################
+BASEDIR=${HOME}/snapshots-${H4VERSION}
+# initial processing of setup option if requested
+if test x-$CMD = x-setup; then
+    CHECK_DIR $BASEDIR
+    test $errcode -ne 0 && exit 1
+elif [ ! -d ${BASEDIR} ]; then
+    echo "BASEDIR ($BASEDIR) does not exist"
+    exit 1
+fi
+# Show the real physical path rather than the symbolic path
+SNAPYARD=`cd $BASEDIR && /bin/pwd`
+# Log file basename
+LOGDIR=${SNAPYARD}/log
+LOGBASENAME=${LOGDIR}/${HOSTNAME}
+PASSEDLOG=${LOGDIR}/PASSED_LOG_${TODAY}
+FAILEDLOG=${LOGDIR}/FAILED_LOG_${TODAY}
+FAILEDDETAIL=${LOGDIR}/FAILED_DETAIL_${TODAY}
+SKIPPEDLOG=${LOGDIR}/SKIPPED_LOG_${TODAY}
+TIMELOG=${LOGDIR}/TIME_LOG_${TODAY}
+TIMEKEEPERLOG=${LOGDIR}/TIMEKEEPER_LOG_${TODAY}
+CVSLOG=${LOGDIR}/CVS_LOG_${TODAY}
+CVSLOG_LOCK=${LOGDIR}/CVS_LOG_LOCK_${TODAY}
+DIFFLOG=${LOGDIR}/DIFF_LOG_${TODAY}
+# Snap Test hosts and Configuration files
+ALLHOSTSFILE=${SNAPYARD}/allhostfile
+SNAPTESTCFG=${SNAPYARD}/snaptest.cfg
+TIMELIMIT=${SNAPYARD}/timelimit
+TMPFILE="${LOGDIR}/#runtest.${TODAY}.$$"
+
+# more processing of setup option if requested
+if test x-$CMD = x-setup; then
+    CHECK_DIR $LOGDIR
+    test $errcode -ne 0 && exit 1
+    CHECK_DIR $LOGDIR/OLD
+    test $errcode -ne 0 && exit 1
+    CHECK_DIR $SNAPYARD/TestDir
+    test $errcode -ne 0 && exit 1
+    # create empty test hosts or configure files if non-existing
+    for f in $ALLHOSTSFILE $SNAPTESTCFG; do
+	if test ! -f $f; then
+	    echo Creating $f
+	    touch $f
+	fi
+    done
+    # create or update the current source.
+    echo update current source
+    $SNAPSHOT checkout 
+    # setup completed.  Exit.
+    exit 0
+fi
+
+#################################
+# Setup test host(s)
+#################################
+if [ "$TESTHOST" = -all ]; then
+    if [ -f $ALLHOSTSFILE ]; then
+	TESTHOST=`sed -e s/#.*// $ALLHOSTSFILE`
+    else
+	PRINT "could not access the all-hosts-file ($ALLHOSTSFILE)"
+	USAGE
+	exit 1
+    fi
+fi
+
+
+#################################
+# Setup to print a trailer summary when exiting not via
+# the normal end of the script.
+#################################
+trap PRINT_TRAILER 0
+
+#
+TotalStartTime=`SecOfDay`
+
+# Process the configuration
+SNAPTEST_CONFIG
+PRINT STANDARD_OPT=$STANDARD_OPT
+PRINT TEST_TYPES=$TEST_TYPES
+PRINT_BLANK
+
+# Do a checkout if one has not been done today
+# Also check MANIFEST file
+if [ -z "$NOCVS" -a ! -f $CVSLOG ]; then
+    PRINT "Running CVS checkout with output saved in"
+    PRINT "   $CVSLOG"
+    # Set CVS lock first
+    touch $CVSLOG_LOCK
+    ($SNAPSHOT checkout ) >> $CVSLOG 2>&1
+    # Save error code and remove the lock
+    errcode=$?
+    rm -f $CVSLOG_LOCK
+    if [ $errcode -ne 0 ]; then
+	# test failed.
+	REPORT_ERR "****FAILED ${HOSTNAME}: CVS checkout****"
+	exit $errcode
+    fi
+    PRINT Checking MAINFEST file ...
+    (cd $SNAPYARD/current; bin/chkmanifest) > $TMPFILE 2>&1
+    errcode=$?
+    if [ $errcode -eq 0 ]; then
+	# test passed.
+	cat $TMPFILE
+    else
+	# test failed.
+	REPORT_ERR "****FAILED ${HOSTNAME}: MANIFEST check****"
+        (   echo =========================
+	    echo "MANIFEST checking failed output"
+	    echo =========================
+	    cat $TMPFILE
+            echo =========================
+	    echo "MANIFEST checking failed output done"
+            echo =========================
+	    echo ""
+	) >> $FAILEDDETAIL
+    fi
+    rm $TMPFILE
+    PRINT_BLANK
+else
+    # make sure the cvs update, if done by another host, has completed.
+    # First wait for the presence of $CVSLOG which signals some host
+    # has started the cvs update.  Then wait for the absense of $CVSLOG_LOCK
+    # which signals the host has completed the cvs update.
+    WAITFOR $CVSLOG 90
+    if [ $WAIT_STATUS -ne 0 ]; then
+	errcode=$WAIT_STATUS
+	REPORT_ERR "****FAILED ${HOSTNAME}: Time expired waiting CVS update to start****"
+	exit $errcode
+    fi
+    WAITTILL $CVSLOG_LOCK 10
+    if [ $WAIT_STATUS -ne 0 ]; then
+	errcode=$WAIT_STATUS
+	REPORT_ERR "****FAILED ${HOSTNAME}: Time expired waiting CVS update to finish****"
+	exit $errcode
+    fi
+fi
+
+# run a snapshot diff to see if any significant differences between
+# the current and previous versions
+if [ -z "$NODIFF" ]; then
+    $SNAPSHOT diff >> $DIFFLOG 2>&1
+    errcode=$?
+    # check the errcode only if NOT in DEBUG MODE
+    if [ -z "$DEBUGMODE" -a $errcode -eq 0 ]; then
+	# no need to run test
+	PRINT "NO TEST: no significant differences between current and previous versions" |
+	    tee -a $PASSEDLOG
+	exit 0
+    fi
+fi
+
+# we can use the version of script in SNAPYARD/current now.
+# Don't do the diff any more.
+PROGNAME="$SNAPYARD/current/$PROGNAME -nodiff"
+
+# Decide to do test for the local host or for remote hosts
+if [ -n "$TESTHOST" -a $HOSTNAME != "$TESTHOST" ]; then
+    date
+    PRINT "*** launching tests from $HOSTNAME ***"
+    PRINT_BLANK
+    TEST_TYPE="launching"
+    cd ${SNAPYARD}/log
+    # Fork off timekeeper if concurrent tests will be used.
+    if [ -n "$SRCDIR" ]; then
+        timelimit=`TIMELIMIT_PARSE < $TIMELIMIT`
+        ($SNAPYARD/current/bin/timekeeper $timelimit > $TIMEKEEPERLOG 2>&1 &)
+        PRINT "    Fork off timekeeper $timelimit"
+    fi
+    n_test=0
+    runtest_type="hosts"
+    for h in $TESTHOST; do
+        CONFIGNAME=`echo $h | cut -f2 -d/`
+        h=`echo $h | cut -f1 -d/`
+	n_test=`expr $n_test + 1`
+	TMP_OUTPUT="#${h}_${CONFIGNAME}.out"
+	(PRINT "=============="
+	 PRINT "Testing $h"
+	 PRINT "==============") > $TMP_OUTPUT
+	CHECK_RSH $h
+	# run the remote shell command with output to $TMP_OUTPUT
+	case "$RSH" in
+	    rsh|ssh)
+		CMD="$RSH $h -n $PROGNAME -configname $CONFIGNAME"
+		PRINT $CMD
+
+		# launch concurrent tests only if srcdir is used
+		if [ -n "$SRCDIR" ]; then
+		    $CMD || REPORT_ERR "****FAILED ${h}: Abnormal exit from runtest****" && PRINT_BLANK &
+                    echo $! > PID.${h}_${CONFIGNAME}
+		else
+		    $CMD || REPORT_ERR "****FAILED ${h}: Abnormal exit from runtest****" && PRINT_BLANK 
+		fi
+		;;
+	    NoRemoteCommand)
+		PRINT $h does not accept Remote Command "(`date`)"
+		;;
+	    NotReachable)
+		PRINT $h is not reachable "(`date`)"
+		;;
+	    *)
+		PRINT "CHECK_RSH for $h returned unknow result ($RSH)"
+		;;
+	esac >> $TMP_OUTPUT 2>&1
+    done
+    # wait for all launched tests to finish, then cat them back out.
+    wait
+    for h in $TESTHOST; do
+        CONFIGNAME=`echo $h | cut -f2 -d/`
+        h=`echo $h | cut -f1 -d/`
+        TMP_OUTPUT="#${h}_${CONFIGNAME}.out"
+	#TMP_OUTPUT="#$h.out"
+	cat $TMP_OUTPUT
+	# Verify test script did complete by checking the last lines
+	(tail -5 $TMP_OUTPUT | grep -s 'Grand total' > /dev/null 2>&1) ||
+	    (REPORT_ERR "****FAILED ${h}: snaptest did not complete****" &&
+		PRINT_BLANK)
+        rm -f $TMP_OUTPUT PID.${h}_${CONFIGNAME}
+	#rm $TMP_OUTPUT
+    done
+    exit 0
+fi
+
+# run the test(s)
+# Note that first field is cut without -s but all subsequent cut
+# must use -s.  If -s is not used at all, a $TEST_TYPES that has
+# no ';' (only 1 test), will pass through intact in all cut. That
+# results in infinite looping.
+# If -s is used with the first field, it will suppress completely
+# a $TYPE_TYPES that has no ';' (only 1 tst ).  That results in no
+# test at all.
+# Note that n_test must start as 1.
+# 
+n_test=1
+runtest_type="tests"
+TEST="`echo $TEST_TYPES | cut -f$n_test -d';'`"
+while [ -n "$TEST" ]; do
+    StartTime=`SecOfDay`
+    RUNSNAPTEST $TEST
+    REPORT_RESULT
+    PRINT_TEST_TRAILER
+
+    n_test=`expr $n_test + 1`
+    TEST="`echo $TEST_TYPES | cut -f$n_test -s -d';'`"
+done
+# dec n_test to show the actual number of tests ran.
+n_test=`expr $n_test - 1`
+
+PRINT_TRAILER
+
+# disable trailer summary printing since all trailers have been
+# printed and we are exiting normally.
+trap 0
+exit $errcode
diff --git a/bin/snapshot b/bin/snapshot
new file mode 100755
index 0000000..4970e9a
--- /dev/null
+++ b/bin/snapshot
@@ -0,0 +1,489 @@
+#!/bin/sh
+# snapshot: Snap shot testing command script for HDF4.
+# This script should be run nightly from cron.  It checks out hdf4
+# from the source repository and compares it against the previous
+# snapshot.  If anything significant changed, it is build and tested.
+# After the test passes and if snapshot release is desired, a new snapshot
+# is created, the minor version number is incremented, and the change is
+# checked back into the source repository.
+
+# function definitions
+TIMESTAMP()
+{
+    echo "=====" "$1": "`date`" "====="
+}
+
+EXIT_BANNER()
+{
+TIMESTAMP "Exit $PROGNAME with status=$?"
+}
+
+# Show current total disk usage.
+DISKUSAGE()
+{
+    du -ks | \
+    ( read x y; echo "Disk Usage=$x KB" )
+}
+
+
+# MAIN
+# SGI /bin/sh replaces $0 as function name if used in a function.
+# Set the name here to avoid that ambiguity and better style too.
+PROGNAME=$0
+
+echo "====================================="
+echo "$PROGNAME $*"
+echo "====================================="
+TIMESTAMP MAIN
+uname -a
+
+# setup exit banner message
+trap EXIT_BANNER 0
+
+# Dump environment variables before option parsing
+echo ===Dumping environment variables before option parsing ===
+printenv | sort
+echo ===Done Dumping environment variables before option parsing ===
+
+# The path isn't properly initialized on hawkwind -- /usr/local/bin is
+# either missing or is after /usr/bin when it should be before.
+PATH="/usr/local/bin:$PATH"
+
+# Where are the snapshots stored?
+#ARCHIVES_default=/afs/ncsa/ftp/HDF/pub/outgoing/hdf4/snapshots
+# Default relative to $BASEDIR.
+ARCHIVES_default=../release_dir
+ARCHIVES=$ARCHIVES_default
+
+# Where is the zlib library?
+# At NCSA, half of the machines have it in /usr/lib, the other half at
+# /usr/ncsa/lib.  Leave it unset.
+ZLIB_default=
+ZLIB=$ZLIB_default
+
+# What compression methods to use?
+METHODS="gzip bzip2 md5"
+
+# Hard set to gmake.
+# No parallel make (-j) because dependences are not set correctly for it.
+# Must use gmake for --srcdir support.
+MAKE=gmake
+export MAKE
+
+#
+# Command options
+cmd="all"
+test_opt=""
+errcode=0
+while [ $# -gt 0 ] ; do
+    case "$1" in
+	all)	
+	    cmd="all"
+	    ;;
+	checkout)
+	    cmdcheckout="checkout"
+	    cmd=""
+	    ;;
+	diff)
+	    cmddiff="diff"
+	    cmd=""
+	    ;;
+	deploy)
+	    # deploy the built binary.
+	    shift
+	    if [ $# -lt 1 ]; then
+		echo "deploy <dir> missing"
+		errcode=1
+		cmd="help"
+		break
+	    fi
+	    cmddeploy="deploy"
+	    DEPLOYDIRNAME="$1"
+	    ;;
+	deploydir)
+	    # default directory for deployment.
+	    shift
+	    if [ $# -lt 1 ]; then
+		echo "deploydir <dir> missing"
+		errcode=1
+		cmd="help"
+		break
+	    fi
+	    deploydir="$1"
+	    ;;
+	test)
+	    cmdtest="test"
+	    cmd=""
+	    ;;
+        setenv)
+            # set environment variable
+            shift
+            eval $1="$2"
+            export $1
+            shift
+            ;;
+        setenvN)
+            # set environment variable with $1 values
+            # e.g., setenvN 3 x a b c is same as setenv x="a b c".
+            # a kludge now--the extra single quotes are needed
+            # else eval complains.
+            shift
+            envN=$1
+            shift
+            envname=$1
+            envalue=
+            while test $envN -gt 0; do
+                shift
+                envalue="$envalue $1"
+                envN=`expr $envN - 1`
+            done
+            eval $envname="'$envalue'"
+            export $envname
+            ;;
+	srcdir)
+	    #use srcdir option for test
+	    srcdir="yes"
+	    ;;
+	srcdirname)
+	    shift
+	    if [ $# -lt 1 ]; then
+		echo "srcdirname <dir> missing"
+		errcode=1
+		cmd="help"
+		break
+	    fi
+	    SRCDIRNAME="$1"
+	    ;;
+	release)
+	    cmdrel="release"
+	    cmd=""
+	    ;;
+	clean | distclean)
+	    cmdclean="$1"
+	    cmd=""
+	    ;;
+	help)
+	    cmd="help"
+	    break
+	    ;;
+	echo)
+	    set -x
+	    break
+	    ;;
+	zlib)
+	    shift
+	    if [ $# -lt 1 ]; then
+		echo "ZLIB information missing"
+		errcode=1
+		cmd="help"
+		break
+	    fi
+	    ZLIB="$1"
+	    ;;
+	archive)
+	    shift
+	    if [ $# -lt 1 ]; then
+		echo "Archive pathname missing"
+		errcode=1
+		cmd="help"
+		break
+	    fi
+	    ARCHIVES="$1"
+	    ;;
+	--*)
+	    OP_CONFIGURE="$OP_CONFIGURE $1"
+	    ;;
+	op-configure)
+	    shift
+	    if [ $# -lt 1 ]; then
+		echo "op-configure option missing"
+		errcode=1
+		cmd="help"
+		break
+	    fi
+	    OP_CONFIGURE="$OP_CONFIGURE $1"
+	    ;;
+	*)
+	    echo "Unkown option $1"
+	    errcode=1
+	    cmd="help"
+	    break
+	    ;;
+    esac
+    shift
+done
+
+# Dump environment variables after option parsing
+echo ===Dumping environment variables after option parsing ===
+printenv | sort
+echo ===Done Dumping environment variables after option parsing ===
+
+if [ "$cmd" = help ]; then
+    set -
+    cat <<EOF
+Usage: $PROGNAME [all] [checkout] [diff] [test] [srcdir] [release] [help]
+	[clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>]
+	[zlib <zlib_path>] [archive <arch_path>] [srcdirname <dir>]
+	[op-configure <option>] [--<option>]
+    all:      Run all commands (checkout, test & release)
+              [Default is all]
+    checkout: Run source checkout
+    diff:     Run diff on current and previous versions.  Exit 0 if
+              no significant differences are found.  Otherwise, non-zero.
+    deploy:   deploy binary to directory <dir>
+    deploydir: use <dir> as the default directory for deployment
+    test:     Run test
+    release:  Run release
+    clean:    Run make clean
+    distclean:Run make distclean
+    setenv <name> <value>:
+              Set environment variable <name> to <value>.
+    setenvN <N> <name> <value> ...:
+              Set environment variable with <N> values.
+              E.g., setenvN 3 x a b c is same as setenv x="a b c".
+    srcdir:   Use srcdir option (does not imply other commands)
+              "snapshot srcdir" is equivalent to "snapshot srcdir all"
+              "snapshot srcdir checkout" is equivalent to "snapshot checkout"
+    srcdirname <dir>:
+              Use <dir> as the srcdir testing directory if srcdir is choosen.
+              If <dir> starts with '-', it is append to the default name
+              E.g., "snapshot srcdir srcdirname -xx" uses hostname-xx
+              [Default is hostname]
+    help:     Print this message
+    echo:     Turn on shell echo
+    zlib <zlib_path>:
+              Use <zlib_path> as the ZLIB locations
+              [Default is $ZLIB_default]
+    archive <arch_path>:
+              Use <arch_path> as the release ARCHIVE area
+              [Default is $ARCHIVES_default]
+    op-configure <option>:
+              Pass <option> to the configure command
+              E.g., "snapshot op-configure --enable-parallel"
+                  configures for parallel mode
+    --<option>:
+              Pass --<option> to the configure command
+              E.g., "snapshot --enable-parallel"
+                  configures for parallel mode
+EOF
+    exit $errcode
+fi
+
+# Setup the proper configure option (--with-zlib) to use zlib library
+# provide ZLIB is non-empty.
+ZLIB=${ZLIB:+"--with-zlib="$ZLIB}
+CONFIGURE="./configure $ZLIB $OP_CONFIGURE"
+
+# Execute the requests
+snapshot=yes
+
+H4VERSION=hdf4
+BASEDIR=${HOME}/snapshots-${H4VERSION}
+CURRENT=${BASEDIR}/current
+PREVIOUS=${BASEDIR}/previous
+ARCHIVES=${ARCHIVES:=${ARCHIVES_default}}
+HOSTNAME=`hostname | cut -f1 -d.`	# no domain part
+if [ $H4VERSION != hdf4 ]; then
+    SVNVERSION="hdf4/branches/$H4VERSION"
+else
+    SVNVERSION=hdf4/trunk		# use the default (trunk) version
+fi
+
+# Try finding a version of diff that supports the -I option too.
+DIFF=diff
+for d in `echo $PATH | sed -e 's/:/ /g'` ; do
+    test -x $d/diff && $d/diff -I XYZ /dev/null /dev/null > /dev/null 2>&1 &&
+	DIFF=$d/diff && break
+done
+
+#=============================
+# Run source checkout
+#=============================
+if [ "$cmd" = "all" -o -n "$cmdcheckout" ]; then
+    TIMESTAMP "checkout"
+    # Create a working directory.  Hopefully one is left over from last
+    # time that still has the contents of the previous release.  But if
+    # not, just create one and assume that a snapshot is necessary.
+    test -d ${BASEDIR} || mkdir -p ${BASEDIR} || exit 1
+
+    # If there is a Makefile in ${CURRENT}, the last test done in it
+    # has not been distclean'ed.  They would interfere with other
+    # --srcdir build since make considers the files in ${CURRENT} 
+    # take precedence over files in its own build-directory.  Run
+    # a "make distclean" to clean them all out.  This is not really
+    # part of the "checkout" functions but this is the most convenient
+    # spot to do the distclean.  We will also continue the checkout process
+    # regardless of the return code of distclean.
+    ( cd ${CURRENT}; test -f Makefile && ${MAKE} distclean)
+
+    SVNROOT=https://svn.hdfgroup.uiuc.edu
+    # Check out the current version from source repository.
+    (cd $BASEDIR; svn -q co ${SVNROOT}/${SVNVERSION} current ) || exit 1
+fi # Do source checkout
+
+
+#=============================
+# Run Test the HDF4 library
+#=============================
+if [ "$cmd" = "all" -o -n "$cmdtest" -o -n "$cmddiff" ]; then
+    TIMESTAMP "diff"
+    # setup if srcdir is used.
+    if [ -z "$srcdir" ]; then
+	TESTDIR=${CURRENT}
+    else
+	#create TESTDIR if not exist yet
+	case "$SRCDIRNAME" in
+	"")
+	    SRCDIRNAME=$HOSTNAME
+	    ;;
+	-*)
+	    SRCDIRNAME="$HOSTNAME$SRCDIRNAME"
+	    ;;
+	esac
+	TESTDIR=${BASEDIR}/TestDir/${SRCDIRNAME}
+	test -d ${TESTDIR} || mkdir ${TESTDIR}
+    fi
+    INSTALLDIR=${TESTDIR}/installdir
+    test -d $INSTALLDIR || mkdir $INSTALLDIR
+    # Make sure current version exists and is clean
+    if [ -d ${TESTDIR} ]; then
+	(cd ${TESTDIR} && ${MAKE} distclean)
+    else
+	errcode=$?
+        snapshot=no
+        exit $errcode
+    fi
+
+    # Compare it with the previous version.  Compare only files listed in
+    # the MANIFEST plus the MANIFEST itself.
+    if [ -d ${PREVIOUS} ]; then
+	if (${DIFF} -c ${PREVIOUS}/MANIFEST ${CURRENT}/MANIFEST); then
+	    snapshot=no
+	    for src in `grep '^\.' ${CURRENT}/MANIFEST|expand|cut -f1 -d' '`; do
+		if ${DIFF} -I H5_VERS_RELEASE -I " released on " \
+		    -I " currently under development" \
+		    ${PREVIOUS}/$src ${CURRENT}/$src
+		then
+		    :	#continue
+		else
+		    snapshot=yes
+		    break
+		fi
+	    done
+	fi
+    fi
+
+    # if diff is choosen, exit 0 if no significant differences are found.
+    # otherwise, exit 1.  This includes cases of other failures.
+    if [ -n "$cmddiff" ]; then
+	if [ $snapshot = no ]; then
+	    exit 0
+	else
+	    exit 1
+	fi
+    fi
+
+    # Make sure all the tests work.
+    # No uninstall target.  Use "rm -rf ..." for now.
+    if [ "$snapshot" = "yes" ]; then
+	if (cd ${TESTDIR} && \
+	    TIMESTAMP "configure" && \
+	    ${srcdir:+${CURRENT}/}${CONFIGURE} --prefix=$INSTALLDIR && \
+	    TIMESTAMP "make" && \
+	    ${MAKE} && \
+	    TIMESTAMP "check" && \
+	    ${MAKE} check && \
+	    TIMESTAMP "install" && \
+	    ${MAKE} install && \
+	    TIMESTAMP "installcheck" && \
+	    ${MAKE} installcheck && \
+	    TIMESTAMP "uninstall" && \
+	    rm -rf $INSTALLDIR ); then
+	    :
+	else
+	    errcode=$?
+	    snapshot=no
+	    exit $errcode
+	fi
+    fi
+fi # Test the HDF4 library
+
+
+#=============================
+# Run deployment if requested.
+#=============================
+if [ -n "$DEPLOYDIRNAME" ]; then
+    if [ "$snapshot" = "yes" ]; then
+	TIMESTAMP "deploy"
+	if (cd ${TESTDIR} && \
+            ${CURRENT}/bin/deploy ${deploydir}/${DEPLOYDIRNAME} && \
+            TIMESTAMP "clean" && \
+            ${MAKE} clean && \
+            TIMESTAMP "installcheck prefix=${deploydir}/${DEPLOYDIRNAME}" && \
+            ${MAKE} installcheck prefix=${deploydir}/${DEPLOYDIRNAME}); then
+	    errcode=$?
+	    exit $errcode
+	fi
+    fi
+fi # Deploy
+
+
+#=============================
+# Run Release snapshot, update version, and commit to source repository
+#=============================
+if [ "$cmd" = "all" -o -n "$cmdrel" ]; then
+    if [ "$snapshot" = "yes" ]; then
+	TIMESTAMP "release"
+	(cd ${CURRENT} && ${MAKE} distclean)
+	(
+	    # Turn on exit on error in the sub-shell so that it does not
+	    # commit source if errors encounter here.
+	    set -e
+	    cd ${CURRENT}
+	    RELEASE_VERSION="`perl bin/h4vers -v`"
+	    bin/release -d $ARCHIVES $METHODS
+	    perl bin/h4vers -i
+	    svn -q commit -m "Snapshot $RELEASE_VERSION"
+	)
+	errcode=$?
+    fi
+
+    # Replace the previous version with the current version.
+    # Should check if the errcode of the release process but there
+    # are other failures after release was done (e.g. h4vers or svn failures)
+    # that should allow the replacement to occure.
+    rm -rf ${PREVIOUS}
+    mv ${CURRENT} ${PREVIOUS}
+fi #Release snapshot
+
+
+#=============================
+# Clean the test area.  Default is no clean.
+#=============================
+if [ -n "$cmdclean" ]; then
+    TIMESTAMP "clean"
+    # setup if srcdir is used.
+    if [ -z "$srcdir" ]; then
+	TESTDIR=${CURRENT}
+    else
+	case "$SRCDIRNAME" in
+	"")
+	    SRCDIRNAME=$HOSTNAME
+	    ;;
+	-*)
+	    SRCDIRNAME="$HOSTNAME$SRCDIRNAME"
+	    ;;
+	esac
+	TESTDIR=${BASEDIR}/TestDir/${SRCDIRNAME}
+    fi
+    # Make sure current version exists and is clean
+    if [ -d ${TESTDIR} ]; then
+	(cd ${TESTDIR} && ${MAKE} $cmdclean )
+    else
+	errcode=$?
+        snapshot=no
+        exit $errcode
+    fi
+fi # Clean the Test directory
+
+exit $errcode
diff --git a/bin/yodconfigure b/bin/yodconfigure
new file mode 100755
index 0000000..039d01c
--- /dev/null
+++ b/bin/yodconfigure
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# 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 at ncsa.uiuc.edu.
+
+# Fix configure file so that it can launch configure testing executable
+# via the proper launching command, e.g., yod.  (Thus the name yodconfigure
+# is used.)
+#
+# Author: Albert Cheng
+
+if [ "$1" = -f ]; then
+    FORCEMODE=yes
+    echo turn FORCEMODE to $FORCEMODE
+    shift
+fi
+
+if [ $# -ne 1 ]; then
+    echo "Usage: $0 [-f] <configure file>"
+    echo "   -f   apply the change even if it has been applied already."
+    exit 1
+fi
+confile=$1
+
+if [ ! -w $confile ]; then
+    echo "$0: $confile is not writable"
+    exit 1
+fi
+
+ACTRY_NAME="ACTRY()"
+if grep ^"$ACTRY_NAME"$ $confile >/dev/null 2>&1 && [ "$FORCEMODE" != yes ]; then
+    echo "$0: $confile is already yodconfigure ready.  Use -f to force yodconfigure again."
+    exit 1
+fi
+
+# Insert the ACTRY function after the 1st line which is the #!/bin/sh.
+# Change all "eval $ac_try" commands to call ACTRY.
+# auto-configure have changed the ac_try syntax from 'eval $ac_try' to
+# 'eval "$ac_try"'.  Thus requiring two very similar global-substitute.
+# The single quotes around EOF tell shell NOT to expand or do substitution in
+# the body of ed input.
+#
+ed - $confile <<'EOF'
+1a
+# ===inserted by yodconfigure ====
+# ACTRY will figure out when it is approprirate to run the command by the
+# $RUNSERIAL launcher (e.g., yod -sz 1) and when to just run it as is.
+# So far, ./a.out and ./conftest are names of real executable that should
+# be run by $RUNSERIAL.
+#
+# (uncomment the echo line if you want to see what is going on.)
+ACTRY()
+{
+#echo ACTRY: args are: $* > /dev/tty
+if [ "$1" = ./a.out -o "$1" = ./conftest ]; then
+#    echo $RUNSERIAL $* > /dev/tty
+    $RUNSERIAL $*
+else
+    $*
+fi
+}
+# === end of ACTRY inserted by yodconfigure ====
+.
+g/eval $ac_try/s/eval/eval ACTRY/
+g/eval "$ac_try"/s/eval/eval ACTRY/
+w
+q
+EOF
diff --git a/config/BlankForm b/config/BlankForm
new file mode 100644
index 0000000..4167a55
--- /dev/null
+++ b/config/BlankForm
@@ -0,0 +1,160 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC="/some/default/compiler/named/foo -ansi"
+  CC_BASENAME=foo
+fi
+
+if test "X-$F77" = "X-"; then
+  F77="/some/default/compiler/named/foo -ansi"
+  F77_BASENAME=foo
+fi
+
+if test "X-$CXX" = "X-"; then
+  CXX="/some/default/compiler/named/foo -ansi"
+  CXX_BASENAME=foo
+fi
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -fverbose-asm"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O3 -fomit-frame-pointer"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS -ansi"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  g77)
+    FFLAGS="$FFLAGS -Wsign-compare"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  *)
+    FFLAGS="$FFLAGS -ansi"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+case $CXX_BASENAME in 
+  g++)
+    CXXFLAGS="$CXXFLAGS"
+    DEBUG_CXXFLAGS="-g -fverbose-asm"
+    PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+
+  *)
+    CXXFLAGS="$CXXFLAGS -ansi"
+    DEBUG_CXXFLAGS="-g"
+    PROD_CXXFLAGS="-O"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+esac
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/aix b/config/aix
new file mode 100644
index 0000000..c790803
--- /dev/null
+++ b/config/aix
@@ -0,0 +1,160 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=xlc
+  CC_BASENAME=xlc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=xlf
+  F77_BASENAME=xlf
+fi
+
+if test "X-$CXX" = "X-"; then
+  CXX=xlC
+  CXX_BASENAME=xlC
+fi
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -fverbose-asm"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O3 -fomit-frame-pointer"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  g77)
+    FFLAGS="$FFLAGS -Wsign-compare"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  *)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+case $CXX_BASENAME in 
+  g++)
+    CXXFLAGS="$CXXFLAGS"
+    DEBUG_CXXFLAGS="-g -fverbose-asm"
+    PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+
+  *)
+    CXXFLAGS="$CXXFLAGS -ansi"
+    DEBUG_CXXFLAGS="-g"
+    PROD_CXXFLAGS="-O"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+esac
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/apple b/config/apple
new file mode 100644
index 0000000..e267a35
--- /dev/null
+++ b/config/apple
@@ -0,0 +1,119 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+# Use clang as the default C compiler.
+if test "X-$CC" = "X-"; then
+    CC=clang
+    CC_BASENAME=clang
+fi
+
+# Use gfortran as the deafult F77 compiler.
+if test "X-$F77" = "X-"; then
+  F77=gfortran
+  F77_BASENAME=gfortran
+fi
+
+case $CC_BASENAME in
+  clang)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -ansi -Wall -pedantic "
+    DEBUG_CPPFLAGS=
+    # There is a bug somewhere in mfhdf/libsrc that is exposed by compiling
+    # with any optimization in $CC in Lion, Mountain Lion and Mavericks systems.
+    # Use -O0 for now.
+    case "$host_os" in
+	darwin11.* | darwin12.* | darwin13.*)	# Lion & Mountain Lion & Mavericks
+	    xOFLAG="-O0"
+	    ;;
+	*)		# Other OSX versions
+	    xOFLAG="-O2"
+	    ;;
+    esac
+    PROD_CFLAGS=${PROD_CFLAGS:-"-ansi  -Wall -pedantic $xOFLAG"}
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  icc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    # There is a bug somewhere in mfhdf/libsrc that is exposed by compiling
+    # with any optimization in $CC in Lion, Mountain Lion and Mavericks systems.
+    # Use -O0 for now.
+    case "$host_os" in
+	darwin11.* | darwin12.* | darwin13.*)   # Lion & Mountain Lion & Mavericks
+	    xOFLAG="-O0"
+	    ;;
+	*)		# Other OSX versions
+	    xOFLAG="-O2"
+	    ;;
+    esac
+    PROD_CFLAGS=${PROD_CFLAGS:-"$xOFLAG"}
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -ansi -Wall -pedantic "
+    DEBUG_CPPFLAGS=
+    # There is a bug somewhere in mfhdf/libsrc that is exposed by compiling
+    # with any optimization in $CC in Lion, Mountain Lion and Mavericks systems.
+    # Use -O0 for now.
+    case "$host_os" in
+	darwin11.* | darwin12.* | darwin13.*)   # Lion & Mountain Lion & Mavericks
+	    xOFLAG="-O0"
+	    ;;
+	*)		# Other OSX versions
+	    xOFLAG="-O2"
+	    ;;
+    esac
+    PROD_CFLAGS=${PROD_CFLAGS:-"-ansi  -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes -Wnested-externs -pedantic $xOFLAG"}
+    PROD_CFLAGS=${PROD_CFLAGS:-"-ansi  -Wall -pedantic $xOFLAG"}
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS=${PROD_CFLAGS:-"-O"}
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  gfortran)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
diff --git a/config/cmake/CPack.Info.plist.in b/config/cmake/CPack.Info.plist.in
new file mode 100644
index 0000000..6cf2a94
--- /dev/null
+++ b/config/cmake/CPack.Info.plist.in
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>@CPACK_PACKAGE_FILE_NAME@</string>
+	<key>CFBundleIconFile</key>
+	<string>@CPACK_BUNDLE_ICON@</string>
+	<key>CFBundleIdentifier</key>
+	<string>org. at CPACK_PACKAGE_VENDOR@. at CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>@CPACK_PACKAGE_VERSIO@</string>
+	<key>CFBundleShortVersionString</key>
+	<string>@CPACK_SHORT_VERSION_STRING@</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+	<key>CFBundleName</key>
+	<string>@CPACK_BUNDLE_NAME@</string>
+	<key>CFBundleGetInfoString</key>
+	<string>@CPACK_APPLE_GUI_INFO_STRING@</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>@CPACK_APPLE_GUI_COPYRIGHT@</string>
+</dict>
+</plist>
diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake
new file mode 100644
index 0000000..0c4d718
--- /dev/null
+++ b/config/cmake/CTestCustom.cmake
@@ -0,0 +1,101 @@
+SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1500)
+
+SET (CTEST_CUSTOM_WARNING_EXCEPTION
+    ${CTEST_CUSTOM_WARNING_EXCEPTION}
+    "note.*expected.*void.*but argument is of type.*volatile"
+    "SZIP.src.*:[ \t]*warning"
+    "jpeg.src.*:[ \t]*warning"
+    "POSIX name for this item is deprecated"
+    "disabling jobserver mode"
+    "config.cmake.xlatefile.c"
+)
+ 
+ 
+SET (CTEST_CUSTOM_MEMCHECK_IGNORE
+    ${CTEST_CUSTOM_MEMCHECK_IGNORE}
+    hdfpack-clear-refs
+    hdfpalette-clear-refs
+    hdfjpeg-clear-refs
+    HDP_tst-clearall-objects
+    HDP_tst_err-clearall-objects
+    HDP-clear-my.dat
+    HDP-clear-mybin.dat
+    hdfimport-clear-refs
+    HDIFF-clearall-objects
+    hrepack-clearall-objects
+    HDF_EXAMPLES-clearall-objects
+    HDF_FORTRAN_EXAMPLES-clearall-objects
+    MFHDF_EXAMPLES-clearall-objects
+    MFHDF_FORTRAN_EXAMPLES-clearall-objects
+    MFHDF_TEST-clearall-objects
+    testhdf-clearall-objects
+    testhdf_thf0-clearall-objects
+    testhdf_thf1-clearall-objects
+    testhdf_thf2-clearall-objects
+    testhdf_thf3-clearall-objects
+    testhdf_thf4-clearall-objects
+    testhdf_thf5-clearall-objects
+    testhdf_thf6-clearall-objects
+    testhdf_thf7-clearall-objects
+    testhdf_thf8-clearall-objects
+    testhdf_thf9-clearall-objects
+    testhdf_thf10-clearall-objects
+    testhdf_thf11-clearall-objects
+    testhdf_thf12-clearall-objects
+    testhdf_thf13-clearall-objects
+    testhdf_thf14-clearall-objects
+    testhdf_thf15-clearall-objects
+    testhdf_thf16-clearall-objects
+    testhdf_thf17-clearall-objects
+    testhdf_thf18-clearall-objects
+    testhdf_thf19-clearall-objects
+    testhdf_thf20-clearall-objects
+    testhdf_thf21-clearall-objects
+    testhdf_thf22-clearall-objects
+    testhdf_thf23-clearall-objects
+    testhdf_thf24-clearall-objects
+    testhdf_thf25-clearall-objects
+    testhdf_thf26-clearall-objects
+    testhdf_thf27-clearall-objects
+    testhdf_thf28-clearall-objects
+    testhdf_thf29-clearall-objects
+    testhdf_thf30-clearall-objects
+    testhdf_thf31-clearall-objects
+    testhdf_thf32-clearall-objects
+    testhdf_thf33-clearall-objects
+    testhdf_thf34-clearall-objects
+    testhdf_thf35-clearall-objects
+    testhdf_thf36-clearall-objects
+    testhdf_thf37-clearall-objects
+    testhdf_thf38-clearall-objects
+    testhdf_thf39-clearall-objects
+    testhdf_thf40-clearall-objects
+    testhdf_thf41-clearall-objects
+    testhdf_thf42-clearall-objects
+    testhdf_thf43-clearall-objects
+    testhdf_thf44-clearall-objects
+    testhdf_thf45-clearall-objects
+    testhdf_thf46-clearall-objects
+    testhdf_thf47-clearall-objects
+    testhdf_thf48-clearall-objects
+    testhdf_thf49-clearall-objects
+    testhdf_thf50-clearall-objects
+    testhdf_thf51-clearall-objects
+    testhdf_thf52-clearall-objects
+    testhdf_thf53-clearall-objects
+    testhdf_thf54-clearall-objects
+    testhdf_thf55-clearall-objects
+    testhdf_thf56-clearall-objects
+    testhdf_thf57-clearall-objects
+    testhdf_thf58-clearall-objects
+    testhdf_thf59-clearall-objects
+    testhdf_thf60-clearall-objects
+    hrepack-clearall-objects
+    MFHDF_FORTRAN-clearall-objects
+    HDF_FORTRAN-clearall-objects
+    hdfgif-clear-refs
+    ncdump-clearall-objects
+    NC_TEST-clearall-objects                            
+    HEDIT-hdfed.input1
+    HEDIT-ristosds.input1
+)
\ No newline at end of file
diff --git a/config/cmake/CheckTypeSize.cmake b/config/cmake/CheckTypeSize.cmake
new file mode 100644
index 0000000..8d51a64
--- /dev/null
+++ b/config/cmake/CheckTypeSize.cmake
@@ -0,0 +1,48 @@
+#
+# Check if the type exists and determine size of type.  if the type
+# exists, the size will be stored to the variable.
+#
+# CHECK_TYPE_SIZE - macro which checks the size of type
+# VARIABLE - variable to store size if the type exists.
+# HAVE_${VARIABLE} - does the variable exists or not
+#
+
+MACRO (HDF_CHECK_TYPE_SIZE TYPE VARIABLE)
+  SET (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1)
+  IF ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+    SET (MACRO_CHECK_TYPE_SIZE_FLAGS 
+        "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}"
+    )
+    FOREACH (def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H HAVE_INTTYPES_H)
+      IF ("${def}")
+        SET (MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
+      ENDIF("${def}")
+    ENDFOREACH (def)
+
+    MESSAGE (STATUS "Check size of ${TYPE}")
+    IF (CMAKE_REQUIRED_LIBRARIES)
+      SET (CHECK_TYPE_SIZE_ADD_LIBRARIES 
+          "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
+      )
+    ENDIF (CMAKE_REQUIRED_LIBRARIES)
+    TRY_RUN (${VARIABLE} HAVE_${VARIABLE}
+        ${CMAKE_BINARY_DIR}
+        ${HDF4_RESOURCES_DIR}/CheckTypeSize.c
+        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
+        "${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
+        OUTPUT_VARIABLE OUTPUT
+    )
+    IF (HAVE_${VARIABLE})
+      MESSAGE (STATUS "Check size of ${TYPE} - done")
+      FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log 
+          "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n"
+      )
+    ELSE (HAVE_${VARIABLE})
+      MESSAGE (STATUS "Check size of ${TYPE} - failed")
+      FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log 
+          "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n\n"
+      )
+    ENDIF (HAVE_${VARIABLE})
+  ENDIF ("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+  SET (CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS)
+ENDMACRO (HDF_CHECK_TYPE_SIZE)
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
new file mode 100644
index 0000000..341c91c
--- /dev/null
+++ b/config/cmake/ConfigureChecks.cmake
@@ -0,0 +1,365 @@
+#-----------------------------------------------------------------------------
+# Include all the necessary files for macros
+#-----------------------------------------------------------------------------
+INCLUDE (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
+INCLUDE (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
+
+#-----------------------------------------------------------------------------
+# Always SET this for now IF we are on an OS X box
+#-----------------------------------------------------------------------------
+IF (APPLE)
+  LIST(LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH)
+  IF(ARCH_LENGTH GREATER 1)
+    set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE)
+    message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is"
+    "due to technical reasons. The best approach would be build each architecture in separate directories"
+    "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'"
+    "variable has been set to a blank value which will build the default architecture for this system.")
+  ENDIF()
+  SET (H4_AC_APPLE_UNIVERSAL_BUILD 0)
+ENDIF (APPLE)
+
+#-----------------------------------------------------------------------------
+# Option to Build HDF4 versions of NetCDF-3 APIS
+#-----------------------------------------------------------------------------
+OPTION (HDF4_ENABLE_NETCDF "Build HDF4 versions of NetCDF-3 APIS" ON)
+IF (HDF4_ENABLE_NETCDF)
+  SET (H4_HAVE_NETCDF 1)
+ENDIF (HDF4_ENABLE_NETCDF)
+
+#-----------------------------------------------------------------------------
+# This MACRO checks IF the symbol exists in the library and IF it
+# does, it appends library to the list.
+#-----------------------------------------------------------------------------
+SET (LINK_LIBS "")
+MACRO (CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
+  CHECK_LIBRARY_EXISTS ("${LIBRARY};${LINK_LIBS}" ${SYMBOL} "" ${VARIABLE})
+  IF (${VARIABLE})
+    SET (LINK_LIBS ${LINK_LIBS} ${LIBRARY})
+  ENDIF (${VARIABLE})
+ENDMACRO (CHECK_LIBRARY_EXISTS_CONCAT)
+
+# ----------------------------------------------------------------------
+# WINDOWS Hard code Values
+# ----------------------------------------------------------------------
+
+SET (WINDOWS)
+IF (WIN32)
+  IF (MINGW)
+    SET (WINDOWS 1) # MinGW tries to imitate Windows
+    SET (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1")
+  ENDIF (MINGW)
+  SET (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib")
+  IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
+    SET (WINDOWS 1)
+    SET (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1")
+  ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
+ENDIF (WIN32)
+
+IF (WINDOWS)
+  SET (H4_HAVE_STDDEF_H 1)
+  SET (H4_HAVE_SYS_STAT_H 1)
+  SET (H4_HAVE_SYS_TYPES_H 1)
+  SET (H4_HAVE_LIBM 1)
+  SET (H4_HAVE_STRDUP 1)
+  SET (H4_HAVE_SYSTEM 1)
+  SET (H4_HAVE_LONGJMP 1)
+  IF (NOT MINGW)
+    SET (H4_HAVE_GETHOSTNAME 1)
+  ENDIF (NOT MINGW)
+  IF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
+    SET (H4_HAVE_GETCONSOLESCREENBUFFERINFO 1)
+  ENDIF (NOT UNIX AND NOT CYGWIN AND NOT MINGW)
+  SET (H4_HAVE_FUNCTION 1)
+  SET (H4_HAVE_TIMEZONE 1)
+  IF (MINGW)
+    SET (H4_HAVE_WINSOCK2_H 1)
+  ENDIF (MINGW)
+  SET (H4_HAVE_LIBWS2_32 1)
+  SET (H4_HAVE_LIBWSOCK32 1)
+ENDIF (WINDOWS)
+
+# ----------------------------------------------------------------------
+# END of WINDOWS Hard code Values
+# ----------------------------------------------------------------------
+
+IF (CYGWIN)
+  CHECK_LIBRARY_EXISTS_CONCAT ("rpc" xdr_opaque     H4_HAVE_RPC)
+ENDIF (CYGWIN)
+
+#-----------------------------------------------------------------------------
+#  Check for the math library "m"
+#-----------------------------------------------------------------------------
+IF (NOT WINDOWS)
+  CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil     H4_HAVE_LIBM)
+  CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup  H4_HAVE_LIBWS2_32)
+  CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname H4_HAVE_LIBWSOCK32)
+ENDIF (NOT WINDOWS)
+
+CHECK_LIBRARY_EXISTS_CONCAT ("ucb"    gethostname  H4_HAVE_LIBUCB)
+CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect      H4_HAVE_LIBSOCKET)
+CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL)
+
+IF (NOT NOT_NEED_LIBNSL)
+  CHECK_LIBRARY_EXISTS_CONCAT ("nsl"    gethostbyname  H4_HAVE_LIBNSL)
+ENDIF (NOT NOT_NEED_LIBNSL)
+
+# For other tests to use the same libraries
+SET (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS})
+
+SET (USE_INCLUDES "")
+IF (WINDOWS)
+  SET (USE_INCLUDES ${USE_INCLUDES} "windows.h")
+ENDIF (WINDOWS)
+
+IF (NOT WINDOWS)
+  TEST_BIG_ENDIAN(H4_WORDS_BIGENDIAN)
+ENDIF (NOT WINDOWS)
+
+# For other specific tests, use this MACRO.
+MACRO (HDF_FUNCTION_TEST OTHER_TEST)
+  IF ("H4_${OTHER_TEST}" MATCHES "^H4_${OTHER_TEST}$")
+    SET (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}")
+    SET (OTHER_TEST_ADD_LIBRARIES)
+    IF (CMAKE_REQUIRED_LIBRARIES)
+      SET (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+    ENDIF (CMAKE_REQUIRED_LIBRARIES)
+
+    FOREACH (def ${HDF_EXTRA_TEST_DEFINITIONS})
+      SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
+    ENDFOREACH (def)
+
+    FOREACH (def
+        HAVE_SYS_TIME_H
+        HAVE_UNISTD_H
+        HAVE_SYS_TYPES_H
+        HAVE_SYS_SOCKET_H
+    )
+      IF ("${H4_${def}}")
+        SET (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}")
+      ENDIF ("${H4_${def}}")
+    ENDFOREACH (def)
+
+    IF (LARGEFILE)
+      SET (MACRO_CHECK_FUNCTION_DEFINITIONS
+          "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
+      )
+    ENDIF (LARGEFILE)
+
+    #MESSAGE (STATUS "Performing ${OTHER_TEST}")
+    TRY_COMPILE (${OTHER_TEST}
+        ${CMAKE_BINARY_DIR}
+        ${HDF4_RESOURCES_DIR}/HDFTests.c
+        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+        "${OTHER_TEST_ADD_LIBRARIES}"
+        OUTPUT_VARIABLE OUTPUT
+    )
+    IF (${OTHER_TEST})
+      SET (H4_${OTHER_TEST} 1 CACHE INTERNAL "Other test ${FUNCTION}")
+      MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Success")
+    ELSE (${OTHER_TEST})
+      MESSAGE (STATUS "Performing Other Test ${OTHER_TEST} - Failed")
+      SET (H4_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}")
+      FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+          "Performing Other Test ${OTHER_TEST} failed with the following output:\n"
+          "${OUTPUT}\n"
+      )
+    ENDIF (${OTHER_TEST})
+  ENDIF ("H4_${OTHER_TEST}" MATCHES "^H4_${OTHER_TEST}$")
+ENDMACRO (HDF_FUNCTION_TEST)
+
+#-----------------------------------------------------------------------------
+HDF_FUNCTION_TEST (STDC_HEADERS)
+
+#-----------------------------------------------------------------------------
+# Check IF header file exists and add it to the list.
+#-----------------------------------------------------------------------------
+MACRO (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
+  CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE})
+  IF (${VARIABLE})
+    SET (USE_INCLUDES ${USE_INCLUDES} ${FILE})
+  ENDIF (${VARIABLE})
+ENDMACRO (CHECK_INCLUDE_FILE_CONCAT)
+
+#-----------------------------------------------------------------------------
+#  Check for the existence of certain header files
+#-----------------------------------------------------------------------------
+CHECK_INCLUDE_FILE_CONCAT ("unistd.h"        H4_HAVE_UNISTD_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h"      H4_HAVE_SYS_STAT_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/types.h"     H4_HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILE_CONCAT ("stddef.h"        H4_HAVE_STDDEF_H)
+CHECK_INCLUDE_FILE_CONCAT ("stdint.h"        H4_HAVE_STDINT_H)
+
+# IF the c compiler found stdint, check the C++ as well. On some systems this
+# file will be found by C but not C++, only do this test IF the C++ compiler
+# has been initialized (e.g. the project also includes some c++)
+IF (H4_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
+  CHECK_INCLUDE_FILE_CXX ("stdint.h" H4_HAVE_STDINT_H_CXX)
+  IF (NOT H4_HAVE_STDINT_H_CXX)
+    SET (H4_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H")
+    SET (USE_INCLUDES ${USE_INCLUDES} "stdint.h")
+  ENDIF (NOT H4_HAVE_STDINT_H_CXX)
+ENDIF (H4_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
+
+# Windows
+IF (NOT CYGWIN)
+  CHECK_INCLUDE_FILE_CONCAT ("winsock2.h"      H4_HAVE_WINSOCK2_H)
+ENDIF (NOT CYGWIN)
+CHECK_INCLUDE_FILE_CONCAT ("pthread.h"       H4_HAVE_PTHREAD_H)
+CHECK_INCLUDE_FILE_CONCAT ("string.h"        H4_HAVE_STRING_H)
+CHECK_INCLUDE_FILE_CONCAT ("strings.h"       H4_HAVE_STRINGS_H)
+CHECK_INCLUDE_FILE_CONCAT ("stdlib.h"        H4_HAVE_STDLIB_H)
+CHECK_INCLUDE_FILE_CONCAT ("memory.h"        H4_HAVE_MEMORY_H)
+CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h"         H4_HAVE_DLFCN_H)
+CHECK_INCLUDE_FILE_CONCAT ("inttypes.h"      H4_HAVE_INTTYPES_H)
+
+#-----------------------------------------------------------------------------
+#  Check for large file support
+#-----------------------------------------------------------------------------
+
+# The linux-lfs option is deprecated.
+SET (LINUX_LFS 0)
+
+SET (HDF_EXTRA_FLAGS)
+IF (NOT WINDOWS)
+  # Linux Specific flags
+#  Removed _POSIX_SOURCE due to OS X build errors
+    SET (HDF_EXTRA_FLAGS -D_BSD_SOURCE)
+  OPTION (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
+  IF (HDF_ENABLE_LARGE_FILE)
+    SET (msg "Performing TEST_LFS_WORKS")
+    TRY_RUN (TEST_LFS_WORKS_RUN   TEST_LFS_WORKS_COMPILE
+        ${HDF4_BINARY_DIR}/CMake
+        ${HDF4_RESOURCES_DIR}/HDFTests.c
+        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS
+        OUTPUT_VARIABLE OUTPUT
+    )
+    IF (TEST_LFS_WORKS_COMPILE)
+      IF (TEST_LFS_WORKS_RUN  MATCHES 0)
+        SET (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
+        SET (LARGEFILE 1)
+        SET (HDF_EXTRA_FLAGS ${HDF_EXTRA_FLAGS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
+        MESSAGE (STATUS "${msg}... yes")
+      ELSE (TEST_LFS_WORKS_RUN  MATCHES 0)
+        SET (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
+        MESSAGE (STATUS "${msg}... no")
+        FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+              "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n"
+        )
+      ENDIF (TEST_LFS_WORKS_RUN  MATCHES 0)
+    ELSE (TEST_LFS_WORKS_COMPILE )
+      SET (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
+      MESSAGE (STATUS "${msg}... no")
+      FILE (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+          "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n"
+      )
+    ENDIF (TEST_LFS_WORKS_COMPILE)
+  ENDIF (HDF_ENABLE_LARGE_FILE)
+  SET (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS})
+ENDIF (NOT WINDOWS)
+
+ADD_DEFINITIONS (${HDF_EXTRA_FLAGS})
+
+#-----------------------------------------------------------------------------
+#  Check the size in bytes of all the int and float types
+#-----------------------------------------------------------------------------
+MACRO (H4_CHECK_TYPE_SIZE type var)
+  SET (aType ${type})
+  SET (aVar  ${var})
+#  MESSAGE (STATUS "Checking size of ${aType} and storing into ${aVar}")
+  CHECK_TYPE_SIZE (${aType}   ${aVar})
+  IF (NOT ${aVar})
+    SET (${aVar} 0 CACHE INTERNAL "SizeOf for ${aType}")
+#    MESSAGE (STATUS "Size of ${aType} was NOT Found")
+  ENDIF (NOT ${aVar})
+ENDMACRO (H4_CHECK_TYPE_SIZE)
+
+
+H4_CHECK_TYPE_SIZE (char           H4_SIZEOF_CHAR)
+H4_CHECK_TYPE_SIZE (short          H4_SIZEOF_SHORT)
+H4_CHECK_TYPE_SIZE (int            H4_SIZEOF_INT)
+H4_CHECK_TYPE_SIZE (unsigned       H4_SIZEOF_UNSIGNED)
+IF (NOT APPLE)
+  H4_CHECK_TYPE_SIZE (long         H4_SIZEOF_LONG)
+ENDIF (NOT APPLE)
+H4_CHECK_TYPE_SIZE ("long long"    H4_SIZEOF_LONG_LONG)
+H4_CHECK_TYPE_SIZE (__int64        H4_SIZEOF___INT64)
+IF (NOT H4_SIZEOF___INT64)
+  SET (H4_SIZEOF___INT64 0)
+ENDIF (NOT H4_SIZEOF___INT64)
+
+H4_CHECK_TYPE_SIZE (float          H4_SIZEOF_FLOAT)
+H4_CHECK_TYPE_SIZE (double         H4_SIZEOF_DOUBLE)
+H4_CHECK_TYPE_SIZE ("long double"  H4_SIZEOF_LONG_DOUBLE)
+
+H4_CHECK_TYPE_SIZE (int8_t         H4_SIZEOF_INT8_T)
+H4_CHECK_TYPE_SIZE (uint8_t        H4_SIZEOF_UINT8_T)
+H4_CHECK_TYPE_SIZE (int_least8_t   H4_SIZEOF_INT_LEAST8_T)
+H4_CHECK_TYPE_SIZE (uint_least8_t  H4_SIZEOF_UINT_LEAST8_T)
+H4_CHECK_TYPE_SIZE (int_fast8_t    H4_SIZEOF_INT_FAST8_T)
+H4_CHECK_TYPE_SIZE (uint_fast8_t   H4_SIZEOF_UINT_FAST8_T)
+
+H4_CHECK_TYPE_SIZE (int16_t        H4_SIZEOF_INT16_T)
+H4_CHECK_TYPE_SIZE (uint16_t       H4_SIZEOF_UINT16_T)
+H4_CHECK_TYPE_SIZE (int_least16_t  H4_SIZEOF_INT_LEAST16_T)
+H4_CHECK_TYPE_SIZE (uint_least16_t H4_SIZEOF_UINT_LEAST16_T)
+H4_CHECK_TYPE_SIZE (int_fast16_t   H4_SIZEOF_INT_FAST16_T)
+H4_CHECK_TYPE_SIZE (uint_fast16_t  H4_SIZEOF_UINT_FAST16_T)
+
+H4_CHECK_TYPE_SIZE (int32_t        H4_SIZEOF_INT32_T)
+H4_CHECK_TYPE_SIZE (uint32_t       H4_SIZEOF_UINT32_T)
+H4_CHECK_TYPE_SIZE (int_least32_t  H4_SIZEOF_INT_LEAST32_T)
+H4_CHECK_TYPE_SIZE (uint_least32_t H4_SIZEOF_UINT_LEAST32_T)
+H4_CHECK_TYPE_SIZE (int_fast32_t   H4_SIZEOF_INT_FAST32_T)
+H4_CHECK_TYPE_SIZE (uint_fast32_t  H4_SIZEOF_UINT_FAST32_T)
+
+H4_CHECK_TYPE_SIZE (int64_t        H4_SIZEOF_INT64_T)
+H4_CHECK_TYPE_SIZE (uint64_t       H4_SIZEOF_UINT64_T)
+H4_CHECK_TYPE_SIZE (int_least64_t  H4_SIZEOF_INT_LEAST64_T)
+H4_CHECK_TYPE_SIZE (uint_least64_t H4_SIZEOF_UINT_LEAST64_T)
+H4_CHECK_TYPE_SIZE (int_fast64_t   H4_SIZEOF_INT_FAST64_T)
+H4_CHECK_TYPE_SIZE (uint_fast64_t  H4_SIZEOF_UINT_FAST64_T)
+IF (NOT APPLE)
+  H4_CHECK_TYPE_SIZE (size_t       H4_SIZEOF_SIZE_T)
+  H4_CHECK_TYPE_SIZE (ssize_t      H4_SIZEOF_SSIZE_T)
+  IF (NOT H4_SIZEOF_SSIZE_T)
+    SET (H4_SIZEOF_SSIZE_T 0)
+  ENDIF (NOT H4_SIZEOF_SSIZE_T)
+ENDIF (NOT APPLE)
+H4_CHECK_TYPE_SIZE (off_t          H4_SIZEOF_OFF_T)
+H4_CHECK_TYPE_SIZE (off64_t        H4_SIZEOF_OFF64_T)
+IF (NOT H4_SIZEOF_OFF64_T)
+  SET (H4_SIZEOF_OFF64_T 0)
+ENDIF (NOT H4_SIZEOF_OFF64_T)
+
+
+#-----------------------------------------------------------------------------
+# Check for some functions that are used
+#
+CHECK_FUNCTION_EXISTS (fork              H4_HAVE_FORK)
+CHECK_FUNCTION_EXISTS (strdup            H4_HAVE_STRDUP)
+CHECK_FUNCTION_EXISTS (system            H4_HAVE_SYSTEM)
+CHECK_FUNCTION_EXISTS (wait              H4_HAVE_WAIT)
+CHECK_FUNCTION_EXISTS (vfork             H4_HAVE_VFORK)
+#-----------------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Check a bunch of other functions
+#-----------------------------------------------------------------------------
+IF (NOT WINDOWS)
+  FOREACH (test
+      STDC_HEADERS
+      HAVE_FUNCTION
+  )
+    HDF_FUNCTION_TEST (${test})
+  ENDFOREACH (test)
+ENDIF (NOT WINDOWS)
diff --git a/config/cmake/FindHDF4.cmake.in b/config/cmake/FindHDF4.cmake.in
new file mode 100644
index 0000000..55a29b0
--- /dev/null
+++ b/config/cmake/FindHDF4.cmake.in
@@ -0,0 +1,82 @@
+#
+# To be used by projects that make use of CMakeified hdf- at HDF4_PACKAGE_VERSION@
+#
+
+#
+# Find the HDF4 includes and get all installed hdf4 library settings from
+# HDF4-config.cmake file : Requires a CMake compatible hdf- at HDF4_PACKAGE_VERSION@ or later 
+# for this feature to work. The following vars are set if hdf4 is found.
+#
+# HDF4_FOUND               - True if found, otherwise all other vars are undefined
+# HDF4_INCLUDE_DIR         - The include dir for main *.h files
+# HDF4_FORTRAN_INCLUDE_DIR - The include dir for fortran modules and headers
+# HDF4_VERSION_STRING      - full version (e.g. @HDF4_PACKAGE_VERSION@)
+# HDF4_VERSION_MAJOR       - major part of version (e.g. @HDF4_PACKAGE_VERSION_MAJOR@)
+# HDF4_VERSION_MINOR       - minor part (e.g. @HDF4_PACKAGE_VERSION_MINOR@)
+# 
+# The following boolean vars will be defined
+# HDF4_ENABLE_PARALLEL - 1 if HDF4 parallel supported
+# HDF4_BUILD_FORTRAN   - 1 if HDF4 was compiled with fortran on
+# HDF4_BUILD_CPP_LIB   - 1 if HDF4 was compiled with cpp on
+# HDF4_BUILD_TOOLS     - 1 if HDF4 was compiled with tools on
+# 
+# Target names that are valid (depending on enabled options)
+# will be the following
+#
+# hdf              : HDF4 C library
+# hdf_f90cstub     : used by Fortran to C interface
+# hdf_fortran      : Fortran HDF4 library
+# mfhdf            : HDF4 multi-file C interface library
+# xdr              : RPC library
+# mfhdf_f90cstub   : used by Fortran to C interface to multi-file library
+# mfhdf_fortran    : Fortran multi-file library
+# 
+# To aid in finding HDF4 as part of a subproject set
+# HDF4_ROOT_DIR_HINT to the location where @HDF4_PACKAGE@@HDF_PACKAGE_EXT at -config.cmake lies
+
+INCLUDE (SelectLibraryConfigurations)
+INCLUDE (FindPackageHandleStandardArgs)
+
+# The HINTS option should only be used for values computed from the system.
+SET (_HDF4_HINTS
+    $ENV{HOME}/.local
+    $ENV{HDF4_ROOT}
+    $ENV{HDF4_ROOT_DIR_HINT}
+)
+# Hard-coded guesses should still go in PATHS. This ensures that the user
+# environment can always override hard guesses.
+SET (_HDF4_PATHS
+    $ENV{HOME}/.local
+    $ENV{HDF4_ROOT}
+    $ENV{HDF4_ROOT_DIR_HINT}
+    /usr/lib/@HDF4_PACKAGE@
+    /usr/share/@HDF4_PACKAGE@
+    /usr/local/@HDF4_PACKAGE@
+    /usr/local/@HDF4_PACKAGE@/share
+)
+
+FIND_PATH (HDF4_ROOT_DIR "@HDF4_PACKAGE@@HDF_PACKAGE_EXT at -config.cmake"
+    HINTS ${_HDF4_HINTS}
+    PATHS ${_HDF4_PATHS}
+    PATH_SUFFIXES
+        cmake/@HDF4_PACKAGE@
+        lib/cmake/@HDF4_PACKAGE@
+        share/cmake/@HDF4_PACKAGE@
+)
+
+FIND_PATH (HDF4_INCLUDE_DIRS "hdf.h"
+    HINTS ${_HDF4_HINTS}
+    PATHS ${_HDF4_PATHS}
+    PATH_SUFFIXES
+        include
+        Include
+)
+
+# For backwards compatibility we set HDF4_INCLUDE_DIR to the value of
+# HDF4_INCLUDE_DIRS
+SET ( HDF4_INCLUDE_DIR "${HDF4_INCLUDE_DIRS}" )
+
+IF (HDF4_INCLUDE_DIR)
+  SET (HDF4_FOUND "YES")
+  INCLUDE (${HDF4_ROOT_DIR}/@HDF4_PACKAGE@@HDF_PACKAGE_EXT at -config.cmake)
+ENDIF (HDF4_INCLUDE_DIR)
diff --git a/config/cmake/FindMPI.cmake b/config/cmake/FindMPI.cmake
new file mode 100644
index 0000000..b16c9c3
--- /dev/null
+++ b/config/cmake/FindMPI.cmake
@@ -0,0 +1,628 @@
+# - Find a Message Passing Interface (MPI) implementation
+# The Message Passing Interface (MPI) is a library used to write
+# high-performance distributed-memory parallel applications, and
+# is typically deployed on a cluster. MPI is a standard interface
+# (defined by the MPI forum) for which many implementations are
+# available. All of them have somewhat different include paths,
+# libraries to link against, etc., and this module tries to smooth
+# out those differences.
+#
+# === Variables ===
+#
+# This module will set the following variables per language in your project,
+# where <lang> is one of C, CXX, or Fortran:
+#   MPI_<lang>_FOUND           TRUE if FindMPI found MPI flags for <lang>
+#   MPI_<lang>_COMPILER        MPI Compiler wrapper for <lang>
+#   MPI_<lang>_COMPILE_FLAGS   Compilation flags for MPI programs
+#   MPI_<lang>_INCLUDE_PATH    Include path(s) for MPI header
+#   MPI_<lang>_LINK_FLAGS      Linking flags for MPI programs
+#   MPI_<lang>_LIBRARIES       All libraries to link MPI programs against
+# Additionally, FindMPI sets the following variables for running MPI
+# programs from the command line:
+#   MPIEXEC                    Executable for running MPI programs
+#   MPIEXEC_NUMPROC_FLAG       Flag to pass to MPIEXEC before giving
+#                              it the number of processors to run on
+#   MPIEXEC_PREFLAGS           Flags to pass to MPIEXEC directly
+#                              before the executable to run.
+#   MPIEXEC_POSTFLAGS          Flags to pass to MPIEXEC after other flags
+# === Usage ===
+#
+# To use this module, simply call FindMPI from a CMakeLists.txt file, or
+# run find_package(MPI), then run CMake.  If you are happy with the auto-
+# detected configuration for your language, then you're done.  If not, you
+# have two options:
+#   1. Set MPI_<lang>_COMPILER to the MPI wrapper (mpicc, etc.) of your
+#      choice and reconfigure.  FindMPI will attempt to determine all the
+#      necessary variables using THAT compiler's compile and link flags.
+#   2. If this fails, or if your MPI implementation does not come with
+#      a compiler wrapper, then set both MPI_<lang>_LIBRARIES and
+#      MPI_<lang>_INCLUDE_PATH.  You may also set any other variables
+#      listed above, but these two are required.  This will circumvent
+#      autodetection entirely.
+# When configuration is successful, MPI_<lang>_COMPILER will be set to the
+# compiler wrapper for <lang>, if it was found.  MPI_<lang>_FOUND and other
+# variables above will be set if any MPI implementation was found for <lang>,
+# regardless of whether a compiler was found.
+#
+# When using MPIEXEC to execute MPI applications, you should typically use
+# all of the MPIEXEC flags as follows:
+#   ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS
+#     ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
+# where PROCS is the number of processors on which to execute the program,
+# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
+# MPI program.
+#
+# === Backward Compatibility ===
+#
+# For backward compatibility with older versions of FindMPI, these
+# variables are set, but deprecated:
+#   MPI_FOUND           MPI_COMPILER        MPI_LIBRARY
+#   MPI_COMPILE_FLAGS   MPI_INCLUDE_PATH    MPI_EXTRA_LIBRARY
+#   MPI_LINK_FLAGS      MPI_LIBRARIES
+# In new projects, please use the MPI_<lang>_XXX equivalents.
+
+#=============================================================================
+# Copyright 2001-2011 Kitware, Inc.
+# Copyright 2010-2011 Todd Gamblin tgamblin at llnl.gov
+# Copyright 2001-2009 Dave Partyka
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# include this to handle the QUIETLY and REQUIRED arguments
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
+include(GetPrerequisites)
+
+#
+# This part detects MPI compilers, attempting to wade through the mess of compiler names in
+# a sensible way.
+#
+# The compilers are detected in this order:
+#
+# 1. Try to find the most generic availble MPI compiler, as this is usually set up by
+#    cluster admins.  e.g., if plain old mpicc is available, we'll use it and assume it's
+#    the right compiler.
+#
+# 2. If a generic mpicc is NOT found, then we attempt to find one that matches
+#    CMAKE_<lang>_COMPILER_ID. e.g. if you are using XL compilers, we'll try to find mpixlc
+#    and company, but not mpiicc.  This hopefully prevents toolchain mismatches.
+#
+# If you want to force a particular MPI compiler other than what we autodetect (e.g. if you
+# want to compile regular stuff with GNU and parallel stuff with Intel), you can always set
+# your favorite MPI_<lang>_COMPILER explicitly and this stuff will be ignored.
+#
+
+# Start out with the generic MPI compiler names, as these are most commonly used.
+set(_MPI_C_COMPILER_NAMES                  mpicc    mpcc      mpicc_r mpcc_r)
+set(_MPI_CXX_COMPILER_NAMES                mpicxx   mpiCC     mpcxx   mpCC    mpic++   mpc++
+                                           mpicxx_r mpiCC_r   mpcxx_r mpCC_r  mpic++_r mpc++_r)
+set(_MPI_Fortran_COMPILER_NAMES            mpif95   mpif95_r  mpf95   mpf95_r
+                                           mpif90   mpif90_r  mpf90   mpf90_r
+                                           mpif77   mpif77_r  mpf77   mpf77_r)
+
+# GNU compiler names
+set(_MPI_GNU_C_COMPILER_NAMES              mpigcc mpgcc mpigcc_r mpgcc_r)
+set(_MPI_GNU_CXX_COMPILER_NAMES            mpig++ mpg++ mpig++_r mpg++_r)
+set(_MPI_GNU_Fortran_COMPILER_NAMES        mpigfortran mpgfortran mpigfortran_r mpgfortran_r
+                                           mpig77 mpig77_r mpg77 mpg77_r)
+
+# Intel MPI compiler names
+set(_MPI_Intel_C_COMPILER_NAMES            mpiicc)
+set(_MPI_Intel_CXX_COMPILER_NAMES          mpiicpc  mpiicxx mpiic++ mpiiCC)
+set(_MPI_Intel_Fortran_COMPILER_NAMES      mpiifort mpiif95 mpiif90 mpiif77)
+
+# PGI compiler names
+set(_MPI_PGI_C_COMPILER_NAMES              mpipgcc mppgcc)
+set(_MPI_PGI_CXX_COMPILER_NAMES            mpipgCC mppgCC)
+set(_MPI_PGI_Fortran_COMPILER_NAMES        mpipgf95 mpipgf90 mppgf95 mppgf90 mpipgf77 mppgf77)
+
+# XLC MPI Compiler names
+set(_MPI_XL_C_COMPILER_NAMES               mpxlc      mpxlc_r    mpixlc     mpixlc_r)
+set(_MPI_XL_CXX_COMPILER_NAMES             mpixlcxx   mpixlC     mpixlc++   mpxlcxx   mpxlc++   mpixlc++   mpxlCC
+                                           mpixlcxx_r mpixlC_r   mpixlc++_r mpxlcxx_r mpxlc++_r mpixlc++_r mpxlCC_r)
+set(_MPI_XL_Fortran_COMPILER_NAMES         mpixlf95   mpixlf95_r mpxlf95 mpxlf95_r
+                                           mpixlf90   mpixlf90_r mpxlf90 mpxlf90_r
+                                           mpixlf77   mpixlf77_r mpxlf77 mpxlf77_r
+                                           mpixlf     mpixlf_r   mpxlf   mpxlf_r)
+
+# append vendor-specific compilers to the list if we either don't know the compiler id,
+# or if we know it matches the regular compiler.
+foreach (lang C CXX Fortran)
+  foreach (id GNU Intel PGI XL)
+    if (NOT CMAKE_${lang}_COMPILER_ID OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "${id}")
+      list(APPEND _MPI_${lang}_COMPILER_NAMES ${_MPI_${id}_${lang}_COMPILER_NAMES})
+    endif()
+    unset(_MPI_${id}_${lang}_COMPILER_NAMES)    # clean up the namespace here
+  endforeach()
+endforeach()
+
+
+# Names to try for MPI exec
+set(_MPI_EXEC_NAMES                        mpiexec mpirun lamexec srun)
+
+# Grab the path to MPI from the registry if we're on windows.
+set(_MPI_PREFIX_PATH)
+if(WIN32)
+  list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
+  list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]")
+  list(APPEND _MPI_PREFIX_PATH "$ENV{ProgramW6432}/MPICH2/")
+endif()
+
+# Build a list of prefixes to search for MPI.
+foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
+  foreach(MpiPackageDir ${_MPI_PREFIX_PATH})
+    if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
+      list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
+    endif()
+  endforeach()
+endforeach()
+
+
+#
+# interrogate_mpi_compiler(lang try_libs)
+#
+# Attempts to extract compiler and linker args from an MPI compiler. The arguments set
+# by this function are:
+#
+#   MPI_<lang>_INCLUDE_PATH    MPI_<lang>_LINK_FLAGS     MPI_<lang>_FOUND
+#   MPI_<lang>_COMPILE_FLAGS   MPI_<lang>_LIBRARIES
+#
+# MPI_<lang>_COMPILER must be set beforehand to the absolute path to an MPI compiler for
+# <lang>.  Additionally, MPI_<lang>_INCLUDE_PATH and MPI_<lang>_LIBRARIES may be set
+# to skip autodetection.
+#
+# If try_libs is TRUE, this will also attempt to find plain MPI libraries in the usual
+# way.  In general, this is not as effective as interrogating the compilers, as it
+# ignores language-specific flags and libraries.  However, some MPI implementations
+# (Windows implementations) do not have compiler wrappers, so this approach must be used.
+#
+function (interrogate_mpi_compiler lang try_libs)
+  # MPI_${lang}_NO_INTERROGATE will be set to a compiler name when the *regular* compiler was
+  # discovered to be the MPI compiler.  This happens on machines like the Cray XE6 that use
+  # modules to set cc, CC, and ftn to the MPI compilers.  If the user force-sets another MPI
+  # compiler, MPI_${lang}_COMPILER won't be equal to MPI_${lang}_NO_INTERROGATE, and we'll
+  # inspect that compiler anew.  This allows users to set new compilers w/o rm'ing cache.
+  string(COMPARE NOTEQUAL "${MPI_${lang}_NO_INTERROGATE}" "${MPI_${lang}_COMPILER}" interrogate)
+
+  # If MPI is set already in the cache, don't bother with interrogating the compiler.
+  if (interrogate AND ((NOT MPI_${lang}_INCLUDE_PATH) OR (NOT MPI_${lang}_LIBRARIES)))
+    if (MPI_${lang}_COMPILER)
+      # Check whether the -showme:compile option works. This indicates that we have either OpenMPI
+      # or a newer version of LAM-MPI, and implies that -showme:link will also work.
+      execute_process(
+        COMMAND ${MPI_${lang}_COMPILER} -showme:compile
+        OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+        ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+        RESULT_VARIABLE  MPI_COMPILER_RETURN)
+
+      if (MPI_COMPILER_RETURN EQUAL 0)
+        # If we appear to have -showme:compile, then we should
+        # also have -showme:link. Try it.
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -showme:link
+          OUTPUT_VARIABLE  MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+
+        if (MPI_COMPILER_RETURN EQUAL 0)
+          # We probably have -showme:incdirs and -showme:libdirs as well,
+          # so grab that while we're at it.
+          execute_process(
+            COMMAND ${MPI_${lang}_COMPILER} -showme:incdirs
+            OUTPUT_VARIABLE  MPI_INCDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_VARIABLE   MPI_INCDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+          execute_process(
+            COMMAND ${MPI_${lang}_COMPILER} -showme:libdirs
+            OUTPUT_VARIABLE  MPI_LIBDIRS OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_VARIABLE   MPI_LIBDIRS ERROR_STRIP_TRAILING_WHITESPACE)
+
+        else()
+          # reset things here if something went wrong.
+          set(MPI_COMPILE_CMDLINE)
+          set(MPI_LINK_CMDLINE)
+        endif()
+      endif ()
+
+      # Older versions of LAM-MPI have "-showme". Try to find that.
+      if (NOT MPI_COMPILER_RETURN EQUAL 0)
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -showme
+          OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+      endif()
+
+      # MVAPICH uses -compile-info and -link-info.  Try them.
+      if (NOT MPI_COMPILER_RETURN EQUAL 0)
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -compile-info
+          OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+
+        # If we have compile-info, also have link-info.
+        if (MPI_COMPILER_RETURN EQUAL 0)
+          execute_process(
+            COMMAND ${MPI_${lang}_COMPILER} -link-info
+            OUTPUT_VARIABLE  MPI_LINK_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+            ERROR_VARIABLE   MPI_LINK_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+            RESULT_VARIABLE  MPI_COMPILER_RETURN)
+        endif()
+
+        # make sure we got compile and link.  Reset vars if something's wrong.
+        if (NOT MPI_COMPILER_RETURN EQUAL 0)
+          set(MPI_COMPILE_CMDLINE)
+          set(MPI_LINK_CMDLINE)
+        endif()
+      endif()
+
+      # MPICH just uses "-show". Try it.
+      if (NOT MPI_COMPILER_RETURN EQUAL 0)
+        execute_process(
+          COMMAND ${MPI_${lang}_COMPILER} -show
+          OUTPUT_VARIABLE  MPI_COMPILE_CMDLINE OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE   MPI_COMPILE_CMDLINE ERROR_STRIP_TRAILING_WHITESPACE
+          RESULT_VARIABLE  MPI_COMPILER_RETURN)
+      endif()
+
+      if (MPI_COMPILER_RETURN EQUAL 0)
+        # We have our command lines, but we might need to copy MPI_COMPILE_CMDLINE
+        # into MPI_LINK_CMDLINE, if we didn't find the link line.
+        if (NOT MPI_LINK_CMDLINE)
+          set(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
+        endif()
+      else()
+        message(STATUS "Unable to determine MPI from MPI driver ${MPI_${lang}_COMPILER}")
+        set(MPI_COMPILE_CMDLINE)
+        set(MPI_LINK_CMDLINE)
+      endif()
+
+      # Here, we're done with the interrogation part, and we'll try to extract args we care
+      # about from what we learned from the compiler wrapper scripts.
+
+      # If interrogation came back with something, extract our variable from the MPI command line
+      if (MPI_COMPILE_CMDLINE OR MPI_LINK_CMDLINE)
+        # Extract compile flags from the compile command line.
+        string(REGEX MATCHALL "(^| )-[Df]([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
+        set(MPI_COMPILE_FLAGS_WORK)
+
+        foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+          if (MPI_COMPILE_FLAGS_WORK)
+            set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+          else()
+            set(MPI_COMPILE_FLAGS_WORK ${FLAG})
+          endif()
+        endforeach()
+
+        # Extract include paths from compile command line
+        string(REGEX MATCHALL "(^| )-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+        foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
+          string(REGEX REPLACE "^ ?-I" "" IPATH ${IPATH})
+          string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+          list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
+        endforeach()
+
+        # try using showme:incdirs if extracting didn't work.
+        if (NOT MPI_INCLUDE_PATH_WORK)
+          set(MPI_INCLUDE_PATH_WORK ${MPI_INCDIRS})
+          separate_arguments(MPI_INCLUDE_PATH_WORK)
+        endif()
+
+        # If all else fails, just search for mpi.h in the normal include paths.
+        if (NOT MPI_INCLUDE_PATH_WORK)
+          set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+          find_path(MPI_HEADER_PATH mpi.h
+            HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+            PATH_SUFFIXES include)
+          set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+        endif()
+
+        # Extract linker paths from the link command line
+        string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+        set(MPI_LINK_PATH)
+        foreach(LPATH ${MPI_ALL_LINK_PATHS})
+          string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH})
+          string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+          list(APPEND MPI_LINK_PATH ${LPATH})
+        endforeach()
+
+        # try using showme:libdirs if extracting didn't work.
+        if (NOT MPI_LINK_PATH)
+          set(MPI_LINK_PATH ${MPI_LIBDIRS})
+          separate_arguments(MPI_LINK_PATH)
+        endif()
+
+        # Extract linker flags from the link command line
+        string(REGEX MATCHALL "(^| )-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+        set(MPI_LINK_FLAGS_WORK)
+        foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+          if (MPI_LINK_FLAGS_WORK)
+            set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+          else()
+            set(MPI_LINK_FLAGS_WORK ${FLAG})
+          endif()
+        endforeach()
+
+        # Extract the set of libraries to link against from the link command
+        # line
+        string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
+        # Determine full path names for all of the libraries that one needs
+        # to link against in an MPI program
+        foreach(LIB ${MPI_LIBNAMES})
+          string(REGEX REPLACE "^ ?-l" "" LIB ${LIB})
+          # MPI_LIB is cached by find_library, but we don't want that.  Clear it first.
+          set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+          find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH})
+
+          if (MPI_LIB)
+            list(APPEND MPI_LIBRARIES_WORK ${MPI_LIB})
+          elseif (NOT MPI_FIND_QUIETLY)
+            message(WARNING "Unable to find MPI library ${LIB}")
+          endif()
+        endforeach()
+
+        # Sanity check MPI_LIBRARIES to make sure there are enough libraries
+        list(LENGTH MPI_LIBRARIES_WORK MPI_NUMLIBS)
+        list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
+        if (NOT MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+          set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+        endif()
+      endif()
+
+    elseif(try_libs)
+      # If we didn't have an MPI compiler script to interrogate, attempt to find everything
+      # with plain old find functions.  This is nasty because MPI implementations have LOTS of
+      # different library names, so this section isn't going to be very generic.  We need to
+      # make sure it works for MS MPI, though, since there are no compiler wrappers for that.
+      find_path(MPI_HEADER_PATH mpi.h
+        HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+        PATH_SUFFIXES include Inc)
+      set(MPI_INCLUDE_PATH_WORK ${MPI_HEADER_PATH})
+
+      # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
+      if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+        set(MS_MPI_ARCH_DIR amd64)
+      else()
+        set(MS_MPI_ARCH_DIR i386)
+      endif()
+
+      set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+      find_library(MPI_LIB
+        NAMES         mpi mpich mpich2 msmpi
+        HINTS         ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+        PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR})
+      set(MPI_LIBRARIES_WORK ${MPI_LIB})
+
+      # Right now, we only know about the extra libs for C++.
+      # We could add Fortran here (as there is usually libfmpich, etc.), but
+      # this really only has to work with MS MPI on Windows.
+      # Assume that other MPI's are covered by the compiler wrappers.
+      if (${lang} STREQUAL CXX)
+        set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+        find_library(MPI_LIB
+          NAMES         mpi++ mpicxx cxx mpi_cxx
+          HINTS         ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+          PATH_SUFFIXES lib)
+        if (MPI_LIBRARIES_WORK AND MPI_LIB)
+          set(MPI_LIBRARIES_WORK ${MPI_LIBRARIES_WORK} ${MPI_LIB})
+        endif()
+      endif()
+
+      if (${lang} STREQUAL Fortran)
+        set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+        find_library(MPI_LIB
+          NAMES         fmpi fmpich fmpich2 fmpich2g
+          HINTS         ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
+          PATH_SUFFIXES lib)
+        if (MPI_LIBRARIES_WORK AND MPI_LIB)
+          set(MPI_LIBRARIES_WORK ${MPI_LIBRARIES_WORK} ${MPI_LIB})
+        endif()
+      endif()
+
+      if (NOT MPI_LIBRARIES_WORK)
+        set(MPI_LIBRARIES_WORK "MPI_${lang}_LIBRARIES-NOTFOUND")
+      endif()
+    endif()
+
+    # If we found MPI, set up all of the appropriate cache entries
+    set(MPI_${lang}_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI ${lang} compilation flags"         FORCE)
+    set(MPI_${lang}_INCLUDE_PATH  ${MPI_INCLUDE_PATH_WORK}  CACHE STRING "MPI ${lang} include path"              FORCE)
+    set(MPI_${lang}_LINK_FLAGS    ${MPI_LINK_FLAGS_WORK}    CACHE STRING "MPI ${lang} linking flags"             FORCE)
+    set(MPI_${lang}_LIBRARIES     ${MPI_LIBRARIES_WORK}     CACHE STRING "MPI ${lang} libraries to link against" FORCE)
+    mark_as_advanced(MPI_${lang}_COMPILE_FLAGS MPI_${lang}_INCLUDE_PATH MPI_${lang}_LINK_FLAGS MPI_${lang}_LIBRARIES)
+
+    # clear out our temporary lib/header detectionv variable here.
+    set(MPI_LIB         "MPI_LIB-NOTFOUND"         CACHE INTERNAL "Scratch variable for MPI lib detection"    FORCE)
+    set(MPI_HEADER_PATH "MPI_HEADER_PATH-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI header detection" FORCE)
+  endif()
+
+  # finally set a found variable for each MPI language
+  if (MPI_${lang}_INCLUDE_PATH AND MPI_${lang}_LIBRARIES)
+    set(MPI_${lang}_FOUND TRUE PARENT_SCOPE)
+  else()
+    set(MPI_${lang}_FOUND FALSE PARENT_SCOPE)
+  endif()
+endfunction()
+
+
+# This function attempts to compile with the regular compiler, to see if MPI programs
+# work with it.  This is a last ditch attempt after we've tried interrogating mpicc and
+# friends, and after we've tried to find generic libraries.  Works on machines like
+# Cray XE6, where the modules environment changes what MPI version cc, CC, and ftn use.
+function(try_regular_compiler lang success)
+  set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+  if (${lang} STREQUAL Fortran)
+    set(test_file ${scratch_directory}/cmake_mpi_test.f90)
+    file(WRITE ${test_file}
+      "program hello\n"
+      "include 'mpif.h'\n"
+      "integer ierror\n"
+      "call MPI_INIT(ierror)\n"
+      "call MPI_FINALIZE(ierror)\n"
+      "end\n")
+  else()
+    if (${lang} STREQUAL CXX)
+      set(test_file ${scratch_directory}/cmake_mpi_test.cpp)
+    else()
+      set(test_file ${scratch_directory}/cmake_mpi_test.c)
+    endif()
+    file(WRITE ${test_file}
+      "#include <mpi.h>\n"
+      "int main(int argc, char **argv) {\n"
+      "  MPI_Init(&argc, &argv);\n"
+      "  MPI_Finalize();\n"
+      "}\n")
+  endif()
+  try_compile(compiler_has_mpi ${scratch_directory} ${test_file})
+  if (compiler_has_mpi)
+    set(MPI_${lang}_NO_INTERROGATE ${CMAKE_${lang}_COMPILER} CACHE STRING "Whether to interrogate MPI ${lang} compiler" FORCE)
+    set(MPI_${lang}_COMPILER       ${CMAKE_${lang}_COMPILER} CACHE STRING "MPI ${lang} compiler"                        FORCE)
+    set(MPI_${lang}_COMPILE_FLAGS  ""                        CACHE STRING "MPI ${lang} compilation flags"               FORCE)
+    set(MPI_${lang}_INCLUDE_PATH   ""                        CACHE STRING "MPI ${lang} include path"                    FORCE)
+    set(MPI_${lang}_LINK_FLAGS     ""                        CACHE STRING "MPI ${lang} linking flags"                   FORCE)
+    set(MPI_${lang}_LIBRARIES      ""                        CACHE STRING "MPI ${lang} libraries to link against"       FORCE)
+  endif()
+  set(${success} ${compiler_has_mpi} PARENT_SCOPE)
+  unset(compiler_has_mpi CACHE)
+endfunction()
+
+# End definitions, commence real work here.
+
+# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
+find_program(MPIEXEC
+  NAMES ${_MPI_EXEC_NAMES}
+  PATHS ${_MPI_PREFIX_PATH}
+  PATH_SUFFIXES bin
+  DOC "Executable for running MPI programs.")
+
+# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
+# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
+get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH)
+get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
+
+set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
+set(MPIEXEC_PREFLAGS     ""    CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
+set(MPIEXEC_POSTFLAGS    ""    CACHE STRING "These flags will come after all flags given to MPIEXEC.")
+set(MPIEXEC_MAX_NUMPROCS "2"   CACHE STRING "Maximum number of processors available to run MPI applications.")
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+
+
+#=============================================================================
+# Backward compatibility input hacks.  Propagate the FindMPI hints to C and
+# CXX if the respective new versions are not defined.  Translate the old
+# MPI_LIBRARY and MPI_EXTRA_LIBRARY to respective MPI_${lang}_LIBRARIES.
+#
+# Once we find the new variables, we translate them back into their old
+# equivalents below.
+foreach (lang C CXX)
+  # Old input variables.
+  set(_MPI_OLD_INPUT_VARS COMPILER COMPILE_FLAGS INCLUDE_PATH LINK_FLAGS)
+
+  # Set new vars based on their old equivalents, if the new versions are not already set.
+  foreach (var ${_MPI_OLD_INPUT_VARS})
+    if (NOT MPI_${lang}_${var} AND MPI_${var})
+      set(MPI_${lang}_${var} "${MPI_${var}}")
+    endif()
+  endforeach()
+
+  # Special handling for MPI_LIBRARY and MPI_EXTRA_LIBRARY, which we nixed in the
+  # new FindMPI.  These need to be merged into MPI_<lang>_LIBRARIES
+  if (NOT MPI_${lang}_LIBRARIES AND (MPI_LIBRARY OR MPI_EXTRA_LIBRARY))
+    set(MPI_${lang}_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+  endif()
+endforeach()
+#=============================================================================
+
+
+# This loop finds the compilers and sends them off for interrogation.
+foreach (lang C CXX Fortran)
+  if (CMAKE_${lang}_COMPILER_WORKS)
+    # If the user supplies a compiler *name* instead of an absolute path, assume that we need to find THAT compiler.
+    if (MPI_${lang}_COMPILER)
+      is_file_executable(MPI_${lang}_COMPILER MPI_COMPILER_IS_EXECUTABLE)
+      if (NOT MPI_COMPILER_IS_EXECUTABLE)
+        # Get rid of our default list of names and just search for the name the user wants.
+        set(_MPI_${lang}_COMPILER_NAMES ${MPI_${lang}_COMPILER})
+        set(MPI_${lang}_COMPILER "MPI_${lang}_COMPILER-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+        # If the user specifies a compiler, we don't want to try to search libraries either.
+        set(try_libs FALSE)
+      endif()
+    else()
+      set(try_libs TRUE)
+    endif()
+
+    find_program(MPI_${lang}_COMPILER
+      NAMES  ${_MPI_${lang}_COMPILER_NAMES}
+      PATHS  "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH})
+    interrogate_mpi_compiler(${lang} ${try_libs})
+    mark_as_advanced(MPI_${lang}_COMPILER)
+
+    # last ditch try -- if nothing works so far, just try running the regular compiler and
+    # see if we can create an MPI executable.
+    set(regular_compiler_worked 0)
+    if (NOT MPI_${lang}_LIBRARIES OR NOT MPI_${lang}_INCLUDE_PATH)
+      try_regular_compiler(${lang} regular_compiler_worked)
+    endif()
+
+    if (regular_compiler_worked)
+      find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_COMPILER)
+    else()
+      find_package_handle_standard_args(MPI_${lang} DEFAULT_MSG MPI_${lang}_LIBRARIES MPI_${lang}_INCLUDE_PATH)
+    endif()
+  endif()
+endforeach()
+
+
+#=============================================================================
+# More backward compatibility stuff
+#
+# Bare MPI sans ${lang} vars are set to CXX then C, depending on what was found.
+# This mimics the behavior of the old language-oblivious FindMPI.
+set(_MPI_OLD_VARS FOUND COMPILER INCLUDE_PATH COMPILE_FLAGS LINK_FLAGS LIBRARIES)
+if (MPI_CXX_FOUND)
+  foreach (var ${_MPI_OLD_VARS})
+    set(MPI_${var} ${MPI_CXX_${var}})
+  endforeach()
+elseif (MPI_C_FOUND)
+  foreach (var ${_MPI_OLD_VARS})
+    set(MPI_${var} ${MPI_C_${var}})
+  endforeach()
+else()
+  # Note that we might still have found Fortran, but you'll need to use MPI_Fortran_FOUND
+  set(MPI_FOUND FALSE)
+endif()
+
+# Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and MPI_EXTRA_LIBRARY, and set them in cache.
+if (MPI_LIBRARIES)
+  list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
+  set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+else()
+  set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+endif()
+
+list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
+if (MPI_NUMLIBS GREATER 1)
+  set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
+  list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
+  set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
+else()
+  set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+endif()
+#=============================================================================
+
+# unset these vars to cleanup namespace
+unset(_MPI_OLD_VARS)
+unset(_MPI_PREFIX_PATH)
+unset(_MPI_BASE_DIR)
+foreach (lang C CXX Fortran)
+  unset(_MPI_${lang}_COMPILER_NAMES)
+endforeach()
diff --git a/config/cmake/FindSZIP.cmake b/config/cmake/FindSZIP.cmake
new file mode 100644
index 0000000..b358862
--- /dev/null
+++ b/config/cmake/FindSZIP.cmake
@@ -0,0 +1,179 @@
+
+# - Find SZIP library
+# - Derived from the FindTiff.cmake that is included with cmake
+# Find the native SZIP includes and library
+# This module defines
+#  SZIP_INCLUDE_DIRS, where to find tiff.h, etc.
+#  SZIP_LIBRARIES, libraries to link against to use SZIP.
+#  SZIP_FOUND, If false, do not try to use SZIP.
+#    also defined, but not for general use are
+#  SZIP_LIBRARY, where to find the SZIP library.
+#  SZIP_LIBRARY_DEBUG - Debug version of SZIP library
+#  SZIP_LIBRARY_RELEASE - Release Version of SZIP library
+
+# MESSAGE (STATUS "Finding SZIP library and headers..." )
+
+############################################
+#
+# Check the existence of the libraries.
+#
+############################################
+# This macro was taken directly from the FindQt4.cmake file that is included
+# with the CMake distribution. This is NOT my work. All work was done by the
+# original authors of the FindQt4.cmake file. Only minor modifications were
+# made to remove references to Qt and make this file more generally applicable
+#########################################################################
+
+MACRO (SZIP_ADJUST_LIB_VARS basename)
+  IF (${basename}_INCLUDE_DIR)
+
+    # if only the release version was found, set the debug variable also to the release version
+    IF (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG)
+      SET (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE})
+      SET (${basename}_LIBRARY       ${${basename}_LIBRARY_RELEASE})
+      SET (${basename}_LIBRARIES     ${${basename}_LIBRARY_RELEASE})
+    ENDIF (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG)
+
+    # if only the debug version was found, set the release variable also to the debug version
+    IF (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE)
+      SET (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG})
+      SET (${basename}_LIBRARY         ${${basename}_LIBRARY_DEBUG})
+      SET (${basename}_LIBRARIES       ${${basename}_LIBRARY_DEBUG})
+    ENDIF (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE)
+    IF (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE)
+      # if the generator supports configuration types then set
+      # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+      IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        SET (${basename}_LIBRARY       optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
+      ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+        # then just use the release libraries
+        SET (${basename}_LIBRARY       ${${basename}_LIBRARY_RELEASE} )
+      ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+      SET (${basename}_LIBRARIES       optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG})
+    ENDIF (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE)
+
+    SET (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library")
+
+    IF (${basename}_LIBRARY)
+      SET (${basename}_FOUND 1)
+    ENDIF (${basename}_LIBRARY)
+
+  ENDIF (${basename}_INCLUDE_DIR )
+
+  # Make variables changeble to the advanced user
+  MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR )
+ENDMACRO (SZIP_ADJUST_LIB_VARS)
+
+
+# Look for the header file.
+SET (SZIP_INCLUDE_SEARCH_DIRS
+    $ENV{SZIP_INSTALL}/include
+    $ENV{SZIP_INSTALL}/include/szip
+    /usr/include
+    /usr/include/szip
+)
+
+SET (SZIP_LIB_SEARCH_DIRS
+    $ENV{SZIP_INSTALL}/lib
+    /usr/lib
+)
+
+SET (SZIP_BIN_SEARCH_DIRS
+    $ENV{SZIP_INSTALL}/bin
+    /usr/bin
+)
+
+FIND_PATH (SZIP_INCLUDE_DIR
+    NAMES szlib.h
+    PATHS ${SZIP_INCLUDE_SEARCH_DIRS}
+    NO_DEFAULT_PATH
+)
+
+IF (WIN32)
+    SET (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d")
+    SET (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip")
+ELSE (WIN32)
+    SET (SZIP_SEARCH_DEBUG_NAMES "sz_d")
+    SET (SZIP_SEARCH_RELEASE_NAMES "sz;szip")
+ENDIF (WIN32)
+
+# Look for the library.
+FIND_LIBRARY (SZIP_LIBRARY_DEBUG
+    NAMES ${SZIP_SEARCH_DEBUG_NAMES}
+    PATHS ${SZIP_LIB_SEARCH_DIRS}
+    NO_DEFAULT_PATH
+)
+
+FIND_LIBRARY (SZIP_LIBRARY_RELEASE
+    NAMES ${SZIP_SEARCH_RELEASE_NAMES}
+    PATHS ${SZIP_LIB_SEARCH_DIRS}
+    NO_DEFAULT_PATH
+)
+
+SZIP_ADJUST_LIB_VARS (SZIP)
+
+IF (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+  SET (SZIP_FOUND 1)
+  SET (SZIP_LIBRARIES ${SZIP_LIBRARY})
+  SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
+  IF (SZIP_LIBRARY_DEBUG)
+    GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH)
+    SET (SZIP_LIB_DIR  ${SZIP_LIBRARY_PATH})
+  ELSEIF (SZIP_LIBRARY_RELEASE)
+    GET_FILENAME_COMPONENT (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH)
+    SET (SZIP_LIB_DIR  ${SZIP_LIBRARY_PATH})
+  ENDIF (SZIP_LIBRARY_DEBUG)
+
+ELSE (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+  SET (SZIP_FOUND 0)
+  SET (SZIP_LIBRARIES)
+  SET (SZIP_INCLUDE_DIRS)
+ENDIF (SZIP_INCLUDE_DIR AND SZIP_LIBRARY)
+
+# Report the results.
+IF (NOT SZIP_FOUND)
+  SET (SZIP_DIR_MESSAGE
+      "SZip was not found. Make sure SZIP_LIBRARY and SZIP_INCLUDE_DIR are set or set the SZIP_INSTALL environment variable."
+  )
+  IF (NOT SZIP_FIND_QUIETLY)
+    MESSAGE (STATUS "${SZIP_DIR_MESSAGE}")
+  ELSE (NOT SZIP_FIND_QUIETLY)
+    IF (SZIP_FIND_REQUIRED)
+      MESSAGE (FATAL_ERROR "SZip was NOT found and is Required by this project")
+    ENDIF (SZIP_FIND_REQUIRED)
+  ENDIF (NOT SZIP_FIND_QUIETLY)
+ENDIF (NOT SZIP_FOUND)
+
+IF (SZIP_FOUND)
+  INCLUDE (CheckSymbolExists)
+  #############################################
+  # Find out if SZIP was build using dll's
+  #############################################
+  # Save required variable
+  SET (CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
+  SET (CMAKE_REQUIRED_FLAGS_SAVE    ${CMAKE_REQUIRED_FLAGS})
+  # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
+  SET (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}")
+
+  CHECK_SYMBOL_EXISTS (SZIP_BUILT_AS_DYNAMIC_LIB "SZconfig.h" HAVE_SZIP_DLL)
+
+  IF (HAVE_SZIP_DLL STREQUAL "TRUE")
+    SET (HAVE_SZIP_DLL "1")
+  ENDIF (HAVE_SZIP_DLL STREQUAL "TRUE")
+
+  # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
+  SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
+  SET (CMAKE_REQUIRED_FLAGS    ${CMAKE_REQUIRED_FLAGS_SAVE})
+  #
+  #############################################
+ENDIF (SZIP_FOUND)
+
+IF (FIND_SZIP_DEBUG)
+  MESSAGE (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}")
+  MESSAGE (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}")
+  MESSAGE (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}")
+  MESSAGE (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}")
+  MESSAGE (STATUS "HAVE_SZIP_DLL: ${HAVE_SZIP_DLL}")
+  MESSAGE (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+ENDIF (FIND_SZIP_DEBUG)
diff --git a/config/cmake/HDF4Macros.cmake b/config/cmake/HDF4Macros.cmake
new file mode 100644
index 0000000..e9d25fd
--- /dev/null
+++ b/config/cmake/HDF4Macros.cmake
@@ -0,0 +1,32 @@
+#-------------------------------------------------------------------------------
+MACRO (H4_SET_LIB_OPTIONS libtarget libname libtype)
+  SET (LIB_OUT_NAME "${libname}")
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      SET (LIBHDF_VERSION ${HDF4_PACKAGE_VERSION_MAJOR})
+    ELSE (WIN32)
+      SET (LIBHDF_VERSION ${HDF4_PACKAGE_VERSION})
+    ENDIF (WIN32)
+    SET_TARGET_PROPERTIES (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION})
+#    IF (WIN32)
+#        SET (${LIB_OUT_NAME} "${LIB_OUT_NAME}-${HDF4_PACKAGE_SOVERSION}")
+#    ELSE (WIN32)
+#        SET_TARGET_PROPERTIES (${libtarget} PROPERTIES SOVERSION ${HDF4_PACKAGE_SOVERSION})
+#    ENDIF (WIN32)
+    SET_TARGET_PROPERTIES (${libtarget} PROPERTIES SOVERSION ${LIBHDF_VERSION})
+  ENDIF (${libtype} MATCHES "SHARED")
+  HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype})
+
+  #-- Apple Specific install_name for libraries
+  IF (APPLE)
+    OPTION (HDF4_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
+    IF (HDF4_BUILD_WITH_INSTALL_NAME)
+      SET_TARGET_PROPERTIES (${libtarget} PROPERTIES
+          LINK_FLAGS "-current_version ${HDF4_PACKAGE_VERSION} -compatibility_version ${HDF4_PACKAGE_VERSION}"
+          INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
+          BUILD_WITH_INSTALL_RPATH ${HDF4_BUILD_WITH_INSTALL_NAME}
+      )
+    ENDIF (HDF4_BUILD_WITH_INSTALL_NAME)
+  ENDIF (APPLE)
+
+ENDMACRO (H4_SET_LIB_OPTIONS)
diff --git a/config/cmake/HDF4UseFortran.cmake b/config/cmake/HDF4UseFortran.cmake
new file mode 100644
index 0000000..175447b
--- /dev/null
+++ b/config/cmake/HDF4UseFortran.cmake
@@ -0,0 +1,121 @@
+#
+# This file provides functions for Fortran support.
+#
+#-------------------------------------------------------------------------------
+ENABLE_LANGUAGE (Fortran)
+  
+#-----------------------------------------------------------------------------
+# Detect name mangling convention used between Fortran and C
+#-----------------------------------------------------------------------------
+INCLUDE (FortranCInterface)
+FortranCInterface_HEADER (
+    ${CMAKE_BINARY_DIR}/F77Mangle.h
+    MACRO_NAMESPACE "H4_F77_"
+    SYMBOL_NAMESPACE "H4_F77_"
+    SYMBOLS mysub mymod:my_sub
+)
+
+FILE (STRINGS ${CMAKE_BINARY_DIR}/F77Mangle.h CONTENTS REGEX "H4_F77_GLOBAL\\(.*,.*\\) +(.*)")
+STRING (REGEX MATCH "H4_F77_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
+SET (H4_F77_FUNC "H4_F77_FUNC(name,NAME) ${CMAKE_MATCH_1}")
+
+FILE (STRINGS ${CMAKE_BINARY_DIR}/F77Mangle.h CONTENTS REGEX "H4_F77_GLOBAL_\\(.*,.*\\) +(.*)")
+STRING (REGEX MATCH "H4_F77_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
+SET (H4_F77_FUNC_ "H4_F77_FUNC_(name,NAME) ${CMAKE_MATCH_1}")
+
+#-----------------------------------------------------------------------------
+# The provided CMake Fortran macros don't provide a general check function
+# so this one is used for a sizeof test.
+#-----------------------------------------------------------------------------
+MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
+  IF (NOT DEFINED ${VARIABLE})
+    MESSAGE (STATUS "Testing Fortran ${FUNCTION}")
+    IF (CMAKE_REQUIRED_LIBRARIES)
+      SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
+          "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+    ELSE (CMAKE_REQUIRED_LIBRARIES)
+      SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
+    ENDIF (CMAKE_REQUIRED_LIBRARIES)
+    FILE (WRITE
+        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+        "${CODE}"
+    )
+    TRY_COMPILE (${VARIABLE}
+        ${CMAKE_BINARY_DIR}
+        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+        CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
+        OUTPUT_VARIABLE OUTPUT
+    )
+
+#    MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+#    MESSAGE ( "Test result ${OUTPUT}")
+#    MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+
+    IF (${VARIABLE})
+      SET (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+      MESSAGE (STATUS "Testing Fortran ${FUNCTION} - OK")
+      FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+          "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n"
+          "${OUTPUT}\n\n"
+      )
+    ELSE (${VARIABLE})
+      MESSAGE (STATUS "Testing Fortran ${FUNCTION} - Fail")
+      SET (${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+      FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+          "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n"
+          "${OUTPUT}\n\n")
+    ENDIF (${VARIABLE})
+  ENDIF (NOT DEFINED ${VARIABLE})
+ENDMACRO (CHECK_FORTRAN_FEATURE)
+
+#-----------------------------------------------------------------------------
+# Configure Checks which require Fortran compilation must go in here
+# not in the main ConfigureChecks.cmake files, because if the user has
+# no Fortran compiler, problems arise.
+#
+# Be careful with leading spaces here, do not remove them.
+#-----------------------------------------------------------------------------
+CHECK_FORTRAN_FEATURE(sizeof
+  "
+       PROGRAM main
+       i = sizeof(x)
+       END PROGRAM
+  "
+  FORTRAN_HAVE_SIZEOF
+)
+
+CHECK_FORTRAN_FEATURE(RealIsNotDouble
+  "
+       MODULE type_mod
+         INTERFACE h4t
+           MODULE PROCEDURE h4t_real
+           MODULE PROCEDURE h4t_dble
+         END INTERFACE
+       CONTAINS
+         SUBROUTINE h4t_real(r)
+           REAL :: r
+         END SUBROUTINE h4t_real
+         SUBROUTINE h4t_dble(d)
+           DOUBLE PRECISION :: d
+         END SUBROUTINE h4t_dble
+       END MODULE type_mod
+       PROGRAM main
+         USE type_mod
+         REAL :: r
+         DOUBLE PRECISION :: d
+         CALL h4t(r)
+         CALL h4t(d)
+       END PROGRAM main
+  "
+  FORTRAN_DEFAULT_REAL_NOT_DOUBLE
+)
+
+#-----------------------------------------------------------------------------
+# Add debug information (intel Fortran : JB)
+#-----------------------------------------------------------------------------
+IF (CMAKE_Fortran_COMPILER MATCHES ifort)
+    IF (WIN32)
+        SET (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
+        SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
+    ENDIF (WIN32)
+ENDIF (CMAKE_Fortran_COMPILER MATCHES ifort)
diff --git a/config/cmake/HDF4_Examples.cmake.in b/config/cmake/HDF4_Examples.cmake.in
new file mode 100644
index 0000000..1c5d469
--- /dev/null
+++ b/config/cmake/HDF4_Examples.cmake.in
@@ -0,0 +1,118 @@
+cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+###############################################################################################################
+# This script will build and run the examples from a compressed file
+# Execute from a command line:
+#     ctest -S HDF4_Examples.cmake,HDF4Examples-0.1.1-Source -C Release -O test.log
+###############################################################################################################
+
+set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@/HDF_Group/@HDF4_PACKAGE_NAME@/@HDF4_PACKAGE_VERSION@")
+set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+set(STATICLIBRARIES "@H4_ENABLE_STATIC_LIB@")
+set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG})
+set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
+set(CTEST_BUILD_CONFIGURATION "Release")
+#set(NO_MAC_FORTRAN "true")
+set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF")
+
+###############################################################################################################
+#     Adjust the following SET Commands as needed
+###############################################################################################################
+if(WIN32)
+  if(STATICLIBRARIES)
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DUSE_SHARED_LIBS:BOOL=OFF")
+  endif(STATICLIBRARIES)
+  set(ENV{HDF4_DIR} "${INSTALLDIR}/cmake/hdf4")
+  set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build)
+  set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}")
+  set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}")
+else(WIN32)
+  if(STATICLIBRARIES)
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DUSE_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
+  endif(STATICLIBRARIES)
+  set(ENV{HDF4_DIR} "${INSTALLDIR}/share/cmake/hdf4")
+  set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib")
+  set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build)
+  set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
+  set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
+endif(WIN32)
+
+###############################################################################################################
+# For any comments please contact cdashhelp at hdfgroup.org
+#
+###############################################################################################################
+ 
+#-----------------------------------------------------------------------------
+# MAC machines need special option
+#-----------------------------------------------------------------------------
+if(APPLE)
+  # Compiler choice
+  execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
+  set(ENV{CC} "${XCODE_CC}")
+  set(ENV{CXX} "${XCODE_CXX}")
+  if(NOT NO_MAC_FORTRAN)
+    # Shared fortran is not supported, build static 
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
+  else(NOT NO_MAC_FORTRAN)
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF4_BUILD_FORTRAN:BOOL=OFF")
+  endif(NOT NO_MAC_FORTRAN)
+  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
+endif(APPLE)
+ 
+#-----------------------------------------------------------------------------
+set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
+## Uncompress source in tar file provided
+## --------------------------
+if(WIN32)
+  set(CTEST_7Z_COMMAND "C:/Program Files/7-Zip/7z.exe")
+  message("extracting... [${CTEST_7Z_COMMAND} x ${CTEST_SOURCE_NAME}.zip]")
+  execute_process(COMMAND ${CTEST_7Z_COMMAND} x ${CTEST_SOURCE_NAME}.zip RESULT_VARIABLE rv)
+else(WIN32)
+  message("extracting... [${CTEST_CMAKE_COMMAND} -E tar -xvf ${CTEST_SOURCE_NAME}.tar.gz]")
+  execute_process(COMMAND tar -xvf ${CTEST_SOURCE_NAME}.tar.gz RESULT_VARIABLE rv)
+endif(WIN32)
+ 
+if(NOT rv EQUAL 0)
+  message("extracting... [error-(${rv}) clean up]")
+  file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
+  message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed")
+endif(NOT rv EQUAL 0)
+ 
+#-----------------------------------------------------------------------------
+## Clear the build directory
+## --------------------------
+set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
+file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
+ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+
+# Use multiple CPU cores to build
+include(ProcessorCount)
+ProcessorCount(N)
+if(NOT N EQUAL 0)
+  if(NOT WIN32)
+    set(CTEST_BUILD_FLAGS -j${N})
+  endif(NOT WIN32)
+  set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
+endif()
+set (CTEST_CONFIGURE_COMMAND
+    "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+)
+ 
+#-----------------------------------------------------------------------------
+## -- set output to english
+set($ENV{LC_MESSAGES}  "en_EN")
+ 
+#-----------------------------------------------------------------------------
+  ## NORMAL process
+  ## --------------------------
+  CTEST_START (Experimental)
+  CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}")
+  CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}")
+  CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
+  CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
+  if(res GREATER 0)
+    message (FATAL_ERROR "tests FAILED")
+  endif(res GREATER 0)
+#-----------------------------------------------------------------------------
+############################################################################################################## 
+message("DONE")
\ No newline at end of file
diff --git a/config/cmake/HDFLibMacros.cmake b/config/cmake/HDFLibMacros.cmake
new file mode 100644
index 0000000..57e6be7
--- /dev/null
+++ b/config/cmake/HDFLibMacros.cmake
@@ -0,0 +1,350 @@
+#-------------------------------------------------------------------------------
+MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic)
+  # May need to build JPEG with PIC on x64 machines with gcc
+  # Need to use CMAKE_ANSI_CFLAGS define so that compiler test works
+
+  IF (${compress_type} MATCHES "SVN")
+    EXTERNALPROJECT_ADD (JPEG
+        SVN_REPOSITORY ${JPEG_URL}
+        # [SVN_REVISION rev] 
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
+    ) 
+  ELSEIF (${compress_type} MATCHES "TGZ")
+    EXTERNALPROJECT_ADD (JPEG
+        URL ${JPEG_URL}
+        URL_MD5 ""
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
+    ) 
+  ENDIF (${compress_type} MATCHES "SVN")
+  EXTERNALPROJECT_GET_PROPERTY (JPEG BINARY_DIR SOURCE_DIR) 
+
+  IF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+    IF (WIN32)
+      SET (JPEG_LIB_NAME "jpeg_D")
+    ELSE (WIN32)
+      SET (JPEG_LIB_NAME "jpeg_debug")
+    ENDIF (WIN32)
+  ELSE (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+    SET (JPEG_LIB_NAME "jpeg")
+  ENDIF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+
+  # Create imported target szip
+  ADD_LIBRARY(jpeg ${libtype} IMPORTED)
+  ADD_DEPENDENCIES (jpeg JPEG)
+
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      IF (MINGW)
+        SET_TARGET_PROPERTIES(jpeg PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${JPEG_LIB_NAME}.lib"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ELSE (MINGW)
+        SET_TARGET_PROPERTIES(jpeg PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ENDIF (MINGW)
+    ELSE (WIN32)
+      IF (CYGWIN)
+        SET_TARGET_PROPERTIES(jpeg PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ELSE (CYGWIN)
+        SET_TARGET_PROPERTIES(jpeg PROPERTIES
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}${JPEG_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${JPEG_VERSION_STRING}"
+            SOVERSION "${JPEG_VERSION_STRING}"
+        )
+      ENDIF (CYGWIN)
+    ENDIF (WIN32)
+  ELSE (${libtype} MATCHES "SHARED")
+    IF (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(jpeg PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/lib${JPEG_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ELSE (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(jpeg PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${JPEG_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ENDIF (WIN32 AND NOT MINGW)
+  ENDIF (${libtype} MATCHES "SHARED")
+
+#  INCLUDE (${BINARY_DIR}/JPEG-targets.cmake)  
+  SET (JPEG_LIBRARY "jpeg")
+  
+  SET (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}")
+  SET (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src")
+  SET (JPEG_FOUND 1)
+  SET (JPEG_LIBRARIES ${JPEG_LIBRARY})
+  SET (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR})
+ENDMACRO (EXTERNAL_JPEG_LIBRARY)
+
+#-------------------------------------------------------------------------------
+MACRO (PACKAGE_JPEG_LIBRARY compress_type)
+  ADD_CUSTOM_TARGET (JPEG-GenHeader-Copy ALL
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JPEG_INCLUDE_DIR_GEN}/jconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
+      COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
+  )
+  SET (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h)
+  IF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+    ADD_DEPENDENCIES (JPEG-GenHeader-Copy JPEG)
+  ENDIF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ENDMACRO (PACKAGE_JPEG_LIBRARY)
+
+#-------------------------------------------------------------------------------
+MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding)
+  IF (${compress_type} MATCHES "SVN")
+    EXTERNALPROJECT_ADD (SZIP
+        SVN_REPOSITORY ${SZIP_URL}
+        # [SVN_REVISION rev] 
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+            -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
+    ) 
+  ELSEIF (${compress_type} MATCHES "TGZ")
+    EXTERNALPROJECT_ADD (SZIP
+        URL ${SZIP_URL}
+        URL_MD5 ""
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+            -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
+    ) 
+  ENDIF (${compress_type} MATCHES "SVN")
+  EXTERNALPROJECT_GET_PROPERTY (SZIP BINARY_DIR SOURCE_DIR) 
+
+  IF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+    IF (WIN32)
+      SET (SZIP_LIB_NAME "szip_D")
+    ELSE (WIN32)
+      SET (SZIP_LIB_NAME "szip_debug")
+    ENDIF (WIN32)
+  ELSE (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+    SET (SZIP_LIB_NAME "szip")
+  ENDIF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+
+  # Create imported target szip
+  ADD_LIBRARY(szip ${libtype} IMPORTED)
+  ADD_DEPENDENCIES (szip SZIP)
+
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      IF (MINGW)
+        SET_TARGET_PROPERTIES(szip PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${SZIP_LIB_NAME}.lib"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ELSE (MINGW)
+        SET_TARGET_PROPERTIES(szip PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ENDIF (MINGW)
+    ELSE (WIN32)
+      IF (CYGWIN)
+        SET_TARGET_PROPERTIES(szip PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ELSE (CYGWIN)
+        SET_TARGET_PROPERTIES(szip PROPERTIES
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            IMPORTED_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}${SZIP_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${SZIP_VERSION_STRING}"
+            SOVERSION "${SZIP_VERSION_STRING}"
+        )
+      ENDIF (CYGWIN)
+    ENDIF (WIN32)
+  ELSE (${libtype} MATCHES "SHARED")
+    IF (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(szip PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/lib${SZIP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ELSE (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(szip PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${SZIP_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ENDIF (WIN32 AND NOT MINGW)
+  ENDIF (${libtype} MATCHES "SHARED")
+
+#  INCLUDE (${BINARY_DIR}/SZIP-targets.cmake)  
+  SET (SZIP_LIBRARY "szip")
+
+  SET (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}")
+  SET (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src")
+  SET (SZIP_FOUND 1)
+  SET (SZIP_LIBRARIES ${SZIP_LIBRARY})
+  SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR})
+ENDMACRO (EXTERNAL_SZIP_LIBRARY)
+
+#-------------------------------------------------------------------------------
+MACRO (PACKAGE_SZIP_LIBRARY compress_type)
+  ADD_CUSTOM_TARGET (SZIP-GenHeader-Copy ALL
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
+      COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
+  )
+  SET (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h)
+  IF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+    ADD_DEPENDENCIES (SZIP-GenHeader-Copy SZIP)
+  ENDIF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ENDMACRO (PACKAGE_SZIP_LIBRARY)
+
+#-------------------------------------------------------------------------------
+MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype)
+  IF (${compress_type} MATCHES "SVN")
+    EXTERNALPROJECT_ADD (ZLIB
+        SVN_REPOSITORY ${ZLIB_URL}
+        # [SVN_REVISION rev] 
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+    ) 
+  ELSEIF (${compress_type} MATCHES "TGZ")
+    EXTERNALPROJECT_ADD (ZLIB
+        URL ${ZLIB_URL}
+        URL_MD5 ""
+        INSTALL_COMMAND ""
+        CMAKE_ARGS
+            -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
+            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
+            -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+            -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
+            -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+            -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+            -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
+            -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
+    ) 
+  ENDIF (${compress_type} MATCHES "SVN")
+  EXTERNALPROJECT_GET_PROPERTY (ZLIB BINARY_DIR SOURCE_DIR) 
+
+  IF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+    IF (WIN32)
+      SET (ZLIB_LIB_NAME "zlib_D")
+    ELSE (WIN32)
+      SET (ZLIB_LIB_NAME "z_debug")
+    ENDIF (WIN32)
+  ELSE (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+    IF (WIN32)
+      SET (ZLIB_LIB_NAME "zlib")
+    ELSE (WIN32)
+      SET (ZLIB_LIB_NAME "z")
+    ENDIF (WIN32)
+  ENDIF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+
+  # Create imported target szip
+  ADD_LIBRARY(zlib ${libtype} IMPORTED)
+  ADD_DEPENDENCIES (zlib ZLIB)
+  
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      IF (MINGW)
+        SET_TARGET_PROPERTIES(zlib PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${ZLIB_LIB_NAME}.lib"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ELSE (MINGW)
+        SET_TARGET_PROPERTIES(zlib PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ENDIF (MINGW)
+    ELSE (WIN32)
+      IF (CYGWIN)
+        SET_TARGET_PROPERTIES(zlib PROPERTIES
+            IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+        )
+      ELSE (CYGWIN)
+        SET_TARGET_PROPERTIES(zlib PROPERTIES
+            IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            IMPORTED_SONAME "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}${ZLIB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}.${ZLIB_VERSION_STRING}"
+            SOVERSION "${ZLIB_VERSION_STRING}"
+        )
+      ENDIF (CYGWIN)
+    ENDIF (WIN32)
+  ELSE (${libtype} MATCHES "SHARED")
+    IF (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(zlib PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/lib${ZLIB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ELSE (WIN32 AND NOT MINGW)
+      SET_TARGET_PROPERTIES(zlib PROPERTIES
+          IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${ZLIB_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+          IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+      )
+    ENDIF (WIN32 AND NOT MINGW)
+  ENDIF (${libtype} MATCHES "SHARED")
+
+#  INCLUDE (${BINARY_DIR}/ZLIB-targets.cmake)  
+  SET (ZLIB_LIBRARY "zlib")
+  
+  SET (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}")
+  SET (ZLIB_INCLUDE_DIR "${SOURCE_DIR}")
+  SET (ZLIB_FOUND 1)
+  SET (ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+  SET (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR})
+ENDMACRO (EXTERNAL_ZLIB_LIBRARY)
+
+#-------------------------------------------------------------------------------
+MACRO (PACKAGE_ZLIB_LIBRARY compress_type)
+  ADD_CUSTOM_TARGET (ZLIB-GenHeader-Copy ALL
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
+      COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
+  )
+  SET (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h)
+  IF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+    ADD_DEPENDENCIES (ZLIB-GenHeader-Copy ZLIB)
+  ENDIF (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
+ENDMACRO (PACKAGE_ZLIB_LIBRARY)
diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake
new file mode 100644
index 0000000..b0788f2
--- /dev/null
+++ b/config/cmake/HDFMacros.cmake
@@ -0,0 +1,187 @@
+#-------------------------------------------------------------------------------
+MACRO (SET_GLOBAL_VARIABLE name value)
+  SET (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE)
+ENDMACRO (SET_GLOBAL_VARIABLE)
+
+#-------------------------------------------------------------------------------
+MACRO (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+  #set(source_group_path "Source/AIM/${NAME}")
+  STRING (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH})
+  source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
+
+  #-- The following is needed if we ever start to use OS X Frameworks but only
+  #--  works on CMake 2.6 and greater
+  #SET_PROPERTY (SOURCE ${HEADERS}
+  #       PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
+  #)
+ENDMACRO (IDE_GENERATED_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+  #  INSTALL (FILES ${HEADERS}
+  #       DESTINATION include/R3D/${NAME}
+  #       COMPONENT Headers       
+  #  )
+
+  STRING (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}  )
+  source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
+
+  #-- The following is needed if we ever start to use OS X Frameworks but only
+  #--  works on CMake 2.6 and greater
+  #SET_PROPERTY (SOURCE ${HEADERS}
+  #       PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
+  #)
+ENDMACRO (IDE_SOURCE_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (TARGET_NAMING libtarget libtype)
+  IF (WIN32)
+    IF (${libtype} MATCHES "SHARED")
+      SET_TARGET_PROPERTIES (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}dll")
+    ENDIF (${libtype} MATCHES "SHARED")
+  ENDIF (WIN32)
+ENDMACRO (TARGET_NAMING)
+
+#-------------------------------------------------------------------------------
+MACRO (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent)
+  IF (WIN32 AND MSVC)
+    GET_TARGET_PROPERTY (target_name ${libtarget} RELWITHDEBINFO_OUTPUT_NAME)
+    INSTALL (
+      FILES
+          ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${target_name}.pdb
+      DESTINATION
+          ${targetdestination}
+      CONFIGURATIONS RelWithDebInfo
+      COMPONENT ${targetcomponent}
+  )
+  ENDIF (WIN32 AND MSVC)
+ENDMACRO (INSTALL_TARGET_PDB)
+
+#-------------------------------------------------------------------------------
+MACRO (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent)
+  IF (WIN32 AND MSVC)
+    GET_TARGET_PROPERTY (target_name ${progtarget} RELWITHDEBINFO_OUTPUT_NAME)
+    GET_TARGET_PROPERTY (target_prefix ${progtarget} PREFIX)
+    INSTALL (
+      FILES
+          ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${target_prefix}${target_name}.pdb
+      DESTINATION
+          ${targetdestination}
+      CONFIGURATIONS RelWithDebInfo
+      COMPONENT ${targetcomponent}
+  )
+  ENDIF (WIN32 AND MSVC)
+ENDMACRO (INSTALL_PROGRAM_PDB)
+
+#-------------------------------------------------------------------------------
+MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
+  # message (STATUS "${libname} libtype: ${libtype}")
+  IF (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      SET (LIB_RELEASE_NAME "${libname}")
+      SET (LIB_DEBUG_NAME "${libname}_D")
+    ELSE (WIN32)
+      SET (LIB_RELEASE_NAME "${libname}")
+      SET (LIB_DEBUG_NAME "${libname}_debug")
+    ENDIF (WIN32)
+  ELSE (${libtype} MATCHES "SHARED")
+    IF (WIN32)
+      SET (LIB_RELEASE_NAME "lib${libname}")
+      SET (LIB_DEBUG_NAME "lib${libname}_D")
+    ELSE (WIN32)
+      # if the generator supports configuration types or if the CMAKE_BUILD_TYPE has a value
+      IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        SET (LIB_RELEASE_NAME "${libname}")
+        SET (LIB_DEBUG_NAME "${libname}_debug")
+      ELSE (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        SET (LIB_RELEASE_NAME "lib${libname}")
+        SET (LIB_DEBUG_NAME "lib${libname}_debug")
+      ENDIF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+    ENDIF (WIN32)
+  ENDIF (${libtype} MATCHES "SHARED")
+  
+  SET_TARGET_PROPERTIES (${libtarget}
+      PROPERTIES
+      DEBUG_OUTPUT_NAME          ${LIB_DEBUG_NAME}
+      RELEASE_OUTPUT_NAME        ${LIB_RELEASE_NAME}
+      MINSIZEREL_OUTPUT_NAME     ${LIB_RELEASE_NAME}
+      RELWITHDEBINFO_OUTPUT_NAME ${LIB_RELEASE_NAME}
+  )
+  
+  #----- Use MSVC Naming conventions for Shared Libraries
+  IF (MINGW AND ${libtype} MATCHES "SHARED")
+    SET_TARGET_PROPERTIES (${libtarget}
+        PROPERTIES
+        IMPORT_SUFFIX ".lib"
+        IMPORT_PREFIX ""
+        PREFIX ""
+    )
+  ENDIF (MINGW AND ${libtype} MATCHES "SHARED")
+
+ENDMACRO (HDF_SET_LIB_OPTIONS)
+
+#-------------------------------------------------------------------------------
+MACRO (TARGET_C_PROPERTIES wintarget addcompileflags addlinkflags)
+  IF (MSVC)
+    TARGET_MSVC_PROPERTIES (${wintarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
+  ELSE (MSVC)
+    IF (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${wintarget}
+          PROPERTIES
+              COMPILE_FLAGS "${addcompileflags}"
+              LINK_FLAGS "${addlinkflags}"
+      ) 
+    ELSE (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${wintarget}
+          PROPERTIES
+              COMPILE_FLAGS "${addcompileflags}"
+              LINK_FLAGS "${addlinkflags}"
+      ) 
+    ENDIF (BUILD_SHARED_LIBS)
+  ENDIF (MSVC)
+ENDMACRO (TARGET_C_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (TARGET_MSVC_PROPERTIES wintarget addcompileflags addlinkflags)
+  IF (MSVC)
+    IF (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${wintarget}
+          PROPERTIES
+              COMPILE_FLAGS "${addcompileflags}"
+              LINK_FLAGS "${addlinkflags}"
+      ) 
+    ELSE (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${wintarget}
+          PROPERTIES
+              COMPILE_FLAGS "${addcompileflags}"
+              LINK_FLAGS "${addlinkflags}"
+      ) 
+    ENDIF (BUILD_SHARED_LIBS)
+  ENDIF (MSVC)
+ENDMACRO (TARGET_MSVC_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (TARGET_FORTRAN_PROPERTIES forttarget addcompileflags addlinkflags)
+  IF (WIN32)
+    TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
+  ENDIF (WIN32)
+ENDMACRO (TARGET_FORTRAN_PROPERTIES)
+
+#-------------------------------------------------------------------------------
+MACRO (TARGET_FORTRAN_WIN_PROPERTIES forttarget addcompileflags addlinkflags)
+  IF (MSVC)
+    IF (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${forttarget}
+          PROPERTIES
+              COMPILE_FLAGS "/dll ${addcompileflags}"
+              LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
+      ) 
+    ELSE (BUILD_SHARED_LIBS)
+      SET_TARGET_PROPERTIES (${forttarget}
+          PROPERTIES
+              COMPILE_FLAGS "${addcompileflags}"
+              LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
+      ) 
+    ENDIF (BUILD_SHARED_LIBS)
+  ENDIF (MSVC)
+ENDMACRO (TARGET_FORTRAN_WIN_PROPERTIES)
diff --git a/config/cmake/HDFTests.c b/config/cmake/HDFTests.c
new file mode 100644
index 0000000..2f69ec8
--- /dev/null
+++ b/config/cmake/HDFTests.c
@@ -0,0 +1,490 @@
+#define SIMPLE_TEST(x) int main(){ x; return 0; }
+
+#ifdef HAVE_C99_DESIGNATED_INITIALIZER
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+extern "C"
+#  endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+  typedef struct
+  {
+    int x;
+    union
+    {
+      int i;
+      double d;
+    }u;
+  }di_struct_t;
+  di_struct_t x =
+  { 0,
+    { .d = 0.0}};
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef HAVE_C99_FUNC
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+ const char *fname = __func__;
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef VSNPRINTF_WORKS
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int test_vsnprintf(const char *fmt,...)
+{
+    va_list     ap;
+    char *s = malloc(16);
+    int ret;
+
+    va_start(ap, fmt);
+    ret=vsnprintf(s,16,"%s",ap);
+    va_end(ap);
+
+    return(ret!=42 ? 1 : 0);
+}
+
+int main(void)
+{
+    return(test_vsnprintf("%s","A string that is longer than 16 characters"));
+}
+#endif
+
+
+#ifdef TIME_WITH_SYS_TIME
+/* Time with sys/time test */
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+int main() { return 0; }
+#endif /* STDC_HEADERS */
+
+#ifdef HAVE_TM_ZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_zone);
+
+#endif /* HAVE_TM_ZONE */
+
+#ifdef HAVE_STRUCT_TM_TM_ZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_zone);
+
+#endif /* HAVE_STRUCT_TM_TM_ZONE */
+
+#ifdef HAVE_ATTRIBUTE
+
+#if 0
+static void test int __attribute((unused)) var)
+{
+  int __attribute__((unused)) x = var;
+}
+
+int main(void)
+{
+  test(19);
+}
+
+#else
+int
+main ()
+{
+int __attribute__((unused)) x
+  ;
+  return 0;
+}
+#endif
+
+
+#endif /* HAVE_ATTRIBUTE */
+
+#ifdef HAVE_FUNCTION
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+(void)__FUNCTION__
+  ;
+  return 0;
+}
+
+#endif /* HAVE_FUNCTION */
+
+#ifdef HAVE_TM_GMTOFF
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+#ifdef HAVE___TM_GMTOFF
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+#ifdef HAVE_TIMEZONE
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(timezone=0);
+
+#endif /* HAVE_TIMEZONE */
+
+#ifdef HAVE_STRUCT_TIMEZONE
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+SIMPLE_TEST(struct timezone tz; tz.tz_minuteswest=0);
+
+#endif /* HAVE_STRUCT_TIMEZONE */
+
+#ifdef HAVE_STAT_ST_BLOCKS
+
+#include <sys/stat.h>
+SIMPLE_TEST(struct stat sb; sb.st_blocks=0);
+
+#endif /* HAVE_STAT_ST_BLOCKS */
+
+#ifdef PRINTF_LL_WIDTH
+
+#ifdef HAVE_LONG_LONG
+#  define LL_TYPE long long
+#else /* HAVE_LONG_LONG */
+#  define LL_TYPE __int64
+#endif /* HAVE_LONG_LONG */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(void)
+{
+  char *llwidthArgs[] = { "l64", "l", "L", "q", "ll", NULL };
+  char *s = malloc(128);
+  char **currentArg = NULL;
+  LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576;
+  for (currentArg = llwidthArgs; *currentArg != NULL; currentArg++)
+    {
+    char formatString[64];
+    sprintf(formatString, "%%%sd", *currentArg);
+    sprintf(s, formatString, x);
+    if (strcmp(s, "1099511627776") == 0)
+      {
+      printf("PRINTF_LL_WIDTH=[%s]\n", *currentArg);
+      return 0;
+      }
+    }
+  return 1;
+}
+
+#endif /* PRINTF_LL_WIDTH */
+
+#ifdef SYSTEM_SCOPE_THREADS
+#include <stdlib.h>
+#include <pthread.h>
+
+int main(void)
+{
+    pthread_attr_t attribute;
+    int ret;
+
+    pthread_attr_init(&attribute);
+    ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
+    if (ret==0)
+        return 0;
+    return 1;
+}
+
+#endif /* SYSTEM_SCOPE_THREADS */
+
+#ifdef HAVE_SOCKLEN_T
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+SIMPLE_TEST(socklen_t foo);
+
+#endif /* HAVE_SOCKLEN_T */
+
+#ifdef DEV_T_IS_SCALAR
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+int main ()
+{
+  dev_t d1, d2;
+  if(d1==d2)
+    return 0;
+  return 1;
+}
+
+#endif /* DEV_T_IS_SCALAR */
+
+#ifdef HAVE_OFF64_T
+#include <sys/types.h>
+int main()
+{
+  off64_t n = 0;
+  return (int)n;
+}
+#endif
+
+#ifdef HAVE_STAT64_STRUCT
+#include <sys/types.h>
+#include <sys/stat.h>],
+struct stat64 sb;
+int main()
+{
+  return 0;
+}
+#endif
+
+#ifdef TEST_DIRECT_VFD_WORKS
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+int main(void)
+{
+   int fid;
+   if((fid=open("tst_file", O_CREAT | O_TRUNC | O_DIRECT, 0755))<0)
+       return 1;
+   close(fid);
+   remove("tst_file");
+   return 0;
+}
+#endif
+
+#ifdef HAVE_DIRECT
+       SIMPLE_TEST(posix_memalign());
+#endif
+
+#ifdef TEST_LFS_WORKS
+/* Return 0 when LFS is available and 1 otherwise.  */
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#define _LARGE_FILES
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+  /* check that off_t can hold 2^63 - 1 and perform basic operations... */
+#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  if (OFF_T_64 % 2147483647 != 1)
+    return 1;
+
+  /* stat breaks on SCO OpenServer */
+  struct stat buf;
+  stat( argv[0], &buf );
+  if (!S_ISREG(buf.st_mode))
+    return 2;
+
+  FILE *file = fopen( argv[0], "r" );
+  off_t offset = ftello( file );
+  fseek( file, offset, SEEK_CUR );
+  fclose( file );
+  return 0;
+}
+#endif
+
+#ifdef GETTIMEOFDAY_GIVES_TZ
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#include <time.h>
+int main(void)
+{
+ struct timeval tv;
+ struct timezone tz;
+ tz.tz_minuteswest = 7777;  /* Initialize to an unreasonable number */
+ tz.tz_dsttime = 7;
+ gettimeofday(&tv, &tz);
+    /* Check whether the function returned any value at all */
+ if(tz.tz_minuteswest == 7777 && tz.tz_dsttime == 7)
+     return 1;
+ else return 0;
+}
+#endif
+
+#ifdef LONE_COLON
+int main(int argc, char * argv) 
+{
+  return 0;
+}
+#endif
+
+#ifdef CXX_HAVE_OFFSETOF
+
+#include <stdio.h>
+#include <stddef.h>
+
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+extern "C"
+#  endif
+int FC_DUMMY_MAIN()
+{ return 1;}
+#endif
+#endif
+int
+main ()
+{
+
+  struct index_st
+  {
+    unsigned char type;
+    unsigned char num;
+    unsigned int len;
+  };
+  typedef struct index_st index_t;
+  int x,y;
+  x = offsetof(struct index_st, len);
+  y = offsetof(index_t, num)
+
+  ;
+  return 0;
+}
+
+#endif
+
+#ifdef HAVE_GPFS
+
+#include <gpfs.h>
+int main ()
+{
+    int fd = 0; 
+    gpfs_fcntl(fd, (void *)0);
+}
+
+#endif /* HAVE_GPFS */
+
+#ifdef HAVE_IOEO
+
+#include <windows.h>
+typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
+int main ()
+{
+	PGNSI pGNSI;
+	pGNSI = (PGNSI) GetProcAddress(
+      GetModuleHandle(TEXT("kernel32.dll")), 
+      "InitOnceExecuteOnce");
+	if(NULL == pGNSI)
+		return 1;
+	else
+		return 0;
+}
+
+#endif /* HAVE_IOEO */
+
+#ifdef HAVE_STRUCT_VIDEOCONFIG
+
+SIMPLE_TEST(struct videoconfig w; w.numtextcols=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+#ifdef HAVE_STRUCT_TEXT_INFO
+
+SIMPLE_TEST(struct text_info w; w.screenwidth=0);
+
+#endif /* HAVE_TM_GMTOFF */
+
+
+#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline )
+#ifndef __cplusplus
+typedef int foo_t;
+static INLINE_TEST_INLINE foo_t static_foo () { return 0; }
+INLINE_TEST_INLINE foo_t foo () {return 0; }
+int main() { return 0; }
+#endif
+
+#endif /* INLINE_TEST */
diff --git a/config/cmake/NSIS.InstallOptions.ini.in b/config/cmake/NSIS.InstallOptions.ini.in
new file mode 100644
index 0000000..83ca053
--- /dev/null
+++ b/config/cmake/NSIS.InstallOptions.ini.in
@@ -0,0 +1,37 @@
+[Settings]
+NumFields=5
+
+[Field 1]
+Type=label
+Text=By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does add its directory to the system PATH.
+Left=0
+Right=-1
+Top=0
+Bottom=20
+
+[Field 2]
+Type=radiobutton
+Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH
+Left=0
+Right=-1
+Top=30
+Bottom=40
+State=0
+
+[Field 3]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users
+Left=0
+Right=-1
+Top=40
+Bottom=50
+State=1
+
+[Field 4]
+Type=radiobutton
+Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user
+Left=0
+Right=-1
+Top=50
+Bottom=60
+State=0
diff --git a/config/cmake/NSIS.template.in b/config/cmake/NSIS.template.in
new file mode 100644
index 0000000..ecced05
--- /dev/null
+++ b/config/cmake/NSIS.template.in
@@ -0,0 +1,974 @@
+; CPack install script designed for a nmake build
+
+;--------------------------------
+; You must define these values
+
+  !define VERSION "@CPACK_PACKAGE_VERSION@"
+  !define PATCH  "@CPACK_PACKAGE_VERSION_PATCH@"
+  !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
+
+;--------------------------------
+;Variables
+
+  Var MUI_TEMP
+  Var STARTMENU_FOLDER
+  Var SV_ALLUSERS
+  Var START_MENU
+  Var DO_NOT_ADD_TO_PATH
+  Var ADD_TO_PATH_ALL_USERS
+  Var ADD_TO_PATH_CURRENT_USER
+  Var INSTALL_DESKTOP
+  Var IS_DEFAULT_INSTALLDIR
+;--------------------------------
+;Include Modern UI
+
+  !include "MUI.nsh"
+
+  ;Default installation folder
+  InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+;--------------------------------
+;General
+
+  ;Name and file
+  Name "@CPACK_NSIS_PACKAGE_NAME@"
+  OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
+
+  ;Set compression
+  SetCompressor @CPACK_NSIS_COMPRESSOR@
+
+ at CPACK_NSIS_DEFINES@
+
+  !include Sections.nsh
+
+;--- Component support macros: ---
+; The code for the add/remove functionality is from:
+;   http://nsis.sourceforge.net/Add/Remove_Functionality
+; It has been modified slightly and extended to provide
+; inter-component dependencies.
+Var AR_SecFlags
+Var AR_RegFlags
+ at CPACK_NSIS_SECTION_SELECTED_VARS@
+
+; Loads the "selected" flag for the section named SecName into the
+; variable VarName.
+!macro LoadSectionSelectedIntoVar SecName VarName
+ SectionGetFlags ${${SecName}} $${VarName}
+ IntOp $${VarName} $${VarName} & ${SF_SELECTED}  ;Turn off all other bits
+!macroend
+
+; Loads the value of a variable... can we get around this?
+!macro LoadVar VarName
+  IntOp $R0 0 + $${VarName}
+!macroend
+
+; Sets the value of a variable
+!macro StoreVar VarName IntValue
+  IntOp $${VarName} 0 + ${IntValue}
+!macroend
+
+!macro InitSection SecName
+  ;  This macro reads component installed flag from the registry and
+  ;changes checked state of the section on the components page.
+  ;Input: section index constant name specified in Section command.
+
+  ClearErrors
+  ;Reading component status from registry
+  ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
+  IfErrors "default_${SecName}"
+    ;Status will stay default if registry value not found
+    ;(component was never installed)
+  IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
+  SectionGetFlags ${${SecName}} $AR_SecFlags  ;Reading default section flags
+  IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE  ;Turn lowest (enabled) bit off
+  IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags      ;Change lowest bit
+
+  ; Note whether this component was installed before
+  !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
+  IntOp $R0 $AR_RegFlags & $AR_RegFlags
+
+  ;Writing modified flags
+  SectionSetFlags ${${SecName}} $AR_SecFlags
+
+ "default_${SecName}:"
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+!macroend
+
+!macro FinishSection SecName
+  ;  This macro reads section flag set by user and removes the section
+  ;if it is not selected.
+  ;Then it writes component installed flag to registry
+  ;Input: section index constant name specified in Section command.
+
+  SectionGetFlags ${${SecName}} $AR_SecFlags  ;Reading section flags
+  ;Checking lowest bit:
+  IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
+  IntCmp $AR_SecFlags 1 "leave_${SecName}"
+    ;Section is not selected:
+    ;Calling Section uninstall macro and writing zero installed flag
+    !insertmacro "Remove_${${SecName}}"
+    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
+  "Installed" 0
+    Goto "exit_${SecName}"
+
+ "leave_${SecName}:"
+    ;Section is selected:
+    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
+  "Installed" 1
+
+ "exit_${SecName}:"
+!macroend
+
+!macro RemoveSection_CPack SecName
+  ;  This macro is used to call section's Remove_... macro
+  ;from the uninstaller.
+  ;Input: section index constant name specified in Section command.
+
+  !insertmacro "Remove_${${SecName}}"
+!macroend
+
+; Determine whether the selection of SecName changed
+!macro MaybeSelectionChanged SecName
+  !insertmacro LoadVar ${SecName}_selected
+  SectionGetFlags ${${SecName}} $R1
+  IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
+
+  ; See if the status has changed:
+  IntCmp $R0 $R1 "${SecName}_unchanged"
+  !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
+
+  IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
+  !insertmacro "Deselect_required_by_${SecName}"
+  goto "${SecName}_unchanged"
+
+  "${SecName}_was_selected:"
+  !insertmacro "Select_${SecName}_depends"
+
+  "${SecName}_unchanged:"
+!macroend
+;--- End of Add/Remove macros ---
+
+;--------------------------------
+;Interface Settings
+
+  !define MUI_HEADERIMAGE
+  !define MUI_ABORTWARNING
+
+;--------------------------------
+; path functions
+
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+
+;----------------------------------------
+; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
+;----------------------------------------
+!verbose 3
+!include "WinMessages.NSH"
+!verbose 4
+;====================================================
+; get_NT_environment
+;     Returns: the selected environment
+;     Output : head of the stack
+;====================================================
+!macro select_NT_profile UN
+Function ${UN}select_NT_profile
+   StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
+      DetailPrint "Selected environment for all users"
+      Push "all"
+      Return
+   environment_single:
+      DetailPrint "Selected environment for current user only."
+      Push "current"
+      Return
+FunctionEnd
+!macroend
+!insertmacro select_NT_profile ""
+!insertmacro select_NT_profile "un."
+;----------------------------------------------------
+!define NT_current_env 'HKCU "Environment"'
+!define NT_all_env     'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+
+!ifndef WriteEnvStr_RegKey
+  !ifdef ALL_USERS
+    !define WriteEnvStr_RegKey \
+       'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+  !else
+    !define WriteEnvStr_RegKey 'HKCU "Environment"'
+  !endif
+!endif
+
+; AddToPath - Adds the given dir to the search path.
+;        Input - head of the stack
+;        Note - Win9x systems requires reboot
+
+Function AddToPath
+  Exch $0
+  Push $1
+  Push $2
+  Push $3
+
+  # don't add if the path doesn't exist
+  IfFileExists "$0\*.*" "" AddToPath_done
+
+  ReadEnvStr $1 PATH
+  ; if the path is too long for a NSIS variable NSIS will return a 0
+  ; length string.  If we find that, then warn and skip any path
+  ; modification as it will trash the existing path.
+  StrLen $2 $1
+  IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
+    CheckPathLength_ShowPathWarning:
+    Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
+    Goto AddToPath_done
+  CheckPathLength_Done:
+  Push "$1;"
+  Push "$0;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  Push "$1;"
+  Push "$0\;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  GetFullPathName /SHORT $3 $0
+  Push "$1;"
+  Push "$3;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+  Push "$1;"
+  Push "$3\;"
+  Call StrStr
+  Pop $2
+  StrCmp $2 "" "" AddToPath_done
+
+  Call IsNT
+  Pop $1
+  StrCmp $1 1 AddToPath_NT
+    ; Not on NT
+    StrCpy $1 $WINDIR 2
+    FileOpen $1 "$1\autoexec.bat" a
+    FileSeek $1 -1 END
+    FileReadByte $1 $2
+    IntCmp $2 26 0 +2 +2 # DOS EOF
+      FileSeek $1 -1 END # write over EOF
+    FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
+    FileClose $1
+    SetRebootFlag true
+    Goto AddToPath_done
+
+  AddToPath_NT:
+    StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
+      ReadRegStr $1 ${NT_current_env} "PATH"
+      Goto DoTrim
+    ReadAllKey:
+      ReadRegStr $1 ${NT_all_env} "PATH"
+    DoTrim:
+    StrCmp $1 "" AddToPath_NTdoIt
+      Push $1
+      Call Trim
+      Pop $1
+      StrCpy $0 "$1;$0"
+    AddToPath_NTdoIt:
+      StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
+        WriteRegExpandStr ${NT_current_env} "PATH" $0
+        Goto DoSend
+      WriteAllKey:
+        WriteRegExpandStr ${NT_all_env} "PATH" $0
+      DoSend:
+      SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+  AddToPath_done:
+    Pop $3
+    Pop $2
+    Pop $1
+    Pop $0
+FunctionEnd
+
+
+; RemoveFromPath - Remove a given dir from the path
+;     Input: head of the stack
+
+Function un.RemoveFromPath
+  Exch $0
+  Push $1
+  Push $2
+  Push $3
+  Push $4
+  Push $5
+  Push $6
+
+  IntFmt $6 "%c" 26 # DOS EOF
+
+  Call un.IsNT
+  Pop $1
+  StrCmp $1 1 unRemoveFromPath_NT
+    ; Not on NT
+    StrCpy $1 $WINDIR 2
+    FileOpen $1 "$1\autoexec.bat" r
+    GetTempFileName $4
+    FileOpen $2 $4 w
+    GetFullPathName /SHORT $0 $0
+    StrCpy $0 "SET PATH=%PATH%;$0"
+    Goto unRemoveFromPath_dosLoop
+
+    unRemoveFromPath_dosLoop:
+      FileRead $1 $3
+      StrCpy $5 $3 1 -1 # read last char
+      StrCmp $5 $6 0 +2 # if DOS EOF
+        StrCpy $3 $3 -1 # remove DOS EOF so we can compare
+      StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
+      StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
+      StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
+      StrCmp $3 "" unRemoveFromPath_dosLoopEnd
+      FileWrite $2 $3
+      Goto unRemoveFromPath_dosLoop
+      unRemoveFromPath_dosLoopRemoveLine:
+        SetRebootFlag true
+        Goto unRemoveFromPath_dosLoop
+
+    unRemoveFromPath_dosLoopEnd:
+      FileClose $2
+      FileClose $1
+      StrCpy $1 $WINDIR 2
+      Delete "$1\autoexec.bat"
+      CopyFiles /SILENT $4 "$1\autoexec.bat"
+      Delete $4
+      Goto unRemoveFromPath_done
+
+  unRemoveFromPath_NT:
+    StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
+      ReadRegStr $1 ${NT_current_env} "PATH"
+      Goto unDoTrim
+    unReadAllKey:
+      ReadRegStr $1 ${NT_all_env} "PATH"
+    unDoTrim:
+    StrCpy $5 $1 1 -1 # copy last char
+    StrCmp $5 ";" +2 # if last char != ;
+      StrCpy $1 "$1;" # append ;
+    Push $1
+    Push "$0;"
+    Call un.StrStr ; Find `$0;` in $1
+    Pop $2 ; pos of our dir
+    StrCmp $2 "" unRemoveFromPath_done
+      ; else, it is in path
+      # $0 - path to add
+      # $1 - path var
+      StrLen $3 "$0;"
+      StrLen $4 $2
+      StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
+      StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
+      StrCpy $3 $5$6
+
+      StrCpy $5 $3 1 -1 # copy last char
+      StrCmp $5 ";" 0 +2 # if last char == ;
+        StrCpy $3 $3 -1 # remove last char
+
+      StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
+        WriteRegExpandStr ${NT_current_env} "PATH" $3
+        Goto unDoSend
+      unWriteAllKey:
+        WriteRegExpandStr ${NT_all_env} "PATH" $3
+      unDoSend:
+      SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
+  unRemoveFromPath_done:
+    Pop $6
+    Pop $5
+    Pop $4
+    Pop $3
+    Pop $2
+    Pop $1
+    Pop $0
+FunctionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Uninstall sutff
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+###########################################
+#            Utility Functions            #
+###########################################
+
+;====================================================
+; IsNT - Returns 1 if the current system is NT, 0
+;        otherwise.
+;     Output: head of the stack
+;====================================================
+; IsNT
+; no input
+; output, top of the stack = 1 if NT or 0 if not
+;
+; Usage:
+;   Call IsNT
+;   Pop $R0
+;  ($R0 at this point is 1 or 0)
+
+!macro IsNT un
+Function ${un}IsNT
+  Push $0
+  ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
+  StrCmp $0 "" 0 IsNT_yes
+  ; we are not NT.
+  Pop $0
+  Push 0
+  Return
+
+  IsNT_yes:
+    ; NT!!!
+    Pop $0
+    Push 1
+FunctionEnd
+!macroend
+!insertmacro IsNT ""
+!insertmacro IsNT "un."
+
+; StrStr
+; input, top of stack = string to search for
+;        top of stack-1 = string to search in
+; output, top of stack (replaces with the portion of the string remaining)
+; modifies no other variables.
+;
+; Usage:
+;   Push "this is a long ass string"
+;   Push "ass"
+;   Call StrStr
+;   Pop $R0
+;  ($R0 at this point is "ass string")
+
+!macro StrStr un
+Function ${un}StrStr
+Exch $R1 ; st=haystack,old$R1, $R1=needle
+  Exch    ; st=old$R1,haystack
+  Exch $R2 ; st=old$R1,old$R2, $R2=haystack
+  Push $R3
+  Push $R4
+  Push $R5
+  StrLen $R3 $R1
+  StrCpy $R4 0
+  ; $R1=needle
+  ; $R2=haystack
+  ; $R3=len(needle)
+  ; $R4=cnt
+  ; $R5=tmp
+  loop:
+    StrCpy $R5 $R2 $R3 $R4
+    StrCmp $R5 $R1 done
+    StrCmp $R5 "" done
+    IntOp $R4 $R4 + 1
+    Goto loop
+done:
+  StrCpy $R1 $R2 "" $R4
+  Pop $R5
+  Pop $R4
+  Pop $R3
+  Pop $R2
+  Exch $R1
+FunctionEnd
+!macroend
+!insertmacro StrStr ""
+!insertmacro StrStr "un."
+
+Function Trim ; Added by Pelaca
+	Exch $R1
+	Push $R2
+Loop:
+	StrCpy $R2 "$R1" 1 -1
+	StrCmp "$R2" " " RTrim
+	StrCmp "$R2" "$\n" RTrim
+	StrCmp "$R2" "$\r" RTrim
+	StrCmp "$R2" ";" RTrim
+	GoTo Done
+RTrim:
+	StrCpy $R1 "$R1" -1
+	Goto Loop
+Done:
+	Pop $R2
+	Exch $R1
+FunctionEnd
+
+Function ConditionalAddToRegisty
+  Pop $0
+  Pop $1
+  StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
+    WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
+    "$1" "$0"
+    ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
+    DetailPrint "Set install registry entry: '$1' to '$0'"
+  ConditionalAddToRegisty_EmptyString:
+FunctionEnd
+
+;--------------------------------
+
+!ifdef CPACK_USES_DOWNLOAD
+Function DownloadFile
+    IfFileExists $INSTDIR\* +2
+    CreateDirectory $INSTDIR
+    Pop $0
+
+    ; Skip if already downloaded
+    IfFileExists $INSTDIR\$0 0 +2
+    Return
+
+    StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
+
+  try_again:
+    NSISdl::download "$1/$0" "$INSTDIR\$0"
+
+    Pop $1
+    StrCmp $1 "success" success
+    StrCmp $1 "Cancelled" cancel
+    MessageBox MB_OK "Download failed: $1"
+  cancel:
+    Return
+  success:
+FunctionEnd
+!endif
+
+;--------------------------------
+; Installation types
+ at CPACK_NSIS_INSTALLATION_TYPES@
+
+;--------------------------------
+; Component sections
+ at CPACK_NSIS_COMPONENT_SECTIONS@
+
+;--------------------------------
+; Define some macro setting for the gui
+ at CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
+ at CPACK_NSIS_INSTALLER_ICON_CODE@
+ at CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
+ at CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
+
+;--------------------------------
+;Pages
+  !insertmacro MUI_PAGE_WELCOME
+
+  !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+  Page custom InstallOptionsPage
+  !insertmacro MUI_PAGE_DIRECTORY
+
+  ;Start Menu Folder Page Configuration
+  !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
+  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+  !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
+  !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
+
+  @CPACK_NSIS_PAGE_COMPONENTS@
+
+  !insertmacro MUI_PAGE_INSTFILES
+  !insertmacro MUI_PAGE_FINISH
+
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Languages
+
+  !insertmacro MUI_LANGUAGE "English" ;first language is the default language
+  !insertmacro MUI_LANGUAGE "Albanian"
+  !insertmacro MUI_LANGUAGE "Arabic"
+  !insertmacro MUI_LANGUAGE "Basque"
+  !insertmacro MUI_LANGUAGE "Belarusian"
+  !insertmacro MUI_LANGUAGE "Bosnian"
+  !insertmacro MUI_LANGUAGE "Breton"
+  !insertmacro MUI_LANGUAGE "Bulgarian"
+  !insertmacro MUI_LANGUAGE "Croatian"
+  !insertmacro MUI_LANGUAGE "Czech"
+  !insertmacro MUI_LANGUAGE "Danish"
+  !insertmacro MUI_LANGUAGE "Dutch"
+  !insertmacro MUI_LANGUAGE "Estonian"
+  !insertmacro MUI_LANGUAGE "Farsi"
+  !insertmacro MUI_LANGUAGE "Finnish"
+  !insertmacro MUI_LANGUAGE "French"
+  !insertmacro MUI_LANGUAGE "German"
+  !insertmacro MUI_LANGUAGE "Greek"
+  !insertmacro MUI_LANGUAGE "Hebrew"
+  !insertmacro MUI_LANGUAGE "Hungarian"
+  !insertmacro MUI_LANGUAGE "Icelandic"
+  !insertmacro MUI_LANGUAGE "Indonesian"
+  !insertmacro MUI_LANGUAGE "Irish"
+  !insertmacro MUI_LANGUAGE "Italian"
+  !insertmacro MUI_LANGUAGE "Japanese"
+  !insertmacro MUI_LANGUAGE "Korean"
+  !insertmacro MUI_LANGUAGE "Kurdish"
+  !insertmacro MUI_LANGUAGE "Latvian"
+  !insertmacro MUI_LANGUAGE "Lithuanian"
+  !insertmacro MUI_LANGUAGE "Luxembourgish"
+  !insertmacro MUI_LANGUAGE "Macedonian"
+  !insertmacro MUI_LANGUAGE "Malay"
+  !insertmacro MUI_LANGUAGE "Mongolian"
+  !insertmacro MUI_LANGUAGE "Norwegian"
+  !insertmacro MUI_LANGUAGE "Polish"
+  !insertmacro MUI_LANGUAGE "Portuguese"
+  !insertmacro MUI_LANGUAGE "PortugueseBR"
+  !insertmacro MUI_LANGUAGE "Romanian"
+  !insertmacro MUI_LANGUAGE "Russian"
+  !insertmacro MUI_LANGUAGE "Serbian"
+  !insertmacro MUI_LANGUAGE "SerbianLatin"
+  !insertmacro MUI_LANGUAGE "SimpChinese"
+  !insertmacro MUI_LANGUAGE "Slovak"
+  !insertmacro MUI_LANGUAGE "Slovenian"
+  !insertmacro MUI_LANGUAGE "Spanish"
+  !insertmacro MUI_LANGUAGE "Swedish"
+  !insertmacro MUI_LANGUAGE "Thai"
+  !insertmacro MUI_LANGUAGE "TradChinese"
+  !insertmacro MUI_LANGUAGE "Turkish"
+  !insertmacro MUI_LANGUAGE "Ukrainian"
+  !insertmacro MUI_LANGUAGE "Welsh"
+
+
+;--------------------------------
+;Reserve Files
+
+  ;These files should be inserted before other files in the data block
+  ;Keep these lines before any File command
+  ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
+
+  ReserveFile "NSIS.InstallOptions.ini"
+  !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+
+;--------------------------------
+;Installer Sections
+
+Section "-Core installation"
+  ;Use the entire tree produced by the INSTALL target.  Keep the
+  ;list of directories here in sync with the RMDir commands below.
+  SetOutPath "$INSTDIR"
+  @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
+  @CPACK_NSIS_FULL_INSTALL@
+
+  ;Store installation folder
+  WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
+
+  ;Create uninstaller
+  WriteUninstaller "$INSTDIR\Uninstall.exe"
+  Push "DisplayName"
+  Push "@CPACK_NSIS_DISPLAY_NAME@"
+  Call ConditionalAddToRegisty
+  Push "DisplayVersion"
+  Push "@CPACK_PACKAGE_VERSION@"
+  Call ConditionalAddToRegisty
+  Push "Publisher"
+  Push "@CPACK_PACKAGE_VENDOR@"
+  Call ConditionalAddToRegisty
+  Push "UninstallString"
+  Push "$INSTDIR\Uninstall.exe"
+  Call ConditionalAddToRegisty
+  Push "NoRepair"
+  Push "1"
+  Call ConditionalAddToRegisty
+
+  !ifdef CPACK_NSIS_ADD_REMOVE
+  ;Create add/remove functionality
+  Push "ModifyPath"
+  Push "$INSTDIR\AddRemove.exe"
+  Call ConditionalAddToRegisty
+  !else
+  Push "NoModify"
+  Push "1"
+  Call ConditionalAddToRegisty
+  !endif
+
+  ; Optional registration
+  Push "DisplayIcon"
+  Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
+  Call ConditionalAddToRegisty
+  Push "HelpLink"
+  Push "@CPACK_NSIS_HELP_LINK@"
+  Call ConditionalAddToRegisty
+  Push "URLInfoAbout"
+  Push "@CPACK_NSIS_URL_INFO_ABOUT@"
+  Call ConditionalAddToRegisty
+  Push "Contact"
+  Push "@CPACK_NSIS_CONTACT@"
+  Call ConditionalAddToRegisty
+  !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
+  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+
+  ;Create shortcuts
+  CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
+ at CPACK_NSIS_CREATE_ICONS@
+ at CPACK_NSIS_CREATE_ICONS_EXTRA@
+  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
+
+  ;Read a value from an InstallOptions INI file
+  !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
+  !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
+  !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
+
+  ; Write special uninstall registry entries
+  Push "StartMenu"
+  Push "$STARTMENU_FOLDER"
+  Call ConditionalAddToRegisty
+  Push "DoNotAddToPath"
+  Push "$DO_NOT_ADD_TO_PATH"
+  Call ConditionalAddToRegisty
+  Push "AddToPathAllUsers"
+  Push "$ADD_TO_PATH_ALL_USERS"
+  Call ConditionalAddToRegisty
+  Push "AddToPathCurrentUser"
+  Push "$ADD_TO_PATH_CURRENT_USER"
+  Call ConditionalAddToRegisty
+  Push "InstallToDesktop"
+  Push "$INSTALL_DESKTOP"
+  Call ConditionalAddToRegisty
+
+  !insertmacro MUI_STARTMENU_WRITE_END
+
+ at CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
+
+SectionEnd
+
+Section "-Add to path"
+  Push $INSTDIR\bin
+  StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
+  StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
+    Call AddToPath
+  doNotAddToPath:
+SectionEnd
+
+;--------------------------------
+; Create custom pages
+Function InstallOptionsPage
+  !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
+  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
+
+FunctionEnd
+
+;--------------------------------
+; determine admin versus local install
+Function un.onInit
+
+  ClearErrors
+  UserInfo::GetName
+  IfErrors noLM
+  Pop $0
+  UserInfo::GetAccountType
+  Pop $1
+  StrCmp $1 "Admin" 0 +3
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Admin group'
+    Goto done
+  StrCmp $1 "Power" 0 +3
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+    Goto done
+
+  noLM:
+    ;Get installation folder from registry if available
+
+  done:
+
+FunctionEnd
+
+;--- Add/Remove callback functions: ---
+!macro SectionList MacroName
+  ;This macro used to perform operation on multiple sections.
+  ;List all of your components in following manner here.
+ at CPACK_NSIS_COMPONENT_SECTION_LIST@
+!macroend
+
+Section -FinishComponents
+  ;Removes unselected components and writes component status to registry
+  !insertmacro SectionList "FinishSection"
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+  ; Get the name of the installer executable
+  System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
+  StrCpy $R3 $R0
+
+  ; Strip off the last 13 characters, to see if we have AddRemove.exe
+  StrLen $R1 $R0
+  IntOp $R1 $R0 - 13
+  StrCpy $R2 $R0 13 $R1
+  StrCmp $R2 "AddRemove.exe" addremove_installed
+
+  ; We're not running AddRemove.exe, so install it
+  CopyFiles $R3 $INSTDIR\AddRemove.exe
+
+  addremove_installed:
+!endif
+SectionEnd
+;--- End of Add/Remove callback functions ---
+
+;--------------------------------
+; Component dependencies
+Function .onSelChange
+  !insertmacro SectionList MaybeSelectionChanged
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+  ReadRegStr $START_MENU SHCTX \
+   "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
+  ;MessageBox MB_OK "Start menu is in: $START_MENU"
+  ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
+  ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
+  ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
+  ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
+  ReadRegStr $INSTALL_DESKTOP SHCTX \
+    "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
+  ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
+
+ at CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
+
+  ;Remove files we installed.
+  ;Keep the list of directories here in sync with the File commands above.
+ at CPACK_NSIS_DELETE_FILES@
+ at CPACK_NSIS_DELETE_DIRECTORIES@
+
+!ifdef CPACK_NSIS_ADD_REMOVE
+  ;Remove the add/remove program
+  Delete "$INSTDIR\AddRemove.exe"
+!endif
+
+  ;Remove the uninstaller itself.
+  Delete "$INSTDIR\Uninstall.exe"
+  DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+  ;Remove the installation directory if it is empty.
+  RMDir "$INSTDIR"
+
+  ; Remove the registry entries.
+  DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+  ; Removes all optional components
+  !insertmacro SectionList "RemoveSection_CPack"
+
+  !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
+
+  Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+ at CPACK_NSIS_DELETE_ICONS@
+ at CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+  ;Delete empty start menu parent diretories
+  StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+  startMenuDeleteLoop:
+    ClearErrors
+    RMDir $MUI_TEMP
+    GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+    IfErrors startMenuDeleteLoopDone
+
+    StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
+  startMenuDeleteLoopDone:
+
+  ; If the user changed the shortcut, then untinstall may not work. This should
+  ; try to fix it.
+  StrCpy $MUI_TEMP "$START_MENU"
+  Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
+ at CPACK_NSIS_DELETE_ICONS_EXTRA@
+
+  ;Delete empty start menu parent diretories
+  StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
+
+  secondStartMenuDeleteLoop:
+    ClearErrors
+    RMDir $MUI_TEMP
+    GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
+
+    IfErrors secondStartMenuDeleteLoopDone
+
+    StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
+  secondStartMenuDeleteLoopDone:
+
+  DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
+
+  Push $INSTDIR\bin
+  StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
+    Call un.RemoveFromPath
+  doNotRemoveFromPath:
+SectionEnd
+
+;--------------------------------
+; determine admin versus local install
+; Is install for "AllUsers" or "JustMe"?
+; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
+; This function is used for the very first "custom page" of the installer.
+; This custom page does not show up visibly, but it executes prior to the
+; first visible page and sets up $INSTDIR properly...
+; Choose different default installation folder based on SV_ALLUSERS...
+; "Program Files" for AllUsers, "My Documents" for JustMe...
+
+Function .onInit
+  StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst
+
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString"
+  StrCmp $0 "" inst
+
+  MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
+  "@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \
+  IDYES uninst IDNO inst
+  Abort
+
+;Run the uninstaller
+uninst:
+  ClearErrors
+  StrLen $2 "\Uninstall.exe"
+  StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path
+  ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file
+
+  IfErrors uninst_failed inst
+uninst_failed:
+  MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
+  Abort
+
+
+inst:
+  ; Reads components status for registry
+  !insertmacro SectionList "InitSection"
+
+  ; check to see if /D has been used to change
+  ; the install directory by comparing it to the
+  ; install directory that is expected to be the
+  ; default
+  StrCpy $IS_DEFAULT_INSTALLDIR 0
+  StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
+    StrCpy $IS_DEFAULT_INSTALLDIR 1
+
+  StrCpy $SV_ALLUSERS "JustMe"
+  ; if default install dir then change the default
+  ; if it is installed for JustMe
+  StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+    StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+  ClearErrors
+  UserInfo::GetName
+  IfErrors noLM
+  Pop $0
+  UserInfo::GetAccountType
+  Pop $1
+  StrCmp $1 "Admin" 0 +4
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Admin group'
+    StrCpy $SV_ALLUSERS "AllUsers"
+    Goto done
+  StrCmp $1 "Power" 0 +4
+    SetShellVarContext all
+    ;MessageBox MB_OK 'User "$0" is in the Power Users group'
+    StrCpy $SV_ALLUSERS "AllUsers"
+    Goto done
+
+  noLM:
+    StrCpy $SV_ALLUSERS "AllUsers"
+    ;Get installation folder from registry if available
+
+  done:
+  StrCmp $SV_ALLUSERS "AllUsers" 0 +3
+    StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+      StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+
+  StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
+    !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
+
+  noOptionsPage:
+FunctionEnd
diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake
new file mode 100644
index 0000000..175c420
--- /dev/null
+++ b/config/cmake/UserMacros/Windows_MT.cmake
@@ -0,0 +1,41 @@
+########################################################
+#  Include file for user options
+########################################################
+
+# To use this option, copy both the macro and option code
+# into the root UserMacros.cmake file. 
+# OR add an include to the root UserMacros.cmake file:
+# INCLUDE(path_to_file/WINDOWS_MT.cmake)
+
+#-----------------------------------------------------------------------------
+# Option to Build with Static CRT libraries on Windows
+#-------------------------------------------------------------------------------
+MACRO (TARGET_STATIC_CRT_FLAGS)
+  IF (MSVC AND NOT BUILD_SHARED_LIBS)
+    FOREACH (flag_var
+        CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+        CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+        CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+        CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+      IF (${flag_var} MATCHES "/MD")
+        STRING (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+      ENDIF (${flag_var} MATCHES "/MD")
+    ENDFOREACH (flag_var)
+    FOREACH (flag_var
+        CMAKE_Fortran_FLAGS CMAKE_Fortran_FLAGS_DEBUG CMAKE_Fortran_FLAGS_RELEASE
+        CMAKE_Fortran_FLAGS_MINSIZEREL CMAKE_Fortran_FLAGS_RELWITHDEBINFO)
+      IF (${flag_var} MATCHES "/libs:dll")
+        STRING (REGEX REPLACE "/libs:dll" "/libs:static" ${flag_var} "${${flag_var}}")
+      ENDIF (${flag_var} MATCHES "/libs:dll")
+    ENDFOREACH (flag_var)
+    SET (WIN_COMPILE_FLAGS "")
+    SET (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT")
+  ENDIF (MSVC AND NOT BUILD_SHARED_LIBS)
+ENDMACRO (TARGET_STATIC_CRT_FLAGS)
+
+#-----------------------------------------------------------------------------
+OPTION (BUILD_STATIC_CRT_LIBS "Build With Static CRT Libraries" OFF)
+IF (BUILD_STATIC_CRT_LIBS)
+  TARGET_STATIC_CRT_FLAGS ()
+ENDIF (BUILD_STATIC_CRT_LIBS)
+ 
\ No newline at end of file
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
new file mode 100644
index 0000000..5a64121
--- /dev/null
+++ b/config/cmake/cacheinit.cmake
@@ -0,0 +1,68 @@
+# This is the CMakeCache file.
+
+########################
+# EXTERNAL cache entries
+########################
+
+SET (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
+
+SET (BUILD_TESTING ON CACHE BOOL "Build HDF4 Unit Testing" FORCE)
+
+SET (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
+
+SET (HDF4_BUILD_EXAMPLES ON CACHE BOOL "Build HDF4 Library Examples" FORCE)
+
+SET (HDF4_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
+
+SET (HDF4_BUILD_TOOLS ON CACHE BOOL "Build HDF4 Tools" FORCE)
+
+SET (HDF4_BUILD_UTILS ON CACHE BOOL "Build HDF4 Library Utilities" FORCE)
+
+SET (HDF4_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE)
+
+SET (HDF4_ENABLE_NETCDF ON CACHE BOOL "Build HDF4 versions of NetCDF-3 APIS" FORCE)
+
+SET (HDF4_BUILD_XDR_LIB OFF CACHE BOOL "Build HDF4 XDR Library" FORCE)
+
+SET (HDF4_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
+
+SET (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
+
+SET (HDF4_ENABLE_JPEG_LIB_SUPPORT ON CACHE BOOL "Enable Jpeg library" FORCE)
+
+SET (HDF4_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
+
+SET (HDF4_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
+
+SET (HDF4_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
+
+SET (HDF4_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
+
+SET (HDF4_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+
+SET (HDF4_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
+
+SET (HDF4_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+
+SET (HDF4_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
+
+SET (HDF4_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
+SET_PROPERTY(CACHE HDF4_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
+
+SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
+
+SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
+
+SET (JPEG_SVN_URL "http://svn.hdfgroup.uiuc.edu/jpeg/branches/jpeg8b" CACHE STRING "Use JPEG from HDF repository" FORCE)
+
+SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
+
+SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
+
+SET (JPEG_TGZ_NAME "JPEG8b.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE)
+
+SET (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
+
+SET (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE)
+
+SET (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE)
diff --git a/config/cmake/h4config.h.in b/config/cmake/h4config.h.in
new file mode 100644
index 0000000..6a7681f
--- /dev/null
+++ b/config/cmake/h4config.h.in
@@ -0,0 +1,143 @@
+/* hdf/src/h4config.h  Generated By CMake during the configuration  */
+
+#ifndef H4_CONFIG_H_
+#define H4_CONFIG_H_
+
+/* Define to dummy `main' function (if any) required to link to the Fortran
+   libraries. */
+#cmakedefine H4_F77_DUMMY_MAIN @H4_F77_DUMMY_MAIN@
+
+/* Defined if HDF4 was built with CMake AND build as a shared library */
+#cmakedefine H4_BUILT_AS_DYNAMIC_LIB @H4_BUILT_AS_DYNAMIC_LIB@
+
+/* Defined if HDF4 was built with CMake AND build as a static library */
+#cmakedefine H4_BUILT_AS_STATIC_LIB @H4_BUILT_AS_STATIC_LIB@
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+   case), which must not contain underscores, for linking with Fortran. */
+#define @H4_F77_FUNC@
+
+/* As F77_FUNC, but for C identifiers containing underscores. */
+#define @H4_F77_FUNC_@
+
+/* Define to 1 if your Fortran compiler doesn't accept -c and -o together. */
+#cmakedefine H4_F77_NO_MINUS_C_MINUS_O @H4_F77_NO_MINUS_C_MINUS_O@
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+#cmakedefine H4_FC_DUMMY_MAIN_EQ_F77 @H4_FC_DUMMY_MAIN_EQ_F77@
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine H4_HAVE_DLFCN_H @H4_HAVE_DLFCN_H@
+
+/* Define to 1 if you have the `fork' function. */
+#cmakedefine H4_HAVE_FORK @H4_HAVE_FORK@
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine H4_HAVE_INTTYPES_H @H4_HAVE_INTTYPES_H@
+
+/* Define to 1 if you have the <jpeglib.h> header file. */
+#cmakedefine H4_HAVE_JPEGLIB_H @H4_HAVE_JPEGLIB_H@
+
+/* Define to 1 if you have the `jpeg' library (-ljpeg). */
+#cmakedefine H4_HAVE_LIBJPEG @H4_HAVE_LIBJPEG@
+
+/* Define to 1 if you have the `sz' library (-lsz). */
+#cmakedefine H4_HAVE_LIBSZ @H4_HAVE_LIBSZ@
+
+/* Define to 1 if you have the `z' library (-lz). */
+#cmakedefine H4_HAVE_LIBZ @H4_HAVE_LIBZ@
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine H4_HAVE_MEMORY_H @H4_HAVE_MEMORY_H@
+
+/* Define if we support HDF NetCDF APIs version 2.3.2 */
+#cmakedefine H4_HAVE_NETCDF @H4_HAVE_NETCDF@
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine H4_HAVE_STDINT_H @H4_HAVE_STDINT_H@
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine H4_HAVE_STDLIB_H @H4_HAVE_STDLIB_H@
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine H4_HAVE_STRINGS_H @H4_HAVE_STRINGS_H@
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine H4_HAVE_STRING_H @H4_HAVE_STRING_H@
+
+/* Define to 1 if you have the `system' function. */
+#cmakedefine H4_HAVE_SYSTEM @H4_HAVE_SYSTEM@
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine H4_HAVE_SYS_STAT_H @H4_HAVE_SYS_STAT_H@
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine H4_HAVE_SYS_TYPES_H @H4_HAVE_SYS_TYPES_H@
+
+/* Define if szip has encoder */
+#cmakedefine H4_HAVE_SZIP_ENCODER @H4_HAVE_SZIP_ENCODER@
+
+/* Define to 1 if you have the <szlib.h> header file. */
+#cmakedefine H4_HAVE_SZLIB_H @H4_HAVE_SZLIB_H@
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine H4_HAVE_UNISTD_H @H4_HAVE_UNISTD_H@
+
+/* Define to 1 if you have the `vfork' function. */
+#cmakedefine H4_HAVE_VFORK @H4_HAVE_VFORK@
+
+/* Define to 1 if you have the `wait' function. */
+#cmakedefine H4_HAVE_WAIT @H4_HAVE_WAIT@
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#cmakedefine H4_HAVE_ZLIB_H @H4_HAVE_ZLIB_H@
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define H4_LT_OBJDIR "@HDF4_LT_OBJDIR@"
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#cmakedefine H4_NO_MINUS_C_MINUS_O @H4_NO_MINUS_C_MINUS_O@
+
+/* Name of package */
+#define H4_PACKAGE "@HDF4_PACKAGE@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define H4_PACKAGE_BUGREPORT "@HDF4_PACKAGE_BUGREPORT@"
+
+/* Define to the full name of this package. */
+#define H4_PACKAGE_NAME "@HDF4_PACKAGE_NAME@"
+
+/* Define to the full name and version of this package. */
+#define H4_PACKAGE_STRING "@HDF4_PACKAGE_STRING@"
+
+/* Define to the one symbol short name of this package. */
+#define H4_PACKAGE_TARNAME "@HDF4_PACKAGE_TARNAME@"
+
+/* Define to the home page for this package. */
+#define H4_PACKAGE_URL "@HDF4_PACKAGE_URL@"
+
+/* Define to the version of this package. */
+#define H4_PACKAGE_VERSION "@HDF4_PACKAGE_VERSION@"
+
+/* The size of `int*', as computed by sizeof. */
+#cmakedefine H4_SIZEOF_INTP @H4_SIZEOF_INTP@
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine H4_STDC_HEADERS @H4_STDC_HEADERS@
+
+/* Version number of package */
+#define H4_VERSION "@HDF4_PACKAGE_VERSION@"
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#cmakedefine H4_WORDS_BIGENDIAN @H4_WORDS_BIGENDIAN@
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine H4_YYTEXT_POINTER @H4_YYTEXT_POINTER@
+
+/* This define is set in the root CMakeLists.txt file to the correct construction. */
+#define @H4_HDSETVBUF@
+
+#endif
diff --git a/config/cmake/hdf.gif b/config/cmake/hdf.gif
new file mode 100644
index 0000000..656617b
Binary files /dev/null and b/config/cmake/hdf.gif differ
diff --git a/config/cmake/hdf4-config-version.cmake.in b/config/cmake/hdf4-config-version.cmake.in
new file mode 100644
index 0000000..a13d728
--- /dev/null
+++ b/config/cmake/hdf4-config-version.cmake.in
@@ -0,0 +1,27 @@
+#-----------------------------------------------------------------------------
+# HDF4 Version file for install directory
+#-----------------------------------------------------------------------------
+
+SET (PACKAGE_VERSION @HDF4_VERSION_STRING@)
+
+IF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H4_VERS_MAJOR@)
+
+  # exact match for version @H5_VERS_MAJOR at .@H4_VERS_MINOR@
+  IF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H4_VERS_MINOR@)
+
+    # compatible with any version @H4_VERS_MAJOR at .@H4_VERS_MINOR at .x
+    SET (PACKAGE_VERSION_COMPATIBLE 1) 
+    
+    IF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H4_VERS_RELEASE@)
+      SET (PACKAGE_VERSION_EXACT 1)    
+
+      IF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H4_VERS_SUBRELEASE@)
+        # not using this yet
+      ENDIF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H4_VERS_SUBRELEASE@)
+      
+    ENDIF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H4_VERS_RELEASE@)
+    
+  ENDIF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H4_VERS_MINOR@)
+ENDIF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H4_VERS_MAJOR@)
+
+
diff --git a/config/cmake/hdf4-config.cmake.build.in b/config/cmake/hdf4-config.cmake.build.in
new file mode 100644
index 0000000..65df934
--- /dev/null
+++ b/config/cmake/hdf4-config.cmake.build.in
@@ -0,0 +1,61 @@
+#-----------------------------------------------------------------------------
+# HDF4 Config file for compiling against hdf4 build directory
+#-----------------------------------------------------------------------------
+GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+#-----------------------------------------------------------------------------
+# User Options
+#-----------------------------------------------------------------------------
+SET (HDF4_ENABLE_PARALLEL @HDF4_ENABLE_PARALLEL@)
+SET (HDF4_BUILD_FORTRAN   @HDF4_BUILD_FORTRAN@)
+SET (HDF4_BUILD_XDR_LIB   @HDF4_BUILD_XDR_LIB@)
+SET (HDF4_BUILD_TOOLS     @HDF4_BUILD_TOOLS@)
+SET (HDF4_BUILD_UTILS     @HDF4_BUILD_UTILS@)
+SET (HDF4_ENABLE_JPEG_LIB_SUPPORT @HDF4_ENABLE_JPEG_LIB_SUPPORT@)
+SET (HDF4_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@)
+SET (HDF4_ENABLE_SZIP_SUPPORT  @HDF4_ENABLE_SZIP_SUPPORT@)
+SET (HDF4_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@)
+SET (HDF4_BUILD_SHARED_LIBS    @BUILD_SHARED_LIBS@)
+
+#-----------------------------------------------------------------------------
+# Directories
+#-----------------------------------------------------------------------------
+SET (HDF4_INCLUDE_DIR "@HDF4_INCLUDES_BUILD_TIME@")
+
+IF (HDF4_BUILD_FORTRAN)
+  SET (HDF4_INCLUDE_DIR_FORTRAN "@CMAKE_Fortran_MODULE_DIRECTORY@" )
+ENDIF (HDF4_BUILD_FORTRAN)
+  
+IF (HDF4_BUILD_XDR_LIB)
+  SET (HDF4_INCLUDE_DIR_XDR ${HDF4_INCLUDE_DIR} )
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+IF (HDF4_BUILD_TOOLS)
+  SET (HDF4_INCLUDE_DIR_TOOLS ${HDF4_INCLUDE_DIR} )
+ENDIF (HDF4_BUILD_TOOLS)
+
+IF (HDF4_BUILD_UTILS)
+  SET (HDF4_INCLUDE_DIR_UTILS ${HDF4_INCLUDE_DIR} )
+ENDIF (HDF4_BUILD_UTILS)
+
+IF (HDF4_BUILD_SHARED_LIBS)
+  SET (H4_BUILT_AS_DYNAMIC_LIB 1 )
+ELSE (HDF4_BUILD_SHARED_LIBS)
+  SET (H4_BUILT_AS_STATIC_LIB 1 )
+ENDIF (HDF4_BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# Version Strings
+#-----------------------------------------------------------------------------
+SET (HDF4_VERSION_STRING @HDF4_VERSION_STRING@)
+SET (HDF4_VERSION_MAJOR  @HDF4_VERSION_MAJOR@)
+SET (HDF4_VERSION_MINOR  @HDF4_VERSION_MINOR@)
+
+#-----------------------------------------------------------------------------
+# Don't include targets if this file is being picked up by another
+# project which has already build hdf4 as a subproject
+#-----------------------------------------------------------------------------
+IF (NOT TARGET "@HDF4_PACKAGE@")
+  INCLUDE (${SELF_DIR}/@HDF4_PACKAGE@@HDF_PACKAGE_EXT at -targets.cmake)
+  SET (HDF4_LIBRARIES "@HDF4_LIBRARIES_TO_EXPORT@")
+ENDIF (NOT TARGET "@HDF4_PACKAGE@")
diff --git a/config/cmake/hdf4-config.cmake.install.in b/config/cmake/hdf4-config.cmake.install.in
new file mode 100644
index 0000000..edc6926
--- /dev/null
+++ b/config/cmake/hdf4-config.cmake.install.in
@@ -0,0 +1,71 @@
+#-----------------------------------------------------------------------------
+# HDF4 Config file for compiling against hdf4 install directory
+#-----------------------------------------------------------------------------
+GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${SELF_DIR}" PATH)
+GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+IF (NOT WIN32)
+  GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+ENDIF (NOT WIN32)
+
+#-----------------------------------------------------------------------------
+# User Options
+#-----------------------------------------------------------------------------
+SET (HDF4_ENABLE_PARALLEL @HDF4_ENABLE_PARALLEL@)
+SET (HDF4_BUILD_FORTRAN   @HDF4_BUILD_FORTRAN@)
+SET (HDF4_BUILD_XDR_LIB   @HDF4_BUILD_XDR_LIB@)
+SET (HDF4_BUILD_TOOLS     @HDF4_BUILD_TOOLS@)
+SET (HDF4_BUILD_UTILS     @HDF4_BUILD_UTILS@)
+SET (HDF4_ENABLE_JPEG_LIB_SUPPORT @HDF4_ENABLE_JPEG_LIB_SUPPORT@)
+SET (HDF4_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@)
+SET (HDF4_ENABLE_SZIP_SUPPORT  @HDF4_ENABLE_SZIP_SUPPORT@)
+SET (HDF4_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@)
+SET (HDF4_BUILD_SHARED_LIBS    @BUILD_SHARED_LIBS@)
+SET (HDF4_PACKAGE_EXTLIBS @HDF4_PACKAGE_EXTLIBS@)
+
+#-----------------------------------------------------------------------------
+# Directories
+#-----------------------------------------------------------------------------
+SET (HDF4_INCLUDE_DIR "${_IMPORT_PREFIX}/include")
+
+IF (HDF4_BUILD_FORTRAN)
+  SET (HDF4_INCLUDE_DIR_FORTRAN "${_IMPORT_PREFIX}/include")
+ENDIF (HDF4_BUILD_FORTRAN)
+  
+IF (HDF4_BUILD_XDR_LIB)
+  SET (HDF4_INCLUDE_DIR_XDR "${_IMPORT_PREFIX}/include")
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+IF (HDF4_BUILD_TOOLS)
+  SET (HDF4_INCLUDE_DIR_TOOLS "${_IMPORT_PREFIX}/include")
+ENDIF (HDF4_BUILD_TOOLS)
+
+IF (HDF4_BUILD_UTILS)
+  SET (HDF4_INCLUDE_DIR_UTILS "${_IMPORT_PREFIX}/include")
+  SET (HDF4_TOOLS_DIR "${_IMPORT_PREFIX}/bin" )
+ENDIF (HDF4_BUILD_UTILS)
+
+#-----------------------------------------------------------------------------
+# Version Strings
+#-----------------------------------------------------------------------------
+SET (HDF4_VERSION_STRING @HDF4_VERSION_STRING@)
+SET (HDF4_VERSION_MAJOR  @HDF4_VERSION_MAJOR@)
+SET (HDF4_VERSION_MINOR  @HDF4_VERSION_MINOR@)
+
+#-----------------------------------------------------------------------------
+# Don't include targets if this file is being picked up by another
+# project which has already built hdf4 as a subproject
+#-----------------------------------------------------------------------------
+IF (NOT TARGET "@HDF4_PACKAGE@")
+  IF (HDF4_ENABLE_JPEG_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "jpeg")
+    INCLUDE (${SELF_DIR}/../JPEG/@JPEG_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
+  ENDIF (HDF4_ENABLE_JPEG_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "jpeg")
+  IF (HDF4_ENABLE_Z_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
+    INCLUDE (${SELF_DIR}/../ZLIB/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
+  ENDIF (HDF4_ENABLE_Z_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
+  IF (HDF4_ENABLE_SZIP_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+    INCLUDE (${SELF_DIR}/../SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
+  ENDIF (HDF4_ENABLE_SZIP_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+  INCLUDE (${SELF_DIR}/@HDF4_PACKAGE@@HDF_PACKAGE_EXT at -targets.cmake)
+  SET (HDF4_LIBRARIES "@HDF4_LIBRARIES_TO_EXPORT@")
+ENDIF (NOT TARGET "@HDF4_PACKAGE@")
diff --git a/config/cmake/libhdf4.settings.cmake.in b/config/cmake/libhdf4.settings.cmake.in
new file mode 100644
index 0000000..d38751b
--- /dev/null
+++ b/config/cmake/libhdf4.settings.cmake.in
@@ -0,0 +1,38 @@
+      SUMMARY OF THE HDF4 CONFIGURATION
+      =================================
+
+General Information:
+-------------------
+                   HDF4 Version: @HDF4_PACKAGE_VERSION@
+                  Configured on: @CONFIG_DATE@
+                  Configured by: @CMAKE_GENERATOR@
+                 Configure mode: CMAKE @CMAKE_VERSION@
+                    Host system: @CMAKE_HOST_SYSTEM@
+              Uname information: @CMAKE_SYSTEM_NAME@
+                      Libraries: @BUILD_NAME_EXT@
+             Installation point: @CMAKE_INSTALL_PREFIX@
+
+Compiling Options:
+------------------
+               Compilation Mode: @CMAKE_BUILD_TYPE@
+                     C Compiler: @CMAKE_C_COMPILER@
+                         CFLAGS: @CMAKE_C_FLAGS@
+                       CPPFLAGS: @CMAKE_CXX_FLAGS@
+               Shared Libraries: @H4_ENABLE_SHARED_LIB@
+               Static Libraries: @H4_ENABLE_STATIC_LIB@
+  Statically Linked Executables: @BUILD_STATIC_EXECS@
+                        LDFLAGS: @CMAKE_SHARED_LINKER_FLAGS@
+                Extra libraries: @LINK_LIBS@
+                       Archiver: @CMAKE_AR@
+                         Ranlib: @CMAKE_RANLIB@
+
+Languages:
+----------
+                        Fortran: @HDF4_BUILD_FORTRAN@
+ at BUILD_FORTRAN_CONDITIONAL_TRUE@               Fortran Compiler: @CMAKE_Fortran_COMPILER@
+ at BUILD_FORTRAN_CONDITIONAL_TRUE@                  Fortran Flags: @CMAKE_Fortran_FLAGS@
+
+Features:
+---------
+               SZIP compression: @SZIP_INFO@
+   Support for netCDF API 2.3.2: @HDF4_ENABLE_NETCDF@
diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake
new file mode 100644
index 0000000..03ff484
--- /dev/null
+++ b/config/cmake/mccacheinit.cmake
@@ -0,0 +1,71 @@
+# This is the CMakeCache file.
+
+########################
+# EXTERNAL cache entries
+########################
+
+SET (BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)
+
+SET (BUILD_TESTING ON CACHE BOOL "Build HDF4 Unit Testing" FORCE)
+
+SET (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
+
+SET (HDF4_BUILD_EXAMPLES ON CACHE BOOL "Build HDF4 Library Examples" FORCE)
+
+SET (HDF4_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
+
+SET (HDF4_BUILD_TOOLS ON CACHE BOOL "Build HDF4 Tools" FORCE)
+
+SET (HDF4_BUILD_UTILS ON CACHE BOOL "Build HDF4 Library Utilities" FORCE)
+
+SET (HDF4_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE)
+
+SET (HDF4_ENABLE_NETCDF ON CACHE BOOL "Build HDF4 versions of NetCDF-3 APIS" FORCE)
+
+SET (HDF4_BUILD_XDR_LIB OFF CACHE BOOL "Build HDF4 XDR Library" FORCE)
+
+SET (HDF4_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
+
+SET (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
+
+SET (HDF4_ENABLE_JPEG_LIB_SUPPORT ON CACHE BOOL "Enable Jpeg library" FORCE)
+
+SET (HDF4_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
+
+SET (HDF4_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
+
+SET (HDF4_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
+
+SET (HDF4_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
+
+SET (HDF4_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker is used" FORCE)
+
+SET (HDF4_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+
+SET (HDF4_ENABLE_DEPRECATED_SYMBOLS ON CACHE BOOL "Enable deprecated public API symbols" FORCE)
+
+SET (HDF4_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+
+SET (HDF4_NO_PACKAGES ON CACHE BOOL "CPACK - Disable packaging" FORCE)
+
+SET (HDF4_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
+
+SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
+
+SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
+
+SET (JPEG_SVN_URL "http://svn.hdfgroup.uiuc.edu/jpeg/branches/jpeg8b" CACHE STRING "Use JPEG from HDF repository" FORCE)
+
+SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
+
+SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
+
+SET (JPEG_TGZ_NAME "JPEG8b.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE)
+
+SET (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Debug" FORCE)
+
+SET (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE)
+
+SET (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE)
+
+SET (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE)
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
new file mode 100644
index 0000000..53b3ee7
--- /dev/null
+++ b/config/cmake/runTest.cmake
@@ -0,0 +1,182 @@
+# runTest.cmake executes a command and captures the output in a file. File is then compared
+# against a reference file. Exit status of command can also be compared.
+cmake_policy(SET CMP0007 NEW)
+
+# arguments checking
+IF (NOT TEST_PROGRAM)
+  MESSAGE (FATAL_ERROR "Require TEST_PROGRAM to be defined")
+ENDIF (NOT TEST_PROGRAM)
+#IF (NOT TEST_ARGS)
+#  MESSAGE (STATUS "Require TEST_ARGS to be defined")
+#ENDIF (NOT TEST_ARGS)
+IF (NOT TEST_FOLDER)
+  MESSAGE ( FATAL_ERROR "Require TEST_FOLDER to be defined")
+ENDIF (NOT TEST_FOLDER)
+IF (NOT TEST_OUTPUT)
+  MESSAGE (FATAL_ERROR "Require TEST_OUTPUT to be defined")
+ENDIF (NOT TEST_OUTPUT)
+#IF (NOT TEST_EXPECT)
+#  MESSAGE (STATUS "Require TEST_EXPECT to be defined")
+#ENDIF (NOT TEST_EXPECT)
+#IF (NOT TEST_FILTER)
+#  MESSAGE (STATUS "Require TEST_FILTER to be defined")
+#ENDIF (NOT TEST_FILTER)
+IF (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
+  MESSAGE (FATAL_ERROR "Require TEST_REFERENCE to be defined")
+ENDIF (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
+
+IF (NOT TEST_ERRREF)
+  SET (ERROR_APPEND 1)
+ENDIF (NOT TEST_ERRREF)
+
+MESSAGE (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
+
+IF (TEST_ENV_VAR)
+  SET (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") 
+ENDIF (TEST_ENV_VAR)
+
+IF (NOT TEST_INPUT)
+  # run the test program, capture the stdout/stderr and the result var
+  EXECUTE_PROCESS (
+      COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
+      WORKING_DIRECTORY ${TEST_FOLDER}
+      RESULT_VARIABLE TEST_RESULT
+      OUTPUT_FILE ${TEST_OUTPUT}
+      ERROR_FILE ${TEST_OUTPUT}.err
+      OUTPUT_VARIABLE TEST_ERROR
+      ERROR_VARIABLE TEST_ERROR
+  )
+ELSE (NOT TEST_INPUT)
+  # run the test program with stdin, capture the stdout/stderr and the result var
+  EXECUTE_PROCESS (
+      COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
+      WORKING_DIRECTORY ${TEST_FOLDER}
+      RESULT_VARIABLE TEST_RESULT
+      INPUT_FILE ${TEST_INPUT}
+      OUTPUT_FILE ${TEST_OUTPUT}
+      ERROR_FILE ${TEST_OUTPUT}.err
+      OUTPUT_VARIABLE TEST_ERROR
+      ERROR_VARIABLE TEST_ERROR
+  )
+ENDIF (NOT TEST_INPUT)
+
+MESSAGE (STATUS "COMMAND Result: ${TEST_RESULT}")
+
+IF (ERROR_APPEND)
+  FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
+  FILE (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") 
+ENDIF (ERROR_APPEND)
+
+IF (TEST_APPEND)
+  FILE (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") 
+ENDIF (TEST_APPEND)
+
+# if the return value is !=${TEST_EXPECT} bail out
+IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+  MESSAGE ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}")
+ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+
+MESSAGE (STATUS "COMMAND Error: ${TEST_ERROR}")
+
+IF (TEST_MASK)
+  FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+  #STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified:  XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") 
+  STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:   <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") 
+  FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ENDIF (TEST_MASK)
+
+IF (TEST_FILTER)
+  FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+  STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") 
+  FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ENDIF (TEST_FILTER)
+
+IF (NOT TEST_SKIP_COMPARE)
+  IF (WIN32 AND NOT MINGW)
+    FILE (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
+    FILE (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
+  ENDIF (WIN32 AND NOT MINGW)
+
+  # now compare the output with the reference
+  EXECUTE_PROCESS (
+      COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
+      RESULT_VARIABLE TEST_RESULT
+  )
+  IF (NOT ${TEST_RESULT} STREQUAL 0)
+  SET (TEST_RESULT 0)
+  FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
+  LIST (LENGTH test_act len_act)
+  FILE (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
+  LIST (LENGTH test_ref len_ref)
+  IF (NOT ${len_act} STREQUAL "0")
+    MATH (EXPR _FP_LEN "${len_ref} - 1")
+    FOREACH (line RANGE 0 ${_FP_LEN})
+      LIST (GET test_act ${line} str_act)
+      LIST (GET test_ref ${line} str_ref)
+      IF (NOT "${str_act}" STREQUAL "${str_ref}")
+        IF (NOT "${str_act}" STREQUAL "")
+          SET (TEST_RESULT 1)
+          MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+         ENDIF (NOT "${str_act}" STREQUAL "")
+      ENDIF (NOT "${str_act}" STREQUAL "${str_ref}")
+    ENDFOREACH (line RANGE 0 ${_FP_LEN})
+  ENDIF (NOT ${len_act} STREQUAL "0")
+  IF (NOT ${len_act} STREQUAL ${len_ref})
+    SET (TEST_RESULT 1)
+  ENDIF (NOT ${len_act} STREQUAL ${len_ref})
+  ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+
+  MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
+
+  # again, if return value is !=0 scream and shout
+  IF (NOT ${TEST_RESULT} STREQUAL 0)
+    MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
+  ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+  
+  IF (TEST_ERRREF)
+    IF (WIN32 AND NOT MINGW)
+      FILE (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM)
+      FILE (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}")
+    ENDIF (WIN32 AND NOT MINGW)
+
+    # now compare the error output with the error reference
+    EXECUTE_PROCESS (
+        COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
+        RESULT_VARIABLE TEST_RESULT
+    )
+    IF (NOT ${TEST_RESULT} STREQUAL 0)
+    SET (TEST_RESULT 0)
+    FILE (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act)
+    LIST (LENGTH test_act len_act)
+    FILE (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref)
+    LIST (LENGTH test_ref len_ref)
+    MATH (EXPR _FP_LEN "${len_ref} - 1")
+    IF (NOT ${len_act} STREQUAL "0")
+      MATH (EXPR _FP_LEN "${len_ref} - 1")
+      FOREACH (line RANGE 0 ${_FP_LEN})
+        LIST (GET test_act ${line} str_act)
+        LIST (GET test_ref ${line} str_ref)
+        IF (NOT "${str_act}" STREQUAL "${str_ref}")
+          IF (NOT "${str_act}" STREQUAL "")
+            SET (TEST_RESULT 1)
+            MESSAGE ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+           ENDIF (NOT "${str_act}" STREQUAL "")
+        ENDIF (NOT "${str_act}" STREQUAL "${str_ref}")
+      ENDFOREACH (line RANGE 0 ${_FP_LEN})
+    ENDIF (NOT ${len_act} STREQUAL "0")
+    IF (NOT ${len_act} STREQUAL ${len_ref})
+      SET (TEST_RESULT 1)
+    ENDIF (NOT ${len_act} STREQUAL ${len_ref})
+    ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+
+    MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
+
+    # again, if return value is !=0 scream and shout
+    IF (NOT ${TEST_RESULT} STREQUAL 0)
+      MESSAGE (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}")
+    ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+  ENDIF (TEST_ERRREF)
+ENDIF (NOT TEST_SKIP_COMPARE)
+
+# everything went fine...
+MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
diff --git a/config/commence.am b/config/commence.am
new file mode 100644
index 0000000..b4bbdca
--- /dev/null
+++ b/config/commence.am
@@ -0,0 +1,43 @@
+## config/commence.am
+
+## (Use double hashes for copyright notice so that automake treats it as
+## comments and does not pass it to Makefile.in)
+## Copyright by The HDF Group.
+## Copyright by the Board of Trustees of the University of Illinois.
+## All rights reserved.
+##
+## This file is part of HDF. The full HDF 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 
+## http://hdfgroup.org/products/hdf4/doc/Copyright.html. If you do not have
+## access to either file, you may request a copy from help at hdfgroup.org.
+
+## Textually included in the beginning of every HDF4 Makefile.am.
+## Contains definitions, etc. used across multiple Makefiles.
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+
+if HDF_BUILD_XDR
+    XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+endif
+
+if HDF_BUILD_SHARED
+    AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+endif
+
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+CHECK_CLEANFILES = *.chkexe *.chklog
diff --git a/config/conclude.am b/config/conclude.am
new file mode 100644
index 0000000..699fc53
--- /dev/null
+++ b/config/conclude.am
@@ -0,0 +1,178 @@
+## config/conclude.am
+## (Use double hashes for copyright notice so that automake treats it as
+## comments and does not pass it to Makefile.in)
+## Copyright by The HDF Group.
+## 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://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have
+## access to either file, you may request a copy from help at hdfgroup.org.
+
+
+## Textually included at the end of most HDF5 Makefiles.am.
+## Contains build rules.
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TESTS = $(TEST_PROG) $(TEST_SCRIPT)
+
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS =
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+TEST_PROG_CHKEXE=$(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH=$(TEST_SCRIPT:=.chkexe_)
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+ 
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
diff --git a/config/examples.am b/config/examples.am
new file mode 100644
index 0000000..55b47cc
--- /dev/null
+++ b/config/examples.am
@@ -0,0 +1,105 @@
+## config/examples.am
+## (Use double hashes for copyright notice so that automake treats it as
+## comments and does not pass it to Makefile.in)
+## Copyright by The HDF Group.
+## All rights reserved.
+##
+## This file is part of HDF.  The full HDF 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 HDF document set and
+## is linked from the top-level documents page.  It can also be found at
+## http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have
+## access to either file, you may request a copy from help at hdfgroup.org.
+
+# We can't tell automake about example programs, because they need to be
+# built using h4cc (or h4fc, etc.) instead of the standard compilers.
+# This creates some extra work for us.
+
+## The Makefile.am that includes this boilerplate needs to define the
+## following:
+##
+## TEST_PROG
+## We assume that all test programs in this directory are examples.
+##
+## INSTALL_FILES
+## The source files that the examples use which should be installed.
+##
+## EXAMPLEDIR
+## The directory into which examples should be installed. 
+##
+## Build rules for $(EXTRA_PROG).
+## Dependencies for example programs.
+## Automake will supply neither of these.
+##
+
+# Assume that all tests in this directory are examples, and tell
+# conclude.am when to build them.
+EXTRA_PROG = $(EXAMPLE_PROG)
+
+# We need to tell automake what to clean
+MOSTLYCLEANFILES=*.o $(EXAMPLE_PROG)
+CHECK_CLEANFILES+= *.hdf
+CLEANFILES=$(EXAMPLE_PROG)
+
+# How to create EXAMPLEDIR if it doesn't already exist
+$(EXAMPLEDIR):
+	mkdir -p $@
+
+# Install and uninstall rules.  We install the source files, not the
+# example programs themselves.
+install-data-local:
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-local:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+install-examples: $(EXAMPLEDIR) 
+	@for f in X $(INSTALL_FILES); do                                     \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_FILES); do                                 \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	  fi;                                                                \
+	done
+
+uninstall-examples:
+	@if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then           \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES);              \
+	fi
+	@if test -n "$(INSTALL_SCRIPT_FILES)" -a -d $(EXAMPLEDIR); then    \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_SCRIPT_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_SCRIPT_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_SCRIPT_FILES);       \
+	fi
+
+installcheck-local:
+	@if test "$(STATIC_SHARED)" = "static, shared"; then               \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	  $(MAKE) $(AM_MAKEFLAGS) clean;                                   \
+	  H5CCFLAGS="" $(MAKE) $(AM_MAKEFLAGS) check;                      \
+	elif test "$(STATIC_SHARED)" = "shared"; then                      \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	else                                                               \
+	  $(MAKE) $(AM_MAKEFLAGS) check;                                   \
+	fi
+
diff --git a/config/freebsd b/config/freebsd
new file mode 100644
index 0000000..f69f062
--- /dev/null
+++ b/config/freebsd
@@ -0,0 +1,160 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=gcc
+  CC_BASENAME=gcc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=f77
+  F77_BASENAME=f77
+fi
+
+if test "X-$CXX" = "X-"; then
+  CXX=g++
+  CXX_BASENAME=g++
+fi
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -ansi -Wall -pedantic "
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-ansi -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes -Wnested-externs -pedantic -O2"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS -ansi"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  g77)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  *)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+case $CXX_BASENAME in 
+  g++)
+    CXXFLAGS="$CXXFLAGS"
+    DEBUG_CXXFLAGS="-g -fverbose-asm"
+    PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+
+  *)
+    CXXFLAGS="$CXXFLAGS -ansi"
+    DEBUG_CXXFLAGS="-g"
+    PROD_CXXFLAGS="-O"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+esac
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/i686-pc-cygwin b/config/i686-pc-cygwin
new file mode 100644
index 0000000..54763e0
--- /dev/null
+++ b/config/i686-pc-cygwin
@@ -0,0 +1,175 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=gcc
+  CC_BASENAME=gcc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=g77
+  F77_BASENAME=g77
+
+else
+    case $F77 in
+        # The PGI and Intel compilers are automatically detected below
+        f95*|pgf90*)
+            ;;
+
+        *)
+            # Figure out which compiler we are using: pgf90 or Absoft f95
+            RM='rm -f'
+            tmpfile=/tmp/cmpver.$$
+            $F77 -V >$tmpfile
+            if test -s "$tmpfile"; then 
+                if( grep -s 'Absoft' $tmpfile > /dev/null) then
+                    F77_BASENAME=f95
+                fi 
+                if( grep -s 'g95' $tmpfile > /dev/null) then
+                    F77_BASENAME=g95
+                fi 
+                if( grep -s 'pgf90' $tmpfile > /dev/null) then
+                    F77_BASENAME=pgf90
+                fi 
+            fi
+            $RM $tmpfile
+            ;;
+    esac
+fi
+
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -fverbose-asm"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O3 -fomit-frame-pointer"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  g77)
+    FFLAGS="$FFLAGS -Wsign-compare"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  f95)
+    CFLAGS="$CFLAGS -DH4_ABSOFT"
+    FFLAGS="$FFLAGS -YEXT_NAMES=UCS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  g95)
+    CFLAGS="$CFLAGS"
+    FFLAGS="$FFLAGS -i4"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/linux-gnu b/config/linux-gnu
new file mode 100644
index 0000000..f29e77a
--- /dev/null
+++ b/config/linux-gnu
@@ -0,0 +1,245 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=gcc
+  CC_BASENAME=gcc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=gfortran
+  F77_BASENAME=gfortran
+
+else
+    case $F77 in
+        # The PGI and Intel compilers are automatically detected below
+        f95*|pgf90*)
+            ;;
+
+        *)
+            # Figure out which compiler we are using: pgf90 or Absoft f95
+            RM='rm -f'
+            tmpfile=/tmp/cmpver.$$
+            $F77 -V >$tmpfile
+            if test -s "$tmpfile"; then 
+                if( grep -s 'Absoft' $tmpfile > /dev/null) then
+                    F77_BASENAME=f95
+                fi 
+                if( grep -s 'g95' $tmpfile > /dev/null) then
+                    F77_BASENAME=g95
+                fi 
+                if( grep -s 'pgf90' $tmpfile > /dev/null) then
+                    F77_BASENAME=pgf90
+                fi 
+            fi
+            $RM $tmpfile
+            ;;
+    esac
+fi
+
+
+# compiler version strings
+case $CC in
+    # whatever matches *pgcc* will also match *gcc*, so this one must come first
+    *pgcc*)
+        cc_version_info=`$CC $CFLAGS $H5_CFLAGS -V 2>&1 | grep 'pgcc'`
+        ;;
+
+    *gcc*)
+        cc_version_info=`$CC $CFLAGS $H5_CFLAGS --version 2>&1 | grep -v 'PathScale' |\
+            grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'`
+        ;;
+
+    *icc*)
+        cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -V 2>&1 | grep 'Version' |\
+            sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'`
+        ;;
+
+    *)
+        echo "No match to get cc_version_info for $CC"
+        ;;
+esac
+
+# get fortran version info
+case $F77 in
+    *gfortran*)
+        fc_version_info=`$F77 $FFLAGS --version 2>&1 |\
+            grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'`
+        ;;
+
+    *ifc*|*ifort*)
+        fc_version_info=`$F77 $FFLAGS -V 2>&1 | grep 'Version' |\
+            sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'`
+        ;;
+
+    *f95*)
+        # Figure out which compiler we are using: pgf90 or Absoft f95
+        RM='rm -f'
+        tmpfile=/tmp/cmpver.$$
+        $F77 -V >$tmpfile
+        if test -s "$tmpfile"; then
+            if( grep -s 'Absoft' $tmpfile > /dev/null) then
+                FC_BASENAME=f95
+            fi
+        fi
+        $RM $tmpfile
+        fc_version_info=`$F77 -V | grep Absoft`
+        ;;
+
+    *g95*|*g77*)
+        fc_version_info=`$F77 $FFLAGS --version 2>&1 |\
+            grep 'GCC'`
+        ;;
+
+    *pgf90*)
+        fc_version_info=`$F77 $FFLAGS -V 2>&1 | grep 'pgf90'`
+        ;;
+
+     *)
+        echo "No match to get fc_version_info for $F77"
+        ;;
+esac
+
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and gfortran compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -fverbose-asm"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O3 -fomit-frame-pointer"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  gfortran)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  g77)
+    FFLAGS="$FFLAGS "
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  f95)
+    CFLAGS="$CFLAGS"
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  g95)
+    CFLAGS="$CFLAGS"
+    FFLAGS="$FFLAGS -i4"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/powerpc-apple b/config/powerpc-apple
new file mode 100644
index 0000000..ed94a9d
--- /dev/null
+++ b/config/powerpc-apple
@@ -0,0 +1,172 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=gcc
+  CC_BASENAME=gcc
+fi
+#Make IBM xlf compiler a deafult
+if test "X-$F77" = "X-"; then
+  F77=xlf
+  F77_BASENAME=xlf
+
+else
+    case $F77 in
+        # The PGI and Intel compilers are automatically detected below
+        xlf*|f95*)
+            ;;
+
+        *)
+            # Figure out which compiler we are using: pgf90 or Absoft f95
+            RM='rm -f'
+            tmpfile=/tmp/cmpver.$$
+            $F77 -V >$tmpfile
+            if test -s "$tmpfile"; then 
+            #Absoft compiler f95 doesn't recognize -V flag; we will use
+            #the error message it produces to identify the compiler
+            #    if( grep -s 'Absoft' $tmpfile > /dev/null) then
+                if( grep -s 'ERROR: No input files' $tmpfile > /dev/null) then
+                    F77_BASENAME=f95
+                fi 
+                if( grep -s 'IBM XL' $tmpfile > /dev/null) then
+                    F77_BASENAME=xlf
+                fi 
+            fi
+            $RM $tmpfile
+            ;;
+    esac
+fi
+
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -ansi -Wall -pedantic "
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-ansi -Wall -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes -Wnested-externs -pedantic -O2"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS -ansi"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  xlf)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  f95)
+    #
+    # Assume Absoft compiler
+    #
+    # Set a flag for compiling C stubs
+    CFLAGS="$CFLAGS -DH4_ABSOFT"
+    FFLAGS="$FFLAGS -YEXT_NAMES=UCS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/powerpc-ibm-aix5.x b/config/powerpc-ibm-aix5.x
new file mode 100644
index 0000000..9b72b0c
--- /dev/null
+++ b/config/powerpc-ibm-aix5.x
@@ -0,0 +1,160 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=xlc
+  CC_BASENAME=xlc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=xlf
+  F77_BASENAME=xlf
+fi
+
+if test "X-$CXX" = "X-"; then
+  CXX=xlC
+  CXX_BASENAME=xlC
+fi
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -fverbose-asm"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O3 -fomit-frame-pointer"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS -D_ALL_SOURCE"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  g77)
+    FFLAGS="$FFLAGS -Wsign-compare"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  *)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+case $CXX_BASENAME in 
+  g++)
+    CXXFLAGS="$CXXFLAGS"
+    DEBUG_CXXFLAGS="-g -fverbose-asm"
+    PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+
+  *)
+    CXXFLAGS="$CXXFLAGS -ansi"
+    DEBUG_CXXFLAGS="-g"
+    PROD_CXXFLAGS="-O"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+esac
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/powerpc64-linux-gnu b/config/powerpc64-linux-gnu
new file mode 100644
index 0000000..a431fc1
--- /dev/null
+++ b/config/powerpc64-linux-gnu
@@ -0,0 +1,152 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=gcc
+  CC_BASENAME=gcc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=gfortran
+  F77_BASENAME=gfortran
+fi
+
+
+# compiler version strings
+case $CC in
+
+    *gcc*)
+        cc_version_info=`$CC $CFLAGS $H5_CFLAGS --version 2>&1 | grep -v 'PathScale' |\
+            grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'`
+        ;;
+
+    *)
+        echo "No match to get cc_version_info for $CC"
+        ;;
+esac
+
+# get fortran version info
+case $F77 in
+    *gfortran*)
+        fc_version_info=`$F77 $FFLAGS --version 2>&1 |\
+            grep 'GCC' | sed 's/\(.*(GCC) [-a-z0-9\. ]*\).*/\1/'`
+        ;;
+
+     *)
+        echo "No match to get fc_version_info for $F77"
+        ;;
+esac
+
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and gfortran compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -fverbose-asm"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O2 -fomit-frame-pointer"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  gfortran)
+    FFLAGS="$FFLAGS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+esac
+
diff --git a/config/solaris2.x b/config/solaris2.x
new file mode 100644
index 0000000..36ca7a2
--- /dev/null
+++ b/config/solaris2.x
@@ -0,0 +1,186 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=cc
+  CC_BASENAME=cc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=f77
+  F77_BASENAME=f77
+fi
+
+if test "X-$CXX" = "X-"; then
+  CXX=CC
+  CXX_BASENAME=CC
+fi
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS -ansi"
+    DEBUG_CFLAGS="-g "
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O3 "
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -v"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-xO2"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  g77)
+    FFLAGS="$FFLAGS -Wsign-compare"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  *)
+    FFLAGS="$FFLAGS -O"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+case $CXX_BASENAME in 
+  g++)
+    CXXFLAGS="$CXXFLAGS"
+    DEBUG_CXXFLAGS="-g -fverbose-asm"
+    PROD_CXXFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+
+  *)
+    CXXFLAGS="$CXXFLAGS -ansi"
+    DEBUG_CXXFLAGS="-g"
+    PROD_CXXFLAGS="-O"
+    PROFILE_CXXFLAGS="-pg"
+    ;;
+esac
+
+# compiler version strings
+case $CC in
+    *cc*)
+        cc_version_info=`$CC $CFLAGS $H5_CFLAGS -V 2>&1 | grep 'Sun' |\
+            sed 's/.*\(Sun.*Sun.*\)/\1 /'`
+        ;;
+
+    *)
+        echo "No match to get cc_version_info for $CC"
+        ;;
+esac
+echo "C compiler '$CC' is $cc_version_info"
+
+case $F77 in
+    # The PGI and Intel compilers are automatically detected below
+    *f90*|*f77*)
+        fc_version_info=`$F77 $FFLAGS $H5_FFLAGS -V 2>&1 | grep 'Sun' |\
+            sed 's/.*\(Sun.*Sun.*\)/\1 /'`
+        ;;
+
+     *)
+        echo "No match to get fc_version_info for $F77"
+        ;;
+esac
+echo "Fortran compiler '$F77' is $fc_version_info"
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/config/x86_64-pc-cygwin b/config/x86_64-pc-cygwin
new file mode 100644
index 0000000..54763e0
--- /dev/null
+++ b/config/x86_64-pc-cygwin
@@ -0,0 +1,175 @@
+#                                                   -*- shell-script -*-
+#
+# This file is part of the HDF4 build script. It is processed shortly
+# after configure starts and defines, among other things, flags for
+# the various compilation modes.
+
+# Choosing C, Fortran, and C++ Compilers
+# --------------------------------------
+#
+# The user should be able to specify the compiler by setting the CC, F77,
+# and CXX environment variables to the name of the compiler and any
+# switches it requires for proper operation. If CC is unset then this
+# script may set it. If CC is unset by time this script completes then
+# configure will try `gcc' and `cc' in that order (perhaps some others
+# too).
+#
+# Note: Code later in this file may depend on the value of $CC_BASENAME
+#       in order to distinguish between different compilers when
+#       deciding which compiler command-line switches to use.  This
+#       variable is set based on the incoming value of $CC and is only
+#       used within this file.
+
+if test "X-$CC" = "X-"; then
+  CC=gcc
+  CC_BASENAME=gcc
+fi
+
+if test "X-$F77" = "X-"; then
+  F77=g77
+  F77_BASENAME=g77
+
+else
+    case $F77 in
+        # The PGI and Intel compilers are automatically detected below
+        f95*|pgf90*)
+            ;;
+
+        *)
+            # Figure out which compiler we are using: pgf90 or Absoft f95
+            RM='rm -f'
+            tmpfile=/tmp/cmpver.$$
+            $F77 -V >$tmpfile
+            if test -s "$tmpfile"; then 
+                if( grep -s 'Absoft' $tmpfile > /dev/null) then
+                    F77_BASENAME=f95
+                fi 
+                if( grep -s 'g95' $tmpfile > /dev/null) then
+                    F77_BASENAME=g95
+                fi 
+                if( grep -s 'pgf90' $tmpfile > /dev/null) then
+                    F77_BASENAME=pgf90
+                fi 
+            fi
+            $RM $tmpfile
+            ;;
+    esac
+fi
+
+
+# C, Fortran, and C++ Compiler and Preprocessor Flags
+# ---------------------------------------------------
+#
+# - Flags that end with `_CFLAGS' are always passed to the C compiler.
+# - Flags that end with `_FFLAGS' are always passed to the Fortran
+#   compiler.
+# - Flags that end with `_CXXFLAGS' are always passed to the C++ compiler.
+# - Flags that end with `_CPPFLAGS' are passed to the C and C++ compilers
+#   when compiling but not when linking.
+#
+#   DEBUG_CFLAGS
+#   DEBUG_FFLAGS
+#   DEBUG_CXXFLAGS
+#   DEBUG_CPPFLAGS  - Flags to pass to the compiler to create a
+#                     library suitable for use with debugging
+#			          tools. Usually this list will exclude
+#                     optimization switches (like `-O') and include
+#                     switches that turn on symbolic debugging support
+#                     (like `-g').
+#
+#   PROD_CFLAGS
+#   PROD_FFLAGS
+#   PROD_CXXFLAGS
+#   PROD_CPPFLAGS   - Flags to pass to the compiler to create a
+#                     production version of the library. These
+#                     usualy exclude symbolic debugging switches (like
+#                     `-g') and include optimization switches (like
+#                     `-O').
+#
+#   PROFILE_CFLAGS
+#   PROFILE_FFLAGS
+#   PROFILE_CXXFLAGS
+#   PROFILE_CPPFLAGS- Flags to pass to the compiler to create a
+#                     library suitable for performance testing (like
+#                     `-pg').  This may or may not include debugging or
+#                     production flags.
+#			
+#   FFLAGS
+#   CFLAGS          - Flags can be added to these variable which
+#                     might already be partially initialized. These
+#                     flags will always be passed to the compiler and
+#                     should include switches to turn on full warnings.
+#
+#                     WARNING: flags do not have to be added to the CFLAGS
+#                     or FFLAGS variable if the compiler is the GNU gcc
+#                     and g77 compiler.
+#
+#                     FFLAGS and CFLAGS should contain *something* or else
+#                     configure will probably add `-g'. For most systems
+#                     this isn't a problem but some systems will disable
+#                     optimizations in favor of the `-g'. The configure
+#                     script will remove the `-g' flag in production mode
+#                     only.
+#
+# These flags should be set according to the compiler being used.
+# There are two ways to check the compiler. You can try using `-v' or
+# `--version' to see if the compiler will print a version string.  You
+# can use the value of $FOO_BASENAME which is the base name of the
+# first word in $FOO, where FOO is either CC, F77, or CXX (note that the
+# value of CC may have changed above).
+
+case $CC_BASENAME in
+  gcc)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g -fverbose-asm"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O3 -fomit-frame-pointer"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+
+  *)
+    CFLAGS="$CFLAGS"
+    DEBUG_CFLAGS="-g"
+    DEBUG_CPPFLAGS=
+    PROD_CFLAGS="-O"
+    PROD_CPPFLAGS=
+    PROFILE_CFLAGS="-pg"
+    PROFILE_CPPFLAGS=
+    ;;
+esac
+
+case $F77_BASENAME in 
+  g77)
+    FFLAGS="$FFLAGS -Wsign-compare"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O3 -fomit-frame-pointer"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  f95)
+    CFLAGS="$CFLAGS -DH4_ABSOFT"
+    FFLAGS="$FFLAGS -YEXT_NAMES=UCS"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+
+  g95)
+    CFLAGS="$CFLAGS"
+    FFLAGS="$FFLAGS -i4"
+    DEBUG_FFLAGS="-g"
+    PROD_FFLAGS="-O"
+    PROFILE_FFLAGS="-pg"
+    ;;
+esac
+
+# Overriding Configure Tests
+# --------------------------
+#
+# Values for overriding configuration tests when cross compiling.
+
+# Set this to `yes' or `no' depending on whether the target is big
+# endian or little endian.
+#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
diff --git a/configure b/configure
new file mode 100755
index 0000000..4fa35d1
--- /dev/null
+++ b/configure
@@ -0,0 +1,26579 @@
+#! /bin/sh
+# From configure.ac Id: configure.ac 6079 2014-02-08 00:29:03Z bmribler .
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for HDF 4.2.10.
+#
+# Report bugs to <help at hdfgroup.org>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf at gnu.org and help at hdfgroup.org
+$0: about your system, including any error possibly output
+$0: before this message. Then install a modern shell, or
+$0: manually run the script under such a shell if you do
+$0: have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -pR'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -pR'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -pR'
+  fi
+else
+  as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='HDF'
+PACKAGE_TARNAME='hdf'
+PACKAGE_VERSION='4.2.10'
+PACKAGE_STRING='HDF 4.2.10'
+PACKAGE_BUGREPORT='help at hdfgroup.org'
+PACKAGE_URL=''
+
+ac_unique_file="hdf/src/atom.c"
+ac_default_prefix=`pwd`/hdf4
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+DEPRECATED_SYMBOLS
+F77_VERSION
+CC_VERSION
+HDF_BUILD_SHARED_FALSE
+HDF_BUILD_SHARED_TRUE
+SETX
+CONFIG_MODE
+CONFIG_USER
+CONFIG_DATE
+H4_VERSION
+HDF_BUILD_XDR_FALSE
+HDF_BUILD_XDR_TRUE
+BUILD_SHARED_SZIP_CONDITIONAL_FALSE
+BUILD_SHARED_SZIP_CONDITIONAL_TRUE
+SZIP_INFO
+LL_PATH
+USE_COMP_SZIP
+CXXCPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+DLLTOOL
+OBJDUMP
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+LIBTOOL
+LT_STATIC_EXEC
+STATIC_EXEC
+UNAME_INFO
+enable_static
+enable_shared
+SHARED_EXTENSION
+STATIC_SHARED
+TBL
+NEQN
+DIFF
+LEX
+YACC
+AR
+LN_S
+BUILD_FORTRAN
+HDF_BUILD_FORTRAN_FALSE
+HDF_BUILD_FORTRAN_TRUE
+FLIBS
+ac_ct_F77
+FFLAGS
+F77
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+BUILD_NETCDF
+HDF_BUILD_NETCDF_FALSE
+HDF_BUILD_NETCDF_TRUE
+TEST_FORTRAN_NETCDF
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+enable_netcdf
+enable_dependency_tracking
+enable_fortran
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+enable_static_exec
+with_fnord
+with_zlib
+with_jpeg
+with_szlib
+enable_hdf4_xdr
+enable_production
+enable_deprecated_symbols
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+F77
+FFLAGS
+CXXCPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures HDF 4.2.10 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/hdf]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of HDF 4.2.10:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode
+                          enable make rules and dependencies not useful (and
+                          sometimes confusing) to the casual installer
+  --enable-netcdf         Build HDF4 versions of NetCDF APIs (version 2.3.2)
+                          [default=yes]
+  --enable-dependency-tracking
+                          do not reject slow dependency extractors
+  --disable-dependency-tracking
+                          speeds up one-time build
+  --enable-fortran        Build Fortran into library [default=yes]
+  --enable-shared[=PKGS]  build shared libraries [default=no]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-static-exec    Install only statically linked executables
+                          [default=no]
+  --enable-hdf4-xdr       Build xdr library from code in HDF4 source. Not
+                          supported for 64 bit mode. [default="no"]
+  --enable-production     Determines how to run the compiler.
+  --enable-deprecated-symbols
+                          Enable deprecated public API symbols [default=yes]
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
+
+ For the following --with-xxx options, you can specify where the header
+ files and libraries are in two different ways:
+
+    --with-xxx=INC,LIB - Specify individually the include directory and
+                         library directory separated by a comma
+    --with-xxx=DIR     - Specify only the directory which contains the
+                         include/ and lib/ subdirectories
+
+  --with-zlib=DIR         Use zlib library [default=yes]
+  --with-jpeg=DIR         Use jpeg library [default=yes]
+  --with-szlib=DIR        Use szlib library [default=no]
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
+  CXXCPP      C++ preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <help at hdfgroup.org>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+HDF configure 4.2.10
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_f77_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_f77_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_f77_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+
+# ac_fn_f77_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_f77_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_f77_try_link
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## -------------------------------- ##
+## Report this to help at hdfgroup.org ##
+## -------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by HDF $as_me 4.2.10, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_aux_dir=
+for ac_dir in bin "$srcdir"/bin; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in bin \"$srcdir\"/bin" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+ac_config_headers="$ac_config_headers hdf/src/h4config.h"
+
+
+
+## AM_INIT_AUTOMAKE takes a list of options that should be applied to
+## every Makefile.am when automake is run.
+am__api_version='1.12'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
+    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$*" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$*" != "X $srcdir/configure conftest.file" \
+	&& test "$*" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment" "$LINENO" 5
+     fi
+     if test "$2" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if ${ac_cv_path_mkdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='hdf'
+ VERSION='4.2.10'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+## AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies
+## for Makefiles, configure, etc.  If AM_MAINTAINER_MODE
+## is *not* included here, these files will be rebuilt if out of date.
+## This is a problem because if users try to build on a machine with
+## the wrong versions of autoconf and automake, these files will be
+## rebuilt with the wrong versions and bad things can happen.
+## Also, CVS doesn't preserve dependencies between timestamps, so
+## Makefiles will often think rebuilding needs to occur when it doesn't.
+## Developers should './configure --enable-maintainer-mode' to turn on
+## rebuild rules.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+   if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+## ----------------------------------------------------------------------
+## Set prefix default (install directory) to a directory in the build area.
+## This allows multiple src-dir builds within one host.
+
+
+## Run post processing on files created by configure.
+## src/h4config.h:
+## libhdf4.settings:
+## Remove all lines begun with "#" which are generated by CONDITIONAL's of
+## configure.
+ac_config_commands="$ac_config_commands h4config"
+
+
+## ======================================================================
+## Information on the package
+## ======================================================================
+
+## Dump all shell variables values.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking shell variables initial values" >&5
+$as_echo_n "checking shell variables initial values... " >&6; }
+set >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if basename works" >&5
+$as_echo_n "checking if basename works... " >&6; }
+BASENAME_TEST="`basename /foo/bar/baz/qux/basename_works`"
+if test $BASENAME_TEST != "basename_works"; then
+  as_fn_error $? "basename program doesn't work" "$LINENO" 5
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if xargs works" >&5
+$as_echo_n "checking if xargs works... " >&6; }
+XARGS_TEST="`echo /foo/bar/baz/qux/xargs_works | xargs basename`"
+if test $XARGS_TEST != "xargs_works"; then
+  as_fn_error $? "xargs program doesn't work" "$LINENO" 5
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+
+## Source any special files that we need. These files normally aren't
+## present but can be used by the maintainers to fine tune things like
+## turning on debug or profiling flags for the compiler. The search order
+## is:
+##
+##         CPU-VENDOR-OS
+##         VENDOR-OS
+##         CPU-OS
+##         CPU-VENDOR
+##         OS
+##         VENDOR
+##         CPU
+##
+## If the `OS' ends with a version number then remove it. For instance,
+## `freebsd3.1' would become `freebsd'
+##
+case "$host_os" in
+  aix4.*)       host_os_novers="aix4.x"     ;;
+  aix5.*)       host_os_novers="aix5.x"     ;;
+  darwin10.*)   host_os_novers="darwin10.x" ;;
+  darwin11.*)   host_os_novers="darwin11.x" ;;
+  darwin12.*)   host_os_novers="darwin12.x" ;;
+  freebsd*)     host_os_novers="freebsd"    ;;
+  solaris2.*)   host_os_novers="solaris2.x" ;;
+  *)            host_os_novers="$host_os"   ;;
+esac
+
+host_config="none"
+for f in $host_cpu-$host_vendor-$host_os        \
+         $host_cpu-$host_vendor-$host_os_novers \
+         $host_vendor-$host_os                  \
+         $host_vendor-$host_os_novers           \
+         $host_cpu-$host_os                     \
+         $host_cpu-$host_os_novers              \
+         $host_cpu-$host_vendor                 \
+         $host_os                               \
+         $host_os_novers                        \
+         $host_vendor                           \
+         $host_cpu ; do
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for config $f" >&5
+$as_echo_n "checking for config $f... " >&6; }
+  if test -f "$srcdir/config/$f"; then
+    host_config=$srcdir/config/$f
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+    break
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+done
+if test "X$host_config" != "Xnone"; then
+  CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
+  F77_BASENAME="`echo $F77 | cut -f1 -d' ' | xargs basename 2>/dev/null`"
+  CXX_BASENAME="`echo $CXX | cut -f1 -d' ' | xargs basename 2>/dev/null`"
+  . $host_config
+fi
+
+## ======================================================================
+## Checks for NetCDF-2.3.2 support
+## ======================================================================
+
+# We disable Fortran netCDF APIs and their testing when --disable-netcdf is used.
+# Let's define a proper variable to be used in mfhdf/testfortran.sh.in to run
+# the netCDF Fortran APIs test program "ftest".
+ TEST_FORTRAN_NETCDF="yes"
+
+# Check whether --enable-netcdf was given.
+if test "${enable_netcdf+set}" = set; then :
+  enableval=$enable_netcdf;
+else
+  enableval="yes"
+fi
+
+
+case "$enableval" in
+  yes)
+    BUILD_NETCDF="yes"
+
+$as_echo "#define HAVE_NETCDF 1" >>confdefs.h
+
+    ;;
+  no)
+    BUILD_NETCDF="no"
+    TEST_FORTRAN_NETCDF="no"
+    ;;
+esac
+ if test "X$BUILD_NETCDF" = "Xyes"; then
+  HDF_BUILD_NETCDF_TRUE=
+  HDF_BUILD_NETCDF_FALSE='#'
+else
+  HDF_BUILD_NETCDF_TRUE='#'
+  HDF_BUILD_NETCDF_FALSE=
+fi
+
+
+
+## ======================================================================
+## Checks for programs
+## ======================================================================
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+  am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if ${ac_cv_prog_CPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
+# Check whether --enable-fortran was given.
+if test "${enable_fortran+set}" = set; then :
+  enableval=$enable_fortran;
+else
+  enableval="yes"
+fi
+
+
+case "$enableval" in
+  yes)
+    BUILD_FORTRAN="yes"
+    ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $F77" >&5
+$as_echo "$F77" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_F77="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_F77" >&5
+$as_echo "$ac_ct_F77" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_F77" && break
+done
+
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    F77=$ac_ct_F77
+  fi
+fi
+
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran 77 compiler" >&5
+$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; }
+if ${ac_cv_f77_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+if ac_fn_f77_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_compiler_gnu" >&5
+$as_echo "$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 accepts -g" >&5
+$as_echo_n "checking whether $F77 accepts -g... " >&6; }
+if ${ac_cv_prog_f77_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  FFLAGS=-g
+cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_f77_try_compile "$LINENO"; then :
+  ac_cv_prog_f77_g=yes
+else
+  ac_cv_prog_f77_g=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_g" >&5
+$as_echo "$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+if test $ac_compiler_gnu = yes; then
+  G77=yes
+else
+  G77=
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get verbose linking output from $F77" >&5
+$as_echo_n "checking how to get verbose linking output from $F77... " >&6; }
+if ${ac_cv_prog_f77_v+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_f77_try_compile "$LINENO"; then :
+  ac_cv_prog_f77_v=
+# Try some options frequently used verbose output
+for ac_verb in -v -verbose --verbose -V -\#\#\#; do
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran compiler in order to get
+# "verbose" output that we can then parse for the Fortran linker
+# flags.
+ac_save_FFLAGS=$FFLAGS
+FFLAGS="$FFLAGS $ac_verb"
+eval "set x $ac_link"
+shift
+$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5
+# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH,
+# LIBRARY_PATH; skip all such settings.
+ac_f77_v_output=`eval $ac_link 5>&1 2>&1 |
+  sed '/^Driving:/d; /^Configured with:/d;
+      '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"`
+$as_echo "$ac_f77_v_output" >&5
+FFLAGS=$ac_save_FFLAGS
+
+rm -rf conftest*
+
+# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
+# /foo, /bar, and /baz are search directories for the Fortran linker.
+# Here, we change these into -L/foo -L/bar -L/baz (and put it first):
+ac_f77_v_output="`echo $ac_f77_v_output |
+	grep 'LPATH is:' |
+	sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_f77_v_output"
+
+# FIXME: we keep getting bitten by quoted arguments; a more general fix
+#        that detects unbalanced quotes in FLIBS should be implemented
+#        and (ugh) tested at some point.
+case $ac_f77_v_output in
+  # With xlf replace commas with spaces,
+  # and remove "-link" and closing parenthesis.
+  *xlfentry*)
+    ac_f77_v_output=`echo $ac_f77_v_output |
+      sed '
+        s/,/ /g
+        s/ -link / /g
+        s/) *$//
+      '
+    ` ;;
+
+  # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
+  # $LIBS confuse us, and the libraries appear later in the output anyway).
+  *mGLOB_options_string*)
+    ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;;
+
+  # Portland Group compiler has singly- or doubly-quoted -cmdline argument
+  # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
+  # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
+  *-cmdline\ * | *-ignore\ * | *-def\ *)
+    ac_f77_v_output=`echo $ac_f77_v_output | sed "\
+	s/-cmdline  *'[^']*'/ /g; s/-cmdline  *\"[^\"]*\"/ /g
+	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
+	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
+
+  # If we are using fort77 (the f2c wrapper) then filter output and delete quotes.
+  *fort77*f2c*gcc*)
+    ac_f77_v_output=`echo "$ac_f77_v_output" | sed -n '
+        /:[	 ]\+Running[	 ]\{1,\}"gcc"/{
+          /"-c"/d
+          /[.]c"*/d
+          s/^.*"gcc"/"gcc"/
+          s/"//gp
+        }'` ;;
+
+  # If we are using Cray Fortran then delete quotes.
+  *cft90*)
+    ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;;
+esac
+
+
+  # look for -l* and *.a constructs in the output
+  for ac_arg in $ac_f77_v_output; do
+     case $ac_arg in
+	[\\/]*.a | ?:[\\/]*.a | -[lLRu]*)
+	  ac_cv_prog_f77_v=$ac_verb
+	  break 2 ;;
+     esac
+  done
+done
+if test -z "$ac_cv_prog_f77_v"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine how to obtain linking information from $F77" >&5
+$as_echo "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;}
+fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compilation failed" >&5
+$as_echo "$as_me: WARNING: compilation failed" >&2;}
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_v" >&5
+$as_echo "$ac_cv_prog_f77_v" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 libraries of $F77" >&5
+$as_echo_n "checking for Fortran 77 libraries of $F77... " >&6; }
+if ${ac_cv_f77_libs+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$FLIBS" != "x"; then
+  ac_cv_f77_libs="$FLIBS" # Let the user override the test.
+else
+
+cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran compiler in order to get
+# "verbose" output that we can then parse for the Fortran linker
+# flags.
+ac_save_FFLAGS=$FFLAGS
+FFLAGS="$FFLAGS $ac_cv_prog_f77_v"
+eval "set x $ac_link"
+shift
+$as_echo "$as_me:${as_lineno-$LINENO}: $*" >&5
+# gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH,
+# LIBRARY_PATH; skip all such settings.
+ac_f77_v_output=`eval $ac_link 5>&1 2>&1 |
+  sed '/^Driving:/d; /^Configured with:/d;
+      '"/^[_$as_cr_Letters][_$as_cr_alnum]*=/d"`
+$as_echo "$ac_f77_v_output" >&5
+FFLAGS=$ac_save_FFLAGS
+
+rm -rf conftest*
+
+# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
+# /foo, /bar, and /baz are search directories for the Fortran linker.
+# Here, we change these into -L/foo -L/bar -L/baz (and put it first):
+ac_f77_v_output="`echo $ac_f77_v_output |
+	grep 'LPATH is:' |
+	sed 's|.*LPATH is\(: *[^ ]*\).*|\1|;s|: */| -L/|g'` $ac_f77_v_output"
+
+# FIXME: we keep getting bitten by quoted arguments; a more general fix
+#        that detects unbalanced quotes in FLIBS should be implemented
+#        and (ugh) tested at some point.
+case $ac_f77_v_output in
+  # With xlf replace commas with spaces,
+  # and remove "-link" and closing parenthesis.
+  *xlfentry*)
+    ac_f77_v_output=`echo $ac_f77_v_output |
+      sed '
+        s/,/ /g
+        s/ -link / /g
+        s/) *$//
+      '
+    ` ;;
+
+  # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
+  # $LIBS confuse us, and the libraries appear later in the output anyway).
+  *mGLOB_options_string*)
+    ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;;
+
+  # Portland Group compiler has singly- or doubly-quoted -cmdline argument
+  # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
+  # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
+  *-cmdline\ * | *-ignore\ * | *-def\ *)
+    ac_f77_v_output=`echo $ac_f77_v_output | sed "\
+	s/-cmdline  *'[^']*'/ /g; s/-cmdline  *\"[^\"]*\"/ /g
+	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
+	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
+
+  # If we are using fort77 (the f2c wrapper) then filter output and delete quotes.
+  *fort77*f2c*gcc*)
+    ac_f77_v_output=`echo "$ac_f77_v_output" | sed -n '
+        /:[	 ]\+Running[	 ]\{1,\}"gcc"/{
+          /"-c"/d
+          /[.]c"*/d
+          s/^.*"gcc"/"gcc"/
+          s/"//gp
+        }'` ;;
+
+  # If we are using Cray Fortran then delete quotes.
+  *cft90*)
+    ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;;
+esac
+
+
+
+ac_cv_f77_libs=
+
+# Save positional arguments (if any)
+ac_save_positional="$@"
+
+set X $ac_f77_v_output
+while test $# != 1; do
+  shift
+  ac_arg=$1
+  case $ac_arg in
+	[\\/]*.a | ?:[\\/]*.a)
+	    ac_exists=false
+  for ac_i in $ac_cv_f77_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
+
+  if test x"$ac_exists" = xtrue; then :
+
+else
+  ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
+fi
+	  ;;
+	-bI:*)
+	    ac_exists=false
+  for ac_i in $ac_cv_f77_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
+
+  if test x"$ac_exists" = xtrue; then :
+
+else
+  if test "$ac_compiler_gnu" = yes; then
+  for ac_link_opt in $ac_arg; do
+    ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt"
+  done
+else
+  ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
+fi
+fi
+	  ;;
+	  # Ignore these flags.
+	-lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \
+	  |-LANG:=* | -LIST:* | -LNO:* | -link)
+	  ;;
+	-lkernel32)
+	  case $host_os in
+	  *cygwin*) ;;
+	  *) ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
+	    ;;
+	  esac
+	  ;;
+	-[LRuYz])
+	  # These flags, when seen by themselves, take an argument.
+	  # We remove the space between option and argument and re-iterate
+	  # unless we find an empty arg or a new option (starting with -)
+	  case $2 in
+	     "" | -*);;
+	     *)
+		ac_arg="$ac_arg$2"
+		shift; shift
+		set X $ac_arg "$@"
+		;;
+	  esac
+	  ;;
+	-YP,*)
+	  for ac_j in `$as_echo "$ac_arg" | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do
+	      ac_exists=false
+  for ac_i in $ac_cv_f77_libs; do
+    if test x"$ac_j" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
+
+  if test x"$ac_exists" = xtrue; then :
+
+else
+  ac_arg="$ac_arg $ac_j"
+			       ac_cv_f77_libs="$ac_cv_f77_libs $ac_j"
+fi
+	  done
+	  ;;
+	-[lLR]*)
+	    ac_exists=false
+  for ac_i in $ac_cv_f77_libs; do
+    if test x"$ac_arg" = x"$ac_i"; then
+      ac_exists=true
+      break
+    fi
+  done
+
+  if test x"$ac_exists" = xtrue; then :
+
+else
+  ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
+fi
+	  ;;
+	-zallextract*| -zdefaultextract)
+	  ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
+	  ;;
+	  # Ignore everything else.
+  esac
+done
+# restore positional arguments
+set X $ac_save_positional; shift
+
+# We only consider "LD_RUN_PATH" on Solaris systems.  If this is seen,
+# then we insist that the "run path" must be an absolute path (i.e. it
+# must begin with a "/").
+case `(uname -sr) 2>/dev/null` in
+   "SunOS 5"*)
+      ac_ld_run_path=`$as_echo "$ac_f77_v_output" |
+			sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'`
+      test "x$ac_ld_run_path" != x &&
+	if test "$ac_compiler_gnu" = yes; then
+  for ac_link_opt in $ac_ld_run_path; do
+    ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt"
+  done
+else
+  ac_cv_f77_libs="$ac_cv_f77_libs $ac_ld_run_path"
+fi
+      ;;
+esac
+fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_libs" >&5
+$as_echo "$ac_cv_f77_libs" >&6; }
+FLIBS="$ac_cv_f77_libs"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dummy main to link with Fortran 77 libraries" >&5
+$as_echo_n "checking for dummy main to link with Fortran 77 libraries... " >&6; }
+if ${ac_cv_f77_dummy_main+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_f77_dm_save_LIBS=$LIBS
+ LIBS="$LIBS $FLIBS"
+ ac_fortran_dm_var=F77_DUMMY_MAIN
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ # First, try linking without a dummy main:
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_fortran_dummy_main=none
+else
+  ac_cv_fortran_dummy_main=unknown
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+ if test $ac_cv_fortran_dummy_main = unknown; then
+   for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define $ac_fortran_dm_var $ac_func
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_fortran_dummy_main=$ac_func; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+   done
+ fi
+ ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+ ac_cv_f77_dummy_main=$ac_cv_fortran_dummy_main
+ rm -rf conftest*
+ LIBS=$ac_f77_dm_save_LIBS
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_dummy_main" >&5
+$as_echo "$ac_cv_f77_dummy_main" >&6; }
+F77_DUMMY_MAIN=$ac_cv_f77_dummy_main
+if test "$F77_DUMMY_MAIN" != unknown; then :
+  if test $F77_DUMMY_MAIN != none; then
+
+cat >>confdefs.h <<_ACEOF
+#define F77_DUMMY_MAIN $F77_DUMMY_MAIN
+_ACEOF
+
+  if test "x$ac_cv_fc_dummy_main" = "x$ac_cv_f77_dummy_main"; then
+
+$as_echo "#define FC_DUMMY_MAIN_EQ_F77 1" >>confdefs.h
+
+  fi
+fi
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "linking to Fortran libraries from C fails
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran 77 name-mangling scheme" >&5
+$as_echo_n "checking for Fortran 77 name-mangling scheme... " >&6; }
+if ${ac_cv_f77_mangling+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      subroutine foobar()
+      return
+      end
+      subroutine foo_bar()
+      return
+      end
+_ACEOF
+if ac_fn_f77_try_compile "$LINENO"; then :
+  mv conftest.$ac_objext cfortran_test.$ac_objext
+
+  ac_save_LIBS=$LIBS
+  LIBS="cfortran_test.$ac_objext $LIBS $FLIBS"
+
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  ac_success=no
+  for ac_foobar in foobar FOOBAR; do
+    for ac_underscore in "" "_"; do
+      ac_func="$ac_foobar$ac_underscore"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_success=yes; break 2
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    done
+  done
+  ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+  if test "$ac_success" = "yes"; then
+     case $ac_foobar in
+	foobar)
+	   ac_case=lower
+	   ac_foo_bar=foo_bar
+	   ;;
+	FOOBAR)
+	   ac_case=upper
+	   ac_foo_bar=FOO_BAR
+	   ;;
+     esac
+
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+     ac_success_extra=no
+     for ac_extra in "" "_"; do
+	ac_func="$ac_foo_bar$ac_underscore$ac_extra"
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_success_extra=yes; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     done
+     ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+     if test "$ac_success_extra" = "yes"; then
+	ac_cv_f77_mangling="$ac_case case"
+	if test -z "$ac_underscore"; then
+	   ac_cv_f77_mangling="$ac_cv_f77_mangling, no underscore"
+	else
+	   ac_cv_f77_mangling="$ac_cv_f77_mangling, underscore"
+	fi
+	if test -z "$ac_extra"; then
+	   ac_cv_f77_mangling="$ac_cv_f77_mangling, no extra underscore"
+	else
+	   ac_cv_f77_mangling="$ac_cv_f77_mangling, extra underscore"
+	fi
+      else
+	ac_cv_f77_mangling="unknown"
+      fi
+  else
+     ac_cv_f77_mangling="unknown"
+  fi
+
+  LIBS=$ac_save_LIBS
+  rm -rf conftest*
+  rm -f cfortran_test*
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compile a simple Fortran program
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_f77_mangling" >&5
+$as_echo "$ac_cv_f77_mangling" >&6; }
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+case $ac_cv_f77_mangling in
+  "lower case, no underscore, no extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) name" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) name" >>confdefs.h
+ ;;
+  "lower case, no underscore, extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) name" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) name ## _" >>confdefs.h
+ ;;
+  "lower case, underscore, no extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) name ## _" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) name ## _" >>confdefs.h
+ ;;
+  "lower case, underscore, extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) name ## _" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) name ## __" >>confdefs.h
+ ;;
+  "upper case, no underscore, no extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) NAME" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) NAME" >>confdefs.h
+ ;;
+  "upper case, no underscore, extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) NAME" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) NAME ## _" >>confdefs.h
+ ;;
+  "upper case, underscore, no extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) NAME ## _" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) NAME ## _" >>confdefs.h
+ ;;
+  "upper case, underscore, extra underscore")
+	  $as_echo "#define F77_FUNC(name,NAME) NAME ## _" >>confdefs.h
+
+	  $as_echo "#define F77_FUNC_(name,NAME) NAME ## __" >>confdefs.h
+ ;;
+  *)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unknown Fortran name-mangling scheme" >&5
+$as_echo "$as_me: WARNING: unknown Fortran name-mangling scheme" >&2;}
+	  ;;
+esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+    if test "X$F77" = "X"; then
+      BUILD_FORTRAN="no"
+    fi
+    ;;
+  no)
+    BUILD_FORTRAN="no"
+    F77="no"
+    ;;
+esac
+ if test "X$BUILD_FORTRAN" = "Xyes"; then
+  HDF_BUILD_FORTRAN_TRUE=
+  HDF_BUILD_FORTRAN_FALSE='#'
+else
+  HDF_BUILD_FORTRAN_TRUE='#'
+  HDF_BUILD_FORTRAN_FALSE=
+fi
+
+
+
+## -------------------------------------------------------------------------
+## Build static libraries by default. Furthermore, fortran shared libraries
+## are unsupported. Disallow a user from enabling both shared libraries and
+## fortran.
+if test "X${enable_shared}" != "Xyes"; then
+    enable_shared="no"
+fi
+
+if test "X${enable_shared}" = "Xyes"; then
+    if test "X${BUILD_FORTRAN}" = "Xyes"; then
+        as_fn_error $? "Cannot build shared fortran libraries. Please configure with --disable-fortran flag." "$LINENO" 5
+    fi
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+
+for ac_prog in ar xar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AR" && break
+done
+test -n "$AR" || AR=":"
+
+
+for ac_prog in 'bison -y' byacc yacc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_YACC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$YACC"; then
+  ac_cv_prog_YACC="$YACC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_YACC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+YACC=$ac_cv_prog_YACC
+if test -n "$YACC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
+$as_echo "$YACC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$YACC" && break
+done
+test -n "$YACC" || YACC="none"
+
+
+if test "$YACC" = "none"; then
+  as_fn_error $? "cannot find yacc utility" "$LINENO" 5
+fi
+
+for ac_prog in flex lex
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LEX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LEX"; then
+  ac_cv_prog_LEX="$LEX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_LEX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LEX=$ac_cv_prog_LEX
+if test -n "$LEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5
+$as_echo "$LEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$LEX" && break
+done
+test -n "$LEX" || LEX="none"
+
+
+if test "$LEX" = "none"; then
+  as_fn_error $? "cannot find lex utility" "$LINENO" 5
+fi
+
+# Extract the first word of "diff", so it can be a program name with args.
+set dummy diff; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DIFF+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DIFF"; then
+  ac_cv_prog_DIFF="$DIFF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DIFF="diff -w"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DIFF=$ac_cv_prog_DIFF
+if test -n "$DIFF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DIFF" >&5
+$as_echo "$DIFF" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "makeinfo", so it can be a program name with args.
+set dummy makeinfo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MAKEINFO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MAKEINFO"; then
+  ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_MAKEINFO="makeinfo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MAKEINFO=$ac_cv_prog_MAKEINFO
+if test -n "$MAKEINFO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKEINFO" >&5
+$as_echo "$MAKEINFO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "neqn", so it can be a program name with args.
+set dummy neqn; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NEQN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NEQN"; then
+  ac_cv_prog_NEQN="$NEQN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_NEQN="neqn"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+NEQN=$ac_cv_prog_NEQN
+if test -n "$NEQN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEQN" >&5
+$as_echo "$NEQN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "tbl", so it can be a program name with args.
+set dummy tbl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_TBL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$TBL"; then
+  ac_cv_prog_TBL="$TBL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_TBL="tbl"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+TBL=$ac_cv_prog_TBL
+if test -n "$TBL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TBL" >&5
+$as_echo "$TBL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+ UNAME_INFO=`uname -a`
+ STATIC_EXEC=no
+
+
+## ======================================================================
+## Libtool initialization
+## ======================================================================
+case `pwd` in
+  *\ * | *\	*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
+
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in dumpbin "link -dump"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_DUMPBIN" && break
+done
+
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
+fi
+
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DLLTOOL=$ac_ct_DLLTOOL
+  fi
+else
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$AR" && break
+  done
+fi
+if test -z "$AR"; then
+  ac_ct_AR=$AR
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AR="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_AR" && break
+done
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+  fi
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&5
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&5
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
+else
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&5
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[012]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+
+
+
+
+
+# Set options
+enable_dlopen=yes
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=no
+fi
+
+
+
+
+
+
+
+
+
+
+
+  enable_win32_dll=no
+
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+
+
+
+
+
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='--shared'
+	lt_prog_compiler_static='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-qpic'
+	lt_prog_compiler_static='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Qoption ld '
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fPIC'
+	  lt_prog_compiler_static='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fpic'
+	  lt_prog_compiler_static='-Bstatic'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        ld_shlibs=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      export_dynamic_flag_spec='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath_
+fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec=''
+  fi
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+  else
+  ld_shlibs=no
+  fi
+
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	hardcode_direct_absolute=yes
+	export_dynamic_flag_spec='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  hardcode_direct_absolute=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	hardcode_direct_absolute=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux # correct to gnu/linux during the next big refactor
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+    ;;
+
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
+else
+  ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+      if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+  _lt_caught_CXX_error=yes
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+reload_flag_CXX=$reload_flag
+reload_cmds_CXX=$reload_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  compiler_CXX=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+    else
+      lt_prog_compiler_no_builtin_flag_CXX=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          whole_archive_flag_spec_CXX=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+    ld_shlibs_CXX=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+      aix[4-9]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        archive_cmds_CXX=''
+        hardcode_direct_CXX=yes
+        hardcode_direct_absolute_CXX=yes
+        hardcode_libdir_separator_CXX=':'
+        link_all_deplibs_CXX=yes
+        file_list_spec_CXX='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[012]|aix4.[012].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    hardcode_direct_CXX=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    hardcode_minus_L_CXX=yes
+	    hardcode_libdir_flag_spec_CXX='-L$libdir'
+	    hardcode_libdir_separator_CXX=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        export_dynamic_flag_spec_CXX='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        always_export_symbols_CXX=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          allow_undefined_flag_CXX='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+	    allow_undefined_flag_CXX="-z nodefs"
+	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    no_undefined_flag_CXX=' ${wl}-bernotok'
+	    allow_undefined_flag_CXX=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      whole_archive_flag_spec_CXX='$convenience'
+	    fi
+	    archive_cmds_need_lc_CXX=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  allow_undefined_flag_CXX=unsupported
+	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  ld_shlibs_CXX=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  hardcode_libdir_flag_spec_CXX=' '
+	  allow_undefined_flag_CXX=unsupported
+	  always_export_symbols_CXX=yes
+	  file_list_spec_CXX='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
+	  enable_shared_with_static_runtimes_CXX=yes
+	  # Don't use ranlib
+	  old_postinstall_cmds_CXX='chmod 644 $oldlib'
+	  postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  hardcode_libdir_flag_spec_CXX='-L$libdir'
+	  export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
+	  allow_undefined_flag_CXX=unsupported
+	  always_export_symbols_CXX=no
+	  enable_shared_with_static_runtimes_CXX=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    ld_shlibs_CXX=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc_CXX=no
+  hardcode_direct_CXX=no
+  hardcode_automatic_CXX=yes
+  hardcode_shlibpath_var_CXX=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+  else
+    whole_archive_flag_spec_CXX=''
+  fi
+  link_all_deplibs_CXX=yes
+  allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+       if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+
+  else
+  ld_shlibs_CXX=no
+  fi
+
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        ld_shlibs_CXX=no
+        ;;
+
+      freebsd-elf*)
+        archive_cmds_need_lc_CXX=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        ld_shlibs_CXX=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        link_all_deplibs_CXX=yes
+        ;;
+
+      hpux9*)
+        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        export_dynamic_flag_spec_CXX='${wl}-E'
+        hardcode_direct_CXX=yes
+        hardcode_minus_L_CXX=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            ld_shlibs_CXX=no
+            ;;
+          aCC*)
+            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              ld_shlibs_CXX=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      export_dynamic_flag_spec_CXX='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct_CXX=no
+            hardcode_shlibpath_var_CXX=no
+            ;;
+          *)
+            hardcode_direct_CXX=yes
+            hardcode_direct_absolute_CXX=yes
+            hardcode_minus_L_CXX=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      ld_shlibs_CXX=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[3-9]*)
+	hardcode_direct_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    link_all_deplibs_CXX=yes
+	    ;;
+        esac
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        inherit_rpath_CXX=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    archive_cmds_need_lc_CXX=no
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+	      prelink_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      old_archive_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      archive_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      no_undefined_flag_CXX=' -zdefs'
+	      archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      hardcode_libdir_flag_spec_CXX='-R$libdir'
+	      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      compiler_needs_object_CXX=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  hardcode_direct_CXX=yes
+	  hardcode_shlibpath_var_CXX=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        ld_shlibs_CXX=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	ld_shlibs_CXX=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  hardcode_direct_CXX=yes
+	  hardcode_shlibpath_var_CXX=no
+	  hardcode_direct_absolute_CXX=yes
+	  archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    export_dynamic_flag_spec_CXX='${wl}-E'
+	    whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  ld_shlibs_CXX=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        allow_undefined_flag_CXX=' -expect_unresolved \*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+		;;
+	    esac
+
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	      hardcode_libdir_separator_CXX=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      ld_shlibs_CXX=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            archive_cmds_need_lc_CXX=yes
+	    no_undefined_flag_CXX=' -zdefs'
+	    archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    hardcode_libdir_flag_spec_CXX='-R$libdir'
+	    hardcode_shlibpath_var_CXX=no
+	    case $host_os in
+	      solaris2.[0-5] | solaris2.[0-5].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    link_all_deplibs_CXX=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[0-5] | solaris2.[0-5].*) ;;
+		*)
+		  whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_CXX='${wl}-z,text'
+      archive_cmds_need_lc_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	no_undefined_flag_CXX='${wl}-z,text'
+	allow_undefined_flag_CXX='${wl}-z,nodefs'
+	archive_cmds_need_lc_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+	hardcode_libdir_separator_CXX=':'
+	link_all_deplibs_CXX=yes
+	export_dynamic_flag_spec_CXX='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
+	      '"$old_archive_cmds_CXX"
+	    reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
+	      '"$reload_cmds_CXX"
+	    ;;
+	  *)
+	    archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+    esac
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+    test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+    GCC_CXX="$GXX"
+    LD_CXX="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_CXX='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_CXX='-fPIC -shared'
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[4-9]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-qpic'
+	    lt_prog_compiler_static_CXX='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      lt_prog_compiler_pic_CXX='-KPIC'
+	      lt_prog_compiler_static_CXX='-Bstatic'
+	      lt_prog_compiler_wl_CXX='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        lt_prog_compiler_pic_CXX='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
+lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works_CXX=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  case $host_os in
+  aix[4-9]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+      ;;
+    esac
+    ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl_CXX
+	  pic_flag=$lt_prog_compiler_pic_CXX
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+	  allow_undefined_flag_CXX=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc_CXX=no
+	  else
+	    lt_cv_archive_cmds_need_lc_CXX=yes
+	  fi
+	  allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
+      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux # correct to gnu/linux during the next big refactor
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+   test -n "$runpath_var_CXX" ||
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+   test "$inherit_rpath_CXX" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+      ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_direct_absolute_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+inherit_rpath_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+reload_flag_F77=$reload_flag
+reload_cmds_F77=$reload_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  compiler_F77=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+  GCC=$G77
+  if test -n "$compiler"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[4-9]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+    GCC_F77="$G77"
+    LD_F77="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_F77='-Wl,'
+    lt_prog_compiler_static_F77='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_F77='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_F77='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static_F77=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_F77=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_F77='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_F77=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic_F77='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl_F77='-Xlinker '
+      if test -n "$lt_prog_compiler_pic_F77"; then
+        lt_prog_compiler_pic_F77="-Xcompiler $lt_prog_compiler_pic_F77"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_F77='-Bstatic'
+      else
+	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic_F77='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-KPIC'
+	lt_prog_compiler_static_F77='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-fPIC'
+	lt_prog_compiler_static_F77='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='--shared'
+	lt_prog_compiler_static_F77='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl_F77='-Wl,-Wl,,'
+	lt_prog_compiler_pic_F77='-PIC'
+	lt_prog_compiler_static_F77='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-fpic'
+	lt_prog_compiler_static_F77='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_F77='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_F77='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-qpic'
+	lt_prog_compiler_static_F77='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77='-Qoption ld '
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  ;;
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  lt_prog_compiler_pic_F77='-fPIC'
+	  lt_prog_compiler_static_F77='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  lt_prog_compiler_pic_F77='-fpic'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_F77='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	lt_prog_compiler_wl_F77='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_F77='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_F77='-Qoption ld '
+      lt_prog_compiler_pic_F77='-PIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic_F77='-Kconform_pic'
+	lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_F77='-pic'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_F77=
+    ;;
+  *)
+    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_F77=$lt_prog_compiler_pic_F77
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_F77" >&5
+$as_echo "$lt_cv_prog_compiler_pic_F77" >&6; }
+lt_prog_compiler_pic_F77=$lt_cv_prog_compiler_pic_F77
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works_F77=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_F77=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_F77" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then
+    case $lt_prog_compiler_pic_F77 in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     esac
+else
+    lt_prog_compiler_pic_F77=
+     lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_F77=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_F77=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_F77=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_F77" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
+    :
+else
+    lt_prog_compiler_static_F77=
+fi
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_F77" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag_F77=
+  always_export_symbols_F77=no
+  archive_cmds_F77=
+  archive_expsym_cmds_F77=
+  compiler_needs_object_F77=no
+  enable_shared_with_static_runtimes_F77=no
+  export_dynamic_flag_spec_F77=
+  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic_F77=no
+  hardcode_direct_F77=no
+  hardcode_direct_absolute_F77=no
+  hardcode_libdir_flag_spec_F77=
+  hardcode_libdir_separator_F77=
+  hardcode_minus_L_F77=no
+  hardcode_shlibpath_var_F77=unsupported
+  inherit_rpath_F77=no
+  link_all_deplibs_F77=unknown
+  module_cmds_F77=
+  module_expsym_cmds_F77=
+  old_archive_from_new_cmds_F77=
+  old_archive_from_expsyms_cmds_F77=
+  thread_safe_flag_spec_F77=
+  whole_archive_flag_spec_F77=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_F77=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_F77=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_F77=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs_F77=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds_F77=''
+        ;;
+      m68k)
+            archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec_F77='-L$libdir'
+            hardcode_minus_L_F77=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag_F77=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      export_dynamic_flag_spec_F77='${wl}--export-all-symbols'
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=no
+      enable_shared_with_static_runtimes_F77=yes
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms_F77='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    haiku*)
+      archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs_F77=yes
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_F77='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec_F77=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object_F77=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object_F77=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  whole_archive_flag_spec_F77='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+	  archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        ld_shlibs_F77=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs_F77=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs_F77=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+	    archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs_F77=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_F77" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_F77=
+      export_dynamic_flag_spec_F77=
+      whole_archive_flag_spec_F77=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=yes
+      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_F77=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct_F77=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_F77=''
+      hardcode_direct_F77=yes
+      hardcode_direct_absolute_F77=yes
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+      file_list_spec_F77='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  hardcode_direct_F77=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L_F77=yes
+	  hardcode_libdir_flag_spec_F77='-L$libdir'
+	  hardcode_libdir_separator_F77=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      export_dynamic_flag_spec_F77='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_F77=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag_F77='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_f77_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__F77=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__F77"; then
+    lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__F77"; then
+    lt_cv_aix_libpath__F77="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__F77
+fi
+
+        hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds_F77='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag_F77="-z nodefs"
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_f77_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__F77=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__F77"; then
+    lt_cv_aix_libpath__F77=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__F77"; then
+    lt_cv_aix_libpath__F77="/usr/lib:/lib"
+  fi
+
+fi
+
+  aix_libpath=$lt_cv_aix_libpath__F77
+fi
+
+	 hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag_F77=' ${wl}-bernotok'
+	  allow_undefined_flag_F77=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec_F77='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec_F77='$convenience'
+	  fi
+	  archive_cmds_need_lc_F77=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds_F77=''
+        ;;
+      m68k)
+            archive_cmds_F77='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec_F77='-L$libdir'
+            hardcode_minus_L_F77=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_F77=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec_F77=' '
+	allow_undefined_flag_F77=unsupported
+	always_export_symbols_F77=yes
+	file_list_spec_F77='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds_F77='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, F77)='true'
+	enable_shared_with_static_runtimes_F77=yes
+	exclude_expsyms_F77='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds_F77='chmod 644 $oldlib'
+	postlink_cmds_F77='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec_F77=' '
+	allow_undefined_flag_F77=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds_F77='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes_F77=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc_F77=no
+  hardcode_direct_F77=no
+  hardcode_automatic_F77=yes
+  hardcode_shlibpath_var_F77=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec_F77='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    compiler_needs_object_F77=yes
+  else
+    whole_archive_flag_spec_F77=''
+  fi
+  link_all_deplibs_F77=yes
+  allow_undefined_flag_F77="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+  else
+  ld_shlibs_F77=no
+  fi
+
+      ;;
+
+    dgux*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds_F77='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_direct_F77=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+	hardcode_direct_F77=yes
+	hardcode_direct_absolute_F77=yes
+	export_dynamic_flag_spec_F77='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L_F77=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_F77='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator_F77=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct_F77=no
+	  hardcode_shlibpath_var_F77=no
+	  ;;
+	*)
+	  hardcode_direct_F77=yes
+	  hardcode_direct_absolute_F77=yes
+	  export_dynamic_flag_spec_F77='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L_F77=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat > conftest.$ac_ext <<_ACEOF
+
+      subroutine foo
+      end
+_ACEOF
+if ac_fn_f77_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
+else
+  lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc_F77='no'
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      inherit_rpath_F77=yes
+      link_all_deplibs_F77=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    newsos6)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct_F77=yes
+	hardcode_shlibpath_var_F77=no
+	hardcode_direct_absolute_F77=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec_F77='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec_F77='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      allow_undefined_flag_F77=unsupported
+      archive_cmds_F77='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc_F77='no'
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag_F77=' -expect_unresolved \*'
+	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec_F77='-rpath $libdir'
+      fi
+      archive_cmds_need_lc_F77='no'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_F77=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds_F77='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds_F77='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_F77='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_shlibpath_var_F77=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs_F77=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds_F77='$CC -r -o $output$reload_objs'
+	  hardcode_direct_F77=no
+        ;;
+	motorola)
+	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var_F77=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs_F77=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_F77='${wl}-z,text'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_F77='${wl}-z,text'
+      allow_undefined_flag_F77='${wl}-z,nodefs'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='${wl}-R,$libdir'
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      ld_shlibs_F77=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec_F77='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_F77" >&5
+$as_echo "$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+with_gnu_ld_F77=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_F77=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_F77 in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc_F77+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl_F77
+	  pic_flag=$lt_prog_compiler_pic_F77
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+	  allow_undefined_flag_F77=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_F77 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc_F77=no
+	  else
+	    lt_cv_archive_cmds_need_lc_F77=yes
+	  fi
+	  allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_F77" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_F77" >&6; }
+      archive_cmds_need_lc_F77=$lt_cv_archive_cmds_need_lc_F77
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[23].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[3-9]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux # correct to gnu/linux during the next big refactor
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_F77\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_F77\""
+    cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_f77_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" ||
+   test -n "$runpath_var_F77" ||
+   test "X$hardcode_automatic_F77" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_F77" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+     test "$hardcode_minus_L_F77" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_F77=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_F77=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_F77=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_F77" >&5
+$as_echo "$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink ||
+   test "$inherit_rpath_F77" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+        ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+: ${CONFIG_LT=./config.lt}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_LT" >&5
+$as_echo "$as_me: creating $CONFIG_LT" >&6;}
+as_write_fail=0
+cat >"$CONFIG_LT" <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>"$CONFIG_LT" <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -pR'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -pR'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -pR'
+  fi
+else
+  as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## --------------------------------- ##
+## Main body of "$CONFIG_LT" script. ##
+## --------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x "$CONFIG_LT"
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $0 [OPTIONS]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool at gnu.org>."
+
+lt_cl_version="\
+HDF config.lt 4.2.10
+configured by $0, generated by GNU Autoconf 2.69.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $# != 0
+do
+  case $1 in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) as_fn_error $? "unrecognized option: $1
+Try \`$0 --help' for more information." "$LINENO" 5 ;;
+
+    *) as_fn_error $? "unrecognized argument: $1
+Try \`$0 --help' for more information." "$LINENO" 5 ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec 6>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+LD_F77='`$ECHO "$LD_F77" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_F77='`$ECHO "$reload_flag_F77" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_F77='`$ECHO "$reload_cmds_F77" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_F77='`$ECHO "$old_archive_cmds_F77" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_F77='`$ECHO "$compiler_F77" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_F77='`$ECHO "$GCC_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_F77='`$ECHO "$lt_prog_compiler_no_builtin_flag_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_F77='`$ECHO "$lt_prog_compiler_pic_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_F77='`$ECHO "$lt_prog_compiler_wl_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_F77='`$ECHO "$lt_prog_compiler_static_F77" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_F77='`$ECHO "$lt_cv_prog_compiler_c_o_F77" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_F77='`$ECHO "$archive_cmds_need_lc_F77" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_F77='`$ECHO "$enable_shared_with_static_runtimes_F77" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_F77='`$ECHO "$export_dynamic_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_F77='`$ECHO "$whole_archive_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_F77='`$ECHO "$compiler_needs_object_F77" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_F77='`$ECHO "$old_archive_from_new_cmds_F77" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_F77='`$ECHO "$old_archive_from_expsyms_cmds_F77" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_F77='`$ECHO "$archive_cmds_F77" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_F77='`$ECHO "$archive_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_F77='`$ECHO "$module_cmds_F77" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_F77='`$ECHO "$module_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_F77='`$ECHO "$with_gnu_ld_F77" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_F77='`$ECHO "$allow_undefined_flag_F77" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_F77='`$ECHO "$no_undefined_flag_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_F77='`$ECHO "$hardcode_direct_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_F77='`$ECHO "$hardcode_direct_absolute_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_F77='`$ECHO "$hardcode_minus_L_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_F77='`$ECHO "$hardcode_shlibpath_var_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_F77='`$ECHO "$hardcode_automatic_F77" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_F77='`$ECHO "$inherit_rpath_F77" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_F77='`$ECHO "$link_all_deplibs_F77" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_F77='`$ECHO "$always_export_symbols_F77" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_F77='`$ECHO "$export_symbols_cmds_F77" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_F77='`$ECHO "$exclude_expsyms_F77" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_F77='`$ECHO "$include_expsyms_F77" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_F77='`$ECHO "$prelink_cmds_F77" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_F77='`$ECHO "$postlink_cmds_F77" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_F77='`$ECHO "$file_list_spec_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_F77='`$ECHO "$hardcode_action_F77" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_F77='`$ECHO "$compiler_lib_search_dirs_F77" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_F77='`$ECHO "$predep_objects_F77" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_F77='`$ECHO "$postdep_objects_F77" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_F77='`$ECHO "$predeps_F77" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_F77='`$ECHO "$postdeps_F77" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_F77='`$ECHO "$compiler_lib_search_path_F77" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+LD_F77 \
+reload_flag_CXX \
+reload_flag_F77 \
+compiler_CXX \
+compiler_F77 \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_no_builtin_flag_F77 \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_pic_F77 \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_wl_F77 \
+lt_prog_compiler_static_CXX \
+lt_prog_compiler_static_F77 \
+lt_cv_prog_compiler_c_o_CXX \
+lt_cv_prog_compiler_c_o_F77 \
+export_dynamic_flag_spec_CXX \
+export_dynamic_flag_spec_F77 \
+whole_archive_flag_spec_CXX \
+whole_archive_flag_spec_F77 \
+compiler_needs_object_CXX \
+compiler_needs_object_F77 \
+with_gnu_ld_CXX \
+with_gnu_ld_F77 \
+allow_undefined_flag_CXX \
+allow_undefined_flag_F77 \
+no_undefined_flag_CXX \
+no_undefined_flag_F77 \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_F77 \
+hardcode_libdir_separator_CXX \
+hardcode_libdir_separator_F77 \
+exclude_expsyms_CXX \
+exclude_expsyms_F77 \
+include_expsyms_CXX \
+include_expsyms_F77 \
+file_list_spec_CXX \
+file_list_spec_F77 \
+compiler_lib_search_dirs_CXX \
+compiler_lib_search_dirs_F77 \
+predep_objects_CXX \
+predep_objects_F77 \
+postdep_objects_CXX \
+postdep_objects_F77 \
+predeps_CXX \
+predeps_F77 \
+postdeps_CXX \
+postdeps_F77 \
+compiler_lib_search_path_CXX \
+compiler_lib_search_path_F77; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+reload_cmds_CXX \
+reload_cmds_F77 \
+old_archive_cmds_CXX \
+old_archive_cmds_F77 \
+old_archive_from_new_cmds_CXX \
+old_archive_from_new_cmds_F77 \
+old_archive_from_expsyms_cmds_CXX \
+old_archive_from_expsyms_cmds_F77 \
+archive_cmds_CXX \
+archive_cmds_F77 \
+archive_expsym_cmds_CXX \
+archive_expsym_cmds_F77 \
+module_cmds_CXX \
+module_cmds_F77 \
+module_expsym_cmds_CXX \
+module_expsym_cmds_F77 \
+export_symbols_cmds_CXX \
+export_symbols_cmds_F77 \
+prelink_cmds_CXX \
+prelink_cmds_F77 \
+postlink_cmds_CXX \
+postlink_cmds_F77; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+
+
+
+
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ofile" >&5
+$as_echo "$as_me: creating $ofile" >&6;}
+
+
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags="CXX F77 "
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: F77
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_F77
+reload_cmds=$lt_reload_cmds_F77
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_F77
+
+# A language specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_F77
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_F77
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_F77
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_F77
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_F77
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_F77
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_F77
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_F77
+postdep_objects=$lt_postdep_objects_F77
+predeps=$lt_predeps_F77
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# ### END LIBTOOL TAG CONFIG: F77
+_LT_EOF
+
+
+as_fn_exit 0
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec 5>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec 5>>config.log
+$lt_cl_success || as_fn_exit 1
+
+
+## ----------------------------------------------------------------------
+## Check if we should install only statically linked executables.
+##   This check needs to occur after libtool is initialized because
+##   we check a libtool cache value and may issue a warning based
+##   on its result.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should install only statically linked executables" >&5
+$as_echo_n "checking if we should install only statically linked executables... " >&6; }
+# Check whether --enable-static_exec was given.
+if test "${enable_static_exec+set}" = set; then :
+  enableval=$enable_static_exec; STATIC_EXEC=$enableval
+fi
+
+
+if test "X$STATIC_EXEC" = "Xyes"; then
+  echo "yes"
+  ## Issue a warning if -static flag is not supported.
+  if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then
+      echo "    warning: -static flag not supported on this system; executable won't statically link shared system libraries."
+  fi
+  LT_STATIC_EXEC="-all-static"
+else
+  echo "no"
+  LT_STATIC_EXEC=""
+fi
+
+
+
+## ======================================================================
+## Checks for libraries
+## ======================================================================
+
+## ----------------------------------------------------------------------
+## Fake --with-xxx option to allow us to create a help message for the
+## following --with-xxx options which can take either a =DIR or =INC,LIB
+## specifier.
+##
+
+# Check whether --with-fnord was given.
+if test "${with_fnord+set}" = set; then :
+  withval=$with_fnord;
+fi
+
+
+## ----------------------------------------------------------------------
+## Is the GNU zlib present? It has a header file `zlib.h' and a library
+## `-lz' and their locations might be specified with the `--with-zlib'
+## command-line switch. The value is an include path and/or a library path.
+## If the library path is specified then it must be preceded by a comma.
+
+# Check whether --with-zlib was given.
+if test "${with_zlib+set}" = set; then :
+  withval=$with_zlib;
+else
+  withval=yes
+fi
+
+
+case "$withval" in
+  yes)
+    HAVE_ZLIB="yes"
+    for ac_header in zlib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_ZLIB_H 1
+_ACEOF
+ HAVE_ZLIB_H="yes"
+else
+  unset HAVE_ZLIB
+fi
+
+done
+
+    if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5
+$as_echo_n "checking for compress2 in -lz... " >&6; }
+if ${ac_cv_lib_z_compress2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char compress2 ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return compress2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_z_compress2=yes
+else
+  ac_cv_lib_z_compress2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5
+$as_echo "$ac_cv_lib_z_compress2" >&6; }
+if test "x$ac_cv_lib_z_compress2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+  LIBS="-lz $LIBS"
+
+else
+  unset HAVE_ZLIB
+fi
+
+    fi
+    if test -z "$HAVE_ZLIB"; then
+      if test -n "$HDF5_CONFIG_ABORT"; then
+        as_fn_error $? "couldn't find zlib library" "$LINENO" 5
+      fi
+    else
+      ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2"
+if test "x$ac_cv_func_compress2" = xyes; then :
+  HAVE_COMPRESS2="yes"
+fi
+
+    fi
+    ;;
+  no)
+    HAVE_ZLIB="no"
+    as_fn_error $? "zlib library required to build HDF4" "$LINENO" 5
+    ;;
+  *)
+    HAVE_ZLIB="yes"
+    case "$withval" in
+      *,*)
+        zlib_inc="`echo $withval | cut -f1 -d,`"
+        zlib_lib="`echo $withval | cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          zlib_inc="$withval/include"
+          zlib_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    ## Trying to include -I/usr/include and -L/usr/lib is redundant and
+    ## can mess some compilers up.
+    if test "X$zlib_inc" = "X/usr/include"; then
+      zlib_inc=""
+    fi
+    if test "X$zlib_lib" = "X/usr/lib"; then
+      zlib_lib=""
+    fi
+
+    if test -n "$zlib_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$zlib_inc"
+    fi
+
+    for ac_header in zlib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_ZLIB_H 1
+_ACEOF
+ HAVE_ZLIB_H="yes"
+else
+  unset HAVE_ZLIB
+fi
+
+done
+
+
+    if test -n "$zlib_lib"; then
+      LDFLAGS="$LDFLAGS -L$zlib_lib"
+    fi
+
+    if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5
+$as_echo_n "checking for compress2 in -lz... " >&6; }
+if ${ac_cv_lib_z_compress2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char compress2 ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return compress2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_z_compress2=yes
+else
+  ac_cv_lib_z_compress2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5
+$as_echo "$ac_cv_lib_z_compress2" >&6; }
+if test "x$ac_cv_lib_z_compress2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+  LIBS="-lz $LIBS"
+
+else
+  unset HAVE_ZLIB
+fi
+
+    fi
+
+    if test -z "$HAVE_ZLIB"; then
+      as_fn_error $? "couldn't find zlib library" "$LINENO" 5
+    else
+      ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2"
+if test "x$ac_cv_func_compress2" = xyes; then :
+  HAVE_COMPRESS2="yes"
+fi
+
+    fi
+    ;;
+esac
+
+## ----------------------------------------------------------------------
+## Is the JPEG library present?
+
+# Check whether --with-jpeg was given.
+if test "${with_jpeg+set}" = set; then :
+  withval=$with_jpeg;
+else
+  withval=yes
+fi
+
+
+case "$withval" in
+  yes)
+    HAVE_JPEG="yes"
+    for ac_header in jpeglib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_JPEGLIB_H 1
+_ACEOF
+ HAVE_JPEG_H="yes"
+else
+  unset HAVE_JPEG
+fi
+
+done
+
+    if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_decompress in -ljpeg" >&5
+$as_echo_n "checking for jpeg_start_decompress in -ljpeg... " >&6; }
+if ${ac_cv_lib_jpeg_jpeg_start_decompress+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljpeg  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char jpeg_start_decompress ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return jpeg_start_decompress ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_jpeg_jpeg_start_decompress=yes
+else
+  ac_cv_lib_jpeg_jpeg_start_decompress=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_start_decompress" >&5
+$as_echo "$ac_cv_lib_jpeg_jpeg_start_decompress" >&6; }
+if test "x$ac_cv_lib_jpeg_jpeg_start_decompress" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBJPEG 1
+_ACEOF
+
+  LIBS="-ljpeg $LIBS"
+
+else
+  unset HAVE_JPEG
+fi
+
+    fi
+
+    if test -z "$HAVE_JPEG"; then
+      as_fn_error $? "couldn't find jpeg library" "$LINENO" 5
+    fi
+    ;;
+  no)
+    HAVE_JPEG="no"
+    as_fn_error $? "jpeg library required to build HDF4" "$LINENO" 5
+    ;;
+  *)
+    HAVE_JPEG="yes"
+    case "$withval" in
+      *,*)
+        jpeg_inc="`echo $withval | cut -f1 -d,`"
+        jpeg_lib="`echo $withval | cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          jpeg_inc="$withval/include"
+          jpeg_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    ## Trying to include -I/usr/include and -L/usr/lib is redundant and
+    ## can mess some compilers up.
+    if test "X$jpeg_inc" = "X/usr/include"; then
+      jpeg_inc=""
+    fi
+    if test "X$jpeg_lib" = "X/usr/lib"; then
+      jpeg_lib=""
+    fi
+
+    if test -n "$jpeg_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$jpeg_inc"
+    fi
+
+    for ac_header in jpeglib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_JPEGLIB_H 1
+_ACEOF
+ HAVE_JPEG_H="yes"
+else
+  unset HAVE_JPEG
+fi
+
+done
+
+
+    if test -n "$jpeg_lib"; then
+      LDFLAGS="$LDFLAGS -L$jpeg_lib"
+    fi
+
+    if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_decompress in -ljpeg" >&5
+$as_echo_n "checking for jpeg_start_decompress in -ljpeg... " >&6; }
+if ${ac_cv_lib_jpeg_jpeg_start_decompress+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljpeg  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char jpeg_start_decompress ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return jpeg_start_decompress ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_jpeg_jpeg_start_decompress=yes
+else
+  ac_cv_lib_jpeg_jpeg_start_decompress=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_start_decompress" >&5
+$as_echo "$ac_cv_lib_jpeg_jpeg_start_decompress" >&6; }
+if test "x$ac_cv_lib_jpeg_jpeg_start_decompress" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBJPEG 1
+_ACEOF
+
+  LIBS="-ljpeg $LIBS"
+
+else
+  unset HAVE_JPEG
+fi
+
+    fi
+
+    if test -z "$HAVE_JPEG"; then
+      as_fn_error $? "couldn't find jpeg library" "$LINENO" 5
+    fi
+    ;;
+esac
+
+## ----------------------------------------------------------------------
+## Is the szip library present?
+ USE_COMP_SZIP="no"
+
+# Check whether --with-szlib was given.
+if test "${with_szlib+set}" = set; then :
+  withval=$with_szlib;
+else
+  withval=no
+fi
+
+
+case "$withval" in
+  yes)
+    HAVE_SZIP="yes"
+    for ac_header in szlib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_szlib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SZLIB_H 1
+_ACEOF
+ HAVE_SZLIB_H="yes"
+else
+  unset HAVE_SZIP
+fi
+
+done
+
+    if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5
+$as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; }
+if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsz  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SZ_BufftoBuffCompress ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return SZ_BufftoBuffCompress ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_sz_SZ_BufftoBuffCompress=yes
+else
+  ac_cv_lib_sz_SZ_BufftoBuffCompress=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5
+$as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; }
+if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSZ 1
+_ACEOF
+
+  LIBS="-lsz $LIBS"
+
+else
+  unset HAVE_SZIP
+fi
+
+    fi
+
+    if test -z "$HAVE_SZIP"; then
+      as_fn_error $? "couldn't find szlib library" "$LINENO" 5
+    fi
+    ;;
+  no)
+    HAVE_SZIP="no"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szlib" >&5
+$as_echo_n "checking for szlib... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
+$as_echo "suppressed" >&6; }
+    SZIP_INFO="${SZIP_INFO}disabled"
+    ;;
+  *)
+    HAVE_SZIP="yes"
+    case "$withval" in
+      *,*)
+        szip_inc="`echo $withval | cut -f1 -d,`"
+        szip_lib="`echo $withval | cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          szip_inc="$withval/include"
+          szip_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    ## Trying to include -I/usr/include and -L/usr/lib is redundant and
+    ## can mess some compilers up.
+    if test "X$szip_inc" = "X/usr/include"; then
+      szip_inc=""
+    fi
+    if test "X$szip_lib" = "X/usr/lib"; then
+      szip_lib=""
+    fi
+
+    if test -n "$szip_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$szip_inc"
+    fi
+
+    for ac_header in szlib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_szlib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SZLIB_H 1
+_ACEOF
+ HAVE_SZLIB_H="yes"
+else
+  unset HAVE_SZIP
+fi
+
+done
+
+
+    if test -n "$szip_lib"; then
+      LDFLAGS="$LDFLAGS -L$szip_lib"
+    fi
+
+    if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5
+$as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; }
+if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsz  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SZ_BufftoBuffCompress ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return SZ_BufftoBuffCompress ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_sz_SZ_BufftoBuffCompress=yes
+else
+  ac_cv_lib_sz_SZ_BufftoBuffCompress=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5
+$as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; }
+if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSZ 1
+_ACEOF
+
+  LIBS="-lsz $LIBS"
+
+else
+  unset HAVE_SZIP
+fi
+
+    fi
+
+    if test -z "$HAVE_SZIP"; then
+      as_fn_error $? "couldn't find szlib library" "$LINENO" 5
+    else
+      USE_COMP_SZIP="yes"
+    fi
+    ;;
+esac
+
+## Check to see if SZIP has encoder
+if test "X$HAVE_SZIP" = "Xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
+    ## SZLIB library is available. Check if it can encode.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szlib encoder" >&5
+$as_echo_n "checking for szlib encoder... " >&6; }
+
+    ## Set LD_LIBRARY_PATH so encoder test can find the library and run.
+    if test -z "$LD_LIBRARY_PATH"; then
+        export LD_LIBRARY_PATH="$szip_lib"
+    else
+        export LD_LIBRARY_PATH="${szip_lib}:$LD_LIBRARY_PATH"
+    fi
+
+     LL_PATH="$LD_LIBRARY_PATH"
+
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    #include <stdlib.h>
+    #include <szlib.h>
+
+    int main(void)
+    {
+        /* SZ_encoder_enabled returns 1 if encoder is present */
+        if (SZ_encoder_enabled() == 1)
+            exit(0);
+        else
+            exit(1);
+    }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  CAN_ENCODE="yes"
+else
+  CAN_ENCODE="no"
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+    ## Report szip encoder test results
+    if test "X$CAN_ENCODE" = "Xyes"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    fi
+    if test "X$CAN_ENCODE" = "Xno"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+
+    ## Add "szip" to external filter list
+    if test "X$CAN_ENCODE" = "Xyes"; then
+        if test "X$SZIP_INFO" != "X"; then
+            SZIP_INFO="${SZIP_INFO}"
+        fi
+        SZIP_INFO="${SZIP_INFO}enabled with encoder"
+    fi
+
+    if test "X$CAN_ENCODE" = "Xno"; then
+        if test "X$SZIP_INFO" != "X"; then
+            SZIP_INFO="${SZIP_INFO}"
+        fi
+        SZIP_INFO="${SZIP_INFO}enabled with decoder only"
+    fi
+
+    ## Create macro to specify if encoder is present
+    if test "X$CAN_ENCODE" = "Xyes"; then
+
+$as_echo "#define HAVE_SZIP_ENCODER 1" >>confdefs.h
+
+        SZIP_HAS_ENCODER="yes"
+    fi
+fi
+
+
+ if test "X$USE_COMP_SZIP" = "Xyes" && test "X$LL_PATH" != "X"; then
+  BUILD_SHARED_SZIP_CONDITIONAL_TRUE=
+  BUILD_SHARED_SZIP_CONDITIONAL_FALSE='#'
+else
+  BUILD_SHARED_SZIP_CONDITIONAL_TRUE='#'
+  BUILD_SHARED_SZIP_CONDITIONAL_FALSE=
+fi
+
+
+## ----------------------------------------------------------------------
+## Is XDR support present? The TRY_LINK info was gotten from the
+## mfhdf/libsrc/local_nc.c file.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr library support" >&5
+$as_echo_n "checking for xdr library support... " >&6; }
+
+# Check whether --enable-hdf4-xdr was given.
+if test "${enable_hdf4_xdr+set}" = set; then :
+  enableval=$enable_hdf4_xdr; enableval="yes"
+else
+  enableval="no"
+fi
+
+
+case "$enableval" in
+  yes)
+    BUILD_XDR="yes"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: using HDF4 XDR" >&5
+$as_echo "using HDF4 XDR" >&6; };
+    ;;
+  no)
+    BUILD_XDR="no"
+    ;;
+esac
+
+if test "X$BUILD_XDR" != "Xyes"; then
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    #include <rpc/types.h>
+    #include <rpc/xdr.h>
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+xdr_int
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }; BUILD_XDR="no"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; BUILD_XDR="yes"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+
+ if test "X$BUILD_XDR" = "Xyes"; then
+  HDF_BUILD_XDR_TRUE=
+  HDF_BUILD_XDR_FALSE='#'
+else
+  HDF_BUILD_XDR_TRUE='#'
+  HDF_BUILD_XDR_FALSE=
+fi
+
+
+
+## Check headers and add libraries for XDR if the HDF4 XDR library is not used.
+if test "X$BUILD_XDR" != "Xyes"; then
+  ## For Solaris systems, add the -nsl for XDR support
+  ##
+  ## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support
+  case "$host" in
+    *-solaris*)
+      LIBS="$LIBS -lnsl"  ;;
+    *-pc-cygwin*)
+      LIBS="$LIBS -ltirpc"  ;;
+    *) ;;
+  esac
+
+  ## ======================================================================
+  ## Checks for header files
+  ## ======================================================================
+
+  ## ----------------------------------------------------------------------
+  ## We're trying to link against the rpc library when building on Cygwin,
+  ## but we need to make sure that it is present on the system. Do that here,
+  ## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support
+  case "$host" in
+    *-pc-cygwin*)
+      HAVE_RPC="yes"
+      ac_fn_c_check_header_mongrel "$LINENO" "rpc.h" "ac_cv_header_rpc_h" "$ac_includes_default"
+if test "x$ac_cv_header_rpc_h" = xyes; then :
+  :
+else
+  unset HAVE_RPC
+fi
+
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xdr_opaque in -ltirpc" >&5
+$as_echo_n "checking for xdr_opaque in -ltirpc... " >&6; }
+if ${ac_cv_lib_tirpc_xdr_opaque+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltirpc  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char xdr_opaque ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return xdr_opaque ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tirpc_xdr_opaque=yes
+else
+  ac_cv_lib_tirpc_xdr_opaque=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tirpc_xdr_opaque" >&5
+$as_echo "$ac_cv_lib_tirpc_xdr_opaque" >&6; }
+if test "x$ac_cv_lib_tirpc_xdr_opaque" = xyes; then :
+  :
+else
+  unset HAVE_RPC
+fi
+
+      if test -z "$HAVE_RPC"; then
+        as_fn_error $? "couldn't find tirpc library" "$LINENO" 5
+      fi
+      ;;
+  esac
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+
+## ======================================================================
+## Checks for types
+## ======================================================================
+
+## ======================================================================
+## Checks for structures
+## ======================================================================
+
+## ======================================================================
+## Checks for compiler characteristics
+## ======================================================================
+
+if test "x$CC" != xcc; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+   test -f conftest2.$ac_objext && { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
+then
+  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+  if test "x$CC" != xcc; then
+    # Test first that cc exists at all.
+    if { ac_try='cc -c conftest.$ac_ext >&5'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+      rm -f conftest2.*
+      if { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+	 test -f conftest2.$ac_objext && { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
+      then
+	# cc works too.
+	:
+      else
+	# cc exists but doesn't like -o.
+	eval ac_cv_prog_cc_${ac_cc}_c_o=no
+      fi
+    fi
+  fi
+else
+  eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+if test "X$BUILD_FORTRAN" = "Xyes"; then
+  ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 understands -c and -o together" >&5
+$as_echo_n "checking whether $F77 understands -c and -o together... " >&6; }
+if ${ac_cv_prog_f77_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+# We test twice because some compilers refuse to overwrite an existing
+# `.o' file with `-o', although they will create one.
+ac_try='$F77 $FFLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+     test -f conftest2.$ac_objext &&
+     { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  ac_cv_prog_f77_c_o=yes
+else
+  ac_cv_prog_f77_c_o=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_f77_c_o" >&5
+$as_echo "$ac_cv_prog_f77_c_o" >&6; }
+if test $ac_cv_prog_f77_c_o = no; then
+
+$as_echo "#define F77_NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+
+## This is a bit of a hack. The AC_CHECK_SIZEOF macro is supposed to
+## #define a value in a header file. However, we don't use a generated
+## header file. So I check the value left over from autoconf's test  is
+## >= 8.
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int*" >&5
+$as_echo_n "checking size of int*... " >&6; }
+if ${ac_cv_sizeof_intp+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int*))" "ac_cv_sizeof_intp"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_intp" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (int*)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_intp=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_intp" >&5
+$as_echo "$ac_cv_sizeof_intp" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INTP $ac_cv_sizeof_intp
+_ACEOF
+
+
+
+if test $ac_cv_sizeof_intp -ge 8; then
+  CPPFLAGS="$CPPFLAGS -DBIG_LONGS"
+
+  ## Define super secret special flag for AIX machines in 64-bit mode.
+  case "${host}" in
+    *-ibm-aix*) CPPFLAGS="$CPPFLAGS -DAIX5L64" ;;
+    *)          ;;
+  esac
+  if test "X$BUILD_XDR" = "Xyes"; then
+    as_fn_error $? "--enable-hdf4-xdr is not supported for 64 bit mode." "$LINENO" 5
+  fi
+fi
+
+## ----------------------------------------------------------------------
+## Set some variables for general configuration information to be saved
+## and installed with the libraries.
+##
+
+## HDF4 version from the first line of the README.txt file.
+H4_VERSION="`cut -d' ' -f3 $srcdir/README.txt | head -1`"
+
+
+## Configuration date
+ CONFIG_DATE="`date`"
+
+## User doing the configuration
+ CONFIG_USER="`whoami`@`hostname`"
+
+## Configuration mode (production, development, etc)
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_bigendian=unknown
+    # See if we're dealing with a universal compiler.
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __APPLE_CC__
+	       not a universal capable compiler
+	     #endif
+	     typedef int dummy;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+	# Check for potential -arch flags.  It is not universal unless
+	# there are at least two -arch flags with different values.
+	ac_arch=
+	ac_prev=
+	for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+	 if test -n "$ac_prev"; then
+	   case $ac_word in
+	     i?86 | x86_64 | ppc | ppc64)
+	       if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+		 ac_arch=$ac_word
+	       else
+		 ac_cv_c_bigendian=universal
+		 break
+	       fi
+	       ;;
+	   esac
+	   ac_prev=
+	 elif test "x$ac_word" = "x-arch"; then
+	   ac_prev=arch
+	 fi
+       done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if sys/param.h defines the BYTE_ORDER macro.
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+	     #include <sys/param.h>
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+		     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+		     && LITTLE_ENDIAN)
+	      bogus endian macros
+	     #endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+		#include <sys/param.h>
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+		 not big endian
+		#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
+else
+  ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <limits.h>
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+	      bogus endian macros
+	     #endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to _BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <limits.h>
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+		 not big endian
+		#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
+else
+  ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # Compile a test program.
+      if test "$cross_compiling" = yes; then :
+  # Try to guess by grepping values from an object file.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+short int ascii_mm[] =
+		  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+		short int ascii_ii[] =
+		  { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+		int use_ascii (int i) {
+		  return ascii_mm[i] + ascii_ii[i];
+		}
+		short int ebcdic_ii[] =
+		  { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+		short int ebcdic_mm[] =
+		  { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+		int use_ebcdic (int i) {
+		  return ebcdic_mm[i] + ebcdic_ii[i];
+		}
+		extern int foo;
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+	      ac_cv_c_bigendian=yes
+	    fi
+	    if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+	      if test "$ac_cv_c_bigendian" = unknown; then
+		ac_cv_c_bigendian=no
+	      else
+		# finding both strings is unlikely to happen, but who knows?
+		ac_cv_c_bigendian=unknown
+	      fi
+	    fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+	     /* Are we little or big endian?  From Harbison&Steele.  */
+	     union
+	     {
+	       long int l;
+	       char c[sizeof (long int)];
+	     } u;
+	     u.l = 1;
+	     return u.c[sizeof (long int) - 1] == 1;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_c_bigendian=no
+else
+  ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+   yes)
+     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+   no)
+     CPPFLAGS="$CPPFLAGS -DSWAP" ;; #(
+   universal)
+
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+     ;; #(
+   *)
+     as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
+
+
+## Are we building this in debug or production mode? (Remove the -g flag
+## in production mode.)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build mode" >&5
+$as_echo_n "checking for build mode... " >&6; }
+# Check whether --enable-production was given.
+if test "${enable_production+set}" = set; then :
+  enableval=$enable_production;
+fi
+
+
+case "X-$enable_production" in
+  X-|X-yes)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: production" >&5
+$as_echo "production" >&6; }
+    CONFIG_MODE=production
+    ## Remove the "-g" flag from compile line if it's in there.
+    CFLAGS_temp=""
+    if test -n "$CFLAGS"; then
+      for d in $CFLAGS ; do
+        if test "X$d" != "X-g"; then
+          CFLAGS_temp="$CFLAGS_temp $d"
+        fi
+      done
+      CFLAGS=$CFLAGS_temp
+    fi
+
+    FFLAGS_temp=""
+    if test -n "$FFLAGS"; then
+      for d in $FFLAGS ; do
+        if test "X$d" != "X-g"; then
+          FFLAGS_temp="$FFLAGS_temp $d"
+        fi
+      done
+      FFLAGS=$FFLAGS_temp
+    fi
+
+    CXXFLAGS_temp=""
+    if test -n "$CXXFLAGS"; then
+      for d in $CXXFLAGS ; do
+        if test "X$d" != "X-g"; then
+          CXXFLAGS_temp="$CXXFLAGS_temp $d"
+        fi
+      done
+      CXXFLAGS=$CXXFLAGS_temp
+    fi
+
+    CFLAGS="$CFLAGS $PROD_CFLAGS"
+    CXXFLAGS="$CXXFLAGS $PROD_CXXFLAGS"
+    FFLAGS="$FFLAGS $PROD_FFLAGS"
+    CPPFLAGS="$CPPFLAGS $PROD_CPPFLAGS"
+    ;;
+  X-no)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: development" >&5
+$as_echo "development" >&6; }
+    CONFIG_MODE=development
+    CFLAGS="$CFLAGS $DEBUG_CFLAGS"
+    FFLAGS="$FFLAGS $DEBUG_FFLAGS"
+    CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS"
+    CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS"
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: user-defined" >&5
+$as_echo "user-defined" >&6; }
+    ;;
+esac
+
+## ======================================================================
+## Checks for library functions
+## ======================================================================
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for math library support" >&5
+$as_echo_n "checking for math library support... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <math.h>
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+sinh(37.927)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; LIBS="$LIBS -lm"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+for ac_func in fork system vfork wait
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+## ======================================================================
+## Checks for system services
+## ======================================================================
+
+## Copy NetCDF header files.
+#
+## FIXME: This is code stolen^Wborrowed from the old HDF4 configure.
+## These header files should probably be generated by autoconf instead
+## of being copied depending upon the host.
+case "$host" in
+  *-linux*)             BAR="linux"       ;;
+  *-freebsd*)           BAR="fbsd"        ;;
+  *-ibm-aix*)           BAR="aix"         ;;
+  sparc64-*-solaris2*)  BAR="solaris64"   ;;
+  *-*-solaris2*)        BAR="solaris"     ;;
+  *-apple*)             BAR="apple"       ;;
+  *-pc-cygwin*)         BAR="linux"       ;;
+  *)                    echo "*** unknown host $host!"; exit 1 ;;
+esac
+src_files=""
+src_files="`echo $src_files | sed -e s/FOO/${BAR}/g`"
+
+for config_file in $src_files; do
+  src_file="${srcdir}/`echo $config_file | sed -e s/:.*$//`"
+  target_file="`echo $config_file | sed -e s/^[^:]*://g`"
+
+  if test ! -r ${src_file}; then
+    echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2
+    echo '***' "since the file \"${src_file}\" does not exist." 1>&2
+    exit 1
+  fi
+
+  ## this sed command emulates the dirname command
+  dstdir=`echo "$target_file" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+  ## Create directory for the target_file if it's not there.
+  if test ! -d $dstdir; then
+    ${srcdir}/bin/mkinstalldirs $dstdir
+  fi
+
+  echo "Copying \"${src_file}\" to \"${target_file}\" ."
+  cp ${src_file} ${target_file}
+
+  if test ! -r ${target_file}; then
+    echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2
+    exit 1
+  fi
+done
+
+## ------------------------------------------------------------------------
+## Check to see if libtool has enabled shared libraries. Set a conditional
+## as some Makefiles will build based on availability of shared libraries.
+if (./libtool --features | grep '^enable shared libraries' > /dev/null); then
+  enable_shared=yes
+else
+  enable_shared=no
+fi
+
+## ------------------------------------------------------------------------
+## Specify shared library extension the host machine should recognize.
+case "$host_os" in
+  darwin*)
+      SHARED_EXTENSION="dylib"
+      ;;
+  *)
+      SHARED_EXTENSION="so"
+      ;;
+esac
+
+## We don't need to say when we're entering directories if we're using
+## GNU make because make does it for us.
+if test "X$GMAKE" = "Xyes"; then
+   SETX=":"
+else
+   SETX="set -x"
+fi
+
+ if test "X$enable_shared" = "Xyes"; then
+  HDF_BUILD_SHARED_TRUE=
+  HDF_BUILD_SHARED_FALSE='#'
+else
+  HDF_BUILD_SHARED_TRUE='#'
+  HDF_BUILD_SHARED_FALSE=
+fi
+
+
+## Compiler with version information. This consists of the full path
+## name of the compiler and the reported version number.
+
+## Strip anything that looks like a flag off of $CC
+CC_NOFLAGS=`echo $CC | sed 's/ -.*//'`
+
+if `echo $CC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
+  CC_VERSION="$CC"
+else
+  CC_VERSION="$CC";
+  for x in `echo $PATH | sed -e 's/:/ /g'`; do
+    if test -x $x/$CC_NOFLAGS; then
+      CC_VERSION="$x/$CC"
+      break
+    fi
+  done
+fi
+
+
+## ----------------------------------------------------------------------
+##
+## If --enable-static-exec and are specified together, there will be ld failures for
+## "attempted static link of dynamic object" when the tools are built.  This check
+## will prevent that error during configure instead.  It could go with the other
+## --enable-static-exec checks, but since enable_static is set by default later in
+## the configure process this check has to be delayed.
+if test "X$STATIC_EXEC" = "Xyes"; then
+  if test "X${enable_static}" != "Xyes"; then
+    as_fn_error $? "--enable-static-exec flag to build static executables requires static libraries.  Please configure with --enable-static flag." "$LINENO" 5
+  fi
+fi
+
+## This part doesn't work yet since HDF4 config files do not contain
+## information for cc_vendor and cc_version as HDF5 similar files do.
+## Needs to be fixed EIP 2010-01-21
+## if test -n "$cc_vendor" && test -n "$cc_version"; then
+##  CC_VERSION="$CC_VERSION ($cc_vendor-$cc_version)"
+## fi
+
+if test -n "$cc_version_info"; then
+  CC_VERSION="$CC_VERSION ( $cc_version_info)"
+fi
+
+## Fortran compiler with version information. This consists of the full path
+## name of the compiler and the reported version number.
+
+## Strip anything that looks like a flag off of $F77
+F77_NOFLAGS=`echo $F77 | sed 's/ -.*//'`
+
+if `echo $F77_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
+  F77_VERSION="$F77"
+else
+  F77_VERSION="$F77";
+  for x in `echo $PATH | sed -e 's/:/ /g'`; do
+    if test -x $x/$F77_NOFLAGS; then
+      F77_VERSION="$x/$F77"
+      break
+    fi
+  done
+fi
+if test -n "$fc_version_info"; then
+  F77_VERSION="$F77_VERSION ( $fc_version_info)"
+fi
+
+## This part doesn't work yet since HDF4 config files do not contain
+## information for fortran_vendor and fortran_version.
+## Needs to be fixed EIP 2010-01-21
+## if test -n "$fortran_vendor" && test -n "$fortran_version"; then
+##   F77_VERSION="$F77_VERSION ($fortran_vendor-$fortran_version)"
+## fi
+
+## ----------------------------------------------------------------------
+## Enable deprecated public API symbols
+##
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if deprecated public symbols are available" >&5
+$as_echo_n "checking if deprecated public symbols are available... " >&6; };
+# Check whether --enable-deprecated-symbols was given.
+if test "${enable_deprecated_symbols+set}" = set; then :
+  enableval=$enable_deprecated_symbols; DEPREC_SYMBOLS=$enableval
+else
+  DEPREC_SYMBOLS=yes
+fi
+
+
+case "X-$DEPREC_SYMBOLS" in
+  X-yes)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    DEPRECATED_SYMBOLS=yes
+    ;;
+  X-no|*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    DEPRECATED_SYMBOLS=no
+
+$as_echo "#define NO_DEPRECATED_SYMBOLS 1" >>confdefs.h
+
+    ;;
+esac
+
+ac_config_files="$ac_config_files Makefile libhdf4.settings hdf/Makefile hdf/examples/Makefile hdf/fortran/Makefile hdf/fortran/examples/Makefile hdf/src/Makefile hdf/test/Makefile hdf/util/Makefile hdf/util/h4cc hdf/util/h4fc hdf/util/h4redeploy hdf/util/testutil.sh man/Makefile mfhdf/fortran/ftest.f mfhdf/fortran/jackets.c mfhdf/fortran/netcdf.inc mfhdf/libsrc/netcdf.h mfhdf/Makefile mfhdf/dumper/Makefile mfhdf/dumper/testhdp.sh mfhdf/examples/Makefile mfhdf/examples/testexamples.sh mf [...]
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    if test "x$cache_file" != "x/dev/null"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HDF_BUILD_NETCDF_TRUE}" && test -z "${HDF_BUILD_NETCDF_FALSE}"; then
+  as_fn_error $? "conditional \"HDF_BUILD_NETCDF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HDF_BUILD_FORTRAN_TRUE}" && test -z "${HDF_BUILD_FORTRAN_FALSE}"; then
+  as_fn_error $? "conditional \"HDF_BUILD_FORTRAN\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${BUILD_SHARED_SZIP_CONDITIONAL_TRUE}" && test -z "${BUILD_SHARED_SZIP_CONDITIONAL_FALSE}"; then
+  as_fn_error $? "conditional \"BUILD_SHARED_SZIP_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HDF_BUILD_XDR_TRUE}" && test -z "${HDF_BUILD_XDR_FALSE}"; then
+  as_fn_error $? "conditional \"HDF_BUILD_XDR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+if test -z "${HDF_BUILD_SHARED_TRUE}" && test -z "${HDF_BUILD_SHARED_FALSE}"; then
+  as_fn_error $? "conditional \"HDF_BUILD_SHARED\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -pR'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -pR'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -pR'
+  fi
+else
+  as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by HDF $as_me 4.2.10, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <help at hdfgroup.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+HDF config.status 4.2.10
+configured by $0, generated by GNU Autoconf 2.69,
+  with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=?*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+LD_F77='`$ECHO "$LD_F77" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_F77='`$ECHO "$reload_flag_F77" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_F77='`$ECHO "$reload_cmds_F77" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_F77='`$ECHO "$old_archive_cmds_F77" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_F77='`$ECHO "$compiler_F77" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_F77='`$ECHO "$GCC_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_F77='`$ECHO "$lt_prog_compiler_no_builtin_flag_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_F77='`$ECHO "$lt_prog_compiler_pic_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_F77='`$ECHO "$lt_prog_compiler_wl_F77" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_F77='`$ECHO "$lt_prog_compiler_static_F77" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_F77='`$ECHO "$lt_cv_prog_compiler_c_o_F77" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_F77='`$ECHO "$archive_cmds_need_lc_F77" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_F77='`$ECHO "$enable_shared_with_static_runtimes_F77" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_F77='`$ECHO "$export_dynamic_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_F77='`$ECHO "$whole_archive_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_F77='`$ECHO "$compiler_needs_object_F77" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_F77='`$ECHO "$old_archive_from_new_cmds_F77" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_F77='`$ECHO "$old_archive_from_expsyms_cmds_F77" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_F77='`$ECHO "$archive_cmds_F77" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_F77='`$ECHO "$archive_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_F77='`$ECHO "$module_cmds_F77" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_F77='`$ECHO "$module_expsym_cmds_F77" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_F77='`$ECHO "$with_gnu_ld_F77" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_F77='`$ECHO "$allow_undefined_flag_F77" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_F77='`$ECHO "$no_undefined_flag_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_F77='`$ECHO "$hardcode_direct_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_F77='`$ECHO "$hardcode_direct_absolute_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_F77='`$ECHO "$hardcode_minus_L_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_F77='`$ECHO "$hardcode_shlibpath_var_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_F77='`$ECHO "$hardcode_automatic_F77" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_F77='`$ECHO "$inherit_rpath_F77" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_F77='`$ECHO "$link_all_deplibs_F77" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_F77='`$ECHO "$always_export_symbols_F77" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_F77='`$ECHO "$export_symbols_cmds_F77" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_F77='`$ECHO "$exclude_expsyms_F77" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_F77='`$ECHO "$include_expsyms_F77" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_F77='`$ECHO "$prelink_cmds_F77" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_F77='`$ECHO "$postlink_cmds_F77" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_F77='`$ECHO "$file_list_spec_F77" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_F77='`$ECHO "$hardcode_action_F77" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_F77='`$ECHO "$compiler_lib_search_dirs_F77" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_F77='`$ECHO "$predep_objects_F77" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_F77='`$ECHO "$postdep_objects_F77" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_F77='`$ECHO "$predeps_F77" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_F77='`$ECHO "$postdeps_F77" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_F77='`$ECHO "$compiler_lib_search_path_F77" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+LD_F77 \
+reload_flag_CXX \
+reload_flag_F77 \
+compiler_CXX \
+compiler_F77 \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_no_builtin_flag_F77 \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_pic_F77 \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_wl_F77 \
+lt_prog_compiler_static_CXX \
+lt_prog_compiler_static_F77 \
+lt_cv_prog_compiler_c_o_CXX \
+lt_cv_prog_compiler_c_o_F77 \
+export_dynamic_flag_spec_CXX \
+export_dynamic_flag_spec_F77 \
+whole_archive_flag_spec_CXX \
+whole_archive_flag_spec_F77 \
+compiler_needs_object_CXX \
+compiler_needs_object_F77 \
+with_gnu_ld_CXX \
+with_gnu_ld_F77 \
+allow_undefined_flag_CXX \
+allow_undefined_flag_F77 \
+no_undefined_flag_CXX \
+no_undefined_flag_F77 \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_F77 \
+hardcode_libdir_separator_CXX \
+hardcode_libdir_separator_F77 \
+exclude_expsyms_CXX \
+exclude_expsyms_F77 \
+include_expsyms_CXX \
+include_expsyms_F77 \
+file_list_spec_CXX \
+file_list_spec_F77 \
+compiler_lib_search_dirs_CXX \
+compiler_lib_search_dirs_F77 \
+predep_objects_CXX \
+predep_objects_F77 \
+postdep_objects_CXX \
+postdep_objects_F77 \
+predeps_CXX \
+predeps_F77 \
+postdeps_CXX \
+postdeps_F77 \
+compiler_lib_search_path_CXX \
+compiler_lib_search_path_F77; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+reload_cmds_CXX \
+reload_cmds_F77 \
+old_archive_cmds_CXX \
+old_archive_cmds_F77 \
+old_archive_from_new_cmds_CXX \
+old_archive_from_new_cmds_F77 \
+old_archive_from_expsyms_cmds_CXX \
+old_archive_from_expsyms_cmds_F77 \
+archive_cmds_CXX \
+archive_cmds_F77 \
+archive_expsym_cmds_CXX \
+archive_expsym_cmds_F77 \
+module_cmds_CXX \
+module_cmds_F77 \
+module_expsym_cmds_CXX \
+module_expsym_cmds_F77 \
+export_symbols_cmds_CXX \
+export_symbols_cmds_F77 \
+prelink_cmds_CXX \
+prelink_cmds_F77 \
+postlink_cmds_CXX \
+postlink_cmds_F77; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+
+
+ac_aux_dir='$ac_aux_dir'
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "hdf/src/h4config.h") CONFIG_HEADERS="$CONFIG_HEADERS hdf/src/h4config.h" ;;
+    "h4config") CONFIG_COMMANDS="$CONFIG_COMMANDS h4config" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "libhdf4.settings") CONFIG_FILES="$CONFIG_FILES libhdf4.settings" ;;
+    "hdf/Makefile") CONFIG_FILES="$CONFIG_FILES hdf/Makefile" ;;
+    "hdf/examples/Makefile") CONFIG_FILES="$CONFIG_FILES hdf/examples/Makefile" ;;
+    "hdf/fortran/Makefile") CONFIG_FILES="$CONFIG_FILES hdf/fortran/Makefile" ;;
+    "hdf/fortran/examples/Makefile") CONFIG_FILES="$CONFIG_FILES hdf/fortran/examples/Makefile" ;;
+    "hdf/src/Makefile") CONFIG_FILES="$CONFIG_FILES hdf/src/Makefile" ;;
+    "hdf/test/Makefile") CONFIG_FILES="$CONFIG_FILES hdf/test/Makefile" ;;
+    "hdf/util/Makefile") CONFIG_FILES="$CONFIG_FILES hdf/util/Makefile" ;;
+    "hdf/util/h4cc") CONFIG_FILES="$CONFIG_FILES hdf/util/h4cc" ;;
+    "hdf/util/h4fc") CONFIG_FILES="$CONFIG_FILES hdf/util/h4fc" ;;
+    "hdf/util/h4redeploy") CONFIG_FILES="$CONFIG_FILES hdf/util/h4redeploy" ;;
+    "hdf/util/testutil.sh") CONFIG_FILES="$CONFIG_FILES hdf/util/testutil.sh" ;;
+    "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+    "mfhdf/fortran/ftest.f") CONFIG_FILES="$CONFIG_FILES mfhdf/fortran/ftest.f" ;;
+    "mfhdf/fortran/jackets.c") CONFIG_FILES="$CONFIG_FILES mfhdf/fortran/jackets.c" ;;
+    "mfhdf/fortran/netcdf.inc") CONFIG_FILES="$CONFIG_FILES mfhdf/fortran/netcdf.inc" ;;
+    "mfhdf/libsrc/netcdf.h") CONFIG_FILES="$CONFIG_FILES mfhdf/libsrc/netcdf.h" ;;
+    "mfhdf/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/Makefile" ;;
+    "mfhdf/dumper/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/dumper/Makefile" ;;
+    "mfhdf/dumper/testhdp.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/dumper/testhdp.sh" ;;
+    "mfhdf/examples/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/examples/Makefile" ;;
+    "mfhdf/examples/testexamples.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/examples/testexamples.sh" ;;
+    "mfhdf/fortran/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/fortran/Makefile" ;;
+    "mfhdf/fortran/examples/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/fortran/examples/Makefile" ;;
+    "mfhdf/fortran/testfortran.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/fortran/testfortran.sh" ;;
+    "mfhdf/hdfimport/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/hdfimport/Makefile" ;;
+    "mfhdf/hdfimport/testutil.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/hdfimport/testutil.sh" ;;
+    "mfhdf/hdiff/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/hdiff/Makefile" ;;
+    "mfhdf/hdiff/testhdiff.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/hdiff/testhdiff.sh" ;;
+    "mfhdf/hrepack/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/hrepack/Makefile" ;;
+    "mfhdf/hrepack/hrepack_all.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/hrepack/hrepack_all.sh" ;;
+    "mfhdf/libsrc/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/libsrc/Makefile" ;;
+    "mfhdf/ncdump/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/ncdump/Makefile" ;;
+    "mfhdf/ncdump/testncdump.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/ncdump/testncdump.sh" ;;
+    "mfhdf/ncgen/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/ncgen/Makefile" ;;
+    "mfhdf/ncgen/testncgen.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/ncgen/testncgen.sh" ;;
+    "mfhdf/nctest/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/nctest/Makefile" ;;
+    "mfhdf/test/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/test/Makefile" ;;
+    "mfhdf/test/testmfhdf.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/test/testmfhdf.sh" ;;
+    "mfhdf/xdr/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/xdr/Makefile" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp= ac_tmp=
+  trap 'exit_status=$?
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = ""
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$ac_tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+	`' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
+
+  rm -f "$ac_tmp/stdin"
+  case $ac_file in
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
+  fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$_am_arg" : 'X\(//\)[^/]' \| \
+	 X"$_am_arg" : 'X\(//\)$' \| \
+	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "h4config":C)
+  echo "modifying hdf/src/h4config.h"
+  sed 's/#define /#define H4_/' < hdf/src/h4config.h |\
+    sed 's/#undef /#undef H4_/' > h4config
+  cp h4config hdf/src/h4config.h
+  rm -f h4config
+
+#if test ! -f hdf/src/h4config.h; then
+#    /bin/mv -f h4config hdf/src/h4config.h
+#  elif (diff h4config hdf/src/h4config.h >/dev/null); then
+#    /bin/rm -f h4config
+#    echo "hdf/src/h4config.h is unchanged"
+#  else
+#    /bin/mv -f h4config hdf/src/h4config.h
+#  fi
+
+  echo "Post process libhdf4.settings"
+  sed '/^#/d' < libhdf4.settings > libhdf4.settings.TMP
+  cp libhdf4.settings.TMP libhdf4.settings
+  rm -f libhdf4.settings.TMP
+ ;;
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named 'Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running 'make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+ ;;
+    "libtool":C)
+
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags="CXX F77 "
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: F77
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_F77
+reload_cmds=$lt_reload_cmds_F77
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_F77
+
+# A language specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_F77
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_F77
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_F77
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_F77
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_F77
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_F77
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_F77
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_F77
+postdep_objects=$lt_postdep_objects_F77
+predeps=$lt_predeps_F77
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# ### END LIBTOOL TAG CONFIG: F77
+_LT_EOF
+
+ ;;
+
+  esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+## A temporary patch. These code were after where it did
+## cp config/netcdf-XXX.h netcdf.h before.
+## Moved it here after AC_CONFIG_FILES(... mfhdf/libsrc/netcdf.h ).
+## Need a better and correct solution.
+##
+if test "X$BUILD_NETCDF" != "Xyes"; then
+    echo "Renaming \"mfhdf/libsrc/netcdf.h\" to \"mfhdf/libsrc/hdf4_netcdf.h\" ."
+    mv mfhdf/libsrc/netcdf.h mfhdf/libsrc/hdf4_netcdf.h
+fi
+
+chmod 755 hdf/util/h4cc hdf/util/h4redeploy
+
+if test "X$BUILD_FORTRAN" = "Xyes"; then
+  chmod 755 hdf/util/h4fc
+fi
+
+## show the configure settings
+cat libhdf4.settings
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..79417b2
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,1030 @@
+## Process this file with autoconf to produce configure.
+##
+##
+## Copyright by The HDF Group.
+## Copyright by the Board of Trustees of the University of Illinois.
+## All rights reserved.
+##
+## This file is part of HDF.  The full HDF 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
+## http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have
+## access to either file, you may request a copy from help at hdfgroup.org.
+## 
+##
+AC_REVISION($Id: configure.ac 6079 2014-02-08 00:29:03Z bmribler $)
+
+## ======================================================================
+## Initialize configure.
+## ======================================================================
+## AC_INIT takes the name of the package, the version number, and an
+## email address to report bugs. AC_CONFIG_SRCDIR takes a unique file
+## as its argument.
+##
+## NOTE: Do not forget to change the version number here when we do a
+## release!!!
+##
+AC_INIT([HDF], [4.2.10], [help at hdfgroup.org])
+AC_CONFIG_SRCDIR([hdf/src/atom.c])
+AC_CONFIG_AUX_DIR([bin])
+AC_CONFIG_HEADER([hdf/src/h4config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+## AM_INIT_AUTOMAKE takes a list of options that should be applied to
+## every Makefile.am when automake is run.
+AM_INIT_AUTOMAKE([foreign])
+
+## AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies
+## for Makefiles, configure, etc.  If AM_MAINTAINER_MODE
+## is *not* included here, these files will be rebuilt if out of date.
+## This is a problem because if users try to build on a machine with
+## the wrong versions of autoconf and automake, these files will be
+## rebuilt with the wrong versions and bad things can happen.
+## Also, CVS doesn't preserve dependencies between timestamps, so
+## Makefiles will often think rebuilding needs to occur when it doesn't.
+## Developers should './configure --enable-maintainer-mode' to turn on
+## rebuild rules.
+AM_MAINTAINER_MODE
+
+## ----------------------------------------------------------------------
+## Set prefix default (install directory) to a directory in the build area.
+## This allows multiple src-dir builds within one host.
+AC_PREFIX_DEFAULT([`pwd`/hdf4])
+
+## Run post processing on files created by configure.
+## src/h4config.h:
+## libhdf4.settings:
+## Remove all lines begun with "#" which are generated by CONDITIONAL's of
+## configure.
+AC_CONFIG_COMMANDS([h4config], [
+  echo "modifying hdf/src/h4config.h"
+  sed 's/#define /#define H4_/' < hdf/src/h4config.h |\
+    sed 's/#undef /#undef H4_/' > h4config
+  cp h4config hdf/src/h4config.h
+  rm -f h4config
+
+#if test ! -f hdf/src/h4config.h; then
+#    /bin/mv -f h4config hdf/src/h4config.h
+#  elif (diff h4config hdf/src/h4config.h >/dev/null); then
+#    /bin/rm -f h4config
+#    echo "hdf/src/h4config.h is unchanged"
+#  else
+#    /bin/mv -f h4config hdf/src/h4config.h
+#  fi
+
+  echo "Post process libhdf4.settings"
+  sed '/^#/d' < libhdf4.settings > libhdf4.settings.TMP
+  cp libhdf4.settings.TMP libhdf4.settings
+  rm -f libhdf4.settings.TMP
+])
+
+## ======================================================================
+## Information on the package
+## ======================================================================
+
+## Dump all shell variables values.
+AC_MSG_CHECKING([shell variables initial values])
+set >&AS_MESSAGE_LOG_FD
+AC_MSG_RESULT([done])
+
+AC_CANONICAL_HOST
+
+AC_MSG_CHECKING([if basename works])
+BASENAME_TEST="`basename /foo/bar/baz/qux/basename_works`"
+if test $BASENAME_TEST != "basename_works"; then
+  AC_MSG_ERROR([basename program doesn't work])
+else
+  AC_MSG_RESULT([yes])
+fi
+
+AC_MSG_CHECKING([if xargs works])
+XARGS_TEST="`echo /foo/bar/baz/qux/xargs_works | xargs basename`"
+if test $XARGS_TEST != "xargs_works"; then
+  AC_MSG_ERROR([xargs program doesn't work])
+else
+  AC_MSG_RESULT([yes])
+fi
+
+## Source any special files that we need. These files normally aren't
+## present but can be used by the maintainers to fine tune things like
+## turning on debug or profiling flags for the compiler. The search order
+## is:
+##
+##         CPU-VENDOR-OS
+##         VENDOR-OS
+##         CPU-OS
+##         CPU-VENDOR
+##         OS
+##         VENDOR
+##         CPU
+##
+## If the `OS' ends with a version number then remove it. For instance,
+## `freebsd3.1' would become `freebsd'
+##
+case "$host_os" in
+  aix4.*)       host_os_novers="aix4.x"     ;;
+  aix5.*)       host_os_novers="aix5.x"     ;;
+  darwin10.*)   host_os_novers="darwin10.x" ;;
+  darwin11.*)   host_os_novers="darwin11.x" ;;
+  darwin12.*)   host_os_novers="darwin12.x" ;;
+  freebsd*)     host_os_novers="freebsd"    ;;
+  solaris2.*)   host_os_novers="solaris2.x" ;;
+  *)            host_os_novers="$host_os"   ;;
+esac
+
+host_config="none"
+for f in $host_cpu-$host_vendor-$host_os        \
+         $host_cpu-$host_vendor-$host_os_novers \
+         $host_vendor-$host_os                  \
+         $host_vendor-$host_os_novers           \
+         $host_cpu-$host_os                     \
+         $host_cpu-$host_os_novers              \
+         $host_cpu-$host_vendor                 \
+         $host_os                               \
+         $host_os_novers                        \
+         $host_vendor                           \
+         $host_cpu ; do
+  AC_MSG_CHECKING([for config $f])
+  if test -f "$srcdir/config/$f"; then
+    host_config=$srcdir/config/$f
+    AC_MSG_RESULT([found])
+    break
+  fi
+  AC_MSG_RESULT([no])
+done
+if test "X$host_config" != "Xnone"; then
+  CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
+  F77_BASENAME="`echo $F77 | cut -f1 -d' ' | xargs basename 2>/dev/null`"
+  CXX_BASENAME="`echo $CXX | cut -f1 -d' ' | xargs basename 2>/dev/null`"
+  . $host_config
+fi
+
+## ======================================================================
+## Checks for NetCDF-2.3.2 support 
+## ======================================================================
+
+# We disable Fortran netCDF APIs and their testing when --disable-netcdf is used.
+# Let's define a proper variable to be used in mfhdf/testfortran.sh.in to run 
+# the netCDF Fortran APIs test program "ftest". 
+AC_SUBST(TEST_FORTRAN_NETCDF) TEST_FORTRAN_NETCDF="yes"
+
+AC_ARG_ENABLE([netcdf],
+              [AS_HELP_STRING([--enable-netcdf],
+                              [Build HDF4 versions of NetCDF APIs (version 2.3.2) [default=yes]])],,
+              [enableval="yes"])
+
+case "$enableval" in
+  yes)
+    BUILD_NETCDF="yes"
+    AC_DEFINE([HAVE_NETCDF], [1], [Define if we support HDF NetCDF APIs version 2.3.2])
+    ;;
+  no)
+    BUILD_NETCDF="no"
+    TEST_FORTRAN_NETCDF="no"
+    ;;
+esac
+AM_CONDITIONAL([HDF_BUILD_NETCDF], [test "X$BUILD_NETCDF" = "Xyes"])
+AC_SUBST([BUILD_NETCDF])
+
+## ======================================================================
+## Checks for programs
+## ======================================================================
+
+AC_PROG_MAKE_SET
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_CXX
+
+AC_ARG_ENABLE([fortran],
+              [AS_HELP_STRING([--enable-fortran],
+                              [Build Fortran into library [default=yes]])],,
+              [enableval="yes"])
+
+case "$enableval" in
+  yes)
+    BUILD_FORTRAN="yes"
+    AC_PROG_F77
+    AC_F77_WRAPPERS
+
+    if test "X$F77" = "X"; then
+      BUILD_FORTRAN="no"
+    fi
+    ;;
+  no)
+    BUILD_FORTRAN="no"
+    F77="no"
+    ;;
+esac
+AM_CONDITIONAL([HDF_BUILD_FORTRAN], [test "X$BUILD_FORTRAN" = "Xyes"])
+AC_SUBST([BUILD_FORTRAN])
+
+## -------------------------------------------------------------------------
+## Build static libraries by default. Furthermore, fortran shared libraries
+## are unsupported. Disallow a user from enabling both shared libraries and
+## fortran.
+if test "X${enable_shared}" != "Xyes"; then
+    enable_shared="no"
+fi
+
+if test "X${enable_shared}" = "Xyes"; then
+    if test "X${BUILD_FORTRAN}" = "Xyes"; then
+        AC_MSG_ERROR([Cannot build shared fortran libraries. Please configure with --disable-fortran flag.])
+    fi
+fi
+
+AC_PROG_INSTALL
+AC_PROG_LN_S
+
+AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH])
+
+AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [none], [])
+
+if test "$YACC" = "none"; then
+  AC_MSG_ERROR([cannot find yacc utility])
+fi
+
+AC_CHECK_PROGS([LEX], [flex lex], [none], [])
+
+if test "$LEX" = "none"; then
+  AC_MSG_ERROR([cannot find lex utility])
+fi
+
+AC_CHECK_PROG([DIFF],     [diff],     [diff -w])
+AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
+AC_CHECK_PROG([NEQN],     [neqn],     [neqn])
+AC_CHECK_PROG([TBL],      [tbl],      [tbl])
+
+AC_SUBST([AR])
+AC_SUBST([DIFF])
+AC_SUBST([STATIC_SHARED])
+AC_SUBST([SHARED_EXTENSION])
+AC_SUBST([enable_shared])
+AC_SUBST([enable_static])
+AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a`
+AC_SUBST([STATIC_EXEC]) STATIC_EXEC=no
+AC_SUBST([LT_STATIC_EXEC])
+
+## ======================================================================
+## Libtool initialization
+## ======================================================================
+LT_INIT([dlopen disable-shared])
+LT_OUTPUT
+
+## ----------------------------------------------------------------------
+## Check if we should install only statically linked executables.
+##   This check needs to occur after libtool is initialized because
+##   we check a libtool cache value and may issue a warning based
+##   on its result.
+AC_MSG_CHECKING([if we should install only statically linked executables])
+AC_ARG_ENABLE([static_exec],
+              [AS_HELP_STRING([--enable-static-exec],
+                              [Install only statically linked executables
+                               [default=no]])],
+              [STATIC_EXEC=$enableval])
+
+if test "X$STATIC_EXEC" = "Xyes"; then
+  echo "yes"
+  ## Issue a warning if -static flag is not supported.
+  if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then
+      echo "    warning: -static flag not supported on this system; executable won't statically link shared system libraries."
+  fi
+  LT_STATIC_EXEC="-all-static"
+else
+  echo "no"
+  LT_STATIC_EXEC=""
+fi
+
+AC_SUBST([LT_STATIC_EXEC])
+
+## ======================================================================
+## Checks for libraries
+## ======================================================================
+
+## ----------------------------------------------------------------------
+## Fake --with-xxx option to allow us to create a help message for the
+## following --with-xxx options which can take either a =DIR or =INC,LIB
+## specifier.
+##
+AC_ARG_WITH([fnord],
+  [
+ For the following --with-xxx options, you can specify where the header
+ files and libraries are in two different ways:
+
+    --with-xxx=INC,LIB - Specify individually the include directory and
+                         library directory separated by a comma
+    --with-xxx=DIR     - Specify only the directory which contains the
+                         include/ and lib/ subdirectories
+  ])
+
+## ----------------------------------------------------------------------
+## Is the GNU zlib present? It has a header file `zlib.h' and a library
+## `-lz' and their locations might be specified with the `--with-zlib'
+## command-line switch. The value is an include path and/or a library path.
+## If the library path is specified then it must be preceded by a comma.
+AC_ARG_WITH([zlib],
+            [AS_HELP_STRING([--with-zlib=DIR],
+                            [Use zlib library [default=yes]])],,
+            [withval=yes])
+
+case "$withval" in
+  yes)
+    HAVE_ZLIB="yes"
+    AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB])
+    if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
+      AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
+    fi
+    if test -z "$HAVE_ZLIB"; then
+      if test -n "$HDF5_CONFIG_ABORT"; then
+        AC_MSG_ERROR([couldn't find zlib library])
+      fi
+    else
+      AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
+    fi
+    ;;
+  no)
+    HAVE_ZLIB="no"
+    AC_MSG_ERROR([zlib library required to build HDF4])
+    ;;
+  *)
+    HAVE_ZLIB="yes"
+    case "$withval" in
+      *,*)
+        zlib_inc="`echo $withval | cut -f1 -d,`"
+        zlib_lib="`echo $withval | cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          zlib_inc="$withval/include"
+          zlib_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    ## Trying to include -I/usr/include and -L/usr/lib is redundant and
+    ## can mess some compilers up.
+    if test "X$zlib_inc" = "X/usr/include"; then
+      zlib_inc=""
+    fi
+    if test "X$zlib_lib" = "X/usr/lib"; then
+      zlib_lib=""
+    fi
+
+    if test -n "$zlib_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$zlib_inc"
+    fi
+
+    AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB])
+
+    if test -n "$zlib_lib"; then
+      LDFLAGS="$LDFLAGS -L$zlib_lib"
+    fi
+
+    if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
+      AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
+    fi
+
+    if test -z "$HAVE_ZLIB"; then
+      AC_MSG_ERROR([couldn't find zlib library])
+    else
+      AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
+    fi
+    ;;
+esac
+
+## ----------------------------------------------------------------------
+## Is the JPEG library present?
+AC_ARG_WITH([jpeg],
+            [AS_HELP_STRING([--with-jpeg=DIR],
+                            [Use jpeg library [default=yes]])],,
+            [withval=yes])
+
+case "$withval" in
+  yes)
+    HAVE_JPEG="yes"
+    AC_CHECK_HEADERS([jpeglib.h], [HAVE_JPEG_H="yes"], [unset HAVE_JPEG])
+    if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then
+      AC_CHECK_LIB([jpeg], [jpeg_start_decompress],, [unset HAVE_JPEG])
+    fi
+
+    if test -z "$HAVE_JPEG"; then
+      AC_MSG_ERROR([couldn't find jpeg library])
+    fi
+    ;;
+  no)
+    HAVE_JPEG="no"
+    AC_MSG_ERROR([jpeg library required to build HDF4])
+    ;;
+  *)
+    HAVE_JPEG="yes"
+    case "$withval" in
+      *,*)
+        jpeg_inc="`echo $withval | cut -f1 -d,`"
+        jpeg_lib="`echo $withval | cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          jpeg_inc="$withval/include"
+          jpeg_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    ## Trying to include -I/usr/include and -L/usr/lib is redundant and
+    ## can mess some compilers up.
+    if test "X$jpeg_inc" = "X/usr/include"; then
+      jpeg_inc=""
+    fi
+    if test "X$jpeg_lib" = "X/usr/lib"; then
+      jpeg_lib=""
+    fi
+
+    if test -n "$jpeg_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$jpeg_inc"
+    fi
+
+    AC_CHECK_HEADERS([jpeglib.h], [HAVE_JPEG_H="yes"], [unset HAVE_JPEG])
+
+    if test -n "$jpeg_lib"; then
+      LDFLAGS="$LDFLAGS -L$jpeg_lib"
+    fi
+
+    if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then
+      AC_CHECK_LIB([jpeg], [jpeg_start_decompress],, [unset HAVE_JPEG])
+    fi
+
+    if test -z "$HAVE_JPEG"; then
+      AC_MSG_ERROR([couldn't find jpeg library])
+    fi
+    ;;
+esac
+
+## ----------------------------------------------------------------------
+## Is the szip library present?
+AC_SUBST(USE_COMP_SZIP) USE_COMP_SZIP="no"
+AC_ARG_WITH([szlib],
+            [AS_HELP_STRING([--with-szlib=DIR],
+                            [Use szlib library [default=no]])],,
+            [withval=no])
+
+case "$withval" in
+  yes)
+    HAVE_SZIP="yes"
+    AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP])
+    if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
+      AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP])
+    fi
+
+    if test -z "$HAVE_SZIP"; then
+      AC_MSG_ERROR([couldn't find szlib library])
+    fi
+    ;;
+  no)
+    HAVE_SZIP="no"
+    AC_MSG_CHECKING([for szlib])
+    AC_MSG_RESULT([suppressed])
+    SZIP_INFO="${SZIP_INFO}disabled"
+    ;;
+  *)
+    HAVE_SZIP="yes"
+    case "$withval" in
+      *,*)
+        szip_inc="`echo $withval | cut -f1 -d,`"
+        szip_lib="`echo $withval | cut -f2 -d, -s`"
+        ;;
+      *)
+        if test -n "$withval"; then
+          szip_inc="$withval/include"
+          szip_lib="$withval/lib"
+        fi
+        ;;
+    esac
+
+    ## Trying to include -I/usr/include and -L/usr/lib is redundant and
+    ## can mess some compilers up.
+    if test "X$szip_inc" = "X/usr/include"; then
+      szip_inc=""
+    fi
+    if test "X$szip_lib" = "X/usr/lib"; then
+      szip_lib=""
+    fi
+
+    if test -n "$szip_inc"; then
+      CPPFLAGS="$CPPFLAGS -I$szip_inc"
+    fi
+
+    AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP])
+
+    if test -n "$szip_lib"; then
+      LDFLAGS="$LDFLAGS -L$szip_lib"
+    fi
+
+    if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
+      AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP])
+    fi
+
+    if test -z "$HAVE_SZIP"; then
+      AC_MSG_ERROR([couldn't find szlib library])
+    else
+      USE_COMP_SZIP="yes"
+    fi
+    ;;
+esac
+
+## Check to see if SZIP has encoder 
+if test "X$HAVE_SZIP" = "Xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
+    ## SZLIB library is available. Check if it can encode.
+    AC_MSG_CHECKING([for szlib encoder])
+
+    ## Set LD_LIBRARY_PATH so encoder test can find the library and run.
+    if test -z "$LD_LIBRARY_PATH"; then
+        export LD_LIBRARY_PATH="$szip_lib"
+    else
+        export LD_LIBRARY_PATH="${szip_lib}:$LD_LIBRARY_PATH"
+    fi
+
+    AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH"
+
+    AC_TRY_RUN([
+    #include <stdlib.h>
+    #include <szlib.h>
+
+    int main(void)
+    {
+        /* SZ_encoder_enabled returns 1 if encoder is present */
+        if (SZ_encoder_enabled() == 1)
+            exit(0);
+        else
+            exit(1);
+    }
+    ], [CAN_ENCODE="yes"], [CAN_ENCODE="no"],)
+
+    ## Report szip encoder test results
+    if test "X$CAN_ENCODE" = "Xyes"; then
+        AC_MSG_RESULT([yes])
+    fi
+    if test "X$CAN_ENCODE" = "Xno"; then
+        AC_MSG_RESULT([no])
+    fi
+
+    ## Add "szip" to external filter list
+    if test "X$CAN_ENCODE" = "Xyes"; then
+        if test "X$SZIP_INFO" != "X"; then
+            SZIP_INFO="${SZIP_INFO}"
+        fi
+        SZIP_INFO="${SZIP_INFO}enabled with encoder"
+    fi
+
+    if test "X$CAN_ENCODE" = "Xno"; then
+        if test "X$SZIP_INFO" != "X"; then
+            SZIP_INFO="${SZIP_INFO}"
+        fi
+        SZIP_INFO="${SZIP_INFO}enabled with decoder only"
+    fi
+
+    ## Create macro to specify if encoder is present
+    if test "X$CAN_ENCODE" = "Xyes"; then
+        AC_DEFINE([HAVE_SZIP_ENCODER], [1],
+                [Define if szip has encoder])
+        SZIP_HAS_ENCODER="yes"
+    fi
+fi
+AC_SUBST([SZIP_INFO])
+
+AM_CONDITIONAL([BUILD_SHARED_SZIP_CONDITIONAL], [test "X$USE_COMP_SZIP" = "Xyes" && test "X$LL_PATH" != "X"])
+
+## ----------------------------------------------------------------------
+## Is XDR support present? The TRY_LINK info was gotten from the
+## mfhdf/libsrc/local_nc.c file.
+AC_MSG_CHECKING([for xdr library support])
+
+AC_ARG_ENABLE([hdf4-xdr],
+              [AS_HELP_STRING([--enable-hdf4-xdr],
+                              [Build xdr library from code in HDF4 source.
+                               Not supported for 64 bit mode. [default="no"]])],
+              [enableval="yes"],[enableval="no"])
+
+case "$enableval" in
+  yes)
+    BUILD_XDR="yes"
+    AC_MSG_RESULT([using HDF4 XDR]);
+    ;;
+  no)
+    BUILD_XDR="no"
+    ;;
+esac
+
+if test "X$BUILD_XDR" != "Xyes"; then
+    AC_TRY_LINK([
+    #include <rpc/types.h>
+    #include <rpc/xdr.h>], [xdr_int],
+                [AC_MSG_RESULT([yes]); BUILD_XDR="no"],
+                [AC_MSG_RESULT([no]); BUILD_XDR="yes"])
+fi
+
+AM_CONDITIONAL([HDF_BUILD_XDR], [test "X$BUILD_XDR" = "Xyes"])
+
+
+## Check headers and add libraries for XDR if the HDF4 XDR library is not used.
+if test "X$BUILD_XDR" != "Xyes"; then
+  ## For Solaris systems, add the -nsl for XDR support
+  ##
+  ## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support
+  case "$host" in
+    *-solaris*)
+      LIBS="$LIBS -lnsl"  ;;
+    *-pc-cygwin*)
+      LIBS="$LIBS -ltirpc"  ;;
+    *) ;;
+  esac
+
+  ## ======================================================================
+  ## Checks for header files
+  ## ======================================================================
+
+  ## ----------------------------------------------------------------------
+  ## We're trying to link against the rpc library when building on Cygwin,
+  ## but we need to make sure that it is present on the system. Do that here,
+  ## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support
+  case "$host" in
+    *-pc-cygwin*)
+      HAVE_RPC="yes"
+      AC_CHECK_HEADER([rpc.h],[:], [unset HAVE_RPC])
+      AC_CHECK_LIB([tirpc], [xdr_opaque],[:], [unset HAVE_RPC])
+      if test -z "$HAVE_RPC"; then
+        AC_MSG_ERROR([couldn't find tirpc library])
+      fi
+      ;;
+  esac
+fi
+
+AC_HEADER_STDC
+
+## ======================================================================
+## Checks for types
+## ======================================================================
+
+## ======================================================================
+## Checks for structures
+## ======================================================================
+
+## ======================================================================
+## Checks for compiler characteristics
+## ======================================================================
+
+AC_PROG_CC_C_O
+AC_PROG_CXXCPP
+
+if test "X$BUILD_FORTRAN" = "Xyes"; then
+  AC_PROG_F77_C_O
+fi
+
+## This is a bit of a hack. The AC_CHECK_SIZEOF macro is supposed to
+## #define a value in a header file. However, we don't use a generated
+## header file. So I check the value left over from autoconf's test  is
+## >= 8.
+AC_CHECK_SIZEOF([int*])
+
+if test $ac_cv_sizeof_intp -ge 8; then
+  CPPFLAGS="$CPPFLAGS -DBIG_LONGS"
+
+  ## Define super secret special flag for AIX machines in 64-bit mode.
+  case "${host}" in
+    *-ibm-aix*) CPPFLAGS="$CPPFLAGS -DAIX5L64" ;;
+    *)          ;;
+  esac
+  if test "X$BUILD_XDR" = "Xyes"; then
+    AC_MSG_ERROR([--enable-hdf4-xdr is not supported for 64 bit mode.])
+  fi
+fi
+
+## ----------------------------------------------------------------------
+## Set some variables for general configuration information to be saved
+## and installed with the libraries.
+##
+
+## HDF4 version from the first line of the README.txt file.
+H4_VERSION="`cut -d' ' -f3 $srcdir/README.txt | head -1`"
+AC_SUBST([H4_VERSION])
+
+## Configuration date
+AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`"
+
+## User doing the configuration
+AC_SUBST([CONFIG_USER]) CONFIG_USER="`whoami`@`hostname`"
+
+## Configuration mode (production, development, etc)
+AC_SUBST([CONFIG_MODE])
+
+AC_C_BIGENDIAN([], [CPPFLAGS="$CPPFLAGS -DSWAP"])
+
+## Are we building this in debug or production mode? (Remove the -g flag
+## in production mode.)
+AC_MSG_CHECKING([for build mode])
+AC_ARG_ENABLE([production],
+              [AS_HELP_STRING([--enable-production],
+                              [Determines how to run the compiler.])])
+
+case "X-$enable_production" in
+  X-|X-yes)
+    AC_MSG_RESULT([production])
+    CONFIG_MODE=production
+    ## Remove the "-g" flag from compile line if it's in there.
+    CFLAGS_temp=""
+    if test -n "$CFLAGS"; then
+      for d in $CFLAGS ; do
+        if test "X$d" != "X-g"; then
+          CFLAGS_temp="$CFLAGS_temp $d"
+        fi
+      done
+      CFLAGS=$CFLAGS_temp
+    fi
+
+    FFLAGS_temp=""
+    if test -n "$FFLAGS"; then
+      for d in $FFLAGS ; do
+        if test "X$d" != "X-g"; then
+          FFLAGS_temp="$FFLAGS_temp $d"
+        fi
+      done
+      FFLAGS=$FFLAGS_temp
+    fi
+
+    CXXFLAGS_temp=""
+    if test -n "$CXXFLAGS"; then
+      for d in $CXXFLAGS ; do
+        if test "X$d" != "X-g"; then
+          CXXFLAGS_temp="$CXXFLAGS_temp $d"
+        fi
+      done
+      CXXFLAGS=$CXXFLAGS_temp
+    fi
+
+    CFLAGS="$CFLAGS $PROD_CFLAGS"
+    CXXFLAGS="$CXXFLAGS $PROD_CXXFLAGS"
+    FFLAGS="$FFLAGS $PROD_FFLAGS"
+    CPPFLAGS="$CPPFLAGS $PROD_CPPFLAGS"
+    ;;
+  X-no)
+    AC_MSG_RESULT([development])
+    CONFIG_MODE=development
+    CFLAGS="$CFLAGS $DEBUG_CFLAGS"
+    FFLAGS="$FFLAGS $DEBUG_FFLAGS"
+    CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS"
+    CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS"
+    ;;
+  *)
+    AC_MSG_RESULT([user-defined])
+    ;;
+esac
+
+## ======================================================================
+## Checks for library functions
+## ======================================================================
+
+AC_MSG_CHECKING([for math library support])
+AC_TRY_LINK([#include <math.h>], [sinh(37.927)],
+            [AC_MSG_RESULT([yes])],
+            [AC_MSG_RESULT([no]); LIBS="$LIBS -lm"])
+
+AC_CHECK_FUNCS([fork system vfork wait])
+
+
+## ======================================================================
+## Checks for system services
+## ======================================================================
+
+## Copy NetCDF header files.
+#
+## FIXME: This is code stolen^Wborrowed from the old HDF4 configure.
+## These header files should probably be generated by autoconf instead
+## of being copied depending upon the host.
+case "$host" in
+  *-linux*)             BAR="linux"       ;;
+  *-freebsd*)           BAR="fbsd"        ;;
+  *-ibm-aix*)           BAR="aix"         ;;
+  sparc64-*-solaris2*)  BAR="solaris64"   ;;
+  *-*-solaris2*)        BAR="solaris"     ;;
+  *-apple*)             BAR="apple"       ;;
+  *-pc-cygwin*)         BAR="linux"       ;;
+  *)                    echo "*** unknown host $host!"; exit 1 ;;
+esac
+src_files=""
+src_files="`echo $src_files | sed -e s/FOO/${BAR}/g`"
+
+for config_file in $src_files; do
+  src_file="${srcdir}/`echo $config_file | sed -e s/:.*$//`"
+  target_file="`echo $config_file | sed -e s/^[[^:]]*://g`"
+
+  if test ! -r ${src_file}; then
+    echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2
+    echo '***' "since the file \"${src_file}\" does not exist." 1>&2
+    exit 1
+  fi
+
+  ## this sed command emulates the dirname command
+  dstdir=`echo "$target_file" | sed -e 's,[[^/]]*$,,;s,/$,,;s,^$,.,'`
+
+  ## Create directory for the target_file if it's not there.
+  if test ! -d $dstdir; then
+    ${srcdir}/bin/mkinstalldirs $dstdir
+  fi
+
+  echo "Copying \"${src_file}\" to \"${target_file}\" ."
+  cp ${src_file} ${target_file}
+
+  if test ! -r ${target_file}; then
+    echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2
+    exit 1
+  fi
+done
+
+## ------------------------------------------------------------------------
+## Check to see if libtool has enabled shared libraries. Set a conditional
+## as some Makefiles will build based on availability of shared libraries.
+if (./libtool --features | grep '^enable shared libraries' > /dev/null); then
+  enable_shared=yes
+else
+  enable_shared=no
+fi
+
+## ------------------------------------------------------------------------
+## Specify shared library extension the host machine should recognize.
+case "$host_os" in
+  darwin*)
+      SHARED_EXTENSION="dylib"
+      ;;
+  *)
+      SHARED_EXTENSION="so"
+      ;;
+esac
+
+## We don't need to say when we're entering directories if we're using
+## GNU make because make does it for us.
+if test "X$GMAKE" = "Xyes"; then
+  AC_SUBST([SETX]) SETX=":"
+else
+  AC_SUBST([SETX]) SETX="set -x"
+fi
+
+AM_CONDITIONAL([HDF_BUILD_SHARED], [test "X$enable_shared" = "Xyes"])
+
+## Compiler with version information. This consists of the full path
+## name of the compiler and the reported version number.
+AC_SUBST([CC_VERSION])
+## Strip anything that looks like a flag off of $CC
+CC_NOFLAGS=`echo $CC | sed 's/ -.*//'`
+
+if `echo $CC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
+  CC_VERSION="$CC"
+else
+  CC_VERSION="$CC";
+  for x in `echo $PATH | sed -e 's/:/ /g'`; do
+    if test -x $x/$CC_NOFLAGS; then
+      CC_VERSION="$x/$CC"
+      break
+    fi
+  done
+fi
+
+
+## ----------------------------------------------------------------------
+## 
+## If --enable-static-exec and are specified together, there will be ld failures for
+## "attempted static link of dynamic object" when the tools are built.  This check
+## will prevent that error during configure instead.  It could go with the other
+## --enable-static-exec checks, but since enable_static is set by default later in
+## the configure process this check has to be delayed.
+if test "X$STATIC_EXEC" = "Xyes"; then
+  if test "X${enable_static}" != "Xyes"; then
+    AC_MSG_ERROR([--enable-static-exec flag to build static executables requires static libraries.  Please configure with --enable-static flag.])
+  fi
+fi
+
+## This part doesn't work yet since HDF4 config files do not contain
+## information for cc_vendor and cc_version as HDF5 similar files do.
+## Needs to be fixed EIP 2010-01-21
+## if test -n "$cc_vendor" && test -n "$cc_version"; then
+##  CC_VERSION="$CC_VERSION ($cc_vendor-$cc_version)"
+## fi
+
+if test -n "$cc_version_info"; then
+  CC_VERSION="$CC_VERSION ( $cc_version_info)"
+fi
+
+## Fortran compiler with version information. This consists of the full path
+## name of the compiler and the reported version number.
+AC_SUBST([F77_VERSION])
+## Strip anything that looks like a flag off of $F77
+F77_NOFLAGS=`echo $F77 | sed 's/ -.*//'`
+
+if `echo $F77_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
+  F77_VERSION="$F77"
+else
+  F77_VERSION="$F77";
+  for x in `echo $PATH | sed -e 's/:/ /g'`; do
+    if test -x $x/$F77_NOFLAGS; then
+      F77_VERSION="$x/$F77"
+      break
+    fi
+  done
+fi
+if test -n "$fc_version_info"; then
+  F77_VERSION="$F77_VERSION ( $fc_version_info)"
+fi
+
+## This part doesn't work yet since HDF4 config files do not contain
+## information for fortran_vendor and fortran_version. 
+## Needs to be fixed EIP 2010-01-21
+## if test -n "$fortran_vendor" && test -n "$fortran_version"; then
+##   F77_VERSION="$F77_VERSION ($fortran_vendor-$fortran_version)"
+## fi
+
+## ----------------------------------------------------------------------
+## Enable deprecated public API symbols
+##
+AC_SUBST([DEPRECATED_SYMBOLS])
+AC_MSG_CHECKING([if deprecated public symbols are available]);
+AC_ARG_ENABLE([deprecated-symbols],
+              [AS_HELP_STRING([--enable-deprecated-symbols],
+                     [Enable deprecated public API symbols [default=yes]])],
+             [DEPREC_SYMBOLS=$enableval],
+             [DEPREC_SYMBOLS=yes])
+
+case "X-$DEPREC_SYMBOLS" in
+  X-yes)
+    AC_MSG_RESULT([yes])
+    DEPRECATED_SYMBOLS=yes
+    ;;
+  X-no|*)
+    AC_MSG_RESULT([no])
+    DEPRECATED_SYMBOLS=no
+    AC_DEFINE([NO_DEPRECATED_SYMBOLS], [1],
+              [Define if deprecated public API symbols are disabled])
+    ;;
+esac
+
+AC_CONFIG_FILES([Makefile
+                 libhdf4.settings
+                 hdf/Makefile
+                 hdf/examples/Makefile
+                 hdf/fortran/Makefile
+                 hdf/fortran/examples/Makefile
+                 hdf/src/Makefile
+                 hdf/test/Makefile
+                 hdf/util/Makefile
+                 hdf/util/h4cc
+                 hdf/util/h4fc
+                 hdf/util/h4redeploy
+                 hdf/util/testutil.sh
+                 man/Makefile
+		 mfhdf/fortran/ftest.f
+		 mfhdf/fortran/jackets.c
+		 mfhdf/fortran/netcdf.inc
+		 mfhdf/libsrc/netcdf.h
+                 mfhdf/Makefile
+                 mfhdf/dumper/Makefile
+                 mfhdf/dumper/testhdp.sh
+                 mfhdf/examples/Makefile
+                 mfhdf/examples/testexamples.sh
+                 mfhdf/fortran/Makefile
+                 mfhdf/fortran/examples/Makefile
+                 mfhdf/fortran/testfortran.sh
+                 mfhdf/hdfimport/Makefile
+                 mfhdf/hdfimport/testutil.sh
+                 mfhdf/hdiff/Makefile
+                 mfhdf/hdiff/testhdiff.sh
+                 mfhdf/hrepack/Makefile
+                 mfhdf/hrepack/hrepack_all.sh
+                 mfhdf/libsrc/Makefile
+                 mfhdf/ncdump/Makefile
+                 mfhdf/ncdump/testncdump.sh
+                 mfhdf/ncgen/Makefile
+                 mfhdf/ncgen/testncgen.sh
+                 mfhdf/nctest/Makefile
+                 mfhdf/test/Makefile
+                 mfhdf/test/testmfhdf.sh
+                 mfhdf/xdr/Makefile])
+
+AC_OUTPUT
+
+## A temporary patch. These code were after where it did
+## cp config/netcdf-XXX.h netcdf.h before.
+## Moved it here after AC_CONFIG_FILES(... mfhdf/libsrc/netcdf.h ).
+## Need a better and correct solution.
+##
+if test "X$BUILD_NETCDF" != "Xyes"; then
+    echo "Renaming \"mfhdf/libsrc/netcdf.h\" to \"mfhdf/libsrc/hdf4_netcdf.h\" ."
+    mv mfhdf/libsrc/netcdf.h mfhdf/libsrc/hdf4_netcdf.h
+fi
+
+chmod 755 hdf/util/h4cc hdf/util/h4redeploy
+
+if test "X$BUILD_FORTRAN" = "Xyes"; then
+  chmod 755 hdf/util/h4fc
+fi
+
+## show the configure settings
+cat libhdf4.settings
+
diff --git a/hdf/CMakeLists.txt b/hdf/CMakeLists.txt
new file mode 100644
index 0000000..0346584
--- /dev/null
+++ b/hdf/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_HDF)
+
+#-----------------------------------------------------------------------------
+# Option to build HDF4 Utilities
+#-----------------------------------------------------------------------------
+IF (EXISTS "${HDF4_HDF_SOURCE_DIR}/util" AND IS_DIRECTORY "${HDF4_HDF_SOURCE_DIR}/util")
+  OPTION (HDF4_BUILD_UTILS  "Build HDF4 Utilities" OFF)
+  IF (HDF4_BUILD_UTILS OR HDF4_BUILD_TOOLS)
+    ADD_SUBDIRECTORY (${HDF4_HDF_SOURCE_DIR}/util   ${HDF4_HDF_BINARY_DIR}/util)
+  ENDIF (HDF4_BUILD_UTILS OR HDF4_BUILD_TOOLS)
+ENDIF (EXISTS "${HDF4_HDF_SOURCE_DIR}/util" AND IS_DIRECTORY "${HDF4_HDF_SOURCE_DIR}/util")
diff --git a/hdf/Makefile.am b/hdf/Makefile.am
new file mode 100644
index 0000000..a5f6cdc
--- /dev/null
+++ b/hdf/Makefile.am
@@ -0,0 +1,30 @@
+include $(top_srcdir)/config/commence.am
+
+if HDF_BUILD_FORTRAN
+FORTRAN_DIR = fortran
+else
+FORTRAN_DIR = 
+endif
+
+# src folder in root Makefile, build other folders now
+SUBDIRS = src $(FORTRAN_DIR) test util
+
+DIST_SUBDIRS = src fortran test util examples
+
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples $(FORTRAN_DIR); do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
diff --git a/hdf/Makefile.in b/hdf/Makefile.in
new file mode 100644
index 0000000..cb95bfb
--- /dev/null
+++ b/hdf/Makefile.in
@@ -0,0 +1,645 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am
+subdir = hdf
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+ at HDF_BUILD_FORTRAN_FALSE@FORTRAN_DIR = 
+ at HDF_BUILD_FORTRAN_TRUE@FORTRAN_DIR = fortran
+
+# src folder in root Makefile, build other folders now
+SUBDIRS = src $(FORTRAN_DIR) test util
+DIST_SUBDIRS = src fortran test util examples
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign hdf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+cscopelist-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+		am__skip_mode_fix=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+	cscopelist-recursive ctags-recursive install-am install-strip \
+	tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	cscopelist cscopelist-recursive ctags ctags-recursive \
+	distclean distclean-generic distclean-libtool distclean-tags \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installcheck-local \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples $(FORTRAN_DIR); do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdf/examples/AN_create_annotation.c b/hdf/examples/AN_create_annotation.c
new file mode 100644
index 0000000..0b604cf
--- /dev/null
+++ b/hdf/examples/AN_create_annotation.c
@@ -0,0 +1,117 @@
+#include "hdf.h"
+
+#define  FILE_NAME      "General_HDFobjects.hdf"
+#define  VG_NAME        "AN Vgroup"
+#define  FILE_LABEL_TXT "General HDF objects"
+#define  FILE_DESC_TXT  "This is an HDF file that contains general HDF objects"
+#define  DATA_LABEL_TXT "Common AN Vgroup"
+#define  DATA_DESC_TXT  "This is a vgroup that is used to test data annotations"
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn   status_n;     /* returned status for functions returning an intn  */
+   int32  status_32,    /* returned status for functions returning an int32 */
+          file_id,      /* HDF file identifier */
+          an_id,        /* AN interface identifier */
+          file_label_id,  /* file label identifier */
+          file_desc_id,   /* file description identifier */
+          data_label_id,  /* data label identifier */
+          data_desc_id,   /* data description identifier */
+          vgroup_id;
+   uint16 vgroup_tag, vgroup_ref;
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Create the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0);
+
+   /*
+   * Initialize the AN interface.
+   */
+   an_id = ANstart (file_id);
+
+   /*
+   * Create the file label.
+   */
+   file_label_id = ANcreatef (an_id, AN_FILE_LABEL);
+
+   /*
+   * Write the annotations to the file label.
+   */
+   status_32 = ANwriteann (file_label_id, FILE_LABEL_TXT, 
+                          strlen (FILE_LABEL_TXT));
+
+   /*
+   * Create file description.
+   */
+   file_desc_id = ANcreatef (an_id, AN_FILE_DESC);
+
+   /*
+   * Write the annotation to the file description.  
+   */
+   status_32 = ANwriteann (file_desc_id, FILE_DESC_TXT, 
+                          strlen (FILE_DESC_TXT));
+
+   /*
+   * Create a vgroup in the V interface.  Note that the vgroup's ref number 
+   * is set to -1 for creating and the access mode is "w" for writing.
+   */
+   status_n = Vstart (file_id);
+   vgroup_id = Vattach (file_id, -1, "w");
+   status_32 = Vsetname (vgroup_id, VG_NAME);
+
+   /*
+   * Obtain the tag and ref number of the vgroup for subsequent
+   * references.  
+   */
+   vgroup_tag = (uint16) VQuerytag (vgroup_id);
+   vgroup_ref = (uint16) VQueryref (vgroup_id);
+
+   /*
+   * Create the data label for the vgroup identified by its tag 
+   * and ref number.
+   */
+   data_label_id = ANcreate (an_id, vgroup_tag, vgroup_ref, AN_DATA_LABEL);
+
+   /*
+   * Write the annotation text to the data label.
+   */
+   status_32 = ANwriteann (data_label_id, DATA_LABEL_TXT, 
+                          strlen (DATA_LABEL_TXT));
+
+   /*
+   * Create the data description for the vgroup identified by its tag 
+   * and ref number.
+   */
+   data_desc_id = ANcreate (an_id, vgroup_tag, vgroup_ref, AN_DATA_DESC);
+
+   /*
+   * Write the annotation text to the data description.
+   */
+   status_32 = ANwriteann (data_desc_id, DATA_DESC_TXT, strlen (DATA_DESC_TXT));
+
+   /*
+   * Teminate access to the vgroup and to the V interface.
+   */
+   status_32 = Vdetach (vgroup_id);
+   status_n = Vend (file_id);
+
+   /*
+   * Terminate access to each annotation explicitly.
+   */
+   status_n = ANendaccess (file_label_id);
+   status_n = ANendaccess (file_desc_id);
+   status_n = ANendaccess (data_label_id);
+   status_n = ANendaccess (data_desc_id);
+
+   /*
+   * Terminate access to the AN interface and close the HDF file.
+   */
+   status_32 = ANend (an_id);
+   status_n = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/AN_get_annotation_info.c b/hdf/examples/AN_get_annotation_info.c
new file mode 100644
index 0000000..7107ccd
--- /dev/null
+++ b/hdf/examples/AN_get_annotation_info.c
@@ -0,0 +1,107 @@
+#include "hdf.h"
+
+#define  FILE_NAME   "General_HDFobjects.hdf"
+#define  VG_NAME     "AN Vgroup"
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn   status_n;      /* returned status for functions returning an intn */
+   int32  status_32,     /* returned status for functions returning an int32*/
+          file_id, an_id, ann_id, 
+          n_annots,      /* number of annotations */
+         *ann_list,      /* list of annotation identifiers */
+          vgroup_ref,    /* reference number of the vgroup */
+          index;         /* index of an annotation in the annotation list */
+          ann_type annot_type = AN_DATA_DESC;   /* annotation to be obtained*/
+   uint16 ann_tag, ann_ref,              /* tag/ref number of an annotation */
+          vgroup_tag = DFTAG_VG;         /* tag of the vgroup */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Create the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the V interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Get the vgroup named VG_NAME.
+   */
+   vgroup_ref = Vfind (file_id, VG_NAME);
+
+   /*
+   * Initialize the AN interface and obtain an interface id.
+   */
+   an_id = ANstart (file_id);
+
+   /*
+   * Get the number of object descriptions.  Note that, since ANnumann takes
+   * the tag and reference number as being of type unit16, vgroup_ref must be
+   * safely cast to uint16 by checking for FAIL value first.
+   */
+   if (vgroup_ref != FAIL)
+   {
+      n_annots = ANnumann (an_id, annot_type, vgroup_tag, (uint16)vgroup_ref);
+
+      /*
+      * Allocate space to hold the annotation identifiers.
+      */
+      ann_list = malloc (n_annots * sizeof (int32));
+
+      /*
+      * Get the list of identifiers of the annotations attached to the 
+      * vgroup and of type annot_type.
+      */
+      n_annots = ANannlist (an_id, annot_type, vgroup_tag, (uint16)vgroup_ref, 
+                            ann_list);
+
+      /*
+      * Get each annotation identifier from the list then display the 
+      * tag/ref number pair of the corresponding annotation.
+      */
+      printf ("List of annotations of type AN_DATA_DESC:\n");
+      for (index = 0; index < n_annots; index++)
+      {
+        /*
+         * Get and display the ref number of the annotation from 
+         * its identifier.
+         */
+         status_32 = ANid2tagref (ann_list[index], &ann_tag, &ann_ref);
+         printf ("Annotation index %d: tag = %s\nreference number= %d\n", 
+           index, ann_tag == DFTAG_DIA ? "DFTAG_DIA (data description)":
+           "Incorrect", ann_ref);
+      } /* for */
+   } /* for */
+
+   /*
+   * Get and display an annotation type from an annotation tag.
+   */
+   annot_type = ANtag2atype (DFTAG_FID);
+   printf ("\nAnnotation type of DFTAG_FID (file label) is %s\n", 
+              annot_type == AN_FILE_LABEL ? "AN_FILE_LABEL":"Incorrect");
+
+   /*
+   * Get and display an annotation tag from an annotation type.
+   */
+   ann_tag = ANatype2tag (AN_DATA_LABEL);
+   printf ("\nAnnotation tag of AN_DATA_LABEL is %s\n", 
+              ann_tag == DFTAG_DIL ? "DFTAG_DIL (data label)":"Incorrect");
+
+   /*
+   * Terminate access to the AN interface and close the HDF file.
+   */
+   status_32 = ANend (an_id);
+   status_n = Hclose (file_id);
+
+   /*
+   * Free the space allocated for the annotation identifier list.
+   */
+   free (ann_list);
+   return 0;
+}
diff --git a/hdf/examples/AN_read_annotation.c b/hdf/examples/AN_read_annotation.c
new file mode 100644
index 0000000..8aab7ff
--- /dev/null
+++ b/hdf/examples/AN_read_annotation.c
@@ -0,0 +1,92 @@
+#include "hdf.h"
+
+#define  FILE_NAME   "General_HDFobjects.hdf"
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file_id,       /* HDF file identifier */
+         an_id,         /* AN interface identifier */
+         ann_id,        /* an annotation identifier */
+         index,         /* position of an annotation in all of the same type*/
+         ann_length,    /* length of the text in an annotation */
+         n_file_labels, n_file_descs, n_data_labels, n_data_descs;
+   char *ann_buf;       /* buffer to hold the read annotation */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the AN interface.
+   */
+   an_id = ANstart (file_id);
+
+   /*
+   * Get the annotation information, e.g., the numbers of file labels, file
+   * descriptions, data labels, and data descriptions.
+   */
+   status_n = ANfileinfo (an_id, &n_file_labels, &n_file_descs,
+                        &n_data_labels, &n_data_descs);
+
+   /*
+   * Get the data labels.  Note that this for loop can be used to
+   * obtain the contents of each kind of annotation with the appropriate
+   * number of annotations and the type of annotation, i.e., replace
+   * n_data_labels with n_file_labels, n_file_descs, or n_data_descs, and
+   * AN_DATA_LABEL with AN_FILE_LABEL, AN_FILE_DESC, or AN_DATA_DESC,
+   * respectively.
+   */
+   for (index = 0; index < n_data_labels; index++)
+   {
+      /*
+      * Get the identifier of the current data label.
+      */
+      ann_id = ANselect (an_id, index, AN_DATA_LABEL);
+
+      /*
+      * Get the length of the data label.
+      */
+      ann_length = ANannlen (ann_id);
+
+      /*
+      * Allocate space for the buffer to hold the data label text.
+      */
+      ann_buf = malloc ((ann_length+1) * sizeof (char));
+
+      /*
+      * Read and display the data label.  Note that the size of the buffer,
+      * i.e., the third parameter, is 1 character more than the length of
+      * the data label; that is for the null character.  It is not the case
+      * when a description is retrieved because the description does not 
+      * necessarily end with a null character.
+      * 
+      */
+      status_32 = ANreadann (ann_id, ann_buf, ann_length+1);
+      printf ("Data label index: %d\n", index);
+      printf ("Data label contents: %s\n", ann_buf);
+
+      /*
+      * Terminate access to the current data label.
+      */
+      status_n = ANendaccess (ann_id);
+
+      /*
+      * Free the space allocated for the annotation buffer.
+      */
+      free (ann_buf);
+   }
+
+   /*
+   * Terminate access to the AN interface and close the HDF file.
+   */
+   status_32 = ANend (an_id);
+   status_n = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/CMakeLists.txt b/hdf/examples/CMakeLists.txt
new file mode 100644
index 0000000..b60d2b6
--- /dev/null
+++ b/hdf/examples/CMakeLists.txt
@@ -0,0 +1,52 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_HDF_EXAMPLES C CXX)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (examples
+    VD_create_vdatas 
+    VD_write_mixed_vdata
+    VD_write_mixed_vdata_struct 
+    VD_write_to_vdata
+    VD_read_from_vdata 
+    VD_read_mixed_vdata
+    VD_set_get_vdata_attr 
+    VD_create_onefield_vdatas
+    VD_get_vdata_info 
+    VD_locate_vdata 
+    VG_create_vgroup
+#    VG_add_sds_to_vgroup 
+    VG_insert_vdatas_to_vgroup
+    VG_set_get_vgroup_attr 
+    VG_vgroup_contents
+    VG_get_vgroup_info 
+    GR_create_and_write_image
+    GR_modify_image 
+    GR_set_attribute 
+    GR_get_attribute
+    GR_write_chunks 
+    GR_write_palette 
+    GR_image_info 
+    GR_read_chunks
+    GR_read_image
+    AN_create_annotation 
+    AN_get_annotation_info 
+    AN_read_annotation
+)
+
+FOREACH (example ${examples})
+  ADD_EXECUTABLE (hdf_${example} ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/${example}.c)
+  TARGET_NAMING (hdf_${example} ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdf_${example} " " " ")
+  TARGET_LINK_LIBRARIES (hdf_${example} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDFOREACH (example ${examples})
+
+ADD_EXECUTABLE (hdf_VG_add_sds_to_vgroup ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.c)
+TARGET_NAMING (hdf_VG_add_sds_to_vgroup ${LIB_TYPE})
+TARGET_C_PROPERTIES (hdf_VG_add_sds_to_vgroup " " " ")
+TARGET_LINK_LIBRARIES (hdf_VG_add_sds_to_vgroup ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
diff --git a/hdf/examples/CMakeTests.cmake b/hdf/examples/CMakeTests.cmake
new file mode 100644
index 0000000..0079918
--- /dev/null
+++ b/hdf/examples/CMakeTests.cmake
@@ -0,0 +1,45 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME HDF_EXAMPLES-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        General_HDFobjects.hdf
+        General_Rimages.hdf
+        General_Vdatas.hdf
+        General_Vgroups.hdf
+        Image_with_Palette.hdf
+        Packed_Vdata.hdf
+        Two_Vdatas.hdf
+        Two_Vgroups.hdf
+)
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (HDF_EXAMPLES-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (HDF_EXAMPLES-clearall-objects PROPERTIES LABELS EXAMPLES)
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "HDF_EXAMPLES-clearall-objects")
+
+FOREACH (example ${examples})
+  ADD_TEST (NAME hdftest_${example} COMMAND $<TARGET_FILE:hdf_${example}>)
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdftest_${example} PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdftest_${example} PROPERTIES LABELS EXAMPLES)
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "hdftest_${example}")
+ENDFOREACH (example ${examples})
+
+ADD_TEST (NAME hdftest_VG_add_sds_to_vgroup COMMAND $<TARGET_FILE:hdf_VG_add_sds_to_vgroup>)
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (hdftest_VG_add_sds_to_vgroup PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (hdftest_VG_add_sds_to_vgroup PROPERTIES LABELS EXAMPLES)
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "hdftest_VG_add_sds_to_vgroup")
diff --git a/hdf/examples/GR_create_and_write_image.c b/hdf/examples/GR_create_and_write_image.c
new file mode 100644
index 0000000..ea5de15
--- /dev/null
+++ b/hdf/examples/GR_create_and_write_image.c
@@ -0,0 +1,85 @@
+#include "hdf.h"
+
+#define  FILE_NAME     "General_RImages.hdf"
+#define  IMAGE_NAME    "Image Array 1"
+#define  X_LENGTH      10    /* number of columns in the image */
+#define  Y_LENGTH      5     /* number of rows in the image */
+#define  N_COMPS       2     /* number of components in the image */
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn  status;         /* status for functions returning an intn */
+   int32 file_id,        /* HDF file identifier */
+         gr_id,          /* GR interface identifier */
+         ri_id,          /* raster image identifier */
+         start[2],       /* start position to write for each dimension */
+         edges[2],       /* number of elements to be written 
+                           along each dimension */
+         dim_sizes[2],   /* dimension sizes of the image array */
+         interlace_mode, /* interlace mode of the image */
+         data_type,      /* data type of the image data */
+         i, j;
+   int16 image_buf[Y_LENGTH][X_LENGTH][N_COMPS];
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Create and open the file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0);
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+
+   /*
+   * Set the data type, interlace mode, and dimensions of the image.
+   */
+   data_type = DFNT_INT16;
+   interlace_mode = MFGR_INTERLACE_PIXEL;
+   dim_sizes[0] = X_LENGTH;
+   dim_sizes[1] = Y_LENGTH;
+
+   /*
+   * Create the raster image array.
+   */
+   ri_id = GRcreate (gr_id, IMAGE_NAME, N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+
+   /*
+   * Fill the image data buffer with values.
+   */
+   for (i = 0; i < Y_LENGTH; i++)
+   {
+      for (j = 0; j < X_LENGTH; j++)
+      {
+         image_buf[i][j][0] = (i + j) + 1;     /* first component */
+         image_buf[i][j][1] = (i + j) + 1;     /* second component */
+      }
+    }
+
+   /*
+   * Define the size of the data to be written, i.e., start from the origin
+   * and go as long as the length of each dimension.
+   */
+   start[0] = start[1] = 0;
+   edges[0] = X_LENGTH;
+   edges[1] = Y_LENGTH;
+
+   /*
+   * Write the data in the buffer into the image array.
+   */
+   status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)image_buf);
+
+   /*
+   * Terminate access to the raster image and to the GR interface and, 
+   * close the HDF file.
+   */
+   status = GRendaccess (ri_id);
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/GR_get_attribute.c b/hdf/examples/GR_get_attribute.c
new file mode 100644
index 0000000..4a00af4
--- /dev/null
+++ b/hdf/examples/GR_get_attribute.c
@@ -0,0 +1,141 @@
+#include "hdf.h"
+
+#define  FILE_NAME       "General_RImages.hdf"
+#define  RI_ATTR_NAME    "Image Attribute 2"
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn   status;          /* status for functions returning an intn */
+   int32  gr_id, ri_id, file_id,
+          f_att_index,     /* index of file attributes */
+          ri_att_index,    /* index of raster image attributes */
+          data_type,       /* image data type */
+          n_values,        /* number of values in an attribute */
+          value_index,     /* index of values in an attribute */
+          n_rimages,       /* number of raster images in the file */
+          n_file_attrs;    /* number of file attributes */
+   char   attr_name[H4_MAX_GR_NAME];  /* buffer to hold the attribute name     */
+   VOIDP  data_buf;                /* buffer to hold the attribute values   */
+   int16 *int_ptr;      /* int16 pointer to point to a void data buffer     */
+   char8 *char_ptr;     /* char8 pointer to point to a void data buffer     */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+
+   /*
+   * Determine the number of attributes in the file.
+   */
+   status = GRfileinfo (gr_id, &n_rimages, &n_file_attrs);
+   if (status != FAIL && n_file_attrs > 0)
+   {
+      for (f_att_index = 0; f_att_index < n_file_attrs; f_att_index++)
+      {
+         /*
+         * Get information about the current file attribute.
+         */
+         status = GRattrinfo (gr_id, f_att_index, attr_name, &data_type, 
+                              &n_values);
+
+         /*
+         * Allocate a buffer to hold the file attribute data.  In this example,
+         * knowledge about the data type is assumed to be available from 
+         * the previous example for simplicity.  In reality, the size
+         * of the type must be determined based on the machine where the 
+         * program resides.
+         */
+         if (data_type == DFNT_CHAR8)
+         {
+            data_buf = malloc (n_values * sizeof (char8));
+            if (data_buf == NULL)
+            {
+               printf ("Unable to allocate space for attribute data.\n");
+               exit (1);
+            }
+         }
+         else
+         {
+            printf ("Unable to determine data type to allocate data buffer.\n");
+            exit (1);
+         }
+
+         /*
+         * Read and display the attribute values.
+         */
+         status = GRgetattr (gr_id, f_att_index, (VOIDP)data_buf);
+
+         char_ptr = (char8 *) data_buf;
+         printf ("Attribute %s: ", attr_name);
+         for (value_index = 0; value_index < n_values; value_index++)
+            printf ("%c", char_ptr[value_index]);
+         printf ("\n");
+
+         /*
+         * Free the space allocated for the data buffer.
+         */
+
+         free (data_buf);
+
+      } /* for */
+   } /* if */
+
+   /*
+   * Select the second image in the file.
+   */
+   ri_id = GRselect (gr_id, 1);
+
+   /*
+   * Find the image attribute named RI_ATTR_NAME.
+   */
+   ri_att_index = GRfindattr (ri_id, RI_ATTR_NAME);
+
+   /*
+   * Get information about the attribute.
+   */
+   status = GRattrinfo (ri_id, ri_att_index, attr_name, &data_type, &n_values);
+
+   /*
+   * Allocate a buffer to hold the file attribute data.  As mentioned above,
+   * knowledge about the data type is assumed to be available from
+   * the previous example for simplicity.  In reality, the size of the 
+   * type must be determined based on the machine where the program resides.
+   */
+   if (data_type == DFNT_INT16)
+      data_buf = malloc (n_values * sizeof (int16));
+
+   /*
+   * Read and display the attribute values.
+   */
+   status = GRgetattr (ri_id, ri_att_index, (VOIDP)data_buf);
+
+   printf ("\nAttribute %s: ", RI_ATTR_NAME);
+   int_ptr = (int16 *)data_buf;
+   for (value_index = 0; value_index < n_values; value_index++)
+      printf ("%d ", int_ptr[value_index]);
+   printf ("\n");
+
+   /*
+   * Free the space allocated for the data buffer.
+   */
+   free (data_buf);
+
+   /*
+   * Terminate access to the raster image and to the GR interface, and
+   * close the file.
+   */
+
+   status = GRendaccess (ri_id);
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/GR_image_info.c b/hdf/examples/GR_image_info.c
new file mode 100644
index 0000000..af6aa37
--- /dev/null
+++ b/hdf/examples/GR_image_info.c
@@ -0,0 +1,100 @@
+#include "hdf.h"
+
+#define  FILE_NAME    "General_RImages.hdf"
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn  status;            /* status for functions returning an intn */
+   int32 file_id, gr_id, ri_id,
+         n_rimages,         /* number of raster images in the file */
+         n_file_attrs,      /* number of file attributes */
+         ri_index,          /* index of a image */
+         dim_sizes[2],      /* dimensions of an image */
+         n_comps,           /* number of components an image contains */
+         interlace_mode,    /* interlace mode of an image */ 
+         data_type,         /* number type of an image */
+         n_attrs;           /* number of attributes belong to an image */
+   char  name[H4_MAX_GR_NAME], /* name of an image */
+        *type_string,       /* mapped text of a number type */
+        *interlace_string;  /* mapped text of an interlace mode */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the file for reading.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+
+   /*
+   * Determine the contents of the file.
+   */
+   status = GRfileinfo (gr_id, &n_rimages, &n_file_attrs);
+
+   /*
+   * For each image in the file, get and display the image information.
+   */
+   printf ("RI#    Name       Components  Type         Interlace     \
+   Dimensions   Attributes\n\n");
+   for (ri_index = 0; ri_index < n_rimages; ri_index++)
+   {
+      ri_id = GRselect (gr_id, ri_index);
+      status = GRgetiminfo (ri_id, name, &n_comps, &data_type, 
+                          &interlace_mode, dim_sizes, &n_attrs);
+      /*
+      * Map the number type and interlace mode into text strings for output 
+      * readability.  Note that, in this example, only two possible types 
+      * are considered because of the simplicity of the example.  For real 
+      * problems, all possible types should be checked and, if reading the
+      * data is desired, the size of the type must be determined based on the
+      * machine where the program resides.
+      */
+      if (data_type == DFNT_CHAR8)
+         type_string = "Char8";
+      else if (data_type == DFNT_INT16)
+         type_string = "Int16";
+      else
+         type_string = "Unknown";
+
+      switch (interlace_mode)
+      {
+         case MFGR_INTERLACE_PIXEL:
+            interlace_string = "MFGR_INTERLACE_PIXEL";
+            break;
+         case MFGR_INTERLACE_LINE:
+            interlace_string = "MFGR_INTERLACE_LINE";
+            break;
+         case MFGR_INTERLACE_COMPONENT:
+            interlace_string = "MFGR_INTERLACE_COMPONENT";
+            break;
+         default:
+            interlace_string = "Unknown";
+            break;
+      } /* switch */
+ 
+      /*
+      * Display the image information for the current raster image.
+      */
+          printf ("%d  %s       %d      %s   %s     %2d,%2d         %d\n", 
+                 ri_index, name, n_comps, type_string, interlace_string,
+                 dim_sizes[0], dim_sizes[1], n_attrs);
+
+      /*
+      * Terminate access to the current raster image.
+      */
+      status = GRendaccess (ri_id);
+   }
+
+   /*
+   * Terminate access to the GR interface and close the HDF file.
+   */
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/GR_modify_image.c b/hdf/examples/GR_modify_image.c
new file mode 100644
index 0000000..df8d137
--- /dev/null
+++ b/hdf/examples/GR_modify_image.c
@@ -0,0 +1,130 @@
+#include "hdf.h"
+
+#define  FILE_NAME    "General_RImages.hdf"
+#define  X1_LENGTH    5     /* number of columns in the first image 
+                              being modified */
+#define  Y1_LENGTH    2     /* number of rows in the first image 
+                              being modified */
+#define  N1_COMPS     2     /* number of components in the first image */
+#define  IMAGE1_NAME  "Image Array 1"
+#define  IMAGE2_NAME  "Image Array 2"
+#define  X2_LENGTH    6     /* number of columns in the second image */
+#define  Y2_LENGTH    4     /* number of rows in the second image */
+#define  N2_COMPS     3     /* number of components in the second image */
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn  status;         /* status for functions returning an intn */
+   int32 file_id,        /* HDF file identifier */
+         gr_id,          /* GR interface identifier */
+         ri1_id,         /* raster image identifier */
+         start1[2],      /* start position to write for each dimension */
+         edges1[2],      /* number of elements to be written along
+                           each dimension */
+         ri2_id,         /* raster image identifier */
+         start2[2],      /* start position to write for each dimension */
+         edges2[2],      /* number of elements to be written along 
+                           each dimension */
+         dims_sizes[2],  /* sizes of the two dimensions of the image array */
+         data_type,      /* data type of the image data */
+         interlace_mode; /* interlace mode of the image */
+   int16 i, j;           /* indices for the dimensions */
+   int16 image1_buf[Y1_LENGTH][X1_LENGTH][N1_COMPS]; /* data of first image */
+   char  image2_buf[Y2_LENGTH][X2_LENGTH][N2_COMPS]; /* data of second image*/
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for writing.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+
+   /*
+   * Select the first raster image in the file.
+   */
+   ri1_id = GRselect (gr_id, 0);
+
+   /*
+   * Fill the first image data buffer with values.
+   */
+   for (i = 0; i < Y1_LENGTH; i++)
+   {
+      for (j = 0; j < X1_LENGTH; j++)
+      {
+         image1_buf[i][j][0] = 0;  /* first component */ 
+         image1_buf[i][j][1] = 0;  /* second component */ 
+      }
+    }
+
+   /*
+   * Define the size of the data to be written, i.e., start from the origin
+   * and go as long as the length of each dimension.
+   */
+   start1[0] = start1[1] = 0;
+   edges1[0] = X1_LENGTH;
+   edges1[1] = Y1_LENGTH;
+
+   /*
+   * Write the data in the buffer into the image array.
+   */
+   status = GRwriteimage (ri1_id, start1, NULL, edges1, (VOIDP)image1_buf);
+
+
+   /*
+   * Set the interlace mode and dimensions of the second image.
+   */
+   data_type = DFNT_CHAR8;
+   interlace_mode = MFGR_INTERLACE_PIXEL;
+   dims_sizes[0] = X2_LENGTH;
+   dims_sizes[1] = Y2_LENGTH;
+
+   /*
+   * Create the second image in the file.
+   */
+   ri2_id = GRcreate (gr_id, IMAGE2_NAME, N2_COMPS, data_type,
+                                interlace_mode, dims_sizes);
+
+   /*
+   * Fill the second image data buffer with values.
+   */
+   for (i = 0; i < Y2_LENGTH; i++)
+   {
+      for (j = 0; j < X2_LENGTH; j++)
+      {
+         image2_buf[i][j][0] = 'A';     /* first component */ 
+         image2_buf[i][j][1] = 'B';     /* second component */
+         image2_buf[i][j][2] = 'C';     /* third component */
+      }
+    }
+
+   /*
+   * Define the size of the data to be written, i.e., start from the origin
+   * and go as long as the length of each dimension.
+   */
+   for (i = 0; i < 2; i++) {
+      start2[i] = 0;
+      edges2[i] = dims_sizes[i];
+   }
+
+   /*
+   * Write the data in the buffer into the second image array.
+   */
+   status = GRwriteimage (ri2_id, start2, NULL, edges2, (VOIDP)image2_buf);
+
+   /*
+   * Terminate access to the raster images and to the GR interface, and
+   * close the HDF file.
+   */
+   status = GRendaccess (ri1_id);
+   status = GRendaccess (ri2_id);
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/GR_read_chunks.c b/hdf/examples/GR_read_chunks.c
new file mode 100644
index 0000000..f5694ec
--- /dev/null
+++ b/hdf/examples/GR_read_chunks.c
@@ -0,0 +1,89 @@
+#include "hdf.h" 
+
+#define  FILE_NAME     "Image_Chunked.hdf" 
+#define  IMAGE_NAME    "Image with Chunks" 
+#define  X_LENGTH      10     /* number of rows in the image */ 
+#define  Y_LENGTH      6    /* number of columns in the image */ 
+#define  NCOMPS        3     /* number of components in the image */ 
+
+int main( )  
+{ 
+   /************************* Variable declaration **************************/ 
+
+   intn  status;         /* status for functions returning an intn */ 
+   int32 file_id,        /* HDF file identifier */ 
+         gr_id,          /* GR interface identifier */ 
+         ri_id,          /* raster image identifier */ 
+         dims[2],        /* dimension sizes of the image array */ 
+         start[2],       /* start position to read the image array */
+         edges[2],       /* edges of read array */
+         interlace_mode; /* interlace mode of the image */ 
+   HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+   int32 image_data[X_LENGTH][Y_LENGTH][NCOMPS];
+   int ii, jj;
+
+   /********************** End of variable declaration **********************/ 
+
+   /* 
+   * Open the file for reading. 
+   */ 
+   file_id = Hopen (FILE_NAME, DFACC_RDONLY, 0); 
+
+   /* 
+   * Initialize the GR interface. 
+   */ 
+   gr_id = GRstart (file_id); 
+
+   /* 
+   * Open the raster image array. 
+   */ 
+   ri_id = GRselect (gr_id, 0);
+
+   /* 
+   * Set dimensions of the image. 
+   */ 
+   dims[0] = X_LENGTH; 
+   dims[1] = Y_LENGTH; 
+   start[0] = start[1] = 0;
+   edges[0] = dims[0];
+   edges[1] = dims[1];
+
+   /* Read the data in the image array. */
+   status = GRreadimage (ri_id, start, NULL, edges, (VOIDP)image_data);
+
+   printf ("Image Data:\n");
+   printf ("Component 1:\n  ");
+   for (ii=0; ii< X_LENGTH; ii++)
+   {
+      for (jj=0; jj< Y_LENGTH; jj++)
+         printf ("%i ",image_data[ii][jj][0]);
+      printf ("\n  ");
+   }
+   printf ("\nComponent 2:\n  ");
+   for (ii=0; ii< X_LENGTH; ii++)
+   {
+      for (jj=0; jj< Y_LENGTH; jj++)
+         printf ("%i ",image_data[ii][jj][1]);
+      printf ("\n  ");
+   }
+   printf ("\nComponent 3:\n  ");
+   for (ii=0; ii< X_LENGTH; ii++)
+   {
+      for (jj=0; jj< Y_LENGTH; jj++)
+         printf ("%i ",image_data[ii][jj][2]);
+      printf ("\n  ");
+   }
+
+
+   printf ("\n");
+
+   /* 
+   * Terminate access to the raster image and to the GR interface and,  
+   * close the HDF file. 
+   */ 
+   status = GRendaccess (ri_id); 
+   status = GRend (gr_id); 
+   status = Hclose (file_id); 
+   return 0;
+} 
+
diff --git a/hdf/examples/GR_read_image.c b/hdf/examples/GR_read_image.c
new file mode 100644
index 0000000..070d9c4
--- /dev/null
+++ b/hdf/examples/GR_read_image.c
@@ -0,0 +1,134 @@
+#include "hdf.h"
+
+#define  FILE_NAME       "General_RImages.hdf"
+#define  N_COMPS         2
+#define  X_LENGTH        10   /* number of columns of the entire image */
+#define  Y_LENGTH        5    /* number of rows of the entire image */
+#define  PART_COLS       2    /* number of columns read for partial image */
+#define  PART_ROWS       3    /* number of rows read for partial image */
+#define  SKIP_COLS       5    /* number of columns read for skipped image */
+#define  SKIP_ROWS       3    /* number of rows read for skipped image */
+#define  COLS_PART_START 3    /* starting column to read partial image */
+#define  ROWS_PART_START 1    /* starting row to read partial image */
+#define  COLS_SKIP_START 1    /* starting column to read skipped image */
+#define  ROWS_SKIP_START 0    /* starting row to read skipped image */
+#define  N_STRIDES       2    /* number of elements to skip on each dim. */
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status;        /* status for functions returning an intn */
+   int32 index;
+   int32 file_id, gr_id, ri_id,
+         start[2],      /* start position to write for each dimension */
+         edges[2],      /* number of elements to bewritten along 
+                           each dimension */
+         stride[2],     /* number of elements to skip on each dimension */
+         dim_sizes[2];  /* dimension sizes of the image array */
+   int16 entire_image[Y_LENGTH][X_LENGTH][N_COMPS],
+         partial_image[PART_ROWS][PART_COLS][N_COMPS],
+         skipped_image[SKIP_ROWS][SKIP_COLS][N_COMPS];
+   int32 i, j;
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for reading.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+
+   /*
+   * Select the first raster image in the file.
+   */
+   ri_id = GRselect (gr_id, 0);
+
+   /*
+   * Define the size of the data to be read, i.e., start from the origin 
+   * and go as long as the length of each dimension.
+   */
+   start[0] = start[1] = 0;
+   edges[0] = X_LENGTH;
+   edges[1] = Y_LENGTH;
+
+   /*
+   * Read the data from the raster image array.
+   */
+   status = GRreadimage (ri_id, start, NULL, edges, (VOIDP)entire_image);
+
+   /*
+   * Display only the first component of the image since the two components 
+   * have the same data in this example.
+   */
+   printf ("First component of the entire image:\n");
+   for (i = 0; i < Y_LENGTH; i++)
+   {
+      for (j = 0; j < X_LENGTH; j++)
+         printf ("%d ", entire_image[i][j][0]);
+      printf ("\n");
+   }
+
+   /*
+   * Define the size of the data to be read.
+   */
+   start[0] = COLS_PART_START;
+   start[1] = ROWS_PART_START;
+   edges[0] = PART_COLS;
+   edges[1] = PART_ROWS;
+
+   /*
+   * Read a subset of the raster image array.
+   */
+   status = GRreadimage (ri_id, start, NULL, edges, (VOIDP)partial_image);
+
+   /*
+   * Display the first component of the read sample.
+   */
+   printf ("\nThree rows & two cols at 2nd row and 4th column");
+   printf (" of the first component:\n");
+   for (i = 0; i < PART_ROWS; i++)
+   {
+      for (j = 0; j < PART_COLS; j++)
+         printf ("%d ", partial_image[i][j][0]);
+      printf ("\n");
+   }
+
+   /*
+   * Define the size and the pattern to read the data.
+   */
+   start[0] = COLS_SKIP_START;
+   start[1] = ROWS_SKIP_START;
+   edges[0] = SKIP_COLS;
+   edges[1] = SKIP_ROWS;
+   stride[0] = stride[1] = N_STRIDES;
+
+   /*
+   * Read all the odd rows and even columns of the image.
+   */
+   status = GRreadimage (ri_id, start, stride, edges, (VOIDP)skipped_image);
+
+   /*
+   * Display the first component of the read sample.
+   */
+   printf ("\nAll odd rows and even columns of the first component:\n");
+   for (i = 0; i < SKIP_ROWS; i++)
+   {
+      for (j = 0; j < SKIP_COLS; j++)
+         printf ("%d ", skipped_image[i][j][0]);
+      printf ("\n");
+   }
+
+   /*
+   * Terminate access to the raster image and to the GR interface, and
+   * close the HDF file.
+   */
+   status = GRendaccess (ri_id);
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/GR_read_palette.c b/hdf/examples/GR_read_palette.c
new file mode 100644
index 0000000..fe1d167
--- /dev/null
+++ b/hdf/examples/GR_read_palette.c
@@ -0,0 +1,81 @@
+#include "hdf.h"
+
+#define  FILE_NAME      "Image_with_Palette.hdf"
+#define  IMAGE_NAME     "Image with Palette"
+#define  N_ENTRIES      256     /* number of elements of each color */
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status,         /* status for functions returning an intn */
+         i, j;
+   int32 file_id, gr_id, ri_id, pal_id, ri_index;
+   int32 data_type, n_comps, n_entries, interlace_mode; 
+   uint8 palette_data[N_ENTRIES][3];        /* static because of fixed size */
+
+   /************************* Variable declaration **************************/
+
+   /* 
+   * Open the file. 
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /* 
+   * Initiate the GR interface. 
+   */
+   gr_id = GRstart (file_id);
+
+   /* 
+   * Get the index of the image IMAGR_NAME.
+   */
+   ri_index = GRnametoindex (gr_id, IMAGE_NAME);
+
+   /*
+   * Get image identifier.
+   */
+   ri_id = GRselect (gr_id, ri_index);
+ 
+   /* 
+   * Get the identifier of the palette attached to the image. 
+   */
+   pal_id = GRgetlutid (ri_id, ri_index);
+
+   /*
+   * Obtain and display information about the palette.
+   */
+   status = GRgetlutinfo (pal_id, &n_comps, &data_type, &interlace_mode, 
+                          &n_entries);
+   printf ("Palette: %d components; %d entries\n", n_comps, n_entries); 
+
+   /* 
+   * Read the palette data. 
+   */
+   status = GRreadlut (pal_id, (VOIDP)palette_data);
+
+   /*
+   * Display the palette data.  Recall that HDF supports only 256 colors.
+   * Each color is defined by its 3 components. Therefore, 
+   * verifying the value of n_entries and n_comps is not necessary and 
+   * the buffer to hold the palette data can be static.  However, 
+   * if more values or colors are added to the model, these parameters 
+   * must be checked to allocate sufficient space when reading a palette.
+   */
+   printf ("  Palette Data: \n");
+   for (i=0; i< n_entries; i++)
+   {
+      for (j = 0; j < n_comps; j++)
+         printf ("%i ", palette_data[i][j]);
+      printf ("\n");
+   }
+   printf ("\n");
+
+   /* 
+   * Terminate access to the image and to the GR interface, and 
+   * close the HDF file. 
+   */
+   status = GRendaccess (ri_id);
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/GR_set_attribute.c b/hdf/examples/GR_set_attribute.c
new file mode 100644
index 0000000..747e372
--- /dev/null
+++ b/hdf/examples/GR_set_attribute.c
@@ -0,0 +1,76 @@
+#include "hdf.h"
+
+#define  FILE_NAME          "General_RImages.hdf"
+#define  IMAGE_NAME         "Image Array 2"
+#define  F_ATT1_NAME        "File Attribute 1"
+#define  F_ATT2_NAME        "File Attribute 2"
+#define  RI_ATT1_NAME       "Image Attribute 1"
+#define  RI_ATT2_NAME       "Image Attribute 2"
+#define  F_ATT1_VAL         "Contents of First FILE Attribute"
+#define  F_ATT2_VAL         "Contents of Second FILE Attribute"
+#define  F_ATT1_N_VALUES    32
+#define  F_ATT2_N_VALUES    33
+#define  RI_ATT1_VAL        "Contents of IMAGE's First Attribute"
+#define  RI_ATT1_N_VALUES   35
+#define  RI_ATT2_N_VALUES   6
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+   
+   intn  status;         /* status for functions returning an intn */
+   int32 gr_id, ri_id, file_id,
+         ri_index;
+   int16 ri_attr_2[RI_ATT2_N_VALUES] = {1, 2, 3, 4, 5, 6};
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+
+   /*
+   * Set two file attributes to the file with names, data types, numbers of 
+   * values, and values of the attributes specified.
+   */
+   status = GRsetattr (gr_id, F_ATT1_NAME, DFNT_CHAR8, F_ATT1_N_VALUES, 
+                       (VOIDP)F_ATT1_VAL); 
+
+   status = GRsetattr (gr_id, F_ATT2_NAME, DFNT_CHAR8, F_ATT2_N_VALUES, 
+                       (VOIDP)F_ATT2_VAL);
+
+   /*
+   * Obtain the index of the image named IMAGE_NAME.
+   */
+   ri_index = GRnametoindex (gr_id, IMAGE_NAME);
+
+   /*
+   * Obtain the identifier of this image.
+   */
+   ri_id = GRselect (gr_id, ri_index);
+
+   /*
+   * Set two attributes to the image with names, data types, numbers of 
+   * values, and values of the attributes specified.
+   */
+   status = GRsetattr (ri_id, RI_ATT1_NAME, DFNT_CHAR8, RI_ATT1_N_VALUES, 
+                       (VOIDP)RI_ATT1_VAL);
+
+   status = GRsetattr (ri_id, RI_ATT2_NAME, DFNT_INT16, RI_ATT2_N_VALUES, 
+                       (VOIDP)ri_attr_2);
+
+   /*
+   * Terminate access to the image and to the GR interface, and close the
+   * HDF file.
+   */
+   status = GRendaccess (ri_id);
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/GR_write_chunks.c b/hdf/examples/GR_write_chunks.c
new file mode 100644
index 0000000..494da35
--- /dev/null
+++ b/hdf/examples/GR_write_chunks.c
@@ -0,0 +1,95 @@
+#include "hdf.h" 
+
+#define  FILE_NAME     "Image_Chunked.hdf" 
+#define  IMAGE_NAME    "Image with Chunks" 
+#define  X_LENGTH      10    /* number of rows in the image */ 
+#define  Y_LENGTH      6     /* number of columns in the image */ 
+#define  NCOMPS        3     /* number of components in the image */ 
+
+int main( )  
+{ 
+   /************************* Variable declaration **************************/ 
+
+   intn  status;         /* status for functions returning an intn */ 
+   int32 file_id,        /* HDF file identifier */ 
+         gr_id,          /* GR interface identifier */ 
+         ri_id,          /* raster image identifier */ 
+         dims[2],        /* dimension sizes of the image array */ 
+         origin[2],      /* origin position to write each chunk */ 
+         interlace_mode; /* interlace mode of the image */ 
+   HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+   int32 chunk00[] = {1, 2, 3, 4, 5, 6,
+                      7, 8, 9, 10, 11, 12,
+                      13, 14, 15, 16, 17, 18 };
+
+   int32 chunk01[] = {210, 211, 212, 220, 221, 222,
+                      230, 231, 232, 240, 241, 242,
+                      250, 251, 252, 260, 261, 262};
+
+   int32 chunk14[] = {1010, 1011, 1012, 1020, 1021, 1022,
+                      1030, 1031, 1032, 1040, 1041, 1042,
+                      1050, 1051, 1052, 1060, 1061, 1062};
+
+   /********************** End of variable declaration **********************/ 
+
+   /* 
+   * Create and open the file. 
+   */ 
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0); 
+
+   /* 
+   * Initialize the GR interface. 
+   */ 
+   gr_id = GRstart (file_id); 
+
+   /* 
+   * Set dimensions of the image. 
+   */ 
+   dims[0] = Y_LENGTH; 
+   dims[1] = X_LENGTH; 
+
+   /* 
+   * Create the raster image array. 
+   */ 
+   ri_id = GRcreate (gr_id, IMAGE_NAME, NCOMPS, DFNT_INT32,  
+                     MFGR_INTERLACE_PIXEL, dims); 
+   /* 
+   * Define chunked image. 
+   */ 
+   chunk_def.comp.comp_type = COMP_CODE_DEFLATE; 
+   chunk_def.comp.cinfo.deflate.level = 6; 
+   chunk_def.comp.chunk_lengths[0] = 3; 
+   chunk_def.comp.chunk_lengths[1] = 2;   
+   status = GRsetchunk (ri_id, chunk_def, HDF_CHUNK | HDF_COMP); 
+
+   /* 
+   * Write first chunk(0,0). 
+   */ 
+   origin[0] = 0; 
+   origin[1] = 0; 
+   status = GRwritechunk (ri_id, origin, (VOIDP)chunk00); 
+
+   /* 
+   * Write second chunk(0,1). 
+   */ 
+   origin[0] = 0; 
+   origin[1] = 1; 
+   status = GRwritechunk (ri_id, origin, (VOIDP)chunk01); 
+
+   /* 
+   * Write third chunk(1,4). 
+   */ 
+   origin[0] = 1; 
+   origin[1] = 4; 
+   status = GRwritechunk (ri_id, origin, (VOIDP)chunk14); 
+
+   /* 
+   * Terminate access to the raster image and to the GR interface and,  
+   * close the HDF file. 
+   */ 
+   status = GRendaccess (ri_id); 
+   status = GRend (gr_id); 
+   status = Hclose (file_id); 
+   return 0;
+} 
+
diff --git a/hdf/examples/GR_write_palette.c b/hdf/examples/GR_write_palette.c
new file mode 100644
index 0000000..907ebbb
--- /dev/null
+++ b/hdf/examples/GR_write_palette.c
@@ -0,0 +1,108 @@
+#include "hdf.h"
+
+#define  FILE_NAME         "Image_with_Palette.hdf"
+#define  NEW_IMAGE_NAME    "Image with Palette"
+#define  N_COMPS_IMG       2       /* number of image components */
+#define  X_LENGTH          5       /* number of rows in the image */
+#define  Y_LENGTH          5       /* number of columns in the image */
+#define  N_ENTRIES         256     /* number of entries in the palette */
+#define  N_COMPS_PAL       3       /* number of palette's components */
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status,         /* status for functions returning an intn */
+         i, j;
+   int32 file_id, gr_id, ri_id, pal_id, 
+         interlace_mode, 
+         start[2],     /* holds where to start to write for each dimension  */
+         edges[2],     /* holds how long to write for each dimension */
+         dim_sizes[2];  /* sizes of the two dimensions of the image array   */
+   uint8 image_buf[Y_LENGTH][X_LENGTH][N_COMPS_IMG]; /* data of first image */
+   uint8 palette_buf[N_ENTRIES][N_COMPS_PAL];
+
+   /********************** End of variable declaration **********************/
+
+   /* 
+   * Open the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0);
+
+   /* 
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+
+   /* 
+   * Define the dimensions and interlace mode of the image. 
+   */
+   dim_sizes[0] = X_LENGTH;
+   dim_sizes[1] = Y_LENGTH;
+   interlace_mode = MFGR_INTERLACE_PIXEL;
+
+   /* 
+   * Create the image named NEW_IMAGE_NAME.
+   */
+   ri_id = GRcreate (gr_id, NEW_IMAGE_NAME, N_COMPS_IMG, DFNT_UINT8, 
+                     interlace_mode, dim_sizes);
+
+   /*
+   * Fill the image data buffer with values.
+   */
+   for (i = 0; i < Y_LENGTH; i++)
+   {
+      for (j = 0; j < X_LENGTH; j++)
+      {
+         image_buf[i][j][0] = (i + j) + 1;
+         image_buf[i][j][1] = (i + j) + 2;
+      }
+    }
+
+   /*
+   * Define the size of the data to be written, i.e., start from the origin
+   * and go as long as the length of each dimension.
+   */
+   start[0] = start[1] = 0;
+   edges[0] = X_LENGTH;
+   edges[1] = Y_LENGTH;
+
+   /*
+   * Write the data in the buffer into the image array.
+   */
+   status = GRwriteimage (ri_id, start, NULL, edges, (VOIDP)image_buf);
+
+   /* 
+   * Initialize the palette to grayscale. 
+   */
+   for (i = 0; i < N_ENTRIES; i++) {
+      palette_buf[i][0] = i;
+      palette_buf[i][1] = i;
+      palette_buf[i][2] = i;
+   }
+
+   /*
+   * Define palette interlace mode.
+   */
+   interlace_mode = MFGR_INTERLACE_PIXEL;
+
+   /* 
+   * Get the identifier of the palette attached to the image NEW_IMAGE_NAME.
+   */
+   pal_id = GRgetlutid (ri_id, 0);
+
+   /*
+   * Write data to the palette.
+   */
+   status = GRwritelut (pal_id, N_COMPS_PAL, DFNT_UINT8, interlace_mode,
+                        N_ENTRIES, (VOIDP)palette_buf);
+
+   /* 
+   * Terminate access to the image and to the GR interface, and 
+   * close the HDF file. 
+   */
+   status = GRendaccess (ri_id);
+   status = GRend (gr_id);
+   status = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/Makefile.am b/hdf/examples/Makefile.am
new file mode 100644
index 0000000..1222374
--- /dev/null
+++ b/hdf/examples/Makefile.am
@@ -0,0 +1,98 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+DEFINES=-DNDEBUG -DHDF
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+EXAMPLE_PROG = VD_create_vdatas VD_write_mixed_vdata		\
+	VD_write_mixed_vdata_struct VD_write_to_vdata		\
+	VD_read_from_vdata VD_read_mixed_vdata			\
+	VD_set_get_vdata_attr VD_create_onefield_vdatas		\
+	VD_get_vdata_info VD_locate_vdata VG_create_vgroup	\
+	VG_add_sds_to_vgroup VG_insert_vdatas_to_vgroup		\
+	VG_set_get_vgroup_attr VG_vgroup_contents		\
+	VG_get_vgroup_info GR_create_and_write_image		\
+	GR_modify_image GR_set_attribute GR_get_attribute	\
+	GR_write_palette GR_read_palette GR_image_info          \
+	GR_read_image GR_write_chunks GR_read_chunks            \
+	AN_create_annotation AN_get_annotation_info AN_read_annotation
+TEST_PROG = $(EXAMPLE_PROG)
+
+# These are the C example files to be installed
+INSTALL_FILES= VD_read_from_vdata.c VD_read_mixed_vdata.c	\
+	VD_set_get_vdata_attr.c VD_write_mixed_vdata.c		\
+	VD_write_mixed_vdata_struct.c VD_write_to_vdata.c	\
+	VD_create_onefield_vdatas.c VD_create_vdatas.c		\
+	VD_get_vdata_info.c VD_locate_vdata.c			\
+	VG_insert_vdatas_to_vgroup.c VG_set_get_vgroup_attr.c	\
+	VG_vgroup_contents.c VG_add_sds_to_vgroup.c		\
+	VG_create_vgroup.c VG_get_vgroup_info.c			\
+	GR_create_and_write_image.c GR_get_attribute.c		\
+	GR_image_info.c GR_modify_image.c GR_read_image.c	\
+	GR_read_palette.c GR_set_attribute.c			\
+	GR_write_palette.c GR_write_chunks.c GR_read_chunks.c	\
+	AN_create_annotation.c AN_get_annotation_info.c		\
+	AN_read_annotation.c
+
+INSTALL_SCRIPT_FILES = run-c-ex.sh
+
+INSTALL_TOP_SCRIPT_FILES = run-all-ex.sh
+INSTALL_TOP_FILES = README
+
+# Where to install example files
+EXAMPLEDIR=$(prefix)/examples/c
+EXAMPLETOPDIR=$(prefix)/examples
+
+# How to build C programs using h4cc
+$(EXTRA_PROG): $(H4CC)
+	$(H4CC) $(H4CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal C compiler, not h4cc.
+
+# C Programs
+VD_read_from_vdata: $(srcdir)/VD_read_from_vdata.c
+VD_read_mixed_vdata: $(srcdir)/VD_read_mixed_vdata.c
+VD_set_get_vdata_attr: $(srcdir)/VD_set_get_vdata_attr.c
+VD_write_mixed_vdata: $(srcdir)/VD_write_mixed_vdata.c
+VD_write_mixed_vdata_struct: $(srcdir)/VD_write_mixed_vdata_struct.c
+VD_write_to_vdata: $(srcdir)/VD_write_to_vdata.c
+VD_create_onefield_vdatas: $(srcdir)/VD_create_onefield_vdatas.c
+VD_create_vdatas: $(srcdir)/VD_create_vdatas.c
+VD_get_vdata_info: $(srcdir)/VD_get_vdata_info.c
+VD_locate_vdata: $(srcdir)/VD_locate_vdata.c
+VG_insert_vdatas_to_vgroup: $(srcdir)/VG_insert_vdatas_to_vgroup.c
+VG_set_get_vgroup_attr: $(srcdir)/VG_set_get_vgroup_attr.c
+VG_vgroup_contents: $(srcdir)/VG_vgroup_contents.c
+VG_add_sds_to_vgroup: $(srcdir)/VG_add_sds_to_vgroup.c
+VG_create_vgroup: $(srcdir)/VG_create_vgroup.c
+VG_get_vgroup_info: $(srcdir)/VG_get_vgroup_info.c
+GR_create_and_write_image: $(srcdir)/GR_create_and_write_image.c
+GR_get_attribute: $(srcdir)/GR_get_attribute.c
+GR_image_info: $(srcdir)/GR_image_info.c
+GR_modify_image: $(srcdir)/GR_modify_image.c
+GR_read_chunks: $(srcdir)/GR_read_chunks.c
+GR_read_image: $(srcdir)/GR_read_image.c
+GR_read_palette: $(srcdir)/GR_read_palette.c
+GR_set_attribute: $(srcdir)/GR_set_attribute.c
+GR_write_chunks: $(srcdir)/GR_write_chunks.c
+GR_write_palette: $(srcdir)/GR_write_palette.c
+AN_create_annotation: $(srcdir)/AN_create_annotation.c
+AN_get_annotation_info: $(srcdir)/AN_get_annotation_info.c
+AN_read_annotation: $(srcdir)/AN_read_annotation.c
+
+DISTCLEANFILES = *.chkexe *.chklog
+
+if BUILD_SHARED_SZIP_CONDITIONAL
+LD_LIBRARY_PATH=$(LL_PATH)
+endif
+    
+include $(top_srcdir)/config/examples.am
+include $(top_srcdir)/config/conclude.am
diff --git a/hdf/examples/Makefile.in b/hdf/examples/Makefile.in
new file mode 100644
index 0000000..2b5b87e
--- /dev/null
+++ b/hdf/examples/Makefile.in
@@ -0,0 +1,763 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+# We can't tell automake about example programs, because they need to be
+# built using h4cc (or h4fc, etc.) instead of the standard compilers.
+# This creates some extra work for us.
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am \
+	$(top_srcdir)/config/examples.am
+TESTS = $(TEST_PROG)
+subdir = hdf/examples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog *.hdf
+DEFINES = -DNDEBUG -DHDF
+
+#############################################################################
+#############################################################################
+EXAMPLE_PROG = VD_create_vdatas VD_write_mixed_vdata		\
+	VD_write_mixed_vdata_struct VD_write_to_vdata		\
+	VD_read_from_vdata VD_read_mixed_vdata			\
+	VD_set_get_vdata_attr VD_create_onefield_vdatas		\
+	VD_get_vdata_info VD_locate_vdata VG_create_vgroup	\
+	VG_add_sds_to_vgroup VG_insert_vdatas_to_vgroup		\
+	VG_set_get_vgroup_attr VG_vgroup_contents		\
+	VG_get_vgroup_info GR_create_and_write_image		\
+	GR_modify_image GR_set_attribute GR_get_attribute	\
+	GR_write_palette GR_read_palette GR_image_info          \
+	GR_read_image GR_write_chunks GR_read_chunks            \
+	AN_create_annotation AN_get_annotation_info AN_read_annotation
+
+TEST_PROG = $(EXAMPLE_PROG)
+
+# These are the C example files to be installed
+INSTALL_FILES = VD_read_from_vdata.c VD_read_mixed_vdata.c	\
+	VD_set_get_vdata_attr.c VD_write_mixed_vdata.c		\
+	VD_write_mixed_vdata_struct.c VD_write_to_vdata.c	\
+	VD_create_onefield_vdatas.c VD_create_vdatas.c		\
+	VD_get_vdata_info.c VD_locate_vdata.c			\
+	VG_insert_vdatas_to_vgroup.c VG_set_get_vgroup_attr.c	\
+	VG_vgroup_contents.c VG_add_sds_to_vgroup.c		\
+	VG_create_vgroup.c VG_get_vgroup_info.c			\
+	GR_create_and_write_image.c GR_get_attribute.c		\
+	GR_image_info.c GR_modify_image.c GR_read_image.c	\
+	GR_read_palette.c GR_set_attribute.c			\
+	GR_write_palette.c GR_write_chunks.c GR_read_chunks.c	\
+	AN_create_annotation.c AN_get_annotation_info.c		\
+	AN_read_annotation.c
+
+INSTALL_SCRIPT_FILES = run-c-ex.sh
+INSTALL_TOP_SCRIPT_FILES = run-all-ex.sh
+INSTALL_TOP_FILES = README
+
+# Where to install example files
+EXAMPLEDIR = $(prefix)/examples/c
+EXAMPLETOPDIR = $(prefix)/examples
+DISTCLEANFILES = *.chkexe *.chklog
+ at BUILD_SHARED_SZIP_CONDITIONAL_TRUE@LD_LIBRARY_PATH = $(LL_PATH)
+
+# Assume that all tests in this directory are examples, and tell
+# conclude.am when to build them.
+EXTRA_PROG = $(EXAMPLE_PROG)
+
+# We need to tell automake what to clean
+MOSTLYCLEANFILES = *.o $(EXAMPLE_PROG)
+CLEANFILES = $(EXAMPLE_PROG)
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/examples/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign hdf/examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+	-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-local
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am all-local check check-TESTS check-am clean \
+	clean-generic clean-libtool distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am \
+	install-data-local install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installcheck-local installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am uninstall uninstall-am uninstall-local
+
+
+# How to build C programs using h4cc
+$(EXTRA_PROG): $(H4CC)
+	$(H4CC) $(H4CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal C compiler, not h4cc.
+
+# C Programs
+VD_read_from_vdata: $(srcdir)/VD_read_from_vdata.c
+VD_read_mixed_vdata: $(srcdir)/VD_read_mixed_vdata.c
+VD_set_get_vdata_attr: $(srcdir)/VD_set_get_vdata_attr.c
+VD_write_mixed_vdata: $(srcdir)/VD_write_mixed_vdata.c
+VD_write_mixed_vdata_struct: $(srcdir)/VD_write_mixed_vdata_struct.c
+VD_write_to_vdata: $(srcdir)/VD_write_to_vdata.c
+VD_create_onefield_vdatas: $(srcdir)/VD_create_onefield_vdatas.c
+VD_create_vdatas: $(srcdir)/VD_create_vdatas.c
+VD_get_vdata_info: $(srcdir)/VD_get_vdata_info.c
+VD_locate_vdata: $(srcdir)/VD_locate_vdata.c
+VG_insert_vdatas_to_vgroup: $(srcdir)/VG_insert_vdatas_to_vgroup.c
+VG_set_get_vgroup_attr: $(srcdir)/VG_set_get_vgroup_attr.c
+VG_vgroup_contents: $(srcdir)/VG_vgroup_contents.c
+VG_add_sds_to_vgroup: $(srcdir)/VG_add_sds_to_vgroup.c
+VG_create_vgroup: $(srcdir)/VG_create_vgroup.c
+VG_get_vgroup_info: $(srcdir)/VG_get_vgroup_info.c
+GR_create_and_write_image: $(srcdir)/GR_create_and_write_image.c
+GR_get_attribute: $(srcdir)/GR_get_attribute.c
+GR_image_info: $(srcdir)/GR_image_info.c
+GR_modify_image: $(srcdir)/GR_modify_image.c
+GR_read_chunks: $(srcdir)/GR_read_chunks.c
+GR_read_image: $(srcdir)/GR_read_image.c
+GR_read_palette: $(srcdir)/GR_read_palette.c
+GR_set_attribute: $(srcdir)/GR_set_attribute.c
+GR_write_chunks: $(srcdir)/GR_write_chunks.c
+GR_write_palette: $(srcdir)/GR_write_palette.c
+AN_create_annotation: $(srcdir)/AN_create_annotation.c
+AN_get_annotation_info: $(srcdir)/AN_get_annotation_info.c
+AN_read_annotation: $(srcdir)/AN_read_annotation.c
+
+# How to create EXAMPLEDIR if it doesn't already exist
+$(EXAMPLEDIR):
+	mkdir -p $@
+
+# Install and uninstall rules.  We install the source files, not the
+# example programs themselves.
+install-data-local:
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-local:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+install-examples: $(EXAMPLEDIR) 
+	@for f in X $(INSTALL_FILES); do                                     \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_FILES); do                                 \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	  fi;                                                                \
+	done
+
+uninstall-examples:
+	@if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then           \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES);              \
+	fi
+	@if test -n "$(INSTALL_SCRIPT_FILES)" -a -d $(EXAMPLEDIR); then    \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_SCRIPT_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_SCRIPT_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_SCRIPT_FILES);       \
+	fi
+
+installcheck-local:
+	@if test "$(STATIC_SHARED)" = "static, shared"; then               \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	  $(MAKE) $(AM_MAKEFLAGS) clean;                                   \
+	  H5CCFLAGS="" $(MAKE) $(AM_MAKEFLAGS) check;                      \
+	elif test "$(STATIC_SHARED)" = "shared"; then                      \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	else                                                               \
+	  $(MAKE) $(AM_MAKEFLAGS) check;                                   \
+	fi
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdf/examples/README b/hdf/examples/README
new file mode 100644
index 0000000..1eb14bb
--- /dev/null
+++ b/hdf/examples/README
@@ -0,0 +1,22 @@
+                               HDF4 Examples
+
+This directory contains example programs for the installed APIs and scripts to 
+compile and run them.  Examples in the c subdirectory are always 
+installed, and those in the fortan subdirectory will be installed 
+when fortran is enabled.
+
+Running the run-all-ex.sh script in this directory will run the scripts and in 
+turn the examples in the subdirectories where examples are installed.  The 
+scripts can also be run individually.  The appropriate compile scripts in the 
+bin directory for this install will be used by default to compile and link the 
+example programs.  Note that h5redeploy must be run if these binaries are 
+copied or extracted in a directory other than the one where they were initially 
+installed.  Compile scripts from other locations can be used by setting an 
+environment variable prefix to the path of the directory containing the bin 
+directory with the compile scripts h4cc and h4fc.  For example, export 
+prefix=/usr/local/hdf4 to use h4cc and h5fc in /usr/local/hdf4/bin.
+
+Running HDF4 examples built with shared libraries not in system locations may 
+result in an error message "...error while loading shared libraries: ...".  
+Setting LD_LIBRARY_PATH to include the directory containing the missing library
+should allow the examples to run.
diff --git a/hdf/examples/VD_create_onefield_vdatas.c b/hdf/examples/VD_create_onefield_vdatas.c
new file mode 100644
index 0000000..8686db0
--- /dev/null
+++ b/hdf/examples/VD_create_onefield_vdatas.c
@@ -0,0 +1,68 @@
+#include "hdf.h" 
+
+#define  FILE_NAME      "General_Vdatas.hdf"
+#define  CLASS1_NAME    "5x1 Array"
+#define  CLASS2_NAME    "6x4 Array"
+#define  VDATA1_NAME    "First Vdata"
+#define  VDATA2_NAME    "Second Vdata"
+#define  FIELD1_NAME    "Single-component Field"
+#define  FIELD2_NAME    "Multi-component Field"
+#define  N_RECORDS_1    5    /* number of records the first vdata contains  */
+#define  N_RECORDS_2    6    /* number of records the second vdata contains */
+#define  ORDER_2        4    /* order of the field in the second vdata      */
+                /* Note that the order of the field in the first vdata is 1 */
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32;     /* returned status for functions returning an int32 */
+   int32 file_id, vdata1_ref, vdata2_ref; 
+
+   /*
+   * Define an array to buffer the data of the first vdata.
+   */
+   char8 vdata1_buf [N_RECORDS_1] = {'V', 'D', 'A', 'T', 'A'};
+
+   /*
+   * Define an array to buffer the data of the second vdata.
+   */
+   int32 vdata2_buf [N_RECORDS_2][ORDER_2] = {{1, 2, 3, 4}, {2, 4, 6, 8},
+                                              {3, 6, 9, 12}, {4, 8, 12, 16},
+                                              {5, 10, 15, 20}, {6, 12, 18, 24}};
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for writing.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+
+   /*
+   * Initialize the VS interface.
+   */
+   status_n = Vstart (file_id);
+    
+   /*
+   * Create the first vdata and populate it with data from the vdata1_buf 
+   * array. Note that the buffer vdata1_buf is cast to (uint8 *) for the 
+   * benefit of generic data type.
+   */
+   vdata1_ref = VHstoredata (file_id, FIELD1_NAME, (uint8 *)vdata1_buf, 
+                       N_RECORDS_1, DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME); 
+
+   /* 
+   * Create the second vdata and populate it with data from the vdata2_buf 
+   * array. 
+   */
+   vdata2_ref = VHstoredatam (file_id, FIELD2_NAME, (uint8 *)vdata2_buf, 
+               N_RECORDS_2, DFNT_INT32, VDATA2_NAME, CLASS2_NAME, ORDER_2); 
+
+   /* 
+   * Terminate access to the VS interface and close the HDF file.
+   */
+   status_n = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_create_vdatas.c b/hdf/examples/VD_create_vdatas.c
new file mode 100644
index 0000000..b2e1379
--- /dev/null
+++ b/hdf/examples/VD_create_vdatas.c
@@ -0,0 +1,116 @@
+#include "hdf.h"
+
+#define  FILE1_NAME     "General_Vdatas.hdf" 
+#define  FILE2_NAME     "Two_Vdatas.hdf" 
+#define  VDATA_NAME     "Vdata 1"
+#define  VDATA_CLASS    "Empty Vdatas"
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file1_id, file2_id,
+         vdata_id, vdata1_id, vdata2_id,
+         vdata_ref = -1;     /* ref number of a vdata, set to -1 to create  */
+
+   /********************** End of variable declaration **********************/
+
+   /* 
+   * Create the first HDF file. 
+   */
+   file1_id = Hopen (FILE1_NAME, DFACC_CREATE, 0);
+
+   /* 
+   * Initialize the VS interface associated with the first HDF file. 
+   */
+   status_n = Vstart (file1_id);
+
+   /* 
+   * Create a vdata in the first HDF file. 
+   */
+   vdata_id = VSattach (file1_id, vdata_ref, "w");
+
+   /*
+   * Assign a name to the vdata.
+   */
+   status_32 = VSsetname (vdata_id, VDATA_NAME);
+
+   /* 
+   * Other operations on the vdata identified by vdata_id can be carried
+   * out starting from this point.
+   */
+
+   /* 
+   * Create the second HDF file. 
+   */
+   file2_id = Hopen (FILE2_NAME, DFACC_CREATE, 0);
+
+   /* 
+   * Initialize the VS interface associated with the second HDF file. 
+   */
+   status_n = Vstart (file2_id);
+
+   /* 
+   * Create the first vdata in the second HDF file. 
+   */
+   vdata1_id = VSattach (file2_id, vdata_ref, "w");
+
+   /* 
+   * Create the second vdata in the second HDF file. 
+   */
+   vdata2_id = VSattach (file2_id, vdata_ref, "w");
+
+   /*
+   * Assign a class name to these vdatas.
+   */
+   status_32 = VSsetclass (vdata1_id, VDATA_CLASS);
+   status_32 = VSsetclass (vdata2_id, VDATA_CLASS);
+
+   /* 
+   * Other operations on the vdatas identified by vdata1_id and vdata2_id 
+   * can be carried out starting from this point.
+   */
+
+   /* 
+   * Terminate access to the first vdata in the second HDF file. 
+   */
+   status_32 = VSdetach (vdata1_id);
+
+   /* 
+   * Terminate access to the second vdata in the second HDF file. 
+   */
+   status_32 = VSdetach (vdata2_id);
+
+   /* 
+   * From this point on, any operations on the vdatas identified by vdata1_id 
+   and vdata2_id are invalid but not on the vdata identified by vdata_id.
+   */
+
+   /* 
+   * Terminate access to the VS interface associated with the second HDF file. 
+   */
+   status_n = Vend (file2_id);
+
+   /* 
+   * Close the second HDF file. 
+   */
+   status_n = Hclose (file2_id);
+
+   /* 
+   * Terminate access to the vdata in the first HDF file. 
+   */
+   status_32 = VSdetach (vdata_id);
+
+   /* 
+   * Terminate access to the VS interface associated with the first HDF file. 
+   */
+   status_n = Vend (file1_id);
+
+   /* 
+   * Close the first HDF file. 
+   */
+   status_n = Hclose (file1_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_get_vdata_info.c b/hdf/examples/VD_get_vdata_info.c
new file mode 100644
index 0000000..762583c
--- /dev/null
+++ b/hdf/examples/VD_get_vdata_info.c
@@ -0,0 +1,74 @@
+#include "hdf.h"
+
+#define  FILE_NAME      "General_Vdatas.hdf"
+#define  FIELD_SIZE     80         /* maximum length of all the field names */
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         n_records,     /* to retrieve the number of records in the vdata   */
+         interlace_mode,/* to retrieve the interlace mode of the vdata      */
+         vdata_size,    /* to retrieve the size of all specified fields     */
+         file_id, vdata_ref, vdata_id;
+   char  fieldname_list[FIELD_SIZE], /* buffer to retrieve the vdata data   */
+         vdata_name[VSNAMELENMAX];   /* buffer to retrieve the vdata name   */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for reading. 
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the VS interface. 
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Set vdata_ref to -1 to start the search from the beginning of file.
+   */
+   vdata_ref = -1;
+
+   /*
+   * Use VSgetid to obtain each vdata by its reference number then attach 
+   * to the vdata and get its information.  The loop terminates when 
+   * the last vdata is reached.
+   */
+   while ((vdata_ref = VSgetid (file_id, vdata_ref)) != FAIL)
+   {
+      /*
+      * Attach to the current vdata for reading.
+      */
+      vdata_id = VSattach (file_id, vdata_ref, "r");
+
+      /*
+      * Test whether the current vdata is not a storage of an attribute, then
+      * obtain and display its information.
+      */
+      if( VSisattr (vdata_id) != TRUE )
+      {
+         status_n = VSinquire (vdata_id, &n_records, &interlace_mode, 
+                            fieldname_list, &vdata_size, vdata_name);
+         printf ("Vdata %s: - contains %d records\n\tInterlace mode: %s \
+                 \n\tFields: %s - %d bytes\n\t\n", vdata_name, n_records,
+                 interlace_mode == FULL_INTERLACE ? "FULL" : "NONE", 
+                 fieldname_list, vdata_size );
+      }
+
+      /*
+      * Detach from the current vdata.
+      */
+      status_32 = VSdetach (vdata_id);
+   } /* while */
+
+   /*
+   * Terminate access to the VS interface and close the HDF file. 
+   */
+   status_n = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_locate_vdata.c b/hdf/examples/VD_locate_vdata.c
new file mode 100644
index 0000000..15d09db
--- /dev/null
+++ b/hdf/examples/VD_locate_vdata.c
@@ -0,0 +1,82 @@
+#include "hdf.h"
+
+#define  FILE_NAME         "General_Vdatas.hdf"
+#define  SEARCHED_FIELDS   "Position,Temperature"
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file_id, vdata_id, vdata_ref,
+         index = 0;     /* index of the vdata in the file - manually kept   */
+   int8  found_fields;  /* TRUE if the specified fields exist in the vdata  */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for reading.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the VS interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Set the reference number to -1 to start the search from 
+   * the beginning of file.
+   */
+   vdata_ref = -1;
+
+   /*
+   * Assume that the specified fields are not found in the current vdata.
+   */
+   found_fields = FALSE;
+   
+   /*
+   * Use VSgetid to obtain each vdata by its reference number then
+   * attach to the vdata and search for the fields.  The loop
+   * terminates when the last vdata is reached or when a vdata which
+   * contains the fields listed in SEARCHED_FIELDS is found.  
+   */
+   while ((vdata_ref = VSgetid (file_id, vdata_ref)) != FAIL)
+   {
+      vdata_id = VSattach (file_id, vdata_ref, "r");
+      if ((status_n = VSfexist (vdata_id, SEARCHED_FIELDS)) != FAIL)
+      {
+         found_fields = TRUE;
+         break;
+      }
+
+      /*
+      * Detach from the current vdata before continuing searching.
+      */
+      status_32 = VSdetach (vdata_id);
+
+      index++;		/* advance the index by 1 for the next vdata */
+   }
+   
+   /*
+   * Print the index of the vdata containing the fields or a "not found" 
+   * message if no such vdata is found.  Also detach from the vdata found.
+   */
+   if (!found_fields) 
+      printf ("Fields Position and Temperature were not found.\n");
+   else 
+   {
+      printf
+     ("Fields Position and Temperature found in the vdata at position %d\n", 
+       index);
+      status_32 = VSdetach (vdata_id);
+   }
+
+   /*
+   * Terminate access to the VS interface and close the HDF file.
+   */
+   status_n = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_read_from_vdata.c b/hdf/examples/VD_read_from_vdata.c
new file mode 100644
index 0000000..9306c85
--- /dev/null
+++ b/hdf/examples/VD_read_from_vdata.c
@@ -0,0 +1,88 @@
+#include "hdf.h"
+
+#define  FILE_NAME       "General_Vdatas.hdf"
+#define  VDATA_NAME      "Solid Particle"
+#define  N_RECORDS       5    /* number of records the vdata contains */
+#define  RECORD_INDEX    3    /* position where reading starts - 4th record */
+#define  ORDER_1         3    /* order of first field to be read */
+#define  ORDER_2         2    /* order of second field to be read */
+#define  FIELDNAME_LIST  "Position,Temperature" /* only two fields are read */
+#define  N_VALS_PER_REC  (ORDER_1 + ORDER_2)   
+                         /* number of values per record */
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file_id, vdata_id, 
+         vdata_ref,     /* vdata's reference number */
+         num_of_records, /* number of records actually written to the vdata */
+         record_pos;    /* position of the current record */
+   int16 i, rec_num;    /* current record number in the vdata */
+   float32 databuf[N_RECORDS][N_VALS_PER_REC];   /* buffer for vdata values */
+
+   /********************** End of variable declaration **********************/
+
+   /* 
+   * Open the HDF file for reading.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /* 
+   * Initialize the VS interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Get the reference number of the vdata, whose name is specified in 
+   * VDATA_NAME, using VSfind, which will be discussed in Section 4.7.3.
+   */
+   vdata_ref = VSfind (file_id, VDATA_NAME);
+
+   /* 
+   * Attach to the vdata for reading if it is found, otherwise 
+   * exit the program.
+   */
+   if (vdata_ref == 0) exit;
+   vdata_id = VSattach (file_id, vdata_ref, "r");
+
+   /* 
+   * Specify the fields that will be read.
+   */
+   status_n = VSsetfields (vdata_id, FIELDNAME_LIST);
+
+   /*
+   * Place the current point to the position specified in RECORD_INDEX.
+   */
+   record_pos = VSseek (vdata_id, RECORD_INDEX);
+
+   /* 
+   * Read the next N_RECORDS records from the vdata and store the data 
+   * in the buffer databuf with fully interlaced mode.
+   */
+   num_of_records = VSread (vdata_id, (uint8 *)databuf, N_RECORDS, 
+                            FULL_INTERLACE);
+
+   /*
+   * Display the read data as many records as the number of records 
+   * returned by VSread.
+   */
+   printf ("\n       Particle Position        Temperature Range\n\n");
+   for (rec_num = 0; rec_num < num_of_records; rec_num++)
+   {
+      printf ("   %6.2f, %6.2f, %6.2f        %6.2f, %6.2f\n", 
+        databuf[rec_num][0], databuf[rec_num][1], databuf[rec_num][2], 
+        databuf[rec_num][3], databuf[rec_num][4]);
+   }
+
+   /* 
+   * Terminate access to the vdata and to the VS interface, then close 
+   * the HDF file.
+   */
+   status_32 = VSdetach (vdata_id);
+   status_n = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_read_mixed_vdata.c b/hdf/examples/VD_read_mixed_vdata.c
new file mode 100644
index 0000000..3521510
--- /dev/null
+++ b/hdf/examples/VD_read_mixed_vdata.c
@@ -0,0 +1,94 @@
+#include "hdf.h"
+
+#define  N_RECORDS       20      /* number of records to be read */
+#define  N_FIELDS        2       /* number of fields to be read */
+#define  FILE_NAME       "Packed_Vdata.hdf"
+#define  VDATA_NAME      "Mixed Data Vdata"
+#define  FIELDNAME_LIST  "Temp,Ident"
+
+/* number of bytes of the data to be read */
+#define  BUFFER_SIZE     ( sizeof(float32) + sizeof(char)) * N_RECORDS 
+
+int main ()
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file_id, vdata_id, 
+         num_of_records,        /* number of records actually read */
+         vdata_ref,             /* reference number of the vdata to be read */
+         buffer_size;           /* number of bytes the vdata can hold       */
+   float32 itemp[N_RECORDS];    /* buffer to hold values of first field     */
+   char  idents[N_RECORDS];     /* buffer to hold values of fourth field    */
+   uint8 databuf[BUFFER_SIZE];  /* buffer to hold read data, still packed   */
+   VOIDP fldbufptrs[N_FIELDS];/*pointers to be pointing to the field buffers*/
+   int   i;
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for reading. 
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the VS interface. 
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Get the reference number of the vdata, whose name is specified in
+   * VDATA_NAME, using VSfind, which will be discussed in Section 4.7.3.
+   */
+   vdata_ref = VSfind (file_id, VDATA_NAME);
+
+   /*
+   * Attach to the vdata for reading. 
+   */
+   vdata_id = VSattach (file_id, vdata_ref, "r");
+
+   /*
+   * Specify the fields that will be read. 
+   */
+   status_n = VSsetfields(vdata_id, FIELDNAME_LIST);
+
+   /*
+   * Read N_RECORDS records of the vdata and store the values into the 
+   * buffer databuf. 
+   */
+   num_of_records = VSread (vdata_id, (uint8 *)databuf, N_RECORDS, 
+                            FULL_INTERLACE);
+
+   /*
+   * Build an array of pointers each of which points to an array that
+   * will hold all values of a field after being unpacked.
+   */
+   fldbufptrs[0] = &itemp[0];
+   fldbufptrs[1] = &idents[0];
+   
+   /*
+   * Unpack the data from the buffer databuf and store the values into the 
+   * appropriate field buffers pointed to by the set of pointers fldbufptrs.
+   * Note that the second parameter is _HDF_VSUNPACK for unpacking and the
+   * number of records is the one returned by VSread.
+   */
+   status_n = VSfpack (vdata_id, _HDF_VSUNPACK, FIELDNAME_LIST, (VOIDP)databuf,
+               BUFFER_SIZE, num_of_records, NULL, (VOIDP)fldbufptrs);
+
+   /*
+   * Display the read data being stored in the field buffers.
+   */
+   printf ("\n     Temp      Ident\n");
+   for (i=0; i < num_of_records; i++)
+       printf ("   %6.2f        %c\n", itemp[i], idents[i]);
+
+   /*
+   * Terminate access to the vdata and the VS interface, then close 
+   * the HDF file. 
+   */
+   status_32 = VSdetach (vdata_id);
+   status_n = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_set_get_vdata_attr.c b/hdf/examples/VD_set_get_vdata_attr.c
new file mode 100644
index 0000000..816f5c4
--- /dev/null
+++ b/hdf/examples/VD_set_get_vdata_attr.c
@@ -0,0 +1,131 @@
+#include "hdf.h"
+
+#define  FILE_NAME        "General_Vdatas.hdf"
+#define  VDATA_NAME       "Solid Particle"
+#define  FIELD_NAME       "Mass"
+#define  VATTR_NAME       "Site Ident"      /* name of the vdata attribute  */
+#define  FATTR_NAME       "Scales"          /* name of the field attribute  */
+#define  VATTR_N_VALUES   3      /* number of values in the vdata attribute */
+#define  FATTR_N_VALUES   4      /* number of values in the field attribute */
+
+int main( )
+{   
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file_id, vdata_ref, vdata_id,
+         field_index,   /* index of a field within the vdata */
+         n_vdattrs,     /* number of vdata attributes */
+         n_fldattrs,    /* number of field attributes */
+         vdata_type,    /* to hold the type of vdata's attribute */ 
+         vdata_n_values,/* to hold the number of vdata's attribute values   */ 
+         vdata_size,    /* to hold the size of vdata's attribute values     */ 
+         field_type,    /* to hold the type of field's attribute            */ 
+         field_n_values,/* to hold the number of field's attribute values   */ 
+         field_size;    /* to hold the size of field's attribute values     */
+   char  vd_attr[VATTR_N_VALUES] = {'A', 'B', 'C'};/* vdata attribute values*/
+   int32 fld_attr[FATTR_N_VALUES] = {2, 4, 6, 8};  /* field attribute values*/
+   char  vattr_buf[VATTR_N_VALUES];     /* to hold vdata attribute's values */
+   int32 fattr_buf[FATTR_N_VALUES];     /* to hold field attribute's values */
+   char  vattr_name[30],                /* name of vdata attribute */
+         fattr_name[30];                /* name of field attribute */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for writing.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+
+   /* 
+   * Initialize the VS interface. 
+   */
+   status_n = Vstart (file_id);
+
+   /* 
+   * Get the reference number of the vdata named VDATA_NAME.
+   */
+   vdata_ref = VSfind (file_id, VDATA_NAME);
+
+   /*
+   * Attach to the vdata for writing. 
+   */
+   vdata_id = VSattach (file_id, vdata_ref, "w");
+
+   /*
+   * Attach an attribute to the vdata, i.e., indicated by the second parameter.
+   */
+   status_n = VSsetattr (vdata_id, _HDF_VDATA, VATTR_NAME, DFNT_CHAR,
+                                                   VATTR_N_VALUES, vd_attr);
+
+   /*
+   * Get the index of the field FIELD_NAME within the vdata.
+   */
+   status_n = VSfindex (vdata_id, FIELD_NAME, &field_index);
+
+   /*
+   * Attach an attribute to the field field_index.
+   */
+   status_n = VSsetattr (vdata_id, field_index, FATTR_NAME, DFNT_INT32, 
+                                                   FATTR_N_VALUES, fld_attr);
+
+   /*
+   * Get the number of attributes attached to the vdata's first 
+   * field - should be 0. 
+   */
+   n_fldattrs = VSfnattrs (vdata_id, 0);
+   printf ( "Number of attributes of the first field of the vdata: %d\n", 
+             n_fldattrs);
+
+   /*
+   * Get the number of attributes attached to the field specified by 
+   * field_index - should be 1.
+   */
+   n_fldattrs = VSfnattrs (vdata_id, field_index);
+   printf ( "Number of attributes of field %s: %d\n", FIELD_NAME, n_fldattrs);
+
+   /*
+   * Get the total number of the field's and vdata's attributes - should be 2. 
+   */
+   n_vdattrs = VSnattrs (vdata_id);
+   printf ( "Number of attributes of the vdata and its fields: %d\n", 
+             n_vdattrs);
+
+   /*
+   * Get information about the vdata's first attribute, indicated
+   * by the third parameter which is the index of the attribute. 
+   */
+   status_n = VSattrinfo (vdata_id, _HDF_VDATA, 0, vattr_name, 
+                          &vdata_type, &vdata_n_values, &vdata_size);
+
+   /*
+   * Get information about the first attribute of the field specified by 
+   * field_index. 
+   */
+   status_n = VSattrinfo (vdata_id, field_index, 0, fattr_name, &field_type, 
+                          &field_n_values, &field_size);
+
+   /*
+   * Get the vdata's first attribute. 
+   */
+   status_n = VSgetattr (vdata_id, _HDF_VDATA, 0, vattr_buf);
+   printf("Values of the vdata attribute = %c %c %c\n", vattr_buf[0],
+                          vattr_buf[1], vattr_buf[2]);
+
+   /*
+   * Get the first attribute of the field specified by field_index.
+   */
+   status_n = VSgetattr (vdata_id, field_index, 0, fattr_buf);
+   printf("Values of the field attribute = %d %d %d %d\n", fattr_buf[0], 
+                          fattr_buf[1], fattr_buf[2], fattr_buf[3]);
+
+   /*
+   * Terminate access to the vdata and to the VS interface, then close 
+   * the HDF file. 
+   */
+   status_32 = VSdetach (vdata_id);
+   status_n  = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_write_mixed_vdata.c b/hdf/examples/VD_write_mixed_vdata.c
new file mode 100644
index 0000000..4a9562b
--- /dev/null
+++ b/hdf/examples/VD_write_mixed_vdata.c
@@ -0,0 +1,115 @@
+#include "hdf.h"
+
+#define  FILE_NAME        "Packed_Vdata.hdf"
+#define  VDATA_NAME       "Mixed Data Vdata"
+#define  CLASS_NAME       "General Data Class"
+#define  FIELD1_NAME      "Temp" 
+#define  FIELD2_NAME      "Height" 
+#define  FIELD3_NAME      "Speed" 
+#define  FIELD4_NAME      "Ident"
+#define  ORDER            1        /* number of values in the field         */
+#define  N_RECORDS        20       /* number of records the vdata contains  */
+#define  N_FIELDS         4        /* number of fields in the vdata         */
+#define  FIELDNAME_LIST   "Temp,Height,Speed,Ident"  /* No spaces b/w names */
+
+/* number of bytes of the data to be written, i.e., the size of all the
+   field values combined times the number of records */
+#define BUF_SIZE (2*sizeof(float32) + sizeof(int16) + sizeof(char)) * N_RECORDS
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file_id, vdata_id,
+         vdata_ref = -1,   /* vdata's reference number, set to -1 to create */
+         num_of_records; /* number of records actually written to the vdata */
+   float32 temp[N_RECORDS];       /* buffer to hold values of first field   */
+   int16   height[N_RECORDS];     /* buffer to hold values of second field  */
+   float32 speed[N_RECORDS];      /* buffer to hold values of third field   */
+   char8   ident[N_RECORDS];      /* buffer to hold values of fourth field  */
+   VOIDP   fldbufptrs[N_FIELDS];/*pointers to be pointing to the field buffers*/
+   uint16  databuf[BUF_SIZE]; /* buffer to hold the data after being packed*/
+   int     i;
+
+   /********************** End of variable declaration **********************/
+
+   /* 
+   * Create an HDF file. 
+   */
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0);
+
+   /* 
+   * Initialize the VS interface. 
+   */
+   status_n = Vstart (file_id);
+
+   /* 
+   * Create a new vdata. 
+   */
+   vdata_id = VSattach (file_id, vdata_ref, "w");
+
+   /* 
+   * Set name and class name of the vdata. 
+   */
+   status_32 = VSsetname (vdata_id, VDATA_NAME);
+   status_32 = VSsetclass (vdata_id, CLASS_NAME);
+
+   /* 
+   * Introduce each field's name, data type, and order.  This is the first
+   * part in defining a vdata field.
+   */
+   status_n = VSfdefine (vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER); 
+   status_n = VSfdefine (vdata_id, FIELD2_NAME, DFNT_INT16, ORDER); 
+   status_n = VSfdefine (vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER); 
+   status_n = VSfdefine (vdata_id, FIELD4_NAME, DFNT_CHAR8, ORDER); 
+
+   /*
+   * Finalize the definition of the fields of the vdata.
+   */
+   status_n = VSsetfields (vdata_id, FIELDNAME_LIST);
+
+   /* 
+   * Enter data values into the field buffers by the records.
+   */
+   for (i = 0; i < N_RECORDS; i++)
+   {
+      temp[i] = 1.11 * (i+1);
+      height[i] = i;
+      speed[i] = 1.11 * (i+1);
+      ident[i] = 'A' + i;
+   }
+
+   /* 
+   * Build an array of pointers each of which points to a field buffer that
+   * holds all values of the field.
+   */
+   fldbufptrs[0] = &temp[0];
+   fldbufptrs[1] = &height[0];
+   fldbufptrs[2] = &speed[0];
+   fldbufptrs[3] = &ident[0];
+
+   /* 
+   * Pack all data in the field buffers that are pointed to by the set of
+   * pointers fldbufptrs, and store the packed data into the buffer 
+   * databuf.  Note that the second parameter is _HDF_VSPACK for packing.
+   */
+   status_n = VSfpack (vdata_id,_HDF_VSPACK, NULL, (VOIDP)databuf,
+           BUF_SIZE, N_RECORDS, NULL, (VOIDP)fldbufptrs);
+
+   /* 
+   * Write all records of the packed data to the vdata. 
+   */
+   num_of_records = VSwrite (vdata_id, (uint8 *)databuf, N_RECORDS, 
+                             FULL_INTERLACE); 
+
+   /* 
+   * Terminate access to the vdata and the VS interface, then close 
+   * the HDF file.
+   */
+   status_32 = VSdetach (vdata_id);
+   status_n = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_write_mixed_vdata_struct.c b/hdf/examples/VD_write_mixed_vdata_struct.c
new file mode 100644
index 0000000..2fccedc
--- /dev/null
+++ b/hdf/examples/VD_write_mixed_vdata_struct.c
@@ -0,0 +1,154 @@
+/* Example 4_struct. Writing a multi-field and mixed-type vdata
+with packing - using struct instead of array to buffer field values.
+
+This example illustrates the use of VSfpack and VSwrite to write a
+vdata with data of different types.  The problem in this example is
+identical to that in Example 4 of Chapter Vdata in the User's Guide.
+However, the two programs differ in the implementation of the
+data structures that hold the user's data.
+
+In this example, the program creates an HDF file named
+"Packed_Vdata.hdf" then defines a vdata, which is named "Mixed
+Data Vdata" and belongs to class "General Data Class".  The vdata
+contains four order-1 fields, "Temp", "Height", "Speed", and "Ident" of
+type float32, int16, float32, and char, respectively.  The program then
+packs the data in fully interlaced mode into a buffer and writes the
+packed data to the vdata.  Note that, in this example, each VSfpack
+call packs 1 record while in Example 4, a VSfpack call packs all
+N_RECORDS.  This difference is the result of using an array of
+structs in this example to hold the field values instead of 
+individual arrays as in Example 4.  */
+
+#include "hdf.h"
+
+#define  FILE_NAME        "Packed_Vdata.hdf"
+#define  VDATA_NAME       "Mixed Data Vdata"
+#define  CLASS_NAME       "General Data Class"
+#define  N_RECORDS        20        /* number of records the vdata contains */
+#define  N_FIELDS         4         /* number of fields in the vdata */
+#define  FIELD1_NAME      "Temp" 
+#define  FIELD2_NAME      "Height" 
+#define  FIELD3_NAME      "Speed" 
+#define  FIELD4_NAME      "Ident"
+#define  FIELDNAME_LIST   "Temp,Height,Speed,Ident"  /* No spaces b/w names */
+
+/* RECORD_SIZE is the number of bytes of all the field values combined and
+   BUFFER_SIZE is the number of bytes of data to be written */
+#define  RECORD_SIZE      (2 * sizeof(float32) + sizeof(int16) + sizeof(char))
+#define  BUFFER_SIZE      (RECORD_SIZE * N_RECORDS)
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         file_id, vdata_id,
+         num_of_records; /* number of records actually written to the vdata */
+   uint8 databuf[BUFFER_SIZE];/* buffer to hold the data after being packed */
+   uint8 *pntr; /* pointer pointing to the current record in the data buffer*/
+   int16 rec_num;        /* current record number */ 
+
+   struct {
+      float32      temp;   /* to hold value of the first field of the vdata */
+      int16        height;/* to hold value of the second field of the vdata */
+      float32      speed;  /* to hold value of the third field of the vdata */
+      char         ident; /* to hold value of the fourth field of the vdata */
+   } source[N_RECORDS];
+
+   /* pointers to be pointing to the fields in the struct buffer */
+   VOIDP  fldbufptrs[N_FIELDS];
+
+   /********************** End of variable declaration **********************/
+
+   /* 
+   * Create the HDF file. 
+   */
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0);
+
+   /* 
+   * Initialize the VS interface. 
+   */
+   status_n = Vstart (file_id);
+
+   /* 
+   * Create a new vdata. 
+   */
+   vdata_id = VSattach (file_id, -1, "w");
+
+   /*
+   * Set name and class name of the vdata.
+   */
+   status_32 = VSsetname (vdata_id, VDATA_NAME);
+   status_32 = VSsetclass (vdata_id, CLASS_NAME);
+
+   /* 
+   * Introduce each field's name, data type, and order.  This is the first
+   * part in defining a vdata field.
+   */
+   status_n = VSfdefine (vdata_id, FIELD1_NAME, DFNT_FLOAT32, 1); 
+   status_n = VSfdefine (vdata_id, FIELD2_NAME, DFNT_INT16, 1); 
+   status_n = VSfdefine (vdata_id, FIELD3_NAME, DFNT_FLOAT32, 1); 
+   status_n = VSfdefine (vdata_id, FIELD4_NAME, DFNT_CHAR8, 1); 
+
+   /*
+   * Finalize the definition of the fields to be written to.
+   */
+   status_n = VSsetfields (vdata_id, FIELDNAME_LIST);
+
+   /*
+   * Initialize pointer for traversing the buffer to pack each record.
+   */
+   pntr = &databuf[0];
+
+   /* 
+   * Enter data values into each record.
+   */
+   for (rec_num = 0; rec_num < N_RECORDS; rec_num++) {
+      source[rec_num].temp = 1.11 * (rec_num+1);
+      source[rec_num].height = rec_num;
+      source[rec_num].speed = 1.11 * (rec_num+1);
+      source[rec_num].ident = 'A' + rec_num;
+   }
+
+   /* 
+   * Pack one record at a time.
+   */
+   for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+   {
+      /* 
+      * Build an array of pointers each of which points to a space that
+      * holds the value of the corresponding field in this record.
+      */
+      fldbufptrs[0] = &source[rec_num].temp;
+      fldbufptrs[1] = &source[rec_num].height;
+      fldbufptrs[2] = &source[rec_num].speed;
+      fldbufptrs[3] = &source[rec_num].ident;
+
+      /* 
+      * Pack the data in the field buffers into the data buffer at the 
+      * current record, i.e. indicated by "pntr".
+      */
+      status_n = VSfpack (vdata_id,_HDF_VSPACK, NULL, (VOIDP)pntr,
+              RECORD_SIZE, 1, NULL, fldbufptrs);
+
+      /*
+      * Advance the current position in the buffer.
+      */
+      pntr = pntr + RECORD_SIZE;
+   }        
+
+   /* 
+   * Write all records of the packed data to the vdata. 
+   */
+   num_of_records = VSwrite (vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); 
+
+   /* 
+   * Terminate access to the Vdata and the VS interface, 
+   * then close the HDF file.
+   */
+   status_32 = VSdetach (vdata_id);
+   status_n = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VD_write_to_vdata.c b/hdf/examples/VD_write_to_vdata.c
new file mode 100644
index 0000000..428d35d
--- /dev/null
+++ b/hdf/examples/VD_write_to_vdata.c
@@ -0,0 +1,96 @@
+#include "hdf.h"
+
+#define  FILE_NAME        "General_Vdatas.hdf"
+#define  N_RECORDS        10        /* number of records the vdata contains */
+#define  ORDER_1          3         /* order of first field */
+#define  ORDER_2          1         /* order of second field */
+#define  ORDER_3          2         /* order of third field */
+#define  CLASS_NAME       "Particle Data"
+#define  VDATA_NAME       "Solid Particle"
+#define  FIELD1_NAME      "Position"      /* contains x, y, z values */
+#define  FIELD2_NAME      "Mass"          /* contains weight values */
+#define  FIELD3_NAME      "Temperature"   /* contains min and max values */
+#define  FIELDNAME_LIST   "Position,Mass,Temperature" /* No spaces b/w names */
+
+/* number of values per record */
+#define  N_VALS_PER_REC   (ORDER_1 + ORDER_2 + ORDER_3)
+
+int main( ) 
+{
+   /************************* Variable declaration **************************/
+
+   intn   status_n;     /* returned status for functions returning an intn  */
+   int32  status_32,    /* returned status for functions returning an int32 */
+          file_id, vdata_id,
+          vdata_ref = -1,    /* ref number of a vdata, set to -1 to create  */
+          num_of_records;    /* number of records actually written to vdata */
+   int16  rec_num;           /* current record number */
+   float32  data_buf[N_RECORDS][N_VALS_PER_REC]; /* buffer for vdata values */
+
+   /********************** End of variable declaration **********************/
+
+   /* 
+   * Open the HDF file for writing.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+
+   /* 
+   * Initialize the VS interface.
+   */
+   status_n = Vstart (file_id);
+
+   /* 
+   * Create a new vdata.
+   */
+   vdata_id = VSattach (file_id, vdata_ref, "w");
+
+   /* 
+   * Set name and class name of the vdata.
+   */
+   status_32 = VSsetname (vdata_id, VDATA_NAME);
+   status_32 = VSsetclass (vdata_id, CLASS_NAME);
+
+   /* 
+   * Introduce each field's name, data type, and order.  This is the first
+   * part in defining a field.
+   */
+   status_n = VSfdefine (vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER_1 );
+   status_n = VSfdefine (vdata_id, FIELD2_NAME, DFNT_FLOAT32, ORDER_2 );
+   status_n = VSfdefine (vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER_3 );
+
+   /* 
+   * Finalize the definition of the fields.
+   */
+   status_n = VSsetfields (vdata_id, FIELDNAME_LIST);
+
+   /* 
+   * Buffer the data by the record for fully interlaced mode.  Note that the
+   * first three elements contain the three values of the first field, the
+   * fourth element contains the value of the second field, and the last two
+   * elements contain the two values of the third field.
+   */
+   for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+   {
+      data_buf[rec_num][0] = 1.0 * rec_num;
+      data_buf[rec_num][1] = 2.0 * rec_num;
+      data_buf[rec_num][2] = 3.0 * rec_num;
+      data_buf[rec_num][3] = 0.1 + rec_num;
+      data_buf[rec_num][4] = 0.0;
+      data_buf[rec_num][5] = 65.0;
+   }
+
+   /* 
+   * Write the data from data_buf to the vdata with full interlacing mode.
+   */
+   num_of_records = VSwrite (vdata_id, (uint8 *)data_buf, N_RECORDS, 
+                             FULL_INTERLACE);
+
+   /* 
+   * Terminate access to the vdata and to the VS interface, then close 
+   * the HDF file.
+   */
+   status_32 = VSdetach (vdata_id);
+   status_n  = Vend (file_id);
+   status_32 = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VG_add_sds_to_vgroup.c b/hdf/examples/VG_add_sds_to_vgroup.c
new file mode 100644
index 0000000..c575e74
--- /dev/null
+++ b/hdf/examples/VG_add_sds_to_vgroup.c
@@ -0,0 +1,82 @@
+#include   "hdf.h"      /* Note: in this example, hdf.h can be omitted...*/
+#include   "mfhdf.h"    /* ...since mfhdf.h already includes hdf.h */
+
+#define  FILE_NAME    "General_Vgroups.hdf"
+#define  SDS_NAME     "Test SD"
+#define  VG_NAME      "SD Vgroup"
+#define  VG_CLASS     "Common Vgroups"
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   intn   status_n;     /* returned status for functions returning an intn  */
+   int32  status_32,    /* returned status for functions returning an int32 */
+          sd_id,        /* SD interface identifier */
+          sds_id,       /* data set identifier */
+          sds_ref,      /* reference number of the data set */
+          dim_sizes[1], /* dimension of the data set - only one */
+          rank = 1,     /* rank of the data set array */
+          vgroup_id,    /* vgroup identifier */
+          file_id;      /* HDF file identifier, same for V interface */
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Create the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0);
+
+   /*
+   * Initialize the V interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_WRITE);
+
+   /*
+   * Set the size of the SDS's dimension.
+   */
+   dim_sizes[0] = 10;
+
+   /*
+   * Create the SDS.
+   */
+   sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT32, rank, dim_sizes);
+
+   /*
+   * Create a vgroup and set its name and class.
+   */
+   vgroup_id = Vattach (file_id, -1, "w");
+   status_32 = Vsetname (vgroup_id, VG_NAME);
+   status_32 = Vsetclass (vgroup_id, VG_CLASS);
+
+   /*
+   * Obtain the reference number of the SDS using its identifier.
+   */
+   sds_ref = SDidtoref (sds_id);
+
+   /*
+   * Add the SDS to the vgroup.  Note: the tag DFTAG_NDG is used
+   * when adding an SDS.  Refer to Appendix A for the entire list of tags.
+   */
+   status_32 = Vaddtagref (vgroup_id, DFTAG_NDG, sds_ref);
+
+   /*
+   * Terminate access to the SDS and to the SD interface.
+   */
+   status_n = SDendaccess (sds_id);
+   status_n = SDend (sd_id);
+
+   /*
+   * Terminate access to the vgroup and to the V interface, and 
+   * close the HDF file.
+   */
+   status_32 = Vdetach (vgroup_id);
+   status_n = Vend (file_id);
+   status_n = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VG_create_vgroup.c b/hdf/examples/VG_create_vgroup.c
new file mode 100644
index 0000000..f863367
--- /dev/null
+++ b/hdf/examples/VG_create_vgroup.c
@@ -0,0 +1,57 @@
+#include "hdf.h"
+
+#define  FILE_NAME    "Two_Vgroups.hdf"
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;      /* returned status for functions returning an intn  */
+   int32 status_32,     /* returned status for functions returning an int32 */
+         vgroup_ref = -1,
+         vgroup1_id, vgroup2_id, file_id;
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Create the HDF file.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_CREATE, 0);
+
+   /*
+   * Initialize the V interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Create the first vgroup.  Note that the vgroup reference number is set
+   * to -1 for creating and the access mode is "w" for writing.
+   */
+   vgroup1_id = Vattach (file_id, vgroup_ref, "w");
+
+   /*
+   * Create the second vgroup. 
+   */
+   vgroup2_id = Vattach (file_id, vgroup_ref, "w");
+
+   /*
+   * Any operations on the vgroups.
+   */
+
+   /*
+   * Terminate access to the first vgroup.
+   */
+   status_32 = Vdetach (vgroup1_id);
+
+   /*
+   * Terminate access to the second vgroup.
+   */
+   status_32 = Vdetach (vgroup2_id);
+
+   /*
+   * Terminate access to the V interface and close the HDF file.
+   */
+   status_n = Vend (file_id);
+   status_n = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VG_get_vgroup_info.c b/hdf/examples/VG_get_vgroup_info.c
new file mode 100644
index 0000000..f2d4fd0
--- /dev/null
+++ b/hdf/examples/VG_get_vgroup_info.c
@@ -0,0 +1,103 @@
+#include "hdf.h"
+
+#define  FILE_NAME   "General_Vgroups.hdf"
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn   status_n;     /* returned status for functions returning an intn  */
+   int32  status_32,    /* returned status for functions returning an int32 */
+          file_id, vgroup_id;
+   int32  lone_vg_number,      /* current lone vgroup number */
+          num_of_lones = 0;    /* number of lone vgroups */
+   int32 *ref_array;    /* buffer to hold the ref numbers of lone vgroups   */
+   char  *vgroup_name, *vgroup_class;
+   uint16 name_len;
+
+   /********************** End of variable declaration **********************/
+ 
+   /*
+   * Open the HDF file for reading.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0); 
+
+   /*
+   * Initialize the V interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Get and print the names and class names of all the lone vgroups.
+   * First, call Vlone with num_of_lones set to 0 to get the number of
+   * lone vgroups in the file, but not to get their reference numbers.
+   */
+   num_of_lones = Vlone (file_id, NULL, num_of_lones );
+
+   /*
+   * Then, if there are any lone vgroups, 
+   */
+   if (num_of_lones > 0)
+   {
+      /*
+      * use the num_of_lones returned to allocate sufficient space for the
+      * buffer ref_array to hold the reference numbers of all lone vgroups,
+      */
+      ref_array = (int32 *) malloc(sizeof(int32) * num_of_lones);
+
+      /*
+      * and call Vlone again to retrieve the reference numbers into 
+      * the buffer ref_array.
+      */
+      num_of_lones = Vlone (file_id, ref_array, num_of_lones);
+
+      /*
+      * Display the name and class of each lone vgroup.
+      */
+      fprintf(stderr, "Lone vgroups in this file are:\n");
+      for (lone_vg_number = 0; lone_vg_number < num_of_lones; 
+                                                            lone_vg_number++)
+      {
+         /*
+         * Attach to the current vgroup then get and display its
+         * name and class. Note: the current vgroup must be detached before
+         * moving to the next.
+         */
+         vgroup_id = Vattach (file_id, ref_array[lone_vg_number], "r");
+	 status_32 = Vgetnamelen(vgroup_id, &name_len);
+	 vgroup_name = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+	 if (vgroup_name == NULL)
+	 {
+	     fprintf(stderr, "Not enough memory for vgroup_name!\n");
+	     exit(1);
+	 }
+         status_32 = Vgetname (vgroup_id, vgroup_name);
+
+	 status_32 = Vgetclassnamelen(vgroup_id, &name_len);
+	 vgroup_class = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+	 if (vgroup_class == NULL)
+	 {
+	     fprintf(stderr, "Not enough memory for vgroup_class!\n");
+	     exit(1);
+	 }
+         status_32 = Vgetclass (vgroup_id, vgroup_class);
+         fprintf(stderr, "   Vgroup name %s and class %s\n", vgroup_name,  
+                     vgroup_class); 
+         status_32 = Vdetach (vgroup_id);
+	 if (vgroup_name != NULL) HDfree(vgroup_name);
+	 if (vgroup_class != NULL) HDfree(vgroup_class);
+      } /* for */
+   } /* if */
+
+   /*
+   * Terminate access to the V interface and close the file.
+   */
+   status_n = Vend (file_id);
+   status_n = Hclose (file_id);
+
+   /*
+   * Free the space allocated by this program.
+   */
+   free (ref_array);
+   return 0;
+}
diff --git a/hdf/examples/VG_insert_vdatas_to_vgroup.c b/hdf/examples/VG_insert_vdatas_to_vgroup.c
new file mode 100644
index 0000000..77638d3
--- /dev/null
+++ b/hdf/examples/VG_insert_vdatas_to_vgroup.c
@@ -0,0 +1,150 @@
+#include "hdf.h"
+
+#define  FILE_NAME         "General_Vgroups.hdf"
+#define  N_RECORDS         30       /* number of records in the vdatas */
+#define  ORDER             3        /* order of field FIELD_VD2 */
+#define  VG_NAME           "Vertices"
+#define  VG_CLASS          "Vertex Set"
+#define  VD1_NAME          "X,Y Coordinates"   /* first vdata to hold X,Y...*/
+#define  VD1_CLASS         "Position"          /*...values of the vertices */
+#define  VD2_NAME          "Temperature"       /* second vdata to hold the...*/
+#define  VD2_CLASS         "Property List"     /*...temperature field */
+#define  VD3_NAME          "Node List"         /* third vdata to hold...*/
+#define  VD3_CLASS         "Mesh"              /*...the list of nodes */
+#define  FIELD1_VD1        "PX"    /* first field of first vdata - X values */
+#define  FIELD2_VD1        "PY"/* second field of first vdata - Y values */
+#define  FIELD_VD2         "TMP"/* field of third vdata */
+#define  FIELD_VD3         "PLIST"/* field of second vdata */
+#define  FIELDNAME_LIST    "PX,PY" /* field name list for first vdata */
+/* Note that the second and third vdatas can use the field names as 
+   the field name lists unless more fields are added to a vdata.
+   Then a field name list is needed for that vdata */
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn     status_n;   /* returned status for functions returning an intn  */
+   int32    status_32,  /* returned status for functions returning an int32 */
+            file_id, vgroup_id, 
+            vdata1_id, vdata2_id, vdata3_id; 
+   int32    num_of_records,           /* number of records actually written */
+            vd_index;                 /* position of a vdata in the vgroup  */
+   int8     i, j, k = 0;
+   float32  pxy[N_RECORDS][2] =       /* buffer for data of the first vdata */
+		  	{-1.5, 2.3, -1.5, 1.98, -2.4, .67,
+   			-3.4, 1.46, -.65, 3.1, -.62, 1.23,
+   			-.4, 3.8, -3.55, 2.3, -1.43, 2.44,
+   			.23, 1.13, -1.4, 5.43, -1.4, 5.8,
+   			-3.4, 3.85, -.55, .3, -.21, 1.22,
+   			-1.44, 1.9, -1.4, 2.8, .94, 1.78,
+   			-.4, 2.32, -.87, 1.99, -.54, 4.11,
+   			-1.5, 1.35, -1.4, 2.21, -.22, 1.8,
+   			-1.1, 4.55, -.44, .54, -1.11, 3.93,
+   			-.76, 1.9, -2.34, 1.7, -2.2, 1.21};
+   float32  tmp[N_RECORDS];          /* buffer for data of the second vdata */
+   int16    plist[N_RECORDS][3];     /* buffer for data of the third vdata */
+
+   /********************** End of variable declaration ***********************/
+
+   /*
+   * Open the HDF file for writing.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+
+   /*
+   * Initialize the V interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Buffer the data for the second and third vdatas.
+   */
+   for (i = 0; i < N_RECORDS; i++)
+      for (j = 0; j < ORDER; j++)
+         plist[i][j] = ++k;
+
+   for (i = 0; i < N_RECORDS; i++)
+      tmp[i] = i * 10.0;
+
+   /*
+   * Create the vgroup then set its name and class.  Note that the vgroup's
+   * reference number is set to -1 for creating and the access mode is "w" for
+   * writing.
+   */
+   vgroup_id = Vattach (file_id, -1, "w");
+   status_32 = Vsetname (vgroup_id, VG_NAME);
+   status_32 = Vsetclass (vgroup_id, VG_CLASS);
+
+   /*
+   * Create the first vdata then set its name and class. Note that the vdata's
+   * reference number is set to -1 for creating and the access mode is "w" for
+   * writing.
+   */
+   vdata1_id = VSattach (file_id, -1, "w");
+   status_32 = VSsetname (vdata1_id, VD1_NAME);
+   status_32 = VSsetclass (vdata1_id, VD1_CLASS);
+
+   /*
+   * Introduce and define the fields of the first vdata.
+   */
+   status_n = VSfdefine (vdata1_id, FIELD1_VD1, DFNT_FLOAT32, 1);
+   status_n = VSfdefine (vdata1_id, FIELD2_VD1, DFNT_FLOAT32, 1);
+   status_n = VSsetfields (vdata1_id, FIELDNAME_LIST);
+
+   /*
+   * Write the buffered data into the first vdata with full interlace mode.
+   */
+   num_of_records = VSwrite (vdata1_id, (uint8 *)pxy, N_RECORDS, 
+                             FULL_INTERLACE);
+
+   /*
+   * Insert the vdata into the vgroup using its identifier.
+   */
+   vd_index = Vinsert (vgroup_id, vdata1_id);
+
+   /*
+   * Detach from the first vdata.
+   */
+   status_32 = VSdetach (vdata1_id);
+
+   /*
+   * Create, write, and insert the second vdata to the vgroup using
+   * steps similar to those used for the first vdata.
+   */ 
+   vdata2_id = VSattach (file_id, -1, "w");
+   status_32 = VSsetname (vdata2_id, VD2_NAME);
+   status_32 = VSsetclass (vdata2_id, VD2_CLASS);
+   status_n = VSfdefine (vdata2_id, FIELD_VD2, DFNT_FLOAT32, 1);
+   status_n = VSsetfields (vdata2_id, FIELD_VD2);
+   num_of_records = VSwrite (vdata2_id, (uint8 *)tmp, N_RECORDS, 
+                             FULL_INTERLACE);
+   vd_index = Vinsert (vgroup_id, vdata2_id);
+   status_32 = VSdetach (vdata2_id);
+
+   /*
+   * Create, write, and insert the third vdata to the vgroup using 
+   * steps similar to those used for the first and second vdatas.
+   */
+   vdata3_id = VSattach (file_id, -1, "w");
+   status_32 = VSsetname (vdata3_id, VD3_NAME);
+   status_32 = VSsetclass (vdata3_id, VD3_CLASS);
+   status_n = VSfdefine (vdata3_id, FIELD_VD3, DFNT_INT16, 3);
+   status_n = VSsetfields (vdata3_id, FIELD_VD3);
+   num_of_records = VSwrite (vdata3_id, (uint8 *)plist, N_RECORDS, 
+                             FULL_INTERLACE);
+   vd_index = Vinsert (vgroup_id, vdata3_id);
+   status_32 = VSdetach (vdata3_id);
+
+   /*
+   * Terminate access to the vgroup "Vertices".
+   */
+   status_32 = Vdetach (vgroup_id);
+
+   /*
+   * Terminate access to the V interface and close the HDF file.
+   */
+   status_n = Vend (file_id);
+   status_n = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/VG_set_get_vgroup_attr.c b/hdf/examples/VG_set_get_vgroup_attr.c
new file mode 100644
index 0000000..77111a2
--- /dev/null
+++ b/hdf/examples/VG_set_get_vgroup_attr.c
@@ -0,0 +1,106 @@
+#include "hdf.h"
+
+#define  FILE_NAME      "General_Vgroups.hdf"
+#define  VGROUP_NAME    "SD Vgroup"
+#define  VGATTR_NAME    "First Attribute"
+#define  N_ATT_VALUES   7              /* number of values in the attribute */
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn   status_n,     /* returned status for functions returning an intn  */
+          n_attrs;      /* number of attributes of the vgroup */
+   int32  status_32,    /* returned status for functions returning an int32 */
+          file_id, vgroup_ref, vgroup_id,
+          attr_index, i, vg_version,
+          data_type, n_values, size;
+   char   vg_attr[N_ATT_VALUES] = {'v','g','r','o','u','p','\0'};
+   char   vgattr_buf[N_ATT_VALUES], attr_name[30];
+
+   /********************** End of variable declaration **********************/
+
+   /*
+   * Open the HDF file for writing.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+
+   /*
+   * Initialize the V interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Get the reference number of the vgroup named VGROUP_NAME.
+   */
+   vgroup_ref = Vfind (file_id, VGROUP_NAME);
+
+   /*
+   * Attach to the vgroup found.
+   */
+   vgroup_id = Vattach (file_id, vgroup_ref, "w");
+
+   /*
+   * Get and display the version of the attached vgroup.
+   */
+   vg_version = Vgetversion (vgroup_id);
+   switch (vg_version) {
+        case VSET_NEW_VERSION:
+              printf ("\nVgroup %s is of the newest version, version 4\n", 
+                   VGROUP_NAME);
+           break;
+        case VSET_VERSION:
+              printf ("Vgroup %s is of a version between 3.2 and 4.0r2\n", 
+                   VGROUP_NAME);
+           break;
+        case VSET_OLD_VERSION:
+              printf ("Vgroup %s is of version before 3.2\n", VGROUP_NAME);
+           break;
+        default:
+           printf ("Unknown version = %d\n", vg_version);
+        } /* switch */
+
+   /*
+   * Add the attribute named VGATTR_NAME to the vgroup.
+   */
+   status_n = Vsetattr (vgroup_id, VGATTR_NAME, DFNT_CHAR, N_ATT_VALUES, 
+                        vg_attr);
+
+   /*
+   * Get and display the number of attributes attached to this vgroup.
+   */
+   n_attrs = Vnattrs (vgroup_id);
+   printf ("\nThis vgroup has %d attribute(s)\n", n_attrs);
+
+   /*
+   * Get and display the name and the number of values of each attribute.
+   * Note that the fourth and last parameters are set to NULL because the type 
+   * and the size of the attribute are not desired.
+   */
+   for (attr_index = 0; attr_index < n_attrs; attr_index++)
+   {
+      status_n = Vattrinfo (vgroup_id, attr_index, attr_name, NULL, 
+                            &n_values, NULL);
+      printf ("\nAttribute #%d is named %s and has %d values: ",
+                            attr_index+1, attr_name, n_values);
+
+      /*
+      * Get and display the attribute values.
+      */
+      status_n = Vgetattr (vgroup_id, attr_index, vgattr_buf);
+      for (i = 0; i < n_values; i++)
+         printf ("%c ", vgattr_buf[i]);
+      printf ("\n");
+   }
+
+
+   /*
+   * Terminate access to the vgroup and to the V interface, and close 
+   * the HDF file.
+   */
+   status_32 = Vdetach (vgroup_id);
+   status_n = Vend (file_id);
+   status_n = Hclose (file_id);
+   return 0;
+}
+
diff --git a/hdf/examples/VG_vgroup_contents.c b/hdf/examples/VG_vgroup_contents.c
new file mode 100644
index 0000000..32556cc
--- /dev/null
+++ b/hdf/examples/VG_vgroup_contents.c
@@ -0,0 +1,104 @@
+#include "hdf.h"
+
+#define   FILE_NAME        "General_Vgroups.hdf"
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn   status_n;     /* returned status for functions returning an intn  */
+   int32  status_32,    /* returned status for functions returning an int32 */
+          file_id, vgroup_id, vgroup_ref,
+          obj_index,    /* index of an object within a vgroup */
+          num_of_pairs, /* number of tag/ref number pairs, i.e., objects */
+          obj_tag, obj_ref,     /* tag/ref number of an HDF object */
+          vgroup_pos = 0;       /* position of a vgroup in the file */
+
+   /********************** End of variable declaration ***********************/
+
+   /*
+   * Open the HDF file for reading.
+   */
+   file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+
+   /*
+   * Initialize the V interface.
+   */
+   status_n = Vstart (file_id);
+
+   /*
+   * Obtain each vgroup in the file by its reference number, get the
+   * number of objects in the vgroup, and display the information about
+   * that vgroup.
+   */
+   vgroup_ref = -1;        /* set to -1 to search from the beginning of file */
+   while (TRUE)
+   {
+      /*
+      * Get the reference number of the next vgroup in the file.
+      */
+      vgroup_ref = Vgetid (file_id, vgroup_ref);
+
+      /*
+      * Attach to the vgroup for reading or exit the loop if no more vgroups
+      * are found.
+      */
+      if (vgroup_ref == -1) break;
+      vgroup_id = Vattach (file_id, vgroup_ref, "r"); 
+
+      /*
+      * Get the total number of objects in the vgroup.
+      */
+      num_of_pairs = Vntagrefs (vgroup_id);
+
+      /*
+      * If the vgroup contains any object, print the tag/ref number 
+      * pair of each object in the vgroup, in the order they appear in the
+      * file, and indicate whether the object is a vdata, vgroup, or neither.
+      */
+      if (num_of_pairs > 0)
+      {
+         printf ("\nVgroup #%d contains:\n", vgroup_pos);
+         for (obj_index = 0; obj_index < num_of_pairs; obj_index++)
+         {
+            /*
+            * Get the tag/ref number pair of the object specified 
+            * by its index, obj_index, and display them.
+            */
+            status_n = Vgettagref (vgroup_id, obj_index, &obj_tag, &obj_ref);
+            printf ("tag = %d, ref = %d", obj_tag, obj_ref);
+
+            /*
+            * State whether the HDF object referred to by obj_ref is a vdata,
+            * a vgroup, or neither.
+            */
+            if (Visvg (vgroup_id, obj_ref))
+               printf ("  <-- is a vgroup\n");
+            else if (Visvs (vgroup_id, obj_ref))
+               printf ("  <-- is a vdata\n");
+            else
+               printf ("  <-- neither vdata nor vgroup\n");
+         } /* for */
+      } /* if */
+
+      else
+         printf ("Vgroup #%d contains no HDF objects\n", vgroup_pos);
+
+      /*
+      * Terminate access to the current vgroup.
+      */
+      status_32 = Vdetach (vgroup_id);
+
+      /*
+      * Move to the next vgroup position.
+      */
+      vgroup_pos++;
+   } /* while */
+
+   /*
+   * Terminate access to the V interface and close the file.
+   */
+   status_n = Vend (file_id);
+   status_n = Hclose (file_id);
+   return 0;
+}
diff --git a/hdf/examples/run-all-ex.sh b/hdf/examples/run-all-ex.sh
new file mode 100755
index 0000000..8a5e6bf
--- /dev/null
+++ b/hdf/examples/run-all-ex.sh
@@ -0,0 +1,38 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF4.  The full HDF4 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://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have
+# access to either file, you may request a copy from help at hdfgroup.org.
+
+#
+#  This file:  run-all-ex.sh
+# Written by:  Larry Knox
+#       Date:  January 17, 2014
+#
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#                                                                               #
+# This script will run the scripts to compile and run the installed hdf5        #
+# examples.                                                                     #
+#                                                                               #
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+echo "Run c examples"
+if ((cd c; sh ./run-c-ex.sh) && \
+   (if test -d fortran; then   
+       echo "Run fortran examples" 
+       cd fortran; sh ./run-fortran-ex.sh 
+    fi)); then
+   echo "Done"
+   exit 0
+else
+   exit 1
+fi
+
diff --git a/hdf/examples/run-c-ex.sh b/hdf/examples/run-c-ex.sh
new file mode 100644
index 0000000..631682b
--- /dev/null
+++ b/hdf/examples/run-c-ex.sh
@@ -0,0 +1,172 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF4.  The full HDF4 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 HDF4 document set and
+# is linked from the top-level documents page.  It can also be found at
+# http://hdfgroup.org/HDF4/doc/Copyright.html.  If you do not have
+# access to either file, you may request a copy from help at hdfgroup.org.
+
+#
+#  This file:  run-hdf-c-ex.sh
+# Written by:  Larry Knox
+#       Date:  Jan 17, 2014
+#
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#                                                                               #
+# This script will compile and run the c examples from source files installed   #
+# in .../examples/c using h4cc.  The order for running       #
+# programs with RunTest in the MAIN section below is taken from the Makefile.   #
+# The order is important since some of the test programs use data files created #
+# by earlier test programs.  Any future additions should be placed accordingly. #
+#                                                                               #
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+# Initializations
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+ 
+# Where the tool is installed.
+# default is relative path to installed location of the tools 
+prefix="${prefix:-../../}"
+AR="@AR@"
+RANLIB="@RANLIB@"
+H4TOOL="h4cc"               # The tool name
+H4TOOL_BIN="${prefix}/bin/${H4TOOL}"   # The path of the tool binary
+
+#### Run test ####
+RunTest()
+{
+    TEST_EXEC=$1
+    Test=$1".c"
+
+    echo
+    echo "#################  $1  #################"
+    ${H4TOOL_BIN} -o $TEST_EXEC $Test
+    if [ $? -ne 0 ]
+    then
+        echo "messed up compiling $Test"
+        exit 1
+    fi
+    ./$TEST_EXEC
+}
+
+
+
+##################  MAIN  ##################
+
+# Run tests
+if [ $? -eq 0 ]
+then
+    if (
+        #### hdf examples ####    
+        RunTest VD_create_vdatas &&\
+        rm VD_create_vdatas &&\
+        RunTest VD_write_mixed_vdata &&\
+        rm VD_write_mixed_vdata &&\
+        RunTest VD_write_mixed_vdata_struct &&\
+        rm VD_write_mixed_vdata_struct &&\
+        RunTest VD_write_to_vdata &&\
+        rm VD_write_to_vdata &&\
+        RunTest VD_read_from_vdata &&\
+        rm VD_read_from_vdata &&\
+        RunTest VD_read_mixed_vdata &&\
+        rm VD_read_mixed_vdata &&\
+        RunTest VD_set_get_vdata_attr &&\
+        rm VD_set_get_vdata_attr &&\
+        RunTest VD_create_onefield_vdatas &&\
+        rm VD_create_onefield_vdatas &&\
+        RunTest VD_get_vdata_info &&\
+        rm VD_get_vdata_info &&\
+        RunTest VD_locate_vdata &&\
+        rm VD_locate_vdata &&\
+        RunTest VG_create_vgroup &&\
+        rm VG_create_vgroup &&\
+        RunTest VG_add_sds_to_vgroup &&\
+        rm VG_add_sds_to_vgroup &&\
+        RunTest VG_insert_vdatas_to_vgroup &&\
+        rm VG_insert_vdatas_to_vgroup &&\
+        RunTest VG_set_get_vgroup_attr &&\
+        rm VG_set_get_vgroup_attr &&\
+        RunTest VG_vgroup_contents &&\
+        rm VG_vgroup_contents &&\
+        RunTest VG_get_vgroup_info &&\
+        rm VG_get_vgroup_info &&\
+        RunTest GR_create_and_write_image &&\
+        rm GR_create_and_write_image &&\
+        RunTest GR_modify_image &&\
+        rm GR_modify_image &&\
+        RunTest GR_set_attribute &&\
+        rm GR_set_attribute &&\
+        RunTest GR_get_attribute &&\
+        rm GR_get_attribute &&\
+        RunTest GR_write_palette &&\
+        rm GR_write_palette &&\
+        RunTest GR_read_palette &&\
+        rm GR_read_palette &&\
+        RunTest GR_image_info &&\
+        rm GR_image_info &&\
+        RunTest GR_read_image &&\
+        rm GR_read_image &&\
+        RunTest GR_write_chunks &&\
+        rm GR_write_chunks &&\
+        RunTest GR_read_chunks &&\
+        rm GR_read_chunks &&\
+        RunTest AN_create_annotation &&\
+        rm AN_create_annotation &&\
+        RunTest AN_get_annotation_info &&\
+        rm AN_get_annotation_info &&\
+        RunTest AN_read_annotation &&\
+        rm AN_read_annotation &&\
+        #### mfhdf examples ####
+        RunTest SD_create_sds &&\
+        rm SD_create_sds &&\
+        RunTest SD_write_to_sds &&\
+        rm SD_write_to_sds &&\
+        RunTest SD_write_slab &&\
+        rm SD_write_slab &&\
+        RunTest SD_alter_sds_values &&\
+        rm SD_alter_sds_values &&\
+        RunTest SD_unlimited_sds &&\
+        rm SD_unlimited_sds &&\
+        RunTest SD_compress_sds &&\
+        rm SD_compress_sds &&\
+        RunTest SD_mv_sds_to_external &&\
+        rm SD_mv_sds_to_external &&\
+        RunTest SD_read_from_sds &&\
+        rm SD_read_from_sds &&\
+        RunTest SD_read_subsets &&\
+        rm SD_read_subsets &&\
+        RunTest SD_get_info &&\
+        rm SD_get_info &&\
+        RunTest SD_find_sds_by_name &&\
+        rm SD_find_sds_by_name &&\
+        RunTest SD_set_get_dim_info &&\
+        rm SD_set_get_dim_info &&\
+        RunTest SD_dimscale_vs_sds &&\
+        rm SD_dimscale_vs_sds &&\
+        RunTest SD_set_attr &&\
+        rm SD_set_attr &&\
+        RunTest SD_get_attr &&\
+        rm SD_get_attr &&\
+        RunTest SD_chunking_example &&\
+        rm SD_chunking_example
+        ); then
+        EXIT_VALUE=${EXIT_SUCCESS}
+    else
+        EXIT_VALUE=${EXIT_FAILURE}
+    fi
+fi
+
+# Cleanup
+rm *.o
+rm *.hdf
+echo
+
+exit $EXIT_VALUE 
+
diff --git a/hdf/fortran/CMakeLists.txt b/hdf/fortran/CMakeLists.txt
new file mode 100644
index 0000000..c7653bd
--- /dev/null
+++ b/hdf/fortran/CMakeLists.txt
@@ -0,0 +1,123 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_HDF_FORTRAN C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Make sure generated files and modules are picked up correctly
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES ( 
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_HDF_BINARY_DIR}
+)
+  
+SET (HDF4_HDF_SRC_CSTUB_FSRCS
+    ${HDF4_HDFSOURCE_DIR}/dfanf.c
+    ${HDF4_HDFSOURCE_DIR}/dff.c
+    ${HDF4_HDFSOURCE_DIR}/dfpf.c
+    ${HDF4_HDFSOURCE_DIR}/dfr8f.c
+    ${HDF4_HDFSOURCE_DIR}/dfsdf.c
+    ${HDF4_HDFSOURCE_DIR}/dfufp2i.c
+    ${HDF4_HDFSOURCE_DIR}/dfutilf.c
+    ${HDF4_HDFSOURCE_DIR}/df24f.c
+    ${HDF4_HDFSOURCE_DIR}/dfufp2if.c
+    ${HDF4_HDFSOURCE_DIR}/herrf.c
+    ${HDF4_HDFSOURCE_DIR}/hfilef.c
+    ${HDF4_HDFSOURCE_DIR}/mfanf.c
+    ${HDF4_HDFSOURCE_DIR}/mfgrf.c
+    ${HDF4_HDFSOURCE_DIR}/vattrf.c
+    ${HDF4_HDFSOURCE_DIR}/vgf.c
+)
+
+SET (HDF4_HDF_SRC_FHDRS
+    ${HDF4_HDFSOURCE_DIR}/dffunc.inc
+    ${HDF4_HDFSOURCE_DIR}/hdf.inc
+)
+
+SET_SOURCE_FILES_PROPERTIES (${HDF4_HDF_SRC_CSTUB_FSRCS} PROPERTIES LANGUAGE C) 
+
+SET (FORTRAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+#-----------------------------------------------------------------------------
+# Add Main fortran library
+#-----------------------------------------------------------------------------
+ADD_LIBRARY (${HDF4_SRC_FCSTUB_LIB_TARGET} ${LIB_TYPE} ${HDF4_HDF_SRC_CSTUB_FSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h ${HDF4_BINARY_DIR}/h4config.h)
+SET_TARGET_PROPERTIES (${HDF4_SRC_FCSTUB_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C)
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+TARGET_C_PROPERTIES (${HDF4_SRC_FCSTUB_LIB_TARGET} " " " ")
+TARGET_LINK_LIBRARIES (${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_SRC_LIB_TARGET})
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_FCSTUB_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_SRC_FCSTUB_LIB_NAME} ${LIB_TYPE})
+
+SET (HDF4_F_FORTRAN_SRCS 
+    ${HDF4_HDFSOURCE_DIR}/df24ff.f  
+    ${HDF4_HDFSOURCE_DIR}/dfanff.f 
+    ${HDF4_HDFSOURCE_DIR}/dfpff.f 
+    ${HDF4_HDFSOURCE_DIR}/dfr8ff.f
+    ${HDF4_HDFSOURCE_DIR}/dfsdff.f 
+    ${HDF4_HDFSOURCE_DIR}/dfufp2iff.f
+    ${HDF4_HDFSOURCE_DIR}/dfff.f 
+    ${HDF4_HDFSOURCE_DIR}/hfileff.f 
+    ${HDF4_HDFSOURCE_DIR}/mfgrff.f
+    ${HDF4_HDFSOURCE_DIR}/vattrff.f 
+    ${HDF4_HDFSOURCE_DIR}/vgff.f 
+)
+#-----------------------------------------------------------------------------
+ADD_LIBRARY (${HDF4_SRC_FORTRAN_LIB_TARGET} ${LIB_TYPE} ${HDF4_F_FORTRAN_SRCS})
+SET (SHARED_LINK_FLAGS " ")
+IF (WIN32)
+  IF (${LIB_TYPE} MATCHES "SHARED")
+    IF (MSVC)
+      SET (SHARED_LINK_FLAGS "/DLL /DEF:${HDF4_HDF_FORTRAN_SOURCE_DIR}/hdf_fortrandll.def")
+    ENDIF (MSVC)
+  ENDIF (${LIB_TYPE} MATCHES "SHARED")
+ENDIF (WIN32)
+TARGET_FORTRAN_PROPERTIES (${HDF4_SRC_FORTRAN_LIB_TARGET} " " ${SHARED_LINK_FLAGS})
+SET_TARGET_PROPERTIES (${HDF4_SRC_FORTRAN_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
+TARGET_LINK_LIBRARIES (${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_FCSTUB_LIB_TARGET} ${LINK_LIBS})
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_FORTRAN_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_NAME} ${LIB_TYPE})
+  
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+    FILES
+        ${HDF4_HDF_SRC_FHDRS}
+    DESTINATION
+        ${HDF4_INSTALL_INCLUDE_DIR}
+    COMPONENT
+        headers
+)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF4_EXPORTED_TARGETS)
+  IF (BUILD_SHARED_LIBS)
+    INSTALL_TARGET_PDB (${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} fortlibraries)
+    INSTALL_TARGET_PDB (${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} fortlibraries)
+  ENDIF (BUILD_SHARED_LIBS)
+  
+  INSTALL (
+      TARGETS 
+          ${HDF4_SRC_FCSTUB_LIB_TARGET}
+          ${HDF4_SRC_FORTRAN_LIB_TARGET}
+      EXPORT
+          ${HDF4_EXPORTED_TARGETS}
+      LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT fortlibraries 
+      ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT fortlibraries
+      RUNTIME DESTINATION ${HDF4_INSTALL_BIN_DIR} COMPONENT fortlibraries
+  )
+ENDIF (HDF4_EXPORTED_TARGETS)
+    
\ No newline at end of file
diff --git a/hdf/fortran/CMakeTests.cmake b/hdf/fortran/CMakeTests.cmake
new file mode 100644
index 0000000..2d37e05
--- /dev/null
+++ b/hdf/fortran/CMakeTests.cmake
@@ -0,0 +1,115 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+  
+  SET (FORTRAN_SRC_DIR ${HDF4_HDF_TEST_SOURCE_DIR})
+
+  #-----------------------------------------------------------------------------
+  # Add test fortran stub library
+  #-----------------------------------------------------------------------------
+  ADD_LIBRARY (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${LIB_TYPE} ${HDF4_HDF_TESTSOURCE_DIR}/forsupf.c)
+  SET_TARGET_PROPERTIES (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DDOS_FS)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  TARGET_C_PROPERTIES (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} " " " ")
+  TARGET_LINK_LIBRARIES (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${HDF4_SRC_LIB_TARGET})
+  H4_SET_LIB_OPTIONS (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET}  ${HDF4_HDF_TEST_FCSTUB_LIB_NAME} ${LIB_TYPE})
+  
+  #-- Adding test for fortest
+  ADD_EXECUTABLE (fortest ${HDF4_HDF_TESTSOURCE_DIR}/fortest.c)
+  TARGET_NAMING (fortest ${LIB_TYPE})
+  TARGET_C_PROPERTIES (fortest " " " ")
+  TARGET_LINK_LIBRARIES (fortest ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_LIB_TARGET})
+  IF (WIN32 AND MSVC)
+    TARGET_LINK_LIBRARIES (fortest "ws2_32.lib")
+  ENDIF (WIN32 AND MSVC)
+  SET_TARGET_PROPERTIES (fortest PROPERTIES LINKER_LANGUAGE C)
+
+  #-----------------------------------------------------------------------------
+  #-- Adding test for fortestF
+  SET (FORTEST_FSRCS 
+      ${HDF4_HDF_TESTSOURCE_DIR}/fortestF.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/forsupff.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/manf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/mgrf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/slabwf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/t24f.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tanf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tanfilef.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tpf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tr8f.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tsdmmsf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tsdnmmsf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tsdnntf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tsdntf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tsdstrf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tstubsf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tvattrf.f
+      ${HDF4_HDF_TESTSOURCE_DIR}/tvsetf.f
+  )
+
+  ADD_EXECUTABLE (fortestF ${FORTEST_FSRCS} )
+  TARGET_NAMING (fortestF ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (fortestF " " " ")
+  TARGET_LINK_LIBRARIES (fortestF ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} )
+  SET_TARGET_PROPERTIES (fortestF PROPERTIES LINKER_LANGUAGE Fortran)
+
+  #-- Copy all the dat files from the test directory into the source directory
+  SET (HDF4_REFERENCE_TEST_FILES
+    8bit.dat
+    bitio.dat
+    gr_r24.dat
+    greyjpeg.dat
+    jpeg.dat
+    litend.dat
+    nbit.dat
+    tmgr.dat
+    tvattr.dat
+  )
+  FOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/test_files/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_TESTSOURCE_DIR}/test_files/${h4_file} to ${PROJECT_BINARY_DIR}/test_files/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     fortestF 
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_TESTSOURCE_DIR}/test_files/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME HDF_FORTRAN-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          fortest.arg
+          Fortran_err.dat
+          GRcompressed.hdf
+          GRchunked1.hdf
+          GRchunked2.hdf
+          manf.hdf
+          slab1wf.hdf
+          slab4wf.hdf
+          slabwf.hdf
+          tdf24f.hdf
+          tdfanF.hdf
+          tdfanflF.hdf
+          tmgrf.hdf
+  )
+
+  ADD_TEST (NAME fortest COMMAND $<TARGET_FILE:fortest>)
+
+  ADD_TEST (NAME fortestF COMMAND $<TARGET_FILE:fortestF>)
+  SET (passRegex "All Fortran Interface Tests Passed")
+  SET_PROPERTY (TEST fortestF PROPERTY PASS_REGULAR_EXPRESSION "${passRegex}")
+    
\ No newline at end of file
diff --git a/hdf/fortran/Makefile.am b/hdf/fortran/Makefile.am
new file mode 100644
index 0000000..1d63ec7
--- /dev/null
+++ b/hdf/fortran/Makefile.am
@@ -0,0 +1,20 @@
+include $(top_srcdir)/config/commence.am
+
+DIST_SUBDIRS = examples
+
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples; do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
diff --git a/hdf/fortran/Makefile.in b/hdf/fortran/Makefile.in
new file mode 100644
index 0000000..61961fe
--- /dev/null
+++ b/hdf/fortran/Makefile.in
@@ -0,0 +1,641 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am
+subdir = hdf/fortran
+SUBDIRS =
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+DIST_SUBDIRS = examples
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/fortran/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign hdf/fortran/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+cscopelist-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+		am__skip_mode_fix=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+	cscopelist-recursive ctags-recursive install-am install-strip \
+	tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	cscopelist cscopelist-recursive ctags ctags-recursive \
+	distclean distclean-generic distclean-libtool distclean-tags \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installcheck-local \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples; do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdf/fortran/examples/AN_create_annotation.f b/hdf/fortran/examples/AN_create_annotation.f
new file mode 100644
index 0000000..16cce27
--- /dev/null
+++ b/hdf/fortran/examples/AN_create_annotation.f
@@ -0,0 +1,125 @@
+      program create_annotation
+      implicit none
+C
+C     Parameter declaration
+C
+      character*22 FILE_NAME
+      character*9  VG_NAME
+      character*19 FILE_LABEL_TXT
+      character*53 FILE_DESC_TXT
+      character*16 DATA_LABEL_TXT
+      character*54 DATA_DESC_TXT
+C
+      parameter (FILE_NAME      = 'General_HDFobjects.hdf',
+     +           VG_NAME        = 'AN Vgroup',
+     +           FILE_LABEL_TXT = 'General HDF objects',
+     +           DATA_LABEL_TXT = 'Common AN Vgroup',
+     +           FILE_DESC_TXT  = 
+     + 'This is an HDF file that contains general HDF objects',
+     +           DATA_DESC_TXT  = 
+     + 'This is a vgroup that is used to test data annotations')
+      integer DFACC_CREATE
+      parameter (DFACC_CREATE = 4)
+      integer AN_FILE_LABEL, AN_FILE_DESC, AN_DATA_LABEL, AN_DATA_DESC
+      parameter (AN_FILE_LABEL = 2,
+     +           AN_FILE_DESC  = 3,
+     +           AN_DATA_LABEL = 0,
+     +           AN_DATA_DESC  = 1)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer afstart, affcreate, afwriteann, afcreate,
+     +        afendaccess, afend
+      integer vfstart, vfatch, vfsnam, vqref, vqtag, vfdtch, vfend
+
+C
+C**** Variable declaration ******************************************* 
+C
+      integer status
+      integer file_id, an_id
+      integer file_label_id, file_desc_id
+      integer data_label_id, data_desc_id
+      integer vgroup_id, vgroup_tag, vgroup_ref
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Create the HDF file.
+C
+      file_id = hopen(FILE_NAME, DFACC_CREATE, 0)
+C
+C     Initialize the AN interface.
+C
+      an_id = afstart(file_id)
+C
+C     Create the file label.
+C
+      file_label_id = affcreate(an_id, AN_FILE_LABEL)
+C
+C     Write the annotation to the file label.
+C
+      status = afwriteann(file_label_id, FILE_LABEL_TXT,
+     +                    len(FILE_LABEL_TXT))       
+C
+C     Create file description.
+C
+      file_desc_id = affcreate(an_id, AN_FILE_DESC)
+C
+C     Write the annotation to the file description.
+C
+      status = afwriteann(file_desc_id, FILE_DESC_TXT,
+     +                    len(FILE_DESC_TXT))
+C
+C     Create a vgroup in the file. Note that the vgroup's ref number is
+C     set to -1 for creating and the access mode is 'w' for writing.
+C
+      status    = vfstart(file_id)
+      vgroup_id = vfatch(file_id, -1, 'w')
+      status    = vfsnam(vgroup_id, VG_NAME)      
+C
+C     Obtain the tag and reference number of the vgroup for subsequent
+C     references.
+C
+      vgroup_ref = vqref(vgroup_id)
+      vgroup_tag = vqtag(vgroup_id)
+C
+C     Create the data label for the vgroup identified by its tag and ref 
+C     number.
+C
+      data_label_id = afcreate(an_id, vgroup_tag, vgroup_ref,
+     +                          AN_DATA_LABEL)
+C
+C     Write the annotation text to the data label.
+C
+      status = afwriteann(data_label_id, DATA_LABEL_TXT, 
+     +                    len(DATA_LABEL_TXT))
+      
+C
+C     Create the data description for the vgroup identified by its tag and ref.
+C
+      data_desc_id = afcreate(an_id, vgroup_tag, vgroup_ref, 
+     +                        AN_DATA_DESC)
+C
+C     Write the annotation text to the data description.
+C
+      status = afwriteann(data_desc_id, DATA_DESC_TXT,
+     +                    len(DATA_DESC_TXT))       
+C      
+C     Terminate access to the vgroup and to the V interface.
+C
+      status = vfdtch(vgroup_id)
+      status = vfend(file_id)
+C
+C     Terminate access to each annotation explicitly.
+C
+      status = afendaccess(file_label_id)
+      status = afendaccess(file_desc_id)
+      status = afendaccess(data_label_id)
+      status = afendaccess(data_desc_id)
+C
+C     Terminate access to the AN interface and close the HDF file.
+C
+      status = afend(an_id)
+      status = hclose(file_id)
+      end 
diff --git a/hdf/fortran/examples/AN_get_annotation_info.f b/hdf/fortran/examples/AN_get_annotation_info.f
new file mode 100644
index 0000000..ea72148
--- /dev/null
+++ b/hdf/fortran/examples/AN_get_annotation_info.f
@@ -0,0 +1,121 @@
+      program annotation_info
+      implicit none
+C
+C     Parameter declaration
+C
+      character*22 FILE_NAME
+      character*9  VG_NAME
+C
+      parameter (FILE_NAME      = 'General_HDFobjects.hdf',
+     +           VG_NAME        = 'AN Vgroup')
+      integer    DFACC_READ
+      parameter (DFACC_READ = 1)
+      integer AN_FILE_LABEL, AN_DATA_LABEL, AN_DATA_DESC
+      parameter (AN_FILE_LABEL = 2,
+     +           AN_DATA_LABEL = 0,
+     +           AN_DATA_DESC  = 1)
+      integer DFTAG_DIA, DFTAG_FID, DFTAG_DIL
+      parameter (DFTAG_DIA = 105,
+     +           DFTAG_FID = 100,
+     +           DFTAG_DIL = 104)
+      integer DFTAG_VG
+      parameter (DFTAG_VG = 1965)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer afstart, afnumann, afannlist, afidtagref, aftagatype,
+     +        afatypetag, afend
+      integer vfstart, vfind 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id, an_id
+      integer n_annots, ann_index, annot_type, ann_tag, ann_ref
+      integer ann_list(10) 
+      integer vgroup_tag, vgroup_ref
+C
+C**** End of variable declaration ************************************
+C
+      annot_type = AN_DATA_DESC
+      vgroup_tag = DFTAG_VG
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the V interface.
+C
+      status = vfstart(file_id)
+C
+C     Get the group named VG_NAME.
+C
+      vgroup_ref = vfind(file_id, VG_NAME)
+C
+C     Initialize the AN interface.
+C
+      an_id = afstart(file_id)
+
+C
+C     Get the number of object descriptions. 
+C
+      if (vgroup_ref .eq. -1) goto 100 
+      n_annots = afnumann(an_id, annot_type, vgroup_tag, vgroup_ref)
+C
+C     Get the list of identifiers of the annotations attached to the
+C     vgroup and of type annot_type. Identifiers are read into ann_list
+C     buffer. One has to make sure that ann_list has the size big enough
+C     to hold the list of identifiers.
+C
+      n_annots = afannlist(an_id, annot_type, vgroup_tag, vgroup_ref,
+     +                     ann_list)
+C
+C     Get each annotation identifier from the list then display the
+C     tag/ref number pair of the corresponding annotation.
+C
+      write(*,*) 'List of annotations of type AN_DATA_DESC'
+      do 10 ann_index = 0, n_annots - 1
+C
+C     Get and display the ref number of the annotation from its
+C     identifier.
+C
+      status = afidtagref(ann_list(ann_index+1), ann_tag, ann_ref) 
+      write(*,*) 'Annotation index: ', ann_index
+      if (ann_tag .eq. DFTAG_DIA) then
+          write(*,*) 'tag = DFTAG_DIA (data description)'
+      else
+          write(*,*) ' tag = Incorrect'
+      endif
+      write(*,*) 'reference number = ', ann_ref
+10    continue
+C
+C     Get and display an annotation type from an annotation tag.
+C
+      annot_type = aftagatype(DFTAG_FID)
+      if (annot_type .eq. AN_FILE_LABEL) then
+         write(*,*) 'Annotation type of DFTAG_FID (file label) is ',
+     +               'AN_FILE_LABEL '
+      else
+         write(*,*) 'Annotation type of DFTAG_FID (file label) is ',
+     +               'Incorrect'
+      endif   
+C
+C     Get and display an annotation tag from an annotation type.
+C
+      ann_tag = afatypetag(AN_DATA_LABEL)
+      if (ann_tag .eq. DFTAG_DIL ) then
+         write(*,*) 'Annotation tag of AN_DATA_LABEL is ',
+     +               'DFTAG_DIL (data label)'
+      else
+         write(*,*) 'Annotation type of DFTAG_FID (file label) is ',
+     +               'Incorrect'
+      endif   
+C
+C     Terminate access to the AN interface and close the HDF file.
+C
+100   continue
+      status = afend(an_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/AN_read_annotation.f b/hdf/fortran/examples/AN_read_annotation.f
new file mode 100644
index 0000000..6f4f49f
--- /dev/null
+++ b/hdf/fortran/examples/AN_read_annotation.f
@@ -0,0 +1,82 @@
+      program  read_annotation
+      implicit none
+C
+C     Parameter declaration
+C
+      character*22 FILE_NAME
+C
+      parameter (FILE_NAME = 'General_HDFobjects.hdf')
+      integer    DFACC_READ
+      parameter (DFACC_READ = 1)
+      integer    AN_DATA_LABEL
+      parameter (AN_DATA_LABEL = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer afstart, affileinfo, afselect, afannlen, afreadann,
+     +        afendaccess, afend
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id, an_id, ann_id
+      integer index, ann_length 
+      integer n_file_labels, n_file_descs, n_data_labels, n_data_descs 
+      character*256 ann_buf 
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the AN interface.
+C
+      an_id = afstart(file_id)
+C
+C     Get the annotation information, i.e., the number of file labels,
+C     file descriptions, data labels, and data descriptions.
+C
+      status = affileinfo(an_id, n_file_labels, n_file_descs,
+     +                    n_data_labels, n_data_descs)
+C
+C     Get the data labels. Note that this DO loop can be used to obtain 
+C     the contents of each kind of annotation with the appropriate number
+C     of annotations and the type of annotation, i.e., replace
+C     n_data_labels with n_file_labels, n_files_descs, or n_data_descs, and
+C     AN_DATA_LABEL with AN_FILE_LABEL, AN_FILE_DESC, or AN_DATA_DESC, 
+C     respectively.
+C
+      do 10 index = 0, n_data_labels-1
+C
+C     Get the identifier of the current data label.
+C
+      ann_id = afselect(an_id, index, AN_DATA_LABEL)
+C
+C     Get the length of the data label.
+C
+      ann_length = afannlen(ann_id)
+C
+C     Read and display the data label. The data label is read into buffer
+C     ann_buf. One has to make sure that ann_buf has sufficient size to hold
+C     the data label. Also note, that the third argument to afreadann is 
+C     1 greater that the actual length of the data label (see comment to
+C     C example).
+C
+      status = afreadann(ann_id, ann_buf, ann_length+1) 
+      write(*,*) 'Data label index: ', index
+      write(*,*) 'Data label contents: ', ann_buf(1:ann_length) 
+10    continue
+C
+C     Terminate access to the current data label.
+C
+      status = afendaccess(ann_id)  
+C
+C     Terminate access to the AN interface and close the HDF file.
+C
+      status = afend(an_id)
+      status = hclose(file_id)
+      end
+
diff --git a/hdf/fortran/examples/CMakeLists.txt b/hdf/fortran/examples/CMakeLists.txt
new file mode 100644
index 0000000..86be112
--- /dev/null
+++ b/hdf/fortran/examples/CMakeLists.txt
@@ -0,0 +1,94 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_HDF_FORTRAN_EXAMPLES C CXX Fortran)
+# --------------------------------------------------------------------
+# Notes: When creating examples they should be prefixed
+# with "f_ex_". This allows for easier filtering of the examples.
+# --------------------------------------------------------------------
+
+#-----------------------------------------------------------------------------
+# Add debug information (intel Fortran : JB)
+#-----------------------------------------------------------------------------
+IF (CMAKE_Fortran_COMPILER MATCHES ifort)
+  IF (WIN32)
+    SET (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
+    SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
+  ENDIF (WIN32)
+ENDIF (CMAKE_Fortran_COMPILER MATCHES ifort)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_HDF_BINARY_DIR}
+    ${HDF4_HDFSOURCE_DIR}
+)
+LINK_DIRECTORIES (
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_HDF_BINARY_DIR}
+    ${HDF4_MFHDF_BINARY_DIR}
+    ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (examples
+    VD_create_vdatas 
+    VD_write_mixed_vdata
+    VD_write_to_vdata 
+    VD_create_onefield_vdatas
+    VD_read_from_vdata 
+    VD_read_mixed_vdata
+    VD_get_vdata_info 
+    VD_locate_vdata 
+    VG_create_vgroup
+    #VG_add_sds_to_vgroup
+    VG_insert_vdatas_to_vgroup
+    VG_set_get_vgroup_attr 
+    VG_vgroup_contents
+    VG_get_vgroup_info 
+    GR_create_and_write_image
+    GR_modify_image 
+    GR_set_attribute 
+    GR_get_attribute
+    GR_write_palette 
+    GR_image_info 
+    GR_read_image
+    AN_create_annotation 
+    AN_get_annotation_info 
+    AN_read_annotation
+    #VD_set_get_vdata_attr
+)
+SET (mf_examples
+    VG_add_sds_to_vgroup
+)
+SET (skip_examples
+    VD_set_get_vdata_attr
+)
+
+FOREACH (example ${examples})
+  ADD_EXECUTABLE (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
+  TARGET_NAMING (f_ex_${example} ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (f_ex_${example} " " " ")
+  SET_TARGET_PROPERTIES (f_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+  TARGET_LINK_LIBRARIES (f_ex_${example} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDFOREACH (example ${examples})
+
+ADD_EXECUTABLE (f_ex_VG_add_sds_to_vgroup ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.f)
+TARGET_NAMING (f_ex_VG_add_sds_to_vgroup ${LIB_TYPE})
+TARGET_FORTRAN_PROPERTIES (f_ex_VG_add_sds_to_vgroup " " " ")
+SET_TARGET_PROPERTIES (f_ex_VG_add_sds_to_vgroup PROPERTIES LINKER_LANGUAGE Fortran)
+TARGET_LINK_LIBRARIES (f_ex_VG_add_sds_to_vgroup ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+FOREACH (example ${skip_examples})
+  ADD_EXECUTABLE (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
+  TARGET_NAMING (f_ex_${example} ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (f_ex_${example} " " " ")
+  SET_TARGET_PROPERTIES (f_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+  TARGET_LINK_LIBRARIES (f_ex_${example} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDFOREACH (example ${skip_examples})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
diff --git a/hdf/fortran/examples/CMakeTests.cmake b/hdf/fortran/examples/CMakeTests.cmake
new file mode 100644
index 0000000..bb44f8d
--- /dev/null
+++ b/hdf/fortran/examples/CMakeTests.cmake
@@ -0,0 +1,49 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME HDF_FORTRAN_EXAMPLES-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        General_HDFobjects.hdf
+        General_RImages.hdf
+        General_Vdatas.hdf
+        General_Vgroups.hdf
+        Image_with_Palette.hdf
+        Packed_Vdata.hdf
+        Two_Vdatas.hdf
+        Two_Vgroups.hdf
+)
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (HDF_FORTRAN_EXAMPLES-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (HDF_FORTRAN_EXAMPLES-clearall-objects PROPERTIES LABELS EXAMPLES)
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "HDF_FORTRAN_EXAMPLES-clearall-objects")
+
+FOREACH (example ${examples})
+  ADD_TEST (NAME f_extest_${example} COMMAND $<TARGET_FILE:f_ex_${example}>)
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (f_extest_${example} PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (f_extest_${example} PROPERTIES LABELS EXAMPLES)
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "f_extest_${example}")
+ENDFOREACH (example ${examples})
+
+ADD_TEST (NAME f_extest_VG_add_sds_to_vgroup COMMAND $<TARGET_FILE:f_ex_VG_add_sds_to_vgroup>)
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (f_extest_VG_add_sds_to_vgroup PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (f_extest_VG_add_sds_to_vgroup PROPERTIES LABELS EXAMPLES)
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "f_extest_VG_add_sds_to_vgroup")
+
+FOREACH (example ${skip_examples})
+  ADD_TEST (NAME f_extest_${example} COMMAND ${CMAKE_COMMAND} -E echo "SKIP f_extest_${example}")
+ENDFOREACH (example ${skip_examples})
diff --git a/hdf/fortran/examples/GR_create_and_write_image.f b/hdf/fortran/examples/GR_create_and_write_image.f
new file mode 100644
index 0000000..9fed2db
--- /dev/null
+++ b/hdf/fortran/examples/GR_create_and_write_image.f
@@ -0,0 +1,92 @@
+      program create_raster_image
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      character*13 IMAGE_NAME
+      integer      X_LENGTH
+      integer      Y_LENGTH
+      integer      N_COMPS
+C
+      parameter (FILE_NAME  = 'General_RImages.hdf',
+     +           IMAGE_NAME = 'Image Array 1',
+     +           X_LENGTH   = 10,
+     +           Y_LENGTH   = 5,
+     +           N_COMPS    = 2)
+      integer DFACC_CREATE, DFNT_INT16, MFGR_INTERLACE_PIXEL
+      parameter (DFACC_CREATE = 4,
+     +           DFNT_INT16   = 22,
+     +           MFGR_INTERLACE_PIXEL = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgcreat, mgwrimg, mgendac, mgend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer gr_id, ri_id, num_type, interlace_mode
+      integer start(2), stride(2), edges(2), dimsizes(2)
+      integer i, j, k
+      integer*2  image_buf(N_COMPS, X_LENGTH, Y_LENGTH) 
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Create and open the file.
+C
+      file_id = hopen(FILE_NAME, DFACC_CREATE, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Set the number type, interlace mode, and dimensions of the image.  
+C
+      num_type = DFNT_INT16
+      interlace_mode = MFGR_INTERLACE_PIXEL
+      dimsizes(1) = X_LENGTH
+      dimsizes(2) = Y_lENGTH
+C
+C     Create the raster image array. 
+C
+      ri_id = mgcreat(gr_id, IMAGE_NAME, N_COMPS, num_type,
+     +                interlace_mode, dimsizes)
+C
+C     Fill the image data buffer with values. 
+C
+      do 30 i = 1, Y_LENGTH
+         do 20 j = 1, X_LENGTH
+            do 10 k = 1, N_COMPS
+               image_buf(k,j,i) = (i+j) - 1
+10          continue
+20       continue
+30    continue
+
+C     
+C     Define the size of the data to be written, i.e., start from the origin
+C     and go as long as the length of each dimension.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Write the data in the buffer into the image array.
+C
+      status = mgwrimg(ri_id, start, stride, edges, image_buf)
+
+C
+C     Terminate access to the raster image and to the GR interface, 
+C     and close the HDF file.
+C
+      status = mgendac(ri_id)
+      status = mgend(gr_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/GR_get_attribute.f b/hdf/fortran/examples/GR_get_attribute.f
new file mode 100644
index 0000000..061c52d
--- /dev/null
+++ b/hdf/fortran/examples/GR_get_attribute.f
@@ -0,0 +1,99 @@
+      program  get_attribute
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      character*17 RI_ATTR_NAME
+C
+      parameter (FILE_NAME    = 'General_RImages.hdf',
+     +           RI_ATTR_NAME  = 'Image Attribute 2')
+      integer DFACC_READ, DFNT_INT16, DFNT_CHAR8
+      parameter (DFACC_READ   = 1,
+     +           DFNT_CHAR8   = 4,
+     +           DFNT_INT16   = 22)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgfinfo, mgatinf, mggcatt, mggnatt , mgfndat,
+     +        mgselct, mgendac, mgend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer      status
+      integer      file_id, gr_id, ri_id
+      integer      f_att_index, ri_att_index, data_type, n_values 
+      integer      n_rimages, n_file_attrs 
+      integer*2    int_buf(10)
+      character*17 attr_name
+      character*80 char_buf
+      integer      i
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Determine the number of attributes in the file. 
+C
+      status = mgfinfo(gr_id, n_rimages, n_file_attrs)
+      if ((status .NE. -1) .AND. (n_file_attrs .GT. 0)) then
+
+         do 10 f_att_index = 0, n_file_attrs-1
+C
+C        Get information about the current file attribute.
+C 
+         status = mgatinf(gr_id, f_att_index, attr_name, data_type,
+     +                    n_values)
+C
+C        Check whether data type is DFNT_CHAR8 in order to use allocated buffer.
+C
+         if(data_type .NE. DFNT_CHAR8) then
+            write(*,*) 
+     +      'Unable to determine data type to use allocated buffer'
+         else
+C
+C           Read and display the attribute values.
+C
+            status = mggcatt(gr_id, f_att_index, char_buf)
+            write(*,*) 'Attribute ', attr_name, ' : ', 
+     +                 char_buf(1:n_values)
+         endif
+10       continue
+
+      endif
+
+C
+C     Select the second image in the file.
+C 
+      ri_id = mgselct(gr_id, 1) 
+C
+C     Find the image attribute named RI_ATTR_NAME. 
+C
+      ri_att_index = mgfndat(ri_id, RI_ATTR_NAME)
+C
+C     Get information about the attribute.
+C
+      status = mgatinf(ri_id, ri_att_index, attr_name, data_type,
+     +                 n_values)
+C      
+C     Read and display attribute values.
+C
+      status = mggnatt(ri_id, ri_att_index, int_buf)
+      write(*,*) 'Attributes :', (int_buf(i), i = 1, n_values)
+C
+C     Terminate access to the image and to the GR interface,
+C     and close the HDF file.
+C
+      status = mgendac(ri_id)
+      status = mgend(gr_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/GR_image_info.f b/hdf/fortran/examples/GR_image_info.f
new file mode 100644
index 0000000..c0fb436
--- /dev/null
+++ b/hdf/fortran/examples/GR_image_info.f
@@ -0,0 +1,90 @@
+      program image_info
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+C
+      parameter (FILE_NAME = 'General_RImages.hdf')
+      integer DFACC_READ
+      parameter (DFACC_READ = 1)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgselct, mgfinfo, mggiinf, mgendac, mgend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id, gr_id, ri_id
+      integer n_rimages, n_file_attrs, ri_index
+      integer n_comps, interlace_mode, n_attrs, data_type
+      integer dim_sizes(2)
+      character*10 type_string
+      character*24 interlace_string
+      character*64 name
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Determine the contents of the file.
+C
+      status = mgfinfo(gr_id, n_rimages, n_file_attrs)
+C
+C     For each image in the file, get and display image information.
+C
+      do 100 ri_index = 0, n_rimages-1
+         ri_id = mgselct(gr_id, ri_index)
+         status = mggiinf(ri_id, name, n_comps, data_type,
+     +                    interlace_mode, dim_sizes, n_attrs)
+C
+C     Map the number type and interlace mode into text strings for
+C     output readability.
+C
+      if(data_type .eq. 4) then
+         type_string = 'DFNT_CHAR8'
+      else if(data_type .eq. 22) then
+         type_string = 'DFNT_INT16'
+      else
+         type_string = 'Unknown'
+      endif
+      if (interlace_mode .eq. 0) then
+          interlace_string = 'MFGR_INTERLACE_PIXEL'
+      else if(interlace_mode .eq. 1) then
+          interlace_string = 'MFGR_INTERLACE_LINE'
+      else if(interlace_mode .eq. 2) then
+          interlace_string = 'MFGR_INTERLACE_COMPONENT'
+      else
+         interlace_string = 'Unknown'
+      endif
+C
+C     Display the image information for the current image.
+C
+      write(*,*) 'Image index: ', ri_index
+      write(*,*) 'Image name: ', name 
+      write(*,*) 'Number of components: ', n_comps
+      write(*,*) 'Number type: ', type_string 
+      write(*,*) 'Interlace mode: ', interlace_string
+      write(*,*) 'Dimnesions: ', dim_sizes(1), dim_sizes(2)
+      write(*,*) 'Number of image attributes: ', n_attrs
+      write(*,*) 
+C
+C     Terminate access to the current raster image.
+C
+      status = mgendac(ri_id)
+100   continue
+C
+C     Terminate access to the GR interface and close the HDF file.
+      status = mgend(gr_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/GR_modify_image.f b/hdf/fortran/examples/GR_modify_image.f
new file mode 100644
index 0000000..684b1c2
--- /dev/null
+++ b/hdf/fortran/examples/GR_modify_image.f
@@ -0,0 +1,133 @@
+      program modify_image
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      character*13 IMAGE1_NAME
+      integer      X1_LENGTH
+      integer      Y1_LENGTH
+      integer      N1_COMPS
+      character*13 IMAGE2_NAME
+      integer      X2_LENGTH
+      integer      Y2_LENGTH
+      integer      N2_COMPS
+C
+      parameter (FILE_NAME   = 'General_RImages.hdf',
+     +           IMAGE1_NAME = 'Image Array 1',
+     +           IMAGE2_NAME = 'Image Array 2',
+     +           X1_LENGTH   = 5,
+     +           Y1_LENGTH   = 2,
+     +           N1_COMPS    = 2,
+     +           X2_LENGTH   = 6,
+     +           Y2_LENGTH   = 4,
+     +           N2_COMPS    = 3)
+      integer DFACC_WRITE, DFNT_INT16, DFNT_CHAR8,
+     +        MFGR_INTERLACE_PIXEL
+      parameter (DFACC_WRITE  = 2,
+     +           DFNT_CHAR8   = 4,
+     +           DFNT_INT16   = 22,
+     +           MFGR_INTERLACE_PIXEL = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgselct, mgcreat, mgwrimg, mgendac, mgend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer gr_id, ri1_id, ri2_id, data_type, interlace_mode
+      integer start1(2), stride1(2), edges1(2)
+      integer start2(2), stride2(2), edges2(2), dim_sizes(2)
+      integer i, j, k
+      integer*2  image1_buf(N1_COMPS, X1_LENGTH, Y1_LENGTH) 
+      character  image2_buf(N2_COMPS, X2_LENGTH, Y2_LENGTH)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Select the first raster image in the file.
+C
+      ri1_id = mgselct(gr_id, 0)
+C
+C     Fill the buffer with values.
+C
+      do 20 i = 1, Y1_LENGTH
+         do 10 j = 1, X1_LENGTH
+               image1_buf(1,j,i) = 0 
+               image1_buf(2,j,i) = 0 
+10       continue
+20    continue
+C
+C     Define the part of the data in the first image that will be overwritten
+C     with the new values from image1_buf.
+C
+      start1(1) = 0
+      start1(2) = 0
+      edges1(1) = X1_LENGTH
+      edges1(2) = Y1_LENGTH
+      stride1(1) = 1
+      stride1(2) = 1
+C
+C     Write the data in the buffer into the image array.
+C
+      status = mgwrimg(ri1_id, start1, stride1, edges1, image1_buf)
+
+C
+C     Set the number type, interlace mode, and dimensions of the second image.  
+C
+      data_type = DFNT_CHAR8
+      interlace_mode = MFGR_INTERLACE_PIXEL
+      dim_sizes(1) = X2_LENGTH
+      dim_sizes(2) = Y2_LENGTH
+C
+C     Create the second image in the file.
+C
+      ri2_id = mgcreat(gr_id, IMAGE2_NAME, N2_COMPS, data_type,
+     +                interlace_mode, dim_sizes)
+C
+C     Fill the image data buffer with values. 
+C
+      do 60 i = 1, Y2_LENGTH 
+         do 50 j = 1, X2_LENGTH
+            do 40 k = 1, N2_COMPS 
+               image2_buf(k,j,i) = char(65 + k - 1) 
+40          continue
+50       continue
+60    continue
+
+C     
+C     Define the size of the data to be written, i.e., start from the origin
+C     and go as long as the length of each dimension.
+C
+      start2(1) = 0
+      start2(2) = 0
+      edges2(1) =  dim_sizes(1)
+      edges2(2) =  dim_sizes(2) 
+      stride2(1) = 1
+      stride2(2) = 1
+C
+C     Write the data in the buffer into the image array.
+C
+      status = mgwrimg(ri2_id, start2, stride2, edges2, image2_buf)
+
+C
+C     Terminate access to the raster images and to the GR interface,
+C     and close the HDF file.
+C
+      status = mgendac(ri1_id)
+      status = mgendac(ri2_id)
+      status = mgend(gr_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/GR_read_image.f b/hdf/fortran/examples/GR_read_image.f
new file mode 100644
index 0000000..fccbfe5
--- /dev/null
+++ b/hdf/fortran/examples/GR_read_image.f
@@ -0,0 +1,136 @@
+      program read_raster_image
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      integer      X_LENGTH
+      integer      Y_LENGTH
+      integer      N_COMPS
+C
+      parameter (FILE_NAME  = 'General_RImages.hdf',
+     +           X_LENGTH   = 10,
+     +           Y_LENGTH   = 5,
+     +           N_COMPS    = 2)
+      integer PART_COLS, PART_ROWS, SKIP_COLS, SKIP_ROWS
+      integer COLS_PART_START, ROWS_PART_START
+      integer COLS_SKIP_START, ROWS_SKIP_START
+      integer N_STRIDES
+      parameter (PART_COLS = 3, PART_ROWS = 2,
+     +           SKIP_COLS = 3, SKIP_ROWS = 5,
+     +           COLS_PART_START = 1, ROWS_PART_START = 3,
+     +           COLS_SKIP_START = 0, ROWS_SKIP_START = 1,
+     +           N_STRIDES = 2)
+      integer DFACC_READ
+      parameter (DFACC_READ = 1)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgselct, mgrdimg, mgendac, mgend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer gr_id, ri_id
+      integer start(2), stride(2), edges(2)
+      integer i, j
+      integer*2  entire_image(N_COMPS, X_LENGTH, Y_LENGTH) 
+      integer*2  partial_image(N_COMPS, PART_ROWS, PART_COLS) 
+      integer*2  skipped_image(N_COMPS, SKIP_ROWS, SKIP_COLS) 
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Select the first raster image in the file.
+C
+      ri_id = mgselct(gr_id, 0)
+C     
+C     Define the size of the data to be read, i.e., start from the origin
+C     and go as long as the length of each dimension.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Read the data from the raster image array. 
+C
+      status = mgrdimg(ri_id, start, stride, edges, entire_image)
+C
+C     Display only the first component of the image since the two components
+C     have the same data in this example.
+C
+      write(*,*) 'First component of the entire image'
+      write(*,*)
+      do 10 i = 1, X_LENGTH
+         write(*,1000) (entire_image(1,i,j), j = 1, Y_LENGTH)
+10    continue
+      write(*,*)
+C
+C     Define the size of the data to be read.
+C
+      start(1) = ROWS_PART_START
+      start(2) = COLS_PART_START 
+      edges(1) = PART_ROWS 
+      edges(2) = PART_COLS 
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Read a subset of the raster image array. 
+C
+      status = mgrdimg(ri_id, start, stride, edges, partial_image)
+C
+C     Display only the first component of the read sample. 
+C
+      write(*,*)
+     +  'Two rows and three columns at 4th row and 2nd column',
+     +  ' of the first component'
+      write(*,*)
+      do 20 i = 1, PART_ROWS
+         write(*,1000) (partial_image(1,i,j), j = 1, PART_COLS)
+20    continue
+      write(*,*)
+C
+C     Define the size and the pattern to read the data.
+C
+      start(1) = ROWS_SKIP_START
+      start(2) = COLS_SKIP_START 
+      edges(1) = SKIP_ROWS 
+      edges(2) = SKIP_COLS 
+      stride(1) = N_STRIDES 
+      stride(2) = N_STRIDES 
+C
+C     Read all the odd rows and even columns of the image.
+C
+      status = mgrdimg(ri_id, start, stride, edges, skipped_image)
+C
+C     Display only the first component of the read sample. 
+C
+      write(*,*) 'All even rows and odd columns of the first component'
+      write(*,*)
+      do 30 i = 1, SKIP_ROWS
+         write(*,1000) (skipped_image(1,i,j), j = 1, SKIP_COLS)
+30    continue
+      write(*,*)
+C
+C     Terminate access to the raster image and to the GR interface, 
+C     and close the HDF file.
+C
+      status = mgendac(ri_id)
+      status = mgend(gr_id)
+      status = hclose(file_id)
+1000  format(1x, 5(I4))
+      end
diff --git a/hdf/fortran/examples/GR_read_palette.f b/hdf/fortran/examples/GR_read_palette.f
new file mode 100644
index 0000000..0120480
--- /dev/null
+++ b/hdf/fortran/examples/GR_read_palette.f
@@ -0,0 +1,84 @@
+      program  read_palette
+      implicit none
+C
+C     Parameter declaration
+C
+      character*22 FILE_NAME
+      character*18 IMAGE_NAME
+      integer      N_ENTRIES
+      integer      N_COMPS_PAL
+C
+      parameter (FILE_NAME   = 'Image_with_Palette.hdf',
+     +           IMAGE_NAME  = 'Image with Palette',
+     +           N_COMPS_PAL = 3,
+     +           N_ENTRIES   = 256)
+      integer DFACC_READ, DFNT_CHAR8, DFNT_UINT8, MFGR_INTERLACE_PIXEL
+      parameter (DFACC_READ  = 1,
+     +           DFNT_CHAR8  = 4,
+     +           DFNT_UINT8  = 21,
+     +           MFGR_INTERLACE_PIXEL = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgn2ndx, mgselct, mggltid, mgglinf, 
+     +        mgrclut, mgendac, mgend 
+C
+C**** Variable declaration *******************************************
+C
+      integer    file_id, gr_id, ri_id, ri_index, pal_id, pal_index
+      integer    interlace_mode
+      integer    data_type, n_comps, n_entries_out
+      integer    status
+      integer    i, j
+      character  palette_data(N_COMPS_PAL, N_ENTRIES)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Get the index of the image IMAGE_NAME.
+C
+      ri_index = mgn2ndx(gr_id, IMAGE_NAME)
+C
+C     Get the image identifier.
+C
+      ri_id = mgselct(gr_id, 0)
+C
+C     Get the identifier of the palette attached to the image.
+C
+      pal_index = 0
+      pal_id = mggltid(ri_id, pal_index)
+C
+C     Obtain information about the palette.
+C
+      status = mgglinf(pal_id, n_comps, data_type, interlace_mode,
+     +                 n_entries_out)
+      write(*,*) ' Palette: ', n_comps, ' components;  ', 
+     +           n_entries_out, ' entries'
+C
+C     Read the palette.
+C
+      status = mgrclut(pal_id, palette_data)
+C
+C     Display the palette data.
+C
+      write(*,*) "Palette data"
+      do 10 i = 1, n_entries_out
+         write(*,*) (ichar(palette_data(j,i)), j = 1, n_comps)
+10    continue  
+C
+C     Terminate access to the raster image and to the GR interface,
+C     and close the HDF file.
+C
+      status = mgendac(ri_id)
+      status = mgend(gr_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/GR_set_attribute.f b/hdf/fortran/examples/GR_set_attribute.f
new file mode 100644
index 0000000..d8e6387
--- /dev/null
+++ b/hdf/fortran/examples/GR_set_attribute.f
@@ -0,0 +1,97 @@
+      program  set_attribute
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      character*13 IMAGE_NAME
+      character*16 F_ATT1_NAME
+      character*16 F_ATT2_NAME
+      character*17 RI_ATT1_NAME
+      character*17 RI_ATT2_NAME
+      character*32 F_ATT1_VAL
+      character*33 F_ATT2_VAL
+      integer      F_ATT1_N_VALUES
+      integer      F_ATT2_N_VALUES
+      character*35 RI_ATT1_VAL
+      integer      RI_ATT1_N_VALUES
+      integer      RI_ATT2_N_VALUES
+C
+      parameter (FILE_NAME    = 'General_RImages.hdf',
+     +           IMAGE_NAME   = 'Image Array 2',
+     +           F_ATT1_NAME  = 'File Attribute 1',
+     +           F_ATT2_NAME  = 'File Attribute 2',
+     +           RI_ATT1_NAME = 'Image Attribute 1',
+     +           RI_ATT2_NAME = 'Image Attribute 2',
+     +           F_ATT1_VAL   = 'Contents of First FILE Attribute',
+     +           F_ATT2_VAL   = 'Contents of Second FILE Attribute',
+     +           F_ATT1_N_VALUES = 32,
+     +           F_ATT2_N_VALUES = 33,
+     +           RI_ATT1_VAL = 'Contents of IMAGE''s First Attribute',
+     +           RI_ATT1_N_VALUES = 35,
+     +           RI_ATT2_N_VALUES = 6)
+      integer DFACC_WRITE, DFNT_INT16, DFNT_CHAR8
+      parameter (DFACC_WRITE  = 2,
+     +           DFNT_CHAR8   = 4,
+     +           DFNT_INT16   = 22)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgscatt, mgsnatt , mgn2ndx,
+     +        mgselct, mgendac, mgend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer   status
+      integer   file_id, gr_id, ri_id, ri_index
+      integer*2 ri_attr_2(RI_ATT2_N_VALUES)
+      integer   i
+
+      do 10 i = 1, RI_ATT2_N_VALUES
+         ri_attr_2(i) = i
+10    continue 
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Set two file attributes to the file with names, data type, numbers of
+C     values, and values of attributes specified.
+C
+      status = mgscatt(gr_id, F_ATT1_NAME, DFNT_CHAR8, 
+     +                 F_ATT1_N_VALUES, F_ATT1_VAL)
+      status = mgscatt(gr_id, F_ATT2_NAME, DFNT_CHAR8, 
+     +                 F_ATT2_N_VALUES, F_ATT2_VAL)
+C
+C     Obtain the index of the image named IMAGE_NAMR.
+C
+      ri_index = mgn2ndx(gr_id, IMAGE_NAME)
+C
+C     Obtain the identifier of this image. 
+C
+      ri_id = mgselct(gr_id, ri_index)
+C
+C     Set two attributes of the image with names, data types, number of
+C     values, and values of the attributes specified. 
+C
+      status = mgscatt(ri_id, RI_ATT1_NAME, DFNT_CHAR8, 
+     +                 RI_ATT1_N_VALUES, RI_ATT1_VAL) 
+      status = mgsnatt(ri_id, RI_ATT2_NAME, DFNT_INT16, 
+     +                 RI_ATT2_N_VALUES, ri_attr_2)
+C
+C     Terminate access to the image and to the GR interface,
+C     and close the HDF file.
+C
+      status = mgendac(ri_id)
+      status = mgend(gr_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/GR_write_palette.f b/hdf/fortran/examples/GR_write_palette.f
new file mode 100644
index 0000000..a3e1e4b
--- /dev/null
+++ b/hdf/fortran/examples/GR_write_palette.f
@@ -0,0 +1,116 @@
+      program  write_palette
+      implicit none
+C
+C     Parameter declaration
+C
+      character*22 FILE_NAME
+      character*18 NEW_IMAGE_NAME
+      integer      X_LENGTH
+      integer      Y_LENGTH
+      integer      N_ENTRIES
+      integer      N_COMPS_IMG
+      integer      N_COMPS_PAL
+C
+      parameter (FILE_NAME       = 'Image_with_Palette.hdf',
+     +           NEW_IMAGE_NAME  = 'Image with Palette',
+     +           X_LENGTH        = 5,
+     +           Y_LENGTH        = 5,
+     +           N_ENTRIES       = 256,
+     +           N_COMPS_IMG     = 2,
+     +           N_COMPS_PAL     = 3)
+      integer DFACC_CREATE, DFNT_CHAR8, DFNT_UINT8, MFGR_INTERLACE_PIXEL
+      parameter (DFACC_CREATE = 4,
+     +           DFNT_CHAR8   = 4,
+     +           DFNT_UINT8   = 21,
+     +           MFGR_INTERLACE_PIXEL = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer mgstart, mgcreat, mgwcimg, mggltid, mgwclut, 
+     +        mgendac, mgend 
+C
+C**** Variable declaration *******************************************
+C
+      integer    file_id, gr_id, ri_id, pal_id
+      integer    interlace_mode
+      integer    start(2), stride(2), edges(2), dim_sizes(2)
+      integer    status
+      integer    i, j
+      character  image_buf(N_COMPS_IMG, X_LENGTH, Y_LENGTH) 
+      character  palette_buf(N_COMPS_PAL, N_ENTRIES)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Create and open the file.
+C
+      file_id = hopen(FILE_NAME, DFACC_CREATE, 0)
+C
+C     Initialize the GR interface.
+C
+      gr_id = mgstart(file_id)
+C
+C     Define interlace mode and dimensions of the image.  
+C
+      interlace_mode = MFGR_INTERLACE_PIXEL
+      dim_sizes(1) = X_LENGTH
+      dim_sizes(2) = Y_lENGTH
+C
+C     Create the raster image array. 
+C
+      ri_id = mgcreat(gr_id, NEW_IMAGE_NAME, N_COMPS_IMG, DFNT_CHAR8,
+     +                interlace_mode, dim_sizes)
+C
+C     Fill the image data buffer with values. 
+C
+      do 20 i = 1, Y_LENGTH
+         do 10 j = 1, X_LENGTH
+               image_buf(1,j,i) = char(i + j - 1 )
+               image_buf(2,j,i) = char(i + j) 
+10       continue
+20    continue
+
+C     
+C     Define the size of the data to be written, i.e., start from the origin
+C     and go as long as the length of each dimension.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Write the data in the buffer into the image array.
+C
+      status = mgwcimg(ri_id, start, stride, edges, image_buf)
+C
+C     Initilaize the palette buffer to grayscale.
+C
+      do 40 i = 1, N_ENTRIES
+          do 30 j = 1, N_COMPS_PAL
+             palette_buf(j,i) = char(i)
+30        continue
+40    continue 
+C
+C     Get the identifier of the palette attached to the image NEW_IMAGE_NAME.
+C
+      pal_id = mggltid(ri_id, 0)
+C
+C     Set palette interlace mode.
+C
+      interlace_mode = MFGR_INTERLACE_PIXEL
+C
+C     Write data to the palette.
+C
+      status = mgwclut(pal_id, N_COMPS_PAL, DFNT_UINT8, interlace_mode,
+     +                 N_ENTRIES, palette_buf)
+C
+C     Terminate access to the raster image and to the GR interface,
+C     and close the HDF file.
+C
+      status = mgendac(ri_id)
+      status = mgend(gr_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/Makefile.am b/hdf/fortran/examples/Makefile.am
new file mode 100644
index 0000000..aa48f92
--- /dev/null
+++ b/hdf/fortran/examples/Makefile.am
@@ -0,0 +1,89 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+DEFINES=-DNDEBUG -DHDF
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+EXAMPLE_PROG = VD_create_vdatas VD_write_mixed_vdata       \
+	VD_write_to_vdata VD_create_onefield_vdatas         \
+	VD_read_from_vdata VD_read_mixed_vdata              \
+	VD_get_vdata_info VD_locate_vdata VG_create_vgroup  \
+	VG_add_sds_to_vgroup VG_insert_vdatas_to_vgroup     \
+	VG_set_get_vgroup_attr VG_vgroup_contents           \
+	VG_get_vgroup_info GR_create_and_write_image        \
+	GR_modify_image GR_set_attribute GR_get_attribute   \
+	GR_write_palette GR_image_info GR_read_image        \
+	AN_create_annotation AN_get_annotation_info AN_read_annotation
+    # VD_set_get_vdata_attr
+TEST_PROG = $(EXAMPLE_PROG)
+
+# These are the Fortran example files to be installed
+INSTALL_FILES= VD_read_from_vdata.f VD_read_mixed_vdata.f \
+	VD_write_mixed_vdata.f VD_write_to_vdata.f            \
+	VD_create_onefield_vdatas.f VD_create_vdatas.f        \
+	VD_get_vdata_info.f VD_locate_vdata.f                 \
+	VG_insert_vdatas_to_vgroup.f VG_set_get_vgroup_attr.f \
+	VG_vgroup_contents.f VG_add_sds_to_vgroup.f           \
+	VG_create_vgroup.f VG_get_vgroup_info.f               \
+	GR_create_and_write_image.f GR_get_attribute.f        \
+	GR_image_info.f GR_modify_image.f GR_read_image.f     \
+	GR_read_palette.f GR_set_attribute.f                  \
+	GR_write_palette.f AN_create_annotation.f             \
+	AN_get_annotation_info.f AN_read_annotation.f         \
+	#VD_set_get_vdata_attr.f
+
+INSTALL_SCRIPT_FILES = run-fortran-ex.sh
+
+# Where to install Fortran example files
+EXAMPLEDIR=$(prefix)/examples/fortran
+
+# How to build Fortran programs using h4fc
+$(EXTRA_PROG): $(H4FC)
+	$(H4FC) $(H4FCFLAGS) $(FFLAGS) -o $@ $(srcdir)/$@.f;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal Fortran compiler, not h4fc.
+
+# Fortran Programs
+VD_read_from_vdata: $(srcdir)/VD_read_from_vdata.f
+VD_read_mixed_vdata: $(srcdir)/VD_read_mixed_vdata.f
+#VD_set_get_vdata_attr: $(srcdir)/VD_set_get_vdata_attr.f
+VD_write_mixed_vdata: $(srcdir)/VD_write_mixed_vdata.f
+VD_write_to_vdata: $(srcdir)/VD_write_to_vdata.f
+VD_create_onefield_vdatas: $(srcdir)/VD_create_onefield_vdatas.f
+VD_create_vdatas: $(srcdir)/VD_create_vdatas.f
+VD_get_vdata_info: $(srcdir)/VD_get_vdata_info.f
+VD_locate_vdata: $(srcdir)/VD_locate_vdata.f
+VG_insert_vdatas_to_vgroup: $(srcdir)/VG_insert_vdatas_to_vgroup.f
+VG_set_get_vgroup_attr: $(srcdir)/VG_set_get_vgroup_attr.f
+VG_vgroup_contents: $(srcdir)/VG_vgroup_contents.f
+VG_add_sds_to_vgroup: $(srcdir)/VG_add_sds_to_vgroup.f
+VG_create_vgroup: $(srcdir)/VG_create_vgroup.f
+VG_get_vgroup_info: $(srcdir)/VG_get_vgroup_info.f
+GR_create_and_write_image: $(srcdir)/GR_create_and_write_image.f
+GR_get_attribute: $(srcdir)/GR_get_attribute.f
+GR_image_info: $(srcdir)/GR_image_info.f
+GR_modify_image: $(srcdir)/GR_modify_image.f
+GR_read_image: $(srcdir)/GR_read_image.f
+GR_read_palette: $(srcdir)/GR_read_palette.f
+GR_set_attribute: $(srcdir)/GR_set_attribute.f
+GR_write_palette: $(srcdir)/GR_write_palette.f
+AN_create_annotation: $(srcdir)/AN_create_annotation.f
+AN_get_annotation_info: $(srcdir)/AN_get_annotation_info.f
+AN_read_annotation: $(srcdir)/AN_read_annotation.f
+
+DISTCLEANFILES = *.chkexe *.chklog
+
+if BUILD_SHARED_SZIP_CONDITIONAL
+LD_LIBRARY_PATH=$(LL_PATH)
+endif
+
+include $(top_srcdir)/config/examples.am
+include $(top_srcdir)/config/conclude.am
diff --git a/hdf/fortran/examples/Makefile.in b/hdf/fortran/examples/Makefile.in
new file mode 100644
index 0000000..05b6f9d
--- /dev/null
+++ b/hdf/fortran/examples/Makefile.in
@@ -0,0 +1,755 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+# We can't tell automake about example programs, because they need to be
+# built using h4cc (or h4fc, etc.) instead of the standard compilers.
+# This creates some extra work for us.
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am \
+	$(top_srcdir)/config/examples.am
+TESTS = $(TEST_PROG)
+subdir = hdf/fortran/examples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog *.hdf
+DEFINES = -DNDEBUG -DHDF
+
+#############################################################################
+#############################################################################
+EXAMPLE_PROG = VD_create_vdatas VD_write_mixed_vdata       \
+	VD_write_to_vdata VD_create_onefield_vdatas         \
+	VD_read_from_vdata VD_read_mixed_vdata              \
+	VD_get_vdata_info VD_locate_vdata VG_create_vgroup  \
+	VG_add_sds_to_vgroup VG_insert_vdatas_to_vgroup     \
+	VG_set_get_vgroup_attr VG_vgroup_contents           \
+	VG_get_vgroup_info GR_create_and_write_image        \
+	GR_modify_image GR_set_attribute GR_get_attribute   \
+	GR_write_palette GR_image_info GR_read_image        \
+	AN_create_annotation AN_get_annotation_info AN_read_annotation
+
+TEST_PROG = $(EXAMPLE_PROG)
+
+# These are the Fortran example files to be installed
+INSTALL_FILES = VD_read_from_vdata.f VD_read_mixed_vdata.f \
+	VD_write_mixed_vdata.f VD_write_to_vdata.f            \
+	VD_create_onefield_vdatas.f VD_create_vdatas.f        \
+	VD_get_vdata_info.f VD_locate_vdata.f                 \
+	VG_insert_vdatas_to_vgroup.f VG_set_get_vgroup_attr.f \
+	VG_vgroup_contents.f VG_add_sds_to_vgroup.f           \
+	VG_create_vgroup.f VG_get_vgroup_info.f               \
+	GR_create_and_write_image.f GR_get_attribute.f        \
+	GR_image_info.f GR_modify_image.f GR_read_image.f     \
+	GR_read_palette.f GR_set_attribute.f                  \
+	GR_write_palette.f AN_create_annotation.f             \
+	AN_get_annotation_info.f AN_read_annotation.f         \
+	#VD_set_get_vdata_attr.f
+
+INSTALL_SCRIPT_FILES = run-fortran-ex.sh
+
+# Where to install Fortran example files
+EXAMPLEDIR = $(prefix)/examples/fortran
+DISTCLEANFILES = *.chkexe *.chklog
+ at BUILD_SHARED_SZIP_CONDITIONAL_TRUE@LD_LIBRARY_PATH = $(LL_PATH)
+
+# Assume that all tests in this directory are examples, and tell
+# conclude.am when to build them.
+EXTRA_PROG = $(EXAMPLE_PROG)
+
+# We need to tell automake what to clean
+MOSTLYCLEANFILES = *.o $(EXAMPLE_PROG)
+CLEANFILES = $(EXAMPLE_PROG)
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/fortran/examples/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign hdf/fortran/examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+	-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-local
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am all-local check check-TESTS check-am clean \
+	clean-generic clean-libtool distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am \
+	install-data-local install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installcheck-local installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am uninstall uninstall-am uninstall-local
+
+    # VD_set_get_vdata_attr
+
+# How to build Fortran programs using h4fc
+$(EXTRA_PROG): $(H4FC)
+	$(H4FC) $(H4FCFLAGS) $(FFLAGS) -o $@ $(srcdir)/$@.f;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal Fortran compiler, not h4fc.
+
+# Fortran Programs
+VD_read_from_vdata: $(srcdir)/VD_read_from_vdata.f
+VD_read_mixed_vdata: $(srcdir)/VD_read_mixed_vdata.f
+#VD_set_get_vdata_attr: $(srcdir)/VD_set_get_vdata_attr.f
+VD_write_mixed_vdata: $(srcdir)/VD_write_mixed_vdata.f
+VD_write_to_vdata: $(srcdir)/VD_write_to_vdata.f
+VD_create_onefield_vdatas: $(srcdir)/VD_create_onefield_vdatas.f
+VD_create_vdatas: $(srcdir)/VD_create_vdatas.f
+VD_get_vdata_info: $(srcdir)/VD_get_vdata_info.f
+VD_locate_vdata: $(srcdir)/VD_locate_vdata.f
+VG_insert_vdatas_to_vgroup: $(srcdir)/VG_insert_vdatas_to_vgroup.f
+VG_set_get_vgroup_attr: $(srcdir)/VG_set_get_vgroup_attr.f
+VG_vgroup_contents: $(srcdir)/VG_vgroup_contents.f
+VG_add_sds_to_vgroup: $(srcdir)/VG_add_sds_to_vgroup.f
+VG_create_vgroup: $(srcdir)/VG_create_vgroup.f
+VG_get_vgroup_info: $(srcdir)/VG_get_vgroup_info.f
+GR_create_and_write_image: $(srcdir)/GR_create_and_write_image.f
+GR_get_attribute: $(srcdir)/GR_get_attribute.f
+GR_image_info: $(srcdir)/GR_image_info.f
+GR_modify_image: $(srcdir)/GR_modify_image.f
+GR_read_image: $(srcdir)/GR_read_image.f
+GR_read_palette: $(srcdir)/GR_read_palette.f
+GR_set_attribute: $(srcdir)/GR_set_attribute.f
+GR_write_palette: $(srcdir)/GR_write_palette.f
+AN_create_annotation: $(srcdir)/AN_create_annotation.f
+AN_get_annotation_info: $(srcdir)/AN_get_annotation_info.f
+AN_read_annotation: $(srcdir)/AN_read_annotation.f
+
+# How to create EXAMPLEDIR if it doesn't already exist
+$(EXAMPLEDIR):
+	mkdir -p $@
+
+# Install and uninstall rules.  We install the source files, not the
+# example programs themselves.
+install-data-local:
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-local:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+install-examples: $(EXAMPLEDIR) 
+	@for f in X $(INSTALL_FILES); do                                     \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_FILES); do                                 \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	  fi;                                                                \
+	done
+
+uninstall-examples:
+	@if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then           \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES);              \
+	fi
+	@if test -n "$(INSTALL_SCRIPT_FILES)" -a -d $(EXAMPLEDIR); then    \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_SCRIPT_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_SCRIPT_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_SCRIPT_FILES);       \
+	fi
+
+installcheck-local:
+	@if test "$(STATIC_SHARED)" = "static, shared"; then               \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	  $(MAKE) $(AM_MAKEFLAGS) clean;                                   \
+	  H5CCFLAGS="" $(MAKE) $(AM_MAKEFLAGS) check;                      \
+	elif test "$(STATIC_SHARED)" = "shared"; then                      \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	else                                                               \
+	  $(MAKE) $(AM_MAKEFLAGS) check;                                   \
+	fi
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdf/fortran/examples/VD_create_onefield_vdatas.f b/hdf/fortran/examples/VD_create_onefield_vdatas.f
new file mode 100644
index 0000000..22e16e0
--- /dev/null
+++ b/hdf/fortran/examples/VD_create_onefield_vdatas.f
@@ -0,0 +1,79 @@
+      program create_onefield_vdatas
+      implicit none
+C
+C     Parameter declaration
+C
+      character*18 FILE_NAME
+      character*9  CLASS1_NAME
+      character*9  CLASS2_NAME
+      character*11 VDATA1_NAME
+      character*12 VDATA2_NAME
+      character*22 FIELD1_NAME
+      character*21 FIELD2_NAME
+      integer      N_RECORDS_1, N_RECORDS_2
+      integer      ORDER_2
+C
+      parameter (FILE_NAME   = 'General_Vdatas.hdf',
+     +           CLASS1_NAME = '5x1 Array',
+     +           CLASS2_NAME = '6x4 Array',
+     +           VDATA1_NAME = 'First Vdata',
+     +           VDATA2_NAME = 'Second Vdata',
+     +           FIELD1_NAME = 'Single-component Field',
+     +           FIELD2_NAME = 'Multi-component Field')
+      parameter (N_RECORDS_1 = 5,
+     +           N_RECORDS_2 = 6,
+     +           ORDER_2     = 4)               
+   
+      integer DFACC_WRITE, DFNT_CHAR8, DFNT_INT32
+      parameter (DFACC_WRITE = 2,
+     +           DFNT_CHAR8  = 4,
+     +           DFNT_INT32  = 24)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vhfscd, vhfsdm, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer   status
+      integer   file_id
+      integer   vdata1_ref, vdata2_ref 
+      character vdata1_buf(N_RECORDS_1)
+      integer   vdata2_buf(ORDER_2, N_RECORDS_2)
+      data vdata1_buf /'V','D','A','T','A'/
+      data vdata2_buf / 1,  2,  3,  4,
+     +                  2,  4,  6,  8,
+     +                  3,  6,  9, 12,
+     +                  4,  8, 12, 16,
+     +                  5, 10, 15, 20,
+     +                  6, 12, 18, 24/
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+C
+C     Create the first vdata and populate it with data from vdata1_buf array.
+C     
+      vdata1_ref = vhfscd(file_id, FIELD1_NAME, vdata1_buf, N_RECORDS_1,
+     +                    DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME)
+C
+C     Create the second vdata and populate it with data from vdata2_buf array.
+C     
+      vdata2_ref = vhfsdm(file_id, FIELD2_NAME, vdata2_buf, N_RECORDS_2,
+     +                    DFNT_INT32, VDATA2_NAME, CLASS2_NAME,
+     +                    ORDER_2)
+C
+C     Terminate access to the VS interface and close the HDF file.
+C
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VD_create_vdatas.f b/hdf/fortran/examples/VD_create_vdatas.f
new file mode 100644
index 0000000..c789475
--- /dev/null
+++ b/hdf/fortran/examples/VD_create_vdatas.f
@@ -0,0 +1,106 @@
+      program create_vdatas
+      implicit none
+C
+C     Parameter declaration
+C
+      character*18 FILE1_NAME
+      character*14 FILE2_NAME
+      character*7  VDATA_NAME
+      character*12 VDATA_CLASS
+C
+      parameter (FILE1_NAME  = 'General_Vdatas.hdf',
+     +           FILE2_NAME  = 'Two_Vdatas.hdf',
+     +           VDATA_NAME  = 'Vdata 1',
+     +           VDATA_CLASS = 'Empty Vdatas')
+      integer DFACC_CREATE
+      parameter (DFACC_CREATE = 4)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsfatch, vsfsnam, vsfscls, vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file1_id, file2_id
+      integer vdata_id, vdata1_id, vdata2_id 
+      integer vdata_ref
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Create the first HDF file.
+C
+      file1_id = hopen(FILE1_NAME, DFACC_CREATE, 0)
+C
+C     Initialize the VS interface associated with the first HDF file.
+C
+      status = vfstart(file1_id) 
+C
+C     Create a vdata in the first HDF file.
+C
+      vdata_ref = -1
+      vdata_id = vsfatch(file1_id, vdata_ref, 'w')
+C
+C     Assign a name to the vdata.
+C
+      status = vsfsnam(vdata_id, VDATA_NAME)
+C
+C     Other operations on the vdata identified by vdata_id can be carried out
+C     starting from this point.
+C
+C     Create the second HDF file.
+C
+      file2_id = hopen(FILE2_NAME, DFACC_CREATE, 0) 
+C
+C     Initialize the VS interface associated with the second HDF file.
+C
+      status = vfstart(file2_id) 
+C
+C     Create the first vdata in the second HDF file.
+C
+      vdata1_id = vsfatch(file2_id, vdata_ref, 'w')
+C
+C     Create the second vdata in the second HDF file.
+C
+      vdata2_id = vsfatch(file2_id, vdata_ref, 'w')
+C
+C     Assign a class name to these vdatas.
+C
+      status = vsfscls(vdata1_id, VDATA_CLASS)
+      status = vsfscls(vdata2_id, VDATA_CLASS)
+C
+C     Other operations on the vdatas identified by vdata1_id and vdata2_id
+C     can be carried out starting from this point.
+C
+C
+C     Terminate access to the first vdata in the second HDF file.
+C
+      status = vsfdtch(vdata1_id)
+C
+C     Terminate access to the second vdata in the second HDF file.
+C
+      status = vsfdtch(vdata2_id)
+C
+C     Terminate access to the VS interface associated with the second HDF file.
+C
+      status = vfend(file2_id)
+C
+C     Close the second HDF file.
+C
+      status = hclose(file2_id)
+C
+C     Terminate access to the vdata in the first HDF file.
+C
+      status = vsfdtch(vdata_id)
+C
+C     terminate access to the VS interface associated with the first HDF file.
+C
+      status = vfend(file1_id)
+C
+C     Close the first HDF file.
+C
+      status = hclose(file1_id)
+      end
diff --git a/hdf/fortran/examples/VD_get_vdata_info.f b/hdf/fortran/examples/VD_get_vdata_info.f
new file mode 100644
index 0000000..3f1e8ae
--- /dev/null
+++ b/hdf/fortran/examples/VD_get_vdata_info.f
@@ -0,0 +1,88 @@
+      program vdata_info 
+      implicit none
+C
+C     Parameter declaration
+C
+      character*18 FILE_NAME
+      integer      DFACC_READ, FULL_INTERLACE
+      integer      FIELD_SIZE
+C
+      parameter (FILE_NAME      = 'General_Vdatas.hdf',
+     +           DFACC_READ     = 1,
+     +           FULL_INTERLACE = 0,
+     +           FIELD_SIZE     = 80)
+      
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsfatch, vsfgid, vsfinq,
+     +        vsfisat, vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer      status
+      integer      file_id, vdata_id, vdata_ref
+      integer      n_records, interlace_mode, vdata_size
+      character*64 vdata_name
+      character*80 fieldname_list 
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+C
+C     Set the reference number to -1 to start the search from the beginning
+C     of the file. 
+C     
+      vdata_ref = -1
+10    continue
+C
+C     Use vsfgid to obtain each vdata by its reference number then
+C     attach to the vdata and get information. The loop terminates
+C     when the last vdata is reached.
+C
+      vdata_ref = vsfgid(file_id, vdata_ref)
+      if (vdata_ref .eq. -1) goto 100
+C
+C     Attach to the current vdata for reading.
+C
+      vdata_id = vsfatch(file_id, vdata_ref, 'r')
+C
+C     Test whether the current vdata is not a storage for an attribute,
+C     then obtain and display its information.
+      if (vsfisat(vdata_id) .ne. 1) then
+          status = vsfinq(vdata_id, n_records, interlace_mode,
+     +                    fieldname_list, vdata_size, vdata_name)
+          write(*,*) 'Vdata: ', vdata_name
+          write(*,*) 'contains ', n_records, ' records'
+          if (interlace_mode .eq. 0) then
+              write(*,*) 'Interlace mode: FULL'
+          else	 
+              write(*,*) 'Interlace mode: NONE'
+          endif
+          write(*,*) 'Fields: ', fieldname_list(1:30)
+          write(*,*) 'Vdata record size in bytes :', vdata_size
+          write(*,*)
+      endif
+C
+C     Detach from the current vdata.
+C
+      status = vsfdtch(vdata_id)
+      goto 10 
+100   continue
+C
+C     Terminate access to the vdata and to the VS interface, and
+C     close the HDF file.
+C
+      status = vsfdtch(vdata_id)
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VD_locate_vdata.f b/hdf/fortran/examples/VD_locate_vdata.f
new file mode 100644
index 0000000..4861a64
--- /dev/null
+++ b/hdf/fortran/examples/VD_locate_vdata.f
@@ -0,0 +1,87 @@
+      program locate_vdata 
+      implicit none
+C
+C     Parameter declaration
+C
+      character*18 FILE_NAME
+      character*20 SEARCHED_FIELDS 
+C
+      parameter (FILE_NAME       = 'General_Vdatas.hdf',
+     +           SEARCHED_FIELDS = 'Position,Temperature')
+      integer DFACC_READ
+      parameter (DFACC_READ = 1)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsfatch, vsfgid, vsfex, vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id, vdata_id, vdata_ref
+      integer index 
+      logical found_fields 
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+      index = 0
+C
+C     Set the reference number to -1 to start the search from the beginning
+C     of the file. 
+C     
+      vdata_ref = -1
+C
+C     Assume that the specified fields are not found in the current vdata.
+C
+      found_fields = .FALSE.
+10    continue
+C
+C     Use vsfgid to obtain each vdata by its reference number then
+C     attach to the vdata and search for the fields. The loop terminates
+C     when the last vdata is reached or when a vdata which contains the
+C     fields listed in SEARCHED_FIELDS is found.
+C
+      vdata_ref = vsfgid(file_id, vdata_ref)
+      if (vdata_ref .eq. -1) goto 100
+      vdata_id = vsfatch(file_id, vdata_ref, 'r')
+      status = vsfex(vdata_id, SEARCHED_FIELDS)
+      if (status .ne. -1) then
+          found_fields = .TRUE.
+          goto 100
+      endif
+      status = vsfdtch(vdata_id)
+      index = index + 1 
+      goto 10
+100   continue
+C
+C     Print the index of the vdata containing the fields or a 'not found'
+C     message if no such vdata is found. Also detach from the vdata found.
+C
+      if(.NOT.found_fields) then
+         write(*,*) 'Fields Positions and Temperature were not found'
+      else
+         write(*,*)
+     +   'Fields Positions and Temperature were found in the vdata',
+     +   ' at position ', index
+C
+C        Terminate access to the vdata
+C
+         status = vsfdtch(vdata_id)
+      endif  
+C
+C     Terminate access to the VS interface and close the HDF file.
+C
+      status = vsfdtch(vdata_id)
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VD_read_from_vdata.f b/hdf/fortran/examples/VD_read_from_vdata.f
new file mode 100644
index 0000000..17d6aba
--- /dev/null
+++ b/hdf/fortran/examples/VD_read_from_vdata.f
@@ -0,0 +1,93 @@
+      program read_from_vdata 
+      implicit none
+C
+C     Parameter declaration
+C
+      character*18 FILE_NAME
+      character*14 VDATA_NAME
+      character*20 FIELDNAME_LIST
+      integer      N_RECORDS, RECORD_INDEX
+      integer      ORDER_1, ORDER_2
+      integer      N_VALS_PER_REC
+C
+      parameter (FILE_NAME       = 'General_Vdatas.hdf',
+     +           VDATA_NAME      = 'Solid Particle',
+     +           FIELDNAME_LIST = 'Position,Temperature')
+      parameter (N_RECORDS  = 5,
+     +           RECORD_INDEX = 3,
+     +           ORDER_1    = 3,
+     +           ORDER_2    = 2,
+     +           N_VALS_PER_REC = ORDER_1 + ORDER_2 )               
+   
+      integer DFACC_READ, FULL_INTERLACE
+      parameter (DFACC_READ     = 1,
+     +           FULL_INTERLACE = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsffnd, vsfatch, vsfsfld, vsfrd, vsfseek,
+     +        vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id, vdata_id
+      integer vdata_ref, rec_num, num_of_records, rec_pos
+      real    databuf(N_VALS_PER_REC, N_RECORDS)
+      integer i
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+C
+C     Get the reference number of the vdata, whose name is specified in
+C     VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. 
+C     
+      vdata_ref = vsffnd(file_id, VDATA_NAME)
+C
+C     Attach to the vdata for reading if it is found, 
+C     otherwise exit the program.
+C
+      if (vdata_ref .eq. 0) stop
+      vdata_id = vsfatch(file_id, vdata_ref, 'r') 
+C
+C     Specify the fields that will be read. 
+C
+      status = vsfsfld(vdata_id, FIELDNAME_LIST)
+C
+C     Place the current point to the position specified in RECORD_INDEX.
+C
+      rec_pos = vsfseek(vdata_id, RECORD_INDEX) 
+C
+C     Read the next N_RECORDS from the vdata and store the data in the buffer 
+C     databuf with fully interlace mode. 
+C
+      num_of_records = vsfrd(vdata_id, databuf, N_RECORDS,
+     +                        FULL_INTERLACE)
+C
+C     Display the read data as many records as the number of records returned
+C     by vsfrd.
+C
+      write(*,*) '  Particle Position     Temperature Range'
+      write(*,*)
+      do 10 rec_num = 1, num_of_records
+         write(*,1000) (databuf(i, rec_num), i = 1, N_VALS_PER_REC)
+10    continue 
+1000  format(1x,3(f6.2), 8x,2(f6.2))
+C
+C     Terminate access to the vdata and to the VS interface, and
+C     close the HDF file.
+C
+      status = vsfdtch(vdata_id)
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VD_read_mixed_vdata.f b/hdf/fortran/examples/VD_read_mixed_vdata.f
new file mode 100644
index 0000000..b08ab73
--- /dev/null
+++ b/hdf/fortran/examples/VD_read_mixed_vdata.f
@@ -0,0 +1,106 @@
+      program read_mixed_vdata 
+      implicit none
+C
+C     Parameter declaration
+C
+      character*16 FILE_NAME
+      character*16 VDATA_NAME
+      character*4  FIELD1_NAME
+      character*5  FIELD2_NAME
+      character*10 FIELDNAME_LIST
+      integer      N_RECORDS, N_FIELDS
+      integer      BUFFER_SIZE 
+C
+      parameter (FILE_NAME       = 'Packed_Vdata.hdf',
+     +           VDATA_NAME      = 'Mixed Data Vdata',
+     +           FIELD1_NAME     = 'Temp',
+     +           FIELD2_NAME     = 'Ident',
+     +           FIELDNAME_LIST = 'Temp,Ident')
+      parameter (N_RECORDS   = 20,
+     +           N_FIELDS    = 2, 
+     +           BUFFER_SIZE = (4 + 1)*N_RECORDS)               
+   
+      integer DFACC_READ, DFNT_FLOAT32, DFNT_CHAR8,
+     +        FULL_INTERLACE, HDF_VSUNPACK  
+      parameter (DFACC_READ       = 1,
+     +           DFNT_FLOAT32     = 5,
+     +           DFNT_CHAR8       = 4,
+     +           FULL_INTERLACE   = 0,
+     +           HDF_VSUNPACK     = 1)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsfatch, vsffnd, vsfsfld,
+     +        vsfnpak, vsfcpak, vsfread, vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer   status
+      integer   file_id, vdata_id
+      integer   vdata_ref, num_of_records
+      real      temp(N_RECORDS)
+      character ident(N_RECORDS) 
+      integer   i
+C
+C     Buffer for read packed data should be big enough to hold N_RECORDS.
+C
+      integer   databuf(BUFFER_SIZE/4 + 1)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+C
+C     Get the reference number of the vdata, whose name is specified in
+C     VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. 
+C     
+      vdata_ref = vsffnd(file_id, VDATA_NAME)
+C
+C     Attach to the vdata for reading if it is found, 
+C     otherwise exit the program.
+C
+      if (vdata_ref .eq. 0) stop
+      vdata_id = vsfatch(file_id, vdata_ref, 'r') 
+C
+C     Specify the fields that will be read. 
+C
+      status = vsfsfld(vdata_id, FIELDNAME_LIST)
+
+C
+C     Read N_RECORDS records of the vdata and store the values into the databuf.
+C
+      num_of_records = vsfread(vdata_id, databuf, N_RECORDS,
+     +                         FULL_INTERLACE)
+C
+C     Unpack N_RECORDS from databuf into temp and ident arrays.
+C     In Fortran, each field is unpacked using separate calls to 
+C     vsfnpak or vsfcpak.
+C
+      status = vsfnpak(vdata_id, HDF_VSUNPACK, FIELDNAME_LIST, databuf,
+     +                 BUFFER_SIZE, num_of_records, FIELD1_NAME, temp) 
+      status = vsfcpak(vdata_id, HDF_VSUNPACK, FIELDNAME_LIST, databuf,
+     +                 BUFFER_SIZE, num_of_records, FIELD2_NAME, ident) 
+C
+C     Display the read data being stored in the field databufs.
+C
+      write (*,*) '    Temp  Ident'
+      do 10 i = 1, num_of_records
+         write(*,1000) temp(i), ident(i)
+10    continue 
+1000  format (3x,F6.2, 4x, a)
+C
+C     Terminate access to the vdata and to the VS interface, and
+C     close the HDF file.
+C
+      status = vsfdtch(vdata_id)
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VD_set_get_vdata_attr.f b/hdf/fortran/examples/VD_set_get_vdata_attr.f
new file mode 100644
index 0000000..ffdbf73
--- /dev/null
+++ b/hdf/fortran/examples/VD_set_get_vdata_attr.f
@@ -0,0 +1,134 @@
+      program vdata_attributes 
+      implicit none
+C
+C     Parameter declaration
+C
+      character*18 FILE_NAME
+      character*14 VDATA_NAME
+      character*4  FIELD_NAME
+      character*10 VATTR_NAME
+      character*6  FATTR_NAME
+      integer      VATTR_N_VALUES, FATTR_N_VALUES 
+C
+      parameter (FILE_NAME    = 'General_Vdatas.hdf',
+     +           VDATA_NAME   = 'Solid Particle',
+     +           FIELD_NAME   = 'Mass',
+     +           VATTR_NAME   = 'Site Ident',
+     +           FATTR_NAME   = 'Scales')
+      parameter (VATTR_N_VALUES = 3,
+     +           FATTR_N_VALUES = 4)
+   
+      integer DFACC_WRITE, FULL_INTERLACE, HDF_VDATA
+      integer DFNT_INT32, DFNT_CHAR8
+      parameter (DFACC_WRITE    =  2,
+     +           FULL_INTERLACE =  0,
+     +           HDF_VDATA      = -1,
+     +           DFNT_INT32     = 24,
+     +           DFNT_CHAR8     =  4)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsffnd, vsfatch, vsfscat, vsfsnat, 
+     +        vsffnas, vsffidx, vsfnats, vsfainf, vsfgcat, vsfgnat,
+     +        vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer   status
+      integer   file_id, vdata_id, vdata_ref
+      integer   field_index, n_vdattrs, n_fldattrs
+      integer   vdata_type, vdata_n_values, vdata_size
+      integer   field_type, field_n_values, field_size 
+      character vd_attr(VATTR_N_VALUES)
+      integer   fld_attr(FATTR_N_VALUES)
+      character vattr_buf(VATTR_N_VALUES)
+      integer   fattr_buf(FATTR_N_VALUES)
+      character vattr_name_out(30), fattr_name_out(30)
+      data vd_attr /'A', 'B', 'C'/
+      data fld_attr /2, 4, 6, 8/
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+C
+C     Get the reference number of the vdata named VDATA_NAME.
+C     
+      vdata_ref = vsffnd(file_id, VDATA_NAME)
+C
+C     Attach to the vdata for writing. 
+C
+      vdata_id = vsfatch(file_id, vdata_ref, 'w') 
+C
+C     Attach an attribute to the vdata, as it is indicated by second parameter.
+C
+      status = vsfscat(vdata_id, HDF_VDATA, VATTR_NAME, DFNT_CHAR8,
+     +                  VATTR_N_VALUES, vd_attr)
+C
+C     Get the index of the field FIELD_NAME within the vdata.
+C
+      status = vsffidx(vdata_id, FIELD_NAME, field_index)
+C
+C     Attach an attribute to the field with the index field_index.
+C
+      status = vsfsnat(vdata_id, field_index, FATTR_NAME, DFNT_INT32,
+     +                  FATTR_N_VALUES, fld_attr)
+      
+C
+C     Get the number of attributes attached to the vdata's first
+C     field - should be 0.
+C
+      n_fldattrs = vsffnas(vdata_id, 0)
+      write(*,*) 'Number of attributes of the first field' 
+      write(*,*) ' of the vdata: ', n_fldattrs
+C
+C     Get the number of the attributes attached to the field specified by
+C     index field_index - should be 1.
+C
+      n_fldattrs = vsffnas(vdata_id, field_index)
+      write(*,*) 'Number of attributes of field ', FIELD_NAME,
+     +           n_fldattrs
+C
+C     Get the total number of the field's and vdata's attributes - should be 2.
+C
+      n_vdattrs = vsfnats(vdata_id)
+      write(*,*) 'Number of attributes of the vdata and its fields: ',
+     +           n_vdattrs
+C
+C     Get information about the vdata's first attribute, indicated by 
+C     the third parameter, which is the index of the attribute.
+C
+      status = vsfainf(vdata_id, HDF_VDATA, 0, vattr_name_out,
+     +                 vdata_type, vdata_n_values, vdata_size)
+C
+C     Get information about the first attribute of the field specified by
+C     field_index.
+C
+      status = vsfainf(vdata_id, field_index, 0, fattr_name_out, 
+     +                 field_type, field_n_values, field_size)
+C
+C     Get the vdata's first attribute.
+C
+      status = vsfgcat(vdata_id, HDF_VDATA, 0, vattr_buf)
+      write(*,*) 'Values of vdata attribute  ', vattr_buf
+C
+C     Get the first attribute of the field specified by field_index.
+C
+      status = vsfgnat(vdata_id, field_index, 0, fattr_buf)
+      write(*,*)  'Values of the field attribute = ', fattr_buf
+C       
+C     Terminate access to the vdata and to the VS interface, and
+C     close the HDF file.
+C
+      status = vsfdtch(vdata_id)
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VD_write_mixed_vdata.f b/hdf/fortran/examples/VD_write_mixed_vdata.f
new file mode 100644
index 0000000..76e1e02
--- /dev/null
+++ b/hdf/fortran/examples/VD_write_mixed_vdata.f
@@ -0,0 +1,126 @@
+      program write_mixed_vdata 
+      implicit none
+C
+C     Parameter declaration
+C
+      character*16 FILE_NAME
+      character*18 CLASS_NAME
+      character*16 VDATA_NAME
+      character*4  FIELD1_NAME
+      character*6  FIELD2_NAME
+      character*5  FIELD3_NAME
+      character*5  FIELD4_NAME
+      character*23 FIELDNAME_LIST
+      integer      N_RECORDS, N_FIELDS, ORDER
+      integer      BUF_SIZE 
+C
+      parameter (FILE_NAME       = 'Packed_Vdata.hdf',
+     +           CLASS_NAME      = 'General Data Class',
+     +           VDATA_NAME      = 'Mixed Data Vdata',
+     +           FIELD1_NAME     = 'Temp',
+     +           FIELD2_NAME     = 'Height',
+     +           FIELD3_NAME     = 'Speed',
+     +           FIELD4_NAME     = 'Ident',
+     +           FIELDNAME_LIST = 'Temp,Height,Speed,Ident')
+      parameter (N_RECORDS = 20,
+     +           N_FIELDS  = 4, 
+     +           ORDER     = 1,
+     +           BUF_SIZE = (4 + 2 + 4 + 1)*N_RECORDS)               
+   
+      integer DFACC_WRITE, DFNT_FLOAT32, DFNT_INT16, DFNT_CHAR8,
+     +        FULL_INTERLACE, HDF_VSPACK  
+      parameter (DFACC_WRITE    = 2,
+     +           DFNT_FLOAT32   = 5,
+     +           DFNT_INT16     = 22,
+     +           DFNT_CHAR8     = 4,
+     +           FULL_INTERLACE = 0,
+     +           HDF_VSPACK     = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld,
+     +        vsfnpak, vsfcpak, vsfwrit, vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer   status
+      integer   file_id, vdata_id
+      integer   vdata_ref, num_of_records
+      real      temp(N_RECORDS)
+      integer*2 height(N_RECORDS)
+      real      speed(N_RECORDS)
+      character ident(N_RECORDS) 
+      integer   i
+C
+C     Buffer for packed data should be big enough to hold N_RECORDS.
+C
+      integer   databuf(BUF_SIZE/4 + 1)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+C
+C     Create a new vdata.
+C     
+      vdata_ref = -1
+      vdata_id = vsfatch(file_id, vdata_ref, 'w') 
+C
+C     Set name and class name of the vdata.
+C
+      status = vsfsnam(vdata_id, VDATA_NAME)
+      status = vsfscls(vdata_id, CLASS_NAME)
+C
+C     Introduce each field's name, data type, and order. This is the
+C     first part in defining a field.
+C
+      status = vsffdef(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER)
+      status = vsffdef(vdata_id, FIELD2_NAME, DFNT_INT16, ORDER)
+      status = vsffdef(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER)
+      status = vsffdef(vdata_id, FIELD4_NAME, DFNT_CHAR8, ORDER)
+C
+C     Finalize the definition of the fields.
+C
+      status = vsfsfld(vdata_id, FIELDNAME_LIST)
+C
+C     Enter data values into the field databufs by the records.
+C
+      do 10 i = 1, N_RECORDS
+         temp(i)   = 1.11 * i
+         height(i) = i - 1
+         speed(i)  = 1.11 * i
+         ident(i)  = char(64+i)
+10    continue
+C
+C     Pack N_RECORDS of data into databuf. In Fortran, each field is packed 
+C     using separate calls to vsfnpak or vsfcpak.
+C
+      status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE,
+     +                 N_RECORDS, FIELD1_NAME, temp) 
+      status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE,
+     +                 N_RECORDS, FIELD2_NAME, height) 
+      status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE,
+     +                 N_RECORDS, FIELD3_NAME, speed) 
+      status = vsfcpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE,
+     +                 N_RECORDS, FIELD4_NAME, ident) 
+C
+C     Write all the records of the packed data to the vdata.
+C
+      num_of_records = vsfwrit(vdata_id, databuf, N_RECORDS,
+     +                         FULL_INTERLACE)
+C
+C     Terminate access to the vdata and to the VS interface, and
+C     close the HDF file.
+C
+      status = vsfdtch(vdata_id)
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VD_write_to_vdata.f b/hdf/fortran/examples/VD_write_to_vdata.f
new file mode 100644
index 0000000..f6ac90b
--- /dev/null
+++ b/hdf/fortran/examples/VD_write_to_vdata.f
@@ -0,0 +1,106 @@
+      program write_to_vdata 
+      implicit none
+C
+C     Parameter declaration
+C
+      character*18 FILE_NAME
+      character*13 CLASS_NAME
+      character*14 VDATA_NAME
+      character*8  FIELD1_NAME
+      character*4  FIELD2_NAME
+      character*11 FIELD3_NAME
+      character*27 FIELDNAME_LIST
+      integer      N_RECORDS
+      integer      ORDER_1, ORDER_2, ORDER_3
+      integer      N_VALS_PER_REC
+C
+      parameter (FILE_NAME       = 'General_Vdatas.hdf',
+     +           CLASS_NAME      = 'Particle Data',
+     +           VDATA_NAME      = 'Solid Particle',
+     +           FIELD1_NAME     = 'Position',
+     +           FIELD2_NAME     = 'Mass',
+     +           FIELD3_NAME     = 'Temperature',
+     +           FIELDNAME_LIST = 'Position,Mass,Temperature')
+      parameter (N_RECORDS = 10,
+     +           ORDER_1   = 3,
+     +           ORDER_2   = 1,
+     +           ORDER_3   = 2,
+     +           N_VALS_PER_REC = ORDER_1 + ORDER_2 + ORDER_3)               
+   
+      integer DFACC_WRITE, DFNT_FLOAT32, FULL_INTERLACE
+      parameter (DFACC_WRITE    = 2,
+     +           DFNT_FLOAT32   = 5,
+     +           FULL_INTERLACE = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld,
+     +        vsfwrt, vsfdtch, vfend 
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id, vdata_id
+      integer vdata_ref, rec_num, num_of_records
+      real    data_buf(N_VALS_PER_REC, N_RECORDS)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+C
+C     Create a new vdata.
+C     
+      vdata_ref = -1
+      vdata_id = vsfatch(file_id, vdata_ref, 'w') 
+C
+C     Set name and class name of the vdata.
+C
+      status = vsfsnam(vdata_id, VDATA_NAME)
+      status = vsfscls(vdata_id, CLASS_NAME)
+C
+C     Introduce each field's name, data type, and order. This is the
+C     first part in defining a field.
+C
+      status = vsffdef(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER_1)
+      status = vsffdef(vdata_id, FIELD2_NAME, DFNT_FLOAT32, ORDER_2)
+      status = vsffdef(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER_3)
+C
+C     Finalize the definition of the fields.
+C
+      status = vsfsfld(vdata_id, FIELDNAME_LIST)
+C
+C     Buffer the data by the record for fully interlaced mode. Note that the
+C     first three elements contain the three values of the first field,
+C     the forth element contains the value of the second field, and the last two
+C     elements contain the two values of the third field.
+C
+      do 10 rec_num = 1, N_RECORDS
+         data_buf(1, rec_num) = 1.0 * rec_num
+         data_buf(2, rec_num) = 2.0 * rec_num
+         data_buf(3, rec_num) = 3.0 * rec_num
+         data_buf(4, rec_num) = 0.1 + rec_num
+         data_buf(5, rec_num) = 0.0
+         data_buf(6, rec_num) = 65.0
+10    continue
+C
+C     Write the data from data_buf to the vdata with the full interlacing mode.
+C
+      num_of_records = vsfwrt(vdata_id, data_buf, N_RECORDS,
+     +                        FULL_INTERLACE)
+C
+C     Terminate access to the vdata and to the VS interface, and
+C     close the HDF file.
+C
+      status = vsfdtch(vdata_id)
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VG_add_sds_to_vgroup.f b/hdf/fortran/examples/VG_add_sds_to_vgroup.f
new file mode 100644
index 0000000..9f0063a
--- /dev/null
+++ b/hdf/fortran/examples/VG_add_sds_to_vgroup.f
@@ -0,0 +1,91 @@
+      program  add_SDS_to_a_vgroup
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      character*7  SDS_NAME
+      character*9  VG_NAME
+      character*13 VG_CLASS
+C
+      parameter (FILE_NAME = 'General_Vgroups.hdf',
+     +           SDS_NAME  = 'Test SD',
+     +           VG_NAME   = 'SD Vgroup',
+     +           VG_CLASS  = 'Common Vgroups')
+      integer DFACC_CREATE, DFACC_WRITE 
+      parameter (DFACC_CREATE = 4, DFACC_WRITE = 2)
+      integer DFNT_INT32
+      parameter (DFNT_INT32 = 24)
+      integer DFTAG_NDG
+      parameter (DFTAG_NDG = 720)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vfatch, vfsnam, vfscls, vfadtr, vfdtch, vfend
+      integer sfstart, sfcreate, sfid2ref, sfendacc, sfend
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer vgroup_id
+      integer sd_id, sds_id, sds_ref
+      integer dim_sizes(1), rank
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Create the HDF file.
+C
+      file_id = hopen(FILE_NAME, DFACC_CREATE, 0)
+C
+C     Initialize the V interface.
+C
+      status = vfstart(file_id)
+       
+C
+C     Initialize SD interface. 
+C
+      sd_id = sfstart(FILE_NAME, DFACC_WRITE) 
+C
+C     Set the rank and the size of SDS's dimension.
+C
+      rank = 1
+      dim_sizes(1) = 10
+C
+C     Create the SDS.
+C
+      sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, rank, dim_sizes)
+C
+C     Create a vgroup and set its name and class.
+C
+      vgroup_id = vfatch(file_id, -1 , 'w')
+      status    = vfsnam(vgroup_id, VG_NAME)
+      status    = vfscls(vgroup_id, VG_CLASS)
+C
+C     Obtain the reference number of the SDS using its identifier.
+C
+      sds_ref = sfid2ref(sds_id)
+C
+C     Add the SDS to the vgroup. Note: the tag DFTAG_NDG is used
+C     when adding an SDS.  Refer to HDF Reference Manual, Section III, Table 3K,
+C     for the entire list of tags.
+C
+      status = vfadtr(vgroup_id, DFTAG_NDG, sds_ref)
+C
+C     Terminate access to the SDS and to the SD interface.
+C
+      status = sfendacc(sds_id)
+      status = sfend(sd_id)
+C
+C     Terminate access to the vgroup.
+C
+      status = vfdtch(vgroup_id)
+C
+C     Terminate access to the V interface and close the HDF file.
+C
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VG_create_vgroup.f b/hdf/fortran/examples/VG_create_vgroup.f
new file mode 100644
index 0000000..bb894ca
--- /dev/null
+++ b/hdf/fortran/examples/VG_create_vgroup.f
@@ -0,0 +1,61 @@
+      program  create_vgroup
+      implicit none
+C
+C     Parameter declaration
+C
+      character*15 FILE_NAME
+C
+      parameter (FILE_NAME = 'Two_Vgroups.hdf')
+      integer DFACC_CREATE
+      parameter (DFACC_CREATE = 4)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vfatch, vfdtch, vfend
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer vgroup1_id, vgroup2_id, vgroup_ref
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Create the HDF file.
+C
+      file_id = hopen(FILE_NAME, DFACC_CREATE, 0)
+C
+C     Initialize the V interface.
+C
+      status = vfstart(file_id)
+C
+C     Create the first vgroup. Note that the vgroup reference number is set
+C     to -1 for creating and the access mode is 'w' for writing.
+C
+      vgroup_ref = -1
+      vgroup1_id = vfatch(file_id, vgroup_ref, 'w')
+C
+C     Create the second vgroup.
+C
+      vgroup2_id = vfatch(file_id, vgroup_ref, 'w')
+C
+C     Any operations on the vgroups.
+C
+C     ..............................
+C
+C     Terminate access to the first vgroup.
+C
+      status = vfdtch(vgroup1_id)
+C
+C     Terminate access to the second vgroup.
+C
+      status = vfdtch(vgroup2_id)
+C
+C     Terminate access to the V interface and close the HDF file.
+C
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VG_get_vgroup_info.f b/hdf/fortran/examples/VG_get_vgroup_info.f
new file mode 100644
index 0000000..40cc1d4
--- /dev/null
+++ b/hdf/fortran/examples/VG_get_vgroup_info.f
@@ -0,0 +1,97 @@
+      program  getinfo_about_vgroup
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+C
+      parameter (FILE_NAME = 'General_Vgroups.hdf')
+      integer DFACC_READ
+      parameter (DFACC_READ = 1)
+      integer SIZE
+      parameter(SIZE = 10)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vfatch, vfgnam, vfgcls, vflone, vfdtch, vfend
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer vgroup_id
+      integer lone_vg_number, num_of_lones
+      character*64 vgroup_name, vgroup_class
+      integer ref_array(SIZE)
+      integer i
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Initialize ref_array.
+C
+      do 10 i = 1, SIZE
+         ref_array(i) = 0
+10    continue
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the V interface.
+C
+      status = vfstart(file_id)
+C
+C     Get and print the name and class name of all lone vgroups.
+C     First, call vflone with num_of_lones set to 0 to get the number of
+C     lone vgroups in the file and check whether size of ref_array is 
+C     big enough to hold reference numbers of ALL lone groups.
+C     If ref_array is not big enough, exit the program after displaying an
+C     informative message.
+C
+      num_of_lones = 0
+      num_of_lones = vflone(file_id, ref_array, num_of_lones)
+      if (num_of_lones .gt. SIZE) then
+      write(*,*) num_of_lones, 'lone vgroups is found'
+      write(*,*) 'increase the size of ref_array to hold reference '
+      write(*,*) 'numbers of all lone vgroups in the file'
+      stop
+      endif
+C
+C     If there are any lone groups in the file,
+C
+      if (num_of_lones .gt. 0) then
+C
+C     call vflone again to retrieve the reference numbers into ref_array.
+C
+      num_of_lones = vflone(file_id, ref_array, num_of_lones)
+C
+C     Display the name and class of each vgroup.
+C
+      write(*,*) 'Lone vgroups in the file are:'
+
+      do 20 lone_vg_number = 1, num_of_lones
+C
+C     Attach to the current vgroup, then get and display its name and class.
+C     Note: the current vgroup must be detached before moving to the next.  
+C
+      vgroup_name = ' '
+      vgroup_class = ' '
+      vgroup_id = vfatch(file_id, ref_array(lone_vg_number), 'r')
+      status    = vfgnam(vgroup_id, vgroup_name)
+      status    = vfgcls(vgroup_id, vgroup_class)
+      write(*,*) 'Vgroup name ' ,  vgroup_name
+      write(*,*) 'Vgroup class ' , vgroup_class
+      write(*,*)
+      status = vfdtch(vgroup_id)
+20    continue
+
+      endif
+C
+C     Terminate access to the V interface and close the HDF file.
+C
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f b/hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f
new file mode 100644
index 0000000..57258cc
--- /dev/null
+++ b/hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f
@@ -0,0 +1,167 @@
+      program  add_vdatas_to_a_vgroup
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      character*8  VG_NAME
+      character*10 VG_CLASS
+      character*15 VD1_NAME
+      character*8  VD1_CLASS
+      character*11 VD2_NAME
+      character*13 VD2_CLASS
+      character*9  VD3_NAME
+      character*4  VD3_CLASS
+C
+      parameter (FILE_NAME = 'General_Vgroups.hdf',
+     +           VG_NAME   = 'Vertices',
+     +           VG_CLASS  = 'Vertex Set')
+      parameter (VD1_NAME  = 'X,Y Coordinates',
+     +           VD2_NAME  = 'Temperature',
+     +           VD3_NAME  = 'Node List')
+      parameter (VD1_CLASS = 'Position',
+     +           VD2_CLASS = 'Property List',
+     +           VD3_CLASS = 'Mesh')
+      character*2 FIELD1_VD1
+      character*2 FIELD2_VD1
+      character*3 FIELD_VD2
+      character*4 FIELD_VD3
+      character*5 FIELDNAME_LIST
+      parameter (FIELD1_VD1 = 'PX',
+     +           FIELD2_VD1 = 'PY',
+     +           FIELD_VD2  = 'TMP',
+     +           FIELD_VD3  = 'PLIST',
+     +           FIELDNAME_LIST = 'PX,PY')
+      integer N_RECORDS
+      parameter (N_RECORDS = 30)
+      
+      integer  DFACC_WRITE 
+      parameter (DFACC_WRITE = 2)
+      integer DFNT_FLOAT32, DFNT_INT16
+      parameter (DFNT_FLOAT32 = 5, DFNT_INT16 = 22)
+      integer FULL_INTERLACE 
+      parameter (FULL_INTERLACE = 0)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vfatch, vfsnam, vfscls, vfinsrt, vfdtch, vfend
+      integer vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, 
+     +        vsfwrt, vsfwrtc, vsfdtch
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer vgroup_id
+      integer vdata1_id, vdata2_id, vdata3_id, vd_index 
+      integer num_of_records
+      integer i, j, k
+      real    pxy(2,N_RECORDS), tmp(N_RECORDS)
+      integer plist(3,N_RECORDS)
+      data pxy /-1.5, 2.3, -1.5, 1.98, -2.4, .67,
+     +          -3.4, 1.46, -.65, 3.1, -.62, 1.23,
+     +          -.4, 3.8, -3.55, 2.3, -1.43, 2.44,
+     +          .23, 1.13, -1.4, 5.43, -1.4, 5.8,
+     +          -3.4, 3.85, -.55, .3, -.21, 1.22,
+     +          -1.44, 1.9, -1.4, 2.8, .94, 1.78,
+     +          -.4, 2.32, -.87, 1.99, -.54, 4.11,
+     +          -1.5, 1.35, -1.4, 2.21, -.22, 1.8,
+     +          -1.1, 4.55, -.44, .54, -1.11, 3.93,
+     +          -.76, 1.9, -2.34, 1.7, -2.2, 1.21/
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the V interface.
+C
+      status = vfstart(file_id)
+C
+C     Buffer the data for the third and second vdatas.
+C
+      do 20 i = 1, N_RECORDS
+         do 10 j = 1, 3 
+            plist(j,i) = k 
+            k = k+1
+10       continue
+20    continue    
+      do 30 i = 1, N_RECORDS
+         tmp(i) = (i-1) * 10.0
+30    continue
+C
+C     Create a vgroup and set its name and class.
+C     Note that the vgroup's reference number is set to -1 for creating
+C     and the access mode is 'w' for writing.
+C
+      vgroup_id = vfatch(file_id, -1 , 'w')
+      status    = vfsnam(vgroup_id, VG_NAME)
+      status    = vfscls(vgroup_id, VG_CLASS)
+C
+C     Create the first vdata then set its name and class. Note that the vdata's
+C     reference number is set to -1 for creating and the access mode is 'w' for
+C     writing.
+C
+      vdata1_id = vsfatch(file_id, -1, 'w')
+      status = vsfsnam(vdata1_id, VD1_NAME)
+      status = vsfscls(vdata1_id, VD1_CLASS)
+C
+C     Introduce and define the fields of the first vdata.
+C
+      status = vsffdef(vdata1_id, FIELD1_VD1, DFNT_FLOAT32, 1)
+      status = vsffdef(vdata1_id, FIELD2_VD1, DFNT_FLOAT32, 1)
+      status = vsfsfld(vdata1_id, FIELDNAME_LIST)
+C
+C     Write the buffered data into the first vdata.
+C
+      num_of_records = vsfwrt(vdata1_id, pxy, N_RECORDS,
+     +                        FULL_INTERLACE)
+C
+C     Insert the vdata into the vgroup using its identifier.
+C
+      vd_index = vfinsrt(vgroup_id, vdata1_id)
+C
+C     Detach from the first vdata.
+C
+      status = vsfdtch(vdata1_id)
+C
+C     Create, write, and insert the second vdata to the vgroup using
+C     steps similar to those used for the first vdata.
+C
+      vdata2_id = vsfatch(file_id, -1, 'w')
+      status = vsfsnam(vdata2_id, VD2_NAME)
+      status = vsfscls(vdata2_id, VD2_CLASS)
+      status = vsffdef(vdata2_id, FIELD_VD2, DFNT_FLOAT32, 1)
+      status = vsfsfld(vdata2_id, FIELD_VD2)
+      num_of_records = vsfwrt(vdata2_id, tmp, N_RECORDS,
+     +                        FULL_INTERLACE)
+      vd_index = vfinsrt(vgroup_id, vdata2_id)
+      status = vsfdtch(vdata2_id)
+C
+C     Create, write, and insert the third vdata to the vgroup using 
+C     steps similar to those used for the first and second vdatas.
+C
+      vdata3_id = vsfatch(file_id, -1, 'w')
+      status = vsfsnam(vdata3_id, VD3_NAME)
+      status = vsfscls(vdata3_id, VD3_CLASS)
+      status = vsffdef(vdata3_id, FIELD_VD3, DFNT_INT16, 3)
+      status = vsfsfld(vdata3_id, FIELD_VD3)
+      num_of_records = vsfwrtc(vdata3_id, plist, N_RECORDS,
+     +                        FULL_INTERLACE)
+      vd_index = vfinsrt(vgroup_id, vdata3_id)
+      status = vsfdtch(vdata3_id)
+ 
+C
+C     Terminate access to the vgroup 'Vertices'.
+C
+      status = vfdtch(vgroup_id)
+C
+C     Terminate access to the V interface and close the HDF file.
+C
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VG_set_get_vgroup_attr.f b/hdf/fortran/examples/VG_set_get_vgroup_attr.f
new file mode 100644
index 0000000..cb14aa1
--- /dev/null
+++ b/hdf/fortran/examples/VG_set_get_vgroup_attr.f
@@ -0,0 +1,106 @@
+      program  vgroup_attribute
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+      character*9  VGROUP_NAME
+      character*15 VGATTR_NAME
+C
+      parameter (FILE_NAME    = 'General_Vgroups.hdf',
+     +           VGROUP_NAME  = 'SD Vgroup',
+     +           VGATTR_NAME  = 'First Attribute')
+      integer VSET_NEW_VERSION, VSET_VERSION, VSET_OLD_VERSION
+      parameter (VSET_NEW_VERSION = 4,
+     +           VSET_VERSION     = 3,
+     +           VSET_OLD_VERSION = 2)  
+      integer DFACC_WRITE 
+      parameter (DFACC_WRITE = 2)
+      integer DFNT_CHAR
+      parameter (DFNT_CHAR = 4)
+      integer N_ATT_VALUES
+      parameter (N_ATT_VALUES = 6)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vfatch, vfgver, vfscatt, vfnatts, vfainfo,
+     +        vfind, vfgcatt, vfdtch, vfend
+C
+C**** Variable declaration *******************************************
+C
+      integer status, n_attrs
+      integer file_id
+      integer vgroup_id, vgroup_ref, vg_version
+      integer attr_index, i
+      integer data_type, n_values, size 
+      character vg_attr(N_ATT_VALUES)
+      character vgattr_buf(N_ATT_VALUES), attr_name(30)
+      data vg_attr /'v','g','r','o','u','p'/
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading/writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+C
+C     Initialize the V interface.
+C
+      status = vfstart(file_id)
+C
+C     Get the reference number of the vgroup named VGROUP_NAME.
+C
+      vgroup_ref = vfind(file_id, VGROUP_NAME)
+C
+C     Attach to the vgroup found.
+C
+      vgroup_id = vfatch(file_id, vgroup_ref , 'w')
+C
+C     Get and display the version of the attached vgroup.
+C
+      vg_version = vfgver(vgroup_id)
+      if (vg_version .eq. VSET_NEW_VERSION) write(*,*)
+     +   VGROUP_NAME, ' is of the newest version, version 4'
+      if (vg_version .eq. VSET_VERSION) write(*,*)
+     +   VGROUP_NAME, ' is of a version between 3.2 and 4.0r2'
+      if(vg_version .eq. VSET_OLD_VERSION) write(*,*)
+     +   VGROUP_NAME, ' is of version before 3.2'
+      if ((vg_version .ne. VSET_NEW_VERSION) .and.
+     +    (vg_version .ne. VSET_VERSION)     .and.
+     +    (vg_version .ne. VSET_OLD_VERSION)) write(*,*)   
+     +    'Unknown version'
+C
+C     Add the attribute named VGATTR_NAME to the vgroup.
+C
+      status = vfscatt(vgroup_id, VGATTR_NAME, DFNT_CHAR, N_ATT_VALUES,
+     +                 vg_attr)
+C
+C     Get and display the number of attributes attached to this group.
+C
+      n_attrs = vfnatts(vgroup_id)
+      write(*,*) 'This group has', n_attrs, ' attributes'
+C
+C     Get and display the name and the number of values of each attribute.
+C
+      do 10 attr_index=1, n_attrs
+         status = vfainfo(vgroup_id, attr_index-1, attr_name, data_type,
+     +                    n_values, size)
+      write(*,*) 'Attribute #', attr_index-1, ' is named ', attr_name
+      write(*,*) 'and has', n_values, ' values: '
+C
+C     Get and display the attribute values.
+C
+      status = vfgcatt(vgroup_id, attr_index-1, vgattr_buf)
+      write(*,*) (vgattr_buf(i), i=1,n_values)
+10    continue
+C
+C     Terminate access to the vgroup.
+C
+      status = vfdtch(vgroup_id)
+C
+C     Terminate accessto the V interface and close the HDF file.
+C
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/VG_vgroup_contents.f b/hdf/fortran/examples/VG_vgroup_contents.f
new file mode 100644
index 0000000..336fa14
--- /dev/null
+++ b/hdf/fortran/examples/VG_vgroup_contents.f
@@ -0,0 +1,102 @@
+      program  vgroup_contents
+      implicit none
+C
+C     Parameter declaration
+C
+      character*19 FILE_NAME
+C
+      parameter (FILE_NAME = 'General_Vgroups.hdf')
+      integer DFACC_ READ
+      parameter (DFACC_READ = 1)
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vfatch, vfgid, vntrc, vfgttr, vfisvg,
+     +        vfisvs, vfdtch, vfend
+
+C
+C**** Variable declaration *******************************************
+C
+      integer status
+      integer file_id
+      integer vgroup_id, vgroup_ref,  vgroup_pos
+      integer obj_index, num_of_pairs 
+      integer obj_tag, obj_ref 
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file for reading.
+C
+      file_id = hopen(FILE_NAME, DFACC_READ, 0)
+C
+C     Initialize the V interface.
+C
+      status = vfstart(file_id)
+C
+C     Obtain each vgroup in the file by its reference number, get the
+C     number of objects in the vgroup, and display the information
+C     about that vgroup.
+C
+      vgroup_ref = -1
+      vgroup_pos = 0
+10    continue
+C
+C     Get the reference number of the next vgroup in the file.
+C
+      vgroup_ref = vfgid(file_id, vgroup_ref)
+C
+C     Attach to the vgroup or go to the end if no additional vgroup is found.
+C
+      if(vgroup_ref. eq. -1) goto 100
+      vgroup_id = vfatch(file_id, vgroup_ref , 'r')
+C
+C     Get the total number of objects in the vgroup.
+C
+      num_of_pairs = vntrc(vgroup_id)
+C
+C     If the vgroup contains any object, print the tag/ref number
+C     pair of each object in vgroup, in the order they appear in the
+C     file, and indicate whether the object is a vdata, vgroup, or neither.
+C
+      if (num_of_pairs .gt. 0) then
+         write(*,*) 'Vgroup # ', vgroup_pos, ' contains:'
+         do 20 obj_index = 1, num_of_pairs
+C
+C     Get the tag/ref number pair of the object specified by its index 
+C     and display them.
+C
+         status = vfgttr(vgroup_id, obj_index-1, obj_tag, obj_ref)
+C
+C     State whether the HDF object referred to by obj_ref is a vdata,
+C     a vgroup, or neither.
+C
+         if( vfisvg(vgroup_id, obj_ref) .eq. 1) then
+             write(*,*) 'tag = ', obj_tag, ' ref = ', obj_ref,
+     +       '  <--- is a vgroup '
+         else if ( vfisvs(vgroup_id, obj_ref) .eq. 1) then
+             write(*,*) 'tag = ', obj_tag, ' ref = ', obj_ref,
+     +       '  <--- is a vdata '
+         else
+             write(*,*) 'tag = ', obj_tag, ' ref = ', obj_ref,
+     +       '  <--- neither vdata nor vgroup '
+         endif
+20       continue
+      else
+         write (*,*) 'Vgroup #', vgroup_pos, ' contains no HDF objects'
+      endif
+      write(*,*)
+      vgroup_pos = vgroup_pos + 1
+      goto 10 
+100   continue      
+C
+C     Terminate access to the vgroup.
+C
+      status = vfdtch(vgroup_id)
+C
+C     Terminate access to the V interface and close the HDF file.
+C
+      status = vfend(file_id)
+      status = hclose(file_id)
+      end
diff --git a/hdf/fortran/examples/run-fortran-ex.sh b/hdf/fortran/examples/run-fortran-ex.sh
new file mode 100644
index 0000000..f0f1983
--- /dev/null
+++ b/hdf/fortran/examples/run-fortran-ex.sh
@@ -0,0 +1,162 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF4.  The full HDF4 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 HDF4 document set and
+# is linked from the top-level documents page.  It can also be found at
+# http://hdfgroup.org/HDF4/doc/Copyright.html.  If you do not have
+# access to either file, you may request a copy from help at hdfgroup.org.
+
+#
+#  This file:  run-hdf-c-ex.sh
+# Written by:  Larry Knox
+#       Date:  Jan 17, 2014
+#
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#                                                                               #
+# This script will compile and run the c examples from source files installed   #
+# in .../examples/c using h4cc.  The order for running       #
+# programs with RunTest in the MAIN section below is taken from the Makefile.   #
+# The order is important since some of the test programs use data files created #
+# by earlier test programs.  Any future additions should be placed accordingly. #
+#                                                                               #
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+# Initializations
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+ 
+# Where the tool is installed.
+# default is relative path to installed location of the tools 
+prefix="${prefix:-../../}"
+AR="@AR@"
+RANLIB="@RANLIB@"
+H4TOOL="h4fc"               # The tool name
+H4TOOL_BIN="${prefix}/bin/${H4TOOL}"   # The path of the tool binary
+
+#### Run test ####
+RunTest()
+{
+    TEST_EXEC=$1
+    Test=$1".f"
+
+    echo
+    echo "#################  $1  #################"
+    ${H4TOOL_BIN} -o $TEST_EXEC $Test
+    if [ $? -ne 0 ]
+    then
+        echo "messed up compiling $Test"
+        exit 1
+    fi
+    ./$TEST_EXEC
+}
+
+
+
+##################  MAIN  ##################
+
+# Run tests
+if [ $? -eq 0 ]
+then
+    if (
+        #### hdf examples ####    
+        RunTest VD_create_vdatas &&\
+        rm VD_create_vdatas &&\
+        RunTest VD_write_mixed_vdata &&\
+        rm VD_write_mixed_vdata &&\
+        RunTest VD_write_to_vdata &&\
+        rm VD_write_to_vdata &&\
+        RunTest VD_create_onefield_vdatas &&\
+        rm VD_create_onefield_vdatas &&\
+        RunTest VD_read_from_vdata &&\
+        rm VD_read_from_vdata &&\
+        RunTest VD_read_mixed_vdata &&\
+        rm VD_read_mixed_vdata &&\
+        RunTest VD_get_vdata_info &&\
+        rm VD_get_vdata_info &&\
+        RunTest VD_locate_vdata &&\
+        rm VD_locate_vdata &&\
+        RunTest VG_create_vgroup &&\
+        rm VG_create_vgroup &&\
+        RunTest VG_add_sds_to_vgroup &&\
+        rm VG_add_sds_to_vgroup &&\
+        RunTest VG_insert_vdatas_to_vgroup &&\
+        rm VG_insert_vdatas_to_vgroup &&\
+        RunTest VG_set_get_vgroup_attr &&\
+        rm VG_set_get_vgroup_attr &&\
+        RunTest VG_vgroup_contents &&\
+        rm VG_vgroup_contents &&\
+        RunTest VG_get_vgroup_info &&\
+        rm VG_get_vgroup_info &&\
+        RunTest GR_create_and_write_image &&\
+        rm GR_create_and_write_image &&\
+        RunTest GR_modify_image &&\
+        rm GR_modify_image &&\
+        RunTest GR_set_attribute &&\
+        rm GR_set_attribute &&\
+        RunTest GR_get_attribute &&\
+        rm GR_get_attribute &&\
+        RunTest GR_write_palette &&\
+        rm GR_write_palette &&\
+        RunTest GR_image_info &&\
+        rm GR_image_info &&\
+        RunTest GR_read_image &&\
+        rm GR_read_image &&\
+        RunTest AN_create_annotation &&\
+        rm AN_create_annotation &&\
+        RunTest AN_get_annotation_info &&\
+        rm AN_get_annotation_info &&\
+        RunTest AN_read_annotation &&\
+        rm AN_read_annotation &&\
+        #### mfhdf examples ####
+        RunTest SD_create_sds &&\
+        rm SD_create_sds &&\
+        RunTest SD_write_to_sds &&\
+        rm SD_write_to_sds &&\
+        RunTest SD_write_slab &&\
+        rm SD_write_slab &&\
+        RunTest SD_alter_sds_values &&\
+        rm SD_alter_sds_values &&\
+        RunTest SD_unlimited_sds &&\
+        rm SD_unlimited_sds &&\
+        RunTest SD_mv_sds_to_external &&\
+        rm SD_mv_sds_to_external &&\
+        RunTest SD_read_from_sds &&\
+        rm SD_read_from_sds &&\
+        RunTest SD_read_subsets &&\
+        rm SD_read_subsets &&\
+        RunTest SD_get_info &&\
+        rm SD_get_info &&\
+        RunTest SD_find_sds_by_name &&\
+        rm SD_find_sds_by_name &&\
+        RunTest SD_set_get_dim_info &&\
+        rm SD_set_get_dim_info &&\
+        RunTest SD_dimscale_vs_sds &&\
+        rm SD_dimscale_vs_sds &&\
+        RunTest SD_set_attr &&\
+        rm SD_set_attr &&\
+        RunTest SD_get_attr &&\
+        rm SD_get_attr &&\
+        RunTest SD_compress_sds &&\
+        rm SD_compress_sds &&\
+        RunTest SD_chunking_example &&\
+        rm SD_chunking_example
+        ); then
+        EXIT_VALUE=${EXIT_SUCCESS}
+    else
+        EXIT_VALUE=${EXIT_FAILURE}
+    fi
+fi
+
+# Cleanup
+rm *.o
+rm *.hdf
+echo
+
+exit $EXIT_VALUE 
+
diff --git a/hdf/fortran/hdf_fortrandll.def b/hdf/fortran/hdf_fortrandll.def
new file mode 100644
index 0000000..e4c5ebb
--- /dev/null
+++ b/hdf/fortran/hdf_fortrandll.def
@@ -0,0 +1,338 @@
+EXPORTS
+; DFFF
+DFISHDF
+DFACCESS
+DFOPEN
+DFIISHDF
+DFIACCESS
+DFIOPEN
+
+; DFR8FF
+DFR8NIMAGES
+DFR8WRITEREF
+DFR8READREF
+DFR8ADDIMAGE
+DFR8PUTIMAGE
+DFR8GETIMAGE
+DFR8GETDIMS
+D8WREF
+D8NIMS
+D8RREF
+D8AIMG
+D8PIMG
+D8GIMG
+D8GDIMS
+D8INIMS
+D8IWREF
+D8IRREF
+D8IAIMG
+D8IPIMG
+D8IGIMG
+D8IGDIM
+
+; DF24FF
+DF24READREF
+DF24PUTIMAGE
+DF24ADDIMAGE
+DF24GETIMAGE
+DF24GETDIMS
+D2NIMG
+D2RREF
+D2PIMG
+D2AIMG
+D2GIMG
+D2GDIMS
+D2IRREF
+D2IAIMG
+D2IGIMG
+D2IGDIM
+D2INIMG
+
+; MFGRFF
+MGGNLUTS
+MGGCOMPRESS
+MGSCOMPRESS
+MGWCHNK
+MGWCCHNK
+MGSCHNK
+MGSCCHNK
+MGRCHNK
+MGRCCHNK
+MGGICHNK
+MGFNDAT
+MGSATTR
+MGSNATT
+MGSCATT
+MGSXFIL
+MGN2NDX
+MGCREAT
+MGCGNLUTS
+MGCGCOM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
+VGNXTC
+VGIDC
+VINQC
+VGCLSC
+VGNAMC
+VDTCHC
+VATCHC
+
+; DFANFF
+DFANADDFID
+DFANLABLIST
+DFANPUTDESC
+DFANPUTLABEL
+DFANGETDESC
+DFANGETDESCLEN
+DFANGETLABEL
+DFANGETLABLEN
+DAAFID
+DALLIST
+DAPDESC
+DAPLAB
+DAGDESC
+DAGDLEN
+DAGLAB
+DAGLLEN
+DAIAFID
+DAILIST
+DAIPANN
+DAIGANN
+DAIGANL
diff --git a/hdf/src/.indent.pro b/hdf/src/.indent.pro
new file mode 100644
index 0000000..957bed0
--- /dev/null
+++ b/hdf/src/.indent.pro
@@ -0,0 +1 @@
+-bap -sob -l78 -c1 -cp8 -bl -nce -cli4 -ss -npcs -di12 -nbc -psl -i4 -ts4 -lp -nip -lps -T uint8 -T int8 -T uint16 -T int16 -T uint32 -T int32 -T intn -T uintn -T float32 -T float64 -T VOIDP -T dd_t
diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt
new file mode 100644
index 0000000..67f1f73
--- /dev/null
+++ b/hdf/src/CMakeLists.txt
@@ -0,0 +1,162 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_HDF_SRC C CXX)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (
+    ${HDF4_HDF_BINARY_DIR}
+    ${HDF4_HDFSOURCE_DIR}
+)
+LINK_DIRECTORIES (
+    ${HDF4_HDF_BINARY_DIR}
+    ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+SET (HDF4_HDF_SRC_CSRCS
+    ${HDF4_HDF_SRC_SOURCE_DIR}/atom.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/bitvect.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cnbit.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cnone.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/crle.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cszip.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/df24.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfan.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfcomp.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfconv.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfgr.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfgroup.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfimcomp.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfjpeg.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfknat.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfkswap.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfp.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfr8.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfrle.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfsd.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfstubs.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfunjpeg.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfutil.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dynarray.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/glist.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hbitio.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hblocks.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hbuffer.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hchunks.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hcomp.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hcompri.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hdatainfo.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hdfalloc.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/herr.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hextelt.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hfile.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hfiledd.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hkit.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/linklist.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mcache.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mfan.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mstdio.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/tbbt.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vattr.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vconv.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vg.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vgp.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vhi.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vio.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vparse.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vrw.c
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vsfld.c
+)
+
+SET (HDF4_HDF_SRC_CHDRS
+    ${HDF4_HDF_SRC_SOURCE_DIR}/atom.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/bitvect.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cnbit.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cnone.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/crle.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/cszip.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/df.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfan.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfgr.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfrig.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfi.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfsd.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfstubs.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/dynarray.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/glist.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/H4api_adpt.h
+    #${HDF4_BINARY_DIR}/h4config.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hbitio.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hchunks.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hcomp.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hcompi.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hconv.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hdatainfo.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hdf.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hdfi.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/herr.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hfile.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hkit.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hlimits.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hntdefs.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hproto.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/hqueue.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/htags.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/linklist.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mcache.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mfan.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/mstdio.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/tbbt.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vattr.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vg.h
+    ${HDF4_HDF_SRC_SOURCE_DIR}/vgint.h
+)
+
+ADD_LIBRARY (${HDF4_SRC_LIB_TARGET} ${LIB_TYPE} ${HDF4_HDF_SRC_CSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_BINARY_DIR}/h4config.h)
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+TARGET_C_PROPERTIES (${HDF4_SRC_LIB_TARGET} " " " ")
+TARGET_LINK_LIBRARIES (${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_SRC_LIB_TARGET} ${HDF4_SRC_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+    FILES
+        ${HDF4_HDF_SRC_CHDRS}
+    DESTINATION
+        ${HDF4_INSTALL_INCLUDE_DIR}
+    COMPONENT
+        headers
+)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF4_EXPORTED_TARGETS)
+  IF (BUILD_SHARED_LIBS)
+    INSTALL_TARGET_PDB (${HDF4_SRC_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries)
+  ENDIF (BUILD_SHARED_LIBS)
+  
+  INSTALL (
+      TARGETS 
+          ${HDF4_SRC_LIB_TARGET}
+      EXPORT
+          ${HDF4_EXPORTED_TARGETS}
+      LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries 
+      ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
+      RUNTIME DESTINATION ${HDF4_INSTALL_BIN_DIR} COMPONENT libraries
+  )
+ENDIF (HDF4_EXPORTED_TARGETS)
+
diff --git a/hdf/src/H4api_adpt.h b/hdf/src/H4api_adpt.h
new file mode 100644
index 0000000..e3f7f55
--- /dev/null
+++ b/hdf/src/H4api_adpt.h
@@ -0,0 +1,220 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hdfi.h 5435 2010-08-11 17:31:24Z byrn $ */
+
+#ifndef H4API_ADPT_H
+#define H4API_ADPT_H
+
+#include "h4config.h"
+
+/**
+ * Provide the macros to adapt the HDF public functions to
+ * dll entry points.
+ * In addition it provides error lines if the configuration is incorrect.
+ **/
+
+
+/* This will only be defined if HDF4 was built with CMake */
+#if defined(H4_BUILT_AS_DYNAMIC_LIB)
+
+#if defined(xdr_EXPORTS)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define XDRLIBAPI extern __declspec(dllexport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define XDRLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif /* xdr_EXPORTS */
+
+#if defined(hdf_EXPORTS)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFERRPUBLIC __declspec(dllimport)
+    #define HDFPUBLIC __declspec(dllexport)
+    #define HDFLIBAPI extern __declspec(dllexport)
+    #define HDFFCLIBAPI extern __declspec(dllimport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFERRPUBLIC extern __attribute__ ((visibility("default")))
+    #define HDFPUBLIC __attribute__ ((visibility("default")))
+    #define HDFLIBAPI extern __attribute__ ((visibility("default")))
+    #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif /* hdf_EXPORTS */
+
+#if defined(hdf_fcstub_EXPORTS)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFPUBLIC __declspec(dllexport)
+    #define HDFLIBAPI extern __declspec(dllimport)
+    #define HDFFCLIBAPI extern __declspec(dllexport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFPUBLIC __attribute__ ((visibility("default")))
+    #define HDFLIBAPI extern __attribute__ ((visibility("default")))
+    #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif /* hdf_fcstub_EXPORTS */
+
+#if defined(mfhdf_EXPORTS)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFERRPUBLIC extern __declspec(dllimport)
+    #define HDFPUBLIC __declspec(dllimport)
+    #define HDFLIBAPI extern __declspec(dllexport)
+    #define HDFFCLIBAPI extern __declspec(dllimport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFERRPUBLIC extern __attribute__ ((visibility("default")))
+    #define HDFPUBLIC __attribute__ ((visibility("default")))
+    #define HDFLIBAPI extern __attribute__ ((visibility("default")))
+    #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif /* mfhdf_EXPORTS */
+
+#if defined(mfhdf_fcstub_EXPORTS)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFPUBLIC __declspec(dllimport)
+    #define HDFLIBAPI extern __declspec(dllimport)
+    #define HDFFCLIBAPI extern __declspec(dllexport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFPUBLIC __attribute__ ((visibility("default")))
+    #define HDFLIBAPI extern __attribute__ ((visibility("default")))
+    #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif /* mfhdf_fcstub_EXPORTS */
+
+#if defined(hdf_test_fcstub_EXPORTS)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFFCLIBAPI extern __declspec(dllexport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif/* hdf_test_fcstub_EXPORTS */
+
+#if !defined(XDRLIBAPI)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define XDRLIBAPI extern __declspec(dllimport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define XDRLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif
+#if !defined(HDFERRPUBLIC)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFERRPUBLIC extern __declspec(dllimport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFERRPUBLIC extern __attribute__ ((visibility("default")))
+  #endif
+#endif
+#if !defined(HDFPUBLIC)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFPUBLIC __declspec(dllimport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFPUBLIC __attribute__ ((visibility("default")))
+  #endif
+#endif
+#if !defined(HDFLIBAPI)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFLIBAPI extern __declspec(dllimport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif
+#if !defined(HDFFCLIBAPI)
+  #if defined (_MSC_VER)  /* MSVC Compiler Case */
+    #define HDFFCLIBAPI extern __declspec(dllimport)
+  #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
+    #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
+  #endif
+#endif
+
+#elif defined(H4_BUILT_AS_STATIC_LIB)
+  #define XDRLIBAPI extern
+  #define HDFERRPUBLIC extern
+  #define HDFPUBLIC
+  #define HDFLIBAPI extern
+  #define HDFFCLIBAPI extern
+
+#else
+/* This is the original HDFGroup defined preprocessor code which should still work
+ * with the VS projects that are maintained by "The HDF Group"
+ * This will be removed after the next release.
+ */
+
+#ifdef _WIN32
+/**
+ * Under _WIN32 we have single threaded static libraries, or
+ * mutli-threaded DLLs using the multithreaded runtime DLLs.
+ **/
+#  if defined(_MT) &&  defined(_DLL) &&!defined(_HDFDLL_)
+/*     If the user really meant to use _HDFDLL_, but he forgot, just define it. */
+#      define _HDFDLL_
+#  endif
+
+#  if !defined(_MT) && defined(_HDFDLL_)
+#      error To use the HDF libraries from a single-threaded project, you must use static HDF libraries
+#      error Undefine the macro "_HDFDLL_"
+#  endif
+
+#  if defined(xdr_EXPORTS)
+#      define XDRLIBAPI extern __declspec(dllexport)
+#  endif /* xdr_EXPORTS */
+
+#  if defined(_HDFDLL_)
+#    pragma warning( disable: 4273 ) /* Disable the stupid dll linkage warnings */
+#    if defined(_HDFLIB_)
+#      define HDFPUBLIC __declspec(dllexport)
+#      define HDFLIBAPI extern __declspec(dllexport)
+#    endif
+
+#    if defined(_MFHDFLIB_)
+#      define HDFLIBAPI extern __declspec(dllexport)
+#    endif
+
+#    if defined(_HDFLIB_C_STUB_EXPORTS) || defined(_MFHDFLIB_C_STUB_EXPORTS) || defined(_DLLLIBTEST_FCSTUB_EXPORTS)
+#      define HDFFCLIBAPI extern __declspec(dllexport)
+#    endif 
+
+#    if defined(_HDFLIB_C_STUB_EXPORTS)
+#      define HDFPUBLIC __declspec(dllexport)
+#    endif
+
+#    if !defined(XDRLIBAPI)
+#      define XDRLIBAPI extern __declspec(dllimport)
+#    endif
+#    if !defined(HDFERRPUBLIC)
+       #define HDFERRPUBLIC extern __declspec(dllimport)
+#    endif
+#    if !defined(HDFPUBLIC)
+#      define HDFPUBLIC __declspec(dllimport)
+#    endif
+#    if !defined(HDFLIBAPI)
+#      define HDFLIBAPI extern __declspec(dllimport)
+#    endif
+#    if !defined(HDFFCLIBAPI)
+#      define HDFFCLIBAPI extern __declspec(dllimport)
+#    endif
+
+#  else
+#    define XDRLIBAPI extern
+#    define HDFERRPUBLIC extern
+#    define HDFPUBLIC
+#    define HDFLIBAPI extern
+#    define HDFFCLIBAPI extern
+#  endif
+#else  /* !defined( _WIN32 ) */
+#  define XDRLIBAPI extern
+#  define HDFERRPUBLIC extern
+#  define HDFPUBLIC
+#  define HDFLIBAPI extern
+#  define HDFFCLIBAPI extern
+#endif
+
+#endif /*H4_BUILT_AS_DYNAMIC_LIB  */
+
+
+#endif /* H4API_ADPT_H */
diff --git a/hdf/src/Makefile.am b/hdf/src/Makefile.am
new file mode 100644
index 0000000..7b0908f
--- /dev/null
+++ b/hdf/src/Makefile.am
@@ -0,0 +1,63 @@
+#############################################################################
+##                          Library to build                               ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+lib_LTLIBRARIES = libdf.la
+
+FSOURCES = df24ff.f dfanf.c dfanff.f dff.c dfff.f dfpf.c dfpff.f dfr8f.c    \
+           dfr8ff.f dfsdf.c dfsdff.f dfufp2iff.f dfutilf.c herrf.c hfilef.c  \
+	   df24f.c dfufp2if.c\
+           hfileff.f mfanf.c mfgrf.c mfgrff.f vattrf.c vattrff.f vgf.c vgff.f 
+CSOURCES = atom.c bitvect.c cdeflate.c cnbit.c cnone.c crle.c cskphuff.c    \
+           cszip.c df24.c dfan.c dfcomp.c dfconv.c dfgr.c dfgroup.c         \
+           dfimcomp.c dfjpeg.c dfknat.c       \
+           dfkswap.c dfp.c dfr8.c dfrle.c dfsd.c dfstubs.c         \
+           dfufp2i.c dfunjpeg.c dfutil.c dynarray.c glist.c hbitio.c        \
+           hblocks.c hbuffer.c hchunks.c hcomp.c hcompri.c hdatainfo.c      \
+	   hdfalloc.c herr.c hextelt.c hfile.c hfiledd.c hkit.c linklist.c  \
+	   mcache.c mfan.c mfgr.c mstdio.c tbbt.c vattr.c vconv.c vg.c	    \
+	   vgp.c vhi.c vio.c vparse.c vrw.c vsfld.c
+
+CHEADERS = atom.h bitvect.h cdeflate.h cnbit.h cnone.h cskphuff.h crle.h    \
+           cszip.h df.h dfan.h dfi.h dfgr.h dfrig.h dfsd.h dfstubs.h        \
+           dfufp2i.h dynarray.h H4api_adpt.h h4config.h hbitio.h hchunks.h hcomp.h       \
+           hcompi.h hconv.h hdf.h hdfi.h herr.h hfile.h hkit.h hlimits.h    \
+           hproto.h hntdefs.h htags.h linklist.h mfan.h mfgr.h mstdio.h     \
+           tbbt.h vattr.h vg.h hdatainfo.h
+## hdatainfo.h needs to be added conditionally only, should fix this asap
+FHEADERS = dffunc.f90 hdf.f90 dffunc.inc hdf.inc
+
+if HDF_BUILD_FORTRAN
+libdf_la_SOURCES = $(CSOURCES) $(FSOURCES)
+include_HEADERS = $(CHEADERS) hproto_fortran.h $(FHEADERS)
+else
+libdf_la_SOURCES = $(CSOURCES)
+include_HEADERS = $(CHEADERS)
+endif
+
+# The following is a workaround. Since Fortran is included in this 
+# Makefile.am, automake will always try to use the Fortran linker, even when
+# fortran has been disabled in configure. The Fortran linker gets confused 
+# when shared libraries are enabled, so when Fortran is not enabled,
+# this replaces the Fortran link macro with the C link macro.
+if HDF_BUILD_FORTRAN
+    # do nothing
+else
+    F77LINK = $(LINK)
+endif
+
+SUFFIXES = .inc .f90
+.inc.f90:
+	if test -f $<; then                                             \
+	  sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $< > $*.f90; \
+	else                                                            \
+	  sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $(srcdir)/$< > $*.f90; \
+	fi
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+DISTCLEANFILES = dffunc.f90 hdf.f90
diff --git a/hdf/src/Makefile.in b/hdf/src/Makefile.in
new file mode 100644
index 0000000..bfdd6e7
--- /dev/null
+++ b/hdf/src/Makefile.in
@@ -0,0 +1,832 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/h4config.h.in \
+	$(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am
+F77LINK = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+subdir = hdf/src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libdf_la_LIBADD =
+am__libdf_la_SOURCES_DIST = atom.c bitvect.c cdeflate.c cnbit.c \
+	cnone.c crle.c cskphuff.c cszip.c df24.c dfan.c dfcomp.c \
+	dfconv.c dfgr.c dfgroup.c dfimcomp.c dfjpeg.c dfknat.c \
+	dfkswap.c dfp.c dfr8.c dfrle.c dfsd.c dfstubs.c dfufp2i.c \
+	dfunjpeg.c dfutil.c dynarray.c glist.c hbitio.c hblocks.c \
+	hbuffer.c hchunks.c hcomp.c hcompri.c hdatainfo.c hdfalloc.c \
+	herr.c hextelt.c hfile.c hfiledd.c hkit.c linklist.c mcache.c \
+	mfan.c mfgr.c mstdio.c tbbt.c vattr.c vconv.c vg.c vgp.c vhi.c \
+	vio.c vparse.c vrw.c vsfld.c df24ff.f dfanf.c dfanff.f dff.c \
+	dfff.f dfpf.c dfpff.f dfr8f.c dfr8ff.f dfsdf.c dfsdff.f \
+	dfufp2iff.f dfutilf.c herrf.c hfilef.c df24f.c dfufp2if.c \
+	hfileff.f mfanf.c mfgrf.c mfgrff.f vattrf.c vattrff.f vgf.c \
+	vgff.f
+am__objects_1 = atom.lo bitvect.lo cdeflate.lo cnbit.lo cnone.lo \
+	crle.lo cskphuff.lo cszip.lo df24.lo dfan.lo dfcomp.lo \
+	dfconv.lo dfgr.lo dfgroup.lo dfimcomp.lo dfjpeg.lo dfknat.lo \
+	dfkswap.lo dfp.lo dfr8.lo dfrle.lo dfsd.lo dfstubs.lo \
+	dfufp2i.lo dfunjpeg.lo dfutil.lo dynarray.lo glist.lo \
+	hbitio.lo hblocks.lo hbuffer.lo hchunks.lo hcomp.lo hcompri.lo \
+	hdatainfo.lo hdfalloc.lo herr.lo hextelt.lo hfile.lo \
+	hfiledd.lo hkit.lo linklist.lo mcache.lo mfan.lo mfgr.lo \
+	mstdio.lo tbbt.lo vattr.lo vconv.lo vg.lo vgp.lo vhi.lo vio.lo \
+	vparse.lo vrw.lo vsfld.lo
+am__objects_2 = df24ff.lo dfanf.lo dfanff.lo dff.lo dfff.lo dfpf.lo \
+	dfpff.lo dfr8f.lo dfr8ff.lo dfsdf.lo dfsdff.lo dfufp2iff.lo \
+	dfutilf.lo herrf.lo hfilef.lo df24f.lo dfufp2if.lo hfileff.lo \
+	mfanf.lo mfgrf.lo mfgrff.lo vattrf.lo vattrff.lo vgf.lo \
+	vgff.lo
+ at HDF_BUILD_FORTRAN_FALSE@am_libdf_la_OBJECTS = $(am__objects_1)
+ at HDF_BUILD_FORTRAN_TRUE@am_libdf_la_OBJECTS = $(am__objects_1) \
+ at HDF_BUILD_FORTRAN_TRUE@	$(am__objects_2)
+libdf_la_OBJECTS = $(am_libdf_la_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
+F77LD = $(F77)
+SOURCES = $(libdf_la_SOURCES)
+DIST_SOURCES = $(am__libdf_la_SOURCES_DIST)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__include_HEADERS_DIST = atom.h bitvect.h cdeflate.h cnbit.h cnone.h \
+	cskphuff.h crle.h cszip.h df.h dfan.h dfi.h dfgr.h dfrig.h \
+	dfsd.h dfstubs.h dfufp2i.h dynarray.h H4api_adpt.h h4config.h \
+	hbitio.h hchunks.h hcomp.h hcompi.h hconv.h hdf.h hdfi.h \
+	herr.h hfile.h hkit.h hlimits.h hproto.h hntdefs.h htags.h \
+	linklist.h mfan.h mfgr.h mstdio.h tbbt.h vattr.h vg.h \
+	hdatainfo.h hproto_fortran.h dffunc.f90 hdf.f90 dffunc.inc \
+	hdf.inc
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+lib_LTLIBRARIES = libdf.la
+FSOURCES = df24ff.f dfanf.c dfanff.f dff.c dfff.f dfpf.c dfpff.f dfr8f.c    \
+           dfr8ff.f dfsdf.c dfsdff.f dfufp2iff.f dfutilf.c herrf.c hfilef.c  \
+	   df24f.c dfufp2if.c\
+           hfileff.f mfanf.c mfgrf.c mfgrff.f vattrf.c vattrff.f vgf.c vgff.f 
+
+CSOURCES = atom.c bitvect.c cdeflate.c cnbit.c cnone.c crle.c cskphuff.c    \
+           cszip.c df24.c dfan.c dfcomp.c dfconv.c dfgr.c dfgroup.c         \
+           dfimcomp.c dfjpeg.c dfknat.c       \
+           dfkswap.c dfp.c dfr8.c dfrle.c dfsd.c dfstubs.c         \
+           dfufp2i.c dfunjpeg.c dfutil.c dynarray.c glist.c hbitio.c        \
+           hblocks.c hbuffer.c hchunks.c hcomp.c hcompri.c hdatainfo.c      \
+	   hdfalloc.c herr.c hextelt.c hfile.c hfiledd.c hkit.c linklist.c  \
+	   mcache.c mfan.c mfgr.c mstdio.c tbbt.c vattr.c vconv.c vg.c	    \
+	   vgp.c vhi.c vio.c vparse.c vrw.c vsfld.c
+
+CHEADERS = atom.h bitvect.h cdeflate.h cnbit.h cnone.h cskphuff.h crle.h    \
+           cszip.h df.h dfan.h dfi.h dfgr.h dfrig.h dfsd.h dfstubs.h        \
+           dfufp2i.h dynarray.h H4api_adpt.h h4config.h hbitio.h hchunks.h hcomp.h       \
+           hcompi.h hconv.h hdf.h hdfi.h herr.h hfile.h hkit.h hlimits.h    \
+           hproto.h hntdefs.h htags.h linklist.h mfan.h mfgr.h mstdio.h     \
+           tbbt.h vattr.h vg.h hdatainfo.h
+
+FHEADERS = dffunc.f90 hdf.f90 dffunc.inc hdf.inc
+ at HDF_BUILD_FORTRAN_FALSE@libdf_la_SOURCES = $(CSOURCES)
+ at HDF_BUILD_FORTRAN_TRUE@libdf_la_SOURCES = $(CSOURCES) $(FSOURCES)
+ at HDF_BUILD_FORTRAN_FALSE@include_HEADERS = $(CHEADERS)
+ at HDF_BUILD_FORTRAN_TRUE@include_HEADERS = $(CHEADERS) hproto_fortran.h $(FHEADERS)
+ at HDF_BUILD_FORTRAN_FALSE@F77LINK = $(LINK)
+SUFFIXES = .inc .f90
+
+#############################################################################
+#############################################################################
+DISTCLEANFILES = dffunc.f90 hdf.f90
+all: h4config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .inc .f90 .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/src/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign hdf/src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+h4config.h: stamp-h1
+	@if test ! -f $@; then rm -f stamp-h1; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/h4config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status hdf/src/h4config.h
+$(srcdir)/h4config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
+	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+	rm -f stamp-h1
+	touch $@
+
+distclean-hdr:
+	-rm -f h4config.h stamp-h1
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; \
+	locs=`for p in $$list; do echo $$p; done | \
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+	      sort -u`; \
+	test -z "$$locs" || { \
+	  echo rm -f $${locs}; \
+	  rm -f $${locs}; \
+	}
+libdf.la: $(libdf_la_OBJECTS) $(libdf_la_DEPENDENCIES) $(EXTRA_libdf_la_DEPENDENCIES) 
+	$(F77LINK) -rpath $(libdir) $(libdf_la_OBJECTS) $(libdf_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/atom.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bitvect.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdeflate.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cnbit.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cnone.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/crle.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cskphuff.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cszip.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/df24.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/df24f.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfan.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfanf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfcomp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfconv.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dff.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfgr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfgroup.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfimcomp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfjpeg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfknat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfkswap.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfpf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfr8.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfr8f.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfrle.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfsd.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfsdf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfstubs.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfufp2i.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfufp2if.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfunjpeg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfutil.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfutilf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dynarray.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/glist.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hbitio.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hblocks.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hbuffer.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hchunks.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hcomp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hcompri.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdatainfo.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfalloc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/herr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/herrf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hextelt.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hfile.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hfiledd.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hfilef.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hkit.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/linklist.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mcache.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mfan.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mfanf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mfgr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mfgrf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mstdio.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tbbt.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vattr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vattrf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vconv.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vgf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vgp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vhi.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vio.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vparse.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vrw.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vsfld.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES) h4config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) h4config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES) h4config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS) h4config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) h4config.h
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-hdr distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
+.MAKE: all install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool cscopelist ctags distclean \
+	distclean-compile distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am \
+	install-includeHEADERS install-info install-info-am \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-includeHEADERS \
+	uninstall-libLTLIBRARIES
+
+
+# The following is a workaround. Since Fortran is included in this 
+# Makefile.am, automake will always try to use the Fortran linker, even when
+# fortran has been disabled in configure. The Fortran linker gets confused 
+# when shared libraries are enabled, so when Fortran is not enabled,
+# this replaces the Fortran link macro with the C link macro.
+ at HDF_BUILD_FORTRAN_TRUE@    # do nothing
+.inc.f90:
+	if test -f $<; then                                             \
+	  sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $< > $*.f90; \
+	else                                                            \
+	  sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $(srcdir)/$< > $*.f90; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdf/src/atom.c b/hdf/src/atom.c
new file mode 100644
index 0000000..c8c6543
--- /dev/null
+++ b/hdf/src/atom.c
@@ -0,0 +1,685 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5028 $";
+#endif
+
+
+/* $Id: atom.c 5028 2008-01-27 16:49:37Z bmribler $ */
+
+/*
+FILE
+    atom.c - Internal storage routines for handling "atoms"
+
+REMARKS
+    Atoms are just ID's which allow objects (void *'s currently) to be
+    bundled into "groups" for more general storage.
+
+DESIGN
+    The groups are stored in an array of pointers to store each group in an
+    element. Each "atomic group" node contains a link to a hash table to
+    manage the atoms in each group.  The allowed "atomic groups" are stored
+    in an enum (called group_t) in atom.h.
+
+BUGS/LIMITATIONS
+    Can't interate over the atoms in a group.
+
+LOCAL ROUTINES
+  HAIfind_atom      - Returns a pointer to an atom_info_t from a atom ID
+  HAIget_atom_node  - Gets an atom node (uses the atom free list)
+  HAIrelease_atom_node - Releases an atom node (uses the atom free list)
+EXPORTED ROUTINES
+ Atom Functions:
+  HAregister_atom   - Register an object in a group and get an atom for it
+  HAatom_object     - Get the object for an atom
+  HAatom_group      - Get the group for an atom
+  HAremove_atom     - Remove an atom from a group
+  HAsearch_atom     - Search a group for a particular object
+ Atom Group Functions:
+  HAinit_group      - Initialize a group to store atoms in
+  HAdestroy_group   - Destroy an atomic group
+ Atom Group Cleanup:
+  HAshutdown        - Terminate various static buffers.
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   1/3/96  - Starting writing specs & coding prototype
+   1/7/96  - Finished coding prototype
+*/
+
+#define ATOM_MASTER
+#include "hdf.h"
+#include "atom.h"
+#include <assert.h>
+
+/* Private function prototypes */
+static atom_info_t *HAIfind_atom(atom_t atm);
+
+static atom_info_t *HAIget_atom_node(void);
+
+static void HAIrelease_atom_node(atom_info_t *atm);
+
+/******************************************************************************
+ NAME
+     HAinit_group - Initialize an atomic group
+
+ DESCRIPTION
+    Creates a global atomic group to store atoms in.  If the group has already
+    been initialized, this routine just increments the count of # of
+    initializations and returns without trying to change the size of the hash
+    table.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HAinit_group(group_t grp,      /* IN: Group to initialize */
+    intn hash_size                  /* IN: Minimum hash table size to use for group */
+)
+{
+    CONSTR(FUNC, "HAinit_group");	/* for HERROR */
+    atom_group_t *grp_ptr=NULL;     /* ptr to the atomic group */
+    intn ret_value=SUCCEED;
+
+    HEclear();
+    if((grp<=BADGROUP || grp>=MAXGROUP) && hash_size>0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef ATOMS_CACHE_INLINE
+/* Assertion necessary for faster pointer swapping */
+assert(sizeof(hdf_pint_t)==sizeof(void *));
+#endif /* ATOMS_CACHE_INLINE */
+
+#ifdef HASH_SIZE_POWER_2
+    if(hash_size & (hash_size-1))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+#endif /* HASH_SIZE_POWER_2 */
+
+    if(atom_group_list[grp]==NULL)
+      {     /* Allocate the group information */
+          grp_ptr=(atom_group_t *)HDcalloc(1,sizeof(atom_group_t));
+          if(grp_ptr==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          atom_group_list[grp]=grp_ptr;
+      } /* end if */
+    else /* Get the pointer to the existing group */
+        grp_ptr=atom_group_list[grp];
+
+    if(grp_ptr->count==0)
+      {     /* Initialize the atom group structure */
+        grp_ptr->hash_size=hash_size;
+        grp_ptr->atoms=0;
+        grp_ptr->nextid=0;
+        if((grp_ptr->atom_list=(atom_info_t **)HDcalloc(hash_size,sizeof(atom_info_t *)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      } /* end if */
+
+    /* Increment the count of the times this group has been initialized */
+    grp_ptr->count++;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(grp_ptr!=NULL)
+          {
+            if(grp_ptr->atom_list!=NULL)
+                HDfree(grp_ptr->atom_list);
+            HDfree(grp_ptr);
+          } /* end if */
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAinit_group() */
+
+/******************************************************************************
+ NAME
+     HAdestroy_group - Destroy an atomic group
+
+ DESCRIPTION
+    Destroys an atomic group which atoms are stored in.  If the group still
+    has atoms which are registered, this routine fails.  If there have been
+    multiple initializations of the group, this routine just decrements the
+    count of initializations and does not check the atoms out-standing.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HAdestroy_group(group_t grp       /* IN: Group to destroy */
+)
+{
+    CONSTR(FUNC, "HAdestroy_group");	/* for HERROR */
+    atom_group_t *grp_ptr=NULL;     /* ptr to the atomic group */
+    intn ret_value=SUCCEED;
+
+    HEclear();
+    if(grp<=BADGROUP || grp>=MAXGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    grp_ptr=atom_group_list[grp];
+    if(grp_ptr==NULL || grp_ptr->count<=0)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Decrement the number of users of the atomic group */
+    if((--(grp_ptr->count))==0)
+      {
+#ifdef ATOMS_ARE_CACHED
+      {
+        uintn i;
+
+        for(i=0; i<ATOM_CACHE_SIZE; i++)
+            if(ATOM_TO_GROUP(atom_id_cache[i])==grp)
+              {
+                atom_id_cache[i]=(-1);
+                atom_obj_cache[i]=NULL;
+              } /* end if */
+      } /* end block */
+#endif /* ATOMS_ARE_CACHED */
+        HDfree(grp_ptr->atom_list);
+	grp_ptr->atom_list = NULL;
+      } /* end if */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAdestroy_group() */
+
+/******************************************************************************
+ NAME
+     HAregister_atom - Register an object in a group and get an atom for it.
+
+ DESCRIPTION
+    Registers an object in a group and returns an atom for it.  This routine
+    does _not_ check for unique-ness of the objects, if you register an object
+    twice, you will get two different atoms for it.  This routine does make
+    certain that each atom in a group is unique.  Atoms are created by getting
+    a unique number for the group the atom is in and incorporating the group
+    into the atom which is returned to the user.
+
+ RETURNS
+    Returns atom if successful and FAIL otherwise
+
+*******************************************************************************/
+atom_t HAregister_atom(group_t grp,     /* IN: Group to register the object in */
+    VOIDP object                        /* IN: Object to attach to atom */
+)
+{
+    CONSTR(FUNC, "HAregister_atom");	/* for HERROR */
+    atom_group_t *grp_ptr=NULL;     /* ptr to the atomic group */
+    atom_info_t *atm_ptr=NULL;      /* ptr to the new atom */
+    atom_t atm_id;                  /* new atom ID */
+    uintn hash_loc;                 /* new item's hash table location */
+    atom_t ret_value=SUCCEED;
+
+    HEclear();
+    if(grp<=BADGROUP || grp>=MAXGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    grp_ptr=atom_group_list[grp];
+    if(grp_ptr==NULL || grp_ptr->count<=0)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    if((atm_ptr=HAIget_atom_node())==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Create the atom & it's ID */
+    atm_id=MAKE_ATOM(grp,grp_ptr->nextid);
+    atm_ptr->id=atm_id;
+    atm_ptr->obj_ptr=object;
+    atm_ptr->next=NULL;
+
+    /* hash bucket already full, prepend to front of chain */
+    hash_loc=grp_ptr->nextid%(uintn)grp_ptr->hash_size;
+    if(grp_ptr->atom_list[hash_loc]!=NULL)
+        atm_ptr->next=grp_ptr->atom_list[hash_loc];
+
+    /* Insert into the group */
+    grp_ptr->atom_list[hash_loc]=atm_ptr;
+    grp_ptr->atoms++;
+    grp_ptr->nextid++;
+
+    ret_value=atm_id;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAregister_atom() */
+
+/******************************************************************************
+ NAME
+     HAatom_object - Returns to the object ptr for the atom 
+
+ DESCRIPTION
+    Retrieves the object ptr which is associated with the atom.
+
+ RETURNS
+    Returns object ptr if successful and NULL otherwise
+
+*******************************************************************************/
+#ifdef ATOMS_CACHE_INLINE
+VOIDP HAPatom_object(atom_t atm   /* IN: Atom to retrieve object for */
+)
+#else /* ATOMS_CACHE_INLINE */
+VOIDP HAatom_object(atom_t atm   /* IN: Atom to retrieve object for */
+)
+#endif /* ATOMS_CACHE_INLINE */
+{
+    CONSTR(FUNC, "HAatom_object");	/* for HERROR */
+#ifndef ATOMS_CACHE_INLINE
+#ifdef ATOMS_ARE_CACHED
+    uintn i;                        /* local counter */
+#endif /* ATOMS_ARE_CACHED */
+#endif /* ATOMS_CACHE_INLINE */
+    atom_info_t *atm_ptr=NULL;      /* ptr to the new atom */
+    VOIDP ret_value=NULL;
+
+    HEclear();
+
+#ifndef ATOMS_CACHE_INLINE
+#ifdef ATOMS_ARE_CACHED
+    /* Look for the atom in the cache first */
+    for(i=0; i<ATOM_CACHE_SIZE; i++)
+        if(atom_id_cache[i]==atm)
+          {
+            ret_value=atom_obj_cache[i];
+            if(i>0)
+              { /* Implement a simple "move forward" caching scheme */
+                atom_t t_atom=atom_id_cache[i-1];
+                VOIDP  t_obj=atom_obj_cache[i-1];
+
+                atom_id_cache[i-1]=atom_id_cache[i];
+                atom_obj_cache[i-1]=atom_obj_cache[i];
+                atom_id_cache[i]=t_atom;
+                atom_obj_cache[i]=t_obj;
+              } /* end if */
+            HGOTO_DONE(ret_value);
+          } /* end if */
+#endif /* ATOMS_ARE_CACHED */
+#endif /* ATOMS_CACHE_INLINE */
+
+    /* General lookup of the atom */
+    if((atm_ptr=HAIfind_atom(atm))==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+    /* Check if we've found the correct atom */
+    if(atm_ptr!=NULL)
+        ret_value=atm_ptr->obj_ptr;
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAatom_object() */
+
+/******************************************************************************
+ NAME
+     HAatom_group - Returns to the group for the atom 
+
+ DESCRIPTION
+    Retrieves the group which is associated with the atom.
+
+ RETURNS
+    Returns group if successful and BADGROUP otherwise
+
+*******************************************************************************/
+group_t HAatom_group(atom_t atm   /* IN: Atom to retrieve group for */
+)
+{
+    CONSTR(FUNC, "HAatom_group");	/* for HERROR */
+    group_t ret_value=BADGROUP;
+
+    HEclear();
+    ret_value=ATOM_TO_GROUP(atm);
+    if(ret_value<=BADGROUP || ret_value>=MAXGROUP)
+        HGOTO_ERROR(DFE_ARGS, BADGROUP);
+
+done:
+  if(ret_value == BADGROUP)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAatom_group() */
+
+/******************************************************************************
+ NAME
+     HAremove_atom - Removes an atom from a group
+
+ DESCRIPTION
+    Removes an atom from a group.
+
+ RETURNS
+    Returns atom's object if successful and NULL otherwise
+
+*******************************************************************************/
+VOIDP HAremove_atom(atom_t atm   /* IN: Atom to remove */
+)
+{
+    CONSTR(FUNC, "HAremove_atom");	/* for HERROR */
+    atom_group_t *grp_ptr=NULL;     /* ptr to the atomic group */
+    atom_info_t *curr_atm,          /* ptr to the current atom */
+        *last_atm;                  /* ptr to the last atom */
+    group_t grp;                    /* atom's atomic group */
+    uintn hash_loc;                 /* atom's hash table location */
+#ifdef ATOMS_ARE_CACHED
+    uintn i;                        /* local counting variable */
+#endif /* ATOMS_ARE_CACHED */
+    VOIDP ret_value=NULL;
+
+    HEclear();
+    grp=ATOM_TO_GROUP(atm);
+    if(grp<=BADGROUP || grp>=MAXGROUP)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    grp_ptr=atom_group_list[grp];
+    if(grp_ptr==NULL || grp_ptr->count<=0)
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+    /* Get the location in which the atom is located */
+    hash_loc=(uintn)ATOM_TO_LOC(atm,grp_ptr->hash_size);
+    curr_atm=grp_ptr->atom_list[hash_loc];
+    if(curr_atm==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+    last_atm=NULL;
+    while(curr_atm!=NULL)
+      {
+          if(curr_atm->id==atm)
+              break;
+          last_atm=curr_atm;
+          curr_atm=curr_atm->next;
+      } /* end while */
+
+    if(curr_atm!=NULL)
+      {
+          if(last_atm==NULL)    /* atom is the first the chain */
+              grp_ptr->atom_list[hash_loc]=curr_atm->next;
+          else
+              last_atm->next=curr_atm->next;
+          ret_value=curr_atm->obj_ptr;
+          HAIrelease_atom_node(curr_atm);
+      } /* end if */
+    else    /* couldn't find the atom in the proper place */
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+    
+#ifdef ATOMS_ARE_CACHED
+    /* Delete object from cache */
+    for(i=0; i<ATOM_CACHE_SIZE; i++)
+        if(atom_id_cache[i]==atm)
+          {
+            atom_id_cache[i]=(-1);
+            atom_obj_cache[i]=NULL;
+            break;  /* we assume there is only one instance in the cache */
+          } /* end if */
+#endif /* ATOMS_ARE_CACHED */
+
+    /* Decrement the number of atoms in the group */
+    (grp_ptr->atoms)--;
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAremove_atom() */
+
+/******************************************************************************
+ NAME
+     HAsearch_atom - Search for an object in a group and get it's pointer.
+
+ DESCRIPTION
+    Searchs for an object in a group and returns the pointer to it.
+    This routine calls the function pointer passed in for each object in the
+    group until it finds a match.  Currently there is no way to resume a
+    search.
+
+ RETURNS
+    Returns pointer an atom's object if successful and NULL otherwise
+
+*******************************************************************************/
+void * HAsearch_atom(group_t grp,        /* IN: Group to search for the object in */
+    HAsearch_func_t func,               /* IN: Ptr to the comparison function */
+    const void * key                     /* IN: pointer to key to compare against */
+)
+{
+    CONSTR(FUNC, "HAsearch_atom");	/* for HERROR */
+    atom_group_t *grp_ptr=NULL;     /* ptr to the atomic group */
+    atom_info_t *atm_ptr=NULL;      /* ptr to the new atom */
+    intn i;                         /* local counting variable */
+    void * ret_value=NULL;
+
+    HEclear();
+    if(grp<=BADGROUP || grp>=MAXGROUP)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    grp_ptr=atom_group_list[grp];
+    if(grp_ptr==NULL || grp_ptr->count<=0)
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+    /* Start at the beginning of the array */
+    for(i=0; i<grp_ptr->hash_size; i++)
+      {
+        atm_ptr=grp_ptr->atom_list[i];
+        while(atm_ptr!=NULL)
+          {
+              if((*func)(atm_ptr->obj_ptr,key))
+                  HGOTO_DONE(atm_ptr->obj_ptr); /* found the item we are looking for */
+              atm_ptr=atm_ptr->next;
+          } /* end while */
+      } /* end for */
+
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAsearch_atom() */
+
+/******************************************************************************
+ NAME
+     HAIfind_atom - Finds a atom in a group
+
+ DESCRIPTION
+    Retrieves the atom ptr which is associated with the atom.
+
+ RETURNS
+    Returns atom ptr if successful and NULL otherwise
+
+*******************************************************************************/
+static atom_info_t *HAIfind_atom(atom_t atm   /* IN: Atom to retrieve atom for */
+)
+{
+    CONSTR(FUNC, "HAIfind_atom");	/* for HERROR */
+    atom_group_t *grp_ptr=NULL;     /* ptr to the atomic group */
+    atom_info_t *atm_ptr=NULL;      /* ptr to the new atom */
+    group_t grp;                    /* atom's atomic group */
+    uintn hash_loc;                 /* atom's hash table location */
+    atom_info_t *ret_value=NULL;
+
+    HEclear();
+    grp=ATOM_TO_GROUP(atm);
+    if(grp<=BADGROUP || grp>=MAXGROUP)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    grp_ptr=atom_group_list[grp];
+    if(grp_ptr==NULL || grp_ptr->count<=0)
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+    /* Get the location in which the atom is located */
+    hash_loc=(uintn)ATOM_TO_LOC(atm,grp_ptr->hash_size);
+    atm_ptr=grp_ptr->atom_list[hash_loc];
+    if(atm_ptr==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+    while(atm_ptr!=NULL)
+      {
+          if(atm_ptr->id==atm)
+              break;
+          atm_ptr=atm_ptr->next;
+      } /* end while */
+    ret_value=atm_ptr;
+
+#ifdef ATOMS_ARE_CACHED
+    atom_id_cache[ATOM_CACHE_SIZE-1]=atm;
+    atom_obj_cache[ATOM_CACHE_SIZE-1]=atm_ptr->obj_ptr;
+#endif /* ATOMS_ARE_CACHED */
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAIfind_atom() */
+
+/******************************************************************************
+ NAME
+     HAIget_atom_node - Gets an atom node
+
+ DESCRIPTION
+    Either gets an atom node from the free list (if there is one available)
+    or allocate a node.
+
+ RETURNS
+    Returns atom ptr if successful and NULL otherwise
+
+*******************************************************************************/
+static atom_info_t *HAIget_atom_node(void)
+{
+    CONSTR(FUNC, "HAIget_atom_node");	/* for HERROR */
+    atom_info_t *ret_value=NULL;
+
+    HEclear();
+    if(atom_free_list!=NULL)
+      {
+        ret_value=atom_free_list;
+        atom_free_list=atom_free_list->next;
+      } /* end if */
+    else
+      {
+        if((ret_value=(atom_info_t *)HDmalloc(sizeof(atom_info_t)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end else */
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HAIget_atom_node() */
+
+/******************************************************************************
+ NAME
+     HAIrelease_atom_node - Releases an atom node
+
+ DESCRIPTION
+    Puts an atom node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+static void HAIrelease_atom_node(atom_info_t *atm)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HAIrelease_atom_node");	/* for HERROR */
+#endif /* LATER */
+
+    /* Insert the atom at the beginning of the free list */
+    atm->next=atom_free_list;
+    atom_free_list=atm;
+}   /* end HAIrelease_atom_node() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HAshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn HAshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the HA routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+HAshutdown(void)
+{
+    atom_info_t *curr;
+    intn i;
+
+    /* Release the free-list if it exists */
+    if(atom_free_list!=NULL)
+      {
+        while(atom_free_list!=NULL)
+          {
+            curr=atom_free_list;
+            atom_free_list=atom_free_list->next;
+            HDfree(curr);
+          } /* end while */
+      } /* end if */
+
+    for(i=0; i<(intn)MAXGROUP; i++)
+        if(atom_group_list[i]!=NULL)
+          {
+            HDfree(atom_group_list[i]);
+            atom_group_list[i]=NULL;
+          } /* end if */
+  return (SUCCEED);
+}	/* end HAshutdown() */
+
diff --git a/hdf/src/atom.h b/hdf/src/atom.h
new file mode 100644
index 0000000..8df642f
--- /dev/null
+++ b/hdf/src/atom.h
@@ -0,0 +1,303 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: atom.h 5444 2010-08-25 16:40:05Z byrn $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    atom.h
+ * Purpose: header file for atom API
+ * Dependencies: 
+ * Invokes:
+ * Contents:
+ * Structure definitions: 
+ * Constant definitions: 
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __ATOM_H
+#define __ATOM_H
+
+#include "H4api_adpt.h"
+
+/* Atom Features control */
+/* Define the following macro for fast hash calculations (but limited hash sizes) */
+#define HASH_SIZE_POWER_2
+
+/* Define the following macro for atom caching over all the atoms */
+#define ATOMS_ARE_CACHED
+
+/* Define the following macro for "inline" atom lookups from the cache */
+#ifdef ATOMS_ARE_CACHED     /* required for this to work */
+#define ATOMS_CACHE_INLINE
+#endif /* ATOMS_ARE_CACHED */
+
+#ifdef ATOMS_CACHE_INLINE
+/* Do swap using XOR operator. Ugly but fast... -QAK */
+#define HAIswap_cache(i,j) \
+                atom_id_cache[i]^=atom_id_cache[j], \
+                atom_obj_cache[i]=(void *)((hdf_pint_t)atom_obj_cache[j]^(hdf_pint_t)atom_obj_cache[i]), \
+                atom_id_cache[j]^=atom_id_cache[i], \
+                atom_obj_cache[j]=(void *)((hdf_pint_t)atom_obj_cache[i]^(hdf_pint_t)atom_obj_cache[j]), \
+                atom_id_cache[i]^=atom_id_cache[j], \
+                atom_obj_cache[i]=(void *)((hdf_pint_t)atom_obj_cache[i]^(hdf_pint_t)atom_obj_cache[j])
+
+/* Note! This is hardwired to the atom cache value being 4 */
+#define HAatom_object(atm) \
+    (atom_id_cache[0]==atm ? atom_obj_cache[0] : \
+      atom_id_cache[1]==atm ? (HAIswap_cache(0,1),atom_obj_cache[0]) : \
+       atom_id_cache[2]==atm ? (HAIswap_cache(1,2),atom_obj_cache[1]) : \
+        atom_id_cache[3]==atm ? (HAIswap_cache(2,3),atom_obj_cache[2]) : \
+         HAPatom_object(atm))
+#endif /* ATOMS_CACHE_INLINE */
+
+#include "hdf.h"
+
+/* Group values allowed */
+typedef enum {BADGROUP=(-1),    /* Invalid Group */
+DDGROUP=0,                  /* Group ID for DD objects */
+AIDGROUP=1,                 /* Group ID for access ID objects */
+FIDGROUP=2,                 /* Group ID for file ID objects */
+VGIDGROUP=3,                /* Group ID for Vgroup ID objects */
+VSIDGROUP=4,                /* Group ID for Vdata ID objects */
+GRIDGROUP=5,                /* Group ID for GR ID objects */
+RIIDGROUP=6,                /* Group ID for RI ID objects */
+BITIDGROUP=7,               /* Group ID for Bitfile ID objects */
+ANIDGROUP=8,                /* Group ID for Annotation ID objects */
+MAXGROUP                    /* Highest group in group_t (Invalid as true group) */
+} group_t;
+
+/* Type of atoms to return to users */
+typedef int32 atom_t;
+
+/* Type of the function to compare objects & keys */
+typedef intn (*HAsearch_func_t)(const void * obj, const void * key);
+
+#if defined ATOM_MASTER | defined ATOM_TESTER
+
+/* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */
+#define GROUP_BITS  4
+#define GROUP_MASK  0x0F
+
+/* # of bits to use for the Atom index in each atom (change if MAXGROUP>16) */
+#define ATOM_BITS   28
+#define ATOM_MASK   0x0FFFFFFF
+
+#ifdef ATOMS_ARE_CACHED
+/* # of previous atoms cached, change inline caching macros (HAatom_object & HAIswap_cache) if this changes */
+#define ATOM_CACHE_SIZE 4
+#endif /* ATOMS_ARE_CACHED */
+
+/* Map an atom to a Group number */
+#define ATOM_TO_GROUP(a)    ((group_t)((((atom_t)(a))>>((sizeof(atom_t)*8)-GROUP_BITS))&GROUP_MASK))
+
+#ifdef HASH_SIZE_POWER_2
+/* Map an atom to a hash location (assumes s is a power of 2 and smaller than the ATOM_MASK constant) */
+#define ATOM_TO_LOC(a,s)    ((atom_t)(a)&((s)-1))
+#else /* HASH_SIZE_POWER_2 */
+/* Map an atom to a hash location */
+#define ATOM_TO_LOC(a,s)    (((atom_t)(a)&ATOM_MASK)%(s))
+#endif /* HASH_SIZE_POWER_2 */
+
+/* Combine a Group number and an atom index into an atom */
+#define MAKE_ATOM(g,i)      ((((atom_t)(g)&GROUP_MASK)<<((sizeof(atom_t)*8)-GROUP_BITS))|((atom_t)(i)&ATOM_MASK))
+
+/* Atom information structure used */
+typedef struct atom_info_struct_tag {
+    atom_t id;              /* atom ID for this info */
+    VOIDP *obj_ptr;         /* pointer associated with the atom */
+    struct atom_info_struct_tag *next;   /* link to next atom (in case of hash-clash) */
+  }atom_info_t;
+
+/* Atom group structure used */
+typedef struct atom_group_struct_tag {
+    uintn count;            /* # of times this group has been initialized */
+    intn hash_size;         /* size of the hash table to store the atoms in */
+    uintn atoms;            /* current number of atoms held */
+    uintn nextid;           /* atom ID to use for the next atom */
+    atom_info_t **atom_list;/* pointer to an array of ptrs to atoms */
+  }atom_group_t;
+
+/* Define this in only one place */
+#ifdef ATOM_MASTER
+
+/* Array of pointers to atomic groups */
+static atom_group_t *atom_group_list[MAXGROUP]={NULL};
+
+/* Pointer to the atom node free list */
+static atom_info_t *atom_free_list=NULL;
+
+#ifdef ATOMS_ARE_CACHED
+/* Array of pointers to atomic groups */
+#ifdef OLD_WAY
+static atom_t atom_id_cache[ATOM_CACHE_SIZE]={-1,-1,-1,-1};
+static VOIDP atom_obj_cache[ATOM_CACHE_SIZE]={NULL};
+#else /* OLD_WAY */
+HDFPUBLIC atom_t atom_id_cache[ATOM_CACHE_SIZE]={-1,-1,-1,-1};
+HDFPUBLIC VOIDP atom_obj_cache[ATOM_CACHE_SIZE]={NULL};
+#endif /* OLD_WAY */
+#endif /* ATOMS_ARE_CACHED */
+#endif /* ATOM_MASTER */
+
+/* Useful routines for generally private use */
+
+#endif /* ATOM_MASTER | ATOM_TESTER */
+
+#ifndef ATOM_MASTER
+HDFLIBAPI atom_t atom_id_cache[];
+HDFLIBAPI VOIDP atom_obj_cache[];
+#endif /* ATOM_MASTER */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/******************************************************************************
+ NAME
+     HAinit_group - Initialize an atomic group
+
+ DESCRIPTION
+    Creates an atomic group to store atoms in.  If the group has already been
+    initialized, this routine just increments the count of # of initializations
+    and returns without trying to change the size of the hash table.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+HDFLIBAPI intn HAinit_group(group_t grp,      /* IN: Group to initialize */
+    intn hash_size                  /* IN: Minimum hash table size to use for group */
+);
+
+/******************************************************************************
+ NAME
+     HAdestroy_group - Destroy an atomic group
+
+ DESCRIPTION
+    Destroys an atomic group which atoms are stored in.  If the group still
+    has atoms which are registered, this routine fails.  If there have been
+    multiple initializations of the group, this routine just decrements the
+    count of initializations and does not check the atoms out-standing.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+HDFLIBAPI intn HAdestroy_group(group_t grp       /* IN: Group to destroy */
+);
+
+/******************************************************************************
+ NAME
+     HAregister_atom - Register an object in a group and get an atom for it.
+
+ DESCRIPTION
+    Registers an object in a group and returns an atom for it.  This routine
+    does _not_ check for unique-ness of the objects, if you register an object
+    twice, you will get two different atoms for it.  This routine does make
+    certain that each atom in a group is unique.  Atoms are created by getting
+    a unique number for the group the atom is in and incorporating the group
+    into the atom which is returned to the user.
+
+ RETURNS
+    Returns atom if successful and FAIL otherwise
+
+*******************************************************************************/
+HDFLIBAPI atom_t HAregister_atom(group_t grp,     /* IN: Group to register the object in */
+    VOIDP object                        /* IN: Object to attach to atom */
+);
+
+/******************************************************************************
+ NAME
+     HAatom_object - Returns to the object ptr for the atom 
+
+ DESCRIPTION
+    Retrieves the object ptr which is associated with the atom.
+
+ RETURNS
+    Returns object ptr if successful and NULL otherwise
+
+*******************************************************************************/
+#ifdef ATOMS_CACHE_INLINE
+HDFLIBAPI VOIDP HAPatom_object(atom_t atm   /* IN: Atom to retrieve object for */
+);
+#else /* ATOMS_CACHE_INLINE */
+HDFLIBAPI VOIDP HAatom_object(atom_t atm   /* IN: Atom to retrieve object for */
+);
+#endif /* ATOMS_CACHE_INLINE */
+
+/******************************************************************************
+ NAME
+     HAatom_group - Returns to the group for the atom 
+
+ DESCRIPTION
+    Retrieves the group which is associated with the atom.
+
+ RETURNS
+    Returns group if successful and FAIL otherwise
+
+*******************************************************************************/
+HDFLIBAPI group_t HAatom_group(atom_t atm   /* IN: Atom to retrieve group for */
+);
+
+/******************************************************************************
+ NAME
+     HAremove_atom - Removes an atom from a group
+
+ DESCRIPTION
+    Removes an atom from a group.
+
+ RETURNS
+    Returns atom's object if successful and FAIL otherwise
+
+*******************************************************************************/
+HDFLIBAPI VOIDP HAremove_atom(atom_t atm   /* IN: Atom to remove */
+);
+
+/******************************************************************************
+ NAME
+     HAsearch_atom - Search for an object in a group and get it's pointer.
+
+ DESCRIPTION
+    Searchs for an object in a group and returns the pointer to it.
+    This routine calls the function pointer passed in for each object in the
+    group until it finds a match.  Currently there is no way to resume a
+    search.
+
+ RETURNS
+    Returns pointer an atom's object if successful and NULL otherwise
+
+*******************************************************************************/
+HDFLIBAPI VOIDP HAsearch_atom(group_t grp,        /* IN: Group to search for the object in */
+    HAsearch_func_t func,               /* IN: Ptr to the comparison function */
+    const void * key                     /* IN: pointer to key to compare against */
+);
+
+/******************************************************************************
+ NAME
+     HAshutdown - Terminate various static buffers.
+
+ DESCRIPTION
+    Free various buffers allocated in the HA routines.
+
+ RETURNS
+    Returns SUCCEED/FAIL
+
+*******************************************************************************/
+HDFLIBAPI intn HAshutdown(void);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif /* __ATOM_H */
+
diff --git a/hdf/src/bitvect.c b/hdf/src/bitvect.c
new file mode 100644
index 0000000..5679e14
--- /dev/null
+++ b/hdf/src/bitvect.c
@@ -0,0 +1,530 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 4932 $";
+#endif
+
+/* $Id: bitvect.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+FILE
+    bitvect.c
+
+PURPOSE
+    Provide an API for dynamicly-sized bit-vectors or "bit-sets"
+
+REMARKS
+    These function manipulate ordered sets of "bits".  They are designed 
+    to closely resemble the functions which one can perform in C with the
+    "bit-wise" algebraic functions, with some additional pizzaz thrown in.
+
+DESIGN
+        These routines a designed to be a modular component for use both
+    inside the HDF library and out.
+        They will use the HDF typedefs & Standard C library macros, but do
+    not explicitly depend on being inside the library itself.
+        Each bit-vector is stored in memory as an array of unsigned 8-bit 
+    integers (uint8's in HDF types), which can grow as additional bits are
+    flagged in the bit-vector.
+        Each bit-vector is stored with the lowest bits in location 0 in the
+    array of base type (uint8s currently) and the bits in "standard" C order
+    (i.e. bit 0 is the lowest bit in the byte) in each byte.  This does make
+    for a slightly strange "bit-swapped" storage, but is the most efficient.
+
+BUGS/LIMITATIONS
+   Currently the following design limitations are still in place:
+
+EXPORTED ROUTINES
+
+bv_ptr bv_new(int32 num_bits, uint32 flags)
+    - Creates a new bit-vector with a particular starting # of bits.
+
+intn bv_delete(bv_ptr b)
+    - Deletes a bit-vector created with bv_new.
+
+intn bv_set(bv_ptr b, int32 bit_num, bv_bool value)
+    - Sets a bit in a bit-vector to a given boolean value.
+
+intn bv_get(bv_ptr b, int32 bit_num)
+    - Gets a bit from a bit-vector.
+
+intn bv_clear(bv_ptr b, bv_bool value)
+    - Clears an entire bit-vector to a given boolean value.
+
+int32 bv_size(bv_ptr b)
+    - Reports the number of bits used in a bit-vector.  
+
+uint32 bv_flags(bv_ptr b)
+    - Returns the flags used when creating the bit-vector
+
+int32 bv_find(bv_ptr b, int32 last_find, bv_bool value)
+    - Find the next bit in a bit-vector with a given value.
+
+Functions that it would be nice to see (some day):
+
+intn bv_bitand(bv_ptr b, int32 bit_num, bv_bool value)
+    - Perform a boolean AND operation on a bit in a bit-vector.
+
+intn bv_bitor(bv_ptr b, int32 bit_num, bv_bool value)
+    - Perform a boolean OR operation on a bit in a bit-vector.
+
+intn bv_bitxor(bv_ptr b, int32 bit_num, bv_bool value)
+    - Perform a boolean XOR operation on a bit in a bit-vector.
+
+intn bv_bitnot(bv_ptr b, int32 bit_num)
+    - Perform a boolean NOT operation on a bit in a bit-vector.
+
+bv_ptr *bv_vectand(bv_ptr b1, bv_ptr b2)
+    - Perform a boolean AND operation between two bit-vectors.
+
+bv_ptr *bv_vector(bv_ptr b1, bv_ptr b2)
+    - Perform a boolean OR operation between two bit-vectors.
+
+bv_ptr *bv_vectxor(bv_ptr b1, bv_ptr b2)
+    - Perform a boolean XOR operation between two bit-vectors.
+
+LOCAL ROUTINES
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   12/05/95  - Starting writing specs & coding prototype
+ */
+
+#define BV_MASTER
+#include "bitvect.h"       /* Multi-file raster information */
+
+/* Local pre-processor macros */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_new
+ PURPOSE
+    Create a new bit-vector.
+ USAGE
+    bv_ptr bv_new(num_bits, flags)
+        int32 num_bits;             IN: The initial number of bits in the vector
+        uint32 flags;               IN: Flags to determine special attributes
+                                        of the newly created bit-vector
+ RETURNS
+    Returns either a valid bv_ptr on succeed or NULL on failure.
+ DESCRIPTION
+    Creates a new bit-vector with a certain initial # of bits.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    If num_bits is set to (-1), then the default number of bits is used.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+bv_ptr bv_new(int32 num_bits, uint32 flags)
+{
+    int32 base_elements;    /* the number of base elements needed to store the # of bits requested */
+    bv_ptr b;               /* ptr to the new bit-vector */
+
+    /* Check for invalid numbers of bits or bad flags */
+    if(num_bits<(-1) || num_bits==0)
+        return(NULL);
+
+    /* Check for requesting the default # of bits */
+    if(num_bits==(-1))
+        num_bits=BV_DEFAULT_BITS;
+
+    base_elements=((num_bits%(int32)BV_BASE_BITS)>0) ? (num_bits/(int32)BV_BASE_BITS)+1 : (num_bits/(int32)BV_BASE_BITS);
+
+    if((b=(bv_ptr)HDmalloc(sizeof(bv_struct)))==NULL)
+        return(NULL);
+    
+    b->bits_used=(uint32)num_bits;
+    b->array_size=(uint32)(((base_elements/BV_CHUNK_SIZE)+1)*BV_CHUNK_SIZE);
+    b->flags=flags;
+    if((b->buffer=(bv_base *)HDmalloc(sizeof(bv_base)*b->array_size))==NULL)
+      {
+          HDfree(b);
+          return(NULL);
+      } /* end if */
+    
+    /* Check the initial bit settings */
+    if(flags&BV_INIT_TO_ONE)
+      {
+        HDmemset(b->buffer,255,b->array_size);
+        b->last_zero=(-1);  /* Set the last zero to unknown */
+      } /* end if */
+    else
+      {
+        HDmemset(b->buffer,0,b->array_size);
+        b->last_zero=0;
+      } /* end else */
+
+    return(b);
+}   /* bv_new() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_delete
+ PURPOSE
+    Dispose of a new bit-vector.
+ USAGE
+    intn bv_delete(b)
+        bv_ptr b;                   IN: Bit-vector to dispose of
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Disposes of a bit-vector created by bv_new.  This routine is responsible
+    for completely cleaning up the bit-vector and disposing of all dynamicly
+    allocated space.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn bv_delete(bv_ptr b)
+{
+    /* Error checking */
+    if(b==NULL || b->buffer==NULL)
+        return(FAIL);
+    
+    /* Free the space used */
+    HDfree(b->buffer);
+    HDfree(b);
+
+    return(SUCCEED);
+}   /* bv_delete() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_set
+ PURPOSE
+    Set a bit in a bit-vector
+ USAGE
+    intn bv_set(b,bit_num,value)
+        bv_ptr b;                   IN: Bit-vector to use
+        int32 bit_num;              IN: bit to set
+        bv_bool value;              IN: bit value to set the bit to
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Sets a bit in a bit-vector to a bit value.  Also extends the bit-vector
+    if the bit to set is beyond the end of the current bit-vector and the
+    bit-vector is marked as extendable.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn bv_set(bv_ptr b, int32 bit_num, bv_bool value)
+{
+    int32 base_elem;    /* the base array index of the bit */
+    int32 bit_elem;      /* the bit index of the bit to set */
+
+    /* Error checking */
+    if(b==NULL || bit_num<0)
+        return(FAIL);
+    
+    base_elem=bit_num/(int32)BV_BASE_BITS;
+    bit_elem=bit_num%(int32)BV_BASE_BITS;
+
+    /* Check if the bit is beyond the end of the current bit-vector */
+    if((uint32)bit_num>=b->bits_used)
+      {
+          /* OK to extend? */
+          if(b->flags&BV_EXTENDABLE)
+            {
+              if((uint32)base_elem<b->array_size)
+                {   /* just use more bits in the currently allocated block */
+                    b->bits_used=(uint32)(bit_num+1);
+                } /* end if */
+              else
+                {   /* allocate more space for bits */
+                    bv_base *old_buf=b->buffer;   /* ptr to the old buffer */
+                    int32 num_chunks;               /* number of chunks to grab */
+                    
+                    num_chunks=(int32)(((((uint32)bit_num/BV_BASE_BITS)+1)-b->array_size)/BV_CHUNK_SIZE)+1;
+                    if((b->buffer=(bv_base *)HDrealloc(b->buffer,b->array_size+(uint32)num_chunks*BV_CHUNK_SIZE))==NULL)
+                      {
+                          b->buffer=old_buf;
+                          return(FAIL); /* fail to allocate a larger bit buffer */
+                      } /* end if */
+
+                    /* Check the initial bit settings, for the new bits */
+                    if(b->flags&BV_INIT_TO_ONE)
+                        HDmemset(&b->buffer[b->array_size],255,num_chunks*BV_CHUNK_SIZE);
+                    else
+                        HDmemset(&b->buffer[b->array_size],0,num_chunks*BV_CHUNK_SIZE);
+
+                    b->array_size+=(uint32)(num_chunks*BV_CHUNK_SIZE);
+                    b->bits_used=(uint32)bit_num+1;
+                } /* end else */
+            } /* end if */
+          else
+              return(FAIL); /* can't extend */
+      } /* end if */
+
+    if(value==BV_FALSE)
+      {
+        b->buffer[base_elem]&=~bv_bit_value[bit_elem];
+        if(base_elem<b->last_zero)
+            b->last_zero=base_elem;
+      } /* end if */
+    else
+        b->buffer[base_elem]|=bv_bit_value[bit_elem];
+
+    return(SUCCEED);
+}   /* bv_set() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_get
+ PURPOSE
+    Get a bit from a bit-vector
+ USAGE
+    intn bv_get(b,bit_num)
+        bv_ptr b;                   IN: Bit-vector to use
+        int32 bit_num;              IN: bit to set
+ RETURNS
+    Returns either BV_TRUE/BV_FALSE on success, or FAIL on error
+ DESCRIPTION
+    Gets a bit from a bit-vector.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn bv_get(bv_ptr b, int32 bit_num)
+{
+    int32 base_elem;    /* the base array index of the bit */
+    int32 bit_elem;     /* the bit index of the bit to set */
+    intn ret_value;     /* the variable to store the return value */
+
+    /* Error checking */
+    if(b==NULL || b->buffer==NULL || bit_num<0)
+        return(FAIL);
+    
+    /* Check for asking for a bit off of the end of the vector */
+    if((uint32)bit_num>=b->bits_used)
+        return((b->flags&BV_INIT_TO_ONE) ? BV_TRUE : BV_FALSE);
+
+    base_elem=bit_num/(int32)BV_BASE_BITS;
+    bit_elem=bit_num%(int32)BV_BASE_BITS;
+
+    ret_value=b->buffer[base_elem]&bv_bit_value[bit_elem];
+    ret_value>>=bit_elem;
+
+    return(ret_value);
+}   /* bv_get() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_clear
+ PURPOSE
+    Clears a bit-vector to a given boolean value
+ USAGE
+    intn bv_clear(b,value)
+        bv_ptr b;                   IN: Bit-vector to use
+        bv_bool value;              IN: bit value to set the bit to
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Clears an entire bit vector to a given boolean value, but does not
+    change the status of the BV_INIT_TO_ONE flag for future bits which
+    might be allocated.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn bv_clear(bv_ptr b, bv_bool value)
+{
+    /* Error checking */
+    if(b==NULL || b->buffer==NULL)
+        return(FAIL);
+
+    if(value==BV_TRUE)
+      {
+        HDmemset(b->buffer,255,b->array_size);
+        b->last_zero=(-1);
+      } /* end if */
+    else
+      {
+        HDmemset(b->buffer,0,b->array_size);
+        b->last_zero=0;
+      } /* end else */
+
+    return(SUCCEED);
+}   /* bv_clear() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_size
+ PURPOSE
+    Report the number of bits in the bit-vector
+ USAGE
+    int32 bv_size(b)
+        bv_ptr b;                   IN: Bit-vector to use
+ RETURNS
+    Returns number of bits in use on success, FAIL on error
+ DESCRIPTION
+    Report the number of bits currently in-use for a bit-vector.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 bv_size(bv_ptr b)
+{
+    /* Error checking */
+    if(b==NULL)
+        return(FAIL);
+
+    return((int32)b->bits_used);
+}   /* bv_size() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_flags
+ PURPOSE
+    Returns the flags for a bit-vector
+ USAGE
+    uint32 bv_size(b)
+        bv_ptr b;                   IN: Bit-vector to use
+ RETURNS
+    Returns bit-vector flags on success, FAIL on error
+ DESCRIPTION
+    Returns the current flags for the bit-vector.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+uint32 bv_flags(bv_ptr b)
+{
+    /* Error checking */
+    if(b==NULL)
+        return(FAIL);
+
+    return(b->flags);
+}   /* bv_flags() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    bv_find
+ PURPOSE
+    Find the next bit of a given value
+ USAGE
+    int32 bv_find(b,last_find,value)
+        bv_ptr b;                   IN: Bit-vector to use
+        int32 last_find;            IN: bit offset of last bit found
+        bv_bool value;              IN: boolean value to look for
+ RETURNS
+    Returns offset of next bit on success, FAIL on error
+ DESCRIPTION
+    Find the next highest bit of a given bit value.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    "last_find" capability not currently implemented for '0' searches - QAK
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 bv_find(bv_ptr b,int32 last_find,bv_bool value)
+{
+    uint32 old_bits_used;   /* the last number of bits used */
+    uint32 bytes_used;  /* number of full bytes used */
+    uint32 first_byte=0;    /* The first byte to begin searching at */
+    bv_base slush_bits; /* extra bits which don't fit into a byte */
+    uint32 u;   /* local counting variable */
+
+    /* Error checking */
+    if(b==NULL || b->buffer==NULL)
+        return(FAIL);
+
+    bytes_used=b->bits_used/BV_BASE_BITS;
+    if(value==BV_TRUE)
+      { /* looking for first '1' in the bit-vector */
+          if(last_find>=0)
+            {   /* if the last bit found option is used, look for more bits in that same byte */
+              intn bit_off;
+
+              first_byte=(uint32)last_find/BV_BASE_BITS;
+              bit_off=(intn)(((uint32)last_find-(first_byte*BV_BASE_BITS))+1);
+              slush_bits=(bv_base)(b->buffer[first_byte]&(~bv_bit_mask[bit_off]));
+              if(slush_bits!=0)
+                  return((int32)(first_byte*BV_BASE_BITS)+bv_first_zero[~slush_bits]);
+              first_byte++;
+            } /* end if */
+
+          for(u=first_byte; u<bytes_used; u++)
+            {
+                if(b->buffer[u]!=0)
+                    return((int32)(u*BV_BASE_BITS)+bv_first_zero[~b->buffer[u]]);
+            } /* end for */
+
+          /* Any extra bits left over? */
+          if((bytes_used*BV_BASE_BITS)<b->bits_used)
+            {
+                slush_bits=(bv_base)(b->buffer[u]&bv_bit_mask[b->bits_used-(bytes_used*BV_BASE_BITS)]);
+                if(slush_bits!=0)
+                    return((int32)(u*BV_BASE_BITS)+bv_first_zero[~slush_bits]);
+            } /* end if */
+      } /* end if */
+    else
+      { /* looking for first '0' in the bit-vector */
+          bv_base *tmp_buf;
+
+          if(b->last_zero>=0)
+              u=(uint32)b->last_zero;
+          else
+              u=0;
+#ifdef OLD_WAY
+          for(; u<bytes_used; u++)
+            {
+                if(b->buffer[u]!=255)
+                  {
+                    b->last_zero=u;
+                    return((u*BV_BASE_BITS)+bv_first_zero[b->buffer[u]]);
+                  } /* end if */
+            } /* end for */
+#else /* OLD_WAY */
+          tmp_buf=&b->buffer[u];
+          while(u<bytes_used && *tmp_buf==255)
+            {
+              u++;
+              tmp_buf++;
+            } /* end while */
+          if(u<bytes_used)
+            {
+              b->last_zero=(int32)u;
+              return((int32)(u*BV_BASE_BITS)+bv_first_zero[*tmp_buf]);
+            } /* end if */
+#endif /* OLD_WAY */
+
+          /* Any extra bits left over? */
+          if((bytes_used*BV_BASE_BITS)<b->bits_used)
+            {
+                slush_bits=(bv_base)(b->buffer[u]&bv_bit_mask[b->bits_used-(bytes_used*BV_BASE_BITS)]);
+                if(slush_bits!=255)
+                  {
+                    b->last_zero=(int32)u;
+                    return((int32)(u*BV_BASE_BITS)+bv_first_zero[slush_bits]);
+                  } /* end if */
+            } /* end if */
+      } /* end else */
+
+    /* Beyond the current end of the bit-vector, extend the bit-vector */
+    old_bits_used=b->bits_used;
+    if(bv_set(b, (int32)b->bits_used, (bv_bool)((b->flags&BV_INIT_TO_ONE) ? BV_TRUE : BV_FALSE))==FAIL)
+        return(FAIL);
+    
+    return((int32)old_bits_used);
+}   /* bv_find() */
+
diff --git a/hdf/src/bitvect.h b/hdf/src/bitvect.h
new file mode 100644
index 0000000..1ad6c64
--- /dev/null
+++ b/hdf/src/bitvect.h
@@ -0,0 +1,388 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: bitvect.h 5444 2010-08-25 16:40:05Z byrn $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    bitvect.h
+ * Purpose: header file for bit-vector API
+ * Dependencies: 
+ * Invokes:
+ * Contents:
+ * Structure definitions: 
+ * Constant definitions: 
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __BITVECT_H
+#define __BITVECT_H
+
+#include "H4api_adpt.h"
+
+#include "hdf.h"
+
+/* Boolean values used */
+typedef enum {BV_FALSE=0, BV_TRUE=1} bv_bool;
+
+/* Flags for the bit-vector */
+#define BV_INIT_TO_ONE  0x00000001  /* to indicate whether to create the bit-vector with one's instead of zero's */
+#define BV_EXTENDABLE   0x00000002  /* to indicate that the bit-vector can be extended */
+
+/* Default size of a bit-vector */
+#define BV_DEFAULT_BITS 128
+
+/* Define the size of the chunks bits are allocated in */
+#define BV_CHUNK_SIZE 64
+
+/* Create the external interface data structures needed */
+typedef struct bv_struct_tag *bv_ptr;
+
+#if defined BV_MASTER | defined BV_TESTER
+
+/* Base type of the array used to store the bits */
+typedef unsigned char bv_base;
+
+/* # of bits in the base type of the array used to store the bits */
+#define BV_BASE_BITS    (sizeof(bv_base)*8)
+
+/* bit-vector structure used */
+typedef struct bv_struct_tag {
+    uint32 bits_used;       /* The actual number of bits current in use */
+    uint32 array_size;      /* The number of bv_base elements in the bit-vector */
+    uint32 flags;           /* The flags used to create this bit-vector */
+    int32 last_zero;        /* The last location we know had a zero bit */
+    bv_base *buffer;        /* Pointer to the buffer used to store the bits */
+  }bv_struct;
+
+/* Table of bits for each bit position */
+/*  (This will need to be changed/expanded if another base type is used) */
+static const uint8 bv_bit_value[8]={
+    1,  /* bit 0's value is 1 */
+    2,  /* bit 1's value is 2 */
+    4,  /* bit 2's value is 4 */
+    8,  /* bit 3's value is 8 */
+    16,  /* bit 4's value is 16 */
+    32,  /* bit 5's value is 32 */
+    64,  /* bit 6's value is 64 */
+    128   /* bit 7's value is 128 */
+};
+
+/* Table of bit-masks for each number of bits in a byte */
+/*  (This will need to be changed/expanded if another base type is used) */
+static const uint8 bv_bit_mask[9]={
+    0x00,  /* 0 bits is a mask of 0x00 */
+    0x01,  /* 1 bits is a mask of 0x01 */
+    0x03,  /* 2 bits is a mask of 0x03 */
+    0x07,  /* 3 bits is a mask of 0x07 */
+    0x0F,  /* 4 bits is a mask of 0x0F */
+    0x1F,  /* 5 bits is a mask of 0x1F */
+    0x3F,  /* 6 bits is a mask of 0x3F */
+    0x7F,  /* 7 bits is a mask of 0x7F */
+    0xFF   /* 8 bits is a mask of 0xFF */
+};
+
+/* Table of "first zero bit" for each byte value */
+/*  (This will need to be changed/expanded if another base type is used) */
+static const int8 bv_first_zero[256]={
+    0,  /* "0" - bit 0 is lowest zero */ 1,  /* "1" - bit 1 is lowest zero */
+    0,  /* "2" - bit 0 is lowest zero */ 2,  /* "3" - bit 2 is lowest zero */
+    0,  /* "4" - bit 0 is lowest zero */ 1,  /* "5" - bit 1 is lowest zero */
+    0,  /* "6" - bit 0 is lowest zero */ 3,  /* "7" - bit 3 is lowest zero */
+    0,  /* "8" - bit 0 is lowest zero */ 1,  /* "9" - bit 1 is lowest zero */
+    0,  /* "10" - bit 0 is lowest zero */ 2,  /* "11" - bit 2 is lowest zero */
+    0,  /* "12" - bit 0 is lowest zero */ 1,  /* "13" - bit 1 is lowest zero */
+    0,  /* "14" - bit 0 is lowest zero */ 4,  /* "15" - bit 4 is lowest zero */
+    0,  /* "16" - bit 0 is lowest zero */ 1,  /* "17" - bit 1 is lowest zero */
+    0,  /* "18" - bit 0 is lowest zero */ 2,  /* "19" - bit 2 is lowest zero */
+    0,  /* "20" - bit 0 is lowest zero */ 1,  /* "21" - bit 1 is lowest zero */
+    0,  /* "22" - bit 0 is lowest zero */ 3,  /* "23" - bit 3 is lowest zero */
+    0,  /* "24" - bit 0 is lowest zero */ 1,  /* "25" - bit 1 is lowest zero */
+    0,  /* "26" - bit 0 is lowest zero */ 2,  /* "27" - bit 2 is lowest zero */
+    0,  /* "28" - bit 0 is lowest zero */ 1,  /* "29" - bit 1 is lowest zero */
+    0,  /* "30" - bit 0 is lowest zero */ 5,  /* "31" - bit 5 is lowest zero */
+    0,  /* "32" - bit 0 is lowest zero */ 1,  /* "33" - bit 1 is lowest zero */
+    0,  /* "34" - bit 0 is lowest zero */ 2,  /* "35" - bit 2 is lowest zero */
+    0,  /* "36" - bit 0 is lowest zero */ 1,  /* "37" - bit 1 is lowest zero */
+    0,  /* "38" - bit 0 is lowest zero */ 3,  /* "39" - bit 3 is lowest zero */
+    0,  /* "40" - bit 0 is lowest zero */ 1,  /* "41" - bit 1 is lowest zero */
+    0,  /* "42" - bit 0 is lowest zero */ 2,  /* "43" - bit 2 is lowest zero */
+    0,  /* "44" - bit 0 is lowest zero */ 1,  /* "45" - bit 1 is lowest zero */
+    0,  /* "46" - bit 0 is lowest zero */ 4,  /* "47" - bit 4 is lowest zero */
+    0,  /* "48" - bit 0 is lowest zero */ 1,  /* "49" - bit 1 is lowest zero */
+    0,  /* "50" - bit 0 is lowest zero */ 2,  /* "51" - bit 2 is lowest zero */
+    0,  /* "52" - bit 0 is lowest zero */ 1,  /* "53" - bit 1 is lowest zero */
+    0,  /* "54" - bit 0 is lowest zero */ 3,  /* "55" - bit 3 is lowest zero */
+    0,  /* "56" - bit 0 is lowest zero */ 1,  /* "57" - bit 1 is lowest zero */
+    0,  /* "58" - bit 0 is lowest zero */ 2,  /* "59" - bit 2 is lowest zero */
+    0,  /* "60" - bit 0 is lowest zero */ 1,  /* "61" - bit 1 is lowest zero */
+    0,  /* "62" - bit 0 is lowest zero */ 6,  /* "63" - bit 6 is lowest zero */
+    0,  /* "64" - bit 0 is lowest zero */ 1,  /* "65" - bit 1 is lowest zero */
+    0,  /* "66" - bit 0 is lowest zero */ 2,  /* "67" - bit 2 is lowest zero */
+    0,  /* "68" - bit 0 is lowest zero */ 1,  /* "69" - bit 1 is lowest zero */
+    0,  /* "70" - bit 0 is lowest zero */ 3,  /* "71" - bit 3 is lowest zero */
+    0,  /* "72" - bit 0 is lowest zero */ 1,  /* "73" - bit 1 is lowest zero */
+    0,  /* "74" - bit 0 is lowest zero */ 2,  /* "75" - bit 2 is lowest zero */
+    0,  /* "76" - bit 0 is lowest zero */ 1,  /* "77" - bit 1 is lowest zero */
+    0,  /* "78" - bit 0 is lowest zero */ 4,  /* "79" - bit 4 is lowest zero */
+    0,  /* "80" - bit 0 is lowest zero */ 1,  /* "81" - bit 1 is lowest zero */
+    0,  /* "82" - bit 0 is lowest zero */ 2,  /* "83" - bit 2 is lowest zero */
+    0,  /* "84" - bit 0 is lowest zero */ 1,  /* "85" - bit 1 is lowest zero */
+    0,  /* "86" - bit 0 is lowest zero */ 3,  /* "87" - bit 3 is lowest zero */
+    0,  /* "88" - bit 0 is lowest zero */ 1,  /* "89" - bit 1 is lowest zero */
+    0,  /* "90" - bit 0 is lowest zero */ 2,  /* "91" - bit 2 is lowest zero */
+    0,  /* "92" - bit 0 is lowest zero */ 1,  /* "93" - bit 1 is lowest zero */
+    0,  /* "94" - bit 0 is lowest zero */ 5,  /* "95" - bit 5 is lowest zero */
+    0,  /* "96" - bit 0 is lowest zero */ 1,  /* "97" - bit 1 is lowest zero */
+    0,  /* "98" - bit 0 is lowest zero */ 2,  /* "99" - bit 2 is lowest zero */
+    0,  /* "100" - bit 0 is lowest zero */ 1,  /* "101" - bit 1 is lowest zero */
+    0,  /* "102" - bit 0 is lowest zero */ 3,  /* "103" - bit 3 is lowest zero */
+    0,  /* "104" - bit 0 is lowest zero */ 1,  /* "105" - bit 1 is lowest zero */
+    0,  /* "106" - bit 0 is lowest zero */ 2,  /* "107" - bit 2 is lowest zero */
+    0,  /* "108" - bit 0 is lowest zero */ 1,  /* "109" - bit 1 is lowest zero */
+    0,  /* "110" - bit 0 is lowest zero */ 4,  /* "111" - bit 4 is lowest zero */
+    0,  /* "112" - bit 0 is lowest zero */ 1,  /* "113" - bit 1 is lowest zero */
+    0,  /* "114" - bit 0 is lowest zero */ 2,  /* "115" - bit 2 is lowest zero */
+    0,  /* "116" - bit 0 is lowest zero */ 1,  /* "117" - bit 1 is lowest zero */
+    0,  /* "118" - bit 0 is lowest zero */ 3,  /* "119" - bit 3 is lowest zero */
+    0,  /* "120" - bit 0 is lowest zero */ 1,  /* "121" - bit 1 is lowest zero */
+    0,  /* "122" - bit 0 is lowest zero */ 2,  /* "123" - bit 2 is lowest zero */
+    0,  /* "124" - bit 0 is lowest zero */ 1,  /* "125" - bit 1 is lowest zero */
+    0,  /* "126" - bit 0 is lowest zero */ 7,  /* "127" - bit 7 is lowest zero */
+    0,  /* "128" - bit 0 is lowest zero */ 1,  /* "129" - bit 1 is lowest zero */
+    0,  /* "130" - bit 0 is lowest zero */ 2,  /* "131" - bit 2 is lowest zero */
+    0,  /* "132" - bit 0 is lowest zero */ 1,  /* "133" - bit 1 is lowest zero */
+    0,  /* "134" - bit 0 is lowest zero */ 3,  /* "135" - bit 3 is lowest zero */
+    0,  /* "136" - bit 0 is lowest zero */ 1,  /* "137" - bit 1 is lowest zero */
+    0,  /* "138" - bit 0 is lowest zero */ 2,  /* "139" - bit 2 is lowest zero */
+    0,  /* "140" - bit 0 is lowest zero */ 1,  /* "141" - bit 1 is lowest zero */
+    0,  /* "142" - bit 0 is lowest zero */ 4,  /* "143" - bit 4 is lowest zero */
+    0,  /* "144" - bit 0 is lowest zero */ 1,  /* "145" - bit 1 is lowest zero */
+    0,  /* "146" - bit 0 is lowest zero */ 2,  /* "147" - bit 2 is lowest zero */
+    0,  /* "148" - bit 0 is lowest zero */ 1,  /* "149" - bit 1 is lowest zero */
+    0,  /* "150" - bit 0 is lowest zero */ 3,  /* "151" - bit 3 is lowest zero */
+    0,  /* "152" - bit 0 is lowest zero */ 1,  /* "153" - bit 1 is lowest zero */
+    0,  /* "154" - bit 0 is lowest zero */ 2,  /* "155" - bit 2 is lowest zero */
+    0,  /* "156" - bit 0 is lowest zero */ 1,  /* "157" - bit 1 is lowest zero */
+    0,  /* "158" - bit 0 is lowest zero */ 5,  /* "159" - bit 5 is lowest zero */
+    0,  /* "160" - bit 0 is lowest zero */ 1,  /* "161" - bit 1 is lowest zero */
+    0,  /* "162" - bit 0 is lowest zero */ 2,  /* "163" - bit 2 is lowest zero */
+    0,  /* "164" - bit 0 is lowest zero */ 1,  /* "165" - bit 1 is lowest zero */
+    0,  /* "166" - bit 0 is lowest zero */ 3,  /* "167" - bit 3 is lowest zero */
+    0,  /* "168" - bit 0 is lowest zero */ 1,  /* "169" - bit 1 is lowest zero */
+    0,  /* "170" - bit 0 is lowest zero */ 2,  /* "171" - bit 2 is lowest zero */
+    0,  /* "172" - bit 0 is lowest zero */ 1,  /* "173" - bit 1 is lowest zero */
+    0,  /* "174" - bit 0 is lowest zero */ 4,  /* "175" - bit 4 is lowest zero */
+    0,  /* "176" - bit 0 is lowest zero */ 1,  /* "177" - bit 1 is lowest zero */
+    0,  /* "178" - bit 0 is lowest zero */ 2,  /* "179" - bit 2 is lowest zero */
+    0,  /* "180" - bit 0 is lowest zero */ 1,  /* "181" - bit 1 is lowest zero */
+    0,  /* "182" - bit 0 is lowest zero */ 3,  /* "183" - bit 3 is lowest zero */
+    0,  /* "184" - bit 0 is lowest zero */ 1,  /* "185" - bit 1 is lowest zero */
+    0,  /* "186" - bit 0 is lowest zero */ 2,  /* "187" - bit 2 is lowest zero */
+    0,  /* "188" - bit 0 is lowest zero */ 1,  /* "189" - bit 1 is lowest zero */
+    0,  /* "190" - bit 0 is lowest zero */ 6,  /* "191" - bit 6 is lowest zero */
+    0,  /* "192" - bit 0 is lowest zero */ 1,  /* "193" - bit 1 is lowest zero */
+    0,  /* "194" - bit 0 is lowest zero */ 2,  /* "195" - bit 2 is lowest zero */
+    0,  /* "196" - bit 0 is lowest zero */ 1,  /* "197" - bit 1 is lowest zero */
+    0,  /* "198" - bit 0 is lowest zero */ 3,  /* "199" - bit 3 is lowest zero */
+    0,  /* "200" - bit 0 is lowest zero */ 1,  /* "201" - bit 1 is lowest zero */
+    0,  /* "202" - bit 0 is lowest zero */ 2,  /* "203" - bit 2 is lowest zero */
+    0,  /* "204" - bit 0 is lowest zero */ 1,  /* "205" - bit 1 is lowest zero */
+    0,  /* "206" - bit 0 is lowest zero */ 4,  /* "207" - bit 4 is lowest zero */
+    0,  /* "208" - bit 0 is lowest zero */ 1,  /* "209" - bit 1 is lowest zero */
+    0,  /* "210" - bit 0 is lowest zero */ 2,  /* "211" - bit 2 is lowest zero */
+    0,  /* "212" - bit 0 is lowest zero */ 1,  /* "213" - bit 1 is lowest zero */
+    0,  /* "214" - bit 0 is lowest zero */ 3,  /* "215" - bit 3 is lowest zero */
+    0,  /* "216" - bit 0 is lowest zero */ 1,  /* "217" - bit 1 is lowest zero */
+    0,  /* "218" - bit 0 is lowest zero */ 2,  /* "219" - bit 2 is lowest zero */
+    0,  /* "220" - bit 0 is lowest zero */ 1,  /* "221" - bit 1 is lowest zero */
+    0,  /* "222" - bit 0 is lowest zero */ 5,  /* "223" - bit 5 is lowest zero */
+    0,  /* "224" - bit 0 is lowest zero */ 1,  /* "225" - bit 1 is lowest zero */
+    0,  /* "226" - bit 0 is lowest zero */ 2,  /* "227" - bit 2 is lowest zero */
+    0,  /* "228" - bit 0 is lowest zero */ 1,  /* "229" - bit 1 is lowest zero */
+    0,  /* "230" - bit 0 is lowest zero */ 3,  /* "231" - bit 3 is lowest zero */
+    0,  /* "232" - bit 0 is lowest zero */ 1,  /* "233" - bit 1 is lowest zero */
+    0,  /* "234" - bit 0 is lowest zero */ 2,  /* "235" - bit 2 is lowest zero */
+    0,  /* "236" - bit 0 is lowest zero */ 1,  /* "237" - bit 1 is lowest zero */
+    0,  /* "238" - bit 0 is lowest zero */ 4,  /* "239" - bit 4 is lowest zero */
+    0,  /* "240" - bit 0 is lowest zero */ 1,  /* "241" - bit 1 is lowest zero */
+    0,  /* "242" - bit 0 is lowest zero */ 2,  /* "243" - bit 2 is lowest zero */
+    0,  /* "244" - bit 0 is lowest zero */ 1,  /* "245" - bit 1 is lowest zero */
+    0,  /* "246" - bit 0 is lowest zero */ 3,  /* "247" - bit 3 is lowest zero */
+    0,  /* "248" - bit 0 is lowest zero */ 1,  /* "249" - bit 1 is lowest zero */
+    0,  /* "250" - bit 0 is lowest zero */ 2,  /* "251" - bit 2 is lowest zero */
+    0,  /* "252" - bit 0 is lowest zero */ 1,  /* "253" - bit 1 is lowest zero */
+    0,  /* "254" - bit 0 is lowest zero */ 8   /* "255" - bit 8 is lowest zero */
+};
+
+/* Table of "number of 1 bits" for each byte value */
+/*  (This will need to be changed/expanded if another base type is used) */
+static const int8 bv_num_ones[256]={
+    0,  /* "0" - n bits are 1's */ 1,  /* "1" - n bits are 1's */
+    1,  /* "2" - n bits are 1's */ 2,  /* "3" - n bits are 1's */
+    1,  /* "4" - n bits are 1's */ 2,  /* "5" - n bits are 1's */
+    2,  /* "6" - n bits are 1's */ 3,  /* "7" - n bits are 1's */
+    1,  /* "8" - n bits are 1's */ 2,  /* "9" - n bits are 1's */
+    2,  /* "10" - n bits are 1's */ 3,  /* "11" - n bits are 1's */
+    2,  /* "12" - n bits are 1's */ 3,  /* "13" - n bits are 1's */
+    3,  /* "14" - n bits are 1's */ 4,  /* "15" - n bits are 1's */
+    1,  /* "16" - n bits are 1's */ 2,  /* "17" - n bits are 1's */
+    2,  /* "18" - n bits are 1's */ 3,  /* "19" - n bits are 1's */
+    2,  /* "20" - n bits are 1's */ 3,  /* "21" - n bits are 1's */
+    3,  /* "22" - n bits are 1's */ 4,  /* "23" - n bits are 1's */
+    2,  /* "24" - n bits are 1's */ 3,  /* "25" - n bits are 1's */
+    3,  /* "26" - n bits are 1's */ 4,  /* "27" - n bits are 1's */
+    3,  /* "28" - n bits are 1's */ 3,  /* "29" - n bits are 1's */
+    4,  /* "30" - n bits are 1's */ 5,  /* "31" - n bits are 1's */
+    1,  /* "32" - n bits are 1's */ 2,  /* "33" - n bits are 1's */
+    2,  /* "34" - n bits are 1's */ 3,  /* "35" - n bits are 1's */
+    2,  /* "36" - n bits are 1's */ 3,  /* "37" - n bits are 1's */
+    3,  /* "38" - n bits are 1's */ 4,  /* "39" - n bits are 1's */
+    2,  /* "40" - n bits are 1's */ 3,  /* "41" - n bits are 1's */
+    3,  /* "42" - n bits are 1's */ 4,  /* "43" - n bits are 1's */
+    3,  /* "44" - n bits are 1's */ 4,  /* "45" - n bits are 1's */
+    4,  /* "46" - n bits are 1's */ 5,  /* "47" - n bits are 1's */
+    2,  /* "48" - n bits are 1's */ 3,  /* "49" - n bits are 1's */
+    3,  /* "50" - n bits are 1's */ 4,  /* "51" - n bits are 1's */
+    3,  /* "52" - n bits are 1's */ 4,  /* "53" - n bits are 1's */
+    4,  /* "54" - n bits are 1's */ 5,  /* "55" - n bits are 1's */
+    3,  /* "56" - n bits are 1's */ 4,  /* "57" - n bits are 1's */
+    4,  /* "58" - n bits are 1's */ 5,  /* "59" - n bits are 1's */
+    4,  /* "60" - n bits are 1's */ 5,  /* "61" - n bits are 1's */
+    5,  /* "62" - n bits are 1's */ 6,  /* "63" - n bits are 1's */
+    1,  /* "64" - n bits are 1's */ 2,  /* "65" - n bits are 1's */
+    2,  /* "66" - n bits are 1's */ 3,  /* "67" - n bits are 1's */
+    2,  /* "68" - n bits are 1's */ 3,  /* "69" - n bits are 1's */
+    3,  /* "70" - n bits are 1's */ 4,  /* "71" - n bits are 1's */
+    2,  /* "72" - n bits are 1's */ 3,  /* "73" - n bits are 1's */
+    3,  /* "74" - n bits are 1's */ 4,  /* "75" - n bits are 1's */
+    3,  /* "76" - n bits are 1's */ 4,  /* "77" - n bits are 1's */
+    4,  /* "78" - n bits are 1's */ 5,  /* "79" - n bits are 1's */
+    2,  /* "80" - n bits are 1's */ 3,  /* "81" - n bits are 1's */
+    3,  /* "82" - n bits are 1's */ 4,  /* "83" - n bits are 1's */
+    3,  /* "84" - n bits are 1's */ 4,  /* "85" - n bits are 1's */
+    4,  /* "86" - n bits are 1's */ 5,  /* "87" - n bits are 1's */
+    3,  /* "88" - n bits are 1's */ 4,  /* "89" - n bits are 1's */
+    4,  /* "90" - n bits are 1's */ 5,  /* "91" - n bits are 1's */
+    4,  /* "92" - n bits are 1's */ 5,  /* "93" - n bits are 1's */
+    5,  /* "94" - n bits are 1's */ 6,  /* "95" - n bits are 1's */
+    2,  /* "96" - n bits are 1's */ 3,  /* "97" - n bits are 1's */
+    3,  /* "98" - n bits are 1's */ 4,  /* "99" - n bits are 1's */
+    3,  /* "100" - n bits are 1's */ 4,  /* "101" - n bits are 1's */
+    4,  /* "102" - n bits are 1's */ 5,  /* "103" - n bits are 1's */
+    3,  /* "104" - n bits are 1's */ 4,  /* "105" - n bits are 1's */
+    4,  /* "106" - n bits are 1's */ 5,  /* "107" - n bits are 1's */
+    3,  /* "108" - n bits are 1's */ 4,  /* "109" - n bits are 1's */
+    4,  /* "110" - n bits are 1's */ 5,  /* "111" - n bits are 1's */
+    3,  /* "112" - n bits are 1's */ 4,  /* "113" - n bits are 1's */
+    4,  /* "114" - n bits are 1's */ 5,  /* "115" - n bits are 1's */
+    4,  /* "116" - n bits are 1's */ 5,  /* "117" - n bits are 1's */
+    5,  /* "118" - n bits are 1's */ 6,  /* "119" - n bits are 1's */
+    4,  /* "120" - n bits are 1's */ 5,  /* "121" - n bits are 1's */
+    5,  /* "122" - n bits are 1's */ 6,  /* "123" - n bits are 1's */
+    5,  /* "124" - n bits are 1's */ 6,  /* "125" - n bits are 1's */
+    6,  /* "126" - n bits are 1's */ 7,  /* "127" - n bits are 1's */
+    1,  /* "128" - n bits are 1's */ 2,  /* "129" - n bits are 1's */
+    2,  /* "130" - n bits are 1's */ 3,  /* "131" - n bits are 1's */
+    2,  /* "132" - n bits are 1's */ 3,  /* "133" - n bits are 1's */
+    3,  /* "134" - n bits are 1's */ 4,  /* "135" - n bits are 1's */
+    2,  /* "136" - n bits are 1's */ 3,  /* "137" - n bits are 1's */
+    3,  /* "138" - n bits are 1's */ 4,  /* "139" - n bits are 1's */
+    3,  /* "140" - n bits are 1's */ 4,  /* "141" - n bits are 1's */
+    4,  /* "142" - n bits are 1's */ 5,  /* "143" - n bits are 1's */
+    2,  /* "144" - n bits are 1's */ 3,  /* "145" - n bits are 1's */
+    3,  /* "146" - n bits are 1's */ 4,  /* "147" - n bits are 1's */
+    3,  /* "148" - n bits are 1's */ 4,  /* "149" - n bits are 1's */
+    4,  /* "150" - n bits are 1's */ 5,  /* "151" - n bits are 1's */
+    3,  /* "152" - n bits are 1's */ 4,  /* "153" - n bits are 1's */
+    4,  /* "154" - n bits are 1's */ 5,  /* "155" - n bits are 1's */
+    4,  /* "156" - n bits are 1's */ 5,  /* "157" - n bits are 1's */
+    5,  /* "158" - n bits are 1's */ 6,  /* "159" - n bits are 1's */
+    2,  /* "160" - n bits are 1's */ 3,  /* "161" - n bits are 1's */
+    3,  /* "162" - n bits are 1's */ 4,  /* "163" - n bits are 1's */
+    3,  /* "164" - n bits are 1's */ 4,  /* "165" - n bits are 1's */
+    4,  /* "166" - n bits are 1's */ 5,  /* "167" - n bits are 1's */
+    3,  /* "168" - n bits are 1's */ 4,  /* "169" - n bits are 1's */
+    4,  /* "170" - n bits are 1's */ 5,  /* "171" - n bits are 1's */
+    4,  /* "172" - n bits are 1's */ 5,  /* "173" - n bits are 1's */
+    5,  /* "174" - n bits are 1's */ 6,  /* "175" - n bits are 1's */
+    3,  /* "176" - n bits are 1's */ 4,  /* "177" - n bits are 1's */
+    4,  /* "178" - n bits are 1's */ 5,  /* "179" - n bits are 1's */
+    4,  /* "180" - n bits are 1's */ 5,  /* "181" - n bits are 1's */
+    5,  /* "182" - n bits are 1's */ 6,  /* "183" - n bits are 1's */
+    4,  /* "184" - n bits are 1's */ 5,  /* "185" - n bits are 1's */
+    5,  /* "186" - n bits are 1's */ 6,  /* "187" - n bits are 1's */
+    5,  /* "188" - n bits are 1's */ 6,  /* "189" - n bits are 1's */
+    6,  /* "190" - n bits are 1's */ 7,  /* "191" - n bits are 1's */
+    2,  /* "192" - n bits are 1's */ 3,  /* "193" - n bits are 1's */
+    3,  /* "194" - n bits are 1's */ 4,  /* "195" - n bits are 1's */
+    3,  /* "196" - n bits are 1's */ 4,  /* "197" - n bits are 1's */
+    4,  /* "198" - n bits are 1's */ 5,  /* "199" - n bits are 1's */
+    3,  /* "200" - n bits are 1's */ 4,  /* "201" - n bits are 1's */
+    4,  /* "202" - n bits are 1's */ 5,  /* "203" - n bits are 1's */
+    4,  /* "204" - n bits are 1's */ 5,  /* "205" - n bits are 1's */
+    5,  /* "206" - n bits are 1's */ 6,  /* "207" - n bits are 1's */
+    3,  /* "208" - n bits are 1's */ 4,  /* "209" - n bits are 1's */
+    4,  /* "210" - n bits are 1's */ 5,  /* "211" - n bits are 1's */
+    4,  /* "212" - n bits are 1's */ 5,  /* "213" - n bits are 1's */
+    5,  /* "214" - n bits are 1's */ 6,  /* "215" - n bits are 1's */
+    4,  /* "216" - n bits are 1's */ 5,  /* "217" - n bits are 1's */
+    5,  /* "218" - n bits are 1's */ 6,  /* "219" - n bits are 1's */
+    5,  /* "220" - n bits are 1's */ 6,  /* "221" - n bits are 1's */
+    6,  /* "222" - n bits are 1's */ 7,  /* "223" - n bits are 1's */
+    3,  /* "224" - n bits are 1's */ 4,  /* "225" - n bits are 1's */
+    4,  /* "226" - n bits are 1's */ 5,  /* "227" - n bits are 1's */
+    4,  /* "228" - n bits are 1's */ 5,  /* "229" - n bits are 1's */
+    5,  /* "230" - n bits are 1's */ 6,  /* "231" - n bits are 1's */
+    4,  /* "232" - n bits are 1's */ 5,  /* "233" - n bits are 1's */
+    5,  /* "234" - n bits are 1's */ 6,  /* "235" - n bits are 1's */
+    5,  /* "236" - n bits are 1's */ 6,  /* "237" - n bits are 1's */
+    6,  /* "238" - n bits are 1's */ 7,  /* "239" - n bits are 1's */
+    4,  /* "240" - n bits are 1's */ 5,  /* "241" - n bits are 1's */
+    5,  /* "242" - n bits are 1's */ 6,  /* "243" - n bits are 1's */
+    5,  /* "244" - n bits are 1's */ 6,  /* "245" - n bits are 1's */
+    6,  /* "246" - n bits are 1's */ 7,  /* "247" - n bits are 1's */
+    5,  /* "248" - n bits are 1's */ 6,  /* "249" - n bits are 1's */
+    6,  /* "250" - n bits are 1's */ 7,  /* "251" - n bits are 1's */
+    6,  /* "252" - n bits are 1's */ 7,  /* "253" - n bits are 1's */
+    7,  /* "254" - n bits are 1's */ 8   /* "255" - n bits are 1's */
+};
+
+/* Useful routines for generally private use */
+
+#endif /* BV_MASTER | BV_TESTER */
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+HDFLIBAPI bv_ptr bv_new(int32 num_bits, uint32 flags);
+
+HDFLIBAPI intn bv_delete(bv_ptr b);
+
+HDFLIBAPI intn bv_set(bv_ptr b, int32 bit_num, bv_bool value);
+
+HDFLIBAPI intn bv_get(bv_ptr b, int32 bit_num);
+
+HDFLIBAPI intn bv_clear(bv_ptr b, bv_bool value);
+
+HDFLIBAPI int32 bv_size(bv_ptr b);
+
+HDFLIBAPI uint32 bv_flags(bv_ptr b);
+
+HDFLIBAPI int32 bv_find(bv_ptr b, int32 last_find, bv_bool value);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif /* __BITVECT_H */
+
diff --git a/hdf/src/cdeflate.c b/hdf/src/cdeflate.c
new file mode 100644
index 0000000..d02b771
--- /dev/null
+++ b/hdf/src/cdeflate.c
@@ -0,0 +1,796 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 5489 $";
+#endif
+
+/* $Id: cdeflate.c 5489 2010-10-23 06:52:48Z bmribler $ */
+
+/*
+   FILE
+   cdeflate.c
+   HDF gzip 'deflate' encoding I/O routines
+
+   REMARKS
+
+   DESIGN
+
+   EXPORTED ROUTINES
+   None of these routines are designed to be called by other users except
+   for the modeling layer of the compression routines.
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   10/24/95     Starting coding
+ */
+
+/* General HDF includes */
+#include "hdf.h"
+
+#define CDEFLATE_MASTER
+#define CODER_CLIENT
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* Internal Defines */
+/* #define TESTING */
+
+/* declaration of the functions provided in this module */
+PRIVATE int32 HCIcdeflate_init(compinfo_t *info);
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcdeflate_init -- Initialize a gzip 'deflate' compressed data element.
+
+ USAGE
+    int32 HCIcdeflate_init(info)
+    compinfo_t *info;           IN: special element information
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcdeflate_staccess and HCIcdeflate_seek
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcdeflate_init(compinfo_t *info)
+{
+    CONSTR(FUNC, "HCIcdeflate_init");
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to deflate info */
+
+    if (Hseek(info->aid, 0, 0) == FAIL)  /* seek to beginning of element */
+        HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* Initialize deflation state information */
+    deflate_info->offset = 0;   /* start at the beginning of the data */
+    deflate_info->acc_init = 0; /* second stage of initializing not performed */
+    deflate_info->acc_mode = 0; /* init access mode to illegal value */
+
+    /* initialize compression context */
+    deflate_info->deflate_context.zalloc=(alloc_func)Z_NULL;
+    deflate_info->deflate_context.zfree=(free_func)Z_NULL;
+    deflate_info->deflate_context.opaque=NULL;
+    deflate_info->deflate_context.data_type=Z_BINARY;
+
+    return (SUCCEED);
+}   /* end HCIcdeflate_init() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcdeflate_decode -- Decode skipping Huffman compressed data into a buffer.
+
+ USAGE
+    int32 HCIcdeflate_decode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to read into the buffer
+    uint8 *buf;         OUT: buffer to store the bytes read
+
+ RETURNS
+    Returns # of bytes decompressed or FAIL
+
+ DESCRIPTION
+    Common code called to decode gzip 'deflated' data from the file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcdeflate_decode(compinfo_t * info, int32 length, uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcdeflate_decode");
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to deflate info */
+    int zstat;              /* inflate status */
+    int32 bytes_read;
+
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* Set up the deflation buffers to point to the user's buffer to fill */
+    deflate_info->deflate_context.next_out=buf;
+    deflate_info->deflate_context.avail_out=(uInt)length;
+    while(deflate_info->deflate_context.avail_out>0)
+      {
+          /* Get more bytes from the file, if we've run out */
+          if(deflate_info->deflate_context.avail_in==0)
+            {
+                int32 file_bytes;
+
+                deflate_info->deflate_context.next_in=deflate_info->io_buf;
+                if((file_bytes=Hread(info->aid,DEFLATE_BUF_SIZE,deflate_info->deflate_context.next_in))==FAIL)
+                    HRETURN_ERROR(DFE_READERROR,FAIL);
+                deflate_info->deflate_context.avail_in=(uInt)file_bytes;
+            } /* end if */
+
+          /* Read compressed data */
+          zstat=inflate(&(deflate_info->deflate_context),Z_NO_FLUSH);
+
+          /* break out if we've reached the end of the compressed data */
+          if (zstat == Z_STREAM_END)
+              break;
+
+          /* break out if "inflate" returns reading errors */
+          else if (zstat == Z_VERSION_ERROR)
+          {
+              HRETURN_ERROR(DFE_COMPVERSION,FAIL);
+          }
+          else if (zstat <= Z_ERRNO && zstat > Z_VERSION_ERROR)
+          {
+              HRETURN_ERROR(DFE_READCOMP,FAIL);
+          }
+      } /* end while */
+    bytes_read=(int32)length-(int32)deflate_info->deflate_context.avail_out;
+    deflate_info->offset+=bytes_read;
+
+    return(bytes_read);
+}   /* end HCIcdeflate_decode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcdeflate_encode -- Encode data from a buffer into gzip 'deflated'
+                            compressed data
+
+ USAGE
+    int32 HCIcdeflate_encode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to store from the buffer
+    uint8 *buf;         OUT: buffer to get the bytes from
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to encode gzip 'deflated' data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcdeflate_encode(compinfo_t * info, int32 length, void * buf)
+{
+    CONSTR(FUNC, "HCIcdeflate_encode");
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to skipping Huffman info */
+
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* Set up the deflation buffers to point to the user's buffer to empty */
+    deflate_info->deflate_context.next_in=buf;
+    deflate_info->deflate_context.avail_in=(uInt)length;
+    while(deflate_info->deflate_context.avail_in>0 || deflate_info->deflate_context.avail_out==0)
+      {
+          /* Write more bytes from the file, if we've filled our buffer */
+          if(deflate_info->deflate_context.avail_out==0)
+            {
+                if(deflate_info->deflate_context.next_out!=NULL)
+{
+                    if(Hwrite(info->aid,DEFLATE_BUF_SIZE,deflate_info->io_buf)==FAIL)
+                        HRETURN_ERROR(DFE_WRITEERROR,FAIL);
+}
+                deflate_info->deflate_context.next_out=deflate_info->io_buf;
+                deflate_info->deflate_context.avail_out=DEFLATE_BUF_SIZE;
+            } /* end if */
+
+          /* break out if we've reached the end of the compressed data somehow */
+          if(deflate(&(deflate_info->deflate_context),Z_NO_FLUSH)!=Z_OK) {
+              HRETURN_ERROR(DFE_CENCODE,FAIL);
+          }
+      } /* end while */
+    deflate_info->offset += length;    /* incr. abs. offset into the file */
+
+    return (length);
+}   /* end HCIcdeflate_encode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcdeflate_term -- Close down internal buffering for gzip 'deflate' encoding
+
+ USAGE
+    int32 HCIcdeflate_term(info,acc_mode)
+    compinfo_t *info;   IN: the info about the compressed element
+    uint32 acc_mode;    IN: the access mode the data element was opened with
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to flush gzip 'deflated' data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcdeflate_term(compinfo_t * info,uint32 acc_mode)
+{
+    CONSTR(FUNC, "HCIcdeflate_term");
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to deflation info */
+
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* set flag to indicate second stage of initialization is finished */
+
+    if(deflate_info->acc_init!=0)
+      {
+        if(acc_mode&DFACC_WRITE)
+          { /* flush the "deflated" data to the file */
+              intn status;
+
+              do
+                {
+                  /* Write more bytes from the file, if we've filled our buffer */
+                  if(deflate_info->deflate_context.avail_out==0)
+                    {
+                        if(Hwrite(info->aid,DEFLATE_BUF_SIZE,deflate_info->io_buf)==FAIL)
+                            HRETURN_ERROR(DFE_WRITEERROR,FAIL);
+                        deflate_info->deflate_context.next_out=deflate_info->io_buf;
+                        deflate_info->deflate_context.avail_out=DEFLATE_BUF_SIZE;
+                    } /* end if */
+
+                    status=deflate(&(deflate_info->deflate_context),Z_FINISH);
+                } while(status==Z_OK || deflate_info->deflate_context.avail_out==0);
+              if(status!=Z_STREAM_END)
+                  HRETURN_ERROR(DFE_CENCODE,FAIL);
+              if(deflate_info->deflate_context.avail_out<DEFLATE_BUF_SIZE)
+                  if(Hwrite(info->aid,(int32)(DEFLATE_BUF_SIZE-deflate_info->deflate_context.avail_out),deflate_info->io_buf)==FAIL)
+                      HRETURN_ERROR(DFE_WRITEERROR,FAIL);
+
+              /* Close down the deflation buffer */
+              if(deflateEnd(&(deflate_info->deflate_context))!=Z_OK)
+                  HRETURN_ERROR(DFE_CTERM,FAIL);
+          } /* end if */
+        else
+          { /* finish up any inflated data */
+              /* Close down the inflation buffer */
+              if(inflateEnd(&(deflate_info->deflate_context))!=Z_OK)
+                  HRETURN_ERROR(DFE_CTERM,FAIL);
+          } /* end else */
+      } /* end if */
+
+    /* Reset parameters */
+    deflate_info->offset = 0;   /* start at the beginning of the data */
+    deflate_info->acc_init = 0; /* second stage of initializing not performed */
+    deflate_info->acc_mode = 0; /* init access mode to illegal value */
+
+    return (SUCCEED);
+}   /* end HCIcdeflate_term() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcdeflate_staccess -- Start accessing a gzip 'deflate' compressed data element.
+
+ USAGE
+    int32 HCIcdeflate_staccess(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcdeflate_stread and HCIcdeflate_stwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcdeflate_staccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIcdeflate_staccess");
+    compinfo_t *info;           /* special element information */
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to deflate info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* need to check for not writing, as opposed to read access */
+    /* because of the way the access works */
+#ifdef OLD_WAY
+    if (!(acc_mode&DFACC_WRITE))
+        info->aid = Hstartread(access_rec->file_id, DFTAG_COMPRESSED,
+                                  info->comp_ref);
+    else
+        info->aid = Hstartwrite(access_rec->file_id, DFTAG_COMPRESSED,
+                                   info->comp_ref, info->length);
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+#else /* OLD_WAY */
+    if (!(acc_mode&DFACC_WRITE)) {
+        info->aid = Hstartread(access_rec->file_id, DFTAG_COMPRESSED,
+                                  info->comp_ref);
+      } /* end if */
+    else {
+        info->aid = Hstartaccess(access_rec->file_id, DFTAG_COMPRESSED,
+                                   info->comp_ref, DFACC_RDWR|DFACC_APPENDABLE);
+      } /* end else */
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+#endif /* OLD_WAY */
+
+    /* Make certain we can append to the data when writing */
+    if ((acc_mode&DFACC_WRITE) && Happendable(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+
+    /* initialize the common deflate coding info */
+    if(HCIcdeflate_init(info)==FAIL)
+        HRETURN_ERROR(DFE_CODER,FAIL);
+
+    /* Allocate compression I/O buffer */
+    if ((deflate_info->io_buf= HDmalloc(DEFLATE_BUF_SIZE)) == NULL)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+    
+    return (SUCCEED);
+}   /* end HCIcdeflate_staccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcdeflate_staccess2 -- 2nd half of start accessing a gzip 'deflate'
+                            compressed data element.
+
+ USAGE
+    int32 HCIcdeflate_staccess2(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcdeflate_stread and HCIcdeflate_stwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcdeflate_staccess2(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIcdeflate_staccess2");
+    compinfo_t *info;           /* special element information */
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to deflate info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* Initialize the gzip library */
+    if(acc_mode&DFACC_WRITE)
+      {
+        if(deflateInit(&(deflate_info->deflate_context),deflate_info->deflate_level)!=Z_OK)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+
+        /* set access mode */
+        deflate_info->acc_mode=DFACC_WRITE;
+
+        /* force I/O with the file at first */
+        deflate_info->deflate_context.next_out=NULL;
+        deflate_info->deflate_context.avail_out=0;
+      } /* end if */
+    else
+      {
+        if(inflateInit(&(deflate_info->deflate_context))!=Z_OK)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+
+        /* set access mode */
+        deflate_info->acc_mode=DFACC_READ;
+        
+        /* force I/O with the file at first */
+        deflate_info->deflate_context.avail_in=0;
+      } /* end else */
+
+    /* set flag to indicate second stage of initialization is finished */
+    deflate_info->acc_init=acc_mode;
+
+    return (SUCCEED);
+}   /* end HCIcdeflate_staccess2() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcdeflate_stread -- start read access for compressed file
+
+ USAGE
+    int32 HCPcdeflate_stread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start read access on a compressed data element using the deflate scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcdeflate_stread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcdeflate_stread");
+
+    if (HCIcdeflate_staccess(access_rec, DFACC_READ) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcdeflate_stread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcdeflate_stwrite -- start write access for compressed file
+
+ USAGE
+    int32 HCPcdeflate_stwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start write access on a compressed data element using the deflate scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcdeflate_stwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcdeflate_stwrite");
+
+    if (HCIcdeflate_staccess(access_rec, DFACC_WRITE) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcdeflate_stwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcdeflate_seek -- Seek to offset within the data element
+
+ USAGE
+    int32 HCPcdeflate_seek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from [UNUSED!]
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Seek to a position with a compressed data element.  The 'origin'
+    calculations have been taken care of at a higher level, it is an
+    un-used parameter.  The 'offset' is used as an absolute offset
+    because of this.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcdeflate_seek(accrec_t * access_rec, int32 offset, int origin)
+{
+    CONSTR(FUNC, "HCPcdeflate_seek");
+    compinfo_t *info;           /* special element information */
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to gzip 'deflate' info */
+    uint8      tmp_buf[DEFLATE_TMP_BUF_SIZE];   /* temporary buffer */
+
+    /* shut compiler up */
+    origin = origin;
+
+    info = (compinfo_t *) access_rec->special_info;
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* Check if second stage of initialization has been performed */
+    if(deflate_info->acc_init==0)
+      {
+        if (HCIcdeflate_staccess2(access_rec, DFACC_READ) == FAIL)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+      } /* end if */
+
+    if (offset < deflate_info->offset)
+      {     /* need to seek from the beginning */
+#ifdef OLD_WAY
+          /* Reset the decompression buffer */
+          if (deflateReset(&(deflate_info->deflate_context))!=Z_OK)
+              HRETURN_ERROR(DFE_CINIT, FAIL);
+#else /* OLD_WAY */
+        /* Terminate the previous method of access */
+        if (HCIcdeflate_term(info, deflate_info->acc_mode) == FAIL)
+            HRETURN_ERROR(DFE_CTERM, FAIL);
+
+        /* Restart access */
+        /* if (HCIcdeflate_staccess2(access_rec, deflate_info->acc_mode) == FAIL) */
+        if (HCIcdeflate_staccess2(access_rec, DFACC_READ) == FAIL)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+
+#endif /* OLD_WAY */
+
+          /* Go back to the beginning of the data-stream */
+          if(Hseek(info->aid,0,0)==FAIL)
+              HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+      }     /* end if */
+
+#ifdef OLD_WAY
+    if ((tmp_buf = (uint8 *) HDmalloc(DEFLATE_TMP_BUF_SIZE)) == NULL)     /* get tmp buffer */
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+#endif /* OLD_WAY */
+
+    while (deflate_info->offset + DEFLATE_TMP_BUF_SIZE < offset) {    /* grab chunks */
+        if (HCIcdeflate_decode(info, DEFLATE_TMP_BUF_SIZE, tmp_buf) == FAIL)
+          {
+#ifdef OLD_WAY
+              HDfree(tmp_buf);
+#endif /* OLD_WAY */
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+      }     /* end if */
+    if (deflate_info->offset < offset) {  /* grab the last chunk */
+        if (HCIcdeflate_decode(info, offset - deflate_info->offset, tmp_buf) == FAIL)
+          {
+#ifdef OLD_WAY
+              HDfree(tmp_buf);
+#endif /* OLD_WAY */
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+      }     /* end if */
+
+#ifdef OLD_WAY
+    HDfree(tmp_buf);
+#endif /* OLD_WAY */
+    return (SUCCEED);
+}   /* HCPcdeflate_seek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcdeflate_read -- Read in a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcdeflate_read(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+
+ RETURNS
+    Returns the number of bytes read or FAIL
+
+ DESCRIPTION
+    Read in a number of bytes from the deflate compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcdeflate_read(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPcdeflate_read");
+    compinfo_t *info;           /* special element information */
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to gzip 'deflate' info */
+    uintn uninit;               /* Whether the interface was initialized */
+
+    info = (compinfo_t *) access_rec->special_info;
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* Check if second stage of initialization has been performed */
+    if(deflate_info->acc_init!=DFACC_READ)
+      {
+        /* preserve the initialized state for later */
+        uninit=(deflate_info->acc_init!=0);
+
+        /* Terminate the previous method of access */
+        if (HCIcdeflate_term(info, deflate_info->acc_mode) == FAIL)
+            HRETURN_ERROR(DFE_CTERM, FAIL);
+
+        /* Restart access */
+        if (HCIcdeflate_staccess2(access_rec, DFACC_READ) == FAIL)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+
+        /* Go back to the beginning of the data-stream */
+        if(Hseek(info->aid,0,0)==FAIL)
+            HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+      } /* end if */
+
+    if ((length=HCIcdeflate_decode(info, length, data)) == FAIL)
+        HRETURN_ERROR(DFE_CDECODE, FAIL);
+
+    return (length);
+}   /* HCPcdeflate_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcdeflate_write -- Write out a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcdeflate_write(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+
+ RETURNS
+    Returns the number of bytes written or FAIL
+
+ DESCRIPTION
+    Write out a number of bytes to the deflate compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcdeflate_write(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPcdeflate_write");
+    compinfo_t *info;           /* special element information */
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to skipping Huffman info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* Don't allow random write in a dataset unless: */
+    /*  1 - append onto the end */
+    /*  2 - start at the beginning and rewrite (at least) the whole dataset */
+    if ((info->length != deflate_info->offset)
+        && (deflate_info->offset != 0 || length < info->length))
+        HRETURN_ERROR(DFE_UNSUPPORTED, FAIL);
+
+    /* Check if second stage of initialization has been performed */
+    if(deflate_info->acc_init!=DFACC_WRITE)
+      {
+        /* Terminate the previous method of access */
+        if (HCIcdeflate_term(info, deflate_info->acc_init) == FAIL)
+            HRETURN_ERROR(DFE_CTERM, FAIL);
+
+        /* Restart access */
+        if (HCIcdeflate_staccess2(access_rec, DFACC_WRITE) == FAIL)
+            HRETURN_ERROR(DFE_CINIT, FAIL);
+
+        /* Go back to the beginning of the data-stream */
+        if(Hseek(info->aid,0,0)==FAIL)
+            HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+      } /* end if */
+
+    if ((length=HCIcdeflate_encode(info, length, (void *)data)) == FAIL)
+        HRETURN_ERROR(DFE_CENCODE, FAIL);
+
+    return (length);
+}   /* HCPcdeflate_write() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcdeflate_inquire -- Inquire information about the access record and data element.
+
+ USAGE
+    int32 HCPcdeflate_inquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+            paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Inquire information about the access record and data element.
+    [Currently a NOP].
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcdeflate_inquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+                    uint16 *pref, int32 *plength, int32 *poffset,
+                    int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    /* shut compiler up */
+    access_rec = access_rec;
+    pfile_id = pfile_id;
+    ptag = ptag;
+    pref = pref;
+    plength = plength;
+    poffset = poffset;
+    pposn = pposn;
+    paccess = paccess;
+    pspecial = pspecial;
+
+    return (SUCCEED);
+}   /* HCPcdeflate_inquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcdeflate_endaccess -- Close the compressed data element
+
+ USAGE
+    int32 HCPcdeflate_endaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Close the compressed data element and free encoding info.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPcdeflate_endaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcdeflate_endaccess");
+    compinfo_t *info;           /* special element information */
+    comp_coder_deflate_info_t *deflate_info;    /* ptr to gzip 'deflate' info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    deflate_info = &(info->cinfo.coder_info.deflate_info);
+
+    /* flush out buffer */
+    if (HCIcdeflate_term(info,deflate_info->acc_mode) == FAIL)
+        HRETURN_ERROR(DFE_CTERM, FAIL);
+
+    /* Get rid of the I/O buffer */
+    HDfree(deflate_info->io_buf);
+
+    /* close the compressed data AID */
+    if (Hendaccess(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_CANTCLOSE, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcdeflate_endaccess() */
+
diff --git a/hdf/src/cdeflate.h b/hdf/src/cdeflate.h
new file mode 100644
index 0000000..65b1d99
--- /dev/null
+++ b/hdf/src/cdeflate.h
@@ -0,0 +1,103 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ /* $Id: cdeflate.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+ /*-----------------------------------------------------------------------------
+ * File:    cdeflate.h
+ * Purpose: Header file for gzip 'deflate' encoding information.
+ * Dependencies: should only be included from hcompi.h
+ * Invokes: none
+ * Contents: Structures & definitions for gzip 'deflate' encoding.
+ * Structure definitions:
+ * Constant definitions:
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __CDEFLATE_H
+#define __CDEFLATE_H
+
+/* Get the gzip 'deflate' header */
+#define intf zintf
+#include "zlib.h"
+#undef zintf
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+   ** from cdeflate.c
+ */
+
+    extern int32 HCPcdeflate_stread
+                (accrec_t * rec);
+
+    extern int32 HCPcdeflate_stwrite
+                (accrec_t * rec);
+
+    extern int32 HCPcdeflate_seek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    extern int32 HCPcdeflate_inquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    extern int32 HCPcdeflate_read
+                (accrec_t * access_rec, int32 length, void * data);
+
+    extern int32 HCPcdeflate_write
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    extern intn HCPcdeflate_endaccess
+                (accrec_t * access_rec);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/* Define the [default] size of the buffer to interact with the file. */
+#define DEFLATE_BUF_SIZE    4096
+#define DEFLATE_TMP_BUF_SIZE        16384
+
+/* gzip [en|de]coding information */
+typedef struct
+{
+    intn        deflate_level;  /* how hard to try to compress this data */
+    int32       offset;         /* offset in the de-compressed array */
+    intn        acc_init;       /* is access mode initialized? */
+    int16       acc_mode;       /* access mode desired */
+    void *       io_buf;         /* buffer for I/O with the file */
+    z_stream    deflate_context;    /* pointer to the deflation context for each byte in the element */
+}
+comp_coder_deflate_info_t;
+
+#ifndef CDEFLATE_MASTER
+extern funclist_t cdeflate_funcs;   /* functions to perform gzip encoding */
+#else
+funclist_t  cdeflate_funcs =
+{                               /* functions to perform gzip encoding */
+    HCPcdeflate_stread,
+    HCPcdeflate_stwrite,
+    HCPcdeflate_seek,
+    HCPcdeflate_inquire,
+    HCPcdeflate_read,
+    HCPcdeflate_write,
+    HCPcdeflate_endaccess
+};
+#endif
+
+#endif /* __CDEFLATE_H */
+
diff --git a/hdf/src/cnbit.c b/hdf/src/cnbit.c
new file mode 100644
index 0000000..e91e8f7
--- /dev/null
+++ b/hdf/src/cnbit.c
@@ -0,0 +1,823 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: cnbit.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+   FILE
+   cnbit.c
+   HDF N-bit encoding I/O routines
+
+   REMARKS
+
+   DESIGN
+
+   EXPORTED ROUTINES
+   None of these routines are designed to be called by other users except
+   for the modeling layer of the compression routines.
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   10/10/93     Starting writing specs & coding prototype
+ */
+
+/* General HDF includes */
+#include "hdf.h"
+
+#define CNBIT_MASTER
+#define CODER_CLIENT
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* Internal Defines */
+/* #define TESTING */
+
+/* Local Variables */
+static const uint8 mask_arr8[9] =
+{                               /* array of values with [n] bits set */
+    0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF
+};
+
+static const uint32 mask_arr32[33] =
+{                               /* array of values with [n] bits set */
+    0x00000000,
+    0x00000001, 0x00000003, 0x00000007, 0x0000000F,
+    0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF,
+    0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF,
+    0x00001FFF, 0x00003FFF, 0x00007FFF, 0x0000FFFF,
+    0x0001FFFF, 0x0003FFFF, 0x0007FFFF, 0x000FFFFF,
+    0x001FFFFF, 0x003FFFFF, 0x007FFFFF, 0x00FFFFFF,
+    0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF, 0x0FFFFFFF,
+    0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFFUL
+};
+
+/* declaration of the functions provided in this module */
+PRIVATE int32 HCIcnbit_staccess
+            (accrec_t * access_rec, int16 acc_mode);
+
+PRIVATE int32 HCIcnbit_init
+            (accrec_t * access_rec);
+
+PRIVATE int32 HCIcnbit_decode
+            (compinfo_t * info, int32 length, uint8 *buf);
+
+PRIVATE int32 HCIcnbit_encode
+            (compinfo_t * info, int32 length, const uint8 *buf);
+
+PRIVATE int32 HCIcnbit_term
+            (compinfo_t * info);
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcnbit_init -- Initialize a N-bit compressed data element.
+
+ USAGE
+    int32 HCIcnbit_init(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcnbit_staccess and HCIcnbit_seek
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcnbit_init(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCIcnbit_init");
+    compinfo_t *info;           /* special element information */
+    comp_coder_nbit_info_t *nbit_info;  /* ptr to N-bit info */
+    intn        bits;           /* number of bits in number type */
+    intn        top_bit, bot_bit;   /* bits around a range of bytes */
+    intn        mask_top, mask_bot;     /* top and bottom bits in mask */
+    intn        i;              /* local counting variable */
+
+    info = (compinfo_t *) access_rec->special_info;
+#ifdef TESTING
+    printf("HCIcnbit_init(): info=%p\n", info);
+#endif
+    if (Hbitseek(info->aid, 0, 0) == FAIL)  /* seek to beginning of element */
+        HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+#ifdef TESTING
+    printf("HCIcnbit_init(): after seek call\n");
+    printf("HCIcnbit_init(): 0.1 - coder_func.write=%p\n", info->cinfo.coder_funcs.write);
+#endif
+
+    nbit_info = &(info->cinfo.coder_info.nbit_info);
+
+    /* Initialize N-bit state information */
+    nbit_info->buf_pos = NBIT_BUF_SIZE;     /* start at the beginning of the buffer */
+    nbit_info->nt_pos = 0;  /* start at beginning of the NT info */
+    nbit_info->offset = 0;  /* offset into the file */
+#ifdef TESTING
+    printf("HCIcnbit_init(): 0.4 - coder_func.write=%p\n", info->cinfo.coder_funcs.write);
+#endif
+    HDmemset(nbit_info->mask_buf, (nbit_info->fill_one == TRUE ? 0xff : 0),
+             nbit_info->nt_size);
+#ifdef TESTING
+    printf("HCIcnbit_init(): 0.5 - fill_one=%d, sign_ext=%d\n", (int) nbit_info->fill_one, (int) nbit_info->sign_ext);
+#endif
+
+    bits = nbit_info->nt_size * 8;  /* compute # of bits */
+    mask_top = nbit_info->mask_off;     /* compute top and bottom ends of mask */
+    mask_bot = nbit_info->mask_off - (nbit_info->mask_len - 1);
+
+    top_bit = bits - 1;     /* set the initial top and bottom bits */
+    bot_bit = bits - 8;
+#ifdef TESTING
+    printf("HCIcnbit_init(): 0.6 - mask_top=%d, mask_bot=%d, bits=%d, top_bit=%d, bot_bit=%d\n", mask_top, mask_bot, bits, top_bit, bot_bit);
+#endif
+    HDmemset(nbit_info->mask_info, 0, sizeof(nbit_info->mask_info));    /* set to 0 */
+#ifdef TESTING
+    printf("HCIcnbit_init(): before init'ing mask, nt_size=%d\n", nbit_info->nt_size);
+    printf("HCIcnbit_init(): 1 - coder_func.write=%p\n", info->cinfo.coder_funcs.write);
+#endif
+    for (i = 0; i < nbit_info->nt_size; i++)
+      {     /* initialize the bitmask info */
+#ifdef TESTING
+          printf("HCIcnbit_init(): i=%d, mask_top=%d, mask_bot=%d, top_bit=%d, bot_bit=%d\n", i, mask_top, mask_bot, top_bit, bot_bit);
+#endif
+          if (mask_top >= top_bit)
+            {   /* mask offset is above current top bit */
+                if (mask_bot <= bot_bit)
+                  {     /* entire byte is in mask */
+                      nbit_info->mask_info[i].offset = 7;
+                      nbit_info->mask_info[i].length = 8;
+                      nbit_info->mask_info[i].mask = mask_arr8[8];
+                  }     /* end if */
+                else
+                  {     /* only top part of byte is in mask */
+                      nbit_info->mask_info[i].offset = 7;
+                      nbit_info->mask_info[i].length = (top_bit - mask_bot) + 1;
+                      nbit_info->mask_info[i].mask = (uint8) (mask_arr8[(top_bit - mask_bot) + 1] << (8 - ((top_bit - mask_bot) + 1)));
+                      break;    /* we've found the bottom of the mask, we're done */
+                  }     /* end else */
+            }   /* end if */
+          else
+            {   /* mask top is below current top bit */
+                if (mask_top >= bot_bit)
+                  {     /* mask top is inside current byte */
+                      if (mask_bot < bot_bit)
+                        {   /* mask top to bottom of byte is in mask */
+                            nbit_info->mask_info[i].offset = mask_top - bot_bit;
+                            nbit_info->mask_info[i].length = (mask_top - bot_bit) + 1;
+                            nbit_info->mask_info[i].mask = mask_arr8[(mask_top - bot_bit) + 1];
+                        }   /* end if */
+                      else
+                        {   /* entire bit-field is inside of this byte */
+                            nbit_info->mask_info[i].offset = mask_top - bot_bit;
+                            nbit_info->mask_info[i].length = (mask_top - mask_bot) + 1;
+                            nbit_info->mask_info[i].mask = (uint8) (mask_arr8[(mask_top - mask_bot) + 1] << (mask_bot - bot_bit));
+                            break;  /* we've found the bottom of the mask, we're done */
+                        }   /* end else */
+                  }     /* end if */
+                else
+                    /* mask top is below bottom bit, just continue */
+                  {
+                  }
+            }   /* end else */
+          top_bit -= 8;     /* decrement location in fill mask */
+          bot_bit -= 8;
+      }     /* end for */
+#ifdef TESTING
+    printf("HCIcnbit_init(): after init'ing mask\n");
+    printf("HCIcnbit_init(): 2 - coder_func.write=%p\n", info->cinfo.coder_funcs.write);
+#endif
+
+    /* mask to 0 the bits where the bit-field will go */
+    if (nbit_info->fill_one == TRUE)
+      {
+          for (i = 0; i < nbit_info->nt_size; i++)
+              nbit_info->mask_buf[i] &= ~(nbit_info->mask_info[i].mask);
+      }     /* end if */
+
+#ifdef TESTING
+    printf("HCIcnbit_init(): successful\n");
+    printf("HCIcnbit_init(): 3 - coder_func.write=%p\n", info->cinfo.coder_funcs.write);
+#endif
+    return (SUCCEED);
+}   /* end HCIcnbit_init() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcnbit_decode -- Decode n-bit data into a buffer.
+
+ USAGE
+    int32 HCIcnbit_decode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to read into the buffer
+    uint8 *buf;         OUT: buffer to store the bytes read
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to decode n-bit data from the file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcnbit_decode(compinfo_t * info, int32 length, uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcnbit_decode");
+    comp_coder_nbit_info_t *nbit_info;  /* ptr to n-bit info */
+    int32       orig_length;    /* original length to write */
+    uint32      input_bits;     /* bits read from the file */
+    uint32      sign_mask,      /* mask to get the sign bit */
+                sign_ext_mask;  /* mask for sign extension */
+    intn        sign_byte,      /* byte which contains the sign bit */
+                sign_bit = 0;   /* the sign bit from the n_bit data */
+    nbit_mask_info_t *mask_info;    /* ptr to the mask info */
+    intn        copy_length;    /* number of bytes to copy */
+    intn        buf_size,       /* size of the expansion buffer to use */
+                buf_items;      /* number of items which will fit into expansion buffer */
+    uint8      *rbuf, *rbuf2;   /* pointer into the n-bit read buffer */
+    intn        i, j;           /* local counting variable */
+
+    /* get a local ptr to the nbit info for convenience */
+    nbit_info = &(info->cinfo.coder_info.nbit_info);
+
+#ifdef TESTING
+    printf("HCIcnbit_decode(): nbit_info=%p\n", nbit_info);
+#endif
+    /* calculate sign extension information */
+    sign_ext_mask = ~mask_arr32[nbit_info->mask_off % 8];   /* sign mask has all 1's in upper bits */
+    sign_byte = nbit_info->nt_size - ((nbit_info->mask_off / 8) + 1);
+    sign_mask = mask_arr32[(nbit_info->mask_off % 8) + 1] ^
+        mask_arr32[nbit_info->mask_off % 8];
+#ifdef TESTING
+    printf("HCInbit_decode(): sign_ext=%d,sign_ext_mask=%lx, sign_byte=%d, sign_mask=%lx\n", nbit_info->sign_ext, (unsigned long) sign_ext_mask, (int) sign_byte, (unsigned long) sign_mask);
+    printf("HCInbit_decode(): file_one=%d\n", nbit_info->fill_one);
+    for (j = 0; j < nbit_info->nt_size; j++)
+        printf("HCInbit_decode(): j=%d, mask=%x, offset=%d, length=%d\n", j, (unsigned) nbit_info->mask_info[j].mask, (int) nbit_info->mask_info[j].offset, (int) nbit_info->mask_info[j].length);
+#endif
+
+    buf_size = MIN(NBIT_BUF_SIZE, length);
+    buf_items = buf_size / nbit_info->nt_size;  /* compute # of items in buffer */
+    orig_length = length;   /* save this for later */
+    while (length > 0)
+      {     /* decode until we have all the bytes */
+#ifdef TESTING
+          printf("HCInbit_decode(): length=%d, buf=%p, buf_items=%d\n", length, buf, buf_items);
+#endif
+          if (nbit_info->buf_pos >= buf_size)
+            {   /* re-fill buffer */
+                rbuf = (uint8 *) nbit_info->buffer;     /* get a ptr to the buffer */
+
+                /* get initial copy of the mask */
+                HDmemfill(rbuf, nbit_info->mask_buf, (uint32)nbit_info->nt_size, (uint32)buf_items);
+
+                for (i = 0; i < buf_items; i++)
+                  {
+                      /* get a ptr to the mask info for convenience also */
+                      mask_info = &(nbit_info->mask_info[0]);
+
+                      if (nbit_info->sign_ext)
+                        {   /* special code for expanding sign extended data */
+#ifdef TESTING
+                            printf("HCInbit_decode(): sign extending\n");
+#endif
+                            rbuf2 = rbuf;   /* set temporary pointer into buffer */
+                            for (j = 0; j < nbit_info->nt_size; j++, mask_info++, rbuf2++)
+                              {
+                                  if (mask_info->length > 0)
+                                    {   /* check if we need to read bits */
+                                        Hbitread(info->aid, mask_info->length, &input_bits);
+                                        input_bits <<= (mask_info->offset - mask_info->length) + 1;
+                                        *rbuf2 |= (uint8)(mask_info->mask & (uint8)input_bits);
+                                        if (j == sign_byte)     /* check if this is the sign byte */
+                                            sign_bit = sign_mask & input_bits ? 1 : 0;
+                                    }   /* end if */
+                              }     /* end for */
+
+#ifdef TESTING
+                            printf("HCInbit_decode(): i=%d, sign_bit=%d, input_bits=%x\n", i, sign_bit, input_bits);
+#endif
+                            /* we only have to sign extend if the sign is not the same */
+                            /* as the bit we are filling the n-bit data with */
+                            if (sign_bit != nbit_info->fill_one)
+                              {
+                                  rbuf2 = rbuf;     /* set temporary pointer into buffer */
+                                  if (sign_bit == 1)
+                                    {   /* fill with ones */
+                                        for (j = 0; j < sign_byte; j++, rbuf2++)
+                                            *rbuf2 = 0xff;
+                                        *rbuf2 |= (uint8)sign_ext_mask;
+                                    }   /* end if */
+                                  else
+                                    {   /* fill with zeroes */
+                                        for (j = 0; j < sign_byte; j++, rbuf2++)
+                                            *rbuf2 = 0x00;
+                                        *rbuf2 &= (uint8)~sign_ext_mask;
+                                    }   /* end else */
+                              }     /* end if */
+                            rbuf += nbit_info->nt_size;     /* increment buffer ptr */
+                        }   /* end if */
+                      else
+                        {   /* no sign extension */
+#ifdef TESTING
+                            printf("HCInbit_decode(): NO sign extention\n");
+#endif
+                            for (j = 0; j < nbit_info->nt_size; j++, mask_info++, rbuf++)
+                              {
+                                  if (mask_info->length > 0)
+                                    {   /* check if we need to read bits */
+                                        if (Hbitread(info->aid, mask_info->length, &input_bits) != mask_info->length)
+                                            HRETURN_ERROR(DFE_CDECODE, FAIL);
+#ifdef TESTING
+                                        printf("HCInbit_decode(): input_bits=%d\n", (int) input_bits);
+#endif
+                                        *rbuf |= (uint8)(mask_info->mask & (uint8)(input_bits <<
+                                                                    ((mask_info->offset - mask_info->length) + 1)));
+#ifdef TESTING
+                                        printf("HCInbit_decode(): j=%d, length=%d, *rbuf=%x\n", j, mask_info->length, (unsigned) *rbuf);
+#endif
+                                    }   /* end if */
+                              }     /* end for */
+                        }   /* end else */
+                  }     /* end for */
+
+                nbit_info->buf_pos = 0;     /* reset buffer position */
+            }   /* end if */
+
+          copy_length = (intn) ((length > (buf_size - nbit_info->buf_pos)) ?
+                                (buf_size - nbit_info->buf_pos) : length);
+
+          HDmemcpy(buf, &(nbit_info->buffer[nbit_info->buf_pos]), copy_length);
+
+          buf += copy_length;
+          length -= copy_length;
+          nbit_info->buf_pos += copy_length;
+      }     /* end for */
+
+    nbit_info->offset += orig_length;   /* incr. abs. offset into the file */
+    return (SUCCEED);
+}   /* end HCIcnbit_decode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcnbit_encode -- Encode data from a buffer into n-bit data
+
+ USAGE
+    int32 HCIcnbit_encode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to store from the buffer
+    const uint8 *buf;         OUT: buffer to get the bytes from
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to encode n-bit data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcnbit_encode(compinfo_t * info, int32 length, const uint8 *buf)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HCIcnbit_encode");
+#endif
+    comp_coder_nbit_info_t *nbit_info;  /* ptr to n-bit info */
+    int32       orig_length;    /* original length to write */
+    uint32      output_bits;    /* bits to write to the file */
+    nbit_mask_info_t *mask_info;    /* ptr to the mask info */
+
+    /* get a local ptr to the nbit info for convenience */
+    nbit_info = &(info->cinfo.coder_info.nbit_info);
+
+#ifdef TESTING
+    printf("HCIcnbit_encode(): nbit_info=%p, length=%d, buf=%p\n", nbit_info, length, buf);
+#endif
+    /* get a ptr to the mask info for convenience also */
+    mask_info = &(nbit_info->mask_info[nbit_info->nt_pos]);
+
+    orig_length = length;   /* save this for later */
+    for (; length > 0; length--, buf++)
+      {     /* encode until we store all the bytes */
+#ifdef TESTING
+          printf("HCIcnbit_encode(): length=%d, buf=%p, nt_pos=%d\n", length, buf, nbit_info->nt_pos);
+          printf("HCIcnbit_encode(): mask->length=%d, offset=%d, mask=%x\n", mask_info->length, mask_info->offset, mask_info->mask);
+#endif
+          if (mask_info->length > 0)
+            {   /* check if we need to output bits */
+                output_bits = (uint32)(((*buf) & (mask_info->mask)) >>
+                    ((mask_info->offset - mask_info->length) + 1));
+#ifdef TESTING
+                printf("HCIcnbit_encode(): output_bits=%x\n", (unsigned) output_bits);
+#endif
+                Hbitwrite(info->aid, mask_info->length, output_bits);
+            }   /* end if */
+
+          /* advance to the next mask position */
+          mask_info++;
+          /* advance buffer offset and check for wrap */
+          if ((++nbit_info->nt_pos) >= nbit_info->nt_size)
+            {
+                nbit_info->nt_pos = 0;  /* reset to beginning of buffer */
+                mask_info = nbit_info->mask_info;   /* reset ptr to masks also */
+            }   /* end if */
+      }     /* end for */
+
+    nbit_info->offset += orig_length;   /* incr. abs. offset into the file */
+    return (SUCCEED);
+}   /* end HCIcnbit_encode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcnbit_term -- Flush any data left to the dataset
+
+ USAGE
+    int32 HCIcnbit_term(info)
+    compinfo_t *info;   IN: the info about the compressed element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to flush n-bit data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcnbit_term(compinfo_t * info)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HCIcnbit_term");
+#endif
+
+    /* shut compiler up */
+    info = info;
+
+#ifdef TESTING
+    printf("HCPcnbit_term(): func called\n");
+#endif
+    return (SUCCEED);
+}   /* end HCIcnbit_term() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcnbit_staccess -- Start accessing a N-bit data element.
+
+ USAGE
+    int32 HCIcnbit_staccess(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcnbit_stread and HCIcnbit_stwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcnbit_staccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIcnbit_staccess");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+#ifdef TESTING
+    printf("HCIcnbit_staccess(): info=%p, ref=%d\n", info, (int) info->comp_ref);
+#endif
+    if (acc_mode == DFACC_READ)
+        info->aid = Hstartbitread(access_rec->file_id, DFTAG_COMPRESSED,
+                                  info->comp_ref);
+    else
+        info->aid = Hstartbitwrite(access_rec->file_id, DFTAG_COMPRESSED,
+                                   info->comp_ref, info->length);
+
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+    if ((acc_mode&DFACC_WRITE) && Hbitappendable(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+#ifdef TESTING
+    printf("HCIcnbit_staccess(): info->aid=%d, coder_func.write=%p\n", info->aid, info->cinfo.coder_funcs.write);
+#endif
+    return (HCIcnbit_init(access_rec));     /* initialize the N-bit info */
+}   /* end HCIcnbit_staccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPclre_stread -- start read access for compressed file
+
+ USAGE
+    int32 HCPmstdio_stread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start read access on a compressed data element using a simple RLE scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnbit_stread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcnbit_stread");
+    int32       ret;
+
+    if ((ret = HCIcnbit_staccess(access_rec, DFACC_READ)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcnbit_stread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPclre_stwrite -- start write access for compressed file
+
+ USAGE
+    int32 HCPmstdio_stwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start write access on a compressed data element using a simple RLE scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnbit_stwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcnbit_stwrite");
+    int32       ret;
+
+#ifdef TESTING
+    printf("HCPcnbit_stwrite(): entering\n");
+#endif
+    if ((ret = HCIcnbit_staccess(access_rec, DFACC_WRITE)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcnbit_stwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnbit_seek -- Seek to offset within the data element
+
+ USAGE
+    int32 HCPcnbit_seek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from [UNUSED!]
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Seek to a position with a compressed data element.  The 'origin'
+    calculations have been taken care of at a higher level, it is an
+    un-used parameter.  The 'offset' is used as an absolute offset
+    because of this.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnbit_seek(accrec_t * access_rec, int32 offset, int origin)
+{
+    CONSTR(FUNC, "HCPcnbit_seek");
+    compinfo_t *info;           /* special element information */
+    comp_coder_nbit_info_t *nbit_info;  /* ptr to n-bit info */
+    int32       bit_offset;     /* offset of the bit to seek to */
+
+    /* shut compiler up */
+    origin = origin;
+
+    info = (compinfo_t *) access_rec->special_info;
+    nbit_info = &(info->cinfo.coder_info.nbit_info);
+
+    /* only seek to an even multiple of the NT-sized elements in the dataset */
+    if (offset % nbit_info->nt_size != 0)
+        HRETURN_ERROR(DFE_CSEEK, FAIL);
+
+    bit_offset = (offset / nbit_info->nt_size) * nbit_info->mask_len;
+
+    if (Hbitseek(info->aid, bit_offset / 8, (intn) (bit_offset % 8)) == FAIL)
+        HRETURN_ERROR(DFE_CSEEK, FAIL);
+
+    nbit_info->buf_pos = NBIT_BUF_SIZE;     /* force re-read if writing */
+    nbit_info->nt_pos = 0;  /* start at the first byte of the mask */
+    nbit_info->offset = offset;     /* set abs. offset into the file */
+
+    return (SUCCEED);
+}   /* HCPcnbit_seek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPclre_read -- Read in a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcnbit_read(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+
+ RETURNS
+    Returns the number of bytes read or FAIL
+
+ DESCRIPTION
+    Read in a number of bytes from a RLE compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnbit_read(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPcnbit_read");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (HCIcnbit_decode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CDECODE, FAIL);
+
+    return length;
+}   /* HCPcnbit_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnbit_write -- Write out a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPwrite(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+
+ RETURNS
+    Returns the number of bytes written or FAIL
+
+ DESCRIPTION
+    Write out a number of bytes to a RLE compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnbit_write(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPcnbit_write");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+#ifdef TESTING
+    printf("HCPcnbit_write(): before HCIcnbit_encode() call\n");
+#endif
+    if (HCIcnbit_encode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CENCODE, FAIL);
+#ifdef TESTING
+    printf("HCPcnbit_write(): after HCIcnbit_encode() call\n");
+#endif
+
+    return (length);
+}   /* HCPcnbit_write() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPclre_inquire -- Inquire information about the access record and data element.
+
+ USAGE
+    int32 HCPcnbit_inquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+            paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Inquire information about the access record and data element.
+    [Currently a NOP].
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnbit_inquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+                 uint16 *pref, int32 *plength, int32 *poffset,
+                 int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    /* shut compiler up */
+    access_rec = access_rec;
+    pfile_id = pfile_id;
+    ptag = ptag;
+    pref = pref;
+    plength = plength;
+    poffset = poffset;
+    pposn = pposn;
+    paccess = paccess;
+    pspecial = pspecial;
+
+    return (SUCCEED);
+}   /* HCPcnbit_inquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnbit_endaccess -- Close the compressed data element
+
+ USAGE
+    intn HCPnbit_endaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Close the compressed data element and free modelling info.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPcnbit_endaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcnbit_endaccess");
+    compinfo_t *info;           /* special element information */
+
+#ifdef TESTING
+    printf("HCPcnbit_endaccess(): entering\n");
+#endif
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* flush out n-bit buffer */
+    if (access_rec->access&DFACC_WRITE)
+        if (HCIcnbit_term(info) == FAIL)
+            HRETURN_ERROR(DFE_CTERM, FAIL);
+
+#ifdef TESTING
+    printf("HCPcnbit_endaccess(): before Hendbitaccess call\n");
+#endif
+    /* close the n-bit data AID */
+    if (Hendbitaccess(info->aid, 0) == FAIL)
+        HRETURN_ERROR(DFE_CANTCLOSE, FAIL);
+
+#ifdef TESTING
+    printf("HCPcnbit_endaccess(): after Hendbitaccess call\n");
+#endif
+    return (SUCCEED);
+}   /* HCPcnbit_endaccess() */
diff --git a/hdf/src/cnbit.h b/hdf/src/cnbit.h
new file mode 100644
index 0000000..88c1f24
--- /dev/null
+++ b/hdf/src/cnbit.h
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ /* $Id: cnbit.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+ /*-----------------------------------------------------------------------------
+ * File:    cnbit.h
+ * Purpose: Header file for N-bit encoding information.
+ * Dependencies: should only be included from hcompi.h
+ * Invokes: none
+ * Contents: Structures & definitions for N-bit encoding.
+ * Structure definitions:
+ * Constant definitions:
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __CNBIT_H
+#define __CNBIT_H
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+   ** from cnbit.c
+ */
+
+    extern int32 HCPcnbit_stread
+                (accrec_t * rec);
+
+    extern int32 HCPcnbit_stwrite
+                (accrec_t * rec);
+
+    extern int32 HCPcnbit_seek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    extern int32 HCPcnbit_inquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    extern int32 HCPcnbit_read
+                (accrec_t * access_rec, int32 length, void * data);
+
+    extern int32 HCPcnbit_write
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    extern intn HCPcnbit_endaccess
+                (accrec_t * access_rec);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/* size of the N-bit buffer */
+#define NBIT_BUF_SIZE   (MAX_NT_SIZE*64)
+/* size of the N-bit mask buffer (same as buffer size for now) */
+#define NBIT_MASK_SIZE  (MAX_NT_SIZE)
+
+typedef struct
+{                               /* structure to hold bit vector info */
+    intn        offset,         /* offset of the bit information */
+                length;         /* number of bits in the information */
+    uint8       mask;           /* mask for this bit vector */
+}
+nbit_mask_info_t;
+
+/* N-bit [en|de]coding information */
+typedef struct
+  {
+      int32       nt;           /* number type of data we are encoding */
+      intn        nt_size;      /* size of the number-type in the file */
+      intn        fill_one;     /* whether to fill with 1's or not (0's) */
+      intn        sign_ext;     /* whether to sign extend or not */
+      uint8       buffer[NBIT_BUF_SIZE];    /* buffer for expanding n-bit data in */
+      intn        buf_pos;      /* current offset in the expansion buffer */
+      intn        mask_off,     /* offset of the bit to start masking with */
+                  mask_len;     /* number of bits to mask */
+      int32       offset;       /* offset in the file in terms of bytes */
+      uint8       mask_buf[NBIT_MASK_SIZE];     /* buffer to hold the bitmask */
+      nbit_mask_info_t mask_info[NBIT_MASK_SIZE];   /* information about the mask */
+      intn        nt_pos;       /* current byte to read or write */
+  }
+comp_coder_nbit_info_t;
+
+#ifndef CNBIT_MASTER
+extern funclist_t cnbit_funcs;  /* functions to perform N-bit encoding */
+#else
+funclist_t  cnbit_funcs =
+{                               /* functions to perform N-bit encoding */
+    HCPcnbit_stread,
+    HCPcnbit_stwrite,
+    HCPcnbit_seek,
+    HCPcnbit_inquire,
+    HCPcnbit_read,
+    HCPcnbit_write,
+    HCPcnbit_endaccess
+};
+#endif
+
+#endif /* __CNBIT_H */
diff --git a/hdf/src/cnone.c b/hdf/src/cnone.c
new file mode 100644
index 0000000..cd8e91a
--- /dev/null
+++ b/hdf/src/cnone.c
@@ -0,0 +1,344 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: cnone.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+   FILE
+   cnone.c
+   HDF none encoding I/O routines
+
+   REMARKS
+   These routines are only included for completeness and are not
+   actually expected to be used.
+
+   DESIGN
+
+   EXPORTED ROUTINES
+   None of these routines are designed to be called by other users except
+   for the modeling layer of the compression routines.
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   4/25/94     Starting writing specs & coding prototype.
+ */
+
+/* General HDF includes */
+#include "hdf.h"
+
+#define CNONE_MASTER
+#define CODER_CLIENT
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* declaration of the functions provided in this module */
+PRIVATE int32 HCIcnone_staccess
+            (accrec_t * access_rec, int16 acc_mode);
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcnone_staccess -- Start accessing a RLE compressed data element.
+
+ USAGE
+    int32 HCIcnone_staccess(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcnone_stread and HCIcnone_stwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcnone_staccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIcnone_staccess");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (acc_mode == DFACC_READ)
+        info->aid = Hstartread(access_rec->file_id, DFTAG_COMPRESSED,
+                               info->comp_ref);
+    else
+        info->aid = Hstartwrite(access_rec->file_id, DFTAG_COMPRESSED,
+                                info->comp_ref, info->length);
+
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+    if ((acc_mode&DFACC_WRITE) && Happendable(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+    return (SUCCEED);
+}   /* end HCIcnone_staccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnone_stread -- start read access for compressed file
+
+ USAGE
+    int32 HCPcnone_stread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start read access on a compressed data element using no compression.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnone_stread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcnone_stread");
+    int32       ret;
+
+    if ((ret = HCIcnone_staccess(access_rec, DFACC_READ)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcnone_stread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnone_stwrite -- start write access for compressed file
+
+ USAGE
+    int32 HCPcnone_stwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start write access on a compressed data element using no compression.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnone_stwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcnone_stwrite");
+    int32       ret;
+
+    if ((ret = HCIcnone_staccess(access_rec, DFACC_WRITE)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcnone_stwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnone_seek -- Seek to offset within the data element
+
+ USAGE
+    int32 HCPcnone_seek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from [UNUSED!]
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Seek to a position with a compressed data element.  The 'origin'
+    calculations have been taken care of at a higher level, it is an
+    un-used parameter.  The 'offset' is used as an absolute offset
+    because of this.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnone_seek(accrec_t * access_rec, int32 offset, int origin)
+{
+    CONSTR(FUNC, "HCPcnone_seek");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (Hseek(info->aid, offset, origin) == FAIL)
+        HRETURN_ERROR(DFE_CSEEK, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcnone_seek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnone_read -- Read in a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcnone_read(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+
+ RETURNS
+    Returns the number of bytes read or FAIL
+
+ DESCRIPTION
+    Read in a number of bytes from a RLE compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnone_read(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPcnone_read");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (Hread(info->aid, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CDECODE, FAIL);
+
+    return (length);
+}   /* HCPcnone_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnone_write -- Write out a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPwrite(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+
+ RETURNS
+    Returns the number of bytes written or FAIL
+
+ DESCRIPTION
+    Write out a number of bytes to a data element (w/ no compression).
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnone_write(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPcnone_write");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (Hwrite(info->aid, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CENCODE, FAIL);
+
+    return (length);
+}   /* HCPcnone_write() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnone_inquire -- Inquire information about the access record and data element.
+
+ USAGE
+    int32 HCPcnone_inquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+            paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Inquire information about the access record and data element.
+    [Currently a NOP].
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcnone_inquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+                 uint16 *pref, int32 *plength, int32 *poffset,
+                 int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    /* shut compiler up */
+    access_rec = access_rec;
+    pfile_id = pfile_id;
+    ptag = ptag;
+    pref = pref;
+    plength = plength;
+    poffset = poffset;
+    pposn = pposn;
+    paccess = paccess;
+    pspecial = pspecial;
+
+    return (SUCCEED);
+}   /* HCPcnone_inquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcnone_endaccess -- Close the compressed data element
+
+ USAGE
+    int32 HCPcnone_endaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Close the compressed data element and free modelling info.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPcnone_endaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcnone_endaccess");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* close the compressed data AID */
+    if (Hendaccess(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_CANTCLOSE, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcnone_endaccess() */
diff --git a/hdf/src/cnone.h b/hdf/src/cnone.h
new file mode 100644
index 0000000..4ac7785
--- /dev/null
+++ b/hdf/src/cnone.h
@@ -0,0 +1,89 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: cnone.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    cnone.h
+ * Purpose: Header file for "none" encoding information.
+ * Dependencies: should only be included from hcompi.h
+ * Invokes: none
+ * Contents: Structures & definitions for "none" encoding.  This header
+ *              should only be included in hcomp.c and cnone.c.
+ * Structure definitions:
+ * Constant definitions:
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __CNONE_H
+#define __CNONE_H
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+   ** from cnone.c
+ */
+
+    extern int32 HCPcnone_stread
+                (accrec_t * rec);
+
+    extern int32 HCPcnone_stwrite
+                (accrec_t * rec);
+
+    extern int32 HCPcnone_seek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    extern int32 HCPcnone_inquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    extern int32 HCPcnone_read
+                (accrec_t * access_rec, int32 length, void * data);
+
+    extern int32 HCPcnone_write
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    extern intn HCPcnone_endaccess
+                (accrec_t * access_rec);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/* "none" [en|de]coding information */
+typedef struct
+{
+    intn        space_holder;   /* merely a space holder so compilers don't barf */
+}
+comp_coder_none_info_t;
+
+#ifndef CNONE_MASTER
+extern funclist_t cnone_funcs;  /* functions to perform run-length encoding */
+#else
+funclist_t  cnone_funcs =
+{                               /* functions to perform run-length encoding */
+    HCPcnone_stread,
+    HCPcnone_stwrite,
+    HCPcnone_seek,
+    HCPcnone_inquire,
+    HCPcnone_read,
+    HCPcnone_write,
+    HCPcnone_endaccess
+};
+#endif
+
+#endif /* __CNONE_H */
diff --git a/hdf/src/crle.c b/hdf/src/crle.c
new file mode 100644
index 0000000..9284046
--- /dev/null
+++ b/hdf/src/crle.c
@@ -0,0 +1,716 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5705 $";
+#endif
+
+/* $Id: crle.c 5705 2011-10-26 12:45:21Z bmribler $ */
+
+/*
+   FILE
+   crle.c
+   HDF run-length encoding I/O routines
+
+   REMARKS
+
+   DESIGN
+
+   EXPORTED ROUTINES
+   None of these routines are designed to be called by other users except
+   for the modeling layer of the compression routines.
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   9/28/93     Starting writing specs & coding prototype.
+   10/09/93    Finished testing.  First version done.
+ */
+
+/* General HDF includes */
+#include "hdf.h"
+
+#define CRLE_MASTER
+#define CODER_CLIENT
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* internal defines */
+#define TMP_BUF_SIZE    8192    /* size of throw-away buffer */
+#define RUN_MASK        0x80    /* bit mask for run-length control bytes */
+#define COUNT_MASK      0x7f    /* bit mask for count of run or mix */
+
+/* #define TESTING */
+
+/* declaration of the functions provided in this module */
+PRIVATE int32 HCIcrle_staccess
+            (accrec_t * access_rec, int16 acc_mode);
+
+PRIVATE int32 HCIcrle_init
+            (accrec_t * access_rec);
+
+PRIVATE int32 HCIcrle_decode
+            (compinfo_t * info, int32 length, uint8 *buf);
+
+PRIVATE int32 HCIcrle_encode
+            (compinfo_t * info, int32 length, const uint8 *buf);
+
+PRIVATE int32 HCIcrle_term
+            (compinfo_t * info);
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcrle_init -- Initialize a RLE compressed data element.
+
+ USAGE
+    int32 HCIcrle_init(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcrle_staccess and HCIcrle_seek
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcrle_init(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCIcrle_init");
+    compinfo_t *info;           /* special element information */
+    comp_coder_rle_info_t *rle_info;    /* ptr to RLE info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    if (Hseek(info->aid, 0, DF_START) == FAIL)  /* seek to beginning of element */
+        HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+
+    rle_info = &(info->cinfo.coder_info.rle_info);
+
+    /* Initialize RLE state information */
+    rle_info->rle_state = RLE_INIT;     /* start in initial state */
+    rle_info->buf_pos = 0;  /* start at the beginning of the buffer */
+    rle_info->last_byte = (uintn) RLE_NIL;  /* start with no code in the last byte */
+    rle_info->second_byte = (uintn) RLE_NIL;    /* start with no code here too */
+    rle_info->offset = 0;   /* offset into the file */
+
+    return (SUCCEED);
+}   /* end HCIcrle_init() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcrle_decode -- Decode RLE compressed data into a buffer.
+
+ USAGE
+    int32 HCIcrle_decode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to read into the buffer
+    uint8 *buf;         OUT: buffer to store the bytes read
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to decode RLE data from the file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcrle_decode(compinfo_t * info, int32 length, uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcrle_decode");
+    comp_coder_rle_info_t *rle_info;    /* ptr to RLE info */
+    int32       orig_length;    /* original length to read */
+    uintn       dec_len;        /* length to decode */
+    intn        c;              /* character to hold a byte read in */
+
+    rle_info = &(info->cinfo.coder_info.rle_info);
+
+    orig_length = length;   /* save this for later */
+    while (length > 0)
+      {     /* decode until we have all the bytes we need */
+          if (rle_info->rle_state == RLE_INIT)
+            {   /* need to figure out RUN or MIX state */
+                if ((c = HDgetc(info->aid)) == FAIL)
+                    HRETURN_ERROR(DFE_READERROR, FAIL);
+                if (c & RUN_MASK)
+                  {     /* run byte */
+                      rle_info->rle_state = RLE_RUN;    /* set to run state */
+                      rle_info->buf_length = (c & COUNT_MASK) + RLE_MIN_RUN;    /* run length */
+                      if ((rle_info->last_byte = (uintn)HDgetc(info->aid)) == (uintn)FAIL)
+                          HRETURN_ERROR(DFE_READERROR, FAIL);
+                  }     /* end if */
+                else
+                  {     /* mix byte */
+                      rle_info->rle_state = RLE_MIX;    /* set to mix state */
+                      rle_info->buf_length = (c & COUNT_MASK) + RLE_MIN_MIX;    /* mix length */
+                      if (Hread(info->aid, rle_info->buf_length, rle_info->buffer) == FAIL)
+                          HRETURN_ERROR(DFE_READERROR, FAIL);
+                      rle_info->buf_pos = 0;
+                  }     /* end else */
+            }   /* end if */
+
+            /* RUN or MIX states */
+            if (length > rle_info->buf_length)  /* still need more data */
+                dec_len = (uintn)rle_info->buf_length;
+            else    /* only grab "length" bytes */
+                dec_len = (uintn) length;
+
+            if (rle_info->rle_state == RLE_RUN)
+                HDmemset(buf, rle_info->last_byte, dec_len);    /* copy the run */
+            else
+              {
+                  HDmemcpy(buf, &(rle_info->buffer[rle_info->buf_pos]), dec_len);
+                  rle_info->buf_pos += (intn)dec_len;
+              }     /* end else */
+
+            rle_info->buf_length -= (intn)dec_len;
+            if (rle_info->buf_length <= 0)  /* check for running out of bytes */
+                rle_info->rle_state = RLE_INIT;     /* get the next status byte */
+            length -= (int32)dec_len;  /* decrement the bytes to get */
+            buf += dec_len;     /* in case we need more bytes */
+      }     /* end while */
+
+    rle_info->offset += orig_length;    /* incr. abs. offset into the file */
+    return (SUCCEED);
+}   /* end HCIcrle_decode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcrle_encode -- Encode data from a buffer into RLE compressed data
+
+ USAGE
+    int32 HCIcrle_encode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to store from the buffer
+    const uint8 *buf;         OUT: buffer to get the bytes from
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to encode RLE data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcrle_encode(compinfo_t * info, int32 length, const uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcrle_encode");
+    comp_coder_rle_info_t *rle_info;    /* ptr to RLE info */
+    int32       orig_length;    /* original length to write */
+    intn        c;              /* character to hold a byte read in */
+
+    rle_info = &(info->cinfo.coder_info.rle_info);
+
+    orig_length = length;   /* save this for later */
+    while (length > 0)
+      {     /* encode until we stored all the bytes */
+          switch (rle_info->rle_state)
+            {
+                case RLE_INIT:      /* initial encoding state */
+                    rle_info->rle_state = RLE_MIX;  /* shift to MIX state */
+                    rle_info->last_byte = (uintn)(rle_info->buffer[0] = *buf);
+                    rle_info->buf_length = 1;
+                    rle_info->buf_pos = 1;
+                    buf++;
+                    length--;
+                    break;
+
+                case RLE_RUN:
+                    /* check for end of run */
+                    if ((uintn)*buf != rle_info->last_byte)
+                      {
+                          rle_info->rle_state = RLE_MIX;
+                          c = RUN_MASK | (rle_info->buf_length - RLE_MIN_RUN);
+                          if (HDputc((uint8) c, info->aid) == FAIL)
+                              HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                          if (HDputc((uint8) rle_info->last_byte, info->aid) == FAIL)
+                              HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                          rle_info->last_byte = (uintn)(rle_info->buffer[0] = *buf);
+                          rle_info->buf_length = 1;
+                          rle_info->buf_pos = 1;
+                      }     /* end if */
+                    else
+                      {     /* run is continuing */
+                          rle_info->buf_length++;
+                          if (rle_info->buf_length >= RLE_MAX_RUN)
+                            {   /* check for too long */
+                                c = RUN_MASK | (rle_info->buf_length - RLE_MIN_RUN);
+                                if (HDputc((uint8) c, info->aid) == FAIL)
+                                    HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                                if (HDputc((uint8) rle_info->last_byte, info->aid) == FAIL)
+                                    HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                                rle_info->rle_state = RLE_INIT;
+                                rle_info->second_byte = rle_info->last_byte = (uintn) RLE_NIL;
+                            }   /* end if */
+                      }     /* end else */
+                    buf++;
+                    length--;
+                    break;
+
+                case RLE_MIX:   /* mixed bunch of bytes */
+                    /* check for run */
+                    if ((uintn)*buf == rle_info->last_byte && (uintn)*buf == rle_info->second_byte)
+                      {
+                          rle_info->rle_state = RLE_RUN;    /* shift to RUN state */
+                          if (rle_info->buf_length > (RLE_MIN_RUN - 1))
+                            {   /* check for mixed data to write */
+                                if (HDputc((uint8) ((rle_info->buf_length - RLE_MIN_MIX) - (RLE_MIN_RUN - 1)), info->aid) == FAIL)
+                                    HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                                if (Hwrite(info->aid, (rle_info->buf_length - (RLE_MIN_RUN - 1)), rle_info->buffer) == FAIL)
+                                    HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                            }   /* end if */
+                          rle_info->buf_length = RLE_MIN_RUN;
+                      }     /* end if */
+                    else
+                      {     /* continue MIX */
+                          rle_info->second_byte = rle_info->last_byte;
+                          rle_info->last_byte = (uintn)(rle_info->buffer[rle_info->buf_pos] = *buf);
+                          rle_info->buf_length++;
+                          rle_info->buf_pos++;
+                          if (rle_info->buf_length >= RLE_BUF_SIZE)
+                            {   /* check for too long */
+                                if (HDputc((uint8) (rle_info->buf_length - RLE_MIN_MIX), info->aid) == FAIL)
+                                    HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                                if (Hwrite(info->aid, rle_info->buf_length, rle_info->buffer) == FAIL)
+                                    HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                                rle_info->rle_state = RLE_INIT;
+                                rle_info->second_byte = rle_info->last_byte = (uintn) RLE_NIL;
+                            }   /* end if */
+                      }     /* end else */
+                    buf++;
+                    length--;
+                    break;
+
+                default:
+                    HRETURN_ERROR(DFE_INTERNAL, FAIL)
+            }   /* end switch */
+      }     /* end while */
+
+    rle_info->offset += orig_length;    /* incr. abs. offset into the file */
+    return (SUCCEED);
+}   /* end HCIcrle_encode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcrle_term -- Flush encoded data from internal buffer to RLE compressed data
+
+ USAGE
+    int32 HCIcrle_term(info)
+    compinfo_t *info;   IN: the info about the compressed element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to flush RLE data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcrle_term(compinfo_t * info)
+{
+    CONSTR(FUNC, "HCIcrle_term");
+    comp_coder_rle_info_t *rle_info;    /* ptr to RLE info */
+    intn        c;              /* character to hold a byte read in */
+
+    rle_info = &(info->cinfo.coder_info.rle_info);
+
+    switch (rle_info->rle_state)
+      {
+          case RLE_RUN:
+              c = RUN_MASK | (rle_info->buf_length - RLE_MIN_RUN);
+              if (HDputc((uint8) c, info->aid) == FAIL)
+                  HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+              if (HDputc((uint8) rle_info->last_byte, info->aid) == FAIL)
+                  HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+              break;
+
+          case RLE_MIX: /* mixed bunch of bytes */
+              if (HDputc((uint8) ((rle_info->buf_length - RLE_MIN_MIX)), info->aid) == FAIL)
+                  HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+              if (Hwrite(info->aid, rle_info->buf_length, rle_info->buffer) == FAIL)
+                  HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+              break;
+
+          default:
+              HRETURN_ERROR(DFE_INTERNAL, FAIL)
+      }     /* end switch */
+    rle_info->rle_state = RLE_INIT;
+    rle_info->second_byte = rle_info->last_byte = (uintn) RLE_NIL;
+
+    return (SUCCEED);
+}   /* end HCIcrle_term() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcrle_staccess -- Start accessing a RLE compressed data element.
+
+ USAGE
+    int32 HCIcrle_staccess(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcrle_stread and HCIcrle_stwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcrle_staccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIcrle_staccess");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+#ifdef OLD_WAY
+    if (acc_mode == DFACC_READ)
+        info->aid = Hstartread(access_rec->file_id, DFTAG_COMPRESSED,
+                               info->comp_ref);
+    else
+        info->aid = Hstartwrite(access_rec->file_id, DFTAG_COMPRESSED,
+                                info->comp_ref, info->length);
+
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+    if ((acc_mode&DFACC_WRITE) && Happendable(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+#else /* OLD_WAY */
+    if (acc_mode == DFACC_READ)
+        info->aid = Hstartread(access_rec->file_id, DFTAG_COMPRESSED,
+                               info->comp_ref);
+    else
+        info->aid = Hstartaccess(access_rec->file_id, DFTAG_COMPRESSED,
+                                info->comp_ref, DFACC_RDWR|DFACC_APPENDABLE);
+
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+#endif /* OLD_WAY */
+    return (HCIcrle_init(access_rec));  /* initialize the RLE info */
+}   /* end HCIcrle_staccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcrle_stread -- start read access for compressed file
+
+ USAGE
+    int32 HCPcrle_stread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start read access on a compressed data element using a simple RLE scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcrle_stread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcrle_stread");
+    int32       ret;
+
+    if ((ret = HCIcrle_staccess(access_rec, DFACC_READ)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcrle_stread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcrle_stwrite -- start write access for compressed file
+
+ USAGE
+    int32 HCPcrle_stwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start write access on a compressed data element using a simple RLE scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcrle_stwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcrle_stwrite");
+    int32       ret;
+
+    if ((ret = HCIcrle_staccess(access_rec, DFACC_WRITE)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcrle_stwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcrle_seek -- Seek to offset within the data element
+
+ USAGE
+    int32 HCPcrle_seek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from [UNUSED!]
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Seek to a position with a compressed data element.  The 'origin'
+    calculations have been taken care of at a higher level, it is an
+    un-used parameter.  The 'offset' is used as an absolute offset
+    because of this.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcrle_seek(accrec_t * access_rec, int32 offset, int origin)
+{
+    CONSTR(FUNC, "HCPcrle_seek");
+    compinfo_t *info;           /* special element information */
+    comp_coder_rle_info_t *rle_info;    /* ptr to RLE info */
+    uint8      *tmp_buf;        /* pointer to throw-away buffer */
+
+    /* shut compiler up */
+    origin = origin;
+
+    info = (compinfo_t *) access_rec->special_info;
+    rle_info = &(info->cinfo.coder_info.rle_info);
+
+    if (offset < rle_info->offset)
+      {     /* need to seek from the beginning */
+          if ((access_rec->access&DFACC_WRITE) && rle_info->rle_state != RLE_INIT)
+              if (HCIcrle_term(info) == FAIL)
+                  HRETURN_ERROR(DFE_CTERM, FAIL);
+          if (HCIcrle_init(access_rec) == FAIL)
+              HRETURN_ERROR(DFE_CINIT, FAIL);
+      }     /* end if */
+
+    if ((tmp_buf = (uint8 *) HDmalloc(TMP_BUF_SIZE)) == NULL)     /* get tmp buffer */
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    while (rle_info->offset + TMP_BUF_SIZE < offset)    /* grab chunks */
+        if (HCIcrle_decode(info, TMP_BUF_SIZE, tmp_buf) == FAIL)
+          {
+              HDfree(tmp_buf);
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+    if (rle_info->offset < offset)  /* grab the last chunk */
+        if (HCIcrle_decode(info, offset - rle_info->offset, tmp_buf) == FAIL)
+          {
+              HDfree(tmp_buf);
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+
+    HDfree(tmp_buf);
+    return (SUCCEED);
+}   /* HCPcrle_seek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcrle_read -- Read in a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcrle_read(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+
+ RETURNS
+    Returns the number of bytes read or FAIL
+
+ DESCRIPTION
+    Read in a number of bytes from a RLE compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcrle_read(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPcrle_read");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (HCIcrle_decode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CDECODE, FAIL);
+
+    return (length);
+}   /* HCPcrle_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcrle_write -- Write out a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcrle_write(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+
+ RETURNS
+    Returns the number of bytes written or FAIL
+
+ DESCRIPTION
+    Write out a number of bytes to a RLE compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcrle_write(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPcrle_write");
+    compinfo_t *info;           /* special element information */
+    comp_coder_rle_info_t *rle_info;    /* ptr to RLE info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    rle_info = &(info->cinfo.coder_info.rle_info);
+
+    /* Don't allow random write in a dataset unless: */
+    /*  1 - append onto the end */
+    /*  2 - start at the beginning and rewrite (at least) the whole dataset */
+    if ((info->length != rle_info->offset)
+        && (rle_info->offset != 0 && length <= (info->length-rle_info->offset)))
+        HRETURN_ERROR(DFE_UNSUPPORTED, FAIL);
+
+    if (HCIcrle_encode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CENCODE, FAIL);
+
+    return (length);
+}   /* HCPcrle_write() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcrle_inquire -- Inquire information about the access record and data element.
+
+ USAGE
+    int32 HCPcrle_inquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+            paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Inquire information about the access record and data element.
+    [Currently a NOP].
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcrle_inquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+                uint16 *pref, int32 *plength, int32 *poffset,
+                int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    /* shut compiler up */
+    access_rec = access_rec;
+    pfile_id = pfile_id;
+    ptag = ptag;
+    pref = pref;
+    plength = plength;
+    poffset = poffset;
+    pposn = pposn;
+    paccess = paccess;
+    pspecial = pspecial;
+
+    return (SUCCEED);
+}   /* HCPcrle_inquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcrle_endaccess -- Close the compressed data element
+
+ USAGE
+    int32 HCPcrle_endaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Close the compressed data element and free encoding info.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPcrle_endaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcrle_endaccess");
+    compinfo_t *info;           /* special element information */
+    comp_coder_rle_info_t *rle_info;    /* ptr to RLE info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    rle_info = &(info->cinfo.coder_info.rle_info);
+
+    /* flush out RLE buffer */
+    if ((access_rec->access&DFACC_WRITE) && rle_info->rle_state != RLE_INIT)
+        if (HCIcrle_term(info) == FAIL)
+            HRETURN_ERROR(DFE_CTERM, FAIL);
+
+    /* close the compressed data AID */
+    if (Hendaccess(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_CANTCLOSE, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcrle_endaccess() */
diff --git a/hdf/src/crle.h b/hdf/src/crle.h
new file mode 100644
index 0000000..5347fde
--- /dev/null
+++ b/hdf/src/crle.h
@@ -0,0 +1,127 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: crle.h 5705 2011-10-26 12:45:21Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    crle.h
+ * Purpose: Header file for run-length encoding information.
+ * Dependencies: should only be included from hcompi.h
+ * Invokes: none
+ * Contents: Structures & definitions for run-length encoding.  This header
+ *              should only be included in hcomp.c and crle.c.
+ * Structure definitions:
+ * Constant definitions:
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __CRLE_H
+#define __CRLE_H
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+   ** from crle.c
+ */
+
+    extern int32 HCPcrle_stread
+                (accrec_t * rec);
+
+    extern int32 HCPcrle_stwrite
+                (accrec_t * rec);
+
+    extern int32 HCPcrle_seek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    extern int32 HCPcrle_inquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    extern int32 HCPcrle_read
+                (accrec_t * access_rec, int32 length, void * data);
+
+    extern int32 HCPcrle_write
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    extern intn HCPcrle_endaccess
+                (accrec_t * access_rec);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/* size of the RLE buffer */
+#define RLE_BUF_SIZE    128
+/* NIL code for run bytes */
+#define RLE_NIL         (-1)
+/* minimum length of run */
+#define RLE_MIN_RUN     3
+/* maximum length of run */
+#define RLE_MAX_RUN     (RLE_BUF_SIZE+RLE_MIN_RUN-1)
+/* minimum length of mix */
+#define RLE_MIN_MIX     1
+/*
+ * Notes on RLE_MIN_RUN and RLE_MIN_MIX:
+ * (excerpt from QAK's email to RA - see bug HDFFR-1261)
+ *
+ * These are [small] optimizations for improving the compression ratio. The
+ * algorithm won't encode a run of identical bytes unless it's at least
+ * RLE_MIN_RUN bytes long.  So, we can assume that all runs are at least
+ * that many bytes, and subtract RLE_MIN_RUN from the actual run length,
+ * allowing encoding of runs that are a little bit longer than otherwise
+ * allowed (i.e. runs up to 127+RLE_MIN_RUN bytes, instead of only 127 bytes).
+ * Similarly for RLE_MIN_MIX - there must be at least RLE_MIN_MIX bytes in a
+ * "mixed" sequence of bytes, so we can encode a little bit longer sequence
+ * of mixed bytes (127+RLE_MIN_MIX bytes, instead of only 127 bytes).
+ */
+
+/* RLE [en|de]coding information */
+typedef struct
+{
+    int32       offset;         /* offset in the file */
+    uint8       buffer[RLE_BUF_SIZE];   /* buffer for storing RLE bytes */
+    intn        buf_length;     /* number of bytes in buffer */
+    intn        buf_pos;        /* offset into the buffer */
+    uintn       last_byte,      /* the last byte stored in the buffer */
+                second_byte;    /* the second to last byte stored in the buffer */
+    enum
+      {
+          RLE_INIT,             /* initial state, need to read a byte to
+                                   determine the next state */
+          RLE_RUN,              /* buffer up to the current position is a run */
+          RLE_MIX		/* buffer up to the current position is a mix */
+      }
+    rle_state;                  /* state of the buffer storage */
+}
+comp_coder_rle_info_t;
+
+#ifndef CRLE_MASTER
+extern funclist_t crle_funcs;   /* functions to perform run-length encoding */
+#else
+funclist_t  crle_funcs =
+{                               /* functions to perform run-length encoding */
+    HCPcrle_stread,
+    HCPcrle_stwrite,
+    HCPcrle_seek,
+    HCPcrle_inquire,
+    HCPcrle_read,
+    HCPcrle_write,
+    HCPcrle_endaccess
+};
+#endif
+
+#endif /* __CRLE_H */
diff --git a/hdf/src/cskphuff.c b/hdf/src/cskphuff.c
new file mode 100644
index 0000000..1e289ad
--- /dev/null
+++ b/hdf/src/cskphuff.c
@@ -0,0 +1,793 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6032 $";
+#endif
+
+/* $Id: cskphuff.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+/*
+   FILE
+   cskphuff.c
+   HDF "skipping" huffman encoding I/O routines
+
+   REMARKS
+
+   DESIGN
+
+   EXPORTED ROUTINES
+   None of these routines are designed to be called by other users except
+   for the modeling layer of the compression routines.
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   4/25/94     Starting writing specs & coding prototype
+ */
+
+/* General HDF includes */
+#include "hdf.h"
+
+#define CSKPHUFF_MASTER
+#define CODER_CLIENT
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* Internal Defines */
+/* #define TESTING */
+#define TMP_BUF_SIZE    8192    /* size of throw-away buffer */
+
+/*
+   *   This piece of code uses Semi-Splay trees to Huffman encode a raster
+   *   image file.
+ */
+
+/* declaration of the functions provided in this module */
+PRIVATE int32 HCIcskphuff_init(accrec_t * access_rec, uintn alloc_buf);
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcskphuff_splay -- Splay the tree around the source code passed
+
+ USAGE
+    void HCIcskphuff_splay(skphuff_info,plain)
+    comp_coder_skphuff_info_t *skphuff_info;    IN:ptr to skphuff info
+    uint8 plain;            IN: the source code to splay the tree around
+
+ RETURNS
+    None.
+
+ DESCRIPTION
+    Common code called by HCIcskphuff_encode and HCIcskphuff_decode
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static void
+HCIcskphuff_splay(comp_coder_skphuff_info_t * skphuff_info, uint8 plain)
+{
+    uintn       a, b;           /* children of nodes to semi-rotate */
+    uint8       c, d;           /* pair of nodes to semi-rotate */
+    intn        skip_num;       /* the tree we are splaying */
+    uintn       *lleft,        /* local copy of the left pointer */
+                *lright;       /* local copy of the right pointer */
+    uint8       *lup;          /* local copy of the up pointer */
+
+    skip_num = skphuff_info->skip_pos;  /* get the tree number to splay */
+
+    /* Get the tree pointers */
+    lleft=skphuff_info->left[skip_num];
+    lright=skphuff_info->right[skip_num];
+    lup=skphuff_info->up[skip_num];
+
+    a = (uintn)plain + SUCCMAX;    /* get the index for this source code in the up array */
+    do
+      {     /* walk up the tree, semi-rotating pairs */
+          c = lup[a];    /* find the parent of the node to semi-rotate around */
+          if (c != ROOT)
+            {   /* a pair remain above this node */
+                d = lup[(int)c];  /* get the grand-parent of the node to semi-rotate around */
+                b = lleft[(int)d];
+
+/* Exchange the children of the pair */
+                if ((uintn)c == b)
+                  {
+                      b = lright[(int)d];
+                      lright[(int)d] = a;
+                  }     /* end if */
+                else
+                    lleft[(int)d] = a;
+
+                if (a == lleft[(int)c])
+                    lleft[(int)c] = b;
+                else
+                    lright[(int)c] = b;
+
+                lup[a] = d;
+                lup[b] = c;
+                a = (uintn)d;
+            }   /* end if */
+          else
+            {   /* handle odd node at end */
+                a = (uintn)c;
+            }   /* end else */
+      }
+    while (a != ROOT);
+}   /* end HCIcskphuff_splay() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcskphuff_init -- Initialize a skipping huffman compressed data element.
+
+ USAGE
+    int32 HCIcskphuff_init(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+    uintn alloc_buf;        IN: whether to allocate the buffers or not
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcskphuff_staccess and HCIcskphuff_seek
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcskphuff_init(accrec_t * access_rec, uintn alloc_buf)
+{
+    CONSTR(FUNC, "HCIcskphuff_init");
+    compinfo_t *info;           /* special element information */
+    comp_coder_skphuff_info_t *skphuff_info;    /* ptr to skphuff info */
+    intn        i, j, k;        /* local counting var */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+#ifdef TESTING
+    printf("HCIcskphuff_init(): before Hbitseek() call\n");
+#endif /* TESTING */
+    if (Hbitseek(info->aid, 0, 0) == FAIL)  /* seek to beginning of element */
+        HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+
+#ifdef TESTING
+    printf("HCIcskphuff_init(): after Hbitseek() call\n");
+#endif /* TESTING */
+    skphuff_info = &(info->cinfo.coder_info.skphuff_info);
+
+    /* Initialize RLE state information */
+    skphuff_info->skip_pos = 0;     /* start in first byte */
+    skphuff_info->offset = 0;   /* start at the beginning of the data */
+
+    if(alloc_buf==TRUE)
+      {
+        /* allocate pointers to the compression buffers */
+        if ((skphuff_info->left = (uintn **) HDmalloc(sizeof(uintn *) * (uintn)skphuff_info->skip_size)) == NULL)
+                        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+        if ((skphuff_info->right = (uintn **) HDmalloc(sizeof(uintn *) * (uintn)skphuff_info->skip_size)) == NULL)
+                        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+        if ((skphuff_info->up = (uint8 **) HDmalloc(sizeof(uint8 *) * (uintn)skphuff_info->skip_size)) == NULL)
+                        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+#ifdef TESTING
+        printf("HCIcskphuff_init(): halfway through allocating space\n");
+#endif /* TESTING */
+        /* allocate compression buffer for each skipping byte */
+        for (i = 0; i < skphuff_info->skip_size; i++)
+          {
+              if ((skphuff_info->left[i] = (uintn *) HDmalloc(sizeof(uintn) * SUCCMAX)) == NULL)
+                              HRETURN_ERROR(DFE_NOSPACE, FAIL);
+              if ((skphuff_info->right[i] = (uintn *) HDmalloc(sizeof(uintn) * SUCCMAX)) == NULL)
+                              HRETURN_ERROR(DFE_NOSPACE, FAIL);
+              if ((skphuff_info->up[i] = (uint8 *) HDmalloc(sizeof(uint8) * TWICEMAX)) == NULL)
+                              HRETURN_ERROR(DFE_NOSPACE, FAIL);
+          }     /* end for */
+      } /* end if */
+
+#ifdef TESTING
+    printf("HCIcskphuff_init(): after allocating space\n");
+#endif /* TESTING */
+    for (k = 0; k < skphuff_info->skip_size; k++)
+      {
+          for (i = 0; i < TWICEMAX; i++)    /* initialize the up pointers to point to their parent in the tree */
+              skphuff_info->up[k][i] = (uint8)(i >> 1);
+
+          for (j = 0; j < SUCCMAX; j++)
+            {   /* initialize the left & right pointers correctly */
+                skphuff_info->left[k][j] = (uintn)(j << 1);
+                skphuff_info->right[k][j] = (uintn)((j << 1) + 1);
+            }   /* end for */
+      }     /* end for */
+
+#ifdef TESTING
+    printf("HCIcskphuff_init(): after initializing arrays\n");
+#endif /* TESTING */
+    return (SUCCEED);
+}   /* end HCIcskphuff_init() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcskphuff_decode -- Decode skipping Huffman compressed data into a buffer.
+
+ USAGE
+    int32 HCIcskphuff_decode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to read into the buffer
+    uint8 *buf;         OUT: buffer to store the bytes read
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to decode skipping Huffman data from the file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcskphuff_decode(compinfo_t * info, int32 length, uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcskphuff_decode");
+    comp_coder_skphuff_info_t *skphuff_info;    /* ptr to skipping Huffman info */
+    int32       orig_length;    /* original length to read */
+    uint32      bit;            /* bit from the file */
+    uintn       a;
+    uint8       plain;          /* the source code expanded from the file */
+
+    skphuff_info = &(info->cinfo.coder_info.skphuff_info);
+
+    orig_length = length;   /* save this for later */
+    while (length > 0)
+      {     /* decode until we have all the bytes we need */
+#ifdef TESTING
+printf("length=%ld\n",(long)length);
+#endif /* TESTING */
+          a = ROOT;     /* start at the root of the tree and find the leaf we need */
+
+          do
+            {   /* walk down once for each bit on the path */
+#ifdef TESTING
+intn bitcount=0;
+printf("bitcount=%d\n",++bitcount);
+#endif /* TESTING */
+                if(Hbitread(info->aid,1,&bit)==FAIL)
+                    HRETURN_ERROR(DFE_CDECODE, FAIL);
+                a=((bit==0) ? ( skphuff_info->left[skphuff_info->skip_pos][a]) \
+                    : (skphuff_info->right[skphuff_info->skip_pos][a]));
+            }
+          while (a <= SKPHUFF_MAX_CHAR);
+
+          plain = (uint8)(a - SUCCMAX);
+          HCIcskphuff_splay(skphuff_info, plain);
+          skphuff_info->skip_pos = (skphuff_info->skip_pos + 1) % skphuff_info->skip_size;
+          *buf++ = plain;
+          length--;
+      }     /* end while */
+    skphuff_info->offset += orig_length;    /* incr. abs. offset into the file */
+    return (SUCCEED);
+}   /* end HCIcskphuff_decode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcskphuff_encode -- Encode data from a buffer into skipping Huffman
+                            compressed data
+
+ USAGE
+    int32 HCIcskphuff_encode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to store from the buffer
+    const uint8 *buf;         OUT: buffer to get the bytes from
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to encode skipping Huffman data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcskphuff_encode(compinfo_t * info, int32 length, const uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcskphuff_encode");
+    comp_coder_skphuff_info_t *skphuff_info;    /* ptr to skipping Huffman info */
+    int32       orig_length;    /* original length to write */
+    intn        stack_ptr;      /* pointer to the position on the stack */
+#ifdef OLD_WAY
+    intn        stack[SKPHUFF_MAX_CHAR]; /* stack to store the bits generated */
+    uintn       a;              /* variable to record the position in the tree */
+#else /* OLD_WAY */
+    uintn       a, last_node;   /* variables to record the current & last position in the tree */
+    uint32      output_bits[(SKPHUFF_MAX_CHAR/4)+1],    /* bits to write out */
+                bit_count[(SKPHUFF_MAX_CHAR/4)+1],      /* # of bits stored in each stack location */
+                bit_mask;       /* bit-mask for accumulating bits to output */
+#endif /* OLD_WAY */
+
+    skphuff_info = &(info->cinfo.coder_info.skphuff_info);
+
+    orig_length = length;   /* save this for later */
+    while (length > 0)
+      {     /* encode until we stored all the bytes */
+          a = (uintn)*buf + SUCCMAX;   /* find position in the up array */
+#ifdef OLD_WAY
+          do
+            {   /* walk up the tree, pushing bits */
+                stack[stack_ptr] = (skphuff_info->right[skphuff_info->skip_pos][skphuff_info->up[skphuff_info->skip_pos][a]] == a);     /* push a 1 is this is the right node */
+                stack_ptr++;
+                a = skphuff_info->up[skphuff_info->skip_pos][a];
+            }
+          while (a != ROOT);
+
+          do
+            {   /* output the bits we have */
+                stack_ptr--;
+                if (Hputbit(info->aid, stack[stack_ptr]) == FAIL)
+                    HRETURN_ERROR(DFE_CENCODE, FAIL);
+            }
+          while (stack_ptr != 0);
+#else /* OLD_WAY */
+/* This way is _much_ faster... */
+          stack_ptr=0;
+          bit_mask=1;   /* initialize to the lowest bit */
+          output_bits[0]=0;
+          bit_count[0]=0;
+          do
+            {   /* walk up the tree, pushing bits */
+                last_node=a; /* keep track of the current node */
+                a = (uintn)skphuff_info->up[skphuff_info->skip_pos][a]; /* move the current node up one */
+                if(skphuff_info->right[skphuff_info->skip_pos][a] == last_node)
+                    output_bits[stack_ptr]|=bit_mask; /* push a 1 if this is the right node */
+                bit_mask<<=1;   /* rotate bit mask over */
+                bit_count[stack_ptr]++;    /* increment # of bits stored */
+                if(bit_count[stack_ptr]>=32)
+                  {
+                    stack_ptr++;    /* increment stack position */
+                    bit_mask=1;     /* reset bit mask to lowest bit position */
+                    output_bits[stack_ptr]=0;   /* initialize stack location */
+                    bit_count[stack_ptr]=0;
+                  } /* end if */
+            }
+          while (a != ROOT);
+
+          do {   /* output the bits we have */
+                if(bit_count[stack_ptr]>0)
+                  {
+                    if(Hbitwrite(info->aid,(intn)bit_count[stack_ptr],output_bits[stack_ptr]) !=(intn)bit_count[stack_ptr])
+                        HRETURN_ERROR(DFE_CENCODE, FAIL);
+                  } /* end if */
+                stack_ptr--;
+            } while (stack_ptr >= 0);
+#endif /* OLD_WAY */
+          HCIcskphuff_splay(skphuff_info, *buf);    /* semi-splay the tree around this node */
+          skphuff_info->skip_pos = (skphuff_info->skip_pos + 1) % skphuff_info->skip_size;
+          buf++;
+          length--;
+      }     /* end while */
+
+    skphuff_info->offset += orig_length;    /* incr. abs. offset into the file */
+    return (SUCCEED);
+}   /* end HCIcskphuff_encode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcskphuff_term -- Flush encoded data from internal buffer to skipping
+                    Huffman compressed data
+
+ USAGE
+    int32 HCIcskphuff_term(info)
+    compinfo_t *info;   IN: the info about the compressed element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to flush skipping Huffman data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcskphuff_term(compinfo_t * info)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HCIcskphuff_term");
+#endif /* endif LATER */
+    comp_coder_skphuff_info_t *skphuff_info;    /* ptr to skipping Huffman info */
+    intn i;                 /* local counting variable */
+
+    skphuff_info = &(info->cinfo.coder_info.skphuff_info);
+
+    skphuff_info->skip_pos = 0;
+
+    /* Free the buffers we allocated */
+    for (i = 0; i < skphuff_info->skip_size; i++)
+      {
+          HDfree(skphuff_info->left[i]);
+          HDfree(skphuff_info->right[i]);
+          HDfree(skphuff_info->up[i]);
+      }     /* end for */
+
+    /* Free the buffer arrays */
+    HDfree(skphuff_info->left);
+    HDfree(skphuff_info->right);
+    HDfree(skphuff_info->up);
+
+    return (SUCCEED);
+}   /* end HCIcskphuff_term() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcskphuff_staccess -- Start accessing a skipping Huffman compressed data element.
+
+ USAGE
+    int32 HCIcskphuff_staccess(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcskphuff_stread and HCIcskphuff_stwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcskphuff_staccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIcskphuff_staccess");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+#ifdef TESTING
+    printf("HCIcskphuff_staccess(): before bitio calls\n");
+#endif /* TESTING */
+    /* need to check for not writing, as opposed to read access */
+    /* because of the way the access works */
+    if (!(acc_mode&DFACC_WRITE))
+        info->aid = Hstartbitread(access_rec->file_id, DFTAG_COMPRESSED,
+                                  info->comp_ref);
+    else
+#ifdef OLD_WAY
+        info->aid = Hstartbitwrite(access_rec->file_id, DFTAG_COMPRESSED,
+                                   info->comp_ref, info->length);
+#else /* OLD_WAY */
+      {
+        info->aid = Hstartbitwrite(access_rec->file_id, DFTAG_COMPRESSED,
+                                   info->comp_ref, 0);
+        Hbitappendable(info->aid);
+      } /* end else */
+#endif /* OLD_WAY */
+
+#ifdef TESTING
+    printf("HCIcskphuff_staccess(): after bitio calls\n");
+#endif /* TESTING */
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+    if ((acc_mode&DFACC_WRITE) && Hbitappendable(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+    return (HCIcskphuff_init(access_rec, TRUE));  /* initialize the skip-Huffman info */
+}   /* end HCIcskphuff_staccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcskphuff_stread -- start read access for compressed file
+
+ USAGE
+    int32 HCPcskphuff_stread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start read access on a compressed data element using a "skipping"
+    Huffman scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcskphuff_stread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcskphuff_stread");
+    int32       ret;
+
+    if ((ret = HCIcskphuff_staccess(access_rec, DFACC_READ)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcskphuff_stread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcskphuff_stwrite -- start write access for compressed file
+
+ USAGE
+    int32 HCPcskphuff_stwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start write access on a compressed data element using a "skipping"
+    Huffman scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcskphuff_stwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcskphuff_stwrite");
+    int32       ret;
+
+#ifdef TESTING
+    printf("HCPcskphuff_stwrite(): before call to HCIcskphuff_staccess()\n");
+#endif
+    if ((ret = HCIcskphuff_staccess(access_rec, DFACC_WRITE)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+#ifdef TESTING
+    printf("HCPcskphuff_stwrite(): after call to HCIcskphuff_staccess(), ret=%d\n", (int) ret);
+#endif
+    return (ret);
+}   /* HCPcskphuff_stwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcskphuff_seek -- Seek to offset within the data element
+
+ USAGE
+    int32 HCPcskphuff_seek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from [UNUSED!]
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Seek to a position with a compressed data element.  The 'origin'
+    calculations have been taken care of at a higher level, it is an
+    un-used parameter.  The 'offset' is used as an absolute offset
+    because of this.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcskphuff_seek(accrec_t * access_rec, int32 offset, int origin)
+{
+    CONSTR(FUNC, "HCPcskphuff_seek");
+    compinfo_t *info;           /* special element information */
+    comp_coder_skphuff_info_t *skphuff_info;    /* ptr to skipping Huffman info */
+    uint8      *tmp_buf;        /* pointer to throw-away buffer */
+
+    /* shut compiler up */
+    origin = origin;
+
+    info = (compinfo_t *) access_rec->special_info;
+    skphuff_info = &(info->cinfo.coder_info.skphuff_info);
+
+    if (offset < skphuff_info->offset)
+      {     /* need to seek from the beginning */
+          if (HCIcskphuff_init(access_rec, FALSE) == FAIL)
+              HRETURN_ERROR(DFE_CINIT, FAIL);
+      }     /* end if */
+
+    if ((tmp_buf = (uint8 *) HDmalloc(TMP_BUF_SIZE)) == NULL)     /* get tmp buffer */
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    while (skphuff_info->offset + TMP_BUF_SIZE < offset)    /* grab chunks */
+        if (HCIcskphuff_decode(info, TMP_BUF_SIZE, tmp_buf) == FAIL)
+          {
+              HDfree(tmp_buf);
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+    if (skphuff_info->offset < offset)  /* grab the last chunk */
+        if (HCIcskphuff_decode(info, offset - skphuff_info->offset, tmp_buf) == FAIL)
+          {
+              HDfree(tmp_buf);
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+
+    HDfree(tmp_buf);
+    return (SUCCEED);
+}   /* HCPcskphuff_seek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcskphuff_read -- Read in a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcskphuff_read(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+
+ RETURNS
+    Returns the number of bytes read or FAIL
+
+ DESCRIPTION
+    Read in a number of bytes from a skipping Huffman compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcskphuff_read(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPcskphuff_read");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (HCIcskphuff_decode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CDECODE, FAIL);
+
+    return (length);
+}   /* HCPcskphuff_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcskphuff_write -- Write out a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcskphuff_write(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+
+ RETURNS
+    Returns the number of bytes written or FAIL
+
+ DESCRIPTION
+    Write out a number of bytes to a skipping Huffman compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcskphuff_write(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPcskphuff_write");
+    compinfo_t *info;           /* special element information */
+    comp_coder_skphuff_info_t *skphuff_info;    /* ptr to skipping Huffman info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    skphuff_info = &(info->cinfo.coder_info.skphuff_info);
+
+    /* Don't allow random write in a dataset unless: */
+    /*  1 - append onto the end */
+    /*  2 - start at the beginning and rewrite (at least) the whole dataset */
+    if ((info->length != skphuff_info->offset)
+        && (skphuff_info->offset != 0 && length <= info->length))
+        HRETURN_ERROR(DFE_UNSUPPORTED, FAIL);
+
+    if (HCIcskphuff_encode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CENCODE, FAIL);
+
+    return (length);
+}   /* HCPcskphuff_write() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcskphuff_inquire -- Inquire information about the access record and data element.
+
+ USAGE
+    int32 HCPcskphuff_inquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+            paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Inquire information about the access record and data element.
+    [Currently a NOP].
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcskphuff_inquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+                    uint16 *pref, int32 *plength, int32 *poffset,
+                    int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    /* shut compiler up */
+    access_rec = access_rec;
+    pfile_id = pfile_id;
+    ptag = ptag;
+    pref = pref;
+    plength = plength;
+    poffset = poffset;
+    pposn = pposn;
+    paccess = paccess;
+    pspecial = pspecial;
+
+    return (SUCCEED);
+}   /* HCPcskphuff_inquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcskphuff_endaccess -- Close the compressed data element
+
+ USAGE
+    int32 HCPcskphuff_endaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Close the compressed data element and free encoding info.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPcskphuff_endaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcskphuff_endaccess");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* Clean up the skipping huffman data structures */
+    if (HCIcskphuff_term(info) == FAIL)
+        HRETURN_ERROR(DFE_CTERM, FAIL);
+
+    /* close the compressed data AID */
+    if (Hendbitaccess(info->aid, 0) == FAIL)
+        HRETURN_ERROR(DFE_CANTCLOSE, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcskphuff_endaccess() */
diff --git a/hdf/src/cskphuff.h b/hdf/src/cskphuff.h
new file mode 100644
index 0000000..50be0f4
--- /dev/null
+++ b/hdf/src/cskphuff.h
@@ -0,0 +1,105 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ /* $Id: cskphuff.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+ /*-----------------------------------------------------------------------------
+ * File:    cskphuff.h
+ * Purpose: Header file for skipping huffman encoding information.
+ * Dependencies: should only be included from hcompi.h
+ * Invokes: none
+ * Contents: Structures & definitions for skipping huffman encoding.
+ * Structure definitions:
+ * Constant definitions:
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __CSKPHUFF_H
+#define __CSKPHUFF_H
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+   ** from cskphuff.c
+ */
+
+    extern int32 HCPcskphuff_stread
+                (accrec_t * rec);
+
+    extern int32 HCPcskphuff_stwrite
+                (accrec_t * rec);
+
+    extern int32 HCPcskphuff_seek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    extern int32 HCPcskphuff_inquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    extern int32 HCPcskphuff_read
+                (accrec_t * access_rec, int32 length, void * data);
+
+    extern int32 HCPcskphuff_write
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    extern intn HCPcskphuff_endaccess
+                (accrec_t * access_rec);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/* The maximum source character code: */
+#define SKPHUFF_MAX_CHAR     255
+
+/* One greater than the maximum source character code: */
+#define SUCCMAX     (SKPHUFF_MAX_CHAR+1)
+
+/* Twice the maximum source character code: */
+#define TWICEMAX    (2*SUCCMAX+1)
+
+/* The root node in the tree */
+#define ROOT        0
+
+/* Skipping huffman [en|de]coding information */
+typedef struct
+{
+    intn        skip_size;      /* number of bytes in each element */
+    uintn     **left,           /* define the left and right pointer arrays */
+              **right;
+    uint8     **up;             /* define the up pointer array */
+    intn        skip_pos;       /* current byte to read or write */
+    int32       offset;         /* offset in the de-compressed array */
+}
+comp_coder_skphuff_info_t;
+
+#ifndef CSKPHUFF_MASTER
+extern funclist_t cskphuff_funcs;   /* functions to perform skipping huffman encoding */
+#else
+funclist_t  cskphuff_funcs =
+{                               /* functions to perform skipping huffman encoding */
+    HCPcskphuff_stread,
+    HCPcskphuff_stwrite,
+    HCPcskphuff_seek,
+    HCPcskphuff_inquire,
+    HCPcskphuff_read,
+    HCPcskphuff_write,
+    HCPcskphuff_endaccess
+};
+#endif
+
+#endif /* __CSKPHUFF_H */
diff --git a/hdf/src/cszip.c b/hdf/src/cszip.c
new file mode 100644
index 0000000..cf3e2b2
--- /dev/null
+++ b/hdf/src/cszip.c
@@ -0,0 +1,1086 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6066 $";
+#endif
+
+/* $Id: cszip.c 6066 2014-02-03 16:30:04Z derobins $ */
+
+/* General HDF includes */
+
+#include "hdf.h"
+#include <assert.h>
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+
+#define CSZIP_MASTER
+#define CODER_CLIENT
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* internal defines */
+#define TMP_BUF_SIZE    8192    /* size of throw-away buffer */
+
+/* declaration of the functions provided in this module */
+PRIVATE int32 HCIcszip_staccess
+            (accrec_t * access_rec, int16 acc_mode);
+
+PRIVATE int32 HCIcszip_init
+            (accrec_t * access_rec);
+
+PRIVATE int32 HCIcszip_decode
+            (compinfo_t * info, int32 length, uint8 *buf);
+
+PRIVATE int32 HCIcszip_encode
+            (compinfo_t * info, int32 length, const uint8 *buf);
+
+PRIVATE int32 HCIcszip_term
+            (compinfo_t * info);
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcszip_init -- Initialize a SZIP compressed data element.
+
+ USAGE
+    int32 HCIcszip_init(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcszip_staccess and HCIcszip_seek
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcszip_init(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCIcszip_init");
+    compinfo_t *info;           /* special element information */
+    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
+    intn       ret_value = SUCCEED;
+
+#ifdef H4_HAVE_LIBSZ
+    /* Sanity check to make certain that we haven't drifted out of date with
+     * the mask options from the SZIP ricehdf.h header */
+    assert(H4_SZ_ALLOW_K13_OPTION_MASK==SZ_ALLOW_K13_OPTION_MASK);
+    assert(H4_SZ_CHIP_OPTION_MASK==SZ_CHIP_OPTION_MASK);
+    assert(H4_SZ_EC_OPTION_MASK==SZ_EC_OPTION_MASK);
+    assert(H4_SZ_LSB_OPTION_MASK==SZ_LSB_OPTION_MASK);
+    assert(H4_SZ_MSB_OPTION_MASK==SZ_MSB_OPTION_MASK);
+    assert(H4_SZ_NN_OPTION_MASK==SZ_NN_OPTION_MASK);
+    assert(H4_SZ_RAW_OPTION_MASK==SZ_RAW_OPTION_MASK);
+#endif
+
+    info = (compinfo_t *) access_rec->special_info;
+    if (Hseek(info->aid, 0, DF_START) == FAIL)  /* seek to beginning of element */
+        HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+
+    szip_info = &(info->cinfo.coder_info.szip_info);
+
+    /* Initialize SZIP state information */
+    szip_info->szip_state = SZIP_INIT;     /* start in initial state */
+    if (szip_info->buffer_size != 0) {
+        szip_info->buffer_size = 0;   /* offset into the file */
+        if (szip_info->buffer != NULL) {
+		HDfree(szip_info->buffer);
+		szip_info->buffer = NULL;
+        }
+    }
+    szip_info->offset = 0;   /* offset into the file */
+    szip_info->szip_dirty=SZIP_CLEAN;
+
+done:
+    return(ret_value);
+}   /* end HCIcszip_init() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcszip_decode -- Decode SZIP compressed data into a buffer.
+
+ USAGE
+    int32 HCIcszip_decode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to read into the buffer
+    uint8 *buf;         OUT: buffer to store the bytes read
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to decode SZIP data from the file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcszip_decode(compinfo_t * info, int32 length, uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcszip_decode");
+#ifdef H4_HAVE_LIBSZ
+    accrec_t *access_rec;
+    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
+    uint8 *in_buffer;
+    uint8 *out_buffer;
+    int32 in_length;
+    int32 out_length;
+    int bytes_per_pixel;
+    int32 rbytes;
+    uint16 tag,ref;
+    int32 len1;
+    int32 aid;
+    int32 status;
+    size_t size_out;
+    uint8 *cp;
+    int32 good_bytes;
+    int32 old_way;
+    SZ_com_t sz_param;
+#endif
+
+#ifdef H4_HAVE_LIBSZ
+
+    szip_info = &(info->cinfo.coder_info.szip_info);
+    if (szip_info->szip_state == SZIP_INIT) {
+	/*  Load from disk, decode the data */
+
+	if ((access_rec = HAatom_object(info->aid)) == NULL)    /* get the access_rec pointer */
+	    HRETURN_ERROR(DFE_ARGS, FAIL);
+
+	/* Discover how much data must be read */
+	if(HTPinquire(access_rec->ddid,&tag,&ref,NULL,&in_length)==FAIL)
+		HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+        if (in_length == -1)
+		HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+        if (tag & 0x4000) {
+	    /* this is linked list -- get the length of the data */
+            aid = Hstartread(access_rec->file_id, tag, ref);
+            if (HDinqblockinfo(aid, &len1, NULL, NULL, NULL) == FAIL) {
+	       Hendaccess(aid);
+	       HRETURN_ERROR(DFE_INTERNAL, FAIL);
+            }
+            in_length = len1; 
+	    Hendaccess(aid);
+        }
+
+	old_way = (int)(szip_info->options_mask & SZ_H4_REV_2);
+	if (old_way == 0) {
+		/* special case: read data encoded in V4.2r0 */
+		old_way = 1;
+		good_bytes = in_length;
+                in_length = in_length+5;
+	        if ((in_buffer = (uint8 *) HDmalloc(in_length)) == NULL)
+    	           HRETURN_ERROR(DFE_NOSPACE, FAIL);
+		cp = in_buffer;
+		*cp = 0;
+		cp++;
+		INT32ENCODE(cp, good_bytes);
+	} else {
+		/*  V4.2r1: in_length is correct */
+		old_way = 0;
+	        if ((in_buffer = (uint8 *) HDmalloc(in_length)) == NULL)
+    	           HRETURN_ERROR(DFE_NOSPACE, FAIL);
+	}
+
+        /* Allocate memory for the uncompressed data */
+	bytes_per_pixel = (szip_info->bits_per_pixel + 7) >> 3;
+	if (bytes_per_pixel == 3)
+		bytes_per_pixel++;
+
+        out_length = szip_info->pixels * bytes_per_pixel;
+	if ((out_buffer = (uint8 *) HDmalloc(out_length)) == NULL)
+		HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+	/* Read the unompressed data */
+	if (old_way == 1) {
+		/* this is encoded in V4.2r0 */
+		/* the preamble isn't in the file, so read only the data */
+		if ((rbytes = Hread(info->aid, in_length-5, in_buffer+5)) == FAIL)
+		{
+			HDfree(out_buffer);
+			HDfree(in_buffer);
+			HRETURN_ERROR(DFE_READERROR, FAIL);
+		}
+		if (rbytes == 0 || rbytes != (in_length - 5)) {
+			/* is this possible? */
+			HDfree(out_buffer);
+			HDfree(in_buffer);
+			HRETURN_ERROR(DFE_READERROR, FAIL);
+		}
+	} else {
+		/* HDF4.2R1: read the data plus preamble */
+		if ((rbytes = Hread(info->aid, in_length, in_buffer)) == FAIL)
+		{
+			HDfree(out_buffer);
+			HDfree(in_buffer);
+			HRETURN_ERROR(DFE_READERROR, FAIL);
+		}
+		if (rbytes == 0 || rbytes != in_length) {
+			/* is this possible? */
+			HDfree(out_buffer);
+			HDfree(in_buffer);
+			HRETURN_ERROR(DFE_READERROR, FAIL);
+		}
+	}
+        cp = in_buffer;
+        cp++;
+        INT32DECODE(cp, good_bytes);
+	if (in_buffer[0] == 1) {
+           /* This byte means the data was not compressed -- just copy out */
+	    szip_info->szip_state = SZIP_RUN;
+	    HDmemcpy(out_buffer, in_buffer+5, good_bytes);
+	    szip_info->buffer = out_buffer;
+	    szip_info->buffer_pos = 0;
+	    szip_info->buffer_size = good_bytes;
+	    szip_info->offset = 0;
+	    if (good_bytes > length) {
+		/* partial read */
+		HDmemcpy(buf, in_buffer+5, length);
+	        szip_info->buffer_pos += length;
+	        szip_info->buffer_size -= length;
+	    } else {
+		/* read the whole data block to the user buffer */
+		HDmemcpy(buf, in_buffer+5, good_bytes);
+	        szip_info->buffer_pos += good_bytes;
+	        szip_info->buffer_size -= good_bytes;
+	    }
+	    szip_info->offset = szip_info->buffer_pos;
+	    HDfree(in_buffer);
+	    if (szip_info->buffer_size == 0) {
+		if (szip_info->buffer != NULL) {
+		   HDfree(szip_info->buffer);
+		   szip_info->buffer = NULL;
+		}
+	    }
+	    return (SUCCEED);
+        }
+
+	/* Decompress the data */
+     
+        /* set up the parameters */
+	sz_param.options_mask = (szip_info->options_mask & ~SZ_H4_REV_2);
+	sz_param.bits_per_pixel = szip_info->bits_per_pixel;
+	sz_param.pixels_per_block = szip_info->pixels_per_block;
+	sz_param.pixels_per_scanline = szip_info->pixels_per_scanline;
+	size_out = out_length;
+	if(SZ_OK!= (status = SZ_BufftoBuffDecompress(out_buffer, &size_out, (in_buffer+5), good_bytes, &sz_param)))
+         {
+		HDfree(out_buffer);
+		HDfree(in_buffer);
+		HRETURN_ERROR(DFE_CDECODE, FAIL);
+        }
+
+	if ((int32)size_out != out_length) {
+	   /* This should never happen?? */
+	   printf("status: %d ??bytes != out_length %d != %d\n",status,size_out,out_length);
+	}
+
+        /* The data is successfully decompressed. Put into the szip struct */
+	 HDfree(in_buffer);
+	 szip_info->szip_state = SZIP_RUN;
+	 szip_info->buffer = out_buffer;
+	 szip_info->buffer_pos = 0;
+	 szip_info->buffer_size = out_length;
+	 szip_info->offset = 0;
+    }
+
+   /* copy the data into the return buffer */
+    if (length > szip_info->buffer_size)
+    {	
+        /*  can't happen?? panic?? */
+	if (szip_info->buffer != NULL) {
+            HDfree(szip_info->buffer);
+	    szip_info->buffer = NULL;
+        } 
+        return (FAIL);
+    }
+
+    HDmemcpy(buf, szip_info->buffer + szip_info->buffer_pos, length);
+    szip_info->buffer_pos += length;
+    szip_info->buffer_size -= length;
+    szip_info->offset = szip_info->buffer_pos;
+
+    if (szip_info->buffer_size == 0) {
+       if (szip_info->buffer != NULL) {
+  	    HDfree(szip_info->buffer);
+	    szip_info->buffer = NULL;
+       }
+    }
+
+    return (SUCCEED);
+
+#else /* ifdef H4_HAVE_LIBSZ */
+
+    HRETURN_ERROR(DFE_CANTCOMP, FAIL);
+
+#endif /* H4_HAVE_LIBSZ */
+
+}   /* end HCIcszip_decode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcszip_encode -- Encode data from a buffer into SZIP compressed data
+
+ USAGE
+    int32 HCIcszip_encode(info,length,buf)
+    compinfo_t *info;   IN: the info about the compressed element
+    int32 length;       IN: number of bytes to store from the buffer
+    const uint8 *buf;         OUT: buffer to get the bytes from
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to encode SZIP data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcszip_encode(compinfo_t * info, int32 length, const uint8 *buf)
+{
+    CONSTR(FUNC, "HCIcszip_encode");
+#ifdef H4_HAVE_SZIP_ENCODER
+    int bytes_per_pixel;
+    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
+    int32 buffer_size;
+
+    if (SZ_encoder_enabled() == 0) 
+        HRETURN_ERROR(DFE_NOENCODER, FAIL);
+
+    szip_info = &(info->cinfo.coder_info.szip_info);
+    if (szip_info->szip_state == SZIP_INIT) {
+	/* Need to initialize */
+	bytes_per_pixel = (szip_info->bits_per_pixel + 7) >> 3;
+	if (bytes_per_pixel == 3)
+		bytes_per_pixel = 4;
+
+	buffer_size = szip_info->pixels * bytes_per_pixel;
+	if ((szip_info->buffer = HDmalloc(buffer_size)) == NULL)
+			HRETURN_ERROR(DFE_NOSPACE, FAIL);
+	
+	szip_info->buffer_size = buffer_size;
+	szip_info->buffer_pos = 0;
+	szip_info->szip_state = SZIP_RUN;
+    }
+
+    /* copy the data into the buffer.  This wil be written in 'term' function */
+    HDmemcpy(szip_info->buffer + szip_info->buffer_pos, buf, length);
+    szip_info->buffer_pos += length;
+    szip_info->buffer_size -= length;
+    szip_info->offset = szip_info->buffer_pos; 
+    szip_info->szip_dirty=SZIP_DIRTY;
+
+    return (SUCCEED);
+
+#else /* ifdef H4_HAVE_SZIP_ENCODER */
+
+    HRETURN_ERROR(DFE_CANTDECOMP, FAIL);
+
+#endif /* H4_HAVE_SZIP_ENCODER */
+
+}   /* end HCIcszip_encode() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcszip_term -- Flush encoded data from internal buffer to SZIP compressed data
+
+ USAGE
+    int32 HCIcszip_term(info)
+    compinfo_t *info;   IN: the info about the compressed element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called to flush SZIP data into a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcszip_term(compinfo_t * info)
+{
+    CONSTR(FUNC, "HCIcszip_term");
+#ifdef H4_HAVE_SZIP_ENCODER
+    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
+    uint8 *out_buffer;
+    uint8 *ob;
+    int32 out_buffer_size;
+    int bytes_per_pixel;
+    int32 current_size;
+    accrec_t *access_rec;
+    uint16 tag,ref;
+    int32 len1;
+    int32 aid;
+    SZ_com_t sz_param;
+    size_t size_out;
+    int32 status;
+    uint8 *cp;
+
+    szip_info = &(info->cinfo.coder_info.szip_info);
+    if (szip_info->szip_state != SZIP_RUN)
+	return (SUCCEED); /* nothing to do */
+
+    if (szip_info->szip_dirty != SZIP_DIRTY) /* Should never happen?? */
+    {
+	    if (szip_info->buffer_size == 0) {
+                if (szip_info->buffer != NULL) {
+		    HDfree(szip_info->buffer);
+	            szip_info->buffer = NULL;
+                }
+            }
+	return (SUCCEED);
+    }
+
+    szip_info->szip_state = SZIP_TERM;
+
+    current_size = 0;
+    if ((access_rec = HAatom_object(info->aid)) == NULL)    /* get the access_rec pointer */
+		HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Discover how much data must be read */
+    if(HTPinquire(access_rec->ddid,&tag,&ref,NULL, &current_size)==FAIL)
+	HRETURN_ERROR(DFE_INTERNAL, FAIL);
+    if (tag & 0x4000) {
+    /* this is linked list -- get the length of the data */
+        aid = Hstartread(access_rec->file_id, tag, ref);
+        if (HDinqblockinfo(aid, &len1, NULL, NULL, NULL) == FAIL) 
+        {
+            Hendaccess(aid);
+	    HRETURN_ERROR(DFE_INTERNAL, FAIL);
+        }
+        current_size = len1; 
+	Hendaccess(aid);
+    }
+
+   /* Compute how much memory is needed to hold compressed data */
+    bytes_per_pixel = (szip_info->bits_per_pixel + 7) >> 3;
+    if (bytes_per_pixel == 3)
+	bytes_per_pixel = 4;
+
+    /* temporary buffer for compression -- leave extra space in case of
+          overflow in the SZIP algorithm. (This number corresponds to
+          the current internal buffer of szip lib.)  Sigh. */
+    /* allocate one byte to indicate when data is written uncompressed */
+    /* allocate 4 bytes to store the amount of data written:  
+        after compression may be less than the previous size  */
+    out_buffer_size = (szip_info->pixels * 2 * bytes_per_pixel) + 5;
+
+    /* heuristic for tiny data -- really shouldn't compress stuff this small,
+       but there isn't any way to prevent it from getting here */
+    if (out_buffer_size < 1024) out_buffer_size = 1024;
+    if ((out_buffer = HDmalloc(out_buffer_size)) == NULL)
+		HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    /* set parms */
+    sz_param.options_mask = szip_info->options_mask;
+    sz_param.bits_per_pixel = szip_info->bits_per_pixel;
+    sz_param.pixels_per_block = szip_info->pixels_per_block;
+    sz_param.pixels_per_scanline = szip_info->pixels_per_scanline;
+    size_out = out_buffer_size - 5;
+
+    *out_buffer=0;
+    if(SZ_OK!= (status =SZ_BufftoBuffCompress((out_buffer+5), &size_out, szip_info->buffer, szip_info->buffer_pos, &sz_param)))
+    {
+       /* Compression Failed.  Analyse several cases, and clean up the mess */
+	if ((int32)size_out > out_buffer_size) {
+                /* Should never happen */
+		printf("PANIC: overwrote memory\n");fflush(stdout);
+	}
+	if (status == 2/*SZ_OUTBUF_FULL*/) {
+            /* SZIP internal overflow: data not successfully compressed */
+            /* Write out the uncompressed data */
+	    *out_buffer=1;  /* 1 = don't decompress */
+            cp = out_buffer;
+            cp++;
+            INT32ENCODE(cp, szip_info->buffer_pos);
+	    HDmemcpy((out_buffer+5), szip_info->buffer, szip_info->buffer_pos);
+	    HDfree(out_buffer);
+	    szip_info->szip_dirty=SZIP_CLEAN;
+			
+	    if (szip_info->buffer_size == 0) {
+	        if (szip_info->buffer != NULL)  {
+		    HDfree(szip_info->buffer);
+	            szip_info->buffer = NULL;
+                }
+            }
+	    return (SUCCEED);
+	 } 
+
+	  /* compress failed, return error */
+          szip_info->szip_dirty=SZIP_CLEAN;
+          HDfree(out_buffer);
+	  if (szip_info->buffer_size == 0) {
+	        if (szip_info->buffer != NULL)  {
+		    HDfree(szip_info->buffer);
+	            szip_info->buffer = NULL;
+                }
+          }
+	  HRETURN_ERROR(DFE_CENCODE, FAIL);
+	}
+
+        /* Compression Succeeded, write out the compressed data */
+
+	if ((int32)size_out >= out_buffer_size) 
+		printf("PANIC: overwrote memory but returned OK?\n");fflush(stdout);
+	if ((int32)size_out > (szip_info->pixels * bytes_per_pixel)) {
+            /* The compression succeeded, but is larger than the original data! */
+	    /*  Write the original data, discard the output  */
+	    *out_buffer=1;  /* 1 = don't decompress */
+            cp = out_buffer;
+            cp++;
+            INT32ENCODE(cp, szip_info->buffer_pos);
+	    HDmemcpy((out_buffer+5), szip_info->buffer, szip_info->buffer_pos);
+	    Hwrite(info->aid, (szip_info->buffer_pos+5), out_buffer);
+	    szip_info->szip_dirty=SZIP_CLEAN;
+	    HDfree(out_buffer);
+	    if (szip_info->buffer_size == 0) {
+	        if (szip_info->buffer != NULL) {
+		    HDfree(szip_info->buffer);
+	            szip_info->buffer = NULL;
+                }
+            }
+	    return (SUCCEED);
+	}
+
+      if ((current_size > 0) && (((int32)size_out+5) < current_size)) {
+            /* SZIP freaks out if there is junk at the end of the good data */
+            /* need to have enough data to overwrite the existing data */
+            /* allocate a buffer, fill in the good data. The rest must be
+                zeroes */
+            if ((ob = HDmalloc(current_size)) == NULL)
+		HRETURN_ERROR(DFE_NOSPACE, FAIL);
+	    *ob=0;  /* data needs to be decompressed */
+            cp = ob;
+            cp++;
+            INT32ENCODE(cp, size_out); /* how much to decompress  (< total size)*/
+	    HDmemcpy((ob+5), out_buffer+5, size_out);
+	    Hwrite(info->aid, current_size, ob);  /* write out at least 'current_size' bytes */
+	    szip_info->szip_dirty=SZIP_CLEAN;
+	    HDfree(out_buffer);
+	    HDfree(ob);
+	    if (szip_info->buffer_size == 0) {
+	        if (szip_info->buffer != NULL)  {
+		    HDfree(szip_info->buffer);
+	            szip_info->buffer = NULL;
+                }
+            }
+	    return (SUCCEED);
+     } 
+
+      /* Finally!  Write the compressed data. Byte 0 is '0' */ 
+    *out_buffer=0;   /* data needs to be decompressed */
+    cp = out_buffer;
+    cp++;
+    INT32ENCODE(cp, size_out);   /* whole bufer needs to be decompressed */
+    status = Hwrite(info->aid, size_out+5, out_buffer);
+
+    szip_info->szip_dirty=SZIP_CLEAN;
+    if (szip_info->buffer_size == 0) {
+	if (szip_info->buffer != NULL) {
+	    HDfree(szip_info->buffer);
+	    szip_info->buffer = NULL;
+        }
+    }
+    HDfree(out_buffer);
+
+    return (SUCCEED);
+
+#else /* H4_HAVE_SZIP_ENCODER */
+
+    HRETURN_ERROR(DFE_CANTCOMP, FAIL);
+
+#endif /* H4_HAVE_SZIP_ENCODER */
+
+}   /* end HCIcszip_term() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIcszip_staccess -- Start accessing a SZIP compressed data element.
+
+ USAGE
+    int32 HCIcszip_staccess(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Common code called by HCIcszip_stread and HCIcszip_stwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIcszip_staccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIcszip_staccess");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+    if (acc_mode == DFACC_READ)
+        info->aid = Hstartread(access_rec->file_id, DFTAG_COMPRESSED,
+                               info->comp_ref);
+    else
+#ifdef H4_HAVE_SZIP_ENCODER
+	{
+	    if (SZ_encoder_enabled() == 0) 
+		HRETURN_ERROR(DFE_NOENCODER, FAIL);
+	    info->aid = Hstartaccess(access_rec->file_id, DFTAG_COMPRESSED,
+                       info->comp_ref, DFACC_RDWR|DFACC_APPENDABLE);
+	}
+#else /* H4_HAVE_SZIP_ENCODER */
+    HRETURN_ERROR(DFE_DENIED, FAIL);
+#endif /* H4_HAVE_SZIP_ENCODER */
+
+    if (info->aid == FAIL)
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+
+    return (HCIcszip_init(access_rec));  /* initialize the SZIP info */
+}   /* end HCIcszip_staccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcszip_stread -- start read access for compressed file
+
+ USAGE
+    int32 HCPcszip_stread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start read access on a compressed data element using a simple SZIP scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcszip_stread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcszip_stread");
+    int32       ret;
+
+    if ((ret = HCIcszip_staccess(access_rec, DFACC_READ)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcszip_stread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcszip_stwrite -- start write access for compressed file
+
+ USAGE
+    int32 HCPcszip_stwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start write access on a compressed data element using a simple SZIP scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcszip_stwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcszip_stwrite");
+    int32       ret;
+
+    if ((ret = HCIcszip_staccess(access_rec, DFACC_WRITE)) == FAIL)
+        HRETURN_ERROR(DFE_CINIT, FAIL);
+    return (ret);
+}   /* HCPcszip_stwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcszip_seek -- Seek to offset within the data element
+
+ USAGE
+    int32 HCPcszip_seek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from [UNUSED!]
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Seek to a position with a compressed data element.  The 'origin'
+    calculations have been taken care of at a higher level, it is an
+    un-used parameter.  The 'offset' is used as an absolute offset
+    because of this.
+
+    COMMENT:
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcszip_seek(accrec_t * access_rec, int32 offset, int origin)
+{
+    CONSTR(FUNC, "HCPcszip_seek");
+    compinfo_t *info;           /* special element information */
+    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
+    uint8      *tmp_buf;        /* pointer to throw-away buffer */
+
+    /* shut compiler up */
+    origin = origin;
+
+    info = (compinfo_t *) access_rec->special_info;
+    szip_info = &(info->cinfo.coder_info.szip_info);
+
+    if (offset < szip_info->offset)
+      {     /* need to seek from the beginning */
+          if (szip_info->szip_dirty == SZIP_DIRTY && szip_info->szip_state != SZIP_INIT)
+{
+              if (HCIcszip_term(info) == FAIL)
+                  HRETURN_ERROR(DFE_CTERM, FAIL);
+}
+          if (HCIcszip_init(access_rec) == FAIL)
+              HRETURN_ERROR(DFE_CINIT, FAIL);
+      }     /* end if */
+
+    if ((tmp_buf = (uint8 *) HDmalloc(TMP_BUF_SIZE)) == NULL)     /* get tmp buffer */
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    while (szip_info->offset + TMP_BUF_SIZE < offset)    /* grab chunks */
+    {
+        if (HCIcszip_decode(info, TMP_BUF_SIZE, tmp_buf) == FAIL)
+          {
+              HDfree(tmp_buf);
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+    }
+    if (szip_info->offset < offset)  /* grab the last chunk */
+    {
+        if (HCIcszip_decode(info, offset - szip_info->offset, tmp_buf) == FAIL)
+          {
+              HDfree(tmp_buf);
+              HRETURN_ERROR(DFE_CDECODE, FAIL)
+          }     /* end if */
+    }
+
+    HDfree(tmp_buf);
+    return (SUCCEED);
+}   /* HCPcszip_seek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcszip_read -- Read in a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcszip_read(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+
+ RETURNS
+    Returns the number of bytes read or FAIL
+
+ DESCRIPTION
+    Read in a number of bytes from a SZIP compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcszip_read(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPcszip_read");
+    compinfo_t *info;           /* special element information */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    if (HCIcszip_decode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CDECODE, FAIL);
+
+    return (length);
+}   /* HCPcszip_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcszip_write -- Write out a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPcszip_write(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+
+ RETURNS
+    Returns the number of bytes written or FAIL
+
+ DESCRIPTION
+    Write out a number of bytes to a SZIP compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcszip_write(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPcszip_write");
+#ifdef H4_HAVE_SZIP_ENCODER
+    compinfo_t *info;           /* special element information */
+    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
+
+    if (SZ_encoder_enabled() == 0) 
+	HRETURN_ERROR(DFE_NOENCODER, FAIL);
+    info = (compinfo_t *) access_rec->special_info;
+    szip_info = &(info->cinfo.coder_info.szip_info);
+
+    /* Don't allow random write in a dataset unless: */
+    /*  1 - append onto the end */
+    /*  2 - start at the beginning and rewrite (at least) the whole dataset */
+    if ((info->length != szip_info->offset)
+        && (szip_info->offset != 0 || length < info->length))
+        HRETURN_ERROR(DFE_UNSUPPORTED, FAIL);
+
+    if (HCIcszip_encode(info, length, data) == FAIL)
+        HRETURN_ERROR(DFE_CENCODE, FAIL);
+
+    return (length);
+#else /* ifdef H4_HAVE_SZIP_ENCODER */
+
+    HRETURN_ERROR(DFE_CANTDECOMP, FAIL);
+
+#endif /* H4_HAVE_SZIP_ENCODER */
+}   /* HCPcszip_write() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcszip_inquire -- Inquire information about the access record and data element.
+
+ USAGE
+    int32 HCPcszip_inquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+            paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Inquire information about the access record and data element.
+    [Currently a NOP].
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcszip_inquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+                uint16 *pref, int32 *plength, int32 *poffset,
+                int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    /* shut compiler up */
+    access_rec = access_rec;
+    pfile_id = pfile_id;
+    ptag = ptag;
+    pref = pref;
+    plength = plength;
+    poffset = poffset;
+    pposn = pposn;
+    paccess = paccess;
+    pspecial = pspecial;
+
+    return (SUCCEED);
+}   /* HCPcszip_inquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcszip_endaccess -- Close the compressed data element
+
+ USAGE
+    int32 HCPcszip_endaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Close the compressed data element and free encoding info.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPcszip_endaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcszip_endaccess");
+    compinfo_t *info;           /* special element information */
+    comp_coder_szip_info_t *szip_info;    /* ptr to SZIP info */
+
+    info = (compinfo_t *) access_rec->special_info;
+    szip_info = &(info->cinfo.coder_info.szip_info);
+
+    /* flush out SZIP buffer if there is unwritten data */
+    if (szip_info->szip_dirty == SZIP_DIRTY && szip_info->szip_state != SZIP_INIT)
+{
+        if (HCIcszip_term(info) == FAIL)
+            HRETURN_ERROR(DFE_CTERM, FAIL);
+    }
+
+    /* close the compressed data AID */
+    if (Hendaccess(info->aid) == FAIL)
+        HRETURN_ERROR(DFE_CANTCLOSE, FAIL);
+
+    return (SUCCEED);
+}   /* HCPcszip_endaccess() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPsetup_szip_parms -- Initialize SZIP parameters
+
+ USAGE
+    intn HCPcszip_setup_parms( comp_info *c_info, int32 nt, int32 ndims, int32 *dims, int32 *cdims)
+    comp_info *c_info;    IN/OUT: the szip compression params
+    int32 nt;             IN: the number type of the data
+    int32 ncomp;          IN: components in GR, 1 for SD
+    int32 ndims;          IN: The rank of the data
+    int32 *dims;          IN: the dimensions 
+    int32 *cdims;         IN: the dimensions of a chunk, if chunked, or NULL;
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    
+    Computes the SZIP parameters for dataset or chunk:
+       pixels -- total elements per compression
+       pixels_per_scanline 
+       bits_per_pixel
+    
+    This is called from SDsetcompress, SDsetchunk, GRsetcompress, GRsetchunk
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+HCPsetup_szip_parms( comp_info *c_info, int32 nt, int32 ncomp, int32 ndims, int32 *dims, int32 *cdims)
+{
+#ifdef H4_HAVE_SZIP_ENCODER
+    int32 scanline;
+    int32 npoints;
+    int32 sz;
+    int i;
+    intn       ret_value = SUCCEED;
+
+    if (ndims <= 0) {
+          ret_value = FAIL;
+          goto done;
+    }
+
+    /* compute the number of elements in the compressed unit:
+        if chunked, compress each chunk. If not, compress whole 
+        object
+    */
+    npoints = ncomp; /* for GR24, treat as 3 D data for szip */
+    /* get npoints */
+    if (cdims == NULL ) {
+	   /* the whole array */
+        for (i = 0; i < ndims; i++) {
+	  npoints *= dims[i];
+        }
+    } else {
+	   /* elements in a single chunk */
+        for (i = 0; i < ndims; i++) {
+	  npoints *= cdims[i];
+        }
+    }
+    c_info->szip.pixels = npoints;
+
+    /* compute the pixels per scanline */
+	/* start with the n-1th dimension, allow for components of GR */
+    if (cdims == NULL ) {
+	scanline = dims[ndims - 1] * ncomp;
+    } else {
+	scanline = cdims[ndims-1] * ncomp;
+    }
+
+    /* apply restrictions to find the correct value */
+    if (scanline < c_info->szip.pixels_per_block) {
+	if (c_info->szip.pixels < c_info->szip.pixels_per_block) {
+	    ret_value = FAIL;
+	    goto done;
+	}
+	scanline = MIN((c_info->szip.pixels_per_block * SZ_MAX_BLOCKS_PER_SCANLINE), npoints);
+		
+    } else {
+	if (scanline <= SZ_MAX_PIXELS_PER_SCANLINE) {
+		scanline = MIN((c_info->szip.pixels_per_block * SZ_MAX_BLOCKS_PER_SCANLINE), scanline);
+	} else {
+		scanline = c_info->szip.pixels_per_block * SZ_MAX_BLOCKS_PER_SCANLINE;
+	}
+    }
+    c_info->szip.pixels_per_scanline = scanline;
+
+    /* compute the bits per pixel from the HDF NDT */
+    if (FAIL == (sz = DFKNTsize(nt | DFNT_NATIVE))) {
+            ret_value = FAIL;
+            goto done;
+    }
+    c_info->szip.bits_per_pixel = sz * 8;
+
+done:
+    return(ret_value);
+#else
+   /* szip not enabled */
+   return(FAIL);
+#endif
+}
diff --git a/hdf/src/cszip.h b/hdf/src/cszip.h
new file mode 100644
index 0000000..2dc7d36
--- /dev/null
+++ b/hdf/src/cszip.h
@@ -0,0 +1,120 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: cszip.h 6066 2014-02-03 16:30:04Z derobins $ */
+
+/*-----------------------------------------------------------------------------
+  * File:    cszip.h
+  * Purpose: Header file for szip encoding information.
+  * Dependencies: should only be included from hcompi.h
+  * Invokes: none
+  * Contents: Structures & definitions for szip encoding.  This header
+  *              should only be included in hcomp.c and cszip.c.
+  * Structure definitions:
+  * Constant definitions:
+  *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __CSZIP_H
+#define __CSZIP_H
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/* Special parameters for szip compression */
+/* [These are aliases for the similar definitions in ricehdf.h header file] */
+#define H4_SZ_ALLOW_K13_OPTION_MASK     1
+#define H4_SZ_CHIP_OPTION_MASK          2
+#define H4_SZ_EC_OPTION_MASK            4
+#define H4_SZ_LSB_OPTION_MASK           8
+#define H4_SZ_MSB_OPTION_MASK           16
+#define H4_SZ_NN_OPTION_MASK            32
+#define H4_SZ_RAW_OPTION_MASK           128
+
+/*
+    ** from cszip.c
+  */
+
+     extern int32 HCPcszip_stread
+                 (accrec_t * rec);
+
+     extern int32 HCPcszip_stwrite
+                 (accrec_t * rec);
+
+     extern int32 HCPcszip_seek
+                 (accrec_t * access_rec, int32 offset, int origin);
+
+     extern int32 HCPcszip_inquire
+                 (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, 
+uint16 *pref,
+                int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                  int16 *pspecial);
+
+     extern int32 HCPcszip_read
+                 (accrec_t * access_rec, int32 length, void * data);
+
+     extern int32 HCPcszip_write
+                 (accrec_t * access_rec, int32 length, const void * data);
+
+     extern intn HCPcszip_endaccess
+                 (accrec_t * access_rec);
+
+     extern intn HCPsetup_szip_parms
+                 ( comp_info *c_info, int32 nt, int32 ncomp, int32 ndims, int32 *dims, int32 *cdims);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+
+/* SZIP [en|de]coding information */
+typedef struct
+{
+     int32       offset;    /* offset in the file */
+     uint8       *buffer;   /* buffer for storing SZIP bytes */
+     int32       buffer_pos;
+     int32       buffer_size;
+     int32 bits_per_pixel;
+     int32 options_mask;
+     int32 pixels;
+     int32 pixels_per_block;
+     int32 pixels_per_scanline;
+     enum
+       {
+           SZIP_INIT, SZIP_RUN,  SZIP_TERM
+       }
+     szip_state;                  /* state of the buffer storage */
+     enum { SZIP_CLEAN, SZIP_DIRTY } szip_dirty;
+}
+comp_coder_szip_info_t;
+
+#define SZ_H4_REV_2 0x10000   /* special bit to signal revised format */
+
+#ifndef CSZIP_MASTER
+extern funclist_t cszip_funcs;   /* functions to perform szip encoding */
+#else
+funclist_t  cszip_funcs =
+{                               /* functions to perform szip encoding */
+     HCPcszip_stread,
+     HCPcszip_stwrite,
+     HCPcszip_seek,
+     HCPcszip_inquire,
+     HCPcszip_read,
+     HCPcszip_write,
+     HCPcszip_endaccess
+};
+#endif
+
+#endif /* __CSZIP_H */
diff --git a/hdf/src/df.h b/hdf/src/df.h
new file mode 100644
index 0000000..396810a
--- /dev/null
+++ b/hdf/src/df.h
@@ -0,0 +1,215 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: df.h 5444 2010-08-25 16:40:05Z byrn $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    df.h
+ * Purpose: header file for HDF routines
+ * Invokes: dfi.h
+ * Contents:
+ *  Structure definitions: DFddh, DFdd, DFdesc, DFdle, DF, DFdi, DFdata
+ *  Procedure type definitions
+ *  Global variables
+ *  Tag definitions
+ *  Error return codes
+ *  Logical constants
+ * Remarks: This file is included with user programs
+ *          Since it includes stdio.h etc., do not include these after df.h
+ *---------------------------------------------------------------------------*/
+
+#ifndef DF_H    /* avoid re-inclusion */
+#define DF_H
+
+#include "H4api_adpt.h"
+
+/* include DF (internal) header information */
+#include "hdf.h"
+
+/*-------------------------------------------------------------------------*/
+/*                      Type declarations                                   */
+
+typedef struct DFddh
+  {                             /*format of data descriptor headers in file */
+      int16       dds;          /* number of dds in header block */
+      int32       next;         /* offset of next header block */
+  }
+DFddh;
+
+typedef struct DFdd
+  {                             /* format of data descriptors as in file */
+      uint16      tag;          /* data tag */
+      uint16      ref;          /* data reference number */
+      int32       offset;       /* offset of data element in file */
+      int32       length;       /* number of bytes */
+  }
+DFdd;
+
+/* descriptor structure is same as dd structure.  ###Note: may be changed */
+typedef DFdd DFdesc;
+
+/* DLE is the internal structure which stores data descriptor information */
+/* It is a linked list of DDs */
+typedef struct DFdle
+  {                             /* Data List element */
+      struct DFdle *next;       /* link to next dle */
+      DFddh       ddh;          /* To store headers */
+      DFdd        dd[1];        /* dummy size */
+  }
+DFdle;
+
+/* DF is the internal structure associated with each DF file */
+/* It holds information associated with the file as a whole */
+/* ### Note: there are hooks for having multiple DF files open at a time */
+typedef struct DF
+  {
+      DFdle      *list;         /* Pointer to the DLE list */
+      DFdle      *last_dle;     /* last_dle and last_dd are used in searches */
+      /* to indicate element returned */
+      /* by previous call to DFfind */
+      DFdd       *up_dd;        /* DD of element being read/updated, */
+      /* used by DFstart */
+      uint16      last_tag;     /* Last tag searched for by DFfind */
+      uint16      last_ref;     /* Last reference number searched for */
+      intn        type;         /* 0= not in use, 1= normal, -1 = multiple */
+      /* this is a hook for when */
+      /* multiple files are open */
+      intn        access;       /* permitted access types: */
+      /* 0=none, 1=r, 2=w, 3=r/w */
+      intn        changed;      /* True if anything in DDs modified */
+      /* since last write */
+      intn        last_dd;      /* see last_dle */
+      intn        defdds;       /* default numer of DD's in each block */
+      intn        up_access;    /* access permissions to element being */
+      /* read/updated. Used by DFstart */
+      /* File handle is a file pointer or file descriptor depending on whether */
+      /* we use buffered or unbuffered I/O.  But, since this structure is a */
+      /* fake, it doesn't matter whether I/O is buffered or not. */
+      intn        file;         /* file descriptor */
+  }
+DF;
+
+typedef struct DFdata
+  {                             /* structure for returning status information */
+      int32       version;      /* version number of program */
+  }
+DFdata;
+
+/*--------------------------------------------------------------------------*/
+/*                          Procedure types                                 */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/* prototypes for dfstubs.c */
+    HDFLIBAPI DF  *DFopen
+                (char *name, int acc_mode, int ndds);
+
+    HDFLIBAPI int  DFclose
+                (DF * dfile);
+
+    HDFLIBAPI int  DFdescriptors
+                (DF * dfile, DFdesc ptr[], int begin, int num);
+
+    HDFLIBAPI int  DFnumber
+                (DF * dfile, uint16 tag);
+
+    HDFLIBAPI int  DFsetfind
+                (DF * dfile, uint16 tag, uint16 ref);
+
+    HDFLIBAPI int  DFfind
+                (DF * dfile, DFdesc * ptr);
+
+    HDFLIBAPI int  DFaccess
+                (DF * dfile, uint16 tag, uint16 ref, char *acc_mode);
+
+    HDFLIBAPI int  DFstart
+                (DF * dfile, uint16 tag, uint16 ref, char *acc_mode);
+
+    HDFLIBAPI int32 DFread
+                (DF * dfile, char *ptr, int32 len);
+
+    HDFLIBAPI int32 DFseek
+                (DF * dfile, int32 offset);
+
+    HDFLIBAPI int32 DFwrite
+                (DF * dfile, char *ptr, int32 len);
+
+    HDFLIBAPI int  DFupdate
+                (DF * dfile);
+
+    HDFLIBAPI int  DFstat
+                (DF * dfile, DFdata * dfinfo);
+
+    HDFLIBAPI int32 DFgetelement
+                (DF * dfile, uint16 tag, uint16 ref, char *ptr);
+
+    HDFLIBAPI int32 DFputelement
+                (DF * dfile, uint16 tag, uint16 ref, char *ptr, int32 len);
+
+    HDFLIBAPI int  DFdup
+                (DF * dfile, uint16 itag, uint16 iref, uint16 otag, uint16 oref);
+
+    HDFLIBAPI int  DFdel
+                (DF * dfile, uint16 tag, uint16 ref);
+
+    HDFLIBAPI uint16 DFnewref
+                (DF * dfile);
+
+    HDFLIBAPI int  DFishdf
+                (char *filename);
+
+    HDFLIBAPI int  DFerrno
+                (void);
+
+    HDFLIBAPI int  DFIerr
+                (DF * dfile);
+
+    HDFLIBAPI int  DFImemcopy
+                (char *from, char *to, int length);
+
+    HDFLIBAPI void *DFIgetspace
+                (uint32 qty);
+
+    HDFLIBAPI void *DFIfreespace
+                (void *ptr);
+
+    HDFLIBAPI int  DFIc2fstr
+                (char *str, int len);
+
+    HDFLIBAPI char *DFIf2cstring
+                (_fcd fdesc, intn len);
+
+/* prototypes for dfconv.c */
+    HDFLIBAPI int  DFconvert
+                (uint8 *source, uint8 *dest, int ntype, int sourcetype, int desttype, int32 size);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/*--------------------------------------------------------------------------*/
+/*                          Global Variables                                */
+
+#ifndef DFMASTER
+HDFLIBAPI
+#endif                          /*DFMASTER */
+int DFerror;            /* Error code for DF routines */
+
+#define DFSETERR(error) (DFerror=(DFerror?DFerror:error))
+
+#define DFTOFID(df) (int32)(df->list)
+
+#endif /* DF_H */
diff --git a/hdf/src/df24.c b/hdf/src/df24.c
new file mode 100644
index 0000000..a1567b3
--- /dev/null
+++ b/hdf/src/df24.c
@@ -0,0 +1,517 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4924 $";
+#endif
+
+/* $Id: df24.c 4924 2007-09-05 21:55:40Z fbaker $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     df24.c
+ * Purpose:  read and write 24-bit raster images
+ * Invokes:  dfgr.c
+ * Contents:
+ *  DF24getdims:     - get dimensions of image
+ *  DF24reqil:       - use this interlace when returning image
+ *  DF24getimage:    - read in image
+ *  DF24setdims:     - set dimensions of image
+ *  DF24setil:       - set interlace of image to write next
+ *  DF24setcompress: - set the compression to use when writing out next image
+ *  DF24restart:     - restart looking for 24-bit images in a file
+ *  DF24addimage:    - append image to file
+ *  DF24putimage:    - write image to a file
+ *  DF24readref:     - set ref of 24-bit RIG to get next
+ *  DF24lastref:     - return reference number of last RIG read or written
+ *  DF24nimages:     - get number of images in file
+ * Missing:
+ *  DF24writeref: set ref of 24-bit RIG to write next
+ *
+ * Remarks: A RIG specifies attributes associated with an image- lookup table,
+ *          dimension, compression, color compensation etc.
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfgr.h"
+
+static intn Newdata = 0;        /* does Readrig contain fresh data? */
+static intn dimsset = 0;        /* have dimensions been set? */
+static int32 last_xdim = 0;
+static int32 last_ydim = 0;     /* .....gheesh......... */
+
+#define LUT     0
+#define IMAGE   1
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24getdims -- get dimensions of next image RIG
+ USAGE
+    intn DF24getdims(filename,pxdim,pydim,pil)
+        char *filename;         IN: the file to get retrieve dims. from
+        int32 *pxdim,*pydim;    OUT: ptrs to the X&Y dims retrieved
+        intn *pil;              OUT: ptr to the interlace for the image
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Gets the next image's dimensions and interlace from the file specified.
+ GLOBAL VARIABLES
+    last_xdim, last_ydim, Newdata
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24getdims(const char *filename, int32 *pxdim, int32 *pydim, intn *pil)
+{
+  CONSTR(FUNC, "DF24getdims");
+  intn        ncomps;
+  intn       ret_value = SUCCEED;
+
+  do
+    {
+      if (DFGRIgetdims(filename, pxdim, pydim, &ncomps, pil, IMAGE) < 0)
+        HGOTO_ERROR(DFE_NODIM, FAIL);
+    }
+  while (ncomps != 3);
+
+  last_xdim = *pxdim;
+  last_ydim = *pydim;
+  Newdata = 1;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+
+  return ret_value;
+}   /* end DF24getdims() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24reqil -- get next image with specified interlace
+ USAGE
+    intn DF24reqil(il)
+        intn il;            IN: the interlace requested for the next image
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Requests that the next image be returned in a particular interlace scheme.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24reqil(intn il)
+{
+  intn ret_value;
+
+  ret_value = (DFGRIreqil(il, IMAGE));
+
+  return ret_value;
+}   /* end DF24reqil() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24getimage -- get image from next RIG
+ USAGE
+    intn DF24getimage(filename,image,xdim,ydim)
+        char *filename;     IN: file name to retrieve image from
+        void * image;        OUT: buffer to store image in
+        int32 xdim,ydim;    IN: dimensions of image buffer
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Retrieves the next 24-bit image from a file.  The image is stored
+    according to the current interlace scheme and is wedged into the upper
+    left corner of the buffer.
+ GLOBAL VARIABLES
+    Newdata, last_xdim, last_ydim
+ COMMENTS, BUGS, ASSUMPTIONS
+    image buffer is assumed to be 3*xdim*ydim bytes in size.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24getimage(const char *filename, void * image, int32 xdim, int32 ydim)
+{
+  CONSTR(FUNC, "DF24getimage");
+  intn        il;
+  int32       tx, ty;
+  int compressed, has_pal;
+  uint16 compr_type;
+  intn         ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!filename || !*filename || !image || (xdim <= 0) || (ydim <= 0))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if (!Newdata && DF24getdims(filename, &tx, &ty, &il) == FAIL)
+    HGOTO_ERROR(DFE_NODIM, FAIL);
+
+  if (Newdata)
+    {
+      tx = last_xdim;
+      ty = last_ydim;
+    }     /* end if */
+
+  if ((tx > xdim) || (ty > ydim))
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+  ret_value = DFGRIgetimlut(filename, image, xdim, ydim, IMAGE, 0,
+                            &compressed, &compr_type, &has_pal);
+
+  Newdata = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DF24getimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24setdims -- set dimensions of image to write next
+ USAGE
+    intn DF24setdims(xdim,ydim)
+        int32 xdim,ydim;    IN: the dimensions of the image to write next
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the dimensions of the next image to write to a file.
+ GLOBAL VARIABLES
+    dimsset
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24setdims(int32 xdim, int32 ydim)
+{
+  intn ret_value;
+
+  dimsset = 1;
+  ret_value = (DFGRIsetdims(xdim, ydim, 3, IMAGE));
+
+  return ret_value;
+}   /* end DF24setdims() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24setil -- set interlace of image to write next
+ USAGE
+    intn DF24setil(il)
+        intn il;            IN: the interlace of the image to write next
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the interlace of the next image to write to a file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24setil(intn il)
+{
+  intn ret_value;
+
+  ret_value = (DFGRIsetil(il, IMAGE));
+
+  return ret_value;
+}   /* end DF24setil() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24setcompress -- set compression scheme for next 24-bit image
+ USAGE
+    intn DF24setcompress(type,cinfo)
+        int32 type;         IN: compression scheme for next image
+        comp_info *cinfo;   IN: additional compression information for
+                                certain compression schemes (currently only
+                                JPEG)
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the compression scheme of the next image to write to a file.
+    A list of the different schemes may be found in the hcomp.h header
+    file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24setcompress(int32 type, comp_info * cinfo)
+{
+  intn ret_value;
+
+  ret_value = (DFGRsetcompress(type, cinfo));
+
+  return ret_value;
+}   /* end DF24setcompress() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24restart -- restart access to a file
+ USAGE
+    intn DF24restart(void)
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Restarts access to a file through the DF24 interface.  Next read/write
+    will start with the first 24-bit image in the file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24restart(void)
+{
+  intn ret_value;
+
+  ret_value = (DFGRIrestart());
+
+  return ret_value;
+}   /* end DF24restart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24addimage -- append 24-bit image to file
+ USAGE
+    intn DF24addimage(filename,image,xdim,ydim)
+        char *filename;     IN: name of HDF file to write to
+        void * image;        IN: Pointer to image data
+        int32 xdim,ydim;    IN: Dimensions of image to write
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Appends a 24-bit raster image to an HDF file.  Will create the file
+    if it doesn't exist.
+ GLOBAL VARIABLES
+    dimsset
+ COMMENTS, BUGS, ASSUMPTIONS
+    Array image is assumed to be xdim * ydim * 3 bytes
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24addimage(const char *filename, const void * image, int32 xdim, int32 ydim)
+{
+  CONSTR(FUNC, "DF24addimage");
+  intn ret_value = SUCCEED;
+
+  /* 0 == C */
+  if (!dimsset && DFGRIsetdims(xdim, ydim, 3, IMAGE) == FAIL)
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+  dimsset = 0;    /* reset to new rig */
+
+  ret_value = (DFGRIaddimlut(filename, image, xdim, ydim, IMAGE, 0, 0));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DF24addimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24putimage -- write 24-bit image to file
+ USAGE
+    intn DF24addimage(filename,image,xdim,ydim)
+        char *filename;     IN: name of HDF file to write to
+        void * image;        IN: Pointer to image data
+        int32 xdim,ydim;    IN: Dimensions of image to write
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Writes a 24-bit raster image to a new HDF file.  Will overwrite existing
+    files if they exist.
+ GLOBAL VARIABLES
+    dimsset
+ COMMENTS, BUGS, ASSUMPTIONS
+    Array image is assumed to be xdim * ydim * 3 bytes
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24putimage(const char *filename, const void * image, int32 xdim, int32 ydim)
+{
+  CONSTR(FUNC, "DF24putimage");
+  intn ret_value = SUCCEED;
+
+  /* 0 == C */
+  if (!dimsset && DFGRIsetdims(xdim, ydim, 3, IMAGE) == FAIL)
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+  dimsset = 0;    /* reset to new rig */
+
+  ret_value = (DFGRIaddimlut(filename, image, xdim, ydim, IMAGE, 0, 1));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DF24putimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24nimages -- determines number of 24-bit raster images in a file
+ USAGE
+    intn DF24nimages(filename)
+        char *filename;     IN: name of HDF file to check
+ RETURNS
+    Number of images on success, FAIL on failure.
+ DESCRIPTION
+    Determines the number of unique 24-bit raster images in a file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24nimages(const char *filename)
+{
+  CONSTR(FUNC, "DF24nimages");
+  int32       file_id;
+  int32       group_id;       /* group ID for looking at RIG's */
+  uint16      elt_tag, elt_ref;   /* tag/ref of items in a RIG */
+  intn        nimages;        /* total number of potential images */
+  uint16      find_tag, find_ref;     /* storage for tag/ref pairs found */
+  int32       find_off, find_len;     /* storage for offset/lengths of tag/refs found */
+  uint8       GRtbuf[64];     /* local buffer to read the ID element into */
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  /* should use reopen if same file as last time - more efficient */
+  if ((file_id = DFGRIopen(filename, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  /* go through the RIGs looking for 24-bit images */
+  nimages = 0;
+  find_tag = find_ref = 0;
+  while (Hfind(file_id, DFTAG_RIG, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+    {
+      /* read RIG into memory */
+      if ((group_id = DFdiread(file_id, DFTAG_RIG, find_ref)) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      while (!DFdiget(group_id, &elt_tag, &elt_ref))
+        {   /* get next tag/ref */
+          if (elt_tag == DFTAG_ID)
+            {     /* just look for ID tags to get the number of components */
+              if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
+                {
+                  uint16      uint16var;
+                  int32       temp;   /* temporary holding variable */
+                  int16       ncomponents;    /* number of image components */
+                  uint8      *p;
+
+                  p = GRtbuf;
+                  INT32DECODE(p, temp);
+                  INT32DECODE(p, temp);
+                  UINT16DECODE(p, uint16var);
+                  UINT16DECODE(p, uint16var);
+                  INT16DECODE(p, ncomponents);
+                  if (ncomponents == 3)   /* whew, all that work and we finally found a 24-bit image */
+                    nimages++;
+                }   /* end if */
+              else	{
+              	DFdifree(group_id);
+                HGOTO_ERROR(DFE_GETELEM, FAIL);
+              }
+            }     /* end if */
+        }   /* end while */
+    }     /* end while */
+
+  if (Hclose(file_id) == FAIL)
+    HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+
+  ret_value = nimages;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+    /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DF24nimages() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24readref -- set ref # of 24-bit RIG to read next
+ USAGE
+    intn DF24readref(filename,ref)
+        char *filename;     IN: name of HDF file
+        uint16 ref;         IN: ref # of next 24-bit RIG to read
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the ref # of the next 24-bit RIG to read from a file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DF24readref(const char *filename, uint16 ref)
+{
+  intn ret_value;
+
+  ret_value = (DFGRreadref(filename, ref));
+
+  return ret_value;
+}   /* end DF24readref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DF24lastref -- return ref # of last read/written 24-bit RIG
+ USAGE
+    uint16 DF24lastref(void)
+ RETURNS
+    Last ref # on success, 0 on failure.
+ DESCRIPTION
+    Returns the last ref # of a 24-bit RIG read to or written from a file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+uint16
+DF24lastref(void)
+{
+  uint16 ret_value;
+
+  ret_value = (DFGRIlastref());
+
+  return ret_value;
+}   /* end DF24lastref() */
diff --git a/hdf/src/df24f.c b/hdf/src/df24f.c
new file mode 100644
index 0000000..a2b7cbb
--- /dev/null
+++ b/hdf/src/df24f.c
@@ -0,0 +1,437 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: df24f.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     df24F.c
+ * Purpose:  read and write 24-bit raster images
+ * Invokes:  dfgr.c df24.c
+ * Contents:
+ *  d2reqil: use this interlace when returning image
+ *  df24reqil: use this interlace when returning image
+ *  d2sdims: set dimensions of image
+ *  df24setdims: set dimensions of image
+ *  d2setil: set interlace for image
+ *  df24setil: set interlace for image
+ *  d2first: restart 24 bit raster
+ *  df24restart: restart 24 bit raster
+ *  d2igdim: get dimensions of image
+ *  d2igimg: read in image
+ *  d2iaimg: write out image
+ *  d2lref: last ref number
+ *  d2scomp: set compression to use (short name)
+ *  df24setcompress: set compression to use (long name)
+ *  d2sjpeg:  set JPEG parameters (short name)
+ *  df24setJPEG: set JPEG parameters (long name)
+ *
+ * Remarks:A RIG specifies attributes associated with an image - lookup table,
+ *          dimension, compression, color compensation etc.
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfgr.h"
+#include "hproto_fortran.h"
+
+#define LUT     0
+#define IMAGE   1
+
+static int  dimsset = 0;
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2reqil
+ * Purpose: get next image with specified interlace
+ * Inputs:  il: interlace to get next image with
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIreqil
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2reqil(intf * il)
+{
+    return (DFGRIreqil((intn) *il, (intn) IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2sdims
+ * Purpose: set dimensions of image to write next
+ * Inputs:  xdim, ydim: dimensions of image
+ *          il: interlace of image
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIsetdims
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2sdims(intf * xdim, intf * ydim)
+{
+    dimsset = 1;
+    return (DFGRIsetdims(*xdim, *ydim, 3, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2igdim
+ * Purpose: get dimensions of next image RIG
+ * Inputs:  filename: name of HDF file
+ *          pxdim, pydim: pointer to locations for returning x,y dimensions
+ *          pil: location for returning interlace of image in file
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ *          *pxdim, *pydim, *pil set on success
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DF24getdims
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2igdim(_fcd filename, intf * pxdim, intf * pydim, intf * pil, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DF24getdims(fn, (int32 *) pxdim, (int32 *) pydim, (intn *) pil);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2igimg
+ * Purpose: get image from next RIG
+ * Inputs:  filename: name of HDF file
+ *          image: pointer to space to return image
+ *          xdim, ydim: dimensions of space to return image
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIgetimlut
+ * Remarks: space is assumed to be xdim * ydim * 3 bytes
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2igimg(_fcd filename, _fcd image, intf * xdim, intf * ydim, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DF24getimage(fn, (VOIDP) _fcdtocp(image), *xdim, *ydim);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2iaimg
+ * Purpose: Write out image
+ * Inputs:  filename: name of HDF file
+ *          image: image to write
+ *          xdim, ydim: dimensions of array image
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIaddimlut
+ * Remarks: array image is assumed to be xdim * ydim * ncomps bytes
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2iaimg(_fcd filename, _fcd image, intf * xdim, intf * ydim, intf * fnlen,
+         intf * newfile)
+{
+    char       *fn;
+    intf        ret;
+
+    if (!dimsset)
+        if (DFGRIsetdims(*xdim, *ydim, 3, IMAGE) < 0)
+            return (-1);
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFGRIaddimlut(fn, (VOIDP) _fcdtocp(image), *xdim, *ydim,
+                        IMAGE, 1, (intn) *newfile);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2setil
+ * Purpose: set interlace store with following images
+ * Inputs:  il: interlace to set
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIsetil
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2setil(intf * il)
+{
+    return (DFGRIsetil((intn) *il, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2first
+ * Purpose: restart 24 bit raster file
+ * Inputs:
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIrestart
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2first(void)
+{
+    return (DFGRIrestart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2lref
+ * Purpose: return last reference number
+ * Inputs:
+ * Returns: last ref number
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIrestart
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2lref(void)
+{
+    return ((intf)DFGRIlastref());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2scomp
+ * Purpose: set the compression to use when writing the next image
+ * Inputs:
+ *      scheme - the type of compression to use
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DF24setcompress
+ * Remarks: if the compression scheme is JPEG, this routine sets up default
+ *          JPEG parameters to use, if a user wants to change them, d2sjpeg
+ *          must be called.
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2scomp(intf * scheme)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    if (*scheme == COMP_JPEG)
+      {     /* check for JPEG compression and set defaults */
+          cinfo.jpeg.quality = 75;
+          cinfo.jpeg.force_baseline = 1;
+      }     /* end if */
+    return (DF24setcompress((int32) *scheme, &cinfo));
+}   /* end d2scomp() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2sjpeg
+ * Purpose: change the JPEG compression parameters
+ * Inputs:
+ *      quality - what the JPEG quality rating should be
+ *      force_baseline - whether to force a JPEG baseline file to be written
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DF24setcompress
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2sjpeg(intf * quality, intf * force_baseline)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    cinfo.jpeg.quality = (intn) *quality;
+    cinfo.jpeg.force_baseline = (intn) *force_baseline;
+    return (DF24setcompress((int32) COMP_JPEG, &cinfo));
+}   /* end d2sjpeg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    df24reqil
+ * Purpose: get next image with specified interlace
+ * Inputs:  il: interlace to get next image with
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIreqil
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndf24reqil(intf * il)
+{
+    return (DFGRIreqil((intn) *il, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    df24setdims
+ * Purpose: set dimensions of image to write next
+ * Inputs:  xdim, ydim: dimensions of image
+ *          il: interlace of image
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIsetdims
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndf24setdims(intf * xdim, intf * ydim)
+{
+    dimsset = 1;
+    return (DFGRIsetdims(*xdim, *ydim, 3, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    df24setil
+ * Purpose: set interlace store with following images
+ * Inputs:  il: interlace to set
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIsetil
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndf24setil(intf * il)
+{
+    return (DFGRIsetil((intn) *il, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    df24restart
+ * Purpose: restart 24 bit raster file
+ * Inputs:
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIrestart
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndf24restart(void)
+{
+    return (DFGRIrestart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    df24scompress
+ * Purpose: set the compression to use when writing the next image
+ * Inputs:
+ *      scheme - the type of compression to use
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DF24setcompress
+ * Remarks: if the compression scheme is JPEG, this routine sets up default
+ *          JPEG parameters to use, if a user wants to change them, df24setjpeg
+ *          must be called.
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndf24scompress(intf * scheme)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    if (*scheme == COMP_JPEG)
+      {     /* check for JPEG compression and set defaults */
+          cinfo.jpeg.quality = 75;
+          cinfo.jpeg.force_baseline = 1;
+      }     /* end if */
+    return (DF24setcompress((int32) *scheme, &cinfo));
+}   /* end df24setcompress() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    df24sjpeg
+ * Purpose: change the JPEG compression parameters
+ * Inputs:
+ *      quality - what the JPEG quality rating should be
+ *      force_baseline - whether to force a JPEG baseline file to be written
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DF24setcompress
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndf24sjpeg(intf * quality, intf * force_baseline)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    cinfo.jpeg.quality = (intn) *quality;
+    cinfo.jpeg.force_baseline = (intn) *force_baseline;
+    return (DF24setcompress((int32) COMP_JPEG, &cinfo));
+}   /* end df24setjpeg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2irref
+ * Purpose: Internal stub for setting ref of rig to read next
+ * Inputs:  filename: name of HDF file
+ *          ref: reference
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRreadref
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2irref(_fcd filename, intf * ref, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFGRreadref(fn, (uint16) *ref);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d2inimg
+ * Purpose: Internal stub for getting the number of 24-bit raster images
+ * Inputs:  filename: name of HDF file
+ *          fnlen: length of filename
+ * Returns: # of images on success, -1 on failure with error stack set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DF24nimages
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd2inimg(_fcd filename, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DF24nimages(fn);
+    HDfree((VOIDP) fn);
+    return (ret);
+} /* end nd2inimg */
+
diff --git a/hdf/src/df24ff.f b/hdf/src/df24ff.f
new file mode 100644
index 0000000..40db708
--- /dev/null
+++ b/hdf/src/df24ff.f
@@ -0,0 +1,241 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: df24ff.f 6034 2014-01-19 06:59:14Z epourmal $
+C
+C------------------------------------------------------------------------------
+C File:     df24Ff.f
+C Purpose:  read and write 24-bit raster images
+C Invokes:  df24F.c
+C Contents: 
+C   d2gdims:      - get dimensions of image
+C   d2gimg:       - read in image
+C   d2aimg:       - write out image
+C   d2rref:       - set reference number to be used for next get
+C   DF24getdims:  - get dimensions of image
+C   DF24getimage: - read in image
+C   DF24getimage: - write out image
+C   DF24readref:  - set reference number to be used for next get
+C
+C Remarks:  A RIG specifies attributes associated with an image - lookup table, 
+C           dimension, compression, color compensation etc.
+C----------------------------------------------------------------------------*/
+
+
+
+C------------------------------------------------------------------------------
+C Name: d2gdims
+C Purpose:  get dimensions of next image RIG
+C Inputs:   name: name of HDF file
+C           xdim, ydim: locations for returning x,y dimensions
+C           il: location for returning interlace of image in file
+C Returns: 0 on success, -1 on failure with DFerror set
+C           *pxdim, *pydim, *pil set on success
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2igdim
+C Remarks: none
+C----------------------------------------------------------------------------*/
+
+      integer function d2gdims(name, xdim, ydim, il)
+      character*(*) name
+      integer xdim, ydim, il, d2igdim
+
+      d2gdims = d2igdim(name, xdim, ydim, il, len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name: d2gimg
+C Purpose:  get image from next RIG
+C Inputs:   name: name of HDF file
+C           image: pointer to space to return image
+C           xdim, ydim: dimensions of space to return image
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2igimg
+C Remarks: space is assumed to be xdim * ydim * 3 bytes
+C----------------------------------------------------------------------------*/
+
+      integer function d2gimg(name, image, xdim, ydim)
+      character*(*) name, image
+      integer xdim, ydim, d2igimg
+
+      d2gimg = d2igimg(name, image, xdim, ydim, len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name: d2aimg
+C Purpose:  Write out image
+C Inputs:   filename: name of HDF file
+C           image: image to write
+C           xdim, ydim: dimensions of array image
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2iaimg
+C Remarks: array image is assumed to be xdim * ydim * ncomps bytes
+C----------------------------------------------------------------------------*/
+
+      integer function d2aimg(name, image, xdim, ydim)
+      character*(*) name, image
+      integer xdim, ydim, d2iaimg
+
+      d2aimg = d2iaimg(name, image, xdim, ydim, len(name), 0)
+      return
+      end
+
+      integer function d2pimg(name, image, xdim, ydim)
+      character*(*) name, image
+      integer xdim, ydim, d2iaimg
+
+      d2pimg = d2iaimg(name, image, xdim, ydim, len(name), 1)
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: d2rref
+C Purpose:  
+C Inputs:   filename: name of HDF file
+C           ref:      reference number to be used for next get
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2irref
+C Remarks: 
+C----------------------------------------------------------------------------*/
+
+      integer function d2rref(name, ref)
+      character*(*) name
+      integer ref, d2irref
+
+      d2rref = d2irref(name, ref, len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name: d2nimg
+C Purpose:  Determine the number of 24-bit raster images in a file.
+C Inputs:   filename: name of HDF file
+C Returns: # of images on success, -1 on failure with error stack set
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2inimg
+C Remarks: 
+C----------------------------------------------------------------------------*/
+
+      integer function d2nimg(name)
+      character*(*) name
+      integer d2inimg
+
+      d2nimg = d2inimg(name, len(name))
+      return
+      end
+
+
+CEND7MAX
+
+
+C------------------------------------------------------------------------------
+C Name: df24getdims
+C Purpose:  get dimensions of next image RIG
+C Inputs:   name: name of HDF file
+C           xdim, ydim: locations for returning x,y dimensions
+C           il: location for returning interlace of image in file
+C Returns: 0 on success, -1 on failure with DFerror set
+C           *pxdim, *pydim, *pil set on success
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2igdim
+C Remarks: none
+C----------------------------------------------------------------------------*/
+
+      integer function df24getdims(name, xdim, ydim, il)
+      character*(*) name
+      integer xdim, ydim, il, d2igdim
+
+      df24getdims = d2igdim(name, xdim, ydim, il, len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name: df24getimage
+C Purpose:  get image from next RIG
+C Inputs:   name: name of HDF file
+C           image: pointer to space to return image
+C           xdim, ydim: dimensions of space to return image
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2igimg
+C Remarks: space is assumed to be xdim * ydim * 3 bytes
+C----------------------------------------------------------------------------*/
+
+      integer function df24getimage(name, image, xdim, ydim)
+      character*(*) name, image
+      integer xdim, ydim, d2igimg
+
+      df24getimage = d2igimg(name, image, xdim, ydim, len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name: df24addimage
+C Purpose:  Write out image
+C Inputs:   filename: name of HDF file
+C           image: image to write
+C           xdim, ydim: dimensions of array image
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2iaimg
+C Remarks: array image is assumed to be xdim * ydim * ncomps bytes
+C----------------------------------------------------------------------------*/
+
+      integer function df24addimage(name, image, xdim, ydim)
+      character*(*) name, image
+      integer xdim, ydim, d2iaimg
+
+      df24addimage = d2iaimg(name, image, xdim, ydim, len(name), 0)
+      return
+      end
+
+      integer function df24putimage(name, image, xdim, ydim)
+      character*(*) name, image
+      integer xdim, ydim, d2iaimg
+
+      df24putimage = d2iaimg(name, image, xdim, ydim, len(name), 1)
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name: df24readref
+C Purpose:  Write out image
+C Inputs:   filename: name of HDF file
+C           ref:      reference number to be used for next get
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF HLL (high-level library) users, utilities, other routines
+C Invokes: d2irref
+C Remarks: array image is assumed to be xdim * ydim * ncomps bytes
+C----------------------------------------------------------------------------*/
+
+      integer function df24readref(name, ref)
+      character*(*) name
+      integer ref, d2irref
+
+      df24readref = d2irref(name, ref, len(name))
+      return
+      end
+
+
+
diff --git a/hdf/src/dfan.c b/hdf/src/dfan.c
new file mode 100644
index 0000000..5de6e82
--- /dev/null
+++ b/hdf/src/dfan.c
@@ -0,0 +1,1742 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5322 $";
+#endif
+
+/* $Id: dfan.c 5322 2010-01-19 06:26:11Z brtnfld $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     dfan.c
+ * Purpose:  read and write annotations: labels and descriptions of data items
+ * Invokes:  df.c
+ * Contents:
+ *
+ *  DFANclear:      - reset DFAN interface
+ *  DFANgetlablen:  - get length of label of tag/ref
+ *  DFANgetlabel:   - get label of tag/ref
+ *  DFANgetdesclen: - get length of description of tag/ref
+ *  DFANgetdesc:    - get description of tag/ref
+ *
+ *  DFANgetfidlen:  - get length of file ID
+ *  DFANgetfid:     - get file ID
+ *  DFANgetfdslen:  - get length of file description
+ *  DFANgetfds:     - get file description
+ *
+ *  DFANputlabel:   - put label of tag/ref
+ *  DFANputdesc:    - put description of tag/ref
+ *
+ *  DFANaddfid:     - add file ID
+ *  DFANaddfds:     - add file description
+ *
+ *  DFANlastref:    - return ref of last annotation read or written
+ *  DFANlablist:    - get list of labels for a particular tag
+ *
+ *  DFANIclear:     - clear Lastref, label/desc entries and directories
+ *  DFANIopen:      - open/reopen file
+ *  DFANIlocate:    - return ref of label/desc of tag/ref
+ *  DFANIaddentry:  - add entry in annotation directory
+ *  DFANIgetannlen: - get length of annotation of tag/ref
+ *  DFANIgetann:    - get annotation of tag/ref
+ *  DFANIputann:    - put annotation of tag/ref
+ *  DFANIlablist:   - get list of labels for a particular tag
+ *
+ *  DFANIaddfann:   - add file annotation (ID or description)
+ *  DFANIgetfannlen: - get length of file annotation
+ *  DFANIgetfann:    - get file annotation
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfan.h"
+PRIVATE uint16 Lastref = 0;     /* Last ref read/written */
+PRIVATE uint16 Next_label_ref = 0;  /* Next file label ref to read/write */
+PRIVATE uint16 Next_desc_ref = 0;   /* Next file desc ref to read/write */
+
+#if 0
+static char Lastfile[DF_MAXFNLEN] = "";     /* last file opened */
+#endif
+PRIVATE char *Lastfile = NULL;
+
+/* pointers to directories of object annotations */
+PRIVATE DFANdirhead *DFANdir[2] =
+{NULL,                          /* object labels       */
+ NULL                           /* object descriptions */
+};
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+/*
+   ** Prototypes for local functions
+ */
+
+PRIVATE int32 DFANIopen(const char *filename, intn acc_mode);
+PRIVATE intn DFANIstart(void);
+
+/*-----------------------------------------------------------------------------
+ * HDF object (i.e. tag/ref) label and description input routines
+ *---------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFANgetlablen -- get length of label of tag/ref
+ USAGE
+       int32 DFANgetlablen(filename, tag, ref)
+       char *filename;     IN: filename: name of HDF file
+       uint16 tag;         IN: tag of data object assigned the label
+       uint16 ref;         IN: reference number of the data object assigned
+                               the label
+ RETURNS
+       length of label on success, FAIL (-1) otherwise
+ DESCRIPTION
+       Calls DFANIgetannlen to get label length.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       This routine should be used to insure that there is enough space
+       allocated for a label before actually reading it.
+ EXAMPLES
+ REVISION LOG
+ *---------------------------------------------------------------------------*/
+int32
+DFANgetlablen(const char *filename, uint16 tag, uint16 ref)
+{
+  int32 ret_value;
+
+  ret_value = (DFANIgetannlen(filename, tag, ref, DFAN_LABEL));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANgetlabel -- get label of object identified by tag/ref
+ USAGE
+       int DFANgetlabel(filename, tag, ref, label, maxlen)
+       char *filename;   IN: name of HDF file
+       uint16 tag;       IN: tag of object of assigned the label
+       uint16 ref;       IN: ref number of object of assigned the label
+       char *label;      OUT: buffer allocated to hold the label
+       int32 maxlen;     IN: size of buffer allocated to hold the label
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIgetann to get label
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       The value of maxlen must be at least one greater than the
+       anticipated length of the label, because a NULL byte is appended
+       to the annotation
+ EXAMPLES
+ REVISION LOG
+ *---------------------------------------------------------------------------*/
+intn
+DFANgetlabel(const char *filename, uint16 tag, uint16 ref, char *label,
+             int32 maxlen)
+{
+  intn ret_value;
+
+  ret_value = (DFANIgetann(filename, tag, ref, (uint8 *) label, maxlen, DFAN_LABEL, 0));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANgetdesclen -- get length of description of tag/ref
+ USAGE
+       int32 DFANgetdesclen(filename, tag, ref)
+       char *filename;  IN: name of HDF file
+       uint16 tag;      IN: tag of item of which we want description
+       uint16 ref;      IN: ref number of item of which we want description
+ RETURNS
+       Length of description if successful, and FAIL (-1) otherwise
+ DESCRIPTION
+       Calls DFANIgetannlen to get description length
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       This routine should be used to insure that there is enough space
+       allocated for a description before actually reading it.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+int32
+DFANgetdesclen(const char *filename, uint16 tag, uint16 ref)
+{
+  int32 ret_value;
+
+  ret_value = (DFANIgetannlen(filename, tag, ref, DFAN_DESC));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANgetdesc -- Reads the description assigned to the data object
+                      with the given tag and reference number.
+ USAGE
+       int DFANgetdesc(filename, tag, ref, desc, maxlen)
+       char * filename; IN: name of HDF file
+       uint16 tag;      IN: tag of object of assigned the label
+       uint16 ref;      IN: ref number of object of assigned the label
+       char *desc;      OUT: buffer allocated to hold the description
+       int32 maxlen;    IN: size of buffer allocated to hold the description
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIgetann to get description
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       The value of maxlen must be at least one greater than the
+       anticipated length of the description, because a NULL byte is
+       appended to the annotation
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+
+intn
+DFANgetdesc(const char *filename, uint16 tag, uint16 ref, char *desc,
+            int32 maxlen)
+{
+  intn ret_value;
+
+  ret_value = (DFANIgetann(filename, tag, ref, (uint8 *) desc, maxlen, DFAN_DESC, 0));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * File ID and description input routines
+ *---------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANgetfidlen -- get length of file label
+ USAGE
+       int32 DFANgetfidlen(file_id, isfirst)
+       int32 file_id;    IN: HDF file label returned by Hopen
+       int isfirst;      IN: 1 to read the first label in the file
+                             0 to read the next label in the file
+ RETURNS
+       Length of file label if successful, and FAIL (-1) otherwise
+ DESCRIPTION
+       Calls DFANIgetfannlen to get label length
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       When first called for a given file, DFANgetfidlen returns the
+       length of the first file label.  In order to get the lengths
+       of successive labels, you must call DFANgetfid between calls
+       to DFANgetfidlen.  Otherwise, successive calls to DFANgetfidlen
+       will return the length of the same file label.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+int32
+DFANgetfidlen(int32 file_id, int isfirst)
+{
+  int32 ret_value;
+
+  ret_value = (DFANIgetfannlen(file_id, DFAN_LABEL, isfirst));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANgetfid -- get next file label
+ USAGE
+       int32 DFANgetfid(file_id, label, maxlen, isfirst)
+       int32 file_id;   IN: HDF file label returned by Hopen
+       char *label;     OUT: buffer allocated to hold the label
+       int32 maxlen;    IN: size of buffer allocated to hold the label
+       int isfirst;     IN: 0 to read the next label in the file;
+                            1 to read the first label in the file
+ RETURNS
+       On success, length of label; FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIgetfann to get label
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       If maxlen is not great enough, the label is truncated to
+       maxlen-1 characters.
+ EXAMPLES
+ REVISION LOG
+ *---------------------------------------------------------------------------*/
+int32
+DFANgetfid(int32 file_id, char *label, int32 maxlen, intn isfirst)
+{
+  int32 ret_value;
+
+  ret_value = (DFANIgetfann(file_id, label, maxlen, DFAN_LABEL, isfirst));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANgetfdslen -- get length of file description
+ USAGE
+       int32 DFANgetfdslen(file_id, isfirst)
+       int32 file_id;    IN: HDF file description returned by Hopen
+       int isfirst;      IN: 1 to read the first description in the file
+                             0 to read the next description in the file
+ RETURNS
+       Length of file description if successful, and FAIL (-1) otherwise
+ DESCRIPTION
+       Calls DFANIgetfannlen to get description length
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       When first called for a given file, DFANgetfdslen returns the
+       length of the first file description.  In order to get the lengths
+       of successive descriptions, you must call DFANgetfds between calls
+       to DFANgetfdslen.  Otherwise, successive calls to DFANgetfdslen
+       will return the length of the same file description.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+int32
+DFANgetfdslen(int32 file_id, intn isfirst)
+{
+  int32 ret_value;
+
+  ret_value = (DFANIgetfannlen(file_id, DFAN_DESC, isfirst));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANgetfds -- get next file description
+ USAGE
+       int32 DFANgetfds(file_id, desc, maxlen, isfirst)
+       int32 file_id;  IN: HDF file description returned by Hopen
+       char *desc;     OUT: buffer allocated to hold the description
+       int32 maxlen;   IN: size of buffer allocated to hold the description
+       int isfirst;    IN: 0 to read the next description in the file;
+                           1 to read the first description in the file
+ RETURNS
+       On success, length of description; FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIgetfann to get description
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       If maxlen is not great enough, the description is truncated to
+       maxlen-1 characters.
+ EXAMPLES
+ REVISION LOG
+ *---------------------------------------------------------------------------*/
+int32
+DFANgetfds(int32 file_id, char *desc, int32 maxlen, intn isfirst)
+{
+  int32 ret_value;
+
+  ret_value = (DFANIgetfann(file_id, desc, maxlen, DFAN_DESC, isfirst));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * HDF object (i.e. tag/ref) label and description output routines
+ *---------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANputlabel -- Assign a label to the data object with the given
+                       tag and reference number
+ USAGE
+       int DFANputlabel(filename, tag, ref, label)
+       char *filename;  IN: name of HDF file
+       uint16 tag;      IN: tag of item to be assigned the label
+       uint16 ref;      IN: reference number of item to be assigned the label
+       char *label;     IN: label to write to file; a single string of
+                            NULL-terminated text
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIgetfann to write out label
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+intn
+DFANputlabel(const char *filename, uint16 tag, uint16 ref, char *label)
+{
+  intn ret_value;
+
+  ret_value = (DFANIputann(filename, tag, ref, (uint8 *) label,
+                           (int32) HDstrlen(label), DFAN_LABEL));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANputdesc -- Assign a description to the data object with the given
+                      tag and reference number
+ USAGE
+       int DFANputdesc(filename, tag, ref, desc, desclen)
+       char *filename;   IN: name of HDF file
+       uint16 tag;       IN: tag of item to be assigned the description
+       uint16 ref;       IN: ref number of item to be assigned description
+       char *desc;       IN: description to write to file; a single string
+                             of NULL-terminated text
+       int32 desclen;  IN: length of description
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIgetfann to write out description
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       The parameter desc can contain any sequence of ASCII characters.
+       It does not have to be a string.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+intn
+DFANputdesc(const char *filename, uint16 tag, uint16 ref, char *desc,
+            int32 desclen)
+{
+  intn ret_value;
+
+  ret_value = (DFANIputann(filename, tag, ref, (uint8 *) desc, desclen, DFAN_DESC));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * File ID and description output routines
+ *---------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANaddfid -- Write a file label to a file
+ USAGE
+       int DFANaddfid(file_id, id)
+       int32 file_id;   IN: file identifier
+       char *id;        IN: label to write to file
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIaddfann to write out label
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+intn
+DFANaddfid(int32 file_id, char *id)
+{
+  intn ret_value;
+
+  ret_value = (DFANIaddfann(file_id, id, (int32) HDstrlen(id), DFAN_LABEL));
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANaddfds -- Write a file description to a file
+ USAGE
+       int DFANaddfds(file_id, desc, desclen)
+       int32 file_id;   IN: file identifier
+       char *desc;      IN: description to write to file
+       int32 desclen;   IN: length of description
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIaddfann to write out description
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+       The parameter desc can contain any sequence of ASCII characters.
+       It does not have to be a string.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+intn
+DFANaddfds(int32 file_id, char *desc, int32 desclen)
+{
+  intn ret_value;
+
+  ret_value = (DFANIaddfann(file_id, desc, desclen, DFAN_DESC));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Miscellaneous other routines
+ *---------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANlastref -- Return the reference number of the annotation last
+                      written or read
+ USAGE
+       uint16 DFANlastref()
+ RETURNS
+       Reference number if successful and 0 otherwise
+ DESCRIPTION
+ GLOBAL VARIABLES
+       Lastref
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+uint16
+DFANlastref(void)
+{
+  uint16 ret_value;
+
+  ret_value = (Lastref);
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANlablist -- Return list of refs and labels for a given tag
+ USAGE
+       int DFANlablist(filename, tag, reflist, labellist,
+                                                listsize, maxlen, startpos)
+       char *filename;   IN: name of HDF file
+       uint16 tag;       IN: tag to use when searching for ref numbers
+                             and labels
+       uint16 reflist[]; OUT: array allocated to place ref numbers in
+       char *labellist;  OUT: array of strings allocated to place labels in
+       int listsize;     IN: size of ref number list and label list
+       int maxlen;       IN: maximum length allocated for label
+       int startpos;     IN: Starting position.  Beginning from the
+                             startpos'th entry, up to listsize entries
+                             will be returned.
+ RETURNS
+       Number of ref numbers found if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Invokes DFANIlablist to get label list.
+       Where there is no corresponding label, the position in
+       labellist is zero filled (C) or blank filled (Fortran).
+       Revised 04/17/90 so that it returns all ref numbers for
+       the given tag, rather than just those that have labels.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+       Revised 04/17/90.  (See DESCRIPTION.)
+ *------------------------------------------------------------------------*/
+intn
+DFANlablist(const char *filename, uint16 tag, uint16 reflist[], char *labellist,
+            intn listsize, intn maxlen, intn startpos)
+{
+  intn ret_value;
+
+  ret_value = (DFANIlablist(filename, tag, reflist, (uint8 *) labellist,
+                            listsize, maxlen, startpos, 0));
+  return ret_value;
+}
+
+/*-------------------------------------------------------------------
+ Name
+        DFANclear --  Clear DFAN interface
+ Usage
+        intn DFANclear()
+ Returns
+        SUCCEED if ok; FAIL otherwise.
+ DESCRIPTION
+        Invokes DFANIclear.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+        When a file is re-created in a single run by other
+          interface, such as DFSDputdata(), user should
+          call DFANclear to reset DFAN interface structures.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------*/
+intn DFANclear(void)
+{
+  intn ret_value;
+
+  ret_value = DFANIclear();
+
+  return ret_value;
+}
+
+/******************************************************************************/
+/*----------------------- Internal routines ---------------------------------*/
+/******************************************************************************/
+
+/*---------------------------------------------------------------------------
+ Name
+       DFANIclear -- Clear label/desc entries and directories
+          Reset DFANdir[i] and Lastref
+ USAGE
+       intn DFANIclear()
+ Returns
+       SUCCEED if ok; FAIL otherwise.
+ DESCRIPTION
+       Reset DFANdir[i] and Lastref
+ GLOBAL VARIABLES
+        Lastref, DFANdir
+ COMMENTS, BUGS, ASSUMPTIONS
+
+ EXAMPLES
+ REVISION LOG
+
+ *-------------------------------------------------------------------------*/
+intn
+DFANIclear(void)
+{
+    CONSTR(FUNC, "DFANIclear");
+  DFANdirhead *p, *q;
+  intn ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  for (p=DFANdir[0]; p!=NULL; p=q) {  /* free linked list space */
+    q = p->next;
+    if (p->entries != NULL)
+	    HDfree((VOIDP) p->entries);
+    p->nentries=0;
+    p->entries = NULL;
+    p->next=NULL;
+    HDfree((VOIDP) p);
+  }
+  for (p=DFANdir[1]; p!=NULL; p=q) {
+    q = p->next;
+    if (p->entries != NULL)
+	    HDfree((VOIDP) p->entries);
+    p->nentries=0;
+    p->entries = NULL;
+    p->next=NULL;
+    HDfree((VOIDP) p);
+  }
+  DFANdir[0] = DFANdir[1] = NULL;
+
+  Lastref = 0; /* 0 is invalid ref */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIopen -- open or reopen a file
+ USAGE
+       PRIVATE int32 DFANIopen(filename, acc_mode)
+       char *filename;  IN: name of file to open
+       intn acc_mode;     IN: access mode
+ RETURNS
+       File identifier if successful and NULL on failure.
+ DESCRIPTION
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+        This is a hook for someday providing more efficient ways to
+        reopen a file, to avoid re-reading all the headers
+
+ EXAMPLES
+ REVISION LOG
+
+ *------------------------------------------------------------------------*/
+PRIVATE int32
+DFANIopen(const char *filename, intn acc_mode)
+{
+  CONSTR(FUNC, "DFANIopen");
+  int32       file_id;
+  DFANdirhead *p, *q;
+  int32      ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Check if filename buffer has been allocated */
+  if (Lastfile == NULL)
+    {
+      Lastfile = (char *) HDmalloc((DF_MAXFNLEN + 1) * sizeof(char));
+      if (Lastfile == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      *Lastfile = '\0';     /* initialize with 0-length string */
+    }
+
+  /* use reopen if same file as last time - more efficient */
+  if (HDstrncmp(Lastfile, filename, DF_MAXFNLEN) || (acc_mode == DFACC_CREATE))
+    {
+      /* treat create as different file */
+      if (( file_id = Hopen(filename, acc_mode, 0))== FAIL)
+          HGOTO_ERROR(DFE_BADOPEN,FAIL);
+
+      for (p = DFANdir[0]; p != NULL; p = q)
+        {   /* free linked list space */
+          q = p->next;
+	    if (p->entries != NULL)
+		    HDfree((VOIDP) p->entries);
+	    p->nentries=0;
+	    p->entries = NULL;
+	    p->next=NULL;
+          HDfree((VOIDP) p);
+        }
+      for (p = DFANdir[1]; p != NULL; p = q)
+        {
+          q = p->next;
+	    if (p->entries != NULL)
+		    HDfree((VOIDP) p->entries);
+	    p->nentries=0;
+	    p->entries = NULL;
+	    p->next=NULL;
+          HDfree((VOIDP) p);
+        }
+      DFANdir[0] = DFANdir[1] = NULL;
+    }
+  else
+    {
+      if (( file_id = Hopen(filename, acc_mode, 0))== FAIL)
+          HGOTO_ERROR(DFE_BADOPEN,FAIL);
+    }
+
+  HIstrncpy(Lastfile, filename, DF_MAXFNLEN);
+  /* remember filename, so reopen may be used next time if same file */
+
+  ret_value = file_id;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIlocate -- get ref of annotation of given data tag/ref
+ USAGE
+       uint16 DFANIlocate(file_id, type, tag, ref)
+       int32 file_id:   IN: pointer to HDF file
+       int type:        IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+       uint16 tag, ref: IN: tag/ref of item for which we want ref of
+                            annotation
+
+ RETURNS
+        ref of annotation on if successful; 0 otherwise
+ DESCRIPTION
+       Searches through directory for annotations with given tag/ref.  (If
+       there is no directory, it creates one.)
+
+ GLOBAL VARIABLES
+
+ COMMENTS, BUGS, ASSUMPTIONS
+       BUG: When FORTRAN calls this routine with type "label", the string
+       returned is incorrect in length by one character
+ EXAMPLES
+
+ REVISION LOG
+
+ *------------------------------------------------------------------------*/
+uint16
+DFANIlocate(int32 file_id, int type, uint16 tag, uint16 ref)
+{
+  CONSTR(FUNC, "DFANIlocate");
+  uint8       datadi[4];
+  int32       more_anns;
+  int32       aid;
+  int32       nanns, i;
+  uint16      anntag, annref = 0;
+  DFANdirhead *p;
+  uint8      *ptr;
+  uint16     ret_value = 0; /* FAIL ? */
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, (uint16)FAIL);
+
+  anntag = (uint16) ((type == DFAN_LABEL) ? DFTAG_DIL : DFTAG_DIA);
+
+  /* if no directory for this type of annotation, make one */
+  if (DFANdir[type] == NULL)
+    {
+      nanns = Hnumber(file_id, anntag);
+      if (nanns == 0)
+        HGOTO_ERROR(DFE_INTERNAL, 0);
+
+      /* allocate directory space, and space for entries. */
+      DFANdir[type] = (DFANdirhead *) HDmalloc((uint32) sizeof(DFANdirhead));
+      if (DFANdir[type] == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, 0);
+      DFANdir[type]->entries = (DFANdirentry *)
+        HDmalloc( (size_t)nanns * sizeof(DFANdirentry));
+      if (DFANdir[type]->entries == NULL) 
+        HGOTO_ERROR(DFE_NOSPACE, 0);
+
+      DFANdir[type]->next = NULL;
+      DFANdir[type]->nentries = nanns;
+
+      /* fill directory table */
+      if (( aid = Hstartread(file_id, anntag, DFREF_WILDCARD))== FAIL)
+        {
+          HGOTO_ERROR(DFE_BADAID, 0);
+        } /* end if */
+      else
+        more_anns = SUCCEED;
+
+      for (i = 0; (i < nanns) && (more_anns != FAIL); i++)
+        {
+          if (FAIL == Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &annref,
+                               (int32 *) NULL, (int32 *) NULL, (int32 *) NULL,
+                               (int16 *) NULL, (int16 *) NULL))
+                HGOTO_ERROR(DFE_INTERNAL, 0);
+
+          if ((int32) FAIL == Hread(aid, (int32) 4, datadi))
+                HGOTO_ERROR(DFE_READERROR, 0);
+
+          /* get data tag/ref */
+          DFANdir[type]->entries[i].annref = annref;
+          ptr = (uint8 *) &(datadi[0]);
+          UINT16DECODE(ptr, DFANdir[type]->entries[i].datatag);
+          UINT16DECODE(ptr, DFANdir[type]->entries[i].dataref);
+
+          more_anns = Hnextread(aid, anntag, DFREF_WILDCARD, DF_CURRENT);
+        }
+      Hendaccess(aid);
+    }
+
+  if (!tag)
+    HGOTO_DONE(1);
+
+  /* find annotation that goes with this tag/ref */
+  for (p = (DFANdirhead *) DFANdir[type]; p != NULL; p = p->next)
+    for (i = 0; i < p->nentries; i++)
+      if (p->entries[i].annref != 0)
+        if ((p->entries[i].dataref == ref) && (p->entries[i].datatag == tag))
+            HGOTO_DONE(p->entries[i].annref);
+
+  HERROR(DFE_NOMATCH);
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIaddentry -- add entry to annotation directory
+ USAGE
+       int type:        IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+       uint16 annref:   IN: ref of annotation
+       uint16 datatag,: IN: tag of item of which this is annotation
+       uint16 dataref;  IN: ref of item of which this is annotation
+
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Moves to end of directory and appends entry.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+int
+DFANIaddentry(int type, uint16 annref, uint16 datatag, uint16 dataref)
+{
+  CONSTR(FUNC, "DFANIaddentry");
+  int32       i;
+  DFANdirhead *p, *q;
+  int         ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* move to last entry in list */
+  for (p = DFANdir[type]; (p != NULL) && (p->next != NULL); p = p->next)
+    ;
+
+  if (p)
+    {     /* not new list */
+      for (i = 0; i < p->nentries; i++)     /* check all entries */
+        if (p->entries[i].annref == 0)
+          {   /* empty slot */
+            p->entries[i].annref = annref;  /* store entry */
+            p->entries[i].datatag = datatag;
+            p->entries[i].dataref = dataref;
+            HGOTO_DONE(SUCCEED);
+          }
+    }
+
+  /* need new list or new node in list */
+  /* allocate directory space and space for entries. */
+  if ((q = (DFANdirhead *) HDmalloc((uint32) sizeof(DFANdirhead))) == NULL)
+      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+  q->entries = (DFANdirentry *) HDmalloc( DFAN_DEFENTRIES * sizeof(DFANdirentry));
+  if (q->entries == NULL)
+      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+  q->next = NULL;
+  q->nentries = DFAN_DEFENTRIES;
+  if (!p)
+    DFANdir[type] = q;  /* set pointer to this new node */
+  else
+    p->next = q;
+
+  /* store entry */
+  q->entries[0].annref = annref;
+  q->entries[0].datatag = datatag;
+  q->entries[0].dataref = dataref;
+
+  for (i = 1; i < DFAN_DEFENTRIES; i++)   /* mark rest unused */
+    q->entries[i].annref = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIgetannlen -- get length of annotation of tag/ref
+ USAGE
+       int32 DFANIgetannlen(filename, tag, ref, type)
+       char *filename;   IN: name of HDF file
+       int32 tag, ref;   IN: tag/ref of item of which we want annotation
+       int type;         IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+ RETURNS
+       length of annotation if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Calls DFANIlocate to get ref of annotation.
+       Calls Hlength to get its length.
+ GLOBAL VARIABLES
+       Lastref
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+int32
+DFANIgetannlen(const char *filename, uint16 tag, uint16 ref, int type)
+{
+  CONSTR(FUNC, "DFANIgetannlen");
+  int32       file_id, annlength;
+  uint16      anntag, annref;
+  int32       ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!tag)
+    HGOTO_ERROR(DFE_BADTAG,FAIL);
+
+  if (!ref)
+    HGOTO_ERROR(DFE_BADREF,FAIL);
+
+  if (( file_id = DFANIopen(filename, DFACC_READ))== FAIL)
+    HGOTO_ERROR(DFE_BADOPEN,FAIL);
+
+    /* get ref of annotation of tag/ref */
+  annref = DFANIlocate(file_id, type, tag, ref);
+  if (annref == 0)
+    HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL,FAIL);
+  anntag = (uint16) ((type == DFAN_LABEL) ? DFTAG_DIL : DFTAG_DIA);   /* set type tag */
+
+  annlength = Hlength(file_id, anntag, annref) - 4;   /* 4=len of data tag/ref */
+  if (annlength == FAIL)
+    HCLOSE_GOTO_ERROR(file_id,DFE_BADLEN,FAIL);
+  Lastref = annref;   /* remember ref last accessed */
+  if (Hclose(file_id) == FAIL)    /* close file */
+    ret_value = FAIL;
+
+  ret_value = annlength;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIgetann -- get annotation of tag/ref
+ USAGE
+       intn DFANIgetann(filename, tag, ref, ann, maxlen, type)
+       char *filename;   IN: name of HDF file
+       uint16 tag, ref;  IN: tag/ref of item of which we want annotation
+       uint8 *ann;       OUT: space to return annotation in
+       int32 maxlen;     IN: size of space to return annotation in
+       int type;         IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+       int isfortran;    IN: 0 if C, 1 if Fortran
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Gets tag and ref of annotation.  Finds DD for that annotation.
+       Reads the annotation, taking care of NULL terminator, if necessary.
+ GLOBAL VARIABLES
+       Lastref.
+ COMMENTS, BUGS, ASSUMPTIONS
+       BUG 1640: Added isfortran flag to avoid termination of the string with 
+       the null character when the routine is call from FORTRAN.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+intn
+DFANIgetann(const char *filename, uint16 tag, uint16 ref, uint8 *ann,
+            int32 maxlen, int type, int isfortran)
+{
+  CONSTR(FUNC, "DFANIgetann");
+  int32       file_id, aid;
+  int32       annlen;
+  uint16      anntag, annref;
+  uint8       datadi[4];      /* to read in and discard data/ref! */
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!ann)
+    HGOTO_ERROR(DFE_BADPTR,FAIL);
+
+  if (!tag)
+    HGOTO_ERROR(DFE_BADTAG,FAIL);
+
+  if (!ref)
+    HGOTO_ERROR(DFE_BADREF,FAIL);
+
+  if (( file_id = DFANIopen(filename, DFACC_READ))== FAIL)
+    HGOTO_ERROR(DFE_BADOPEN,FAIL);
+
+  /* get annref and anntag of annotation of tag/ref */
+  annref = DFANIlocate(file_id, type, tag, ref);
+  if (annref == 0)
+    HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL,FAIL);
+  anntag = (uint16) ((type == DFAN_LABEL) ? DFTAG_DIL : DFTAG_DIA);
+
+    /* find DD for that annotation */
+  aid = Hstartread(file_id, anntag, annref);
+  if (aid == FAIL)
+      HCLOSE_GOTO_ERROR(file_id,DFE_BADAID,FAIL);
+
+  if (FAIL == Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, (uint16 *) NULL, 
+                       &annlen, (int32 *) NULL, (int32 *) NULL, (int16 *) NULL, 
+                       (int16 *) NULL))
+    {
+      Hendaccess(aid);
+      HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL,FAIL);
+    }
+  annlen -= 4;    /* first four bytes were tag/ref, so they don't count */
+
+  /* check length, if not enough space, truncate annotation */
+  /* In C labels need space for null terminator, descriptions don't */
+  if (isfortran)
+    {
+      if (annlen > maxlen )
+	annlen = maxlen;
+    }
+  else
+    if (type == DFAN_LABEL)
+      {
+	if (annlen > maxlen - 1)
+	  annlen = maxlen - 1;
+      }
+    else
+      {
+	if (annlen > maxlen)
+	  annlen = maxlen;
+      }
+  
+  /* read annotation */
+  if ((int32) FAIL == Hread(aid, (int32) 4, datadi))
+    {     /* go past tag/ref */
+      Hendaccess(aid);
+      HCLOSE_GOTO_ERROR(file_id,DFE_READERROR,FAIL);
+    }
+  if ((int32) FAIL == Hread(aid, annlen, ann))
+    {     /* read the annotation */
+      Hendaccess(aid);
+      HCLOSE_GOTO_ERROR(file_id,DFE_READERROR,FAIL);
+    }
+  /* add null for C */
+  if (type == DFAN_LABEL)
+    if (!isfortran)
+      ann[annlen] = '\0'; /* terminate string properly for C */
+
+  Lastref = annref;   /* remember ref last accessed */
+  Hendaccess(aid);
+  ret_value = (Hclose(file_id));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIputann -- put annotation of tag/ref into file
+ USAGE
+       intn DFANIputann(filename, tag, ref, ann, annlen, type)
+       char *filename;   IN: name of HDF file
+       uint16 tag, ref;  IN: tag/ref of item of which this is the annotation
+       uint8 *ann;       IN: space to return annotation in
+       int32 annlen;     IN: length of annotation
+       int type;         IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Checks for pre-existence of annotation, replacing old one if it
+       exists. Writes out annotation, and updates directory..
+ GLOBAL VARIABLES
+       Lastref.
+ COMMENTS, BUGS, ASSUMPTIONS
+       If the given object already has this type of annotation, it replaces
+       the old annotation with this one.
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+intn
+DFANIputann(const char *filename, uint16 tag, uint16 ref, uint8 *ann,
+            int32 annlen, int type)
+{
+  CONSTR(FUNC, "DFANIputann");
+  int32       file_id, aid;
+  int         newflag = 0;
+  uint16      anntag, annref;
+  uint8       datadi[4];      /* to hold data tag/ref for writing */
+  uint8      *ptr;
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!ann)
+    HGOTO_ERROR(DFE_BADPTR,FAIL);
+
+  if (!tag)
+    HGOTO_ERROR(DFE_BADTAG,FAIL);
+
+  if (!ref)
+    HGOTO_ERROR(DFE_BADREF,FAIL);
+
+  if (( file_id = DFANIopen(filename, DFACC_RDWR))== 0)
+    HGOTO_ERROR(DFE_BADOPEN,FAIL);
+
+  anntag = (uint16) ((type == DFAN_LABEL) ? DFTAG_DIL : DFTAG_DIA);
+
+  /* check if this tag/ref already has this type of annotation */
+  annref = DFANIlocate(file_id, type, tag, ref);
+  if (annref == 0)
+    {
+      annref = Htagnewref(file_id,anntag);
+      if (annref == 0)
+        HCLOSE_GOTO_ERROR(file_id,DFE_NOREF,FAIL);
+      newflag = 1;  /* remember to add ann tag/ref to directory */
+    }
+
+  /*
+   * if annotation exists, reuse tag/ref and rewrite new annotation
+   */
+  if (newflag == 0)
+    {     /* does prev annotation exist? */
+      if (HDreuse_tagref(file_id, anntag, annref) == FAIL)
+        {
+          Hclose(file_id);
+          HEreport("Unable to replace old annotation");
+          HGOTO_DONE(FAIL);
+        }
+    }
+
+  /* put annotation */
+  /* Note: cannot use DFputelement because need to write data tag/ref */
+  aid = Hstartwrite(file_id, anntag, annref, annlen + 4);
+  if (aid == FAIL)
+    {
+      Hendaccess(aid);
+      HCLOSE_GOTO_ERROR(file_id,DFE_BADAID,FAIL);
+    }
+
+  /* write annotation */
+  ptr = (uint8 *) &(datadi[0]);   /* first, write the object's tag/ref */
+  UINT16ENCODE(ptr, tag);
+  UINT16ENCODE(ptr, ref);
+  if ((int32) FAIL == Hwrite(aid, (int32) 4, datadi))
+      HCLOSE_GOTO_ERROR(file_id,DFE_WRITEERROR,FAIL);
+  if ((int32) FAIL == Hwrite(aid, annlen, ann))
+    {     /* then write the annotation */
+      Hendaccess(aid);
+      HCLOSE_GOTO_ERROR(file_id,DFE_WRITEERROR,FAIL);
+    }
+
+  /* put annotation tag/ref into directory if new */
+  if (newflag)
+    {
+      if (FAIL == DFANIaddentry(type, annref, tag, ref))
+        {
+          Hendaccess(aid);
+          HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL,FAIL);
+        }
+    }
+
+  Lastref = annref;   /* remember ref last accessed */
+  Hendaccess(aid);
+  ret_value = (Hclose(file_id));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIlablist -- Return list of refs and labels for a given tag
+ USAGE
+       int DFANlablist(filename, tag, reflist, labellist,
+                                                listsize, maxlen, startpos)
+       char *filename;   IN: name of HDF file
+       uint16 tag;       IN: tag to use when searching for ref numbers
+                             and labels
+       uint16 reflist[]; OUT: array allocated to place ref numbers in
+       char *labellist;  OUT: array of strings allocated to place labels in
+       int listsize;     IN: size of ref number list and label list
+       int maxlen;       IN: maximum length allocated for label
+       int startpos;     IN: Starting position.  Beginning from the
+                             startpos'th entry, up to listsize entries
+                             will be returned.
+       int isfortran: 0 if C, 1 if Fortran
+ RETURNS
+       Number of ref numbers found if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Where there is no corresponding label, the position in
+       labellist is zero filled (C) or blank filled (Fortran).
+       Revised 04/17/90 so that it returns all ref numbers for
+       the given tag, rather than just those that have labels.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+       Revised 04/17/90.  (See DESCRIPTION.)
+ *------------------------------------------------------------------------*/
+intn
+DFANIlablist(const char *filename, uint16 tag, uint16 reflist[],
+             uint8 *labellist, int listsize, int maxlen, int startpos,
+             int isfortran)
+{
+  CONSTR(FUNC, "DFANIlablist");
+  int32       i;
+  int         j, k;
+  int32       file_id, aid, len;
+  uint16      ref=0;
+  DFANdirhead *p;
+  uint8      *lp;             /* pointer to label */
+  intn        nrefs, nlabs;
+  uint8       labeldi[4];     /* to read in and discard data/ref */
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!reflist || !labellist)
+    HGOTO_ERROR(DFE_BADPTR,FAIL);
+
+  if (!tag)
+    HGOTO_ERROR(DFE_BADTAG,FAIL);
+
+  if (( file_id = DFANIopen(filename, DFACC_READ))== 0)
+    HGOTO_ERROR(DFE_BADOPEN,FAIL);
+
+    /* clear labellist.  pad with blanks for Fortran; add null for C  */
+  if (isfortran)
+    HDmemset(labellist, ' ', (uint32) maxlen * (uint32) listsize);
+  else
+    HDmemset(labellist, '\0', (uint32) maxlen * (uint32) listsize);
+
+    /* find all refs for this tag; store them in reflist */
+  nrefs = (intn) Hnumber(file_id, tag);   /* how many times is tag in file? */
+  if (nrefs == FAIL)
+    HCLOSE_GOTO_ERROR(file_id,DFE_NOMATCH,FAIL);
+
+  aid = Hstartread(file_id, tag, DFREF_WILDCARD);     /* set search for refs */
+  if (aid == FAIL)
+    HCLOSE_GOTO_ERROR(file_id,DFE_BADAID,FAIL);
+
+  for (i = 0, j = 0; i < nrefs && j < listsize; i++)
+    {
+      if (HQuerytagref(aid, (uint16 *) NULL, &ref) == FAIL)
+        {
+          Hendaccess(aid);
+          HCLOSE_GOTO_ERROR(file_id,DFE_NOMATCH,FAIL);
+        }
+      if (i >= startpos - 1)
+        reflist[j++] = ref;   /* store next ref in reflist */
+      Hnextread(aid, tag, DFREF_WILDCARD, DF_CURRENT);
+    }
+  nrefs = j;
+  Hendaccess(aid);
+
+  /* get directory of all labels */
+
+  nlabs = (intn) Hnumber(file_id, DFTAG_DIL);
+  if (nlabs != 0)
+    {
+      if (DFANdir[DFAN_LABEL] == NULL)
+        {   /* if no dir info create dir */
+          if (0 == DFANIlocate(file_id, DFAN_LABEL, 0, 0))
+            {
+              Hendaccess(aid);
+              HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL,FAIL);
+            }
+        }
+
+      lp = labellist;
+
+      /* Look through all labels. Get those that correspond to the tag,
+         and match them with corresponding tag/refs in the reflist.      */
+      for (p = DFANdir[DFAN_LABEL]; p != NULL; p = p->next)
+        {   /* for each ann dir */
+          for (i = 0; i < p->nentries; i++)
+            {     /* for each tag in dir */
+              if (p->entries[i].datatag == tag)
+                {   /* if this tag==our tag */
+
+                  aid = Hstartread(file_id, DFTAG_DIL, p->entries[i].annref);
+                  if (aid == FAIL)
+                      HCLOSE_GOTO_ERROR(file_id,DFE_BADAID,FAIL);
+                  if ((int32) FAIL == Hread(aid, (int32) 4, labeldi))
+                    {     /* data tag/ref */
+                      Hendaccess(aid);
+                      HCLOSE_GOTO_ERROR(file_id,DFE_READERROR,FAIL);
+                    }
+                  /* look for corresponding ref in reflist */
+                  for (k = 0; k < nrefs && p->entries[i].dataref != reflist[k]; k++)
+                    ;
+                  if (k < nrefs)
+                    {     /* if ref found */
+
+                      lp = labellist + k * maxlen;  /* get pos to copy to */
+
+                      /* note len on read may be too big, but OK for DFread */
+                      len = Hread(aid, (int32) (maxlen - 1), lp);
+                      if (len == FAIL)
+                        {
+                          Hendaccess(aid);
+                          HCLOSE_GOTO_ERROR(file_id,DFE_READERROR,FAIL);
+                        }
+                      /* ret now contains actual length read */
+                      /* pad with blanks for Fortran; add null for C */
+                      if (isfortran)
+                        while (len++ < maxlen)
+                          lp[len] = ' ';
+                      else
+                        lp[len] = '\0';
+                    }
+                  Hendaccess(aid);
+                }   /* tag == our tag  */
+            }     /* for each tag in dir  */
+        }   /* for each ann dir  */
+    }     /* nlabs != 0  */
+  if (FAIL == Hclose(file_id))    /* close file */
+    ret_value = FAIL;
+  else
+    ret_value = nrefs;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANaddfann -- Write a file label or description to a file
+ USAGE
+       int DFANaddfid(file_id, id)
+       int32 file_id;  IN: pointer to HDF file
+       char *ann;      IN: annotation to write to file
+       int32 annlen:   IN: length of annotation
+       int type:       IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Calls Hputelement to putput the annotation.
+ GLOBAL VARIABLES
+       Lastref
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+int
+DFANIaddfann(int32 file_id, char *ann, int32 annlen, int type)
+{
+  CONSTR(FUNC, "DFANIaddfann");
+  uint16      anntag, annref;
+  int         ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!ann)
+    HGOTO_ERROR(DFE_BADPTR,FAIL);
+
+  anntag = (uint16) ((type == DFAN_LABEL) ? DFTAG_FID : DFTAG_FD);
+
+  annref = Htagnewref(file_id,anntag);
+  if (annref == 0)
+    HGOTO_ERROR(DFE_NOREF,FAIL);
+
+    /* write out annotation */
+  if (FAIL == Hputelement(file_id, anntag, annref, (uint8 *) ann, annlen))
+    HGOTO_ERROR(DFE_PUTELEM,FAIL);
+
+  Lastref = annref;   /* remember ref last accessed */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIgetfannlen -- get length of next file annotation
+ USAGE
+       int32 DFANIgetannlen(filename, tag, ref, type)
+       int32 file_id;   IN: id of HDF file
+       int type;        IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+       int isfirst;     IN: 1: start with first one; 0: get next one
+ RETURNS
+       length of annotation if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Uses isfirst and Next_label_ref (or Next_desc_ref) to determine
+       which annotation to pick up next.
+ GLOBAL VARIABLES
+       Lastref
+       Next_label_ref
+       Next_desc_ref
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+ *------------------------------------------------------------------------*/
+int32
+DFANIgetfannlen(int32 file_id, int type, int isfirst)
+{
+  CONSTR(FUNC, "DFANIgetfannlen");
+  uint16      anntag, annref;
+  int32       aid;
+  int32       length;
+  int32       ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* Identify tag for this "type" of access; determine which ref to key on. */
+  if (type == DFAN_LABEL)
+    {
+      anntag = DFTAG_FID;
+      annref = (uint16) ((isfirst == 1) ? DFREF_WILDCARD : Next_label_ref);
+    }
+  else
+    {
+      anntag = DFTAG_FD;
+      annref = (uint16) ((isfirst == 1) ? DFREF_WILDCARD : Next_desc_ref);
+    }
+  aid = Hstartread(file_id, anntag, annref);
+  if (aid == FAIL)
+    HGOTO_ERROR(DFE_BADAID, FAIL);
+  if (FAIL == Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &annref, &length,
+                       (int32 *) NULL, (int32 *) NULL, (int16 *) NULL, (int16 *) NULL))
+    {
+      Hendaccess(aid);
+      HGOTO_ERROR(DFE_NOMATCH, FAIL);
+    }
+  if (type == DFAN_LABEL)     /* prepare for next call */
+    Next_label_ref = annref;
+  else
+    Next_desc_ref = annref;
+
+  Hendaccess(aid);
+  Lastref = annref;   /* remember ref last accessed */
+
+  if (length >= 0)    /* (length == 0) => no length found */
+    ret_value = length;
+  else
+    HGOTO_ERROR(DFE_NOMATCH,FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFANIgetfann -- get next file annotation (file ID or file description)
+ USAGE
+       intn DFANIgetfann(filename, tag, ref, ann, maxlen, type)
+       int32 file_id;    IN: id of HDF file
+       uint8 *ann;       OUT: space to return annotation in
+       int32 annlen;     IN: size of space to return annotation in
+       int type;         IN: DFAN_LABEL for labels, DFAN_DESC for descriptions
+       int isfirst;      IN: 1: start with first one; 0: get next one
+
+ RETURNS
+       Length of annotation if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Gets tag and ref of annotation.  Finds DD for that annotation.
+       Reads the annotation, taking care of NULL terminator, if necessary.
+ GLOBAL VARIABLES
+       Lastref, Next_desc_ref, Next_label_ref
+ COMMENTS, BUGS, ASSUMPTIONS
+       If maxlen not great enough, ann is truncated to maxlen-1 chars
+       BUG: If ref is high possible ref value, setting of Next_label_ref
+            or Next_desc_ref behave unpredictably.
+ EXAMPLES
+ REVISION LOG
+ *---------------------------------------------------------------------------*/
+int32
+DFANIgetfann(int32 file_id, char *ann, int32 maxlen, int type,
+             int isfirst)
+{
+  CONSTR(FUNC, "DFANIgetfann");
+  uint16      anntag, annref;
+  int32       length, aid;
+  int32       ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!ann)
+    HGOTO_ERROR(DFE_BADPTR,FAIL);
+
+    /* Identify tag for this "type" of access; determine which ref to key on. */
+  if (type == DFAN_LABEL)
+    {
+      anntag = DFTAG_FID;
+      annref = (uint16) ((isfirst == 1) ? DFREF_WILDCARD : Next_label_ref);
+    }
+  else
+    {
+      anntag = DFTAG_FD;
+      annref = (uint16) ((isfirst == 1) ? DFREF_WILDCARD : Next_desc_ref);
+    }
+
+  if (( aid = Hstartread(file_id, anntag, annref))== FAIL)
+    HGOTO_ERROR(DFE_BADAID, FAIL);
+  if (FAIL == Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &annref, &length,
+                   (int32 *) NULL, (int32 *) NULL, (int16 *) NULL, (int16 *) NULL))
+    {
+      Hendaccess(aid);
+      HGOTO_ERROR(DFE_NOMATCH, FAIL);
+    }
+  length = (length > maxlen) ? maxlen : length;   /* truncate if too long */
+
+  if ((int32) FAIL == Hread(aid, length, (uint8 *) ann))  /* get the annotation */
+    {
+      Hendaccess(aid);
+      HGOTO_ERROR(DFE_READERROR, FAIL);
+    }
+
+  if (length > maxlen - 1)
+    length = maxlen - 1;
+
+  ann[length] = '\0';
+
+  Lastref = annref;   /* remember ref last accessed */
+
+  /* prepare for next call */
+  if (FAIL == Hnextread(aid, anntag, DFREF_WILDCARD, DF_CURRENT))
+    {     /* If no more of them, set Next_ ???_ref */
+      if (type == DFAN_LABEL)   /*    to one higher than current value   */
+        Next_label_ref++;     /*    so that next call will fail.       */
+      else
+        Next_desc_ref++;
+    }
+  else
+    {     /* Otherwise save the next ref */
+      if (FAIL == Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &annref,
+                           (int32 *) NULL, (int32 *) NULL, (int32 *) NULL,
+                           (int16 *) NULL, (int16 *) NULL))
+        {
+          Hendaccess(aid);
+          HGOTO_ERROR(DFE_NOMATCH, FAIL);
+        }
+      if (type == DFAN_LABEL)
+        Next_label_ref = annref;
+      else
+        Next_desc_ref = annref;
+    }
+
+  Hendaccess(aid);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  else
+    ret_value = length;
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFANIstart
+ PURPOSE
+    DFAN-level initialization routine
+ USAGE
+    intn DFANIstart()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Register the shut-down routine (DFANPshutdown) for call with atexit
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn DFANIstart(void)
+{
+    CONSTR(FUNC, "DFANIstart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&DFANPshutdown) != 0)
+      HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return(ret_value);
+} /* end DFANIstart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFANPshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn DFANPshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the DFAN routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn DFANPshutdown(void)
+{
+    DFANIclear();   /* frees the directory lists */
+
+    if(Lastfile!=NULL)
+      {
+          HDfree(Lastfile);
+          Lastfile=NULL;
+      } /* end if */
+    return(SUCCEED);
+} /* end DFANPshutdown() */
+
diff --git a/hdf/src/dfan.h b/hdf/src/dfan.h
new file mode 100644
index 0000000..df50a80
--- /dev/null
+++ b/hdf/src/dfan.h
@@ -0,0 +1,65 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfan.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*------------------------------------------------------------------------------
+ * File:    dfan.h
+ * Purpose: header file for the Annotations set
+ * Invokes: df.h
+ * Contents:
+ *  Structure definitions: DFANdirentry, DFANdirhead
+ *  Constant definitions: DFAN_LABEL, DFAN_DESC
+ * Remarks: none
+ *----------------------------------------------------------------------------*/
+
+#ifndef DFAN_H  /* avoid re-inclusion */
+#define DFAN_H
+
+#include "hdf.h"
+
+#define DFAN_LABEL  0
+#define DFAN_DESC   1
+
+#define DFAN_LAB_BLKSIZE   64   /* default blksize to use for labels */
+#define DFAN_DESC_BLKSIZE 512   /* default blksize to use for descriptions */
+
+#define DFAN_DEFENTRIES 16  /* no of dir entries to add at a time */
+
+/*
+ * This structure stores an entry in the label/desc directory
+ * for a label/desc in the file, it gives the ref of the label/desc,
+ * and the tag/ref of the data item to which the label/desc relates
+ */
+typedef struct
+  {
+      uint16      annref;       /* ref of annotation */
+      uint16      datatag;      /* tag of data */
+      uint16      dataref;      /* ref of data */
+  }
+DFANdirentry;
+
+/*
+ * This structure is a head node for the directory, which is organized as
+ * as a linked list of arrays.  DFANdirentry is the structure of an
+ * array element, while DFANdirhead is the list element
+ */
+typedef struct DFANdirhead
+  {
+      struct DFANdirhead *next; /* list element */
+      int32       nentries;     /* Numer of entries */
+      DFANdirentry *entries;  /* actually an arbitrary size array */
+  }
+DFANdirhead;
+
+#endif /* DFAN_H */
diff --git a/hdf/src/dfanf.c b/hdf/src/dfanf.c
new file mode 100644
index 0000000..635ac6f
--- /dev/null
+++ b/hdf/src/dfanf.c
@@ -0,0 +1,458 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5322 $";
+#endif
+
+/* $Id: dfanf.c 5322 2010-01-19 06:26:11Z brtnfld $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfanF.c
+ * Purpose: Fortran stubs for annotation routines
+ * Invokes: dfan.c dfkit.c
+ * Contents:
+ *
+ *  daiganl_     : get length of annotation of tag/ref
+ *  daigann_     : get annotation of tag/ref
+ *  daipann_     : put annotation of tag/ref
+ *  dailist_     : get list of refs and labels for a given tag
+ *  dalref_      : return last ref written or read
+ *  daclear_     : reset annotation internal structures
+ *  dfanlastref_ : return last ref written or read
+ *
+ *  dfanaddfds_    : add file description
+ *  dfangetfidlen_ : get length of file id
+ *  dfangetfdslen_ : get length of file description
+ *  dfangetfid_    : get file id
+ *  dfangetfds_    : get file description
+ *  daafds_        : get file description
+ *  dagfidl_       : get file id length
+ *  dagfdsl_       : get file description length
+ *  dagfid_        : get file id
+ *  dagfds_        : get file description
+ *
+ *  daiafid_       : add file id (intermediate routine)
+ *---------------------------------------------------------------------------*/
+#include "dfan.h"
+#include "df.h"
+#include "hproto_fortran.h"
+
+/* conventions used in forming names of routines:
+   **
+   **    dfan: hdf annotation routine (<dfan>addfds)
+   **    add:  add item to file       dfan<add>fds
+   **    get:  get item from file     dfan<get>fds
+   **    f:    file                   dfanadd<f>ds
+   **    id:   id                     dfanaddf<id>
+   **    ds:   description            dfanaddf<ds>
+   **    len:  length                 dfanaddfid<len>
+   **    l:    length (short forms)   dagfid<l>
+   **    da:   dfan (short forms)     <da>gfid
+   **    a:    add (short forms)      da<a>fds
+   **    g:    get (short forms)      da<g>fds
+   **    i:    intermediate routine (not in user interface) da<i>afid
+   * */
+
+/*---------------------------------------------------------------------------
+** Routines for handling tag/ref (not file) annotations
+ *-------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------
+ * Name:    daclear
+ * Purpose: Call DFANIclear to clear Lastref and DFANdir[i]
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIclear
+ *-------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndaclear(void)
+{
+    return(DFANIclear());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    daiganl
+ * Purpose: get length of annotation of tag/ref
+ * Inputs:  filename: name of HDF file
+ *          tag, ref: tag/ref of item of which we want label
+ *          type: DFAN_LABEL if label, DFAN_DESC if description
+ *          fnlen: length of filename
+ * Returns: length of annotation on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetannlen, HDf2cstring, DFIfreespace
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndaiganl(_fcd filename, intf * tag, intf * ref, intf * type, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFANIgetannlen(fn, (uint16) *tag, (uint16) *ref, (intn) *type);
+    HDfree((VOIDP) fn);
+
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    daigann
+ * Purpose: get annotation of tag/ref
+ * Inputs:  filename: name of HDF file
+ *          tag, ref: tag/ref of item of which we want label
+ *          annotation: space to return label in
+ *          maxlen: size of space to return label in
+ *          type: DFAN_LABEL if label, DFAN_DESC if description
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndaigann(_fcd filename, intf * tag, intf * ref, _fcd annotation, intf * maxlen,
+         intf * type, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFANIgetann(fn, (uint16) *tag, (uint16) *ref,
+		      (uint8 *) _fcdtocp(annotation), (int32) *maxlen, (intn) *type, 1);
+    HDfree((VOIDP) fn);
+
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    daipann
+ * Purpose: put annotation of tag/ref
+ * Inputs:  filename: name of HDF file
+ *          tag, ref: tag/ref of item of which we want label
+ *          annotation: space to return label in
+ *          annlen: length of annotation
+ *          type: DFAN_LABEL if label, DFAN_DESC if description
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndaipann(_fcd filename, intf * tag, intf * ref, _fcd annotation,
+         intf * annlen, intf * type, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFANIputann(fn, (uint16) *tag, (uint16) *ref,
+             (uint8 *) _fcdtocp(annotation), (int32) *annlen, (intn) *type);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dailist
+ * Purpose: Return list of refs and labels for a given tag
+ * Inputs:  filename: name of HDF file
+ *          tag: tag to get list of refs and labels for
+ *          reflist: array to place refs in
+ *          labellist: array of strings to place labels in
+ *          listsize: size of ref and label lists
+ *          maxlen: maximum length allowed for label
+ *          startpos: beginning from the startpos'th entry, upto listsize
+ *              entries will be returned.
+ *          fnlen: length of filename
+ * Returns: number of entries on success, -1 on error with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFANIlablist
+ * Method:  call DFANIlablist
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndailist(_fcd filename, intf * tag, intf reflist[], _fcd labellist,
+         intf * listsize, intf * maxlen, intf * startpos, intf * fnlen)
+{
+    char       *fn;
+    int         i;
+    intf        nrefs;
+    uint16     *tempreflist;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+
+    /* create reflist with true uint16s to maintain compatibility
+       ** with machines that allocate more than 16 bits per uint16.
+     */
+    tempreflist = (uint16 *) HDmalloc((size_t) (*listsize) * sizeof(uint16));
+    /* 1 for isfortran */
+    nrefs = DFANIlablist(fn, (uint16) *tag, tempreflist,
+                         (uint8 *) _fcdtocp(labellist),
+                         (int) *listsize, (int) *maxlen, (int) *startpos, 1);
+    if (nrefs < 0)
+        return FAIL;
+
+    /* move ref numbers into caller's reflist */
+    for (i = 0; i < *listsize; i++)
+        reflist[i] = (intf)tempreflist[i];
+
+    HDfree((VOIDP) fn);
+    HDfree((VOIDP) tempreflist);
+
+    return (nrefs);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dalref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Globals: Lastref
+ * Returns: ref on success, -1 on error with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFANlastref
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndalref(void)
+{
+    return ((intf)DFANlastref());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfanlastref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Globals: Lastref
+ * Returns: ref on success, -1 on error with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFANlastref
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfanlastref(void)
+{
+    return ((intf)DFANlastref());
+}
+
+/*---------------------------------------------------------------------------
+** Routines for handling file annotations
+ *-------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfanaddfds
+ * Purpose: add file description (Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          desc: description to write to file
+ *          desclen: length of description
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANaddfileann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfanaddfds(intf * dfile, _fcd desc, intf * desclen)
+{
+    return (DFANIaddfann(*dfile, _fcdtocp(desc), *desclen, DFAN_DESC));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfangetfidlen
+ * Purpose: get length of next file ID (Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          isfirst: 1: start with first one; 0: get length of next one
+ * Returns: On success: length of next file ID; On failure: -1, with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetfannlen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfangetfidlen(intf * dfile, intf * isfirst)
+{
+    return (DFANIgetfannlen(*dfile, DFAN_LABEL, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfangetfdslen
+ * Purpose: get length of next file description (Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          isfirst: 1: start with first one; 0: get length of next one
+ * Returns: On success: length of next file ID; On failure: -1, with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetfannlen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfangetfdslen(intf * dfile, intf * isfirst)
+{
+    return (DFANIgetfannlen(*dfile, DFAN_DESC, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfangetfid
+ * Purpose: get file ID (Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          desc: description to write to file
+ *          desclen: length of description
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANgetfann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfangetfid(intf * dfile, _fcd id, intf * maxlen, intf * isfirst)
+{
+    return (DFANIgetfann(*dfile, _fcdtocp(id), *maxlen,
+                         DFAN_LABEL, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfangetfds
+ * Purpose: get file description (Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          desc: description to write to file
+ *          desclen: length of description
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANgetfann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfangetfds(intf * dfile, _fcd id, intf * maxlen, intf * isfirst)
+{
+    return (DFANIgetfann(*dfile, _fcdtocp(id), *maxlen,
+                         DFAN_DESC, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+** Versions with short names
+**---------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ * Name:    daafds
+ * Purpose: add file description (short form of DFANaddfds; Fortran callable)
+ * Inputs:  dfile: pointer to HDF file
+ *          desc: description to write to file
+ *          desclen: length of description
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANaddfileann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndaafds(intf * dfile, _fcd desc, intf * desclen)
+{
+    return (DFANIaddfann(*dfile, _fcdtocp(desc), *desclen, DFAN_DESC));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dagfidl
+ * Purpose: get length of next file ID
+ * Inputs:  dfile: pointer to HDF file
+ *          isfirst: 1: start with first one; 0: get length of next one
+ * Returns: On success: length of next file ID; On failure: -1, with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetfannlen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndagfidl(intf * dfile, intf * isfirst)
+{
+    return (DFANIgetfannlen(*dfile, DFAN_LABEL, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dagfdsl
+ * Purpose: get length of next file description (Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          isfirst: 1: start with first one; 0: get length of next one
+ * Returns: On success: length of next file ID; On failure: -1, with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetfannlen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndagfdsl(intf * dfile, intf * isfirst)
+{
+    return (DFANIgetfannlen(*dfile, DFAN_DESC, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dagfid
+ * Purpose: get file ID (short form of DFANgetfid; Fortran callable version)
+ * Inputs:  dfile: pointer to HDF file
+ *          desc: description to write to file
+ *          desclen: length of description
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANIgetfann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndagfid(intf * dfile, _fcd id, intf * maxlen, intf * isfirst)
+{
+    return (DFANIgetfann(*dfile, _fcdtocp(id), *maxlen,
+                         DFAN_LABEL, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dagfds
+ * Purpose: get file description
+ *          (short form of DFANgetfds; Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          desc: description to write to file
+ *          desclen: length of description
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFANgetfann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndagfds(intf * dfile, _fcd id, intf * maxlen, intf * isfirst)
+{
+    return (DFANIgetfann(*dfile, _fcdtocp(id), *maxlen,
+                         DFAN_DESC, (intn) *isfirst));
+}
+
+/*-----------------------------------------------------------------------------
+** Intermediate routines called from user's fortran routines
+**---------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ * Name:    daiafid
+ * Purpose: intermediate routine to add file ID (Fortran callable C version)
+ * Inputs:  dfile: pointer to HDF file
+ *          id: ID to write to file
+ *          idlen: length of ID string
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran user routines DFANaddfid and daafid
+ * Invokes: DFANaddfann
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndaiafid(intf * dfile, _fcd id, intf * idlen)
+{
+    return (DFANIaddfann(*dfile, _fcdtocp(id), *idlen, DFAN_LABEL));
+}
diff --git a/hdf/src/dfanff.f b/hdf/src/dfanff.f
new file mode 100644
index 0000000..2214cc4
--- /dev/null
+++ b/hdf/src/dfanff.f
@@ -0,0 +1,402 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: dfanff.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+C------------------------------------------------------------------------------
+C File:     dfanFf.f
+C Purpose:    Fortran stub routines for annotations
+C Invokes:    dfanF.c
+C Contents: 
+C    dagllen      : get length of label of tag/ref
+C    daglab       : get label of tag/ref
+C    dagdlen      : get length of description of tag/ref
+C    dagdesc      : get description of tag/ref
+C    daplab       : put label of tag/ref
+C    dapdesc      : put description of tag/ref
+C    dallist      : get list of labels for a particular tag
+C    daafid       : add file ID to file
+C
+C    dfangetlablen: get length of label of tag/ref
+C    dfangetlabel : get label of tag/ref
+C    dfangetdesclen: get length of description of tag/ref
+C    dfangetdesc  : get description of tag/ref
+C    dfanputlabel : put label of tag/ref
+C    dfanputdesc  : put description of tag/ref
+C    dfanlablist  : get list of labels for a particular tag
+C    dfanaddfid   : add file ID to file 
+
+C------------------------------------------------------------------------------
+
+
+C------------------------------------------------------------------------------
+C Name:    dagllen
+C Purpose: get length of label of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want label
+C Returns: length of label on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daiganl
+C------------------------------------------------------------------------------
+
+      integer function dagllen(filename, tag, ref)
+      character *(*) filename
+      integer tag, ref, daiganl
+
+C 0 is DFAN_LABEL
+      dagllen = daiganl(filename, tag, ref, 0, len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    daglab
+C Purpose: get label of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want label
+C          label: space to return label in
+C          maxlen: size of space to return label in
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daigann
+C------------------------------------------------------------------------------
+
+      integer function daglab(filename, tag, ref, label, maxlen)
+      character *(*) filename, label
+      integer tag, ref, maxlen, daigann
+
+C 0 is DFAN_LABEL
+      daglab = daigann(filename, tag, ref, label, maxlen, 0,
+     +                                                  len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dagdlen
+C Purpose: get length of description of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want description
+C Returns: length of description on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daiganl
+C------------------------------------------------------------------------------
+
+      integer function dagdlen(filename, tag, ref)
+      character *(*) filename
+      integer tag, ref, daiganl
+
+C 1 is DFAN_DESC
+      dagdlen = daiganl(filename, tag, ref, 1, len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dagdesc
+C Purpose: get description of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want description
+C          desc: space to return description in
+C          maxlen: size of space to return description in
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daigann
+C------------------------------------------------------------------------------
+
+      integer function dagdesc(filename, tag, ref, desc, maxlen)
+      character *(*) filename, desc
+      integer tag, ref, daigann, maxlen
+
+C 1 is DFAN_DESC
+      dagdesc = daigann(filename, tag, ref, desc, maxlen, 1,
+     +                                                  len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    daplab
+C Purpose: put label of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which this is the label
+C          label: label to write to file
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daipann
+C------------------------------------------------------------------------------
+
+      integer function daplab(filename, tag, ref, label)
+      character *(*) filename, label
+      integer tag, ref, daipann
+
+C 0 is DFAN_LABEL
+      daplab = daipann(filename, tag, ref, label, len(label), 0,
+     +                                                   len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dapdesc
+C Purpose: put description of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which this is the description
+C          desc: description to write to file
+C          desclen: length of description
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daipann
+C------------------------------------------------------------------------------
+
+      integer function dapdesc(filename, tag, ref, desc, desclen)
+      character *(*) filename, desc
+      integer tag, ref, desclen, daipann
+
+C 1 is DFAN_DESC
+      dapdesc = daipann(filename, tag, ref, desc, desclen, 1,
+     +                                               len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dallist
+C Purpose: Return list of refs and labels for a given tag
+C Inputs:  filename: name of HDF file
+C          tag: tag to get list of refs and labels for
+C          reflist: array to place refs in
+C          labellist: array of strings to place labels in
+C          listsize: size of ref and label lists
+C          maxlen: maximum length allowed for label
+C          startpos: beginning from the startpos'th entry, upto listsize
+C                entries will be returned.
+C Returns: number of entries on success, -1 on error with DFerror set
+C Users:   HDF users, utilities, other routines
+C Invokes: dailist
+C Method:  call dailist
+C Remarks: none
+C------------------------------------------------------------------------------
+
+      integer function dallist(filename, tag, reflist, labellist,
+     +                                      listsize, maxlen, startpos)
+      character *(*) filename, labellist
+      integer tag, reflist(*), listsize, maxlen, startpos, dailist
+
+      dallist = dailist(filename, tag, reflist, labellist,
+     +                     listsize, maxlen, startpos, len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    daafid
+C Purpose: add file ID to file
+C Inputs:  dfile: pointer to HDF file
+C          id: id to write to file
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daipann
+C------------------------------------------------------------------------------
+
+      integer function daafid(file, id)
+      integer file, daiafid
+      character*(*) id
+
+      daafid = daiafid(file, id, len(id) )
+      return
+      end
+
+
+CEND7MAX
+
+
+C------------------------------------------------------------------------------
+C Name:    dfangetlablen
+C Purpose: get length of label of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want label
+C Returns: length of label on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daignal
+C------------------------------------------------------------------------------
+
+      integer function dfangetlablen(filename, tag, ref)
+      character *(*) filename
+      integer tag, ref, daiganl
+
+C 0 is DFAN_LABEL
+      dfangetlablen = daiganl(filename, tag, ref, 0, len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dfangetlabel
+C Purpose: get label of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want label
+C          label: space to return label in
+C          maxlen: size of space to return label in
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daigann
+C------------------------------------------------------------------------------
+
+      integer function dfangetlabel(filename, tag, ref, label, maxlen)
+      character *(*) filename, label
+      integer tag, ref, maxlen, daigann
+
+C 0 is DFAN_LABEL
+      dfangetlabel = daigann(filename, tag, ref, label, maxlen, 0,
+     +                                                  len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dfangetdesclen
+C Purpose: get length of description of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want description
+C Returns: length of description on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daiganl
+C------------------------------------------------------------------------------
+
+      integer function dfangetdesclen(filename, tag, ref)
+      character *(*) filename
+      integer tag, ref, daiganl
+
+C 1 is DFAN_DESC
+      dfangetdesclen = daiganl(filename, tag, ref, 1, len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dfangetdesc
+C Purpose: get description of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which we want description
+C          desc: space to return description in
+C          maxlen: size of space to return description in
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daigann
+C------------------------------------------------------------------------------
+
+      integer function dfangetdesc(filename, tag, ref, desc, maxlen)
+      character *(*) filename, desc
+      integer tag, ref, daigann, maxlen
+
+C 1 is DFAN_DESC
+      dfangetdesc = daigann(filename, tag, ref, desc, maxlen, 1,
+     +                                                  len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dfanputlabel
+C Purpose: put label of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which this is the label
+C          label: label to write to file
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daipann
+C------------------------------------------------------------------------------
+
+      integer function dfanputlabel(filename, tag, ref, label)
+      character *(*) filename, label
+      integer tag, ref, daipann
+
+C 0 is DFAN_LABEL
+      dfanputlabel = daipann(filename, tag, ref, label, len(label), 0,
+     +                                                   len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dfanputdesc
+C Purpose: put description of tag/ref
+C Inputs:  filename: name of HDF file
+C          tag, ref: tag/ref of item of which this is the description
+C          desc: description to write to file
+C          desclen: length of description
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daipann
+C------------------------------------------------------------------------------
+
+      integer function dfanputdesc(filename, tag, ref, desc, desclen)
+      character *(*) filename, desc
+      integer tag, ref, desclen, daipann
+
+C 1 is DFAN_DESC
+      dfanputdesc = daipann(filename, tag, ref, desc, desclen, 1,
+     +                                               len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dfanlablist
+C Purpose: Return list of refs and labels for a given tag
+C Inputs:  filename: name of HDF file
+C          tag: tag to get list of refs and labels for
+C          reflist: array to place refs in
+C          labellist: array of strings to place labels in
+C          listsize: size of ref and label lists
+C          maxlen: maximum length allowed for label
+C          startpos: beginning from the startpos'th entry, upto listsize
+C                entries will be returned.
+C Returns: number of entries on success, -1 on error with DFerror set
+C Users:   HDF users, utilities, other routines
+C Invokes: dailist
+C Method:  call dailist
+C Remarks: none
+C------------------------------------------------------------------------------
+
+      integer function dfanlablist(filename, tag, reflist, labellist,
+     +                                      listsize, maxlen, startpos)
+      character *(*) filename, labellist
+      integer tag, reflist(*), listsize, maxlen, startpos, dailist
+
+      dfanlablist = dailist(filename, tag, reflist, labellist,
+     +                     listsize, maxlen, startpos, len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:    dfanaddfid
+C Purpose: add file ID to file
+C Inputs:  dfile: pointer to HDF file
+C          id: id to write to file
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF HLL users, utilities, other routines
+C Invokes: daipann
+C------------------------------------------------------------------------------
+
+      integer function dfanaddfid(file, id)
+      integer file, daiafid
+      character*(*) id
+
+      DFANaddfid = daiafid(file, id, len(id) )
+      return
+      end
+
+
diff --git a/hdf/src/dfcomp.c b/hdf/src/dfcomp.c
new file mode 100644
index 0000000..89c6785
--- /dev/null
+++ b/hdf/src/dfcomp.c
@@ -0,0 +1,354 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfcomp.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfcomp.c
+ * Purpose: File compression
+ * Invokes: df.c dfimcomp.c df.h
+ * Contents:
+ *  DFputcomp: compress image and write it to HDF file
+ *  DFgetcomp: read compressed image from HDF file and decompress it
+ *  DFCrle: compress string using run length encoding
+ *  DFCunrle: decompress string using run length encoding
+ * Remarks: DFgetcomp and DFputcomp constitute a general compression interface
+ *---------------------------------------------------------------------------*/
+
+/* This module (dfcomp.c) used to be in */
+/* charge of the general compression information */
+/* but hcomp.c now supercedes it. */
+#include "hdf.h"
+
+#define R8_MAX_BLOCKS 32
+#define R8_MAX_LENGTH 512
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFputcomp
+ * Purpose: Compress and write images to HDF file
+ * Inputs:  file_id: pointer to HDF file
+ *          tag, ref: tag, ref of compressed image for writing out
+ *          image: image to be compressed
+ *          xdim, ydim: dimensions of image
+ *          palette: palette associated with image
+ *          newpal: modified palette, produced if compression scheme is IMCOMP
+ *          scheme: compression scheme to be used
+ *          cinfo: additional information needed for compression
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF programmers, DF8putrig, other routines
+ * Invokes: DFCrle, DFCimcomp, DFaccess, DFwrite, DFIcheck
+ * Remarks: IMCOMP modifies the palette associated with the image
+ *          Hence the palette and newpal arguments
+ *          This is a general compression interface - to be used anytime image
+ *          compression is needed in HDF
+ *          Note that rseq does its own compression, because that is part of
+ *          the interactive color raster protocol
+ *          The space needed for compression and decompression can be allocated
+ *          statically or dynamically, depending on the DF_DYNAMIC flag, and
+ *          for entire image or part of it (reused) depending on availability
+ *          Accordingly, writing out is whole image, or row by row
+ *          Note that compression is always row by row for RLE.
+ *---------------------------------------------------------------------------*/
+
+intn
+DFputcomp(int32 file_id, uint16 tag, uint16 ref, const uint8 *image, int32 xdim,
+          int32 ydim, uint8 *palette, uint8 *newpal, int16 scheme,
+          comp_info * cinfo)
+{
+    CONSTR(FUNC, "DFputcomp");
+    uint8      *buffer;         /* buffer to hold compressed image */
+    const uint8      *in;       /* pointer to input for compression */
+    uint8      *out;            /* pointer to space for compressed output */
+    int32       cisize;         /* maximum size of compressed image */
+    int32       crowsize;       /* maximum size of compressed row */
+    intn        buftype;        /* buftype = 1: buffer enough for whole image */
+    /* buftype = 2: buffer holds 1 row */
+    int32       n;              /* number of compressed bytes produced */
+    int32       total;          /* total compressed bytes produced so far */
+    int32       i;
+    int32       ret = 0;
+    int32       aid = 0;
+
+    if (!HDvalidfid(file_id) || !tag || !ref || xdim <= 0 || ydim <= 0 || !image)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    switch (scheme)
+      {
+          case DFTAG_RLE:   /* RLE compression (8-bit or 24-bit(?) images */
+              cisize = ydim * (xdim * 121 / 120 + 1);   /* 120 chars can compress to 121! */
+              crowsize = xdim * 121 / 120 + 128;
+
+              /* allocate buffer for compression */
+              buffer = (uint8 *) HDmalloc((uint32) cisize);
+              if (!buffer)
+                {
+                    buffer = (uint8 *) HDmalloc((uint32) crowsize);
+                    if (!buffer)
+                        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+                    buftype = 2;    /* compress and write out row by row */
+                }
+              else  /* can hold whole image, then write */
+                  buftype = 1;
+
+              in = image;
+              out = buffer;
+              n = total = 0;    /* no bytes compressed so far */
+
+              if (buftype == 2)
+                {
+                    int32       num_blocks;
+                    int32       block_length;
+
+                    num_blocks = (ydim > (int32) R8_MAX_BLOCKS) ?
+                        (int32) R8_MAX_BLOCKS : ydim;
+                    block_length = (xdim > (int32) R8_MAX_LENGTH) ?
+                        (int32) R8_MAX_LENGTH : xdim;
+                    aid = HLcreate(file_id, tag, ref, block_length, num_blocks);
+                    if (aid == FAIL)
+                        return FAIL;
+                }
+
+              /* compress row by row */
+              for (i = 0; i < ydim; i++)
+                {
+                    n = DFCIrle(in, out, xdim);     /* compress row */
+                    in += xdim;     /* move input pointer */
+                    total += n;     /* keep running total */
+                    if (buftype == 1)   /* can hold whole image */
+                        out = &buffer[total];   /* move out buffer pointer */
+                    else
+                      {     /* buffer too small, */
+                          /* write out what was produced */
+                          if (Hwrite(aid, n, buffer) == FAIL)
+                            {
+                                ret = FAIL;     /* flag value */
+                                break;
+                            }
+                          out = buffer;     /* reset output pointer */
+                      }
+                }
+
+              if (buftype == 1)
+                {   /* write out entire image */
+                    ret = Hputelement(file_id, tag, ref, buffer, total);
+                    HDfree((VOIDP) buffer);
+                }
+              break;
+
+          case DFTAG_IMC:   /* IMCOMP compression (8-bit images) */
+              if (!palette || !newpal)  /* need palette and newpal */
+                  HRETURN_ERROR(DFE_ARGS, FAIL);
+              cisize = xdim * ydim / 4;     /* IMCOMP always cuts to 1/4 */
+
+              buffer = (uint8 *) HDmalloc((uint32) cisize);
+              if (!buffer)
+                  HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+              DFCIimcomp(xdim, ydim, image, buffer, palette, newpal, 0);
+              ret = Hputelement(file_id, tag, ref, buffer, cisize);
+
+              HDfree((VOIDP) buffer);
+              break;
+
+          case DFTAG_JPEG5:      /* JPEG compression (for 24-bit images) */
+          case DFTAG_GREYJPEG5:      /* JPEG compression (for 8-bit images) */
+              ret = DFCIjpeg(file_id, tag, ref, xdim, ydim, image, scheme, cinfo);
+              break;
+
+          default:      /* unknown compression scheme */
+              HRETURN_ERROR(DFE_BADSCHEME, FAIL)
+      }
+    return ((intn) ret);
+}   /* end DFputcomp() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFgetcomp
+ * Purpose: Read compressed image and decompress it
+ * Inputs:  file_id: HDF file pointer
+ *          tag, ref: id of image to be decompressed
+ *          image: space to return decompressed image in
+ *          xdim, ydim: dimensions of decompressed image
+ *          scheme: compression scheme used
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF programmers, DF8getrig, other routines
+ * Invokes: DFIcheck, DFIfind, DFaccess, DFread, DFCunrle, DFCunimcomp
+ * Remarks: Will use dynamic/static memory allocation for buffer
+ *          will read in image in parts if memory insufficient
+ *          Decompression of rle is not necessarily row by row
+ *          Other encodings can also be decoded with this
+ *---------------------------------------------------------------------------*/
+
+int
+DFgetcomp(int32 file_id, uint16 tag, uint16 ref, uint8 *image, int32 xdim,
+          int32 ydim, uint16 scheme)
+{
+    CONSTR(FUNC, "DFgetcomp");
+    uint8      *buffer;
+    uint8      *in;
+    uint8      *out;
+    int32       cisize, crowsize, buflen, bufleft;  /* bufleft: bytes left in buffer */
+
+    int32       i;
+    int32       totalread;
+    int32       n;
+    int32       aid;
+
+    if (!HDvalidfid(file_id) || !tag || !ref || xdim <= 0 || ydim <= 0 || !image)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* put this call up here instead of in switch statement, to make the */
+    /* code easier to follow */
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+        return (DFCIunjpeg(file_id, tag, ref, (VOIDP) image, xdim, ydim, (int16)scheme));
+
+    /* Only do this stuff for non-JPEG compressed images */
+    aid = Hstartread(file_id, tag, ref);
+    if (aid == FAIL)
+        HRETURN_ERROR(DFE_NOMATCH, FAIL);
+    if (Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, (uint16 *) NULL, &cisize,
+    (int32 *) NULL, (int32 *) NULL, (int16 *) NULL, (int16 *) NULL) == FAIL)
+        return FAIL;
+
+    switch (scheme)
+      {
+          case DFTAG_RLE:
+              crowsize = xdim * 121 / 120 + 128;    /* max size of a row */
+
+              buffer = (uint8 *) HDmalloc((uint32) cisize);
+              if (!buffer)
+                {
+                    buffer = (uint8 *) HDmalloc((uint32) crowsize);
+                    if (!buffer)
+                      {
+                          Hendaccess(aid);
+                          HRETURN_ERROR(DFE_NOSPACE, FAIL)
+                      }     /* end if */
+                    buflen = crowsize;
+                }   /* end if */
+              else
+                  buflen = cisize;
+
+              in = buffer;
+              out = image;
+              if ((n = Hread(aid, buflen, in)) < 0)
+                {
+                    HDfree((VOIDP) buffer);
+                    Hendaccess(aid);
+                    HRETURN_ERROR(DFE_READERROR, FAIL)
+                }   /* end if */
+              totalread = n;
+              bufleft = n;
+              for (i = 0; i < ydim; i++)
+                {
+                    n = DFCIunrle(in, out, xdim, !i);   /* no of bytes used up */
+                    /* last arg=TRUE if i=0 - resets decompress */
+                    in += n;
+                    out += xdim;
+                    bufleft -= n;
+                    /* check if more bytes may be needed for next read */
+                    if ((bufleft < crowsize) && (totalread < cisize))
+                      {
+                          HDmemcpy(buffer, in, (size_t) bufleft);
+                          in = buffer;
+                          if ((n = Hread(aid, buflen - bufleft, (uint8 *) &in[bufleft])) < 0)
+                            {
+                                HDfree((VOIDP) buffer);
+                                Hendaccess(aid);
+                                HRETURN_ERROR(DFE_READERROR, FAIL)
+                            }   /* end if */
+                          totalread += n;
+                          bufleft += n;
+                      }     /* end if */
+                }   /* end for */
+
+              Hendaccess(aid);
+              HDfree((VOIDP) buffer);
+              break;
+
+          case DFTAG_IMC:
+              crowsize = xdim;  /* size of compressed row */
+
+              buffer = (uint8 *) HDmalloc((uint32) cisize);
+              if (!buffer)
+                {
+                    buffer = (uint8 *) HDmalloc((uint32) crowsize);
+                    if (!buffer)
+                      {
+                          Hendaccess(aid);
+                          HRETURN_ERROR(DFE_NOSPACE, FAIL)
+                      }     /* end if */
+                    buflen = crowsize;
+                }   /* end if */
+              else
+                  buflen = cisize;
+              if (buflen >= cisize)
+                {
+                    if (Hread(aid, cisize, buffer) < cisize)
+                      {
+                          HDfree((VOIDP) buffer);
+                          Hendaccess(aid);
+                          HRETURN_ERROR(DFE_READERROR, FAIL)
+                      }     /* end if */
+                    /* HDfree(buffer); */
+                    Hendaccess(aid);
+                    DFCIunimcomp(xdim, ydim, buffer, image);
+                    HDfree((VOIDP) buffer);
+                    break;  /* go to end of switch */
+                }   /* end if */
+
+              in = buffer;  /* if can only read piecemeal */
+              out = image;
+              if ((n = Hread(aid, buflen, in)) < 0)
+                {
+                    HDfree((VOIDP) buffer);
+                    Hendaccess(aid);
+                    HRETURN_ERROR(DFE_READERROR, FAIL)
+                }   /* end if */
+              totalread = n;
+              bufleft = n;
+              for (i = 0; i < ydim; i += 4)
+                {
+                    DFCIunimcomp(xdim, (int32) 4, in, out);
+                    in += xdim;
+                    out += 4 * xdim;
+                    bufleft -= xdim;
+                    if ((bufleft < crowsize) && (totalread < cisize))
+                      {
+                          HDmemcpy(buffer, in, (size_t) bufleft);
+                          in = buffer;
+                          if ((n = Hread(aid, buflen - bufleft, (uint8 *) &in[bufleft])) < 0)
+                            {
+                                HDfree((VOIDP) buffer);
+                                Hendaccess(aid);
+                                HRETURN_ERROR(DFE_READERROR, FAIL)
+                            }   /* end if */
+                          totalread += n;
+                          bufleft += n;
+                      }     /* end if */
+                }   /* end for */
+
+              HDfree((VOIDP) buffer);
+              Hendaccess(aid);
+              break;
+
+          default:      /* unknown scheme */
+              HRETURN_ERROR(DFE_ARGS, FAIL)
+      }     /* end switch */
+
+    return SUCCEED;
+}   /* end DFgetcomp() */
diff --git a/hdf/src/dfconv.c b/hdf/src/dfconv.c
new file mode 100644
index 0000000..184d8c5
--- /dev/null
+++ b/hdf/src/dfconv.c
@@ -0,0 +1,543 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6032 $";
+#endif
+
+/* $Id: dfconv.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+/*------------------------------------------------------------------
+ File:  dfconv.c
+
+ Purpose:
+    Routines to support conversion to and from HDF format
+
+ Invokes:
+
+ PRIVATE conversion functions: All of these are now in seperate files!
+    dfknat.c
+    DFKnb1b -  Native mode for 8 bit integers
+    DFKnb2b -  Native mode for 16 bit integers
+    DFKnb4b -  Native mode for 32 bit integers and floats
+    DFKnb8b -  Native mode for 64 bit floats
+    dfkswap.c
+    DFKsb2b -  Byte swapping for 16 bit integers
+    DFKsb4b -  Byte swapping for 32 bit integers
+    DFKsb8b -  Byte swapping for 64 bit floats
+
+ Other PUBLIC functions:
+    DFKmachineNTsize - Determine size in machine, given number type
+    DFKhdfNTsize     - Determine size in HDF format, given number type
+    DFKsetNT         - Set number type for future conversion calls
+    DFKsetcustom    - Template for user to setup custom conversion
+                      routines
+    DFKisnative     - Checks whether number type is native mode
+    DFKislitend     - Checks whether number type is little-endian mode
+    DFconvert       - provide compatibility with 3.0 routines
+
+ Private functions:
+    DFKInoset    - Indicate that DFKsetNT hasn't been called
+
+ Remarks:
+
+ *------------------------------------------------------------------*/
+
+/*****************************************************************************/
+/*                                                                           */
+/*    All the routines in this file marked as PRIVATE have been marked so    */
+/*  for a reason.  *ANY* of these routines may or may nor be supported in    */
+/*  the next version of HDF (4.00).  Furthurmore, the names, paramters, or   */
+/*  functionality is *NOT* guaranteed to remain the same.                    */
+/*    The *ONLY* guarantee possible is that DFKnumin(), and DFKnumout()      */
+/*  will not change.  They are *NOT* guaranteed to be implemented in the     */
+/*  next version of HDF as function pointers.  They are guaranteed to take   */
+/*  the same arguments and produce the same results.                         */
+/*    If your programs call any routines in this file except for             */
+/*  DFKnumin(), DFKnumout, and/or DFKsetntype(), your code may not work      */
+/*  with future versions of HDF and your code will *NOT* be portable.        */
+/*                                                                           */
+/*****************************************************************************/
+
+#include <ctype.h>
+#include "hdf.h"
+#include "hconv.h"
+
+/*
+   **  Static function prototypes
+ */
+PRIVATE int DFKInoset
+            (VOIDP source, VOIDP dest, uint32 num_elm, uint32 source_stride,
+             uint32 dest_stride);
+
+/* Prototypes */
+extern int32 DFKqueryNT(void);
+extern int DFKsetcustom(
+  int (*DFKcustin) (VOIDP source, VOIDP dest, uint32 num_elm,
+                           uint32 source_stride, uint32 dest_stride),
+  int  (*DFKcustout) (VOIDP source, VOIDP dest, uint32 num_elm,
+                             uint32 source_stride, uint32 dest_stride));
+extern int DFconvert(uint8 *source, uint8 *dest, int ntype, int sourcetype, 
+                     int desttype, int32 size);
+
+/*
+   **  Conversion Routine Pointer Definitions
+ */
+static int	(*DFKnumin)
+            (VOIDP source, VOIDP dest, uint32 num_elm,
+                    uint32 source_stride, uint32 dest_stride) = DFKInoset;
+static int	(*DFKnumout)
+            (VOIDP source, VOIDP dest, uint32 num_elm,
+                    uint32 source_stride, uint32 dest_stride) = DFKInoset;
+
+/************************************************************
+ * If the programmer forgot to call DFKsetntype, then let
+ * them know about it.
+ ************************************************************/
+PRIVATE int
+DFKInoset(VOIDP source, VOIDP dest, uint32 num_elm,
+          uint32 source_stride, uint32 dest_stride)
+{
+    CONSTR(FUNC, "DFKInoset");
+
+    HEclear();
+
+    /* shut the compiler up about not using the arguments */
+    source = source;
+    dest = dest;
+    num_elm = num_elm;
+    source_stride = source_stride;
+    dest_stride = dest_stride;
+
+    /* If this is causing a problem for you, call DFKsetntype */
+    HERROR(DFE_BADCONV);
+    return FAIL;
+}
+
+/*****************************************************************************
+ * Routines that depend on the above information
+ *****************************************************************************/
+
+PRIVATE int32 g_ntype = DFNT_NONE;  /* Holds current number type. */
+                    /* Initially not set.         */
+
+/************************************************************
+* DFKqueryNT()
+*   Determine the current conversion settings
+ ************************************************************/
+int32
+DFKqueryNT(void)
+{
+    return g_ntype;
+}
+
+/************************************************************
+ * DFKNTsize()
+ *   Determine the size, given the number type
+ ************************************************************/
+int
+DFKNTsize(int32 number_type)
+{
+#ifdef LATER
+    CONSTR(FUNC, "DFKNTsize");
+#endif
+
+    /* mask off the litend bit since little endian and big endian have */
+    /* the same size.  Only need to distinguish size difference between */
+    /* HDF and native types. */
+    switch (number_type & (~DFNT_LITEND))
+      {
+	  /* native types */
+          case DFNT_NUCHAR:
+              return (SIZE_NUCHAR);
+          case DFNT_NCHAR:
+              return (SIZE_NCHAR);
+          case DFNT_NINT8:
+              return (SIZE_NINT8);
+          case DFNT_NUINT8:
+              return (SIZE_NUINT8);
+
+          case DFNT_NINT16:
+              return (SIZE_NINT16);
+          case DFNT_NUINT16:
+              return (SIZE_NUINT16);
+
+          case DFNT_NINT32:
+              return (SIZE_NINT32);
+          case DFNT_NUINT32:
+              return (SIZE_NUINT32);
+
+          case DFNT_NFLOAT32:
+              return (SIZE_NFLOAT32);
+
+          case DFNT_NFLOAT64:
+              return (SIZE_NFLOAT64);
+
+	  /* HDF types */
+          case DFNT_UCHAR:
+              return (SIZE_UCHAR);
+          case DFNT_CHAR:
+              return (SIZE_CHAR);
+          case DFNT_INT8:
+              return (SIZE_INT8);
+          case DFNT_UINT8:
+              return (SIZE_UINT8);
+
+          case DFNT_INT16:
+              return (SIZE_INT16);
+          case DFNT_UINT16:
+              return (SIZE_UINT16);
+
+          case DFNT_INT32:
+              return (SIZE_INT32);
+          case DFNT_UINT32:
+              return (SIZE_UINT32);
+
+          case DFNT_FLOAT32:
+              return (SIZE_FLOAT32);
+
+          case DFNT_FLOAT64:
+              return (SIZE_FLOAT64);
+
+	  /* Unknown types */
+          default:
+              break;
+      }     /* switch       */
+    /* hdf default format   */
+    return FAIL;
+}
+
+/************************************************************
+ * DFKsetNT()
+ *   Set the number type for future conversion calls
+ ************************************************************/
+intn
+DFKsetNT(int32 ntype)
+{
+    CONSTR(FUNC, "DFKsetNT");
+
+    HEclear();
+
+    g_ntype = ntype;
+
+    switch (ntype)
+      {
+          case DFNT_CHAR8:
+          case DFNT_UCHAR8:
+          case DFNT_INT8:
+          case DFNT_UINT8:
+              DFKnumin = UI8_IN;
+              DFKnumout = UI8_OUT;
+              break;
+          case DFNT_INT16:
+              DFKnumin = SI16_IN;
+              DFKnumout = SI16_OUT;
+              break;
+          case DFNT_UINT16:
+              DFKnumin = UI16_IN;
+              DFKnumout = UI16_OUT;
+              break;
+          case DFNT_INT32:
+              DFKnumin = SI32_IN;
+              DFKnumout = SI32_OUT;
+              break;
+          case DFNT_UINT32:
+              DFKnumin = UI32_IN;
+              DFKnumout = UI32_OUT;
+              break;
+          case DFNT_FLOAT32:
+              DFKnumin = F32_IN;
+              DFKnumout = F32_OUT;
+              break;
+          case DFNT_FLOAT64:
+              DFKnumin = F64_IN;
+              DFKnumout = F64_OUT;
+              break;
+
+              /*
+               * NATIVE MODE 'CONVERSIONS'
+               */
+          case DFNT_NCHAR:
+          case DFNT_NINT8:
+          case DFNT_NUCHAR:
+          case DFNT_NUINT8:
+              DFKnumin = NUI8_IN;
+              DFKnumout = NUI8_OUT;
+              break;
+          case DFNT_NINT16:
+              DFKnumin = NSI16_IN;
+              DFKnumout = NSI16_OUT;
+              break;
+          case DFNT_NUINT16:
+              DFKnumin = NUI16_IN;
+              DFKnumout = NUI16_OUT;
+              break;
+          case DFNT_NINT32:
+              DFKnumin = NSI32_IN;
+              DFKnumout = NSI32_OUT;
+              break;
+          case DFNT_NUINT32:
+              DFKnumin = NUI32_IN;
+              DFKnumout = NUI32_OUT;
+              break;
+          case DFNT_NFLOAT32:
+              DFKnumin = NF32_IN;
+              DFKnumout = NF32_OUT;
+              break;
+          case DFNT_NFLOAT64:
+              DFKnumin = NF64_IN;
+              DFKnumout = NF64_OUT;
+              break;
+
+              /*
+               * Little Endian Conversions
+               */
+          case DFNT_LCHAR:
+          case DFNT_LINT8:
+          case DFNT_LUCHAR:
+          case DFNT_LUINT8:
+              DFKnumin = LUI8_IN;
+              DFKnumout = LUI8_OUT;
+              break;
+          case DFNT_LINT16:
+              DFKnumin = LSI16_IN;
+              DFKnumout = LSI16_OUT;
+              break;
+          case DFNT_LUINT16:
+              DFKnumin = LUI16_IN;
+              DFKnumout = LUI16_OUT;
+              break;
+          case DFNT_LINT32:
+              DFKnumin = LSI32_IN;
+              DFKnumout = LSI32_OUT;
+              break;
+          case DFNT_LUINT32:
+              DFKnumin = LUI32_IN;
+              DFKnumout = LUI32_OUT;
+              break;
+          case DFNT_LFLOAT32:
+              DFKnumin = LF32_IN;
+              DFKnumout = LF32_OUT;
+              break;
+          case DFNT_LFLOAT64:
+              DFKnumin = LF64_IN;
+              DFKnumout = LF64_OUT;
+              break;
+
+/* No conversion routines are specified for DFNT_custom.  User must provide. */
+/* Users should call DFCV_SetCustomIn() and DFCV_SetCustomOut() if they      */
+/* choose to use DFNT_CUSTOM.  Users should provide their own method to      */
+/* distinguish between multiple 'custom' conversion routines.  HDF only      */
+/* knows such routines as type 'DFNT_CUSTOM'.                                */
+
+          case DFNT_CUSTOM:
+              g_ntype = DFNT_CUSTOM;
+              break;
+          default:
+              HRETURN_ERROR(DFE_BADCONV,FAIL)
+      }
+  return 0;
+}
+
+/*****************************************************************************
+ * The following routine provides an easy method for the user to setup custom
+ * conversion routines....
+ *****************************************************************************/
+int
+DFKsetcustom(
+  int         (*DFKcustin) (VOIDP /* source */, VOIDP /* dest */, uint32 /* num_elm */,
+                                 uint32 /* source_stride */, uint32 /* dest_stride */),
+ int         (*DFKcustout) (VOIDP /* source */, VOIDP /* dest */, uint32 /* num_elm */,
+                                   uint32 /* source_stride */, uint32 /* dest_stride */)
+)
+{
+    DFKnumin = DFKcustin;
+    DFKnumout = DFKcustout;
+    DFKsetNT(DFNT_CUSTOM);  /* Keep HDF from getting confused */
+    return 0;
+}
+
+/*------------------------------------------------------------------
+ * Name:    DFKisnativeNT
+ * Purpose: Determine whether number type is native mode
+ * Inputs:  numbertype: number type
+ * Returns: 1 if true, 0 if false
+ * Users:   DFSDgetslice
+ * Method:  Checks to see if the "native mode" bit is set
+ * Remarks:
+ *------------------------------------------------------------------*/
+
+int32
+DFKisnativeNT(int32 numbertype)
+{
+    return ((DFNT_NATIVE & numbertype) > 0 ? 1 : 0);
+}
+
+/*------------------------------------------------------------------
+ * Name:    DFKislitendNT
+ * Purpose: Determine whether number type is little-endian mode
+ * Inputs:  numbertype: number type
+ * Returns: 1 if true, 0 if false
+ * Users:   DFSDgetslice
+ * Method:  Checks to see if the "native mode" bit is set
+ * Remarks:
+ *------------------------------------------------------------------*/
+
+int32
+DFKislitendNT(int32 numbertype)
+{
+    return ((DFNT_LITEND & numbertype) > 0 ? 1 : 0);
+}
+
+/************************************************************
+ * DFconvert()
+ *
+ * This routine is called by HDF version 3.0 compatibility
+ * routines.  It serves as a jump point to the new version 4.0
+ * comversion functions.  DFconvert() CANNOT be used by Vdata
+ * applications because it assumes a stride of 1 (for
+ * compatibility). Vdata routines should call DFnum_in() and
+ * DFKnumout() (depending on which translation is needed)
+ *
+ * uint8 * source    location where the data is stored
+ * uint8 * dest      location to put the converted data
+ * int  * ntype       the overall number type of the data, ie DFNT_FLOAT...
+ * int  * sourcetype  the specific type of the source data, ie DFNTF_IEEE...
+ * int  * desttype    the specifid type of the converted data, ie DFNTF_VAX...
+ * int  * size        the number (total) of BYTES to convert
+ ************************************************************/
+int
+DFconvert(uint8 *source, uint8 *dest, int ntype, int sourcetype, int desttype,
+          int32 size)
+{
+    uint32 num_elm;
+    CONSTR(FUNC, "DFconvert");
+
+    HEclear();
+
+    if (DFKsetNT(ntype) == FAIL)
+      {
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    if (sourcetype == desttype)
+      {
+          HDmemcpy(dest, source, size);
+          return 0;
+      }
+
+    num_elm = (uint32)size / 4;
+
+/* Check to see if they want to covert numbers in from the disk */
+    if (sourcetype == DFNTF_IEEE && (desttype == DFNTF_VAX ||
+                                     desttype == DFNTF_CRAY ||
+                                     desttype == DFNTF_PC))
+        return (DFKnumin) ((VOIDP) source, (VOIDP) dest, num_elm, 0, 0);
+
+/* Check to see if they want to convert numbers out to disk */
+    if (desttype == DFNTF_IEEE && (sourcetype == DFNTF_VAX ||
+                                   sourcetype == DFNTF_CRAY ||
+                                   sourcetype == DFNTF_PC))
+        return DFKnumout((VOIDP) source, (VOIDP) dest, num_elm, 0, 0);
+
+/* Return an error because they did not specify valid translation codes */
+    HERROR(DFE_BADCONV);
+    return FAIL;
+}
+
+/*------------------------------------------------------------------
+ * Name:    DFKgetPNSC
+ * Purpose: Get PlatformNumberSubclass for a given number type
+ * Inputs:  numtype: number type to get subclass for
+ *          machinetype: machine-type code
+ * Returns: PlatformNumberSubclass on success, FAIL on failure with
+ *          error set
+ * Users:   DFSDgetslice
+ * Method:  Checks NT_TYPES to determine whether it is a char, int, or
+ *          float, then looks in corresponding field of machine type
+ *          (DFMT) to get the class.
+ * Remarks:
+ *------------------------------------------------------------------*/
+
+int8
+DFKgetPNSC(int32 numbertype, int32 machinetype)
+{
+    CONSTR(FUNC, "DFKgetPNSC");
+
+    /* clear error stack and validate args */
+    HEclear();
+
+    /* Since the information is provided only for the 4 */
+    /* classes of char, int, float, double and is indenpend */
+    /* of whether it is stored native or little-endian in file, */
+    /* we will use only the standard HDF format information */
+    switch (numbertype & DFNT_MASK)
+      {
+          case DFNT_CHAR8:
+          case DFNT_UCHAR8:
+              return (int8) (machinetype & 0x0f);
+
+          case DFNT_INT8:
+          case DFNT_UINT8:
+          case DFNT_INT16:
+          case DFNT_UINT16:
+          case DFNT_INT32:
+          case DFNT_UINT32:
+              return (int8) ((machinetype >> 4) & 0x0f);
+
+          case DFNT_FLOAT32:
+              return (int8) ((machinetype >> 8) & 0x0f);
+
+          case DFNT_FLOAT64:
+              return (int8) ((machinetype >> 12) & 0x0f);
+
+          default:
+	      HRETURN_ERROR(DFE_BADNUMTYPE, FAIL);
+      }
+}
+
+/*----------------------------------------------------------------------------
+* Name: DFKconvert
+* Purpose: set number type and do the convert
+* Inputs:  source -- location where the data is stored
+*      dest -- location to put the converted data
+*      ntype -- the current number type
+*      num_elm -- number of elements to be converted
+*      acc_mode -- DFACC_READ for numin, DFACC_WRITE for numout
+*      source_stride, dest_stride -- strides in source and destination
+* Returns: 0 -- succeed; FAIL -- failure
+* Users:   DFSDgetsdg, DFSDputsdg, DFSDIgetslice, DFSDIgetslice
+* Method:  Calls DFKsetNT, then call DFnumin or DFnumout
+*---------------------------------------------------------------------------*/
+int32
+DFKconvert(VOIDP source, VOIDP dest, int32 ntype, int32 num_elm,
+           int16 acc_mode, int32 source_stride, int32 dest_stride)
+{
+    int         ret;
+
+    /* Check args (minimally) */
+    if (source==NULL || dest==NULL)
+        return(-1);
+
+    DFKsetNT(ntype);
+    if (acc_mode == DFACC_READ)
+        ret = DFKnumin(source, dest, (uint32)num_elm, (uint32)source_stride, (uint32)dest_stride);
+    else
+        ret = DFKnumout(source, dest, (uint32)num_elm, (uint32)source_stride, (uint32)dest_stride);
+    return (ret);
+}
+
+/*****************************************************************************
+ * Miscellaneous Other Conversion Routines
+ *****************************************************************************/
diff --git a/hdf/src/dfconvrt.h b/hdf/src/dfconvrt.h
new file mode 100644
index 0000000..87d1599
--- /dev/null
+++ b/hdf/src/dfconvrt.h
@@ -0,0 +1,101 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfconvrt.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/* In order to speed the conversion process, eliminate a layer of function
+ * calls by making DFconvert into a macro.
+ * Peter Webb, Oct 11, 1989
+ */
+#ifndef DFCONVRT_H
+#define DFCONVRT_H
+
+#ifndef FUNC_CONV
+/* This is the default */
+/* using the DFconvert macro instead of function */
+#define DFconvert(src,dest,ntype,stype,dtype,size,status)\
+{ char *s=(src), *d=(dest);\
+  int nt=(ntype), st=(stype), dt=(dtype);\
+  int sz=((int)size);\
+  if (nt==DFNT_FLOAT) {\
+    if ((st==DFNTF_IEEE && dt==DFNTF_PC) ||\
+        (st==DFNTF_PC && dt==DFNTF_IEEE)) {\
+      int32 i;\
+      for (i=0;i<sz*4;i+=4) {\
+        d[i] = s[i+3];\
+        d[i+1] = s[i+2];\
+        d[i+2] = s[i+1];\
+        d[i+3] = s[i];\
+      }\
+      status=0;\
+    } else {\
+      if (st==DFNTF_PC) {\
+        int i;\
+        char t;\
+        for (i=0;i<sz*4;i+=4) {\
+          t = s[i];\
+          s[i] = s[i+3];\
+          s[i+3] = t;\
+          t = s[i+1];\
+          s[i+1] = s[i+2];\
+          s[i+2] = t;\
+        }\
+        st=DFNTF_IEEE;\
+      }\
+      if (st==DFNTF_IEEE && dt==DFNTF_CRAY) {\
+    int i=1;\
+        SCUP32(s,d,&sz,&i);\
+      } else if (st==DFNTF_CRAY && (dt==DFNTF_IEEE || dt==DFNTF_PC)) {\
+    int i=1;\
+        CSPK32(s,d,&sz,&i);\
+      } else if (st==DFNTF_IEEE && dt==DFNTF_VAX) {\
+        status = DFCVieeeF2vaxF((union float_uint_uchar *)s,(union float_uint_uchar *)d,sz);\
+      } else if (st==DFNTF_VAX && (dt==DFNTF_IEEE || dt==DFNTF_PC)) {\
+        status = DFCVvaxF2ieeeF((union float_uint_uchar *)s,(union float_uint_uchar *)d,sz);\
+      } else {\
+        status = -1;\
+      }\
+      if (dt==DFNTF_PC) {\
+        int i;\
+        char t;\
+        for (i=0;i<sz*4;i+=4) {\
+          t = d[i];\
+          d[i] = d[i+3];\
+          d[i+3] = t;\
+          t = d[i+1];\
+          d[i+1] = d[i+2];\
+          d[i+2] = t;\
+        }\
+      }\
+      if ((stype)==DFNTF_PC) {\
+        int i;\
+        char t;\
+        for (i=0;i<sz*4;i+=4) {\
+          t = s[i];\
+          s[i] = s[i+3];\
+          s[i+3] = t;\
+          t = s[i+1];\
+          s[i+1] = s[i+2];\
+          s[i+2] = t;\
+        }\
+        st=DFNTF_IEEE;\
+      }\
+    }\
+  } else {\
+  status = -1;\
+  }\
+  if (status == -1) HERROR(DFE_BADCONV);\
+}
+#endif /* !FUNC_CONV */
+
+#endif /* !DFCONVRT_H */
diff --git a/hdf/src/dff.c b/hdf/src/dff.c
new file mode 100644
index 0000000..f9813d7
--- /dev/null
+++ b/hdf/src/dff.c
@@ -0,0 +1,439 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dff.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfF.c
+ * Purpose: C stubs for Fortran low level routines
+ * Invokes: dfF.c
+ * Contents:
+ *  dfiopen:   call DFopen to open HDF file
+ *  dfclose:   call DFclose to close HDF file
+ *  dfdesc:    call DFdescriptors to get contents of DDs
+ *  dfdup:     call DFdup to create additional DD for item
+ *  dfdel:     call DFdel to delete DD of item
+ *  dfiaccess: call DFaccess to set up access to item
+ *  dfstart:   call DFaccess to set up access to item
+ *  dfread:    call DFread to read part of item
+ *  dfseek:    call DFseek to move to offset within item
+ *  dfwrite:   call DFwrite to write part of item
+ *  dfupdate:  call DFupdate to write out changes
+ *  dfget:     call DFgetelement to read item
+ *  dfput:     call DFputelement to write item
+ *  dfsfind:   call DFsetfind to set up search
+ *  dffind:    call DFfind to find next matching item
+ *  dferrno:   call DFerrno to return value of DFerror
+ *  dfnewref:  call DFnewref to get unused ref no
+ *  dfnumber:  call DFnumber to get number of occurrances of given tag
+ *  dfstat:    call DFstat to get status info on file
+ *  dfiishdf:  call DFishdf to get HDF string
+ *---------------------------------------------------------------------------*/
+#include "df.h"
+
+#include "hproto_fortran.h"
+/*-----------------------------------------------------------------------------
+ * Name:    dfiopen
+ * Purpose: call DFopen to open HDF file
+ * Inputs:  name: name of file to open
+ *      acc_mode: access mode - integer with value DFACC_READ etc.
+ *      defdds: default number of DDs per header block
+ *      namelen: length of name
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFopen
+ * Method:  Convert filename to C string, call DFopen
+ * Note: DFopen actually return *DF.  In machines that a pointer
+ *       is bigger than a Fortran INTEGER, this routine would fail.
+ *       This is a design error and has no easy portable solution.
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfiopen(_fcd name, intf * acc_mode, intf * defdds, intf * namelen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = DFIf2cstring(name, (intn) *namelen);
+    /* For compiler warning, see note above. */
+    ret = (intf) DFopen(fn, (intn) *acc_mode, (intn) *defdds);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfclose
+ * Purpose: Call DFclose to close HDF file
+ * Inputs:  dfile: pointer to HDF file to close
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFclose
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfclose(intf * dfile)
+{
+    return (DFclose((DF *) * dfile));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfdesc
+ * Purpose: Call DFdescriptors to obtain descriptors
+ * Inputs:  dfile: pointer to HDF file
+ *          ptr: pointer to array of size >= (4, num) to put descriptors in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFdesc
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfdesc(intf * dfile, intf ptr[][4], intf * begin, intf * num)
+{
+    CONSTR(FUNC, "dfdesc");
+    DFdesc     *ptr1;
+    int         i;
+    intf        num_desc;
+
+    /* allocate temporary space */
+    if ((ptr1 = (DFdesc *) HDmalloc((uint32) *num * sizeof(DFdesc))) == NULL)
+      HRETURN_ERROR(DFE_NOSPACE, -1);
+	      ;
+    num_desc = DFdescriptors((DF *) * dfile, ptr1, (intn) *begin, (intn) *num);
+
+    /* copy ptr1 array  ptr; note row/column inversion */
+    for (i = 0; i < num_desc; i++)
+      {
+          ptr[i][0] = (int32) ptr1[i].tag;
+          ptr[i][1] = (int32) ptr1[i].ref;
+          ptr[i][2] = ptr1[i].offset;
+          ptr[i][3] = ptr1[i].length;
+      }
+
+    HDfree((VOIDP) ptr1);
+
+    return (num_desc);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfdup
+ * Purpose: Call DFdup to create additional DD for item
+ * Inputs:  dfile: pointer to HDF file
+ *          tag, ref: attributes of new DD to add
+ *          otag, oref: attributes of item to point to
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFdup
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfdup(intf * dfile, intf * tag, intf * ref, intf * otag, intf * oref)
+{
+    return (DFdup((DF *) * dfile, (uint16) *tag, (uint16) *ref, (uint16) *otag,
+                  (uint16) *oref));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfdel
+ * Purpose: Call DFdel to delete DD of item
+ * Inputs:  dfile: pointer to HDF file
+ *          tag, ref: attributes of DD to delete
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFdel
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfdel(intf * dfile, intf * tag, intf * ref)
+{
+    return (DFdel((DF *) * dfile, (uint16) *tag, (uint16) *ref));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfiaccess
+ * Purpose: Call DFaccess to set up access to item
+ * Inputs:  dfile: pointer to HDF file
+ *          tag, ref: attributes of item to access
+ *          acc_mode: access mode
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFaccess
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfiaccess(intf * dfile, intf * tag, intf * ref, _fcd acc_mode, intf * acclen)
+{
+    char       *acc;
+    intf        ret;
+
+    acc = DFIf2cstring(acc_mode, (intn) *acclen);
+    ret = (intf) DFaccess((DF *) * dfile, (uint16) *tag, (uint16) *ref, acc);
+    HDfree((VOIDP) acc);
+    return (ret);
+}
+
+#if 0
+/*-----------------------------------------------------------------------------
+ * Name:    dfstart
+ * Purpose: Call DFaccess to set up access to item
+ * Inputs:  dfile: pointer to HDF file
+ *          tag, ref: attributes of item to access
+ *          acc_mode: access mode
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFaccess
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfstart(intf * dfile, intf * tag, intf * ref, char *acc_mode)
+{
+    return (DFaccess((DF *) * dfile, (uint16) *tag, (uint16) *ref, acc_mode));
+}
+#endif /* 0 */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfread
+ * Purpose: Call DFread to read part of item
+ * Inputs:  dfile: pointer to HDF file
+ *          ptr: pointer to space to read item into
+ *          len: number of bytes to read
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFread
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfread(intf * dfile, _fcd ptr, intf * len)
+{
+    return (DFread((DF *) * dfile, (char *) _fcdtocp(ptr), *len));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfseek
+ * Purpose: Call DFseek to move to offset within item
+ * Inputs:  dfile: pointer to HDF file
+ *      offset: number of bytes from beginning of item to move to
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFseek
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfseek(intf * dfile, intf * offset)
+{
+    return (DFseek((DF *) * dfile, *offset));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfwrite
+ * Purpose: Call DFwrite to write part of item
+ * Inputs:  dfile: pointer to HDF file
+ *      ptr: pointer to data to write
+ *      len: number of bytes to write
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFwrite
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfwrite(intf * dfile, _fcd ptr, intf * len)
+{
+    return (DFwrite((DF *) * dfile, (char *) _fcdtocp(ptr), *len));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfupdate
+ * Purpose: Call DFupdate to write out changes
+ * Inputs:  dfile: pointer to HDF file
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFupdate
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfupdate(intf * dfile)
+{
+    return (DFupdate((DF *) * dfile));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfget
+ * Purpose: Call DFget to read an element
+ * Inputs:  dfile: pointer to HDF file
+ *      tag, ref: pointer to item to read
+ *      ptr: space to read item into
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFgetelement
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfget(intf * dfile, intf * tag, intf * ref, _fcd ptr)
+{
+    return (DFgetelement((DF *) * dfile, (uint16) *tag, (uint16) *ref,
+                         (char *) _fcdtocp(ptr)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfput
+ * Purpose: Call DFput to write an element
+ * Inputs:  dfile: pointer to HDF file
+ *      tag, ref: attributes of item to write
+ *      ptr: item to write
+ *      len: size of item
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFputelement
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfput(intf * dfile, intf * tag, intf * ref, _fcd ptr, intf * len)
+{
+    return (DFputelement((DF *) * dfile, (uint16) *tag, (uint16) *ref,
+                         (char *) _fcdtocp(ptr), *len));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsfind
+ * Purpose: Call DFsetfind to set up search
+ * Inputs:  dfile: pointer to HDF file
+ *      tag, ref: attributes of item to find
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFsetfind
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsfind(intf * dfile, intf * tag, intf * ref)
+{
+    return (DFsetfind((DF *) * dfile, (uint16) *tag, (uint16) *ref));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dffind
+ * Purpose: Call DFfind to find next match
+ * Inputs:  dfile: pointer to HDF file
+ *      itag, iref: attributes of item found
+ *      len: size of item
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFfind
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndffind(intf * dfile, intf * itag, intf * iref, intf * len)
+{
+    CONSTR(FUNC, "dffind");
+    DFdesc     *ptr1;
+    intf        ret;
+
+    ptr1 = (DFdesc *) HDmalloc((uint32) sizeof(DFdesc));
+    if (ptr1 == NULL)
+	HRETURN_ERROR(DFE_NOSPACE, -1);
+    ret = DFfind((DF *) * dfile, ptr1);
+
+    *itag = (int32) (ptr1->tag);
+    *iref = (int32) (ptr1->ref);
+    *len = ptr1->length;
+
+    HDfree((VOIDP) ptr1);
+
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dferrno
+ * Purpose: Call DFerrno to get value of DFerror
+ * Inputs:  none
+ * Returns: value of DFerror
+ * Users:   HDF Fortran programmers
+ * Invokes: DFerrno
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndferrno(void)
+{
+    return (DFerrno());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfnewref
+ * Purpose: Call DFnewref to get unused ref no
+ * Inputs:  dfile: pointer to HDF file
+ * Returns: int16: unused ref no
+ * Users:   HDF Fortran programmers
+ * Invokes: DFnewref
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfnewref(intf * dfile)
+{
+    return ((intf)DFnewref((DF *) * dfile));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfnumber
+ * Purpose: Call DFnumber to get unused ref no
+ * Inputs:  dfile: pointer to HDF file
+ *      tag:   pointer to (int16)tag to count
+ * Returns: int: number of occurances of given tag
+ * Users:   HDF Fortran programmers
+ * Invokes: DFnumber
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfnumber(intf * dfile, intf * tag)
+{
+    return (DFnumber((DF *) * dfile, (uint16) *tag));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfstat
+ * Purpose: Call DFstat to get staus info on file
+ * Inputs:  dfile:  pointer to HDF file
+ *      dfinfo: pointer to DFdata structure to fill in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFstat
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfstat(intf * dfile, DFdata * dfinfo)
+{
+    return (DFstat((DF *) * dfile, dfinfo));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfiishdf
+ * Purpose: Call DFishdf to test file
+ * Inputs:  name:    name of file to test
+ *      namelen: pointer to variable containing length of name string
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFishdf
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfiishdf(_fcd name, intf * namelen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = DFIf2cstring(name, (intn) *namelen);
+    ret = DFishdf(fn);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
diff --git a/hdf/src/dfff.f b/hdf/src/dfff.f
new file mode 100644
index 0000000..fc5f09c
--- /dev/null
+++ b/hdf/src/dfff.f
@@ -0,0 +1,81 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: dfff.f 4932 2007-09-07 17:17:23Z bmribler $ 
+C
+C------------------------------------------------------------------------------
+C File:     dfFf.f
+C Purpose:  Fortran stubs for Fortran low level i/o routines
+C Invokes:  dfF.c dfkit.c
+C Contents: 
+C   dfopen:     call dfiopen to open HDF file
+C   dfishdf:    call dfiishdf to find is file is HDF
+C -----------------------------------------------------------------------------
+
+C------------------------------------------------------------------------------
+C Name:     dfopen
+C Purpose:  call dfiopen to open HDF file
+C Inputs:   name: name of HDF file to open
+C           access: integer for access mode: DFACC_READ etc.
+C           defdds: default number of DDs per header block
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dfiopen
+C------------------------------------------------------------------------------
+
+
+      integer function dfopen(name, access, defdds)
+      character*(*) name
+      integer access, defdds, dfiopen
+
+      dfopen = dfiopen(name, access, defdds, len(name))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name:    dfaccess
+C Purpose: call dfiaccess to set up access to a data element
+C Inputs:  dfile: pointer to open HDF file
+C          tag: tag of element to access
+C          ref: ref of element to access
+C          access: access mode requested
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:   HDF FORTRAN programmers
+C Invokes: dfiaccess
+C------------------------------------------------------------------------------
+
+      integer function dfaccess(dfile, tag, ref, access)
+      character*(*) access
+      integer dfile, tag, ref, dfiaccess
+
+      dfaccess = dfiaccess(dfile, tag, ref, access, len(access))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name:     dfishdf
+C Purpose:  call dfiishdf to test file
+C Inputs:   name: name of file to test
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dfiishdf
+C------------------------------------------------------------------------------
+
+
+      integer function dfishdf(name)
+      character*(*) name
+      integer dfiishdf
+
+      dfishdf = dfiishdf(name, len(name))
+      return
+      end
diff --git a/hdf/src/dffunc.inc b/hdf/src/dffunc.inc
new file mode 100644
index 0000000..48232a2
--- /dev/null
+++ b/hdf/src/dffunc.inc
@@ -0,0 +1,705 @@
+C****************************************************************************
+C* NCSA HDF                                                                 *
+C* Software Development Group                                               *
+C* National Center for Supercomputing Applications                          *
+C* University of Illinois at Urbana-Champaign                               *
+C* 605 E. Springfield, Champaign IL 61820                                   *
+C*                                                                          *
+C* For conditions of distribution and use, see the accompanying             *
+C* hdf/COPYING file.                                                        *
+C*                                                                          *
+C****************************************************************************
+C
+C $Id: dffunc.inc 6034 2014-01-19 06:59:14Z epourmal $
+C
+C     dffunc.inc
+C
+C     Declarations of return values for HDF SDS functions
+C
+      integer  DFSDadddata,         dsadata
+      external DFSDadddata,         dsadata
+      integer  DFSDclear,           dsclear
+      external DFSDclear,           dsclear
+      integer  DFSDsetdimscale,     dssdisc
+      external DFSDsetdimscale,     dssdisc
+      integer  DFSDendslice,        dseslc
+      external DFSDendslice,        dseslc
+      integer  DFSDgetNT,           dsgnt
+      external DFSDgetNT,           dsgnt
+      integer  DFSDgetdata,         dsgdata
+      external DFSDgetdata,         dsgdata
+      integer  DFSDgetdatalen,      dsgdaln
+      external DFSDgetdatalen,      dsgdaln
+      integer  DFSDgetdatastrs,     dsgdast
+      external DFSDgetdatastrs,     dsgdast
+      integer  DFSDgetdimlen,       dsgdiln
+      external DFSDgetdimlen,       dsgdiln
+      integer  DFSDgetdims,         dsgdims
+      external DFSDgetdims,         dsgdims
+      integer  DFSDgetdimscale,     dsgdisc
+      external DFSDgetdimscale,     dsgdisc
+      integer  DFSDgetdimstrs,      dsgdist
+      external DFSDgetdimstrs,      dsgdist
+      integer  DFSDgetrange,        dsgrang
+      external DFSDgetrange,        dsgrang
+      integer  DFSDgetslice,        dsgslc
+      external DFSDgetslice,        dsgslc
+      integer  DFSDlastref,         dslref
+      external DFSDlastref,         dslref
+      integer  DFSDnumber,          dsnum
+      external DFSDnumber,          dsnum
+      integer  DFSDputdata,         dspdata
+      external DFSDputdata,         dspdata
+      integer  DFSDputslice,        dspslc
+      external DFSDputslice,        dspslc
+      integer  DFSDreadref,         dsrref
+      external DFSDreadref,         dsrref
+      integer  DFSDrestart,         dsfirst
+      external DFSDrestart,         dsfirst
+      integer  DFSDsetNT,           dssnt
+      external DFSDsetNT,           dssnt
+      integer  DFSDsetdatastrs,     dssdast
+      external DFSDsetdatastrs,     dssdast
+      integer  DFSDsetdims,         dssdims
+      external DFSDsetdims,         dssdims
+      integer  DFSDsetdimstrs,      dssdist
+      external DFSDsetdimstrs,      dssdist
+      integer  DFSDsetlengths,      dsslens
+      external DFSDsetlengths,      dsslens
+      integer  DFSDsetrange,        dssrang
+      external DFSDsetrange,        dssrang
+      integer  DFSDstartslice,      dssslc
+      external DFSDstartslice,      dssslc
+      integer  dsgcal
+      external dsgcal
+      integer  dsp32sd
+      external dsp32sd
+      integer  dsscal
+      external dsscal
+      integer  dseslab
+      external dseslab
+      integer  dsrslab
+      external dsrslab
+      integer  dssslab
+      external dssslab
+      integer  dswslab
+      external dswslab
+      integer  dsgfill
+      external dsgfill
+      integer  dssfill
+      external dssfill
+      integer  dswref
+      external dswref
+C
+C     Declarations of return values for HDF Annotation functions
+C
+      integer  DFANputlabel,     daplab
+      external DFANputlabel,     daplab
+      integer  DFANputdesc,      dapdesc
+      external DFANputdesc,      dapdesc
+      integer  DFANgetlablen,    dagllen
+      external DFANgetlablen,    dagllen
+      integer  DFANgetlabel,     daglab
+      external DFANgetlabel,     daglab
+      integer  DFANgetdesclen,   dagdlen
+      external DFANgetdesclen,   dagdlen
+      integer  DFANgetdesc,      dagdesc
+      external DFANgetdesc,      dagdesc
+      integer  DFANlablist,      dallist
+      external DFANlablist,      dallist
+      integer  DFANaddfid,       daafid
+      external DFANaddfid,       daafid
+      integer  DFANaddfds,       daafds
+      external DFANaddfds,       daafds
+      integer  DFANgetfidlen,    dagfidl
+      external DFANgetfidlen,    dagfidl
+      integer  DFANgetfid,       dagfid
+      external DFANgetfid,       dagfid
+      integer  DFANgetfdslen,    dagfdsl
+      external DFANgetfdslen,    dagfdsl
+      integer  DFANgetfds,       dagfds
+      external DFANgetfds,       dagfds
+      integer  DFANlastref,      dalref
+      external DFANlastref,      dalref
+      integer  daclear
+      external daclear
+C
+C     Declarations of return values for HDF Raster Image functions
+C
+      integer  DFR8setpalette,          d8spal
+      external DFR8setpalette,          d8spal
+      integer  DFR8putimage,            d8pimg
+      external DFR8putimage,            d8pimg
+      integer  DFR8addimage,            d8aimg
+      external DFR8addimage,            d8aimg
+      integer  DFR8getdims,             d8gdims
+      external DFR8getdims,             d8gdims
+      integer  DFR8getimage,            d8gimg
+      external DFR8getimage,            d8gimg
+      integer  DFR8readref,             d8rref
+      external DFR8readref,             d8rref
+      integer  DFR8writeref,            d8wref
+      external DFR8writeref,            d8wref
+      integer  DFR8restart,             d8first
+      external DFR8restart,             d8first
+      integer  DFR8nimages,             d8nims
+      external DFR8nimages,             d8nims
+      integer  DFR8lastref,             d8lref
+      external DFR8lastref,             d8lref
+      integer  DFR8scompress,           d8scomp
+      external DFR8scompress,           d8scomp
+      integer  DFR8sjpeg,               d8sjpeg
+      external DFR8sjpeg,               d8sjpeg
+
+      integer  DF24setil,               d2setil
+      external DF24setil,               d2setil
+      integer  DF24addimage,            d2aimg
+      external DF24addimage,            d2aimg
+      integer  DF24putimage,            d2pimg
+      external DF24putimage,            d2pimg
+      integer  DF24getimage,            d2gimg
+      external DF24getimage,            d2gimg
+      integer  DF24getdims,             d2gdims
+      external DF24getdims,             d2gdims
+      integer  DF24setdims,             d2sdims
+      external DF24setdims,             d2sdims
+      integer  DF24readref,             d2rref
+      external DF24readref,             d2rref
+      integer  DF24restart,             d2first
+      external DF24restart,             d2first
+      integer  DF24reqil,               d2reqil
+      external DF24reqil,               d2reqil
+      integer  d2lref
+      external d2lref
+      integer  DF24scompress,           d2scomp
+      external DF24scompress,           d2scomp
+      integer  DF24sjpeg,               d2sjpeg
+      external DF24sjpeg,               d2sjpeg
+
+      integer  DFPaddpal,               dpapal
+      external DFPaddpal,               dpapal
+      integer  DFPgetpal,               dpgpal
+      external DFPgetpal,               dpgpal
+      integer  DFPputpal,               dpppal
+      external DFPputpal,               dpppal
+      integer  DFPnpals,                dpnpals
+      external DFPnpals,                dpnpals
+      integer  DFPwriteref,             dpwref
+      external DFPwriteref,             dpwref
+      integer  DFPreadref,              dprref
+      external DFPreadref,              dprref
+      integer  DFPrestart,              dprest
+      external DFPrestart,              dprest
+      integer  DFPlastref,              dplref
+      external DFPlastref,              dplref
+
+C
+C     Declarations of return values for HDF Raster Image functions
+C
+      integer  DFopen
+      external DFopen
+      integer  DFclose
+      external DFclose
+      integer  DFsfind
+      external DFsfind
+      integer  DFfind
+      external DFfind
+      integer  DFget
+      external DFget
+      integer  DFput
+      external DFput
+      integer  DFaccess
+      external DFaccess
+      integer  DFread
+      external DFread
+      integer  DFwrite
+      external DFwrite
+      integer  DFseek
+      external DFseek
+      integer  DFupdate
+      external DFupdate
+      integer  DFdup
+      external DFdup
+      integer  DFdel
+      external DFdel
+      integer  DFerrno
+      external DFerrno
+      integer  DFishdf
+      external DFishdf
+      integer  DFnewref
+      external DFnewref
+      integer  DFnumber
+      external DFnumber
+      integer  DFstat
+      external DFstat
+
+C
+C     Declarations of return values for HDF Vgroup functions
+C
+      integer  vfadtr 
+      external vfadtr 
+      integer  vfainfo
+      external vfainfo
+      integer  vfatch
+      external vfatch
+      integer  vfdtch
+      external vfdtch
+      integer  vfdtr
+      external vfdtr
+      integer  vfend
+      external vfend
+      integer  vfents
+      external vfents
+      integer  vffdatt
+      external vffdatt
+      integer  vffloc
+      external vffloc
+      integer  vfgnatt
+      external vfgnatt
+      integer  vfgcatt
+      external vfgcatt
+      integer  vfgcls
+      external vfgcls
+      integer  vfgid
+      external vfgid
+      integer  vfgnam
+      external vfgnam
+      integer  vfgnxt
+      external vfgnxt
+      integer  vfgttr
+      external vfgttr
+      integer  vfgttrs
+      external vfgttrs
+      integer  vfgver
+      external vfgver
+      integer  vfind
+      external vfind
+      integer  vfinq
+      external vfinq
+      integer  vfinqtr
+      external vfinqtr
+      integer  vfinsrt
+      external vfinsrt
+      integer  vfisvg
+      external vfisvg
+      integer  vfisvs
+      external vfisvs
+      integer  vflone
+      external vflone
+      integer  vfnatts
+      external vfnatts
+      integer  vfntr
+      external vfntr
+      integer  vfsnatt
+      external vfsnatt
+      integer  vfscatt
+      external vfscatt
+      integer  vfscls
+      external vfscls
+      integer  vfsnam
+      external vfsnam
+      integer  vfstart
+      external vfstart
+      integer  vfgvgroups
+      external vfgvgroups
+
+C
+C     Declarations of return values for HDF high level Vdata/Vgroup
+C     functions
+C
+      integer  vhfmkgp
+      external vhfmkgp
+      integer  vhfscd
+      external vhfscd
+      integer  vhfsd
+      external vhfsd
+      integer  vhfscdm
+      external vhfscdm
+      integer  vhfsdm
+      external vhfsdm
+
+C
+C     Declarations of return values for HDF Vdata functions
+C
+      integer  vsfainf
+      external vsfainf
+      integer  vsfatch
+      external vsfatch
+      integer  vsfcpak
+      external vsfcpak
+      integer  vsfdlte
+      external vsfdlte
+      integer  vsfdtch
+      external vsfdtch
+      integer  vsfelts
+      external vsfelts
+      integer  vsfex
+      external vsfex
+      integer  vsffdef
+      external vsffdef
+      integer  vsffdat
+      external vsffdat
+      integer  vsffidx
+      external vsffidx
+      integer  vsffnas
+      external vsffnas
+      integer  vsffnd
+      external vsffnd
+      integer  vsfgnat
+      external vsfgnat
+      integer  vsfgcat
+      external vsfgcat
+      integer  vsfgcls
+      external vsfgcls
+      integer  vsfgfld
+      external vsfgfld
+      integer  vsfgid
+      external vsfgid
+      integer  vsfgint
+      external vsfgint
+      integer  vsfgnam
+      external vsfgnam
+      integer  vsfinq
+      external vsfinq
+      integer  vsfisat
+      external vsfisat
+      integer  vsflone
+      external vsflone
+      integer  vsfnats
+      external vsfnats
+      integer  vsfndc
+      external vsfndc
+      integer  vsfnpak
+      external vsfnpak
+      integer  vsfrd
+      external vsfrd
+      integer  vsfrdc
+      external vsfrdc
+      integer  vsfread
+      external vsfread
+      integer  vsfsnat
+      external vsfsnat
+      integer  vsfscat
+      external vsfscat
+      integer  vsfscls
+      external vsfscls
+      integer  vsffcls
+      external vsffcls
+      integer  vsfseek
+      external vsfseek
+      integer  vsfsextf
+      external vsfsextf
+      integer  vsfsfld
+      external vsfsfld
+      integer  vsfsint
+      external vsfsint
+      integer  vsfsiz
+      external vsfsiz
+      integer  vsfsnam
+      external vsfsnam
+      integer  vsfwrt
+      external vsfwrt
+      integer  vsfwrtc
+      external vsfwrtc
+      integer  vsfwrit
+      external vsfwrit
+      external vsfsetblsz
+      integer  vsfsetblsz
+      external vsfsetnmbl 
+      integer  vsfsetnmbl
+      external vsfgetblinfo
+      integer  vsfgetblinfo
+      integer  vsfgvdatas
+      external vsfgvdatas
+C
+C     Declarations of return values for HDF Vdata Field Functions
+C
+      external vffesiz
+      integer  vffesiz 
+      external vffisiz
+      integer  vffisiz
+      external vffname
+      integer  vffname
+      external vffordr
+      integer  vffordr
+      external vfftype
+      integer  vfftype
+      external vfnflds
+      integer  vfnflds
+C
+C     Declarations of return values for HDF Vdata Query functions
+C
+      integer  vsqfnelt
+      external vsqfnelt
+      integer  vsqfintr
+      external vsqfintr
+      integer  vsqfflds
+      external vsqfflds
+      integer  vsqfvsiz
+      external vsqfvsiz
+      integer  vsqfname
+      external vsqfname
+
+C
+C     Declarations of return values for HDF low level H functions
+C
+      integer  hclose
+      external hclose
+      integer  heprnt
+      external heprnt
+      integer  hnumber
+      external hnumber
+      integer  hopen
+      external hopen
+      integer  hxscdir
+      external hxscdir
+      integer  hxsdir
+      external hxsdir
+      integer  hddontatexit
+      external hddontatexit
+      integer  hglibver
+      external hglibver
+      integer  hgfilver
+      external hgfilver
+      integer  hishdff
+      external hishdff
+      integer  hestringf
+      external hestringf
+      integer  heprntf
+      external heprntf
+      integer  hconfinf
+      external hconfinf
+      
+
+C
+C     Decls of MGxxx functions for Fortran multi-file GR interface
+C
+
+      integer  mgstart
+      external mgstart
+      integer  mgfinfo
+      external mgfinfo
+      integer  mgend       
+      external mgend       
+      integer  mgcreat    
+      external mgcreat    
+      integer  mgselct     
+      external mgselct     
+      integer  mgn2ndx    
+      external mgn2ndx    
+      integer  mggiinf     
+      external mggiinf     
+      integer  mgwrimg     
+      external mgwrimg     
+      integer  mgrdimg     
+      external mgrdimg     
+      integer  mgendac     
+      external mgendac     
+      integer  mgid2rf     
+      external mgid2rf     
+      integer  mgr2idx     
+      external mgr2idx     
+      integer  mgrltil     
+      external mgrltil     
+      integer  mgrimil     
+      external mgrimil     
+      integer  mggltid     
+      external mggltid     
+      integer  mgglinf     
+      external mgglinf     
+      integer  mgwrlut     
+      external mgwrlut     
+      integer  mgrdlut     
+      external mgrdlut     
+      integer  mgsxfil    
+      external mgsxfil    
+      integer  mgsattr    
+      external mgsattr    
+      integer  mgatinf     
+      external mgatinf     
+      integer  mggattr     
+      external mggattr     
+      integer  mgfndat    
+      external mgfndat    
+      integer  mggichnk
+      external mggichnk
+      integer  mgscchnk
+      external mgscchnk
+      integer  mgschnk
+      external mgschnk
+      integer  mgwchnk
+      external mgwchnk
+      integer  mgwcchnk
+      external mgwcchnk
+      integer  mgrchnk
+      external mgrchnk
+      integer  mgrcchnk
+      external mgrcchnk
+      integer  mgscompress
+      external mgscompress
+      integer  mggcompress
+      external mggcompress
+      integer  mglt2rf
+      external mglt2rf
+      integer  mggnluts
+      external mggnluts
+
+C
+C       Decls of ANxxx functions for Fortran multi-file AN interface
+C
+      integer  afstart
+      external afstart
+      integer  affileinfo
+      external affileinfo
+      integer  afend       
+      external afend       
+      integer  afcreate
+      external afcreate
+      integer  affcreate
+      external affcreate
+      integer  afselect
+      external afselect
+      integer  afnumann
+      external afnumann
+      integer  afannlist
+      external afannlist
+      integer  afannlen
+      external afannlen
+      integer  afwriteann
+      external afwriteann
+      integer  afreadann
+      external afreadann
+      integer  afendaccess
+      external afendaccess
+      integer  afgettagref
+      external afgettagref
+      integer  afidtagref
+      external afidtagref
+      integer  aftagrefid
+      external aftagrefid
+      integer  afatypetag
+      external afatypetag
+      integer  aftagatype
+      external aftagatype
+
+
+C
+C       Decls of SFxxx functions for Fortran multi-file interface
+C
+      integer  sfstart
+      external sfstart
+      integer  sfn2index
+      external sfn2index
+      integer  sfcreate
+      external sfcreate
+      integer  sfsdmstr
+      external sfsdmstr
+      integer  sfsdmname
+      external sfsdmname
+      integer  sfsdtstr
+      external sfsdtstr
+      integer  sfgdtstr
+      external sfgdtstr
+      integer  sfgdmstr
+      external sfgdmstr
+      integer  sfginfo
+      external sfginfo
+      integer  sfgainfo
+      external sfgainfo
+      integer  sfgdinfo
+      external sfgdinfo
+      integer  sfsattr
+      external sfsattr
+      integer  sfsnatt
+      external sfscatt
+      integer  sfscatt
+      integer  sffattr
+      external sffattr
+      integer  sfend
+      external sfend
+      integer  sfendacc
+      external sfendacc
+      integer  sffinfo
+      external sffinfo
+      integer  sfselect
+      external sfselect
+      integer  sfdimid
+      external sfdimid
+      integer  sfgcal
+      external sfgcal
+      integer  sfscal
+      external sfscal
+      integer  sfsdscale
+      external sfsdscale
+      integer  sfgdscale
+      external sfgdscale
+      integer  sfsfill
+      external sfsfill
+      integer  sfgfill
+      external sfgfill
+      integer  sfgrange
+      external sfgrange
+      integer  sfsrange
+      external sfsrange
+      integer  sfrattr
+      external sfrattr
+      integer  sfrnatt
+      external sfrcatt
+      integer  sfrcatt
+      integer  sfrdata
+      external sfrdata
+      integer  sfwdata
+      external sfwdata
+      integer  sfsextf
+      external sfsextf
+      integer  sfsnbit
+      external sfsnbit
+      integer  sfsacct
+      external sfsacct
+      integer  sfid2ref
+      external sfid2ref
+      integer  sfiscvar
+      external sfiscvar
+      integer  sfref2index
+      external sfref2index
+      integer  sfsdmvc
+      external sfsdmvc
+      integer  sfisdmvc
+      external sfisdmvc
+      integer  sfgichnk
+      external sfgichnk
+      integer  sfrcchnk
+      external sfrcchnk
+      integer  sfrchnk
+      external sfrchnk
+      integer  sfwcchnk
+      external sfwcchnk
+      integer  sfwchnk
+      external sfwchnk
+      integer  sfscchnk
+      external sfscchnk
+      integer  sfschnk
+      external sfschnk
+      integer  sfscompress
+      external sfscompress
+      integer  sfgcompress
+      external sfgcompress
+      integer  sfisrcrd
+      external sfisrcrd
+      integer  sfsblsz
+      external sfsblsz
+      integer  sfchempty
+      external sfchempty
+      integer  sfwcdata
+      external sfwcdata
+      integer  sfrcdata
+      external sfrcdata
+      integer  sfgcfill
+      external sfgcfill
+      integer  sfscfill
+      external sfscfill
+      integer  sfsflmd
+      external sfsflmd
+
+C End of declarations
+
diff --git a/hdf/src/dfgr.c b/hdf/src/dfgr.c
new file mode 100644
index 0000000..83c9f9a
--- /dev/null
+++ b/hdf/src/dfgr.c
@@ -0,0 +1,1653 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfgr.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     dfgr.c
+ * Purpose:  read and write general raster images
+ * Invokes:  df.c, dfkit.c, dfcomp.c, dfgroup.c, dfgr.h
+ * Contents:
+ *  DFGRgetlutdims  : get dimensions of lookup table
+ *  DFGRreqlutil    : use this interlace when returning lookup table
+ *  DFGRgetlut      : read in lookup table
+ *  DFGRgetimdims   : get dimensions of image
+ *  DFGRreqimil     : use this interlace when returning image
+ *  DFGRgetimage    : read in image
+ *  DFGRsetcompress : specify compression scheme to be used
+ *  DFGRsetlutdims  : set dimensions of lookup table
+ *  DFGRsetlut      : set lookup table to write out with subsequent images
+ *  DFGRaddlut      : write out lookup table
+ *  DFGRsetimdims   : set dimensions of image
+ *  DFGRaddimage    : write out image
+ *
+ *  DFGRgetrig  : read in raster image group
+ *  DFGRaddrig  : write out raster image group
+ *
+ *  DFGRIopen      : open/reopen file
+ *  DFGRIriginfo   : obtain info about next RIG
+ *  DFGRIgetdims   : get dimensions of lut/iamge
+ *  DFGRIreqil     : get lut/image with this interlace
+ *  DFGRIgetimlut  : get image/lut
+ *  DFGRIsetdims   : set image/lut dimensions
+ *  DFGRIaddimlut  : write out image/lut
+ * Remarks: A RIG specifies attributes associated with an image - lookup table,
+ *          dimension, compression, color compensation etc.
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfgr.h"
+
+PRIVATE char *Grlastfile = NULL;
+PRIVATE uint8 *Grlutdata = NULL;    /* points to lut, if in memory */
+PRIVATE intn Grnewdata = 0;     /* does Grread contain fresh data? */
+PRIVATE intn Grcompr = 0;       /* compression scheme to use */
+PRIVATE comp_info Grcinfo;      /* Compression information for each
+                                   scheme */
+PRIVATE uint16 Grrefset = 0;    /* Ref of image to get next */
+PRIVATE uint16 Grlastref = 0;   /* Last ref read/written */
+PRIVATE intn Grreqil[2] =
+{0, 0};                         /* requested lut/image il */
+PRIVATE struct
+  {                             /* track refs of set vals written before */
+      intn        lut;          /* -1: no vals set */
+      int16       dims[2];      /* 0: vals set, not written */
+      intn        nt;           /* non-zero: ref of val in file */
+  }
+Ref =
+{
+    -1,
+    {
+        -1, -1
+    }
+    ,-1
+};
+PRIVATE DFGRrig Grread =
+{                               /* information about RIG being read */
+    NULL, 0, 0, (float32) 0.0, (float32) 0.0,
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {
+        {0, 0},
+        {0, 0},
+        {0, 0},},
+    {
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},},
+};
+PRIVATE DFGRrig Grwrite =
+{                               /* information about RIG being written */
+    NULL, 0, 0, (float32) 0.0, (float32) 0.0,
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {
+        {0, 0},
+        {0, 0},
+        {0, 0},},
+    {
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},},
+};
+PRIVATE DFGRrig Grzrig =
+{                               /* empty RIG for initialization */
+    NULL, 0, 0, (float32) 0.0, (float32) 0.0,
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {
+        {0, 0},
+        {0, 0},
+        {0, 0},},
+    {
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},
+        {0, 0, 0, 0,
+         {0, 0},
+         {0, 0}},},
+};
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+#define LUT     0
+#define IMAGE   1
+
+/* private functions */
+PRIVATE int DFGRIriginfo
+            (int32 file_id);
+PRIVATE int DFGRgetrig
+            (int32 file_id, uint16 ref, DFGRrig * rig);
+PRIVATE int DFGRaddrig
+            (int32 file_id, uint16 ref, DFGRrig * rig);
+PRIVATE intn DFGRIstart(void);
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRgetlutdims
+ * Purpose: get dimensions of lut from next RIG
+ * Inputs:  filename: name of HDF file
+ *          pxdim, pydim: pointer to locations for returning x,y dimensions
+ *          pncomps: location for returning no of components
+ *          pil: location for returning interlace of lut in file
+ * Returns: 0 on success, -1 on failure with DFerror set
+ *          *pxdim, *pydim, *pncomps, *pil set on success
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIgetdims
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRgetlutdims(const char *filename, int32 *pxdim, int32 *pydim, int *pncomps,
+               int *pil)
+{
+    return (DFGRIgetdims(filename, pxdim, pydim, pncomps, pil, LUT));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRreqlutil
+ * Purpose: get next lut with specified interlace
+ * Inputs:  il: interlace to get next lut with
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIreqil
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRreqlutil(int il)
+{
+    return (DFGRIreqil(il, LUT));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRgetlut
+ * Purpose: get lut from next RIG
+ * Inputs:  filename: name of HDF file
+ *          lut: pointer to space to return lookup table
+ *          xdim, ydim: dimensions of space to return lut
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIgetimlut
+ * Remarks: space is assumed to be xdim * ydim * ncomps bytes
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRgetlut(const char *filename, void * lut, int32 xdim, int32 ydim)
+{
+    int compressed, has_pal;
+    uint16 compr_type;
+    /* 0 == C */
+    return (DFGRIgetimlut(filename, lut, xdim, ydim, LUT, 0,
+			  &compressed, &compr_type, &has_pal));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRgetimdims
+ * Purpose: get dimensions of next image RIG
+ * Inputs:  filename: name of HDF file
+ *          pxdim, pydim: pointer to locations for returning x,y dimensions
+ *          pncomps: location for returning no of components
+ *          pil: location for returning interlace of image in file
+ * Returns: 0 on success, -1 on failure with DFerror set
+ *          *pxdim, *pydim, *pncomps, *pil set on success
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIgetdims
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRgetimdims(const char *filename, int32 *pxdim, int32 *pydim, int *pncomps,
+              int *pil)
+{
+    return (DFGRIgetdims(filename, pxdim, pydim, pncomps, pil, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRreqimil
+ * Purpose: get next image with specified interlace
+ * Inputs:  il: interlace to get next image with
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIreqil
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRreqimil(int il)
+{
+    return (DFGRIreqil(il, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRgetimage
+ * Purpose: get image from next RIG
+ * Inputs:  filename: name of HDF file
+ *          image: pointer to space to return image
+ *          xdim, ydim: dimensions of space to return lut
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIgetimlut
+ * Remarks: space is assumed to be xdim * ydim * ncomps bytes
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRgetimage(const char *filename, void * image, int32 xdim, int32 ydim)
+{
+    int compressed, has_pal;
+    uint16 compr_type;
+    /* 0 == C */
+    return (DFGRIgetimlut(filename, image, xdim, ydim, IMAGE, 0,
+			  &compressed, &compr_type, &has_pal));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRsetcompress
+ * Purpose: set compression scheme to use
+ * Inputs:
+ *      scheme - compression scheme
+ *      cinfo - compression information structure
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+int
+DFGRsetcompress(int32 scheme, comp_info * cinfo)
+{
+    CONSTR(FUNC, "DFGRsetcompress");
+    intn   ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (scheme == COMP_NONE)
+      {     /* quick check for no compression */
+          Grcompr = 0;  /* Set the compression scheme */
+          HGOTO_DONE(SUCCEED);
+      }     /* end if */
+
+    if (scheme < 0 || scheme > COMP_MAX_COMP || compress_map[scheme] == 0)
+        HGOTO_ERROR(DFE_BADSCHEME, FAIL);
+
+    /* map JPEG compression into correct type of JPEG compression */
+    if (scheme == COMP_JPEG)
+        Grcompr = DFTAG_JPEG5;   /* Set the compression scheme */
+    else    /* otherwise, just use mapped tag */
+        Grcompr = (intn)compress_map[scheme];
+    Grcinfo = (*cinfo);     /* Set the compression parameters */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFGRsetcompress() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRsetlutdims
+ * Purpose: set dimensions of lut to write next
+ * Inputs:  xdim, ydim: dimensions of lut
+ *          ncomps: no of components
+ *          il: interlace of lut
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIsetdims
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRsetlutdims(int32 xdim, int32 ydim, int ncomps, int il)
+{
+    if (DFGRIsetil(il, LUT) < 0)
+        return FAIL;
+    return (DFGRIsetdims(xdim, ydim, ncomps, LUT));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRsetlut
+ * Purpose: set lut for subsequent RIGs
+ * Inputs:  lut: lookup table to write
+ *          xdim, ydim: dimensions of array lut
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIaddimlut
+ * Remarks: array lut is assumed to be xdim * ydim * ncomps bytes
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRsetlut(void * lut, int32 xdim, int32 ydim)
+{
+    /* 0 == C, 0 == no newfile */
+    return (DFGRIaddimlut((const char *) NULL, lut, xdim, ydim, LUT, 0, 0));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRaddlut
+ * Purpose: write lut to file, associate it with subsequent RIGs
+ * Inputs:  filename: name of HDF file
+ *          lut: lookup table to write
+ *          xdim, ydim: dimensions of array lut
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIaddimlut
+ * Remarks: array lut is assumed to be xdim * ydim * ncomps bytes
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRaddlut(const char *filename, void * lut, int32 xdim, int32 ydim)
+{
+    /* 0 == C, 0 == no new file */
+    return (DFGRIaddimlut(filename, lut, xdim, ydim, LUT, 0, 0));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRsetimdims
+ * Purpose: set dimensions of image to write next
+ * Inputs:  xdim, ydim: dimensions of image
+ *          ncomps: no of components
+ *          il: interlace of image
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIsetdims
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRsetimdims(int32 xdim, int32 ydim, int ncomps, int il)
+{
+    if (DFGRIsetil(il, IMAGE) < 0)
+        return FAIL;
+    return (DFGRIsetdims(xdim, ydim, ncomps, IMAGE));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRaddimage
+ * Purpose: Write out image
+ * Inputs:  filename: name of HDF file
+ *          image: image to write
+ *          xdim, ydim: dimensions of array image
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIaddimlut
+ * Remarks: array image is assumed to be xdim * ydim * ncomps bytes
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRaddimage(const char *filename, void * image, int32 xdim, int32 ydim)
+{
+    /* 0 == C, 0 == not new file */
+    return (DFGRIaddimlut(filename, image, xdim, ydim, IMAGE, 0, 0));
+}
+
+int
+DFGRputimage(const char *filename, void * image, int32 xdim, int32 ydim)
+{
+    /* 0 == C, 1 == new file */
+    return (DFGRIaddimlut(filename, image, xdim, ydim, IMAGE, 0, 1));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRreadref
+ * Purpose: Set ref of rig to get next
+ * Inputs:  filename: file to which this applies
+ *          ref: reference number of next get
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFGRIopen, DFIfind, DFclose
+ * Remarks: checks if rig with this ref exists
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRreadref(const char *filename, uint16 ref)
+{
+    CONSTR(FUNC, "DFGRreadref");
+    intn    ret_value = SUCCEED;
+    int32   file_id=(-1);
+#ifdef OLD_WAY
+    int32   aid;
+#endif /* OLD_WAY */
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if ((file_id = DFGRIopen(filename, DFACC_READ))== FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+#ifdef OLD_WAY
+    if ((aid = Hstartread(file_id, DFTAG_RIG, ref)) == FAIL)
+        HGOTO_ERROR(DFE_BADAID, FAIL);
+
+    if (Hendaccess(aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+#else /* OLD_WAY */
+    if (Hexist(file_id, DFTAG_RIG, ref) == FAIL)
+        HGOTO_ERROR(DFE_BADAID, FAIL);
+
+#endif /* OLD_WAY */
+
+    Grrefset = ref;
+    ret_value= Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(file_id!=(-1))
+          Hclose(file_id);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*****************************************************************************/
+/* This is the next lower layer - procedures to read in and write out a RIG. */
+/*****************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRgetrig
+ * Purpose: Read a RIG into memory
+ * Inputs:  file_id: pointer to HDF file containing RIG
+ *          ref: reference number of RIG to get
+ *          rig: struct in which to place info obtained
+ * Returns: 0 on success, -1 on failure with DFerror set
+ *          contents of RIG in the struct rig
+ * Users:   HDF programmers, utilities, DFGRIgetdims,DFGRIgetimlut,
+ *          other routines
+ * Invokes: DFdiget, DFdinext, DFIcheck, DFgetelement
+ * Remarks: incomplete - does not support DFTAG_MA etc.
+ *---------------------------------------------------------------------------*/
+
+PRIVATE int
+DFGRgetrig(int32 file_id, uint16 ref, DFGRrig * rig)
+{
+    CONSTR(FUNC, "DFGRgetrig");
+    uint16      elt_tag, elt_ref;
+    uint8       ntstring[4];
+    int         type;
+    int32       GroupID;
+    uint8       GRtbuf[64];     /* local buffer for reading RIG info */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (!HDvalidfid(file_id) || !ref)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* read RIG into memory */
+    if ((GroupID = DFdiread(file_id, DFTAG_RIG, ref)) == FAIL)
+        HGOTO_ERROR(DFE_READERROR, FAIL);
+
+    *rig = Grzrig;  /* fill rig with zeroes */
+    while (!DFdiget(GroupID, &elt_tag, &elt_ref))
+      {     /* get next tag/ref */
+          switch (elt_tag)
+            {   /* process tag/ref */
+                case DFTAG_CI:
+                case DFTAG_RI:
+                case DFTAG_LUT:
+                    type = (elt_tag == DFTAG_LUT) ? LUT : IMAGE;
+                    rig->data[type].tag = elt_tag;
+                    rig->data[type].ref = elt_ref;
+                    break;
+
+                case DFTAG_ID:      /* read description info */
+                case DFTAG_LD:
+                    type = (elt_tag == DFTAG_LD) ? LUT : IMAGE;
+                    if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
+                      {
+                          int16       int16var;
+                          uint8      *p;
+
+                          p = GRtbuf;
+                          INT32DECODE(p, rig->datadesc[type].xdim);
+                          INT32DECODE(p, rig->datadesc[type].ydim);
+                          UINT16DECODE(p, rig->datadesc[type].nt.tag);
+                          UINT16DECODE(p, rig->datadesc[type].nt.ref);
+                          INT16DECODE(p, int16var);
+                          rig->datadesc[type].ncomponents=(intn)int16var;
+                          INT16DECODE(p, int16var);
+                          rig->datadesc[type].interlace=(intn)int16var;
+                          UINT16DECODE(p, rig->datadesc[type].compr.tag);
+                          UINT16DECODE(p, rig->datadesc[type].compr.ref);
+                      }
+                    else
+                      {
+                    	DFdifree(GroupID);
+                        HGOTO_ERROR(DFE_READERROR, FAIL);
+                    }
+
+                    if (rig->datadesc[type].nt.tag == 0)
+                        break;  /* old RIGs */
+
+                    /* read NT */
+                    if (Hgetelement(file_id, rig->datadesc[type].nt.tag,
+                              rig->datadesc[type].nt.ref, ntstring) == FAIL)
+                      {
+                    	DFdifree(GroupID);
+                        HGOTO_ERROR(DFE_READERROR, FAIL);
+                      }
+                    if ((ntstring[2] != 8) || (ntstring[1] != DFNT_UCHAR))
+                      {
+                     	DFdifree(GroupID);
+                        HGOTO_ERROR(DFE_BADCALL, FAIL);
+                      }
+                    break;
+                default:    /* ignore unknown tags */
+                    break;
+            }
+      }
+      
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRaddrig
+ * Purpose: Write RIG struct out to HDF file
+ * Inputs:  file_id: HDF file pointer
+ *          ref: ref to write RIG with
+ *          rig: struct containing RIG info to write
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF programmers, utilities, DFGRIaddimlut, other routines
+ * Invokes: DFIcheck, DFdistart, DFdiadd, DFdiend, DFputelement
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+PRIVATE int
+DFGRaddrig(int32 file_id, uint16 ref, DFGRrig * rig)
+{
+    CONSTR(FUNC, "DFGRaddrig");
+    uint8       ntstring[4];
+    int32       lutsize;
+    int32       GroupID;
+    uint8       GRtbuf[64];     /* local buffer for reading RIG info */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (!HDvalidfid(file_id) || !ref)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (Ref.nt <= 0)
+      {     /* if nt not previously written to file */
+          /* construct and write out NT */
+          ntstring[0] = DFNT_VERSION;   /* version */
+          ntstring[1] = DFNT_UCHAR;     /* type */
+          ntstring[2] = 8;  /* width: RIG data is 8-bit chars */
+          ntstring[3] = DFNTC_BYTE;     /* class: data are numeric values */
+          if (Hputelement(file_id, DFTAG_NT, ref,
+                          (uint8 *) ntstring, (int32) 4) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          rig->datadesc[IMAGE].nt.tag = DFTAG_NT;
+          rig->datadesc[IMAGE].nt.ref = ref;
+          Ref.nt = (intn)ref;
+      }
+
+    if (Ref.dims[IMAGE] == 0)
+      {
+          uint8      *p;
+
+          p = GRtbuf;
+          INT32ENCODE(p, rig->datadesc[IMAGE].xdim);
+          INT32ENCODE(p, rig->datadesc[IMAGE].ydim);
+          UINT16ENCODE(p, rig->datadesc[IMAGE].nt.tag);
+          UINT16ENCODE(p, rig->datadesc[IMAGE].nt.ref);
+          INT16ENCODE(p, rig->datadesc[IMAGE].ncomponents);
+          INT16ENCODE(p, rig->datadesc[IMAGE].interlace);
+          UINT16ENCODE(p, rig->datadesc[IMAGE].compr.tag);
+          UINT16ENCODE(p, rig->datadesc[IMAGE].compr.ref);
+
+          if (Hputelement(file_id, DFTAG_ID, ref,
+                          GRtbuf, (int32) (p - GRtbuf)) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+
+          Ref.dims[IMAGE] = (int16)ref;
+      }
+    if (!Ref.lut)
+      {     /* associated lut not written to this file */
+          if (Grlutdata == NULL)    /* no lut associated */
+              HGOTO_ERROR(DFE_ARGS, FAIL);
+          lutsize = Grwrite.datadesc[LUT].xdim * Grwrite.datadesc[LUT].ydim *
+              Grwrite.datadesc[LUT].ncomponents;
+          if (Hputelement(file_id, DFTAG_LUT, ref,
+                          Grlutdata, (int32) lutsize) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          rig->data[LUT].tag = DFTAG_LUT;
+          rig->data[LUT].ref = ref;
+          Ref.lut = (intn)ref;
+      }
+
+    if (Ref.dims[LUT] == 0)
+      {
+          uint8      *p;
+          p = GRtbuf;
+          INT32ENCODE(p, rig->datadesc[LUT].xdim);
+          INT32ENCODE(p, rig->datadesc[LUT].ydim);
+          UINT16ENCODE(p, rig->datadesc[LUT].nt.tag);
+          UINT16ENCODE(p, rig->datadesc[LUT].nt.ref);
+          INT16ENCODE(p, rig->datadesc[LUT].ncomponents);
+          INT16ENCODE(p, rig->datadesc[LUT].interlace);
+          UINT16ENCODE(p, rig->datadesc[LUT].compr.tag);
+          UINT16ENCODE(p, rig->datadesc[LUT].compr.ref);
+          if (Hputelement(file_id, DFTAG_LD, ref,
+                          GRtbuf, (int32) (p - GRtbuf)) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          Ref.dims[LUT] = (int16)ref;
+      }
+
+    /* prepare to start writing rig */
+    /* ### NOTE: the parameter to this call may go away */
+    if ((GroupID = DFdisetup(10)) == FAIL)
+        HGOTO_ERROR(DFE_GROUPSETUP, FAIL);    /* max 10 tag/refs in set */
+    /* add tag/ref to RIG - image description, image and lookup table */
+    if (DFdiput(GroupID, DFTAG_ID, (uint16) Ref.dims[IMAGE]) == FAIL)
+        HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+    if (DFdiput(GroupID, rig->data[IMAGE].tag, rig->data[IMAGE].ref) == FAIL)
+        HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+    if ((Ref.dims[LUT] > 0)
+        && (DFdiput(GroupID, DFTAG_LD, (uint16) Ref.dims[LUT]) == FAIL))
+        HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+    if ((Ref.lut > 0)
+      && (DFdiput(GroupID, rig->data[LUT].tag, rig->data[LUT].ref) == FAIL))
+        HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+    /* write out RIG */
+    if(DFdiwrite(file_id, GroupID, DFTAG_RIG, ref)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*****************************************************************************/
+/*----------------------- Internal routines ---------------------------------*/
+/*****************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIopen
+ * Purpose: open or reopen a file
+ * Inputs:  filename: name of file to open
+ *          acc_mode : access mode
+ * Returns: file pointer on success, NULL on failure with DFerror set
+ * Users:   HDF systems programmers, all the RIG routines
+ * Invokes: DFopen
+ * Remarks: This is a hook for someday providing more efficient ways to
+ *          reopen a file, to avoid re-reading all the headers
+ *---------------------------------------------------------------------------*/
+
+int32
+DFGRIopen(const char *filename, int acc_mode)
+{
+    CONSTR(FUNC, "DFGRIopen");
+    int32       file_id=(-1);
+    int32       ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (( file_id = Hopen(filename, acc_mode, 0))== FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* Check if filename buffer has been allocated */
+    if (Grlastfile == NULL)
+      {
+          if (( Grlastfile = (char *) HDmalloc(DF_MAXFNLEN + 1))== NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          *Grlastfile = '\0';   /* initialize to a 0-length string */
+      }
+
+    /* use reopen if same file as last time - more efficient */
+    if (HDstrncmp(Grlastfile, filename, DF_MAXFNLEN) || (acc_mode == DFACC_CREATE))
+      {
+          /* treat create as different file */
+          Grrefset = 0;     /* no ref to get set for this file */
+          Grnewdata = 0;
+          if (Ref.lut > 0)
+              Ref.lut = 0;
+          if (Grlutdata == NULL)
+              Ref.lut = (-1);   /* no LUT if not a "set" call */
+          if (Ref.dims[IMAGE] > 0)
+              Ref.dims[IMAGE] = 0;
+          if (Ref.dims[LUT] > 0)
+              Ref.dims[LUT] = 0;
+          if (Ref.nt > 0)
+              Ref.nt = 0;
+          Grread = Grzrig;  /* no rigs read yet */
+      }
+
+    /* remember filename, so reopen may be used next time if same file */
+    HDstrncpy(Grlastfile, filename, DF_MAXFNLEN);
+
+    ret_value= file_id;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(file_id!=(-1))
+          Hclose(file_id);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIriginfo
+ * Purpose: Get information about next RIG in file
+ * Inputs:  file_id: pointer to DF file
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF systems programmers
+ * Invokes: DFIfind, DFgetelement, DFGRgetrig
+ * Remarks: if Grrefset set, gets image with that ref, if any
+ *---------------------------------------------------------------------------*/
+
+PRIVATE int
+DFGRIriginfo(int32 file_id)
+{
+    CONSTR(FUNC, "DFGRIriginfo");
+    int         i, isfirst;
+    uint16      newref = 0, newtag = 0, gettag, getref, ref=0, dummy=0;
+    struct
+      {
+          uint16      xdim;
+          uint16      ydim;
+      }
+    r8dims;
+    char       *p;
+    int32       aid;
+  intn        ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    isfirst = (Grrefset != 0) || (Grread.data[IMAGE].ref == 0);
+    getref = Grrefset;  /* ref if specified, else 0 */
+    Grrefset = 0;   /* no longer need to remember specified ref */
+    gettag = DFTAG_RIG;
+    for (i = 0; i < 4; i++)
+      {     /* repeat for RIG, RI8, CI8, II8 */
+          if (isfirst)
+            {
+                aid = Hstartread(file_id, gettag, getref);
+            }
+          else
+            {
+                aid = Hstartread(file_id, gettag, Grread.data[IMAGE].ref);
+                if ((aid != FAIL) &&
+                    Hnextread(aid, gettag, getref, DF_CURRENT) == FAIL)
+                  {
+                      Hendaccess(aid);
+                      aid = FAIL;
+                  }
+            }
+          if (aid == FAIL)
+            {   /* not found */
+                if (gettag == DFTAG_RIG)
+                  {     /* were looking for RIGs */
+                      if ((Grread.data[IMAGE].tag == DFTAG_RI)  /* file has RIGs */
+                          || (Grread.data[IMAGE].tag == DFTAG_CI))
+                          HGOTO_DONE(FAIL);  /* no more to return */
+                      gettag = DFTAG_RI8;   /* if no RIGs in file, look for RI8s */
+                  }
+                else if ((gettag == DFTAG_II8) && (!newref))    /* no RI8/CI8/II8 */
+                    HGOTO_DONE(FAIL);
+                continue;   /* continue checking */
+            }
+          /* found */
+          HQuerytagref(aid, &dummy, &ref);
+          Hendaccess(aid);
+          if (!newref || (ref < newref))
+            {   /* is it next one? */
+                newref = ref;   /* remember tag, ref */
+                newtag = gettag;
+            }
+          if (gettag == DFTAG_RI8)
+              gettag = DFTAG_CI8;   /* check next */
+          else if (gettag == DFTAG_CI8)
+              gettag = DFTAG_II8;
+          else
+              break;    /* all checked, quit */
+      }
+
+    if (newtag == DFTAG_RIG)
+      {
+          if (DFGRgetrig(file_id, newref, &Grread) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+    else
+      {
+          uint16    uint16var;
+
+          Grread.data[IMAGE].ref = newref;
+          Grread.data[IMAGE].tag = newtag;
+          if (newtag == DFTAG_CI8)
+              Grread.datadesc[IMAGE].compr.tag = DFTAG_RLE;
+          else if (newtag == DFTAG_II8)
+              Grread.datadesc[IMAGE].compr.tag = DFTAG_IMC;
+
+          if (Hgetelement(file_id, DFTAG_ID8, newref, (uint8 *) &r8dims) == FAIL)
+              HGOTO_ERROR(DFE_GETELEM, FAIL);
+          p = (char *) &r8dims;
+          UINT16DECODE(p, uint16var);
+          Grread.datadesc[IMAGE].xdim=(int32)uint16var;
+          UINT16DECODE(p, uint16var);
+          Grread.datadesc[IMAGE].ydim=(int32)uint16var;
+
+          aid = Hstartread(file_id, DFTAG_IP8, newref);
+          if (aid != FAIL)
+            {
+                Grread.data[LUT].tag = DFTAG_IP8;
+                Grread.data[LUT].ref = newref;
+                Hendaccess(aid);
+            }
+          HEclear();    /* reset it, just in case! */
+      }
+
+    /* if LUT dimensions not set, set default dimensions */
+    if (Grread.data[LUT].tag && Grread.datadesc[LUT].xdim == 0)
+      {
+          Grread.datadesc[LUT].xdim = 256;
+          Grread.datadesc[LUT].ydim = 1;
+          Grread.datadesc[LUT].ncomponents = 3;
+      }
+
+#ifdef OLD_WAY
+    Grlastref = Grread.data[IMAGE].ref;     /* remember ref read */
+#else /* OLD_WAY */
+    Grlastref = newref;     /* remember ref read */
+#endif /* OLD_WAY */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIgetdims
+ * Purpose: get dimensions of next image/lut from RIG
+ * Inputs:  filename: name of HDF file
+ *          pxdim, pxdim: pointer to locations for returning x,y dimensions
+ *          pncomps: location for returning no of components
+ *          pil: location for returning interlace of image/lut in file
+ *          type: LUT to get lut dims, IMAGE to get image dims
+ * Returns: 0 on success, -1 on failure with DFerror set
+ *          *pxdim, *pydim are set to dimensions of the next image on success
+ *          *pncomps, *pil set on success
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFGRIopen, DFclose, DFGRIriginfo, DFIerr
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRIgetdims(const char *filename, int32 *pxdim, int32 *pydim,
+             int *pncomps, int *pil, int type)
+{
+    CONSTR(FUNC, "DFGRIgetdims");
+    intn        ret_value = SUCCEED;
+    int32       file_id=(-1);
+
+    HEclear();
+
+    if (( file_id = DFGRIopen(filename, DFACC_READ))== FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    if (type == IMAGE)
+      {     /* getimdims sequences, getlutdims does not */
+          /* reads next RIG or RI8 from file */
+          if (DFGRIriginfo(file_id) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL,FAIL);
+          Grnewdata = 1;
+      }
+
+    if (type == LUT && Grread.data[LUT].ref == 0)
+        HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+    if (pxdim)
+        *pxdim = Grread.datadesc[type].xdim;
+    if (pydim)
+        *pydim = Grread.datadesc[type].ydim;
+    if (pncomps)
+        *pncomps = Grread.datadesc[type].ncomponents;
+    if (pil)
+        *pil = Grread.datadesc[type].interlace;
+
+  Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(file_id!=(-1))
+        Hclose(file_id);
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIreqil
+ * Purpose: set interlace with which to get subsequent images/luts
+ * Inputs:  il: interlace to get image/lut with
+ *          type: LUT for luts, IMAGE for images
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRIreqil(intn il, intn type)
+{
+    CONSTR(FUNC, "DFGRIreqil");
+    intn    ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    Grreqil[type] = il;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIgetimlut
+ * Purpose: get next image/lut from a RIG
+ * Inputs:  filename: name of HDF file
+ *          imlut: space to read image/lut into
+ *          xdim, ydim: dimensions of space allocated by user for image/lut
+ *          type: LUT for luts, IMAGE for images
+ *          isfortran: 0 if called from C, 1 if called from Fortran
+ * Returns: 0 on success, -1 on failure with DFerror set
+ *          image/lut in imlut
+ * Users:   HDF HLL users, utilities, other routines
+ * Invokes: DFGRIopen, DFGRIriginfo, DFIerr, DFclose, DFgetelement, DFgetcomp
+ * Remarks: Will also get RI8s and CI8s if no RIGs in file
+ *          Normally, DFGRgetimdims is called first and it moves to next image
+ *          But if that is not called, DFGRgetimlut will itself move to next
+ *          image (but not next lut!).
+ *          Automatically decompresses images/luts
+ *---------------------------------------------------------------------------*/
+
+/* shut lint up */
+/* ARGSUSED */
+int
+DFGRIgetimlut(const char *filename, void * imlut, int32 xdim, int32 ydim,
+              int type, int isfortran, int *compressed, uint16 *compr_type, 
+	      int *has_pal)
+{
+    CONSTR(FUNC, "DFGRIgetimlut");
+    int32       file_id=(-1);
+    int32       currpos[3], currmax[3], destsize[3], bufsize, i, j;
+    uint8      *buf, *destp;
+    int32       aid;
+    intn        ret_value = SUCCEED;
+
+    /* shut compiler up */
+    isfortran = isfortran;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (( file_id = DFGRIopen(filename, DFACC_READ))== FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    if ((type == IMAGE) && (Grnewdata != 1))
+      {     /* if Grread not fresh */
+          if (DFGRIriginfo(file_id) == FAIL)    /* reads next RIG or RI8 from file */
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+    if (Grnewdata == 0)
+        HGOTO_ERROR(DFE_BADCALL, FAIL);
+    Grnewdata = 0;  /* read new RIG next time */
+
+    if ((xdim != Grread.datadesc[type].xdim)
+        || (ydim != Grread.datadesc[type].ydim))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* read image/lut */
+    if (Grread.datadesc[type].compr.tag)
+      {     /* compressed image/lut */
+          *compressed = 1;
+	  *compr_type = Grread.datadesc[type].compr.tag;
+	  if ((Grreqil[type] >= 0)
+              && (Grreqil[type] != Grread.datadesc[type].interlace))
+              HGOTO_ERROR(DFE_UNSUPPORTED, FAIL);
+          if (DFgetcomp(file_id, Grread.data[type].tag, Grread.data[type].ref,
+                        (uint8 *) imlut, Grread.datadesc[type].xdim,
+                        Grread.datadesc[type].ydim,
+                        Grread.datadesc[type].compr.tag) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+    else
+      {     /* non-compressed raster image/lut */
+	  *compressed = 0;
+          if (Grreqil[type] >= 0)
+            {
+                if (Grreqil[type] >= Grread.datadesc[type].ncomponents)
+                  {
+                      HGOTO_ERROR(DFE_ARGS, FAIL);
+                  }
+                else if (Grreqil[type] != Grread.datadesc[type].interlace)
+                  {
+                      aid = Hstartread(file_id, Grread.data[type].tag,
+                                       Grread.data[type].ref);
+                      if (aid == FAIL)
+                          HGOTO_ERROR(DFE_BADAID, FAIL);
+                      /* current position in data */
+                      currpos[0] = currpos[1] = currpos[2] = 0;
+                      currmax[0] = Grread.datadesc[type].ncomponents;
+                      currmax[1] = Grread.datadesc[type].xdim;
+                      currmax[2] = Grread.datadesc[type].ydim;
+
+                      /* compute size of each dim of dest array */
+                      destsize[0] = destsize[1] = 1;
+                      destsize[2] = currmax[1];     /* xdim is more sig than ydim */
+                      if (Grreqil[type] == 0)
+                        {
+                            destsize[1] *= currmax[0];
+                            destsize[2] *= currmax[0];
+                        }
+                      else if (Grreqil[type] == 1)
+                        {
+                            destsize[0] *= currmax[1];
+                            destsize[2] *= currmax[0];
+                        }
+                      else if (Grreqil[type] == 2)
+                        {
+                            destsize[0] *= currmax[1] * currmax[2];
+                        }
+
+                      bufsize = Grread.datadesc[type].ydim *
+                          Grread.datadesc[type].ncomponents;
+                      buf = (uint8 *) HDmalloc((uint32) bufsize);
+                      if (buf == NULL)
+                        {
+                            Hendaccess(aid);
+                            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                        }
+
+                      /* read byte by byte and copy */
+                      for (i = 0; i < Grread.datadesc[type].xdim; i++)
+                        {
+                            if (Hread(aid, bufsize, buf) == FAIL)
+                              {
+                                  Hendaccess(aid);
+                                  HGOTO_ERROR(DFE_READERROR, FAIL);
+                              }
+                            for (j = 0; j < bufsize; j++)
+                              {
+                                  destp = (uint8 *) imlut + destsize[0] * currpos[0] +
+                                      destsize[1] * currpos[1] +
+                                      destsize[2] * currpos[2];
+                                  *destp = buf[j];
+                                  if (Grread.datadesc[type].interlace == 0)
+                                    {
+                                        if (++currpos[0] == currmax[0])
+                                          {
+                                              currpos[0] = 0;
+                                              if (++currpos[1] == currmax[1])
+                                                {
+                                                    currpos[1] = 0;
+                                                    if (++currpos[2] == currmax[2])
+                                                        break;
+                                                }
+                                          }
+                                    }
+                                  else if (++currpos[1] == currmax[1])
+                                    {
+                                        currpos[1] = 0;
+                                        if (Grread.datadesc[type].interlace == 1)
+                                          {
+                                              if (++currpos[0] == currmax[0])
+                                                {
+                                                    currpos[0] = 0;
+                                                    if (++currpos[2] == currmax[2])
+                                                        break;
+                                                }
+                                          }
+                                        else
+                                          {
+                                              if (++currpos[2] == currmax[2])
+                                                {
+                                                    currpos[2] = 0;
+                                                    if (++currpos[0] == currmax[0])
+                                                        break;
+                                                }
+                                          }
+                                    }
+                              }
+                        }
+                      Hendaccess(aid);
+                      HDfree(buf);
+                      HGOTO_DONE(Hclose(file_id));
+                  }
+            }
+          if (Hgetelement(file_id, Grread.data[type].tag, Grread.data[type].ref,
+                          (uint8 *) imlut) == FAIL) {
+              *has_pal = 0;
+              HGOTO_ERROR(DFE_GETELEM,FAIL);
+          }
+	  else
+	      *has_pal = 1;
+      }
+
+    Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(file_id!=(-1))
+        Hclose(file_id);
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIsetdims
+ * Purpose: set dimensions of image/lut
+ * Inputs:  xdim, ydim: dimensions of lut
+ *          ncomps: no of components
+ *          il: interlace of lut
+ *          type: LUT if lut, IMAGE if image
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRIsetdims(int32 xdim, int32 ydim, intn ncomps, int type)
+{
+    CONSTR(FUNC, "DFGRIsetdims");
+    intn    ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (ncomps == FAIL || (xdim <= 0) || (ydim <= 0))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    Grwrite.datadesc[type].xdim = xdim;
+    Grwrite.datadesc[type].ydim = ydim;
+    Grwrite.datadesc[type].ncomponents = ncomps;
+
+    Ref.dims[type] = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIsetil
+ * Purpose: set interlace of image/lut
+ * Inputs:  il: interlace of lut
+ *          type: LUT if lut, IMAGE if image
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+DFGRIsetil(int il, int type)
+{
+    CONSTR(FUNC, "DFGRIsetil");
+    intn    ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (il == FAIL)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    Grwrite.datadesc[type].interlace = il;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIrestart
+ * Purpose: restart file
+ * Inputs:
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+int
+DFGRIrestart(void)
+{
+    CONSTR(FUNC, "DFGRIrestart");
+    intn    ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    if (Grlastfile != NULL)
+        *Grlastfile = '\0';     /* zero out string instead of NULL'ing pointer */
+    Grrefset = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRIaddimlut
+ * Purpose: Internal routine to write RIG to file
+ * Inputs:  filename: name of HDF file
+ *          imlut: image/lut to be written to file
+ *          xdim, ydim: dimensions of image/lut
+ *          type: LUT if lut, IMAGE if image
+ *          isfortran: 0 if called from C, 1 if called from Fortran
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF systems programmers, DFGRaddimage, DFGRaddlut, DFGRsetlut
+ * Invokes: DFGRIopen, DFclose, DFputelement, DFdup, DFGRaddrig, DFputcomp,
+ *          DFIerr
+ * Remarks: Creates both RIG and RI8/CI8 tags, to accomodate older programs
+ *          LUT will be associated with image if set previously
+ *---------------------------------------------------------------------------*/
+
+/* shut lint up */
+/* ARGSUSED */
+int
+DFGRIaddimlut(const char *filename, const void * imlut, int32 xdim, int32 ydim,
+              int type, int isfortran, int newfile)
+{
+    CONSTR(FUNC, "DFGRIaddimlut");
+    int32       file_id=(-1);
+    uint16      wtag, wref;     /* tag of image/lut being written */
+    uint16      rigref;         /* ref # for the RIG */
+    uint8      *newlut = NULL;
+    int32       lutsize = 0;
+    int         is8bit;
+    struct
+      {
+          uint16      xdim;
+          uint16      ydim;
+      }
+    r8dims;
+    uint8      *p;
+    intn        ret_value = SUCCEED;
+
+    /* shut compiler up */
+    isfortran = isfortran;
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFGRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* Check if filename buffer has been allocated */
+    if (Grlastfile == NULL)
+      {
+          Grlastfile = (char *) HDmalloc((DF_MAXFNLEN + 1) * sizeof(char));
+          if (Grlastfile == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          *Grlastfile = '\0';   /* initialize to a 0-length string */
+      }
+
+    if (0 != HDstrcmp(Grlastfile, filename))
+      {     /* if new file, reset dims */
+          Grwrite.datadesc[type].xdim = xdim;
+          Grwrite.datadesc[type].ydim = ydim;
+          Ref.dims[type] = 0;   /* indicate set & not written */
+      }
+
+    if ((Ref.dims[type] == 0 && (xdim != Grwrite.datadesc[type].xdim
+                         || ydim != Grwrite.datadesc[type].ydim)) || !imlut)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* if dims not set, set dimensions */
+    if (Ref.dims[type] == FAIL)
+        if (DFGRIsetdims(xdim, ydim, 1, type) == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* default: ncomps=1, il=0 */
+
+    if ((type == LUT) && (filename == NULL))
+      {     /* set call */
+          if (Grlutdata)
+            {
+                HDfree(Grlutdata);
+                Grlutdata = NULL;
+            }
+          Ref.lut = -1;
+          if (imlut == NULL)
+              HGOTO_DONE(SUCCEED);
+          lutsize = Grwrite.datadesc[LUT].xdim * Grwrite.datadesc[LUT].ydim
+              * Grwrite.datadesc[LUT].ncomponents;
+          if (( Grlutdata = (uint8 *) HDmalloc((uint32) lutsize))== NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          HDmemcpy(Grlutdata, imlut, (uint32) lutsize);
+          Ref.lut = 0;
+          HGOTO_DONE(SUCCEED);
+      }
+
+    if (( file_id = DFGRIopen(filename, newfile ? DFACC_CREATE : DFACC_RDWR))== (int32) NULL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* make 8-bit compatibility only for older 8-bit stuff, not JPEG */
+    is8bit = ((Grwrite.datadesc[IMAGE].ncomponents == 1) &&
+              (Grcompr != DFTAG_GREYJPEG5 && Grcompr != DFTAG_JPEG5));
+
+    wtag = (uint16) ((type == LUT) ? DFTAG_LUT : (Grcompr ? DFTAG_CI : DFTAG_RI));
+    Grwrite.data[type].tag = wtag;
+
+    if (( wref = Htagnewref(file_id,wtag))==0)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+    /* write out image/lut */
+    if ((type == IMAGE) && Grcompr)
+      {
+          lutsize = Grwrite.datadesc[LUT].xdim * Grwrite.datadesc[LUT].ydim *
+              Grwrite.datadesc[LUT].ncomponents;
+          if (Grcompr == DFTAG_IMC)
+            {
+                if (Grlutdata == NULL)
+                    HGOTO_ERROR(DFE_BADCALL, FAIL);
+                if (( newlut = (uint8 *) HDmalloc((uint32) lutsize))==NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+          if (DFputcomp(file_id, wtag, wref, imlut, xdim, ydim,
+           (uint8 *) Grlutdata, (uint8 *) newlut, (int16) Grcompr, &Grcinfo)
+              == FAIL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      }
+    else
+      {     /* image need not be compressed */
+          if (Hputelement(file_id, (uint16) wtag, (uint16) wref, imlut,
+                  xdim * ydim * Grwrite.datadesc[type].ncomponents) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      }
+    Grwrite.data[type].ref = wref;
+    Grwrite.aspectratio = (float32) 1.0;
+
+    /* Write out Raster-8 tags for those who want it */
+    if (is8bit)
+      {
+          wtag = (uint16) ((type == LUT) ? DFTAG_IP8 : Grcompr ?
+                           ((Grcompr == DFTAG_RLE) ? DFTAG_CI8 :
+                            DFTAG_II8) : DFTAG_RI8);
+
+          if (Hdupdd(file_id, wtag, wref, Grwrite.data[type].tag, wref) == FAIL)
+              HGOTO_ERROR(DFE_DUPDD, FAIL);
+      }     /* end if */
+
+    if (type == IMAGE)
+        Grwrite.datadesc[IMAGE].compr.tag = (uint16) Grcompr;
+
+    if (Grcompr == DFTAG_IMC)
+      {
+          if (Hputelement(file_id, DFTAG_LUT, wref, newlut, lutsize) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          Ref.lut = (intn)wref;
+      }
+
+    if (( rigref = Htagnewref(file_id,DFTAG_RIG))==0)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    if (DFGRaddrig(file_id, rigref, &Grwrite) == FAIL)    /* writes ID, NT */
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    if (is8bit)
+      {
+          /* put in Raster-8 stuff also, for those who want it */
+          if ((Ref.lut >= 0)
+              && Hdupdd(file_id, DFTAG_IP8, wref, DFTAG_LUT, wref) == FAIL)
+              HGOTO_ERROR(DFE_DUPDD, FAIL);
+          p = (uint8 *) &r8dims.xdim;
+          UINT16ENCODE(p, Grwrite.datadesc[IMAGE].xdim);
+          UINT16ENCODE(p, Grwrite.datadesc[IMAGE].ydim);
+          if (Hputelement(file_id, DFTAG_ID8, wref, (uint8 *) &r8dims, (int32) 4) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      }
+
+    if (Grcompr == DFTAG_IMC)
+      {
+          Ref.lut = 0;
+          HDfree(newlut);
+          newlut = NULL;
+      }
+
+#ifdef OLD_WAY
+    Grlastref = wref;   /* remember the last ref */
+#else /* OLD_WAY */
+    Grlastref = rigref;   /* remember the last ref */
+#endif /* OLD_WAY */
+
+    wref = 0;   /* don't know ref to write next */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        
+    } /* end if */
+
+  /* Normal function cleanup */
+  if(file_id!=(-1))
+    Hclose(file_id);
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFGRlastref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Globals: Grlastref
+ * Returns: ref on success
+ * Users:   HDF users, utilities, other routines
+ * Invokes: none
+ * Method:  return Grlastref
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+uint16
+DFGRIlastref(void)
+{
+    return ((uint16) Grlastref);
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFGRIstart
+ PURPOSE
+    DFGR-level initialization routine
+ USAGE
+    intn DFGRIstart()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Register the shut-down routine (DFGRPshutdown) for call with atexit
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn DFGRIstart(void)
+{
+    CONSTR(FUNC, "DFGRIstart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&DFGRPshutdown) != 0)
+      HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return(ret_value);
+} /* end DFGRIstart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFGRPshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn DFGRshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the DFGR routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn DFGRPshutdown(void)
+{
+    if(Grlastfile!=NULL)
+      {
+          HDfree(Grlastfile);
+          Grlastfile=NULL;
+      } /* end if */
+    return(SUCCEED);
+} /* end DFGRPshutdown() */
+
diff --git a/hdf/src/dfgr.h b/hdf/src/dfgr.h
new file mode 100644
index 0000000..626a57a
--- /dev/null
+++ b/hdf/src/dfgr.h
@@ -0,0 +1,74 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfgr.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfgr.h
+ * Purpose: header file for the Raster Image set
+ * Invokes: df.h
+ * Contents:
+ *  Structure definitions: DFGRdr, DFGRrig
+ * Remarks: This is included with user programs which use general raster
+ *---------------------------------------------------------------------------*/
+
+#ifndef DFGR_H  /* avoid re-inclusion */
+#define DFGR_H
+
+/* description record: used to describe image data, palette data etc. */
+typedef struct
+  {
+      intn        ncomponents;  /* number of components */
+      intn        interlace;    /* data ordering: chunky / planar etc */
+      int32       xdim;         /* X- dimension of data */
+      int32       ydim;         /* Y- dimensionsof data */
+      DFdi        nt;           /* number type of data */
+      DFdi        compr;        /* compression */
+      /* ### Note: compression is currently uniquely described with a tag.
+         No data is attached to this tag/ref.  But this capability is
+         provided for future expansion, when this tag/ref might point to
+         some data needed for decompression, such as the actual encodings */
+  }
+DFGRdr;
+
+/* structure to hold RIG info */
+typedef struct
+  {
+      char       *cf;           /* color format */
+      int32       xpos;         /* X position of image on screen */
+      int32       ypos;         /* Y position of image on screen */
+      float32     aspectratio;  /* ratio of pixel height to width */
+      float32     ccngamma;     /* gamma color correction parameter */
+      float32     ccnred[3];    /* red color correction parameter */
+      float32     ccngrren[3];  /* green color correction parameter */
+      float32     ccnblue[3];   /* blue color correction parameter */
+      float32     ccnwhite[3];  /* white color correction parameter */
+      DFdi        data[3];      /* image/lut/mattechannel */
+      DFGRdr      datadesc[3];  /* description of image/lut/mattechannel */
+  }
+DFGRrig;
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/* Library-developer functions */
+    extern int32 DFGRIopen
+                (const char *filename, int acc_mode);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* DFGR_H */
diff --git a/hdf/src/dfgroup.c b/hdf/src/dfgroup.c
new file mode 100644
index 0000000..20cc232
--- /dev/null
+++ b/hdf/src/dfgroup.c
@@ -0,0 +1,339 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfgroup.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfgroup.c
+ * Purpose: Low level functions for implementing groups
+ * Invokes: df.c df.h
+ * Contents:
+ *  DFdiread   : read in the data identifier list from the group
+ *  DFdiget    : get next data identifier from list
+ *  DFdisetup  : get ready to store a list of data identifiers to write out
+ *  DFdiput    : add a data identifier to the list to be written out
+ *  DFdiwrite  : write out the list of data identifiers
+ * Remarks: A group is a way of associating data elements with each other.
+ *          It is a tag whose data is a list of tag/refs
+ *          Each tag/ref combination is called a data identifier (DI).
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "hfile.h"
+
+#if 0
+#define MAX_GROUPS 8
+#endif
+
+typedef struct DIlist_struct
+  {
+      uint8      *DIlist;
+      intn        num;
+      intn        current;
+  }
+DIlist     , *DIlist_ptr;
+
+static DIlist_ptr Group_list[MAX_GROUPS] = {NULL};
+
+#define GSLOT2ID(s) ((((uint32)GROUPTYPE & 0xffff) << 16) | ((s) & 0xffff))
+#define VALIDGID(i) (((((uint32)(i) >> 16) & 0xffff) == GROUPTYPE) && \
+                    (((uint32)(i) & 0xffff) < MAX_GROUPS))
+#define GID2REC(i)  ((VALIDGID(i) ? (Group_list[(uint32)(i) & 0xffff]) : NULL))
+
+/*-----------------------------------------------------------------------------
+ * Name:    setgroupREC
+ * Purpose: Add a group list into the internal structure and return an ID
+ * Inputs:  list_rec: list to remember
+ * Returns: FAIL on failure else a group ID to the list
+ * Users:   other group routines
+ * Invokes:
+ * Remarks: Allocates internal storeage if necessary
+ *---------------------------------------------------------------------------*/
+PRIVATE int32
+setgroupREC(DIlist_ptr list_rec)
+{
+    CONSTR(FUNC, "setgroupREC");
+    uintn       i;
+
+    for (i = 0; i < MAX_GROUPS; i++)
+        if (Group_list[i]==NULL)
+          {
+              Group_list[i] = list_rec;
+              return (int32)GSLOT2ID(i);
+          }
+
+    HRETURN_ERROR(DFE_INTERNAL, FAIL)
+}   /* setgroupREC */
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFdiread
+ * Purpose: Read a list of DIs into memory
+ * Inputs:  file_id: HDF file pointer
+ *          tag, ref: id of group which is to be read in
+ * Returns: FAIL on failure else a group ID to the list
+ * Users:   HDF systems programmers, DF8getrig, other routines
+ * Invokes: HDvalidfid, DFIfind, DFgetelement
+ * Remarks: assumes tag is a group
+ *---------------------------------------------------------------------------*/
+
+int32
+DFdiread(int32 file_id, uint16 tag, uint16 ref)
+{
+    DIlist_ptr  new_list;
+    CONSTR(FUNC, "DFdiread");
+    int32       length;
+
+    HEclear();
+
+    if (!HDvalidfid(file_id))
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* Find the group. */
+    length = Hlength(file_id, tag, ref);
+    if (length == FAIL)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+    /* allocate a new structure to hold the group */
+    new_list = (DIlist_ptr) HDmalloc((uint32) sizeof(DIlist));
+    if (!new_list)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    new_list->DIlist = (uint8 *) HDmalloc((uint32) length);
+    if (!new_list->DIlist)
+      {
+          HDfree((VOIDP) new_list);
+          HRETURN_ERROR(DFE_NOSPACE, FAIL)
+      }
+
+    new_list->num = (intn) (length / 4);
+    new_list->current = 0;  /* no DIs returned so far */
+
+    /* read in group */
+    if (Hgetelement(file_id, tag, ref, (uint8 *) new_list->DIlist) < 0)
+      {
+          HDfree((VOIDP) new_list->DIlist);
+          HDfree((VOIDP) new_list);
+          HRETURN_ERROR(DFE_READERROR, FAIL)
+      }
+    return (int32) setgroupREC(new_list);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFdiget
+ * Purpose: return next DI from the list of DIs in a group
+ * Inputs:  list: handle to group (which is list of DIs)
+ * Outputs: ptag: pointer to tag part of DI to be returned
+ *          pref: pointer to ref part of DI to be returned
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF systems programmers, DF8getrig, other routines
+ * Invokes: none
+ * Remarks: frees Dilist space when all DIs returned
+ *---------------------------------------------------------------------------*/
+
+intn
+DFdiget(int32 list, uint16 *ptag, uint16 *pref)
+{
+    CONSTR(FUNC, "DFdiget");
+    uint8      *p;
+    DIlist_ptr  list_rec;
+
+    list_rec = GID2REC(list);
+
+    if (!list_rec)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+    if (list_rec->current >= list_rec->num)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+    /* compute address of Ndi'th di */
+    p = (uint8 *) list_rec->DIlist + 4 * list_rec->current++;
+    UINT16DECODE(p, *ptag);
+    UINT16DECODE(p, *pref);
+
+    if (list_rec->current == list_rec->num)
+      {
+          HDfree((VOIDP) list_rec->DIlist);    /*if all returned, free storage */
+          HDfree((VOIDP) list_rec);
+          Group_list[list & 0xffff] = NULL;     /* YUCK! BUG! */
+      }
+    return SUCCEED;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFdinobj
+ * Purpose: return number of tag/refs in the group
+ * Inputs:  list: handle to group (which is list of DIs)
+ * Returns: number of tag/refs in the group on success,
+ *  -1 on failure with error set
+ * Users:   HDF systems programmers, hdp utility
+ * Invokes: none
+ * Remarks: nuttin'
+ *---------------------------------------------------------------------------*/
+intn
+DFdinobj(int32 list)
+{
+    CONSTR(FUNC, "DFdinobj");
+    DIlist_ptr  list_rec;
+
+    list_rec = GID2REC(list);
+
+    if (!list_rec)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    return (list_rec->num);
+}   /* DFdinobj() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFdisetup
+ * Purpose: setup space for storing a list of DIs to be written out
+ * Inputs:  maxsize: maximum number of DIs expected in the list
+ * Returns: FAIL on failure with error set
+ *          else a group ID
+ * Users:   HDF systems programmers, DF8putrig, other routines
+ * Invokes: none
+ * Remarks: This call should go away sometime.  Need better way to allocate
+ *          space, possibly just use a big block of static space
+ *---------------------------------------------------------------------------*/
+
+int32
+DFdisetup(int maxsize)
+{
+    CONSTR(FUNC, "DFdisetup");
+    DIlist_ptr  new_list;
+
+    new_list = (DIlist_ptr) HDmalloc((uint32) sizeof(DIlist));
+
+    if (!new_list)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    new_list->DIlist = (uint8 *) HDmalloc((uint32) (maxsize * 4));
+    if (!new_list->DIlist)
+      {
+          HDfree((VOIDP) new_list);
+          HRETURN_ERROR(DFE_NOSPACE, FAIL)
+      }
+
+    new_list->num = maxsize;
+    new_list->current = 0;
+
+    return setgroupREC(new_list);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFdiput
+ * Purpose: add a DI to the list to be written out
+ * Inputs:  tag, ref: DI to add
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF systems programmers, DF8putrig, other routines
+ * Invokes: none
+ * Remarks: arg is tag/ref rather than DI for convenience
+ *---------------------------------------------------------------------------*/
+
+intn
+DFdiput(int32 list, uint16 tag, uint16 ref)
+{
+    CONSTR(FUNC, "DFdiput");
+    uint8      *p;
+    DIlist_ptr  list_rec;
+
+    list_rec = GID2REC(list);
+
+    if (!list_rec)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+    if (list_rec->current >= list_rec->num)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+    /* compute address of Ndi'th di to put tag/ref in */
+    p = (uint8 *) list_rec->DIlist + 4 * list_rec->current++;
+    UINT16ENCODE(p, tag);
+    UINT16ENCODE(p, ref);
+
+    return SUCCEED;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFdiwrite
+ * Purpose: Write DI list out to HDF file
+ * Inputs:  file_id: HDF file pointer
+ *          tag, ref: tag and ref of group whose contents is the list
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF systems programmers, DF8putrig, other routines
+ * Invokes: none
+ * Remarks: frees storage for Dilist
+ *---------------------------------------------------------------------------*/
+
+intn
+DFdiwrite(int32 file_id, int32 list, uint16 tag, uint16 ref)
+{
+    CONSTR(FUNC, "DFdiwrite");
+    int32       ret;            /* return value */
+    DIlist_ptr  list_rec;
+
+    if (!HDvalidfid(file_id))
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    list_rec = GID2REC(list);
+
+    if (!list_rec)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    ret = Hputelement(file_id, tag, ref, list_rec->DIlist,
+                      (int32) list_rec->current * 4);
+    HDfree((VOIDP) list_rec->DIlist);
+    HDfree((VOIDP) list_rec);
+    Group_list[list & 0xffff] = NULL;   /* YUCK! BUG! */
+    return (intn) ret;
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFdifree
+ * Purpose: Cleanup DI group
+ * Inputs:  groupID
+ * Returns: none
+ * Users:   callers of DFdiget() when it is NOT called for every pair in the group.
+ * Invokes: none
+ * Remarks: Notes from Fortner Build Notes:
+ *		While working on a group, its info is stored in RAM, and the pointer to 
+ *		that info is kept in a global array called Group_List. the size of Group_List 
+ *		is fixed, and contains MAX_GROUPS pointers. When DFdiget() has returned 
+ *		the last tag-ref pair from a given group's info, that info is freed, and 
+ *		the corresponding slot in the Group_List array is available for re-use.
+ *
+ *		If DFdiget() is NOT called for every pair in the group, the group info is 
+ *		never freed, except by the use of this routine. So when a loop based on 
+ *		DFdiget() exits early, it should first call freeDIGroup() to recover the 
+ *		group slot for future use. 
+ *
+ *		The typical example seems to be an error occuring within the DFdiget() 
+ *		loop or finding an element while doing a search.
+ *
+ *---------------------------------------------------------------------------*/
+void DFdifree(int32 groupID)
+{
+#ifdef LATER
+    CONSTR(FUNC, "DFdifree");
+#endif /* LATER */
+	DIlist_ptr	list_rec;
+	
+	list_rec = GID2REC( groupID );
+	if (list_rec == NULL )
+		return;
+	
+	HDfree((void*) list_rec->DIlist );
+	HDfree((void*) list_rec );
+	Group_list[groupID & 0xffff ] = NULL;
+}
diff --git a/hdf/src/dfi.h b/hdf/src/dfi.h
new file mode 100644
index 0000000..5f3c64c
--- /dev/null
+++ b/hdf/src/dfi.h
@@ -0,0 +1,151 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfi.h 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfi.h
+ * Purpose: HDF internal header file
+ * Invokes: stdio.h, sys/file.h
+ * Contents:
+ *  Compilation parameters
+ *  Machine-dependent definitions
+ *  Flexibility definitions: i/o buffering, dynamic memory, structure i/o
+ *  Size parameters
+ * Remarks: To port to a new system, only dfi.h and Makefile need be modified.
+ *          This file is included with user programs, but users do not see it.
+ *---------------------------------------------------------------------------*/
+
+#ifndef DFI_H
+#define DFI_H
+
+/*--------------------------------------------------------------------------*/
+/*          Compilation Parameters for Flexibility and Portability          */
+
+/* modify this line for buffered/unbuffered i/o */
+#define DF_BUFFIO
+
+/* modify this line for dynamic/static memory allocation */
+#define DF_DYNAMIC
+
+/* modify this line if structures cannot be read/written as is */
+#undef  DF_STRUCTOK     /* leave it this way - hdfsh expects it */
+
+/*--------------------------------------------------------------------------*/
+/*                      Machine dependencies                                */
+/*--------------------------------------------------------------------------*/
+
+#ifdef IRIX
+#undef DF_STRUCTOK
+#include <sys/types.h>
+#include <sys/file.h>   /* for unbuffered i/o stuff */
+#ifndef DFmovmem
+#define DFmovmem(from, to, len) bcopy(from, to, len)
+#endif /* DFmovmem */
+#ifndef DF_STRUCTOK
+#define UINT16READ(p, x)    { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
+#define INT16READ(p, x)     { x = (*p++)<<8; x |= (*p++) & 255; }
+#define INT32READ(p, x)     { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
+                                x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
+#define UINT16WRITE(p, x)   { *p++ = (x>>8) & 255; *p++ = x & 255; }
+#define INT16WRITE(p, x)    { *p++ = (x>>8) & 255; *p++ = x & 255; }
+#define INT32WRITE(p, x)    { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;   \
+                                *p++ = (x>>8) & 255; *p++ = x & 255; }
+#endif /*DF_STRUCTOK */
+#define DF_CREAT(name, prot) creat(name, prot)
+#ifndef DF_MT
+#define DF_MT   DFMT_IRIX
+#endif /* DF_MT  */
+#endif /*IRIX */
+
+#ifdef IBM6000  /* NOTE: IBM6000 defines are same as for SUN */
+#if ! defined mc68010 && ! defined mc68020 && ! defined mc68030
+#undef DF_STRUCTOK
+#endif
+#include <sys/file.h>   /* for unbuffered i/o stuff */
+#define DFmovmem(from, to, len) memcpy(to, from, len)
+#ifndef DF_STRUCTOK
+#define UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
+#define INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
+#define INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
+            x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
+#define UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
+#define INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
+#define INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
+            *p++ = (x>>8) & 255; *p++ = x & 255; }
+#endif /*DF_STRUCTOK */
+#define DF_CREAT(name, prot) creat(name, prot)
+#define DF_MT   DFMT_IBM6000
+#endif /*IBM6000 */
+
+#ifdef APOLLO
+#if ! defined mc68010 && ! defined mc68020 && ! defined mc68030
+#undef DF_STRUCTOK
+#endif
+#include <sys/file.h>   /* for unbuffered i/o stuff */
+#define int8 char
+#define uint8 unsigned char
+#define int16 short int
+#define uint16 unsigned short int
+#define int32 long int
+#define uint32 unsigned long int
+#define float32 float
+#define DFmovmem(from, to, len) memcpy(to, from, len)
+#ifndef DF_STRUCTOK
+#define UINT16READ(p, x) { x = ((*p++) & 255)<<8; x |= (*p++) & 255; }
+#define INT16READ(p, x) { x = (*p++)<<8; x |= (*p++) & 255; }
+#define INT32READ(p, x) { x = (*p++)<<24; x|=((*p++) & 255)<<16;    \
+            x|=((*p++) & 255)<<8; x|=(*p++) & 255; }
+#define UINT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
+#define INT16WRITE(p, x) { *p++ = (x>>8) & 255; *p++ = x & 255; }
+#define INT32WRITE(p, x) { *p++ = (x>>24) & 255; *p++ = (x>>16) & 255;  \
+            *p++ = (x>>8) & 255; *p++ = x & 255; }
+#endif /*DF_STRUCTOK */
+#define DF_CREAT(name, prot) creat(name, prot)
+#define DF_MT   DFMT_APOLLO
+#endif /*APOLLO */
+
+/*--------------------------------------------------------------------------*/
+/*                      Flexibility parameters                              */
+#ifdef DF_BUFFIO    /* set all calls to do buffered I/O */
+#define DF_OPEN(x,y) fopen(x,y)
+#define DF_CLOSE(x) fclose(x)
+#define DF_SEEK(x,y,z) fseek(x,y,z)
+#define DF_SKEND(x,y,z) fseek(x,y,z)
+#define DF_TELL(x) ftell(x)
+#define DF_READ(a,b,c,d) fread(a,b,c,d)
+#define DF_WRITE(a,b,c,d) fwrite(a,b,c,d)
+#define DF_FLUSH(a) fflush(a)
+#define DF_OPENERR(f)   (!(f))
+#define DF_RDACCESS "rb"
+#define DF_WRACCESS "rb+"
+
+#else  /*DF_BUFFIO         unbuffered i/o */
+#define DF_OPEN(x,y) open(x,y)
+#define DF_CLOSE(x) close(x)
+#define DF_SEEK(x,y,z) lseek(x,y,z)
+#define DF_SKEND(x,y,z) lseek(x,-1*y,z)
+#define DF_TELL(x) lseek(x,0L,1)
+#define DF_READ(a,b,c,d) read(d,a,b*c)
+#define DF_WRITE(a,b,c,d) write(d,a,b*c)
+#define DF_OPENERR(f)   ((f) == -1)
+#define DF_FLUSH(a)     /* no need to flush */
+#define DF_RDACCESS O_RDONLY
+#define DF_WRACCESS O_RDWR
+#endif /* DF_BUFFIO */
+
+#ifndef FILE
+#include <stdio.h>
+#endif /*FILE */
+
+#endif /* DFI_H */
diff --git a/hdf/src/dfimcomp.c b/hdf/src/dfimcomp.c
new file mode 100644
index 0000000..1e049e3
--- /dev/null
+++ b/hdf/src/dfimcomp.c
@@ -0,0 +1,1119 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: dfimcomp.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/************************************************************************/
+/*  Module Name : imcomp                                                */
+/*  Exports     : DFCimcomp(), DFCunimcomp()                            */
+/*  Purpose     : Compresses color images                               */
+/*  Author  : Eng-Kiat Koh                                              */
+/*  Date    : June 30th, 1988                                           */
+/*  Functions   : DFCimcomp(), compress(), init_global(), cnt_color()   */
+/*        set_palette(), fillin_color(), map(), nearest_color()         */
+/*        DFCunimcomp(), sqr()                                          */
+/************************************************************************/
+
+#include "hdf.h"
+
+#define PALSIZE 256
+#define BIT8 0
+#define BIT24 1
+#define MAXCOLOR 32768
+
+#ifndef NULL
+#   define NULL 0
+#endif
+
+#define RED 0
+#define GREEN 1
+#define BLUE 2
+#define EPSILON 0.5
+#define LO 1
+#define HI 0
+
+struct rgb
+  {
+      uint8       c[3];
+  };
+
+struct box
+  {
+      float32     bnd[3][2];
+      int        *pts;
+      int         nmbr_pts;
+      int         nmbr_distinct;
+      struct box *left;
+      struct box *right;
+  };
+
+static uint8      *new_pal;            /* pointer to new palette           */
+
+static int *hist = (int *) NULL;    /* histogram for distinct colors    */
+static struct box *frontier = (struct box *) NULL;  /* pointer to the */
+/* list of boxes */
+static struct rgb *distinct_pt = (struct rgb *) NULL;   /* contains all */
+/* distinct rgb points */
+
+static struct rgb *color_pt = (struct rgb *) NULL;  /*contains the hi-lo */
+/*colors for each block */
+static uint8 *image;            /* contains the compressed image            */
+static int  trans[MAXCOLOR];    /* color translation table                  */
+
+PRIVATE VOID compress(unsigned char raster[], int block);
+PRIVATE VOID init_global(int32 xdim, int32 ydim, VOIDP out, VOIDP out_pal);
+PRIVATE int cnt_color(int blocks);
+PRIVATE VOID set_palette(int blocks);
+PRIVATE VOID fillin_color(int blocks);
+PRIVATE int indx(unsigned char r, unsigned char g, unsigned char b);
+PRIVATE VOID map(int blocks);
+PRIVATE int nearest_color(uint8 r, uint8 g, uint8 b);
+PRIVATE uint32 sqr(int16 x);
+PRIVATE VOID sel_palette(int blocks, int distinct, struct rgb *my_color_pt);
+PRIVATE VOID init(int blocks, int distinct, struct rgb *my_color_pt);
+PRIVATE VOID sort(int l, int r, int dim, int rank[]);
+PRIVATE int partition(int l, int r, int dim, int rank[]);
+PRIVATE struct box *find_box(void);
+PRIVATE VOID split_box(struct box *ptr);
+PRIVATE VOID assign_color(void);
+PRIVATE int select_dim(struct box *ptr);
+PRIVATE float find_med(struct box *ptr, int dim);
+PRIVATE VOID classify(struct box *ptr, struct box *child);
+PRIVATE int next_pt(int dim, int i, int rank[], int distinct);
+
+/************************************************************************/
+/*  Function: DFCIimcomp                                                */
+/*  Purpose : Performs Imcomp Compression                               */
+/*  Parameters  :                                                       */
+/*    xdim, ydim - dimensions of image                                  */
+/*                 IT IS ASSUMED THAT THE DIMENSIONS ARE A MULTIPLE OF 4 */
+/*    in, out    - input image array and output image buffer size of in */
+/*                 is xdim*ydim bytes for 8 bit per pixel mode. It is 3 */
+/*                 times that for 24 bits per pixel mode. The output    */
+/*                 buffer is always (xdim*ydim)/4.                      */
+/*    in_pal     - input palette. Consist of rgb triples unlike seq-type */
+/*                 palette. This is a NULL pointer if operating at the  */
+/*                 24 bit per pixel mode.                               */
+/*    out_pal    - output palette. Consist of PALSIZE color entries.    */
+/*                 each entry is an rgb triple.                         */
+/*    mode       - Either BIT8 or BIT24                                 */
+/*  Returns     : none                                                  */
+/*  Called by   : External routines                                     */
+/*  Calls       : init_global(), compress(), cnt_color(), set_palette(), */
+/*        sel_palette(), map()                                          */
+/************************************************************************/
+
+VOID
+DFCIimcomp(int32 xdim, int32 ydim, const uint8 *in, uint8 out[],
+           uint8 in_pal[], uint8 out_pal[], int mode)
+{
+    unsigned char raster[48];
+    int         blocks, nmbr;
+    int32       i, j, k, l, x, y;
+
+    init_global(xdim, ydim, (VOIDP) out, (VOIDP) out_pal);
+
+    /* compress pixel blocks */
+    blocks = 0;
+    for (i = 0; i < (ydim / 4); i++)
+        for (j = 0; j < (xdim / 4); j++)
+          {
+              switch (mode)
+                {
+                    case BIT8:      /* 8 bit per pixel format */
+                        k = 0;
+                        for (y = (i * 4); y < (i * 4 + 4); y++)
+                            for (x = (j * 4); x < (j * 4 + 4); x++)
+                              {
+                                  l = y * xdim + x;
+                                  raster[k++] = (unsigned char)
+                                      in_pal[3 * (unsigned char) in[l]];
+                                  raster[k++] = (unsigned char)
+                                      in_pal[3 * (unsigned char) in[l] + 1];
+                                  raster[k++] = (unsigned char)
+                                      in_pal[3 * (unsigned char) in[l] + 2];
+                              }     /* end of for x */
+                        compress(raster, blocks);
+                        break;
+
+                    case BIT24: /* 24 bit per pixel format */
+                        k = 0;
+                        for (y = (i * 4); y < (i * 4 + 4); y++)
+                            for (x = (j * 4); x < (j * 4 + 4); x++)
+                              {
+                                  l = 3 * (y * xdim + x);
+                                  raster[k++] = (unsigned char) in[l];
+                                  raster[k++] = (unsigned char) in[l + 1];
+                                  raster[k++] = (unsigned char) in[l + 2];
+                              }     /* end of for x */
+                        compress(raster, blocks);
+                        break;
+
+                    default:    /* unsupported format */
+                        break;
+                }   /* end of switch */
+
+              blocks++;
+          }     /* end of for j */
+
+    /* set palette */
+    nmbr = cnt_color(blocks);
+    /*
+       printf("Number of colors %d \n", nmbr);
+     */
+    if (nmbr <= PALSIZE)
+        set_palette(blocks);
+    else
+      {
+          sel_palette(blocks, nmbr, color_pt);
+          map(blocks);
+      }
+
+    fillin_color(blocks);
+    if (color_pt)
+      {
+          HDfree((VOIDP) color_pt);
+          color_pt = NULL;
+      }     /* end if */
+
+}   /* end of DFCIimcomp */
+
+/************************************************************************/
+/*  Function    : compress                                              */
+/*  Purpose : Given a block of 16 pixels, sets up a 16 bit bitmap       */
+/*                and assigns a lo and hi color for the block. For block */
+/*                i, hi color is stored in color_pt[2i] and lo in       */
+/*                color_pt[2i+1]. Each color is then reduced to 15 bits */
+/*                by truncating the lower order 3 bits of each component */
+/*  Parameter   :                                                       */
+/*    raster     - contains the 16 pixels of a block. Each pixel is 3   */
+/*         bytes, 1 byte for each color component                       */
+/*    block  - pixel block number                                       */
+/*  Returns     : none                                                  */
+/*  Called by   : DFCimcomp()                                           */
+/*  Calls       : none                                                  */
+/************************************************************************/
+
+PRIVATE     VOID
+compress(unsigned char raster[], int block)
+{
+    float32     y[16], y_av;
+    int         i, j, k, l;
+    uint8       bit;
+    int         high, hi, lo;
+    int         c_hi[3], c_lo[3];
+
+    /* calculate luminance */
+    y_av = (float32) 0.0;
+    for (i = 0; i < 16; i++)
+      {
+          j = 3 * i;
+          y[i] = (float32) 0.3 *(float32) raster[j] +
+                      (float32) 0.59 *(float32) raster[j + 1] +
+                      (float32) 0.11 *(float32) raster[j + 2];
+          /*    printf("compress: y[%d] is %f\n",i,y[i]); */
+          y_av = y_av + y[i];
+      }
+    y_av /= (float32) 16.0;
+    /*  printf("y_av is %f\n",y_av); */
+
+    /* initialize c_hi and c_lo */
+    for (i = RED; i <= BLUE; i++)
+      {
+          c_hi[i] = 0;
+          c_lo[i] = 0;
+      }
+
+    /* build bit map */
+    k = 4 * block;
+    high = 0;
+    hi = 2 * block;
+    lo = hi + 1;
+    for (i = 0; i < 2; i++)
+      {
+          bit = 128;
+          for (j = (i * 8); j < (i * 8 + 8); j++)
+            {
+                if (y[j] > y_av)
+                  {
+                      image[k] |= bit;
+                      high++;
+                      for (l = RED; l <= BLUE; l++)
+                          c_hi[l] = c_hi[l] + (int) raster[3 * j + l];
+                  }
+                else
+                  {
+                      for (l = RED; l <= BLUE; l++)
+                          c_lo[l] = c_lo[l] + (int) raster[3 * j + l];
+                  }     /* end of if */
+
+                bit = (uint8)(bit>>1);
+            }   /* end of for j */
+
+          k++;
+      }     /* end of for i */
+
+    /* calculate hi lo color */
+    for (i = RED; i <= BLUE; i++)
+      {
+          if (high != 0)
+              color_pt[hi].c[i] = (uint8) ((float) c_hi[i] / (float) high);
+          if (high != 16)
+              color_pt[lo].c[i] = (uint8) ((float) c_lo[i] / (float) (16 - high));
+          color_pt[hi].c[i] = (uint8)(color_pt[hi].c[i] >> 3);
+          color_pt[lo].c[i] = (uint8)(color_pt[lo].c[i] >> 3);
+
+      }
+}   /* end of compress */
+
+/************************************************************************/
+/*  Function    : init_global                       */
+/*  Purpose : Allocates memory for global variables                 */
+/*  Parameter   :                           */
+/*    xdim, ydim - x and y dimension of image               */
+/*    out        - pointer to output buffer                             */
+/*    out_pal    - pointer to output palette                            */
+/*  Returns     : none                              */
+/*  Called by   : DFCimcomp()                       */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE     VOID
+init_global(int32 xdim, int32 ydim, VOIDP out, VOIDP out_pal)
+{
+    int32       i, j;
+
+    /* allocate memory */
+    image = (unsigned char *) out;
+    new_pal = (unsigned char *) out_pal;
+    if (color_pt)
+        HDfree((VOIDP) color_pt);
+    color_pt = (struct rgb *) HDmalloc((unsigned) ((xdim * ydim) / 8) *
+                                         sizeof(struct rgb));
+
+    if (image == NULL || color_pt == NULL || new_pal == NULL)
+      {
+          return; /* punt! */
+      }
+
+    /* initialize */
+    for (i = 0; i < (xdim * ydim / 4); i++)
+        image[i] = 0;
+
+    for (i = 0; i < (xdim * ydim / 8); i++)
+        for (j = RED; j <= BLUE; j++)
+            color_pt[i].c[j] = 0;
+
+    for (i = 0; i < MAXCOLOR; i++)
+        trans[i] = -1;
+}   /* end of init_global */
+
+/************************************************************************/
+/*  Function    : cnt_color                                 */
+/*  Purpose : Counts the number of distinct colors compressd image  */
+/*  Parameter   :                           */
+/*    blocks     - total number of pixel blocks             */
+/*  Returns     : Number of distinct colors                             */
+/*  Called by   : DFCimcomp()                                           */
+/*  Calls       : indx()                        */
+/************************************************************************/
+
+PRIVATE int
+cnt_color(int blocks)
+{
+    int         temp[MAXCOLOR];
+    int         i, k, count;
+
+    for (i = 0; i < MAXCOLOR; i++)
+        temp[i] = -1;
+
+    for (i = 0; i < (2 * blocks); i++)
+      {
+          k = indx(color_pt[i].c[RED], color_pt[i].c[GREEN], color_pt[i].c[BLUE]);
+          /*    printf("cnt_color: k is %d\n",k); */
+          if (k < MAXCOLOR) /* Fortner Fix: supplied by Peter Lawton */
+              temp[k] = 0;
+      }
+
+    count = 0;
+    for (i = 0; i < MAXCOLOR; i++)
+        if (temp[i] == 0)
+            count++;
+
+    return count;
+}   /* end of cnt_color */
+
+/************************************************************************/
+/*  Function    : set_palette                       */
+/*  Purpose : The number of distinct colors is less than the desired */
+/*                output palette size. Therefore each distinct color can */
+/*        be a palette entry. Function enters each distinct     */
+/*                color as a palette entry and sets up the translation  */
+/*                table. It also shifts each color component left 3 bits */
+/*                so that each color component is again 8 bits wide     */
+/*  Parameter   :                           */
+/*    blocks     - total number of pixel blocks                         */
+/*  Returns     : none                          */
+/*  Called by   : DFCimcomp()                       */
+/*  Calls       : indx()                        */
+/************************************************************************/
+
+PRIVATE     VOID
+set_palette(int blocks)
+{
+    int         ent, i, k;
+
+    ent = 0;
+    for (i = 0; i < (2 * blocks); i++)
+      {
+          k = indx(color_pt[i].c[RED], color_pt[i].c[GREEN], color_pt[i].c[BLUE]);
+          if (trans[k] == -1)
+            {
+                new_pal[3 * ent] = (uint8) (color_pt[i].c[RED] << 3);
+                new_pal[3 * ent + 1] = (uint8) (color_pt[i].c[GREEN] << 3);
+                new_pal[3 * ent + 2] = (uint8) (color_pt[i].c[BLUE] << 3);
+                trans[k] = ent;
+                ent++;
+            }
+      }
+}   /* end of set_palette */
+
+/************************************************************************/
+/*  Function    : fillin_color                      */
+/*  Purpose : For each pixel block, fills in the pointers into the  */
+/*                palette.                                              */
+/*  Parameter   :                           */
+/*    blocks     - total number of pixel blocks             */
+/*  Returns     : none                          */
+/*  Called by   : DFCimcomp()                       */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE     VOID
+fillin_color(int blocks)
+{
+    int         i, j, k;
+
+    for (i = 0; i < blocks; i++)
+        for (j = HI; j <= LO; j++)
+          {
+              k = indx(color_pt[2 * i + j].c[RED], color_pt[2 * i + j].c[GREEN],
+                       color_pt[2 * i + j].c[BLUE]);
+              image[i * 4 + 2 + j] = (uint8) trans[k];
+          }
+}   /* end of fillin_color */
+
+/************************************************************************/
+/*  Function    : indx                          */
+/*  Purpose : Maps an rgb triple (5 bits each) to an integer array  */
+/*        index                         */
+/*  Parameter   :                           */
+/*    r, g, b    - color components                 */
+/*  Returns     : returns an array index                */
+/*  Called by   : set_palette(), fillin_color(), map()                  */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE int
+indx(unsigned char r, unsigned char g, unsigned char b)
+{
+    int         temp;
+
+    temp = 0;
+    temp = ((r & 0x1f) << 10) | ((g & 0x1f) << 5) | (b & 0x1f);
+    return temp;
+}   /* end of indx */
+
+/************************************************************************/
+/*  Function    : map                           */
+/*  Purpose : Maps a color_pt to the closest representative color   */
+/*        Sets up translation table             */
+/*  Parameter   :                           */
+/*    blocks     - total number of pixel blocks             */
+/*  Returns     : none                          */
+/*  Called by   : DFCimcomp()                       */
+/*  Calls       : nearest_color()                   */
+/************************************************************************/
+
+PRIVATE     VOID
+map(int blocks)
+{
+    int         i, k;
+    uint8       r, g, b;
+
+    for (i = 0; i < (2 * blocks); i++)
+      {
+          k = indx(color_pt[i].c[RED], color_pt[i].c[GREEN], color_pt[i].c[BLUE]);
+
+          if (trans[k] == -1)
+            {
+                r = (uint8) (color_pt[i].c[RED] << 3);
+                g = (uint8) (color_pt[i].c[GREEN] << 3);
+                b = (uint8) (color_pt[i].c[BLUE] << 3);
+                trans[k] = nearest_color(r, g, b);
+                /*
+                   printf("map: %d %d %d mapped to %d %d %d\n", r, g, b, new_pal[tran
+                   s[k]*3
+                   ],
+                   new_pal[trans[k]*3+1], new_pal[trans[k]*3+2]);
+                 */
+            }
+      }
+}   /* end of map */
+
+/************************************************************************/
+/*  Function    : nearest_color                     */
+/*  Purpose : Finds the nearest palette color           */
+/*  Parameter   :                           */
+/*    r, g, b    - color component                  */
+/*  Returns     : Entry number of the closest color in the palette      */
+/*  Called by   : map()                         */
+/*  Calls       : sqr()                         */
+/************************************************************************/
+
+PRIVATE int
+nearest_color(uint8 r, uint8 g, uint8 b)
+{
+    int         i, nearest;
+    long int    min, error;
+
+    min = (long)(sqr((int16) (r - new_pal[0])) + sqr((int16) (g - new_pal[1])) +
+        sqr((int16) (b - new_pal[2])));
+    nearest = 0;
+    for (i = 1; i < PALSIZE; i++)
+      {
+          error = (long)(sqr((int16) (r - new_pal[3 * i])) + sqr((int16) (g - new_pal[3 * i + 1])) +
+              sqr((int16) (b - new_pal[3 * i + 2])));
+          if (error < min)
+            {
+                min = error;
+                nearest = i;
+            }
+      }
+
+    return nearest;
+}   /* end of nearest_color */
+
+/************************************************************************/
+/*  Function    : sqr                           */
+/*  Purpose : Computes the square of an integer         */
+/*  Parameter   :                           */
+/*    x      - an integer                       */
+/*  Returns     : The square of x                   */
+/*  Called by   : nearest_color()                   */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE uint32
+sqr(int16 x)
+{
+    return ((uint32) x * (uint32) x);
+}
+
+/************************************************************************/
+/*  Function    : DFCIunimcomp                       */
+/*  Purpose : 'Decompresses' the compressed image           */
+/*  Parameter   :                           */
+/*    xdim, ydim - dimensions of image                  */
+/*    in, out    - Input buffer and output buffer. Size of input buffer */
+/*         is (xdim*ydim)/4. Size of output buffer is 4 times   */
+/*         that. It 'restores' images into seq-type files       */
+/*  Returns     : none                          */
+/*  Called by   : External routines                 */
+/*  Calls       : none                          */
+/************************************************************************/
+
+VOID
+DFCIunimcomp(int32 xdim, int32 ydim, uint8 in[], uint8 out[])
+{
+    int         bitmap, temp;
+    int32       i, j, k, x, y;
+    uint8       hi_color, lo_color;
+
+    for (y = 0; y < (ydim / 4); y++)
+        for (x = 0; x < xdim; x = x + 4)
+          {
+              k = y * xdim + x;
+              hi_color = (unsigned char) in[k + 2];
+              lo_color = (unsigned char) in[k + 3];
+
+              bitmap = ((unsigned char) in[k] << 8) | (unsigned char) in[k + 1];
+
+              for (i = (y * 4); i < (y * 4 + 4); i++)
+                {
+                    temp = bitmap >> (3 + y * 4 - i) * 4;
+                    for (j = x; j < (x + 4); j++)
+                      {
+                          if ((temp & 8) == 8)
+                              out[i * xdim + j] = (char) hi_color;
+                          else
+                              out[i * xdim + j] = (char) lo_color;
+                          temp = temp << 1;
+                      }
+                }
+          }     /* end of for x */
+}   /* end of DFCIunimcomp */
+
+/************************************************************************/
+/*  Module Name : color                         */
+/*  Exports     : sel_palette(); new_pal, pointer to a new color palette */
+/*  Purpose     : Quantizes colors                  */
+/*  Author  : Eng-Kiat Koh                      */
+/*  Date    : June 30th, 1988                   */
+/*  Functions   : sel_palette(), init(), sort(), partition(), find_box() */
+/*        split_box(), assign_color(), select_dim(), find_med() */
+/*                classify(), next_pt()                                 */
+/************************************************************************/
+
+/************************************************************************/
+/*  Function    : sel_palette                       */
+/*  Purpose : Selects PALSIZE palette colors out of a list of colors */
+/*        in color_pt                       */
+/*  Parameter   :                           */
+/*    blocks     - number of pixel blocks               */
+/*    distinct   - number of distinct colors                */
+/*    color_pt   - contains the lo hi colors for each pixel block       */
+/*  Returns     : none                          */
+/*  Called by   : DFCimcomp()                       */
+/*  Calls       : init(), split_box(), find_box(), assign_color()   */
+/************************************************************************/
+
+PRIVATE     VOID
+sel_palette(int blocks, int distinct, struct rgb *my_color_pt)
+{
+    int         boxes;
+    /*  int i, j; */
+    struct box *ptr;
+
+    init(blocks, distinct, my_color_pt);
+
+    /* split box into smaller boxes with about equal number of points */
+    for (boxes = 1; boxes < PALSIZE; boxes++)
+      {
+          /*
+             ptr=frontier->right;
+             j = 0;
+             while (ptr != NULL)
+             {
+             printf("Box %d, distinct %d, total %d\n",j,ptr->nmbr_distinct,
+             ptr->nmbr_pts);
+             for (i=0; i<ptr->nmbr_distinct; i++)
+             printf("pt %d: %d %d %d",i,distinct_pt[ptr->pts[i]].c[RED],
+             distinct_pt[ptr->pts[i]].c[GREEN],
+             distinct_pt[ptr->pts[i]].c[BLUE]);
+             j++;
+             ptr = ptr->right;
+             }
+           */
+
+          ptr = find_box();
+          split_box(ptr);
+      }
+
+    assign_color();
+}
+
+/************************************************************************/
+/*  Function    : init                          */
+/*  Purpose : Initializes the global variables, sets up the first   */
+/*        box. It will contain all the color points     */
+/*  Parameter   :                           */
+/*    blocks     - number of pixel blocks               */
+/*    distinct   - number of distinct colors                */
+/*    my_color_pt   - contains the lo hi colors for each pixel block       */
+/*  Returns     : none                          */
+/*  Called by   : sel_palette()                     */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE     VOID
+init(int blocks, int distinct, struct rgb *my_color_pt)
+{
+    int         i, j, k, l;
+    int         temp[MAXCOLOR];
+    struct box *first;
+    struct box *dummy;
+
+    /* alloc memory */
+    if (hist)
+        HDfree((VOIDP) hist);
+    if (distinct_pt)
+        HDfree((VOIDP) distinct_pt);
+    hist = (int *) HDmalloc((unsigned) distinct * sizeof(int));
+    distinct_pt = (struct rgb *) HDmalloc((unsigned) distinct *
+                                            sizeof(struct rgb));
+
+    for (i = 0; i < distinct; i++)
+        hist[i] = 0;
+
+    /* select distinct pts and set up histogram */
+    for (i = 0; i < MAXCOLOR; i++)
+        temp[i] = -1;
+
+    k = 0;
+    for (i = 0; i < (2 * blocks); i++)
+      {
+          j = ((int) my_color_pt[i].c[RED] << 10) | (my_color_pt[i].c[GREEN] << 5) |
+              my_color_pt[i].c[BLUE];
+
+          if (temp[j] == -1)
+            {
+                /* new pt */
+                temp[j] = k;
+                for (l = RED; l <= BLUE; l++)
+                    distinct_pt[k].c[l] = my_color_pt[i].c[l];
+                k++;
+            }
+
+          hist[temp[j]]++;
+      }
+
+    /* set up first box */
+    first = (struct box *) HDmalloc(sizeof(struct box));
+    for (i = RED; i <= BLUE; i++)
+      {
+          first->bnd[i][LO] = (float32) 999.9;
+          first->bnd[i][HI] = (float32) -999.9;
+
+          for (j = 0; j < distinct; j++)
+            {
+                if (first->bnd[i][LO] > (float) distinct_pt[j].c[i])
+                    first->bnd[i][LO] = (float) distinct_pt[j].c[i];
+
+                if (first->bnd[i][HI] < (float) distinct_pt[j].c[i])
+                    first->bnd[i][HI] = (float) distinct_pt[j].c[i];
+            }   /* end of for j */
+
+          first->bnd[i][LO] = first->bnd[i][LO] - (float32) EPSILON;
+          first->bnd[i][HI] = first->bnd[i][HI] + (float32) EPSILON;
+      }     /* end of for i */
+
+    first->pts = (int *) HDmalloc((unsigned) distinct * sizeof(int));
+    for (i = 0; i < distinct; i++)
+        first->pts[i] = i;
+    first->nmbr_pts = 2 * blocks;
+    first->nmbr_distinct = distinct;
+
+    dummy = (struct box *) HDmalloc(sizeof(struct box));
+    frontier = dummy;
+    dummy->right = first;
+    first->left = dummy;
+    first->right = NULL;
+    dummy->nmbr_pts = 0;
+
+    HDfree((VOIDP) first);
+    HDfree((VOIDP) dummy);
+}   /* end of init */
+
+/************************************************************************/
+/*  Function    : sort                          */
+/*  Purpose : Performs quick sort on the points in a box along a    */
+/*        given dimension                   */
+/*  Parameter   :                           */
+/*    l, r   - index of leftmost and rightmost element      */
+/*    dim    - dimension along which sorting is done        */
+/*    rank   - an array which carries the index of the points to be */
+/*         sorted                       */
+/*  Returns     : none                          */
+/*  Called by   : find_med()                        */
+/*  Calls       : partition()                       */
+/************************************************************************/
+
+PRIVATE     VOID
+sort(int l, int r, int dim, int rank[])
+{
+    int         i;
+
+    if (r > l)
+      {
+          i = partition(l, r, dim, rank);
+          sort(l, i - 1, dim, rank);
+          sort(i + 1, r, dim, rank);
+      }
+}
+
+/************************************************************************
+*  Function    : partition
+*  Purpose : Partitions the list into 2 parts as in the quick sort
+*        algorithm
+*  Parameter   :
+*    l, r   - index of leftmost and rightmost element
+*    dim    - dimension along which sorting is done
+*    rank   - an array which carries the index of the points to be
+*  Returns     : index where list is partitioned
+*  Called by   : sort()
+*  Calls       : none
+************************************************************************/
+
+PRIVATE int
+partition(int l, int r, int dim, int rank[])
+{
+    int         i, j, temp;
+    uint8       v;
+
+    v = distinct_pt[rank[r]].c[dim];
+    i = l - 1;
+    j = r;
+
+    /* repeat until i and j crosses */
+    do
+      {
+          /* repeat until an element >= v is found */
+          do
+              i++;
+          while (distinct_pt[rank[i]].c[dim] < v);
+
+          /* repeat until an element <= v is found */
+          do
+              j--;
+          while ((j > 0) && (distinct_pt[rank[j]].c[dim] > v));
+
+          /* swap pointers */
+          temp = rank[i];
+          rank[i] = rank[j];
+          rank[j] = temp;
+      }
+    while (i < j);
+
+    /* position partitioning element at location i */
+    temp = rank[j];
+    rank[j] = rank[i];
+    rank[i] = rank[r];
+    rank[r] = temp;
+
+    return i;
+}
+
+/************************************************************************/
+/*  Function    : find_box                      */
+/*  Purpose : Finds the box with the largest number of color points */
+/*        The points need not necessarily be distinct. But in   */
+/*        order to partition the box, there must be at least  2 */
+/*        distinct points                   */
+/*  Parameter   : none                          */
+/*  Returns     : pointer to box selected for splitting         */
+/*  Called by   : sel_palette()                     */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE struct box *
+find_box(void)
+{
+    struct box *temp;
+    struct box *max;
+    int         max_pts;
+
+    max_pts = 1;
+    max = NULL;
+    temp = frontier->right;
+    while (temp != NULL)
+        if ((temp->nmbr_distinct > 1) && (max_pts < temp->nmbr_pts))
+          {
+              max_pts = temp->nmbr_pts;
+              max = temp;
+              temp = temp->right;
+          }
+        else
+            temp = temp->right;
+
+    if (max == NULL)
+      {
+          return(NULL); /* punt! */
+      }
+
+    return max;
+}
+
+/************************************************************************/
+/*  Function    : split_box                     */
+/*  Purpose : Splits a selected box into 2 and reinserts the 2 sub- */
+/*        boxes into the frontier list              */
+/*  Parameter   :                           */
+/*    ptr    - pointer to box to be split               */
+/*  Returns     : none                          */
+/*  Called by   : sel_palette()                     */
+/*  Calls       : find_med(), select_dim(), classify()          */
+/************************************************************************/
+
+PRIVATE     VOID
+split_box(struct box * ptr)
+{
+    int         dim, j, i;
+    float       median;
+    struct box *l_child, *r_child;
+
+    dim = select_dim(ptr);
+    median = find_med(ptr, dim);
+
+    /* create 2 child */
+    l_child = (struct box *) HDmalloc(sizeof(struct box));
+    r_child = (struct box *) HDmalloc(sizeof(struct box));
+
+    for (i = RED; i <= BLUE; i++)
+        for (j = HI; j <= LO; j++)
+          {
+              l_child->bnd[i][j] = ptr->bnd[i][j];
+              r_child->bnd[i][j] = ptr->bnd[i][j];
+          }
+    l_child->bnd[dim][HI] = median;
+    r_child->bnd[dim][LO] = median;
+
+    classify(ptr, l_child);
+    classify(ptr, r_child);
+
+    r_child->right = ptr->right;
+    r_child->left = l_child;
+    l_child->right = r_child;
+    l_child->left = ptr->left;
+    (ptr->left)->right = l_child;
+    if (ptr->right != NULL)
+        (ptr->right)->left = r_child;
+}   /* end of split_box */
+
+/************************************************************************/
+/*  Function    : assign_color                      */
+/*  Purpose : Assigns a color to each box. It computes the average  */
+/*        color of all the points in the box            */
+/*        Sets up the new_pal buffer. Each color component is   */
+/*        shifted left 3 bits because of the truncation when    */
+/*        color_pt was set up                   */
+/*  Parameter   : none                          */
+/*  Returns     : none                          */
+/*  Called by   : sel_palette()                     */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE     VOID
+assign_color(void)
+{
+    struct box *temp;
+    int         ent, k, j;
+    int         c[3];
+
+    temp = frontier->right;
+    for (ent = 0; ent < PALSIZE; ent++)
+      {
+          for (k = RED; k <= BLUE; k++)
+              c[k] = 0;
+
+          /*
+             printf("Box %d: number of pts %d\n", ent, temp->nmbr_pts);
+           */
+
+          for (j = 0; j < temp->nmbr_distinct; j++)
+            {
+                /*
+                   printf("pt %d:", j);
+                 */
+                for (k = RED; k <= BLUE; k++)
+                  {
+                      /*
+                         printf("%d ",distinct_pt[temp->pts[j]].c[k]);
+                       */
+                      c[k] = c[k] +
+                          distinct_pt[temp->pts[j]].c[k] * hist[temp->pts[j]];
+                  }
+                /*
+                   printf("\n");
+                 */
+            }
+
+          for (k = RED; k <= BLUE; k++)
+            {
+                c[k] = c[k] / temp->nmbr_pts;
+                new_pal[3 * ent + k] = (uint8) (c[k] << 3);
+            }
+
+          temp = temp->right;
+      }     /* end of for entry */
+}
+
+/************************************************************************/
+/*  Function    : select_dim                        */
+/*  Purpose : Selects the dimension with the largest spread         */
+/*  Parameter   :                           */
+/*    ptr    - pointer to desired box               */
+/*  Returns     : dimension where the box is to be split        */
+/*  Called by   : split_box()                       */
+/*  Calls       : none                          */
+/************************************************************************/
+PRIVATE int
+select_dim(struct box *ptr)
+{
+    int         i, j;
+    uint8       low[3], high[3];
+    uint8       max;
+
+    for (j = RED; j <= BLUE; j++)
+      {
+          low[j] = distinct_pt[ptr->pts[0]].c[j];
+          high[j] = distinct_pt[ptr->pts[0]].c[j];
+      }
+
+    for (i = 1; i < ptr->nmbr_distinct; i++)
+        for (j = RED; j <= BLUE; j++)
+          {
+              if (low[j] > distinct_pt[ptr->pts[i]].c[j])
+                  low[j] = distinct_pt[ptr->pts[i]].c[j];
+              if (high[j] < distinct_pt[ptr->pts[i]].c[j])
+                  high[j] = distinct_pt[ptr->pts[i]].c[j];
+          }
+
+    max = (uint8) (high[RED] - low[RED]);
+    i = RED;
+    for (j = GREEN; j <= BLUE; j++)
+        if (max < (uint8) (high[j] - low[j]))
+          {
+              max = (uint8) (high[j] - low[j]);
+              i = j;
+          }
+
+    return i;
+}   /* end of select_dim */
+
+/************************************************************************/
+/*  Function    : find_med                      */
+/*  Purpose : Finds the point where the box is to be split. It finds */
+/*        a point such that the 2 new boxes have about the same */
+/*        number of color points.               */
+/*  Parameter   :                           */
+/*    ptr    - pointer to box to be split               */
+/*    dim    - dimension to split box               */
+/*  Returns     : point where the box is to be cut          */
+/*  Called by   : split_box()                       */
+/*  Calls       : next_pt()                     */
+/************************************************************************/
+
+PRIVATE float
+find_med(struct box *ptr, int dim)
+{
+    int         i, j, count, next, prev;
+    int        *rank;
+    float32     median;
+
+    rank = (int *) HDmalloc((unsigned) ptr->nmbr_distinct * sizeof(int));
+    for (i = 0; i < ptr->nmbr_distinct; i++)
+        rank[i] = ptr->pts[i];
+
+    sort(0, ptr->nmbr_distinct - 1, dim, rank);
+    /*
+       for (i=0; i<ptr->nmbr_distinct; i++)
+       printf("find_med: sorted list is %d\n",distinct_pt[rank[i]].c[dim]);
+     */
+
+    count = 0;
+    prev = i = 0;
+    while ((i < ptr->nmbr_distinct) && (count < ptr->nmbr_pts / 2))
+      {
+          next = next_pt(dim, i, rank, ptr->nmbr_distinct);
+          for (j = i; j < next; j++)
+              count = count + hist[rank[j]];
+
+          prev = i;
+          i = next;
+      }
+
+    if (prev == 0)
+      {
+          /* the first distinct point overshot the median */
+          median = (float32) distinct_pt[rank[prev]].c[dim] + (float32) EPSILON;
+      }
+    else
+        median = (float32) distinct_pt[rank[prev - 1]].c[dim] + (float32) EPSILON;
+
+    HDfree((VOIDP) rank);
+    return median;
+}   /* end of find_med */
+
+/************************************************************************/
+/*  Function    : classify                      */
+/*  Purpose : Looks at the color points in the parent and selects   */
+/*        the points that belong to the child           */
+/*  Parameter   :                           */
+/*    ptr    - pointer to parent                    */
+/*    child  - pointer to child box                 */
+/*  Returns     : none                          */
+/*  Called by   : split_box()                       */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE     VOID
+classify(struct box * ptr, struct box * child)
+{
+    int         i, j;
+    int        *temp;
+    int         distinct, total;
+
+    temp = (int *) HDmalloc((unsigned) ptr->nmbr_distinct * sizeof(int));
+
+    distinct = 0;
+    total = 0;
+    for (i = 0; i < ptr->nmbr_distinct; i++)
+      {
+          j = ptr->pts[i];
+          if ((((float) distinct_pt[j].c[RED] >= child->bnd[RED][LO]) &&
+               ((float) distinct_pt[j].c[RED] <= child->bnd[RED][HI])) &&
+              (((float) distinct_pt[j].c[GREEN] >= child->bnd[GREEN][LO]) &&
+               ((float) distinct_pt[j].c[GREEN] <= child->bnd[GREEN][HI])) &&
+              (((float) distinct_pt[j].c[BLUE] >= child->bnd[BLUE][LO]) &&
+               ((float) distinct_pt[j].c[BLUE] <= child->bnd[BLUE][HI])))
+            {
+                /* pt is in new box */
+                temp[distinct] = j;
+                distinct++;
+                total = total + hist[j];
+            }   /* end of if */
+      }     /* end of for i */
+
+    /* assign points */
+    child->nmbr_pts = total;
+    child->nmbr_distinct = distinct;
+    child->pts = (int *) HDmalloc((unsigned) distinct * sizeof(int));
+    for (i = 0; i < distinct; i++)
+        child->pts[i] = temp[i];
+
+    HDfree((VOIDP) temp);
+
+}   /* end of classify */
+
+/************************************************************************/
+/*  Function    : next_pt                       */
+/*  Purpose : Determines the next point that has a different value  */
+/*        from the current point along  a dimension     */
+/*  Parameter   :                           */
+/*    dim    - dimension where box is to be split           */
+/*    i      - index to current point               */
+/*    rank       - sorted list of points to be searched starting from i */
+/*    distinct   - length of sorted list                                */
+/*  Returns     : index of point that has a different value     */
+/*  Called by   : find_med                      */
+/*  Calls       : none                          */
+/************************************************************************/
+
+PRIVATE int
+next_pt(int dim, int i, int rank[], int distinct)
+{
+    int         j;
+    uint8       old;
+
+    old = distinct_pt[rank[i]].c[dim];
+    for (j = (i + 1); j < distinct; j++)
+        if (distinct_pt[rank[j]].c[dim] != old)
+            break;
+
+    return j;
+}   /* end of next_pt */
diff --git a/hdf/src/dfjpeg.c b/hdf/src/dfjpeg.c
new file mode 100644
index 0000000..5bc8ce0
--- /dev/null
+++ b/hdf/src/dfjpeg.c
@@ -0,0 +1,316 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4951 $";
+#endif
+
+/* $Id: dfjpeg.c 4951 2007-09-11 19:33:41Z epourmal $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfjpeg.c
+ * Purpose: JPEG image compression algorithm
+ * Invokes: JPEG library functions
+ * Contents:
+ *  DFCIjpeg: compress image using JPEG compression
+ * Remarks: DFCIjpeg() compress images using the JPEG library functions.
+ *      This file (dfjpeg.c) and dfunjpeg.c should remain the only HDF files
+ *      that has to know about how to use the JPEG routines.
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "jpeglib.h"
+#include "jerror.h"
+/* Expanded data destination object for HDF output */
+
+typedef struct {
+    struct jpeg_destination_mgr pub; /* public fields */
+
+    int32 aid;              /* target AID for output */
+    int32 file_id;          /* HDF file ID */
+    uint16 tag, ref;        /* tag & ref of image to output */
+    const void * image;            /* pointer to the image data */
+    int32 xdim, ydim;       /* X & Y dimensions of the image */
+    int16 scheme;           /* type of image (8-bit or 24-bit) */
+
+    JOCTET *buffer;         /* buffer for JPEG library to fill */
+} hdf_destination_mgr;
+
+typedef hdf_destination_mgr * hdf_dest_ptr;
+
+#define OUTPUT_BUF_SIZE     4096    /* size of JPEG output buffer */
+
+/* Prototypes */
+extern void    hdf_init_destination(struct jpeg_compress_struct *cinfo_ptr);
+extern boolean hdf_empty_output_buffer(struct jpeg_compress_struct *cinfo_ptr);
+extern void    hdf_term_destination(struct jpeg_compress_struct *cinfo_ptr);
+extern intn    jpeg_HDF_dest(struct jpeg_compress_struct *cinfo_ptr, int32 file_id, uint16 tag,
+                             uint16 ref, const void * image, int32 xdim, int32 ydim, int16 scheme);
+extern intn    jpeg_HDF_dest_term(struct jpeg_compress_struct *cinfo_ptr);
+
+void (*jpeg_message_handler)(j_common_ptr cinfo) = NULL;
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    hdf_init_destination
+ * Purpose: Initialize the destination mgr for the JPEG image
+ * Inputs:
+ *      cinfo_ptr - JPEG compression structure pointer
+ * Returns: none.
+ * Users:   JPEG library
+ * Invokes: HDF low-level I/O functions
+ * Remarks: Initializes the JPEG destination mgr for further output.
+ *---------------------------------------------------------------------------*/
+void
+hdf_init_destination(struct jpeg_compress_struct *cinfo_ptr)
+{
+    hdf_dest_ptr dest=(hdf_dest_ptr)cinfo_ptr->dest;
+    int32 temp_aid;
+
+    if((dest->buffer=HDmalloc(sizeof(JOCTET)*OUTPUT_BUF_SIZE))==NULL)
+        ERREXIT1(cinfo_ptr, JERR_OUT_OF_MEMORY, (int)1);
+
+    /* Create empty JPEG5/GREYJPEG5 tag/ref to indicate the image */
+    if((temp_aid=Hstartwrite(dest->file_id,(uint16)dest->scheme,dest->ref,0))==FAIL)
+        ERREXIT(cinfo_ptr, JERR_FILE_WRITE);
+    Hendaccess(temp_aid);
+
+    if((dest->aid=Hstartaccess(dest->file_id,dest->tag,dest->ref,DFACC_WRITE|DFACC_APPENDABLE))==FAIL)
+        ERREXIT(cinfo_ptr, JERR_FILE_WRITE);
+
+    dest->pub.next_output_byte = dest->buffer;
+    dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
+} /* end hdf_init_destination() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    hdf_empty_output_buffer
+ * Purpose: Write out a chunk of JPEG compressed data
+ * Inputs:
+ *      cinfo_ptr - JPEG compression structure pointer
+ * Returns: none.
+ * Users:   JPEG library
+ * Invokes: HDF low-level I/O functions
+ * Remarks: 
+ *---------------------------------------------------------------------------*/
+boolean
+hdf_empty_output_buffer(struct jpeg_compress_struct *cinfo_ptr)
+{
+    hdf_dest_ptr dest=(hdf_dest_ptr)cinfo_ptr->dest;
+
+    if(Hwrite(dest->aid,OUTPUT_BUF_SIZE,dest->buffer)!=OUTPUT_BUF_SIZE)
+        ERREXIT(cinfo_ptr, JERR_FILE_WRITE);
+
+    dest->pub.next_output_byte = dest->buffer;
+    dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
+    return TRUE;
+} /* end hdf_empty_output_buffer() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    hdf_term_destination
+ * Purpose: Terminate the destination mgr for the JPEG image
+ * Inputs:
+ *      cinfo_ptr - JPEG compression structure pointer
+ * Returns: none.
+ * Users:   JPEG library
+ * Invokes: HDF low-level I/O functions
+ * Remarks: Terminate the JPEG destination mgr for further output.
+ *---------------------------------------------------------------------------*/
+void
+hdf_term_destination(struct jpeg_compress_struct *cinfo_ptr)
+{
+    hdf_dest_ptr dest=(hdf_dest_ptr)cinfo_ptr->dest;
+    /* note that 'free_in_buffer' is size_t in the jpeg library */
+    int32 datacount = (int32)OUTPUT_BUF_SIZE - (int32)dest->pub.free_in_buffer;
+
+    /* Write any data remaining in the buffer */
+    if (datacount > 0) {
+        if (Hwrite(dest->aid, datacount, dest->buffer) != datacount)
+            ERREXIT(cinfo_ptr, JERR_FILE_WRITE);
+    }
+
+    /* close the HDF object */
+    Hendaccess(dest->aid);
+
+    /* Free the output buffer */
+    HDfree(dest->buffer);
+
+} /* end hdf_term_destination() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    jpeg_HDF_dest
+ * Purpose: Setup an HDF I/O destination manager for the IJG library.
+ * Inputs:
+ *      cinfo_ptr - JPEG compression structure pointer
+ *      file_id - HDF file ID for file we are opening
+ *      tag - HDF tag for image we are writing
+ *      ref - HDF ref for image we are writing
+ *      image - pointer to the image data to output
+ *      xdim,ydim - X & Y dimensions of image
+ *      scheme - the type of image to output
+ * Returns: 0 on success, -1 on failure
+ * Users:   DFCIjpeg
+ * Invokes: JPEG library routines (lots of them...)
+ * Remarks: Sets up the destination manager functions for the JPEG library.
+ *          These routines will be called by the JPEG routines to output
+ *---------------------------------------------------------------------------*/
+intn
+jpeg_HDF_dest(struct jpeg_compress_struct *cinfo_ptr, int32 file_id, uint16 tag,
+    uint16 ref, const void * image, int32 xdim, int32 ydim, int16 scheme)
+{
+    CONSTR(FUNC, "jpeg_HDF_dest");     /* for HERROR */
+    hdf_dest_ptr dest;
+
+    if((dest=HDmalloc(sizeof(hdf_destination_mgr)))==NULL)
+        HRETURN_ERROR(DFE_NOSPACE,FAIL);
+
+    cinfo_ptr->dest=(struct jpeg_destination_mgr *)dest;
+    dest->pub.init_destination = hdf_init_destination;
+    dest->pub.empty_output_buffer = hdf_empty_output_buffer;
+    dest->pub.term_destination = hdf_term_destination ;
+
+    /* Now the HDF specific parameters */
+    dest->aid = 0;  /* start with no AID */
+    dest->file_id = file_id;
+    dest->tag = tag;
+    dest->ref = ref;
+    dest->image = image;
+    dest->xdim = xdim;
+    dest->ydim = ydim;
+    dest->scheme = scheme;
+
+    return(SUCCEED);
+} /* end jpeg_HDF_dest() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    jpeg_HDF_dest_term
+ * Purpose: Terminate an HDF I/O destination manager for the IJG library.
+ * Inputs:
+ *      cinfo_ptr - JPEG compression structure pointer
+ * Returns: 0 on success, -1 on failure
+ * Users:   DFCIjpeg
+ * Invokes: JPEG library routines (lots of them...)
+ * Remarks: Terminates the destination manager functions for the JPEG library.
+ *---------------------------------------------------------------------------*/
+intn
+jpeg_HDF_dest_term(struct jpeg_compress_struct *cinfo_ptr)
+{
+    /* all we need to do for now is to free up the dest. mgr structure */
+    HDfree(cinfo_ptr->dest);
+
+    return(SUCCEED);
+} /* end jpeg_HDF_dest_term() */
+
+/***********************************************************************/
+/* HDF callable routine for writing out an image with JPEG compression */
+/***********************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFCIjpeg
+ * Purpose: compress an image using the JPEG compression algorithm
+ * Inputs:
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF programmers, DFputcomp, other routines
+ * Invokes: JPEG library routines (lots of them...)
+ * Remarks: Uses the JPEG library routines.  The reason this routine doesn't
+ *          compress into a buffer (like IMCOMP and RLE methods) is because
+ *          the size of the buffer cannot be predicted before-hand and since
+ *          24-bit images are already huge, I don't want to try allocating a
+ *          worst-case buffer.  This means that this routine has to do the
+ *          writing of the compressed image itself, instead of allowing
+ *          DFputcomp() to write out the entire image at once.
+ *---------------------------------------------------------------------------*/
+
+intn
+DFCIjpeg(int32 file_id, uint16 tag, uint16 ref, int32 xdim, int32 ydim,
+         const void * image, int16 scheme, comp_info * scheme_info)
+{
+    CONSTR(FUNC, "DFCIjpeg");     /* for HERROR */
+    /* These three structs contain JPEG parameters and working data.
+     * They must survive for the duration of parameter setup and one
+     * call to jpeg_compress; typically, making them local data in the
+     * calling routine is the best strategy.
+     */
+    struct jpeg_compress_struct *cinfo_ptr;
+    struct jpeg_error_mgr *jerr_ptr;
+    JSAMPROW row_pointer[1];
+    intn row_stride;
+    const uint8 *image_buffer=image;
+
+    if((cinfo_ptr=HDcalloc(1,sizeof(struct jpeg_compress_struct)))==NULL)
+        HRETURN_ERROR(DFE_NOSPACE,FAIL);
+
+    if((jerr_ptr=HDmalloc(sizeof(struct jpeg_error_mgr)))==NULL)
+        HRETURN_ERROR(DFE_NOSPACE,FAIL);
+
+    /* Initialize the error-handling routines */
+    cinfo_ptr->err = jpeg_std_error(jerr_ptr);
+    if (jpeg_message_handler != NULL)
+    {
+        jerr_ptr->output_message = jpeg_message_handler;
+    } 
+
+    /* Initialize the JPEG compression stuff */
+    jpeg_create_compress(cinfo_ptr);
+
+    /* Set-up HDF destination manager */
+    jpeg_HDF_dest(cinfo_ptr,file_id,tag,ref,image,xdim,ydim,scheme);
+
+    /* Set up default JPEG parameters in the cinfo data structure. */
+    cinfo_ptr->image_width=(JDIMENSION)xdim;
+    cinfo_ptr->image_height=(JDIMENSION)ydim;
+    if((uint16)scheme==DFTAG_JPEG5) /* 24-bit image */
+      {
+        cinfo_ptr->input_components=3;
+        cinfo_ptr->in_color_space=JCS_RGB;
+        row_stride=xdim*3;
+      } /* end if */
+    else if((uint16)scheme==DFTAG_GREYJPEG5) /* 8-bit image */
+      {
+        cinfo_ptr->input_components=1;
+        cinfo_ptr->in_color_space=JCS_GRAYSCALE;
+        row_stride=xdim;
+      } /* end if */
+    else
+        HRETURN_ERROR(DFE_ARGS,FAIL);
+    jpeg_set_defaults(cinfo_ptr);
+
+    /* Set up user JPEG parameters in the cinfo data structure. */
+    jpeg_set_quality(cinfo_ptr, scheme_info->jpeg.quality,
+                 (boolean)scheme_info->jpeg.force_baseline);
+
+    /* OK, get things started */
+    jpeg_start_compress(cinfo_ptr,TRUE);
+
+    /* write the whole image out at once */
+    while (cinfo_ptr->next_scanline < cinfo_ptr->image_height)
+      {
+        row_pointer[0]=(JSAMPROW)(&image_buffer[(size_t)cinfo_ptr->next_scanline * (size_t)row_stride]);
+        jpeg_write_scanlines(cinfo_ptr,row_pointer,1);
+      } /* end while */
+
+    /* Finish writing stuff out */
+    jpeg_finish_compress(cinfo_ptr);
+
+    /* Get rid of the JPEG information */
+    jpeg_destroy_compress(cinfo_ptr);
+
+    /* Wrap up any HDF specific code */
+    jpeg_HDF_dest_term(cinfo_ptr);
+
+    /* Free update memory allocated */
+    HDfree(jerr_ptr);
+    HDfree(cinfo_ptr);
+
+    return (SUCCEED);   /* we must be ok... */
+}   /* end DFCIjpeg() */
+
diff --git a/hdf/src/dfknat.c b/hdf/src/dfknat.c
new file mode 100644
index 0000000..4f8f54a
--- /dev/null
+++ b/hdf/src/dfknat.c
@@ -0,0 +1,325 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6032 $";
+#endif
+
+/* $Id: dfknat.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+/*------------------------------------------------------------------
+ File:  dfknat.c
+
+ Purpose:
+    Routines to support "native mode" conversion to and from HDF format
+
+ Invokes:
+
+ PRIVATE conversion functions:
+    DFKnb1b -  Native mode for 8 bit integers
+    DFKnb2b -  Native mode for 16 bit integers
+    DFKnb4b -  Native mode for 32 bit integers and floats
+    DFKnb8b -  Native mode for 64 bit floats
+
+ Remarks:
+    These files used to be in dfconv.c, but it got a little too huge,
+    so they were broken into a separate file.
+
+ *------------------------------------------------------------------*/
+
+/*****************************************************************************/
+/*                                                                           */
+/*    All the routines in this file marked as PRIVATE have been marked so    */
+/*  for a reason.  *ANY* of these routines may or may nor be supported in    */
+/*  the next version of HDF (4.00).  Furthurmore, the names, paramters, or   */
+/*  functionality is *NOT* guaranteed to remain the same.                    */
+/*    The *ONLY* guarantee possible is that DFKnumin(), and DFKnumout()      */
+/*  will not change.  They are *NOT* guaranteed to be implemented in the     */
+/*  next version of HDF as function pointers.  They are guaranteed to take   */
+/*  the same arguments and produce the same results.                         */
+/*    If your programs call any routines in this file except for             */
+/*  DFKnumin(), DFKnumout, and/or DFKsetntype(), your code may not work      */
+/*  with future versions of HDF and your code will *NOT* be portable.        */
+/*                                                                           */
+/*****************************************************************************/
+
+#include "hdf.h"
+#include "hconv.h"
+
+/*****************************************************************************/
+/* NATIVE MODE NUMBER "CONVERSION" ROUTINES                                  */
+/*****************************************************************************/
+
+/************************************************************/
+/* DFKnb1b()                                                */
+/*   Native mode for 1 byte data items                      */
+/************************************************************/
+int
+DFKnb1b(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;
+    int         in_place = 0;
+    uint32 i;
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    CONSTR(FUNC, "DFKnb1b");
+
+    HEclear();
+
+    if (num_elm == 0)
+      {
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    /* Determine if faster array processing is appropriate */
+    if ((source_stride == 0 && dest_stride == 0) ||
+        (source_stride == 1 && dest_stride == 1))
+        fast_processing = 1;
+
+    /* Determine if the conversion should be inplace */
+    if (source == dest)
+        in_place = 1;
+
+    if (fast_processing)
+      {
+          if (!in_place)
+            {
+                HDmemcpy(dest, source, num_elm);
+                return 0;
+            }
+          else
+              return 0;     /* Nothing to do */
+      }
+    else
+      {
+          *dest = *source;
+          for (i = 1; i < num_elm; i++)
+            {
+                dest += dest_stride;
+                source += source_stride;
+                *dest = *source;
+            }
+      }
+
+    return 0;
+}
+
+/************************************************************/
+/* DFKnb2b()                                                */
+/* -->Native mode for 2 byte data items                     */
+/************************************************************/
+int
+DFKnb2b(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* Default is not fast processing */
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[2];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    CONSTR(FUNC, "DFKnb2b");
+
+    HEclear();
+
+    if (num_elm == 0)
+      {
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    /* Determine if faster array processing is appropriate */
+    if ((source_stride == 0 && dest_stride == 0) ||
+        (source_stride == 2 && dest_stride == 2))
+        fast_processing = 1;
+
+    /* Determine if the conversion should be inplace */
+    if (source == dest)
+        in_place = 1;
+
+    if (fast_processing) {
+        if (!in_place)
+          {
+              HDmemcpy(dest, source, num_elm * 2);
+              return 0;
+          }
+        else
+          {     /* Nothing to do */
+              return 0;
+          }
+    }
+
+    /* Generic stride processing */
+    if (!in_place)
+        for (i = 0; i < num_elm; i++)
+          {
+              dest[0] = source[0];
+              dest[1] = source[1];
+              dest += dest_stride;
+              source += source_stride;
+          }
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+              buf[0] = source[0];
+              buf[1] = source[1];
+              dest[0] = buf[0];
+              dest[1] = buf[1];
+              dest += dest_stride;
+              source += source_stride;
+          }
+
+    return 0;
+}
+
+/************************************************************/
+/* DFKnb4b()                                                */
+/* -->Native mode for 4 byte items                          */
+/************************************************************/
+int
+DFKnb4b(VOIDP s, VOIDP d, uint32 num_elm,
+        uint32 source_stride, uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* Default is not fast processing */
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    CONSTR(FUNC, "DFKnb4b");
+
+    HEclear();
+
+    if (num_elm == 0)
+      {
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    /* Determine if faster array processing is appropriate */
+    if ((source_stride == 0 && dest_stride == 0) ||
+        (source_stride == 4 && dest_stride == 4))
+        fast_processing = 1;
+
+    /* Determine if the conversion should be inplace */
+    if (source == dest)
+        in_place = 1;
+
+    if (fast_processing) {
+        if (!in_place)
+          {
+              HDmemcpy(dest, source, num_elm * 4);
+              return 0;
+          }
+        else
+          {     /* Nothing to do */
+              return 0;
+          }
+    }
+
+    /* Generic stride processing */
+    if (!in_place)
+        for (i = 0; i < num_elm; i++)
+          {
+              dest[0] = source[0];
+              dest[1] = source[1];
+              dest[2] = source[2];
+              dest[3] = source[3];
+              dest += dest_stride;
+              source += source_stride;
+          }
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+              buf[0] = source[0];
+              buf[1] = source[1];
+              buf[2] = source[2];
+              buf[3] = source[3];
+              dest[0] = buf[0];
+              dest[1] = buf[1];
+              dest[2] = buf[2];
+              dest[3] = buf[3];
+              dest += dest_stride;
+              source += source_stride;
+          }
+
+    return 0;
+}
+
+/************************************************************/
+/* DFKnb8b()                                                */
+/* -->Native mode for 8 byte items                          */
+/************************************************************/
+int
+DFKnb8b(VOIDP s, VOIDP d, uint32 num_elm,
+        uint32 source_stride, uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* Default is not fast processing */
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[8];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+
+    CONSTR(FUNC, "DFKnb8b");
+
+    HEclear();
+
+    if (num_elm == 0)
+      {
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    /* Determine if faster array processing is appropriate */
+    if ((source_stride == 0 && dest_stride == 0) ||
+        (source_stride == 8 && dest_stride == 8))
+        fast_processing = 1;
+
+    /* Determine if the conversion should be inplace */
+    if (source == dest)
+        in_place = 1;
+
+    if (fast_processing) {
+        if (!in_place)
+          {
+              HDmemcpy(dest, source, num_elm * 8);
+              return 0;
+          }
+        else
+          {
+              return 0;     /* No work to do ! */
+          }
+    }
+
+    /* Generic stride processing */
+    if (!in_place)
+        for (i = 0; i < num_elm; i++)
+          {
+              HDmemcpy(dest, source, 8);
+              dest += dest_stride;
+              source += source_stride;
+          }
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+              HDmemcpy(buf, source, 8);
+              HDmemcpy(dest, buf, 8);
+              dest += dest_stride;
+              source += source_stride;
+          }
+
+    return 0;
+}
diff --git a/hdf/src/dfkswap.c b/hdf/src/dfkswap.c
new file mode 100644
index 0000000..60c5d52
--- /dev/null
+++ b/hdf/src/dfkswap.c
@@ -0,0 +1,440 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfkswap.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*------------------------------------------------------------------
+ File:  dfkswap.c
+
+ Purpose:
+    Routines to support little-endian conversion to and from HDF format
+
+ Invokes:
+
+ PRIVATE conversion functions:
+    DFKsb2b -  Byte swapping for 16 bit integers
+    DFKsb4b -  Byte swapping for 32 bit integers
+    DFKsb8b -  Byte swapping for 64 bit floats
+
+ Remarks:
+    These files used to be in dfconv.c, but it got a little too huge,
+    so I broke them out into seperate files. - Q
+
+ *------------------------------------------------------------------*/
+
+/*****************************************************************************/
+/*                                                                           */
+/*    All the routines in this file marked as PRIVATE have been marked so    */
+/*  for a reason.  *ANY* of these routines may or may nor be supported in    */
+/*  the next version of HDF (4.00).  Furthurmore, the names, paramters, or   */
+/*  functionality is *NOT* guaranteed to remain the same.                    */
+/*    The *ONLY* guarantee possible is that DFKnumin(), and DFKnumout()      */
+/*  will not change.  They are *NOT* guaranteed to be implemented in the     */
+/*  next version of HDF as function pointers.  They are guaranteed to take   */
+/*  the same arguments and produce the same results.                         */
+/*    If your programs call any routines in this file except for             */
+/*  DFKnumin(), DFKnumout, and/or DFKsetntype(), your code may not work      */
+/*  with future versions of HDF and your code will *NOT* be portable.        */
+/*                                                                           */
+/*****************************************************************************/
+
+#include "hdf.h"
+#include "hconv.h"
+
+/*****************************************************************************/
+/* NUMBER CONVERSION ROUTINES FOR BYTE SWAPPING                              */
+/*****************************************************************************/
+
+/************************************************************/
+/* DFKsb2b()                                                */
+/* -->Byte swapping for 2 byte data items                   */
+/************************************************************/
+int
+DFKsb2b(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* Default is not fast processing */
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[2];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    CONSTR(FUNC, "DFKsb2b");
+
+    HEclear();
+
+    if (num_elm == 0)
+      {     /* No elements is an error. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    /* Determine if faster array processing is appropriate */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    /* Determine if the conversion should be inplace */
+    if (source == dest)
+        in_place = 1;
+
+    if (fast_processing) {
+        if (!in_place)
+          {
+              for (i = 0; i < num_elm; i++)
+                {
+                    dest[0] = source[1];
+                    dest[1] = source[0];
+                    dest += 2;
+                    source += 2;
+                }
+              return 0;
+          }
+        else
+          {
+              for (i = 0; i < num_elm; i++)
+                {
+                    buf[0] = source[1];
+                    buf[1] = source[0];
+                    dest[0] = buf[0];
+                    dest[1] = buf[1];
+                    dest += 2;
+                    source += 2;
+                }
+              return 0;
+          }
+    }
+
+    /* Generic stride processing */
+    if (!in_place)
+        for (i = 0; i < num_elm; i++)
+          {
+              dest[0] = source[1];
+              dest[1] = source[0];
+              dest += dest_stride;
+              source += source_stride;
+          }
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+              buf[0] = source[1];
+              buf[1] = source[0];
+              dest[0] = buf[0];
+              dest[1] = buf[1];
+              dest += dest_stride;
+              source += source_stride;
+          }
+    return 0;
+}
+
+/************************************************************/
+/* DFKsb4b()                                                */
+/* -->Byte swapping for 4 byte data items                   */
+/************************************************************/
+int
+DFKsb4b(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* Default is not fast processing */
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[4];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    CONSTR(FUNC, "DFKsb4b");
+#ifdef TEST3_sb4b
+    uint32     *lp_dest;
+    uint32     *lp_src;
+#endif
+
+    HEclear();
+
+    if (num_elm == 0)
+      {     /* No elements is an error. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    /* Determine if faster array processing is appropriate */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    /* Determine if the conversion should be inplace */
+    if (source == dest)
+        in_place = 1;
+
+    if (fast_processing) {
+        if (!in_place)
+          {
+#ifndef DUFF_sb4b
+#ifdef TEST1_sb4b
+              source += 3;
+#endif
+#ifdef TEST3_sb4b
+              lp_dest = (uint32 *) dest;
+              lp_src = (uint32 *) source;
+#endif
+              for (i = 0; i < num_elm; i++)
+                {
+#if defined TEST3_sb4b
+                    *lp_dest++ = ((lp_src[0] & 0x000000ff) << 24) |
+                        ((lp_src[0] & 0x0000ff00) << 8) |
+                        ((lp_src[0] & 0x00ff0000) >> 8) |
+                        ((lp_src[0] & 0xff000000) >> 24);
+                    lp_src++;
+#else
+                    dest[0] = source[3];
+                    dest[1] = source[2];
+                    dest[2] = source[1];
+                    dest[3] = source[0];
+                    dest += 4;
+                    source += 4;
+#endif
+                }
+#else  /* DUFF_sb4b */
+              uint32 n = (num_elm + 7) / 8;
+
+              switch (num_elm % 8)
+                {
+                    case 0:
+                        do
+                          {
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                    case 7:
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                    case 6:
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                    case 5:
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                    case 4:
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                    case 3:
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                    case 2:
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                    case 1:
+                              dest[0] = source[3];
+                              dest[1] = source[2];
+                              dest[2] = source[1];
+                              dest[3] = source[0];
+                              dest += 4;
+                              source += 4;
+                          }
+                        while (--n > 0);
+                }
+#endif /* DUFF_sb4b */
+              return 0;
+          }
+        else
+          {
+              for (i = 0; i < num_elm; i++)
+                {
+                    buf[0] = source[3];
+                    buf[1] = source[2];
+                    buf[2] = source[1];
+                    buf[3] = source[0];
+                    dest[0] = buf[0];
+                    dest[1] = buf[1];
+                    dest[2] = buf[2];
+                    dest[3] = buf[3];
+                    dest += 4;
+                    source += 4;
+                }
+              return 0;
+          }
+    }
+
+    /* Generic stride processing */
+    if (!in_place)
+        for (i = 0; i < num_elm; i++)
+          {
+              dest[0] = source[3];
+              dest[1] = source[2];
+              dest[2] = source[1];
+              dest[3] = source[0];
+              dest += dest_stride;
+              source += source_stride;
+          }
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+              buf[0] = source[3];
+              buf[1] = source[2];
+              buf[2] = source[1];
+              buf[3] = source[0];
+              dest[0] = buf[0];
+              dest[1] = buf[1];
+              dest[2] = buf[2];
+              dest[3] = buf[3];
+              dest += dest_stride;
+              source += source_stride;
+          }
+    return 0;
+}
+
+/************************************************************/
+/* DFKsb8b()                                                */
+/* -->Byte swapping for 8 byte data items                   */
+/************************************************************/
+int
+DFKsb8b(VOIDP s, VOIDP d, uint32 num_elm, uint32 source_stride,
+        uint32 dest_stride)
+{
+    int         fast_processing = 0;    /* Default is not fast processing */
+    int         in_place = 0;   /* Inplace must be detected */
+    uint32 i;
+    uint8       buf[8];         /* Inplace processing buffer */
+    uint8      *source = (uint8 *) s;
+    uint8      *dest = (uint8 *) d;
+    CONSTR(FUNC, "DFKsb8b");
+
+    HEclear();
+
+    if (num_elm == 0)
+      {     /* No elements is an error. */
+          HERROR(DFE_BADCONV);
+          return FAIL;
+      }
+
+    /* Determine if faster array processing is appropriate */
+    if (source_stride == 0 && dest_stride == 0)
+        fast_processing = 1;
+
+    /* Determine if the conversion should be inplace */
+    if (source == dest)
+        in_place = 1;
+
+    if (fast_processing) {
+        if (!in_place)
+          {
+              for (i = 0; i < num_elm; i++)
+                {
+                    dest[0] = source[7];
+                    dest[1] = source[6];
+                    dest[2] = source[5];
+                    dest[3] = source[4];
+                    dest[4] = source[3];
+                    dest[5] = source[2];
+                    dest[6] = source[1];
+                    dest[7] = source[0];
+                    dest += 8;
+                    source += 8;
+                }
+              return 0;
+          }
+        else
+          {
+              for (i = 0; i < num_elm; i++)
+                {
+                    buf[0] = source[7];
+                    buf[1] = source[6];
+                    buf[2] = source[5];
+                    buf[3] = source[4];
+                    buf[4] = source[3];
+                    buf[5] = source[2];
+                    buf[6] = source[1];
+                    buf[7] = source[0];
+                    dest[0] = buf[0];
+                    dest[1] = buf[1];
+                    dest[2] = buf[2];
+                    dest[3] = buf[3];
+                    dest[4] = buf[4];
+                    dest[5] = buf[5];
+                    dest[6] = buf[6];
+                    dest[7] = buf[7];
+                    dest += 8;
+                    source += 8;
+                }
+              return 0;
+          }
+    }
+
+    /* Generic stride processing */
+    if (!in_place)
+        for (i = 0; i < num_elm; i++)
+          {
+              dest[0] = source[7];
+              dest[1] = source[6];
+              dest[2] = source[5];
+              dest[3] = source[4];
+              dest[4] = source[3];
+              dest[5] = source[2];
+              dest[6] = source[1];
+              dest[7] = source[0];
+              dest += dest_stride;
+              source += source_stride;
+          }
+    else
+        for (i = 0; i < num_elm; i++)
+          {
+              buf[0] = source[7];
+              buf[1] = source[6];
+              buf[2] = source[5];
+              buf[3] = source[4];
+              buf[4] = source[3];
+              buf[5] = source[2];
+              buf[6] = source[1];
+              buf[7] = source[0];
+              dest[0] = buf[0];
+              dest[1] = buf[1];
+              dest[2] = buf[2];
+              dest[3] = buf[3];
+              dest[4] = buf[4];
+              dest[5] = buf[5];
+              dest[6] = buf[6];
+              dest[7] = buf[7];
+              dest += dest_stride;
+              source += source_stride;
+          }
+
+    return 0;
+}
diff --git a/hdf/src/dfp.c b/hdf/src/dfp.c
new file mode 100644
index 0000000..ef0a09d
--- /dev/null
+++ b/hdf/src/dfp.c
@@ -0,0 +1,569 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfp.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     dfp.c
+ * Purpose:  read and write palettes
+ * Invokes:  df.c
+ * Contents:
+ *  DFPgetpal    : retrieve next palette
+ *  DFPputpal    : write palette to file
+ *  DFPaddpal    : add palette to file
+ *  DFPnpals     : number of palettes in HDF file
+ *  DFPreadref   : get palette with this reference number next
+ *  DFPwriteref  : put palette with this reference number next
+ *  DFPrestart   : forget info about last file accessed - restart from beginning
+ *  DFPlastref   : return reference number of last element read or written
+ *  DFPIopen     : open/reopen file
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+
+/* remember that '0' is invalid ref number */
+PRIVATE uint16 Readref = 0;
+PRIVATE uint16 Writeref = 0;
+PRIVATE uint16 Refset = 0;      /* Ref of palette to get next */
+PRIVATE uint16 Lastref = 0;     /* Last ref read/written */
+
+PRIVATE char Lastfile[DF_MAXFNLEN] = "";    /* last file opened */
+
+PRIVATE int32 DFPIopen
+            (const char * filename, intn acc_mode);
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPgetpal -- get next palette from file
+ USAGE
+    intn DFPgetpal(filename,palette)
+        char *filename;         IN: name of HDF file
+        void * palette;          OUT: ptr to the buffer to store the palette in
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Gets the next palette from the file specified.
+ GLOBAL VARIABLES
+    Lastref, Refset
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFPgetpal(const char *filename, void * palette)
+{
+  CONSTR(FUNC, "DFPgetpal");
+  int32       file_id;
+  int32       aid;
+  int32       length;
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!palette)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if ((file_id = DFPIopen(filename, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  if (Refset)
+    {
+      aid = Hstartread(file_id, DFTAG_IP8, Refset);
+      if (aid == FAIL)
+        aid = Hstartread(file_id, DFTAG_LUT, Refset);
+    }     /* end if */
+  else if (Readref)
+    {
+      aid = Hstartread(file_id, DFTAG_IP8, Readref);
+      if (aid == FAIL)
+        aid = Hstartread(file_id, DFTAG_LUT, Readref);
+      if (aid != FAIL &&
+          (Hnextread(aid, DFTAG_IP8, DFREF_WILDCARD, DF_CURRENT) == FAIL))
+        {
+          if (Hnextread(aid, DFTAG_LUT, DFREF_WILDCARD, DF_CURRENT) == FAIL)
+            {
+              Hendaccess(aid);
+              aid = FAIL;
+            }     /* end if */
+        }   /* end if */
+    }     /* end if */
+  else
+    {
+      aid = Hstartread(file_id, DFTAG_IP8, DFREF_WILDCARD);
+      if (aid == FAIL)
+        aid = Hstartread(file_id, DFTAG_LUT, DFREF_WILDCARD);
+    }     /* end else */
+
+  Refset = 0;
+  /* on error, close file and return -1 */
+  if (aid == FAIL)
+    {
+      ret_value = (HDerr(file_id));
+      goto done;
+    }
+
+  if (Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &Readref, &length,
+               (int32 *) NULL, (int32 *) NULL, (int16 *) NULL, (int16 *) NULL) == FAIL)
+    {
+      Hendaccess(aid);
+      ret_value = HDerr(file_id);
+      goto done;
+    }     /* end if */
+
+  /* read palette */
+  if (Hread(aid, length, (uint8 *) palette) == FAIL)
+    {
+      Hendaccess(aid);
+      ret_value = (HDerr(file_id));
+      goto done;
+    }     /* end if */
+
+  Hendaccess(aid);
+
+  Lastref = Readref;
+
+  ret_value = Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFPgetpal() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPputpal -- Write palette to file
+ USAGE
+    intn DFPputpal(filename,palette,overwrite,filemode)
+        char *filename;         IN: name of HDF file
+        void * palette;          IN: ptr to the buffer retrieve the palette from
+        intn overwrite;         IN: whether to (1) overwrite last palette written,
+                                    or (0) write it as a fresh palette
+        char *filemode;         IN: if "a" append palette to file, "w" create
+                                    new file
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Stores a palette in an HDF file, with options for creating new file or appending,
+    and overwriting last palette written.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    To overwrite, the filename must be the same as for the previous call.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFPputpal(const char *filename, const void * palette, intn overwrite, const char *filemode)
+{
+  CONSTR(FUNC, "DFPputpal");
+  int32       file_id;
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!palette)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if (overwrite && HDstrcmp(filename, Lastfile))
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  file_id = DFPIopen(filename, (*filemode == 'w') ? DFACC_CREATE : DFACC_WRITE);
+  if (file_id == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* if we want to overwrite, Lastref is the ref to write.  If not, if
+       Writeref is set, we use that ref.  If not we get a fresh ref. The
+       ref to write is placed in Lastref */
+  if (!overwrite)
+    Lastref = (uint16) (Writeref ? Writeref : Htagnewref(file_id,DFTAG_IP8));
+  if (Lastref == 0)
+    HGOTO_ERROR(DFE_NOREF, FAIL);
+
+  Writeref = 0;   /* don't know ref to write after this */
+
+  /* write out palette */
+  if (Hputelement(file_id, DFTAG_IP8, Lastref, (const uint8 *) palette, (int32) 768) < 0)
+    {
+      ret_value = (HDerr(file_id));
+      goto done;
+    }
+
+    /* Check for the tag/ref before creating it willy-nilly */
+  if(Hexist(file_id,DFTAG_LUT,Lastref)==FAIL)
+    Hdupdd(file_id, DFTAG_LUT, Lastref, DFTAG_IP8, Lastref);
+
+  ret_value = (Hclose(file_id)); 
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFPputpal() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPaddpal -- Append palette to file
+ USAGE
+    intn DFPaddpal(filename,palette)
+        char *filename;         IN: name of HDF file
+        void * palette;          IN: ptr to the buffer retrieve the palette from
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Appends a palette in an HDF file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFPaddpal(const char *filename, const void * palette)
+{
+  intn ret_value;
+
+  ret_value = (DFPputpal(filename, palette, 0, "a"));
+
+  return ret_value;
+}   /* end DFPaddpal() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPnpals -- determine # of palettes in a file
+ USAGE
+    intn DFPnpals(filename)
+        char *filename;         IN: name of HDF file
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Determines the number of unique palettes in a file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFPnpals(const char *filename)
+{
+  CONSTR(FUNC, "DFPnpals");
+  int32       file_id;
+  intn        curr_pal;       /* current palette count */
+  int32       nip8, nlut;     /* number of IP8s & number of LUTs */
+  intn        npals;          /* total number of palettes */
+  uint16      find_tag, find_ref;     /* storage for tag/ref pairs found */
+  int32       find_off, find_len;     /* storage for offset/lengths of tag/refs found */
+  int32      *pal_off;        /* storage for an array of palette offsets */
+  intn        i, j;           /* local counting variable */
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  /* should use reopen if same file as last time - more efficient */
+  if ((file_id = DFPIopen(filename, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* count number of IPs */
+  if ((nip8 = Hnumber(file_id, DFTAG_IP8)) == FAIL)
+    {
+      ret_value = (HDerr(file_id));
+      goto done;
+    }
+
+  /* count number of LUTs */
+  if ((nlut = Hnumber(file_id, DFTAG_LUT)) == FAIL)
+    {
+      ret_value = (HDerr(file_id));
+      goto done;
+    }
+  npals = (intn) (nip8 + nlut);
+
+  /* if no palettes just return zero and get out */
+  if (npals == 0)
+    {
+      if (Hclose(file_id) == FAIL)
+        {
+          ret_value = FAIL;
+          goto done;
+        }
+
+      ret_value = npals;
+      goto done;
+    }
+
+  /* Get space to store the palette offsets */
+  if ((pal_off = (int32 *) HDmalloc(npals * sizeof(int32))) == NULL)
+    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+  /* go through the IP8s */
+  curr_pal = 0;
+  find_tag = find_ref = 0;
+  while (Hfind(file_id, DFTAG_IP8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+    {
+      pal_off[curr_pal] = find_off;     /* store offset */
+      curr_pal++;
+    }     /* end while */
+
+  /* go through the LUTs */
+  find_tag = find_ref = 0;
+  while (Hfind(file_id, DFTAG_LUT, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+    {
+      pal_off[curr_pal] = find_off;     /* store offset */
+      curr_pal++;
+    }     /* end while */
+
+  npals = curr_pal;   /* reset the number of palettes we really have */
+  for (i = 1; i < curr_pal; i++)
+    {     /* go through the palettes looking for duplicates */
+      if(pal_off[i]!=(-1))
+          for (j = 0; j < i; j++)
+            {
+              if (pal_off[i] == pal_off[j])
+                {
+                    npals--;    /* if duplicate found, decrement the number of palettes */
+                    pal_off[j]=(-1); /* mark as used, so we don't count it too... */
+                } /* end if */
+            }   /* end for */
+    }     /* end for */
+
+  HDfree(pal_off);   /* free offsets */
+
+  if (Hclose(file_id) == FAIL)
+    HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+
+  ret_value = npals;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFPnpals() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPreadref -- set ref # of palette to read next
+ USAGE
+    intn DFPreadref(filename,ref)
+        char *filename;         IN: name of HDF file
+        uint16 ref;             IN: ref # of palette to read next
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the ref # of the next palette to read from a file
+ GLOBAL VARIABLES
+    Refset
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFPreadref(const char *filename, uint16 ref)
+{
+  CONSTR(FUNC, "DFPreadref");
+  int32       file_id;
+  int32       aid;
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if ((file_id = DFPIopen(filename, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  aid = Hstartread(file_id, DFTAG_IP8, ref);
+  if (aid == FAIL)
+    {
+      aid = Hstartread(file_id, DFTAG_LUT, ref);
+      if (aid == FAIL)
+        {
+          ret_value = (HDerr(file_id));
+          goto done;
+        }
+    }     /* end if */
+
+  Hendaccess(aid);
+  Refset = ref;
+
+  ret_value = (Hclose(file_id));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFPreadref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPwriteref -- set ref # of palette to write next
+ USAGE
+    intn DFPwriteref(filename,ref)
+        char *filename;         IN: name of HDF file
+        uint16 ref;             IN: ref # of palette to write next
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the ref # of the next palette to write to a file.  The filename is
+    ignored -- this is probably a bug.  No matter what file the next palette
+    is written to, it will have the reference number ref.
+ GLOBAL VARIABLES
+    Writeref
+
+--------------------------------------------------------------------------*/
+intn
+DFPwriteref(const char *filename, uint16 ref)
+{
+  intn ret_value = SUCCEED;
+
+  /* shut compiler up */
+  filename = filename;
+  Writeref = ref;
+
+  return ret_value;
+}   /* end DFPwriteref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPrestart -- restart reading/writing palettes from the start of a file
+ USAGE
+    intn DFPrestart(void)
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Restart reading/writing palettes to a file.
+ GLOBAL VARIABLES
+    Lastfile
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFPrestart(void)
+{
+  intn ret_value = SUCCEED;
+
+  Lastfile[0] = '\0';
+
+  return ret_value;
+}   /* end DFPrestart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPlastref -- returns last ref # read/written
+ USAGE
+    uint16 DFPlastref(void)
+ RETURNS
+    ref # on on success, 0 on failure.
+ DESCRIPTION
+    Return the last ref # read/written from a file.
+ GLOBAL VARIABLES
+    Lastref
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+uint16
+DFPlastref(void)
+{
+  uint16 ret_value;
+
+  ret_value = Lastref;
+
+  return ret_value;
+}   /* end DFPlastref() */
+
+/**************************************************************************/
+/*----------------------- Internal routines ------------------------------*/
+/**************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFPIopen
+ * Purpose: open or reopen a file
+ * Inputs:  filename: name of file to open
+ *          acc_mode : access mode
+ * Returns: file pointer on success, NULL on failure with DFerror set
+ * Users:   HDF systems programmers, other DFP routines
+ * Invokes: DFopen
+ * Remarks: This is a hook for someday providing more efficient ways to
+ *          reopen a file, to avoid re-reading all the headers
+ *---------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFPIopen -- open/reopen file for palette interface
+ USAGE
+    int32 DFPIopen(filename,acc_mode)
+        char *filename;         IN: name of HDF file
+        intn acc_mode;            IN: type of access to open file with
+ RETURNS
+    HDF file handle on success, FAIL on failure.
+ DESCRIPTION
+    Open/reopen a file for the DFP interface to work with.
+ GLOBAL VARIABLES
+    Refset, Readref, Lastfile
+ COMMENTS, BUGS, ASSUMPTIONS
+    This is a hook for someday providing more efficient ways to
+    reopen a file, to avoid re-reading all the headers
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+DFPIopen(const char *filename, intn acc_mode)
+{
+  CONSTR(FUNC, "DFPIopen");
+  int32       file_id;
+  int32       ret_value = SUCCEED;
+
+  /* use reopen if same file as last time - more efficient */
+  if (HDstrncmp(Lastfile, filename, DF_MAXFNLEN) || (acc_mode == DFACC_CREATE))
+    {
+      /* treat create as different file */
+      if ((file_id = Hopen(filename, acc_mode, 0)) == FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+      Refset = 0;   /* no ref to get set for this file */
+      Readref = 0;
+    }     /* end if */
+  else if ((file_id = Hopen(filename, acc_mode, 0)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* remember filename, so reopen may be used next time if same file */
+  HDstrncpy(Lastfile, filename, DF_MAXFNLEN);
+
+  ret_value = (file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFPIopen() */
diff --git a/hdf/src/dfpf.c b/hdf/src/dfpf.c
new file mode 100644
index 0000000..5c7f0aa
--- /dev/null
+++ b/hdf/src/dfpf.c
@@ -0,0 +1,236 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfpf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfpF.c
+ * Purpose: C stubs for Palette Fortran routines
+ * Invokes: dfp.c dfkit.c
+ * Contents:
+ *  dpigpal_     : Call DFPgetpal to get palette
+ *  dpippal_     : Call DFPputpal to write/overwrite palette in file
+ *  dpinpal_     : Call DFPnpals to get number of palettes in file
+ *  dpiwref_     : Call DFPwriteref to set ref of pal to write next
+ *  dpirref_     : Call DFPreadref to set ref of pal to read next
+ *  dprest_      : Call DFPrestart to get palettes afresh in file
+ *  dplref_      : Call DFPlastref to get ref of last pal read/written
+ *  DFPrestart_  : Call DFPrestart to get palettes afresh in file
+ *  DFPlastref_  : Call DFPlastref to get ref of last pal read/written
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "hproto_fortran.h"
+
+/*-----------------------------------------------------------------------------
+ * Name:    dpigpal
+ * Purpose: call DFPgetpal, get palette
+ * Inputs:  filename, fnlen: filename, length of name
+ *          pal: space to put palette
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFPgetpal
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndpigpal(_fcd filename, _fcd pal, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFPgetpal(fn, (VOIDP) _fcdtocp(pal));
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dpippal
+ * Purpose: Write palette to file
+ * Inputs:  filename: name of HDF file
+ *          palette: palette to be written to file
+ *          overwrite: if 1, overwrite last palette read or written
+ *                     if 0, write it as a fresh palette
+ *          filemode: if "a", append palette to file
+ *                    if "w", create new file
+ *          fnlen:  length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF users, programmers, utilities
+ * Invokes: DFPputpal
+ * Remarks: To overwrite, the filename must be the same as for the previous
+ *          call
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndpippal(_fcd filename, _fcd pal, intf * overwrite, _fcd filemode, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFPputpal(fn, (VOIDP) _fcdtocp(pal), (intn) *overwrite,
+                    (char *) _fcdtocp(filemode));
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dpinpal
+ * Purpose: How many palettes are present in this file?
+ * Inputs:  filename, fnlen: name, length of HDF file
+ * Returns: number of palettes on success, -1 on failure with DFerror set
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFPnpals
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndpinpal(_fcd filename, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFPnpals(fn);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dpirref
+ * Purpose: Set ref of palette to get next
+ * Inputs:  filename: file to which this applies
+ *          ref: reference number of next get
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFPreadref
+ * Remarks: checks if palette with this ref exists
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndpirref(_fcd filename, intf *ref, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFPreadref(fn, (uint16) *ref);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dpiwref
+ * Purpose: Set ref of palette to put next
+ * Inputs:  filename: file to which this applies
+ *          ref: reference number of next put
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFPwriteref
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndpiwref(_fcd filename, intf *ref, intf * fnlen)
+{
+
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFPreadref(fn, (uint16) *ref);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dprest
+ * Purpose: Do not remember info about file - get again from first palette
+ * Inputs:  none
+ * Returns: 0 on success
+ * Users:   HDF programmers
+ * Remarks: Invokes DFPrestart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndprest(void)
+{
+
+    return (DFPrestart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dplref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Globals: Lastref
+ * Returns: ref on success, -1 on error with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFPlastref
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndplref(void)
+{
+
+    return ((intf)DFPlastref());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfprestart
+ * Purpose: Do not remember info about file - get again from first palette
+ * Inputs:  none
+ * Returns: 0 on success
+ * Users:   HDF programmers
+ * Remarks: Invokes DFPrestart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfprestart(void)
+{
+
+    return (DFPrestart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfplastref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Globals: Lastref
+ * Returns: ref on success, -1 on error with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFPlastref
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfplastref(void)
+{
+
+    return ((intf)DFPlastref());
+}
diff --git a/hdf/src/dfpff.f b/hdf/src/dfpff.f
new file mode 100644
index 0000000..349df1d
--- /dev/null
+++ b/hdf/src/dfpff.f
@@ -0,0 +1,285 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: dfpff.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+C------------------------------------------------------------------------------
+C File:     dfpFf.f
+C Purpose:  Fortran stubs for Palette Fortran routines
+C Invokes:  dfpF.c dfkit.c
+C Contents: 
+C   dpgpal:         Call dpigpal to get palette
+C   dpapal:         Call dpippal to add palette to file
+C   dpppal:         Call dpippal to write/overwrite palette in file
+C   dpnpal:         Call dpinpal to get number of palettes in file
+C   dpwref:         Call dpiwref to set ref of pal to write next
+C   dprref:         Call dpirref to set ref of pal to read next
+C   dfpgetpal:      Call dpigpal to get palette
+C   dfpaddpal:      Call dpippal to add palette to file
+C   dfpputpal:      Call dpippal to write/overwrite palette in file
+C   dfpnpals:       Call dpinpal to get number of palettes in file
+C   dfpwriteref:    Call dpiwref to set ref of pal to write next
+C   dfpreadref:     Call dpirref to set ref of pal to read next
+C Remarks: none
+C----------------------------------------------------------------------------*/
+
+
+C------------------------------------------------------------------------------
+C Name: dpgpal
+C Purpose:  call dpigpal, get palette
+C Inputs:   filename: filename to get pal from
+C           pal: space to put palette
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    Fortran stub routine
+C Invokes: dpigpal
+C----------------------------------------------------------------------------*/
+
+      integer function dpgpal(filename, pal)
+
+      character*(*) filename
+      character*(*) pal
+      integer dpigpal
+
+      dpgpal = dpigpal(filename, pal, len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name: dpapal
+C Purpose:  call dpippal, add palette
+C Inputs:   filename: filename to put pal into
+C           pal: palette
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    Fortran stub routine
+C Invokes: dpippal
+C----------------------------------------------------------------------------*/
+
+      integer function dpapal(filename, pal)
+
+      character*(*) filename
+      character*(*) pal
+      integer dpippal
+
+      dpapal = dpippal(filename, pal, 0, 'a', len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dpppal
+C     Purpose:  call dpippal, write palette
+C     Inputs:   filename: filename to put pal to
+C     		pal: palette
+C           ow, filemode: see dfpputpal
+C     Returns: 0 on success, -1 on failure with DFerror set
+C     Users:    Fortran stub routine
+C     Invokes: dpippal
+C----------------------------------------------------------------------------*/
+      
+      integer function dpppal(filename, pal, ow, filemode)
+      
+      character*(*) filename
+      character*(*) pal
+      integer dpippal, ow
+      character*(*) filemode
+      
+      dpppal = dpippal(filename, pal, ow, filemode, len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dpnpals
+C     Purpose:  How many palettes are present in this file?
+C     Inputs:   filename: name of HDF file
+C     Returns: number of palettes on success, -1 on failure with DFerror set
+C     Users:    HDF programmers, other routines and utilities
+C     Invokes: dpinpal
+C----------------------------------------------------------------------------*/
+      
+      integer function dpnpals(filename)
+      
+      character*(*) filename
+      integer dpinpal
+      
+      dpnpals = dpinpal(filename, len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dpwref
+C     Purpose:  Ref to write next
+C     Inputs:   filename: name of HDF file
+C     ref: ref to write next
+C     Returns: number of palettes on success, -1 on failure with DFerror set
+C     Users:    HDF programmers, other routines and utilities
+C     Invokes: dpiwref
+C----------------------------------------------------------------------------*/
+      
+      integer function dpwref(filename, ref)
+      
+      character*(*) filename
+      integer ref, dpiwref
+      
+      dpwref = dpiwref(filename, ref, len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dprref
+C     Purpose:  Ref to read next
+C     Inputs:   filename: name of HDF file
+C     ref: ref to read next
+C     Returns: number of palettes on success, -1 on failure with DFerror set
+C     Users:    HDF programmers, other routines and utilities
+C     Invokes: dpirref
+C----------------------------------------------------------------------------*/
+      
+      integer function dprref(filename, ref)
+      
+      character*(*) filename
+      integer ref, dpirref
+      
+      dprref = dpirref(filename, ref, len(filename))
+      return
+      end
+      
+      
+CEND7MAX
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dfpgetpal
+C     Purpose:  call dpigpal, get palette
+C     Inputs:   filename: filename to get pal from
+C     pal: space to put palette
+C     Returns: 0 on success, -1 on failure with DFerror set
+C     Users:    Fortran stub routine
+C     Invokes: dpigpal
+C----------------------------------------------------------------------------*/
+      
+      integer function dfpgetpal(filename, pal)
+      
+      character*(*) filename
+      character*(*) pal
+      integer dpigpal
+      
+      dfpgetpal = dpigpal(filename, pal, len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dfpaddpal
+C     Purpose:  call dpippal, add palette
+C     Inputs:   filename: filename to put pal into
+C     pal: palette
+C     Returns: 0 on success, -1 on failure with DFerror set
+C     Users:    Fortran stub routine
+C     Invokes: dpippal
+C----------------------------------------------------------------------------*/
+      
+      integer function dfpaddpal(filename, pal)
+      
+      character*(*) filename
+      character*(*) pal
+      integer dpippal
+      
+      dfpaddpal = dpippal(filename, pal, 0, 'a', len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dfpputpal
+C     Purpose:  call dpippal, write palette
+C     Inputs:   filename: filename to put pal to
+C     pal: palette
+C     ow, filemode: see dfpputpal
+C     Returns: 0 on success, -1 on failure with DFerror set
+C     Users:    Fortran stub routine
+C     Invokes: dpippal
+C----------------------------------------------------------------------------*/
+      
+      integer function dfpputpal(filename, pal, ow, filemode)
+      
+      character*(*) filename
+      character*(*) pal
+      integer dpippal, ow
+      character*(*) filemode
+      
+      dfpputpal = dpippal(filename, pal, ow, filemode, len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dpnpals
+C     Purpose:  How many palettes are present in this file?
+C     Inputs:   filename: name of HDF file
+C     Returns: number of palettes on success, -1 on failure with DFerror set
+C     Users:    HDF programmers, other routines and utilities
+C     Invokes: dpinpal
+C----------------------------------------------------------------------------*/
+      
+      integer function dfpnpals(filename)
+      
+      character*(*) filename
+      integer dpinpal
+      
+      dfpnpals = dpinpal(filename, len(filename))
+      return
+      end
+
+      
+C------------------------------------------------------------------------------
+C     Name: dfpwriteref
+C     Purpose:  Ref to write next
+C     Inputs:   filename: name of HDF file
+C     ref: ref to write next
+C     Returns: number of palettes on success, -1 on failure with DFerror set
+C     Users:    HDF programmers, other routines and utilities
+C     Invokes: dpiwref
+C----------------------------------------------------------------------------*/
+      
+      integer function dfpwriteref(filename, ref)
+      
+      character*(*) filename
+      integer ref, dpiwref
+      
+      dfpwriteref = dpiwref(filename, ref, len(filename))
+      return
+      end
+      
+      
+C------------------------------------------------------------------------------
+C     Name: dfpreadref
+C     Purpose:  Ref to read next
+C     Inputs:   filename: name of HDF file
+C     ref: ref to read next
+C     Returns: number of palettes on success, -1 on failure with DFerror set
+C     Users:    HDF programmers, other routines and utilities
+C     Invokes: dpirref
+C----------------------------------------------------------------------------*/
+      
+      integer function dfpreadref(filename, ref)
+      
+      character*(*) filename
+      integer ref, dpirref
+      
+      dfpreadref = dpirref(filename, ref, len(filename))
+      return
+      end
diff --git a/hdf/src/dfr8.c b/hdf/src/dfr8.c
new file mode 100644
index 0000000..17c03e6
--- /dev/null
+++ b/hdf/src/dfr8.c
@@ -0,0 +1,1685 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfr8.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     dfr8.c
+ * Purpose:  read and write 8-bit Raster Image Groups
+ * Invokes:  df.c, dfcomp.c, dfgroup.c, dfrig.h
+ * Contents:
+ *  DFR8setpalette  : specify palette to be used with subsequent 8-bit images
+ *  DFR8setcompress : Set the compression for next image written
+ *  DFR8putimage    : write 8-bit image into an HDF file
+ *  DFR8addimage    : append another 8-bit image to an HDF file
+ *  DFR8getdims     : retrieve information about 8-bit image dimensions
+ *  DFR8getimage    : retrieve 8-bit image and associated palette
+ *  DFR8putrig      : write out a raster image group for 8-bit images
+ *  DFR8getrig      : read in a raster image group for 8-bit images
+ *  DFR8nimages     : number of images in HDF file
+ *  DFR8readref     : get image with this reference number next
+ *  DFR8writeref    : put image with this reference number next
+ *  DFR8lastref     : return reference number of last element read or written
+ *  DFR8restart     : forget info about last file accessed, restart from
+ *                      beginning
+ * Private:
+ *  DFR8Iopen: open/reopen file
+ *  DFR8Iriginfo: obtain info about next RIG/RI8 to get
+ *  DFR8Iputimage   : internal routine that write 8-bit images to files
+ * Remarks: A RIG specifies attributes associated with an image - palette,
+ *          dimension, compression, color compensation etc.
+ *          The palette for an 8-bit image is assumed to always be 768 bytes
+ *          The palette is arranged as RGBRGB...
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfrig.h"
+
+/* Private Variables */
+PRIVATE uint8 *paletteBuf = NULL;
+PRIVATE uint16 Refset = 0;      /* Ref of image to get next */
+PRIVATE uint16 Lastref = 0;     /* Last ref read/written */
+PRIVATE uint16 Writeref = 0;    /* ref of next image to put in this file */
+PRIVATE intn foundRig = -1;     /* -1: don't know if HDF file has RIGs
+                                   0: No RIGs, try for RI8s etc.
+                                   1: RIGs used, ignore RI8s etc. */
+PRIVATE intn Newdata = 0;       /* does Readrig contain fresh data? */
+PRIVATE intn Newpalette = -1;   /* -1 = no palette is associated
+                                   0 = palette already written out
+                                   1 = new palette, not yet written out */
+
+PRIVATE intn CompressSet = FALSE;   /* Whether the compression parameters have
+                                       been set for the next image */
+PRIVATE int32 CompType = COMP_NONE;     /* What compression to use for the next
+                                           image */
+PRIVATE comp_info CompInfo;     /* Params for compression to perform */
+PRIVATE char Lastfile[DF_MAXFNLEN];     /* last file opened */
+PRIVATE DFRrig Readrig =
+{                               /* information about RIG being read */
+    NULL, 0, 0, (float32) 0.0, (float32) 0.0,
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+};
+PRIVATE DFRrig Writerig =
+{                               /* information about RIG being written */
+    NULL, 0, 0, (float32) 0.0, (float32) 0.0,
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+};
+PRIVATE DFRrig Zrig =
+{                               /* empty RIG for initialization */
+    NULL,
+    0, 0, (float32) 0.0, (float32) 0.0,
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {(float32) 0.0, (float32) 0.0, (float32) 0.0},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+    {0, 0},
+    {0, 0, 0, 0,
+     {0, 0},
+     {0, 0}},
+};
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+/* private functions */
+PRIVATE intn DFR8Iputimage
+            (const char *filename, const void * image, int32 xdim, int32 ydim, uint16 compress,
+             intn append);
+
+PRIVATE int32 DFR8Iopen
+            (const char *filename, intn acc_mode);
+
+PRIVATE intn DFR8Iriginfo
+            (int32 file_id);
+
+PRIVATE intn DFR8getrig
+            (int32 file_id, uint16 ref, DFRrig * rig);
+
+PRIVATE intn DFR8putrig
+            (int32 file_id, uint16 ref, DFRrig * rig, intn wdim);
+
+PRIVATE intn DFR8Istart(void);
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8setcompress -- set compression scheme for 8-bit image
+ USAGE
+    intn DFR8setcompress(type,cinfo)
+        int32 type;             IN: the type of compression to perform on the
+                                    next image
+        comp_info *cinfo;       IN: ptr to compression information structure
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the scheme used to compress the next 8-bit raster image written out
+    with the DFR8 interface.
+
+    Valid compression types available for this interface are listed in
+    hcomp.h as COMP_nnnn.
+ GLOBAL VARIABLES
+    Uses the CompressSet, CompType and CompInfo global variables to store
+    the information about the compression scheme.
+ COMMENTS, BUGS, ASSUMPTIONS
+    Only the JPEG compression type currently uses the cinfo structure.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8setcompress(int32 type, comp_info * cinfo)
+{
+  CONSTR(FUNC, "DFR8setcompress");
+  intn   ret_value = SUCCEED;
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (type == COMP_NONE)
+    {     /* quick check for no compression */
+      CompType = 0;
+      HGOTO_DONE(SUCCEED);
+    }     /* end if */
+
+  if (type < 0 || type > COMP_MAX_COMP || compress_map[type] == 0)
+    HGOTO_ERROR(DFE_BADSCHEME, FAIL);
+
+  CompressSet = TRUE;
+
+  /* map JPEG compression into correct type of JPEG compression */
+  if (type == COMP_JPEG)
+  CompType = DFTAG_GREYJPEG5;
+  else    /* otherwise, just use mapped tag */
+    CompType = (int32)compress_map[type];
+  CompInfo = (*cinfo);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFR8setcompress() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8getdims -- get dimensions of next image from RIG, also if there is a
+                    palette
+ USAGE
+    intn DFR8getdims(filename,pxdim,pydim,pispal)
+        char *filename;         IN: name of HDF file
+        int32 *pxdim, *pydim;   OUT: ptr to locations for returning X & Y dims
+        intn *pispal;           OUT: ptr to location for returning if there is
+                                    a palette
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Moves to the next 8-bit raster image in a file and returns the
+    dimensions and whether there is a palette associated with it.
+
+    Will also handle file with just raster-8 tags: RI8, CI8, ID8, IP8
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8getdims(const char *filename, int32 *pxdim, int32 *pydim, intn *pispal)
+{
+  CONSTR(FUNC, "DFR8getdims");
+  int32       file_id=(-1);
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!filename || !*filename || !pxdim || !pydim)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if ((file_id = DFR8Iopen(filename, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  if (DFR8Iriginfo(file_id) == FAIL)  /* reads next RIG or RI8 from file */
+      HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+  Newdata = 1;
+  *pxdim = Readrig.descimage.xdim;
+  *pydim = Readrig.descimage.ydim;
+  if (pispal)
+    *pispal = Readrig.lut.tag ? 1 : 0;  /* is there a palette */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  if(file_id!=(-1))
+      Hclose(file_id);
+
+  return ret_value;
+}   /* end DFR8getdims() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8getimage -- get next image from a RIG, get palette also if desired
+ USAGE
+    intn DFR8getimage(filename,image,xdim,ydim,pal)
+        char *filename;         IN: name of HDF file
+        uint8 *image;           OUT: ptr to buffer to store image in
+        int32 xdim,ydim;        IN: dims of space allocated by user for image
+        uint8 *pal;             OUT: 768-byte space for palette, NULL if palette
+                                    not wanted
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Reads the next 8-bit raster image from the file specified into the image
+    buffer and it's associated palette into the palette buffer if the pal
+    ptr is not NULL.
+
+    Will also get RI8s and CI8s if no RIGs in file.
+
+    Normally,DFR8getdims is called first and it finds next image to get.
+    But if that is not called, DFR8getimage will itself find next image.
+
+    Automatically decompresses images.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8getimage(const char *filename, uint8 *image, int32 xdim, int32 ydim, uint8 *pal)
+{
+  CONSTR(FUNC, "DFR8getimage");
+  int32       file_id=(-1);
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!filename || !*filename || !image || (xdim <= 0) || (ydim <= 0))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if ((file_id = DFR8Iopen(filename, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  if (!Newdata)
+    {     /* if Readrig not fresh */
+      if (DFR8Iriginfo(file_id) == FAIL)    /*reads next RIG or RI8 from file */
+          HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    }     /* end if */
+  Newdata = 0;    /* read new RIG next time */
+
+  if ((Readrig.descimage.xdim > xdim) || (Readrig.descimage.ydim > ydim))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* read image */
+  if (Readrig.descimage.compr.tag)
+    {     /* compressed image */
+      if (DFgetcomp(file_id, Readrig.image.tag, Readrig.image.ref, image,
+                    Readrig.descimage.xdim, Readrig.descimage.ydim,
+                    Readrig.descimage.compr.tag) == FAIL)
+          HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    }     /* end if */
+  else
+    {     /* non-compressed raster image */
+      if (Hgetelement(file_id, Readrig.image.tag, Readrig.image.ref, image) == FAIL)
+          HGOTO_ERROR(DFE_GETELEM,FAIL);
+    }     /* end else */
+
+  if (xdim > Readrig.descimage.xdim)
+    {
+      int32       off1, off2;
+      int32       x, y;
+
+      off1 = (Readrig.descimage.ydim - 1) * xdim;
+      off2 = (Readrig.descimage.ydim - 1) * Readrig.descimage.xdim;
+      for (y = Readrig.descimage.ydim - 1; y > 0; y--)
+        {
+          for (x = Readrig.descimage.xdim - 1; x >= 0; x--)
+            image[off1 + x] = image[off2 + x];
+          off1 -= xdim;
+          off2 -= Readrig.descimage.xdim;
+        }   /* end for */
+    }     /* end for */
+
+  if (pal && Readrig.lut.tag)
+    {     /* read palette */
+      if (Hgetelement(file_id, Readrig.lut.tag, Readrig.lut.ref, pal) == FAIL)
+          HGOTO_ERROR(DFE_GETELEM,FAIL);
+    }     /* end if */
+
+  if((ret_value = Hclose(file_id))==FAIL)
+    HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(file_id!=(-1))
+            Hclose(file_id);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8getimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8setpalette -- set palette for subsequent images
+ USAGE
+    intn DFR8setpalette(pal)
+        uint8 *pal;             IN: 768-byte buffer for palette to use for next
+                                    image
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Stores a palette for use with further 8-bit raster images written
+    through this interface.
+
+    If pal is NULL, no palette is associated with subsequent images.
+ GLOBAL VARIABLES
+    paletteBuf, Writerig, Newpalette
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8setpalette(uint8 *pal)
+{
+  CONSTR(FUNC, "DFR8setpalette");
+  intn     ret_value = SUCCEED;
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Check if paletteBuf buffer has been allocated */
+  if (paletteBuf == NULL)
+    {
+      paletteBuf = (uint8 *) HDmalloc(768 * sizeof(uint8));
+      if (paletteBuf == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    }     /* end if */
+
+  if (!pal)
+    {
+      Newpalette = -1;  /* no palette */
+      Writerig.lut.tag = 0;
+      Writerig.lut.ref = 0;     /* forget tag/ref of previous palette */
+      Writerig.desclut.xdim = 0;
+      Writerig.desclut.ncomponents = 0;
+    }     /* end if */
+  else
+    {     /* store palette */
+      HDmemcpy(paletteBuf, pal, 768);
+      Newpalette = 1;
+    }     /* end else */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFR8setpalette() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8Iputimage -- Internal routine to write RIG to file
+ USAGE
+    intn DFR8Iputimage(filename, image, xdim, ydim, compress, append)
+        char *filename;         IN: name of HDF file
+        const void * image;            IN: ptr to buffer image is stored in
+        int32 xdim,ydim;        IN: dims of space allocated by user for image
+        uint16 compress;        IN: type of compression to store image with
+        intn append;            IN: whether to (0) overwrite existing file, or
+                                    (1) append image to file.
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Stores an image in an HDF file.  If a palette has been specified to use
+    with 8-bit rasters, then it will be written to the file too and associated
+    with the image.
+ GLOBAL VARIABLES
+    paletteBuf, Newpalette, Writeref, CompressSet, CompType, CompInfo, Lastref,
+    Writerig
+ COMMENTS, BUGS, ASSUMPTIONS
+    Palette will be associated with image is isPalette is 1
+    Palette will be written to file if not written before (Palref=0)
+    Creates both RIG and RI8/CI8 tags, to accomodate older programs
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+DFR8Iputimage(const char *filename, const void * image, int32 xdim, int32 ydim,
+              uint16 compress, intn append)
+{
+  CONSTR(FUNC, "DFR8Iputimage");
+  intn        acc_mode;       /* create if op 0, write if op 1 */
+  int32       file_id=(-1);
+  uint16      r8tag;          /* RIG and raster tags of image being written */
+  uint8      *pal;            /* pointer to palette to be written */
+  uint8       newpal[768];    /* Imcomp creates new palette to be associated */
+  intn        wdim;           /* have dimensions already been written out? */
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!filename || !*filename || !image || (xdim <= 0) || (ydim <= 0))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* Check if Palette buffer has been allocated */
+  if (paletteBuf == NULL)
+    {
+      paletteBuf = (uint8 *) HDmalloc(768 * sizeof(uint8));
+      if (paletteBuf == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    }     /* end if */
+
+  pal = (Newpalette >= 0) ? paletteBuf : NULL;
+  acc_mode = append ? DFACC_WRITE : DFACC_CREATE;
+
+  if ((file_id = DFR8Iopen(filename, acc_mode)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* write out image */
+  if (compress || CompressSet)
+    {
+      /* if a compression type has been set, check if it's the same */
+      if (CompressSet == FALSE || (compress > (uint16)1 && (int32)compress != CompType &&
+                                   !(compress == (uint16)COMP_JPEG && CompType == (int32)DFTAG_GREYJPEG5)))
+        {
+          if ((int32)compress > COMP_MAX_COMP || compress_map[compress] == 0)
+            HGOTO_ERROR(DFE_BADSCHEME, FAIL);
+          /* map JPEG compression into correct type of JPEG compression */
+          if (compress == COMP_JPEG)
+            {
+              CompType = DFTAG_GREYJPEG5;
+              /* set up some sane JPEG params */
+              CompInfo.jpeg.quality = 75;
+              CompInfo.jpeg.force_baseline = TRUE;
+            }     /* end if */
+          else    /* otherwise, just use mapped tag */
+            CompType = (int32)compress_map[compress];
+        }   /* end if */
+      if (!Writeref)
+        if ((Writeref = Hnewref(file_id)) == 0)
+          HGOTO_ERROR(DFE_NOREF, FAIL);
+
+      if (DFputcomp(file_id, DFTAG_CI, Writeref, image, xdim, ydim,
+                    pal, newpal, (int16) CompType, &CompInfo) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+      Writerig.image.tag = DFTAG_CI;
+      if (CompType == DFTAG_IMC)
+        {
+          pal = newpal;   /* Imcomp creates new pal */
+          Newpalette = 1;     /* write out palette */
+        }   /* end if */
+    }     /* end if */
+  else
+    {     /* image need not be compressed */
+      if (!Writeref)
+        if ((Writeref = Hnewref(file_id)) == 0)
+          HGOTO_ERROR(DFE_NOREF, FAIL);
+
+      if (Hputelement(file_id, DFTAG_RI, Writeref, image, xdim * ydim) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      Writerig.image.tag = DFTAG_RI;
+    }     /* end else */
+  Writerig.image.ref = Writeref;
+  Writerig.descimage.ncomponents = 1;
+  Writerig.aspectratio = (float32) 1.0;
+
+    /* Write out Raster-8 tags for those who want it */
+    if (CompType != DFTAG_GREYJPEG5)
+      {
+        r8tag = (uint16) (CompType ?
+                          ((CompType == DFTAG_RLE) ? DFTAG_CI8 : DFTAG_II8) : DFTAG_RI8);
+        if (Hdupdd(file_id, r8tag, Writeref, Writerig.image.tag, Writeref) == FAIL)
+          HGOTO_ERROR(DFE_NOFREEDD, FAIL);
+      }     /* end if */
+
+  /* Write out palette */
+  if (pal)
+    {     /* if there is a palette */
+      if (Newpalette == 1)
+        {   /* write palette */
+          if (Hputelement(file_id, DFTAG_LUT, Writeref, pal, (int32) 768) == FAIL)
+            HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          Writerig.lut.tag = DFTAG_LUT;
+          Writerig.lut.ref = Writeref;
+          Writerig.desclut.xdim = 768;
+          Writerig.desclut.ncomponents = 1;
+        }   /* end if */
+      if (CompType != DFTAG_IMC)
+        Newpalette = 0;
+      /* if IMCOMP, original palette not written out */
+
+      /* put in Raster-8 stuff also, for those who want it */
+      Hdeldd(file_id, DFTAG_IP8, Writeref);
+      if (Hdupdd(file_id, DFTAG_IP8, Writeref, Writerig.lut.tag,
+                 Writerig.lut.ref) == FAIL)
+        HGOTO_ERROR(DFE_NOFREEDD, FAIL);
+    }     /* end if */
+
+  /* Write out RIG */
+  if ((Writerig.descimage.xdim == xdim) && (Writerig.descimage.ydim == ydim) &&
+      (Writerig.descimage.compr.tag == (uint16) CompType))
+    wdim = 0;
+  else
+    {
+      wdim = 1;
+      Writerig.descimage.xdim = xdim;
+      Writerig.descimage.ydim = ydim;
+      Writerig.descimage.compr.tag = (uint16) CompType;
+      Writerig.descimage.compr.ref = Writeref;
+    }     /* end else */
+
+  /* write ID, NT */
+  if (DFR8putrig(file_id, Writeref, &Writerig, wdim) == FAIL)
+    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+  Lastref = Writeref;     /* remember ref written */
+
+  Writeref = 0;   /* don't know ref to write next */
+  CompressSet = FALSE;    /* Reset Compression flag and type */
+  CompType = COMP_NONE;
+
+  ret_value = Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(file_id!=(-1))
+          Hclose(file_id);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8Iputimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8putimage -- Write 8-bit raster image to HDF file
+ USAGE
+    intn DFR8putimage(filename, image, xdim, ydim, compress)
+        char *filename;         IN: name of HDF file
+        const void * image;            IN: ptr to buffer to store image in
+        int32 xdim,ydim;        IN: dims of space allocated by user for image
+        uint16 compress;        IN: type of compression to store image with
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Stores an image in an HDF file.  If a palette has been specified to use
+    with 8-bit rasters, then it will be written to the file too and associated
+    with the image.
+
+    This function overwrites existing HDF files.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8putimage(const char *filename, const void * image, int32 xdim, int32 ydim,
+             uint16 compress)
+{
+    CONSTR(FUNC, "DFR8putimage");    /* for HERROR */
+    intn ret_value;
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  ret_value = (DFR8Iputimage(filename, image, xdim, ydim, compress, 0));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8putimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8addimage -- Append 8-bit raster image to HDF file
+ USAGE
+    intn DFR8putimage(filename, image, xdim, ydim, compress)
+        char *filename;         IN: name of HDF file
+        const void * image;            IN: ptr to buffer to store image in
+        int32 xdim,ydim;        IN: dims of space allocated by user for image
+        uint16 compress;        IN: type of compression to store image with
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Stores an image in an HDF file.  If a palette has been specified to use
+    with 8-bit rasters, then it will be written to the file too and associated
+    with the image.
+
+    This function does not overwrite existing HDF files, just appends the
+    to the file.  It will create the file if necessary.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8addimage(const char *filename, const void * image, int32 xdim, int32 ydim,
+             uint16 compress)
+{
+    CONSTR(FUNC, "DFR8addimage");    /* for HERROR */
+    intn ret_value;
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  ret_value = (DFR8Iputimage(filename, image, xdim, ydim, compress, 1));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8addimage() */
+
+/*****************************************************************************/
+/* This is the next lower layer - procedures to get and put a RIG. */
+/* These are specific to 8-bit */
+/*****************************************************************************/
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8getrig -- Read a RIG into memory
+ USAGE
+    intn DFR8getrig(file_id,ref,rig)
+        int32 file_id;          IN: HDF file ID of file to retrieve RIG from
+        uint16 ref;             IN: ref # of RIG to get
+        DFRrig *rig;            OUT: ptr to RIG structure to place info in
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Retrieves a specific RIG from an HDF file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    This function seems to be a low level routine, but could be exported.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+DFR8getrig(int32 file_id, uint16 ref, DFRrig * rig)
+{
+  CONSTR(FUNC, "DFR8getrig");
+  uint16      elt_tag;
+  uint16      elt_ref;
+  uint8       ntstring[4];
+  int32       GroupID;
+  uint8       R8tbuf[64];
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!HDvalidfid(file_id) || !ref || !rig)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* read RIG into memory */
+  if ((GroupID = DFdiread(file_id, DFTAG_RIG, ref)) == FAIL)
+    HGOTO_ERROR(DFE_BADGROUP, FAIL);
+
+  *rig = Zrig;    /* fill rig with zeroes */
+  while (DFdiget(GroupID, &elt_tag, &elt_ref) != FAIL)
+    {
+      /*get next tag/ref from RIG */
+      switch (elt_tag)
+        {   /* process tag/ref */
+        case DFTAG_CI:
+        case DFTAG_RI:
+          rig->image.tag = elt_tag;   /* put tag/ref in struct */
+          rig->image.ref = elt_ref;
+          break;
+
+        case DFTAG_LUT:
+          rig->lut.tag = elt_tag;
+          rig->lut.ref = elt_ref;
+          break;
+
+        case DFTAG_ID:      /* read description info */
+          if (Hgetelement(file_id, elt_tag, elt_ref, R8tbuf) != FAIL)
+            {
+              uint8      *p;
+
+              p = R8tbuf;
+              INT32DECODE(p, rig->descimage.xdim);
+              INT32DECODE(p, rig->descimage.ydim);
+              UINT16DECODE(p, rig->descimage.nt.tag);
+              UINT16DECODE(p, rig->descimage.nt.ref);
+              INT16DECODE(p, rig->descimage.ncomponents);
+              INT16DECODE(p, rig->descimage.interlace);
+              UINT16DECODE(p, rig->descimage.compr.tag);
+              UINT16DECODE(p, rig->descimage.compr.ref);
+            }     /* end if */
+          else
+            {
+              DFdifree(GroupID);
+              ret_value = FAIL;
+              goto done;
+            }
+          if (rig->descimage.ncomponents != 1)
+            {
+              DFdifree(GroupID);
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+            }
+          if (rig->descimage.nt.tag == 0)
+            break;  /* old RIGs */
+
+          /* read NT */
+          if (Hgetelement(file_id, rig->descimage.nt.tag,
+                          rig->descimage.nt.ref, ntstring) == FAIL)
+            {
+              DFdifree(GroupID);
+              HGOTO_ERROR(DFE_GETELEM, FAIL);
+            }
+          if ((ntstring[2] != 8) || (ntstring[1] != DFNT_UCHAR))
+            {
+              DFdifree(GroupID);
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+            }
+          break;
+
+        default:    /* ignore unknown tags */
+          break;
+        }   /* end switch */
+    }     /* end while */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8getrig() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8putrig -- Write RIG struct out to HDF file
+ USAGE
+    intn DFR8putrig(file_id,ref,rig,wdim)
+        int32 file_id;          IN: HDF file ID of file to put RIG into
+        uint16 ref;             IN: ref # of RIG to put
+        DFRrig *rig;            IN: ptr to RIG structure to write to file
+        intn wdim;              IN: if (1) write new descr. records, (0)
+                                    if records already written
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Writes a specific RIG to an HDF file.  If wdim is 1, then the ID & ID8
+    records will be written also
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    This function seems to be a low level routine, but could be exported.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+DFR8putrig(int32 file_id, uint16 ref, DFRrig * rig, intn wdim)
+{
+  CONSTR(FUNC, "DFR8putrig");
+  static uint16 prevdimref = 0;   /*ref of previous dimension record, to reuse */
+  R8dim       im8dim;
+  uint8       ntstring[4];
+  int32       GroupID;
+  uint8       R8tbuf[64];
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  if (!HDvalidfid(file_id) || !ref)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!rig->descimage.nt.tag)
+    {     /* construct and write out NT */
+      ntstring[0] = DFNT_VERSION;   /* version */
+      ntstring[1] = DFNT_UCHAR;     /* type */
+      ntstring[2] = 8;  /* width: RIG data is 8-bit chars */
+      ntstring[3] = DFNTC_BYTE;     /* class: data are numeric values */
+      if (Hputelement(file_id, DFTAG_NT, ref, ntstring, (int32) 4) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      rig->descimage.nt.tag = DFTAG_NT;
+      rig->descimage.nt.ref = ref;
+    }     /* end if */
+
+  im8dim.xd = (uint16) rig->descimage.xdim;
+  im8dim.yd = (uint16) rig->descimage.ydim;
+  if (wdim)
+    {
+      uint8      *p;
+
+      p = R8tbuf;
+      INT32ENCODE(p, rig->descimage.xdim);
+      INT32ENCODE(p, rig->descimage.ydim);
+      UINT16ENCODE(p, rig->descimage.nt.tag);
+      UINT16ENCODE(p, rig->descimage.nt.ref);
+      INT16ENCODE(p, rig->descimage.ncomponents);
+      INT16ENCODE(p, rig->descimage.interlace);
+      UINT16ENCODE(p, rig->descimage.compr.tag);
+      UINT16ENCODE(p, rig->descimage.compr.ref);
+      if (Hputelement(file_id, DFTAG_ID, ref, R8tbuf, (int32) (p - R8tbuf)) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+
+      /* write out ID8 */
+      p = R8tbuf;
+      UINT16ENCODE(p, im8dim.xd);
+      UINT16ENCODE(p, im8dim.yd);
+      if (Hputelement(file_id, DFTAG_ID8, ref, R8tbuf, (int32) 4) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      prevdimref = ref;
+    }     /* end if */
+  if (!prevdimref)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* prepare to start writing rig */
+    /* ### NOTE: the second parameter to this call may go away */
+  if ((GroupID = DFdisetup(10)) == FAIL)
+    HGOTO_ERROR(DFE_GROUPSETUP, FAIL);    /* max 10 tag/refs in set */
+
+    /* add tag/ref to RIG - image description, image and palette */
+  if (DFdiput(GroupID, DFTAG_ID, prevdimref) == FAIL)
+    HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+  if (DFdiput(GroupID, rig->image.tag, rig->image.ref) == FAIL)
+    HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+  if (rig->lut.ref && DFdiput(GroupID, rig->lut.tag, rig->lut.ref) == FAIL)
+    HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+    /* write out RIG */
+  if((ret_value = DFdiwrite(file_id, GroupID, DFTAG_RIG, ref))==FAIL)
+    HGOTO_ERROR(DFE_GROUPWRITE, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8putrig() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8nimages -- Determines the number of 8-bit raster images in a file
+ USAGE
+    intn DFR8nimages(filename)
+        char *filename;         IN: filename to check # of images
+ RETURNS
+    number of images on success, -1 on failure.
+ DESCRIPTION
+    Determines the number of unique 8-bit images in the file.  Only counts
+    RIGs and RI8s which point to the same image once.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Does not count 8-bit SDS datasets.  (Should not either!)
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8nimages(const char *filename)
+{
+  CONSTR(FUNC, "DFR8nimages");
+  int32       file_id;
+  int32       group_id;       /* group ID for looking at RIG's */
+  uint16      elt_tag, elt_ref;   /* tag/ref of items in a RIG */
+  intn        curr_image;     /* current image gathering information about */
+  intn        nimages;        /* total number of potential images */
+  int32       nrig, nri8, nci8;   /* number of RIGs, RI8s, and CI8s */
+  int32      *img_off;        /* storage for an array of image offsets */
+  uint16      rig_tag, rig_ref;   /* storage for tag/ref pairs of RIGs */
+  intn        found_8bit;     /* indicates whether a RIG is an 8-bit RIG */
+  uint16      find_tag, find_ref;     /* storage for tag/ref pairs found */
+  int32       find_off, find_len;     /* storage for offset/lengths of tag/refs found */
+  uint8       GRtbuf[64];     /* local buffer to read the ID element into */
+  intn        i, j;           /* local counting variable */
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* should use reopen if same file as last time - more efficient */
+  file_id = DFR8Iopen(filename, DFACC_READ);
+  if (file_id == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* In a completely psychotic file, there could be RIGs with no corresponding
+       RI8s and also RI8s with no corresponding RIGs, so assume the worst
+       case and then run through them all to eliminate matched pairs */
+  nrig = Hnumber(file_id, DFTAG_RIG);     /* count the number of RIGS */
+  if (nrig == FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+  nri8 = Hnumber(file_id, DFTAG_RI8);     /* add the number of RI8 and CI8s */
+  if (nri8 == FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+  nci8 = Hnumber(file_id, DFTAG_CI8);
+  if (nci8 == FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+  nimages = (intn) (nrig + nri8 + nci8);
+
+  /* if there are no images just close the file and get out */
+  if (nimages == 0)
+    {
+      if (Hclose(file_id) == FAIL)
+        ret_value = FAIL;
+      else
+        ret_value = nimages;
+
+      goto done; /* we are done */
+    }
+
+  /* Get space to store the image offsets */
+  if ((img_off = (int32 *) HDmalloc(nimages * sizeof(int32))) == NULL)
+    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* go through the RIGs looking for 8-bit images */
+  curr_image = 0;
+  find_tag = find_ref = 0;
+  while (Hfind(file_id, DFTAG_RIG, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+    {
+      /* read RIG into memory */
+      if ((group_id = DFdiread(file_id, DFTAG_RIG, find_ref)) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      found_8bit = FALSE;   /* initialize to no 8-bit image found */
+      rig_tag = rig_ref = 0;    /* initialize bogus tag/ref */
+      while (!DFdiget(group_id, &elt_tag, &elt_ref))
+        {   /* get next tag/ref */
+          if (elt_tag == DFTAG_ID)
+            {     /* just look for ID tags to get the number of components */
+              if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
+                {
+                  uint16      temp16;   /* temporary holding variable */
+                  int32       temp;   /* temporary holding variable */
+                  int16       ncomponents;    /* number of image components */
+                  uint8      *p;
+
+                  p = GRtbuf;
+                  INT32DECODE(p, temp);
+                  INT32DECODE(p, temp);
+                  UINT16DECODE(p, temp16);
+                  UINT16DECODE(p, temp16);
+                  INT16DECODE(p, ncomponents);
+                  if (ncomponents == 1)   /* whew, all that work and we finally found an 8-bit image */
+                    found_8bit = TRUE;
+                }   /* end if */
+              else
+                {
+                  DFdifree(group_id);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+            }     /* end if */
+          else
+            /* check for the image tag/ref */ if (elt_tag == DFTAG_CI || elt_tag == DFTAG_RI)
+              {     /* keep for later */
+                rig_tag = elt_tag;
+                rig_ref = elt_ref;
+              }     /* end if */
+        }   /* end while */
+      if (found_8bit)
+        {   /* check for finding an 8-bit RIG */
+          if ((uintn)rig_tag > (uintn)0 && (uintn)rig_ref > (uintn)0)
+            {     /* make certain we found an image */
+              img_off[curr_image] = Hoffset(file_id, rig_tag, rig_ref);     /* store offset */
+              curr_image++;
+            }     /* end if */
+        }   /* end if */
+    }     /* end while */
+
+  /* go through the RI8s */
+  find_tag = find_ref = 0;
+  while (Hfind(file_id, DFTAG_RI8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+    {
+      img_off[curr_image] = find_off;   /* store offset */
+      curr_image++;
+    }     /* end while */
+
+  /* go through the CI8s */
+  find_tag = find_ref = 0;
+  while (Hfind(file_id, DFTAG_CI8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+    {
+      img_off[curr_image] = find_off;   /* store offset */
+      curr_image++;
+    }     /* end while */
+
+  nimages = curr_image;   /* reset the number of images we really have */
+  for (i = 1; i < curr_image; i++)
+    {     /* go through the images looking for duplicates */
+      for (j = 0; j < i; j++)
+        {
+          if (img_off[i] == img_off[j])
+            {
+                nimages--;  /* if duplicate found, decrement the number of images */
+                img_off[j]=(-1); /* mark as used, so we don't count it too... */
+            } /* end if */
+        }   /* end for */
+    }     /* end for */
+
+  HDfree(img_off);   /* free offsets */
+  if (Hclose(file_id) == FAIL)
+    HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+
+  ret_value = nimages;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFR8nimages() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8readref -- Set ref of image to get next
+ USAGE
+    intn DFR8readref(char *filename, uint16 ref)
+        char *filename;         IN: filename to set read ref #
+        uint16 ref;             IN: ref# of next image to read
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the reference # of the RIG to read from next.
+ GLOBAL VARIABLES
+    Refset, Newdata
+ COMMENTS, BUGS, ASSUMPTIONS
+    Checks if image with this ref exists.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8readref(const char *filename, uint16 ref)
+{
+  CONSTR(FUNC, "DFR8readref");
+  int32       file_id=(-1);
+  int32       aid;
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if ((file_id = DFR8Iopen(filename, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  if ((aid = Hstartread(file_id, DFTAG_RIG, ref)) == FAIL
+      && (aid = Hstartread(file_id, DFTAG_RI8, ref)) == FAIL
+      && (aid = Hstartread(file_id, DFTAG_CI8, ref)) == FAIL)
+    HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+  Refset = ref;
+  Newdata = 0;
+  Hendaccess(aid);
+  ret_value = Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(file_id!=(-1))
+          Hclose(file_id);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DFR8readref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8writeref -- Set ref of image to put next
+ USAGE
+    intn DFR8writeref(char *filename, uint16 ref)
+        char *filename;         IN: filename to set write ref #
+        uint16 ref;             IN: ref# of next image to write
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Sets the reference # of the RIG to write to next.
+ GLOBAL VARIABLES
+    Writeref
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8writeref(const char *filename, uint16 ref)
+{
+    CONSTR(FUNC, "DFR8writeref");    /* for HERROR */
+  intn  ret_value = SUCCEED;
+
+  HEclear();
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* shut compiler up */
+  filename = filename;
+  Writeref = ref;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8writeref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8restart -- Restart reading/writing from beginning of file
+ USAGE
+    intn DFR8restart(void)
+ RETURNS
+    SUCCEED on success, FAIL on failure.
+ DESCRIPTION
+    Restarts reading and writing of RIGs from file from the beginning.
+ GLOBAL VARIABLES
+    Lastfile
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+DFR8restart(void)
+{
+    CONSTR(FUNC, "DFR8restart");    /* for HERROR */
+    intn ret_value = SUCCEED;
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  Lastfile[0] = '\0';
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8restart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8lastref -- Return last ref # written or read
+ USAGE
+    uint16 DFR8lastref(void)
+ RETURNS
+    Ref # on success, 0 on failure.
+ DESCRIPTION
+    Returns the last ref # written to or read from.
+ GLOBAL VARIABLES
+    Lastref
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+uint16
+DFR8lastref(void)
+{
+    CONSTR(FUNC, "DFR8lastref");    /* for HERROR */
+    uint16 ret_value;
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, 0);
+
+  ret_value = Lastref;
+
+done:
+  if(ret_value == 0)   /* 0 is invalid ref */
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8lastref() */
+
+/*--------------------------------------------------------------------------
+ * NAME
+ *   DFR8getpalref - get the reference number of the palette
+ * DESCRIPTION
+ *   Convience function to get reference number of the palette of 
+ *   last image. Must come after DFR8getdims() since it relies on
+ *   this call to fill the Readrig structure
+ * RETURNS
+ *   SUCCEED.
+--------------------------------------------------------------------------*/
+intn
+DFR8getpalref(uint16 *pal_ref)
+{
+  CONSTR(FUNC, "DFR8getpalref");
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(DFR8Istart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  *pal_ref = Readrig.lut.ref; /* ref of palette */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8getpalref() */
+
+/*************************************************************************/
+/*----------------------- Internal routines -----------------------------*/
+/*************************************************************************/
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8Iopen -- open or reopen a file
+ USAGE
+    int32 DFR8Iopen(filename, acc_mode)
+        char *filename;             IN: name of file to open
+        intn acc_mode;                IN: access mode to open file with
+ RETURNS
+    HDF file ID on success, FAIL on failure
+ DESCRIPTION
+    Used to open/reopen a file for the DFR8 interface.
+ GLOBAL VARIABLES
+    Lastfile, foundRig, Refset, Newdata, Readrig, Writerig, Newpalette
+ COMMENTS, BUGS, ASSUMPTIONS
+    This is a hook for someday providing more efficient ways to
+    reopen a file, to avoid re-reading all the headers.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+DFR8Iopen(const char *filename, intn acc_mode)
+{
+  CONSTR(FUNC, "DFR8Iopen");
+  int32       file_id;
+  int32       ret_value = SUCCEED;
+
+  /* use reopen if same file as last time - more efficient */
+  if (HDstrncmp(Lastfile, filename, DF_MAXFNLEN) || (acc_mode == DFACC_CREATE))
+    {
+      /* treat create as different file */
+      if ((file_id = Hopen(filename, acc_mode, 0)) == FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+      foundRig = -1;    /* don't know if any RIGs in file */
+      Refset = 0;   /* no ref to get set for this file */
+      Newdata = 0;
+      Readrig = Zrig;   /* blank out read/write RIGs */
+      Writerig = Zrig;
+      if (Newpalette != (-1))
+        Newpalette = 1;   /* need to write out palette */
+    }     /* end if */
+  else
+    {
+      if ((file_id = Hopen(filename, acc_mode, 0)) == FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+    }     /* end else */
+
+  /* remember filename, so reopen may be used next time if same file */
+  HDstrncpy(Lastfile, filename, DF_MAXFNLEN);
+
+  ret_value = file_id;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8Iopen() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8Iriginfo -- Get information about next RIG or RI8 in file
+ USAGE
+    intn DFR8Iriginfo(file_id)
+        int32 file_id;              IN: HDF file ID to read from
+ RETURNS
+    SUCCEED on success, FAIL on failure
+ DESCRIPTION
+    Reads in a RIGs structure into internal data structures, or if no RIGs
+    are found, patches things together from RI8 information.
+
+ GLOBAL VARIABLES
+
+ COMMENTS, BUGS, ASSUMPTIONS
+    if Refset is set, gets image with that ref, if any.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+DFR8Iriginfo(int32 file_id)
+{
+  CONSTR(FUNC, "DFR8Iriginfo");
+  uint16      riref = 0, ciref = 0;
+  int32       aid = FAIL;
+  uint16      ref;
+  uint8       R8tbuf[64];
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+  /* find next rig */
+  if (foundRig)
+    {     /* either RIGs present or don't know */
+      if (!Refset && Readrig.image.ref)
+        aid = Hstartread(file_id, DFTAG_RIG, Readrig.image.ref);
+      do
+        {
+          if (Refset)
+            aid = Hstartread(file_id, DFTAG_RIG, Refset);
+          else
+            {
+              if (!Readrig.image.ref)
+                aid = Hstartread(file_id, DFTAG_RIG, DFREF_WILDCARD);
+              else
+                {
+                  if (aid != FAIL && Hnextread(aid, DFTAG_RIG, DFREF_WILDCARD,
+                                               DF_CURRENT) == FAIL)
+                    {
+                      if(Hendaccess(aid)==FAIL)
+                          HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+                      aid = FAIL;
+                    }     /* end if */
+                }   /* end else */
+            }     /* end else */
+          if (aid == FAIL)
+            {
+              if (foundRig == 1)    /*RIGs present, but no more to return */
+                HGOTO_ERROR(DFE_NOMATCH, FAIL);
+              foundRig = 0;     /* No RIGs present in file */
+            }     /* end if */
+
+          /* RIG found */
+          if (aid != FAIL)
+            {
+              Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &ref,
+                       (int32 *) NULL, (int32 *) NULL, (int32 *) NULL,
+                       (int16 *) NULL, (int16 *) NULL);
+              if (DFR8getrig(file_id, ref, &Readrig) == FAIL)
+                {
+                  if (Refset || (HEvalue(1) != DFE_BADCALL))
+                    {
+                      Refset = 0;
+                      if(Hendaccess(aid)==FAIL)
+                          HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+                      HGOTO_ERROR(DFE_BADRIG, FAIL);
+                    }     /* end if */
+                  Readrig.image.ref = ref;
+                }   /* end if */
+              else
+                {
+                  foundRig = 1;
+                  Refset = 0;
+                }   /* end else */
+            }     /* end if */
+        } while ((aid != FAIL) && (HEvalue(1) == DFE_BADCALL));
+      if (aid != FAIL)
+        if(Hendaccess(aid)==FAIL)
+          HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    }     /* end if */
+  if (Refset || !foundRig)
+    {     /* No RIGs present, look for RI8 and CI8 */
+      /* look for Refset if DFR8ref called, else look for next ref */
+      if (Refset)
+        aid = Hstartread(file_id, DFTAG_RI8, Refset);
+      else
+        {
+          if (Readrig.image.ref)
+            {
+              aid = Hstartread(file_id, DFTAG_RI8, Readrig.image.ref);
+              if (aid != FAIL && Hnextread(aid, DFTAG_RI8, DFREF_WILDCARD,
+                                           DF_CURRENT) == FAIL)
+                {
+                  Hendaccess(aid);
+                  aid = FAIL;
+                }   /* end if */
+            }     /* end if */
+          else
+            aid = Hstartread(file_id, DFTAG_RI8, DFREF_WILDCARD);
+        }   /* end else */
+      if (aid != FAIL)
+        {
+          Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &riref,
+                   (int32 *) NULL, (int32 *) NULL, (int32 *) NULL,
+                   (int16 *) NULL, (int16 *) NULL);
+          if(Hendaccess(aid)==FAIL)
+              HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+        }   /* end if */
+
+      if (Refset)
+        aid = Hstartread(file_id, DFTAG_CI8, Refset);
+      else
+        {
+          if (Readrig.image.ref)
+            {
+              aid = Hstartread(file_id, DFTAG_CI8, Readrig.image.ref);
+              if (aid != FAIL && Hnextread(aid, DFTAG_CI8, DFREF_WILDCARD,
+                                           DF_CURRENT) == FAIL)
+                {
+                  if(Hendaccess(aid)==FAIL)
+                      HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+                  aid = FAIL;
+                }   /* end if */
+            }     /* end if */
+          else
+            aid = Hstartread(file_id, DFTAG_CI8, DFREF_WILDCARD);
+        }   /* end else */
+      if (aid != FAIL)
+        {
+          Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &ciref,
+                   (int32 *) NULL, (int32 *) NULL, (int32 *) NULL,
+                   (int16 *) NULL, (int16 *) NULL);
+          if(Hendaccess(aid)==FAIL)
+              HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+        }   /* end if */
+
+      Refset = 0;
+      if (!riref && !ciref)
+        HGOTO_ERROR(DFE_NOMATCH, FAIL);
+      if ((!ciref) || (riref && (riref < ciref)))
+        {   /* next image is RI8 */
+          Readrig.image.ref = riref;
+          Readrig.image.tag = DFTAG_RI8;
+        }   /* end if */
+      else
+        {   /* next image is CI8 */
+          Readrig.image.ref = ciref;
+          Readrig.image.tag = DFTAG_CI8;
+          Readrig.descimage.compr.tag = DFTAG_RLE;
+        }   /* end else */
+
+      if (Hgetelement(file_id, DFTAG_ID8, Readrig.image.ref, R8tbuf) != FAIL)
+        {
+          uint8      *p;
+          uint16      uint16var;
+
+          p = R8tbuf;
+          UINT16DECODE(p, uint16var);
+          Readrig.descimage.xdim=(int32)uint16var;
+          UINT16DECODE(p, uint16var);
+          Readrig.descimage.ydim=(int32)uint16var;
+        }   /* end if */
+      else
+        HGOTO_ERROR(DFE_GETELEM, FAIL);
+
+      if (Hexist(file_id, DFTAG_IP8, Readrig.image.ref) != FAIL)
+        {
+          Readrig.lut.tag = DFTAG_IP8;
+          Readrig.lut.ref = Readrig.image.ref;
+        }   /* end if */
+    }     /* end if */
+  Lastref = Readrig.image.ref;    /* remember ref read */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end DFR8Iriginfo() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8Istart
+ PURPOSE
+    DFR8-level initialization routine
+ USAGE
+    intn DFR8Istart()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Register the shut-down routine (DFR8Pshutdown) for call with atexit
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn DFR8Istart(void)
+{
+    CONSTR(FUNC, "DFR8Istart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&DFR8Pshutdown) != 0)
+      HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return(ret_value);
+} /* end DFR8Istart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFR8Pshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn DFR8shutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the DFR8 routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn DFR8Pshutdown(void)
+{
+    if(paletteBuf!=NULL)
+      {
+          HDfree(paletteBuf);
+          paletteBuf=NULL;
+      } /* end if */
+    return(SUCCEED);
+} /* end DFR8Pshutdown() */
+
+
diff --git a/hdf/src/dfr8f.c b/hdf/src/dfr8f.c
new file mode 100644
index 0000000..aac7c82
--- /dev/null
+++ b/hdf/src/dfr8f.c
@@ -0,0 +1,431 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfr8f.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfr8F.c
+ * Purpose: C stubs for Fortran RIS routines
+ * Invokes: dfr8.c dfkit.c
+ * Contents:
+ *  d8spal:     Set palette to write out with subsequent images
+ *  d8first:    Call DFR8restart to reset sequencing to first image
+ *  d8igdim:    Call DFR8getdims to get dimensions of next image
+ *  d8igimg:    Call DFR8getimage to get next image
+ *  d8ipimg:    Call DFR8putimage to write image to new file
+ *  d8iaimg:    Call DFR8putimage to add image to existing file
+ *  d8irref:    Call DFR8readref to set ref to get next
+ *  d8iwref:    Call DFR8writeref to set ref to put next
+ *  d8inims:    Call DFR8nimages to get the number of images in the file
+ *  d8lref:     Call DFR8lastref to get ref of last image read/written
+ *  dfr8lastref:    Call DFR8lastref to get ref of last image read/written
+ *  dfr8setpalette: Set palette to write out with subsequent images
+ *  dfr8restart:    Call DFR8restart to reset sequencing to first image
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "hproto_fortran.h"
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8spal
+ * Purpose: Set palette to be written out with subsequent images
+ * Inputs:  pal: palette to associate with subsequent images
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8setpalette
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8spal(_fcd pal)
+{
+    return (DFR8setpalette((uint8 *) _fcdtocp(pal)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8first
+ * Purpose: Reset sequencing back to first image
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8restart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8first(void)
+{
+    return (DFR8restart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8igdim
+ * Purpose: Get dimensions of next image using DFR8getdims
+ * Inputs:  filename: name of HDF file
+ *          xdim, ydim - integers to return dimensions in
+ *          ispal - boolean to indicate whether the image includes a palette
+ *          lenfn - length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8getdims
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8igdim(_fcd filename, intf * xdim, intf * ydim, intf * ispal, intf * lenfn)
+{
+    char       *fn;
+    intf        ret;
+    int32	txdim, tydim;
+    intn	tispal;
+
+    fn = HDf2cstring(filename, (intn) *lenfn);
+    if (!fn)
+	return(-1);
+    ret = DFR8getdims(fn, &txdim, &tydim, &tispal);
+    if (ret != FAIL){
+	*xdim = txdim;
+	*ydim = tydim;
+	*ispal = tispal;
+    }
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8igimg
+ * Purpose: Get next image using DFR8getimage
+ * Inputs:  filename: name of HDF file
+ *          image: space provided for returning image
+ *          xdim, ydim: dimension of space provided for image
+ *          pal: space of 768 bytes for palette
+ *          lenfn: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8getimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8igimg(_fcd filename, _fcd image, intf * xdim, intf * ydim, _fcd pal, intf * lenfn)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *lenfn);
+    if (!fn)
+	return(-1);
+    ret = DFR8getimage(fn, (uint8 *) _fcdtocp(image), *xdim, *ydim,
+                       (uint8 *) _fcdtocp(pal));
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8ipimg
+ * Purpose: Write out image to new file
+ * Inputs:  filename: name of HDF file
+ *          image: image to write out
+ *          xdim, ydim: dimensions of image to write out
+ *          compress: compression scheme
+ *          lenfn: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8putimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8ipimg(_fcd filename, _fcd image, intf * xdim, intf * ydim, intf * compress,
+         intf * lenfn)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *lenfn);
+    if (!fn)
+	return(-1);
+    ret = (intf) DFR8putimage(fn, (VOIDP) _fcdtocp(image),
+                          (int32) *xdim, (int32) *ydim, (uint16) *compress);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8iaimg
+ * Purpose: Add image to existing file
+ * Inputs:  filename: name of HDF file
+ *          image: image to write out
+ *          xdim, ydim: dimensions of image to write out
+ *          compress: compression scheme
+ *          lenfn: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8addimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8iaimg(_fcd filename, _fcd image, intf * xdim, intf * ydim, intf * compress,
+         intf * lenfn)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *lenfn);
+    if (!fn)
+	return(-1);
+    ret = (intf) DFR8addimage(fn, (VOIDP) _fcdtocp(image),
+                          (int32) *xdim, (int32) *ydim, (uint16) *compress);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    D8irref
+ * Purpose: Set ref of image to get next
+ * Inputs:  filename: file to which this applies
+ *          ref: reference number of next get
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFR8Iopen, DFIfind
+ * Remarks: checks if image with this ref exists
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8irref(_fcd filename, intf * ref, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+    uint16      Ref;
+
+    Ref = (uint16) *ref;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+        return -1;
+    ret = DFR8readref(fn, Ref);
+    HDfree((VOIDP) fn);
+    return ret;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8iwref
+ * Purpose: Set ref of image to put next
+ * Inputs:  filename: file to which this applies
+ *          fnlen: length of the filename
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFR8writeref
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8iwref(_fcd filename, intf * ref, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+    uint16      Ref;
+
+    Ref = (uint16) *ref;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFR8writeref(fn, Ref);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8inims
+ * Purpose: How many images are present in this file?
+ * Inputs:  filename: file to which this applies
+ *          fnlen: length of HDF file name
+ * Returns: number of images on success, -1 on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFR8nimages
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8inims(_fcd filename, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFR8nimages(fn);
+    HDfree((VOIDP) fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8lref
+ * Purpose: return reference number of last element read or written
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8lastref
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8lref(void)
+{
+    return ((intf)DFR8lastref());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8scomp
+ * Purpose: set the compression to use when writing the next image
+ * Inputs:
+ *      scheme - the type of compression to use
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFR8setcompress
+ * Remarks: if the compression scheme is JPEG, this routine sets up default
+ *          JPEG parameters to use, if a user wants to change them, d8sjpeg
+ *          must be called.
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8scomp(intf * scheme)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    if (*scheme == COMP_JPEG)
+      {     /* check for JPEG compression and set defaults */
+          cinfo.jpeg.quality = 75;
+          cinfo.jpeg.force_baseline = 1;
+      }     /* end if */
+    return (DFR8setcompress((int32) *scheme, &cinfo));
+}   /* end d8scomp() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    d8sjpeg
+ * Purpose: change the JPEG compression parameters
+ * Inputs:
+ *      quality - what the JPEG quality rating should be
+ *      force_baseline - whether to force a JPEG baseline file to be written
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFR8setcompress
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nd8sjpeg(intf * quality, intf * force_baseline)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    cinfo.jpeg.quality = (intn) *quality;
+    cinfo.jpeg.force_baseline = (intn) *force_baseline;
+    return (DFR8setcompress((int32) COMP_JPEG, &cinfo));
+}   /* end d8sjpeg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfr8lastref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Returns: ref on success, -1 on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFR8lastref
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfr8lastref(void)
+{
+    return ((intf)DFR8lastref());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfr8setpalette
+ * Purpose: Set palette to be written out with subsequent images
+ * Inputs:  pal: palette to associate with subsequent images
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8setpalette
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfr8setpalette(_fcd pal)
+{
+
+    return (DFR8setpalette((uint8 *) _fcdtocp(pal)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfr8restart
+ * Purpose: Reset sequencing back to first image
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFR8restart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfr8restart(void)
+{
+
+    return (DFR8restart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfr8scompress
+ * Purpose: set the compression to use when writing the next image
+ * Inputs:
+ *      scheme - the type of compression to use
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFR8setcompress
+ * Remarks: if the compression scheme is JPEG, this routine sets up default
+ *          JPEG parameters to use, if a user wants to change them, dfr8setjpeg
+ *          must be called.
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfr8scompress(intf * scheme)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    if (*scheme == COMP_JPEG)
+      {     /* check for JPEG compression and set defaults */
+          cinfo.jpeg.quality = 75;
+          cinfo.jpeg.force_baseline = 1;
+      }     /* end if */
+    return (DFR8setcompress((int32) *scheme, &cinfo));
+}   /* end dfr8setcompress() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfr8sjpeg
+ * Purpose: change the JPEG compression parameters
+ * Inputs:
+ *      quality - what the JPEG quality rating should be
+ *      force_baseline - whether to force a JPEG baseline file to be written
+ * Returns: 0 on success, -1 for error
+ * Users:   HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: DFR8setcompress
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfr8sjpeg(intf * quality, intf * force_baseline)
+{
+    comp_info   cinfo;          /* Structure containing compression parameters */
+
+    cinfo.jpeg.quality = (intn) *quality;
+    cinfo.jpeg.force_baseline = (intn) *force_baseline;
+    return (DFR8setcompress((int32) COMP_JPEG, &cinfo));
+}   /* end dfr8setjpeg() */
diff --git a/hdf/src/dfr8ff.f b/hdf/src/dfr8ff.f
new file mode 100644
index 0000000..8d4a05c
--- /dev/null
+++ b/hdf/src/dfr8ff.f
@@ -0,0 +1,337 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: dfr8ff.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+C------------------------------------------------------------------------------
+C File:     dfr8Ff.f
+C Purpose:  Fortran stubs for Fortran RIS routines
+C Invokes:  dfr8F.c
+C Contents: 
+C   d8gdims       : call d8igdim to get dimensions of next image
+C   d8gimg        : call d8igimg to get next image
+C   d8pimg        : call d8ipimg to put image to new file
+C   d8aimg        : call d8iaimg to add image to existing file
+C   d8nims        : call d8inims to get number of images in the file
+C   d8wref        : call d8iwref to set ref for the next write of image
+C   d8rref        : call d8irref to set ref for the next read of image
+C   dfr8getdims   : call d8igdim to get dimensions of next image
+C   dfr8getimage  : call d8igimg to get next image
+C   dfr8putimage  : call d8ipimg to put image to new file
+C   dfr8addimage  : call d8iaimg to add image to existing file
+C   dfr8nimages   :  call d8inims to get the number of images in the file
+C   dfr8writeref  : call d8iwref to set ref for the next write of image
+C   dfr8readref   : call d8iref to set ref for the next read of image
+C -----------------------------------------------------------------------------
+
+C------------------------------------------------------------------------------
+C Name:     d8gdims
+C Purpose:  call d8igdim to get dimensions of next image
+C Inputs:   name: name of HDF file
+C           xdim, ydim: integers to return dimensions of image
+C           ispal: integer to return whether a palette is associated
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8igdim
+C------------------------------------------------------------------------------
+
+
+      integer function d8gdims(name, xdim, ydim, ispal)
+      character*(*) name
+      integer xdim, ydim, ispal, d8igdim
+
+      d8gdims = d8igdim(name, xdim, ydim, ispal, len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     d8gimg
+C Purpose:  call d8igimg to get next image
+C Inputs:   name: name of HDF file
+C           image: space to return image in
+C           xdim, ydim: dimensions of space to return image in
+C           pal: 768-byte space to return palette in
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8igimg
+C------------------------------------------------------------------------------
+
+
+      integer function d8gimg(name, image, xdim, ydim, pal)
+      character*(*) name
+      character image(*), pal(*)
+      integer xdim, ydim, d8igimg
+
+      d8gimg = d8igimg(name,image,xdim,ydim,pal,len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     d8pimg
+C Purpose:  call d8ipimg to write image to new file
+C Inputs:   name: name of HDF file
+C           image: space containing image
+C           xdim, ydim: dimensions of image
+C           compress: compression scheme to be used
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8ipimg
+C------------------------------------------------------------------------------
+
+
+      integer function d8pimg(name, image, xdim, ydim, compress)
+      character*(*) name
+      character image(*)
+      integer xdim, ydim, compress, d8ipimg
+
+      d8pimg=d8ipimg(name,image,xdim,ydim,compress,len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     d8aimg
+C Purpose:  call d8iaimg to add image to existing file
+C Inputs:   name: name of HDF file
+C           image: space containing image
+C           xdim, ydim: dimensions of image
+C           compress: compression scheme to be used
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8iaimg
+C------------------------------------------------------------------------------
+
+
+      integer function d8aimg(name, image, xdim, ydim, compress)
+      character*(*) name
+      character image(*)
+      integer xdim, ydim, compress, d8iaimg
+
+      d8aimg=d8iaimg(name,image,xdim,ydim,compress,len(name))
+      return
+      end
+
+C-----------------------------------------------------------------------------
+C  Name:    d8rref
+C  Purpose: Set ref of image to get next
+C  Inputs:  filename: file to which this applies
+C           ref: reference number of next get
+C  Returns: 0 on success, -1 on failure
+C  Users:   HDF programmers, other routines and utilities
+C  Invokes: d8irref
+C  Remarks: checks if image with this ref exists
+C-----------------------------------------------------------------------------
+
+      integer function d8rref(name, ref)
+      character*(*) name
+      integer ref
+      integer d8irref
+
+      d8rref = d8irref(name, ref, len(name))
+      return
+      end
+
+CEND7MAX
+
+
+C-----------------------------------------------------------------------
+C  Name:    d8nims
+C  Purpose:  How many images are present in this file
+C  Inputs:  filename: file to which this applies
+C  Returns: number of images on success, -1 on failure
+C  Users:   HDF programmers, other routines and utilities
+C  Invokes: d8inims
+C  Remarks:
+C-----------------------------------------------------------------------
+
+      integer function d8nims(filename)
+      character*(*) filename
+      integer d8inims
+
+      d8nims = d8inims(filename, len(filename))
+      return
+      end
+
+
+C-----------------------------------------------------------------------
+C  Name:    d8wref
+C  Purpose: Set ref of image to put next
+C  Inputs:  name: file to which this applies
+C           ref: reference number of next put
+C  Returns: 0 on success, -1 on failure
+C  Users:   HDF programmers, other routines and utilities
+C  Invokes: d8iwref
+C  Remarks: checks if image with this ref exists
+C-----------------------------------------------------------------------
+
+      integer function d8wref(name, ref)
+      character*(*) name
+      integer ref
+      integer  d8iwref
+
+      d8wref = d8iwref(name, ref, len(name))
+      return
+      end
+
+
+
+C------------------------------------------------------------------------------
+C Name:     dfr8getdims
+C Purpose:  call d8igdim to get dimensions of next image
+C Inputs:   name: name of HDF file
+C           xdim, ydim: integers to return dimensions of image
+C           ispal: integer to return whether a palette is associated
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8igdim
+C------------------------------------------------------------------------------
+
+
+      integer function dfr8getdims(name, xdim, ydim, ispal)
+      character*(*) name
+      integer xdim, ydim, ispal, d8igdim
+
+      dfr8getdims = d8igdim(name, xdim, ydim, ispal, len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfr8getimage
+C Purpose:  call d8igimg to get next image
+C Inputs:   name: name of HDF file
+C           image: space to return image in
+C           xdim, ydim: dimensions of space to return image in
+C           pal: 768-byte space to return palette in
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8igimg
+C------------------------------------------------------------------------------
+
+
+      integer function dfr8getimage(name, image, xdim, ydim, pal)
+      character*(*) name
+      character image(*), pal(*)
+      integer xdim, ydim, d8igimg
+
+      dfr8getimage = d8igimg(name,image,xdim,ydim,pal,len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfr8putimage
+C Purpose:  call d8ipimg to write image to new file
+C Inputs:   name: name of HDF file
+C           image: space containing image
+C           xdim, ydim: dimensions of image
+C           compress: compression scheme to be used
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8ipimg
+C------------------------------------------------------------------------------
+
+
+      integer function dfr8putimage(name, image, xdim, ydim, compress)
+      character*(*) name
+      character image(*)
+      integer xdim, ydim, compress, d8ipimg
+
+      dfr8putimage=d8ipimg(name,image,xdim,ydim,compress,len(name))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfr8addimage
+C Purpose:  call d8iaimg to add image to existing file
+C Inputs:   name: name of HDF file
+C           image: space containing image
+C           xdim, ydim: dimensions of image
+C           compress: compression scheme to be used
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  d8iaimg
+C------------------------------------------------------------------------------
+
+
+      integer function dfr8addimage(name, image, xdim, ydim, compress)
+      character*(*) name
+      character image(*)
+      integer xdim, ydim, compress, d8iaimg
+
+      dfr8addimage=d8iaimg(name,image,xdim,ydim,compress,len(name))
+      return
+      end
+
+
+C-----------------------------------------------------------------------------
+C  Name:    dfr8readref
+C  Purpose: Set ref of image to get next
+C  Inputs:  filename: file to which this applies
+C           ref: reference number of next get
+C  Returns: 0 on success, -1 on failure
+C  Users:   HDF programmers, other routines and utilities
+C  Invokes: d8irref
+C  Remarks: checks if image with this ref exists
+C-----------------------------------------------------------------------------
+
+      integer function dfr8readref(name, ref)
+      character*(*) name
+      integer ref
+      integer d8irref
+
+      dfr8readref = d8irref(name, ref, len(name))
+      return
+      end
+
+C-----------------------------------------------------------------------
+C  Name:    dfr8writeref
+C  Purpose: Set ref of image to put next
+C  Inputs:  filename: file to which this applies
+C           ref: reference number of next put
+C  Returns: 0 on success, -1 on failure
+C  Users:   HDF programmers, other routines and utilities
+C  Invokes: d8iwref
+C  Remarks: checks if image with this ref exists
+C-----------------------------------------------------------------------
+
+      integer function dfr8writeref(filename, ref)
+      character*(*) filename
+      integer ref
+      integer d8iwref
+
+      dfr8writeref = d8iwref(filename, ref, len(filename))
+      return
+      end
+
+
+C-----------------------------------------------------------------------
+C  Name:    dfr8nimages
+C  Purpose:  How many images are present in this file
+C  Inputs:  filename: file to which this applies
+C  Returns: number of images on success, -1 on failure
+C  Users:   HDF programmers, other routines and utilities
+C  Invokes: d8inims
+C  Remarks:
+C-----------------------------------------------------------------------
+
+      integer function dfr8nimages(filename)
+      character*(*) filename
+      integer d8inims
+
+      dfr8nimages = d8inims(filename, len(filename))
+      return
+      end
diff --git a/hdf/src/dfrig.h b/hdf/src/dfrig.h
new file mode 100644
index 0000000..88eebb7
--- /dev/null
+++ b/hdf/src/dfrig.h
@@ -0,0 +1,74 @@
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfrig.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfrig.h
+ * Purpose: header file for the Raster Image set
+ * Invokes: df.h
+ * Contents:
+ *  Structure definitions: DFRdr, DFRrig
+ * Remarks: This is included with user programs which use RIG
+ *---------------------------------------------------------------------------*/
+
+#ifndef DFRIG   /* avoid re-inclusion */
+#define DFRIG
+
+/* description record: used to describe image data, palette data etc. */
+typedef struct
+  {
+      int16       ncomponents;  /* Number of components */
+      int16       interlace;    /* data ordering: chunky / planar etc */
+      int32       xdim;         /* X-dimension of data */
+      int32       ydim;         /* Y-dimensionsof data */
+      DFdi        nt;           /* number type of data */
+      DFdi        compr;        /* compression */
+      /* ### Note: compression is currently uniquely described with a tag.
+         No data is attached to this tag/ref.  But this capability is
+         provided for future expansion, when this tag/ref might point to
+         some data needed for decompression, such as the actual encodings */
+  }
+DFRdr;
+
+/* structure to hold RIG info */
+typedef struct
+  {
+      char       *cf;           /* color format */
+      int32       xpos;         /* X position of image on screen */
+      int32       ypos;         /* Y position of image on screen */
+      float32     aspectratio;  /* ratio of pixel height to width */
+      float32     ccngamma;     /* gamma color correction parameters */
+      float32     ccnred[3];    /* red color correction parameters */
+      float32     ccngrren[3];  /* green color correction parameters */
+      float32     ccnblue[3];   /* blue color correction parameters */
+      float32     ccnwhite[3];  /* white color correction parameters */
+      DFdi        image;        /* image */
+      DFRdr       descimage;    /* image data description */
+      DFdi        lut;          /* color look-up table (palette) */
+      DFRdr       desclut;      /* look-up table description */
+      DFdi        mattechannel; /* matte? */
+      DFRdr       descmattechannel;     /* Description of matte? */
+  }
+DFRrig;
+
+/* dimensions of raster-8 image */
+typedef struct R8dim
+  {
+      uint16      xd;
+      uint16      yd;
+  }
+R8dim;
+
+#endif /*DFRIG */
diff --git a/hdf/src/dfrle.c b/hdf/src/dfrle.c
new file mode 100644
index 0000000..44e1181
--- /dev/null
+++ b/hdf/src/dfrle.c
@@ -0,0 +1,170 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfrle.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfrle.c
+ * Purpose: RLE image compression algorithm
+ * Invokes:
+ * Contents:
+ *  DFCIrle: compress string using run length encoding
+ *  DFCIunrle: decompress string using run length encoding
+ * Remarks: DFCIrle() and DFCIunrle() compress and decompress RLE encoded info
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFCIrle
+ * Purpose: compress a string of bytes
+ * Inputs:  buf: buffer containing data to be compressed
+ *          bufto: space for compressed data - assumed big enough
+ *          len: number of bytes to compress
+ * Returns: number of compressed bytes on success, -1 on failure
+ * Users:   HDF programmers, DFputcomp, other routines
+ * Invokes: none
+ * Remarks: Written for efficiency
+ *---------------------------------------------------------------------------*/
+
+int32
+DFCIrle(const void * buf, void * bufto, int32 len)
+{
+    const uint8 *p;
+    const uint8 *q;
+    uint8 *cfoll;
+    uint8 *clead;
+    const uint8 *begp;
+    int32       i;
+
+    p = buf;
+    cfoll = (uint8 *) bufto;    /* place to copy to */
+    clead = cfoll + 1;
+
+    begp = p;
+    while (len > 0)
+      {     /* encode stuff until gone */
+
+          q = p + 1;
+          i = len - 1;
+          while (i && i + 120 > len && *p == *q)
+            {
+                q++;
+                i--;
+            }
+
+          if (q - p > 2)
+            {   /* three in a row */
+                if (p > begp)
+                  {
+                      *cfoll = (uint8) (p - begp);
+                      cfoll = clead;
+                  }
+                *cfoll++ = (uint8) (128 | (uint8) (q - p));     /* len of seq */
+                *cfoll++ = *p;  /* char of seq */
+                len -= q - p;   /* subtract len of seq */
+                p = q;
+                clead = cfoll + 1;
+                begp = p;
+            }
+          else
+            {
+                *clead++ = *p++;    /* copy one char */
+                len--;
+                if (p - begp > 120)
+                  {
+                      *cfoll = (uint8) (p - begp);
+                      cfoll = clead++;
+                      begp = p;
+                  }
+            }
+
+      }
+/*
+ *  fill in last bytecount
+ */
+    if (p > begp)
+        *cfoll = (uint8) (p - begp);
+    else
+        clead--;    /* don't need count position */
+
+    return ((int32) ((uint8 *) clead - (uint8 *) bufto));   /* how many encoded */
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFCIunrle
+ * Purpose: decompress run length encoding
+ * Inputs:  buf: buffer containing compressed data
+ *          bufto: space for returning decompressed data
+ *          outlen: number of *decompressed* bytes desired.
+ *          resetsave: don't use any stored state info - used for fresh image
+ * Returns: number of compressed bytes used up on success, -1 on failure
+ * Users:   HDF programmers, DFgetcomp, other routines
+ * Invokes: none
+ * Remarks: has been modified so it will decompress even non-rowwise compression
+ *          Hence the static storage stuff
+ *---------------------------------------------------------------------------*/
+
+int32
+DFCIunrle(uint8 *buf, uint8 *bufto, int32 outlen, int resetsave)
+{
+    int cnt;
+    uint8 *p;
+    uint8 *q;
+    uint8      *endp;
+    static uint8 save[255], *savestart = NULL, *saveend = NULL;
+    /* save has a list of decompressed bytes not returned in
+       previous call.  savestart and saveend specify the position
+       at which this list starts and ends in the array save */
+
+    p = (uint8 *) buf;
+    endp = (uint8 *) bufto + outlen;
+    q = (uint8 *) bufto;
+    if (resetsave)
+        savestart = saveend = save;     /* forget saved state */
+    while ((saveend > savestart) && (q < endp))     /* copy saved stuff */
+        *q++ = *savestart++;
+    if (savestart >= saveend)
+        savestart = saveend = save;     /* all copied */
+    while (q < endp)
+      {
+          cnt = (int)*p++;   /* count field */
+          if (!(cnt & 128))
+            {   /* is set of uniques */
+                while (cnt--)
+                  {
+                      if (q < endp)
+                          *q++ = *p++;  /* copy unmodified */
+                      else
+                          *saveend++ = *p++;
+                  }
+            }
+          else
+            {
+                cnt &= 127;     /* strip high bit */
+                while (cnt--)
+                  {
+                      if (q < endp)
+                          *q++ = *p;    /* copy unmodified */
+                      else
+                          *saveend++ = *p;
+                  }
+                p++;    /* skip that character */
+            }
+      }
+    return ((int32) (p - buf));
+}
diff --git a/hdf/src/dfsd.c b/hdf/src/dfsd.c
new file mode 100644
index 0000000..5d27ff0
--- /dev/null
+++ b/hdf/src/dfsd.c
@@ -0,0 +1,5755 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6032 $";
+#endif
+
+/* $Id: dfsd.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+/*-----------------------------------------------------------------------------
+ File:  dfsd.c
+
+ Purpose:
+    Routines for input and output of numeric data group
+
+ Invokes:
+    df.c dfgroup.c dfkit.c dfi.h df.h dfsd.h
+
+ Public functions:
+    DFSDgetdims      - get rank and dim sizes
+    DFSDgetdatastrs  - get label, unit, format and coord system of data
+    DFSDgetdimstrs   - get label, unit and format for a dimension
+    DFSDgetdatalen   -
+    DFSDgetdimlen    -
+    DFSDgetdimscale  - get scale for a dimension
+    DFSDgetrange     - get max and min of data
+    DFSDgetdata      - get data values
+    DFSDgetNT        - get file number type for reading
+    DFSDpre32sdg     - tests, without calling DFSDsdginfo,  whether or
+                       not the SDG/ref written with 3.1
+    DFSDsetlengths   - set lengths of label, unit, format strings on gets
+    DFSDsetdims      - set rank and dim sizes
+    DFSDsetdatastrs  - set data label, unit, format and coord system
+    DFSDsetdimstrs   - set dim labels, units and formats
+    DFSDsetdimscale  - set scale for a dimension
+    DFSDsetrange     - set max and min of data
+    DFSDsetorder     - set array order to C or FORTRAN order
+    DFSDsetNT        - set number type to be written out
+    DFSDputdata      - output data, data info, and display info
+    DFSDrestart      - forget info about last file accessed - restart from
+                       beginning
+    DFSDndatasets    - return number of SDGs in file
+    DFSDclear        - forget all info set by DFSDset* routines
+    DFSDlastref      - get reference number of last SDG read or written
+    DFSDgetslice     - get part of the data, specified as a slice
+    DFSDstartslice   - set up to write SD
+    DFSDputslice     - write specified number of data items to file
+    DFSDendslice     - end of series of writes, write out SDG
+    DFSDwriteref     - set reference number to be used in next SDS write slab
+    DFSDsetfillvalue - set fill value to be used in next SDS written
+    DFSDgetfillvalue - return fill value from SDS that is about to be read
+    DFSDstartslab    - set up to write slabs
+    DFSDwriteslab    - write hyperslab of values
+    DFSDendslab      - end of series of hyperslab writes
+    DFSDreadslab     - get part of the data, specified as a slab
+
+Lower level functions:
+    DFSDgetsdg  - read SDG into struct
+    DFSDputsdg  - write SDG to file
+
+Private functions:
+    DFSDIopen      - open or reopen file
+    DFSDIsdginfo   - find next sdg in file
+    DFSDIisndg     - was currently read sdg written by HDF3.2
+    DFSDIrefresh   - get info of next sdg if necessary
+    DFSDIgetrrank  - get rank of the currently read sdg
+    DFSDIgetwrank  - get rank of the sdg to be written
+    DFSDIclear     - clear sdg data structure of all info
+    DFSDIgetdata   - read data from file
+    DFSDIputdata   - write data to file
+    DFSDIgetslice  - get slice
+    DFSDIputslice  - put slice
+    DFSDIendslice  -
+    DFSDIsetnsdg_t - set up nsdg table
+    DFSDInextnsdg  - get next nsdg from nsdg table
+    DFSDIgetndg    - read NDG into struct
+    DFSDIputndg    - write NDG to file
+
+Fortran stub functions:
+    dsisdas - set data label, unit, format and coord system
+    dsisdis - set dim labels, units and formats
+
+ Remarks:
+    These functions will be copied into dfsd.c after debugging.
+    This version assumes that all the values are floating point.
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfsd.h"
+
+/* MMM: make this definition correct and move to hfile.h, or wherever. */
+#define DF_NOFILE 0
+
+#define LABEL   0
+#define UNIT    1
+#define FORMAT  2
+#define COORDSYS 3
+
+#define NFGSDG_TYPE_SDG 0   /* a pure SDG  */
+#define NFGSDG_TYPE_NFG 1   /* a pure NDG  */
+#define NFGSDG_TYPE_SDGNDG 2    /* an SDG in NDG */
+
+/* Init NSDG table header      */
+PRIVATE DFnsdg_t_hdr *nsdghdr = NULL;
+
+/* initialize aid to -1 and numbertype to DFNT_NONE.   S. Xu    */
+PRIVATE DFSsdg Readsdg =        /* struct for reading */
+{
+    {(uint16) 0, (uint16) 0}, (intn) 0, NULL, NULL,
+    {NULL, NULL, NULL},
+    {NULL, NULL, NULL}, NULL,
+    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+    (int32) DFNT_NONE, DFNTF_NONE, (int32) -1, (int32) 0, (int32) 0,
+    (float64) 1.0, (float64) 0.0, (float64) 0.0, (float64) 0.0,
+    (int32) -1,
+    {0}, 0
+};
+
+PRIVATE DFSsdg Writesdg =       /* struct for writing */
+{
+    {(uint16) 0, (uint16) 0}, (intn) 0, NULL, NULL,
+    {NULL, NULL, NULL},
+    {NULL, NULL, NULL}, NULL,
+    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+    (int32) DFNT_NONE, DFNTF_NONE, (int32) -1, (int32) 0, (int32) 0,
+    (float64) 1.0, (float64) 0.0, (float64) 0.0, (float64) 0.0,
+    (int32) -1,
+    {0}, 0
+};
+
+PRIVATE uint16 Writeref = 0;    /* ref of next SDG/NDG to write to file */
+PRIVATE intn Newdata = (-1);    /* Values in Readsdg fresh? */
+                /* -1 : no descriptor read */
+                /* 1 : descriptor read */
+PRIVATE intn Nextsdg = 1;       /* Signal if DFSDgetdata should get the */
+                /* next SDG/NDG */
+PRIVATE int32 Sfile_id = DF_NOFILE;     /* pointer to file for slice writes */
+PRIVATE int32 *Sddims;          /*dims written so far in slice write */
+
+PRIVATE struct
+  {                             /* Indicators of status (s) of info:    */
+      intn        dims;         /* s = -1: there is no info in this category */
+      intn        nt;           /* s = 0: info was set, but not yet written */
+      intn        coordsys;     /* s > 0: info was set and written with ref no.s */
+      intn        luf[3];
+      intn        scales;
+      intn        maxmin;
+      intn        transpose;    /* It should be taken out!!!            !!!  */
+      intn        cal;
+      intn        fill_value;
+      intn        new_ndg;
+  }
+Ref =
+{
+    -1, -1, -1,
+    {
+        -1, -1, -1
+    }
+    ,-1, -1, -1, -1, -1, -1
+};
+
+PRIVATE intn Maxstrlen[4] =
+{DFS_MAXLEN, DFS_MAXLEN, DFS_MAXLEN, DFS_MAXLEN};
+PRIVATE intn Ismaxmin = 0;      /* is there a max/min value on read?  */
+PRIVATE intn FileTranspose = 0; /* is the data in column major order? */
+PRIVATE intn Fortorder = 0;     /* should data be written col major?  */
+PRIVATE intn IsCal = 0;         /* has calibration info been set?     */
+
+/* In ver. 3.2 numbertype and file number format (subclass) are included  */
+/* in DFSsdg, and  fileNTsize is local to functions .           */
+/* static int fileNT=DFNTF_IEEE,         default: all IEEE       */
+/*           fileNTsize=4,                       */
+/*           outNT=DFNTF_IEEE,           default output: IEEE */
+/*           outNTsize=4,                        */
+/*           userNT=DFNTF_IEEE ;         default */
+
+PRIVATE uint16 Readref = 0;     /* ref of next SDG/NDG to be read? */
+#if 0
+PRIVATE char Lastfile[DF_MAXFNLEN] = "";    /* last file opened */
+#endif
+PRIVATE char *Lastfile = NULL;
+PRIVATE uint16 Lastref = 0;     /* Last ref to be read/written? */
+PRIVATE DFdi lastnsdg;          /* last read nsdg in nsdg_t */
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+/* Private buffer */
+PRIVATE uint8 *ptbuf = NULL;
+
+/* Prototypes */
+static intn DFSDIsetnsdg_t(int32 file_id, DFnsdg_t_hdr * l_nsdghdr);
+static intn DFSDInextnsdg(DFnsdg_t_hdr * l_nsdghdr, DFdi * nsdg);
+static intn DFSDIgetndg(int32 file_id, uint16 tag, uint16 ref, DFSsdg * sdg);
+static intn DFSDIputndg(int32 file_id, uint16 ref, DFSsdg * sdg);
+static intn DFSDIstart(void);
+
+/*--------------------------------------------------------------------------
+ NAME
+       DFSDgetdims
+ USAGE
+       int DFSDgetdims(filename, prank, sizes, maxrank)
+       char  *filename;   IN:  Name of file with scientific data set
+       int   prank;       OUT: Number of dimensions
+       int32 sizes:       OUT: array for holding dimensions of data set in file.
+       int   maxrank:     IN:  size of array "dimsizes"
+
+ RETURNS
+       Returns SUCCED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Gets the number of dimensions(rank) and the sizes of the dimensions
+       (dimsizes) for the next data set in the file. The input argument
+       "maxrank" tells the size of the array that is allocated for storing
+       the "dimsizses" array. The value of rank cannot exceed the value of
+       "maxrank". The allocation of space for reading in the scientific
+       data set should correspond to the values read in by "DFSDgetdims".
+       The first value in the array "dimsizes" should equal the first
+       dimension of the array that is allocated to hold the data set; the
+       second value in "dimsizes" should equal the second dimension of the
+       data set, and so forth. "DFSDgetdims" opens and closes the file.
+
+--------------------------------------------------------------------------*/
+intn
+DFSDgetdims(const char *filename, intn *prank, int32 sizes[], intn maxrank)
+{
+  intn        i;
+  int32       file_id;
+  CONSTR(FUNC, "DFSDgetdims");
+  intn       ret_value = SUCCEED;
+
+  HEclear();  /* Clear error stack */
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!prank)     /* check if ptr is valid */
+    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+  file_id = DFSDIopen(filename, DFACC_READ);  /* open/reopen file */
+  if (file_id == FAIL)
+    {
+      ret_value = FAIL;
+      goto done;
+    }
+
+  if (DFSDIsdginfo(file_id) < 0)
+    {     /* reads next SDG from file */
+      Hclose(file_id);
+      ret_value = FAIL;  /* on error, close file and return */
+      goto done;
+    }
+
+  *prank = Readsdg.rank;  /* copy rank, dimensions */
+  if (maxrank < *prank)   /* if not all dimensions copied */
+    HGOTO_ERROR(DFE_NOTENOUGH, FAIL);
+
+  for (i = 0; i < *prank; i++)    /* copy dimensions */
+    sizes[i] = Readsdg.dimsizes[i];
+  Nextsdg = 0;
+
+  ret_value = Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+       DFSDgetdatastrs
+ USAGE
+       int DFSDgetdatastrs(label, unit, format, coordsys)
+       char *label;    OUT: label string that describes the data
+       char *unit;     OUT: unit string that describes the unit used
+       char *format;   OUT: format string that describes the format for
+                            displaying the data
+       char *coordsys; OUT: string describing coordinate system
+ RETURN
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Retrieves information about the data from its associated attribute
+       strings. Particularly, it reads the label, unit and format strings
+       for the data. The parameter "coordsys" gives the coordinate system
+       that is to be used for interpreting the dimension information.
+
+----------------------------------------------------------------------------*/
+intn
+DFSDgetdatastrs(char *label, char *unit, char *format, char *coordsys)
+{
+  int32       luf;
+  char       *lufp;
+  CONSTR(FUNC, "DFSDgetdatastrs");
+  intn        ret_value = SUCCEED;
+
+  HEclear();  /* Clear error stack */
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+/* NOTE: Once DFSDsetdatastrs is changed to always write all three (label,
+   unit and format) whenever it is called, this routine should be
+   changed so that it returns all three, if any exist.  This means
+   that it also should be changed to return -1 if none exist.
+   (Currently it returns FAIL only if the SDS doesn't exist.)
+   */
+
+    /* copy label, unit, format */
+  for (luf = LABEL; luf <= FORMAT; luf++)
+    {
+      lufp = (luf == LABEL) ? label : (luf == UNIT) ? unit : format;
+      if (lufp)
+        {
+          if (Readsdg.dataluf[luf])
+            HIstrncpy(lufp, Readsdg.dataluf[luf], Maxstrlen[luf]);
+        }
+    }     /* end for 'luf' */
+  /* copy coordsys */
+  if (coordsys)
+    {
+      if (Readsdg.coordsys)
+        HIstrncpy(coordsys, Readsdg.coordsys, Maxstrlen[COORDSYS]);
+      else
+        coordsys[0] = '\0';
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ NAME
+       DFSDgetdimstrs
+ USAGE
+       int DFSDgetdimstrs(dim, label, unit, format)
+       int  dim;      OUT: Dimension this label, unit and format refer to
+       char *label;   OUT: Label that describes this dimension
+       char *unit;    OUT: Unit to be used with this dimension
+       char *format;  OUT: Format to be used in displaying scale for this
+                           dimension
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Gets the labe, unit and format strings corresponding to the specified
+       dimension. The space allocated for the label, unit and format string
+       must be at least 1 byte larger than the length of the string. If the
+       length is unknown when the program is written, declare the array size
+       as 1+maxlen_label, _unit or _format after they are set by "DFSDsetlengths".
+       The maximum default string length is 255.
+----------------------------------------------------------------------------*/
+intn
+DFSDgetdimstrs(int dim, char *label, char *unit, char *format)
+{
+  intn        luf;
+  intn        rdim;
+  char       *lufp;
+  CONSTR(FUNC, "DFSDgetdimstrs");
+  intn        ret_value = SUCCEED;
+
+  HEclear();  /* Clear error stack */
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+/* NOTE: Once DFSDsetdimstrs is changed to always write all three (label,
+   unit and format) whenever it is called, this routine should be
+   changed so that it returns all three, if any exist.  This means
+   that it also should be changed to return -1 if none exist.
+   (Currently it returns FAIL only if the SDS doesn't exist.)
+   */
+
+  rdim = dim - 1;     /* translate dim to zero origin */
+  if ((rdim >= Readsdg.rank) || (rdim < 0))
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+    /* copy labels etc */
+  for (luf = LABEL; luf <= FORMAT; luf++)
+    {
+      lufp = (luf == LABEL) ? label : (luf == UNIT) ? unit : format;
+      if (lufp)
+        {
+          if (!Readsdg.dimluf)
+            {     /* no labels etc */
+              *lufp = '\0';
+              continue;
+            }
+          if (Readsdg.dimluf[luf])
+            HIstrncpy(lufp, Readsdg.dimluf[luf][rdim], Maxstrlen[luf]);
+        }   /* end if 'lufp' */
+    }     /* end for 'luf' */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+       DFSDgetdatalen
+ USAGE
+       int DFSDgetdatalen(llabel, lunit, lformat, lcoordsys)
+       int *llabel;     OUT: length of label string
+       int *lunit;      OUT: length of unit string
+       int *lformat;    OUT: length of format string
+       int *lcoordsys;  OUT: length of coordsys string
+
+ RETURN
+       Returns SUCCED(0) if succesful and FAIL(-1) otherwise
+ DESCRIPTION
+       Gets actual length of label, unit, format and coordinate system
+       strings. The space allocated for the label, unit, format and
+       coordinate system strings must be at least 1 byte larger than the
+       actual length of the string.
+
+----------------------------------------------------------------------------*/
+intn
+DFSDgetdatalen(intn *llabel, intn *lunit, intn *lformat, intn *lcoordsys)
+{
+  CONSTR(FUNC, "DFSDgetdatalen");
+  intn      ret_value = SUCCEED;
+
+  HEclear();  /* Clear error stack */
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  *llabel = (intn)(Readsdg.dataluf[LABEL] ?  HDstrlen(Readsdg.dataluf[LABEL]) : 0);
+  *lunit = (intn)(Readsdg.dataluf[UNIT] ?  HDstrlen(Readsdg.dataluf[UNIT]) : 0);
+  *lformat = (intn)(Readsdg.dataluf[FORMAT] ?  HDstrlen(Readsdg.dataluf[FORMAT]) : 0);
+  *lcoordsys = (intn)(Readsdg.coordsys ?  HDstrlen(Readsdg.coordsys) : 0);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+       DFSDgetdimlen
+ USAGE
+       int DFSDgetdimlen(dim, llabel, lunit, lformat)
+       int dim;       OUT: number of dimensions to get info about
+       int *llabel;   OUT: length of label string
+       int *lunit;    OUT: length of unit string
+       int *lformat;  OUT: length of format string
+ RETURN
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Get the length of label, unit, and format for the specified
+       dimension. The space allocated to hold the label, unit, and format
+       strings must be at least 1 byte larger than the actual length of the
+       string.
+----------------------------------------------------------------------------*/
+intn
+DFSDgetdimlen(intn dim, intn *llabel, intn *lunit, intn *lformat)
+{
+  CONSTR(FUNC, "DFSDgetdimlen");
+  intn ret_value = SUCCEED;
+
+  HEclear();  /* Clear error stack */
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  if (dim > Readsdg.rank)
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+  *llabel = (intn)(Readsdg.dimluf[LABEL][dim - 1] ?  HDstrlen(Readsdg.dimluf[LABEL][dim - 1]) : 0);
+  *lunit = (intn)(Readsdg.dimluf[UNIT][dim - 1] ?  HDstrlen(Readsdg.dimluf[UNIT][dim - 1]) : 0);
+  *lformat = (intn)(Readsdg.dimluf[FORMAT][dim - 1] ?  HDstrlen(Readsdg.dimluf[FORMAT][dim - 1]) : 0);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ NAME
+       DFSDgetdimscale
+ USAGE
+       int DFSDgetdimscale(dim, maxsize, scale)
+       int   dim;      IN: Dimension this scale corresponds to
+       int32 size;     IN:  size of scale
+       VOIDP scale;    OUT: the scale
+ RETURN
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Gets the scale corresponding to the specified demension. The DFSD
+       interface in HDFv3.3 requires that the dimension scales are of the
+       same number type as the corresponding data. To store dimension scales
+       of a different number type than the corresponding data see the
+       multi-file SD interface.
+---------------------------------------------------------------------------*/
+intn
+DFSDgetdimscale(intn dim, int32 maxsize, VOIDP scale)
+{
+  uint32      dimsize;
+  int32       numtype;
+  int32       localNTsize;
+  intn        rdim;
+  uint8      *p1, *p2;
+  CONSTR(FUNC, "DFSDgetdimscale");
+  intn       ret_value = SUCCEED;
+
+  HEclear();  /* Clear error stack */
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  rdim = dim - 1;     /* translate dim to zero origin */
+  if ((rdim >= Readsdg.rank) || (rdim < 0))
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+  if (maxsize < Readsdg.dimsizes[rdim])
+    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+  if (!scale)
+    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+  if (!Readsdg.dimscales || !Readsdg.dimscales[rdim])     /* no scale */
+    HGOTO_ERROR(DFE_NOVALS, FAIL);
+
+    /* get number type and copy data from Readsdg to scale */
+  if (Readsdg.numbertype == DFNT_NONE)
+    Readsdg.numbertype = DFNT_FLOAT32;
+
+  numtype = Readsdg.numbertype;
+  localNTsize = DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+  dimsize = (uint32)localNTsize * (uint32)Readsdg.dimsizes[rdim];     /* in bytes  */
+
+  p1 = (uint8 *) scale;
+  p2 = (uint8 *) (Readsdg.dimscales[rdim]);
+  HDmemcpy(p1, p2, dimsize);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+       DFSDgetrange
+ USAGE
+       int DFSDgetrange(max, min)
+       VOIDP max;    OUT: High value stored with the scientific data set
+       VOIDP min;    OUT: Low value stored with the scientific data set
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Gets the maximum and minimum values stored with the scientific data
+       set. The "max" and "min" values are set by "DFSDsetrange". They are
+       not automatically stored when a data set is written to a file.
+       Since these values are supposed to relate to the data itself, it is
+       assumed that they are of the same number type as the data itself.
+       One implication of this is that in the C version of "DFSDgetrange"
+       the arguments are pointers, rather than simple variables, whereas in
+       the FORTRAN version they are simple variables of the same type as the
+       data array. Neither "DFSDgetrange" or "DFSDgetdata" compare the "max"
+       and "min" values stored with the data set to the actual values in
+       the data set; they merely retrieve the data. As a result, the
+       maximum and minimum values may not always reflect the actual maximum
+       and minimum vlaues in the data set. In some cases the "max" and "min"
+       values may actually lie outside the range of values in the data set.
+---------------------------------------------------------------------------*/
+int
+DFSDgetrange(VOIDP pmax, VOIDP pmin)
+{
+  int32       numtype;
+  uint32      localNTsize;
+  uint8      *p1, *p2;
+  CONSTR(FUNC, "DFSDgetrange");
+  int         ret_value = SUCCEED;
+
+  HEclear();  /* Clear error stack */
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+    /* get number type and copy data  */
+  if (Readsdg.numbertype == DFNT_NONE)
+    Readsdg.numbertype = DFNT_FLOAT32;
+  numtype = Readsdg.numbertype;
+  localNTsize = (uint32)DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+
+  if (Ismaxmin)   /* Ismaxmin is a global */
+    {
+      p1 = (uint8 *) pmax;
+      p2 = (uint8 *) &(Readsdg.max_min[0]);
+      HDmemcpy(p1, p2, localNTsize);
+      p1 = (uint8 *) pmin;
+      p2 = &(Readsdg.max_min[localNTsize]);
+      HDmemcpy(p1, p2, localNTsize);
+      ret_value = SUCCEED;
+      goto done;
+    }
+  else
+    HGOTO_ERROR(DFE_NOVALS, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+      DFSDgetdata
+ USAGE
+      intn DFSDgetdata(filename, rank, maxsizes, data)
+      char  filename;    IN:  name of HDF file containing scientific data set
+      intn  rank;        IN:  number of dimensions of array "data"
+      int32 maxsizes;    IN:  Array that holds dimensions of buffer that will
+                              hold the data
+      VOIDP data;        OUT: Array for holding the data
+
+ RETURN
+       Returns SUCCEED(0) if succesful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Reads the next data set in the file. If you do no know the values of
+       "rank" or "dimsizes", you must call "DFSDgetdims" to get them and
+       then use them to provide the right amount of space for the array
+       "data". If you do not know the number type of the data in the
+       scientific dat set, you can call "DFSDgetNT" to find out.
+       Subsequent calls to "DFSDgetdata"(or to "DFSDgetdims" and "DFSDgetdata")
+       will sequentially read scientific data sets from the file. For example,
+       if "DFSDgetdata" is called three times in succession, the third call
+       reads data from the third scientific data set in the file. Note that
+       if you do no know the values of "rank" or "dimsizes" you must call
+       "DFSDgetdims" to get them each time and then provide the necessary
+       space to hold the data. If "DFSDgetdims" or "DFSDgetdata" is called
+       and there are no more scientific data sets left in the file, an
+       error code is returned and nothing is read. "DFSDrestart" can be
+       used to override this convention.
+
+---------------------------------------------------------------------------*/
+intn
+DFSDgetdata(const char *filename, intn rank, int32 maxsizes[], VOIDP data)
+{
+  intn ret_value;
+
+  ret_value = (DFSDIgetdata(filename, rank, maxsizes, data, 0));   /* 0 == C */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetlengths
+ USAGE
+       int DFSDsetlengths(maxlen_label, maxlen_unit, maxlen_format, maxlen_coordsys)
+       int maxlen_label;     IN: maximum length of any label
+       int maxlen_unit;      IN: maximum length of any unit
+       int maxlen_format;    IN: maximum length of any format
+       int maxlen_coordsys;  IN: maximum length of any coordsys
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the maximum lengths for the strings that will hold labels, units
+       formats and the name of the coordinate system. These lengths are used
+       by the routines "DFSDgetdimstrs" and "DFSDgetdatastrs" to determine
+       the maximum lengths of strings that they get from the HDF file.
+       Normally, "DFSDsetlengths" is not needed. If it is not called,
+       default maximum lengths of 255 are used for all strings.
+-----------------------------------------------------------------------------*/
+intn
+DFSDsetlengths(intn maxlen_label, intn maxlen_unit, intn maxlen_format,
+               intn maxlen_coordsys)
+{
+  CONSTR(FUNC, "DFSDsetlengths");
+  intn ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (maxlen_label > 0)
+    Maxstrlen[LABEL] = maxlen_label;
+  if (maxlen_unit > 0)
+    Maxstrlen[UNIT] = maxlen_unit;
+  if (maxlen_format > 0)
+    Maxstrlen[FORMAT] = maxlen_format;
+  if (maxlen_coordsys > 0)
+    Maxstrlen[COORDSYS] = maxlen_coordsys;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetdims
+ USAGE
+       int DFSDsetdims(rank, dimsizes)
+       int   rank;         IN: number of dimensions
+       int32 dimsizes[];   IN: array containing dimensions of scientific data sett
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the rank and dimension sizes for all subsequent scientific data
+       sets written to the file. This routine must be called before calling
+       either "DFSDgetdimstrs" or "DFSDsetdimscale". "DFSDsetdims" need not
+       be called if other set routines are not called and the correct
+       dimensions are supplied in "DFSDputdata" or "DFSDadddata". If the
+       rank or dimension sizes change, all previous set calls are cleared,
+       except for the number type which is set by calling "DFSDsetNT".
+-----------------------------------------------------------------------------*/
+intn
+DFSDsetdims(intn rank, int32 dimsizes[])
+{
+  intn        i;
+  CONSTR(FUNC, "DFSDsetdims");
+  intn     ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Sfile_id != DF_NOFILE)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  if (Writesdg.rank == rank)  /* check if dimensions same */
+    {
+      if (Writesdg.dimsizes)
+        {
+          for (i = 0; i < rank; i++)
+            {
+              if (Writesdg.dimsizes[i] != dimsizes[i])
+                break;
+            }
+          if (i == rank)
+            {
+              ret_value= SUCCEED;     /* Dimensions same as before */
+              goto done;
+            }
+        }
+    }
+
+  /* forget all attributes set previously */
+  if (DFSDIclear((DFSsdg *) & Writesdg) < 0)
+    {
+      ret_value = FAIL;
+      goto done;
+    }
+
+  /* allocate dimensions */
+  Writesdg.dimsizes = (int32 *) HDmalloc((size_t)rank * sizeof(int32));
+  if (Writesdg.dimsizes == NULL)
+    {
+      ret_value = FAIL;
+      goto done;
+    }
+
+  /* copy dimensions */
+  Writesdg.rank = rank;
+  for (i = 0; i < rank; i++)
+    Writesdg.dimsizes[i] = dimsizes[i];
+
+    /* Note dimensions modified */
+  Ref.dims = 0;
+
+  /*
+   *  Added side effect, allows creation of new "ref" whenever called
+   *  before DFSDwriteslab().
+   */
+  Ref.new_ndg = 0;
+  Writeref = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetdatastrs
+ USAGE
+       int DFSDsetdatastrs(label, unit, format, coordsys)
+       char *label;       IN: label that describes the data
+       char *unit;        IN: unit to be used with the data
+       char *format;      IN: format to be used in displaying the data
+       char *coordsys;    IN: coordinate system
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the label, unit, format and coordsys(coordinate system) strings
+       to be assigned to the next data set written to the file.
+-----------------------------------------------------------------------------*/
+intn
+DFSDsetdatastrs(const char *label, const char *unit, const char *format, const char *coordsys)
+{
+  intn ret_value;
+
+  ret_value = (DFSDIsetdatastrs(label, unit, format, coordsys));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIsetdatastrs()
+ * Purpose: Set label, unit and format for displaying subsequent SDGs
+ * Inputs:  label: label to be used to describe data
+ *          unit: unit corresponding to data values
+ *          format: format to be used in displaying data values
+ *          coordsys: type of coordinate system
+ * Globals: Writesdg, Ref
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: none
+ * Method:  Stores values in global structure Writesdg
+ * Remarks: should we validate coordsys? proposed strings: "cartesian",
+ *          "polar" (="spherical") and "cylindrical".  Do "spherical" and
+ *          "cylindrical" make sense for 2D?
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIsetdatastrs(const char *label, const char *unit, const char *format, const char *coordsys)
+{
+  intn        luf;            /* takes values LABEL, UNIT, FORMAT */
+                                /* in succession */
+  const char *lufp;           /* points to label, unit, format */
+                                /* in succession */
+  CONSTR(FUNC, "DFSDIsetdatastrs");    /* for HERROR */
+  intn      ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+   /* NOTE: The following code should be changed to write all three, even if
+      one or more is an empty string.  Then, when DFSDgetdatastrs is called
+      values will be returned for all three also, even though some might
+      be empty strings.
+    */
+  for (luf = LABEL; luf <= FORMAT; luf++)
+    {
+      /* set lufp to point to label etc. as apppropriate */
+      lufp = (luf == LABEL) ? label : (luf == UNIT) ? unit : format;
+
+          /* free space if allocated */
+      HDfreenclear(Writesdg.dataluf[luf]);
+
+      /* copy string */
+      if (lufp)
+        {
+          Writesdg.dataluf[luf] = (char *) HDstrdup(lufp);
+          if (Writesdg.dataluf[luf] == NULL)
+            {
+              ret_value= FAIL;
+              goto done;
+            }
+        }
+    }
+
+  HDfreenclear(Writesdg.coordsys);
+
+  if (coordsys)
+    {
+      Writesdg.coordsys = (char *) HDstrdup(coordsys);
+      if (Writesdg.coordsys == NULL)
+        {
+          ret_value = FAIL;
+          goto done;
+        }
+    }
+
+  /* indicate that label, unit, format and coordsys info modified */
+  Ref.luf[LABEL] = Ref.luf[UNIT] = Ref.luf[FORMAT] = Ref.coordsys = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetdimstrs()
+ USAGE
+       int  DFSDsetdimstrs(dim, label, unit, format)
+       int  dim;        IN: dimension this label, unit and format refer to
+       char *label;     IN: label that describes this dimension
+       char *unit;      IN: unit to be used with this dimension
+       char *format;    IN: format to be used to display scale
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the label, unit, and format strings corresponding to the specified
+       dimension. In both FORTRAN and C programs, dim=1 for the first
+       dimension, and dim=2 for the second and so on. If the user is not
+       interested in one or more strings, empty strings can be used as
+       parameters for the "DFSDsetdimstrs" call. For example,
+       "DFSDsetdimstrs(1, "vertical", "", "") " will set the label for the
+       first dimension to "vertical" and set the unit and format strings to
+       empty strings.
+-----------------------------------------------------------------------------*/
+intn
+DFSDsetdimstrs(intn dim, const char *label, const char *unit, const char *format)
+{
+  intn ret_value;
+
+  ret_value = (DFSDIsetdimstrs(dim, label, unit, format));
+
+  return ret_value;
+}   /* DFSDsetdimstrs */
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIsetdimstrs()
+ * Purpose: For the given dimension, set label, unit, format
+ *          This routine needs to be called once for each dimension whose
+ *          values the user wants to set.
+ * Inputs:  dim: the dimension that this info applies to
+ *          label: label to be used to describe this dimension
+ *          unit: units for dimension
+ *          format: format to be used in displaying
+ * Globals: Writesdg, Ref
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: none
+ * Method:  Stores values in global structure Writesdg
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIsetdimstrs(intn dim, const char *label, const char *unit, const char *format)
+{
+  intn        i;
+  intn        rdim;
+  intn        luf;            /* takes values LABEL, UNIT, FORMAT */
+                                /* in succession */
+  const char *lufp;           /* points to label, unit, format */
+                                /* in succession */
+  CONSTR(FUNC, "DFSDsetdimstrs");
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* translate from 1 to 0 origin */
+  rdim = dim - 1;
+
+  if ((rdim >= Writesdg.rank) || (rdim < 0))
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+  for (luf = LABEL; luf <= FORMAT; luf++)
+    {
+      /* set lufp to point to label etc. as apppropriate */
+      lufp = (luf == LABEL) ? label : (luf == UNIT) ? unit : format;
+
+      /* allocate space if necessary */
+      if (!Writesdg.dimluf[luf])
+        {
+          Writesdg.dimluf[luf] =
+            (char **) HDmalloc((uint32) Writesdg.rank * sizeof(char *));
+          if (Writesdg.dimluf[luf] == NULL)
+            {
+              ret_value = FAIL;
+              goto done;
+            }
+          for (i = 0; i < Writesdg.rank; i++)     /* set allocated pointers to NULL */
+            Writesdg.dimluf[luf][i] = NULL;
+        }
+
+      /* free string space if allocated */
+      HDfreenclear(Writesdg.dimluf[luf][rdim]);
+
+      /* NOTE: The following code should be changed to write all three, even if
+             one or more is an empty string.  Then, when DFSDgetdimstrs is called
+             values will be returned for all three also, even though some might
+             be empty strings.
+      */
+      /* copy string */
+      if (lufp)
+        {
+          Writesdg.dimluf[luf][rdim] = (char *) HDstrdup(lufp);
+          if (Writesdg.dimluf[luf][rdim] == NULL)
+            {
+              ret_value = FAIL;
+              goto done;
+            }
+        }
+    }
+  /* Indicate that this info has not been written to file */
+  Ref.luf[LABEL] = Ref.luf[UNIT] = Ref.luf[FORMAT] = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetdimscale
+ USAGE
+       int DFSDsetdimscale(dim, dimsize, scale)
+       int   dim;        IN: dimension the is scale corresponds to
+       int32 dimsize;    IN: size of scale in the dimension
+       VOID  *scale;     IN: the scale
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the scale for a dimension. A scale is a 1D array whose value
+       describes reference points along one of the dimensions of the
+       scientific data set. For example, a 2D scientific data set representing
+       points on a mpa could have two scales, one representing points of
+       latitude, and the other points of longitude.
+-----------------------------------------------------------------------------*/
+intn
+DFSDsetdimscale(intn dim, int32 dimsize, VOIDP scale)
+{
+    int32       i;
+    intn        rdim;
+    int32       numtype;
+    uint32      bytesize;
+    int32       localNTsize;
+    uint8      *p1, *p2;
+    intn        ret_value = SUCCEED;
+    CONSTR(FUNC, "DFSDsetdimscale");
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    rdim = dim - 1;     /* translate from 1 to 0 origin */
+
+    if (!Writesdg.dimsizes)
+        HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+    if (Writesdg.numbertype == DFNT_NONE)
+      {
+          if (DFSDsetNT(DFNT_FLOAT32) < 0)
+            {
+              ret_value = FAIL;
+              goto done;
+            }
+      }
+    numtype = Writesdg.numbertype;
+    localNTsize = DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+
+    if ((rdim >= Writesdg.rank) || (rdim < 0)   /* check dimensions */
+        || (dimsize != Writesdg.dimsizes[rdim]))
+      {
+          HGOTO_ERROR(DFE_BADDIM, FAIL);
+      }
+
+    if (!scale)
+      {     /* No scale for this dimension */
+          if (Writesdg.dimscales)
+              HDfreenclear(Writesdg.dimscales[rdim]);
+          Ref.scales = 0;
+          ret_value = SUCCEED;
+          goto done;
+      }
+
+    /* get number type and size of this type in this machine  */
+    if (Writesdg.numbertype == DFNT_NONE)
+      {
+          if (DFSDsetNT(DFNT_FLOAT32) < 0)
+            {
+              ret_value = FAIL;
+              goto done;
+            }
+      }
+    numtype = Writesdg.numbertype;
+    localNTsize = DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+    bytesize = (uint32)(dimsize * localNTsize);
+
+    /* allocate space for dimscales if necessary */
+    if (!Writesdg.dimscales)
+      {
+          Writesdg.dimscales =
+              (uint8 **) HDmalloc((uint32) Writesdg.rank * sizeof(int8 *));
+          if (Writesdg.dimscales == NULL)
+            {
+              ret_value = FAIL;
+              goto done;
+            }
+          for (i = 0; i < Writesdg.rank; i++)   /* set allocated pointers to NULL */
+              Writesdg.dimscales[i] = NULL;
+      }
+
+    if (!Writesdg.dimscales[rdim])
+      {
+          /* allocate dimension scale space if necessary */
+          Writesdg.dimscales[rdim] =
+              (uint8 *) HDmalloc((uint32) bytesize);
+          if (Writesdg.dimscales[rdim] == NULL)
+            {
+              ret_value = FAIL;
+              goto done;
+            }
+      }
+
+    /* copy scale */
+    p1 = (uint8 *) scale;
+    p2 = (uint8 *) Writesdg.dimscales[rdim];
+    HDmemcpy(p2, p1, bytesize);
+
+    /* Indicate scales modified */
+    Ref.scales = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetrange
+ USAGE
+       int DFSDsetrange(max, min)
+       VOIDP max;    IN: High value in the scientific data set
+       VOIDP min;    IN: Low value in the scientific data set
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the maximum and minimum values to be stored with the scientific
+       data set. Since these values are supposed to relate to the data itself,
+       it is assumed that they are of the same number type as the data itself.
+       One implication of this is that in the C version of "DFSDgetrange"
+       the arguments are pointers, rather than simple variables, whereas in
+       the FORTRAN version they are simple variables of the same type as the
+       data array. This routine does not compute the maximum and minimum values;
+       it merely stores the values it is given. As a result, the
+       maximum and minimum values may not always reflect the actual maximum
+       and minimum vlaues in the data set. When the maximum and minimum
+       values are written to a file, the HDF elemement that hold these value
+       is cleared, because it is assumed that subsequent data sets will have
+       different values for "max" and "min". These values are automatically
+       cleared aftera a call to either "DFSDputdata" or "DFSDaddadata".
+-----------------------------------------------------------------------------*/
+intn
+DFSDsetrange(VOIDP maxi, VOIDP mini)
+{
+    int32       numtype;
+    uint32      localNTsize;
+    intn        i;
+    uint8      *p1, *p2;
+    intn        ret_value = SUCCEED;
+    CONSTR(FUNC, "DFSDsetrange");    /* for HERROR */
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    p1 = &(Writesdg.max_min[0]);
+    for (i = 0; i < 16; i++)
+        *p1++ = 0;  /* clear max_min   */
+
+    /* get number type and copy the values to Writesdg   */
+    if (Writesdg.numbertype == DFNT_NONE)
+        DFSDsetNT(DFNT_FLOAT32);
+
+    numtype = Writesdg.numbertype;
+    localNTsize = (uint32)DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+    p1 = (uint8 *) maxi;
+    p2 = (uint8 *) mini;
+
+    HDmemcpy((uint8 *) &(Writesdg.max_min[0]), p1, localNTsize);
+    HDmemcpy((uint8 *) &(Writesdg.max_min[localNTsize]), p2, localNTsize);
+
+    Ref.maxmin = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDputdata
+ USAGE
+       intn DFSDputdata(filename, rank, dimsizes, data)
+       char  *filename;     IN: name of file to store scientific data set in
+       int   rank;          IN: number of dimensions of data array to be stored
+       int32 dimsizes[];    IN: array that holds sizes of dimensions
+       VOID  *data;         IN: array holding data to be stored
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Writes scientific data and related information to an HDF file.
+       If a new filename is used, "DFSDputdata" functions exactly like
+       "DFSDadddata".
+ WARNING
+       "DFSDputdata" will write data to an existing file by destroying the
+       contents of the original file. Use with caution.
+-----------------------------------------------------------------------------*/
+
+intn
+DFSDputdata(const char *filename, intn rank, int32 dimsizes[], VOIDP data)
+{
+  intn ret_value;
+
+  /* 0, 0 specify create mode, C style array (row major) */
+  ret_value = (DFSDIputdata(filename, rank, dimsizes, data, 0, 0));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+NAME
+      DFSDadddata
+USAGE
+      intn DFSDadddata(filename, rank, dimsizes, data)
+      char  *filename;    IN: Name of HDF file to store the data set
+      intn  rank;         IN: Number of dimensions in the data array to be written
+      int32 dimsizes[];   IN: Array holding the size of each dimension
+      VOIDP data;         IN: Array holding the data to be stored
+
+RETURNS
+      SUCCEED(0) if successful and FAIL(-1) otherwise.
+
+DESCRIPTION
+      In addition to appending any multidemensional array of data to an HDF
+      file, "DFSDaddata" automatically stores any information pertinent to the
+      data set. It will not overwrite existing data in the file. The array
+      "data" can be of any valid type. However if no number type has been set
+      by "DFSDsetNT", it is assumed that the data type is of type "float32".
+      The invocation of "DFSDadddata" triggers the writing of the entire
+      scientific data set. That is, when "DFSDadddat" is called, all
+      information that has been set by "DFSDset* " calls is written to the
+      file, along with the data array itself.
+-----------------------------------------------------------------------------*/
+intn
+DFSDadddata(const char *filename, intn rank, int32 dimsizes[], VOIDP data)
+{
+  intn  ret_value;
+
+  /* 1, 0 specifies append mode, C style array (row major) */
+  ret_value = (DFSDIputdata(filename, rank, dimsizes, data, 1, 0));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDrestart
+ USAGE
+       int DFSDrestart()
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Forces the next read operation to read the first scientific data set
+       in the file.
+-----------------------------------------------------------------------------*/
+intn
+DFSDrestart(void)
+{
+  intn ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDndatasets");
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Lastfile != NULL)
+    *Lastfile = '\0';   /* set to 0-length string instead of NULLing ptr */
+  Readref = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDndatasets
+ USAGE
+       int32 DFSDndatasets(filename)
+       char *filename;     IN: filename of HDF file
+ RETURNS
+       Returns the number of data sets if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Returns the number of scientific datasets in the file. In HDFv3.3
+       "DFSDndatasets" replaces "DFSDnumber". In order to maintain backward
+       compatibility with existing HDF applications, HDF will continue to
+       support "DFSDnumber". However, it is recommended that all new applications
+       use "DFSDndatasets" instead of "DFSDnumber".
+-----------------------------------------------------------------------------*/
+int32
+DFSDndatasets(char *filename)
+{
+  int32       file_id;
+  int32       nsdgs = 0;
+  int32       ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDndatasets");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* should use reopen if same file as last time - more efficient */
+  file_id = DFSDIopen(filename, DFACC_READ);
+  if (file_id == FAIL)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  nsdgs = (int32)nsdghdr->size;
+  if (Hclose(file_id) == FAIL)
+      HGOTO_ERROR(DFE_CANTCLOSE,FAIL);
+
+  ret_value = nsdgs;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDclear
+ USAGE
+       int DFSDclear()
+ RETURNS
+      Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+      Clears all possible set values. After a call to "DFSDclear", all
+      values set by an "DFSDset*" calls will not be written unless they
+      are set again.
+----------------------------------------------------------------------------*/
+intn
+DFSDclear(void)
+{
+  CONSTR(FUNC, "DFSDclear");
+  intn   ret_value = SUCCEED;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  lastnsdg.tag = DFTAG_NULL;
+  lastnsdg.ref = 0;
+  if (DFSDIclearNT(&Writesdg) < 0)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  ret_value = DFSDIclear(&Writesdg);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDlastref
+ USAGE
+       uint16 DFSDlastref()
+ RETURNS
+       Returns the reference number of the last accessed scientific data set
+       if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Get the most recent reference number used in writing or reading a
+       scientific data set.
+-----------------------------------------------------------------------------*/
+uint16
+DFSDlastref(void)
+{
+  CONSTR(FUNC, "DFSDlastref");
+  uint16  ret_value;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, 0);
+
+  ret_value = (uint16) Lastref;
+
+done:
+  if(ret_value == 0)    /* 0 is invalid ref */
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDreadref
+ USAGE
+       int DFSDreadref(filename, ref)
+       char   *filename;    IN: name of HDF file containing scientific data set
+       uint16 ref;          IN: reference number for next "DFSDgetdata" call
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Specifies teh reference number for the data set to be read during
+       the next read operation. This routine is most likely to be used in
+       conjunction with "DFANgetlablist" which returns a list of labels for
+       a given tag together with their reference numbers. It provides a sort
+       of random access to scientific data sets. There is no guarantee that
+       reference numbers appear in sequence in an HDF file, so ti is not
+       generally safe to assume that a reference number is a sequence number
+       for a scientific data set.
+-----------------------------------------------------------------------------*/
+
+intn
+DFSDreadref(char *filename, uint16 ref)
+{
+  int32       file_id;
+  int32       aid;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDreadref");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  file_id = DFSDIopen(filename, DFACC_READ);
+  if (file_id == DF_NOFILE)
+      HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  if ((aid = Hstartread(file_id, DFTAG_SDG, ref)) == FAIL
+        && (aid = Hstartread(file_id, DFTAG_NDG, ref)) == FAIL)
+      HCLOSE_GOTO_ERROR(file_id, DFE_NOMATCH, FAIL);
+
+  Hendaccess(aid);
+  Readref = ref;
+  Newdata = -1;
+
+  ret_value = Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDgetslice
+ USAGE
+       intn DFSDgetslice(filename, winst, windims, data, dims)
+       char  *filename;       IN:  name of HDF file
+       int32 winst[];         IN:  array containing the coordinates for the start
+                                   of the slice
+       int32 windims[];       IN:  array containing the dimensions of the slice
+       VOID  *data;           OUT: array for returning the slice
+       int32 dims[];          OUT: dimensions of array data
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Gets a part of a scientific data set from a file. "DFSDgetslice"
+       accesses the data set last accessed by "DFSDgetdims". If "DFSDgetdims"
+       has not been called for the named file, "DFSDgetslice" gets a slice
+       from the next data set in the file. The array "winst" specifies the
+       coordinates for the beginning of the slice. Array "windims" gives the
+       size of the slice. The number of elements in both "winst" and "windims"
+       must be equal to the rank of the data set. For example, if the file
+       contains a 3D data set, "winst" may contain the values {2,4,3}, while
+       "windims" contains the values {3,1,4} and the dims shuld be at least
+       {3,1,4}, the same size as the slice. This will extract a 3x4,
+       two-dimensional slice, containing the elements between(2,4.3) and
+       (4,4,6) from the original data set. The array "data" is the array
+       into which the slice is read. It must be at least as big as the desired
+       slice. The array "dims" is the array containing the actual dimensions
+       of the array "data". The user assigns values to "dims" before calling
+       "DFSDgetslice". All parameters assume FORTRAN-style 1-based arrays.
+       "DFSDgetslice" is obsoleted by "DFSDreadslab". "DFSDreadslab" is the
+       recommended fucntion call to use when reading hyperslabs(previously
+       known as data slices). HDFv3.3 will continue to support "DFSDgetslice"
+       only to maintain backward compatibility with HDF applications built
+       on earlier versions of the library.
+----------------------------------------------------------------------------*/
+intn
+DFSDgetslice(const char *filename, int32 winst[], int32 windims[], VOIDP data,
+             int32 dims[])
+{
+  intn ret_value;
+
+  ret_value = (DFSDIgetslice(filename, winst, windims, data, dims, 0));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDstartslice
+ USAGE
+       int DFSDstartslice(filename)
+       char *filename;   IN: name of HDF file to write to
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Prepares the DFSD interface to write a slice to a scientific data set.
+       Before calling "DFSDstartslice", you must call "DFSDsetdims" to
+       specify the dimensions of the data set to be written to the file.
+       "DFSDstartslice" always appends a new data set to an existing file.
+       Remember, you must call "DFSDstartslice" before calling "DFSDputslice"
+       or "DFSDendslice". "DFSDstarslice" is obsolete in favor of "DFSDstartslab"
+       "DFSDstartslab" is the recommended function to call to use when
+       beginning hyperslab(i.e. data slabs) opertaions. HDFv3.3 will continue
+       to support "DFSDstartslice" only to maintain backward compatibility
+       with HDF applications built on earlier version of the library.
+-----------------------------------------------------------------------------*/
+intn
+DFSDstartslice(const char *filename)
+{
+  intn        i;
+  int32       size;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDstartslice");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!Writesdg.rank)     /* dimensions not set */
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+  Sfile_id = DFSDIopen(filename, DFACC_WRITE);
+  if (Sfile_id == DF_NOFILE)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  Writesdg.data.tag = DFTAG_SD;
+
+  if (!Writeref)
+    Writeref = Hnewref(Sfile_id);
+  if (!Writeref)
+    HGOTO_ERROR(DFE_BADREF, FAIL);
+  Writesdg.data.ref = Writeref;
+
+  if (Writesdg.numbertype == DFNT_NONE)   /* if NT not set,default to float32 */
+    DFSDsetNT(DFNT_FLOAT32);
+
+    /* set up to write data */
+  size = DFKNTsize(Writesdg.numbertype);
+  for (i = 0; i < Writesdg.rank; i++)
+    size *= Writesdg.dimsizes[i];
+
+  Writesdg.aid = Hstartwrite(Sfile_id, DFTAG_SD, Writeref, size);
+  if (Writesdg.aid == FAIL)
+    HCLOSE_GOTO_ERROR(Sfile_id,DFE_BADAID, FAIL);
+
+  /* allocate array for keeping track of dims written */
+  Sddims = (int32 *) HDmalloc((uint32) Writesdg.rank * sizeof(int32));
+  if (Sddims == NULL)
+    HCLOSE_GOTO_ERROR(Sfile_id,DFE_NOSPACE, FAIL);
+
+  for (i = 0; i < Writesdg.rank; i++)
+    Sddims[i] = 0;  /* nothing written so far */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDputslice
+ USAGE
+       int DFSDputslice(winend, data, dims)
+       int32 winend[];    IN: dimensions that specify the size of slice to be
+                              written
+       VOID  *data;       IN: array containing slice to be written
+       int32 dims[];      IN: dimensions of array data
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Writes part of a scientific data set to a file. "DFSDputslice" takes
+       some contiguous part of an array in memory and stores it as part of
+       the scientific data set array specified by "DFSDgetdims". Slices must
+       be stored contiguously. Array "windims" specifies the size of the
+       slice to be written. The number of elements in "windims" is equal to
+       the number of dimensions in the scientific data set array. The array
+       "data" is the array in memory containg the slice. The array "dims"
+       contains the dimensions of the array "data". Note that the two arrays
+       "windim" and "dims" need not be the same since the "windims" arguement
+       could refer to a sub-array of "data". In this case only a portion
+       of the array "data" is written to the scientific data set. All
+       parameters assume FORTRAN-style 1-based arrays. "DFSDputslice" is
+       obsoleted by "DFSDwriteslab". DFSDwriteslab is the recommended function
+       call to use when writing hyperslabs(previously known as data slices).
+       HDFv3.3 will continue to support "DFSDputslice" only to maintain
+       backward compatibility with HDF applications built on earlier versions
+       of the library.
+-----------------------------------------------------------------------------*/
+intn
+DFSDputslice(int32 winend[], VOIDP data, int32 dims[])
+{
+  intn ret_value;
+
+  ret_value = (DFSDIputslice(winend, data, dims, 0));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDendslice
+ USAGE
+       int DFSDendslice()
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Terminates the write operation after storing a slice of data in a
+       scientific data set. "DFSDendslice" must be called after all the
+       slices are written. It checks to insure that the entire data set
+       has been written, and returns an error code if not. "DFSDendslice"
+       is obsolete in favor of "DFSDendslab". "DFSDendslab" is the
+       recommended function call to use when terminating hyperslab(previously
+       known as data slices) operations. HDFv3.3 will continue to support
+       "DFSDendslice" only to maintain backward compatability with HDF
+       applications build on earlier versions of the library.
+
+----------------------------------------------------------------------------*/
+intn
+DFSDendslice(void)
+{
+  intn ret_value;
+
+  ret_value = (DFSDIendslice(0));
+
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+       DFSDsetNT
+ USAGE
+       int DFSDsetNT(numbertype)
+       int32 *numbertype;  IN: Number type of the data to be written
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the number type for the data to be written in the next write
+       operation. "DFSDsetNT" must be called if a number type other than
+       "float32" is to be stored. "DFSDsetNT" and "DFSDsetdims" can be called
+       in any order, but they should be called before any other "DFSDset*"
+       functions and before "DFSDputdata" or "DFSDadddata". Valid values for
+       "DFSDgetNT" are of the general form "DFNT_<numbertype>". If you include
+       the headier file "hdf.h" in your program, you can use the following
+       symbolic names for the number types:
+            32-bit float          DFNT_FLOAT32    5
+            64-bit float          DFNT_FLOAT64    6
+            8-bit signed int      DFNT_INT8      20
+            8-bit unsigned int    DFNT_UINT8     21
+            16-bit signed int     DFNT_INT16     22
+            16-bit unsigned int   DFNT_UINT16    23
+            32-bit signed int     DFNT_INT32     24
+            32-bit unsigned int   DFNT_UINT32    25
+---------------------------------------------------------------------------*/
+intn
+DFSDsetNT(int32 numbertype)
+{
+  uint8       outNT;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDsetNT");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  outNT = (uint8) (DFKisnativeNT(numbertype) ? DFKgetPNSC(numbertype, DF_MT) :
+                  (DFKislitendNT(numbertype) ? DFNTF_PC : DFNTF_HDFDEFAULT));
+  if ((numbertype == Writesdg.numbertype)
+        && (outNT == Writesdg.filenumsubclass))
+    HGOTO_DONE(SUCCEED);
+
+  /* Forget previous numbertype  */
+  if (DFSDIclearNT((DFSsdg *) & Writesdg) < 0)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  Writesdg.numbertype = numbertype;
+  Writesdg.filenumsubclass = outNT;
+  Ref.nt = 0;
+  Ref.dims = (Ref.dims >= 0 ? 0 : Ref.dims);
+  Ref.new_ndg = 0;
+
+  ret_value = (DFKsetNT(numbertype));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-------------------------------------------------------------------
+* Name:    DFSDIclearNT
+* Purpose: Reset all "set" values related to number types
+* Inputs:  sdg: pointer to sdg struct to clear
+* Globals: Ref
+* Returns: 0 on success, FAIL on error with error set
+* Users:   DFSDsetNT, HDF users
+* Invokes: none
+* Remarks:
+*--------------------------------------------------------------------*/
+intn
+DFSDIclearNT(DFSsdg * sdg)
+{
+  intn        i;
+  intn      ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIclearNT");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  sdg->numbertype = DFNT_NONE;
+  sdg->filenumsubclass = DFNTF_NONE;
+
+  /* free scale pointers. Note: scale pointer array is not freed   */
+  /* sdg->dimscales will be freed only when rank is changed        */
+  if (sdg->dimscales)
+    {
+      for (i = 0; i < sdg->rank; i++)
+        HDfreenclear(sdg->dimscales[i]);
+    }
+
+  Ref.nt = -1;
+  Ref.maxmin = -1;    /* maxmin and scales should be changed to */
+  Ref.scales = -1;    /* new number type              */
+  Ref.new_ndg = -1;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+       DFSDgetNT
+ USAGE
+       int DFSDgetNT(numbertype)
+       int32 *numbertype;    OUT: Number type of the data in the scientific
+                                  data set.
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Gets the number type of the current scientific data set. This
+       information is then used by calls such as "DFSDgetdata" and
+       "DFSDgetslice". Since "DFSDgetNT" gets the number type of the
+       current data set, "DFSDgetdims" must be called before calling
+       "DFSDgetNT". Valid values for "DFSDgetNT" are of the general form
+       "DFNT_<numbertype>". The following are valid symbolic names and
+       their number types:
+
+            32-bit float          DFNT_FLOAT32    5
+            64-bit float          DFNT_FLOAT64    6
+            8-bit signed int      DFNT_INT8      20
+            8-bit unsigned int    DFNT_UINT8     21
+            16-bit signed int     DFNT_INT16     22
+            16-bit unsigned int   DFNT_UINT16    23
+            32-bit signed int     DFNT_INT32     24
+            32-bit unsigned int   DFNT_UINT32    25
+--------------------------------------------------------------------------- */
+intn
+DFSDgetNT(int32 *pnumbertype)
+{
+  intn    ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDgetNT");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  *(pnumbertype) = Readsdg.numbertype;
+  if (*(pnumbertype) == DFNT_NONE)
+    HGOTO_ERROR(DFE_BADNUMTYPE, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*---------------------------------------------------------------------------
+ NAME
+       DFSDpre32sdg
+ USAGE
+       int DFSDpre32sdg(filename, ref, ispre32)
+       char   *filename;      IN:  The name of the HDF file containing the
+                                   scientific data set
+       uint16 ref;            IN:  Reference number of scientific data set
+       int    ispre32;        OUT: Pointer to the results of the inquiry
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Tests if the scientific data set with the specified reference number
+       was created by a HDF library that precedes HDF3.2. This routine is
+       for programmers who need to know whether a scientific data set was
+       written by a version of the HDF library earlier than HDF3.2. If the
+       scientific data set was created with a version of HDF prior to v3.2,
+       "ispre32" will be set to 1, otherwise it will be set to 0. Based on
+       this information, programmers can decide whether or not to transpose
+       the corresponding array.
+----------------------------------------------------------------------------*/
+intn
+DFSDpre32sdg(char *filename, uint16 ref, intn *ispre32)
+{
+    uint32      num;
+    int32       file_id;
+    intn        found = 0;
+    DFnsdgle   *ptr;
+    intn       ret_value = SUCCEED;
+    CONSTR(FUNC, "DFSDpre32sdg");
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    file_id = DFSDIopen(filename, DFACC_READ);
+    if (file_id == FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+    ptr = nsdghdr->nsdg_t;
+    num = nsdghdr->size;
+
+    while ((num > 0) && (ptr != NULL) && !found)
+      {
+          if ((ptr->nsdg.tag == DFTAG_SDG)
+              && (ptr->nsdg.ref == ref))
+            {   /* pure SDG  */
+                found = 1;
+                *ispre32 = TRUE;
+            }
+          else if ((ptr->sdg.tag == DFTAG_SDG)
+                   && (ptr->sdg.ref == ref))
+            {   /* NDGSDG   */
+                found = 1;
+                *ispre32 = FALSE;
+            }
+          else
+            {
+                ptr = ptr->next;
+                num--;
+            }
+      }     /* while  */
+
+    if (((num == 0) && (ptr != NULL)) || ((num != 0) && (ptr == NULL)) || !found)
+      HCLOSE_GOTO_ERROR(file_id, DFE_BADTABLE, FAIL);
+
+    if (Hclose(file_id) < 0)
+        ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end of DFSDpre32sdg   */
+
+/******************************************************************************/
+/*--------------------- Lower level routines --------------------------------*/
+/******************************************************************************/
+
+/* Functions for NDG and SDG stuff                       */
+
+/*--------------------------------------------------------------------------
+ * Name:    DFSDIsetnsdg_t
+ * Purpose: Set up the NDG/SDG table. Each node has two
+            fields: the 1st field is NDG or SDG, the 2nd
+            field has value only when it is a special
+            NDG, i.e. the data set is float32 and not
+            compressed.
+ * Inputs:  file_id: pointer to HDF file containing SDG
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   DFSDIopen for READ
+ *--------------------------------------------------------------------------*/
+static intn
+DFSDIsetnsdg_t(int32 file_id, DFnsdg_t_hdr * l_nsdghdr)
+{
+  uint32      sz_DFnsdgle = (uint32) sizeof(struct DFnsdgle);
+  int32       aid;            /* access id */
+  int32       ndgs;           /* number of ndg's */
+  int32       sdgs;           /* number of sdg's */
+  int32       GroupID;
+  uint16      intag=DFTAG_NULL;
+  uint16      inref=DFTAG_NULL;
+  intn        moretags;
+  intn        found;
+  DFnsdgle   *ntb = NULL;
+  DFnsdgle   *stb = NULL;
+  DFnsdgle   *new;
+  DFnsdgle   *nf;
+  DFnsdgle   *nr;
+  DFnsdgle   *sf;
+  DFnsdgle   *sr;
+  DFdi        di;
+  DFdi        lnkdd[2];
+  uint8      *bufp;
+  intn       ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDsetnsdg_t");
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!HDvalidfid(file_id))
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+    /* Check if temproray buffer has been allocated */
+  if (ptbuf == NULL)
+    {
+      ptbuf = (uint8 *) HDmalloc(TBUF_SZ * sizeof(uint8));
+      if (ptbuf == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    }
+
+  /* MMM:  Talk to Shiming and make sure the change made to the way ndgs
+   and sdgs are handled is ok.
+   */
+  ndgs = Hnumber(file_id, DFTAG_NDG);
+  sdgs = Hnumber(file_id, DFTAG_SDG);
+  if ((ndgs == FAIL) || (sdgs == FAIL))
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  if ((ndgs + sdgs) == 0)
+    {     /* no sdgs or ndgs in file */
+      l_nsdghdr->size = 0;
+      l_nsdghdr->nsdg_t = NULL;
+      HGOTO_DONE(SUCCEED);
+    }
+  if ((ntb = (DFnsdgle *) HDmalloc(sz_DFnsdgle)) == NULL)
+    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* the first node in each table is a dummy node  */
+  ntb->nsdg.tag = DFTAG_NULL;     /* set up and init an ndg table  */
+  ntb->nsdg.ref = 0;
+  ntb->sdg.tag = DFTAG_NULL;
+  ntb->sdg.ref = 0;
+  ntb->next = NULL;
+
+  if ((stb = (DFnsdgle *) HDmalloc(sz_DFnsdgle)) == NULL)
+    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+  stb->nsdg.tag = DFTAG_NULL;     /* set up and init an sdg table  */
+  stb->nsdg.ref = 0;
+  stb->sdg.tag = DFTAG_NULL;  /* this field should be named as */
+  stb->sdg.ref = 0;   /* stb->ndg.tag, the ndg to which this */
+  stb->next = NULL;   /* sdg belongs.                 */
+
+  aid = Hstartread(file_id, DFTAG_WILDCARD, DFREF_WILDCARD);
+  moretags = (aid != FAIL);
+  while (moretags)
+    {     /* read dd's and put each dd in ntb or stb */
+      HQuerytagref(aid, &intag, &inref);
+      /* put NDG or SDG on ntb or stb */
+      if (intag == DFTAG_NDG)
+        {
+          nr = ntb;
+          nf = ntb;
+          while ((inref > nf->nsdg.ref) && (nf->next != NULL))
+            {
+              nr = nf;
+              nf = nf->next;
+            }
+          /* MMM:  Tlk to Shiming and make sure the way this part was 
+             rearranged is ok.
+           */
+          /* check for duplicate nsdg */
+          if (inref == nf->nsdg.ref)
+            HGOTO_ERROR(DFE_BADNDG, FAIL);
+
+          /* add a node to the table */
+          if ((new = (DFnsdgle *) HDmalloc(sz_DFnsdgle)) == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          new->nsdg.tag = DFTAG_NDG;
+          new->nsdg.ref = inref;
+          new->sdg.tag = DFTAG_NULL;
+          new->sdg.ref = 0;
+
+          if (inref < nf->nsdg.ref)
+            {     /* does it go before current node? */
+              new->next = nf;
+              nr->next = new;
+            }
+          else
+            {     /* or at the end? */
+              new->next = nf->next;
+              nf->next = new;
+            }
+
+          /* Does this NDG have an SDG?       */
+          if ((GroupID = DFdiread(file_id, DFTAG_NDG, inref)) < 0)
+            HGOTO_ERROR(DFE_BADGROUP, FAIL);
+
+          found = FALSE;
+          di.tag = DFTAG_NULL;
+          di.ref = 0;
+          while ((found == 0) && (DFdiget(GroupID, &di.tag, &di.ref) == 0))
+            {
+              if (di.tag == DFTAG_SDLNK)
+                found = TRUE;
+            }
+
+          if (found)
+            {     /* read in the tag/refs in the link element */
+              if (Hgetelement(file_id, di.tag, di.ref, ptbuf) == (int32) FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+              bufp = ptbuf;
+              UINT16DECODE(bufp, lnkdd[0].tag);
+              UINT16DECODE(bufp, lnkdd[0].ref);
+              UINT16DECODE(bufp, lnkdd[1].tag);
+              UINT16DECODE(bufp, lnkdd[1].ref);
+              new->sdg.tag = lnkdd[1].tag;
+              new->sdg.ref = lnkdd[1].ref;
+              DFdifree(GroupID);
+            }
+        }   /* end of NDG    */
+
+      if (intag == DFTAG_SDG)
+        {
+          sr = stb;
+          sf = stb;
+          while ((inref > sf->nsdg.ref) && (sf->next != NULL))
+            {
+              sr = sf;
+              sf = sf->next;
+            }
+          if (inref == sf->nsdg.ref)
+            HGOTO_ERROR(DFE_BADNDG, FAIL);
+
+          /* insert a new node */
+          if ((new = (DFnsdgle *) HDmalloc(sz_DFnsdgle)) == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          new->nsdg.tag = DFTAG_SDG;
+          new->nsdg.ref = inref;
+          new->sdg.tag = DFTAG_NULL;
+          new->sdg.ref = 0;
+
+          if (inref < sf->nsdg.ref)
+            {     /* does it go before current node? */
+              new->next = sf;
+              sr->next = new;
+            }
+          else
+            {     /* or at the end? */
+              new->next = sf->next;
+              sf->next = new;
+            }
+          /* Does it belong to  an NDG?    */
+          if ((GroupID = DFdiread(file_id, DFTAG_SDG, inref)) < 0)
+              HGOTO_ERROR(DFE_BADGROUP, FAIL);
+          found = FALSE;
+          di.tag = DFTAG_NULL;
+          di.ref = 0;
+          while ((found == 0) && (DFdiget(GroupID, &di.tag, &di.ref) == 0))
+            {
+              if (di.tag == DFTAG_SDLNK)
+                found = TRUE;
+            }
+          if (found)
+            {     /* read in the tag/refs in the link element */
+              if (Hgetelement(file_id, di.tag, di.ref, ptbuf) == (int32) FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+              bufp = ptbuf;
+              UINT16DECODE(bufp, lnkdd[0].tag);
+              UINT16DECODE(bufp, lnkdd[0].ref);
+              UINT16DECODE(bufp, lnkdd[1].tag);
+              UINT16DECODE(bufp, lnkdd[1].ref);
+              new->sdg.tag = lnkdd[0].tag;
+              new->sdg.ref = lnkdd[0].ref;
+              DFdifree(GroupID);
+            }
+        }   /* end of SDG    */
+
+      /*   get next dd   */
+      moretags = (SUCCEED == Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT));
+    }     /* gone through the dd blocks   */
+  Hendaccess(aid);
+
+  /* merge stb and ntb        */
+  /* remove SDGNDG from stb   */
+  nf = ntb->next;
+  while (nf != NULL)
+    {
+      inref = nf->sdg.ref;
+      if (inref != 0)
+        {   /* it has an SDG   */
+          sr = stb;
+          sf = stb;
+          while ((sf->nsdg.ref < inref) && (sf->next != NULL))
+            {
+              sr = sf;
+              sf = sf->next;
+            }
+          if (sf->nsdg.ref == inref)
+            {
+              if (sf->sdg.ref != nf->nsdg.ref)
+                {
+                  HGOTO_ERROR(DFE_BADNDG, FAIL);
+                }
+              else
+                {
+                  sr->next = sf->next;
+                  HDfreenclear(sf);
+                  sdgs--;
+                }
+            }
+        }
+      nf = nf->next;
+    }
+
+  /* check all SDGNDGs were removed   */
+  sf = stb->next;
+  while (sf != NULL)
+    {
+      if (sf->sdg.ref != 0)
+        HGOTO_ERROR(DFE_BADSDG, FAIL);
+      sf = sf->next;
+    }
+
+  /* merge the two tables into one */
+  nf = ntb;   /* looking for the end of ntb   */
+  while (nf->next != NULL)
+    nf = nf->next;
+  nf->next = stb->next;   /* the first node in stb is a dummy */
+  l_nsdghdr->size = (uint32)(ndgs + sdgs);
+  l_nsdghdr->nsdg_t = ntb->next;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  /* Release the first nodes in stb and ntb  */
+  if (stb != NULL)
+    HDfree((VOIDP) stb);
+  if (ntb != NULL)
+    HDfree((VOIDP) ntb);
+
+  return ret_value;
+}   /* end of DFSDsdtnsdg_t   */
+
+/*-----------------------------------------------------------------------
+* Name  DFSDInextnsdg
+* Purpose: Returns next ndg or sdg in the file
+* Inputs:  nsdghdr: point to the nsdg table
+*      nsdg: the structure holds the di of next sdg or ndg
+* Returns: 0 on succeeds, FAIL on failure
+* -------------------------------------------------------------------*/
+static intn
+DFSDInextnsdg(DFnsdg_t_hdr * l_nsdghdr, DFdi * nsdg)
+{
+  uint32      num;
+  intn        found = FALSE;
+  DFnsdgle   *ptr;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDInextnsdg");
+
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  nsdg->tag = DFTAG_NULL;
+  nsdg->ref = 0;
+  ptr = l_nsdghdr->nsdg_t;
+  num = l_nsdghdr->size;
+
+  if ((ptr == NULL) || (num == 0))
+      HGOTO_DONE(SUCCEED);
+
+  if ((lastnsdg.tag == DFTAG_NULL) && (lastnsdg.ref == 0))
+    {
+      found = TRUE;
+    }
+  else
+    {
+      while ((num > 0) && (ptr != NULL) && !found)
+        {
+          if ((ptr->nsdg.tag == lastnsdg.tag)
+              && (ptr->nsdg.ref == lastnsdg.ref))
+            {
+              if ((ptr = ptr->next) != NULL)
+                found = TRUE;
+            }
+          else
+            {
+              ptr = ptr->next;
+              num--;
+            }
+        }   /* while  */
+
+      if (((num == 0) && (ptr != NULL))
+          || ((num != 0) && (ptr == NULL)) || !found)
+        {
+          HGOTO_ERROR(DFE_BADTABLE, FAIL);
+        }
+    }     /* else   */
+
+  if (found)
+    {
+      nsdg->tag = ptr->nsdg.tag;
+      nsdg->ref = ptr->nsdg.ref;
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end of DFSDInextnsdg   */
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIgetndg
+ * Purpose: Reads in NDG
+ * Inputs:  file_id: pointer to HDF file containing NDG
+ *          ref: ref of NDG to read
+ *          sdg: pointer to DFSsdg struct to read NDG into
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF programmers, DFSDIsdginfo
+ * Invokes: DFgetelement, DFdiread, DFdiget, DFaccess, DFread
+        DFSDgetsdg
+ * Method:  Reads in NDG using DFdiread.  Gets each tag/ref using DFdiget.
+ *          Reads in dimensions using DFgetelement.
+ *      Call DFSDgetsdg to read in the rest info.
+ *          Mallocs space for these, freeing
+ *          previously allocated space.
+ * Remarks: This accepts non-float32 data
+ *---------------------------------------------------------------------------*/
+static intn
+DFSDIgetndg(int32 file_id, uint16 tag, uint16 ref, DFSsdg * sdg)
+{
+  int16       int16var;
+  int32       i;
+  intn        luf;
+  DFdi        elmt;
+  DFdi        nt;
+  int32       length;
+  int32       numtype = 0;    /* current number type */
+  int32       fileNTsize = 0; /* size of this NT as it is in the file */
+  int32       localNTsize = 0;    /* size of this NT as it is in this machine */
+  int32       ret;
+  int32       aid;
+  int32       GroupID;
+  int8        fileNT = 0;     /* file number subclass */
+  int8        platnumsubclass = 0;    /* platform number subclass */
+  uint8       ntstring[4];
+  uint8      *isscales;
+  uint8      *buf;
+  uint8      *p;              /* temporary pointer for moving things to buffer */
+  intn       ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIgetndg");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!HDvalidfid(file_id))
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  if (!ref)
+    HGOTO_ERROR(DFE_BADREF, FAIL);
+
+  /* Check if temproray buffer has been allocated */
+  if (ptbuf == NULL)
+    {
+      ptbuf = (uint8 *) HDmalloc(TBUF_SZ * sizeof(uint8));
+      if (ptbuf == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    }
+
+  /* read NDG into memory */
+  if ((GroupID = DFdiread(file_id, tag, ref)) < 0)
+        HGOTO_ERROR(DFE_BADGROUP, FAIL);
+
+  DFSDIclear(sdg);
+  if (tag == DFTAG_NDG)
+    DFSDIclearNT(sdg);
+  Ismaxmin = 0;
+  IsCal = FALSE;
+
+  /*
+   * Loop through all members of the group
+   */
+  while (!DFdiget(GroupID, &elmt.tag, &elmt.ref))
+    {
+      luf = -1;     /* flag value for label/unit/ */
+      /* format gets process tag/ref */
+      switch (elmt.tag)
+        {
+
+        case DFTAG_SD:      /* data tag/ref */
+          sdg->data.tag = elmt.tag;   /* put tag/ref in struct */
+          sdg->data.ref = elmt.ref;
+          break;
+
+        case DFTAG_SDD: /* dimension */
+          aid = Hstartread(file_id, elmt.tag, elmt.ref);
+          if (aid == FAIL)
+            {
+              DFdifree(GroupID);
+              HGOTO_ERROR(DFE_BADAID, FAIL);
+            }
+
+          /* read rank */
+          if (Hread(aid, (int32) 2, ptbuf) == FAIL)
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+            }
+          p = ptbuf;
+          INT16DECODE(p, int16var);
+          sdg->rank=(intn)int16var;
+
+          /* get space for dimensions */
+          sdg->dimsizes = (int32 *) HDmalloc((uint32) sdg->rank *
+                                             sizeof(int32));
+          if (sdg->dimsizes == NULL)
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          /* read dimension record */
+          if (Hread(aid, (int32) 4 * sdg->rank, ptbuf) == FAIL)
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+            }
+          p = ptbuf;
+          for (i = 0; i < sdg->rank; i++)
+            INT32DECODE(p, sdg->dimsizes[i]);
+
+          /* read tag/ref of NT */
+          if (Hread(aid, (int32) 4, ptbuf) == FAIL)
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+            }
+          p = ptbuf;
+          UINT16DECODE(p, nt.tag);
+          UINT16DECODE(p, nt.ref);
+
+          /* read actual NT */
+          if (Hgetelement(file_id, nt.tag, nt.ref, ntstring) == FAIL)
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_GETELEM, FAIL);
+            }
+
+          /* check for any valid NT */
+          if (ntstring[1] == DFNT_NONE)
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+            }
+
+          /* if looking for an SDG type must be FLOAT32 */
+          if (tag == DFTAG_SDG && ntstring[1] != DFNT_FLOAT32)
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+            }
+
+          /* set NT info */
+          numtype = (int32)ntstring[1];
+          fileNT = (int8)ntstring[3];
+          platnumsubclass = DFKgetPNSC(numtype, DF_MT);
+          if ((fileNT != DFNTF_HDFDEFAULT)
+              && (fileNT != DFNTF_PC)
+              && (fileNT != platnumsubclass))
+            {
+              DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+            }
+          if (fileNT != DFNTF_HDFDEFAULT)
+            {     /* if native or little endian */
+              if (fileNT != DFNTF_PC)   /* native */
+                numtype |= DFNT_NATIVE;
+              else  /* little endian */
+                numtype |= DFNT_LITEND;
+            }     /* end if */
+
+          sdg->filenumsubclass = ntstring[3];
+          sdg->numbertype = numtype;
+
+          /* set size of NT    */
+          fileNTsize = DFKNTsize(numtype);
+          localNTsize = DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+
+          /* read and check all scale NTs */
+          for (i = 0; i < sdg->rank; i++)
+            {
+              if (Hread(aid, (int32) 4, ptbuf) == FAIL)
+                {
+	              DFdifree(GroupID);
+                  Hendaccess(aid);
+                  HGOTO_ERROR(DFE_READERROR, FAIL);
+                }
+              p = ptbuf;
+              UINT16DECODE(p, nt.tag);
+              UINT16DECODE(p, nt.ref);
+
+              /* read NT itself */
+              if (Hgetelement(file_id, nt.tag, nt.ref, ntstring) == FAIL)
+                {
+	              DFdifree(GroupID);
+                  Hendaccess(aid);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+
+              /* check for any valid NT */
+              if (ntstring[1] == DFNT_NONE)
+                {
+	              DFdifree(GroupID);
+                  Hendaccess(aid);
+                  HGOTO_ERROR(DFE_BADCALL, FAIL);
+                }
+
+              /* if looking for an SDG type must be FLOAT32 */
+              if (tag == DFTAG_SDG && ntstring[1] != DFNT_FLOAT32)
+                {
+	              DFdifree(GroupID);
+                  Hendaccess(aid);
+                  HGOTO_ERROR(DFE_BADCALL, FAIL);
+                }
+
+            }     /* end for loop */
+          Hendaccess(aid);
+          break;
+
+        case DFTAG_SDLNK:   /* SDG NDG link */
+          break;  /* do nothing in 3.2  */
+
+        case DFTAG_SDL: /* labels */
+          if (luf == (-1))
+            luf = LABEL;
+
+        case DFTAG_SDU: /* units */
+          if (luf == (-1))
+            luf = UNIT;
+
+        case DFTAG_SDF: /* formats */
+          if (luf == (-1))
+            luf = FORMAT;
+
+          if (!sdg->dimsizes)
+            {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_CORRUPT, FAIL);
+            }
+
+          /* get needed size of buffer, allocate */
+          length = Hlength(file_id, elmt.tag, elmt.ref);
+          if (length == FAIL)
+            {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_BADLEN, FAIL);
+            }
+          buf = (uint8 *) HDmalloc((uint32) length);
+          if (buf == NULL)
+            {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          /* read in luf */
+          if (Hgetelement(file_id, elmt.tag, elmt.ref, buf) == FAIL)
+            {
+	          DFdifree(GroupID);
+              HDfree((VOIDP) buf);
+              HGOTO_ERROR(DFE_GETELEM, FAIL);
+            }
+          p = buf;
+
+          /* allocate data luf space */
+          sdg->dataluf[luf] = (char *) HDmalloc((uint32) HDstrlen((char *) p) + 1);
+
+          if (sdg->dataluf[luf] == NULL)
+            {
+	          DFdifree(GroupID);
+              HDfree((VOIDP) buf);
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          /* extract data luf */
+          HDstrcpy(sdg->dataluf[luf], (char *) p);
+          p += HDstrlen(sdg->dataluf[luf]) + 1;
+
+          /* get space for dimluf array */
+          sdg->dimluf[luf] =
+            (char **) HDmalloc((uint32) sdg->rank * sizeof(char *));
+          if (sdg->dimluf[luf] == NULL)
+            {
+	          DFdifree(GroupID);
+              HDfree((VOIDP) buf);
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          /* extract dimension lufs */
+          for (i = 0; i < sdg->rank; i++)
+            {
+              sdg->dimluf[luf][i] = (char *)
+                HDmalloc((uint32) HDstrlen((char *) p) + 1);
+              if (sdg->dimluf[luf][i] == NULL)
+                {
+		          DFdifree(GroupID);
+                  HDfree((VOIDP) buf);
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                }
+              HDstrcpy(sdg->dimluf[luf][i], (char *) p);
+              p += HDstrlen(sdg->dimluf[luf][i]) + 1;
+            }
+          HDfree((VOIDP) buf);
+          break;
+
+        case DFTAG_SDS: /* scales */
+          if (!sdg->dimsizes)
+	        {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_CORRUPT, FAIL);
+            }
+
+          /* set up to read scale */
+          aid = Hstartread(file_id, elmt.tag, elmt.ref);
+          if (aid == FAIL)
+	        {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_BADAID, FAIL);
+            }
+
+          /* read isscales */
+          isscales = (uint8 *) HDmalloc((uint32) sdg->rank);
+          if (isscales == NULL)
+            {
+	          DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+          if (Hread(aid, (int32) sdg->rank, isscales) == FAIL)
+            {
+	          DFdifree(GroupID);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+            }
+
+          /* allocate scale pointers */
+          sdg->dimscales =
+            (uint8 **) HDmalloc((uint32) sdg->rank * sizeof(int8 *));
+          if (sdg->dimscales == NULL)
+            {
+	          DFdifree(GroupID);
+              HDfree((VOIDP) isscales);
+              Hendaccess(aid);
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          /* read scales */
+          for (i = 0; i < sdg->rank; i++)
+            {
+              sdg->dimscales[i] = NULL;     /* default */
+              if (!isscales[i])
+                continue;
+
+              /* space for scale */
+              sdg->dimscales[i] = (uint8 *)
+                HDmalloc((size_t) (sdg->dimsizes[i] * localNTsize));
+              if (sdg->dimscales[i] == NULL)
+                {
+		          DFdifree(GroupID);
+                  HDfree((VOIDP) isscales);
+                  Hendaccess(aid);
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                }
+
+              if (platnumsubclass == fileNT)
+                {   /* no conversion needed */
+                  ret = Hread(aid, (int32) sdg->dimsizes[i] * fileNTsize,
+                              (uint8 *) sdg->dimscales[i]);
+                  if (ret == FAIL)
+                    {
+			          DFdifree(GroupID);
+                      HDfree((VOIDP) isscales);
+                      Hendaccess(aid);
+                      HGOTO_ERROR(DFE_READERROR, FAIL);
+                    }
+                }
+              else
+                {   /* conversion necessary */
+                  /* allocate conversion buffer */
+                  buf = (uint8 *) HDmalloc((size_t) (sdg->dimsizes[i] * fileNTsize));
+                  if (buf == NULL)
+                    {
+			          DFdifree(GroupID);
+                      HDfree((VOIDP) isscales);
+                      Hendaccess(aid);
+                      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                    }
+
+                  /* read scale from file */
+                  ret = Hread(aid,(int32) (sdg->dimsizes[i] * fileNTsize), buf);
+                  if (ret == FAIL)
+                    {
+			          DFdifree(GroupID);
+                      HDfree((VOIDP) buf);
+                      HDfree((VOIDP) isscales);
+                      Hendaccess(aid);
+                      HGOTO_ERROR(DFE_READERROR, FAIL);
+                    }
+
+                  p = buf;
+
+                  /* convert, all at once */
+                  DFKconvert((VOIDP) p, (VOIDP) sdg->dimscales[i], numtype,
+                             sdg->dimsizes[i], DFACC_READ, 0, 0);
+
+                  HDfree((VOIDP) buf);
+                }
+            }
+          HDfree((VOIDP) isscales);
+          Hendaccess(aid);
+          break;
+
+        case DFTAG_SDC: /* coordsys */
+          /* find and allocate necessary space */
+          length = Hlength(file_id, elmt.tag, elmt.ref);
+          if (length == FAIL)
+            {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_BADLEN, FAIL);
+            }
+
+          sdg->coordsys = (char *) HDmalloc((uint32) length);
+          if (sdg->coordsys == NULL)
+            {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          /* read coordsys */
+          if (Hgetelement(file_id, elmt.tag, elmt.ref,
+                          (uint8 *) sdg->coordsys) == FAIL)
+	        {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_GETELEM, FAIL);
+            }
+          break;
+
+        case DFTAG_SDM: /* max/min */
+          if (fileNT == platnumsubclass)
+            {     /* no conversion */
+              if (Hgetelement(file_id, elmt.tag, elmt.ref,
+                              (uint8 *) &(sdg->max_min[0])) == FAIL)
+                {
+		          DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+            }
+          else
+            {
+              /* conversion needed */
+              /* allocate buffer */
+              buf = (uint8 *) HDmalloc((size_t) (2 * fileNTsize));
+              if (buf == NULL)
+                {
+ 		          DFdifree(GroupID);
+                 HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                }
+
+              /* read and convert max/min */
+              if (Hgetelement(file_id, elmt.tag, elmt.ref, buf) == FAIL)
+                {
+		          DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+
+              DFKconvert((VOIDP) buf, (VOIDP) &(sdg->max_min[0]), numtype, 2,
+                         DFACC_READ, 0, 0);
+
+              HDfree((VOIDP) buf);
+            }
+          Ismaxmin = 1;
+          break;
+
+        case DFTAG_CAL:
+          if (fileNT == platnumsubclass)
+            {     /* no conversion */
+              /* get size of element */
+              intn        eltSize = (intn) Hlength(file_id, elmt.tag, elmt.ref);
+              if (eltSize == FAIL)
+                {
+		          DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_BADLEN, FAIL);
+                }
+
+              if (eltSize == 36)
+                {
+                   /* element is new, double based type */
+                  if (Hgetelement(file_id, elmt.tag, elmt.ref,
+                                  (unsigned char *) &sdg->cal) < 0)
+	                {
+			          DFdifree(GroupID);
+                      HGOTO_ERROR(DFE_GETELEM, FAIL);
+                    }
+                }
+              else
+                {
+                  /* element is old float based type */
+                  float32     buf2[4];
+
+                   /* allocate input buffer */
+                  if (Hgetelement(file_id, elmt.tag, elmt.ref,
+                                  (unsigned char *) buf2) < 0)
+	                {
+			          DFdifree(GroupID);
+                      HGOTO_ERROR(DFE_GETELEM, FAIL);
+                    }
+
+                  /* move 'em over */
+                  sdg->ioff = (float64) buf2[0];
+                  sdg->ioff_err = (float64) buf2[1];
+                  sdg->cal = (float64) buf2[2];
+                  sdg->cal_err = (float64) buf2[3];
+                  sdg->cal_type = DFNT_INT16;
+
+                }
+            }
+          else
+            {
+              intn        eltSize;
+
+              /* get size of element */
+              eltSize = (intn) Hlength(file_id, elmt.tag, elmt.ref);
+              if (eltSize == FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_BADLEN, FAIL);
+                }
+
+              /* allocate buffer */
+              buf = (uint8 *) HDmalloc((uint32) eltSize);
+              if (buf == NULL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                }
+
+              /* read and convert calibration */
+              if (Hgetelement(file_id, elmt.tag, elmt.ref, buf) == FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+
+              if (eltSize == 36)
+                {
+                  /* element is new, double based type */
+                 /* read in the 64bit float factors */
+                  DFKconvert((VOIDP) buf,
+                             (VOIDP) &sdg->cal,
+                             DFNT_FLOAT64, 4, DFACC_READ, 0, 0);
+
+                  /* read in the 32bit integer number type */
+                  DFKconvert((VOIDP) (buf + 32),
+                             (VOIDP) &sdg->cal_type,
+                             DFNT_INT32, 1, DFACC_READ, 0, 0);
+                }
+              else
+                {
+                  /* element is old float based type */
+                  float32     buf2[4];
+
+                  /* convert calibration factors */
+                  DFKconvert((VOIDP) buf, (VOIDP) buf2, DFNT_FLOAT32, 4,
+                             DFACC_READ, 0, 0);
+
+                  /* move 'em over */
+                  sdg->ioff = (float64) buf2[0];
+                  sdg->ioff_err = (float64) buf2[1];
+                  sdg->cal = (float64) buf2[2];
+                  sdg->cal_err = (float64) buf2[3];
+                  sdg->cal_type = DFNT_INT16;
+
+                }
+              HDfree((VOIDP) buf);
+            }
+          IsCal = TRUE;
+          break;
+
+        case DFTAG_FV:
+          if (fileNT == platnumsubclass)
+            {     /* no conversion */
+              /* get size of element */
+              intn        eltSize = (intn) Hlength(file_id, elmt.tag, elmt.ref);
+              if (eltSize == FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_BADLEN, FAIL);
+                }
+
+              /* get element */
+              if (Hgetelement(file_id, elmt.tag, elmt.ref,
+                              (unsigned char *) sdg->fill_value) == FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+            }
+          else
+            {
+              intn        eltSize;
+
+              /* get size of element  */
+              eltSize = (intn) Hlength(file_id, elmt.tag, elmt.ref);
+              if (eltSize == FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_BADLEN, FAIL);
+                }
+
+              /* allocate buffer for conversion  */
+              buf = (uint8 *) HDmalloc((uint32) eltSize);
+              if (buf == NULL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                }
+
+              /* read fill value into buffer */
+              if (Hgetelement(file_id, elmt.tag, elmt.ref, buf) == FAIL)
+                {
+                  DFdifree(GroupID);
+                  HGOTO_ERROR(DFE_GETELEM, FAIL);
+                }
+
+              /* convert the fill value  */
+              DFKconvert((VOIDP) buf, (VOIDP) sdg->fill_value,
+                         numtype, 1, DFACC_READ, 0, 0);
+
+              HDfree((VOIDP) buf);
+            }
+          break;
+
+        case DFTAG_SDT:
+          FileTranspose = 1;
+          break;
+        default:
+          if ((elmt.tag <= DFTAG_BREQ) && (elmt.tag >= DFTAG_EREQ))
+	        {
+	          DFdifree(GroupID);
+              HGOTO_ERROR(DFE_BADNDG, FAIL);
+            }
+          break;
+        }
+    }
+
+  /* since the dataset exists, the fill value cannot be changed */
+  sdg->fill_fixed = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+ /*---------------------------------------------------------------------------*
+ * Name:    DFSDIputndg
+ * Purpose: Write NDG out to HDF file
+ * Inputs:  file_id: HDF file pointer
+ *          ref: ref to put NDG with
+ *          sdg: struct containing NDG info to put
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF programmers, utilities, DFSDputdata, other routines
+ * Invokes: DFIcheck, DFdistart, DFdiadd, DFdiend, DFputelement, DFaccess,
+ *          DFwrite
+ * Remarks: Writes out NTs
+ *---------------------------------------------------------------------------*/
+static intn
+DFSDIputndg(int32 file_id, uint16 ref, DFSsdg * sdg)
+{
+  int32       i;
+  intn        j;
+  intn        luf;
+  intn        issdg = 0;      /* issdg=1 if it is NDG SDG  */
+  intn        len;
+  uint16      luftag;
+  uint8      *buf;
+  uint8      *Isscales = NULL;
+  uint8      *bufp;
+  uint8       ntstring[4];
+  uint8       platnumsubclass;
+  uint8       outNT;          /* file number type subclass */
+  int32       GroupID;
+  int32       numtype;        /* current number type  */
+  int32       fileNTsize;     /* size of this NT as it will be in the file */
+  int32       scaleNTsize;    /* size of scale NT as it will be in the file */
+  int32       aid;
+  DFdi        nt;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIputndg");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!HDvalidfid(file_id))
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+  if (!ref)
+    HGOTO_ERROR(DFE_BADREF, FAIL);
+
+  /* Check if temproray buffer has been allocated */
+  if (ptbuf == NULL)
+    {
+      ptbuf = (uint8 *) HDmalloc(TBUF_SZ * sizeof(uint8));
+      if (ptbuf == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    }
+
+  /* set number type and subclass     */
+  if (sdg->numbertype == DFNT_NONE)
+    DFSDsetNT(DFNT_FLOAT32);    /* default is float32  */
+  numtype = sdg->numbertype;
+  fileNTsize = DFKNTsize(numtype);
+  scaleNTsize = fileNTsize;   /* for now, assume same. MAY CHANGE */
+  outNT = sdg->filenumsubclass;
+  platnumsubclass = (uint8)DFKgetPNSC(numtype, (int32)DF_MT);
+
+  /* prepare to start writing ndg   */
+  if ((GroupID = DFdisetup(10)) < 0)
+    HGOTO_ERROR(DFE_GROUPSETUP, FAIL);
+
+  /* put ND and ref       */
+  if (DFdiput(GroupID, sdg->data.tag, sdg->data.ref) < 0)
+    HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+  if (Ref.nt <= 0)
+    {     /* will not execute if has been written in putsdg  */
+      /* construct and write out NT */
+      ntstring[0] = DFNT_VERSION;   /* version */
+      ntstring[1] = (uint8) (numtype & 0xff);   /* type */
+      ntstring[2] = (uint8) (fileNTsize * 8);   /* width of number type in bits */
+      ntstring[3] = outNT;  /* class: IEEE or machine class */
+      if (Hputelement(file_id, DFTAG_NT, ref, ntstring, (int32) 4) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      Ref.nt = (intn)ref;
+    }
+
+  /* write out NDD (dimension record) */
+  if (Ref.dims <= 0)
+    { /* new NDD; write rank, dims, data NT and scale NTs */
+      /* put rank & dimensions in buffer */
+      bufp = ptbuf;
+      UINT16ENCODE(bufp, sdg->rank);
+      for (i = 0; i < sdg->rank; i++)
+        INT32ENCODE(bufp, sdg->dimsizes[i]);
+
+      /* put data NT and scale NTs  in buffer */
+      nt.tag = DFTAG_NT;
+      nt.ref = (uint16) Ref.nt;     /* same NT for scales too */
+
+      /* "<=" used to put 1 data NT + rank scale NTs in buffer */
+      for (i = 0; i <= sdg->rank; i++)
+        {   /* scale NTs written even if no scale! */
+          UINT16ENCODE(bufp, nt.tag);
+          UINT16ENCODE(bufp, nt.ref);
+        }
+      /* write out NDD record */
+      if ( Hputelement(file_id, DFTAG_SDD, ref, ptbuf, (int32) (bufp - ptbuf)) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      Ref.dims = (intn)ref;
+    }
+  /* write dimension record tag/ref */
+  if (DFdiput(GroupID, DFTAG_SDD, (uint16) Ref.dims) < 0)
+    HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+  /* write out label/unit/format */
+  for (luf = LABEL; luf <= FORMAT; luf++)
+    {
+      luftag = (uint16) ((luf == LABEL) ? DFTAG_SDL :
+                         (luf == UNIT) ? DFTAG_SDU : DFTAG_SDF);
+      bufp = ptbuf;
+      /* this block of code checks if luf is NULL, else writes it */
+      if (!Ref.luf[luf])
+        {   /* if luf was set */
+          Ref.luf[luf] = -1;  /* assume it is NULL */
+
+          /* if dataluf non-NULL, set up to write */
+          if (sdg->dataluf[luf] && sdg->dataluf[luf][0])
+            {
+              HDstrcpy((char *) bufp, sdg->dataluf[luf]);
+              bufp += HDstrlen(bufp) + 1;
+            }
+          else
+            {     /* dataluf NULL */
+              *bufp++ = '\0';
+            }
+
+          /* for each dimluf, if non-NULL, set up to write */
+          for (i = 0; i < sdg->rank; i++)
+            {
+              if (sdg->dimluf[luf] && sdg->dimluf[luf][i]
+                  && sdg->dimluf[luf][i][0])
+                {   /* dimluf not NULL */
+                  HDstrcpy((char *) bufp, sdg->dimluf[luf][i]);
+                  bufp += HDstrlen(bufp) + 1;
+                }
+              else
+                {   /* dimluf NULL */
+                  *bufp++ = '\0';
+                }
+            }     /* i loop   */
+          Ref.luf[luf] = (intn)ref;     /* remember ref */
+          if ( Hputelement(file_id, luftag, (uint16) Ref.luf[luf], ptbuf, (int32) (bufp - ptbuf)) == FAIL)
+            HGOTO_ERROR(DFE_PUTELEM, FAIL);
+        }   /* luf was set */
+
+      /* write luf tag/ref */
+      if (Ref.luf[luf] > 0)
+        {
+          if (DFdiput(GroupID, luftag, (uint16) Ref.luf[luf]) < 0)
+            HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+        }
+    }     /* luf loop     */
+
+  /* check if there is a scale and write it out */
+  if (!Ref.scales)
+    {     /* if scale set */
+      Isscales = (uint8 *) HDmalloc((uint32) sdg->rank);
+      if (Isscales == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      Ref.scales = (-1);    /* assume there is no scale */
+
+      /* set up Isscales array */
+      for (i = 0; i < sdg->rank; i++)
+        {
+          if (sdg->dimscales && sdg->dimscales[i])
+            {     /* a scale exists */
+              Isscales[i] = 1;
+              Ref.scales = 0;   /* flag: write out scales */
+            }
+          else
+            Isscales[i] = 0;
+        }
+    }
+
+  if (!Ref.scales)
+    { /* write out scales */
+      /* compute space needed for scales */
+      len = 0;
+      for (i = 0; i < sdg->rank; i++)
+        {
+          if (Isscales[i] == 1)
+            len += (intn) (sdg->dimsizes[i] * scaleNTsize);
+        }
+      len += sdg->rank;
+
+      aid = Hstartwrite(file_id, DFTAG_SDS, ref, len);
+      if (aid == FAIL)
+        {
+          HDfree((VOIDP) Isscales);
+          HGOTO_ERROR(DFE_BADAID, FAIL);
+        }
+
+      /* write Isscales */
+      if (Hwrite(aid, (int32) sdg->rank, Isscales) == FAIL)
+        {
+          HDfree((VOIDP) Isscales);
+          HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+        }
+
+      /* Write scales */
+      for (j = 0; j < sdg->rank; j++)
+        {
+          if (!Isscales[j])
+            continue;
+          if (platnumsubclass == outNT)
+            {     /* no conversion needed */
+              if (Hwrite(aid, (int32) (fileNTsize * sdg->dimsizes[j]),
+                         (uint8 *) sdg->dimscales[j]) == FAIL)
+                {
+                  HDfree((VOIDP) Isscales);
+                  HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                }
+            }
+          else
+            {     /* convert and write */
+              /* allocate buffer */
+              buf = (uint8 *) HDmalloc((uint32) (fileNTsize * sdg->dimsizes[j]));
+              if (buf == NULL)
+                {
+                  HDfree((VOIDP) Isscales);
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                }
+              /* convert, all at once */
+              DFKconvert((VOIDP) sdg->dimscales[j], (VOIDP) buf, numtype,
+                         sdg->dimsizes[j], DFACC_WRITE, 0, 0);
+              /* write it all out */
+              if (Hwrite(aid, (int32) (fileNTsize * sdg->dimsizes[j]), buf)
+                  == FAIL)
+                {
+                  HDfree((VOIDP) Isscales);
+                  HDfree((VOIDP) buf);
+                  HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                }
+              HDfree((VOIDP) buf);
+            }
+        }
+
+      Ref.scales = (intn)ref;
+      Hendaccess(aid);
+    }
+  if (Isscales != NULL)
+     HDfree((VOIDP) Isscales);
+  Isscales = NULL;
+  if (Ref.scales > 0)
+    if (DFdiput(GroupID, DFTAG_SDS, (uint16) Ref.scales) < 0)
+      HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+  /* write coordsys */
+  if (!sdg->coordsys || !sdg->coordsys[0])
+    Ref.coordsys = (-1);
+  if (!Ref.coordsys)
+    {
+      if ( Hputelement(file_id, DFTAG_SDC, ref, (uint8 *) sdg->coordsys, (int32) (HDstrlen(sdg->coordsys) + 1)) == FAIL)
+          HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      Ref.coordsys = (intn)ref;
+    }
+  if (Ref.coordsys > 0)
+    {
+      if (DFdiput(GroupID, DFTAG_SDC, (uint16) Ref.coordsys) < 0)
+          HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+    }
+
+  /* write max/min */
+  if (!Ref.maxmin)
+    {
+      if (platnumsubclass == outNT)
+        {   /* no conversion */
+          if ( Hputelement(file_id, DFTAG_SDM, ref, (uint8 *) &(sdg->max_min[0]), (int32) (2 * fileNTsize)) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          Ref.maxmin = (intn)ref;
+        }
+      else
+        {
+          /* allocate buffer */
+          buf = (uint8 *) HDmalloc((size_t) (2 * fileNTsize));    /* max/min is 8 bytes */
+          if (buf == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* convert */
+          DFKconvert((VOIDP) &(sdg->max_min[0]), (VOIDP) buf,
+                     numtype, 2, DFACC_WRITE, 0, 0);
+
+          /* write */
+          if ( Hputelement(file_id, DFTAG_SDM, ref, buf, (int32) (2 * fileNTsize)) == FAIL)
+            {
+              HDfree((VOIDP) buf);
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+            }
+
+          Ref.maxmin = (intn)ref;
+          HDfree((VOIDP) buf);
+        }
+    }
+  if (Ref.maxmin > 0)
+    {
+      if (DFdiput(GroupID, DFTAG_SDM, (uint16) Ref.maxmin) < 0)
+          HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+    }
+  Ref.maxmin = (-1);  /* max/min should be reset for each data set */
+
+    /* Write calibration. */
+  if (!Ref.cal)
+    {
+      if (platnumsubclass == outNT)
+        {   /* no conversion */
+          if (Hputelement(file_id, DFTAG_CAL, ref,
+                          (unsigned char *) &sdg->cal,
+                          (int32) 36) < 0)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          Ref.cal = (intn)ref;
+        }
+      else
+        {
+          /* allocate buffer */
+          uint8       buf2[4 * sizeof(float64) + sizeof(int32)];
+
+          /* convert doubles */
+          DFKconvert((VOIDP) &sdg->cal, (VOIDP) buf2,
+                     DFNT_FLOAT64, 4, DFACC_WRITE, 0, 0);
+
+          /* convert int */
+          DFKconvert((VOIDP) &sdg->cal_type, (VOIDP) (buf2 + 32),
+                     DFNT_INT32, 1, DFACC_WRITE, 0, 0);
+
+          /* write it into the file */
+          if (Hputelement(file_id, DFTAG_CAL, ref,
+                          (unsigned char *) buf2, (int32) 36) < 0)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          Ref.cal = (intn)ref;
+
+        }
+    }
+
+  if (Ref.cal > 0)
+    {
+      if (DFdiput(GroupID, DFTAG_CAL, (uint16) Ref.cal) < 0)
+          HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+    }
+  Ref.cal = (-1);     /* Calibration should be reset for each data set */
+
+    /* Write fill value.  */
+  if (!Ref.fill_value)
+    {
+      if (platnumsubclass == outNT)
+        {   /* No conversion  */
+          if (Hputelement(file_id, DFTAG_FV, ref,
+                          (unsigned char *) sdg->fill_value,
+                          (int32) fileNTsize) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+          Ref.fill_value = (intn)ref;
+        }
+      else
+        {
+          /* Allocate buffer  */
+          uint8       buf2[DFSD_MAXFILL_LEN];
+
+          /* Convert from native to IEEE  */
+          DFKconvert((VOIDP) sdg->fill_value, (VOIDP) buf2,
+                     numtype, 1, DFACC_WRITE, 0, 0);
+
+          /* Write it into the file  */
+          if (Hputelement(file_id, DFTAG_FV, ref,
+                          (unsigned char *) buf2,
+                          (int32) fileNTsize) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+
+          Ref.fill_value = (intn)ref;
+        }
+    }
+
+  /* Check to add to DFgroup  */
+  if (Ref.fill_value > 0)
+    {
+      if (DFdiput(GroupID, DFTAG_FV, (uint16) Ref.fill_value) == FAIL)
+          HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+    }
+  Ref.fill_value = (-1);  /* Fill value should be reset for each data set  */
+
+  if (!Ref.transpose)
+    {     /* if transposed, add transpose tag */
+      if (Hdupdd(file_id, DFTAG_SDT, ref, DFTAG_SDD, ref) == FAIL)
+          HGOTO_ERROR(DFE_DUPDD, FAIL);
+      Ref.transpose = (intn)ref;
+    }
+  if (Ref.transpose > 0)
+    {
+      if (DFdiput(GroupID, DFTAG_SDT, (uint16) Ref.transpose) < 0)
+          HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+    }
+
+  if (numtype == DFNT_FLOAT32)
+    {     /* if float32, add a DFTAG_SDLNK   */
+      DFdi        lnkdd[2];
+
+      issdg = 1;
+      lnkdd[0].tag = DFTAG_NDG;
+      lnkdd[0].ref = ref;
+      lnkdd[1].tag = DFTAG_SDG;
+      lnkdd[1].ref = ref;
+      bufp = ptbuf;
+
+      for (i = 0; i < 2; i++)
+        {
+          UINT16ENCODE(bufp, lnkdd[i].tag);
+          UINT16ENCODE(bufp, lnkdd[i].ref);
+        }
+      if ( Hputelement(file_id, DFTAG_SDLNK, ref, ptbuf, (int32) (bufp - ptbuf)) == FAIL)
+          HGOTO_ERROR(DFE_PUTELEM, FAIL);
+
+      /* write DFTAG_SDLNK  */
+      if (DFdiput(GroupID, DFTAG_SDLNK, ref) < 0)
+          HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+    }
+
+  /* write out NDG */
+  if (DFdiwrite(file_id, GroupID, DFTAG_NDG, ref) < 0)
+      HGOTO_ERROR(DFE_GROUPWRITE, FAIL);
+
+  /* write an SDG point to the dataset if it is an NDG SDG  */
+  if (issdg)
+    {
+      if (Hdupdd(file_id, DFTAG_SDG, ref, DFTAG_NDG, ref) == FAIL)
+          HCLOSE_GOTO_ERROR(file_id,DFE_DUPDD, FAIL);
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIendslice
+ * Purpose: Write of data to SDG completed, write SDG and close file
+ * Inputs:  isfortran: true if called from Fortran
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   DFSDIputdata
+ * Invokes: DFSDputsdg, Hclose, HERROR
+ * Method:  call DFSDputsdg, close Sfile_id
+ * Remarks: checks that slice writes were completed.
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIendslice(intn isfortran)
+{
+  intn        i;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIendslice");
+
+  HEclear();
+
+  if (Sfile_id == DF_NOFILE)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* check if slice writes complete */
+  for (i = 0; i < Writesdg.rank; i++)
+    {
+      if (!Fortorder && (i == 0) && (Sddims[i] == Writesdg.dimsizes[i]))
+        continue;
+      if ((isfortran || Fortorder) && (i == Writesdg.rank - 1)
+          && (Sddims[i] == Writesdg.dimsizes[i]))
+        continue;
+      if ((isfortran || Fortorder || i > 0)
+          && (!Fortorder || i < Writesdg.rank - 1) && (Sddims[i] == 0))
+        continue;
+
+      HGOTO_ERROR(DFE_BADCALL, FAIL);
+    }
+
+  if (DFSDIputndg(Sfile_id, Writeref, &Writesdg) < 0)
+      HCLOSE_GOTO_ERROR(Sfile_id,DFE_INTERNAL,FAIL);
+
+  /* old nsdg table should be reset next time  */
+  if (nsdghdr != NULL)
+    {
+      if (nsdghdr->nsdg_t != NULL)
+        {
+          DFnsdgle   *rear, *front;
+
+          rear = nsdghdr->nsdg_t;
+          front = rear->next;
+          while (rear != NULL)
+            {
+              HDfreenclear(rear);
+              rear = front;
+              if (rear != NULL)
+                front = rear->next;
+            }
+          nsdghdr->size = 0;
+          nsdghdr->nsdg_t = NULL;
+          lastnsdg.tag = DFTAG_NULL;
+          lastnsdg.ref = 0;
+        }
+      HDfreenclear(nsdghdr);
+    }
+
+  Lastref = Writeref;     /* remember ref written */
+  Writeref = 0;   /* don't know ref to write next */
+
+  Hendaccess(Writesdg.aid);
+  ret_value = Hclose(Sfile_id);
+  Sfile_id = 0;   /* partial write complete */
+  HDfreenclear(Sddims);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/******************************************************************************/
+/*----------------------- Internal routines ---------------------------------*/
+/******************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIopen
+ * Purpose: open or reopen a file
+ * Inputs:  filename: name of file to open
+ *          acc_mode : access mode
+ * Returns: file id on success, -1 (FAIL) on failure with error set
+ * Users:   HDF systems programmers, many SD routines
+ * Invokes: DFopen
+ * Remarks: This is a hook for someday providing more efficient ways to
+ *          reopen a file, to avoid re-reading all the headers
+ *---------------------------------------------------------------------------*/
+int32
+DFSDIopen(const char *filename, intn acc_mode)
+{
+  int32       file_id;
+  int32       ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIopen");
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Sfile_id != DF_NOFILE)  /* in the middle of a partial write */
+    HGOTO_ERROR(DFE_ALROPEN, FAIL);
+
+    /* if last filename buffer has not been allocated
+     *    allocate buffer for "Lastfile" and open file
+     * else if same file as last time
+     *    use reopen - more efficient
+     *  else
+     *    open file for first time
+     */
+  if (Lastfile == NULL)
+    {
+      Lastfile = (char *) HDmalloc((DF_MAXFNLEN + 1) * sizeof(char));
+      if (Lastfile == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      /* open file */
+      if (( file_id = Hopen(filename, acc_mode, (int16) 0)) == FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+    }
+  else if ((HDstrcmp(Lastfile, filename)) || (acc_mode == DFACC_CREATE))
+    {     /* open a new file, delete nsdg table and reset lastnsdg  */
+      if (nsdghdr != NULL)
+        {
+          if (nsdghdr->nsdg_t != NULL)
+            {
+              DFnsdgle   *rear, *front;
+
+              rear = nsdghdr->nsdg_t;
+              while (rear != NULL)
+                {
+                  front = rear->next;
+                  HDfreenclear(rear);
+                  rear = front;
+                }
+              nsdghdr->size = 0;
+              nsdghdr->nsdg_t = NULL;
+              lastnsdg.tag = DFTAG_NULL;
+              lastnsdg.ref = 0;
+            }
+          HDfreenclear(nsdghdr);
+        }
+
+      /* treat create as different file */
+      if (( file_id = Hopen(filename, acc_mode, (int16) 0))== FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+      Newdata = (-1);   /* data in Readsdg is not fresh */
+      Readsdg.data.ref = 0;     /* No SDG read yet */
+
+      /* remember no info written to file */
+      Ref.scales = (Ref.scales >= 0) ? 0 : Ref.scales;
+      Ref.luf[LABEL] = (Ref.luf[LABEL] >= 0) ? 0 : Ref.luf[LABEL];
+      Ref.luf[UNIT] = (Ref.luf[UNIT] >= 0) ? 0 : Ref.luf[UNIT];
+      Ref.luf[FORMAT] = (Ref.luf[FORMAT] >= 0) ? 0 : Ref.luf[FORMAT];
+      Ref.dims = (Ref.dims >= 0) ? 0 : Ref.dims;
+      Ref.coordsys = (Ref.coordsys >= 0) ? 0 : Ref.coordsys;
+      Ref.maxmin = (Ref.maxmin >= 0) ? 0 : Ref.maxmin;
+      Ref.nt = (Ref.nt >= 0) ? 0 : Ref.nt;
+      Ref.transpose = (Ref.transpose >= 0) ? 0 : Ref.transpose;
+    }
+  else
+    {
+      if (( file_id = Hopen(filename, acc_mode, (int16) 0))== FAIL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+    }
+
+  /* if read, set up nsdg table */
+  if (nsdghdr == NULL)
+    {
+      nsdghdr = (DFnsdg_t_hdr *) HDmalloc((uint32) sizeof(DFnsdg_t_hdr));
+      if (nsdghdr == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      nsdghdr->size = 0;
+      nsdghdr->nsdg_t = NULL;
+    }
+  if ((nsdghdr->nsdg_t == NULL) && (acc_mode == DFACC_READ))
+    {
+      if (DFSDIsetnsdg_t(file_id, nsdghdr) < 0)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      lastnsdg.tag = DFTAG_NULL;
+      lastnsdg.ref = 0;
+    }
+
+  HIstrncpy(Lastfile, filename, DF_MAXFNLEN);
+  /* remember filename, so reopen may be used next time if same file */
+
+  ret_value = file_id;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIsdginfo
+ * Purpose: Locates next sdg in file
+ * Inputs:  file_id: pointer to DF file
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF systems programmers, DFSDgetdims, DFSDgetdata
+ * Invokes: DFIfind, DFSDIgetndg
+ * Method:  Call DFIfind to find SDG, then DFSDIgetndg to read it in to Readsdg
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIsdginfo(int32 file_id)
+{
+  DFdi        ptr;
+  CONSTR(FUNC, "DFSDIsdginfo");
+  int32       aid;
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!HDvalidfid(file_id))
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  if (Readref != 0)
+    {
+      aid = Hstartread(file_id, DFTAG_NDG, Readref);
+      if (aid != FAIL)
+        {
+          ptr.ref = Readref;
+          ptr.tag = DFTAG_NDG;
+          Hendaccess(aid);
+        }
+      else
+        {
+          aid = Hstartread(file_id, DFTAG_SDG, Readref);
+          if (aid != FAIL)
+            {
+              ptr.ref = Readref;
+              ptr.tag = DFTAG_SDG;
+              Hendaccess(aid);
+            }
+          else
+            HGOTO_ERROR(DFE_BADAID, FAIL);
+        }
+    }
+  else
+    {
+      if (DFSDInextnsdg(nsdghdr, &ptr) < 0)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      if ((ptr.tag != DFTAG_NDG) && (ptr.tag != DFTAG_SDG))
+        HGOTO_ERROR(DFE_BADTAG, FAIL);
+      if (ptr.ref == DFREF_WILDCARD)
+        HGOTO_ERROR(DFE_BADREF, FAIL);
+      Readref = ptr.ref;
+    }
+
+  /* find next sd object */
+  if (DFSDIgetndg(file_id, ptr.tag, ptr.ref, &Readsdg) < 0)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* remember what type of thing we just read */
+  Readsdg.isndg = (ptr.tag == DFTAG_NDG) ? 1 : 0;
+
+  Lastref = ptr.ref;  /* remember ref read */
+  lastnsdg.tag = ptr.tag;
+  lastnsdg.ref = ptr.ref;
+
+  Newdata = 1;    /* now Readsdg is fresh */
+  Readref = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIrefresh
+ * Purpose: get next sdg if Readsdg is not fresh
+ * Inputs:  filename
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF systems programmers, functions in dfsdF.c
+ * Invokes: DFSDIopen, DFSDIsdginfo
+ * Method:  test Newdata and Nextsdg, call DFSDIsdginfo if necessary
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIrefresh(char *filename)
+{
+  int32       file_id;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIrefresh");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata != 1 || Nextsdg)
+    {     /* if Readsdg not fresh  */
+      if (( file_id = DFSDIopen(filename, DFACC_READ))== FAIL)
+            HGOTO_ERROR(DFE_BADOPEN, FAIL);
+      if (DFSDIsdginfo(file_id) < 0)
+        HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL, FAIL);
+      if (Hclose(file_id) < 0)
+        HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+      Nextsdg = 0;
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIisndg
+ * Purpose: is the current read sds an sdg or nsdg/ndg
+ * Inputs:  isndg: 0 -- pure sdg( written by 3.1); 1 -- nsdg/ndg
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF systems programmers, functions in dfsdF.c
+ * Invokes: none
+ * Method:  Assigns Readsdg.isndg to isndg.
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIisndg(intn *isndg)
+{
+  intn ret_value = SUCCEED;
+
+  *isndg = (intn) Readsdg.isndg;
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIgetrrank
+ * Purpose: get rank of the current sdg, to transpose dims for Fortran
+ * Inputs:  &rank: address to return the rank
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF systems programmers, functions in dfsdF.c
+ * Invokes: none
+ * Method:  Assigns Readsdg.rank to rank.
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIgetrrank(intn *rank)
+{
+  intn  ret_value = SUCCEED;
+
+  *rank = (intn) Readsdg.rank;
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIgetwrank
+ * Purpose: get rank of the current sdg, to transpose dims for Fortran
+ * Inputs:  &rank: address to return the rank
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF systems programmers, functions in dfsdF.c
+ * Invokes: none
+ * Method:  Assigns Readsdg.rank to rank.
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIgetwrank(intn *rank)
+{
+  intn ret_value = SUCCEED;
+
+  *rank = (intn) Writesdg.rank;
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIclear
+ * Purpose: Reset all "set" values, free allocated space
+ * Inputs:  sdg: pointer to sdg struct to clear
+ * Globals: Ref
+ * Returns: 0 on success, FAIL on error with error set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: none
+ * Method:  Release space in sdg
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIclear(DFSsdg * sdg)
+{
+  intn        i;
+  intn        luf;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIclear");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Sfile_id != DF_NOFILE)  /* cannot clear during slice writes */
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  HDfreenclear(sdg->dimsizes);
+  HDfreenclear(sdg->coordsys);
+
+    /* free label/unit/format pointers */
+  for (luf = LABEL; luf <= FORMAT; luf++)
+    {
+      if (sdg->dimluf[luf])
+        {   /* free strings */
+          for (i = 0; i < sdg->rank; i++)
+            HDfreenclear(sdg->dimluf[luf][i]);
+        }
+
+      /* free string pointers */
+      HDfreenclear(sdg->dimluf[luf]);
+
+      /* free data string */
+      HDfreenclear(sdg->dataluf[luf]);
+    }
+
+  /* free scale pointers */
+  if (sdg->dimscales)
+    {
+      for (i = 0; i < sdg->rank; i++)
+        HDfreenclear(sdg->dimscales[i]);
+    }
+
+  /* free array of scale pointers */
+  HDfreenclear(sdg->dimscales);
+  sdg->rank = 0;
+
+    /* number type is independant to dimsizes   4/7/92  sxu
+       sdg->numbertype = DFNT_NONE;
+       sdg->filenumsubclass = DFNTF_NONE;
+     */
+  sdg->aid = (int32) -1;
+  sdg->compression = (int32) 0;
+  FileTranspose = 0;
+  sdg->fill_fixed = FALSE;    /* allow fill_value to be changed */
+
+  Ref.dims = -1;
+  Ref.scales = Ref.luf[LABEL] = Ref.luf[UNIT] = Ref.luf[FORMAT] = (-1);
+  Ref.coordsys = Ref.maxmin = (-1);
+  Ref.new_ndg = -1;
+  Ref.fill_value = -1;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIgetdata
+ * Purpose: Get data from SDG.  Will sequence to next SDG if DFSDgetdims not
+ *          called.
+ * Inputs:  filename: name of HDF file to use
+ *          rank: no of dimensions of array "data"
+ *          maxsizes: actual dimensions of array "data"
+ *          data: data for returning scientific data
+ *          isfortran : 0 if called from C, 1 when called from FORTRAN
+ * Returns: 0 on success, FAIL on failure with error set
+ * Outputs: actual scientific data in array
+ * Users:   DFSDgetdata
+ * Invokes: DFSDIgetslice, HDmalloc, HDfree, DFSDIopen, Hclose,
+ *          HERROR, DFSDIsdginfo
+ * Method:  Open file, call DFSDIsdginfo to read sdg if necessary, set up
+ *          window start and end arrays, call DFSDIgetslice.
+ * Remarks: maxsizes may be larger than actual size.  In that event, the actual
+ *          data may not be contiguous in the array "data"
+ *          User sets maxsizes before call.
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIgetdata(const char *filename, intn rank, int32 maxsizes[], VOIDP data,
+             intn isfortran)
+{
+  intn        i;
+  int32      *winst;
+  int32      *windims;
+  int32       file_id;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIgetdata");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata != 1 || Nextsdg)
+    {     /* if Readsdg not fresh */
+      if (( file_id = DFSDIopen(filename, DFACC_READ))== DF_NOFILE)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+      if (DFSDIsdginfo(file_id) < 0)
+        HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL, FAIL);
+      if (Hclose(file_id) == FAIL)
+        HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+    }
+
+  winst = (int32 *) HDmalloc((uint32) Readsdg.rank * sizeof(int32));
+  if (winst == NULL)
+    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+  windims = (int32 *) HDmalloc((uint32) Readsdg.rank * sizeof(int32));
+  if (windims == NULL)
+    {
+      HDfree((VOIDP) winst);
+      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+    }
+
+  for (i = 0; i < rank; i++)
+    {
+      winst[i] = 1;
+      windims[i] = Readsdg.dimsizes[i];
+    }
+
+  ret_value = DFSDIgetslice(filename, winst, windims, data, maxsizes, isfortran);
+  Nextsdg = 1;
+  HDfree((VOIDP) winst);
+  HDfree((VOIDP) windims);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFSDIputdata
+ * Purpose: Writes entire SDG to file
+ * Inputs:  filename: name of HDF file to use
+ *          rank: rank of data array
+ *          dimsizes: sizes of the dimensions of data array
+ *          data: array that holds data
+ *          accmode: 0 if write to new file, 1 if append to file
+ *          isfortran: 0 if C, 1 if FORTRAN
+ * Globals: Writeref
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFSDIopen, Hclose, HDmalloc, HDfree, DFSDIputslice,
+ *          DFSDstartslice, DFSDIendslice
+ * Method:  Create file if necessary, allocate arrays, call slice routines
+ *---------------------------------------------------------------------------*/
+intn
+DFSDIputdata(const char *filename, intn rank, int32 *dimsizes, VOIDP data,
+             intn accmode, intn isfortran)
+{
+  int32       file_id;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIputdata");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!accmode)
+    {     /* new file */
+      if (( file_id = DFSDIopen(filename, DFACC_CREATE))== DF_NOFILE)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+      if (Hclose(file_id) == FAIL)
+        HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+    }
+
+  if (Ref.dims)
+    {     /* don't call setdims if already called */
+      if (DFSDsetdims(rank, dimsizes) < 0)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+  if (DFSDstartslice(filename) < 0)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  if (DFSDIputslice(Writesdg.dimsizes, data, dimsizes, isfortran) < 0)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  ret_value = DFSDIendslice(isfortran);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name:    DFSDIgetslice
+ * Purpose: Get slice of data from SDG.  Will sequence to next SDG if
+ *          DFSDgetdims, DFSDgetdata or DFSDgetslice not called earlier.
+ * Inputs:  filename: name of HDF file to use
+ *          winst: array of size = rank of data, containing start of slice
+ *          windims: array of size rank, containing size of slice
+ *          data: array for returning slice
+ *          dims: dimensions of array data
+ *          isfortran : 0 if called from C, 1 when called from FORTRAN
+ * Returns: 0 on success, FAIL on failure with error set
+ * Outputs: slice of data in data
+ * Users:   DFSDIgetdata
+ * Invokes: DFSDIopen, Hclose, HERROR, DFSDIsdginfo, DFaccess, DFread
+ * Method:  Open file, call DFSDIsdginfo to read sdg if necessary, read the
+ *          data, convert types if necessary, place in data as appropriate
+ *          data is assumed column major for FORTRAN, row major for C
+ * Remarks: dims may be larger than size of slice.  In that event, the actual
+ *          data may not be contiguous in the array "data".
+ *          User sets dims before call.
+ *--------------------------------------------------------------------------*/
+
+/*****************************************************************************/
+/* DESIGN DECISIONS                                                          */
+/*****************************************************************************/
+/*
+   A. All stride/index/offset value will, when this is done -- refer to
+   element counts rather than byte counts in the name of consistency.
+
+   B. The conversion buffers/allcated areas... will all be char buffers --
+   providing that the Cray-2 is cooperative.
+ */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* CHANGE LOG                                                                */
+/*****************************************************************************/
+/*
+   A.
+ */
+/*****************************************************************************/
+intn
+DFSDIgetslice(const char *filename, int32 winst[], int32 windims[],
+              VOIDP data, int32 dims[], intn isfortran)
+{
+  intn        rank;           /* number of dimensions in data[] */
+  int32       leastsig;       /* fastest varying subscript in the array */
+  int32       error;          /* flag if an error occurred, */
+                              /*  used by DFconvert macro */
+  int32       convert;        /* true if machine NT != NT to be read */
+  int32       transposed;     /* true if we must transpose the data before writing */
+  int32       done;           /* true if we are at the end of the slice */
+  int32       aid;
+  int32       i, j;           /* temporary loop index */
+  int32       issdg;          /* 1 -- pure sdg. do what HDF3.1 does   */
+  int32      *wstart;         /* tmp array containing starting slice dims */
+  int32      *wdims;          /* tmp array containing the slice size */
+  int32      *adims;          /* tmp array containing the dimensions of data[] */
+  int32      *fdims;          /* tmp array containing the dimensions */
+                              /*  of the dataset in the file */
+  int32       numtype;        /* current number type  */
+  int32       fileNTsize;     /* size of this NT in the file  */
+  int32       localNTsize;    /* size of this NT as it occurs in this machine */
+  int32       numelements;    /* number of floats to read at once */
+  int32       readsize;       /* number of bytes to read at once */
+  int32       datastride;     /* number of floats in one row of data[] */
+  int32      *offset;         /* array for accessing the next element in data[] */
+  int32      *foffset;        /* array for accessing the next element in the file */
+  int32      *dimsleft;       /* array for tracking the current position in data[] */
+  int32       isnative;
+  int32       fileoffset;     /* offset into the current dataset in the file */
+  uint8       platnumsubclass;    /* class of this NT for this platform */
+  uint8       fileNT;         /* file number subclass */
+  uint8      *scatterbuf;     /* buffer to hold the current row contiguously */
+  uint8      *sp;             /* ptr into scatterbuf      */
+  uint8      *datap;          /* ptr into data[] at starting offset */
+                              /* of current block */
+  uint8      *dp;             /* ptr into data[] at an element of the current row */
+  uint8      *buf;            /* buffer containing the converted current row */
+  int32       file_id;        /* HDF file pointer */
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIgetslice");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (data == NULL)
+    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+  if (( file_id = DFSDIopen(filename, DFACC_READ))== DF_NOFILE)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  if (Newdata != 1)
+    {     /* if Readsdg not fresh */
+      if (DFSDIsdginfo(file_id) < 0) /* reads next SDG from file */
+        HCLOSE_GOTO_ERROR(file_id,DFE_INTERNAL, FAIL);
+    }
+  rank = Readsdg.rank;
+  numtype = Readsdg.numbertype;
+  fileNT = Readsdg.filenumsubclass;
+  issdg = Readsdg.isndg ? 0 : 1;
+  isnative = DFNT_NATIVE;
+  localNTsize = DFKNTsize((numtype | isnative) & (~DFNT_LITEND));
+  fileNTsize = DFKNTsize(numtype);
+  platnumsubclass = (uint8)DFKgetPNSC(numtype & (~DFNT_LITEND), (int32)DF_MT);
+
+  /* get dimensions of slice to extract, set nwindims. also err check */
+  for (i = 0; i < (int32) rank; i++)
+    {
+      /* check validity for the dimension ranges */
+      if ((windims[i] < 1) || (winst[i] < 1)
+          || (winst[i] + windims[i] - 1 > Readsdg.dimsizes[i]))
+        {
+          HCLOSE_GOTO_ERROR(file_id, DFE_BADDIM, FAIL);
+        }
+      /* check if space allocated is sufficient */
+      if (dims[i] < windims[i])
+        {
+          HCLOSE_GOTO_ERROR(file_id, DFE_NOTENOUGH, FAIL);
+        }
+    }
+  /* allocate buffers */
+  wstart = (int32 *) HDmalloc((size_t) (4 * rank) * sizeof(int32));
+  if (wstart == NULL)
+    {
+      HCLOSE_GOTO_ERROR(file_id, DFE_NOSPACE, FAIL);
+    }
+  wdims = wstart + rank;
+  adims = wdims + rank;
+  fdims = adims + rank;
+
+  /* copy arrays to private workspace (so that they are in row major order) */
+  for (i = 0; i < (int32) rank; i++)
+    {
+      int32       ii = (issdg && isfortran) ? rank - i - 1 : i;
+
+      adims[i] = dims[ii];
+      ii = (issdg && FileTranspose) ? rank - i - 1 : i;
+      wstart[i] = winst[ii] - 1;    /* translate to 0 origin */
+      wdims[i] = windims[ii];
+      fdims[i] = Readsdg.dimsizes[ii];
+    }
+
+  convert = (fileNT != platnumsubclass);  /* is conversion necessary */
+  transposed = issdg && (isfortran ^ FileTranspose);  /* is transposition needed */
+
+  /*
+   * Note that if the data is transposed we must work on a row by row
+   * basis and cannot collapse dimensions.
+   */
+  if (!transposed)
+    {
+      /* collapse dimensions if contiguous both in the file and in memory */
+      for (i = (int32) rank - 1; i > 0; i--)
+        {   /* stop before most sig dim */
+          if (adims[i] > wdims[i]     /* not all of data[] will be filled */
+              || wstart[i] != 0   /* reading only part of the dataset */
+              || wdims[i] < fdims[i])
+            {
+              break;
+            }
+          wstart[i - 1] *= fdims[i];
+          wdims[i - 1] *= wdims[i];
+          adims[i - 1] *= adims[i];
+          fdims[i - 1] *= fdims[i];
+          rank--;
+        }
+    }
+  leastsig = (int32) rank - 1;    /* which is least sig dim */
+
+  /* position at start of data set */
+  aid = Hstartread(file_id, Readsdg.data.tag, Readsdg.data.ref);
+  if (aid == FAIL)
+    {
+      HDfree((VOIDP) wstart);
+      HCLOSE_GOTO_ERROR(file_id,DFE_BADAID, FAIL);
+    }
+
+  error = 0;
+  if (rank == 1 && !convert)
+    {
+      /* all data is contiguous with no conversions */
+      readsize = adims[0] * fileNTsize;
+      if ((Hseek(aid, wstart[0] * fileNTsize, 0) == FAIL)
+          || (readsize != Hread(aid, readsize, (uint8 *) data)))
+        {
+          error = 1;
+        }
+    }
+  else
+    {
+      /*
+       * The data must be further manipulated.
+       * It may be transposed, may need conversion, may not be contiguous, or
+       * any combination of these.
+       */
+      numelements = wdims[leastsig];
+      readsize = numelements * fileNTsize;
+
+      /* allocate 1 row buffers */
+      if (convert)
+        {
+          if ((buf = (uint8 *) HDmalloc((uint32) readsize)) == NULL)
+            {
+              HDfree((VOIDP) wstart);
+              Hendaccess(aid);
+              HCLOSE_GOTO_ERROR(file_id, DFE_NOSPACE, FAIL);
+            }
+        }
+      else
+        buf = NULL;
+
+      if (transposed)
+        {
+          scatterbuf =
+            (uint8 *) HDmalloc((size_t) (numelements * localNTsize));
+
+          if (scatterbuf == NULL)
+            {
+              HDfree((VOIDP) wstart);
+              HDfree((VOIDP) buf);
+              Hendaccess(aid);
+              HCLOSE_GOTO_ERROR(file_id, DFE_NOSPACE, FAIL);
+            }
+        }
+      else
+        scatterbuf = NULL;
+
+      offset = (int32 *) HDmalloc((size_t) (3 * rank) * sizeof(int32));
+      if (offset == NULL)
+        {
+          HDfree((VOIDP) wstart);
+          HDfree((VOIDP) buf);
+          HDfree((VOIDP) scatterbuf);
+          Hendaccess(aid);
+          HCLOSE_GOTO_ERROR(file_id, DFE_NOSPACE, FAIL);
+        }
+      foffset = offset + rank;
+      dimsleft = foffset + rank;
+
+      /* compute initial position in the data */
+      for (i = leastsig; i >= 0; i--)
+        dimsleft[i] = wdims[i];
+
+      /* compute offsets in the source array */
+      if (transposed)
+        {
+          offset[0] = 1 * localNTsize;
+          for (i = 0; i < leastsig; i++)
+            offset[i + 1] = offset[i] * adims[leastsig - i];
+        }
+      else
+        {
+          offset[leastsig] = 1 * localNTsize;
+          for (i = leastsig; i > 0; i--)
+            offset[i - 1] = offset[i] * adims[i];
+        }
+      datastride = offset[leastsig];
+
+      /* compute offsets in the file */
+      for (i = leastsig, foffset[i] = 1 * fileNTsize; i > 0; i--)
+        foffset[i - 1] = foffset[i] * fdims[i];
+
+       /*
+        * Compute starting position in file
+        * All file reads are done relative to this starting offset.
+        * Cumulative offset is from most sig to next to least sig dim.
+        */
+      for (i = 0, fileoffset = 0; i < leastsig; i++)
+        fileoffset = (fileoffset + wstart[i]) * fdims[i + 1];
+      fileoffset += wstart[leastsig];   /* adjust for last dim */
+      fileoffset *= fileNTsize;     /* convert to bytes */
+
+      datap = (uint8 *) data;
+      done = 0;
+      /* -- now read in the data */
+      do
+        {
+          /* move to the next data element in the file */
+          if (Hseek(aid, fileoffset, 0) == FAIL)
+            {
+              error = 1;
+              break;
+            }
+
+          /* read and convert one contiguous block of data */
+          if (convert)
+            {
+              if (readsize != Hread(aid, readsize, buf))
+                {
+                  error = 1;
+                  break;
+                }
+              DFKconvert((VOIDP) buf, transposed ? (VOIDP) scatterbuf :
+                         (VOIDP) datap, numtype, numelements, DFACC_READ, 0, 0);
+            }
+          else
+            {
+              if (readsize != Hread(aid, readsize,
+                                    transposed ? scatterbuf : datap))
+                {
+                  error = 1;
+                  break;
+                }
+            }
+          if (transposed)
+            {
+              /* scatter out the elements of one row */
+              for (dp = datap, sp = scatterbuf, i = 0; i < numelements; i++)
+                {
+                  for (j = 0; j < localNTsize; j++)
+                    *(dp + j) = *(sp + j);
+                  sp += localNTsize;
+                  dp += datastride;
+                }
+            }
+
+          /*
+           * Find starting place of the next row/block.
+           * Note that all moves are relative:
+           *   this preserves the starting offsets of each dimension
+           */
+          for (i = leastsig - 1; i >= 0; i--)
+            {
+              if (--dimsleft[i] > 0)
+                {
+                  /* move to next element in the current dimension */
+                  datap += offset[i];
+                  fileoffset += foffset[i];
+                  break;
+                }
+              else
+                {
+                  dimsleft[i] = wdims[i];
+                  /*
+                   * Note that we are still positioned at the beginning of
+                   * the last element in the current dimension
+                   */
+                  /* move back to the beginning of dimension i */
+                  datap -= offset[i] * (wdims[i] - 1);
+                  /* move back to beginning read position of dimension i */
+                  fileoffset -= foffset[i] * (wdims[i] - 1);
+                  if (i == 0)
+                    done = 1;
+                }
+            }
+        }
+      while (!done && leastsig > 0);
+
+      if (buf != NULL)
+         HDfree((VOIDP) buf);
+      if (scatterbuf != NULL)
+         HDfree((VOIDP) scatterbuf);
+      if (offset != NULL)
+         HDfree((VOIDP) offset);
+    }
+
+  Hendaccess(aid);
+  HDfree((VOIDP) wstart);
+  if (error)
+    {
+      Hclose(file_id);
+      ret_value = FAIL;
+    }
+  else
+    ret_value = Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ * Name:    DFSDIputslice
+ * Purpose: Put slice of data to SDG.
+ * Inputs:  windims: array of size rank, containing size of slice
+ *          data: array containing slice
+ *          dims: dimensions of array data
+ *          isfortran: 0 for C, 1 for Fortran
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   DFSDputslice
+ * Invokes: DFwrite, HDmalloc, HDfree,DFKnumout(if conversion
+        required)
+ * Method:  check dimensions for contiguity, convert types if necessary
+ *          write to file
+ * Remarks: dims may be larger than size of slice.  In that event, the actual
+ *          data may not be contiguous in the array "data".
+ *          DFSDstartslice must have been called first
+ *          If DFKnumout is called, DFSDsetNT may need to have been
+ *      called
+ *      Note, writes must be contiguous - successive calls to putslice
+ *          must write out array consecutively, according to the setting
+ *          of the Fortorder variable - row major if 0, column major if 1
+ *--------------------------------------------------------------------------*/
+intn
+DFSDIputslice(int32 windims[], VOIDP data, int32 dims[], intn isfortran)
+{
+  intn        rank;           /* number of dimensions in data[] */
+  int32       leastsig;       /* fastest varying subscript in the array */
+  int32       convert;        /* true if machine NT = NT to be written */
+  int32       contiguous;     /* true if there are no gaps in the data to be written */
+  int32       numtype;        /* current number type */
+  int32       platnumsubclass;    /* class of this NT for this platform */
+  int32       fileNTsize;     /* size of this NT as it will be in the file */
+  int32       fileNT;         /* class of NT for the data to write */
+  int32       isnative;
+  int32       localNTsize;    /* size of this NT as it occurs in theis machine */
+  int32       ret = SUCCEED;  /* return code from DFwrite */
+  int32       i, j;           /* temporaries */
+  int32       numelements;    /* number of elements to write out per row */
+  int32       writesize;      /* number of bytes to write out per row */
+  int32       datastride;     /* number of bytes in one row of data[] */
+  uint8      *datap;          /* pointer into data[] at */
+                                /*  the start of the current row */
+  uint8      *buf;            /* buffer containing converted current row */
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDIputslice");
+
+  /* shut compiler up */
+  isfortran = isfortran;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (!data)
+    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+  if (Sfile_id == DF_NOFILE)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  rank = Writesdg.rank;
+
+  for (i = 0; i < (int32) rank; i++)
+    {
+      /* check validity for the dimension ranges */
+      if ((windims[i] <= 0) || (windims[i] > Writesdg.dimsizes[i]))
+        HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+          /* check if space allocated is sufficient */
+      if (dims[i] < windims[i])
+        HGOTO_ERROR(DFE_NOTENOUGH, FAIL);
+    }
+
+  /* check to see if the slices fit together */
+  /* Same for Fortran or C    */
+  /* find the first significant dimension */
+  for (i = 0; windims[i] == 1 && i < (int32) rank - 1; i++)
+    /* empty */ ;
+  /* check that all 'lesser' dims match */
+  for (j = i + 1; j < (int32) rank; j++)
+    {
+      if (Writesdg.dimsizes[j] != windims[j])
+        HGOTO_ERROR(DFE_BADDIM, FAIL);
+    }
+
+  /* update Sddims to reflect new write */
+  Sddims[i] += windims[i];
+  for (; i > 0 && Sddims[i] >= Writesdg.dimsizes[i]; i--)
+    {
+      Sddims[i - 1] += Sddims[i] / Writesdg.dimsizes[i];
+      /* promote the unit */
+      Sddims[i] %= Writesdg.dimsizes[i];
+    }
+
+  leastsig = (int32) rank - 1;    /* which is least sig dim */
+  numtype = Writesdg.numbertype;
+
+  /* get class of this num type for this platform */
+  fileNT = (int32)Writesdg.filenumsubclass;
+  isnative = DFNT_NATIVE;
+  fileNTsize = DFKNTsize(numtype);
+  localNTsize = DFKNTsize((numtype | isnative) & (~DFNT_LITEND));
+  platnumsubclass = (int32)DFKgetPNSC(numtype & (~DFNT_LITEND), (int32)DF_MT);
+  convert = (platnumsubclass != fileNT);
+
+  contiguous = 1;
+  for (i = 0; contiguous && i < (int32) rank; i++)
+    {
+      /* check if data at the end of the users array will be contiguous */
+      if (dims[i] > Writesdg.dimsizes[i])
+        contiguous = 0;
+      /* Note: if a winstart[] array is ever added, will also need */
+      /*      to check if data at start of users array will be */
+      /*      contig                  */
+    }
+
+  /*
+     *  2 Factors that determine how we write (in order of importance)
+     *  conversion and contiguous
+     */
+  datap = (uint8 *) data;
+  if (!convert && contiguous)
+    {
+      /* compute total number of elements to write */
+      for (i = 0, numelements = 1; i < (int32) rank; i++)
+        numelements *= windims[i];
+      writesize = numelements * fileNTsize;
+
+      if ( Hwrite(Writesdg.aid, writesize, (uint8 *) data) == FAIL)
+            HCLOSE_GOTO_ERROR(Sfile_id,DFE_WRITEERROR, FAIL);
+    }
+  else
+    {     /* must step through the data */
+      /* compute number of occurrences of the least sig dim */
+      if (Fortorder)
+        {
+          for (i = (int32) rank - 1, j = 1; i > 0; i--)
+            j *= windims[i];
+        }
+      else
+        {
+          for (i = 0, j = 1; i < (int32) rank - 1; i++)
+            j *= windims[i];
+        }
+
+      numelements = windims[leastsig];
+      writesize = numelements * fileNTsize;
+      datastride = dims[leastsig] * localNTsize;
+      if (convert)
+        {
+          buf = (uint8 *) HDmalloc((uint32) writesize);
+          if (buf == NULL)
+            HCLOSE_GOTO_ERROR(Sfile_id,DFE_NOSPACE, FAIL);
+          for (i = 0; i < j; i++, datap += datastride)
+            {
+              DFKconvert((VOIDP) datap, (VOIDP) buf, numtype,
+                         numelements, DFACC_WRITE, 0, 0);
+              ret = Hwrite(Writesdg.aid, writesize, buf);   /* done */
+              if (ret == FAIL)
+                {
+                  HDfree((VOIDP) buf);
+                  HCLOSE_GOTO_ERROR(Sfile_id,DFE_WRITEERROR, FAIL);
+                }
+            }
+          HDfree((VOIDP) buf);
+        }
+      else
+        {   /* !contiguous      */
+          for (i = 0; i < j; i++, datap += datastride)
+              if ( Hwrite(Writesdg.aid, writesize, datap) == FAIL)
+                  HCLOSE_GOTO_ERROR(Sfile_id,DFE_WRITEERROR, FAIL);
+        }
+    }
+
+  ret_value = (ret >= 0 ? 0 : -1);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDgetcal
+ USAGE
+       int DFSDgetcal(pcal, pcal_err, pioff, pioff_err, cal_nt)
+       float64 *pcal;       OUT: calibration factor
+       float64 *pcal_err;   OUT: calibration error value
+       float64 *pioff;      OUT: uncalibrated offset value
+       float64 *pioff_err;  OUT: uncalibrated offset error value
+       int32   *cal_nt;     OUT: Nunber type of uncalibrated data
+
+ RETURNS
+       Returns SUCCED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       This routine reads the calibration record, if there is one, attached
+       to the scientific data set. A calibration record contains four 64-bit
+       floating point values followed by a 32-bit integer, to be interpreted
+       as follows:
+
+            cal        - calibration factor
+            cal_err    - calibration error
+            offset     - uncalibrated offset
+            offset_err - uncalibrated offset error
+            num_type   - number type of uncalibrated data
+
+       The relationship between a value 'iy' stored in a data set and the
+       actual value 'y' is defined as:
+
+            y = cal * (iy - offset)
+
+       The variable "offset_err" contains a potential error of offset,
+       and "cal_err" contains a potential error of "cal". Currently the
+       calibration record is provided for information only. The DFSD
+       interface performs no operations on the data based on the calibration
+       tag.
+
+----------------------------------------------------------------------------*/
+intn
+DFSDgetcal(float64 *pcal, float64 *pcal_err, float64 *pioff,
+           float64 *pioff_err, int32 *cal_nt)
+{
+  intn      ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDgetcal");
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  if (IsCal)
+    {
+      *pcal = Readsdg.cal;
+      *pcal_err = Readsdg.cal_err;
+      *pioff = Readsdg.ioff;
+      *pioff_err = Readsdg.ioff_err;
+      *cal_nt = Readsdg.cal_type;
+      ret_value = SUCCEED;
+    }
+  else
+    HGOTO_ERROR(DFE_NOVALS, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* DFSDgetcal */
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetcal
+ USAGE
+       intn DFSDsetcal(cal, cal_err, ioff, ioff_err, cal_nt)
+       float64 cal;         IN: calibration factor
+       float64 cal_err;     IN: calibration error
+       float64 ioff;        IN: uncalibrated offset
+       float64 ioff_err;    IN: uncalibrated offset error
+       int32   cal_nt;      IN: number type of uncalibrated data
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Sets the calibration information associated with data. This routine
+       sets the calibration record attached to a data set. A calibration
+       record contains four 64-bit floating point values followed by a
+       32-bit integer, to be interpreted as follows:
+
+            cal        - calibration factor
+            cal_err    - calibration error
+            offset     - uncalibrated offset
+            offset_err - uncalibrated offset error
+            num_type   - number type of uncalibrated data
+
+       The relationship between a value 'iy' stored in a data set and the
+       actual value 'y' is defined as:
+
+            y = cal * (iy - offset)
+
+       The variable "offset_err" contains a potential error of offset,
+       and "cal_err" contains a potential error of "cal". Currently the
+       calibration record is provided for information only. The DFSD
+       interface performs no operations on the data based on the calibration
+       tag. "DFSDsetcal" works like other "DFSDset*" routines, with one
+       exception: the calibration information is automatically cleared
+       after a call to "DFSDputdata" or "DFSDadddata". Hence, "DFSDsetcal"
+       must be called anew for each data set that is to be written.
+----------------------------------------------------------------------------*/
+intn
+DFSDsetcal(float64 cal, float64 cal_err, float64 ioff, float64 ioff_err,
+           int32 cal_nt)
+{
+    CONSTR(FUNC, "DFSDsetcal");
+  intn    ret_value = SUCCEED;
+
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  Writesdg.cal = (float64) cal;
+  Writesdg.cal_err = (float64) cal_err;
+  Writesdg.ioff = (float64) ioff;
+  Writesdg.ioff_err = (float64) ioff_err;
+  Writesdg.cal_type = (int32) cal_nt;
+
+  Ref.cal = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDwriteref
+ USAGE
+       int DFSDwriteref(filename, ref)
+       char   *filename;  IN: HDF file to write to
+       uint16 ref;        IN: reference number for the next writing of data
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Specifies the data set to be written to next by using the reference
+       number. Note that there is no gaurantee that reference numbers appear
+       in sequence in and HDF file; therefore, it is not safe to assume
+       that a reference number is the sequence number for a data set.
+-----------------------------------------------------------------------------*/
+intn
+DFSDwriteref(const char *filename, uint16 ref)
+{
+  int32       file_id;
+  int32       aid;
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDwriteref");
+
+  /* Clear error stack */
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Open file for read access */
+  if (( file_id = DFSDIopen(filename, DFACC_READ))== DF_NOFILE)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  /* Check for existence of SDG */
+  if ((aid = Hstartread(file_id, DFTAG_SDG, ref)) == FAIL
+      && (aid = Hstartread(file_id, DFTAG_NDG, ref)) == FAIL)
+    {
+      HCLOSE_GOTO_ERROR(file_id, DFE_NOMATCH, FAIL);
+    }
+
+  /*
+   ** Probably need to call DFSDgetndg to intialize Writesdg struct
+   ** This is so that we use the information of an SDG that has
+   ** already been written out. Once a SDG has been written out,
+   ** a user should not be able to change attributes such as
+   ** numbertype, dimensions or fill value.
+  */
+  if ((DFSDIgetndg(file_id, DFTAG_SDG, ref, &Writesdg) < 0)
+      && (DFSDIgetndg(file_id, DFTAG_NDG, ref, &Writesdg) < 0))
+    {
+      Hendaccess(aid);
+      HCLOSE_GOTO_ERROR(file_id, DFE_INTERNAL, FAIL);
+    }
+
+  /* Close access to file, set Writeref */
+  Hendaccess(aid);
+  Writeref = ref;
+  Lastref = ref;
+
+  ret_value = Hclose(file_id);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDsetfillvalue
+ USAGE
+       int DFSDsetfillvalue(fill_value)
+       VOID *fill_value;     IN: number to be stored in any unwritten locations
+                                 of the scientific data set
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Set the value used to fill in any unwritten location in a scientific
+       data set. Since the data is written in hyperslabs, it is possible
+       that not alof the possible locations in a given data set are written
+       to. The fill value is placed into all unwritten locations. The value
+       gets written if the following "DFSDwriteslab" call is the first
+       call to the data set i.e. the data set is created. It is assumed that
+       the fille value has the same number type as the data set.
+ WARNING
+       Memory bug on SGI's if you try to free allocated space for fill values.
+-----------------------------------------------------------------------------*/
+intn
+DFSDsetfillvalue(VOIDP fill_value)
+{
+  int32       numtype;        /* current number type  */
+  uint32      localNTsize;    /* size of this NT on as it is on this machine  */
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDsetfillvalue");
+
+  /* Clear error stack  */
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Check to see if fill value written out already */
+  if (Ref.fill_value == -1 && Writesdg.fill_fixed == TRUE)
+    {
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+  else
+    {
+      /* Get local and file number type sizes  */
+      numtype = Writesdg.numbertype;
+      localNTsize = (uint32)DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+
+      /* Set fill value in Writesdg struct, and set fill value flag  */
+      Ref.fill_value = 0;
+      if (HDmemcpy(Writesdg.fill_value, fill_value, localNTsize) != NULL)
+        ret_value = SUCCEED;
+      else
+        ret_value = FAIL;
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDgetfillvalue
+ USAGE
+       int DFSDgetfillvalue(fill_value)
+       VOID *fill_value;    OUT: Number to be stored in any unwritten
+                                 locations of the scientific data set
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+      Gets the value used to fill any unwritten location in a scientific
+      data set. The value is set by "DFSDsetfillvalue". Note that a call
+      that initializes file information structures such as "DFSDgetdims"
+      is required in order for "DFSDgetfillvalue" to succeed. This is because
+      "DFSDgetfillvalue" does not take a file name as an arguement.
+-----------------------------------------------------------------------------*/
+intn
+DFSDgetfillvalue(VOIDP fill_value)
+{
+  int32       numtype;        /* current number type  */
+  uint32      localNTsize;    /* size of this NT on as it is on this machine  */
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDgetfillvalue");
+
+  /* Clear error stack  */
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Check if Readsdg is fresh  */
+  if (Newdata < 0)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+    /* Get local number type size  */
+  numtype = Readsdg.numbertype;
+  localNTsize = (uint32)DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+
+    /* Set return fill value  */
+  if (HDmemcpy(fill_value, Readsdg.fill_value, localNTsize) != NULL)
+    ret_value = SUCCEED;
+  else
+    ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDreadslab
+ USAGE
+       int DFSDreadslab(filename, start, slab_size, stride, buffer, buffer_size)
+       char *filename;       IN: name of HDF file to write to
+       int32 start[];        IN: array of size rank containing the coordinates
+                                 for the start of the slab of data
+       int32 slab_size[];    IN: array of size rank containing the size of
+                                 each dimension in the slab of data
+       int32 stride[];       IN: sub-sampling stride(not implemented)
+       VOIDP buffer;         OUT: buffer to hold the extracted slab of data
+       int32 buffer_size[];  OUT: array containing the dimensions of the buffer
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Reads a sub-array of data from a scientific data set. "DFSDreadslab"
+       will sequence to the next scientific data set if "DFSDgetdims" or
+       "DFSDgetdata" is not called earlier. The "start[]" indices are relative
+       to 1. The rank(size) of "start[]" must be the same as the number of
+       dimensions of the specified variable. The elements of "slab_size[]"
+       must be no larger than the dimensions of the scientific data set.
+       The stride feature is not currently implemented. For now just pass
+       the "start[]" array as the arguement for "stride[]" where it will be
+       ignored. To extract a slab of lower dimension than that of the data
+       set, enter 1 in the "slab_size[] array for each ommitted dimension.
+       For example, to extract a 2D slab from a 3D data set, specify the
+       beginning coordiantes in 3 dimensions in "start[]" and enter a 1 for
+       the for the missing dimension in the array "slab_size[]". More
+       specifically, to extract a 3x4 slab containing the elements (6,7,8)
+       through (8.7,11) specify the begining coordiantes as {6,7,8} and
+       the slab size as {3,1,4}.
+-----------------------------------------------------------------------------*/
+intn
+DFSDreadslab(const char *filename, int32 start[], int32 slab_size[],
+             int32 stride[], VOIDP buffer, int32 buffer_size[])
+{
+  intn  ret_value = SUCCEED;
+  /* shut compiler up */
+  stride = stride;
+
+  ret_value = (DFSDgetslice(filename, start, slab_size, buffer, buffer_size));
+
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDstartslab
+ USAGE
+       int DFSDstartslab(filename)
+       char *filename;    IN: name of HDF file to write to
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Prepares the DFSD interface to write a slab(s) od data to a scientific
+       data set. "DFSDsetdims" must be called before calling "DFSDstartslab".
+       No call which needs to open a file may be made after a "DFSDstartslab"
+       call until "DFSDendslab" is called. This routine will write out the
+       fill values if "DFSDsetfillvalue" is called before this routine and
+       this is the first write(i.e. creation) to the data set.
+-----------------------------------------------------------------------------*/
+intn
+DFSDstartslab(const char *filename)
+{
+  int32       i;
+  int32       sdg_size;
+  int32       localNTsize;
+  int32       fileNTsize;
+  int32       fill_bufsize = 16384;   /* Chosen for the PC */
+  int32       odd_size;
+  uint8      *fill_buf;
+  uint8       platnumsubclass;
+  uint8       outNT;          /* file number type subclass */
+  intn       ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDstartslab");
+
+  /* Clear errors */
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Check rank set i.e. DFSDsetdims()  */
+  if (!Writesdg.rank)
+    HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+  /* If NT not set(i.e. DFSDsetNT() not called), default to float32  */
+  if (Writesdg.numbertype == DFNT_NONE)
+    DFSDsetNT(DFNT_FLOAT32);
+
+  /* Open file */
+  if (( Sfile_id = DFSDIopen(filename, DFACC_WRITE))== DF_NOFILE)
+    HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+  /*
+  ** Check for Writeref set i.e. DFSDwriteref() called?
+  ** If not Writeref then we create a new Writeref i.e new SDG
+  ** Else use existing one.
+  */
+  /* Set tag, ref of SDG to write */
+  Writesdg.data.tag = DFTAG_SD;
+  if (!Writeref)
+    Writeref = Hnewref(Sfile_id);
+  if (!Writeref)
+    HGOTO_ERROR(DFE_BADREF, FAIL);
+  Writesdg.data.ref = Writeref;
+
+  /* Intialize a few local variables */
+  localNTsize = DFKNTsize((Writesdg.numbertype | DFNT_NATIVE) & (~DFNT_LITEND));
+  fileNTsize = DFKNTsize(Writesdg.numbertype);
+
+  /* Calculate size of of dataset */
+  sdg_size = fileNTsize;
+  for (i = 0; i < Writesdg.rank; i++)
+    sdg_size *= Writesdg.dimsizes[i];
+
+  /* set up to write data */
+  Writesdg.aid = Hstartwrite(Sfile_id, DFTAG_SD, Writeref, sdg_size);
+  if (Writesdg.aid == FAIL)
+    HCLOSE_GOTO_ERROR(Sfile_id,DFE_BADAID, FAIL);
+
+  /*
+   ** Check if fill value is set
+  */
+  if (!Ref.fill_value)
+    {
+      /* make the fill buffer smaller if possible */
+      if (fill_bufsize > sdg_size && localNTsize == fileNTsize)
+        fill_bufsize = sdg_size;
+
+          /* Allocate space for fill buffer */
+      if ((fill_buf = (uint8 *) HDmalloc((uint32) fill_bufsize)) == NULL)
+        {
+          Hendaccess(Writesdg.aid);
+          HCLOSE_GOTO_ERROR(Sfile_id,DFE_NOSPACE, FAIL);
+        }
+
+      /* Get number types and compare */
+      outNT = Writesdg.filenumsubclass;
+      platnumsubclass = (uint8)DFKgetPNSC(Writesdg.numbertype, (int32)DF_MT);
+
+      if (platnumsubclass != outNT)
+        {   /* conversion  */
+          /* Allocate buffer  */
+          uint8       buf2[DFSD_MAXFILL_LEN];
+
+          /* Convert from native to IEEE  */
+          DFKconvert((VOIDP)&Writesdg.fill_value, (VOIDP) buf2,
+                     Writesdg.numbertype, 1, DFACC_WRITE, 0, 0);
+
+          /* Intialize buffer to fill value */
+          for (i = 0; i < fill_bufsize; i = i + localNTsize)
+              HDmemcpy(&(fill_buf[i]), buf2, localNTsize);
+
+        }
+      else /* no conversion */
+        {
+            /* Intialize buffer to fill value */
+            for (i = 0; i < fill_bufsize; i = i + localNTsize)
+                HDmemcpy(&(fill_buf[i]), Writesdg.fill_value, localNTsize);
+        }
+
+
+      /* Write fill values */
+      if (sdg_size <= fill_bufsize)
+        odd_size = sdg_size;
+      else
+        {
+          odd_size = sdg_size % fill_bufsize;
+          for (i = 0; i < (sdg_size / fill_bufsize); i++)
+            {     /* Write out fill buffer X times */
+              if (Hwrite(Writesdg.aid, fill_bufsize, fill_buf) == FAIL)
+                {
+                  Hendaccess(Writesdg.aid);
+                  HDfree((VOIDP) fill_buf);
+                  HCLOSE_GOTO_ERROR(Sfile_id,DFE_WRITEERROR, FAIL);
+                }
+            }
+        }
+      /* Write fill values for odd size piece */
+      if (Hwrite(Writesdg.aid, odd_size, fill_buf) == FAIL)
+        {
+          Hendaccess(Writesdg.aid);
+          HDfree((VOIDP) fill_buf);
+          HCLOSE_GOTO_ERROR(Sfile_id,DFE_WRITEERROR, FAIL);
+        }
+
+      Writesdg.fill_fixed = TRUE;   /* fill value cannot be changed */
+      /* Free up space */
+      HDfree((VOIDP) fill_buf);
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*----------------------------------------------------------------------------
+ NAME
+       DFSDwriteslab
+ USAGE
+       int  DFSDwriteslab(start, stride, count, data)
+       int32 start[];     IN: array containing the coordinates of the start
+                              of the slab in the HDF file
+       int32 stride[];    IN: array containing the dimensions of data[]
+       int32 count[];     IN: array containing the size of the slab
+       VOID  *data;       IN: array to hold the floating point data to write
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Writes a slab of data to a scientific data set. The "start" indices
+       are relative to 1. The rank of "start" must be the same as the
+       number of dimensions of the specified variable. The elements of "start"
+       must be no larger than the scientific data set's dimensions in order.
+       The stride feature is not currently implemented. For now just pass the
+       "start" array as the argument for "stride" where it will be ignored.
+       The rank of "count" must be the same as the number of dimensions of the
+       specified variable. The elements of "count" must be no larger that
+       the scientific data sets's dimensions in order. The order in which
+       the data will be written into the specified hyperslab is with the
+       last dimension varying the fastest. The array "data" should be of
+       appropriate number type for the data set. Note that neither the
+       compilier nor the HDF sotfware can detect if the wrong type of data
+       is written.
+----------------------------------------------------------------------------*/
+intn
+DFSDwriteslab(int32 start[], int32 stride[],
+              int32 count[], VOIDP data)
+{
+  intn        rank;           /* number of dimensions in data[] */
+  int32       i;              /* temporary loop index */
+
+  int32       leastsig;       /* fastest varying subscript in the array */
+  int32       convert;        /* true if machine NT != NT to be read */
+  int32       done;           /* true if we are at the end of the slab */
+  int32       numtype;        /* current number type  */
+  int32       fileNTsize;     /* size of this NT in the file  */
+  int32       localNTsize;    /* size of this NT as it occurs in this machine */
+  int32       numelements;    /* number of floats to read at once */
+  int32       sdgsize;        /* number of bytes to be written in the SDG */
+  int32       rowsize;        /* number of bytes to be written at once */
+                                /*   in the hyperslab */
+  int32       fileoffset;     /* offset into the current dataset in the file */
+  int32      *doffset;        /* array for accessing the next element in data[] */
+  int32      *foffset;        /* array for accessing  next element in the file */
+  int32      *dimsleft;       /* array for tracking current position in data[] */
+  int32      *startdims;      /* tmp array containing starting slab dims */
+  int32      *sizedims;       /* tmp array containing the slab size */
+  int32      *filedims;       /* tmp array containing the dimensions */
+                                /*   of the dataset in the file */
+  int32       r_error;        /* flag if an error occurred, */
+                                /*   used by DFconvert macro */
+  int32       aid;
+
+  uint8       platnumsubclass;    /* class of this NT for this platform */
+  uint8       fileNT;         /* file number subclass  */
+  uint8      *buf;            /* buffer containing the converted current row */
+  uint8      *datap;          /* ptr into data[] at starting offset */
+                                /*   of current block */
+  intn       ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDwriteslab");
+
+  /* shut compiler up */
+  stride = stride;
+
+  /* Clear error stack  */
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Sanity checking of input data  */
+  if (!data)
+    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* Set rank */
+  rank = Writesdg.rank;
+
+  /* Do sanity checking of starting and size dimension arrays  */
+  for (i = 0; i < (int32) rank; i++)
+    {
+      /*
+      ** Check validity for the dimension ranges by
+      **  checking lower bound of slab sizes
+      **  checking lower bound of starting dimensions
+      **  checking upper bound on writing dimensions
+      */
+      if ((count[i] < 1) || (start[i] < 1)
+          || (start[i] + count[i] - 1 > Writesdg.dimsizes[i]))
+          HCLOSE_GOTO_ERROR(Sfile_id,DFE_BADDIM, FAIL);
+    }
+
+  /* Intialize a few local variables */
+  numtype = Writesdg.numbertype;
+  platnumsubclass = (uint8)DFKgetPNSC(numtype & (~DFNT_LITEND), DF_MT);
+  localNTsize = DFKNTsize((numtype | DFNT_NATIVE) & (~DFNT_LITEND));
+  fileNTsize = DFKNTsize(numtype);
+  fileNT = Writesdg.filenumsubclass;
+
+  /* Calculate total bytes in SDS that can be written */
+  sdgsize = fileNTsize;
+  for (i = 0; i < Writesdg.rank; i++)
+    sdgsize *= Writesdg.dimsizes[i];
+
+  /* Set Access Id */
+  aid = Writesdg.aid;
+
+  /*
+   ** Get dimensions of hyperslab to write out
+   ** Allocate temporary buffers(3) to hold starting, size,
+   **  and file(SDG in file) dimensions
+   */
+  startdims = (int32 *) HDmalloc((size_t) (3 * rank) * sizeof(int32));
+  if (startdims == NULL)
+      HCLOSE_GOTO_ERROR(Sfile_id,DFE_NOSPACE, FAIL);
+  sizedims = startdims + rank;
+  filedims = sizedims + rank;
+
+  /* Copy arrays to private workspace (row major order) */
+  for (i = 0; i < (int32) rank; i++)
+    {
+      startdims[i] = start[i] - 1;
+      sizedims[i] = count[i];   /* dimensions of just slab */
+      filedims[i] = Writesdg.dimsizes[i];   /* dimensions of whole SDG */
+    }
+
+  /* Is conversion necessary */
+  convert = (fileNT != platnumsubclass);
+
+  /* Collapse dimensions if contiguous both in the file and in memory */
+  for (i = (int32) rank - 1; i > 0; i--)  /* stop before most sig dim */
+    {
+      /* read only part of dataset */
+      if (startdims[i] != 0 || sizedims[i] < filedims[i])
+        break;
+      startdims[i - 1] *= filedims[i];
+      sizedims[i - 1] *= sizedims[i];
+      filedims[i - 1] *= filedims[i];
+      rank--;
+    }
+
+  /*
+   ** Which is least sig dim i.e fastest varying.
+   ** In C usually the last.
+  */
+  leastsig = (int32) rank - 1;
+
+  r_error = 0;
+  if (rank == 1 && !convert)
+    {
+      /* all data is contiguous with no conversions */
+      rowsize = sizedims[0] * fileNTsize;
+      if ((Hseek(aid, startdims[0] * fileNTsize, 0) == FAIL)
+          || (rowsize != Hwrite(aid, rowsize, (uint8 *) data)))
+        {
+          r_error = 1;
+        }
+    }
+  else
+    {
+      /*
+       * The data must be further manipulated.
+       * It may need conversion, may not be contiguous, or
+       * any combination of these.
+       */
+      numelements = sizedims[leastsig];     /* # of elmenents in a row */
+      rowsize = numelements * fileNTsize;   /* # of bytes in a row */
+
+      /* If conversion, allocate 1 row buffers */
+      if (convert)
+        {
+          if ((buf = (uint8 *) HDmalloc((uint32) rowsize)) == NULL)
+            {
+              HDfree((VOIDP) startdims);
+              Hendaccess(aid);
+              HCLOSE_GOTO_ERROR(Sfile_id,DFE_NOSPACE, FAIL);
+            }
+        }
+      else
+        buf = NULL;
+
+      /* Allocate space for file and data offsets and dimsleft */
+      foffset = (int32 *) HDmalloc((size_t) (3 * rank) * sizeof(int32));
+      if (foffset == NULL)
+        {
+          HDfree((VOIDP) startdims);
+          HDfree((VOIDP) buf);
+          Hendaccess(aid);
+          HCLOSE_GOTO_ERROR(Sfile_id,DFE_NOSPACE, FAIL);
+        }
+      dimsleft = foffset + rank;
+      doffset = dimsleft + rank;
+
+      /* Set number of dimensions left */
+      for (i = leastsig; i >= 0; i--)
+        dimsleft[i] = sizedims[i];
+
+      /* compute offsets in the source array */
+      doffset[leastsig] = 1 * localNTsize;
+      for (i = leastsig; i > 0; i--)
+        doffset[i - 1] = doffset[i] * sizedims[i];
+
+      /*
+       ** Compute offsets in the file for dimension, according to the
+       ** possible length for each dimension. Depends on numbertype.
+       */
+      for (i = leastsig, foffset[i] = 1 * fileNTsize; i > 0; i--)
+        foffset[i - 1] = foffset[i] * filedims[i];
+
+      /*
+       ** Compute starting position in file
+       ** All file writes are done relative to this starting offset.
+       ** Cumulative offset is from most sig to next to least sig dim.
+       */
+      for (i = 0, fileoffset = 0; i < leastsig; i++)
+        fileoffset = fileoffset + (startdims[i] * foffset[i]);
+
+      /* Dont forget about last dimension */
+      fileoffset = fileoffset + startdims[leastsig] * fileNTsize;
+
+      datap = (uint8 *) data;
+      done = 0;
+
+      /* -- now write the data */
+      do
+        {
+          /* move to the next data element in the file */
+          if (Hseek(aid, fileoffset, 0) == FAIL)
+            {
+              r_error = 1;
+              break;
+            }
+
+          /*  If convert and write one contiguous block of data */
+          /*  Else write one contiguous block of data */
+          if (convert)
+            {
+              DFKconvert((VOIDP) datap, (VOIDP) buf, numtype,
+                         numelements, DFACC_WRITE, 0, 0);
+              if (rowsize != Hwrite(aid, rowsize, buf))
+                {
+                  r_error = 1;
+                  break;
+                }
+            }
+          else
+            {
+              if (rowsize != Hwrite(aid, rowsize, datap))
+                {
+                  r_error = 1;
+                  break;
+                }
+            }
+
+          /*
+           * Find starting place of the next row/block.
+           * Note that all moves are relative:
+           *   this preserves the starting offsets of each dimension
+           */
+          for (i = leastsig - 1; i >= 0; i--)
+            {
+              if (--dimsleft[i] > 0)
+                {
+                  /* Move to next element in the current dimension */
+                  datap += doffset[i];
+                  fileoffset += foffset[i];
+                  break;
+                }
+              else
+                {
+                  dimsleft[i] = sizedims[i];
+                  /*
+                   * Note that we are still positioned at the beginning of
+                   * the last element in the current dimension
+                   */
+                  /* move back to the beginning of dimension i */
+                  datap -= doffset[i] * (sizedims[i] - 1);
+
+                  /* move back to beginning read position of dimension i */
+                  fileoffset -= foffset[i] * (sizedims[i] - 1);
+                  if (i == 0)
+                    done = 1;
+                }
+            }
+        }
+      while (!done && leastsig > 0);
+
+      if (buf != NULL)
+         HDfree((VOIDP) buf);
+      if (foffset != NULL)
+         HDfree((VOIDP) foffset);
+    }
+
+  /* Clean up time.... */
+  HDfree((VOIDP) startdims);
+
+  if (r_error)
+    ret_value = FAIL;
+  else
+    ret_value = SUCCEED;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*-----------------------------------------------------------------------------
+ NAME
+       DFSDendslab
+ USAGE
+       int DFSDendslab()
+
+ RETURNS
+       Returns SUCCEED(0) if successful and FAIL(-1) otherwise.
+ DESCRIPTION
+       Ends a sequence of slab calls started by "DFSDstartslab" by closing
+       the file. Writes the NDG information to the file if this call follows
+       a "DFSDstartslab" that created a new SDG.
+
+----------------------------------------------------------------------------*/
+intn
+DFSDendslab(void)
+{
+  intn        ret_value = SUCCEED;
+  CONSTR(FUNC, "DFSDendslab");
+
+  /* Clear error stack */
+  HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(DFSDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Valid file id */
+  if (Sfile_id == DF_NOFILE)
+    HGOTO_ERROR(DFE_BADCALL, FAIL);
+
+  /* Check to see if we have written out the SDG info */
+  if (!Ref.new_ndg)
+    {
+      if (DFSDIputndg(Sfile_id, Writeref, &Writesdg) < 0)
+        HCLOSE_GOTO_ERROR(Sfile_id,DFE_INTERNAL, FAIL);
+
+      /* old nsdg table should be reset next time  */
+      if (nsdghdr != NULL)
+        {
+          if (nsdghdr->nsdg_t != NULL)
+            {
+              DFnsdgle   *rear, *front;
+
+              rear = nsdghdr->nsdg_t;
+              front = rear->next;
+              while (rear != NULL)
+                {
+                  HDfreenclear(rear);
+                  rear = front;
+                  if (rear != NULL)
+                    front = rear->next;
+                }
+              nsdghdr->size = 0;
+              nsdghdr->nsdg_t = NULL;
+              lastnsdg.tag = DFTAG_NULL;
+              lastnsdg.ref = 0;
+            }
+
+          HDfreenclear(nsdghdr);
+        }
+
+      Ref.new_ndg = -1;
+    }
+
+  /* Slab clean up */
+  Hendaccess(Writesdg.aid);
+  ret_value = Hclose(Sfile_id);
+  Sfile_id = 0;
+  Lastref = (uint16) Writeref;    /* remember ref written */
+  Writeref = 0;   /* Reset Write ref */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFSDIstart
+ PURPOSE
+    DFSD-level initialization routine
+ USAGE
+    intn DFSDIstart()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Register the shut-down routine (DFSDPshutdown) for call with atexit
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn DFSDIstart(void)
+{
+    CONSTR(FUNC, "DFSDIstart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&DFSDPshutdown) != 0)
+      HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return(ret_value);
+} /* end DFSDIstart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    DFSDPshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn DFSDshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the DFSD routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn DFSDPshutdown(void)
+{
+    DFSDIclear(&Readsdg);
+    DFSDIclear(&Writesdg);
+
+    /* old nsdg table should be reset next time  */
+    if (nsdghdr != NULL)
+      {
+          if (nsdghdr->nsdg_t != NULL)
+            {
+                DFnsdgle   *rear, *front;
+
+                rear = nsdghdr->nsdg_t;
+                front = rear->next;
+                while (rear != NULL)
+                  {
+                      HDfree(rear);
+                      rear = front;
+                      if (rear != NULL)
+                          front = rear->next;
+                  }
+                lastnsdg.tag = DFTAG_NULL;
+                lastnsdg.ref = 0;
+            }
+          HDfreenclear(nsdghdr);
+      }
+
+    if(ptbuf!=NULL)
+      {
+          HDfree(ptbuf);
+          ptbuf=NULL;
+      } /* end if */
+
+    if(Lastfile!=NULL)
+      {
+          HDfree(Lastfile);
+          Lastfile=NULL;
+      } /* end if */
+    return(SUCCEED);
+} /* end DFSDPshutdown() */
+
diff --git a/hdf/src/dfsd.h b/hdf/src/dfsd.h
new file mode 100644
index 0000000..9939ad7
--- /dev/null
+++ b/hdf/src/dfsd.h
@@ -0,0 +1,139 @@
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfsd.h 5444 2010-08-25 16:40:05Z byrn $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfsd.h
+ * Purpose: header file for the Scientific Data set
+ * Invokes: dfrig.h
+ * Contents:
+ *  Structure definitions: DFSsdg
+ *  Constant definitions: DFS_MAXLEN
+ * Remarks: This is included with user programs which use SDG
+ *          Currently defined to be 2-D.  Will later be increased to
+ *          multiple dimensions
+ *---------------------------------------------------------------------------*/
+
+#ifndef _DFSD_H   /* avoid re-inclusion */
+#define _DFSD_H
+
+#include "H4api_adpt.h"
+
+#include "hdf.h"
+
+/* include numbertype and aid for 3.2   S. Xu   */
+/* structure to hold SDG info */
+typedef struct DFSsdg
+  {
+      DFdi        data;         /* tag/ref of data in file */
+      intn        rank;         /* number of dimensions */
+      int32 *dimsizes;    /* dimensions of data */
+      char *coordsys;
+      char *dataluf[3];   /* label/unit/format of data */
+      char **dimluf[3];   /* label/unit/format for each dim */
+      uint8 **dimscales;  /* scales for each dimension */
+      uint8       max_min[16];  /* max, min values of data, */
+      /*  currently atmost 8 bytes each   */
+      int32       numbertype;   /* default is float32      */
+      uint8       filenumsubclass;  /* number format in the file, default is IEEE */
+      int32       aid;          /* access id     */
+      int32       compression;  /* 0 -- not compressed  */
+      int32       isndg;        /* 0 -- pure sdg, written by 3.1 else ndg */
+      float64     cal, cal_err; /* calibration multiplier stuff          */
+      float64     ioff, ioff_err;   /* calibration offset stuff              */
+      int32       cal_type;     /* number type of data after calibration */
+      uint8       fill_value[DFSD_MAXFILL_LEN];     /* fill value if any specified  */
+      intn        fill_fixed;   /* whether ther fill value is a fixed value, or it can change */
+  }
+DFSsdg;
+
+/* DFnsdgle is the internal structure which stores SDG or NDS and   */
+/* related SDG in an HDF file.                                      */
+/* It is a linked list.                                             */
+
+typedef struct DFnsdgle
+  {
+      DFdi        nsdg;         /* NDG from 3.2 or SDG from 3.1  */
+      DFdi        sdg;          /* Only special NDF has values in this field */
+      struct DFnsdgle *next;
+  }
+DFnsdgle;
+
+typedef struct DFnsdg_t_hdr
+  {
+      uint32      size;
+      DFnsdgle   *nsdg_t;
+  }
+DFnsdg_t_hdr;
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+    HDFLIBAPI int32 DFSDIopen
+                (const char * filename, int acc_mode);
+
+    HDFLIBAPI int  DFSDIsdginfo
+                (int32 file_id);
+
+    HDFLIBAPI int  DFSDIclear
+                (DFSsdg * sdg);
+
+    HDFLIBAPI int  DFSDIclearNT
+                (DFSsdg * sdg);
+
+    HDFLIBAPI int  DFSDIgetdata
+                (const char * filename, intn rank, int32 maxsizes[], VOIDP data,
+                 int isfortran);
+
+    HDFLIBAPI int  DFSDIputdata
+                (const char * filename, intn rank, int32 * dimsizes, VOIDP data,
+                 int accmode, int isfortran);
+
+    HDFLIBAPI int  DFSDIgetslice
+                (const char * filename, int32 winst[], int32 windims[], VOIDP data,
+                 int32 dims[], int isfortran);
+
+    HDFLIBAPI int  DFSDIputslice
+                (int32 windims[], VOIDP data, int32 dims[], int isfortran);
+
+    HDFLIBAPI int  DFSDIendslice
+                (int isfortran);
+
+    HDFLIBAPI intn DFSDIrefresh
+                (char * filename);
+
+    HDFLIBAPI int  DFSDIisndg
+                (intn * isndg);
+
+    HDFLIBAPI int  DFSDIgetrrank
+                (intn * rank);
+
+    HDFLIBAPI int  DFSDIgetwrank
+                (intn * rank);
+
+    HDFLIBAPI int  DFSDIsetdimstrs
+                (int dim, const char * label, const char * unit, const char * format);
+
+    HDFLIBAPI int  DFSDIsetdatastrs
+                (const char * label, const char * unit, const char * format,
+                 const char * coordsys);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* _DFSD_H */
diff --git a/hdf/src/dfsdf.c b/hdf/src/dfsdf.c
new file mode 100644
index 0000000..f671942
--- /dev/null
+++ b/hdf/src/dfsdf.c
@@ -0,0 +1,1639 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfsdf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfsdf.c
+ * Purpose: C stubs for Fortran SDS routines
+ * Invokes: dfsd.c dfkit.c
+ * Contents:
+ *  dsgdast:       Call DFSDgetdatastrs to get attributes of data
+ *  dsigdis:       Call DFSDgetdimstrs to get attributes of a dimension
+ *  dsgdisc:       Call DFSDgetdimscale to get scale for a dimension
+ *  dsgrang:       Call DFSDgetmaxmin to get max and min data values
+ *  dssdims:       Call DFSDsetdims to set dimensions for subsequent SDGs
+ *  dssdisc:       Call DFSDsetdimscale to set scale for subsequent SDGs
+ *  dssrang:       Call DFSDsetmaxmin to set max/min values for subsequent SDGs
+ *  dsclear:       Call DFSDclear to erase values set for subsequent SDGs
+ *  dsslens:       Call DFSDsetlengths to set maximum lengths of string
+ *  dsgdiln:       Call DFSDgetdimlen to get lengths of strings for a dimension
+ *  dsgdaln:       Call DFSDgetdatalen to get lengths of data strings
+ *  dsfirst:       Call DFSDrestart to get SDGs again from beginning of file
+ *  dspslc:        Call DFSDIputslice to write slice to file
+ *  dseslc:        Call DFSDendslice to end slice writes, write SDG to file
+ *  dssnt:         Call DFSDsetNT to set number type
+ *  dsgnt:         Call DFSDgetNT to get number type for reading
+ *  dsigdim:       Call DFSDgetdims to get dimensions of next SDG
+ *  dsigdat:       Call DFSDgetdata to get data values
+ *  dsipdat:       Call DFSDIputdata to write SDG to new file
+ *  dsiadat:       Call DFSDIputdata to append SDG to existing file
+ *  dsigslc:       Call DFSDIgetslice to get slice from file
+ *  dsisslc:       Call DFSDstartslice to set up to write slice
+ *  dslref:        Call DFSDlastref to get ref of last SDS accessed
+ *  dsinum:        Call DFSDndatasets to get number of SDG in the file
+ *  dsip32s:       Call DFSDpre32sdg to test if the sdg was written by HDF prior to
+ *                      version 3.2
+ *  dfsdgetdatastrs_:Call DFSDgetdatastrs to get attributes of data
+ *  dfsdgetdimscale_:Call DFSDgetdimscale to get scale for a dimension
+ *  dfsdgetrange_:  Call DFSDgetmaxmin to get max and min data values
+ *  dfsdsetdims_:   Call DFSDsetdims to set dimensions for subsequent SDGs
+ *  dfsdsetdimscale_:Call DFSDsetdimscale to set scale for subsequent SDGs
+ *  dfsdsetrange_:  Call DFSDsetmaxmin to set max/min values for subsequent SDGs
+ *  dfsdclear_:     Call DFSDclear to erase values set for subsequent SDGs
+ *  dfsdsetlengths_:Call DFSDsetlengths to set maximum lengths of string
+ *  dfsdgetdimlen_: Call DFSDgetdimlen to get lengths of strings for a dimension
+ *  dfsdgetdatalen_:Call DFSDgetdatalen to get lengths of data strings
+ *  dfsdrestart_:   Call DFSDrestart to get SDGs again from beginning of file
+ *  dfsdputslice_:  Call DFSDIputslice to write slice to file
+ *  dfsdendslice_:  Call DFSDendslice to end slice writes, write SDG to file
+ *  dfsdsetnt_:     Call DFSDsetNT to set number type
+ *  dfsdgetnt_:     Call DFSDgetNT to get number type
+ *  dfsdlastref_:   Call DFSDlastref to get ref of last SDS accessed
+ *  dsiwref:        Call DFSDwriteref to set up next ref to write
+ *  dssfill:        Call DFSDsetfillvalue to set fill value for SDS
+ *  dsgfill:        Call DFSDgetfillvalue to get fill value from SDS
+ *  dsisslab:       Call DFSDstartslab to set up write to SDS
+ *  dswslab:        Call DFSDwriteslab to write slab to file
+ *  dseslab:        Call DFSDendslab to end slab writes, write NDG to file
+ *  dsirslab:       Call DFSDreadslab to get slab from SDS
+ * Remarks: no C stubs needed for the put string routines, only Fortran stubs
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfsd.h"
+#include "hproto_fortran.h"
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsgdisc
+ * Purpose: Call DFSDgetdimscale to get scale for a dimension
+ * Inputs:  dim: dimension to get attributes for
+ *          maxsize: size of scale array
+ *          scale: array to return scale in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdimscale
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsgdisc(intf * dim, intf * maxsize, VOIDP scale)
+{
+    intn        rank, cdim;
+    intn        isndg;
+
+    DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          DFSDIgetrrank(&rank);
+          if (rank < *dim)
+              return FAIL;
+          cdim = rank - (intn) *dim + 1;
+      }
+    else
+        cdim = (intn) *dim;
+
+    return (DFSDgetdimscale(cdim, *maxsize, scale));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsgrang
+ * Purpose: Call DFSDgetrange to get maximum and minimum data values
+ * Inputs:  pmax: float to return maximum in
+ *          pmin: float to return minimum in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetrange
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsgrang(VOIDP pmax, VOIDP pmin)
+{
+    return (DFSDgetrange(pmax, pmin));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dssdims
+ * Purpose: Call DFSDsetdims to set dimensions for subsequent SDGs
+ * Inputs:  rank: no of dimensions of SDG
+ *          dimsizes: array containing dimensions of SDG
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetdims
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndssdims(intf * rank, intf dimsizes[])
+{
+    int32       i, *cdims, *p;
+    intf        ret;
+
+    p = (int32 *) HDmalloc((size_t) (*rank) * sizeof(int32));
+    if (p == NULL)
+        return FAIL;
+    cdims = p;
+    for (i = 1; i <= *rank; i++)
+      {
+          *p = dimsizes[*rank - i];
+          p++;
+      }
+
+    ret = DFSDsetdims((intn) *rank, cdims);
+    HDfree((VOIDP) cdims);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dssdisc
+ * Purpose: Call DFSDsetdimscale to set scales for subsequent SDGs
+ * Inputs:  dim: dimension to set scale for
+ *          dimsize: size of array scale
+ *          scale: array of scale values
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetdimscale
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndssdisc(intf * dim, intf * dimsize, VOIDP scale)
+{
+    int         cdim;
+    intn        rank;
+
+    DFSDIgetwrank(&rank);
+    if (rank < *dim)
+        return FAIL;
+    cdim = rank - (intn) *dim + 1;
+
+    return (DFSDsetdimscale(cdim, *dimsize, scale));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dssrang
+ * Purpose: Call DFSDsetrange to set max and min values for this SDG
+ * Inputs:  max, min: max and min data values
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetrange
+ * Remarks: Max and Min are set only for next SDG, reset to NULL after
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndssrang(VOIDP max, VOIDP min)
+{
+    return (DFSDsetrange(max, min));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsclear
+ * Purpose: Call DFSDclear to erase values set for subsequent SDGs
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDclear
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsclear(void)
+{
+    return (DFSDclear());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsslens
+ * Purpose: Call DFSDsetlengths to set max lengths of strings
+ * Inputs:  maxlen_label, maxlen_unit, maxlen_format, maxlen_coordsys: max lens
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetlengths
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsslens(intf * maxlen_label, intf * maxlen_unit, intf * maxlen_format,
+         intf * maxlen_coordsys)
+{
+    return (DFSDsetlengths((intn) *maxlen_label, (intn) *maxlen_unit,
+                           (intn) *maxlen_format, (intn) *maxlen_coordsys));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsgdiln
+ * Purpose: Call DFSDgetdimlen to get actual lengths of strings
+ * Inputs:  dim: dimension to get lengths for
+ *          llabel, lunit, lformat: integers to return lengths of each string in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdimlen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsgdiln(intf * dim, intf * llabel, intf * lunit, intf * lformat)
+{
+    intn        rank, cdim;
+    intf        ret;
+    intn        isndg;
+    intn        cllabel, clunit, clformat;  /* convert between intf and intn */
+
+    ret = DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          ret = DFSDIgetrrank(&rank);
+          if (rank < *dim)
+              return FAIL;
+          cdim = rank - (intn) *dim + 1;
+      }
+    else
+        cdim = (intn) *dim;
+
+    ret = (intf) DFSDgetdimlen(cdim, &cllabel, &clunit, &clformat);
+    if (ret != FAIL)
+      {     /* if ok, copy the values over */
+          *llabel = cllabel;
+          *lunit = clunit;
+          *lformat = clformat;
+      }     /* end if */
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsgdaln
+ * Purpose: Call DFSDgetdatalen to get actual lengths of strings
+ * Inputs:  llabel, lunit, lformat, lcoordsys: integers to return lengths in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdatalen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsgdaln(intf * llabel, intf * lunit, intf * lformat, intf * lcoordsys)
+{
+    intf        ret;
+    intn        cllabel, clunit, clformat, clcoordsys;
+
+    ret = (intf) DFSDgetdatalen(&cllabel, &clunit, &clformat, &clcoordsys);
+    if (ret != FAIL)
+      {
+          *llabel = cllabel;
+          *lunit = clunit;
+          *lformat = clformat;
+          *lcoordsys = clcoordsys;
+      }     /* end if */
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsfirst * Purpose: Call DFSDrestart to get SDGs again from the beginning
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDrestart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsfirst(void)
+{
+
+    return (DFSDrestart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dspslc
+ * Purpose: Call DFSDIputslice to write slice to file
+ * Inputs:  windims: array of size rank, containing size of slice
+ *          data: array containing slice
+ *          dims: dimensions of array data
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIputslice
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndspslc(intf windims[], VOIDP data, intf dims[])
+{
+    int32      *cdims, *cwindims, *p, *wp;
+    intn        i, rank;
+    intf        ret;
+
+    ret = DFSDIgetwrank(&rank);
+    wp = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+    if (wp == NULL)
+        return FAIL;
+    cwindims = wp;
+    p = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+    if (p == NULL){
+	HDfree((VOIDP) cwindims);
+        return FAIL;
+    }
+    cdims = p;
+    for (i = 1; i <= rank; i++)
+      {     /* reverse dims & windims */
+          *p = dims[rank - i];
+          p++;
+          *wp = windims[rank - i];
+          wp++;
+      }
+
+    ret = DFSDIputslice(cwindims, data, cdims, 1);
+    HDfree((VOIDP) cdims);
+    HDfree((VOIDP) cwindims);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dseslc
+ * Purpose: Call DFSDIendslice to finish slice writes and write out SDG
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIendslice
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndseslc(void)
+{
+
+    return (DFSDIendslice(1));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dssnt
+ * Purpose: Call DFSDsetNT to set number type for subsequent calls to
+            DFSDputdata, DFSDadddata, DFSDsetdimscales.
+ * Inputs:  numbertype
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ * Method:  Invokes DFSDsetNT
+ * Remarks: 0 specifies default value
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndssnt(intf * numbertype)
+{
+    return (DFSDsetNT(*numbertype));
+}
+
+/*----------------------------------------------------------------------------
+ * Name:    dsgnt
+ * Purpose: Call DFSDgetNT to get number type for subsequent calls
+ * Inputs:  pnumbertype
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ * Method:  Invokes DFSDgetNT
+ * Remarks: 0 specifies default value
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsgnt(intf * pnumbertype)
+{
+    return (DFSDgetNT((int32 *) pnumbertype));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsigdim
+ * Purpose: Call DFSDgetdims to get dimensions of next SDG
+ * Inputs:  filename: name of HDF file
+ *          prank: integer to return rank in
+ *          sizes: array to return dimensions in
+ *          maxrank: dimension of array sizes
+ *          lenfn: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   Fortran stub routine
+ * Invokes: DFSDgetdims
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsigdim(_fcd filename, intf * prank, intf sizes[], intf * maxrank,
+         intf * lenfn)
+{
+    char       *fn;
+    int32       i, tmp;
+    intn        isndg;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *lenfn);
+    if (!fn)
+	return(-1);
+    ret = DFSDgetdims(fn, (intn *) prank, (int32 *) sizes, (intn) *maxrank);
+    DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          for (i = 0; i < ((int32) *prank) / 2; i++)
+            {
+                tmp = sizes[i];
+                sizes[i] = sizes[(int32) *prank - i - 1];
+                sizes[(int32) *prank - i - 1] = tmp;
+            }
+      }
+    HDfree(fn);
+    return ret;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsigdat
+ * Purpose: Call DFSDgetdata to get data values
+ * Inputs:  filename: name of HDF file
+ *          rank: no of dimensions in array data
+ *          maxsizes: array containing dimensions of the array data
+ *          data: array to return the data in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIgetdata,DFSDIrefresh,DFSDIisndg
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsigdat(_fcd filename, intf * rank, intf maxsizes[], VOIDP data, intf * fnlen)
+{
+    int32       i;
+    intn        isndg;
+    intf        ret;
+    char       *fn;
+    int32      *p, *cmaxsizes;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    /* if DFSDgetdims has not be called call DFSDIsdginfo to */
+    /* refresh Readsdg       */
+    if (DFSDIrefresh(fn) < 0)
+        return FAIL;
+    ret = DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          p = (int32 *) HDmalloc((size_t) (*rank) * sizeof(int32));
+          if (p == NULL)
+              return FAIL;
+          cmaxsizes = p;
+
+          for (i = 1; i <= *rank; i++)
+            {
+                *p = maxsizes[*rank - i];
+                p++;
+            }
+          ret = DFSDIgetdata(fn, (intn) *rank, cmaxsizes, data, 1);
+          HDfree((VOIDP) cmaxsizes);
+      }
+    else
+        ret = DFSDIgetdata(fn, (intn) *rank, (int32 *) maxsizes, data, 1);  /* 1==FORTRAN */
+    HDfree(fn);
+    return ret;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsipdat
+ * Purpose: Call DFSDIputdata to write SDG to new file
+ * Inputs:  filename: name of HDF file
+ *          rank: no of dimensions of array data
+ *          dimsizes: array containing size of each dimension of array data
+ *          data: array containing data values
+ *          fnlen: length of string filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIputdata
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsipdat(_fcd filename, intf * rank, intf dimsizes[], VOIDP data, intf * fnlen)
+{
+    char       *fn;
+    int32       i, *cdims, *p;
+    intf        ret;
+
+    /* reverse the dimsizes first  */
+    p = (int32 *) HDmalloc((size_t) (*rank) * sizeof(int32));
+    if (p == NULL)
+        return FAIL;
+    cdims = p;
+    for (i = 1; i <= *rank; i++)
+      {
+          *p = dimsizes[*rank - i];
+          p++;
+      }
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+
+    /* 0, 1 specify create mode, called from FORTRAN program */
+    /* In HDF3.2 .hdf files, data and dimsizes are in C order  */
+    ret = DFSDIputdata(fn, (intn) *rank, cdims, data, 0, 1);
+    HDfree(fn);
+    HDfree((VOIDP) cdims);
+
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsiadat
+ * Purpose: Call DFSDIputdata to append SDG to existing file
+ * Inputs:  filename: name of HDF file
+ *          rank: no of dimensions of array data
+ *          dimsizes: array containing size of each dimension of array data
+ *          data: array containing data values
+ *          fnlen: length of string filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIputdata
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsiadat(_fcd filename, intf * rank, intf dimsizes[], VOIDP data, intf * fnlen)
+{
+    char       *fn;
+    int32       i, *cdims, *p;
+    intf        ret;
+
+    /* reverse the dimsizes first  */
+    p = (int32 *) HDmalloc((size_t) (*rank) * sizeof(int32));
+    if (p == NULL)
+        return FAIL;
+    cdims = p;
+    for (i = 1; i <= *rank; i++)
+      {
+          *p = dimsizes[*rank - i];
+          p++;
+      }
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+
+    /* 1, 1 specify create mode, called from FORTRAN program */
+    /* In HDF3.2 .hdf files, data and dimsizes are in C order  */
+    ret = DFSDIputdata(fn, (intn) *rank, cdims, data, 1, 1);
+    HDfree(fn);
+    HDfree((VOIDP) cdims);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsigslc
+ * Purpose: Call DFSDIgetslice to read slice from file
+ * Inputs:  filename: name of HDF file
+ *          winst: array of size = rank of data, containing start of slice
+ *          windims: array of size rank, containing end of slice
+ *          data: array for returning slice
+ *          ndims: no of dims of array data
+ *          dims: dimensions of array data
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIgetslice
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsigslc(_fcd filename, intf winst[], intf windims[], VOIDP data, intf dims[],
+         intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+    intn        rank, i;
+    int32      *cdims, *cwindims, *cwinst, *p, *wp, *wsp;
+    intn        isndg;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+
+    /* if DFSDgetdims has not be called call DFSDIsdginfo to */
+    /* refresh Readsdg       */
+    if (DFSDIrefresh(fn) < 0)
+        return FAIL;
+
+    ret = DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          ret = DFSDIgetrrank(&rank);
+          p = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+          if (p == NULL)
+              return FAIL;
+          cdims = p;
+          wp = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+          if (wp == NULL)
+              return FAIL;
+          cwindims = wp;
+          wsp = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+          if (wsp == NULL)
+              return FAIL;
+          cwinst = wsp;
+
+          for (i = 1; i <= rank; i++)
+            {
+                *p = dims[rank - i];
+                p++;
+                *wp = windims[rank - i];
+                wp++;
+                *wsp = winst[rank - i];
+                wsp++;
+            }
+          ret = DFSDIgetslice(fn, cwinst, cwindims, data, cdims, 1);
+          HDfree((VOIDP) cdims);
+          HDfree((VOIDP) cwindims);
+          HDfree((VOIDP) cwinst);
+      }
+    else
+        ret = DFSDIgetslice(fn, (int32 *) winst, (int32 *) windims,
+                            data, (int32 *) dims, 1);
+    HDfree(fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsisslc
+ * Purpose: Call DFSDstartslice to set up to write slice
+ * Inputs:  filename: name of HDF file
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDstartslice
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsisslc(_fcd filename, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFSDstartslice(fn);
+    HDfree(fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsirref
+ * Purpose: Call DFSDreadref to set up next ref to read
+ * Inputs:  filename: name of HDF file
+ *      ref: next ref to read
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDstartslice
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsirref(_fcd filename, intf * ref, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFSDreadref(fn, (uint16) *ref);
+    HDfree(fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dslref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Globals: Lastref
+ * Returns: ref on success, -1 on error with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFANlastref
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndslref(void)
+{
+    return ((intf)DFSDlastref());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsinum
+ * Purpose: Return number of SDGs in the file
+ * Inputs:  filename: name of file
+ *          len: length of Fortran string filename
+ * Returns: number of SDGs on success, -1 on failure with DFerror set
+ * Users:   dsnum, dfsdnumber
+ * Invokes: DFSDndataset, HDf2cstring
+ * Method:  convert string, call DFSDndatasets
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsinum(_fcd filename, intf * len)
+{
+    char       *cname;
+    intf        status;
+
+    cname = HDf2cstring(filename, (intn) *len);
+    if (!cname)
+	return(-1);
+    status = DFSDndatasets(cname);
+    HDfree(cname);
+
+    return (status);
+}
+
+/*------------------------------------------------------------------------------
+* Name:     dsip32s
+* Purpose:  tests if the SDG with the specified ref was written by HDF prior to
+*            version 3.2
+* Input:    filename: name of HDF file
+*           ref: the ref number of the SDG
+*           ispre32: set to TRUE if the SDG/ref was written by old library;
+*                        to FALSE otherwise.
+*           len:     length of filename
+* Retruns:  0 on success, -1 on failure
+* Users:    HDF Fortran programmers
+*------------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsip32s(_fcd filename, intf * ref, intf * ispre32, intf * len)
+{
+    char       *cname;
+    intf        status;
+
+    cname = HDf2cstring(filename, (intn) *len);
+    if (!cname)
+	return(-1);
+    status = DFSDpre32sdg(cname, (uint16) *ref, (intn *) ispre32);
+
+    HDfree(cname);
+    return (status);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdgetdatastrs
+ * Purpose: Call DFSDgetdatastrs to get the data attributes
+ * Inputs:  label, unit, format, coordsys: strings to return attributes in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdatastrs
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdgetdatastrs(_fcd label, _fcd unit, _fcd format, _fcd coordsys)
+{
+    return (DFSDgetdatastrs((char *) _fcdtocp(label), (char *) _fcdtocp(unit),
+                   (char *) _fcdtocp(format), (char *) _fcdtocp(coordsys)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdgetdimstrs
+ * Purpose: Call DFSDgetdimstrs to get attributes of a dimension
+ * Inputs:  label, unit, format: strings to return attributes in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdimstrs
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdgetdimstrs(intf * dim, _fcd label, _fcd unit, _fcd format)
+{
+    intn        isndg;
+    intn        rank, cdim;
+
+    DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          DFSDIgetrrank(&rank);
+          if (rank < *dim)
+              return FAIL;
+          cdim = rank - (intn) *dim + 1;
+      }
+    else
+        cdim = (intn) *dim;
+
+    return (DFSDgetdimstrs(cdim, (char *) _fcdtocp(label),
+                       (char *) _fcdtocp(unit), (char *) _fcdtocp(format)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdgetdimscale
+ * Purpose: Call DFSDgetdimscale to get scale for a dimension
+ * Inputs:  dim: dimension to get attributes for
+ *          maxsize: size of scale array
+ *          scale: array to return scale in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdimscale
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdgetdimscale(intf * dim, intf * maxsize, VOIDP scale)
+{
+
+    intn        isndg;
+    intn        rank, cdim;
+
+    DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          DFSDIgetrrank(&rank);
+          if (rank < *dim)
+              return FAIL;
+          cdim = rank - (intn) *dim + 1;
+      }
+    else
+        cdim = (intn) *dim;
+
+    return (DFSDgetdimscale(cdim, *maxsize, scale));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdgetrange
+ * Purpose: Call DFSDgetrange to get maximum and minimum data values
+ * Inputs:  pmax: float to return maximum in
+ *          pmin: float to return minimum in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetrange
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdgetrange(VOIDP pmax, VOIDP pmin)
+{
+    return (DFSDgetrange(pmax, pmin));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdsetdims
+ * Purpose: Call DFSDsetdims to set dimensions for subsequent SDGs
+ * Inputs:  rank: no of dimensions of SDG
+ *          dimsizes: array containing dimensions of SDG
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetdims
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdsetdims(intf * rank, intf dimsizes[])
+{
+
+    int32       i, *cdims, *p;
+    intf        ret;
+
+    p = (int32 *) HDmalloc((size_t) (*rank) * sizeof(int32));
+    if (p == NULL)
+        return FAIL;
+    cdims = p;
+    for (i = 1; i <= *rank; i++)
+      {
+          *p = dimsizes[*rank - i];
+          p++;
+      }
+
+    ret = DFSDsetdims((intn) *rank, cdims);
+    HDfree((VOIDP) cdims);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdsetdimscale
+ * Purpose: Call DFSDsetdimscale to set scales for subsequent SDGs
+ * Inputs:  dim: dimension to set scale for
+ *          dimsize: size of array scale
+ *          scale: array of scale values
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetdimscale
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdsetdimscale(intf * dim, intf * dimsize, VOIDP scale)
+{
+    intn        rank, cdim;
+
+    DFSDIgetwrank(&rank);
+    if (rank < *dim)
+        return FAIL;
+    cdim = rank - (intn) *dim + 1;
+
+    return (DFSDsetdimscale(cdim, *dimsize, scale));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdsetrange
+ * Purpose: Call DFSDsetrange to set max and min values for this SDG
+ * Inputs:  max, min: max and min data values
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetrange
+ * Remarks: Max and Min are set only for next SDG, reset to NULL after
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdsetrange(VOIDP max, VOIDP min)
+{
+    return (DFSDsetrange(max, min));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdclear
+ * Purpose: Call DFSDclear to erase values set for subsequent SDGs
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDclear
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdclear(void)
+{
+    return (DFSDclear());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdsetlengths
+ * Purpose: Call DFSDsetlengths to set max lengths of strings
+ * Inputs:  maxlen_label, maxlen_unit, maxlen_format, maxlen_coordsys: max lens
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetlengths
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdsetlengths(intf * maxlen_label, intf * maxlen_unit, intf * maxlen_format,
+                intf * maxlen_coordsys)
+{
+    return (DFSDsetlengths((intn) *maxlen_label, (intn) *maxlen_unit,
+                           (intn) *maxlen_format, (intn) *maxlen_coordsys));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdgetdimlen
+ * Purpose: Call DFSDgetdimlen to get actual lengths of strings
+ * Inputs:  dim: dimension to get lengths for
+ *         llabel, lunit, lformat: integers to return lengths of each string in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdimlen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdgetdimlen(intf * dim, intf * llabel, intf * lunit, intf * lformat)
+{
+    intn        isndg;
+    intn        rank, cdim;
+    intf        ret;
+    intn        cllabel, clunit, clformat;  /* convert between intf and intn */
+
+    ret = DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          ret = DFSDIgetrrank(&rank);
+          if (rank < *dim)
+              return FAIL;
+          cdim = rank - (intn) *dim + 1;
+      }
+    else
+        cdim = (intn) *dim;
+
+    ret = (intf) DFSDgetdimlen(cdim, &cllabel, &clunit, &clformat);
+    if (ret != FAIL)
+      {     /* if ok, copy the values over */
+          *llabel = cllabel;
+          *lunit = clunit;
+          *lformat = clformat;
+      }     /* end if */
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdgetdatalen
+ * Purpose: Call DFSDgetdatalen to get actual lengths of strings
+ * Inputs:  llabel, lunit, lformat, lcoordsys: integers to return lengths in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdatalen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdgetdatalen(intf * llabel, intf * lunit, intf * lformat, intf * lcoordsys)
+{
+    intf        ret;
+    intn        cllabel, clunit, clformat, clcoordsys;
+
+    ret = (intf) DFSDgetdatalen(&cllabel, &clunit, &clformat, &clcoordsys);
+    if (ret != FAIL)
+      {
+          *llabel = cllabel;
+          *lunit = clunit;
+          *lformat = clformat;
+          *lcoordsys = clcoordsys;
+      }     /* end if */
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdrestart
+ * Purpose: Call DFSDrestart to get SDGs again from the beginning
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDrestart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdrestart(void)
+{
+    return (DFSDrestart());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdputslice
+ * Purpose: Call DFSDIputslice to write slice to file
+ * Inputs:  winst: array of size = rank of data, containing start of slice
+ *          windims: array of size rank, containing end of slice
+ *          data: array containing slice
+ *          dims: dimensions of array data
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIputslice
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdputslice(intf windims[], VOIDP data, intf dims[])
+{
+    intn        rank, i;
+    intf        ret;
+    int32      *cdims, *cwindims, *p, *wp;
+
+    ret = DFSDIgetwrank(&rank);
+    wp = (int32 *) HDmalloc((size_t) (rank) * sizeof(int32));
+    if (wp == NULL)
+        return FAIL;
+    cwindims = wp;
+    p = (int32 *) HDmalloc((size_t) (rank) * sizeof(int32));
+    if (p == NULL)
+        return FAIL;
+    cdims = p;
+    for (i = 1; i <= rank; i++)
+      {     /* reverse dims & windims */
+          *p = dims[rank - i];
+          p++;
+          *wp = windims[rank - i];
+          wp++;
+      }
+
+    ret = DFSDIputslice(cwindims, data, cdims, 1);
+    HDfree((VOIDP) cdims);
+    HDfree((VOIDP) cwindims);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdendslice
+ * Purpose: Call DFSDendslice to finish slice writes and write out SDG
+ * Inputs:  none
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIendslice
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdendslice(void)
+{
+    return (DFSDIendslice(1));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdsetnt
+ * Purpose: Call DFSDsetNT to set number type for subsequent calls to
+ *          DFSDputdata, DFSDadddata, DFSDsetdimscales.
+ * Inputs:  numbertype
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ * Method:  Invokes DFSDsetNT
+ * Remarks: 0 specifies default value
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdsetnt(intf * numbertype)
+{
+    return (DFSDsetNT(*numbertype));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdgetnt
+ * Purpose: Call DFSDgetNT to get number type for subsequent calls
+ * Inputs:  pnumbertype
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ * Method:  Invokes DFSDgetNT
+ * Remarks: 0 specifies default value
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdgetnt(intf * pnumbertype)
+{
+    return (DFSDgetNT((int32 *) pnumbertype));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdlastref
+ * Purpose: Return last ref written or read
+ * Inputs:  none
+ * Globals: Lastref
+ * Returns: ref on success, -1 on error with DFerror set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFANlastref
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfsdlastref(void)
+{
+    return ((intf)DFSDlastref());
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsisdis
+ * Purpose: For the given dimension, set label, unit, format
+ *          This routine needs to be called once for each dimension whose
+ *          values the user wants to set.
+ * Inputs:  dim: the dimension that this info applies to
+ *          label: label to be used to describe this dimension
+ *          unit: units for dimension
+ *          format: format to be used in displaying
+ *          llabel, lunit, lformat: lengths of corresponding strings
+ * Globals:
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF users, utilities, other routines
+ * Invokes: DFSDIsetdimstr
+ * Method:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsisdis(intf * dim, _fcd flabel, _fcd funit, _fcd fformat,
+         intf * llabel, intf * lunit, intf * lformat)
+{
+    char       *label = HDf2cstring(flabel, (intn) *llabel);
+    char       *unit = HDf2cstring(funit, (intn) *lunit);
+    char       *format = HDf2cstring(fformat, (intn) *lformat);
+    intf        status;
+    intn        rank, cdim;
+
+    if (!(label && unit && format))
+    {
+	if (label) HDfree(label);
+	if (unit) HDfree(unit);
+	if (format) HDfree(format);
+	return FAIL;
+    }
+    status = DFSDIgetwrank(&rank);
+
+    if (rank < *dim)
+        return FAIL;
+    cdim = rank - (intn) *dim + 1;
+
+    status = DFSDIsetdimstrs(cdim, label, unit, format);
+
+    HDfree(label);
+    HDfree(unit);
+    HDfree(format);
+
+    return status;
+
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsigdis
+ * Purpose: Call DFSDgetdimstrs to get attributes of a dimension
+ * Inputs:  label, unit, format: strings to return attributes in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdimstrs
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsigdis(intf * dim, _fcd label, _fcd unit, _fcd format, intf * llabel,
+         intf * lunit, intf * lformat)
+{
+    char       *ilabel, *iunit, *iformat;
+    intn        rank, cdim;
+    intn        isndg, status;
+
+    DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          DFSDIgetrrank(&rank);
+          if (rank < *dim)
+              return FAIL;
+          cdim = rank - (intn) *dim + 1;
+      }
+    else
+        cdim = (intn) *dim;
+
+    iunit = ilabel = iformat = NULL;
+
+    if (*llabel)
+        ilabel = (char *) HDmalloc((size_t) *llabel + 1);
+    if (*lunit)
+        iunit = (char *) HDmalloc((size_t) *lunit + 1);
+    if (*lformat)
+        iformat = (char *) HDmalloc((size_t) *lformat + 1);
+
+    status = DFSDgetdimstrs(cdim, ilabel, iunit, iformat);
+
+    HDpackFstring(ilabel, _fcdtocp(label), (intn) *llabel);
+    HDpackFstring(iunit, _fcdtocp(unit), (intn) *lunit);
+    HDpackFstring(iformat, _fcdtocp(format), (intn) *lformat);
+
+    if (ilabel)
+        HDfree(ilabel);
+    if (iunit)
+        HDfree(iunit);
+    if (iformat)
+        HDfree(iformat);
+
+    return status;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsisdas
+ * Purpose: Set label, unit and format for displaying subsequent SDGs
+ * Inputs:  label: label to be used to describe data
+ *          unit: unit corresponding to data values
+ *          format: format to be used in displaying data values
+ *          coordsys: type of coordinate system
+ * Globals: Writesdg, Ref
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran stubs
+ * Invokes: DFSDIsetdatastrs
+ * Method:  Stores values in global structure Writesdg
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+ndsisdas(_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys, intf * isfortran,
+         intf * llabel, intf * lunit, intf * lformat, intf * lcoordsys)
+{
+    char       *label = HDf2cstring(flabel, (intn) *llabel);
+    char       *unit = HDf2cstring(funit, (intn) *lunit);
+    char       *format = HDf2cstring(fformat, (intn) *lformat);
+    char       *coordsys = HDf2cstring(fcoordsys, (intn) *lcoordsys);
+    intf        status;
+
+    if (!(label && unit && format))
+    {
+	if (label) HDfree(label);
+	if (unit) HDfree(unit);
+	if (format) HDfree(format);
+	return FAIL;
+    }
+
+    /* shut compiler up */
+    isfortran = isfortran;
+
+    status = DFSDIsetdatastrs(label, unit, format, coordsys);
+
+    HDfree(label);
+    HDfree(unit);
+    HDfree(format);
+    HDfree(coordsys);
+
+    return status;
+}   /* ndsisdas */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsigdas
+ * Purpose: Call DFSDgetdatastrs to get the data attributes
+ * Inputs:  label, unit, format, coordsys: strings to return attributes in
+ * Returns: 0 on success, -1 on failure with    DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdatastrs
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsigdas(_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf * llabel,
+         intf * lunit, intf * lformat, intf * lcoord)
+{
+    char       *ilabel, *iunit, *iformat, *icoord;
+    intf        status;
+
+    iunit = ilabel = iformat = icoord = NULL;
+
+    if (*llabel)
+        ilabel = (char *) HDmalloc((uint32) *llabel + 1);
+    if (*lunit)
+        iunit = (char *) HDmalloc((uint32) *lunit + 1);
+    if (*lformat)
+        iformat = (char *) HDmalloc((uint32) *lformat + 1);
+    if (*lcoord)
+        icoord = (char *) HDmalloc((uint32) *lcoord + 1);
+
+    status = DFSDgetdatastrs(ilabel, iunit, iformat, icoord);
+
+    HDpackFstring(ilabel, _fcdtocp(label), (intn) *llabel);
+    HDpackFstring(iunit, _fcdtocp(unit), (intn) *lunit);
+    HDpackFstring(iformat, _fcdtocp(format), (intn) *lformat);
+    HDpackFstring(icoord, _fcdtocp(coordsys), (intn) *lcoord);
+
+    if (ilabel)
+        HDfree(ilabel);
+    if (iunit)
+        HDfree(iunit);
+    if (iformat)
+        HDfree(iformat);
+    if (icoord)
+        HDfree(icoord);
+
+    return status;
+
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsscal
+ * Purpose: Call DFSDsetcal to set calibration data
+ * Inputs:  cal, cal_err   : calibration and error
+ *          ioff, ioff_err : offset and error
+ *          cal_type       : after calibration NT
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetdatastrs
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+ndsscal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err,
+        intf * cal_type)
+{
+    intf ret;
+    float64 dcal=0.0;
+    float64 dcal_err=0.0;
+    float64 dioff=0.0;
+    float64 dioff_err=0.0;
+    
+    HDmemcpy(&dcal, cal, sizeof(float64));
+    HDmemcpy(&dcal_err, cal_err, sizeof(float64));
+    HDmemcpy(&dioff, ioff, sizeof(float64));
+    HDmemcpy(&dioff_err, ioff_err, sizeof(float64));
+
+    ret=(intf)DFSDsetcal((float64)dcal, (float64)dcal_err, (float64)dioff, (float64)dioff_err, (int32)*cal_type);
+    return ret;
+}   /* ndsscal */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsgcal
+ * Purpose: Call DFSDgetcal to get calibration data
+ * Inputs:  cal, cal_err   : calibration and error
+ *          ioff, ioff_err : offset and error
+ *          cal_type       : after calibration NT
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetcal
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsgcal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err,
+        intf * cal_type)
+{
+    intf ret;
+    float64 dcal ;
+    float64 dcal_err ;
+    float64 dioff ;
+    float64 dioff_err ;
+    
+    ret =(intf) DFSDgetcal(&dcal, &dcal_err, &dioff, &dioff_err, (int32 *) cal_type);
+
+    HDmemcpy(cal, &dcal, sizeof(float64));
+    HDmemcpy(cal_err, &dcal_err, sizeof(float64));
+    HDmemcpy(ioff, &dioff, sizeof(float64));
+    HDmemcpy(ioff_err, &dioff_err, sizeof(float64));
+
+    return ret;
+}   /* ndsgcal */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsiwref
+ * Purpose: Call DFSDwriteref to set up next ref to write
+ * Inputs:  filename: name of HDF file
+ *          fnlen: length of filename
+ *          ref: next ref to read
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDwriteref
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsiwref(_fcd filename, intf * fnlen, intf * ref)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (!fn)
+	return(-1);
+    ret = DFSDwriteref(fn, (uint16) *ref);
+    HDfree(fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfsdsfill
+ * Purpose: Call DFSDsetfillvalue to set fill value for SDS
+ * Inputs:  fill_value: fill value for SDS
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDsetfillvalue
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndssfill(VOIDP fill_value)
+{
+    return DFSDsetfillvalue(fill_value);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsgfill
+ * Purpose: Call DFSDgetfillvalue to get fill value for SDS
+ * Inputs:  fill_value: fill value of SDS
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDgetfillvalue
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsgfill(VOIDP fill_value)
+{
+    return DFSDgetfillvalue(fill_value);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsisslab
+ * Purpose: Set up slab writes to SDS
+ * Inputs:  filename: file to which this applies
+ *          fnlen: file name length
+ * Returns: 0 on success, FAIL on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFSDstartslab
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsisslab(_fcd filename, intf * fnlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (fn == NULL)
+        return FAIL;
+    ret = DFSDstartslab(fn);
+    HDfree(fn);
+    return ret;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dswslab
+ * Purpose: Call DFSDwriteslab to write slab to file
+ * Inputs:  start: array of size = rank of data, containing start of slab
+ *          stride: array for subsampling
+ *          count: array of size rank, containing size of slab
+ *          data: array of data to be written
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDIgetwrank, HDmalloc, HDfree, HDf2cstring, DFSDwriteslab
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndswslab(intf start[], intf stride[],
+         intf count[], VOIDP data)
+{
+    int32      *lstart, *lstride, *lcount, *aptr, *bptr, *cptr;
+    intn        i, rank;
+    intf        ret;
+
+    /*
+       ** Lets reverse the order for the arrays since we
+       ** are going from fortran to C
+     */
+    ret = DFSDIgetwrank(&rank);
+    if (ret == FAIL)
+        return FAIL;
+
+    aptr = (int32 *) HDmalloc((size_t) (3 * rank) * sizeof(int32));
+    if (aptr == NULL)
+        return FAIL;
+
+    lstart = aptr;
+    lstride = bptr = aptr + rank;
+    lcount = cptr = bptr + rank;
+
+    for (i = 1; i <= rank; i++)
+      {     /* reverse start, stride & count */
+          *aptr = start[rank - i];
+          aptr++;
+          *bptr = stride[rank - i];
+          bptr++;
+          *cptr = count[rank - i];
+          cptr++;
+      }
+
+    ret = DFSDwriteslab(lstart, lstride, lcount, data);
+    HDfree((VOIDP) lstart);
+
+    return ret;
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dseslab
+ * Purpose: End slab writes to SDS, Write out NDG
+ * Inputs:  None
+ * Returns: 0 on success, FAIL on failure
+ * Users:   HDF programmers, other routines and utilities
+ * Invokes: DFSDendslab
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndseslab(void)
+{
+    return DFSDendslab();
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    dsirslab
+ * Purpose: Call DFSDreadslab to read slab from SDS
+ * Inputs:  filename: name of HDF file
+ *          start: array of size = rank of data, containing start of slab
+ *          slab_size: array of size rank, containing end of slab
+ *          stride: sub sampling stride.
+ *          buffer: array for returning slab
+ *          buffer_size: dimensions of array data
+ *          fnlen: length of filename
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFSDreadslab
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndsirslab(_fcd filename, intf * fnlen, intf start[], intf slab_size[],
+          intf stride[], VOIDP buffer, intf buffer_size[])
+{
+    char       *fn;
+    intf        ret;
+    intn        rank, i;
+    int32      *lbuffer_size, *lslab_size, *lstart, *lstride;
+    int32	*p, *wp, *wsp, *sp;
+    intn        isndg;
+
+    /* Convert "filename" to fortran string */
+    fn = HDf2cstring(filename, (intn) *fnlen);
+    if (fn == NULL)
+        return FAIL;
+
+    /* If DFSDgetdims has not be called call DFSDIsdginfo to refresh Readsdg */
+    if (DFSDIrefresh(fn) < 0)
+        return FAIL;
+
+    ret = DFSDIisndg(&isndg);
+    if (isndg)
+      {
+          ret = DFSDIgetrrank(&rank);
+          p = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+          if (p == NULL)
+              return FAIL;
+          lbuffer_size = p;
+          wp = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+          if (wp == NULL)
+              return FAIL;
+          lslab_size = wp;
+          wsp = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+          if (wsp == NULL)
+              return FAIL;
+          lstart = wsp;
+          sp = (int32 *) HDmalloc((size_t) rank * sizeof(int32));
+          if (sp == NULL)
+              return FAIL;
+          lstride = sp;
+
+          for (i = 1; i <= rank; i++)
+            {
+                *p = buffer_size[rank - i];
+                p++;
+                *wp = slab_size[rank - i];
+                wp++;
+                *wsp = start[rank - i];
+                wsp++;
+                *sp = stride[rank - i];
+                sp++;
+            }
+          ret = DFSDreadslab(fn, lstart, lslab_size, lstride, buffer,
+                             lbuffer_size);
+          HDfree((VOIDP) lstart);
+          HDfree((VOIDP) lslab_size);
+          HDfree((VOIDP) lbuffer_size);
+          HDfree((VOIDP) lstride);
+      }
+    else
+        ret = DFSDreadslab(fn, (int32 *) start, (int32 *) slab_size,
+                           (int32 *) stride, buffer, (int32 *) buffer_size);
+    HDfree(fn);
+    return (ret);
+}
diff --git a/hdf/src/dfsdff.f b/hdf/src/dfsdff.f
new file mode 100644
index 0000000..8abdae9
--- /dev/null
+++ b/hdf/src/dfsdff.f
@@ -0,0 +1,625 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: dfsdff.f 4932 2007-09-07 17:17:23Z bmribler $ 
+C
+C------------------------------------------------------------------------------
+C File:     dfsdFf.f
+C Purpose:  Fortran stubs for Fortran SDS routines
+C Invokes:  dfsdF.c dfsd.c
+C Contents: 
+C   dsgdims:        get dimensions of next SDG
+C   dsgdata:        get data for next SDG
+C   dssdast:        set strings for data for subsequent SDGs
+C   dssdist:        set strings for a dimension for subsequent SDGs
+C   dspdata:        write SDG to new file
+C   dsadata:        append SDG to existing file
+C   dsgslc:         get slice from file
+C   dssslc:         set up to write slices to file
+C   dsrref:	        set up next ref to read
+C   dsnum:          return number of SDGs in file
+C   dsp32sd:        is the SDG/ref written by HDF prior to version 3.2?
+C   dfsdgetdims:    get dimensions of next SDG
+C   dfsdgetdata:    get data for next SDG
+C   dfsdsetdatastrs:set strings for data for subsequent SDGs
+C   dfsdsetdimstrs: set strings for a dimension for subsequent SDGs
+C   dfsdputdata:    write SDG to new file
+C   dfsdadddata:    append SDG to existing file
+C   dfsdgetslice:   get slice from file
+C   dfsdstartslice: set up to write slices to file
+C   dfsdreadref:    set up next ref to read
+C   dfsdnumber:     return number of SDGs in the file
+C   dswref:         set up next ref to write
+C   dssslab:        set up write to SDS
+C   dsrslab:        set up to read from SDS
+C Remarks: none
+C------------------------------------------------------------------------------
+
+
+
+C------------------------------------------------------------------------------
+C Name: dsgdims
+C Purpose:  get dimensions of next SDG
+C Inputs:   filename: name of HDF file
+C           rank: integer to return rank in
+C           dimsizes: array to return dimensions in
+C           maxrank: size of array dimsizes
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes: dsigdim
+C------------------------------------------------------------------------------
+
+      integer function dsgdims(filename, rank, dimsizes, maxrank)
+      character*(*) filename
+      integer rank, dimsizes, maxrank, dsigdim
+
+      dsgdims = dsigdim(filename, rank, dimsizes, maxrank,
+     +                                              len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dsgdata
+C Purpose:  get data from next SDG
+C Inputs:   filename: name of HDF file
+C           rank: integer containing no of dimensions in array data
+C           maxsizes: array containing dimensions of array data
+C           data: array to return data values in
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsigdat
+C------------------------------------------------------------------------------
+
+      integer function dsgdata(filename, rank, maxsizes, data)
+      character*(*) filename
+      integer rank, maxsizes, dsigdat
+      real data
+
+      dsgdata = dsigdat(filename, rank, maxsizes, data,
+     +                                                len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dssdast
+C Purpose:  set data strings to be written out with next SDG
+C Inputs:   label, unit, format, coordsys: strings to be set
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsisdas_
+C------------------------------------------------------------------------------
+
+      integer function  dssdast(label, unit, format, coordsys)
+      character*(*) label, unit, format,  coordsys
+      integer dsisdas, len
+
+      dssdast = dsisdas(label, unit, format, coordsys,
+     +1, len(label), len(unit), len(format), len(coordsys))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dssdist
+C Purpose:  set dim strings to be written out with next SDG
+C Inputs:   label, unit, format, coordsys: strings to be set
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsisdis_
+C------------------------------------------------------------------------------
+
+      integer function  dssdist(dim, label, unit, format)
+      character*(*) label, unit, format
+      integer dim, len
+      integer dsisdis
+
+      dssdist = dsisdis(dim, label, unit, format,
+     +len(label), len(unit), len(format))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dspdata
+C Purpose:  call dsipdat to write SDG to new file
+C Inputs:   filename: name of HDF file
+C           rank: no of dimensions of array data
+C           dimsizes: array containing the dimensions of array data
+C           data: array containing the data values
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsipdat
+C------------------------------------------------------------------------------
+
+      integer function dspdata(filename, rank, dimsizes, data)
+      character*(*) filename
+      integer rank, dimsizes, data, len, dsipdat
+
+      dspdata = dsipdat(filename, rank, dimsizes, data, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dsadata
+C Purpose:  call dsiadat to append SDG to existing file
+C Inputs:   filename: name of HDF file
+C           rank: no of dimensions of array data
+C           dimsizes: array containing the dimensions of array data
+C           data: array containing the data values
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsiadat
+C------------------------------------------------------------------------------
+
+      integer function dsadata(filename, rank, dimsizes, data)
+      character*(*) filename
+      integer rank, dimsizes, data, len, dsiadat
+
+      dsadata = dsiadat(filename, rank, dimsizes, data, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dsgslc
+C Purpose:  call dsigslc to get slice from file
+C Inputs:   filename: name of HDF file
+C           winst: array of size = rank of data, containing start of slice
+C           winend: array of size rank, containing end of slice
+C           data: array for returning slice
+C           ndims: no of dims of array data
+C           dims: dimensions of array data
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsigslc
+C------------------------------------------------------------------------------
+
+      integer function dsgslc(filename,winst,windims,data,dims)
+      character*(*) filename
+      integer winst, windims, data, dims, dsigslc
+
+      dsgslc = dsigslc(filename, winst, windims, data, dims,
+     +     len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dssslc
+C Purpose:  call dsisslc to set up to write slices
+C Inputs:   filename: name of HDF file
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsisslc
+C------------------------------------------------------------------------------
+
+      integer function dssslc(filename)
+      character*(*) filename
+      integer dsisslc
+
+      dssslc = dsisslc(filename, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dsrref
+C Purpose:  call dsirref to set up next ref to read
+C Inputs:   filename: name of HDF file
+C           ref: next ref to read
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsirref
+C------------------------------------------------------------------------------
+
+      integer function dsrref(filename, ref)
+      character*(*) filename
+      integer ref
+      integer dsirref
+
+      dsrref = dsirref(filename, ref, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dsnum
+C Purpose:  return the number of SDGs in the file
+C Inputs:   filename: name of HDF file
+C Returns:  number of SDGs on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsinum
+C------------------------------------------------------------------------------
+
+      integer function dsnum(filename)
+      character*(*) filename
+      integer len, dsinum
+
+      dsnum = dsinum(filename, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dsp32sd
+C Purpose:  tests if the SDG with the specified ref was written by HDF prior to
+C            version 3.2
+C Input:    filename: name of HDF file
+C           ref: the ref number of the SDG
+C           ispre32: set to TRUE if the SDG/ref was written by old library;
+C                        to FALSE otherwise.
+C Retruns:  0 on success, -1 on failure
+C Users:    HDF Fortran programmers
+C------------------------------------------------------------------------------
+
+      integer function dsp32sd(filename, ref, ispre32)
+      character*(*) filename
+      integer ref, ispre32, len, dsip32s
+
+      dsp32sd = dsip32s(filename, ref, ispre32, len(filename))
+
+      return
+      end
+
+
+
+CEND7MAX
+
+
+C------------------------------------------------------------------------------
+C Name: dfsdgetdims
+C Purpose:  get dimensions of next SDG
+C Inputs:   filename: name of HDF file
+C           rank: integer to return rank in
+C           dimsizes: array to return dimensions in
+C           maxrank: size of array dimsizes
+C Returns: 0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes: dsigdim
+C------------------------------------------------------------------------------
+
+      integer function dfsdgetdims(filename, rank, dimsizes, maxrank)
+      character*(*) filename
+      integer rank, dimsizes, maxrank, dsigdim
+
+      dfsdgetdims = dsigdim(filename, rank, dimsizes, maxrank,
+     +                                              len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdgetdata
+C Purpose:  get data from next SDG
+C Inputs:   filename: name of HDF file
+C           rank: integer containing no of dimensions in array data
+C           maxsizes: array containing dimensions of array data
+C           data: array to return data values in
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsigdat
+C------------------------------------------------------------------------------
+
+      integer function dfsdgetdata(filename, rank, maxsizes, data)
+      character*(*) filename
+      integer rank, maxsizes, dsigdat
+      real data
+
+      dfsdgetdata = dsigdat(filename, rank, maxsizes, data,
+     +                                                len(filename))
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdsetdatastrs
+C Purpose:  set data strings to be written out with next SDG
+C Inputs:   label, unit, format, coordsys: strings to be set
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsisdas_
+C------------------------------------------------------------------------------
+
+      integer function  dfsdsetdatastrs(label, unit, format, coordsys)
+      character*(*) label, unit, format,  coordsys
+      integer dsisdas, len
+
+      dfsdsetdatastrs = dsisdas(label, unit, format, coordsys,
+     +1, len(label), len(unit), len(format), len(coordsys))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdsetdimstrs
+C Purpose:  set dim strings to be written out with next SDG
+C Inputs:   label, unit, format, coordsys: strings to be set
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsisdis_
+C------------------------------------------------------------------------------
+
+      integer function  dfsdsetdimstrs(dim, label, unit, format)
+      character*(*) label, unit, format
+      integer dim, len
+      integer dsisdis
+
+      dfsdsetdimstrs = dsisdis(dim, label, unit, format,
+     +len(label), len(unit), len(format))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdputdata
+C Purpose:  call dsipdat to write SDG to new file
+C Inputs:   filename: name of HDF file
+C           rank: no of dimensions of array data
+C           dimsizes: array containing the dimensions of array data
+C           data: array containing the data values
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsipdat
+C------------------------------------------------------------------------------
+
+      integer function dfsdputdata(filename, rank, dimsizes, data)
+      character*(*) filename
+      integer rank, dimsizes, data, len, dsipdat
+
+      dfsdputdata = dsipdat(filename,rank,dimsizes,data,len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdadddata
+C Purpose:  call dsiadat to append SDG to existing file
+C Inputs:   filename: name of HDF file
+C           rank: no of dimensions of array data
+C           dimsizes: array containing the dimensions of array data
+C           data: array containing the data values
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsiadat
+C------------------------------------------------------------------------------
+
+      integer function dfsdadddata(filename, rank, dimsizes, data)
+      character*(*) filename
+      integer rank, dimsizes, data, len, dsiadat
+
+      dfsdadddata = dsiadat(filename,rank,dimsizes,data,len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdgetslice
+C Purpose:  call dsigslc to get slice from file
+C Inputs:   filename: name of HDF file
+C           winst: array of size = rank of data, containing start of slice
+C           winend: array of size rank, containing end of slice
+C           data: array for returning slice
+C           ndims: no of dims of array data
+C           dims: dimensions of array data
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsigslc
+C------------------------------------------------------------------------------
+
+      integer function dfsdgetslice(filename, winst, winend, data,
+     +                                                     dims)
+      character*(*) filename
+      integer winst, winend, data,  dims, dsigslc
+
+      dfsdgetslice = dsigslc(filename, winst, winend, data,
+     +                                             dims, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdstartslice
+C Purpose:  call dsisslc to set up to write slices
+C Inputs:   filename: name of HDF file
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsisslc
+C------------------------------------------------------------------------------
+
+      integer function dfsdstartslice(filename)
+      character*(*) filename
+      integer dsisslc
+
+      dfsdstartslice = dsisslc(filename, len(filename))
+
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name:     dfsdreadref
+C Purpose:  call dsirref to set up next ref to read
+C Inputs:   filename: name of HDF file
+C           ref: next ref to read
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsirref
+C------------------------------------------------------------------------------
+
+      integer function dfsdreadref(filename, ref)
+      character*(*) filename
+      integer ref
+      integer dsirref
+
+      dfsdreadref = dsirref(filename, ref, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdnumber
+C Purpose:  return the number of SDGs in the file
+C Inputs:   filename: name of HDF file
+C Returns:  number of SDGs on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsinum
+C------------------------------------------------------------------------------
+
+      integer function dfsdnumber(filename)
+      character*(*) filename
+      integer len, dsinum
+
+      dfsdnumber = dsinum(filename, len(filename))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dfsdgetdimstrs
+C Purpose:  return the label unit and format for the current SDGs 
+C Inputs:   
+C Returns:  -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsinum
+C------------------------------------------------------------------------------
+
+      integer function dfsdgetdimstrs(dim, label, unit, format)
+      character*(*) label, unit, format
+      integer len, dsigdis, dim
+
+      dfsdgetdimstrs = dsigdis(dim, label, unit, format, len(label),
+     +   len(unit), len(format))
+
+      return
+      end
+
+
+C------------------------------------------------------------------------------
+C Name:     dsgdist
+C Purpose:  return the label unit and format for the current SDGs 
+C Inputs:   
+C Returns:  -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsinum
+C------------------------------------------------------------------------------
+
+      integer function dsgdist(dim, label, unit, format)
+      character*(*) label, unit, format
+      integer len, dsigdis, dim
+
+      dsgdist = dsigdis(dim, label, unit, format, len(label),
+     +   len(unit), len(format))
+
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name:     dsgdast
+C Purpose:  return the label unit and format for the current SDGs 
+C Inputs:   
+C Returns:  -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsinum
+C------------------------------------------------------------------------------
+
+      integer function dsgdast(label, unit, format, coordsys)
+      character*(*) label, unit, format, coordsys
+      integer len, dsigdas
+
+      dsgdast = dsigdas(label, unit, format, coordsys, len(label),
+     +   len(unit), len(format), len(coordsys))
+
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name:     dswref
+C Purpose:  set up next ref to write
+C Inputs:   filename: file to write to.
+C           ref: reference number to set.
+C Returns:  -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsiwref
+C------------------------------------------------------------------------------
+
+      integer function dswref(filename, ref)
+      character*(*) filename
+      integer ref, dsiwref
+
+      dswref = dsiwref(filename, len(filename), ref)
+ 
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name:     dssslab
+C Purpose:  Set up slab writes to SDS
+C Inputs:   filename: file to write to.
+C Returns:  -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsisslab
+C------------------------------------------------------------------------------
+
+      integer function dssslab(filename)
+      character*(*) filename
+      integer dsisslab
+
+      dssslab = dsisslab(filename, len(filename))
+ 
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name:     dsrslab
+C Purpose:  call dsirslab to get slab from SDS
+C Inputs:   fname: name of HDF file
+C           start: array of size = rank of data, containing start of slab
+C           slab_size: array of size rank, containing end of slab
+C           stride: sub sampling stride.
+C           buffer: array for returning slab
+C           buffer_size: dimensions of array data
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Invokes:  dsirslab
+C------------------------------------------------------------------------------
+
+      integer function dsrslab(fname, start, slabsize, stride, buffer,
+     +                         buffersize)
+      character*(*) fname
+      integer start, slabsize, stride, buffer, buffersize, dsirslab
+
+      dsrslab = dsirslab(fname, len(fname), start, slabsize, stride, 
+     +                   buffer, buffersize)
+
+      return
+      end
+
diff --git a/hdf/src/dfstubs.c b/hdf/src/dfstubs.c
new file mode 100644
index 0000000..c16b50c
--- /dev/null
+++ b/hdf/src/dfstubs.c
@@ -0,0 +1,1451 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6036 $";
+#endif
+
+/* $Id: dfstubs.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+/*
+   ** FILE
+   **   dfstubs.c
+   **   V3.X stubs for V4.0 "H-level" I/O routines.  First implemented: V3.2
+   ** EXPORTED ROUTINES
+   **   *DFopen -- open HDF file
+   **   *DFclose -- close HDF file
+   **   *DFdescriptors -- return a list of the data descriptors in the HDF file
+   **   *DFnumber -- count the number of occurrances of a given tag in HDF file
+   **   *DFsetfind -- set up a search
+   **   *DFfind -- search for tag/ref combination
+   **   DFaccess -- set up a read/write on a data element
+   **   DFstart -- set up a read/write on a data element
+   **   DFread -- read a portion of a data element
+   **   DFseek -- seek a new position within a data element
+   **   DFwrite -- write a portion of a data element
+   **   DFupdate -- write out updated DDs to HDF file
+   **   *DFstat -- provide status information about HDF file
+   **   *DFgetelement -- read an entire data element
+   **   *DFputelement -- write an entire data element
+   **   *DFdup -- create an additional descriptor for a data element
+   **   *DFdel -- delete a data element
+   **   *DFnewref -- get an unused reference number
+   **   *DFishdf -- is this an HDF file?
+   **   *DFerrno -- return value of DFerror
+   ** AUTHOR
+   **   Doug Ilg
+ */
+
+#include "dfstubs.h"
+#include "df.h"
+
+#define CKMALLOC( x, ret) { if (!x) { DFerror = DFE_NOSPACE; return(ret); } }
+
+#define CKSEEK(x,y,z, ret)  {  if (DF_SEEK( x,(long)y,z) <0) \
+                {DFerror = DFE_SEEKERROR; return(ret); } }
+
+#define CKSEEKEND(x,y,z, ret)   {  if (DF_SKEND( x,(long)y,z) <0) \
+                {DFerror = DFE_SEEKERROR; return(ret); } }
+
+#define CKREAD(x,y,z,f, ret)    { \
+                if (DF_READ( (char*)x, (int)(y), (int)(z), (f))<0) \
+                { DFerror = DFE_READERROR; return(ret); } \
+                }
+
+#define CKWRITE(x,y,z,f, ret)   { if (DF_WRITE( (char*)x, (int)y, (int)z,f)<0) \
+                {DFerror = DFE_WRITEERROR; return(ret); } }
+
+/*
+ *  Important Internal Variables
+ */
+PRIVATE DF *DFlist = NULL;      /* pointer to list of open DFs */
+#ifdef PERM_OUT
+PRIVATE int DFinuse = 0;        /* How many are currently in use */
+PRIVATE uint16 DFmaxref = 0;    /* which is the largest ref used? */
+PRIVATE unsigned char *DFreflist = NULL;    /* list of refs in use */
+PRIVATE char patterns[] =
+{0x80, 0x40, 0x20, 0x10, 0x08,
+ 0x04, 0x02, 0x01};
+#endif /* PERM_OUT */
+
+/*
+   ** NAME
+   **   DFopen -- open HDF file
+   ** USAGE
+   **   DF *DFopen(name, acc_mode, ndds)
+   **   char* name;             IN: name of file to open
+   **   int acc_mode;           IN: DFACC_READ, DFACC_WRITE, DFACC_CREATE,
+   **                               DFACC_ALL
+   **   int ndds;               IN: number of DDs in a block
+   ** RETURNS
+   **   DF ptr to open file on success, NULL on failure with DFerror set
+   ** DESCRIPTION
+   **   Open an HDF file, if it exists.  If file does not exist and write
+   **   access requested, create file.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   The pointer returned by DFopen is NOT a reference to a DF.  It is
+   **   just a place keeper for the new type of file handle.  Any program that
+   **   relies on the contents of a DF returned by DFopen must be re-written.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+DF         *
+DFopen(char *name, int acc_mode, int ndds)
+{
+    if (DFIcheck(DFlist) == 0)
+      {
+          DFerror = DFE_TOOMANY;
+          return (NULL);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    DFaccmode = acc_mode | DFACC_READ;
+    DFid = Hopen(name, DFaccmode, (int16) ndds);
+
+    if (DFid == -1)
+      {
+          DFerror = (int)HEvalue(1);
+          return (NULL);
+      }
+    else
+      {
+          /*
+             DFlist = makedf(DFid);
+           */
+          DFlist = (DF *) & DFid;
+          return (DFlist);
+      }
+}
+
+/*
+   ** NAME
+   **   DFclose -- close HDF file
+   ** USAGE
+   **   int DFclose(dfile)
+   **   DF *dfile;              IN: pointer to an open DF file
+   ** RETURNS
+   **   0 on success, -1 on failure with DFerror set
+   ** DESCRIPTION
+   **   Write out updated DDs; close DF file.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFclose(DF * dfile)
+{
+    int         ret;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (FAIL);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    if (DFelstat == DFEL_RESIDENT)
+      {
+          Hputelement(DFid, acc_tag, acc_ref, (unsigned char *) DFelement, DFelsize);
+          HDfree(DFelement);
+      }
+    else
+        Hendaccess(DFaid);
+
+    if (search_stat == DFSRCH_OLD)
+      {
+          Hendaccess(search_aid);
+          search_aid = 0;
+      }
+
+    ret = Hclose(DFid);
+    if (ret == 0)
+      {
+          dfile = 0;
+          DFlist = (DF *) NULL;
+          DFid = 0;
+          DFaccmode = 0;
+      }
+    else
+      {
+          DFerror = (int)HEvalue(1);
+      }
+
+    return (ret);
+}
+
+/*
+   ** NAME
+   **   DFdescriptors -- return a list of the data descriptors in the file
+   ** USAGE
+   **   int DFdescriptors(dfile, ptr, begin, num)
+   **   DF *dfile;              IN: pointer to an open DF file
+   **   DFdesc ptr[];           IN: pointer to space for the list of DDs
+   **   int begin;              IN: starting DD number
+   **   int num;                IN: number of entries
+   ** RETURNS
+   **   number of DDs returned in the list
+   ** DESCRIPTION
+   **   Fills in a list of all DDs in the file beginning with DD begin and
+   **   including a maximum of num entries.  The number of DDs actually entered
+   **   into the list is returned.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFdescriptors(DF * dfile, DFdesc ptr[], int begin, int num)
+{
+    int         i, ret;
+    int32       aid;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    aid = Hstartread(DFid, DFTAG_WILDCARD, DFREF_WILDCARD);
+
+    if (aid == FAIL)
+      {
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+
+    for (i = 2; i <= begin; i++)
+      {
+          ret = Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT);
+          if (ret == FAIL)
+            {
+                Hendaccess(aid);
+                DFerror = (int)HEvalue(1);
+                return (-1);
+            }
+      }
+
+    Hinquire(aid, NULL, &ptr[0].tag, &ptr[0].ref, &ptr[0].length,
+             &ptr[0].offset, NULL, NULL, NULL);
+
+    for (i = 1; i < num; i++)
+      {
+          ret = Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT);
+          if (ret == FAIL)
+            {
+              Hendaccess(aid);
+              return (i);
+            }
+          Hinquire(aid, NULL, &ptr[i].tag, &ptr[i].ref, &ptr[i].length,
+                   &ptr[i].offset, NULL, NULL, NULL);
+      }
+    Hendaccess(aid);
+
+    return (i);
+}
+
+/*
+   ** NAME
+   **   DFnumber -- return number of occurrences of given tag in the HDF file
+   ** USAGE
+   **   DFnumber(dfile, tag)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   uint16 tag;             IN: tag to count occurrences of
+   ** RETURNS
+   **   Number of occurrences on success, -1 on failure with DFerror set.
+   ** DESCRIPTION
+   **   Returns the number of occurrences of the specified tag in the HDF file.
+   **   If tag is DFTAG_WILDCARD, all tags are counted.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFnumber(DF * dfile, uint16 tag)
+{
+    int         num;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    num = Hnumber(DFid, tag);
+    return (num);
+}
+
+/*
+   ** NAME
+   **   DFsetfind -- set up parameters for a wildcard find
+   ** USAGE
+   **   int DFsetfind(dfile, tag, ref)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   uint16 tag;             IN: tag of element to search for (0 is wild)
+   **   uint16 ref;             IN: ref of element to search for (0 is wild)
+   ** RETURNS
+   **   0 on success, -1 on failure
+   ** DESCRIPTION
+   **   Sets up parameters for a wildcard find on a tag/ref pair.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFsetfind(DF * dfile, uint16 tag, uint16 ref)
+{
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    search_tag = tag;
+    search_ref = ref;
+
+    search_stat = DFSRCH_NEW;
+
+    return (0);
+}
+
+/*
+   ** NAME
+   **   DFfind -- perform wildcard searches
+   ** USAGE
+   **   int DFfind(dfile, ptr)
+   **   DF *dfile;              IN: pointer to an open DF file
+   **   DFdesc *ptr;            IN: pointer to put in DD when found
+   ** RETURNS
+   **   0 on success, -1 on failure
+   ** DESCRIPTION
+   **   If desired tag/ref is found, its DD is copied to *ptr.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFfind(DF * dfile, DFdesc * ptr)
+{
+    int         ret;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    if (search_stat == DFSRCH_NEW)
+      {
+          search_aid = Hstartread(DFid, search_tag, search_ref);
+          search_stat = DFSRCH_OLD;
+          ret = 0;
+      }
+    else
+      {
+          ret = Hnextread(search_aid, search_tag, search_ref, DF_CURRENT);
+      }
+
+    if ((search_aid == FAIL) || (ret == FAIL))
+      {
+          DFerror = DFE_NOMATCH;
+          ptr->tag = 0;
+          ptr->ref = 0;
+          return (-1);
+      }
+
+    Hinquire(search_aid, NULL, &ptr->tag, &ptr->ref, &ptr->length, &ptr->offset,
+             NULL, NULL, NULL);
+
+    return (0);
+}
+
+/*
+   ** NAME
+   **   DFaccess -- set up a read/write on a data element
+   ** USAGE
+   **   int DFaccess(dfile, tag, ref, acc_mode)
+   **   DF *dfile;              IN: pointer to open HDF file
+   **   uint16 tag;             IN: tag of element
+   **   uint16 ref;             IN: ref number of element
+   **   char *acc_mode;         IN: "r", "w", or "a" (read, write, append)
+   ** RETURNS
+   **   0 on success, -1 on failure
+   ** DESCRIPTION
+   **   Set up read or write access on data element.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   This function needs to call DFupdate and Hendaccess if there is already
+   **   an active access element with a different tag/ref.
+   **   Also, set up globals "acc_tag" and "acc_ref" to keep tabs on the data
+   **   being referenced, and "in_mem" to keep track of whether the data for
+   **   an element to be appended to has been read into memory.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFaccess(DF * dfile, uint16 tag, uint16 ref, char *acc_mode)
+{
+    int         accmode;
+    /*
+       DFdle *ptr;
+       int dle_num, index, i;
+     */
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    switch (*acc_mode)
+      {
+          case 'r':
+              accmode = DFACC_READ;
+              break;
+          case 'w':
+              accmode = DFACC_WRITE;
+              if (((DFaccmode & DFACC_WRITE) == 0) &&
+                  ((DFaccmode & DFACC_CREATE) == 0))
+                {
+                    DFerror = DFE_BADACC;
+                    return (-1);
+                }
+              break;
+          case 'a':
+              accmode = DFACC_APPEND;
+              if (((DFaccmode & DFACC_WRITE) == 0) &&
+                  ((DFaccmode & DFACC_CREATE) == 0))
+                {
+                    DFerror = DFE_BADACC;
+                    return (-1);
+                }
+              break;
+          default:
+              DFerror = DFE_BADACC;
+              return (-1);
+      }
+
+/* test
+   if (((tag != acc_tag) || (ref != acc_ref)) || (accmode != DFelaccmode))
+   if (DFelstat == DFEL_RESIDENT) {
+   Hputelement(DFid, acc_tag, acc_ref, DFelement, DFelsize);
+   HDfree(DFelement);
+   }
+   else
+   Hendaccess(DFaid);
+   test */
+
+    acc_tag = tag;
+    acc_ref = ref;
+    DFelaccmode = accmode;
+    DFelstat = DFEL_ABSENT;
+    DFelseekpos = 0;
+    DFelsize = 0;
+
+    switch (*acc_mode)
+      {
+          case 'r':
+              DFelsize = Hlength(DFid, acc_tag, acc_ref);
+              if (DFelsize <= 0)
+                {
+                    DFIclearacc();
+                    DFerror = (int)HEvalue(1);
+                    return (-1);
+                }
+              /* test
+                 DFaid = Hstartread(DFid, acc_tag, acc_ref);
+                 if (DFaid != FAIL) {
+                 Hinquire(DFaid, (int32*)NULL, (uint16*)NULL, (uint16*)NULL,
+                 &DFelsize, (int32*)NULL, (int32*)NULL,
+                 (int32*)NULL, (int32*)NULL);
+                 inq_accid(DFaid, &dle_num, &index, &(dfile->up_access));
+                 Hendaccess(DFaid);
+                 ptr = dfile->list;
+                 for (i=0; i<dle_num; i++)
+                 ptr = ptr->next;
+                 dfile->up_dd = &(ptr->dd[index]);
+                 } else {
+                 DFIclearacc();
+                 DFerror = HEvalue(1);
+                 return(-1);
+                 }
+                 test */
+              break;
+              /* _maybe_ treat 'w' and 'a' in the same general 'a'-way */
+          case 'w':
+              DFelsize = Hlength(DFid, acc_tag, acc_ref);
+              if (DFelsize == FAIL)
+                {
+                    DFelsize = 0;
+                }
+              else
+                  DFelstat = DFEL_RESIDENT;
+              break;
+          case 'a':
+              DFelsize = Hlength(DFid, acc_tag, acc_ref);
+              if (DFelsize == FAIL)
+                {
+                    DFIclearacc();
+                    DFerror = (int)HEvalue(1);
+                    return (-1);
+                }
+              DFelseekpos = DFelsize;
+              break;
+      }
+
+    return (0);
+}
+
+PRIVATE int
+DFIclearacc(void)
+{
+    Hendaccess(DFaid);
+    DFaid = 0;
+    acc_tag = 0;
+    acc_ref = 0;
+    DFelsize = 0;
+    DFelseekpos = 0;
+    DFelstat = DFEL_ABSENT;
+    DFelement = NULL;
+
+    return (0);
+}
+
+/*
+   ** NAME
+   **   DFstart -- set up a read/write on an access element
+   ** USAGE
+   **   int DFstart(dfile, tag, ref, acc_mode)
+   **   DF *dfile;              IN: pointer to open  DF file
+   **   uint16 tag;             IN: tag of element
+   **   uint16 ref;             IN: ref number of element
+   **   char *acc_mode;         IN: "r", "w", ro "a" (read, write, append)
+   ** RETURNS
+   **   0 on success, -1 on failure
+   ** DESCRIPTION
+   **   Set up a read or write access on data element.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFstart(DF * dfile, uint16 tag, uint16 ref, char *acc_mode)
+{
+    return (DFaccess(dfile, tag, ref, acc_mode));
+}
+
+/*
+   ** NAME
+   **   DFread -- read a portion of a data element
+   ** USAGE
+   **   int32 DFread(dfile, ptr, len)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   char *ptr;              IN: pointer to space to read data into
+   **   int32 len;              IN: number of bytes to read
+   ** RETURNS
+   **   number of bytes read on success, -1 on failure
+   ** DESCRIPTION
+   **   Read bytes from a DF file (part of element specified by DFaccess)
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   Space for data is assumed to be pre-allocated.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int32
+DFread(DF * dfile, char *ptr, int32 len)
+{
+    int32       ret;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    DFaid = Hstartread(DFid, acc_tag, acc_ref);
+    ret = Hseek(DFaid, DFelseekpos, 0);
+    if (ret == FAIL)
+      {
+          Hendaccess(DFaid);
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+
+    ret = Hread(DFaid, len, (unsigned char *) ptr);
+    Hendaccess(DFaid);
+
+    if (ret == FAIL)
+      {
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+    else
+      {
+          DFelseekpos += ret;
+          return (ret);
+      }
+}
+
+/*
+   ** NAME
+   **   DFseek -- seek a new position within a data element
+   ** USAGE
+   **   int32 DFseek(dfile, offset)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   int32 offset;           IN: offset from beginning of element
+   ** RETURNS
+   **   offset of actual position seek'ed to from beginning of element
+   ** DESCRIPTION
+   **   Seek position within element specified by DFaccess.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int32
+DFseek(DF * dfile, int32 offset)
+{
+    int         ret;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    /* assuming no blank space can be forced by seeking past end of element
+       and writing more data */
+    if (offset > DFelsize)
+      {
+          DFerror = DFE_BADSEEK;
+          return (-1);
+      }
+    else
+      {
+          ret = Hseek(DFaid, offset, DF_START);
+          if (ret == FAIL)
+            {
+                DFerror = (int)HEvalue(1);
+                return (-1);
+            }
+          DFelseekpos = offset;
+      }
+
+    return (0);
+}
+
+/*
+   ** NAME
+   **   DFwrite -- write a portion of a data element
+   ** USAGE
+   **   int32 DFwrite(dfile, ptr, len)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   char *ptr;              IN: pointer to data to be written
+   **   int32 len;              IN: number of bytes to be written
+   ** RETURNS
+   **   number of bytes written on success, -1 on failure
+   ** DESCRIPTION
+   **   Write bytes to DF file (part of element specified by DFaccess)
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   This function should check the access mode in DFaccmode.  On write
+   **   access, if(!in_mem) Hstartwrite, Hwrite, and set in_mem, otherwise just
+   **   Hwrite.  On append access, if(!in_mem) Hstartread, Hinquire(oldsize),
+   **   malloc(oldsize+writesize), Hread to malloc'd area, copy write request
+   **   to end of malloc'd area, set in_mem, otherwise, realloc(area+writesize)
+   **   copy write request to end of area.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int32
+DFwrite(DF * dfile, char *ptr, int32 len)
+{
+    int32       size, ret, newlen;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    if ((DFelaccmode != DFACC_WRITE) && (DFelaccmode != DFACC_APPEND))
+      {
+          DFerror = DFE_BADACC;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    size = DFelseekpos + len;
+    if (DFelaccmode == DFACC_WRITE)
+      {
+          if (DFelstat == DFEL_ABSENT)
+            {
+                Hendaccess(DFaid);
+                DFaid = Hstartwrite(DFid, acc_tag, acc_ref, len);
+                Hseek(DFaid, DFelseekpos, DF_START);
+                ret = Hwrite(DFaid, len, (unsigned char *) ptr);
+            }
+          else
+            {
+                if (size <= DFelsize)
+                  {
+                      Hendaccess(DFaid);
+                      DFaid = Hstartwrite(DFid, acc_tag, acc_ref, len);
+                      Hseek(DFaid, DFelseekpos, DF_START);
+                      ret = Hwrite(DFaid, len, (unsigned char *) ptr);
+                  }
+                else
+                  {
+                      Hendaccess(DFaid);
+                      DFerror = DFE_NOTENOUGH;
+                      return (-1);
+                  }
+            }
+      }
+    else
+      {
+          newlen = size - Hlength(DFid, acc_tag, acc_ref);
+          Hendaccess(DFaid);
+          DFaid = HLcreate(DFid, acc_tag, acc_ref, newlen, (int32) 4);
+          Hseek(DFaid, DFelseekpos, DF_START);
+          ret = Hwrite(DFaid, len, (unsigned char *) ptr);
+      }
+
+    Hendaccess(DFaid);
+    DFelseekpos += len;
+    DFelsize = size;
+    DFelstat = DFEL_RESIDENT;
+
+    return (ret);
+}
+
+/*
+   ** NAME
+   **   DFupdate -- write out updated DDs to HDF file
+   ** USAGE
+   **   int DFupdate(dfile)
+   **   DF *dfile;              IN: pointer to open DF file
+   ** RETURNS
+   **   0 on success, -1 on failure with DFerror set.
+   ** DESCRIPTION
+   **   This function only checks for valid input and returns.  It is included
+   **   solely for compatibility with older programs.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   This function does nothing but check for valid input.
+   **   However, this function should check to see if an appended-to data
+   **   element is in memory and, if it is, write it out.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFupdate(DF * dfile)
+{
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    /* test
+       if (DFelstat == DFEL_RESIDENT) {
+       Hputelement(DFid, acc_tag, acc_ref, DFelement, DFelsize);
+       HDfree(DFelement);
+       DFIclearacc();
+       }
+       test */
+
+    return (0);
+}
+
+/*
+   ** NAME
+   **   DFstat -- provide status information about HDF file
+   ** USAGE
+   **   int DFstat(dfile, dfinfo)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   struct DFdata *dfinfo;  IN: pointer to space for info
+   ** RETURNS
+   **   0 on success, -1 on failure
+   ** DESCRIPTION
+   **   Fill dfinfo with status information about the HDF file.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   Currently, only the HDF version number is returned in dfinfo.
+   **   Actually, nothing happens here now.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFstat(DF * dfile, DFdata * dfinfo)
+{
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    dfinfo = dfinfo;
+
+    return (0);
+}
+
+/*
+   ** NAME
+   **   DFgetelement -- read an entire data element
+   ** USAGE
+   **  int32 DFgetelement(dfile, tag, ref, ptr)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   uint16 tag;             IN: tag of element
+   **   uint16 ref;             IN: ref number of element
+   **   char *ptr;              IN: pointer to space for data element
+   ** RETURNS
+   **   number of bytes read on success, -1 on failure
+   ** DESCRIPTION
+   **   Reads in a data element from an HDF file.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   Currently, this function returns 0 on success, not #bytes read.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int32
+DFgetelement(DF * dfile, uint16 tag, uint16 ref, char *ptr)
+{
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    /* test
+       if (DFelstat == DFEL_RESIDENT) {
+       Hputelement(DFid, acc_tag, acc_ref, DFelement, DFelsize);
+       HDfree(DFelement);
+       DFIclearacc();
+       }
+       test */
+
+    if (Hgetelement(DFid, tag, ref, (unsigned char *) ptr) == -1)
+      {
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+    else
+        return (Hlength(DFid, tag, ref));
+}
+
+/*
+   ** NAME
+   **   DFputelement -- write an entire data element
+   ** USAGE
+   **   int DFputelement(dfile, tag, ref, ptr, len)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   uint16 tag;             IN: tag of data element
+   **   uint16 ref;             IN: ref number of data element
+   **   char *ptr;              IN: pointer to data element
+   **   int32 len;              IN: length of data element
+   ** RETURNS
+   **   Number of bytes written on success, -1 on failure
+   ** DESCRIPTION
+   **   Write an entire data element to HDF file.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int32
+DFputelement(DF * dfile, uint16 tag, uint16 ref, char *ptr, int32 len)
+{
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    /* test
+       if (DFelstat == DFEL_RESIDENT) {
+       Hputelement(DFid, acc_tag, acc_ref, DFelement, DFelsize);
+       HDfree(DFelement);
+       DFIclearacc();
+       }
+       test */
+
+    if (Hputelement(DFid, tag, ref, (unsigned char *) ptr, len) == FAIL)
+      {
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+    else
+        return (Hlength(DFid, tag, ref));
+}
+
+/*
+   ** NAME
+   **   DFdup -- create an additional descriptor for a data element
+   ** USAGE
+   **   int DFdup(dfile, itag, iref, otag, oref)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   uint16 itag;            IN: new tag of data element
+   **   uint16 iref;            IN: new ref number of data element
+   **   uint16 otag;            IN: current tag of data element
+   **   uint16 oref;            IN: current ref number of data element
+   ** RETURNS
+   **   0 on success, -1 on failure
+   ** DESCRIPTION
+   **   Add a new tag/ref for existing data.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFdup(DF * dfile, uint16 itag, uint16 iref, uint16 otag, uint16 oref)
+{
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    if (Hdupdd(DFid, itag, iref, otag, oref) != SUCCEED)
+      {
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+    else
+        return (0);
+}
+
+/*
+   ** NAME
+   **   DFdel -- delete a data element
+   ** USAGE
+   **   int DFdel(dfile, tag, ref)
+   **   DF *dfile;              IN: pointer to open DF file
+   **   uint16 tag;             IN: tag of element
+   **   uint16 ref;             IN: ref number of element
+   ** RETURNS
+   **   0 on success, -1 on failure
+   ** DESCRIPTION
+   **   Delete a data element from HDF file.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   The data element is not actually deleted; it simply loses its DD.
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFdel(DF * dfile, uint16 tag, uint16 ref)
+{
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (-1);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    if (Hdeldd(DFid, tag, ref) != 0)
+      {
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+    else
+        return (0);
+}
+
+/*
+   ** NAME
+   **   DFnewref -- get an unused reference number
+   ** USAGE
+   **   uint16 DFnewref(dfile)
+   **   DF *dfile;              IN: pointer to open DF file
+   ** RETURNS
+   **   unused reference number, or 0 if no reference numbers are free
+   ** DESCRIPTION
+   **   Get an unused reference number.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+uint16
+DFnewref(DF * dfile)
+{
+    uint16      ret;
+
+    if (DFIcheck(dfile) != 0)
+      {
+          DFerror = DFE_NOTOPEN;
+          return (0);
+      }
+    else
+        DFerror = DFE_NONE;
+
+    ret = Hnewref(DFid);
+    if (ret == 0xffff)
+      {
+          DFerror = (int)HEvalue(1);
+          return (0);
+      }
+
+    return (ret);
+}
+
+/*
+   ** NAME
+   **   DFishdf -- is this an HDF file?
+   ** USAGE
+   **   int DFishdf(filename)
+   **   char *filename;         IN: name of file to check
+   ** RETURNS
+   **   0 if it is an HDF file, -1 if it is not.
+   ** DESCRIPTION
+   **   Determine whether file is an HDF file.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFishdf(char *filename)
+{
+    int32       dummy;
+
+    DFerror = DFE_NONE;
+
+    dummy = Hopen(filename, DFACC_READ, 0);
+    if (dummy == -1)
+      {
+          DFerror = (int)HEvalue(1);
+          return (-1);
+      }
+    else
+      {
+          Hclose(dummy);
+          return (0);
+      }
+}
+
+/*
+   ** NAME
+   **   DFerrno -- return value of DFerror
+   ** USAGE
+   **   int DFerrno()
+   ** RETURNS
+   **   Value of DFerror.
+   ** DESCRIPTION
+   **   Return value of DFerror.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+   ** REVISION LOG
+ */
+int
+DFerrno(void)
+{
+    return (DFerror);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFIcheck
+ * Purpose: check if dfile argument represents a valid DF file
+ * Inputs:  dfile: pointer to open DF file
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF systems programmers, several routines in this file
+ *---------------------------------------------------------------------------*/
+
+PRIVATE int
+DFIcheck(DF * dfile)
+{
+    DFerror = DFE_NONE;
+
+    if ((dfile != (DF *) & DFid) || (DFid == 0))
+      {
+          DFerror = DFE_DFNULL;
+          return (-1);
+      }
+
+    if ((DFaccmode & DFACC_ALL) != DFaccmode)
+      {
+          DFerror = DFE_BADACC;
+          return (-1);
+      }
+    else
+        return (0);
+
+    /* test
+       if (!dfile) {
+       DFerror = DFE_DFNULL;
+       return(-1);
+       }
+
+       if ((dfile->access & DFACC_ALL) != dfile->access)
+       DFerror = DFE_BADACC;
+
+       if ((dfile->type >1) || (dfile->type <-1))
+       DFerror = DFE_ILLTYPE;
+
+       if (!dfile->list)
+       DFerror= DFE_BADDDLIST;
+
+       if (DFerror)
+       return(-1);
+       else
+       return(0);
+       test */
+
+}
+
+#ifdef PERM_OUT
+/*-----------------------------------------------------------------------------
+ * Name:    DFIfind
+ * Purpose: perform wildcard searches
+ * Inputs:  dfile: pointer to open DF file
+ *          tag, ref: tag, ref (possibly wildcard) being searched for
+ *          isfirst: 1 if first call to DFIfind for this tag/ref, else 0
+ *          ltag, lref: last tag and ref returned for this search,
+ *              don't care if isfirst set
+ *          cDLEp, cddp: pointers to DLE and DD number to return matched DD in
+ * Returns: 0 on success, -1 on failure
+ *          if success, cDLEp and cddp are set to point to matched DD
+ * Users:   HDF system programmers, DFfind, HDF utilities, many routines
+ * Remarks: The searching algorithm is a little complex.  It returns entries
+ *          in the sorting order of refs, then tags.  Even after a candidate
+ *          is found, searching continues till best candidate found.  Best way
+ *          to check if conditions: work it out independently for yourself!
+ *---------------------------------------------------------------------------*/
+
+int
+DFIfind(dfile, tag, ref, isfirst, ltag, lref, cDLEp, cddp)
+DF         *dfile;
+DFdle     **cDLEp;
+int        *cddp;
+int         isfirst;            /* 1 if no prev search, 0 otherwise */
+uint16      tag, ref, ltag, lref;
+{
+    DFdle      *DLEp;
+    int         i, found = 0;
+    uint16      ctag = 0, cref = 0, wtag, wref;     /* ctag, cref: tag, ref found so far */
+    /* wtag, wref: tag, ref being checked */
+
+    if (isfirst)
+      {
+          search_tag = tag;
+          search_ref = ref;
+      }
+
+    DLEp = dfile->list;     /* start of DLE list */
+
+    if (tag && ref)
+      {     /* No wildcards */
+          if (isfirst)
+            {   /* if not already found */
+                while (DLEp)
+                  {     /* go through list */
+                      for (i = 0; i < DLEp->ddh.dds; i++)
+                        {   /* for all DDs */
+                            if (DLEp->dd[i].tag == tag &&
+                                DLEp->dd[i].ref == ref)
+                              {
+                                  *cDLEp = DLEp;
+                                  *cddp = i;
+                                  return (0);
+                              }
+                        }
+                      DLEp = DLEp->next;
+                  }
+            }
+      }
+    else if (tag && !ref)   /* wildcard ref */
+        while (DLEp)
+          {
+              for (i = 0; i < DLEp->ddh.dds; i++)
+                {
+                    wtag = DLEp->dd[i].tag;
+                    wref = DLEp->dd[i].ref;
+                    /* condition = tag match, better than found so far (if any),
+                       follows what was returned last time (if any) */
+                    if ((wtag == tag) && (!found || (wref < cref)) &&
+                        (isfirst || (wref > lref)))
+                      {
+                          ctag = wtag;
+                          cref = wref;
+                          *cDLEp = DLEp;
+                          *cddp = i;
+                          found = 1;
+                      }
+                }
+              DLEp = DLEp->next;
+          }
+    else if (!tag && ref)   /* wildcard tag */
+        while (DLEp)
+          {
+              for (i = 0; i < DLEp->ddh.dds; i++)
+                {
+                    wtag = DLEp->dd[i].tag;
+                    wref = DLEp->dd[i].ref;
+                    if ((wref == ref) && (isfirst || (wtag > ltag)) &&
+                        (!found || (wtag < ctag)))
+                      {
+                          ctag = wtag;
+                          cref = wref;
+                          *cDLEp = DLEp;
+                          *cddp = i;
+                          found = 1;
+                      }
+                }
+              DLEp = DLEp->next;
+          }
+    else if (!tag && !ref)  /* wildcard tag & ref */
+        while (DLEp)
+          {
+              for (i = 0; i < DLEp->ddh.dds; i++)
+                {
+                    wtag = DLEp->dd[i].tag;
+                    wref = DLEp->dd[i].ref;
+                    if ((isfirst || (wref > lref) || (wref == lref && wtag > ltag)) &&
+                        (!found || (wref < cref) || (wref == cref && wtag < ctag)) &&
+                        (wtag != DFTAG_NULL))   /* empty DDs are invisible */
+                      {
+                          ctag = wtag;
+                          cref = wref;
+                          *cDLEp = DLEp;
+                          *cddp = i;
+                          found = 1;
+                      }
+                }
+              DLEp = DLEp->next;
+          }
+    return (found - 1);     /* 0 or -1 */
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFIemptyDD
+ * Purpose: find an empty DD to use, or create a block of DDs if necessary
+ * Inputs:  dfile: pointer to open DF file
+ * Returns: pointer to an empty DD
+ * Invokes: DFIfind
+ * Users:   HDF system programmers, DFaccess, DFdup
+ *---------------------------------------------------------------------------*/
+
+DFdd       *
+DFIemptyDD(dfile)
+DF         *dfile;
+{
+    DFdle      *cDLEp;
+    int         cdd;
+
+    if (!DFIfind(dfile, DFTAG_NULL, DFREF_WILDCARD, 1, 0, 0, &cDLEp, &cdd))
+        return (&(cDLEp->dd[cdd]));     /* there is an empty DD */
+
+    else
+      {     /* add new DDH block */
+          int32       fpos;
+          DFdle      *p, *dle;
+          DFddh       ddh;
+          DFdd        dd;
+          int         j;
+          char        MYtbuf[12];   /* My own tbuf so that the content
+                                       of DFtbuf will be preserved */
+
+          CKSEEKEND(dfile->file, (long) 0, 2, NULL);    /* go to end of df */
+          fpos = (int32) DF_TELL(dfile->file);
+          ddh.dds = dfile->defdds;  /* Initialize ddh */
+          ddh.next = 0;
+          dd.tag = DFTAG_NULL;  /* and all DD's */
+          dd.ref = 0;
+#ifdef DF_STRUCTOK
+          CKWRITE(&ddh, sizeof(DFddh), 1, dfile->file, NULL);
+#else  /*DF_STRUCTOK */
+          {
+              char *p;
+              p = MYtbuf;
+              INT16WRITE(p, ddh.dds);
+              INT32WRITE(p, ddh.next);
+              CKWRITE(MYtbuf, 6, 1, dfile->file, NULL);     /* 6 = size of header */
+          }
+#endif /*DF_STRUCTOK */
+          for (j = 0; j < ddh.dds; j++)
+            {
+#ifdef DF_STRUCTOK
+                CKWRITE(&dd, sizeof(DFdd), 1, dfile->file, NULL);
+#else  /*DF_STRUCTOK */
+                {
+                    char *p;
+                    p = MYtbuf;
+                    UINT16WRITE(p, dd.tag);
+                    UINT16WRITE(p, dd.tag);
+                    INT32WRITE(p, dd.offset);
+                    INT32WRITE(p, dd.length);
+                    CKWRITE(MYtbuf, 12, 1, dfile->file, NULL);  /* 12=size of dd */
+                }
+#endif /*DF_STRUCTOK */
+            }
+
+          p = dfile->list;  /* find end of list */
+          while (p->next)
+              p = p->next;
+
+          p->ddh.next = fpos;   /* new dd goes at end of file */
+          dle = (DFdle *)
+              DFIgetspace((unsigned)
+                          (sizeof(DFdle) + (ddh.dds - 1) * sizeof(DFdd)));
+          /* one dd included in dle */
+          CKMALLOC(dle, NULL);
+          p->next = dle;    /* insert dle at end of list */
+          dle->next = NULL;
+          HDmemcpy((char *) &dle->ddh, (char *) &ddh, sizeof(DFddh));
+          for (j = 0; j < ddh.dds; j++)
+              HDmemcpy((char *) &dle->dd[j], (char *) &dd, sizeof(DFdd));
+          return (&(dle->dd[0]));
+      }
+    return (NULL);  /* dummy, for return value checking */
+}
+
+/* Simplified version without the overhead.  This is useful if you */
+ /* know that the args are okay, and if you need to read many time */
+ /* (like in a loop in DFSDIgetslice()) */
+int32
+DFIread(dfile, ptr, len)
+DF         *dfile;
+char       *ptr;
+int32       len;
+{
+    int32       maxlen;
+    maxlen = dfile->up_dd->length -
+        ((int32) DF_TELL(dfile->file) - dfile->up_dd->offset);
+    if (len > maxlen)
+        len = maxlen;
+    if (len < 0)
+      {     /* will also catch reads from beyond element */
+          DFerror = DFE_BADLEN;
+          return (-1);
+      }
+
+    if (len)
+      {     /* NOTE: cast to (int) will limit to 64K on 16 bit m/cs */
+          CKREAD(ptr, (int) len, 1, dfile->file, -1);
+      }
+
+    return (len);
+}
+
+/* Simplified version without the overhead.  This is useful if you */
+ /* know that the args are okay, and if you need to seek many time */
+ /* (like in a loop in DFSDIgetslice()) */
+int32
+DFIseek(dfile, offset)
+DF         *dfile;
+int32       offset;
+{
+    CKSEEK(dfile->file, (long) dfile->up_dd->offset + offset, 0, -1);
+    return (offset);
+}
+#endif /* PERM_OUT */
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFIerr
+ * Purpose: Close a file and return on error. save DFerror
+ * Inputs:  dfile: pointer to HDF file to close
+ * Returns: -1
+ * Users:   HDF systems programmers, for error handling
+ * Invokes: DFclose
+ * Remarks: Used to centralize some error handling
+ *---------------------------------------------------------------------------*/
+
+int
+DFIerr(DF * dfile)
+{
+    int         saveerror;
+
+    saveerror = DFerror;
+    if (dfile != NULL)
+        (void) DFclose(dfile);
+    DFerror = saveerror;
+    return (-1);
+}
+
+/*-----------------------------------------------------------------------------
+ * The following functions are stubs for the old routines from "dfkit.c".
+ *---------------------------------------------------------------------------*/
+
+#if !(defined IBM6000 | defined SUN)
+#include <ctype.h>
+#endif
+
+void       *
+DFIgetspace(uint32 qty)
+{
+    void       *ret;
+
+    ret = (void *) HDmalloc(qty);
+    DFerror = (int)HEvalue(1);
+    return (ret);
+}
+
+void       *
+DFIfreespace(void *ptr)
+{
+#ifdef MALLOC_CHECK
+    return (HDfree(ptr));
+#else
+    HDfree(ptr);
+    return (NULL);
+#endif
+}
+
+intn
+DFIc2fstr(char *str, int len)
+{
+    return (HDc2fstr(str, len));
+}
+
+char       *
+DFIf2cstring(_fcd fdesc, intn len)
+{
+    return (HDf2cstring(fdesc, len));
+}
diff --git a/hdf/src/dfstubs.h b/hdf/src/dfstubs.h
new file mode 100644
index 0000000..f288f65
--- /dev/null
+++ b/hdf/src/dfstubs.h
@@ -0,0 +1,76 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfstubs.h 6036 2014-01-20 17:28:01Z acheng $ */
+
+/*
+   ** FILE
+   **   dfstubs.h
+   ** PURPOSE
+   **   Header file for "dfstubs.c" HDF 3.1 emulation using new routines
+   **   from "hfile.c".
+   ** AUTHOR
+   **   Doug Ilg
+ */
+
+#ifndef DFSTUBS_H   /* avoid re-inclusion */
+#define DFSTUBS_H
+/* This is the master HDF driver (taking the place of df.c), so... */
+#define DFMASTER
+#undef PERM_OUT     /* used to "comment out" code */
+
+#include "df.h"
+#undef DFMASTER
+
+#if !defined(__GNUC__) & !defined(CONVEX)
+#include <memory.h>
+#endif /* !__GNUC__ & !CONVEX */
+
+#define DFACC_APPEND    8
+#define DFEL_ABSENT 0
+#define DFEL_RESIDENT   1
+#define DFSRCH_OLD  0
+#define DFSRCH_NEW  1
+
+PRIVATE int32 DFid = 0;
+PRIVATE int32 DFaid = 0;
+PRIVATE int DFaccmode = 0;
+PRIVATE int DFelaccmode = 0;
+PRIVATE uint16 search_tag = 0;
+PRIVATE uint16 search_ref = 0;
+PRIVATE int search_stat = DFSRCH_NEW;
+PRIVATE int32 search_aid = 0;
+PRIVATE int DFelstat = DFEL_ABSENT;
+PRIVATE int32 DFelsize = 0;
+PRIVATE int32 DFelseekpos = 0;
+PRIVATE uint16 acc_tag = 0;
+PRIVATE uint16 acc_ref = 0;
+PRIVATE char *DFelement = NULL;
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/* prototypes for internal routines */
+    PRIVATE int DFIclearacc
+                (void);
+
+    PRIVATE int DFIcheck
+                (DF * dfile);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* DFSTUBS_H */
diff --git a/hdf/src/dfufp2i.c b/hdf/src/dfufp2i.c
new file mode 100644
index 0000000..d09d068
--- /dev/null
+++ b/hdf/src/dfufp2i.c
@@ -0,0 +1,702 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfufp2i.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------c
+ *    dfufp2i.c
+ *
+ * Purpose:  Utility function to convert floating point data to 8-bit
+ *           raster image set (RIS8) format, storing the results in
+ *           an hdf file.
+ *                                   -----------
+ *                                  |           | ----------> RIS8
+ *       floating point data   ---> | fp_to_hdf |   and/or
+ *         (in an array)            |           | ----------> SDS
+ *                                   -----------
+ *
+ * Invokes:  libdf.a
+ *
+ * Includes: stdio.h, ctype.h, "df.h"
+ *
+ * Public function:
+ *      DFUfptoimage: sets up structs with input params, calls process()
+ *
+ * Private functions:
+ *      process: main driver routine: transforms the data to an image and
+ *               stores it in the file
+ *      generate_scale: generates a scale, if none provided
+ *      convert_interp: creates an interpolated image
+ *      pixrep_scaled: creates an expanded image using scales provided
+ *      compute_offsets: called by pixrep_scaled
+ *      pixrep_simple: creates an expanded image assuming equal gaps in scales
+ *
+ * Fortran stub function:
+ *      duif2i - intermediate, called by fortran functions in DFUfptoimage.f
+ *
+ * Remarks:
+ *      This routine is very similar to the utility fp_to_hdf, which
+ *      takes its input from one or more files, rather than from internal
+ *      memory.
+ *      Another difference is that this routine allows compression (run
+ *      length encoding), whereas fp_to_hdf does not at present (8/31/89).
+ *      Since this routine is meant to mimic many of the features of
+ *      NCSA DataScope, much of the code has been taken directly from
+ *      the DataScope source.
+ *
+ *  National Center for Supercomputing Applications
+ *  University of Illinois, Urbana-Champaign
+ *
+ *  by Mike Folk (mfolk at ncsa.uiuc.edu)
+ *  Beta version: 9/1/89
+ *  Released:     6/5/90
+ *
+ *  This program is in the public domain
+ *
+ *--------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "dfufp2i.h"
+#include "dfsd.h"
+
+/**********************************************************************
+*
+*  Header information
+*
+***********************************************************************/
+
+/*
+   *  global definitions
+ */
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE    1
+#endif /* TRUE */
+#define EXPAND  1   /* -e: expand image with pixel replication */
+#define INTERP  2   /* -i: expand image with bilinear interpolation */
+
+/*-----------------------------------------------------------------------------s
+ * DFUfptoimage()
+ *
+ * Purpose:sets up structs with input params, calls process()
+ * Inputs:
+ *     hdim, vdim: horizontal and vertical dimensions of input data
+ *     max, min:   maximum and minimum values in the data
+ *     hscale,vscale: optional horizontal and vertical scales
+ *     data:       input data
+ *     palette:    optional palette to be stored with the image
+ *     outfile:n   name of hdf file to store image in
+ *     ct_method:  color transform method: 1=EXPAND; 2=INTERP
+ *     hres, vres: resolutions desired for output image
+ *     compress:   compression flag: 0=don't; 1=do
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:       HDF HLL (high-level library) users, utilities, other routines
+ * Invokes: process
+ * Remarks: none
+ *----------------------------------------------------------------------------*/
+
+int
+DFUfptoimage(int32 hdim, int32 vdim, float32 max, float32 min,
+             float32 *hscale, float32 *vscale, float32 *data, uint8 *palette,
+         char *outfile, int ct_method, int32 hres, int32 vres, int compress)
+{
+    Input       in;
+    Output      out;
+
+    in.hdim = hdim;
+    in.vdim = vdim;
+    in.max = max;
+    in.min = min;
+    in.is_hscale = (hscale == NULL) ? FALSE : TRUE;
+    in.is_vscale = (vscale == NULL) ? FALSE : TRUE;
+    in.hscale = hscale;
+    in.vscale = vscale;
+    in.data = data;
+    in.is_pal = (palette == NULL) ? FALSE : TRUE;
+    in.ct_method = ct_method;
+    HDstrcpy(out.outfile, outfile);     /* get outfile name */
+    out.palette = palette;  /* get palette address (may be NULL) */
+    out.hres = hres;
+    out.vres = vres;
+    out.compress = compress ? 11 : 0;   /* 0=>don't; 11=>RLE compression */
+
+    /* tloc1 = time((long *) 0); *//* these 4 lines for debugging */
+    process(&in, &out);
+    /* tloc2 = time((long *) 0); */
+    /* printf("Time:    %ld\n",tloc2-tloc1); */
+    return 0;
+}   /* end of DFUfptoimage */
+
+/*-----------------------------------------------------------------------------s
+ * process
+ *
+ * Purpose:   to transform the data to an image and stores it in the file
+ * Inputs:
+ *     in:   structure with information about data to be converted to image
+ *     out:  structure with information about image
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:    DFUfptoimage
+ * Invokes: from libdf.a: DFR8setpalette, Hopen, Hclose, DFR8addimage
+ *          local: generate_scale, pixrep_scaled, pixrep_simple,convert_interp
+ * Remarks: none
+ *----------------------------------------------------------------------------*/
+
+int
+process(Input * in, Output * out)
+{
+    int         ret;
+    int32       file_id;
+
+    /*    printinput(in); *//* for debugging */
+
+    if (in->is_pal)
+      {
+          ret = DFR8setpalette((uint8 *) out->palette);     /* output as HDF palette */
+          if (ret < 0)
+              return ret;
+      }
+
+    file_id = Hopen(out->outfile, DFACC_WRITE, 0);
+    Hclose(file_id);
+
+    /*
+       *  allocate buffers for output and scales
+     */
+    if (!in->is_hscale)
+        in->hscale = (float32 *) HDmalloc((uint32) (1 + in->hdim) * sizeof(float32));
+    if (!in->is_vscale)
+        in->vscale = (float32 *) HDmalloc((uint32) (1 + in->vdim) * sizeof(float32));
+    out->hres = (out->hres <= in->hdim) ? in->hdim : out->hres;
+    out->vres = (out->vres <= in->vdim) ? in->vdim : out->vres;
+    out->image = (uint8 *) HDmalloc((size_t) out->hres * (size_t)out->vres);
+
+    /*
+       *  if necessary, generate x and y scales
+     */
+    if (!in->is_hscale)
+        generate_scale(in->hdim, in->hscale);
+    if (!in->is_vscale)
+        generate_scale(in->vdim, in->vscale);
+    /*
+       *  output raster hdf file
+     */
+    if (in->ct_method == EXPAND)
+      {
+          if (in->is_hscale || in->is_vscale)
+              pixrep_scaled(in, out);
+          else
+              pixrep_simple(in, out);
+      }
+    else
+        convert_interp(in, out);
+
+    /*    printoutput(out); *//* for debugging */
+
+    ret = DFR8addimage(out->outfile, (char *) out->image,
+                       out->hres, out->vres, (uint16) out->compress);
+    if (ret < 0)
+        return ret;
+    /*
+       *  free allocated space
+     */
+    if (!in->is_hscale)
+        HDfree((char *) in->hscale);
+    if (!in->is_vscale)
+        HDfree((char *) in->vscale);
+    HDfree((char *) out->image);
+    return 0;
+}   /* end of process */
+
+/*-----------------------------------------------------------------------------
+ * generate_scale
+ *
+ * Purpose:   to generate the scale 1 2 3 ... dim
+ * Input:
+ *     dim:   length of scale
+ * Output:
+ *     scale: array of floating point numbers from 1 to dim
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:    process
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+int
+generate_scale(int32 dim, float32 *scale)
+{
+    int32       i;
+
+    for (i = 0; i <= dim; i++)
+        *scale++ = (float32) i;
+    return 0;
+}
+
+/*-----------------------------------------------------------------------------
+ * printinput
+ *
+ * Purpose:   debugging: prints input values to stdout
+ * Input:
+ *     in:    struct with all input values
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:    process and other local routines
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+/*  This function is commented out of the code!! */
+#ifdef DEBUG_HDF
+int
+printinput(Input * in)
+{
+    int         i, j;
+
+    printf("\nmax: %8.2f   min: %8.2f\n", in->max, in->min);
+
+    printf("There %s a palette\n", in->is_pal ? "IS" : "is NOT");
+    printf("color tranform method = %s\n",
+           (in->ct_method == EXPAND) ? "expand" : "interpolate");
+    if (in->hscale != NULL)
+      {
+          printf("\nHorizontal scale:\n");
+          for (i = 0; i < (int) (in->hdim); i++)
+              printf("%8.2f", in->hscale[i]);
+      }
+    else
+        printf("\nNo horizontal scale\n");
+
+    if (in->vscale != NULL)
+      {
+          printf("\nVertical scale:\n");
+          for (i = 0; i < (int) (in->vdim); i++)
+              printf("%8.2f", in->vscale[i]);
+      }
+    else
+        printf("\nNo vertical scale.\n");
+
+    printf("\n");
+    printf("Data:");
+    for (i = 0; i < (int) (in->vdim) && i < 11; i++)
+      {
+          printf("\n");
+          for (j = 0; j < (int) (in->hdim); j++)
+              printf("%6.1f ", in->data[i * in->hdim + j]);
+      }
+    printf("\n");
+    return 0;
+}   /* end of print_input */
+#endif /* DEBUG_HDF */
+
+/*-----------------------------------------------------------------------------
+ * printoutput
+ *
+ * Purpose:   debugging: prints input values to stdout
+ * Input:
+ *     out:    struct with all output values
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:    process and other local routines
+ * Invokes: none
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+/*  This function is commented out of the code!! */
+#ifdef DEBUG_HDF
+int
+printoutput(Output * out)
+{
+    int         i, j;
+    printf("\n");
+    for (i = 0; i < (int) (out->vres) && i < 20; i++)
+      {
+          printf("\n");
+          for (j = 0; j < (int) (out->hres); j++)
+              if (j < 19)
+                  printf("%4d", (uint8) out->image[i * out->hres + j]);
+      }
+    printf("\n");
+    return 0;
+}   /* end of printoutput */
+#endif /* DEBUG_HDF */
+
+/***************************************************************************
+*
+*  Next comes the routine for performing bilinear interpolation
+*
+****************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * convert_interp
+ *
+ * Purpose:   Create an interpolated image from the data array
+ * Input:
+ *     in:    struct with all input values
+ *     out:   struct with all output values
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   process
+ * Invokes: none
+ * Remarks: Uses a bilinear interpolation method to fill in the picture.
+ *---------------------------------------------------------------------------*/
+
+int
+convert_interp(Input * in, Output * out)
+{
+    int j, theval;
+    float32    *f, *dxs, *dys, *xv, *yv, *lim, delx, dely, pt, xrange, yrange,
+                range, zy, *z1, *z2, *z3, *z4, z;
+    uint8 *p;
+    uint8      *xinc;
+    int32       i, *yoffs;
+
+    p = (uint8 *) out->image;   /* space for interpolated image */
+
+    range = in->max - in->min;
+    xrange = *(in->hscale + in->hdim - 1) - *in->hscale;
+    yrange = *(in->vscale + in->vdim - 1) - *in->vscale;
+    delx = xrange / (float32)out->hres;  /* x axis increment in image */
+    dely = yrange / (float32)out->vres;  /* y axis increment in image */
+
+    dxs = (float32 *) HDmalloc(sizeof(float32) * (size_t)out->hres);
+    /* temp space for dx's */
+    dys = (float32 *) HDmalloc(sizeof(float32) * (size_t)out->vres);
+    /* temp space for dy's */
+    xinc = (uint8 *) HDmalloc((size_t) out->hres);
+    yoffs = (int32 *) HDmalloc((size_t) (out->vres + 1) * sizeof(int32));
+    yoffs[0] = 0;
+
+    if (range < (float32)0.0)
+        range = -range;     /* max must be > min */
+
+    f = dys;    /* beginning of dys to fill in */
+    yv = in->vscale;    /* beginning and end of yvals */
+    lim = in->vscale + in->vdim - 2;
+
+    if (yrange > (float32)0.0)
+      {
+          for (i = 0; i < out->vres; i++)
+            {   /* fill in dy's */
+                pt = dely * (float32) i + *in->vscale;  /* scaled pos in new image */
+
+                while (*(yv + 1) < pt && yv < lim)
+                  {     /* move y pointer */
+                      yv++;
+                      yoffs[i]++;
+                  }
+                *f++ = (*(yv + 1) - pt) / (*(yv + 1) - *yv);    /* calc dy pcnt and put in */
+
+                yoffs[i + 1] = yoffs[i];
+            }
+      }
+    else
+      {     /* decrementing instead */
+          yrange = -yrange;
+
+          for (i = 0; i < out->vres; i++)
+            {   /* fill in dy's */
+                pt = dely * (float32) i + *in->vscale;
+
+                while (*(yv + 1) > pt && yv < lim)
+                  {     /* move y pointer */
+                      yv++;
+                      yoffs[i]++;
+                  }
+                *f++ = -(*(yv + 1) - pt) / (*(yv + 1) - *yv);   /* calc dy pcnt and put in */
+
+                yoffs[i + 1] = yoffs[i];
+            }
+      }
+
+    f = dxs;    /* beginning of dxs to fill in */
+    xv = in->hscale;    /* beginning and end of xvals */
+    lim = in->hscale + in->hdim - 2;
+
+    if (xrange > (float32)0.0)
+      {
+          for (i = 0; i < out->hres; i++)
+            {   /* fill in dx's */
+                pt = delx * (float32) i + *in->hscale;
+                xinc[i] = 0;
+
+                while (*(xv + 1) < pt && xv < lim)
+                  {     /* move xv pointer */
+                      xv++;
+                      xinc[i]++;
+                  }
+                *f++ = (*(xv + 1) - pt) / (*(xv + 1) - *xv);    /* calc dy prct and put in */
+            }
+      }
+    else
+      {     /* decrementing instead */
+          xrange = -xrange;
+
+          for (i = 0; i < out->hres; i++)
+            {   /* fill in dx's */
+                pt = delx * (float32) i + *in->hscale;
+                xinc[i] = 0;
+
+                while (*(xv + 1) > pt && xv < lim)
+                  {     /* move y pointer */
+                      xv++;
+                      xinc[i]++;
+                  }
+                *f++ = -(*(xv + 1) - pt) / (*(xv + 1) - *xv);   /* calc dy pcnt and put in */
+            }
+      }
+
+/*
+   *   Do the interpolation for each point in the target image.
+   *   We take advantage of the fact that we know the target is evenly spaced
+   *   along both axes.
+ */
+    yv = dys;
+
+    for (i = 0; i < out->vres; i++, yv++)
+      {
+
+          z1 = in->data + in->hdim * (yoffs[i]);
+          z2 = z1 + 1;
+          z3 = z1 + in->hdim;
+          z4 = z3 + 1;
+
+          xv = dxs;
+          zy = *yv;
+
+          for (j = 0; j < (int) (out->hres); j++, xv++)
+            {   /* for each target point */
+
+                z1 += (size_t)xinc[j];  /* xinc == 0 when we don't need to shift */
+                z2 += (size_t)xinc[j];
+                z3 += (size_t)xinc[j];
+                z4 += (size_t)xinc[j];
+
+                z = (*z1 - *z3 - *z2 + *z4) * (*xv) * zy +  /* weighted sum */
+                    (*z3 - *z4) * (*xv) + (*z2 - *z4) * zy + *z4;
+
+                theval = (int) ((float32)1.0 + (float32)237.9 * (z - in->min) / range);   /* scaled value  */
+                if (theval >= 240 || theval < 1)
+                    *p++ = 0;
+                else
+                    *p++ = (uint8) theval;
+            }
+      }
+    HDfree((char *) dxs);
+    HDfree((char *) dys);
+    HDfree((char *) xinc);
+    HDfree((char *) yoffs);
+    return 0;
+}   /* end of convert_interp */
+
+/****************************************************************************
+*
+*  Next come the routines for pixel replication
+*
+*
+*  Two routines to create expanded image via pixel replication
+*
+*  pixrep_scaled replicates pixels according to given scales
+*  pixrep_simple replicates the same number of pixels for each point
+*
+******************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * pixrep_scaled
+ *
+ * Purpose:   Create an expanded image from the data array
+ * Input:
+ *     in:    struct with all input values
+ *     out:   struct with all output values
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   process
+ * Invokes: compute_offsets
+ * Remarks: Uses pixel replication to fill in the picture. Replicates
+ *          pixels according to in->vscale and in->hscale
+ *---------------------------------------------------------------------------*/
+
+int
+pixrep_scaled(Input * in, Output * out)
+{
+    int32 j;
+    float      *data, range, ratio;
+    uint8 *image, *prevrow;
+    uint8      *pixvals;
+    int32       i, theval, *hoffsets, *voffsets, prevoffset;
+
+    data = in->data;    /* space for data */
+    image = (uint8 *) out->image;   /* space for image */
+
+    range = in->max - in->min;
+    if (range < (float32)0.0)
+        range = -range;     /* max must be > min */
+
+    hoffsets = (int32 *) HDmalloc((uint32) (out->hres + 1) * sizeof(int32));
+    voffsets = (int32 *) HDmalloc((uint32) (out->vres + 1) * sizeof(int32));
+    pixvals = (uint8 *) HDmalloc((uint32) in->hdim + 1);
+    compute_offsets(in->hscale, in->hdim, hoffsets, out->hres);
+    compute_offsets(in->vscale, in->vdim, voffsets, out->vres);
+
+    prevoffset = voffsets[0] - 1;
+    ratio = (float32) 237.9 / range;
+
+    for (i = 0; i < out->vres; i++)
+      {     /* for each row, store pixel vals */
+
+          if (voffsets[i] > prevoffset)
+            {   /* if new data row, compute pix vals */
+
+                for (j = 0; j < in->hdim; j++)
+                  {     /* compute vals for each data point */
+                      theval = (int) ((float32)1.5 + ratio * (*data++ - in->min));
+                      if (theval >= 240 || theval < 1)
+                          theval = 0;
+                      pixvals[j] = (uint8) theval;
+                  }
+
+                for (j = 0; j < out->hres; j++)     /* put row of pix vals into */
+                    *image++ = pixvals[hoffsets[j]];    /* next row of image */
+            }
+
+          else
+            {   /* else repeating a previous row */
+                prevrow = image - out->hres;
+                for (j = 0; j < out->hres; j++)     /* put previous  row of pix vals */
+                    *image++ = *prevrow++;  /* into next row of image */
+            }
+          prevoffset = voffsets[i];
+      }
+    HDfree((char *) hoffsets);
+    HDfree((char *) voffsets);
+    HDfree((char *) pixvals);
+    return 0;
+}   /* end of pixrep_scaled */
+
+/*-----------------------------------------------------------------------------
+ * compute_offsets
+ *
+ * Purpose:  For each pixel position on the horizontal or vertical
+ *           dimension, compute the offet of the corresponding value
+ *           in the scale array.
+ * Input:
+ *     scale: the scale
+ *     dim:   length of scale
+ *     res:   resolution: length of the array 'offsets'
+ * Output:
+ *     offsets: the set of offsets that were computed
+ *     out:   struct with all output values
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   pixrep_scaled
+ * Invokes: compute_offsets
+ * Remarks: The array 'offsets' can be used to determine which scaled
+ *          pixel value to place in the final picture.
+ *---------------------------------------------------------------------------*/
+
+int
+compute_offsets(float32 *scale, int32 dim, int32 *offsets, int32 res)
+{
+    int32       i, j;
+    float32    *midpt, pt, delta;
+
+    midpt = (float32 *) HDmalloc(sizeof(float32) * (size_t)dim);
+
+    for (i = 0; i < dim - 1; i++)
+      {     /* compute all midpoints */
+          midpt[i] = (scale[i] + scale[i + 1]) / (float32) 2.0;
+/*        printf("midpt[%d]=%8.1f\tscale[%d]=%8.1f\n",i,midpt[i],i,scale[i]); */
+      }
+    midpt[i] = scale[i] + scale[i] - midpt[i - 1];  /* tack one onto end */
+
+    delta = (*(scale + dim - 1) - *scale) / (float32)(res - 1);  /* amt of change along scale */
+    /* per pixel position */
+    offsets[0] = 0;
+    pt = *scale;    /* base point has value of 1st scale item */
+
+    for (i = 1, j = 0; i < res; i++)
+      {     /* compute & store offsets of pix vals */
+          pt += delta;
+          offsets[i] = offsets[i - 1];  /* keep offsets same until past midpt */
+          while (pt >= midpt[j])
+            {
+                offsets[i]++;
+                j++;
+            }
+      }
+    HDfree((char *) midpt);
+    return 0;
+}   /* end of compute_offsets */
+
+/*-----------------------------------------------------------------------------
+ * pixrep_simple
+ *
+ * Purpose:   Create an expanded image from the data array
+ * Input:
+ *     in:    struct with all input values
+ *     out:   struct with all output values
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   process
+ * Invokes: compute_offsets
+ * Remarks: Uses pixel replication to fill in the picture. Replicates
+ *          the same number of pixels for each point
+ *---------------------------------------------------------------------------*/
+
+int
+pixrep_simple(Input * in, Output * out)
+{
+    int32       i, j;
+    uint8       raster_val;
+    uint8 *image, *row_buf;
+    float32    *in_row_ptr, *in_buf;
+    float32     ratio, delh, delv, hblockend, vblockend;
+
+    ratio = (float32) 237.9 / (in->max - in->min);
+    image = (uint8 *) out->image;
+    in_buf = in->data;
+
+    delh = ((float32) out->hres) / (float32)in->hdim;    /* horiz block size */
+    delv = ((float32) out->vres) / (float32)in->vdim;    /* vert block size  */
+
+/*
+   * Compute expanded image
+   * Do it a vertical block at a time
+   * (Note the trick with the counters i and j vis-a-vis the blockends.)
+ */
+    vblockend = delv;
+    for (i = 0; i < out->vres; i++, vblockend += delv)
+      {
+          in_row_ptr = in_buf;
+          row_buf = image;  /* start of next NEW row of output */
+
+          /* compute raster values for this row */
+          hblockend = delh;
+          for (j = 0; j < out->hres; j++, hblockend += delh)
+            {
+
+                raster_val = (uint8)
+                    ((float32)1.5 + ratio * (float32) (*in_row_ptr++ - in->min));
+                *image++ = raster_val;
+
+                for (; j < (int32) hblockend - 1; j++)  /* store vals for this blk of this row */
+                    *image++ = raster_val;
+            }
+
+          /* repeat same row for whole vertical block */
+          for (; i < (int32) vblockend - 1; i++)
+              for (j = 0; j < out->hres; j++)
+                  *image++ = row_buf[j];
+
+          in_buf += in->hdim;   /* move to next row in input array */
+      }
+    return 0;
+}   /* end of pixrep_simple() */
diff --git a/hdf/src/dfufp2i.h b/hdf/src/dfufp2i.h
new file mode 100644
index 0000000..676c653
--- /dev/null
+++ b/hdf/src/dfufp2i.h
@@ -0,0 +1,87 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dfufp2i.h 5949 2013-06-10 16:16:09Z byrn $ */
+
+#ifndef DFUFP2IM_H  /* avoid re-inclusion */
+#define DFUFP2IM_H
+
+#include "H4api_adpt.h"
+
+/* Input structure */
+typedef struct
+  {
+      int32       hdim;         /* horizontal dimension of input data */
+      int32       vdim;         /* vertical dimension of input data */
+      intn        is_pal;       /* flag to tell whether there is a palette */
+      intn        is_vscale;    /* flag telling whether vertical scale included  */
+      intn        is_hscale;    /* flag telling whether horizonatal scale included */
+      intn        ct_method;    /* color transform method: EXPAND or INTERP */
+      float32     max;          /* max value of data */
+      float32     min;          /* min value of the data */
+      float32    *hscale;       /* horizontal scale */
+      float32    *vscale;       /* vertical scale */
+      float32    *data;         /* floating point data */
+  }
+Input;
+
+/* Output structure */
+typedef struct
+  {
+      int32       hres;         /* horizontal resolution of image */
+      int32       vres;         /* vertical resolution of image */
+      intn        compress;     /* compression scheme */
+      char        outfile[32];  /* output file name */
+      uint8      *image;        /* Image */
+      uint8      *palette;      /* Palette */
+  }
+Output;
+
+/*----------------------------------------------------------------------------*/
+/*                           Function Prototypes                              */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/* prototypes for dfufp2im.c */
+
+#ifdef OLD_WAY
+    HDFLIBAPI int  duif2i_(int32 *hdim, int32 *vdim, float32 *max, float32 *min,
+                        float32 hscale[], float32 vscale[], float32 data[],
+                  _fcd palette, _fcd outfile, int *ct_method, int32 *hres,
+                        int32 *vres, int *compress, int *lenfn);
+    HDFLIBAPI int  DFUfptoimage(int32 hdim, int32 vdim, float32 max, float32 min,
+                             float32 *hscale, float32 *vscale, float32 *data,
+                             uint8 *palette, char *outfile, int ct_method,
+                             int32 hres, int32 vres, int compress);
+#endif
+    HDFLIBAPI int  process
+                (Input * in, Output * out);
+    HDFLIBAPI int  generate_scale
+                (int32 dim, float32 *scale);
+    HDFLIBAPI int  convert_interp
+                (Input * in, Output * out);
+    HDFLIBAPI int  pixrep_scaled
+                (Input * in, Output * out);
+    HDFLIBAPI int  compute_offsets
+                (float32 *scale, int32 dim, int32 *offsets, int32 res);
+    HDFLIBAPI int  pixrep_simple
+                (Input * in, Output * out);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* DFUFP2IM_H */
diff --git a/hdf/src/dfufp2if.c b/hdf/src/dfufp2if.c
new file mode 100644
index 0000000..afc3a88
--- /dev/null
+++ b/hdf/src/dfufp2if.c
@@ -0,0 +1,43 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf.h"
+#include "dfufp2i.h"
+#include "dfsd.h"
+#include "hproto_fortran.h"
+
+/*-----------------------------------------------------------------------------
+ * Name:    duif2i
+ * Purpose: Intermediate Fortran callable version of DFUfptoimage
+ *          (See DFUfptoimage for details)
+ *
+ * Invokes: DFUfptoimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(int)
+nduif2i(int32 *hdim, int32 *vdim, float32 *max, float32 *min, float32 hscale[],
+        float32 vscale[], float32 data[], _fcd palette, _fcd outfile,
+        int *ct_method, int32 *hres, int32 *vres, int *compress, int *lenfn)
+{
+    char       *fn;
+    int         ret;
+
+    fn = HDf2cstring(outfile, *lenfn);
+    if (!fn)
+	return(FAIL);
+    ret = DFUfptoimage(*hdim, *vdim, (float32)*max, (float32)*min, hscale, vscale, data,
+                (uint8 *)_fcdtocp(palette), fn, *ct_method, *hres, *vres, *compress);
+    HDfree(fn);
+    return (ret);
+}
+
diff --git a/hdf/src/dfufp2iff.f b/hdf/src/dfufp2iff.f
new file mode 100644
index 0000000..9b096b1
--- /dev/null
+++ b/hdf/src/dfufp2iff.f
@@ -0,0 +1,95 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: dfufp2if.f 1014 1994-01-13 21:16:42Z georgev $
+C
+C------------------------------------------------------------------------------
+C File:     DFUfptoimFf.f
+C Purpose:  Fortran stub for DFUfptoimage()
+C Invokes:  DFUfptoimage.c
+C Contents: 
+C   duf2im:       call duif2i_ to invoke DFUfptoimage()
+C   dfufptoimage: call duif2i_ to invoke DFUfptoimage()
+C -----------------------------------------------------------------------------
+
+C------------------------------------------------------------------------------
+C Name:     duf2im
+C Purpose:   call duif2i_ to invoke DFUfptoimage()
+C Inputs:   
+C      hdim, vdim: horizontal and vertical dimensions of input data
+C      max, min:   maximum and minimum values in the data
+C      hscale,vscale: optional horizontal and vertical scales
+C      data:       input data
+C      palette:    optional palette to be stored with the image
+C      outfile:n   name of hdf file to store image in
+C      ctmethod:  color transform method: 1=EXPAND; 2=INTERP
+C      hres, vres: resolutions desired for output image
+C      compress:   compression flag: 0=don't; 1=do
+C  Returns: 0 on success, -1 on failure with DFerror set
+C  Users:       HDF HLL (high-level library) users, utilities, other routines
+C  Invokes: process
+C  Remarks: none
+C----------------------------------------------------------------------------
+
+
+      integer function duf2im(hdim,vdim,max,min,hscale,vscale,data,
+     *                palette,outfile,ctmethod,hres,vres,compress)
+
+      integer       hdim, vdim
+      real          max, min, hscale, vscale, data
+      character*(*) palette
+      character*(*) outfile
+      integer       ctmethod, hres, vres, compress, duif2i
+
+      duf2im = duif2i(hdim,vdim,max,min,hscale,vscale,data,palette,
+     *              outfile,ctmethod,hres,vres,compress, len(outfile))        
+      return
+      end
+
+CEND7MAX
+
+C------------------------------------------------------------------------------
+C Name:     dfufptoimage
+C Purpose:   call duif2i_ to invoke DFUfptoimage()
+C Inputs:   
+C      hdim, vdim: horizontal and vertical dimensions of input data
+C      max, min:   maximum and minimum values in the data
+C      hscale,vscale: optional horizontal and vertical scales
+C      data:       input data
+C      palette:    optional palette to be stored with the image
+C      outfile:n   name of hdf file to store image in
+C      ctmethod:  color transform method: 1=EXPAND; 2=INTERP
+C      hres, vres: resolutions desired for output image
+C      compress:   compression flag: 0=don't; 1=do
+C  Returns: 0 on success, -1 on failure with DFerror set
+C  Users:       HDF HLL (high-level library) users, utilities, other routines
+C  Invokes: process
+C  Remarks: none
+C----------------------------------------------------------------------------
+
+
+      integer function dfufptoimage(hdim,vdim,max,min,hscale,vscale,
+     *           data, palette,outfile,ctmethod,hres,vres,compress)
+
+      integer       hdim, vdim
+      real          max, min, hscale, vscale, data
+      character*(*) palette
+      character*(*) outfile
+      integer       ctmethod, hres, vres, compress, duif2i
+
+      dfufptoimage = 
+     *             duif2i(hdim,vdim,max,min,hscale,vscale,data,palette,
+     *              outfile,ctmethod,hres,vres,compress, len(outfile))        
+      return
+      end
+
diff --git a/hdf/src/dfunjpeg.c b/hdf/src/dfunjpeg.c
new file mode 100644
index 0000000..f2bfe6a
--- /dev/null
+++ b/hdf/src/dfunjpeg.c
@@ -0,0 +1,375 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfunjpeg.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfunjpeg.c
+ * Purpose: JPEG image decompression algorithm
+ * Invokes: JPEG library functions
+ * Contents:
+ *  DFCIunjpeg: decompress image using JPEG compression
+ * Remarks: DFCIunjpeg() decompresses JPEG encoded images using the JPEG
+ *      library functions.  The dfjpeg.c file and this file (dfunjpeg.c) should
+ *      remain the only HDF files that has to know about how to use the JPEG
+ *      routines.
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "jpeglib.h"
+#include "jerror.h"
+
+/* Expanded data destination object for HDF input */
+
+typedef struct {
+    struct jpeg_source_mgr pub; /* public fields */
+
+    int32 aid;              /* target AID for input */
+    int32 file_id;          /* HDF file ID */
+    uint16 tag, ref;        /* tag & ref of image to input */
+
+    /* HDF backward compatibility flags */
+    intn old_jpeg_image;    /* whether the image is an JPEG4-style HDF image */
+    intn old_header_read;   /* if the header has been read from the old image */
+
+    JOCTET *buffer;         /* buffer for JPEG library to fill */
+} hdf_source_mgr;
+
+typedef hdf_source_mgr * hdf_src_ptr;
+
+#define INPUT_BUF_SIZE     4096    /* size of JPEG input buffer */
+
+/* Prototypes */
+extern void    hdf_init_source(struct jpeg_decompress_struct *cinfo_ptr);
+extern boolean hdf_fill_input_buffer(struct jpeg_decompress_struct *cinfo_ptr);
+extern void    hdf_skip_input_data(struct jpeg_decompress_struct *cinfo_ptr,long num_bytes);
+extern void    hdf_term_source(struct jpeg_decompress_struct *cinfo_ptr);
+extern intn    jpeg_HDF_src(struct jpeg_decompress_struct *cinfo_ptr, int32 file_id, uint16 tag,
+                            uint16 ref, VOIDP image, int32 xdim, int32 ydim, int16 scheme);
+extern intn    jpeg_HDF_src_term(struct jpeg_decompress_struct *cinfo_ptr);
+
+/*-----------------------------------------------------------------------------
+ * Name:    hdf_init_source
+ * Purpose: Initialize the source mgr for the JPEG image
+ * Inputs:
+ *      cinfo_ptr - JPEG decompression structure pointer
+ * Returns: none.
+ * Users:   JPEG library
+ * Invokes: HDF low-level I/O functions
+ * Remarks: Initializes the JPEG source mgr for further output.
+ *---------------------------------------------------------------------------*/
+void
+hdf_init_source(struct jpeg_decompress_struct *cinfo_ptr)
+{
+    hdf_src_ptr src=(hdf_src_ptr)cinfo_ptr->src;
+
+    if((src->buffer=HDmalloc(sizeof(JOCTET)*INPUT_BUF_SIZE))==NULL)
+        ERREXIT1(cinfo_ptr, JERR_OUT_OF_MEMORY, (int)1);
+
+    if((src->aid=Hstartaccess(src->file_id,src->tag,src->ref,DFACC_READ))==FAIL)
+        ERREXIT(cinfo_ptr, JERR_FILE_WRITE);
+} /* end hdf_init_source() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    hdf_fill_input_buffer
+ * Purpose: Read in a chunk of compressed data to feed to the JPEG routines
+ * Inputs:
+ *      cinfo_ptr - JPEG decompression structure pointer
+ * Returns: none.
+ * Users:   JPEG library
+ * Invokes: HDF low-level I/O functions
+ * Remarks: Reads in a chunk of data from either an old-style JPEG image or
+ *              a new-style one.
+ *---------------------------------------------------------------------------*/
+boolean
+hdf_fill_input_buffer(struct jpeg_decompress_struct *cinfo_ptr)
+{
+    hdf_src_ptr src=(hdf_src_ptr)cinfo_ptr->src;
+    int32 num_read;     /* number of bytes read */
+
+    if(src->old_jpeg_image==TRUE) /* reading old-style JPEG image */
+      {
+        if(src->old_header_read==TRUE)  /* done with header just grab data now */
+          {
+            if((num_read=Hread(src->aid,INPUT_BUF_SIZE,src->buffer))==FAIL)
+                ERREXIT(cinfo_ptr, JERR_FILE_READ);
+
+            src->pub.bytes_in_buffer = (size_t)num_read;
+          } /* end if */
+        else 
+          {
+            int32 num_read2=0;     /* number of bytes read */
+                
+            if((num_read=Hread(src->aid,INPUT_BUF_SIZE,src->buffer))==FAIL)
+                ERREXIT(cinfo_ptr, JERR_FILE_READ);
+            if(num_read<INPUT_BUF_SIZE)
+              { /* finished with header, move into the data portion of the JPEG image */
+                Hendaccess(src->aid);   /* close the header AID */
+
+                src->old_header_read=TRUE; /* done with the header */
+
+                /* start reading the image data */
+                if((src->aid=Hstartaccess(src->file_id,DFTAG_CI,src->ref,DFACC_READ))==FAIL)
+                    ERREXIT(cinfo_ptr, JERR_FILE_READ);
+
+                /* finish filling the buffer */
+                if((num_read2=Hread(src->aid,(INPUT_BUF_SIZE-num_read),src->buffer+num_read))==FAIL)
+                    ERREXIT(cinfo_ptr, JERR_FILE_READ);
+
+              } /* end if */
+            src->pub.bytes_in_buffer = (size_t)(num_read+num_read2);
+          } /* end else */
+      } /* end if */
+    else
+      {
+        if((num_read=Hread(src->aid,INPUT_BUF_SIZE,src->buffer))==FAIL)
+            ERREXIT(cinfo_ptr, JERR_FILE_READ);
+
+        src->pub.bytes_in_buffer = (size_t)num_read;
+      } /* end else */
+
+    /* check if we are at the end of the input stream */
+    if(src->pub.bytes_in_buffer==0)
+      {
+          src->buffer[0] = (JOCTET) 0xFF;
+          src->buffer[1] = (JOCTET) JPEG_EOI;
+          src->pub.bytes_in_buffer = 2;
+      } /* end if */
+    src->pub.next_input_byte = src->buffer;
+    return TRUE;
+} /* end hdf_fill_input_buffer() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    hdf_skip_input_data
+ * Purpose: Skip past a chunk of compressed data
+ * Inputs:
+ *      cinfo_ptr - JPEG decompression structure pointer
+ * Returns: none.
+ * Users:   JPEG library
+ * Invokes: HDF low-level I/O functions
+ * Remarks: Skips past a chunk of data from either an old-style JPEG image or
+ *              a new-style one.
+ *---------------------------------------------------------------------------*/
+void
+hdf_skip_input_data(struct jpeg_decompress_struct *cinfo_ptr,long num_bytes)
+{
+    hdf_src_ptr src=(hdf_src_ptr)cinfo_ptr->src;
+
+    /* Just a dumb implementation for now.  Not clear that being smart 
+    * is worth any trouble anyway --- large skips are infrequent.
+    */
+    if (num_bytes > 0) {
+        while (num_bytes > (long) src->pub.bytes_in_buffer) {
+            num_bytes -= (long) src->pub.bytes_in_buffer;
+            (void) hdf_fill_input_buffer(cinfo_ptr);
+            /* note we assume that fill_input_buffer will never return FALSE,
+            * so suspension need not be handled.
+            */
+        }
+        src->pub.next_input_byte += (size_t) num_bytes;
+        src->pub.bytes_in_buffer -= (size_t) num_bytes;
+    }
+} /* end hdf_skip_input_data() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    hdf_term_source
+ * Purpose: Terminate the source mgr for the JPEG image
+ * Inputs:
+ *      cinfo_ptr - JPEG compression structure pointer
+ * Returns: none.
+ * Users:   JPEG library
+ * Invokes: HDF low-level I/O functions
+ * Remarks: Terminate the JPEG source mgr for further input.
+ *---------------------------------------------------------------------------*/
+void
+hdf_term_source(struct jpeg_decompress_struct *cinfo_ptr)
+{
+    hdf_src_ptr src=(hdf_src_ptr)cinfo_ptr->src;
+
+    /* close the HDF object */
+    Hendaccess(src->aid);
+
+    /* Free the input buffer */
+    HDfree(src->buffer);
+} /* end hdf_term_source() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    jpeg_HDF_src
+ * Purpose: Setup an HDF I/O source manager for the IJG library.
+ * Inputs:
+ *      cinfo_ptr - JPEG decompression structure pointer
+ *      file_id - HDF file ID for file we are opening
+ *      tag - HDF tag for image we are writing
+ *      ref - HDF ref for image we are writing
+ *      image - pointer to the image data to output
+ *      xdim,ydim - X & Y dimensions of image
+ *      scheme - the type of image to output
+ * Returns: 0 on success, -1 on failure
+ * Users:   DFCIunjpeg
+ * Invokes: JPEG library routines (lots of them...)
+ * Remarks: Sets up the source manager functions for the JPEG library.
+ *          These routines will be called by the JPEG routines to input
+ *---------------------------------------------------------------------------*/
+intn
+jpeg_HDF_src(struct jpeg_decompress_struct *cinfo_ptr, int32 file_id, uint16 tag,
+    uint16 ref, VOIDP image, int32 xdim, int32 ydim, int16 scheme)
+{
+    CONSTR(FUNC, "jpeg_HDF_src");     /* for HERROR */
+    hdf_src_ptr src;
+
+    /* shut compiler up */
+    image=image; xdim=xdim; ydim=ydim; scheme=scheme;
+
+    if((src=HDmalloc(sizeof(hdf_source_mgr)))==NULL)
+        HRETURN_ERROR(DFE_NOSPACE,FAIL);
+
+    cinfo_ptr->src=(struct jpeg_source_mgr *)src;
+    src->pub.init_source = hdf_init_source;
+    src->pub.fill_input_buffer = hdf_fill_input_buffer;
+    src->pub.skip_input_data = hdf_skip_input_data;
+    src->pub.resync_to_restart = jpeg_resync_to_restart; /* use JPEG default */
+    src->pub.term_source = hdf_term_source ;
+
+    /* Now the HDF specific parameters */
+    src->aid = 0;  /* start with no AID */
+    src->file_id = file_id;
+    src->tag = tag;
+    src->ref = ref;
+
+    /* check for old-style HDF JPEG image */
+#ifdef OLD_WAY
+    if(tag==DFTAG_JPEG || tag==DFTAG_GREYJPEG)
+      {
+        src->old_jpeg_image=TRUE;   /* indicate an old-style image */
+        src->old_header_read=FALSE; /* start with the header */
+      } /* end if */
+    else
+        src->old_jpeg_image=FALSE;   /* indicate an new-style image */
+#else /* OLD_WAY */
+    if(scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+      {
+        src->tag = (uint16)scheme;      /* start reading from the JPEG header first */
+        src->old_jpeg_image=TRUE;   /* indicate an old-style image */
+        src->old_header_read=FALSE; /* start with the header */
+      } /* end if */
+    else
+        src->old_jpeg_image=FALSE;   /* indicate an new-style image */
+#endif /* OLD_WAY */
+
+    /* force fill_input_buffer until buffer loaded */
+    src->pub.bytes_in_buffer = 0;
+    src->pub.next_input_byte = NULL;
+
+    return(SUCCEED);
+} /* end jpeg_HDF_src() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    jpeg_HDF_src_term
+ * Purpose: Terminate an HDF I/O source manager for the IJG library.
+ * Inputs:
+ *      cinfo_ptr - JPEG decompression structure pointer
+ * Returns: 0 on success, -1 on failure
+ * Users:   DFCIunjpeg
+ * Invokes: JPEG library routines (lots of them...)
+ * Remarks: Terminates the source manager functions for the JPEG library.
+ *---------------------------------------------------------------------------*/
+intn
+jpeg_HDF_src_term(struct jpeg_decompress_struct *cinfo_ptr)
+{
+    /* all we need to do for now is to free up the dest. mgr structure */
+    HDfree(cinfo_ptr->src);
+
+    return(SUCCEED);
+} /* end jpeg_HDF_src_term() */
+
+/**********************************************************************/
+/* HDF callable routine for reading in an image with JPEG compression */
+/**********************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFCIunjpeg
+ * Purpose: decompress an image using the JPEG compression algorithm
+ * Inputs:
+ * Returns: 0 on success, -1 on failure
+ * Users:   HDF programmers, DFputcomp, other routines
+ * Invokes: JPEG library routines (lots of them...)
+ * Remarks: Uses the JPEG library routines.
+ *---------------------------------------------------------------------------*/
+
+intn
+DFCIunjpeg(int32 file_id, uint16 tag, uint16 ref, VOIDP image, int32 xdim,
+           int32 ydim, int16 scheme)
+{
+    CONSTR(FUNC, "DFCIunjpeg");     /* for HERROR */
+    /* These three structs contain JPEG parameters and working data.
+     * They must survive for the duration of parameter setup and one
+     * call to jpeg_decompress; typically, making them local data in the
+     * calling routine is the best strategy.
+     */
+    struct jpeg_decompress_struct *cinfo_ptr;
+    struct jpeg_error_mgr *jerr_ptr;
+    JDIMENSION lines_read, lines_left;
+    JSAMPARRAY buffer;
+
+    if((cinfo_ptr=HDcalloc(1,sizeof(struct jpeg_decompress_struct)))==NULL)
+        HRETURN_ERROR(DFE_NOSPACE,FAIL);
+
+    if((jerr_ptr=HDmalloc(sizeof(struct jpeg_error_mgr)))==NULL)
+        HRETURN_ERROR(DFE_NOSPACE,FAIL);
+
+    /* Initialize the error-handling routines */
+    cinfo_ptr->err=jpeg_std_error(jerr_ptr);
+
+    /* Initialize the JPEG compression stuff */
+    jpeg_create_decompress(cinfo_ptr);
+
+    /* Set-up HDF destination manager */
+    jpeg_HDF_src(cinfo_ptr,file_id,tag,ref,image,xdim,ydim,scheme);
+
+    /* Read the JPEG header from the datastream */
+    jpeg_read_header(cinfo_ptr,TRUE);
+
+    /* OK, get things started */
+    jpeg_start_decompress(cinfo_ptr);
+
+    /* read the whole image in */
+    lines_left=(JDIMENSION)ydim;
+    while(cinfo_ptr->output_scanline < cinfo_ptr->output_height)
+      {
+        buffer=(JSAMPARRAY)ℑ
+        lines_read=jpeg_read_scanlines(cinfo_ptr,buffer,1);
+        lines_left-=lines_read;
+        image=(char *)image
+            +((size_t)cinfo_ptr->output_width*(size_t)cinfo_ptr->output_components*lines_read);
+      } /* end while */
+
+    /* Finish reading stuff in */
+    jpeg_finish_decompress(cinfo_ptr);
+
+    /* Get rid of the JPEG information */
+    jpeg_destroy_decompress(cinfo_ptr);
+
+    /* Wrap up any HDF specific code */
+    jpeg_HDF_src_term(cinfo_ptr);
+
+    /* Free update memory allocated */
+    HDfree(jerr_ptr);
+    HDfree(cinfo_ptr);
+
+    return (SUCCEED);   /* we must be ok... */
+}   /* end DFCIunjpeg() */
+
diff --git a/hdf/src/dfutil.c b/hdf/src/dfutil.c
new file mode 100644
index 0000000..a1540a4
--- /dev/null
+++ b/hdf/src/dfutil.c
@@ -0,0 +1,83 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfutil.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:  dfutil.c
+ *
+ * Purpose:
+ *    General purpose utility routines, and callable versions of hdf utilities
+ *
+ * Invokes:
+ *    latest libdf.a
+ *
+ * Public functions:
+ *    DFUfindnextref - For this tag, find the ref after given ref
+ *
+ * Lower level functions:
+ *
+ * Private functions:
+ *
+ * Remarks:
+ *    This version assumes that all the values are floating point.
+ *--------------------------------------------------------------------------*/
+
+#include "hdf.h"
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFfindnextref
+ * Purpose: For this tag, find the ref after lref
+ * Inputs:
+ *          file_id: handle to open HDF file
+ *          tag: tag to look for
+ *          lref: ref after which to search
+ * Returns: The desired ref if success, and FAIL on failure
+ * Users:   HDF users, utilities, other routines
+ * Invokes: HDvalidfid,
+ * Remarks:
+ *---------------------------------------------------------------------------*/
+
+uint16
+DFfindnextref(int32 file_id, uint16 tag, uint16 lref)
+{
+    CONSTR(FUNC, "DFfindnextref");
+    uint16      newtag=DFTAG_NULL, newref=DFTAG_NULL;
+    int32       aid;
+
+    HEclear();
+
+    if (!HDvalidfid(file_id))
+      {
+          HERROR(DFE_ARGS);
+          return (uint16) FAIL;
+      }
+
+    aid = Hstartread(file_id, tag, lref);
+    if (aid == FAIL)
+        return (uint16) FAIL;
+
+    if (lref != DFREF_WILDCARD)
+        if (Hnextread(aid, tag, DFREF_WILDCARD, DF_CURRENT) == FAIL)
+            return (uint16) FAIL;
+
+    if (HQuerytagref(aid, &newtag, &newref) == FAIL)
+        return (uint16) FAIL;
+
+    Hendaccess(aid);
+    return (newref);
+}
diff --git a/hdf/src/dfutilf.c b/hdf/src/dfutilf.c
new file mode 100644
index 0000000..ed136a7
--- /dev/null
+++ b/hdf/src/dfutilf.c
@@ -0,0 +1,68 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dfutilf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dfutilf.c
+ * Purpose: C stubs for Fortran utility routines
+ * Invokes: dfutil.c
+ * Contents:
+ *  dfindnr_:       For a given tag, find the next ref after the given ref
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "hproto_fortran.h"
+/*-----------------------------------------------------------------------------
+ * Name:    dfindnr
+ * Purpose: For this tag, find the ref after lref
+ * Inputs:  dfile: ptr to open DF file
+ *          tag:   tag to look for
+ *          lref:  ref after which to search
+ *
+ * Returns: the desired ref if successful, on failure with  DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFfindnextref
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfindnr(intf * dfile, intf * tag, intf * lref)
+{
+    return ((intf)DFfindnextref(*dfile, (uint16) *tag, (uint16) *lref));
+}
+
+/*
+   CEND7MAX
+ */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dffindnextref
+ * Purpose: For this tag, find the ref after lref
+ * Inputs:  dfile: ptr to open DF file
+ *          tag:   tag to look for
+ *          lref:  ref after which to search
+ *
+ * Returns: the desired ref if successful, on failure with  DFerror set
+ * Users:   HDF Fortran programmers
+ * Invokes: DFfindnextref
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndffindnextref(intf * dfile, intf * tag, intf * lref)
+{
+    return ((intf)DFfindnextref(*dfile, (uint16) *tag, (uint16) *lref));
+}
diff --git a/hdf/src/dynarray.c b/hdf/src/dynarray.c
new file mode 100644
index 0000000..e8e02c2
--- /dev/null
+++ b/hdf/src/dynarray.c
@@ -0,0 +1,353 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: dynarray.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+FILE
+    dynarray.c - Internal storage routines for handling "dynamic arrays"
+
+REMARKS
+    Dynamic arrays are "standard" arrays which store objects in a straight-
+    forward linear array of objects (void *'s currently), but the "dynarray"
+    allows the size of the array to vary without excessive overhead.
+
+DESIGN
+    Each dynarray is managed as a small structure to store the current size
+    of the dynarray and a pointer to the array of pointers to the objects
+    stored within the array.
+
+BUGS/LIMITATIONS
+    No hashing or any other "folding" of the storage space is done, so the size
+    of the dynarray can get quite excessive in proportion to the # of elements
+    used if the elements used are "sparse" in the dynarray space.
+
+    These are strictly useable from C, adding a FORTRAN calling facility would
+    require some re-working of the routines.
+
+LOCAL ROUTINES
+  None
+EXPORTED ROUTINES
+ Element Functions:
+     DAget_elem - Get an element from a dynarray
+     DAset_elem - Set an element pointer for a dynarray
+     DAdel_elem - Delete an element from a dynarray
+ Dynarray Functions:
+     DAcreate_array - Create a dynarray
+     DAdestroy_array - Destroy a dynarray
+     DAsize_array    - Get the current dynarray size
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   1/7/96  - Starting writing specs & coding prototype
+*/
+
+#define DYNARRAY_MASTER
+#include "hdf.h"
+#include "dynarray.h"
+
+
+/* Private function prototypes */
+/* <none yet> */
+
+/******************************************************************************
+ NAME
+     DAcreate_array - Create a dynarray
+
+ DESCRIPTION
+    Create a dynarray for later use.  This routine allocates the dynarray
+    structure and creates a dynarray with the specified minimum size.
+
+ RETURNS
+    Returns pointer to the dynarray created if successful and NULL otherwise
+
+*******************************************************************************/
+dynarr_p DAcreate_array(intn start_size,      /* IN: Initial array size */
+    intn incr_mult                  /* IN: multiple to create additional elements in */
+)
+{
+    CONSTR(FUNC, "DAcreate_array");	/* for HERROR */
+    dynarr_t   *new_arr=NULL;       /* ptr to the new dynarray */
+    dynarr_p    ret_value=NULL;
+
+    HEclear();
+    if(start_size<0 || incr_mult<=0)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    new_arr=(dynarr_t *)HDcalloc(1,sizeof(dynarr_t));
+    if(new_arr==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    new_arr->num_elems=start_size;
+    new_arr->incr_mult=incr_mult;
+    if(start_size>0)
+      { /* only allocate space if the initial size is positive */
+        new_arr->arr=(VOIDP *)HDcalloc(start_size,sizeof(VOIDP));
+        if(new_arr->arr==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end if */
+
+    ret_value=(dynarr_p)new_arr;
+
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+        if(new_arr!=NULL)
+          {
+            if(new_arr->arr!=NULL)
+                HDfree(new_arr->arr);
+            HDfree(new_arr);
+          } /* end if */
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DAcreate_array() */
+
+/******************************************************************************
+ NAME
+     DAdestroy_array - Destroy a dynarray
+
+ DESCRIPTION
+    Destroy an existing dynarray from use.  This routine de-allocates the
+    dynarray structure and deletes the current dynarray.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn DAdestroy_array(dynarr_p arr,  /* IN: Array to destroy */
+        intn free_elem              /* IN: whether to free each element */
+)
+{
+    CONSTR(FUNC, "DAdestroy_array");	/* for HERROR */
+    dynarr_t   *dest_arr;               /* ptr to the dynarray destroy*/
+    intn i;
+    intn    ret_value=SUCCEED;
+
+    HEclear();
+    dest_arr=(dynarr_t *)arr;
+    if(dest_arr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Chuck all the items stored in the array */
+    if(free_elem!=0)
+        for(i=0; i<arr->num_elems; i++)
+          {
+              if(arr->arr[i]!=NULL)
+                  HDfree(arr->arr[i]);
+          } /* end for */
+
+    if(dest_arr->arr!=NULL)
+        HDfree(dest_arr->arr);
+    HDfree(dest_arr);
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DAdestroy_array() */
+
+/******************************************************************************
+ NAME
+     DAdestroy_array - Get the current size of a dynarray
+
+ DESCRIPTION
+    Get the number of elements in use currently.
+
+ RETURNS
+    Returns # of dynarray elements if successful and FAIL otherwise
+
+*******************************************************************************/
+intn DAsize_array(dynarr_p arr   /* IN: Array to get size of */
+)
+{
+    CONSTR(FUNC, "DAsize_array");	/* for HERROR */
+    dynarr_t   *arr_ptr;            /* ptr to the dynarray destroy*/
+    intn    ret_value=SUCCEED;
+
+    HEclear();
+    arr_ptr=(dynarr_t *)arr;
+    if(arr_ptr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    ret_value=arr_ptr->num_elems;
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DAsize_array() */
+
+/******************************************************************************
+ NAME
+     DAget_elem - Get an element from a dynarray
+
+ DESCRIPTION
+    Retrieve an element from a dynarray.  If the element to be retrieved is
+    beyond the end of the currently allocated array elements, the array is
+    not extended, a NULL pointer is merely returned.
+
+ RETURNS
+    Returns object ptr if successful and NULL otherwise
+
+*******************************************************************************/
+VOIDP DAget_elem(dynarr_p arr_ptr, /* IN: Array to access */
+    intn elem                       /* IN: Array element to retrieve */
+)
+{
+    CONSTR(FUNC, "DAget_elem");     /* for HERROR */
+    dynarr_t   *arr;                /* ptr to the dynarray */
+    VOIDP    ret_value=NULL;
+
+    HEclear();
+    arr=(dynarr_t *)arr_ptr;
+    if(elem<0 || arr==NULL)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    if(elem>=arr->num_elems)
+        ret_value=NULL;
+    else
+        ret_value=arr->arr[elem];
+        
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DAget_elem() */
+
+/******************************************************************************
+ NAME
+     DAset_elem - Set an element pointer for a dynarray
+
+ DESCRIPTION
+    Set an element pointer for a dynarray.  If the element to be set is
+    beyond the end of the currently allocated array elements, the array is
+    extended by whatever multiple of the incr_mult is needed to expand the
+    # of array elements to include the array element to set.
+
+ RETURNS
+    Returns SUCCEED if successful and NULL otherwise
+
+*******************************************************************************/
+intn DAset_elem(dynarr_p arr_ptr,  /* IN: Array to access */
+    intn elem,                      /* IN: Array element to set */
+    VOIDP obj                       /* IN: Pointer to the object to store */
+)
+{
+    CONSTR(FUNC, "DAset_elem");     /* for HERROR */
+    dynarr_t   *arr;                /* ptr to the dynarray */
+    intn        ret_value=SUCCEED;
+
+    HEclear();
+    arr=(dynarr_t *)arr_ptr;
+    if(elem<0 || arr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if(elem>=arr->num_elems)
+      {
+        intn new_size;        /* new number of elements in the array */
+
+        new_size=((elem/arr->incr_mult)+1)*arr->incr_mult;
+        if(arr->num_elems==0)
+          { /* array not currently allocated */
+            if((arr->arr=(VOIDP *)HDcalloc(new_size,sizeof(VOIDP)))==NULL)
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          } /* end if */
+        else
+          { /* extend the existing array */
+            VOIDP *new_arr;   /* storage for the new array of ptrs */
+
+            if((new_arr=(VOIDP *)HDrealloc(arr->arr,new_size*sizeof(VOIDP)))==NULL)
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            HDmemset(&new_arr[arr->num_elems],0,sizeof(VOIDP)*(uintn)(new_size-arr->num_elems));
+            arr->arr=new_arr;
+          } /* end else */
+        arr->num_elems=new_size;
+      } /* end if */
+
+    /* Set the element value */
+    arr->arr[elem]=obj;
+        
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DAset_elem() */
+
+/*****************************************************************************
+ NAME
+     DAdel_elem - Delete an element from a dynarray
+
+ DESCRIPTION
+    Retrieve an element from a dynarray & delete it from the dynarray.  If the
+    element to be retrieved is beyond the end of the currently allocated array
+    elements, the array is not extended, a NULL pointer is merely returned.
+
+ RETURNS
+    Returns object ptr if successful and NULL otherwise
+
+*******************************************************************************/
+VOIDP DAdel_elem(dynarr_p arr_ptr, /* IN: Array to access */
+    intn elem                       /* IN: Array element to retrieve */
+)
+{
+    CONSTR(FUNC, "DAdel_elem");     /* for HERROR */
+    dynarr_t   *arr;                /* ptr to the dynarray */
+    VOIDP    ret_value=NULL;
+
+    HEclear();
+    arr=(dynarr_t *)arr_ptr;
+    if(elem<0 || arr==NULL)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    if(elem>=arr->num_elems)
+        ret_value=NULL;
+    else
+      {
+        ret_value=arr->arr[elem];
+        arr->arr[elem]=NULL;
+      } /* end else */
+
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end DAdel_elem() */
+
diff --git a/hdf/src/dynarray.h b/hdf/src/dynarray.h
new file mode 100644
index 0000000..a1f2311
--- /dev/null
+++ b/hdf/src/dynarray.h
@@ -0,0 +1,157 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: dynarray.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    dynarray.h
+ * Purpose: header file for dynamic array API
+ * Dependencies: 
+ * Invokes:
+ * Contents:
+ * Structure definitions: 
+ * Constant definitions: 
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __DYNARRAY_H
+#define __DYNARRAY_H
+
+#include "hdf.h"
+
+/*
+    Define the pointer to the dynarray without giving outside routines access
+    to the internal workings of the structure.
+*/
+typedef struct dynarray_tag *dynarr_p;
+
+#if defined DYNARRAY_MASTER | defined DYNARRAY_TESTER
+typedef struct dynarray_tag 
+  {
+      intn num_elems;       /* Number of elements in the array currently */
+      intn incr_mult;       /* Multiple to increment the array size by */
+      VOIDP *arr;           /* Pointer to the actual array of void *'s */
+  }dynarr_t;
+
+#endif /* DYNARRAY_MASTER | DYNARRAY_TESTER */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/******************************************************************************
+ NAME
+     DAcreate_array - Create a dynarray
+
+ DESCRIPTION
+    Create a dynarray for later use.  This routine allocates the dynarray
+    structure and creates a dynarray with the specified minimum size.
+
+ RETURNS
+    Returns pointer to the dynarray created if successful and NULL otherwise
+
+*******************************************************************************/
+dynarr_p DAcreate_array(intn start_size,      /* IN: Initial array size */
+    intn incr_mult                  /* IN: multiple to create additional elements in */
+);
+
+/******************************************************************************
+ NAME
+     DAdestroy_array - Destroy a dynarray
+
+ DESCRIPTION
+    Destroy an existing dynarray from use.  This routine de-allocates the
+    dynarray structure and deletes the current dynarray.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn DAdestroy_array(dynarr_p arr,  /* IN: Array to destroy */
+        intn free_elem              /* IN: whether to free each element */
+);
+
+/******************************************************************************
+ NAME
+     DAdestroy_array - Get the current size of a dynarray
+
+ DESCRIPTION
+    Get the number of elements in use currently.
+
+ RETURNS
+    Returns # of dynarray elements if successful and FAIL otherwise
+
+*******************************************************************************/
+intn DAsize_array(dynarr_p arr   /* IN: Array to get size of */
+);
+
+/******************************************************************************
+ NAME
+     DAget_elem - Get an element from a dynarray
+
+ DESCRIPTION
+    Retrieve an element from a dynarray.  If the element to be retrieved is
+    beyond the end of the currently allocated array elements, the array is
+    not extended, a NULL pointer is merely returned.
+
+ RETURNS
+    Returns object ptr if successful and NULL otherwise
+
+*******************************************************************************/
+VOIDP DAget_elem(dynarr_p arr_ptr, /* IN: Array to access */
+    intn elem                       /* IN: Array element to retrieve */
+);
+
+/******************************************************************************
+ NAME
+     DAset_elem - Set an element pointer for a dynarray
+
+ DESCRIPTION
+    Set an element pointer for a dynarray.  If the element to be set is
+    beyond the end of the currently allocated array elements, the array is
+    extended by whatever multiple of the incr_mult is needed to expand the
+    # of array elements to include the array element to set.
+
+ RETURNS
+    Returns SUCCEED if successful and NULL otherwise
+
+*******************************************************************************/
+intn DAset_elem(dynarr_p arr_ptr,  /* IN: Array to access */
+    intn elem,                      /* IN: Array element to set */
+    VOIDP obj                       /* IN: Pointer to the object to store */
+);
+
+/*****************************************************************************
+ NAME
+     DAdel_elem - Delete an element from a dynarray
+
+ DESCRIPTION
+    Retrieve an element from a dynarray & delete it from the dynarray.  If the
+    element to be retrieved is beyond the end of the currently allocated array
+    elements, the array is not extended, a NULL pointer is merely returned.
+
+ RETURNS
+    Returns object ptr if successful and NULL otherwise
+
+*******************************************************************************/
+VOIDP DAdel_elem(dynarr_p arr_ptr, /* IN: Array to access */
+    intn elem                       /* IN: Array element to retrieve */
+);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif /* __DYNARRAY_H */
+
diff --git a/hdf/src/glist.c b/hdf/src/glist.c
new file mode 100644
index 0000000..520531a
--- /dev/null
+++ b/hdf/src/glist.c
@@ -0,0 +1,1195 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/************************************************************************
+  Credits:
+          Original code is part of the public domain 'Generic List Library'
+          by Keith Pomakis(kppomaki at jeeves.uwaterloo.ca)-Spring, 1994
+          I modified it to adhere to HDF coding standards.
+
+  1996/06/04 - George V. 
+ ************************************************************************/
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Id: glist.c 6043 2014-01-21 21:09:03Z acheng $";
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "glist.h"
+
+/*+
+****************************************************************************
+GENERAL
+****************************************************************************
+
+A set of basic generic doubly-linked list functions were designed and
+programmed first (along with a suitable efficient data structure), and then
+some higher-level functions were added to increase ease of use.  The
+functionality of stacks, queues and sorted lists were then added.  In
+actuality, these functions (with the exception of one of the sorted-list
+functions) are nothing more than aliases for the appropriate generic list
+operations.  This aliasing is behind the scenes, however, and the user of
+this library may treat the operation of lists, stacks and queues in this
+library as completely separate functionality.
+
+In order to make the library completely generic, it was designed to
+manipulate pointers of type void *.  Therefore, it is assumed that the
+programmer is statically or dynamically creating the objects of interest,
+and using the generic list functions to manipulate them.  It is up to the
+programmer to handle the allocation and deallocation of the memory for the
+objects themselves.
+
+A pointer to the same object may be stored in a list multiple times.  The
+only restriction imposed is that a NULL pointer may not be stored.
+
+
+****************************************************************************
+USAGE
+****************************************************************************
+
+The use of this library is simple and straight-forward.  In every source
+file that requires the use of generic list functions, the line:
+
+#include "glist.h"
+
+must be included at the top of the file.  For those who hand-craft their own
+makefiles, "generic_list.h" should become a prerequisite for each of these
+files, as well as for "generic_list.c" itself.
+
+The library defines three data types:
+
+    Generic_list
+    Generic_stack
+    Generic_queue
+
+The usage of these functions is best illustrated with an example:
+Error checking of the return values from the functions are not shown.
+
+foo() {
+    Generic_stack stack;
+    My_object *obj;
+
+    HDGSinitialize_stack(&stack);
+
+    obj = new_object();
+    HDGSpush(stack, obj);
+    ...
+    obj = HDGSpop(stack);
+    free(obj);
+    ...
+    HDGSdestroy_stack(&stack);
+}
+
+Each list must be initialized before use and should be destroyed after it is
+no longer needed.  The programmer must handle the allocation and
+deallocation of the memory for the objects being stored.  Explicit memory
+management for the lists is not necessary.
+
+****************************************************************************
+LIST OF FUNCTIONS
+****************************************************************************
+
+The following are the headers of the functions provided in the generic list
+library.  They are described in more detail later.
+
+Generic Lists
+-------------
+
+intn HDGLinitialize_list(Generic_list *list);
+void HDGLdestroy_list(Generic_list *list);
+intn HDGLadd_to_beginning(Generic_list list, void *pointer);
+intn HDGLadd_to_end(Generic_list list, void *pointer);
+intn HDGLadd_to_list(Generic_list list, void *pointer);
+void *HDGLremove_from_beginning(Generic_list list);
+void *HDGLremove_from_end(Generic_list list);
+void *HDGLremove_from_list(Generic_list list, void *pointer);
+void HDGLremove_all(Generic_list list);
+void *HDGLpeek_at_beginning(Generic_list list);
+void *HDGLpeek_at_end(Generic_list list);
+
+void *HDGLfirst_in_list(Generic_list list);
+void *HDGLnext_in_list(Generic_list list);
+void *HDGLcurrent_in_list(Generic_list list);
+void *HDGLremove_current(Generic_list list);
+void *HDGLprevious_in_list(Generic_list list);
+void *HDGLlast_in_list(Generic_list list);
+void HDGLreset_to_beginning(Generic_list list);
+void HDGLreset_to_end(Generic_list list);
+
+intn HDGLnum_of_objects(Generic_list list);
+intn HDGLis_empty(Generic_list list);
+intn HDGLis_in_list(Generic_list list, void *pointer);
+Generic_list HDGLcopy_list(Generic_list list);
+
+void HDGLperform_on_list
+     (Generic_list list, void (*fn)(void *pointer, void *args), void *args);
+void *HDGLfirst_that
+     (Generic_list list, intn (*fn)(void *pointer, void *args), void *args);
+void *HDGLnext_that
+     (Generic_list list, intn (*fn)(void *pointer, void *args), void *args);
+void *HDGLprevious_that
+     (Generic_list list, intn (*fn)(void *pointer, void *args), void *args);
+void *HDGLlast_that
+     (Generic_list list, intn (*fn)(void *pointer, void *args), void *args);
+Generic_list HDGLall_such_that
+     (Generic_list list, intn (*fn)(void *pointer, void *args), void *args);
+void HDGLremove_all_such_that
+     (Generic_list list, intn (*fn)(void *pointer, void *args), void *args);
+
+
+Generic Sorted Lists
+--------------------
+
+intn HDGLinitialize_sorted_list(Generic_list *list, int (*lt)(void *a, void *b));
+
+...and all Generic_list functions EXCEPT:
+
+intn HDGLadd_to_beginning(Generic_list list, void *pointer);
+intn HDGLadd_to_end(Generic_list list, void *pointer);
+void *HDGLremove_from_beginning(Generic_list list);
+void *HDGLremove_from_end(Generic_list list);
+
+
+Generic Stacks(HDGSxxx)
+----------------------
+
+intn HDGSinitialize_stack(Generic_stack *stack);
+void HDGSdestroy_stack(Generic_stack *stack);
+intn HDGSpush(Generic_stack stack, void *pointer);
+void *HDGSpop(Generic_stack stack);
+void HDGSpop_all(Generic_stack stack);
+void *HDGSpeek_at_top(Generic_stack stack);
+Generic_stack HDGScopy_stack(Generic_stack stack);
+
+* This is a list fcn *
+intn HDGLis_empty(Generic_stack stack); 
+
+Generic Queues(HDGQxxx)
+----------------------
+
+intn HDGQinitialize_queue(Generic_queue *queue);
+void HDGQdestroy_queue(Generic_queue *queue);
+intn HDGQenqueue(Generic_queue queue, void *pointer);
+void *HDGQdequeue(Generic_queue queue);
+void HDGQdequeue_all(Generic_queue queue);
+void *HDGQpeek_at_head(Generic_queue queue);
+void *HDGQpeek_at_tail(Generic_queue queue);
+Generic_queue HDGQcopy_queue(Generic_queue queue);
+
+* This is a list fcn *
+intn HDGLis_empty(Generic_queue queue);
+
+****************************************************************************
+HINTS
+****************************************************************************
+
+Technically, any of the above functions can be used with any of the three
+data types.  For example, one can use HDGLperform_on_list() to perform a
+specified function on every object in a queue, or HDGLis_in_list() to determine
+whether or not a particular object is a member of a stack.  One can even
+HDGSpop from a queue and HDGQdequeue from a stack.  However, such usage is not
+recommended, as it is contrary to the logical usage of such data
+structures.
+
+ +*/
+
+/******************************************************************************
+ NAME
+     HDGLinitialize_list
+ DESCRIPTION
+     Every list must be initialized before it is used.  The only time it is
+     valid to re-initialize a list is after it has been destroyed.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+intn
+HDGLinitialize_list(Generic_list *list)
+{
+    CONSTR(FUNC, "HDGLinitialize_list");	/* for HERROR */
+    intn  ret_value = SUCCEED;
+
+    /* Allocate an intialize info struct */
+    list->info = (Generic_list_info *)HDmalloc(sizeof(Generic_list_info));
+
+    if (list->info != NULL)
+      {
+          list->info->pre_element.pointer  = NULL;
+          list->info->pre_element.previous = &list->info->pre_element;
+          list->info->pre_element.next     = &list->info->post_element;
+          list->info->post_element.pointer = NULL;
+          list->info->post_element.previous = &list->info->pre_element;
+          list->info->post_element.next     = &list->info->post_element;
+
+          list->info->current = &list->info->pre_element;
+          list->info->deleted_element.pointer = NULL;
+          list->info->lt      = NULL;
+          list->info->num_of_elements = 0;
+      }
+    else
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+done:
+    if (ret_value == FAIL)
+      {
+      }
+
+return ret_value;
+} /* HDGLinitialize_list() */
+
+/******************************************************************************
+ NAME
+     HDGLinitialize_sorted_list
+ DESCRIPTION
+    This function initializes a sorted list.  A less-than function must be
+    specified which accepts two pointers, a and b, and returns TRUE
+    (non-zero) if a is less than b, FALSE otherwise.
+
+    Once a list is initialized in this way, all of the generic list
+    functions described above can be used, except for:
+
+        void HDGLadd_to_beginning(Generic_list list, void *pointer);
+        void HDGLadd_to_end(Generic_list list, void *pointer);
+        void *HDGLremove_from_beginning(Generic_list list);
+        void *HDGLremove_from_end(Generic_list list);
+
+    and the list will remain sorted by the criteria specified by the
+    less-than function.  The only time it is valid to re-initialize a list
+    is after it has been destroyed.
+ RETURNS
+     SUCEED/FAIL
+*******************************************************************************/
+intn
+HDGLinitialize_sorted_list(Generic_list *list, 
+                       intn (*lt)(VOIDP /* a */, VOIDP /* b */))
+{
+    intn ret_value = SUCCEED;
+
+    /* First initialize list */
+    if ((ret_value = HDGLinitialize_list(list)) == FAIL)
+        goto done;
+    else
+        list->info->lt = lt; /* Set sort fcn */
+
+done:
+    if (ret_value == FAIL)
+      {
+      }
+
+return ret_value;
+} /* HDGLinitialize_sorted_list() */
+
+/******************************************************************************
+ NAME
+     HDGLdestroy_list
+ DESCRIPTION
+    When a list is no longer needed, it should be destroyed.  This process
+    will automatically remove all remaining objects from the list.  However,
+    the memory for these objects will not be reclaimed, so if the objects
+    have no other references, care should be taken to purge the list and
+    free all objects before destroying the list.
+
+    It is an error to destroy a list more than once (unless it has been
+    re-initialized in the meantime).
+ RETURNS
+     Nothing
+*******************************************************************************/
+void
+HDGLdestroy_list(Generic_list *list)
+{
+    /* Fist remove all nodes */
+    HDGLremove_all(*list);
+
+    /* Free the info struct last */
+    HDfree((VOIDP)list->info);
+} /* HDGLdestroy_list() */
+
+/******************************************************************************
+ NAME
+    HDGLadd_to_beginning
+ DESCRIPTION
+    This function will add the specified object to the beginning of the
+    list.  The pointer must not be NULL.
+ RETURNS
+    SUCCEED/FAIL
+*******************************************************************************/
+intn
+HDGLadd_to_beginning(Generic_list list, 
+                 VOIDP pointer)
+{
+    CONSTR(FUNC, "HDGLadd_to_beginning");	/* for HERROR */
+    Generic_list_element *element;
+    intn   ret_value = SUCCEED;
+
+    /* Check data element */
+    if (pointer == NULL)
+        HGOTO_ERROR(DFE_ARGS,FAIL); 
+
+    /* Allocate and add to beginning of list */
+    element = (Generic_list_element *)HDmalloc(sizeof(Generic_list_element));
+    if (element != NULL)
+      {
+          element->next     = list.info->pre_element.next;
+          element->previous = &list.info->pre_element;
+          element->pointer  = pointer;
+
+          list.info->pre_element.next->previous = element;
+          list.info->pre_element.next = element;
+
+          list.info->num_of_elements++;
+      }
+    else
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+done:
+    if (ret_value == FAIL)
+      {
+      }
+
+return ret_value;
+} /* HDGLadd_to_beginning() */
+
+/******************************************************************************
+ NAME
+     HDGLadd_to_end
+ DESCRIPTION
+    This function will add the specified object to the end of the
+    list.  The pointer must not be NULL.
+ RETURNS
+    SUCCEED/FAIL
+*******************************************************************************/
+intn
+HDGLadd_to_end(Generic_list list, 
+           VOIDP pointer)
+{
+    CONSTR(FUNC, "HDGLadd_to_end");	/* for HERROR */
+    Generic_list_element *element;
+    intn   ret_value = SUCCEED;
+
+    /* Check data element */
+    if (pointer == NULL) 
+        HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* Allocate and add to end of list */
+    element = (Generic_list_element *)HDmalloc(sizeof(Generic_list_element));
+    if (element != NULL)
+      {
+          element->next     = &list.info->post_element;
+          element->previous = list.info->post_element.previous;
+          element->pointer  = pointer;
+
+          list.info->post_element.previous->next = element;
+          list.info->post_element.previous = element;
+
+          list.info->num_of_elements++;
+      }
+    else
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+done:
+    if (ret_value == FAIL)
+      {
+      }
+
+return ret_value;
+} /* HDGLadd_to_end() */
+
+/******************************************************************************
+ NAME
+     HDGLadd_to_list
+ DESCRIPTION
+    This function will add the specified object to the list.  The pointer
+    must not be NULL.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+intn
+HDGLadd_to_list(Generic_list list, 
+            VOIDP pointer)
+{
+    CONSTR(FUNC, "HDGLadd_to_list");	/* for HERROR */
+    Generic_list_element *element, *new_element;
+    intn ret_value = SUCCEED;
+
+    /* Check to see if there is a sort fcn */
+    if (list.info->lt) 
+      {
+          /* Check data element */
+        if (pointer == NULL) 
+            HGOTO_ERROR(DFE_ARGS,FAIL);
+
+        element = list.info->pre_element.next;
+        while (element != &list.info->post_element &&
+                (*list.info->lt)(element->pointer, pointer))
+            element = element->next;
+    
+       /* Allocate and add to list */
+        new_element = (Generic_list_element *)HDmalloc(sizeof(Generic_list_element));
+        if (new_element != NULL)
+          {
+              new_element->next     = element;
+              new_element->previous = element->previous;
+              new_element->pointer  = pointer;
+
+              element->previous->next = new_element;
+              element->previous = new_element;
+
+              list.info->num_of_elements++;
+          }
+        else
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      }
+    else /* no sort fcn so add to end of list */
+        ret_value = HDGLadd_to_end(list, pointer);
+
+done:
+    if (ret_value == FAIL)
+      {
+      }
+
+return ret_value;
+} /* HDGLadd_to_list() */
+
+/******************************************************************************
+ NAME
+     HDGLremove_from_list
+ DESCRIPTION
+    This function will remove the specified object from the list and return
+    it.  If the specified object does not exist in the list, NULL is
+    returned.  If the specified object exists in the list more than once,
+    only the last reference to it is removed.
+
+ RETURNS
+    Element removed if successful and NULL otherwise
+*******************************************************************************/
+VOIDP
+HDGLremove_from_list(Generic_list list, 
+                 VOIDP pointer)
+{
+    Generic_list_element *element;
+    VOIDP ret_value = NULL;
+
+    /* Find element in list */
+    element = list.info->post_element.previous;
+    while (element != &list.info->pre_element && element->pointer != pointer)
+        element = element->previous;
+
+    if (element == &list.info->pre_element)
+      { /* No such element was found. */
+        ret_value = NULL;
+        goto done;
+      }
+
+    /* Have found element */
+    if (element == list.info->current) 
+      {
+        list.info->deleted_element.previous = element->previous;
+        list.info->deleted_element.next     = element->next;
+        list.info->current                  = &list.info->deleted_element;
+      }
+
+    element->previous->next = element->next;
+    element->next->previous = element->previous;
+
+    HDfree(element); /* free element */
+    list.info->num_of_elements--;
+
+    ret_value = pointer; /* return ptr to original element */
+
+done:
+    if (ret_value == NULL)
+      {
+      }
+
+return ret_value;
+} /* HDGLremove_from_list() */
+
+/******************************************************************************
+ NAME
+     HDGLremove_from_beginning
+ DESCRIPTION
+    This function will remove the first object from the beginning of the
+    list and return it.  If the list is empty, NULL is returned.
+ RETURNS
+    First Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP
+HDGLremove_from_beginning(Generic_list list)
+{
+    Generic_list_element *element;
+    VOIDP pointer;
+    VOIDP ret_value = NULL;
+
+    /* Check to see if there any elements in the list */
+    if(list.info->num_of_elements == 0)
+      { /* nope */
+        ret_value = NULL;
+        goto done;
+      }
+
+    /* Remove first element */
+    element = list.info->pre_element.next;
+    if (element == list.info->current)
+        list.info->current = &list.info->pre_element;
+
+    pointer = element->pointer;
+    list.info->pre_element.next = element->next;
+    element->next->previous = &list.info->pre_element;
+
+    HDfree(element);
+    list.info->num_of_elements--;
+
+    ret_value = pointer; /* return the fist element */
+
+done:
+    if (ret_value == NULL)
+      {
+      }
+
+return ret_value;
+} /* HDGLremove_from_beginning() */
+
+/******************************************************************************
+ NAME
+     HDGLremove_from_end
+ DESCRIPTION
+    This function will remove the last object from the end of the list and
+    return it.  If the list is empty, NULL is returned.
+ RETURNS
+    Last element if successfull and NULL otherwise
+*******************************************************************************/
+VOIDP
+HDGLremove_from_end(Generic_list list)
+{
+    Generic_list_element *element;
+    VOIDP pointer;
+    VOIDP ret_value = NULL;
+
+    /* Check to see if there any elements in the list */
+    if(list.info->num_of_elements == 0)
+      { /* nope */
+        ret_value = NULL;
+        goto done;
+      }
+
+    element = list.info->post_element.previous;
+    if (element == list.info->current)
+        list.info->current = &list.info->post_element;
+
+    pointer = element->pointer;
+    list.info->post_element.previous = element->previous;
+    element->previous->next = &list.info->post_element;
+
+    HDfree(element);
+    list.info->num_of_elements--;
+
+    ret_value = pointer; /* return last element */
+
+done:
+    if (ret_value == NULL)
+      {
+      }
+
+return ret_value;
+} /* HDGLremove_from_end() */
+
+/******************************************************************************
+ NAME
+     HDGLremove_current
+ DESCRIPTION
+    This function will remove the current object from the list and return
+    it.  If the current object has already been removed, if current points
+    to the beginning or end of the list, or if the list is empty, NULL is
+    returned.
+ RETURNS
+    Current element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP
+HDGLremove_current(Generic_list list)
+{
+    Generic_list_element *element;
+    VOIDP pointer;
+    VOIDP ret_value = NULL;
+
+    element = list.info->current;
+    if (element->pointer == NULL)
+      { /* current is empty */
+        ret_value = NULL;
+        goto done;
+      }
+
+    list.info->deleted_element.previous = element->previous;
+    list.info->deleted_element.next     = element->next;
+    list.info->current                  = &list.info->deleted_element;
+
+    pointer = element->pointer;
+    element->next->previous = element->previous;
+    element->previous->next = element->next;
+
+    HDfree(element);
+    list.info->num_of_elements--;
+
+    ret_value = pointer; /* return current element */
+
+done:
+    if (ret_value == NULL)
+      {
+      }
+
+return ret_value;
+} /* HDGLremove_current() */
+
+/******************************************************************************
+ NAME
+     HDGLremove_all
+ DESCRIPTION
+    This function will remove all objects from the list.  Note that the
+    memory for these objects will not be reclaimed, so if the objects have
+    no other references, it is best to avoid this function and remove the
+    objects one by one, freeing them when necessary.
+ RETURNS
+    Nothing
+*******************************************************************************/
+void
+HDGLremove_all(Generic_list list)
+{
+    Generic_list_element *element;
+
+    /* remove all the elements from the list */
+    element = list.info->pre_element.next;
+    while (element != &list.info->post_element) 
+      {
+        element = element->next;
+        HDfree(element->previous);
+      }
+
+    list.info->pre_element.next = &list.info->post_element;
+    list.info->post_element.previous = &list.info->pre_element;
+    list.info->num_of_elements = 0;
+} /* HDGLremove_all() */
+
+/******************************************************************************
+ NAME
+     HDGLpeek_at_beginning
+ DESCRIPTION
+    This function will return the first object in the list.  If the list is
+    empty, NULL is returned.
+ RETURNS
+    First element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP
+HDGLpeek_at_beginning(Generic_list list)
+{
+    return list.info->pre_element.next->pointer;
+} /* HDGLpeek_at_beginning() */
+
+/******************************************************************************
+ NAME
+     HDGLpeek_at_end
+ DESCRIPTION
+    This function will return the last object in the list.  If the list is
+    empty, NULL is returned.
+ RETURNS
+    Last element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP
+HDGLpeek_at_end(Generic_list list)
+{
+    return list.info->post_element.previous->pointer;
+} /* HDGLpeek_at_end() */
+
+/******************************************************************************
+ NAME
+     HDGLfirst_in_list
+ DESCRIPTION
+    This function will return the first object in the list and mark it as
+    the current object.  If the list is empty, NULL is returned.
+ RETURNS
+    First element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP
+HDGLfirst_in_list(Generic_list list)
+{
+    list.info->current = list.info->pre_element.next->next->previous;
+    return list.info->current->pointer;
+} /* HDGLfirst_in_list() */
+
+/******************************************************************************
+ NAME
+     HDGLcurrent_in_list
+ DESCRIPTION
+    This function will return the object in the list that is considered
+    the current object (as defined by the surrounding functions).  If the
+    current object has just been removed, if current points to the
+    beginning or end of the list, or if the list is empty, NULL is
+    returned.
+ RETURNS
+    Current element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP
+HDGLcurrent_in_list(Generic_list list)
+{
+    return list.info->current->pointer;
+} /* HDGLcurrent_in_list() */
+
+/******************************************************************************
+ NAME
+     HDGLlast_in_list
+ DESCRIPTION
+    This function will return the last object in the list and mark it as
+    the current object.  If the list is empty, NULL is returned.
+ RETURNS
+    Last element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP
+HDGLlast_in_list(Generic_list list)
+{
+    list.info->current = list.info->post_element.previous->previous->next;
+    return list.info->current->pointer;
+} /* HDGLlast_in_list() */
+
+/******************************************************************************
+ NAME
+     HDGLnext_in_list
+ DESCRIPTION
+    This function will return the next object in the list and mark it as
+    the current object.  If the end of the list is reached, or if the list
+    is empty, NULL is returned.
+ RETURNS
+    Next element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP
+HDGLnext_in_list(Generic_list list)
+{
+    list.info->current = list.info->current->next;
+    return list.info->current->pointer;
+} /* HDGLnext_in_list() */
+
+/******************************************************************************
+ NAME
+     HDGLprevious_in_list
+ DESCRIPTION
+    This function will return the previous object in the list and mark it
+    as the current object.  If the beginning of the list is reached, or if
+    the list is empty, NULL is returned.
+ RETURNS
+    Previous element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP
+HDGLprevious_in_list(Generic_list list)
+{
+    list.info->current = list.info->current->previous;
+    return list.info->current->pointer;
+} /* HDGLprevious_in_list() */
+
+/******************************************************************************
+ NAME
+     HDGLreset_to_beginning
+ DESCRIPTION
+    This function will reset the list to the beginning.  Therefore, current
+    points to the beginning of the list, and the next object in the list is
+    the first object.
+ RETURNS
+     Nothing
+*******************************************************************************/
+void
+HDGLreset_to_beginning(Generic_list list)
+{
+    list.info->current = &list.info->pre_element;
+} /* HDGLreset_to_beginning() */
+
+/******************************************************************************
+ NAME
+     HDGLreset_to_end
+ DESCRIPTION
+    This function will reset the list to the end.  Therefore, current
+    points to the end of the list, and the previous object in the list is
+    the last object.
+ RETURNS
+     Nothing
+*******************************************************************************/
+void
+HDGLreset_to_end(Generic_list list)
+{
+    list.info->current = &list.info->post_element;
+} /* rest_to_end() */
+
+/******************************************************************************
+ NAME
+     HDGLnum_of_objects
+ DESCRIPTION
+    This function will determine the number of objects in the list.
+ RETURNS
+    Number of objects in list
+*******************************************************************************/
+intn
+HDGLnum_of_objects(Generic_list list)
+{
+    return (intn)list.info->num_of_elements;
+} /* HDGLnum_of_objects() */
+
+/******************************************************************************
+ NAME
+     HDGLis_empty
+ DESCRIPTION
+    Finds if list is empty
+ RETURNS
+    This function will return TRUE (1) if the list is empty, and FALSE (0)
+    otherwise.
+*******************************************************************************/
+intn
+HDGLis_empty(Generic_list list)
+{
+    return (list.info->num_of_elements == 0);
+} /* HDGLis_empty() */
+
+/******************************************************************************
+ NAME
+     HDGLis_in_list
+ DESCRIPTION
+     Detemines if the object is in the list.
+ RETURNS
+    This function will return TRUE (1) if the specified object is a member
+    of the list, and FALSE (0) otherwise.
+*******************************************************************************/
+intn
+HDGLis_in_list(Generic_list list, 
+           VOIDP pointer)
+{
+    Generic_list_element *element;
+
+    element = list.info->pre_element.next;
+
+    while (element != &list.info->post_element && element->pointer != pointer)
+        element = element->next;
+
+    return (element != &list.info->post_element);
+} /* HDGLis_in_list() */
+
+/******************************************************************************
+ NAME
+     HDGLcopy_list
+ DESCRIPTION
+    This function will make a copy of the list.  The objects themselves
+    are not copied; only new references to them are made.  The new list
+    loses its concept of the current object.
+ RETURNS
+    A copy of the orginal list.
+*******************************************************************************/
+Generic_list
+HDGLcopy_list(Generic_list list)
+{
+    Generic_list list_copy;
+    Generic_list_element *element;
+    intn  ret_value = SUCCEED;
+
+    list_copy.info = NULL; /* intialize info to NULL */
+
+    /* initialize new list */
+    if (HDGLinitialize_sorted_list(&list_copy, list.info->lt) == FAIL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* copy over every element to new list */
+    element = list.info->pre_element.next;
+    while (element != &list.info->post_element) 
+      {
+        if (HDGLadd_to_end(list_copy, element->pointer) == FAIL)
+            {
+                ret_value = FAIL;
+                break;
+            }
+        element = element->next;
+      }
+
+done:    
+    if (ret_value == FAIL)
+      { /* need to remove all elements from copy */
+          if (list_copy.info != NULL)
+            {
+                HDGLremove_all(list_copy);
+            }
+
+          list_copy.info = NULL; /* set to NULL */
+      }
+
+    return list_copy;
+} /* HDGLcopy_list() */
+
+/******************************************************************************
+ NAME
+     HDGLperform_on_list
+ DESCRIPTION
+    This function will perform the specified function on each object in the
+    list.  Any optional arguments required can be passed through args.
+ RETURNS
+    Nothing
+*******************************************************************************/
+void
+HDGLperform_on_list(Generic_list list, 
+                void (*fn)(VOIDP /* pointer */, VOIDP /* args */),
+                VOIDP args)
+{
+    Generic_list_element *element;
+
+    element = list.info->pre_element.next;
+    while (element != &list.info->post_element) 
+      { /* call fcn on each element */
+        (*fn)(element->pointer, args);
+        element = element->next;
+      }
+} /* HDGLperform_on_list() */
+
+/******************************************************************************
+ NAME
+     HDGLfirst_that
+ DESCRIPTION
+     This function will find and return the first object in the list which
+     causes the specified function to return a TRUE (non-zero) value.  Any
+     optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If no objects in the list
+     meet the criteria of the specified function, NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP
+HDGLfirst_that(Generic_list list, 
+           intn (*fn)(VOIDP /* pointer */, VOIDP /* args */), 
+           VOIDP args)
+{
+    Generic_list_element *element;
+
+    element = list.info->pre_element.next;
+    while (element != &list.info->post_element &&
+                            !(*fn)(element->pointer, args)) 
+      {
+        element = element->next;
+      }
+
+    if (element->pointer)
+        list.info->current = element;
+
+    return element->pointer;
+} /* HDGLfirst_that() */
+
+/******************************************************************************
+ NAME
+     HDGLnext_that
+ DESCRIPTION
+     This function will find and return the next object in the list which
+     causes the specified function to return a TRUE (non-zero) value.  Any
+     optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If there are no objects
+     left in the list that meet the criteria of the specified function,
+     NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP
+HDGLnext_that(Generic_list list, 
+          intn (*fn)(VOIDP /* pointer */, VOIDP /* args */), 
+          VOIDP args)
+{
+    Generic_list_element *element;
+
+    element = list.info->current->next;
+    while (element != &list.info->post_element &&
+                            !(*fn)(element->pointer, args)) 
+      {
+        element = element->next;
+      }
+
+    if (element->pointer)
+        list.info->current = element;
+
+    return element->pointer;
+} /* HDGLnext_that() */
+
+/******************************************************************************
+ NAME
+     HDGLprevious_that
+ DESCRIPTION
+     This function will find and return the previous object in the list
+     which causes the specified function to return a TRUE (non-zero) value.
+     Any optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If there are no objects
+     left in the list that meet the criteria of the specified function,
+     NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP
+HDGLprevious_that(Generic_list list, 
+              intn (*fn)(VOIDP /* pointer */, VOIDP /* args */), 
+              VOIDP args)
+{
+    Generic_list_element *element;
+
+    element = list.info->current->previous;
+    while (element != &list.info->pre_element &&
+                            !(*fn)(element->pointer, args)) 
+      {
+        element = element->previous;
+      }
+
+    if (element->pointer)
+        list.info->current = element;
+
+    return element->pointer;
+} /* HDGLprevious_that() */
+
+/******************************************************************************
+ NAME
+     HDGLlast_that
+ DESCRIPTION
+     This function will find and return the last object in the list which
+     causes the specified function to return a TRUE (non-zero) value.  Any
+     optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If no objects in the
+     list meet the criteria of the specified function, NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP
+HDGLlast_that(Generic_list list, 
+          intn (*fn)(VOIDP /* pointer */, VOIDP /* args */), 
+          VOIDP args)
+{
+    Generic_list_element *element;
+
+    element = list.info->post_element.previous;
+    while (element != &list.info->pre_element &&
+                            !(*fn)(element->pointer, args)) 
+      {
+        element = element->previous;
+      }
+
+    if (element->pointer)
+        list.info->current = element;
+
+    return element->pointer;
+} /* HDGLlast_that() */
+
+/******************************************************************************
+ NAME
+    HDGLall_such_that
+ DESCRIPTION
+    This function will return a new list containing all of the objects in
+    the specified list which cause the specified function to return a TRUE
+    (non-zero) value.  Any optional arguments required can be passed
+    through args. The objects themselves are not copied; only new
+    references to them are made.
+ RETURNS
+    New list if successful and empty if not.
+*******************************************************************************/
+Generic_list
+HDGLall_such_that(Generic_list list, 
+              intn (*fn)(VOIDP /* pointer */, VOIDP /* args */), 
+              VOIDP args)
+{
+    Generic_list list_copy;
+    Generic_list_element *element;
+    intn  ret_value = SUCCEED;
+
+    /* initialize copy of list */
+    if (HDGLinitialize_sorted_list(&list_copy, list.info->lt) == FAIL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* copy over elments that satisfy the fcn */
+    element = list.info->pre_element.next;
+    while (element != &list.info->post_element) 
+      {
+        if ((*fn)(element->pointer, args))
+          {
+            if (HDGLadd_to_end(list_copy, element->pointer) == FAIL)
+              {
+                  ret_value = FAIL;
+                  break;
+              }
+          }
+        element = element->next;
+      }
+    
+done:    
+    if (ret_value == FAIL)
+      {
+          if (list_copy.info != NULL)
+            {
+                HDGLremove_all(list_copy);
+            }
+
+          list_copy.info = NULL; /* set to NULL */
+      }
+
+    return list_copy;
+} /* HDGLall_such_that() */
+
+/******************************************************************************
+ NAME
+     HDGLremove_all_such_that
+ DESCRIPTION
+    This function will remove all objects in the list which cause the
+    specified function to return a TRUE (non-zero) value.  Any optional
+    arguments required can be passed through args.  Note that the memory
+    for these objects will not be reclaimed, so if the objects have
+    no other references, it is best to avoid this function and remove the
+    objects one by one, freeing them when necessary.
+ RETURNS
+     Nothing
+*******************************************************************************/
+void
+HDGLremove_all_such_that(Generic_list list, 
+                     intn (*fn)(VOIDP /* pointer */, VOIDP /* args */), 
+                     VOIDP args)
+{
+    VOIDP obj;
+
+    /* reset to the beginning */
+    HDGLreset_to_beginning(list);
+
+    while ((obj = HDGLnext_in_list(list)))
+      {
+        if ((*fn)(obj, args))
+            HDGLremove_current(list);
+      }
+} /* HDGLremove_HDGLall_such_that() */
+
+
+#if 0
+/****************************************************************************/
+/****************************************************************************/
+/**                                                                        **/
+/**                         Internal functions                             **/
+/**                                                                        **/
+/****************************************************************************/
+/****************************************************************************/
+
+static void *
+emalloc(unsigned int n)
+{
+    void *ptr;
+
+    ptr = (void *) malloc(n);
+    if ( ptr == NULL ) 
+      {
+        fprintf(stderr,"%s: error allocating memory\n", module);
+        exit(1);
+      }
+    return ptr;
+}
+#endif
diff --git a/hdf/src/glist.h b/hdf/src/glist.h
new file mode 100644
index 0000000..19bd336
--- /dev/null
+++ b/hdf/src/glist.h
@@ -0,0 +1,670 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/************************************************************************
+  Credits:
+         Original code is part of the public domain 'Generic List Library'
+         by Keith Pomakis(kppomaki at jeeves.uwaterloo.ca)-Spring, 1994
+         It has been modifed to adhere to HDF coding standards.
+
+  1996/05/29 - George V.
+ ************************************************************************/
+
+/* $Id: glist.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+#ifndef GLIST_H
+#define GLIST_H
+
+#include "hdf.h" /* needed for data types */
+
+/* Structure for each element in the list */
+typedef struct GLE_struct {
+    VOIDP                pointer;   /* data element itself */
+    struct GLE_struct   *previous; /* previous element */
+    struct GLE_struct   *next;     /* next element */
+} Generic_list_element;
+
+/* List info structure */
+typedef struct GLI_struct {
+    Generic_list_element   *current;               /* current element */
+    Generic_list_element   pre_element;            /* pre element */
+    Generic_list_element   post_element;           /* post element */
+    Generic_list_element   deleted_element;        /* deleted element */
+    intn                  (*lt)(VOIDP a, VOIDP b); /* sort fcn */
+    uint32                 num_of_elements;        /* number of elements */
+} Generic_list_info;
+
+/* Top most List structure, handle to the list */
+typedef struct GL_struct {
+    Generic_list_info *info;
+} Generic_list;
+
+/* Define a Stack and Queue */
+#define Generic_stack Generic_list
+#define Generic_queue Generic_list
+
+/* Function declarations 
+   Descriptions for the General List routines can be found in 'glist.c'
+   while the stack and queue routines are found below
+ */
+
+/******************************************************************************
+ NAME
+     HDGLinitialize_list
+ DESCRIPTION
+     Every list must be initialized before it is used.  The only time it is
+     valid to re-initialize a list is after it has been destroyed.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+intn HDGLinitialize_list(Generic_list *list /* IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLinitialize_sorted_list
+ DESCRIPTION
+    This function initializes a sorted list.  A less-than function must be
+    specified which accepts two pointers, a and b, and returns TRUE
+    (non-zero) if a is less than b, FALSE otherwise.
+
+    Once a list is initialized in this way, all of the generic list
+    functions described above can be used, except for:
+
+        void HDGLadd_to_beginning(Generic_list list, void *pointer);
+        void HDGLadd_to_end(Generic_list list, void *pointer);
+        void *HDGLremove_from_beginning(Generic_list list);
+        void *HDGLremove_from_end(Generic_list list);
+
+    and the list will remain sorted by the criteria specified by the
+    less-than function.  The only time it is valid to re-initialize a list
+    is after it has been destroyed.
+ RETURNS
+     SUCEED/FAIL
+*******************************************************************************/
+intn HDGLinitialize_sorted_list(Generic_list *list/*IN: list */, 
+                                intn (*lt)(VOIDP a, VOIDP b)/*IN:sort fcn */);
+
+/******************************************************************************
+ NAME
+     destory_list
+ DESCRIPTION
+    When a list is no longer needed, it should be destroyed.  This process
+    will automatically remove all remaining objects from the list.  However,
+    the memory for these objects will not be reclaimed, so if the objects
+    have no other references, care should be taken to purge the list and
+    free all objects before destroying the list.
+
+    It is an error to destroy a list more than once (unless it has been
+    re-initialized in the meantime).
+ RETURNS
+     Nothing
+*******************************************************************************/
+void HDGLdestroy_list(Generic_list *list /*IN: list */);
+
+/******************************************************************************
+ NAME
+    HDGLadd_to_beginning
+ DESCRIPTION
+    This function will add the specified object to the beginning of the
+    list.  The pointer must not be NULL.
+ RETURNS
+    SUCCEED/FAIL
+*******************************************************************************/
+intn HDGLadd_to_beginning(Generic_list list, /*IN: list */
+                          VOIDP pointer /*IN: data element */ );
+
+/******************************************************************************
+ NAME
+     HDGLadd_to_end
+ DESCRIPTION
+    This function will add the specified object to the end of the
+    list.  The pointer must not be NULL.
+ RETURNS
+    SUCCEED/FAIL
+*******************************************************************************/
+intn HDGLadd_to_end(Generic_list list, /*IN: list */
+                    VOIDP pointer /*IN: data element */);
+
+/******************************************************************************
+ NAME
+     HDGLadd_to_list
+ DESCRIPTION
+    This function will add the specified object to the list.  The pointer
+    must not be NULL.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+intn HDGLadd_to_list(Generic_list list, /*IN: list */
+                     VOIDP pointer /*IN: data element */);
+
+/******************************************************************************
+ NAME
+     HDGLremove_from_beginning
+ DESCRIPTION
+    This function will remove the first object from the beginning of the
+    list and return it.  If the list is empty, NULL is returned.
+ RETURNS
+    First Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP HDGLremove_from_beginning(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLremove_from_end
+ DESCRIPTION
+    This function will remove the last object from the end of the list and
+    return it.  If the list is empty, NULL is returned.
+ RETURNS
+    Last element if successfull and NULL otherwise
+*******************************************************************************/
+VOIDP HDGLremove_from_end(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLremove_from_list
+ DESCRIPTION
+    This function will remove the specified object from the list and return
+    it.  If the specified object does not exist in the list, NULL is
+    returned.  If the specified object exists in the list more than once,
+    only the last reference to it is removed.
+
+ RETURNS
+    Element removed if successful and NULL otherwise
+*******************************************************************************/
+VOIDP HDGLremove_from_list(Generic_list list, /*IN: list */
+                           VOIDP pointer /*IN: data element */);
+
+/******************************************************************************
+ NAME
+     HDGLremove_current
+ DESCRIPTION
+    This function will remove the current object from the list and return
+    it.  If the current object has already been removed, if current points
+    to the beginning or end of the list, or if the list is empty, NULL is
+    returned.
+ RETURNS
+    Current element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP HDGLremove_current(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLremove_all
+ DESCRIPTION
+    This function will remove all objects from the list.  Note that the
+    memory for these objects will not be reclaimed, so if the objects have
+    no other references, it is best to avoid this function and remove the
+    objects one by one, freeing them when necessary.
+ RETURNS
+    Nothing
+*******************************************************************************/
+void HDGLremove_all(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLpeek_at_beginning
+ DESCRIPTION
+    This function will return the first object in the list.  If the list is
+    empty, NULL is returned.
+ RETURNS
+    First element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP HDGLpeek_at_beginning(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLpeek_at_end
+ DESCRIPTION
+    This function will return the last object in the list.  If the list is
+    empty, NULL is returned.
+ RETURNS
+    Last element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP HDGLpeek_at_end(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLfirst_in_list
+ DESCRIPTION
+    This function will return the first object in the list and mark it as
+    the current object.  If the list is empty, NULL is returned.
+ RETURNS
+    First element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP HDGLfirst_in_list(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLcurrent_in_list
+ DESCRIPTION
+    This function will return the object in the list that is considered
+    the current object (as defined by the surrounding functions).  If the
+    current object has just been removed, if current points to the
+    beginning or end of the list, or if the list is empty, NULL is
+    returned.
+ RETURNS
+    Current element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP HDGLcurrent_in_list(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLlast_in_list
+ DESCRIPTION
+    This function will return the last object in the list and mark it as
+    the current object.  If the list is empty, NULL is returned.
+ RETURNS
+    Last element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP HDGLlast_in_list(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLnext_in_list
+ DESCRIPTION
+    This function will return the next object in the list and mark it as
+    the current object.  If the end of the list is reached, or if the list
+    is empty, NULL is returned.
+ RETURNS
+    Next element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP HDGLnext_in_list(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLprevious_in_list
+ DESCRIPTION
+    This function will return the previous object in the list and mark it
+    as the current object.  If the beginning of the list is reached, or if
+    the list is empty, NULL is returned.
+ RETURNS
+    Previous element in list if non-empty, otherwise NULL.
+*******************************************************************************/
+VOIDP HDGLprevious_in_list(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLreset_to_beginning
+ DESCRIPTION
+    This function will reset the list to the beginning.  Therefore, current
+    points to the beginning of the list, and the next object in the list is
+    the first object.
+ RETURNS
+     Nothing
+*******************************************************************************/
+void HDGLreset_to_beginning(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLreset_to_end
+ DESCRIPTION
+    This function will reset the list to the end.  Therefore, current
+    points to the end of the list, and the previous object in the list is
+    the last object.
+ RETURNS
+     Nothing
+*******************************************************************************/
+void HDGLreset_to_end(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLnum_of_objects
+ DESCRIPTION
+    This function will determine the number of objects in the list.
+ RETURNS
+    Number of objects in list
+*******************************************************************************/
+intn HDGLnum_of_objects(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLis_empty
+ DESCRIPTION
+    Finds if list is empty
+ RETURNS
+    This function will return TRUE (1) if the list is empty, and FALSE (0)
+    otherwise.
+*******************************************************************************/
+intn HDGLis_empty(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLis_in_list
+ DESCRIPTION
+     Detemines if the object is in the list.
+ RETURNS
+    This function will return TRUE (1) if the specified object is a member
+    of the list, and FALSE (0) otherwise.
+*******************************************************************************/
+intn HDGLis_in_list(Generic_list list, /*IN: list */
+               VOIDP pointer /*IN: data element */);
+
+/******************************************************************************
+ NAME
+     HDGLcopy_list
+ DESCRIPTION
+    This function will make a copy of the list.  The objects themselves
+    are not copied; only new references to them are made.  The new list
+    loses its concept of the current object.
+ RETURNS
+    A copy of the orginal list.
+*******************************************************************************/
+Generic_list HDGLcopy_list(Generic_list list /*IN: list */);
+
+/******************************************************************************
+ NAME
+     HDGLperform_on_list
+ DESCRIPTION
+    This function will perform the specified function on each object in the
+    list.  Any optional arguments required can be passed through args.
+ RETURNS
+    Nothing
+*******************************************************************************/
+void HDGLperform_on_list(Generic_list list, /*IN: list */
+                         void (*fn)(VOIDP pointer, VOIDP args), /* IN: iterator fcn */
+                         VOIDP args /*IN: args to iterator fcn */);
+
+/******************************************************************************
+ NAME
+     HDGLfirst_that
+ DESCRIPTION
+     This function will find and return the first object in the list which
+     causes the specified function to return a TRUE (non-zero) value.  Any
+     optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If no objects in the list
+     meet the criteria of the specified function, NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP HDGLfirst_that(Generic_list list, /*IN: list */
+                     intn (*fn)(VOIDP pointer, VOIDP args), /* IN: iterator fcn */
+                     VOIDP args /*IN: args to iterator fcn */);
+
+/******************************************************************************
+ NAME
+     HDGLnext_that
+ DESCRIPTION
+     This function will find and return the next object in the list which
+     causes the specified function to return a TRUE (non-zero) value.  Any
+     optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If there are no objects
+     left in the list that meet the criteria of the specified function,
+     NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP HDGLnext_that(Generic_list list, /*IN: list */
+                    intn (*fn)(VOIDP pointer, VOIDP args), /* IN: iterator fcn */
+                    VOIDP args /*IN: args to iterator fcn */);
+
+/******************************************************************************
+ NAME
+     HDGLprevious_that
+ DESCRIPTION
+     This function will find and return the previous object in the list
+     which causes the specified function to return a TRUE (non-zero) value.
+     Any optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If there are no objects
+     left in the list that meet the criteria of the specified function,
+     NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP HDGLprevious_that(Generic_list list, /*IN: list */
+                        intn (*fn)(VOIDP pointer, VOIDP args), /* IN: iterator fcn */
+                        VOIDP args /*IN: args to iterator fcn */);
+
+/******************************************************************************
+ NAME
+     HDGLlast_that
+ DESCRIPTION
+     This function will find and return the last object in the list which
+     causes the specified function to return a TRUE (non-zero) value.  Any
+     optional arguments required can be passed through args.  The found
+     object is then marked as the current object.  If no objects in the
+     list meet the criteria of the specified function, NULL is returned.
+ RETURNS
+     Element if successful and NULL otherwise.
+*******************************************************************************/
+VOIDP HDGLlast_that(Generic_list list, /*IN: list */
+                    intn (*fn)(VOIDP pointer, VOIDP args), /* IN: iterator fcn */
+                    VOIDP args /*IN: args to iterator fcn */);
+
+/******************************************************************************
+ NAME
+    HDGLall_such_that
+ DESCRIPTION
+    This function will return a new list containing all of the objects in
+    the specified list which cause the specified function to return a TRUE
+    (non-zero) value.  Any optional arguments required can be passed
+    through args. The objects themselves are not copied; only new
+    references to them are made.
+ RETURNS
+    New list if successful and empty if not.
+*******************************************************************************/
+Generic_list HDGLall_such_that(Generic_list list, /*IN: list */
+                               intn (*fn)(VOIDP pointer, VOIDP args), /* IN: iterator fcn */
+                               VOIDP args /*IN: args to iterator fcn */);
+
+/******************************************************************************
+ NAME
+     HDGLremove_HDGLall_such_that
+ DESCRIPTION
+    This function will remove all objects in the list which cause the
+    specified function to return a TRUE (non-zero) value.  Any optional
+    arguments required can be passed through args.  Note that the memory
+    for these objects will not be reclaimed, so if the objects have
+    no other references, it is best to avoid this function and remove the
+    objects one by one, freeing them when necessary.
+ RETURNS
+     Nothing
+*******************************************************************************/
+void HDGLremove_all_such_that(Generic_list list, /*IN: list */
+                              intn (*fn)(VOIDP pointer, VOIDP args), /* IN: iterator fcn */
+                              VOIDP args /*IN: args to iterator fcn */);
+
+
+/****************************************************************************/
+/* 
+ * Stack operations 
+ */
+
+/******************************************************************************
+ NAME
+     HDGSinitialize_stack
+ DESCRIPTION
+    Every stack must be initialized before it is used.  The only time it is
+    valid to re-initialize a stack is after it has been destroyed.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+#define HDGSinitialize_stack HDGLinitialize_list
+
+/******************************************************************************
+ NAME
+     HDGSdestroy_stack     
+ DESCRIPTION
+    When a stack is no longer needed, it should be destroyed.  This process
+    will automatically remove all remaining objects from the stack.
+    However, the memory for these objects will not be reclaimed, so if the
+    objects have no other references, care should be taken to purge the
+    stack and free all objects before destroying the stack.
+
+    It is an error to destroy a stack more than once (unless it has been
+    re-initialized in the meantime).
+ RETURNS
+     Nothing
+*******************************************************************************/
+#define HDGSdestroy_stack    HDGLdestroy_list
+
+/******************************************************************************
+ NAME
+     HDGSpush
+ DESCRIPTION
+    This function will HDGSpush the specified object onto the stack.  The
+    pointer must not be NULL.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+#define HDGSpush             HDGLadd_to_beginning
+
+/******************************************************************************
+ NAME
+     HDGSpop
+ DESCRIPTION
+    This function will HDGSpop the first object from the top of the stack and
+    return it.  If the stack is empty, NULL is returned.
+ RETURNS
+     First element of the top of the stack
+*******************************************************************************/
+#define HDGSpop              HDGLremove_from_beginning
+
+/******************************************************************************
+ NAME
+     HDGSpop_all
+ DESCRIPTION
+    This function will HDGSpop all objects from the stack.  Note that the
+    memory for these objects will not be reclaimed, so if the objects have
+    no other references, it is best to avoid this function and HDGSpop the
+    objects one by one, freeing them when necessary.
+ RETURNS
+     Nothing
+*******************************************************************************/
+#define HDGSpop_all          HDGLremove_all
+
+/******************************************************************************
+ NAME
+     HDGSpeek_at_top
+ DESCRIPTION
+    This function will return the object on the top of the stack.  If the
+    stack is empty, NULL is returned.
+ RETURNS
+     Element at top of stack.
+*******************************************************************************/
+#define HDGSpeek_at_top      HDGLpeek_at_beginning
+
+/******************************************************************************
+ NAME
+     HDGScopy_stack
+ DESCRIPTION
+    This function will return a copy of the stack.  The objects themselves
+    are not copied; only new references to them are made.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+#define HDGScopy_stack       HDGLcopy_list
+
+
+/****************************************************************************/
+/* 
+ * Queue operations 
+ */
+
+/******************************************************************************
+ NAME
+     HDGQinitialize_queue
+ DESCRIPTION
+    Every queue must be initialized before it is used.  The only time it is
+    valid to re-initialize a queue is after it has been destroyed.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+#define HDGQinitialize_queue HDGLinitialize_list
+
+/******************************************************************************
+ NAME
+     HDGQdestroy_queue
+ DESCRIPTION
+    When a queue is no longer needed, it should be destroyed.  This process
+    will automatically remove all remaining objects from the queue.
+    However, the memory for these objects will not be reclaimed, so if the
+    objects have no other references, care should be taken to purge the
+    queue and free all objects before destroying the queue.
+
+    It is an error to destroy a queue more than once (unless it has been
+    re-initialized in the meantime).
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+#define HDGQdestroy_queue    HDGLdestroy_list
+
+/******************************************************************************
+ NAME
+     HDGQenqueue     
+ DESCRIPTION
+    This function will add the specified object to the tail of the queue.
+    The pointer must not be NULL.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+#define HDGQenqueue          HDGLadd_to_end
+
+/******************************************************************************
+ NAME
+     HDGQdequeue
+ DESCRIPTION
+    This function will remove the first object from the head of the queue
+    and return it.  If the queue is empty, NULL is returned.
+ RETURNS
+    First element in the queue in non-empty, else NULL.
+*******************************************************************************/
+#define HDGQdequeue          HDGLremove_from_beginning
+
+/******************************************************************************
+ NAME
+     HDGQdequeue_all
+ DESCRIPTION
+    This function will remove all objects from the queue.  Note that the
+    memory for these objects will not be reclaimed, so if the objects have
+    no other references, it is best to avoid this function and HDGQdequeue the
+    objects one by one, freeing them when necessary.
+ RETURNS
+     Nothing
+*******************************************************************************/
+#define HDGQdequeue_all      HDGLremove_all
+
+/******************************************************************************
+ NAME
+     HDGQpeek_at_head
+ DESCRIPTION
+    This function will return the object at the head of the queue.  If the
+    queue is empty, NULL is returned.
+ RETURNS
+    First element in the queue in non-empty, else NULL.
+*******************************************************************************/
+#define HDGQpeek_at_head     HDGLpeek_at_beginning
+
+/******************************************************************************
+ NAME
+     HDGQpeek_at_tail
+ DESCRIPTION
+    This function will return the object at the tail of the queue.  If the
+    queue is empty, NULL is returned.
+ RETURNS
+    Last element in the queue in non-empty, else NULL.
+*******************************************************************************/
+#define HDGQpeek_at_tail     HDGLpeek_at_end
+
+/******************************************************************************
+ NAME
+     HDGQcopy_queue
+ DESCRIPTION
+    This function will return a copy of the queue.  The objects themselves
+    are not copied; only new references to them are made.
+ RETURNS
+     SUCCEED/FAIL
+*******************************************************************************/
+#define HDGQcopy_queue       HDGLcopy_list
+
+#endif /* GLIST_H */
+
diff --git a/hdf/src/h4config.h.in b/hdf/src/h4config.h.in
new file mode 100644
index 0000000..34ca436
--- /dev/null
+++ b/hdf/src/h4config.h.in
@@ -0,0 +1,139 @@
+/* hdf/src/h4config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to dummy `main' function (if any) required to link to the Fortran
+   libraries. */
+#undef F77_DUMMY_MAIN
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+   case), which must not contain underscores, for linking with Fortran. */
+#undef F77_FUNC
+
+/* As F77_FUNC, but for C identifiers containing underscores. */
+#undef F77_FUNC_
+
+/* Define to 1 if your Fortran compiler doesn't accept -c and -o together. */
+#undef F77_NO_MINUS_C_MINUS_O
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+#undef FC_DUMMY_MAIN_EQ_F77
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <jpeglib.h> header file. */
+#undef HAVE_JPEGLIB_H
+
+/* Define to 1 if you have the `jpeg' library (-ljpeg). */
+#undef HAVE_LIBJPEG
+
+/* Define to 1 if you have the `sz' library (-lsz). */
+#undef HAVE_LIBSZ
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define if we support HDF NetCDF APIs version 2.3.2 */
+#undef HAVE_NETCDF
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `system' function. */
+#undef HAVE_SYSTEM
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define if szip has encoder */
+#undef HAVE_SZIP_ENCODER
+
+/* Define to 1 if you have the <szlib.h> header file. */
+#undef HAVE_SZLIB_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the `wait' function. */
+#undef HAVE_WAIT
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Define if deprecated public API symbols are disabled */
+#undef NO_DEPRECATED_SYMBOLS
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `int*', as computed by sizeof. */
+#undef SIZEOF_INTP
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
diff --git a/hdf/src/hbitio.c b/hdf/src/hbitio.c
new file mode 100644
index 0000000..e8aca1f
--- /dev/null
+++ b/hdf/src/hbitio.c
@@ -0,0 +1,965 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: hbitio.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+FILE
+   hbitio.c
+   HDF bit level I/O routines
+REMARKS
+   These functions operate on top of the "H" layer routines
+   (i.e. they call Hstartread, Hstartwrite, Hread, Hseek, Hwrite, etc.)
+   and depend on them for all actual I/O to data elements in the
+   file.  This may be somewhat slow, but it prevents having
+   to duplicate code for that access.
+EXPORTED ROUTINES
+   Hstartbitread  - open a dataset for bitfile dataset reading
+   Hstartbitwrite - open a dataset for bitfile dataset writing
+   Happendable    - make a writable dataset appendable
+   Hbitread       - read bits from a bitfile dataset
+   Hbitwrite      - write bits to a bitfile dataset
+   Hbitseek       - seek to a given bit offset in a bitfile dataset
+   Hendbitaccess  - close off access to a bitfile dataset
+LOCAL ROUTINES
+   HIbitflush         - flush the bits out to a writable bitfile
+   HIget_bitfile_rec  - get a free bitfile record 
+   HIread2write       - switch from reading bits to writing them
+   HIwrite2read       - switch from writing bits to reading them
+AUTHOR
+   Quincey Koziol
+MODIFICATION HISTORY
+   3/15/92     Starting writing
+*/
+
+#define BITMASTER
+#include "hdf.h"
+#include "hfile.h"
+
+/* Local Variables */
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+/* Local Function Declarations */
+PRIVATE bitrec_t * HIget_bitfile_rec(void);
+
+PRIVATE intn HIbitflush(bitrec_t * bitfile_rec, intn flushbit, intn writeout);
+
+PRIVATE intn HIwrite2read(bitrec_t * bitfile_rec);
+PRIVATE intn HIread2write(bitrec_t * bitfile_rec);
+
+PRIVATE intn HIbitstart(void);
+
+/* #define TESTING */
+/* Actual Function Definitions */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hstartbitread -- locate and position a bit-read access elt on a tag/ref
+ USAGE
+       int32 Hstartbitread(fileid, tag, ref)
+       int fileid;             IN: id of file to attach access element to
+       int tag;                IN: tag to search for
+       int ref;                IN: ref to search for
+ RETURNS
+       returns id of bit-access element if successful, otherwise FAIL (-1)
+ DESCRIPTION
+        Calls Hstartread and initializes bit-level structures.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+Hstartbitread(int32 file_id, uint16 tag, uint16 ref)
+{
+    CONSTR(FUNC, "Hstartbitread");  /* for HERROR */
+    int32       aid;            /* Access ID for the bit-level routines to use */
+    struct bitrec_t *bitfile_rec;   /* Pointer to the bitfile record */
+    int32       ret_value;          /* return bit ID */
+
+    /* clear error stack */
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(HIbitstart()==FAIL)
+            HRETURN_ERROR(DFE_CANTINIT, FAIL);
+
+    /* Try to get an AID */
+    if ((aid = Hstartread(file_id, tag, ref)) == FAIL)
+        HRETURN_ERROR(DFE_BADAID, FAIL);
+
+    /* get a slot in the access record array */
+    if ((bitfile_rec = HIget_bitfile_rec()) == NULL)
+        HRETURN_ERROR(DFE_TOOMANY, FAIL);
+
+    bitfile_rec->acc_id = aid;
+    ret_value= HAregister_atom(BITIDGROUP,bitfile_rec);
+    bitfile_rec->bit_id=ret_value;
+    if (HQuerylength(aid, &bitfile_rec->max_offset) == FAIL)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+    bitfile_rec->byte_offset = 0;
+
+    bitfile_rec->access = 'r';
+    bitfile_rec->mode = 'r';
+    bitfile_rec->bytez = bitfile_rec->bytea + BITBUF_SIZE;
+
+    /* pre-read the first block into the buffer */
+    if (bitfile_rec->max_offset > bitfile_rec->byte_offset)
+      {
+          int32       read_size;    /* number of bytes to read into buffer */
+          int32       n;        /* number of bytes actually read */
+
+          read_size = MIN((bitfile_rec->max_offset - bitfile_rec->byte_offset), BITBUF_SIZE);
+          if ((n = Hread(bitfile_rec->acc_id, read_size, bitfile_rec->bytea)) == FAIL)
+              return (FAIL);    /* EOF? somebody pulled the rug out from under us! */
+          bitfile_rec->buf_read = (intn) n;    /* keep track of the number of bytes in buffer */
+          bitfile_rec->bytep = bitfile_rec->bytea;  /* set to the beginning of the buffer */
+      }     /* end if */
+    else
+      {
+          bitfile_rec->bytep = bitfile_rec->bytez;  /* set to the end of the buffer to force read */
+          bitfile_rec->buf_read = 0;    /* set the number of bytes in buffer to 0 */
+      }     /* end else */
+    bitfile_rec->block_offset = 0;
+    bitfile_rec->count = 0;
+
+    return(ret_value);
+}   /* Hstartbitread() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hstartbitwrite -- set up a bit access elt for a write
+ USAGE
+       int32 Hstartbitwrite(fileid, tag, ref, len)
+       int fileid;             IN: id of file to write to
+       int tag;                IN: tag to write to
+       int ref;                IN: ref to write to
+       long length;            IN: the length of the data element (in bytes)
+ RETURNS
+       returns id of bit access element if successful and FAIL otherwise
+ DESCRIPTION
+       Set up a bit-write access elt to write out a data element.  Calls
+       Hstartwrite for most initialization and just initializes the bit-
+       level stuff here.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+Hstartbitwrite(int32 file_id, uint16 tag, uint16 ref, int32 length)
+{
+    CONSTR(FUNC, "Hstartbitwrite");     /* for HERROR */
+    bitrec_t   *bitfile_rec;    /* access record */
+    int32       aid;            /* Access ID for the bit-level routines to use */
+    intn        exists;         /* whether dataset exists already */
+    int32       ret_value;          /* return bit ID */
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(HIbitstart()==FAIL)
+            HRETURN_ERROR(DFE_CANTINIT, FAIL);
+
+    exists = (Hexist(file_id, tag, ref) == SUCCEED) ? TRUE : FALSE;
+
+    /* Try to get an AID */
+    if ((aid = Hstartwrite(file_id, tag, ref, length)) == FAIL)
+        HRETURN_ERROR(DFE_BADAID, FAIL);
+
+    /* get empty slot in bit-access records */
+    if ((bitfile_rec = HIget_bitfile_rec()) == NULL)
+        HRETURN_ERROR(DFE_TOOMANY, FAIL);
+
+    bitfile_rec->acc_id = aid;
+    ret_value= HAregister_atom(BITIDGROUP,bitfile_rec);
+    bitfile_rec->bit_id=ret_value;
+    bitfile_rec->byte_offset = 0;
+    bitfile_rec->block_offset = 0;
+    if (exists == TRUE)
+      {
+          if (HQuerylength(aid, &bitfile_rec->max_offset) == FAIL)
+              HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+          /* pre-read the first block into the buffer */
+          if (bitfile_rec->max_offset > bitfile_rec->byte_offset)
+            {
+                int32       read_size;  /* number of bytes to read into buffer */
+                int32       n;  /* number of bytes actually read */
+
+                read_size = MIN((bitfile_rec->max_offset - bitfile_rec->byte_offset), BITBUF_SIZE);
+                if ((n = Hread(bitfile_rec->acc_id, read_size, bitfile_rec->bytea)) == FAIL)
+                    HRETURN_ERROR(DFE_READERROR, FAIL);     /* EOF? somebody pulled the rug out from under us! */
+                bitfile_rec->buf_read = (intn) n;  /* keep track of the number of bytes in buffer */
+                if (Hseek(bitfile_rec->acc_id, bitfile_rec->block_offset, DF_START) == FAIL)
+                    HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+            }   /* end if */
+      }     /* end if */
+    else
+      {
+          bitfile_rec->max_offset = 0;
+          bitfile_rec->buf_read = 0;    /* set the number of bytes in buffer to 0 */
+      }     /* end else */
+    bitfile_rec->access = 'w';
+    bitfile_rec->mode = 'w';
+    bitfile_rec->bytez = bitfile_rec->bytea + BITBUF_SIZE;
+    bitfile_rec->bytep = bitfile_rec->bytea;    /* set to the beginning of the buffer */
+    bitfile_rec->count = BITNUM;
+    bitfile_rec->bits = 0;
+
+    return ret_value;
+}   /* end Hstartbitwrite() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hbitappendable -- make a bitio AID appendable
+ USAGE
+       intn Hbitappendable(bitid)
+       int32 bitid;         IN: id of bit-element to make appendable
+ RETURNS
+        SUCCEED for success
+        FAIL to indicate failure
+ DESCRIPTION
+       If a dataset is at the end of a file, allow Hbitwrite()s to write
+       past the end of a file.  Allows expanding datasets without the use
+       of linked blocks.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hbitappendable(int32 bitid)
+{
+    CONSTR(FUNC, "Hbitappendable");     /* for HERROR */
+    bitrec_t   *bitfile_rec;    /* access record */
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    if ((bitfile_rec = HAatom_object(bitid)) == NULL)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for write access */
+    if (bitfile_rec->access != 'w')
+        HRETURN_ERROR(DFE_BADACC, FAIL);
+
+    if (Happendable(bitfile_rec->acc_id) == FAIL)
+        HRETURN_ERROR(DFE_NOTENOUGH, FAIL);
+    return (SUCCEED);
+}   /* end Hbitappendable() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hbitwrite -- write a number of bits out to a bit-element
+ USAGE
+       intn Hbitwrite(bitid, count, data)
+       int32 bitid;         IN: id of bit-element to write to
+       intn count;          IN: number of bits to write
+       uint32 data;         IN: actual data bits to output
+                            (bits to output must be in the low bits)
+ RETURNS
+       the number of bits written for successful write,
+       FAIL to indicate failure
+ DESCRIPTION
+       Write a number of bits out to a bit-element.  This function
+       buffers the bits and then writes them out when appropriate
+       with Hwrite().
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hbitwrite(int32 bitid, intn count, uint32 data)
+{
+    CONSTR(FUNC, "Hbitwrite");  /* for HERROR */
+    static int32 last_bit_id=(-1); /* the bit ID of the last bitfile_record accessed */
+    static bitrec_t   *bitfile_rec=NULL; /* access record */
+    intn        orig_count = count;     /* keep track of orig, number of bits to output */
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    if (count <= 0)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* cache the bitfile_record since this routine gets called so many times */
+    if(bitid!=last_bit_id)
+      {
+/* This needs a mutex semaphore when we go to a multi-threaded version of the library -QAK */
+        bitfile_rec = HAatom_object(bitid);
+        last_bit_id=bitid;
+      } /* end if */
+
+    if (bitfile_rec == NULL)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for write access */
+    if (bitfile_rec->access != 'w')
+        HRETURN_ERROR(DFE_BADACC, FAIL);
+
+    if (count > (intn)DATANUM)
+        count = (intn)DATANUM;
+
+    /* change bitfile modes if necessary */
+    if (bitfile_rec->mode == 'r')
+        HIread2write(bitfile_rec);
+
+    data &= maskl[count];
+
+    /* if the new bits will not fill up a byte, then just */
+    /* merge the new bits into the current bits buffer */
+    if (count < bitfile_rec->count)
+      {
+          bitfile_rec->bits |= (uint8)(data << (bitfile_rec->count -= count));
+          return (orig_count);
+      }     /* end if */
+
+    /* fill up the current bits buffer and output the byte */
+    *(bitfile_rec->bytep) = (uint8) (bitfile_rec->bits | (uint8)(data >> (count -= bitfile_rec->count)));
+    bitfile_rec->byte_offset++;
+    if (++bitfile_rec->bytep == bitfile_rec->bytez)
+      {
+          int32       write_size;
+
+          write_size = bitfile_rec->bytez - bitfile_rec->bytea;
+          bitfile_rec->bytep = bitfile_rec->bytea;
+          if (Hwrite(bitfile_rec->acc_id, write_size, bitfile_rec->bytea) == FAIL)
+              HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+          bitfile_rec->block_offset += write_size;
+
+          /* check if we should pre-read the next block into the buffer */
+          if (bitfile_rec->max_offset > bitfile_rec->byte_offset)
+            {
+                int32       read_size;  /* number of bytes to read into buffer */
+                int32       n;  /* number of bytes actually read */
+
+                read_size = MIN((bitfile_rec->max_offset - bitfile_rec->byte_offset), BITBUF_SIZE);
+                if ((n = Hread(bitfile_rec->acc_id, read_size, bitfile_rec->bytea)) == FAIL)
+                    HRETURN_ERROR(DFE_READERROR, FAIL);     /* EOF? somebody pulled the rug out from under us! */
+                bitfile_rec->buf_read = n;  /* keep track of the number of bytes in buffer */
+                if (Hseek(bitfile_rec->acc_id, bitfile_rec->block_offset, DF_START) == FAIL)
+                    HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+            }   /* end if */
+      }     /* end if */
+
+    /* output any and all remaining whole bytes */
+    while (count >= (intn)BITNUM)
+      {
+          *(bitfile_rec->bytep) = (uint8) (data >> (count -= (intn)BITNUM));
+          bitfile_rec->byte_offset++;
+          if (++bitfile_rec->bytep == bitfile_rec->bytez)
+            {
+                int32       write_size;
+
+                write_size = bitfile_rec->bytez - bitfile_rec->bytea;
+                bitfile_rec->bytep = bitfile_rec->bytea;
+                if (Hwrite(bitfile_rec->acc_id, write_size, bitfile_rec->bytea) == FAIL)
+                    HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+                bitfile_rec->block_offset += write_size;
+
+                /* check if we should pre-read the next block into the buffer */
+                if (bitfile_rec->max_offset > bitfile_rec->byte_offset)
+                  {
+                      int32       read_size;    /* number of bytes to read into buffer */
+                      int32       n;    /* number of bytes actually read */
+
+                      read_size = MIN((bitfile_rec->max_offset - bitfile_rec->byte_offset), BITBUF_SIZE);
+                      if ((n = Hread(bitfile_rec->acc_id, read_size, bitfile_rec->bytea)) == FAIL)
+                          HRETURN_ERROR(DFE_READERROR, FAIL);   /* EOF? somebody pulled the rug out from under us! */
+                      bitfile_rec->buf_read = n;    /* keep track of the number of bytes in buffer */
+                      if (Hseek(bitfile_rec->acc_id, bitfile_rec->block_offset, DF_START) == FAIL)
+                          HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+                  }     /* end if */
+            }   /* end if */
+      }     /* end while */
+
+    /* put any remaining bits into the bits buffer */
+    if ((bitfile_rec->count = (intn)BITNUM - count) > 0)
+        bitfile_rec->bits = (uint8) (data << bitfile_rec->count);
+
+    /* Update the offset in the buffer */
+    if (bitfile_rec->byte_offset > bitfile_rec->max_offset)
+        bitfile_rec->max_offset = bitfile_rec->byte_offset;
+
+    return (orig_count);
+}   /* end Hbitwrite() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hbitread -- read a number of bits from a bit-element
+ USAGE
+       intn Hbitread(bitid, count, data)
+       int32 bitid;         IN: id of bit-element to write to
+       intn count;          IN: number of bits to write
+       uint32 *data;        IN: pointer to the bits to read
+                            OUT: points to the bits read in
+                            (bits input will be in the low bits)
+ RETURNS
+       the number of bits read for successful write,
+       FAIL to indicate failure
+ DESCRIPTION
+       Read a number of bits from a bit-element.  This function
+       buffers the bits and then reads them when appropriate
+       with Hread().
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hbitread(int32 bitid, intn count, uint32 *data)
+{
+    CONSTR(FUNC, "Hbitread");   /* for HERROR */
+    static int32 last_bit_id=(-1); /* the bit ID of the last bitfile_record accessed */
+    static bitrec_t   *bitfile_rec=NULL;    /* access record */
+    uint32 l;
+    uint32      b = 0;          /* bits to return */
+    intn        orig_count;     /* the original number of bits to read in */
+    int32       n;
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    if (count <= 0)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* cache the bitfile_record since this routine gets called so many times */
+    if(bitid!=last_bit_id)
+      {
+/* This needs a mutex semaphore when we go to a multi-threaded version of the library -QAK */
+        bitfile_rec = HAatom_object(bitid);
+        last_bit_id=bitid;
+      } /* end if */
+
+    if (bitfile_rec == NULL)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for write access */
+    /* change bitfile modes if necessary */
+    if (bitfile_rec->mode == 'w')
+        HIwrite2read(bitfile_rec);
+
+    if (count > (intn)DATANUM)    /* truncate the count if it's too large */
+        count = DATANUM;
+
+    /* if the request can be satisfied with just the */
+    /* buffered bits then do the shift and return */
+    if (count <= bitfile_rec->count)
+      {
+          *data = (uint32)((uintn)bitfile_rec->bits >> (bitfile_rec->count -= count)) & (uint32) maskc[count];
+          return (count);
+      }     /* end if */
+
+    /* keep track of the original number of bits to read in */
+    orig_count = count;
+
+    /* get all the buffered bits into the correct position first */
+    if (bitfile_rec->count > 0)
+      {
+          b = (uint32)(bitfile_rec->bits & maskc[bitfile_rec->count]);
+          b <<= (count -= bitfile_rec->count);
+      }     /* end if */
+
+    /* bring in as many whole bytes as the request allows */
+    while (count >= (intn)BITNUM)
+      {
+          if (bitfile_rec->bytep == bitfile_rec->bytez)
+            {
+                n = Hread(bitfile_rec->acc_id, BITBUF_SIZE, bitfile_rec->bytea);
+                if (n == FAIL)
+                  {     /* EOF */
+                      bitfile_rec->count = 0;   /* make certain that we don't try to access the file->bits information */
+                      *data = b;    /* assign the bits read in */
+                      return (orig_count - count);  /* break out now */
+                  }     /* end if */
+                bitfile_rec->block_offset += bitfile_rec->buf_read;     /* keep track of the number of bytes in buffer */
+                bitfile_rec->bytez = n + (bitfile_rec->bytep = bitfile_rec->bytea);
+                bitfile_rec->buf_read = n;  /* keep track of the number of bytes in buffer */
+            }   /* end if */
+          l = (uint32) (*bitfile_rec->bytep++);
+          b |= (uint32)(l << (count -= (intn)BITNUM));
+          bitfile_rec->byte_offset++;
+          if (bitfile_rec->byte_offset > bitfile_rec->max_offset)
+              bitfile_rec->max_offset = bitfile_rec->byte_offset;
+      }     /* end while */
+
+    /* split any partial request with the bits buffer */
+    if (count > 0)
+      {
+          if (bitfile_rec->bytep == bitfile_rec->bytez)
+            {
+                n = Hread(bitfile_rec->acc_id, BITBUF_SIZE, bitfile_rec->bytea);
+                if (n == FAIL)
+                  {     /* EOF */
+                      bitfile_rec->count = 0;   /* make certain that we don't try to access the file->bits information */
+                      *data = b;    /* assign the bits read in */
+                      return (orig_count - count);  /* return now */
+                  }     /* end if */
+                bitfile_rec->block_offset += bitfile_rec->buf_read;     /* keep track of the number of bytes in buffer */
+                bitfile_rec->bytez = n + (bitfile_rec->bytep = bitfile_rec->bytea);
+                bitfile_rec->buf_read = n;  /* keep track of the number of bytes in buffer */
+            }   /* end if */
+          bitfile_rec->count = ((intn)BITNUM - count);
+          l = (uint32) (bitfile_rec->bits = *bitfile_rec->bytep++);
+          b |= l >> bitfile_rec->count;
+          bitfile_rec->byte_offset++;
+          if (bitfile_rec->byte_offset > bitfile_rec->max_offset)
+              bitfile_rec->max_offset = bitfile_rec->byte_offset;
+      }     /* end if */
+    else
+        bitfile_rec->count = 0;
+
+    *data = b;
+    return (orig_count);
+}   /* end Hbitread() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hbitseek -- seek to a given bit position in a bit-element
+ USAGE
+       intn Hbitseek(bitid, offset)
+       int32 bitid;         IN: id of bit-element to write to
+       intn byte_offset;    IN: byte offset in the bit-element
+       intn bit_offset;     IN: bit offset from the byte offset
+
+ RETURNS
+       returns FAIL (-1) if fail, SUCCEED (0) otherwise.
+ DESCRIPTION
+       Seek to a bit offset in a bit-element.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+        If seeking to the 15th bit in a bit-element, the call would look like:
+            Hbitseek(bitid,1,7);
+
+        Converting from a direct bit offset variable to this call looks like:
+            Hbitseek(bitid,bit_offset/8,bit_offset%8);
+REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hbitseek(int32 bitid, int32 byte_offset, intn bit_offset)
+{
+    CONSTR(FUNC, "Hbitseek");   /* for HERROR */
+    bitrec_t   *bitfile_rec;    /* access record */
+    int32       seek_pos;       /* position of block to seek to */
+    int32       read_size;      /* number of bytes to read into buffer */
+    int32       n;              /* number of bytes actually read */
+    intn        new_block;      /* whether to move to another block in the dataset */
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    if (byte_offset < 0 || bit_offset < 0 || bit_offset > ((intn)BITNUM - 1)
+        || (bitfile_rec = HAatom_object(bitid)) == NULL
+        || byte_offset > bitfile_rec->max_offset)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* determine whether we need to seek to another block in the file */
+    new_block = (byte_offset < bitfile_rec->block_offset
+         || byte_offset >= bitfile_rec->block_offset + BITBUF_SIZE)
+        ? TRUE : FALSE;
+    if (bitfile_rec->mode == 'w')
+        if (HIbitflush(bitfile_rec, -1, new_block) == FAIL)     /* flush, but merge */
+            HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+
+    if (new_block == TRUE)
+      {
+          seek_pos = (byte_offset / BITBUF_SIZE) * BITBUF_SIZE;
+          if (Hseek(bitfile_rec->acc_id, seek_pos, DF_START) == FAIL)
+              HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+
+          read_size = MIN((bitfile_rec->max_offset - seek_pos), BITBUF_SIZE);
+          if ((n = Hread(bitfile_rec->acc_id, read_size, bitfile_rec->bytea)) == FAIL)
+              HRETURN_ERROR(DFE_READERROR, FAIL);   /* EOF? somebody pulled the rug out from under us! */
+          bitfile_rec->bytez = n + (bitfile_rec->bytep = bitfile_rec->bytea);
+          bitfile_rec->buf_read = n;    /* keep track of the number of bytes in buffer */
+          bitfile_rec->block_offset = seek_pos;
+          if (bitfile_rec->mode == 'w')     /* if writing, return the file offset to it's original position */
+              if (Hseek(bitfile_rec->acc_id, seek_pos, DF_START) == FAIL)
+                  HRETURN_ERROR(DFE_SEEKERROR, FAIL);
+      }     /* end if */
+
+    bitfile_rec->byte_offset = byte_offset;
+
+    /* set to the correct position in the buffer */
+    bitfile_rec->bytep = bitfile_rec->bytea + (byte_offset - bitfile_rec->block_offset);
+    if (bit_offset > 0)
+      {
+          bitfile_rec->count = ((intn)BITNUM - bit_offset);
+          if (bitfile_rec->mode == 'w')
+            {   /* if writing, mask off bits not yet written */
+                bitfile_rec->bits = *(bitfile_rec->bytep);
+                bitfile_rec->bits &= maskc[bit_offset] << bitfile_rec->count;
+            }   /* end if */
+          else
+            {
+                bitfile_rec->bits = *bitfile_rec->bytep++;
+            }   /* end else */
+      }     /* end if */
+    else
+      {
+          if (bitfile_rec->mode == 'w')
+            {   /* if writing, mask off bits not yet written */
+                bitfile_rec->count = BITNUM;
+                bitfile_rec->bits = 0;
+            }   /* end if */
+          else
+            {
+                bitfile_rec->count = 0;
+            }   /* end else */
+      }     /* end else */
+
+    return (SUCCEED);
+}   /* end Hbitseek() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hgetbit -- read 1 bit from a bit-element
+ USAGE
+       intn Hgetbit(bitid)
+       int32 bitid;         IN: id of bit-element to read from
+ RETURNS
+       the bit read in (0/1) on success, FAIL(-1) to indicate failure
+ DESCRIPTION
+       Read one bit from a bit-element.  This function is mostly a wrapper
+       around Hbitread.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hgetbit(int32 bitid)
+{
+    CONSTR(FUNC, "Hgetbit");    /* for HERROR */
+    uint32      data;
+
+    if (Hbitread(bitid, 1, &data) == FAIL)
+        HRETURN_ERROR(DFE_BITREAD, FAIL)
+            return ((intn) data);
+}   /* end Hgetbit() */
+
+#ifdef OLD_WAY
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hputbit -- write 1 bit to a bit-element
+ USAGE
+       intn Hputbit(bitid,bit)
+       int32 bitid;         IN: id of bit-element to read from
+       intn bit;            IN: bit to write
+ RETURNS
+       SUCCEED on success, FAIL(-1) to indicate failure
+ DESCRIPTION
+       Write one bit to a bit-element.  This function is mostly a wrapper
+       around Hbitwrite.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hputbit(int32 bitid, intn bit)
+{
+    CONSTR(FUNC, "Hputbit");    /* for HERROR */
+
+    if (Hbitwrite(bitid, 1, (uint32) bit) == FAIL)
+        HRETURN_ERROR(DFE_BITWRITE, FAIL)
+            return (SUCCEED);
+}   /* end Hputbit() */
+#endif /* OLD_WAY */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+       Hendbitaccess -- to dispose of a bitfile element
+ USAGE
+       int32 Hendbitaccess(bitfile_id,flushbit)
+       int32 bitfile_id;        IN: id of bitfile element to dispose of
+       intn flushbit;           IN: determines how to flush leftover bits
+                                   (leftover bits are bits that have been
+                                    buffered, but are less than the
+                                    BITNUM (usually set to 8) number of
+                                    bits)
+                                    0 - flush with zeros
+                                    1 - flush with ones
+                                   -1 - throw away any leftover bits
+ RETURNS
+       returns SUCCEED (0) if successful, FAIL (-1) otherwise
+ DESCRIPTION
+       Used to dispose of a bitfile element.  Flushes any buffered bits
+       to the dataset (if writing), and then calls Hendaccess.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+Hendbitaccess(int32 bitfile_id, intn flushbit)
+{
+    CONSTR(FUNC, "Hendbitaccess");  /* for HERROR */
+    bitrec_t   *bitfile_rec;    /* bitfile record */
+
+    /* check validity of access id */
+    bitfile_rec = HAatom_object(bitfile_id);
+    if (bitfile_rec == NULL)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    if (bitfile_rec->mode == 'w')
+        if (HIbitflush(bitfile_rec, flushbit, TRUE) == FAIL)
+            HRETURN_ERROR(DFE_WRITEERROR,FAIL);
+    HDfree((VOIDP) bitfile_rec->bytea);    /* free the space for the buffer */
+
+    if(HAremove_atom(bitfile_id)==NULL) 
+        HRETURN_ERROR(DFE_WRITEERROR,FAIL);
+    if(Hendaccess(bitfile_rec->acc_id)==FAIL)
+        HRETURN_ERROR(DFE_CANTENDACCESS,FAIL);
+    HDfree(bitfile_rec);
+
+    return (SUCCEED);
+}   /* end Hendbitaccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HIbitstart
+ PURPOSE
+    Bit I/O initialization routine
+ USAGE
+    intn HIbitstart()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    One-time initialization of the interface
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn HIbitstart(void)
+{
+    CONSTR(FUNC, "HIbitstart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Create the file ID and access ID groups */
+    if(HAinit_group(BITIDGROUP,16)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return(ret_value);
+} /* end HIbitstart() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+    HIbitflush -- flush the bits out to a writable bitfile
+ USAGE
+    intn HIbitflush(bitfile_rec,flushbit)
+        bitrec_t *bitfile_rec;  IN: record of bitfile element to flush
+        intn flushbit;          IN: determines how to flush leftover bits
+                                   (leftover bits are bits that have been
+                                    buffered, but are less than the
+                                    BITNUM (usually set to 8) number of
+                                    bits)
+                                    0 - flush with zeros
+                                    1 - flush with ones
+                                   -1 - throw away any leftover bits
+ RETURNS
+    returns SUCCEED (0) if successful, FAIL (-1) otherwise
+ DESCRIPTION
+    Used to flush the buffer of a bitfile element, preserving the bits
+    in the buffer which have not been modified.  The flushbits parameter
+    is only used when the last bits written to the element are at the
+    actual end of the dataset, not somewhere in the middle.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    This routine does _not_ leave the bitfile in a position to continue
+    I/O from the current point, additional modifications would have to be
+    made in order to accomodate this.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIbitflush(bitrec_t * bitfile_rec, intn flushbit, intn writeout)
+{
+    CONSTR(FUNC, "HIbitflush");
+    intn        write_size;     /* number of bytes to write out */
+
+    if (bitfile_rec->count < (intn)BITNUM)
+      {     /* check if there are any */
+          if (bitfile_rec->byte_offset > bitfile_rec->max_offset)
+            {
+                if (flushbit != (-1))   /* only flush bits if asked and there are bits to flush */
+                    if (Hbitwrite(bitfile_rec->bit_id, bitfile_rec->count, (uint32) (flushbit ? 0xFF : 0)) == FAIL)
+                        HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+            }   /* end if */
+          else
+            {   /* we are in the middle of a dataset and need to integrate */
+                /* mask off a place for the new bits */
+                *(bitfile_rec->bytep) &= (uint8)(~(maskc[(intn)BITNUM - bitfile_rec->count] << bitfile_rec->count));
+
+                /* merge in new bits */
+                *(bitfile_rec->bytep) |= bitfile_rec->bits;
+
+                bitfile_rec->bytep++;
+                bitfile_rec->byte_offset++;
+                
+                /* Update the offset in the buffer */
+                if (bitfile_rec->byte_offset > bitfile_rec->max_offset)
+                    bitfile_rec->max_offset = bitfile_rec->byte_offset;
+
+                bitfile_rec->count = BITNUM;    /* reset count */
+                bitfile_rec->bits=0;            /* reset bits */
+            }   /* end else */
+      }     /* end if */
+    if (writeout == TRUE)
+      {     /* only write data out if necessary */
+          write_size = (intn) MIN((bitfile_rec->bytez - bitfile_rec->bytea),bitfile_rec->max_offset);
+          if (write_size > 0)
+              if (Hwrite(bitfile_rec->acc_id, write_size, bitfile_rec->bytea) == FAIL)
+                  HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+      }     /* end if */
+
+    return (SUCCEED);
+}   /* HIbitflush */
+
+/*--------------------------------------------------------------------------
+ HIget_bitfile_rec - get a new bitfile record 
+--------------------------------------------------------------------------*/
+PRIVATE bitrec_t *
+HIget_bitfile_rec(void)
+{
+    CONSTR(FUNC, "HIget_bitfile_rec");
+    bitrec_t *ret_value=NULL;
+
+    ret_value = (bitrec_t *) HDcalloc(1, sizeof(bitrec_t));
+    if ((ret_value->bytea = (uint8 *) HDmalloc(BITBUF_SIZE)) == NULL)
+        HRETURN_ERROR(DFE_NOSPACE, NULL);
+
+    return ret_value;
+}   /* HIget_bitfile_rec */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+    HIread2write - switch from reading bits to writing them
+ USAGE
+    intn HIread2write(bitfile_rec)
+        bitrec_t *bitfile_rec;  IN: record of bitfile element to switch
+ RETURNS
+    returns SUCCEED (0) if successful, FAIL (-1) otherwise
+ DESCRIPTION
+    Used to switch a bitfile (which has 'w' access) from read mode to write
+    mode, at the same bit offset in the file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIread2write(bitrec_t * bitfile_rec)
+{
+    CONSTR(FUNC, "HIread2write");
+
+    bitfile_rec->block_offset = (int32)LONG_MIN;    /* set to bogus value */
+    bitfile_rec->mode = 'w';    /* change to write mode */
+    if (Hbitseek(bitfile_rec->bit_id, bitfile_rec->byte_offset, ((intn)BITNUM - bitfile_rec->count)) == FAIL)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+    return (SUCCEED);
+}   /* HIread2write */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+    HIwrite2read - switch from writing bits to reading them
+ USAGE
+    intn HIwrite2read(bitfile_rec)
+        bitrec_t *bitfile_rec;  IN: record of bitfile element to switch
+ RETURNS
+    returns SUCCEED (0) if successful, FAIL (-1) otherwise
+ DESCRIPTION
+    Used to switch a bitfile (which has 'w' access) from write mode to read
+    mode, at the same bit offset in the file.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIwrite2read(bitrec_t * bitfile_rec)
+{
+    CONSTR(FUNC, "HIwrite2read");
+    intn       prev_count = bitfile_rec->count;    /* preserve this for later */
+    int32       prev_offset = bitfile_rec->byte_offset;
+
+    if (HIbitflush(bitfile_rec, -1, TRUE) == FAIL)  /* flush any leftover bits */
+        HRETURN_ERROR(DFE_WRITEERROR, FAIL);
+
+    bitfile_rec->block_offset = (int32)LONG_MIN;    /* set to bogus value */
+    bitfile_rec->mode = 'r';    /* change to read mode */
+    if (Hbitseek(bitfile_rec->bit_id, prev_offset, ((intn)BITNUM - prev_count)) == FAIL)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+    return (SUCCEED);
+}   /* HIwrite2read */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HPbitshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn HPbitshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the Hbit routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn HPbitshutdown(void)
+{
+    /* Shutdown the file ID atom group */
+    HAdestroy_group(BITIDGROUP);
+
+    return(SUCCEED);
+} /* end HPbitshutdown() */
+
diff --git a/hdf/src/hbitio.h b/hdf/src/hbitio.h
new file mode 100644
index 0000000..e0a3c64
--- /dev/null
+++ b/hdf/src/hbitio.h
@@ -0,0 +1,85 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hbitio.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+   **  hbitio.h
+   **
+   **  Data structures and macros for bitfile access to HDF data objects.
+   **  These are mainly used for compression I/O and N-bit data objects.
+ */
+
+#ifndef __HBITIO_H
+#define __HBITIO_H
+
+/* Define the number of elements in the buffered array */
+#define BITBUF_SIZE 4096
+/* Macro to define the number of bits cached in the 'bits' variable */
+#define BITNUM      (sizeof(uint8)*8)
+/* Macro to define the number of bits able to be read/written at a time */
+#define DATANUM     (sizeof(uint32)*8)
+
+typedef struct bitrec_t
+  {
+      int32       acc_id;       /* Access ID for H layer I/O routines */
+      int32       bit_id;       /* Bitfile ID for internal use */
+  /* Note that since HDF has signed 32bit offset limit we need to change this to signed
+     since the get passed to Hxxx calls which take signed 32bit arguments */
+      int32      block_offset, /* offset of the current buffered block in the dataset */
+                 max_offset,   /* offset of the last byte written to the dataset */
+                 byte_offset;  /* offset of the current byte in the dataset */
+
+      intn       count,        /* bit count to next boundary */
+                 buf_read;     /* number of bytes read into buffer (necessary for random I/O) */
+      uint8       access;       /* What the access on this file is ('r', 'w', etc..) */
+      uint8       mode;         /* how are we interacting with the data now ('r', 'w', etc) */
+      uint8       bits;         /* extra bit buffer, 0..BITNUM-1 bits */
+      uint8      *bytep;        /* current position in buffer */
+      uint8      *bytez;        /* end of buffer to compare */
+      uint8      *bytea;        /* byte buffer */
+  }
+bitrec_t;
+
+#ifndef BITMASTER
+extern
+#endif
+const uint8 maskc[9]
+#ifdef BITMASTER
+=
+{0, 1, 3, 7, 15, 31, 63, 127, 255}
+#endif
+           ;
+
+#ifndef BITMASTER
+extern
+#endif
+const uint32 maskl[33]
+#ifdef BITMASTER
+=
+{0x00000000,
+ 0x00000001, 0x00000003, 0x00000007, 0x0000000f,
+ 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
+ 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
+ 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
+ 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
+ 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
+ 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
+ 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffffUL}
+#endif
+           ;
+
+/* Function-like Macros */
+#define Hputbit(bitid,bit) ((Hbitwrite(bitid,1,(uint32)bit)==FAIL) ? FAIL : SUCCEED)
+
+#endif /* __HBITIO_H */
diff --git a/hdf/src/hblocks.c b/hdf/src/hblocks.c
new file mode 100644
index 0000000..b0b04d5
--- /dev/null
+++ b/hdf/src/hblocks.c
@@ -0,0 +1,2031 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6026 $";
+#endif
+
+/* $Id: hblocks.c 6026 2014-01-16 15:16:16Z bmribler $ */
+
+/*LINTLIBRARY */
+/* ------------------------------ hblocks.c -------------------------------
+   routines to implement linked-block elements
+
+   Linked element in HDF files created in two ways
+   -- created from the start or
+   -- converted from a normal data element
+
+   A linked-block element is a special element.
+
+   Special elements are
+   flagged with a set high-bit in their tag.  Thus, a tag t has
+   BASETAG == t & 0x7f and is a special tag if t & 0x80 != 0x00
+
+   The first 16 bits of the meta-element that this tag/ref points to
+   tells us what type of special element this is.  If these 16 bits is
+   SPECIAL_LINKED, then it contains information about the linked blocks.
+   After this 16 bits, 32 bit which is the length of each block, after
+   which is the information header:
+
+   ----------------------------------------------------------------------
+   | # blocks in | tag/ref of | tag/ref of blocks list .......          |
+   | this header | next header|                                         |
+   ----------------------------------------------------------------------
+
+   File Description of Linked Block Element
+   ****************************************
+   DD for Linked Block pointing to Linked Block Description Record
+   ==============================================================
+   <-  2 bytes -> <- 2 bytes -> <- 4 bytes -> <- 4bytes ->
+   --------------------------------------------------------
+   |extended tag | reference # |  Offset     |  Length    |
+   --------------------------------------------------------
+                                    \______________/
+   __________________________________________|
+   V
+   LINKED BLOCK DESCRIPTION RECORD(LBDR - 16 bytes)
+   ===============================================
+   <-  2 bytes -> <- 4 bytes  -> <- 4 bytes -> <- 4 bytes -> <- 2 bytes ->
+   ---------------------------------------------- ------------------------
+   |ext_tag_desc | elem_tot_len | blk_length  |   num_blk   | link_ref   |
+   ---------------------------------------------- ------------------------
+    
+
+   ext_tag_desc   - SPECIAL_LINKED(16 bit constant), identifies this as
+                    a linked block description record
+   elem_tot_len   - Length of the entire element(32 bit field)
+   blk_length     - Length of successive data blocks(32 bit field) after first block,
+			first block is calculated.
+   num_blk        - Number of blocks per block table(32 bit field)
+   link_ref       - Reference number of the first block table(16 bit field)
+
+   Linked Block Table(12 + 2 + 2 + 2 + 2 + ... bytes)
+   ===================================================
+   <-  2 bytes -> <- 2 bytes -> <- 4 bytes -> <- 4bytes ->
+   --------------------------------------------------------
+   |link_blk_tag | link_ref    |  Offset     |  Length    |
+   --------------------------------------------------------
+                                    \______________/
+   __________________________________________|
+   V
+   <-  2 bytes -> <- 2 bytes -> <- 2 bytes -> <- 2 bytes -> <-...
+   -----------------------------------------------------------...
+   | next_ref    | block_ref_1 | block_ref_2 | block_ref_3 |  ...
+   -----------------------------------------------------------...
+    
+   link_blk_tag   - DFTAG_LINKED(16 bit)
+   link_ref       - Reference number for this table(16 bit)
+   next_ref       - Reference number for next block table(16 bit)
+                    Zero(0) signifies no more block tables for this element.
+   blk_ref_x      - Reference number for data block X (16 bit). 
+                  e.g. for data block 1
+                  <-  2 bytes ->  <- 2 bytes -> <- 4 bytes -> <- 4bytes ->
+                  --------------------------------------------------------
+                  | DFTAG_LINKED | block_ref_1 |  Offset     |  Length    |
+                  --------------------------------------------------------
+                                                    \______________/
+                  __________________________________________|
+                  V
+                  -----------------------
+                  | Data_block          |
+                  -----------------------
+                  Note: The "Length" here is specified by either 
+                        "elem_first_len" or "blk_length".
+
+   For now, HLcreate() has the best description of what the on-disk
+   representation of a linked block element looks like.
+
+EXPORTED ROUTINES
+
+   HLcreate       -- create a linked block element
+   HLconvert      -- convert an AID into a linked block element
+   HLgetdatainfo  -- get data information of linked blocks
+   HDinqblockinfo -- return info about linked blocks
+   HLPstread      -- open an access record for reading
+   HLPstwrite     -- open an access record for writing
+   HLPseek        -- set the seek posn
+   HLPread        -- read some data out of a linked block element
+   HLPwrite       -- write out some data to a linked block
+   HLPinquire     -- Hinquire for linked blocks
+   HLPendacess    -- close a linked block AID
+   HLPinfo        -- return info about a linked block element
+LOCAL ROUTINES
+   HLIstaccess -- set up AID to access a linked block elem
+   HLIgetlink  -- get link information
+   HLInewlink  -- write out some data to a linked block
+*/
+
+#include "hdf.h"
+#include "hfile.h"
+
+/* block_t - record of a linked block. contains the tag and ref of the
+   data elt that forms the linked block */
+typedef struct block_t
+{
+    uint16      ref;          /* ref of the linked block */
+}
+block_t;
+
+/* link_t - a linked list block table.
+   Very similar to the dd block structure */
+typedef struct link_t
+{
+    uint16          nextref;   /* ref of the next block table */
+    struct link_t  *next;      /* ptr to the next block table */
+    struct block_t *block_list;/* ptr to the block list for this table */
+}
+link_t;
+
+/* information on this special linked block data elt */
+typedef struct linkinfo_t
+{
+    int      attached;     /* how many access records refer to this elt */
+    int32    length;       /* the actual length of the data elt */
+    int32    first_length; /* length of first block */
+    int32    block_length; /* the length of the remaining blocks */
+    int32    number_blocks;/* total number of blocks in each link/block table */
+    uint16   link_ref;     /* ref of the first block table structure */
+    link_t  *link;         /* pointer to the first block table */
+    link_t  *last_link;    /* pointer to the last block table */
+}
+linkinfo_t;
+
+/* private functions */
+PRIVATE int32 HLIstaccess(accrec_t *access_rec, 
+                          int16     acc_mode);
+
+PRIVATE link_t *HLInewlink(int32  file_id, 
+                           int32  number_blocks, 
+                           uint16 link_ref, 
+                           uint16 first_block_ref);
+
+PRIVATE link_t *HLIgetlink(int32  file_id, 
+                           uint16 ref, 
+                           int32  number_blocks);
+
+/* the accessing function table for linked blocks */
+funclist_t  linked_funcs =
+{
+    HLPstread,
+    HLPstwrite,
+    HLPseek,
+    HLPinquire,
+    HLPread,
+    HLPwrite,
+    HLPendaccess,
+    HLPinfo,
+    NULL         /* no routine registered */
+};
+
+/* ------------------------------------------------------------------------
+NAME
+   HLcreate -- create a linked block element
+USAGE
+   int32 HLcreate(fid, tag, ref, blocklen, numblocks)
+   int32   fid;         IN: file to put linked block element in
+   uint16  tag;         IN: tag of element
+   uint16  ref;         IN: ref of element
+   int32   blocklen;    IN: length of standard block
+   int32   numblocks;   IN: number of blocks per block list
+RETURNS
+   The AID of newly created linked block element, FAIL on error.
+DESCRIPTION
+   This routine takes an HDF element and promotes it into a linked
+   block element.  Basically, the element becomes a linked list
+   allowing easy appending.  If the element already exists, it
+   is promoted to being a linked block element, otherwise a new
+   element is created.
+
+   All of the pieces of the linked list are the same size (blocklen)
+   except for the first one which stays the size of the element
+   at the time HLcreate was called.
+
+   numblocks gives the number of linked list objects in each
+   block header.
+
+   The ideal setting for numblocks and blocklen are very data
+   and application depedent.
+
+ --------------------------------------------------------------------------- */
+int32
+HLcreate(int32  file_id, 
+         uint16 tag, 
+         uint16 ref, 
+         int32  block_length,
+         int32  number_blocks)
+{
+    CONSTR(FUNC, "HLcreate");   /* for HERROR */
+    filerec_t  *file_rec;       /* file record */
+    accrec_t   *access_rec=NULL;/* access record */
+    int32       dd_aid;         /* AID for writing the special info */
+    linkinfo_t *info = NULL;   /* information for the linked blocks elt */
+    uint16      link_ref;       /* the ref of the link structure
+                                   (block table) */
+    atom_t      data_id;        /* dd ID of existing regular element */
+    uint16      new_data_tag, new_data_ref=0;  /* Tag/ref of the new data in the file */
+    int32       data_len;		/* length of the data we are checking */
+    int32       data_off;		/* offset of the data we are checking */
+    uint16      special_tag;    /* special version of this tag */
+    uint8       local_ptbuf[16];
+    int32       ret_value = SUCCEED;
+
+    /* clear error stack and validate file record id */
+    HEclear();
+    file_rec = HAatom_object(file_id);
+
+    /* check args and create special tag */
+    if (BADFREC(file_rec) || block_length < 0 || number_blocks < 0
+        || SPECIALTAG(tag)
+        || (special_tag = MKSPECIALTAG(tag)) == DFTAG_NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* make sure write access to file */
+    if (!(file_rec->access & DFACC_WRITE))
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+
+    /* get empty access record */
+    access_rec = HIget_access_rec();
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_TOOMANY, FAIL);
+
+    /* search for identical dd */
+    if ((data_id = HTPselect(file_rec,tag,ref))!=FAIL)
+      {
+          /* Check if the element is already special */
+          if (HTPis_special(data_id)==TRUE)
+            {
+                HTPendaccess(data_id);
+                HGOTO_ERROR(DFE_CANTMOD, FAIL);
+            }   /* end if */
+
+          /* If the data already was in the file, 
+           * convert it into the first linked block 
+           * get the info for the dataset */
+          if(HTPinquire(data_id,NULL,NULL,&data_off,&data_len)==FAIL)
+            {
+                HTPendaccess(data_id);
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            } /* end if */
+
+          if(data_off == INVALID_OFFSET || data_len==INVALID_LENGTH)
+            { /* data object which has been created, but has no data */
+              /* Delete the old data ID */
+              if(HTPdelete(data_id)==FAIL)
+                  HGOTO_ERROR(DFE_CANTDELHASH, FAIL);
+
+              data_id=FAIL; /* reset this so the first block is a "regular" fixed length block */
+            } /* end if */
+          else
+            {   /* existing data object with real data in it */
+              new_data_tag = DFTAG_LINKED;
+              new_data_ref = Htagnewref(file_id,new_data_tag);
+              /* create new linked-block table DD to point to existing data */
+              if(Hdupdd(file_id, new_data_tag, new_data_ref, tag, ref)==FAIL)
+                {
+                    HTPendaccess(data_id);
+                    HGOTO_ERROR(DFE_CANTUPDATE, FAIL);
+                } /* end if */
+
+              /* Delete the old data ID */
+              if(HTPdelete(data_id)==FAIL)
+                  HGOTO_ERROR(DFE_CANTDELHASH, FAIL);
+
+              /* Attach to the new data ID */
+              if ((data_id = HTPselect(file_rec,new_data_tag,new_data_ref))==FAIL)
+                  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            } /* end else */
+      } /* end if */
+
+    /* get ref for next linked-block? */
+    link_ref = Htagnewref(file_id,DFTAG_LINKED);
+
+    /* allocate and fill special info struct */
+    if (( info = (linkinfo_t *) HDmalloc((uint32) sizeof(linkinfo_t)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    info->attached     = 1;
+    info->length       = (data_id!=FAIL) ? data_len : 0;
+    info->first_length = (data_id!=FAIL) ? data_len : block_length;
+    info->block_length = block_length;
+    info->number_blocks = number_blocks;
+    info->link_ref      = link_ref;
+
+    /* encode special information for writing to file */
+    {
+        uint8      *p;
+        p = local_ptbuf;
+        UINT16ENCODE(p, SPECIAL_LINKED);
+        INT32ENCODE(p, info->length);
+        INT32ENCODE(p, block_length);
+        INT32ENCODE(p, number_blocks);
+        UINT16ENCODE(p, link_ref);  /* link_ref */
+    }
+
+    /* write the special info structure */
+    if((dd_aid = Hstartaccess(file_id,special_tag,ref,DFACC_ALL))==FAIL)
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+    if (Hwrite(dd_aid, 16, local_ptbuf) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+    if(Hendaccess(dd_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    /* write out linked block */
+    info->link = HLInewlink(file_id, number_blocks, link_ref,
+                            (uint16) ((data_id!=FAIL) ? new_data_ref : 0));
+    if (!info->link)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Detach from the data DD ID */
+    if(data_id != FAIL)
+      {
+        if(HTPendaccess(data_id)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+
+    /* update access record and file record */
+    if((access_rec->ddid=HTPselect(file_rec,special_tag,ref))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    access_rec->special_func = &linked_funcs;
+    access_rec->special_info = (void *)info;
+    access_rec->special      = SPECIAL_LINKED;
+    access_rec->posn         = 0;
+    access_rec->access       = DFACC_RDWR;
+    access_rec->file_id      = file_id;
+    access_rec->appendable   = FALSE;     /* start data as non-appendable */
+
+    file_rec->attach++; /* increment number of elements attached to file */
+
+    /* set return value */
+    ret_value = HAregister_atom(AIDGROUP,access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if (info != NULL)
+            HDfree(info);
+        if(access_rec!=NULL)
+            HIrelease_accrec_node(access_rec);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* HLcreate() */
+
+/* ------------------------------------------------------------------------
+NAME
+   HLconvert -- convert an AID into a linked block element
+USAGE
+   intn HLconvert(aid, blocklen, numblocks)
+   int32   aid;         IN: AID to convert
+   int32   blocklen;    IN: length of standard block
+   int32   numblocks;   IN: number of blocks per block list
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   This routine takes an HDF element and promotes it into a linked
+   block element.  Basically, the element becomes a linked list
+   allowing easy appending.  If the element already exists, it
+   is promoted to being a linked block element, otherwise a new
+   element is created.
+
+   All of the pieces of the linked list are the same size (blocklen)
+   except for the first one which stays the size of the element
+   at the time HLcreate was called.
+
+   This routine is similar to HLcreate but is used to convert an
+   existing AID into a linked block element "in-place".  This is
+   done for convenience and ease-of-use mostly internally to the
+   library in various places, but it is allowable for user-level
+   code to do this also.
+
+   Hopefully HLcreate will get re-written to call this routine for
+   most of it's work...
+
+   numblocks gives the number of linked list objects in each
+   block header.
+
+   The ideal setting for numblocks and blocklen are very data
+   and application depedent.
+
+---------------------------------------------------------------------------*/
+intn
+HLconvert(int32 aid, 
+          int32 block_length, 
+          int32 number_blocks)
+{
+    CONSTR(FUNC, "HLconvert");  /* for HERROR */
+    filerec_t  *file_rec;       /* file record */
+    accrec_t   *access_rec=NULL;/* access record */
+    linkinfo_t *info;           /* information for the linked blocks elt */
+    uint16      link_ref;       /* the ref of the link structure
+                                   (block table) */
+    int32       dd_aid;         /* AID for writing the special info */
+    uint16      new_data_tag=DFTAG_NULL, new_data_ref=0;  /* Tag/ref of the new data in the file */
+    uint16      data_tag, data_ref;  /* Tag/ref of the data in the file */
+    int32       data_len;		/* length of the data we are checking */
+    int32       data_off;		/* offset of the data we are checking */
+    uint16      special_tag;    /* special version of this tag */
+    int32       file_id;        /* file ID for the access record */
+    uint8       local_ptbuf[16];
+    int32       old_posn;       /* position in the access element */
+    intn        ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* start checking the func. args */
+    if (HAatom_group(aid)!=AIDGROUP || block_length < 0 || number_blocks < 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get the access_rec pointer */
+    if ((access_rec = HAatom_object(aid)) == NULL)    
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    file_id = access_rec->file_id;
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (!(file_rec->access & DFACC_WRITE))
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+
+    /* verify that the object is not already special. Can not convert
+       if already special.  */
+    if (HTPis_special(access_rec->ddid))
+        HGOTO_ERROR(DFE_CANTMOD, FAIL);
+
+    /* Save previous position in data element so that we can come back to it */
+    old_posn=access_rec->posn;
+
+    /* get the info for the dataset */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,&data_off,&data_len)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* make data tag special i.e. will be linked-block element */
+    if ((special_tag = MKSPECIALTAG(data_tag)) == DFTAG_NULL)
+        HGOTO_ERROR(DFE_BADDDLIST, FAIL);
+
+    /* is data defined but does not exist in the file? */
+    if(data_off==INVALID_OFFSET && data_len==INVALID_LENGTH)
+      { /* catch the case where the data doesn't exist yet */
+
+          /* set length to zero */
+        if(Hsetlength(aid,0)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* get back new offset and length */
+        if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,&data_off,&data_len)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      } /* end if */
+      
+    /* set up new tag/ref for linked block element */
+    new_data_tag = DFTAG_LINKED;
+    new_data_ref = Htagnewref(file_id,new_data_tag);
+
+    /* make new tag/ref point to existing data element */
+    if(Hdupdd(file_id, new_data_tag, new_data_ref, data_tag, data_ref)==FAIL)
+        HGOTO_ERROR(DFE_CANTUPDATE, FAIL);
+
+    /* Delete the old data ID */
+    if(HTPdelete(access_rec->ddid)==FAIL)
+        HGOTO_ERROR(DFE_CANTDELHASH, FAIL);
+
+    /* Attach to the new data ID */
+    if ((access_rec->ddid=HTPcreate(file_rec,special_tag,data_ref))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* get link ref for linked-block ? */
+    link_ref = Htagnewref(file_id,DFTAG_LINKED);
+
+    /* allocates special info struct for linked blocks */
+    access_rec->special_info = HDmalloc((uint32) sizeof(linkinfo_t));
+    if (!access_rec->special_info)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* fill in special info struct */
+    info = (linkinfo_t *) access_rec->special_info;
+    info->attached     = 1;
+    info->length       = data_len;
+    info->first_length = data_len;
+    info->block_length = block_length;
+    info->number_blocks = number_blocks;
+    info->link_ref = link_ref;
+
+    /* Get ready to fill and write the special info structure  */
+
+    /* start write access on special tag/ref */
+    if((dd_aid=Hstartaccess(file_id,special_tag,data_ref,DFACC_ALL))==FAIL)
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+
+    /* encode special information to write out */
+    {
+        uint8      *p;
+
+        p = local_ptbuf;
+        UINT16ENCODE(p, SPECIAL_LINKED);
+        INT32ENCODE(p, info->length);
+        INT32ENCODE(p, block_length);
+        INT32ENCODE(p, number_blocks);
+        UINT16ENCODE(p, link_ref);  /* link_ref */
+    }
+
+    /* write out special information */
+    if (Hwrite(dd_aid, 16, local_ptbuf) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+    if(Hendaccess(dd_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    /* write out linked block */
+    if ((info->link = HLInewlink(file_id, number_blocks, link_ref, (uint16)new_data_ref)) ==NULL)
+        HGOTO_ERROR(DFE_CANTLINK, FAIL);
+
+    /* update access record and file record */
+    access_rec->special_func = &linked_funcs;
+    access_rec->special = SPECIAL_LINKED;
+    access_rec->appendable = FALSE;     /* start data as non-appendable */
+
+    /* check whether we should seek out to the proper position */
+    if(old_posn>0)
+      {
+        if(Hseek(aid,old_posn,DF_START)==FAIL)
+              HGOTO_ERROR(DFE_BADSEEK, FAIL);
+      } /* end if */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(access_rec->special_info != NULL)
+            HDfree(access_rec->special_info);
+        if(access_rec!=NULL)
+            HIrelease_accrec_node(access_rec);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HLconvert() */
+
+/* ---------------------------- HDinqblockinfo ---------------------------- */
+/*
+NAME
+   HDinqblockinfo -- return info about linked blocks
+USAGE
+   int32 HDinqblockinfo(aid, length, flength, blen, nblocks)
+   int32   aid;          IN:  aid of element
+   int32 * length;       OUT: total element length
+   int32 * flength;      OUT: length of first element
+   int32 * blen;         OUT: length of block elements
+   int32 * nblocks;      OUT: number of blocks per block header
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Given an aid, return low level special info for linked-block
+   element in space provided.  This function works like HDinquire()
+   but provides more low level info than HLPinquire.  NULL can
+   be passed for any non-interesting entries.
+
+   hdfpack is the only application that I know of which uses
+   this function.
+
+---------------------------------------------------------------------------*/
+int
+HDinqblockinfo(int32 aid, 
+               int32 *length, 
+               int32 *first_length,
+               int32 *block_length, 
+               int32 *number_blocks)
+{
+    accrec_t   *arec;
+    int        ret_value = SUCCEED;
+    CONSTR(FUNC, "HDinqblockinfo");
+
+    HEclear();
+    if ((arec = HAatom_object(aid)) == (accrec_t *) NULL)
+        HGOTO_ERROR(DFE_BADAID, FAIL);
+
+    if (arec->special != SPECIAL_LINKED)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (length)
+        *length = ((linkinfo_t *) (arec->special_info))->length;
+    if (first_length)
+        *first_length = ((linkinfo_t *) (arec->special_info))->first_length;
+    if (block_length)
+        *block_length = ((linkinfo_t *) (arec->special_info))->block_length;
+    if (number_blocks)
+        *number_blocks = ((linkinfo_t *) (arec->special_info))->number_blocks;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HDinqblockinfo */
+
+/* ----------------------------- HLIstaccess ------------------------------ */
+/*
+NAME
+   HLIstaccess -- set up AID to access a linked block elem
+USAGE
+   int32 HLIstaccess(access_rec, acc_mode)
+   access_t * access_rec;   IN: access record to fill in
+   int16      acc_mode;     IN: access mode
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   Calls to HLIstread and HLIstwrite resolve to this function.
+   Given an active AID fill in all of the special information.
+   If this information has already been read in for a different
+   element use that else we must go out to the HDF file and
+   pull in the information ourselves
+
+----------------------------------------------------------------------------*/
+PRIVATE int32
+HLIstaccess(accrec_t *access_rec, 
+            int16     acc_mode)
+{
+    CONSTR(FUNC, "HLIstaccess");    /* for HERROR */
+    filerec_t  *file_rec;       /* file record */
+    linkinfo_t *info = NULL;           /* information about data elt */
+    int32       dd_aid;         /* AID for writing the special info */
+    uint16      data_tag, data_ref;  /* Tag/ref of the data in the file */
+    uint8       local_ptbuf[14];
+    int32       ret_value = SUCCEED;
+
+    /* validate file record id */
+    file_rec = HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec) || !(file_rec->access & acc_mode))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* set up some data in access record */
+    access_rec->special = SPECIAL_LINKED;
+    access_rec->posn = 0;
+    access_rec->access = (uint32)(acc_mode|DFACC_READ);
+
+    /*
+     * Lets free old special info first,if one exists,
+     * before copying a new one
+     */
+    if (access_rec->special_info != NULL)
+      {   /* special information record */
+          linkinfo_t *t_info = (linkinfo_t *) access_rec->special_info;
+
+          if (--(t_info->attached) == 0)
+            {
+                link_t     *t_link; /* current link to free */
+                link_t     *next;   /* next link to free */
+
+                /* free the linked list of links/block tables */
+                if(t_info->link!=NULL)
+                  {
+                    for (t_link = t_info->link; t_link; t_link = next)
+                      {
+                          next = t_link->next;
+                          if(t_link->block_list!=NULL)
+                              HDfree(t_link->block_list);
+                          HDfree(t_link);
+                      }
+                  } /* end if */
+                HDfree(t_info);
+                access_rec->special_info = NULL;
+            }
+      }
+
+    /* get the info for the dataset */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,NULL,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* if the special information are already in some other acc elt,
+     * point to it */
+    access_rec->special_info = HIgetspinfo(access_rec);
+    if (access_rec->special_info)
+      {
+          ((linkinfo_t *) access_rec->special_info)->attached++;
+          file_rec->attach++;
+          ret_value = HAregister_atom(AIDGROUP,access_rec);
+          goto done; /* we are done */
+      }
+
+    /* read the special info structure from the file */
+    if((dd_aid = Hstartaccess(access_rec->file_id,data_tag,data_ref,DFACC_READ))==FAIL)
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+    if (Hseek(dd_aid, 2, DF_START) == FAIL)
+        HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+    if (Hread(dd_aid, 14, local_ptbuf) == FAIL)
+        HGOTO_ERROR(DFE_READERROR, FAIL);
+    if(Hendaccess(dd_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    /* allocate space for special information */
+    access_rec->special_info = HDmalloc((uint32) sizeof(linkinfo_t));
+    info = (linkinfo_t *) access_rec->special_info;
+    if (!info)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* decode special information retrieved from file into info struct */
+    {
+        uint8      *p = local_ptbuf;
+        INT32DECODE(p, info->length);
+        INT32DECODE(p, info->block_length);
+        INT32DECODE(p, info->number_blocks);
+        UINT16DECODE(p, info->link_ref);
+    }
+
+    /* get the block length and number of blocks */
+    access_rec->block_size = info->block_length;
+    access_rec->num_blocks = info->number_blocks;
+
+    /* set up the block tables of the information */
+    info->link = HLIgetlink(access_rec->file_id,
+                            info->link_ref, info->number_blocks);
+    if (!info->link)
+        HGOTO_DONE(FAIL);
+
+    /* find and set the length of the first linked-block */
+    if (info->link->block_list[0].ref)
+      {
+          info->first_length = Hlength(access_rec->file_id, DFTAG_LINKED,
+                                       info->link->block_list[0].ref);
+          if (info->first_length == FAIL)
+            {
+                HDfree(info->link);
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            }
+      }
+    else
+        info->first_length = info->block_length;
+
+    /* process through all the linked-blocks in the file for this element */
+    info->last_link = info->link;
+    while (info->last_link->nextref != 0)
+      {
+          info->last_link->next = HLIgetlink(access_rec->file_id,
+                 info->last_link->nextref, info->number_blocks);
+          if (!info->last_link->next)
+            {
+                link_t     *l, *next;
+
+                for (l = info->link; l; l = next)
+                  {
+                      next = l->next;
+                      if (l->block_list)
+                          HDfree(l->block_list);
+                      HDfree(l);
+                  }
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            }
+          info->last_link = info->last_link->next;
+      }
+
+    /* update data */
+    info->attached = 1;
+
+    file_rec->attach++; /* increment number of elements attached to file */
+
+    ret_value = HAregister_atom(AIDGROUP,access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(access_rec->special_info != NULL)
+            HDfree(access_rec->special_info);
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HLIstaccess */
+
+/* ----------------------------- HLgetdatainfo --------------------------- */
+/*
+NAME
+   HLgetdatainfo -- get data information from linked blocks
+USAGE
+   int32 HLgetdatainfo(file_id, link_ref, num_blocks, offsetarray, lengtharray)
+   int32  file_id;	IN: the file
+   uint8 *buf;		IN: special header info read from the file by caller
+   uintn start_block,   IN: data block to start at, 0 base
+   uintn info_count,    IN: size of offset/length lists
+   int32 *offsetarray;	OUT: offsets of data blocks
+   int32 *lengtharray;	OUT: lengths of data blocks
+RETURNS
+   The number of actual data blocks, if successful, FAIL, otherwise
+DESCRIPTION
+   HLgetdatainfo uses HLIgetlink to get each block table in the element.
+   We're looking for actual data blocks which have a positive reference number.
+   Blocks with ref# as 0 will signal the end of the actual data blocks.
+   HLgetdatainfo goes through the block table to record offset and length of
+   the actual data blocks.
+   Aug 08, 2010 -BMR
+TODO
+   - No effect from start_block yet; since it's not used in the HDF Mapping
+     project, and we're running out of time, I'm leaving it out.
+     Feb 18, 2011 -BMR
+---------------------------------------------------------------------------*/
+intn
+HLgetdatainfo(int32 file_id,
+           uint8 *buf, 		   /* IN: special header info */
+           uintn start_block,      /* IN: data block to start at, 0 base */
+           uintn info_count,       /* IN: size of offset/length lists */
+	   int32 *offsetarray,     /* OUT: array to hold offsets */
+	   int32 *lengtharray)     /* OUT: array to hold lengths */
+{
+    CONSTR(FUNC, "HLgetdatainfo");	/* for HERROR */
+    link_t *link_info=NULL;  /* link information, to get block ref#s*/
+    intn    num_data_blocks; /* number of blocks that actually have data */
+    uint16  link_ref;        /* ref# pointing to a block table */
+    uint8  *p=NULL;          /* pointer to special info buffer */
+    int32   num_blocks,      /* number of blocks in each table */
+            block_length,    /* length of each block */
+            total_length,    /* total data length of the element */
+            accum_length;    /* accummulative length of actual data in blocks */
+    int     ii;
+    intn   ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate arguments */
+    if (info_count == 0 && offsetarray != NULL && lengtharray != NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Decode special information retrieved from file */
+    p = &buf[0];
+    INT32DECODE(p, total_length);
+    INT32DECODE(p, block_length);
+    INT32DECODE(p, num_blocks);     /* get number of blocks in link table */
+    UINT16DECODE(p, link_ref);      /* get ref# link table */
+
+    /* Initialize number of actual data blocks and the accumulative data len */
+    num_data_blocks = 0;
+    accum_length = 0;
+
+    /* Get the block table pointed to by link_ref; the table contains ref#s of
+       the blocks */
+    link_info = HLIgetlink(file_id, link_ref, num_blocks);
+    if (!link_info) /* no data */
+        HGOTO_DONE(FAIL);
+
+    /* Go through all the linked-block tables of this element, as long as the
+       number of data blocks being collected has not reached the maximum length
+       of the non-NULL arrays provided */
+    while (link_info != NULL &&
+	(info_count == 0 ||	/* case of offset/length arrays being NULL */
+	 num_data_blocks < info_count))
+    {
+        uint16 next_ref = link_info->nextref; /* shortcut */
+
+        /* Get offset/length of blocks that actually point to a data elem,
+           until all blocks in this table with valid ref#s are processed */
+        for (ii = 0; ii < num_blocks && link_info->block_list[ii].ref != 0;ii++)
+	{
+            int32 offset, length;
+            uint16 block_ref = link_info->block_list[ii].ref; /* shortcut */
+
+            /* If this block has a valid ref# then get the offset/length of
+               the data if they are requested, and increment the number of
+	       data blocks */
+            if (block_ref != 0)
+            {
+                if (offsetarray != NULL)
+		{
+                    offset = Hoffset(file_id, DFTAG_LINKED, block_ref);
+                    if (offset == FAIL)
+                        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                    offsetarray[num_data_blocks] = offset;
+                }
+                if (lengtharray != NULL)
+		{
+                    length = Hlength(file_id, DFTAG_LINKED, block_ref);
+                    if (length == FAIL)
+                        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    
+                    /* Make sure to detect when the last block of the element is
+		       reached and calculate the len of the actual data in it */
+
+		    /* Continue accumulating data length if there is
+		       another block table coming */
+                    if (next_ref != 0)
+                        accum_length = accum_length + length;
+
+		    /* When no more block table following this one, i.e., this
+                       is the last block table in the element */
+                    else
+                    {
+		        /* if this is NOT the last block having data in the
+                           current table, continue accumulating */
+                        if (ii < num_blocks - 1 && link_info->block_list[ii + 1].ref != 0)
+                            accum_length = accum_length + length;
+
+			/* else, i.e., this is the last block in the curr table,
+			      or the last block that points to actual data */
+                        else
+                        {
+			    /* then calculate the data's actual length when the
+                               length is the same as the default block length,
+                               because it might not be */
+                            if (length == block_length)
+                                length = total_length - accum_length;
+                        }
+                    }
+                    /* Record the actual data length in the current block */
+                    lengtharray[num_data_blocks] = length;
+                }
+                num_data_blocks++; /* count number of blocks with data */
+            }
+        } /* for each block in the current table */
+
+        /* Free allocated memory before getting the next block table if
+	   there is one */
+        if (link_info != NULL)
+        {
+            if (link_info->block_list != NULL)
+                HDfree(link_info->block_list);
+            HDfree(link_info);
+            link_info = NULL;
+        }
+	/* Get next block table */
+        if (next_ref != 0)
+            link_info = HLIgetlink(file_id, next_ref, num_blocks);
+    } /* while there are more linked-block tables and the offset/length arrays
+	 are not full yet */
+
+    /* Return the number of blocks with actual data */
+    ret_value = num_data_blocks;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(link_info != NULL)
+            if (link_info->block_list != NULL)
+                HDfree(link_info->block_list);
+            HDfree(link_info);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* HLgetdatainfo */
+
+/* ------------------------------ HLPstread ------------------------------- */
+/*
+NAME
+   HLPstread -- open an access record for reading
+USAGE
+   int32 HLPstread(access_rec)
+   access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   Calls to HLIstaccess to fill in the access rec for
+   reading
+
+---------------------------------------------------------------------------*/
+int32
+HLPstread(accrec_t * access_rec)
+{
+  int32 ret_value;
+
+  ret_value = HLIstaccess(access_rec, DFACC_READ);
+
+  return ret_value;
+}   /* HLPstread */
+
+/* ------------------------------ HLPstwrite ------------------------------- */
+/*
+NAME
+   HLPstwrite -- open an access record for writing
+USAGE
+   int32 HLPstwrite(access_rec)
+   access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   Calls to HLIstaccess to fill in the access rec for
+   writing
+
+---------------------------------------------------------------------------*/
+int32
+HLPstwrite(accrec_t * access_rec)
+{
+  int32  ret_value;
+
+  ret_value = HLIstaccess(access_rec, (int16)DFACC_WRITE);
+
+  return ret_value;
+}   /* HLPstwrite */
+
+/* ------------------------------ HLIgetlink ------------------------------ */
+/*
+NAME
+   HLIgetlink -- get link information
+USAGE
+   link_t * HLIgetlink(fid, ref, num_blocks)
+   int32  file_id;             IN: the file
+   uint16 ref;                 IN: ref number of the link table
+   int32  num_blocks;          IN: number of blocks in the table
+RETURNS
+   A pointer to a link_t or NULL.
+DESCRIPTION
+   Read a block table out of the file and return a pointer to
+   the internal table representing it.
+
+   It seems that num_blocks is redundant.
+
+---------------------------------------------------------------------------*/
+PRIVATE link_t *
+HLIgetlink(int32  file_id, 
+           uint16 ref, 
+           int32  number_blocks)
+{
+    CONSTR(FUNC, "HLIgetlink");     /* for HERROR */
+    int32    access_id;      /* access record id */
+    uint8    *buffer = NULL;
+    uint16   tag     = DFTAG_LINKED;
+    link_t   *new_link  = NULL;
+    link_t   *ret_value = NULL; /* FAIL */
+
+    /* allocate necessary memory for in-memory block table */
+    new_link = (link_t *) HDmalloc((uint32) sizeof(link_t));
+
+    if (new_link == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    new_link->block_list = (block_t *) HDmalloc((uint32) number_blocks
+                                                  * sizeof(block_t));
+    if (new_link->block_list == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    new_link->next = (link_t *) NULL;
+
+    /* create temp buffer to read block table in */
+    buffer = (uint8 *) HDmalloc((uint32) (2 + 2 * number_blocks));
+    if (buffer == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    /* read block table into buffer */
+    access_id = Hstartread(file_id, tag, ref);
+    if (access_id == FAIL ||
+        Hread(access_id, 2 + 2 * number_blocks, buffer) == FAIL)
+        HGOTO_ERROR(DFE_READERROR, NULL);
+
+    /* decode block table information read from file */
+    {
+        int32 i;
+        uint8      *p = buffer;
+
+        UINT16DECODE(p, new_link->nextref);
+        for (i = 0; i < number_blocks; i++)
+            UINT16DECODE(p, new_link->block_list[i].ref);
+    }
+
+    /* end acces to this block table */
+    Hendaccess(access_id);
+
+    /* set return value */
+    ret_value = new_link;
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+        if (new_link->block_list != NULL)
+            HDfree(new_link->block_list);
+        if (new_link != NULL)
+            HDfree(new_link);
+    } /* end if */
+
+  /* Normal function cleanup */
+  if (buffer != NULL)
+      HDfree(buffer);
+
+  return ret_value;
+}   /* HLIgetlink */
+
+/* ------------------------------- HLPseek -------------------------------- */
+/*
+NAME
+   HLPseek -- set the seek posn
+USAGE
+   int32 HLPseek(access_rec, offset, origin)
+   access_t * access_rec;      IN: access record to mess with
+   int32      offset;          IN: seek offset
+   int32      origin;          IN: where we should calc the offset from
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Set the seek posn in the given linked block element
+
+---------------------------------------------------------------------------*/
+int32
+HLPseek(accrec_t *access_rec, 
+        int32     offset, 
+        int       origin)
+{
+    CONSTR(FUNC, "HLPseek");    /* for HERROR */
+    int32   ret_value = SUCCEED;
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_LINKED)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* adjust the offset according to origin and validate */
+    /* there is no upper bound to posn */
+    if (origin == DF_CURRENT)
+        offset += access_rec->posn;
+    if (origin == DF_END)
+        offset += ((linkinfo_t *) (access_rec->special_info))->length;
+    if (offset < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* set position */
+    access_rec->posn = offset;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HLPseek */
+
+/* ------------------------------- HLPread -------------------------------- */
+/*
+NAME
+   HLPread -- read some data out of a linked block element
+USAGE
+   int32 HLPseek(access_rec, length, data)
+   access_t * access_rec;      IN: access record to mess with
+   int32      length;          IN: number of bytes to read
+   void *      data;            IN: buffer for data
+RETURNS
+   The number of bytes read or FAIL on error
+DESCRIPTION
+   Read in some data from a linked block element.  If length
+   is zero read until the end of the element.  It is assumed
+   that the data buffer is big enough to store the data.
+   If length would take us off the end of the element only
+   read what has been written.
+
+--------------------------------------------------------------------------- */
+int32
+HLPread(accrec_t *access_rec, 
+        int32     length, 
+        void *     datap)
+{
+    CONSTR(FUNC, "HLPread");    /* for HERROR */
+    uint8      *data = (uint8 *) datap;
+    /* information record for this special data elt */
+    linkinfo_t *info = (linkinfo_t *) (access_rec->special_info);
+    link_t     *t_link = info->link;    /* block table record */
+
+    /* relative position in linked block of data elt */
+    int32       relative_posn = access_rec->posn;
+
+    int32       block_idx;      /* block table index of current block */
+    int32       current_length; /* length of current block */
+    int32       nbytes = 0;     /* # bytes read on any single Hread() */
+    int32       bytes_read = 0; /* total # bytes read for this call of HLIread */
+    int32       ret_value = SUCCEED;
+
+    /* validate length */
+    if (length == 0)
+        length = info->length - access_rec->posn;
+    else
+        if (length < 0)
+            HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    if (access_rec->posn + length > info->length)
+        length = info->length - access_rec->posn;
+
+    /* search for linked block to start reading from */
+    if (relative_posn < info->first_length)
+      { /* first block */
+          block_idx = 0;
+          current_length = info->first_length;
+      }
+    else /* not first block? */
+      {
+          relative_posn -= info->first_length;
+          block_idx = relative_posn / info->block_length + 1;
+          relative_posn %= info->block_length;
+          current_length = info->block_length;
+      }
+
+/* calculate which block to start from? */
+    {
+        int32 i;
+
+        for (i = 0; i < block_idx / info->number_blocks; i++)
+          {
+              if (t_link == NULL)
+                  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+              t_link = t_link->next;
+          }
+    }
+    block_idx %= info->number_blocks;
+
+    /* found the starting block, now read in the data */
+    do
+      {
+          int32 remaining =    /* remaining data in current block */
+              current_length - relative_posn;
+
+          /* read in the data in this block */
+          if (remaining > length)
+              remaining = length;
+          if (t_link->block_list[block_idx].ref != 0)
+            {
+                int32       access_id;  /* access record id for this block */
+                block_t    *current_block =     /* record on the current block */
+                    &(t_link->block_list[block_idx]);
+
+                access_id = Hstartread(access_rec->file_id, DFTAG_LINKED,
+                                       current_block->ref);
+                if (access_id == (int32) FAIL
+                    || (relative_posn
+                && (int32) FAIL == Hseek(access_id, relative_posn, DF_START))
+                    || (int32) FAIL == (nbytes = Hread(access_id, remaining, data)))
+                    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                bytes_read += nbytes;
+                Hendaccess(access_id);
+            }
+          else
+            {   /*if block is missing, fill this part of buffer with zero's */
+                HDmemset(data, 0, (size_t)remaining);
+                bytes_read += nbytes;
+            }
+
+          /* move variables for the next block */
+          data += remaining;
+          length -= remaining;
+          if (length > 0 && ++block_idx >= info->number_blocks)
+            {
+                block_idx = 0;
+                t_link = t_link->next;
+                if (t_link == NULL)
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            }
+          relative_posn = 0;
+          current_length = info->block_length;
+      }
+    while (length > 0);     /* if still somemore to read in, repeat */
+
+    access_rec->posn += bytes_read;
+    ret_value = bytes_read;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HLPread  */
+
+/* ------------------------------- HLPwrite ------------------------------- */
+/*
+NAME
+   HLPwrite -- write out some data to a linked block
+USAGE
+   int32 HLPwrite(access_rec, length, data)
+   access_t * access_rec;      IN: access record to mess with
+   int32      length;          IN: number of bytes to write
+   void *      data;            IN: buffer for data
+RETURNS
+   The number of bytes written or FAIL on error
+DESCRIPTION
+   Write out some data from a linked block element.  If we write
+   passed the end of the existing element new blocks are created
+   as needed.
+
+---------------------------------------------------------------------------*/
+int32
+HLPwrite(accrec_t   *access_rec, 
+         int32       length, 
+         const void * datap)
+{
+    CONSTR(FUNC, "HLPwrite");   /* for HERROR */
+    const uint8      *data = datap;
+    filerec_t  *file_rec;       /* file record */
+    int32       dd_aid;         /* AID for writing the special info */
+    uint16      data_tag, data_ref;  /* Tag/ref of the data in the file */
+    linkinfo_t *info =          /* linked blocks information record */
+        (linkinfo_t *) (access_rec->special_info);
+    link_t     *t_link =        /* ptr to link block table */
+        info->link;
+    int32       relative_posn = /* relative position in linked block */
+        access_rec->posn;
+    int32       block_idx;      /* block table index of current block */
+    link_t     *prev_link = NULL; /* ptr to block table before current block table.
+                                       for groking the offset of
+                                       current block table */
+    int32       current_length; /* length of current block */
+    int32       nbytes = 0;     /* #bytes written by any single Hwrite */
+    int32       bytes_written = 0;  /* total #bytes written by HLIwrite */
+    uint8       local_ptbuf[4];
+    int32       ret_value = SUCCEED;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* validate length and file records */
+    if (length <= 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* determine linked block and position to start writing into */
+    /* determine where to start.  Setup missing block tables
+       along the way. */
+    if (relative_posn < info->first_length)
+      {
+          block_idx = 0;
+          current_length = info->first_length;
+      }
+    else
+      {
+          relative_posn -= info->first_length;
+          block_idx = relative_posn / info->block_length + 1;
+          relative_posn %= info->block_length;
+          current_length = info->block_length;
+      }
+    {
+        /* follow the links of block tables and create missing
+           block tables along the way */
+        int32 num_links;   /* number of links to follow */
+
+        for (num_links = block_idx / info->number_blocks; num_links > 0; num_links--)
+          {
+              if (!t_link->next)
+                {   /* create missing link (block table) */
+                    t_link->nextref = Htagnewref(access_rec->file_id,DFTAG_LINKED);
+                    t_link->next = HLInewlink(access_rec->file_id,
+                                   info->number_blocks, t_link->nextref, 0);
+                    if (!t_link->next)
+                        HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                    {   /* AA */
+                        /* update previous link with information about new link */
+
+                        uint16      link_tag = DFTAG_LINKED;
+                        uint16      link_ref =  /* ref of current link */
+                        (uint16) (prev_link != NULL ?
+                                  prev_link->nextref : info->link_ref);
+
+                        uint8      *p = local_ptbuf;    /* temp buf ptr */
+
+                        /* write file the updated portion of current link */
+
+                        int32       link_id =   /* access id for current link */
+                        Hstartwrite(access_rec->file_id, link_tag, link_ref, 0);
+
+                        if (link_id == FAIL)
+                            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                        UINT16ENCODE(p, t_link->nextref);
+                        if (Hwrite(link_id, 2, local_ptbuf) == FAIL)
+                            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                        Hendaccess(link_id);
+                    }   /* AA */
+                }   /* if not t_link->next */
+
+              /* move to the next link */
+              prev_link = t_link;
+              t_link = t_link->next;
+          }     /* end for */
+    }   /* end block statement(bad) */
+
+    block_idx %= info->number_blocks;
+
+    /* start writing in that block */
+    do
+      {
+          int32       access_id;    /* access record id */
+          int32       remaining =   /* remaining data length in this block */
+              current_length - relative_posn;
+          uint16      new_ref = 0;  /* ref of newly created block */
+
+          /* determine length and write this block */
+          if (remaining > length)
+              remaining = length;
+
+          /* this block already exist, so just set up access to it */
+          if (t_link->block_list[block_idx].ref != 0)
+            {
+                block_t    *current_block =     /* ptr to current block record */
+                &(t_link->block_list[block_idx]);
+
+                access_id = Hstartwrite(access_rec->file_id, DFTAG_LINKED,
+                                        current_block->ref, current_length);
+            }   
+          else
+            {   /* block is missing, set up a new block */
+                new_ref = Htagnewref(access_rec->file_id,DFTAG_LINKED);
+                access_id = Hstartwrite(access_rec->file_id, DFTAG_LINKED,
+                                        new_ref, current_length);
+            }
+
+          if (access_id == (int32) FAIL)
+              HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+          if ((relative_posn &&
+               (int32) FAIL == Hseek(access_id, relative_posn, DF_START)) ||
+              (int32) FAIL == (nbytes = Hwrite(access_id, remaining, data)))
+            {
+                HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+            }
+          Hendaccess(access_id);
+          bytes_written += nbytes;
+
+          if (new_ref)
+            {   /* created a new block, so update the link/block table */
+                uint16      link_tag = DFTAG_LINKED;
+                uint16      link_ref =  /* ref of the current link/block table */
+                (uint16) (prev_link ? prev_link->nextref : info->link_ref);
+                uint8      *p = /* temp buffer ptr */
+                local_ptbuf;
+                int32       link_id =   /* access record id of the current
+                                           link/block table */
+                Hstartwrite(access_rec->file_id, link_tag, link_ref, 0);
+
+                if (link_id == FAIL)
+                    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                UINT16ENCODE(p, new_ref);
+                if (Hseek(link_id, 2 + 2 * block_idx, DF_START) == FAIL)
+                    HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+                if (Hwrite(link_id, 2, local_ptbuf) == FAIL)
+                    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                Hendaccess(link_id);
+
+                /* update memory structure */
+                t_link->block_list[block_idx].ref = new_ref;
+            }   /* if new_ref */
+
+          /* move ptrs and counters for next phase */
+          data += remaining;
+          length -= remaining;
+
+          if (length > 0 && ++block_idx >= info->number_blocks)
+            {  /* move to the next link/block table */
+                block_idx = 0;
+                if (!t_link->next)
+                  {     /* create missing link/block table */
+                      t_link->nextref = Htagnewref(access_rec->file_id,DFTAG_LINKED);
+                      t_link->next = HLInewlink(access_rec->file_id,
+                                   info->number_blocks, t_link->nextref, 0);
+                      if (!t_link->next)
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                      {     /* BB */
+                          uint16      link_tag = DFTAG_LINKED;
+                          uint16      link_ref =    /* ref of current link/block table */
+                          (uint16) (prev_link ? prev_link->nextref : info->link_ref);
+                          uint8      *p =   /* temp buffer ptr */
+                          local_ptbuf;
+                          int32       link_id =     /* access record id of
+                                                       current link/block table */
+                          Hstartwrite(access_rec->file_id, link_tag,
+                                      link_ref, 0);
+
+                          if (link_id == FAIL)
+                              HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                          UINT16ENCODE(p, t_link->nextref);
+                          if (Hwrite(link_id, 2, local_ptbuf) == FAIL)
+                              HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+                          Hendaccess(link_id);
+                      }     /* BB */
+                  }     /* if not t_link->next  */
+
+                /* move to the next link/block table */
+                prev_link = t_link;
+                t_link = t_link->next;
+            }   /* end if "length" */
+
+          /* update vars for next phase */
+          relative_posn = 0;
+          current_length = info->block_length;
+      }
+    while (length > 0);
+
+    /* update the info for the dataset */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,NULL,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    if((dd_aid=Hstartaccess(access_rec->file_id,data_tag,data_ref,DFACC_WRITE))==FAIL)
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+    if (Hseek(dd_aid, 2, DF_START) == FAIL)
+        HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+    {
+        int32       tmp;
+        uint8      *p = local_ptbuf;
+
+        tmp = bytes_written + access_rec->posn;
+        if (tmp > info->length)
+            info->length = tmp;
+        INT32ENCODE(p, info->length);
+
+    }
+    if (Hwrite(dd_aid, 4, local_ptbuf) == FAIL)
+        HGOTO_ERROR(DFE_READERROR, FAIL);
+    if(Hendaccess(dd_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    access_rec->posn += bytes_written;
+    /* return SUCCEED; */
+    /* if wrong # bytes written, FAIL has already been returned */
+    ret_value = bytes_written;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HLPwrite */
+
+/* ------------------------------ HLInewlink ------------------------------ */
+/*
+NAME
+   HLInewlink -- write out some data to a linked block
+USAGE
+   link_t * HLInewlink(fid, nblocks, link_ref, first_block_ref)
+   int32  fid;               IN: file ID
+   int32  nblocks;           IN: number of blocks in the table
+   uint16 link_ref;          IN: ref number for the table
+   uint16 first_block_ref;   IN: ref number for first block
+RETURNS
+   A pointer to a new link/block table or NULL
+DESCRIPTION
+   Create a new link/block table in memory and in file returns
+   ptr to the new link/block table.
+
+---------------------------------------------------------------------------*/
+PRIVATE link_t *
+HLInewlink(int32  file_id, 
+           int32  number_blocks,
+           uint16 link_ref, 
+           uint16 first_block_ref)
+{
+    CONSTR(FUNC, "HLInewlink");     /* for HERROR */
+    int32       link_id;        /* access record id of new link */
+    uint8      *buf       = NULL;            /* temp buffer */
+    link_t     *t_link    = NULL;
+    link_t     *ret_value = NULL; /* FAIL */
+
+    /* set up new link record in memory */
+    /* new link record */
+    t_link = (link_t *) HDmalloc((uint32) sizeof(link_t));
+
+    if (!t_link)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    t_link->block_list = (block_t *) HDmalloc((uint32) number_blocks
+                                                * sizeof(block_t));
+    if (!t_link->block_list)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    t_link->next = NULL;
+
+    /* get ready to write the new link to file */
+    link_id = Hstartwrite(file_id, DFTAG_LINKED, link_ref, 2 + 2 * number_blocks);
+    if (link_id == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, NULL);
+
+    /* encode this block information for writing to the file */
+    {   /* CC */
+        int32 i;       /* temp int index */
+        uint8      *p;          /* temp buffer ptr */
+
+        p = buf = (uint8 *) HDmalloc((uint32) (2 + 2 * number_blocks));
+        if (!buf)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+        /* set up the record and write to file */
+        t_link->nextref = 0;
+        UINT16ENCODE(p, 0);
+        t_link->block_list[0].ref = first_block_ref;
+        UINT16ENCODE(p, first_block_ref);
+/* why is this first_block_ref = 0? */
+        for (i = 1; i < number_blocks; i++)
+          {     /* set up each block in this link */
+              t_link->block_list[i].ref = 0;
+              UINT16ENCODE(p, 0);
+          }
+    }   /* CC */
+
+    /* write the link */
+    if (Hwrite(link_id, 2 + 2 * number_blocks, buf) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, NULL);
+
+    /* close down acces to this block */
+    Hendaccess(link_id);
+
+    /* set return value */
+    ret_value = t_link;
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+        if (t_link->block_list != NULL)
+            HDfree(t_link->block_list);
+        if (t_link != NULL)
+            HDfree(t_link);
+    } /* end if */
+
+  /* Normal function cleanup */
+  if (buf != NULL)
+      HDfree(buf);
+
+  return ret_value;
+}   /* HLInewlink */
+
+/* ------------------------------ HLPinquire ------------------------------ */
+/*
+NAME
+   HLPinquire -- Hinquire for linked blocks
+USAGE
+   int32 HLPinquire(access_rec, fid, tag, ref, len, off, pos, acc, sp)
+   access_t * access_rec;      IN:  access record to return info about
+   uint16   * file;            OUT: file ID;
+   uint16   * tag;             OUT: tag of info record;
+   uint16   * ref;             OUT: ref of info record;
+   int32    * len;             OUT: length of element;
+   int32    * off;             OUT: offset of element -- meaningless
+   int32    * pos;             OUT: current position in element;
+   int16    * acc;             OUT: access mode;
+   int16    * sp;              OUT: special code;
+RETURNS
+   SUCCEED
+DESCRIPTION
+   Return interesting information about a linked block element.
+   NULL can be passed for any of the OUT parameters if their
+   value is not needed.
+
+--------------------------------------------------------------------------- */
+int32
+HLPinquire(accrec_t  *access_rec, 
+           int32     *pfile_id, 
+           uint16    *ptag,
+           uint16    *pref, 
+           int32     *plength, 
+           int32     *poffset, 
+           int32     *pposn,
+           int16     *paccess, 
+           int16     *pspecial)
+{
+    CONSTR(FUNC, "HLPinquire");   /* for HERROR */
+    uint16      data_tag, data_ref;  /* Tag/ref of the data in the file */
+    linkinfo_t *info =          /* special information record */
+        (linkinfo_t *) access_rec->special_info;
+    int32   ret_value = SUCCEED;
+
+    /* update the info for the dataset */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,NULL,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the variables if they are present */
+    if (pfile_id)
+        *pfile_id = access_rec->file_id;
+    if (ptag)
+        *ptag = data_tag;
+    if (pref)
+        *pref = data_ref;
+    if (plength)
+        *plength = info->length;
+    if (poffset)
+        *poffset = 0;   /* meaningless */
+    if (pposn)
+        *pposn = access_rec->posn;
+    if (paccess)
+        *paccess = (int16)access_rec->access;
+    if (pspecial)
+        *pspecial = (int16)access_rec->special;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return ret_value;
+}   /* HLPinquire */
+
+/* ----------------------------- HLPendaccess ----------------------------- */
+/*
+NAME
+   HLPendacess -- close a linked block AID
+USAGE
+   intn HLPendaccess(access_rec)
+   access_t * access_rec;      IN:  access record to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Free up all of the space used to store information about a
+   linked block element.  Information is flushed to disk as
+   it is created so this routine does NOT have to write anything
+   out.
+
+--------------------------------------------------------------------------- */
+intn
+HLPendaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HLPendaccess");   /* for HERROR */
+    filerec_t  *file_rec;           /* file record */
+    intn      ret_value = SUCCEED;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* detach the special information record.
+       If no more references to that, free the record */
+    HLPcloseAID(access_rec);
+
+    /* update file and access records */
+    if (HTPendaccess(access_rec->ddid) == FAIL)
+      HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+
+    /* validate file record */
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* detach from the file */
+    file_rec->attach--;
+
+    /* free the access record */
+    HIrelease_accrec_node(access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HLPendaccess */
+
+/* ----------------------------- HLPcloseAID ------------------------------ */
+/*
+NAME
+   HLPcloseAID -- close file but keep AID active
+USAGE
+   int32 HLPcloseAID(access_rec)
+   access_t * access_rec;      IN:  access record of file to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   close the file currently being pointed to by this AID but 
+   do *NOT* free the AID.
+
+   This is called by Hnextread() which reuses an AID to point to
+   the 'next' object as requested.  If the current object was an
+   linked object, the linked information needs to be closed before all
+   reference to it is lost.
+
+---------------------------------------------------------------------------*/
+int32
+HLPcloseAID(accrec_t * access_rec)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HLPcloseAID");    /* for HERROR */
+#endif /* LATER */
+    linkinfo_t *info =          /* special information record */
+        (linkinfo_t *) access_rec->special_info;
+    int32      ret_value = SUCCEED;
+
+    /* detach the special information record.
+       If no more references to that, free the record */
+    if (--(info->attached) == 0)
+      {
+          link_t     *t_link;   /* current link to free */
+          link_t     *next;     /* next link to free */
+
+          /* free the linked list of links/block tables */
+          for (t_link = info->link; t_link; t_link = next)
+            {
+                next = t_link->next;
+                HDfree(t_link->block_list);
+                HDfree(t_link);
+            }
+
+          HDfree(info);
+          access_rec->special_info = NULL;
+      }
+
+#ifdef LATER
+done:
+#endif /* LATER */
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return ret_value;
+}   /* HLPcloseAID */
+
+/* ------------------------------- HLPinfo -------------------------------- */
+/*
+NAME
+   HLPinfo -- return info about a linked block element
+USAGE
+   int32 HLPinfo(access_rec, info_block)
+   access_t        * access_rec;
+   IN: access record of access element
+   sp_info_block_t * info_block;
+   OUT: information about the special element
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Return information about the given linked block.  Info_block is
+   assumed to be non-NULL.
+
+--------------------------------------------------------------------------- */
+int32
+HLPinfo(accrec_t * access_rec, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HLPinfo");
+    linkinfo_t *info =          /* special information record */
+    (linkinfo_t *) access_rec->special_info;
+    int32     ret_value = SUCCEED;
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_LINKED)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the info_block */
+    info_block->key = SPECIAL_LINKED;
+
+    info_block->first_len = info->first_length;
+    info_block->block_len = info->block_length;
+    info_block->nblocks = info->number_blocks;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HLPinfo */
+
+/*--------------------------------------------------------------------------
+NAME
+   HLsetblockinfo -- set the block length of a linked-block element
+
+USAGE
+   intn HLsetblockinfo(
+   int32 aid		IN: access record id
+   int32 block_size	IN: length to be used for each linked-block 
+   int32 num_blocks	IN: number of blocks the element will have
+
+RETURNS
+   SUCCEED / FAIL
+
+DESCRIPTION
+   HLsetblockinfo sets (accrec_t).block_size and (accrec_t).num_blocks
+   to block_size and num_blocks, respectively.  An error will occur, if
+   either of the parameters is a 0 or a negative number, that is not
+   -1, which is used to indicate that the respective field is not to be
+   changed.
+
+   In the library, this routine is used by:
+	VSsetblocksize 
+	VSsetnumblocks
+
+MODIFICATION
+   BMR - added in June 2001 to fix bug# 267
+
+--------------------------------------------------------------------------*/
+intn
+HLsetblockinfo(int32 aid,	/* access record id */
+              int32 block_size, /* length to be used for each linked-block */
+              int32 num_blocks) /* number of blocks the element will have */
+{
+    CONSTR(FUNC, "HLsetblockinfo");  	/* for HERROR */
+    accrec_t   *access_rec;               /* access record */
+    intn	ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* validate aid */
+    if (HAatom_group(aid)!=AIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* block_size and num_blocks should be either -1, to keep the original 
+       values, or positive values to change the block size and/or the 
+       number of blocks */ 
+    if ((block_size <= 0 && block_size != -1) || 
+        (num_blocks <= 0 && num_blocks != -1))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get the access record */
+    if ((access_rec = HAatom_object(aid)) == NULL)        
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If this element is already stored as linked-block, do not allow
+       to change the block info, ignore the request to change. */
+    if (access_rec->special != SPECIAL_LINKED)
+    {
+	/* Set the linked-block size, if requested */
+	if (block_size != -1)
+	    access_rec->block_size = block_size;
+
+	/* Set the number of blocks in each block table, if requested */
+	if (num_blocks != -1)
+	    access_rec->num_blocks = num_blocks;
+    }
+
+done:
+    if(ret_value == FAIL)
+    { /* Error condition cleanup */
+    } /* end if */
+
+  /* Normal function cleanup */
+    return ret_value;
+}       /* end HLsetblockinfo */
+
+/*--------------------------------------------------------------------------
+NAME
+   HLgetblockinfo -- get the block size and the number of blocks of a 
+		    linked-block element
+
+USAGE
+   intn HLgetblockinfo(aid, block_size, num_blocks)
+   int32  aid		IN: access record id
+   int32* block_size	OUT: the returned block size of each linked-block 
+   int32* num_blocks	OUT: the returned number of blocks of the element
+
+RETURNS
+   SUCCEED / FAIL
+
+DESCRIPTION
+   HLgetblockinfo retrieves the values of (accrec_t).block_size and 
+   (accrec_t).num_blocks to block_size and num_blocks, respectively.  
+   A NULL can be passed in for an unwanted value.
+
+   In the library, this routine is used by:
+	VSgetblockinfo 
+
+MODIFICATION
+   BMR - added in June 2001 to fix bug# 267
+
+--------------------------------------------------------------------------*/
+intn
+HLgetblockinfo(int32 aid,	/* access record id */
+              int32* block_size, /* length being used for each linked-block */
+              int32* num_blocks) /* number of blocks the element will have */
+{
+    CONSTR(FUNC, "HLgetblockinfo");  /* for HERROR */
+    accrec_t   *access_rec;               /* access record */
+    intn	ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the access record */
+    if ((access_rec = HAatom_object(aid)) == NULL)        
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get the linked-block size and the number of linked-blocks if requested */
+    if (block_size != NULL)
+        *block_size = access_rec->block_size;
+    if (num_blocks != NULL)
+        *num_blocks = access_rec->num_blocks;
+
+done:
+    if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return ret_value;
+}       /* end HLgetblockinfo */
+
diff --git a/hdf/src/hbuffer.c b/hdf/src/hbuffer.c
new file mode 100644
index 0000000..35aa62d
--- /dev/null
+++ b/hdf/src/hbuffer.c
@@ -0,0 +1,640 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: hbuffer.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/*LINTLIBRARY */
+/* ------------------------------ hbuffer.c -------------------------------
+
+   Routines for buffered elements, i.e., data elements that reside in memory
+   until they are closed, and are then flushed out to the file.  Buffered
+   elements are held in memory while they are being accessed and are only
+   written back to the file if they are modified.
+
+   File Organization
+  ******************
+    These special elements are invoked at run-time only, information about
+    whether an element was cached is not stored in the file.  Unless specificly
+    asked for by an API routine or required for a particular kind of access by
+    the library, these routines aren't called.
+
+ LOCAL ROUTINES
+
+ EXPORTED BUT LIBRARY PRIVATE ROUTINES
+   HBPcloseAID      -- close file but keep AID active
+   HBPendacess      -- close file, free AID
+   HBPinfo          -- return info about an buffered element
+   HBPinquire       -- retrieve information about an buffered element
+   HBPread          -- read some data out of an buffered element
+   HBPreset         -- replace the current buffered info with new info (NOP)
+   HBPseek          -- set the seek position
+   HBPsetaccesstype -- set the I/O access type of the buffered element
+   HBPstread        -- open an access record for reading
+   HBPstwrite       -- open an access record for reading
+   HBPwrite         -- write some data out to a buffered element
+
+EXPORTED ROUTINES
+   HBconvert        -- start buffering an AID
+
+------------------------------------------------------------------------- */
+
+#include "hdf.h"
+#include "hfile.h"
+#include <assert.h>
+
+/* extinfo_t -- external elt information structure */
+
+typedef struct
+  {
+      intn        attached;     /* number of access records attached
+                                   to this information structure */
+      intn        modified;     /* has the buffered element been modified? */
+      int32       length;       /* length of this element */
+      uint8      *buf;          /* pointer to the buffered data */
+      int32       buf_aid;      /* AID for buffered access record (below) */
+      accrec_t   *buf_access_rec;   /* "Real" access record for buffered data */
+  }
+bufinfo_t;
+
+/* forward declaration of the functions provided in this module */
+
+/* buf_funcs -- table of the accessing functions of the buffered
+   data element function modules.  The position of each function in
+   the table is standard */
+funclist_t  buf_funcs =
+{
+    HBPstread,
+    HBPstwrite,
+    HBPseek,
+    HBPinquire,
+    HBPread,
+    HBPwrite,
+    HBPendaccess,
+    HBPinfo,
+    NULL         /* no routine registered */
+};
+
+/*------------------------------------------------------------------------ 
+NAME
+   HBconvert -- cause an existing AID to be buffered.
+USAGE
+   intn HBcreate(aid)
+       int32  aid;          IN: AID of data element to buffer
+RETURNS
+   SUCCEED/FAIL
+DESCRIPTION
+   Buffers an existing data element (referred to with the AID passed in) in
+   memory for faster access.  This is especially useful when repeatedly
+   accessing a compressed special element object which would otherwise have
+   to be repeatedly decompressed over many I/O accesses.
+
+   If the ALLOW_BUFFER_GROWING flag is defined during compile time,
+   the buffered object is allowed to grow, it is assumed that a higher-level
+   API will prevent this if it is not allowed through that API.
+
+FORTRAN
+   None
+
+--------------------------------------------------------------------------*/
+intn
+HBconvert(int32 aid)
+{
+    CONSTR(FUNC, "HBconvert");   /* for HERROR */
+    accrec_t   *access_rec=NULL;/* access element record */
+    accrec_t   *new_access_rec; /* newly created access record */
+    accrec_t   *tmp_access_rec; /* temp. access record */
+    bufinfo_t  *info;           /* information for the buffered element */
+    uint16 data_tag,data_ref;   /* tag/ref of the data we are checking */
+    int32       data_off;		/* offset of the data we are checking */
+    int32       data_len;		/* length of the data we are checking */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+    if ((access_rec = HAatom_object(aid)) == NULL)	/* get the access_rec pointer */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get the info for the dataset */
+    if (HTPis_special(access_rec->ddid) || access_rec->special!=0) {
+        if((*access_rec->special_func->inquire) (access_rec, NULL,
+                           &data_tag, &data_ref, &data_len, &data_off, NULL, NULL, NULL)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    } /* end if */
+    else
+        if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,&data_off,&data_len)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* is data defined but does not exist in the file? */
+    if(data_off==INVALID_OFFSET && data_len==INVALID_LENGTH)
+      { /* catch the case where the data doesn't exist yet */
+
+          /* set length to zero */
+        if(Hsetlength(aid,0)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* get back new offset and length */
+        if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,&data_off,&data_len)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      } /* end if */
+      
+    /* allocate special info struct for buffered element */
+    if ((info = HDmalloc((uint32) sizeof(bufinfo_t)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* fill in special info struct */
+    info->attached     = 1;
+    info->modified     = 0;         /* Data starts out not modified */
+    info->length       = data_len;  /* initial buffer size */
+
+    /* Get space for buffer */
+    if(data_len>0) {
+        if((info->buf = HDmalloc((uint32) data_len))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      } /* end if */
+    else
+        info->buf=NULL;
+
+    /* Read in existing data into buffer */
+    if(data_len>0) {
+        if (Hseek(aid, 0, DF_START) == FAIL)
+            HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+        if (Hread(aid, data_len, info->buf) == FAIL)
+            HGOTO_ERROR(DFE_READERROR, FAIL);
+    } /* end if */
+
+    /* get empty access record */
+    new_access_rec = HIget_access_rec();
+    if (new_access_rec == NULL)
+        HGOTO_ERROR(DFE_TOOMANY, FAIL);
+
+    /* Copy the old access record information to the new access record */
+    /*
+     * Don't get a new copy of the DD id or increment the number of attached
+     * elements, buffered elements are supposed to be "transparent".
+     * We "inherit" the appendable flag if it's set and ALLOW_BUFFER_GROW is
+     * defined to support it.
+     */
+    tmp_access_rec=new_access_rec->next;    /* preserve free list pointer */
+    HDmemcpy(new_access_rec,access_rec,sizeof(accrec_t));
+    new_access_rec->next=tmp_access_rec;    /* restore free list pointer */
+
+    /* Preserve the actual access record for the buffered element */
+    info->buf_access_rec = new_access_rec;  /* Access record of actual data on disk */
+
+    /* Create AID for actual access record */
+    info->buf_aid = HAregister_atom(AIDGROUP,new_access_rec);
+
+    /* Modify access record to point to buffered element functions */
+    access_rec->special_info = (void *)info;
+    access_rec->special_func = &buf_funcs;
+    access_rec->special      = SPECIAL_BUFFERED;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+    } /* end if */
+
+  return ret_value;
+} /* HBconvert */
+
+/* ------------------------------ HBPstread ------------------------------- */
+/*
+NAME
+   HBPstread -- open an access record for reading
+USAGE
+   int32 HBPstread(access_rec)
+       access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   This is a stub routine and should never be called
+
+---------------------------------------------------------------------------*/
+int32
+HBPstread(accrec_t * rec)
+{
+    /* shut compilers up*/
+    rec=rec;
+
+assert(0 && "Should never be called");
+  return (FAIL);
+}   /* HBPstread */
+
+/* ------------------------------ HBPstwrite ------------------------------- */
+/*
+NAME
+   HBPstwrite -- open an access record for reading
+USAGE
+   int32 HBPstwrite(access_rec)
+       access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   This is a stub routine and should never be called.
+
+---------------------------------------------------------------------------*/
+int32
+HBPstwrite(accrec_t * rec)
+{
+    /* shut compilers up*/
+    rec=rec;
+
+assert(0 && "Should never be called");
+  return (FAIL);
+}   /* HBPstwrite */
+
+/* ------------------------------ HBPseek ------------------------------- */
+/*
+NAME
+   HBPseek -- set the seek posn
+USAGE
+   int32 HXPseek(access_rec, offset, origin)
+       access_t * access_rec;      IN: access record to mess with
+       int32      offset;          IN: seek offset
+       int32      origin;          IN: where we should calc the offset from
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Set the seek posn in the given buffered element
+
+---------------------------------------------------------------------------*/
+int32
+HBPseek(accrec_t * access_rec, int32 offset, int origin)
+{
+    int32     ret_value = SUCCEED;
+    CONSTR(FUNC, "HBPseek");    /* for HERROR */
+
+    /* Adjust offset according to origin.  There is no upper bound to posn */
+    if (origin == DF_CURRENT)
+        offset += access_rec->posn;
+    if (origin == DF_END)
+        offset += ((bufinfo_t *) (access_rec->special_info))->length;
+    if (offset < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* set the offset */
+    access_rec->posn = offset;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HBPseek */
+
+/* ------------------------------ HBPread ------------------------------- */
+/*
+NAME
+   HBPread -- read some data out of buffered element
+USAGE
+   int32 HBPread(access_rec, length, data)
+       access_t * access_rec;      IN: access record to mess with
+       int32      length;          IN: number of bytes to read
+       void *      data;           IN: buffer for data
+RETURNS
+   The number of bytes read or FAIL on error
+DESCRIPTION
+   Read in some data from a buffered element.  If length is zero
+   read until the end of the element.  It is assumed that the
+   data buffer is big enough to store the data.
+
+---------------------------------------------------------------------------*/
+int32
+HBPread(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HBPread");    /* for HERROR */
+    bufinfo_t  *info =          /* information on the special element */
+        (bufinfo_t *) access_rec->special_info;
+    int32    ret_value = SUCCEED;
+
+    /* validate length */
+    if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* adjust length if it falls off the end of the element */
+    if ((length == 0) || (access_rec->posn + length > info->length))
+        length = info->length - access_rec->posn;
+    else if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* Copy data from buffer */
+    HDmemcpy(data,info->buf+access_rec->posn,length);
+
+    /* adjust access position */
+    access_rec->posn += length;
+
+    ret_value = length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* HBPread */
+
+/* ------------------------------ HBPwrite ------------------------------- */
+/*
+NAME
+   HBPwrite -- write some data out to a buffered element
+USAGE
+   int32 HBPwrite(access_rec, length, data)
+       access_t * access_rec;      IN: access record to mess with
+       int32      length;          IN: number of bytes to read
+       void *     data;            IN: buffer of data
+RETURNS
+   The number of bytes written or FAIL on error
+DESCRIPTION
+   Write out some data to a buffered element.
+
+---------------------------------------------------------------------------*/
+int32
+HBPwrite(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HBPwrite");   /* for HERROR */
+    bufinfo_t  *info =          /* information on the special element */
+                    (bufinfo_t *) (access_rec->special_info);
+    int32 new_len;              /* new length of object */
+    int32      ret_value = SUCCEED;
+
+    /* validate length */
+    if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* Check if the data to write will overrun the buffer and realloc it if so */
+    if(access_rec->posn+length>info->length) {
+        /* Calc. the new size of the object */
+        new_len=access_rec->posn+length;
+
+        /* Resize buffer in safe manner */
+        /* Realloc should handle this, but the Sun is whining about it... -QAK */
+        if(info->buf==NULL) {
+            if((info->buf = HDmalloc((uint32)new_len))==NULL)
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+        }
+        else {
+            uint8 *temp_buf=info->buf;  /* temporary buffer pointer in case realloc fails */
+
+            if((info->buf = HDrealloc(info->buf, (uint32)new_len))==NULL) {
+                info->buf=temp_buf;
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            } /* end if */
+        }
+
+        /* update length */
+        info->length=new_len;
+    } /* end if */
+    
+    /* Copy data to buffer */
+    HDmemcpy(info->buf+access_rec->posn,data,length);
+
+    /* Mark the buffer as modified */
+    info->modified=TRUE;
+
+    /* update access record */
+    access_rec->posn += length;
+
+    ret_value = length;    /* return length of bytes written */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* HBPwrite */
+
+/* ------------------------------ HBPinquire ------------------------------ */
+/*
+NAME
+   HBPinquire -- retreive information about a buffered element
+USAGE
+   int32 HBPinquire(access_rec, file, tag, ref, len, off, pos, acc, sp)
+   access_t * access_rec;      IN:  access record to return info about
+   uint16   * file;            OUT: file ID;
+   uint16   * tag;             OUT: tag of info record;
+   uint16   * ref;             OUT: ref of info record;
+   int32    * len;             OUT: length of element;
+   int32    * off;             OUT: offset of element (NOT correct);
+   int32    * pos;             OUT: current position in element;
+   int16    * acc;             OUT: access mode;
+   int16    * sp;              OUT: special code;
+RETURNS
+   SUCCEED
+DESCRIPTION
+   Return interesting information about a buffered element.
+   NULL can be passed for any of the OUT parameters if their
+   value is not needed.
+
+---------------------------------------------------------------------------*/
+int32
+HBPinquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+           uint16 *pref, int32 *plength, int32 *poffset,
+           int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    CONSTR(FUNC, "HBPinquire");   /* for HERROR */
+    bufinfo_t  *info =          /* special information record */
+        (bufinfo_t *) access_rec->special_info;
+    uint16 data_tag,data_ref;   /* tag/ref of the data we are checking */
+    int32       data_off;		/* offset of the data we are checking */
+    int32    ret_value = SUCCEED;
+
+    /* Get the data's offset & length */
+    if(HTPinquire(info->buf_access_rec->ddid,&data_tag,&data_ref,&data_off,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the variables if they are present */
+    if (pfile_id)
+        *pfile_id = access_rec->file_id;
+    if (ptag)
+        *ptag = data_tag;
+    if (pref)
+        *pref = data_ref;
+    if (plength)
+        *plength = info->length;    /* pass along our value, which might be different from that on disk */
+    if (poffset)
+        *poffset = data_off;
+    if (pposn)
+        *pposn = access_rec->posn;
+    if (paccess)
+        *paccess = (int16)access_rec->access;
+    if (pspecial)
+        *pspecial = (int16)access_rec->special;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return ret_value;
+}	/* HBPinquire */
+
+/* ----------------------------- HBPendaccess ----------------------------- */
+/*
+NAME
+   HBPendacess -- flush buffer, free AID
+USAGE
+   intn HBPendaccess(access_rec)
+       access_t * access_rec;      IN:  access record to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Flush the buffer (if modified) and free the AID
+
+---------------------------------------------------------------------------*/
+intn
+HBPendaccess(accrec_t * access_rec)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HBPendaccess");   /* for HERROR */
+#endif /* LATER */
+    intn     ret_value = SUCCEED;
+
+    /* shut down the memory buffer and dependant access record */
+    HBPcloseAID(access_rec);
+
+    /* free the access record */
+    HIrelease_accrec_node(access_rec);
+
+#ifdef LATER
+done:
+#endif /* LATER */
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(access_rec!=NULL)
+          HIrelease_accrec_node(access_rec);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value; 
+}	/* HBPendaccess */
+
+/* ----------------------------- HBPcloseAID ------------------------------ */
+/*
+NAME
+   HBPcloseAID -- flush buffer and free memory but keep AID active
+USAGE
+   int32 HXPcloseAID(access_rec)
+       access_t * access_rec;      IN:  access record of file to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Flush the buffered data (if modified) and free special element information,
+   but do *NOT* free the AID.
+
+   This is called by Hnextread() which reuses an AID to point to
+   the 'next' object as requested.  If the current object was an
+   buffered object, the buffer needs to be flushed and freed before all
+   reference to it is lost.
+
+---------------------------------------------------------------------------*/
+int32
+HBPcloseAID(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HBPcloseAID");    /* for HERROR */
+    bufinfo_t  *info =          /* special information record */
+        (bufinfo_t *) access_rec->special_info;
+    int32      ret_value = SUCCEED;
+
+    /* detach the special information record.
+       If no more references to that, free the record */
+
+    if (--(info->attached) == 0)
+      {
+        /* Flush the data if it's been modified */
+        if(info->modified) {
+            if (Hwrite(info->buf_aid, info->length, info->buf) == FAIL)
+                HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+          } /* end if */
+
+        /* Free the memory buffer */
+        HDfree(info->buf);
+
+        /* Close the dependent access record */
+        Hendaccess(info->buf_aid);
+
+        HDfree(info);
+        access_rec->special_info = NULL;
+      }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return(ret_value);
+}   /* HBPcloseAID */
+
+/* ------------------------------- HBPinfo -------------------------------- */
+/*
+NAME
+   HBPinfo -- return info about an external element
+USAGE
+   int32 HBPinfo(access_rec, info_block)
+       accrec_t        * access_rec; IN: access record of element
+       sp_info_block_t * info_block; OUT: information about the special element 
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Return information about the given external element.  Info_block is
+   assumed to be non-NULL.  
+
+   --------------------------------------------------------------------------- */
+int32
+HBPinfo(accrec_t * access_rec, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HBPinfo");    /* for HERROR */
+    bufinfo_t  *info =          /* special information record */
+        (bufinfo_t *) access_rec->special_info;
+    int32      ret_value = SUCCEED;
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_BUFFERED)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the info_block */
+    info_block->key = SPECIAL_BUFFERED;
+
+    info_block->buf_aid = info->buf_aid;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}   /* HBPinfo */
+
diff --git a/hdf/src/hchunks.c b/hdf/src/hchunks.c
new file mode 100644
index 0000000..b1aac47
--- /dev/null
+++ b/hdf/src/hchunks.c
@@ -0,0 +1,4358 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5830 $";
+#endif
+
+/* $Id: hchunks.c 5830 2012-07-19 09:08:48Z bmribler $ */
+
+/*LINTLIBRARY */
+/* ------------------------------ HMCxxx -------------------------------
+   Routines to implement chunked elements via a Vdatas for
+   the chunk table and using a new data tag DFTAG_CHUNK to represent
+   each chunk object. As a result the *total* number of chunks
+   for all the chunked elements in an HDF file can only be as 
+   large as sizeof(uint16) = 65,536(i.e. number of refs).
+
+   This layer only has to deal with Chunks from a STDIO programming
+   model as this how special elements are viewed by other API's in the library.
+   The layers above deal with the more complex issues 
+   of deciding what data to read/write next given the users request.
+   This layer basically chunks the element from a stream of bytes.
+   Note that this is different than if the layer was integrated
+   with say the SDS layer.
+   
+   NOTE: GeorgeV's standard Disclaimer <here>. 
+         I was coerced to do it this way....:-)
+         If you break it .....you fix it...
+
+   Description of file format headers for chunked element
+   ------------------------------------------------------
+   A chunked element is a special element.
+
+   Special elements are
+   flagged with a set high-bit in their tag.  Thus, a tag t has
+   BASETAG == t & 0x7f and is a special tag if t & 0x80 != 0x00
+
+   The first 16 bits of the meta-element that this tag/ref points to
+   tells us what type of special element this is.  If these 16 bits is
+   SPECIAL_CHUNKED, then it contains information about the chunked element.
+   After this 16 bits, 32 bit which is the length of each chunk, after
+   which is the information header:
+
+   File Description of Chunked Element
+   ****************************************
+
+   NOTE: I know some of the fields could be 1 byte instead of 4 bytes
+         but I decided to make them 4 to allow the fields to change
+         their behaviour in the future.....i.e some could hold tag/refs..
+
+   DD for Chunked Element pointing to Chunked Description Record(12 byes )
+   =======================================================================
+   <-  2 bytes -> <- 2 bytes -> <- 4 bytes -> <- 4bytes ->
+   --------------------------------------------------------
+   |extended tag | reference # |  Offset     |  Length    |
+   --------------------------------------------------------
+                                    \______________/
+   __________________________________________|
+   V
+   CHUNKED DESCRIPTION RECORD(6 + 9 + 12 + 8 + 12 x ndims + 4 + fill_val_len + 
+                              'specialness' bytes) > 52 bytes
+   ============================================================================
+   <-  2 bytes -> <-  4 bytes  -> (6 bytes)
+   --------------------------------
+   |sp_tag_desc  |sp_tag_head_len | ... cont'd
+   --------------------------------
+
+   <-1 byte-> <- 4 bytes -> <-  4bytes  -> ( 9 bytes)
+   ------------------------------------------
+   | version |    flag     | elm_tot_length |... cont'd
+   ------------------------------------------
+        
+   <- 4 bytes  -> <- 4 bytes  -> <- 2 bytes -> <- 2 bytes -> (12 bytes)
+   ---------------------------------------------------------
+...| chunk_size  |  nt_size     | chk_tbl_tag | chk_tbl_ref | ...cont'd
+   ---------------------------------------------------------
+
+   <- 2 bytes -> <- 2 bytes -> <- 4 bytes -> (8 bytes)
+   ----------------------------------------
+...| sp_tag     | sp_ref      |  ndims   |  ...cont'd
+   ----------------------------------------
+
+   <- 4 bytes   -> <- 4 bytes -> <- 4 bytes -> (12 x ndims bytes)
+   --------------------------------------------
+...|    flag      | dim_length  | chunk_length |  ... x Number of dimensions
+   --------------------------------------------
+
+   <-      4 bytes    -> <- variable bytes -> 
+   ------------------------------------------
+...| fill_val_num_bytes | fill value......  |   ...(optional cont'd)
+   ------------------------------------------
+
+          Optinal number of these depending on multiple 'specialness'
+          set in 'flag' field.
+
+   <- 2 byte   -> <-      4 bytes  -> <- variable bytes -> (6 + variable bytes)
+   --------------------------------------------------------
+...| sp_tag_desc | sp_tag_header len | sp_tag_header......|...
+   --------------------------------------------------------
+
+   Fields
+   ------
+   sp_tag_desc     - SPECIAL_CHUNKED(16 bit constant), identifies this as
+                     a chunked element description record
+   sp_tag_head_len - length of this special element header only.(4 bytes)
+                     Does not include length of header with additional 
+                     'specialness' headers.
+                     NOTE: This is done to make this header layout similiar to the 
+                           multiple 'specialiness' layout.
+   version        - version info (8 bit field)
+   flag           - bit field to set additional specialness  (32 bit field)
+                    only bottom 8bits used for now.
+   elem_tot_len   - Valid logical Length of the entire element(4 bytes)
+                    The logical physical length is this value multiplied
+                    by 'nt_size'.
+                    The actual physical length used for storage can be
+                    greater than the dataset size due to ghost areas in
+                    chunks. Partial chunks are not distinguished from
+                    regular chunks.
+   chunk_size     - logical size of data chunks(4 bytes)
+   nt_size        - Number type size i.e size of data type (4 bytes)
+   chk_tbl_tag    - Tag of chunk table i.e. Vdata (2 bytes)
+   chk_tbl_ref    - Reference number of the chunk table
+                    i.e. Vdata (2 bytes)
+   sp_tag         - For future use i.e. special table for 'ghost' chunks(2 bytes)
+   sp_ref         - For future use(2 bytes)
+   ndims          - number of dimensions for the chunked element.(4 bytes)
+   file_val_num_bytes - number of bytes in fill value (4 bytes)
+   fill value         - fill value (variable bytes)
+
+   Fields for each dimension: (12 x ndims bytes)
+   --------------------------------------
+   flag           - (32 bit field) 
+                    |High 8bits|Medium High 8bits|Medium Low 8bit|Low 8bits|
+                    o distrib_type (Low 8 bits, bits 0-7) - 
+                      type of data distribution along this dimension 
+                      0x00->None, 
+                      0x01->Block
+                      Currently only block distribution is supported but
+                      this is not checked or verified for now.
+                    o other (Medium Low 8 bits, bits 7-15)
+                      0x00->Regular dimension, 
+                      0x01->UNLIMITED dimension
+   dim_length     - current length of this dimension. (4 bytes)
+   chunk_length   - length of the chunk along this dimension (4 bytes)
+
+   Fields for each additional 'specialness' (Optional)
+   -------------------------------------------
+   sp_tag_desc    - SPECIAL_xxx(16 bit constant), identifies this as
+                    a 'xxx' element description record .(16 bit field)
+   sp_tag_header_len - length of special element header(4 bytes)
+   sp_tag_header     - special header.(variable bytes)
+
+
+   Chunk Table(variable bytes per record in Vdata due to size of origin)
+   ====================================================================
+   <-  variable bytes -> <- 2 bytes -> <- 2 bytes -> 
+   -------------------------------------------------
+   |      origin        |  chunk_tag  | chunk_ref_1 |   
+   -------------------------------------------------
+           -                 -             -             N is number of
+           -                 -             -             chunk records
+           -                 -             -             in Vdata
+   -------------------------------------------------
+   |      origin        |  chunk_tag  | chunk_ref_N |
+   -------------------------------------------------
+                                 \______________/
+   __________________________________________|
+   V
+    <-   2 bytes  -> <- 2 bytes -> <- 4 bytes -> <- 4bytes ->
+    --------------------------------------------------------
+    | DFTAG_CHUNK   | chunk_ref_N |  Offset     |  Length    |
+    --------------------------------------------------------
+                                         \______________/
+        __________________________________________|
+        V
+        -----------------------
+        | Data_chunk          |
+        -----------------------
+                  Note: The "Length" here is specified by "chk_size" x "nt_size". 
+
+   Fields
+   ------
+   origin    - specifies the coordinates of the chunk in the overall
+               chunk array. (variable field, depends on number of 
+               dimensions of chunked element).
+   chunk_tag - DFTAG_CHUNK for now(could be another chunked element to
+               allow recursive chunked elements(DFTAG_CHUNKED)) (16 bit field)
+   chunk_ref - Reference number of chunk itself   (16 bit field)
+
+EXPORTED ROUTINES
+=================
+   User Public  
+   -----------
+   HMCcreate       -- create a chunked element
+   HMCwriteChunk   -- write out the specified chunk to a chunked element
+   HMCreadChunk    -- read the specified chunk from a chunked element
+   HMCsetMaxcache  -- maximum number of chunks to cache 
+   HMCPcloseAID    -- close file but keep AID active (For Hnextread())
+
+   Library Private
+   ---------------
+   HMCPstread      -- open an access record for reading
+   HMCPstwrite     -- open an access record for writing
+   HMCPseek        -- set the seek posn
+   HMCPchunkread   -- read a single chunk out of a chunked element
+   HMCPread        -- read some data out of a chunked element
+   HMCPchunkwrite  -- write out a single chunk to a chunked element
+   HMCPwrite       -- write out some data to a chunked element
+   HMCPinquire     -- Hinquire for chunked element
+   HMCPendacess    -- close a chunked element AID
+   HMCPinfo        -- return info about a chunked element
+   HMCPgetnumrecs  -- get the number of records in a chunked element
+
+   TBBT helper rotuines
+   -------------------
+   chkcompare      -- comprares 2 chunk records
+   chkfreekey      -- frees chunk key
+   chkdestroynode  -- destroys chunk record
+
+LOCAL ROUTINES
+==============
+   Chunking helper routines
+   ------------------------
+   create_dim_recs           -- create the appropriate arrays in memory
+   update_chunk_indices_seek -- translate seek pos to chunk and pos in chunk
+   compute_chunk_to_seek     -- translate chunk coordiantes to seek postion
+   update_chunk_indices      -- not used
+   compute_array_to_chunk    -- not used
+   calculate_num_to_chunk    -- not used
+   compute_chunk_to_array    -- translate chunk arrays to user array
+   compute_array_to_seek     -- translate user array to user seek position
+   calculate_seek_in_chunk   -- translate pos in chunk to seek pos in chunk
+   update_seek_pos_chunk     -- update chunk seek array with seek pos in chunk 
+   calculate_chunk_num       -- translate chunk coordinates to a number
+   calculate_chunk_for_chunk -- calculate number of bytes to operate on chunk
+
+   Common Routine
+   -------------
+   HMCIstaccess -- set up AID to access a chunked element
+
+   AUTHOR 
+   ------- 
+   -GeorgeV - 9/3/96
+*/
+
+/* For debugging */
+/*
+#define CHK_DEBUG_1
+#define CHK_DEBUG_2
+#define CHK_DEBUG_3
+#define CHK_DEBUG_4
+#define CHK_DEBUG_5
+#define CHK_DEBUG_10
+*/
+
+
+/* For Statistics from the chunk cache.
+   Note thate 'mache.c' must be compilied with -DSTATISTICS */
+/*
+#define STATISTICS 
+*/
+
+#define  _HCHUNKS_MAIN_  /* Master chunk handling file */
+#include "hdf.h"
+#include "hfile.h"
+#include "mcache.h" /* cache */
+#include "hchunks.h"
+
+/* private functions */
+PRIVATE int32 
+HMCIstaccess(accrec_t * access_rec,  /* IN: access record to fill in */
+             int16 acc_mode          /* IN: access mode */ );
+
+/* -------------------------------------------------------------------------
+NAME
+    create_dim_recs -- create the appropriate arrays in memory
+DESCRIPTION
+    Given number of dimensions create the following 3 arrays.
+    1. Dimension record array contains a record for each dimension.
+    2. Seek chunk indice array contains the seek postion relative to
+       the logical representation of the chunked array.
+    3. The seek position chunk array contains the seek postion 
+       relative to the chunk itself.
+    4. The user array contains the users seek postion in the element
+RETURNS
+    SUCCEED/FAIL
+
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE int32
+create_dim_recs(DIM_REC **dptr, /* OUT: dimension record pointers */
+                int32  **sbi,   /* OUT: seek chunk indices array */
+                int32  **spb,   /* OUT: seek pos w/ chunk array */
+                int32  **sui,   /* OUT: seek user indicies array */
+                int32 ndims     /* IN: number of dimension of element */)
+{
+    CONSTR(FUNC, "create_dim_recs");   /* for HERROR */
+    int32 i;
+    int32 ret_value = SUCCEED;
+
+    /* allocate space for demension records pointers */
+    if ((*dptr = (DIM_REC *)HDmalloc(sizeof(DIM_REC) * (size_t)ndims)) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* allocate space for seek chunk indices and chunk seek positions */
+    if ((*sbi = (int32 *)HDmalloc(sizeof(int32)*(size_t)ndims)) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    if ((*spb = (int32 *)HDmalloc(sizeof(int32)*(size_t)ndims)) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* allocate space for user seek indicies */
+    if ((*sui = (int32 *)HDmalloc(sizeof(int32)*(size_t)ndims)) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* for each dimension */
+    for (i = 0; i < ndims; i++)
+      {
+          /* Initialize values for dimension record */
+          (*dptr)[i].flag = 0;
+          (*dptr)[i].dim_length = 0;
+          (*dptr)[i].chunk_length = 0;
+          (*dptr)[i].distrib_type = 0;
+          (*dptr)[i].unlimited = 0;
+          (*dptr)[i].last_chunk_length = 0;
+          (*dptr)[i].num_chunks = 0;
+
+          (*sbi)[i] = 0;
+          (*spb)[i] = 0;
+          (*sui)[i] = 0;
+      } /* end for i */
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (*dptr != NULL)
+              HDfree(*dptr);
+          if (*sbi != NULL)
+              HDfree(*sbi);
+          if (*spb != NULL)
+              HDfree(*spb);
+          if (*sui != NULL)
+              HDfree(*sui);
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* end create_dim_recs() */
+
+/* -------------------------------------------------------------------------
+NAME
+    update_chunk_indicies_seek -- translate seek pos to chunk and pos in chunk
+DESCRIPTION
+    Give seek location within an element, calculate which chunk in
+    chunk array and position within chunk.
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+update_chunk_indicies_seek(int32 sloc,    /* IN: physical Seek loc in element */
+                           int32 ndims,   /* IN: number of dimensions of elem */
+                           int32 nt_size, /* IN: number type size */
+                           int32 *sbi,    /* IN: seek chunk indicies array */
+                           int32 *spb,    /* IN: seek pos w/ chunk array */
+                           DIM_REC *ddims /* IN: dim record ptrs */)
+{
+    int32 i;
+    int32 stmp;
+
+    /* adjust physical seek->logical seek by using number type size */
+    stmp = sloc / nt_size;
+#ifdef CHK_DEBUG_1
+          printf("ucis: sloc=%d, stmp=%d \n", sloc,stmp);
+#endif
+    for(i = ndims - 1; i >= 0 ; i--) 
+      { /* Calculate which chunk index in chunk representation */
+          sbi[i] = (int32)((stmp % ddims[i].dim_length) 
+                           / ddims[i].chunk_length);
+          /* calculate starting postion in the chunk itself */
+          spb[i] = (int32)((stmp % ddims[i].dim_length) 
+                           % ddims[i].chunk_length);
+
+          stmp = stmp / ddims[i].dim_length;
+      } /* end for i */
+#ifdef CHK_DEBUG_1
+    printf("ucis: chunk_array =(");
+    for(i = 0; i < ndims; i++) 
+        printf("%d%s", sbi[i], i!= ndims-1 ? ",":NULL);
+    printf(")\n");
+
+    printf("ucis: chunk_pos_array =(");
+    for(i = 0; i < ndims; i++) 
+        printf("%d%s", spb[i], i!= ndims-1 ? ",":NULL);
+    printf(")\n");
+#endif 
+} /* update_chunk_indicies_seek()*/
+
+#ifdef UNUSED
+/* -------------------------------------------------------------------------
+NAME
+    compute_chunk_to_seek -- translate chunk coordinates to chunk seek postion
+DESCRIPTION
+    Calculate new chunk seek postion given seek chunk array and seek postion
+    within that chunk array. 
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+compute_chunk_to_seek(int32 *chunk_seek, /* OUT: new physical chunk seek pos in element*/
+                     int32 ndims,       /* IN: number of dims */
+                     int32 nt_size,     /* IN: number type size */
+                     int32 *sbi,        /* IN: seek chunk array */
+                     int32 *spb,        /* IN; seek pos w/ chunk array */
+                     DIM_REC *ddims,    /* IN: dim record ptrs */
+                     int32 chunk_size   /* IN: physical size of chunk */)
+{
+    int32 j;
+    int32 new_seek;
+    int32 l_chunk_size = 0;
+
+    /* Adjust physical chunk_size -> logical chunk size by size of number type */
+    l_chunk_size = chunk_size / nt_size;
+
+    /* Calculate Seek Location in element 
+     * First calculste seek-chunk position in element
+     * i.e seek position according to chunk first */
+    *chunk_seek = sbi[ndims -1];
+    for(j = ndims - 1; j; j--) 
+      {
+          *chunk_seek = (*chunk_seek * ddims[j-1].num_chunks)
+              + sbi[j-1]; 
+      }
+
+    /* must get chunk_size from somewhere else
+     * to give us position in file relative to chunk.
+     * Next comes adjustment of seek for postion inside chunk*/
+    *chunk_seek *= l_chunk_size; 
+#ifdef CHK_DEBUG_1
+    printf("ccs:  chunk_seek = %d(chunk# %d)\n", *chunk_seek,
+           *chunk_seek/l_chunk_size);       
+#endif
+    /* Calculate seek position in chunk */
+    new_seek = spb[ndims - 1];
+    for(j = ndims - 1; j; j--) 
+      {
+          new_seek = (new_seek * ddims[j - 1].chunk_length) 
+              + spb[j - 1];
+      }
+
+    /* add seek position in chunk to seek-chunk offset */
+    new_seek += *chunk_seek;
+#ifdef CHK_DEBUG_1
+    printf("ccs:   calculated seek position in file is %d\n", new_seek);
+#endif
+
+    /* multiply by number type size to get new physical seek positon */
+    *chunk_seek = new_seek * nt_size;
+
+} /* compute_chunk_to_seek() */
+#endif /* UNUSED */
+
+#if 0 /* NOT USED */
+
+/* -------------------------------------------------------------------------
+NAME
+    update_chunk_indices
+DESCRIPTION
+    Given chunk size and current chunk in chunk array and postion within
+    that chunk, update to new chunk in chunk array and postion within 
+    the new chunk.
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+update_chunk_indices(int32 chunk_size, /* IN: physical size of chunk read/written*/
+                     int32 ndims,      /* IN: number of dimensions */
+                     int32 nt_size,    /* IN: number type size */
+                     int32 *sbi,       /* IN: seek chunk indicies array */
+                     int32 *spb,       /* IN: seek pos w/ chunk array */
+                     DIM_REC *ddims    /* IN: dim record ptrs */)
+{
+    int32 change = 1;
+    int32 index = 0;
+    int32 l_chunk_size = 0;
+#ifdef CHK_DEBUG_1
+    int32 i;
+#endif
+
+    /* Adjust physical chunk_size -> logical chunk size by size of number type */
+    l_chunk_size = chunk_size / nt_size;
+#ifdef CHK_DEBUG_1
+    printf("uci: l_chunk_size=%d \n", l_chunk_size);
+#endif
+    while(change && index < ndims) 
+      { /* add chunk written to current chunk dimension */
+          spb[index] += l_chunk_size;
+          change = 0;
+          if(spb[index] == ddims[index].chunk_length) 
+            { /* we've move to next chunk since we filled the previous one */
+#ifdef CHK_DEBUG_1
+                fprintf(stderr,"uci: going to next chunk along spb[%d] to access\n",
+                        index);
+#endif
+                spb[index] = 0; /* position at beginning of chunk */
+                if(++(sbi[index]) == ddims[index].num_chunks) 
+                  { /* we've written to all the chunks in this demension, 
+                       so reset for this dimension */
+#ifdef CHK_DEBUG_1
+                    fprintf(stderr,"uci: accessed all chunks along sbi[%d] so reset \n", 
+                            index);
+#endif
+                      sbi[index] = 0;
+                      change = 1;
+                  } 
+                index++; /* go to next dimension */
+                l_chunk_size = 1; 
+            }
+      } /* end while "change" */
+
+#ifdef CHK_DEBUG_1
+    printf("uci : sbi =(");
+    for(i = 0; i < ndims; i++) 
+        printf("%d%s", sbi[i], i!= ndims-1 ? ",":NULL);
+    printf(")\n");
+
+    printf("uci : spb =(");
+    for(i = 0; i < ndims; i++) 
+        printf("%d%s", spb[i], i!= ndims-1 ? ",":NULL);
+    printf(")\n");
+#endif 
+} /* update_chunk_indices() */
+
+/* -------------------------------------------------------------------------
+NAME
+    compute_array_to_chunk
+DESCRIPTION
+    Calculate chunk array indicies and position within chunk 
+    given user array indicies i.e. translates array postion in user 
+    array to position in overall chunk array and within the chunk.
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+compute_array_to_chunk(int32 *chunk_indicies, /* OUT: chunk indicies */
+                       int32 *chunk_array_ind,/* OUT: chunk array indices */
+                       int32 *array_indicies, /* IN: array indicies */
+                       int32 ndims,           /* IN: number of dims */
+                       DIM_REC *ddims         /* IN: dim record ptrs */ )
+{
+    int32 j;
+
+    for(j = 0; j < ndims; j++) 
+      {   /* set postion in overall chunk array */
+          chunk_indicies[j] = array_indicies[j] / ddims[j].chunk_length;
+          /* set postion within the chunk itself */
+          chunk_array_ind[j] = array_indicies[j] % ddims[j].chunk_length;
+      }
+} /* compute_array_to_chunk() */
+
+
+/* -------------------------------------------------------------------------
+NAME
+    calculate_num_to_chunk
+DESCRIPTION
+    Calculate seek chunk array given chunk number
+
+    Not implemented
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+calculate_num_to_chunk(int32 chunk_num, /* IN: chunk number within element */
+                       int32 ndims,     /* IN: number of dims */
+                       int32 *sbi,      /* IN/OUT: seek chunk array */
+                       DIM_REC *ddims   /* IN: dim record ptrs */ )
+{
+    int32 j;
+    int nchunk_num = chunk_num;
+   
+
+} /* calculate_num_chunk() */
+
+#endif /* NOT USED */
+
+/* -------------------------------------------------------------------------
+NAME
+    compute_chunk_to_array -- translate chunk arrays to user array
+DESCRIPTION
+    Calculate user array indicies given overall array chunk indicies 
+    and position within chunk. 
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+compute_chunk_to_array(int32 *chunk_indicies, /* IN: chunk indicies */
+                       int32 *chunk_array_ind,/* IN: chunk array indices */
+                       int32 *array_indicies, /* OUT: array indicies */
+                       int32 ndims,           /* IN: number of dims */
+                       DIM_REC *ddims         /* IN: dim record ptrs */ )
+{
+    int32 j;
+
+    for(j = 0; j < ndims; j++) 
+      {   /* set postion in using overall chunk array */
+          array_indicies[j] = chunk_indicies[j] * ddims[j].chunk_length;
+
+          /* set postion  using the chunk itself 
+             need to adjust for last chunk along each dimension */
+          if (chunk_indicies[j] == (ddims[j].num_chunks -1))
+            { /* last chunk along this dimension */
+              array_indicies[j] += (chunk_array_ind[j] > ddims[j].last_chunk_length)?
+                  ddims[j].last_chunk_length : chunk_array_ind[j];
+            }
+          else /* not last chunk along a dimension */
+              array_indicies[j] +=  chunk_array_ind[j];
+      }
+
+#ifdef CHK_DEBUG_1
+          printf("ccta: array_indicies:(");
+          for (j = 0; j < ndims; j++)
+              printf("%d%s", array_indicies[j], j!= ndims-1 ? ",":NULL);
+          printf(")\n");
+#endif
+} /* compute_chunk_to_array() */
+
+/* -------------------------------------------------------------------------
+NAME
+    compute_array_to_seek -- translate user array to user seek position
+DESCRIPTION
+    Computer user seek postion within element given user array.
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+compute_array_to_seek(int32 *user_seek,      /* OUT: user seek */
+                      int32 *array_indicies, /* IN: user array indicies */
+                      int32 nt_size,         /* IN: number type size */
+                      int32 ndims,           /* IN: number of dims */
+                      DIM_REC *ddims         /* IN: dim record ptrs */ )
+{
+    int32 j;
+    int32 cnum;
+
+    /* Calculate seek position within user array */
+    *user_seek = array_indicies[ndims - 1];
+    if (ndims > 1)
+      {   
+          cnum = 1;
+          for(j = ndims - 2; j >= 0 ; j--) 
+            {
+                cnum *= ddims[j + 1].dim_length;      
+                *user_seek += (array_indicies[j] * cnum );
+            }
+      }
+
+    /* multiply by number type size to get new physical user seek positon */
+    *user_seek = *user_seek * nt_size;
+   
+} /* compute_array_to_seek() */
+
+/* -------------------------------------------------------------------------
+NAME
+    calculate_seek_in_chunk -- translate pos in chunk to seek pos in chunk
+DESCRIPTION
+    Calculate seek postion within chunk
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+calculate_seek_in_chunk(int32 *chunk_seek,/* OUT: new physical seek pos in element*/
+                        int32 ndims,      /* IN: number of dims */
+                        int32 nt_size,    /* IN: number type size */
+                        int32 *spb,       /* IN; seek pos w/ chunk array */
+                        DIM_REC *ddims    /* IN: dim record ptrs */ )
+{
+    int32 j;
+    int32 cnum;
+
+    /* Calculate seek position within chunk */
+    *chunk_seek = spb[ndims - 1];
+    if (ndims > 1)
+      {   
+          cnum = 1;
+          for(j = ndims - 2; j >= 0 ; j--) 
+            {
+                cnum *= ddims[j + 1].chunk_length;      
+                *chunk_seek += (spb[j] * cnum );
+            }
+      }
+
+    /* multiply by number type size to get new physical seek positon */
+    *chunk_seek = *chunk_seek * nt_size;
+   
+} /* calculate_seek_in_chunk() */
+
+/* -------------------------------------------------------------------------
+NAME
+    update_seek_pos_chunk -- update chunk seek array with seek pos in chunk 
+DESCRIPTION
+    Update chunk seek array with seek pos in chunk. 
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+update_seek_pos_chunk(int32 chunk_seek, /* IN: physical seek pos in chunk */
+                      int32 ndims,      /* IN: number of dims */
+                      int32 nt_size,    /* IN: number type size */
+                      int32 *spb,       /* OUT: seek pos w/ chunk array */
+                      DIM_REC *ddims    /* IN: dim record ptrs */ )
+{
+    int32 i;
+    int32 stmp;
+
+    /* adjust physical seek->logical seek by using number type size */
+    stmp = chunk_seek / nt_size;
+
+    for(i = ndims - 1; i >= 0 ; i--) 
+      { 
+          /* calculate starting postion in the chunk itself */
+          spb[i] = (int32)(stmp % ddims[i].chunk_length);
+          stmp = stmp / ddims[i].chunk_length;
+      } /* end for i */
+
+#ifdef CHK_DEBUG_1
+    printf("uspc: spb[] =(");
+    for(i = 0; i < ndims; i++) 
+        printf("%d%s", spb[i], i!= ndims-1 ? ",":NULL);
+    printf(")\n");
+#endif    
+} /* update_seek_pos_chunk() */
+
+
+/* -------------------------------------------------------------------------
+NAME
+    calculate_chunk_num - translate chunk coordinates to a number
+DESCRIPTION
+    Calculate new chunk number given seek chunk array and seek postion
+    within that chunk array. 
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+calculate_chunk_num(int32 *chunk_num, /* OUT: new chunk number within element */
+                    int32 ndims,      /* IN: number of dims */
+                    int32 *sbi,       /* IN: seek chunk array */
+                    DIM_REC *ddims    /* IN: dim record ptrs */ )
+{
+    int32 j;
+    int32 cnum;
+
+    /* Calculate chunk number from overall chunk array indicies */
+    *chunk_num = sbi[ndims - 1];
+    if (ndims > 1)
+      {   
+          cnum = 1;
+          for(j = ndims - 2; j >= 0 ; j--) 
+            {
+                cnum *= ddims[j + 1].num_chunks;      
+                *chunk_num += (sbi[j] * cnum );
+            }
+      }
+
+} /* calculate_chunk_num() */
+
+/* -------------------------------------------------------------------------
+NAME
+    calculate_chunk_for_chunk - calculate number of bytes to operate on chunk
+DESCRIPTION
+  Given the length of bytes to operate on and the size of bytes
+  already operated on, calculate how big of chunk can be written
+  to the current chunk.
+RETURNS
+    Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+PRIVATE void
+calculate_chunk_for_chunk(int32 *chunk_size,   /* OUT: chunk size for this chunk */
+                          int32 ndims,         /* IN: number of dims */
+                          int32 nt_size,       /* IN: number type size */
+                          int32 len,           /* IN: total length to operate on */
+                          int32 bytes_finished,/* IN: bytes already operted on*/
+                          int32 *sbi,          /* IN: seek chunk array */
+                          int32 *spb,          /* IN: seek pos w/ chunk array */
+                          DIM_REC *ddims       /* IN: dim record ptrs */)
+{
+    /* Is this the last chunk along fastest changing dimension(i.e. subscript).
+       In future maybe need to handle variable case of any dimension being
+       the fastest. */
+    if (sbi[ndims - 1] == (ddims[ndims - 1].num_chunks - 1))
+      { /* last chunk */
+          /* Calculate size of chunk to write for the last chunk */
+          if ((ddims[ndims -1].last_chunk_length - spb[ndims - 1]) * nt_size 
+              > (len - bytes_finished))
+              *chunk_size = len - bytes_finished; /* less than a chunk to write */
+          else /* last full chunk */
+              *chunk_size = (ddims[ndims - 1].last_chunk_length - spb[ndims -1]) * nt_size; 
+
+      }
+    else /* not the last chunk */
+      {
+          /* Calculate size of chunk to write in this chunk */
+          if ((ddims[ndims -1].chunk_length - spb[ndims - 1]) * nt_size 
+              > (len - bytes_finished))
+              *chunk_size = len - bytes_finished; /* less than a chunk to write */
+          else /* full chunk */
+              *chunk_size = (ddims[ndims - 1].chunk_length - spb[ndims -1]) * nt_size; 
+      }
+} /* calculate_chunk_for_chunk() */
+
+/* -------------------------------------------------------------------------
+NAME
+    chkcompare
+DESCRIPTION
+   Compares two chunk B-tree keys for equality.  Similar to memcmp.
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+RETURNS
+
+AUTHOR
+   -GeorgeV - 9/3/96   
+---------------------------------------------------------------------------*/
+intn
+chkcompare(void * k1,   /* IN: first key */
+           void * k2,   /* IN: second key */
+           intn cmparg /* IN: not sure? */)
+{
+    intn  ret_value;
+    /* shut compiler up */
+    cmparg = cmparg;
+
+    /* valid for integer keys */
+    ret_value = ((intn) ((*(int32 *) k1) - (*(int32 *) k2)));    
+
+    return ret_value;
+}   /* chkcompare */
+
+/********* Helper fcns for dealing with chunk table TBBT tree ***************/
+
+/* -------------------------------------------------------------------------
+NAME
+    chkfreekey
+DESCRIPTION
+    Free key - used by tbbt routines 
+    *** Only called by B-tree routines, should _not_ be called externally ***
+
+RETURNS
+   Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+void
+chkfreekey(void * key /*IN: chunk key */ )
+{
+    if (key != NULL)
+        HDfree(key);
+} /* chkfreekey() */
+
+/* -------------------------------------------------------------------------
+NAME
+    chkdestroynode
+DESCRIPTION
+   Frees chunk B-Tree nodes
+   *** Only called by B-tree routines, should _not_ be called externally ***
+
+RETURNS
+   Nothing
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+void
+chkdestroynode(void * n /* IN: chunk record */ )
+{
+    CHUNK_REC *t=(CHUNK_REC *)n;
+
+    if (t != NULL)
+      {   
+          /* free orgin first */
+          if (t->origin != NULL)
+              HDfree(t->origin);
+
+          /* free chunk record structure */
+          HDfree((void *) t);
+      }
+}   /* chkdestroynode */
+
+/* ----------------------------- HMCIstaccess ------------------------------
+NAME
+   HMCIstaccess -- set up AID to access a chunked elem
+
+DESCRIPTION
+   Calls to HMCIstread and HMCIstwrite resolve to this function.
+   Given an active AID fill in all of the special information.
+   If this information has already been read in for a different
+   element use that else we must go out to the HDF file and
+   pull in the information ourselves
+
+   This routine also creates the chunk cache for the chunked element. 
+   The cache is initialzed with the physical size of each chunk, 
+   the number of chunks in the object i.e. object size/ chunk size,
+   and the maximum number of chunks to cache in memory. Chunks in
+   the cache are dealt with by their number i.e. translation of
+   'origin' of chunk to a unique number. The default maximum number
+   of chunks is the cache is set the number of chunks along the
+   last dimension.
+
+   NOTE: The cache itself could be used to cache any object into a number 
+   of fixed size chunks so long as the read/write(page-in/page-out) routines know
+   how to deal with getting the correct chunk based on a number. These
+   routines can be found in 'mcache.c'.
+
+RETURNS
+   The AID of the access record on success FAIL on error.
+AUTHOR
+   -GeorgeV - 9/3/96
+----------------------------------------------------------------------------*/
+PRIVATE int32
+HMCIstaccess(accrec_t *access_rec, /* IN: access record to fill in */
+             int16 acc_mode        /* IN: access mode */)
+{
+    CONSTR(FUNC, "HMCIstaccess");    /* for HERROR */
+    filerec_t  *file_rec = NULL;     /* file record */
+    chunkinfo_t *info    = NULL;     /* information about data elt */
+    int32       dd_aid;              /* AID for writing the special info */
+    uint16      data_tag, data_ref;  /* Tag/ref of the data in the file */
+    uint8       local_ptbuf[6];      /* 6 bytes for special header length */
+#if 0
+    uint8       *c_sp_header = NULL;   /* special element header(dynamic) */
+#endif
+    uint8       c_sp_header[256]="" ;   /* special element header buffer.
+                                           dynamic allocation causes 
+                                           a problem on the HPUX -GV */
+    int32       interlace;           /* type of interlace */
+    int32       vdata_size;          /* size of Vdata */
+    int32       num_recs;            /* number of Vdatas */
+    uint8       *v_data = NULL;      /* Vdata record */
+    CHUNK_REC   *chkptr = NULL;      /* Chunk record */
+    int32       *chk_key   = NULL;   /* chunk key */
+    int32       npages     = 1;      /* number of chunks */
+    int32       chunks_needed;       /* default chunk cache size  */
+    int32       access_aid = FAIL;   /* access id */
+    int32       ret_value = SUCCEED;
+    char        name[VSNAMELENMAX + 1];  /* Vdata name */
+    char        class[VSNAMELENMAX + 1]; /* Vdata class */
+    char        v_class[VSNAMELENMAX + 1] = ""; /* Vdata class for comparison */
+    intn        i,j,k;                     /* loop indicies */
+
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+        
+    /* validate file record id */
+    file_rec = HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec) || !(file_rec->access & acc_mode))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* set up some data in access record */
+    access_rec->special = SPECIAL_CHUNKED;
+    access_rec->posn    = 0;
+    access_rec->access  = (uint32)(acc_mode|DFACC_READ);
+
+    /*
+     * Lets free old special info first,if one exists,
+     * before copying a new one
+     *
+     * Hmm.....this is what other special elements do currently
+     * don't know if this is really necessary.....but leave in for now..
+     */
+    if (access_rec->special_info != NULL)
+      {   /* special information record */
+          chunkinfo_t *tmpinfo = (chunkinfo_t *) access_rec->special_info;
+
+          if (--(tmpinfo->attached) == 0)
+            {   /* the last one so now.. */
+                /* free old info from Chunk tables ..etc*/
+
+                /* Sync chunk cache */
+                mcache_sync(info->chk_cache);
+
+                /* close/free chunk cache */
+                mcache_close(info->chk_cache);
+
+                /* Use Vxxx interface to free Vdata info */
+                VSdetach(info->aid);
+
+                /* free chunk tree */
+                tbbtdfree(info->chk_tree, chkdestroynode, chkfreekey);
+
+                /* free up stuff in special info */
+                if (tmpinfo->ddims != NULL)
+                    HDfree(tmpinfo->ddims);
+                if (tmpinfo->seek_chunk_indices != NULL)
+                    HDfree(tmpinfo->seek_chunk_indices);
+                if (tmpinfo->seek_pos_chunk != NULL)
+                    HDfree(tmpinfo->seek_pos_chunk);
+                if (tmpinfo->seek_user_indices != NULL)
+                    HDfree(tmpinfo->seek_user_indices);
+
+                if (tmpinfo->fill_val != NULL)
+                    HDfree(tmpinfo->fill_val);
+
+                if (tmpinfo->comp_sp_tag_header != NULL)
+                    HDfree(tmpinfo->comp_sp_tag_header);
+                if (tmpinfo->cinfo != NULL)
+                    HDfree(tmpinfo->cinfo);
+                if (tmpinfo->minfo != NULL)
+                    HDfree(tmpinfo->minfo);
+                /* free info struct last */
+                HDfree(tmpinfo);
+
+                access_rec->special_info = NULL;
+            }
+      } /* end if special->info already */
+
+    /* get the info for the dataset i.e. tag/ref*/
+    /* get info about chunk table i.e. Vdata? */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,NULL,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* if the special information are already in some other acc elt,
+     * point to it  and return */
+    access_rec->special_info = HIgetspinfo(access_rec);
+    if (access_rec->special_info)
+      { /* special info exists */
+          ((chunkinfo_t *) access_rec->special_info)->attached++;
+          file_rec->attach++;
+          info = (chunkinfo_t *) access_rec->special_info;          
+          /* set return value */
+          access_aid = HAregister_atom(AIDGROUP,access_rec);
+      }
+    else /* need to allocate a new special info and get it */
+      {
+          /* allocate space for special chunk info */
+          if ((info = (chunkinfo_t *)HDmalloc(sizeof(chunkinfo_t))) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          info->seek_chunk_indices = NULL;
+          info->seek_pos_chunk     = NULL;
+          info->seek_user_indices = NULL;
+          info->ddims     = NULL;
+          info->chk_tree  = NULL;
+          info->chk_cache = NULL;
+          info->fill_val  = NULL;
+          info->minfo     = NULL;
+          info->cinfo     = NULL;
+          info->comp_sp_tag_header   = NULL;
+          info->comp_sp_tag_head_len = 0;
+          info->num_recs  = 0; /* zero records to start with */
+
+          /* read the special info structure from the file */
+          if((dd_aid=Hstartaccess(access_rec->file_id,data_tag,data_ref,DFACC_READ))==FAIL)
+              HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+
+          if (Hseek(dd_aid, 2, DF_START) == FAIL)
+              HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+
+          /* first read special tag header length which is 4 bytes */
+          if (Hread(dd_aid, 4, local_ptbuf) == FAIL)
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+
+          /* Decode it */
+          {
+              uint8      *p = local_ptbuf;
+              INT32DECODE(p, info->sp_tag_header_len);   /* 4 bytes */          
+          }
+
+          /* Sanity check, the 256 limit is arbitrary and can 
+             be removed later....*/
+          if (info->sp_tag_header_len < 0 || info->sp_tag_header_len > 256)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+#if 0 /* dynamic alocation causes a problem on HPUX, removed for now -GV */
+          /* Allocate buffer space for rest of special header */
+          if (( c_sp_header = (uint8 *) HDcalloc(info->sp_tag_header_len,1))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+#endif
+          /* first read special header in */
+          if (Hread(dd_aid, info->sp_tag_header_len, c_sp_header) == FAIL)
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+
+          /* decode first special element header  */
+          {
+              uint8      *p = c_sp_header;
+
+              /* version info */
+              HDmemcpy(&info->version,p,1);      /* 1 byte  */
+              p = p + 1;
+
+              /* Should check version here to see if we can handle 
+                 this version of special format header before we go on */
+              if (info->version != _HDF_CHK_HDR_VER)
+                  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+              INT32DECODE(p, info->flag);         /* 4 bytes */
+              INT32DECODE(p, info->length);       /* 4 bytes */
+              INT32DECODE(p, info->chunk_size);   /* 4 bytes */
+              INT32DECODE(p, info->nt_size);      /* 4 bytes */
+              UINT16DECODE(p, info->chktbl_tag);  /* 2 bytes */
+              UINT16DECODE(p, info->chktbl_ref);  /* 2 bytes */
+              UINT16DECODE(p, info->sp_tag);      /* 2 bytes */
+              UINT16DECODE(p, info->sp_ref);      /* 2 bytes */
+              INT32DECODE(p, info->ndims);        /* 4 bytes */
+                                                  /* = 29 bytes */
+              /* create dimension, seek_block and seek_pos arrays 
+                 given number of dims */
+              if (create_dim_recs(&(info->ddims),&(info->seek_chunk_indices),
+                                  &(info->seek_pos_chunk),
+                                  &(info->seek_user_indices),info->ndims) == FAIL)
+                  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+              /* decode dimension stuff */
+              for (j = 0; j < info->ndims; j++)
+                {
+                    int32 odd_size;
+
+                    INT32DECODE(p,(info->ddims[j].flag));          /* 4 bytes */
+                    INT32DECODE(p,(info->ddims[j].dim_length));    /* 4 bytes */
+                    INT32DECODE(p,(info->ddims[j].chunk_length));  /* 4 bytes */
+                                                                  /* = 12 bytes */  
+
+                    /* check 'flag' and decode settings */
+                    info->ddims[j].distrib_type = (int32)(0xff & info->ddims[j].flag);
+                    info->ddims[j].unlimited = (int32)
+                                    (0xff & ((uint32)(info->ddims[j].flag >> 8)));
+
+                    info->ddims[j].num_chunks = info->ddims[j].dim_length /
+                        info->ddims[j].chunk_length;
+                    /* check to see if need to increase # of chunks along this dim*/
+                    if ((odd_size = (info->ddims[j].dim_length % info->ddims[j].chunk_length)))
+
+                      {
+                          info->ddims[j].num_chunks++; /* increase by one */
+                          /* set last chunk length */
+                          info->ddims[j].last_chunk_length = odd_size; 
+                      }
+                    else
+                        info->ddims[j].last_chunk_length = info->ddims[j].chunk_length; /*  */	    
+
+                    npages = npages * info->ddims[j].num_chunks;
+                }   /* = 12 x ndims bytes */
+
+              /* decode fill value length */
+              INT32DECODE(p,(info->fill_val_len));   /* 4 bytes */
+
+              /* allocate space for fill value */
+              if ((info->fill_val = HDmalloc((size_t)info->fill_val_len ))==NULL)
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+              /* finally decode fill value */
+              HDmemcpy(info->fill_val,p, info->fill_val_len); /* 1 byte */
+
+          } /* end decode special header */
+
+          /* if multiply special deal with now */
+          switch(info->flag & 0xff) /* only using 8bits for now */
+            {
+            case SPECIAL_COMP:
+            {
+                uint16     sp_tag;
+
+                /* first read specail tag header length which is 2+4 bytes */
+                if (Hread(dd_aid, 6, local_ptbuf) == FAIL)
+                    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                /* Decode compression header length */
+                {
+                    uint8      *p = NULL;
+
+                    p = local_ptbuf;
+                    UINT16DECODE(p, sp_tag);                     /* 2 bytes */
+                    INT32DECODE(p, info->comp_sp_tag_head_len);   /* 4 bytes */      
+                }
+
+                /* Sanity check */
+                if (info->sp_tag_header_len < 0 || sp_tag != SPECIAL_COMP)
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+                /* Allocate buffer space for compression special header */
+                if (( info->comp_sp_tag_header = HDcalloc(info->comp_sp_tag_head_len,1))==NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* read special header in */
+                if (Hread(dd_aid, info->comp_sp_tag_head_len, info->comp_sp_tag_header) == FAIL)
+                    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                /* allocate compression special info  */
+                if (( info->cinfo = (comp_info *) HDmalloc(sizeof(comp_info)))==NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                if (( info->minfo = (model_info *) HDmalloc(sizeof(model_info)))==NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* Decode header */
+                if (HCPdecode_header((uint8 *)info->comp_sp_tag_header,
+                                     (comp_model_t *)&info->model_type, info->minfo, 
+                                     (comp_coder_t *)&info->comp_type, info->cinfo) == FAIL)
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            }
+              break;
+            default:
+                /* Do nothing */
+                break;
+            } /* end switch on specialness */
+
+          /* end access to special info stuff */
+          if(Hendaccess(dd_aid)==FAIL)
+              HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+          /* set up the chunk tables of the information */
+          /* intialize TBBT tree of CHUNK records*/
+          info->chk_tree = tbbtdmake(chkcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+
+          /* Use Vdata interface to read in chunk table and
+             store per chunk-info in memory using TBBT trees  */ 
+
+          /* Start access on Vdata */
+          if(Vstart(access_rec->file_id) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          /* Attach to Vdata with write access if we are writing 
+             else read access */
+          if (access_rec->access & DFACC_WRITE)
+            {
+                if((info->aid = VSattach(access_rec->file_id, (int32)info->chktbl_ref, "w")) == FAIL)
+                    HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+            }
+          else /* attach with read access only */
+            {
+                if((info->aid = VSattach(access_rec->file_id, (int32)info->chktbl_ref, "r")) == FAIL)
+                    HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+            }
+
+          /* get relevant info on Vdata */
+          if ((VSinquire(info->aid, &num_recs, &interlace, NULL, &vdata_size, name)) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          /* Get class of Vdata */
+          if ((VSgetclass(info->aid, class)) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          /* verify class and version */
+          sprintf(v_class,"%s%d",_HDF_CHK_TBL_CLASS,_HDF_CHK_TBL_CLASS_VER);
+          if (HDstrncmp(class,v_class,HDstrlen(v_class)) != 0 )
+            {
+#ifdef CHK_DEBUG_2
+                fprintf(stderr," error, wrong class=%s, %d \n",class,HDstrlen(class));
+                fprintf(stderr,"            v_class=%s, %d \n",v_class,HDstrlen(v_class));
+#endif
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            }
+
+          /* Check to see if any chunks have been written out yet */
+          if (num_recs > 0)
+            { /* Yes */
+                /* Set the fields to read */
+                if(VSsetfields(info->aid,_HDF_CHK_FIELD_NAMES)==FAIL)
+                    HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+                /* Allocate space for a single Vdata record */
+                if ((v_data = HDmalloc((size_t)vdata_size)) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* for each record read it in and put into TBBT tree 
+                   NOTE: Should change this to a single VSread() but then
+                   would have to store all the v_data rec's somewhere
+                   before inserting them into the TBBT tree...
+                   ....for somone to do later if performance of VSread() is bad.
+                   Technically a B+-Tree should have been used instead or
+                   better yet the Vdata implementation should be re-written to use one.
+                   Note that chunk tag DTAG_CHUNK is not verified here.
+                   It is checked in HMCPchunkread() before the chunk is read. */
+                for (j = 0; j < num_recs; j++)
+                  {
+                      uint8 *pntr = NULL;
+
+                      /* read single record */
+                      if(VSread(info->aid,v_data,1,FULL_INTERLACE)==FAIL)
+                          HGOTO_ERROR(DFE_VSREAD,FAIL);
+        
+                      pntr = v_data; /* set pointer to vdata record */
+
+                      /* Allocate space for a chunk record */
+                      if ((chkptr = (CHUNK_REC *) HDmalloc(sizeof(CHUNK_REC))) == NULL)
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                      /* Allocate space for a origin in chunk record */
+                      if ((chkptr->origin = (int32 *) HDmalloc((size_t)info->ndims*sizeof(int32))) == NULL)
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                      /* allocate space for key */
+                      if ((chk_key = (int32 *)HDmalloc(sizeof(int32))) == NULL)
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                      /* Copy origin first */
+                      for (k = 0; k < info->ndims; k++)
+                        {
+                            HDmemcpy(&chkptr->origin[k],pntr,sizeof(int32));
+                            pntr += sizeof(int32);
+
+                        }
+
+#ifdef CHK_DEBUG_2
+                      printf(" chkptr->origin = (");
+                      for (k = 0; k < info->ndims; k++)
+                          printf("%d%s", chkptr->origin[k], k!= info->ndims-1 ? ",":NULL);
+                      printf("), ");
+#endif
+
+                      /* Copy tag next. 
+                         Note: Verification of tag as DTAG_CHUNK is done in
+                         HMCPchunkread() before the chunk object is read.
+                         In the future the tag/ref pair could point to
+                         another chunk table...etc.
+                         */
+                      HDmemcpy(&chkptr->chk_tag,pntr,sizeof(uint16));
+                      pntr += sizeof(uint16);
+#ifdef CHK_DEBUG_2
+                      printf(" chktpr->chk_tag=%d, ",chkptr->chk_tag);
+#endif
+                      /* Copy ref last */
+                      HDmemcpy(&chkptr->chk_ref,pntr,sizeof(uint16));
+#ifdef CHK_DEBUG_2
+                      printf(" chktpr->chk_ref=%d, ",chkptr->chk_ref);
+                      printf("\n");
+#endif
+                      /* now compute chunk number from origin */
+                      calculate_chunk_num(chk_key, info->ndims, chkptr->origin, 
+                                          info->ddims);
+
+                      chkptr->chunk_number = *chk_key; 
+
+                      /* set chunk number to record number */
+                      chkptr->chk_vnum = info->num_recs++;
+
+                      /* add to TBBT tree based on chunk number as the key */
+                      tbbtdins(info->chk_tree, chkptr , chk_key);   
+                  } /* end for num_recs */
+            } /* end if num_recs */
+
+          /* set return value */
+          access_aid = HAregister_atom(AIDGROUP,access_rec);
+
+          /* create chunk cache with 'maxcache' set to the number of chunks
+             along the last dimension i.e subscript changes the fastest*/
+	  chunks_needed = 1;
+	  for (i = 1; i < info->ndims; i++) {
+		chunks_needed *= info->ddims[i].num_chunks;
+	  }
+          if ((info->chk_cache = 
+               mcache_open(&access_rec->file_id,                   /* cache key */
+                           access_aid,                             /* object id */
+                           (info->chunk_size*info->nt_size),       /* chunk size */
+                           chunks_needed, /* maxcache */
+                           npages,                                 /* num chunks */
+                           0                                       /* flags */)) 
+              == NULL)
+              HE_REPORT_GOTO("failed to find initialize chunk cache", FAIL);
+
+          /* set up chunk read/write routines 
+             These routines do the actual reading/writing of data 
+             from the file in whole chunks only. */
+          mcache_filter(info->chk_cache, /* cache handle */
+                        HMCPchunkread,   /* page-in routine */
+                        HMCPchunkwrite,  /* page-out routine */
+                        access_rec       /* object handle */);
+
+          /* update chunk info data and file record info */
+          info->attached = 1;
+          file_rec->attach++;
+          access_rec->special_info = (chunkinfo_t *) info;
+      } /* end else need to get special info */
+
+    /* access to data elments is done on a per chunk basis which
+       can only be done in the read/write routines 
+       i.e. the cache pagin/pageout routines....*/    
+
+    ret_value = access_aid;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+          /* free info struct */
+          if (info != NULL)
+            {
+                if (info->chk_cache != NULL)
+                  {
+                      /* Sync chunk cache */
+                      mcache_sync(info->chk_cache);
+
+                      /* close/free chunk cache */
+                      mcache_close(info->chk_cache);
+                  }
+
+                if (info->aid != FAIL)
+                    VSdetach(info->aid);
+
+                /* free chunk tree */
+                if (info->chk_tree != NULL)
+                    tbbtdfree(info->chk_tree, chkdestroynode, chkfreekey);
+
+                /* free up stuff in special info */
+                if (info->ddims != NULL)
+                    HDfree(info->ddims);
+                if (info->seek_chunk_indices != NULL)
+                    HDfree(info->seek_chunk_indices);
+                if (info->seek_pos_chunk != NULL)
+                    HDfree(info->seek_pos_chunk);
+                if (info->seek_user_indices != NULL)
+                    HDfree(info->seek_user_indices);
+                if (info->fill_val != NULL)
+                    HDfree(info->fill_val);
+                if (info->comp_sp_tag_header != NULL)
+                    HDfree(info->comp_sp_tag_header);
+                if (info->cinfo != NULL)
+                    HDfree(info->cinfo);
+                if (info->minfo != NULL)
+                    HDfree(info->minfo);
+
+                HDfree(info);
+
+                access_rec->special_info = NULL;
+            }
+
+      } /* end if */
+
+    /* Normal function cleanup */
+#if 0 /* dynamic alocation causes a problem on HPUX, removed for now -GV */
+    /* free specail element header */
+    if (c_sp_header != NULL)
+        HDfree(c_sp_header);
+#endif
+    /* free allocated space for vdata record */
+    if (v_data != NULL)
+        HDfree(v_data);
+
+    return ret_value;
+}   /* HMCIstaccess */
+
+/* ------------------------------------------------------------------------
+NAME
+   HMCcreate -- create a chunked element
+
+DESCRIPTION
+   This routine takes an HDF element and promotes it into a 
+   chunked element.  Basically, the element becomes a chunked element
+   allowing easy appending where the chunk records are stored in
+   a Vdata.  If the element already exists, this is an error currently 
+   otherwise a new element is created.
+
+   All of the pieces of the chunked element are the same size from
+   the stand point of the element. If compression is used then
+   each chunk is compressed and the compression layer takes
+   care of it as the chunk layer sees each chunks as a seperate
+   HDF object(DFTAG_CHUNK). The proper compression special header
+   needs to be passed to the compression layer.
+
+   The Vdata(chunk table) is made appendable with linked-block
+   table size of 128.
+
+   This routine also creates the chunk cache for the chunked element. 
+   The cache is initialzed with the physical size of each chunk, 
+   the number of chunks in the object i.e. object size/ chunk size,
+   and the maximum number of chunks to cache in memory. Chunks in
+   the cache are dealt with by their number i.e. translation of
+   'origin' of chunk to a unique number. The default maximum number
+   of chunks is the cache is set the number of chunks along the
+   last dimension.
+
+   NOTE: The cache itself could be used to cache any object into a number 
+   of fixed size chunks so long as the read/write(page-in/page-out) routines know
+   how to deal with getting the correct chunk based on a number.These
+   routines can be found in 'mcache.c'.
+
+RETURNS
+   The AID of newly created chunked element, FAIL on error.
+AUTHOR
+   -GeorgeV - 9/3/96
+ --------------------------------------------------------------------------- */
+int32
+HMCcreate(int32 file_id,       /* IN: file to put chunked element in */
+          uint16 tag,          /* IN: tag of element */
+          uint16 ref,          /* IN: ref of element */
+          uint8 nlevels,       /* IN: number of levels of chunks */
+          int32 fill_val_len,  /* IN: fill value length in bytes */
+          void *fill_val,      /* IN: fill value */
+          HCHUNK_DEF *chk_array /* IN: structure describing chunk distribution
+                                  can be an array? but we only handle 1 level */ )
+{
+    CONSTR(FUNC, "HMCcreate");     /* for HERROR */
+    filerec_t  *file_rec   = NULL; /* file record */
+    accrec_t   *access_rec = NULL; /* access record */
+    int32       dd_aid     = FAIL; /* AID for writing the special info */
+    chunkinfo_t *info      = NULL; /* information for the chunked elt */
+    uint8       *c_sp_header = NULL; /* special element header */
+    int32       npages     = 1;    /* i.e. number of chunks in element */
+    int32       chunks_needed;     /* default size of chunk cache */
+    int32       access_aid = FAIL; /* access id */
+    uint16      chktbl_ref;        /* the ref of the link structure
+                                      chunk table i.e. Vdata */
+    uint16      special_tag;       /* special version of this tag */
+    atom_t      data_id;           /* dd ID of existing regular element */
+    int32       sp_tag_header_len = 0; /* length of special header */
+    int32       data_len   = 1;        /* logical length of element */
+    int32       ret_value  = SUCCEED;
+    char        v_name[VSNAMELENMAX + 1] = "";/* name of vdata i.e. chunk table */
+    char        v_class[VSNAMELENMAX + 1] = ""; /* Vdata class */
+    intn        i;                 /* loop index */
+
+    /* shut compiler up */
+    nlevels=nlevels;
+
+    /* clear error stack and validate file record id */
+    HEclear();
+    file_rec = HAatom_object(file_id);
+
+    /* validate args */
+    if (BADFREC(file_rec) || chk_array == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check file access for write */
+    if (!(file_rec->access & DFACC_WRITE))
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+
+    /* check if we are accidently passwed a special tag already */
+    if(SPECIALTAG(tag)
+       || (special_tag = MKSPECIALTAG(tag)) == DFTAG_NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get empty slot in access records */
+    access_rec = HIget_access_rec();
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_TOOMANY, FAIL);
+
+    /* search for identical dd */
+    if ((data_id = HTPselect(file_rec,tag,ref))!=FAIL)
+      {
+          /*  this is where if a tag was already special i.e. compressed
+              we would have to note it and promote it maybe? */
+          /* Check if the element is already special */
+          if (HTPis_special(data_id)==TRUE)
+            {
+                HTPendaccess(data_id);
+                HGOTO_ERROR(DFE_CANTMOD, FAIL);
+            }   /* end if */
+
+      } /* end if */
+
+    /* In theory we can have more than one level of chunks so 
+       we need to repeat the following steps. This would
+       allow subchunking but currently haven't decided how
+       the user would pass this info to routine to create the
+       proper chunk tables...etc.
+
+       Do we need to create special chunk table to handle the
+       special chunks i.e. ghost chunks.-> Pass on this for now  */
+
+#if 0
+    /* Okay we need to get a new ref for CHUNK table tag for first level */
+    chktbl_ref = Htagnewref(file_id,DFTAG_CHUNKED);
+#endif
+
+    /* allocate and fill in special chunk info struct for CHUNKs */
+    if (( info = (chunkinfo_t *) HDmalloc(sizeof(chunkinfo_t)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    info->attached     = 1;
+    info->aid          = FAIL;
+    info->version      = _HDF_CHK_HDR_VER ;     /* verson 1 for now */
+    info->flag         = chk_array->chunk_flag; /* SPECIAL_COMP ? */
+    info->cinfo        = NULL;
+    info->minfo        = NULL; 
+    info->comp_sp_tag_head_len = 0;
+    info->comp_sp_tag_header   = NULL;
+    info->chunk_size   = chk_array->chunk_size; /* logical chunk size */
+    info->nt_size      = chk_array->nt_size;    /* number type size */
+    info->ndims        = chk_array->num_dims;   /* number of dimensions */
+    info->sp_tag       = DFTAG_NULL;            /* not used currently */
+    info->sp_ref       = 0;                     /* not used currently */
+    info->seek_chunk_indices = NULL;
+    info->seek_pos_chunk = NULL;
+    info->seek_user_indices = NULL;
+    info->ddims          = NULL;
+    info->chk_tree       = NULL;
+    info->chk_cache      = NULL;
+    info->num_recs       = 0;                   /* zero Vdata records to start */
+    info->fill_val_len   = fill_val_len;        /* length of fill value */
+    /* allocate space for fill value */
+    if (( info->fill_val = HDmalloc((uint32)fill_val_len))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    /* copy fill value over */
+    HDmemcpy(info->fill_val, fill_val, info->fill_val_len); /* fill_val_len bytes */
+
+    /* if compression set then fill in info i.e ENCODE for storage */
+    switch(info->flag & 0xff) /* only using 8bits for now */
+      {
+      case SPECIAL_COMP:
+          /* set compression info */
+          /* allocate compression special info  */
+          if (( info->cinfo = (comp_info *) HDmalloc(sizeof(comp_info)))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          if (( info->minfo = (model_info *) HDmalloc(sizeof(model_info)))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          
+          /* find compression header length */
+          info->comp_sp_tag_head_len = HCPquery_encode_header(
+              (comp_model_t)chk_array->model_type, chk_array->minfo, 
+              (comp_coder_t)chk_array->comp_type, chk_array->cinfo);
+
+          /* allocate space for compression header */
+          if (( info->comp_sp_tag_header = HDmalloc((size_t)info->comp_sp_tag_head_len))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* Encode header for storage */
+          if (HCPencode_header((uint8 *)info->comp_sp_tag_header,
+                               (comp_model_t)chk_array->model_type, chk_array->minfo, 
+                               (comp_coder_t)chk_array->comp_type, chk_array->cinfo) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          /* Decode header back for memory */
+          if (HCPdecode_header((uint8 *)info->comp_sp_tag_header,
+                               (comp_model_t *)&info->model_type, info->minfo, 
+                               (comp_coder_t *)&info->comp_type, info->cinfo) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+          break;
+      default:
+          /* Do nothing */
+          break;
+      } /* end switch on specialness */
+
+    /* Use Vxxx interface to create new Vdata to hold Chunk table */
+    /* create/intialize chunk table (Vdata ) */
+
+    /* Start access on Vdata */
+    if(Vstart(file_id) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Create Vdata */
+    if((info->aid = VSattach(file_id, -1, "w")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+    /* get ref of Vdata */
+    chktbl_ref = (uint16)VSQueryref(info->aid);
+
+    info->chktbl_ref      = chktbl_ref; /* ref of chunk table */
+
+    /* get tag of Vdata */
+    info->chktbl_tag = (uint16)VSQuerytag(info->aid);
+
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCcreate: info->chktbl_tag =%d, info->chktbl_ref=%d \n", 
+            info->chktbl_tag, info->chktbl_ref);
+#endif
+    /* Define fields of chunk table i.e. Vdata */
+
+    /* Define origin - order based on number of dims */
+    if(VSfdefine(info->aid,_HDF_CHK_FIELD_1, DFNT_INT32,info->ndims) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Define tag of chunk 
+       Note that the tag could be another Chunk table to
+       represent another level. useful for quadtrees...etc. */
+    if(VSfdefine(info->aid,_HDF_CHK_FIELD_2, DFNT_UINT16,1) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Define ref of chunk 
+       Note that the ref could be that of another Chunk table to
+       represent another level. useful for quadtrees...etc. */
+    if(VSfdefine(info->aid,_HDF_CHK_FIELD_3, DFNT_UINT16,1) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Set Vdata name based on tag and ref of element and of tag/ref of Vdata.
+       ...sort of a back pointer...so sue me...*/
+    sprintf(v_name,"%s%d_%d_%d_%d",_HDF_CHK_TBL_NAME,tag, ref,
+            info->chktbl_tag, info->chktbl_ref);
+    if(VSsetname(info->aid,v_name) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Set Vdata class and version */
+    sprintf(v_class,"%s%d",_HDF_CHK_TBL_CLASS,_HDF_CHK_TBL_CLASS_VER);
+    if(VSsetclass(info->aid,v_class) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Set the fields to write */
+    if(VSsetfields(info->aid,_HDF_CHK_FIELD_NAMES)==FAIL)
+        HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+    /* create dimension, seek_block and seek_pos arrays given number of dims */
+    if (create_dim_recs(&(info->ddims),&(info->seek_chunk_indices),
+                        &(info->seek_pos_chunk),
+                        &(info->seek_user_indices),info->ndims) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Copy info from input to dimension arrays */
+    data_len = 1;
+    for (i = 0; i < info->ndims; i++)
+      {
+          int32 odd_size;
+
+          info->ddims[i].distrib_type = chk_array->pdims[i].distrib_type;
+          if (chk_array->pdims[i].dim_length == 0) /* check unlimited dimension */
+            { /* yes, UNLIMITED */
+                info->ddims[i].unlimited = 1; /* set flag */
+                /* set dimension length to be at least the chunk length
+                   along this dimension */
+                info->ddims[i].dim_length = chk_array->pdims[i].chunk_length;
+            }
+          else /* not an unlimited dimension */
+              info->ddims[i].dim_length = chk_array->pdims[i].dim_length;
+
+          /* set dimension 'flag' */
+          info->ddims[i].flag = 
+          (int32)(0xffff & ((info->ddims[i].unlimited << 8)
+                             | (info->ddims[i].distrib_type)));
+
+          info->ddims[i].chunk_length = chk_array->pdims[i].chunk_length;
+          info->ddims[i].num_chunks = info->ddims[i].dim_length /
+                                      info->ddims[i].chunk_length;
+          /* check to see if need to increase # of chunks along this dim */
+          if ((odd_size = (info->ddims[i].dim_length % info->ddims[i].chunk_length)))
+            {
+                info->ddims[i].num_chunks++; /* increase by one */
+                /* set last chunk length */
+                info->ddims[i].last_chunk_length = odd_size; 
+            }
+          else
+              info->ddims[i].last_chunk_length = info->ddims[i].chunk_length; /*  */	    
+
+
+          /* calculate number of chunks/pages in element */
+          npages = npages * info->ddims[i].num_chunks;
+
+          /* compute logical element length */
+          data_len *= info->ddims[i].dim_length;
+
+#ifdef CHK_DEBUG_2
+          printf("HMCcreate: dim[%d].dim_length=%d,",i,info->ddims[i].dim_length);
+          printf("dim[%d].chunk_length=%d,",i,info->ddims[i].chunk_length);
+          printf("dim[%d].num_chunks=%d \n",i,info->ddims[i].num_chunks);
+#endif
+      }  /* end for ndims */                                        
+#ifdef CHK_DEBUG_2
+    printf("\n");
+#endif
+
+    /* Make Vdata appendable with linked block table size of 'npages'
+       if less than 128 and greater than 16.
+       Not the best heuristic but for now it should be okay...*/
+    if (npages > 16 && npages < 128)
+      {
+          if (VSappendable(info->aid, npages) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+    else if (npages < 16 )
+      { /* 16 is default */
+          if (VSappendable(info->aid, 16) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+    else /* use 128 for large chunk tables for now */
+      {
+          if (VSappendable(info->aid, 128) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+
+    /* Set logical length of element */
+    info->length = data_len;              /* logical size of element */
+
+    /* Calculate total length of this special element header
+       including the fields for 'sp_tag_desc' and 'sp_tag_head_len'.
+       See description of format header at top of file for more
+       info on fields.
+       Include also length for multiply specialness headers */
+    switch(info->flag & 0xff) /* only using 8bits for now */
+      {
+      case SPECIAL_COMP:
+          sp_tag_header_len = 6 + 9 + 12 + 8 +(12*info->ndims) + 4 + info->fill_val_len
+                            + 6 + info->comp_sp_tag_head_len;
+          break;
+      default:
+          sp_tag_header_len = 6 + 9 + 12 + 8 +(12*info->ndims) + 4 + info->fill_val_len;
+          break;
+      }
+
+    /* Allocate buffer space for header */
+    if (( c_sp_header = (uint8 *) HDcalloc(sp_tag_header_len,1))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Calculate length of this special element header itself.
+       Note the value of 'sp_tag_head_len' in the file is the 
+       total length of this special object header - 6 bytes.
+       beacuse the length of the fields 'sp_tag_desc'(2 bytes) and 
+       'sp_tag_head_len' (4 bytes) which are not included 
+       If also multiply special need to subtract another 6 byts plus
+       length for multiply specialness headers */
+    switch(info->flag & 0xff) /* only using 8bits for now */
+      {
+      case SPECIAL_COMP:
+          info->sp_tag_header_len = sp_tag_header_len - 6 - 6 - info->comp_sp_tag_head_len;
+          break;
+      default:
+          info->sp_tag_header_len = sp_tag_header_len - 6;
+          break;
+      }
+
+    /* encode info into chunked descripton record */
+    {
+        uint8      *p = c_sp_header;
+        intn        j;
+
+        UINT16ENCODE(p, SPECIAL_CHUNKED);        /* 2 bytes */
+        INT32ENCODE(p, info->sp_tag_header_len); /* 4 bytes */
+        HDmemcpy(p, &info->version,1);           /* 1 byte  */
+        p = p + 1;
+        INT32ENCODE(p, info->flag);         /* 4 bytes */
+        INT32ENCODE(p, info->length);       /* 4 bytes */
+        INT32ENCODE(p, info->chunk_size);   /* 4 bytes */
+        INT32ENCODE(p, info->nt_size);      /* 4 bytes */
+        UINT16ENCODE(p, info->chktbl_tag);  /* 2 bytes */
+        UINT16ENCODE(p, info->chktbl_ref);  /* 2 bytes */
+        UINT16ENCODE(p, info->sp_tag);      /* 2 bytes */
+        UINT16ENCODE(p, info->sp_ref);      /* 2 bytes */
+        INT32ENCODE(p, info->ndims);        /* 4 bytes */
+                                            /* = 35 bytes*/
+        for (j = 0; j < info->ndims; j++)
+          {
+              INT32ENCODE(p,(info->ddims[j].flag));         /* 4 bytes */
+              INT32ENCODE(p,(info->ddims[j].dim_length));   /* 4 bytes */
+              INT32ENCODE(p,(info->ddims[j].chunk_length)); /* 4 bytes */
+          }                                               /* = 12 x ndims bytes */
+
+        /* now for fill value */
+        INT32ENCODE(p,(info->fill_val_len));            /* 4 bytes */
+        HDmemcpy(p,info->fill_val,info->fill_val_len); /* fill_val_len bytes */
+        p = p + fill_val_len;
+
+        /* Future to encode multiply specialness stuff
+           header lengths, header,..etc*/
+        switch(info->flag & 0xff) /* only using 8bits for now */
+          {
+          case SPECIAL_COMP:
+              UINT16ENCODE(p, SPECIAL_COMP);              /* 2 bytes */
+              INT32ENCODE(p, info->comp_sp_tag_head_len); /* 4 bytes */
+              /* copy special element header */
+              HDmemcpy(p,info->comp_sp_tag_header,info->comp_sp_tag_head_len); 
+              p = p + info->comp_sp_tag_head_len;
+              break;
+          default:
+              /* Do nothing */
+              break;
+          }
+    }
+
+    /* write the special info structure to fill */
+    if((dd_aid = Hstartaccess(file_id,special_tag,ref,DFACC_ALL))==FAIL)
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+
+    /* write only the base 32 bytes ( 6 + 9 + 12 + 5)
+       plus what is needed for each dimension which is (12 x ndims) bytes.
+       plus for fill value 4 bytes + fill_val_len 
+       plus in future multiply special headers  = sp_tag_header_len */
+    if (Hwrite(dd_aid, sp_tag_header_len, c_sp_header) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+    /* end access to special info stuff in file */
+    if(Hendaccess(dd_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    /* intialize TBBT tree of CHUNK records*/
+    info->chk_tree = tbbtdmake(chkcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+
+    /* Detach from the data DD ID */
+    if(data_id != FAIL)
+      {
+          if(HTPendaccess(data_id)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCcreate: special_tag =%d, ref=%d \n", 
+            special_tag, ref);
+    fprintf(stderr,"HMCcreate: dd_aid =%d, data_id=%d \n", 
+            dd_aid, data_id);
+#endif
+    /* update access record and file record */
+    if((access_rec->ddid = HTPselect(file_rec,special_tag,ref))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    access_rec->special      = SPECIAL_CHUNKED;
+    access_rec->special_func = &chunked_funcs;
+    access_rec->special_info = info;
+    access_rec->posn         = 0;
+    access_rec->access       = DFACC_RDWR;
+    access_rec->file_id      = file_id;
+    access_rec->appendable   = FALSE;     /* start data as non-appendable */
+
+    file_rec->attach++;
+
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCcreate: access_rec->ddid =%d \n", 
+            access_rec->ddid);
+#endif
+    /* register this valid access record for the chunked element */
+    access_aid = HAregister_atom(AIDGROUP,access_rec);
+
+    chunks_needed = 1;
+    for (i = 1; i < info->ndims; i++) {
+	chunks_needed *= info->ddims[i].num_chunks;
+    }
+    /* create chunk cache */
+    if ((info->chk_cache = 
+         mcache_open(&access_rec->file_id,                   /* cache key */
+                     access_aid,                             /* object id */
+                     (info->chunk_size*info->nt_size),       /* chunk size */
+                     chunks_needed, /* maxcache */
+                     npages,                                 /* num chunks */
+                     0                                       /* flags */)) 
+        == NULL)
+        HE_REPORT_GOTO("failed to initialize chunk cache", FAIL);
+
+    /* 
+      set up chunk read/write routines
+      These routine are the actual routines that read/write
+      whole chunks at a time.i.e. page-in/page-out routines
+     */
+    mcache_filter(info->chk_cache, /* cache handle */
+                  HMCPchunkread,   /* page-in routine */
+                  HMCPchunkwrite,  /* page-out routine */
+                  access_rec       /* object handle */);
+
+    ret_value = access_aid;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          /* free info struct */
+          if (info != NULL)
+            {
+                if (info->chk_cache != NULL)
+                  {   /* Sync chunk cache */
+                      mcache_sync(info->chk_cache);
+
+                      /* close chunk cache */
+                      mcache_close(info->chk_cache);
+                  }
+
+                if (info->aid != FAIL)
+                    VSdetach(info->aid); /* detach from chunk table */
+
+                /* free chunk tree */
+                if (info->chk_tree != NULL)
+                    tbbtdfree(info->chk_tree, chkdestroynode, chkfreekey);
+
+                /* free up stuff in special info */
+                if (info->ddims != NULL)
+                    HDfree(info->ddims);
+                if (info->seek_chunk_indices != NULL)
+                    HDfree(info->seek_chunk_indices);
+                if (info->seek_pos_chunk != NULL)
+                    HDfree(info->seek_pos_chunk);
+                if (info->fill_val != NULL)
+                    HDfree(info->fill_val);
+                if (info->comp_sp_tag_header != NULL)
+                    HDfree(info->comp_sp_tag_header);
+                if (info->cinfo != NULL)
+                    HDfree(info->cinfo);
+                if (info->minfo != NULL)
+                    HDfree(info->minfo);
+                HDfree(info); /* free spcial info last */
+            }
+
+          /* free access record */
+          if(access_rec != NULL)
+              HIrelease_accrec_node(access_rec);
+      } /* end if */
+
+    /* Normal function cleanup */
+    /* free special element header */
+    if (c_sp_header != NULL)
+        HDfree(c_sp_header);
+
+    return ret_value;
+} /* HMCcreate() */
+
+/*--------------------------------------------------------------------------
+NAME
+     HMCgetcompress - get compression information for chunked element
+
+DESCRIPTION
+     Checks if the given element is compressed then get the compression
+     information using HCPdecode_header.
+     This routine is used by HCgetcompress for the chunked element part.
+
+RETURNS
+     Returns SUCCEED/FAIL
+
+REVISION LOG
+     September 2001: Added to fix bug #307 - BMR
+
+-------------------------------------------------------------------------- */
+intn
+HMCgetcompress( accrec_t*    access_rec, /* IN: access record */
+		comp_coder_t* comp_type, /* OUT: compression type */
+		comp_info* c_info)       /* OUT: retrieved compression info */
+{
+    CONSTR(FUNC, "HMCgetcompress");   /* for HERROR */
+    chunkinfo_t *info = NULL;   /* chunked element information record */
+    model_info  m_info;         /* modeling information - dummy */
+    comp_model_t model_type;    /* modeling type - dummy */
+    intn        ret_value = SUCCEED;
+
+    /* Get the special info from the given record */
+    info = (chunkinfo_t *) access_rec->special_info;
+    if (info == NULL) HGOTO_ERROR(DFE_COMPINFO, FAIL);
+
+    /* If this chunked element is compressed, retrieve its comp info */
+    if (info->flag == SPECIAL_COMP)
+    {
+        /* Decode header from storage */
+        ret_value = HCPdecode_header((uint8 *)info->comp_sp_tag_header,
+                 &model_type, &m_info, /* dummy */ 
+		 comp_type, c_info);
+    }
+    /* It's not compressed */
+    else
+	*comp_type = COMP_CODE_NONE;
+
+  done:
+    if(ret_value == FAIL)
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* HMCgetcompress() */
+
+
+/*--------------------------------------------------------------------------
+NAME
+     HMCgetcomptype - get compression information for chunked element
+
+DESCRIPTION
+     Checks if the given element is compressed then get the compression
+     information using HCPdecode_header.
+     This routine is used by HCgetcompress for the chunked element part.
+
+RETURNS
+     Returns SUCCEED/FAIL
+
+REVISION LOG
+     September 2001: Added to fix bug #307 - BMR
+
+-------------------------------------------------------------------------- */
+intn
+HMCgetcomptype(int32 dd_aid, /* IN: access id of header info */
+	       comp_coder_t* comp_type) /* OUT: compression type */
+{
+    CONSTR(FUNC, "HMCgetcomptype");   /* for HERROR */
+    uint8 *bufp;		/* pointer to buffer */
+    uint8  version;      /* Version of this Chunked element */
+    int32  flag;         /* flag for multiply specialness ...*/
+    uint16 c_type;    /* compression type */
+    uint8 *c_sp_header = NULL; /* special element header */
+    int32  sp_tag_header_len = 0; /* length of special header */
+    int32  comp_sp_tag_head_len; /* Compression header length */
+    VOID  *comp_sp_tag_header = NULL;  /* compression header */
+    uint8  local_ptbuf[6];      /* 6 bytes for special header length */
+    intn   ret_value = SUCCEED;
+
+    /* first read special tag header length which is 4 bytes */
+    if (Hread(dd_aid, 4, local_ptbuf) == FAIL)
+	HGOTO_ERROR(DFE_READERROR, FAIL);
+
+    /* Decode it */
+    bufp = local_ptbuf;
+    INT32DECODE(bufp, sp_tag_header_len);   /* 4 bytes */
+
+    /* Sanity check */
+    if (sp_tag_header_len < 0)
+	HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Allocate buffer space for rest of special header */
+    if ((c_sp_header = (uint8 *) HDcalloc(sp_tag_header_len,1))==NULL)
+	HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* read special info header in */
+    if (Hread(dd_aid, sp_tag_header_len, c_sp_header) == FAIL)
+	HGOTO_ERROR(DFE_READERROR, FAIL);
+
+    /* decode special info header */
+    bufp = c_sp_header;
+
+    /* version info */
+    HDmemcpy(&version, bufp, 1);      /* 1 byte  */
+    bufp = bufp + 1;
+
+    /* Should check version here to see if we can handle
+    this version of special format header before we go on */
+    if (version != _HDF_CHK_HDR_VER)
+	HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* flag indicating multiple specialness */
+    INT32DECODE(bufp, flag);         /* 4 bytes */
+
+    /* check for further specialness */
+    switch(flag & 0xff)
+      {
+	/* if the element is also compressed, read the compress special info
+	   header and decode to get the compression coder */
+	case SPECIAL_COMP:
+	{
+	    uint16     sp_tag;
+
+	    /* Read compression special tag and header length, 2+4 bytes */
+	    if (Hread(dd_aid, 6, local_ptbuf) == FAIL)
+		HGOTO_ERROR(DFE_READERROR, FAIL);
+
+	    /* Decode compression header length */
+		bufp = local_ptbuf;
+		UINT16DECODE(bufp, sp_tag);		/* 2 bytes */
+		INT32DECODE(bufp, comp_sp_tag_head_len);   /* 4 bytes */ 
+
+	    /* Sanity check */
+	    if (comp_sp_tag_head_len < 0 || sp_tag != SPECIAL_COMP)
+		HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	    /* Allocate buffer space for compression special header */
+	    if ((comp_sp_tag_header = HDcalloc(comp_sp_tag_head_len,1))==NULL)
+		HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+	    /* Read compression special header in */
+	    if (Hread(dd_aid, comp_sp_tag_head_len, comp_sp_tag_header) == FAIL)
+		HGOTO_ERROR(DFE_READERROR, FAIL);
+
+	    /* Decode header to get compression type */
+	    bufp = comp_sp_tag_header;
+	    bufp = bufp + 2;	/* skip model type */
+	    UINT16DECODE(bufp, c_type);     /* get encoding type */
+	    *comp_type=(comp_coder_t)c_type;
+	    break;
+	}
+	/* It's not compressed */
+	default:
+	    *comp_type = COMP_CODE_NONE;
+      } /* switch flag */
+
+  done:
+    if(ret_value == FAIL)
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    /* Free special element headers */
+    if (c_sp_header != NULL)
+        HDfree(c_sp_header);
+    if (comp_sp_tag_header != NULL)
+        HDfree(comp_sp_tag_header);
+
+    return ret_value;
+} /* HMCgetcomptype() */
+
+
+/*--------------------------------------------------------------------------
+NAME
+     HMCgetdatainfo - get data info (offset & length) of the chunked element
+
+DESCRIPTION
+     - If the given chunk has data without any special storage, HMCgetdatainfo
+       will return one pair of offset/length of the data.
+     - If the chunk's data is compressed only, then HMCgetdatainfo will also
+       return one pair of offset/length to the compressed data
+     - If the chunk's data is compessed and is stored in linked-blocks, then
+       HMCgetdatainfo will return a number of offset/length pairs for the
+       the data's blocks.
+
+RETURNS
+     Returns number of offset/length pairs retrieved or FAIL
+
+REVISION LOG
+     March 2009: Added during hmap project. -BMR
+     August 2010: Modified according to revised SDgetdatainfo -BMR
+     Sept 2010: Mofified to handle chunk with comp and linked-blocks -BMR
+     March 2011: Added an "else" to flag as an error if the chunk has additional
+	specialness other than compression, just in case if there is. -BMR
+
+-------------------------------------------------------------------------- */
+intn
+HMCgetdatainfo(int32 file_id,
+		uint16 tag,
+		uint16 ref,
+		int32* chk_coord,       /* IN: chunk number to be processed */
+		uintn start_block,	/* IN: data block to start at, 0 base */
+		uintn info_count,	/* IN: size of offset/length lists */
+                int32 *offsetarray,	/* OUT: array to hold offsets */
+                int32 *lengtharray)	/* OUT: array to hold lengths */
+{
+    CONSTR(FUNC, "HMCgetdatainfo");	/* for HERROR */
+    uint16	 comp_ref = 0;		/* ref# of compressed data */
+    chunkinfo_t *chkinfo=NULL;		/* chunked element information */
+    atom_t       ddid=FAIL;             /* description record access id */
+    atom_t       cmpddid=FAIL;          /* description record access id */
+    uint16	 new_tag=0, new_ref=0;
+    int32	 new_off=0, new_len=0;
+    intn	 count=0;		/* number of blocks */
+    int32	 chk_num=0;
+    CHUNK_REC   *chk_rec = NULL;	/* chunk record */
+    TBBT_NODE   *entry   = NULL;	/* chunk node from TBBT */
+    accrec_t *access_rec;
+    filerec_t *file_rec;
+    int32 new_aid=FAIL;
+    int16        spec_code=0;
+    uint8        lbuf[16];		/* temporary buffer */
+    uint8       *p;			/* tmp buf ptr */
+    intn	 ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate arguments */
+    if (info_count == 0 && offsetarray != NULL && lengtharray != NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+	HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    if ((new_aid = Hstartread(file_id, tag, ref))== FAIL)
+	HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+    access_rec = HAatom_object(new_aid);
+    if (access_rec == (accrec_t *) NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* It should be chunked, but verify anyway, just in case */
+    if (access_rec->special == SPECIAL_CHUNKED)
+    {
+	if (access_rec->special_info != NULL)
+	    chkinfo = (chunkinfo_t *) (access_rec->special_info);
+    }
+    else
+	HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Calculate chunk number from origin */
+    calculate_chunk_num(&chk_num, chkinfo->ndims, chk_coord, chkinfo->ddims);
+
+    /* Find chunk record in TBBT */
+    if ((entry = (tbbtdfind(chkinfo->chk_tree, &chk_num, NULL))) == NULL)
+    { /* chunk had not been written, no chunk record */
+	if (offsetarray != NULL && lengtharray != NULL)
+	{
+	    offsetarray[0] = 0;
+	    lengtharray[0] = 0;
+	}
+	count = 0;
+    }
+    else
+    { /* chunk record exists */
+        /* Get chunk record from node */
+        chk_rec = (CHUNK_REC *) entry->data;
+
+        /* Check to see if it has been written to */
+        if (chk_rec->chk_tag != DFTAG_NULL && BASETAG(chk_rec->chk_tag) == DFTAG_CHUNK)
+        { /* valid chunk in file */
+	    /* Check for further specialness */
+ 	    if (Hfind(file_id,chk_rec->chk_tag,chk_rec->chk_ref,&new_tag,&new_ref,
+                   &new_off,&new_len,DF_FORWARD)==FAIL)
+	        HE_REPORT_GOTO("Hfind failed ", FAIL);
+
+	    if ((ddid = HTPselect(file_rec, new_tag, new_ref)) == FAIL)
+	        HE_REPORT_GOTO("HTPselect failed ", FAIL);
+
+	    if (HTPis_special(ddid)!=TRUE)
+	    { /* this chunk is not special */
+	        if (offsetarray != NULL && lengtharray != NULL)
+	        {
+		    offsetarray[0] = Hoffset(file_id, chk_rec->chk_tag, chk_rec->chk_ref);
+		    lengtharray[0] = Hlength(file_id, chk_rec->chk_tag, chk_rec->chk_ref);
+	        }
+	        count = 1;
+	    }   /* end if */
+	    else
+	    { /* this chunk is special */
+	        if (HPseek(file_rec, new_off) == FAIL)
+		    HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+	        if (HP_read(file_rec, lbuf, (int)2) == FAIL)
+		    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+	        /* Use special code to determine if additional specialness is
+		   compression */
+	        p = &lbuf[0];
+	        INT16DECODE(p, spec_code);
+
+		/* Chunk is compressed */
+	        if (spec_code == SPECIAL_COMP)
+	        {
+		    if (HP_read(file_rec, lbuf, (int)14) == FAIL)
+		        HGOTO_ERROR(DFE_READERROR, FAIL);
+
+		    p = &lbuf[0];
+		    p = p + 2 + 4;	/* skip version and _uncompressed_ data length */
+		    UINT16DECODE(p, comp_ref);/* get ref# of compressed data */
+
+		    /* Get the special info header */
+		    if (Hfind(file_id, DFTAG_COMPRESSED, comp_ref, &new_tag,&new_ref, &new_off,&new_len,DF_FORWARD)==FAIL)
+		        HE_REPORT_GOTO("Hfind failed ", FAIL);
+		    if ((cmpddid = HTPselect(file_rec, new_tag, new_ref)) == FAIL)
+		        HE_REPORT_GOTO("HTPselect failed ", FAIL);
+
+		    /* Check for further specialness */
+		    if (HTPis_special(cmpddid)!=TRUE)
+		    { /* this chunk is not further special, only compressed */
+		        if (offsetarray != NULL && lengtharray != NULL)
+		        {
+			    offsetarray[0] = new_off;
+			    lengtharray[0] = new_len;
+		        }
+		        count = 1;
+		    }   /* end if */
+		    else
+		    { /* this chunk is further special */
+		        if (HPseek(file_rec, new_off) == FAIL)
+			    HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+		        if (HP_read(file_rec, lbuf, (int)2) == FAIL)
+			    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                        /* Get the special code */
+		        p = &lbuf[0];
+		        INT16DECODE(p, spec_code);
+
+                        /* If the special storage is in linked-blocks, use
+                           HLgetdatainfo to get data info */
+		        if (spec_code == SPECIAL_LINKED)
+		        {
+			    if (HP_read(file_rec, lbuf, (int)14) == FAIL)
+			        HGOTO_ERROR(DFE_READERROR, FAIL);
+
+			    /* decode special information retrieved from file into info struct */
+			    p = &lbuf[0];
+
+			    /* get data information from the linked blocks */
+			    if (offsetarray != NULL && lengtharray != NULL)
+			        count = HLgetdatainfo(file_id, p, start_block, info_count, offsetarray, lengtharray);
+			    else
+			        count = HLgetdatainfo(file_id, p, start_block, 0, NULL, NULL);
+		        } /* this chunk is also stored in linked blocks */
+			/* May not be any other specialness, but we should flag
+			   it, so that if there is, we'll be aware of */
+			else
+			    HE_REPORT_GOTO("Compressed chunk has specialness other than linked-blocks", FAIL);
+		    } /* this element is further special */
+		    if (HTPendaccess(cmpddid) == FAIL)
+		        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+	        } /* spec_code is SPECIAL_COMP */
+
+		/* May not be any other specialness, but we should flag it, so
+		   that if there is, we'll be aware of */
+		else
+		    HE_REPORT_GOTO("Chunk has specialness other than compression", FAIL);
+	    } /* this chunk is special */
+	    if (HTPendaccess(ddid) == FAIL)
+	        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+        } /* if valid chunk in file */
+
+	/* chunk record exists but chunk had not been written, could be error */
+	else
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    } /* chunk record exists */
+
+    /* End access to the aid returned by Hstartread */
+    if (Hendaccess(new_aid)==FAIL)
+	HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    ret_value = count;
+
+  done:
+    if(ret_value == FAIL)
+      { /* Error condition cleanup */
+
+    /* End accesses */
+    if (ddid != FAIL)
+	HTPendaccess(ddid);
+    if (new_aid != FAIL)
+	Hendaccess(new_aid);
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* HMCgetdatainfo */
+
+/*--------------------------------------------------------------------------
+NAME
+     HMCgetdatasize - get data sizes of the chunked element
+
+DESCRIPTION
+     This routine was intented to be used by HCPgetdatasize for the chunked 
+     element part.  
+
+     HMCgetdatasize proceeds as followed:
+     - decode the chunking info special header to get the chunk table info
+     - get access to the chunk table via Vdata interface
+     - get the size of the chunk table to determine if the data has been written
+     - if the element is also compressed, read each vdata record to obtain the
+	tag/ref pair of the compression special header and read the header
+     - decode the compression special header to get the compressed data ref# and
+	retrieve the compressed data length via Hlength
+     - if uncompressed size is requested by the caller, calculate the actual 
+	size of the uncompressed data by (chunk size * number of records)
+     - if compressed size is requested by the caller, calculate the total 
+	compressed size by accumulating the compressed size of all chunks.
+
+RETURNS
+     Returns SUCCEED/FAIL
+
+REVISION LOG
+     September 2008: Added to fix bugzilla #587 - BMR
+
+-------------------------------------------------------------------------- */
+intn
+HMCgetdatasize(int32 file_id,
+		uint8 *p, /* IN: access id of header info */
+		int32 *comp_size, /* OUT: size of compressed data */
+		int32 *orig_size) /* OUT: size of uncompression type */
+{
+    CONSTR(FUNC, "HMCgetdatasize");	/* for HERROR */
+    uint16	 comp_ref = 0;		/* ref# of compressed data */
+    char         vsname[VSNAMELENMAX + 1];  /* Vdata name */
+    char         v_class[VSNAMELENMAX + 1] = ""; /* Vdata class for comparison */
+    char         vsclass[VSNAMELENMAX + 1]; /* Vdata class */
+    int32        vdata_size;		/* size of Vdata */
+    chunkinfo_t* chkinfo=NULL;		/* chunked element information */
+    uint8       *v_data = NULL;		/* Vdata record */
+    int32        num_recs=0,		/* number of records in chunk table */
+		 chk_data_size=0,	/* non-compressed data size */
+		 chk_comp_data_size=0,	/* compressed data size */
+		 chktab_id=-1,		/* chunk table (vdata) id */
+		 chk_aid=-1,		/* a single chunk aid */
+		 len = 0;		/* length of a compressed chunk */
+    uint8	 chk_spbuf[10];		/* 10 bytes for special tag, version, 
+					   uncomp len, comp ref# */
+    int		 j, k;
+    intn	 ret_value = SUCCEED;
+
+    /* Skip 4byte header len */
+    p = p + 4;
+
+    /* Allocate and fill in special chunk info struct for CHUNKs */
+    if (( chkinfo = (chunkinfo_t *) HDmalloc(sizeof(chunkinfo_t)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Version info */
+    HDmemcpy(&chkinfo->version, p, 1);      /* 1 byte  */
+    p = p + 1;
+
+    /* Should check version here to see if we can handle this version of
+       special format header before we go on */
+    if (chkinfo->version != _HDF_CHK_HDR_VER)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Flag indicating multiple specialness, used to find out if this element
+       is also compressed or something else */
+    INT32DECODE(p, chkinfo->flag);         /* 4 bytes */
+
+    /* Length of uncompressed data as a whole, size of each chunk, and size of
+       number type */
+    INT32DECODE(p, chkinfo->length);       /* 4 bytes */
+    INT32DECODE(p, chkinfo->chunk_size);   /* 4 bytes */
+    INT32DECODE(p, chkinfo->nt_size);      /* 4 bytes */
+
+    /* Get chunk data size */
+    chk_data_size = chkinfo->chunk_size * chkinfo->nt_size;
+
+    /* Get tag/ref of chunk table, 2 bytes each */
+    UINT16DECODE(p, chkinfo->chktbl_tag);
+    UINT16DECODE(p, chkinfo->chktbl_ref);
+
+    /* Skip sp_tag and sp_ref then get ndims for use in skipping origins */
+    p  = p + 2 + 2;
+    INT32DECODE(p, chkinfo->ndims);        /* 4 bytes */
+
+    /* Make sure it is really the vdata */
+    if (chkinfo->chktbl_tag == DFTAG_VH)
+    {
+	/* Use Vdata interface to access chunk table */
+
+	/* Start access on Vdata */
+	if(Vstart(file_id) == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	/* Attach to the chunk table vdata and get its num of records */
+	if ((chktab_id = VSattach(file_id,(int32)chkinfo->chktbl_ref,"r")) == FAIL)
+	    HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+	if ((VSinquire(chktab_id, &num_recs, NULL, NULL, &vdata_size, vsname)) == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	/* Only continue reading the chunk table to get compressed data size 
+	   if it is requested and if data had been written, i.e. chunk table is
+	   not empty */
+	if (comp_size != NULL && num_recs > 0)
+	{
+	    /* Check for further specialness.  If chunks are also compressed, 
+	       then the chunk table will be read for each chunk's tag/ref, 
+	       which points to the compression info of the chunk, to get the 
+	       compressed data size */
+	    switch(chkinfo->flag & 0xff)
+	    {
+		/* Element is also compressed, read and decode the compression 
+		   special info header of each chunk and get the compressed 
+		   data size */
+		case SPECIAL_COMP:
+		{
+		    uint16     sp_tag;
+
+		    /* Get class of Vdata */
+		    if ((VSgetclass(chktab_id, vsclass)) == FAIL)
+			HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+		    /* Verify class and version */
+		    sprintf(v_class,"%s%d",_HDF_CHK_TBL_CLASS,_HDF_CHK_TBL_CLASS_VER);
+		    if (HDstrncmp(vsclass,v_class,HDstrlen(v_class)) != 0 )
+		    {
+			HGOTO_ERROR(DFE_INTERNAL, FAIL);
+		    }
+
+		    /* Set the fields to read */
+		    if(VSsetfields(chktab_id,_HDF_CHK_FIELD_NAMES)==FAIL)
+			HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+		    /* Allocate space for a single Vdata record */
+		    if ((v_data = HDmalloc((size_t)vdata_size)) == NULL)
+			HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+		    /* Read in the tag/ref of each chunk then get the 
+			compression info header the tag/ref points to and 
+			decode the compressed data size */
+		    for (j = 0; j < num_recs; j++)
+		    {
+			uint8 *pntr = NULL;       /* temp pointer to vdata record */
+			uint16 chk_tag, chk_ref;  /* each chunk's tag/ref */
+
+			/* Read single record */
+			if(VSread(chktab_id,v_data,1,FULL_INTERLACE)==FAIL)
+			    HGOTO_ERROR(DFE_VSREAD,FAIL);
+        
+			pntr = v_data; /* set pointer to vdata record */
+
+			/* Skip origin first */
+			for (k = 0; k < chkinfo->ndims; k++)
+			{
+			    pntr += sizeof(int32);
+			}
+
+			/* Get the chunk's tag and ref */
+			HDmemcpy(&chk_tag, pntr, sizeof(uint16));
+			pntr += sizeof(uint16);
+			HDmemcpy(&chk_ref, pntr, sizeof(uint16));
+
+			/* Prepare to read the info which the tag/ref points to */
+			chk_aid = Hstartaccess(file_id, MKSPECIALTAG(chk_tag), chk_ref, DFACC_READ);
+			if (chk_aid == FAIL)
+			    HGOTO_ERROR(DFE_BADAID, FAIL);
+
+			/* Read 10 bytes: special tag (2), comp. version (2), 
+			   uncomp length (4), and comp. ref# (2) */
+			if (Hread(chk_aid, 10, chk_spbuf) == FAIL)
+			    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+			/* Decode and check the special tag to be sure */
+			p = chk_spbuf;
+			UINT16DECODE(p, sp_tag);             /* 2 bytes */
+			if (sp_tag == SPECIAL_COMP)
+			{
+			    /* Skip compression version (2 bytes) and 
+				uncompressed data length (4 bytes) */
+			    p = p + 2 + 4;
+
+			    /* Get ref # of compressed data (2 bytes) */
+			    UINT16DECODE(p, comp_ref);
+
+			    /* Get length of compressed data.  Note that this 
+				length is specified as compressed chunk size 
+				times nt_size. */
+			    if ((len = Hlength(file_id, DFTAG_COMPRESSED, comp_ref)) == FAIL)
+				HGOTO_ERROR(DFE_BADLEN, FAIL);
+
+			    /* Accumulate compressed size of all chunks. */
+			    chk_comp_data_size = chk_comp_data_size + len;
+			}
+
+			/* sp_tag is not SPECIAL_COMP, while 'chkinfo->flag' 
+			   above is SPECIAL_COMP, something must be wrong */
+			else
+			    HGOTO_ERROR(DFE_COMPINFO, FAIL);
+
+			/* End access to special info of an individual chunk */
+			if(Hendaccess(chk_aid)==FAIL)
+			    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+		    } /* for each record */
+		    break;
+		}
+		default:
+		/* Element is not compressed, use non-compressed data size.
+		   Note: must multiply by num_recs here because when element is
+		   compressed, chk_comp_data_size was calculated by accumulating
+		   "len" of each compressed chunk (see case above) */
+		   chk_comp_data_size = chk_data_size * num_recs;
+	    } /* switch flag */
+	} /* if comp_size != NULL && num_recs >= 0 */
+
+	if (VSdetach(chktab_id) == FAIL)
+	    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    } /* it is a vdata */
+    else
+	HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Return requested sizes */
+    if (comp_size != NULL)
+	*comp_size = chk_comp_data_size;
+    if (orig_size != NULL)
+	*orig_size = chk_data_size * num_recs;
+
+  done:
+    if(ret_value == FAIL)
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    /* Free allocated space for vdata record */
+    if (v_data != NULL)
+        HDfree(v_data);
+
+    /* Free special chunk info struct */
+    if (chkinfo != NULL)
+	HDfree(chkinfo);
+
+    return ret_value;
+} /* HMCgetdatasize */
+
+/*--------------------------------------------------------------------------
+NAME
+     HMCsetMaxcache - maximum number of chunks to cache 
+
+DESCRIPTION
+     Set the maximum number of chunks to cache.
+
+     The values set here affects the current object's caching behaviour.
+
+     If the chunk cache is full and 'maxcache' is greater then the
+     current 'maxcache' value, then the chunk cache is reset to the new
+     'maxcache' value, else the chunk cache remains at the current
+     'maxcache' value.
+
+     If the chunk cache is not full, then the chunk cache is set to the
+     new 'maxcache' value only if the new 'maxcache' value is greater than the
+     current number of chunks in the cache.
+
+     Use flags arguement of 'HMC_PAGEALL' if the whole object is to be cached 
+     in memory otherwise passs in zero.
+
+RETURNS
+     Returns number of 'maxcache' if successful and FAIL otherwise
+
+AUTHOR
+   -GeorgeV - 9/3/96
+
+NOTE
+     This calls the real routine mcache_set_maxcache().
+     Currently 'maxcache' has to be greater than 1. 
+
+-------------------------------------------------------------------------- */
+int32
+HMCsetMaxcache(int32 access_id, /* IN: access aid to mess with */
+               int32 maxcache,  /* IN: max number of pages to cache */
+               int32 flags      /* IN: flags = 0, HMC_PAGEALL */)
+{
+    CONSTR(FUNC, "HMCsetMaxcache");   /* for HERROR */
+    accrec_t    *access_rec = NULL;   /* access record */
+    chunkinfo_t *info       = NULL;   /* chunked element information record */
+    int32       ret_value = SUCCEED;
+
+    /* shut compiler up */
+    flags=flags;
+
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCsetMaxcache: access_id =%d \n", access_id);
+#endif
+    /* Check args */
+    access_rec = HAatom_object(access_id);
+    if (access_rec == NULL || maxcache < 1)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCsetMaxcache: access_rec->special =%d \n", access_rec->special);
+    fprintf(stderr,"HMCsetMaxcache: access_rec->ddid =%d \n", access_rec->ddid);
+#endif
+
+    /* since this routine can be called by the user,
+       need to check if this access id is special CHUNKED */
+    if (access_rec->special == SPECIAL_CHUNKED)
+      {
+          info     = (chunkinfo_t *) (access_rec->special_info);
+
+          if (info != NULL)
+              ret_value =  mcache_set_maxcache(info->chk_cache,maxcache);
+          else 
+              ret_value = FAIL;
+      }
+    else /* not special */
+        ret_value = FAIL;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* HMCsetMaxcache() */
+
+/* ------------------------------ HMCPstread -------------------------------
+NAME
+   HMCPstread -- open an access record of chunked element for reading
+
+DESCRIPTION
+   Calls to HMCIstaccess to fill in the access rec for
+   reading
+
+RETURNS
+   The AID of the access record on success FAIL on error.
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCPstread(accrec_t * access_rec /* IN: access record to fill in */)
+{
+    int32 ret_value;
+
+    ret_value = HMCIstaccess(access_rec, DFACC_READ);
+
+    return ret_value;
+}   /* HMCPstread */
+
+/* ------------------------------ HMCPstwrite ------------------------------
+NAME
+   HMCPstwrite -- open an access record of a chunked elmenent for writing
+
+DESCRIPTION
+   Calls to HMCIstaccess to fill in the access rec for
+   writing
+
+RETURNS
+   The AID of the access record on success FAIL on error.
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCPstwrite(accrec_t * access_rec /* IN: access record to fill in */)
+{
+    int32  ret_value;
+
+    ret_value = HMCIstaccess(access_rec, DFACC_WRITE);
+
+    return ret_value;
+}   /* HMCPstwrite */
+
+
+/* ------------------------------- HMCPseek --------------------------------
+NAME
+   HMCPseek -- set the seek posn in the chunked elemnent
+
+DESCRIPTION
+   Set the seek posn in the given chunked element
+
+RETURNS
+   SUCCEED / FAIL
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCPseek(accrec_t * access_rec,  /* IN: access record to mess with */
+         int32 offset,           /* IN: seek offset */
+         int origin              /* IN: where we should calc the offset from */)
+{
+    CONSTR(FUNC, "HMCPseek");    /* for HERROR */
+    chunkinfo_t *info = NULL;    /* information for the chunked elt */
+    int32   ret_value = SUCCEED;
+
+#ifdef CHK_DEBUG_3
+    printf("HMCPseek called with offset %d \n",offset);
+#endif
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_CHUNKED)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* get special info */
+    info = (chunkinfo_t *) (access_rec->special_info);
+
+    /* adjust the offset according to origin and validate */
+    /* there is no upper bound to posn */
+    if (origin == DF_CURRENT)
+        offset += access_rec->posn;
+    if (origin == DF_END)
+        offset += (info->length * info->nt_size); /* adjust by number type size */
+    if (offset < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* Seek to given location(bytes) for reading/writing */
+    /* i.e calculate chunk indices given seek location 
+       this will update the proper arrays in the special info struct */
+    update_chunk_indicies_seek(offset,info->ndims, info->nt_size,
+                               info->seek_chunk_indices,
+                               info->seek_pos_chunk,info->ddims);
+
+    /* set position in access record */
+    access_rec->posn = offset;
+
+#ifdef CHK_DEBUG_3
+    printf("HMCPseek new user seek postion in element is  %d \n",offset);
+#endif
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+}   /* HMCPseek */
+
+/* ------------------------------- HMCPchunkread --------------------------------
+NAME
+   HMCPchunkread - read a chunk
+
+DESCRIPTION
+   Read in a whole chunk from a chunked element given the chunk number.  
+
+   This is used as the 'page-in-chunk' routine for the cache.
+   Only the cache should call this routine.
+
+RETURNS
+   The number of bytes read or FAIL on error
+AUTHOR
+   -GeorgeV - 9/3/96
+--------------------------------------------------------------------------- */
+int32
+HMCPchunkread(void  *cookie,    /* IN: access record to mess with */
+              int32 chunk_num,  /* IN: chunk to read */
+              void  *datap      /* OUT: buffer for data */)
+{
+    CONSTR(FUNC, "HMCPchunkread");    /* for HERROR */
+    accrec_t * access_rec = (accrec_t *)cookie; /* access record */
+    chunkinfo_t *info    = NULL; /* information record for this special data elt */
+    CHUNK_REC   *chk_rec = NULL; /* chunk record */
+    TBBT_NODE   *entry   = NULL; /* chunk node from TBBT */
+    uint8       *bptr    = NULL; /* pointer to data buffer */
+    int32       chk_id   = FAIL; /* chunk id */
+    int32       bytes_read = 0;    /* total # bytes read for this call of HMCIread */
+    int32       read_len = 0;      /* length of bytes to read */
+    int32       nitems = 1;        /* used in HDmemfill(), */
+    int32       ret_value = SUCCEED;
+
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* set inputs */
+    bptr = (uint8 *) datap;
+    info = (chunkinfo_t *) (access_rec->special_info);
+    bytes_read    = 0;
+    read_len      = (info->chunk_size * info->nt_size); 
+
+#ifdef CHK_DEBUG_3
+    printf("HMCPchunkread called with chunk %d \n",chunk_num);
+#endif
+    /* find chunk record in TBBT */
+    if ((entry = (tbbtdfind(info->chk_tree, &chunk_num, NULL))) == NULL)
+      { /* does not exist */
+          /* calculate number of fill value items to fill buffer with */
+          nitems = (info->chunk_size * info->nt_size) / info->fill_val_len;
+
+          /* copy fill values into buffer and return */
+          if (HDmemfill(datap,info->fill_val, (uint32)info->fill_val_len,(uint32)nitems) == NULL)
+              HE_REPORT_GOTO("HDmemfill failed to fill read chunk", FAIL);
+      }
+    else /* exists in TBBT */
+      {
+          /* get chunk record from node */
+          chk_rec = (CHUNK_REC *) entry->data; 
+
+          /* check to see if has been written to */
+          if (chk_rec->chk_tag != DFTAG_NULL && BASETAG(chk_rec->chk_tag) == DFTAG_CHUNK)
+            { /* valid chunk in file */
+                /* Start read on chunk */
+                if ((chk_id = Hstartread(access_rec->file_id, chk_rec->chk_tag,
+                                         chk_rec->chk_ref)) == FAIL)
+                  {
+                      Hendaccess(chk_id);
+                      HE_REPORT_GOTO("Hstartread failed to read chunk", FAIL);
+                  }
+
+                /* read data from chunk */
+                if (Hread(chk_id, read_len, bptr) == FAIL)
+                    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                bytes_read = read_len;
+
+                /* end access to chunk */
+                if (Hendaccess(chk_id) == FAIL)
+                    HE_REPORT_GOTO("Hendaccess failed to end access to chunk", FAIL);
+              
+            }
+          else if (chk_rec->chk_tag == DFTAG_NULL) 
+            {/* chunk has not been written, so return fill value buffer */
+                /* calculate number of fill value items to fill buffer with */
+                nitems = (info->chunk_size * info->nt_size) / info->fill_val_len;
+
+                /* copy fill values into buffer and return */
+                if (HDmemfill(datap,info->fill_val, (uint32)info->fill_val_len,(uint32)nitems) == NULL)
+                    HE_REPORT_GOTO("HDmemfill failed to fill read chunk", FAIL);
+            }
+          else /* not a valid chunk ref for now */
+            {  
+                /* For now DFTAG_CHUNK is the only allowed value.
+                   In the future this could be another Chunk table. */
+                HE_REPORT_GOTO("Not a valid Chunk object, wrong tag for chunk", FAIL);
+            }
+
+      } /* end else exists in TBBT tree */
+
+    ret_value = bytes_read; /* number of bytes read */
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (chk_id != FAIL)
+              Hendaccess(chk_id);
+      } /* end if */
+
+    /* Normal function cleanup */
+#ifdef CHK_DEBUG_3
+    printf("HMCPchunkread exit with ret_value= %d \n",ret_value);
+#endif
+    return ret_value;
+} /* HMCPchunkread() */
+
+/* ------------------------------- HMCreadChunk ---------------------------
+NAME
+   HMCreadChunk -- read a whole chunk
+
+DESCRIPTION
+   Read a whole chunk from a chunked element.  
+
+   This can be used by users to read whole chunks from the file
+   based on chunk origin for now i.e postion of chunk in overall
+.  chunk array.
+
+RETURNS
+   The number of bytes read or FAIL on error
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCreadChunk(int32 access_id,  /* IN: access aid to mess with */
+             int32 *origin,    /* IN: origin of chunk to read */
+             void *datap /* IN: buffer for data */)
+{
+    CONSTR(FUNC, "HMCreadChunk");  /* for HERROR */
+    accrec_t    *access_rec = NULL; /* access record */
+#ifdef UNUSED
+    uint8       *data       = NULL; /* data buffer */
+#endif /* UNUSED */
+    filerec_t   *file_rec   = NULL; /* file record */
+    chunkinfo_t *info       = NULL; /* chunked element information record */
+    uint8       *bptr       = NULL; /* data buffer pointer */
+    void        *chk_data   = NULL; /* chunk data */
+    uint8       *chk_dptr   = NULL; /* chunk data pointer */
+    int32       relative_posn;      /* relative position in chunked element */
+    int32       bytes_read = 0;     /* total #bytes read  */
+    int32       read_len = 0;       /* bytes to read next */
+    int32       chunk_num = -1;     /* chunk number */
+    int32       ret_value = SUCCEED;
+    intn        i;
+
+#ifdef CHK_DEBUG_5
+    printf("HMCreadChunk: entered \n");
+#endif
+    /* Check args */
+    access_rec = HAatom_object(access_id);
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (origin == NULL || datap == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* validate file records */
+    file_rec =  HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* can read from this file? */
+    if (!(file_rec->access & DFACC_READ))
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+
+    /* since this routine can be called by the user,
+       need to check if this access id is special CHUNKED */
+    if (access_rec->special == SPECIAL_CHUNKED)
+      {
+          /* Set inputs */
+#ifdef UNUSED
+          data     = (uint8 *) datap;
+#endif /* UNUSED */
+          info     = (chunkinfo_t *) (access_rec->special_info);
+          relative_posn = access_rec->posn;
+          read_len      = (info->chunk_size * info->nt_size);
+          bytes_read    = 0;
+          bptr          = datap;
+          
+          /* copy origin over to seek chunk indicies 
+             and set position within chunk to beginning of that chunk */
+          for (i = 0; i < info->ndims; i++)
+            {
+              info->seek_chunk_indices[i] = origin[i];
+              info->seek_pos_chunk[i] = 0;
+            }
+
+#ifdef CHK_DEBUG_5
+          printf(" Seek start(in chunk array):(");
+          for (i = 0; i < info->ndims; i++)
+              printf("%d%s", info->seek_chunk_indices[i], i!= info->ndims-1 ? ",":NULL);
+          printf(")\n");
+#endif
+          /* calculate chunk number from origin */
+          calculate_chunk_num(&chunk_num, info->ndims, origin, info->ddims);
+
+#ifdef CHK_DEBUG_5
+    printf("HMCreadChunk called with chunk %d \n",chunk_num);
+#endif
+          /* currently get chunk data from cache based on chunk number 
+             Note the cache deals with objects starting from 1 not 0 */
+          if ((chk_data = mcache_get(info->chk_cache, /* cache handle */
+                                              chunk_num+1,     /* chunk number */
+                                              0                /* flag: unused */)) 
+              == NULL)
+              HE_REPORT_GOTO("failed to find chunk record", FAIL);
+
+          chk_dptr = chk_data; /* set chunk data ptr */
+
+          /* copy data from chunk to users buffer */
+          HDmemcpy(bptr, chk_dptr, read_len);        
+
+          /* put chunk back to cache and mark it as *not* DIRTY */
+          if (mcache_put(info->chk_cache, /* cache handle */
+                         chk_data,        /* whole data chunk */
+                         0                /* flag: 0->not DIRTY */) 
+              == FAIL)
+              HE_REPORT_GOTO("failed to put chunk back in cache", FAIL);
+
+          /* adjust number of bytes already read */
+          bytes_read = read_len; 
+
+#ifdef CHK_DEBUG_5
+          printf("HMCreadChunk: read %d bytes already\n", bytes_read);
+#endif
+
+          /*update chunk seek indicies after reading chunk */
+          update_seek_pos_chunk(bytes_read,info->ndims,info->nt_size,
+                                info->seek_pos_chunk,
+                                info->ddims);
+
+          /* compute user array for chunk arrays */
+          compute_chunk_to_array(info->seek_chunk_indices,info->seek_pos_chunk,
+                                 info->seek_user_indices,
+                                 info->ndims,info->ddims);
+
+          /* calculate new read seek postion in element from user array */
+          compute_array_to_seek(&relative_posn,
+                                 info->seek_user_indices,
+                                 info->nt_size,info->ndims,info->ddims);
+
+#ifdef CHK_DEBUG_5
+          printf("HMCreadChunk: new postion in element is %d\n", relative_posn);
+#endif
+          /* update access record with bytes read */
+          access_rec->posn = relative_posn;
+
+#ifdef CHK_DEBUG_5
+          /* for info only */
+          compute_chunk_to_seek(&relative_posn,info->ndims,info->nt_size,
+                               info->seek_chunk_indices,
+                               info->seek_pos_chunk,info->ddims,
+                               info->chunk_size);
+          printf("HMCreadChunk: new chunk seek postion in element is %d\n", relative_posn);
+#endif
+
+          ret_value = bytes_read;
+      }
+    else /* not special chunked element */
+        ret_value = FAIL;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+      } /* end if */
+
+    /* Normal function cleanup */
+
+#ifdef CHK_DEBUG_5
+    printf("HMCreadChunk: exited, ret=%d \n",ret_value);
+#endif
+    return ret_value;
+} /* HMCreadChunk() */
+
+/* ------------------------------- HMCPread --------------------------------
+NAME
+   HMCPread - read data from a chunked element
+
+DESCRIPTION
+   Read in some data from a chunked element. 
+
+   Data is obtained from the cache which takes care of reading
+   in the proper chunks to satisfy the request.
+
+RETURNS
+   The number of bytes read or FAIL on error
+AUTHOR
+   -GeorgeV - 9/3/96
+--------------------------------------------------------------------------- */
+int32
+HMCPread(accrec_t * access_rec, /* IN: access record to mess with */
+         int32 length,          /* IN: number of bytes to read */
+         void * datap            /* OUT: buffer for data */)
+{
+    CONSTR(FUNC, "HMCPread");    /* for HERROR */
+#ifdef UNUSED
+    uint8       *data = NULL;    /* data buffer */
+#endif /* UNUSED */
+    chunkinfo_t *info = NULL;    /* information record for this special data elt */
+    int32       relative_posn = 0; /* relative position in chunk of data elt */
+    int32       bytes_read = 0;  /* total # bytes read for this call of HMCIread */
+    uint8       *bptr = NULL;    /* data buffer pointer */
+    int32       read_len = 0;    /* amount of data to copy */
+    int32       read_seek = 0;   /* next read seek position */
+    int32       chunk_size = 0;  /* size of data to read from chunk */
+    int32       chunk_num = 0;   /* next chunk number */
+    void        *chk_data = NULL; /* chunk data */
+    uint8       *chk_dptr = NULL; /* pointer to chunk data */
+#ifdef CHK_DEBUG_3
+    int         i;
+#endif
+    int32       ret_value = SUCCEED;
+
+#ifdef CHK_DEBUG_3
+    printf("HMCPread called with length %d \n",length);
+#endif
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCread: access_rec->special =%d \n", access_rec->special);
+    fprintf(stderr,"HMCread: access_rec->ddid =%d \n", access_rec->ddid);
+#endif
+
+    /* set inputs */
+#ifdef UNUSED
+    data = (uint8 *) datap;
+#endif /* UNUSED */
+    info = (chunkinfo_t *) (access_rec->special_info);
+    relative_posn = access_rec->posn; /* current seek postion in element */
+
+    /* validate length and set proper length */
+    if (length == 0)
+        length = (info->length * info->nt_size) - access_rec->posn;
+    else if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    if (access_rec->posn + length > (info->length * info->nt_size))
+        length = (info->length * info->nt_size) - access_rec->posn;
+
+    /* should chunk indicies be updated with relative_posn? 
+       or did last operation update it already */
+    update_chunk_indicies_seek(access_rec->posn,info->ndims, info->nt_size,
+                               info->seek_chunk_indices,
+                               info->seek_pos_chunk,info->ddims);
+
+    /* enter translating length to proper filling of buffer from chunks */
+    bptr = datap;
+    bytes_read = 0;
+    read_len = length; 
+    while (bytes_read < read_len) 
+      {
+          /* for debuging */
+#ifdef CHK_DEBUG_3
+	  int i;
+          printf(" Seek start(in chunk array):(");
+          for (i = 0; i < info->ndims; i++)
+              printf("%d%s", info->seek_chunk_indices[i], i!= info->ndims-1 ? ",":NULL);
+          printf(")\n");
+          printf(" Seek start(within the chunk):(");
+          for (i = 0; i < info->ndims; i++)
+              printf("%d%s", info->seek_pos_chunk[i], i!= info->ndims-1 ? ",":NULL);
+          printf(")\n");
+#endif
+
+          /* calculate chunk to retrieve on this pass */
+          calculate_chunk_num(&chunk_num,info->ndims,info->seek_chunk_indices,
+                              info->ddims);
+
+          /* calculate contiguous chunk size that we can read from this chunk 
+             during this pass */
+          calculate_chunk_for_chunk(&chunk_size,info->ndims,info->nt_size,
+                                    read_len,bytes_read,
+                                    info->seek_chunk_indices,
+                                    info->seek_pos_chunk,info->ddims);
+
+          /* would be nice to get Chunk record from TBBT based on chunk number 
+             and then get chunk data base on chunk vdata number but
+             currently the chunk calculations return chunk 
+             numbers and not Vdata record numbers. 
+             This would reduce some overhead in the number of chunks
+             dealt with in the cache */
+
+          /* currently get chunk data from cache based on chunk number 
+             Note the cache deals with objects starting from 1 not 0 */
+          if ((chk_data = mcache_get(info->chk_cache, /* cache handle */
+                                              chunk_num+1,     /* chunk number */
+                                              0                /* flag: unused */)) 
+              == NULL)
+              HE_REPORT_GOTO("failed to find chunk record", FAIL);
+
+          chk_dptr = chk_data; /* set chunk data ptr */
+
+          /* calculate position in chunk */
+          calculate_seek_in_chunk(&read_seek,info->ndims,info->nt_size,
+                                  info->seek_pos_chunk,
+                                  info->ddims);
+
+          chk_dptr += read_seek; /* move to correct position in chunk */
+
+#ifdef CHK_DEBUG_3
+          printf("  read pos in chunk(%d) is %d bytes\n", chunk_num, read_seek);
+#endif
+          /* copy data from chunk to users buffer */
+          HDmemcpy(bptr, chk_dptr, chunk_size);        
+
+#ifdef CHK_DEBUG_10
+          printf(" chk_dptr={");
+          for (i = 0; i < chunk_size; i++)
+              printf("%d,",(uint8)*((uint8 *)(chk_dptr)+i));
+          printf("}\n");
+#endif
+          /* put chunk back to cache */
+          if (mcache_put(info->chk_cache, /* cache handle */
+                         chk_data,        /* whole data chunk */
+                         0                /* flag: 0->not DIRTY */) 
+              == FAIL)
+              HE_REPORT_GOTO("failed to put chunk back in cache", FAIL);
+
+          /* increment buffer pointer */
+          bptr += chunk_size;
+
+          /* adjust number of bytes already read */
+          bytes_read += chunk_size; 
+
+#ifdef CHK_DEBUG_3
+          printf("  read %d bytes already\n", bytes_read);
+#endif
+          /* update relative position i.e. user element seek postion 
+             with chunk size written */
+          relative_posn += chunk_size;
+#ifdef CHK_DEBUG_3
+          printf("  relative_posn = %d bytes \n", relative_posn);
+#endif
+          /* i.e calculate chunk indices given seek location 
+             this will update the proper arrays in the special info struct */
+          update_chunk_indicies_seek(relative_posn,info->ndims, info->nt_size,
+                                     info->seek_chunk_indices,
+                                     info->seek_pos_chunk,info->ddims);
+      } /* end while "bytes_read" */
+
+    /* update access record postion with bytes read */
+    access_rec->posn += bytes_read;
+
+    ret_value = bytes_read;
+
+#ifdef CHK_DEBUG_10
+    printf(" datap={");
+    for (i = 0; i < length; i++)
+        printf("%d,",(uint8)*((uint8 *)(datap)+i));
+    printf("}\n");
+#endif
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+}   /* HMCPread  */
+
+/* ------------------------------- HMCPchunkwrite -------------------------------
+NAME
+   HMCPchunkwrite -- write out chunk
+
+DESCRIPTION
+   Write a whole chunk to a chunked element given the chunk number.  
+
+   This is used as the 'page-out-chunk' routine for the cache.
+   Only the cache should call this routine.
+
+RETURNS
+   The number of bytes written or FAIL on error
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCPchunkwrite(void  *cookie,    /* IN: access record to mess with */
+               int32 chunk_num,  /* IN: chunk number */
+               const void *datap /* IN: buffer for data */)
+{
+    CONSTR(FUNC, "HMCPchunkwrite");   /* for HERROR */
+    accrec_t * access_rec = (accrec_t *)cookie; /* access record */
+    chunkinfo_t *info    = NULL;  /* chunked element information record */
+    CHUNK_REC   *chk_rec = NULL;  /* current chunk */
+    TBBT_NODE   *entry   = NULL;  /* node off of  chunk tree */
+    uint8       *v_data  = NULL;  /* chunk table record i.e Vdata record */
+    CHUNK_REC   *chkptr  = NULL;  /* Chunk record to inserted in TBBT  */
+    const void  *bptr    = NULL;  /* data buffer pointer */
+    int32       chk_id   = FAIL ; /* chunkd accces id */
+#ifdef UNUSED
+    uint8      *data     = NULL;  /* data buffer */
+    int32       relative_posn;     /* relative position in chunked element */
+#endif /* UNUSED */
+    int32       bytes_written = 0; /* total #bytes written by HMCIwrite */
+    int32       write_len = 0;     /* nbytes to write next */
+    int32       ret_value = SUCCEED;
+    intn        k;                 /* loop index */
+
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Set inputs */
+    info     = (chunkinfo_t *) (access_rec->special_info);
+#ifdef UNUSED
+    data     = (uint8 *) datap;
+    relative_posn = access_rec->posn;
+#endif /* UNUSED */
+    write_len     = (info->chunk_size * info->nt_size);
+    bytes_written = 0;
+    bptr          = datap;
+
+#ifdef CHK_DEBUG_4
+    printf("HMCPchunkwrite called with chunk %d \n",chunk_num);
+#endif
+    /* find chunk record in TBBT */
+    if ((entry = (tbbtdfind(info->chk_tree, &chunk_num, NULL))) == NULL)
+        HE_REPORT_GOTO("failed to find chunk record", FAIL);
+
+    chk_rec = (CHUNK_REC *) entry->data; /* get file entry from node */
+
+    /* Check to see if already created in chunk table */
+    if (chk_rec->chk_tag == DFTAG_NULL)
+      { /* does not exists in Vdata table and in file but does in TBBT */
+          uint8 *pntr = NULL;
+
+          chkptr = chk_rec;
+          /* so create a new Vdata record */
+          /* Allocate space for a single Chunk record in Vdata */
+          if (v_data == NULL)
+            {
+                if ((v_data = HDmalloc(((size_t)info->ndims*sizeof(int32))
+                                               + (2*sizeof(uint16)))) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          /* Initialize chunk record */
+          chkptr->chk_tag = DFTAG_CHUNK;
+          chkptr->chk_ref = Htagnewref(access_rec->file_id, DFTAG_CHUNK);
+#ifdef CHK_DEBUG_4
+          printf(" chktpr->chk_tag=%d, ",chkptr->chk_tag);
+          printf(" chktpr->chk_ref=%d, ",chkptr->chk_ref);
+          printf(" chkptr->origin = (");
+          for (k = 0; k < info->ndims; k++)
+              printf("%d%s", chkptr->origin[k], k!= info->ndims-1 ? ",":NULL);
+          printf(")\n");
+#endif
+
+          if (chkptr->chk_ref == 0) {
+                    /* out of ref numbers -- extremely fatal  */
+                    HGOTO_ERROR(DFE_NOREF, FAIL);
+          }
+          /* Copy origin first to vdata record*/
+          pntr = v_data;
+          for (k = 0; k < info->ndims; k++)
+            {
+                HDmemcpy(pntr, &chkptr->origin[k],sizeof(int32));
+                pntr += sizeof(int32);
+            }
+
+          /* Copy tag next */
+          HDmemcpy(pntr, &chkptr->chk_tag,sizeof(uint16));
+          pntr += sizeof(uint16);
+
+          /* Copy ref last */
+          HDmemcpy(pntr, &chkptr->chk_ref,sizeof(uint16));
+
+          /* Add to Vdata i.e. chunk table */
+          if(VSwrite(info->aid,v_data,1,FULL_INTERLACE)==FAIL)
+              HGOTO_ERROR(DFE_VSWRITE,FAIL);
+
+          /* Create compressed chunk if set 
+             else start write access on element */
+          switch(info->flag & 0xff) /* only using 8bits for now */
+            {
+            case SPECIAL_COMP: /* Create compressed chunk */
+                if ((chk_id = HCcreate(access_rec->file_id, chk_rec->chk_tag,
+                                       chk_rec->chk_ref,
+                                       info->model_type, info->minfo,
+                                       info->comp_type, info->cinfo)) == FAIL)
+                    HE_REPORT_GOTO("HCcreate failed to read chunk", FAIL);
+                break;
+            default:
+                /* Start write on chunk */
+                if ((chk_id = Hstartwrite(access_rec->file_id, chk_rec->chk_tag,
+                                          chk_rec->chk_ref,write_len)) == FAIL)
+                    HE_REPORT_GOTO("Hstartwrite failed to read chunk", FAIL);
+                break;
+            }
+      } /* not already in Vdata table */
+    else
+      { /* Already in table so start access */
+        /* Start write on chunk */
+        if ((chk_id = Hstartwrite(access_rec->file_id, chk_rec->chk_tag,
+                                  chk_rec->chk_ref,write_len)) == FAIL)
+            HE_REPORT_GOTO("Hstartwrite failed to read chunk", FAIL);
+      }
+
+    /* write data to chunk */
+    if (Hwrite(chk_id, write_len, bptr) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+    bytes_written = write_len;
+
+    /* end access to chunk */
+    if (Hendaccess(chk_id) == FAIL)
+        HE_REPORT_GOTO("Hendaccess failed to end access to chunk", FAIL);
+
+    ret_value = bytes_written;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (chk_id != FAIL)
+              Hendaccess(chk_id);
+      } /* end if */
+
+    /* Normal function cleanup */
+    if (v_data != NULL)
+        HDfree(v_data);
+
+#ifdef CHK_DEBUG_4
+    printf("HMCPchunkwrite exited with ret_value %d \n",ret_value);
+#endif
+    return ret_value;
+} /* HMCPchunkwrite() */
+
+/* ------------------------------- HMCwriteChunk ---------------------------
+NAME
+   HMCwriteChunk -- write out a whole chunk
+
+DESCRIPTION
+   Write out some data from a chunked element.  
+
+   This can be used by users to write whole chunks to the file
+   based on chunk origin for now i.e position of chunk in overall
+   chunk array.
+
+RETURNS
+   The number of bytes written or FAIL on error
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCwriteChunk(int32 access_id,  /* IN: access aid to mess with */
+              int32 *origin,    /* IN: origin of chunk to write */
+              const void *datap /* IN: buffer for data */)
+{
+    CONSTR(FUNC, "HMCwriteChunk");  /* for HERROR */
+    accrec_t    *access_rec = NULL; /* access record */
+#ifdef UNUSED
+    uint8       *data       = NULL; /* data buffer */
+    CHUNK_REC   *chk_rec    = NULL; /* current chunk */
+    TBBT_NODE   *entry      = NULL; /* node off of  chunk tree */
+#endif /* UNUSED */
+    filerec_t   *file_rec   = NULL; /* file record */
+    chunkinfo_t *info       = NULL; /* chunked element information record */
+    CHUNK_REC   *chkptr     = NULL; /* Chunk record to inserted in TBBT  */
+    int32       *chk_key    = NULL; /* Chunk recored key for insertion in TBBT */
+    const void  *bptr       = NULL; /* data buffer pointer */
+    void        *chk_data   = NULL; /* chunk data */
+    uint8       *chk_dptr   = NULL; /* chunk data pointer */
+    int32       relative_posn;      /* relative position in chunked element */
+    int32       bytes_written = 0;  /* total #bytes written by HMCIwrite */
+    int32       write_len = 0;      /* bytes to write next */
+    int32       chunk_num = -1;     /* chunk number */
+    int32       ret_value = SUCCEED;
+    intn        k;                  /* loop index */
+    intn        i;
+
+
+#ifdef CHK_DEBUG_4
+    printf("HMCwriteChunk: entered \n");
+#endif
+    /* Check args */
+    access_rec = HAatom_object(access_id);
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (origin == NULL || datap == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* validate file records */
+    file_rec =  HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* can write in this file? */
+    if (!(file_rec->access & DFACC_WRITE))
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+
+    /* since this routine can be called by the user,
+       need to check if this access id is special CHUNKED */
+    if (access_rec->special == SPECIAL_CHUNKED)
+      {
+          /* Set inputs */
+#ifdef UNUSED
+          data     = (uint8 *) datap;
+#endif /* UNUSED */
+          info     = (chunkinfo_t *) (access_rec->special_info);
+          relative_posn = access_rec->posn;
+          write_len     = (info->chunk_size * info->nt_size);
+          bytes_written = 0;
+          bptr          = datap;
+
+          /* copy origin over to seek chunk indicies 
+             and set position within chunk to beginning of that chunk */
+          for (i = 0; i < info->ndims; i++)
+            {
+              info->seek_chunk_indices[i] = origin[i];
+              info->seek_pos_chunk[i] = 0;
+            }
+
+#ifdef CHK_DEBUG_4
+          printf(" Seek start(in chunk array):(");
+          for (i = 0; i < info->ndims; i++)
+              printf("%d%s", info->seek_chunk_indices[i], i!= info->ndims-1 ? ",":NULL);
+          printf(")\n");
+#endif
+          /* calculate chunk number from origin */
+          calculate_chunk_num(&chunk_num, info->ndims, origin, 
+                              info->ddims);
+
+#ifdef CHK_DEBUG_4
+    printf("HMCwriteChunk called with chunk %d \n",chunk_num);
+#endif
+          /* find chunk record in TBBT */
+          if (tbbtdfind(info->chk_tree, &chunk_num, NULL) == NULL)
+            { /* not in tree */
+                
+                /* so create a new chunk record */
+                /* Allocate space for a chunk record */
+                if ((chkptr = (CHUNK_REC *) HDmalloc(sizeof(CHUNK_REC))) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* Allocate space for a origin in chunk record */
+                if ((chkptr->origin = (int32 *) HDmalloc((size_t)info->ndims*sizeof(int32))) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* allocate space for key */
+                if ((chk_key = (int32 *)HDmalloc(sizeof(int32))) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* Initialize chunk record */
+                chkptr->chk_tag = DFTAG_NULL;
+                chkptr->chk_ref = 0;
+#ifdef CHK_DEBUG_4
+                printf("HMCwriteChunk: chktpr->chk_tag=%d, ",chkptr->chk_tag);
+                printf(" chktpr->chk_ref=%d \n",chkptr->chk_ref);
+#endif
+                /* Intialize chunk origins */
+                for (k = 0; k < info->ndims; k++)
+                  {
+                      chkptr->origin[k] = origin[k];
+#ifdef CHK_DEBUG_4
+                      printf("   chktpr->origin[%d]=%d, ",k,chkptr->origin[k]);
+#endif
+                  }
+#ifdef CHK_DEBUG_4
+                printf("\n");
+#endif
+                /* set chunk record number to next Vdata record number */
+                chkptr->chk_vnum = info->num_recs++;
+
+                /* set key to chunk number */
+                chkptr->chunk_number = *chk_key = chunk_num;
+
+                /* add to TBBT tree based on chunk number as the key */
+                tbbtdins(info->chk_tree, chkptr , chk_key);   
+
+#ifdef UNUSED
+                /* assign over new chk */
+                chk_rec = chkptr;
+#endif /* UNUSED */
+
+                /* re-intialize ptrs to allow for error-failure check */
+                chkptr = NULL;
+                chk_key = NULL;
+            }
+#ifdef UNUSED
+          else /* already in TBBT tree */
+              chk_rec = (CHUNK_REC *) entry->data; /* get file entry from node */
+#endif /* UNUSED */
+
+          /* would be nice to get Chunk record from TBBT based on chunk number 
+             and then get chunk data base on chunk vdata number but
+             currently the chunk calculations return chunk 
+             numbers and not Vdata record numbers. 
+             This would reduce some overhead in the number of chunks
+             dealt with in the cache */
+
+          /* get chunk data from cache based on chunk number 
+             chunks in the cache start from 1 not 0 */
+          if ((chk_data = mcache_get(info->chk_cache, /* cache handle */
+                                              chunk_num+1,     /* chunk number */
+                                              0                /* flag: unused */)) 
+              == NULL)
+              HE_REPORT_GOTO("failed to find chunk record", FAIL);
+
+          chk_dptr = chk_data; /* set chunk data ptr */
+
+          /* copy data from users buffer to chunk */
+          HDmemcpy(chk_dptr, bptr, write_len);        
+
+          /* put chunk back to cache and mark it as DIRTY */
+          if (mcache_put(info->chk_cache, /* cache handle */
+                         chk_data,        /* whole data chunk */
+                         MCACHE_DIRTY     /* flag:  DIRTY */) 
+              == FAIL)
+              HE_REPORT_GOTO("failed to put chunk back in cache", FAIL);
+
+          bytes_written = write_len;
+
+          /*update chunk seek indicies after writing chunk */
+          update_seek_pos_chunk(bytes_written,info->ndims,info->nt_size,
+                                info->seek_pos_chunk,
+                                info->ddims);
+
+          /* calculate new read seek postion */
+          compute_chunk_to_array(info->seek_chunk_indices,info->seek_pos_chunk,
+                                 info->seek_user_indices,
+                                 info->ndims,info->ddims);
+
+          compute_array_to_seek(&relative_posn,
+                                 info->seek_user_indices,
+                                 info->nt_size,info->ndims,info->ddims);
+
+#ifdef CHK_DEBUG_4
+          printf(" new user seek postion in element is %d\n", relative_posn);
+#endif
+          /* update access record with bytes written */
+          access_rec->posn = relative_posn;
+
+#ifdef CHK_DEBUG_4
+          /* for info only */
+          compute_chunk_to_seek(&relative_posn,info->ndims,info->nt_size,
+                               info->seek_chunk_indices,
+                               info->seek_pos_chunk,info->ddims,
+                               info->chunk_size);
+
+          printf(" new chunk seek postion in element is %d\n", relative_posn);
+#endif
+
+          ret_value = bytes_written;
+      }
+    else /* not special chunked element */
+        ret_value = FAIL;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          /* check chunk ptrs */
+          if (chkptr != NULL)
+            {
+                if (chkptr->origin != NULL)
+                    HDfree(chkptr->origin);
+                HDfree(chkptr);
+            }
+          if (chk_key != NULL)
+              HDfree(chk_key);
+      } /* end if */
+
+    /* Normal function cleanup */
+
+#ifdef CHK_DEBUG_4
+    printf("HMCwriteChunk: exited, ret=%d \n",ret_value);
+#endif
+    return ret_value;
+}   /* HMCwriteChunk */
+
+/* ------------------------------- HMCPwrite -------------------------------
+NAME
+   HMCPwrite -- write out some data to a chunked element
+
+DESCRIPTION
+   Write out some data to a chunked element.  
+
+   Data is obtained from the cache which takes care of obtaining
+   the proper chunks to write to satisfy the request.
+
+   The chunks are marked as dirty before being returned to the cache.
+
+RETURNS
+   The number of bytes written or FAIL on error
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCPwrite(accrec_t * access_rec, /* IN: access record to mess with */
+          int32 length,          /* IN: number of bytes to write */
+          const void * datap      /* IN: buffer for data */)
+{
+    CONSTR(FUNC, "HMCPwrite");    /* for HERROR */
+    filerec_t   *file_rec = NULL; /* file record */
+    chunkinfo_t *info     = NULL; /* chunked element information record */
+#ifdef UNUSED
+    CHUNK_REC   *chk_rec  = NULL; /* current chunk */
+    uint8       *data     = NULL; /* data buffer */
+    TBBT_NODE   *entry    = NULL; /* node off of  chunk tree */
+#endif /* UNUSED */
+    CHUNK_REC   *chkptr   = NULL; /* Chunk record to inserted in TBBT  */
+    int32       *chk_key  = NULL; /* Chunk recored key for insertion in TBBT */
+    const uint8 *bptr     = NULL; /* data buffer pointer */
+    void        *chk_data = NULL; /* chunk data */
+    uint8       *chk_dptr = NULL; /* chunk data pointer */
+    int32       relative_posn;    /* relative position in chunked element */
+    int32       bytes_written = 0;/* total #bytes written by HMCIwrite */
+    int32       write_len = 0;    /* next write size */
+    int32       write_seek = 0;   /* next write seek */
+    int32       chunk_size = 0;   /* chunk size */
+    int32       chunk_num = 0;    /* chunk number */
+    int32       ret_value = SUCCEED;
+    intn        k;                  /* loop index */
+#ifdef CHK_DEBUG_4
+    intn         i;
+#endif
+
+#ifdef CHK_DEBUG_4
+    printf("HMCPwrite called with length %d \n",length);
+#endif
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Set inputs */
+#ifdef UNUSED
+    data     = (uint8 *) datap;
+#endif /* UNUSED */
+    file_rec =  HAatom_object(access_rec->file_id);
+    info     = (chunkinfo_t *) (access_rec->special_info);
+    relative_posn = access_rec->posn;
+    write_len     = length;
+
+    /* validate length and file records */
+    if (length <= 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* should chunk indicies be updated with relative_posn? 
+       or did last operation update it already */
+    update_chunk_indicies_seek(access_rec->posn,info->ndims, info->nt_size,
+                               info->seek_chunk_indices,
+                               info->seek_pos_chunk,info->ddims);
+
+    bytes_written = 0;
+    bptr = datap;
+    while (bytes_written < write_len) 
+      {
+          /* for debuging */
+#ifdef CHK_DEBUG_4
+          printf("Seek start(in chunk array):(");
+          for (i = 0; i < info->ndims; i++)
+              printf("%d%s", info->seek_chunk_indices[i], i!= info->ndims-1 ? ",":NULL);
+          printf(")\n");
+          printf(" Seek start(within the chunk):(");
+          for (i = 0; i < info->ndims; i++)
+              printf("%d%s", info->seek_pos_chunk[i], i!= info->ndims-1 ? ",":NULL);
+          printf(")\n");
+#endif
+
+          /* calculate chunk to retrieve */
+          calculate_chunk_num(&chunk_num,info->ndims,info->seek_chunk_indices,
+                              info->ddims);
+
+          /* calculate contiguous chunk size that we can write to this chunk */
+          calculate_chunk_for_chunk(&chunk_size,info->ndims,info->nt_size,
+                                    write_len,bytes_written,
+                                    info->seek_chunk_indices,
+                                    info->seek_pos_chunk,info->ddims);
+
+#ifdef CHK_DEBUG_4
+          printf("    writing chunk(%d) of %d bytes ->\n", chunk_num, chunk_size);
+#endif
+
+          /* find chunk record in TBBT */
+          if (tbbtdfind(info->chk_tree, &chunk_num, NULL) == NULL)
+            { /* not in tree */
+                
+                /* so create a new chunk record */
+                /* Allocate space for a chunk record */
+                if ((chkptr = (CHUNK_REC *) HDmalloc(sizeof(CHUNK_REC))) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* Allocate space for a origin in chunk record */
+                if ((chkptr->origin = (int32 *) HDmalloc((size_t)info->ndims*sizeof(int32))) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* allocate space for key */
+                if ((chk_key = (int32 *)HDmalloc(sizeof(int32))) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                /* Initialize chunk record */
+                chkptr->chk_tag = DFTAG_NULL;
+                chkptr->chk_ref = 0;
+#ifdef CHK_DEBUG_4
+                printf(" chktpr->chk_tag=%d, ",chkptr->chk_tag);
+                printf(" chktpr->chk_ref=%d, ",chkptr->chk_ref);
+#endif
+                /* Intialize chunk origins */
+                for (k = 0; k < info->ndims; k++)
+                      chkptr->origin[k] = info->seek_chunk_indices[k];
+#ifdef CHK_DEBUG_4
+                printf(" chkptr->origin = (");
+                for (k = 0; k < info->ndims; k++)
+                    printf("%d%s", chkptr->origin[k], k!= info->ndims-1 ? ",":NULL);
+                printf(")\n");
+#endif
+                /* set chunk record number to next Vdata record number */
+                chkptr->chk_vnum = info->num_recs++;
+
+                /* set key to chunk number */
+                chkptr->chunk_number = *chk_key = chunk_num;
+
+                /* add to TBBT tree based on chunk number as the key */
+                tbbtdins(info->chk_tree, chkptr , chk_key);   
+
+#ifdef UNUSED
+                /* assign over new chk */
+                chk_rec = chkptr;
+#endif /* UNUSED */
+
+                /* re-intialize ptrs to allow for error-failure check */
+                chkptr = NULL;
+                chk_key = NULL;
+            }
+#ifdef UNUSED
+          else /* already in TBBT tree */
+              chk_rec = (CHUNK_REC *) entry->data; /* get file entry from node */
+#endif /* UNUSED */
+
+          /* would be nice to get Chunk record from TBBT based on chunk number 
+             and then get chunk data base on chunk vdata number but
+             currently the chunk calculations return chunk 
+             numbers and not Vdata record numbers. 
+             This would reduce some overhead in the number of chunks
+             dealt with in the cache */
+#ifdef CHK_DEBUG_4
+          printf("  getting chunk %d from cache\n",chunk_num);
+#endif
+          /* get chunk data from cache based on chunk number 
+             chunks in the cache start from 1 not 0 */
+          if ((chk_data = mcache_get(info->chk_cache, /* cache handle */
+                                              chunk_num+1,     /* chunk number */
+                                              0                /* flag: unused */)) 
+              == NULL)
+              HE_REPORT_GOTO("failed to find chunk record", FAIL);
+
+          chk_dptr = chk_data; /* set chunk data ptr */
+
+          /* calculate position in chunk */
+          calculate_seek_in_chunk(&write_seek,info->ndims,info->nt_size,
+                                  info->seek_pos_chunk,
+                                  info->ddims);
+
+          chk_dptr += write_seek; /* move to correct position in chunk */
+
+#ifdef CHK_DEBUG_4
+          fprintf(stderr,"  write pos in chunk (%d) is %d bytes\n", chunk_num, write_seek);
+#endif
+          /* copy data from users buffer to chunk */
+          HDmemcpy(chk_dptr, bptr, chunk_size);        
+
+#ifdef CHK_DEBUG_10
+          printf(" chk_dptr={");
+          for (i = 0; i < chunk_size; i++)
+              printf("%d,",(uint8)*((uint8 *)(chk_dptr)+i));
+          printf("}\n");
+#endif
+          /* put chunk back to cache as DIRTY */
+          if (mcache_put(info->chk_cache, /* cache handle */
+                         chk_data,        /* whole data chunk */
+                         MCACHE_DIRTY     /* flag:  DIRTY */) 
+              == FAIL)
+              HE_REPORT_GOTO("failed to put chunk back in cache", FAIL);
+
+          /* increment buffer pointer */
+          bptr += chunk_size;
+
+          /* adjust number of bytes already written */
+          bytes_written += chunk_size; 
+
+#ifdef CHK_DEBUG_4
+          printf("     written %d bytes already -> \n", bytes_written);
+#endif
+          /* update relative position i.e. user element seek postion 
+             with chunk size written */
+          relative_posn += chunk_size;
+#ifdef CHK_DEBUG_4
+          printf("  relative_posn = %d bytes \n", relative_posn);
+#endif
+          /* i.e calculate chunk indices given seek location 
+             this will update the proper arrays in the special info struct */
+          update_chunk_indicies_seek(relative_posn,info->ndims, info->nt_size,
+                                     info->seek_chunk_indices,
+                                     info->seek_pos_chunk,info->ddims);
+      } /* end while "bytes_written" */
+
+    /* update access record with bytes written */
+    access_rec->posn += bytes_written; 
+
+    ret_value = bytes_written;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          /* check chunk ptrs */
+          if (chkptr != NULL)
+            {
+                if (chkptr->origin != NULL)
+                    HDfree(chkptr->origin);
+                HDfree(chkptr);
+            }
+          if (chk_key != NULL)
+              HDfree(chk_key);
+      } /* end if */
+
+    /* Normal function cleanup */
+
+#ifdef CHK_DEBUG_4
+    printf("HMCPwrite: exited, ret=%d \n",ret_value);
+#endif
+    return ret_value;
+}   /* HMCPwrite */
+
+
+/* ---------------------------------------------------------------------
+NAME
+   HMCPcloseAID -- close file but keep AID active
+
+DESCRIPTION
+   Close the file currently being pointed to by this AID but 
+   do *NOT* free the AID.
+
+   This will flush the chunk cache and free up the special info struct.
+
+   This is called by Hnextread() which reuses an AID to point to
+   the 'next' object as requested.  If the current object was an
+   chunked object, the chunked information needs to be closed before all
+   reference to it is lost.
+
+   NOTE: Hnextread() is a bad fcn to use since it relies on previous state
+         information. 
+
+RETURNS
+   SUCCEED / FAIL
+AUTHOR
+   -GeorgeV - 9/3/96
+---------------------------------------------------------------------------*/
+int32
+HMCPcloseAID(accrec_t *access_rec /* IN:  access record of file to close */)
+{
+    CONSTR(FUNC, "HMCPcloseAID");    /* for HERROR */
+    chunkinfo_t *info     = NULL;    /* special information record */
+    int32       ret_value = SUCCEED;
+
+    /* check args */
+    info =  (chunkinfo_t *) access_rec->special_info;
+    if (info == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* detach the special information record.
+       If no more references to that, free the record */
+    if (--(info->attached) == 0)
+      {
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCPcloseAID: info->attached =%d, last one \n", info->attached);
+            
+#endif
+          if (info->chk_cache != NULL)
+            {
+                /* Sync chunk cache */
+                mcache_sync(info->chk_cache);
+#ifdef STATISTICS
+                /* cache statistics if 'mcache.c' complied with -DSTATISTICS */
+                mcache_stat(info->chk_cache);
+#endif
+                /* close chunk cache */
+                mcache_close(info->chk_cache);
+            } /* cache not empty */
+
+          /* clean up chunk table lists and info record here */
+          /* Use Vxxx interface to end access to Vdata info */
+          if (info->aid != FAIL)
+            {
+                if (VSdetach(info->aid) == FAIL)
+                    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+            }
+          else
+              HGOTO_ERROR(DFE_BADAID, FAIL);
+
+          if (Vend(access_rec->file_id) == FAIL)
+              HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+
+          /* clean up chunk tree */
+          tbbtdfree(info->chk_tree, chkdestroynode, chkfreekey);
+
+          /* free up stuff in special info */
+          if (info->ddims != NULL)
+              HDfree(info->ddims);
+          if (info->seek_chunk_indices != NULL)
+              HDfree(info->seek_chunk_indices);
+          if (info->seek_pos_chunk != NULL)
+              HDfree(info->seek_pos_chunk);
+          if (info->seek_user_indices != NULL)
+              HDfree(info->seek_user_indices);
+          if (info->fill_val != NULL)
+              HDfree(info->fill_val);
+          if (info->comp_sp_tag_header != NULL)
+              HDfree(info->comp_sp_tag_header);
+          if (info->cinfo != NULL)
+              HDfree(info->cinfo);
+          if (info->minfo != NULL)
+              HDfree(info->minfo);
+          /* finally free up info */
+          HDfree(info);
+          access_rec->special_info = NULL;
+      } /* attached to info */
+    else
+      {
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCPcloseAID: info->attached =%d \n", info->attached);
+            
+#endif
+      }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+}   /* HMCPcloseAID */
+
+/* ----------------------------- HPendaccess -----------------------------
+NAME
+   HMCPendacess -- close a chunk element AID
+
+DESCRIPTION
+   Free up all of the space used to store information about a
+   chunked element. All relevant info will be flushed.
+   Update proper records i.e. access_rec, file_rec..etc
+
+RETURNS
+   SUCCEED / FAIL
+AUTHOR
+   -GeorgeV - 9/3/96
+--------------------------------------------------------------------------- */
+intn
+HMCPendaccess(accrec_t * access_rec /* IN:  access record to close */)
+{
+    CONSTR(FUNC, "HMCPendaccess");   /* for HERROR */
+    filerec_t   *file_rec = NULL;    /* file record */
+    intn        ret_value = SUCCEED;
+
+    /* validate arguments first */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);        
+
+    /* get file rec and special info */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* validate file record */
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* detach the special information record.
+       If no more references to that, free the record */
+    if (HMCPcloseAID(access_rec) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* update file and access records */
+    if (HTPendaccess(access_rec->ddid) == FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    /* detach from the file */
+    file_rec->attach--;
+
+#ifdef CHK_DEBUG_2
+    fprintf(stderr,"HMCPendaccess: file_rec->attach =%d \n", file_rec->attach);
+            
+#endif
+    /* free the access record */
+    HIrelease_accrec_node(access_rec);
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+}   /* HMCPendaccess */
+
+/* ------------------------------- HMCPinfo --------------------------------
+NAME
+   HMCPinfo -- return info about a chunked element
+
+DESCRIPTION
+   Return information about the given chunked element.  
+   'info_chunk' is assumed to be non-NULL.
+   
+RETURNS
+   SUCCEED / FAIL
+AUTHOR
+   -GeorgeV - 9/3/96
+--------------------------------------------------------------------------- */
+int32
+HMCPinfo(accrec_t *access_rec,       /* IN: access record of access elemement */
+         sp_info_block_t *info_chunk /* OUT: information about the special element */)
+{
+    CONSTR(FUNC, "HMCPinfo");       /* for HERROR */
+    chunkinfo_t *info     = NULL;   /* special information record */
+    int32       ret_value = SUCCEED;
+    intn        i;                  /* loop variable */
+
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_CHUNKED)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the info_chunk */
+    info =  (chunkinfo_t *) access_rec->special_info;
+    info_chunk->key        = SPECIAL_CHUNKED;
+    info_chunk->chunk_size = (info->chunk_size * info->nt_size); /* phsyical size */
+    info_chunk->ndims      = info->ndims; 
+    if ((info->flag & 0xff) == SPECIAL_COMP) /* only using 8bits for now */
+      {
+          info_chunk->comp_type  = (int32)info->comp_type;
+          info_chunk->model_type = (int32)info->model_type;
+      }
+    else
+      {
+          info_chunk->comp_type  = COMP_CODE_NONE;
+          info_chunk->model_type = 0;
+      }
+
+    /* allocate space for chunk lengths */
+    if (( info_chunk->cdims = (int32 *) HDmalloc((size_t)info->ndims*sizeof(int32)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* copy info over */
+    for (i = 0; i < info->ndims; i++)
+      {
+          info_chunk->cdims[i] = info->ddims[i].chunk_length; 
+      }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (info_chunk->cdims != NULL)
+              HDfree(info_chunk->cdims);
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+}   /* HMCPinfo */
+
+/* ------------------------------ HMCPinquire ----------------------------- 
+NAME
+   HMCPinquire -- Hinquire for chunked elements
+
+DESCRIPTION
+   Return interesting information about a chunked element.
+   NULL can be passed for any of the OUT parameters if their
+   value is not needed.
+
+RETURNS
+   SUCCEED/FAIL
+AUTHOR
+   -GeorgeV - 9/3/96
+--------------------------------------------------------------------------- */
+int32
+HMCPinquire(accrec_t *access_rec,  /* IN:  access record to return info about */
+            int32 *pfile_id,       /* OUT: file ID; */
+            uint16 *ptag,          /* OUT: tag of info record; */
+            uint16 *pref,          /* OUT: ref of info record; */
+            int32 *plength,        /* OUT: length of element; */
+            int32 *poffset,        /* OUT: offset of element -- meaningless */
+            int32 *pposn,          /* OUT: current position in element; */
+            int16 *paccess,        /* OUT: access mode; */
+            int16 *pspecial        /* OUT: special code; */)
+{
+    CONSTR(FUNC, "HMCPinquire");    /* for HERROR */
+    uint16      data_tag, data_ref; /* Tag/ref of the data in the file */
+    chunkinfo_t *info = NULL;       /* special information record */
+    int32       ret_value = SUCCEED;
+
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get special info */
+    info =   (chunkinfo_t *) access_rec->special_info;
+
+    /* get latest info for the dataset */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,NULL,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the variables if they are present */
+    if (pfile_id)
+        *pfile_id = access_rec->file_id;
+    if (ptag)
+        *ptag = data_tag;
+    if (pref)
+        *pref = data_ref;
+    if (plength)
+        *plength = (info->length * info->nt_size);
+    if (poffset)
+        *poffset = 0;   /* meaningless */
+    if (pposn)
+        *pposn = access_rec->posn;
+    if (paccess)
+        *paccess = (int16)access_rec->access;
+    if (pspecial)
+        *pspecial = (int16)access_rec->special;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+}   /* HMCPinquire */
+
+/* -------------------------------------------------------------------------
+NAME
+   HMCPgetnumrecs -- get the number of records in a chunked element
+DESCRIPTION
+   Retrieves the number of records in a chunked element.  
+   This function was originally added for SDcheckempty/HDcheckempty to 
+   determine whether a chunked SDS has been written with data.
+RETURNS
+   SUCCEED/FAIL - FAIL when num_recs is NULL
+AUTHOR
+   bmribler - 10/3/2004
+---------------------------------------------------------------------------*/
+int32
+HMCPgetnumrecs(accrec_t* access_rec,	/* access record */
+               int32 *num_recs		/* OUT: length of the chunked elt */)
+{
+    CONSTR(FUNC, "HMCPgetnumrecs");	/* for HGOTO_ERROR */
+    chunkinfo_t *chunk_info = NULL;	/* chunked element information record */
+    int32       ret_value = SUCCEED;
+
+    /* Check args */
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get the special info from the given record */
+    chunk_info = (chunkinfo_t *) access_rec->special_info;
+    if (chunk_info == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (num_recs)
+        *num_recs = chunk_info->num_recs;
+    else
+	ret_value = FAIL;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+}   /* HMCPgetnumrecs */
+
diff --git a/hdf/src/hchunks.h b/hdf/src/hchunks.h
new file mode 100644
index 0000000..a2e4eca
--- /dev/null
+++ b/hdf/src/hchunks.h
@@ -0,0 +1,317 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hchunks.h 5494 2010-11-01 05:10:53Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:         hchunks.h
+ * Purpose:      Header file for Chunked elements
+ * Dependencies: tbbt.c mcache.c
+ * Invokes:      none
+ * Contents:     Structures & definitions for chunked elements
+ * Structure definitions: DIM_DEF, HCHUNK_DEF
+ * Constant definitions:
+ * Author: -GeorgeV -  9/3/96
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __HCHUNKS_H
+#define __HCHUNKS_H
+
+#include "H4api_adpt.h"
+
+/* required includes */
+#include "hfile.h"  /* special info stuff */
+
+#ifdef   _HCHUNKS_MAIN_
+/* Private to 'hchunks.c' */
+
+#include "tbbt.h"   /* TBBT stuff */
+#include "mcache.h" /* caching routines */
+#include "hcomp.h"  /* For Compression */
+
+/* Define class, class version and name(partial) for chunk table i.e. Vdata */
+#if 0 /* moved definition of class of vdata to hlimits.h */
+#define _HDF_CHK_TBL_CLASS "_HDF_CHK_TBL_" /* 13 bytes */
+#define _HDF_CHK_TBL_CLASS_VER  0          /* zero version number for class */
+#endif /* moved definition of class of vdata to hlimits.h */ 
+#define _HDF_CHK_TBL_NAME  "_HDF_CHK_TBL_" /* 13 bytes */
+
+/* Define field name for each chunk record i.e. Vdata record */
+#define _HDF_CHK_FIELD_1   "origin"  /* 6 bytes */
+#define _HDF_CHK_FIELD_2   "chk_tag" /* 7 bytes */
+#define _HDF_CHK_FIELD_3   "chk_ref" /* 7 bytes */
+#define _HDF_CHK_FIELD_NAMES   "origin,chk_tag,chk_ref" /* 22 bytes */
+
+/* Define version number for chunked header format */
+#define _HDF_CHK_HDR_VER   0  /* zero version for format header */
+
+#endif /* _HCHUNKS_MAIN_ */
+
+/* Public structures */
+
+/* Structure for each Data array dimension Defintion */
+typedef struct dim_def_struct {
+    int32 dim_length;          /* length of this dimension */
+    int32 chunk_length;        /* chunk length along this dimension */
+    int32 distrib_type;        /* Data distribution along this dimension */
+} DIM_DEF, * DIM_DEF_PTR;
+
+/* Structure for each Chunk Definition*/
+typedef struct hchunk_def_struct {
+    int32    chunk_size;     /* size of this chunk*/
+    int32    nt_size;        /* number type size i.e. size of data type */
+    int32    num_dims;       /* number of actual dimensions */
+    DIM_DEF *pdims;          /* ptr to array of dimension records for this chunk*/
+    int32   chunk_flag;      /* multiply specialness? SPECIAL_COMP */
+
+    /* For Compression info */
+    comp_coder_t comp_type;     /* Compression type */
+    comp_model_t model_type;    /* Compression model type */
+    comp_info  *cinfo;        /* Compression info struct */
+    model_info *minfo;        /* Compression model info struct */
+}HCHUNK_DEF, * HCHUNK_DEF_PTR;
+
+/* Private structues */
+#ifdef _HCHUNKS_MAIN_
+/* Private to 'hchunks.c' */
+
+/* Structure for each Data array dimension */
+typedef struct dim_rec_struct {
+    /* fields stored in chunked header */
+    int32 flag;                /* distrib_type(low 8 bits 0-7)
+                                  - Data distribution along this dimension 
+                                  other(medium low 8 bits 8-15)
+                                  - regular/unlimited dimension? */
+    int32 dim_length;          /* length of this dimension */
+    int32 chunk_length;        /* chunk length along this dimension */
+    
+    /* info determined from 'flag' field */
+    int32 distrib_type;        /* Data distribution along this dimension */
+    int32 unlimited;           /* regular(0) or unlimited dimension(1) */
+
+    /* computed fields */
+    int32 last_chunk_length;   /* last chunk length along this dimension */
+    int32 num_chunks;          /* i.e. "dim_length / chunk_length" */
+} DIM_REC, * DIM_REC_PTR;
+
+/* Structure for each Chunk */
+typedef struct chunk_rec_struct {
+    int32 chunk_number;      /* chunk number from coordinates i.e. origin */
+    int32 chk_vnum;          /* chunk vdata record number i.e. position in table*/
+
+    /* chunk record fields stored in Vdata Table */
+    int32  *origin;          /* origin -> position of chunk */
+    uint16 chk_tag;          /* DFTAG_CHUNK or another Chunked element? */
+    uint16 chk_ref;          /* reference number of this chunk */
+}CHUNK_REC, * CHUNK_REC_PTR;
+
+/* information on this special chunk data elt */
+typedef struct chunkinfo_t
+{
+    intn        attached;     /* how many access records refer to this elt */
+    int32       aid;          /* Access id of chunk table i.e. Vdata */
+
+    /* chunked element format header  fields */
+    int32       sp_tag_header_len; /* length of the special element header */
+    uint8       version;      /* Version of this Chunked element */
+    int32       flag;         /* flag for multiply specialness ...*/
+    int32       length;       /* the actual length of the data elt */
+    int32       chunk_size;   /* the logical size of the chunks */
+    int32       nt_size;      /* number type size i.e. size of data type */
+    uint16      chktbl_tag;   /* DFTAG_VH - Vdata header */
+    uint16      chktbl_ref;   /* ref of the first chunk table structure(VDATA) */
+    uint16      sp_tag;       /* For future use.. */
+    uint16      sp_ref;       /* For future use.. */
+    int32       ndims;        /* number of dimensions of chunk */
+    DIM_REC     *ddims;       /* array of dimension records */
+    int32       fill_val_len; /* fill value number of bytes */
+    VOID        *fill_val;    /* fill value */
+    /* For each specialness, only one for now SPECIAL_COMP */
+    int32       comp_sp_tag_head_len; /* Compression header length */
+    VOID        *comp_sp_tag_header;  /* compression header */
+
+    /* For Compression info */
+    comp_coder_t comp_type;            /* Compression type */
+    comp_model_t model_type;           /* Compression model type */
+    comp_info   *cinfo;               /* Compression info struct */
+    model_info  *minfo;               /* Compression model info struct */
+
+    /* additional memory resident data structures to be used */
+    int32       *seek_chunk_indices; /* chunk array indicies relative
+                                        to the other chunks */
+    int32       *seek_pos_chunk;     /* postion within the current chunk */
+    int32       *seek_user_indices;  /* user postion within the element  */
+    TBBT_TREE   *chk_tree;    /* TBBT tree of all accessed table entries 
+                                 i.e. CHUNK_REC's read/written/modified */
+    MCACHE      *chk_cache;   /* chunk cache */
+    int32       num_recs;     /* number of Table(Vdata) records */
+}
+chunkinfo_t;
+#endif /* _HCHUNKS_MAIN_ */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+** from hchunks.c
+*/
+
+/* User Public */
+    HDFLIBAPI int32 HMCcreate
+        (int32 file_id,       /* IN: file to put linked chunk element in */
+         uint16 tag,          /* IN: tag of element */
+         uint16 ref,          /* IN: ref of element */
+         uint8 nlevels,       /* IN: number of levels of chunks */
+         int32 fill_val_len,  /* IN: fill value length in bytes */
+         VOID  *fill_val,     /* IN: fill value */
+         HCHUNK_DEF *chk_array /* IN: structure describing chunk distribution
+                                 can be an array? but we only handle 1 level */);
+
+    HDFLIBAPI intn HMCgetcompress
+        (accrec_t* access_rec,    /* IN: access record */
+         comp_coder_t* comp_type, /* OUT: compression type */
+         comp_info* c_info        /* OUT: retrieved compression info */);
+
+    HDFLIBAPI intn HMCgetcomptype
+        (int32 access_id,         /* IN: access record */
+         comp_coder_t* comp_type  /* OUT: compression type */);
+
+    HDFLIBAPI intn HMCgetdatainfo
+        (int32 file_id,    /* IN: file in which element is located */
+         uint16 data_tag,
+         uint16 data_ref,
+	 int32 *chk_coord, /* IN: chunk coord array or NULL for non-chunk SDS */
+         uintn start_block,/* IN: data block to start at, 0 base */
+         uintn info_count, /* IN: size of offset/length lists */
+         int32 *offsetarray,     /* OUT: array to hold offsets */
+         int32 *lengtharray);    /* OUT: array to hold lengths */
+
+    HDFLIBAPI intn HMCgetdatasize
+        (int32 file_id,    /* IN: file in which element is located */
+         uint8 *p,         /* IN: buffer of special info header */
+         int32 *comp_size, /* OUT: size of compressed data */
+         int32 *orig_size  /* OUT: size of non-compressed data */);
+
+    HDFLIBAPI int32 HMCsetMaxcache
+        (int32 access_id,  /* IN: access aid to mess with */
+         int32 maxcache,   /* IN: max number of pages to cache */
+         int32 flags       /* IN: flags = 0, HMC_PAGEALL */);
+
+    HDFLIBAPI int32 HMCwriteChunk
+        (int32 access_id,  /* IN: access aid to mess with */
+         int32 *origin,    /* IN: origin of chunk to write */
+         const VOID *datap /* IN: buffer for data */);
+
+    HDFLIBAPI int32 HMCreadChunk
+        (int32 access_id,  /* IN: access aid to mess with */
+         int32 *origin,    /* IN: origin of chunk to read */
+         VOID *datap       /* IN: buffer for data */);
+
+    HDFLIBAPI int32 HMCPcloseAID
+        (accrec_t *access_rec /* IN:  access record of file to close */);
+
+    HDFLIBAPI int32 HMCPgetnumrecs /* has to be here because used in hfile.c */
+        (accrec_t * access_rec, /* IN:  access record to return info about */
+         int32 *num_recs        /* OUT: length of the chunked elt */);
+
+/* Library Private */
+#ifdef _HCHUNKS_MAIN_
+    /* tbbt.h helper routines */
+    intn chkcompare(void * k1,   /* IN: first key */
+           void * k2,   /* IN: second key */
+           intn cmparg /* IN: not sure? */);
+    void chkfreekey(void * key /*IN: chunk key */ );
+    void chkdestroynode(void * n /* IN: chunk record */ );
+
+/* Private to 'hchunks.c' */
+    extern int32 HMCPstread
+        (accrec_t *access_rec  /* IN: access record to fill in */);
+
+    extern int32 HMCPstwrite
+        (accrec_t *access_rec  /* IN: access record to fill in */);
+
+    extern int32 HMCPseek
+        (accrec_t *access_rec, /* IN: access record to mess with */
+         int32 offset,         /* IN: seek offset */
+         int   origin          /* IN: where we should calc the offset from */);
+
+    extern int32 HMCPchunkread
+        (VOID  *cookie,    /* IN: access record to mess with */
+         int32 chunk_num,  /* IN: chunk to read */
+         VOID  *datap      /* OUT: buffer for data */);
+
+    extern int32 HMCPread
+        (accrec_t * access_rec, /* IN: access record to mess with */
+         int32 length,          /* IN: number of bytes to read */
+         void * data             /* OUT: buffer for data */);
+
+    extern int32 HMCPchunkwrite
+        (VOID  *cookie,    /* IN: access record to mess with */
+         int32 chunk_num,  /* IN: chunk number */
+         const VOID *datap /* IN: buffer for data */);
+
+    extern int32 HMCPwrite
+        (accrec_t *access_rec, /* IN: access record to mess with */
+         int32 length,         /* IN: number of bytes to write */
+         const void * data      /* IN: buffer for data */);
+
+    extern intn HMCPendaccess
+        (accrec_t *access_rec /* IN:  access record to close */);
+
+    extern int32 HMCPinfo
+        (accrec_t *access_rec,       /* IN: access record of access elemement */
+         sp_info_block_t *info_chunk /* OUT: information about the special element */);
+
+    extern int32 HMCPinquire
+        (accrec_t * access_rec, /* IN:  access record to return info about */
+         int32 *pfile_id,       /* OUT: file ID; */
+         uint16 *ptag,          /* OUT: tag of info record; */
+         uint16 *pref,          /* OUT: ref of info record; */
+         int32 *plength,        /* OUT: length of element; */
+         int32 *poffset,        /* OUT: offset of element -- meaningless */
+         int32 *pposn,          /* OUT: current position in element; */
+         int16 *paccess,        /* OUT: access mode; */
+         int16 *pspecial        /* OUT: special code; */);
+
+#endif /* _HCHUNKS_MAIN_ */
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#ifndef _HCHUNKS_MAIN_
+/* not in master file hchunk.c */
+extern funclist_t chunked_funcs;  /* functions to perform chunking */
+
+#else /* in hchunks.c */
+
+/* the accessing special function table for chunks */
+funclist_t  chunked_funcs =
+{
+    HMCPstread,
+    HMCPstwrite,
+    HMCPseek,
+    HMCPinquire,
+    HMCPread,
+    HMCPwrite,
+    HMCPendaccess,
+    HMCPinfo,
+    NULL         /* no routine registerd */
+};
+
+#endif
+
+#endif /* __HCHUNKS_H */
diff --git a/hdf/src/hcomp.c b/hdf/src/hcomp.c
new file mode 100644
index 0000000..96748d3
--- /dev/null
+++ b/hdf/src/hcomp.c
@@ -0,0 +1,2009 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5887 $";
+#endif
+
+/* $Id: hcomp.c 5887 2012-10-08 04:57:47Z bmribler $ */
+
+/*
+FILE
+   hcomp.c
+   HDF compressed data I/O routines
+
+REMARKS
+   These functions read and write compressed data to HDF data objects.
+   The compressed data objects are implemented as "special tags"
+   in the HDF file and the "H" layer I/O routines break out to the
+   functions in this module to deal with them.
+
+DESIGN
+   The compression I/O functions are designed as state machines.
+   There are two seperate state machines implemented, as layers
+   on top of one another. 
+      The top layer is the modeling layer, 
+   whose purpose is to send/receive uncompressed bytes between the higher 
+   layer (the "H" layer routines) and the lower layer, the coding layer.
+   The modeling layer is constrained to look like Standard C
+   I/O functions to the upper layer, while sending data in
+   potentially unusual orders to the coding layer.  [An unusual
+   order of bytes would be a Peano or Hilbert curve instead
+   of the raster order more normally used].
+      The lower layer is the coding layer, whose purpose is to
+   send/receive bytes of data to the higher layer (the modeling
+   layer) and to send/receive bits/bytes of data to the bit I/O
+   functions after encoding them with some compression scheme.
+   Both of these layers are designed as independent state
+   machines whose state contains all the information to restart
+   at a given point.  The purpose of this is to "cache" the
+   state of each layer at certain [convenient] times in order
+   to increase performance during random I/O.
+
+BUGS/LIMITATIONS
+   Currently the following design limitations are still in place:
+   1 - Cannot compress an existing data element (will be fixed
+       before release)  [ I think this is done, but it needs
+       testing]
+
+   2 - Statistic gathering from several types of compression
+       is not implemented (should be fixed before release)
+   3 - "State caching" for improved performance in not implemented,
+       although some data-structures allow for it. (should be
+       fixed before release)
+   4 - Random writing in compressed data is not supported (unlikely
+       to _ever_ be fixed)
+
+EXPORTED ROUTINES
+   HCcreate - create or modify an existing data element to be compressed
+LOCAL ROUTINES
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   9/21/93  - Starting writing specs & coding prototype
+   10/09/93 - Finished initial testing.  First version with only stdio
+              modeling and RLE coding done.
+ */
+
+/* General HDF includes */
+#define COMPRESS_MASTER
+#include "hdf.h"
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"                                                                                 
+#endif 
+
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* Local defines */
+#define COMP_HEADER_VERSION 0
+#ifdef OLD_WAY
+#define COMP_START_BLOCK    1
+#else /* OLD_WAY */
+#define COMP_START_BLOCK    0
+#endif /* OLD_WAY */
+
+/* declaration of the functions provided in this module */
+PRIVATE int32 HCIstaccess
+            (accrec_t * access_rec, int16 acc_mode);
+
+PRIVATE int32 HCIinit_coder
+            (int16 acc_mode, comp_coder_info_t * cinfo, comp_coder_t coder_type,
+             comp_info * coder_info);
+
+PRIVATE int32 HCIread_header
+            (accrec_t * access_rec, compinfo_t * info,
+                comp_info * c_info, model_info * m_info);
+
+PRIVATE int32 HCIwrite_header
+            (atom_t file_id, compinfo_t * info, uint16 special_tag, uint16 ref,
+            comp_info *c_info, model_info *m_info);
+
+PRIVATE int32 HCIinit_model
+            (int16 acc_mode, comp_model_info_t * minfo, comp_model_t model_type,
+             model_info * m_info);
+
+/* comp_funcs -- struct of accessing functions for the compressed
+   data element function modules.  The position of each function in
+   the table is standard */
+
+funclist_t  comp_funcs =
+{
+    HCPstread,
+    HCPstwrite,
+    HCPseek,
+    HCPinquire,
+    HCPread,
+    HCPwrite,
+    HCPendaccess,
+    HCPinfo,
+    NULL         /* no routine registerd */
+};
+
+/* #define TESTING */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIinit_coder -- Set the coder function pointers
+ USAGE
+    int32 HCIinit_coder(cinfo,coder_type,coder_info)
+    comp_coder_info_t *cinfo;   IN/OUT: pointer to coder information to modify
+    comp_coder_t coder_type;    IN: the type of encoding to use
+    comp_info *coder_info;      IN: setup information for some encoding types
+
+ RETURNS
+    Return SUCCEED or FAIL
+ DESCRIPTION
+    Sets the encoder function pointers and the encoder type for a given
+    coder type.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    IMCOMP: Since IMCOMP is no longer supported in creating new data but the
+	    library still reads existing data, it may need to be added into
+	    this function somehow.  Yet, I'm not sure exactly how it should
+	    be added because this function is called in both cases, writing
+	    and reading.  At this time, the function will fail if it encounters
+	    COMP_CODE_IMCOMP. -BMR, Jul 11, 2012
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIinit_coder(int16 acc_mode, comp_coder_info_t * cinfo, comp_coder_t coder_type,
+              comp_info * c_info)
+{
+    uint32 comp_info;
+    CONSTR(FUNC, "HCIinit_coder");  /* for HERROR */
+
+    HCget_config_info(coder_type, &comp_info);
+    if ((comp_info & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED) == 0) {
+	/* coder not present?? */
+              HRETURN_ERROR(DFE_BADCODER, FAIL)
+    }
+
+    switch (coder_type)
+      {     /* determine the type of encoding */
+          case COMP_CODE_NONE:      /* "none" (i.e. no) encoding */
+              cinfo->coder_type = COMP_CODE_NONE;   /* set coding type */
+              cinfo->coder_funcs = cnone_funcs;     /* set the "none" func. ptrs */
+              break;
+
+          case COMP_CODE_RLE:   /* Run-length encoding */
+              cinfo->coder_type = COMP_CODE_RLE;    /* set coding type */
+              cinfo->coder_funcs = crle_funcs;  /* set the RLE func. ptrs */
+              break;
+
+          case COMP_CODE_NBIT:      /* N-bit encoding */
+              cinfo->coder_type = COMP_CODE_NBIT;   /* set the coding type */
+              cinfo->coder_funcs = cnbit_funcs;     /* set the N-bit func. ptrs */
+
+              /* copy encoding info */
+              cinfo->coder_info.nbit_info.nt = c_info->nbit.nt;
+              cinfo->coder_info.nbit_info.sign_ext = c_info->nbit.sign_ext;
+              cinfo->coder_info.nbit_info.fill_one = c_info->nbit.fill_one;
+              cinfo->coder_info.nbit_info.mask_off = c_info->nbit.start_bit;
+              cinfo->coder_info.nbit_info.mask_len = c_info->nbit.bit_len;
+              if ((cinfo->coder_info.nbit_info.nt_size
+                   = DFKNTsize(cinfo->coder_info.nbit_info.nt)) == FAIL)
+                  HRETURN_ERROR(DFE_BADNUMTYPE, FAIL);
+              break;
+
+          case COMP_CODE_SKPHUFF:   /* Skipping Huffman encoding */
+              if(c_info->skphuff.skp_size<1)
+                  HRETURN_ERROR(DFE_BADCODER, FAIL)
+
+              /* set the coding type and the skipping huffman func. ptrs */
+              cinfo->coder_type = COMP_CODE_SKPHUFF;
+              cinfo->coder_funcs = cskphuff_funcs;
+
+              /* copy encoding info */
+              cinfo->coder_info.skphuff_info.skip_size = c_info->skphuff.skp_size;
+              break;
+
+          case COMP_CODE_DEFLATE:   /* gzip 'deflate' encoding */
+	      /* valid deflate levels are from 0 to 9, this error checking
+		 caused the problem in HDF4r1.2 , fixed by Apu Kapadia    
+	      if(c_info->deflate.level<1 || c_info->deflate.level>9)
+	      */
+              if(c_info->deflate.level<0 || c_info->deflate.level>9)
+                  HRETURN_ERROR(DFE_BADCODER, FAIL)
+
+              /* set the coding type and the gzip 'deflate' func. ptrs */
+              cinfo->coder_type = COMP_CODE_DEFLATE;
+              cinfo->coder_funcs = cdeflate_funcs;
+
+              /* copy encoding info */
+              if(acc_mode&DFACC_WRITE)
+                  cinfo->coder_info.deflate_info.deflate_level = c_info->deflate.level;
+              break;
+
+           case COMP_CODE_SZIP:
+              /* set the coding type */
+              cinfo->coder_type = COMP_CODE_SZIP;
+
+	      /* when libsz presents, initialize other info - BMR, 08/25/2007
+		 (changed from eliminating this case completely) */
+	      /* completely removed the libsz limitation, we shouldn't need 
+		 szip library to initialize here - BMR, 10/21/2008 */
+
+              /* set the szip func. ptrs */
+              cinfo->coder_funcs = cszip_funcs;
+
+              /* copy encoding info */
+              cinfo->coder_info.szip_info.pixels = c_info->szip.pixels;
+              cinfo->coder_info.szip_info.bits_per_pixel = c_info->szip.bits_per_pixel;
+              cinfo->coder_info.szip_info.pixels_per_block = c_info->szip.pixels_per_block;
+              cinfo->coder_info.szip_info.pixels_per_scanline = c_info->szip.pixels_per_scanline;
+              cinfo->coder_info.szip_info.options_mask = c_info->szip.options_mask;
+              cinfo->coder_info.szip_info.buffer = NULL;
+              cinfo->coder_info.szip_info.buffer_size = 0;
+              cinfo->coder_info.szip_info.offset = 0;
+              cinfo->coder_info.szip_info.szip_state = SZIP_INIT;
+              cinfo->coder_info.szip_info.szip_dirty = SZIP_CLEAN;
+              break;
+
+          default:
+              HRETURN_ERROR(DFE_BADCODER, FAIL)
+      }     /* end switch */
+    return (SUCCEED);
+}   /* end HCIinit_coder() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIinit_model -- Set the model function pointers
+ USAGE
+    int32 HCIinit_model(minfo,model_type,m_info)
+    comp_model_info_t *minfo;   IN/OUT: pointer to model information to modify
+    comp_model_t model_type;    IN: the type of encoding to use
+    model_info *m_info;         IN: modeling information
+
+ RETURNS
+    Return SUCCEED or FAIL
+ DESCRIPTION
+    Sets the modeling function pointers and the model type for a given
+    model type.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIinit_model(int16 acc_mode, comp_model_info_t * minfo, comp_model_t model_type,
+              model_info * m_info)
+{
+    CONSTR(FUNC, "HCIinit_model");  /* for HERROR */
+
+    /* shut compiler up */
+    acc_mode = acc_mode;
+    m_info = m_info;
+
+    switch (model_type)
+      {     /* determine the type of modeling */
+          case COMP_MODEL_STDIO:    /* standard C stdio modeling */
+              minfo->model_type = COMP_MODEL_STDIO;     /* set model type */
+              minfo->model_funcs = mstdio_funcs;    /* set the stdio func. ptrs */
+              break;
+
+          default:
+              HRETURN_ERROR(DFE_BADMODEL, FAIL)
+      }     /* end switch */
+
+    return (SUCCEED);
+}   /* end HCIinit_model() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPquery_encode_header -- Query the length of compression header for a memory buffer
+ USAGE
+    int32 HCPquery_encode_header(model_type, model_info, coder_type, coder_info)
+    comp_model_t model_type; IN: the type of modeling to use
+    model_info *m_info;      IN: Information needed for the modeling type chosen
+    comp_coder_t coder_type; IN: the type of encoding to use
+    coder_info *c_info;      IN: Information needed for the encoding type chosen
+
+ RETURNS
+    Return the length of the buffer needed to store the compression header on
+    success (>0) or FAIL (-1)
+ DESCRIPTION
+    Determine the compression information length in a memory block.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPquery_encode_header(comp_model_t model_type, model_info * m_info,
+         comp_coder_t coder_type, comp_info * c_info)
+{
+    CONSTR(FUNC, "HCPquery_encode_header");    /* for HERROR */
+    int32 coder_len=2;  /* # of bytes to encode coder information (2 minimum) */
+    int32 model_len=2;  /* # of bytes to encode model information (2 minimum) */
+    int32 ret_value=SUCCEED;
+    
+    /* clear error stack and validate args */
+    HEclear();
+    if (m_info==NULL || c_info==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* add any additional information needed for modeling type */
+    switch (model_type)
+      {
+          default:      /* no additional information needed */
+              break;
+      }     /* end switch */
+
+    /* add any additional information needed for coding type */
+    switch (coder_type)
+      {
+          case COMP_CODE_NBIT:    /* N-bit coding needs 16 bytes of info */
+              coder_len+=16;
+              break;
+
+          case COMP_CODE_SKPHUFF: /* Skipping Huffman coding needs 8 bytes of info */
+              coder_len+=8;
+              break;
+
+          case COMP_CODE_DEFLATE: /* Deflation coding stores deflation level */
+              coder_len+=2;
+              break;
+
+          case COMP_CODE_SZIP: /* Szip coding stores various szip parameters */
+	      coder_len += 14;
+	      break;
+
+          case COMP_CODE_IMCOMP: /* IMCOMP is no longer supported, can only be inquired */
+              HRETURN_ERROR(DFE_BADCODER, FAIL);
+              break;
+
+          default:      /* no additional information needed */
+              break;
+      }     /* end switch */
+
+    ret_value=model_len+coder_len;
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+  
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+} /* end HCPquery_encode_header() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPencode_header -- Encode the compression header info to a memory buffer
+ USAGE
+    intn HCPencode_header(model_type, model_info, coder_type, coder_info)
+    void * buf;               OUT: encoded compression info header
+    comp_model_t model_type; IN: the type of modeling to use
+    model_info *m_info;      IN: Information needed for the modeling type chosen
+    comp_coder_t coder_type; IN: the type of encoding to use
+    coder_info *c_info;      IN: Information needed for the encoding type chosen
+
+ RETURNS
+    Return SUCCEED or FAIL
+ DESCRIPTION
+    Encodes the compression information to a block in memory.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPencode_header(uint8 *p, comp_model_t model_type, model_info * m_info,
+         comp_coder_t coder_type, comp_info * c_info)
+{
+    CONSTR(FUNC, "HCPencode_header");    /* for HERROR */
+    int32 ret_value=SUCCEED;
+    
+    /* clear error stack and validate args */
+    HEclear();
+    if (p==NULL || m_info==NULL || c_info==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    UINT16ENCODE(p, (uint16) model_type);   /* specify model type */
+    UINT16ENCODE(p, (uint16) coder_type);   /* specify coder type */
+
+    /* add any additional information needed for modeling type */
+    switch (model_type)
+      {
+          default:      /* no additional information needed */
+              break;
+      }     /* end switch */
+
+    /* add any additional information needed for coding type */
+    switch (coder_type)
+      {
+          case COMP_CODE_NBIT:      /* N-bit coding needs info */
+              /* specify number-type of N-bit data */
+              INT32ENCODE(p, c_info->nbit.nt);
+              /* next is the flag to indicate whether to sign extend */
+              UINT16ENCODE(p, (uint16) c_info->nbit.sign_ext);
+              /* flag to fill with 1's or 0's */
+              UINT16ENCODE(p, (uint16) c_info->nbit.fill_one);
+              /* the offset of the bits extracted */
+              INT32ENCODE(p, (int32) c_info->nbit.start_bit);
+              /* the number of bits extracted */
+              INT32ENCODE(p, (int32) c_info->nbit.bit_len);
+              break;
+
+          case COMP_CODE_SKPHUFF:   /* Skipping Huffman coding needs info */
+              if(c_info->skphuff.skp_size<1)
+                  HRETURN_ERROR(DFE_BADCODER, FAIL)
+
+              /* specify skipping unit size */
+              UINT32ENCODE(p, (uint32) c_info->skphuff.skp_size);
+              /* specify # of bytes compressed (not used currently) */
+              UINT32ENCODE(p, (uint32) c_info->skphuff.skp_size);
+              break;
+
+          case COMP_CODE_DEFLATE:   /* Deflation coding stores deflation level */
+              /* valid deflate levels are from 0 to 9
+              if(c_info->deflate.level<1 || c_info->deflate.level>9)
+              */
+              if(c_info->deflate.level<0 || c_info->deflate.level>9)
+                  HRETURN_ERROR(DFE_BADCODER, FAIL)
+
+              /* specify deflation level */
+              UINT16ENCODE(p, (uint16) c_info->deflate.level);
+              break;
+
+          case COMP_CODE_SZIP: /* Szip coding stores various szip parameters */
+              UINT32ENCODE(p, (uint32) c_info->szip.pixels);
+              UINT32ENCODE(p, (uint32) c_info->szip.pixels_per_scanline);
+              UINT32ENCODE(p, (uint32) (c_info->szip.options_mask | SZ_H4_REV_2));
+              *p++ = (uint8) c_info->szip.bits_per_pixel;
+              *p++ = (uint8) c_info->szip.pixels_per_block;
+              break;
+
+          case COMP_CODE_IMCOMP: /* IMCOMP is no longer supported, can only be inquired */
+              HRETURN_ERROR(DFE_BADCODER, FAIL);
+              break;
+
+          default:      /* no additional information needed */
+              break;
+      }     /* end switch */
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+  
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+} /* end HCPencode_header() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPdecode_header -- Decode the compression header info from a memory buffer
+ USAGE
+    intn HCPdecode_header(model_type, model_info, coder_type, coder_info)
+    void * buf;                  IN: encoded compression info header
+    comp_model_t *model_type;   OUT: the type of modeling to use
+    model_info *m_info;         OUT: Information needed for the modeling type chosen
+    comp_coder_t *coder_type;   OUT: the type of encoding to use
+    coder_info *c_info;         OUT: Information needed for the encoding type chosen
+
+ RETURNS
+    Return SUCCEED or FAIL
+ DESCRIPTION
+    Decodes the compression information from a block in memory.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPdecode_header(uint8 *p, comp_model_t *model_type, model_info * m_info,
+         comp_coder_t *coder_type, comp_info * c_info)
+{
+    CONSTR(FUNC, "HCPdecode_header");    /* for HERROR */
+    uint16 m_type, c_type;
+    int32 ret_value=SUCCEED;
+
+    /* clear error stack and validate args */
+    HEclear();
+    if (p==NULL || model_type==NULL || m_info==NULL || coder_type==NULL || c_info==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    UINT16DECODE(p, m_type);     /* get model type */
+    *model_type=(comp_model_t)m_type;
+    UINT16DECODE(p, c_type);     /* get encoding type */
+    *coder_type=(comp_coder_t)c_type;
+
+    /* read any additional information needed for modeling type */
+    switch (*model_type)
+      {
+          default:      /* no additional information needed */
+              break;
+      }     /* end switch */
+
+    /* read any additional information needed for coding type */
+    switch (*coder_type)
+      {
+          case COMP_CODE_NBIT:      /* Obtain info for N-bit coding */
+              {
+                  uint16      s_ext;    /* temp. var for sign extend */
+                  uint16      f_one;    /* temp. var for fill one */
+                  int32       m_off, m_len;     /* temp. var for mask offset and len */
+
+                  /* number-type of N-bit data */
+                  INT32DECODE(p, c_info->nbit.nt);
+                  /* next is the flag to indicate whether to sign extend */
+                  UINT16DECODE(p, s_ext);
+                  c_info->nbit.sign_ext = (intn) s_ext;
+                  /* flag to indicate whether to fill with 1's or 0's */
+                  UINT16DECODE(p, f_one);
+                  c_info->nbit.fill_one = (intn) f_one;
+                  /* offset of the bits extracted */
+                  INT32DECODE(p, m_off);
+                  c_info->nbit.start_bit = (intn) m_off;
+                  /* number of bits extracted */
+                  INT32DECODE(p, m_len);
+                  c_info->nbit.bit_len = (intn) m_len;
+              }     /* end case */
+              break;
+
+          case COMP_CODE_SKPHUFF: /* Obtain info for Skipping Huffman coding */
+              {
+                  uint32      skp_size,     /* size of skipping unit */
+                              comp_size;    /* # of bytes to compress */
+
+                  /* specify skipping unit size */
+                  UINT32DECODE(p, skp_size);
+                  /* specify # of bytes of skipping data to compress */
+                  UINT32DECODE(p, comp_size);   /* ignored for now */
+                  c_info->skphuff.skp_size = (intn) skp_size;
+              }     /* end case */
+              break;
+
+          case COMP_CODE_DEFLATE: /* Obtains deflation level for Deflation coding */
+              {
+                  uint16      level;    /* deflation level */
+
+                  /* specify deflation level */
+                  UINT16DECODE(p, level);
+                  c_info->deflate.level = (intn) level;
+              }     /* end case */
+              break;
+
+          case COMP_CODE_SZIP: /* Obtains szip parameters for Szip coding */
+	      {
+                  UINT32DECODE(p, c_info->szip.pixels);
+                  UINT32DECODE(p, c_info->szip.pixels_per_scanline);
+                  UINT32DECODE(p, c_info->szip.options_mask);
+                  c_info->szip.bits_per_pixel = *p++;
+                  c_info->szip.pixels_per_block = *p++;
+	      }
+              break;
+
+          default:      /* no additional information needed */
+                        /* this includes RLE, JPEG, and IMCOMP */
+              break;
+      }     /* end switch */
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+  
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+} /* end HCPdecode_header() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIwrite_header -- Write the compression header info to a file
+ USAGE
+    int32 HCIwrite_header(access_rec,info,special_tag,ref)
+    atom_t file_id;         IN: File ID of the file to write the header to
+    compinfo_t *info;       IN: ptr the compression information
+    uint16 special_tag,ref; IN: the tag/ref of the compressed element
+    coder_info *c_info;     IN: Information needed for the encoding type chosen
+    model_info *m_info;     IN: Information needed for the modeling type chosen
+
+ RETURNS
+    Return SUCCEED or FAIL
+ DESCRIPTION
+    Writes the compression information to a new block in the HDF file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIwrite_header(atom_t file_id, compinfo_t * info, uint16 special_tag, uint16 ref, comp_info *c_info, model_info *m_info)
+{
+    CONSTR(FUNC, "HCIwrite_header");    /* for HERROR */
+    int32       dd_aid;         /* AID for writing the special info */
+    uint8      *p;              /* pointer to the temporary buffer */
+    uint8       local_ptbuf[32];
+    int32       header_len;     /* how many bytes the header is */
+    int32       ret_value=SUCCEED;
+
+    /* write special element info to the file */
+    p = local_ptbuf;
+    INT16ENCODE(p, SPECIAL_COMP);   /* specify special tag type */
+    UINT16ENCODE(p, COMP_HEADER_VERSION);   /* specify header version */
+    INT32ENCODE(p, info->length);   /* write length of un-comp. data */
+    UINT16ENCODE(p, (uint16) info->comp_ref);   /* specify ref # of comp. data */
+#ifdef OLD_WAY
+    UINT16ENCODE(p, (uint16) info->minfo.model_type);   /* specify model type */
+    UINT16ENCODE(p, (uint16) info->cinfo.coder_type);   /* specify coder type */
+
+    /* write any additional information needed for modeling type */
+    switch (info->minfo.model_type)
+      {
+          default:      /* no additional information needed */
+              break;
+      }     /* end switch */
+
+    /* write any additional information needed for coding type */
+    switch (info->cinfo.coder_type)
+      {
+          case COMP_CODE_NBIT:      /* N-bit coding needs info */
+              /* specify number-type of N-bit data */
+              INT32ENCODE(p, info->cinfo.coder_info.nbit_info.nt);
+              /* next is the flag to indicate whether to sign extend */
+              UINT16ENCODE(p, (uint16) info->cinfo.coder_info.nbit_info.sign_ext);
+              /* flag to fill with 1's or 0's */
+              UINT16ENCODE(p, (uint16) info->cinfo.coder_info.nbit_info.fill_one);
+              /* the offset of the bits extracted */
+              INT32ENCODE(p, (int32) info->cinfo.coder_info.nbit_info.mask_off);
+              /* the number of bits extracted */
+              INT32ENCODE(p, (int32) info->cinfo.coder_info.nbit_info.mask_len);
+              break;
+
+          case COMP_CODE_SKPHUFF:   /* Skipping Huffman coding needs info */
+              /* specify skipping unit size */
+              UINT32ENCODE(p, (uint32) info->cinfo.coder_info.skphuff_info.skip_size);
+              /* specify # of bytes compressed (not used currently) */
+              UINT32ENCODE(p, (uint32) info->cinfo.coder_info.skphuff_info.skip_size);
+              break;
+
+          case COMP_CODE_SZIP:
+              INT32ENCODE(p, (int32) c_info->szip.pixels);
+              INT32ENCODE(p, (int32) c_info->szip.pixels_per_scanline);
+              INT32ENCODE(p, (int32) c_info->szip.options_mask);
+              INT32ENCODE(p, (int32) c_info->szip.bits_per_pixel);
+              INT32ENCODE(p, (int32) c_info->szip.pixels_per_block);
+              break;
+
+          case COMP_CODE_IMCOMP: /* IMCOMP is no longer supported, can only be inquired */
+              HRETURN_ERROR(DFE_BADCODER, FAIL);
+              break;
+
+          default:      /* no additional information needed */
+              break;
+      }     /* end switch */
+#else /* OLD_WAY */
+    if((header_len=HCPquery_encode_header(info->minfo.model_type,
+            m_info,info->cinfo.coder_type,c_info))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    if(HCPencode_header(p,info->minfo.model_type,m_info,
+            info->cinfo.coder_type,c_info)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    p+=header_len;
+#endif /* OLD_WAY */
+    
+    /* write the special info structure to fill */
+    if((dd_aid=Hstartaccess(file_id,special_tag,ref,DFACC_ALL))==FAIL)
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+    if (Hwrite(dd_aid, p-local_ptbuf, local_ptbuf) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+    if(Hendaccess(dd_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+  
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCIwrite_header() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIread_header -- Read the compression header info from a file
+ USAGE
+    int32 HCIread_header(file_rec,access_rec,info,comp_info,model_info)
+    accrec_t *access_rec;   IN: ptr to the access element record
+    compinfo_t *info;       IN: ptr the compression information
+    comp_info *comp_info;   IN/OUT: ptr to encoding info
+    model_info *model_info; IN/OUT: ptr to modeling info
+ RETURNS
+    Return SUCCEED or FAIL
+ DESCRIPTION
+    Parses the compression header from a data element in an HDF file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIread_header(accrec_t * access_rec,
+               compinfo_t * info, comp_info * c_info, model_info * m_info)
+{
+    CONSTR(FUNC, "HCIread_header");     /* for HERROR */
+    uint16      header_version; /* version of the compression header */
+    uint8      *p;              /* pointer to the temporary buffer */
+    uint8      *local_ptbuf;
+    int32       ret_value=SUCCEED;
+
+    /* shut compiler up */
+    m_info = m_info;
+
+    /* Get the compression header (description record) */
+    HPread_drec(access_rec->file_id, access_rec->ddid, &local_ptbuf);
+
+    /* Extract info */
+    p = local_ptbuf+2;
+    UINT16DECODE(p, header_version);    /* get compression version */
+    INT32DECODE(p, info->length);   /* get _uncompressed_ data length */
+    UINT16DECODE(p, info->comp_ref);    /* get ref # of comp. data */
+
+    /* Decode the compression header */
+    if(HCPdecode_header(p,&(info->minfo.model_type),m_info,&(info->cinfo.coder_type),c_info)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    HDfree(local_ptbuf);
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+  
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCIread_header() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCcreate -- Create a compressed data element
+ USAGE
+    int32 HCcreate(id,tag,ref,model_type,coder_type)
+    int32 id;                IN: the file id to create the data in
+    uint16 tag,ref;          IN: the tag/ref pair which is to be compressed
+    comp_model_t model_type; IN: the type of modeling to use
+    model_info *m_info;      IN: Information needed for the modeling type chosen
+    comp_coder_t coder_type; IN: the type of encoding to use
+    coder_info *c_info;      IN: Information needed for the encoding type chosen
+ RETURNS
+    Return an AID to the newly created compressed element, FAIL on error.
+ DESCRIPTION
+    Create a compressed data element.  If that data element already
+    exists, we will compress that data element if it is currently un-compresed,
+    or return FAIL if it is already compressed.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCcreate(int32 file_id, uint16 tag, uint16 ref, comp_model_t model_type,
+         model_info * m_info, comp_coder_t coder_type,
+         comp_info * c_info)
+{
+    CONSTR(FUNC, "HCcreate");   /* for HERROR */
+    filerec_t  *file_rec;       /* file record */
+    accrec_t   *access_rec=NULL;/* access element record */
+    compinfo_t *info=NULL;      /* special element information */
+    atom_t      data_id=FAIL;   /* dd ID of existing regular element */
+    int32       data_len;		/* length of the data we are checking */
+    uint16      special_tag;    /* special version of tag */
+    void *       buf = NULL;      /* temporary buffer */
+    int32       ret_value=SUCCEED;
+
+    /* clear error stack and validate args */
+    HEclear();
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec) || SPECIALTAG(tag)
+            || (special_tag = MKSPECIALTAG(tag)) == DFTAG_NULL)
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* chech for access permission */
+    if (!(file_rec->access & DFACC_WRITE))
+        HRETURN_ERROR(DFE_DENIED, FAIL);
+
+    /* get a slot in the access records table */
+    if (NULL == (access_rec = HIget_access_rec()))
+        HRETURN_ERROR(DFE_TOOMANY, FAIL);
+
+    /* search for identical dd */
+    if ((data_id=HTPselect(file_rec,tag,ref))!=FAIL)
+      {
+          /* Check if the element is already special */
+          if (HTPis_special(data_id)==TRUE)
+            {
+                if (HTPendaccess(data_id) == FAIL)
+                    HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+                HGOTO_ERROR(DFE_CANTMOD, FAIL);
+            }   /* end if */
+          
+          /* get the info for the dataset */
+          if(HTPinquire(data_id,NULL,NULL,NULL,&data_len)==FAIL)
+            {
+                if (HTPendaccess(data_id) == FAIL)
+                    HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            } /* end if */
+
+          if ((buf = HDmalloc((uint32) data_len)) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          if (Hgetelement(file_id, tag, ref, buf) == FAIL)
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+          /* Delete the old DD from the file and memory hash table */
+          if (FAIL == HTPdelete(data_id))
+              HGOTO_ERROR(DFE_CANTDELDD, FAIL);
+
+      } /* end if */
+
+    /* set up the special element information and write it to file */
+    info = (compinfo_t *) HDmalloc(sizeof(compinfo_t));
+    access_rec->special_info = info;
+    if (info == NULL)
+          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    info->length = (data_id!=FAIL) ? data_len : COMP_START_BLOCK;
+
+    /* set up compressed special info structure */
+    info->attached = 1;
+    info->comp_ref = Htagnewref(file_id,DFTAG_COMPRESSED);  /* get the new reference # */
+    if(HCIinit_model(DFACC_RDWR, &(info->minfo), model_type, m_info)==FAIL)
+        HGOTO_ERROR(DFE_MINIT,FAIL);
+    if(HCIinit_coder(DFACC_RDWR, &(info->cinfo), coder_type, c_info)==FAIL)
+        HGOTO_ERROR(DFE_CINIT,FAIL);
+
+    if (HCIwrite_header(file_id, info, special_tag, ref, c_info, m_info) == FAIL)
+          HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+    /* update access record and file record */
+    if((access_rec->ddid=HTPselect(file_rec,tag,ref))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    access_rec->special_func = &comp_funcs;
+    access_rec->special = SPECIAL_COMP;
+    access_rec->posn = 0;
+    access_rec->access = DFACC_RDWR;
+    access_rec->file_id = file_id;
+    access_rec->appendable = FALSE;     /* start data as non-appendable */
+    file_rec->attach++;
+
+    /* propagate the initialization down to the modeling layer */
+    if ((*(info->minfo.model_funcs.stwrite))(access_rec) == FAIL)
+          HGOTO_ERROR(DFE_MODEL, FAIL);
+
+    /* compress the old DD and get rid of it, if there was one */
+    if (data_id != FAIL)
+      {
+          /* write the data through to the compression layer */
+          if (HCPwrite(access_rec, data_len, buf) == FAIL)
+              HGOTO_ERROR(DFE_MODEL, FAIL);
+
+          /* seek back to the beginning of the data through to the compression layer */
+          if (HCPseek(access_rec, 0, DF_START) == FAIL)
+              HGOTO_ERROR(DFE_MODEL, FAIL);
+      }     /* end if */
+
+    ret_value=HAregister_atom(AIDGROUP,access_rec);
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+        if(access_rec!=NULL)
+            HIrelease_accrec_node(access_rec);
+        if(info!=NULL)
+            HDfree(info);
+      } /* end if */
+
+    /* Normal function cleanup */
+    if (buf != NULL)
+        HDfree(buf);
+
+    return ret_value; 
+}   /* end HCcreate() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPgetcompress -- Retrieves compression information of an element
+ USAGE
+    intn HCPgetcompress(aid, coder_type, c_info)
+    int32 aid;                  IN: access record ID
+    comp_coder_t* coder_type;   OUT: the type of compression
+    comp_info* c_info;          OUT: ptr to compression information
+                                structure for storing the retrieved info
+ RETURNS
+    SUCCEED/FAIL
+ DESCRIPTION
+    This routine retrieves the compression type and the compression
+    information of the element, identified by 'aid'.  The routine is 
+    used by GRgetcompinfo and SDgetcompinfo at this time.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+    July 2001: Added to fix bug #307 - BMR
+    Dec. 2004: Changed name to HCPgetcompress, to be consistent with other
+               practice.  REM
+--------------------------------------------------------------------------*/
+intn
+HCPgetcompress(int32 file_id,
+              uint16 data_tag, uint16 data_ref,
+              comp_coder_t* comp_type,  /* OUT: compression type */
+              comp_info* c_info)        /* OUT: retrieved compression info */
+{
+    CONSTR(FUNC, "HCPgetcompress");   /* for HGOTO_ERROR */
+    int32   aid=0, status;
+    accrec_t*    access_rec=NULL;/* access element record */
+    compinfo_t*  info=NULL;  /* compressed element information */
+    model_info  m_info;         /* modeling information - dummy */
+    int32       ret_value=SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* start read access on the access record of the data element, which
+       is being inquired for its compression information */
+    aid = Hstartread(file_id, data_tag, data_ref);
+
+    /* get the access_rec pointer */
+    access_rec = HAatom_object(aid);
+    if (access_rec == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* if the element is compressed, get the compression info as requested*/
+    if (access_rec->special == SPECIAL_COMP)
+    {
+        info = (compinfo_t *) access_rec->special_info;
+        if (info == NULL) HGOTO_ERROR(DFE_COMPINFO, FAIL);
+
+        status = HCIread_header(access_rec, info, c_info, &m_info);
+        if (status == FAIL) HGOTO_ERROR(DFE_COMPINFO, FAIL);
+
+        /* get the compression type */
+        *comp_type = info->cinfo.coder_type;
+
+    }  /* end if element is compressed */
+
+    /* if the element is chunked, call HMCgetcompress to get the 
+	compression info as appropriate */
+    else if (access_rec->special == SPECIAL_CHUNKED)
+    {
+	status = HMCgetcompress(access_rec, comp_type, c_info);
+        if (status == FAIL) HGOTO_ERROR(DFE_COMPINFO, FAIL);
+    }
+
+    /* flag the error when attempting to get compression info on a
+       non-compressed element */
+    else 
+    /* EIP 9/16/03  Fail but return compression type COMP_CODE_NONE
+       instead of junk in this case.
+    */
+     {
+        /*Mac OSX screams here (comp_coder_t)*comp_type = COMP_CODE_NONE; */
+        *comp_type = COMP_CODE_NONE; 
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+     }
+    /* end access to the aid appropriately */
+    if (Hendaccess(aid)== FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+       /* end access to the aid if it's been accessed */
+        if (aid != 0)
+            if (Hendaccess(aid)== FAIL)
+                HERROR(DFE_CANTENDACCESS);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* HCPgetcompress */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPgetcompinfo -- Retrieves compression information of an element
+ USAGE
+    intn HCPgetcompinfo(aid, coder_type, c_info)
+    int32 aid;                  IN: access record ID
+    comp_coder_t* coder_type;   OUT: the type of compression
+    comp_info* c_info;          OUT: ptr to compression information
+                                structure for storing the retrieved info
+ RETURNS
+    SUCCEED/FAIL
+ DESCRIPTION
+    This routine retrieves the compression type and the compression
+    information of the element, identified by 'aid'.  The routine is 
+    used by GRgetcompinfo and SDgetcompinfo at this time.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+    July 2001: Added to fix bug #307 - BMR
+    Dec. 2004: Changed name to HCPgetcompress, to be consistent with other
+               practice.  REM
+    Apr. 2005:	HCPgetcompinfo was added to fix bugzilla #130 and may replace 
+		HCPgetcompress in the future because HCPgetcompress did not 
+		behave correctly.  The revision logs above are carried over 
+		from HCPgetcompress for the records.
+--------------------------------------------------------------------------*/
+intn
+HCPgetcompinfo(int32 file_id,
+              uint16 data_tag, uint16 data_ref,
+              comp_coder_t* comp_type,  /* OUT: compression type */
+              comp_info* c_info)        /* OUT: retrieved compression info */
+{
+    CONSTR(FUNC, "HCPgetcompinfo");	/* for HGOTO_ERROR */
+    int32   aid=0, status;
+    accrec_t*    access_rec=NULL;	/* access element record */
+    compinfo_t*  info=NULL;		/* compressed element information */
+    comp_coder_t temp_coder=COMP_CODE_NONE;
+    model_info  m_info;			/* modeling information - dummy */
+    intn       ret_value=SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* check the output arguments */
+    if (comp_type == NULL || c_info == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* start read access on the access record of the data element, which
+       is being inquired for its compression information */
+    aid = Hstartread(file_id, data_tag, data_ref);
+
+    /* get the access_rec pointer */
+    access_rec = HAatom_object(aid);
+    if (access_rec == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* if the element is compressed, get the compression info as requested */
+    if (access_rec->special == SPECIAL_COMP)
+    {
+        info = (compinfo_t *) access_rec->special_info;
+        if (info == NULL) HGOTO_ERROR(DFE_COMPINFO, FAIL);
+
+        status = HCIread_header(access_rec, info, c_info, &m_info);
+        if (status == FAIL) HGOTO_ERROR(DFE_COMPINFO, FAIL);
+
+        /* get the compression type */
+        temp_coder = info->cinfo.coder_type;
+
+    }  /* end if element is compressed */
+
+    /* if the element is chunked, call HMCgetcompress to get the 
+	compression info as appropriate */
+    else if (access_rec->special == SPECIAL_CHUNKED)
+    {
+	status = HMCgetcompress(access_rec, &temp_coder, c_info);
+        if (status == FAIL) HGOTO_ERROR(DFE_COMPINFO, FAIL);
+    }
+
+    /* return COMP_CODE_NONE for a non-compressed element */
+    /* Note: SPECIAL_COMPRAS may need special handling */
+    else if (access_rec->special == SPECIAL_LINKED ||
+             access_rec->special == SPECIAL_EXT ||
+             access_rec->special == SPECIAL_VLINKED ||
+             access_rec->special == SPECIAL_BUFFERED ||
+             access_rec->special == SPECIAL_COMPRAS ||
+             access_rec->special == 0)
+    {
+        temp_coder = COMP_CODE_NONE;
+    }
+
+    /* flag the error when access_rec->special is not something valid */
+    else 
+    {
+	temp_coder = COMP_CODE_INVALID; 
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    }
+    /* end access to the aid appropriately */
+    if (Hendaccess(aid)== FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    if (comp_type != NULL) *comp_type = temp_coder;
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+       /* end access to the aid if it's been accessed */
+        if (aid != 0)
+            if (Hendaccess(aid)== FAIL)
+                HERROR(DFE_CANTENDACCESS);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* HCPgetcompinfo */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCIstaccess -- Start accessing a compressed data element.
+ USAGE
+    int32 HCIstaccess(access_rec, access)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int16 access;           IN: the type of access wanted
+ RETURNS
+    Returns an AID or FAIL
+ DESCRIPTION
+    Common code called by HCIstread and HCIstwrite
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE int32
+HCIstaccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HCIstaccess");    /* for HERROR */
+    compinfo_t *info=NULL;      /* special element information */
+    filerec_t  *file_rec;       /* file record */
+    comp_info   c_info;         /* encoding information from the header */
+    model_info  m_info;         /* modeling information from the header */
+    int32       ret_value=SUCCEED;
+
+    /* get file record and validate */
+    file_rec = HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec) || !(file_rec->access & acc_mode))
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    /* intialize the access record */
+    access_rec->special = SPECIAL_COMP;
+    access_rec->posn = 0;
+    access_rec->access = (uint32)(acc_mode|DFACC_READ);
+
+    /* get the special info record */
+    access_rec->special_info = HDmalloc(sizeof(compinfo_t));
+    info = (compinfo_t *) access_rec->special_info;
+    if (info == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    if (HCIread_header(access_rec, info, &c_info, &m_info) == FAIL)
+          HGOTO_ERROR(DFE_COMPINFO, FAIL);
+    info->attached = 1;
+    if (HCIinit_model(acc_mode,&(info->minfo), info->minfo.model_type, &m_info) == FAIL)
+          HRETURN_ERROR(DFE_MINIT, FAIL);
+    if (HCIinit_coder(acc_mode,&(info->cinfo), info->cinfo.coder_type, &c_info) == FAIL)
+          HRETURN_ERROR(DFE_CINIT, FAIL);
+
+    file_rec->attach++;
+
+    ret_value=HAregister_atom(AIDGROUP,access_rec);
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+        if(info!=NULL)
+            HDfree(info);
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCIstaccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPstread -- Start read access on a compressed data element.
+ USAGE
+    int32 HCPstread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+ RETURNS
+    Returns an AID or FAIL
+ DESCRIPTION
+    Start read access on a compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPstread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPstread");  /* for HERROR */
+    compinfo_t *info;           /* information on the special element */
+    int32       ret_value;      /* AID to return */
+
+    if ((ret_value = HCIstaccess(access_rec, DFACC_READ)) == FAIL)
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+    info = (compinfo_t *) access_rec->special_info;
+    if ((*(info->minfo.model_funcs.stread)) (access_rec) == FAIL)
+        HGOTO_ERROR(DFE_MODEL, FAIL);
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCPstread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPstwrite -- Start write access on a compressed data element.
+ USAGE
+    int32 HCPstwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+ RETURNS
+    Returns an AID or FAIL
+ DESCRIPTION
+    Start write access on a compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPstwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPstwrite");     /* for HERROR */
+    compinfo_t *info;               /* information on the special element */
+    int32       ret_value;          /* AID to return */
+
+    if ((ret_value = HCIstaccess(access_rec, DFACC_WRITE)) == FAIL)
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+    info = (compinfo_t *) access_rec->special_info;
+    if ((*(info->minfo.model_funcs.stwrite)) (access_rec) == FAIL)
+        HGOTO_ERROR(DFE_MODEL, FAIL);
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCPstwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPseek -- Seek to offset within the data element
+ USAGE
+    int32 HCPseek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from
+ RETURNS
+    Returns SUCCEED or FAIL
+ DESCRIPTION
+    Seek to a position with a compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPseek(accrec_t * access_rec, int32 offset, intn origin)
+{
+    CONSTR(FUNC, "HCPseek");    /* for HERROR */
+    compinfo_t *info;           /* information on the special element */
+    int32       ret_value;
+
+    /* Adjust offset according to origin.  There is no upper bound to posn */
+    if (origin == DF_CURRENT)
+        offset += access_rec->posn;
+    if (origin == DF_END)
+        offset += ((compinfo_t *) (access_rec->special_info))->length;
+    if (offset < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    info = (compinfo_t *) access_rec->special_info;
+    if ((ret_value = (*(info->minfo.model_funcs.seek)) (access_rec, offset, origin)) == FAIL)
+        HGOTO_ERROR(DFE_MODEL, FAIL);
+
+    /* set the offset */
+    access_rec->posn = offset;
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCPseek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPread -- Read in a portion of data from a compressed data element.
+ USAGE
+    int32 HCPread(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+ RETURNS
+    Returns the number of bytes read or FAIL
+ DESCRIPTION
+    Read in a number of bytes from a compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPread(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPread");    /* for HERROR */
+    compinfo_t *info;           /* information on the special element */
+    int32       ret_value;
+
+    /* validate length */
+    if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* adjust length if it falls off the end of the element */
+    if (length == 0)
+        length = info->length - access_rec->posn;
+    else if (length < 0 || access_rec->posn + length > info->length)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    if ((*(info->minfo.model_funcs.read))(access_rec, length, data) == FAIL)
+        HGOTO_ERROR(DFE_MODEL, FAIL);
+
+    /* adjust access position */
+    access_rec->posn += length;
+
+    ret_value=length;
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCPread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPwrite -- Write out a portion of data from a compressed data element.
+ USAGE
+    int32 HCPwrite(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+ RETURNS
+    Returns the number of bytes written or FAIL
+ DESCRIPTION
+    Write out a number of bytes to a compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPwrite(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPwrite");   /* for HERROR */
+    compinfo_t *info;           /* information on the special element */
+    uint8       local_ptbuf[4];
+    uint8       *p = local_ptbuf;  /* temp buffer ptr */
+    filerec_t  *file_rec;           /* file record */
+    int32       ret_value;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* validate length */
+    if (length < 0)
+        HRETURN_ERROR(DFE_RANGE, FAIL);
+
+    info = (compinfo_t *) access_rec->special_info;
+    if ((*(info->minfo.model_funcs.write)) (access_rec, length, data) == FAIL)
+        HGOTO_ERROR(DFE_MODEL, FAIL);
+
+    /* update access record, and information about special element */
+    access_rec->posn += length;
+    if (access_rec->posn > info->length)
+      {
+          int32       data_off;		/* offset of the data we are checking */
+
+          /* get the info for the dataset */
+          if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,NULL)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          info->length = access_rec->posn;
+
+          INT32ENCODE(p, info->length);
+          if (HPseek(file_rec, data_off + 4) == FAIL)
+              HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          /* re-write un-comp. len */
+          if (HP_write(file_rec, local_ptbuf, 4) == FAIL)     
+              HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+      }     /* end if */
+
+    ret_value=length;  /* return length of bytes written */
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value; 
+}   /* end HCPwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPinquire -- Inquire information about the access record and data element.
+ USAGE
+    int32 HCPinquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+                     paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+ RETURNS
+    Returns SUCCEED or FAIL
+ DESCRIPTION
+    Inquire information about the access record and data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPinquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+ uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+           int16 *pspecial)
+{
+    CONSTR(FUNC, "HCPinquire");   /* for HERROR */
+    compinfo_t *info =          /* special information record */
+        (compinfo_t *) access_rec->special_info;
+    uint16 data_tag,data_ref;   /* tag/ref of the data we are checking */
+    int32       data_off;		/* offset of the data we are checking */
+
+    /* get the info for the dataset */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,&data_off,NULL)==FAIL)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the variables if they are present */
+    if (pfile_id != NULL)
+        *pfile_id = access_rec->file_id;
+    if (ptag != NULL)
+        *ptag = data_tag;
+    if (pref != NULL)
+        *pref = data_ref;
+    if (plength != NULL)
+        *plength = info->length;
+    if (poffset != NULL)
+        *poffset = data_off;
+    if (pposn != NULL)
+        *pposn = access_rec->posn;
+    if (paccess != NULL)
+        *paccess = (int16)access_rec->access;
+    if (pspecial != NULL)
+        *pspecial = (int16)access_rec->special;
+
+    return (SUCCEED);
+}   /* end HCPinquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPendaccess -- Close the compressed data element and free the AID
+ USAGE
+    intn HCPendaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+ RETURNS
+    Returns SUCCEED or FAIL
+ DESCRIPTION
+    Close the compressed data element and free the AID.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPendaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPendaccess");   /* for HERROR */
+    filerec_t  *file_rec;           /* file record */
+    intn      ret_value = SUCCEED;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* validate file record */
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* close the file pointed to by this access rec */
+    HCPcloseAID(access_rec);
+
+    /* update file and access records */
+    if (HTPendaccess(access_rec->ddid) == FAIL)
+      HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+
+    /* detach from the file */
+    file_rec->attach--;
+
+    /* free the access record */
+    HIrelease_accrec_node(access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HCPendaccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPcloseAID -- Get rid of the compressed data element data structures
+ USAGE
+    int32 HCPcloseAID(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+ RETURNS
+    Returns SUCCEED or FAIL
+ DESCRIPTION
+    Get rid of the compressed data element internal data structures
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPcloseAID(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPcloseAID");    /* for HERROR */
+    compinfo_t *info;           /* special information record */
+    int32       ret=SUCCEED;
+
+    info = (compinfo_t *) access_rec->special_info;
+    if ((ret = (*(info->minfo.model_funcs.endaccess)) (access_rec)) == FAIL)
+        HRETURN_ERROR(DFE_MODEL, FAIL);
+
+    /* Free the compression information */
+    /* BMR - reset special_info to NULL after memory is freed; problem shown
+       by the failure when running hdp list with a large file on PC - 12/6/98 */
+    if (--(info->attached) == 0)
+    {
+       HDfree(info);
+       access_rec->special_info = NULL;
+    }
+    return (ret);
+}   /* end HCPcloseAID() */
+
+/* ------------------------------- HCPinfo -------------------------------- */
+/*
+NAME
+   HCPinfo -- return info about a compressed element
+USAGE
+   int32 HCPinfo(access_rec, info_block)
+   accrec_t        *  access_rec;   IN: access record of access element
+   sp_info_block_t * info_block;   OUT: information about the special element
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Return information about the given compressed element.  Info_block is
+   assumed to be non-NULL.
+
+---------------------------------------------------------------------------*/
+int32
+HCPinfo(accrec_t * access_rec, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HCPinfo");
+    compinfo_t *info =          /* special information record */
+    (compinfo_t *) access_rec->special_info;
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_COMP)
+        HRETURN_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the info_block */
+    info_block->key = SPECIAL_COMP;
+
+    info_block->comp_type = (int32)info->cinfo.coder_type;
+    info_block->model_type = (int32)info->minfo.model_type;
+    info_block->comp_size = Hlength(access_rec->file_id, DFTAG_COMPRESSED, info->comp_ref);
+
+    return SUCCEED;
+}   /* HCPinfo */
+
+/* ------------------------------- HCPgetinfo ----------------------------- */
+/*
+NAME
+   HCget_config_info -- return info about configuration of a compression method
+
+USAGE
+     intn HCget_config_info( comp_coder_t coder_type,  
+	uint32* compression_config_info)
+        comp_coder_t coder_type;  IN: the compression type queried  
+	compression_config_info;  OUT: flags to indiat compression status
+               
+                0 -- not enabled
+		COMP_DECODER_ENABLED - decoding enabled
+                COMP_ENCODER_ENABLED - encoding enabled
+
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Return information about the given compresion method. 
+
+   Currently, reports if encoding and/or decoding are available. SZIP
+   is the only method that varies in the current versions.
+
+
+---------------------------------------------------------------------------*/
+intn
+HCget_config_info( comp_coder_t coder_type,  /* IN: compression type */
+		uint32* compression_config_info)
+{
+    CONSTR(FUNC, "HCget_config_info");
+
+    *compression_config_info = 0;
+    switch (coder_type)
+      {     
+          case COMP_CODE_IMCOMP:    /* IMCOMP no longer supported */
+                *compression_config_info = 0;
+              break;
+          /* This block doesn't look intentional, for there is no "break;"
+             before case COMP_CODE_RLE:, which means *compression_config_info
+             was reassigned to something else even though it is "case
+             COMP_CODE_NONE:"  When I added "break;" for "case COMP_CODE_NONE:",             some tests failed.  It needs to be checked out.-BMR, Jul 16, 2012*/
+          case COMP_CODE_NONE:      /* "none" (i.e. no) encoding */
+		*compression_config_info = 0;
+          case COMP_CODE_RLE:   /* Run-length encoding */
+          case COMP_CODE_NBIT:      /* N-bit encoding */
+          case COMP_CODE_SKPHUFF:   /* Skipping Huffman encoding */
+		*compression_config_info = COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED;
+              break;
+
+          case COMP_CODE_JPEG:  /* jpeg may be optional */
+		*compression_config_info = COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED;
+              break;
+          case COMP_CODE_DEFLATE:   /* gzip 'deflate' encoding, maybe optional */
+		*compression_config_info = COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED;
+              break;
+
+           case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+	      if (SZ_encoder_enabled()) {
+		*compression_config_info = COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED;
+		} else {
+		*compression_config_info = COMP_DECODER_ENABLED;
+		}
+#else
+		*compression_config_info = 0;
+#endif /* H4_HAVE_LIBSZ */
+              break;
+          default:
+		*compression_config_info = 0;
+              HRETURN_ERROR(DFE_BADCODER, FAIL)
+	}
+    return SUCCEED;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPgetcomptype -- Retrieves compression type of an element
+ USAGE
+    intn HCPgetcomptype(aid, coder_type)
+    int32 aid;                  IN: access record ID
+    comp_coder_t* coder_type;   OUT: the type of compression
+ RETURNS
+    SUCCEED/FAIL
+ DESCRIPTION
+    This routine retrieves the compression type of the element, identified 
+    by 'aid'.  It is very similar to HCPgetcompinfo except that it only
+    retrieves the compression type and not the compression information.  The 
+    routine is used by GRgetcomptype and SDgetcomptype.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+    Dec. 2007: Added so that applications can get the compression method only.
+		The immediate intention is to avoid the need for external 
+		libraries to be present when only compression type is desired
+		and not compression information. -BMR
+--------------------------------------------------------------------------*/
+intn
+HCPgetcomptype(int32 file_id,
+              uint16 data_tag, uint16 data_ref, /* IN: tag/ref of element */
+              comp_coder_t* comp_type)  /* OUT: compression type */
+{
+    CONSTR(FUNC, "HCPgetcomptype");	/* for HGOTO_ERROR */
+    uint16      ctag, cref;	/* tag/ref for the special info header object */
+    int32       data_id=FAIL;	/* temporary AID for header info */
+    int32	temp_aid=FAIL;	/* temporary AID for header info */
+    int32	data_len;	/* offset of the data we are checking */
+    uint8      *p;		/* pointers to the temporary buffer */
+    uint8      *local_ptbuf=NULL;	/* temporary buffer */
+    uint16	sp_tag;		/* special tag */
+    uint16	c_type;		/* compression type */
+    filerec_t  *file_rec;	/* file record */
+    intn        ret_value=SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* convert file id to file rec and check for validity */
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get access element from dataset's tag/ref */
+    if ((data_id=HTPselect(file_rec, data_tag, data_ref))!=FAIL)
+    {
+	/* get the info for the dataset */
+	if(HTPinquire(data_id,&ctag,&cref,NULL,&data_len)==FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	/* if element is not special, return COMP_CODE_NONE */
+	if (!SPECIALTAG(ctag))	
+	{
+	    *comp_type = COMP_CODE_NONE;
+	    HGOTO_DONE(SUCCEED);
+	}
+
+	/* element is special, proceed with reading special info header */
+	if((local_ptbuf=(uint8 *)HDmalloc(data_len))==NULL)
+	    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+	/* Get the special info header */
+	if ((temp_aid=Hstartaccess(file_id,MKSPECIALTAG(ctag),cref,DFACC_READ)) == FAIL)
+	    HGOTO_ERROR(DFE_BADAID, FAIL);
+	if (Hread(temp_aid,2,local_ptbuf) == FAIL)
+	    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+	/* Get special tag */
+	p = local_ptbuf;
+	UINT16DECODE(p, sp_tag);
+
+	/* If it is a compressed element, move forward until compression
+	   coder and get it */
+	switch (sp_tag)
+	{
+	  case SPECIAL_COMP:
+	      if (Hread(temp_aid,12,local_ptbuf) == FAIL)
+		  HGOTO_ERROR(DFE_READERROR, FAIL);
+
+	      /* Skip comp version, length, ref#, and model type */
+	      p = local_ptbuf + 2 + 4 + 2 + 2;
+	      UINT16DECODE(p, c_type);     /* get encoding type */
+	      *comp_type=(comp_coder_t)c_type;
+	      break;
+
+	  /* If element is chunked, hand over to the chunk interface to check 
+	     if it is compressed and get the type */
+	  case SPECIAL_CHUNKED:
+	      if (HMCgetcomptype(temp_aid, comp_type)==FAIL)
+		  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	      break;
+
+	  /* return COMP_CODE_NONE for a non-compressed element */
+	  /* Developer's Note: SPECIAL_COMPRAS may need special handling */
+	  case SPECIAL_LINKED:
+	  case SPECIAL_EXT:
+	  case SPECIAL_VLINKED:
+	  case SPECIAL_BUFFERED:
+	  case SPECIAL_COMPRAS:
+	  case 0:
+	      *comp_type = COMP_CODE_NONE;
+	      break;
+
+	  /* flag the error when special tag is not something valid */
+	  default:
+	      *comp_type = COMP_CODE_INVALID;
+	      HGOTO_ERROR(DFE_ARGS, FAIL);
+	}
+    }
+    else /* no special element */
+    {
+        *comp_type = COMP_CODE_NONE;
+    }
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+    } /* end if */
+
+    /* end access to the aid's if they've been accessed */
+    if (temp_aid != FAIL)
+        if (Hendaccess(temp_aid)== FAIL)
+            HERROR(DFE_CANTENDACCESS);
+    if (data_id != FAIL)
+        if (HTPendaccess(data_id)== FAIL)
+            HERROR(DFE_CANTENDACCESS);
+
+    /* release allocated memory */
+    if (local_ptbuf != NULL)
+        HDfree(local_ptbuf);
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* HCPgetcomptype */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPgetdatasize -- Retrieves the sizes of original and compressed data.
+ USAGE
+    int32 HCPgetdatasize(file_id, data_tag, data_ref, comp_size, orig_size)	
+		int32 file_id;		IN: file id
+		uint16 data_tag;	IN: tag of the element
+		uint16 data_ref;	IN: ref of element
+		int32* comp_size;	OUT: size of compressed data
+		int32* orig_size;	OUT: size of non-compressed data
+ RETURNS
+    SUCCEED/FAIL
+ DESCRIPTION
+    This routine gets access to the element pointed to by the dataset's 
+    tag/ref pair, then proceeds as followed:
+    - If the element is not special, HCPgetdatasize will use Hlength to get 
+      the length of the data then return.
+    - If the element is compressed, HCPgetdatasize will read the element's
+      special header and decode it for the uncompressed data length and the 
+      compressed data ref#, then use Hlength to get the length of the 
+      compressed data.
+    - If the element is chunked, HCPgetdatasize will let the chunking layer
+      retrieve the sizes (HMCgetdatasize.)
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPgetdatasize(int32 file_id,
+              uint16 data_tag, uint16 data_ref, /* IN: tag/ref of element */
+              int32* comp_size,	/* OUT  - size of compressed data */
+              int32* orig_size)	/* OUT  - size of non-compressed data */
+{
+    CONSTR(FUNC, "HCPgetdatasize");	/* for HGOTO_ERROR */
+    uint8      *local_ptbuf=NULL, *p;
+    uint16	sp_tag;		/* special tag */
+    uint16 comp_ref = 0;
+    atom_t      data_id = FAIL;	/* dd ID of existing regular element */
+    int32 len = 0;
+    filerec_t  *file_rec;	/* file record */
+    intn        ret_value=SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* convert file id to file rec and check for validity */
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get access element from dataset's tag/ref */
+    if ((data_id=HTPselect(file_rec, data_tag, data_ref))!=FAIL)
+    {
+	/* if the element is not special, that means dataset's tag/ref 
+	   specifies the actual data that was written to the dataset, so
+	   we don't need to check further */
+	if (HTPis_special(data_id)==FALSE)
+        {
+	    if ((len = Hlength(file_id, data_tag, data_ref)) == FAIL)
+		HGOTO_ERROR(DFE_BADLEN, FAIL);
+	    *orig_size = *comp_size = len;
+        }
+
+	/* if the element is special, get the special info header and decode
+	   for the uncompressed data length and the compressed data ref#, which
+	   will be used with DFTAG_COMPRESSED to get the compressed data len */
+	else
+	{
+	    int32 rec_len=0;
+
+	    /* Get the compression header (description record) */
+	    rec_len = HPread_drec(file_id, data_id, &local_ptbuf);
+	    if (rec_len <= 0)
+		HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	    /* get special tag */
+	    p = local_ptbuf;
+	    INT16DECODE(p, sp_tag);
+
+	    /* verify that it is a compressed element, then get the data len */
+	    if (sp_tag == SPECIAL_COMP)
+	    {
+		/* skip 2byte header_version */
+		p = p + 2;
+		INT32DECODE(p, len);	/* get _uncompressed_ data length */
+		*orig_size = len;	/* set original data size */
+
+		/* if no data written, set compressed data size too */
+		if (len == 0)
+		{
+		    *comp_size = len;
+		}
+		/* Data has been written, get compressed data size */
+		else
+		{
+		    /* get ref# of compressed data */
+		    UINT16DECODE(p, comp_ref);
+		    if ((len = Hlength(file_id, DFTAG_COMPRESSED, comp_ref)) == FAIL)
+			HGOTO_ERROR(DFE_BADLEN, FAIL);
+		    *comp_size = len;	/* set compressed data size */
+		} /* data written */
+	    } /* element is compressed */
+
+	    /* if it is a chunked element, hand the task over to the chunking
+		layer. */
+	    else if (sp_tag == SPECIAL_CHUNKED)
+	    {
+	     if (HMCgetdatasize(file_id, p, comp_size, orig_size)==FAIL)
+		  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	    }
+
+	    /* unlimited dimension falls in here */
+	    else if (sp_tag == SPECIAL_LINKED)
+	    {
+		INT32DECODE(p, len);	/* get total data length */
+		*orig_size = *comp_size = len;	/* set data sizes */
+	    }
+	} /* else, data_id is special */
+
+	/* end access to the aid */
+	if (HTPendaccess(data_id) == FAIL)
+	    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    }  /* end if data_id != FAIL */
+
+    else /* HTPselect failed */
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+ 
+done:
+    if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+    } /* end if */
+
+    /* Normal function cleanup */
+    if (local_ptbuf != NULL) 
+	HDfree(local_ptbuf);
+
+    return ret_value;
+} /* HCPgetdatasize */
diff --git a/hdf/src/hcomp.h b/hdf/src/hcomp.h
new file mode 100644
index 0000000..d8ebd5f
--- /dev/null
+++ b/hdf/src/hcomp.h
@@ -0,0 +1,147 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hcomp.h 5830 2012-07-19 09:08:48Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    hcomp.h
+ * Purpose: header file for compression information & structures
+ * Dependencies: should be included after hdf.h
+ * Invokes:
+ * Contents:
+ * Structure definitions: comp_info
+ * Constant definitions: lots...
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __HCOMP_H
+#define __HCOMP_H
+
+/* For determining which type of modeling is being done */
+typedef enum
+  {
+      COMP_MODEL_STDIO = 0      /* for Standard C I/O model */
+  }
+comp_model_t;
+
+/* For determining which type of encoding is being done */
+typedef enum
+  {
+      COMP_CODE_NONE = 0,       /* don't encode at all, just store */
+      COMP_CODE_RLE,            /* for simple RLE encoding */
+      COMP_CODE_NBIT,           /* for N-bit encoding */
+      COMP_CODE_SKPHUFF,        /* for Skipping huffman encoding */
+      COMP_CODE_DEFLATE,        /* for gzip 'deflate' encoding */
+      COMP_CODE_SZIP,		/* for szip encoding */
+      COMP_CODE_INVALID,        /* invalid last code, for range checking */
+      COMP_CODE_JPEG,           /* _Ugly_ hack to allow JPEG images to be created with GRsetcompress */
+      COMP_CODE_IMCOMP = 12     /* another _Ugly_ hack to allow IMCOMP images to
+                         be inquired, 12 to be the same as COMP_IMCOMP writing
+                         will not be allowed, however.  -BMR, Jul 2012 */
+  }
+comp_coder_t;
+
+/* Compression types available */
+#define COMP_NONE       0
+#define COMP_JPEG       2
+#define COMP_RLE        11
+#define COMP_IMCOMP     12
+
+/* Compression encoder/decoder configuration */
+#define COMP_DECODER_ENABLED     1
+#define COMP_ENCODER_ENABLED     2
+
+#ifndef COMPRESS_MASTER
+extern uint16 compress_map[];
+#else
+uint16      compress_map[COMP_MAX_COMP + 1] =
+{                               /* Mapping from compression types to tags */
+    0,                          /* No corresponding tag for un-compressed data */
+    0,                          /* (1) */
+    DFTAG_JPEG5,                /* COMP_JPEG -> DFTAG_JPEG5 (for JPEG compression) */
+    0,                          /* (3) */
+    0,                          /* (4) */
+    0,                          /* (5) */
+    0,                          /* (6) */
+    0,                          /* (7) */
+    0,                          /* (8) */
+    0,                          /* (9) */
+    0,                          /* (10) */
+    DFTAG_RLE,                  /* COMP_RLE -> DFTAG_RLE (for Run-length compression) */
+    DFTAG_IMC                   /* COMP_IMCOMP -> DFTAG_IMC (for IMCOMP compression) */
+};
+#endif
+
+typedef union tag_model_info
+  {                             /* Union to contain modeling information */
+      struct
+        {
+            int32       nt;     /* number type */
+            intn        ndim;   /* number of dimensions */
+            int32      *dims;   /* array of dimensions */
+        }
+      dim;
+  }
+model_info;
+
+typedef union tag_comp_info
+  {                             /* Union to contain compression information */
+      struct
+        {   /* Struct to contain information about how to compress */
+            /* or decompress a JPEG encoded 24-bit image */
+            intn    quality;    /* Quality factor for JPEG compression, should be from */
+            /* 0 (terrible) to 100 (very good) */
+            intn    force_baseline;     /* If force_baseline is set to TRUE then */
+            /* quantization tables are limited to */
+            /* 0..255 for JPEG baseline compability */
+            /* This is only an issue for quality */
+            /* settings below 24 */
+        }
+      jpeg;
+      struct
+        {   /* struct to contain information about how to compress */
+            /* or decompress a N-bit encoded dataset */
+            int32   nt;     /* number type of the data to encode */
+            intn    sign_ext;   /* whether to sign extend or not */
+            intn    fill_one;   /* whether to fill with 1's or 0's */
+            intn    start_bit;  /* offset of the start bit in the data */
+            intn    bit_len;    /* number of bits to store */
+        }
+      nbit;
+      struct
+        {   /* struct to contain info about how to compress */
+            /* or decompress a "skipping" huffman encoded dataset */
+            intn    skp_size;   /* size of the individual elements when skipping */
+        }
+      skphuff;
+      struct
+        {   /* struct to contain info about how to compress */
+            /* or decompress a gzip encoded dataset */
+            intn    level;   /* how hard to work when compressing the data */
+        }
+      deflate;
+      struct
+        {
+            int32 options_mask;   /* IN */
+            int32 pixels_per_block;   /* IN */
+            int32 pixels_per_scanline; /* OUT: computed */
+	    int32 bits_per_pixel; /* OUT: size of NT */
+            int32 pixels; /* OUT: size of dataset or chunk */
+         }
+       szip;  /* for szip encoding */
+
+  }
+comp_info;
+
+#endif /* __HCOMP_H */
+
diff --git a/hdf/src/hcompi.h b/hdf/src/hcompi.h
new file mode 100644
index 0000000..fe1f75f
--- /dev/null
+++ b/hdf/src/hcompi.h
@@ -0,0 +1,115 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hcompi.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    hcompi.h
+ * Purpose: Internal library header file for compression information
+ * Dependencies: should be included after hdf.h
+ * Invokes:
+ * Contents:
+ * Structure definitions:
+ * Constant definitions:
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __HCOMPI_H
+#define __HCOMPI_H
+
+#include "hfile.h"
+
+/* Modeling information */
+
+/* structure for storing modeling information */
+/* only allow modeling and master compression routines access */
+
+#include "mstdio.h"     /* stdio modeling header */
+
+typedef struct comp_model_info_tag
+  {
+      comp_model_t model_type;  /* model this stream is using */
+      union
+        {                       /* union of all the different types of model information */
+            comp_model_stdio_info_t stdio_info;     /* stdio model info */
+        }
+      model_info;
+      funclist_t  model_funcs;  /* functions to perform modeling */
+  }
+comp_model_info_t;
+
+/* Coding information */
+
+/* structure for storing modeling information */
+/* only allow encoding and master compression routines access */
+
+#include "cnone.h"  /* no encoding header */
+#include "crle.h"   /* run-length encoding header */
+#include "cnbit.h"  /* N-bit encoding header */
+#include "cskphuff.h"   /* Skipping huffman encoding header */
+#include "cdeflate.h"   /* gzip 'deflate' encoding header */
+#include "cszip.h"   /* szip encoding header */
+
+typedef struct comp_coder_info_tag
+  {
+      comp_coder_t coder_type;  /* coding scheme this stream is using */
+      union
+        {                       /* union of all the different types of coding information */
+            comp_coder_none_info_t none_info;   /* "None" coding info */
+            comp_coder_rle_info_t rle_info;     /* RLE coding info */
+            comp_coder_nbit_info_t nbit_info;   /* N-bit coding info */
+            comp_coder_skphuff_info_t skphuff_info;     /* Skipping huffman coding info */
+            comp_coder_deflate_info_t deflate_info;   /* gzip 'deflate' coding info */
+	    comp_coder_szip_info_t szip_info;   /* szip coding info */
+
+        }
+      coder_info;
+      funclist_t  coder_funcs;  /* functions to perform encoding */
+  }
+comp_coder_info_t;
+
+/* structure for storing a state */
+typedef struct comp_stateinfo_tag
+  {
+      uint32      d_offset;     /* the offset of the state in the dataset */
+      uint32      c_offset;     /* offset of the state in the compressed data */
+      comp_model_info_t minfo;  /* modeling information */
+      comp_coder_info_t cinfo;  /* coding information */
+  }
+comp_stateinfo_t;
+
+/* structure for storing state caching information */
+typedef struct comp_state_cache_tag
+  {
+      intn        num_states;   /* the number of states cached */
+      comp_stateinfo_t **comp_state;    /* pointer to an array of pointers to
+                                           compression states */
+  }
+comp_state_cache_t;
+
+/* compinfo_t -- compressed element information structure */
+typedef struct compinfo_tag
+  {
+      intn        attached;     /* number of access records attached
+                                   to this information structure */
+      int32       length;       /* the actual length of the data elt */
+      uint16      comp_ref;     /* compressed info ref. number */
+      int32       aid;          /* AID of the compressed info */
+      comp_model_info_t minfo;  /* modeling information */
+      comp_coder_info_t cinfo;  /* coding information */
+      intn        caching;      /* whether caching is turned on */
+      comp_state_cache_t sinfo; /* state information for caching */
+  }
+compinfo_t;
+
+#endif /* __HCOMPI_H */
diff --git a/hdf/src/hcompri.c b/hdf/src/hcompri.c
new file mode 100644
index 0000000..39b9016
--- /dev/null
+++ b/hdf/src/hcompri.c
@@ -0,0 +1,560 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: hcompri.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/*LINTLIBRARY */
+/* ------------------------------ hcompri.c -------------------------------
+
+   Routines for reading & writing old-style (i.e. non-special compressed)
+   compressed raster images, such as JPEG, (raster specific) RLE and IMCOMP.
+   These routines are designed to be layered underneath the buffered special
+   element code and only provide access to reading/writing the entire image
+   at once through the DFgetcomp/DFputcomp code.
+
+   File Organization
+  ******************
+    These special elements are invoked at run-time only, information about
+    whether an element was written/read through this interface is not stored in
+    the file.  Unless specificly asked for by an API routine or required for a
+    particular kind of access by the library, these routines aren't called.
+
+ LOCAL ROUTINES
+
+ EXPORTED BUT LIBRARY PRIVATE ROUTINES
+   HRPcloseAID      -- close object but keep AID active
+   HRPendacess      -- close object, free AID
+   HRPinfo          -- return info about a compressed raster element
+   HRPinquire       -- retrieve information about a compressed raster element
+   HRPread          -- read some data out of a compressed raster element
+   HRPreset         -- replace the current comp. raster info with new info (NOP)
+   HRPseek          -- set the seek position
+   HRPsetaccesstype -- set the I/O access type of the compressed raster element
+   HRPstread        -- open an access record for reading
+   HRPstwrite       -- open an access record for reading
+   HRPwrite         -- write some data out to a compressed raster element
+   HRPconvert       -- wrap access to a compress raster object
+
+------------------------------------------------------------------------- */
+
+#include "hdf.h"
+#include "hfile.h"
+#include <assert.h>
+
+/* crinfo_t -- compressed raster information structure */
+
+typedef struct
+  {
+      intn        attached;     /* number of access records attached
+                                   to this information structure */
+      int32 fid;                /* File ID of image */
+      uint16 tag, ref;          /* Tag & ref of compressed raster image */
+      int32 xdim, ydim;         /* Image dimensions */
+      int16 scheme;             /* Compression scheme */
+      comp_info cinfo;          /* Compression information */
+      uintn image_size;         /* Size of the uncompressed image in memory */
+  }
+crinfo_t;
+
+/* forward declaration of the functions provided in this module */
+
+/* cr_funcs -- table of the accessing functions of the compressed raster
+   data element function modules.  The position of each function in
+   the table is standard */
+funclist_t  cr_funcs =
+{
+    HRPstread,
+    HRPstwrite,
+    HRPseek,
+    HRPinquire,
+    HRPread,
+    HRPwrite,
+    HRPendaccess,
+    HRPinfo,
+    NULL         /* no routine registered */
+};
+
+/*------------------------------------------------------------------------ 
+NAME
+   HRPconvert -- wrap an existing raster image with the special element routines.
+USAGE
+   intn HRPconvert(fid, tag, ref, xdim, ydim, scheme, cinfo, pixel_size)
+        int32 fid;          IN: File ID for raster image
+        uint16 tag, ref;    IN: Tag & Ref of raster image to wrap
+        int32 xdim, ydim;   IN: Dimensions of raster image
+        int16 scheme;       IN: Compression scheme used
+        comp_info *cinfo;   IN: Additional compression parameters
+        uintn pixel_size;   IN: Size of the pixels in the image
+RETURNS
+   AID on SUCCEED/FAIL on failure
+DESCRIPTION
+   Wraps an existing compressed raster image with the special element API.
+   This is designed only for use under a buffered special element.
+
+FORTRAN
+   None
+
+--------------------------------------------------------------------------*/
+int32
+HRPconvert(int32 fid, uint16 tag, uint16 ref, int32 xdim, int32 ydim,int16 scheme, comp_info *cinfo, uintn pixel_size)
+{
+    CONSTR(FUNC, "HRPconvert");     /* for HERROR */
+    filerec_t  *file_rec;           /* file record */
+    accrec_t   *access_rec=NULL;    /* access element record */
+    crinfo_t  *info;                /* information for the compressed raster element */
+    int32      ret_value = SUCCEED;
+
+    HEclear();
+
+    file_rec = HAatom_object(fid);
+    if (BADFREC(file_rec) || SPECIALTAG(tag))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* allocate special info struct for buffered element */
+    if ((info = HDmalloc((uint32) sizeof(crinfo_t)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* fill in special info struct */
+    info->attached= 1;
+    info->fid     = fid;
+    info->tag     = tag;
+    info->ref     = ref;
+    info->xdim    = xdim;
+    info->ydim    = ydim;
+    info->image_size  = xdim*ydim*pixel_size;
+    info->scheme  = scheme;
+    HDmemcpy(&(info->cinfo),cinfo,sizeof(comp_info));
+
+    /* get empty access record */
+    access_rec = HIget_access_rec();
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_TOOMANY, FAIL);
+
+    /* set up the information in the access record */
+    access_rec->special_info = info;
+
+    /* Check if the tag/ref pair exists */
+    if(Hexist(fid,tag,ref)<0) {
+        access_rec->new_elem=TRUE;
+        if((access_rec->ddid=HTPcreate(file_rec,tag,ref))==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      } /* end if */
+    else {
+        if((access_rec->ddid=HTPselect(file_rec,tag,ref))==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      } /* end else */
+    access_rec->special_func = &cr_funcs;
+    access_rec->special      = SPECIAL_COMPRAS;
+    access_rec->posn         = 0;
+    access_rec->access       = DFACC_RDWR;
+    access_rec->file_id      = fid;
+    access_rec->appendable   = FALSE;     /* data is non-appendable */
+    file_rec->attach++;
+
+    ret_value = HAregister_atom(AIDGROUP,access_rec);  /* return access id */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+    } /* end if */
+
+  return ret_value; 
+} /* HRPconvert */
+
+/* ------------------------------ HRPstread ------------------------------- */
+/*
+NAME
+   HRPstread -- open an access record for reading
+USAGE
+   int32 HRPstread(access_rec)
+       access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   This is a stub routine and should never be called
+
+---------------------------------------------------------------------------*/
+int32
+HRPstread(accrec_t * rec)
+{
+    /* shut compilers up*/
+    rec=rec;
+
+assert(0 && "Should never be called");
+  return (FAIL);
+}   /* HRPstread */
+
+/* ------------------------------ HRPstwrite ------------------------------- */
+/*
+NAME
+   HRPstwrite -- open an access record for reading
+USAGE
+   int32 HRPstwrite(access_rec)
+       access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   This is a stub routine and should never be called.
+
+---------------------------------------------------------------------------*/
+int32
+HRPstwrite(accrec_t * rec)
+{
+    /* shut compilers up*/
+    rec=rec;
+
+assert(0 && "Should never be called");
+  return (FAIL);
+}   /* HRPstwrite */
+
+/* ------------------------------ HRPseek ------------------------------- */
+/*
+NAME
+   HRPseek -- set the seek posn
+USAGE
+   int32 HRPseek(access_rec, offset, origin)
+       access_t * access_rec;      IN: access record to mess with
+       int32      offset;          IN: seek offset
+       int32      origin;          IN: where we should calc the offset from
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Set the seek posn in the given compressed raster element.  The only valid
+   position is 0 bytes from the beginning.
+
+---------------------------------------------------------------------------*/
+int32
+HRPseek(accrec_t * access_rec, int32 offset, int origin)
+{
+    int32     ret_value = SUCCEED;
+    CONSTR(FUNC, "HRPseek");    /* for HERROR */
+
+    /* Adjust offset according to origin.  There is no upper bound to posn */
+    if (origin != DF_START || offset !=0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* set the offset */
+    access_rec->posn = offset;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HRPseek */
+
+/* ------------------------------ HRPread ------------------------------- */
+/*
+NAME
+   HRPread -- read some data out of compressed raster element
+USAGE
+   int32 HRPread(access_rec, length, data)
+       access_t * access_rec;      IN: access record to mess with
+       int32      length;          IN: number of bytes to read
+       void *      data;           IN: buffer for data
+RETURNS
+   The number of bytes read or FAIL on error
+DESCRIPTION
+    Uncompress a compressed raster image into the buffer provided.  Support is
+    only provided for reading the entire image in.
+
+---------------------------------------------------------------------------*/
+int32
+HRPread(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HRPread");    /* for HERROR */
+    crinfo_t  *info =          /* information on the special element */
+        (crinfo_t *) access_rec->special_info;
+    int32    ret_value = SUCCEED;
+
+    /* validate length */
+    if (length!=0 && length!=(int32)info->image_size)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* adjust length */
+    if (length == 0)
+        length = info->image_size;
+
+    /* Copy data from buffer */
+    DFgetcomp(info->fid,info->tag,info->ref,data,info->xdim,info->ydim,info->scheme);
+
+    ret_value = length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* HRPread */
+
+/* ------------------------------ HRPwrite ------------------------------- */
+/*
+NAME
+   HRPwrite -- write data out to a compressed raster image
+USAGE
+   int32 HRPwrite(access_rec, length, data)
+       access_t * access_rec;      IN: access record to mess with
+       int32      length;          IN: number of bytes to read
+       void *     data;            IN: buffer of data
+RETURNS
+   The number of bytes written or FAIL on error
+DESCRIPTION
+   Write out data to a compressed raster image.  The entire image must be
+   written.
+
+---------------------------------------------------------------------------*/
+int32
+HRPwrite(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HRPwrite");   /* for HERROR */
+    crinfo_t  *info =          /* information on the special element */
+                    (crinfo_t *) (access_rec->special_info);
+    int32      ret_value = SUCCEED;
+
+    /* validate length */
+    if (length!=0 && length!=(int32)info->image_size)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* adjust length */
+    if (length == 0)
+        length = info->image_size;
+
+    /* Copy data to buffer */
+    DFputcomp(info->fid,info->tag,info->ref,data,info->xdim,info->ydim,NULL,NULL,info->scheme,&(info->cinfo));
+
+    ret_value = length;    /* return length of bytes written */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* HRPwrite */
+
+/* ------------------------------ HRPinquire ------------------------------ */
+/*
+NAME
+   HRPinquire -- retreive information about a compressed raster element
+USAGE
+   int32 HBPinquire(access_rec, file, tag, ref, len, off, pos, acc, sp)
+   access_t * access_rec;      IN:  access record to return info about
+   uint16   * file;            OUT: file ID;
+   uint16   * tag;             OUT: tag of info record;
+   uint16   * ref;             OUT: ref of info record;
+   int32    * len;             OUT: length of element;
+   int32    * off;             OUT: offset of element (NOT correct);
+   int32    * pos;             OUT: current position in element;
+   int16    * acc;             OUT: access mode;
+   int16    * sp;              OUT: special code;
+RETURNS
+   SUCCEED
+DESCRIPTION
+   Return interesting information about a compressed raster element.
+   NULL can be passed for any of the OUT parameters if their
+   value is not needed.
+
+---------------------------------------------------------------------------*/
+int32
+HRPinquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+           uint16 *pref, int32 *plength, int32 *poffset,
+           int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    CONSTR(FUNC, "HRPinquire");   /* for HERROR */
+    crinfo_t  *info =          /* special information record */
+        (crinfo_t *) access_rec->special_info;
+    uint16 data_tag,data_ref;   /* tag/ref of the data we are checking */
+    int32       data_off;		/* offset of the data we are checking */
+    int32    ret_value = SUCCEED;
+
+    /* Get the data's offset & length */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,&data_off,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the variables if they are present */
+    if (pfile_id)
+        *pfile_id = access_rec->file_id;
+    if (ptag)
+        *ptag = data_tag;
+    if (pref)
+        *pref = data_ref;
+    if (plength)
+        *plength = (access_rec->new_elem ? -1 : info->image_size);
+    if (poffset)
+        *poffset = data_off;
+    if (pposn)
+        *pposn = access_rec->posn;
+    if (paccess)
+        *paccess = (int16)access_rec->access;
+    if (pspecial)
+        *pspecial = (int16)access_rec->special;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return ret_value;
+}	/* HRPinquire */
+
+/* ----------------------------- HRPendaccess ----------------------------- */
+/*
+NAME
+   HRPendacess -- free AID
+USAGE
+   intn HRPendaccess(access_rec)
+       access_t * access_rec;      IN:  access record to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Free the AID
+
+---------------------------------------------------------------------------*/
+intn
+HRPendaccess(accrec_t * access_rec)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HRPendaccess");   /* for HERROR */
+#endif /* LATER */
+    filerec_t  *file_rec; 	    /* file record */
+    intn     ret_value = SUCCEED;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* shut down dependant access record */
+    HRPcloseAID(access_rec);
+
+    /* free the access record */
+    HIrelease_accrec_node(access_rec);
+
+    /* detach from the file */
+    file_rec->attach--;
+
+
+#ifdef LATER
+done:
+#endif /* LATER */
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(access_rec!=NULL)
+          HIrelease_accrec_node(access_rec);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value; 
+}	/* HRPendaccess */
+
+/* ----------------------------- HRPcloseAID ------------------------------ */
+/*
+NAME
+   HRPcloseAID -- free memory but keep AID active
+USAGE
+   int32 HRPcloseAID(access_rec)
+       access_t * access_rec;      IN:  access record of file to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Free special element information, but do *NOT* free the AID.
+
+---------------------------------------------------------------------------*/
+int32
+HRPcloseAID(accrec_t * access_rec)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HRPcloseAID");    /* for HERROR */
+#endif /* LATER */
+    crinfo_t  *info =          /* special information record */
+        (crinfo_t *) access_rec->special_info;
+    int32      ret_value = SUCCEED;
+
+    /* detach the special information record.
+       If no more references to that, free the record */
+
+    if (--(info->attached) == 0)
+      {
+        HDfree(info);
+        access_rec->special_info = NULL;
+      }
+
+#ifdef LATER
+done:
+#endif /* LATER */
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return(ret_value);
+}   /* HRPcloseAID */
+
+/* ------------------------------- HRPinfo -------------------------------- */
+/*
+NAME
+   HRPinfo -- return info about a compressed raster element
+USAGE
+   int32 HRPinfo(access_rec, info_block)
+       accrec_t        * access_rec; IN: access record of element
+       sp_info_block_t * info_block; OUT: information about the special element 
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Return information about the given external element.  Info_block is
+   assumed to be non-NULL.  
+
+   --------------------------------------------------------------------------- */
+int32
+HRPinfo(accrec_t * access_rec, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HRPinfo");    /* for HERROR */
+    int32      ret_value = SUCCEED;
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_COMPRAS)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the info_block */
+    info_block->key = SPECIAL_COMPRAS;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}   /* HRPinfo */
+
diff --git a/hdf/src/hconv.h b/hdf/src/hconv.h
new file mode 100644
index 0000000..9f9f635
--- /dev/null
+++ b/hdf/src/hconv.h
@@ -0,0 +1,159 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hconv.h 6036 2014-01-20 17:28:01Z acheng $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    hconv.h
+ * Purpose: header file for data conversion information & structures
+ * Invokes:
+ * Contents:
+ * Structure definitions:
+ * Constant definitions: lots...
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef _HCONV_H
+#define _HCONV_H
+
+/* This looks redundant because previously, VMS platform would undefine DUFF. */
+/* Don't know why. -AKC 2014/1/18 */
+#define DUFF
+#ifdef DUFF
+#define DUFF_sb4b
+
+#define DUFF_ui2i
+#define DUFF_ui2s
+#define DUFF_uo2i
+#define DUFF_ui4i
+#define DUFF_ui4s
+#define DUFF_uo4i
+#define DUFF_ui4f
+#define DUFF_uo4f
+#define DUFF_ui8f
+#define DUFF_uo8f
+
+#define DUFF_lui2i
+#define DUFF_lui2s
+#define DUFF_luo2i
+#define DUFF_lui4i
+#define DUFF_lui4s
+#define DUFF_luo4i
+#define DUFF_lui4f
+#define DUFF_luo4f
+#define DUFF_lui8f
+#define DUFF_luo8f
+#endif
+
+/*****************************************************************************/
+/* CONSTANT DEFINITIONS                                                      */
+/*****************************************************************************/
+/* Generally Big-Endian machines */
+#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__)
+#       define UI8_IN     DFKnb1b   /* Unsigned Integer, 8 bits */
+#       define UI8_OUT    DFKnb1b
+#       define SI16_IN    DFKnb2b   /* S = Signed */
+#       define SI16_OUT   DFKnb2b
+#       define UI16_IN    DFKnb2b
+#       define UI16_OUT   DFKnb2b
+#       define SI32_IN    DFKnb4b
+#       define SI32_OUT   DFKnb4b
+#       define UI32_IN    DFKnb4b
+#       define UI32_OUT   DFKnb4b
+#       define F32_IN     DFKnb4b   /* Float, 32 bits */
+#       define F32_OUT    DFKnb4b
+#       define F64_IN     DFKnb8b
+#       define F64_OUT    DFKnb8b
+
+#       define LUI8_IN    DFKnb1b   /* Little Endian Unsigned Integer, 8 bits */
+#       define LUI8_OUT   DFKnb1b
+#       define LSI16_IN   DFKsb2b
+#       define LSI16_OUT  DFKsb2b
+#       define LUI16_IN   DFKsb2b
+#       define LUI16_OUT  DFKsb2b
+#       define LSI32_IN   DFKsb4b
+#       define LSI32_OUT  DFKsb4b
+#       define LUI32_IN   DFKsb4b
+#       define LUI32_OUT  DFKsb4b
+#       define LF32_IN    DFKsb4b
+#       define LF32_OUT   DFKsb4b
+#       define LF64_IN    DFKsb8b
+#       define LF64_OUT   DFKsb8b
+
+#else  /* must be INTEL86 || MIPSEL || DEC_ALPHA || I860 || SUN386 || IA64 || Linux64 (Generally, little-endian machines */
+#   define UI8_IN     DFKnb1b   /* Big-Endian IEEE support */
+#   define UI8_OUT    DFKnb1b   /* The s in DFKsb2b is for swap */
+#   define SI16_IN    DFKsb2b
+#   define SI16_OUT   DFKsb2b
+#   define UI16_IN    DFKsb2b
+#   define UI16_OUT   DFKsb2b
+#   define SI32_IN    DFKsb4b
+#   define SI32_OUT   DFKsb4b
+#   define UI32_IN    DFKsb4b
+#   define UI32_OUT   DFKsb4b
+#   define F32_IN     DFKsb4b
+#   define F32_OUT    DFKsb4b
+#   define F64_IN     DFKsb8b
+#   define F64_OUT    DFKsb8b
+
+#   define LUI8_IN    DFKnb1b   /* Little-Endian IEEE support */
+#   define LUI8_OUT   DFKnb1b
+#   define LSI16_IN   DFKnb2b
+#   define LSI16_OUT  DFKnb2b
+#   define LUI16_IN   DFKnb2b
+#   define LUI16_OUT  DFKnb2b
+#   define LSI32_IN   DFKnb4b
+#   define LSI32_OUT  DFKnb4b
+#   define LUI32_IN   DFKnb4b
+#   define LUI32_OUT  DFKnb4b
+#   define LF32_IN    DFKnb4b
+#   define LF32_OUT   DFKnb4b
+#   define LF64_IN    DFKnb8b
+#   define LF64_OUT   DFKnb8b
+
+#endif /* !INTEL86 && !MIPS && !DEC_ALPHA && !I860 && !SUN386 && !IA64 && !Linux64*/
+
+/* All Machines currently use the same routines */
+/* for Native mode "conversions" */
+#     define NUI8_IN    DFKnb1b
+#     define NUI8_OUT   DFKnb1b
+#     define NSI16_IN   DFKnb2b
+#     define NSI16_OUT  DFKnb2b
+#     define NUI16_IN   DFKnb2b
+#     define NUI16_OUT  DFKnb2b
+#     define NSI32_IN   DFKnb4b
+#     define NSI32_OUT  DFKnb4b
+#     define NUI32_IN   DFKnb4b
+#     define NUI32_OUT  DFKnb4b
+#     define NF32_IN    DFKnb4b
+#     define NF32_OUT   DFKnb4b
+#     define NF64_IN    DFKnb8b
+#     define NF64_OUT   DFKnb8b
+
+/*****************************************************************************/
+/* STRUCTURE DEFINTIONS                                                      */
+/*****************************************************************************/
+union fpx
+  {
+      float       f;
+      long        l;
+  };
+
+union float_uint_uchar
+  {
+      float32     f;
+      int32       i;
+      unsigned char c[4];
+  };
+
+#endif /* _HCONV_H */
diff --git a/hdf/src/hdatainfo.c b/hdf/src/hdatainfo.c
new file mode 100644
index 0000000..e1d703b
--- /dev/null
+++ b/hdf/src/hdatainfo.c
@@ -0,0 +1,1186 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* NOTE: this file and other "datainfo" related files will be configured so
+         that this feature will not be built by default. -BMR
+   Update: THG and NASA had decided to include all features developed for the
+           HDF Mapping Project in the library -BMR (~Jan 2011) */
+
+/**********************************************************************
+FILE
+  hdatainfo.c
+  HDF data information routines - added to support the HDF4 Mapping project
+
+  This file contains the multi-file HDF interface functions that provide
+  information about location and size of raw data.  This type of information
+  will allow applications to extract raw data from an HDF file without the
+  use of HDF4 library.  These features were developed to support the HDF4
+  Mapping project (2010-2011.)
+
+  As with the rest of the functions in the APIs, these functions have names
+  beginning with VG, VS, GR, and AN, appropriately.
+
+EXPORTED ROUTINES
+-----------------
+  VSgetdatainfo    -- retrieves offset(s) and length(s) of a vdata's data
+  GRgetdatainfo    -- retrieves offset(s) and length(s) of an image's data
+  VSgetattdatainfo -- retrieves offset and length of a vdata attribute's data
+  Vgetattdatainfo  -- retrieves offset and length of a vgroup attribute's data 
+  GRgetattdatainfo -- retrieves offset and length of an image attribute's data 
+  ANgetdatainfo    -- retrieves offset and length of an annotation's data
+
+LOW-LEVEL ROUTINES
+------------------
+  HDgetdatainfo -- retrieves offset(s) and length(s) of the data in a data element
+
+**********************************************************************/
+
+#ifndef MFGR_MASTER
+#define MFGR_MASTER	/* for GRgetdatainfo and GRgetattdatainfo */
+#endif			/* mfgr.h had been included in hdf.h */
+
+#ifndef MFAN_MASTER
+#define MFAN_MASTER	/* for ANgetdatainfo */
+#endif			/* mfan.h is included here */
+
+#include "hdf.h"
+#include "hlimits.h"
+#include "vgint.h"
+#include "mfan.h"
+
+#ifdef H4_HAVE_LIBSZ	/* we have the szip library */
+#include "szlib.h"
+#endif
+
+
+/*----------------------------------------------------------------------------- 
+ NAME
+    HDgetdatainfo -- Retrieves offset(s) and length(s) of the data in a
+		     data element.
+ USAGE
+    intn HDgetdatainfo(file_id, tag, ref, start_block, info_count,
+			 *offsetarray, *lengtharray)	
+	int32  file_id		IN: file id
+	uint16 tag		IN: tag of the element
+	uint16 ref		IN: ref of element
+	int32 *chk_coord	IN: chunk's coordinates or NULL if not chunked
+	uintn  start_block	IN: data block to start at, 0 base
+	uintn  info_count	IN: number of info records
+	int32 *offsetarray	OUT: array to hold offsets
+	int32 *lengtharray	OUT: array to hold lengths
+ RETURNS
+    Number of data blocks if successful, or FAIL, otherwise.
+
+ DESCRIPTION
+    HDgetdatainfo will use low-level functions to get data information
+    of element that is in chunk or linked-block storage.
+
+    If the given tag/ref point to:
+    - no data then the function will return 0 for number of data blocks,
+    - actual data written then the function will return 1 for number of
+      data blocks and its offset/length if they are requested, or
+    - description record, which means this element is special, then the
+      function will act appropriately depend upon the specialness
+      + compression
+	* if the compressed data is stored in one block, the function will
+          return 1 and the offset/length if they are requested
+	* if the compressed data is stored in linked-blocks,
+	  > read the linked-block special header info
+	  > call HLgetdatainfo to get data info of the blocks
+      + chunking
+	* call HMCgetdatainfo to get data info of the requested chunk
+      + linked-block
+	* read the linked-block special header info
+	* call HLgetdatainfo to get data info of the blocks
+
+ NOTES
+    Aug 17, 2010: Tested with SDgetdatainfo and VSgetdatainfo -BMR
+    Sep 7, 2010: Tested with GRgetdatainfo, but not linked-block yet -BMR
+    Oct 5, 2010: Modified to handle compressed/linked-block element -BMR
+--------------------------------------------------------------------------*/
+intn
+HDgetdatainfo(int32 file_id, uint16 tag, uint16 ref, int32 *chk_coord,
+	uintn start_block, uintn info_count, int32 *offsetarray,
+	int32 *lengtharray)
+{
+    CONSTR(FUNC, "HDgetdatainfo");	/* for HGOTO_ERROR */
+    filerec_t  *file_rec;	/* file record */
+    uint16	sp_tag;		/* special tag */
+    uint16	comp_ref = 0;	/* ref for compressed data or comp header */
+    uint16	dtag, dref;	/* description record tag/ref */
+    int32	dlen=0, doff=0;	/* offset/length of the description record */
+    uint8	lbuf[COMP_HEADER_LENGTH],
+		*p=NULL;	/* desc record buffer and a pointer to it */
+    atom_t	data_id = FAIL;	/* dd ID of existing element */
+    int32	length; /* uncomp data len to check if data had been written */
+    intn	count=0;/* num of data blocks returned by getdatainfo funcs */
+    uint16	spec_code=0;/* special code: SPECIAL_LINKED, SPECIAL_COMP,... */
+    int32	comp_aid=-1;/* compressed element access id */
+    intn	ret_value=SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate array size */
+    if (info_count == 0 && offsetarray != NULL && lengtharray != NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Getting only offsets or lengths is not allowed */
+    if ((offsetarray != NULL && lengtharray == NULL) ||
+        (offsetarray == NULL && lengtharray != NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Convert file id to file rec and check for validity */
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get access element from dataset's tag/ref */
+    if ((data_id=HTPselect(file_rec, tag, ref))!=FAIL)
+    {
+	/* Get the info pointed to by this dd, which could point to data or
+	   description record */
+	if (HTPinquire(data_id, &dtag, &dref, &doff, &dlen) == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* Return 0 if no data had been written */
+        if (doff == INVALID_OFFSET && dlen == INVALID_LENGTH)
+	{
+	    /* End access to the element */
+	    if (HTPendaccess(data_id) == FAIL)
+	        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+	    HGOTO_DONE(0);
+	}
+
+	/* If the element is not special, that means dataset's tag/ref 
+	   specifies the actual data that was written to the dataset, get
+	   the offset and length of the data if they were requested */
+	if (HTPis_special(data_id)==FALSE)
+        {
+	    /* Only one data block here, starting offset cannot be > 1 */
+	    if (start_block > 1)
+		HGOTO_ERROR(DFE_ARGS, FAIL);
+
+	    /* Offset and length are requested by caller */
+	    if (offsetarray != NULL && lengtharray != NULL)
+	    {
+		offsetarray[0] = doff;
+		lengtharray[0] = dlen;
+	    }
+	    count = 1;
+        }
+
+	/* If the element is special, get the special info header and decode
+	   for special tag to detect compression/chunking/linked blocks */
+	else
+	{
+	    if (HPseek(file_rec, doff) == FAIL)
+		HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+	    if (HP_read(file_rec, lbuf, (int)2) == FAIL)
+		HGOTO_ERROR(DFE_READERROR, FAIL);
+
+	    /* Decode the special tag */
+	    p = &lbuf[0];
+	    INT16DECODE(p, sp_tag);
+
+	    /* This is a compressed element */
+	    if (sp_tag == SPECIAL_COMP)
+	    {
+		/* Read compression info header */
+		if (HP_read(file_rec, lbuf, (int)COMP_HEADER_LENGTH) == FAIL)
+		HGOTO_ERROR(DFE_READERROR, FAIL);
+
+		/* Decode header to get data length */
+		p = &lbuf[0];
+		p = p + 2; /* skip 2byte header_version */
+		INT32DECODE(p, length);	/* get _uncompressed_ data length */
+
+		/* No data written */
+		if (length == 0)
+		{
+		    count = 0;
+		}
+		/* Data had been written, either in contiguous block or more
+		   special storage, in which case special code needs to be read */
+		else
+		{
+		    /* Decode for the compression ref# */
+		    UINT16DECODE(p, comp_ref);
+
+		    /* Get access to the compression element */
+		    if ((comp_aid = HTPselect(file_rec, DFTAG_COMPRESSED, comp_ref)) == FAIL)
+		        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+		    /* If data had been written in one contiguous block */
+		    if (HTPis_special(comp_aid) != TRUE)
+		    {
+		        /* Only one data block here, starting offset cannot be > 1*/
+		        if (start_block > 1)
+			    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+		        /* This element is not further special, only compressed,
+		           get its offset and length if they are requested */
+		        if (offsetarray != NULL && lengtharray != NULL)
+		        {
+			    int32 off=0, len=0;
+			    off = Hoffset(file_id, DFTAG_COMPRESSED, comp_ref);
+			    if (off == FAIL)
+			        HGOTO_ERROR(DFE_BADOFFSET, FAIL);
+			    len = Hlength(file_id, DFTAG_COMPRESSED, comp_ref);
+			    if (len == FAIL)
+			        HGOTO_ERROR(DFE_BADLEN, FAIL);
+
+			    offsetarray[0] = off;
+			    lengtharray[0] = len;
+		        }
+		        count = 1;
+		    }   /* end if */
+
+		    /* This element is further special, read in the special code
+		       to see what specialness is and process appropriately */
+		    else
+		    {
+			/* Get offset of the special header */
+		        if(HTPinquire(comp_aid, NULL, NULL, &doff, NULL)==FAIL)
+		        {
+			    HTPendaccess(comp_aid);
+			    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+		        }
+			/* Get to and read the special code from the header */
+		        if (HPseek(file_rec, doff) == FAIL)
+			    HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+		        if (HP_read(file_rec, lbuf, (int)2) == FAIL)
+			    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+		        /* Decode special code */
+		        p = &lbuf[0];
+		        INT16DECODE(p, spec_code);
+
+			/* The element has linked-blocks */
+		        if (spec_code == SPECIAL_LINKED)
+		        {
+			    /* Read the rest of the linked-block info header */
+			    if (HP_read(file_rec, lbuf, (int)14) == FAIL)
+			        HGOTO_ERROR(DFE_READERROR, FAIL);
+
+			    /* Pass the header info to the linked-block API
+			       to get the data info if they are requested or the
+			       info count only, otherwise */ 
+			    p = &lbuf[0];
+			    if (offsetarray != NULL && lengtharray != NULL)
+			        count = HLgetdatainfo(file_id, p, start_block,
+					info_count, offsetarray, lengtharray);
+			    else  /* get number of data blocks only */
+			        count = HLgetdatainfo(file_id, p, start_block,
+					0, NULL, NULL);
+		        } /* this element is also stored in linked blocks */
+		    } /* this element is further special */
+
+		    /* Release the compression element */
+		    if(HTPendaccess(comp_aid)==FAIL)
+		        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+		} /* compressed data written */
+	    } /* element is compressed */
+
+	    /* This is a chunked element, hand the task over to the chunking
+		layer. */
+	    else if (sp_tag == SPECIAL_CHUNKED)
+	    {
+		if (chk_coord != NULL)
+		    count = HMCgetdatainfo(file_id, tag, ref, chk_coord,
+			    start_block, info_count, offsetarray, lengtharray);
+		else /* BMR: check to see what should be done here */
+		{
+		    fprintf(stderr, "\nERROR>>> Element with tag/ref %d/%d is a chunked element, the chunk's coordinates must be specified\n", tag, ref);
+	 	    HGOTO_ERROR(DFE_ARGS, FAIL);
+		}
+	    }
+
+	    /* Unlimited dimension; extract the number of blocks and the ref #
+		of the link table then hand over to linked block layer */
+	    else if (sp_tag == SPECIAL_LINKED)
+	    {
+		/* Read the linked-block info header */
+		if (HP_read(file_rec, lbuf, (int)14) == FAIL)
+		    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+		/* Pass the header info to the linked-block API to get the data
+		   info if they are requested or the info count only */ 
+		p = &lbuf[0];
+		if (offsetarray != NULL && lengtharray != NULL)
+		    count = HLgetdatainfo(file_id, p, start_block, info_count,
+			    offsetarray, lengtharray);
+		else  /* get data information from the linked blocks */
+		    count = HLgetdatainfo(file_id, p, start_block, 0, NULL, NULL);
+	    } /* element is SPECIAL_LINKED */
+	} /* else, data element is special */
+
+	/* End access to the element */
+	if (HTPendaccess(data_id) == FAIL)
+	    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    }  /* end if data_id != FAIL */
+
+    else /* HTPselect failed */
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+
+    /* Return the number of data blocks */
+    ret_value = count;
+done:
+    if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+    } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* HDgetdatainfo */
+
+
+/*------------------------------------------------------ 
+ NAME
+    VSgetdatainfo - Gets the offset/length of a vdata's data
+ USAGE
+    intn VSgetdatainfo(vsid, start_block, info_count, offsetarray, lengtharray)	
+	int32  vsid		IN: vdata id
+	uintn  start_block	IN: data block to start at, 0 base
+	uintn  info_count	IN: number of blocks to be retrieved
+	int32 *offsetarray	OUT: array to hold offsets
+	int32 *lengtharray	OUT: array to hold lengths
+ RETURNS
+    The number of data blocks retrieved, if successful and FAIL, otherwise.
+
+ DESCRIPTION
+    This function uses the low-level function HDgetdatainfo to 
+    get the data info when the vdata is stored in linked-blocks.
+
+ TODO
+    - not tested with start_block and info_count
+ NOTES
+    Aug 17, 2010: Tested some in hdf/test/tdatainfo.c -BMR
+----------------------------------------------------------*/
+intn 
+VSgetdatainfo(int32 vsid, uintn start_block, uintn info_count,
+	int32 *offsetarray, int32 *lengtharray)
+{
+    CONSTR(FUNC, "VSgetdatainfo");
+    vsinstance_t *vs_inst = NULL;
+    VDATA        *vs = NULL;
+    accrec_t     *access_rec;
+    intn	  count;
+    intn          ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate array size */
+    if (info_count == 0 && offsetarray != NULL && lengtharray != NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Getting only offsets or lengths is not allowed */
+    if ((offsetarray != NULL && lengtharray == NULL) ||
+        (offsetarray == NULL && lengtharray != NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check key is valid vdata */
+    if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get vdata instance */
+    if (NULL == (vs_inst = (vsinstance_t *) HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* Get vdata info structure and check it */
+    vs = vs_inst->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* Get access record of the vdata */
+    access_rec = HAatom_object(vs->aid);
+    if (access_rec == (accrec_t *) NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If the vdata is empty, return 0 block */
+    if (vs->nvertices <= 0)
+	HGOTO_DONE(0);
+
+    /* If the vdata is stored in linked-blocks, let the low-level function
+       handle it */
+    if (access_rec->special == SPECIAL_LINKED)
+    {
+	/* Application only wants the number of data blocks */
+	if (offsetarray == NULL && lengtharray == NULL)
+	{
+	    count = HDgetdatainfo(vs->f, VSDATATAG, vs->oref, NULL, start_block, info_count, NULL, NULL);
+	}
+	/* Application only wants the offset and length of the blocks too */
+	else
+	{
+	    count = HDgetdatainfo(vs->f, VSDATATAG, vs->oref, NULL, start_block, info_count, offsetarray, lengtharray);
+	}
+	if (count == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+    /* The vdata is stored in contiguous block */
+    else
+    {
+	if (offsetarray != NULL && lengtharray != NULL)
+	{
+	    int32 off=0, len=0;
+	    if ((off = Hoffset(vs->f, VSDATATAG, vs->oref)) == FAIL)
+		HGOTO_ERROR(DFE_BADOFFSET, FAIL);
+	    if ((len = Hlength(vs->f, VSDATATAG, vs->oref)) == FAIL)
+		HGOTO_ERROR(DFE_BADLEN, FAIL);
+	    *offsetarray = off;
+	    *lengtharray = len;
+	}
+	count = 1;
+    }
+    /* Return the number of data blocks */
+    ret_value = count;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetdatainfo */
+
+
+/*----------------------------------------------------------------------------- 
+ NAME
+    Vgetattdatainfo - Gets the offset/length of the data of a vgroup's attribute
+ USAGE
+    intn Vgetattdatainfo(vgid, attrindex, *offset, *length)	
+	int32  vgid		IN: vgroup id
+	intn   attrindex	IN: attribute index
+	int32 *offset		OUT: buffer for offset
+	int32 *length		OUT: buffer for length
+ RETURNS
+    The number of data blocks retrieved, which should be 1, if successful
+    and FAIL, otherwise.
+
+ DESCRIPTION
+    There are two types of attributes for vgroups.  One is the old-style
+    that was created using methods other than the standard attribute API
+    function Vsetattr, which was introduced after HDF Version 4.0 Release
+    2, July 19, 1996.  Without the use of Vsetattr, an application could
+    simulate an attribute for a vgroup by creating and writing a vdata
+    of class _HDF_ATTRIBUTE and adding that vdata to the vgroup via
+    these calls:
+
+    vdata_ref = VHstoredatam(file_id, ATTR_FIELD_NAME, values, size, type,
+		 attr_name, _HDF_ATTRIBUTE, order);
+    ret_value = Vaddtagref (vgroup_id, DFTAG_VH, vdata2_ref);
+
+    While both types of attributes are stored as vdatas, the vdatas of
+    the new-style attributes are saved in a list of attribute tags/refs
+    of the vgroup, and the vdatas of the old-style attributes are saved
+    as elements of the vgroup.  Because of the different storages, the
+    new attribute functions would miss the old-style attributes.
+
+    Two fields are added to the internal structure VGROUP for holding the
+    number of old-style attributes and their ref#s.  These fields are set
+    by Vnoldattrs when old-style attributes exist in the file.
+
+    When a vgroup has both type of attributes, the two list will be
+    combined with the old-style attributes preceeding the new ones.
+    The attribute indices will be adjusted accordingly.
+
+    This function uses the API function VSgetdatainfo to get the data
+    info of the attribute's data.
+    -BMR 2011/3/19
+----------------------------------------------------------*/
+intn 
+Vgetattdatainfo(int32 vgid, intn attrindex, int32 *offset, int32 *length)
+{
+    CONSTR(FUNC, "Vgetattdatainfo");
+    VGROUP *vg;
+    vg_attr_t *vg_alist;
+    vginstance_t *vg_inst;
+    int32 attr_vsid;
+    intn adjusted_index;
+    intn status;
+    intn ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Both buffers must be allocated */
+    if (offset == NULL || length == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Validate Vgroup ID */
+    if (HAatom_group(vgid) != VGIDGROUP)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate vg's index in vgtab */
+    if (NULL == (vg_inst = (vginstance_t *)HAatom_object(vgid)))
+       HGOTO_ERROR(DFE_VTAB, FAIL);
+    if (NULL == (vg = vg_inst->vg))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* Validate arguments */
+
+    if (attrindex < 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL); /* invalid attribute index given */
+
+    adjusted_index = attrindex;
+    if (adjusted_index < vg->noldattrs) /* index of old-style attribute */
+        vg_alist = vg->old_alist;  /* use old-attr list */
+    else if (adjusted_index >= vg->noldattrs &&
+             adjusted_index < (vg->nattrs+vg->noldattrs))
+                 /* index of new-style attributes */
+    {
+        /* Adjust the index to accommodate for the old-style attributes
+           preceding the new-style attribute list */
+        adjusted_index = adjusted_index - vg->noldattrs;
+        vg_alist = vg->alist;        /* use new-attr list */
+    }
+    else /* not that many attrs */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    if (vg_alist == NULL)
+        /* Bad attr list */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    /* Get vdata holding the attribute */
+    if (FAIL == (attr_vsid = VSattach(vg->f, (int32)vg_alist[adjusted_index].aref, "r")))
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+    /* Get offset and length of attribute's data.  Note that start_block is 0
+       and info_count is 1 because attribute's data is only stored in 1 block */
+    status = VSgetdatainfo(attr_vsid, 0, 1, offset, length);
+    if (status == FAIL)
+        HGOTO_ERROR(DFE_GENAPP, FAIL);
+
+    /* Close vdata */
+    if (FAIL == VSdetach(attr_vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+    /* Return the number of data blocks, which should be 1 */
+    ret_value = status;
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vgetattdatainfo */
+
+
+/*------------------------------------------------------ 
+ NAME
+    VSgetattdatainfo - Gets the offset/length of the data
+		      of a vdata's or vdata field's attribute
+ USAGE
+    intn VSgetattdatainfo(vsid, findex, attrindex, *offset, *length)	
+	int32  vsid		IN: vdata id
+	int32  findex		IN: vdata's field index or _HDF_VDATA
+	intn   attrindex	IN: attribute index
+	int32 *offset		OUT: buffer for offset
+	int32 *length		OUT: buffer for length
+ RETURNS
+    The number of data blocks retrieved, which should be 1, if successful
+    and FAIL, otherwise.
+
+ DESCRIPTION
+    VSgetattdatainfo retrieves the offset and length of the data that belongs
+    to an attribute.  If findex is _HDF_VDATA (or -1), then the attribute is
+    associated with the vdata vsid.  If findex is an index of the vdata field,
+    then the attribute is one that is associated with the vdata field.  The
+    parameter attrindex specifies the attribute's index within the vdata's
+    or the field's attribute list.  Thus, its valid value must be within
+    [0-nattrs of the associated list].
+
+    VSgetattdatainfo uses VSgetdatainfo once it locates the vdata that stores
+    the attribute.
+    -BMR 2011/3/19
+----------------------------------------------------------*/
+intn 
+VSgetattdatainfo(int32 vsid, int32 findex, intn attrindex, int32 *offset, int32 *length)
+{
+    CONSTR(FUNC, "VSgetattdatainfo");
+    VDATA *vs;
+    vs_attr_t *vs_alist;
+    vsinstance_t *vs_inst;
+    int32 attr_vsid;
+    intn nattrs, idx, a_index, found;
+    intn status;
+    intn ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Both buffers must be allocated */
+    if (offset == NULL || length == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* locate vs' index in vstab */
+    if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if ((findex >= vs->wlist.n || findex < 0) && (findex != _HDF_VDATA))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+    nattrs = vs->nattrs;
+
+    /* No attrs */
+    if (nattrs == 0) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Index must be positive and less than the number of attributes */
+    if (attrindex <0 || attrindex >= nattrs)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    vs_alist = vs->alist;
+
+    /* Bad attr list */
+    if (vs_alist == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    found = 0;
+    a_index = -1;
+    for (idx=0; idx<nattrs && found==0; idx++)
+    {
+	if (vs_alist->findex == findex)
+	{
+	    a_index++;
+	    if (a_index == attrindex)
+		found = 1;
+        }
+	if (!found) vs_alist++;
+    }
+    /* If this happened, it would have been detected by the check for range
+       of attrindex above already, but check it anyway */
+    if (!found)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Attribute is found.  Get access to the vdata that stores the attribute's
+       data, retrieve the offset and length of the data, then close access. */
+
+    /* Get vdata */
+    if (FAIL == (attr_vsid = VSattach(vs->f, (int32)vs_alist->aref, "r")))
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+    /* Get offset and length of attribute's data.  Note that start_block is 0
+       and info_count is 1 because attribute's data is only stored in 1 block */
+    status = VSgetdatainfo(attr_vsid, 0, 1, offset, length);
+    if (status == FAIL)
+        HGOTO_ERROR(DFE_GENAPP, FAIL);
+
+    /* Close vdata */
+    if (FAIL == VSdetach(attr_vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+    /* Return the number of data blocks, which should be 1 */
+    ret_value = status;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetattdatainfo */
+
+
+/*------------------------------------------------------------ 
+ NAME
+    GRgetattdatainfo - Gets the offset/length of the data of a
+			GR file's or an image's attribute
+ USAGE
+    intn GRgetattdatainfo(id, attrindex, offset, length)
+        int32 id		IN: either GR ID or RI ID
+        int32 attrindex		IN: index of the attribute being inquired
+        int32 *offset		OUT: buffer for offset
+        int32 *length		OUT: buffer for length
+ RETURNS
+    The number of data blocks retrieved, which should be 1, if successful
+    and FAIL, otherwise.
+
+ DESCRIPTION
+    GRgetattdatainfo retrieves the location and size of the attribute's data
+    and its length.
+
+ MODIFICATION
+    Apr 03, 2011: Revised to remove the parameter attrname because, for hmap
+        project, it makes sense to just provide the attribute index. -BMR
+
+--------------------------------------------------------------*/
+intn 
+GRgetattdatainfo(int32 id, int32 attrindex, int32 *offset, int32 *length)
+{
+    CONSTR(FUNC, "GRgetattdatainfo");
+    int32      hdf_file_id;	/* file id */
+    int32      attr_vsid;	/* id of vdata that stores the attribute */
+    group_t id_group=BADGROUP;	/* temporary group of id */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for gr id */
+    ri_info_t *ri_ptr;          /* ptr to the image information for ri id */
+    at_info_t *at_ptr=NULL;	/* ptr to the attribute information */
+    void     **aentry;		/* temp. ptr to the image found */
+    TBBT_TREE *search_tree;	/* attribute tree to search through */
+    int        found = FALSE;	/* TRUE when the searched attribute is found */
+    intn       status = 0; 
+    intn       ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate index */
+    if (attrindex < 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Both buffers must be allocated */
+    if (offset == NULL || length == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Validate ID */
+    id_group = HAatom_group(id);
+    if (id_group != RIIDGROUP && id_group != GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* Get attribute info and validate index */
+
+    /* When file ID is given, check index against file's attribute count */
+    if (id_group == GRIDGROUP)
+      {
+          /* locate GR's object in hash table */
+          if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+	  /* Check index against file's attribute count */
+          if(attrindex >= gr_ptr->gattr_count)
+              HGOTO_ERROR(DFE_ARGS, FAIL);
+
+          search_tree = gr_ptr->gattree;
+	  hdf_file_id = gr_ptr->hdf_file_id;
+      } /* end if */
+
+    /* When raster image ID is given, check index against image's attr count */
+    else if (id_group == RIIDGROUP)
+      {
+          /* locate RI's object in hash table */
+          if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+	  /* Check index against image's attribute count */
+          if(attrindex >= ri_ptr->lattr_count)
+              HGOTO_ERROR(DFE_ARGS, FAIL); 
+          search_tree = ri_ptr->lattree;
+	  hdf_file_id = ri_ptr->gr_ptr->hdf_file_id;
+      } /* end if */
+    else
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Search for an attribute with the same index */
+    aentry = (void **)tbbtfirst((TBBT_NODE *)*search_tree);
+    found = FALSE;
+    while (!found && (aentry != NULL))
+    {
+	at_ptr = (at_info_t *)*aentry;
+	if (at_ptr == NULL)
+	{
+	    HGOTO_ERROR(DFE_ARGS, FAIL); 
+	}
+
+	/* If index is found, set flag */
+	if (at_ptr->index == attrindex)
+	    found = TRUE;
+
+	/* Not found, go to the next entry */
+	if (!found)
+	    aentry = (void **)tbbtnext((TBBT_NODE *)aentry);
+    } /* end while */
+
+    /* If the attribute is found, get offset/length of its data */
+    if (found)
+    {
+	/* Get access to the vdata that stores the attribute */
+	attr_vsid = VSattach(hdf_file_id, (int32)at_ptr->ref, "r");
+	if (attr_vsid == FAIL)
+	    HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+	/* Get offset and length of attribute's data.  Note that start_block
+	   is 0 and info_count is 1 because attribute's data is only stored
+	   in 1 block */
+	status = VSgetdatainfo(attr_vsid, 0, 1, offset, length);
+	if (status == FAIL)
+	    HGOTO_ERROR(DFE_GENAPP, FAIL);
+
+	if (FAIL == VSdetach(attr_vsid))
+	    HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+    }
+    ret_value = status; /* should be 1 */
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}   /* GRgetattdatainfo */
+
+
+/*--------------------------------------------------------------- 
+NAME
+    GRgetdatainfo - Gets the offsets/lengths of the data of an image
+USAGE
+    intn GRgetdatainfo(riid, start_block, info_count, offsetarray, lengtharray)
+        int32 riid		IN: raster image ID
+	uintn start_block	IN: start retrieving data at
+	uintn info_count	IN: number of data blocks to retrieve
+	int32 *offsetarray	OUT: buffer for offset(s)
+	int32 *lengtharray	OUT: buffer for length(s)
+RETURNS
+    The number of data blocks retrieved, if successful and FAIL, otherwise.
+
+DESCRIPTION
+    This function uses the low-level function HDgetdatainfo to 
+    get the data info of an image.
+
+TODO
+    - not tested with linked-block element yet
+    - need more documentation
+----------------------------------------------------------------*/
+intn 
+GRgetdatainfo(int32 riid, uintn start_block, uintn info_count,
+	int32 *offsetarray, int32 *lengtharray)
+{
+    CONSTR(FUNC, "GRgetdatainfo");
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    int32 hdf_file_id;		/* short cut for file id */
+    int32 length = 0;
+    uintn count;
+    intn   ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate array size */
+    if (info_count == 0 && (offsetarray != NULL && lengtharray != NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Getting only offsets or lengths is not allowed */
+    if ((offsetarray != NULL && lengtharray == NULL) ||
+        (offsetarray == NULL && lengtharray != NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check the validity of the ID */
+    if (HAatom_group(riid) != RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate RI's object in hash table */
+    ri_ptr = (ri_info_t *) HAatom_object(riid);
+    if (NULL == ri_ptr)
+	HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    hdf_file_id = ri_ptr->gr_ptr->hdf_file_id;	/* alias for file id */
+
+    /* Check for no data in the image */
+
+    /* If the image has no tag/ref pair assigned to it yet, return 0 for
+       info count */
+    if(ri_ptr->img_tag==DFTAG_NULL || ri_ptr->img_tag==DFREF_WILDCARD
+	|| ri_ptr->img_ref==DFREF_WILDCARD)
+    {
+        if ((offsetarray != NULL && lengtharray != NULL))
+	    *offsetarray = *lengtharray = 0;
+	HGOTO_DONE(0);
+    }
+    /* If the image already had a tag/ref pair, make sure it has actual data,
+       if not, return 0 for info count */
+    else
+    {
+	length = Hlength(hdf_file_id, ri_ptr->img_tag, ri_ptr->img_ref);
+	if (length == FAIL)
+	{
+            if ((offsetarray != NULL && lengtharray != NULL))
+		*offsetarray = *lengtharray = 0;
+	    HGOTO_DONE(0);
+	}
+
+        /* If both arrays are NULL, get the number of data blocks and return */
+        if ((offsetarray == NULL && lengtharray == NULL))
+        {
+            count = HDgetdatainfo(hdf_file_id, ri_ptr->img_tag, ri_ptr->img_ref, NULL, start_block, 0, NULL, NULL);
+            if (count == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+        }
+
+        /* Application requests offsets/lengths */
+        else
+        {
+            count = HDgetdatainfo(hdf_file_id, ri_ptr->img_tag, ri_ptr->img_ref, NULL, start_block, info_count, offsetarray, lengtharray);
+            if (count == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+        }
+    } /* end else */
+
+    ret_value = count;
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}   /* GRgetdatainfo */
+
+
+/*--------------------------------------------------------------- 
+NAME
+    GRgetpalinfo - Gets the palette data descriptors (DDs) in the
+		   file (i.e., palette tags, refs, offsets, and lengths)
+USAGE
+    intn GRgetpalinfo(gr_id, pal_count, palinfo_array)
+        int32 gr_id		IN: GR interface ID
+	uintn pal_count		IN: number of palette DDs to get
+	hdf_ddinfo_t *palinfo_array	OUT: array of palette DDs
+RETURNS
+    The number of palette DDs in the file or the actual number of palette
+    DDs retrieved, if successful, and FAIL, otherwise.
+
+DESCRIPTION
+    If the caller only requests the number of palette tags in the file,
+    i.e., when palinfo_array is NULL and pal_count is 0, we will simply
+    return the number of palette tags, including both DFTAG_IP8 and
+    DFTAG_LUT, without further processing.
+
+    Otherwise, the function will search the file for all tags DFTAG_IP8
+    and DFTAG_LUT, then retrieve the palette data information into the
+    provided array of structures.
+
+    -BMR 2012/6/19
+----------------------------------------------------------------*/
+intn 
+GRgetpalinfo(int32 gr_id, uintn pal_count, hdf_ddinfo_t *palinfo_array)
+{
+    CONSTR(FUNC, "GRgetpalinfo");
+    gr_info_t *gr_ptr;
+    int32 file_id;
+    int32 nbytes = 0;
+    int32 aid = FAIL;
+    intn  idx;
+    uintn count;
+    intn  ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* check the validity of the GR ID */
+    if (HAatom_group(gr_id)!=GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate GR's object in hash table */
+    if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(gr_id)))
+        HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+    file_id = gr_ptr->hdf_file_id; /* alias of the file id */
+
+    /* Validate array size.  Fail when count is a pos number but the array is
+       NULL, or when count is a neg number */
+    if ((pal_count > 0 && palinfo_array == NULL) || pal_count < 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If only the number of palette tags is interested, return that */
+    if (pal_count == 0 && palinfo_array == NULL)
+    {
+	int32 n_IP8s = 0, n_LUTs = 0;
+
+	n_IP8s = Hnumber(file_id, DFTAG_IP8);
+	n_LUTs = Hnumber(file_id, DFTAG_LUT);
+	if (n_IP8s == FAIL || n_LUTs == FAIL)
+	{   HGOTO_ERROR(DFE_INTERNAL, FAIL); }
+	else 
+	    return(n_IP8s + n_LUTs);
+    }
+
+    /* Application requests data info of palettes.  Start checking tags in
+       the file and when a palette tag is encountered, retrieve its DD.  The
+       process continues until no more tags/refs in the file or the maxinum
+       size of the provided array is reached */
+    idx = 0;
+    ret_value = aid = Hstartread(file_id, DFTAG_WILDCARD, DFREF_WILDCARD);
+    while (ret_value != FAIL && idx < pal_count)
+    {
+	uint16 tag;
+
+	/* Get tag of this element */
+	ret_value = Hinquire(aid, NULL, &tag, NULL,NULL,NULL,NULL,NULL,NULL);
+	if (ret_value == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	if (tag == DFTAG_IP8 || tag == DFTAG_LUT)
+	{ /* a palette tag is found */
+
+	    /* Get the palette's data info */
+	    ret_value = Hinquire(aid, NULL, &palinfo_array[idx].tag,
+		&palinfo_array[idx].ref, &palinfo_array[idx].length,
+		&palinfo_array[idx].offset, NULL, NULL, NULL);
+	    if (ret_value == FAIL)
+		HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	    /* Move to next element in the array */
+	    idx++;
+	} /* a palette tag is found */
+
+	/* Get next element */
+	ret_value = Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT);
+    } /* get data info of palettes */
+
+    /* Close access id */
+    if (aid != FAIL)
+	if (Hendaccess(aid) == FAIL)
+	    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    ret_value = idx;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if (aid != FAIL)
+          Hendaccess(aid);
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}   /* GRgetpalinfo */
+
+
+/*--------------------------------------------------------------------------
+NAME
+    ANgetdatainfo -- Gets the offset(s) and length(s) locating the data of
+		      the annotation.
+USAGE
+    int32 ANgetdatainfo(ann_id, *offset, *length)	
+	int32  ann_id	IN: annotation ID
+	int32 *offset	OUT: buffer for offset
+	int32 *length	OUT: buffer for length
+RETURNS
+    SUCCEED/FAIL
+
+DESCRIPTION
+    Annotations have contiguous data, so ANgetdatainfo only needs to use
+    Hoffset/Hlength to get the data info of an annotation.
+    
+NOTES
+    Aug 25, 2010: Tested in tdatainfo.c/test_annotation -BMR
+--------------------------------------------------------------------------*/
+intn
+ANgetdatainfo(int32 ann_id,    /* IN: annotation id */
+	int32 *offset,	/* OUT: buffer for offset */
+	int32 *length)	/* OUT: buffer for length */
+{
+    CONSTR(FUNC, "ANgetdatainfo");
+    filerec_t  *file_rec = NULL;		/* file record pointer */
+    ANnode     *ann_node   = NULL;
+    int32       file_id = FAIL;
+    int32       type;
+    int32       ann_key;
+    int         newflag = 0;
+    uint16      ann_tag;
+    uint16      ann_ref;
+    intn        ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Both buffers must be allocated */
+    if (offset == NULL || length == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get annotation record */
+    ann_node = HAatom_object(ann_id);
+    if (NULL == ann_node)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Convert file_id to file rec and check for validity */
+    file_id = ann_node->file_id;
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Get annotation key, type, and ref# */
+    ann_key = ann_node->ann_key;
+    type    = AN_KEY2TYPE(ann_key);
+    ann_ref = AN_KEY2REF(ann_key);
+
+    /* Set type tag */
+    switch((int32)type)
+      {
+      case AN_DATA_LABEL:
+          ann_tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          ann_tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          ann_tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          ann_tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+#ifdef NEED_ELEMENT_TAG_REF
+/* Keep these here just in case we end up need the object's tag/ref -BMR */
+    /* Get annotation entry so that we can get object's tag/ref later */
+    if ((entry = tbbtdfind(file_rec->an_tree[type], &ann_key, NULL)) == NULL)
+	HE_REPORT_GOTO("failed to retrieve annotation of 'type' tree", FAIL);
+
+    ann_entry = (ANentry *) entry->data;
+
+    elem_tag = ann_entry->elmtag;
+    elem_ref = ann_entry->elmref;
+#endif
+
+    /* If annotation exists, try to get offset/length */
+    newflag  = ann_node->new_ann;
+    if (newflag == 0)
+    {
+	int32 off=0, len=0;
+	if (offset != NULL && length != NULL)
+	{
+	    off = Hoffset(file_id, ann_tag, ann_ref);
+	    if (off == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	    len = Hlength(file_id, ann_tag, ann_ref);
+	    if (len == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	    *offset = off;
+	    *length = len;
+	}
+
+	/* Because for Data label/description, the object's tag/ref were
+	written to the file before the annotation data, 4 bytes must be
+	taken into account for them */
+	if (ann_tag == DFTAG_DIL || ann_tag == DFTAG_DIA)
+	{
+	    *offset = *offset + 4;
+	    *length = *length - 4;
+	}
+    }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+      } /* end if */
+    /* Normal function cleanup */
+    return ret_value;
+} /* ANgetdatainfo */
diff --git a/hdf/src/hdatainfo.h b/hdf/src/hdatainfo.h
new file mode 100644
index 0000000..e6744f2
--- /dev/null
+++ b/hdf/src/hdatainfo.h
@@ -0,0 +1,68 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hproto.h 5400 2010-04-22 03:45:32Z bmribler $ */
+
+#ifndef _HDATAINFO_H
+#define _HDATAINFO_H
+
+#include "H4api_adpt.h"
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/* Structure that holds a data descriptor.  First added for GRgetpalinfo. */
+typedef struct hdf_ddinfo_t
+{
+    uint16 tag;
+    uint16 ref;
+    int32 offset;
+    int32 length;
+} hdf_ddinfo_t;
+
+/* Public functions for getting raw data information */
+
+    HDFLIBAPI intn ANgetdatainfo
+		(int32 ann_id, int32 *offset, int32 *length);
+
+    HDFLIBAPI intn HDgetdatainfo
+		(int32 file_id, uint16 data_tag, uint16 data_ref,
+		 int32 *chk_coord, uintn start_block, uintn info_count,
+		 int32 *offsetarray, int32 *lengtharray);
+
+    HDFLIBAPI intn VSgetdatainfo
+		(int32 vsid, uintn start_block, uintn info_count,
+		 int32 *offsetarray, int32 *lengtharray);
+
+    HDFLIBAPI intn VSgetattdatainfo
+		(int32 vsid, int32 findex, intn attrindex, int32 *offset, int32 *length);
+
+    HDFLIBAPI intn Vgetattdatainfo
+		(int32 vgid, intn attrindex, int32 *offset, int32 *length);
+
+    HDFLIBAPI intn GRgetdatainfo
+		(int32 riid, uintn start_block, uintn info_count,
+		 int32 *offsetarray, int32 *lengtharray);
+
+    HDFLIBAPI intn GRgetattdatainfo
+		(int32 id, int32 attrindex, int32 *offset, int32 *length);
+
+    HDFLIBAPI intn GRgetpalinfo(int32 gr_id, uintn pal_count, hdf_ddinfo_t *palinfo_array);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif				/* c_plusplus || __cplusplus */
+#endif                          /* _HDATAINFO */
+
diff --git a/hdf/src/hdf.h b/hdf/src/hdf.h
new file mode 100644
index 0000000..f9fd7ba
--- /dev/null
+++ b/hdf/src/hdf.h
@@ -0,0 +1,172 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hdf.h 5584 2011-04-13 18:25:06Z bmribler $ */
+
+#ifndef HDF_H
+#define HDF_H
+
+#include "h4config.h"
+#include "hdfi.h"
+#include "hlimits.h"
+
+/* Internal DF structure */
+typedef struct
+  {
+      uint16      tag;          /* tag of element */
+      uint16      ref;          /* ref of element */
+  }
+DFdi;
+
+/* For annotations */
+/* enumerated types of the varous annotation types */
+typedef enum 
+{ 
+    AN_UNDEF = -1,
+    AN_DATA_LABEL = 0, /* Data label */
+    AN_DATA_DESC,      /* Data description */
+    AN_FILE_LABEL,     /* File label */
+    AN_FILE_DESC       /* File description */
+} ann_type;
+
+/* internal file access codes */
+
+#define DFACC_READ 1
+#define DFACC_WRITE 2
+#define DFACC_CREATE 4
+#define DFACC_ALL 7
+
+#define DFACC_RDONLY 1
+#define DFACC_RDWR 3
+#define DFACC_CLOBBER 4
+
+/* New file access codes (for Hstartaccess only, currently) */
+#define DFACC_BUFFER 8  /* buffer the access to this AID */
+#define DFACC_APPENDABLE 0x10 /* make this AID appendable */
+#define DFACC_CURRENT 0x20 /* start looking for a tag/ref from the current */
+			   /* location in the DD list (useful for continued */
+			   /* searching ala findfirst/findnext) */
+
+/* External Element File access mode */
+/* #define DFACC_CREATE 4	is for creating new external element file */
+#define DFACC_OLD	1	/* for accessing existing ext. element file */
+
+/* The magic cookie for Hcache to cache all files */
+#define CACHE_ALL_FILES (-2)
+
+/* File access modes */
+/* 001--007 for different serial modes */
+/* 011--017 for different parallel modes */
+
+#define DFACC_DEFAULT   000
+#define DFACC_SERIAL    001
+#define DFACC_PARALLEL  011
+
+/* used by Hnextread to determine where to start searching for the
+   next tag/ref to read */
+
+#define DF_START 0
+#define DF_CURRENT 1
+#define DF_END 2
+
+/* Used by Hfind to determine the direction to search for tag/ref's in the */
+/* file. */
+
+#define DF_FORWARD  1
+#define DF_BACKWARD 2
+
+/* return code - since some unix/c routines use 0 and -1 as their return
+   code, and some assumption had been made in the code about that, it is
+   important to keep these constants the same values.  For explicitly
+   boolean functions, use TRUE and FALSE */
+
+#define SUCCEED 0
+#define FAIL (-1)
+
+/* boolean values,  reminder: NEVER compare with numeric values */
+
+#ifndef FALSE
+#   define FALSE 0
+#endif
+#ifndef TRUE
+#   define TRUE (!FALSE)
+#endif
+
+/* macros */
+#define STREQ(s, t) (HDstrcmp((s), (t)) == 0)
+#define NSTREQ(s, t, n) (HDstrncmp((s), (t), (n)) == 0)
+
+/*
+ * Macros used for variable and function scoping in code.....
+ */
+#ifndef EXPORT
+#define EXPORT
+#endif
+
+#ifndef PRIVATE
+#define PRIVATE static
+#endif
+
+/* Include the Number-type definitions */
+#include "hntdefs.h"
+
+/* Include the Tag definitions */
+#include "htags.h"
+
+/*
+   * interlacing supported by the vset.
+ */
+
+#define FULL_INTERLACE  0
+#define NO_INTERLACE    1
+
+/* Some information about a number type - character strings to be displayed */
+typedef struct hdf_ntinfo_t
+  {
+      char type_name[9];    /* longest possible string "float128" */
+      char byte_order[13];   /* "bigEndian" or "littleEndian" */
+  }
+hdf_ntinfo_t;
+
+/* type for File ID to send to Hlevel from Vxx interface */
+typedef int32 HFILEID;
+
+typedef intn (*hdf_termfunc_t)(void);   /* termination function typedef */
+
+/* .................................................................. */
+
+/* Publically accessible functions declarations.  This includes all the
+   functions that are used by application programs.  */
+
+#include "hbitio.h"
+#include "hcomp.h"
+#include "herr.h"
+#include "hproto.h"
+#include "hdatainfo.h"  /* Add the data info header */
+#include "vg.h"         /* Add the Vgroup/Vdata header so the users don't have to */
+#include "mfgr.h"       /* Add the GR header so the users don't have to */
+
+/* these may eventaully evolve into real-life functions but not yet */
+#define HDFopen(f,a,d)      Hopen((f), (a), (d))
+#define HDFclose(f)         Hclose((f))
+#define Vstart(f)           Vinitialize((f))
+#define Vend(f)             Vfinish((f))
+
+/* Misc. macros for backward compability */
+#define HDgettagname(tag)   HDgettagdesc(tag)
+
+/* This is also defined in fmpio.h */
+#define MP_PAGEALL    0x01  /* page the whole file i.e. no limit on 'maxcache'*/
+
+#endif /* HDF_H */
+
diff --git a/hdf/src/hdf.inc b/hdf/src/hdf.inc
new file mode 100644
index 0000000..b281bbf
--- /dev/null
+++ b/hdf/src/hdf.inc
@@ -0,0 +1,467 @@
+C****************************************************************************
+C* NCSA HDF                                                                 *
+C* Software Development Group                                               *
+C* National Center for Supercomputing Applications                          *
+C* University of Illinois at Urbana-Champaign                               *
+C* 605 E. Springfield, Champaign IL 61820                                   *
+C*                                                                          *
+C* For conditions of distribution and use, see the accompanying             *
+C* hdf/COPYING file.                                                        *
+C*                                                                          *
+C****************************************************************************
+C
+C $Id: hdf.inc 6034 2014-01-19 06:59:14Z epourmal $
+C
+C *-----------------------------------------------------------------------------
+C * File: 	hdf.inc
+C * Purpose:	Fortran header file for HDF routines
+C * Contents: 
+C *     Tag definitions
+C *     Error return codes
+C *    	Logical constants
+C * Remarks: This file can be included with Fortran user programs.  As a
+C *          general rule, don't use DFNT constants that don't include a
+C *          number in their name.  E.g., don't use DFNT_FLOAT, use
+C *          DFNT_FLOAT32 or DFNT_FLOAT64.  The DFNT constants that don't
+C *          include numbers are for backward compatibility only.  Also,
+C *          there are no current plans to support 128-bit number types.
+C *          For more information about constants in this file, see the
+C *          equivalent constant declarations in the C include file 'hdf.h'
+C *------------------------------------------------------------------------
+
+
+C	Error Return Codes 
+
+      integer   DFE_NOERROR,   DFE_NONE,        DFE_FNF   
+      integer   DFE_DENIED,    DFE_ALROPEN,     DFE_TOOMANY
+      integer   DFE_BADNAME,   DFE_BADACC,      DFE_BADOPEN
+      integer   DFE_NOTOPEN,   DFE_CANTCLOSE,   DFE_DFNULL
+      integer   DFE_ILLTYPE,   DFE_UNSUPPORTED, DFE_BADDDLIST
+      integer   DFE_NOTDFFILE, DFE_SEEDTWICE,   DFE_NOSPACE
+      integer   DFE_NOSUCHTAG, DFE_READERROR
+
+      parameter(DFE_NOERROR      =   0)
+      parameter(DFE_NONE         =   0)
+      parameter(DFE_FNF          =  -1)
+      parameter(DFE_DENIED       =  -2)
+      parameter(DFE_ALROPEN      =  -3)
+      parameter(DFE_TOOMANY      =  -4)
+      parameter(DFE_BADNAME      =  -5)
+      parameter(DFE_BADACC       =  -6)
+      parameter(DFE_BADOPEN      =  -7)
+      parameter(DFE_NOTOPEN      =  -8)
+      parameter(DFE_CANTCLOSE    =  -9)
+      parameter(DFE_DFNULL       = -10)
+      parameter(DFE_ILLTYPE      = -11)
+      parameter(DFE_UNSUPPORTED  = -12)
+      parameter(DFE_BADDDLIST    = -13)
+      parameter(DFE_NOTDFFILE    = -14)
+      parameter(DFE_SEEDTWICE    = -15)
+      parameter(DFE_NOSPACE      = -16)
+      parameter(DFE_NOSUCHTAG    = -17)
+      parameter(DFE_READERROR    = -18)
+
+      integer DFE_WRITEERROR,  DFE_SEEKERROR,   DFE_NOFREEDD
+      integer   DFE_BADTAG,      DFE_BADREF,      DFE_RDONLY
+      integer   DFE_BADCALL,     DFE_BADPTR,      DFE_BADLEN
+      integer   DFE_BADSEEK,     DFE_NOMATCH,     DFE_NOTINSET
+      integer   DFE_BADDIM,      DFE_BADOFFSET,   DFE_BADSCHEME
+      integer   DFE_NODIM,       DFE_NOTENOUGH,   DFE_NOVALS
+      integer   DFE_CORRUPT,     DFE_BADFP
+ 
+      parameter(DFE_WRITEERROR           = -19)
+      parameter(DFE_SEEKERROR            = -20)
+      parameter(DFE_NOFREEDD             = -21)
+      parameter(DFE_BADTAG               = -22)
+      parameter(DFE_BADREF               = -23)
+      parameter(DFE_RDONLY               = -24)
+      parameter(DFE_BADCALL              = -25)
+      parameter(DFE_BADPTR               = -26)
+      parameter(DFE_BADLEN               = -27)
+      parameter(DFE_BADSEEK              = -28)
+      parameter(DFE_NOMATCH              = -29)
+      parameter(DFE_NOTINSET             = -30)
+      parameter(DFE_BADDIM               = -31)
+      parameter(DFE_BADOFFSET            = -32)
+      parameter(DFE_BADSCHEME            = -33)
+      parameter(DFE_NODIM                = -34)
+      parameter(DFE_NOTENOUGH            = -35)
+      parameter(DFE_NOVALS               = -36)
+      parameter(DFE_CORRUPT              = -37)
+      parameter(DFE_BADFP                = -38)
+
+      integer DFE_NOREF,       DFE_BADDATATYPE, DFE_BADMCTYPE
+      integer   DFE_BADNUMTYPE,  DFE_BADORDER,    DFE_ARGS
+      integer   DFE_INTERNAL,    DFE_DUPDD,       DFE_CANTMOD
+      integer   DFE_RANGE,       DFE_BADTABLE,    DFE_BADSDG
+      integer   DFE_BADNDG,      DFE_BADFIELDS,   DFE_NORESET
+      integer   DFE_NOVS,        DFE_VGSIZE,      DFE_DIFFFILES
+      integer   DFE_VTAB,        DFE_BADAID
+
+      parameter(DFE_NOREF                = -39)
+      parameter(DFE_BADDATATYPE          = -40)
+      parameter(DFE_BADMCTYPE            = -41)
+      parameter(DFE_BADNUMTYPE           = -42)
+      parameter(DFE_BADORDER             = -43)
+      parameter(DFE_ARGS                 = -44)
+      parameter(DFE_INTERNAL             = -45)
+      parameter(DFE_DUPDD                = -46)
+      parameter(DFE_CANTMOD              = -47)
+      parameter(DFE_RANGE                = -48)
+      parameter(DFE_BADTABLE             = -49)
+      parameter(DFE_BADSDG               = -50)
+      parameter(DFE_BADNDG               = -51)
+      parameter(DFE_BADFIELDS            = -52)
+      parameter(DFE_NORESET              = -53)
+      parameter(DFE_NOVS                 = -54)
+      parameter(DFE_VGSIZE               = -55)
+      parameter(DFE_DIFFFILES            = -56)
+      parameter(DFE_VTAB                 = -57)
+      parameter(DFE_BADAID               = -58)
+
+      integer   DFE_OPENAID, DFE_BADCONV, DFE_GENAPP, DFE_CANTFLUSH
+      integer   DFE_BADTYPE, DFE_SYMSIZE, DFE_BADATTACH
+      integer   DFE_CANTDETACH
+
+      parameter(DFE_OPENAID              = -59)
+      parameter(DFE_BADCONV              = -60)
+      parameter(DFE_GENAPP               = -61)
+      parameter(DFE_CANTFLUSH            = -62)
+      parameter(DFE_BADTYPE              = -63)
+      parameter(DFE_SYMSIZE              = -64)
+      parameter(DFE_BADATTACH            = -65)
+      parameter(DFE_CANTDETACH           = -66)
+
+C internal file access codes
+
+      integer DFACC_READ, DFACC_WRITE, DFACC_CREATE, DFACC_ALL  
+      integer DFACC_RDONLY, DFACC_RDWR, DFACC_CLOBBER
+
+      parameter(DFACC_READ               = 1)
+      parameter(DFACC_WRITE              = 2)
+      parameter(DFACC_CREATE             = 4)
+      parameter(DFACC_ALL                = 7)
+      parameter(DFACC_RDONLY             = 1)
+      parameter(DFACC_RDWR               = 3)
+      parameter(DFACC_CLOBBER            = 4)
+
+C Access types for SDsetaccesstype
+
+      integer DFACC_DEFAULT, DFACC_SERIAL, DFACC_PARALLEL
+      parameter(DFACC_DEFAULT           = 0)
+      parameter(DFACC_SERIAL            = 1)
+      parameter(DFACC_PARALLEL          = 9)
+
+C Constants for DFSDsetorder
+
+      integer DFO_FORTRAN, DFO_C
+ 
+      parameter(DFO_FORTRAN            = 1)
+      parameter(DFO_C                  = 2)
+
+C Definitions of storage convention
+
+      integer DFNTF_IEEE, DFNTF_VAX, DFNTF_CRAY, DFNTF_PC
+      integer   DFNTF_CONVEX, DFNTF_VP
+ 
+      parameter(DFNTF_IEEE             = 1)
+      parameter(DFNTF_VAX              = 2)
+      parameter(DFNTF_CRAY             = 3)
+      parameter(DFNTF_PC               = 4)
+      parameter(DFNTF_CONVEX           = 5)
+      parameter(DFNTF_VP               = 6)
+
+C       Masks for types
+
+      integer   DFNT_HDF, DFNT_NATIVE, DFNT_CUSTOM, DFNT_LITEND
+
+      parameter(DFNT_HDF                 = 0)
+      parameter(DFNT_NATIVE              = 4096)
+      parameter(DFNT_CUSTOM              = 8192)
+      parameter(DFNT_LITEND              = 16384)
+
+C Number type info codes 
+
+      integer DFNT_NONE, DFNT_QUERY, DFNT_VERSION
+ 
+      parameter(DFNT_NONE       = 0)
+      parameter(DFNT_QUERY      = 0)
+      parameter(DFNT_VERSION    = 1)
+      
+      integer   DFNT_FLOAT32, DFNT_FLOAT, DFNT_FLOAT64
+      integer   DFNT_DOUBLE,  DFNT_FLOAT128
+
+      parameter(DFNT_FLOAT32    = 5)
+      parameter(DFNT_FLOAT      = 5)
+      parameter(DFNT_FLOAT64    = 6)
+      parameter(DFNT_DOUBLE     = 6)
+      parameter(DFNT_FLOAT128   = 7)
+
+      integer   DFNT_INT8,  DFNT_UINT8
+      integer   DFNT_INT16, DFNT_UINT16
+      integer   DFNT_INT32, DFNT_UINT32
+      integer   DFNT_INT64, DFNT_UINT64
+      integer   DFNT_INT128,DFNT_UINT128
+ 
+      parameter(DFNT_INT8       = 20)
+      parameter(DFNT_UINT8      = 21)
+      parameter(DFNT_INT16      = 22)
+      parameter(DFNT_UINT16     = 23)
+      parameter(DFNT_INT32      = 24)
+      parameter(DFNT_UINT32     = 25)
+      parameter(DFNT_INT64      = 26)
+      parameter(DFNT_UINT64     = 27)
+      parameter(DFNT_INT128     = 28)
+      parameter(DFNT_UINT128    = 29)
+
+      integer  DFNT_UCHAR8, DFNT_UCHAR, DFNT_CHAR8
+      integer  DFNT_CHAR,   DFNT_CHAR16, DFNT_UCHAR16
+ 
+      parameter(DFNT_UCHAR8     = 3)
+      parameter(DFNT_UCHAR      = 3)
+      parameter(DFNT_CHAR8      = 4)
+      parameter(DFNT_CHAR       = 4)
+      parameter(DFNT_CHAR16     = 42)
+      parameter(DFNT_UCHAR16    = 43)
+
+      integer DFNT_NFLOAT32, DFNT_NFLOAT, DFNT_NFLOAT64
+      integer DFNT_NDOUBLE,  DFNT_NFLOAT128
+
+      parameter(DFNT_NFLOAT32   = 4101)
+      parameter(DFNT_NFLOAT     = 4101)
+      parameter(DFNT_NFLOAT64   = 4102)
+      parameter(DFNT_NDOUBLE    = 4102)
+      parameter(DFNT_NFLOAT128  = 4103)
+
+      integer    DFNT_NINT8,  DFNT_NUINT8
+      integer    DFNT_NINT16, DFNT_NUINT16
+      integer    DFNT_NINT32, DFNT_NUINT32
+      integer    DFNT_NINT64, DFNT_NUINT64
+      integer    DFNT_NINT128,DFNT_NUINT128
+ 
+      parameter(DFNT_NINT8       = 4116)
+      parameter(DFNT_NUINT8      = 4117)
+      parameter(DFNT_NINT16      = 4118)
+      parameter(DFNT_NUINT16     = 4119)
+      parameter(DFNT_NINT32      = 4120)
+      parameter(DFNT_NUINT32     = 4121)
+      parameter(DFNT_NINT64      = 4122)
+      parameter(DFNT_NUINT64     = 4123)
+      parameter(DFNT_NINT128     = 4124)
+      parameter(DFNT_NUINT128    = 4125)
+
+      integer DFNT_NUCHAR8, DFNT_NUCHAR, DFNT_NCHAR8
+      integer DFNT_NCHAR,   DFNT_NCHAR16, DFNT_NUCHAR16
+ 
+      parameter(DFNT_NUCHAR8  = 4099)
+      parameter(DFNT_NUCHAR   = 4099)
+      parameter(DFNT_NCHAR8   = 4100)
+      parameter(DFNT_NCHAR    = 4100)
+      parameter(DFNT_NCHAR16  = 4138)
+      parameter(DFNT_NUCHAR16 = 4139)
+
+      integer DFNT_LFLOAT32, DFNT_LFLOAT, DFNT_LFLOAT64
+      integer DFNT_LDOUBLE,  DFNT_LFLOAT128
+
+      parameter(DFNT_LFLOAT32  = 16389)
+      parameter(DFNT_LFLOAT    = 16389)
+      parameter(DFNT_LFLOAT64  = 16390)
+      parameter(DFNT_LDOUBLE   = 16390)
+      parameter(DFNT_LFLOAT128 = 16391)
+
+      integer   DFNT_LINT8,DFNT_LUINT8,DFNT_LINT16,DFNT_LUINT16
+      integer   DFNT_LINT32,DFNT_LUINT32,DFNT_LINT64,DFNT_LUINT64
+      integer   DFNT_LINT128,DFNT_LUINT128
+ 
+      parameter(DFNT_LINT8      = 16404)
+      parameter(DFNT_LUINT8     = 16405)
+      parameter(DFNT_LINT16     = 16406)
+      parameter(DFNT_LUINT16    = 16407)
+      parameter(DFNT_LINT32     = 16408)
+      parameter(DFNT_LUINT32    = 16409)
+      parameter(DFNT_LINT64     = 16410)
+      parameter(DFNT_LUINT64    = 16411)
+      parameter(DFNT_LINT128    = 16412)
+      parameter(DFNT_LUINT128   = 16413)
+
+      integer DFNT_LUCHAR8, DFNT_LUCHAR, DFNT_LCHAR8
+      integer DFNT_LCHAR,   DFNT_LCHAR16, DFNT_LUCHAR16
+ 
+      parameter(DFNT_LUCHAR8    = 16387)
+      parameter(DFNT_LUCHAR     = 16387)
+      parameter(DFNT_LCHAR8     = 16388)
+      parameter(DFNT_LCHAR      = 16388)
+      parameter(DFNT_LCHAR16    = 16426)
+      parameter(DFNT_LUCHAR16   = 16427)
+
+C tags and refs
+
+      integer DFREF_WILDCARD, DFTAG_WILDCARD, DFTAG_NULL
+      integer DFTAG_LINKED, DFTAG_VERSION, DFTAG_COMPRESSED
+ 
+      parameter(DFREF_WILDCARD  = 0, DFTAG_WILDCARD  = 0)
+      parameter(DFTAG_NULL      = 1, DFTAG_LINKED    = 20)
+      parameter(DFTAG_VERSION   = 30,DFTAG_COMPRESSED = 40)
+
+
+C utility set
+
+      integer DFTAG_FID, DFTAG_FD,  DFTAG_TID, DFTAG_TD
+      integer DFTAG_DIL, DFTAG_DIA, DFTAG_NT,  DFTAG_MT
+ 
+      parameter(DFTAG_FID       = 100, DFTAG_FD        = 101)
+      parameter(DFTAG_TID       = 102, DFTAG_TD        = 103)
+      parameter(DFTAG_DIL       = 104, DFTAG_DIA       = 105)
+      parameter(DFTAG_NT        = 106, DFTAG_MT        = 107)
+
+C  raster-8 set 
+
+      integer DFTAG_ID8, DFTAG_IP8, DFTAG_RI8
+      integer DFTAG_CI8, DFTAG_II8
+ 
+      parameter(DFTAG_ID8       = 200, DFTAG_IP8       = 201)
+      parameter(DFTAG_RI8       = 202, DFTAG_CI8       = 203)
+      parameter(DFTAG_II8       = 204)
+
+C Raster Image set
+
+      integer DFTAG_ID, DFTAG_LUT, DFTAG_RI, DFTAG_CI
+ 
+      parameter(DFTAG_ID        = 300, DFTAG_LUT       = 301)
+      parameter(DFTAG_RI        = 302, DFTAG_CI        = 303)
+
+      integer DFTAG_RIG, DFTAG_LD,  DFTAG_MD, DFTAG_MA
+      integer DFTAG_CCN, DFTAG_CFM, DFTAG_AR
+  
+      parameter(DFTAG_RIG       = 306, DFTAG_LD        = 307)
+      parameter(DFTAG_MD        = 308, DFTAG_MA        = 309)
+      parameter(DFTAG_CCN       = 310, DFTAG_CFM       = 311)
+      parameter(DFTAG_AR        = 312)
+
+      integer DFTAG_DRAW, DFTAG_RUN, DFTAG_XYP, DFTAG_MTO
+ 
+      parameter(DFTAG_DRAW      = 400, DFTAG_RUN       = 401)
+      parameter(DFTAG_XYP       = 500, DFTAG_MTO       = 501)
+
+C Tektronix 
+
+      integer DFTAG_T14, DFTAG_T105
+ 
+      parameter(DFTAG_T14       = 602, DFTAG_T105      = 603)
+
+C Scientific Data set 
+
+      integer   DFTAG_SDG, DFTAG_SDD, DFTAG_SD, DFTAG_SDS, DFTAG_SDL
+      integer   DFTAG_SDU, DFTAG_SDF, DFTAG_SDM, DFTAG_SDC
+      integer   DFTAG_SDT,DFTAG_SDLNK,DFTAG_NDG
+      integer   DFTAG_BREQ,DFTAG_EREQ,DFTAG_CAL, DFTAG_FV
+ 
+      parameter(DFTAG_SDG       = 700, DFTAG_SDD       = 701)
+      parameter(DFTAG_SD        = 702, DFTAG_SDS       = 703)
+      parameter(DFTAG_SDL       = 704, DFTAG_SDU       = 705)
+      parameter(DFTAG_SDF       = 706, DFTAG_SDM       = 707)
+      parameter(DFTAG_SDC       = 708, DFTAG_SDT       = 709)
+      parameter(DFTAG_SDLNK     = 710, DFTAG_NDG       = 720)
+      parameter(DFTAG_CAL       = 731, DFTAG_FV        = 732)
+      parameter(DFTAG_BREQ      = 799, DFTAG_EREQ      = 780)
+
+C VSets 
+
+      integer DFTAG_VG, DFTAG_VH, DFTAG_VS
+ 
+      parameter(DFTAG_VG        = 1965, DFTAG_VH        = 1962)
+      parameter(DFTAG_VS        = 1963)
+
+C compression schemes 
+
+      integer DFTAG_RLE, DFTAG_IMC, DFTAG_IMCOMP, DFTAG_JPEG
+      integer   DFTAG_GREYJPEG
+ 
+      parameter(DFTAG_RLE       =11, DFTAG_IMC       =12)
+      parameter(DFTAG_IMCOMP   =12, DFTAG_JPEG      =13)
+      parameter(DFTAG_GREYJPEG =14)
+
+C SPECIAL CODES 
+
+      integer SPECIAL_LINKED, SPECIAL_EXT
+ 
+      parameter(SPECIAL_LINKED = 1, SPECIAL_EXT = 2)
+
+C PARAMETERS 
+
+      integer DF_MAXFNLEN
+      integer   SD_UNLIMITED
+      integer   SD_DIMVAL_BW_COMP
+      integer   SD_DIMVAL_BW_INCOMP 
+      integer   SD_FILL
+      integer   SD_NOFILL
+
+      parameter(DF_MAXFNLEN     = 256, SD_UNLIMITED    = 0)
+      parameter(SD_DIMVAL_BW_COMP = 1, SD_DIMVAL_BW_INCOMP = 0)
+      parameter(SD_FILL           = 0, SD_NOFILL = 256)
+
+      integer   HDF_VDATA
+      
+      parameter(HDF_VDATA = -1)
+
+C       Standard return codes       
+      integer SUCCEED, FAIL  
+ 
+      parameter(SUCCEED         = 0, FAIL     = -1)
+
+
+C Compression Types 
+
+      integer COMP_NONE, COMP_RLE, COMP_IMCOMP, COMP_JPEG
+
+      parameter(COMP_NONE       = 0, COMP_RLE        = 11)
+      parameter(COMP_IMCOMP     = 12, COMP_JPEG       = 2)
+C
+C       Fortran chunking (SD and GR interfaces) and compression routines use
+C       the following compression types:
+C
+      integer COMP_CODE_NONE, COMP_CODE_RLE, COMP_CODE_NBIT
+      integer COMP_CODE_SKPHUFF, COMP_CODE_DEFLATE
+      integer COMP_CODE_JPEG
+      integer COMP_CODE_SZIP
+      integer SZ_EC_OPTION_MASK, SZ_NN_OPTION_MASK
+      integer COMP_DECODER_ENABLED, COMP_ENCODER_ENABLED
+      parameter (COMP_CODE_NONE = 0)
+      parameter (COMP_CODE_RLE  = 1)
+      parameter (COMP_CODE_NBIT = 2)
+      parameter (COMP_CODE_SKPHUFF = 3)
+      parameter (COMP_CODE_DEFLATE = 4)
+      parameter (COMP_CODE_SZIP = 5)
+      parameter (COMP_CODE_JPEG = 6)
+C
+C     SZIP parameters
+C
+      parameter (SZ_EC_OPTION_MASK = 4)
+      parameter (SZ_NN_OPTION_MASK = 32)
+      parameter (COMP_DECODER_ENABLED = 1)
+      parameter (COMP_ENCODER_ENABLED = 2)
+C
+C Interlace Types 
+
+      integer MFGR_INTERLACE_PIXEL, MFGR_INTERLACE_LINE
+      integer   MFGR_INTERLACE_COMPONENT
+
+      parameter(MFGR_INTERLACE_PIXEL    = 0)
+      parameter(MFGR_INTERLACE_LINE     = 1)
+      parameter(MFGR_INTERLACE_COMPONENT= 2)
+
+      integer FULL_INTERLACE, NO_INTERLACE
+
+      parameter(FULL_INTERLACE = 0, NO_INTERLACE = 1)
+
+C       Vdata fields packing types
+      integer   HDF_VSPACK, HDF_VSUNPACK
+      parameter (HDF_VSPACK   = 0, HDF_VSUNPACK = 1)
+
+C    Multi-file Annotation types
+      integer AN_DATA_LABEL, AN_DATA_DESC, AN_FILE_LABEL, AN_FILE_DESC
+
+      parameter(AN_DATA_LABEL = 0, AN_DATA_DESC  = 1)
+      parameter(AN_FILE_LABEL = 2, AN_FILE_DESC  = 3)
+
+c******************End of hdf.inc***************************
diff --git a/hdf/src/hdfalloc.c b/hdf/src/hdfalloc.c
new file mode 100644
index 0000000..26fb9ec
--- /dev/null
+++ b/hdf/src/hdfalloc.c
@@ -0,0 +1,290 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: hdfalloc.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+#ifdef MALDEBUG
+#define __MALDEBUG__
+#endif
+#include "hdf.h"
+
+/*
+LOCAL ROUTINES
+  None
+EXPORTED ROUTINES
+  HDmemfill    -- copy a chunk of memory repetitively into another chunk
+  HIstrncpy    -- string copy with termination
+  HDmalloc     -- dynamicly allocates memory
+  HDrealloc    -- dynamicly resize (reallocate) memory
+  HDfree       -- free dynamicly allocated memory
+  HDcalloc     -- dynamicly allocates memory and clears it to zero
+  HDstrdup     -- in-library replacement for non-ANSI strdup()
+*/
+
+/*--------------------------------------------------------------------------
+ NAME
+    HDmemfill -- copy a chunk of memory repetitively into another chunk
+
+ USAGE
+    void * HDmemfill(dest,src,item_size,num_items)
+        void * dest;         OUT: pointer to the chunk of memory to be filled
+                            with a pattern
+        void * src;          IN: pointer to the pattern to copy
+        uint32 item_size;   IN: size of the pattern to copy
+        uint32 num_items;   IN: number of times to copy the pattern into the dest
+                            buffer
+
+ RETURNS
+    Returns a pointer to the dest parameter
+
+ DESCRIPTION
+    Common code used to fill a chunk of memory with a pattern.  This
+    routine can be used to copy a given "fill" value into an array
+    of any number type.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    The src and dest pointers are assumed to point to valid portions of
+    memory.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+void *
+HDmemfill(void * dest, const void * src, uint32 item_size, uint32 num_items)
+{
+    uint32      copy_size;      /* size of the buffer to copy */
+    uint32      copy_items;     /* number of items currently copying */
+    uint32      items_left;     /* number of items left to copy */
+    uint8      *curr_dest;      /* ptr into the 'dest' memory where we are currently */
+
+    /* minimal error check for 0 sized array or item size */
+    if (num_items > 0 && item_size > 0)
+      {
+          HDmemcpy(dest, src, item_size);   /* copy first item */
+
+          copy_size = item_size;
+          copy_items = 1;
+          items_left = num_items - 1;
+          curr_dest = ((uint8 *) dest) + item_size;
+
+          /* copy until we've copied at least half of the items */
+          while (items_left >= copy_items)
+            {
+
+                HDmemcpy(curr_dest, dest, copy_size);   /* copy the current chunk */
+                curr_dest += copy_size;     /* move the offset for the next chunk */
+                items_left -= copy_items;   /* decrement the number of items left */
+
+                copy_size *= 2;     /* increase the size of the chunk to copy */
+                copy_items *= 2;    /* increase the count of items we are copying */
+            }   /* end while */
+          if (items_left > 0)   /* if there are any items left to copy */
+              HDmemcpy(curr_dest, dest, items_left * item_size);
+      }     /* end if */
+    return (dest);
+}   /* end HDmemfill() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HIstrncpy -- string copy with termination
+ USAGE
+    char *HIstrncpy(char *dest,char *source,int32 len)
+        char *dest;             OUT: location to place string
+        char *source;           IN: location of string to copy
+        int32 len;              IN: mas. length of dest. string
+ RETURNS
+    dest on success, NULL on failure.
+ DESCRIPTION
+    This function creates a string in dest that is at most 'len' characters
+    long.  The 'len' characters *include* the NULL terminator which must be
+    added.  So if you have the string "Foo\0" you must call this copy function
+    with len == 4.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+    Sep 19, 11 - Changed last argument's type from int32 to intn.  It didn't
+	make sense to have to cast in most places. -BMR
+--------------------------------------------------------------------------*/
+char *
+HIstrncpy(char *dest, const char *source, intn len)
+{
+    char       *destp;
+
+    destp = dest;
+    if (len == 0)
+        return (destp);
+    for (; (len > 1) && (*source != '\0'); len--)
+        *dest++ = *source++;
+    *dest = '\0';   /* Force the last byte be '\0'   */
+    return (destp);
+}   /* end HIstrncpy() */
+/* *INDENT-OFF* */
+/* GNU indent 1.9.1 urps on this section, so turn off indenting for now -QAK */
+
+/* define MALLOC_CHECK to get some more information when malloc/realloc fail */
+#ifdef MALLOC_CHECK
+/*--------------------------------------------------------------------------
+ NAME
+    HDmalloc -- dynamicly allocates memory
+ USAGE
+    void * HDmalloc(qty)
+        uint32 qty;         IN: the (minimum) number of bytes to allocate in
+                                the memory block.
+ RETURNS
+    Pointer to the memory allocated on success, NULL on failure.
+ DESCRIPTION
+    Dynamicly allocates a block of memory and returns a pointer to it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Acts like malloc().
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+void * HDmalloc(uint32 qty)
+{
+    char FUNC[]="HDmalloc";
+    char *p;
+
+    p = (char *) malloc(qty);
+    if (p== (char *) NULL) {
+        HEreport("Attempted to allocate %d bytes", qty);
+        HRETURN_ERROR(DFE_NOSPACE,NULL);
+      } /* end if */
+    return(p);
+}   /* end HDmalloc() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HDrealloc -- dynamicly resize (reallocate) memory
+ USAGE
+    void * HDrealloc(vfp,qty)
+        void * vfp;          IN: pointer to the memory block to resize.
+        uint32 qty;         IN: the (minimum) number of bytes to allocate in
+                                the new memory block.
+ RETURNS
+    Pointer to the memory allocated on success, NULL on failure.
+ DESCRIPTION
+    Dynamicly re-allocates a block of memory and returns a pointer to it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Acts like realloc().
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+void * HDrealloc(void * where, uint32 qty)
+{
+    char FUNC[]="HDrealloc";
+    char *p;
+
+    p = (char *) realloc(where, qty);
+    if (p== (char *) NULL) {
+        HEreport("Attempted to re-allocate %d bytes", qty);
+        HRETURN_ERROR(DFE_NOSPACE,NULL);
+      } /* end if */
+    return(p);
+}   /* end HDrealloc() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HDfree -- free dynamicly allocated memory
+ USAGE
+    void HDfree(vfp)
+        void * vfp;          IN: pointer to the memory block to free.
+ RETURNS
+    NULL?
+ DESCRIPTION
+    Free dynamicly allocated blocks of memory.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Acts like free().
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+void HDfree(void * ptr)
+{
+    if (ptr!=NULL)
+        free(ptr);
+}   /* end HDfree() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HDcalloc -- dynamicly allocates memory and clears it to zero
+ USAGE
+    void * HDcalloc(n,size)
+        uint32 n;         IN: the number of blocks to allocate
+        uint32 size;      IN: the size of the block
+ RETURNS
+    Pointer to the memory allocated on success, NULL on failure.
+ DESCRIPTION
+    Dynamicly allocates a block of memory and returns a pointer to it
+    after setting it to zero.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Acts like calloc().  Instead of doing all the work ourselves, this calls
+    HDmalloc and HDmemset().
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+void *
+HDcalloc(uint32 n, uint32 size)
+{
+    char        FUNC[] = "HDcalloc";
+    void *       p;
+
+    p = HDmalloc(n * size);
+    if (p == NULL)
+      {
+          HEreport("Attempted to allocate %d blocks of %d bytes", (int) n, (int) size);
+          HRETURN_ERROR(DFE_NOSPACE, NULL);
+      }     /* end if */
+    else
+        HDmemset(p, 0, n * size);
+    return (p);
+}   /* end HDcalloc() */
+#endif /* MALLOC_CHECK */
+
+#if defined IBM6000 || defined ANSISUN || defined IRIX
+/*--------------------------------------------------------------------------
+ NAME
+    HDstrdup -- in-library replacement for non-ANSI strdup()
+ USAGE
+    char *HDstrdup(s)
+        const char *s;          IN: pointer to the string to duplicate
+ RETURNS
+    Pointer to the duplicated string, or NULL on failure.
+ DESCRIPTION
+    Duplicates a string (i.e. allocates space and copies it over).
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Acts like strdup().
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+char       *
+HDstrdup(const char *s)
+{
+    char       *ret;
+
+    ret = (char *) HDmalloc((uint32) HDstrlen(s) + 1);
+    if (ret == NULL)
+        return (NULL);
+    HDstrcpy(ret, s);
+    return (ret);
+}   /* end HDstrdup() */
+
+#endif /* macinosh */
diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h
new file mode 100644
index 0000000..e645965
--- /dev/null
+++ b/hdf/src/hdfi.h
@@ -0,0 +1,1308 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hdfi.h 6043 2014-01-21 21:09:03Z acheng $ */
+
+#ifndef HDFI_H
+#define HDFI_H
+
+#ifdef GOT_MACHINE
+#undef GOT_MACHINE
+#endif
+
+/*--------------------------------------------------------------------------*/
+/*                              MT/NT constants                             */
+/*  Four MT nibbles represent double, float, int, uchar (from most          */
+/*      significant to least significant).                                  */
+/*  Each "column" in the "table" below is essentially independant of the    */
+/*      other "columns", for example the CONVEXNATIVE entry means that the  */
+/*      floating point formats are in Convex native format but the integers */
+/*      are big-endian and standard sizes                                   */
+/*  If you add another value to this "table", you need to add another       */
+/*      DFNTF_xxx entry in hntdefs.h                                        */
+/*  The values for each nibble are:                                         */
+/*      1 - Big Endian                                                      */
+/*          (i.e. Big-Endian, 32-bit architecture w/IEEE Floats)            */
+/*      2 - VAX                                                             */
+/*          (i.e. Middle-Endian, 32-bit architecture w/VAX Floats)          */
+/*      3 - Cray                                                            */
+/*          (i.e. Big-Endian, all 64-bit architecture w/Cray Floats)        */
+/*      4 - Little Endian                                                   */
+/*          (i.e. Little-Endian, 32-bit architecture w/IEEE Floats)         */
+/*      5 - Convex                                                          */
+/*          (i.e. Big-Endian, 32-bit architecture w/Convex Native Floats)   */
+/*      6 - Fujitsu VP                                                      */
+/*          (i.e. Big-Endian, 32-bit architecture w/Fujitsu Native Floats)  */
+/*      7 - Cray MPP                                                        */
+/*          (i.e. Big-Endian, 32-bit architecture w/IEEE Floats, but no 16-bit type)            */
+/*      8 - Cray IEEE                                                       */
+/*          (i.e. Big-Endian, all 64-bit architecture w/IEEE Floats)        */
+/*--------------------------------------------------------------------------*/
+#define     DFMT_SUN            0x1111 
+#define     DFMT_SUN_INTEL      0x4441
+#define     DFMT_ALLIANT        0x1111
+#define     DFMT_IRIX           0x1111
+#define     DFMT_APOLLO         0x1111
+#define     DFMT_IBM6000        0x1111
+#define     DFMT_HP9000         0x1111
+#define     DFMT_CONVEXNATIVE   0x5511
+#define     DFMT_CONVEX         0x1111
+#define     DFMT_UNICOS         0x3331
+#define     DFMT_UNICOSIEEE     0x1831
+#define     DFMT_CTSS           0x3331
+#define     DFMT_VAX            0x2221
+#define     DFMT_MIPSEL         0x4441
+#define     DFMT_PC             0x4441
+#define     DFMT_APPLE          0x1111
+#define     DFMT_APPLE_INTEL    0x4441
+#define     DFMT_MAC            0x1111
+#define     DFMT_SUN386         0x4441
+#define     DFMT_NEXT           0x1111
+#define     DFMT_MOTOROLA       0x1111
+#define     DFMT_ALPHA          0x4441
+#define     DFMT_VP             0x6611
+#define     DFMT_I860           0x4441
+#define     DFMT_IA64           0x4441
+#define     DFMT_LINUX64        0x4441
+#define     DFMT_POWERPC64      0x1111
+
+/* I/O library constants */
+#define UNIXUNBUFIO 1
+#define UNIXBUFIO   2
+#define MACIO       3
+
+
+/* Standard header files needed all the time */
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+
+#include "H4api_adpt.h"
+
+
+/*-------------------------------------------------------------------------
+ * Define options for each platform
+ *-------------------------------------------------------------------------*/
+
+/*
+ * Meaning of each defined macros (not completed yet)
+ *
+ * BIG_LONGS--Define when long is not "equal" to int32.  True in cases
+ *      where (int32 *) is not compatible with (long *).  Should
+ *      be renamed as LONGNEINT32.
+ */
+
+#if (defined(SUN) || defined(sun) || defined(__sun__) || defined(__SUNPRO_C)) & !defined(__i386)
+#ifdef __STDC__
+#define ANSISUN
+#else /* __STDC__ */
+#define KNRSUN
+#endif /* __STDC__ */
+#endif /* SUN || sun */
+
+#if defined(ANSISUN)
+
+#if !defined(SUN)
+#define SUN
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <unistd.h>                 /* for some file I/O stuff */
+#include <sys/time.h>
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#if (defined __sun) && (defined __amd64 || defined __i386) /* SunOS on Intel; 32 and 64-bit modes */
+#define DF_MT   DFMT_SUN_INTEL 
+#else
+#define DF_MT   DFMT_SUN
+#endif /* __sun */
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+#ifdef _LP64 /* 64-bit environment */
+typedef int               int32;
+typedef unsigned int      uint32;
+#else /* 32-bit environment */
+typedef long int          int32;
+typedef unsigned long int uint32;
+#endif
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+#ifdef _LP64 /* 64-bit environment */
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#else /* 32-bit environment */
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#endif
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* ANSISUN */
+
+#if defined(KNRSUN)
+
+#if !defined(SUN)
+#define SUN
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#   define BSD
+#define DUMBCC 	/* because it is.  for later use in macros */
+#ifndef __GNUC__
+#include <memory.h>
+#endif /* __GNUC__ */
+#include <unistd.h>
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_SUN
+typedef void              VOID;
+typedef char              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef long int          int32;
+typedef unsigned long int uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+#endif /* SUN */
+
+
+#if defined(IBM6000) || defined(_AIX)
+
+#ifndef IBM6000
+#define IBM6000
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#   define BSD
+
+#ifndef __GNUC__
+#include <memory.h>
+#endif /* __GNUC__ */
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_IBM6000
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+#ifndef _ALL_SOURCE       
+typedef char              int8;
+typedef short int         int16; 
+typedef int               int32;
+#endif  
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef unsigned char     uint8;
+typedef unsigned short int uint16;
+typedef unsigned int      uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef float             float32;
+typedef double            float64;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+#ifdef AIX5L64
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#else /*AIX5L64 */
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#endif /*AIX5L64 */
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* IBM6000 */
+
+#if defined(HP9000) || (!defined(__convexc__) && (defined(hpux) || defined(__hpux)))
+
+#ifndef HP9000
+#define HP9000
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#ifndef HAVE_UNISTD_H
+#define HAVE_UNISTD_H  /* unistd.h - close, fork,..etc */
+#endif
+
+#   define BSD
+#ifndef __GNUC__
+#include <memory.h>
+#endif /* __GNUC__ */
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_HP9000
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+#ifdef _LP64 /* 64-bit environment */
+typedef int               int32;
+typedef unsigned int      uint32;
+#else /* 32-bit environment */
+typedef long int          int32;
+typedef unsigned long int uint32;
+#endif
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef float             float32;
+typedef double            float64;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+#ifdef _LP64 /* 64-bit environment */
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#else /* 32-bit environment */
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#endif
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#endif /* HP9000 */
+
+
+#if defined(IRIX) || defined(IRIS4) || defined(sgi) || defined(__sgi__) || defined(__sgi)
+
+#ifndef IRIX
+#define IRIX
+#endif
+
+#if (_MIPS_SZLONG == 64)
+/* IRIX 64 bits objects.  It is nearly the same as the conventional
+ * 32 bits objects.  Let them share IRIX definitions for now.
+ */
+#define IRIX64
+#endif
+
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE 1
+
+/*
+ * BSD was originally defined with no value.  But some newer SGI system
+ * header files (e.g., resolv.h) assume it has a value and evaluate it
+ * in expressions, thus causing compiling errors.  This has been reported
+ * to SGI as bug #781568.  SGI could not provide a list of the semantics
+ * of BSD values and suggested a work around of setting BSD to 1.
+ */
+#   define BSD 1
+#ifndef __GNUC__
+#include <memory.h>
+#endif /* __GNUC__ */
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT              DFMT_IRIX
+typedef void               VOID;
+typedef void               *VOIDP;
+typedef char               *_fcd;
+typedef signed char        char8;
+typedef unsigned char      uchar8;
+typedef signed char        int8;
+typedef unsigned char      uint8;
+typedef short int          int16;
+typedef unsigned short int uint16;
+typedef int                int32;
+typedef unsigned int       uint32;
+typedef int                intn;
+typedef unsigned int       uintn;
+typedef float              float32;
+typedef double             float64;
+typedef int                intf;     /* size of INTEGERs in Fortran compiler */
+typedef long               hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+/*
+#ifdef IRIX64
+#define BIG_LONGS
+#endif
+*/
+
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* IRIX */
+
+/* CRAY XT3
+ * Note from RedStorm helpdesk,
+ * When I compile a C code with the '-v' option, it indicates that the compile
+ * is done with the macros __QK_USER__ and __LIBCATAMOUNT__ defined.  In
+ * addition, there are other macros like __x86_64__ defined as well, to
+ * indicate processor type.  __QK_USER__ might be a good check for Catamount,
+ * and __x86_64__ might be good for Opteron node.  You might try something
+ * like the following in a header file:
+ */
+#if ((defined(__QK_USER__)) && (defined(__x86_64__)))
+#define __CRAY_XT3__
+#endif
+
+#if defined(CONVEX) || defined(CONVEXNATIVE) || defined(__convexc__)
+
+#ifndef CONVEX
+#define CONVEX
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/types.h>
+#include <sys/stat.h>
+/* For Convex machines with native format floats */
+#ifdef CONVEXNATIVE
+#define DF_MT             DFMT_CONVEXNATIVE
+#else
+#define DF_MT             DFMT_CONVEX
+#endif
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef long int          int32;
+typedef unsigned long int uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef float             float32;
+typedef double            float64;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+#define RIGHT_SHIFT_IS_UNSIGNED
+#define INCLUDES_ARE_ANSI
+#define HAVE_STDC
+
+#endif /* CONVEX */
+
+ 
+#if defined (__APPLE__)
+
+#ifndef __APPLE__
+#define __APPLE__
+#endif
+#ifdef __LITTLE_ENDIAN__
+#define DF_MT DFMT_APPLE_INTEL
+#else
+#define DF_MT DFMT_APPLE
+#endif
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE 1
+
+#ifndef __GNUC__
+#define DUMBCC 	/* because it is.  for later use in macros */
+#endif /* __GNUC__ */
+
+#include <sys/types.h>
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#ifdef __i386
+#ifndef INTEL86
+#define INTEL86   /* we need this Intel define or bad things happen later */
+#endif /* INTEL86 */
+#endif /* __i386 */
+
+typedef void            VOID;
+typedef void            *VOIDP;
+typedef char            *_fcd;
+typedef char            char8;
+typedef unsigned char   uchar8;
+typedef char            int8;
+typedef unsigned char   uint8;
+typedef short           int16;
+typedef unsigned short  uint16;
+typedef int             int32;
+typedef unsigned int    uint32;
+typedef int             intn;
+typedef unsigned int    uintn;
+typedef float           float32;
+typedef double          float64;
+typedef int             intf;     /* size of INTEGERs in Fortran compiler */
+typedef long            hdf_pint_t;   /* an integer the same size as a pointer */
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#endif /* __APPLE__ */
+
+
+
+/* Metrowerks Mac compiler defines some PC stuff so need to exclude this on the Mac */
+#if !(defined (__APPLE__))
+
+#if defined _M_ALPHA || defined _M_X64 || defined _M_IA64 || defined _M_IX86 || defined INTEL86 || defined M_I86 || defined M_I386 || defined DOS386 || defined __i386 || defined UNIX386 || defined i386
+#ifndef INTEL86
+#define INTEL86
+#endif /* INTEL86 */
+
+#if !defined UNIX386 && (defined unix || defined __unix)
+#define UNIX386
+#endif /* UNIX386 */
+
+#if !defined DOS386 && defined M_I386
+#define DOS386
+#endif /* M_I386 && !DOS386 */
+
+#if defined _WINDOWS || defined _WIN32
+#define WIN386
+#endif  /* _WINDOWS | _WIN32 */
+
+#if defined WIN386 || defined DOS386 || defined UNIX386
+#define INTEL386
+#endif /* WIN386 | DOS386 | UNIX386 */
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE 1
+
+#if defined _WINDOWS || defined _WIN32
+#pragma comment( lib, "oldnames" )
+#endif
+
+#include <fcntl.h>
+#ifdef UNIX386
+#include <sys/types.h>      /* for unbuffered file I/O */
+#include <sys/stat.h>
+#include <unistd.h>
+#else /* !UNIX386 */
+#include <sys\types.h>      /* for unbuffered file I/O */
+#include <sys\stat.h>
+#include <io.h>
+#include <conio.h>          /* for debugging getch() calls */
+#include <malloc.h>
+#endif /* UNIX386 */
+#include <ctype.h>          /* for character macros */
+#ifdef __WATCOMC__
+#include <stddef.h>         /* for the 'fortran' pragma */
+#endif
+
+
+#if defined WIN386
+#ifndef GMEM_MOVEABLE       /* check if windows header is already included */
+#include <windows.h>        /* include the windows headers */
+#include <winnt.h>
+#define HAVE_BOOLEAN
+#endif /* GMEM_MOVEABLE */
+#endif /* WIN386 */
+
+#define DF_MT             DFMT_PC
+
+#ifndef VOID    /* The stupid windows.h header file uses a #define instead of a typedef */
+typedef void              VOID;
+#endif  /* end VOID */
+typedef void *            VOIDP;
+typedef char *            _fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef long int          int32;
+typedef unsigned long int uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef float             float32;
+typedef double            float64;
+typedef long              intf;     /* size of INTEGERs in Fortran compiler */
+#ifdef _WIN64
+typedef long long         hdf_pint_t;   /* 8-byte pointer */
+#else
+typedef int               hdf_pint_t;   /* 4-byte pointer */
+#endif /* _WIN64 */
+
+#if defined _M_ALPHA
+#define FNAME_PRE_UNDERSCORE
+#endif
+
+#if defined UNIX386
+#ifdef H4_ABSOFT
+#define FNAME(x) x
+#define DF_CAPFNAMES
+#else
+#define FNAME_POST_UNDERSCORE
+#endif
+#elif defined INTEL386
+#define DF_CAPFNAMES
+#endif
+#define _fcdtocp(desc) (desc)
+
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* INTEL86 */
+#endif /* !(defined(__APPLE__)) */
+
+/*-----------------------------------------------------*/
+#if defined(NEXT) || defined(NeXT)
+
+#ifndef NEXT
+#define NEXT
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#define isascii(c)  (isprint(c) || iscntrl(c))
+#ifndef __GNUC__
+#include <memory.h>
+#endif /* __GNUC__ */
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_NEXT
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef long int          int32;
+typedef unsigned long int uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+
+#endif /* NEXT */
+
+/*-----------------------------------------------------*/
+#if defined(MOTOROLA) || defined(m88k)
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#ifndef __GNUC__
+#include <memory.h>
+#endif /* __GNUC__ */
+#include <unistd.h>
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#ifndef O_RDONLY
+#include <fcntl.h>              /* for unbuffered i/o stuff */
+#endif /*O_RDONLY*/
+#define DF_MT             DFMT_MOTOROLA
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef long int          int32;
+typedef unsigned long int uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#endif /* MOTOROLA */
+
+/*-----------------------------------------------------*/
+#if defined DEC_ALPHA || (defined __alpha && defined __unix__)
+
+#ifndef DEC_ALPHA
+#define DEC_ALPHA
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_ALPHA
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+#ifndef __rpc_types_h
+typedef int               int32;
+typedef unsigned int      uint32;
+#endif /* __rpc_types_h */
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+#endif /* DEC_ALPHA */
+
+/*-----------------------------------------------------*/
+#if defined VP | defined __uxpm__
+
+#ifndef VP
+#define VP
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE 1
+
+#include <memory.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#define DF_MT              DFMT_VP
+typedef void                VOID;
+typedef void               *VOIDP;
+typedef char               *_fcd;
+typedef char               char8;
+typedef unsigned char      uchar8;
+typedef char               int8;
+typedef unsigned char      uint8;
+typedef short int          int16;
+typedef unsigned short int uint16;
+typedef long int           int32;
+typedef unsigned long int  uint32;
+typedef int                intn;
+typedef unsigned int       uintn;
+typedef int                intf;     /* size of INTEGERs in Fortran compiler */
+typedef float              float32;
+typedef double             float64;
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#endif /* VP */
+
+/*-----------------------------------------------------*/
+#if defined I860 | defined i860
+
+#ifndef I860
+#define I860
+#endif
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE 1
+
+#include <sys/types.h>
+#include <sys/file.h>           /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#include <unistd.h>             /* mis-using def. for SEEK_SET, but oh well */
+#define DF_MT   DFMT_I860
+typedef void            VOID;
+typedef void            *VOIDP;
+typedef char            *_fcd;
+typedef char            char8;
+typedef unsigned char   uchar8;
+typedef char            int8;
+typedef unsigned char   uint8;
+typedef short           int16;
+typedef unsigned short  uint16;
+typedef int             int32;
+typedef unsigned int    uint32;
+typedef int             intn;
+typedef unsigned int    uintn;
+typedef float           float32;
+typedef double          float64;
+typedef int             intf;     /* size of INTEGERs in Fortran compiler */
+typedef int               hdf_pint_t;   /* an integer the same size as a pointer */
+#define _fcdtocp(desc) (desc)
+#define FNAME_POST_UNDERSCORE
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#endif /* I860 */
+
+
+/*-----------------------------------------------------*/
+/* Power PC 5 64 */
+#if defined __powerpc64__
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_POWERPC64
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef int               int32;
+typedef unsigned int      uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#if defined __GNUC__
+#define FNAME_POST_UNDERSCORE
+#endif
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+/*-----------------------------------------------------*/
+#endif /*power PC 5 64 */
+/* Linux 64 */
+#if defined(__linux__) && defined __x86_64__  && !(defined  SUN)  /* i.e. 64-bit Linux  but not SunOS on Intel */
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_LINUX64
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef int               int32;
+typedef unsigned int      uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+#endif /*Linux 64 */
+
+/*-----------------------------------------------------*/
+/* 64-bit Free BSD */
+
+#if defined __FreeBSD__ && defined __x86_64__
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_LINUX64
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef int               int32;
+typedef unsigned int      uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+#endif /*64-bit FreeBSD */
+
+/*-----------------------------------------------------*/
+
+/* IA64 running Linux */
+#if defined __ia64 && !(defined(hpux) || defined(__hpux))
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/file.h>               /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT             DFMT_IA64
+typedef void              VOID;
+typedef void              *VOIDP;
+typedef char              *_fcd;
+typedef char              char8;
+typedef unsigned char     uchar8;
+typedef char              int8;
+typedef unsigned char     uint8;
+typedef short int         int16;
+typedef unsigned short int uint16;
+typedef int               int32;
+typedef unsigned int      uint32;
+typedef int               intn;
+typedef unsigned int      uintn;
+typedef int               intf;     /* size of INTEGERs in Fortran compiler */
+typedef float             float32;
+typedef double            float64;
+typedef long              hdf_pint_t;   /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#define FILELIB UNIXBUFIO
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/*  MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS.  See the JPEG docs for details on */
+/*  what each does */
+#define JMEMSYS         MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+#endif /* IA64 */
+
+#ifndef GOT_MACHINE
+No machine type has been defined.  Your Makefile needs to have someing like
+-DSUN or -DUNICOS in order for the HDF internal structures to be defined
+correctly.
+#endif
+
+/*-----------------------------------------------------*/
+/*              encode and decode macros               */
+/*-----------------------------------------------------*/
+
+#   define INT16ENCODE(p, i) \
+{ *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; \
+        *(p) = (uint8)((uintn)(i) & 0xff); (p)++; }
+
+#   define UINT16ENCODE(p, i) \
+{ *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; *(p) = (uint8)((i) & 0xff); (p)++; }
+
+#   define INT32ENCODE(p, i) \
+{ *(p) = (uint8)(((uint32)(i) >> 24) & 0xff); (p)++; \
+        *(p) = (uint8)(((uint32)(i) >> 16) & 0xff); (p)++; \
+        *(p) = (uint8)(((uint32)(i) >> 8) & 0xff); (p)++; \
+        *(p) = (uint8)((uint32)(i) & 0xff); (p)++; }
+
+#   define UINT32ENCODE(p, i) \
+{ *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; \
+        *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \
+        *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \
+        *(p) = (uint8)((i) & 0xff); (p)++; }
+
+#   define NBYTEENCODE(d, s, n) \
+{   HDmemcpy(d,s,n); p+=n }
+
+/* DECODE converts big endian bytes pointed by p to integer values and store
+ * it in i.  For signed values, need to do sign-extension when converting
+ * the 1st byte which carries the sign bit.
+ * The macros does not require i be of a certain byte sizes.  It just requires
+ * i be big enough to hold the intended value range.  E.g. INT16DECODE works
+ * correctly even if i is actually a 64bit int like in a Cray.
+ */
+
+#   define INT16DECODE(p, i) \
+{ (i) = ((*(p) & 0x80) ? ~0xffff : 0x00) | ((int16)(*(p) & 0xff) << 8); (p)++; \
+        (i) |= (int16)((*(p) & 0xff)); (p)++; }
+
+#   define UINT16DECODE(p, i) \
+{ (i) = (uint16)((*(p) & 0xff) << 8); (p)++; \
+        (i) |= (uint16)(*(p) & 0xff); (p)++; }
+
+#   define INT32DECODE(p, i) \
+{ (i) = (int32)(((int32)*(p) & 0x80) ? ~0xffffffff : 0x00) | ((int32)(*(p) & 0xff) << 24); (p)++; \
+        (i) |= ((int32)(*(p) & 0xff) << 16); (p)++; \
+        (i) |= ((int32)(*(p) & 0xff) << 8); (p)++; \
+        (i) |= (*(p) & 0xff); (p)++; }
+
+#   define UINT32DECODE(p, i) \
+{ (i) = ((uint32)(*(p) & 0xff) << 24); (p)++; \
+        (i) |= ((uint32)(*(p) & 0xff) << 16); (p)++; \
+        (i) |= ((uint32)(*(p) & 0xff) << 8); (p)++; \
+        (i) |= (uint32)(*(p) & 0xff); (p)++; }
+
+/* Note! the NBYTEDECODE macro is backwards from the memcpy() routine, */
+/*      in the spirit of the other DECODE macros */
+#   define NBYTEDECODE(s, d, n) \
+{   HDmemcpy(d,s,n); p+=n }
+
+/*----------------------------------------------------------------
+** MACRO FCALLKEYW for any special fortran-C stub keyword
+**
+** Microsoft C and Fortran need __fortran for Fortran callable C
+**  routines.
+**
+** MACRO FRETVAL for any return value from a fortran-C stub function
+**  Replaces the older FCALLKEYW macro.
+**---------------------------------------------------------------*/
+#ifdef FRETVAL
+#undef FRETVAL
+#endif
+
+#ifndef FRETVAL /* !MAC */
+#   define FCALLKEYW    /*NONE*/
+#   define FRETVAL(x)   x
+#endif
+
+
+/*----------------------------------------------------------------
+** MACRO FNAME for any fortran callable routine name.
+**
+**  This macro prepends, appends, or does not modify a name
+**  passed as a macro parameter to it based on the FNAME_PRE_UNDERSCORE,
+**  FNAME_POST_UNDERSCORE macros set for a specific system.
+**
+**---------------------------------------------------------------*/
+#if defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE)
+#   define FNAME(x)     _##x##_
+#endif
+#if defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE)
+#   define FNAME(x)     _##x
+#endif
+#if !defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE)
+#   define FNAME(x)     x##_
+#endif
+#if !defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE)
+#   define FNAME(x)     x
+#endif
+
+/**************************************************************************
+*  Generally useful macro definitions
+**************************************************************************/
+#ifndef MIN
+#define MIN(a,b)    (((a)<(b)) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a,b)    (((a)>(b)) ? (a) : (b))
+#endif
+
+/**************************************************************************
+*  Debugging Allocation functions
+**************************************************************************/
+#ifdef MALDEBUG
+#include "maldebug.h"
+#endif
+
+/**************************************************************************
+*  Macros to work around ANSI C portability problems.
+**************************************************************************/
+#ifdef DUMBCC
+#define CONSTR(v,s) char *v=s
+#else
+#define CONSTR(v,s) static const char v[]=s
+#endif
+
+/* Old-style memory allocation function aliases -QAK */
+#define HDgetspace HDmalloc
+#define HDclearspace HDcalloc
+#define HDregetspace HDrealloc
+#define HDfreespace HDfree
+
+/**************************************************************************
+*  Allocation functions defined differently 
+**************************************************************************/
+#if !defined(MALLOC_CHECK)
+#  define HDmalloc(s)      (malloc((size_t)s))
+#  define HDcalloc(a,b)    (calloc((size_t)a,(size_t)b))
+#  define HDfree(p)        (free((void*)p))
+#  define HDrealloc(p,s)   (realloc((void*)p,(size_t)s))
+#endif /* !defined MALLOC_CHECK */
+/* Macro to free space and clear pointer to NULL */
+#define HDfreenclear(p) { if((p)!=NULL) HDfree(p); p=NULL; }
+
+/**************************************************************************
+*  String functions defined differently 
+**************************************************************************/
+
+#  define HDstrcat(s1,s2)   (strcat((s1),(s2)))
+#  define HDstrcmp(s,t)     (strcmp((s),(t)))
+#  define HDstrcpy(s,d)     (strcpy((s),(d)))
+#  define HDstrlen(s)       (strlen((const char *)(s)))
+#  define HDstrncmp(s1,s2,n)    (strncmp((s1),(s2),(n)))
+#  define HDstrncpy(s1,s2,n)    (strncpy((s1),(s2),(n)))
+#  define HDstrchr(s,c)         (strchr((s),(c)))
+#  define HDstrrchr(s,c)        (strrchr((s),(c)))
+#  define HDstrtol(s,e,b)       (strtol((s),(e),(b)))
+/* non-standard function, not defined on the following machines - */
+#if !(defined IBM6000 || defined ANSISUN )
+#  define HDstrdup(s)      ((char *)strdup((const char *)(s)))
+#endif /* !(etc..) */
+
+
+/**************************************************************************
+*  Memory functions defined differently
+**************************************************************************/
+
+# define HDmemcpy(dst,src,n)   (memcpy((void *)(dst),(const void *)(src),(size_t)(n)))
+# define HDmemset(dst,c,n)     (memset((void *)(dst),(intn)(c),(size_t)(n)))
+# define HDmemcmp(dst,src,n)   (memcmp((const void *)(dst),(const void *)(src),(size_t)(n)))
+
+
+/**************************************************************************
+*  Misc. functions
+**************************************************************************/
+#define HDstat(path, result)	(stat(path, result))
+#define HDgetenv(s1)            (getenv(s1))
+#define HDputenv(s1)            (putenv(s1))
+#define HDltoa(v)               (ltoa(v))
+#if defined (SUN) && defined(__GNUC__)
+#define HDatexit(f)             (0) /* we punt on the SUN using gcc */
+#else /* !SUN & GCC */
+#define HDatexit(f)             (atexit(f))
+#endif /* !SUN & GCC */
+
+/* Compatibility #define for V3.3, should be taken out by v4.0 - QAK */
+#define DFSDnumber DFSDndatasets
+
+#endif /* HDFI_H */
+
diff --git a/hdf/src/herr.c b/hdf/src/herr.c
new file mode 100644
index 0000000..83aa918
--- /dev/null
+++ b/hdf/src/herr.c
@@ -0,0 +1,321 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: herr.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*LINTLIBRARY */
+/* -------------------------------- herr.c -------------------------------- */
+/*
+   HDF error handling / reporting routines
+
+LOCAL ROUTINES
+  None
+EXPORTED ROUTINES
+  HEstring -- return error description
+  HEclear  -- clear the error stack
+  HEpush   -- push an error onto the stack
+  HEreport -- give a more detailed error description
+  HEprint  -- print values from the error stack
+  HEvalue  -- return a error off of the error stack
+ */
+
+#define _H_ERR_MASTER_
+
+#include "hdf.h"
+
+/*
+   ** Include files for variable argument processing for HEreport
+ */
+#include <stdarg.h>
+
+/* We use a stack to hold the errors plus we keep track of the function,
+   file and line where the error occurs. */
+
+/* the structure of the error stack element */
+typedef struct error_t
+  {
+      hdf_err_code_t error_code;    /* Error number */
+      char function_name[FUNC_NAME_LEN];    /* function where error occur */
+      const char *file_name;    /* file where error occur */
+      intn        line;         /* line in file where error occurs */
+      intn        system;       /* for system or HDF error */
+      char       *desc;         /* optional supplied description */
+  }
+error_t;
+
+
+/* pointer to the structure to hold error messages */
+PRIVATE error_t *error_stack = NULL;
+
+#ifndef DEFAULT_MESG
+#   define DEFAULT_MESG "Unknown error"
+#endif
+
+/* size of error message table */
+#define ERRMESG_SZ (sizeof(error_messages) / sizeof(error_messages[0]))
+
+/*------------------------------------------------------------------------
+NAME
+   HEstring -- return error description
+USAGE
+   char * HEstring(error_code)
+   int16  error_code;      IN: the numerical value of this error
+RETURNS
+   An error description string
+DESCRIPTION
+   Return a textual description of the given error.  These strings
+   are statically declared and should not be free()ed by the user.
+   If no string can be found to describe this error a generic
+   default message is returned.
+
+---------------------------------------------------------------------------*/
+const char *
+HEstring(hdf_err_code_t error_code)
+{
+    int         i;              /* temp int index */
+
+    /* look for the error_code in error message table */
+    for (i = 0; i < (int)ERRMESG_SZ; i++)
+        if (error_messages[i].error_code == error_code)
+          {
+            return error_messages[i].str;
+          }
+
+    /* otherwise, return default message */
+    return DEFAULT_MESG;
+} /* HEstring */
+
+/*--------------------------------------------------------------------------
+NAME
+   HEclear -- clear the error stack
+USAGE
+   VOID HEclear(VOID)
+RETURNS
+   NONE
+DESCRIPTION
+   Remove all currently reported errors from the error stack
+
+---------------------------------------------------------------------------*/
+VOID
+HEPclear(void)
+{
+    if (!error_top)
+        goto done;
+
+    /* error_top == 0 means no error in stack */
+    /* clean out old descriptions if they exist */
+    for (; error_top > 0; error_top--)
+      {
+          if (error_stack[error_top - 1].desc)
+            {
+                HDfree(error_stack[error_top - 1].desc);
+                error_stack[error_top - 1].desc = NULL;
+            }
+      }
+
+done:
+  return;
+} /* HEPclear */
+
+/*-------------------------------------------------------------------------
+NAME
+   HEpush -- push an error onto the stack
+USAGE
+   VOID HEpush(error_code, func_name, file_name, line)
+   int16  error_code;      IN: the numerical value of this error
+   char * func_name;       IN: function where the error happened
+   char * file_name;       IN: file name of offending function
+   int    line;            IN: line number of the reporting statment
+RETURNS
+   NONE
+DESCRIPTION
+   push a new error onto stack.  If stack is full, error 
+   is ignored.  assumes that the character strings 
+   (function_name and file_name) referred are in some 
+   semi-permanent storage, so it just saves the pointer 
+   to the strings.  blank out the description field so 
+   that a description is reported  only if REreport is called
+
+---------------------------------------------------------------------------*/
+VOID
+HEpush(hdf_err_code_t error_code, const char *function_name, const char *file_name, intn line)
+{
+    intn        i;
+
+    /* if the stack is not allocated, then do it */
+    if (!error_stack)
+      {
+          error_stack = (error_t *) HDmalloc((uint32) sizeof(error_t) * ERR_STACK_SZ);
+          if (!error_stack)
+            {
+                puts("HEpush cannot allocate space.  Unable to continue!!");
+                exit(8);
+            }
+          for (i = 0; i < ERR_STACK_SZ; i++)
+              error_stack[i].desc = NULL;
+      }
+
+    /* if stack is full, discard error */
+    /* otherwise, push error details onto stack */
+
+    if (error_top < ERR_STACK_SZ)
+      {
+          HDstrcpy(error_stack[error_top].function_name,function_name);
+          error_stack[error_top].file_name = file_name;
+          error_stack[error_top].line = line;
+          error_stack[error_top].error_code = error_code;
+          if (error_stack[error_top].desc)
+            {
+                HDfree(error_stack[error_top].desc);
+                error_stack[error_top].desc = NULL;
+            }
+          error_top++;
+      }
+}   /* HEpush */
+
+/*-------------------------------------------------------------------------
+NAME
+   HEreport -- give a more detailed error description
+USAGE
+   VOID HEreport(format, ....)
+   char * format;           IN: printf style print statement
+RETURNS
+   NONE
+DESCRIPTION
+   Using printf and the variable number of args facility allow the
+   library to specify a more detailed description of a given
+   error condition
+
+---------------------------------------------------------------------------*/
+VOID
+HEreport(const char *format,...)
+{
+    va_list     arg_ptr;
+    char       *tmp;
+    CONSTR(FUNC, "HEreport");   /* name of function if HIalloc fails */
+
+    va_start(arg_ptr, format);
+
+    if ((error_top < ERR_STACK_SZ + 1) && (error_top > 0))
+      {
+          tmp = (char *) HDmalloc(ERR_STRING_SIZE);
+          if (!tmp)
+            {
+                HERROR(DFE_NOSPACE);
+                goto done;
+            }
+          vsprintf(tmp, format, arg_ptr);
+          if (error_stack[error_top - 1].desc)
+              HDfree(error_stack[error_top - 1].desc);
+          error_stack[error_top - 1].desc = tmp;
+      }
+
+    va_end(arg_ptr);
+
+done:
+    return;
+} /* HEreport */
+
+/*-------------------------------------------------------------------------
+NAME
+   HEprint -- print values from the error stack
+USAGE
+   VOID HEprint(stream, levels)
+   FILE * stream;      IN: file to print error message to
+   int32  level;       IN: level at which to start printing
+RETURNS
+   NONE
+DESCRIPTION
+   Print part of the error stack to a given file.  If level == 0
+   the entire stack is printed.  If an extra description has been
+   added (via HEreport) it is printed too.
+
+---------------------------------------------------------------------------*/
+VOID
+HEprint(FILE * stream, int32 print_levels)
+{
+    if (print_levels == 0 || print_levels > error_top)  /* print all errors */
+        print_levels = error_top;
+
+    /* print the errors starting from most recent */
+    for (print_levels--; print_levels >= 0; print_levels--)
+      {
+          fprintf(stream, "HDF error: (%d) <%s>\n\tDetected in %s() [%s line %d]\n",
+                  error_stack[print_levels].error_code,
+                  HEstring(error_stack[print_levels].error_code),
+                  error_stack[print_levels].function_name,
+                  error_stack[print_levels].file_name,
+                  error_stack[print_levels].line);
+          if (error_stack[print_levels].desc)
+              fprintf(stream, "\t%s\n", error_stack[print_levels].desc);
+      }
+} /* HEprint */
+
+/* ------------------------------- HEvalue -------------------------------- */
+/*
+
+   NAME
+   HEvalue -- return a error off of the error stack
+   USAGE
+   int16 HEvalue(level)
+   int32 level;           IN: level of the error stack to return
+   RETURNS
+   Error code or DFE_NONE if no error
+   DESCRIPTION
+   Return the error code of a single error out of the error stack
+
+   --------------------------------------------------------------------------- */
+int16
+HEvalue(int32 level)
+{
+  int16 ret_value = DFE_NONE;
+
+  if (level > 0 && level <= error_top)
+    ret_value = (int16) error_stack[error_top - level].error_code;
+  else
+    ret_value = DFE_NONE;
+
+  return ret_value;
+} /* HEvalue */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HEshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn HEshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the HE routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn HEshutdown(void)
+{
+    if(error_stack!=NULL)
+      {
+          HDfree(error_stack);
+          error_stack=NULL;
+      } /* end if */
+    return(SUCCEED);
+} /* end HEshutdown() */
+
diff --git a/hdf/src/herr.h b/hdf/src/herr.h
new file mode 100644
index 0000000..52d7dae
--- /dev/null
+++ b/hdf/src/herr.h
@@ -0,0 +1,485 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: herr.h 5759 2012-01-19 22:34:47Z byrn $ */
+
+/*+ herr.h
+   ***  header file for using error routines
+   *** to be included by all ".c" files
+   + */
+
+#ifndef __HERR_H
+#define __HERR_H
+
+/* if these symbols are not provided by the compiler, we'll have to
+   fake them.  These are used in HERROR for recording location of
+   error in code. */
+
+#ifndef __FILE__
+#   define __FILE__ "File name not supported"
+#endif
+#ifndef __LINE__
+#   define __LINE__ 0
+#endif
+
+/* HERROR macro, used to facilitate error reporting.  Assumes that
+   there's a variable called FUNC which holds the function name.
+   Assume that func and file are both stored in static space, or at
+   least be not corrupted in the meanwhile. */
+
+#define HERROR(e) HEpush(e, FUNC, __FILE__, __LINE__)
+
+/* HRETURN_ERROR macro, used to facilitate error reporting.  Makes
+   same assumptions as HERROR.  IN ADDITION, this macro causes
+   a return from the calling routine */
+
+#define HRETURN_ERROR(err, ret_val) {HERROR(err); return(ret_val);}
+
+/* HCLOSE_RETURN_ERROR macro, used to facilitate error reporting.  Makes
+   same assumptions as HRETURN_ERROR.  IN ADDITION, this macro causes
+   the file specified by the id "fid" to be closed */
+
+#define HCLOSE_RETURN_ERROR(hfid, err, ret_val) {HERROR(err); Hclose(hfid); \
+                                                return(ret_val);}
+
+/* HGOTO_ERROR macro, used to facilitate error reporting.  Makes
+   same assumptions as HERROR.  IN ADDITION, this macro causes
+   a jump to the label 'done' which should be in every fucntion
+   Also there is an assumption of a variable 'ret_value' */
+
+#define HGOTO_ERROR(err, ret_val) {HERROR(err); ret_value = ret_val; \
+                                   goto done;}
+
+/* HCLOSE_RETURN_ERROR macro, used to facilitate error reporting.  Makes
+   same assumptions as HRETURN_ERROR.  IN ADDITION, this macro causes
+   the file specified by the id "fid" to be closed 
+   Also , this macro causes a jump to the label 'done' which should 
+   be in every fucntion. There is an assumption of a variable 'ret_value' */
+
+#define HCLOSE_GOTO_ERROR(hfid, err, ret_val) {HERROR(err); Hclose(hfid); \
+                                            ret_value = ret_val; goto done;}
+
+/* HGOTO_DONE macro, used to facilitate the new error reporting model.  
+   This macro is just a wrapper to set the return value and jump to the 'done'
+   label.  Also assumption of a variable 'ret_value' */
+
+#define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;}
+
+/* For further error reporting */
+#define HE_REPORT(msg) HEreport(msg)
+#define HE_REPORT_RETURN(msg, ret_val) { HEreport(msg); return(ret_val); }
+#define HE_CLOSE_REPORT_RETURN(hfid,msg, ret_val) { HEreport(msg); \
+                                                    Hclose(hfid); \
+                                                    return(ret_val);}
+
+#define HE_REPORT_GOTO(msg, ret_val) { HEreport(msg); ret_value = ret_val; \
+                                       goto done;}
+#define HE_CLOSE_REPORT_GOTO(hfid,msg, ret_val) { HEreport(msg); \
+                                                  Hclose(hfid); \
+                                                  ret_value = ret_val; \
+                                                  goto done;}
+
+
+/* always points to the next available slot; the last error record is in slot (top-1) */
+#if defined(H4_BUILT_AS_DYNAMIC_LIB)
+#ifdef _H_ERR_MASTER_
+#if defined _WIN32 && defined hdf_EXPORTS
+__declspec(dllexport)
+#endif
+#else
+HDFERRPUBLIC
+#endif /* _H_ERR_MASTER_ */
+int32       error_top
+#ifdef _H_ERR_MASTER_
+= 0
+#endif /* _H_ERR_MASTER_ */
+;
+#else /* defined(H4_BUILT_AS_DYNAMIC_LIB) */
+#ifndef _H_ERR_MASTER_
+#if defined _WIN32 && defined HDFAPDLL
+__declspec(dllimport)
+#else
+HDFERRPUBLIC
+#endif
+#else
+#if defined _WIN32 && defined HDFLIBDLL
+__declspec(dllexport)
+#endif
+#endif /* _H_ERR_MASTER_ */
+int32       error_top
+#ifdef _H_ERR_MASTER_
+= 0
+#endif /* _H_ERR_MASTER_ */
+;
+#endif /* defined(H4_BUILT_AS_DYNAMIC_LIB) */
+
+/* Macro to wrap around calls to HEPclear, so it doesn't get called zillions of times */
+#define HEclear() {if(error_top!=0) HEPclear(); }
+
+/*
+   ======================================================================
+   Error codes
+
+   NOTE: Remember to update the error_messages[] structure in herr.c
+   whenever errors are added/deleted from this list.
+   ======================================================================
+ */
+/* Declare an enumerated type which holds all the valid HDF error codes */
+typedef enum
+  {
+      DFE_NONE = 0,             /* special zero, no error */
+/* Low-level I/O errors */
+      DFE_FNF,                  /* File not found */
+      DFE_DENIED,               /* Access to file denied */
+      DFE_ALROPEN,              /* File already open */
+      DFE_TOOMANY,              /* Too Many AID's or files open */
+      DFE_BADNAME,              /* Bad file name on open */
+      DFE_BADACC,               /* Bad file access mode */
+      DFE_BADOPEN,              /* Other open error */
+      DFE_NOTOPEN,              /* File can't be closed 'cause it isn't open */
+      DFE_CANTCLOSE,            /* fclose wouldn't work! */
+      DFE_READERROR,            /* There was a read error */
+      DFE_WRITEERROR,           /* There was a write error */
+      DFE_SEEKERROR,            /* There was a seek error */
+      DFE_RDONLY,               /* The DF is read only */
+      DFE_BADSEEK,              /* Attempt to seek past end of element */
+
+/* Low-level HDF I/O errors */
+      DFE_PUTELEM,              /* Hputelement failed in some way */
+      DFE_GETELEM,              /* Hgetelement failed in some way */
+      DFE_CANTLINK,             /* Can't initialize link information */
+      DFE_CANTSYNC,             /* Cannot syncronize memory with file */
+
+/* Old group interface errors */
+      DFE_BADGROUP,             /* Error from DFdiread in opening a group */
+      DFE_GROUPSETUP,           /* Error from DFdisetup in opening a group */
+      DFE_PUTGROUP,             /* Error when putting a tag/ref into a group */
+      DFE_GROUPWRITE,           /* Error when writing out a group */
+
+/* Internal HDF errors */
+      DFE_DFNULL,               /* DF is a null pointer */
+      DFE_ILLTYPE,              /* DF has an illegal type: internal error */
+      DFE_BADDDLIST,            /* The DD list is non-existent: internal error */
+      DFE_NOTDFFILE,            /* This is not a DF file and it is not 0 length */
+      DFE_SEEDTWICE,            /* The DD list already seeded: internal error */
+      DFE_NOSUCHTAG,            /* No such tag in the file: search failed */
+      DFE_NOFREEDD,             /* There are no free DD's left: internal error */
+      DFE_BADTAG,               /* illegal WILDCARD tag */
+      DFE_BADREF,               /* illegal WILDCARD reference # */
+      DFE_NOMATCH,              /* No (more) DDs which match specified tag/ref */
+      DFE_NOTINSET,             /* Warning: Set contained unknown tag: ignored */
+      DFE_BADOFFSET,            /* Illegal offset specified */
+      DFE_CORRUPT,              /* File is corrupted */
+      DFE_NOREF,                /* no more reference numbers are available */
+      DFE_DUPDD,                /* the new tag/ref is already used */
+      DFE_CANTMOD,              /* old element not exist, cannot modify */
+      DFE_DIFFFILES,            /* Attempt to merge objs in diff files */
+      DFE_BADAID,               /* Got a bogus aid */
+      DFE_OPENAID,              /* There are still active AIDs */
+      DFE_CANTFLUSH,            /* Can't flush DD back to file */
+      DFE_CANTUPDATE,           /* Cannot update the DD block */
+      DFE_CANTHASH,             /* Cannot add a DD to the hash table */
+      DFE_CANTDELDD,            /* Cannot delete a DD in the file */
+      DFE_CANTDELHASH,          /* Cannot delete a DD from the hash table */
+      DFE_CANTACCESS,           /* Cannot access specified tag/ref */
+      DFE_CANTENDACCESS,        /* Cannot end access to data element */
+      DFE_TABLEFULL,            /* Access table is full */
+      DFE_NOTINTABLE,           /* Cannot find element in table */
+
+/* Generic errors */
+      DFE_UNSUPPORTED,          /* Feature not currently supported */
+      DFE_NOSPACE,              /* Malloc failed */
+      DFE_BADCALL,              /* Calls in wrong order */
+      DFE_BADPTR,               /* NULL ptr argument */
+      DFE_BADLEN,               /* Invalid len specified */
+      DFE_NOTENOUGH,            /* space provided insufficient for size of data */
+      DFE_NOVALS,               /* Values not available */
+      DFE_ARGS,                 /* bad arguments to routine */
+      DFE_INTERNAL,             /* serious internal error */
+      DFE_NORESET,              /* Too late to modify this value */
+      DFE_GENAPP,               /* Generic application,level error */
+
+/* Generic interface errors */
+      DFE_UNINIT,               /* Interface was not initialized correctly */
+      DFE_CANTINIT,             /* Can't initialize an interface we depend on */
+      DFE_CANTSHUTDOWN,         /* Can't shut down an interface we depend on */
+
+/* General Dataset errors */
+      DFE_BADDIM,               /* negative or zero dimensions specified */
+      DFE_BADFP,                /* File contained an illegal floating point num */
+      DFE_BADDATATYPE,          /* unknown or unavailable data type specified */
+      DFE_BADMCTYPE,            /* unknown or unavailable machine type specified */
+      DFE_BADNUMTYPE,           /* unknown or unavailable number type specified */
+      DFE_BADORDER,             /* unknown or illegal array order specified */
+      DFE_RANGE,                /* improper range for attempted acess */
+      DFE_BADCONV,              /* Don't know how to convert data type */
+      DFE_BADTYPE,              /* Incompatible types specified */
+      DFE_NOVGREP,              /* No Vgroup representation for SDS and dim */
+
+/* Compression errors */
+      DFE_BADSCHEME,            /* Unknown compression scheme specified */
+      DFE_BADMODEL,             /* Invalid compression model specified */
+      DFE_BADCODER,             /* Invalid compression encoder specified */
+      DFE_MODEL,                /* Error in modeling layer of compression */
+      DFE_CODER,                /* Error in encoding layer of compression */
+      DFE_CINIT,                /* Error in encoding initialization */
+      DFE_CDECODE,              /* Error in decoding compressed data */
+      DFE_CENCODE,              /* Error in encoding compressed data */
+      DFE_CTERM,                /* Error in encoding termination */
+      DFE_CSEEK,                /* Error seekging in encoded dataset */
+      DFE_MINIT,                /* Error in modeling initialization */
+      DFE_COMPINFO,             /* Invalid compression header */
+      DFE_CANTCOMP,             /* Can't compress an object */
+      DFE_CANTDECOMP,           /* Can't de-compress an object */
+      DFE_NOENCODER,            /* Encoder not available */
+      DFE_NOSZLIB,              /* SZIP library not available */
+      DFE_COMPVERSION,          /* Z_VERSION_ERROR (-6) returned from zlib */
+      DFE_READCOMP,             /* Error in reading compressed data; this
+                                   error occurs when one of the following
+                                   error codes is returned from zlib:
+                                        Z_ERRNO         (-1)
+                                        Z_STREAM_ERROR  (-2)
+                                        Z_DATA_ERROR    (-3)
+                                        Z_MEM_ERROR     (-4)
+                                        Z_BUF_ERROR     (-5) */
+
+/* Raster errors */
+      DFE_NODIM,                /* No dimension record associated with image */
+      DFE_BADRIG,               /* Error processing a RIG */
+      DFE_RINOTFOUND,           /* Can't find raster image */
+      DFE_BADATTR,              /* Bad Attribute */
+      DFE_LUTNOTFOUND,          /* No palette information for RIG */
+      DFE_GRNOTFOUND,           /* Can't find specified GR */
+
+/* SDG/NDG errors */
+      DFE_BADTABLE,             /* the nsdg table is wrong */
+      DFE_BADSDG,               /* error processing an sdg */
+      DFE_BADNDG,               /* error processing an ndg */
+
+/* Vset errors */
+      DFE_VGSIZE,               /* Too many elements in VGroup */
+      DFE_VTAB,                 /* Elmt not in vtab[] */
+      DFE_CANTADDELEM,          /* Cannot add tag/ref to VGroup */
+      DFE_BADVGNAME,            /* Cannot set VGroup name */
+      DFE_BADVGCLASS,           /* Cannot set VGroup class */
+
+/* Vdata errors */
+      DFE_BADFIELDS,            /* Bad fields string passed to Vset routine */
+      DFE_NOVS,                 /* Counldn't find VS in file */
+      DFE_SYMSIZE,              /* Too many symbols in users table */
+      DFE_BADATTACH,            /* Cannot write to a previously attached VData */
+      DFE_BADVSNAME,            /* Cannot set VData name */
+      DFE_BADVSCLASS,           /* Cannot set VData class */
+      DFE_VSWRITE,              /* Error writing to VData */
+      DFE_VSREAD,               /* Error reading from VData */
+      DFE_BADVH,                /* Error in VData Header */
+      DFE_FIELDSSET,            /* Fields already set for vdata */
+/* High-level Vdata/Vset errors */
+      DFE_VSCANTCREATE,         /* Cannot create VData */
+      DFE_VGCANTCREATE,         /* Cannot create VGroup */
+
+/* Generic Vdata/Vset errors */
+      DFE_CANTATTACH,           /* Cannot attach to a VData/Vset */
+      DFE_CANTDETACH,           /* Cannot detach a VData/Vset with access 'w' */
+
+/* bit I/O errors */
+      DFE_BITREAD,              /* There was a bit-read error */
+      DFE_BITWRITE,             /* There was a bit-write error */
+      DFE_BITSEEK,              /* There was a bit-seek error */
+
+/* tbbt interface errors */
+      DFE_TBBTINS,              /* Failed to insert element into tree */
+
+/* bit-vector interface errors */
+      DFE_BVNEW,                /* Failed to create a bit-vector */
+      DFE_BVSET,                /* Failed when setting a bit in a bit-vector */
+      DFE_BVGET,                /* Failed when getting a bit in a bit-vector */
+      DFE_BVFIND                /* Failed when finding a bit in a bit-vector */
+  }
+hdf_err_code_t;
+
+#ifdef _H_ERR_MASTER_
+
+/* error_messages is the list of error messages in the system, kept as
+   error_code-message pairs.  To look up a message, a linear search is
+   required but efficiency should be okay. */
+
+typedef struct error_messages_t
+  {
+      hdf_err_code_t error_code;
+      const char *str;
+  }
+error_messages_t;
+
+PRIVATE const struct error_messages_t error_messages[] =
+{
+    {DFE_NONE,          "No error"},
+/* Low-level I/O errors */
+    {DFE_FNF,           "File not found"},
+    {DFE_DENIED,        "Access to file denied"},
+    {DFE_ALROPEN,       "File already open"},
+    {DFE_TOOMANY,       "Too Many AID's or files open"},
+    {DFE_BADNAME,       "Bad file name on open"},
+    {DFE_BADACC,        "Bad file access mode"},
+    {DFE_BADOPEN,       "Error opening file"},
+    {DFE_NOTOPEN,       "File can't be closed; It isn't open"},
+    {DFE_CANTCLOSE,     "Unable to close file"},
+    {DFE_READERROR,     "Read error"},
+    {DFE_WRITEERROR,    "Write error"},
+    {DFE_SEEKERROR,     "Error performing seek operation"},
+    {DFE_RDONLY,        "Attempt to write to read-only HDF file"},
+    {DFE_BADSEEK,       "Attempt to seek past end of element"},
+
+/* Low-level HDF I/O errors */
+    {DFE_PUTELEM,       "Hputelement failed in some way"},
+    {DFE_GETELEM,       "Hgetelement failed in some way"},
+    {DFE_CANTLINK,      "Can't initialize link information"},
+    {DFE_CANTSYNC,      "Cannot syncronize memory with file"},
+
+/* Old group interface errors */
+    {DFE_BADGROUP,      "Error from DFdiread in opening a group"},
+    {DFE_GROUPSETUP,    "Error from DFdisetup in opening a group"},
+    {DFE_PUTGROUP,      "Error when putting a tag/ref into a group"},
+    {DFE_GROUPWRITE,    "Error when writing out a group"},
+
+/* Internal HDF errors */
+    {DFE_DFNULL,        "DF has a null pointer"},
+    {DFE_ILLTYPE,       "Internal error: DF has an illegal type"},
+    {DFE_BADDDLIST,     "Internal error: The DD list is non-existent"},
+    {DFE_NOTDFFILE,     "This is not an HDF file"},
+    {DFE_SEEDTWICE,     "Internal error: The DD list is already seeded"},
+    {DFE_NOSUCHTAG,     "No such tag in the file: search failed"},
+    {DFE_NOFREEDD,      "There are no free DD's left"},
+    {DFE_BADTAG,        "Illegal WILDCARD tag"},
+    {DFE_BADREF,        "Illegal WILDCARD reference"},
+    {DFE_NOMATCH,       "No (more) DDs which match specified tag/ref"},
+    {DFE_NOTINSET,      "Set contained unknown tag: ignored"},
+    {DFE_BADOFFSET,     "Illegal offset specified"},
+    {DFE_CORRUPT,       "File is corrupted"},
+    {DFE_NOREF,         "No more reference numbers are available"},
+    {DFE_DUPDD,         "Tag/ref is already used"},
+    {DFE_CANTMOD,       "Old element does not exist, cannot modify"},
+    {DFE_DIFFFILES,     "Attempt to merge objects in different files"},
+    {DFE_BADAID,        "Unable to create a new AID"},
+    {DFE_OPENAID,       "There are still active AIDs"},
+    {DFE_CANTFLUSH,     "Cannot flush the changed DD back to the file"},
+    {DFE_CANTUPDATE,    "Cannot update the DD block"},
+    {DFE_CANTHASH,      "Cannot add a DD to the hash table"},
+    {DFE_CANTDELDD,     "Cannot delete a DD in the file"},
+    {DFE_CANTDELHASH,   "Cannot delete a DD from the hash table"},
+    {DFE_CANTACCESS,    "Cannot access specified tag/ref"},
+    {DFE_CANTENDACCESS, "Cannot end access to data element"},
+    {DFE_TABLEFULL,     "Access table is full"},
+    {DFE_NOTINTABLE,    "Cannot find element in table"},
+
+/* Generic errors */
+    {DFE_UNSUPPORTED,   "Feature not currently supported"},
+    {DFE_NOSPACE,       "Internal error: Out of space"},
+    {DFE_BADCALL,       "Calls in wrong order"},
+    {DFE_BADPTR,        "NULL ptr argument"},
+    {DFE_BADLEN,        "Invalid length specified"},
+    {DFE_NOTENOUGH,     "Space provided insufficient for size of data"},
+    {DFE_NOVALS,        "Values not available"},
+    {DFE_ARGS,          "Invalid arguments to routine"},
+    {DFE_INTERNAL,      "HDF Internal error"},
+    {DFE_NORESET,       "Can not reset this value"},
+    {DFE_GENAPP,        "Generic application-level error"},
+
+/* Generic interface errors */
+    {DFE_UNINIT,        "Interface was not initialized correctly"},
+    {DFE_CANTINIT,      "Can't initialize an interface we depend on"},
+    {DFE_CANTSHUTDOWN,  "Can't shut down an interface we depend on"},
+
+/* Dataset errors */
+    {DFE_BADDIM,        "Negative or zero dimensions specified"},
+    {DFE_BADFP,         "File contained an illegal floating point number"},
+    {DFE_BADDATATYPE,   "Unknown or unavailable data type specified"},
+    {DFE_BADMCTYPE,     "Unknown or unavailable machine type specified"},
+    {DFE_BADNUMTYPE,    "Unknown or unavailable number type specified"},
+    {DFE_BADORDER,      "Unknown or illegal array order specified"},
+    {DFE_RANGE,         "Improper range for attempted access"},
+    {DFE_BADCONV,       "Don't know how to convert data type"},
+    {DFE_BADTYPE,       "Incompatible type specified"},
+
+/* Compression errors */
+    {DFE_BADSCHEME,     "Unknown compression scheme specified"},
+    {DFE_BADMODEL,      "Invalid compression model specified"},
+    {DFE_BADCODER,      "Invalid compression coder specified"},
+    {DFE_MODEL,         "Error in modeling layer of compression"},
+    {DFE_CODER,         "Error in encoding layer of compression"},
+    {DFE_CINIT,         "Error in encoding initialization"},
+    {DFE_CDECODE,       "Error in decoding compressed data"},
+    {DFE_CENCODE,       "Error in encoding compressed data"},
+    {DFE_CTERM,         "Error in encoding termination"},
+    {DFE_CSEEK,         "Error seeking in encoded dataset"},
+    {DFE_MINIT,         "Error in modeling initialization"},
+    {DFE_COMPINFO,      "Invalid compression header"},
+    {DFE_CANTCOMP,      "Can't compress an object"},
+    {DFE_CANTDECOMP,    "Can't de-compress an object"},
+    {DFE_NOENCODER,     "Encoder not available"},
+
+/* Raster errors */
+    {DFE_NODIM,         "No dimension record associated with image"},
+    {DFE_BADRIG,        "Error processing a RIG"},
+    {DFE_RINOTFOUND,    "Can't find raster image"},
+    {DFE_BADATTR,       "Bad Attribute"},
+    {DFE_LUTNOTFOUND,   "No palette information for RIG"},
+
+/* SDG/NDG errors */
+    {DFE_BADTABLE,      "The nsdg table is wrong"},
+    {DFE_BADSDG,        "Error processing an sdg"},
+    {DFE_BADNDG,        "Error processing an ndg"},
+
+/* Vset errors */
+    {DFE_VGSIZE,        "No more elements will fit in this VGroup"},
+    {DFE_VTAB,          "Element is not in VSet tables"},
+    {DFE_CANTADDELEM,   "Cannot add tag/ref to VGroup"},
+    {DFE_BADVGNAME,     "Cannot set VGroup name"},
+    {DFE_BADVGCLASS,    "Cannot set VGroup class"},
+
+/* Vdata errors */
+    {DFE_BADFIELDS,     "Unable to parse fields string correctly"},
+    {DFE_NOVS,          "Could not find specified VS or VG in file"},
+    {DFE_SYMSIZE,       "Too many symbols in table"},
+    {DFE_BADATTACH,     "Cannot write to a previously attached VData"},
+    {DFE_BADVSNAME,     "Cannot set VData name"},
+    {DFE_BADVSCLASS,    "Cannot set VData class"},
+    {DFE_VSWRITE,       "Error writing to VData"},
+    {DFE_VSREAD,        "Error reading from VData"},
+    {DFE_FIELDSSET,     "Fields already set for vdata"},
+
+/* High-level Vdata/Vset errors */
+    {DFE_VSCANTCREATE,  "Cannot create VData"},
+    {DFE_VGCANTCREATE,  "Cannot create VGroup"},
+
+/* Generic Vdata/Vset errors */
+    {DFE_CANTATTACH,    "Cannot attach to a VData"},
+    {DFE_CANTDETACH,    "Cannot detach a VData with access 'w'"},
+
+/* bit I/O errors */
+    {DFE_BITREAD,       "There was a bit-read error"},
+    {DFE_BITWRITE,      "There was a bit-write error"},
+    {DFE_BITSEEK,       "There was a bit-seek error"},
+
+/* tbbt interface errors */
+    {DFE_TBBTINS,       "Failed to insert element into tree"},
+
+/* bit-vector interface errors */
+    {DFE_BVNEW,         "Failed to create a bit-vector"},
+    {DFE_BVSET,         "Failed when setting a bit in a bit-vector"},
+    {DFE_BVGET,         "Failed when getting a bit in a bit-vector"},
+    {DFE_BVFIND,        "Failed when finding a bit in a bit-vector"}
+};
+#endif /* _H_ERR_MASTER_ */
+
+#endif /* __HERR_H */
diff --git a/hdf/src/herrf.c b/hdf/src/herrf.c
new file mode 100644
index 0000000..6151676
--- /dev/null
+++ b/hdf/src/herrf.c
@@ -0,0 +1,125 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: herrf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    herrf.c
+ * Purpose: C stubs for error-handling Fortran routines
+ * Invokes: herr.c.
+ * Contents:
+ *     heprnt_:    Call HEprint to print error message
+ * Remarks: none
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "hproto_fortran.h"
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    heprnt
+ * Purpose: call HEprint to print error messages, starting from top of stack
+ * Inputs:  print_levels: number of levels to print
+ * Returns: 0 on success, FAIL on failure
+ * Users:   Fortran stub routine
+ * Invokes: HEprint
+ * Remarks: This routine has one less parameter than HEprint, because it
+ *          doesn't allow the user to specify the stream to print to.
+ *          Instead it prints automatically to stdout.
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(VOID)
+nheprnt(intf * print_levels)
+{
+    HEprint(stderr, *print_levels);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    heprntc
+ * Purpose: call HEprint to print error messages, starting from top of stack
+ * Inputs:  print_levels: number of levels to print
+ * Returns: 0 on success, FAIL on failure
+ * Users:   Fortran stub routine
+ * Invokes: HEprint
+ * Remarks: This routine has one less parameter than HEprint, because it
+ *          doesn't allow the user to specify the stream to print to.
+ *          Instead it prints automatically to stdout.
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+
+#ifdef PROTOTYPE
+nheprntc(_fcd filename, intf * print_levels, intf *namelen)
+#else
+nheprntc(filename, print_levels, namelen)
+           _fcd  filename;
+           intf *print_levels; 
+           intf  *namelen;
+#endif /* PROTOTYPE */
+
+{
+    FILE *err_file;
+    char * c_name;
+    intn c_len;
+    int ret = 0;
+
+    c_len = *namelen;
+    if(c_len == 0) {
+                HEprint(stderr, *print_levels);
+                return(ret);
+    }
+    c_name = HDf2cstring(filename, c_len);
+    	if (!c_name) return(FAIL);
+    err_file = fopen(c_name, "a");
+    	if (!err_file) return(FAIL);
+    HEprint(err_file, *print_levels);
+    fclose(err_file);
+    return(ret);
+    
+}
+/*-----------------------------------------------------------------------------
+ * Name: hestringc
+ * Purpose:  Calls HEstring
+ * Inputs:   error_code - HDF error code
+ * Outputs: error_message - error message assocoated with the error code
+ * Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+ *----------------------------------------------------------------------------*/
+ 
+ 
+ FRETVAL(intf)
+#ifdef PROTOTYPE
+nhestringc(intf *error_code,
+            _fcd error_message, intf *len)
+#else
+nhestringc(error_code, error_message, len)
+           intf *error_code;
+           _fcd  error_message;
+           intf  *len;
+#endif /* PROTOTYPE */
+{
+   char *cstring = NULL;
+   intn   status;
+ 
+   status = -1;
+   cstring = (char *)HEstring((hdf_err_code_t) *error_code);
+   if (cstring) {
+                status = 0;
+                HDpackFstring(cstring,  _fcdtocp(error_message),  *len);
+   }  
+   return status;
+ 
+ 
+}
diff --git a/hdf/src/hextelt.c b/hdf/src/hextelt.c
new file mode 100644
index 0000000..cc05323
--- /dev/null
+++ b/hdf/src/hextelt.c
@@ -0,0 +1,1457 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: hextelt.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*LINTLIBRARY */
+/* ------------------------------ hextelt.c -------------------------------
+
+   Routines for external elements, i.e., data elements that reside on
+   some other file.  These elements have no limits on their length.
+   While users are prevented from reading beyond what is written, a
+   user can write an unlimited amount of data.
+
+   17-Mar-93
+   Adding offset and "starting length" to elements so that a user can
+   take an existing file with some data in it and create an HDF file
+   which has a pointer to that data.
+
+   File Organization
+  ******************
+   DD for External Element pointing to External Element Description Record
+   =======================================================================
+   <-  2 bytes -> <- 2 bytes -> <- 4 bytes -> <- 4bytes ->
+   --------------------------------------------------------
+   |extended tag | reference # |  Offset     |  Length    |
+   --------------------------------------------------------
+                                    \______________/
+   __________________________________________|
+   V
+   EXTERNAL ELEMENT DESCRIPTION RECORD(EEDR - 12 + file_name_length bytes)
+   ========================================================================
+   <-  4 bytes  -> <- 4 bytes -> <- 4 bytes -> <- variable ->
+   ---------------------------------------------------------
+   | ext_tag_desc |   offset    |  length     | filename   |
+   ---------------------------------------------------------
+
+   ext_tag_desc  - EXT_EXTERN(16 bit constant). Identifies this as an
+                   external element description record.
+   offset        - Location of the element(data) within the external 
+                   file(32 bit field)
+   length        - Length in bytes of the element(data) in the external
+                   file(32 bit field)
+   filename      - Non-null terminated ASCII string naming the external
+                   file(variable length)
+
+ LOCAL ROUTINES
+   HXIstaccess      -- set up AID to access an ext elem
+   HXIbuildfilename -- Build the Filename for the External Element
+
+ EXPORTED BUT LIBRARY PRIVATE ROUTINES
+   HXPcloseAID      -- close file but keep AID active
+   HXPendacess      -- close file, free AID
+   HXPinfo          -- return info about an external element
+   HXPinquire       -- retreive information about an external element
+   HXPread          -- read some data out of an external file
+   HXPreset         -- replace the current external info with new info
+   HXPseek          -- set the seek position
+   HXPsetaccesstype -- set the I/O access type of the external file
+   HXPstread        -- open an access record for reading
+   HXPstwrite       -- open an access record for reading
+   HXPwrite         -- write some data out to an external file
+
+EXPORTED ROUTINES
+   HXcreate         -- create an external element
+   HXsetcreatedir   -- set the directory variable for creating external file
+   HXsetdir         -- set the directory variable for locating external file
+
+------------------------------------------------------------------------- */
+
+#include "hdf.h"
+#include "hfile.h"
+
+/* Directory seperator definitions relating to a path. 
+ * Note this does not provide a universal way to recognize
+ * different path name conventions and translate between them */
+#if defined WIN386 | defined DOS386
+/* DOS-Windows seperator */
+#define DIR_SEPC  92  /* Integer value of '\' */
+#define DIR_SEPS  "\\"
+#else 
+/* Unix - POSIX */
+#define DIR_SEPC  47  /* Integer value of '/' */
+#define DIR_SEPS  "/"
+#endif /* !WIN386 & !DOS386 */
+
+/* directory path seperator from other directory paths */
+#define DIR_PATH_SEPC 124
+#define DIR_PATH_SEPS "|" 
+
+/* extinfo_t -- external elt information structure */
+
+typedef struct
+  {
+      int         attached;     /* number of access records attached
+                                   to this information structure */
+      int32       extern_offset;
+      int32       length;       /* length of this element */
+      int32       length_file_name;     /* length of the external file name */
+      int32       para_extfile_id;  /* parallel ID of the external file */
+      hdf_file_t  file_external;    /* external file descriptor */
+      char       *extern_file_name;     /* name of the external file */
+      intn        file_open;    /* has the file been opened yet ? */
+  }
+extinfo_t;
+
+/* forward declaration of the functions provided in this module */
+PRIVATE int32 HXIstaccess
+            (accrec_t * access_rec, int16 access);
+PRIVATE char *HXIbuildfilename
+	(const char *ext_fname, const intn acc_mode);
+
+/* ext_funcs -- table of the accessing functions of the external
+   data element function modules.  The position of each function in
+   the table is standard */
+funclist_t  ext_funcs =
+{
+    HXPstread,
+    HXPstwrite,
+    HXPseek,
+    HXPinquire,
+    HXPread,
+    HXPwrite,
+    HXPendaccess,
+    HXPinfo,
+    HXPreset,
+};
+
+/*------------------------------------------------------------------------ 
+NAME
+   HXcreate -- create an external element
+USAGE
+   int32 HXcreate(file_id, tag, ref, ext_name, offset, len)
+   int32  file_id;      IN: file ID for HDF file
+   int16  tag;          IN: tag number for external elem
+   int16  ref;          IN: ref number for external elem
+   char * ext_name;     IN: external file name
+   int32  offset;       IN: offset where elem should start in ext file
+   int32  len;          IN: current len of element if already in
+                            ext file (see desc below)
+RETURNS
+   returns AID to external element if succeed, else FAIL
+DESCRIPTION
+   Create a data element in an external file starting at the location
+   of _offset_.  If the external file does not exist, it is created.
+   If it already exists, we will simply open it, not delete it and
+   start over.
+
+   If the data element does not exist, it is created in reference to
+   the external file starting at location _offset_.  Its data length is
+   set as _len_.  If the data element already exists, it is "promoted"
+   as an external element and its data is copied to the external file,
+   again, starting at location _offset_.  In this case, since the
+   length of the existing element is defined, it is set as the length
+   of the external element.  The given _len_ value is ignored.
+
+   Currently, all ordinary data element plus link-block and external
+   elements can be set as an external element.  (For the case of
+   setting an existing external element to a new external element has
+   the effect of copying the data of the element from an old external
+   file to a new one.)
+
+   All further reference (e.g., read, write, seek) to this external
+   element applies to the content of the external file.
+
+   The AID which refers to this new external element, is returned upon
+   successful execution.  FAIL is returned if any error is encountered.
+FORTRAN
+   None
+
+--------------------------------------------------------------------------*/
+int32
+HXcreate(int32 file_id, uint16 tag, uint16 ref, const char *extern_file_name, int32 offset, int32 start_len)
+{
+    CONSTR(FUNC, "HXcreate");   /* for HERROR */
+    filerec_t  *file_rec;       /* file record */
+    accrec_t   *access_rec=NULL;/* access element record */
+    int32       dd_aid;         /* AID for writing the special info */
+    hdf_file_t  file_external;  /* external file descriptor */
+    extinfo_t  *info=NULL;      /* special element information */
+    atom_t      data_id=FAIL;   /* dd ID of existing regular element */
+    int32       data_len;		/* length of the data we are checking */
+    uint16      special_tag;    /* special version of tag */
+    uint8       local_ptbuf[20 + MAX_PATH_LEN];     /* temp working buffer */
+    char	   *fname=NULL;    /* filename built from external filename */
+    void *       buf = NULL;      /* temporary buffer */
+    int32       ret_value = SUCCEED;
+
+    /* clear error stack and validate args */
+    HEclear();
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec) || !extern_file_name || (offset < 0) || SPECIALTAG(tag)
+        || (special_tag = MKSPECIALTAG(tag)) == DFTAG_NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (!(file_rec->access & DFACC_WRITE))
+        HGOTO_ERROR(DFE_DENIED, FAIL);
+
+    /* get a access records */
+    access_rec = HIget_access_rec();
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_TOOMANY, FAIL);
+
+    /* search for identical dd */
+    if ((data_id=HTPselect(file_rec,tag,ref))!=FAIL)
+      {
+          /* Check if the element is already special */
+          if (HTPis_special(data_id)==TRUE)
+            {
+                sp_info_block_t sp_info;
+                int32	aid, retcode;
+
+                aid = Hstartread(file_id, tag, ref);
+                retcode = HDget_special_info(aid, &sp_info);
+                Hendaccess(aid);
+                if ((retcode == FAIL) || (sp_info.key == FAIL))
+                    HGOTO_ERROR(DFE_CANTMOD, FAIL);
+		
+                switch(sp_info.key)
+                  {
+                    /* we can proceed with these types of special elements */
+                    case SPECIAL_LINKED:
+                    case SPECIAL_EXT:
+                        break;
+
+                    /* abort since we cannot convert the data element to an external data element */
+                    case SPECIAL_COMP:
+                    default:
+                        HTPendaccess(data_id);
+                        HGOTO_ERROR(DFE_CANTMOD, FAIL);
+                  } /* switch */
+            }   /* end if */
+
+          /* get the info for the dataset */
+          if(HTPinquire(data_id,NULL,NULL,NULL,&data_len)==FAIL)
+            {
+                HTPendaccess(data_id);
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            } /* end if */
+      } /* end if */
+
+    /* build the customized external file name. */
+    if (!(fname = HXIbuildfilename(extern_file_name, DFACC_CREATE)))
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* create the external file */
+    file_external = (hdf_file_t)HI_OPEN(fname, DFACC_WRITE);
+    if (OPENERR(file_external))
+    {
+        file_external = (hdf_file_t)HI_CREATE(fname);
+        if (OPENERR(file_external))
+            HGOTO_ERROR(DFE_BADOPEN, FAIL);
+    }
+    HDfree(fname);
+
+    /* set up the special element information and write it to file */
+    access_rec->special_info = HDmalloc((uint32) sizeof(extinfo_t));
+    info = (extinfo_t *) access_rec->special_info;
+    if (!info)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    if (data_id!=FAIL && data_len>0)
+      {
+          if ((buf = HDmalloc((uint32) data_len)) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          if (Hgetelement(file_id, tag, ref, buf) == FAIL)
+                HGOTO_ERROR(DFE_READERROR, FAIL);
+          if (HI_SEEK(file_external, offset) == FAIL)
+                HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HI_WRITE(file_external, buf, (int)data_len) == FAIL)
+                HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+          info->length = data_len;
+      }
+    else
+      info->length = start_len;
+
+    info->attached         = 1;
+    info->file_open        = TRUE;
+    info->file_external    = file_external;
+    info->extern_offset    = offset;
+    info->extern_file_name = (char *) HDstrdup(extern_file_name);
+    if (!info->extern_file_name)
+      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Getting ready to write out special info struct */
+    info->length_file_name = (int32)HDstrlen(extern_file_name);
+    {
+        uint8      *p = local_ptbuf;
+    
+        INT16ENCODE(p, SPECIAL_EXT);
+        INT32ENCODE(p, info->length);
+        INT32ENCODE(p, info->extern_offset);
+        INT32ENCODE(p, info->length_file_name);
+        HDstrcpy((char *) p, extern_file_name);
+    }
+    if(data_id!=FAIL)
+        if (HTPdelete(data_id) == FAIL)
+            HGOTO_ERROR(DFE_CANTDELDD, FAIL);
+
+    /* write the special info structure to file */
+    if((dd_aid=Hstartaccess(file_id,special_tag,ref,DFACC_ALL))==FAIL)
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+    if (Hwrite(dd_aid, 14+info->length_file_name, local_ptbuf) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+    if(Hendaccess(dd_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    /* update access record and file record */
+    if((access_rec->ddid=HTPselect(file_rec,special_tag,ref))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    access_rec->special_func = &ext_funcs;
+    access_rec->special      = SPECIAL_EXT;
+    access_rec->posn         = 0;
+    access_rec->access       = DFACC_RDWR;
+    access_rec->file_id      = file_id;
+    access_rec->appendable   = FALSE;     /* start data as non-appendable */
+    file_rec->attach++;
+
+    ret_value = HAregister_atom(AIDGROUP,access_rec);  /* return access id */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(access_rec!=NULL)
+            HIrelease_accrec_node(access_rec);
+        if(info!=NULL)
+            HDfree(info);
+        if(fname!=NULL)
+            HDfree(fname);
+        if(data_id!=FAIL)
+            HTPendaccess(data_id);
+    } /* end if */
+
+  /* Normal function cleanup */
+  if (buf != NULL)
+      HDfree(buf);
+
+  return ret_value; 
+} /* HXcreate */
+
+/*------------------------------------------------------------------------ 
+NAME
+   HXPsetaccesstype -- set the I/O access type of the external file
+USAGE
+   intn HXPsetaccesstype(access_rec)
+   accrec_t *access_rec   IN/OUT: access record of the external element
+RETURNS
+   SUCCEED if no error, else FAIL
+DESCRIPTION
+   Open the external file according to the access type specified.
+
+--------------------------------------------------------------------------*/
+intn
+HXPsetaccesstype(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HXPsetaccesstype");
+    hdf_file_t  file_external;  /* external file descriptor */
+    extinfo_t  *info;           /* special element information */
+    char	*fname=NULL;
+    intn       ret_value = SUCCEED;
+
+    /* clear error stack and validate args */
+    HEclear();
+
+    /* sanity check */
+    if (access_rec==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (( info = (extinfo_t *) access_rec->special_info)==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* build the customized external file name. */
+    if ((fname = HXIbuildfilename(info->extern_file_name, DFACC_OLD))==NULL)
+        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+    /* Open the external file for the correct access type */
+    switch (access_rec->access_type)
+      {
+          case DFACC_SERIAL:
+              file_external = (hdf_file_t)HI_OPEN(fname, DFACC_WRITE);
+              if (OPENERR(file_external))
+                {
+                    file_external = (hdf_file_t)HI_CREATE(fname);
+                    if (OPENERR(file_external))
+                        HGOTO_ERROR(DFE_BADOPEN, FAIL);
+                }
+	      HDfree(fname);
+              info->file_external = file_external;
+              break;
+              
+          default:
+              HGOTO_ERROR(DFE_BADOPEN, FAIL);
+      }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(fname!=NULL)
+            HDfree(fname);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/* ----------------------------- HXIstaccess ------------------------------ */
+/*
+NAME
+   HXIstaccess -- set up AID to access an ext elem
+USAGE
+   int32 HXIstaccess(access_rec, acc_mode)
+   access_t * access_rec;   IN: access record to fill in
+   int16      acc_mode;     IN: access mode
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   Calls to HXIstread and HXIstwrite resolve to this function.
+   Given an active AID fill in all of the special information.
+   If this information has already been read in for a different
+   element use that else we must go out to the HDF file and
+   pull in the information ourselves
+
+---------------------------------------------------------------------------*/
+PRIVATE int32
+HXIstaccess(accrec_t * access_rec, int16 acc_mode)
+{
+    CONSTR(FUNC, "HXIstaccess");    /* for HERROR */
+    extinfo_t  *info = NULL;        /* special element information */
+    filerec_t  *file_rec = NULL;    /* file record */
+    int32       data_off;		    /* offset of the data we are checking */
+    uint8       local_ptbuf[12];    /* working buffer */
+    int32       ret_value = SUCCEED;
+
+    /* get file record and validate */
+    file_rec = HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec) || !(file_rec->access & acc_mode))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* intialize the access record */
+    access_rec->special = SPECIAL_EXT;
+    access_rec->posn = 0;
+    access_rec->access = (uint32)(acc_mode|DFACC_READ);
+
+    /* Get the data's offset & length */
+    if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* get the special info record */
+    access_rec->special_info = HIgetspinfo(access_rec);
+    if (access_rec->special_info)
+      {   /* found it from other access records */
+          info = (extinfo_t *) access_rec->special_info;
+          info->attached++;
+      }
+    else
+      {   /* look for information in the file */
+          if (HPseek(file_rec, data_off + 2) == FAIL)
+              HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HP_read(file_rec, local_ptbuf, 12) == FAIL)
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+
+          access_rec->special_info = HDmalloc((uint32) sizeof(extinfo_t));
+          info = (extinfo_t *) access_rec->special_info;
+          if (info==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          {
+              uint8      *p = local_ptbuf;
+              INT32DECODE(p, info->length);
+              INT32DECODE(p, info->extern_offset);
+              INT32DECODE(p, info->length_file_name);
+          }
+          info->extern_file_name = (char *) HDmalloc((uint32) info->length_file_name + 1);
+          if (!info->extern_file_name)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          if (HP_read(file_rec, info->extern_file_name, info->length_file_name) == FAIL)
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+
+          info->extern_file_name[info->length_file_name] = '\0';
+
+          /* delay file opening until needed */
+          info->file_open = FALSE;
+          info->attached = 1;
+      }
+
+    file_rec->attach++;
+    ret_value = HAregister_atom(AIDGROUP,access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(access_rec!=NULL)
+            HIrelease_accrec_node(access_rec);
+        if(info !=NULL)
+          {   /* free file name first */
+              if (info->extern_file_name != NULL)
+                  HDfree(info->extern_file_name);
+              HDfree(info);
+          }
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HXIstaccess */
+
+/* ------------------------------ HXPstread ------------------------------- */
+/*
+NAME
+   HXPstread -- open an access record for reading
+USAGE
+   int32 HXPstread(access_rec)
+   access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   Calls to HXIstaccess to fill in the access rec for 
+   reading
+
+---------------------------------------------------------------------------*/
+int32
+HXPstread(accrec_t * rec)
+{
+  int32 ret_value;
+
+  ret_value = HXIstaccess(rec, DFACC_READ);
+
+  return ret_value;
+}   /* HXPstread */
+
+/* ------------------------------ HXPstwrite ------------------------------- */
+/*
+NAME
+   HXPstwrite -- open an access record for reading
+USAGE
+   int32 HXPstwrite(access_rec)
+   access_t * access_rec;   IN: access record to fill in
+RETURNS
+   The AID of the access record on success FAIL on error.
+DESCRIPTION
+   Calls to HXIstaccess to fill in the access rec for writing
+
+---------------------------------------------------------------------------*/
+int32
+HXPstwrite(accrec_t * rec)
+{
+  int32 ret_value;
+
+  ret_value = HXIstaccess(rec, DFACC_WRITE);
+
+  return ret_value;
+}   /* HXPstwrite */
+
+/* ------------------------------ HXPseek ------------------------------- */
+/*
+NAME
+   HXPseek -- set the seek posn
+USAGE
+   int32 HXPseek(access_rec, offset, origin)
+   access_t * access_rec;      IN: access record to mess with
+   int32      offset;          IN: seek offset
+   int32      origin;          IN: where we should calc the offset from
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Set the seek posn in the given external element
+
+---------------------------------------------------------------------------*/
+int32
+HXPseek(accrec_t * access_rec, int32 offset, int origin)
+{
+    int32     ret_value = SUCCEED;
+    CONSTR(FUNC, "HXPseek");    /* for HERROR */
+
+    /* Adjust offset according to origin.
+       there is no upper bound to posn */
+    if (origin == DF_CURRENT)
+        offset += access_rec->posn;
+    if (origin == DF_END)
+        offset += ((extinfo_t *) (access_rec->special_info))->length;
+    if (offset < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* set the offset */
+    access_rec->posn = offset;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HXPseek */
+
+/* ------------------------------ HXPread ------------------------------- */
+/*
+NAME
+   HXPread -- read some data out of an external file
+USAGE
+   int32 HXPseek(access_rec, length, data)
+   access_t * access_rec;      IN: access record to mess with
+   int32      length;          IN: number of bytes to read
+   void *      data;            IN: buffer for data
+RETURNS
+   The number of bytes read or FAIL on error
+DESCRIPTION
+   Read in some data from an external file.  If length is zero
+   read until the end of the element.  It is assumed that the
+   data buffer is big enough to store the data.
+
+   BUG:  Need to investigate what happens if length would take
+   us off the end of what has been written -- should only read
+   until the end.
+
+---------------------------------------------------------------------------*/
+int32
+HXPread(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HXPread");    /* for HERROR */
+    extinfo_t  *info =          /* information on the special element */
+    (extinfo_t *) access_rec->special_info;
+    int32    ret_value = SUCCEED;
+
+    /* validate length */
+    if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* adjust length if it falls off the end of the element */
+    if ((length == 0) || (access_rec->posn + length > info->length))
+        length = info->length - access_rec->posn;
+    else if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* see if the file is open, if not open it */
+    if (!info->file_open)
+      {
+        char	*fname;
+
+        /* build the customized external file name. */
+        if ((fname = HXIbuildfilename(info->extern_file_name, DFACC_OLD))==NULL)
+            HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+        info->file_external = (hdf_file_t)HI_OPEN(fname, access_rec->access);
+        HDfree(fname);
+        if (OPENERR(info->file_external))
+          {
+            HERROR(DFE_BADOPEN);
+            HEreport("Could not find external file %s\n", info->extern_file_name);
+            HGOTO_DONE(FAIL);
+          }
+        info->file_open = TRUE;
+      }
+
+    /* read it in from the file */
+      {
+          if (HI_SEEK(info->file_external, access_rec->posn + info->extern_offset) == FAIL)
+              HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HI_READ(info->file_external, data, length) == FAIL)
+              HGOTO_ERROR(DFE_READERROR, FAIL);
+      }
+
+    /* adjust access position */
+    access_rec->posn += length;
+
+    ret_value = length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HXPread */
+
+/* ------------------------------ HXPwrite ------------------------------- */
+/*
+NAME
+   HXPwrite -- write some data out to an external file
+USAGE
+   int32 HXPwrite(access_rec, length, data)
+   access_t * access_rec;      IN: access record to mess with
+   int32      length;          IN: number of bytes to read
+   void *      data;            IN: buffer of data
+RETURNS
+   The number of bytes written or FAIL on error
+DESCRIPTION
+   Write out some data to an external file.  
+
+   It looks like this will allow us to write to a file even if we only
+   have a read AID for it.   Is that really the behavior that we want?
+
+---------------------------------------------------------------------------*/
+int32
+HXPwrite(accrec_t * access_rec, int32 length, const void * data)
+{
+    uint8       local_ptbuf[4]; /* temp buffer */
+    CONSTR(FUNC, "HXPwrite");   /* for HERROR */
+    extinfo_t  *info =          /* information on the special element */
+                    (extinfo_t *) (access_rec->special_info);
+    uint8      *p =local_ptbuf; /* temp buffer ptr */
+    filerec_t  *file_rec;       /* file record */
+    int32      ret_value = SUCCEED;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* validate length */
+    if (length < 0)
+        HGOTO_ERROR(DFE_RANGE, FAIL);
+
+    /* see if the file is open, if not open it */
+    if (!info->file_open)
+    {
+        char *fname;
+
+        /* build the customized external file name. */
+        if ((fname = HXIbuildfilename(info->extern_file_name, DFACC_OLD))==NULL)
+            HGOTO_ERROR(DFE_BADOPEN, FAIL);
+
+        info->file_external = (hdf_file_t)HI_OPEN(fname, access_rec->access);
+        HDfree(fname);
+        if (OPENERR(info->file_external))
+          {
+            HERROR(DFE_BADOPEN);
+            HEreport("Could not find external file %s\n", info->extern_file_name);
+            HGOTO_DONE(FAIL);
+          }
+        info->file_open = TRUE;
+    }
+
+    /* write the data onto file */
+      {
+          if (HI_SEEK(info->file_external, access_rec->posn + info->extern_offset) == FAIL)
+              HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HI_WRITE(info->file_external, data, length) == FAIL)
+            {
+            /* this external file might not be opened with write permission,
+               reopen the file and try again */
+                hdf_file_t  f = (hdf_file_t)HI_OPEN(info->extern_file_name, DFACC_WRITE);
+                
+                if (OPENERR(f) ||
+                    HI_SEEK(f, access_rec->posn + info->extern_offset) == FAIL ||
+                    HI_WRITE(f, data, length) == FAIL)
+                  {
+                    HI_CLOSE(f);
+                    HGOTO_ERROR(DFE_DENIED, FAIL);
+                  }
+                HI_CLOSE(info->file_external);
+
+                /* if okay, substitute the file descriptor */
+                info->file_external = f;
+            }
+      }
+
+    /* update access record, and information about special elelemt */
+    access_rec->posn += length;
+    if (access_rec->posn > info->length)
+      {
+          int32       data_off;		/* offset of the data we are checking */
+          info->length = access_rec->posn;
+          INT32ENCODE(p, info->length);
+
+          /* Get the data's offset & length */
+          if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,NULL)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+          if (HPseek(file_rec, data_off + 2) == FAIL)
+              HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HP_write(file_rec, local_ptbuf, 4) == FAIL)
+              HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+      }
+
+    ret_value = length;    /* return length of bytes written */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value; 
+}	/* HXPwrite */
+
+/* ------------------------------ HXPinquire ------------------------------ */
+/*
+NAME
+   HXPinquire -- retreive information about an external element
+USAGE
+   int32 HXPinquire(access_rec, file, tag, ref, len, off, pos, acc, sp)
+   access_t * access_rec;      IN:  access record to return info about
+   uint16   * file;            OUT: file ID;
+   uint16   * tag;             OUT: tag of info record;
+   uint16   * ref;             OUT: ref of info record;
+   int32    * len;             OUT: length of element;
+   int32    * off;             OUT: offset of element (NOT correct);
+   int32    * pos;             OUT: current position in element;
+   int16    * acc;             OUT: access mode;
+   int16    * sp;              OUT: special code;
+RETURNS
+   SUCCEED
+DESCRIPTION
+   Return interesting information about an external element.
+   NULL can be passed for any of the OUT parameters if their
+   value is not needed.
+   BUG: The offset returned is not correct.
+
+---------------------------------------------------------------------------*/
+int32
+HXPinquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+           uint16 *pref, int32 *plength, int32 *poffset,
+           int32 *pposn, int16 *paccess, int16 *pspecial)
+{
+    CONSTR(FUNC, "HXPinquire");   /* for HERROR */
+    extinfo_t  *info =          /* special information record */
+    (extinfo_t *) access_rec->special_info;
+    uint16 data_tag,data_ref;   /* tag/ref of the data we are checking */
+    int32    ret_value = SUCCEED;
+
+    /* Get the data's offset & length */
+    if(HTPinquire(access_rec->ddid,&data_tag,&data_ref,NULL,NULL)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the variables if they are present */
+    if (pfile_id)
+        *pfile_id = access_rec->file_id;
+    if (ptag)
+        *ptag = data_tag;
+    if (pref)
+        *pref = data_ref;
+    if (plength)
+        *plength = info->length;
+    if (poffset)
+        *poffset = 0;   /* meaningless -- actually not anymore */
+    if (pposn)
+        *pposn = access_rec->posn;
+    if (paccess)
+        *paccess = (int16)access_rec->access;
+    if (pspecial)
+        *pspecial = (int16)access_rec->special;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return ret_value;
+}	/* HXPinquire */
+
+/* ----------------------------- HXPendaccess ----------------------------- */
+/*
+NAME
+   HXPendacess -- close file, free AID
+USAGE
+   intn HXPendaccess(access_rec)
+   access_t * access_rec;      IN:  access record to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Close the file pointed to by the current AID and free the AID
+
+---------------------------------------------------------------------------*/
+intn
+HXPendaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HXPendaccess");   /* for HERROR */
+    filerec_t  *file_rec;           /* file record */
+    intn     ret_value = SUCCEED;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(access_rec->file_id);
+
+    /* close the file pointed to by this access rec */
+    HXPcloseAID(access_rec);
+
+    /* update file and access records */
+    if (HTPendaccess(access_rec->ddid) == FAIL)
+      HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+
+    /* validate file record */
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* detach from the file */
+    file_rec->attach--;
+
+    /* free the access record */
+    HIrelease_accrec_node(access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(access_rec!=NULL)
+          HIrelease_accrec_node(access_rec);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value; 
+}	/* HXPendaccess */
+
+/* ----------------------------- HXPcloseAID ------------------------------ */
+/*
+NAME
+   HXPcloseAID -- close file but keep AID active
+USAGE
+   int32 HXPcloseAID(access_rec)
+   access_t * access_rec;      IN:  access record of file to close
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   close the file currently being pointed to by this AID but 
+   do *NOT* free the AID.
+
+   This is called by Hnextread() which reuses an AID to point to
+   the 'next' object as requested.  If the current object was an
+   external object, the external file needs to be closed before all
+   reference to it is lost.
+
+---------------------------------------------------------------------------*/
+int32
+HXPcloseAID(accrec_t * access_rec)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HXPcloseAID");    /* for HERROR */
+#endif /* LATER */
+    extinfo_t  *info =          /* special information record */
+    (extinfo_t *) access_rec->special_info;
+    int32      ret_value = SUCCEED;
+
+    /* detach the special information record.
+       If no more references to that, free the record */
+
+    if (--(info->attached) == 0)
+      {
+          if (info->file_open)
+              HI_CLOSE(info->file_external);
+          HDfree(info->extern_file_name);
+          HDfree(info);
+          access_rec->special_info=NULL;
+      }
+
+#ifdef LATER
+done:
+#endif /* LATER */
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return ret_value;
+}   /* HXPcloseAID */
+
+/* ------------------------------- HXPinfo -------------------------------- */
+/*
+NAME
+   HXPinfo -- return info about an external element
+USAGE
+   int32 HXPinfo(access_rec, info_block)
+   accrec_t        * access_rec; IN: access record of element
+   sp_info_block_t * info_block; OUT: information about the special element 
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Return information about the given external element.  Info_block is
+   assumed to be non-NULL.  Do not make a copy of the path, just have
+   the info_block copy point to our local copy.
+
+   --------------------------------------------------------------------------- */
+int32
+HXPinfo(accrec_t * access_rec, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HXPinfo");    /* for HERROR */
+    extinfo_t  *info =          /* special information record */
+    (extinfo_t *) access_rec->special_info;
+    int32      ret_value = SUCCEED;
+
+    /* validate access record */
+    if (access_rec->special != SPECIAL_EXT)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* fill in the info_block */
+    info_block->key = SPECIAL_EXT;
+
+    info_block->offset = info->extern_offset;
+    info_block->length = info->length;
+    info_block->length_file_name = info->length_file_name;
+    info_block->path = info->extern_file_name;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value; 
+}   /* HXPinfo */
+
+/* ------------------------------- HXPreset ------------------------------- */
+/*
+NAME
+   HXPreset -- replace the current external info with new info
+USAGE
+   int32 HXPreset(access_rec, info_block)
+   accrec_t        * access_rec;   IN: access record of element
+   sp_info_block_t * info_block;   IN: information about the special element 
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Reset information about the given external element.  Info_block is
+   assumed to be non-NULL.
+
+   Basically, what this routine does is throw out the old file
+   information for a special element and replaces it with a new
+   file name.  This is useful for when a file has changed places.
+   The offset and length are assumed to be the same.
+
+---------------------------------------------------------------------------*/
+int32
+HXPreset(accrec_t * access_rec, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HXPreset");    /* for HERROR */
+    filerec_t  *file_rec;       /* file record */
+    uint8       local_ptbuf[14 + MAX_PATH_LEN];     /* temp buffer */
+    extinfo_t  *info =          /* special information record */
+    (extinfo_t *) access_rec->special_info;
+    int32 new_len, new_off;     /* new length & offset of the special info */
+    int32      ret_value = SUCCEED;
+
+    /* validate access record -- make sure is already external element */
+    if (access_rec->special != SPECIAL_EXT)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* just replace with other external element info for now  */
+    /* (i.e., this can not change the type of special element */
+    if (info_block->key != SPECIAL_EXT)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* check validity of file record */
+    file_rec = HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* update our internal pointers */
+    info->extern_offset = info_block->offset;
+    info->extern_file_name = (char *) HDstrdup(info_block->path);
+    if (!info->extern_file_name)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    info->length_file_name = (int32)HDstrlen(info->extern_file_name);
+
+    /*
+     * delete the existing tag / ref object
+     * accomplish this by changing the offset and length of the existing
+     *  special element DD and writing it in a new place
+     */
+    new_len=14+info->length_file_name;
+    if ((new_off=HPgetdiskblock(file_rec, new_len, TRUE)) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* write the new external file record */
+    {
+        uint8      *p = local_ptbuf;
+        INT16ENCODE(p, SPECIAL_EXT);
+        INT32ENCODE(p, info->length);
+        INT32ENCODE(p, info->extern_offset);
+        INT32ENCODE(p, info->length_file_name);
+        HDstrcpy((char *) p, (char *) info->extern_file_name);
+    }
+
+    /* write out the new external file record */
+    if (HP_write(file_rec, local_ptbuf, new_len) == FAIL)
+        HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+    /* update the DD block in the file */
+    if (HTPupdate(access_rec->ddid, new_off, new_len) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value; 
+}	/* HXPreset */
+
+static	char*	extcreatedir = NULL;
+static	char*	HDFEXTCREATEDIR = NULL;
+static	char*	extdir = NULL;
+static	char*	HDFEXTDIR = NULL;
+
+/*------------------------------------------------------------------------ 
+NAME
+   HXsetcreatedir -- set the directory variable for creating external file
+USAGE
+   intn HXsetcreatedir(dir)
+   const char *dir		IN: directory for creating external file
+RETURNS
+   SUCCEED if no error, else FAIL
+DESCRIPTION
+   Set up the directory variable for creating external file.
+   The directory content is copied into HXsetcreatedir area.
+   If dir is NULL, the directory variable is unset.
+   If error encountered during setup, previous value of createdir
+   is not changed.
+
+FORTRAN
+   hxscdir
+
+--------------------------------------------------------------------------*/
+intn
+HXsetcreatedir(const char *dir)
+{
+    CONSTR(FUNC, "HXsetcreatedir");
+  char	*pt;
+  intn       ret_value = SUCCEED;
+
+
+  if (dir)
+    {
+      if (!(pt = HDstrdup(dir)))
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    }
+  else
+    pt = NULL;		/* will reset extcreatedir to NULL */
+
+  if (extcreatedir)
+    HDfree(extcreatedir);
+    
+  extcreatedir = pt;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value; 
+}	/* HXsetcreatedir */
+
+/*------------------------------------------------------------------------ 
+NAME
+   HXsetdir -- set the directory variable for locating external file
+USAGE
+   intn HXsetdir(dir)
+   const char *dir		IN: directory for locating external file
+RETURNS
+   SUCCEED if no error, else FAIL
+DESCRIPTION
+   Set up the directory variable for locating external file.
+   It can contain multiple directories separated by colons.
+   The directory content is copied into HXsetdir area.
+   If dir is NULL, the directory variable is unset.
+   If error encountered during setup, previous value of extdir
+   is not changed.
+
+FORTRAN
+   hxsdir
+
+--------------------------------------------------------------------------*/
+intn
+HXsetdir(const char *dir)
+{
+    CONSTR(FUNC, "HXsetdir");
+  char	*pt;
+  intn   ret_value = SUCCEED;
+
+  if (dir)
+    {
+      if (!(pt = HDstrdup(dir)))
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    }
+  else
+    pt = NULL;		/* will reset extdir to NULL */
+
+  if (extdir)
+    HDfree(extdir);
+    
+  extdir = pt;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value; 
+}	/* HXsetdir */
+
+/* ------------------------------- HXIbuildfilename ------------------------------- */
+/*
+NAME
+    HXIbuildfilename -- Build the Filename for the External Element
+USAGE
+    char* HXIbuildfilename(char *ext_fname, const intn acc_mode)
+    char            * ext_fname;	IN: external filename as stored
+    intn 	      acc_mode;		IN: access mode
+RETURNS
+    finalpath / NULL
+DESCRIPTION
+    Compose the external object file name.
+    [More detail later.]
+
+---------------------------------------------------------------------------*/
+/* the following can be sped up by doing my own copying instead of scanning */
+/* for end-of-line two extra times, or even use memcpy since the string lengths */
+/* are calculated already.  For now, it works. */
+#define HDstrcpy3(s1, s2, s3, s4)	(HDstrcat(HDstrcat(HDstrcpy(s1, s2),s3),s4))
+#define HDstrcpy4(s1, s2, s3, s4, s5)	(HDstrcat(HDstrcat(HDstrcat(HDstrcpy(s1, s2),s3),s4),s5))
+
+PRIVATE
+char *
+HXIbuildfilename(const char *ext_fname, const intn acc_mode)
+{
+    CONSTR(FUNC, "HXIbuildfilename");
+    int	        fname_len;		/* string length of the ext_fname */
+    int	        path_len;		/* string length of prepend pathname */
+    static int	firstinvoked = 1;	/* true if invoked the first time */
+
+    char	*finalpath = NULL;	/* Final pathname to return */
+    const char	*fname = NULL;
+    struct	stat filestat;	/* for checking pathname existence */
+    char        *ret_value = NULL; /* FAIL */
+
+    /* initialize HDFEXTDIR and HDFCREATEDIR if invoked the first time */
+    if (firstinvoked){
+        firstinvoked = 0;
+        HDFEXTCREATEDIR = HDgetenv("HDFEXTCREATEDIR");
+        HDFEXTDIR = HDgetenv("HDFEXTDIR");
+    }
+
+    if (!ext_fname)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+    fname = ext_fname;
+
+    /* get the space for the final pathname */
+    if (!(finalpath=HDmalloc(MAX_PATH_LEN)))
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    fname_len = (int)HDstrlen(fname);
+    
+    switch (acc_mode){
+    case DFACC_CREATE: {			/* Creating a new external element */
+        if ( *fname == DIR_SEPC ) {	/* Absolute Pathname */
+            ret_value = (HDstrcpy(finalpath, fname));
+            goto done;
+        }
+        else {				/* Relative Pathname */
+
+            /* try function variable */
+            if (extcreatedir) {
+                path_len = (int)HDstrlen(extcreatedir);
+
+                if (fname_len + 1 + path_len + 1 > MAX_PATH_LEN )
+                    HGOTO_ERROR(DFE_NOSPACE, NULL);
+                ret_value = (HDstrcpy3(finalpath, extcreatedir, DIR_SEPS, fname));
+                goto done;
+            }
+
+            /* try Envrironment Variable */
+            if (HDFEXTCREATEDIR) {
+                path_len = (int)HDstrlen(HDFEXTCREATEDIR);
+
+                if (fname_len + 1 + path_len + 1 > MAX_PATH_LEN )
+                    HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+                ret_value = (HDstrcpy3(finalpath, HDFEXTCREATEDIR, DIR_SEPS, fname));
+                goto done;
+            }
+
+            /* try Head File Directory */
+            /* Don't have Head File information now.  Continue */
+
+            /* Just return the ext_fname */
+            ret_value = (HDstrcpy(finalpath, fname));
+            goto done;
+        }
+        /* break; */
+    } /*DFACC_CREATE */
+    case DFACC_OLD:{			/* Locating an old external element */
+        if ( *fname == DIR_SEPC ) {	/* Absolute Pathname */
+            if (HDstat(fname, &filestat) == 0){
+                ret_value = (HDstrcpy(finalpath, fname));
+                goto done;
+            }
+            else if (!extdir && !HDFEXTDIR) {
+                HGOTO_ERROR(DFE_FNF, NULL);
+            }
+            /* strip the pathname component */
+            fname = HDstrrchr(fname, DIR_SEPC) + 1;
+            fname_len = (int)HDstrlen(fname);
+            /* continue to Relative Pathname */
+        }
+
+
+        /* Relative Pathname */
+        {
+            char   *dir_pt, *path_pt;	/* temporary pointers */
+
+            /* try function variable */
+            if (extdir) {
+                dir_pt = extdir;
+                while (*dir_pt){
+                    /* extract one extdir component to finalpath */
+                    path_len = 0;
+                    path_pt = finalpath;
+                    while (*dir_pt && *dir_pt != DIR_PATH_SEPC){
+                        if (path_len >= MAX_PATH_LEN)
+                            HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+                        *path_pt++ = *dir_pt++;
+                        path_len++;
+                    }
+                    if (*dir_pt == DIR_PATH_SEPC) dir_pt++;
+                    *path_pt++ = DIR_SEPC;
+                    path_len++;
+
+                    if (fname_len + path_len + 1 > MAX_PATH_LEN )
+                        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+                    HDstrcpy(path_pt, fname);
+                    if (HDstat(finalpath, &filestat) == 0 ){
+                        ret_value = finalpath;
+                        goto done;
+                    }
+                }
+            }
+
+            /* try Envrironment Variable */
+            if (HDFEXTDIR) {
+                dir_pt = HDFEXTDIR;
+                while (*dir_pt){
+                    /* extract one HDFEXTDIR component to finalpath */
+                    path_len = 0;
+                    path_pt = finalpath;
+                    while (*dir_pt && *dir_pt != DIR_PATH_SEPC){
+                        if (path_len >= MAX_PATH_LEN)
+                            HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+                        *path_pt++ = *dir_pt++;
+                        path_len++;
+                    }
+                    if (*dir_pt == DIR_PATH_SEPC) dir_pt++;
+                    *path_pt++ = DIR_SEPC;
+                    path_len++;
+
+                    if (fname_len + path_len + 1 > MAX_PATH_LEN )
+                        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+                    HDstrcpy(path_pt, fname);
+                    if (HDstat(finalpath, &filestat) == 0 ){
+                        ret_value = finalpath;
+                        goto done;
+                    }
+                }
+            }
+
+            /* try Head File Directory */
+            /* Don't have Head File information now.  Continue */
+
+            /* See if the file exists */
+            if (HDstat(fname, &filestat) == 0 )
+              {
+                  ret_value = (HDstrcpy(finalpath, fname));
+                  goto done;
+              }
+
+            /* All have failed */
+            ret_value = NULL;
+            goto done;
+        }
+        /* break; */
+    } /* DFACC_OLD */
+    default:
+        HDfree(finalpath);
+        HGOTO_ERROR(DFE_ARGS, NULL);
+    }
+
+  done:
+    if(ret_value == NULL)   
+      { /* Error condition cleanup */
+          if (finalpath != NULL)
+              HDfree(finalpath); /* free this */
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value; 
+}	/* HXIbuildfilename */
+
+/*------------------------------------------------------------------------ 
+NAME
+   HXPshutdown -- free any memory buffers we've allocated
+USAGE
+   intn HXPshutdown()
+RETURNS
+   SUCCEED/FAIL
+DESCRIPTION
+    Free buffers we've allocated during the execution of the program.
+
+--------------------------------------------------------------------------*/
+intn
+HXPshutdown(void)
+{
+    if(extcreatedir!=NULL)
+      {
+          HDfree(extcreatedir);
+          extcreatedir=NULL;
+      } /* end if */
+    if(HDFEXTCREATEDIR!=NULL)
+      {
+          HDFEXTCREATEDIR=NULL;
+      } /* end if */
+    if(extdir!=NULL)
+      {
+          HDfree(extdir);
+          extdir=NULL;
+      } /* end if */
+    if(HDFEXTDIR!=NULL)
+      {
+          HDFEXTDIR=NULL;
+      } /* end if */
+    return(SUCCEED);
+} /* end HXPshutdown() */
diff --git a/hdf/src/hfile.c b/hdf/src/hfile.c
new file mode 100644
index 0000000..d992a4c
--- /dev/null
+++ b/hdf/src/hfile.c
@@ -0,0 +1,4395 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: hfile.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*LINTLIBRARY */
+/*+
+   FILE
+   hfile.c
+   HDF low level file I/O routines
+
+   H-Level Limits
+   ==============
+   o MAX_ACC access records open at a single time (#define in hfile.h) 
+   o int16 total tags (fixed) 
+   o int32 max length and offset of an element in an HDF file (fixed) 
+
+   Routine prefix conventions
+   ==========================
+   HP: private, external
+   HI: private, static
+   HD: not-private, external (i.e. usable by non-developers)
+
+   "A" will be used to indicate that a routine is for parallel I/O.
+
+   Prefixes now have potentially three parts: (1) the interface, (2) optional
+   "A" to indicate parallel, and (3) scope:
+
+   <prefix> :== <interface>|<interface><scope>|<interface>A<scope>
+   <interface> :== H|HL|HX|SD|DFSD|DFAN|DFR8|...
+   <scope> :== D|P|I
+
+   Examples:  HAP => H interface, parallel, private external
+   HAD => H interface, parallel, non-private external
+   HI  => H interface, private static
+
+   EXPORTED ROUTINES
+   Hopen       -- open or create a HDF file
+   Hclose      -- close HDF file
+   Hstartread  -- locate and position a read access elt on a tag/ref
+   Hnextread   -- locate and position a read access elt on next tag/ref.
+   Hexist      -- locate an object in an HDF file
+   Hinquire    -- inquire stats of an access elt
+   Hstartwrite -- set up a WRITE access elt for a write
+   Happendable -- attempt make a dataset appendable
+   Hseek       -- position an access element to an offset in data element
+   Hread       -- read the next segment from data element
+   Hwrite      -- write next data segment to data element
+   HDgetc      -- read a byte from data element
+   HDputc      -- write a byte to data element
+   Hendaccess  -- to dispose of an access element
+   Hgetelement -- read in a data element
+   Hputelement -- writes a data element
+   Hlength     -- returns length of a data element
+   Hoffset     -- get offset of data element in the file
+   Hishdf      -- tells if a file is an HDF file
+   Htrunc      -- truncate a dataset to a length
+   Hsync       -- sync file with memory
+   Hcache      -- set low-level caching for a file
+   HDvalidfid  -- check if a file ID is valid
+   HDerr       --  Closes a file and return FAIL.  
+   Hsetacceesstype -- set the I/O access type (serial, parallel, ...)
+                       of a data element
+   Hgetlibversion  -- return version info on current HDF library
+   Hgetfileversion -- return version info on HDF file
+   HPgetdiskblock  -- Get the offset of a free block in the file.
+   HPfreediskblock -- Release a block in a file to be re-used.
+   HDread_drec -- reads a description record
+   HDcheck_empty   -- determines if an element has been written with data
+   HDget_special_info -- get information about a special element
+   HDset_special_info -- reset information about a special element
+   HDspecial_type -- return the special type if the given element is special
+
+   File Memory Pool routines
+   -------------------------
+   Hmpset  -- set pagesize and maximum number of pages to cache on next open/create       
+   Hmpget  -- get last pagesize and max number of pages cached for open/create
+
+   Special Tag routines
+   -------------------
+   HDmake_special_tag --
+   HDis_special_tag   --
+   HDbaset_tag        --
+
+   Macintosh specific Routines(unbuffered C I/O stubs on top of Mac toolbox)
+   --------------------------
+   mopen  -- 
+   mclose --
+   mread  --
+   mwrite --
+   mlsekk --
+
+   LOCAL ROUTINES
+   HIextend_file   -- extend file to current length
+   HIget_function_table -- create special function table
+   HIgetspinfo          -- return special info
+   HIunlock             -- unlock a previously locked file record
+   HIget_filerec_node   -- locate a filerec for a new file
+   HIrelease_filerec_node -- release a filerec
+   HIvalid_magic        -- verify the magic number in a file
+   HIget_access_rec     -- allocate a new access record
+   HIupdate_version     -- determine whether new version tag should be written
+   HIread_version       -- reads a version tag from a file
+   + */
+
+#define HMASTER
+#include "hdf.h"
+#undef HMASTER
+#define HFILE_MASTER
+#include "hfile.h"
+#include <errno.h>
+#include "glist.h" /* for double-linked lists, stacks and queues */
+
+/*--------------------- Locally defined Globals -----------------------------*/
+
+/* The default state of the file DD caching */
+PRIVATE intn default_cache = TRUE;
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+#ifdef OLD_WAY
+PRIVATE list_head_t *cleanup_list = NULL;
+#else
+PRIVATE Generic_list *cleanup_list = NULL;
+#endif
+
+/* Whether to install the atexit routine */
+PRIVATE intn install_atexit = TRUE;
+
+/*--------------------- Externally defined Globals --------------------------*/
+/* Function tables declarations.  These function tables contain pointers
+   to functions that help access each type of special element. */
+
+/* Functions for accessing the linked block special
+   data element.  For definition of the linked block, see hblocks.c. */
+extern funclist_t linked_funcs;
+
+/* Functions for accessing external data elements, or data
+   elements that are in some other files.  For definition of the external
+   data element, see hextelt.c. */
+extern funclist_t ext_funcs;
+
+/* Functions for accessing compressed data elements.
+   For definition of the compressed data element, see hcomp.c. */
+extern funclist_t comp_funcs;
+
+/* Functions for accessing chunked data elements.
+   For definition of the chunked data element, see hchunk.c. */
+#include "hchunks.h"
+
+/* Functions for accessing buffered data elements.
+   For definition of the buffered data element, see hbuffer.c. */
+extern funclist_t buf_funcs;
+
+/* Functions for accessing compressed raster data elements.
+   For definition of the compressed raster data element, see hcompri.c. */
+extern funclist_t cr_funcs;
+
+/* Table of these function tables for accessing special elements.  The first
+   member of each record is the speical code for that type of data element. */
+functab_t   functab[] =
+{
+	{SPECIAL_LINKED, &linked_funcs},
+	{SPECIAL_EXT, &ext_funcs},
+	{SPECIAL_COMP, &comp_funcs},
+	{SPECIAL_CHUNKED, &chunked_funcs},
+#ifdef LATER
+	{SPECIAL_VLINKED, &vlnk_funcs},
+#endif /* LATER */
+	{SPECIAL_BUFFERED, &buf_funcs},
+	{SPECIAL_COMPRAS, &cr_funcs},
+	{0, NULL}					/* terminating record; add new record */
+			   /* before this line */
+};
+
+/*
+   ** Declaration of private functions.
+ */
+PRIVATE intn HIunlock
+            (filerec_t *file_rec);
+
+PRIVATE filerec_t *HIget_filerec_node
+            (const char *path);
+
+PRIVATE intn HIrelease_filerec_node
+            (filerec_t *file_rec);
+
+PRIVATE intn HIvalid_magic
+            (hdf_file_t file);
+
+PRIVATE intn HIextend_file
+            (filerec_t * file_rec);
+
+PRIVATE funclist_t *HIget_function_table
+            (accrec_t * access_rec);
+
+PRIVATE intn HIupdate_version
+            (int32);
+
+PRIVATE intn HIread_version
+            (int32);
+
+PRIVATE intn HIcheckfileversion
+            (int32 file_id);
+
+PRIVATE intn HIsync
+            (filerec_t *file_rec);
+
+PRIVATE intn HIstart(void);
+
+/* #define TESTING */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hopen -- Opens a HDF file.
+USAGE
+   int32 Hopen(path, access, ndds)
+   char *path;             IN: Name of file to be opened.
+   int access;             IN: DFACC_READ, DFACC_WRITE, DFACC_CREATE
+				or any bitwise-or of the above.
+   int16 ndds;             IN: Number of dds in a block if this
+				file needs to be created.
+RETURNS
+   On success returns file id, on failure returns -1.
+DESCRIPTION
+   Opens an HDF file.  Returns the the file ID on success, or -1
+   on failure.
+
+   Access equals DFACC_CREATE means discard existing file and
+   create new file.  If access is a bitwise-or of DFACC_CREATE
+   and anything else, the file is only created if it does not
+   exist.  DFACC_WRITE set in access also means that if the file
+   does not exist, it is created.  DFACC_READ is assumed to be
+   implied even if it is not set.  DFACC_CREATE implies
+   DFACC_WRITE.
+
+   If the file is already opened and access is DFACC_CREATE:
+   error DFE_ALROPEN.
+   If the file is already opened, the requested access contains
+   DFACC_WRITE, and previous open does not allow write: attempt
+   to reopen the file with write permission.
+
+   On successful exit,
+   * file_rec members are filled in correctly.
+   * file is opened with the relevant permission.
+   * information about dd's are set up in memory.
+   For new file, in addition,
+   * the file headers and initial information are set up properly.
+
+--------------------------------------------------------------------------*/
+int32 
+Hopen(const char *path, intn acc_mode, int16 ndds)
+{
+  CONSTR(FUNC, "Hopen");	/* For HERROR */
+  filerec_t  *file_rec=NULL;/* File record */
+  int         vtag = 0;		/* write version tag? */
+  int32       fid=FAIL;     /* File ID */
+  int32       ret_value = SUCCEED;
+
+  /* Clear errors and check args and all the boring stuff. */
+  HEclear();
+  if (!path || ((acc_mode & DFACC_ALL) != acc_mode))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Perform global, one-time initialization */
+  if (library_terminate == FALSE)
+      if(HIstart()==FAIL)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  /* Get a space to put the file information.
+   * HIget_filerec_node() also copies path into the record. */
+  if ((file_rec = HIget_filerec_node(path))== NULL)
+    HGOTO_ERROR(DFE_TOOMANY, FAIL);	/* The slots are full. */
+
+  if (file_rec->refcount)
+    {	/* File is already opened, check that permission is okay. */
+      /* If this request is to create a new file and file is still
+       * in use, return error. */
+      if (acc_mode == DFACC_CREATE)
+        HGOTO_ERROR(DFE_ALROPEN, FAIL);
+
+      if ((acc_mode & DFACC_WRITE) && !(file_rec->access & DFACC_WRITE))
+        {
+	/* If the request includes writing, and if original open does not
+	   provide for write, then try to reopen file for writing.
+	   This cannot be done on OS (such as the SXOS) where only one
+	   open is allowed per file at any time. */
+#ifndef NO_MULTI_OPEN
+          hdf_file_t  f;
+
+          /* Sync. the file before throwing away the old file handle */
+          if(HIsync(file_rec)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          f =  (hdf_file_t)HI_OPEN(file_rec->path, acc_mode);
+          if (OPENERR(f))
+            HGOTO_ERROR(DFE_DENIED, FAIL);
+
+				/* Replace file_rec->file with new file pointer and
+				   close old one. */
+          if (HI_CLOSE(file_rec->file) == FAIL)
+            {
+              HI_CLOSE(f);
+              HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+            }
+          file_rec->file = f;
+          file_rec->f_cur_off=0;
+          file_rec->last_op=H4_OP_UNKNOWN;
+#else  /* NO_MULTI_OPEN */
+          HGOTO_ERROR(DFE_DENIED, FAIL);
+#endif /* NO_MULTI_OPEN */
+        }
+
+      /* There is now one more open to this file. */
+      file_rec->refcount++;
+    }
+  else
+    {
+      /* Flag to see if file is new and needs to be set up. */
+      intn        new_file = FALSE;
+
+      /* Open the file, fill in the blanks and all the good stuff. */
+      if (acc_mode != DFACC_CREATE)
+        {	/* try to open existing file */
+          file_rec->file =  (hdf_file_t)HI_OPEN(file_rec->path, acc_mode);
+          if (OPENERR(file_rec->file))
+            {
+              if (acc_mode & DFACC_WRITE)
+                {
+                 /* Seems like the file is not there, try to create it. */
+                  new_file = TRUE;
+                }
+              else
+                HGOTO_ERROR(DFE_BADOPEN, FAIL);
+            }
+          else
+            {
+#ifdef STDIO_BUF
+               /* Testing stdio buffered i/o */
+              if (HDsetvbuf(file_rec->file, my_stdio_buf, _IOFBF, MY_STDIO_BUF_SIZE) != 0)
+                HGOTO_ERROR(DFE_BADOPEN, FAIL);
+#endif /* STDIO_BUF */
+               /* Open existing file successfully. */
+              file_rec->access = acc_mode | DFACC_READ;
+
+              /* Check to see if file is a HDF file. */
+              if (!HIvalid_magic(file_rec->file))
+                {
+                  HI_CLOSE(file_rec->file);
+                  HGOTO_ERROR(DFE_NOTDFFILE, FAIL);
+                }
+
+              file_rec->f_cur_off=0;
+              file_rec->last_op=H4_OP_UNKNOWN;
+              /* Read in all the relevant data descriptor records. */
+              if (HTPstart(file_rec) == FAIL)
+                {
+                  HI_CLOSE(file_rec->file);
+                  HGOTO_ERROR(DFE_BADOPEN, FAIL);
+                }
+            }
+        }
+      /* do *not* use else here */
+      if (acc_mode == DFACC_CREATE || new_file)
+        { /* create the file */
+	/* make user we get a version tag */
+          vtag = 1;
+
+          file_rec->file =  (hdf_file_t)HI_CREATE(file_rec->path);
+          if (OPENERR(file_rec->file))
+          {
+	      /* check if the failure was due to "too many open files" */
+              if(errno == EMFILE)
+                {
+                  HGOTO_ERROR(DFE_TOOMANY, FAIL);
+                }
+              else
+                  HGOTO_ERROR(DFE_BADOPEN, FAIL);
+          }
+
+          file_rec->f_cur_off=0;
+          file_rec->last_op=H4_OP_UNKNOWN;
+#ifdef STDIO_BUF
+	/* Testing stdio buffered i/o */
+          if (HDsetvbuf(file_rec->file, my_stdio_buf, _IOFBF, MY_STDIO_BUF_SIZE) != 0)
+            HGOTO_ERROR(DFE_BADOPEN, FAIL);
+#endif /* STDIO_BUF */
+	/* set up the newly created (and empty) file with
+	   the magic cookie and initial data descriptor records */
+          if (HP_write(file_rec, HDFMAGIC, MAGICLEN) == FAIL)
+            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+          if (HI_FLUSH(file_rec->file) == FAIL)	/* flush the cookie */
+            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+          if (HTPinit(file_rec, ndds) == FAIL)
+            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+          file_rec->maxref = 0;
+          file_rec->access = new_file ? acc_mode | DFACC_READ : DFACC_ALL;
+        }
+      file_rec->refcount = 1;
+      file_rec->attach = 0;
+
+      /* currently, default is caching OFF */
+      file_rec->cache = default_cache;
+      file_rec->dirty = 0;	/* mark all dirty flags off to start */
+    }	/* end else */
+
+  file_rec->version_set = FALSE;
+
+  if((fid=HAregister_atom(FIDGROUP,file_rec))==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* version tags */
+  if (vtag == 1)
+    {
+      if(HIupdate_version(fid)==FAIL)
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    } /* end if */
+  else
+    {
+      HIread_version(fid);  /* ignore return code in case the file doesn't have a version */
+    } /* end else */
+
+    ret_value=fid;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(fid!=FAIL)
+          HAremove_atom(fid);
+
+      /* Chuck the file record we've built */
+      if(file_rec!=NULL && file_rec->refcount==0)
+          HIrelease_filerec_node(file_rec);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hopen */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hclose -- close HDF file
+USAGE
+   intn Hclose(id)
+   int id;                 IN: the file id to be closed
+RETURNS
+   returns SUCCEED (0) if successful and FAIL (-1) if failed.
+DESCRIPTION
+   closes an HDF file given the file id.  Id is first validated.  If
+   there are still access objects attached to the file, an error is
+   returned and the file is not closed.
+
+--------------------------------------------------------------------------*/
+intn
+Hclose(int32 file_id)
+{
+  CONSTR(FUNC, "Hclose");	/* for HERROR */
+  filerec_t  *file_rec;		/* file record pointer */
+  intn  ret_value = SUCCEED;
+
+  /* Clear errors and check args and all the boring stuff. */
+  HEclear();
+
+  /* convert file id to file rec and check for validity */
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* version tags */
+  if ((file_rec->refcount > 0) && (file_rec->version.modified == 1))
+      HIupdate_version(file_id);
+
+  /* decrease the reference count */
+  if (--file_rec->refcount == 0)
+    {
+      /* if file reference count is zero but there are still attached
+         access elts, reject this close. */
+      if (file_rec->attach > 0)
+        {
+          file_rec->refcount++;
+          HEreport("There are still %d active aids attached", file_rec->attach);
+          HGOTO_ERROR(DFE_OPENAID, FAIL);
+        } /* end if */
+
+      /* before closing file, check whether to flush file info */
+      if(HIsync(file_rec)==FAIL)
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+      /* otherwise, nothing should still be using this file, close it */
+      /* ignore any close error */
+      HI_CLOSE(file_rec->file);
+
+      if(HTPend(file_rec)==FAIL)
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+      if(HIrelease_filerec_node(file_rec))
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    } /* end if */
+
+    if(HAremove_atom(file_id)==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hclose */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hexist -- locate an object in an HDF file
+USAGE
+   intn Hexist(file_id ,search_tag, search_ref)
+   int32 file_id;           IN: file ID to search in
+   uint16 search_tag;       IN: the tag to search for
+								(can be DFTAG_WILDCARD)
+   uint16 search_ref;       IN: ref to search for
+								(can be DFREF_WILDCARD)
+RETURNS
+   returns SUCCEED (0) if successful and FAIL (-1) otherwise
+DESCRIPTION
+   Simple interface to Hfind which just determines if a given
+   tag/ref pair exists in a file.  Wildcards apply.
+GLOBAL VARIABLES
+COMMENTS, BUGS, ASSUMPTIONS
+	Hfind() does all validity checking, this is just a _very_
+	simple wrapper around it.
+EXAMPLES
+REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hexist(int32 file_id, uint16 search_tag, uint16 search_ref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "Hexist");		/* for HERROR */
+#endif
+  uint16      find_tag = 0, find_ref = 0;
+  int32       find_offset, find_length;
+  intn        ret_value;
+
+  ret_value = (Hfind(file_id, search_tag, search_ref, &find_tag, &find_ref,
+                &find_offset, &find_length, DF_FORWARD));
+  return ret_value;
+}	/* end Hexist() */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hinquire -- inquire stats of an access elt
+USAGE
+   intn Hinquire(access_id, pfile_id, ptag, pref, plength,
+				   poffset, pposn, paccess, pspecial)
+   int access_id;          IN: id of an access elt
+   int32 *pfile_id;        OUT: file id
+   uint16 *ptag;           OUT: tag of the element pointed to
+   uint16 *pref;           OUT: ref of the element pointed to
+   int32 *plength;         OUT: length of the element pointed to
+   int32 *poffset;         OUT: offset of elt in the file
+   int32 *pposn;           OUT: position pointed to within the data elt
+   int16 *paccess;         OUT: the access type of this access elt
+   int16 *pspecial;        OUT: special code
+RETURNS
+   returns SUCCEED (0) if the access elt points to some data element,
+   otherwise FAIL (-1)
+DESCRIPTION
+   Inquire statistics of the data element pointed to by access elt and
+   the access elt.  The access type is set if the access_id is valid even
+   if FAIL is returned.  If access_id is not valid then access is set to
+   zero (0). If statistic is not needed, pass NULL for the appropriate
+   value.
+
+--------------------------------------------------------------------------*/
+intn
+Hinquire(int32 access_id, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+		 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+		 int16 *pspecial)
+{
+  CONSTR(FUNC, "Hinquire");	/* for HERROR */
+  accrec_t   *access_rec;	/* access record */
+  intn   ret_value = SUCCEED;
+
+  /* clear error stack and check validity of access id */
+  HEclear();
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* if special elt, let special functions handle it */
+  if (access_rec->special)
+    {
+      ret_value = (int) (*access_rec->special_func->inquire) (access_rec, pfile_id,
+                           ptag, pref, plength, poffset, pposn, paccess, pspecial);
+      goto done;
+    }
+  if (pfile_id != NULL)
+    *pfile_id = access_rec->file_id;
+  /* Get the relevant DD information */
+  if (HTPinquire(access_rec->ddid,ptag,pref,poffset,plength)==FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+  if (pposn != NULL)
+    *pposn = access_rec->posn;
+  if (paccess != NULL)
+    *paccess = (int16) access_rec->access;
+  if (pspecial != NULL)
+    *pspecial = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hinquire */
+
+
+/* ----------------------------- Hfidinquire ----------------------------- */
+/*
+** NAME
+**      Hfidinquire --- Inquire about a file ID
+** USAGE
+**      int Hfidinquire(file_id)
+**      int32 file_id;          IN: handle of file
+**      char  *path;            OUT: path of file
+**      int32 mode;             OUT: mode file is opened with
+** RETURNS
+**      returns SUCCEED (0) if successful and FAIL (-1) if failed.
+** DESCRIPTION
+** GLOBAL VARIABLES
+** COMMENTS, BUGS, ASSUMPTIONS
+--------------------------------------------------------------------------*/
+intn 
+Hfidinquire(int32 file_id, char **fname, intn *faccess, intn *attach)
+{
+    CONSTR(FUNC, "Hfidinquire");               /* for HERROR */
+    filerec_t *file_rec;
+    intn      ret_value = SUCCEED;
+
+    HEclear();
+
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    *fname  = file_rec->path;
+    *faccess = file_rec->access;
+    *attach = file_rec->attach;
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* Hfidinquire */
+
+/*--------------------------------------------------------------------------
+
+NAME
+   Hstartread -- locate and position a read access elt on a tag/ref
+USAGE
+   int32 Hstartread(fileid, tag, ref)
+   int fileid;             IN: id of file to attach access element to
+   int tag;                IN: tag to search for
+   int ref;                IN: ref to search for
+RETURNS
+   returns id of access element if successful, otherwise FAIL (-1)
+DESCRIPTION
+   Searches the DD's for a particular tag/ref combination.  The
+   searching starts from the head of the DD list.  Wildcards can be
+   used for tag or ref (DFTAG_WILDCARD, DFREF_WILDCARD) and they match
+   any values.  If the search is successful, the access elt is
+   positioned to the start of that tag/ref, otherwise it is an error.
+   An access element is created and attached to the file.
+
+--------------------------------------------------------------------------*/
+int32
+Hstartread(int32 file_id, uint16 tag, uint16 ref)
+{
+  CONSTR(FUNC, "Hstartread");		/* for HERROR */
+  int32       ret;			/* AID to return */
+  int32  ret_value = SUCCEED;
+
+  /* clear error stack */
+  HEclear();
+
+  /* Call Hstartaccess with the modified base tag */
+  if ((ret = Hstartaccess(file_id, BASETAG(tag), ref, DFACC_READ)) == FAIL)
+    HGOTO_ERROR(DFE_BADAID, FAIL);
+
+  ret_value = ret;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hstartread() */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hnextread -- locate and position a read access elt on tag/ref.
+USAGE
+   intn Hnextread(access_id, tag, ref, origin)
+   int32 access_id;         IN: id of a READ access elt
+   uint16 tag;              IN: the tag to search for
+   uint16 ref;              IN: ref to search for
+   int origin;              IN: from where to start searching
+RETURNS
+   returns SUCCEED (0) if successful and FAIL (-1) otherwise
+DESCRIPTION
+   Searches for the `next' DD that fits the tag/ref.  Wildcards
+   apply.  If origin is DF_START, search from start of DD list,
+   if origin is DF_CURRENT, search from current position, otherwise
+   origin should be DF_END which searches from end of file.
+   If the search is successful, then the access elt
+   is positioned at the start of that tag/ref, otherwise, it is not
+   modified.
+COMMENTS, BUGS, ASSUMPTIONS
+DF_END _not_ supported yet!
+
+--------------------------------------------------------------------------*/
+intn
+Hnextread(int32 access_id, uint16 tag, uint16 ref, intn origin)
+{
+  CONSTR(FUNC, "Hnextread");	/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  accrec_t   *access_rec;		/* access record */
+  uint16 new_tag=0, new_ref=0;  /* new tag & ref to access */
+  int32  new_off, new_len;      /* offset & length of new tag & ref */
+  intn        ret_value = SUCCEED;
+
+    /* clear error stack and check validity of the access id */
+    HEclear();
+    access_rec = HAatom_object(access_id);
+    if (access_rec == (accrec_t *) NULL || !(access_rec->access & DFACC_READ)
+            || (origin != DF_START && origin != DF_CURRENT)) /* DF_END is NOT supported yet !!!! */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+  
+    file_rec = HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /*
+   * if access record used to point to an external element we
+   * need to close the file before moving on
+   */
+    if (access_rec->special)
+      {
+        switch(access_rec->special)
+          {
+          case SPECIAL_LINKED:
+            if (HLPcloseAID(access_rec) == FAIL)
+              HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+            break;
+
+          case SPECIAL_EXT:
+            if (HXPcloseAID(access_rec) == FAIL)
+              HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+            break;
+  
+          case SPECIAL_COMP:
+            if (HCPcloseAID(access_rec) == FAIL)
+              HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+            break;
+
+          case SPECIAL_CHUNKED:
+            if (HMCPcloseAID(access_rec) == FAIL)
+              HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+            break;
+  
+          case SPECIAL_BUFFERED:
+            if (HBPcloseAID(access_rec) == FAIL)
+              HGOTO_ERROR(DFE_CANTCLOSE, FAIL);
+            break;
+  
+          default:    /* do nothing for other cases currently */
+            break;
+          } /* end switch */
+      }
+
+    if (origin == DF_START)
+      {		/* set up variables to start searching from beginning of file */
+        new_tag=0;
+        new_ref=0;
+      }
+    else
+      {	/* origin == CURRENT */
+          /* set up variables to start searching from the current position */
+        /* Get the old tag & ref */
+        if(HTPinquire(access_rec->ddid,&new_tag,&new_ref,NULL,NULL)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+
+    /* go look for the dd */
+    if(Hfind(access_rec->file_id,tag,ref,&new_tag,&new_ref,&new_off,&new_len,DF_FORWARD)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Let go of the previous DD id */
+    if (HTPendaccess(access_rec->ddid) == FAIL)
+        HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+
+    /* found, so update the access record */
+    if((access_rec->ddid=HTPselect(file_rec,new_tag,new_ref))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    access_rec->appendable = FALSE;		/* start data as non-appendable */
+    if (new_len == INVALID_OFFSET && new_off == INVALID_LENGTH)
+        access_rec->new_elem = TRUE;
+    else
+        access_rec->new_elem = FALSE;
+
+    /* If special element act upon it accordingly */
+    if (HTPis_special(access_rec->ddid))
+      {
+        int32 spec_aid;
+
+        /* special element, call special function to handle */
+        if((access_rec->special_func = HIget_function_table(access_rec))==NULL)
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* decrement "attach" to the file_rec */
+        HIunlock(file_rec);
+        if ((spec_aid=(*access_rec->special_func->stread) (access_rec)) != FAIL)
+          {
+            HAremove_atom(spec_aid); /* This is a gross hack! -QAK */
+            HGOTO_DONE(SUCCEED);
+          } /* end if */
+        else
+          {
+            HGOTO_DONE(FAIL);
+          } /* end if */
+      }
+  
+    access_rec->special = 0;
+    access_rec->posn = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hnextread() */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hstartwrite -- set up a WRITE access elt for a write
+USAGE
+   int32 Hstartwrite(fileid, tag, ref, len)
+   int fileid;             IN: id of file to write to
+   int tag;                IN: tag to write to
+   int ref;                IN: ref to write to
+   long length;            IN: the length of the data element
+RETURNS
+   returns id of access element if successful and FAIL otherwise
+DESCRIPTION
+   Set up a WRITE access elt to write out a data element.  The DD list
+   of the file is searched first.  If the tag/ref is found, it is
+   NOT replaced - the seek position is presumably at 0.
+			If it does not exist, it is created.
+
+--------------------------------------------------------------------------*/
+int32
+Hstartwrite(int32 file_id, uint16 tag, uint16 ref, int32 length)
+{
+  CONSTR(FUNC, "Hstartwrite");	/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  int32       ret;			/* AID to return */
+  int32       ret_value = SUCCEED;
+
+  /* clear error stack */
+  HEclear();
+
+  /* Call Hstartaccess with the modified base tag */
+  if ((ret = Hstartaccess(file_id, BASETAG(tag), ref, DFACC_RDWR)) == FAIL)
+    HGOTO_ERROR(DFE_BADAID, FAIL);
+
+  access_rec = HAatom_object(ret);
+
+  /* if new element set the length */
+  if (access_rec->new_elem       
+      && (Hsetlength(ret, length) == FAIL))
+    {
+      Hendaccess(ret);
+      HGOTO_ERROR(DFE_BADLEN, FAIL);
+    }		/* end if */
+
+    ret_value = ret;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hstartwrite */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hstartaccess -- set up a access elt for either reading or writing
+USAGE
+   int32 Hstartaccess(fileid, tag, ref, flags)
+   int32 fileid;           IN: id of file to read/write to
+   uint16 tag;             IN: tag to read/write to
+   uint16 ref;             IN: ref to read/write to
+   uint32 flags;           IN: access flags for the data element
+RETURNS
+   returns id of access element if successful and FAIL otherwise
+DESCRIPTION
+   Start access to data element for read or write access.  The DD list
+   of the file is searched first.  If the tag/ref is found, it is
+   NOT replaced - the seek position is presumably at 0.
+			If it does not exist, it is created.
+
+--------------------------------------------------------------------------*/
+int32
+Hstartaccess(int32 file_id, uint16 tag, uint16 ref, uint32 flags)
+{
+  CONSTR(FUNC, "Hstartaccess");	/* for HERROR */
+  intn        ddnew = FALSE;	/* is the dd a new one? */
+  filerec_t  *file_rec=NULL;		/* file record */
+  accrec_t   *access_rec=NULL;		/* access record */
+  uint16 new_tag=0, new_ref=0;      /* new tag & ref to access */
+  int32  new_off, new_len;      /* offset & length of new tag & ref */
+  int32      ret_value = SUCCEED;
+
+  /* clear error stack and check validity of file id */
+  HEclear();
+
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* If writing, can we write to this file? */
+  if ((flags & DFACC_WRITE) && !(file_rec->access & DFACC_WRITE))
+    HGOTO_ERROR(DFE_DENIED, FAIL);
+
+  /* get empty slot in access records */
+  access_rec = HIget_access_rec();
+  if (access_rec == NULL)
+    HGOTO_ERROR(DFE_TOOMANY, FAIL);
+
+  /* set up access record to look for the dd */
+  access_rec->file_id = file_id;
+  if (flags & DFACC_APPENDABLE)
+    access_rec->appendable = TRUE;	/* start data as appendable */
+  else
+    access_rec->appendable = FALSE;	/* start data as non-appendable */
+
+  /* set the default values for block size and number of blocks for use in */
+  /* linked-block creation/conversion; they can be changed by the user via */
+  /* VSsetblocksize and VSsetnumblocks - BMR (bug #267 - June 2001) */
+  access_rec->block_size = HDF_APPENDABLE_BLOCK_LEN;
+  access_rec->num_blocks = HDF_APPENDABLE_BLOCK_NUM;
+
+  access_rec->special_info = NULL; /* reset */
+
+  /* if the DFACC_CURRENT flag is set, start searching for the tag/ref from */
+  /* the current location in the DD list */
+  if (flags & DFACC_CURRENT 
+      || Hfind(access_rec->file_id,tag,ref,&new_tag,&new_ref,
+               &new_off,&new_len,DF_FORWARD)==FAIL)
+    { /* not in DD list */
+        new_tag=tag;
+        new_ref=ref;
+        new_off=INVALID_OFFSET;
+        new_len=INVALID_LENGTH;
+    }
+
+  /* get DD id for tag/ref if in DD list using 'new_tag' and 'new_ref' */
+  if ((access_rec->ddid = HTPselect(file_rec, new_tag, new_ref)) == FAIL)
+    { /* not in DD list */
+      /* can't create data elements with only read access */
+      if (!(flags & DFACC_WRITE))
+          HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+      /* dd not found, so have to create new element */
+      if((access_rec->ddid = HTPcreate(file_rec,new_tag,new_ref))==FAIL)
+          HGOTO_ERROR(DFE_NOFREEDD, FAIL);
+
+      ddnew = TRUE; /* mark as new element */
+    }		
+  else     /* tag/ref already exists in DD list. */
+    {   /* need to update the access_rec block and idx */
+
+      /* If the tag we were looking up is special, and we aren't looking */
+      /* for the actual special element information, then use special */
+      /* element access to the data... -QAK */
+      if (!SPECIALTAG(tag) && HTPis_special(access_rec->ddid)==TRUE)
+        { /* found, if this elt is special, let special function handle it */
+
+            /* get special function table for element */
+            access_rec->special_func = HIget_function_table(access_rec);
+            if (access_rec->special_func==NULL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+            /* call appropriate special startread/startwrite fcn */
+          if (!(flags & DFACC_WRITE))
+            ret_value = (*access_rec->special_func->stread) (access_rec);
+          else
+            ret_value = (*access_rec->special_func->stwrite) (access_rec);
+
+          goto done; /* we are done since the special fcn should take
+                        of everthing. */
+
+        }	/* end if special */
+    }		/* end else tag/ref exists */
+
+  /* Need to check if the "new" element was written to the file without */
+  /* it's length being set.  If that was the case, the offset and length */
+  /* will be marked as invalid, and therefore we should mark it as "new" */
+  /* again when the element is re-opened -QAK */
+  if (!ddnew && new_off == INVALID_OFFSET && new_len == INVALID_LENGTH)
+    ddnew = TRUE; /* mark as new element */
+
+  /* update the access record, and the file record */
+  access_rec->posn     = 0;
+  access_rec->access   = flags;		/* keep the access flags around */
+  access_rec->file_id  = file_id;
+  access_rec->special  = 0;     /* not special */
+  access_rec->new_elem = ddnew;	/* set the flag indicating whether 
+                                   this elt is new */
+  file_rec->attach++; /* increment number of elts attached to file */
+
+  /* check current maximum ref for file and update if necessary */
+  if (new_ref > file_rec->maxref)
+    file_rec->maxref = new_ref;
+
+  /*
+   * If this is the first time we are writting to this file
+   *    update the version tags as needed */
+  if (!file_rec->version_set)
+    HIcheckfileversion(file_id);
+
+  ret_value = HAregister_atom(AIDGROUP,access_rec);
+ 
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(access_rec!=NULL)
+            HIrelease_accrec_node(access_rec);
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hstartaccess */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hsetlength -- set the length of a new HDF element
+USAGE
+   intn Hsetlength(aid, length)
+   int32 aid;           IN: id of element to set the length of
+   int32 length;        IN: the length of the element
+RETURNS
+   SUCCEED/FAIL
+DESCRIPTION
+   Sets the length of a new data element.  This function is only valid
+   when called after Hstartaccess on a new data element and before
+   any data is written to that element.
+
+--------------------------------------------------------------------------*/
+intn
+Hsetlength(int32 aid, int32 length)
+{
+  CONSTR(FUNC, "Hsetlength");		/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  filerec_t  *file_rec;		/* file record */
+  int32       offset;			/* offset of this data element in file */
+  intn       ret_value = SUCCEED;
+
+  /* clear error stack and check validity of file id */
+  HEclear();
+
+  if ((access_rec = HAatom_object(aid)) == NULL)	/* get the access_rec pointer */
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Check whether we are allowed to change the length */
+  if (access_rec->new_elem != TRUE)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  file_rec = HAatom_object(access_rec->file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* place the data element at the end of the file and record its offset */
+  if ((offset = HPgetdiskblock(file_rec, length, FALSE)) == FAIL)
+      HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+
+  /* fill in dd record updating the offset and length of the element */
+  if(HTPupdate(access_rec->ddid,offset,length)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* turn off the "new" flag now that we have a length and offset */
+  access_rec->new_elem = FALSE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hsetlength */
+
+/*--------------------------------------------------------------------------
+NAME
+   Happendable -- Allow a data set to be appended to without the
+	use of linked blocks
+USAGE
+   intn Happendable(aid)
+   int32 aid;              IN: aid of the dataset to make appendable
+RETURNS
+   returns 0 if dataset is allowed to be appendable, FAIL otherwise
+DESCRIPTION
+   If a dataset is at the end of a file, allow Hwrite()s to write
+   past the end of a file.  Allows expanding datasets without the use
+   of linked blocks.
+
+--------------------------------------------------------------------------*/
+intn
+Happendable(int32 aid)
+{
+  CONSTR(FUNC, "Happendable");	/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  intn   ret_value = SUCCEED;
+
+  /* clear error stack and check validity of file id */
+  HEclear();
+  if ((access_rec = HAatom_object(aid)) == NULL)	/* get the access_rec pointer */
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* just indicate that the data should be appendable, and only convert */
+  /* it when actually asked to modify the data */
+  access_rec->appendable = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Happendable */
+
+/*--------------------------------------------------------------------------
+NAME
+   HPisappendable -- Check whether a data set can be appended to without the
+	use of linked blocks
+USAGE
+   intn HPisappendable(aid)
+   int32 aid;              IN: aid of the dataset to check appendable
+RETURNS
+   returns SUCCEED if dataset is allowed to be appendable, FAIL otherwise
+DESCRIPTION
+   If a dataset is at the end of a file, allow Hwrite()s to write
+   past the end of a file.  Allows expanding datasets without the use
+   of linked blocks.
+
+--------------------------------------------------------------------------*/
+intn
+HPisappendable(int32 aid)
+{
+  CONSTR(FUNC, "HPisappendable");		/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  filerec_t  *file_rec;		/* file record */
+  int32       data_len;		/* length of the data we are checking */
+  int32       data_off;		/* offset of the data we are checking */
+  intn        ret_value = SUCCEED;
+
+  /* clear error stack and check validity of file id */
+  HEclear();
+  if ((access_rec = HAatom_object(aid)) == NULL)	/* get the access_rec pointer */
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  file_rec = HAatom_object(access_rec->file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* get the offset and length of the dataset */
+  if(HTPinquire(access_rec->ddid,NULL,NULL,&data_len,&data_off)==FAIL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* dataset at end? */
+  if (data_len + data_off == file_rec->f_end_off)	
+    ret_value = SUCCEED;
+  else
+    ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end HPisappendable */
+
+/*--------------------------------------------------------------------------
+
+NAME
+   Hseek -- position an access element to an offset in data element
+USAGE
+   intn Hseek(access_id, offset, origin)
+   int32 access_id;        IN: id of access element
+   long offset;            IN: offset to seek to
+   int origin;             IN: position to seek from by offset, 0: from
+						   beginning; 1: current position; 2: end of
+						   data element
+RETURNS
+   returns FAIL (-1) if fail, SUCCEED (0) otherwise.
+DESCRIPTION
+   Sets the position of an access element in a data element so that the
+   next Hread or Hwrite will start from that position.  origin
+   determines the position from which the offset should be added.  This
+   routine fails if the access elt is not associated with any data
+   element and if the seeked position is outside of the data element.
+
+--------------------------------------------------------------------------*/
+intn
+Hseek(int32 access_id, int32 offset, intn origin)
+{
+  CONSTR(FUNC, "Hseek");	/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  intn        old_offset = offset;	/* save for later potential use */
+  filerec_t  *file_rec;		/* file record */
+  int32       data_len;		/* length of the data we are checking */
+  int32       data_off;		/* offset of the data we are checking */
+  intn        ret_value = SUCCEED;
+
+  /* clear error stack and check validity of this access id */
+  HEclear();
+
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL
+      || (origin != DF_START && origin != DF_CURRENT && origin != DF_END))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* if special elt, use special function */
+  if (access_rec->special)
+    { /* yes, call special seek fucntion with proper args */
+      ret_value = (intn) (*access_rec->special_func->seek) (access_rec, offset, origin);
+      goto done;
+    }
+
+  /* Get the data's offset & length */
+  if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,&data_len)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      
+  /* calculate real offset based on the origin */
+  if (origin == DF_CURRENT)
+    offset += access_rec->posn;
+  if (origin == DF_END)
+    offset += data_len;
+
+  /* If we aren't moving the access records position, bypass the next bit of code */
+  /* This allows seeking to offset zero in not-yet-existent data elements -QAK */
+  if(offset==access_rec->posn)
+      HGOTO_DONE(SUCCEED);
+
+  /* Check the range */
+  if (offset < 0 || (!access_rec->appendable && offset > data_len))
+    {
+      HEreport("Tried to seek to %d (object length:  %d)", offset, data_len);
+      HGOTO_ERROR(DFE_BADSEEK, FAIL);
+    }
+
+/* check if element is appendable and writing past current element length */
+  if (access_rec->appendable && offset >= data_len)
+    { /* yes */
+      file_rec = HAatom_object(access_rec->file_id);
+
+      /* check if we are at end of file */
+      if (data_len + data_off != file_rec->f_end_off)
+          {	/* nope, so try to convert element into linked-block element */
+            if (HLconvert(access_id, access_rec->block_size, access_rec->num_blocks) == FAIL)
+              {
+                access_rec->appendable = FALSE;
+                HEreport("Tried to seek to %d (object length:  %d)", offset, data_len);
+                HGOTO_ERROR(DFE_BADSEEK, FAIL);
+              }		/* end if */
+            else
+               /* successfully converted the element into a linked block */
+               /* now loop back and actually seek to the correct position */
+              {
+                if (Hseek(access_id, old_offset, origin) == FAIL)
+                  HGOTO_ERROR(DFE_BADSEEK, FAIL);
+              }		/* end else */
+          }	/* end if */
+    } /* end if */
+
+  /* set the new position */
+  access_rec->posn = offset;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hseek() */
+
+/*--------------------------------------------------------------------------
+
+NAME
+   Htell -- report position of an access element in a data element
+USAGE
+   int32 Htell(access_id)
+       int32 access_id;        IN: id of access element
+RETURNS
+   returns FAIL (-1) on error, offset in data element otherwise
+DESCRIPTION
+    Reports the offset in bytes of an AID in a data element.  Analogous to
+    ftell().
+
+--------------------------------------------------------------------------*/
+int32
+Htell(int32 access_id)
+{
+  CONSTR(FUNC, "Htell");	/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  int32     ret_value = SUCCEED;
+
+  /* clear error stack and check validity of this access id */
+  HEclear();
+
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* return the offset in the AID */
+  ret_value = (int32)access_rec->posn;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Htell() */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hread -- read the next segment from data element
+USAGE
+   int32 Hread(access_id, length, data)
+   int32 access_id;        IN: id of READ access element
+   int32 length;           IN: length of segment to read in
+   char *data;             OUT: pointer to data array to read to
+RETURNS
+   returns length of segment actually read in if successful and FAIL
+   (-1) otherwise
+DESCRIPTION
+   Read in the next segment in the data element pointed to by the
+   access elt.  If length is zero or larger than the remaining bytes
+   of the object, read until the end of the object.
+
+--------------------------------------------------------------------------*/
+int32
+Hread(int32 access_id, int32 length, void * data)
+{
+  CONSTR(FUNC, "Hread");	/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  accrec_t   *access_rec;		/* access record */
+  int32       data_len;		/* length of the data we are checking */
+  int32       data_off;		/* offset of the data we are checking */
+  int32      ret_value = SUCCEED;
+
+  /* clear error stack and check validity of access id */
+  HEclear();
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL || data == NULL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Don't allow reading of "new" elements */
+  if (access_rec->new_elem == TRUE)
+    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+  /* special elt, so call special function */
+  if (access_rec->special)
+    { /* yes, call special read function with proper args */
+      ret_value = (*access_rec->special_func->read) (access_rec, length, data);
+      goto done; /* we are done */
+    }
+
+  /* check validity of file record */
+  file_rec = HAatom_object(access_rec->file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* get the dd of this data elt */
+  if (length < 0)
+    HGOTO_ERROR(DFE_BADSEEK, FAIL);
+
+  /* Get the data's offset & length */
+  if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,&data_len)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      
+  /* seek to position to start reading and read in data */
+  if (HPseek(file_rec, access_rec->posn + data_off) == FAIL)
+    HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+
+  /* length == 0 means to read to end of element, */
+  /* if read length exceeds length of elt, read till end of elt */
+  if (length == 0 || length + access_rec->posn > data_len)
+    length = data_len - access_rec->posn;
+
+  /* read in data */
+  if (HP_read(file_rec, data, length) == FAIL)
+    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+  /* move the position of the access record */
+  access_rec->posn += length;
+
+  ret_value = length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hread */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hwrite -- write next data segment to data element
+USAGE
+   int32 Hwrite(access_id, len, data)
+   int32 access_id;        IN: id of WRITE access element
+   int32 len;              IN: length of segment to write
+   const char *data;       IN: pointer to data to write
+RETURNS
+   returns length of segment successfully written, FAIL (-1) otherwise
+DESCRIPTION
+   Write the data to data element where the last write or Hseek()
+   stopped.  If the space reserved is less than the length to write,
+   then only as much as can fit is written.  It is the responsibility
+   of the user to insure that no two access elements are writing to the
+   same data element.  It is possible to interlace writes to more than
+   one data elements in the same file though.
+   Calling with length == 0 is an error.
+
+--------------------------------------------------------------------------*/
+int32
+Hwrite(int32 access_id, int32 length, const void * data)
+{
+  CONSTR(FUNC, "Hwrite");		/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  accrec_t   *access_rec;		/* access record */
+  int32       data_len;		/* length of the data we are checking */
+  int32       data_off;		/* offset of the data we are checking */
+  int32       ret_value = SUCCEED;
+
+  /* clear error stack and check validity of access id */
+  HEclear();
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL 
+      || !(access_rec->access & DFACC_WRITE)
+      || data == NULL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+
+  /* if special elt, call special write function */
+  if (access_rec->special)
+    {
+      ret_value = (*access_rec->special_func->write) (access_rec, length, data);
+      goto done; /* we are done */
+    } /* end special */
+
+  /* check validity of file record and get dd ptr */
+  file_rec = HAatom_object(access_rec->file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* check for a "new" element and make it appendable if so.
+     Does this mean every element is by default appendable? */
+  if (access_rec->new_elem == TRUE)
+    {
+      Hsetlength(access_id, length);	/* make the initial chunk of data */
+      access_rec->appendable = TRUE;	/* make it appendable */
+    }		/* end if */
+
+
+  /* get the offset and length of the element. This should have
+     been set by Hstartwrite(). */
+  if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,&data_len)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* check validity of length and write data.
+   NOTE: it is an error to attempt write past the end of the elt */
+  if (length <= 0 
+      || (!access_rec->appendable && length + access_rec->posn > data_len))
+    HGOTO_ERROR(DFE_BADSEEK, FAIL);
+
+  /* check if element is appendable and write length exceeds current 
+     data element length */
+  if (access_rec->appendable && length + access_rec->posn > data_len)
+    { /* yes */
+
+        /* is data element at end of file? 
+           hmm. not sure about this condition. */
+      if (data_len + data_off != file_rec->f_end_off)
+        {	/* nope, not at end of file. Try to promote to
+               linked-block element. */
+          if (HLconvert(access_id, access_rec->block_size, access_rec->num_blocks) == FAIL)
+            {
+              access_rec->appendable = FALSE;
+              HGOTO_ERROR(DFE_BADSEEK, FAIL);
+            }		/* end if */
+            /* successfully converted the element into a linked block */
+            /* now loop back and actually write the data out */
+          if ((ret_value = Hwrite(access_id, length, data)) == FAIL)
+            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+          goto done;    /* we're finished, wrap things up */
+        }	/* end if */
+
+      /* Update the DD with the new length. Note argument of '-2' for
+         the offset parameter means not to change the offset in the DD. */
+      if(HTPupdate(access_rec->ddid,-2,access_rec->posn+length)==FAIL)
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }		/* end if */
+
+  /* seek and write data */
+  if (HPseek(file_rec, access_rec->posn + data_off) == FAIL)
+    HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+
+  if (HP_write(file_rec, data, length) == FAIL)
+    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+  /* update end of file pointer? */
+  if (file_rec->f_cur_off > file_rec->f_end_off)
+    file_rec->f_end_off = file_rec->f_cur_off;
+
+  /* update position of access in elt */
+  access_rec->posn += length;
+
+  ret_value = length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hwrite */
+
+/*--------------------------------------------------------------------------
+NAME
+   HDgetc -- read a byte from data element
+USAGE
+   intn HDgetc(access_id)
+   int access_id;          IN: id of READ access element
+
+RETURNS
+   returns byte read in from data if successful and FAIL
+   (-1) otherwise
+
+DESCRIPTION
+	Calls Hread() to read a single byte and reports errors.
+
+--------------------------------------------------------------------------*/
+intn
+HDgetc(int32 access_id)
+{
+  CONSTR(FUNC, "HDgetc");		 /* for HERROR */
+  uint8       c=(uint8)FAIL;		     /* character read in */
+  intn    ret_value = SUCCEED;
+
+  if (Hread(access_id, 1, &c) == FAIL)
+    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+  ret_value = (intn)c;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HDgetc */
+
+/*--------------------------------------------------------------------------
+NAME
+
+USAGE
+   intn HDputc(c,access_id)
+   uint8 c;                 IN: byte to write out
+   int32 access_id;         IN: id of WRITE access element
+
+RETURNS
+   returns byte written out to data if successful and FAIL
+   (-1) otherwise
+
+DESCRIPTION
+   Calls Hwrite() to write a single byte and reports errors.
+
+--------------------------------------------------------------------------*/
+intn
+HDputc(uint8 c, int32 access_id)
+{
+  CONSTR(FUNC, "HDputc");		/* for HERROR */
+  intn ret_value = SUCCEED;
+
+  if (Hwrite(access_id, 1, &c) == FAIL)
+    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+  ret_value = (intn)c;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HDputc */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hendaccess -- to dispose of an access element
+USAGE
+   intn Hendaccess(access_id)
+   int32 access_id;          IN: id of access element to dispose of
+RETURNS
+   returns SUCCEED (0) if successful, FAIL (-1) otherwise
+DESCRIPTION
+   Used to dispose of an access element.  If access elements are not
+   disposed it will eventually become impossible to allocate new
+   ones and close the file.
+
+   If there are active aids Hclose will *NOT* close the file.  This
+   is a very common problem when developing new code.
+
+--------------------------------------------------------------------------*/
+intn
+Hendaccess(int32 access_id)
+{
+    CONSTR(FUNC, "Hendaccess");		/* for HERROR */
+    filerec_t  *file_rec;		/* file record */
+    accrec_t   *access_rec=NULL;/* access record */
+    intn        ret_value = SUCCEED;
+
+    /* clear error stack and check validity of access id */
+    HEclear();
+    if ((access_rec = HAremove_atom(access_id))==NULL)
+      HGOTO_ERROR(DFE_ARGS, FAIL);
+  
+    /* if special elt, call special function */
+    if (access_rec->special)
+      {
+        ret_value = (*access_rec->special_func->endaccess) (access_rec);
+        goto done;
+      } /* end if */
+
+    /* check validity of file record */
+    file_rec = HAatom_object(access_rec->file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* update file and access records */
+    if (HTPendaccess(access_rec->ddid) == FAIL)
+        HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+
+    file_rec->attach--;
+#ifdef OLD_WAY
+    if(HAremove_atom(access_id)==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+#endif /* OLD_WAY */
+    HIrelease_accrec_node(access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+      if(access_rec!=NULL)
+        HIrelease_accrec_node(access_rec);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hendaccess */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hgetelement -- read in a data element
+USAGE
+   int32 Hgetelement(file_id, tag, ref, data)
+   int32 file_id;          IN: id of the file to read from
+   int16 tag;              IN: tag of data element to read
+   int16 ref;              IN: ref of data element to read
+   char *data;             OUT: buffer to read into
+RETURNS
+   returns  number of bytes read if successful, FAIL (-1)
+   otherwise
+DESCRIPTION
+   Read in a data element from a HDF file and puts it into buffer
+   pointed to by data.  The space allocated for buffer is assumed to
+   be large enough.
+
+--------------------------------------------------------------------------*/
+int32
+Hgetelement(int32 file_id, uint16 tag, uint16 ref, uint8 *data)
+{
+  CONSTR(FUNC, "Hgetelement");	/* for HERROR */
+  int32       access_id=FAIL;   /* access record id */
+  int32       length;			/* length of this elt */
+  int32       ret_value = SUCCEED;
+
+  /* clear error stack */
+  HEclear();
+
+  /* get the access record, get the length of the elt, read in data,
+   and dispose of access record */
+  if (( access_id = Hstartread(file_id, tag, ref))== FAIL)
+    HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+  if ((length = Hread(access_id, (int32) 0, data)) == FAIL)
+      HGOTO_ERROR(DFE_READERROR, FAIL);
+
+  if(Hendaccess(access_id)==FAIL)
+      HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+  ret_value = length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(access_id!=FAIL)
+          Hendaccess(access_id);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hgetelement() */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hputelement -- writes a data element
+USAGE
+   int Hputelement(fileid, tag, ref, data, length)
+   int32 fileid;             IN: id of file
+   int16 tag;                IN: tag of data element to put
+   int16 ref;                IN: ref of data element to put
+   char *data;               IN: pointer to buffer
+   int32 length;             IN: length of data
+RETURNS
+   returns length of bytes written if successful and FAIL (-1)
+   otherwise
+DESCRIPTION
+   Writes a data element or replaces an existing data element
+   in an HDF file.  Uses Hwrite and its associated routines.
+
+--------------------------------------------------------------------------*/
+int32
+Hputelement(int32 file_id, uint16 tag, uint16 ref, const uint8 *data,
+			int32 length)
+{
+  CONSTR(FUNC, "Hputelement");	/* for HERROR */
+  int32       access_id=FAIL;   /* access record id */
+  int32       ret_value = SUCCEED;
+
+  /* clear error stack */
+  HEclear();
+
+  /* get access record, write out data and dispose of access record */
+  if (( access_id = Hstartwrite(file_id, (uint16) tag, (uint16) ref, length))== FAIL)
+    HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+  if ((ret_value = Hwrite(access_id, length, data)) == FAIL)
+    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+  if(Hendaccess(access_id)==FAIL)
+      HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        if(access_id!=FAIL)
+          Hendaccess(access_id);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hputelement() */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hlength -- returns length of a data element
+USAGE
+   int32 Hlength(fileid, tag, ref)
+   int fileid;             IN: id of file
+   int tag;                IN: tag of data element
+   int ref;                IN: ref of data element
+RETURNS
+   return the length of a data element or FAIL if there is a problem.
+DESCRIPTION
+   returns length of data element if it is present in the file.
+   Return FAIL (-1) if it is not in the file or an error occurs.
+
+   The current implementation is probably less efficient than it
+   could be.  However, because of special elements the code is much
+   cleaner this way.
+
+--------------------------------------------------------------------------*/
+int32
+Hlength(int32 file_id, uint16 tag, uint16 ref)
+{
+#ifdef FASTER_BUT_DOESNT_WORK
+  CONSTR(FUNC, "Hlength");	/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  ddblock_t  *block;			/* DDB containing DD of  element */
+  int32       idx;			/* index into DDB i.e. DD of element */
+  int32       ret_value = SUCCEED;
+
+  /* clear error stack */
+  HEclear();
+
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  block = file_rec->ddhead;
+  idx = -1;
+  if (HIlookup_dd(file_rec, tag, ref, &block, &idx) == FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  ret_value = block->ddlist[idx].length;
+  
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+#else /* FASTER_BUT_DOESNT_WORK */
+  CONSTR(FUNC, "Hlength");    /* for HERROR */
+  int32       access_id;      /* access record id */
+  int32       length=FAIL;    /* length of elt inquired */
+  int32       ret_value = SUCCEED;
+
+  /* clear error stack */
+  HEclear();
+
+  /* get access record, inquire about lebngth and then dispose of
+       access record */
+  access_id = Hstartread(file_id, tag, ref);
+  if (access_id == FAIL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if ((ret_value = HQuerylength(access_id, &length)) == FAIL)
+    HERROR(DFE_INTERNAL);
+  
+  if(Hendaccess(access_id)==FAIL)
+      HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+  ret_value = length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+#endif /* FASTER_BUT_DOESNT_WORK */
+}	/* end Hlength */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hoffset -- get offset of data element in the file
+USAGE
+   int32 Hoffset(fileid, tag, ref)
+   int32 fileid;           IN: id of file
+   uint16 tag;             IN: tag of data element
+   uint16 ref;             IN: ref of data element
+RETURNS
+   returns offset of data element if it is present in the
+   file or FAIL (-1) if it is not.
+
+DESCRIPTION
+   This should be used for debugging purposes only since
+   the user should not have to know the actual offset of
+   a data element in a file.
+
+   Like Hlength().  This could be sped up by not going through
+   Hstartread() but because of special elements it is easier
+   this way
+
+--------------------------------------------------------------------------*/
+int32
+Hoffset(int32 file_id, uint16 tag, uint16 ref)
+{
+  CONSTR(FUNC, "Hoffset");	/* for HERROR */
+  int32       access_id;	/* access record id */
+  int32       offset=FAIL;	/* offset of elt inquired */
+  int32       ret_value = SUCCEED;
+
+  /* clear error stack */
+  HEclear();
+
+  /* get access record, inquire offset, and dispose of access record */
+  access_id = Hstartread(file_id, tag, ref);
+  if (access_id == FAIL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if ((ret_value = HQueryoffset(access_id, &offset)) == FAIL)
+    HERROR(DFE_INTERNAL);
+
+  if(Hendaccess(access_id)==FAIL)
+      HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+  ret_value = offset;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hoffset */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hishdf -- tells if a file is an HDF file
+USAGE
+   intn Hishdf(path)
+   const char *path;             IN: name of file
+RETURNS
+   returns TRUE (non-zero) if file is HDF, FALSE (0) otherwise
+DESCRIPTION
+   This user level routine can be used to determine if a file
+   with a given name is an HDF file.  Note, just because a file
+   is not an HDF file does not imply that all HDF library
+   functions can not work on it.
+
+--------------------------------------------------------------------------*/
+intn
+Hishdf(const char *filename)
+{
+#ifdef LATER
+  CONSTR(FUNC, "Hishdf");
+#endif /* LATER */
+
+  intn        ret;
+  hdf_file_t  fp;
+  intn   ret_value = TRUE;
+
+  /* Search for a matching slot in the already open files. */
+  if(HAsearch_atom(FIDGROUP,HPcompare_filerec_path,filename)!=NULL)
+      HGOTO_DONE(TRUE);
+
+  fp =  (hdf_file_t)HI_OPEN(filename, DFACC_READ);
+  if (OPENERR(fp))
+    {
+      ret_value = FALSE;
+    }
+  else
+    {
+      ret = HIvalid_magic(fp);
+      HI_CLOSE(fp);
+      ret_value = (int) ret;
+    }
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hishdf */
+
+/*--------------------------------------------------------------------------
+NAME
+   Htrunc -- truncate a data element to a length
+USAGE
+   int32 Htrunc(aid, len)
+   int32 aid;             IN: id of file
+   int32 len;             IN: length at which to truncate data element
+RETURNS
+   return the length of a data element
+DESCRIPTION
+   truncates a data element in the file.  Return
+   FAIL (-1) if it is not in the file or an error occurs.
+
+--------------------------------------------------------------------------*/
+int32
+Htrunc(int32 aid, int32 trunc_len)
+{
+  CONSTR(FUNC, "Htrunc");		/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  int32       data_len;		/* length of the data we are checking */
+  int32       data_off;		/* offset of the data we are checking */
+  int32      ret_value = SUCCEED;
+
+  /* clear error stack and check validity of access id */
+  HEclear();
+  access_rec = HAatom_object(aid);
+  if (access_rec == (accrec_t *) NULL || !(access_rec->access & DFACC_WRITE))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* Dunno about truncating special elements... -QAK */
+#ifdef DONT_KNOW
+  /* if special elt, call special function */
+  if (access_rec->special)
+    {
+      ret_value = (*access_rec->special_func->write) (access_rec, length, data);
+      goto done;
+    }
+#endif
+
+  /* get the offset and length of the dataset */
+  if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,&data_len)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* check for actually being able to truncate the data */
+  if (data_len > trunc_len)
+    {
+      /* set the new length of the dataset.
+         Note value of '-2' for the offset paramter means not to update
+         the offset in the DD.*/
+      if(HTPupdate(access_rec->ddid,-2,trunc_len)==FAIL)
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      if (access_rec->posn > trunc_len)		/* move the seek position back */
+        access_rec->posn = trunc_len;
+      ret_value =  trunc_len;
+    }		/* end if */
+  else
+    HGOTO_ERROR(DFE_BADLEN, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Htrunc() */
+
+/*--------------------------------------------------------------------------
+NAME
+   HIsync -- sync file with memory
+USAGE
+   intn HIsync(file_rec)
+   filerec_t *file_rec;            IN: file record of file
+RETURNS
+   returns SUCCEED (0) if sucessful, FAIL (-1) otherwise
+DESCRIPTION
+    HIsync() performs the actual sync'ing of the file in memory & on disk.
+NOTE
+
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIsync(filerec_t *file_rec)
+{
+  CONSTR(FUNC, "HIsync");	/* for HERROR */
+  intn    ret_value = SUCCEED;
+
+  /* check whether to flush the file info */
+  if (file_rec->cache && file_rec->dirty)
+    {
+      /* flush DD blocks if necessary */
+      if (file_rec->dirty & DDLIST_DIRTY)
+        if (HTPsync(file_rec) == FAIL)
+          HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+
+		  /* extend the end of the file if necessary */
+      if (file_rec->dirty & FILE_END_DIRTY)
+        if (HIextend_file(file_rec) == FAIL)
+          HGOTO_ERROR(DFE_CANTFLUSH, FAIL);
+      file_rec->dirty = 0;	/* file doesn't need to be flushed now */
+    }		/* end if */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIsync */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hsync -- sync file with memory
+USAGE
+   intn Hsync(file_id)
+   int32 file_id;            IN: id of file
+RETURNS
+   returns SUCCEED (0) if sucessful, FAIL (-1) otherwise
+DESCRIPTION
+   Currently, the on-disk and in-memory representations are always
+   the same.  Thus there is no real use for Hsync().  In the future,
+   things may be buffered before being written out at which time
+   Hsync() will be useful to sync up the on-disk representation.
+NOTE
+   First tests of caching DD's until close.
+
+--------------------------------------------------------------------------*/
+intn
+Hsync(int32 file_id)
+{
+  CONSTR(FUNC, "Hsync");	/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  intn        ret_value = SUCCEED;
+
+  /* check validity of file record and get dd ptr */
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* check whether to flush the file info */
+  if(HIsync(file_rec)==FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hsync */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hcache -- set low-level caching for a file
+USAGE
+   intn Hcache(file_id,cache_on)
+	   int32 file_id;            IN: id of file
+	   intn cache_on;            IN: whether to cache or not
+RETURNS
+   returns SUCCEED (0) if sucessful, FAIL (-1) otherwise
+DESCRIPTION
+   Set/reset the caching in an HDF file.
+   If file_id is set to CACHE_ALL_FILES, then the value of cache_on is
+   used to modify the default caching state.
+--------------------------------------------------------------------------*/
+intn
+Hcache(int32 file_id, intn cache_on)
+{
+  CONSTR(FUNC, "Hcache");		/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  intn        ret_value = SUCCEED;
+
+  if (file_id == CACHE_ALL_FILES)/* check whether to modify the default cache */
+    {	/* set the default caching for all further files Hopen'ed */
+      default_cache = (cache_on != 0 ? TRUE : FALSE);
+    }	/* end if */
+  else
+    {
+      /* check validity of file record and get dd ptr */
+      file_rec = HAatom_object(file_id);
+      if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+      /* check whether to flush the file info */
+      if (cache_on == FALSE && file_rec->cache)
+        {
+          if(HIsync(file_rec)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+        } /* end if */
+      file_rec->cache = (cache_on != 0 ? TRUE : FALSE);
+    }		/* end else */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hcache */
+
+/*--------------------------------------------------------------------------
+NAME
+   HDvalidfid -- check if a file ID is valid
+USAGE
+   int HDvalidfid(file_id)
+   int32 file_id;            IN: id of file
+RETURNS
+   returns TRUE if valid ID else FALSE
+DESCRIPTION
+   Determine whether a given int32 is a valid HDF file ID or not
+
+--------------------------------------------------------------------------*/
+intn
+HDvalidfid(int32 file_id)
+{
+  filerec_t  *file_rec;
+  intn        ret_value = TRUE;
+
+  /* convert file id to file rec and check for validity */
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    ret_value = FALSE;
+
+  return ret_value;
+}	/* HDvalidfid */
+
+/*--------------------------------------------------------------------------
+HDerr --  Closes a file and return FAIL.  
+	   Replacement for DFIerr in HDF3.1 and before
+--------------------------------------------------------------------------*/
+int
+HDerr(int32 file_id)
+{
+  Hclose(file_id);
+  return FAIL;
+}
+
+/*--------------------------------------------------------------------------
+NAME
+   Hsetacceesstype -- set the I/O access type (serial, parallel, ...)
+					  of a data element
+USAGE
+   intn Hsetacceesstype(access_id, accesstype)
+   int32 access_id;        IN: id of access element
+   uintn accesstype;       IN: I/O access type
+RETURNS
+   returns FAIL (-1) if fail, SUCCEED (0) otherwise.
+DESCRIPTION
+   Set the type of I/O for accessing the data element to
+   accesstype.
+
+--------------------------------------------------------------------------*/
+intn
+Hsetaccesstype(int32 access_id, uintn accesstype)
+{
+  CONSTR(FUNC, "Hsetaccesstype");		/* for HERROR */
+  accrec_t   *access_rec;		/* access record */
+  intn       ret_value = SUCCEED;
+
+  /* clear error stack and check validity of this access id */
+  HEclear();
+
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+  if (accesstype != DFACC_DEFAULT && accesstype != DFACC_SERIAL &&
+      accesstype != DFACC_PARALLEL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if (accesstype == access_rec->access_type)
+    goto done;
+
+  /* kludge mode on */
+  if (accesstype != DFACC_PARALLEL)	/* go to PARALLEL only */
+    {
+      ret_value = FAIL;
+      goto done;
+    }
+  /* if special elt, call special function */
+  if (access_rec->special)
+    ret_value = HXPsetaccesstype(access_rec);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hsetacceesstype() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HDdont_atexit
+ PURPOSE
+    Indicates to the library that an 'atexit()' routine is _not_ to be installed
+ USAGE
+    intn HDdont_atexit(void)
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+        This routine indicates to the library that an 'atexit()' cleanip routine
+    should not be installed.  The major (only?) purpose for this is in
+    situations where the library is dynamically linked into an application and
+    is un-linked from the application before 'exit()' gets callled.  In those
+    situations, a routine installed with 'atexit()' would jump to a routine
+    which was no longer in memory, causing errors.
+        In order to be effective, this routine _must_ be called before any other
+    HDF function calls, and must be called each time the library is loaded/
+    linked into the application. (the first time and after it's been un-loaded) 
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    If this routine is used, certain memory buffers will not be de-allocated,
+    although in theory a user could call HPend on their own...
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn HDdont_atexit(void)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HDdont_atexit");    /* for HERROR */
+#endif /* LATER */
+    intn        ret_value = SUCCEED;
+
+    if(install_atexit == TRUE)
+        install_atexit=FALSE;
+
+#ifdef LATER
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+#endif /* LATER */
+
+  /* Normal function cleanup */
+    return(ret_value);
+} /* end HDdont_atexit() */
+
+/*==========================================================================
+
+Internal Routines
+
+==========================================================================*/
+
+/*--------------------------------------------------------------------------
+ NAME
+    HIstart
+ PURPOSE
+    Global and H-level initialization routine
+ USAGE
+    intn HIstart()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Register the global shut-down routine (HPend) for call with atexit
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn HIstart(void)
+{
+    CONSTR(FUNC, "HIstart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if(install_atexit==TRUE)
+        if (HDatexit(&HPend) != 0)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* Create the file ID and access ID groups */
+    if(HAinit_group(FIDGROUP,64)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    if(HAinit_group(AIDGROUP,256)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+#ifdef OLD_WAY
+    if((cleanup_list=HULcreate_list(NULL))==NULL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+#else
+    if(cleanup_list == NULL)
+      {
+          /* allocate list to hold terminateion fcns */
+          if ((cleanup_list = HDmalloc(sizeof(Generic_list))) == NULL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          /* initialize list */
+          if (HDGLinitialize_list(cleanup_list) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+#endif
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return(ret_value);
+} /* end HIstart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HPregister_term_func
+ PURPOSE
+    Registers a termination function in the list of routines to call during
+    atexit() termination.
+ USAGE
+    intn HPregister_term_func(term_func)
+        intn (*term_func)();           IN: function to call during axexit()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Adds routines to the linked-list of routines to call when terminating the
+    library.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function, or real power-users.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn HPregister_term_func(hdf_termfunc_t term_func)
+{
+    CONSTR(FUNC, "HPregister_term_func");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+    if(library_terminate == FALSE)
+        if(HIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+#ifdef OLD_WAY
+    if(HULadd_node(cleanup_list,(void *)term_func)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+#else
+    if(HDGLadd_to_list(*cleanup_list,(void *)term_func)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+#endif
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return(ret_value);
+} /* end HPregister_term_func() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HPend
+ PURPOSE
+    Terminate various static buffers and shutdown the library.
+ USAGE
+    intn HPend()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Walk through the shutdown routines for the various interfaces and 
+    terminate them all.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function, or real power-users.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+void HPend(void)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HPend");    /* for HERROR */
+#endif /* LATER */
+    hdf_termfunc_t term_func;      /* pointer to a termination routine for an interface */
+
+    /* Shutdown the file ID atom group */
+    HAdestroy_group(FIDGROUP);
+
+    /* Shutdown the access ID atom group */
+    HAdestroy_group(AIDGROUP);
+
+    if((term_func=(hdf_termfunc_t)HDGLfirst_in_list(*cleanup_list))!=NULL)
+      {
+        do {
+            (*term_func)();
+          } while((term_func=(hdf_termfunc_t)HDGLnext_in_list(*cleanup_list))!=NULL);
+      } /* end if */
+
+    /* can't issue errors if you're free'ing the error stack. */
+    HDGLdestroy_list(cleanup_list);    /* clear the list of interface cleanup routines */
+    /* free allocated list struct */
+    HDfree(cleanup_list);
+    /* re-initialize */
+    cleanup_list = NULL;
+
+
+    HPbitshutdown();
+    HXPshutdown();
+    Hshutdown();
+    HEshutdown();
+    HAshutdown();
+#ifdef OLD_WAY
+    HULshutdown();
+#endif
+    tbbt_shutdown();
+} /* end HPend() */
+
+/*--------------------------------------------------------------------------
+NAME
+   HIextend_file -- extend file to current length
+USAGE
+   int HIextend_file(file_rec)
+	   filerec_t  * file_rec        IN: pointer to file structure to extend
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   The routine extends an HDF file to be the length on the f_end_off
+   member of the file_rec.  This is mainly written as a function so that
+   the functionality is localized.
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIextend_file(filerec_t * file_rec)
+{
+  CONSTR(FUNC, "HIextend_file");	/* for HERROR */
+  uint8       temp = 0;
+  intn        ret_value = SUCCEED;
+
+  if (HPseek(file_rec, file_rec->f_end_off) == FAIL)
+    HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+  if (HP_write(file_rec, &temp, 1) == FAIL)
+    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIextend_file */
+
+/*--------------------------------------------------------------------------
+NAME
+   HIget_function_table -- create special function table
+USAGE
+   int HIget_func_table(access_rec, FUNC)
+   accrec_t * access_rec;     IN: access record we are working on
+   char     * FUNC;           IN: function we are working for
+RETURNS
+   NULL no matter what (seems odd....)
+DESCRIPTION
+   Set up the table of special functions for a given special element
+
+--------------------------------------------------------------------------*/
+PRIVATE funclist_t *
+HIget_function_table(accrec_t * access_rec)
+{
+  CONSTR(FUNC, "HIget_function_table");	/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  int16       spec_code;
+  uint8       lbuf[4];      /* temporary buffer */
+  uint8      *p;		/* tmp buf ptr */
+  int32       data_off;		/* offset of the data we are checking */
+  int         i;		/* loop index */
+  funclist_t  *ret_value = NULL; /* FAIL */
+
+  /* read in the special code in the special elt */
+  file_rec = HAatom_object(access_rec->file_id);
+
+  /* get the offset and length of the dataset */
+  if(HTPinquire(access_rec->ddid,NULL,NULL,&data_off,NULL)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+  if (HPseek(file_rec, data_off) == FAIL)
+    HGOTO_ERROR(DFE_SEEKERROR, NULL);
+  if (HP_read(file_rec, lbuf, (int)2) == FAIL)
+    HGOTO_ERROR(DFE_READERROR, NULL);
+
+  /* using special code, look up function table in associative table */
+  p = &lbuf[0];
+  INT16DECODE(p, spec_code);
+  access_rec->special=(intn)spec_code;
+  for (i = 0; functab[i].key != 0; i++)
+    {
+      if (access_rec->special == functab[i].key)
+        {
+          ret_value =  functab[i].tab;
+          break; /* break out of loop */
+        }
+    }
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIget_function_table */
+
+/*--------------------------------------------------------------------------
+NAME
+   HIgetspinfo -- return special info
+USAGE
+   int HIgetspinfo(access_rec, tag, ref)
+   accrec_t * access_rec;     IN: access record we are working on
+   int16      tag;            IN: tag to look for
+   int16      ref;            IN: ref to look for
+RETURNS
+   special_info field or NULL if not found
+DESCRIPTION
+   given the tag and ref of a given element return the special
+   info field of the access element.
+
+   Basically, this function checks if any other AIDs in the file
+   have read in the special information for this object.  If so,
+   this special information will be reused.  Otherwise, the
+   special element handling code needs to read in the information
+   from disk
+GLOBALS
+   Reads from the global access_records
+
+--------------------------------------------------------------------------*/
+void *
+HIgetspinfo(accrec_t * access_rec)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HIgetspinfo");	/* for HERROR */
+#endif /* LATER */
+    void *    ret_value = NULL; /* FAIL */
+  
+    if((ret_value=HAsearch_atom(AIDGROUP,HPcompare_accrec_tagref,access_rec))!=NULL)
+        HGOTO_DONE(((accrec_t *)ret_value)->special_info);
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIgetspinfo */
+
+/*--------------------------------------------------------------------------
+HIunlock -- unlock a previously locked file record
+--------------------------------------------------------------------------*/
+PRIVATE int
+HIunlock(filerec_t *file_rec)
+{
+#ifdef LATER
+  CONSTR(FUNC, "HIunlock");	/* for HERROR */
+  int  ret_value = SUCCEED;
+#endif /* LATER */
+
+  /* unlock the file record */
+  file_rec->attach--;
+
+#ifdef LATER
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+#endif /* LATER */
+  return(SUCCEED);
+}
+
+/* ------------------------- SPECIAL TAG ROUTINES ------------------------- */
+/*
+   The HDF tag space is divided as follows based on the 2 highest bits:
+   00: NCSA reserved ordinary tags
+   01: NCSA reserved special tags
+   10, 11: User tags.
+
+   It is relatively cheap to operate with special tags within the NCSA
+   reserved tags range.  For users to specify special tags and their
+   corresponding ordinary tag, the pair has to be added to the
+   special_table.
+
+   The special_table contains pairs of each tag and its corrsponding
+   special tag.  The same table is also used to determine if a tag is
+   special.  Add to this table any additional tag/special_tag pairs
+   that might be necessary.
+
+ */
+
+/*
+   The functionality of these routines is covered by the SPECIALTAG,
+   MKSPECIALTAG and BASETAG macros
+ */
+
+#ifdef SPECIAL_TABLE
+
+typedef struct special_table_t
+{
+	uint16      tag;
+	uint16      special_tag;
+}
+special_table_t;
+
+PRIVATE special_table_t special_table[] =
+{
+	{0x8010, 0x4000 | 0x8010},	/* dummy */
+};
+
+#define SP_TAB_SZ (sizeof(special_table) / sizeof(special_table[0]))
+
+/*--------------------------------------------------------------------------
+--------------------------------------------------------------------------*/
+uint16
+HDmake_special_tag(uint16 tag)
+{
+  int         i;
+  uint16     ret_value = DFTAG_NULL; /* FAIL */
+
+  if (~tag & 0x8000)
+    {
+      ret_value = ((uint16) (tag | 0x4000));
+      goto done;
+    }
+
+  for (i = 0; i < SP_TAB_SZ; i++)
+    if (special_table[i].tag == tag)
+      {
+        ret_value = (uint16) special_table[i].special_tag;
+        break;
+      }
+
+
+done:
+  if(ret_value == DFTAG_NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+--------------------------------------------------------------------------*/
+intn
+HDis_special_tag(uint16 tag)
+{
+  int         i;
+  intn      ret_value = FALSE; /* FAIL */
+
+  if (~tag & 0x8000)
+    {
+      ret_value = (tag & 0x4000) ? TRUE : FALSE;
+      goto done;
+    }
+
+  for (i = 0; i < SP_TAB_SZ; i++)
+    if (special_table[i].special_tag == tag)
+      {
+        ret_value = TRUE;
+        break;
+      }
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+--------------------------------------------------------------------------*/
+uint16
+HDbase_tag(uint16 tag)
+{
+  int         i;
+  uint16     ret_value = tag;
+
+  if (~tag & 0x8000)
+    {
+      ret_value = ((uint16) (tag & ~0x4000));
+      goto done;
+    }
+
+  for (i = 0; i < SP_TAB_SZ; i++)
+    if (special_table[i].special_tag == tag)
+      {
+        ret_value = special_table[i].special_tag;
+        break;
+      }
+done:
+  if(ret_value == tag)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+#endif /* SPECIAL_TABLE */
+
+/*--------------------------------------------------------------------------
+ NAME
+    Hgetlibversion -- return version info for current HDF library
+ USAGE
+    intn Hgetlibversion(majorv, minorv, release, string)
+    uint32 *majorv;     OUT: majorv version number
+    uint32 *minorv;     OUT: minorv versoin number
+    uint32 *release;    OUT: release number
+    char   string[];    OUT: informational text string (80 chars)
+ RETURNS
+    returns SUCCEED (0).
+ DESCRIPTION
+    Copies values from #defines in hfile.h to provided buffers. This
+        information is statistically compilied into the HDF library, so
+        it is not necessary to have any files open to get this information.
+
+--------------------------------------------------------------------------*/
+intn
+Hgetlibversion(uint32 *majorv, uint32 *minorv, uint32 *releasev, char *string)
+{
+#ifdef LATER
+  CONSTR(FUNC, "Hgetlibversion");
+#endif
+  HEclear();
+
+  *majorv = LIBVER_MAJOR;
+  *minorv = LIBVER_MINOR;
+  *releasev = LIBVER_RELEASE;
+  HIstrncpy(string, LIBVER_STRING, LIBVSTR_LEN + 1);
+
+  return (SUCCEED);
+}	/* HDgetlibversion */
+
+/*--------------------------------------------------------------------------
+ NAME
+    Hgetfileversion -- return version info for HDF file
+ USAGE
+    intn Hgetfileversion(file_id, majorv, minorv, release, string)
+    int32 file_id;      IN: handle of file
+    uint32 *majorv;     OUT: majorv version number
+    uint32 *minorv;     OUT: minorv versoin number
+    uint32 *release;    OUT: release number
+    char *string;       OUT: informational text string (80 chars)
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Copies values from file_records[] structure for a given file to
+        provided buffers.
+ GLOBAL VARIABLES
+    Reads file_records[]
+
+--------------------------------------------------------------------------*/
+intn
+Hgetfileversion(int32 file_id, uint32 *majorv, uint32 *minorv,
+				uint32 *release, char *string)
+{
+  CONSTR(FUNC, "Hgetfileversion");
+  filerec_t  *file_rec;
+  intn      ret_value = SUCCEED;
+
+  HEclear();
+
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if (majorv != NULL)
+      *majorv = file_rec->version.majorv;
+  if (minorv != NULL)
+      *minorv = file_rec->version.minorv;
+  if (release != NULL)
+      *release = file_rec->version.release;
+  if (string != NULL)
+      HIstrncpy(string, file_rec->version.string, LIBVSTR_LEN + 1);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Hgetfileversion */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HIcheckfileversion -- check version info for HDF file
+ USAGE
+    intn Hgetfileversion(file_id)
+    int32 file_id;      IN: handle of file
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Checks that the file's version is current and update it if it isn't.
+
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIcheckfileversion(int32 file_id)
+{
+  CONSTR(FUNC, "HIcheckfileversion");
+  filerec_t  *file_rec;
+  uint32      lmajorv, lminorv, lrelease;
+  uint32      fmajorv, fminorv, frelease;
+  char        string[LIBVSTR_LEN + 1];	/* len 80+1  */
+  intn        newver = 0;
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+	/* get file version and set newver condition */
+  if (Hgetfileversion(file_id, &fmajorv, &fminorv, &frelease, string) != SUCCEED)
+    {
+      newver = 1;
+      HEclear();
+    }		/* end if */
+
+  /* get library version */
+  Hgetlibversion(&lmajorv, &lminorv, &lrelease, string);
+
+  /* check whether we need to update the file version tag */
+  if(lmajorv > fmajorv || (lmajorv==fmajorv && lminorv > fminorv) ||
+          (lmajorv==fmajorv && lminorv==fminorv && lrelease > frelease))
+      newver=1;
+  if (newver == 1)
+    {
+      file_rec->version.majorv = lmajorv;
+      file_rec->version.minorv = lminorv;
+      file_rec->version.release = lrelease;
+      HIstrncpy(file_rec->version.string, string, LIBVSTR_LEN + 1);
+      file_rec->version.modified = 1;
+    }		/* end if */
+
+  file_rec->version_set = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIcheckfileversion */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HIget_filerec_node -- find a filerec for a FILE
+ USAGE
+       filerec_t *HIget_filerec_node(path)
+       char * path;             IN: name of file
+ RETURNS
+       a file record or else NULL
+ DESCRIPTION
+       Search the file record array for a matching record, or allocate an
+       empty slot.
+       The file is considered the same if the path matches exactly.  This
+       routine is unable to detect aliases, or how to compare relative and
+       absolute paths.
+
+--------------------------------------------------------------------------*/
+PRIVATE filerec_t *
+HIget_filerec_node(const char *path)
+{
+    CONSTR(FUNC, "HIget_filerec_node");
+    filerec_t  *ret_value=NULL;
+
+    if((ret_value=HAsearch_atom(FIDGROUP,HPcompare_filerec_path,path))==NULL)
+      {
+        if((ret_value=(filerec_t *)HDcalloc(1,sizeof(filerec_t)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE,NULL);
+
+        if((ret_value->path=(char *)HDstrdup(path))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE,NULL);
+
+        /* Initialize annotation stuff */
+        ret_value->an_tree[AN_DATA_LABEL] = NULL;
+        ret_value->an_tree[AN_DATA_DESC]  = NULL;
+        ret_value->an_tree[AN_FILE_LABEL] = NULL;
+        ret_value->an_tree[AN_FILE_DESC]  = NULL;
+        ret_value->an_num[AN_DATA_LABEL] = -1;   
+        ret_value->an_num[AN_DATA_DESC]  = -1;   
+        ret_value->an_num[AN_FILE_LABEL] = -1;   
+        ret_value->an_num[AN_FILE_DESC]  = -1;   
+      } /* end if */
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIget_filerec_node */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HIrelease_filerec_node -- release/recycle a filerec
+ USAGE
+       intn HIrelease_filerec_node(file_rec)
+       filerec_t *file_rec;         IN: File record to release
+ RETURNS
+       SUCCEED/FAIL
+ DESCRIPTION
+        Release a file record back to the system
+
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIrelease_filerec_node(filerec_t *file_rec)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HIrelease_filerec_node");
+#endif /* LATER */
+
+    /* Close file if it's opened */
+    if(file_rec->file!=NULL)
+	HI_CLOSE(file_rec->file);
+
+    /* Free all the components of the file record */
+    if(file_rec->path!=NULL)
+        HDfree(file_rec->path);
+    HDfree(file_rec);
+
+#ifdef LATER
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+#endif /* LATER */
+
+  /* Normal function cleanup */
+
+  return SUCCEED;
+}	/* HIrelease_filerec_node */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HPisfile_in_use -- check if a FILE is currently in use
+ USAGE
+       intn HPisfile_in_use(path)
+       const char * path;             IN: name of file
+ RETURNS
+       TRUE if the file is in use or FALSE, otherwise.
+ DESCRIPTION
+        Get its record if the file is opened, then check its
+        reference count to decide whether the file is currently in use.
+
+--------------------------------------------------------------------------*/
+intn HPisfile_in_use(const char *path)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HPisfile_in_use");
+#endif /* LATER */
+
+    filerec_t  *file_rec=NULL;
+    intn	ret_value=FALSE;
+
+    /* Search for the record of a file named "path". */
+    file_rec = (filerec_t *)HAsearch_atom(FIDGROUP,HPcompare_filerec_path,path);
+
+    /* If the file is not found, it can't be in use, return FALSE */
+    if (file_rec == NULL)
+	ret_value = FALSE;
+    else
+	if (file_rec->refcount) /* file is in use if ref count is not 0 */
+	    ret_value = TRUE;
+
+#ifdef LATER
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+#endif /* LATER */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HPisfile_in_use */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HPcompare_filerec_path -- compare filerec objects for the atom API
+ USAGE
+       intn HPcompare_filerec_path(obj, key)
+       const void * obj;             IN: pointer to the file record
+       const void * key;             IN: pointer to the name of file
+ RETURNS
+       TRUE if the key matches the obj, FALSE otherwise
+ DESCRIPTION
+       Look inside the file record for the atom API and compare the the
+       paths.
+--------------------------------------------------------------------------*/
+intn HPcompare_filerec_path(const void * obj, const void * key)
+{
+    const filerec_t  *frec  = obj;
+    const char *fname = key;
+    intn        ret_value = FALSE; /* set default as FALSE */
+#ifdef LATER
+    CONSTR(FUNC, "HPcompare_filerec_path");
+#endif /* LATER */
+
+    /* check args */
+    if (frec != NULL && fname != NULL)
+      {
+          /* check bad file record */
+          if (BADFREC(frec))
+              ret_value = FALSE;
+          else
+            {
+                if(!HDstrcmp(frec->path,fname))
+                    ret_value = TRUE;
+                else
+                    ret_value = FALSE;
+            }
+      }
+
+#ifdef LATER
+done:
+    if(ret_value == FALSE)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+#endif /* LATER */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+}	/* HPcompare_filerec_path */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HPcompare_accrec_tagref -- compare accrec objects for the atom API
+ USAGE
+       intn HPcompare_accrec_tagref(obj, key)
+       const void * rec1;            IN: pointer to the access record #1
+       const void * rec2;            IN: pointer to the access record #2
+ RETURNS
+       TRUE if tag/ref of rec1 matches the tag/ref of rec2, FALSE otherwise
+ DESCRIPTION
+       Look inside the access record for the atom API and compare the the
+       paths.
+--------------------------------------------------------------------------*/
+intn HPcompare_accrec_tagref(const void * rec1, const void * rec2)
+{
+    CONSTR(FUNC, "HPcompare_accrec_tagref");
+    uint16      tag1,ref1;      /* tag/ref of access record #1 */
+    uint16      tag2,ref2;      /* tag/ref of access record #2 */
+    intn        ret_value = FALSE; /* FAIL */
+
+    if(rec1!=rec2)
+      {
+        if(HTPinquire(((const accrec_t *)rec1)->ddid,&tag1,&ref1,NULL,NULL)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FALSE);
+
+        if(HTPinquire(((const accrec_t *)rec2)->ddid,&tag2,&ref2,NULL,NULL)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FALSE);
+
+        if (((const accrec_t *)rec1)->file_id == ((const accrec_t *)rec2)->file_id
+            && tag1 == tag2 && ref1 == ref2)
+            HGOTO_DONE(TRUE);
+      } /* end if */
+
+done:
+    if(ret_value == FALSE)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return(ret_value);
+}	/* HPcompare_accrec_tagref */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HIvalid_magic -- verify the magic number in a file
+ USAGE
+       int32 HIvalid_magic(path)
+       hdf_file_t file;             IN: FILE pointer
+ RETURNS
+       TRUE if valid magic number else FALSE
+ DESCRIPTION
+       Given an open file pointer, see if the first four bytes of the
+       file are the HDF "magic number" HDFMAGIC
+
+--------------------------------------------------------------------------*/
+PRIVATE intn
+HIvalid_magic(hdf_file_t file)
+{
+  CONSTR(FUNC, "HIvalid_magic");
+  char        b[MAGICLEN];	/* Temporary buffer */
+  intn    ret_value = FALSE; /* FAIL */
+
+  /* Seek to beginning of the file. */
+  if (HI_SEEK(file, 0) == FAIL)
+    HGOTO_ERROR(DFE_SEEKERROR, FALSE);
+
+  /* Read in magic cookie and compare. */
+  if (HI_READ(file, b, MAGICLEN) == FAIL)
+    HGOTO_ERROR(DFE_READERROR, FALSE);
+
+  if (NSTREQ(b, HDFMAGIC, MAGICLEN))
+    ret_value = TRUE;
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/*--------------------------------------------------------------------------
+ NAME
+    HIget_access_rec -- allocate a new access record
+ USAGE
+    int HIget_access_rec(void)
+ RETURNS
+    returns access_record pointer or NULL if failed.
+ DESCRIPTION
+        Return an pointer to a new access_rec to use for a new AID.
+
+--------------------------------------------------------------------------*/
+accrec_t *HIget_access_rec(void)
+{
+    CONSTR(FUNC, "HIget_access_rec");
+    accrec_t   *ret_value = NULL;
+  
+    HEclear();
+
+    /* Grab from free list if possible */
+    if(accrec_free_list!=NULL)
+      {
+        ret_value=accrec_free_list;
+        accrec_free_list=accrec_free_list->next;
+      } /* end if */
+    else
+      {
+        if((ret_value=(accrec_t *)HDmalloc(sizeof(accrec_t)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end else */
+
+    /* Initialize to zeros */
+    HDmemset(ret_value,0,sizeof(accrec_t));
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIget_access_rec */
+
+/******************************************************************************
+ NAME
+     HIrelease_accrec_node - Releases an atom node
+
+ DESCRIPTION
+    Puts an accrec node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+void HIrelease_accrec_node(accrec_t *acc)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HIrelease_atom_node");	/* for HERROR */
+#endif /* LATER */
+
+    /* Insert the atom at the beginning of the free list */
+    acc->next=accrec_free_list;
+    accrec_free_list=acc;
+}   /* end HIrelease_accrec_node() */
+
+/*--------------------------------------------------------------------------
+ PRIVATE    PRIVATE     PRIVATE     PRIVATE     PRIVATE
+ NAME
+    HIupdate_version -- determine whether new version tag should be written
+ USAGE
+    int HIupdate_version(file_id)
+    int32 file_id;      IN: handle of file
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Writes out version numbers of current library as file version.
+ GLOBAL VARIABLES
+    Resets modified field of version field of appropriate file_records[]
+    entry.
+
+--------------------------------------------------------------------------*/
+PRIVATE int
+HIupdate_version(int32 file_id)
+{
+  /* uint32 lmajorv, lminorv, lrelease; */
+  uint8 /*lstring[81], */ lversion[LIBVER_LEN];
+  filerec_t * file_rec;
+  int         i;
+  CONSTR(FUNC, "Hupdate_version");
+  int       ret_value = SUCCEED;
+
+  HEclear();
+
+  /* Check args */
+  file_rec=HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* copy in-memory version to file */
+  Hgetlibversion(&(file_rec->version.majorv), &(file_rec->version.minorv),
+                 &(file_rec->version.release), file_rec->version.string);
+
+  {
+    uint8      *p;
+
+    p = lversion;
+    UINT32ENCODE(p, file_rec->version.majorv);
+    UINT32ENCODE(p, file_rec->version.minorv);
+    UINT32ENCODE(p, file_rec->version.release);
+    HIstrncpy((char *) p, file_rec->version.string, LIBVSTR_LEN);
+    i = (int)HDstrlen((char *) p);
+    HDmemset(&p[i],0,LIBVSTR_LEN-i);
+  }
+
+  if(Hputelement(file_id, (uint16) DFTAG_VERSION, (uint16) 1, lversion,
+                          (int32) LIBVER_LEN)==FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  file_rec->version.modified = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIupdate_version */
+
+/*--------------------------------------------------------------------------
+ PRIVATE    PRIVATE     PRIVATE     PRIVATE     PRIVATE
+ NAME
+    HIread_version -- reads a version tag from a file
+ USAGE
+    int HIread_version(file_id)
+    int32 file_id;      IN: handle of file
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Reads a version tag from the specified file into the version fields
+    of the appropriate filerec_t.  On failure, zeros are put in the version
+    number fields and NULLS in the string.
+ GLOBAL VARIABLES
+    Writes to version fields of appropriate file_records[] entry.
+
+--------------------------------------------------------------------------*/
+PRIVATE int
+HIread_version(int32 file_id)
+{
+  filerec_t  *file_rec;
+  uint8       fversion[LIBVER_LEN];
+  CONSTR(FUNC, "Hread_version");
+  int         ret_value = SUCCEED;
+
+  HEclear();
+
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  if (Hgetelement(file_id, (uint16) DFTAG_VERSION, (uint16) 1, fversion) == FAIL)
+    {
+      file_rec->version.majorv = 0;
+      file_rec->version.minorv = 0;
+      file_rec->version.release = 0;
+      HDstrcpy(file_rec->version.string, "");
+      file_rec->version.modified = 0;
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+  else
+    {
+      uint8      *p;
+
+      p = fversion;
+      UINT32DECODE(p, file_rec->version.majorv);
+      UINT32DECODE(p, file_rec->version.minorv);
+      UINT32DECODE(p, file_rec->version.release);
+      HIstrncpy(file_rec->version.string, (char *) p, LIBVSTR_LEN);
+    }
+  file_rec->version.modified = 0;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HIread_version */
+
+/*-----------------------------------------------------------------------
+NAME
+   HPgetdiskblock --- Get the offset of a free block in the file.
+USAGE
+   int32 HPgetdiskblock(file_rec, block_size)
+   filerec_t *file_rec;     IN: ptr to the file record
+   int32 block_size;        IN: size of the block needed
+   intn moveto;             IN: whether to move the file position
+                                to the allocated position or leave
+                                it undefined.
+RETURNS
+   returns offset of block in the file if successful, FAIL (-1) if failed.
+DESCRIPTION
+   Used to "allocate" space in the file.  Currently, it just appends
+   blocks to the end of the file willy-nilly.  At some point in the
+   future, this could be changed to use a "real" free-list of empty
+   blocks in the file and dole those out.
+
+-------------------------------------------------------------------------*/
+int32
+HPgetdiskblock(filerec_t * file_rec, int32 block_size, intn moveto)
+{
+  CONSTR(FUNC, "HPgetdiskblock");
+  uint8       temp;
+  int32       ret_value = SUCCEED;
+
+  /* check for valid arguments */
+  if (file_rec == NULL || block_size < 0)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+
+#ifdef DISKBLOCK_DEBUG
+  block_size+=(DISKBLOCK_HSIZE+DISKBLOCK_TSIZE);
+  /* get the offset of the allocated block */
+  ret_value = file_rec->f_end_off+DISKBLOCK_HSIZE;
+#else /* DISKBLOCK_DEBUG */
+  /* get the offset of the allocated block */
+  ret_value = file_rec->f_end_off;
+#endif /* DISKBLOCK_DEBUG */
+
+  /* reserve the space by marking the end of the element */
+  if (block_size > 0)
+    {
+#ifdef DISKBLOCK_DEBUG
+      if (file_rec->cache)
+        file_rec->dirty |= FILE_END_DIRTY;
+      else
+        {
+          /* Write the debugging head & tail to the file block allocated */
+          if (HPseek(file_rec, file_rec->f_end_off) == FAIL)
+            HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HP_write(file_rec, diskblock_header, DISKBLOCK_HSIZE) == FAIL)
+            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+          if (HPseek(file_rec, file_rec->f_end_off+block_size-DISKBLOCK_TSIZE) == FAIL)
+            HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HP_write(file_rec, diskblock_tail, DISKBLOCK_TSIZE) == FAIL)
+            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+        }	/* end else */
+#else /* DISKBLOCK_DEBUG */
+      if (file_rec->cache)
+        file_rec->dirty |= FILE_END_DIRTY;
+      else
+        {
+          if (HPseek(file_rec, ret_value + block_size - 1) == FAIL)
+            HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+          if (HP_write(file_rec, &temp, 1) == FAIL)
+            HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+        }	/* end else */
+#endif /* DISKBLOCK_DEBUG */
+    }		/* end if */
+  if (moveto == TRUE)		/* move back to the beginning of the element */
+    {
+      if (HPseek(file_rec, ret_value) == FAIL)
+        HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+    } /* end if */
+
+  /* incr. offset of end of file */
+  file_rec->f_end_off +=block_size;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HPgetdiskblock() */
+
+/*-----------------------------------------------------------------------
+NAME
+   HPfreediskblock --- Release a block in a file to be re-used.
+USAGE
+   intn HPfreediskblock(file_rec, block_off, block_size)
+   filerec_t *file_rec;     IN: ptr to the file record
+   int32 block_off;         IN: offset of the block to release
+   int32 block_size;        IN: size of the block to release
+RETURNS
+   returns SUCCEED (0) if successful, FAIL (-1) if failed.
+DESCRIPTION
+   Used to "release" space in the file.  Currently, it does nothing.
+   At some point in the future, this could be changed to add the block
+   to a "real" free-list of empty blocks in the file and manage those.
+
+-------------------------------------------------------------------------*/
+intn
+HPfreediskblock(filerec_t * file_rec, int32 block_off, int32 block_size)
+{
+#ifdef LATER
+  CONSTR(FUNC, "HPfreediskblock");
+#endif
+  intn ret_value = SUCCEED;
+
+  /* shut compiler up */
+  file_rec = file_rec;
+  block_off = block_off;
+  block_size = block_size;
+
+  return ret_value;
+}	/* HPfreediskblock() */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HDget_special_info -- get information about a special element
+ USAGE
+       intn HDget_special_info(access_id, info_block)
+       int32 access_id;        IN: id of READ access element
+       sp_info_block_t * info_block;
+                               OUT: information about the special element
+ RETURNS
+       SUCCEED / FAIL
+ DESCRIPTION
+       Fill in the given info_block with information about the special
+       element.  Return FAIL if it is not a special element AND set
+       the 'key' field to FAIL in info_block.
+
+--------------------------------------------------------------------------*/
+int32
+HDget_special_info(int32 access_id, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HDget_special_info");
+  accrec_t   *access_rec;		/* access record */
+  int32       ret_value = FAIL;
+
+  /* clear error stack and check validity of access id */
+  HEclear();
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL || info_block == NULL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* special elt, so call special function */
+  if (access_rec->special)
+    ret_value = (*access_rec->special_func->info) (access_rec, info_block);
+  else /* else is not special so FAIL */
+    info_block->key = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HDget_special_info */
+
+/*--------------------------------------------------------------------------
+ NAME
+       HDset_special_info -- reset information about a special element
+ USAGE
+       intn HDet_special_info(access_id, info_block)
+       int32 access_id;        IN: id of READ access element
+       sp_info_block_t * info_block;
+                               IN: information about the special element
+ RETURNS
+       SUCCEED / FAIL
+ DESCRIPTION
+       Attempt to replace the special information for the given element
+       with new information.  This routine should be used to rename
+       external elements for example.  Doing things like changing the
+       blocking of a linekd block element are beyond the scope of this
+       routine.
+
+--------------------------------------------------------------------------*/
+int32
+HDset_special_info(int32 access_id, sp_info_block_t * info_block)
+{
+    CONSTR(FUNC, "HDset_special_info");
+  accrec_t   *access_rec;		/* access record */
+  int32      ret_value = FAIL;
+
+  /* clear error stack and check validity of access id */
+  HEclear();
+  access_rec = HAatom_object(access_id);
+  if (access_rec == (accrec_t *) NULL || info_block == NULL)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* special elt, so call special function */
+  if (access_rec->special)
+    ret_value = (*access_rec->special_func->reset) (access_rec, info_block);
+
+  /* else is not special so fail */
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HDset_special_info */
+
+/*--------------------------------------------------------------------------
+ NAME
+    Hshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn Hshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the H routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+Hshutdown(void)
+{
+    accrec_t *curr;
+
+    /* Release the free-list if it exists */
+    if(accrec_free_list != NULL)
+      {
+        while(accrec_free_list != NULL 
+              && accrec_free_list != accrec_free_list->next)
+          {
+            curr = accrec_free_list;
+            accrec_free_list = accrec_free_list->next;
+            curr->next = NULL;
+            HDfree(curr);
+          } /* end while */
+      } /* end if */
+
+    return (SUCCEED);
+}	/* end Hshutdown() */
+
+/* #define HFILE_SEEKINFO */
+#ifdef HFILE_SEEKINFO
+static uint32 seek_taken=0;
+static uint32 seek_avoided=0;
+static uint32 write_force_seek=0;
+static uint32 read_force_seek=0;
+
+void
+Hdumpseek(void)
+{
+    printf("Seeks taken=%lu\n",(unsigned long)seek_taken);
+    printf("Seeks avoided=%lu\n",(unsigned long)seek_avoided);
+    printf("# of times write forced a seek=%lu\n",(unsigned long)write_force_seek);
+    printf("# of times read forced a seek=%lu\n",(unsigned long)read_force_seek);
+} /* Hdumpseek() */
+#endif /* HFILE_SEEKINFO */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HP_read
+ PURPOSE
+    Alias for HI_READ on HDF files.
+ USAGE
+    intn HP_read(file_rec,buf,bytes)
+        filerec_t * file_rec;   IN: Pointer to the HDF file record
+        void * buf;              IN: Pointer to the buffer to read data into
+        int32 bytes;            IN: # of bytes to read
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Function to wrap around HI_READ
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only be called by HDF low-level routines
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+HP_read(filerec_t *file_rec,void * buf,int32 bytes)
+{
+  CONSTR(FUNC, "HP_read");
+  intn     ret_value = SUCCEED;
+
+  /* Check for switching file access operations */
+  if(file_rec->last_op==H4_OP_WRITE || file_rec->last_op==H4_OP_UNKNOWN)
+    {
+#ifdef HFILE_SEEKINFO
+      read_force_seek++;
+#endif /* HFILE_SEEKINFO */
+      file_rec->last_op=H4_OP_UNKNOWN;
+      if(HPseek(file_rec,file_rec->f_cur_off)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    } /* end if */
+
+  if(HI_READ(file_rec->file,buf,bytes)==FAIL)
+    HGOTO_ERROR(DFE_READERROR, FAIL);
+  file_rec->f_cur_off+=bytes;
+  file_rec->last_op=H4_OP_READ;
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end HP_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HPseek
+ PURPOSE
+    Alias for HI_SEEK on HDF files.
+ USAGE
+    intn HPseek(file_rec,offset)
+        filerec_t * file_rec;   IN: Pointer to the HDF file record
+        int32 offset;           IN: offset in the file to go to
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Function to wrap around HI_SEEK
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only be called by HDF low-level routines
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+HPseek(filerec_t *file_rec,int32 offset)
+{
+  CONSTR(FUNC, "HPseek");
+  intn     ret_value = SUCCEED;
+
+#ifdef HFILE_SEEKINFO
+printf("%s: file_rec=%p, last_offset=%ld, offset=%ld, last_op=%d",FUNC,file_rec,(long)file_rec->f_cur_off,(long)offset,(int)file_rec->last_op);
+#endif /* HFILE_SEEKINFO */
+  if(file_rec->f_cur_off!=offset || file_rec->last_op==H4_OP_UNKNOWN)
+    {
+#ifdef HFILE_SEEKINFO
+      seek_taken++;
+printf(" taken: %d\n",(int)seek_taken);
+#endif /* HFILE_SEEKINFO */
+      if (HI_SEEK(file_rec->file, offset) == FAIL)
+        HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+      file_rec->f_cur_off=offset;
+      file_rec->last_op=H4_OP_SEEK;
+    } /* end if */
+#ifdef HFILE_SEEKINFO
+  else
+{
+    seek_avoided++;
+printf(" avoided: %d\n",(int)seek_avoided);
+}
+#endif /* HFILE_SEEKINFO */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end HPseek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HP_write
+ PURPOSE
+    Alias for HI_WRITE on HDF files.
+ USAGE
+    intn HP_write(file_rec,buf,bytes)
+        filerec_t * file_rec;   IN: Pointer to the HDF file record
+        void * buf;              IN: Pointer to the buffer to write
+        int32 bytes;            IN: # of bytes to write
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Function to wrap around HI_WRITE
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only be called by HDF low-level routines
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+HP_write(filerec_t *file_rec,const void * buf,int32 bytes)
+{
+  CONSTR(FUNC, "HP_write");
+  intn    ret_value = SUCCEED;
+
+  /* Check for switching file access operations */
+  if(file_rec->last_op==H4_OP_READ || file_rec->last_op==H4_OP_UNKNOWN)
+    {
+#ifdef HFILE_SEEKINFO
+      write_force_seek++;
+#endif /* HFILE_SEEKINFO */
+      file_rec->last_op=H4_OP_UNKNOWN;
+      if(HPseek(file_rec,file_rec->f_cur_off)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    } /* end if */
+
+  if(HI_WRITE(file_rec->file,buf,bytes)==FAIL)
+    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+  file_rec->f_cur_off+=bytes;
+  file_rec->last_op=H4_OP_WRITE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end HP_write() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+    HDread_drec -- reads a description record
+ USAGE
+    int32 HDread_drec(file_id, data_id, drec_buf)
+    int32 file_id;		IN: id of file
+    atom_t data_id;		IN: id of an element
+    uint8** drec_buf		OUT: buffer containing special info header
+ RETURNS
+    Returns the length of the info read
+ DESCRIPTION
+    This private function contains code that was repeated in several places
+    throughout the library.  It gets access to the element's description
+    record and read the special info header.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+    03-20-2010 BMR: Factored out repeated code
+--------------------------------------------------------------------------*/
+int32
+HPread_drec(int32 file_id, atom_t data_id, uint8** drec_buf)
+{
+    CONSTR(FUNC, "HDread_drec");	/* for HERROR */
+    int32       drec_len=0;		/* length of the description record */
+    int32	drec_aid=-1;		/* description record access id */
+    uint16	drec_tag, drec_ref;	/* description record tag/ref */
+    int32       ret_value=0;
+
+    /* get the info for the dataset (description record) */
+    if (HTPinquire(data_id,&drec_tag,&drec_ref,NULL,&drec_len) == FAIL)
+	HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    if ((*drec_buf = (uint8 *)HDmalloc(drec_len)) == NULL)
+	HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* get the special info header */
+    drec_aid = Hstartaccess(file_id,MKSPECIALTAG(drec_tag),drec_ref,DFACC_READ);
+    if (drec_aid == FAIL)
+	HGOTO_ERROR(DFE_BADAID, FAIL);
+    if (Hread(drec_aid,0,*drec_buf) == FAIL)
+	HGOTO_ERROR(DFE_READERROR, FAIL);
+    if(Hendaccess(drec_aid)==FAIL)
+	HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+    ret_value = drec_len;
+
+done:
+    if(ret_value == FAIL)
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* HPread_drec */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HDcheck_empty -- determines if an element has been written with data
+ USAGE
+    int32 HDcheck_empty(file_id, tag, ref, *emptySDS)
+    int32 file_id;             IN: id of file
+    uint16 tag;                IN: tag of data element
+    uint16 ref;                IN: ref of data element
+    intn *emptySDS;	      OUT: TRUE if data element is empty 
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    If the data element is special, gets the compressed or chunked description
+    record and retrieves the special tag.  If the special tag indicates that
+    the data element is compressed, then this function will retrieve the data 
+    length.  If the special tag indicates the data element is chunked, then 
+    retrieve the vdata chunk table to get its number of records.
+
+    Uses the data length or number of records to determine the value for 
+    'emptySDS'.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+    10-30-2004 BMR: This function was added for SDcheckempty
+    08-28-2007 BMR: The old code of this function failed when szip library 
+		didn't present (bugzilla 842.)  Modified to read info directly 
+		from file.
+--------------------------------------------------------------------------*/
+int32
+HDcheck_empty(int32 file_id, uint16 tag, uint16 ref,
+	      intn  *emptySDS /* TRUE if data element is empty */)
+{
+    CONSTR(FUNC, "HDcheck_empty");	/* for HERROR */
+    int32       length;			/* length of the element's data */
+    atom_t      data_id = FAIL;	/* dd ID of existing regular element */
+    filerec_t  *file_rec;	/* file record pointer */
+    uint8      *local_ptbuf=NULL, *p;
+    int16	sptag = -1;	/* special tag read from desc record */
+    int32       ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* convert file id to file rec and check for validity */
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get access element from dataset's tag/ref */
+    if ((data_id=HTPselect(file_rec,tag,ref))!=FAIL)
+    {
+	int32  dlen=0, doff=0; /* offset/length of the description record */
+
+        /* Get the info pointed to by this dd, which could point to data or
+           description record, or neither */
+        if (HTPinquire(data_id, NULL, NULL, &doff, &dlen) == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* doff/dlen = -1 means no data had been written */
+        if (doff == INVALID_OFFSET && dlen == INVALID_LENGTH)
+        {
+	    *emptySDS = TRUE;
+        }
+
+	/* if the element is not special, that means dataset's tag/ref 
+	   specifies the actual data that was written to the dataset, so
+	   we don't need to check further */
+	else if (HTPis_special(data_id)==FALSE)
+        {
+	    *emptySDS = FALSE;
+        }
+	else
+	{
+	    int32 rec_len=0;
+
+	    /* Get the compression header (description record) */
+	    rec_len = HPread_drec(file_id, data_id, &local_ptbuf);
+	    if (rec_len <= 0)
+		HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	    /* get special tag */
+	    p = local_ptbuf;
+	    INT16DECODE(p, sptag);
+
+	    /* if it is a compressed element, get the data length and set
+		flag emptySDS appropriately */
+	    if (sptag == SPECIAL_COMP)
+	    {
+		/* skip 2byte header_version */
+		p = p + 2;
+		INT32DECODE(p, length);   /* get _uncompressed_ data length */
+
+		/* set flag specifying whether the dataset is empty */
+		*emptySDS = length == 0 ? TRUE : FALSE;
+	    }
+
+	    /* if it is a chunked element, get the number of records in
+	       the chunk table (vdata) to determine emptySDS value */
+	    else if (sptag == SPECIAL_CHUNKED)
+	    {
+		uint16 chk_tbl_tag, chk_tbl_ref; /* chunk table tag/ref */
+		int32 vdata_id = -1;	/* chunk table id */
+		int32 n_records = 0;	/* number of records in chunk table */
+
+		/* skip 4byte header len, 1byte chunking version, 4byte flag, */
+		/* 4byte elm_tot_length, 4byte chunk_size and 4byte nt_size */
+		p = p + 4 + 1 + 4 + 4 + 4 + 4;
+		UINT16DECODE(p, chk_tbl_tag);
+		UINT16DECODE(p, chk_tbl_ref);
+
+		/* make sure it is really the vdata */
+		if (chk_tbl_tag == DFTAG_VH)
+		{
+		    /* attach to the chunk table vdata and get its num of records */
+		    if ((vdata_id = VSattach(file_id,chk_tbl_ref,"r")) == FAIL)
+			HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+		    if (VSinquire(vdata_id, &n_records,NULL,NULL,NULL,NULL) == FAIL)
+		        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+		    if (VSdetach(vdata_id) == FAIL)
+		        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+		    /* set flag specifying whether the dataset is empty */
+		    *emptySDS = n_records == 0 ? TRUE : FALSE;
+		} /* it is a vdata */
+		else
+		    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	    }
+	    /* need to check about other special cases - BMR 08/28/2007 */
+	} /* else, data_id is special */
+
+	/* end access to the aid */
+	if (HTPendaccess(data_id) == FAIL)
+	    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    }  /* end if data_id != FAIL */
+    else
+    {
+        HGOTO_ERROR(DFE_CANTACCESS, FAIL);
+    }
+ 
+done:
+    if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+    /* Normal function cleanup */
+    if (local_ptbuf != NULL) 
+	HDfree(local_ptbuf);
+
+    return ret_value;
+} /* end HDcheck_empty() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+    Hgetspecinfo
+ PURPOSE
+    Returns the special type if the given element is special.
+ USAGE
+    intn Hgetspecinfo(file_id, tag, ref)
+        int32 file_id;    IN: file id
+        uint16 tag;    IN: tag of the element
+        uint16 ref;    IN: ref of the element
+ RETURNS
+    Special type:
+  SPECIAL_LINKED
+  SPECIAL_EXT
+  SPECIAL_COMP
+  SPECIAL_VLINKED
+  SPECIAL_CHUNKED
+  SPECIAL_BUFFERED
+  SPECIAL_COMPRAS
+    or 0 if the element is not special element.
+ DESCRIPTION
+    Called internally by the GRIget_image_list to allow a chunked or
+    linked-block element to proceed eventhough its offset is 0.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+
+  *** Only called by library routines, should _not_ be called externally ***
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+Hgetspecinfo(int32 file_id, uint16 tag, uint16 ref, sp_info_block_t *info)
+{
+    CONSTR(FUNC, "Hgetspecinfo");
+    accrec_t* access_rec=NULL;/* access element record */
+    int32     aid;
+    intn      status=0, ret_value=0;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Start read access on the access record of the data element, which
+       is being inquired for its special information */
+    aid = Hstartread(file_id, tag, ref);
+
+    /* Get the access_rec pointer */
+    access_rec = HAatom_object(aid);
+    if (access_rec == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Only return the valid special code, anything else return 0 */
+    ret_value = access_rec->special;
+    switch (access_rec->special)
+    {
+        case SPECIAL_LINKED:
+        case SPECIAL_EXT:
+        case SPECIAL_COMP:
+        case SPECIAL_CHUNKED:
+        case SPECIAL_BUFFERED:
+        case SPECIAL_COMPRAS:
+	    /* special elt, call special function */
+	    status = (*access_rec->special_func->info) (access_rec, info);
+	    /* return FAIL if special function fails eventhough special type
+		was OK */
+	    if (status == FAIL) ret_value = FAIL;
+            break;
+#ifdef LATER
+        case SPECIAL_VLINKED:
+            break;
+#endif /* LATER */
+        default:
+            ret_value = 0;
+    } /* switch */
+
+    /* End access to the aid */
+    if (Hendaccess(aid) == FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+	/* End access to the aid if it's been accessed */
+	if (aid != 0)
+	    if (Hendaccess(aid)== FAIL)
+		HERROR(DFE_CANTENDACCESS);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Hgetspecinfo */
+
+
+/* ------------------------------- Hgetntinfo ------------------------------ */
+/*
+NAME
+   Hgetntinfo -- retrieves some information of a number type in text format
+USAGE
+   intn Hgetntinfo(numbertype, nt_info)
+   int32 numbertype;      IN: HDF-supported number type
+   hdf_ntinfo_t *nt_info; OUT: structure containing number type's info
+RETURNS
+   FAIL if there is no match for the number type, otherwise, SUCCEED.
+DESCRIPTION
+   Load the structure hdf_ntinfo_t with the number type's name and byte
+   order in array of characters format.  When the "default:" is reached,
+   it means that a supported number type is missing from the switch statement
+   or an unrecognized value is encountered.  The type will be verified and
+   added or appropriate error handling will be added.  The structure
+   hdf_ntinfo_t is defined in hdf.h.
+
+   Design note: Passing the struct hdf_ntinfo_t into this function instead
+   of individual strings will allow expandability without changing the
+   function's prototype in the event of more information is desired.
+   -BMR (Sep 2010)
+
+---------------------------------------------------------------------------*/
+intn
+Hgetntinfo(const int32 numbertype, hdf_ntinfo_t *nt_info)
+{
+    /* Clear error stack */
+    HEclear();
+
+    /* Get byte order string */
+    if ((DFNT_LITEND & numbertype) > 0)
+    {
+        HDstrcpy(nt_info->byte_order, "littleEndian");
+    }
+    else
+        HDstrcpy(nt_info->byte_order, "bigEndian");
+
+    /* Get type name string; must mask native and little-endian to make
+       sure we get standard type */
+    switch((numbertype & ~DFNT_NATIVE) & ~DFNT_LITEND)
+    {
+      case DFNT_UCHAR8:
+        HDstrcpy(nt_info->type_name, "uchar8");
+        break;
+      case DFNT_CHAR8:
+        HDstrcpy(nt_info->type_name, "char8");
+        break;
+      case DFNT_FLOAT32:
+        HDstrcpy(nt_info->type_name, "float32");
+        break;
+      case DFNT_FLOAT64:
+        HDstrcpy(nt_info->type_name, "float64");
+        break;
+      case DFNT_FLOAT128:
+        HDstrcpy(nt_info->type_name, "float128");
+        break;
+      case DFNT_INT8:
+        HDstrcpy(nt_info->type_name, "int8");
+        break;
+      case DFNT_UINT8:
+        HDstrcpy(nt_info->type_name, "uint8");
+        break;
+      case DFNT_INT16:
+        HDstrcpy(nt_info->type_name, "int16");
+        break;
+      case DFNT_UINT16:
+        HDstrcpy(nt_info->type_name, "uint16");
+        break;
+      case DFNT_INT32:
+        HDstrcpy(nt_info->type_name, "int32");
+        break;
+      case DFNT_UINT32:
+        HDstrcpy(nt_info->type_name, "uint32");
+        break;
+      case DFNT_INT64:
+        HDstrcpy(nt_info->type_name, "int64");
+        break;
+      case DFNT_UINT64:
+        HDstrcpy(nt_info->type_name, "uint64");
+        break;
+      case DFNT_INT128:
+        HDstrcpy(nt_info->type_name, "int128");
+        break;
+      case DFNT_UINT128:
+        HDstrcpy(nt_info->type_name, "uint128");
+        break;
+      case DFNT_CHAR16:
+        HDstrcpy(nt_info->type_name, "char16");
+        break;
+      case DFNT_UCHAR16:
+        HDstrcpy(nt_info->type_name, "uchar16");
+        break;
+      default:
+	return FAIL;
+    } /* end switch */
+    return SUCCEED;
+} /* Hgetntinfo */
+
+
+#ifdef HAVE_FMPOOL
+/******************************************************************************
+NAME
+     Hmpset - set pagesize and maximum number of pages to cache on next open/create
+
+DESCRIPTION
+     Set the pagesize and maximum number of pages to cache on the next 
+     open/create of a file. A pagesize that is a power of 2 is recommended.
+
+     The values set here only affect the next open/creation of a file and
+     do not change a particular file's paging behaviour after it has been
+     opened or created. This maybe changed in a later release.
+
+     Use flags arguement of 'MP_PAGEALL' if the whole file is to be cached 
+     in memory otherwise passs in zero.
+
+RETURNS
+     Returns SUCCEED if successful and FAIL otherwise
+
+NOTE
+     This calls the real routine MPset().
+     Currently 'maxcache' has to be greater than 1. Maybe use special 
+     case of 0 to specify you want to turn page buffering off or use
+     the flags arguement. 
+
+******************************************************************************/
+int
+Hmpset(int pagesize, /* IN: pagesize to use for next open/create */
+       int maxcache, /* IN: max number of pages to cache */
+       int flags     /* IN: flags = 0, MP_PAGEALL */
+)
+{
+    int ret_value = SUCCEED;
+
+        /* call the real routine */
+    ret_value =  MPset(pagesize,maxcache,flags);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}
+
+/******************************************************************************
+NAME
+     Hmpget - get last pagesize and max number of pages cached for open/create
+
+DESCRIPTION
+     This gets the last pagesize and maximum number of pages cached for 
+     the last open/create of a file.
+
+RETURNS
+     Returns SUCCEED.
+
+NOTES
+     This routine calls the real routine MPget().
+******************************************************************************/
+int
+Hmpget(int *pagesize, /* OUT: pagesize to used in last open/create */
+      int *maxcache, /* OUT: max number of pages cached in last open/create */
+      int flags      /* IN: */
+)
+{
+    int psize = 0;
+    int mcache = 0;
+    int ret_value = SUCCEED;
+
+    /* call the real routine */
+    ret_value =  MPget(&psize,&mcache,flags);
+    *pagesize = psize;
+    *maxcache = mcache;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* Hmpget() */
+
+#endif /* HAVE_FMPOOL */
diff --git a/hdf/src/hfile.h b/hdf/src/hfile.h
new file mode 100644
index 0000000..1cb7c3a
--- /dev/null
+++ b/hdf/src/hfile.h
@@ -0,0 +1,928 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hfile.h 6079 2014-02-08 00:29:03Z bmribler $ */
+
+/*+ hfile.h
+   *** Header for hfile.c, routines for low level data element I/O
+   + */
+
+#ifndef HFILE_H
+#define HFILE_H
+
+#include "H4api_adpt.h"
+
+#include "tbbt.h"
+#include "bitvect.h"
+#include "atom.h"
+#include "linklist.h"
+#include "dynarray.h"
+
+/* Magic cookie for HDF data files */
+#define MAGICLEN 4  /* length */
+#define HDFMAGIC "\016\003\023\001"     /* ^N^C^S^A */
+
+/* sizes of elements in a file.  This is necessary because
+   the size of variables need not be the same as in the file
+   (cannot use sizeof) */
+#define DD_SZ 12    /* 2+2+4+4 */
+#define NDDS_SZ 2
+#define OFFSET_SZ 4
+
+/* invalid offset & length to indicate a partially defined element 
+* written to the HDF file i.e. can handle the case where the the
+* element is defined but not written out */
+#define INVALID_OFFSET -1
+#define INVALID_LENGTH -1
+
+
+/* ----------------------------- Version Tags ----------------------------- */
+/* Library version numbers */
+
+#define LIBVER_MAJOR    4
+#define LIBVER_MINOR    2 
+#define LIBVER_RELEASE  10 
+#define LIBVER_SUBRELEASE ""   /* For pre-releases like snap0       */
+                                /* Empty string for real releases.           */
+#define LIBVER_STRING   "HDF Version 4.2 Release 10, February 7, 2014"
+#define LIBVSTR_LEN    80   /* length of version string  */
+#define LIBVER_LEN  92      /* 4+4+4+80 = 92 */
+/* end of version tags */
+
+/* -------------------------- File I/O Functions -------------------------- */
+/* FILELIB -- file library to use for file access: 1 stdio, 2 fcntl
+   default to stdio library i.e. UNIX buffered I/O */
+
+#ifndef FILELIB
+#   define FILELIB UNIXBUFIO    /* UNIX buffered I/O is the default */
+#endif /* FILELIB */
+
+#if (FILELIB == UNIXBUFIO)
+/* using C buffered file I/O routines to access files */
+#include <stdio.h>
+typedef FILE *hdf_file_t;
+#if defined SUN && defined (__GNUC__)
+#   define HI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                fopen((p), "r+") : fopen((p), "r"))
+#   define HI_CREATE(p)        (fopen((p), "w+"))
+#else /* !SUN w/ GNU CC */
+#   define HI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                fopen((p), "rb+") : fopen((p), "rb"))
+#   define HI_CREATE(p)        (fopen((p), "wb+"))
+#endif /* !SUN w/ GNU CC */
+#   define HI_READ(f, b, n)    (((size_t)(n) == (size_t)fread((b), 1, (size_t)(n), (f))) ? \
+                                SUCCEED : FAIL)
+#   define HI_WRITE(f, b, n)   (((size_t)(n) == (size_t)fwrite((b), 1, (size_t)(n), (f))) ? \
+                                SUCCEED : FAIL)
+#   define HI_CLOSE(f)   (((f = ((fclose(f)==0) ? NULL : f))==NULL) ? SUCCEED:FAIL)
+#   define HI_FLUSH(f)   (fflush(f)==0 ? SUCCEED : FAIL)
+#   define HI_SEEK(f,o)  (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL)
+#   define HI_SEEK_CUR(f,o)  (fseek((f), (long)(o), SEEK_CUR)==0 ? SUCCEED : FAIL)
+#   define HI_SEEKEND(f) (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL)
+#   define HI_TELL(f)    (ftell(f))
+#   define OPENERR(f)    ((f) == (FILE *)NULL)
+#endif /* FILELIB == UNIXBUFIO */
+
+#if (FILELIB == UNIXUNBUFIO)
+/* using UNIX unbuffered file I/O routines to access files */
+typedef int hdf_file_t;
+#   define HI_OPEN(p, a)       (((a) & DFACC_WRITE) ? \
+                                    open((p), O_RDWR) : open((p), O_RDONLY))
+#   define HI_CREATE(p)         (open((p), O_RDWR | O_CREAT | O_TRUNC, 0666))
+#   define HI_CLOSE(f)          (((f = ((close(f)==0) ? NULL : f))==NULL) ? SUCCEED:FAIL)
+#   define HI_FLUSH(f)          (SUCCEED)
+#   define HI_READ(f, b, n)     (((n)==read((f), (char *)(b), (n))) ? SUCCEED : FAIL)
+#   define HI_WRITE(f, b, n)    (((n)==write((f), (char *)(b), (n))) ? SUCCEED : FAIL)
+#   define HI_SEEK(f, o)        (lseek((f), (off_t)(o), SEEK_SET)!=(-1) ? SUCCEED : FAIL)
+#   define HI_SEEKEND(f)        (lseek((f), (off_t)0, SEEK_END)!=(-1) ? SUCCEED : FAIL)
+#   define HI_TELL(f)           (lseek((f), (off_t)0, SEEK_CUR))
+#   define OPENERR(f)           (f < 0)
+#endif /* FILELIB == UNIXUNBUFIO */
+
+#if (FILELIB == MACIO)
+/* using special routines to redirect to Mac Toolkit I/O */
+typedef short hdf_file_t;
+#   define HI_OPEN(x,y)         mopen(x,y)
+#   define HI_CREATE(name)      mopen(name, DFACC_CREATE)
+#   define HI_CLOSE(x)          (((x = ((mclose(x)==0) ? NULL : x))==NULL) ? SUCCEED:FAIL)
+#   define HI_FLUSH(a)          (SUCCEED)
+#   define HI_READ(a,b,c)       mread(a, (char *) b, (int32) c)
+#   define HI_WRITE(a,b,c)      mwrite(a, (char *) b, (int32) c)
+#   define HI_SEEK(x,y)         mlseek(x, (int32 )y, 0)
+#   define HI_SEEKEND(x)        mlseek(x, 0L, 2)
+#   define HI_TELL(x)           mlseek(x,0L,1)
+#   define DF_OPENERR(f)        ((f) == -1)
+#   define OPENERR(f)           (f < 0)
+#endif /* FILELIB == MACIO */
+
+
+/* ----------------------- Internal Data Structures ----------------------- */
+/* The internal structure used to keep track of the files opened: an
+   array of filerec_t structures, each has a linked list of ddblock_t.
+   Each ddblock_t struct points to an array of dd_t structs. 
+
+   File Header(4 bytes)
+   ===================
+   <--- 32 bits ----->
+   ------------------
+   |HDF magic number |
+   ------------------
+
+   HDF magic number - 0x0e031301 (Hexadecimal)
+
+   Data Descriptor(DD - 12 bytes)
+   ==============================
+   <-  16 bits -> <- 16 bits -> <- 32 bits -> <- 32 bits ->
+   --------------------------------------------------------
+   |    Tag      | reference   |  Offset     |  Length    |
+   |             | number      |             |            |
+   --------------------------------------------------------
+        \____________/
+               V
+        tag/ref (unique data indentifier in file)
+   
+   Tag  -- identifies the type of data, 16 bit unsigned integer whose
+           value ranges from 1 - 65535. Tags are assigned by NCSA.
+           The HDF tag space is divided as follows based on the 2 highest bits:
+
+              00: NCSA reserved ordinary tags
+              01: NCSA reserved special tags(i.e. regular tags made into 
+                                                  linked-block, external, 
+                                                  compressed or chunked.)
+              10, 11: User tags.
+
+           Current tag assingments are:
+           00001 - 32767  - reserved for NCSA use
+                            00001 - 16383 - NCSA regular tags
+                            16384 - 32767 - NCSA special tags
+           32768 - 64999  - user definable
+           65000 - 65535  - reserved for expansion of format
+
+   Refererence number - 16 bit unsigned integer whose assignment is not
+          gauranteed to be consecutive. Provides a way to distinguish 
+          elements with the same tag in the file.
+
+   Offset - Specifies the byte offset of the data element from the 
+            beginning of the file - 32 bit unsigned integer
+
+   Length - Indicates the byte length of the data element
+            32 bit unsigned integer
+
+   Data Descriptor Header(DDH - 6 bytes)
+   ====================================
+   <-  16 bits -> <- 32 bits ->
+   -----------------------------
+   | Block Size  | Next Block  |
+   -----------------------------
+
+   Block Size - Indicates the number of DD's in the DD Block,
+                16 bit unsigned integer value
+   Next Block - Gives the offset of the next DD Block. The last DD Block has
+                a ZERO(0) in the "Next Block" field in the DDH.
+                32 bit unsigned integer value
+
+   Data Descriptor Block(DDB - variable size)
+   ==========================================
+   <- DD Header -> <--------------- DD's --------------------->
+   --------------------------------------------------------...-
+   |Block | Next  | DD | DD | DD | DD | DD | DD | DD | DD |...|
+   |Size  | Block |    |    |    |    |    |    |    |    |   |
+   --------------------------------------------------------...-
+   <-------------------------- DD Block ---------------------->
+
+   Note: default number of DD's in a DD Block is 16
+
+   HDF file layout
+   =============================
+   (one example)
+   ---------------------------------------------------------------------
+   | FH | DD Block | Data | DD Block | Data | DD Block | Data | .....
+   ---------------------------------------------------------------------
+ 
+*/
+
+/* record of each data decsriptor */
+typedef struct dd_t
+  {
+      uint16      tag;          /* Tag number of element i.e. type of data */
+      uint16      ref;          /* Reference number of element */
+      int32       length;       /* length of data element */
+      int32       offset;       /* byte offset of data element from */
+      struct ddblock_t *blk;    /* Pointer to the block this dd is in */
+  }                             /* beginning of file */
+dd_t;
+
+/* version tags */
+typedef struct version_t
+  {
+      uint32      majorv;       /* major version number */
+      uint32      minorv;       /* minor version number */
+      uint32      release;      /* release number */
+      char        string[LIBVSTR_LEN + 1];  /* optional text description, len 80+1 */
+      int16       modified;     /* indicates file was modified */
+  }
+version_t;
+
+/* record of a block of data descriptors, mirrors structure of a HDF file.  */
+typedef struct ddblock_t
+  {
+      uintn       dirty;        /* boolean: should this DD block be flushed? */
+      int32       myoffset;     /* offset of this DD block in the file */
+      int16       ndds;         /* number of dd's in this block */
+      int32       nextoffset;   /* offset to the next ddblock in the file */
+      struct filerec_t *frec;   /* Pointer to the filerec this block is in */
+      struct ddblock_t *next;   /* pointer to the next ddblock in memory */
+      struct ddblock_t *prev;   /* Pointer to previous ddblock. */
+      struct dd_t *ddlist;      /* pointer to array of dd's */
+  }
+ddblock_t;
+
+/* Tag tree node structure */
+typedef struct tag_info_str
+  {
+      uint16 tag;       /* tag value for this node */
+      /* Needs to be first in this structure */
+      bv_ptr b;         /* bit-vector to keep track of which refs are used */
+      dynarr_p d;       /* dynarray of the refs for this tag */
+  }tag_info;
+
+/* For determining what the last file operation was */
+typedef enum
+  {
+      H4_OP_UNKNOWN = 0,   /* Don't know what the last operation was (after fopen frex) */
+      H4_OP_SEEK,          /* Last operation was a seek */
+      H4_OP_WRITE,         /* Last operation was a write */
+      H4_OP_READ           /* Last operation was a read */
+  }
+fileop_t;
+
+/* File record structure */
+typedef struct filerec_t
+  {
+      char       *path;         /* name of file */
+      hdf_file_t  file;         /* either file descriptor or pointer */
+      uint16      maxref;       /* highest ref in this file */
+      intn        access;       /* access mode */
+      intn        refcount;     /* reference count / times opened */
+      intn        attach;       /* number of access elts attached */
+      intn        version_set;  /* version tag stuff */
+      version_t   version;      /* file version info */
+
+      /* Seek caching info */
+      int32      f_cur_off;    /* Current location in the file */
+      fileop_t    last_op;      /* the last file operation performed */
+
+      /* DD block caching info */
+      intn        cache;        /* boolean: whether caching is on */
+      intn        dirty;        /* boolean: if dd list needs to be flushed */
+      int32      f_end_off;    /* offset of the end of the file */
+
+      /* DD list pointers */
+      struct ddblock_t *ddhead; /* head of ddblock list */
+      struct ddblock_t *ddlast; /* end of ddblock list */
+
+      /* NULL DD pointers (for fast lookup of DFTAG_NULL) */
+      struct ddblock_t *ddnull; /* location of last ddblock with a DFTAG_NULL */
+      int32       ddnull_idx;   /* offset of the last location with DFTAG_NULL */
+
+      /* tag tree for file */
+      TBBT_TREE *tag_tree;      /* TBBT of the tags in the file */
+
+      /* annotation stuff for file */
+      intn       an_num[4];   /* Holds number of annotations found of each type */
+      TBBT_TREE *an_tree[4];  /* tbbt trees for each type of annotation in file 
+                               * i.e. file/data labels and descriptions.
+                               * This is done for faster searching of annotations
+                               * of a particular type. */
+  }
+filerec_t;
+
+/* bits for filerec_t 'dirty' flag */
+#define DDLIST_DIRTY   0x01     /* mark whether to flush dirty DD blocks */
+#define FILE_END_DIRTY 0x02     /* indicate that the file needs to be extended */
+
+/* Each access element is associated with a tag/ref to keep track of
+   the dd it is pointing at.  To facilitate searching for next dd's,
+   instead of pointing directly to the dd, we point to the ddblock and
+   index into the ddlist of that ddblock. */
+typedef struct accrec_t
+  {
+      /* Flags for this access record */
+      intn        appendable;   /* whether appends to the data are allowed */
+      intn        special;      /* special element ? */
+      intn        new_elem;     /* is a new element (i.e. no length set yet) */
+      int32       block_size;   /* size of the blocks for linked-block element*/
+      int32       num_blocks;   /* number blocks in the linked-block element */
+      uint32      access;       /* access codes */
+      uintn       access_type;  /* I/O access type: serial/parallel/... */
+      int32       file_id;      /* id of attached file */
+      atom_t      ddid;         /* DD id for the DD attached to */
+      int32       posn;         /* seek position with respect to start of element */
+      void *       special_info; /* special element info? */
+      struct funclist_t *special_func;  /* ptr to special function? */
+      struct accrec_t *next;    /* for free-list linking */
+  }
+accrec_t;
+
+#ifdef HFILE_MASTER
+/* Pointer to the access record node free list */
+static accrec_t *accrec_free_list=NULL;
+#endif /* HFILE_MASTER */
+
+/* this type is returned to applications programs or other special
+   interfaces when they need to know information about a given
+   special element.  This is all information that would not be returned
+   via Hinquire().  This should probably be a union of structures. */
+/* Added length of external element.  Note: this length is not returned
+   via Hinquire(). -BMR 2011/12/12 */
+typedef struct sp_info_block_t
+  {
+      int16       key;          /* type of special element this is */
+
+      /* external elements */
+      int32       offset;       /* offset in the file */
+      int32       length;       /* length of external data in the file */
+      int32       length_file_name;  /* length of external file name */
+      char       *path;         /* file name - should not be freed by user */
+
+      /* linked blocks */
+      int32       first_len;    /* length of first block */
+      int32       block_len;    /* length of standard block */
+      int32       nblocks;      /* number of blocks per chunk */
+
+      /* compressed elements */
+      int32       comp_type;    /* compression type */
+      int32       model_type;   /* model type */
+      int32       comp_size;    /* size of compressed information */
+
+      /* variable-length linked blocks */
+      int32       min_block;    /* the minimum block size */
+
+    /* Chunked elements */
+      int32       chunk_size;   /* logical size of chunks */
+      int32       ndims;        /* number of dimensions */
+      int32       *cdims;       /* array of chunk lengths for each dimension */
+
+      /* Buffered elements */
+      int32       buf_aid;      /* AID of element buffered */
+  }
+sp_info_block_t;
+
+/* a function table record for accessing special data elements.
+   special data elements of a key could be accessed through the list
+   of functions in array pointed to by tab. */
+typedef struct funclist_t
+  {
+      int32       (*stread) (accrec_t * rec);
+      int32       (*stwrite) (accrec_t * rec);
+      int32       (*seek) (accrec_t * access_rec, int32 offset, intn origin);
+      int32       (*inquire) (accrec_t * access_rec, int32 *pfile_id,
+                                 uint16 *ptag, uint16 *pref, int32 *plength,
+                               int32 *poffset, int32 *pposn, int16 *paccess,
+                                     int16 *pspecial);
+      int32       (*read) (accrec_t * access_rec, int32 length, void * data);
+      int32       (*write) (accrec_t * access_rec, int32 length, const void * data);
+      intn        (*endaccess) (accrec_t * access_rec);
+      int32       (*info) (accrec_t * access_rec, sp_info_block_t * info);
+      int32       (*reset) (accrec_t * access_rec, sp_info_block_t * info);
+  }
+funclist_t;
+
+typedef struct functab_t
+  {
+      int16       key;          /* the key for this type of special elt */
+      funclist_t *tab;          /* table of accessing functions */
+  }
+functab_t;
+
+/* ---------------------- ID Types and Manipulation ----------------------- */
+/* each id, what ever the type, will be represented with a 32-bit word,
+   the most-significant 16 bits is a number unique for type.  The less-
+   significant 16 bits is an id unique to each type; in this, we use the
+   internal slot number. */
+
+#define FIDTYPE   1
+#define AIDTYPE   2
+#define GROUPTYPE 3
+#define SDSTYPE   4
+#define DIMTYPE   5
+#define CDFTYPE   6
+#define VGIDTYPE  8     /* also defined in vg.h for Vgroups */
+#define VSIDTYPE  9     /* also defined in vg.h for Vsets */
+#define BITTYPE   10    /* For bit-accesses */
+#define GRIDTYPE  11    /* for GR access */
+#define RIIDTYPE  12    /* for RI access */
+
+#define BADFREC(r)  ((r)==NULL || (r)->refcount==0)
+
+/* --------------------------- Special Elements --------------------------- */
+/* The HDF tag space is divided as follows based on the 2 highest bits:
+   00: NCSA reserved ordinary tags
+   01: NCSA reserved special tags(e.g. linked-block, external, compressed,..)
+   10, 11: User tags.
+
+   It is relatively cheap to operate with special tags within the NCSA
+   reserved tags range. For users to specify special tags and their
+   corresponding ordinary tag, the pair has to be added to the
+   special_table in hfile.c and SPECIAL_TABLE must be defined. */
+
+#ifdef SPECIAL_TABLE
+#define BASETAG(t)      (HDbase_tag(t))
+#define SPECIALTAG(t)   (HDis_special_tag(t))
+#define MKSPECIALTAG(t) (HDmake_special_tag(t))
+#else
+/* This macro converts a (potentially) special tag into a normal tag */
+#define BASETAG(t)      (uint16)((~(t) & 0x8000) ? ((t) & ~0x4000) : (t))
+/* This macro checks if a tag is special */
+#define SPECIALTAG(t)   (uint16)((~(t) & 0x8000) && ((t) & 0x4000))
+/* This macro (potentially) converts a regular tag into a special tag */
+#define MKSPECIALTAG(t) (uint16)((~(t) & 0x8000) ? ((t) | 0x4000) : DFTAG_NULL)
+#endif /*SPECIAL_TABLE */
+
+/* -------------------------- H-Layer Prototypes -------------------------- */
+/*
+   ** Functions to get information of special elt from other access records.
+   **   defined in hfile.c
+   ** These should really be HD... routines, but they are only used within
+   **   the H-layer...
+ */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+    HDFLIBAPI accrec_t *HIget_access_rec
+                (void);
+
+    HDFLIBAPI void HIrelease_accrec_node(accrec_t *acc);
+
+    HDFLIBAPI void * HIgetspinfo
+                (accrec_t * access_rec);
+
+    HDFLIBAPI intn HPcompare_filerec_path
+                (const void * obj, const void * key);
+
+    HDFLIBAPI intn HPcompare_accrec_tagref
+                (const void * rec1, const void * rec2);
+
+    HDFLIBAPI int32 HPgetdiskblock
+                (filerec_t * file_rec, int32 block_size, intn moveto);
+
+    HDFLIBAPI intn HPfreediskblock
+                (filerec_t * file_rec, int32 block_offset, int32 block_size);
+
+    HDFLIBAPI intn HPisfile_in_use
+                (const char *path);
+
+    HDFLIBAPI int32 HDcheck_empty
+                (int32 file_id, uint16 tag, uint16 ref, intn *emptySDS);
+
+    HDFLIBAPI int32 HDget_special_info
+                (int32 access_id, sp_info_block_t * info_block);
+
+    HDFLIBAPI int32 HDset_special_info
+                (int32 access_id, sp_info_block_t * info_block);
+
+    HDFLIBAPI intn HP_read
+                (filerec_t *file_rec,void * buf,int32 bytes);
+
+    HDFLIBAPI intn HPseek
+                (filerec_t *file_rec,int32 offset);
+
+    HDFLIBAPI intn HP_write
+                (filerec_t *file_rec,const void * buf,int32 bytes);
+
+    HDFLIBAPI int32 HPread_drec
+                (int32 file_id, atom_t data_id, uint8** drec_buf);
+
+    HDFLIBAPI intn tagcompare
+                (void * k1, void * k2, intn cmparg);
+
+    HDFLIBAPI VOID tagdestroynode
+                (void * n);
+
+/*
+   ** from hblocks.c
+ */
+    HDFLIBAPI int32 HLPstread
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HLPstwrite
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HLPseek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    HDFLIBAPI int32 HLPread
+                (accrec_t * access_rec, int32 length, void * data);
+
+    HDFLIBAPI int32 HLPwrite
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    HDFLIBAPI int32 HLPinquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    HDFLIBAPI intn HLPendaccess
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HLPcloseAID
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HLPinfo
+                (accrec_t * access_rec, sp_info_block_t * info_block);
+
+/*
+   ** from hextelt.c
+ */
+    HDFLIBAPI int32 HXPstread
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HXPstwrite
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HXPseek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    HDFLIBAPI int32 HXPread
+                (accrec_t * access_rec, int32 length, void * data);
+
+    HDFLIBAPI int32 HXPwrite
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    HDFLIBAPI int32 HXPinquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    HDFLIBAPI intn HXPendaccess
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HXPcloseAID
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HXPinfo
+                (accrec_t * access_rec, sp_info_block_t * info_block);
+
+    HDFLIBAPI int32 HXPreset
+                (accrec_t * access_rec, sp_info_block_t * info_block);
+
+    HDFLIBAPI intn HXPsetaccesstype
+                (accrec_t * access_rec);
+
+    HDFLIBAPI intn HXPshutdown
+                (void);
+
+/*
+   ** from hcomp.c
+ */
+
+    HDFLIBAPI int32 HCPstread
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HCPstwrite
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HCPseek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    HDFLIBAPI int32 HCPinquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    HDFLIBAPI int32 HCPread
+                (accrec_t * access_rec, int32 length, void * data);
+
+    HDFLIBAPI int32 HCPwrite
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    HDFLIBAPI intn HCPendaccess
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HCPcloseAID
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HCPinfo
+                (accrec_t * access_rec, sp_info_block_t * info_block);
+
+    HDFLIBAPI int32 get_comp_len
+	        (accrec_t* access_rec);
+
+/*
+   ** from hchunks.c - should be the same as found in 'hchunks.h'
+ */
+#include "hchunks.h"
+
+
+/*
+   ** from hbuffer.c
+ */
+
+    HDFLIBAPI int32 HBPstread
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HBPstwrite
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HBPseek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    HDFLIBAPI int32 HBPinquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    HDFLIBAPI int32 HBPread
+                (accrec_t * access_rec, int32 length, void * data);
+
+    HDFLIBAPI int32 HBPwrite
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    HDFLIBAPI intn HBPendaccess
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HBPcloseAID
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HBPinfo
+                (accrec_t * access_rec, sp_info_block_t * info_block);
+
+/*
+   ** from hcompri.c
+ */
+
+    HDFLIBAPI int32 HRPstread
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HRPstwrite
+                (accrec_t * rec);
+
+    HDFLIBAPI int32 HRPseek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    HDFLIBAPI int32 HRPinquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    HDFLIBAPI int32 HRPread
+                (accrec_t * access_rec, int32 length, void * data);
+
+    HDFLIBAPI int32 HRPwrite
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    HDFLIBAPI intn HRPendaccess
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HRPcloseAID
+                (accrec_t * access_rec);
+
+    HDFLIBAPI int32 HRPinfo
+                (accrec_t * access_rec, sp_info_block_t * info_block);
+
+/*
+   ** from hfiledd.c
+ */
+/******************************************************************************
+ NAME
+     HTPstart - Initialize the DD list in memory
+
+ DESCRIPTION
+    Reads the DD blocks from disk and creates the in-memory structures for
+    handling them.  This routine should only be called once for a given
+    file and HTPend should be called when finished with the DD list (i.e.
+    when the file is being closed).
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPstart(filerec_t *file_rec       /* IN:  File record to store info in */
+);
+
+/******************************************************************************
+ NAME
+     HTPinit - Create a new DD list in memory
+
+ DESCRIPTION
+    Creates a new DD list in memory for a newly created file.  This routine
+    should only be called once for a given file and HTPend should be called
+    when finished with the DD list (i.e.  when the file is being closed).
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPinit(filerec_t *file_rec,       /* IN: File record to store info in */
+    int16 ndds                          /* IN: # of DDs to store in each block */
+);
+
+/******************************************************************************
+ NAME
+     HTPsync - Flush the DD list in memory
+
+ DESCRIPTION
+    Syncronizes the in-memory copy of the DD list with the copy on disk by
+    writing out the DD blocks which have changed to disk.
+    
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPsync(filerec_t *file_rec       /* IN:  File record to store info in */
+);
+
+/******************************************************************************
+ NAME
+     HTPend - Terminate the DD list in memory
+
+ DESCRIPTION
+    Terminates access to the DD list in memory, writing the DD blocks out to
+    the disk (if they've changed).  After this routine is called, no further
+    access to tag/refs (or essentially any other HDF objects) can be performed
+    on the file.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPend(filerec_t *file_rec       /* IN:  File record to store info in */
+); 
+
+/******************************************************************************
+ NAME
+     HTPcreate - Create (and attach to) a tag/ref pair
+
+ DESCRIPTION
+    Creates a new tag/ref pair in memory and inserts the tag/ref pair into the
+    DD list to be written out to disk.  This routine returns a DD id which can
+    be used in the other tag/ref routines to modify the DD.
+
+ RETURNS
+    Returns DD id if successful and FAIL otherwise
+
+*******************************************************************************/
+atom_t HTPcreate(filerec_t *file_rec,   /* IN: File record to store info in */
+    uint16 tag,                         /* IN: Tag to create */
+    uint16 ref                          /* IN: ref to create */
+);
+
+/******************************************************************************
+ NAME
+     HTPselect - Attach to an existing tag/ref pair
+
+ DESCRIPTION
+    Attaches to an existing tag/ref pair.  This routine returns a DD id which
+    can be used in the other tag/ref routines to modify the DD.
+
+ RETURNS
+    Returns DD id if successful and FAIL otherwise
+
+*******************************************************************************/
+atom_t HTPselect(filerec_t *file_rec,   /* IN: File record to store info in */
+    uint16 tag,                         /* IN: Tag to select */
+    uint16 ref                          /* IN: ref to select */
+);
+
+/******************************************************************************
+ NAME
+     HTPendaccess - End access to an existing tag/ref pair
+
+ DESCRIPTION
+    Ends access to an existing tag/ref pair.  Any further access to the tag/ref
+    pair may result in incorrect information being recorded about the DD in
+    memory or on disk.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPendaccess(atom_t ddid           /* IN: DD id to end access to */
+);
+
+/******************************************************************************
+ NAME
+     HTPdelete - Delete an existing tag/ref pair
+
+ DESCRIPTION
+    Deletes a tag/ref from the file.  Also ends access to the tag/ref pair.
+    Any further access to the tag/ref pair may result in incorrect information
+    being recorded about the DD in memory or on disk.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPdelete(atom_t ddid              /* IN: DD id to delete */
+);
+
+/******************************************************************************
+ NAME
+     HTPupdate - Change the offset or length of an existing tag/ref pair
+
+ DESCRIPTION
+    Updates a tag/ref in the file, allowing the length and/or offset to be
+    modified. Note: "INVALID_OFFSET" & "INVALID_LENGTH" are used to indicate
+    that the length or offset (respectively) is unchanged.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPupdate(atom_t ddid,             /* IN: DD id to update */
+    int32 new_off,                      /* IN: new offset for DD */
+    int32 new_len                       /* IN: new length for DD */
+);
+
+/******************************************************************************
+ NAME
+     HTPinquire - Get the DD information for a DD (i.e. tag/ref/offset/length)
+
+ DESCRIPTION
+    Get the DD information for a DD id from the DD block.  Passing NULL for
+    any parameter does not try to update that parameter.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPinquire(atom_t ddid,            /* IN: DD id to inquire about */
+    uint16 *tag,                        /* IN: tag of DD */
+    uint16 *ref,                        /* IN: ref of DD */
+    int32 *off,                         /* IN: offset of DD */
+    int32 *len                          /* IN: length of DD */
+);
+
+/******************************************************************************
+ NAME
+     HTPis_special - Check if a DD id is associated with a special tag
+
+ DESCRIPTION
+    Checks if the tag for the DD id is a special tag.
+
+ RETURNS
+    Returns TRUE(1)/FALSE(0) if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPis_special(atom_t ddid             /* IN: DD id to inquire about */
+);
+
+/******************************************************************************
+ NAME
+    HTPdump_dds -- Dump out the dd information for a file
+
+ DESCRIPTION
+    Prints out all the information (that you could _ever_ want to know) about
+    the dd blocks and dd list for a file.
+
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+
+*******************************************************************************/
+intn HTPdump_dds(int32 file_id,     /* IN: file ID of HDF file to dump info for */
+    FILE *fout                      /* IN: file stream to output to */
+);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/* #define DISKBLOCK_DEBUG */
+#ifdef DISKBLOCK_DEBUG
+
+#ifndef HFILE_MASTER
+extern
+#endif /* HFILE_MASTER */
+const uint8 diskblock_header[4]
+#ifdef HFILE_MASTER
+={0xde, 0xad, 0xbe, 0xef}
+#endif /* HFILE_MASTER */
+;
+
+#ifndef HFILE_MASTER
+extern
+#endif /* HFILE_MASTER */
+const uint8 diskblock_tail[4]
+#ifdef HFILE_MASTER
+={0xfe, 0xeb, 0xda, 0xed}
+#endif /* HFILE_MASTER */
+;
+#define DISKBLOCK_HSIZE sizeof(diskblock_header)
+#define DISKBLOCK_TSIZE sizeof(diskblock_tail)
+
+#endif /* DISKBLOCK_DEBUG */
+
+#endif                          /* HFILE_H */
diff --git a/hdf/src/hfiledd.c b/hdf/src/hfiledd.c
new file mode 100644
index 0000000..03bf40b
--- /dev/null
+++ b/hdf/src/hfiledd.c
@@ -0,0 +1,2333 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5584 $";
+#endif
+
+/* $Id: hfiledd.c 5584 2011-04-13 18:25:06Z bmribler $ */
+
+/*
+FILE
+    hfiledd.c - DD & DD block management routines.
+
+REMARKS
+    These routines provide all the management for the DD list, both on disk
+    and in memory.  The DD list is read in from disk (or created in memory
+    for a new file) here and the tag tree and all the DD modifying functions
+    are in this module.  DO NOT MODIFY THE DD BLOCKS FROM OUTSIDE THIS FILE!
+
+DESIGN
+    The DD blocks are stored in memory in a very similar way to the way they
+    are stored in the file: in a doubly-linked list of DD blocks with each
+    block having a pointer to the array of DDs in it (in the file).  There
+    are additional memory structures which are indexed into the DD list which
+    are designed for faster access to certain manipulations of the DD list.
+    The tag_tree is a tbbt of the tags contained within the file.  Each
+    node of the tag_tree has a link to a bit-vector for keeping track of the
+    refs used for that tag and a link to a dynamic array pointers into the
+    DD list for each ref # used.
+
+BUGS/LIMITATIONS
+
+EXPORTED ROUTINES
+  User-level functions:
+    Hdupdd      - Duplicate a data descriptor
+    Hnumber     - Count number of occurrances of tag/ref in file
+    Hnewref     - Returns a ref that is unique in the file
+    Htagnewref  - Returns a ref that is unique in the file for a given tag
+    Hfind       - Locate the next object of a search in an HDF file
+    Hdeldd      - Delete a data descriptor
+
+  Developer-level routines
+    HDcheck_tagref - Checks to see if tag/ref is in DD list i.e. created already
+    HDreuse_tagref - reuse a data descriptor preserving tag/refw(assumes DD exists)
+
+  Tag/ref functions:
+    HTPcreate   - Create (& attach to) a tag/ref pair (inserts into DD list also)
+    HTPselect   - Attach to an existing DD in the DD list
+    HTPendaccess- End access to an attached DD in the DD list
+    HTPdelete   - Mark a tag/ref pair as free (marks space as free in DD list)
+                    (ends access to the tag/ref also)
+    HTPupdate   - Change the offset and/or length of a data object
+    HTPinquire  - Get the DD information for a DD (i.e. tag/ref/offset/length)
+    HTPis_special- Check if a DD id is associated with a special tag
+  DD list functions:
+    HTPstart    - Initialize the DD list from disk (creates the DD list in memory)
+    HTPinit     - Create a new DD list (creates the DD list in memory)
+    HTPsync     - Flush the DD list to disk (syncronizes with disk)
+    HTPend      - Close the DD list to disk (syncronizes with disk too)
+LOCAL ROUTINES
+    HTIfind_dd      - find a specific DD in the file
+    HTInew_dd_block - create a new (empty) DD block
+    HTIupdate_dd    - update a DD on disk
+    HTIcount_dd     - counts the dd's of a certain type in file
+    HTIregister_tag_ref     - insert a ref into the tag tree for a file
+    HTIunregister_tag_ref   - remove a ref from the tag tree for a file
+
+OLD ROUTINES
+    HIlookup_dd             - find the dd record for an element
+    HIflush_dds             - flush changed DD blocks to file
+    HIinit_file_dds         - Initialize DD blocks for a new file
+    HIfill_file_rec         - read in all of the DDs
+    HIadd_hash_dd           - add a dd to the hash table
+    HIdel_hash_dd           - remove a dd from the hash table
+    HIfind_dd               - find the dd record for an element
+    HIcount_dd              - counts the dd's of a certain type in file
+    HInew_dd_block          - create a new (empty) DD block
+    HIupdate_dd             - write an updated dd to the file
+    HIregister_tag_ref      - mark a ref as used for a tag
+    HIunregister_tag_ref    - mark a ref as un-used for a tag
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   12/20/95  - Starting writing specs & coding prototype
+*/
+
+#include "hdf.h"
+#include "hfile.h"
+
+/* Private routines */
+static intn HTIfind_dd(filerec_t * file_rec, uint16 look_tag, uint16 look_ref,
+            dd_t ** pdd, intn direction);
+
+static intn HTInew_dd_block(filerec_t * file_rec);
+
+static intn HTIupdate_dd(filerec_t * file_rec, dd_t * dd);
+
+static intn HTIcount_dd(filerec_t * file_rec, uint16 cnt_tag, uint16 cnt_ref,
+            uintn *all_cnt, uintn *real_cnt);
+
+static intn HTIregister_tag_ref(filerec_t * file_rec, dd_t *dd);
+
+static intn HTIunregister_tag_ref(filerec_t * file_rec, dd_t *dd_ptr);
+
+/* Local definitions */
+/* The initial size of a ref dynarray */
+#define REF_DYNARRAY_START  64
+/* The increment of a ref dynarray */
+#define REF_DYNARRAY_INCR   256
+/* macros to encode and decode a DD */
+#define DDENCODE(p, tag,ref,offset,length) \
+   {UINT16ENCODE(p, tag); \
+    UINT16ENCODE(p, ref); \
+    INT32ENCODE(p, offset); \
+    INT32ENCODE(p, length); \
+   }
+#define DDDECODE(p, tag,ref,offset,length) \
+   {UINT16DECODE(p, tag); \
+    UINT16DECODE(p, ref); \
+    INT32DECODE(p, offset); \
+    INT32DECODE(p, length); \
+   }
+
+
+/******************************************************************************
+ NAME
+     HTPstart - Initialize the DD list in memory
+
+ DESCRIPTION
+    Reads the DD blocks from disk and creates the in-memory structures for
+    handling them.  This routine should only be called once for a given
+    file and HTPend should be called when finished with the DD list (i.e.
+    when the file is being closed).
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPstart(filerec_t *file_rec       /* IN:  File record to store info in */
+)
+{
+  CONSTR(FUNC, "HTPstart");	/* for HERROR */
+  uint8      *tbuf=NULL;  /* temporary buffer */
+  uintn       tbuf_size=0;    /* temporary buffer size */
+  int32       end_off = 0;	/* offset of the end of the file */
+  intn        ret_value = SUCCEED;
+
+  HEclear();
+  /* Alloc start of linked list of ddblocks. */
+  file_rec->ddhead = (ddblock_t *) HDmalloc(sizeof(ddblock_t));
+  if (file_rec->ddhead == (ddblock_t *) NULL)
+    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+  /* Keep the filerec_t pointer around for each ddblock */
+  file_rec->ddhead->frec=file_rec;
+
+  /* Only one elt in linked list so head is also last. */
+  file_rec->ddlast = file_rec->ddhead;
+  file_rec->ddlast->next = (ddblock_t *) NULL;
+  file_rec->ddlast->prev = (ddblock_t *) NULL;
+
+  /* The first ddblock always starts after the magic number.
+  Set it up so that we start reading from there. */
+  file_rec->ddlast->myoffset = MAGICLEN;	/* set offset of block in file */
+  file_rec->ddlast->dirty = 0;	/* block does not need to be flushed */
+
+  /* Initialize the tag tree */
+  file_rec->tag_tree = tbbtdmake(tagcompare, sizeof(uint16), TBBT_FAST_UINT16_COMPARE);
+
+  /* Initialize the DD atom group (trying 256 hash currently, feel free to change */
+  if(HAinit_group(DDGROUP,256)==FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+  /* Read in the dd's one at a time and determine the max ref in the file
+	   at the same time. */
+  file_rec->maxref = 0;
+  for (;;)
+    {
+        ddblock_t *ddcurr;      /* ptr to the current DD block */
+        dd_t *curr_dd_ptr;      /* pointer to the current DD being read in */
+        uint8       ddhead[NDDS_SZ+OFFSET_SZ];   /* storage for the DD header */
+        uint8      *p;          /* Temporary buffer pointer. */
+        intn        ndds;       /* number of DDs in a block */
+        intn        i;          /* Temporary integer */
+
+        /* Get a short-cut for the current DD block being read-in */
+        ddcurr=file_rec->ddlast;
+  
+        /* Go to the beginning of the DD block */
+        if (HPseek(file_rec, ddcurr->myoffset) == FAIL)
+          HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+  
+        /* Read in the start of this dd block.
+           Read data consists of ndds (number of dd's in this block) and
+           offset (offset to the next ddblock). */
+        if (HP_read(file_rec, ddhead, NDDS_SZ + OFFSET_SZ) == FAIL)
+          HGOTO_ERROR(DFE_READERROR, FAIL);
+  
+        /* Decode the numbers. */
+        p = &ddhead[0];
+        INT16DECODE(p, ddcurr->ndds);
+        ndds = (intn)ddcurr->ndds;
+        if (ndds <= 0)		/* validity check */
+          HGOTO_ERROR(DFE_CORRUPT, FAIL);
+        INT32DECODE(p, ddcurr->nextoffset);
+  
+        /* check if the DD block is the last thing in the file */
+        /* (Unlikely, but possible (I think)) */
+        if (ddcurr->myoffset + (NDDS_SZ + OFFSET_SZ) + (ndds * DD_SZ) > end_off)
+          end_off = ddcurr->myoffset + (NDDS_SZ + OFFSET_SZ) + (ndds * DD_SZ);
+  
+        /* Now that we know how many dd's are in this block,
+           alloc memory for the records. */
+        ddcurr->ddlist = (dd_t *) HDmalloc((uint32) ndds * sizeof(dd_t));
+        if (ddcurr->ddlist==(dd_t *)NULL)
+          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+  
+        /* Allocate memory for the temporary buffer also */
+        if(tbuf==NULL || ((uintn)ndds*DD_SZ)>tbuf_size)
+          {
+              if (tbuf!=(uint8 *)NULL)
+                  HDfree(tbuf);
+              tbuf_size=(uintn)ndds*DD_SZ;
+              tbuf=(uint8 *)HDmalloc(tbuf_size);
+              if (tbuf==(uint8 *)NULL)
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          } /* end if */
+  
+        /* Index of current dd in ddlist of this ddblock is 0. */
+        curr_dd_ptr=ddcurr->ddlist;
+  
+        /* Read in a chunk of dd's from the file. */
+        if (HP_read(file_rec, tbuf, ndds * DD_SZ) == FAIL)
+          HGOTO_ERROR(DFE_READERROR, FAIL);
+  
+      /* decode the dd's */
+        p = tbuf;
+        for (i = 0; i < ndds; i++, curr_dd_ptr++)
+          {
+	    DDDECODE(p, curr_dd_ptr->tag, curr_dd_ptr->ref,
+		curr_dd_ptr->offset, curr_dd_ptr->length);
+            curr_dd_ptr->blk=ddcurr;
+  
+             /* check if maximum ref # exceeded */
+            if (file_rec->maxref < curr_dd_ptr->ref)
+              file_rec->maxref = curr_dd_ptr->ref;
+  
+            /* check if the data element is the last thing in the file */
+            if ((curr_dd_ptr->offset + curr_dd_ptr->length) > end_off)
+              end_off = curr_dd_ptr->offset + curr_dd_ptr->length;
+  
+            /* Add to the tag info tree */
+            if(curr_dd_ptr->tag!=DFTAG_NULL)
+                if(HTIregister_tag_ref(file_rec,curr_dd_ptr)==FAIL)
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+          }
+  
+        if (ddcurr->nextoffset != 0)
+          {	/* More ddblocks in the file */
+              ddblock_t *ddnew;    /* ptr to the new DD block */
+  
+      /* extend the linked list */
+            ddcurr->next = ddnew = (ddblock_t *) HDmalloc((uint32) sizeof(ddblock_t));
+            if (ddnew == (ddblock_t *) NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+  
+            ddnew->prev = ddcurr;
+            ddnew->next = (ddblock_t *) NULL;
+            ddnew->ddlist = (dd_t *) NULL;
+            ddnew->myoffset = ddcurr->nextoffset;
+            ddnew->dirty= FALSE;
+            file_rec->ddlast = ddnew;
+
+            /* Keep the filerec_t pointer around for each ddblock */
+            ddnew->frec=file_rec;
+          }	/* end if */
+        else
+              break;
+      } /* end for */
+    
+    /* Update the DFTAG_NULL pointers */
+    file_rec->ddnull=NULL;
+    file_rec->ddnull_idx=(-1);
+
+    /* Update the end of the file from the DD's we have read in */
+    file_rec->f_end_off = end_off;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  if(tbuf!=NULL)
+      HDfree(tbuf);
+
+  return ret_value;
+} /* end HTPstart() */
+
+/******************************************************************************
+ NAME
+     HTPinit - Create a new DD list in memory
+
+ DESCRIPTION
+    Creates a new DD list in memory for a newly created file.  This routine
+    should only be called once for a given file and HTPend should be called
+    when finished with the DD list (i.e.  when the file is being closed).
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPinit(filerec_t *file_rec,       /* IN: File record to store info in */
+    int16 ndds                          /* IN: # of DDs to store in each block */
+)
+{
+    CONSTR(FUNC, "HTPinit");    /* for HERROR */
+    ddblock_t  *block;          /* dd block to intialize */
+    uint8       ddhead[NDDS_SZ+OFFSET_SZ];   /* storage for the DD header */
+    uint8      *tbuf=NULL;      /* temporary buffer */
+    uint8      *p;              /* temp buffer ptr */
+    dd_t       *list;           /* list of dd */
+    intn        ret_value = SUCCEED;
+  
+    HEclear();
+    if (file_rec == NULL || ndds<0)	/* valid arguments */
+      HGOTO_ERROR(DFE_ARGS, FAIL);
+  
+    /* 'reasonablize' the value of ndds.  0 means use default */
+    if (0 == ndds)
+      ndds = DEF_NDDS;
+    else if (ndds < MIN_NDDS)
+      ndds = MIN_NDDS;
+  
+    /* allocate the dd block in memory and initialize it */
+    file_rec->ddhead = (ddblock_t *) HDmalloc(sizeof(ddblock_t));
+    if (file_rec->ddhead == (ddblock_t *) NULL)
+      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    block = file_rec->ddlast = file_rec->ddhead;
+    block->prev = (ddblock_t *) NULL;
+    block->ndds = ndds;
+    block->next = (ddblock_t *) NULL;
+    block->nextoffset = 0;
+    block->myoffset = MAGICLEN;
+    block->dirty = FALSE;
+
+    /* Keep the filerec_t pointer around for each ddblock */
+    block->frec=file_rec;
+  
+    /* write first dd block header to file */
+    p = &ddhead[0];
+    INT16ENCODE(p, block->ndds);
+    INT32ENCODE(p, (int32) 0);
+    if (HP_write(file_rec, ddhead, NDDS_SZ + OFFSET_SZ) == FAIL)
+      HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+  
+    /* allocate and initialize dd list */
+    list = block->ddlist = (dd_t *) HDmalloc((uint32) ndds * sizeof(dd_t));
+    if (list == (dd_t *) NULL)
+      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Fill the first memory DD block with NIL dd's */
+    list[0].tag = DFTAG_NULL;
+    list[0].ref = DFREF_NONE;
+    list[0].length = INVALID_LENGTH;
+    list[0].offset = INVALID_OFFSET;
+    list[0].blk = block;
+    HDmemfill(&list[1],&list[0],sizeof(dd_t),(uint32)(ndds-1));
+
+    tbuf=(uint8 *)HDmalloc(ndds*DD_SZ);
+    if (tbuf == NULL)	/* check for DD list */
+      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+  
+    /* Fill the first disk DD block with NIL dd's */
+    p = tbuf;
+    DDENCODE(p, (uint16) DFTAG_NULL, (uint16) DFREF_NONE,
+	(int32) INVALID_LENGTH, (int32) INVALID_OFFSET);
+    HDmemfill(p,tbuf,DD_SZ,(uint32)(ndds-1));
+
+    /* Write the NIL dd's out into the DD block on disk */
+    if (HP_write(file_rec, tbuf, ndds * DD_SZ) == FAIL)
+      HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+    /* Update the DFTAG_NULL pointers */
+    file_rec->ddnull=block;
+    file_rec->ddnull_idx=(-1);
+  
+    /* set the end of the file currently to the end of the first DD block */
+    file_rec->f_end_off = block->myoffset + (NDDS_SZ + OFFSET_SZ) + (block->ndds * DD_SZ);
+  
+    /* no dd's yet, so maximum ref is 0 */
+    file_rec->maxref = 0;
+  
+    /* Initialize the tag tree */
+    file_rec->tag_tree = tbbtdmake(tagcompare, sizeof(uint16), TBBT_FAST_UINT16_COMPARE);
+
+    /* Initialize the DD atom group (trying 256 hash currently, feel free to change */
+    if(HAinit_group(DDGROUP,256)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  HDfree(tbuf);
+
+  return ret_value;
+} /* end HTPinit() */
+
+/******************************************************************************
+ NAME
+     HTPsync - Flush the DD list in memory
+
+ DESCRIPTION
+    Syncronizes the in-memory copy of the DD list with the copy on disk by
+    writing out the DD blocks which have changed to disk.
+    
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPsync(filerec_t *file_rec       /* IN:  File record to store info in */
+)
+{
+    CONSTR(FUNC, "HTPsync");	/* for HERROR */
+    ddblock_t  *block;		/* dd block to intialize */
+    uint8       ddhead[NDDS_SZ+OFFSET_SZ];   /* storage for the DD header */
+    uint8      *tbuf=NULL;  /* temporary buffer */
+    uintn       tbuf_size=0;    /* temporary buffer size */
+    uint8      *p;		/* temp buffer ptr */
+    dd_t       *list;		/* list of dd */
+    int16       ndds;		/* # of DDs per block */
+    intn        i;		/* temp ints */
+    intn        ret_value = SUCCEED;
+  
+    HEclear();
+    block = file_rec->ddhead;
+    if (block == NULL)	/* check for DD list */
+      HGOTO_ERROR(DFE_BADDDLIST, FAIL);
+  
+    while (block != NULL)
+      {	/* check all the blocks for flushing */
+        if (block->dirty == TRUE)
+          {	/* flush this block? */
+            if (HPseek(file_rec, block->myoffset) == FAIL)
+              HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+  
+      /* write dd block header to file */
+            p = ddhead;
+            INT16ENCODE(p, block->ndds);
+            INT32ENCODE(p, block->nextoffset);
+            if (HP_write(file_rec, ddhead, NDDS_SZ + OFFSET_SZ) == FAIL)
+              HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+  
+      /* n is the maximum number of dd's in tbuf */
+            ndds = block->ndds;
+            /* Allocate memory for the temporary buffer also */
+            if(tbuf==NULL || ((uintn)ndds*DD_SZ)>tbuf_size)
+              {
+                  if (tbuf!=(uint8 *)NULL)
+                      HDfree(tbuf);
+                  tbuf_size=(uintn)ndds*DD_SZ;
+                  tbuf=(uint8 *)HDmalloc(tbuf_size);
+                  if (tbuf==(uint8 *)NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+              } /* end if */
+  
+      /* write dd list to file */
+            list = &block->ddlist[0];	/* start at the first DD, go from there */
+            p = tbuf;
+            for (i = 0; i < ndds; i++, list++)
+		DDENCODE(p, list->tag, list->ref, list->offset, list->length);
+
+            if (HP_write(file_rec, tbuf, ndds * DD_SZ) == FAIL)
+              HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+  
+            block->dirty = FALSE;	/* block has been flushed */
+          }	/* end if */
+        block = block->next;	/* advance to next block for file */
+      }		/* end while */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  if (tbuf!=(uint8 *)NULL)
+      HDfree(tbuf);
+
+  return ret_value;
+} /* end HTPsync() */
+
+/******************************************************************************
+ NAME
+     HTPend - Terminate the DD list in memory
+
+ DESCRIPTION
+    Terminates access to the DD list in memory, writing the DD blocks out to
+    the disk (if they've changed).  After this routine is called, no further
+    access to tag/refs (or essentially any other HDF objects) can be performed
+    on the file.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPend(filerec_t *file_rec       /* IN:  File record to store info in */
+) 
+{
+    CONSTR(FUNC, "HTPend");	/* for HERROR */
+    ddblock_t  *bl, *next;	/* current ddblock and next ddblock pointers.
+				   for freeing ddblock linked list */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+    if(HTPsync(file_rec)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    for (bl = file_rec->ddhead; bl!=NULL; bl = next)
+      {
+        next = bl->next;
+        if (bl->ddlist)
+          HDfree((VOIDP) bl->ddlist);
+        HDfree((VOIDP) bl);
+      }
+
+    /* Chuck the tag info tree too */
+    tbbtdfree(file_rec->tag_tree,tagdestroynode,NULL);
+
+    /* Shutdown the DD atom group */
+    if(HAdestroy_group(DDGROUP)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    file_rec->ddhead = (ddblock_t *) NULL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end HTPend() */
+
+/******************************************************************************
+ NAME
+     HTPcreate - Create (and attach to) a tag/ref pair
+
+ DESCRIPTION
+    Creates a new tag/ref pair in memory and inserts the tag/ref pair into the
+    DD list to be written out to disk.  This routine returns a DD id which can
+    be used in the other tag/ref routines to modify the DD.
+
+ RETURNS
+    Returns DD id if successful and FAIL otherwise
+
+*******************************************************************************/
+atom_t HTPcreate(filerec_t *file_rec,   /* IN: File record to store info in */
+    uint16 tag,                         /* IN: Tag to create */
+    uint16 ref                          /* IN: ref to create */
+)
+{
+    CONSTR(FUNC, "HTPcreate");  /* for HERROR */
+    dd_t *dd_ptr=NULL;          /* ptr to dd created */
+    atom_t ret_value=SUCCEED;
+
+    HEclear();
+    if(file_rec==NULL || (tag==DFTAG_NULL || tag==DFTAG_WILDCARD) ||
+            ref==DFREF_WILDCARD)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if(HTIfind_dd(file_rec,(uint16)DFTAG_NULL,(uint16)DFTAG_WILDCARD,
+            &dd_ptr,DF_FORWARD)==FAIL)
+      {
+        if (HTInew_dd_block(file_rec) == FAIL)
+          {
+            HGOTO_ERROR(DFE_NOFREEDD, FAIL);
+          }	/* end if */
+        else
+            dd_ptr=&file_rec->ddlast->ddlist[0];
+      } /* end if */
+
+    /* Insert DD information into the DD list in memory */
+    dd_ptr->tag=tag;
+    dd_ptr->ref=ref;
+    /* the following assures object defintion in DD list 
+       without data written for object. */
+    dd_ptr->offset=INVALID_OFFSET;
+    dd_ptr->length=INVALID_LENGTH;
+
+    /* dd_ptr->blk should already be correctly set */
+
+    /* Update the disk, etc. */
+    if(HTIupdate_dd(file_rec,dd_ptr)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Mark off the ref # as 'used' in the tag tree & add to dynarray of refs */
+    if(HTIregister_tag_ref(file_rec,dd_ptr)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Get the atom to return */
+    if((ret_value=HAregister_atom(DDGROUP,dd_ptr))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HTPcreate() */
+
+/******************************************************************************
+ NAME
+     HTPselect - Attach to an existing tag/ref pair
+
+ DESCRIPTION
+    Attaches to an existing tag/ref pair.  This routine returns a DD id which
+    can be used in the other tag/ref routines to modify the DD.
+
+ RETURNS
+    Returns DD id if successful and FAIL otherwise
+
+*******************************************************************************/
+atom_t HTPselect(filerec_t *file_rec,   /* IN: File record to store info in */
+    uint16 tag,                         /* IN: Tag to select */
+    uint16 ref                          /* IN: ref to select */
+)
+{
+    CONSTR(FUNC, "HTPselect");  /* for HERROR */
+    dd_t *dd_ptr;         /* ptr to the DD info for the tag/ref */
+    tag_info **tip_ptr;   /* ptr to the ptr to the info for a tag */
+    tag_info *tinfo_ptr;  /* pointer to the info for a tag */
+    uint16 base_tag=BASETAG(tag);    /* corresponding base tag (if the tag is special) */
+    atom_t ret_value=SUCCEED;
+
+    HEclear();
+    if(file_rec==NULL || (tag==DFTAG_NULL || tag==DFTAG_WILDCARD) ||
+            ref==DFREF_WILDCARD)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+        
+    /* Try to find the regular tag in the tag info tree */
+    if((tip_ptr=(tag_info **)tbbtdfind(file_rec->tag_tree,(VOIDP)&base_tag,NULL))==NULL)
+        HGOTO_DONE(FAIL); /* Not an error, we just didn't find the object */
+
+    tinfo_ptr=*tip_ptr; /* get the pointer to the tag info */
+    if((dd_ptr=DAget_elem(tinfo_ptr->d,(intn)ref))==NULL)
+        HGOTO_DONE(FAIL); /* Not an error, we just didn't find the object */
+
+    /* Get the atom to return */
+    if((ret_value=HAregister_atom(DDGROUP,dd_ptr))==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HTPselect() */
+
+/******************************************************************************
+ NAME
+     HTPendaccess - End access to an existing tag/ref pair
+
+ DESCRIPTION
+    Ends access to an existing tag/ref pair.  Any further access to the tag/ref
+    pair may result in incorrect information being recorded about the DD in
+    memory or on disk.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPendaccess(atom_t ddid           /* IN: DD id to end access to */
+)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HTPendaccess"); /* for HERROR */
+#endif /* LATER */
+    int32 ret_value=SUCCEED;
+
+    /* Chuck the atom */
+    if(HAremove_atom(ddid)==NULL)
+        HGOTO_DONE(FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HTPendaccess() */
+
+/******************************************************************************
+ NAME
+     HTPdelete - Delete an existing tag/ref pair
+
+ DESCRIPTION
+    Deletes a tag/ref from the file.  Also ends access to the tag/ref pair.
+    Any further access to the tag/ref pair may result in incorrect information
+    being recorded about the DD in memory or on disk.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPdelete(atom_t ddid              /* IN: DD id to delete */
+)
+{
+    CONSTR(FUNC, "HTPdelete"); /* for HERROR */
+    dd_t *dd_ptr;           /* ptr to the DD info for the tag/ref */
+    filerec_t * file_rec;
+    int32 ret_value=SUCCEED;
+
+    HEclear();
+    /* Retrieve the atom's object, so we can delete the tag/ref */
+    if((dd_ptr=HAatom_object(ddid))==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Grab this information, because the global dd_info will be deleted in HTIunregister_tag_ref */
+    file_rec=dd_ptr->blk->frec;
+
+    /* Since we don't know where we are, reset the DFTAG_NULL pointers */
+    file_rec->ddnull=NULL;
+    file_rec->ddnull_idx=(-1);
+  
+    if (HPfreediskblock(file_rec,dd_ptr->offset,dd_ptr->length) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Update the disk, etc. */
+    if(HTIupdate_dd(file_rec,dd_ptr)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Remove the ref # as 'used' in the tag tree & delete from dynarray of refs */
+    if(HTIunregister_tag_ref(file_rec,dd_ptr)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Destroy everything */
+    if(HAremove_atom(ddid)==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HTPdelete() */
+
+/******************************************************************************
+ NAME
+     HTPupdate - Change the offset or length of an existing tag/ref pair
+
+ DESCRIPTION
+    Updates a tag/ref in the file, allowing the length and/or offset to be
+    modified. 
+
+    Note: a value of '-2' for both 'length' and 'offset' are used to indicate
+    that the length or offset (respectively) is unchanged and should
+    remain the same. Kind of ugly but works for now.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPupdate(atom_t ddid,             /* IN: DD id to update */
+    int32 new_off,                      /* IN: new offset for DD */
+    int32 new_len                       /* IN: new length for DD */
+)
+{
+    CONSTR(FUNC, "HTPupdate");  /* for HERROR */
+    dd_t *dd_ptr    = NULL;     /* ptr to the DD info for the tag/ref */
+    int32 dont_change = -2;     /* initialize to '-2' */
+    int32 ret_value = SUCCEED;
+
+    HEclear();
+    /* Retrieve the atom's object, so we can update the DD */
+    if((dd_ptr=HAatom_object(ddid))==NULL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Update the tag/ref in memory */
+    if(new_len != dont_change)
+        dd_ptr->length=new_len;
+    if(new_off != dont_change)
+        dd_ptr->offset=new_off;
+
+    /* Update the disk, etc. */
+    if(HTIupdate_dd(dd_ptr->blk->frec,dd_ptr)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HTPupdate() */
+
+/******************************************************************************
+ NAME
+     HTPinquire - Get the DD information for a DD (i.e. tag/ref/offset/length)
+
+ DESCRIPTION
+    Get the DD information for a DD id from the DD block.  Passing NULL for
+    any parameter does not try to update that parameter.
+
+ RETURNS
+    Returns SUCCEED if successful and FAIL otherwise
+
+*******************************************************************************/
+intn HTPinquire(atom_t ddid,            /* IN: DD id to inquire about */
+    uint16 *tag,                        /* IN: tag of DD */
+    uint16 *ref,                        /* IN: ref of DD */
+    int32 *off,                         /* IN: offset of DD */
+    int32 *len                          /* IN: length of DD */
+)
+{
+    CONSTR(FUNC, "HTPinquire"); /* for HERROR */
+    dd_t *dd_ptr;               /* ptr to the DD info for the tag/ref */
+    intn ret_value=SUCCEED;
+
+    HEclear();
+    /* Retrieve the atom's object, so we can update the DD */
+    if((dd_ptr=HAatom_object(ddid))==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get the information requested */
+    if(tag!=NULL)
+        *tag=dd_ptr->tag;
+    if(ref!=NULL)
+        *ref=dd_ptr->ref;
+    if(off!=NULL)
+        *off=dd_ptr->offset;
+    if(len!=NULL)
+        *len=dd_ptr->length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HTPinquire() */
+
+/******************************************************************************
+ NAME
+     HTPis_special - Check if a DD id is associated with a special tag
+
+ DESCRIPTION
+    Checks if the tag for the DD id is a special tag.
+
+ RETURNS
+    Returns TRUE(1)/FALSE(0)
+
+*******************************************************************************/
+intn HTPis_special(atom_t ddid             /* IN: DD id to inquire about */
+)
+{
+    CONSTR(FUNC, "HTPis_special"); /* for HERROR */
+    dd_t *dd_ptr;               /* ptr to the DD info for the tag/ref */
+    int32 ret_value=FAIL;
+
+    HEclear();
+    /* Retrieve the atom's object, so we can update the DD */
+    if((dd_ptr=HAatom_object(ddid))==NULL)
+        HGOTO_ERROR(DFE_ARGS, FALSE);
+
+    /* Get the information requested */
+    if(SPECIALTAG(dd_ptr->tag))
+        ret_value=TRUE;
+    else
+        ret_value=FALSE;
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HTPis_special() */
+
+/******************************************************************************
+ NAME
+     Hdupdd - Duplicate a data descriptor
+
+ DESCRIPTION
+    Duplicates a data descriptor so that the new tag/ref points to the
+    same data element pointed to by the old tag/ref.  Return FAIL if
+    the given tag/ref are already in use.
+
+ RETURNS
+    returns SUCCEED (0) if successful, FAIL (-1) otherwise
+
+*******************************************************************************/
+intn Hdupdd(int32 file_id,      /* IN: File ID the tag/refs are in */
+        uint16 tag,             /* IN: Tag of new tag/ref */
+        uint16 ref,             /* IN: Ref of new tag/ref */
+        uint16 old_tag,         /* IN: Tag of old tag/ref */
+        uint16 old_ref          /* IN: Ref of old tag/ref */
+)
+{
+    CONSTR(FUNC, "Hdupdd"); /* for HERROR */
+    filerec_t  *file_rec;		/* file record */
+    atom_t      old_dd;         /* The DD id for the old DD */
+    atom_t      new_dd;         /* The DD id for the new DD */
+    int32       old_len;        /* The length of the old DD */
+    int32       old_off;        /* The offset of the old DD */
+    intn ret_value=SUCCEED;
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+      HGOTO_ERROR(DFE_ARGS, FAIL);
+  
+    /* Attach to the old DD in the file */
+    if((old_dd=HTPselect(file_rec,old_tag,old_ref))==FAIL)
+      HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+    /* Create the new DD in the file */
+    if((new_dd=HTPcreate(file_rec,tag,ref))==FAIL)
+      HGOTO_ERROR(DFE_DUPDD, FAIL);
+
+    /* Retrieve the old offset & length */
+    if(HTPinquire(old_dd,NULL,NULL,&old_off,&old_len)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Set the new DD's offset & length to the same as the old DD */
+    if(HTPupdate(new_dd,old_off,old_len)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* End access to the old & new DDs */
+    if(HTPendaccess(old_dd)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    if(HTPendaccess(new_dd)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Hdupdd() */
+
+/******************************************************************************
+ NAME
+     Hnumber - Determine the number of objects of a given type
+
+ DESCRIPTION
+    Determine how many objects of the given tag are in the file.
+    tag may be set to DFTAG_WILDCARD to get back the total number
+    of objects in the file.
+
+    Note, a return value of zero is not a fail condition.
+
+ RETURNS
+    the number of objects of type 'tag' else FAIL
+
+*******************************************************************************/
+int32 Hnumber(int32 file_id,    /* IN: File ID the tag/refs are in */
+        uint16 tag              /* IN: Tag to count */
+)
+{
+    CONSTR(FUNC, "Hnumber");
+    uintn       all_cnt;
+    uintn       real_cnt;
+    filerec_t  *file_rec;           /* file record */
+    int32 ret_value=SUCCEED;
+
+    /* convert file id to file record */
+    file_rec = HAatom_object(file_id);
+
+    HEclear();
+    if (BADFREC(file_rec))
+      HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Go count the items with that tag */
+    if (HTIcount_dd(file_rec, tag, DFREF_WILDCARD, &all_cnt, &real_cnt) == FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    ret_value = (int32) real_cnt;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Hnumber() */
+
+/******************************************************************************
+ NAME
+     Hnewref - Returns a ref that is guaranteed to be unique in the file
+
+ DESCRIPTION
+    Returns a ref number that can be used with any tag to produce a
+    unique tag/ref.  Successive calls to Hnewref will generate a
+    strictly increasing sequence until the highest possible ref had been
+    returned, then Hnewref will return unused ref's starting from 1.
+
+ RETURNS
+    returns the ref number, 0 otherwise
+
+*******************************************************************************/
+uint16 
+Hnewref(int32 file_id /* IN: File ID the tag/refs are in */)
+{
+    CONSTR(FUNC, "Hnewref");
+    filerec_t  *file_rec;	   /* file record */
+    uint16      ref;		   /* the new ref */
+    uint16      ret_value = DFREF_NONE;
+    uint32      i_ref;        /* index for FOR loop */
+
+    /* clear error stack and check validity of file record id */
+    HEclear();
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, 0);
+  
+    /* if maxref of this file is still below the maximum,
+     just return next number */
+    if (file_rec->maxref < MAX_REF)
+        ret_value = ++(file_rec->maxref);
+    else
+      { /* otherwise, search for an empty ref */
+        /* incredibly slow but unlikely situation */
+/* This could possibly get replaced with some sort of bit-vector manipulation -QAK */
+        for (i_ref = 1; i_ref <= (uint32)MAX_REF; i_ref++)
+          {
+            dd_t *dd_ptr=NULL;
+            ref = (uint16)i_ref; 
+            if (HTIfind_dd(file_rec, (uint16) DFTAG_WILDCARD, ref, &dd_ptr, DF_FORWARD) == FAIL)
+              {
+               ret_value = ref; /* set return value to ref found */
+               break; /* break out of loop */
+              } /* end if */
+          } /* end for */
+      } /* end else */
+
+done:
+  if(ret_value == DFREF_NONE)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Hnewref() */
+
+/******************************************************************************
+ NAME
+    Htagnewref  - returns a ref that is unique in the file for a given tag
+
+ DESCRIPTION
+    Returns a ref number that can be used with any tag to produce a
+    unique tag/ref.  Successive calls to Hnewref will generate a
+    strictly increasing sequence until the highest possible ref had been
+    returned, then Hnewref will return unused ref's starting from 1.
+
+ RETURNS
+    returns the ref number, 0 otherwise
+
+*******************************************************************************/
+uint16 
+Htagnewref(int32 file_id,/* IN: File ID the tag/refs are in */
+           uint16 tag    /* IN: Tag to search for a new ref for */)
+{
+    CONSTR(FUNC, "Htagnewref");
+    filerec_t  *file_rec;  /* file record */
+    tag_info   *tinfo_ptr; /* pointer to the info for a tag */
+    tag_info  **tip_ptr;   /* ptr to the ptr to the info for a tag */
+    uint16      base_tag = BASETAG(tag); /* corresponding base tag (if the tag is special) */
+    uint16      ret_value = DFREF_NONE;
+
+    /* clear error stack and check validity of file record id */
+    HEclear();
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, 0);
+  
+    if((tip_ptr = (tag_info **)tbbtdfind(file_rec->tag_tree,(VOIDP)&base_tag,NULL))==NULL)
+        ret_value = 1;  /* The first available ref */
+    else
+      {   /* found an existing tag */
+          tinfo_ptr = *tip_ptr; /* get the pointer to the tag info */
+          if((ret_value = (uint16)bv_find(tinfo_ptr->b,-1,BV_FALSE)) == (uint16)FAIL)
+              HGOTO_ERROR(DFE_BVFIND, 0);
+      } /* end else */
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Htagnewref() */
+
+/******************************************************************************
+ NAME
+    Hfind - locate the next object of a search in an HDF file
+
+ DESCRIPTION
+    Searches for the `next' DD that fits the search tag/ref.  Wildcards
+    apply.  If origin is DF_FORWARD, search from current position forwards
+    in the file, otherwise DF_BACKWARD searches backward from the current
+    position in the file.  If *find_tag and *find_ref are both set to
+    0, this indicates the beginning of a search, and the search will
+    start from the beginning of the file if the direction is DF_FORWARD
+    and from the and of the file if the direction is DF_BACKWARD.
+
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) otherwise
+
+*******************************************************************************/
+intn Hfind(int32 file_id,       /* IN: file ID to search in */
+        uint16 search_tag,      /* IN: the tag to search for (can be DFTAG_WILDCARD) */
+        uint16 search_ref,      /* IN: ref to search for (can be DFREF_WILDCARD) */
+        uint16 *find_tag,       /* IN: if (*find_tag==0) and (*find_ref==0) then start search */
+                                /* OUT: tag matching the search tag */
+        uint16 *find_ref,       /* IN: if (*find_tag==0) and (*find_ref==0) then start search */
+                                /* OUT: ref matching the search ref */
+        int32 *find_offset,     /* OUT: offset of the data element found */
+        int32 *find_length,     /* OUT: length of the data element found */
+        intn direction          /* IN: Direction to search in: */
+                                /*  DF_FORWARD searches forward from the current location */
+                                /*  DF_BACKWARD searches backward from the current location */
+)
+{
+    CONSTR(FUNC, "Hfind");	/* for HERROR */
+    filerec_t  *file_rec;		/* file record */
+    dd_t       *dd_ptr;		   /* ptr to current ddlist searched */
+    intn    ret_value = SUCCEED;
+
+    /* clear error stack and check validity of the access id */
+    HEclear();
+    if (file_id == FAIL || /* search_ref > MAX_REF || */ find_tag == NULL
+        || find_ref == NULL || find_offset == NULL || find_length == NULL
+        || (direction != DF_FORWARD && direction != DF_BACKWARD))
+      HGOTO_ERROR(DFE_ARGS, FAIL);
+  
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+  
+    dd_ptr = NULL;
+    if (*find_ref != 0 || *find_tag != 0)
+      {		/* continue a search */
+        /* get the block and index of the last tag/ref found, to continue */
+        if (HTIfind_dd(file_rec, *find_tag, *find_ref, &dd_ptr, direction) == FAIL)
+          HGOTO_ERROR(DFE_NOMATCH, FAIL);
+      }		/* end else */
+  
+    /* Go get the next match in the given direction */
+    if (HTIfind_dd(file_rec, search_tag, search_ref, &dd_ptr, direction) == FAIL)
+      HGOTO_DONE(FAIL); /* Not an error, we just didn't find the object */
+  
+    *find_tag = dd_ptr->tag;
+    *find_ref = dd_ptr->ref;
+    *find_offset = dd_ptr->offset;
+    *find_length = dd_ptr->length;
+
+done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+  /* Normal function cleanup */
+    return ret_value;
+}	/* end Hfind() */
+
+/******************************************************************************
+ NAME
+     HDcheck_tagref - Checks to see if tag/ref is in DD list i.e. created already
+
+ DESCRIPTION
+     Routine checks to see if tag/ref exists in the DD list i.e. has
+     been created.
+
+ RETURNS
+     0-> tag/ref does not exist
+     1-> tag/ref exists
+    -1-> function failed
+
+*******************************************************************************/
+intn 
+HDcheck_tagref(int32  file_id, /* IN: id of file */
+               uint16 tag,     /* IN: Tag to check */
+               uint16 ref      /* IN: ref to check */)
+{
+    CONSTR(FUNC, "HDcheck_tagref");  /* for HERROR */
+    filerec_t *file_rec = NULL;  /* file record */
+    dd_t      *dd_ptr = NULL;    /* ptr to the DD info for the tag/ref */
+    tag_info **tip_ptr = NULL;   /* ptr to the ptr to the info for a tag */
+    tag_info  *tinfo_ptr = NULL; /* pointer to the info for a tag */
+    uint16     base_tag;         /* corresponding base tag (if the tag is special) */
+    intn       ret_value = 1;  /* default tag/ref exists  */
+
+    /* clear error stack */
+    HEclear();
+
+    /* check args */
+    file_rec = HAatom_object(file_id);
+    if(file_rec == NULL 
+       || (tag == DFTAG_NULL || tag==DFTAG_WILDCARD) 
+       ||  ref == DFREF_WILDCARD)
+        HGOTO_ERROR(DFE_ARGS, -1);
+
+    base_tag = BASETAG(tag);
+        
+    /* Try to find the regular tag in the tag info tree */
+    if((tip_ptr = (tag_info **)tbbtdfind(file_rec->tag_tree,
+                                         (VOIDP)&base_tag,NULL)) == NULL)
+        HGOTO_DONE(0); /* Not an error, we just didn't find the object */
+
+    tinfo_ptr = *tip_ptr; /* get the pointer to the tag info */
+    if((dd_ptr = DAget_elem(tinfo_ptr->d,(intn)ref)) == NULL)
+        HGOTO_DONE(0); /* Not an error, we just didn't find the object */
+
+    /* found if we reach here*/
+    ret_value = 1;
+
+done:
+  if(ret_value == -1)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* HDcheck_tagref() */
+
+/************************************************************************
+NAME
+   HDreuse_tagref -- reuse a data descriptor preserving tag/ref(assumes DD exists)
+
+DESCRIPTION
+   Reuses the data descriptor of tag/ref in the dd list of the file.
+   The tag/ref must already exist in the DD list.
+   This routine is unsafe and may leave a file in a condition that is
+   not usable by some routines.  Use with care. Not valid for
+   special elments right now. Used for allowing the data to change
+   and move somewhere else in the file for non-special elements.
+   Must be carefully if apply to higher-level objects like GR's and SDS
+   that are comprised of other objects.
+   Usefull when re-writing simple elements whose size changes while
+   preserving the original tag/ref of the element since other elements
+   might refer to this element by tag/ref e.g. in a Vgroup.
+
+   NOTE: this routine is similiar to Hdeldd() but with a different name
+
+RETURNS
+   returns SUCCEED (0) if successful, FAIL (-1) otherwise
+************************************************************************/
+intn 
+HDreuse_tagref(int32 file_id, /* IN: id of file */
+               uint16 tag,    /* IN: tag of data descriptor to reuse */
+               uint16 ref     /* IN: ref of data descriptor to reuse */ )
+{
+  CONSTR(FUNC, "HDreusedd");   /* for HERROR */
+  filerec_t  *file_rec = NULL; /* file record */
+  atom_t      ddid;            /* ID for the DD */
+  intn        ret_value = SUCCEED;
+
+  /* clear error stack and check validity of file record id */
+  HEclear();
+
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec) || tag == DFTAG_WILDCARD || ref == DFREF_WILDCARD)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* look for the dd to reuse */
+  if ((ddid = HTPselect(file_rec, tag, ref)) == FAIL)
+    HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+  /* could reuse space in file by calling HPfreediskblock() routine 
+     but it does nothing for now. For later. */
+  /* if (HPfreediskblock(file_rec,dd_ptr->offset,dd_ptr->length) == FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL); */
+
+  /* reuse the dd by setting the offset and length to
+     INVALID_OFFSET and INVALID_LENGTH*/
+  if (HTPupdate(ddid,INVALID_OFFSET, INVALID_LENGTH) == FAIL)
+    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+ /* We leave the ref # as 'used' in the tag tree and
+    dont' delete from dynarray of refs. */
+
+  /* Remove DD from atom group since it should get re-created in Hstartaccess().
+     This could be handled better if Hstartaccess() was revamped
+     to not create new access records for existing tag/ref pairs
+     as well as revamping a few other routines. */
+  if(HAremove_atom(ddid)==NULL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end HDreuse_tagref */
+
+/*--------------------------------------------------------------------------
+NAME
+   Hdeldd -- delete a data descriptor
+USAGE
+   intn Hdeldd(file_id, tag, ref)
+   int32 file_id;            IN: id of file
+   int16 tag;                IN: tag of data descriptor to delete
+   int16 ref;                IN: ref of data descriptor to delete
+RETURNS
+   returns SUCCEED (0) if successful, FAIL (-1) otherwise
+DESCRIPTION
+   Deletes a data descriptor of tag/ref from the dd list of the file.
+   This routine is unsafe and may leave a file in a condition that is
+   not usable by some routines.  Use with care.
+   For example, if this element is contained in a Vgroup, that group
+   will *NOT* get updated to reflect that this element has been deleted.
+
+--------------------------------------------------------------------------*/
+intn Hdeldd(int32 file_id, uint16 tag, uint16 ref)
+{
+  CONSTR(FUNC, "Hdeldd");		/* for HERROR */
+  filerec_t  *file_rec;		/* file record */
+  atom_t      ddid;         /* ID for the DD */
+  intn        ret_value = SUCCEED;
+
+  /* clear error stack and check validity of file record id */
+  HEclear();
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec) || tag == DFTAG_WILDCARD || ref == DFREF_WILDCARD)
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+  /* look for the dd to delete */
+  if ((ddid=HTPselect(file_rec, tag, ref)) == FAIL)
+    HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+  /* delete the dd */
+  if (HTPdelete(ddid) == FAIL)
+    HGOTO_ERROR(DFE_CANTDELDD, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* end Hdeldd */
+
+#ifdef DEBUGGING
+/*--------------------------------------------------------------------------
+ NAME
+    HTPdump_dds -- Dump out the dd information for a file
+ USAGE
+    intn HTPdump_dds(file_id)
+        int32 file_id;              IN: file ID of HDF file to dump
+        FILE *fout;                 IN: file stream to output to
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Prints out all the information (that you could _ever_ want to know) about
+    the dd blocks and dd list for a file.
+
+--------------------------------------------------------------------------*/
+intn HTPdump_dds(int32 file_id, FILE *fout)
+{
+  CONSTR(FUNC, "HTPdump_dds");
+  filerec_t  *file_rec;		/* file record */
+  int         ret_value = SUCCEED;
+
+  /* clear error stack and check validity of file record id */
+  HEclear();
+  file_rec = HAatom_object(file_id);
+  if (BADFREC(file_rec))
+    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+/* Print out each DD block */
+    {
+        ddblock_t   *block=file_rec->ddhead;    /* dd block currently dumping */
+        intn blk_count=0;       /* Count of the number of blocks we've dumped */
+        intn i;                 /* local counting variable */
+
+        while(block!=NULL)
+          {
+            dd_t *curr_dd;      /* current dd to dump */
+
+            fprintf(fout,"DD block %d\n",blk_count);
+            fprintf(fout,"# of DDs: %d, next block offset=%ld\n",(int)block->ndds,(long)block->nextoffset);
+            fprintf(fout,"DD block offset: %ld, dirty?=%d\n",(long)block->myoffset,(int)block->dirty);
+            for(i=0, curr_dd=block->ddlist; i<block->ndds; i++,curr_dd++)
+                fprintf(fout,"%5d: tag/ref=(%5u/%5u), offset=%7ld, length=%7ld\n",(int)i,(unsigned)curr_dd->tag,(unsigned)curr_dd->ref,(long)curr_dd->offset,(long)curr_dd->length);
+            blk_count++;
+            block=block->next;
+          } /* end while */
+    } /* End of ddblock dumping code */
+
+/* Dump the tag tree */
+    {
+        VOIDP      *t;
+
+        if (NULL != (t = (VOIDP *) tbbtfirst((TBBT_NODE *) * (file_rec->tag_tree))))
+          {   /* found at least one node in the tree */
+            tag_info *tinfo_ptr;  /* pointer to the info for a tag */
+
+            do
+              { /* dump each node */
+                intn size;      /* # of elements in the array */
+                intn i;         /* local counting variable */
+
+                tinfo_ptr = (tag_info *) * t;   /* get actual pointer to the tag info */
+                fprintf(fout,"Tag: %u\n",tinfo_ptr->tag);
+                
+                /* Dump the ref # dynarray */
+                if((size=DAsize_array(tinfo_ptr->d))!=FAIL)
+                  {
+                    VOIDP elem;
+
+                    fprintf(fout,"dynarray size=%d\n",size);
+                    for(i=0; i<size; i++)
+                      {
+                        elem=DAget_elem(tinfo_ptr->d,i);
+                        if(elem!=NULL)
+                            fprintf(fout,"dynarray[%d]=%p\n",i,elem);
+                      } /* end for */
+                  } /* end if */
+                
+                /* Dump the ref # bit-vector */
+                if((size=bv_size(tinfo_ptr->b))!=FAIL)
+                  {
+                    intn bit;
+
+                    fprintf(fout,"bitvector size=%d\n",size);
+                    fprintf(fout,"bits set:");
+                    for(i=0; i<size; i++)
+                      {
+                        bit=bv_get(tinfo_ptr->b,i);
+                        if(bit!=BV_FALSE)
+                            fprintf(fout,"%5d",i);
+                      } /* end for */
+                    fprintf(fout,"\n");
+                  } /* end if */
+
+                /* Get the next tag node */
+                t = (VOIDP *) tbbtnext((TBBT_NODE *) t);
+              } while(t!=NULL);
+          }
+        else
+            fprintf(fout,"No nodes in tag tree\n");
+    } /* End of tag node dumping */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HTPdump_dds */
+#endif /* DEBUGGING */
+
+
+
+/* Private, static, internal routines.  Do not call from outside this module */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HTInew_dd_block -- create a new (empty) DD block
+ USAGE
+    intn HTInew_dd_block(file_rec)
+
+    filerec_t  * file_rec;        IN: file record
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Create a new DDblock in the file.  Update the previously last DDblock so
+    that its offset points to the newly created one.
+
+--------------------------------------------------------------------------*/
+static intn HTInew_dd_block(filerec_t * file_rec)
+{
+    CONSTR(FUNC, "HTInew_dd_block");    /* for HERROR */
+    int32       nextoffset;		/* offset of new ddblock */
+    uint8       ddhead[NDDS_SZ+OFFSET_SZ];   /* storage for the DD header */
+    int32       offset;			/* offset to the offset of new ddblock */
+    ddblock_t *block;           /* Block the DD is located in */
+    dd_t       *list;			/* dd list array of new dd block */
+    uint8      *p;              /* Temporary buffer pointer. */
+    intn        ndds;                   /* number of ndds in new DD block */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+    /* check integrity of file record */
+    if (file_rec->ddhead==NULL || file_rec->ddlast==NULL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+  
+    /* allocate new dd block record and fill in data */
+    if ((block = (ddblock_t *) HDmalloc(sizeof(ddblock_t))) == NULL)
+      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    block->ndds = (int16)(ndds = (intn)file_rec->ddhead->ndds);    /* snarf from first block */
+    block->next = (ddblock_t *) NULL;
+    block->nextoffset = 0;
+
+    /* Keep the filerec_t pointer around for each ddblock */
+    block->frec=file_rec;
+  
+    /* get room for the new DD block in the file */
+    if ((nextoffset = HPgetdiskblock(file_rec, NDDS_SZ + OFFSET_SZ + (ndds * DD_SZ), TRUE)) == FAIL)
+      HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+    block->myoffset = nextoffset;	/* set offset of new block */
+    block->dirty = (uintn)file_rec->cache; /* if we're caching, wait to write DD block */
+  
+    if (file_rec->cache)	/* if we are caching, wait to update previous DD block */
+      file_rec->dirty |= DDLIST_DIRTY;	/* indicate file needs to be flushed */
+    else
+      {
+        p = ddhead;
+        INT16ENCODE(p, block->ndds);
+        INT32ENCODE(p, (int32) 0);
+        if (HP_write(file_rec, ddhead, NDDS_SZ + OFFSET_SZ) == FAIL)
+          HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+      }		/* end else */
+  
+    /* set up the dd list of this dd block and put it in the file
+     after the dd block header */
+    list = block->ddlist = (dd_t *) HDmalloc((uint32) ndds * sizeof(dd_t));
+    if (list == (dd_t *) NULL)
+      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Fill the block with NIL tags */
+    list[0].tag = DFTAG_NULL;
+    list[0].ref = DFREF_NONE;
+    list[0].length = INVALID_LENGTH;
+    list[0].offset = INVALID_OFFSET;
+    list[0].blk = block;
+    HDmemfill(&list[1],&list[0],sizeof(dd_t),(uint32)ndds-1);
+  
+    if (file_rec->cache!=0)
+      {	/* if we are caching, wait to update previous DD block */
+        uint8 *tbuf;    /* temporary buffer */
+
+        tbuf=(uint8 *)HDmalloc(ndds*DD_SZ);
+        if(tbuf==(uint8 *)NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+        p = tbuf;
+	DDENCODE(p, (uint16) DFTAG_NULL, (uint16) DFREF_NONE,
+	    (int32) INVALID_LENGTH, (int32) INVALID_OFFSET);
+        HDmemfill(p,tbuf,DD_SZ,(uint32)(ndds-1));
+
+        if (HP_write(file_rec, tbuf, ndds * DD_SZ) == FAIL)
+          HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+        HDfree(tbuf);
+      }		/* end if */
+  
+    /* update previously last ddblock to point to this new dd block */
+    file_rec->ddlast->nextoffset = nextoffset;
+    block->prev = file_rec->ddlast;
+    file_rec->ddlast->next = block;
+    if (file_rec->cache)
+      {	/* if we are caching, wait to update previous DD block */
+        file_rec->dirty |= DDLIST_DIRTY;	/* indicate file needs to be flushed */
+        file_rec->ddlast->dirty = TRUE;	/* indicate this block needs to be flushed */
+      }	/* end if */
+    else
+      {
+        if (file_rec->ddhead == file_rec->ddlast)
+          offset = MAGICLEN + NDDS_SZ;
+        else
+          offset = file_rec->ddlast->prev->nextoffset + NDDS_SZ;
+        p = ddhead;
+        INT32ENCODE(p, nextoffset);
+        if (HPseek(file_rec, offset) == FAIL)
+          HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+        if (HP_write(file_rec, ddhead, OFFSET_SZ) == FAIL)
+          HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+      }	/* end else */
+  
+    /* update file record */
+    file_rec->ddlast = block;
+  
+    /* set the end of the file to the end of the current DD block */
+    file_rec->f_end_off = block->myoffset + (NDDS_SZ + OFFSET_SZ) + (block->ndds * DD_SZ);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HTInew_dd_block */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HTIfind_dd -- find a specific DD in the file
+ USAGE
+    int HTIfind_dd(file_rec, tag, ref, dd_ptr, direction)
+        filerec_t *  file_rec;       IN:  file record to search
+        uint16       tag;            IN:  tag of element to find
+        uint16       ref;            IN:  ref of element to find
+        dd_t      ** pdd;            OUT: pointer to the DD in memory
+        intn         direction;      IN:  direction to search
+                                        (DF_FORWARD / DF_BACKWARD)
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Find the dd with tag and ref, by returning the block where the dd resides
+    and the index of the dd in the ddblock ddlist.
+
+--------------------------------------------------------------------------*/
+static intn HTIfind_dd(filerec_t * file_rec, uint16 look_tag, uint16 look_ref,
+            dd_t ** pdd, intn direction)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HTIfind_dd");    /* for HERROR */
+#endif /* LATER */
+    intn idx;          /* index into ddlist of current dd searched */
+    ddblock_t *block;  /* ptr to current ddblock searched */
+    dd_t *list;        /* ptr to current ddlist searched */
+    uint16      special_tag;    /* corresponding special tag */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+    /* Create the special version of the tag to search for also */
+    special_tag = MKSPECIALTAG(look_tag);
+
+    if(look_tag!=DFTAG_WILDCARD && look_ref!=DFTAG_WILDCARD)
+      { /* easy to optimize case, looking for a specific tag/ref pair */
+          tag_info **tip_ptr;   /* ptr to the ptr to the info for a tag */
+          tag_info *tinfo_ptr;  /* pointer to the info for a tag */
+          dd_t *dd_ptr;         /* ptr to the DD info for a tag/ref */
+          uint16 base_tag=BASETAG(look_tag);    /* corresponding base tag (if the tag is special) */
+
+          /* Try to find the regular tag in the tag info tree */
+          if((tip_ptr=(tag_info **)tbbtdfind(file_rec->tag_tree,(VOIDP)&base_tag,NULL))==NULL)
+              HGOTO_DONE(FAIL); /* Not an error, we just didn't find the object */
+
+          tinfo_ptr=*tip_ptr; /* get the pointer to the tag info */
+          if((dd_ptr=DAget_elem(tinfo_ptr->d,(intn)look_ref))==NULL)
+              HGOTO_DONE(FAIL); /* Not an error, we just didn't find the object */
+
+          *pdd=dd_ptr;
+          HGOTO_DONE(SUCCEED);
+      } /* end if */
+    else
+      { /* handle wildcards, etc. */
+        if (direction == DF_FORWARD)
+          {   /* search forward through the DD list */
+            if(*pdd==NULL)
+              {
+                block=file_rec->ddhead;
+                idx=0;
+              } /* end if */
+            else
+              {
+                block=(*pdd)->blk;
+                idx=((*pdd)-&block->ddlist[0])+1;
+              } /* end else */
+            if(look_tag==DFTAG_WILDCARD && look_ref==DFREF_WILDCARD)
+              { /* Both tag & ref are wildcards */
+                for (; block; block = block->next)
+                  {
+                    list = &block->ddlist[idx];
+                    for (; idx < block->ndds; idx++, list++)
+                      {
+                        /* skip the empty dd's */
+                        if (list->tag == DFTAG_NULL)
+                            continue;
+      
+                        /* we have a match !! (anything matches! :-) */
+                        *pdd=list;
+                        HGOTO_DONE(SUCCEED);
+                      }	/* end for */
+        
+                    /* start from beginning of the next dd list */
+                    idx = 0;
+                  }	/* end for */
+              } /* end if */
+            else if(look_tag==DFTAG_NULL && look_ref==DFTAG_WILDCARD)
+              { /* special case for quick lookup of empty DD's */
+                if(file_rec->ddnull==NULL)
+                    block=file_rec->ddhead;
+                else
+                    block=file_rec->ddnull;
+                if(file_rec->ddnull_idx<0)
+                    idx=0;
+                else
+                    idx=file_rec->ddnull_idx+1;
+
+                for (; block; block = block->next)
+                  {
+                    list = &block->ddlist[idx];
+                    for (; idx < block->ndds; idx++, list++)
+                      {
+                        /* skip the empty dd's */
+                        if (list->tag == DFTAG_NULL)
+                          {
+                            /* we have a match !! */
+                            *pdd=list;
+
+                            /* Update the DFTAG_NULL pointers */
+                            file_rec->ddnull=block;
+                            file_rec->ddnull_idx=idx;
+
+                            HGOTO_DONE(SUCCEED);
+                          } /* end if */
+                      }	/* end for */
+        
+                    /* start from beginning of the next dd list */
+                    idx = 0;
+                  }	/* end for */
+              } /* end if */
+            else if(look_tag==DFTAG_WILDCARD)
+              { /* tag is wildcard */
+                for (; block; block = block->next)
+                  {
+                    list = &block->ddlist[idx];
+                    for (; idx < block->ndds; idx++, list++)
+                      {
+                        /* skip the empty dd's */
+                        if (list->tag == DFTAG_NULL)
+                            continue;
+      
+                        if (list->ref == look_ref)
+                          {
+                            /* we have a match !! */
+                            *pdd=list;
+                            HGOTO_DONE(SUCCEED);
+                          } /* end if */
+                      }	/* end for */
+        
+                    /* start from beginning of the next dd list */
+                    idx = 0;
+                  }	/* end for */
+              } /* end if */
+            else if(look_ref==DFREF_WILDCARD)
+              { /* ref is wildcard */
+#ifndef OLD_WAY
+                if(special_tag==DFTAG_NULL)
+                  {
+/* Change this to lookup the next used ref # in the bitvector or dynarray -QAK */
+                    for (; block; block = block->next)
+                      {
+                        list = &block->ddlist[idx];
+                        for (; idx < block->ndds; idx++, list++)
+                          {
+                            /* skip the empty dd's */
+                            if (list->tag == DFTAG_NULL && look_tag != DFTAG_NULL)
+                                continue;
+          
+                            if (list->tag == look_tag)
+                              {
+                                /* we have a match !! */
+                                *pdd=list;
+                                HGOTO_DONE(SUCCEED);
+                              } /* end if */
+                          }	/* end for */
+            
+                        /* start from beginning of the next dd list */
+                        idx = 0;
+                      }	/* end for */
+                  } /* end if */
+                else
+                  {
+                    for (; block; block = block->next)
+                      {
+                        list = &block->ddlist[idx];
+                        for (; idx < block->ndds; idx++, list++)
+                          {
+                            /* skip the empty dd's */
+                            if (list->tag == DFTAG_NULL && look_tag != DFTAG_NULL)
+                                continue;
+          
+                            if (list->tag == look_tag || list->tag == special_tag)
+                              {
+                                /* we have a match !! */
+                                *pdd=list;
+                                HGOTO_DONE(SUCCEED);
+                              } /* end if */
+                          }	/* end for */
+            
+                        /* start from beginning of the next dd list */
+                        idx = 0;
+                      }	/* end for */
+                  } /* end else */
+#else /* OLD_WAY */
+/* Hmm, not working yet?... -QAK */
+                tag_info **tip_ptr;   /* ptr to the ptr to the info for a tag */
+                tag_info *tinfo_ptr;  /* pointer to the info for a tag */
+                dd_t *dd_ptr;         /* ptr to the DD info for a tag/ref */
+                uint16 base_tag=BASETAG(look_tag);    /* corresponding base tag (if the tag is special) */
+                int32 last_ref;       /* the last ref # found */
+                uint16 found_ref;     /* next ref # found */
+
+                /* Try to find the regular tag in the tag info tree */
+                if((tip_ptr=(tag_info **)tbbtdfind(file_rec->tag_tree,(VOIDP)&base_tag,NULL))==NULL)
+                    HGOTO_ERROR(DFE_BADTAG, FAIL);
+
+                tinfo_ptr=*tip_ptr; /* get the pointer to the tag info */
+                if(*pdd==NULL) /* check if we are searching from the beginning */
+                    last_ref=-1;
+                else
+                    last_ref=block->ddlist[idx].ref;
+                if((found_ref=bv_find(tinfo_ptr->b,last_ref,1))==(uint16)FAIL)
+                  HGOTO_ERROR(DFE_BVFIND, FAIL);
+
+                if((dd_ptr=DAget_elem(tinfo_ptr->d,found_ref))==NULL)
+                  HGOTO_ERROR(DFE_BADREF, FAIL);
+
+                *pdd=dd_ptr;
+                HGOTO_DONE(SUCCEED);
+#endif /* OLD_WAY */
+              } /* end if */
+            else
+              { /* Both tag & ref are not wildcards */
+                for (; block; block = block->next)
+                  {
+                    list = &block->ddlist[idx];
+                    for (; idx < block->ndds; idx++, list++)
+                      {
+                        /* skip the empty dd's */
+                        if (list->tag == DFTAG_NULL && look_tag != DFTAG_NULL)
+                            continue;
+      
+                        if ((list->tag == look_tag
+                            || (special_tag != DFTAG_NULL && list->tag == special_tag))
+                            && list->ref == look_ref)
+                        {
+                            /* we have a match !! */
+                            *pdd=list;
+                            HGOTO_DONE(SUCCEED);
+                        }	/* end if */
+                      }	/* end for */
+        
+                    /* start from beginning of the next dd list */
+                    idx = 0;
+                  }	/* end for */
+              } /* end else */
+          }		/* end if */
+        else if (direction == DF_BACKWARD)
+          {	  /* search backward through the DD list */
+            if(*pdd==NULL)
+              {
+                block=file_rec->ddlast;
+                idx=block->ndds-1;
+              } /* end if */
+            else
+              {
+                block=(*pdd)->blk;
+                idx=((*pdd)-&block->ddlist[0])-1;
+              } /* end else */
+            for (; block;)
+              {
+                list = block->ddlist;
+                for (; idx >= 0; idx--)
+                  {
+                      /* skip the empty dd's */
+                    if (list[idx].tag == DFTAG_NULL && look_tag != DFTAG_NULL)
+                      continue;
+    
+                    if (((look_tag == DFTAG_WILDCARD || list[idx].tag == look_tag)
+                       || (special_tag != DFTAG_NULL && list[idx].tag == special_tag))
+                       && (look_ref == DFREF_WILDCARD || list[idx].ref == look_ref))
+                      {
+    
+                        /* we have a match !! */
+                        *pdd=&list[idx];
+                        HGOTO_DONE(SUCCEED);
+                      }	/* end if */
+                }	/* end for */
+
+              /* start from beginning of the next dd list */
+              block = block->prev;
+              if (block != NULL)
+                  idx = block->ndds - 1;
+              }	/* end for */
+          }		/* end if */
+      } /* end else */
+
+    /* If we get here, we've failed */
+    ret_value=FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HTIfind_dd */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HTIupdate_dd -- update a DD on disk
+ USAGE
+    int HTIupdate_dd(file_rec, dd_ptr)
+        filerec_t *file_rec;    IN: id of file
+        dd_t      *dd_ptr;      IN: pointer to dd to update
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+   Takes appropriate action to note that a DD in a DD block has changed
+
+--------------------------------------------------------------------------*/
+static intn HTIupdate_dd(filerec_t * file_rec, dd_t * dd_ptr)
+{
+    CONSTR(FUNC, "HTIupdate_dd");   /* for HERROR */
+    ddblock_t  *block;              /* DD block the dd is in */
+    int32       idx;                /* index of the DD in the DD block */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+    block=dd_ptr->blk;
+    idx=dd_ptr-&block->ddlist[0];
+    if (file_rec->cache)
+      {		/* if caching is on, postpone update until later */
+        file_rec->dirty |= DDLIST_DIRTY;
+        block->dirty = TRUE;
+      } /* end if */
+    else
+      {
+        int32       offset;         /* offset of updated dd in file */
+        uint8       tbuf[DD_SZ];    /* storage for the DD */
+        uint8      *p;              /* temp buffer ptr */
+
+        /* look for offset of updated dd block in the file */
+        offset = block->myoffset + (NDDS_SZ + OFFSET_SZ) + (idx * DD_SZ);
+
+        /* write in the updated dd */
+        if (HPseek(file_rec, offset) == FAIL)
+          HGOTO_ERROR(DFE_SEEKERROR, FAIL);
+  
+        p = tbuf;
+	DDENCODE(p, dd_ptr->tag, dd_ptr->ref, dd_ptr->offset, dd_ptr->length);
+        if (HP_write(file_rec, tbuf, DD_SZ) == FAIL)
+          HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+      } /* end else */
+  
+    /* check whether to incr. offset of end of file */
+    /* not certain whether this is actually necessary, but better safe than */
+    /* sorry later... -QAK */
+    if ((dd_ptr->offset != INVALID_OFFSET && dd_ptr->length != INVALID_LENGTH) &&
+        ( dd_ptr->offset +  dd_ptr->length) > file_rec->f_end_off)
+      file_rec->f_end_off = dd_ptr->offset + dd_ptr->length;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HTIupdate_dd */
+
+/* ----------------------------- HTIcount_dd ------------------------------ */
+/*
+NAME
+   HTIcount_dd -- counts the dd's of a certain type in file
+USAGE
+   intn HTIcount_dd(file_rec, tag, ref, all_cnt, real_cnt)
+   filerec_t *  file_rec;       IN:  file record to search
+   uint16       tag;            IN:  tag of element to find
+                                     (can be DFTAG_WILDCARD)
+   uint16       ref;            IN:  ref of element to find
+                                     (can be DFREF_WILDCARD)
+   uintn       *all_cnt;        OUT: Count of all the tag/ref pairs
+                                     found, including DFTAG_NULL and
+                                     DFTAG_FREE
+   uintn       *real_cnt;       OUT: Count of all the tag/ref pairs
+                                     found, excluding DFTAG_NULL and 
+                                     DFTAG_FREE
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Counts the number of tag/ref pairs in a file.
+
+   This routine keeps track of and returns to the user the number
+   of all tag/refs and the number of "real" tag/refs found.
+   "Real" tag/refs are any except DFTAG_NULL & DFTAG_FREE.
+
+   This routine always counts the total tag/refs in the file, no
+   provision is made for partial searches.
+
+---------------------------------------------------------------------------*/
+static intn HTIcount_dd(filerec_t * file_rec, uint16 cnt_tag, uint16 cnt_ref,
+           uintn *all_cnt, uintn *real_cnt)
+{
+    uintn       t_all_cnt = 0;  /* count of all tag/refs found */
+    uintn       t_real_cnt = 0; /* count of all tag/refs except NULL & FREE */
+    intn        idx;            /* index into ddlist of current dd searched */
+    ddblock_t  *block;          /* ptr to current ddblock searched */
+    dd_t       *dd_ptr;         /* ptr to current ddlist searched */
+    uint16      special_tag;    /* corresponding special tag */
+
+    HEclear();
+    /* search for special version also */
+    special_tag = MKSPECIALTAG(cnt_tag);
+
+/* Change these algorithms to take advantage of the dynamic arrays for tags -QAK */
+    switch(cnt_tag)
+      {
+          case DFTAG_WILDCARD:
+              for (block = file_rec->ddhead; block != NULL; block = block->next)
+                {
+                    t_all_cnt += (uintn)block->ndds;
+
+                    dd_ptr = block->ddlist;
+                    for (idx = 0; idx < block->ndds; idx++, dd_ptr++)
+                      {
+                          /* skip the empty dd's */
+                          if (dd_ptr->tag == DFTAG_NULL || dd_ptr->tag == DFTAG_FREE)
+                              continue;
+
+                          if ((cnt_ref == DFREF_WILDCARD || dd_ptr->ref == cnt_ref))
+                                t_real_cnt++;
+                  }	/* end for */
+                }		/* end for */
+              break;
+
+          case DFTAG_NULL:
+          case DFTAG_FREE:
+              for (block = file_rec->ddhead; block != NULL; block = block->next)
+                {
+                    t_all_cnt += (uintn)block->ndds;
+
+                    dd_ptr = block->ddlist;
+                    for (idx = 0; idx < block->ndds; idx++, dd_ptr++)
+                          if ((dd_ptr->tag == cnt_tag
+                            || (special_tag != DFTAG_NULL && dd_ptr->tag == special_tag))
+                           && (cnt_ref == DFREF_WILDCARD || dd_ptr->ref == cnt_ref))
+                                t_real_cnt++;
+                }		/* end for */
+              break;
+
+          default:
+              if(special_tag==DFTAG_NULL)
+                {
+                  for (block = file_rec->ddhead; block != NULL; block = block->next)
+                    {
+                        t_all_cnt += (uintn)block->ndds;
+
+                        dd_ptr = block->ddlist;
+                        for (idx = 0; idx < block->ndds; idx++, dd_ptr++)
+                            if (dd_ptr->tag == cnt_tag
+                             && (dd_ptr->ref == cnt_ref || cnt_ref == DFREF_WILDCARD))
+                                  t_real_cnt++;
+                    }		/* end for */
+                } /* end if */
+              else
+                {
+                  if(cnt_ref==DFREF_WILDCARD)
+                    {
+                      for (block = file_rec->ddhead; block != NULL; block = block->next)
+                        {
+                            t_all_cnt += (uintn)block->ndds;
+
+                            idx=0;
+                            dd_ptr = block->ddlist;
+                            if(block->ndds%2 == 1)
+                                if (dd_ptr->tag == cnt_tag || dd_ptr->tag == special_tag)
+                                  {
+                                    t_real_cnt++;
+                                    idx++;
+                                    dd_ptr++;
+                                  } /* end if */
+                            for (; idx < block->ndds; idx++, dd_ptr++)
+                              {
+                                  if (dd_ptr->tag == cnt_tag || dd_ptr->tag == special_tag)
+                                      t_real_cnt++;
+                                  idx++;
+                                  dd_ptr++;
+                                  if (dd_ptr->tag == cnt_tag || dd_ptr->tag == special_tag)
+                                      t_real_cnt++;
+                              } /* end for */
+                        }		/* end for */
+                    } /* end if */
+                  else
+                    {
+                      for (block = file_rec->ddhead; block != NULL; block = block->next)
+                        {
+                            t_all_cnt += (uintn)block->ndds;
+
+                            dd_ptr = block->ddlist;
+                            for (idx = 0; idx < block->ndds; idx++, dd_ptr++)
+                                if ((dd_ptr->tag == cnt_tag || dd_ptr->tag == special_tag)
+                                   && dd_ptr->ref == cnt_ref)
+                                      t_real_cnt++;
+                        }		/* end for */
+                    } /* end else */
+                } /* end else */
+              break;
+      } /* end switch */
+
+    *all_cnt = t_all_cnt;
+    *real_cnt = t_real_cnt;
+    return (SUCCEED);
+}	/* HTIcount_dd */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HTIregister_tag_ref -- mark a ref # as used for a tag
+ USAGE
+    intn HTIregister_tag_ref(file_rec, dd_ptr)
+        filerec_t  * file_rec;        IN: file record
+        dd_t  * dd_ptr;               IN: pointer to the dd the tag/ref is in
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Marks a ref # as used for a given tag.
+
+--------------------------------------------------------------------------*/
+static intn
+HTIregister_tag_ref(filerec_t * file_rec, dd_t *dd_ptr)
+{
+  CONSTR(FUNC, "HTIregister_tag_ref");
+  tag_info *tinfo_ptr;  /* pointer to the info for a tag */
+  tag_info **tip_ptr;   /* ptr to the ptr to the info for a tag */
+  uint16 base_tag=BASETAG(dd_ptr->tag);      /* the base tag for the tag tree */
+  int         ret_value = SUCCEED;
+
+  HEclear();
+  /* Add to the tag info tree */
+  if((tip_ptr=(tag_info **)tbbtdfind(file_rec->tag_tree,(VOIDP)&base_tag,NULL))==NULL)
+    {   /* a new tag was found */
+      if((tinfo_ptr=(tag_info *)HDcalloc(1,sizeof(tag_info)))==NULL)
+          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      tinfo_ptr->tag=base_tag;
+
+      /* Insert the tag node into the tree */
+      tbbtdins(file_rec->tag_tree, (VOIDP) tinfo_ptr, NULL);
+
+      /* Take care of the bit-vector */
+      if((tinfo_ptr->b=bv_new(-1,BV_EXTENDABLE))==NULL)
+          HGOTO_ERROR(DFE_BVNEW, FAIL);
+      /* Set the 0'th bit in the bit-vector (cannot be stored in HDF files) */
+      /* Yes, this is a kludge due to ref # zero not being used -QAK */
+      if(bv_set(tinfo_ptr->b,0,BV_TRUE)==FAIL)
+          HGOTO_ERROR(DFE_BVSET, FAIL);
+
+      /* Take care of the dynarray */
+      if((tinfo_ptr->d=DAcreate_array(REF_DYNARRAY_START,REF_DYNARRAY_INCR))==NULL)
+          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    } /* end if */
+  else
+    {   /* found an existing tag */
+        intn ref_bit;    /* bit of the ref # in the tag info */
+
+        tinfo_ptr=*tip_ptr; /* get the pointer to the tag info */
+        if((ref_bit=bv_get(tinfo_ptr->b,(intn)dd_ptr->ref))==FAIL)
+            HGOTO_ERROR(DFE_BVGET, FAIL);
+        if(ref_bit==BV_TRUE)
+            HGOTO_ERROR(DFE_DUPDD, FAIL);
+    } /* end else */
+
+  /* Set the bit in the bit-vector */
+  if(bv_set(tinfo_ptr->b,(intn)dd_ptr->ref,BV_TRUE)==FAIL)
+      HGOTO_ERROR(DFE_BVSET, FAIL);
+
+  /* Insert the DD info into the dynarray for later use */
+  if(DAset_elem(tinfo_ptr->d,(intn)dd_ptr->ref,(VOIDP)dd_ptr)==FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+      if(tinfo_ptr->d!=NULL)
+          DAdestroy_array(tinfo_ptr->d,0);
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HTIregister_tag_ref */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HTIunregister_tag_ref -- mark a ref # as free for a tag
+ USAGE
+    intn HTIunregister_tag_ref(file_rec, tag, ref)
+        filerec_t  * file_rec;        IN: file record
+        dd_t  *dd_ptr;                IN: DD of the tag/ref to unregister
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) if failed.
+ DESCRIPTION
+    Marks a ref # as free for a given tag.
+
+--------------------------------------------------------------------------*/
+static intn HTIunregister_tag_ref(filerec_t * file_rec, dd_t *dd_ptr)
+{
+  CONSTR(FUNC, "HTIunregister_tag_ref");
+  tag_info *tinfo_ptr;  /* pointer to the info for a tag */
+  tag_info **tip_ptr;   /* ptr to the ptr to the info for a tag */
+  uint16 base_tag=BASETAG(dd_ptr->tag);      /* the base tag for the tag tree */
+  int         ret_value = SUCCEED;
+
+  HEclear();
+  /* Add to the tag info tree */
+  if((tip_ptr=(tag_info **)tbbtdfind(file_rec->tag_tree,(VOIDP)&base_tag,NULL))==NULL)
+    {
+      HGOTO_ERROR(DFE_BADTAG, FAIL);
+    } /* end if */
+  else
+    {   /* found an existing tag */
+        intn ref_bit;    /* bit of the ref # in the tag info */
+
+        tinfo_ptr=*tip_ptr; /* get the pointer to the tag info */
+        if((ref_bit=bv_get(tinfo_ptr->b,(intn)dd_ptr->ref))==FAIL)
+            HGOTO_ERROR(DFE_BVGET, FAIL);
+        if(ref_bit==BV_FALSE)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+        if(bv_set(tinfo_ptr->b,(intn)dd_ptr->ref,BV_FALSE)==FAIL)
+            HGOTO_ERROR(DFE_BVSET, FAIL);
+
+        /* Delete the DD info from the tag tree */
+        if(DAdel_elem(tinfo_ptr->d,(intn)dd_ptr->ref)==NULL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* Delete the tag/ref from the file */
+        dd_ptr->tag=DFTAG_NULL;
+    } /* end else */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* HTIunregister_tag_ref */
+
+/* ---------------------------- tagcompare ------------------------- */
+/*
+   Compares two tag B-tree keys for equality.  Similar to memcmp.
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+ */
+intn
+tagcompare(VOIDP k1, VOIDP k2, intn cmparg)
+{
+  intn  ret_value;
+  /* shut compiler up */
+  cmparg = cmparg;
+
+  ret_value = ((intn) ((*(uint16 *) k1) - (*(uint16 *) k2)));    /* valid for integer keys */
+
+  return ret_value;
+}   /* tagcompare */
+
+/* ---------------------------- tagdestroynode ------------------------- */
+/*
+   Frees tag B-Tree nodes
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+ */
+VOID
+tagdestroynode(VOIDP n)
+{
+    tag_info *t=(tag_info *)n;
+
+    if(t->b!=NULL)
+        bv_delete(t->b);
+    if(t->d!=NULL)
+        DAdestroy_array(t->d,0);
+    HDfree((VOIDP) n);
+}   /* tagdestroynode */
+
diff --git a/hdf/src/hfilef.c b/hdf/src/hfilef.c
new file mode 100644
index 0000000..c4c7b24
--- /dev/null
+++ b/hdf/src/hfilef.c
@@ -0,0 +1,291 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: hfilef.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    hfilef.c
+ * Purpose: C stubs for Fortran low level routines
+ * Invokes: hfile.c
+ * Contents:
+ *  hiopen_:   call Hopen to open HDF file
+ *  hclose_:   call Hclose to close HDF file
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "hproto_fortran.h"
+
+/*-----------------------------------------------------------------------------
+ * Name:    hiopen
+ * Purpose: call Hopen to open HDF file
+ * Inputs:  name: name of file to open
+ *          acc_mode: access mode - integer with value DFACC_READ etc.
+ *          defdds: default number of DDs per header block
+ *          namelen: length of name
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers
+ * Invokes: Hopen
+ * Method:  Convert filename to C string, call Hopen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhiopen(_fcd name, intf * acc_mode, intf * defdds, intf * namelen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(name, (intn) *namelen);
+    if (!fn)
+	return(FAIL);
+    ret = (intf) Hopen(fn, (intn) *acc_mode, (int16) *defdds);
+    HDfree(fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    hclose
+ * Purpose: Call DFclose to close HDF file
+ * Inputs:  file_id: handle to HDF file to close
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ * Invokes: Hclose
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhclose(intf * file_id)
+{
+    return (Hclose(*file_id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    hnumber
+ * Purpose: Get numer of elements with tag
+ * Inputs:  file_id: handle to HDF file to close
+ * Returns: the number of objects of type 'tag' else FAIL
+ * Users:   HDF Fortran programmers
+ * Invokes: Hnumber
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhnumber(intf * file_id, intf *tag)
+{
+    return (Hnumber((int32) *file_id, (uint16) *tag));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    hxisdir
+ * Purpose: call HXsetdir to set the directory variable for locating an external file
+ * Inputs:  dir: names of directory separated by colons
+ * Returns: SUCCEED if no error, else FAIL
+ * Users:   HDF Fortran programmers
+ * Invokes: HXsetdir
+ * Method:  Convert dir to C string, call HXsetdir
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhxisdir(_fcd dir, intf * dirlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(dir, (intn) *dirlen);
+    if (!fn)
+	return(FAIL);
+    ret = (intf) HXsetdir(fn);
+    HDfree(fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    hxiscdir
+ * Purpose: call HXsetcreatedir to set the directory variable for creating an external file
+ * Inputs:  dir: name of directory
+ * Returns: SUCCEED if no error, else FAIL
+ * Users:   HDF Fortran programmers
+ * Invokes: HXsetcreatedir
+ * Method:  Convert dir to C string, call HXsetcdir
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhxiscdir(_fcd dir, intf * dirlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(dir, (intn) *dirlen);
+    if (!fn)
+	return(FAIL);
+    ret = (intf) HXsetcreatedir(fn);
+    HDfree(fn);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    hddontatexit
+ * Purpose: Call HDdont_atexit
+ * Inputs:  
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ * Invokes: HDdont_atexit 
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhddontatexit(void)
+{
+   return((intf)(HDdont_atexit()));
+}
+/*-----------------------------------------------------------------------------
+ * Name: hglibverc
+ * Purpose:  Calls Hgetlibversion
+ * 
+ * Outputs: major_v - major version number
+ *          minor_v - minor version number
+ *          release - release number
+ *          string  - version number text string
+ * Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+ *----------------------------------------------------------------------------*/
+ 
+ 
+ FRETVAL(intf)
+#ifdef PROTOTYPE
+nhglibverc(intf *major_v, intf *minor_v, intf *release, _fcd string, intf *len)
+#else
+nhglibverc(major_v, minor_v, release, string, len)
+           intf *major_v;
+           intf *minor_v;
+           intf *release;
+           _fcd  string;
+           intf  *len;
+#endif /* PROTOTYPE */
+{
+   char *cstring;
+   uint32 cmajor_v;
+   uint32 cminor_v;
+   uint32 crelease;
+   intn   status;
+   
+   cstring = NULL;
+   if (*len) cstring = (char *) HDmalloc((uint32)*len + 1);
+   status = Hgetlibversion(&cmajor_v, &cminor_v, &crelease, cstring);
+ 
+   HDpackFstring(cstring,  _fcdtocp(string),  *len);
+
+   if(cstring)  HDfree((VOIDP)cstring);
+
+   *major_v = (intf) cmajor_v;
+   *minor_v = (intf) cminor_v;
+   *release = (intf) crelease;
+
+   return((intf)status);
+
+}
+/*-----------------------------------------------------------------------------
+ * Name: hgfilverc
+ * Purpose:  Calls Hgetfileversion
+ * Inputs:  file_id - file identifier 
+ * Outputs: major_v - major version number
+ *          minor_v - minor version number
+ *          release - release number
+ *          string  - version number text string
+ * Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+ *----------------------------------------------------------------------------*/
+ 
+ 
+ FRETVAL(intf)
+#ifdef PROTOTYPE
+nhgfilverc(intf *file_id, intf *major_v, intf *minor_v, intf *release,
+            _fcd string, intf *len)
+#else
+nhgfilverc(file_id, major_v, minor_v, release, string, len)
+           intf *file_id; 
+           intf *major_v;
+           intf *minor_v;
+           intf *release;
+           _fcd  string;
+           intf  *len;
+#endif /* PROTOTYPE */
+{
+   char *cstring;
+   uint32 cmajor_v;
+   uint32 cminor_v;
+   uint32 crelease;
+   intn   status;
+   
+   cstring = NULL;
+   if (*len) cstring = (char *) HDmalloc((uint32)*len + 1);
+   status = Hgetfileversion((int32) *file_id, &cmajor_v, &cminor_v, &crelease,
+                            cstring);
+ 
+   HDpackFstring(cstring,  _fcdtocp(string),  *len);
+
+   if(cstring)  HDfree((VOIDP)cstring);
+
+   *major_v = (intf) cmajor_v;
+   *minor_v = (intf) cminor_v;
+   *release = (intf) crelease;
+
+   return((intf)status);
+
+}
+/*-----------------------------------------------------------------------------
+ * Name:    hiishdf
+ * Purpose: call Hishdf function
+ * Inputs:  name: Name of the file 
+ *          namelen: length of name
+ * Returns: TRUE(1) on success, FALSE (-1) on failure
+ * Users:   HDF Fortran programmers
+ * Method:  Convert filename to C string, call Hishdf
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhiishdf(_fcd name,  intf * namelen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(name, (intn) *namelen);
+    if (!fn)
+	return(FAIL);
+    ret = (intf) Hishdf(fn);
+    HDfree(fn);
+    return (ret);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    hconfinfc
+ * Purpose: call HCget_config_info
+ * Inputs:  coder_type - compression type
+ * Outputs: info       - flag to indicate compression status
+ *                       0 - compression is not available
+ *                       1 - only decoder found
+ *                       2 - both decoder and encoder are available
+ * Returns: SUCCEED (0)  on success, FALSE (-1) on failure
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhconfinfc (intf *coder_type,  intf * info)
+{
+    comp_coder_t coder_type_c;
+    uint32       info_c;
+    intn         status;
+
+    coder_type_c = (comp_coder_t) *coder_type;
+    status = HCget_config_info(coder_type_c, &info_c);
+    if (status == FAIL)
+	return(FAIL);
+    *info = (intf) info_c; 
+    return (status);
+}
diff --git a/hdf/src/hfileff.f b/hdf/src/hfileff.f
new file mode 100644
index 0000000..5c59d03
--- /dev/null
+++ b/hdf/src/hfileff.f
@@ -0,0 +1,197 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: hfileff.f 4964 2007-09-15 23:32:35Z epourmal $
+C
+C------------------------------------------------------------------------------
+C File:     hfileFf.f
+C Purpose:  Fortran stubs for Palette Fortran routines
+C Invokes:  hfileF.c 
+C Contents: 
+C   hopen:          Call hiopen to open file
+C hnumber:          Call hnumber
+C Remarks: none
+C----------------------------------------------------------------------------*/
+
+
+C------------------------------------------------------------------------------
+C Name: hopen
+C Purpose:  call hiopen, open file
+C Inputs:   path: Name of file to be opened
+C           access: DFACC_READ, DFACC_WRITE, DFACC_CREATE,
+C                      or any bitwise-or of the above.
+C           ndds: Number of dds in header block if file needs to be created.
+C Returns: 0 on success, FAIL on failure with error set
+C Users:    Fortran stub routine
+C Invokes: hiopen
+C----------------------------------------------------------------------------*/
+
+      integer function hopen(filename, access, defdds)
+
+      character*(*) filename
+      integer       access, defdds, hiopen
+
+      hopen = hiopen(filename, access, defdds, len(filename))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: hxsdir
+C Purpose:  call hxisdir to set directory variable for locating an external file
+C Inputs:   dir: names of directory separated by colons.
+C Returns:  SUCCEED if no error, else FAIL
+C Users:    Fortran stub routine
+C Invokes: hxisdir
+C----------------------------------------------------------------------------*/
+
+      integer function hxsdir(dir)
+
+      character*(*) dir
+      integer       hxisdir
+
+      hxsdir = hxisdir(dir, len(dir))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: hxscdir
+C Purpose:  call hxiscdir to set directory variable for creating an external file
+C Inputs:   dir: name of the directory
+C Returns:  SUCCEED if no error, else FAIL
+C Users:    Fortran stub routine
+C Invokes: hxiscdir
+C----------------------------------------------------------------------------*/
+
+      integer function hxscdir(dir)
+
+      character*(*) dir
+      integer       hxiscdir
+
+      hxscdir = hxiscdir(dir, len(dir))
+      return
+      end
+C-----------------------------------------------------------------------------
+C Name: hglibver
+C Purpose: retrieves the version information for the current HDF library
+C Outputs: major_v - major version number
+C          minor_v - minor version number
+C          release - release number
+C          string  - version number test string
+C Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+C-----------------------------------------------------------------------------*/
+
+      integer function hglibver(major_v, minor_v, release, string)
+
+      integer major_v, minor_v, release
+      character*(*) string
+      integer hglibverc 
+
+      hglibver = hglibverc(major_v, minor_v, release, string,
+     .                     len(string))
+      return
+      end
+C-----------------------------------------------------------------------------
+C Name: hgfilver
+C Purpose: retrieves the version information for the current HDF library
+C Inputs:  file_id - file identifier
+C Outputs: major_v - major version number
+C          minor_v - minor version number
+C          release - release number
+C          string  - version number test string
+C Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+C-----------------------------------------------------------------------------*/
+
+      integer function hgfilver(file_id, major_v, minor_v, release,
+     .                          string)
+
+      integer file_id, major_v, minor_v, release
+      character*(*) string
+      integer hgfilverc 
+
+      hgfilver = hgfilverc(file_id, major_v, minor_v, release, string,
+     .                     len(string))
+      return
+      end
+C------------------------------------------------------------------------------
+C Name: hishdff
+C Purpose:  Identifies if the file "file_name" is an HDF file. 
+C Inputs:   file_name:  File name
+C Returns: TRUE (1) if successful, FALSE (0) otherwise.
+C Invokes: hiopen
+C----------------------------------------------------------------------------*/
+
+      integer function hishdff(filename)
+
+      character*(*) filename
+      integer       hiishdf
+
+      hishdff = hiishdf(filename, len(filename))
+      return
+      end
+C-----------------------------------------------------------------------------
+C Name: hestringf
+C Purpose: retrieves the error message associated with the specified error code 
+C Inputs:  error_code 
+C Outputs: error_message - string associated with the error code 
+C Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+C-----------------------------------------------------------------------------*/
+
+      integer function hestringf(error_code, error_message)
+
+      integer error_code 
+      character*(*) error_message 
+      integer hestringc 
+
+      hestringf = hestringc(error_code, error_message,
+     .                      len(error_message))
+      return
+      end
+C-----------------------------------------------------------------------------
+C Name: heprntf
+C Purpose: prints values from the error stack 
+C Inputs:  filename - name of the output file; if length of the
+C          filename is 0, then output goes to stdout.  
+C          print_levels - number of levels to print 
+C Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+C
+C Remarks: This routine always prints to the standard output.
+C-----------------------------------------------------------------------------*/
+
+      integer function heprntf(filename, print_levels)
+      integer print_levels 
+      character*(*) filename
+      
+      integer heprntc
+      heprntf = heprntc(filename, print_levels,len(filename))
+      return
+      end
+C-----------------------------------------------------------------------------
+C Name: hconfinf
+C Purpose: return info about configuration of a compression method
+C Inputs:  coder_type -  the compression type queried  
+C          info       -  flag to indicate compression status
+C                         0 - no compression found
+C                         1 - decoder only found
+C                         3 - both decoder and encoder found 
+C Retruns: SUCCEED (0) if successful and FAIL(-1) otherwise
+C
+C Currently this routine is used with SZIP compression only 
+C-----------------------------------------------------------------------------*/
+
+      integer function hconfinf(coder_type, info)
+      integer coder_type, info
+
+      integer hconfinfc
+      hconfinf = hconfinfc(coder_type, info)
+      return
+      end
diff --git a/hdf/src/hkit.c b/hdf/src/hkit.c
new file mode 100644
index 0000000..9bea081
--- /dev/null
+++ b/hdf/src/hkit.c
@@ -0,0 +1,347 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: hkit.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+#include <ctype.h>
+#include "hkit.h"
+
+/*
+LOCAL ROUTINES
+  None
+EXPORTED ROUTINES
+  HDc2fstr      -- convert a C string into a Fortran string IN PLACE
+  HDf2cstring   -- convert a Fortran string to a C string
+  HDpackFstring -- convert a C string into a Fortran string
+  HDflush       -- flush the HDF file
+  HDgettagdesc  -- return a text description of a tag
+  HDgettagsname -- return a text name of a tag
+  HDgettagnum   -- return the tag number for a text description of a tag
+  HDgetNTdesc   -- return a text description of a number-type
+  HDfidtoname   -- return the filename the file ID corresponds to
+*/
+
+/* ------------------------------- HDc2fstr ------------------------------- */
+/*
+NAME
+   HDc2fstr -- convert a C string into a Fortran string IN PLACE
+USAGE
+   intn HDc2fstr(str, len)
+   char * str;       IN: string to convert
+   intn   len;       IN: length of Fortran string
+RETURNS
+   SUCCEED
+DESCRIPTION
+   Change a C string (NULL terminated) into a Fortran string.
+   Basically, all that is done is that the NULL is ripped out
+   and the string is padded with spaces
+
+---------------------------------------------------------------------------*/
+intn 
+HDc2fstr(char *str, intn len)
+{
+    int         i;
+
+    i=(int)HDstrlen(str);
+    for (; i < len; i++)
+        str[i] = ' ';
+    return SUCCEED;
+}   /* HDc2fstr */
+
+/* ----------------------------- HDf2cstring ------------------------------ */
+/*
+NAME
+   HDf2cstring -- convert a Fortran string to a C string
+USAGE
+   char * HDf2cstring(fdesc, len)
+   _fcd  fdesc;     IN: Fortran string descriptor
+   intn  len;       IN: length of Fortran string
+RETURNS
+   Pointer to the C string if success, else NULL
+DESCRIPTION
+   Chop off trailing blanks off of a Fortran string and
+   move it into a newly allocated C string.  It is up
+   to the user to free this string.
+
+---------------------------------------------------------------------------*/
+char *
+HDf2cstring(_fcd fdesc, intn len)
+{
+    CONSTR(FUNC, "HDf2cstring");  /* for HERROR */
+    char       *cstr, *str;
+    int         i;
+
+    str = _fcdtocp(fdesc);
+    /* This should be equivalent to the above test -QAK */
+    for(i=len-1; i>=0 && !isgraph((int)str[i]); i--)
+        /*EMPTY*/;
+    cstr = (char *) HDmalloc((uint32) (i + 2));
+    if (!cstr)
+	HRETURN_ERROR(DFE_NOSPACE, NULL);
+    cstr[i + 1] = '\0';
+    HDmemcpy(cstr,str,i+1);
+    return cstr;
+}   /* HDf2cstring */
+/* ---------------------------- HDpackFstring ----------------------------- */
+/*
+NAME
+   HDpackFstring -- convert a C string into a Fortran string
+USAGE
+   intn HDpackFstring(src, dest, len)
+   char * src;          IN:  source string
+   char * dest;         OUT: destination
+   intn   len;          IN:  length of string
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   given a NULL terminated C string 'src' convert it to
+   a space padded Fortran string 'dest' of length 'len'
+
+   This is very similar to HDc2fstr except that function does
+   it in place and this one copies.  We should probably only
+   support one of these.
+
+---------------------------------------------------------------------------*/
+intn 
+HDpackFstring(char *src, char *dest, intn len)
+{
+    intn        sofar;
+
+    for (sofar = 0; (sofar < len) && (*src != '\0'); sofar++)
+        *dest++ = *src++;
+
+    while (sofar++ < len)
+        *dest++ = ' ';
+
+    return SUCCEED;
+}	/* HDpackFstring */
+
+/* ------------------------------- HDflush -------------------------------- */
+/*
+NAME
+   HDflush -- flush the HDF file
+USAGE
+   intn HDflush(fid)
+   int32 fid;            IN: file ID
+RETURNS
+   SUCCEED / FAIL
+DESCRIPTION
+   Force the system to flush the HDF file stream
+
+   This should be primarily used for debugging
+
+   The MAC does not really support fflush() so this r
+   outine just returns SUCCEED always on a MAC w/o
+   really doing anything.
+
+---------------------------------------------------------------------------*/
+intn 
+HDflush(int32 file_id)
+{
+    CONSTR(FUNC, "HDflush");    /* for HERROR */
+
+    filerec_t  *file_rec;
+
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HRETURN_ERROR(DFE_ARGS, FAIL);
+
+    HI_FLUSH(file_rec->file);
+
+    return SUCCEED;
+}	/* HDflush */
+
+/* ----------------------------- HDgettagdesc ----------------------------- */
+/*
+NAME
+   HDgettagdesc -- return a text description of a tag
+USAGE
+   char * HDgettagdesc(tag)
+   uint16   tag;          IN: tag of element to find
+RETURNS
+   Descriptive text or NULL
+DESCRIPTION
+   Map a tag to a statically allocated text description of it.
+
+---------------------------------------------------------------------------*/
+const char *
+HDgettagdesc(uint16 tag)
+{
+    intn        i;
+
+    for (i = 0; i < (intn)(sizeof(tag_descriptions) / sizeof(tag_descript_t)); i++)
+        if (tag_descriptions[i].tag == tag)
+            return (tag_descriptions[i].desc);
+    return (NULL);
+} /* HDgettagdesc */
+
+/* ----------------------------- HDgettagsname ----------------------------- */
+/*
+NAME
+   HDgettagsname -- return a text name of a tag
+USAGE
+   char * HDgettagsname(tag)
+   uint16   tag;          IN: tag of element to find
+RETURNS
+   Descriptive text or NULL
+DESCRIPTION
+   Map a tag to a dynamically allocated text name of it.
+   Checks for special elements now.
+
+--------------------------------------------------------------------------- */
+char *
+HDgettagsname(uint16 tag)
+{
+    CONSTR(FUNC, "HDgettagsname");  /* for HERROR */
+    char       *ret = NULL;
+    intn        i;
+
+    if (SPECIALTAG(tag))
+        ret = (char *) HDstrdup("Special ");
+    tag = BASETAG(tag);
+    for (i = 0; i < (intn)(sizeof(tag_descriptions) / sizeof(tag_descript_t)); i++)
+        if (tag_descriptions[i].tag == tag)
+          {
+              if (ret == NULL)
+                  ret = (char *) HDstrdup(tag_descriptions[i].name);
+              else
+                {
+                    char       *t;
+
+                    t = (char *) HDmalloc(HDstrlen(ret) +
+                                    HDstrlen(tag_descriptions[i].name) + 2);
+                    if (t == NULL)
+                      {
+                          HDfree(ret);
+                          HRETURN_ERROR(DFE_NOSPACE, NULL)
+                      }     /* end if */
+                    HDstrcpy(t, ret);
+                    HDstrcat(t, tag_descriptions[i].name);
+                    HDfree(ret);
+                    ret = t;
+                }   /* end else */
+          }     /* end if */
+    return (ret);
+}  /* HDgettagsname */
+
+/* ----------------------------- HDgettagnum ------------------------------ */
+/*
+NAME
+   HDgettagnum -- return the tag number for a text description of a tag
+USAGE
+   intn HDgettagnum(tag_name)
+   char *   tag_name;         IN: name of tag to find
+RETURNS
+   Tag number (>=0) on success or FAIL on failure
+DESCRIPTION
+   Map a tag name to a statically allocated tag number for it.
+
+---------------------------------------------------------------------------*/
+intn 
+HDgettagnum(const char *tag_name)
+{
+    intn        i;
+
+    for (i = 0; i < (intn)(sizeof(tag_descriptions) / sizeof(tag_descript_t)); i++)
+        if (0 == HDstrcmp(tag_descriptions[i].name, tag_name))
+            return ((intn)tag_descriptions[i].tag);
+    return (FAIL);
+} /* HDgettagnum */
+
+/* ----------------------------- HDgetNTdesc ----------------------------- */
+/*
+NAME
+   HDgetNTdesc -- return a text description of a number-type
+USAGE
+   char * HDgetNTdesc(nt)
+   int32   nt;          IN: tag of element to find
+RETURNS
+   Descriptive text or NULL
+DESCRIPTION
+   Map a number-type to a dynamically allocated text description of it.
+
+---------------------------------------------------------------------------*/
+char *
+HDgetNTdesc(int32 nt)
+{
+    CONSTR(FUNC, "HDgetNTdesc");    /* for HERROR */
+    intn        i;
+    char       *ret_desc = NULL;
+
+    /* evil hard-coded values */
+    if (nt & DFNT_NATIVE)
+        ret_desc = (char *) HDstrdup(nt_descriptions[0].desc);
+    else if (nt & DFNT_CUSTOM)
+        ret_desc = (char *) HDstrdup(nt_descriptions[1].desc);
+    else if (nt & DFNT_LITEND)
+        ret_desc = (char *) HDstrdup(nt_descriptions[2].desc);
+
+    nt &= DFNT_MASK;    /* mask off unusual format types */
+    for (i = 3; i < (intn)(sizeof(nt_descriptions) / sizeof(nt_descript_t)); i++)
+        if (nt_descriptions[i].nt == nt)
+          {
+              if (ret_desc == NULL)
+                  ret_desc = (char *) HDstrdup(nt_descriptions[i].desc);
+              else
+                {
+                    char       *t;
+
+                    t = (char *) HDmalloc(HDstrlen(ret_desc) +
+                                     HDstrlen(nt_descriptions[i].desc) + 2);
+                    if (t == NULL)
+                      {
+                          HDfree(ret_desc);
+                          HRETURN_ERROR(DFE_NOSPACE, NULL)
+                      }     /* end if */
+                    HDstrcpy(t, ret_desc);
+                    HDstrcat(t, " ");
+                    HDstrcat(t, nt_descriptions[i].desc);
+                    HDfree(ret_desc);
+                    ret_desc = t;
+                }   /* end else */
+              return (ret_desc);
+          }     /* end if */
+    return (NULL);
+}   /* end HDgetNTdesc() */
+
+/* ------------------------------- HDfidtoname ------------------------------ */
+/*
+NAME
+   HDfidtoname -- return the filename the file ID corresponds to
+USAGE
+   const char * HDfidtoname(fid)
+   int32 fid;            IN: file ID
+RETURNS
+   SUCCEED - pointer to filename / FAIL - NULL
+DESCRIPTION
+   Map a file ID to the filename used to get it.  This is useful for 
+   mixing old style single-file interfaces (which take filenames) and
+   newer interfaces which use file IDs.
+
+---------------------------------------------------------------------------*/
+const char *
+HDfidtoname(int32 file_id)
+{
+    CONSTR(FUNC, "HDfidtoname");    /* for HERROR */
+    filerec_t  *file_rec;
+
+    if ((file_rec = HAatom_object(file_id)) == NULL)
+        HRETURN_ERROR(DFE_ARGS, NULL);
+
+    return (file_rec->path);
+}   /* HDfidtoname */
+
diff --git a/hdf/src/hkit.h b/hdf/src/hkit.h
new file mode 100644
index 0000000..1954c60
--- /dev/null
+++ b/hdf/src/hkit.h
@@ -0,0 +1,167 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hkit.h 5467 2010-09-25 14:19:19Z bmribler $ */
+
+/*+ hkit.h
+   ***  private header file for hkit routines
+   + */
+
+#ifndef __HKIT_H
+#include "hdf.h"
+#include "hfile.h"
+
+/* tag_messages is the list of tag descriptions in the system, kept as
+   tag-description pairs.  To look up a description, a linear search is
+   required but efficiency should be okay. */
+typedef struct tag_descript_t
+  {
+      uint16      tag;          /* tag for description ? */
+      const char *desc;         /* tag description ? */
+      const char *name;         /* tag name ? */
+  }
+tag_descript_t;
+
+/* stringizing macro */
+#define string(x) #x
+
+/*  NOTE:
+ *        Please keep tag descriptions <= 30 characters - a
+ *        lot of pretty-printing code depends on it.
+ */
+PRIVATE const tag_descript_t tag_descriptions[] =
+{
+/* low-level set */
+    {DFTAG_NULL, string(DFTAG_NULL), "No Data"},
+    {DFTAG_LINKED, string(DFTAG_LINKED), "Linked Blocks Indicator"},
+    {DFTAG_VERSION, string(DFTAG_VERSION), "Version Descriptor"},
+    {DFTAG_COMPRESSED, string(DFTAG_COMPRESSED), "Compressed Data Indicator"},
+    {DFTAG_CHUNK, string(DFTAG_CHUNK), "Data Chunk"},
+
+/* utility set */
+    {DFTAG_FID, string(DFTAG_FID), "File Identifier"},
+    {DFTAG_FD, string(DFTAG_FD), "File Description"},
+    {DFTAG_TID, string(DFTAG_TID), "Tag Identifier"},
+    {DFTAG_TD, string(DFTAG_TD), "Tag Description"},
+    {DFTAG_DIL, string(DFTAG_DIL), "Data Id Label"},
+    {DFTAG_DIA, string(DFTAG_DIA), "Data Id Annotation"},
+    {DFTAG_NT, string(DFTAG_NT), "Number type"},
+    {DFTAG_MT, string(DFTAG_MT), "Machine type"},
+    {DFTAG_FREE, string(DFTAG_FREE), "Free space"},
+
+      /* raster-8 Tags */
+    {DFTAG_ID8, string(DFTAG_ID8), "Image Dimensions-8"},
+    {DFTAG_IP8, string(DFTAG_IP8), "Image Palette-8"},
+    {DFTAG_RI8, string(DFTAG_RI8), "Raster Image-8"},
+    {DFTAG_CI8, string(DFTAG_CI8), "RLE Compressed Image-8"},
+    {DFTAG_II8, string(DFTAG_II8), "Imcomp Image-8"},
+
+      /* Raster Image Tags */
+    {DFTAG_ID, string(DFTAG_ID), "Image Dimensions"},
+    {DFTAG_LUT, string(DFTAG_LUT), "Image Palette"},
+    {DFTAG_RI, string(DFTAG_RI), "Raster Image Data"},
+    {DFTAG_CI, string(DFTAG_CI), "Compressed Image"},
+    {DFTAG_RIG, string(DFTAG_RIG), "Raster Image Group"},
+    {DFTAG_LD, string(DFTAG_LD), "Palette Dimension"},
+    {DFTAG_MD, string(DFTAG_MD), "Matte Dimension"},
+    {DFTAG_MA, string(DFTAG_MA), "Matte Data"},
+    {DFTAG_CCN, string(DFTAG_CCN), "Color Correction"},
+    {DFTAG_CFM, string(DFTAG_CFM), "Color Format"},
+    {DFTAG_AR, string(DFTAG_AR), "Aspect Ratio"},
+    {DFTAG_DRAW, string(DFTAG_DRAW), "Sequenced images"},
+    {DFTAG_RUN, string(DFTAG_RUN), "Runable program / script"},
+    {DFTAG_XYP, string(DFTAG_XYP), "X-Y position"},
+    {DFTAG_MTO, string(DFTAG_MTO), "M/c-Type override"},
+
+      /* Tektronix */
+    {DFTAG_T14, string(DFTAG_T14), "TEK 4014 Data"},
+    {DFTAG_T105, string(DFTAG_T105), "TEK 4105 data"},
+
+      /* Scientific / Numeric Data Sets */
+    {DFTAG_SDG, string(DFTAG_SDG), "Scientific Data Group"},
+    {DFTAG_SDD, string(DFTAG_SDD), "SciData dimension record"},
+    {DFTAG_SD, string(DFTAG_SD), "Scientific Data"},
+    {DFTAG_SDS, string(DFTAG_SDS), "SciData scales"},
+    {DFTAG_SDL, string(DFTAG_SDL), "SciData labels"},
+    {DFTAG_SDU, string(DFTAG_SDU), "SciData units"},
+    {DFTAG_SDF, string(DFTAG_SDF), "SciData formats"},
+    {DFTAG_SDM, string(DFTAG_SDM), "SciData max/min"},
+    {DFTAG_SDC, string(DFTAG_SDC), "SciData coordsys"},
+    {DFTAG_SDT, string(DFTAG_SDT), "Transpose"},
+    {DFTAG_SDLNK, string(DFTAG_SDLNK), "Links related to the dataset"},
+    {DFTAG_NDG, string(DFTAG_NDG), "Numeric Data Group"},
+    {DFTAG_CAL, string(DFTAG_CAL), "Calibration information"},
+    {DFTAG_FV, string(DFTAG_FV), "Fill value information"},
+
+      /* V Group Tags */
+    {DFTAG_VG, string(DFTAG_VG), "Vgroup"},
+    {DFTAG_VH, string(DFTAG_VH), "Vdata"},
+    {DFTAG_VS, string(DFTAG_VS), "Vdata Storage"},
+
+      /* Compression Schemes */
+    {DFTAG_RLE, string(DFTAG_RLE), "Run Length Encoding"},
+    {DFTAG_IMCOMP, string(DFTAG_IMCOMP), "IMCOMP Encoding"},
+    {DFTAG_JPEG, string(DFTAG_JPEG), "24-bit JPEG Encoding"},
+    {DFTAG_GREYJPEG, string(DFTAG_GREYJPEG), "8-bit JPEG Encoding"},
+    {DFTAG_JPEG5, string(DFTAG_JPEG5), "24-bit JPEG Encoding"},
+    {DFTAG_GREYJPEG5, string(DFTAG_GREYJPEG5), "8-bit JPEG Encoding"}
+
+};
+
+/* nt_message is the list of NT descriptions in the system, kept as
+   NT-description pairs.  To look up a description, a linear search is
+   required but efficiency should be okay. */
+typedef struct nt_descript_t
+  {
+      int32       nt;           /* nt for description */
+      const char *name;         /* nt name */
+      const char *desc;         /* nt description */
+  }
+nt_descript_t;
+
+PRIVATE const nt_descript_t nt_descriptions[] =
+{
+
+/* Masks for types */
+    {DFNT_NATIVE, string(DFNT_NATIVE), "native format"},
+    {DFNT_CUSTOM, string(DFNT_CUSTOM), "custom format"},
+    {DFNT_LITEND, string(DFNT_LITEND), "little-endian format"},
+
+    {DFNT_NONE, string(DFNT_NONE), "number-type not set"},
+
+/* Floating point types */
+    {DFNT_FLOAT32, string(DFNT_FLOAT32), "32-bit floating point"},
+    {DFNT_FLOAT64, string(DFNT_FLOAT64), "64-bit floating point"},
+    {DFNT_FLOAT128, string(DFNT_FLOAT128), "128-bit floating point"},
+
+/* Integer types */
+    {DFNT_INT8, string(DFNT_INT8), "8-bit signed integer"},
+    {DFNT_UINT8, string(DFNT_UINT8), "8-bit unsigned integer"},
+    {DFNT_INT16, string(DFNT_INT16), "16-bit signed integer"},
+    {DFNT_UINT16, string(DFNT_UINT16), "16-bit unsigned integer"},
+    {DFNT_INT32, string(DFNT_INT32), "32-bit signed integer"},
+    {DFNT_UINT32, string(DFNT_UINT32), "32-bit unsigned integer"},
+    {DFNT_INT64, string(DFNT_INT64), "64-bit signed integer"},
+    {DFNT_UINT64, string(DFNT_UINT64), "64-bit unsigned integer"},
+    {DFNT_INT128, string(DFNT_INT128), "128-bit signed integer"},
+    {DFNT_UINT128, string(DFNT_UINT128), "128-bit unsigned integer"},
+
+/* Character types */
+    {DFNT_CHAR8, string(DFNT_CHAR8), "8-bit signed char"},
+    {DFNT_UCHAR8, string(DFNT_UCHAR8), "8-bit unsigned char"},
+    {DFNT_CHAR16, string(DFNT_CHAR16), "16-bit signed char"},
+    {DFNT_UCHAR16, string(DFNT_UCHAR16), "16-bit unsigned char"}
+
+};
+
+#endif /* __HKIT_H */
diff --git a/hdf/src/hlimits.h b/hdf/src/hlimits.h
new file mode 100644
index 0000000..f4ce6ba
--- /dev/null
+++ b/hdf/src/hlimits.h
@@ -0,0 +1,288 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hlimits.h 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*+ hlimits.h
+   *** This file contains all hard coded limits for the library
+   *** and reserved vdata/vgroup names and classes. 
+   *** Also pre-defined attribute names are contained in thie file.
+   + */
+
+#ifndef _HLIMITS_H
+#define _HLIMITS_H
+
+#ifndef _WIN32
+#define HDsetvbuf(F,S,M,Z)	setvbuf(F,S,M,Z)
+#endif
+/**************************************************************************
+*  Generally useful macro definitions
+*   (These are copied from hdfi.h and shoudl remain included in both files
+*       because hlimits.h is included from netcdf.h which is used in some
+*       netCDF utilities which don't need or want the rest of the HDF header
+*       files. -QAK - 2/17/99 )
+**************************************************************************/
+#ifndef MIN
+#define MIN(a,b)    (((a)<(b)) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a,b)    (((a)>(b)) ? (a) : (b))
+#endif
+
+/* ------------------------- General Constants hdf.h  --------------------- */
+/* tbuf used as a temporary buffer for small jobs.  The size is
+   preferably > 512 but MUST be > ~256.  It is advised that if an
+   arbitrarily large buffer (> 100 bytes) is require, dynamic space be
+   used.  tbuf lives in the hfile.c */
+
+#ifndef TBUF_SZ
+#   define TBUF_SZ     1024
+#endif
+
+/*  File name max length (old annotations)  */
+#define DF_MAXFNLEN     256
+
+/*
+   * some max lengths for the Vset interface
+   *
+   * Except for FIELDNAMELENMAX, change these as you please, they
+   * affect memory only, not the file.
+   *
+ */
+
+#define FIELDNAMELENMAX    128  /* fieldname   : 128 chars max */
+#define VSFIELDMAX         256  /* max no of fields per vdata */
+#define VSNAMELENMAX        64  /* vdata name  : 64 chars max */
+#define VGNAMELENMAX        64  /* vgroup name : 64 chars max */
+/* Note: VGNAMELENMAX has been removed from library, test, and tools
+   except in mfgr.c and Fortran interface, in favor of dynamic allocation.
+   BMR- 1/28/2010 */
+
+/*
+ * default max no of objects in a vgroup
+ * VGroup will grow dynamically if needed
+ */
+#define MAXNVELT            64
+
+/*
+ * Defaults for linked block operations with Vsets
+ */
+#define VDEFAULTBLKSIZE    4096
+#define VDEFAULTNBLKS        32
+
+/* Max order of a field in a Vdata */
+#define MAX_ORDER          65535
+#define MAX_FIELD_SIZE     65535
+
+
+/* ------------------------- Constants for hfile.c --------------------- */
+/* Maximum number of files (number of slots for file records) */
+#ifndef MAX_FILE
+#   define MAX_FILE   32
+#endif /* MAX_FILE */
+
+/* Maximum length of external filename(s) (used in hextelt.c) */
+#ifndef MAX_PATH_LEN
+#define MAX_PATH_LEN     1024
+#endif /* MAX_PATH_LEN */
+
+/* ndds (number of dd's in a block) default,
+   so user need not specify */
+#ifndef DEF_NDDS
+#   define DEF_NDDS 16
+#endif /* DEF_NDDS */
+
+/* ndds minimum, to prevent excessive overhead of very small dd-blocks */
+#ifndef MIN_NDDS
+#   define MIN_NDDS 4
+#endif /* MIN_NDDS */
+
+/* largest number that will fit into 16-bit word ref variable */
+#define MAX_REF ((uint16)65535)
+
+/* length of block and number of blocks for converting 'appendable' data */
+/* elements into linked blocks (will eventually be replaced by the newer */
+/* variable-length blocks */
+#define HDF_APPENDABLE_BLOCK_LEN 4096
+#define HDF_APPENDABLE_BLOCK_NUM 16
+
+/* hashing information */
+#define HASH_MASK       0xff
+#define HASH_BLOCK_SIZE 100
+
+/* ------------------------- Constants for Vxx interface --------------------- */
+
+/*
+ * Private conversion buffer stuff
+ * VDATA_BUFFER_MAX is the largest buffer that can be allocated for
+ *   writing (haven't implemented reading yet).
+ * Vtbuf is the buffer
+ * Vtbufsize is the buffer size in bytes at any given time.
+ * Vtbuf is increased in size as need be
+ * BUG: the final Vtbuf never gets freed
+ */
+#define VDATA_BUFFER_MAX 1000000
+
+/* --------------------- Constants for DFSDxx interface --------------------- */
+
+#define DFS_MAXLEN 255       /*  Max length of label/unit/format strings */
+#define DFSD_MAXFILL_LEN 16  /* Current max length for fill_value space */
+
+/* ----------------- Constants for COMPRESSION interface --------------------- */
+
+/* Set the following macro to the value the highest compression scheme is */
+#define COMP_MAX_COMP   12
+#define COMP_HEADER_LENGTH  14
+
+/* ----------------- Constants for DGROUP interface --------------------- */
+#define MAX_GROUPS 8
+
+/* ----------------- Constants for HERROR interface --------------------- */
+#define FUNC_NAME_LEN   32
+
+/* error_stack is the error stack.  error_top is the stack top pointer, 
+   and points tothe next available slot on the stack */
+#ifndef ERR_STACK_SZ
+#   define ERR_STACK_SZ 10
+#endif
+
+/* max size of a stored error description */
+#ifndef ERR_STRING_SIZE
+#   define ERR_STRING_SIZE 512
+#endif
+
+/* ----------------- Constants for NETCDF interface(netcdf.h) ---------------- */
+/*
+ * This can be as large as the maximum number of stdio streams
+ * you can have open on your system.
+ */
+#define H4_MAX_NC_OPEN MAX_FILE
+
+/*
+ * These maximums are enforced by the interface, to facilitate writing
+ * applications and utilities.  However, nothing is statically allocated to
+ * these sizes internally.
+ */
+#define H4_MAX_NC_DIMS 5000	 /* max dimensions per file */
+#define H4_MAX_NC_ATTRS 3000	 /* max global or per variable attributes */
+#define H4_MAX_NC_VARS 5000	 /* max variables per file */
+/* This macro changed the behavior of the SDcreate function in HDF4r1.3
+ * SDcreate started to fail if SDS name length was greater than 64, instead of truncating
+ * it to 64 characters and creating a dataset. Switched back to the old definition.
+ * EP 5/5/2000
+#define H4_MAX_NC_NAME MIN(256,MIN(VSNAMELENMAX,VGNAMELENMAX)) */
+
+#define H4_MAX_NC_NAME 256		 /* max length of a name */
+#define H4_MAX_NC_CLASS 128         /* max length of a class name - added this
+        because 128 was used commonly in SD for class name, and this will help
+        changing the class name variable declaration much easier - BMR 4/1/02*/
+#define H4_MAX_VAR_DIMS 32          /* max per variable dimensions */
+
+/* These definitions here are for backward/forward compatibiliy since major
+   constants were modified with H4 prefix to avoid conflicts with the
+   real NetCDF-3 library   - EIP 9/5/07                                     */
+
+#ifdef H4_HAVE_NETCDF
+#define MAX_NC_OPEN  H4_MAX_NC_OPEN
+#define MAX_NC_DIMS  H4_MAX_NC_DIMS
+#define MAX_NC_VARS  H4_MAX_NC_VARS
+#define MAX_NC_NAME  H4_MAX_NC_NAME
+#define MAX_NC_CLASS H4_MAX_NC_CLASS
+#define MAX_VAR_DIMS H4_MAX_VAR_DIMS
+#endif
+
+/* ----------------- Constants for MFGR interface --------------------- */
+#define H4_MAX_GR_NAME 256		 /* max length of a name */
+
+#endif /* _HLIMITS_H */
+
+/* -----------  Reserved classes and names for vdatas/vgroups -----*/
+
+/* The names of the Vgroups created by the GR interface, from mfgr.h */
+#define GR_NAME "RIG0.0"          /* name of the Vgroup containing all the images */
+#define RI_NAME "RI0.0"           /* name of a Vgroup containing information a
+                                     bout one image */
+#define RIGATTRNAME  "RIATTR0.0N" /* name of a Vdata containing an 
+                                     attribute */
+#define RIGATTRCLASS "RIATTR0.0C" /* class of a Vdata containing an 
+                                     attribute */
+/* Vdata and Vgroup attributes use the same class as that of SD attr,
+ *  _HDF_ATTRIBUTE  "Attr0.0"  8/1/96 */
+
+/* classes of the Vdatas/Vgroups created by the SD interface, 
+   from local_nc.h  */
+#define _HDF_ATTRIBUTE         "Attr0.0" 
+        /* class of a Vdata containing SD interface attribute */
+#define _HDF_VARIABLE          "Var0.0"
+        /* class of a Vgroup representing an SD NDG */
+#define _HDF_SDSVAR            "SDSVar"
+        /* class of a Vdata indicating its group is an SDS variable */
+	/* - only after hdf4r2 */
+#define _HDF_CRDVAR          "CoordVar"
+        /* name of a Vdata indicating its group is a coordinate variable */
+	/* - only after hdf4r2 */
+#define _HDF_DIMENSION         "Dim0.0"
+        /* class of a Vgroup representing an SD dimension */
+#define _HDF_UDIMENSION        "UDim0.0"
+        /* class of a Vgroup representing an SD UNLIMITED dimension*/
+#define DIM_VALS          "DimVal0.0"
+        /* class of a Vdata containing an SD dimension size and fake values */
+#define DIM_VALS01        "DimVal0.1"
+             /* class of a Vdata containing an SD dimension size */
+#define _HDF_CDF               "CDF0.0"
+/* DATA is defined in DTM. Change DATA to DATA0 
+  #define DATA              "Data0.0" */
+#define DATA0             "Data0.0"
+#define ATTR_FIELD_NAME   "VALUES"
+
+/* The following vdata class name is reserved by the Chunking interface.
+   originally defined in 'hchunks.h'. The full class name 
+   currently is "_HDF_CHK_TBL_0". -GV 9/25/97
+
+   Made the vdata class name available to other interfaces since it is needed
+   during hmap project. -BMR 11/11/2010 */
+#define _HDF_CHK_TBL_CLASS "_HDF_CHK_TBL_" /* 13 bytes */
+#define _HDF_CHK_TBL_CLASS_VER  0          /* zero version number for class */
+
+/*
+#define NUM_INTERNAL_VGS	6
+char *INTERNAL_HDF_VGS[] = {_HDF_VARIABLE, _HDF_DIMENSION, _HDF_UDIMENSION,
+		 _HDF_CDF, GR_NAME, RI_NAME}; 
+
+#define NUM_INTERNAL_VDS	8
+char *INTERNAL_HDF_VDS[] = {DIM_VALS, DIM_VALS01, _HDF_ATTRIBUTE, _HDF_SDSVAR,
+		 _HDF_CRDVAR, "_HDF_CHK_TBL_", RIGATTRNAME, RIGATTRCLASS};
+
+*/
+/* ------------  pre-defined attribute names ---------------- */
+/* For MFGR interface */
+#define FILL_ATTR    "FillValue"   
+          /* name of an attribute containing the fill value */
+
+/* For SD interface  */
+#define _FillValue      "_FillValue"
+          /* name of an attribute to set fill value for an SDS */
+#define _HDF_LongName "long_name" /* data/dimension label string  */
+#define _HDF_Units    "units"     /* data/dimension unit string   */
+#define _HDF_Format   "format"    /* data/dimension format string */
+#define _HDF_CoordSys "coordsys"  /* data coordsys string         */
+#define _HDF_ValidRange     "valid_range" /* valid range of data values  */
+#define _HDF_ScaleFactor    "scale_factor" /* data calibration factor    */
+#define _HDF_ScaleFactorErr "scale_factor_err" /* data calibration factor error */
+#define _HDF_AddOffset      "add_offset" /* calibration offset           */
+#define _HDF_AddOffsetErr   "add_offset_err" /*  calibration offset error */
+#define _HDF_CalibratedNt   "calibrated_nt"  /* data type of uncalibrated data */
+#define _HDF_ValidMax       "valid_max"
+#define _HDF_ValidMin       "valid_min"
+#define _HDF_Remarks        "remarks"        /* annotation, by DFAN */
+#define _HDF_AnnoLabel      "anno_label"     /* annotation label, by DFAN */
diff --git a/hdf/src/hntdefs.h b/hdf/src/hntdefs.h
new file mode 100644
index 0000000..6dd02d4
--- /dev/null
+++ b/hdf/src/hntdefs.h
@@ -0,0 +1,226 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hntdefs.h 6032 2014-01-17 18:13:52Z acheng $ */
+
+/*+ hnt.h
+   *** This file contains all the number-type definitions for HDF
+   + */
+
+#ifndef _HNT_H
+#define _HNT_H
+
+/* masks for types */
+#define DFNT_HDF      0x00000000    /* standard HDF format  */
+#define DFNT_NATIVE   0x00001000    /* native format        */
+#define DFNT_CUSTOM   0x00002000    /* custom format        */
+#define DFNT_LITEND   0x00004000    /* Little Endian format */
+#define DFNT_MASK     0x00000fff    /* format mask */
+
+/* type info codes */
+
+#define DFNT_NONE        0  /* indicates that number type not set */
+#define DFNT_QUERY       0  /* use this code to find the current type */
+#define DFNT_VERSION     1  /* current version of NT info */
+
+#define DFNT_FLOAT32     5
+#define DFNT_FLOAT       5  /* For backward compat; don't use */
+#define DFNT_FLOAT64     6
+#define DFNT_DOUBLE      6  /* For backward compat; don't use */
+#define DFNT_FLOAT128    7  /* No current plans for support */
+
+#define DFNT_INT8       20
+#define DFNT_UINT8      21
+
+#define DFNT_INT16      22
+#define DFNT_UINT16     23
+#define DFNT_INT32      24
+#define DFNT_UINT32     25
+#define DFNT_INT64      26
+#define DFNT_UINT64     27
+#define DFNT_INT128     28  /* No current plans for support */
+#define DFNT_UINT128    30  /* No current plans for support */
+
+#define DFNT_UCHAR8      3  /* 3 chosen for backward compatibility */
+#define DFNT_UCHAR       3  /* uchar=uchar8 for backward combatibility */
+#define DFNT_CHAR8       4  /* 4 chosen for backward compatibility */
+#define DFNT_CHAR        4  /* char=char8 for backward combatibility */
+#define DFNT_CHAR16     42  /* No current plans for support */
+#define DFNT_UCHAR16    43  /* No current plans for support */
+
+/* Type info codes for Native Mode datasets */
+#define DFNT_NFLOAT32   (DFNT_NATIVE | DFNT_FLOAT32)
+#define DFNT_NFLOAT64   (DFNT_NATIVE | DFNT_FLOAT64)
+#define DFNT_NFLOAT128  (DFNT_NATIVE | DFNT_FLOAT128)   /* Unsupported */
+
+#define DFNT_NINT8      (DFNT_NATIVE | DFNT_INT8)
+#define DFNT_NUINT8     (DFNT_NATIVE | DFNT_UINT8)
+#define DFNT_NINT16     (DFNT_NATIVE | DFNT_INT16)
+#define DFNT_NUINT16    (DFNT_NATIVE | DFNT_UINT16)
+#define DFNT_NINT32     (DFNT_NATIVE | DFNT_INT32)
+#define DFNT_NUINT32    (DFNT_NATIVE | DFNT_UINT32)
+#define DFNT_NINT64     (DFNT_NATIVE | DFNT_INT64)
+#define DFNT_NUINT64    (DFNT_NATIVE | DFNT_UINT64)
+#define DFNT_NINT128    (DFNT_NATIVE | DFNT_INT128)     /* Unsupported */
+#define DFNT_NUINT128   (DFNT_NATIVE | DFNT_UINT128)    /* Unsupported */
+
+#define DFNT_NCHAR8     (DFNT_NATIVE | DFNT_CHAR8)
+#define DFNT_NCHAR      (DFNT_NATIVE | DFNT_CHAR8)  /* backward compat */
+#define DFNT_NUCHAR8    (DFNT_NATIVE | DFNT_UCHAR8)
+#define DFNT_NUCHAR     (DFNT_NATIVE | DFNT_UCHAR8)     /* backward compat */
+#define DFNT_NCHAR16    (DFNT_NATIVE | DFNT_CHAR16)     /* Unsupported */
+#define DFNT_NUCHAR16   (DFNT_NATIVE | DFNT_UCHAR16)    /* Unsupported */
+
+/* Type info codes for Little Endian data */
+#define DFNT_LFLOAT32   (DFNT_LITEND | DFNT_FLOAT32)
+#define DFNT_LFLOAT64   (DFNT_LITEND | DFNT_FLOAT64)
+#define DFNT_LFLOAT128  (DFNT_LITEND | DFNT_FLOAT128)   /* Unsupported */
+
+#define DFNT_LINT8      (DFNT_LITEND | DFNT_INT8)
+#define DFNT_LUINT8     (DFNT_LITEND | DFNT_UINT8)
+#define DFNT_LINT16     (DFNT_LITEND | DFNT_INT16)
+#define DFNT_LUINT16    (DFNT_LITEND | DFNT_UINT16)
+#define DFNT_LINT32     (DFNT_LITEND | DFNT_INT32)
+#define DFNT_LUINT32    (DFNT_LITEND | DFNT_UINT32)
+#define DFNT_LINT64     (DFNT_LITEND | DFNT_INT64)
+#define DFNT_LUINT64    (DFNT_LITEND | DFNT_UINT64)
+#define DFNT_LINT128    (DFNT_LITEND | DFNT_INT128)     /* Unsupported */
+#define DFNT_LUINT128   (DFNT_LITEND | DFNT_UINT128)    /* Unsupported */
+
+#define DFNT_LCHAR8     (DFNT_LITEND | DFNT_CHAR8)
+#define DFNT_LCHAR      (DFNT_LITEND | DFNT_CHAR8)  /* backward compat */
+#define DFNT_LUCHAR8    (DFNT_LITEND | DFNT_UCHAR8)
+#define DFNT_LUCHAR     (DFNT_LITEND | DFNT_UCHAR8)     /* backward compat */
+#define DFNT_LCHAR16    (DFNT_LITEND | DFNT_CHAR16)     /* Unsupported */
+#define DFNT_LUCHAR16   (DFNT_LITEND | DFNT_UCHAR16)    /* Unsupported */
+
+/* class info codes for int */
+#define        DFNTI_MBO       1    /* Motorola byte order 2's compl */
+#define        DFNTI_VBO       2    /* Vax byte order 2's compl */
+#define        DFNTI_IBO       4    /* Intel byte order 2's compl */
+
+/* class info codes for float */
+#define        DFNTF_NONE      0    /* indicates subclass is not set */
+#define        DFNTF_HDFDEFAULT 1   /* hdf default float format is ieee */
+#define        DFNTF_IEEE      1    /* IEEE format */
+#define        DFNTF_VAX       2    /* Vax format */
+#define        DFNTF_CRAY      3    /* Cray format */
+#define        DFNTF_PC        4    /* PC floats - flipped IEEE */
+#define        DFNTF_CONVEX    5    /* CONVEX native format */
+#define        DFNTF_VP        6    /* Fujitsu VP native format */
+
+/* class info codes for char */
+#define        DFNTC_BYTE      0    /* bitwise/numeric field */
+#define        DFNTC_ASCII     1    /* ASCII */
+#define        DFNTC_EBCDIC    5    /* EBCDIC */
+
+/* array order */
+#define        DFO_FORTRAN     1    /* column major order */
+#define        DFO_C           2    /* row major order */
+
+/*******************************************************************/
+/* Sizes of number types                                            */
+/*******************************************************************/
+
+/* first the standard sizes of number types */
+
+#    define SIZE_FLOAT32    4
+#    define SIZE_FLOAT64    8
+#    define SIZE_FLOAT128  16   /* No current plans for support */
+
+#    define SIZE_INT8       1
+#    define SIZE_UINT8      1
+#    define SIZE_INT16      2
+#    define SIZE_UINT16     2
+#    define SIZE_INT32      4
+#    define SIZE_UINT32     4
+#    define SIZE_INT64      8
+#    define SIZE_UINT64     8
+#    define SIZE_INT128    16   /* No current plans for support */
+#    define SIZE_UINT128   16   /* No current plans for support */
+
+#    define SIZE_CHAR8      1
+#    define SIZE_CHAR       1   /* For backward compat char8 == char */
+#    define SIZE_UCHAR8     1
+#    define SIZE_UCHAR      1   /* For backward compat uchar8 == uchar */
+#    define SIZE_CHAR16     2   /* No current plans for support */
+#    define SIZE_UCHAR16    2   /* No current plans for support */
+
+/* then the native sizes of number types */
+
+/* Unusual number sizes */
+/* IA64 (IA64) native number sizes:
+	Char = 8 bits, signed
+	Short=16 int=32 long=64 float=32 double=64 bits
+	Long double=64 bits
+	Char pointers = 64 bits
+	Int pointers = 64 bits
+	Little endian, IEEE floating point
+*/
+
+#    define SIZE_NFLOAT32    4
+#    define SIZE_NFLOAT64    8
+#    define SIZE_NFLOAT128  16  /* No current plans for support */
+
+#    define SIZE_NINT8       1
+#    define SIZE_NUINT8      1
+#    define SIZE_NINT16      2
+#    define SIZE_NUINT16     2
+#    define SIZE_NINT32      4
+#    define SIZE_NUINT32     4
+#    define SIZE_NINT64      8
+#    define SIZE_NUINT64     8
+#    define SIZE_NINT128    16  /* No current plans for support */
+#    define SIZE_NUINT128   16  /* No current plans for support */
+
+#    define SIZE_NCHAR8      1
+#    define SIZE_NCHAR       1  /* For backward compat char8 == char */
+#    define SIZE_NUCHAR8     1
+#    define SIZE_NUCHAR      1  /* For backward compat uchar8 == uchar */
+#    define SIZE_NCHAR16     2  /* No current plans for support */
+#    define SIZE_NUCHAR16    2  /* No current plans for support */
+
+/* then the sizes of little-endian number types */
+#    define SIZE_LFLOAT32    4
+#    define SIZE_LFLOAT64    8
+#    define SIZE_LFLOAT128  16  /* No current plans for support */
+
+#    define SIZE_LINT8       1
+#    define SIZE_LUINT8      1
+#    define SIZE_LINT16      2
+#    define SIZE_LUINT16     2
+#    define SIZE_LINT32      4
+#    define SIZE_LUINT32     4
+#    define SIZE_LINT64      8
+#    define SIZE_LUINT64     8
+#    define SIZE_LINT128    16  /* No current plans for support */
+#    define SIZE_LUINT128   16  /* No current plans for support */
+
+#    define SIZE_LCHAR8      1
+#    define SIZE_LCHAR       1  /* For backward compat char8 == char */
+#    define SIZE_LUCHAR8     1
+#    define SIZE_LUCHAR      1  /* For backward compat uchar8 == uchar */
+#    define SIZE_LCHAR16     2  /* No current plans for support */
+#    define SIZE_LUCHAR16    2  /* No current plans for support */
+
+    /* sizes of different number types */
+#       define MACHINE_I8_SIZE     1
+#       define MACHINE_I16_SIZE    2
+#       define MACHINE_I32_SIZE    4
+#       define MACHINE_F32_SIZE    4
+#       define MACHINE_F64_SIZE    8
+
+    /* maximum size of the atomic data types */
+#       define MAX_NT_SIZE      16
+#endif /* _HNT_H */
+
diff --git a/hdf/src/hproto.h b/hdf/src/hproto.h
new file mode 100644
index 0000000..54c7424
--- /dev/null
+++ b/hdf/src/hproto.h
@@ -0,0 +1,1971 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hproto.h 6043 2014-01-21 21:09:03Z acheng $ */
+
+#ifndef _H_PROTO
+#define _H_PROTO
+
+#include "H4api_adpt.h"
+
+/* Usefull macros, which someday might become actual functions */
+/* Wrappers for Hinquire. feb-2-92 */
+#define HQueryfileid(aid, fileid)     \
+  (Hinquire ((int32)   aid,  (int32*) fileid, (uint16*) NULL,\
+             (uint16*) NULL, (int32*) NULL,   (int32*)  NULL,\
+             (int32*)  NULL, (int16*) NULL,   (int16*)  NULL))
+
+#define HQuerytagref(aid, tag, ref) \
+  (Hinquire ((int32)   aid,  (int32*) NULL,   (uint16*) tag,\
+             (uint16*) ref,  (int32*) NULL,   (int32*)  NULL,\
+             (int32*)  NULL, (int16*) NULL,   (int16*)  NULL))
+
+#define HQuerylength(aid, length)     \
+  (Hinquire ((int32)    aid, (int32*) NULL, (uint16*) NULL,   \
+             (uint16*) NULL, (int32*) length,   (int32*)  NULL,   \
+             (int32*)  NULL, (int16*) NULL, (int16*)  NULL))
+
+#define HQueryoffset(aid, offset)     \
+  (Hinquire ((int32)    aid, (int32*) NULL, (uint16*) NULL,   \
+             (uint16*) NULL, (int32*) NULL,     (int32*)  offset, \
+             (int32*)  NULL, (int16*) NULL,     (int16*)  NULL))
+
+#define HQueryposition(aid, position) \
+  (Hinquire ((int32)    aid, (int32*) NULL, (uint16*) NULL,   \
+             (uint16*) NULL, (int32*) NULL, (int32*)  NULL,   \
+             (int32*) position, (int16*) NULL,  (int16*)  NULL))
+
+#define HQueryaccess(aid, access)     \
+  (Hinquire ((int32)    aid,    (int32*) NULL,   (uint16*) NULL,  \
+             (uint16*) NULL,    (int32*) NULL,   (int32*)  NULL,  \
+             (int32*)   NULL,   (int16*) access, (int16*)  NULL))
+
+#define HQueryspecial(aid, special) \
+  (Hinquire ((int32)    aid,    (int32*) NULL,  (uint16*) NULL,   \
+             (uint16*) NULL,    (int32*) NULL,  (int32*)  NULL,   \
+             (int32*)   NULL,   (int16*) NULL,  (int16*)  special))
+
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+   ** from hfile.c
+ */
+    HDFLIBAPI int32 Hopen
+                (const char *path, intn acc_mode, int16 ndds);
+
+    HDFLIBAPI intn Hclose
+                (int32 file_id);
+
+    HDFLIBAPI int32 Hstartread
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    HDFLIBAPI intn Hnextread
+                (int32 access_id, uint16 tag, uint16 ref, intn origin);
+
+    HDFLIBAPI intn Hexist
+                (int32 file_id, uint16 search_tag, uint16 search_ref);
+
+    HDFLIBAPI intn Hinquire
+                (int32 access_id, int32 * pfile_id, uint16 * ptag,
+          uint16 * pref, int32 * plength, int32 * poffset,
+        int32 * pposn, int16 * paccess, int16 * pspecial);
+
+    HDFLIBAPI int32 Hstartwrite
+                (int32 file_id, uint16 tag, uint16 ref, int32 length);
+
+    HDFLIBAPI int32 Hstartaccess
+                (int32 file_id, uint16 tag, uint16 ref, uint32 flags);
+
+    HDFLIBAPI intn Hsetlength
+                (int32 file_id, int32 length);
+
+    HDFLIBAPI intn Happendable
+                (int32 aid);
+
+    HDFLIBAPI intn HPisappendable
+                (int32 aid);
+
+    HDFLIBAPI intn HPregister_term_func
+                (hdf_termfunc_t term_func);
+
+    HDFLIBAPI intn Hseek
+                (int32 access_id, int32 offset, intn origin);
+
+    HDFLIBAPI int32 Htell
+                (int32 access_id);
+
+    HDFLIBAPI int32 Hread
+                (int32 access_id, int32 length, void * data);
+
+    HDFLIBAPI int32 Hwrite
+                (int32 access_id, int32 length, const void * data);
+
+    HDFLIBAPI int32 Htrunc
+                (int32 access_id, int32 trunc_len);
+
+    HDFLIBAPI intn Hendaccess
+                (int32 access_id);
+
+    HDFLIBAPI intn HDgetc
+                (int32 access_id);
+
+    HDFLIBAPI intn HDputc
+                (uint8 c, int32 access_id);
+
+    HDFLIBAPI int32 Hgetelement
+                (int32 file_id, uint16 tag, uint16 ref, uint8 * data);
+
+    HDFLIBAPI int32 Hputelement
+                (int32 file_id, uint16 tag, uint16 ref, const uint8 * data, int32 length);
+
+    HDFLIBAPI int32 Hlength
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    HDFLIBAPI int32 Hoffset
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    HDFLIBAPI intn Hsync
+                (int32 file_id);
+
+    HDFLIBAPI intn Hcache
+                (int32 file_id, intn cache_on);
+
+    HDFLIBAPI intn Hgetlibversion
+                (uint32 * majorv, uint32 * minorv,
+                 uint32 * releasev, char * string);
+
+    HDFLIBAPI intn Hgetfileversion
+                (int32 file_id, uint32 * majorv, uint32 * minorv,
+                 uint32 * release, char * string);
+
+    HDFLIBAPI intn Hsetaccesstype(int32 access_id, uintn accesstype);
+
+    HDFLIBAPI uint16 HDmake_special_tag
+                (uint16 tag);
+
+    HDFLIBAPI intn HDis_special_tag
+                (uint16 tag);
+
+    HDFLIBAPI uint16 HDbase_tag
+                (uint16 tag);
+
+    HDFLIBAPI int  HDerr
+                (int32 file_id);
+
+    HDFLIBAPI intn HDvalidfid
+                (int32 file_id);
+
+    HDFLIBAPI const char *HDgettagdesc
+                (uint16 tag);
+
+    HDFLIBAPI char *HDgettagsname
+                (uint16 tag);
+
+    HDFLIBAPI intn HDgettagnum
+                (const char *tag_name);
+
+    HDFLIBAPI char *HDgetNTdesc
+                (int32 nt);
+
+    HDFLIBAPI const char *HDfidtoname
+                (int32 fid);
+
+    HDFLIBAPI intn Hgetntinfo
+                (int32 numbertype, hdf_ntinfo_t *nt_info);
+
+    HDFLIBAPI intn Hishdf
+                (const char * filename);
+
+    HDFLIBAPI intn Hfidinquire
+                (int32 file_id, char ** fname, intn * acc_mode,
+                 intn * attach);
+    
+    HDFLIBAPI intn Hshutdown(void);
+
+    HDFLIBAPI void HPend(void);
+
+    HDFLIBAPI intn HDdont_atexit(void);
+
+/*
+   ** from hfiledd.c
+ */
+/******************************************************************************
+ NAME
+     Hdupdd - Duplicate a data descriptor
+
+ DESCRIPTION
+    Duplicates a data descriptor so that the new tag/ref points to the
+    same data element pointed to by the old tag/ref.  Return FAIL if
+    the given tag/ref are already in use.
+
+ RETURNS
+    returns SUCCEED (0) if successful, FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI intn Hdupdd(int32 file_id,      /* IN: File ID the tag/refs are in */
+        uint16 tag,             /* IN: Tag of new tag/ref */
+        uint16 ref,             /* IN: Ref of new tag/ref */
+        uint16 old_tag,         /* IN: Tag of old tag/ref */
+        uint16 old_ref          /* IN: Ref of old tag/ref */
+);
+
+/******************************************************************************
+ NAME
+     Hnumber - Determine the number of objects of a given type
+
+ DESCRIPTION
+    Determine how many objects of the given tag are in the file.
+    tag may be set to DFTAG_WILDCARD to get back the total number
+    of objects in the file.
+
+    Note, a return value of zero is not a fail condition.
+
+ RETURNS
+    the number of objects of type 'tag' else FAIL
+
+*******************************************************************************/
+HDFLIBAPI int32 Hnumber(int32 file_id,    /* IN: File ID the tag/refs are in */
+        uint16 tag              /* IN: Tag to count */
+);
+
+/******************************************************************************
+ NAME
+     Hnewref - Returns a ref that is guaranteed to be unique in the file
+
+ DESCRIPTION
+    Returns a ref number that can be used with any tag to produce a
+    unique tag/ref.  Successive calls to Hnewref will generate a
+    strictly increasing sequence until the highest possible ref had been
+    returned, then Hnewref will return unused ref's starting from 1.
+
+ RETURNS
+    returns the ref number, 0 otherwise
+
+*******************************************************************************/
+HDFLIBAPI uint16 Hnewref(int32 file_id        /* IN: File ID the tag/refs are in */
+);
+
+/******************************************************************************
+ NAME
+    Htagnewref  - returns a ref that is unique in the file for a given tag
+
+ DESCRIPTION
+    Returns a ref number that can be used with any tag to produce a
+    unique tag/ref.  Successive calls to Hnewref will generate a
+    strictly increasing sequence until the highest possible ref had been
+    returned, then Hnewref will return unused ref's starting from 1.
+
+ RETURNS
+    returns the ref number, 0 otherwise
+
+*******************************************************************************/
+HDFLIBAPI uint16 Htagnewref(int32 file_id,    /* IN: File ID the tag/refs are in */
+        uint16 tag                  /* IN: Tag to search for a new ref for */
+);
+
+/******************************************************************************
+ NAME
+    Hfind - locate the next object of a search in an HDF file
+
+ DESCRIPTION
+    Searches for the `next' DD that fits the search tag/ref.  Wildcards
+    apply.  If origin is DF_FORWARD, search from current position forwards
+    in the file, otherwise DF_BACKWARD searches backward from the current
+    position in the file.  If *find_tag and *find_ref are both set to
+    0, this indicates the beginning of a search, and the search will
+    start from the beginning of the file if the direction is DF_FORWARD
+    and from the and of the file if the direction is DF_BACKWARD.
+
+ RETURNS
+    returns SUCCEED (0) if successful and FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI intn Hfind(int32 file_id,       /* IN: file ID to search in */
+        uint16 search_tag,      /* IN: the tag to search for (can be DFTAG_WILDCARD) */
+        uint16 search_ref,      /* IN: ref to search for (can be DFREF_WILDCARD) */
+        uint16 *find_tag,       /* IN: if (*find_tag==0) and (*find_ref==0) then start search */
+                                /* OUT: tag matching the search tag */
+        uint16 *find_ref,       /* IN: if (*find_tag==0) and (*find_ref==0) then start search */
+                                /* OUT: ref matching the search ref */
+        int32 *find_offset,     /* OUT: offset of the data element found */
+        int32 *find_length,     /* OUT: length of the data element found */
+        intn direction          /* IN: Direction to search in: */
+                                /*  DF_FORWARD searches forward from the current location */
+                                /*  DF_BACKWARD searches backward from the current location */
+);
+
+
+/******************************************************************************
+ NAME
+     HDcheck_tagref - Checks to see if tag/ref is in DD list i.e. created already
+
+ DESCRIPTION
+     Routine checks to see if tag/ref exists in the DD list i.e. has
+     been created.
+
+ RETURNS
+     0-> tag/ref does not exist
+     1-> tag/ref exists
+    -1-> function failed
+
+*******************************************************************************/
+HDFLIBAPI intn 
+HDcheck_tagref(int32  file_id, /* IN: id of file */
+               uint16 tag,     /* IN: Tag to check */
+               uint16 ref      /* IN: ref to check */);
+
+/************************************************************************
+NAME
+   HDreuse_tagref -- reuse a data descriptor preserving tag/ref
+
+DESCRIPTION
+   Reuses the data descriptor of tag/ref in the dd list of the file.
+   The tag/ref must already exist in the DD list.
+   This routine is unsafe and may leave a file in a condition that is
+   not usable by some routines.  Use with care. Not valid for
+   special elments right now. Used for allowing the data to change
+   and move somewhere else in the file for non-special elements.
+   Must be carefully if apply to higher-level objects like GR's and SDS
+   that are comprised of other objects. 
+   Usefull when re-writing simple elements whose size changes while
+   preserving the original tag/ref of the element since other elements
+   might refer to this element by tag/ref e.g. in a Vgroup.
+
+RETURNS
+   returns SUCCEED (0) if successful, FAIL (-1) otherwise
+************************************************************************/
+HDFLIBAPI intn 
+HDreuse_tagref(int32 file_id, /* IN: id of file */
+               uint16 tag,    /* IN: tag of data descriptor to reuse */
+               uint16 ref     /* IN: ref of data descriptor to reuse */ );
+
+/******************************************************************************
+ NAME
+     Hdeldd - Delete a data descriptor
+
+ DESCRIPTION
+    Deletes a data descriptor of tag/ref from the dd list of the file.
+    This routine is unsafe and may leave a file in a condition that is
+    not usable by some routines.  Use with care.
+    For example, if this element is contained in a Vgroup, that group
+    will *NOT* get updated to reflect that this element has been deleted.
+
+ RETURNS
+    returns SUCCEED (0) if successful, FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI intn Hdeldd(int32 file_id,      /* IN: File ID the tag/refs are in */
+        uint16 tag,             /* IN: Tag of tag/ref to delete */
+        uint16 ref              /* IN: Ref of tag/ref to delete */
+);
+
+/*
+   ** from hdfalloc.c
+ */
+
+    HDFLIBAPI void * HDmemfill
+                (void * dest, const void * src, uint32 item_size, uint32 num_items);
+
+    HDFLIBAPI char *HIstrncpy
+                (char * dest, const char * source, intn len);
+
+    HDFLIBAPI int32 HDspaceleft
+                (void);
+
+#if defined(MALLOC_CHECK)
+    HDFPUBLIC extern void * HDmalloc
+                (uint32 qty);
+
+    HDFPUBLIC extern void * HDrealloc
+                (void * where, uint32 qty);
+
+    HDFPUBLIC extern void * HDcalloc
+                (uint32 n, uint32 size);
+
+    HDFPUBLIC extern void HDfree
+                (void * ptr);
+
+#endif /* defined MALLOC_CHECK */
+
+#if defined IBM6000 || defined SUN
+    HDFPUBLIC extern char *HDstrdup
+                (const char *s);
+
+#endif
+
+    HDFLIBAPI intn HDc2fstr
+                (char * str, intn len);
+
+    HDFLIBAPI char *HDf2cstring
+                (_fcd fdesc, intn len);
+
+    HDFLIBAPI intn HDflush
+                (int32 file_id);
+
+    HDFLIBAPI intn HDpackFstring
+                (char * src, char * dest, intn len);
+
+/*
+   ** from hblocks.c
+ */
+    HDFLIBAPI int32 HLcreate
+                (int32 file_id, uint16 tag, uint16 ref, int32 block_length,
+                 int32 number_blocks);
+
+    HDFLIBAPI intn HLconvert
+                (int32 aid, int32 block_length, int32 number_blocks);
+
+    HDFLIBAPI int  HDinqblockinfo
+                (int32 aid, int32 *length, int32 *first_length, int32 *block_length,
+                 int32 *number_blocks);
+
+    HDFLIBAPI intn HLsetblockinfo
+                (int32 aid, int32 block_size, int32 num_blocks);
+
+    HDFLIBAPI intn HLgetblockinfo
+                (int32 aid, int32* block_size, int32* num_blocks);
+
+    HDFLIBAPI intn HLgetdatainfo
+		(int32 file_id, uint8 *buf, uintn start_block,
+		 uintn info_count, int32 *offsetarray, int32 *lengtharray);
+
+
+/*
+   ** from hextelt.c
+ */
+    HDFLIBAPI int32 HXcreate
+                (int32 file_id, uint16 tag, uint16 ref, const char * extern_file_name,
+                 int32 offset, int32 start_len);
+
+    HDFLIBAPI intn HXsetcreatedir
+                (const char *dir);
+
+    HDFLIBAPI intn HXsetdir
+                (const char *dir);
+
+/*
+   ** from hcomp.c
+ */
+    HDFLIBAPI int32 HCcreate
+                (int32 file_id, uint16 tag, uint16 ref,
+                 comp_model_t model_type, model_info * m_info,
+                 comp_coder_t coder_type, comp_info * c_info);
+
+    HDFLIBAPI intn HCPgetcompress
+                (int32 file_id, uint16 data_tag, uint16 data_ref, 
+		 comp_coder_t *coder_type, comp_info * c_info);
+
+    HDFLIBAPI intn HCPgetcompinfo
+                (int32 file_id, uint16 data_tag, uint16 data_ref, 
+		 comp_coder_t *coder_type, comp_info * c_info);
+
+    HDFLIBAPI intn HCPgetcomptype
+                (int32 file_id, uint16 data_tag, uint16 data_ref, 
+		 comp_coder_t *coder_type);
+
+    HDFLIBAPI intn HCPgetdatasize
+                (int32 file_id, uint16 data_tag, uint16 data_ref, 
+		 int32* comp_size, int32* orig_size);
+
+    HDFPUBLIC intn HCget_config_info ( comp_coder_t coder_type, uint32 *compression_config_info);
+
+    HDFLIBAPI int32 HCPquery_encode_header(comp_model_t model_type, model_info * m_info,
+             comp_coder_t coder_type, comp_info * c_info);
+
+    HDFLIBAPI intn HCPencode_header(uint8 *p, comp_model_t model_type, model_info * m_info,
+             comp_coder_t coder_type, comp_info * c_info);
+
+    HDFLIBAPI intn HCPdecode_header(uint8 *p, comp_model_t *model_type, model_info * m_info,
+             comp_coder_t *coder_type, comp_info * c_info);
+
+/*
+   ** from cszip.c
+ */
+
+     HDFLIBAPI intn HCPsetup_szip_parms ( comp_info *c_info, int32 nt, int32 ncomp, int32 ndims, int32 *dims, int32 *cdims);
+/*
+   ** from hbuffer.c
+ */
+    HDFLIBAPI intn HBconvert
+                (int32 aid);
+
+/*
+   ** from hcompri.c
+ */
+    HDFLIBAPI int32 HRPconvert
+                (int32 fid, uint16 tag, uint16 ref, int32 xdim, int32 ydim,int16 scheme, comp_info *cinfo, uintn pixel_size);
+
+
+/*
+   ** from herr.c
+ */
+    HDFLIBAPI const char *HEstring
+                (hdf_err_code_t error_code);
+
+    HDFLIBAPI void HEpush
+                (hdf_err_code_t error_code, const char * function_name,
+                 const char * file_name, intn line);
+
+    HDFLIBAPI void HEreport
+                (const char *,...);
+
+    HDFLIBAPI void HEprint
+                (FILE * stream, int32 print_level);
+
+    HDFLIBAPI int16 HEvalue
+                (int32 level);
+
+    HDFLIBAPI void HEPclear
+                (void);
+
+ 	HDFLIBAPI intn HEshutdown(void);
+
+/*
+   ** from hbitio.c
+ */
+    HDFLIBAPI int32 Hstartbitread
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    HDFLIBAPI int32 Hstartbitwrite
+                (int32 file_id, uint16 tag, uint16 ref, int32 length);
+
+    HDFLIBAPI intn Hbitappendable
+                (int32 bitid);
+
+    HDFLIBAPI intn Hbitwrite
+                (int32 bitid, intn count, uint32 data);
+
+    HDFLIBAPI intn Hbitread
+                (int32 bitid, intn count, uint32 *data);
+
+    HDFLIBAPI intn Hbitseek
+                (int32 bitid, int32 byte_offset, intn bit_offset);
+
+    HDFLIBAPI intn Hgetbit
+                (int32 bitid);
+
+    HDFLIBAPI int32 Hendbitaccess
+                (int32 bitfile_id, intn flushbit);
+
+    HDFLIBAPI intn HPbitshutdown(void);
+
+/*
+ ** from dfutil.c
+ */
+    HDFLIBAPI uint16 DFfindnextref
+                (int32 file_id, uint16 tag, uint16 lref);
+
+/*
+   ** from dfcomp.c
+ */
+    HDFLIBAPI intn DFputcomp
+                (int32 file_id, uint16 tag, uint16 ref, const uint8 * image,
+        int32 xdim, int32 ydim, uint8 * palette, uint8 * newpal,
+                 int16 scheme, comp_info * cinfo);
+
+    HDFLIBAPI int  DFgetcomp
+                (int32 file_id, uint16 tag, uint16 ref, uint8 * image,
+                 int32 xdim, int32 ydim, uint16 scheme);
+
+/*
+   ** from dfrle.c
+ */
+    HDFLIBAPI int32 DFCIrle
+                (const void * buf, void * bufto, int32 len);
+
+    HDFLIBAPI int32 DFCIunrle
+                (uint8 * buf, uint8 *bufto, int32 outlen, int resetsave);
+
+/*
+   ** from dfimcomp.c
+ */
+    HDFLIBAPI void DFCIimcomp
+                (int32 xdim, int32 ydim, const uint8 *in, uint8 out[],
+                 uint8 in_pal[], uint8 out_pal[], int mode);
+
+    HDFLIBAPI void DFCIunimcomp
+                (int32 xdim, int32 ydim, uint8 in[], uint8 out[]);
+
+/*
+   ** from dfjpeg.c
+ */
+
+    HDFLIBAPI intn DFCIjpeg
+                (int32 file_id, uint16 tag, uint16 ref, int32 xdim, int32 ydim,
+                 const void * image, int16 scheme, comp_info * scheme_info);
+
+/*
+   ** from dfunjpeg.c
+ */
+
+    HDFLIBAPI intn DFCIunjpeg
+                (int32 file_id, uint16 tag, uint16 ref, void * image, int32 xdim,
+                 int32 ydim, int16 scheme);
+
+/*
+   ** from dfgroup.c
+ */
+    HDFLIBAPI int32 DFdiread
+                (int32 file_id, uint16 tag, uint16 ref);
+
+    HDFLIBAPI intn DFdiget
+                (int32 list, uint16 * ptag, uint16 * pref);
+
+    HDFLIBAPI intn DFdinobj
+                (int32 list);
+
+    HDFLIBAPI int32 DFdisetup
+                (int maxsize);
+
+    HDFLIBAPI intn DFdiput
+                (int32 list, uint16 tag, uint16 ref);
+
+    HDFLIBAPI intn DFdiwrite
+                (int32 file_id, int32 list, uint16 tag, uint16 ref);
+                
+    HDFLIBAPI void DFdifree
+    			(int32 groupID);
+
+/*
+   ** from dfp.c
+ */
+    HDFLIBAPI intn DFPgetpal
+                (const char * filename, void * palette);
+
+    HDFLIBAPI intn DFPputpal
+                (const char * filename, const void * palette, intn overwrite, const char * filemode);
+
+    HDFLIBAPI intn DFPaddpal
+                (const char * filename, const void * palette);
+
+    HDFLIBAPI intn DFPnpals
+                (const char * filename);
+
+    HDFLIBAPI intn DFPreadref
+                (const char * filename, uint16 ref);
+
+    HDFLIBAPI intn DFPwriteref
+                (const char * filename, uint16 ref);
+
+    HDFLIBAPI intn DFPrestart
+                (void);
+
+    HDFLIBAPI uint16 DFPlastref
+                (void);
+
+/*
+   ** from dfr8.c
+ */
+    HDFLIBAPI int  DFR8setcompress
+                (int32 scheme, comp_info * cinfo);
+
+    HDFLIBAPI intn DFR8getdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 int * pispal);
+
+    HDFLIBAPI intn DFR8getimage
+                (const char * filename, uint8 * image, int32 xdim, int32 ydim,
+                 uint8 * pal);
+
+    HDFLIBAPI intn DFR8setpalette
+                (uint8 * pal);
+
+    HDFLIBAPI intn DFR8putimage
+                (const char * filename, const void * image, int32 xdim, int32 ydim, uint16 compress);
+
+    HDFLIBAPI intn DFR8addimage
+                (const char * filename, const void * image, int32 xdim, int32 ydim, uint16 compress);
+
+    HDFLIBAPI intn DFR8nimages
+                (const char * filename);
+
+    HDFLIBAPI intn DFR8readref
+                (const char * filename, uint16 ref);
+
+    HDFLIBAPI intn DFR8writeref
+                (const char * filename, uint16 ref);
+
+    HDFLIBAPI intn DFR8restart
+                (void);
+
+    HDFLIBAPI uint16 DFR8lastref
+                (void);
+
+    HDFLIBAPI intn DFR8getpalref(uint16 *pal_ref);
+
+    HDFLIBAPI intn DFR8Pshutdown(void);
+
+/*
+   ** from dfgr.c
+ */
+    HDFLIBAPI intn DFGRgetlutdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pncomps, intn * pil);
+
+    HDFLIBAPI intn DFGRreqlutil
+                (intn il);
+
+    HDFLIBAPI intn DFGRgetlut
+                (const char * filename, void * lut, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DFGRgetimdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pncomps, intn * pil);
+
+    HDFLIBAPI intn DFGRreqimil
+                (intn il);
+
+    HDFLIBAPI intn DFGRgetimage
+                (const char * filename, void * image, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DFGRsetcompress
+                (int32 scheme, comp_info * cinfo);
+
+    HDFLIBAPI intn DFGRsetlutdims
+                (int32 xdim, int32 ydim, intn ncomps, intn il);
+
+    HDFLIBAPI intn DFGRsetlut
+                (void * lut, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DFGRaddlut
+                (const char * filename, void * lut, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DFGRsetimdims
+                (int32 xdim, int32 ydim, intn ncomps, intn il);
+
+    HDFLIBAPI intn DFGRaddimage
+                (const char * filename, void * image, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DFGRputimage
+                (const char * filename, void * image, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DFGRreadref
+                (const char * filename, uint16 ref);
+
+    HDFLIBAPI uint16 DFGRIlastref
+                (void);
+
+    HDFLIBAPI intn DFGRIgetdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pncomps, intn * pil, intn type);
+
+    HDFLIBAPI intn DFGRIreqil
+                (intn il, intn type);
+
+    HDFLIBAPI intn DFGRIgetimlut
+                (const char * filename, void * imlut, int32 xdim, int32 ydim, intn type,
+                 intn isfortran, int *compressed, uint16 *compr_type, int *has_pal);
+
+    HDFLIBAPI intn DFGRIsetdims
+                (int32 xdim, int32 ydim, intn ncomps, intn type);
+
+    HDFLIBAPI intn DFGRIsetil
+                (intn il, intn type);
+
+    HDFLIBAPI intn DFGRIrestart
+                (void);
+
+    HDFLIBAPI intn DFGRIaddimlut
+                (const char * filename, const void * imlut, int32 xdim, int32 ydim, intn type,
+                 intn isfortran, intn newfile);
+
+    HDFLIBAPI intn DFGRPshutdown(void);
+
+/*
+   ** from df24.c
+ */
+    HDFLIBAPI intn DF24getdims
+                (const char * filename, int32 * pxdim, int32 * pydim,
+                 intn * pil);
+
+    HDFLIBAPI intn DF24reqil
+                (intn il);
+
+    HDFLIBAPI intn DF24getimage
+                (const char * filename, void * image, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DF24setdims
+                (int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DF24setil
+                (intn il);
+
+    HDFLIBAPI intn DF24setcompress
+                (int32 type, comp_info * cinfo);
+
+    HDFLIBAPI intn DF24restart
+                (void);
+
+    HDFLIBAPI intn DF24addimage
+                (const char * filename, const void * image, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DF24putimage
+                (const char * filename, const void * image, int32 xdim, int32 ydim);
+
+    HDFLIBAPI intn DF24nimages
+                (const char * filename);
+
+    HDFLIBAPI intn DF24readref
+                (const char * filename, uint16 ref);
+
+    HDFLIBAPI uint16 DF24lastref
+                (void);
+
+/*
+   ** from dfan.c
+ */
+
+    HDFLIBAPI int32 DFANgetlablen
+                (const char * filename, uint16 tag, uint16 ref);
+
+    HDFLIBAPI intn DFANgetlabel
+                (const char * filename, uint16 tag, uint16 ref, char * label,
+                 int32 maxlen);
+
+    HDFLIBAPI int32 DFANgetdesclen
+                (const char * filename, uint16 tag, uint16 ref);
+
+    HDFLIBAPI intn DFANgetdesc
+                (const char * filename, uint16 tag, uint16 ref, char * desc,
+                 int32 maxlen);
+
+    HDFLIBAPI int32 DFANgetfidlen
+                (int32 file_id, intn isfirst);
+
+    HDFLIBAPI int32 DFANgetfid
+                (int32 file_id, char * id, int32 maxlen, intn isfirst);
+
+    HDFLIBAPI int32 DFANgetfdslen
+                (int32 file_id, intn isfirst);
+
+    HDFLIBAPI int32 DFANgetfds
+                (int32 file_id, char * desc, int32 maxlen, intn isfirst);
+
+    HDFLIBAPI intn DFANputlabel
+                (const char * filename, uint16 tag, uint16 ref, char * label);
+
+    HDFLIBAPI intn DFANputdesc
+                (const char * filename, uint16 tag, uint16 ref, char * desc,
+                 int32 desclen);
+
+    HDFLIBAPI intn DFANaddfid
+                (int32 file_id, char * id);
+
+    HDFLIBAPI intn DFANaddfds
+                (int32 file_id, char * desc, int32 desclen);
+
+    HDFLIBAPI uint16 DFANlastref
+                (void);
+
+    HDFLIBAPI intn DFANlablist
+                (const char * filename, uint16 tag, uint16 reflist[],
+         char * labellist, intn listsize, intn maxlen, intn startpos);
+
+    HDFLIBAPI intn DFANclear
+                (void);
+
+    HDFLIBAPI intn DFANIclear
+                (void);
+
+    HDFLIBAPI uint16 DFANIlocate
+                (int32 file_id, int type, uint16 tag, uint16 ref);
+
+    HDFLIBAPI int  DFANIaddentry
+                (int type, uint16 annref, uint16 datatag, uint16 dataref);
+
+    HDFLIBAPI int32 DFANIgetannlen
+                (const char * filename, uint16 tag, uint16 ref, int type);
+
+    HDFLIBAPI intn DFANIgetann
+                (const char * filename, uint16 tag, uint16 ref, uint8 * ann,
+                 int32 maxlen, int type, int isfortran);
+
+    HDFLIBAPI intn DFANIputann
+                (const char * filename, uint16 tag, uint16 ref, uint8 * ann,
+                 int32 annlen, int type);
+
+    HDFLIBAPI int  DFANIlablist
+                (const char * filename, uint16 tag, uint16 reflist[],
+            uint8 * labellist, int listsize, int maxlen, int startpos,
+                 int isfortran);
+
+    HDFLIBAPI int  DFANIaddfann
+                (int32 file_id, char * ann, int32 annlen, int type);
+
+    HDFLIBAPI int32 DFANIgetfannlen
+                (int32 file_id, int type, int isfirst);
+
+    HDFLIBAPI int32 DFANIgetfann
+                (int32 file_id, char * ann, int32 maxlen, int type, int isfirst);
+
+    HDFLIBAPI intn DFANPshutdown(void);
+
+/*
+   ** from dfsd.c
+ */
+
+    HDFLIBAPI int  DFSDgetdims
+                (const char * filename, intn * prank, int32 sizes[], intn maxrank);
+
+    HDFLIBAPI int  DFSDgetdatastrs
+                (char * label, char * unit, char * format, char * coordsys);
+
+    HDFLIBAPI int  DFSDgetdimstrs
+                (int dim, char * label, char * unit, char * format);
+
+    HDFLIBAPI int  DFSDgetdatalen
+                (int * llabel, int * lunit, int * lformat, int * lcoordsys);
+
+    HDFLIBAPI int  DFSDgetdimlen
+                (int dim, int * llabel, int * lunit, int * lformat);
+
+    HDFLIBAPI int  DFSDgetdimscale
+                (intn dim, int32 maxsize, void * scale);
+
+    HDFLIBAPI int  DFSDgetrange
+                (void * pmax, void * pmin);
+
+    HDFLIBAPI int  DFSDgetdata
+                (const char * filename, intn rank, int32 maxsizes[], void * data);
+
+    HDFLIBAPI int  DFSDsetlengths
+                (int maxlen_label, int maxlen_unit, int maxlen_format,
+                 int maxlen_coordsys);
+
+    HDFLIBAPI int  DFSDsetdims
+                (intn rank, int32 dimsizes[]);
+
+    HDFLIBAPI int  DFSDsetdatastrs
+                (const char * label, const char * unit, const char * format, const char * coordsys);
+
+    HDFLIBAPI int  DFSDsetdimstrs
+                (int dim, const char * label, const char * unit, const char * format);
+
+    HDFLIBAPI int  DFSDsetdimscale
+                (intn dim, int32 dimsize, void * scale);
+
+    HDFLIBAPI int  DFSDsetrange
+                (void * maxi, void * mini);
+
+    HDFLIBAPI int  DFSDputdata
+                (const char * filename, intn rank, int32 dimsizes[], void * data);
+
+    HDFLIBAPI int  DFSDadddata
+                (const char * filename, intn rank, int32 dimsizes[], void * data);
+
+    HDFLIBAPI int  DFSDrestart
+                (void);
+
+    HDFLIBAPI int32 DFSDndatasets
+                (char * filename);
+
+    HDFLIBAPI int  DFSDclear
+                (void);
+
+    HDFLIBAPI uint16 DFSDlastref
+                (void);
+
+    HDFLIBAPI int  DFSDreadref
+                (char * filename, uint16 ref);
+
+    HDFLIBAPI int  DFSDgetslice
+                (const char * filename, int32 winst[], int32 windims[], void * data,
+                 int32 dims[]);
+
+    HDFLIBAPI int  DFSDstartslice
+                (const char * filename);
+
+    HDFLIBAPI int  DFSDputslice
+                (int32 winend[], void * data, int32 dims[]);
+
+    HDFLIBAPI int  DFSDendslice
+                (void);
+
+    HDFLIBAPI int  DFSDsetNT
+                (int32 numbertype);
+
+    HDFLIBAPI int  DFSDsetorder
+                (int arrayorder);
+
+    HDFLIBAPI int  DFSDgetNT
+                (int32 * pnumbertype);
+
+    HDFLIBAPI intn DFSDpre32sdg
+                (char * filename, uint16 ref, intn * ispre32);
+
+    HDFLIBAPI int  DFSDsetcal
+                (float64 cal, float64 cal_err, float64 ioff,
+                 float64 ioff_err, int32 cal_nt);
+
+    HDFLIBAPI int  DFSDgetcal
+                (float64 * pcal, float64 * pcal_err, float64 * pioff,
+                 float64 * pioff_err, int32 * cal_nt);
+
+    HDFLIBAPI int  DFSDwriteref
+                (const char * filename, uint16 ref);
+
+    HDFLIBAPI int  DFSDsetfillvalue
+                (void * fill_value);
+
+    HDFLIBAPI int  DFSDgetfillvalue
+                (void * fill_value);
+
+    HDFLIBAPI int  DFSDstartslab
+                (const char * filename);
+
+    HDFLIBAPI int  DFSDwriteslab
+                (int32 start[], int32 stride[], int32 count[],
+                 void * data);
+
+    HDFLIBAPI int  DFSDendslab
+                (void);
+
+    HDFLIBAPI int  DFSDreadslab
+                (const char *filename, int32 start[], int32 slab_size[],
+             int32 stride[], void * buffer, int32 buffer_size[]);
+
+    HDFLIBAPI intn DFSDPshutdown(void);
+
+/*
+   ** from dfconv.c
+ */
+
+    HDFLIBAPI int  DFKNTsize
+                (int32 number_type);
+
+    HDFLIBAPI int32 DFKisnativeNT
+                (int32 numbertype);
+
+    HDFLIBAPI int32 DFKislitendNT
+                (int32 numbertype);
+
+    HDFLIBAPI int8 DFKgetPNSC
+                (int32 numbertype, int32 machinetype);
+
+    HDFLIBAPI intn DFKsetNT
+                (int32 ntype);
+
+    HDFLIBAPI int32 DFKconvert
+                (void * source, void * dest, int32 ntype, int32 num_elm,
+                 int16 acc_mode, int32 source_stride, int32 dest_stride);
+
+/*
+   ** from dfknat.c
+ */
+
+    HDFLIBAPI intn DFKnb1b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKnb2b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKnb4b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKnb8b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+/*
+   ** from dfkswap.c
+ */
+
+    HDFLIBAPI intn DFKsb2b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKsb4b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+    HDFLIBAPI intn DFKsb8b
+                (void * s, void * d, uint32 num_elm, uint32 source_stride, uint32 dest_stride);
+
+
+/* Multi-file Annotation C-routines found in mfan.c */
+HDFLIBAPI int32 ANstart(int32 file_id);
+
+HDFLIBAPI intn  ANfileinfo(int32 an_id, int32 *n_file_label, int32 *n_file_desc,
+                        int32 *n_obj_label, int32 *n_obj_desc);
+
+HDFLIBAPI int32 ANend(int32 an_id);
+
+HDFLIBAPI int32 ANcreate(int32 an_id, uint16 elem_tag, uint16 elem_ref, 
+                      ann_type type);
+
+HDFLIBAPI int32 ANcreatef(int32 an_id, ann_type type);
+
+HDFLIBAPI int32 ANselect(int32 an_id, int32 idx, ann_type type);
+
+HDFLIBAPI intn  ANnumann(int32 an_id, ann_type type, uint16 elem_tag, 
+                      uint16 elem_ref);
+
+HDFLIBAPI intn  ANannlist(int32 an_id, ann_type type, uint16 elem_tag, 
+                       uint16 elem_ref, int32 ann_list[]);
+
+HDFLIBAPI int32 ANannlen(int32 ann_id);
+
+HDFLIBAPI int32 ANwriteann(int32 ann_id, const char *ann, int32 annlen);
+
+HDFLIBAPI int32 ANreadann(int32 ann_id, char *ann, int32 maxlen);
+
+HDFLIBAPI intn  ANendaccess(int32 ann_id);
+
+HDFLIBAPI int32 ANget_tagref(int32 an_id, int32 idx, ann_type type,
+                          uint16 *ann_tag, uint16 *ann_ref);
+
+HDFLIBAPI int32 ANid2tagref(int32 an_id, uint16 *ann_tag, uint16 *ann_ref);
+
+HDFLIBAPI int32 ANtagref2id(int32 an_id, uint16 ann_tag, uint16 ann_ref);
+
+HDFLIBAPI uint16 ANatype2tag(ann_type atype);
+
+HDFLIBAPI ann_type ANtag2atype(uint16 atag);
+
+/* BMR: Removed because this function is meant to be private.
+HDFLIBAPI intn ANdestroy(void); */ 
+
+/* Multi-file Raster C-routines found in mfgr.c */
+HDFLIBAPI intn rigcompare(void * k1, void * k2, intn cmparg);
+
+HDFLIBAPI int32 GRstart(int32 hdf_file_id);
+
+HDFLIBAPI intn GRfileinfo(int32 grid,int32 *n_datasets,int32 *n_attrs);
+
+HDFLIBAPI intn GRend(int32 grid);
+
+HDFLIBAPI int32 GRcreate(int32 grid,const char *name,int32 ncomp,int32 nt,int32 il,
+    int32 dimsizes[2]);
+
+HDFLIBAPI int32 GRselect(int32 grid,int32 idx);
+
+HDFLIBAPI int32 GRnametoindex(int32 grid,const char *name);
+
+HDFLIBAPI intn GRgetiminfo(int32 riid,char *name,int32 *ncomp,int32 *nt,int32 *il,
+    int32 dimsizes[2],int32 *n_attr);
+
+HDFLIBAPI intn GRgetnluts(int32 riid);
+
+HDFLIBAPI intn GRwriteimage(int32 riid,int32 start[2],int32 stride[2],
+    int32 count[2],void * data);
+
+HDFLIBAPI intn GRreadimage(int32 riid,int32 start[2],int32 stride[2],
+    int32 count[2],void * data);
+
+HDFLIBAPI intn GRendaccess(int32 riid);
+
+HDFLIBAPI uint16 GRidtoref(int32 riid);
+
+HDFLIBAPI int32 GRreftoindex(int32 grid,uint16 ref);
+
+HDFLIBAPI intn GRreqlutil(int32 riid,intn il);
+
+HDFLIBAPI intn GRreqimageil(int32 riid,intn il);
+
+HDFLIBAPI int32 GRgetlutid(int32 riid,int32 idx);
+
+HDFLIBAPI uint16 GRluttoref(int32 lutid);
+
+HDFLIBAPI intn GRgetlutinfo(int32 riid,int32 *ncomp,int32 *nt,
+    int32 *il,int32 *nentries);
+
+HDFLIBAPI intn GRwritelut(int32 riid,int32 ncomps,int32 nt,
+    int32 il,int32 nentries,void * data);
+
+HDFLIBAPI intn GRreadlut(int32 lutid,void * data);
+
+HDFLIBAPI intn GRsetexternalfile(int32 riid,const char *filename,int32 offset);
+
+HDFLIBAPI intn GRsetaccesstype(int32 riid,uintn accesstype);
+
+HDFLIBAPI intn GRsetcompress(int32 riid,comp_coder_t comp_type,comp_info *cinfo);
+
+HDFLIBAPI intn GRgetcompress(int32 riid,comp_coder_t* comp_type,comp_info *cinfo);
+
+HDFLIBAPI intn GRgetcompinfo(int32 riid,comp_coder_t* comp_type,comp_info *cinfo);
+
+HDFLIBAPI intn GRsetattr(int32 id,const char *name,int32 attr_nt,int32 count,const void * data);
+
+HDFLIBAPI intn GRattrinfo(int32 id,int32 idx,char *name,int32 *attr_nt,int32 *count);
+
+HDFLIBAPI intn GRgetattr(int32 id,int32 idx,void * data);
+
+HDFLIBAPI int32 GRfindattr(int32 id,const char *name);
+
+HDFLIBAPI intn GRgetcomptype (int32 riid, comp_coder_t *comp_type);
+
+HDFLIBAPI intn GRPshutdown(void);
+
+/* This function was added for hmap project only.  Feb-25-2011 */
+HDFLIBAPI intn GR2bmapped(int32 riid, intn *tobe_mapped, intn *created_byGR);
+
+/*=== HDF_CHUNK_DEF same as in mfhdf.h - moved here  ====*/
+
+/* Bit flags used for SDsetchunk(), SDgetchunkinfo() 
+   GRsetchunk() and GRgetchunkinfo(). Note that GRs do not support NBIT */
+#define HDF_NONE    0x0
+#define HDF_CHUNK   0x1
+#define HDF_COMP    0x3
+#define HDF_NBIT    0x5
+
+/* Cache flags */
+#define HDF_CACHEALL 0x1
+
+/* Chunk Defintion, Note that GRs need only 2 dimensions for the chunk_lengths */
+typedef union hdf_chunk_def_u
+{
+    /* Chunk Lengths only */
+    int32   chunk_lengths[H4_MAX_VAR_DIMS]; /* chunk lengths along each dimension */
+
+    struct 
+    {   /* For Compression info */
+        int32      chunk_lengths[H4_MAX_VAR_DIMS]; /* chunk lengths along each dimension */
+        int32      comp_type;    /* Compression type */
+        int32      model_type;   /* Compression model type */
+        comp_info  cinfo;        /* Compression info struct */
+        model_info minfo;        /* Compression model info struct */
+    }comp;
+        
+    struct 
+    { /* For NBIT, Used by SDS and not by GR */
+        int32 chunk_lengths[H4_MAX_VAR_DIMS]; /* chunk lengths along each dimension */
+        intn  start_bit; /* offset of the start bit in the data */
+        intn  bit_len;   /* number of bits to store */
+        intn  sign_ext;  /* whether to sign extend or not */
+        intn  fill_one;  /* whether to fill with 1's or not (0's) */
+    } nbit;
+
+} HDF_CHUNK_DEF;
+
+/*=== GR Chunking Routines  ====*/
+
+/******************************************************************************
+ NAME
+      GRsetchunk   -- make GR a chunked GR
+
+ DESCRIPTION
+      This routine makes the GR a chunked GR according to the chunk
+      definition passed in.
+
+      The image currently cannot be special already.  i.e. NBIT,
+      COMPRESSED, or EXTERNAL. This is an Error.
+
+      The defintion of the HDF_CHUNK_DEF union with relvant fields is:
+
+      typedef union hdf_chunk_def_u
+      {
+         int32   chunk_lengths[2];  Chunk lengths along each dimension
+
+         struct 
+          {   
+            int32     chunk_lengths[2]; Chunk lengths along each dimension
+            int32     comp_type;                   Compression type 
+            comp_info cinfo;                       Compression info struct 
+          }comp;
+
+      } HDF_CHUNK_DEF
+
+      The simplist is the 'chunk_lengths' array specifiying chunk 
+      lengths for each dimension where the 'flags' argument set to 
+      'HDF_CHUNK';
+
+      COMPRESSION is set by using the 'HDF_CHUNK_DEF' structure to set the
+      appropriate compression information along with the required chunk lengths
+      for each dimension. The compression information is the same as 
+      that set in 'SDsetcompress()'. The bit-or'd'flags' argument' is set to 
+      'HDF_CHUNK | HDF_COMP'.
+
+      See the example in pseudo-C below for further usage.
+
+      The maximum number of Chunks in an HDF file is 65,535.
+
+      The performance of the GRxxx interface with chunking is greatly
+      affected by the users access pattern over the image and by
+      the maximum number of chunks set in the chunk cache. The cache contains 
+      the Least Recently Used(LRU cache replacment policy) chunks. See the
+      routine GRsetchunkcache() for further info on the chunk cache and how 
+      to set the maximum number of chunks in the chunk cache. A default chunk 
+      cache is always created.
+
+      The following example shows the organization of chunks for a 2D iamge.
+      e.g. 4x4 image with 2x2 chunks. The array shows the layout of
+           chunks in the chunk array.
+
+            4 ---------------------                                           
+              |         |         |                                                 
+        Y     |  (0,1)  |  (1,1)  |                                       
+        ^     |         |         |                                      
+        |   2 ---------------------                                       
+        |     |         |         |                                               
+        |     |  (0,0)  |  (1,0)  |                                      
+        |     |         |         |                                           
+        |     ---------------------                                         
+        |     0         2         4                                       
+        ---------------> X                                                       
+                                                                                
+        --Without compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                                                                    
+        -- Set chunk lengths --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2; 
+
+        -- Set Chunking -- 
+        GRsetchunk(riid, chunk_def, HDF_CHUNK);                      
+         ......                                                                  
+        }                                                                           
+
+        --With compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                
+        -- Set chunk lengths first --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2;
+
+        -- Set compression --
+        chunk_def.comp.cinfo.deflate.level = 9;
+        chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+
+        -- Set Chunking with Compression --
+        GRsetchunk(riid, chunk_def, HDF_CHUNK | HDF_COMP);                      
+         ......                                                                  
+        }                                                                           
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn GRsetchunk
+    (int32 riid,             /* IN: raster access id */
+     HDF_CHUNK_DEF chunk_def, /* IN: chunk definition */
+     int32 flags              /* IN: flags */);
+
+/******************************************************************************
+ NAME
+     GRgetchunkinfo -- get Info on GR
+
+ DESCRIPTION
+     This routine gets any special information on the GR. If its chunked,
+     chunked and compressed or just a regular GR. Currently it will only
+     fill the array of chunk lengths for each dimension as specified in
+     the 'HDF_CHUNK_DEF' union. You can pass in a NULL for 'chunk_def'
+     if don't want the chunk lengths for each dimension.
+     Additionaly if successfull it will return a bit-or'd value in 'flags' 
+     indicating if the GR is:
+
+     Chunked                  -> flags = HDF_CHUNK
+     Chunked and compressed   -> flags = HDF_CHUNK | HDF_COMP 
+     Non-chunked              -> flags = HDF_NONE
+  
+     e.g. 4x4 array - Pseudo-C
+     {
+     int32   rcdims[3];
+     HDF_CHUNK_DEF rchunk_def;
+     int32   cflags;
+     ...
+     rchunk_def.chunk_lengths = rcdims;
+     GRgetchunkinfo(riid, &rchunk_def, &cflags);
+     ...
+     }
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn GRgetchunkinfo
+    (int32 riid,              /* IN: Raster access id */
+     HDF_CHUNK_DEF *chunk_def, /* IN/OUT: chunk definition */
+     int32 *flags              /* IN/OUT: flags */);
+
+
+/******************************************************************************
+ NAME
+     GRwritechunk  -- write the specified chunk to the GR
+
+ DESCRIPTION
+     This routine writes a whole chunk of data to the chunked GR 
+     specified by chunk 'origin' for the given GR and can be used
+     instead of GRwriteimage() when this information is known. This
+     routine has less overhead and is much faster than using GRwriteimage().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See GRsetchunk() for a description of the organization of chunks in an GR.
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn GRwritechunk
+    (int32 riid,      /* IN: raster access id */
+     int32 *origin,    /* IN: origin of chunk to write */
+     const void *datap /* IN: buffer for data */);
+
+/******************************************************************************
+ NAME
+     GRreadchunk   -- read the specified chunk to the GR
+
+ DESCRIPTION
+     This routine reads a whole chunk of data from the chunked GR
+     specified by chunk 'origin' for the given GR and can be used
+     instead of GRreadimage() when this information is known. This
+     routine has less overhead and is much faster than using GRreadimage().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See GRsetchunk() for a description of the organization of chunks in an GR.
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn GRreadchunk
+    (int32 riid,      /* IN: raster access id */
+     int32 *origin,    /* IN: origin of chunk to read */
+     void  *datap      /* IN/OUT: buffer for data */);
+
+
+/******************************************************************************
+NAME
+     GRsetchunkcache -- maximum number of chunks to cache 
+
+DESCRIPTION
+     Set the maximum number of chunks to cache.
+
+     The cache contains the Least Recently Used(LRU cache replacment policy) 
+     chunks. This routine allows the setting of maximum number of chunks that 
+     can be cached, 'maxcache'.
+
+     The performance of the GRxxx interface with chunking is greatly
+     affected by the users access pattern over the image and by
+     the maximum number of chunks set in the chunk cache. The number chunks 
+     that can be set in the cache is process memory limited. It is a good 
+     idea to always set the maximum number of chunks in the cache as the 
+     default heuristic does not take into account the memory available for 
+     the application.
+
+     By default when the GR is promoted to a chunked element the 
+     maximum number of chunks in the cache 'maxcache' is set to the number of
+     chunks along the last dimension.
+
+     The values set here affects the current object's caching behaviour.
+
+     If the chunk cache is full and 'maxcache' is greater then the
+     current 'maxcache' value, then the chunk cache is reset to the new
+     'maxcache' value, else the chunk cache remains at the current
+     'maxcache' value.
+
+     If the chunk cache is not full, then the chunk cache is set to the
+     new 'maxcache' value only if the new 'maxcache' value is greater than the
+     current number of chunks in the cache.
+
+     Use flags argument of 'HDF_CACHEALL' if the whole object is to be cached 
+     in memory, otherwise pass in zero(0). Currently you can only
+     pass in zero.
+
+    See GRsetchunk() for a description of the organization of chunks in an GR.
+
+RETURNS
+     Returns the 'maxcache' value for the chunk cache if successful 
+     and FAIL otherwise
+******************************************************************************/
+HDFLIBAPI intn GRsetchunkcache
+    (int32 riid,     /* IN: raster access id */
+     int32 maxcache,  /* IN: max number of chunks to cache */
+     int32 flags      /* IN: flags = 0, HDF_CACHEALL */);
+
+
+#ifdef HAVE_FMPOOL
+/******************************************************************************
+NAME
+     Hmpset - set pagesize and maximum number of pages to cache on next open/create
+
+DESCRIPTION
+     Set the pagesize and maximum number of pages to cache on the next 
+     open/create of a file. A pagesize that is a power of 2 is recommended.
+
+     The values set here only affect the next open/creation of a file and
+     do not change a particular file's paging behaviour after it has been
+     opened or created. This maybe changed in a later release.
+
+     Use flags arguement of 'MP_PAGEALL' if the whole file is to be cached 
+     in memory otherwise passs in zero.
+
+RETURNS
+     Returns SUCCEED if successful and FAIL otherwise
+
+NOTE
+     This calls the real routine MPset().
+     Currently 'maxcache' has to be greater than 1. Maybe use special 
+     case of 0 to specify you want to turn page buffering off or use
+     the flags arguement. 
+
+******************************************************************************/
+HDFLIBAPI int  Hmpset(int pagesize, /* IN: pagesize to use for next open/create */
+                   int maxcache, /* IN: max number of pages to cache */
+                   int flags     /* IN: flags = 0, MP_PAGEALL */);
+
+/******************************************************************************
+NAME
+     Hmpget - get last pagesize and max number of pages cached for open/create
+
+DESCRIPTION
+     This gets the last pagesize and maximum number of pages cached for 
+     the last open/create of a file.
+
+RETURNS
+     Returns SUCCEED.
+
+NOTES
+     This routine calls the real routine MPget().
+******************************************************************************/
+HDFLIBAPI int  Hmpget(int *pagesize, /*OUT: pagesize to used in last open/create */
+                   int *maxcache, /*OUT: max number of pages cached in last open/create */
+                   int flags      /* IN: */);
+
+#endif /* HAVE_FMPOOL */
+
+/* Vset interface functions (used to be in vproto.h) */
+
+/* Useful macros, which someday might become actuall functions */
+/*
+ * macros for VSinquire
+ * all these macros should be public for users
+ */
+#define VSQuerycount(vs, count) \
+        (VSinquire (vs, (int32 *) count, (int32*) NULL, (char*) NULL, (int32*) NULL, (char*) NULL))
+
+#define VSQueryinterlace(vs, intr) \
+        (VSinquire (vs, (int32 *) NULL, (int32*) intr, (char*) NULL, (int32*) NULL, (char*) NULL))
+
+#define VSQueryfields(vs, flds) \
+        (VSinquire (vs, (int32 *) NULL, (int32*) NULL, (char*) flds, (int32*) NULL, (char*) NULL))
+
+#define VSQueryvsize(vs, size) \
+        (VSinquire (vs, (int32 *) NULL, (int32*) NULL, (char*) NULL, (int32*) size, (char*) NULL))
+
+#define VSQueryname(vs, name) \
+        (VSinquire (vs, (int32 *) NULL, (int32*) NULL, (char*) NULL, (int32*) NULL, (char*) name))
+
+/* 
+   ** from vattr.c
+ */
+   HDFLIBAPI intn Vsetattr
+                (int32 vgid,  const char *attrname, int32 datatype,
+                 int32 count, const void * values);
+   HDFLIBAPI intn Vnattrs
+                (int32 vgid);
+   HDFLIBAPI intn Vnattrs2
+                (int32 vgid);
+   HDFLIBAPI intn Vnoldattrs
+                (int32 vgid);
+   HDFLIBAPI intn Vfindattr
+                (int32 vgid, const char *attrname);
+   HDFLIBAPI intn Vattrinfo
+                (int32 vgid, intn attrindex, char *name, 
+                 int32 *datatype, int32 *count, int32 *size);
+   HDFLIBAPI intn Vattrinfo2 /* copy of Vattrinfo for old attributes */
+                (int32 vgid, intn attrindex, char *name, int32 *datatype,
+		 int32 *count, int32 *size, int32 *nfields, uint16 *refnum);
+   HDFLIBAPI intn Vgetattr
+                (int32 vgid, intn attrindex, void * values);
+   HDFLIBAPI intn Vgetattr2 /* copy of Vgetattr for old attributes */
+                (int32 vgid, intn attrindex, void * values);
+   HDFLIBAPI int32 Vgetversion
+                (int32 vgid);
+   HDFLIBAPI intn VSfindex
+                 (int32 vsid, const char *fieldname, int32 *fldindex);
+   HDFLIBAPI intn VSsetattr
+                (int32 vsid, int32 findex, const char *attrname,
+                 int32 datatype, int32 count, const void * values);
+   HDFLIBAPI intn VSnattrs
+                (int32 vsid);
+   HDFLIBAPI intn VSfnattrs
+                (int32 vsid, int32 findex);
+   HDFLIBAPI intn VSfindattr
+                (int32 vsid, int32 findex, const char *attrname);
+   HDFLIBAPI intn VSattrinfo
+                (int32 vsid, int32 findex, intn attrindex,
+                 char *name, int32 *datatype, int32 *count, 
+                 int32 *size);
+   HDFLIBAPI intn VSgetattr
+                (int32 vsid, int32 findex, intn attrindex,
+                  void * values);
+   HDFLIBAPI intn VSisattr
+                (int32 vsid);
+/*
+   ** from vconv.c
+ */
+    HDFLIBAPI int32 vicheckcompat
+                (HFILEID f);
+
+    HDFLIBAPI int32 vimakecompat
+                (HFILEID f);
+
+    HDFLIBAPI int32 vcheckcompat
+                (char  * fs);
+
+    HDFLIBAPI int32 vmakecompat
+                (char  * fs);
+
+/*
+   ** from vg.c
+ */
+    HDFLIBAPI int32 VSelts
+                (int32 vkey);
+
+    HDFLIBAPI int32 VSgetinterlace
+                (int32 vkey);
+
+    HDFLIBAPI intn VSsetinterlace
+                (int32 vkey, int32 interlace);
+
+    HDFLIBAPI int32 VSgetfields
+                (int32 vkey, char  * fields);
+
+    HDFLIBAPI intn VSfexist
+                (int32 vkey, char  * fields);
+
+    HDFLIBAPI int32 VSsizeof
+                (int32 vkey, char  * fields);
+
+    HDFLIBAPI void VSdump
+                (int32 vkey);
+
+    HDFLIBAPI int32 VSsetname
+                (int32 vkey, const char  * vsname);
+
+    HDFLIBAPI int32 VSsetclass
+                (int32 vkey, const char  * vsclass);
+
+    HDFLIBAPI int32 VSgetname
+                (int32 vkey, char  * vsname);
+
+    HDFLIBAPI int32 VSgetclass
+                (int32 vkey, char  * vsclass);
+
+    HDFLIBAPI intn VSinquire
+                (int32 vkey, int32  * nelt, int32  * interlace,
+           char  * fields, int32  * eltsize, char  * vsname);
+
+    HDFLIBAPI intn VSisinternal
+                (const char  *vsclass);
+
+    HDFLIBAPI int32 VSlone
+                (HFILEID f, int32  * idarray, int32 asize);
+
+    HDFLIBAPI int32 Vlone
+                (HFILEID f, int32  * idarray, int32 asize);
+
+    HDFLIBAPI int32 Vfind
+                (HFILEID f, const char  * vgname);
+
+    HDFLIBAPI int32 VSfind
+                (HFILEID f, const char  * vsname);
+
+    HDFLIBAPI int32 Vfindclass
+                (HFILEID f, const char  * vgclass);
+
+    HDFLIBAPI int32 VSfindclass
+                (HFILEID f, const char  * vsclass);
+    
+    HDFLIBAPI intn VSofclass
+                (int32 id, const char *vsclass, uintn start_vd,
+                 uintn array_size, uint16 *refarray);
+
+    HDFLIBAPI intn VSgetvdatas
+                (int32 id, uintn start_vd, uintn array_size, uint16 *refarray);
+    
+    HDFLIBAPI intn VSsetblocksize
+                (int32 vkey, int32 block_size);
+
+    HDFLIBAPI intn VSsetnumblocks
+                (int32 vkey, int32 num_blocks);
+
+    HDFLIBAPI intn VSgetblockinfo
+                (int32 vkey, int32* block_size, int32* num_blocks);
+
+    HDFLIBAPI void Vsetzap
+                (void);
+
+/*
+   ** from vgp.c
+ */
+    HDFLIBAPI intn vcompare
+                (void * k1, void * k2, intn cmparg);
+
+    HDFLIBAPI intn vcompareref
+                (void * k1, void * k2, intn cmparg);
+
+    HDFLIBAPI void vdestroynode
+                (void * n);
+
+    HDFLIBAPI void vtfreekey
+                (void * k);
+
+    HDFLIBAPI intn Vinitialize
+                (HFILEID f);
+
+    HDFLIBAPI intn Vfinish
+                (HFILEID f);
+
+    HDFLIBAPI HFILEID Vopen
+                (char *path, intn acc_mode, int16 ndds);
+
+    HDFLIBAPI intn Vclose
+                (HFILEID f);
+
+    HDFLIBAPI int32 vexistvg
+                (HFILEID f, uint16 vgid);
+
+    HDFLIBAPI int32 Vattach
+                (HFILEID f, int32 vgid, const char  * accesstype);
+
+    HDFLIBAPI int32 Vdetach
+                (int32 vkey);
+
+    HDFLIBAPI int32 Vinsert
+                (int32 vkey, int32 vskey);
+    /* note: 2nd arg of Vinsert can also be (VGROUP *) */
+
+    HDFLIBAPI int32 Vflocate
+                (int32 vkey, char  * field);
+
+    HDFLIBAPI intn Vinqtagref
+                (int32 vkey, int32 tag, int32 ref);
+
+    HDFLIBAPI int32 Vntagrefs
+                (int32 vkey);
+
+    HDFLIBAPI int32 Vnrefs
+                (int32 vkey,int32 tag);
+
+    HDFLIBAPI int32 Vgettagrefs
+                (int32 vkey, int32  tagarray[], int32  refarray[], int32 n);
+
+    HDFLIBAPI int32 Vgetuservgs
+                (int32 id, int32 start_ref, int32 n_vgs, int32 *refarray); 
+
+    HDFLIBAPI intn Vgettagref
+                (int32 vkey, int32 which, int32  * tag, int32  * ref);
+
+    HDFLIBAPI int32 VQueryref
+                (int32 vkey);
+
+    HDFLIBAPI int32 VQuerytag
+                (int32 vkey);
+
+    HDFLIBAPI int32 Vaddtagref
+                (int32 vkey, int32 tag, int32 ref);
+
+    HDFLIBAPI int32 Ventries
+                (HFILEID f, int32 vgid);
+
+    HDFLIBAPI int32 Vsetname
+                (int32 vkey, const char  * vgname);
+
+    HDFLIBAPI int32 Vsetclass
+                (int32 vkey, const char  * vgclass);
+
+    HDFLIBAPI intn Visvg
+                (int32 vkey, int32 id);
+
+    HDFLIBAPI intn Visvs
+                (int32 vkey, int32 id);
+
+    HDFLIBAPI int32 Vgetid
+                (HFILEID f, int32 vgid);
+
+    HDFLIBAPI int32 Vgetnext
+                (int32 vkey, int32 id);
+
+    HDFLIBAPI int32 Vgetname
+                (int32 vkey, char  * vgname);
+
+    HDFLIBAPI int32 Vgetnamelen
+                (int32 vkey, uint16 * name_len);
+
+    HDFLIBAPI int32 Vgetclassnamelen
+                (int32 vkey, uint16 * classname_len);
+
+    HDFLIBAPI int32 Vgetclass
+                (int32 vkey, char  * vgclass);
+
+    HDFLIBAPI intn Vinquire
+                (int32 vkey, int32  * nentries, char  * vgname);
+
+    HDFLIBAPI int32 Vdelete
+                (int32 f, int32 ref);
+
+    HDFLIBAPI intn Vgisinternal
+		(int32 vkey);
+
+    HDFLIBAPI intn Visinternal	/* this function is replaced by Vgisinternal */
+		(const char *classname);
+
+    HDFLIBAPI intn Vgetvgroups
+		(int32 id, uintn start_vg, uintn n_vgs, uint16 *refarray);
+
+
+/*******************************************************************************
+NAME
+   Vdeletetagref - delete tag/ref pair in Vgroup
+
+DESCRIPTION
+    Deletes the given tag/ref pair from the Vgroup.  If the given tag/ref pair 
+    does not exist in the vgroup the routine will return FAIL. Users should use 
+    Vinqtagref() to check if the tag/ref pair exists before deleting.
+
+RETURNS
+    Returns SUCCEED if the tag/ref pair is deleted from Vgroup and
+    FAIL if unsuccessful.
+
+*******************************************************************************/
+HDFLIBAPI intn
+Vdeletetagref(int32 vkey, /* IN: vgroup key */ 
+              int32 tag,  /* IN: tag to delete in vgroup */
+              int32 ref   /* IN: ref to delete in vgroup */);
+
+    HDFLIBAPI intn VPshutdown(void);
+
+/*
+   ** from vparse.c
+ */
+    HDFLIBAPI int32 scanattrs
+                (const char  * attrs, int32  * attrc, char  *** attrv);
+
+/*
+   ** from vhi.c
+ */
+    HDFLIBAPI int32 VHstoredata
+                (HFILEID f, const char  * field, const uint8  *buf, int32 n, int32 datatype,
+                 const char  * vsname, const char  * vsclass);
+
+    HDFLIBAPI int32 VHstoredatam
+                (HFILEID f, const char * field, const uint8  *buf, int32 n, int32 datatype,
+                 const char  * vsname, const char  * vsclass, int32 order);
+
+    HDFLIBAPI int32 VHmakegroup
+                (HFILEID f, int32  tagarray[], int32  refarray[], int32 n,
+                    const char * vgname, const char  * vgclass);
+
+/*
+   ** from vio.c
+ */
+
+    HDFLIBAPI intn VSPhshutdown(void);
+
+    HDFLIBAPI int32 vexistvs
+                (HFILEID f, uint16 vsref);
+
+    HDFLIBAPI void vsdestroynode
+                (void * n);
+
+    HDFLIBAPI void vfdestroynode
+                (void * n);
+
+    HDFLIBAPI int32 VSattach
+                (HFILEID f, int32 vsref, const char  * accesstype);
+
+    HDFLIBAPI int32 VSdetach
+                (int32 vkey);
+
+    HDFLIBAPI int32 VSQuerytag
+                (int32 vkey);
+
+    HDFLIBAPI int32 VSQueryref
+                (int32 vkey);
+ 
+    HDFLIBAPI int32 VSgetid
+                (HFILEID f, int32 vsref);
+
+    HDFLIBAPI int32 VSgetversion
+                (int32 vkey);
+
+    HDFLIBAPI int32 VSdelete
+                (int32 f, int32 ref);
+
+    HDFLIBAPI int32 VSappendable
+                (int32 vkey, int32 blk);
+
+/*
+   ** from vsfld.c
+ */
+
+    HDFLIBAPI intn VSsetfields
+                (int32 vkey, const char  * fields);
+
+    HDFLIBAPI intn VSfdefine
+                (int32 vkey, const char  * field, int32 localtype, int32 order);
+
+    HDFLIBAPI int32 VFnfields
+                (int32 vkey);
+
+    HDFLIBAPI char *VFfieldname
+                (int32 vkey, int32 idx);
+
+    HDFLIBAPI int32 VFfieldtype
+                (int32 vkey, int32 idx);
+
+    HDFLIBAPI int32 VFfieldisize
+                (int32 vkey, int32 idx);
+
+    HDFLIBAPI int32 VFfieldesize
+                (int32 vkey, int32 idx);
+
+    HDFLIBAPI int32 VFfieldorder
+                (int32 vkey, int32 idx);
+
+    HDFLIBAPI intn VSsetexternalfile
+		(int32 vkey, const char *filename, int32 offset);
+
+    HDFLIBAPI intn VSgetexternalfile
+		 (int32 vkey, uintn name_len, char *filename, int32* offset);
+
+    HDFLIBAPI intn VSgetexternalinfo
+		 (int32 vkey, uintn name_len, char *filename, int32* offset,
+		 int32* length);
+
+    HDFLIBAPI intn VSfpack
+                (int32 vsid, intn packtype, const char *fields_in_buf,
+                void * buf, intn bufsz, intn n_records, 
+                const char *fields, void * fldbufpt[]);
+
+/*
+   ** from vrw.c
+ */
+    HDFLIBAPI intn VSPshutdown(void);
+
+    HDFLIBAPI int32 VSseek
+                (int32 vkey, int32 eltpos);
+
+    HDFLIBAPI int32 VSread
+                (int32 vkey, uint8  buf[], int32 nelt, int32 interlace);
+
+    HDFLIBAPI int32 VSwrite
+                (int32 vkey, const uint8  buf[], int32 nelt, int32 interlace);
+
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* _H_PROTO */
+
diff --git a/hdf/src/hproto_fortran.h b/hdf/src/hproto_fortran.h
new file mode 100644
index 0000000..0ab6f85
--- /dev/null
+++ b/hdf/src/hproto_fortran.h
@@ -0,0 +1,1696 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hproto.h 4784 2006-11-21 04:49:51Z bmribler $ */
+
+#ifndef _H_PROTO_FORTRAN
+#define _H_PROTO_FORTRAN
+
+#include "H4api_adpt.h"
+#include "df.h"
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+
+/*
+   ** from dfanF.c
+ */
+#   define ndaiganl         H4_F77_FUNC(daiganl, DAIGANL)
+#   define ndaigann         H4_F77_FUNC(daigann, DAIGANN)
+#   define ndaipann         H4_F77_FUNC(daipann, DAIPANN)
+#   define ndailist         H4_F77_FUNC(dailist, DAILIST)
+#   define ndalref          H4_F77_FUNC(dalref, DALREF)
+#   define ndaclear         H4_F77_FUNC(daclear, DACLEAR)
+#   define ndfanlastref     H4_F77_FUNC(dfanlastref, DFANLASTREF)
+#   define ndfanaddfds      H4_F77_FUNC(dfanaddfds, DFANADDFDS)
+#   define ndfangetfidlen   H4_F77_FUNC(dfangetfidlen, DFANGETFIDLEN)
+#   define ndfangetfdslen   H4_F77_FUNC(dfangetfdslen, DFANGETFDSLEN)
+#   define ndfangetfid      H4_F77_FUNC(dfangetfid, DFANGETFID)
+#   define ndfangetfds      H4_F77_FUNC(dfangetfds, DFANGETFDS)
+#   define ndaafds          H4_F77_FUNC(daafds, DAAFDS)
+#   define ndagfidl         H4_F77_FUNC(dagfidl, DAGFIDL)
+#   define ndagfdsl         H4_F77_FUNC(dagfdsl, DAGFDSL)
+#   define ndagfid          H4_F77_FUNC(dagfid, DAGFID)
+#   define ndagfds          H4_F77_FUNC(dagfds, DAGFDS)
+#   define ndaiafid         H4_F77_FUNC(daiafid, DAIAFID)
+
+    HDFFCLIBAPI      FRETVAL(intf) ndaiganl
+                (_fcd filename, intf * tag, intf * ref, intf * type,
+                 intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndaigann
+                (_fcd filename, intf * tag, intf * ref, _fcd annotation,
+                 intf * maxlen, intf * type, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndaipann
+                (_fcd filename, intf * tag, intf * ref, _fcd annotation,
+                 intf * annlen, intf * type, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndailist
+                (_fcd filename, intf * tag, intf reflist[], _fcd labellist,
+          intf * listsize, intf * maxlen, intf * startpos,
+                 intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndalref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndaclear
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfanlastref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfanaddfds
+                (intf * dfile, _fcd desc, intf * desclen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfangetfidlen
+                (intf * dfile, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfangetfdslen
+                (intf * dfile, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfangetfid
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfangetfds
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndaafds
+                (intf * dfile, _fcd desc, intf * desclen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndagfidl
+                (intf * dfile, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndagfdsl
+                (intf * dfile, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndagfid
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndagfds
+                (intf * dfile, _fcd id, intf * maxlen, intf * isfirst);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndaiafid
+                (intf * dfile, _fcd id, intf * idlen);
+
+/*
+   ** from dfr8F.c
+ */
+#   define nd8spal           H4_F77_FUNC(d8spal, D8SPAL)
+#   define nd8first          H4_F77_FUNC(d8first, D8FIRST)
+#   define nd8igdim          H4_F77_FUNC(d8igdim, D8IGDIM)
+#   define nd8igimg          H4_F77_FUNC(d8igimg, D8IGIMG)
+#   define nd8ipimg          H4_F77_FUNC(d8ipimg, D8IPIMG)
+#   define nd8iaimg          H4_F77_FUNC(d8iaimg, D8IAIMG)
+#   define nd8irref          H4_F77_FUNC(d8irref, D8IRREF)
+#   define nd8iwref          H4_F77_FUNC(d8iwref, D8IWREF)
+#   define nd8inims          H4_F77_FUNC(d8inims, D8INIMS)
+#   define nd8lref           H4_F77_FUNC(d8lref, D8LREF)
+#   define ndfr8lastref      H4_F77_FUNC(dfr8lastref, DFR8LASTREF)
+#   define ndfr8setpalette   H4_F77_FUNC(dfr8setpalette, DFR8SETPALETTE)
+#   define ndfr8restart      H4_F77_FUNC(dfr8restart, DFR8RESTART)
+#   define nd8scomp          H4_F77_FUNC(d8scomp, D8SCOMP)
+#   define ndfr8scompress    H4_F77_FUNC(dfr8scompress, DFR8SCOMPRESS)
+#   define nd8sjpeg          H4_F77_FUNC(d8sjpeg, D8SJPEG)
+#   define ndfr8sjpeg        H4_F77_FUNC(dfr8sjpeg, DFR8SJPEG)
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8spal
+                (_fcd pal);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8first
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8igdim
+                (_fcd filename, intf * xdim, intf * ydim, intf * ispal,
+                 intf * lenfn);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8igimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 _fcd pal, intf * lenfn);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8ipimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 intf * compress, intf * lenfn);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8iaimg
+                (_fcd filename, _fcd image, intf * xdim, intf * ydim,
+                 intf * compress, intf * lenfn);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8irref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8iwref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8inims
+                (_fcd filename, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8lref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfr8lastref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfr8setpalette
+                (_fcd pal);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfr8restart
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8scomp
+                (intf * scheme);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfr8scompress
+                (intf * scheme);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd8sjpeg
+                (intf * quality, intf * force_baseline);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfr8sjpeg
+                (intf * quality, intf * force_baseline);
+
+/*
+   ** from dfsdF.c
+ */
+#   define ndsgdast          H4_F77_FUNC(dsgdast, DSGDAST)
+#   define ndsgdisc          H4_F77_FUNC(dsgdisc, DSGDISC)
+#   define ndsgrang          H4_F77_FUNC(dsgrang, DSGRANG)
+#   define ndssdims          H4_F77_FUNC(dssdims, DSSDIMS)
+#   define ndssdisc          H4_F77_FUNC(dssdisc, DSSDISC)
+#   define ndssrang          H4_F77_FUNC(dssrang, DSSRANG)
+#   define ndsclear          H4_F77_FUNC(dsclear, DSCLEAR)
+#   define ndsslens          H4_F77_FUNC(dsslens, DSSLENS)
+#   define ndsgdiln          H4_F77_FUNC(dsgdiln, DSGDILN)
+#   define ndsgdaln          H4_F77_FUNC(dsgdaln, DSGDALN)
+#   define ndsfirst          H4_F77_FUNC(dsfirst, DSFIRST)
+#   define ndspslc           H4_F77_FUNC(dspslc, DSPSLC)
+#   define ndseslc           H4_F77_FUNC(dseslc, DSESLC)
+#   define ndsgnt            H4_F77_FUNC(dsgnt, DSGNT)
+#   define ndssnt            H4_F77_FUNC(dssnt, DSSNT)
+#   define ndsigdim          H4_F77_FUNC(dsigdim, DSIGDIM)
+#   define ndsigdat          H4_F77_FUNC(dsigdat, DSIGDAT)
+#   define ndsipdat          H4_F77_FUNC(dsipdat, DSIPDAT)
+#   define ndsiadat          H4_F77_FUNC(dsiadat, DSIADAT)
+#   define ndsigdas          H4_F77_FUNC(dsigdas, DSIGDAS)
+#   define ndsigslc          H4_F77_FUNC(dsigslc, DSIGSLC)
+#   define ndsigdis          H4_F77_FUNC(dsigdis, DSIGDIS)
+#   define ndsisslc          H4_F77_FUNC(dsisslc, DSISSLC)
+#   define ndsisdas          H4_F77_FUNC(dsisdas, DSISDAS)
+#   define ndsisdis          H4_F77_FUNC(dsisdis, DSISDIS)
+#   define ndsirref          H4_F77_FUNC(dsirref, DSIRREF)
+#   define ndslref           H4_F77_FUNC(dslref, DSLREF)
+#   define ndsinum           H4_F77_FUNC(dsinum, DSINUM)
+#   define ndsip32s          H4_F77_FUNC(dsip32s, DSIP32S)
+#   define ndsscal           H4_F77_FUNC(dsscal, DSSCAL)
+#   define ndsgcal           H4_F77_FUNC(dsgcal, DSGCAL)
+#   define ndfsdgetdatastrs  H4_F77_FUNC(dfsdgetdatastrs, DFSDGETDATASTRS)
+#   define ndfsdgetdimscale  H4_F77_FUNC(dfsdgetdimscale, DFSDGETDIMSCALE)
+#   define ndfsdgetrange     H4_F77_FUNC(dfsdgetrange, DFSDGETRANGE)
+#   define ndfsdsetdims      H4_F77_FUNC(dfsdsetdims, DFSDSETDIMS)
+#   define ndfsdsetdimscale  H4_F77_FUNC(dfsdsetdimscale, DFSDSETDIMSCALE)
+#   define ndfsdsetrange     H4_F77_FUNC(dfsdsetrange, DFSDSETRANGE)
+#   define ndfsdclear        H4_F77_FUNC(dfsdclear, DFSDCLEAR)
+#   define ndfsdsetlengths   H4_F77_FUNC(dfsdsetlengths, DFSDSETLENGTHS)
+#   define ndfsdgetdimlen    H4_F77_FUNC(dfsdgetdimlen, DFSDGETDIMLEN)
+#   define ndfsdgetdatalen   H4_F77_FUNC(dfsdgetdatalen, DFSDGETDATALEN)
+#   define ndfsdrestart      H4_F77_FUNC(dfsdrestart, DFSDRESTART)
+#   define ndfsdputslice     H4_F77_FUNC(dfsdputslice, DFSDPUTSLICE)
+#   define ndfsdendslice     H4_F77_FUNC(dfsdendslice, DFSDENDSLICE)
+#   define ndfsdsetnt        H4_F77_FUNC(dfsdsetnt, DFSDSETNT)
+#   define ndfsdgetnt        H4_F77_FUNC(dfsdgetnt, DFSDGETNT)
+#   define ndfsdlastref      H4_F77_FUNC(dfsdlastref, DFSDLASTREF)
+#   define ndsiwref          H4_F77_FUNC(dsiwref, DSIWREF)
+#   define ndssfill          H4_F77_FUNC(dssfill, DSSFILL)
+#   define ndsgfill          H4_F77_FUNC(dsgfill, DSGFILL)
+#   define ndsisslab         H4_F77_FUNC(dsisslab, DSISSLAB)
+#   define ndswslab          H4_F77_FUNC(dswslab, DSWSLAB)
+#   define ndseslab          H4_F77_FUNC(dseslab, DSESLAB)
+#   define ndsirslab         H4_F77_FUNC(dsirslab, DSIRSLAB)
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsgdisc
+                (intf * dim, intf * maxsize, void * scale);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsgrang
+                (void * pmax, void * pmin);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndssdims
+                (intf * rank, intf dimsizes[]);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndssdisc
+                (intf * dim, intf * dimsize, void * scale);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndssrang
+                (void * max, void * min);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsclear
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsslens
+                (intf * maxlen_label, intf * maxlen_unit,
+                 intf * maxlen_format, intf * maxlen_coordsys);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsgdiln
+                (intf * dim, intf * llabel, intf * lunit,
+                 intf * lformat);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsgdaln
+                (intf * llabel, intf * lunit, intf * lformat,
+                 intf * lcoordsys);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsfirst
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndspslc
+                (intf windims[], void * data, intf dims[]);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndseslc
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndssnt
+                (intf * numbertype);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsgnt
+                (intf * pnumbertype);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsigdim
+                (_fcd filename, intf * prank, intf sizes[],
+                 intf * maxrank, intf * lenfn);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsigdat
+                (_fcd filename, intf * rank, intf maxsizes[],
+                 void * data, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsipdat
+                (_fcd filename, intf * rank, intf dimsizes[],
+                 void * data, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsiadat
+                (_fcd filename, intf * rank, intf dimsizes[],
+                 void * data, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsigslc
+                (_fcd filename, intf winst[], intf windims[],
+                 void * data, intf dims[], intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsisslc
+                (_fcd filename, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsirref
+                (_fcd filename, intf * ref, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndslref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsinum
+                (_fcd filename, intf * len);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsip32s
+                (_fcd filename, intf * ref, intf * ispre32, intf * len);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdgetdatastrs
+                (_fcd label, _fcd unit, _fcd format, _fcd coordsys);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdgetdimstrs
+                (intf * dim, _fcd label, _fcd unit, _fcd format);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdgetdimscale
+                (intf * dim, intf * maxsize, void * scale);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdgetrange
+                (void * pmax, void * pmin);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdsetdims
+                (intf * rank, intf dimsizes[]);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdsetdimscale
+                (intf * dim, intf * dimsize, void * scale);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdsetrange
+                (void * max, void * min);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdclear
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdsetlengths
+                (intf * maxlen_label, intf * maxlen_unit,
+                 intf * maxlen_format, intf * maxlen_coordsys);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdgetdimlen
+                (intf * dim, intf * llabel, intf * lunit,
+                 intf * lformat);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdgetdatalen
+                (intf * llabel, intf * lunit, intf * lformat,
+                 intf * lcoordsys);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdrestart
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdputslice
+                (intf windims[], void * data, intf dims[]);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdendslice
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdsetnt
+                (intf * numbertype);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdgetnt
+                (intf * pnumbertype);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsdlastref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsisdis
+                (intf * dim, _fcd flabel, _fcd funit, _fcd fformat,
+             intf * llabel, intf * lunit, intf * lformat);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsigdis
+                (intf * dim, _fcd label, _fcd unit, _fcd format,
+             intf * llabel, intf * lunit, intf * lformat);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsisdas
+                (_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys,
+            intf * isfortran, intf * llabel, intf * lunit,
+                 intf * lformat, intf * lcoordsys);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsigdas
+                (_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf * llabel,
+             intf * lunit, intf * lformat, intf * lcoord);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsscal
+                (float64 * cal, float64 * cal_err, float64 * ioff,
+                 float64 * ioff_err, intf * cal_type);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsgcal
+                (float64 * cal, float64 * cal_err, float64 * ioff,
+                 float64 * ioff_err, intf * cal_type);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndswref
+                (_fcd filename, intf * fnlen, intf * ref);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndssfill
+                (void * fill_value);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndsgfill
+                (void * fill_value);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndssslab
+                (_fcd filename, intf * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndswslab
+                (intf start[], intf  stride[],
+                 intf  cont[], void * data);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndseslab
+                (void);
+
+    HDFFCLIBAPI	FRETVAL(intf) ndsiwref
+		(_fcd filename, intf * fnlen, intf * ref);
+
+    HDFFCLIBAPI	FRETVAL(intf) ndsisslab
+		(_fcd filename, intf * fnlen);
+
+    HDFFCLIBAPI	FRETVAL(intf) ndsirslab
+		(_fcd filename, intf * fnlen, intf start[], intf slab_size[],
+	         intf stride[], void * buffer, intf buffer_size[]);
+
+/*
+   ** from dfpF.c
+ */
+
+#   define ndpigpal      H4_F77_FUNC(dpigpal, DPIGPAL)
+#   define ndpippal      H4_F77_FUNC(dpippal, DPIPPAL)
+#   define ndpinpal      H4_F77_FUNC(dpinpal, DPINPAL)
+#   define ndpiwref      H4_F77_FUNC(dpiwref, DPIWREF)
+#   define ndpirref      H4_F77_FUNC(dpirref, DPIRREF)
+#   define ndprest       H4_F77_FUNC(dprest, DPREST)
+#   define ndplref       H4_F77_FUNC(dplref, DPLREF)
+#   define ndfprestart   H4_F77_FUNC(dfprestart, DFPRESTART)
+#   define ndfplastref   H4_F77_FUNC(dfplastref, DFPLASTREF)
+
+    HDFFCLIBAPI      FRETVAL(intf) ndpigpal
+                (_fcd filename, _fcd pal, intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndpippal
+                (_fcd filename, _fcd pal, intf  * overwrite, _fcd filemode,
+                 intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndpinpal
+                (_fcd filename, intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndpirref
+                (_fcd filename, intf  * ref, intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndpiwref
+                (_fcd filename, intf  * ref, intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndprest
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndplref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfprestart
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfplastref
+                (void);
+
+/*
+   ** from df24F.c
+ */
+#   define nd2reqil        H4_F77_FUNC(d2reqil, D2REQIL)
+#   define ndf24reqil      H4_F77_FUNC(df24reqil, DF24REQIL)
+#   define nd2sdims        H4_F77_FUNC(d2sdims, D2SDIMS)
+#   define ndf24setdims    H4_F77_FUNC(df24setdims, DF24SETDIMS)
+#   define nd2setil        H4_F77_FUNC(d2setil, D2SETIL)
+#   define ndf24setil      H4_F77_FUNC(df24setil, DF24SETIL)
+#   define nd2first        H4_F77_FUNC(d2first, D2FIRST)
+#   define ndf24restart    H4_F77_FUNC(df24restart, DF24RESTART)
+#   define nd2igdim        H4_F77_FUNC(d2igdim, D2IGDIM)
+#   define nd2igimg        H4_F77_FUNC(d2igimg, D2IGIMG)
+#   define nd2iaimg        H4_F77_FUNC(d2iaimg, D2IAIMG)
+#   define nd2irref        H4_F77_FUNC(d2irref, D2IRREF)
+#   define nd2inimg        H4_F77_FUNC(d2inimg, D2INIMG)
+#   define nd2lref         H4_F77_FUNC(d2lref, D2LREF)
+#   define nd2scomp        H4_F77_FUNC(d2scomp, D2SCOMP)
+#   define ndf24scompress  H4_F77_FUNC(df24scompress, DF24SCOMPRESS)
+#   define nd2sjpeg        H4_F77_FUNC(d2sjpeg, D2SJPEG)
+#   define ndf24sjpeg      H4_F77_FUNC(df24sjpeg, DF24SJPEG)
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2reqil
+                (intf  * il);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2sdims
+                (intf  * xdim, intf  * ydim);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2igdim
+                (_fcd filename, intf  * pxdim, intf  * pydim, intf  * pil,
+                 intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2igimg
+                (_fcd filename, _fcd image, intf  * xdim, intf  * ydim,
+                 intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2iaimg
+                (_fcd filename, _fcd image, intf  * xdim, intf  * ydim,
+                 intf  * fnlen, intf  * newfile);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2setil
+                (intf  * il);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2first
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndf24reqil
+                (intf  * il);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndf24setdims
+                (intf  * xdim, intf  * ydim);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndf24setil
+                (intf  * il);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndf24restart
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2irref
+                (_fcd filename, intf  * ref, intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2inimg
+                (_fcd filename, intf  * fnlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2lref
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2scomp
+                (intf * scheme);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndf24scompress
+                (intf * scheme);
+
+    HDFFCLIBAPI      FRETVAL(intf) nd2sjpeg
+                (intf * quality, intf * force_baseline);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndf24sjpeg
+                (intf * quality, intf * force_baseline);
+
+/*
+   ** from dfF.c
+ */
+#   define ndfiaccess H4_F77_FUNC(dfiaccess, DFIACCESS)
+#   define ndfiopen   H4_F77_FUNC(dfiopen, DFIOPEN)
+#   define ndfclose   H4_F77_FUNC(dfclose, DFCLOSE)
+#   define ndfdesc    H4_F77_FUNC(dfdesc, DFDESC)
+#   define ndfdup     H4_F77_FUNC(dfdup, DFDUP)
+#   define ndfdel     H4_F77_FUNC(dfdel, DFDEL)
+#   define ndfstart   H4_F77_FUNC(dfstart, DFSTART)
+#   define ndfread    H4_F77_FUNC(dfread, DFREAD)
+#   define ndfseek    H4_F77_FUNC(dfseek, DFSEEK)
+#   define ndfwrite   H4_F77_FUNC(dfwrite, DFWRITE)
+#   define ndfupdate  H4_F77_FUNC(dfupdate, DFUPDATE)
+#   define ndfget     H4_F77_FUNC(dfget, DFGET)
+#   define ndfput     H4_F77_FUNC(dfput, DFPUT)
+#   define ndfsfind   H4_F77_FUNC(dfsfind, DFSFIND)
+#   define ndffind    H4_F77_FUNC(dffind, DFFIND)
+#   define ndferrno   H4_F77_FUNC(dferrno, DFERRNO)
+#   define ndfnewref  H4_F77_FUNC(dfnewref, DFNEWREF)
+#   define ndfnumber  H4_F77_FUNC(dfnumber, DFNUMBER)
+#   define ndfstat    H4_F77_FUNC(dfstat, DFSTAT)
+#   define ndfiishdf  H4_F77_FUNC(dfiishdf, DFIISHDF)
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfiopen
+                (_fcd name, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfclose
+                (intf  * dfile);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfdesc
+                (intf  * dfile, intf  ptr[][4], intf  * begin,
+                 intf  * num);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfdup
+                (intf  * dfile, intf  * tag, intf  * ref, intf  * otag,
+                 intf  * oref);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfdel
+                (intf  * dfile, intf  * tag, intf  * ref);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfiaccess
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd acc_mode, intf  * acclen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfstart
+                (intf  * dfile, intf  * tag, intf  * ref, char  * acc_mode);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfread
+                (intf  * dfile, _fcd ptr, intf  * len);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfseek
+                (intf  * dfile, intf  * offset);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfwrite
+                (intf  * dfile, _fcd ptr, intf  * len);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfupdate
+                (intf  * dfile);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfget
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd ptr);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfput
+                (intf  * dfile, intf  * tag, intf  * ref, _fcd ptr, intf  * len);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfsfind
+                (intf  * dfile, intf  * tag, intf  * ref);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndffind
+                (intf  * dfile, intf  * itag, intf  * iref, intf  * len);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndferrno
+                (void);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfnewref
+                (intf  * dfile);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfnumber
+                (intf  * dfile, intf  * tag);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfstat
+                (intf * dfile, DFdata * dfinfo);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfiishdf
+                (_fcd name, intf  * namelen);
+
+/*
+   ** from dfutilF.c
+ */
+#   define ndfindnr          H4_F77_FUNC(dfindnr, DFINDNR)
+#   define ndffindnextref    H4_F77_FUNC(dffindnextref, DFFINDNEXTREF)
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfindnr
+                (intf  * dfile, intf  * tag, intf  * lref);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndffindnextref
+                (intf  * dfile, intf  * tag, intf  * lref);
+
+/*
+   ** from herrF.c
+ */
+#   define nheprnt    H4_F77_FUNC(heprnt, HEPRNT)
+#   define nheprntc   H4_F77_FUNC(heprntc, HEPRNTC)
+#   define nhestringc H4_F77_FUNC(hestringc, HESTRINGC)
+
+    HDFFCLIBAPI      FRETVAL(void) nheprnt
+                (intf  * print_levels);
+
+    HDFFCLIBAPI      FRETVAL(intf) nheprntc
+                (_fcd filename, intf  * print_levels, intf *namelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nhestringc
+				(intf *error_code,_fcd error_message, intf *len);
+/*
+   ** from hfilef.c
+*/
+/* 
+ *  Not all HDF4 Fortran functions are real Fortran functions, they are C wrappers called from a
+ *  Fortran program. Since on Windows we have to have a real Fortran function, additional C wrappers
+ *  were added at the time when Windows port was done for multi-file interfaces: for example, 
+ *  hclose is a C wrapper on UNIX, while on Windows we have two functions: Fortran function hclose
+ *  and C wrapper function hiclose called by hclose   
+ *                                                                                    EIP 2007-09-14
+ */
+#   define nhiopen       H4_F77_FUNC(hiopen, HIOPEN)
+#   define nhclose       H4_F77_FUNC(hclose, HCLOSE)
+#   define nhnumber      H4_F77_FUNC(hnumber, HNUMBER)
+#   define nhxisdir      H4_F77_FUNC(hxisdir, HXISDIR)
+#   define nhxiscdir     H4_F77_FUNC(hxiscdir, HXISCDIR)
+#   define nhddontatexit H4_F77_FUNC(hddontatexit, HDDONTATEXIT)
+#   define nhglibverc    H4_F77_FUNC(hglibverc, HGLIBVERC)
+#   define nhgfilverc    H4_F77_FUNC(hgfilverc, HGFILVERC)
+#   define nhiishdf      H4_F77_FUNC(hiishdf, HIISHDF)
+#   define nhconfinfc    H4_F77_FUNC(hconfinfc, HCONFINFC)
+
+    HDFFCLIBAPI      FRETVAL(intf) nhiopen
+                (_fcd name, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nhclose
+                (intf  * file_id);
+
+    HDFFCLIBAPI	FRETVAL(intf) nhnumber
+		(intf  * file_id, intf  * tag);
+
+    HDFFCLIBAPI	FRETVAL(intf) nhxisdir
+		(_fcd dir, intf * dirlen);
+
+    HDFFCLIBAPI	FRETVAL(intf) nhxiscdir
+		(_fcd dir, intf * dirlen);
+ 
+    HDFFCLIBAPI      FRETVAL(intf)
+                nhddontatexit(void);
+
+    HDFFCLIBAPI      FRETVAL(intf)   
+                nhglibverc(intf *major_v, intf *minor_v, intf *release,
+                _fcd string, intf *len);
+
+    HDFFCLIBAPI      FRETVAL(intf)
+                nhgfilverc(intf *file_id, intf *major_v, intf *minor_v,
+                intf *release, _fcd string, intf *len);
+
+    HDFFCLIBAPI      FRETVAL(intf) nhiishdf
+               (_fcd name, intf  * namelen);
+
+    HDFFCLIBAPI FRETVAL(intf) nhiclose
+               (intf  * file_id);
+               
+    HDFFCLIBAPI	FRETVAL(intf) nhinumbr
+               (int32 file_id, uint16 tag);
+    
+    HDFFCLIBAPI	FRETVAL(intf) nhconfinfc
+               (intf *coder_type, intf *info);
+/*
+   ** from dfufp2im.c
+ */
+#   define nduif2i       H4_F77_FUNC(duif2i, DUIF2I)
+
+    HDFFCLIBAPI      FRETVAL(int) nduif2i
+                (int32  * hdim, int32  * vdim, float32  * max,
+        float32  * min, float32  hscale[], float32  vscale[],
+                 float32  data[], _fcd palette, _fcd outfile,
+              int  * ct_method, int32  * hres, int32  * vres,
+                 int  * compress, int  * lenfn);
+
+    HDFFCLIBAPI int  DFUfptoimage
+                (int32 hdim, int32 vdim, float32 max, float32 min,
+       float32  * hscale, float32  * vscale, float32  * data,
+                 uint8  * palette, char  * outfile, int ct_method,
+                 int32 hres, int32 vres, int compress);
+
+/* for Multi-file fortran Annotation inteface */
+
+/* 
+ *  Not all HDF4 Fortran functions are real Fortran functions, they are C wrappers called from a
+ *  Fortran program. Since on Windows we have to have a real Fortran function, additional C wrappers
+ *  were added at the time when Windows port was done for multi-file interfaces: for example, 
+ *  hclose is a C wrapper on UNIX, while on Windows we have two functions: Fortran function hclose
+ *  and C wrapper function hiclose called by hclose   
+ *                                                                                    EIP 2007-09-14
+ */
+#  define nafstart      H4_F77_FUNC(afstart, AFSTART)
+#  define naffileinfo   H4_F77_FUNC(affileinfo, AFFILEINFO)
+#  define nafend        H4_F77_FUNC(afend, AFEND)
+#  define nafcreate     H4_F77_FUNC(afcreate, AFCREATE)
+#  define naffcreate    H4_F77_FUNC(affcreate, AFFCREATE)
+#  define nafselect     H4_F77_FUNC(afselect, AFSELECT)
+#  define nafnumann     H4_F77_FUNC(afnumann, AFNUMANN)
+#  define nafannlist    H4_F77_FUNC(afannlist, AFANNLIST)
+#  define nafannlen     H4_F77_FUNC(afannlen, AFANNLEN)
+#  define nafwriteann   H4_F77_FUNC(afwriteann, AFWRITEANN)
+#  define nafreadann    H4_F77_FUNC(afreadann, AFREADANN)
+#  define nafendaccess  H4_F77_FUNC(afendaccess, AFENDACCESS)
+#  define nafgettagref  H4_F77_FUNC(afgettagref, AFGETTAGREF)
+#  define nafidtagref   H4_F77_FUNC(afidtagref, AFIDTAGREF)
+#  define naftagrefid   H4_F77_FUNC(aftagrefid, AFTAGREFID)
+#  define nafatypetag   H4_F77_FUNC(afatypetag, AFATYPETAG)
+#  define naftagatype   H4_F77_FUNC(aftagatype, AFTAGATYPE)
+
+/* Multi-file Annotation C-stubs for fortan interface found in mfanf.c */
+
+HDFFCLIBAPI FRETVAL(intf)
+nafstart(intf *file_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+naffileinfo(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel,
+            intf *num_odesc);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafend(intf *an_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafcreate(intf *an_id, intf *etag, intf *eref, intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+naffcreate(intf *an_id, intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafselect(intf *an_id, intf *idx, intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafnumann(intf *an_id, intf *atype, intf *etag, intf *eref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafannlist(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafannlen(intf *ann_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafwriteann(intf *ann_id,_fcd ann, intf *annlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafreadann(intf *ann_id,_fcd ann, intf *maxlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafendaccess(intf *ann_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafgettagref(intf *an_id, intf *idx, intf *type, intf *tag, intf *ref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafidtagref(intf *ann_id, intf *tag, intf *ref);
+
+HDFFCLIBAPI FRETVAL(intf)
+naftagrefid(intf *an_id, intf *tag, intf *ref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafatypetag(intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+naftagatype(intf *tag);
+
+/* if defined Windows */
+/* Multi-file Annotation C-stubs for fortan interface found in mfanf.c */
+
+HDFFCLIBAPI FRETVAL(intf)
+nafistart(intf *file_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafifinf(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel,
+            intf *num_odesc);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafiend(intf *an_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+naficreat(intf *an_id, intf *etag, intf *eref, intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafifcreat(intf *an_id, intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafiselct(intf *an_id, intf *index, intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafinann(intf *an_id, intf *atype, intf *etag, intf *eref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafialst(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafialen(intf *ann_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafiwann(intf *ann_id,_fcd ann, intf *annlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafirann(intf *ann_id,_fcd ann, intf *maxlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafiendac(intf *ann_id);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafigtr(intf *an_id, intf *index, intf *type, intf *tag, intf *ref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafiid2tr(intf *ann_id, intf *tag, intf *ref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafitr2id(intf *an_id, intf *tag, intf *ref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafitp2tg(intf *atype);
+
+HDFFCLIBAPI FRETVAL(intf)
+nafitg2tp(intf *tag);
+
+/* endif defined Windows */
+
+
+/* Multi-file Annotation C-routines found in mfan.c */
+HDFLIBAPI int32 ANstart(int32 file_id);
+
+HDFLIBAPI intn  ANfileinfo(int32 an_id, int32 *n_file_label, int32 *n_file_desc,
+                        int32 *n_obj_label, int32 *n_obj_desc);
+
+HDFLIBAPI int32 ANend(int32 an_id);
+
+HDFLIBAPI int32 ANcreate(int32 an_id, uint16 elem_tag, uint16 elem_ref, 
+                      ann_type type);
+
+HDFLIBAPI int32 ANcreatef(int32 an_id, ann_type type);
+
+HDFLIBAPI int32 ANselect(int32 an_id, int32 idx, ann_type type);
+
+HDFLIBAPI intn  ANnumann(int32 an_id, ann_type type, uint16 elem_tag, 
+                      uint16 elem_ref);
+
+HDFLIBAPI intn  ANannlist(int32 an_id, ann_type type, uint16 elem_tag, 
+                       uint16 elem_ref, int32 ann_list[]);
+
+HDFLIBAPI int32 ANannlen(int32 ann_id);
+
+HDFLIBAPI int32 ANwriteann(int32 ann_id, const char *ann, int32 annlen);
+
+HDFLIBAPI int32 ANreadann(int32 ann_id, char *ann, int32 maxlen);
+
+HDFLIBAPI intn  ANendaccess(int32 ann_id);
+
+HDFLIBAPI int32 ANget_tagref(int32 an_id, int32 idx, ann_type type,
+                          uint16 *ann_tag, uint16 *ann_ref);
+
+HDFLIBAPI int32 ANid2tagref(int32 an_id, uint16 *ann_tag, uint16 *ann_ref);
+
+HDFLIBAPI int32 ANtagref2id(int32 an_id, uint16 ann_tag, uint16 ann_ref);
+
+HDFLIBAPI uint16 ANatype2tag(ann_type atype);
+
+HDFLIBAPI ann_type ANtag2atype(uint16 atag);
+
+/* Removed because this function is meant to be private.
+HDFLIBAPI intn ANdestroy(void); */
+
+/* for Multi-file fortran GR interface */
+/* 
+ *  Not all HDF4 Fortran functions are real Fortran functions, they are C wrappers called from a
+ *  Fortran program. Since on Windows we have to have a real Fortran function, additional C wrappers
+ *  were added at the time when Windows port was done for multi-file interfaces: for example, 
+ *  hclose is a C wrapper on UNIX, while on Windows we have two functions: Fortran function hclose
+ *  and C wrapper function hiclose called by hclose   
+ *                                                                                    EIP 2007-09-14
+ */
+#  define nmgstart         H4_F77_FUNC(mgstart, MGSTART)
+#  define nmgfinfo         H4_F77_FUNC(mgfinfo, MGFINFO)
+#  define nmgend           H4_F77_FUNC(mgend, MGEND)
+#  define nmgicreat        H4_F77_FUNC(mgicreat, MGICREAT)
+#  define nmgselct         H4_F77_FUNC(mgselct, MGSELCT)
+#  define nmgin2ndx        H4_F77_FUNC(mgin2ndx, MGIN2NDX)
+#  define nmggiinf         H4_F77_FUNC(mggiinf, MGGIINF)
+#  define nmgwcimg         H4_F77_FUNC(mgwcimg, MGWCIMG)
+#  define nmgrcimg         H4_F77_FUNC(mgrcimg, MGRCIMG)
+#  define nmgwrimg         H4_F77_FUNC(mgwrimg, MGWRIMG)
+#  define nmgrdimg         H4_F77_FUNC(mgrdimg, MGRDIMG)
+#  define nmgendac         H4_F77_FUNC(mgendac, MGENDAC)
+#  define nmgid2rf         H4_F77_FUNC(mgid2rf, MGID2RF)
+#  define nmgr2idx         H4_F77_FUNC(mgr2idx, MGR2IDX)
+#  define nmgrltil         H4_F77_FUNC(mgrltil, MGRLTIL)
+#  define nmgrimil         H4_F77_FUNC(mgrimil, MGRIMIL)
+#  define nmggltid         H4_F77_FUNC(mggltid, MGGLTID)
+#  define nmgglinf         H4_F77_FUNC(mgglinf, MGGLINF)
+#  define nmgwrlut         H4_F77_FUNC(mgwrlut, MGWRLUT)
+#  define nmgwclut         H4_F77_FUNC(mgwclut, MGWCLUT)
+#  define nmgrdlut         H4_F77_FUNC(mgrdlut, MGRDLUT)
+#  define nmgrclut         H4_F77_FUNC(mgrclut, MGRCLUT)
+#  define nmgisxfil        H4_F77_FUNC(mgisxfil, MGISXFIL)
+#  define nmgiscatt        H4_F77_FUNC(mgiscatt, MGISCATT)
+#  define nmgisattr        H4_F77_FUNC(mgisattr, MGISATTR)
+#  define nmgatinf         H4_F77_FUNC(mgatinf, MGATINF)
+#  define nmggcatt         H4_F77_FUNC(mggcatt, MGGCATT)
+#  define nmggnatt         H4_F77_FUNC(mggnatt, MGGNATT)
+#  define nmggattr         H4_F77_FUNC(mggattr, MGGATTR)
+#  define nmgifndat        H4_F77_FUNC(mgifndat, MGIFNDAT)
+#  define nmgcgichnk        H4_F77_FUNC(mgcgichnk, MGCGICHNK)
+#  define nmgcrcchnk        H4_F77_FUNC(mgcrcchnk, MGCRCCHNK)
+#  define nmgcrchnk         H4_F77_FUNC(mgcrchnk, MGCRCHNK)
+#  define nmgcscchnk        H4_F77_FUNC(mgcscchnk, MGCSCCHNK)
+#  define nmgcschnk         H4_F77_FUNC(mgcschnk, MGCSCHNK)
+#  define nmgcwcchnk        H4_F77_FUNC(mgcwcchnk, MGCWCCHNK)
+#  define nmgcwchnk         H4_F77_FUNC(mgcwchnk, MGCWCHNK)
+#  define nmgcscompress     H4_F77_FUNC(mgcscompress, MGCSCOMPRESS)
+#  define nmgcgcompress     H4_F77_FUNC(mgcgcompress, MGCGCOMPRESS)
+#  define nmglt2rf          H4_F77_FUNC(mglt2rf, MGLT2RF)
+#  define nmgcgnluts        H4_F77_FUNC(mgcgnluts, MGCGNLUTS)
+
+/* Multi-file GR C-stubs for FORTRAN interface found in mfgrf.c */
+
+HDFFCLIBAPI FRETVAL(intf)     /* !sl */
+nmgiwimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data);
+
+HDFFCLIBAPI FRETVAL(intf)     /* !sl */
+nmgirimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data);
+
+HDFFCLIBAPI FRETVAL(intf)     /* !sl */
+nmgignat(intf * riid, intf *idx, VOIDP data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgstart(intf * fid);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgfinfo(intf * grid,intf *n_datasets,intf *n_attrs);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgend(intf * grid);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgicreat(intf * grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[2], intf *nlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgselct(intf * grid, intf *idx);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgin2ndx(intf * grid, _fcd name, intf *nlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmggiinf(intf * riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, intf *nattr);
+
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgwcimg(intf * riid, intf *start, intf *stride, intf *count, _fcd data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgrcimg(intf * riid, intf *start, intf *stride, intf *count, _fcd data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgwrimg(intf * riid, intf *start, intf *stride, intf *count, void * data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgrdimg(intf * riid, intf *start, intf *stride, intf *count, void * data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgendac(intf * riid);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgid2rf(intf * riid);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgr2idx(intf * grid, intf *ref);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgrltil(intf * riid, intf *il);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgrimil(intf * riid, intf *il);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmggltid(intf * riid, intf *lut_index);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgglinf(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgwrlut(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, void * data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgwclut(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgrdlut(intf * lutid, void * data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgrclut(intf * lutid, _fcd data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgisxfil(intf * riid, _fcd filename, intf *offset, intf *nlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgsactp(intf * riid, intf *accesstype);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgiscatt(intf * riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgisattr(intf * riid, _fcd name, intf *nt, intf *count, void * data, intf *nlen);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgatinf(intf * riid, intf *idx, _fcd name, intf *nt, intf *count);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmggcatt(intf * riid, intf *idx, _fcd data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmggnatt(intf * riid, intf *idx, void * data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmggattr(intf * riid, intf *idx, void * data);
+
+HDFFCLIBAPI FRETVAL(intf)
+nmgifndat(intf * riid, _fcd name, intf *nlen);
+
+     HDFFCLIBAPI FRETVAL (intf)
+     nmgcgichnk(intf *id, intf *dim_length, intf *flags);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcrcchnk(intf *id, intf *start, _fcd char_data);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcrchnk(intf *id, intf *start, VOIDP num_data);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcscchnk(intf *id, intf *maxcache, intf *flags);
+
+    HDFFCLIBAPI FRETVAL (intf)
+      nmgcschnk(intf *id, intf *dim_length, intf *comp_type,
+                intf *comp_prm);
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcwcchnk(intf *id, intf *start, _fcd char_data);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcwchnk(intf *id, intf *start, VOIDP num_data);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcscompress(intf *id, intf *comp_type, intf *comp_prm);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcgcompress(intf *id, intf *comp_type, intf *comp_prm);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmglt2rf(intf *id);
+
+    HDFFCLIBAPI FRETVAL (intf)
+       nmgcgnluts(intf *id);
+
+
+/*
+   ** from vgF.c
+ */
+/* 
+ *  Not all HDF4 Fortran functions are real Fortran functions, they are C wrappers called from a
+ *  Fortran program. Since on Windows we have to have a real Fortran function, additional C wrappers
+ *  were added at the time when Windows port was done for multi-file interfaces: for example, 
+ *  hclose is a C wrapper on UNIX, while on Windows we have two functions: Fortran function hclose
+ *  and C wrapper function hiclose called by hclose   
+ *                                                                                    EIP 2007-09-14
+ */
+#   define  ndfivopn       H4_F77_FUNC(dfivopn, DFIVOPN)
+#   define  ndfvclos       H4_F77_FUNC(dfvclos, DFVCLOS)
+#   define  nvatchc        H4_F77_FUNC(vatchc, VATCHC)
+#   define  nvdtchc        H4_F77_FUNC(vdtchc, VDTCHC)
+#   define  nvgnamc        H4_F77_FUNC(vgnamc, VGNAMC)
+#   define  nvgclsc        H4_F77_FUNC(vgclsc, VGCLSC)
+#   define  nvinqc         H4_F77_FUNC(vinqc, VINQC)
+#   define  nvdeletec      H4_F77_FUNC(vdeletec, VDELETEC)
+#   define  nvgidc         H4_F77_FUNC(vgidc, VGIDC)
+#   define  nvgnxtc        H4_F77_FUNC(vgnxtc, VGNXTC)
+#   define  nvsnamc        H4_F77_FUNC(vsnamc, VSNAMC)
+#   define  nvsclsc        H4_F77_FUNC(vsclsc, VSCLSC)
+#   define  nvinsrtc       H4_F77_FUNC(vinsrtc, VINSRTC)
+#   define  nvisvgc        H4_F77_FUNC(visvgc, VISVGC)
+#   define  nvisvsc        H4_F77_FUNC(visvsc, VISVSC)
+#   define  nvsatchc       H4_F77_FUNC(vsatchc, VSATCHC)
+#   define  nvsdtchc       H4_F77_FUNC(vsdtchc, VSDTCHC)
+#   define  nvsqref        H4_F77_FUNC(vsqref, VSQREF)
+#   define  nvsqtag        H4_F77_FUNC(vsqtag, VSQTAG)
+#   define  nvsgver        H4_F77_FUNC(vsgver, VSGVER)
+#   define  nvsseekc       H4_F77_FUNC(vsseekc, VSSEEKC)
+#   define  nvsgnamc       H4_F77_FUNC(vsgnamc, VSGNAMC)
+#   define  nvsgclsc       H4_F77_FUNC(vsgclsc, VSGCLSC)
+#   define  nvsinqc        H4_F77_FUNC(vsinqc, VSINQC)
+#   define  nvsfexc        H4_F77_FUNC(vsfexc, VSFEXC)
+#   define  nvsfndc        H4_F77_FUNC(vsfndc, VSFNDC)
+#   define  nvsgidc        H4_F77_FUNC(vsgidc, VSGIDC)
+#   define  nvsdltc        H4_F77_FUNC(vsdltc, VSDLTC)
+#   define  nvsapp         H4_F77_FUNC(vsapp, VSAPP)
+#   define  nvssnamc       H4_F77_FUNC(vssnamc, VSSNAMC)
+#   define  nvssclsc       H4_F77_FUNC(vssclsc, VSSCLSC)
+#   define  nvssfldc       H4_F77_FUNC(vssfldc, VSSFLDC)
+#   define  nvssintc       H4_F77_FUNC(vssintc, VSSINTC)
+#   define  nvsfdefc       H4_F77_FUNC(vsfdefc, VSFDEFC)
+#   define  nvssextfc      H4_F77_FUNC(vssextfc, VSSEXTFC)
+#   define  nvfnflds       H4_F77_FUNC(vfnflds, VFNFLDS)
+#   define  nvffnamec      H4_F77_FUNC(vffnamec, VFFNAMEC)
+#   define  nvfftype       H4_F77_FUNC(vfftype, VFFTYPE)
+#   define  nvffisiz       H4_F77_FUNC(vffisiz, VFFISIZ)
+#   define  nvffesiz       H4_F77_FUNC(vffesiz, VFFESIZ)
+#   define  nvffordr       H4_F77_FUNC(vffordr, VFFORDR)
+#   define  nvsfrdc        H4_F77_FUNC(vsfrdc, VSFRDC)
+#   define  nvsfrd         H4_F77_FUNC(vsfrd, VSFRD)
+#   define  nvsreadc       H4_F77_FUNC(vsreadc, VSREADC)
+#   define  nvsfwrt        H4_F77_FUNC(vsfwrt, VSFWRT)
+#   define  nvsfwrtc       H4_F77_FUNC(vsfwrtc, VSFWRTC)
+#   define  nvswritc       H4_F77_FUNC(vswritc, VSWRITC)
+#   define  nvsgintc       H4_F77_FUNC(vsgintc, VSGINTC)
+#   define  nvseltsc       H4_F77_FUNC(vseltsc, VSELTSC)
+#   define  nvsgfldc       H4_F77_FUNC(vsgfldc, VSGFLDC)
+#   define  nvssizc        H4_F77_FUNC(vssizc, VSSIZC)
+#   define  nventsc        H4_F77_FUNC(ventsc, VENTSC)
+#   define  nvlonec        H4_F77_FUNC(vlonec, VLONEC)
+#   define  nvslonec       H4_F77_FUNC(vslonec, VSLONEC)
+#   define  nvfindc        H4_F77_FUNC(vfindc, VFINDC)
+#   define  nvfndclsc      H4_F77_FUNC(vfndclsc, VFNDCLSC)
+#   define  nvhscdc        H4_F77_FUNC(vhscdc, VHSCDC)
+#   define  nvhsdc         H4_F77_FUNC(vhsdc, VHSDC)
+#   define  nvhscdmc       H4_F77_FUNC(vhscdmc, VHSCDMC)
+#   define  nvhsdmc        H4_F77_FUNC(vhsdmc, VHSDMC)
+#   define  nvhmkgpc       H4_F77_FUNC(vhmkgpc, VHMKGPC)
+#   define  nvflocc        H4_F77_FUNC(vflocc, VFLOCC)
+#   define  nvinqtrc       H4_F77_FUNC(vinqtrc, VINQTRC)
+#   define  nvntrc         H4_F77_FUNC(vntrc, VNTRC)
+#   define  nvnrefs        H4_F77_FUNC(vnrefs, VNREFS)
+#   define  nvgttrsc       H4_F77_FUNC(vgttrsc, VGTTRSC)
+#   define  nvqref         H4_F77_FUNC(vqref, VQREF)
+#   define  nvqtag         H4_F77_FUNC(vqtag, VQTAG)
+#   define  nvgttrc        H4_F77_FUNC(vgttrc, VGTTRC)
+#   define  nvadtrc        H4_F77_FUNC(vadtrc, VADTRC)
+#   define  nvfstart       H4_F77_FUNC(vfstart, VFSTART)
+#   define  nvfend         H4_F77_FUNC(vfend, VFEND)
+#   define  nvsqfnelt      H4_F77_FUNC(vsqfnelt, VSQFNELT)
+#   define  nvsqfintr      H4_F77_FUNC(vsqfintr, VSQFINTR)
+#   define  nvsqfldsc      H4_F77_FUNC(vsqfldsc, VSQFLDSC)
+#   define  nvsqfvsiz      H4_F77_FUNC(vsqfvsiz, VSQFVSIZ)
+#   define  nvsqnamec      H4_F77_FUNC(vsqnamec, VSQNAMEC)
+#   define  nvsfccpk       H4_F77_FUNC(vsfccpk, VSFCCPK)
+#   define  nvsfncpk       H4_F77_FUNC(vsfncpk, VSFNCPK)
+#   define  nvdtrc         H4_F77_FUNC(vdtrc, VDTRC)
+#   define  nvscfcls       H4_F77_FUNC(vscfcls, VSCFCLS)
+#   define  nvscsetblsz    H4_F77_FUNC(vscsetblsz, VSCSETBLSZ)
+#   define  nvscsetnmbl    H4_F77_FUNC(vscsetnmbl, VSCSETNMBL)
+#   define  nvscgblinfo    H4_F77_FUNC(vscgblinfo, VSCGBLINFO)
+#   define  nvcgvgrp       H4_F77_FUNC(vcgvgrp, VCGVGRP)
+#   define  nvscgvdatas    H4_F77_FUNC(vscgvdatas, VSCGVDATAS)
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfivopn
+                (_fcd filename, intf  * acc_mode, intf  * defdds, intf  * namelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) ndfvclos
+                (intf  * file_id);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvatchc
+                (intf  * f, intf  * vgid, _fcd accesstype);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvdtchc
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvgnamc
+                (intf  * vkey, _fcd vgname);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvgclsc
+                (intf  * vkey, _fcd vgclass);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvinqc
+                (intf  * vkey, intf  * nentries, _fcd vgname);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvdeletec
+                (intf  *f, intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvgidc
+                (intf  * f, intf  * vgid);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvgnxtc
+                (intf  * vkey, intf  * id);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsnamc
+                (intf  * vkey, _fcd vgname, intf  * vgnamelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsclsc
+                (intf  * vkey, _fcd vgclass, intf  * vgclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvinsrtc
+                (intf  * vkey, intf  * vobjptr);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvisvgc
+                (intf  * vkey, intf  * id);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvfstart
+                (intf  * f);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvfend
+                (intf  * f);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvisvsc
+                (intf  * vkey, intf  * id);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsatchc
+                (intf  * f, intf  * vsref, _fcd accesstype);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsdtchc
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsqref
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsqtag
+                (intf  * vkey);
+  
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsgver
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsseekc
+                (intf  * vkey, intf  * eltpos);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsgnamc
+                (intf  * vkey, _fcd vsname, intf *vsnamelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsgclsc
+                (intf  * vkey, _fcd vsclass, intf *vsclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsinqc
+                (intf  * vkey, intf  * nelt, intf  * interlace, _fcd fields,
+		intf  * eltsize, _fcd vsname, intf *fieldslen, intf *vsnamelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfexc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfndc
+                (intf  * f, _fcd name, intf  * namelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsgidc
+                (intf  * f, intf  * vsref);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsdltc
+                (intf  * f, intf  * vsref);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsapp
+                (intf  * vkey, intf  *blk);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvssnamc
+                (intf  * vkey, _fcd vsname, intf  * vsnamelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvssclsc
+                (intf  * vkey, _fcd vsclass, intf  * vsclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvssfldc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvssintc
+                (intf  * vkey, intf  * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfdefc
+                (intf  * vkey, _fcd field, intf  * localtype,
+                 intf  * order, intf  * fieldlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvssextfc
+                (intf  * vkey, _fcd fname, intf  * offset,
+                 intf  * fnamelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvfnflds
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvffnamec
+                (intf  * vkey, intf  *idx, _fcd fname, intf *len);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvfftype
+                (intf  * vkey, intf  *idx);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvffisiz
+                (intf  * vkey, intf  *idx);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvffesiz
+                (intf  * vkey, intf  *idx);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvffordr
+                (intf  * vkey, intf  *idx);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfrdc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfrd
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsreadc
+                (intf  * vkey, uint8  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfwrtc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfwrt
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvswritc
+                (intf  * vkey, uint8  * buf, intf  * nelt,
+                 intf  * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsgintc
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvseltsc
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsgfldc
+                (intf  * vkey, _fcd fields);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvssizc
+                (intf  * vkey, _fcd fields, intf  * fieldslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nventsc
+                (intf  * f, intf  * vgid);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvlonec
+                (intf  * f, intf  * idarray, intf  * asize);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvslonec
+                (intf  * f, intf  * idarray, intf  * asize);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvfindc
+                (intf  * f, _fcd name, intf  * namelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvfndclsc
+                (intf  * f, _fcd vgclass, intf  * classlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvhscdc
+                (intf  * f, _fcd field, _fcd  cbuf, intf  * n, 
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * fieldlen, intf  * vsnamelen,
+                 intf  * vsclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvhsdc
+                (intf  * f, _fcd field, uint8  * buf, intf  * n, 
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * fieldlen, intf  * vsnamelen,
+                 intf  * vsclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvhscdmc
+                (intf  * f, _fcd field, _fcd  cbuf, intf  * n,
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * order, intf  * fieldlen, intf * vsnamelen,
+                 intf  * vsclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvhsdmc
+                (intf  * f, _fcd field, uint8  * buf, intf  * n,
+                 intf  * datatype, _fcd vsname, _fcd vsclass, 
+                 intf  * order, intf  * fieldlen, intf * vsnamelen,
+                 intf  * vsclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvhmkgpc
+                (intf  * f, intf  * tagarray, intf  * refarray, intf  * n,
+                 _fcd vgname, _fcd vgclass, intf  * vgnamelen, intf  * vgclasslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvflocc
+                (intf  * vkey, _fcd field, intf  * fieldlen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvinqtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvntrc
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvnrefs
+                (intf  * vkey, intf  *tag);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvqref
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvqtag
+                (intf  * vkey);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvgttrsc
+                (intf  * vkey, intf  * tagarray, intf  * refarray, intf  * n);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvgttrc
+                (intf  * vkey, intf  * which, intf  * tag, intf  * ref);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvadtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvdtrc
+                (intf  * vkey, intf  * tag, intf  * ref);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsqfnelt
+                (intf * vkey, intf * nelt);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsqfintr
+                (intf * vkey, intf * interlace);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsqfldsc
+                (intf * vkey, _fcd fields, intf *fieldslen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsqfvsiz
+                (intf * vkey, intf * size);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsqnamec  
+                (intf * vkey, _fcd name, intf *namelen);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfccpk
+                (intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz,
+        intf *nrecs, _fcd pckfld, _fcd fldbuf, intf *buflds_len, intf *fld_len);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvsfncpk
+                (intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz,
+        intf *nrecs, _fcd pckfld, intf *fldbuf, intf *buflds_len, intf *fld_len);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvscsetblsz
+                (intf *id, intf *block_size);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvscsetnmbl
+                (intf *id, intf *num_blocks);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvscgblinfo
+                (intf *id, intf *block_size, intf *num_blocks);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvcgvgrp
+                (intf *id, intf *start_vg, intf *vg_count, intf *refarray);
+
+    HDFFCLIBAPI      FRETVAL(intf) nvscgvdatas
+                (intf *id, intf *start_vd, intf *vd_count, intf *refarray);
+
+     HDFFCLIBAPI FRETVAL(intf) nvscfcls
+                (intf  * id, _fcd name, intf  * namelen);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfistart
+                (intf  * f);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfiend
+                (intf  * f);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsiqref
+                (intf  * vkey);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsiqtag
+                (intf  * vkey);
+  
+     HDFFCLIBAPI FRETVAL(intf) nvsigver
+                (intf  * vkey);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfinflds
+                (intf  * vkey);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfifnm
+                (intf  * vkey, intf  *index, _fcd fname);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfiftp
+                (intf  * vkey, intf  *index);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfifisz
+                (intf  * vkey, intf  *index);
+     HDFFCLIBAPI FRETVAL(intf) nvfifesz
+                (intf  * vkey, intf  *index);
+     HDFFCLIBAPI FRETVAL(intf) nvfifodr
+                (intf  * vkey, intf  *index);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsfirdc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsfird
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsfiwrc
+                (intf  * vkey, _fcd  cbuf, intf  * nelt,
+                 intf  * interlace);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsfiwr
+                (intf  * vkey, intf  * buf, intf  * nelt,
+                 intf  * interlace);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfirefs
+                (intf  * vkey, intf  *tag);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfiqref
+                (intf  * vkey);
+
+     HDFFCLIBAPI FRETVAL(intf) nvfiqtag
+                (intf  * vkey);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsiqnelt
+                (intf * vkey, intf *nelt);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsiqintr
+                (intf * vkey, intf *interlace);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsqfldsc
+                (intf * vkey, _fcd fields, intf *fieldslen);
+
+     HDFFCLIBAPI FRETVAL(intf) nvsiqvsz
+                (intf * vkey, intf *ret_size);
+
+ /* 
+  ** from vattrf.c
+  */
+/* 
+ *  Not all HDF4 Fortran functions are real Fortran functions, they are C wrappers called from a
+ *  Fortran program. Since on Windows we have to have a real Fortran function, additional C wrappers
+ *  were added at the time when Windows port was done for multi-file interfaces: for example, 
+ *  hclose is a C wrapper on UNIX, while on Windows we have two functions: Fortran function hclose
+ *  and C wrapper function hiclose called by hclose   
+ *                                                                                    EIP 2007-09-14
+ */
+#  define nvsfcfdx   H4_F77_FUNC(vsfcfdx, VSFCFDX)
+#  define nvsfcsat   H4_F77_FUNC(vsfcsat, VSFCSAT)
+#  define nvsfcsca   H4_F77_FUNC(vsfcsca, VSFCSCA)
+#  define nvsfnats   H4_F77_FUNC(vsfnats, VSFNATS)
+#  define nvsffnas   H4_F77_FUNC(vsffnas, VSFFNAS)
+#  define nvsfcfda   H4_F77_FUNC(vsfcfda, VSFCFDA)
+#  define nvsfcain   H4_F77_FUNC(vsfcain, VSFCAIN)
+#  define nvsfgnat   H4_F77_FUNC(vsfgnat, VSFGNAT)
+#  define nvsfgcat   H4_F77_FUNC(vsfgcat, VSFGCAT)
+#  define nvsfisat   H4_F77_FUNC(vsfisat, VSFISAT)
+#  define nvfcsatt   H4_F77_FUNC(vfcsatt, VFCSATT)
+#  define nvfcscat   H4_F77_FUNC(vfcscat, VFCSCAT)
+#  define nvfnatts   H4_F77_FUNC(vfnatts, VFNATTS)
+#  define nvfcfdat   H4_F77_FUNC(vfcfdat, VFCFDAT)
+#  define nvfainfo   H4_F77_FUNC(vfainfo, VFAINFO)
+#  define nvfgnatt   H4_F77_FUNC(vfgnatt, VFGNATT)
+#  define nvfgcatt   H4_F77_FUNC(vfgcatt, VFGCATT)
+#  define nvfgver    H4_F77_FUNC(vfgver,  VFGVER)
+
+   HDFFCLIBAPI   FRETVAL(intf) nvsfcfdx
+            (intf *vsid, _fcd fldnm, intf *findex, intf *fldnmlen);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfcsat
+            (intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+             intf *count, intf *values, intf *attrnmlen);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfcsca
+            (intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+             intf *count, _fcd values, intf *attrnmlen);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfnats
+            (intf *vsid);
+   HDFFCLIBAPI   FRETVAL(intf) nvsffnas
+            (intf *vsid, intf *findex);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfcfda
+            (intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfcain
+            (intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size, intf *attrnamelen);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfgnat
+            (intf *vsid, intf *findex, intf *aindex, intf *values);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfgcat
+            (intf *vsid, intf *findex, intf *aindex, _fcd values);
+   HDFFCLIBAPI   FRETVAL(intf) nvsfisat
+            (intf *vsid);
+   HDFFCLIBAPI   FRETVAL(intf) nvfcsatt
+            (intf *vgid, _fcd attrnm, intf *dtype,
+             intf *count, intf *values, intf *attrnmlen);
+   HDFFCLIBAPI   FRETVAL(intf) nvfcscat
+            (intf *vgid, _fcd attrnm, intf *dtype, intf *count,
+             _fcd values, intf *attrnmlen);
+   HDFFCLIBAPI   FRETVAL(intf) nvfnatts
+            (intf *vgid);
+   HDFFCLIBAPI   FRETVAL(intf) nvfcfdat
+            (intf *vgid, _fcd attrnm, intf *attrnmlen);
+   HDFFCLIBAPI   FRETVAL(intf) nvfainfo
+            (intf *vgid, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+   HDFFCLIBAPI   FRETVAL(intf) nvfgnatt
+            (intf *vgid, intf *aindex, intf *values);
+   HDFFCLIBAPI   FRETVAL(intf) nvfgcatt
+            (intf *vgid, intf *aindex, _fcd values);
+   HDFFCLIBAPI   FRETVAL(intf) nvfgver
+            (intf *vgid);
+
+/* Added for windows */
+   HDFFCLIBAPI FRETVAL(intf) nvsfainf
+            (intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+  
+   HDFFCLIBAPI FRETVAL(intf) nvsfcnats
+            (intf *vsid);
+
+   HDFFCLIBAPI FRETVAL(intf) nvsfcfnas
+            (intf *vsid, intf *findex);
+   
+   HDFFCLIBAPI FRETVAL(intf) nvsfcainf
+            (intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+
+   HDFFCLIBAPI FRETVAL(intf) nvsfcgna
+            (intf *vsid, intf *findex, intf *aindex, intf *values);
+
+   HDFFCLIBAPI FRETVAL(intf) nvsfcgca
+            (intf *vsid, intf *findex, intf *aindex, _fcd values);
+
+   HDFFCLIBAPI FRETVAL(intf) nvsfcisa
+            (intf *vsid);
+
+   HDFFCLIBAPI FRETVAL(intf) nvfcnats
+            (intf *vgid);
+
+   HDFFCLIBAPI FRETVAL(intf) nvfcainf
+            (intf *vgid, intf *aindex, _fcd attrname,
+             intf *dtype, intf *count, intf *size);
+
+   HDFFCLIBAPI FRETVAL(intf) nvfcgnat
+            (intf *vgid, intf *aindex, intf *values);
+
+   HDFFCLIBAPI FRETVAL(intf) nvfcgcat
+            (intf *vgid, intf *aindex, _fcd values);
+
+   HDFFCLIBAPI FRETVAL(intf) nvfcgver
+            (intf *vgid);
+/* End of windows */
+
+
+/* 
+  ** from dfufp2i.c
+ */
+
+#   define nduif2i       H4_F77_FUNC(duif2i, DUIF2I)
+
+    HDFFCLIBAPI   FRETVAL(int) nduif2i
+             (int32 *hdim, int32 *vdim, float32 *max, float32 *min, float32 hscale[],
+              float32 vscale[], float32 data[], _fcd palette, _fcd outfile,
+              int *ct_method, int32 *hres, int32 *vres, int *compress, int *lenfn);
+
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* _H_PROTO_FORTRAN */
+
diff --git a/hdf/src/hqueue.h b/hdf/src/hqueue.h
new file mode 100644
index 0000000..f71c7ab
--- /dev/null
+++ b/hdf/src/hqueue.h
@@ -0,0 +1,257 @@
+/* 
+ * Copyright (c) 1991, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	@(#)queue.h	8.3 (Berkeley) 12/13/93
+ */
+
+/*****************************************************************************
+ * File: hqueue.h
+ *
+ * This is a modfied version of the original Berkley code for
+ * manipulating a memory pool. This version however is not 
+ * compatible with the original Berkley version.
+ *
+ * Author: George V.- 9/3/96
+ *
+ *****************************************************************************/ 
+
+/* $Id: hqueue.h 5146 2009-01-14 17:46:57Z fbaker $ */
+
+#ifndef	_HQUEUE_H_
+#define	_HQUEUE_H_
+
+/*
+ * This file defines three types of data structures: lists, tail queues,
+ * and circular queues.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list after
+ * an existing element or at the head of the list. A list may only be
+ * traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A tail queue may only be traversed in the forward direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ * (BSD4.3 manual set - GeorgeV)
+ * 
+ */
+
+/*
+ * List definitions.
+ */
+#define LIST_HEAD(name, type)						\
+struct name {								\
+	struct type *lh_first;	/* first element */			\
+}
+
+#define LIST_ENTRY(type)						\
+struct {								\
+	struct type *le_next;	/* next element */			\
+	struct type **le_prev;	/* address of previous next element */	\
+}
+
+/*
+ * List functions.
+ */
+#define	LIST_INIT(head) {						\
+	(head)->lh_first = NULL;					\
+}
+
+#define LIST_INSERT_AFTER(listelm, elm, field) {			\
+	if (((elm)->field.le_next = (listelm)->field.le_next) != NULL)	\
+		(listelm)->field.le_next->field.le_prev =		\
+		    &(elm)->field.le_next;				\
+	(listelm)->field.le_next = (elm);				\
+	(elm)->field.le_prev = &(listelm)->field.le_next;		\
+}
+
+#define LIST_INSERT_HEAD(head, elm, field) {				\
+	if (((elm)->field.le_next = (head)->lh_first) != NULL)		\
+		(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+	(head)->lh_first = (elm);					\
+	(elm)->field.le_prev = &(head)->lh_first;			\
+}
+
+#define LIST_REMOVE(elm, field) {					\
+	if ((elm)->field.le_next != NULL)				\
+		(elm)->field.le_next->field.le_prev = 			\
+		    (elm)->field.le_prev;				\
+	*(elm)->field.le_prev = (elm)->field.le_next;			\
+}
+
+
+/*
+ * Tail queue definitions.
+ */
+#define TAILQ_HEAD(name, type)						\
+struct name {								\
+	struct type *tqh_first;	/* first element */			\
+	struct type **tqh_last;	/* addr of last next element */		\
+}
+
+#define TAILQ_ENTRY(type)						\
+struct {								\
+	struct type *tqe_next;	/* next element */			\
+	struct type **tqe_prev;	/* address of previous next element */	\
+}
+
+/*
+ * Tail queue functions.
+ */
+#define	TAILQ_INIT(head) {						\
+	(head)->tqh_first = NULL;					\
+	(head)->tqh_last = &(head)->tqh_first;				\
+}
+
+#define TAILQ_INSERT_HEAD(head, elm, field) {				\
+	if (((elm)->field.tqe_next = (head)->tqh_first) != NULL)	\
+		(elm)->field.tqe_next->field.tqe_prev =			\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(head)->tqh_first = (elm);					\
+	(elm)->field.tqe_prev = &(head)->tqh_first;			\
+}
+
+#define TAILQ_INSERT_TAIL(head, elm, field) {				\
+	(elm)->field.tqe_next = NULL;					\
+	(elm)->field.tqe_prev = (head)->tqh_last;			\
+	*(head)->tqh_last = (elm);					\
+	(head)->tqh_last = &(elm)->field.tqe_next;			\
+}
+
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) {			\
+	if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    &(elm)->field.tqe_next;				\
+	else								\
+		(head)->tqh_last = &(elm)->field.tqe_next;		\
+	(listelm)->field.tqe_next = (elm);				\
+	(elm)->field.tqe_prev = &(listelm)->field.tqe_next;		\
+}
+
+#define TAILQ_REMOVE(head, elm, field) {				\
+	if (((elm)->field.tqe_next) != NULL)				\
+		(elm)->field.tqe_next->field.tqe_prev = 		\
+		    (elm)->field.tqe_prev;				\
+	else								\
+		(head)->tqh_last = (elm)->field.tqe_prev;		\
+	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
+}
+
+/*
+ * Circular queue definitions.
+ */
+#define CIRCLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *cqh_first;		/* first element */		\
+	struct type *cqh_last;		/* last element */		\
+}
+
+#define CIRCLEQ_ENTRY(type)						\
+struct {								\
+	struct type *cqe_next;		/* next element */		\
+	struct type *cqe_prev;		/* previous element */		\
+}
+
+/*
+ * Circular queue functions.
+ */
+#define	CIRCLEQ_INIT(head) {						\
+	(head)->cqh_first = (void *)(head);				\
+	(head)->cqh_last = (void *)(head);				\
+}
+
+#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) {		\
+	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
+	(elm)->field.cqe_prev = (listelm);				\
+	if ((listelm)->field.cqe_next == (void *)(head))		\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
+	(listelm)->field.cqe_next = (elm);				\
+}
+
+#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) {		\
+	(elm)->field.cqe_next = (listelm);				\
+	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
+	if ((listelm)->field.cqe_prev == (void *)(head))		\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
+	(listelm)->field.cqe_prev = (elm);				\
+}
+
+#define CIRCLEQ_INSERT_HEAD(head, elm, field) {				\
+	(elm)->field.cqe_next = (head)->cqh_first;			\
+	(elm)->field.cqe_prev = (void *)(head);				\
+	if ((head)->cqh_last == (void *)(head))				\
+		(head)->cqh_last = (elm);				\
+	else								\
+		(head)->cqh_first->field.cqe_prev = (elm);		\
+	(head)->cqh_first = (elm);					\
+}
+
+#define CIRCLEQ_INSERT_TAIL(head, elm, field) {				\
+	(elm)->field.cqe_next = (void *)(head);				\
+	(elm)->field.cqe_prev = (head)->cqh_last;			\
+	if ((head)->cqh_first == (void *)(head))			\
+		(head)->cqh_first = (elm);				\
+	else								\
+		(head)->cqh_last->field.cqe_next = (elm);		\
+	(head)->cqh_last = (elm);					\
+}
+
+#define	CIRCLEQ_REMOVE(head, elm, field) {				\
+	if ((elm)->field.cqe_next == (void *)(head))			\
+		(head)->cqh_last = (elm)->field.cqe_prev;		\
+	else								\
+		(elm)->field.cqe_next->field.cqe_prev =			\
+		    (elm)->field.cqe_prev;				\
+	if ((elm)->field.cqe_prev == (void *)(head))			\
+		(head)->cqh_first = (elm)->field.cqe_next;		\
+	else								\
+		(elm)->field.cqe_prev->field.cqe_next =			\
+		    (elm)->field.cqe_next;				\
+}
+#endif	/* !_HQUEUE_H_ */
diff --git a/hdf/src/htags.h b/hdf/src/htags.h
new file mode 100644
index 0000000..8ce8874
--- /dev/null
+++ b/hdf/src/htags.h
@@ -0,0 +1,137 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: htags.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*+ htags.h
+   *** This file contains all the tag definitions for HDF
+   + */
+
+#ifndef _HTAGS_H
+#define _HTAGS_H
+
+/* wild-card tags and refs. Should only be used in interface calls
+   and never stored in the file i.e. in DD's. */
+#define DFREF_WILDCARD      0
+#define DFTAG_WILDCARD      0
+
+#define DFREF_NONE          0  /* used by mfhdf/libsrc/putget.c */
+/* tags and refs */
+#define DFTAG_NULL          1
+#define DFTAG_LINKED        20  /* linked-block special element */
+#define DFTAG_VERSION       30
+#define DFTAG_COMPRESSED    40  /* compressed special element */
+#define DFTAG_VLINKED       50  /* variable-len linked-block header */
+#define DFTAG_VLINKED_DATA  51  /* variable-len linked-block data */
+#define DFTAG_CHUNKED       60  /* chunked special element header
+                                   (for expansion, not used )*/
+#define DFTAG_CHUNK         61  /* chunk element */
+
+/* utility set */
+#define DFTAG_FID   ((uint16)100)   /* File identifier */
+#define DFTAG_FD    ((uint16)101)   /* File description */
+#define DFTAG_TID   ((uint16)102)   /* Tag identifier */
+#define DFTAG_TD    ((uint16)103)   /* Tag descriptor */
+#define DFTAG_DIL   ((uint16)104)   /* data identifier label */
+#define DFTAG_DIA   ((uint16)105)   /* data identifier annotation */
+#define DFTAG_NT    ((uint16)106)   /* number type */
+#define DFTAG_MT    ((uint16)107)   /* machine type */
+#define DFTAG_FREE  ((uint16)108)   /* free space in the file */
+
+/* raster-8 set */
+#define DFTAG_ID8   ((uint16)200)   /* 8-bit Image dimension */
+#define DFTAG_IP8   ((uint16)201)   /* 8-bit Image palette */
+#define DFTAG_RI8   ((uint16)202)   /* Raster-8 image */
+#define DFTAG_CI8   ((uint16)203)   /* RLE compressed 8-bit image */
+#define DFTAG_II8   ((uint16)204)   /* IMCOMP compressed 8-bit image */
+
+/* Raster Image set */
+#define DFTAG_ID    ((uint16)300)   /* Image DimRec */
+#define DFTAG_LUT   ((uint16)301)   /* Image Palette */
+#define DFTAG_RI    ((uint16)302)   /* Raster Image */
+#define DFTAG_CI    ((uint16)303)   /* Compressed Image */
+#define DFTAG_NRI   ((uint16)304)   /* New-format Raster Image */
+
+#define DFTAG_RIG   ((uint16)306)   /* Raster Image Group */
+#define DFTAG_LD    ((uint16)307)   /* Palette DimRec */
+#define DFTAG_MD    ((uint16)308)   /* Matte DimRec */
+#define DFTAG_MA    ((uint16)309)   /* Matte Data */
+#define DFTAG_CCN   ((uint16)310)   /* color correction */
+#define DFTAG_CFM   ((uint16)311)   /* color format */
+#define DFTAG_AR    ((uint16)312)   /* aspect ratio */
+
+#define DFTAG_DRAW  ((uint16)400)   /* Draw these images in sequence */
+#define DFTAG_RUN   ((uint16)401)   /* run this as a program/script */
+
+#define DFTAG_XYP   ((uint16)500)   /* x-y position */
+#define DFTAG_MTO   ((uint16)501)   /* machine-type override */
+
+/* Tektronix */
+#define DFTAG_T14   ((uint16)602)   /* TEK 4014 data */
+#define DFTAG_T105  ((uint16)603)   /* TEK 4105 data */
+
+/* Scientific Data set */
+/*
+   Objects of tag 721 are never actually written to the file.  The tag is
+   needed to make things easier mixing DFSD and SD style objects in the
+   same file
+ */
+#define DFTAG_SDG   ((uint16)700)   /* Scientific Data Group */
+#define DFTAG_SDD   ((uint16)701)   /* Scientific Data DimRec */
+#define DFTAG_SD    ((uint16)702)   /* Scientific Data */
+#define DFTAG_SDS   ((uint16)703)   /* Scales */
+#define DFTAG_SDL   ((uint16)704)   /* Labels */
+#define DFTAG_SDU   ((uint16)705)   /* Units */
+#define DFTAG_SDF   ((uint16)706)   /* Formats */
+#define DFTAG_SDM   ((uint16)707)   /* Max/Min */
+#define DFTAG_SDC   ((uint16)708)   /* Coord sys */
+#define DFTAG_SDT   ((uint16)709)   /* Transpose */
+#define DFTAG_SDLNK ((uint16)710)   /* Links related to the dataset */
+#define DFTAG_NDG   ((uint16)720)   /* Numeric Data Group */
+                  /* tag 721 reserved chouck 24-Nov-93 */
+#define DFTAG_CAL   ((uint16)731)   /* Calibration information */
+#define DFTAG_FV    ((uint16)732)   /* Fill Value information */
+#define DFTAG_BREQ  ((uint16)799)   /* Beginning of required tags   */
+#define DFTAG_SDRAG ((uint16)781)   /* List of ragged array line lengths */
+#define DFTAG_EREQ  ((uint16)780)   /* Current end of the range   */
+
+/* VSets */
+#define DFTAG_VG     ((uint16)1965)     /* Vgroup */
+#define DFTAG_VH     ((uint16)1962)     /* Vdata Header */
+#define DFTAG_VS     ((uint16)1963)     /* Vdata Storage */
+
+/* compression schemes */
+#define DFTAG_RLE       ((uint16)11)    /* run length encoding */
+#define DFTAG_IMC       ((uint16)12)    /* IMCOMP compression alias */
+#define DFTAG_IMCOMP    ((uint16)12)    /* IMCOMP compression */
+#define DFTAG_JPEG      ((uint16)13)    /* JPEG compression (24-bit data) */
+#define DFTAG_GREYJPEG  ((uint16)14)    /* JPEG compression (8-bit data) */
+#define DFTAG_JPEG5     ((uint16)15)    /* JPEG compression (24-bit data) */
+#define DFTAG_GREYJPEG5 ((uint16)16)    /* JPEG compression (8-bit data) */
+
+/* Interlace schemes */
+#define DFIL_PIXEL   0  /* Pixel Interlacing */
+#define DFIL_LINE    1  /* Scan Line Interlacing */
+#define DFIL_PLANE   2  /* Scan Plane Interlacing */
+
+/* SPECIAL CODES */
+#define SPECIAL_LINKED 1    /* Fixed-size Linked blocks */
+#define SPECIAL_EXT 2       /* External */
+#define SPECIAL_COMP 3      /* Compressed */
+#define SPECIAL_VLINKED 4   /* Variable-length linked blocks */
+#define SPECIAL_CHUNKED 5   /* chunked element */
+#define SPECIAL_BUFFERED 6  /* Buffered element */
+#define SPECIAL_COMPRAS 7   /* Compressed Raster element */
+
+#endif /* _HTAGS_H */
+
diff --git a/hdf/src/linklist.c b/hdf/src/linklist.c
new file mode 100644
index 0000000..7249309
--- /dev/null
+++ b/hdf/src/linklist.c
@@ -0,0 +1,500 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: linklist.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+FILE
+    linklist.c - Internal storage routines for handling generic linked lists
+
+REMARKS
+    Generic linked lists are used in several places in the HDF library when
+    a variable number of items are needed to be kept track of without the
+    additional overhead of a threaded binary tree.  The linked list can be
+    either sorted or un-sorted, chosen at creation time.  The interface allows
+    objects (void *'s currently) to be stored and searched and interated
+    through in a fairly easy manner
+
+DESIGN
+    The lists are stored in a singly-linked list of node, each containing
+    a pointer to a managed object.  The list may be sorted or unsorted, based
+    on the comparison function.
+
+BUGS/LIMITATIONS
+
+LOCAL ROUTINES
+    HULIget_list_node - Gets a list node
+    HULIrelease_list_node - Releases a list node
+EXPORTED ROUTINES
+    HULcreate_list  - Create a new linked list
+    HULdestroy_list - Destroys a linked list
+    HULadd_node     - Adds an object to a linked-list
+    HULsearch_node  - Search for an object in a linked-list
+    HULfirst_node   - Get the first object in a linked-list
+    HULnext_node    - Get the next object in a linked-list
+    HULremove_node  - Removes an object from a linked-list
+    HULshutdown     - Close down the HUL interface
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   2/5/96  - Starting writing specs & coding prototype
+   2/12/96  - Finished writing specs & coding prototype, start testing
+*/
+
+#define LIST_MASTER
+#include "hdf.h"
+#include "linklist.h"
+
+
+/* Private function prototypes */
+static node_info_t *HULIget_list_node(void);
+static void HULIrelease_list_node(node_info_t *nod);
+
+/******************************************************************************
+ NAME
+     HULcreate_list - Create a linked list
+
+ DESCRIPTION
+    Creates a linked list.  The list may either be sorted or un-sorted, based
+    on the comparison function.
+
+ RETURNS
+    Returns a pointer to the list if successful and NULL otherwise
+
+*******************************************************************************/
+list_head_t *HULcreate_list(HULfind_func_t find_func    /* IN: object comparison function */
+)
+{
+    CONSTR(FUNC, "HULcreate_list");	/* for HERROR */
+    list_head_t *ret_value=NULL;     /* ptr to the linked list "head" node */
+
+    HEclear();
+
+    /* Allocate the head information */
+    if((ret_value=(list_head_t *)HDcalloc(1,sizeof(list_head_t)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+
+    /* Set the counter */
+    ret_value->count=0;
+
+    /* Store the creation flags, etc */
+    if(find_func==NULL)
+        ret_value->flags=HUL_UNSORTED_LIST;
+    else
+        ret_value->flags=HUL_SORTED_LIST;
+    ret_value->cmp_func=find_func;
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HULcreate_list() */
+
+/******************************************************************************
+ NAME
+     HULdestroy_list - Destroys a linked list
+
+ DESCRIPTION
+    Destroys a linked list created by HULcreate_list().  This function
+    walks through the list and frees all the nodes, then frees the list head.
+    Note: this function does not (currently) free the objects in the nodes,
+    it just leaves 'em hanging.
+
+ RETURNS
+    Returns SUCCEED/FAIL.
+
+*******************************************************************************/
+intn HULdestroy_list(list_head_t *lst    /* IN: list to destroy */
+)
+{
+    CONSTR(FUNC, "HULdestroy_list");	/* for HERROR */
+    node_info_t *curr_node,         /* current node while walking through list */
+        *next_node;                 /* next node in the list */
+    intn ret_value=SUCCEED;         /* return value */
+
+    HEclear();
+    if(lst==NULL)
+        HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* Chuck the list */
+    curr_node=lst->node_list;
+    while(curr_node!=NULL)
+      {
+          next_node=curr_node->next;
+          HULIrelease_list_node(curr_node);
+          curr_node=next_node;
+      } /* end while */
+
+    /* Chuck the list-head */
+    HDfree(lst);
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HULdestroy_list() */
+
+/******************************************************************************
+ NAME
+     HULadd_node - Adds an object to a linked-list
+
+ DESCRIPTION
+    Adds an object to the linked list.  If the list is sorted, the comparison
+    function is used to determine where to insert the node, otherwise it is
+    inserted at the head of the list.
+
+ RETURNS
+    Returns SUCCEED/FAIL.
+
+*******************************************************************************/
+intn HULadd_node(list_head_t *lst,  /* IN: list to modify */
+    VOIDP obj                       /* IN: object to add to the list */
+)
+{
+    CONSTR(FUNC, "HULadd_node");	/* for HERROR */
+    node_info_t *new_node;          /* new node to insert into the list */
+    intn ret_value=SUCCEED;         /* return value */
+
+    HEclear();
+    if(lst==NULL || obj==NULL)
+        HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* Allocate & initialize the new node */
+    if((new_node=HULIget_list_node())==NULL)
+        HGOTO_ERROR(DFE_NOSPACE,FAIL);
+    new_node->obj_ptr=obj;
+
+    if(((lst->flags)&HUL_SORTED_LIST)!=0)
+      { /* insert node into a sorted list */
+        node_info_t *curr_node,         /* current node while walking through list */
+            *prev_node;                 /* previous node in the list */
+
+        prev_node=NULL;
+        curr_node=lst->node_list;
+        while(curr_node!=NULL)
+          {
+            if(lst->cmp_func(curr_node->obj_ptr,new_node->obj_ptr)>=0)
+              { /* 'curr_node' object is greater than or equal to 'new_node' */
+                new_node->next=curr_node;
+                if(prev_node==NULL)
+                    lst->node_list=new_node;
+                else
+                    prev_node->next=new_node;
+                HGOTO_DONE(SUCCEED);  /* Break out of the loop */
+              } /* end if */
+            prev_node=curr_node;
+            curr_node=curr_node->next;
+          } /* end while */
+
+        /* Walked off the list, so append to last node */
+        if(prev_node==NULL)
+            lst->node_list=new_node;
+        else
+            prev_node->next=new_node;
+      } /* end if */
+    else
+      { /* insert node into an un-sorted list */
+        new_node->next=lst->node_list;
+        lst->node_list=new_node;
+      } /* end else */
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HULadd_node() */
+
+/******************************************************************************
+ NAME
+     HULsearch_node - Search for an object in a linked-list
+
+ DESCRIPTION
+    Locate an object in a linked list using a key and comparison function.
+
+ RETURNS
+    Returns a pointer to the object found in the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULsearch_node(list_head_t *lst,  /* IN: list to search */
+    HULsearch_func_t srch_func,       /* IN: function to use to find node */
+    VOIDP key                       /* IN: key of object to search for */
+)
+{
+    CONSTR(FUNC, "HULsearch_node");	/* for HERROR */
+    node_info_t *curr_node;         /* current node we are on */
+    VOIDP ret_value=NULL;           /* default return value */
+
+    HEclear();
+    if(lst==NULL || srch_func==NULL || key==NULL)
+        HGOTO_ERROR(DFE_ARGS,NULL);
+
+    curr_node=lst->node_list;
+    while(curr_node!=NULL)
+      {
+        if(srch_func(curr_node->obj_ptr,key)==1)
+            HGOTO_DONE(curr_node->obj_ptr);
+      } /* end while */
+
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HULsearch_node() */
+
+/******************************************************************************
+ NAME
+     HULfirst_node - Get the first object in a linked-list
+
+ DESCRIPTION
+    Returns the first object in a linked-list and prepares the list for
+    interating through.
+
+ RETURNS
+    Returns a pointer to the first object found in the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULfirst_node(list_head_t *lst   /* IN: list to search */
+)
+{
+    CONSTR(FUNC, "HULfirst_node");	/* for HERROR */
+    VOIDP ret_value=NULL;           /* default return value */
+
+    HEclear();
+    if(lst==NULL)
+        HGOTO_ERROR(DFE_ARGS,NULL);
+
+    if(lst->node_list!=NULL)
+      {
+        lst->curr_node=lst->node_list;
+        HGOTO_DONE(lst->node_list->obj_ptr);
+      } /* end if */
+
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HULfirst_node() */
+
+/******************************************************************************
+ NAME
+     HULnext_node - Get the next object in a linked-list
+
+ DESCRIPTION
+    Returns the next object in a linked-list by walking through the list
+
+ RETURNS
+    Returns a pointer to the next object found in the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULnext_node(list_head_t *lst   /* IN: list to search */
+)
+{
+    CONSTR(FUNC, "HULnext_node");	/* for HERROR */
+    VOIDP ret_value=NULL;           /* default return value */
+
+    HEclear();
+    if(lst==NULL)
+        HGOTO_ERROR(DFE_ARGS,NULL);
+
+    if(lst->curr_node!=NULL)
+      {
+        lst->curr_node=lst->curr_node->next;
+        if(lst->curr_node!=NULL)
+            HGOTO_DONE(lst->curr_node->obj_ptr);
+      } /* end if */
+
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HULnext_node() */
+
+/******************************************************************************
+ NAME
+     HULremove_node - Removes an object from a linked-list
+
+ DESCRIPTION
+    Remove an object from a linked list.  The key and comparison function are
+    provided locate the object to delete.
+
+ RETURNS
+    Returns a pointer to the object deleted from the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULremove_node(list_head_t *lst,  /* IN: list to modify */
+    HULsearch_func_t srch_func,     /* IN: function to use to find node to remove */
+    VOIDP key                       /* IN: object to add to the list */
+)
+{
+    CONSTR(FUNC, "HULremove_node");	/* for HERROR */
+    node_info_t *curr_node,         /* current node we are on */
+        *prev_node;                 /* previous node we looked at */
+    VOIDP ret_value=NULL;           /* default return value */
+
+    HEclear();
+    if(lst==NULL || srch_func==NULL || key==NULL)
+        HGOTO_ERROR(DFE_ARGS,NULL);
+
+    prev_node=NULL;
+    curr_node=lst->node_list;
+    while(curr_node!=NULL)
+      {
+        if(srch_func(curr_node->obj_ptr,key)==1)
+          {
+            if(prev_node==NULL)
+                lst->node_list=curr_node->next;
+            else
+                prev_node->next=curr_node->next;
+            ret_value=curr_node->obj_ptr;
+            HULIrelease_list_node(curr_node);
+            break;
+          } /* end if */
+      } /* end while */
+
+done:
+  if(ret_value == NULL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* end HULremove_node() */
+
+/******************************************************************************
+ NAME
+     HULIget_list_node - Gets a list node
+
+ DESCRIPTION
+    Either gets an list node from the free list (if there is one available)
+    or allocate a node.
+
+ RETURNS
+    Returns list node ptr if successful and NULL otherwise
+
+*******************************************************************************/
+static node_info_t *HULIget_list_node(void)
+{
+    CONSTR(FUNC, "HULIget_list_node");	/* for HERROR */
+    node_info_t *ret_value=NULL;
+
+    HEclear();
+    if(node_free_list!=NULL)
+      {
+        ret_value=node_free_list;
+        node_free_list=node_free_list->next;
+      } /* end if */
+    else
+      {
+        if((ret_value=(node_info_t *)HDmalloc(sizeof(node_info_t)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end else */
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end HULIget_list_node() */
+
+/******************************************************************************
+ NAME
+     HULIrelease_list_node - Releases a list node
+
+ DESCRIPTION
+    Puts a list node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+static void HULIrelease_list_node(node_info_t *nod)
+{
+#ifdef LATER
+    CONSTR(FUNC, "HULIrelease_list_node");	/* for HERROR */
+#endif /* LATER */
+
+    /* Insert the node at the beginning of the free list */
+    nod->next=node_free_list;
+    node_free_list=nod;
+}   /* end HULIrelease_list_node() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HULshutdown
+ PURPOSE
+    Terminate various global items.
+ USAGE
+    intn HULshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the HUL routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+HULshutdown(void)
+{
+    node_info_t *curr;
+
+    /* Release the free-list if it exists */
+    if(node_free_list!=NULL)
+      {
+        while(node_free_list!=NULL)
+          {
+            curr=node_free_list;
+            node_free_list=node_free_list->next;
+            HDfree(curr);
+          } /* end while */
+      } /* end if */
+  return (SUCCEED);
+}	/* end HULshutdown() */
+
diff --git a/hdf/src/linklist.h b/hdf/src/linklist.h
new file mode 100644
index 0000000..93a426b
--- /dev/null
+++ b/hdf/src/linklist.h
@@ -0,0 +1,211 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: linklist.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    linklist.h
+ * Purpose: header file for linked list API
+ * Dependencies: 
+ * Invokes:
+ * Contents:
+ * Structure definitions: 
+ * Constant definitions: 
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __LINKLIST_H
+#define __LINKLIST_H
+
+#include "hdf.h"
+
+/* Definitions for linked-list creation flags */
+#define HUL_UNSORTED_LIST   0x0000
+#define HUL_SORTED_LIST     0x0001
+
+/* Type of the function to compare objects & keys */
+typedef intn (*HULsearch_func_t)(const VOIDP obj, const VOIDP key);
+
+/* Type of the function to compare two objects */
+typedef intn (*HULfind_func_t)(const VOIDP obj1, const VOIDP obj2);
+
+/* Linked list information structure used */
+typedef struct node_info_struct_tag {
+    VOIDP *obj_ptr;         /* pointer associated with the linked list node */
+    struct node_info_struct_tag *next;   /* link to list node */
+  }node_info_t;
+
+/* Linked list head structure */
+typedef struct list_head_struct_tag {
+    uintn count;            /* # of nodes in the list */
+    uintn flags;            /* list creation flags */
+    HULfind_func_t cmp_func;    /* node comparison function */
+    node_info_t *node_list; /* pointer to a linked list of nodes */
+    node_info_t *curr_node; /* pointer to the current node when iterating */
+  }list_head_t;
+
+#if defined LIST_MASTER | defined LIST_TESTER
+
+/* Define this in only one place */
+#ifdef LIST_MASTER
+/* Pointer to the list node free list */
+static node_info_t *node_free_list=NULL;
+
+#endif /* LIST_MASTER */
+
+/* Useful routines for generally private use */
+
+#endif /* LIST_MASTER | LIST_TESTER */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/******************************************************************************
+ NAME
+     HULcreate_list - Create a linked list
+
+ DESCRIPTION
+    Creates a linked list.  The list may either be sorted or un-sorted, based
+    on the comparison function.
+
+ RETURNS
+    Returns a pointer to the list if successful and NULL otherwise
+
+*******************************************************************************/
+list_head_t *HULcreate_list(HULfind_func_t find_func    /* IN: object comparison function */
+);
+
+/******************************************************************************
+ NAME
+     HULdestroy_list - Destroys a linked list
+
+ DESCRIPTION
+    Destroys a linked list created by HULcreate_list().  This function
+    walks through the list and frees all the nodes, then frees the list head.
+    Note: this function does not (currently) free the objects in the nodes,
+    it just leaves 'em hanging.
+
+ RETURNS
+    Returns SUCCEED/FAIL.
+
+*******************************************************************************/
+intn HULdestroy_list(list_head_t *lst    /* IN: list to destroy */
+);
+
+/******************************************************************************
+ NAME
+     HULadd_node - Adds an object to a linked-list
+
+ DESCRIPTION
+    Adds an object to the linked list.  If the list is sorted, the comparison
+    function is used to determine where to insert the node, otherwise it is
+    inserted at the head of the list.
+
+ RETURNS
+    Returns SUCCEED/FAIL.
+
+*******************************************************************************/
+intn HULadd_node(list_head_t *lst,  /* IN: list to modify */
+    VOIDP obj                       /* IN: object to add to the list */
+);
+
+/******************************************************************************
+ NAME
+     HULsearch_node - Search for an object in a linked-list
+
+ DESCRIPTION
+    Locate an object in a linked list using a key and comparison function.
+
+ RETURNS
+    Returns a pointer to the object found in the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULsearch_node(list_head_t *lst,  /* IN: list to search */
+    HULsearch_func_t srch_func,       /* IN: function to use to find node */
+    VOIDP key                       /* IN: key of object to search for */
+);
+
+/******************************************************************************
+ NAME
+     HULfirst_node - Get the first object in a linked-list
+
+ DESCRIPTION
+    Returns the first object in a linked-list and prepares the list for
+    interating through.
+
+ RETURNS
+    Returns a pointer to the first object found in the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULfirst_node(list_head_t *lst   /* IN: list to search */
+);
+
+/******************************************************************************
+ NAME
+     HULnext_node - Get the next object in a linked-list
+
+ DESCRIPTION
+    Returns the next object in a linked-list by walking through the list
+
+ RETURNS
+    Returns a pointer to the next object found in the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULnext_node(list_head_t *lst   /* IN: list to search */
+);
+
+/******************************************************************************
+ NAME
+     HULremove_node - Removes an object from a linked-list
+
+ DESCRIPTION
+    Remove an object from a linked list.  The key and comparison function are
+    provided locate the object to delete.
+
+ RETURNS
+    Returns a pointer to the object deleted from the list, or NULL on failure.
+
+*******************************************************************************/
+VOIDP HULremove_node(list_head_t *lst,  /* IN: list to modify */
+    HULsearch_func_t srch_func,       /* IN: function to use to find node to remove */
+    VOIDP key                       /* IN: object to add to the list */
+);
+
+/*--------------------------------------------------------------------------
+ NAME
+    HULshutdown
+ PURPOSE
+    Terminate various global items.
+ USAGE
+    intn HULshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the HUL routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+HULshutdown(void);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif /* __LINKLIST_H */
+
diff --git a/hdf/src/maldebug.c b/hdf/src/maldebug.c
new file mode 100644
index 0000000..4d6673f
--- /dev/null
+++ b/hdf/src/maldebug.c
@@ -0,0 +1,660 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: maldebug.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*----------------------------------------------------------------------
+ *
+ *  maldebug.c
+ *  Memory management utilities
+ *
+ *  Description
+ *
+ *  maldebug.c contains routines to protect the programmer
+ *  from errors in calling memory allocation/free routines.
+ *  The programmer must use the memory calls defined
+ *  in maldebug.h. When these calls are used, the
+ *  allocation routines in this module add a data structure
+ *  to the top of allocated memory blocks which tags them as
+ *  legal memory blocks.
+ *
+ *  When the free routine is called, the memory block to
+ *  be freed is checked for legality tag.  If the block
+ *  is not legal, the memory list is dumped to stderr and
+ *  the program is terminated.
+ *
+ *  Compilation Options
+ *
+ *  MEM_LIST    Link all allocated memory blocks onto
+ *          an internal list. The list can be
+ *          displayed using Mem_Display().
+ *
+ *  MEM_WHERE   Save the file/line number of allocated
+ *          blocks in the header.
+ *          Requires that the compilier supports
+ *          __FILE__ and __LINE__ preprocessor
+ *          directives.
+ *          Also requires that the __FILE__ string
+ *          have a static or global scope.
+ *
+ *  MEM_HEADER  Place a header and footer section around each
+ *          allocated block to detect overwrites on the beginning
+ *          and the ending of the allocated block.
+ *
+ *  MEM_COMP_FREE   Complement the free'd memory.
+ *
+ */
+
+#define __MALDEBUG__
+/*#define DEBUG_LIST */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "maldebug.h"
+#include "hdf.h"
+
+/* Constants */
+/* --------- */
+#define MEMTAG  0xa55a  /* Value for mh_tag */
+#define HEADERTAG   0x5a    /* Value for the header and footer data */
+
+/* Structures */
+/* ---------- */
+typedef struct memnod
+  {                             /* Memory block header info     */
+      uint16      mh_tag;       /* Special ident tag            */
+      size_t      mh_size;      /* Size of allocation block     */
+#if defined(MEM_LIST)
+      struct memnod *mh_next;   /* Next memory block            */
+      struct memnod *mh_prev;   /* Previous memory block        */
+#endif
+#if defined(MEM_WHERE)
+      char       *mh_file;      /* File allocation was from     */
+      uint16      mh_line;      /* Line allocation was from */
+#endif
+  }
+MEMHDR;
+
+/* Alignment macros */
+/* ---------------- */
+#define ALIGN_SIZE sizeof(double)
+
+#define HDR_SIZE sizeof(MEMHDR)
+
+#if defined(MEM_HEADER)
+#define BLOCK_SIZE  5
+#define HEADER_SIZE (sizeof(unsigned char)*BLOCK_SIZE)
+#define RESERVE_SIZE ((((HDR_SIZE+(ALIGN_SIZE-1))/ALIGN_SIZE)*ALIGN_SIZE)+HEADER_SIZE)
+#else
+#define BLOCK_SIZE  0
+#define HEADER_SIZE 0
+#define RESERVE_SIZE (((HDR_SIZE+(ALIGN_SIZE-1))/ALIGN_SIZE)*ALIGN_SIZE)
+#endif
+
+/* Conversion macros */
+/* ----------------- */
+#define CLIENT_2_HDR(a) ((MEMHDR *) (((char *)(a)) - RESERVE_SIZE))
+#define HDR_2_CLIENT(a) ((void *) (((char *)(a)) + RESERVE_SIZE))
+
+/* Local variables */
+/* --------------- */
+static unsigned long mem_size = 0;  /* Amount of memory used */
+#if defined(MEM_LIST)
+static MEMHDR *memlist = NULL;  /* List of memory blocks */
+#endif
+
+/* Local functions */
+/* --------------- */
+static void mem_tag_err(void *, int, char *, char *, int);  /* Tag error */
+#if defined(MEM_LIST)
+static void mem_list_add(MEMHDR *);     /* Add block to list */
+static void mem_list_delete(MEMHDR *);  /* Delete block from list */
+#define Mem_Tag_Err(a,b,c) mem_tag_err(a,b,c,fil,lin)
+#else
+#define Mem_Tag_Err(a,b,c) mem_tag_err(a,b,c,__FILE__,__LINE__)
+#endif
+
+#define ME_BADTAG       0
+#define ME_BADHEADER    1
+
+/************************************************************************/
+/**** Functions accessed only through macros ****************************/
+/************************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ *  mem_HDmalloc()
+ *  Allocate a memory block
+ *
+ *  Usage:
+ *
+ *  void *mem_HDmalloc(size_t size)
+ *
+ *  Parameters:
+ *
+ *  size        Size of block in bytes to allocate
+ *
+ *  Return Value:
+ *
+ *  Pointer to allocated memory block
+ *  NULL if not enough memory
+ *
+ *  Description:
+ *
+ *  mem_HDmalloc() makes a protected call to HDmalloc()
+ *
+ *  Notes
+ *
+ *  Access this routine using the malloc() macro in memdebug.h
+ *
+ *
+ */
+
+void       *
+mem_HDmalloc(
+#if defined(MEM_WHERE)
+                  size_t size,
+                  char *fil,
+                  int lin
+#else
+                  size_t size
+#endif
+)
+
+{
+    MEMHDR     *p;
+
+/* Allocate memory block */
+/* --------------------- */
+    p = HDmalloc(RESERVE_SIZE + size + HEADER_SIZE);
+    if (p == NULL)
+      {
+          fprintf(stdaux, "NULL pointer malloc'ed in %s, line %d\n", fil, lin);
+          return (NULL);
+      }     /* end if */
+
+/* Init header */
+/* ----------- */
+    p->mh_tag = MEMTAG;
+    p->mh_size = size;
+    mem_size += size;
+#if defined(MEM_WHERE)
+    p->mh_file = fil;
+    p->mh_line = (uint16) lin;
+#endif
+
+#if defined(MEM_HEADER)
+    HDmemset((char *) HDR_2_CLIENT(p) - HEADER_SIZE, HEADERTAG, HEADER_SIZE);
+    HDmemset((char *) HDR_2_CLIENT(p) + size, HEADERTAG, HEADER_SIZE);
+#endif
+
+#if defined(MEM_LIST)
+    mem_list_add(p);
+#endif
+
+/* Return pointer to client data */
+/* ----------------------------- */
+    return (HDR_2_CLIENT(p));
+}   /* end mem_alloc() */
+
+/*----------------------------------------------------------------------
+ *
+ *  mem_HDrealloc()
+ *  Reallocate a memory block
+ *
+ *  Usage:
+ *
+ *  void *mem_HDrealloc(void *ptr,size_t size)
+ *
+ *  Parameters:
+ *
+ *  ptr     Pointer to current block
+ *  size    Size to adjust block to
+ *
+ *  Return Value:
+ *
+ *  Pointer to new memory block
+ *  NULL if memory cannot be reallocated
+ *
+ *  Description:
+ *
+ *  mem_HDrealloc() makes a protected call to HDrealloc().
+ *
+ *  Notes:
+ *
+ *  Access this routine using the realloc() macro in maldebug.h
+ *
+ *
+ */
+
+void       *
+mem_HDrealloc(
+#if defined(MEM_WHERE)
+                    void *ptr,
+                    size_t size,
+                    char *fil,
+                    int lin
+#else
+                    void *ptr,
+                    size_t size
+#endif
+)
+
+{
+    MEMHDR     *p;
+#if defined(MEM_HEADER) || defined(MEM_COMP_FREE)
+    unsigned char *q;
+    int         i;
+#endif
+    char       *FUNC = "HDrealloc";
+
+/* Check for equivalent to malloc() call, i.e. where ptr==NULL */
+    if (ptr == NULL)
+        return (mem_HDmalloc(size
+#if defined(MEM_WHERE)
+                               ,fil, lin
+#endif
+                ));
+
+/* Convert client pointer to header pointer */
+/* ---------------------------------------- */
+    p = CLIENT_2_HDR(ptr);
+
+/* Check for valid block */
+/* --------------------- */
+    if (p->mh_tag != MEMTAG)
+      {
+          Mem_Tag_Err(p, ME_BADTAG, FUNC);
+          return (NULL);
+      }     /* end if */
+
+/* Check for overwrites into the header & footer */
+/* --------------------------------------------- */
+#if defined(MEM_HEADER)
+    q = (unsigned char *) ptr - HEADER_SIZE;    /* Check the Header to consistancy */
+    for (i = 0; i < BLOCK_SIZE; i++)
+      {
+          if (q[i] != HEADERTAG)
+            {
+                Mem_Tag_Err(p, ME_BADHEADER, FUNC);
+                return (NULL);
+            }   /* end if */
+      }     /* end for */
+    q = (unsigned char *) ptr + p->mh_size;     /* Check the Footer for consistancy */
+    for (i = 0; i < BLOCK_SIZE; i++)
+      {
+          if (q[i] != HEADERTAG)
+            {
+                Mem_Tag_Err(p, ME_BADHEADER, FUNC);
+                return (NULL);
+            }   /* end if */
+      }     /* end for */
+#endif
+
+/* Invalidate header */
+/* ----------------- */
+    p->mh_tag = ~MEMTAG;
+    mem_size -= p->mh_size;
+
+#if defined(MEM_WHERE)
+    mem_list_delete(p);     /* Remove block from list */
+#endif
+
+/* Reallocate memory block */
+/* ----------------------- */
+    p = (MEMHDR *) HDrealloc(p, RESERVE_SIZE + size + HEADER_SIZE);
+    if (p == NULL)
+        return (NULL);
+
+/* Update header */
+/* ------------- */
+    p->mh_tag = MEMTAG;
+    p->mh_size = size;
+    mem_size += size;
+#if defined(MEM_LIST)
+    p->mh_file = fil;
+    p->mh_line = (uint16) lin;
+#endif
+
+#if defined(MEM_WHERE)
+    mem_list_add(p);    /* Add block to list */
+#endif
+
+#if defined(MEM_HEADER)
+    HDmemset((char *) HDR_2_CLIENT(p) - HEADER_SIZE, HEADERTAG, HEADER_SIZE);
+    HDmemset((char *) HDR_2_CLIENT(p) + size, HEADERTAG, HEADER_SIZE);
+#endif
+
+/* Return pointer to client data */
+/* ----------------------------- */
+    return (HDR_2_CLIENT(p));
+}   /* end mem_realloc() */
+
+/*----------------------------------------------------------------------
+ *
+ *  mem_HDfree()
+ *  Free a memory block
+ *
+ *  Usage:
+ *
+ *  void mem_HDfree(void   *ptr)
+ *
+ *  Parameters:
+ *
+ *  ptr     Pointer to memory to free
+ *
+ *  Return Value:
+ *
+ *  None
+ *
+ *  Description:
+ *
+ *  mem_HDfree() frees the specified memory block. The
+ *  block must be allocated using mem_HDmalloc() or mem_HDrealloc().
+ *
+ *  Notes
+ *
+ *  Access this routine using the HDfree() macro in maldebug.h
+ *
+ *
+ */
+
+void       *
+mem_HDfree(
+#if defined(MEM_WHERE)
+                   void *ptr,
+                   char *fil,
+                   int lin
+#else
+                   void *ptr
+#endif
+)
+
+{
+    MEMHDR     *p;
+#if defined(MEM_HEADER) || defined(MEM_COMP_FREE)
+    unsigned char *q;
+    uintn       i;
+#endif
+    char       *FUNC = "HDfree";
+
+/* Convert client pointer to header pointer */
+/* ---------------------------------------- */
+    p = CLIENT_2_HDR(ptr);
+
+/* Check for valid block */
+/* --------------------- */
+    if (p->mh_tag != MEMTAG)
+      {
+          Mem_Tag_Err(p, ME_BADTAG, FUNC);
+          return (NULL);
+      }     /* end if */
+
+/* Check for overwrites into the header & footer */
+/* --------------------------------------------- */
+#if defined(MEM_HEADER)
+    q = (unsigned char *) ptr - HEADER_SIZE;    /* Check the Header to consistancy */
+    for (i = 0; i < BLOCK_SIZE; i++)
+      {
+          if (q[i] != HEADERTAG)
+            {
+                Mem_Tag_Err(p, ME_BADHEADER, FUNC);
+                return (NULL);
+            }   /* end if */
+      }     /* end for */
+    q = (unsigned char *) ptr + p->mh_size;     /* Check the Footer for consistancy */
+    for (i = 0; i < BLOCK_SIZE; i++)
+      {
+          if (q[i] != HEADERTAG)
+            {
+                Mem_Tag_Err(p, ME_BADHEADER, FUNC);
+                return (NULL);
+            }   /* end if */
+      }     /* end for */
+#endif
+
+/* Invalidate header */
+/* ----------------- */
+    p->mh_tag = ~MEMTAG;
+    mem_size -= p->mh_size;
+
+/* Invalidate the block of memory to be free'd */
+/* ------------------------------------------- */
+#if defined(MEM_COMP_FREE)
+    q = (unsigned char *) ptr;
+    for (i = 0; i < p->mh_size; i++)
+        q[i] = (unsigned char) ~q[i];
+#endif
+
+#if defined(MEM_LIST)
+    mem_list_delete(p);     /* Remove block from list */
+#endif
+
+/* Free memory block */
+/* ----------------- */
+    return (HDfree(p));
+}   /* end mem_free() */
+
+/************************************************************************/
+/**** Functions accessed directly ***************************************/
+/************************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ *  Mem_Used()
+ *  Return amount of memory currently allocated
+ *
+ *  Usage:
+ *
+ *  unsigned long Mem_Used()
+ *
+ *  Parameters:
+ *
+ *  None.
+ *
+ *  Description:
+ *
+ *  Mem_Used() returns the number of bytes currently allocated
+ *  using the memory management system. The value returned is
+ *  simply the sum of the size requests to allocation routines.
+ *  It does not reflect any overhead required by the memory
+ *  management system.
+ *
+ *  Notes:
+ *
+ *  None
+ *
+ *
+ */
+
+unsigned long
+Mem_Used(void)
+{
+    return (mem_size);
+}   /* end Mem_Used() */
+
+/*----------------------------------------------------------------------
+ *
+ *  Mem_Display()
+ *  Display memory allocation list
+ *
+ *  Usage:
+ *
+ *  void Mem_Display(FILE *fp)
+ *
+ *  Parameters:
+ *
+ *  fp      File to output data to
+ *
+ *  Description:
+ *
+ *  Mem_Display() displays the contents of the memory
+ *  allocation list.
+ *
+ *  This function is a no-op if MEM_LIST is not defined.
+ *
+ *  Notes:
+ *
+ *  None
+ *
+ *
+ */
+
+void
+Mem_Display(FILE * fp)
+{
+#if defined(MEM_LIST)
+    MEMHDR     *p;
+    int         idx;
+#if defined(MEM_HEADER)
+    unsigned char *q;
+    int         i;
+#endif
+
+#if defined(MEM_WHERE)
+    fprintf(fp, "Index   Size  File(Line) - total size %lu\n", mem_size);
+#else
+    fprintf(fp, "Index   Size - total size %lu\n", mem_size);
+#endif
+
+    idx = 0;
+    p = memlist;
+    while (p != NULL)
+      {
+          fprintf(fp, "%-5d %6u", idx++, p->mh_size);
+#if defined(MEM_WHERE)
+          fprintf(fp, "  %s(%d)", p->mh_file, p->mh_line);
+#endif
+          if (p->mh_tag != MEMTAG)
+              fprintf(fp, " INVALID TAG");
+
+/* Check for overwrites into the header & footer */
+/* --------------------------------------------- */
+#if defined(MEM_HEADER)
+          q = (unsigned char *) HDR_2_CLIENT(p) - HEADER_SIZE;  /* Check the Header to consistancy */
+          for (i = 0; i < BLOCK_SIZE; i++)
+            {
+                if (q[i] != HEADERTAG)
+                  {
+                      fprintf(fp, " HEADER OVERWRITTEN");
+                      break;
+                  }     /* end if */
+            }   /* end for */
+          q = (unsigned char *) HDR_2_CLIENT(p) + p->mh_size;   /* Check the Footer for consistancy */
+          for (i = 0; i < BLOCK_SIZE; i++)
+            {
+                if (q[i] != HEADERTAG)
+                  {
+                      fprintf(fp, " FOOTER OVERWRITTEN");
+                      break;
+                  }     /* end if */
+            }   /* end for */
+#endif
+          fprintf(fp, "\n");
+          p = p->mh_next;
+      }     /* end while */
+#else
+    fprintf(fp, "Memory list not compiled (MEM_LIST not defined)\n");
+#endif
+}   /* end Mem_Display() */
+
+/************************************************************************/
+/**** Memory list manipulation functions ********************************/
+/************************************************************************/
+
+/*
+ * mem_list_add()
+ * Add block to list
+ */
+
+#if defined(MEM_LIST)
+static void
+mem_list_add(MEMHDR * p)
+{
+    p->mh_next = memlist;
+    p->mh_prev = NULL;
+    if (memlist != NULL)
+        memlist->mh_prev = p;
+    memlist = p;
+
+#if defined(DEBUG_LIST)
+    printf("mem_list_add()\n");
+    Mem_Display(stdout);
+#endif
+}   /* end mem_list_add() */
+#endif
+
+/*----------------------------------------------------------------------*/
+
+/*
+ * mem_list_delete()
+ * Delete block from list
+ */
+
+#if defined(MEM_LIST)
+static void
+mem_list_delete(MEMHDR * p)
+{
+    if (p->mh_next != NULL)
+        p->mh_next->mh_prev = p->mh_prev;
+    if (p->mh_prev != NULL)
+        p->mh_prev->mh_next = p->mh_next;
+    else
+        memlist = p->mh_next;
+
+#if defined(DEBUG_LIST)
+    printf("mem_list_delete()\n");
+    Mem_Display(stdout);
+#endif
+}   /* end mem_list_delete() */
+#endif
+
+/************************************************************************/
+/**** Error display *****************************************************/
+/************************************************************************/
+
+/*
+ *  mem_tag_err()
+ *  Display memory tag error
+ */
+static void
+mem_tag_err(void *p, int type, char *func, char *fil, int lin)
+{
+    FILE       *fp;
+
+    /* shut compiler up */
+    fp = fp;
+
+#ifdef OLD_WAY
+    fprintf(stdaux, "Malloc tag error #%d, in %s : %p - %s(%d)\n", type, func, p, fil, lin);
+    if ((fp = fopen("impro.err", "wt+")) != NULL)
+      {     /* open impro.err to output the error file */
+          fprintf(fp, "Malloc tag error - %p - %s(%d)\n", p, fil, lin);
+#if defined(MEM_LIST)
+          Mem_Display(fp);
+#endif
+          fclose(fp);
+      }     /* end if */
+#else
+    fprintf(stdaux, "Malloc tag error #%d, in %s : %p - %s(%d)\n", type, func, p, fil, lin);
+    getch();
+#if defined(MEM_LIST)
+    Mem_Display(stdaux);
+#endif
+#endif
+}   /* end mem_tag_err() */
diff --git a/hdf/src/maldebug.h b/hdf/src/maldebug.h
new file mode 100644
index 0000000..ff12fff
--- /dev/null
+++ b/hdf/src/maldebug.h
@@ -0,0 +1,62 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: maldebug.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*----------------------------------------------------------------------
+ *
+ *  maldebug.h -- Dynamic memory handler interface
+ *  Description: memdebug.h provides the interface definitions for the dynamic
+ *  memory handler.
+ *  See memdebug.c for complete documentation.
+ *
+ */
+
+#ifndef _MALDEBUG_H
+#define _MALDEBUG_H
+
+/* Compilation options */
+#define MEM_LIST    /* Build internal list */
+#define MEM_WHERE   /* Keep track of memory block source */
+#define MEM_HEADER  /* Keep headers and footers around for each block */
+#define MEM_COMP_FREE   /* Complement the space free'd */
+
+/* Interface functions */
+unsigned long Mem_Used(void);
+void        Mem_Display(FILE * fp);
+
+/* Interface functions to access only through macros */
+#if defined(MEM_WHERE)
+void       *mem_HDmalloc(size_t size, char *fil, int lin);
+void       *mem_HDrealloc(void *old_ptr, size_t size, char *fil, int lin);
+void       *mem_HDfree(void *ptr, char *fil, int lin);
+#else
+void       *mem_HDmalloc(size_t size);
+void       *mem_HDrealloc(void *old_ptr, size_t size);
+void       *mem_HDfree(void *ptr);
+#endif
+
+/* Interface macros */
+#if !defined(__MALDEBUG__)
+#if defined(MEM_WHERE)
+#define HDmalloc(a)         mem_HDmalloc((a),__FILE__,__LINE__)
+#define HDrealloc(a,b)      mem_HDrealloc((a),(b),__FILE__,__LINE__)
+#define HDfree(a)           mem_HDfree((a),__FILE__,__LINE__)
+#else
+#define HDmalloc(a)         mem_HDmalloc(a)
+#define HDrealloc(a,b)      mem_HDrealloc((a),(b))
+#define HDfree(a)           mem_HDfree(a)
+#endif
+#endif
+
+#endif /* _MALDEBUG_H */
diff --git a/hdf/src/mcache.c b/hdf/src/mcache.c
new file mode 100644
index 0000000..4fa04e6
--- /dev/null
+++ b/hdf/src/mcache.c
@@ -0,0 +1,1342 @@
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*****************************************************************************
+ * File: mcache.c
+ *
+ * This is a modfied version of the original Berkley code for
+ * manipulating a memory pool. This version however is not 
+ * compatible with the original Berkley version.
+ *
+ * NOTE: references to pages here is the same as chunks
+ *
+ * AUTHOR - George V.- 1996/08/22
+ *****************************************************************************/ 
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5146 $";
+#endif
+
+/* $Id: mcache.c 5146 2009-01-14 17:46:57Z fbaker $ */
+
+/*
+ *  NOTE:
+ *    Here pages are the same thing as chunks.
+ *    I just didn't bother to change all references from pages to chunks.
+ *
+ *    -georgev
+ */
+
+/* for debugging */
+/*
+#define MCACHE_DEBUG
+*/
+/*
+#define STATISTICS
+*/
+
+#define	__MCACHEINTERFACE_PRIVATE
+#include "hdf.h"     /* number types ..etc */
+#include "hqueue.h"  /* Circluar queue functions(Macros) */
+#include "mcache.h"
+
+#if defined(hpux) || defined(__hpux) || defined(__hpux__)
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
+#endif /* hpux */
+
+
+/* Private routines */
+static BKT  *mcache_bkt   (MCACHE *mp);
+static BKT  *mcache_look  (MCACHE *mp, int32 pgno);
+static intn  mcache_write (MCACHE *mp, BKT *bkt);
+
+/******************************************************************************
+NAME
+    mcache_get_npages - returns current number of pages for object
+
+DESCRIPTION
+    Finds current number of pages in object.
+
+RETURNS
+    Returns current number of pages in object.
+******************************************************************************/
+int32
+mcache_get_npages(
+    MCACHE *mp /* IN: MCACHE cookie */)
+{
+    if(mp != NULL)
+        return mp->npages;
+    else
+        return 0;
+} /* mcache_get_npages */
+
+/******************************************************************************
+NAME
+    mcache_get_maxcache - returns current number of pages cached.
+
+DESCRIPTION
+    Finds current number of pages cached for object.
+
+RETURNS
+    Returns current number of pages cached.
+******************************************************************************/
+int32
+mcache_get_maxcache(
+    MCACHE *mp /* IN: MCACHE cookie */)
+{
+    if (mp != NULL)
+        return mp->maxcache;
+    else
+        return 0;
+} /* mcache_get_maxcache */
+
+/******************************************************************************
+NAME
+    mcache_set_maxcache - sets current number of pages to cache.
+
+DESCRIPTION
+    Sets current number of pages to cached for object to 'maxcache'.
+
+RETURNS
+    Returns current number of pages cached.
+******************************************************************************/
+int32
+mcache_set_maxcache(
+    MCACHE *mp,     /* IN: MCACHE cookie */
+    int32  maxcache /* IN: max pages to cache */)
+{
+    if (mp != NULL)
+      { /* currently allow the current cache to grow up */
+          if (mp->maxcache < maxcache)
+              mp->maxcache = maxcache;
+          else /* maxcache is less than current maxcache */
+            {   /* if current number of cached pages is less than request 
+                   then set to 'maxcache', 
+                   else we don't currently handle decreasing
+                   the curcache to 'maxcache' */
+                if (maxcache > mp->curcache)
+                    mp->maxcache = maxcache;
+            }
+          return mp->maxcache;
+      }
+    else
+        return 0;
+} /* mcache_set_maxcache */
+
+/******************************************************************************
+NAME
+    mcache_get_pagsize - returns pagesize for object
+
+DESCRIPTION
+    Finds current pagesize used for object.
+
+RETURNS
+    returns pagesize for object.
+******************************************************************************/
+int32
+mcache_get_pagesize( 
+    MCACHE *mp /* IN: MCACHE cookie */)
+{
+    if (mp != NULL)
+        return mp->pagesize;
+    else
+        return 0;
+} /* mcache_get_pagesize */
+
+/******************************************************************************
+NAME
+   mcache_open -- Open a memory pool on the given object
+
+DESCRIPTION
+   Initialize a memory pool for object using the given pagesize
+   and size of object. 
+
+   Note for 'flags' input only '0' should be used for now.
+
+RETURNS
+   A memory pool cookie if successful else NULL
+
+NOTE: 
+      The key string byte for sharing buffers is not implemented.
+******************************************************************************/
+MCACHE *
+mcache_open(
+    VOID    *key,        /* IN: byte string used as handle to share buffers */
+    int32   object_id,   /* IN: object handle */
+    int32   pagesize,    /* IN: chunk size in bytes  */
+    int32   maxcache,    /* IN: maximum number of pages to cache at any time */
+    int32   npages,      /* IN: number of chunks currently in object */
+    int32   flags        /* IN: 0= object exists, 1= does not exist  */)
+{
+    CONSTR(FUNC, "mcache_open");   /* for HERROR */
+    struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+    MCACHE       *mp    = NULL; /* MCACHE cookie */
+    L_ELEM       *lp    = NULL;
+    intn          ret_value   = RET_SUCCESS;
+    intn          entry;         /* index into hash table */
+    int32         pageno;
+
+    /* shut compiler up */
+    key=key;
+
+    /* Set the pagesize and max # of pages to cache */
+    if(pagesize == 0)
+        pagesize = (int32)DEF_PAGESIZE;
+    if (maxcache == 0)
+        maxcache = (int32)DEF_MAXCACHE;
+
+    /* Allocate and initialize the MCACHE cookie. */
+    if ((mp = (MCACHE *)HDcalloc(1, sizeof(MCACHE))) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    CIRCLEQ_INIT(&mp->lqh);
+    for (entry = 0; entry < HASHSIZE; ++entry)
+      {
+          CIRCLEQ_INIT(&mp->hqh[entry]);
+          CIRCLEQ_INIT(&mp->lhqh[entry]);
+      }
+
+    /* Initialize max # of pages to cache and number of pages in object */
+    mp->maxcache = (int32)maxcache;
+    mp->npages   = npages;
+
+    /* Set pagesize and object handle and current object size */
+    mp->pagesize = pagesize;
+    mp->object_id = object_id;
+    mp->object_size = pagesize * npages;
+
+    /* Initialize list hash chain */
+    for (pageno = 1; pageno <= mp->npages; ++pageno)
+      {
+          lhead = &mp->lhqh[HASHKEY(pageno)];
+          if ((lp = (L_ELEM *)HDmalloc(sizeof(L_ELEM))) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          lp->pgno   = (int32)pageno;     /* set page number */
+
+          /* check if object exists already 
+             The usefullness of this flag is yet to be
+             determined. Currently '0' should be used */
+          if (flags == 0)
+              lp->eflags = (uint8)ELEM_SYNC; /* valid page exists on disk */
+          else
+              lp->eflags = (uint8)0; /* page does not exist on disk */
+#ifdef STATISTICS
+          lp->elemhit = 0;
+          ++(mp->listalloc);
+#endif
+          CIRCLEQ_INSERT_HEAD(lhead, lp, hl); /* add to list */
+      } /* end for pageno */
+
+    /* initialize input/output filters and cookie to NULL */
+    mp->pgin     = NULL;
+    mp->pgout    = NULL;        
+    mp->pgcookie = NULL;        
+#ifdef STATISTICS
+    mp->listhit    = 0;
+    mp->cachehit   = 0;
+    mp->cachemiss  = 0;
+    mp->pagealloc  = 0;
+    mp->pageflush  = 0;
+    mp->pageget    = 0;
+    mp->pagenew    = 0;
+    mp->pageput    = 0;
+    mp->pageread   = 0;
+    mp->pagewrite  = 0;
+#endif
+
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+          if (mp != NULL)
+              HDfree(mp);
+          /* free up list elements */
+          for (entry = 0; entry < HASHSIZE; ++entry)
+            {
+                while ((lp = mp->lhqh[entry].cqh_first) != (VOID *)&mp->lhqh[entry]) 
+                  {
+                      CIRCLEQ_REMOVE(&mp->lhqh[entry], mp->lhqh[entry].cqh_first, hl);
+                      HDfree(lp);
+                  }
+            } /* end for entry */
+#ifdef MCACHE_DEBUG
+          (VOID)fprintf(stderr,"mcache_open: ERROR \n");
+#endif      
+          mp = NULL; /* return value */
+      } /* end error cleanup */
+    /* Normal cleanup */
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_open: mp->pagesize=%lu\n",mp->pagesize);
+    (VOID)fprintf(stderr,"mcache_open: mp->maxcache=%u\n",mp->maxcache);
+    (VOID)fprintf(stderr,"mcache_open: mp->npages=%u\n",mp->npages);
+    (VOID)fprintf(stderr,"mcache_open: flags=%u\n",flags);
+#ifdef STATISTICS
+    (VOID)fprintf(stderr,"mcache_open: mp->listalloc=%lu\n",mp->listalloc);
+#endif
+#endif
+
+    return (mp);
+} /* mcache_open () */
+
+/******************************************************************************
+NAME
+   mcache_filter -- Initialize input/output filters.
+
+DESCRIPTION
+   Initialize input/output filters for user page processing.
+   These are used to read/write the chunks.
+
+RETURNS
+   Nothing
+
+******************************************************************************/
+VOID
+mcache_filter( 
+    MCACHE *mp,                                            /* IN: MCACHE cookie */
+    int32 (*pgin) (VOID * /* cookie */, int32 /* pgno */, VOID * /* page */),  /* IN: page in filter */
+    int32 (*pgout) (VOID * /* cookie */, int32 /* pgno */, const VOID * /*page */), /* IN: page out filter */
+    VOID *pgcookie                                         /* IN: filter cookie */)
+{
+    mp->pgin     = pgin;
+    mp->pgout    = pgout;
+    mp->pgcookie = pgcookie;
+} /* mcache_filter() */
+
+#if 0 /* NOT USED YET */
+/******************************************************************************
+NAME
+   mcache_new -- get a new page of memory and extend memory pool.
+
+DESCRIPTION
+    Get a new page of memory. This is where we get new pages for the object.
+    This will only return a full page of memory. 
+    If the last page is an odd size the user must keep track
+    of this as only lastpagesize bytes will be written out.
+    As a result if the user fills the last page and
+    lastpagesize does not equal pagesize the user will lose data.
+
+    If 'flags' = 0, increase number of pages by 1 and return
+                   *pgnoaddr = npages
+
+    If 'flags' = MCACHE_EXTEND, set page to *pgnoaddr and
+                               npages = *pgnoaddr.
+
+    All returned pages are pinned.
+
+RETURNS
+    Returns the new page if successfull and NULL otherwise
+
+NOTE:
+    This is not used currently.
+******************************************************************************/
+VOID *
+mcache_new(
+    MCACHE *mp,       /* IN: MCACHE cookie */
+    int32  *pgnoaddr, /* IN/OUT: address of newly create page */
+    int32  flags      /* IN:MCACHE_EXTEND or 0 */)
+{
+    CONSTR(FUNC, "mcache_new");   /* for HERROR */
+    struct _hqh  *head  = NULL; /* head of an entry in hash chain */
+    struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+    BKT          *bp   = NULL;  /* bucket element */
+    L_ELEM       *lp   = NULL;
+    intn          ret_value = RET_SUCCESS;
+
+    /* check inputs */
+    if (mp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* page overflow? */
+    if (mp->npages == MAX_PAGE_NUMBER) 
+        HE_REPORT_GOTO("page allocation overflow", FAIL);
+
+#ifdef STATISTICS
+    ++mp->pagenew;
+#endif
+    /*
+     * Get a BKT from the cache.  
+     * Assign a new page number based upon 'flags'. If flags 
+     * is MCACHE_EXTEND then we want to extend object up to '*pgnoaddr' pages.
+     * attach it to the head of the hash chain, the tail of the lru chain,
+     * and return.
+     */
+    if ((bp = mcache_bkt(mp)) == NULL)
+        HE_REPORT_GOTO("unable to get a new page from bucket", FAIL);
+
+    if (!(flags & MCACHE_EXTEND))
+      { /* we increase by one page */
+          mp->npages++;                      /* number of pages */
+          *pgnoaddr = bp->pgno = mp->npages; /* page number */
+      } 
+    else 
+      { /* we extend to *pgnoaddr pages */
+          if (*pgnoaddr > MAX_PAGE_NUMBER) 
+            {
+                (VOID)fprintf(stderr, "mcache_new: page allocation overflow.\n");
+                abort();
+            }
+
+          bp->pgno = *pgnoaddr;      /* page number to create */
+          mp->npages= *pgnoaddr; /* number of pages */
+      }
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_new: increasing #of pages to=%d\n",mp->npages);
+#endif  
+
+    /* Pin the page and insert into head of hash chain 
+     * and tail of lru chain */
+    bp->flags = MCACHE_PINNED;
+    head = &mp->hqh[HASHKEY(bp->pgno)];
+    CIRCLEQ_INSERT_HEAD(head, bp, hq);
+    CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
+  
+    /* Check to see if this page has ever been referenced */
+    lhead = &mp->lhqh[HASHKEY(bp->pgno)];
+    for (lp = lhead->cqh_first; lp != (VOID *)lhead; lp = lp->hl.cqe_next)
+        if (lp->pgno == bp->pgno)
+          { /* hit */
+#ifdef STATISTICS
+              ++mp->listhit;
+              ++lp->elemhit;
+#endif
+              /* we are done */
+              ret_value = RET_SUCCESS;
+              goto done;
+          } /* end if lp->pgno */
+
+    /* NO hit, new list element */
+    if ((lp = (L_ELEM *)HDmalloc(sizeof(L_ELEM))) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    lp->pgno   = bp->pgno;
+    lp->eflags = 0;
+#ifdef STATISTICS
+    lp->elemhit = 0;
+    ++mp->listalloc;
+#endif
+    CIRCLEQ_INSERT_HEAD(lhead, lp, hl); /* add to list */
+
+#ifdef MCACHE_DEBUG
+#ifdef STATISTICS
+    (VOID)fprintf(stderr,"mcache_new: mp->listalloc=%d \n", mp->listalloc);
+#endif
+#endif
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+          if(lp != NULL)
+              HDfree(lp);
+
+          return NULL;
+      }
+    /* Normal cleanup */
+
+    return (bp->page);
+} /* mcache_new() */
+
+#endif /* commented out for later */
+
+/******************************************************************************
+NAME
+   mcache_get - get a specified page by page number.
+
+DESCRIPTION
+    Get a page specified by 'pgno'. If the page is not cached then
+    we need to create a new page. All returned pages are pinned.
+
+RETURNS
+   The specifed page if successful and NULL otherwise
+******************************************************************************/
+VOID *
+mcache_get( 
+    MCACHE *mp,  /* IN: MCACHE cookie */
+    int32  pgno, /* IN: page number */
+    int32  flags /* IN: XXX not used? */)
+{
+    CONSTR(FUNC, "mcache_get");   /* for HERROR */
+    struct _hqh  *head  = NULL; /* head of lru queue */
+    struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+    BKT          *bp   = NULL;  /* bucket element */
+    L_ELEM       *lp   = NULL;
+    intn         ret_value   = RET_SUCCESS;
+#ifdef UNUSED
+    int32        rpagesize;   /* pagesize to read */
+#endif /* UNUSED */
+    intn         list_hit;    /* hit flag */
+
+    /* shut compiler up */
+    flags=flags;
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_get: entering \n");
+#endif
+    /* check inputs */
+    if (mp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for attempting to retrieve a non-existent page. 
+     *  remember pages go from 1 ->npages  */
+    if (pgno > mp->npages) 
+        HE_REPORT_GOTO("attempting to get a non existant page from cache", FAIL);
+
+#ifdef STATISTICS
+    ++mp->pageget;
+#endif
+
+    /* Check for a page that is cached. */
+    if ((bp = mcache_look(mp, pgno)) != NULL) 
+      {
+#ifdef MCACHE_DEBUG
+          if (bp->flags & MCACHE_PINNED) 
+            {
+                (VOID)fprintf(stderr,
+                              "mcache_get: page %d already pinned\n", bp->pgno);
+                abort();
+            }
+#endif
+          /*
+           * Move the page to the head of the hash chain and the tail
+           * of the lru chain.
+           */
+          head = &mp->hqh[HASHKEY(bp->pgno)];
+          CIRCLEQ_REMOVE(head, bp, hq);
+          CIRCLEQ_INSERT_HEAD(head, bp, hq);
+          CIRCLEQ_REMOVE(&mp->lqh, bp, q);
+          CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
+          /* Return a pinned page. */
+          bp->flags |= MCACHE_PINNED;
+
+#ifdef MCACHE_DEBUG
+          (VOID)fprintf(stderr,"mcache_get: getting cached bp->pgno=%d,npages=%d\n",
+                        bp->pgno,mp->npages);
+#endif   
+          /* update this page reference */
+          lhead = &mp->lhqh[HASHKEY(bp->pgno)];
+          for (lp = lhead->cqh_first; lp != (VOID *)lhead; lp = lp->hl.cqe_next)
+              if (lp->pgno == bp->pgno)
+                { /* hit */
+#ifdef STATISTICS
+                    ++mp->listhit;
+                    ++lp->elemhit;
+#endif
+                    break;
+                } /* end if lp->pgno */
+
+          /* we are done */
+          ret_value = RET_SUCCESS;
+          goto done;
+      } /* end if bp */
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_get: NOT cached page\n");
+#endif
+
+    /* Page not cached so
+     * Get a page from the cache to use or create one. */
+    if ((bp = mcache_bkt(mp)) == NULL)
+        HE_REPORT_GOTO("unable to get a new page from bucket", FAIL);
+
+    /* Check to see if this page has ever been referenced */
+    list_hit = 0;
+    lhead = &mp->lhqh[HASHKEY(pgno)];
+    for (lp = lhead->cqh_first; lp != (VOID *)lhead; lp = lp->hl.cqe_next)
+        if (lp->pgno == pgno && lp->eflags != 0)
+          { /* hit */
+#ifdef STATISTICS
+              ++mp->listhit;
+              ++lp->elemhit;
+#endif
+              list_hit = 1;
+              break;
+          } /* end if lp->pgno */
+
+    /* If there is no hit then we allocate a new element 
+     *  and insert into hash table */
+    if (!list_hit)
+      { /* NO hit, new list element 
+         * no need to read this page from disk */
+          if ((lp = (L_ELEM *)HDmalloc(sizeof(L_ELEM))) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          lp->pgno = pgno;
+          lp->eflags = 0;
+#ifdef STATISTICS
+          ++mp->listalloc;
+          lp->elemhit =1;
+#endif
+          CIRCLEQ_INSERT_HEAD(lhead, lp, hl); /* add to list */
+#ifdef MCACHE_DEBUG
+          (VOID)fprintf(stderr,"mcache_get: skiping reading in page=%u\n",pgno);
+#endif
+      } /*end if !list_hit */
+    else
+      { /* list hit, need to read page */
+          lp->eflags = ELEM_READ; /* Indiate we are reading this page */
+
+#ifdef STATISTICS
+          ++mp->pageread;
+#endif
+
+#ifdef UNUSED
+          rpagesize = mp->pagesize;
+#endif /* UNUSED */
+
+          /* Run through the user's filter. 
+             we use this fcn to read in the data chunk/page.
+             Not the original intention. */
+          if (mp->pgin != NULL)
+            {  /* Note page numbers in HMCPxxx are 0 based not 1 based */
+                if (((mp->pgin)(mp->pgcookie, pgno-1, bp->page)) == FAIL)
+                  {
+                      HEreport("mcache_get: error reading chunk=%d\n",(intn)pgno-1);
+                      lp = NULL; /* don't clobber the cache! */
+                      ret_value = RET_ERROR;
+                      goto done;
+                  }
+            }
+          else
+            {
+                HEreport("mcache_get: reading fcn not set,chunk=%d\n",(intn)pgno-1);
+                lp = NULL;
+                ret_value = RET_ERROR;
+                goto done;
+            }
+      } /* end else list hit */
+
+    /* Set the page number, pin the page. */
+    bp->pgno = pgno;
+    bp->flags = MCACHE_PINNED;
+
+    /*
+     * Add the page to the head of the hash chain and the tail
+     * of the lru chain.
+     */
+    head = &mp->hqh[HASHKEY(bp->pgno)];
+    CIRCLEQ_INSERT_HEAD(head, bp, hq);
+    CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
+
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+#ifdef MCACHE_DEBUG
+          (VOID)fprintf(stderr,"mcache_get: Error exiting \n");
+#endif
+          if (lp!=NULL)
+              HDfree(lp);
+          return NULL;
+      }
+    /* Normal cleanup */
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_get: Exiting \n");
+#endif
+    return (bp->page);
+} /* mcache_get() */
+
+/******************************************************************************
+NAME
+   mcache_put -- put a page back into the memory buffer pool
+
+DESCRIPTION
+    Return a page to the buffer pool. Unpin it and mark it 
+    appropriately i.e. MCACHE_DIRTY
+
+RETURNS
+    RET_SUCCESS if succesful and RET_ERROR otherwise
+******************************************************************************/
+intn
+mcache_put(
+    MCACHE  *mp,   /* IN: MCACHE cookie */
+    VOID    *page, /* IN: page to put */
+    int32   flags  /* IN: flags = 0, MCACHE_DIRTY */)
+{
+    CONSTR(FUNC, "mcache_put");   /* for HERROR */
+    struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+    L_ELEM       *lp    = NULL;
+    BKT          *bp = NULL;    /* bucket element ptr */
+    intn          ret_value = RET_SUCCESS;
+
+    /* check inputs */
+    if (mp == NULL || page == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef STATISTICS
+    ++mp->pageput;
+#endif
+    /* get pointer to bucket element */
+    bp = (BKT *)((char *)page - sizeof(BKT));
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_put: putting page=%d\n",bp->pgno);
+    if (!(bp->flags & MCACHE_PINNED)) 
+      {
+          (VOID)fprintf(stderr,
+                        "mcache_put: page %d not pinned\n", bp->pgno);
+          abort();
+      }
+#endif
+    /* Unpin the page and mark it appropriately */
+    bp->flags &= ~MCACHE_PINNED;
+    bp->flags |= flags & MCACHE_DIRTY;
+
+    if (bp->flags & MCACHE_DIRTY)
+      { /* update this page reference */
+          lhead = &mp->lhqh[HASHKEY(bp->pgno)];
+          for (lp = lhead->cqh_first; lp != (VOID *)lhead; lp = lp->hl.cqe_next)
+              if (lp->pgno == bp->pgno)
+                { /* hit */
+#ifdef STATISTICS
+                    ++mp->listhit;
+                    ++lp->elemhit;
+#endif
+                    lp->eflags = ELEM_WRITTEN;
+                    break;
+                } /* end if lp->pgno */
+      }
+
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+          return ret_value;
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* mcache_put () */
+
+/******************************************************************************
+NAME
+   mcache_close - close the memory buffer pool
+
+DESCRIPTION
+   Close the buffer pool.  Frees the buffer pool.
+   Does not sync the buffer pool.
+
+RETURNS
+   RET_SUCCESS if succesful and RET_ERROR otherwise   
+******************************************************************************/
+intn
+mcache_close(
+    MCACHE *mp /* IN: MCACHE cookie */)
+{
+    CONSTR(FUNC, "mcache_close");   /* for HERROR */
+    L_ELEM  *lp = NULL;
+    BKT     *bp = NULL;   /* bucket element */
+    intn     nelem = 0;
+    intn     ret_value   = RET_SUCCESS;
+    intn     entry;      /* index into hash table */
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_close: entered \n");
+#endif
+    /* check inputs */
+    if (mp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Free up any space allocated to the lru pages. */
+    while ((bp = mp->lqh.cqh_first) != (VOID *)&mp->lqh) 
+      {
+          CIRCLEQ_REMOVE(&mp->lqh, mp->lqh.cqh_first, q);
+          HDfree(bp);
+      }
+
+    /* free up list elements */
+    for (entry = 0; entry < HASHSIZE; ++entry)
+      {
+          while ((lp = mp->lhqh[entry].cqh_first) != (VOID *)&mp->lhqh[entry]) 
+            {
+                CIRCLEQ_REMOVE(&mp->lhqh[entry], mp->lhqh[entry].cqh_first, hl);
+                HDfree(lp);
+                nelem++;
+            }
+      } /* end for entry */
+
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+          return ret_value;
+      }
+    /* Normal cleanup */
+
+    /* Free the MCACHE cookie. */
+    HDfree(mp);
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_close: freed %d list elements\n\n",nelem);
+#endif
+    return ret_value;
+} /* mcache_close() */
+
+/******************************************************************************
+NAME
+   mcache_sync -- sync the memory buffer pool
+
+DESCRIPTION
+   Sync the pool to disk. Does NOT Free the buffer pool.
+
+RETURNS
+   RET_SUCCESS if succesful and RET_ERROR otherwise   
+******************************************************************************/
+intn
+mcache_sync(
+    MCACHE *mp /* IN: MCACHE cookie */)
+{
+    CONSTR(FUNC, "mcache_sync");   /* for HERROR */
+    BKT *bp = NULL; /* bucket element */
+    intn ret_value = RET_SUCCESS;
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"MCACHE_sync: entering \n");
+#endif
+    /* check inputs */
+    if (mp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Walk the lru chain, flushing any dirty pages to disk. */
+    for (bp = mp->lqh.cqh_first; bp != (VOID *)&mp->lqh; bp = bp->q.cqe_next)
+      {
+          if (bp->flags & MCACHE_DIRTY && mcache_write(mp, bp) == RET_ERROR)
+              HE_REPORT_GOTO("unable to flush a dirty page", FAIL);
+      } /* end for bp */
+
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+          return ret_value;
+      }
+    /* Normal cleanup */
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_sync: exiting \n");
+#endif
+
+    return ret_value;
+} /* mcache_sync() */
+
+#if 0  /* NOT USED */
+/******************************************************************************
+NAME
+   mcache_page_sync -- write the specified page to disk given its page number
+
+DESCRIPTION
+   Write a cached page to disk given it's page number
+   If the page is not cached return an error.
+
+RETURNS
+   RET_SUCCESS if succesful and RET_ERROR otherwise     
+
+NOTE: No longer used.
+      This was mainly used in the case where we extend the object.
+      We need to mark the current object size by writing out
+      the last page(or part of it) otherwise MCACHE_get() on
+      an intermediate page between the current end of the object
+      and the new end of object will fail.
+******************************************************************************/
+intn
+mcache_page_sync(
+    MCACHE  *mp,   /* IN: MCACHE cookie */
+    int32   pgno,  /* IN: page number */
+    int32   flags  /* IN: XXX not used? */)
+{
+    CONSTR(FUNC, "mcache_page_sync");   /* for HERROR */
+    struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+    L_ELEM       *lp    = NULL;
+    BKT          *bp    = NULL; /* bucket element */
+    intn          ret_value = RET_SUCCESS;
+    int32        wpagesize;         /* page size to write */
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_page_sync: entering\n");
+#endif  
+    /* check inputs */
+    if (mp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for attempting to sync a non-existent page. 
+     *  remember pages go from 1 ->npages  */
+    if (pgno > mp->npages) 
+        HE_REPORT_GOTO("attempting to get a non existant page from cache", FAIL);
+
+    /* Check for a page that is cached. */
+    if ((bp = mcache_look(mp, pgno)) != NULL) 
+      {
+#ifdef MCACHE_DEBUG
+          if (bp->flags & MCACHE_PINNED) 
+            {
+                (VOID)fprintf(stderr,
+                              "mcache_page_sync: page %u already pinned\n", bp->pgno);
+                abort();
+            }
+#endif
+
+          /* only flush the page if dirty */
+          if (!(bp->flags & MCACHE_DIRTY))
+            { /* done */
+                ret_value = RET_SUCCESS;
+                goto done;
+            }
+
+#ifdef STATISTICS
+          ++mp->pagewrite;
+#endif
+
+          /* update this page reference */
+          lhead = &mp->lhqh[HASHKEY(bp->pgno)];
+          for (lp = lhead->cqh_first; lp != (VOID *)lhead; lp = lp->hl.cqe_next)
+              if (lp->pgno == bp->pgno)
+                { /* hit */
+#ifdef STATISTICS
+                    ++mp->listhit;
+                    ++lp->elemhit;
+#endif
+                    lp->eflags = ELEM_SYNC;
+                    break;
+                }
+
+          /* Run page through the user's filter.
+             we use this to write the data chunk/page out.
+             This deviates from the orignal purpose of the filter. */
+          if (mp->pgout)
+            { /* Note page numbers in HMCPxxx are 0 based not 1 based */
+                if (((mp->pgout)(mp->pgcookie, bp->pgno - 1, bp->page)) == FAIL)
+                  {
+                      HEreport("error writing chunk=%d\n",(intn)bp->pgno);
+                      ret_value = RET_ERROR;
+                      goto done;
+                  }
+            }
+          else
+            {
+                HEreport("writing fcn not set,chunk=%d\n",(intn)bp->pgno);
+                ret_value = RET_ERROR;
+                goto done;
+            }
+
+#ifdef MCACHE_DEBUG
+          (VOID)fprintf(stderr,"mcache_page_sync: npages=%u\n",mp->npages);
+#endif
+
+          wpagesize = mp->pagesize;
+
+          /* mark page as clean */
+          bp->flags &= ~MCACHE_DIRTY;
+
+      } /* end if cached page */
+    else /* not a cached page!...we shouldn't encounter this */
+        ret_value = RET_ERROR;
+
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+          return ret_value;
+      }
+    /* Normal cleanup */
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_page_sync: exiting\n");
+#endif  
+    return ret_value;
+} /* mcache_page_sync() */
+#endif
+
+/******************************************************************************
+NAME
+   mcache_bkt - Get a page from the cache (or create one).
+
+DESCRIPTION
+   Private routine. Get a page from the cache (or create one).
+
+RETURNS
+   A page if successful and NULL otherwise.
+       
+NOTE: Note that the size of the page allocated is equal to
+      sizeof(bucket element) + pagesize. We only return the
+      pagesize fragment to the user. The only caveat here is
+      that a user could inadvertently clobber the bucket element
+      information by writing out of the page size bounds.
+******************************************************************************/
+static BKT *
+mcache_bkt(
+    MCACHE *mp  /* IN: MCACHE cookie */)
+{
+    CONSTR(FUNC, "mcache_bkt");   /* for HERROR */
+    struct _hqh *head = NULL;  /* head of hash chain */
+    BKT         *bp   = NULL;  /* bucket element */
+    intn         ret_value  = RET_SUCCESS;
+
+    /* check inputs */
+    if (mp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If under the max cached, always create a new page. */
+    if ((int32)mp->curcache < (int32)mp->maxcache)
+        goto new;
+
+    /*
+     * If the cache is max'd out, walk the lru list for a buffer we
+     * can flush.  If we find one, write it (if necessary) and take it
+     * off any lists.  If we don't find anything we grow the cache anyway.
+     * The cache never shrinks.
+     */
+    for (bp = mp->lqh.cqh_first; bp != (VOID *)&mp->lqh; bp = bp->q.cqe_next)
+        if (!(bp->flags & MCACHE_PINNED)) 
+          { /* Flush if dirty. */
+              if (bp->flags & MCACHE_DIRTY  && mcache_write(mp, bp) == RET_ERROR)
+                  HE_REPORT_GOTO("unable to flush a dirty page", FAIL);
+#ifdef STATISTICS
+              ++mp->pageflush;
+#endif
+              /* Remove from the hash and lru queues. */
+              head = &mp->hqh[HASHKEY(bp->pgno)];
+              CIRCLEQ_REMOVE(head, bp, hq);
+              CIRCLEQ_REMOVE(&mp->lqh, bp, q);
+#ifdef MCACHE_DEBUG
+              { VOID *spage;
+              spage = bp->page;
+              memset(bp, 0xff, sizeof(BKT) + mp->pagesize);
+              bp->page = spage;
+              }
+#endif
+              /* done */
+              ret_value = RET_SUCCESS;
+              goto done;
+          } /* end if bp->flags */
+
+    /* create a new page */
+  new: if ((bp = (BKT *)HDmalloc(sizeof(BKT) + (uintn)mp->pagesize)) == NULL)
+      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+#ifdef STATISTICS
+  ++mp->pagealloc;
+#endif
+
+#if defined(MCACHE_DEBUG) || defined(PURIFY)
+  memset(bp, 0xff, sizeof(BKT) + mp->pagesize);
+#endif
+
+  /* set page ptr past bucket element section */
+  bp->page = (char *)bp + sizeof(BKT);
+  ++mp->curcache; /* increase number of cached pages */
+
+  done:
+  if(ret_value == RET_ERROR)
+    { /* error cleanup */
+        if (bp != NULL)
+            HDfree(bp);
+
+        return NULL;
+    }
+  /* Normal cleanup */
+
+  return (bp); /* return only the pagesize fragement */
+} /* mcache_bkt() */
+
+/******************************************************************************
+NAME
+   mcache_write - write a page to disk given it's bucket handle.
+
+DESCRIPTION
+   Private routine. Write a page to disk given it's bucket handle.
+
+RETURNS
+   RET_SUCCESS if succesful and RET_ERROR otherwise    
+******************************************************************************/
+static int
+mcache_write(
+    MCACHE *mp, /* IN: MCACHE cookie */
+    BKT *bp     /* IN: bucket element */)
+{
+    CONSTR(FUNC, "mcache_write");   /* for HERROR */
+    struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+    L_ELEM       *lp   = NULL;
+    intn          ret_value = RET_SUCCESS;
+#ifdef UNUSED
+    int32         wpagesize;  /* page size to write */
+#endif /* UNUSED */
+
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_write: entering \n");
+#endif
+    /* check inputs */
+    if (mp == NULL || bp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef STATISTICS
+    ++mp->pagewrite;
+#endif
+
+    /* update this page reference */
+    lhead = &mp->lhqh[HASHKEY(bp->pgno)];
+    for (lp = lhead->cqh_first; lp != (VOID *)lhead; lp = lp->hl.cqe_next)
+        if (lp->pgno == bp->pgno)
+          { /* hit */
+#ifdef STATISTICS
+              ++mp->listhit;
+              ++lp->elemhit;
+#endif
+              lp->eflags = ELEM_SYNC;
+              break;
+          }
+
+    /* Run page through the user's filter.
+       we use this to write the data chunk/page out.
+       This deviates from the orignal purpose of the filter. */
+    if (mp->pgout)
+      { /* Note page numbers in HMCPxxx are 0 based not 1 based */
+          if (((mp->pgout)(mp->pgcookie, bp->pgno - 1, bp->page)) == FAIL)
+            {
+                HEreport("mcache_write: error writing chunk=%d\n",(intn)bp->pgno);
+                ret_value = RET_ERROR;
+                goto done;
+            }
+      }
+    else
+      {
+          HEreport("mcache_write: writing fcn not set,chunk=%d\n",(intn)bp->pgno);
+          ret_value = RET_ERROR;
+          goto done;
+      }
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_write: npages=%u\n",mp->npages);
+#endif
+
+#ifdef UNUSED
+    wpagesize = mp->pagesize;
+#endif /* UNUSED */
+
+    /* mark page as clean */
+    bp->flags &= ~MCACHE_DIRTY;
+
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+#ifdef MCACHE_DEBUG
+          (VOID)fprintf(stderr,"mcache_write: error exiting\n");
+#endif
+          return ret_value;
+      }
+    /* Normal cleanup */
+
+#ifdef MCACHE_DEBUG
+    (VOID)fprintf(stderr,"mcache_write: exiting\n");
+#endif
+    return ret_value;
+} /* mcache_write() */
+
+/******************************************************************************
+NAME
+   mcache_look - lookup a page in the cache.
+
+DESCRIPTION
+   Private routine. Lookup a page in the cache and return pointer to it.
+
+RETURNS
+   Page if successfull and NULL othewise.
+******************************************************************************/
+static BKT *
+mcache_look(
+    MCACHE *mp, /* IN: MCACHE cookie */
+    int32 pgno  /* IN: page to look up in cache */)
+{
+    CONSTR(FUNC, "mcache_look");   /* for HERROR */
+    struct _hqh *head = NULL; /* head of hash chain */
+    BKT         *bp   = NULL; /* bucket element */
+    intn         ret_value  = RET_SUCCESS;
+
+    /* check inputs */
+    if (mp == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for attempt to look up a non-existent page. */
+    if (pgno > mp->npages) 
+        HE_REPORT_GOTO("attempting to get a non existant page from cache", FAIL);
+
+    /* search through hash chain */
+    head = &mp->hqh[HASHKEY(pgno)];
+    for (bp = head->cqh_first; bp != (VOID *)head; bp = bp->hq.cqe_next)
+        if (bp->pgno == pgno) 
+          { /* hit....found page in cache */
+#ifdef STATISTICS
+              ++mp->cachehit;
+#endif
+              /* done */
+              ret_value = RET_SUCCESS;
+              goto done;
+          }
+
+    /* Well didn't find page in cache so mark return
+     * value as NULL */
+    bp = NULL; 
+
+#ifdef STATISTICS
+    ++mp->cachemiss;
+#endif
+  done:
+    if(ret_value == RET_ERROR)
+      { /* error cleanup */
+          return NULL;
+      }
+    /* Normal cleanup */
+
+    return (bp);
+} /* mcache_look() */
+
+#ifdef STATISTICS
+#ifdef HAVE_GETRUSAGE
+/******************************************************************************
+NAME
+   myrusage - print some process usage statistics
+
+DESCRIPTION
+   prints some process usage statistics to STDERR
+
+RETURNS
+   Nothing
+******************************************************************************/
+VOID
+myrusage()
+{
+    struct rusage r;
+    double sys, user, idle;
+    double per;
+    double timespent();
+
+    getrusage(RUSAGE_SELF,&r);
+    fprintf(stderr,"USAGE: shmem=%d,unshdata=%d,unshstack=%d\n",
+            r.ru_ixrss,r.ru_idrss,r.ru_isrss);
+    fprintf(stderr,"       pager=%d,pagef=%d,nswap=%d\n",
+            r.ru_minflt,r.ru_majflt,r.ru_nswap);
+    fprintf(stderr,"       block_in=%d,block_out=%d,nioch=%d\n",
+            r.ru_inblock,r.ru_oublock,r.ru_ioch);
+    fprintf(stderr,"       mesgs=%d,mesgr=%d,nsignals=%d\n",
+            r.ru_msgsnd,r.ru_msgrcv,r.ru_nsignals);
+}
+#endif /* HAVE_GETRUSAGE */
+
+/******************************************************************************
+NAME
+   mcache_stat - print out cache statistics
+
+DESCRIPTION
+   Print out cache statistics to STDERR.
+
+RETURNS
+   Nothing
+******************************************************************************/
+VOID
+mcache_stat(
+    MCACHE *mp /* IN: MCACHE cookie */)
+{
+    struct _lhqh *lhead = NULL; /* head of an entry in list hash chain */
+    BKT          *bp    = NULL; /* bucket element */
+    L_ELEM       *lp    = NULL;
+    char         *sep   = NULL;
+    intn          entry;         /* index into hash table */
+    intn          cnt;
+    intn          hitcnt; 
+
+#ifdef HAVE_GETRUSAGE
+    myrusage();
+#endif
+
+    /* check inputs */
+    if (mp != NULL)
+      {
+          (VOID)fprintf(stderr, "%u pages in the object\n", mp->npages);
+          (VOID)fprintf(stderr,
+                        "page size %u, cacheing %u pages of %u page max cache\n",
+                        mp->pagesize, mp->curcache, mp->maxcache);
+          (VOID)fprintf(stderr, "%u page puts, %u page gets, %u page new\n",
+                        mp->pageput, mp->pageget, mp->pagenew);
+          (VOID)fprintf(stderr, "%u page allocs, %u page flushes\n",
+                        mp->pagealloc, mp->pageflush);
+          if (mp->cachehit + mp->cachemiss)
+              (VOID)fprintf(stderr,
+                            "%.0f%% cache hit rate (%u hits, %u misses)\n", 
+                            ((double)mp->cachehit / (mp->cachehit + mp->cachemiss))
+                            * 100, mp->cachehit, mp->cachemiss);
+          (VOID)fprintf(stderr, "%u page reads, %u page writes\n",
+                        mp->pageread, mp->pagewrite);
+          (VOID)fprintf(stderr, "%u listhits, %u listallocs\n",
+                        mp->listhit, mp->listalloc);
+          (VOID)fprintf(stderr, "sizeof(MCACHE)=%d, sizeof(BKT)=%d, sizeof(L_ELEM)=%d\n",
+                        sizeof(MCACHE), sizeof(BKT), sizeof(L_ELEM));
+          (VOID)fprintf(stderr, "memory pool used %u bytes\n",
+                        (int32)(sizeof(MCACHE)+ (sizeof(BKT)+mp->pagesize)*mp->curcache +
+                                (sizeof(L_ELEM)*mp->npages)));
+          sep = "";
+          cnt = 0;
+          for (bp = mp->lqh.cqh_first; bp != (VOID *)&mp->lqh; bp = bp->q.cqe_next) 
+            {
+                (VOID)fprintf(stderr, "%s%u", sep, bp->pgno);
+                if (bp->flags & MCACHE_DIRTY)
+                    (VOID)fprintf(stderr, "d");
+                if (bp->flags & MCACHE_PINNED)
+                    (VOID)fprintf(stderr, "P");
+                if (++cnt == 10) 
+                  {
+                      sep = "\n";
+                      cnt = 0;
+                  } 
+                else
+                    sep = ", ";
+            }
+          (VOID)fprintf(stderr, "\n");
+          (VOID)fprintf(stderr, "Element hits\n");
+          sep = "";
+          cnt = 0;
+          hitcnt = 0;
+          for (entry = 0; entry < HASHSIZE; ++entry)
+            {
+                lhead = &mp->lhqh[entry];
+                for (lp = lhead->cqh_first; lp != (VOID *)lhead; lp = lp->hl.cqe_next)
+                  {
+                      cnt++;
+                      (VOID)fprintf(stderr, "%s%u(%u)", sep, lp->pgno, lp->elemhit);
+                      hitcnt += lp->elemhit;
+                      if (cnt >= 8) 
+                        {
+                            sep = "\n";
+                            cnt = 0;
+                        } 
+                      else
+                          sep = ", ";
+                  }
+                if (cnt >= 8) 
+                  {
+                      (VOID)fprintf(stderr, "\n");
+                      cnt = 0;
+                  } 
+            }
+          (VOID)fprintf(stderr, "\n");
+          (VOID)fprintf(stderr, "Total num of elemhits=%d\n",hitcnt);
+      } /* end if mp */
+}
+#endif /* STATISTICS */
diff --git a/hdf/src/mcache.h b/hdf/src/mcache.h
new file mode 100644
index 0000000..063608b
--- /dev/null
+++ b/hdf/src/mcache.h
@@ -0,0 +1,216 @@
+/*-
+ * Copyright (c) 1991, 1993, 1994
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*****************************************************************************
+ * File: mcache.h
+ *
+ * This is a modfied version of the original Berkley code for
+ * manipulating a memory pool. This version however is not 
+ * compatible with the original Berkley version.
+ *
+ * This version uses HDF number types.
+ *
+ * AUTHOR - George V.- 1996/08/22
+ *****************************************************************************/ 
+
+/* $Id: mcache.h 5146 2009-01-14 17:46:57Z fbaker $ */
+
+/*
+ *  NOTE:
+ *    Here pagesize is the same thing as chunk size and pages refer to chunks.
+ *    I just didn't bother to change all references from pages to chunks.
+ *
+ *    -georgev
+ */
+
+#ifndef _MCACHE_H
+#define _MCACHE_H
+
+/* Required include */
+#include "hqueue.h"    /* Circluar queue functions(Macros) */
+
+/* Set return/succeed values */
+#ifdef SUCCEED
+#define RET_SUCCESS  SUCCEED
+#define RET_ERROR    FAIL
+#else
+#define RET_SUCCESS  0
+#define RET_ERROR    -1
+#endif
+
+/*
+ * The memory pool scheme is a simple one.  Each in-memory page is referenced
+ * by a bucket which is threaded in up to two (three?) ways.  All active pages
+ * are threaded on a hash chain (hashed by page number) and an lru chain.
+ * (Inactive pages are threaded on a free chain?).  Each reference to a memory
+ * pool is handed an opaque MPOOL cookie which stores all of this information.
+ */
+
+/* Current Hash table size. Page numbers start with 1 
+* (i.e 0 will denote invalid page number) */
+#define	HASHSIZE	    128
+#define	HASHKEY(pgno)  ((pgno -1) % HASHSIZE)
+
+/* Default pagesize and max # of pages to cache */
+#define DEF_PAGESIZE   8192
+#define DEF_MAXCACHE   1
+
+#define MAX_PAGE_NUMBER 0xffffffff  /* >= # of pages in a object */
+
+/* The BKT structures are the elements of the queues. */
+typedef struct _bkt 
+{
+  CIRCLEQ_ENTRY(_bkt) hq;	/* hash queue */
+  CIRCLEQ_ENTRY(_bkt) q;	/* lru queue */
+  VOID    *page;            /* page */
+  int32   pgno;             /* page number */
+#define	MCACHE_DIRTY  0x01  /* page needs to be written */
+#define	MCACHE_PINNED 0x02  /* page is pinned into memory */
+  uint8   flags;            /* flags */
+} BKT;
+
+/* The element structure for every page referenced(read/written) in object */
+typedef struct _lelem
+{
+  CIRCLEQ_ENTRY(_lelem) hl;	    /* hash list */
+  int32        pgno;            /* page number */
+#ifdef STATISTICS
+  int32	      elemhit;          /* # of hits on page */
+#endif
+#define ELEM_READ       0x01
+#define ELEM_WRITTEN    0x02
+#define ELEM_SYNC       0x03
+  uint8      eflags;            /* 1= read, 2=written, 3=synced */
+} L_ELEM;
+
+#define	MCACHE_EXTEND    0x10	/* increase number of pages 
+                                   i.e extend object */
+
+/* Memory pool cache */
+typedef struct MCACHE
+{
+  CIRCLEQ_HEAD(_lqh, _bkt)    lqh;	      /* lru queue head */
+  CIRCLEQ_HEAD(_hqh, _bkt)    hqh[HASHSIZE];  /* hash queue array */
+  CIRCLEQ_HEAD(_lhqh, _lelem) lhqh[HASHSIZE]; /* hash of all elements */
+  int32	curcache;		      /* current num of cached pages */
+  int32	maxcache;		      /* max number of cached pages */
+  int32	npages;			      /* number of pages in the object */
+  int32	pagesize;		      /* cache page size */
+  int32 object_id;            /* access ID of object this cache is for */
+  int32 object_size;          /* size of object to cache 
+                                 must be multiple of pagesize for now */
+  int32 (*pgin) (VOID *cookie, int32 pgno, VOID *page); /* page in conversion routine */
+  int32 (*pgout) (VOID *cookie, int32 pgno, const VOID *page);/* page out conversion routine*/
+  VOID	*pgcookie;                         /* cookie for page in/out routines */
+#ifdef STATISTICS
+  int32	listhit;                /* # of list hits */
+  int32	listalloc;              /* # of list elems allocated */
+  int32	cachehit;               /* # of cache hits */
+  int32	cachemiss;              /* # of cache misses */
+  int32	pagealloc;              /* # of pages allocated */
+  int32	pageflush;              /* # of pages flushed */
+  int32	pageget;                /* # of pages requested from pool */
+  int32	pagenew;                /* # of new pages */
+  int32	pageput;                /* # of pages put back into pool */
+  int32	pageread;               /* # of pages read from object */
+  int32	pagewrite;              /* # of pages written to object */
+#endif /* STATISTICS */
+} MCACHE;
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+extern MCACHE *mcache_open (
+    VOID *key,          /* IN:byte string used as handle to share buffers */
+    int32 object_id,    /* IN: object handle */
+    int32 pagesize,     /* IN: chunk size in bytes */
+    int32 maxcache,     /* IN: maximum number of pages to cache at any time */
+    int32 npages,       /* IN: number of chunks currently in object */
+    int32 flags         /* IN: 0= object exists, 1= does not exist */);
+
+extern VOID	 mcache_filter (
+    MCACHE *mp,             /* IN: MCACHE cookie */
+    int32 (*pgin)(VOID *cookie, int32 pgno, VOID *page) ,/* IN: page in filter */
+    int32 (*pgout)(VOID *cookie, int32 pgno, const VOID *page) , /* IN: page out filter */
+    VOID *pgcookie          /* IN: filter cookie */);
+
+extern VOID	*mcache_new (
+    MCACHE *mp,      /* IN: MCACHE cookie */
+    int32 *pgnoaddr, /* IN/OUT: address of newly create page */
+    int32 flags      /* IN:MCACHE_EXTEND or 0 */);
+
+
+extern VOID	*mcache_get (
+    MCACHE *mp, /* IN: MCACHE cookie */
+    int32 pgno, /* IN: page number */
+    int32 flags /* IN: XXX not used? */);
+
+extern intn	 mcache_put (
+    MCACHE *mp, /* IN: MCACHE cookie */
+    VOID *page, /* IN: page to put */ 
+    int32 flags /* IN: flags = 0, MCACHE_DIRTY */);
+
+extern intn	 mcache_sync (
+    MCACHE *mp /* IN: MCACHE cookie */);
+
+extern intn	 mcache_close (
+    MCACHE *mp /* IN: MCACHE cookie */);
+
+extern int32  mcache_get_pagesize (
+    MCACHE *mp /* IN: MCACHE cookie */);
+
+extern int32  mcache_get_maxcache (
+    MCACHE *mp /* IN: MCACHE cookie */);
+
+extern int32  mcache_set_maxcache (
+    MCACHE *mp,     /* IN: MCACHE cookie */
+    int32  maxcache /* IN: max pages to cache */);
+
+extern int32  mcache_get_npages (
+    MCACHE *mp /* IN: MCACHE cookie */);
+
+#ifdef STATISTICS
+extern VOID	 mcache_stat(
+    MCACHE *mp /* IN: MCACHE cookie */);
+#endif /* STATISTICS */
+#if 0 /* NOT USED */
+extern intn	 mcache_page_sync (
+    MCACHE *mp, /* IN: MCACHE cookie */
+    int32 pgno, /* IN: page to sync */
+    int32 flags /* IN: flags */);
+#endif
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif /* _MCACHE_H */
diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c
new file mode 100644
index 0000000..b8c11e6
--- /dev/null
+++ b/hdf/src/mfan.c
@@ -0,0 +1,2281 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5454 $";
+#endif
+
+/* $Id: mfan.c 5454 2010-08-27 17:24:55Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     mfan.c
+ * Author:   GeorgeV
+ * Purpose:  Multi-file read and write annotations: labels and descriptions 
+ *           of data items and file
+ * Invokes:  
+ * Comments:
+ *           Currently the id returned by ANstart() is the same as the
+ *           one returned by Hopen().
+ *
+ *           Currently as least 4 TBBT trees are created to handle 
+ *           annotations(1 for file_ann, 1 for file_desc, 1 for data_ann 
+ *           and 1 for data_desc) for each file which is not pretty but it 
+ *           does make search/find of annotations much easier.
+ *
+ *           NOTE2: Note that any mention of file ID's except in ANStart() 
+ *                  should now refer to annotation interface ID.
+ *
+ * Contents: 
+ *
+ *  Private Routines:
+ *  -----------------
+ *  NOTES: TYPE here refers to file/data label/description types 
+ *         They are AN_FILE_LABEL, AN_FILE_DESC, AN_DATA_LABEL, AN_DATA_DESC
+ *         The tag/ref refers to data tag/ref
+ *
+ *  ANIinit      - Intialize the annotation interface
+ *  ANIdestroy   - Un-intialize the annotation interface
+ *
+ *  ANIanncmp    - compare two annotation handles(ann_id's) 
+ *                  (used in annotation TBBTtree)
+ *  ANIaddentry:  - add entry to corresponding annotation TBBTtree
+ *  ANIcreate_ann_tree - create annotation TBBTtree 
+ *  ANIfind:      - return annotation handle(ann_id) if found of given TYPE/ref
+ *  ANInumann:    - return number of annotations that match TYPE/tag/ref
+ *  ANIannlist:   - return list of handles(ann_id's) that match TYPE/tag/ref
+ *  ANIannlen:    - get length of annotation given handle(ann_id)
+ *  ANIreadann:   - read annotation given handle(ann_id)
+ *  ANIwriteann:  - write annotation given handle(ann_id)
+ *  ANIcreate     - create a new file/label annotation 
+ *                  and return a handle(ann_id)
+ *
+ *  Public API routines:
+ *  --------------------
+ *  ANstart     - open file for annotation handling, returns an_id
+ *  ANfileinfo  - get number of file/data annotations in file. Indices returned
+ *                are used in ANselect() calls.
+ *  ANend       - end access to annotation handling on file
+ *  ANcreate    - create a new data annotation and return a handle(ann_id)
+ *  ANcreatef   - create a new file annotation and return a handle(ann_id)
+ *  ANselect    - returns an annotation handle(ann_id) from index for 
+ *                a particular annotation TYPE. This handle is then used for
+ *                calls like ANwriteann(), ANreadann(), ANannlen(),..etc
+ *  ANnumann:   - return number of annotations that match TYPE/tag/ref
+ *  ANannlist:  - return list of handles(ann_id's) that match TYPE/tag/ref
+ *  ANannlen:   - get length of annotation given handle(ann_id)
+ *  ANreadann:  - read annotation given handle(ann_id)
+ *  ANwriteann: - write annotation given handle(ann_id)
+ *  ANendaccess - end access to annotation using handle(ann_id)
+ *
+ *  Public Miscellaneous API Routines
+ *  ---------------------------------
+ *  ANget_tagref - get tag/ref pair to annotation type and index
+ *  ANid2tagref  - get tag/ref pair to annotation ID
+ *  ANtagref2id  - get annotation id given tag/ref
+ *  ANatype2tag - annotation type to corresponding annotation TAG
+ *  ANtag2atype - annotation TAG to corresponding annotation type
+ *
+ *---------------------------------------------------------------------------*/
+
+#ifndef MFAN_MASTER  /* define main annotation source file */
+#define MFAN_MASTER
+
+#include "mfan.h"
+#include "atom.h"
+#include "hfile.h" /* needed for filerec_t */
+
+/* Whether we've installed the library termination function yet for this 
+   interface */
+PRIVATE intn library_terminate = FALSE;
+
+/* Function Prototypes for fcns used by TBBT. Can not be PRIVATE. */
+extern void ANfreedata(void * data);
+extern void ANfreekey(void * key);
+extern void dumpentryKey(void *key, void *data);
+extern intn ANIanncmp(void * i, void * j, intn value);
+
+/* private initialization routine */
+PRIVATE intn ANIstart(void);
+
+/*-----------------------------------------------------------------------------
+ *                          Internal Routines
+ *---------------------------------------------------------------------------*/
+
+/* ------------------------ Routines for TBBT ------------------------------*/
+/* free data - used by tbbt routines */
+void
+ANfreedata(void * data)
+{
+    HDfree(data);
+} /* ANfreekey() */
+
+/* free key - used by tbbt routines */
+void
+ANfreekey(void * key)
+{
+    HDfree(key);
+} /* ANfreekey() */
+
+#ifdef AN_DEBUG
+/* The following routine is used for debugging purposes to dump 
+ * key/data pairs from the TBBT trees 
+ * eg. tbbt_dump(tree, dumpentryKey, 0)*/
+void
+dumpentryKey(void *key, void *data)
+{
+    ANentry *node = NULL;
+
+    printf("key = %4.4d, data = ",*(int*)key);
+    if (data != NULL) 
+      {
+          node = (ANentry *) data;
+          printf("ann_id=%ld, annref=%d, elmtag=%d, elmref=%d\n", 
+                 (long)node->ann_id, node->annref, node->elmtag, node->elmref);
+      }
+    else 
+        printf("(NULL)\n");
+    return;
+} /* dumpentryKey() */
+#endif /* AN_DEBUG */
+
+/* ------------------------ Private Internal Routines ---------------------*/
+
+/* ------------------------------- ANIanncmp -------------------------------- 
+ NAME
+	ANIanncmp -- compare two annotation keys or id's
+
+ DESCRIPTION
+    Compares two annotation keys. Used by tree for annotations
+    Also used to compare annotation id's since also 32 bit value.
+
+ RETURNS
+    Returns 0 if i=j, -1 if i > j and 1 if i < j
+
+ AUTHOR
+    GeorgeV.
+--------------------------------------------------------------------------- */
+intn 
+ANIanncmp(void * i,   /* IN: annotation key(tag,ref) */
+          void * j,   /* IN: annotation key(tag,ref) */
+          intn value /* not used */)
+{
+    /* shut compiler up */
+    value = value;
+
+    if (*(int32 *)i == *(int32 *)j) 
+        return 0;
+    if (*(int32 *)i > *(int32 *)j) 
+        return -1; 
+    else 
+        return 1;
+} /* ANIanncmp */
+
+/* ------------------------------- ANIdestroy -------------------------------- 
+ NAME
+	ANIdestroy -- Un-Initialize Annotation Interface
+
+ DESCRIPTION
+    Destroys annotation Atom group ANIDGROUP. This routine is usually
+    registered with the atexit() rouinte.
+
+ RETURNS
+    SUCCEED or FAIL
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+intn
+ANIdestroy(void)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANIdestroy");
+#endif /* LATER */
+    int32    ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Destroy the atom groups for annotations */
+    HAdestroy_group(ANIDGROUP);
+
+    return ret_value;
+} /* ANIdestroy () */
+
+/*--------------------------------------------------------------------------
+ NAME
+    ANIstart - AN-level initialization routine.
+
+ DESCRIPTION
+    Register the shut-down routine (ANPdestroy) for call with atexit()
+
+ RETURNS
+    Returns SUCCEED/FAIL
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------*/
+PRIVATE intn 
+ANIstart(void)
+{
+    CONSTR(FUNC, "ANIstart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine ANIdestroy() */
+    if (HPregister_term_func(&ANIdestroy) != 0)
+        HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return(ret_value);
+} /* end ANIstart() */
+
+/* ------------------------------- ANIinit -------------------------------- 
+ NAME
+	ANIinit -- Initialize Annotation Interface
+
+ DESCRIPTION
+    Initializes the annotation interface i.e. installs library
+    cleanup routine and creates the Atom group ANIDGROUP for annotations 
+    if necessary.
+
+ RETURNS
+    SUCCEED or FAIL
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+PRIVATE int32
+ANIinit(void)
+{
+    CONSTR(FUNC, "ANIinit");
+    int32 ret_value = SUCCEED;
+    
+    /* Clear error stack */
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+      {
+        if(ANIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+        /* Initialize the atom groups for annotations */
+        HAinit_group(ANIDGROUP,ANATOM_HASH_SIZE);
+      }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIinit() */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANIaddentry -- add entry to corresponding annotation TBBT tree and 
+                  atom group.
+
+ DESCRIPTION
+   Adds annotation to correct tree and register with atom group
+
+ RETURNS
+   annotation ID if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ -------------------------------------------------------------------------*/
+PRIVATE int32
+ANIaddentry(int32 an_id,    /* IN: annotation interface id */
+            ann_type type,  /* IN: annotation type 
+                                   AN_DATA_LABEL for data labels, 
+                                   AN_DATA_DESC for data descriptions,
+                                   AN_FILE_LABEL for file labels,
+                                   AN_FILE_DESC for file descritpions.*/ 
+            uint16 ann_ref, /* IN: ref of annotation */
+            uint16 elmtag,  /* IN: tag of item of which this is annotation */
+            uint16 elmref,  /* IN: ref of item of which this is annotation */
+            intn new_ann    /* IN: new annotation flag */)
+{
+    CONSTR(FUNC, "ANIaddentry");
+    filerec_t   *file_rec = NULL;		/* file record pointer */
+    uint16       ann_tag  = DFTAG_NULL;
+    int32       *ann_key  = NULL;
+    ANentry     *ann_entry  = NULL;
+    ANnode      *ann_node   = NULL;
+    int32        ret_value  = SUCCEED;
+ 
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for empty annotation tree of 'type'? */   
+    if (file_rec->an_num[type] == -1)
+      {
+          if ((file_rec->an_tree[type] = 
+               (TBBT_TREE *) tbbtdmake(ANIanncmp,sizeof(int32),0)) == NULL)
+            {
+              HE_REPORT_GOTO("failed to create annotation tree", FAIL);
+            }
+
+          file_rec->an_num[type] = 0;
+      }
+
+    /* Which type of annotation file/data label or desc? */
+    switch((ann_type)type)
+      {
+      case AN_DATA_LABEL:
+          ann_tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          ann_tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          ann_tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          ann_tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    /* allocate space for key */
+    if ((ann_key = (int32 *)HDmalloc(sizeof(int32))) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* Create 32bit key from type/ref 
+     *  ----------------------------
+     *  | type(16bits)| ref(16bits) |
+     *  -----------------------------*/
+    *ann_key = AN_CREATE_KEY(type, ann_ref);
+
+    /* Initialize annotation node for insertion in annotation atom group*/
+    if ((ann_node = HDmalloc(sizeof(ANnode))) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    ann_node->file_id = an_id;
+    ann_node->ann_key = *ann_key;
+    ann_node->new_ann = new_ann;
+
+    /* Initialize annotation entry for insertion into corresponding TBBT */
+    if ((ann_entry = HDmalloc(sizeof(ANentry))) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* register annotation with atom group ANIDGROUP */
+    ann_entry->annref  = ann_ref;
+    ann_entry->ann_id = HAregister_atom(ANIDGROUP,ann_node);
+    if (FAIL == ann_entry->ann_id)
+        HE_REPORT_GOTO("failed to insert annotation into ANIDGROUP atom group", 
+                       FAIL);
+
+    if (type == AN_DATA_LABEL || type == AN_DATA_DESC)
+      {
+          ann_entry->elmtag = (uint16) elmtag;
+          ann_entry->elmref = (uint16) elmref;
+      }
+    else
+      {
+          ann_entry->elmtag = ann_tag;
+          ann_entry->elmref = ann_ref;
+      }
+
+    /* Add annotation entry to 'type' tree */
+    if (tbbtdins(file_rec->an_tree[type], ann_entry, ann_key) == NULL)
+        HE_REPORT_GOTO("failed to insert annotation into 'type' tree", FAIL);
+
+    /* increment number of annotatiosn of 'type' */
+    file_rec->an_num[type] += 1;
+
+    /* return annotation id */
+    ret_value = ann_entry->ann_id;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (ann_key != NULL)
+              HDfree(ann_key);
+          if (ann_entry != NULL)
+              HDfree(ann_entry);
+          if (ann_node != NULL)
+              HDfree(ann_node);
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIaddentry */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANIcreate_ann_tree --  create an annotation tree of 'type' for given file 
+
+ DESCRIPTION
+   Creates either a label or descritption annotation TBBT tree. 
+
+ RETURNS
+   Number of annotations of 'type' in file if successful and 
+   FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ -------------------------------------------------------------------------*/
+PRIVATE intn
+ANIcreate_ann_tree(int32    an_id,/* IN: annotation interface id */
+                   ann_type type  /* IN: AN_DATA_LABEL for data labels, 
+                                         AN_DATA_DESC for data descriptions,
+                                         AN_FILE_LABEL for file labels,
+                                         AN_FILE_DESC for file descritpions.*/)
+{
+    CONSTR(FUNC, "ANIcreate_ann_tree");
+    filerec_t  *file_rec = NULL;		/* file record pointer */
+    uint8       datadi[4];
+    int32       more_anns;
+    int32       aid = FAIL;
+    int32       nanns;
+    int32       i;
+    int32      *ann_key = NULL; 
+    uint16      ann_tag;
+    uint16      ann_ref;
+    uint8      *dptr = NULL;
+    ANentry    *ann_entry  = NULL;
+    ANnode     *ann_node   = NULL;
+    intn        ret_value  = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for empty annotation tree of 'type'? */   
+    if (file_rec->an_num[type] == -1)
+      {
+          if ((file_rec->an_tree[type] = 
+               (TBBT_TREE *) tbbtdmake(ANIanncmp,sizeof(int32),0)) == NULL)
+            {
+              HE_REPORT_GOTO("failed to create annotation tree", FAIL);
+            }
+          file_rec->an_num[type] = 0; /* initialize to zero entries */
+      }
+    else
+      {
+          ret_value = file_rec->an_num[type];  /* tree already created */
+          goto done; /* we are done */
+      }
+
+    /* Which type of annotation data/file label or desc? */
+    switch((ann_type)type)
+      {
+      case AN_DATA_LABEL:
+          ann_tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          ann_tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          ann_tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          ann_tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    /* Get number of annotations of 'type' in file */
+    if ((nanns = Hnumber(an_id, ann_tag)) == 0)
+      { /* ZERO annotations of 'type' in file */
+          file_rec->an_num[type] = 0;
+          ret_value =  file_rec->an_num[type];  
+          goto done; /* we are done */
+      }
+
+    /* start read on 'type' annotations  in file 
+     * note that so far an_id == file_id */
+    if ((aid = Hstartread(an_id, ann_tag, DFREF_WILDCARD)) == FAIL)
+      {
+        HE_REPORT_GOTO("Hstartread failed to read annotation", FAIL);
+      }
+    else
+        more_anns = SUCCEED; 
+
+    /* Process annotations of 'type' in file */
+    for (i = 0; (i < nanns) && (more_anns != FAIL); i++)
+      { /* see if annotation is there */
+          if (FAIL == Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, &ann_ref,
+                               (int32 *) NULL, (int32 *) NULL, (int32 *) NULL,
+                               (int16 *) NULL, (int16 *) NULL))
+            {   /* record what we found so far and return */
+                file_rec->an_num[type] = nanns;
+                ret_value =  FAIL;
+                goto done; /* we are done */
+            }
+
+          /* if data annotation, read data annotation tag/ref */
+          if(type != AN_FILE_LABEL && type != AN_FILE_DESC)
+            {
+                if ((int32) FAIL == Hread(aid, (int32) 4, datadi))
+                  {   /* record what we found so far and return */
+                      file_rec->an_num[type] = nanns;
+                      ret_value =  FAIL;
+                      goto done; /* we are done */
+                  }
+            }
+
+          /* allocate space for key */
+          if ((ann_key = (int32 *)HDmalloc(sizeof(int32))) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* Create key from tag/ref pair 
+           *  ----------------------------
+           *  | tag(16bits) | ref(16bits) |
+           *  -----------------------------*/
+          *ann_key = AN_CREATE_KEY(type, ann_ref);
+
+          /* Initialize annotation node for insertion in annotation atom group*/
+          if ((ann_node = HDmalloc(sizeof(ANnode))) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          ann_node->file_id = an_id;
+          ann_node->ann_key = *ann_key;
+          ann_node->new_ann = 0;       /* not a newly created annotation */
+
+          /* Initialize annotation entry for insertion into corresponding TBBT */
+          /* and  decode data tag/ref */
+          if ((ann_entry = HDmalloc(sizeof(ANentry))) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          ann_entry->annref  = ann_ref;
+          /* ann_entry->ann_id  = *ann_id = num_anns++; */
+          ann_entry->ann_id = HAregister_atom(ANIDGROUP,ann_node);
+          if (FAIL == ann_entry->ann_id)
+              HE_REPORT_GOTO("failed to insert annotation into ann_id Group", FAIL);
+
+          /* Check if data annotation to decode data tag/ref */
+          if(type != AN_FILE_LABEL && type != AN_FILE_DESC)
+            {
+                dptr = (uint8 *) &(datadi[0]);
+                UINT16DECODE(dptr, ann_entry->elmtag);
+                UINT16DECODE(dptr, ann_entry->elmref);
+            }
+          else
+            {
+                ann_entry->elmtag = ann_tag;
+                ann_entry->elmref = ann_ref;
+            }
+
+          /* Add annotation entry to 'type' tree */
+          if (tbbtdins(file_rec->an_tree[type], ann_entry, ann_key) == NULL)
+              HE_REPORT_GOTO("failed to insert annotation into 'type' tree", FAIL);
+
+          /* set read on next annotation */
+          more_anns = Hnextread(aid, ann_tag, DFREF_WILDCARD, DF_CURRENT);
+      } /* end for "more_anns" */
+    
+    /* Finish access*/
+    if (FAIL != aid)
+      {
+        if (FAIL == Hendaccess(aid))
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+
+    /* set return value */
+    ret_value = file_rec->an_num[type] = nanns;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (ann_key != NULL)
+              HDfree(ann_key);
+          if (ann_entry != NULL)
+              HDfree(ann_entry);
+          if (ann_node != NULL)
+              HDfree(ann_node);
+          if (FAIL != aid)
+              Hendaccess(aid);
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIcreate_ann_tree */
+
+#if NOT_USED_YET
+/*--------------------------------------------------------------------------
+ NAME
+     ANIfind -- find annotation id for given annotation type and ref number
+
+ DESCRIPTION
+     Find annotation id for the given annotation type and ref number
+
+ RETURNS
+    Annotation id if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ -------------------------------------------------------------------------*/ 
+PRIVATE int32
+ANIfind(int32    an_id, /* IN: annotation interface id */
+        ann_type type,  /* IN: AN_DATA_LABEL for data labels, 
+                               AN_DATA_DESC for data descriptions,
+                               AN_FILE_LABEL for file labels,
+                               AN_FILE_DESC for file descritpions.*/ 
+        uint16   ann_ref /* IN: ref of annotation */)
+{
+    CONSTR(FUNC, "ANIfind");
+    filerec_t  *file_rec = NULL;		/* file record pointer */
+    TBBT_NODE  *entry    = NULL;
+    ANentry    *ann_entry  = NULL;
+    int32       ann_key;
+    int32       ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check for empty annotation tree of 'type'? */   
+    if (file_rec->an_num[type] == -1)
+      {
+          if ((file_rec->an_tree[type] = 
+               (TBBT_TREE *) tbbtdmake(ANIanncmp,sizeof(int32),0)) == NULL)
+            {
+              HE_REPORT_GOTO("failed to create annotation tree", FAIL);
+            }
+
+          file_rec->an_num[type] = 0; /* intialize after allocation */
+      }
+
+    /* Create key from type/ref pair 
+     *  ----------------------------
+     *  | type(16bits) | ref(16bits) |
+     *  -----------------------------*/
+    ann_key = AN_CREATE_KEY(type, ann_ref);
+
+    /* See if annotation of 'type' with ref exits */
+    if ((entry = tbbtdfind(file_rec->an_tree[type], &ann_key, NULL)) == NULL)
+        HE_REPORT_GOTO("failed to find annotation of 'type'", FAIL);
+
+    /* get annotation entry from node */
+    ann_entry = (ANentry *) entry->data; 
+
+    /* return annotation id */
+    ret_value = ann_entry->ann_id;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIfind */
+#endif /* NOT_USED_YET */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANInumann -- find number of annotation of 'type' that 
+                 match the given element tag/ref 
+
+ DESCRIPTION
+   Find number of annotation of 'type' for the given element 
+   tag/ref pair. Not used for file lables/descs since there
+   can only be one set of them for a file.
+
+ RETURNS
+   Number of annotation found if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ -------------------------------------------------------------------------*/ 
+PRIVATE intn
+ANInumann(int32    an_id,   /* IN: annotation interface id */
+          ann_type type,    /* IN: AN_DATA_LABEL for data labels, 
+                                   AN_DATA_DESC for data descriptions,
+                                   AN_FILE_LABEL for file labels,
+                                   AN_FILE_DESC for file descritpions.*/
+          uint16   elem_tag, /* IN: tag of item of which this is annotation */
+          uint16   elem_ref  /* IN: ref of item of which this is annotation */)
+{
+    CONSTR(FUNC, "ANInumann");
+    filerec_t  *file_rec = NULL;		/* file record pointer */
+    TBBT_NODE  *entry    = NULL;
+    ANentry    *ann_entry = NULL;
+    intn        nanns     = 0; 
+    intn        ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Empty annotation tree */
+    if (file_rec->an_num[type] == -1)
+      {
+          if (ANIcreate_ann_tree(an_id, type) == FAIL)
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+      }
+
+    /* Traverse the list looking for a match */
+    for(entry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[type])); 
+        entry != NULL; entry = tbbtnext(entry))
+      {
+          ann_entry = (ANentry *) entry->data; /* get annotation entry from node */
+          if ((ann_entry->elmref == elem_ref) && (ann_entry->elmtag == elem_tag))
+            {
+                nanns++; /* increment ref counter if match */
+            }
+      }
+
+    /* return number of annotation references found for tag/ref */
+    ret_value = nanns;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANInumann */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANIannlist -- generate list of annotation ids of 'type' that 
+                 match the given element tag/ref 
+
+ DESCRIPTION
+       Find and generate list of annotation ids of 'type' for the given 
+       element tag/ref pair
+
+ RETURNS
+       number of annotations ids found if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/ 
+PRIVATE intn
+ANIannlist(int32    an_id,    /* IN: annotation interface id */
+           ann_type type,     /* IN: AN_DATA_LABEL for data labels, 
+                                     AN_DATA_DESC for data descriptions,
+                                     AN_FILE_LABEL for file labels,
+                                     AN_FILE_DESC for file descritpions.*/
+           uint16   elem_tag, /* IN: tag of item of which this is annotation*/
+           uint16   elem_ref, /* IN: ref of item of which this is annotation */
+           int32    ann_list[]/* OUT: array of ann_id's that match criteria. */)
+{
+    CONSTR(FUNC, "ANIannlist");
+    filerec_t  *file_rec = NULL;		/* file record pointer */
+    TBBT_NODE  *entry    = NULL;
+    ANentry    *ann_entry = NULL;
+    intn        nanns     = 0;
+    intn        ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Empty annotation tree */
+    if (file_rec->an_num[type] == -1)
+      {
+          if (ANIcreate_ann_tree(an_id, type) == FAIL)
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+      }
+
+    /* Traverse the list looking for a match */
+    for(entry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[type])); 
+        entry != NULL; entry = tbbtnext(entry))
+      {
+          ann_entry = (ANentry *) entry->data; /* get annotation entry from node */
+          if ((ann_entry->elmref == elem_ref) && (ann_entry->elmtag == elem_tag))
+            { /* save ref of ann match in list */
+                ann_list[nanns++] = ann_entry->ann_id; 
+            }
+      }
+
+    /* return number of annotation id's found for tag/ref */
+    ret_value = nanns;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIannlist */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANIannlen -- get length of annotation givne annotation id
+
+ DESCRIPTION
+   Uses the annotation id to find ann_key & file_id
+
+ RETURNS
+   length of annotation if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+PRIVATE int32
+ANIannlen(int32 ann_id /*  IN: annotation id */)
+{
+    CONSTR(FUNC, "ANIannlen");
+    ANnode    *ann_node   = NULL;
+    int32      file_id = FAIL;
+    int32      type;
+    int32      ann_key;
+    uint16     ann_tag;
+    uint16     ann_ref;
+    int32      ann_length =(-1);
+    int32      ret_value  = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* get annotation record */
+    ann_node = HAatom_object(ann_id);
+    if (NULL == ann_node)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get file id and annotation key */
+    file_id = ann_node->file_id;
+    ann_key = ann_node->ann_key;
+    type    = AN_KEY2TYPE(ann_key);
+    ann_ref = AN_KEY2REF(ann_key);
+
+    /* Valid file id */
+    if (file_id == FAIL)
+        HE_REPORT_GOTO("bad file_id", FAIL);
+
+    /* set type annotation tag */
+    switch((int32)type)
+      {
+      case AN_DATA_LABEL:
+          ann_tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          ann_tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          ann_tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          ann_tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    if (ann_tag == DFTAG_DIL || ann_tag == DFTAG_DIA)
+      {  /* 4=length of data tag/ref for data label or description */
+          if ((ann_length = Hlength(file_id, ann_tag, ann_ref)) == FAIL) 
+              HE_REPORT_GOTO("Failed to find annotation length", FAIL);
+          ann_length -= 4;
+      }
+    else if (ann_tag == DFTAG_FID || ann_tag == DFTAG_FD)
+      {  /* not data tag/ref for file label or description */
+          if ((ann_length = Hlength(file_id, ann_tag, ann_ref)) == FAIL) 
+              HE_REPORT_GOTO("Failed to find annotation length", FAIL);
+      }
+
+    /* return the length */
+    ret_value = (ann_length);
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIannlen */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANIreadann -- read annotation given ann_id
+
+ DESCRIPTION
+   Gets tag and ref of annotation.  Finds DD for that annotation.
+   Reads the annotation, taking care of NULL terminator, if necessary.
+
+ RETURNS
+   SUCCEED (0) if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+PRIVATE intn
+ANIreadann(int32 ann_id, /* IN: annotation id (handle) */ 
+           char *ann,    /* OUT: space to return annotation in */
+           int32 maxlen  /* IN: size of space to return annotation in */)
+{
+    CONSTR(FUNC, "ANIreadann");
+    ANnode  *ann_node   = NULL;
+    int32   file_id = FAIL;
+    int32   type;
+    int32   ann_key;
+    int32   aid = FAIL;
+    int32   ann_len;
+    uint16  ann_tag;
+    uint16  ann_ref;
+    uint8   datadi[4] = {0,0,0,0};   /* to read in and discard data/ref! */
+    intn    ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* get annotation record */
+    ann_node = HAatom_object(ann_id);
+    if (NULL == ann_node)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get file id and annotation key */
+    file_id = ann_node->file_id;
+    ann_key = ann_node->ann_key;
+    type    = AN_KEY2TYPE(ann_key);
+    ann_ref = AN_KEY2REF(ann_key);
+
+    /* Valid file id */
+    if (file_id == FAIL)
+        HE_REPORT_GOTO("bad file_id", FAIL);
+
+    /* set type tag */
+    switch((int32)type)
+      {
+      case AN_DATA_LABEL:
+          ann_tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          ann_tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          ann_tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          ann_tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    /* find DD for that annotation using tag/ref */
+    aid = Hstartread(file_id, ann_tag, ann_ref);
+    if (aid == FAIL)
+        HE_REPORT_GOTO("Failed to get access to annotation",FAIL);
+
+    if (FAIL == Hinquire(aid, (int32 *) NULL, (uint16 *) NULL, (uint16 *) NULL, 
+                         &ann_len, (int32 *) NULL, (int32 *) NULL, 
+                         (int16 *) NULL, (int16 *) NULL))
+      {
+          HE_REPORT_GOTO("Failed to get annotation",FAIL);
+      }
+
+    /* first four bytes were tag/ref if data annotation, so they don't count */
+    if (ann_tag == DFTAG_DIL || ann_tag == DFTAG_DIA)
+        ann_len -= 4;    
+#ifdef AN_DEBUG
+    printf("ANIreadann: from Hinquire, ann_len=%d, maxlen=%d\n", 
+           ann_len, maxlen);
+#endif
+    /* Check length of space provided
+     * if not enough space, truncate annotation 
+     * Labels need space for null terminator, Descriptions don't */
+    if (ann_tag == DFTAG_FID || ann_tag == DFTAG_DIL)
+      { /* Labels */
+          if (ann_len > maxlen - 1)
+              ann_len = maxlen - 1;
+      }
+    else
+      { /* Descriptions */
+          if (ann_len > maxlen)
+              ann_len = maxlen;
+      }
+
+    /* If data label or description need to read past tag/ref */
+    if (ann_tag == DFTAG_DIL || ann_tag == DFTAG_DIA)
+      { /* Data label/description */
+          if ((int32) FAIL == Hread(aid, (int32) 4, datadi))
+              HE_REPORT_GOTO("Failed to go past tag/ref",FAIL);
+      }
+
+    /* read itslef annotation now..*/
+    if ((int32) FAIL == Hread(aid, ann_len, ann))
+        HE_REPORT_GOTO("Failed to read annotation",FAIL);
+
+    /* If Label need to NULL terminate string */
+    if (ann_tag == DFTAG_FID || ann_tag == DFTAG_DIL)
+        ann[ann_len] = '\0';     
+#ifdef AN_DEBUG
+    printf("ANIreadann: ann_len=%d, ann=%s\n", ann_len,ann);
+#endif
+    /* Close access to annotation object */
+    if (FAIL != aid)
+      {
+        if (FAIL == Hendaccess(aid))
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (FAIL != aid)
+              Hendaccess(aid);
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIreadann */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANIwriteann -- write annotation given ann_id
+
+ DESCRIPTION
+   Checks for pre-existence of given annotation, replacing old one if it
+   exists. Writes out annotation.
+
+ RETURNS
+   SUCCEED (0) if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+PRIVATE intn
+ANIwriteann(int32 ann_id,    /* IN: annotation id */
+            const char *ann, /* IN: annotation to write */
+            int32 ann_len    /* IN: length of annotation */)
+{
+    CONSTR(FUNC, "ANIwriteann");
+    filerec_t  *file_rec = NULL;		/* file record pointer */
+    TBBT_NODE  *entry  = NULL;
+    ANentry    *ann_entry  = NULL;
+    ANnode     *ann_node   = NULL;
+    int32       file_id = FAIL;
+    int32       type;
+    int32       ann_key;
+    int32       aid = FAIL;
+    int         newflag = 0;
+    uint16      ann_tag;
+    uint16      ann_ref;
+    uint16      elem_tag;
+    uint16      elem_ref;
+    uint8       datadi[4] = {0,0,0,0};      /* to hold data tag/ref for writing */
+    uint8      *ptr = NULL;
+    intn        ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* get annotation record */
+    ann_node = HAatom_object(ann_id);
+    if (NULL == ann_node)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get file id and annotation key */
+    file_id = ann_node->file_id;
+    ann_key = ann_node->ann_key;
+    type    = AN_KEY2TYPE(ann_key);
+    ann_ref = AN_KEY2REF(ann_key);
+
+    /* convert file_id to file rec and check for validity */
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* set type tag */
+    switch((int32)type)
+      {
+      case AN_DATA_LABEL:
+          ann_tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          ann_tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          ann_tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          ann_tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    /* Get annotation entry so that we can extract tag/ref of element 
+     * Note that for file labels and descriptions the tag/ref contain
+     * DFTAG_XXX and annotation reference number */
+    if ((entry = tbbtdfind(file_rec->an_tree[type], &ann_key, NULL)) == NULL)
+        HE_REPORT_GOTO("failed to retrieve annotation of 'type' tree", FAIL);
+
+    ann_entry = (ANentry *) entry->data;
+
+    elem_tag = ann_entry->elmtag;
+    elem_ref = ann_entry->elmref;
+    newflag  = ann_node->new_ann;
+
+    /* is this a new annotation */
+    if (newflag == 1)
+      { 
+          ann_node->new_ann = 0; /* set new annotation entry to false */
+      }
+
+    /* If annotation exists, re-used the DD and rewrite new annotation 
+       while preserving tag/ref. We assume annotations are not stored
+       as linked-blocks for now. */
+    if (newflag == 0)
+      {  /* annotation exists in file, re-writing */
+          /* Not new, re-used the tag/ref(i.e. DD) for new annotation.
+             pointer to old annotation is lost. */
+          if (HDreuse_tagref(file_id, ann_tag, ann_ref) == FAIL)
+              HE_REPORT_GOTO("Unable to replace old annotation",FAIL);
+      }
+
+    if (ann_tag == DFTAG_DIL || ann_tag == DFTAG_DIA)
+      { /* Data label/description 
+         * Note: cannot use Hputelement because need to write data tag/ref */
+          aid = Hstartwrite(file_id, ann_tag, ann_ref, ann_len + 4);
+          if (aid == FAIL)
+              HE_REPORT_GOTO("Failed to start write access on annotation",FAIL);
+
+          /* Setup up to write annotation tag/ref */
+          ptr = (uint8 *) &(datadi[0]);   /* first, write the object's tag/ref */
+          UINT16ENCODE(ptr, elem_tag);
+          UINT16ENCODE(ptr, elem_ref);
+
+          /* write annotation tag/ref of element */
+          if ((int32) FAIL == Hwrite(aid, (int32) 4, datadi))
+              HE_REPORT_GOTO("Failed to write tag/ref of annotation",FAIL);
+
+#ifdef AN_DEBUG
+          printf("ANIwriteann: ann_len=%d, ann=%s\n", ann_len,ann);
+#endif
+          /* then write the annotation itself */
+          if ((int32) FAIL == Hwrite(aid, ann_len, ann))
+              HE_REPORT_GOTO("Failed to write annotation",FAIL);
+
+          /* end access to annotation */
+          if (FAIL == Hendaccess(aid)) 
+              HE_REPORT_GOTO("Failed to end access to annotation",FAIL);
+      }
+    else /* file label/description */
+      { 
+         /* write out file label/description */
+          if (FAIL == Hputelement(file_id, ann_tag, ann_ref, (const uint8 *)ann, ann_len))
+              HE_REPORT_GOTO("Failed to write file annotation",FAIL);
+#ifdef AN_DEBUG
+          printf("ANIwriteann: fann_len=%d, fann=%s\n", ann_len,ann);
+#endif
+      }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+          if (FAIL != aid)
+              Hendaccess(aid); 
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIwriteann */
+
+/* ------------------------------- ANIcreate ------------------------------- 
+ NAME
+	ANIcreate - create a new annotation and return a handle(id)
+
+ DESCRIPTION
+    Creates an annotation, returns an 'an_id' to work with the new 
+    annotation which can either be a label or description.
+
+ RETURNS
+    An ID to an annotation which can either be a label or description
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+PRIVATE intn 
+ANIcreate(int32    file_id,  /* IN: file ID */
+          uint16   elem_tag, /* IN: tag of item to be assigned annotation */
+          uint16   elem_ref, /* IN: reference number of itme to be assigned ann */ 
+          ann_type type      /* IN: AN_DATA_LABEL for data labels, 
+                                    AN_DATA_DESC for data descriptions,
+                                    AN_FILE_LABEL for file labels,
+                                    AN_FILE_DESC for file descritpions.*/)
+{
+    CONSTR(FUNC, "ANIcreate");    /* for HERROR */
+    int32   ann_id = FAIL;
+    uint16  ann_tag;
+    uint16  ann_ref;
+    intn    ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+  
+    /* Valid file id */
+    if (HAatom_group(file_id) != FIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* deal with type */
+    switch((ann_type)type)
+      {
+      case AN_DATA_LABEL:
+          ann_tag = DFTAG_DIL;
+          ann_ref = Htagnewref(file_id,ann_tag);
+          break;
+      case AN_DATA_DESC:
+          ann_tag = DFTAG_DIA;
+          ann_ref = Htagnewref(file_id,ann_tag);
+          break;
+      case AN_FILE_LABEL:
+          /* for file label set elmement tag/ref to ann_tag & ref */
+          ann_tag = DFTAG_FID;
+          ann_ref = Htagnewref(file_id,ann_tag);
+          elem_tag = ann_tag;
+          elem_ref = ann_ref;
+          break;
+      case AN_FILE_DESC:
+          /* for file desc set elmement tag/ref to ann_tag & ref */
+          ann_tag = DFTAG_FD;
+          ann_ref = Htagnewref(file_id,ann_tag);
+          elem_tag = ann_tag;
+          elem_ref = ann_ref;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    /* Check tag and ref */
+    if (!elem_tag)
+        HGOTO_ERROR(DFE_BADTAG, FAIL);
+    if (!elem_ref)
+        HGOTO_ERROR(DFE_BADREF, FAIL);
+  
+    /* put new annotation tag/ref into 'type' TBBTtree */
+    if ((ann_id = ANIaddentry(file_id, type, ann_ref, elem_tag, elem_ref, 1)) == FAIL)
+        HE_REPORT_GOTO("Failed to add annotation to TBBT tree",FAIL);
+
+    ret_value = ann_id;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANIcreate() */
+
+/* --------------------- Exported Multi-file Interface ----------------------*/
+
+/* ------------------------------- ANstart -------------------------------- 
+ NAME
+	ANstart -- open file for annotation handling
+
+ DESCRIPTION
+    Start annotation handling on the file return a annotation ID to the file.
+
+ RETURNS
+    A file ID or FAIL. Note that we use 'an_id' which is the same
+    as the file id.
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+EXPORT int32
+ANstart(int32 file_id /* IN: file to start annotation access on*/)
+{
+    CONSTR(FUNC, "ANstart");
+    filerec_t  *file_rec = NULL;		/* file record pointer */
+    int32       ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert file id to file rec and check for validity */
+    file_rec = HAatom_object(file_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* call ANIinit, should just register termination function once 
+       no matter how many times it is called. */
+    ANIinit();
+
+    ret_value = file_id;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* ANstart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    ANfileinfo - Report high-level information about the ANxxx interface 
+                 for a given file.
+
+ DESCRIPTION
+    Reports general information about the number of file and object(i.e. data)
+    annotations in the file. This routine is generally used to find
+    the range of acceptable indices for ANselect calls.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------*/
+EXPORT intn 
+ANfileinfo(int32  an_id,        /* IN:  annotation interface id */
+           int32 *n_file_label, /* OUT: the # of file labels */
+           int32 *n_file_desc,  /* OUT: the # of file descriptions */
+           int32 *n_obj_label,  /* OUT: the # of object labels */
+           int32 *n_obj_desc    /* OUT: the # of object descriptions */)
+{
+    CONSTR(FUNC, "ANfileinfo");    /* for HERROR */
+    filerec_t  *file_rec  = NULL;  /* file record pointer */
+    intn        ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Empty file label annotation tree? */
+    if (file_rec->an_num[AN_FILE_LABEL] == -1)
+      {
+          if ((*n_file_label = ANIcreate_ann_tree(an_id, AN_FILE_LABEL)) == FAIL)
+              HE_REPORT_GOTO("failed to create file label annotation TBBTtree", FAIL);
+      }
+    else
+        *n_file_label = file_rec->an_num[AN_FILE_LABEL];
+
+    /* Empty file descritpiton annotation tree? */
+    if (file_rec->an_num[AN_FILE_DESC] == -1)
+      {
+          if ((*n_file_desc = ANIcreate_ann_tree(an_id, AN_FILE_DESC)) == FAIL)
+              HE_REPORT_GOTO("failed to create file desc annotation TBBTtree", FAIL);
+      }
+    else
+        *n_file_desc = file_rec->an_num[AN_FILE_DESC];
+
+    /* Empty label annotation tree? */
+    if (file_rec->an_num[AN_DATA_LABEL] == -1)
+      {
+          if ((*n_obj_label = ANIcreate_ann_tree(an_id, AN_DATA_LABEL)) == FAIL)
+              HE_REPORT_GOTO("failed to create data label annotation TBBTtree", FAIL);
+      }
+    else
+        *n_obj_label = file_rec->an_num[AN_DATA_LABEL];
+
+    /* Empty descritpiton annotation tree? */
+    if (file_rec->an_num[AN_DATA_DESC] == -1)
+      {
+          if ((*n_obj_desc = ANIcreate_ann_tree(an_id, AN_DATA_DESC)) == FAIL)
+              HE_REPORT_GOTO("failed to create data desc annotation TBBTtree", FAIL);
+      }
+    else
+        *n_obj_desc = file_rec->an_num[AN_DATA_DESC];
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* ANfileinfo() */
+
+/* -------------------------------- ANend ---------------------------------
+ NAME
+	ANend -- End annotation access to file file
+
+ DESCRIPTION
+    End annotation access to file.
+
+ RETURNS
+    SUCCEED / FAIL
+--------------------------------------------------------------------------- */
+EXPORT int32
+ANend(int32 an_id /* IN: Annotation ID of file to close */)
+{
+    CONSTR(FUNC,"ANend");
+    filerec_t *file_rec = NULL;  /* file record pointer */
+    TBBT_NODE *aentry   = NULL;
+    ANentry   *ann_entry = NULL;
+    ANnode    *ann_node  = NULL;
+    int32      ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* NEED to delete trees of annotations attached to node 
+     * NOTE: This could be written shorter using a for loop....
+     * or something....  */
+
+    /* free file label annotation rb tree */
+    if (file_rec->an_tree[AN_FILE_LABEL] != NULL) 
+      { /* Traverse tree puling ann_id's to delete from annotation atom group */
+          for(aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_FILE_LABEL])); 
+              aentry != NULL;
+              aentry = tbbtnext(aentry))
+            { /* get annotation entry from node */
+                ann_entry = (ANentry *) aentry->data; 
+
+                /* delete annotation node from annotation group  */
+                if(NULL == (ann_node = HAremove_atom(ann_entry->ann_id)))
+                    HE_REPORT_GOTO("Failed to remove annotation with ann_id", FAIL);
+
+                if(ann_node != NULL)
+                    HDfree(ann_node); /* free node */
+            } /* end for 'entry */
+          /* finally free tree */
+          tbbtdfree(file_rec->an_tree[AN_FILE_LABEL], ANfreedata, ANfreekey);  
+      }
+
+    /* free file desc annotation rb tree */
+    if (file_rec->an_tree[AN_FILE_DESC] != NULL) 
+      { /* Traverse tree puling ann_id's to delete from annotation atom group */
+          for(aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_FILE_DESC])); 
+              aentry != NULL;
+              aentry = tbbtnext(aentry))
+            { /* get annotation entry from node */
+                ann_entry = (ANentry *) aentry->data; 
+
+                /* delete annotation node from annotation group  */
+                if(NULL == (ann_node = HAremove_atom(ann_entry->ann_id)))
+                    HE_REPORT_GOTO("Failed to remove annotation with ann_id", FAIL);
+
+                if(ann_node != NULL)
+                    HDfree(ann_node); /* free node */
+
+            } /* end for 'entry */
+          /* finally free tree */
+          tbbtdfree(file_rec->an_tree[AN_FILE_DESC], ANfreedata, ANfreekey);  
+      }
+
+    /* free label annotation rb tree */
+    if (file_rec->an_tree[AN_DATA_LABEL] != NULL) 
+      { /* Traverse tree puling ann_id's to delete from annotation atom group */
+          for(aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_DATA_LABEL])); 
+              aentry != NULL;
+              aentry = tbbtnext(aentry))
+            { /* get annotation entry from node */
+                ann_entry = (ANentry *) aentry->data; 
+
+                /* delete annotation node from annotation group  */
+                if(NULL == (ann_node = HAremove_atom(ann_entry->ann_id)))
+                    HE_REPORT_GOTO("Failed to remove annotation with ann_id", FAIL);
+
+                if(ann_node != NULL)
+                    HDfree(ann_node); /* free node */
+            } /* end for 'entry */
+          /* finally free tree */
+          tbbtdfree(file_rec->an_tree[AN_DATA_LABEL], ANfreedata, ANfreekey);  
+      }
+
+    /* free desc annotation rb tree */
+    if (file_rec->an_tree[AN_DATA_DESC] != NULL) 
+      { /* Traverse tree puling ann_id's to delete from annotation atom group */
+          for(aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_DATA_DESC])); 
+              aentry != NULL;
+              aentry = tbbtnext(aentry))
+            { /* get annotation entry from node */
+                ann_entry = (ANentry *) aentry->data; 
+
+                /* delete annotation node from annotation group  */
+                if(NULL == (ann_node = HAremove_atom(ann_entry->ann_id)))
+                    HE_REPORT_GOTO("Failed to remove annotation with ann_id", FAIL);
+
+                if(ann_node != NULL)
+                    HDfree(ann_node); /* free node */
+
+            } /* end for 'entry */
+          /* finally free tree */
+          tbbtdfree(file_rec->an_tree[AN_DATA_DESC], ANfreedata, ANfreekey);  
+      }
+
+    /* re-initalize everything in file record for annotations so
+       the a ANstart() works. */
+    file_rec->an_tree[AN_DATA_LABEL] = NULL;
+    file_rec->an_tree[AN_DATA_DESC]  = NULL;
+    file_rec->an_tree[AN_FILE_LABEL] = NULL;
+    file_rec->an_tree[AN_FILE_DESC]  = NULL;
+    file_rec->an_num[AN_DATA_LABEL] = -1;   
+    file_rec->an_num[AN_DATA_DESC]  = -1;   
+    file_rec->an_num[AN_FILE_LABEL] = -1;   
+    file_rec->an_num[AN_FILE_DESC]  = -1;   
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* ANend() */
+
+/* ------------------------------------------------------------------------ 
+ NAME
+	ANcreate - create a new element annotation and return a handle(id)
+
+ DESCRIPTION
+    Creates a data annotation, returns an 'an_id' to work with the new 
+    annotation which can either be a label or description.
+
+ RETURNS
+    An ID to an annotation which can either be a label or description
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+EXPORT int32
+ANcreate(int32    an_id,    /* IN: annotation interface ID */
+         uint16   elem_tag, /* IN: tag of item to be assigned annotation */ 
+         uint16   elem_ref, /* IN: reference number of itme to be assigned ann */ 
+         ann_type type      /* IN: AN_DATA_LABEL for data labels, 
+                                  AN_DATA_DESC for data descriptions*/)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANcreate");    /* for HERROR */
+#endif /* LATER */
+    int32    ret_value;
+
+    ret_value = (ANIcreate(an_id, elem_tag, elem_ref, type));
+
+    return ret_value;
+} /* ANcreate() */
+
+/* ------------------------------------------------------------------------ 
+ NAME
+	ANcreatef - create a new file annotation and return a handle(id)
+
+ DESCRIPTION
+    Creates a file annotation, returns an 'an_id' to work with the new 
+    file annotation which can either be a label or description.
+
+ RETURNS
+    An ID to an annotation which can either be a file label or description        
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+EXPORT int32
+ANcreatef(int32    an_id,/* IN: annotation interface ID */
+          ann_type type  /* IN:  AN_FILE_LABEL for file labels,
+                                 AN_FILE_DESC for file descritpions.*/)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANcreatef");    /* for HERROR */
+#endif /* LATER */
+    uint16 ann_tag;
+    uint16 ann_ref;
+    int32  ret_value = SUCCEED;
+
+    /* deal with type */
+    switch((ann_type)type)
+      {
+      case AN_FILE_LABEL:
+          ann_tag = DFTAG_FID;
+          ann_ref = 0; /* initalize with invalid ref, 
+                          will be replaced in ANIcreate() */
+          break;
+      case AN_FILE_DESC:
+          ann_tag = DFTAG_FD;
+          ann_ref = 0; /* initialize with invalid ref, 
+                          will be replaced in ANIcreate() */
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    ret_value = ANIcreate(an_id, ann_tag, ann_ref, type);
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* ANcreateann() */
+
+/* ------------------------------- ANselect ------------------------------- 
+ NAME
+	ANselect -- get an annotation ID from index of 'type'
+
+ DESCRIPTION
+    The position index is ZERO based
+
+ RETURNS
+    An ID to an annotation type which can either be a label or description 
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+EXPORT int32
+ANselect(int32    an_id, /* IN: annotation interface ID */
+         int32    index, /* IN: index of annottion to get ID for */
+         ann_type type   /* IN: AN_DATA_LABEL for data labels, 
+                                AN_DATA_DESC for data descriptions,
+                                AN_FILE_LABEL for file labels,
+                                AN_FILE_DESC for file descritpions.*/)
+{
+    CONSTR(FUNC, "ANselect");    /* for HERROR */
+    filerec_t *file_rec = NULL;  /* file record pointer */
+    TBBT_NODE *entry    = NULL;
+    ANentry   *ann_entry = NULL;
+    int32      ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Empty annotation tree */
+    if (file_rec->an_num[type] == -1)
+      {
+          if (ANIcreate_ann_tree(an_id, type) == FAIL)
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+      }
+
+    /* check index and adjust to 1 based for tbbtindx()*/
+    if(index >= 0 && index < file_rec->an_num[type])
+        index++;
+    else
+        HE_REPORT_GOTO("bad index", FAIL);
+
+    /* find 'index' entry */
+    if ((entry = tbbtindx((TBBT_NODE *)*(file_rec->an_tree[type]), index)) == NULL)
+        HE_REPORT_GOTO("failed to find 'index' entry", FAIL);
+
+    ann_entry = (ANentry *) entry->data; 
+
+    /* return ann_id */
+    ret_value = ann_entry->ann_id;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+    return ret_value;
+} /* ANselect() */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANnumann -- find number of annotation of 'type' that 
+               match the given element tag/ref 
+
+ DESCRIPTION
+   Find number of annotation of 'type' for the given element 
+   tag/ref pair. Should not be used for File labels and
+   descriptions.
+
+ RETURNS
+   Number of annotations found if successful and FAIL (-1) otherwise.
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/ 
+EXPORT intn
+ANnumann(int32    an_id,    /* IN: annotation interface id */
+         ann_type type,     /* IN: AN_DATA_LABEL for data labels, 
+                                   AN_DATA_DESC for data descriptions,
+                                   AN_FILE_LABEL for file labels,
+                                   AN_FILE_DESC for file descritpions.*/
+         uint16   elem_tag, /* IN: tag of item of which this is annotation */
+         uint16   elem_ref  /* IN: ref of item of which this is annotation */ )
+{
+    CONSTR(FUNC, "ANnumann");
+    intn   ret_value = SUCCEED;
+
+    /* deal with invalid types */
+    if(type == AN_FILE_LABEL || type == AN_FILE_DESC)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    ret_value = ANInumann(an_id, type, elem_tag, elem_ref);
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANnumann() */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANannlist -- generate list of annotation ids of 'type' that 
+                match the given element tag/ref 
+
+ DESCRIPTION
+   Find and generate list of annotation ids of 'type' for the given 
+   element tag/ref pair. Should not be used for File labels and
+   descriptions.
+
+ RETURNS
+   Number of annotations ids found if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/ 
+EXPORT intn
+ANannlist(int32    an_id,      /* IN: annotation interface id */
+          ann_type type,       /* IN: AN_DATA_LABEL for data labels, 
+                                      AN_DATA_DESC for data descriptions,
+                                      AN_FILE_LABEL for file labels,
+                                      AN_FILE_DESC for file descritpions.*/
+          uint16   elem_tag,   /* IN: tag of item of which this is annotation */
+          uint16   elem_ref,   /* IN: ref of item of which this is annotation */
+          int32    ann_list[]  /* OUT: array of ann_id's that match criteria. */)
+{
+    CONSTR(FUNC, "ANannlist");
+    intn  ret_value = SUCCEED;
+
+    /* deal with invalid types */
+    if(type == AN_FILE_LABEL || type == AN_FILE_DESC)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    ret_value = ANIannlist(an_id, type, elem_tag, elem_ref, ann_list);
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANannlist() */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANannlen -- get length of annotation givne annotation id
+
+ DESCRIPTION
+   Uses the annotation id to find ann_key & file_id
+
+ RETURNS
+   length of annotation if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+EXPORT int32
+ANannlen(int32 ann_id /* IN: annotation id */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANannlen");
+#endif /* LATER */
+    int32  ret_value;
+
+    ret_value =  ANIannlen(ann_id);
+    return ret_value;
+} /* ANannlen() */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANwriteann -- write annotation given ann_id
+
+ DESCRIPTION
+   Checks for pre-existence of given annotation, replacing old one if it
+   exists. Writes out annotation.
+
+ RETURNS
+   SUCCEED (0) if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+EXPORT int32
+ANwriteann(int32 ann_id,     /* IN: annotation id */
+           const char *ann,  /* IN: annotation to write */
+           int32 annlen      /* IN: length of annotation */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANwriteann");    /* for HERROR */
+#endif /* LATER */
+    int32  ret_value;
+
+    ret_value = ANIwriteann(ann_id, ann, annlen);
+    return ret_value;
+} /* ANwriteann() */
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANreadann -- read annotation given ann_id
+
+ DESCRIPTION
+   Gets tag and ref of annotation.  Finds DD for that annotation.
+   Reads the annotation, taking care of NULL terminator, if necessary.
+
+ RETURNS
+   SUCCEED (0) if successful and FAIL (-1) otherwise
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+EXPORT int32
+ANreadann(int32 ann_id,  /* IN: annotation id (handle) */
+          char *ann,     /* OUT: space to return annotation in */
+          int32 maxlen   /* IN: size of space to return annotation in */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANreadann");    /* for HERROR */
+#endif /* LATER */
+    int32   ret_value;
+
+    ret_value = ANIreadann(ann_id, ann, maxlen);
+    return ret_value;
+} /* ANreadann() */
+
+/* ----------------------------------------------------------------------- 
+ NAME
+	ANendaccess -- end access to an annotation given it's id
+
+ DESCRIPTION
+    Terminates access to an annotation. For now does nothing
+
+ RETURNS
+    SUCCEED(0) or FAIL(-1)
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+EXPORT intn
+ANendaccess(int32 ann_id /* IN: annotation id */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "ANendaccess");    /* for HERROR */
+#endif /* LATER */
+    intn  ret_value = SUCCEED;
+    /* shut compiler up */
+    ann_id=ann_id;
+
+    return ret_value;
+} /* ANendaccess() */
+
+/* ----------------------------------------------------------------------- 
+ NAME
+	ANget_tagref - get tag/ref pair for annotation based on type and index
+
+ DESCRIPTION
+    Get the tag/ref of the annotation based on  the type and index of the 
+    annotation. The position index is zero based
+
+ RETURNS
+    A tag/ref pair for an annotation type which can either be a 
+    label or description.
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------------- */
+EXPORT int32
+ANget_tagref(int32    an_id, /* IN: annotation interface ID */
+             int32    index, /* IN: index of annotation to get tag/ref for */
+             ann_type type,  /* IN: AN_DATA_LABEL for data labels, 
+                                    AN_DATA_DESC for data descriptions,
+                                    AN_FILE_LABEL for file labels,
+                                    AN_FILE_DESC for file descritpions.*/
+             uint16  *tag,   /* OUT: Tag for annotation */
+             uint16  *ref    /* OUT: ref for annotation */)
+{
+    CONSTR(FUNC, "ANget_tagref");    /* for HERROR */
+    filerec_t *file_rec = NULL;  /* file record pointer */
+    TBBT_NODE *entry    = NULL;
+    ANentry   *ann_entry = NULL;
+    int32      ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Empty annotation tree */
+    if (file_rec->an_num[type] == -1)
+      {
+          if (ANIcreate_ann_tree(an_id, type) == FAIL)
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+      }
+
+    /* check index and adjust to 1 based for tbbtindx()*/
+    if(index >= 0 && index <= file_rec->an_num[type])
+        index++;
+    else
+        HE_REPORT_GOTO("bad index", FAIL);
+
+    /* find 'index' entry */
+    if ((entry = tbbtindx((TBBT_NODE *)*(file_rec->an_tree[type]), index)) == NULL)
+        HE_REPORT_GOTO("failed to find 'index' entry", FAIL);
+
+    ann_entry = (ANentry *) entry->data; 
+
+    /* set ref */
+    *ref = ann_entry->annref;
+
+    /* set tag based on type */
+    switch((int32)type)
+      {
+      case AN_DATA_LABEL:
+          *tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          *tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          *tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          *tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANget_tagref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    ANid2tagref -- get tag/ref given annotation id
+
+ DESCRIPTION
+    Uses the annotation id to find ann_node entry which contains ann_ref
+
+ RETURNS
+    SUCCEED(0) if successful and FAIL (-1) otherwise.  
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+int32
+ANid2tagref(int32   ann_id,/* IN: annotation id */
+            uint16 *tag,   /* OUT: Tag for annotation */
+            uint16 *ref    /* OUT: ref for annotation */)
+{
+    CONSTR(FUNC, "ANid2tagref");
+    ANnode    *ann_node = NULL;
+    int32      file_id  = FAIL;
+    int32      type;
+    int32      ann_key;
+    uint16     ann_ref;
+    int32      ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Valid annotation id */
+    /* get annotation record */
+    ann_node = HAatom_object(ann_id);
+    if (NULL == ann_node)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get file id and annotation key */
+    file_id = ann_node->file_id;
+    ann_key = ann_node->ann_key;
+    type    = AN_KEY2TYPE(ann_key);
+    ann_ref = AN_KEY2REF(ann_key);
+
+    /* Valid file id */
+    if (file_id == FAIL)
+        HE_REPORT_GOTO("bad file_id", FAIL);
+
+    *ref = ann_ref;
+    /* set type annotation tag */
+    switch((int32)type)
+      {
+      case AN_DATA_LABEL:
+          *tag = DFTAG_DIL;
+          break;
+      case AN_DATA_DESC:
+          *tag = DFTAG_DIA;
+          break;
+      case AN_FILE_LABEL:
+          *tag = DFTAG_FID;
+          break;
+      case AN_FILE_DESC:
+          *tag = DFTAG_FD;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANid2tagref */
+
+/*--------------------------------------------------------------------------
+ NAME
+       ANtagref2id -- get annotation id given tag/ref
+
+ DESCRIPTION
+       Gets the annotation id of the annotation given the tag/ref of
+       the annotation itself and the annotation interface id.
+
+ RETURNS
+       Annotation id of annotation if successful and FAIL(-1) otherwise. 
+
+ AUTHOR
+    GeorgeV.
+
+ ------------------------------------------------------------------------*/
+int32
+ANtagref2id(int32  an_id,   /* IN  Annotation interface id */
+            uint16 ann_tag, /* IN: Tag for annotation */
+            uint16 ann_ref  /* IN: ref for annotation */)
+{
+    CONSTR(FUNC, "ANtagref2id");
+    filerec_t *file_rec = NULL;		/* file record pointer */
+    TBBT_NODE *entry    = NULL;
+    ANentry   *ann_entry = NULL;
+    int32      ann_key;
+    ann_type   type;
+    int32      ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* convert an_id i.e. file_id to file rec and check for validity */
+    file_rec = HAatom_object(an_id);
+    if (BADFREC(file_rec))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* set type given annotation tag */
+    switch((uint16)ann_tag)
+      {
+      case DFTAG_DIL:
+          type = AN_DATA_LABEL;
+          break;
+      case DFTAG_DIA:
+          type = AN_DATA_DESC;
+          break;
+      case  DFTAG_FID:
+          type = AN_FILE_LABEL;
+          break;
+      case  DFTAG_FD:
+          type = AN_FILE_DESC;
+          break;
+      default:
+          HE_REPORT_GOTO("Bad annotation type for this call",FAIL);
+      }
+
+    /* Check for empty annotation tree of 'type'? */   
+    if (file_rec->an_num[type] == -1)
+      {
+          if (ANIcreate_ann_tree(an_id, type) == FAIL)
+              HGOTO_ERROR(DFE_BADCALL, FAIL);
+      }
+
+    /* Create key from type/ref pair 
+     *  ----------------------------
+     *  | type(16bits) | ref(16bits) |
+     *  -----------------------------*/
+    ann_key = AN_CREATE_KEY(type, ann_ref);
+
+    /* See if annotation of 'type' with ref exits */
+    if ((entry = tbbtdfind(file_rec->an_tree[type], &ann_key, NULL)) == NULL)
+        HE_REPORT_GOTO("failed to find annotation of 'type'", FAIL);
+
+    /* get annotation entry from node */
+    ann_entry = (ANentry *) entry->data; 
+
+    /* return annotation id */
+    ret_value = ann_entry->ann_id;
+
+  done:
+    if(ret_value == FAIL)   
+      { /* Error condition cleanup */
+
+      } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* ANtagref2id */
+
+/*-------------------------------------------------------------------- 
+ NAME
+     ANatype2tag - annotation type to corresponding annotation TAG
+
+ DESCRIPTION
+     Translate annotation type to corresponding TAG
+
+ RETURNS
+     Returns TAG corresponding to annotatin type
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------*/
+EXPORT uint16
+ANatype2tag(ann_type atype /* IN: Annotation type */)
+{   /* Switch on annotation type "atype" */
+#ifdef LATER
+    CONSTR(FUNC, "ANatype2tag");    /* for HERROR */
+#endif /* LATER */
+    uint16 ann_tag;
+
+    switch((ann_type)atype) 
+      {
+      case AN_FILE_LABEL: ann_tag = DFTAG_FID; break;
+      case AN_FILE_DESC:  ann_tag = DFTAG_FD;  break;
+      case AN_DATA_LABEL: ann_tag = DFTAG_DIL; break;
+      case AN_DATA_DESC:  ann_tag = DFTAG_DIA; break;
+      default: ann_tag = DFTAG_NULL;  /*changed from 5 to DFTAG_NULL -BMR*/
+      } /* switch */
+    return ann_tag;
+} /* ANatype2tag */
+
+/*-------------------------------------------------------------------- 
+ NAME
+     ANtag2atype - annotation TAG to corresponding annotation type
+
+ DESCRIPTION
+     Translate annotation TAG to corresponding atype
+
+ RETURNS
+     Returns type corresponding to annotatin TAG
+
+ AUTHOR
+    GeorgeV.
+
+--------------------------------------------------------------------*/
+EXPORT ann_type
+ANtag2atype(uint16 atag /* IN: annotation tag */)
+{   /* Switch on annotation tag */
+#ifdef LATER
+    CONSTR(FUNC, "ANtag2atype");    /* for HERROR */
+#endif /* LATER */
+    ann_type atype;
+
+    switch((uint16)atag) 
+      {
+      case DFTAG_FID: atype = AN_FILE_LABEL; break;
+      case DFTAG_FD:  atype = AN_FILE_DESC;  break;
+      case DFTAG_DIL: atype = AN_DATA_LABEL; break;
+      case DFTAG_DIA: atype = AN_DATA_DESC;  break;
+          /* This will cause warnings on some compiliers */
+      default: atype = AN_UNDEF;
+      } /* switch */
+    return atype;
+} /* ANtag2atype */
+
+#endif /* MFAN_MASTER */
diff --git a/hdf/src/mfan.h b/hdf/src/mfan.h
new file mode 100644
index 0000000..5ccff98
--- /dev/null
+++ b/hdf/src/mfan.h
@@ -0,0 +1,363 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: mfan.h 5454 2010-08-27 17:24:55Z bmribler $ */
+
+/*------------------------------------------------------------------------------
+ * File:    mfan.h
+ * Author:  GeorgeV
+ * Purpose: header file for the Multi-file Annotation Interface
+ * Invokes: 
+ * Contents:
+ *          Structure definitions: ANnode, ANentry
+ *          Constant definitions:  AN_DATA_LABEL, AN_DATA_DESC
+ *          (-moved to hdf.h)      AN_FILE_LABEL, AN_FILE_DESC
+ *
+ *----------------------------------------------------------------------------*/
+
+#ifndef _MFAN_H  /* avoid re-inclusion */
+#define _MFAN_H
+
+#include "H4api_adpt.h"
+
+#include "hdf.h"
+
+#if 0
+/* enumerated types of the varous annotation types 
+ * NOTE: moved to hdf.h since they are used by end users. */
+typedef enum 
+{ 
+  AN_DATA_LABEL = 0, /* Data label */
+  AN_DATA_DESC,      /* Data description */
+  AN_FILE_LABEL,     /* File label */
+  AN_FILE_DESC       /* File description */
+} ann_type;
+#endif
+
+#if defined MFAN_MASTER | defined MFAN_TESTER
+/* WE ARE IN MAIN ANNOTATION SOURCE FILE "mfan.c" */
+
+/* PRIVATE variables and definitions */
+
+/* This sturcture is used to find which file the annotation belongs to
+ * and use the subsequent file specific annotation 'key' to find the 
+ * annotation. The annotation atom group(ANIDGROUP) keeps track of 
+ * all anotations across the file. */
+typedef struct ANnode
+{
+  int32   file_id;  /* which file this annotation belongs to */
+  int32   ann_key;  /* type/ref: used to find annotation in corresponding
+                       TBBT in filerec_t->tree[]. */
+  intn    new_ann;  /* flag */
+} ANnode;
+
+/*
+ * This structure is an entry in the label/desc tree
+ * for a label/desc in the file, it gives the ref of the label/desc,
+ * and the tag/ref of the data item to which the label/desc relates 
+ * The filerec_t->an_tree[] TBBT members will contain these entries.
+ **/
+typedef struct ANentry
+{
+  int32   ann_id;      /* annotation id */
+  uint16  annref;      /* ref of annotation */
+  uint16  elmtag;      /* tag of data */
+  uint16  elmref;      /* ref of data */
+} ANentry;
+
+
+/* This is the size of the hash tables used for annotation IDs */
+#define ANATOM_HASH_SIZE    64
+
+/* Used to create unique 32bit keys from annotation type and reference number 
+ *  This key is used to add nodes to a corresponding TBBT in 
+ *  filrerec_t->an_tree[]. 
+ *  ----------------------------
+ *  | type(16bits) | ref(16bits) |
+ *  -----------------------------*/
+#define AN_CREATE_KEY(t,r) ((((int32)t & 0xffff) << 16) | r)
+
+/* Obtain Reference number from key */
+#define AN_KEY2REF(k)      ((uint16)((int32)k & 0xffff))
+
+/* Obtain Annotation type from key */
+#define AN_KEY2TYPE(k)     ((int32)((int32)k >> 16))
+
+#else /* !defined MFAN_MASTER && !defined MFAN_TESTER */
+/* WE are NOT in main ANNOTATION source file
+ * Nothing EXPORTED except Public fcns */
+
+
+/******************************************************************************
+ NAME
+   ANstart - open file for annotation handling
+
+ DESCRIPTION
+   Start annotation handling on the file return a annotation ID to the file.
+
+ RETURNS
+   A file ID or FAIL.
+*******************************************************************************/
+HDFLIBAPI int32 ANstart(int32 file_id /* IN: file to start annotation access on */);
+
+/******************************************************************************
+ NAME
+   ANfileinfo - Report high-level information about the ANxxx interface for a given file.
+
+ DESCRIPTION
+   Reports general information about the number of file and object(i.e. data)
+   annotations in the file. This routine is generally used to find
+   the range of acceptable indices for ANselect calls.
+
+ RETURNS
+   Returns SUCCEED if successful and FAIL othewise
+
+*******************************************************************************/
+HDFLIBAPI intn  ANfileinfo(int32 an_id,         /* IN:  annotation interface id */
+                        int32 *n_file_label, /* OUT: the # of file labels */
+                        int32 *n_file_desc,  /* OUT: the # of file descriptions */
+                        int32 *n_obj_label,  /* OUT: the # of object labels */ 
+                        int32 *n_obj_desc    /* OUT: the # of object descriptions */);
+
+/******************************************************************************
+ NAME
+   ANend - End annotation access to file file
+
+ DESCRIPTION
+   End annotation access to file.
+
+ RETURNS
+   SUCCEED if successful and  FAIL otherwise.
+*******************************************************************************/
+HDFLIBAPI int32 ANend(int32 an_id /* IN: Annotation ID of file to close */);
+
+/******************************************************************************
+ NAME
+   ANcreate - create a new element annotation and return a handle(id)
+
+ DESCRIPTION
+   Creates a data annotation, returns an 'an_id' to work with the new 
+   annotation which can either be a label or description.
+   Valid annotation types are AN_DATA_LABEL for data labels and 
+   AN_DATA_DESC for data descriptions.
+
+ RETURNS
+        An ID to an annotation which can either be a label or description.
+*******************************************************************************/
+HDFLIBAPI int32 ANcreate(int32 an_id,     /* IN: annotation interface ID */
+                      uint16 elem_tag, /* IN: tag of item to be assigned annotation */
+                      uint16 elem_ref, /* IN: reference number of itme to be assigned ann*/
+                      ann_type type    /* IN: annotation type */);
+
+
+/******************************************************************************
+ NAME
+	ANcreatef - create a new file annotation and return a handle(id)
+
+ DESCRIPTION
+    Creates a file annotation, returns an 'an_id' to work with the new 
+    file annotation which can either be a label or description.
+    Valid annotation types are AN_FILE_LABEL for file labels and
+    AN_FILE_DESC for file descritpions.
+
+ RETURNS
+        An ID to an annotation which can either be a file label or description
+*******************************************************************************/
+HDFLIBAPI int32 ANcreatef(int32 an_id,  /* IN: annotation interface ID */
+                       ann_type type /* IN:  annotation type */);
+
+/******************************************************************************
+ NAME
+	ANselect - get an annotation ID from index of 'type'
+
+ DESCRIPTION
+    Get an annotation Id from index of 'type'.
+    The position index is ZERO based
+
+ RETURNS
+    An ID to an annotation type which can either be a label or description 
+*******************************************************************************/
+HDFLIBAPI int32 ANselect(int32 an_id,  /* IN: annotation interface ID */
+                      int32 index,  /* IN: index of annottion to get ID for */
+                      ann_type type /* IN: annotation type */);
+
+/******************************************************************************
+ NAME
+   ANnumann - find number of annotation of 'type' that  match the given element tag/ref 
+
+ DESCRIPTION
+   Find number of annotation of 'type' for the given element 
+   tag/ref pair.Should not be used for File labels and
+   descriptions.
+
+ RETURNS
+   number of annotation found if successful and FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI intn  ANnumann(int32 an_id,     /* IN: annotation interface id */
+                      ann_type type,   /* IN: annotation type */
+                      uint16 elem_tag, /* IN: tag of item of which this is annotation */
+                      uint16 elem_ref  /* IN: ref of item of which this is annotation*/);
+
+/******************************************************************************
+ NAME
+   ANannlist - generate list of annotation ids of 'type' that match the given element tag/ref 
+
+ DESCRIPTION
+   Find and generate list of annotation ids of 'type' for the given 
+   element tag/ref pair.Should not be used for File labels and
+   descriptions.
+
+ RETURNS
+   number of annotations ids found if successful and FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI intn  ANannlist(int32 an_id,     /* IN: annotation interface id */
+                       ann_type type,   /* IN: annotation type */
+                       uint16 elem_tag, /* IN: tag of item of which this is annotation */
+                       uint16 elem_ref, /* IN: ref of item of which this is annotation*/
+                       int32 ann_list[] /* OUT: array of ann_id's that match criteria.*/);
+
+/******************************************************************************
+ NAME
+   ANannlen - get length of annotation givne annotation id
+
+ DESCRIPTION
+   Uses the annotation id to find ann_key & file_id
+
+ RETURNS
+   length of annotation if successful and FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI int32 ANannlen(int32 ann_id /* IN: annotation id */);
+
+/******************************************************************************
+ NAME
+   ANwriteann - write annotation given ann_id
+
+ DESCRIPTION
+   Checks for pre-existence of given annotation, replacing old one if it
+   exists. Writes out annotation.
+
+ RETURNS
+   SUCCEED (0) if successful and FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI int32 ANwriteann(int32 ann_id,    /* IN: annotation id */
+                        const char *ann, /* IN: annotation to write */
+                        int32 annlen     /* IN: length of annotation*/);
+
+/******************************************************************************
+ NAME
+   ANreadann - read annotation given ann_id
+
+ DESCRIPTION
+   Gets tag and ref of annotation.  Finds DD for that annotation.
+   Reads the annotation, taking care of NULL terminator, if necessary.
+
+ RETURNS
+   SUCCEED (0) if successful and FAIL (-1) otherwise
+
+*******************************************************************************/
+HDFLIBAPI int32 ANreadann(int32 ann_id, /* IN: annotation id (handle) */
+                       char *ann,    /* OUT: space to return annotation in */
+                       int32 maxlen  /* IN: size of space to return annotation in */);
+
+/******************************************************************************
+ NAME
+	ANendaccess - end access to an annotation given it's id
+
+ DESCRIPTION
+    Terminates access to an annotation. For now does nothing
+
+ RETURNS
+    SUCCEED(0) or FAIL(-1)
+*******************************************************************************/
+HDFLIBAPI intn  ANendaccess(int32 ann_id /* IN: annotation id */);
+
+/******************************************************************************
+ NAME
+   ANget_tagref - get tag/ref pair for annotation based on type and index
+
+ DESCRIPTION
+   Get the tag/ref of the annotation based on  the type and index of the 
+   annotation. The position index is zero based
+
+ RETURNS
+   A tag/ref pairt to an annotation type which can either be a 
+   label or description.
+
+*******************************************************************************/
+HDFLIBAPI int32 ANget_tagref(int32 an_id,    /* IN: annotation interface ID */
+                          int32 index,    /* IN: index of annotation to get tag/ref for*/
+                          ann_type type,  /* IN: annotation type */
+                          uint16 *ann_tag,/* OUT: Tag for annotation */ 
+                          uint16 *ann_ref /* OUT: ref for annotation */);
+
+/******************************************************************************
+ NAME
+   ANid2tagref -- get tag/ref given annotation id
+
+ DESCRIPTION
+   Uses the annotation id to find ann_node entry which contains ann_ref
+
+ RETURNS
+   SUCCEED(0) if successful and FAIL (-1) otherwise. 
+*******************************************************************************/
+HDFLIBAPI int32 ANid2tagref(int32 ann_id,    /* IN: annotation id */
+                         uint16 *ann_tag, /* OUT: Tag for annotation */
+                         uint16 *ann_ref  /* OUT: ref for annotation */);
+
+/******************************************************************************
+ NAME
+   ANtagref2id -- get annotation id given tag/ref
+
+ DESCRIPTION
+   Gets the annotation id of the annotation given the tag/ref of
+   the annotation itself and the annotation interface id.
+
+ RETURNS
+   Annotation id of annotation if successful and FAIL(-1) otherwise. 
+*******************************************************************************/
+HDFLIBAPI int32 ANtagref2id(int32 an_id,    /* IN  Annotation interface id */
+                         uint16 ann_tag, /* IN: Tag for annotation */
+                         uint16 ann_ref  /* IN: ref for annotation */);
+
+/******************************************************************************
+ NAME
+   ANatype2tag - annotation type to corresponding annotation TAG
+
+ DESCRIPTION
+   Translate annotation type to corresponding TAG.
+
+ RETURNS
+   Returns TAG corresponding to annotatin type.
+*******************************************************************************/
+HDFLIBAPI uint16 ANatype2tag(ann_type atype /* IN: Annotation type */);
+
+/******************************************************************************
+ NAME
+   ANtag2atype - annotation TAG to corresponding annotation type
+
+ DESCRIPTION
+   Translate annotation TAG to corresponding atype
+
+ RETURNS
+   Returns type corresponding to annotatin TAG.
+*******************************************************************************/
+HDFLIBAPI ann_type ANtag2atype(uint16 atag /* IN: annotation tag */);
+
+
+#endif /* !defined MFAN_MASTER && !MFAN_TESTER */
+
+#endif /* _MFAN_H */
diff --git a/hdf/src/mfanf.c b/hdf/src/mfanf.c
new file mode 100644
index 0000000..2682512
--- /dev/null
+++ b/hdf/src/mfanf.c
@@ -0,0 +1,503 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: mfanf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:     mfanf.c
+ * Author:   GeorgeV.
+ * Purpose:  C-stubs for multi-file Fortran annotation routines
+ * Invokes:  C-Routines in "mfan.c"
+ * Contents: SEE annotation source/header files "mfan.c" and "mfan.h"
+ *           for more info on the annotation interface.
+ *
+ *  NOTES: TYPE here refers to file/data label/description types 
+ *         They are AN_FILE_LABEL, AN_FILE_DESC, AN_DATA_LABEL, AN_DATA_DESC
+ *         THE tag/ref refers to data tag/ref. The fortran equivalents
+ *         are defined in 'hdf.inc'.
+ *
+ *  C-stubs directly callable by Fortran Users
+ *  ------------------------------------------
+ *    afstart    - start annotation access on file and return annotaton id
+ *    affileinfo - get number of file/data annotations in file. 
+ *                 Indices returned are used in afselect() calls.
+ *    afend      - end access to annotation handling on file
+ *    afcreate   - create a new data annotation and return a handle
+ *    affcreate  - create a new file annotation and return a handle
+ *    afselect   - returns an annotation handle(ann_id) from index for 
+ *                 a particular annotation TYPE. This handle is then used for
+ *                 calls like afwriteann(), afreadann(), afannlen(),..etc
+ *    afnumann   - return number of annotations that match TYPE/tag/ref
+ *    afannlist  - return list of handles that match TYPE/tag/ref
+ *    afannlen   - get length of annotation given handle
+ *    afwriteann - write annotation given handle
+ *    afreadann  - read annotation given handle
+ *    afendaccess - end access to annotation using handle
+ *    afgettagref - get tag/ref pair to annotation ID
+ *    afidtagref  - get tag/ref given annotation id 
+ *    aftagrefid  - get annotation id given tag/ref
+ *    afatypetag  - annotation type to corresponding annotation TAG
+ *    aftagatype  - annotation TAG to corresponding annotation type
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "mfan.h"
+#include "hproto_fortran.h"
+
+/*-----------------------------------------------------------------------------
+  FUNCTION NAMEING CONVENTION:
+  ---------------------------
+  This file contains the HDF-style C stubs for the multi-file Annotation
+  interface. They call the corresponding C-functions in "mfan.c"
+
+  The basic routines called by fortran will be of the form afxxxx
+
+  If only a C stub is needed it will be named nafxxxx have the FNAME()
+  function applied to it.
+
+  If a Fortran stub is also required the fortran stub will be called
+  afxxxx(mfanff.f) and the one in here will be nacxxx and again be FNAME()ed
+
+-----------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------------------
+ * Name:    afstart
+ * Purpose: Open file for annoation handling
+ * Inputs:  file_id: id of HDF file
+ * Returns: annotation interface handle on SUCCEED and FAIL otherwise
+ * Users:   
+ * Invokes: ANstart()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafstart(intf *file_id)
+{
+  intf ret;
+
+  ret = ANstart((int32)*file_id);
+
+  return (ret);
+} /* nafstart() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    affileinfo
+ * Purpose: Get number of file/data annotations in file. 
+ * Inputs:  IN an_id:     annotation interface handle
+ *          OUT num_flabel: number of file labels in file
+ *          OUT num_fdesc:  number of file descriptions in file
+ *          OUT num_olabel: number of data labels in file
+ *          OUT num_odesc:  number of data descriptions in file
+ * Returns: see ANfileinfo()
+ * Users:   Fortran Users
+ * Invokes: ANfileinfo()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+naffileinfo(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel,
+            intf *num_odesc)
+{
+#ifdef LATER
+  CONSTR(FUNC, "affileinfo");
+#endif /* LATER */
+  intf  ret;
+  int32 nflabel, nfdesc, nolabel, nodesc; 
+
+  ret = ANfileinfo((int32)*an_id, &nflabel, &nfdesc, &nolabel, &nodesc);
+
+  /* fill in values to return */
+  *num_flabel = nflabel;
+  *num_fdesc  = nfdesc;
+  *num_olabel = nolabel;
+  *num_odesc  = nodesc;
+
+  return ret;
+} /* naffileinfo() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afend    
+ * Purpose: End access to annotation handling on file
+ * Inputs:  file_id:
+ * Returns: see ANend()
+ * Users:   Fortran Users
+ * Invokes: ANend()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafend(intf *an_id)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afend");
+#endif /* LATER */
+
+  return (intf)ANend((int32) *an_id);
+} /* nafend() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afcreate
+ * Purpose: Create a new data annotation and return an annotation handle 
+ * Inputs:  an_id: annotation interface handle
+ *          etag:    tag of data to annotate
+ *          eref:    ref of data to annotate
+ *          atype:   annotation type AN_DATA_LABEL, AN_DATA_DESC
+ * Returns: see ANcreate()
+ * Users:   Fortran Users
+ * Invokes: ANcreate()
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafcreate(intf *an_id, intf *etag, intf *eref, intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afcreate");
+#endif /* LATER */
+
+  return (intf)ANcreate((int32)*an_id,(uint16)*etag,(uint16)*eref,(ann_type)*atype);
+} /* nafcreate() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    affcreate
+ * Purpose: Create a new file annotation and return an annotation handle
+ * Inputs:  an_id: annottion inteface handle
+ *          atype:   annotation type AN_FILE_LABEL, AN_DATA_DESC
+ * Returns: see ANcreatef()
+ * Users:   Fortran Users
+ * Invokes: ANcreatf()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+naffcreate(intf *an_id, intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "affcreate");
+#endif /* LATER */
+
+  return (intf)ANcreatef((int32)*an_id,(ann_type)*atype);
+} /* naffcreate() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afselect
+ * Purpose: returns an annotation handle(ann_id) from index for 
+ *          a particular annotation TYPE. This handle is then used for
+ *          calls like afwriteann(), afreadann(), afannlen(),..etc
+ * Inputs:  an_id: annotation interface handle
+ *          index:   index for particular annoation type. Usually based on
+ *                   number of a particular type obtained from affileinfo()call.
+ *                   ZERO based.
+ *          atype:   annotation type AN_FILE_LABEL, AN_FILE_DESC, AN_DATA_LABEL
+ *                   AN_DATA_DESC
+ * Returns: see ANselect()
+ * Users:   Fortran Users
+ * Invokes: ANselect()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafselect(intf *an_id, intf *index, intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afselect");
+#endif /* LATER */
+
+  return (intf)ANselect((int32)*an_id,(int32)*index, (ann_type)*atype);
+} /* nafselect() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afnumann
+ * Purpose: Return number of annotations that match TYPE/tag/ref
+ * Inputs:  an_id: annotation interface handle
+ *          atype:   annotation type AN_DATA_LABEL, AN_DATA_DESC
+ *          etag:    data tag to match
+ *          eref:    data ref to match
+ * Returns: see ANnumann()
+ * Users:   Fortran Users
+ * Invokes: ANnumann()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafnumann(intf *an_id, intf *atype, intf *etag, intf *eref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afnumann");
+#endif /* LATER */
+
+  return (intf)ANnumann((int32)*an_id,(ann_type)*atype,(uint16)*etag,(uint16)*eref);
+} /* nafnumann() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afannlist
+ * Purpose: Return list of handles that match TYPE/tag/ref
+ * Inputs:  IN an_id: annotation inteface handle
+ *          IN atype:   annotation type AN_DATA_LABEL, AN_DATA_DESC
+ *          IN etag:    data tag to match
+ *          IN eref:    data ref to match
+ *          OUT alist[]: list of annotation handles found that match tag/ref
+ * Returns: number of annoations found that match else FAIL. see ANannlist()
+ * Users:   Fortran Users
+ * Invokes: ANnumann(), ANannlist()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafannlist(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[])
+{
+  CONSTR(FUNC, "afannlist");
+  intf  ret;
+  int32 *tempanlist;
+  intf  nanns;
+  intn  i;
+
+  /* Get number of annotations that match tag/ref pair */
+  nanns = ANnumann((int32)*an_id,(ann_type)*atype,(uint16)*etag,(uint16)*eref);
+  if (nanns < 0)
+    HE_REPORT_RETURN("ANnumann: failed to any annotations", FAIL);
+
+  /* create annlist with true int32s to maintain compatibility
+  ** with machines that allocate less than 32 bits per int. */
+  if ((tempanlist = (int32 *) HDmalloc(nanns * sizeof(int32))) == NULL)
+    HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+  /* Get list of annoation handles to return */
+  ret = ANannlist((int32)*an_id,(ann_type)*atype,(uint16)*etag,(uint16)*eref,
+                  tempanlist);
+  if (ret < 0)
+    HE_REPORT_RETURN("ANannlist:failed to any annotations", FAIL);
+
+  /* move annotation handles into caller's alist */
+  for (i = 0; i < nanns; i++)
+    alist[i] = tempanlist[i];
+
+  HDfree((VOIDP) tempanlist); /* free allocated space */
+
+  return ret;
+} /* nafannlist() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afannlen
+ * Purpose: Get length of annotation given handle
+ * Inputs:  an_id:annotation handle
+ * Returns: see ANannlen()
+ * Users:   Fortran Users
+ * Invokes: ANannlen()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafannlen(intf *an_id)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afannlen");
+#endif /* LATER */
+
+    return (intf)ANannlen((int32)*an_id);
+} /* nafannlen() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afwriteann
+ * Purpose: Write annotation given handle
+ * Inputs:  ann_id: annotation handle
+ *          ann:   annotation to write out
+ *          annlen:length of annotation
+ * Returns: see ANwriteann()
+ * Users:   Fortran Users
+ * Invokes: ANwriteann()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafwriteann(intf *ann_id,_fcd ann, intf *annlen)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afwriteann");
+#endif /* LATER */
+
+    char       *iann = NULL;
+    intf        status;
+
+    /* Convert fortran string to C-String */
+    iann = HDf2cstring(ann, (intn) *annlen);
+    if (!iann)
+        return(FAIL);
+
+    status = ANwriteann((int32)*ann_id, (char *) _fcdtocp(ann), (int32)*annlen);
+
+    HDfree(iann); /* free allocaed space by HDf2cstring */
+
+    return status;
+} /* nafwriteann() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afreadann
+ * Purpose: Read annotation given handle
+ * Inputs:  ann_id:  annotation handle
+ *          ann:    annotation read
+ *          maxlen: maximum space allocted for "ann"
+ * Returns: see ANreadann() (SUCCEED (0) if successful, else FAIL (-1))
+ * Users:   Fortran Users
+ * Invokes: ANreadann()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafreadann(intf *ann_id,_fcd ann, intf *maxlen)
+{
+    CONSTR(FUNC, "afreadann");
+    char	*iann = NULL;
+    intn        status;
+
+    /* Allocate space for fortran string */
+    if (*maxlen)
+        iann = (char *) HDmalloc((uint32) *maxlen + 1);
+
+    if (!iann)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    status = ANreadann((int32)*ann_id, iann, (int32)*maxlen);
+
+    /* C-String to Fortran String */
+    HDpackFstring(iann, _fcdtocp(ann), (intn) *maxlen);
+
+    if (iann)
+        HDfree(iann); /* free allocated space */
+
+    return status;
+} /* nafreadann() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afendaccess
+ * Purpose: End access to annotation using handle
+ * Inputs:  ann_id:annotation handle
+ * Returns: see ANendaccess()
+ * Users:   Fortran Users
+ * Invokes: ANendaccess()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafendaccess(intf *ann_id)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afendaccess");
+#endif /* LATER */
+
+  return (intf)ANendaccess((int32)*ann_id);
+} /* nafendaccess() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afgettagref 
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANget_tagref()
+ * Users:   Fortran Users
+ * Invokes: ANget_tagref()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafgettagref(intf *an_id, intf *index, intf *type, intf *tag, intf *ref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afgettagref");
+#endif /* LATER */
+  intf   ret;
+  uint16 otag, oref;
+
+  ret = (intf)ANget_tagref((int32)*an_id,(int32)*index,(ann_type)*type,
+                           &otag, &oref);
+
+  *tag = otag;
+  *ref = oref;
+
+  return ret;
+} /* nafgettagref() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afidtagref
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANid2tagref()
+ * Users:   Fortran Users
+ * Invokes: ANid2tagerf()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafidtagref(intf *ann_id, intf *tag, intf *ref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "afidtagref");
+#endif /* LATER */
+  intf   ret;
+  uint16 otag, oref;
+
+  ret = (intf)ANid2tagref((int32)*ann_id, &otag, &oref);
+
+  *tag = otag;
+  *ref = oref;
+
+  return ret;
+} /* nafidtagref() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    aftagrefid
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANtagref2id()
+ * Users:   Fortran Users
+ * Invokes: ANtagref2id()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+naftagrefid(intf *an_id, intf *tag, intf *ref)
+{
+#ifdef LATER
+  CONSTR(FUNC, "aftagrefid");
+#endif /* LATER */
+  
+  return (intf)ANtagref2id((int32)*an_id, (uint16)*tag, (uint16)*ref);
+
+} /* naftagrefid() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    afatypetag
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANatype2tag()
+ * Users:   Fortran Users
+ * Invokes: ANatype2tag()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nafatypetag(intf *atype)
+{
+#ifdef LATER
+  CONSTR(FUNC, "aftypetag");
+#endif /* LATER */
+
+  return (intf)ANatype2tag((ann_type)*atype);
+
+} /* nafatypetag() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    aftagatype
+ * Purpose: 
+ * Inputs:  
+ * Returns: see ANtag2atype()
+ * Users:   Fortran Users
+ * Invokes: ANtag2atype()
+ * Author: GeorgeV
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+naftagatype(intf *tag)
+{
+#ifdef LATER
+  CONSTR(FUNC, "aftagatype");
+#endif /* LATER */
+
+  return (intf)ANtag2atype((uint16)*tag);
+
+} /* naftagatype() */
diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c
new file mode 100644
index 0000000..369e164
--- /dev/null
+++ b/hdf/src/mfgr.c
@@ -0,0 +1,6678 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 5831 $";
+#endif
+
+/* $Id: mfgr.c 5831 2012-07-20 07:03:42Z bmribler $ */
+
+/*
+FILE
+    mfgr.c
+
+PURPOSE
+    Multi-file access to "generic" raster images
+
+REMARKS
+    These functions perform manipulate "generic" raster images.  These
+    raster images are composed of "pixels" which can have multiple
+    components of data-types other than 8-bit unsigned integers.  Each
+    image can have multiple palettes associated with it and other 'attributes'
+    in the same "name=value" style as the SD*() routines have.
+
+DESIGN
+        These routines are modeled loosely after the previous single-file
+    DFGR*() routines and the current SD*() routines.  There is a table of
+    pointers to sets of raster images stored in the files which have been
+    initialized, similar to the current Vgroup/Vdata implementation.  The table
+    contains entries for each file which contain pointers to set of information
+    about the "global" attributes (for this interface) and to the set of raster
+    images in the file.
+        Each set of information for each file is stored in memory using
+    the tbbt*() routines.
+        Each raster image (RI) in the file will be stored in one Vgroup which
+    will contain all the RIs created as well as the "global" raster attributes.
+        Each RI in the file will be stored as a Vgroup containing the image data
+    for each RI as well as the palettes and dataset attributes for that image.
+    Also, each RI Vgroup will have a corresponding RIG created with it and
+    maintained in parallel, for backward compatibility.
+
+BUGS/LIMITATIONS
+   Currently the following design limitations are still in place:
+   1 - Cannot have pixels or palette entries which contain mixed variable
+        types, ie. all the pixel/palette components must be of the same
+        number type.
+   2 - Currently all the components must be of valid HDF number types,
+        fractional bytes (ie. 6-bit components) or 'plain' multiple byte values
+        are not handled, although they can be packed into the next larger
+        sized number type in order to hold them.
+
+EXPORTED ROUTINES
+
+File/Interface Functions:
+int32 GRstart(int32 hdf_file_id)
+    - Initializes the GR interface for a particular file. Returns a 'grid' to
+        specify the GR group to operate on.
+intn GRfileinfo(int32 grid, int32 *n_datasets, int32 *n_attrs)
+    - Returns information about the datasets and "global" attributes for the
+        GR interface.
+intn GRend(int32 grid)
+    - Terminates multi-file GR access for a file.
+
+Image I/O Functions:
+int32 GRcreate(int32 grid,char *name,int32 ncomp,int32 nt,int32 il,int32 dimsizes[2])
+    - Defines a raster image in a file.  Returns a 'riid' to work with the new
+        raster image.
+int32 GRselect(int32 grid,int32 index)
+    - Selects an existing RI to operate on.
+int32 GRnametoindex(int32 grid,char *name)
+    - Maps a RI name to an index which is returned.
+intn GRgetiminfo(int32 riid,char *name,int32 *ncomp,int32 *nt,int32 *il,int32 dimsizes[2],int32 *n_attr)
+    - Gets information about an RI which has been selected/created.
+intn GRgetnluts(int32 riid)
+    - Get the number of palettes (LUTs) for an image
+intn GRwriteimage(int32 riid,int32 start[2],int32 stride[2],int32 count[2],void * data)
+    - Writes image data to an RI.  Partial dataset writing and subsampling is
+        allowed, but only with the dimensions of the dataset (ie. no UNLIMITED
+        dimension support)
+intn GRreadimage(int32 riid,int32 start[2],int32 stride[2],int32 count[2],void * data)
+    - Read image data from an RI.  Partial reads and subsampling are allowed.
+intn GRendaccess(int32 riid)
+    - End access to an RI.
+
+Dimension Functions:
+int32 GRgetdimid(int32 riid,int32 index)
+    - Get a dimension id ('dimid') for an RI to assign atrributes to. [Later]
+intn GRsetdimname(int32 dimid,char *name)
+    - Set the name of a dimension. [Later]
+int32 GRdiminfo(int32 dimid,char *name,int32 *size,int32 *n_attr)
+    - Get information about the dimensions attributes and size. [Later]
+
+ID/Ref/Index Functions:
+uint16 GRidtoref(int32 riid)
+    - Maps an riid to a reference # for annotating or including in a Vgroup.
+int32 GRreftoindex(int32 hdf_file_id,uint16 ref)
+    - Maps the reference # of an RI into an index which can be used with
+        GRselect.
+
+Interlace Request Functions:
+intn GRreqlutil(int32 riid,intn il)
+    - Request that the next LUT read from an RI have a particular interlace.
+intn GRreqimageil(int32 riid,intn il)
+    - Request that the image read from an RI have a particular interlace.
+
+LUT/Palette I/O Functions:
+int32 GRgetlutid(int32 riid,int32 index)
+    - Get a palette id ('palid') for an RI.
+uint16 GRluttoref(int32 lutid)
+    - Maps a lutid to a reference # for annotating of including in a Vgroup.
+intn GRgetlutinfo(int32 lutid,int32 *ncomp,int32 *nt,int32 *il,int32 *nentries)
+    - Gets information about a palette.
+intn GRwritelut(int32 lutid,int32 ncomps,int32 nt,int32 il,int32 nentries,void * data)
+    - Writes out a palette for an RI.
+intn GRreadlut(int32 palid,void * data)
+    - Reads a palette from an RI.
+
+Special Element Functions:
+int32 GRsetexternalfile(int32 riid,char *filename,int32 offset)
+    - Makes the image data of an RI into an external element special element.
+intn GRsetaccesstype(int32 riid,uintn accesstype)
+    - Sets the access for an RI to be either serial or parallel I/O.
+intn GRsetcompress(int32 riid,comp_coder_t comp_type,comp_info *cinfo)
+    - Makes the image data of an RI into a compressed special element.
+intn GRgetcompress(int32 riid,comp_coder_t* comp_type,comp_info *cinfo)
+    - Retrieves the compression information of a raster image's data.
+intn GRgetcompinfo(int32 riid,comp_coder_t* comp_type,comp_info *cinfo)
+    - Retrieves the compression information of a raster image's data.
+      Will replace GRgetcompress in the future.
+
+Attribute Functions:
+intn GRsetattr(int32 dimid|riid|grid,char *name,int32 attr_nt,int32 count,void * data)
+    - Write an attribute for an object.
+int32 GRattrinfo(int32 dimid|riid|grid,int32 index,char *name,int32 *attr_nt,int32 *count)
+    - Get attribute information for an object.
+intn GRgetattr(int32 dimid|riid|grid,int32 index,void * data)
+    - Read an attribute for an object.
+int32 GRfindattr(int32 dimid|riid|grid,char *name)
+    - Get the index of an attribute with a given name for an object.
+
+Chunking Functions:
+     GRsetchunk     -- make GR a chunked GR
+     GRgetchunkinfo -- get Info on GR
+     GRwritechunk   -- write the specified chunk to the GR
+     GRreadchunk    -- read the specified chunk to the GR
+     GRsetchunkcache -- maximum number of chunks to cache 
+
+LOCAL ROUTINES
+intn GRIil_convert(const void * inbuf,gr_interlace_t inil,void * outbuf,
+        gr_interlace_t outil,int32 dims[2],int32 ncomp,int32 nt);
+    - Copy a pixel buffer from one interlace to another.
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   10/20/95  - Starting writing specs & coding prototype
+    3/ 8/96  - Modifications to remove compiled limits on the # of files
+ */
+
+#define MFGR_MASTER
+#include "hdf.h"
+#include "hlimits.h"
+
+#ifdef H4_HAVE_LIBSZ          /* we have the library */
+#include "szlib.h"
+#endif
+
+/* Local pre-processor macros */
+#define XDIM    0
+#define YDIM    1
+
+/*
+   * --------------------------------------------------------------------
+   * PRIVATE  data structure and routines.
+   * --------------------------------------------------------------------
+ */
+static TBBT_TREE *gr_tree=NULL;
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+PRIVATE intn GRIupdatemeta(int32 hdf_file_id,ri_info_t *img_ptr);
+
+PRIVATE intn GRIupdateRIG(int32 hdf_file_id,ri_info_t *img_ptr);
+
+PRIVATE intn GRIupdateRI(int32 hdf_file_id,ri_info_t *img_ptr);
+
+PRIVATE intn GRIup_attr_data(int32 hdf_file_id,at_info_t *attr_ptr);
+
+PRIVATE intn GRIstart(void);
+
+PRIVATE intn GRIgetaid(ri_info_t *img_ptr, intn acc_perm);
+
+PRIVATE intn GRIisspecial_type(int32 file_id, uint16 tag, uint16 ref);
+
+/*--------------------------------------------------------------------------
+ NAME
+    rigcompare
+ PURPOSE
+    Compare two B-tree keys for equality.
+ USAGE
+    intn rigcompare(k1, k2, cmparg)
+        void * k1, k2;               IN: ptrs to the keys for the tree elements
+        intn cmparg;                IN/OUT: unused
+ RETURNS
+    Returns negative for k2>k1, positive for k2<k1 and 0 for k2=k1
+ DESCRIPTION
+    Similar to memcmp function, this routine just compares tree keys for
+    greater/equal/lesser status.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+
+  *** Only called by B-tree routines, should _not_ be called externally ***
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn rigcompare(void * k1, void * k2, intn cmparg)
+{
+    /* shut compiler up */
+    cmparg = cmparg;
+
+    return ((intn) ((*(int32 *) k1) - (*(int32 *) k2)));    /* valid for integer keys */
+}   /* rigcompare */
+
+/* ---------------------------- GRIgrdestroynode ------------------------- */
+/*
+   Frees B-Tree gr_info_t nodes
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+ */
+VOID
+GRIgrdestroynode(void * n)
+{
+    gr_info_t      *gr_ptr=(gr_info_t *)n;
+
+    /* clear out the tbbt's */
+    tbbtdfree(gr_ptr->grtree, GRIridestroynode, NULL);
+    tbbtdfree(gr_ptr->gattree, GRIattrdestroynode, NULL);
+
+    HDfree(gr_ptr);
+}   /* GRIgrdestroynode */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIattrdestroynode
+ PURPOSE
+    Frees B-Tree attribute nodes.
+ USAGE
+    VOID GRIattrdestroynode(n)
+        void * n;               IN: ptr to the attr node to delete
+ RETURNS
+    none
+ DESCRIPTION
+    Called internally by the tbbt*() routines, this routine is used when
+    deleting trees.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+
+  *** Only called by B-tree routines, should _not_ be called externally ***
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+VOID GRIattrdestroynode(void * n)
+{
+    at_info_t *at_ptr=(at_info_t *)n;
+
+    if(at_ptr->name!=NULL)
+        HDfree(at_ptr->name);
+    if(at_ptr->data!=NULL)
+        HDfree(at_ptr->data);
+
+    HDfree(at_ptr);
+}   /* GRIattrdestroynode */
+       
+/*--------------------------------------------------------------------------
+ NAME
+    GRIridestroynode
+ PURPOSE
+    Frees B-Tree raster-image nodes.
+ USAGE
+    VOID GRIridestroynode(n)
+        void * n;               IN: ptr to the attr node to delete
+ RETURNS
+    none
+ DESCRIPTION
+    Called internally by the tbbt*() routines, this routine is used when
+    deleting trees.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+
+  *** Only called by B-tree routines, should _not_ be called externally ***
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+VOID GRIridestroynode(void * n)
+{
+    ri_info_t *ri_ptr=(ri_info_t *)n;
+
+    if(ri_ptr->name!=NULL)
+        HDfree(ri_ptr->name);
+    if(ri_ptr->ext_name!=NULL)
+        HDfree(ri_ptr->ext_name);
+    tbbtdfree(ri_ptr->lattree, GRIattrdestroynode, NULL);
+    if(ri_ptr->fill_value!=NULL)
+        HDfree(ri_ptr->fill_value);
+
+    HDfree(ri_ptr);
+}   /* GRIridestroynode */
+       
+/* -------------------------- Get_grfile ------------------------ */
+/*
+   Looks in the TBBT gr_tree for the file ID of a file.
+   Returns a pointer to the gr_info_t for that file on success, otherwise NULL.
+ */
+PRIVATE gr_info_t *
+Get_grfile(HFILEID f)
+{
+    void * *t;       /* vfile_t pointer from tree */
+    int32 key=(int32)f;
+
+    t = (void **)tbbtdfind(gr_tree, &key, NULL);
+    return((gr_info_t *)(t==NULL ? NULL : *t));
+} /* end Get_grfile() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIisspecial_type
+ PURPOSE
+    Returns the special type if the given element is special.
+ USAGE
+    intn GRIisspecial_type(file_id, tag, ref)
+        int32 file_id;    IN: file id
+        uint16 tag;    IN: tag of the element
+        uint16 ref;    IN: ref of the element
+ RETURNS
+    Special type:
+  SPECIAL_LINKED
+  SPECIAL_EXT
+  SPECIAL_COMP
+  SPECIAL_VLINKED
+  SPECIAL_CHUNKED
+  SPECIAL_BUFFERED
+  SPECIAL_COMPRAS
+    or 0 if the element is not special element.
+ DESCRIPTION
+    Called internally by the GRIget_image_list to allow a chunked or 
+    linked-block element to proceed eventhough its offset is 0.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+
+  *** Only called by library routines, should _not_ be called externally ***
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn
+GRIisspecial_type(int32 file_id, uint16 tag, uint16 ref)
+{
+    CONSTR(FUNC, "GRIisspecial_type");
+    accrec_t* access_rec=NULL;/* access element record */
+    int32     aid;
+    intn      ret_value=0;
+
+    /* clear error stack */
+    HEclear();
+
+    /* start read access on the access record of the data element, which
+       is being inquired for its special information */
+    aid = Hstartread(file_id, tag, ref);
+
+    /* get the access_rec pointer */
+    access_rec = HAatom_object(aid);
+    if (access_rec == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* only return the valid special code, anything else return 0 */
+    switch (access_rec->special)
+    {
+  case SPECIAL_LINKED:
+  case SPECIAL_EXT:
+  case SPECIAL_COMP:
+  case SPECIAL_VLINKED:
+  case SPECIAL_CHUNKED:
+  case SPECIAL_BUFFERED:
+  case SPECIAL_COMPRAS:
+      ret_value = access_rec->special;
+      break;
+  default:
+      ret_value = 0;
+    } /* switch */
+
+    if (Hendaccess(aid)== FAIL)
+        HERROR(DFE_CANTENDACCESS);
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+  /* end access to the aid if it's been accessed */
+  if (aid != 0)
+      if (Hendaccess(aid)== FAIL)
+    HERROR(DFE_CANTENDACCESS);
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* GRIisspecial_type */
+
+/* -------------------------- New_grfile ------------------------ */
+/*
+   Creates gr_info_t structure and adds it to the tree
+   Returns a pointer to the gr_info_t for that file on success, otherwise NULL.
+ */
+PRIVATE gr_info_t *
+New_grfile(HFILEID f)
+{
+    gr_info_t *g;
+    
+    /* Allocate the gr_info_t structure */
+    if (NULL == (g = (gr_info_t *) HDcalloc(1,sizeof(gr_info_t))))
+      return(NULL);
+
+    /* Assign the file ID & insert into the tree */
+    g->hdf_file_id=f;
+    tbbtdins(gr_tree, g, NULL);    /* insert the vg instance in B-tree */
+
+    return(g);
+} /* end New_grfile() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIget_image_list
+ PURPOSE
+    Find all the unique raster images in the file
+ USAGE
+    intn GRIget_image_list(hdf_file_id,gr_info)
+        int32 hdf_file_id;          IN: file ID from Hopen
+        gr_info_t *gr_info;         IN: # of unique images found
+ RETURNS
+    Return SUCCEED/FAIL
+ DESCRIPTION
+    Sifts through all the images in a file and compiles a list of all the
+    unique ones.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+   o Count the maximum number of possible raster images in the file
+   o Search through the file for raster images
+      - Look for RI8s
+      - Look for RIGs
+      - Look for an RI Vgroup, then read in RIs & "global" attributes.
+   o Eliminate duplicate images
+   o Throw all the remaining RI8s, RIGs, and RIs into an internal table with
+      appropriate information about each of them
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static intn GRIget_image_list(int32 file_id,gr_info_t *gr_ptr)
+{
+    CONSTR(FUNC, "GRIget_image_list");
+    uint16      gr_ref;         /* ref # of the Vgroup containing new-style RIs */
+    intn        curr_image;     /* current image gathering information about */
+    intn        nimages;        /* total number of potential images */
+    int32       nri, nci, nri8, nci8, nii8, nvg;   /* number of RIs, CIs, RI8s, CI8s & II8s & Vgroups */
+    struct image_info {
+        uint16 grp_tag,grp_ref;         /* tag/ref of the group the image is in */
+        uint16 img_tag,img_ref;         /* tag/ref of the image itself */
+        uint16 aux_ref;                 /* ref of aux. info about an image */
+        int32 offset;                   /* offset of the image data */
+  uint16 orig_tag;    /* original tag before the elimination of duplicates */
+    } *img_info;
+    uint16      find_tag, find_ref;     /* storage for tag/ref pairs found */
+    int32       find_off, find_len;     /* storage for offset/lengths of tag/refs found */
+    intn        i, j;           /* local counting variable */
+    intn        ret_value = SUCCEED;
+
+    HEclear();
+
+    /* In a completely psychotic file, there could be RIGs with no corresponding
+       RI8s and also RI8s with no corresponding RIGs, so assume the worst
+       case and then run through them all to eliminate matched pairs */
+    nri = Hnumber(file_id, DFTAG_RI);     /* count the number of RI and CIs */
+    if (nri == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    nci = Hnumber(file_id, DFTAG_CI);     /* count the number of RI and CIs */
+    if (nci == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    nri8 = Hnumber(file_id, DFTAG_RI8);     /* add the number of RI8, CI8s and II8s */
+    if (nri8 == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    nci8 = Hnumber(file_id, DFTAG_CI8);
+    if (nci8 == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    nii8 = Hnumber(file_id, DFTAG_II8);
+    if (nii8 == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    nvg = Hnumber(file_id, RI_TAG);
+    if (nvg == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    nimages = (intn) (nri + nci + nri8 + nci8 + nii8 + nvg);
+
+    /* if there are no images just close the file and get out */
+    if (nimages == 0)
+      {
+        ret_value = (SUCCEED);
+        goto done;
+      }
+
+    /* Get space to store the image offsets */
+    if ((img_info = (struct image_info *) HDmalloc(nimages * sizeof(struct image_info))) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    HDmemset(img_info,0,(size_t)nimages*sizeof(struct image_info));    
+
+    /* search through the GR group for raster images & global attributes */
+    curr_image = 0;
+    if((gr_ref=(uint16)Vfind(file_id,GR_NAME))!=0)
+      {
+          int32       gr_key;         /* Vgroup key of the GR Vgroup */
+
+          gr_ptr->gr_ref=gr_ref; /* squirrel this away for later use */
+          if((gr_key=Vattach(file_id,(int32)gr_ref,"r"))!=FAIL)
+            {
+                int32 nobjs=Vntagrefs(gr_key); /* The number of objects in the Vgroup */
+                int32 img_key;  /* Vgroup key of an image */
+                int32 grp_tag,grp_ref;  /* a tag/ref in the Vgroup */
+                int32 img_tag,img_ref;  /* image tag/ref in the Vgroup */
+                char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+                
+                for(i=0; i<nobjs; i++)
+                  {
+                      if(Vgettagref(gr_key,i,&grp_tag,&grp_ref)==FAIL)
+                          continue;
+                      
+                      switch(grp_tag)
+                        {
+                            case DFTAG_VG:  /* should be an image */
+                                if((img_key=Vattach(file_id,grp_ref,"r"))!=FAIL)
+                                  {
+                                    if(Vgetclass(img_key,textbuf)!=FAIL)
+                                      {
+                                        if(!HDstrcmp(textbuf,RI_NAME))
+                                          { /* found an image, whew! */
+                                            for(j=0; j<Vntagrefs(img_key); j++)
+                                              {
+                                                  if(Vgettagref(img_key,j,&img_tag,&img_ref)==FAIL)
+                                                      continue;
+                                                  if(img_tag==DFTAG_RI || img_tag==DFTAG_CI)
+                                                    {
+                                                        img_info[curr_image].grp_tag=(uint16)grp_tag;
+                                                        img_info[curr_image].grp_ref=(uint16)grp_ref;
+                                                        img_info[curr_image].img_tag=(uint16)img_tag;
+                                                        img_info[curr_image].img_ref=(uint16)img_ref;
+                                                        img_info[curr_image].offset = Hoffset(file_id, (uint16)img_tag, (uint16)img_ref);     /* store offset */
+                                                        curr_image++;
+                                                        break;
+                                                    } /* end if */
+                                              } /* end for */
+                                          } /* end if */
+                                      } /* end if */
+                                    Vdetach(img_key);
+                                  } /* end if */
+                                break;
+
+                            case DFTAG_VH:  /* must be a "global" attaribute */
+                                  {
+                                      at_info_t *new_attr;  /* attribute to add to the set of local attributes */
+                                      int32 at_key;         /* VData key for the attribute */
+
+                                      if((new_attr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
+                                          HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                      new_attr->ref=(uint16)grp_ref;
+                                      new_attr->index=gr_ptr->gattr_count;
+                                      new_attr->data_modified=FALSE;
+                                      new_attr->new_at=FALSE;
+                                      new_attr->data=NULL;
+                                      if((at_key=VSattach(file_id,(int32)grp_ref,"r"))!=FAIL)
+                                        {
+                                            char *fname;
+
+                                            /* Make certain the attribute only has one field */
+                                            if(VFnfields(at_key)!=1)
+                                              {
+                                                VSdetach(at_key);
+                                                HDfree(new_attr);
+                                                break;
+                                              } /* end if */
+                                            new_attr->nt=VFfieldtype(at_key,0);
+                                            new_attr->len=VFfieldorder(at_key,0);
+                                            if(new_attr->len==1)
+                                                new_attr->len=VSelts(at_key);
+
+                                            /* Get the name of the attribute */
+                                            if((fname=VFfieldname(at_key,0))==NULL)
+                                              {
+                                                sprintf(textbuf,"Attribute #%d",(int)new_attr->index);
+                                                if((new_attr->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                                                  {
+                                                    VSdetach(at_key);
+                                                    HDfree(new_attr);
+                                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                                  } /* end if */
+                                                HDstrcpy(new_attr->name,textbuf);
+                                              } /* end if */
+                                            else
+                                              {
+                                                if((new_attr->name=(char *)HDmalloc(HDstrlen(fname)+1))==NULL)
+                                                  {
+                                                    VSdetach(at_key);
+                                                    HDfree(new_attr);
+                                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                                  } /* end if */
+                                                HDstrcpy(new_attr->name,fname);
+                                              } /* end else */
+                                                
+                                            tbbtdins(gr_ptr->gattree, new_attr, NULL);    /* insert the attr instance in B-tree */ 
+
+                                            VSdetach(at_key);
+                                        } /* end if */
+
+                                      gr_ptr->gattr_count++;
+                                  } /* end case */
+                                break;
+
+                            default:
+                                break;
+                        } /* end switch */
+                  } /* end for */
+              Vdetach(gr_key);
+            } /* end if */
+      } /* end if */
+
+    /* Get information about the RIGs in the file */
+    find_tag = find_ref = 0;
+    while (Hfind(file_id, DFTAG_RIG, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+      {
+          uint16      elt_tag, elt_ref;   /* tag/ref of items in a RIG */
+          int32       group_id;       /* group ID for looking at RIG's */
+
+          /* read RIG into memory */
+          if ((group_id = DFdiread(file_id, DFTAG_RIG, find_ref)) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+          elt_tag = elt_ref = 0;    /* initialize bogus tag/ref */
+          while (DFdiget(group_id, &elt_tag, &elt_ref)!=FAIL)
+            {   /* get next tag/ref */
+                if (elt_tag == DFTAG_CI || elt_tag == DFTAG_RI)
+                  {   
+                      if (elt_tag != DFTAG_NULL && elt_ref != DFREF_NONE) /* make certain we found an image */
+                        {     /* store the information about the image */
+                            img_info[curr_image].grp_tag=DFTAG_RIG;
+                            img_info[curr_image].grp_ref=find_ref;
+                            img_info[curr_image].img_tag=elt_tag;
+                            img_info[curr_image].img_ref=elt_ref;
+                            img_info[curr_image].offset = Hoffset(file_id, elt_tag, elt_ref);     /* store offset */
+                            curr_image++;
+                        }     /* end if */
+                  } /* end if */
+            } /* end while */
+      } /* end while */
+
+    /* go through the RI8s */
+    find_tag = find_ref = 0;
+    while (Hfind(file_id, DFTAG_RI8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+      {
+          img_info[curr_image].grp_tag=DFTAG_NULL;
+          img_info[curr_image].grp_ref=DFREF_WILDCARD;
+          img_info[curr_image].img_tag=find_tag;
+          img_info[curr_image].img_ref=find_ref;
+          img_info[curr_image].offset = find_off;   /* store offset */
+          curr_image++;
+      }     /* end while */
+
+    /* go through the CI8s */
+    find_tag = find_ref = 0;
+    while (Hfind(file_id, DFTAG_CI8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+      {
+          img_info[curr_image].grp_tag=DFTAG_NULL;
+          img_info[curr_image].grp_ref=DFREF_WILDCARD;
+          img_info[curr_image].img_tag=find_tag;
+          img_info[curr_image].img_ref=find_ref;
+          img_info[curr_image].offset = find_off;   /* store offset */
+          curr_image++;
+      } /* end while */
+
+    /* go through the II8s */
+    find_tag = find_ref = 0;
+    while (Hfind(file_id, DFTAG_II8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+      {
+          img_info[curr_image].grp_tag=DFTAG_NULL;
+          img_info[curr_image].grp_ref=DFREF_WILDCARD;
+          img_info[curr_image].img_tag=find_tag;
+          img_info[curr_image].img_ref=find_ref;
+          img_info[curr_image].offset = find_off;   /* store offset */
+          curr_image++;
+      } /* end while */
+
+    /* Eliminate duplicate images by using the offset of the image data */
+    /* Here's a table for how the images will be eliminated: */
+    /*
+                                    img_info[i].grp_tag
+                                    VG              RIG             NULL(RI8)
+                               +-----------------+-----------------+--------+
+                            VG | j=NULL          | i=NULL          | i=NULL |
+                               |                 | j.aux=i.grp_ref |        |
+                               +-----------------+-----------------+--------+
+    img_info[j].grp_tag     RIG| j=NULL          | j=NULL          | i=NULL |
+                               | i.aux=j.grp_ref |                 |        |
+                               +-----------------+-----------------+--------+
+                      NULL(RI8)| j=NULL          | j=NULL          | j=NULL |
+                               +-----------------+-----------------+--------+
+    */
+
+    nimages = curr_image;   /* reset the number of images we really have */
+    for (i = 0; i < curr_image; i++)
+      {     /* go through the images looking for duplicates */
+          if(img_info[i].img_tag!=DFTAG_NULL)
+              for (j = i+1; j < curr_image; j++)
+                {
+      /* if their refs are different, they're not duplicate, skip */
+      if(img_info[i].img_ref == img_info[j].img_ref)
+                    if(img_info[j].img_tag!=DFTAG_NULL)
+          {
+                        /* If the element is special, get its type, to allow
+                           linked block or chunked images to go into the if
+                           statement below in order for the duplicate image be
+                           eliminated - bug #814, BMR Feb, 2005 */
+                        intn special_type = GRIisspecial_type(file_id,img_info[i].img_tag,img_info[i].img_ref);
+
+                        if (((img_info[i].offset!= INVALID_OFFSET && img_info[i]
+.offset!=0)
+                                && img_info[i].offset == img_info[j].offset) ||
+                             (img_info[i].offset==0
+                                && (special_type == SPECIAL_LINKED ||
+                                    special_type == SPECIAL_CHUNKED)))
+                          {
+                              /* eliminate the oldest tag from the match */
+                              switch(img_info[i].img_tag) {
+                                  case DFTAG_RI:
+                                  case DFTAG_CI: /* Newer style raster image, found in RIG & Vgroup */
+                                      if(img_info[j].grp_tag==DFTAG_RIG)
+                                        {
+            img_info[j].orig_tag = img_info[j].img_tag;
+                                          img_info[j].img_tag=DFTAG_NULL;
+                                          if(img_info[i].grp_tag==DFTAG_VG)
+                                              img_info[i].aux_ref=img_info[j].grp_ref;
+                                        } /* end if */
+                                      else
+                                          if(img_info[i].grp_tag==DFTAG_VG)
+            {
+                img_info[j].orig_tag = img_info[j].img_tag;
+                                              img_info[j].img_tag=DFTAG_NULL;
+            }
+                                          else
+                                            {
+                img_info[j].orig_tag = img_info[j].img_tag;
+                                              img_info[j].img_tag=DFTAG_NULL;
+                                              if(img_info[i].grp_tag==DFTAG_RIG)
+                                                  img_info[j].aux_ref=img_info[i].grp_ref;
+                                            } /* end else */
+                                      break;
+
+                                  case DFTAG_RI8:
+                                  case DFTAG_CI8:
+                                  case DFTAG_II8: /* Eldest style raster image, no grouping */
+                                      if(img_info[j].img_tag!=DFTAG_RI8 && img_info[j].img_tag!=DFTAG_CI8 && img_info[j].img_tag!=DFTAG_II8)
+                                          img_info[i].img_tag=DFTAG_NULL;
+                                      else
+                                          img_info[j].img_tag=DFTAG_NULL;
+                                      break;
+
+                                  default: /* an image which was eliminated from the list of images */
+                                    break;
+                                } /* end switch */
+                              nimages--;  /* if duplicate found, decrement the number of images */
+                          } /* end if */
+                     } /* end if */
+                } /* end for */
+      } /* end for */
+
+    /* Ok, now sort through the file for information about each image found */
+    for(i=0; i<curr_image; i++)
+      {
+          if(img_info[i].img_tag!=DFTAG_NULL)
+            {
+              switch(img_info[i].grp_tag) {
+                  case DFTAG_VG: /* New style raster image, found in a Vgroup */
+                      {
+                          ri_info_t *new_image; /* ptr to the image to read in */
+                          int32 img_key;            /* Vgroup key of an image */
+                          int32 img_tag,img_ref;    /* image tag/ref in the Vgroup */
+                          char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+                          uint8 ntstring[4];        /* buffer to store NT info */
+                          uint8 GRtbuf[64];         /* local buffer for reading RIG info */
+
+                          if((img_key=Vattach(file_id,(int32)img_info[i].grp_ref,"r"))!=FAIL)
+                            {
+        uint16 name_len;
+                                if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
+                                  {
+                                    HDfree(img_info);   /* free offsets */
+                                    Hclose(file_id);
+                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                  } /* end if */
+
+                                /* Initialize all the fields in the image structure to zeros */
+                                HDmemset(new_image,0,sizeof(ri_info_t));
+
+                                /* Get the name of the image */
+        if(Vgetnamelen(img_key,&name_len)==FAIL)
+            name_len = 20; /* for "Raster Image #%d" */
+                                if((new_image->name=(char *)HDmalloc(name_len+1))==NULL)
+                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                if(Vgetname(img_key,new_image->name)==FAIL)
+                                    sprintf(new_image->name,"Raster Image #%d",(int)i);
+
+                                /* Initialize the local attribute tree */
+                                new_image->lattr_count = 0;
+                                new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+                                if (new_image->lattree == NULL)
+                                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                                new_image->ri_ref=img_info[i].grp_ref;
+                                if(img_info[i].aux_ref!=0)
+                                    new_image->rig_ref=img_info[i].aux_ref;
+                                else
+                                    new_image->rig_ref=DFREF_WILDCARD;
+
+                                for(j=0; j<Vntagrefs(img_key); j++)
+                                  {
+                                      if(Vgettagref(img_key,j,&img_tag,&img_ref)==FAIL)
+                                          continue;
+
+                                      /* parse this tag/ref pair */
+                                      switch(img_tag) {
+                                          case DFTAG_RI:    /* Regular image data */
+                                              new_image->img_tag=(uint16)img_tag;
+                                              new_image->img_ref=(uint16)img_ref;
+ /*  fprintf(stderr, "SPECIALTAG(%d/%d) = %d\n", new_image->img_tag, new_image->img_ref, SPECIALTAG(new_image->img_tag));
+ */ 
+                                              if(SPECIALTAG(new_image->img_tag)==TRUE) {
+                                                  new_image->use_buf_drvr=1;
+                                              } /* end if */
+                                              break;
+
+                                          case DFTAG_CI:    /* Compressed image data */
+                                              new_image->img_tag=(uint16)img_tag;
+                                              new_image->img_ref=(uint16)img_ref;
+                                              new_image->use_buf_drvr=1;
+                                              new_image->use_cr_drvr=1;
+                                              break;
+
+                                          case DFTAG_LUT:   /* Palette */
+                                              new_image->lut_tag=(uint16)img_tag;
+                                              new_image->lut_ref=(uint16)img_ref;
+
+                                              /* Fill in some default palette dimension info, in case there isn't a DFTAG_LD for this palette */
+                                              if(new_image->lut_dim.dim_ref==0)
+                                                {
+                                                  new_image->lut_dim.dim_ref = DFREF_WILDCARD;
+                                                  new_image->lut_dim.xdim=256;
+                                                  new_image->lut_dim.ydim=1;
+                                                  new_image->lut_dim.ncomps=3;
+                                                  new_image->lut_dim.nt=DFNT_UINT8;
+                                                  new_image->lut_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
+                                                  new_image->lut_dim.il=MFGR_INTERLACE_PIXEL;
+                                                  new_image->lut_dim.nt_tag=DFTAG_NULL;
+                                                  new_image->lut_dim.nt_ref=DFREF_WILDCARD;
+                                                  new_image->lut_dim.comp_tag=DFTAG_NULL;
+                                                  new_image->lut_dim.comp_ref=DFREF_WILDCARD;
+                                                } /* end if */
+                                              break;
+
+                                          case DFTAG_LD:    /* Palette dimensions */
+                                              if (Hgetelement(file_id, (uint16)img_tag, (uint16)img_ref, GRtbuf) != FAIL)
+                                                {
+                                                    int16       int16var;
+                                                    uint8      *p;
+
+                                                    p = GRtbuf;
+                                                    INT32DECODE(p, new_image->lut_dim.xdim);
+                                                    INT32DECODE(p, new_image->lut_dim.ydim);
+                                                    UINT16DECODE(p, new_image->lut_dim.nt_tag);
+                                                    UINT16DECODE(p, new_image->lut_dim.nt_ref);
+                                                    INT16DECODE(p, int16var);
+                                                    new_image->lut_dim.ncomps=(int32)int16var;
+                                                    INT16DECODE(p, new_image->lut_dim.il);
+                                                    UINT16DECODE(p, new_image->lut_dim.comp_tag);
+                                                    UINT16DECODE(p, new_image->lut_dim.comp_ref);
+                                                }
+                                              else
+                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
+                                               
+                                               /* read NT */
+                                              if (Hgetelement(file_id, new_image->lut_dim.nt_tag, new_image->lut_dim.nt_ref, ntstring) == FAIL)
+                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                                              /* check for any valid NT */
+                                              if (ntstring[1] == DFNT_NONE)
+                                                  break;
+                                              
+                                              /* set NT info */
+                                              new_image->lut_dim.dim_ref = (uint16)img_ref;
+                                              new_image->lut_dim.nt = (int32)ntstring[1];
+                                              new_image->lut_dim.file_nt_subclass = (int32)ntstring[3];
+                                              if ((new_image->lut_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                                    && (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)
+                                                    && (new_image->lut_dim.file_nt_subclass!= DFKgetPNSC(new_image->lut_dim.nt, DF_MT)))
+                                                  break; /* unknown subclass */
+                                              if (new_image->lut_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                                                {     /* if native or little endian */
+                                                    if (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                                        new_image->lut_dim.nt |= DFNT_NATIVE;
+                                                    else  /* little endian */
+                                                        new_image->lut_dim.nt |= DFNT_LITEND;
+                                                }     /* end if */
+                                              break;
+
+                                          case DFTAG_ID:    /* Image description info */
+                                              if (Hgetelement(file_id, (uint16)img_tag, (uint16)img_ref, GRtbuf) != FAIL)
+                                                {
+                                                    int16       int16var;
+                                                    uint8      *p;
+
+                                                    p = GRtbuf;
+                                                    INT32DECODE(p, new_image->img_dim.xdim);
+                                                    INT32DECODE(p, new_image->img_dim.ydim);
+                                                    UINT16DECODE(p, new_image->img_dim.nt_tag);
+                                                    UINT16DECODE(p, new_image->img_dim.nt_ref);
+                                                    INT16DECODE(p, int16var);
+                                                    new_image->img_dim.ncomps=(int32)int16var;
+                                                    INT16DECODE(p, new_image->img_dim.il);
+                                                    UINT16DECODE(p, new_image->img_dim.comp_tag);
+                                                    UINT16DECODE(p, new_image->img_dim.comp_ref);
+                                                }
+                                              else
+                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
+                                               
+                                               /* read NT */
+                                              if (Hgetelement(file_id, new_image->img_dim.nt_tag, new_image->img_dim.nt_ref, ntstring) == FAIL)
+                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                                              /* check for any valid NT */
+                                              if (ntstring[1] == DFNT_NONE)
+                                                  break;
+                                              
+                                              /* set NT info */
+                                              new_image->img_dim.dim_ref=(uint16)img_ref;
+                                              new_image->img_dim.nt = (int32)ntstring[1];
+                                              new_image->img_dim.file_nt_subclass = (int32)ntstring[3];
+                                              if ((new_image->img_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                                    && (new_image->img_dim.file_nt_subclass!= DFNTF_PC)
+                                                    && (new_image->img_dim.file_nt_subclass!= DFKgetPNSC(new_image->img_dim.nt, DF_MT)))
+                                                  break; /* unknown subclass */
+                                              if (new_image->img_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                                                {     /* if native or little endian */
+                                                    if (new_image->img_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                                        new_image->img_dim.nt |= DFNT_NATIVE;
+                                                    else  /* little endian */
+                                                        new_image->img_dim.nt |= DFNT_LITEND;
+                                                }     /* end if */
+                                              break;
+
+                                          case DFTAG_VH:    /* Attribute information */
+                                              {
+                                                  at_info_t *new_attr;  /* attribute to add to the set of local attributes */
+                                                  int32 at_key;         /* VData key for the attribute */
+
+                                                  if((new_attr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
+                                                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                                  new_attr->ref=(uint16)img_ref;
+                                                  new_attr->index=new_image->lattr_count;
+                                                  new_attr->data_modified=FALSE;
+                                                  new_attr->new_at=FALSE;
+                                                  new_attr->data=NULL;
+                                                  if((at_key=VSattach(file_id,(int32)img_ref,"r"))!=FAIL)
+                                                    {
+                                                        char *fname;
+
+                                                        /* Make certain the attribute only has one field */
+                                                        if(VFnfields(at_key)!=1)
+                                                          {
+                                                            VSdetach(at_key);
+                                                            HDfree(new_attr);
+                                                            break;
+                                                          } /* end if */
+                                                        new_attr->nt=VFfieldtype(at_key,0);
+                                                        new_attr->len=VFfieldorder(at_key,0);
+                                                        if(new_attr->len==1)
+                                                            new_attr->len=VSelts(at_key);
+
+                                                        /* Get the name of the attribute */
+                                                        if((fname=VFfieldname(at_key,0))==NULL)
+                                                          {
+                                                            sprintf(textbuf,"Attribute #%d",(int)new_attr->index);
+                                                            if((new_attr->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                                                              {
+                                                                VSdetach(at_key);
+                                                                HDfree(new_attr);
+                                                                HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                                              } /* end if */
+                                                            HDstrcpy(new_attr->name,textbuf);
+                                                          } /* end if */
+                                                        else
+                                                          {
+                                                            if((new_attr->name=(char *)HDmalloc(HDstrlen(fname)+1))==NULL)
+                                                              {
+                                                                VSdetach(at_key);
+                                                                HDfree(new_attr);
+                                                                HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                                              } /* end if */
+                                                            HDstrcpy(new_attr->name,fname);
+                                                          } /* end else */
+                                                
+                                                        tbbtdins(new_image->lattree, new_attr, NULL);    /* insert the attr instance in B-tree */ 
+
+                                                        VSdetach(at_key);
+                                                    } /* end if */
+
+                                                  new_image->lattr_count++;
+                                              } /* end case */
+                                              break;
+
+                                          default:          /* Unknown tag */
+                                              break;
+                                        } /* end switch */
+                                  } /* end for */
+                              new_image->index=gr_ptr->gr_count;
+                              new_image->gr_ptr=gr_ptr; /* point up the tree */
+                              tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
+                              gr_ptr->gr_count++;
+                              Vdetach(img_key);
+                            } /* end if */
+                      } /* end case */
+                      break;
+
+                  case DFTAG_RIG:   /* Older style raster image, found in RIG */
+                      {
+                          int32       GroupID;
+                          uint16      elt_tag, elt_ref;
+                          ri_info_t *new_image; /* ptr to the image to read in */
+                          char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+                          uint8 ntstring[4];        /* buffer to store NT info */
+                          uint8 GRtbuf[64];         /* local buffer for reading RIG info */
+
+                          /* read RIG into memory */
+                          if ((GroupID = DFdiread(file_id, DFTAG_RIG, img_info[i].grp_ref)) == FAIL)
+                              HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                          if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
+                            {
+                              HDfree(img_info);   /* free offsets */
+                              Hclose(file_id);
+                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                            } /* end if */
+
+                          /* Initialize all the fields in the image structure to zeros */
+                          HDmemset(new_image,0,sizeof(ri_info_t));
+
+                          /* Get the name of the image */
+                          sprintf(textbuf,"Raster Image #%d",(int)i);
+                          if((new_image->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                          HDstrcpy(new_image->name,textbuf);
+        new_image->name_generated = TRUE;
+
+                          /* Initialize the local attribute tree */
+                          new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+                          if (new_image->lattree == NULL)
+                              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                          new_image->ri_ref=DFREF_WILDCARD;
+                          new_image->rig_ref=img_info[i].grp_ref;
+
+                          while (DFdiget(GroupID, &elt_tag, &elt_ref)!=FAIL)
+                            {     /* get next tag/ref */
+                                switch (elt_tag)
+                                  {   /* process tag/ref */
+                                      case DFTAG_RI:    /* regular image data */
+                                          new_image->img_tag=elt_tag;
+                                          new_image->img_ref=elt_ref;
+                                          if(SPECIALTAG(new_image->img_tag)==TRUE) {
+                                              new_image->use_buf_drvr=1;
+                                          } /* end if */
+                                          break;
+
+                                      case DFTAG_CI:    /* compressed image data */
+                                          new_image->img_tag=elt_tag;
+                                          new_image->img_ref=elt_ref;
+                                          new_image->use_buf_drvr=1;
+                                          new_image->use_cr_drvr=1;
+                                          break;
+
+                                      case DFTAG_LUT:   /* Palette */
+                                          new_image->lut_tag=elt_tag;
+                                          new_image->lut_ref=elt_ref;
+
+                                          /* Fill in some default palette dimension info, in case there isn't a DFTAG_LD for this palette */
+                                          if(new_image->lut_dim.dim_ref==0)
+                                            {
+                                              new_image->lut_dim.dim_ref = DFREF_WILDCARD;
+                                              new_image->lut_dim.xdim=256;
+                                              new_image->lut_dim.ydim=1;
+                                              new_image->lut_dim.ncomps=3;
+                                              new_image->lut_dim.nt=DFNT_UINT8;
+                                              new_image->lut_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
+                                              new_image->lut_dim.il=MFGR_INTERLACE_PIXEL;
+                                              new_image->lut_dim.nt_tag=DFTAG_NULL;
+                                              new_image->lut_dim.nt_ref=DFREF_WILDCARD;
+                                              new_image->lut_dim.comp_tag=DFTAG_NULL;
+                                              new_image->lut_dim.comp_ref=DFREF_WILDCARD;
+                                            } /* end if */
+                                          break;
+
+                                      case DFTAG_LD:    /* Palette dimensions */
+                                          if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
+                                            {
+                                                int16       int16var;
+                                                uint8      *p;
+
+                                                p = GRtbuf;
+                                                INT32DECODE(p, new_image->lut_dim.xdim);
+                                                INT32DECODE(p, new_image->lut_dim.ydim);
+                                                UINT16DECODE(p, new_image->lut_dim.nt_tag);
+                                                UINT16DECODE(p, new_image->lut_dim.nt_ref);
+                                                INT16DECODE(p, int16var);
+                                                new_image->lut_dim.ncomps=(int32)int16var;
+                                                INT16DECODE(p, new_image->lut_dim.il);
+                                                UINT16DECODE(p, new_image->lut_dim.comp_tag);
+                                                UINT16DECODE(p, new_image->lut_dim.comp_ref);
+                                            }
+                                          else
+                                            {
+                        DFdifree( GroupID );
+                                              HGOTO_ERROR(DFE_READERROR, FAIL);
+                                            }
+                                               
+                                           /* read NT */
+                                          if (Hgetelement(file_id, new_image->lut_dim.nt_tag, new_image->lut_dim.nt_ref, ntstring) == FAIL)
+                                            {
+                        DFdifree( GroupID );
+                                              HGOTO_ERROR(DFE_READERROR, FAIL);
+                                            }
+
+                                          /* check for any valid NT */
+                                          if (ntstring[1] == DFNT_NONE)
+                                              break;
+                                              
+                                          /* set NT info */
+                                          new_image->lut_dim.dim_ref = elt_ref;
+                                          new_image->lut_dim.nt = (int32)ntstring[1];
+                                          new_image->lut_dim.file_nt_subclass = (int32)ntstring[3];
+                                          if ((new_image->lut_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                                && (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)
+                                                && (new_image->lut_dim.file_nt_subclass!= DFKgetPNSC(new_image->lut_dim.nt, DF_MT)))
+                                              break; /* unknown subclass */
+                                          if (new_image->lut_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                                            {     /* if native or little endian */
+                                                if (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                                    new_image->lut_dim.nt |= DFNT_NATIVE;
+                                                else  /* little endian */
+                                                    new_image->lut_dim.nt |= DFNT_LITEND;
+                                            }     /* end if */
+                                          break;
+
+                                        case DFTAG_ID:    /* Image description info */
+                                            if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
+                                              {
+                                                  int16       int16var;
+                                                  uint8      *p;
+
+                                                  p = GRtbuf;
+                                                  INT32DECODE(p, new_image->img_dim.xdim);
+                                                  INT32DECODE(p, new_image->img_dim.ydim);
+                                                  UINT16DECODE(p, new_image->img_dim.nt_tag);
+                                                  UINT16DECODE(p, new_image->img_dim.nt_ref);
+                                                  INT16DECODE(p, int16var);
+                                                  new_image->img_dim.ncomps=(int32)int16var;
+                                                  INT16DECODE(p, new_image->img_dim.il);
+                                                  UINT16DECODE(p, new_image->img_dim.comp_tag);
+                                                  UINT16DECODE(p, new_image->img_dim.comp_ref);
+                                              }
+                                            else
+                                              {
+                          DFdifree( GroupID );
+                                                HGOTO_ERROR(DFE_GETELEM, FAIL);
+                                              }
+                                               
+                                             /* read NT */
+                                            if (Hgetelement(file_id, new_image->img_dim.nt_tag, new_image->img_dim.nt_ref, ntstring) == FAIL)
+                                              {
+                          DFdifree( GroupID );
+                                                HGOTO_ERROR(DFE_GETELEM, FAIL);
+                                              }
+
+                                            /* check for any valid NT */
+                                            if (ntstring[1] == DFNT_NONE)
+                                                break;
+                                              
+                                            /* set NT info */
+                                            new_image->img_dim.dim_ref=elt_ref;
+                                            new_image->img_dim.nt = (int32)ntstring[1];
+                                            new_image->img_dim.file_nt_subclass = (int32)ntstring[3];
+                                            if ((new_image->img_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                                  && (new_image->img_dim.file_nt_subclass!= DFNTF_PC)
+                                                  && (new_image->img_dim.file_nt_subclass!= DFKgetPNSC(new_image->img_dim.nt, DF_MT)))
+                                                break; /* unknown subclass */
+                                            if (new_image->img_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                                              {     /* if native or little endian */
+                                                  if (new_image->img_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                                      new_image->img_dim.nt |= DFNT_NATIVE;
+                                                  else  /* little endian */
+                                                      new_image->img_dim.nt |= DFNT_LITEND;
+                                              }     /* end if */
+                                            break;
+
+                                      default:    /* ignore unknown tags */
+                                          break;
+                                  } /* end switch */
+                            } /* end while */
+                        new_image->index=gr_ptr->gr_count;
+                        new_image->gr_ptr=gr_ptr; /* point up the tree */
+                        tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
+                        gr_ptr->gr_count++;
+                      } /* end case */
+                      break;
+
+                  case DFTAG_NULL:  /* Eldest style raster image, no grouping */
+                      {
+                          ri_info_t *new_image; /* ptr to the image to read in */
+                          char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+                          uint8 GRtbuf[64];         /* local buffer for reading RIG info */
+
+                          if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
+                            {
+                              HDfree(img_info);   /* free offsets */
+                              Hclose(file_id);
+                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                            } /* end if */
+
+                          /* Initialize all the fields in the image structure to zeros */
+                          HDmemset(new_image,0,sizeof(ri_info_t));
+
+                          /* Get the name of the image */
+                          sprintf(textbuf,"Raster Image #%d",(int)i);
+                          if((new_image->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                          HDstrcpy(new_image->name,textbuf);
+        new_image->name_generated = TRUE;
+
+                          /* Initialize the local attribute tree */
+                          new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+                          if (new_image->lattree == NULL)
+                              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                          new_image->ri_ref=DFREF_WILDCARD;
+                          new_image->rig_ref=DFREF_WILDCARD;
+
+                          /* Get tag/ref for image */
+                          new_image->img_tag=img_info[i].img_tag;
+                          new_image->img_ref=img_info[i].img_ref;
+
+                          /* Get dimension information */
+                          if (Hgetelement(file_id, DFTAG_ID8, new_image->img_ref, GRtbuf) != FAIL)
+                            {
+                                uint8      *p;
+                                uint16      u;
+
+                                p = GRtbuf;
+                                UINT16DECODE(p, u);
+                                new_image->img_dim.xdim=(int32)u;
+                                UINT16DECODE(p, u);
+                                new_image->img_dim.ydim=(int32)u;
+                            }   /* end if */
+                          else
+                              HGOTO_ERROR(DFE_GETELEM, FAIL);
+
+                          /* only 8-bit images, so fill in rest of dim info */
+                          new_image->img_dim.dim_ref=DFREF_WILDCARD;
+                          new_image->img_dim.ncomps=1;
+                          new_image->img_dim.nt=DFNT_UINT8;
+                          new_image->img_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
+                          new_image->img_dim.il=MFGR_INTERLACE_PIXEL;
+                          new_image->img_dim.nt_tag=DFTAG_NULL;
+                          new_image->img_dim.nt_ref=DFREF_WILDCARD;
+                          new_image->img_dim.comp_tag=DFTAG_NULL;
+                          new_image->img_dim.comp_ref=DFREF_WILDCARD;
+
+                          /* Get palette information */
+                          if(Hexist(file_id, DFTAG_IP8, new_image->img_ref)==SUCCEED)
+                            {
+                                new_image->lut_tag=DFTAG_IP8;
+                                new_image->lut_ref=new_image->img_ref;
+
+                                /* set palette dimensions too */
+                                new_image->lut_dim.dim_ref = DFREF_WILDCARD;
+                                new_image->lut_dim.xdim=256;
+                                new_image->lut_dim.ydim=1;
+                                new_image->lut_dim.ncomps=3;
+                                new_image->lut_dim.nt=DFNT_UINT8;
+                                new_image->lut_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
+                                new_image->lut_dim.il=MFGR_INTERLACE_PIXEL;
+                                new_image->lut_dim.nt_tag=DFTAG_NULL;
+                                new_image->lut_dim.nt_ref=DFREF_WILDCARD;
+                                new_image->lut_dim.comp_tag=DFTAG_NULL;
+                                new_image->lut_dim.comp_ref=DFREF_WILDCARD;
+                            } /* end if */
+                          else
+                                new_image->lut_tag=new_image->lut_ref=DFREF_WILDCARD;
+
+                        new_image->index=gr_ptr->gr_count;
+                        new_image->gr_ptr=gr_ptr; /* point up the tree */
+                        tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
+                        gr_ptr->gr_count++;
+                      } /* end case */
+                      break;
+
+                  default: /* an image which was eliminated from the list of images */
+                    break;
+                } /* end switch */
+            } /* end if */
+      } /* end for */
+
+    HDfree(img_info);   /* free offsets */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end GRIget_image_list() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIil_convert
+ PURPOSE
+    Convert a buffer from one interlace to another.
+ USAGE
+    intn GRIil_convert(inbuf,inil,outbuf,outil,dims,ncomp,nt)
+        const void * inbuf;          IN: input buffer
+        gr_interlace_t inil;        IN: input buffer's interlace scheme
+        void * outbuf;               IN: output buffer
+        gr_interlace_t outil;       IN: output buffer's requested interlace scheme
+        int32 dims[2];              IN: dimensions of the buffers
+        int32 ncomp;                IN: both buffer's number of components per pixel
+        int32 nt;                   IN: both buffer's pixel number-type
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    This routine converts between PIXEL, LINE & COMPONENT interlacing schemes.
+    All data written to the disk is written in PIXEL interlacing and converted
+    to/from the user's buffers.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    This routine does no parameter checking, it's assumed to be done at a
+    higher layer.
+
+    This routine also does not handle the case where the inbuf==outbuf, i.e.
+    switching the interlace 'in-place'.  More work would be required to enable
+    this to be done.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRIil_convert(const void * inbuf,gr_interlace_t inil,void * outbuf,
+        gr_interlace_t outil,int32 dims[2],int32 ncomp,int32 nt)
+{
+    CONSTR(FUNC, "GRIil_convert");    /* for HERROR */
+    intn ret_value=SUCCEED;
+    uintn pixel_size=(uintn)DFKNTsize((nt|DFNT_NATIVE)&(~DFNT_LITEND))*(uintn)ncomp;
+    uintn comp_size=(uintn)DFKNTsize((nt|DFNT_NATIVE)&(~DFNT_LITEND));
+    const void * *in_comp_ptr=NULL;    /* an array of pointers to each input component */
+    void * *out_comp_ptr=NULL;   /* an array of pointers to each output component */
+    int32 *in_pixel_add=NULL;   /* an array of increments for each input pixel moved */
+    int32 *out_pixel_add=NULL;  /* an array of increments for each output pixel moved */
+    int32 *in_line_add=NULL;    /* an array of increments for each input line moved */
+    int32 *out_line_add=NULL;   /* an array of increments for each output line moved */
+    intn i,j,k;       /* local counting variables */
+
+    if(inil==outil)     /* check for trivial input=output 'conversion' */
+        HDmemcpy(outbuf,inbuf,(size_t)dims[XDIM]*(size_t)dims[YDIM]*(size_t)pixel_size);
+    else
+      {
+          /* allocate pixel pointer arrays */
+          if((in_comp_ptr=HDmalloc(sizeof(void *)*(size_t)ncomp))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          if((out_comp_ptr=HDmalloc(sizeof(void *)*(size_t)ncomp))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* allocate pixel increment arrays */
+          if((in_pixel_add=HDmalloc(sizeof(int32)*(size_t)ncomp))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          if((out_pixel_add=HDmalloc(sizeof(int32)*(size_t)ncomp))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* allocate line increment arrays */
+          if((in_line_add=HDmalloc(sizeof(int32)*(size_t)ncomp))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          if((out_line_add=HDmalloc(sizeof(int32)*(size_t)ncomp))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* Set up the input buffer pointers and adders */
+          switch(inil)
+            {
+                case MFGR_INTERLACE_PIXEL:
+                    for(i=0; i<ncomp; i++)
+                      {
+                        in_comp_ptr[i]=((const uint8 *)inbuf)+(size_t)i*comp_size;
+                        in_pixel_add[i]=(int32)pixel_size;
+                        in_line_add[i]=0;
+                      } /* end for */
+                    break;
+
+                case MFGR_INTERLACE_LINE:
+                    for(i=0; i<ncomp; i++)
+                      {
+                        in_comp_ptr[i]=((const uint8 *)inbuf)+(size_t)i*(size_t)dims[XDIM]*comp_size;
+                        in_pixel_add[i]=(int32)comp_size;
+                        in_line_add[i]=(int32)((size_t)(ncomp-1)*(size_t)dims[XDIM]*comp_size);
+                      } /* end for */
+                    break;
+
+                case MFGR_INTERLACE_COMPONENT:
+                    for(i=0; i<ncomp; i++)
+                      {
+                        in_comp_ptr[i]=((const uint8 *)inbuf)+(size_t)i*(size_t)dims[YDIM]*(size_t)dims[XDIM]*comp_size;
+                        in_pixel_add[i]=(int32)comp_size;
+                        in_line_add[i]=0;
+                      } /* end for */
+                    break;
+
+                default:
+                    HGOTO_ERROR(DFE_ARGS, FAIL);
+            } /* end switch */
+
+          /* Set up the output buffer pointers and adders */
+          switch(outil)
+            {
+                case MFGR_INTERLACE_PIXEL:
+                    for(i=0; i<ncomp; i++)
+                      {
+                        out_comp_ptr[i]=((uint8 *)outbuf)+(size_t)i*comp_size;
+                        out_pixel_add[i]=(int32)pixel_size;
+                        out_line_add[i]=0;
+                      } /* end for */
+                    break;
+
+                case MFGR_INTERLACE_LINE:
+                    for(i=0; i<ncomp; i++)
+                      {
+                        out_comp_ptr[i]=((uint8 *)outbuf)+(size_t)i*(size_t)dims[XDIM]*comp_size;
+                        out_pixel_add[i]=(int32)comp_size;
+                        out_line_add[i]=(int32)((size_t)(ncomp-1)*(size_t)dims[XDIM]*comp_size);
+                      } /* end for */
+                    break;
+
+                case MFGR_INTERLACE_COMPONENT:
+                    for(i=0; i<ncomp; i++)
+                      {
+                        out_comp_ptr[i]=((uint8 *)outbuf)+(size_t)i*(size_t)dims[YDIM]*(size_t)dims[XDIM]*comp_size;
+                        out_pixel_add[i]=(int32)comp_size;
+                        out_line_add[i]=0;
+                      } /* end for */
+                    break;
+
+                default:
+                    HGOTO_ERROR(DFE_ARGS, FAIL);
+            } /* end switch */
+
+        /* now just push pixels from one buffer to another */
+        for(i=0; i<dims[YDIM]; i++)
+          {
+              for(j=0; j<dims[XDIM]; j++)
+                {
+                    for(k=0; k<ncomp; k++)
+                      {
+                          HDmemcpy(out_comp_ptr[k],in_comp_ptr[k],comp_size);
+                          out_comp_ptr[k]=((uint8 *)out_comp_ptr[k])+out_pixel_add[k];
+                          in_comp_ptr[k]=((const uint8 *)in_comp_ptr[k])+in_pixel_add[k];
+                      } /* end for */
+                } /* end for */
+
+              /* wrap around the end of the line of pixels */
+              /* (only necessary if one of the buffers is in 'line' interlace) */
+              if(inil==MFGR_INTERLACE_LINE || outil==MFGR_INTERLACE_LINE)
+                  for(k=0; k<ncomp; k++)
+                    {
+                        out_comp_ptr[k]=((uint8 *)out_comp_ptr[k])+out_line_add[k];
+                        in_comp_ptr[k]=((const uint8 *)in_comp_ptr[k])+in_line_add[k];
+                    } /* end for */
+          } /* end for */
+      } /* end else */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    /* Free arrays allocated during this routine */
+    /* (common for both error and normal returns) */
+    if(in_comp_ptr!=NULL)
+        HDfree((void*)in_comp_ptr);
+    if(out_comp_ptr!=NULL)
+        HDfree(out_comp_ptr);
+    if(in_pixel_add!=NULL)
+        HDfree(in_pixel_add);
+    if(out_pixel_add!=NULL)
+        HDfree(out_pixel_add);
+    if(in_line_add!=NULL)
+        HDfree(in_line_add);
+    if(out_line_add!=NULL)
+        HDfree(out_line_add);
+
+  return ret_value;
+} /* end GRIil_convert() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRstart
+ PURPOSE
+    Initialize the GR*() interface for a given HDF file.
+ USAGE
+    int32 GRstart(hdf_file_id)
+        int32 hdf_file_id;          IN: file ID from Hopen
+ RETURNS
+    Return grid on success or FAIL
+ DESCRIPTION
+    Initializes the GR*() interface to operate on the HDF file which was
+    specified by hdf_file_id.  This routine must be called before any further
+    GR*() routines are called for a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 GRstart(int32 hdf_file_id)
+{
+    CONSTR(FUNC, "GRstart");    /* for HERROR */
+    gr_info_t *gr_ptr;          /* ptr to the new GR information for a file */
+    int32  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(GRIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* check the validity of the file ID */
+    if(!HDvalidfid(hdf_file_id))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check if GR file tree has been allocated */
+    if (gr_tree == NULL)
+      {
+          if ((gr_tree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE)) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* Initialize the atom groups for GRs and RIs */
+          HAinit_group(GRIDGROUP,GRATOM_HASH_SIZE);
+          HAinit_group(RIIDGROUP,GRATOM_HASH_SIZE);
+      } /* end if */
+
+    /* Grab the existing gr_info_t structure first, otherwise create a new one */
+    if ((gr_ptr = Get_grfile(hdf_file_id)) == NULL)
+        if ((gr_ptr = New_grfile(hdf_file_id)) == NULL)
+            HGOTO_ERROR(DFE_FNF, FAIL);
+
+    if (gr_ptr->access==0)
+      {
+        /* Fire up the Vset interface */
+        if(Vstart(hdf_file_id)==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT,FAIL);
+
+        /* Initialize the starting information for the interface */
+        gr_ptr->hdf_file_id=hdf_file_id;
+        gr_ptr->gr_ref=DFREF_WILDCARD;
+        gr_ptr->gr_count=0;
+        gr_ptr->grtree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+        if (gr_ptr->grtree == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+        gr_ptr->gr_modified=0;
+
+        gr_ptr->gattr_count=0;
+        gr_ptr->gattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+        if (gr_ptr->gattree == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+        gr_ptr->gattr_modified=0;
+        gr_ptr->attr_cache=GR_ATTR_THRESHHOLD;
+
+        /* Go get all the images and attributes in the file */
+        if(GRIget_image_list(hdf_file_id,gr_ptr)==FAIL)
+            HGOTO_ERROR(DFE_INTERNAL,FAIL);
+      } /* end else */
+    gr_ptr->access++;
+
+    /* Return handle to the GR interface to the user */
+    ret_value=HAregister_atom(GRIDGROUP,gr_ptr);
+
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRstart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRfileinfo
+ PURPOSE
+    Report high-level information about the GR*() interface for a given file.
+ USAGE
+    intn GRfileinfo(grid, n_datasets, n_attrs)
+        int32 grid;                 IN: GR ID to get information about
+        int32 *n_datasets;          OUT: the # of GR datasets in a file
+        int32 *n_attrs;             OUT: the # of "global" GR attributes
+ RETURNS
+    SUCCEED/FAIL
+ DESCRIPTION
+    Reports general information about the number of datasets and "global"
+    attributes for the GR interface.  This routine is generally used to find
+    the range of acceptable indices for GRselect calls.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRfileinfo(int32 grid,int32 *n_datasets,int32 *n_attrs)
+{
+    CONSTR(FUNC, "GRfileinfo");    /* for HERROR */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for a file */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    /* check the validity of the GR ID */
+    if (HAatom_group(grid)!=GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate GR's object in hash table */
+    if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(grid)))
+        HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+    /* Get the number of datasets & global attributes from the memory structures */
+    if(n_datasets!=NULL)
+        *n_datasets=gr_ptr->gr_count;
+    if(n_attrs!=NULL)
+        *n_attrs=gr_ptr->gattr_count;
+        
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRfileinfo() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIupdatemeta
+ PURPOSE
+    Internal routine to update the meta-data for an image
+ USAGE
+    intn GRIupdatemeta(hdf_file_id,img_ptr)
+        int32 hdf_file_id;          IN: the file ID for the HDF file.
+        ri_info_t *img_ptr;         IN: pointer to the image info for the
+                                        image to write.
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Write out the meta-information about an image (& palette) to an HDF file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Shared by both GRIupdateRIG() and GRIupdateRI() calls.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn GRIupdatemeta(int32 hdf_file_id,ri_info_t *img_ptr)
+{
+    CONSTR(FUNC, "GRIupdatemeta");   /* for HERROR */
+    uint8 GRtbuf[64];   /* local buffer for reading RIG info */
+    uint8 ntstring[4];  /* temporary storage for the number type information */
+    uint8 *p;           /* temporary pointer into buffer */
+    intn  ret_value = SUCCEED;
+
+    HEclear();
+    if (!HDvalidfid(hdf_file_id) || img_ptr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Weird test below to allow for tag/ref values of zero.  (I'll spare */
+    /*  everyone my rant about why DFTAG_NULL should have been made zero */
+    /*  instead of one... QAK) */
+    if(img_ptr->img_dim.nt_tag<=(uint16)DFTAG_NULL)
+        img_ptr->img_dim.nt_tag=DFTAG_NT;
+    if(img_ptr->img_dim.nt_ref==DFREF_WILDCARD)
+        img_ptr->img_dim.nt_ref=Htagnewref(hdf_file_id,img_ptr->img_dim.nt_tag);
+    
+    /* Write out the raster image's number-type record */
+    ntstring[0] = DFNT_VERSION;     /* version */
+    ntstring[1] = (uint8)img_ptr->img_dim.nt;       /* type */
+    ntstring[2] = (uint8)(DFKNTsize(img_ptr->img_dim.nt)*8); /* width: RIG data is 8-bit chars */
+    ntstring[3] = DFNTC_BYTE;       /* class: data are numeric values */
+    if (Hputelement(hdf_file_id, img_ptr->img_dim.nt_tag,
+            img_ptr->img_dim.nt_ref, ntstring, (int32) 4) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+    
+    /* Check for a palette with this image */
+    if(img_ptr->lut_ref!=DFREF_WILDCARD)
+      {
+          /* Write out the palette number-type */
+          if(img_ptr->lut_dim.nt_tag<=(uint16)DFTAG_NULL)
+              img_ptr->lut_dim.nt_tag=DFTAG_NT;
+          if(img_ptr->lut_dim.nt_ref==DFREF_WILDCARD)
+              img_ptr->lut_dim.nt_ref=Htagnewref(hdf_file_id,img_ptr->lut_dim.nt_tag);
+          ntstring[0] = DFNT_VERSION;     /* version */
+          ntstring[1] = DFNT_UCHAR;       /* type */
+          ntstring[2] = 8;                /* width: RIG data is 8-bit chars */
+          ntstring[3] = DFNTC_BYTE;       /* class: data are numeric values */
+          if (Hputelement(hdf_file_id, img_ptr->lut_dim.nt_tag,
+                  img_ptr->lut_dim.nt_ref, ntstring, (int32)4) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+
+          /* Write out the palette dimensions */
+          p = GRtbuf;
+          INT32ENCODE(p, img_ptr->lut_dim.xdim);
+          INT32ENCODE(p, img_ptr->lut_dim.ydim);
+          UINT16ENCODE(p, img_ptr->lut_dim.nt_tag);
+          UINT16ENCODE(p, img_ptr->lut_dim.nt_ref);
+          INT16ENCODE(p, img_ptr->lut_dim.ncomps);
+/* Currently all data is written out in 'pixel' interlace, so force the */
+/* interlace stored on disk to match, instead of the interlacing that the */
+/* user created the image with. -QAK  */
+#ifdef LATER
+          INT16ENCODE(p, img_ptr->lut_dim.il);
+#else /* LATER */
+          INT16ENCODE(p, (int16)MFGR_INTERLACE_PIXEL);
+#endif /* LATER */
+          UINT16ENCODE(p, img_ptr->lut_dim.comp_tag);
+          UINT16ENCODE(p, img_ptr->lut_dim.comp_ref);
+          if(img_ptr->lut_dim.dim_ref==DFREF_WILDCARD)
+              img_ptr->lut_dim.dim_ref=Htagnewref(hdf_file_id,DFTAG_LD);
+          if (Hputelement(hdf_file_id, DFTAG_LD, img_ptr->lut_dim.dim_ref, GRtbuf, (int32)(p-GRtbuf)) == FAIL)
+              HGOTO_ERROR(DFE_PUTELEM, FAIL);
+      } /* end if */
+
+    /* Write out the image dimensions */
+    p = GRtbuf;
+    INT32ENCODE(p, img_ptr->img_dim.xdim);
+    INT32ENCODE(p, img_ptr->img_dim.ydim);
+    UINT16ENCODE(p, img_ptr->img_dim.nt_tag);
+    UINT16ENCODE(p, img_ptr->img_dim.nt_ref);
+    INT16ENCODE(p, img_ptr->img_dim.ncomps);
+/* Currently all data is written out in 'pixel' interlace, so force the */
+/* interlace stored on disk to match, instead of the interlacing that the */
+/* user created the image with. -QAK  */
+#ifdef LATER
+    INT16ENCODE(p, img_ptr->img_dim.il);
+#else /* LATER */
+    INT16ENCODE(p, (int16)MFGR_INTERLACE_PIXEL);
+#endif /* LATER */
+    UINT16ENCODE(p, img_ptr->img_dim.comp_tag);
+    UINT16ENCODE(p, img_ptr->img_dim.comp_ref);
+    if(img_ptr->img_dim.dim_ref==DFREF_WILDCARD)
+        img_ptr->img_dim.dim_ref=Htagnewref(hdf_file_id,DFTAG_ID);
+    if (Hputelement(hdf_file_id, DFTAG_ID, img_ptr->img_dim.dim_ref, GRtbuf, (int32)(p-GRtbuf)) == FAIL)
+        HGOTO_ERROR(DFE_PUTELEM, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end GRIupdatemeta() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIupdateRIG
+ PURPOSE
+    Internal routine to update the RIG for an image
+ USAGE
+    intn GRIupdateRIG(hdf_file_id,img_ptr)
+        int32 hdf_file_id;          IN: the file ID for the HDF file.
+        ri_info_t *img_ptr;         IN: pointer to the image info for the
+                                        image to write.
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Write out the RIG structure to an HDF file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn GRIupdateRIG(int32 hdf_file_id,ri_info_t *img_ptr)
+{
+    CONSTR(FUNC, "GRIupdateRIG");   /* for HERROR */
+    int32 GroupID;      /* RIG id for group interface */
+    intn   ret_value = SUCCEED;
+
+    HEclear();
+    if (!HDvalidfid(hdf_file_id) || img_ptr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Don't write out a RIG, unless it is compatible with the older RIGS */
+    /*  which already exist.  This is to guarantee compatibility with older */
+    /*  software, both application and in the library */
+    if(img_ptr->img_dim.nt!=DFNT_UINT8 || (img_ptr->img_dim.ncomps!=1
+            && img_ptr->img_dim.ncomps!=3))
+      {
+        ret_value =(SUCCEED); /* lie and say it's ok - QAK */
+        goto done;
+      }
+
+    /* Write out the image/palette meta-information */
+    if (GRIupdatemeta(hdf_file_id,img_ptr)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Write out the RIG itself */
+    if ((GroupID = DFdisetup(6)) == FAIL)    /* max 6 tag/refs in set */
+        HGOTO_ERROR(DFE_GROUPSETUP, FAIL);
+
+    /* add image dimension tag/ref to RIG */
+    if (DFdiput(GroupID, DFTAG_ID, (uint16) img_ptr->img_dim.dim_ref) == FAIL)
+        HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+    /* add image data tag/ref to RIG */
+    if (DFdiput(GroupID, img_ptr->img_tag, img_ptr->img_ref) == FAIL)
+        HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+    /* Check if we should write palette information */
+    if(img_ptr->lut_ref!=DFREF_WILDCARD)
+      {
+          /* add palette dimension tag/ref to RIG */
+          if (DFdiput(GroupID, DFTAG_LD, (uint16) img_ptr->lut_dim.dim_ref) == FAIL)
+              HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+
+          /* add palette data tag/ref to RIG */
+          if (DFdiput(GroupID, img_ptr->lut_tag, img_ptr->lut_ref) == FAIL)
+              HGOTO_ERROR(DFE_PUTGROUP, FAIL);
+      } /* end if */
+
+    /* write out RIG */
+    if(img_ptr->rig_ref==DFTAG_WILDCARD)
+        img_ptr->rig_ref=Htagnewref(hdf_file_id,DFTAG_RIG);
+    if(DFdiwrite(hdf_file_id, GroupID, DFTAG_RIG, img_ptr->rig_ref)==FAIL)
+        HGOTO_ERROR(DFE_GROUPWRITE, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end GRIupdateRIG() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIupdateRI
+ PURPOSE
+    Internal routine to update the RI Vgroup for an image
+ USAGE
+    intn GRIupdateRI(hdf_file_id,img_ptr)
+        int32 hdf_file_id;          IN: the file ID for the HDF file.
+        ri_info_t *img_ptr;         IN: pointer to the image info for the
+                                        image to write.
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Write out the RI Vgroup to an HDF file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn GRIupdateRI(int32 hdf_file_id,ri_info_t *img_ptr)
+{
+    CONSTR(FUNC, "GRIupdateRI");   /* for HERROR */
+    int32 GroupID;      /* RI vgroup id */
+    intn  ret_value = SUCCEED;
+    int32 temp_ref;     /* used to hold the returned value from a function
+                                that may return a ref or a FAIL - BMR */
+
+
+    HEclear();
+    if (!HDvalidfid(hdf_file_id) || img_ptr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Write out the image/palette meta-information */
+    if (GRIupdatemeta(hdf_file_id,img_ptr)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Write out the RI Vgroup itself */
+    if ((GroupID = Vattach(hdf_file_id,(img_ptr->ri_ref!=DFREF_WILDCARD ?
+            img_ptr->ri_ref : -1),"w")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+    /* grab the ref. # of the new Vgroup */
+    if(img_ptr->ri_ref==DFREF_WILDCARD)
+    {
+    /* due to uint16 type of ref, check return value of VQueryref
+         and assign it to ri_ref only when it's not FAIL - BMR */
+    temp_ref = VQueryref (GroupID);
+    if(temp_ref == FAIL)
+        HGOTO_ERROR(DFE_BADREF,FAIL);
+    img_ptr->ri_ref = (uint16)temp_ref;
+    }
+
+    /* Set the name of the RI */
+    if(img_ptr->name!=NULL)
+        if(Vsetname(GroupID,img_ptr->name)==FAIL)
+            HGOTO_ERROR(DFE_BADVSNAME,FAIL);
+
+    /* Set the class of the RI group */
+    if(Vsetclass(GroupID,RI_NAME)==FAIL)
+        HGOTO_ERROR(DFE_BADVSNAME,FAIL);
+
+    /* add image dimension tag/ref to RIG */
+    if (Vaddtagref(GroupID, DFTAG_ID, (int32)img_ptr->img_dim.dim_ref) == FAIL)
+        HGOTO_ERROR(DFE_CANTADDELEM, FAIL);
+
+    /* If we don't have a tag for the image, just use DFTAG_RI for now */
+    if(img_ptr->img_tag==DFTAG_NULL)
+        img_ptr->img_tag=DFTAG_RI;
+
+    /* If we don't have a ref for the image, generate a new one */
+    if(img_ptr->img_ref==DFREF_WILDCARD) {
+        int32 temp_aid;
+
+        /* Assign reference number for image */
+        img_ptr->img_ref=Htagnewref(hdf_file_id,img_ptr->img_tag);
+
+        /* Make certain that the tag/ref pair is allocated in the file */
+        if((temp_aid=Hstartaccess(hdf_file_id,img_ptr->img_tag,img_ptr->img_ref,DFACC_WRITE))==FAIL)
+            HGOTO_ERROR(DFE_CANTADDELEM, FAIL);
+        Hendaccess(temp_aid);
+    } /* end if */
+
+    /* add image data tag/ref to RIG */
+    if (Vaddtagref(GroupID, (int32)img_ptr->img_tag, (int32)img_ptr->img_ref) == FAIL)
+        HGOTO_ERROR(DFE_CANTADDELEM, FAIL);
+
+    /* Check if we should write palette information */
+    if(img_ptr->lut_ref!=DFREF_WILDCARD)
+      {
+          /* add palette dimension tag/ref to RIG */
+          if (Vaddtagref(GroupID, DFTAG_LD, (int32)img_ptr->lut_dim.dim_ref) == FAIL)
+              HGOTO_ERROR(DFE_CANTADDELEM, FAIL);
+
+          /* add palette data tag/ref to RIG */
+          if (Vaddtagref(GroupID, (int32)img_ptr->lut_tag, (int32)img_ptr->lut_ref) == FAIL)
+              HGOTO_ERROR(DFE_CANTADDELEM, FAIL);
+      } /* end if */
+
+    /* write out RIG */
+    if(Vdetach(GroupID)==FAIL)
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end GRIupdateRI() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIup_attr_data
+ PURPOSE
+    Internal routine to update/create the attribute data
+ USAGE
+    intn GRIup_attr_data(hdf_file_id,attr_ptr)
+        int32 hdf_file_id;          IN: the file ID for the HDF file.
+        at_info_t *attr_ptr;        IN: pointer to the attribute info for the
+                                        attr. to write.
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Write out the data for an attribute to an HDF file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn GRIup_attr_data(int32 hdf_file_id,at_info_t *attr_ptr)
+{
+    CONSTR(FUNC, "GRIup_attr_data");   /* for HERROR */
+    intn   ret_value = SUCCEED;
+
+    HEclear();
+    if (!HDvalidfid(hdf_file_id) || attr_ptr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Write out the attribute data */
+    if (attr_ptr->ref==DFREF_WILDCARD)  /* create a new attribute */
+      {
+        if((attr_ptr->ref=(uint16)VHstoredata(hdf_file_id,attr_ptr->name,attr_ptr->data,
+                attr_ptr->len,attr_ptr->nt,RIGATTRNAME,RIGATTRCLASS))==(uint16)FAIL)
+            HGOTO_ERROR(DFE_VSCANTCREATE,FAIL);
+        attr_ptr->new_at=TRUE;
+      } /* end if */
+    else    /* update an existing one */
+      {
+        int32 AttrID;       /* attribute Vdata id */
+
+        if((AttrID=VSattach(hdf_file_id,(int32)attr_ptr->ref,"w"))==FAIL)
+            HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+        if(VSsetfields(AttrID,attr_ptr->name)==FAIL)
+          {
+            VSdetach(AttrID);
+            HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+          } /* end if */
+        if(VSwrite(AttrID,attr_ptr->data,attr_ptr->len,FULL_INTERLACE)==FAIL)
+          {
+            VSdetach(AttrID);
+            HGOTO_ERROR(DFE_VSWRITE,FAIL);
+          } /* end if */
+        if(VSdetach(AttrID)==FAIL)
+            HGOTO_ERROR(DFE_CANTDETACH,FAIL);
+      } /* end else */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end GRIup_attr_data() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRend
+ PURPOSE
+    Terminate the GR*() interface for a given HDF file.
+ USAGE
+    intn GRend(grid)
+        int32 grid;          IN: GR ID from GRstart
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Terminates access to the GR*() interface for a specific file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRend(int32 grid)
+{
+    CONSTR(FUNC, "GRend");      /* for HERROR */
+    int32 hdf_file_id;          /* HDF file ID */
+    int32 GroupID;              /* VGroup ID for the GR group */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    filerec_t *file_rec;        /* File record */
+    void *      *t1;
+    intn   ret_value = SUCCEED;
+    int32 temp_ref;     /* used to hold the returned value from a function
+                                that may return a ref or a FAIL - BMR */
+
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    /* check the validity of the GR ID */
+    if (HAatom_group(grid)!=GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate GR's object in hash table */
+    if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(grid)))
+        HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+    if (--gr_ptr->access)
+        HGOTO_DONE(SUCCEED);
+
+    hdf_file_id=gr_ptr->hdf_file_id;
+    file_rec = HAatom_object(hdf_file_id);
+
+    if(((file_rec->access)&DFACC_WRITE)!=0)
+      {
+        /* Check if the GR group exists, and create it if not */
+        if(gr_ptr->gr_ref==DFREF_WILDCARD)
+          {
+            if((GroupID=Vattach(gr_ptr->hdf_file_id,-1,"w"))==FAIL)
+                HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+
+            /* due to uint16 type of ref, check return value of VQueryref
+                then assign it to gr_ref only when it's not FAIL */
+            temp_ref = VQueryref(GroupID);
+            if(temp_ref == FAIL)
+                HGOTO_ERROR (DFE_NOVALS,FAIL);
+            gr_ptr->gr_ref = (uint16)temp_ref;
+            if(Vsetname(GroupID,GR_NAME)==FAIL)
+                HGOTO_ERROR(DFE_BADVSNAME,FAIL);
+            if(Vsetclass(GroupID,GR_NAME)==FAIL)
+                HGOTO_ERROR(DFE_BADVSNAME,FAIL);
+          } /* end if */
+        else
+          {
+            if((GroupID=Vattach(gr_ptr->hdf_file_id,(int32)gr_ptr->gr_ref,"w"))==FAIL)
+                HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+          } /* end else */
+
+        /* Write out the information for RIs which have been changed */
+        if(gr_ptr->gr_modified==TRUE && gr_ptr->gr_count>0)
+          {
+              void *      *t2;
+              ri_info_t *img_ptr;   /* ptr to the image */
+
+              if (NULL == (t2 = (void **)tbbtfirst((TBBT_NODE *) * (gr_ptr->grtree))))
+                {
+                    HGOTO_ERROR(DFE_NOTINTABLE, FAIL);
+                } /* end if */
+              else
+                  img_ptr = (ri_info_t *) * t2;   /* get actual pointer to the ri_info_t */
+
+              /* cycle through all of the images in memory */
+              while (t2!=NULL)
+                {
+                    /* check if the image data has been modified */
+                    if(img_ptr->data_modified==TRUE)
+                      {
+                        /* do nothing currently, we are synchronously updating the image data */
+                          img_ptr->data_modified=FALSE;
+                      } /* end if */
+
+                    /* check if the image meta-info has been modified */
+                    if(img_ptr->meta_modified==TRUE)
+                      {
+                          /* Test if the tag/ref pair has been assigned yet */
+                          if(img_ptr->img_tag==DFTAG_NULL || img_ptr->img_ref==DFREF_WILDCARD)
+                            {
+                              img_ptr->img_tag=DFTAG_RI;
+                            } /* end if */
+
+                          /* write out the RI/RIG information again */
+                          if(GRIupdateRIG(gr_ptr->hdf_file_id,img_ptr)==FAIL)
+                              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                          if(GRIupdateRI(gr_ptr->hdf_file_id,img_ptr)==FAIL)
+                              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                          img_ptr->meta_modified=FALSE;
+                      } /* end if */
+
+                    /* check if the local attributes has been modified */
+                    if(img_ptr->attr_modified==TRUE && img_ptr->lattr_count>0)
+                      {
+                          void *      *t3;
+                          at_info_t *attr_ptr;   /* ptr to the attribute */
+
+                          if (NULL == (t3 = (void **)tbbtfirst((TBBT_NODE *) * (img_ptr->lattree))))
+                            {
+                                HGOTO_ERROR(DFE_NOTINTABLE, FAIL);
+                            } /* end if */
+                          else
+                              attr_ptr = (at_info_t *) * t3;   /* get actual pointer to the at_info_t */
+
+                          /* cycle through all of the local attributes in memory */
+                          while (t3!=NULL)
+                            {
+                                /* check if the attribute data has been modified */
+                                if(attr_ptr->data_modified==TRUE)
+                                  {
+                                      if(GRIup_attr_data(gr_ptr->hdf_file_id,attr_ptr)==FAIL)
+                                          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                                      attr_ptr->data_modified=FALSE;
+                                  } /* end if */
+
+                                /* check if the attribute was added to the group */
+                                if(attr_ptr->new_at==TRUE)
+                                  {
+                                      int32 lGroupID;  /* ID of the Vgroup */
+
+                                      if((lGroupID=Vattach(gr_ptr->hdf_file_id,(int32)img_ptr->ri_ref,"w"))==FAIL)
+                                          HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+                                      if(Vaddtagref(lGroupID,ATTR_TAG,(int32)attr_ptr->ref)==FAIL)
+                                          HGOTO_ERROR(DFE_CANTADDELEM,FAIL);
+                                      if(Vdetach(lGroupID)==FAIL)
+                                          HGOTO_ERROR(DFE_CANTDETACH,FAIL);
+                                      attr_ptr->new_at=FALSE;
+                                  } /* end if */
+
+                                /* get the next local attribute in the tree/list */
+                                if (NULL != (t3 = (void **)tbbtnext((TBBT_NODE *) t3)))     /* get the next node in the tree */
+                                    attr_ptr = (at_info_t *) * t3;     /* get actual pointer to the at_info_t */
+                            } /* end while */
+                          img_ptr->attr_modified=FALSE;
+                      } /* end if */
+
+                    /* Check if the RI is already in the GR, add it if not */
+                    if(Vinqtagref(GroupID,RI_TAG,(int32)img_ptr->ri_ref)==FALSE)
+                        if(Vaddtagref(GroupID,RI_TAG,(int32)img_ptr->ri_ref)==FAIL)
+                            HGOTO_ERROR(DFE_CANTADDELEM,FAIL);
+
+                    /* get the next image in the tree/list */
+                    if (NULL != (t2 = (void **)tbbtnext((TBBT_NODE *) t2)))     /* get the next node in the tree */
+                        img_ptr = (ri_info_t *) * t2;     /* get actual pointer to the ri_info_t */
+                } /* end while */
+          } /* end if */
+
+        /* Write out the information for the global attributes which have been changed */
+        if(gr_ptr->gattr_modified==TRUE && gr_ptr->gattr_count>0)
+          {
+              void *      *t2;
+              at_info_t *attr_ptr;   /* ptr to the attribute */
+
+              if (NULL == (t2 = (void **)tbbtfirst((TBBT_NODE *) * (gr_ptr->gattree))))
+                {
+                    HGOTO_ERROR(DFE_NOTINTABLE, FAIL);
+                } /* end if */
+              else
+                  attr_ptr = (at_info_t *) * t2;   /* get actual pointer to the at_info_t */
+
+              /* cycle through all of the global attributes in memory */
+              while (t2!=NULL)
+                {
+                    /* check if the attribute data has been modified */
+                    if(attr_ptr->data_modified==TRUE)
+                      {
+                        if(GRIup_attr_data(gr_ptr->hdf_file_id,attr_ptr)==FAIL)
+                            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                        attr_ptr->data_modified=FALSE;
+
+                        /* check if the attribute was a new attribute */
+                        if(attr_ptr->new_at==TRUE)
+                          {
+                            if(Vaddtagref(GroupID,ATTR_TAG,(int32)attr_ptr->ref)==FAIL)
+                                HGOTO_ERROR(DFE_CANTADDELEM,FAIL);
+                            attr_ptr->new_at=FALSE;
+                          } /* end if */
+                      } /* end if */
+
+                    /* get the next global attribute in the tree/list */
+                    if (NULL != (t2 = (void **)tbbtnext((TBBT_NODE *) t2)))     /* get the next node in the tree */
+                        attr_ptr = (at_info_t *) * t2;     /* get actual pointer to the at_info_t */
+                } /* end while */
+            gr_ptr->gattr_modified=FALSE;
+          } /* end if */
+
+        /* Let go of the GR Vgroup */
+        if(Vdetach(GroupID)==FAIL)
+            HGOTO_ERROR(DFE_CANTDETACH,FAIL);
+      } /* end if */
+
+    /* Free all the memory we've allocated */
+    tbbtdfree(gr_ptr->grtree, GRIridestroynode, NULL);
+    tbbtdfree(gr_ptr->gattree, GRIattrdestroynode, NULL);
+
+    /* Close down the entry for this file in the GR tree */
+    /* Find the node in the tree */
+    if (( t1 = (void **)tbbtdfind(gr_tree, &hdf_file_id, NULL)) == NULL)
+        HGOTO_DONE(FAIL);
+
+    /* Delete the node and free the gr_info_t stucture */
+    tbbtrem((TBBT_NODE **) gr_tree, (TBBT_NODE *) t1, NULL);
+    HDfree(gr_ptr);
+
+    /* Close down the Vset routines we started */
+    if(Vend(hdf_file_id)==FAIL)
+        HGOTO_ERROR(DFE_CANTSHUTDOWN,FAIL);
+
+    if (NULL == HAremove_atom(grid))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRend() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRselect
+ PURPOSE
+    Select a raster image to operate on.
+ USAGE
+    int32 GRselect(grid,index)
+        int32 grid;          IN: GR ID from GRstart
+        int32 index;         IN: Which raster image to select (indexed from 0)
+ RETURNS
+    A valid riid (Raster-Image ID) on success, or FAIL.
+
+ DESCRIPTION
+    Selects a raster image from the file to work on.  This ID is needed for
+    all operations on the image dataset, including reading/writing data,
+    annotations, etc.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 GRselect(int32 grid,int32 index)
+{
+    CONSTR(FUNC, "GRselect");   /* for HERROR */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    void * *t;                   /* temp. ptr to the image found */
+    int32  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    /* check the validity of the GR ID */
+    if (HAatom_group(grid)!=GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate GR's object in hash table */
+    if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(grid)))
+        HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+    /* check the index range validity */
+    if(!VALIDRIINDEX(index,gr_ptr))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if((t = (void **)tbbtdfind(gr_ptr->grtree, &index, NULL))==NULL)
+        HGOTO_ERROR(DFE_RINOTFOUND,FAIL);
+    ri_ptr=(ri_info_t *)*t;
+
+    ri_ptr->access++;
+
+    ret_value=HAregister_atom(RIIDGROUP,ri_ptr);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRselect() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRcreate
+
+ PURPOSE
+    Create a new raster image.
+
+ USAGE
+    int32 GRcreate(grid, name, ncomp, nt, il, dimsizes)
+        int32 grid;         IN: GR ID from GRstart
+        char *name;         IN: Name of raster image to create
+        int32 ncomp;        IN: Number of components in image
+        int32 nt;           IN: Number type of each component
+        int32 il;           IN: Interlace of the components in the image
+        int32 dimsizes[2];  IN: Dimensions of the new image
+
+ RETURNS
+    A valid riid (Raster-Image ID) on success, or FAIL.
+
+ DESCRIPTION
+    Creates a new raster image in a file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    All components must be the same number-type.
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 GRcreate(int32 grid,const char *name,int32 ncomp,int32 nt,int32 il,int32 dimsizes[2])
+{
+    CONSTR(FUNC, "GRcreate");   /* for HERROR */
+    int32 GroupID;              /* ID of the Vgroup created */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    int32    ret_value = SUCCEED;
+    int32 temp_ref;     /* used to hold the returned value from a function
+                                that may return a ref or a FAIL - BMR */
+
+    /* clear error stack */
+    HEclear();
+
+    /* check the validity of the args */
+    if (HAatom_group(grid)!=GRIDGROUP || name==NULL || ncomp<1
+            || (il!=MFGR_INTERLACE_PIXEL && il!=MFGR_INTERLACE_LINE 
+            && il!=MFGR_INTERLACE_COMPONENT) || dimsizes==NULL 
+            || dimsizes[0]<=0 || dimsizes[1]<=0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate GR's object in hash table */
+    if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(grid)))
+        HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+    /* Allocate space for the new image information */
+    if((ri_ptr=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE,FAIL);
+    HDmemset(ri_ptr,0,sizeof(ri_info_t));
+    
+    /* Allocate space for the name and copy it */
+    if((ri_ptr->name=(char *)HDmalloc(HDstrlen(name)+1))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE,FAIL);
+    HDstrcpy(ri_ptr->name,name);
+
+    /* Assign image information */
+    ri_ptr->index=gr_ptr->gr_count;
+#ifdef OLD_WAY
+    ri_ptr->ri_ref=DFREF_WILDCARD;
+#else /* OLD_WAY */
+    if ((GroupID = Vattach(gr_ptr->hdf_file_id,-1,"w")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    /* due to uint16 type of ref, check return value of VQueryref
+         and assign it to ri_ref only when it's not FAIL - BMR */
+    temp_ref = VQueryref(GroupID);
+    if(temp_ref == FAIL)
+        HGOTO_ERROR(DFE_BADREF, FAIL);
+    ri_ptr->ri_ref = (uint16)temp_ref;
+    if(Vdetach(GroupID)==FAIL)
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+#endif /* OLD_WAY */
+    ri_ptr->rig_ref=DFREF_WILDCARD;
+    ri_ptr->gr_ptr=gr_ptr;
+    ri_ptr->img_dim.dim_ref=DFREF_WILDCARD;
+    ri_ptr->img_dim.xdim=dimsizes[XDIM];
+    ri_ptr->img_dim.ydim=dimsizes[YDIM];
+    ri_ptr->img_dim.ncomps=ncomp;
+    ri_ptr->img_dim.nt=nt;
+    ri_ptr->img_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
+    ri_ptr->img_dim.il=(gr_interlace_t)il;
+    ri_ptr->img_dim.nt_tag=ri_ptr->img_dim.nt_ref=DFREF_WILDCARD;
+    ri_ptr->img_dim.comp_tag=ri_ptr->img_dim.comp_ref=DFREF_WILDCARD;
+    ri_ptr->img_tag=ri_ptr->img_ref=DFREF_WILDCARD;
+    ri_ptr->img_aid=0;
+    ri_ptr->acc_perm=0;
+    ri_ptr->lut_tag=ri_ptr->lut_ref=DFREF_WILDCARD;
+    ri_ptr->im_il=MFGR_INTERLACE_PIXEL;
+    ri_ptr->lut_il=MFGR_INTERLACE_PIXEL;
+    ri_ptr->data_modified=FALSE;
+    ri_ptr->meta_modified=TRUE;
+    ri_ptr->attr_modified=FALSE;
+    ri_ptr->lattr_count=0;
+    ri_ptr->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+    if(ri_ptr->lattree==NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    ri_ptr->use_buf_drvr=FALSE;
+    ri_ptr->use_cr_drvr=FALSE;
+    ri_ptr->comp_img=FALSE;
+    ri_ptr->ext_img=FALSE;
+    ri_ptr->acc_img=FALSE;
+    ri_ptr->fill_img=TRUE;
+    ri_ptr->fill_value=NULL;
+    ri_ptr->store_fill=FALSE;
+    ri_ptr->access++;
+
+    /* insert the new image in the global image tree */
+    tbbtdins(gr_ptr->grtree, ri_ptr, NULL);    /* insert the new image into B-tree */ 
+
+    /* indicate that the GR info has changed */
+    gr_ptr->gr_modified=TRUE;
+    gr_ptr->gr_count++;
+
+    ret_value=HAregister_atom(RIIDGROUP,ri_ptr);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRcreate() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRnametoindex
+ PURPOSE
+    Map a raster image name to an index.
+ USAGE
+    int32 GRnametoindex(grid,name)
+        int32 grid;          IN: GR ID from GRstart
+        char *name;          IN: Name of raster image to search for
+ RETURNS
+    A valid index on success, or FAIL.
+
+ DESCRIPTION
+    Searches for a raster image based on the name provided.  This routine
+    maps from names of raster images to indices inside the GR group.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 GRnametoindex(int32 grid,const char *name)
+{
+    CONSTR(FUNC, "GRnametoindex");   /* for HERROR */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    void * *t;                   /* temp. ptr to the image found */
+    int32   ret_value = SUCCEED;
+
+    /* clear error stack and check validity of file id */
+    HEclear();
+
+    /* check the validity of the GR ID */
+    if (HAatom_group(grid)!=GRIDGROUP || name==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate GR's object in hash table */
+    if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(grid)))
+        HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+    if((t = (void **)tbbtfirst((TBBT_NODE *)* (gr_ptr->grtree)))==NULL)
+        HGOTO_ERROR(DFE_RINOTFOUND,FAIL);
+    do {
+        ri_ptr=(ri_info_t *)*t;
+        if(ri_ptr!=NULL && HDstrcmp(ri_ptr->name,name)==0)  /* ie. the name matches */
+            HGOTO_DONE(ri_ptr->index);
+    } while((t= (void **)tbbtnext((TBBT_NODE *)t))!=NULL);
+
+    ret_value = (FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRnametoindex() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetiminfo
+
+ PURPOSE
+    Gets information about a raster image.
+
+ USAGE
+    intn GRgetiminfo(riid,name,ncomp,nt,il,dimsizes,n_attr)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        char *name;         OUT: name of raster image
+        int32 *ncomp;       OUT: number of components in image
+        int32 *nt;          OUT: number type of components
+        int32 *il;          OUT: interlace of the image
+        int32 *dimsizes;    OUT: size of each dimension
+        int32 *n_attr;      OUT: the number of attributes for the image
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Looks up information about an image which has been selected or created
+    with the GR routines.  Each of the parameters can be NULL, in which case
+    that piece of information will not be retrieved.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRgetiminfo(int32 riid,char *name,int32 *ncomp,int32 *nt,int32 *il,
+    int32 dimsizes[2],int32 *n_attr)
+{
+    CONSTR(FUNC, "GRgetiminfo");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    if(name!=NULL)
+        HDstrcpy(name, ri_ptr->name);
+
+    if(ncomp!=NULL)
+        *ncomp=ri_ptr->img_dim.ncomps;
+
+    if(nt!=NULL)
+        *nt=ri_ptr->img_dim.nt;
+
+    if(il!=NULL)
+        *il=(int32)ri_ptr->img_dim.il;
+
+    if(dimsizes!=NULL)
+      {
+          dimsizes[0]=ri_ptr->img_dim.xdim;
+          dimsizes[1]=ri_ptr->img_dim.ydim;
+      } /* end if */
+
+    if(n_attr!=NULL)
+        *n_attr=ri_ptr->lattr_count;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRgetiminfo() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetnluts
+
+ PURPOSE
+    Get the number of palettes (LUTs) for an image
+
+ USAGE
+    intn GRgetnluts(riid)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+
+ RETURNS
+    The number of palettes on success, FAIL (-1) on failure
+
+ DESCRIPTION
+    Determines the number of palettes for an image (0 or 1 for now).  In the
+    future, if multiple palettes are supported, this function may return
+    values greater than 1.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRgetnluts(int32 riid)
+{
+    CONSTR(FUNC, "GRgetnluts");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = FAIL;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate LUT's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    if(ri_ptr->lut_ref==DFREF_WILDCARD) /* check for no palette defined currently */
+        ret_value=0;
+    else        /* we've got a valid palette currently */
+        ret_value=1;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return ret_value;
+} /* end GRgetnluts() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRwriteimage
+
+ PURPOSE
+    Writes raster data to an image
+
+ USAGE
+    intn GRwriteimage(riid,start,stride,edge,data)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        int32 start[2];     IN: array containing the offset in the image of the
+                                image data to write out
+        int32 stride[2];    IN: array containing interval of data being written
+                                along each edge.  strides of 0 are illegal
+                                (and generate an error)
+                                ie. stride of 1 in each dimension means
+                                writing contiguous data, stride of 2 means
+                                writing every other element out along an edge.
+        int32 count[2];     IN: number of elements to write out along each edge.
+        void * data;         IN: pointer to the data to write out.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Writes image data to an RI.  Partial dataset writing and subsampling is
+        allowed, but only within the dimensions of the dataset (ie. no UNLIMITED
+        dimension support)
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    If the stride parameter is set to NULL, a stride of 1 will be assumed.
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRwriteimage(int32 riid,int32 start[2],int32 in_stride[2],int32 count[2],void * data)
+{
+    CONSTR(FUNC, "GRwriteimage");   /* for HERROR */
+    int32 hdf_file_id;          /* HDF file ID */
+    int32 stride[2];            /* pointer to the stride array */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn solid_block=FALSE;     /* whether the image data is a solid block of data */
+    intn whole_image=FALSE;     /* whether we are writing out the whole image */
+    void * *img_data;            /* pointer to the converted image data to write */
+    uintn pixel_mem_size,       /* size of a pixel in memory */
+        pixel_disk_size;        /* size of a pixel on disk */
+    uint16 scheme;  /* compression scheme used for JPEG images */
+    uint32     comp_config;
+    comp_coder_t comp_type; 
+    comp_info cinfo;
+    intn status=FAIL;
+    intn convert=FALSE;         /* true if machine NT != NT to be written */
+    uint8 platnumsubclass;      /* class of this NT for this platform */
+    intn new_image=FALSE;       /* whether we are writing a new image out */
+    intn switch_interlace=FALSE;/* whether the memory interlace needs to be switched around */
+    intn ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the basic validity of the args (stride is OK to be NULL) */
+    if (HAatom_group(riid)!=RIIDGROUP || start==NULL /* || in_stride==NULL */ || count==NULL
+            || data==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* Get the correct parameters into the stride array */
+    if(in_stride==NULL)
+          stride[XDIM]=stride[YDIM]=1;
+    else
+      {
+          stride[XDIM]=in_stride[XDIM];
+          stride[YDIM]=in_stride[YDIM];
+      } /* end else */
+
+    /* Sanity check the start, stride, and count args */
+    if((start[XDIM]<0 || start[YDIM]<0) || (stride[XDIM]<1 || stride[YDIM]<1)
+            || (count[XDIM]<1 || count[YDIM]<1))
+        HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+    gr_ptr=ri_ptr->gr_ptr;
+    hdf_file_id=gr_ptr->hdf_file_id;
+
+    comp_type = COMP_CODE_NONE;
+    scheme = ri_ptr->img_dim.comp_tag;
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+    {
+        comp_type = COMP_CODE_JPEG;
+        cinfo.jpeg.quality = 0;
+        cinfo.jpeg.force_baseline = 0;
+    }
+    else if (scheme == DFTAG_IMC)
+    { /* coder no longer supported */
+        HGOTO_ERROR(DFE_BADCODER,FAIL);
+    }
+    else
+    {
+        /* use lower-level routine to get the compression information */
+        status = HCPgetcompinfo(ri_ptr->gr_ptr->hdf_file_id,
+                        ri_ptr->img_tag, ri_ptr->img_ref,
+                        &comp_type, &cinfo);
+	if (status == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    }
+    if (comp_type != COMP_CODE_NONE)
+    {
+        /* Check that the compression encoder is available */
+        HCget_config_info(comp_type, &comp_config);
+        if ((comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED) == 0) {
+            /* coder not present?? */
+             HGOTO_ERROR(DFE_BADCODER,FAIL); 
+        }
+        if ((comp_config & COMP_ENCODER_ENABLED) == 0) {
+            /* encoder not present?? */
+             HGOTO_ERROR(DFE_NOENCODER,FAIL); 
+        }
+    }
+
+    if(stride[XDIM]==1 && stride[YDIM]==1)
+      { /* solid block of data */
+          solid_block=TRUE;
+          if((start[XDIM]==0 && start[YDIM]==0) && (count[XDIM]==ri_ptr->img_dim.xdim
+                && count[YDIM]==ri_ptr->img_dim.ydim))
+              whole_image=TRUE;
+          else
+              whole_image=FALSE;
+      } /* end if */
+    else /* block of data spread out with strides */
+          solid_block=FALSE;
+
+    if(ri_ptr->img_dim.il!=MFGR_INTERLACE_PIXEL)
+        switch_interlace=TRUE;
+
+    /* Get the size of the pixels in memory and on disk */
+    pixel_mem_size=(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize((ri_ptr->img_dim.nt | DFNT_NATIVE) & (~DFNT_LITEND)));
+    pixel_disk_size=(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+
+    /* Get number-type and conversion information */
+    platnumsubclass = (uint8)DFKgetPNSC(ri_ptr->img_dim.nt & (~DFNT_LITEND), DF_MT);
+    convert = (ri_ptr->img_dim.file_nt_subclass != platnumsubclass) ||
+  (pixel_mem_size != pixel_disk_size);  /* is conversion necessary? */
+
+    if(convert || switch_interlace==TRUE)
+      {   /* convert image data to HDF disk format */
+          /* Allocate space for the conversion buffer */
+          if((img_data=HDmalloc(pixel_disk_size*(size_t)count[XDIM]*(size_t)count[YDIM]))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+          if(switch_interlace==TRUE)
+            {
+              void * pixel_buf;  /* buffer for the pixel interlaced data */
+
+              /* Allocate space for the conversion buffer */
+              if((pixel_buf=HDmalloc(pixel_mem_size*(size_t)count[XDIM]*(size_t)count[YDIM]))==NULL)
+                  HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+              GRIil_convert(data,ri_ptr->img_dim.il,pixel_buf,MFGR_INTERLACE_PIXEL,
+                  count,ri_ptr->img_dim.ncomps,ri_ptr->img_dim.nt);
+
+              /* convert the pixel data into the HDF disk format */
+              DFKconvert(pixel_buf,img_data,ri_ptr->img_dim.nt,
+                  ri_ptr->img_dim.ncomps*count[XDIM]*count[YDIM],DFACC_WRITE,0,0);
+
+              HDfree(pixel_buf);
+            } /* end if */
+          else /* convert the pixel data into the HDF disk format */
+              DFKconvert(data,img_data,ri_ptr->img_dim.nt,
+                  ri_ptr->img_dim.ncomps*count[XDIM]*count[YDIM],DFACC_WRITE,0,0);
+      } /* end if */
+    else /* no conversion necessary, just use the user's buffer */
+        img_data=data;
+
+    if(ri_ptr->img_tag==DFTAG_NULL || ri_ptr->img_ref==DFREF_WILDCARD)
+        new_image=TRUE;
+    else {
+        /* Check if the actual image data is in the file yet, or if just the tag & ref are known */
+        if(Hlength(ri_ptr->gr_ptr->hdf_file_id,ri_ptr->img_tag,ri_ptr->img_ref)>0)
+            new_image=FALSE;
+        else
+            new_image=TRUE;
+    } /* end else */
+
+    if(GRIgetaid(ri_ptr,DFACC_WRITE)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+    if(whole_image==TRUE)
+      { /* write the whole image out */
+#ifdef OLD_WAY
+        if(new_image==TRUE)
+          { /* Create the tag/ref for the new image */
+              ri_ptr->img_tag=DFTAG_RI;
+              ri_ptr->img_ref=Htagnewref(hdf_file_id,ri_ptr->img_tag);
+          } /* end if */
+        if(Hputelement(hdf_file_id,ri_ptr->img_tag,ri_ptr->img_ref,
+                (uint8 *)img_data,(int32)pixel_disk_size*count[XDIM]*count[YDIM])==FAIL)
+            HGOTO_ERROR(DFE_PUTELEM,FAIL);
+#else /* OLD_WAY */
+        /* Make certain we are at the beginning */
+        if(Hseek(ri_ptr->img_aid,0,DF_START)==FAIL)
+            HGOTO_ERROR(DFE_SEEKERROR,FAIL);
+
+        /* Write the entire image out */
+        if(Hwrite(ri_ptr->img_aid,(int32)pixel_disk_size*count[XDIM]*count[YDIM],
+                (uint8 *)img_data)==FAIL)
+            HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+#endif /* OLD_WAY */
+      } /* end if */
+    else
+      { /* write only part of the image out */
+          int32 img_offset; /* current offset in the image data */
+          void * tmp_data;   /* temp. pointer to the image data to write */
+          intn fill_image=FALSE;  /* whether to create fill values, etc. */
+          void * fill_line=NULL;   /* array containing the fill pixels for an entire line of the image */
+          int32 fill_lo_size=0,   /* number of bytes in the "low" block */
+              fill_hi_size=0,     /* number of bytes in the "high" block */
+              fill_line_size=0;   /* number of bytes in the "line" block */
+
+          img_offset=((ri_ptr->img_dim.xdim*start[YDIM])+start[XDIM])*(int32)pixel_disk_size;
+
+          /* check if this is a new image, and if we need to write fill pixels */
+          if(new_image==TRUE && ri_ptr->fill_img==TRUE)
+            { /* create fill value arrays for various blocks */
+                void * fill_pixel; /* converted value for the filled pixel */
+                int32 at_index;   /* attribute index for the fill value */
+
+                if((fill_pixel=HDmalloc(pixel_disk_size))==NULL)
+                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+                /* create correct disk version of fill pixel */
+                if(ri_ptr->fill_value!=NULL)
+                  {
+                      DFKconvert(ri_ptr->fill_value,fill_pixel,
+                          ri_ptr->img_dim.nt,ri_ptr->img_dim.ncomps,
+                          DFACC_WRITE,0,0);
+                  } /* end if */
+                else  /* create default pixel fill value of all zero components */
+                  {
+                    /* Try to find a fill value attribute */
+                    if((at_index=GRfindattr(riid,FILL_ATTR))!=FAIL)
+                      { /* Found a fill value attribute */
+                          if((ri_ptr->fill_value=HDmalloc(pixel_mem_size))==NULL)
+                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                          if(GRgetattr(riid,at_index,ri_ptr->fill_value)==FAIL)
+                              HGOTO_ERROR(DFE_BADATTR,FAIL);
+                          DFKconvert(ri_ptr->fill_value,fill_pixel,
+                              ri_ptr->img_dim.nt,ri_ptr->img_dim.ncomps,
+                              DFACC_WRITE,0,0);
+                      } /* end if */
+                    else
+                        HDmemset(fill_pixel,0,pixel_disk_size);
+                  } /* end else */
+
+                /* check for "low" pixel runs */
+                if(start[XDIM]>0)
+                    fill_lo_size=(int32)pixel_disk_size*start[XDIM];
+
+                /* check for "high" pixel runs */
+                if((start[XDIM]+((count[XDIM]-1)*stride[XDIM])+1)<ri_ptr->img_dim.xdim)
+                    fill_hi_size=(int32)pixel_disk_size*(ri_ptr->img_dim.xdim-
+                        (start[XDIM]+((count[XDIM]-1)*stride[XDIM])+1));
+
+                /* create the "line" pixel block */
+                /* allocate space for the "line" block */
+                fill_line_size=(int32)pixel_disk_size*ri_ptr->img_dim.xdim;
+                if((fill_line=HDmalloc(fill_line_size))==NULL)
+                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                HDmemfill(fill_line,fill_pixel,pixel_disk_size,(uint32)ri_ptr->img_dim.xdim);
+
+                fill_image=TRUE;  /* set flag to write out fill pixels */
+                ri_ptr->store_fill=TRUE;  /* set flag to store fill value attribute */
+
+                /* Get rid of the fill pixel */
+                if(ri_ptr->fill_value==NULL)
+                    ri_ptr->fill_value=fill_pixel;
+                else
+                    HDfree(fill_pixel);
+            } /* end if */
+
+          tmp_data=img_data;
+          if(solid_block==TRUE)
+            {   /* write out runs of data in the image */
+                int32 pix_len;    /* length of current row's pixel run */
+                intn i;           /* temporary loop variable */
+
+                pix_len=(int32)pixel_disk_size*count[XDIM];
+                  
+                if(fill_image==TRUE)
+                  {   /* surround the block to write with fill values */
+                      /* write out lines "below" the block */
+                      if(start[YDIM]>0)
+                        { /* fill in the lines leading up the block */
+                          for(i=0; i<start[YDIM]; i++)
+                              if(Hwrite(ri_ptr->img_aid,fill_line_size,fill_line)==FAIL)
+                                  HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                        } /* end if */
+
+                      /* write prelude of low pixels */
+                      if(fill_lo_size>0)
+                          if(Hwrite(ri_ptr->img_aid,fill_lo_size,fill_line)==FAIL)
+                              HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+
+                      /* write out the block */
+                      for(i=0; i<count[YDIM]; i++)
+                        {
+                            if(Hwrite(ri_ptr->img_aid,pix_len,tmp_data)==FAIL)
+                                HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+
+                            /* This next write wraps around the high side */
+                            /* of the block and writes the next low side */
+                            /* at the same time. */
+                            if((fill_hi_size+fill_lo_size)>0
+                                    && i<(count[YDIM]-1))
+                                if(Hwrite(ri_ptr->img_aid,(fill_hi_size+fill_lo_size),fill_line)==FAIL)
+                                    HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                            tmp_data=(void *)((char *)tmp_data+pix_len);
+                        } /* end for */
+                        
+                      /* Finish the last chunk of high side fill values */
+                      if(fill_hi_size>0)
+                          if(Hwrite(ri_ptr->img_aid,fill_hi_size,fill_line)==FAIL)
+                              HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+
+                      /* write out lines "above" the block */
+                      if((start[YDIM]+((count[YDIM]-1)*stride[YDIM])+1)
+                          <ri_ptr->img_dim.ydim)
+                        {
+                          for(i=start[YDIM]+((count[YDIM]-1)*stride[YDIM])+1;
+                                  i<ri_ptr->img_dim.ydim; i++)
+                              if(Hwrite(ri_ptr->img_aid,fill_line_size,fill_line)==FAIL)
+                                  HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                        } /* end if */
+                  } /* end if */
+                else
+                  {   /* don't worry about fill values */
+                      for(i=0; i<count[YDIM]; i++)
+                        {
+                            if(Hseek(ri_ptr->img_aid,img_offset,DF_START)==FAIL)
+                                HGOTO_ERROR(DFE_SEEKERROR,FAIL);
+                            if(Hwrite(ri_ptr->img_aid,pix_len,tmp_data)==FAIL)
+                                HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                            img_offset+=(int32)pixel_disk_size*ri_ptr->img_dim.xdim;
+                            tmp_data=(void *)((char *)tmp_data+pix_len);
+                        } /* end for */
+                  } /* end else */
+            } /* end if */
+          else
+            {   /* sub-sampling, seek to each data element and write it out */
+                intn i,j,k;       /* temporary loop variables */
+                int32 fill_stride_size=0; /* # of pixels in the stride block */
+                intn fill_xdim=FALSE, /* whether to fill in the X dimension */
+                    fill_ydim=FALSE;  /* whether to fill in the Y dimension */
+
+                /* check if we need to insert fill pixels between strides */
+                if(fill_image==TRUE)
+                  {   /* create the "stride" pixel block */
+                      if(stride[XDIM]>1)
+                        {
+                          /* allocate space for the "stride" block */
+                          fill_stride_size=(int32)pixel_disk_size*(stride[XDIM]-1);
+                          fill_xdim=TRUE;
+                        } /* end if */
+                      if(stride[YDIM]>1)
+                          fill_ydim=TRUE;
+
+                      /* write fills and sub-sampled data */
+
+                      /* write out lines "below" the block */
+                      if(start[YDIM]>0)
+                        { /* fill in the lines leading up the block */
+                          for(i=0; i<start[YDIM]; i++)
+                            {
+                              if(Hwrite(ri_ptr->img_aid,fill_line_size,fill_line)==FAIL)
+                                  HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                            } /* end for */
+                        } /* end if */
+
+                      /* write prelude of low pixels */
+                      if(fill_lo_size>0)
+                        {
+                          if(Hwrite(ri_ptr->img_aid,fill_lo_size,fill_line)==FAIL)
+                              HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                        } /* end if */
+
+                      for(i=0; i<count[YDIM]; i++)
+                        {
+                            for(j=0; j<count[XDIM]; j++)
+                              {
+                                if(Hwrite(ri_ptr->img_aid,(int32)pixel_disk_size,tmp_data)==FAIL)
+                                    HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                                if(fill_xdim==TRUE && j<(count[XDIM]-1))
+                                  {
+                                    if(Hwrite(ri_ptr->img_aid,fill_stride_size,fill_line)==FAIL)
+                                        HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                                  } /* end if */
+                                tmp_data=(void *)((char *)tmp_data+pixel_disk_size);
+                              } /* end for */
+
+                            /* Fill in the y-dim stride lines */
+                            if(fill_ydim==TRUE)
+                                for(k=1; k<stride[YDIM]; k++)
+                                  {
+                                    if(Hwrite(ri_ptr->img_aid,fill_line_size,fill_line)==FAIL)
+                                        HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                                  } /* end for */
+
+                            /* This next write wraps around the high side */
+                            /* of the block and writes the next low side */
+                            /* at the same time. */
+                            if((fill_hi_size+fill_lo_size)>0
+                                    && i<(count[YDIM]-1))
+                              {
+                                if(Hwrite(ri_ptr->img_aid,(fill_hi_size+fill_lo_size),fill_line)==FAIL)
+                                    HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                              } /* end if */
+                        } /* end for */
+
+                      /* Finish the last chunk of high side fill values */
+                      if(fill_hi_size>0)
+                        {
+                          if(Hwrite(ri_ptr->img_aid,fill_hi_size,fill_line)==FAIL)
+                              HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                        } /* end if */
+
+                  } /* end if */
+                else
+                  {   /* don't worry about fill values */
+                    int32 stride_add; /* amount to add for stride amount */
+
+                    stride_add=(int32)pixel_disk_size*stride[XDIM];
+
+                      for(i=0; i<count[YDIM]; i++)
+                        {
+                            int32 local_offset;
+
+                            local_offset=img_offset;
+                            for(j=0; j<count[XDIM]; j++)
+                              {
+                                if(Hseek(ri_ptr->img_aid,local_offset,DF_START)==FAIL)
+                                    HGOTO_ERROR(DFE_SEEKERROR,FAIL);
+                                if(Hwrite(ri_ptr->img_aid,(int32)pixel_disk_size,tmp_data)==FAIL)
+                                    HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+                                local_offset+=stride_add;
+                                tmp_data=(void *)((char *)tmp_data+pixel_disk_size);
+                              } /* end for */
+
+                            img_offset+=ri_ptr->img_dim.xdim*stride[YDIM]*(int32)pixel_disk_size;
+                        } /* end for */
+                  } /* end else */
+            } /* end else */
+            
+          if(fill_line!=NULL)     /* free the fill-value pixels if we used 'em */
+              HDfree(fill_line);
+
+      } /* end else */
+    ri_ptr->data_modified=TRUE;
+
+    /* if we've allocated a temporary buffer, free it */
+    if(convert || switch_interlace==TRUE)
+        HDfree(img_data);
+
+    /* mark the image as being modified */
+    ri_ptr->data_modified=TRUE;
+    gr_ptr->gr_modified=TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRwriteimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRreadimage
+
+ PURPOSE
+    Read raster data for an image
+
+ USAGE
+    intn GRreadimage(riid,start,stride,edge,data)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        int32 start[2];     IN: array containing the offset in the image of the
+                                image data to read in
+        int32 stride[2];    IN: array containing interval of data being read
+                                along each edge.  strides of 0 are illegal
+                                (and generate an error)
+                                ie. stride of 1 in each dimension means
+                                reading contiguous data, stride of 2 means
+                                reading every other element out along an edge.
+        int32 count[2];     IN: number of elements to read in along each edge.
+        void * data;         IN: pointer to the data to read in.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Read image data from an RI.  Partial dataset reading and subsampling is
+        allowed.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    If the stride parameter is set to NULL, a stride of 1 will be assumed.
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRreadimage(int32 riid,int32 start[2],int32 in_stride[2],int32 count[2],void * data)
+{
+    CONSTR(FUNC, "GRreadimage");   /* for HERROR */
+    int32 hdf_file_id;          /* HDF file ID */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    int32 stride[2];            /* pointer to the stride array */
+    intn solid_block=FALSE;     /* whether the image data is a solid block of data */
+    intn whole_image=FALSE;     /* whether we are reading in the whole image */
+    intn image_data=FALSE;      /* whether there is actual image data or not */
+    void * *img_data;           /* pointer to the converted image data to write */
+    uintn pixel_disk_size;      /* size of a pixel on disk */
+    uintn pixel_mem_size;       /* size of a pixel in memory */
+    intn convert;               /* true if machine NT != NT to be written */
+    uint8 platnumsubclass;      /* class of this NT for this platform */
+    uint16 scheme;  /* compression scheme used for JPEG images */
+    uint32     comp_config;
+    comp_coder_t comp_type; 
+    comp_info cinfo;
+    intn status=FAIL;
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the basic validity of the args (stride is OK to be NULL) */
+    if (HAatom_group(riid)!=RIIDGROUP || start==NULL /* || in_stride==NULL */ || count==NULL
+            || data==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* Get the correct parameters into the stride array */
+    if(in_stride==NULL)
+          stride[XDIM]=stride[YDIM]=1;
+    else
+      {
+          stride[XDIM]=in_stride[XDIM];
+          stride[YDIM]=in_stride[YDIM];
+      } /* end else */
+
+    /* Sanity check the start, stride, and count args */
+    if((start[XDIM]<0 || start[YDIM]<0) || (stride[XDIM]<1 || stride[YDIM]<1)
+            || (count[XDIM]<1 || count[YDIM]<1))
+        HGOTO_ERROR(DFE_BADDIM, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+    gr_ptr=ri_ptr->gr_ptr;
+    hdf_file_id=gr_ptr->hdf_file_id;
+
+    comp_type = COMP_CODE_NONE;
+    scheme = ri_ptr->img_dim.comp_tag;
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+    {
+	comp_type = COMP_CODE_JPEG;
+	cinfo.jpeg.quality = 0;
+	cinfo.jpeg.force_baseline = 0;
+    }
+    /* Catch old images to avoid going into HCPgetcompinfo */
+    else if (scheme == DFTAG_RLE) /* old image */
+        comp_type = COMP_CODE_RLE;
+    else if (scheme == DFTAG_IMC) /* old image */
+        comp_type = COMP_CODE_IMCOMP;
+    else
+    {
+	/* use lower-level routine to get the compression information */
+	status = HCPgetcompinfo(hdf_file_id, ri_ptr->img_tag, ri_ptr->img_ref,
+                        &comp_type, &cinfo);
+	if (status == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    }
+    if (comp_type != COMP_CODE_NONE &&
+	comp_type != COMP_CODE_RLE &&
+	comp_type != COMP_CODE_IMCOMP)
+    {   /* This is reading, why do we need encoder? -BMR */
+	/* Check that the compression encoder is available */
+	HCget_config_info(comp_type, &comp_config);
+	if ((comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED) == 0)
+	{ /* coder not present?? */
+	    HGOTO_ERROR(DFE_BADCODER,FAIL); 
+	}
+	if ((comp_config & COMP_DECODER_ENABLED) == 0)
+	{ /* decoder not present?? */
+	    HGOTO_ERROR(DFE_NOENCODER,FAIL); 
+	}
+    }
+    if(stride[XDIM]==1 && stride[YDIM]==1)
+    { /* solid block of data */
+	solid_block=TRUE;
+	if ((start[XDIM]==0 && start[YDIM]==0)
+	 && (count[XDIM]==ri_ptr->img_dim.xdim
+	  && count[YDIM]==ri_ptr->img_dim.ydim))
+	    whole_image=TRUE;
+	else
+	    whole_image=FALSE;
+      } /* end if */
+    else /* block of data spread out with strides */
+        solid_block=FALSE;
+
+    /* Get the size of the pixels in memory and on disk */
+    pixel_disk_size=(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+    pixel_mem_size=(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize((ri_ptr->img_dim.nt | DFNT_NATIVE) & (~DFNT_LITEND)));
+
+    /* Get number-type and conversion information */
+    platnumsubclass = (uint8)DFKgetPNSC(ri_ptr->img_dim.nt & (~DFNT_LITEND), DF_MT);
+    convert = (pixel_disk_size != pixel_mem_size) || (ri_ptr->img_dim.file_nt_subclass != platnumsubclass);  /* is conversion necessary? */
+
+    /* Check if the image data is in the file */
+    if(ri_ptr->img_tag==DFTAG_NULL || ri_ptr->img_ref==DFREF_WILDCARD)
+        image_data=FALSE;
+    else
+    {
+        /* Check if the actual image data is in the file yet, or if just the
+	   tag & ref are known */
+        if(Hlength(hdf_file_id,ri_ptr->img_tag,ri_ptr->img_ref)>0)
+            image_data=TRUE;
+        else
+            image_data=FALSE;
+    } /* end else */
+
+    if(image_data==FALSE)
+      { /* Fake an image for the user by using the pixel fill value */
+          void * fill_pixel;         /* converted value for the filled pixel */
+          int32 at_index;
+
+          if((fill_pixel=HDmalloc(pixel_mem_size))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+          /* Try to find a fill value attribute */
+          if((at_index=GRfindattr(riid,FILL_ATTR))!=FAIL)
+            { /* Found a fill value attribute */
+                if(GRgetattr(riid,at_index,fill_pixel)==FAIL)
+                    HGOTO_ERROR(DFE_BADATTR,FAIL);
+            } /* end if */
+          else /* no fill value attribute */
+              HDmemset(fill_pixel,0,pixel_mem_size);
+
+          /* Fill the user's buffer with the fill value */
+          HDmemfill(data,fill_pixel,pixel_mem_size,(uint32)(count[XDIM]*count[YDIM]));
+          HDfree(fill_pixel);
+      } /* end if */
+    else
+      { /* an image exists in the file */
+          if(convert)
+            {   /* convert image data to HDF disk format */
+                /* Allocate space for the conversion buffer */
+                if((img_data=HDmalloc(pixel_disk_size*(size_t)count[XDIM]*(size_t)count[YDIM]))==NULL)
+                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+            } /* end if */
+          else /* no conversion necessary, just use the user's buffer */
+              img_data=data;
+
+          if(GRIgetaid(ri_ptr, DFACC_READ)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+          if(whole_image==TRUE)
+            { /* read the whole image in */
+#ifdef OLD_WAY
+                if(Hgetelement(hdf_file_id,ri_ptr->img_tag,ri_ptr->img_ref,
+                        (uint8 *)img_data)==FAIL)
+                    HGOTO_ERROR(DFE_GETELEM,FAIL);
+#else /* OLD_WAY */
+            /* Make certain we are at the beginning */
+            if(Hseek(ri_ptr->img_aid,0,DF_START)==FAIL)
+                HGOTO_ERROR(DFE_SEEKERROR,FAIL);
+
+            /* Read the entire image in */
+
+      /* This offset is relative to the element not the file and this */
+      /* is where it reads and decompresses the data -BMR 09/2010 */
+            if(Hread(ri_ptr->img_aid,(int32)pixel_disk_size*count[XDIM]*count[YDIM],
+                    (uint8 *)img_data)==FAIL)
+                HGOTO_ERROR(DFE_READERROR,FAIL);
+#endif /* OLD_WAY */
+            } /* end if */
+          else
+            { /* read only part of the image in */
+                int32 img_offset; /* current offset in the image data */
+                void * tmp_data;   /* temp. pointer to the image data read in */
+
+                img_offset=((ri_ptr->img_dim.xdim*start[YDIM])+start[XDIM])*(int32)pixel_disk_size;
+
+                tmp_data=img_data;
+                if(solid_block==TRUE)
+                  {   /* read in runs of data in the image */
+                      int32 pix_len;    /* length of current row's pixel run */
+                      intn i;           /* temporary loop variable */
+
+                      pix_len=(int32)pixel_disk_size*count[XDIM];
+                        
+                      /* read in the block */
+                      for(i=0; i<count[YDIM]; i++)
+                        {
+                            if(Hseek(ri_ptr->img_aid,img_offset,DF_START)==FAIL)
+                                HGOTO_ERROR(DFE_SEEKERROR,FAIL);
+                            if(Hread(ri_ptr->img_aid,pix_len,tmp_data)==FAIL)
+                                HGOTO_ERROR(DFE_READERROR,FAIL);
+                            img_offset+=(int32)pixel_disk_size*ri_ptr->img_dim.xdim;
+                            tmp_data=(void *)((char *)tmp_data+pix_len);
+                        } /* end for */
+                  } /* end if */
+                else
+                  {   /* sub-sampling, seek to each data element and read it in */
+                      intn i,j;         /* temporary loop variables */
+                      int32 stride_add; /* amount to add for stride amount */
+
+                      stride_add=(int32)pixel_disk_size*stride[XDIM];
+
+                      for(i=0; i<count[YDIM]; i++)
+                        {
+                            int32 local_offset;
+
+                            local_offset=img_offset;
+                            for(j=0; j<count[XDIM]; j++)
+                              {
+                                if(Hseek(ri_ptr->img_aid,local_offset,DF_START)==FAIL)
+                                    HGOTO_ERROR(DFE_SEEKERROR,FAIL);
+                                if(Hread(ri_ptr->img_aid,(int32)pixel_disk_size,tmp_data)==FAIL)
+                                    HGOTO_ERROR(DFE_READERROR,FAIL);
+                                local_offset+=stride_add;
+                                tmp_data=(void *)((char *)tmp_data+pixel_disk_size);
+                              } /* end for */
+
+                            img_offset+=ri_ptr->img_dim.xdim*stride[YDIM]*(int32)pixel_disk_size;
+                        } /* end for */
+                  } /* end else */
+            } /* end else */
+                  
+          if(convert)
+            { /* convert the pixel data into the HDF disk format */
+              DFKconvert(img_data,data,ri_ptr->img_dim.nt,
+                  ri_ptr->img_dim.ncomps*count[XDIM]*count[YDIM],DFACC_READ,0,0);
+              HDfree(img_data);
+            } /* end if */
+      } /* end else */
+
+      /* Check whether we need to convert the buffer to the user's */
+      /*    requested interlace scheme. */
+      /* Note: This is implemented in a horribly ugly & slow manner, but I'm */
+      /*        in a bit of a hurry right now - QAK */
+      if(ri_ptr->im_il!=MFGR_INTERLACE_PIXEL)
+        {
+          void * pixel_buf;  /* buffer for the pixel interlaced data */
+
+          /* Allocate space for the conversion buffer */
+          if((pixel_buf=HDmalloc(pixel_mem_size*(size_t)count[XDIM]*(size_t)count[YDIM]))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+          GRIil_convert(data,MFGR_INTERLACE_PIXEL,pixel_buf,ri_ptr->im_il,
+              count,ri_ptr->img_dim.ncomps,ri_ptr->img_dim.nt);
+
+          HDmemcpy(data,pixel_buf,pixel_mem_size*(size_t)count[XDIM]*(size_t)count[YDIM]);
+
+          HDfree(pixel_buf);
+        } /* end if */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRreadimage() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRendaccess
+
+ PURPOSE
+    End access to an RI.
+
+ USAGE
+    intn GRendaccess(riid)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    End access to an RI.  Further attempts to access the RI ID will result in
+    an error.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRendaccess(int32 riid)
+{
+    CONSTR(FUNC, "GRendaccess");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    if(!(ri_ptr->access>0))
+        HGOTO_ERROR(DFE_CANTENDACCESS,FAIL);
+
+    /* Check for writing a fill value attribute out */
+    if(ri_ptr->store_fill==TRUE)
+      { /* store the fill value attribute before letting go of the image */
+          if(GRsetattr(riid,FILL_ATTR,ri_ptr->img_dim.nt,ri_ptr->img_dim.ncomps,ri_ptr->fill_value)==FAIL)
+              HGOTO_ERROR(DFE_WRITEERROR,FAIL);
+          ri_ptr->store_fill=FALSE;
+      } /* end if */
+
+    /* Reduce the number of accesses to the RI */
+    ri_ptr->access--;
+
+    /* Check if we should shut down the AID we've been holding open */
+    if(!(ri_ptr->access>0) && ri_ptr->img_aid!=0)
+      {
+        Hendaccess(ri_ptr->img_aid);
+        ri_ptr->img_aid=0;
+      } /* end if */
+
+    /* Double check on setting the GR modified flag */
+    /* Maybe this should be flagged as as error? -QAK */
+    if(ri_ptr->meta_modified==TRUE &&& ri_ptr->gr_ptr->gr_modified==FALSE)
+        ri_ptr->gr_ptr->gr_modified=TRUE;
+
+    /* Delete the atom for the RI ID */
+    if(NULL==HAremove_atom(riid))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRendaccess() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRidtoref
+
+ PURPOSE
+    Maps an RI ID to a reference # for annotating or including in a Vgroup.
+
+ USAGE
+    uint16 GRidtoref(riid)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+
+ RETURNS
+    A valid reference # on success or 0
+
+ DESCRIPTION
+    Maps an riid to a reference # for annotating or including in a Vgroup.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+uint16 GRidtoref(int32 riid)
+{
+    CONSTR(FUNC, "GRidtoref");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    uint16  ret_value = 0; /* FAIL? */
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, 0);
+    
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, 0);
+
+#ifdef OLD_WAY
+    ret_value = (ri_ptr->ri_ref!=DFREF_WILDCARD ? ri_ptr->ri_ref : ri_ptr->rig_ref);
+#else /* OLD_WAY */
+/* Changed to handle case when ri_ptr->rig_ref is DFREF_WILDCARD */
+    if(ri_ptr->ri_ref!=DFREF_WILDCARD)
+        ret_value=ri_ptr->ri_ref;
+    else
+      {
+        if(ri_ptr->rig_ref==DFREF_WILDCARD) {
+            if(ri_ptr->img_ref==DFREF_WILDCARD)
+                HGOTO_ERROR(DFE_INTERNAL,0);
+            ret_value=ri_ptr->img_ref;
+        }
+        else
+            ret_value=ri_ptr->rig_ref;
+      } /* end else */
+#endif /* OLD_WAY */
+
+done:
+  if(ret_value == 0)   /* 0 is invalid ref */
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRidtoref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRreftoindex
+
+ PURPOSE
+    Maps the reference # of an RI into an index which can be used with GRselect.
+
+ USAGE
+    int32 GRreftoindex(grid,ref)
+        int32 grid;         IN: GR ID from GRstart
+        uint16 ref;         IN: reference number of raster image to map to index
+
+ RETURNS
+    A valid index # on success or FAIL
+
+ DESCRIPTION
+    Maps the reference # of an RI into an index which can be used with GRselect.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 GRreftoindex(int32 grid,uint16 ref)
+{
+    CONSTR(FUNC, "GRreftoindex");   /* for HERROR */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    void * *t;                   /* temp. ptr to the image found */
+    int32   ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(grid)!=GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate GR's object in hash table */
+    if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(grid)))
+        HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+    if((t = (void **)tbbtfirst((TBBT_NODE *) *(gr_ptr->grtree)))==NULL)
+        HGOTO_ERROR(DFE_RINOTFOUND,FAIL);
+    do {
+        ri_ptr=(ri_info_t *)*t;
+        if(ri_ptr!=NULL && ((ri_ptr->ri_ref==ref) || (ri_ptr->ri_ref==DFREF_WILDCARD && ri_ptr->rig_ref==ref)))  /* the ref matches */
+            HGOTO_DONE(ri_ptr->index);
+    } while((t= (void **)tbbtnext((TBBT_NODE *)t))!=NULL);
+
+    ret_value = (FAIL);
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRreftoindex() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRreqlutil
+
+ PURPOSE
+    Request that the next LUT read from an RI have a particular interlace.
+
+ USAGE
+    intn GRreqlutil(riid,il)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        intn il;            IN: interlace for next LUT.  From the following
+                                values (found in mfgr.h): 
+                      MFGR_INTERLACE_PIXEL      - pixel interlacing
+                      MFGR_INTERLACE_LINE       - line interlacing
+                      MFGR_INTERLACE_COMPONENT  - component/plane interlacing
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Request that the next LUT read from an RI have a particular interlace.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRreqlutil(int32 riid,intn il)
+{
+    CONSTR(FUNC, "GRreqlutil");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP || il<(intn)MFGR_INTERLACE_PIXEL ||
+            il>(intn)MFGR_INTERLACE_COMPONENT)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* Assign interlacing scheme */
+    ri_ptr->lut_il=(gr_interlace_t)il;   
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRreqlutil() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRreqimageil
+
+ PURPOSE
+    Request that the image read from an RI have a particular interlace.
+
+ USAGE
+    intn GRreqimageil(riid,il)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        intn il;            IN: interlace for next RI.  From the following
+                                values (found in mfgr.h): 
+                      MFGR_INTERLACE_PIXEL      - pixel interlacing
+                      MFGR_INTERLACE_LINE       - line interlacing
+                      MFGR_INTERLACE_COMPONENT  - component/plane interlacing
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Request that the image read from an RI have a particular interlace.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRreqimageil(int32 riid,intn il)
+{
+    CONSTR(FUNC, "GRreqimageil");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP || il<(intn)MFGR_INTERLACE_PIXEL ||
+            il>(intn)MFGR_INTERLACE_COMPONENT)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* Assign interlacing scheme */
+    ri_ptr->im_il=(gr_interlace_t)il;   
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRreqimageil() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetlutid
+
+ PURPOSE
+    Get a LUT id ('lutid') for an RI.
+
+ USAGE
+    int32 GRgetlutid(riid,index)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        int32 lut_index;    IN: Which LUT image to select (indexed from 0)
+
+ RETURNS
+    Valid LUT ID on success, FAIL on failure
+
+ DESCRIPTION
+    Get a LUT id ('lutid') for accessing LUTs in an RI.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Currently only supports one LUT per image, at index 0 and LUTID==RIID.
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 GRgetlutid(int32 riid,int32 lut_index)
+{
+    CONSTR(FUNC, "GRgetlutid");   /* for HERROR */
+    int32  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP || lut_index!=0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    ret_value =(riid);
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRgetlutid() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRluttoref
+
+ PURPOSE
+    Returns the ref # for a LUT.
+
+ USAGE
+    uint16 GRluttoref(lutid)
+        int32 lutid;        IN: LUT ID from GRgetlutid
+
+ RETURNS
+    Valid ref # if a palette exists, or 0 when:
+  - palette doesn't exist, or
+  - unable to get the image from the palette id. - BMR
+
+ DESCRIPTION
+    Gets the ref # used to store the LUT in the file.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+uint16 GRluttoref(int32 lutid)
+{
+    CONSTR(FUNC, "GRluttoref");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    uint16 ret_value = 0;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(lutid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, 0);  /* return 0 for invalid ref # - BMR */
+    
+    /* locate LUT's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(lutid)))
+        HGOTO_ERROR(DFE_LUTNOTFOUND, 0); /* return 0 for invalid ref # - BMR */
+
+    ret_value=ri_ptr->lut_ref;
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRluttoref() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetlutinfo
+
+ PURPOSE
+    Gets information about a LUT.
+
+ USAGE
+    intn GRgetlutinfo(lutid,ncomp,nt,il,nentries)
+        int32 lutid;        IN: LUT ID from GRgetlutid
+        int32 *ncomp;       OUT: number of components in LUT
+        int32 *nt;          OUT: number type of components
+        int32 *il;          OUT: interlace of the LUT
+        int32 *nentries;    OUT: the number of entries for the LUT
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Gets information about a LUT.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRgetlutinfo(int32 lutid,int32 *ncomp,int32 *nt,int32 *il,int32 *nentries)
+{
+    CONSTR(FUNC, "GRgetlutinfo");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(lutid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate LUT's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(lutid)))
+        HGOTO_ERROR(DFE_LUTNOTFOUND, FAIL);
+
+    if(ri_ptr->lut_ref==DFREF_WILDCARD) { /* check for no palette defined currently */
+        if(ncomp!=NULL)
+            *ncomp=0;
+        if(nt!=NULL)
+            *nt=DFNT_NONE;
+        if(il!=NULL)
+            *il=-1;
+        if(nentries!=NULL)
+            *nentries=0;
+    } /* end if */
+    else        /* we've got a valid palette currently */
+      {
+          if(ncomp!=NULL)
+              *ncomp=ri_ptr->lut_dim.ncomps;
+          if(nt!=NULL)
+              *nt=ri_ptr->lut_dim.nt;
+          if(il!=NULL)
+              *il=(int32)ri_ptr->lut_dim.il;
+          if(nentries!=NULL)  /* xdim for LUTs is the number of entries */
+              *nentries=ri_ptr->lut_dim.xdim;
+      } /* end else */
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return ret_value;
+} /* end GRgetlutinfo() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRwritelut
+
+ PURPOSE
+    Writes out a LUT for an RI.
+
+ USAGE
+    intn GRwritelut(riid,ncomps,nt,il,nentries,data)
+        int32 lutid;        IN: LUT ID from GRgetlutid
+        int32 ncomp;        IN: number of components in LUT
+        int32 nt;           IN: number type of components
+        int32 il;           IN: interlace of the LUT
+        int32 nentries;     IN: the number of entries for the LUT
+        void * data;         IN: LUT data to write out
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Writes out a LUT for an RI.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRwritelut(int32 lutid,int32 ncomps,int32 nt,int32 il,int32 nentries,void * data)
+{
+    CONSTR(FUNC, "GRwritelut");   /* for HERROR */
+    int32 hdf_file_id;          /* file ID from Hopen */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the args (how to check il?) */
+    if (HAatom_group(lutid)!=RIIDGROUP || ncomps<1 || (DFKNTsize(nt)==FAIL)
+            || nentries<1 || data==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate LUT's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(lutid)))
+        HGOTO_ERROR(DFE_LUTNOTFOUND, FAIL);
+    hdf_file_id=ri_ptr->gr_ptr->hdf_file_id;
+
+    /* Check if this is compatible with older-style palettes */
+    if(ncomps==3 && (nt==DFNT_UINT8 ||nt==DFNT_UCHAR8) && 
+        il==MFGR_INTERLACE_PIXEL && nentries==256)
+      {
+          /* Check if LUT exists already */
+          if(ri_ptr->lut_tag!=DFTAG_NULL && ri_ptr->lut_ref!=DFREF_WILDCARD)
+            {   /* LUT already exists */
+                if(Hputelement(hdf_file_id,ri_ptr->lut_tag,ri_ptr->lut_ref,
+                        data,ncomps*nentries*DFKNTsize(nt))==FAIL)
+                    HGOTO_ERROR(DFE_PUTELEM,FAIL);
+            } /* end if */
+          else
+            {   /* LUT does not exist */
+                ri_ptr->lut_tag=DFTAG_LUT;
+                ri_ptr->lut_ref=Htagnewref(hdf_file_id,ri_ptr->lut_tag);
+                ri_ptr->lut_dim.dim_ref=DFREF_WILDCARD;
+                ri_ptr->lut_dim.xdim=256;
+                ri_ptr->lut_dim.ydim=1;
+                ri_ptr->lut_dim.ncomps=3;
+                ri_ptr->lut_dim.nt=DFNT_UINT8;
+                ri_ptr->lut_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
+                ri_ptr->lut_dim.il=MFGR_INTERLACE_PIXEL;
+                ri_ptr->lut_dim.nt_tag=DFTAG_NULL;
+                ri_ptr->lut_dim.nt_ref=DFREF_WILDCARD;
+                ri_ptr->lut_dim.comp_tag=DFTAG_NULL;
+                ri_ptr->lut_dim.comp_ref=DFREF_WILDCARD;
+                if(Hputelement(hdf_file_id,ri_ptr->lut_tag,ri_ptr->lut_ref,
+                        data,ncomps*nentries*DFKNTsize(nt))==FAIL)
+                    HGOTO_ERROR(DFE_PUTELEM,FAIL);
+
+                ri_ptr->meta_modified=TRUE;
+                ri_ptr->gr_ptr->gr_modified=TRUE;
+            } /* end else */
+      } /* end if */
+    else
+      {     /* currently, we are not going to support non-standard palettes */
+          HGOTO_ERROR(DFE_UNSUPPORTED,FAIL);
+      } /* end else */
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRwritelut() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRreadlut
+
+ PURPOSE
+    Reads a LUT from an RI.
+
+ USAGE
+    intn GRreadlut(lutid,data)
+        int32 lutid;        IN: LUT ID from GRgetlutid
+        void * data;         IN: buffer for LUT data read in
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Reads a LUT from an RI.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRreadlut(int32 lutid,void * data)
+{
+    CONSTR(FUNC, "GRreadlut");   /* for HERROR */
+    int32 hdf_file_id;          /* file ID from Hopen */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(lutid)!=RIIDGROUP || data==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate LUT's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(lutid)))
+        HGOTO_ERROR(DFE_LUTNOTFOUND, FAIL);
+    hdf_file_id=ri_ptr->gr_ptr->hdf_file_id;
+
+    if(ri_ptr->lut_tag!=DFTAG_NULL && ri_ptr->lut_ref!=DFREF_WILDCARD)
+      {
+          if(Hgetelement(hdf_file_id,ri_ptr->lut_tag,ri_ptr->lut_ref,data)==FAIL)
+              HGOTO_ERROR(DFE_GETELEM,FAIL);
+      } /* end if */
+    
+    /* Re-format the palette into the user's requested interlacing */
+    if(ri_ptr->lut_il!=MFGR_INTERLACE_PIXEL)
+      {
+          uintn pixel_mem_size;       /* size of a pixel in memory */
+          void * pixel_buf;  /* buffer for the pixel interlaced data */
+          int32 count[2];   /* "dimension" info */
+
+          pixel_mem_size=(uintn)(ri_ptr->lut_dim.ncomps*DFKNTsize((ri_ptr->lut_dim.nt | DFNT_NATIVE) & (~DFNT_LITEND)));
+
+          /* Allocate space for the conversion buffer */
+          if((pixel_buf=HDmalloc(pixel_mem_size*(size_t)ri_ptr->lut_dim.xdim))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+          count[XDIM]=1;
+          count[YDIM]=ri_ptr->lut_dim.xdim;
+          GRIil_convert(data,MFGR_INTERLACE_PIXEL,pixel_buf,ri_ptr->lut_il,
+              count,ri_ptr->lut_dim.ncomps,ri_ptr->lut_dim.nt);
+
+          HDmemcpy(data,pixel_buf,pixel_mem_size*(size_t)ri_ptr->lut_dim.xdim);
+
+          HDfree(pixel_buf);
+      } /* end if */
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRreadlut() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRsetexternalfile
+
+ PURPOSE
+    Makes the image data of an RI into an external element special element.
+
+ USAGE
+    intn GRsetexternalfile(riid,filename,offset)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        char *filename;     IN: name of the external file
+        int32 offset;       IN: offset in the external file to store the image
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Makes the image data of an RI into an external element special element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRsetexternalfile(int32 riid,const char *filename,int32 offset)
+{
+    CONSTR(FUNC, "GRsetexternalfile");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    int32 tmp_aid;  /* AID returned from HXcreate() */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    if((ri_ptr->ext_name=(char *)HDmalloc(HDstrlen(filename)+1))==NULL)
+        HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+    /* Mark the image as external and cache parameters */
+    ri_ptr->ext_img=TRUE;
+    HDstrcpy(ri_ptr->ext_name,filename);
+    ri_ptr->ext_offset=offset;
+
+    /* Create the image tag/ref if it's a new image */
+    if(ri_ptr->img_tag==DFTAG_NULL || ri_ptr->img_ref==DFREF_WILDCARD)
+      {
+        ri_ptr->img_tag=DFTAG_RI;
+        ri_ptr->img_ref=Htagnewref(ri_ptr->gr_ptr->hdf_file_id,ri_ptr->img_tag);
+        ri_ptr->meta_modified=TRUE;
+      } /* end if */
+
+    /* close any existing AID, to convert to external element AID */
+    if(ri_ptr->img_aid!=0)
+      {
+        Hendaccess(ri_ptr->img_aid);
+        ri_ptr->img_aid=0;
+      } /* end if */
+
+    /* Convert the image into an external element */
+    if((tmp_aid=HXcreate(ri_ptr->gr_ptr->hdf_file_id,ri_ptr->img_tag,
+            ri_ptr->img_ref,filename,offset,0))==FAIL)
+        HGOTO_ERROR(DFE_BADAID, FAIL);
+    if(Hendaccess(tmp_aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRsetexternalfile() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRsetaccesstype
+
+ PURPOSE
+    Sets the access for an RI to be either serial or parallel I/O.
+
+ USAGE
+    intn GRsetaccesstype(riid,accesstype)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        uintn accesstype;   IN: access type for image data, from the following
+           values:
+        DFACC_SERIAL - for serial access
+        DFACC_PARALLEL - for parallel access
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Sets the access for an RI to be either serial or parallel I/O.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRsetaccesstype(int32 riid,uintn accesstype)
+{
+    CONSTR(FUNC, "GRsetaccesstype");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP || (accesstype!=DFACC_DEFAULT && accesstype!=DFACC_SERIAL
+            && accesstype!=DFACC_PARALLEL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* Mark the image as having an access-mode and cache args */
+    ri_ptr->acc_img=TRUE;
+    ri_ptr->acc_type=accesstype;
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRsetaccesstype() */
+
+
+#ifdef H4_HAVE_LIBSZ          /* we have the library */
+/*--------------------------------------------------------------------------
+ NAME
+    GRsetup_szip_parms( ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims)
+
+ PURPOSE
+    Set up the szip parameters
+
+ USAGE
+    intn GRsetaccesstype( ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims)
+    ri_info_t *ri_ptr;  IN: the RI object 
+    comp_info *c_info;  IN/OUT: the compression info (szip) 
+    int32 *cdims;       IN: chunk dims if chunked, else NULL
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Sets the computed szip parameters before calling HCcreate.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+GRsetup_szip_parms( ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims)
+{
+    int32 nt;
+    int32 ndims;
+    int32 ncomp;
+    int32 xdims[H4_MAX_VAR_DIMS];
+    intn  ret_value = SUCCEED;
+    
+    
+    ndims = 2;
+    xdims[0] = ri_ptr->img_dim.xdim;
+    xdims[1] = ri_ptr->img_dim.ydim;
+    
+    nt = ri_ptr->img_dim.nt;
+    ncomp = ri_ptr->img_dim.ncomps;
+    
+    ret_value = HCPsetup_szip_parms( c_info, nt, ncomp, ndims, xdims, cdims);
+    
+done:
+    return(ret_value);
+}
+#endif
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRsetcompress
+
+ PURPOSE
+    Compressed the image data of an RI.
+
+ USAGE
+    intn GRsetcompress(riid,comp_type,cinfo)
+        int32 riid;             IN: RI ID from GRselect/GRcreate
+        comp_coder_t comp_type; IN: type of compression
+        comp_info *cinfo;       IN: compression specific information
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Compressed the image data of an RI.
+    (Makes the image data of an RI into a compressed special element)
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRsetcompress(int32 riid,comp_coder_t comp_type,comp_info *cinfo)
+{
+    CONSTR(FUNC, "GRsetcompress");   /* for HERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    comp_info cinfo_x;
+    uint32 comp_config;
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    HDmemcpy(&cinfo_x,cinfo,sizeof(comp_info));
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    /* Check the validity of the compression type */
+    if ((comp_type < COMP_CODE_NONE || comp_type >= COMP_CODE_INVALID) 
+  && comp_type!=COMP_CODE_JPEG)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* Check if the image is already special (all special elements use the buffered driver) */
+    if (ri_ptr->use_buf_drvr)
+        HGOTO_ERROR(DFE_CANTMOD, FAIL);
+
+    /* Check that the compression method is enabled */
+    HCget_config_info(comp_type, &comp_config);
+    if ((comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED) == 0) {
+  /* coder not present?? */
+      HGOTO_ERROR(DFE_BADCODER, FAIL);
+    }
+    if ((comp_config & COMP_ENCODER_ENABLED) != COMP_ENCODER_ENABLED) {
+     /* if ((comp_config & COMP_ENCODER_ENABLED) == 0) {
+ */ 
+  /* encoder not present?? */
+      HGOTO_ERROR(DFE_NOENCODER, FAIL);
+    }
+
+    if (comp_type==COMP_CODE_SZIP) 
+#ifndef H4_HAVE_LIBSZ
+        HGOTO_ERROR(DFE_NOSZLIB, FAIL);
+#else
+    {
+    /* szip is enabled, check and set up szip parms */
+  if (GRsetup_szip_parms( ri_ptr, &cinfo_x, NULL) == FAIL) {
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+  }
+    }
+#endif
+
+    /* Mark the image as being compressed and cache args */
+    if(comp_type==COMP_CODE_JPEG)
+      {
+        if(ri_ptr->img_dim.ncomps==1)
+            ri_ptr->img_dim.comp_tag=DFTAG_GREYJPEG5;
+        else if(ri_ptr->img_dim.ncomps==3)
+            ri_ptr->img_dim.comp_tag=DFTAG_JPEG5;
+        else
+            HGOTO_ERROR(DFE_CANTMOD, FAIL);
+        ri_ptr->use_cr_drvr=TRUE;
+      } /* end if */
+    else
+      {
+        ri_ptr->comp_img=TRUE;
+        ri_ptr->comp_type=comp_type;
+      } /* end else */
+
+    /* Todo: Application may send in COMP_CODE_NONE -BMR 9/2010 */
+
+    /* Store compression parameters */
+    HDmemcpy(&(ri_ptr->cinfo),&cinfo_x,sizeof(comp_info));
+
+    /* Mark the image as needing to be a buffered special element */
+    ri_ptr->use_buf_drvr=1;
+
+    /* Make certain the image gets created */
+    if(GRIgetaid(ri_ptr, DFACC_WRITE)==FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRsetcompress() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetcompress
+
+ PURPOSE
+    Get the compression information of a raster image's data.
+
+ USAGE
+    intn GRgetcompress(riid,comp_type,cinfo)
+        int32 riid;       IN: RI ID from GRselect/GRcreate
+        comp_coder_t* comp_type;   OUT: type of compression
+        comp_info* cinfo;     OUT: retrieved compression information
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    This routine gets the compression type of the given RI's data, then
+    retrieves the appropriate information into the provided compression
+    info structure.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    JPEG information is currently not retrievable because the JPEG 
+    parameters, 'quality' and 'force_baseline', are irreversibly 
+    mapped to a quantization table.  Thus, only the correct compression 
+    type will be returned; cinfo will only contain 0s.
+
+ EXAMPLES
+ REVISION LOG
+    July 2001: Added to fix bug #307 -BMR
+    Apr 2005: Replaced by GRgetcompinfo due to deficiency in handling some
+		special elements. -BMR
+--------------------------------------------------------------------------*/
+intn GRgetcompress(int32 riid, comp_coder_t* comp_type, comp_info* cinfo)
+{
+    CONSTR(FUNC, "GRgetcompress");   /* for HGOTO_ERROR */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    int32 file_id;
+    uint16 scheme;  /* compression scheme used for JPEG images */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid) != RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* and check the output arguments */
+    if (comp_type == NULL || cinfo == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    file_id = ri_ptr->gr_ptr->hdf_file_id;  /* temporary use */
+
+    /* If the compression scheme used was JPEG, return the compression type
+       and 0 for the 'quality' and 'force_baseline' parameters, because 
+       these parameters are currently not possible to be retrieved. */
+    scheme = ri_ptr->img_dim.comp_tag;
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+    {
+	*comp_type = COMP_CODE_JPEG;
+	cinfo->jpeg.quality = 0;
+	cinfo->jpeg.force_baseline = 0;
+    }
+    else
+    {
+	/* use lower-level routine to get the compression information */
+	ret_value = HCPgetcompress(file_id, ri_ptr->img_tag, ri_ptr->img_ref,
+                                comp_type, cinfo);
+	if (ret_value == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+done:
+  if(ret_value == 0)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRgetcompress() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetcomptype
+
+ PURPOSE
+    Get the compression type of a raster image's data.
+
+ USAGE
+    intn GRgetcomptype(riid, comp_type)
+        int32 riid;     IN: RI ID from GRselect/GRcreate
+        comp_coder_t* comp_type;  OUT: type of compression, including obsolete ones
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Historical note:
+    This function (old name grgetcomptype) was implemented specifically
+    for the hmap project.  It gets the compression type of the given
+    RI's data.  The existing function GRgetcompinfo did not detect the
+    obsolete compression scheme IMCOMP.  Because the hmap writer needs
+    to report when an image with IMCOMP exists in the file, it needs a
+    way to detect such images.  One option is to add COMP_CODE_IMCOMP
+    to the enum type comp_coder_t.  However, with the consideration of
+    backward/forward compatibility, it would be risky to change the
+    existing public type comp_coder_t while running against deadlines.
+    Instead, it was decided that a function would be made for the hmap
+    project only, and would not be published in the HDF4 documentation.
+    The function, grgetcomptype, will return comp_type as COMP_IMCOMP
+    or one of the values included in the type comp_coder_t.  Mar 11, 2011 -BMR
+
+    Update:
+    Further investigation indicated that it is safe to add COMP_CODE_IMCOMP
+    to comp_coder_t, with the value of 12 (as DFTAG_IMC/DFTAG_IMCOMP), which
+    is after COMP_CODE_JPEG.  Extra care had been taken to ensure that GR
+    interface cannot create or write images using IMCOMP compression.
+    grgetcomptype is now changed to GRgetcomptype and published in
+    release 4.2.8.  Jul 11, 2012 -BMR
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    At this time, hdp and other tools still use GRgetcompinfo.  We need to
+    discuss about how to handle its limitation.  In addition, GR2bmapped is
+    using grgetcomptype until we have an official GRgetcomptype or will change
+    to use GRgetcompinfo if we decide not to have GRgetcomptype.  The fact that
+    grgetcomptype uses int32 for comp_type makes it not a good long term option
+    due to inconsistency in the library.  Mar 11, 2011 -BMR
+
+    Update:
+    GRgetcomptype is now used in place of grgetcomptype and in hdp to detect
+    and report IMCOMP compression, in release 4.2.8.  Jul 11, 2012 -BMR
+
+ EXAMPLES
+ REVISION LOG
+
+--------------------------------------------------------------------------*/
+intn GRgetcomptype(int32 riid, comp_coder_t* comp_type)
+{
+    CONSTR(FUNC, "GRgetcomptype");  /* for HGOTO_ERROR */
+    ri_info_t *ri_ptr;            /* ptr to the image to work with */
+    int32 file_id;
+    uint16 scheme;  /* compression scheme used for old images */
+    intn  ret_value = SUCCEED;
+
+    /* clear error */
+    HEclear();
+
+    /* Validate the RI ID */
+    if (HAatom_group(riid) != RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check the output argument */
+    if (comp_type == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    file_id = ri_ptr->gr_ptr->hdf_file_id;  /* temporary use */
+
+    /* Handle old compression schemes separately */
+    scheme = ri_ptr->img_dim.comp_tag;
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+    {
+        *comp_type = COMP_CODE_JPEG;
+    }
+    else if (scheme == DFTAG_RLE)
+        *comp_type = COMP_CODE_RLE;
+    else if (scheme == DFTAG_IMC || scheme == DFTAG_IMCOMP)
+        *comp_type = COMP_CODE_IMCOMP;
+
+    /* Use lower-level routine to get the new compression type */
+    else
+    {
+        comp_coder_t temp_comp_type = COMP_CODE_INVALID;
+        ret_value = HCPgetcomptype(file_id, ri_ptr->img_tag, ri_ptr->img_ref,
+                                &temp_comp_type);
+        if (ret_value == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+        *comp_type = temp_comp_type;
+    }
+done:
+  if(ret_value == 0)
+    { /* Error condition cleanup */
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRgetcomptype() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetcompinfo
+
+ PURPOSE
+    Get the compression information of a raster image's data.
+
+ USAGE
+    intn GRgetcompinfo(riid,comp_type,cinfo)
+        int32 riid;       IN: RI ID from GRselect/GRcreate
+        comp_coder_t* comp_type;   OUT: type of compression
+        comp_info* cinfo;     OUT: retrieved compression information
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    This routine gets the compression type of the given RI's data, then
+    retrieves the appropriate information into the provided compression
+    info structure.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    JPEG information is currently not retrievable because the JPEG 
+    parameters, 'quality' and 'force_baseline', are irreversibly 
+    mapped to a quantization table.  Thus, only the correct compression 
+    type will be returned; cinfo will only contain 0s.
+
+ EXAMPLES
+ REVISION LOG
+    July 2001: Added to fix bug #307 - BMR (from GRgetcompress)
+    Apr 2005:  This function was actually created at this time, but it is
+               almost a duplicate of GRgetcompress, which is intended to be
+               removed in the future, due to its incorrect behavior.  The
+               only difference is the call to the low-level routine,
+               HCPgetcompinfo, instead of HCPgetcompress.
+
+--------------------------------------------------------------------------*/
+intn GRgetcompinfo(int32 riid, comp_coder_t* comp_type, comp_info* cinfo)
+{
+    CONSTR(FUNC, "GRgetcompinfo");  /* for HGOTO_ERROR */
+    ri_info_t *ri_ptr;            /* ptr to the image to work with */
+    int32 file_id;
+    uint16 scheme;  /* compression scheme used for JPEG images */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid) != RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* and check the output arguments */
+    if (comp_type == NULL || cinfo == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    file_id = ri_ptr->gr_ptr->hdf_file_id;  /* temporary use */
+
+    /* If the compression scheme used was JPEG, return the compression type
+       and 0 for the 'quality' and 'force_baseline' parameters, because 
+       these parameters are currently not possible to be retrieved. */
+    scheme = ri_ptr->img_dim.comp_tag;
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+    {
+	*comp_type = COMP_CODE_JPEG;
+	cinfo->jpeg.quality = 0;
+	cinfo->jpeg.force_baseline = 0;
+    }
+    /* Catch old images to avoid going into HCPgetcompinfo */
+    else if (scheme == DFTAG_RLE) /* old image */
+	*comp_type = COMP_CODE_RLE;
+    else if (scheme == DFTAG_IMC) /* old image */
+        *comp_type = COMP_CODE_IMCOMP;
+    else
+    {
+	/* use lower-level routine to get the compression information */
+	ret_value = HCPgetcompinfo(file_id, ri_ptr->img_tag, ri_ptr->img_ref,
+                                comp_type, cinfo);
+	if (ret_value == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+done:
+  if(ret_value == 0)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRgetcompinfo() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRsetattr
+
+ PURPOSE
+    Write an attribute for an object.
+
+ USAGE
+    intn GRsetattr(dimid|riid|grid,name,attr_nt,count,data)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        char *name;             IN: name of attribute
+        int32 attr_nt;          IN: number-type of attribute
+        int32 count;            IN: number of entries of the attribute
+        void * data;             IN: attribute data to write
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Write an attribute for an object (function will figure out ID type).
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Currently does not allow changing NT of an existing attribute.
+
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRsetattr(int32 id,const char *name,int32 attr_nt,int32 count,const void * data)
+{
+    CONSTR(FUNC, "GRsetattr");   /* for HERROR */
+    int32 hdf_file_id;          /* HDF file ID from Hopen */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr=NULL;     /* ptr to the image to work with */
+    void * *t;                   /* temp. ptr to the image found */
+    TBBT_TREE *search_tree;     /* attribute tree to search through */
+    at_info_t *at_ptr=NULL;     /* ptr to the attribute to work with */
+    int32 at_size;              /* size in bytes of the attribute data */
+    int32 *update_count;        /* pointer to the count of attributes in a tree */
+    uintn *update_flag;         /* pointer to the flag to indicate an attribute tree is changed */
+    uintn found=FALSE;          /* boolean for indicating the attribute exists already */
+    intn is_riid=FALSE;         /* whether we had a RIID */
+    intn ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* Make sure that count is less than MAX_ORDER(Vdata)
+           and total size is less than MAX_FIELD_SIZE(Vdata) */
+    if ((count > MAX_ORDER) ||
+        ((count * DFKNTsize(attr_nt)) > MAX_FIELD_SIZE))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check the validity of the args */
+    if ((HAatom_group(id)!=RIIDGROUP && HAatom_group(id)!=GRIDGROUP) || data==NULL || name==NULL
+            || count<=0 || DFKNTsize(attr_nt)==FAIL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    if (HAatom_group(id)==GRIDGROUP)
+      {
+          /* locate GR's object in hash table */
+          if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+          hdf_file_id=gr_ptr->hdf_file_id;
+          search_tree=gr_ptr->gattree;
+          update_flag=&(gr_ptr->gattr_modified);
+          update_count=&(gr_ptr->gattr_count);
+      } /* end if */
+    else if (HAatom_group(id)==RIIDGROUP)
+      {
+          /* Need this flag for later */
+          is_riid=TRUE;
+
+          /* locate RI's object in hash table */
+          if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+          gr_ptr=ri_ptr->gr_ptr;
+
+          hdf_file_id=gr_ptr->hdf_file_id;
+          search_tree=ri_ptr->lattree;
+          update_flag=&(ri_ptr->attr_modified);
+          update_count=&(ri_ptr->lattr_count);
+      } /* end if */
+    else    /* shouldn't get here, but what the heck... */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Search for an attribute with the same name */
+    if((t = (void **)tbbtfirst((TBBT_NODE *)*search_tree))!=NULL)
+      {
+          do {
+              at_ptr=(at_info_t *)*t;
+              if(at_ptr!=NULL && HDstrcmp(at_ptr->name,name)==0)  /* ie. the name matches */
+                {
+                    found=TRUE;
+                    break;
+                } /* end if */
+          } while((t= (void **)tbbtnext((TBBT_NODE *)t))!=NULL);
+      } /* end if */
+
+    if(found==TRUE) /* attribute already exists, just update it */
+      {
+          int32 new_at_size;          /* size in bytes of the new attribute data */
+
+          /* Catch the user if he tries to change the NT */
+          if(attr_nt!=at_ptr->nt)
+              HGOTO_ERROR(DFE_ARGS, FAIL);
+
+          /* Calc. old & new attr. sizes */
+          new_at_size=count*DFKNTsize((attr_nt | DFNT_NATIVE) & (~DFNT_LITEND));
+          at_size=at_ptr->len*DFKNTsize((at_ptr->nt | DFNT_NATIVE) & (~DFNT_LITEND));
+
+          if((uint32)new_at_size>gr_ptr->attr_cache)    /* check if data is cacheable */
+            {   /* not cacheable, write directly out to disk and throw away old in-memory copy */
+                int32 AttrID;       /* attribute Vdata id */
+
+                /* Update data on disk */
+                if((AttrID=VSattach(hdf_file_id,(int32)at_ptr->ref,"w"))==FAIL)
+                    HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+                if(VSsetfields(AttrID,at_ptr->name)==FAIL)
+                  {
+                    VSdetach(AttrID);
+                    HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+                  } /* end if */
+                if(VSwrite(AttrID,data,count,FULL_INTERLACE)==FAIL)
+                  {
+                    VSdetach(AttrID);
+                    HGOTO_ERROR(DFE_VSWRITE,FAIL);
+                  } /* end if */
+                if(VSdetach(AttrID)==FAIL)
+                    HGOTO_ERROR(DFE_CANTDETACH,FAIL);
+
+                /* Update in-memory fields */
+                at_ptr->len=count;
+                at_ptr->data_modified=FALSE;
+
+                /* Toss the old data, it's not valid and it's un-cacheable now */
+                if(at_ptr->data!=NULL)
+                    HDfreenclear(at_ptr->data);
+            }  /* end if */
+          else
+            {
+                /* check if we need a bigger buffer */
+                if(new_at_size>at_size || at_ptr->data==NULL)
+                  {
+                      if(at_ptr->data!=NULL)
+                          HDfree(at_ptr->data);
+                      if((at_ptr->data=HDmalloc(new_at_size))==NULL)
+                          HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                  } /* end if */
+                HDmemcpy(at_ptr->data,data,new_at_size);
+
+                /* Update in-memory fields */
+                at_ptr->len=count;
+                at_ptr->data_modified=TRUE;
+                *update_flag=TRUE;  /* flag the tree as changed */
+            } /* end else */
+      } /* end if */
+    else    /* a new attribute */
+      {
+        if((at_ptr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+        /* Fill in fields for the new attribute */
+        at_ptr->index=*update_count;  /* get the index and update the tree's count */
+        at_ptr->nt=attr_nt;
+        at_ptr->len=count;
+
+        /* allocate space for the attribute name & copy it */
+        if((at_ptr->name=(char *)HDmalloc(HDstrlen(name)+1))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+        HDstrcpy(at_ptr->name,name);
+
+        /* calc. the attr size to see if it is worth caching */
+        at_size=at_ptr->len*DFKNTsize((at_ptr->nt | DFNT_NATIVE) & (~DFNT_LITEND));
+        if((uint32)at_size<gr_ptr->attr_cache)
+          { /* cacheable */
+              /* allocate space for the attribute name & copy it */
+              if((at_ptr->data=(char *)HDmalloc(at_size))==NULL)
+                  HGOTO_ERROR(DFE_NOSPACE,FAIL);
+              HDmemcpy(at_ptr->data,data,at_size);
+              at_ptr->data_modified=TRUE;
+              at_ptr->ref=DFREF_WILDCARD;
+          } /* end if */
+        else
+          { /* non-cacheable */
+              if((at_ptr->ref=(uint16)VHstoredata(hdf_file_id,at_ptr->name,data,
+                      at_ptr->len,at_ptr->nt,RIGATTRNAME,RIGATTRCLASS))==(uint16)FAIL)
+                  HGOTO_ERROR(DFE_VSCANTCREATE,FAIL);
+              at_ptr->data=NULL;
+              at_ptr->data_modified=FALSE;
+          } /* end else */
+        at_ptr->new_at=TRUE;
+
+        /* Add the attribute to the attribute tree */
+        if(tbbtdins(search_tree, at_ptr, NULL)==NULL)
+            HGOTO_ERROR(DFE_TBBTINS,FAIL);
+
+        /* flag the attribute tree as being modified */
+        *update_flag=TRUE;
+        (*update_count)++;  /* get the index and update the tree's count */
+      } /* end else */
+
+    /* set this flag also, if we set local attributes */
+    if(is_riid==TRUE) 
+      {
+        if(found==FALSE)    /* when adding new attributes, make certain the RI gets updated */
+            ri_ptr->meta_modified=TRUE;
+        gr_ptr->gr_modified=TRUE;
+      } /* end if */
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRsetattr() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRattrinfo
+
+ PURPOSE
+    Get attribute information for an object.
+
+ USAGE
+    intn GRattrinfo(dimid|riid|grid,index,name,attr_nt,count)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        int32 index;            IN: index of the attribute for info
+        char *name;             OUT: name of attribute
+        int32 attr_nt;          OUT: number-type of attribute
+        int32 count;            OUT: number of entries of the attribute
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Get attribute information for an object.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRattrinfo(int32 id,int32 index,char *name,int32 *attr_nt,int32 *count)
+{
+    CONSTR(FUNC, "GRattrinfo");   /* for HERROR */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    void * *t;                   /* temp. ptr to the image found */
+    TBBT_TREE *search_tree;     /* attribute tree to search through */
+    at_info_t *at_ptr;          /* ptr to the attribute to work with */
+    intn   ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the ID, the index is checked below */
+    if (HAatom_group(id)!=RIIDGROUP && HAatom_group(id)!=GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    if (HAatom_group(id)==GRIDGROUP)
+      {
+          /* locate GR's object in hash table */
+          if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+          if(index<0 || index>=gr_ptr->gattr_count)
+              HGOTO_ERROR(DFE_ARGS, FAIL);
+
+          search_tree=gr_ptr->gattree;
+      } /* end if */
+    else if (HAatom_group(id)==RIIDGROUP)
+      {
+          /* locate RI's object in hash table */
+          if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+          if(index<0 || index>=ri_ptr->lattr_count)
+              HGOTO_ERROR(DFE_ARGS, FAIL); 
+          search_tree=ri_ptr->lattree;
+      } /* end if */
+    else    /* shouldn't get here, but what the heck... */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if((t = (void **)tbbtdfind(search_tree, &index, NULL))==NULL)
+        HGOTO_ERROR(DFE_RINOTFOUND,FAIL);
+    at_ptr=(at_info_t *)*t;
+
+    if(name!=NULL)
+        HDstrcpy(name,at_ptr->name);
+    if(attr_nt!=NULL)
+        *attr_nt=at_ptr->nt;
+    if(count!=NULL)
+        *count=at_ptr->len;
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRattrinfo() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRgetattr
+
+ PURPOSE
+    Read an attribute for an object.
+
+ USAGE
+    intn GRgetattr(dimid|riid|grid,index,data)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        int32 index;            IN: index of the attribute for info
+        void * data;             OUT: data read for attribute
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Read an attribute for an object.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRgetattr(int32 id,int32 index,void * data)
+{
+    CONSTR(FUNC, "GRgetattr");   /* for HERROR */
+    int32 hdf_file_id;          /* HDF file ID from Hopen */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    void * *t;                   /* temp. ptr to the image found */
+    TBBT_TREE *search_tree;     /* attribute tree to search through */
+    at_info_t *at_ptr;          /* ptr to the attribute to work with */
+    int32 at_size;              /* size in bytes of the attribute data */
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the ID & data ptr, the index is checked below */
+    if ((HAatom_group(id)!=RIIDGROUP && HAatom_group(id)!=GRIDGROUP) || data==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    if (HAatom_group(id)==GRIDGROUP)
+      {
+          /* locate GR's object in hash table */
+          if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+          if(index<0 || index>=gr_ptr->gattr_count)
+              HGOTO_ERROR(DFE_ARGS, FAIL);
+
+          search_tree=gr_ptr->gattree;
+      } /* end if */
+    else if (HAatom_group(id)==RIIDGROUP)
+      {
+          /* locate RI's object in hash table */
+          if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+          gr_ptr=ri_ptr->gr_ptr;
+
+          if(index<0 || index>=ri_ptr->lattr_count)
+              HGOTO_ERROR(DFE_ARGS, FAIL);
+
+          search_tree=ri_ptr->lattree;
+      } /* end if */
+    else    /* shouldn't get here, but what the heck... */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    hdf_file_id=gr_ptr->hdf_file_id;
+    if((t = (void **)tbbtdfind(search_tree, &index, NULL))==NULL)
+        HGOTO_ERROR(DFE_RINOTFOUND,FAIL);
+    at_ptr=(at_info_t *)*t;
+
+    /* Calculate the size of the attribute data */
+    at_size=at_ptr->len*DFKNTsize((at_ptr->nt | DFNT_NATIVE) & (~DFNT_LITEND));
+
+    /* Check if the attribute has been read in yet, and get it if not */
+    if(at_ptr->data==NULL)
+      {
+        int32 AttrID;       /* attribute Vdata id */
+
+        /* Grab some memory for the attribute data */
+        if((at_ptr->data=HDmalloc(at_size))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+            
+        if((AttrID=VSattach(hdf_file_id,(int32)at_ptr->ref,"r"))==FAIL)
+            HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+        if(VSsetfields(AttrID,at_ptr->name)==FAIL)
+          {
+            VSdetach(AttrID);
+            HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+          } /* end if */
+        if(VSread(AttrID,at_ptr->data,at_ptr->len,FULL_INTERLACE)==FAIL)
+          {
+            VSdetach(AttrID);
+            HGOTO_ERROR(DFE_VSWRITE,FAIL);
+          } /* end if */
+        if(VSdetach(AttrID)==FAIL)
+            HGOTO_ERROR(DFE_CANTDETACH,FAIL);
+      } /* end if */
+
+    /* Copy the attribute into the user's buffer */
+    HDmemcpy(data,at_ptr->data,at_size);
+
+    /* If the attribute is too large to keep in memory, chuck it again */
+    if((uint32)at_size>gr_ptr->attr_cache)
+        HDfreenclear(at_ptr->data);
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRgetattr() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRfindattr
+
+ PURPOSE
+    Get the index of an attribute with a given name for an object.
+
+ USAGE
+    int32 GRfindattr(int32 dimid|riid|grid,char *name)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        char *name;             IN: name of attribute to search for
+
+ RETURNS
+    Valid index for an attribute on success, FAIL on failure
+
+ DESCRIPTION
+    Get the index of an attribute with a given name for an object.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32 GRfindattr(int32 id,const char *name)
+{
+    CONSTR(FUNC, "GRfindattr");   /* for HERROR */
+    gr_info_t *gr_ptr;          /* ptr to the GR information for this grid */
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    void * *t;                   /* temp. ptr to the image found */
+    TBBT_TREE *search_tree;     /* attribute tree to search through */
+    at_info_t *at_ptr;          /* ptr to the attribute to work with */
+    int32 ret_value = SUCCEED;
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(id)!=RIIDGROUP && HAatom_group(id)!=GRIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    if (HAatom_group(id)==GRIDGROUP)
+      {
+          /* locate GR's object in hash table */
+          if (NULL == (gr_ptr = (gr_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_GRNOTFOUND, FAIL);
+
+          search_tree=gr_ptr->gattree;
+      } /* end if */
+    else if (HAatom_group(id)==RIIDGROUP)
+      {
+          /* locate RI's object in hash table */
+          if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(id)))
+              HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+          search_tree=ri_ptr->lattree;
+      } /* end if */
+    else    /* shouldn't get here, but what the heck... */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if((t = (void **)tbbtfirst((TBBT_NODE *)*search_tree))==NULL)
+        HGOTO_ERROR(DFE_RINOTFOUND,FAIL);
+    do {
+        at_ptr=(at_info_t *)*t;
+        if(at_ptr!=NULL && HDstrcmp(at_ptr->name,name)==0)  /* ie. the name matches */
+            HGOTO_DONE(at_ptr->index);
+    } while((t= (void **)tbbtnext((TBBT_NODE *)t))!=NULL);
+
+    ret_value = (FAIL);
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* end GRfindattr() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIstart
+ PURPOSE
+    GR-level initialization routine
+ USAGE
+    intn GRIstart()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Register the shut-down routine (GRPshutdown) for call with atexit
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn GRIstart(void)
+{
+    CONSTR(FUNC, "GRIstart");    /* for HERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&GRPshutdown) != 0)
+      HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return(ret_value);
+} /* end GRIstart() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRIgetaid
+ PURPOSE
+    Internal routine to make certain an image has an AID attached to it.
+ USAGE
+    intn GRIgetaid(img_ptr, acc_perm)
+        ri_info_t *img_ptr;         IN: pointer to the image info for the
+                                        image to access.
+        intn acc_perm;              IN: method of access desired.
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Attach an AID to the image's in-memory structures, in order to better
+    manage I/O.  If the prior method of access for the image's AID was read
+    and write permission, then the previous AID is closed and reopened for
+    both read & write permission.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+PRIVATE intn GRIgetaid(ri_info_t *ri_ptr, intn acc_perm)
+{
+    CONSTR(FUNC, "GRIgetaid");  /* for HERROR */
+    int32 hdf_file_id;          /* HDF file ID */
+    gr_info_t *gr_ptr;          /* ptr to the file GR information for this image */
+    model_info minfo;           /* Dummy modeling information structure */
+    intn  ret_value = SUCCEED;
+
+    HEclear();
+    if (ri_ptr==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* initialize important values */
+    gr_ptr=ri_ptr->gr_ptr;
+    hdf_file_id=gr_ptr->hdf_file_id;
+
+    /* everybody gets read permission */
+    acc_perm|=DFACC_READ;
+
+    /* Test if the tag/ref pair has been assigned yet */
+    if(ri_ptr->img_tag==DFTAG_NULL || ri_ptr->img_ref==DFREF_WILDCARD)
+      {
+
+        if(ri_ptr->use_cr_drvr)
+            ri_ptr->img_tag=DFTAG_CI;
+        else
+            ri_ptr->img_tag=DFTAG_RI;
+        ri_ptr->img_ref=Htagnewref(hdf_file_id,ri_ptr->img_tag);
+      } /* end if */
+
+    /* Check if we need to increase the access permissions asked for */
+    if(ri_ptr->comp_img || (ri_ptr->img_aid!=0 && (acc_perm&DFACC_WRITE)!=0 && (ri_ptr->acc_perm&DFACC_WRITE)==0))
+      {
+        /* Close the old AID (which only had read permission) */
+        Hendaccess(ri_ptr->img_aid);
+        ri_ptr->img_aid=0;
+      } /* end if */
+
+    /* Check if we are the first to open the AID */
+    if(ri_ptr->img_aid==0)
+      {
+        /* Go get the AID */
+        if(ri_ptr->comp_img)
+          { /* Need to create the compressed data element */
+            if((ri_ptr->img_aid=HCcreate(hdf_file_id,ri_ptr->img_tag,ri_ptr->img_ref,COMP_MODEL_STDIO,&minfo,ri_ptr->comp_type,&(ri_ptr->cinfo)))==FAIL)
+                HGOTO_ERROR(DFE_BADAID,FAIL);
+            ri_ptr->comp_img=0;     /* reset the compression flag */
+          } /* end if */
+        else
+          { /* Check for old-style compressed raster or just open normally */
+            if(ri_ptr->use_cr_drvr)
+              { /* Use compressed raster driver */
+                uintn pixel_size;        /* size of a pixel on disk */
+
+
+                pixel_size=(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+
+/* BMR: HRPconvert made access_rec->special = SPECIAL_COMPRAS */
+                if((ri_ptr->img_aid=HRPconvert(hdf_file_id,ri_ptr->img_tag,
+                    ri_ptr->img_ref,ri_ptr->img_dim.xdim,ri_ptr->img_dim.ydim,
+                    ri_ptr->img_dim.comp_tag,&(ri_ptr->cinfo),pixel_size))==FAIL)
+                    HGOTO_ERROR(DFE_BADAID,FAIL);
+              } /* end if */
+            else
+              { /* Use regular startaccess to create element */
+                if((ri_ptr->img_aid=Hstartaccess(hdf_file_id,ri_ptr->img_tag,ri_ptr->img_ref,acc_perm))==FAIL)
+                    HGOTO_ERROR(DFE_BADAID,FAIL);
+              } /* end else */
+          } /* end else */
+        if(ri_ptr->use_buf_drvr)
+          { /* Convert to buffered special element if needed */
+            if(HBconvert(ri_ptr->img_aid)==FAIL)
+                HGOTO_ERROR(DFE_CANTINIT,FAIL);
+          } /* end if */
+        ri_ptr->acc_perm=acc_perm;
+      } /* end if */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+        ri_ptr->img_aid=0;
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end GRIgetaid() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    GRPshutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn GRPshutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the GR routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn GRPshutdown(void)
+{
+    if(gr_tree!=NULL)
+      {
+          /* Free the vfile tree */
+          tbbtdfree(gr_tree, GRIgrdestroynode, NULL);
+
+          /* Destroy the atom groups for GRs and RIs */
+          HAdestroy_group(GRIDGROUP);
+          HAdestroy_group(RIIDGROUP);
+
+          gr_tree=NULL;
+      } /* end if */
+    return(SUCCEED);
+} /* end GRPshutdown() */
+
+
+
+/*====================== Chunking Routines ================================*/
+
+/* Debugging */
+/* #define CHK_DEBUG */
+
+/* NOTE: the definition of the union HDF_CHUNK_DEF can be found in hproto.h */
+
+/******************************************************************************
+ NAME
+      GRsetchunk  -- make GR a chunked GR
+
+ DESCRIPTION
+      This routine makes the GR a chunked GR according to the chunk
+      definiton passed in.
+
+      The image currently cannot be special already.  i.e. NBIT,
+      COMPRESSED, or EXTERNAL. This is an Error.
+
+      The defintion of the HDF_CHUNK_DEF union with relvant fields is:
+
+      typedef union hdf_chunk_def_u
+      {
+         int32   chunk_lengths[2];  Chunk lengths along each dimension
+
+         struct 
+          {   
+            int32     chunk_lengths[2]; Chunk lengths along each dimension
+            int32     comp_type;                   Compression type 
+            comp_info cinfo;                       Compression info struct 
+          }comp;
+
+      } HDF_CHUNK_DEF
+
+      The variable agruement 'flags' is a bit-or'd value which can currently be
+      'HDF_CHUNK' or 'HDF_CHUNK | HDF_COMP'.
+
+      The simplist is the 'chunk_lengths' array specifiying chunk 
+      lengths for each dimension where the 'flags' argument set to 
+      'HDF_CHUNK';
+
+      COMPRESSION is set by using the 'HDF_CHUNK_DEF' union to set the
+      appropriate compression information along with the required chunk lengths
+      for each dimension. The compression information is the same as 
+      that set in 'GRsetcompress()'. The bit-or'd 'flags' argument' is set to 
+      'HDF_CHUNK | HDF_COMP'.
+
+      See the example in pseudo-C below for further usage.
+
+      The maximum number of Chunks in an HDF file is 65,535.
+
+      The performance of the GRxxx interface with chunking is greatly
+      affected by the users access pattern over the image and by
+      the maximum number of chunks set in the chunk cache. The cache contains 
+      the Least Recently Used(LRU cache replacment policy) chunks. See the
+      routine GRsetchunkcache() for further info on the chunk cache and how 
+      to set the maximum number of chunks in the chunk cache. A default chunk 
+      cache is always created.
+
+      The following example shows the organization of chunks for a 2D array.
+      e.g. 4x4 array with 2x2 chunks. The array shows the layout of
+           chunks in the chunk array.
+
+            4 ---------------------                                           
+              |         |         |                                                 
+        Y     |  (0,1)  |  (1,1)  |                                       
+        ^     |         |         |                                      
+        |   2 ---------------------                                       
+        |     |         |         |                                               
+        |     |  (0,0)  |  (1,0)  |                                      
+        |     |         |         |                                           
+        |     ---------------------                                         
+        |     0         2         4                                       
+        ---------------> X                                                       
+
+        --Without compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                                                                    
+        -- Set chunk lengths --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2; 
+
+        -- Set Chunking -- 
+        GRsetchunk(riid, chunk_def, HDF_CHUNK);                      
+         ......                                                                  
+        }                                                                           
+
+        --With compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                
+        -- Set chunk lengths first --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2;
+
+        -- Set compression --
+        chunk_def.comp.cinfo.deflate.level = 9;
+        chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+
+        -- Set Chunking with Compression --
+        GRsetchunk(riid, chunk_def, HDF_CHUNK | HDF_COMP);                      
+         ......                                                                  
+        }                                                                           
+
+        NOTE:
+           This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+        -GeorgeV
+******************************************************************************/
+intn 
+GRsetchunk(int32 riid,              /* IN: raster access id */
+           HDF_CHUNK_DEF chunk_def, /* IN: chunk definition */
+           int32 flags              /* IN: flags */)
+{
+    CONSTR(FUNC, "GRsetchunk");
+    ri_info_t     *ri_ptr = NULL;    /* ptr to the image to work with */
+    HCHUNK_DEF     chunk[1];         /* H-level chunk defintion */
+    HDF_CHUNK_DEF *cdef   = NULL;    /* GR Chunk definition */
+    model_info minfo;                /* dummy model info struct */
+    comp_info  cinfo;                /* compression info - NBIT */
+    int32      *cdims    = NULL;     /* array of chunk lengths */
+    uintn      pixel_mem_size;       /* size of a pixel in memory */
+    uintn      pixel_disk_size;      /* size of a pixel on disk */
+    void *      fill_pixel = NULL;    /* converted value for the filled pixel */
+    int32      at_index;             /* attribute index for the fill value */
+    uint32     comp_config;
+    int32      ndims    = 0;         /* # dimensions i.e. rank */
+    uint8      nlevels  = 1;         /* default # levels is 1 */
+    intn       i;                    /* loop variable */
+    int32      hdf_file_id;          /* HDF file ID */
+    gr_info_t *gr_ptr;               /* ptr to the file GR information for this image */
+    intn       ret_value = SUCCEED;  /* return value */
+
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: called  \n");
+#endif
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    memset(chunk,0,sizeof(chunk[0]));
+    /* Check some args */
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* initialize important values */
+    gr_ptr = ri_ptr->gr_ptr;
+    hdf_file_id = gr_ptr->hdf_file_id;
+
+    /* Test if the tag/ref pair has been assigned yet 
+       Note that HMCcreate() needs to do the Hstartaccess on
+       the special tag/ref pair that is created. If another
+       GRxx routine does it then the special element cannot be
+       created. Special elements require 'lazy' DD creation. */
+    if(ri_ptr->img_tag == DFTAG_NULL || ri_ptr->img_ref == DFREF_WILDCARD)
+      {
+        ri_ptr->img_tag = DFTAG_RI;
+        ri_ptr->img_ref = Htagnewref(hdf_file_id,ri_ptr->img_tag);
+      } /* end if */
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: ri_ptr->img_aid=%d  \n",ri_ptr->img_aid);
+#endif
+
+    /* Decide type of defintion passed in  */
+    switch (flags)
+      {
+      case HDF_CHUNK: /* case where chunk_def only has chunk lengths */
+          cdef  = (HDF_CHUNK_DEF *)&chunk_def;
+          cdims = cdef->chunk_lengths;
+          chunk[0].chunk_flag = 0;  /* nothing set for this now */
+          chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+          chunk[0].model_type = COMP_MODEL_STDIO; /* Default */
+          chunk[0].cinfo = &cinfo; /* dummy */
+          chunk[0].minfo = &minfo; /* dummy */
+          break;
+      case (HDF_CHUNK | HDF_COMP):
+    /*  EIP 9/12/03 
+     *  We have to take special care if SZIP library is not available;
+     *  Fow all other compression types do
+     */
+          cdef  = (HDF_CHUNK_DEF *)&chunk_def;
+
+    /* Check that the compression encoder is available */
+    HCget_config_info((comp_coder_t )(cdef->comp.comp_type), &comp_config);
+    if ((comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED) == 0) {
+    /* coder not present?? */
+              HGOTO_ERROR(DFE_BADCODER,FAIL); 
+    }
+    if ((comp_config & COMP_ENCODER_ENABLED) == 0) {
+    /* encoder not present?? */
+              HGOTO_ERROR(DFE_NOENCODER,FAIL); 
+    }
+          cdims = cdef->comp.chunk_lengths;
+          chunk[0].chunk_flag = SPECIAL_COMP;  /* Compression */
+          chunk[0].comp_type  = (comp_coder_t)cdef->comp.comp_type; 
+          chunk[0].model_type = COMP_MODEL_STDIO; /* Default */
+          chunk[0].minfo = &minfo; /* dummy */
+
+    if ((comp_coder_t)cdef->comp.comp_type != COMP_CODE_SZIP) {
+              chunk[0].cinfo = &cdef->comp.cinfo; 
+    }
+    else
+#ifdef H4_HAVE_LIBSZ          /* we have the library */
+          {
+            HDmemcpy(&cinfo,&(cdef->comp.cinfo),sizeof(comp_info));
+        if (GRsetup_szip_parms(ri_ptr, &cinfo, cdims) == FAIL) 
+                  HGOTO_ERROR(DFE_INTERNAL,FAIL); 
+              chunk[0].cinfo = &cinfo; 
+    }
+#else                         /* we do not have the SZIP library */
+          {
+        HGOTO_ERROR(DFE_NOSZLIB, FAIL);
+          }
+#endif /* H4_HAVE_LIBSZ */
+          break;
+      case (HDF_CHUNK | HDF_NBIT): /* don't support NBIT for GRs */
+    HGOTO_ERROR(DFE_UNSUPPORTED, FAIL);
+      default:
+    HGOTO_ERROR(DFE_BADSCHEME, FAIL);
+      } /* end switch */
+
+    /* Now start setting chunk info */
+    ndims = 2; /* set number of dims i.e. rank 
+                  for Rasters it is 2 */
+
+    /* allocate space for chunk dimensions */
+    if ((chunk[0].pdims = (DIM_DEF *)HDmalloc(ndims*sizeof(DIM_DEF))) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+    /* initialize image/chunk sizes using CHUNK defintion structure */
+    chunk[0].chunk_size = 1;
+    chunk[0].num_dims = ndims;
+    for (i = 0; i < ndims; i++)
+      {   /* get dimension length from shape arrays */
+          if ( i == 0) /* X */
+              chunk[0].pdims[i].dim_length = ri_ptr->img_dim.xdim;
+          else /* Y */
+              chunk[0].pdims[i].dim_length = ri_ptr->img_dim.ydim;
+
+          /* set chunk lengths */
+          if (cdims[i] >= 1)
+              chunk[0].pdims[i].chunk_length = cdims[i];
+          else
+            { /* chunk length is less than 1 */
+                ret_value = FAIL;
+                goto done;
+            }
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: cdims[%d]=%d \n",i,cdims[i]);
+    fflush(stderr);
+#endif          
+          /* Data distribution along dimensions 
+          *  Check dimension length agains chunk length */
+          if (i == 0) /* X */
+            {
+                if (cdims[i] == ri_ptr->img_dim.xdim)
+                    chunk[0].pdims[i].distrib_type = 0;     /* NONE */
+                else
+                    chunk[0].pdims[i].distrib_type = 1;     /* BLOCK */
+            }
+          else /* Y */
+            {
+                if (cdims[i] == ri_ptr->img_dim.ydim)
+                    chunk[0].pdims[i].distrib_type = 0;     /* NONE */
+                else
+                    chunk[0].pdims[i].distrib_type = 1;     /* BLOCK */
+            }
+
+          /* compute chunk size */
+          chunk[0].chunk_size *= cdims[i];
+      } /* end for ndims */
+
+    /* Get the size of the pixels in memory and on disk */
+    pixel_mem_size  = (uintn)(ri_ptr->img_dim.ncomps*DFKNTsize((ri_ptr->img_dim.nt | DFNT_NATIVE) & (~DFNT_LITEND)));
+    pixel_disk_size = (uintn)(ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+
+    /* Set number type size i.e. size of data type 
+       number of components times the number type */
+    chunk[0].nt_size = ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt);
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: datatype size =%d\n",
+            ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+    fflush(stderr);
+#endif
+
+    /* allocate space for fill pixel */
+    if((fill_pixel = HDmalloc(pixel_disk_size)) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+    /* create correct disk version of fill pixel */
+    if(ri_ptr->fill_value != NULL)
+      {
+          if (FAIL == DFKconvert(ri_ptr->fill_value,fill_pixel,
+                                 ri_ptr->img_dim.nt,ri_ptr->img_dim.ncomps,
+                                 DFACC_WRITE,0,0))
+              HGOTO_ERROR(DFE_INTERNAL,FAIL); 
+      } /* end if */
+    else  /* create default pixel fill value of all zero components */
+      {
+          /* Try to find a fill value attribute */
+          if((at_index = GRfindattr(riid,FILL_ATTR)) != FAIL)
+            { /* Found a fill value attribute */
+                if((ri_ptr->fill_value = HDmalloc(pixel_mem_size)) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                if(GRgetattr(riid,at_index,ri_ptr->fill_value) == FAIL)
+                    HGOTO_ERROR(DFE_BADATTR,FAIL);
+                if (FAIL == DFKconvert(ri_ptr->fill_value,fill_pixel,
+                                       ri_ptr->img_dim.nt,ri_ptr->img_dim.ncomps,
+                                       DFACC_WRITE,0,0))
+                    HGOTO_ERROR(DFE_INTERNAL,FAIL);
+            } /* end if */
+          else
+              HDmemset(fill_pixel,0,pixel_disk_size);
+      } /* end else */
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: get ready to create\n");
+    fprintf(stderr,"GRsetchunk: img_tag=%d, img_ref=%d\n",
+            ri_ptr->img_tag, ri_ptr->img_ref);
+#endif
+
+    /* check to see already special.
+       Error if already special since doubly special elements are
+       not yet handled. HMCcreate should catch this....*/
+    /* Create GR as chunked element  */
+    ret_value = HMCcreate(hdf_file_id, /* HDF file handle */
+                          (uint16)ri_ptr->img_tag,/* Data tag */
+                          (uint16)ri_ptr->img_ref,/* Data ref */
+                          nlevels,                /* nlevels */
+                          pixel_disk_size,        /* fill value length */
+                          (VOID *)fill_pixel,     /* fill value */
+                          (HCHUNK_DEF *)chunk     /* chunk definition */);
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"HMCcreate: ret_value =%d \n", ret_value);
+#endif
+
+    /* check return */
+    if(ret_value != FAIL) 
+      { /* close old aid and set new one
+         ..hmm......this is for the doubly special hack */
+          if((ri_ptr->img_aid != 0) && (ri_ptr->img_aid != FAIL))
+            {
+              if (FAIL == Hendaccess(ri_ptr->img_aid))
+                  HGOTO_ERROR(DFE_INTERNAL,FAIL);
+            }
+
+          ri_ptr->img_aid = ret_value; /* set new access id */
+          ret_value = SUCCEED; /* re-set to successful */
+      } /* end if */
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"GRsetchunk: ri_ptr->img_aid =%d \n", ri_ptr->img_aid);
+#endif
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    /* free fill value */
+    if (fill_pixel != NULL)
+        HDfree(fill_pixel);
+
+    /* free chunk dims */
+    if (chunk[0].pdims != NULL)
+        HDfree(chunk[0].pdims);
+
+    return ret_value;
+} /* GRsetchunk */
+
+/******************************************************************************
+ NAME
+     GRgetchunkinfo -- get Info on GR
+
+ DESCRIPTION
+     This routine gets any special information on the GR. If its chunked,
+     chunked and compressed or just a regular GR. Currently it will only
+     fill the array of chunk lengths for each dimension as specified in
+     the 'HDF_CHUNK_DEF' union. You can pass in a NULL for 'chunk_def'
+     if don't want the chunk lengths for each dimension.
+     If successfull it will return a bit-or'd value in 'flags' indicating 
+     if the GR is  chunked(HDF_CHUNK), chunked and compressed(HDF_CHUNK | HDF_COMP) 
+     or non-chunked(HDF_NONE).
+ 
+     e.g. 4x4 array - Pseudo-C
+     {
+     HDF_CHUNK_DEF rchunk_def;
+     int32   cflags;
+     ...
+     GRgetchunkinfo(riid, &rchunk_def, &cflags);
+     ...
+     }
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+        -GeorgeV
+******************************************************************************/
+intn 
+GRgetchunkinfo(int32 riid,               /* IN: sds access id */
+               HDF_CHUNK_DEF *chunk_def, /* IN/OUT: chunk definition */
+               int32 *flags              /* IN/OUT: flags */)
+{
+    CONSTR(FUNC, "GRgetchunkinfo");
+    ri_info_t      *ri_ptr = NULL;        /* ptr to the image to work with */
+    sp_info_block_t info_block;           /* special info block */
+    int16           special;              /* Special code */
+    intn            i;                    /* loop variable */
+    intn            ret_value = SUCCEED;  /* return value */
+
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* Check some args */
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* check if access id exists already */
+    if(ri_ptr->img_aid == 0)
+      {
+          /* now get access id, use read access for now */
+          if(GRIgetaid(ri_ptr,DFACC_READ)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL,FAIL);
+      }
+    else if (ri_ptr->img_aid == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"%s: ri_ptr->img_aid =%d \n", FUNC, ri_ptr->img_aid);
+#endif
+
+    /* inquire about element */
+    ret_value = Hinquire(ri_ptr->img_aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {   /* make sure it is chunked element */
+          if (special == SPECIAL_CHUNKED)
+            { /* get info about chunked element */
+             if ((ret_value = HDget_special_info(ri_ptr->img_aid, &info_block)) != FAIL)
+               {   /* Does user want chunk lengths back? */
+                   if (chunk_def != NULL)
+                     {
+                         /* we assume user has allocat space for chunk lengths */
+                         /* copy chunk lengths over */
+                         for (i = 0; i < info_block.ndims; i++)
+                           {
+                               chunk_def->chunk_lengths[i] = info_block.cdims[i];
+                           }
+                     }
+                   /* dont forget to free up info is special info block 
+                      This space was allocated by the library */
+                   HDfree(info_block.cdims);
+
+                   /* Check to see if compressed */
+                   switch(info_block.comp_type)
+                     {
+                     case COMP_CODE_NONE:
+                         *flags = HDF_CHUNK;
+                         break;
+                     case COMP_CODE_NBIT: 
+                         /* is this an error? 
+                            NBIT can't be set in GRsetchunk(). */
+                         *flags = (HDF_CHUNK | HDF_NBIT);
+                         break;
+                     default:
+                         *flags = (HDF_CHUNK | HDF_COMP);
+                         break;
+                     }
+               }
+            }
+          else /* not special chunked element */
+            {
+              *flags = HDF_NONE; /* regular GR */
+            }
+      }
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* GRgetchunkinfo() */
+
+
+/******************************************************************************
+ NAME
+     GRwritechunk   -- write the specified chunk to the GR
+
+ DESCRIPTION
+     This routine writes a whole chunk of data to the chunked GR 
+     specified by chunk 'origin' for the given GR and can be used
+     instead of GRwriteimage() when this information is known. This
+     routine has less overhead and is much faster than using GRwriteimage().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See GRsetchunk() for a description of the organization of chunks in an GR.
+
+     NOTE:
+           This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+       -GeorgeV
+******************************************************************************/
+intn 
+GRwritechunk(int32 riid,       /* IN: access aid to GR */
+             int32 *origin,    /* IN: origin of chunk to write */
+             const VOID *datap /* IN: buffer for data */)
+{
+    CONSTR(FUNC, "GRwritechunk");
+    ri_info_t *ri_ptr = NULL;   /* ptr to the image to work with */
+    uintn      pixel_mem_size,  /* size of a pixel in memory */
+               pixel_disk_size; /* size of a pixel on disk */
+    VOID      *img_data = NULL; /* buffer used for conversion */
+    int16      special;         /* Special code */
+    int32      csize;           /* phsical chunk size */
+    sp_info_block_t info_block; /* special info block */
+    uint32     byte_count;      /* bytes to write */
+    int8       platnumsubclass; /* the machine type of the current platform */
+    uintn      convert;         /* whether to convert or not */
+    intn       i;
+    uint16 scheme;  /* compression scheme used for JPEG images */
+    uint32     comp_config;
+    comp_coder_t comp_type; 
+    comp_info cinfo;
+    intn       status=FAIL;
+    intn       switch_interlace = FALSE;/* whether the memory interlace needs to be switched around */
+    intn       ret_value = SUCCEED;
+
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    info_block.cdims = NULL;
+
+    /* Check args */
+    if (origin == NULL || datap == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* check if access id exists already */
+    if(ri_ptr->img_aid == 0)
+      {
+          /* now get access id, use write access */
+          if(GRIgetaid(ri_ptr,DFACC_WRITE)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL,FAIL);
+      }
+    else if (ri_ptr->img_aid == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"%s: ri_ptr->img_aid =%d \n", FUNC, ri_ptr->img_aid);
+#endif
+    comp_type = COMP_CODE_NONE;
+    scheme = ri_ptr->img_dim.comp_tag;
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+    {
+	comp_type = COMP_CODE_JPEG;
+	cinfo.jpeg.quality = 0;
+	cinfo.jpeg.force_baseline = 0;
+    }
+    else if (scheme == DFTAG_IMC)
+    { /* coder no longer supported */
+        HGOTO_ERROR(DFE_BADCODER,FAIL);
+    }
+    else
+    {
+	/* use lower-level routine to get the compression information */
+	status = HCPgetcompinfo(ri_ptr->gr_ptr->hdf_file_id,
+                        ri_ptr->img_tag, ri_ptr->img_ref,
+                        &comp_type, &cinfo);
+	if (status == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    }
+    if (comp_type != COMP_CODE_NONE)
+    {
+        /* Check that the compression encoder is available */
+        HCget_config_info(comp_type, &comp_config);
+        if ((comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED) == 0) {
+            /* coder not present?? */
+             HGOTO_ERROR(DFE_BADCODER,FAIL); 
+        }
+        if ((comp_config & COMP_ENCODER_ENABLED) == 0) {
+            /* encoder not present?? */
+             HGOTO_ERROR(DFE_NOENCODER,FAIL); 
+        }
+    }
+
+   /* inquire about element */
+    ret_value = Hinquire(ri_ptr->img_aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {
+          if (special == SPECIAL_CHUNKED)
+            {  /* yes */
+
+                /* get info about chunked element */
+                if ((ret_value = HDget_special_info(ri_ptr->img_aid, &info_block)) != FAIL)
+                  {   
+                      /* calculate chunk size  */
+                      csize = 1;
+                      for (i = 0; i < info_block.ndims; i++)
+                          csize *= info_block.cdims[i];
+
+                      /* Get the size of the pixels in memory and on disk */
+                      pixel_mem_size  =(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize((ri_ptr->img_dim.nt | DFNT_NATIVE) & (~DFNT_LITEND)));
+                      pixel_disk_size =(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+
+                      /* adjust for data type size */
+                      /* csize *= pixel_mem_size; */
+                      byte_count = csize * pixel_mem_size;
+
+                      /* figure out if data needs to be converted */
+                      /* Get number-type and conversion information */
+                      if (FAIL == (platnumsubclass = DFKgetPNSC(ri_ptr->img_dim.nt & (~DFNT_LITEND), DF_MT)))
+                          HGOTO_ERROR(DFE_INTERNAL,FAIL);
+                     convert = (ri_ptr->img_dim.file_nt_subclass != platnumsubclass) ||
+                              (pixel_mem_size != pixel_disk_size);  /* is conversion necessary? */
+
+                      /* check interlace */
+                      if(ri_ptr->img_dim.il != MFGR_INTERLACE_PIXEL)
+                          switch_interlace=TRUE;
+
+                      /* convert if necessary */
+                      if(convert || switch_interlace == TRUE) 
+                        {
+                            /* Allocate space for the conversion buffer */
+                            if((img_data = HDmalloc(pixel_disk_size*csize)) == NULL)
+                                HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+                            if(switch_interlace == TRUE)
+                              {
+                                  void * pixel_buf;  /* buffer for the pixel interlaced data */
+
+                                  /* Allocate space for the conversion buffer */
+                                  if((pixel_buf = HDmalloc(pixel_mem_size*csize)) == NULL)
+                                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+                                  if (FAIL == GRIil_convert((VOID *)datap,ri_ptr->img_dim.il,pixel_buf,MFGR_INTERLACE_PIXEL,
+                                                            info_block.cdims,ri_ptr->img_dim.ncomps,ri_ptr->img_dim.nt))
+                                      HGOTO_ERROR(DFE_INTERNAL,FAIL);
+                                  
+                                  /* convert the pixel data into the HDF disk format */
+                                  if (FAIL == DFKconvert(pixel_buf,img_data,ri_ptr->img_dim.nt,
+                                                         ri_ptr->img_dim.ncomps*csize,DFACC_WRITE,0,0))
+                                      HGOTO_ERROR(DFE_INTERNAL,FAIL);
+                                  
+                                  HDfree(pixel_buf);
+                              } /* end if */
+                            else /* convert the pixel data into the HDF disk format */
+                              {
+                                  if (FAIL == DFKconvert((VOID *)datap,img_data,ri_ptr->img_dim.nt,
+                                                         ri_ptr->img_dim.ncomps*csize,DFACC_WRITE,0,0))
+                                      HGOTO_ERROR(DFE_INTERNAL,FAIL);
+                              }
+                          /* Write chunk out, */
+                          if ((ret_value = HMCwriteChunk(ri_ptr->img_aid, origin, img_data)) != FAIL)
+                              ret_value = SUCCEED;
+                        }
+                      else { /* no conversion necessary, just use the user's buffer */
+                          /* Write chunk out, */
+                          if ((ret_value = HMCwriteChunk(ri_ptr->img_aid, origin, datap)) != FAIL)
+                              ret_value = SUCCEED;
+                      } /* end else */
+                  } /* end if get special info block */
+            }
+          else /* not special CHUNKED */
+              ret_value = FAIL;
+      } /* end if Hinquire */
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    /* dont forget to free up info is special info block 
+       This space was allocated by the library */
+    if (info_block.cdims != NULL)
+        HDfree(info_block.cdims);
+
+    /* free conversion buffers if we created them */
+    if (img_data != NULL)
+        HDfree(img_data);
+
+    return ret_value;
+} /* GRwritechunk() */
+
+/******************************************************************************
+ NAME
+     GRreadchunk   -- read the specified chunk to the GR
+
+ DESCRIPTION
+     This routine reads a whole chunk of data from the chunked GR
+     specified by chunk 'origin' for the given GR and can be used
+     instead of GRreaddata() when this information is known. This
+     routine has less overhead and is much faster than using GRreaddata().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See GRsetchunk() for a description of the organization of chunks in an GR.
+
+     NOTE:
+         This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+       -GeorgeV
+******************************************************************************/
+intn 
+GRreadchunk(int32 riid,    /* IN: access aid to GR */
+            int32 *origin, /* IN: origin of chunk to write */
+            VOID *datap    /* IN/OUT: buffer for data */)
+{
+    CONSTR(FUNC, "GRreadchunk");
+    ri_info_t *ri_ptr = NULL;   /* ptr to the image to work with */
+    uintn      pixel_mem_size;  /* size of a pixel in memory */
+    uintn      pixel_disk_size; /* size of a pixel on disk */
+    VOID      *img_data = NULL; /* buffer used for conversion */
+    int16      special;         /* Special code */
+    int32      csize;           /* phsical chunk size */
+    sp_info_block_t info_block; /* special info block */
+    uint32     byte_count;      /* bytes to read */
+    int8       platnumsubclass; /* the machine type of the current platform */
+    uintn      convert;         /* whether to convert or not */
+    intn       i;
+    uint16 scheme;  /* compression scheme used for JPEG images */
+    uint32     comp_config;
+    comp_coder_t comp_type; 
+    comp_info cinfo;
+    intn       status=FAIL;
+    intn       switch_interlace = FALSE;/* whether the memory interlace needs to be switched around */
+    intn       ret_value = SUCCEED;
+
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    info_block.cdims = NULL;
+
+    /* Check args */
+    if (origin == NULL || datap == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* check if access id exists already */
+    if(ri_ptr->img_aid == 0)
+      {
+          /* now get access id, use write access */
+          if(GRIgetaid(ri_ptr,DFACC_WRITE)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL,FAIL);
+      }
+    else if (ri_ptr->img_aid == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"%s: ri_ptr->img_aid =%d \n", FUNC, ri_ptr->img_aid);
+#endif
+
+    comp_type = COMP_CODE_NONE;
+    scheme = ri_ptr->img_dim.comp_tag;
+    if (scheme == DFTAG_JPEG5 || scheme == DFTAG_GREYJPEG5
+            || scheme==DFTAG_JPEG || scheme==DFTAG_GREYJPEG)
+    {
+	comp_type = COMP_CODE_JPEG;
+	cinfo.jpeg.quality = 0;
+	cinfo.jpeg.force_baseline = 0;
+    }
+    /* Catch old images to avoid going into HCPgetcompinfo.  Note: I don't
+       think old images have chunking, but just in case I'm wrong.  Should
+       verify these later. -BMR, Jul 2012 */
+    else if (scheme == DFTAG_RLE) /* old image */
+	comp_type = COMP_CODE_RLE;
+    else if (scheme == DFTAG_IMC) /* old image */
+        comp_type = COMP_CODE_IMCOMP;
+    else
+    {
+	/* use lower-level routine to get the compression information */
+	status = HCPgetcompinfo(ri_ptr->gr_ptr->hdf_file_id,
+                        ri_ptr->img_tag, ri_ptr->img_ref,
+                        &comp_type, &cinfo);
+	if (status == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL,FAIL);
+    }
+    if (comp_type != COMP_CODE_NONE &&
+	comp_type != COMP_CODE_RLE &&
+	comp_type != COMP_CODE_IMCOMP)
+    {   /* BMR: this is reading, why do we need encoder? */
+	/* Check that the compression encoder is available */
+	HCget_config_info(comp_type, &comp_config);
+	if ((comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED) == 0) {
+    /* coder not present?? */
+         HGOTO_ERROR(DFE_BADCODER,FAIL); 
+      }
+      if ((comp_config & COMP_DECODER_ENABLED) == 0) {
+    /* decoder not present?? */
+         HGOTO_ERROR(DFE_NOENCODER,FAIL); 
+      } 
+    }
+    /* inquire about element */
+    ret_value = Hinquire(ri_ptr->img_aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {
+          if (special == SPECIAL_CHUNKED)
+            {  /* yes */
+
+                /* get info about chunked element */
+                if ((ret_value = HDget_special_info(ri_ptr->img_aid, &info_block)) != FAIL)
+                  {   
+                      /* calcualte chunk size  */
+                      csize = 1;
+                      for (i = 0; i < info_block.ndims; i++)
+                          csize *= info_block.cdims[i];
+
+                      /* Get the size of the pixels in memory and on disk */
+                      pixel_mem_size  =(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize((ri_ptr->img_dim.nt | DFNT_NATIVE) & (~DFNT_LITEND)));
+                      pixel_disk_size =(uintn)(ri_ptr->img_dim.ncomps*DFKNTsize(ri_ptr->img_dim.nt));
+
+                      /* adjust for number type size */
+                      /* csize *= pixel_mem_size; */
+                      byte_count = csize * pixel_mem_size;
+
+                      /* figure out if data needs to be converted */
+                      /* Get number-type and conversion information */
+                      if (FAIL ==(platnumsubclass = DFKgetPNSC(ri_ptr->img_dim.nt & (~DFNT_LITEND), DF_MT)))
+                          HGOTO_ERROR(DFE_INTERNAL,FAIL);
+                       convert = (ri_ptr->img_dim.file_nt_subclass != platnumsubclass) 
+                                 ||  (pixel_mem_size != pixel_disk_size);  /* is conversion necessary? */
+
+                      /* check interlace */
+                      if(ri_ptr->img_dim.il != MFGR_INTERLACE_PIXEL)
+                          switch_interlace=TRUE;
+
+                      /* read chunk in */
+                      if(convert) 
+                        {
+                            /* Allocate space for the conversion buffer */
+                            if((img_data = HDmalloc(pixel_disk_size*csize)) == NULL)
+                                HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+                            /* read it in */
+                            if ((ret_value = HMCreadChunk(ri_ptr->img_aid, origin, img_data)) 
+                                != FAIL)
+                                {
+                                    if (FAIL == DFKconvert(img_data,datap,ri_ptr->img_dim.nt,
+                                                           ri_ptr->img_dim.ncomps*csize,DFACC_READ,0,0))
+                                        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+                                    ret_value = SUCCEED;
+                                }
+                        } /* end if */
+                      else 
+                        {
+                          if ((ret_value = HMCreadChunk(ri_ptr->img_aid, origin, datap))
+                              != FAIL)
+                              ret_value = SUCCEED;
+                        }
+
+                      /* Check whether we need to convert the buffer to the user's */
+                      /*    requested interlace scheme. */
+                      /* Note: This is implemented in a horribly ugly & slow manner, but I'm */
+                      /*        in a bit of a hurry right now - QAK */
+                      /* I took this code from GRwrite() and put it here - GV */
+                      if(ri_ptr->im_il != MFGR_INTERLACE_PIXEL)
+                        {
+                            void * pixel_buf;  /* buffer for the pixel interlaced data */
+
+                            /* Allocate space for the conversion buffer */
+                            if((pixel_buf = HDmalloc(pixel_mem_size*csize)) == NULL)
+                                HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+                            if (FAIL == GRIil_convert(datap,MFGR_INTERLACE_PIXEL,pixel_buf,ri_ptr->im_il,
+                                                      info_block.cdims,ri_ptr->img_dim.ncomps,ri_ptr->img_dim.nt))
+                                HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+                            HDmemcpy(datap,pixel_buf,pixel_mem_size*csize);
+
+                            HDfree(pixel_buf);
+                        } /* end if */
+
+                  } /* end if get special info block */
+            }
+          else /* not special CHUNKED */
+              ret_value = FAIL;
+      } /* end if Hinquire */
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    /* dont forget to free up info is special info block 
+       This space was allocated by the library */
+    if (info_block.cdims != NULL)
+        HDfree(info_block.cdims);
+
+    /* free conversion buffers if any */
+    if (img_data != NULL)
+        HDfree(img_data);
+
+    return ret_value;
+} /* GRreadchunk() */
+
+
+/******************************************************************************
+NAME
+     GRsetchunkcache - maximum number of chunks to cache 
+
+DESCRIPTION
+     Set the maximum number of chunks to cache.
+
+     The cache contains the Least Recently Used(LRU cache replacment policy) 
+     chunks. This routine allows the setting of maximum number of chunks that 
+     can be cached, 'maxcache'.
+
+     The performance of the GRxxx interface with chunking is greatly
+     affected by the users access pattern over the image and by
+     the maximum number of chunks set in the chunk cache. The number chunks 
+     that can be set in the cache is process memory limited. It is a good 
+     idea to always set the maximum number of chunks in the cache as the 
+     default heuristic does not take into account the memory available for 
+     the application.
+
+     By default when the GR is promoted to a chunked element the 
+     maximum number of chunks in the cache 'maxcache' is set to the number of
+     chunks along the last dimension.
+
+     The values set here affects the current GR object's caching behaviour.
+
+     If the chunk cache is full and 'maxcache' is greater then the
+     current 'maxcache' value, then the chunk cache is reset to the new
+     'maxcache' value, else the chunk cache remains at the current
+     'maxcache' value.
+
+     If the chunk cache is not full, then the chunk cache is set to the
+     new 'maxcache' value only if the new 'maxcache' value is greater than the
+     current number of chunks in the cache.
+
+     Use flags argument of 'HDF_CACHEALL' if the whole object is to be cached 
+     in memory, otherwise pass in zero(0). Currently you can only
+     pass in zero.
+
+     See GRsetchunk() for a description of the organization of chunks in an GR.
+     
+     NOTE:
+          This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+RETURNS
+     Returns the 'maxcache' value for the chunk cache if successful 
+     and FAIL otherwise
+
+AUTHOR 
+      -GeorgeV
+******************************************************************************/
+intn
+GRsetchunkcache(int32 riid,     /* IN: access aid to mess with */
+                int32 maxcache, /* IN: max number of chunks to cache */
+                int32 flags     /* IN: flags = 0, HDF_CACHEALL */)
+{
+    CONSTR(FUNC, "GRsetchunkcache");
+    ri_info_t *ri_ptr = NULL;        /* ptr to the image to work with */
+    int16      special;              /* Special code */
+    intn       ret_value = SUCCEED;
+
+
+    /* clear error stack and check validity of args */
+    HEclear();
+
+    /* Check args */
+    if (maxcache < 1 )
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    if (flags != 0 && flags != HDF_CACHEALL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* check the validity of the RI ID */
+    if (HAatom_group(riid)!=RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate RI's object in hash table */
+    if (NULL == (ri_ptr = (ri_info_t *) HAatom_object(riid)))
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* check if access id exists already */
+    if(ri_ptr->img_aid == 0)
+      {
+          /* now get access id, use write access */
+          if(GRIgetaid(ri_ptr,DFACC_WRITE)==FAIL)
+              HGOTO_ERROR(DFE_INTERNAL,FAIL);
+      }
+    else if (ri_ptr->img_aid == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,FAIL);
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"%s: ri_ptr->img_aid =%d \n", FUNC, ri_ptr->img_aid);
+#endif
+
+    /* inquire about element */
+    ret_value = Hinquire(ri_ptr->img_aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {
+          if (special == SPECIAL_CHUNKED) /* set cache*/
+              ret_value = HMCsetMaxcache(ri_ptr->img_aid, maxcache, flags); 
+          else
+              ret_value = FAIL;
+      }
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* GRsetchunkcache() */
+
+
+/*---------------------------------------------------------------
+NAME
+   GRmapped - Checks whether an RI is to be mapped (hmap project)
+
+USAGE
+    intn GRmapped(riid, *tobe_mapped, *created_byGR)
+        int32 riid;     IN: raster image ID
+        intn *tobe_mapped;  IN: TRUE if the image should be mapped
+  intn *created_byGR;  IN: TRUE if the image was created by GR API
+DESCRIPTION
+   GRmapped checks if the given RI satisfies the following conditions:
+   + being an 8-bit RI
+   + having one component
+   + being non-special or RLE compressed only, i.e., no other
+        compressions, no chunking,...
+
+   The function will set tobe_mapped to TRUE if the image satisfies the
+   above conditions, and FALSE, otherwise.
+
+   In addition, the function will set the flag name_generated to indicate
+   whether the image has name that was generated by the library.  Old images
+   (or images created with non-GR API) didn't have a name so the library
+   would generate a name for it while reading in the file.
+
+RETURNS
+   SUCCEED/FAIL
+   Feb 24, 2011 -BMR
+
+MODIFICATION
+   Mar 17, 2011: Changed the function from
+  intn GR2bmapped(int32 riid), returning TRUE/FALSE/FAIL, to
+  intn GR2bmapped(int32 riid, intn *tobe_mapped, intn *name_generated),
+  returning SUCCEED/FAIL
+----------------------------------------------------------------*/
+intn
+GR2bmapped(int32 riid, intn *tobe_mapped, intn *name_generated)
+{
+    CONSTR(FUNC, "GR2bmapped");
+    ri_info_t *ri_ptr;          /* ptr to the image to work with */
+    intn   should_map = FALSE;  /* TRUE if the image should be mapped */
+    uint16 img_tag, img_ref;  /* shortcuts image's tag/ref */
+    int32  ritype;    /* image's type */
+    intn   special_type=0;  /* specialness of the image data */
+    int32  file_id;    /* shortcut file id */
+    intn   status;
+    intn   ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Check the validity of the ID */
+    if (HAatom_group(riid) != RIIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate RI's object in hash table */
+    ri_ptr = (ri_info_t *) HAatom_object(riid);
+    if (NULL == ri_ptr)
+        HGOTO_ERROR(DFE_RINOTFOUND, FAIL);
+
+    /* shortcuts */
+    img_tag = ri_ptr->img_tag;
+    img_ref = ri_ptr->img_ref;
+    file_id = ri_ptr->gr_ptr->hdf_file_id;
+
+    /* If the image has old image tag, then make sure it is either non-special
+       or compressed with RLE only */ 
+    if (img_tag == DFTAG_RI8 || img_tag == DFTAG_CI8)
+    {
+	if (ri_ptr->img_dim.comp_tag == DFTAG_RLE ||
+	    ri_ptr->img_dim.comp_tag == DFTAG_NULL)
+	    should_map = TRUE;
+    }
+    /* If the image has new image tag, then make sure that it has 8-bit data
+       and has no special storage except RLE compression before determining
+       that it is mapped-able */
+    else if (img_tag == DFTAG_RI || img_tag == DFTAG_CI)
+    {
+	/* Get the image data's type */
+	status = GRgetiminfo(riid, NULL, NULL, &ritype, NULL, NULL, NULL);
+
+	/* If it is 8-bit, set flag to check further for special storage */
+	if (ritype == DFNT_UCHAR8 || ritype == DFNT_CHAR8 ||
+	    ritype == DFNT_UINT8 || ritype == DFNT_INT8)
+	{
+	    /* Also make sure it only has one component */
+	    if (ri_ptr->img_dim.ncomps ==1)
+	    {
+		/* Make sure no specialness or only with RLE compression */
+		comp_coder_t comp_type=COMP_CODE_NONE;
+		status = GRgetcomptype(riid, &comp_type);
+		if (comp_type == COMP_CODE_RLE || comp_type == COMP_CODE_NONE)
+		{
+		    special_type = GRIisspecial_type(file_id, img_tag, img_ref);
+		    /* In some cases, special_type = 0 for old image with RLE,
+		    although the image has newer image tag.  Added the check
+		    for 0 here, but this should be investigated more. -BMR*/
+		    if (special_type == SPECIAL_COMP || special_type == 0)
+			should_map = TRUE;
+		}
+	    }
+	}
+    }
+    /* Set flag to return */
+    *tobe_mapped = should_map;
+
+    /* Copy flag that indicates whether this image has name that was
+       generated by library, and not given by application */
+    *name_generated = ri_ptr->name_generated;
+
+done:
+  if(ret_value == 0)
+    { /* Error condition cleanup */
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}   /* GR2bmapped */
+/*
+
+API functions to finish:
+
+Misc. stuff left to do:
+    Deal with special elements for images.
+    GRrename for images.
+    GRsetflags to suppress writing fill data and to suppress fillvalue attr.
+    Read/Write Interlaced data (of line & plane types, pixel is working).
+
+Features not supported:
+    Add in full support for multiple palettes with each RI.
+    Add in support for named palettes with each RI.
+    Add in support for palettes with non-standard formats.
+    Deletion of attributes or images (would require changing the way index
+        numbers are handled)
+
+*/
diff --git a/hdf/src/mfgr.h b/hdf/src/mfgr.h
new file mode 100644
index 0000000..eb59657
--- /dev/null
+++ b/hdf/src/mfgr.h
@@ -0,0 +1,147 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: mfgr.h 5584 2011-04-13 18:25:06Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    mfgr.h
+ * Purpose: header file for multi-file general raster information
+ * Dependencies: 
+ * Invokes:
+ * Contents:
+ * Structure definitions: 
+ * Constant definitions: 
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __MFGR_H
+#define __MFGR_H
+
+#include "H4api_adpt.h"
+
+/* Interlace types available */
+typedef int16 gr_interlace_t;
+#define MFGR_INTERLACE_PIXEL		0    /* pixel interlacing scheme */
+#define MFGR_INTERLACE_LINE		    1    /* line interlacing scheme */
+#define MFGR_INTERLACE_COMPONENT 	2    /* component interlacing scheme */
+
+#if defined MFGR_MASTER | defined MFGR_TESTER
+
+#include "hfile.h"
+#include "tbbt.h"       /* Get tbbt routines */
+
+/* This is the size of the hash tables used for GR & RI IDs */
+#define GRATOM_HASH_SIZE    32
+
+/* The tag of the attribute data */
+#define RI_TAG      DFTAG_VG    /* Current RI groups are stored in Vgroups */
+#define ATTR_TAG    DFTAG_VH    /* Current GR attributes are stored in VDatas */
+
+/* The default threshhold for attributes which will be cached */
+#define GR_ATTR_THRESHHOLD  2048    
+
+#define VALIDRIINDEX(i,gp) ((i)>=0 && (i)<(gp)->gr_count)
+
+/*
+ * Each gr_info_t maintains 2 threaded-balanced-binary-tress: one of
+ * raster images and one of global attributes
+ */
+
+typedef struct gr_info {
+    int32       hdf_file_id;    /* the corresponding HDF file ID (must be first in the structure) */
+    uint16      gr_ref;         /* ref # of the Vgroup of the GR in the file */
+
+    int32       gr_count;       /* # of image entries in gr_tab so far */
+    TBBT_TREE  *grtree;         /* Root of image B-Tree */
+    uintn       gr_modified;    /* whether any images have been modified */
+
+    int32       gattr_count;    /* # of global attr entries in gr_tab so far */
+    TBBT_TREE  *gattree;        /* Root of global attribute B-Tree */
+    uintn       gattr_modified; /* whether any global attributes have been modified */
+
+    intn        access;         /* the number of active pointers to this file's GRstuff */
+    uint32      attr_cache;     /* the threshhold for the attribute sizes to cache */
+} gr_info_t;
+
+typedef struct at_info {
+    int32 index;            /* index of the attribute (needs to be first in the struct) */
+    int32 nt;               /* number type of the attribute */
+    int32 len;              /* length/order of the attribute */
+    uint16 ref;             /* ref of the attribute (stored in VData) */
+    uintn data_modified;    /* flag to indicate whether the attribute data has been modified */
+    uintn new_at;           /* flag to indicate whether the attribute was added to the Vgroup */
+    char *name;             /* name of the attribute */
+    void * data;             /* data for the attribute */
+} at_info_t;
+
+typedef struct dim_info {
+    uint16  dim_ref;            /* reference # of the Dim record */
+    int32   xdim,ydim,          /* dimensions of the image */
+            ncomps,             /* number of components of each pixel in image */
+            nt,                 /* number type of the components */
+            file_nt_subclass;   /* number type subclass of data on disk */
+    gr_interlace_t il;          /* interlace of the components (stored on disk) */
+    uint16  nt_tag,nt_ref;      /* tag & ref of the number-type info */
+    uint16  comp_tag,comp_ref;  /* tag & ref of the compression info */
+} dim_info_t;
+
+typedef struct ri_info {
+    int32   index;              /* index of this image (needs to be first in the struct) */
+    uint16  ri_ref;             /* ref # of the RI Vgroup */
+    uint16  rig_ref;            /* ref # of the RIG group */
+    gr_info_t *gr_ptr;          /* ptr to the GR info that this ri_info applies to */
+    dim_info_t img_dim;         /* image dimension information */
+    dim_info_t lut_dim;         /* palette dimension information */
+    uint16  img_tag,img_ref;    /* tag & ref of the image data */
+    int32   img_aid;            /* AID for the image data */
+    intn    acc_perm;           /* Access permission (read/write) for image AID */
+    uint16  lut_tag,lut_ref;    /* tag & ref of the palette data */
+    gr_interlace_t im_il;       /* interlace of image when next read (default PIXEL) */
+    gr_interlace_t lut_il;      /* interlace of LUT when next read */
+    uintn data_modified;        /* whether the image or palette data has been modified */
+    uintn meta_modified;        /* whether the image or palette meta-info has been modified */
+    uintn attr_modified;        /* whether the attributes have been modified */
+    char   *name;               /* name of the image */
+    int32   lattr_count;        /* # of local attr entries in ri_info so far */
+    TBBT_TREE *lattree;         /* Root of the local attribute B-Tree */
+    intn access;                /* the number of times this image has been selected */
+    uintn use_buf_drvr;         /* access to image needs to be through the buffered special element driver */
+    uintn use_cr_drvr;          /* access to image needs to be through the compressed raster special element driver */
+    uintn comp_img;             /* whether to compress image data */
+    comp_coder_t comp_type;     /* compression type */
+    comp_info cinfo;            /* compression information */
+    uintn ext_img;              /* whether to make image data external */
+    char *ext_name;             /* name of the external file */
+    int32 ext_offset;           /* offset in the external file */
+    uintn acc_img;              /* whether to make image data a different access type */
+    uintn acc_type;             /* type of access-mode to get image data with */
+    uintn fill_img;             /* whether to fill image, or just store fill value */
+    void * fill_value;           /* pointer to the fill value (NULL means use default fill value of 0) */
+    uintn store_fill;           /* whether to add fill value attribute or not */
+    intn   name_generated;      /* whether the image has name that was given by app. or was generated by the library like the DFR8 images (added for hmap)*/
+} ri_info_t;
+
+/* Useful raster routines for generally private use */
+
+HDFLIBAPI intn GRIil_convert(const void * inbuf,gr_interlace_t inil,void * outbuf,
+        gr_interlace_t outil,int32 dims[2],int32 ncomp,int32 nt);
+
+extern VOID GRIgrdestroynode(void * n);
+
+extern VOID GRIattrdestroynode(void * n);
+
+extern VOID GRIridestroynode(void * n);
+
+#endif /* MFGR_MASTER | MFGR_TESTER */
+
+#endif /* __MFGR_H */
diff --git a/hdf/src/mfgrf.c b/hdf/src/mfgrf.c
new file mode 100644
index 0000000..6123210
--- /dev/null
+++ b/hdf/src/mfgrf.c
@@ -0,0 +1,1318 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5700 $";
+#endif
+
+/* $Id: mfgrf.c 5700 2011-10-10 04:32:38Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    mfsdf.c
+ * Purpose: C stubs for Fortran GR routines
+ * Invokes: mfgr.c
+ * Contents:
+ *  mgstart:    Call GRstart to initialize the GR interface for a file
+ *  mgfinfo:    Call GRfileinfo for information about the file
+ *  mgend:      Call GRend to close down the GR interface to a file
+ *  mgcreat:    Call GRcreate to create a raster image
+ *  mgselct:    Call GRselect to select an existing raster image for I/O
+ *  mgn2ndx:    Call GRnametoindex to map an image's name into a index in a file
+ *  mggiinf:    Call GRgetiminfo to get information about an image 
+ *  mgwrimg:    Call GRwriteimage to write image data to the file
+ *  mgrdimg:    Call GRreadimage to read image data from the file
+ *  mgendac:    Call GRendaccess to end access to a raster image
+ *  mggdid:     Call GRgetdimid to get a dimension ID for an image [Later]
+ *  mgsdnam:    Call GRsetdimname to set a dimension's name [Later]
+ *  mggdinf:    Call GRgetdiminfo to get information about a dimension [Later]
+ *  mgid2rf:    Call GRidtoref to map an RI ID into a ref. # for annotating
+ *  mgr2idx:    Call GRreftoindex to map a ref. # into an index for the image
+ *  mgrltil:    Call GRreqlutil to request the interlace of the next LUT read
+ *  mgrimil:    Call GRreqimageil to request the interlace of the next image read
+ *  mggltid:    Call GRgetlutid to get a palette ID for an image
+ *  mgglinf:    Call GRgetlutinfo to get information about a palette
+ *  mgwrlut:    Call GRwritelut to write a palette to the file
+ *  mgwclut:    Call GRwritelut to write a character palette to the file
+ *  mgrdlut:    Call GRreadlut to read a palette from the file
+ *  mgrclut:    Call GRreadlut to read a character palette from the file
+ *  mgsxfil:    Call GRsetexternalfile to move an image into an external file
+ *  mgsactp:    Call GRsetaccesstype to set the access type for an image
+ *  mgscomp:    Call GRsetcompress to compress an image in the file 
+ *  mggcomp:    Call GRgetcompinfo to get image compression information 
+ *  mgisattr:    Call GRsetattr to write an attribute for an object
+ *  mgiscatt:   Call GRsetattr to write a char attribute for an obj.
+ *  mgatinf:    Call GRattrinfo get information about an attribute
+ *  mggcatt:    Call GRgetattr to read a char attribute from the file
+ *  mggnatt:    Call GRgetattr to read a numeric attribute from the file
+ *  mggattr:    Call GRgetattr to read an attribute from the file
+ *  mgfndat:    Call GRfindattr to get the index of an attribute for a name
+ *  mglut2ref:  Call GRluttoref to get reference number for a palette specified
+ *                   by palette identifier
+ * Remarks: 
+ *---------------------------------------------------------------------------*/
+
+#include "hdf.h"
+#include "hproto_fortran.h"
+
+/* Local pre-processor macros */
+#define XDIM    0
+#define YDIM    1
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgstart
+ * Purpose: Call GRstart to initialize the GR interface for a file
+ * Inputs:  fid: HDF file ID of file to initialize
+ * Returns: GR ID on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRstart
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgstart(intf * fid)
+{
+    return((intf)GRstart((int32)*fid));
+}   /* end mgstart() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgfinfo
+ * Purpose: Call GRfileinfo to get information about the images in a file
+ * Inputs:  grid: GR ID of file for information
+ *          n_datasets: # of raster images in the file
+ *          n_attrs: # of "global" GR attributes
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRfileinfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgfinfo(intf * grid,intf *n_datasets,intf *n_attrs)
+{
+    int32 n_data, n_attr;
+    intf ret;
+
+    ret=(intf)GRfileinfo((int32)*grid,&n_data,&n_attr);
+    *n_datasets=(intf)n_data;
+    *n_attrs=(intf)n_attr;
+    return(ret);
+}   /* end mgfinfo() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgend
+ * Purpose: Call GRend to close the GR interface for a file
+ * Inputs:  grid: GR ID of interface to close
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRend
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgend(intf * grid)
+{
+    return((intf)GRend((int32)*grid));
+}   /* end mgend() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgicreat
+ * Purpose: Call GRcreate to create a raster image.
+ * Inputs:
+ *      grid: GR ID of interface to create image in
+ *      name: name of raster image
+ *      ncomp: number of components per pixel
+ *      nt: number-type of each component
+ *      il: interlace scheme to use
+ *      dimsizes[2]: dimensions of the image to create
+ *      nlen: length of the name string
+ * Returns: RI ID on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRcreate
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgicreat(intf * grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[2], intf *nlen)
+{
+    char       *fn;
+    int32       cdims[2];
+    intf        ret;
+
+    /* Convert the FORTRAN string into a C string */
+    fn = HDf2cstring(name, (intn)*nlen);
+    if (fn == NULL)
+        return FAIL;
+
+    /* Copy the array of dimensions into an array of the proper type */
+    cdims[XDIM]=(int32)dimsizes[XDIM];
+    cdims[YDIM]=(int32)dimsizes[YDIM];
+    ret = (intf)GRcreate((int32)*grid, fn, (int32)*ncomp,(int32)*nt,(int32)*il,cdims);
+    HDfree(fn);
+
+    return(ret);
+}   /* end mgicreat() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgselct
+ * Purpose: Call GRselect to choose an existing raster image.
+ * Inputs:
+ *      grid: GR ID of interface
+ *      index: the index of the image to select
+ * Returns: RI ID on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRselect
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgselct(intf * grid, intf *index)
+{
+    return((intf)GRselect((int32)*grid,(int32)*index));
+}   /* end mgselct() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgin2ndx
+ * Purpose: Call GRnametoindex to map a raster image name to an index
+ * Inputs:
+ *      grid: GR ID of interface
+ *      name: the name of the raster image to find
+ *      nlen: the length of the name
+ * Returns: image index on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRnametoindex
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgin2ndx(intf * grid, _fcd name, intf *nlen)
+{
+    char       *fn;
+    intf        ret;
+
+    /* Convert the FORTRAN string into a C string */
+    fn = HDf2cstring(name, (intn)*nlen);
+    if (fn == NULL)
+        return FAIL;
+
+    /* Copy the array of dimensions into an array of the proper type */
+    ret = (intf)GRnametoindex((int32)*grid, fn);
+    HDfree(fn);
+
+    return(ret);
+}   /* end mgin2ndx() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mggiinf
+ * Purpose: Call GRgetiminfo to get information about an image
+ * Inputs:
+ *      riid: RI ID of the image
+ *      name: the name of the raster image to find
+ *      ncomp: the number of components each pixel has
+ *      nt: the number type of each component
+ *      il: the interlace of the image components
+ *      dimsizes: the dimensions of the image
+ *      nattr: the number of attributes the image has
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRgetiminfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmggiinf(intf * riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, intf *nattr)
+{
+    int32   t_ncomp,
+        t_nt,
+        t_il,
+        t_dimsizes[2],
+        t_nattr;
+    intf    ret;
+
+    /* Copy the array of dimensions into an array of the proper type */
+    ret = (intf)GRgetiminfo((int32)*riid, (char *)_fcdtocp(name), &t_ncomp, &t_nt, &t_il, t_dimsizes, &t_nattr);
+    *ncomp=(intf)t_ncomp;
+    *nt=(intf)t_nt;
+    *il=(intf)t_il;
+    dimsizes[XDIM]=t_dimsizes[XDIM];
+    dimsizes[YDIM]=t_dimsizes[YDIM];
+    *nattr=(intf)t_nattr;
+
+    return(ret);
+}   /* end mggiinf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgwcimg
+ * Purpose: Call mgwrimg to write char type image data to the file
+ * Inputs:
+ *      riid: RI ID of the image
+ *      start: the starting location of the image data to write
+ *      stride: the stride of image data to write
+ *      count: the number of pixels in each dimension to write
+ *      data: the image data (pixels) to write out
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRwriteimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgwcimg(intf * riid, intf *start, intf *stride, intf *count, _fcd data)
+{
+    return(nmgwrimg(riid, start, stride, count, (VOIDP)_fcdtocp(data)));
+}   /* end mgwcimg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgwrimg
+ * Purpose: Call GRwriteimage to write image data to the file
+ * Inputs:
+ *      riid: RI ID of the image
+ *      start: the starting location of the image data to write
+ *      stride: the stride of image data to write
+ *      count: the number of pixels in each dimension to write
+ *      data: the image data (pixels) to write out
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRwriteimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgwrimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data)
+{
+    int32 t_start[2],
+        t_stride[2],
+        t_count[2];
+
+    /* Copy the array of dimensions into an array of the proper type */
+    t_start[XDIM]=(int32)start[XDIM]; t_start[YDIM]=(int32)start[YDIM];
+    t_stride[XDIM]=(int32)stride[XDIM]; t_stride[YDIM]=(int32)stride[YDIM];
+    t_count[XDIM]=(int32)count[XDIM]; t_count[YDIM]=(int32)count[YDIM];
+
+    return((intf)GRwriteimage((int32)*riid, t_start, t_stride, t_count, data));
+}   /* end mgwrimg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgrcimg
+ * Purpose: Call mgrdimg to read char type image data from a file
+ * Inputs:
+ *      riid: RI ID of the image
+ *      start: the starting location of the image data to read
+ *      stride: the stride of image data to read
+ *      count: the number of pixels in each dimension to read
+ *      data: the image data (pixels) to read out
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRreadimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgrcimg(intf * riid, intf *start, intf *stride, intf *count, _fcd data)
+{
+    return(nmgrdimg(riid,start,stride,count,(VOIDP)_fcdtocp(data)));
+}   /* end mgrcimg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgrdimg
+ * Purpose: Call GRreadimage to read image data from a file
+ * Inputs:
+ *      riid: RI ID of the image
+ *      start: the starting location of the image data to read
+ *      stride: the stride of image data to read
+ *      count: the number of pixels in each dimension to read
+ *      data: the image data (pixels) to read out
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRreadimage
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgrdimg(intf * riid, intf *start, intf *stride, intf *count, VOIDP data)
+{
+    int32 t_start[2],
+        t_stride[2],
+        t_count[2];
+
+    /* Copy the array of dimensions into an array of the proper type */
+    t_start[XDIM]=(int32)start[XDIM]; t_start[YDIM]=(int32)start[YDIM];
+    t_stride[XDIM]=(int32)stride[XDIM]; t_stride[YDIM]=(int32)stride[YDIM];
+    t_count[XDIM]=(int32)count[XDIM]; t_count[YDIM]=(int32)count[YDIM];
+
+    return((intf)GRreadimage((int32)*riid, t_start, t_stride, t_count, data));
+}   /* end mgrdimg() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgendac
+ * Purpose: Call GRendaccess to terminate access to a raster image
+ * Inputs:
+ *      riid: RI ID of the image
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRendaccess
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgendac(intf * riid)
+{
+    return((intf)GRendaccess((int32)*riid));
+}   /* end mgendac() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgid2rf
+ * Purpose: Call GRidtoref to map a RI index into a reference #
+ * Inputs:
+ *      riid: RI ID of the image
+ * Returns: ref. # on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRidtoref
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgid2rf(intf * riid)
+{
+    return((intf)GRidtoref((int32)*riid));
+}   /* end mgid2rf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgr2idx
+ * Purpose: Call GRreftoindex to map a reference # into a ri index
+ * Inputs:
+ *      grid: GR ID of the file
+ *      ref: ref. # of the image
+ * Returns: a valid index # on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRreftoindex
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgr2idx(intf * grid, intf *ref)
+{
+    return((intf)GRreftoindex((int32)*grid,(uint16)*ref));
+}   /* end mgr2idx() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgrltil
+ * Purpose: Call GRreqlutil to request the interlacing scheme for the next LUT
+ * Inputs:
+ *      riid: RI ID of the image
+ *      il: interlace scheme for next read
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRreqlutil
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgrltil(intf * riid, intf *il)
+{
+    return((intf)GRreqlutil((int32)*riid,(intn)*il));
+}   /* end mgrltil() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgrimil
+ * Purpose: Call GRreqimageil to request the interlacing scheme for the next image
+ * Inputs:
+ *      riid: RI ID of the image
+ *      il: interlace scheme for next read
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRreqimageil
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgrimil(intf * riid, intf *il)
+{
+    return((intf)GRreqimageil((int32)*riid,(intn)*il));
+}   /* end mgrimil() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mggltid
+ * Purpose: Call GRgetlutid to get the palette ID for an image
+ * Inputs:
+ *      riid: RI ID of the image
+ *      lut_index: index of the palette to select
+ * Returns: valud LUT ID on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRgetlutid
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmggltid(intf * riid, intf *lut_index)
+{
+    return((intf)GRgetlutid((int32)*riid,(intn)*lut_index));
+}   /* end mggltid() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgglinf
+ * Purpose: Call GRgetlutinfo to get information about a palette
+ * Inputs:
+ *      lutid: LUT ID of the image
+ *      ncomp: number of components per palette entry
+ *      nt: number-type of components in palette entry
+ *      il: interlace of components in palette entry
+ *      nentries: number of palette entries
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRgetlutinfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgglinf(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries)
+{
+    int32 t_ncomp, t_nt, t_il, t_nentries;
+    intf status;
+
+    status=(intf)GRgetlutinfo((int32)*lutid,&t_ncomp,&t_nt,&t_il,&t_nentries);
+    *ncomp=(intf)t_ncomp;
+    *nt=(intf)t_nt;
+    *il=(intf)t_il;
+    *nentries=(intf)t_nentries;
+    return(status);
+}   /* end mgglinf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgwclut
+ * Purpose: Call GRwritelut to write data into a character palette
+ * Inputs:
+ *      lutid: LUT ID of the image
+ *      ncomp: number of components per palette entry
+ *      nt: number-type of components in palette entry
+ *      il: interlace of components in palette entry
+ *      nentries: number of palette entries
+ *      data: data to write
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRwritelut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgwclut(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data)
+{
+    return((intf)GRwritelut((int32)*lutid,(int32)*ncomp,(int32)*nt,(int32)*il,(int32)*nentries,(VOIDP)_fcdtocp(data)));
+}   /* end mgwrlut() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgwrlut
+ * Purpose: Call GRwritelut to write data into a palette
+ * Inputs:
+ *      lutid: LUT ID of the image
+ *      ncomp: number of components per palette entry
+ *      nt: number-type of components in palette entry
+ *      il: interlace of components in palette entry
+ *      nentries: number of palette entries
+ *      data: data to write
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRwritelut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgwrlut(intf * lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, VOIDP data)
+{
+    return((intf)GRwritelut((int32)*lutid,(int32)*ncomp,(int32)*nt,(int32)*il,(int32)*nentries,data));
+}   /* end mgwrlut() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgrclut
+ * Purpose: Call GRreadlut to read data from a character palette
+ * Inputs:
+ *      lutid: LUT ID of the image
+ *      data: data to read
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRreadlut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgrclut(intf * lutid, _fcd data)
+{
+    return((intf)GRreadlut((int32)*lutid,(VOIDP)_fcdtocp(data)));
+}   /* end mgrclut() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgrdlut
+ * Purpose: Call GRreadlut to read data from a palette
+ * Inputs:
+ *      lutid: LUT ID of the image
+ *      data: data to read
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRreadlut
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgrdlut(intf * lutid, VOIDP data)
+{
+    return((intf)GRreadlut((int32)*lutid,data));
+}   /* end mgrdlut() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgisxfil
+ * Purpose: Call GRsetexternalfile to convert an image into an external image
+ * Inputs:
+ *      riid: RI ID of the image
+ *      filename: filename of the external file
+ *      offset: offset in the external file to place image at
+ *      nlen: the length of the name
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRsetexternalfile
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgisxfil(intf * riid, _fcd filename, intf *offset, intf *nlen)
+{
+    char       *fn;
+    intf        ret;
+
+    /* Convert the FORTRAN string into a C string */
+    fn = HDf2cstring(filename, (intn)*nlen);
+    if (fn == NULL)
+        return FAIL;
+
+    ret=(intf)GRsetexternalfile((int32)*riid,fn,(int32)*offset);
+    HDfree(fn);
+
+    return(ret);
+}   /* end mgisxfil() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgsactp
+ * Purpose: Call GRsetaccesstype to determine access mode for an image
+ * Inputs:
+ *      riid: RI ID of the image
+ *      accesstype: the type of access to image data
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRsetaccesstype
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgsactp(intf * riid, intf *accesstype)
+{
+    return((intf)GRsetaccesstype((int32)*riid,(uintn)*accesstype));
+}   /* end mgsactp() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgiscatt
+ * Purpose: Call mgisatt to store a char attribute about an image
+ * Inputs:
+ *      riid: RI ID of the image
+ *      name: the name of the attribute
+ *      nt: the number-type of the attribute
+ *      count: the number of values in the attribute
+ *      data: the data for the attribute
+ *      nlen: the length of the name
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRsetattr
+ *---------------------------------------------------------------------------*/
+FRETVAL(intf)
+nmgiscatt(intf * riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen)
+{
+    return(nmgisattr(riid, name, nt, count, (VOIDP) _fcdtocp(data),
+                    nlen));
+}   /* end mgiscatt() */
+/*-----------------------------------------------------------------------------
+ * Name:    mgisattr
+ * Purpose: Call GRsetattr to store an attribute about an image
+ * Inputs:
+ *      riid: RI ID of the image
+ *      name: the name of the attribute
+ *      nt: the number-type of the attribute
+ *      count: the number of values in the attribute
+ *      data: the data for the attribute
+ *      nlen: the length of the name
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRsetattr
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgisattr(intf * riid, _fcd name, intf *nt, intf *count, VOIDP data, intf *nlen)
+{
+    char       *fn;
+    intf        ret;
+
+    /* Convert the FORTRAN string into a C string */
+    fn = HDf2cstring(name, (intn)*nlen);
+    if (fn == NULL)
+        return FAIL;
+
+    ret=(intf)GRsetattr((int32)*riid,fn,(int32)*nt,(int32)*count,data);
+    HDfree(fn);
+
+    return(ret);
+}   /* end mgisattr() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgatinf
+ * Purpose: Call GRattrinfo to get information about an attribute
+ * Inputs:
+ *      riid: RI ID of the image
+ *      index: the index of the attribute
+ *      name: the name of the attribute
+ *      nt: the number-type of the attribute
+ *      count: the number of values in the attribute
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRattrinfo
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgatinf(intf * riid, intf *index, _fcd name, intf *nt, intf *count)
+{
+    int32 t_nt, t_count;
+    intf        ret;
+
+    ret=(intf)GRattrinfo((int32)*riid,(int32)*index,(char *)_fcdtocp(name),&t_nt,&t_count);
+    *nt=(intf)t_nt;
+    *count=(intf)t_count;
+
+    return(ret);
+}   /* end mgatinf() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mggcatt
+ * Purpose: Call mggnatt to get a char attribute
+ * Inputs:
+ *      riid: RI ID of the image
+ *      index: the index of the attribute
+ *      data: the data for the attribute
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRgetattr
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmggcatt(intf * riid, intf *index, _fcd data)
+{
+    return(nmggnatt(riid, index, (VOIDP) _fcdtocp(data)));
+}   /* end mggcatt() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mggnatt
+ * Purpose: Call GRgetattr to get a numeric attribute
+ * Inputs:
+ *      riid: RI ID of the image
+ *      index: the index of the attribute
+ *      data: the data for the attribute
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRgetattr
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmggnatt(intf * riid, intf *index, VOIDP data)
+{
+    return((intf)GRgetattr((int32)*riid,(int32)*index,data));
+}   /* end mggnatt() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mggattr
+ * Purpose: Call GRgetattr to get an attribute
+ * Inputs:
+ *      riid: RI ID of the image
+ *      index: the index of the attribute
+ *      data: the data for the attribute
+ * Returns: SUCCEED on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRgetattr
+ * Remarks: This routine is replaced by mggcatt and mggmatt
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmggattr(intf * riid, intf *index, VOIDP data)
+{
+    return((intf)GRgetattr((int32)*riid,(int32)*index,data));
+}   /* end mggattr() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    mgifndat
+ * Purpose: Call GRfindattr to locate an attribute
+ * Inputs:
+ *      riid: RI ID of the image
+ *      name: the name for the attribute
+ *      nlen: the length of the name for the attribute
+ * Returns: attribute index on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: GRfindattr
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nmgifndat(intf * riid, _fcd name, intf *nlen)
+{
+    char       *fn;
+    intf        ret;
+
+    /* Convert the FORTRAN string into a C string */
+    fn = HDf2cstring(name, (intn)*nlen);
+    if (fn == NULL)
+        return FAIL;
+
+    ret=(intf)GRfindattr((int32)*riid,fn);
+    HDfree(fn);
+
+    return(ret);
+}   /* end mgifndat() */
+
+/*-------------------------------------------------------------------------
+ * Name:    mgcgichnk
+ * Puporse: Call GRgetchunkinfo
+ * Inputs:  id: access id to GR
+ * Outputs: dim_length: chunk dimensions
+ *          flags:            -1 - GR is nonchunked
+ *                             0 - GR is chunked, no compression
+ *                             1 - GR is chunked and compressed 
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+      nmgcgichnk(intf *id, intf *dim_length, intf *flags)
+#else
+       nmgcgichnk( id, dim_length, flags)
+       intf *id;       
+       intf *dim_length;
+       intf *flags;
+#endif /* PROTOTYPE */
+{
+
+    HDF_CHUNK_DEF chunk_def;  /* Chunk definition set */
+    int32 riid;               /* GR id               */
+    int   i;
+    int32 rank, status, cflags;
+    intf ret;
+
+    riid = *id;
+    rank = 2;
+
+    /* Get GR info */
+    status = GRgetchunkinfo(riid, &chunk_def, &cflags);
+    if(status == FAIL) return FAIL;
+
+    switch (cflags)  
+
+      {
+
+      case HDF_NONE:       /* Non-chunked GR */
+
+        *flags = -1;
+         ret = 0;
+         return(ret);
+
+      case HDF_CHUNK:    /* Chunked, noncompressed GR */
+
+        *flags = 0;
+         for (i=0; i < rank; i++)
+              dim_length[rank-i-1] = chunk_def.chunk_lengths[i];
+         ret = 0;
+         return(ret);
+
+      case (HDF_CHUNK | HDF_COMP):     /* Chunked and compressed GR */
+     
+         *flags = 1;
+         for (i=0; i < rank; i++)
+              dim_length[rank-i-1] =  chunk_def.comp.chunk_lengths[i];
+         ret = 0;
+         return(ret);
+
+      default:
+
+        return FAIL;
+            
+      }
+
+}   
+/*-----------------------------------------------------------------------------
+ * Name:     mgcrcchnk
+ * Purpose:  read the specified chunk of CHARACTER data to the buffer
+ * Inputs:   id        - access ID to GR
+ *           start     - origin of chunk to read 
+ * Outputs:  char_data  - buffer the data will be read into
+ * Calls:    scrchnk 
+ * Reamrks:  dimensions will be flipped in scrchnk function
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE 
+       nmgcrcchnk(intf *id, intf *start, _fcd char_data)
+#else
+       nmgcrcchnk(id, start, char_data)
+                intf *id;
+                intf *start;
+               _fcd  char_data;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret;
+
+       ret = nmgcrchnk(id, start, (VOIDP) _fcdtocp(char_data));
+
+       return(ret);
+
+} 
+
+/*-----------------------------------------------------------------------------
+ * Name:     mgcrchnk
+ * Purpose:  read the specified chunk of NUMERIC data to the buffer
+ * Inputs:   id        - access ID to GR
+ *           start     - origin of chunk to read 
+ * Outputs:  num_data  - buffer the data will be read into
+ * Calls:    GRreadchunk
+ * Remarks:  need to flip the dimensions to account for array ordering
+ *           differencies (start --> cstart)
+ *           If performance becomes an issue, use static cstart 
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmgcrchnk(intf *id, intf *start, VOIDP num_data)
+#else
+       nmgcrchnk(id, start, num_data)
+                intf *id;
+                intf *start;
+                VOIDP num_data;
+#endif /* PROTOTYPE */
+
+{
+       intf    ret;
+       int32   rank, i;
+       int32   *cstart;
+
+       rank = 2;
+/* Allocate memory for cstart array; use static array, if performance
+       becomes an issue */
+
+       cstart = (int32 *) HDmalloc(sizeof(int32) * rank);
+       if(!cstart) return FAIL;
+
+/* Flip an array to account for array odering in Fortran and C */
+
+       for ( i=0; i < rank; i++)
+             cstart[i] = start[rank-i-1] - 1;
+
+/* Call GRreadchunk function to read the data */
+
+       ret = GRreadchunk(*id, cstart, num_data);
+
+/* Free memory */
+
+       HDfree((VOIDP)cstart);
+       return(ret);
+
+} 
+
+/*-----------------------------------------------------------------------------
+ * Name:     mgcscchnk
+ * Purpose:  set the maximum number of chunks to cache 
+ * Inputs:   id        - access ID to GR
+ *           maxcache  - max number of chunks to cache
+ *           flags     - flags= 0, HDF_CACHEALL
+ *                       Currently only 0 can be passed
+ * Calls:    GRsetchunkcache
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmgcscchnk(intf *id, intf *maxcache, intf *flags)
+#else
+       nmgcscchnk(id, maxcache, flags)
+                intf *id;
+                intf *maxcache;
+                intf *flags;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret;
+
+       ret = GRsetchunkcache(*id, *maxcache, *flags);
+
+       return(ret);
+
+} 
+
+/*-------------------------------------------------------------------------
+ * Name:    mgcschnk
+ * Puporse: Call GRsetchunk
+ * Inputs:  id: access id to GR
+ *          dim_length: chunk dimensions
+ *          comp_type:  type of compression
+ *                              COMP_CODE_NONE    (0)
+ *                              COMP_CODE_RLE     (1)
+ *                              COMP_CODE_SKPHUFF (3)
+ *                              COMP_CODE_DEFLATE (4)
+ *                              COMP_CODE_INVALID (5)
+ *          comp_prm:   compression parameters array
+ *          comp_prm[0] = skphuff_skp_size: size of individual elements for 
+ *                            Adaptive Huffman compression algorithm
+ *          comp_prm[0] = deflate_level:    GZIP  compression parameter
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+      nmgcschnk(intf *id, intf *dim_length, intf *comp_type,
+                intf *comp_prm)
+#else
+       nmgcschnk( id, dim_length, comp_type,
+                 comp_prm)
+       intf *id;
+       intf *dim_length;
+       intf *comp_type;
+       intf *comp_prm;
+#endif /* PROTOTYPE */
+{
+
+    HDF_CHUNK_DEF chunk_def;  /* Chunk definition set */
+    int32 riid;               /* GR id               */
+    int32 cflags;             /* chunk flags          */
+    int   i, CASE;
+    int32 rank;
+    intf ret;
+
+    rank   = 2;
+    CASE   = *comp_type;
+    riid  = *id;
+    cflags = HDF_CHUNK | HDF_COMP;
+
+    switch (CASE)  {
+
+       case 0:       /* No compression */
+         cflags = HDF_CHUNK;
+         for (i=0; i < rank; i++)
+               chunk_def.chunk_lengths[i] = dim_length[rank-i-1]; 
+         break;
+    
+       case 1:       /* RLE compression */
+         for (i=0; i < rank; i++)
+                chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1];
+
+         chunk_def.comp.comp_type = COMP_CODE_RLE;
+
+         break;
+
+#ifdef GRsetchunk_does_not_support_NBIT
+
+       case 2:      /* N-bit encoding */
+         for (i=0; i < rank; i++)
+                chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1]; 
+
+         chunk_def.comp.comp_type = COMP_CODE_NBIT;
+         chunk_def.comp.cinfo.nbit.sign_ext = comp_prm[0];
+         chunk_def.comp.cinfo.nbit.fill_one = comp_prm[1];
+         chunk_def.comp.cinfo.nbit.start_bit = comp_prm[2];
+         chunk_def.comp.cinfo.nbit.bit_len = comp_prm[3];  
+
+         break; 
+ 
+#endif
+       case 3:      /* Skipping Huffman encoding */
+          for (i=0; i < rank; i++)
+                chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1];
+
+          chunk_def.comp.comp_type = COMP_CODE_SKPHUFF;
+          chunk_def.comp.cinfo.skphuff.skp_size = comp_prm[0];
+
+          break;
+
+       case 4:      /* GZIP compression */  
+          for (i=0; i < rank; i++)
+                 chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1];
+           
+          chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+          chunk_def.comp.cinfo.deflate.level = comp_prm[0];
+
+          break;
+
+       default:
+
+          return FAIL;
+                    
+     }
+
+    ret = GRsetchunk(riid, chunk_def, cflags);
+     
+    return(ret);
+
+}   
+/*-----------------------------------------------------------------------------
+ * Name:     mgcwcchnk
+ * Purpose:  write the specified chunk of CHARACTER data to the GR 
+ * Inputs:   id        - access ID to GR
+ *           start     - origin of chunk to read 
+ * Outputs:  char_data  - buffer the data will be read into
+ * Calls:    mgcwchnk 
+ * Reamrks:  dimensions will be flipped in scrchnk function
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmgcwcchnk(intf *id, intf *start, _fcd char_data)
+#else
+       nmgcwcchnk(id, start, char_data)
+                intf *id;
+                intf *start;
+               _fcd  char_data;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret;
+
+       ret = nmgcwchnk(id, start, (VOIDP) _fcdtocp(char_data));
+
+       return(ret);
+
+} 
+
+/*-----------------------------------------------------------------------------
+ * Name:     mgcwchnk
+ * Purpose:  write the specified chunk of NUMERIC data to the GR
+ * Inputs:   id        - access ID to GR
+ *           start     - origin of chunk to write
+ *           num_data  - buffer for data
+ * Calls:    GRwritechunk
+ * Remarks:  need to flip the dimensions to account for array ordering
+ *           differencies (start --> cstart)
+ *           If performance becomes an issue, use static cstart 
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmgcwchnk(intf *id, intf *start, VOIDP num_data)
+#else
+       nmgcwchnk(id, start, num_data)
+                intf *id;
+                intf *start;
+                VOIDP num_data;
+#endif /* PROTOTYPE */
+
+{
+       intf    ret;
+       int32   rank, i;
+       int32   *cstart;
+
+       rank = 2;
+/* Allocate memory for cstart array; use static array, if performance
+       becomes an issue */
+
+       cstart = (int32 *) HDmalloc(sizeof(int32) * rank);
+       if(!cstart) return FAIL;
+
+/* Flip an array */
+
+       for ( i=0; i < rank; i++)
+             cstart[i] = start[rank-i-1] - 1;
+
+/* Call GRwritechunk function to write the data */
+
+       ret = GRwritechunk(*id, cstart, num_data);
+
+/* Free memory */ 
+
+       HDfree((VOIDP)cstart);
+
+       return(ret);
+
+} 
+/*-------------------------------------------------------------------------
+ * Name:    mgcscompress
+ * Puporse: Call GRsetcompress
+ * Inputs:  id: access id to GR
+ *          comp_type:  type of compression
+ *                      COMP_CODE_NONE = 0
+ *                      COMP_CODE_RLE  = 1
+ *                      COMP_CODE_SKPHUFF = 3
+ *                      COMP_CODE_DEFLATE = 4
+ *                      COMP_CODE_JPEG    = 7 
+ *          comp_prm:   compression parameters array
+ *          comp_prm[0]=skphuff_skp_size: size of individual elements for 
+ *                            Adaptive Huffman compression algorithm
+ *          comp_prm[0]=deflate_level:    GZIP  compression parameter
+ *          comp_prm[0]=quality           JPEG parameters
+ *          comp_prm[1]=baseline      
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmgcscompress(intf *id, intf *comp_type, intf *comp_prm)
+#else
+       nmgcscompress( id, comp_type, comp_prm)
+       intf *id;
+       intf *comp_type;
+       intf *comp_prm;
+#endif /* PROTOTYPE */
+{
+    int32 riid;               /*  GR id               */
+    comp_info c_info;         /* compression info     */
+    comp_coder_t c_type;              /* compression type definition */
+
+    int CASE;
+    intf ret;
+
+
+
+    CASE = *comp_type;
+    riid = *id;
+    switch (CASE)  {
+
+       case COMP_CODE_NONE:       /* No compression */
+         c_type = COMP_CODE_NONE;
+         break;
+    
+       case COMP_CODE_RLE:             /* RLE compression */
+         c_type = COMP_CODE_RLE;
+         break;
+ 
+       case COMP_CODE_SKPHUFF:      /* Skipping Huffman encoding */
+          c_type = COMP_CODE_SKPHUFF;
+          c_info.skphuff.skp_size = comp_prm[0];
+          break;
+
+       case COMP_CODE_DEFLATE:      /* GZIP compression */  
+          c_type = COMP_CODE_DEFLATE;
+          c_info.deflate.level = comp_prm[0];
+          break;
+
+       case COMP_CODE_JPEG:      /* JPEG compression */  
+          c_type = COMP_CODE_JPEG;
+          c_info.jpeg.quality = comp_prm[0];
+          c_info.jpeg.force_baseline = comp_prm[1];
+          break;
+
+       default:
+
+          return FAIL;
+                    
+     }
+
+    ret = GRsetcompress(riid, c_type, &c_info);
+    return(ret);
+
+}   
+/*-------------------------------------------------------------------------
+ * Name:    mgcgcompress
+ * Puporse: Call GRgetcompinfo
+ * Inputs:  id: access id to GR
+ * Outputs: comp_type:  type of compression
+ *                      COMP_CODE_NONE = 0
+ *                      COMP_CODE_RLE  = 1
+ *                      COMP_CODE_SKPHUFF = 3
+ *                      COMP_CODE_DEFLATE = 4
+ *                      COMP_CODE_JPEG    = 7 
+ *          comp_prm:   compression parameters array
+ *          comp_prm[0]=skphuff_skp_size: size of individual elements for 
+ *                            Adaptive Huffman compression algorithm
+ *          comp_prm[0]=deflate_level:    GZIP  compression parameter
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmgcgcompress(intf *id, intf *comp_type, intf *comp_prm)
+#else
+       nmgcgcompress( id, comp_type, comp_prm)
+       intf *id;
+       intf *comp_type;
+       intf *comp_prm;
+#endif /* PROTOTYPE */
+{
+    comp_info c_info;         /* compression info     */
+    comp_coder_t c_type;              /* compression type definition */
+
+    int CASE;
+    intf ret = -1;
+    intn c_ret;
+
+
+    c_ret = GRgetcompinfo(*id, &c_type, &c_info);
+
+    if (c_ret == 0) {
+    CASE = (int)c_type;
+    switch (CASE)  {
+
+       case COMP_CODE_NONE:       /* No compression */
+         *comp_type = 0;
+         ret = 0;
+         break;
+    
+       case COMP_CODE_RLE:             /* RLE compression */
+         *comp_type = 1;
+         ret = 0;
+         break;
+ 
+       case COMP_CODE_SKPHUFF:      /* Skipping Huffman encoding */
+          *comp_type = 3;
+          comp_prm[0] = (intf)c_info.skphuff.skp_size;
+          ret = 0;
+          break;
+
+       case COMP_CODE_DEFLATE:      /* GZIP compression */  
+          *comp_type = 4;
+          comp_prm[0] = (intf)c_info.deflate.level;
+          ret = 0;
+          break;
+
+       case COMP_CODE_JPEG:      /* JPEG compression */  
+          *comp_type = 7;
+          ret = 0;
+          break;
+
+       default:
+
+          return FAIL;
+                    
+     } /*end CASE */
+    } /*end if */
+    return(ret);
+
+}   
+/*-------------------------------------------------------------------------
+ * Name:    mglt2rf
+ * Puporse: Call GRluttoref
+ * Inputs:  id: LUT id returned by GRgetlutid(mggltid) 
+ * Returns: valid reference number if a pallette exists or 0 (DFREF_WILDCARD)
+ *          if one doesn't / FAIL
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmglt2rf(intf *id)
+#else
+       nmglt2rf( id)
+       intf *id;
+#endif /* PROTOTYPE */
+{
+   intf ret;
+
+   ret = GRluttoref ( *id );
+   return(ret);
+}
+/*-------------------------------------------------------------------------
+ * Name:    mgcgnluts
+ * Puporse: Call GRgetnluts
+ * Inputs:  id: image identifier
+ * Returns: number of palettes on success and -1 if fails.
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nmgcgnluts(intf *id)
+#else
+       nmgcgnluts( id)
+       intf *id;
+#endif /* PROTOTYPE */
+{
+   intf ret = -1;
+   intn c_ret;
+
+   c_ret = GRgetnluts ( *id );
+   if(c_ret >= 0) ret = c_ret;
+   return(ret);
+}
diff --git a/hdf/src/mfgrff.f b/hdf/src/mfgrff.f
new file mode 100644
index 0000000..40ba1a6
--- /dev/null
+++ b/hdf/src/mfgrff.f
@@ -0,0 +1,416 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: mfgrff.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+C------------------------------------------------------------------------------
+C File:     mfgrff.f
+C Purpose:  Fortran stubs for Fortran GR routines
+C Invokes:  mfgrf.c
+C Contents: 
+C   dsgdims:        get dimensions of next SDG
+C Remarks: none
+C------------------------------------------------------------------------------
+
+
+
+C------------------------------------------------------------------------------
+C Name: mgcreat
+C Purpose:  Create a new raster image
+C Inputs:   
+C       grid: GR ID of interface to create image in
+C       name: name of raster image
+C       ncomp: number of components per pixel
+C       nt: number-type of each component
+C       il: interlace scheme to use
+C       dimsizes[2]: dimensions of the image to create
+C Returns: RI ID on success, -1 on failure
+C Users:    HDF Fortran programmers
+C Invokes: mgicreat
+C------------------------------------------------------------------------------
+
+      integer function mgcreat(grid, name, ncomp, nt, il, dimsizes)
+      character*(*) name
+      integer grid, ncomp, nt, il, dimsizes, mgicreat
+
+      mgcreat = mgicreat(grid, name, ncomp, nt, il, dimsizes,
+     +                                              len(name))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: mgn2ndx
+C Purpose:  Map the name of a raster image to an index in the file
+C Inputs:   
+C       grid: GR ID of interface to create image in
+C       name: name of raster image
+C Returns: index of image on success, -1 on failure
+C Users:    HDF Fortran programmers
+C Invokes: mgin2ndx
+C------------------------------------------------------------------------------
+
+      integer function mgn2ndx(grid, name)
+      character*(*) name
+      integer grid, mgin2ndx
+
+      mgn2ndx = mgin2ndx(grid, name, len(name))
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: mgsxfil
+C Purpose:  Convert a standard image into an external image
+C Inputs:   
+C       riid: RI ID of image to move
+C       filename: filename of file to move image into
+C       offset: offset in file to move image to
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgisxfil
+C-------------------------------------------------------------
+
+      integer function mgsxfil(riid, filename, offset)
+      character*(*) filename
+      integer riid, mgisxfil, offset
+
+      mgsxfil = mgisxfil(riid, filename, offset, len(filename))
+      return
+      end
+
+C-------------------------------------------------------------
+C Name: mgscatt
+C Purpose:  Add a char type attribute to a raster image
+C Inputs:   
+C       riid: RI ID of image
+C       name: the name of the attribute
+C       nt: the number-type of the attribute
+C       count: the number of values in the attribute
+C       data: the data for the attribute
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgiscatt
+C-------------------------------------------------------------
+
+      integer function mgscatt(riid, name, nt, count, data)
+      character*(*) name
+      character*(*) data
+      integer riid, mgiscatt, nt, count
+
+      mgscatt = mgiscatt(riid, name, nt, count, data, len(name))
+      return
+      end
+
+C-------------------------------------------------------------
+C Name: mgsnatt
+C Purpose:  Add a numeric attribute to a raster image
+C Inputs:   
+C       riid: RI ID of image
+C       name: the name of the attribute
+C       nt: the number-type of the attribute
+C       count: the number of values in the attribute
+C       data: the data for the attribute
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgisattr
+C-------------------------------------------------------------
+
+      integer function mgsnatt(riid, name, nt, count, data)
+      character*(*) name
+      integer data
+      integer riid, mgisattr, nt, count
+
+      mgsnatt = mgisattr(riid, name, nt, count, data, len(name))
+      return
+      end
+
+C-------------------------------------------------------------
+C Name: mgsattr
+C Purpose:  Add an attribute to a raster image
+C Inputs:   
+C       riid: RI ID of image
+C       name: the name of the attribute
+C       nt: the number-type of the attribute
+C       count: the number of values in the attribute
+C       data: the data for the attribute
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgisattr
+C-------------------------------------------------------------
+
+      integer function mgsattr(riid, name, nt, count, data)
+      character*(*) name
+      character*(*) data
+      integer riid, mgisattr, nt, count
+
+      mgsattr = mgisattr(riid, name, nt, count, data, len(name))
+      return
+      end
+C---------------------------------------------------------------
+C Name: mgfndat
+C Purpose:  Locate an attribute for a raster image
+C Inputs:   
+C       riid: RI ID of image
+C       name: the name of the attribute
+C Returns: SUCCEED/FAIL
+C Users:    HDF Fortran programmers
+C Invokes: mgifndat
+C------------------------------------------------------------------------------
+
+      integer function mgfndat(riid, name)
+      character*(*) name
+      integer riid, mgifndat
+
+      mgfndat = mgifndat(riid, name, len(name))
+      return
+      end
+
+C-------------------------------------------------------------------------
+C        Name:      mggichnk
+C        Purpose:   get Info on GR 
+C        Inputs:    riid       - access ID to GR
+C        Outputs:   dim_length - chunk dimensions (if any)
+C                   comp_type: 
+C                               -1 - GR is non-chunked
+C                                0 - GR is chunked without compression
+C                                1 - GR is chunked and compressed 
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcgichnk (C stub for GRgetchunkinfo function)
+C-------------------------------------------------------------------------
+
+         INTEGER function mggichnk(riid, dim_length, comp_type)
+
+         INTEGER riid, dim_length(*), comp_type
+         INTEGER mgcgichnk 
+
+
+         mggichnk = mgcgichnk(riid, dim_length, comp_type)
+         return
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      mgrcchnk
+C        Purpose:   read the specified chunk of CHARACTER data to the GR 
+C        Inputs:    riid      - access ID to GR
+C                   start     - chunk coordinates 
+C                   char_data - buffer the data will be read into  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcrcchnk (C stub for GRreadchunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function mgrcchnk(riid, start, char_data)
+
+         INTEGER riid, start(*)
+         CHARACTER*(*) char_data(*)
+         INTEGER mgcrcchnk 
+
+         mgrcchnk = mgcrcchnk(riid, start, char_data) 
+
+         return 
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      mgrchnk
+C        Purpose:   read the specified chunk of NUMERIC data to the GR 
+C        Inputs:    riid     - access ID to GR
+C                   start    - chunk coordinates 
+C                   num_data - buffer the  numeric data will be read into  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcrchnk (C stub for GRreadchunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function mgrchnk(riid, start, num_data)
+
+         INTEGER riid, start(*), num_data(*)
+         INTEGER mgcrchnk 
+
+         mgrchnk = mgcrchnk(riid, start, num_data) 
+
+         return 
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      mgscchnk
+C        Purpose:   set the maximum number of chunks to cache
+C        Inputs:    riid     - access ID to GR
+C                   maxcache - max number of chunks to cache 
+C                   flags    - flags =0, HDF_CACHEALL
+C                              Currently only 0 can be passed.
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcscchnk (C stub for GRsetchunkcache function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function mgscchnk(riid, maxcache, flags)
+C
+         INTEGER riid, maxcache, flags 
+         INTEGER mgcscchnk 
+C
+         mgscchnk = mgcscchnk(riid, maxcache, flags) 
+C
+         return 
+         end
+
+           
+
+C-------------------------------------------------------------------------
+C        Name:      mgschnk
+C        Purpose:   make the GR a chunked GR 
+C        Inputs:    riid       - access ID to GR
+C                   dim_length - chunk dimensions
+C                   comp_type  - type of compression         
+C                   comp_prm   - compression parameters array
+C                   Huffman:   comp_prm(1) = skphuff_skp_size
+C                   GZIP:      comp_prm(1) = deflate_level       
+C                                      
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcschnk (C stub for GRsetchunk function)
+C-------------------------------------------------------------------------
+
+         INTEGER function mgschnk(riid, dim_length, comp_type,
+     .                            comp_prm)
+
+         INTEGER riid, dim_length(*), comp_type, comp_prm(*)
+         INTEGER mgcschnk 
+         mgschnk = mgcschnk(riid, dim_length, comp_type,
+     .                      comp_prm)
+         return
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      mgwcchnk
+C        Purpose:   write the specified chunk of CHARACTER data to the GR 
+C        Inputs:    riid      - access ID to GR
+C                   start     - chunk coordinates 
+C                   char_data - buffer containing  data to be written  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcwcchnk (C stub for GRwritechunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function mgwcchnk(riid, start, char_data)
+
+         INTEGER riid, start(*) 
+         CHARACTER*(*) char_data(*)
+         INTEGER mgcwcchnk 
+
+         mgwcchnk = mgcwcchnk(riid, start, char_data) 
+
+         return 
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      mgwchnk
+C        Purpose:   write the specified chunk of NUMERIC data to the GR 
+C        Inputs:    riid     - access ID to GR
+C                   start    - chunk coordinates 
+C                   num_data - buffer containing data to be written  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcwchnk (C stub for GRwritechunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function mgwchnk(riid, start, num_data)
+
+         INTEGER riid, start(*), num_data(*)
+         INTEGER mgcwchnk 
+
+         mgwchnk = mgcwchnk(riid, start, num_data) 
+
+         return 
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      mgscompress
+C        Purpose:   compress GR 
+C        Inputs:    riid      - access ID to GR
+C                   comp_type - type of compression
+C                   supports the following compression types:
+C                            ( see hcomp.h  file) 
+C                            COMP_CODE_NONE = 0
+C                            COMP_CODE_RLE =1
+C                            COMP_CODE_SKPHUFF = 3
+C                            COMP_CODE_DEFLATE = 4
+C                            COMP_CODE_JPEG    = 7 
+C                   comp_prm  - compression parameters array
+C                   Huffman:   comp_prm(1) = skphuff_skp_size
+C                   GZIP:      comp_prm(1) = deflate_level       
+C                   JPEG:      comp_prm(1) = quality ( value from 0 to 100)
+C                              comp_prm(2) = baseline (compatibility flag 0 or 1)
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcscompress (C stub for GRsetcompress function)
+C-------------------------------------------------------------------------
+
+         INTEGER function mgscompress(riid, comp_type, comp_prm)
+
+         INTEGER riid, comp_type
+         INTEGER mgcscompress 
+
+         mgscompress = mgcscompress(riid, comp_type,
+     .                              comp_prm)
+         return
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      mggcompress
+C        Purpose:   gets compression information about GR image
+C        Inputs:    riid      - access ID to GR
+C        Outputs:  comp_type - type of compression
+C                   supports the following compression types:
+C                            ( see hcomp.h  file) 
+C                            COMP_CODE_NONE = 0
+C                            COMP_CODE_RLE =1
+C                            COMP_CODE_SKPHUFF = 3
+C                            COMP_CODE_DEFLATE = 4
+C                            COMP_CODE_JPEG    = 7 
+C                   comp_prm  - compression parameters array
+C                   Huffman:   comp_prm(1) = skphuff_skp_size
+C                   GZIP:      comp_prm(1) = deflate_level       
+C        Returns:   0 on success, -1 on failure
+C        Calls:     mgcgcompress (C stub for GRgetcompress function)
+C-------------------------------------------------------------------------
+
+         INTEGER function mggcompress(riid, comp_type, comp_prm)
+
+         INTEGER riid, comp_type, comp_prm(1)
+         INTEGER mgcgcompress 
+
+         mggcompress = mgcgcompress(riid, comp_type,
+     .                              comp_prm)
+         return
+         end
+C-------------------------------------------------------------------------
+C        Name:      mggnluts
+C        Purpose:   gets number of palettes (LUTs) for an image
+C        Inputs:    riid      - access ID to GR
+C        Returns:   Number of palettes on success (0 or 1), -1 on failure
+C        Calls:     mgcgnluts (C stub for GRgetnluts function)
+C-------------------------------------------------------------------------
+
+         INTEGER function mggnluts(riid)
+
+         INTEGER riid
+         INTEGER mgcgnluts 
+
+         mggnluts = mgcgnluts(riid)
+         return
+         end
+
+           
+           
diff --git a/hdf/src/mstdio.c b/hdf/src/mstdio.c
new file mode 100644
index 0000000..8306844
--- /dev/null
+++ b/hdf/src/mstdio.c
@@ -0,0 +1,348 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: mstdio.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+FILE
+   mstdio.c
+   HDF stdio-like modeling I/O routines
+
+REMARKS
+   Basically a NOP interface, it just calls the encoding layer.
+
+DESIGN
+   Just pass the data to the encoding layer, reporting errors.
+
+EXPORTED ROUTINES
+   None of these routines are designed to be called by other users except
+   for the top layer of the compression routines.
+
+    HCPmstdio_stread    -- start read access for compressed file
+    HCPmstdio_stwrite   -- start write access for compressed file
+    HCPmstdio_seek      -- Seek to offset within the data element
+    HCPmstdio_read      -- Read in a portion of data from a compressed 
+                            data element.
+    HCPmstdio_write     -- Write out a portion of data from a compressed 
+                            data element.
+    HCPmstdio_inquire   -- Inquire information about the access record 
+                            and data element.
+    HCPmstdio_endaccess -- Close the compressed data element
+
+AUTHOR
+   Quincey Koziol
+
+MODIFICATION HISTORY
+   9/28/93     Starting writing specs & coding prototype
+   10/09/93    Finished testing.  First version done.
+ */
+
+/* General HDF includes */
+#include "hdf.h"
+#include "hfile.h"
+
+#define MSTDIO_MASTER
+#define MODEL_CLIENT
+/* HDF compression includes */
+#include "hcompi.h"     /* Internal definitions for compression */
+
+/* #define TESTING */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPmstdio_stread -- start read access for compressed file
+
+ USAGE
+    int32 HCPmstdio_stread(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start read access on a compressed data element using the stdio modeling
+    scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPmstdio_stread(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPmstdio_stread");
+    compinfo_t *info;           /* information on the special element */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* set the offset */
+    info->minfo.model_info.stdio_info.pos = 0;
+
+#ifdef TESTING
+printf("%s(): info=%p\n", FUNC, info);
+#endif
+    if ((*(info->cinfo.coder_funcs.stread)) (access_rec) == FAIL)
+        HRETURN_ERROR(DFE_CODER, FAIL);
+    return (SUCCEED);
+}   /* HCPmstdio_stread() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPmstdio_stwrite -- start write access for compressed file
+
+ USAGE
+    int32 HCPmstdio_stwrite(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Start write access on a compressed data element using the stdio modeling
+    scheme.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPmstdio_stwrite(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPmstdio_stwrite");
+    compinfo_t *info;           /* information on the special element */
+
+    info = (compinfo_t *) access_rec->special_info;
+
+#ifdef TESTING
+printf("%s(): info=%p\n", FUNC, info);
+#endif
+    /* set the offset */
+    info->minfo.model_info.stdio_info.pos = 0;
+
+#ifdef TESTING
+printf("%s(): before coder_funcs.write=%p\n", FUNC, info->cinfo.coder_funcs.write);
+#endif
+    if ((*(info->cinfo.coder_funcs.stwrite)) (access_rec) == FAIL)
+        HRETURN_ERROR(DFE_CODER, FAIL);
+#ifdef TESTING
+printf("%s(): after coder_funcs.write=%p\n", FUNC, info->cinfo.coder_funcs.write);
+#endif
+    return (SUCCEED);
+}   /* HCPmstdio_stwrite() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPmstdio_seek -- Seek to offset within the data element
+
+ USAGE
+    int32 HCPmstdio_seek(access_rec,offset,origin)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 offset;       IN: the offset in bytes from the origin specified
+    intn origin;        IN: the origin to seek from [UNUSED!]
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Seek to a position with a compressed data element.  The 'origin'
+    calculations have been taken care of at a higher level, it is an
+    un-used parameter.  The 'offset' is used as an absolute offset
+    because of this.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPmstdio_seek(accrec_t * access_rec, int32 offset, int origin)
+{
+    CONSTR(FUNC, "HCPmstdio_seek");
+    compinfo_t *info;           /* information on the special element */
+    int32       ret;
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* set the offset */
+    info->minfo.model_info.stdio_info.pos = offset;
+
+    if ((ret = (*(info->cinfo.coder_funcs.seek)) (access_rec, offset, origin)) == FAIL)
+        HRETURN_ERROR(DFE_CODER, FAIL);
+    return (ret);
+}   /* HCPmstdio_seek() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPmstdio_read -- Read in a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPmstdio_read(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to read
+    void * data;             OUT: the buffer to place the bytes read
+
+ RETURNS
+    Returns the number of bytes read or FAIL
+
+ DESCRIPTION
+    Read in a number of bytes from a compressed data element, using
+    stdio functionality.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPmstdio_read(accrec_t * access_rec, int32 length, void * data)
+{
+    CONSTR(FUNC, "HCPmstdio_read");
+    compinfo_t *info;           /* information on the special element */
+    int32       ret;
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* adjust model position */
+    info->minfo.model_info.stdio_info.pos += length;
+
+    if ((ret = (*(info->cinfo.coder_funcs.read)) (access_rec, length, data)) == FAIL)
+        HRETURN_ERROR(DFE_CODER, FAIL);
+    return (ret);
+}   /* HCPmstdio_read() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPmstdio_write -- Write out a portion of data from a compressed data element.
+
+ USAGE
+    int32 HCPwrite(access_rec,length,data)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 length;           IN: the number of bytes to write
+    void * data;             IN: the buffer to retrieve the bytes written
+
+ RETURNS
+    Returns the number of bytes written or FAIL
+
+ DESCRIPTION
+    Write out a number of bytes to a compressed data element.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPmstdio_write(accrec_t * access_rec, int32 length, const void * data)
+{
+    CONSTR(FUNC, "HCPmstdio_write");
+    compinfo_t *info;           /* information on the special element */
+    int32       ret;
+
+    info = (compinfo_t *) access_rec->special_info;
+
+    /* adjust model position */
+    info->minfo.model_info.stdio_info.pos += length;
+
+#ifdef TESTING
+printf("%s(): before function ptr call func_ptr=%p\n", FUNC, info->cinfo.coder_funcs.write);
+#endif
+    if ((ret = (*(info->cinfo.coder_funcs.write)) (access_rec, length, data)) == FAIL)
+        HRETURN_ERROR(DFE_CODER, FAIL);
+#ifdef TESTING
+printf("%s(): after function ptr call, ret=%d\n",FUNC,(int)ret);
+#endif
+    return (ret);
+}   /* HCPmstdio_write() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPmstdio_inquire -- Inquire information about the access record and data element.
+
+ USAGE
+    int32 HCPmstdio_inquire(access_rec,pfile_id,ptag,pref,plength,poffset,pposn,
+            paccess,pspecial)
+    accrec_t *access_rec;   IN: the access record of the data element
+    int32 *pfile_id;        OUT: ptr to file id
+    uint16 *ptag;           OUT: ptr to tag of information
+    uint16 *pref;           OUT: ptr to ref of information
+    int32 *plength;         OUT: ptr to length of data element
+    int32 *poffset;         OUT: ptr to offset of data element
+    int32 *pposn;           OUT: ptr to position of access in element
+    int16 *paccess;         OUT: ptr to access mode
+    int16 *pspecial;        OUT: ptr to special code
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Inquire information about the access record and data element.
+    [Currently a NOP].
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+int32
+HCPmstdio_inquire(accrec_t * access_rec, int32 *pfile_id, uint16 *ptag,
+ uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                  int16 *pspecial)
+{
+    CONSTR(FUNC, "HCPmstdio_inquire");
+    compinfo_t *info;           /* information on the special element */
+    int32       ret;
+
+    info = (compinfo_t *) access_rec->special_info;
+    if ((ret = (*(info->cinfo.coder_funcs.inquire)) (access_rec, pfile_id, ptag, pref,
+                       plength, poffset, pposn, paccess, pspecial)) == FAIL)
+        HRETURN_ERROR(DFE_CODER, FAIL);
+    return (ret);
+}   /* HCPmstdio_inquire() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    HCPmstdio_endaccess -- Close the compressed data element
+
+ USAGE
+    intn HCPendaccess(access_rec)
+    accrec_t *access_rec;   IN: the access record of the data element
+
+ RETURNS
+    Returns SUCCEED or FAIL
+
+ DESCRIPTION
+    Close the compressed data element and free modelling info.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn
+HCPmstdio_endaccess(accrec_t * access_rec)
+{
+    CONSTR(FUNC, "HCPmstdio_endaccess");
+    compinfo_t *info;           /* information on the special element */
+    intn        ret;
+
+    info = (compinfo_t *) access_rec->special_info;
+    if ((ret = (*(info->cinfo.coder_funcs.endaccess)) (access_rec)) == FAIL)
+        HRETURN_ERROR(DFE_CODER, FAIL);
+    return (ret);
+}   /* HCPmstdio_endaccess() */
diff --git a/hdf/src/mstdio.h b/hdf/src/mstdio.h
new file mode 100644
index 0000000..6ec6e26
--- /dev/null
+++ b/hdf/src/mstdio.h
@@ -0,0 +1,89 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: mstdio.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*-----------------------------------------------------------------------------
+ * File:    mstdio.h
+ * Purpose: Header file for stdio-like modeling information.
+ * Dependencies: should be included after hdf.h
+ * Invokes:
+ * Contents: Structures & definitions for stdio modeling.  This header
+ *              should only be included in hcomp.c and mstdio.c.
+ * Structure definitions:
+ * Constant definitions:
+ *---------------------------------------------------------------------------*/
+
+/* avoid re-inclusion */
+#ifndef __MSTDIO_H
+#define __MSTDIO_H
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+   ** from mstdio.c
+ */
+
+    extern int32 HCPmstdio_stread
+                (accrec_t * rec);
+
+    extern int32 HCPmstdio_stwrite
+                (accrec_t * rec);
+
+    extern int32 HCPmstdio_seek
+                (accrec_t * access_rec, int32 offset, int origin);
+
+    extern int32 HCPmstdio_inquire
+                (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
+               int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
+                 int16 *pspecial);
+
+    extern int32 HCPmstdio_read
+                (accrec_t * access_rec, int32 length, void * data);
+
+    extern int32 HCPmstdio_write
+                (accrec_t * access_rec, int32 length, const void * data);
+
+    extern intn HCPmstdio_endaccess
+                (accrec_t * access_rec);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+/* model information about stdio model */
+typedef struct
+{
+    int32      pos;            /* postion ? */
+}
+comp_model_stdio_info_t;
+
+#ifndef MSTDIO_MASTER
+extern funclist_t mstdio_funcs; /* functions to perform run-length encoding */
+#else
+funclist_t  mstdio_funcs =
+{                               /* functions to perform run-length encoding */
+    HCPmstdio_stread,
+    HCPmstdio_stwrite,
+    HCPmstdio_seek,
+    HCPmstdio_inquire,
+    HCPmstdio_read,
+    HCPmstdio_write,
+    HCPmstdio_endaccess
+};
+#endif
+
+#endif /* __MSTDIO_H */
diff --git a/hdf/src/patchlevel.h b/hdf/src/patchlevel.h
new file mode 100644
index 0000000..98303a3
--- /dev/null
+++ b/hdf/src/patchlevel.h
@@ -0,0 +1,2 @@
+
+#define PATCHLEVEL  0
diff --git a/hdf/src/src.inc b/hdf/src/src.inc
new file mode 100644
index 0000000..42d6704
--- /dev/null
+++ b/hdf/src/src.inc
@@ -0,0 +1,136 @@
+# ****************************************************************************
+# * NCSA HDF                                                                 *
+# * Software Development Group                                               *
+# * National Center for Supercomputing Applications                          *
+# * University of Illinois at Urbana-Champaign                               *
+# * 605 E. Springfield, Champaign IL 61820                                   *
+# *                                                                          *
+# * For conditions of distribution and use, see the accompanying             *
+# * hdf/COPYING file.                                                        *
+# *                                                                          *
+# ***************************************************************************
+#
+# $Id: src.inc 4445 2003-12-10 21:15:54Z epourmal $
+#
+# ##################################################################
+#
+#           Part of MAKEFILE for creating the HDF library, libdf.a,
+#
+# This file contains the definitions of all the source code and headers
+# used in the actual makefile.  They are located here for ease of maintainence.
+#
+# ##################################################################
+#
+#
+
+# Header files not included for copying to 'include' directory during installation
+# These are private to the library and users do need them
+HDRS_NO= glist.h mcache.h hqueue.h
+
+HDRS=$(H_HDRS) $(DF_HDRS) $(DFAN_HDRS) $(DFRI_HDRS) $(DFSD_HDRS) $(V_HDRS) \
+     $(MFAN_HDRS) $(MFGR_HDRS)
+
+H_HDRS=hfile.h hdf.h hdfi.h herr.h hproto.h hcomp.h hconv.h hbitio.h \
+       tbbt.h crle.h cnbit.h mstdio.h cnone.h cskphuff.h cdeflate.h \
+       hlimits.h hntdefs.h htags.h hkit.h hcompi.h bitvect.h atom.h \
+       dynarray.h linklist.h hchunks.h vattr.h cszip.h
+
+DF_HDRS=df.h dfi.h dfstubs.h dfufp2i.h
+DFAN_HDRS=dfan.h
+DFRI_HDRS=dfrig.h dfgr.h
+DFSD_HDRS=dfsd.h
+V_HDRS=vg.h
+MFAN_HDRS=mfan.h
+MFGR_HDRS=mfgr.h
+
+CSRCS = $(HCSRCS) $(VCSRCS) $(DFCSRCS) $(MFCSRCS)
+HCSRCS=hfile.c herr.c hblocks.c hbuffer.c hcompri.c hextelt.c hkit.c hdfalloc.c \
+    hcomp.c hbitio.c tbbt.c hdfalloc.c hcomp.c crle.c cnbit.c mstdio.c cnone.c \
+    cskphuff.c cdeflate.c bitvect.c atom.c hfiledd.c dynarray.c linklist.c \
+    glist.c hchunks.c mcache.c cszip.c
+
+VCSRCS=vg.c vrw.c vio.c vparse.c vconv.c vsfld.c vgp.c vhi.c vattr.c
+
+DFCSRCS=$(DFG_CSRCS) $(DFAN_CSRCS) $(DFSD_CSRCS) $(DFRI_CSRCS)
+DFG_CSRCS=dfgroup.c dfconv.c dfufp2i.c dfutil.c dfstubs.c dfknat.c dfkswap.c \
+          dfkcray.c dfkvms.c dfkconv.c dfkfuji.c 
+DFAN_CSRCS=dfan.c
+DFSD_CSRCS=dfsd.c
+DFRI_CSRCS=dfr8.c dfcomp.c dfrle.c dfimcomp.c dfjpeg.c dfunjpeg.c dfp.c \
+           dfgr.c df24.c
+
+MFCSRCS= $(MFAN_CSRCS) $(MFGR_CSRCS)
+MFAN_CSRCS=mfan.c
+MFGR_CSRCS=mfgr.c
+
+COBJS = $(HCOBJS) $(VCOBJS) $(DFCOBJS) $(MFCOBJS)
+HCOBJS=hfile.o herr.o hblocks.o hbuffer.o hcompri.o hextelt.o hkit.o hdfalloc.o \
+    hcomp.o hbitio.o tbbt.o crle.o cnbit.o mstdio.o cnone.o cskphuff.o \
+    cdeflate.o bitvect.o atom.o hfiledd.o dynarray.o linklist.o glist.o \
+    hchunks.o mcache.o cszip.o
+
+VCOBJS=vg.o vrw.o vio.o vparse.o vconv.o vsfld.o vgp.o vhi.o vattr.o
+
+DFCOBJS=$(DFG_COBJS) $(DFAN_COBJS) $(DFSD_COBJS) $(DFRI_COBJS)
+DFG_COBJS=dfgroup.o dfconv.o dfufp2i.o dfutil.o dfstubs.o dfknat.o dfkswap.o \
+          dfkcray.o dfkvms.o dfkconv.o dfkfuji.o 
+DFAN_COBJS=dfan.o
+DFSD_COBJS=dfsd.o
+DFRI_COBJS=dfr8.o dfcomp.o dfrle.o dfimcomp.o dfjpeg.o dfunjpeg.o dfp.o \
+           dfgr.o df24.o
+
+MFCOBJS= $(MFAN_COBJS) $(MFGR_COBJS)
+MFAN_COBJS=mfan.o
+MFGR_COBJS=mfgr.o
+
+FSRCS = $(FCSRCS) $(FFSRCS)
+FCSRCS=$(H_FCSRCS) $(V_FCSRCS) $(DF_FCSRCS) $(DFAN_FCSRCS) $(DFSD_FCSRCS) \
+       $(DFRI_FCSRCS) $(MFAN_FCSRCS) $(MFGR_FCSRCS)
+H_FCSRCS=hfilef.c herrf.c
+V_FCSRCS=vgf.c vattrf.c
+DF_FCSRCS=dff.c dfutilf.c
+DFAN_FCSRCS=dfanf.c
+DFSD_FCSRCS=dfsdf.c
+DFRI_FCSRCS=dfr8f.c dfpf.c df24f.c
+MFAN_FCSRCS=mfanf.c
+MFGR_FCSRCS=mfgrf.c
+
+FFSRCS=$(H_FFSRCS) $(V_FFSRCS) $(DF_FFSRCS) $(DFAN_FFSRCS) $(DFSD_FFSRCS) \
+       $(DFRI_FFSRCS) $(MFAN_FFSRCS) $(MFGR_FFSRCS)
+H_FFSRCS=hfileff.f 
+V_FFSRCS=vgff.f vattrff.f
+DF_FFSRCS=dfff.f dfufp2if.f
+DFAN_FFSRCS=dfanff.f
+DFSD_FFSRCS=dfsdff.f
+DFRI_FFSRCS=df24ff.f dfpff.f dfr8ff.f
+MFAN_FFSRCS=
+MFGR_FFSRCS=mfgrff.f
+
+FOBJS = $(FCOBJS) $(FFOBJS)
+
+FCOBJS=$(H_FCOBJS) $(V_FCOBJS) $(DF_FCOBJS) $(DFAN_FCOBJS) $(DFSD_FCOBJS) \
+       $(DFRI_FCOBJS) $(MFAN_FCOBJS) $(MFGR_FCOBJS)
+H_FCOBJS=hfilef.o herrf.o 
+V_FCOBJS=vgf.o vattrf.o
+DF_FCOBJS=dff.o dfutilf.o
+DFAN_FCOBJS=dfanf.o
+DFSD_FCOBJS=dfsdf.o
+DFRI_FCOBJS=dfr8f.o dfpf.o df24f.o
+MFAN_FCOBJS=mfanf.o
+MFGR_FCOBJS=mfgrf.o
+
+FFOBJS=$(H_FFOBJS) $(V_FFOBJS) $(DF_FFOBJS) $(DFAN_FFOBJS) $(DFSD_FFOBJS) \
+       $(DFRI_FFOBJS) $(MFAN_FFOBJS) $(MFGR_FFOBJS)
+H_FFOBJS=hfileff.o 
+V_FFOBJS=vgff.o vattrff.o
+DF_FFOBJS=dfff.o dfufp2if.o
+DFAN_FFOBJS=dfanff.o
+DFSD_FFOBJS=dfsdff.o
+DFRI_FFOBJS=df24ff.o dfpff.o dfr8ff.o
+MFAN_FFOBJS=
+MFGR_FFOBJS=mfgrff.o
+
+F90INCS=dffunc.f90 hdf.f90
+FINCS=dffunc.inc hdf.inc $(F90INCS)
+
+
diff --git a/hdf/src/tbbt.c b/hdf/src/tbbt.c
new file mode 100644
index 0000000..091c37f
--- /dev/null
+++ b/hdf/src/tbbt.c
@@ -0,0 +1,1038 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: tbbt.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/* "tbbt.c" -- Routines for using threaded, balanced, binary trees. */
+/* Extended from (added threads to) Knuth 6.2.3, Algorithm A (AVL trees) */
+/* Basic tree structure by Adel'son-Vel'skii and Landis */
+
+#include <stdio.h>  /* NULL */
+#include "hdf.h"
+#define TBBT_INTERNALS
+#include "tbbt.h"
+#define   Alloc(cnt,typ)   (typ *) HDmalloc( (cnt) * sizeof(typ) )
+#define   Free(x)           (HDfree((VOIDP)x))
+
+# define   KEYcmp(k1,k2,a) ((NULL!=compar) ? (*compar)( k1, k2, a) \
+                 : HDmemcmp( k1, k2, 0<(a) ? (a) : (intn)HDstrlen(k1) )  )
+
+VOID        tbbt1dump
+            (TBBT_NODE * node, intn method);
+
+/* Function Prototypes */
+extern VOID tbbt_printNode(TBBT_NODE * node, VOID(*key_dump)(VOID *,VOID *));
+extern VOID tbbt_dumpNode(TBBT_NODE *node, VOID (*key_dump)(VOID *,VOID *),
+                          intn method);
+extern VOID tbbt_dump(TBBT_TREE *ptree, VOID (*key_dump)(VOID *,VOID *), 
+                      intn method);
+
+static TBBT_NODE *tbbt_get_node(void);
+static void tbbt_release_node(TBBT_NODE *nod);
+
+/* #define TESTING */
+
+/* Returns pointer to end-most (to LEFT or RIGHT) node of tree: */
+static TBBT_NODE *
+tbbt_end(TBBT_NODE * root, intn side)
+{
+    if (root == NULL)
+        return (NULL);
+    while (HasChild(root, side))
+      {
+          root = root->link[side];
+      }
+    return (root);
+}
+
+TBBT_NODE  *
+tbbtfirst(TBBT_NODE * root)
+{
+    return (tbbt_end(root, LEFT));
+}
+
+TBBT_NODE  *
+tbbtlast(TBBT_NODE * root)
+{
+    return (tbbt_end(root, RIGHT));
+}
+
+/* Return address of parent's pointer to neighboring node (to LEFT or RIGHT) **
+   static TBBT_NODE **tbbt_anbr(TBBT_NODE *ptr, intn side )
+   {
+   TBBT_NODE **aptr;
+
+   if(  ! HasChild( ptr, side )  )
+   return(  & ptr->link[side]  );
+   aptr= & ptr->link[side];
+   while(  HasChild( *aptr, Other(side) )  )
+   aptr= & (*aptr)->link[Other(side)];
+   return( aptr );
+   } */
+
+/* Returns pointer to neighboring node (to LEFT or RIGHT): */
+static TBBT_NODE *
+tbbt_nbr(TBBT_NODE * ptr, intn side)
+{
+    /* return( *tbbt_anbr(ptr,side) ); */
+
+    if (!HasChild(ptr, side))
+        return (ptr->link[side]);
+/*        return(NULL); */
+    ptr = ptr->link[side];
+    if(ptr==NULL)
+        return(NULL);
+    while (HasChild(ptr, Other(side)))
+        ptr = ptr->link[Other(side)];
+    return (ptr);
+}
+
+/* Returns pointer to node with previous key value: */
+TBBT_NODE  *
+tbbtnext(TBBT_NODE * node)
+{
+    return (tbbt_nbr(node, RIGHT));
+}
+
+/* Returns pointer to node with next key value: */
+TBBT_NODE  *
+tbbtprev(TBBT_NODE * node)
+{
+    return (tbbt_nbr(node, LEFT));
+}
+
+/* tbbtfind -- Look up a node in a tree based on a key value */
+/* tbbtffind is based on this routine - fix bugs in both places! */
+/* Returns a pointer to the found node (or NULL) */
+TBBT_NODE  *
+tbbtfind(TBBT_NODE * root, VOIDP key,
+     intn (*compar) (VOIDP, VOIDP, intn), intn arg, TBBT_NODE ** pp)
+{
+    TBBT_NODE  *ptr = root;
+    TBBT_NODE  *parent = NULL;
+    intn        cmp = 1;
+
+    if (ptr)
+      {
+          intn        side;
+
+          while (0 != (cmp = KEYcmp(key, ptr->key, arg)))
+            {
+                parent = ptr;
+                side = (cmp < 0) ? LEFT : RIGHT;
+                if (!HasChild(ptr, side))
+                    break;
+                ptr = ptr->link[side];
+            }
+      }
+    if (NULL != pp)
+        *pp = parent;
+    return ((0 == cmp) ? ptr : NULL);
+}
+
+/* tbbtffind -- Look up a node in a tree based on a key value */
+/* This routine is based on tbbtfind (fix bugs in both places!) */
+/* Returns a pointer to the found node (or NULL) */
+static TBBT_NODE  *
+tbbtffind(TBBT_NODE * root, VOIDP key, uintn fast_compare, TBBT_NODE ** pp)
+{
+    TBBT_NODE  *ptr = root;
+    TBBT_NODE  *parent = NULL;
+    intn        cmp = 1;
+
+    switch(fast_compare)
+      {
+        case TBBT_FAST_UINT16_COMPARE:
+            if (ptr)
+              {
+                  intn        side;
+
+                  while (0 != (cmp = (*(uint16 *)key - *(uint16 *)ptr->key)))
+                    {
+                        parent = ptr;
+                        side = (cmp < 0) ? LEFT : RIGHT;
+                        if (!HasChild(ptr, side))
+                            break;
+                        ptr = ptr->link[side];
+                    }
+              }
+            if (NULL != pp)
+                *pp = parent;
+            return ((0 == cmp) ? ptr : NULL);
+
+        case TBBT_FAST_INT32_COMPARE:
+            if (ptr)
+              {
+                  intn        side;
+
+                  while (0 != (cmp = (*(int32 *)key - *(int32 *)ptr->key)))
+                    {
+                        parent = ptr;
+                        side = (cmp < 0) ? LEFT : RIGHT;
+                        if (!HasChild(ptr, side))
+                            break;
+                        ptr = ptr->link[side];
+                    }
+              }
+            if (NULL != pp)
+                *pp = parent;
+            return ((0 == cmp) ? ptr : NULL);
+
+        default:
+            return(NULL);
+    } /* end switch */
+} /* tbbtffind() */
+
+/* tbbtdfind -- Look up a node in a "described" tree based on a key value */
+/* Returns a pointer to the found node (or NULL) */
+TBBT_NODE  *
+tbbtdfind(TBBT_TREE * tree, VOIDP key, TBBT_NODE ** pp)
+{
+    if (tree == NULL)
+        return (NULL);
+    if(tree->fast_compare!=0)
+        return (tbbtffind(tree->root, key, tree->fast_compare, pp));
+    else
+        return (tbbtfind(tree->root, key, tree->compar, tree->cmparg, pp));
+}
+
+/* tbbtless -- Find a node in a tree which is less than a key, */
+/*  based on a key value */
+/* Returns a pointer to the found node (or NULL) */
+TBBT_NODE  *
+tbbtless(TBBT_NODE * root, VOIDP key,
+     intn (*compar) (VOIDP, VOIDP, intn), intn arg, TBBT_NODE ** pp)
+{
+    TBBT_NODE  *ptr = root;
+    TBBT_NODE  *parent = NULL;
+    intn        cmp = 1;
+
+    if (ptr)
+      {
+          intn        side;
+
+          while (0 != (cmp = KEYcmp(key, ptr->key, arg)))
+            {
+                parent = ptr;
+                side = (cmp < 0) ? LEFT : RIGHT;
+                if (!HasChild(ptr, side))
+                    break;
+                ptr = ptr->link[side];
+            }
+      }
+    if(cmp!=0)
+	/* didn't find an exact match, search back up the tree until a node */
+	/* is found with a key less than the key searched for */
+      {
+	while((ptr=ptr->Parent)!=NULL) 
+	  {
+              cmp = KEYcmp(key, ptr->key, arg);
+	      if(cmp<0) /* found a node which is less than the search for one */
+		  break;
+	  } /* end while */
+	if(ptr==NULL) /* didn't find a node in the tree which was less */
+	  cmp=1;
+	else /* reset this for cmp test below */
+	  cmp=0;
+      } /* end if */
+    if (NULL != pp)
+        *pp = parent;
+    return ((0 == cmp) ? ptr : NULL);
+}
+
+/* tbbtdless -- Find a node less than a key in a "described" tree */
+/* Returns a pointer to the found node (or NULL) */
+TBBT_NODE  *
+tbbtdless(TBBT_TREE * tree, VOIDP key, TBBT_NODE ** pp)
+{
+    if (tree == NULL)
+        return (NULL);
+    return (tbbtless(tree->root, key, tree->compar, tree->cmparg, pp));
+}
+
+/* tbbtindx -- Look up the Nth node (in key order) */
+/* Returns a pointer to the `indx'th node (or NULL) */
+/* Bugs(fixed):
+   Added NULL check for 'ptr' in while loop to 
+     prevent endless loop condition. 
+   Fixed bug where we subtracted children count from the wrong side of the
+    tree. */
+TBBT_NODE  *
+tbbtindx(TBBT_NODE * root, int32 indx)
+{
+  TBBT_NODE  *ptr = root;
+
+  /* I believe indx is 1 based */
+  if (NULL == ptr || indx < 1)
+    return (NULL);
+  /* Termination condition is if the index equals the number of children on
+     out left plus the current node */
+  while (ptr != NULL && indx != ((int32) LeftCnt(ptr)) + 1 )
+    {
+      if (indx <= (int32) LeftCnt(ptr))
+        {
+#if 0
+          indx -= LeftCnt(ptr);  /* ??....bug */
+#endif
+          ptr = ptr->Lchild;
+        }
+      else if (HasChild(ptr, RIGHT))
+        { /* subtract children count from leftchild plus current node when
+             we descend into a right branch */
+          indx -= (int32)(LeftCnt(ptr) + 1);  
+          ptr = ptr->Rchild;
+        }
+      else
+        return (NULL);    /* Only `indx' or fewer nodes in tree */
+    }
+  return (ptr);
+}
+
+/* swapkid -- Often refered to as "rotating" nodes.  ptr and ptr's `side'
+ * child, kid, are swapped so ptr becomes kid's `Other(side)' child.
+ * Here is how a single swap (rotate) works:
+ *
+ *           |           --side-->         |
+ *         (ptr)                         (kid)
+ *        /     \                       /     \
+ *    +-A-+    (kid)                 (ptr)    +-C-+
+ *    |   |   /     \               /     \   |   |
+ *    |...| +-B-+  +-C-+         +-A-+  +-B-+ |...|
+ *          |   |  |   |         |   |  |   |
+ *          |...|  |...|         |...|  |...|
+ * `deep' contains the relative depths of the subtrees so, since we set
+ * `deep[1]' (the relative depth of subtree [B]) to 0, `deep[2]' is the depth
+ * of [C] minus the depth of [B] (-1, 0, or 1 since `kid' is never too out of
+ * balance) and `deep[0]' is the depth of [A] minus the depth of [B].  These
+ * values are used to compute the balance levels after the rotation.  Note that
+ * [A], [B], or [C] can have depth 0 so `link[]' contains threads rather than
+ * pointers to children.
+ */
+static TBBT_NODE *
+swapkid(TBBT_NODE ** root, TBBT_NODE * ptr, intn side)
+{
+    TBBT_NODE  *kid = ptr->link[side];  /* Sibling to be swapped with parent */
+    intn        deep[3];        /* Relative depths of three sub-trees involved. */
+    /* 0:ptr->link[Other(side)], 1:kid->link[Other(side)], 2:kid->link[side] */
+    TBBT_FLAG   ptrflg;         /* New value for ptr->flags (ptr->flags used after set) */
+    TBBT_LEAF   plcnt, prcnt,   /* current values of the ptr's and kid's leaf count */
+                klcnt, krcnt;
+
+    deep[2] = (deep[1] = 0) + Delta(kid, side);
+    deep[0] = Max(0, deep[2]) + 1 - Delta(ptr, side);
+    kid->Parent = ptr->Parent;
+    ptrflg = (TBBT_FLAG)SetFlags(ptr, side, deep[0],
+                  HasChild(ptr, Other(side)) && HasChild(kid, Other(side)));
+    plcnt = LeftCnt(ptr);
+    prcnt = RightCnt(ptr);
+    klcnt = LeftCnt(kid);
+    krcnt = RightCnt(kid);
+    if (HasChild(kid, Other(side)))
+      {
+          ptr->link[side] = kid->link[Other(side)];     /* Real child */
+          ptr->link[side]->Parent = ptr;
+      }
+    else
+      {
+          ptr->link[side] = kid;    /* Thread */
+      }
+    /* Update grand parent's pointer: */
+    if (NULL == ptr->Parent)
+      {
+          *root = kid;
+      }
+    else if (ptr /*->Lchild*/  == ptr->Parent->Lchild)
+      {
+          ptr->Parent->Lchild = kid;
+      }
+    else
+      {
+          ptr->Parent->Rchild = kid;
+      }
+    ptr->Parent = kid;
+    kid->link[Other(side)] = ptr;
+    kid->flags = (TBBT_FLAG)SetFlags(kid, Other(side),
+                        deep[2] - 1 - Max(deep[0], 0), HasChild(kid, side));
+
+    /* update leaf counts */
+    if (side == LEFT)
+      {     /* kid's left count doesn't change, nor ptr's r-count */
+          kid->rcnt = prcnt + krcnt + 1;    /* kid's leafs+former parent's leafs+parent */
+          ptr->lcnt = krcnt;
+      }     /* end if */
+    else
+      {     /* kid's right count doesn't change, nor ptr's l-count */
+          kid->lcnt = plcnt + klcnt + 1;    /* kid's leafs+former parent's leafs+parent */
+          ptr->rcnt = klcnt;
+      }     /* end if */
+    ptr->flags = ptrflg;
+    return (kid);
+}
+
+/* balance -- Move up tree, incrimenting number of left children when needed
+ * and looking for unbalanced ancestors.  Adjust all balance factors and re-
+ * balance through "rotation"s when needed.
+ */
+static      VOID
+balance(TBBT_NODE ** root, TBBT_NODE * ptr, intn side, intn added)
+{
+    intn        deeper = added; /* 1 if sub-tree got longer; -1 if got shorter */
+    intn        odelta;
+    intn        obal;
+
+    while (NULL != ptr)
+      {
+          odelta = Delta(ptr, side);    /* delta before the node was added */
+          obal = UnBal(ptr);
+          if (LEFT == side)     /* One more/fewer left child: */
+              if (0 < added)
+                  ptr->lcnt++;  /* LeftCnt(ptr)++ */
+              else
+                  ptr->lcnt--;  /* LeftCnt(ptr)-- */
+          else if (0 < added)
+              ptr->rcnt++;  /* RightCnt(ptr)++ */
+          else
+              ptr->rcnt--;  /* RightCnt(ptr)-- */
+          if (0 != deeper)
+            {   /* One leg got longer or shorter: */
+                if ((deeper < 0 && odelta < 0) || (deeper > 0 && odelta > 0))
+                  {     /* Became too unbalanced: */
+                      TBBT_NODE  *kid;
+
+                      ptr->flags |= TBBT_DOUBLE;    /* Mark node too unbalanced */
+                      if (deeper < 0)   /* Just removed a node: */
+                          side = Other(side);   /* Swap with child from other side. */
+                      else
+                          /* Just inserted a node: */ if (ptr->Parent && UnBal(ptr->Parent))
+                        {
+                            deeper = 0;     /* Fix will re-shorten sub-tree. */
+                        }
+                      kid = ptr->link[side];
+                      if (Heavy(kid, Other(side)))
+                        {   /* Double rotate needed: */
+                            kid = swapkid(root, kid, Other(side));
+                            ptr = swapkid(root, ptr, side);
+                        }
+                      else
+                        {   /* Just rotate parent and kid: */
+                            if (HasChild(kid, side))    /* In this case, sub-tree gets */
+                                if (ptr->Parent && UnBal(ptr->Parent))
+                                  {
+                                      deeper = 0;   /* re-lengthened after a node removed. */
+                                  }
+                            ptr = swapkid(root, ptr, side);
+                        }
+                  }
+                else if (obal)
+                  {     /* Just became balanced: */
+                      ptr->flags &= ~TBBT_UNBAL;
+                      if (0 < deeper)
+                        {   /* Shorter of legs lengthened */
+                            ptr->flags |= TBBT_INTERN;  /* Mark as internal node now */
+                            deeper = 0;     /* so max length unchanged */
+                        }   /* end if */
+                  }
+                else if (deeper < 0)
+                  {     /* Just became unbalanced: */
+                      if (ptr->link[Other(side)] != NULL && ptr->link[Other(side)]->Parent == ptr)
+                        {
+                            ptr->flags |= (TBBT_FLAG)TBBT_HEAVY(Other(side));  /* Other side longer */
+                            if (ptr->Parent)
+                                if (ptr->Parent->Rchild == ptr) {     /* we're the right child */
+                                    if (Heavy(ptr->Parent, RIGHT) && LeftCnt(ptr->Parent) == 1)
+                                        deeper = 0;
+                                    else
+                                        /* we're the left child */ if (Heavy(ptr->Parent, LEFT))
+                                        if (ptr->Parent->Rchild && !UnBal(ptr->Parent->Rchild))
+                                            deeper = 0;
+                                }
+                        }
+                  }
+                else
+                  {     /* Just became unbalanced: */
+                      ptr->flags |= (TBBT_FLAG)TBBT_HEAVY(side);   /* 0<deeper: Our side longer */
+                  }     /* end else */
+            }
+          if (ptr->Parent)
+            {
+                if (ptr == (ptr->Parent->Rchild))
+                    side = RIGHT;
+                else
+                    side = LEFT;
+            }   /* end if */
+          ptr = ptr->Parent;    /* Move up the tree */
+      }
+    /* total tree depth += deeper; */
+}
+/* Here is how rotatation rebalances a tree:
+ * Either the deletion of a node shortened the sub-tree [A] (to length `h')
+ * while [B] or [C] or both are length `h+1'  or  the addition of a node
+ * lengthened [B] or [C] to length `h+1' while the other and [A] are both
+ * length `h'.  Each case changes `ptr' from being "right heavy" to being
+ * overly unbalanced.
+ * This           |                      Becomes:      |
+ * sub-tree:    (ptr)                                (kid)
+ *             /     \          --side-->           /     \
+ *         +-A-+    (kid)                        (ptr)   +-C-+
+ *         |   |   /     \                      /     \  |   |
+ *         | h | +-B-+  +-C-+               +-A-+  +-B-+ | h |
+ *         |   | |   |  |   |               |   |  |   | |   |
+ *         +---+ | h |  | h |               | h |  | h | +---+
+ *         : - : |   |  |   |               |   |  |   | : 1 :
+ *         `- -' +---+  +---+               +---+  +---+ + - +
+ *               : 1 :  : 1 :                      : 1 :
+ *               + - +  + - +                      + - +
+ *
+ * However, if [B] is long (h+1) while [C] is short (h), a double rotate is
+ * required to rebalance.  In this case, [A] was shortened or [X] or [Y] was
+ * lengthened so [A] is length `h' and one of [X] and [Y] is length `h' while
+ * the other is length `h-1'.  Swap `kid' with `babe' then `ptr' with `babe'.
+ * This          |                         Becomes:     |
+ * sub-tree:   (ptr)                                  (babe)
+ *            /     \             --side-->          /      \
+ *       +-A-+       (kid)                      (ptr)       (kid)
+ *       |   |      /     \                    /     \     /     \
+ *       | h |    (babe)   +-C-+             +-A-+ +-X-+ +-Y-+ +-C-+
+ *       |   |   /      \  |   |             |   | |h-1| |h-1| |   |
+ *       +---+ +-X-+ +-Y-+ | h |             | h | +---+ +---+ | h |
+ *       : - : |h-1| |h-1| |   |             |   | : 1 : : 1 : |   |
+ *       `- -' +---+ +---+ +---+             +---+ + - + + - + +---+
+ *             : 1 : : 1 :
+ *             + - + + - +
+ *
+ * Note that in the node insertion cases total sub-tree length always increases
+ * by one then decreases again so after the rotation(s) no more rebalancing is
+ * required.  In the node removal cases, the single rotation reduces total sub-
+ * tree length unless [B] is length `h+1' (`ptr' ends of "right heavy") while
+ * the double rotation ALWAYS reduces total sub-tree length.  Thus removing a
+ * single node can require log(N) rotations for rebalancing.  On average, only
+ * are usually required.
+ */
+
+/* Returns pointer to inserted node (or NULL) */
+TBBT_NODE  *
+tbbtins(TBBT_NODE ** root, VOIDP item, VOIDP key, intn (*compar)
+        (VOIDP /* k1 */, VOIDP /* k2 */, intn /* arg */), intn arg)
+{
+    intn        cmp;
+    TBBT_NODE  *ptr, *parent;
+
+    if (NULL != tbbtfind(*root, (key ? key : item), compar, arg, &parent)
+        || NULL == (ptr = tbbt_get_node()))
+        return (NULL);
+    ptr->data = item;
+    ptr->key = key ? key : item;
+    ptr->Parent = parent;
+    ptr->flags = 0L;    /* No children on either side */
+    ptr->lcnt = 0;
+    ptr->rcnt = 0;
+    if (NULL == parent)
+      {     /* Adding first node to tree: */
+          *root = ptr;
+          ptr->Lchild = ptr->Rchild = NULL;
+          return (ptr);
+      }
+    cmp = KEYcmp(ptr->key, parent->key, arg);
+    if (cmp < 0)
+      {
+          ptr->Lchild = parent->Lchild;     /* Parent's thread now new node's */
+          ptr->Rchild = parent;     /* New nodes right thread is parent */
+          parent->Lchild = ptr;     /* Parent now has a left child */
+      }
+    else
+      {
+          ptr->Rchild = parent->Rchild;
+          ptr->Lchild = parent;
+          parent->Rchild = ptr;
+      }
+    balance(root, parent, (cmp < 0) ? LEFT : RIGHT, 1);
+    return (ptr);
+}
+
+/* tbbtdins -- Insert a node into a "described" tree */
+         /* Returns a pointer to the inserted node */
+TBBT_NODE  *
+tbbtdins(TBBT_TREE * tree, VOIDP item, VOIDP key)
+{
+    TBBT_NODE  *ret_node;       /* the node to return */
+
+    if (tree == NULL)
+        return (NULL);
+    ret_node = tbbtins(&(tree->root), item, key, tree->compar, tree->cmparg);
+    if (ret_node != NULL)
+        tree->count++;
+    return (ret_node);
+}
+
+/* tbbtrem -- Remove a node from a tree.  You pass in the address of the
+ * pointer to the root node of the tree along, a pointer to the node you wish
+ * to remove, and optionally the address of a pointer to hold the address of
+ * the key value of the deleted node.  The second argument is usually the
+ * result from a lookup function call (tbbtfind, tbbtdfind, or tbbtindx) so if
+ * it is NULL, tbbtrem returns NULL.  Otherwise tbbtrem removes the node from
+ * the tree and returns a pointer to the data item for that node and, if the
+ * third argument is not NULL, the address of the key value for the deleted
+ * node is placed in the buffer that it points to.
+ */
+          /* Data item pointer of deleted node is returned */
+VOIDP
+tbbtrem(TBBT_NODE ** root, TBBT_NODE * node, VOIDP *kp)
+{
+    TBBT_NODE  *leaf;           /* Node with one or zero children */
+    TBBT_NODE  *par;            /* Parent of `leaf' */
+    TBBT_NODE  *next;           /* Next/prev node near `leaf' (`leaf's `side' thread) */
+    intn        side;           /* `leaf' is `side' child of `par' */
+    VOIDP       data;           /* Saved pointer to data item of deleted node */
+
+    if (NULL == root || NULL == node)
+        return (NULL);  /* Argument couldn't find node to delete */
+    data = node->data;  /* Save pointer to data item to be returned at end */
+    if (NULL != kp)
+        *kp = node->key;
+    /* If the node to be removed is "internal" (children on both sides), we
+     * replace it with it's previous (or next) node in the tree and delete that
+     * previous (next) node (which has one or no children) instead. */
+    if (Intern(node))
+      {     /* Replace with a non-internal node: */
+          if (Heavy(node, RIGHT))
+            {   /* Pick "near-leaf" node from the */
+                side = LEFT;    /* heavier of the sub-trees. */
+            }
+          else if (Heavy(node, LEFT))
+            {
+                side = RIGHT;
+            }
+          else
+            {   /* If no sub-tree heavier, pick at "random" for "better */
+                side = (0x10 & *(short *) &node) ? LEFT : RIGHT;    /* balance" */
+            }
+          leaf = tbbt_nbr(next = node, Other(side));
+          par = leaf->Parent;
+          if (par == next)
+            {   /* Case 2x: `node' had exactly 2 descendants */
+                side = Other(side);     /* Transform this to Case 2 */
+                next = leaf->link[side];
+            }
+          node->data = leaf->data;
+          node->key = leaf->key;
+      }
+    else
+      {     /* Node has one or zero children: */
+          leaf = node;  /* Simply remove THIS node */
+          par = leaf->Parent;
+          if (NULL == par)
+            {   /* Case 3: Remove root (of 1- or 2-node tree) */
+                side = (intn) UnBal(node);  /* Which side root has a child on */
+                if (side)
+                  {     /* Case 3a: Remove root of 2-node tree: */
+                      *root = leaf = node->link[side];
+                      leaf->Parent = leaf->link[Other(side)] = NULL;
+                      leaf->flags = 0;  /* No left children, balanced, not internal */
+                  }
+                else
+                  {     /* Case 3b: Remove last node of tree: */
+                      *root = NULL;
+                  }     /* end else */
+                tbbt_release_node(node);
+                return (data);
+            }
+          side = (par->Rchild == leaf) ? RIGHT : LEFT;
+          next = leaf->link[side];
+      }
+    /* Now the deletion has been reduced to the following cases (and Case 3 has
+     * been handled completely above and Case 2x has been transformed into
+     * Case 2).  `leaf' is a node with one or zero children that we are going
+     * to remove.  `next' points where the `side' thread of `leaf' points.
+     * `par' is the parent of `leaf'.  The only posibilities (not counting
+     * left/right reversals) are shown below:
+     *       [Case 1]                  [Case 2]              [Case 2x]
+     *            (next)                 (next)         ^         (next & par)
+     *           /  ^   \               /  ^   \        |        /  ^         \
+     *     . . .    |             . . .    |            |  (leaf)   /
+     *   /          |           /          |            \_/      \_/
+     * (par)        |         (par)        |             ^threads^
+     *      \       |              \       |
+     *     (leaf)   /             (leaf)   /            [Case 3a]    [Case 3b]
+     *    /  ^   \_/<thread             \_/<thread       (root)
+     * (n)   /                                                 \       (root)
+     *    \_/<thread        --"side"-->                         (n)
+     * Note that in Cases 1 and 2, `leaf's `side' thread can be NULL making
+     * `next' NULL as well.  If you remove a node from a 2-node tree, removing
+     * the root falls into Case 3a while removing the only leaf falls into
+     * Case 2 (with `next' NULL and `par' the root node). */
+    if (!UnBal(leaf))
+      {     /* Case 2: `leaf' has no children: */
+          par->link[side] = leaf->link[side];
+          par->flags &= (TBBT_FLAG)(~(TBBT_INTERN | TBBT_HEAVY(side)));
+      }
+    else
+      {     /* Case 1: `leaf' has one child: */
+          TBBT_NODE  *n;
+
+          if (HasChild(leaf, side))
+            {   /* two-in-a-row cases */
+                n = leaf->link[side];
+                par->link[side] = n;
+                n->Parent = par;
+                if (HasChild(n, Other(side)))
+                    while (HasChild(n, Other(side)))
+                        n = n->link[Other(side)];
+                n->link[Other(side)] = par;
+            }   /* end if */
+          else
+            {   /* zig-zag cases */
+                n = leaf->link[Other(side)];
+                par->link[side] = n;
+                n->Parent = par;
+                if (HasChild(n, side))
+                    while (HasChild(n, side))
+                        n = n->link[side];
+                n->link[side] = next;
+            }   /* end else */
+      }
+    tbbt_release_node(leaf);
+    balance(root, par, side, -1);
+    ((TBBT_TREE *) root)->count--;
+    return (data);
+}
+
+/* tbbtdmake - Allocate a new tree description record for an empty tree */
+/* Returns a pointer to the description record */
+TBBT_TREE  *
+tbbtdmake(intn (*cmp) (VOIDP /* k1 */, VOIDP /* k2 */, intn /* arg */), intn arg, uintn fast_compare)
+{
+    TBBT_TREE  *tree = Alloc(1, TBBT_TREE);
+
+    if (NULL == tree)
+        return (NULL);
+    tree->root = NULL;
+    tree->count = 0;
+    tree->fast_compare=fast_compare;
+    tree->compar = cmp;
+    tree->cmparg = arg;
+    return (tree);
+}
+
+#ifdef WASTE_STACK
+/* You can have a very simple recursive version that wastes lots of stack
+ * space, this next less-simple recursive version that wastes less stack space,
+ * or the last non-recursive version which isn't simple but saves stack space.
+ */
+static      VOID(*FD) (VOIDP item), (*FK) (VOIDP key);
+static      VOID
+tbbt1free(TBBT_NODE * node)
+{
+    if (HasChild(node, LEFT))
+        tbbt1free(node->Lchild);
+    if (HasChild(node, RIGHT))
+        tbbt1free(node->Rchild);
+    if (NULL != FD)
+        (*FD) (node->data);
+    if (NULL != FK)
+        (*FK) (node->key);
+    tbbt_release_node(node);
+}
+
+VOID
+tbbtfree(TBBT_NODE ** root, VOID(*fd) (VOIDP item), VOID(*fk) (VOIDP key))
+{
+    if (NULL == *root)
+        return;
+    FD = fd;
+    FK = fk;
+    tbbt1free(*root);
+    *root = NULL;
+}
+#else  /* WASTE_STACK */
+
+/* tbbtfree() - Free an entire tree not allocated with tbbtdmake(). */
+VOID
+tbbtfree(TBBT_NODE ** root, VOID(*fd) (VOIDP /* item */), VOID(*fk) (VOIDP /* key */))
+{
+    TBBT_NODE  *par, *node = *root;
+
+    while (NULL != *root)
+      {     /* While nodes left to be free()d */
+          /* First time at this node (just moved down a new leg of tree) */
+          if (!HasChild(node, LEFT))
+              node->Lchild = NULL;
+          if (!HasChild(node, RIGHT))
+              node->Rchild = NULL;
+          do
+            {
+                par = NULL;     /* Assume we aren't ready to move up tree yet */
+                if (NULL != node->Lchild)
+                    node = node->Lchild;    /* Move down this leg next */
+                else if (NULL != node->Rchild)
+                    node = node->Rchild;    /* Move down this leg next */
+                else
+                  {     /* No children; free node an move up: */
+                      par = node->Parent;   /* Move up tree (stay in loop) */
+                      if (NULL != fd)
+                          (*fd) (node->data);
+                      if (NULL != fk)
+                          (*fk) (node->key);
+                      if (NULL == par)  /* Just free()d last node */
+                          *root = NULL;     /* NULL=par & NULL=*root gets fully out */
+                      else if (node == par->Lchild)
+                          par->Lchild = NULL;   /* Now no longer has this child */
+                      else
+                          par->Rchild = NULL;   /* Ditto */
+
+                      tbbt_release_node(node);
+
+                      node = par;   /* Move up tree; remember which node to do next */
+                  }
+            }
+          while (NULL != par);  /* While moving back up tree */
+      }
+}
+#endif /* WASTE_STACK */
+
+VOID
+tbbtprint(TBBT_NODE * node)
+{
+    if (node == NULL)
+        return;
+    printf("node=%p, key=%p, data=%p, flags=%x\n", node, node->key, node->data, (unsigned) node->flags);
+    printf("Lcnt=%d, Rcnt=%d\n", (int) node->lcnt, (int) node->rcnt);
+    printf("*key=%d\n", (int) *(int32 *) (node->key));
+    printf("Lchild=%p, Rchild=%p, Parent=%p\n", node->Lchild, node->Rchild, node->Parent);
+}   /* end tbbtprint() */
+
+VOID
+tbbt1dump(TBBT_NODE * node, intn method)
+{
+    if (node == NULL)
+        return;
+    switch (method)
+      {
+          case -1:      /* Pre-Order Traversal */
+              tbbtprint(node);
+              if (HasChild(node, LEFT))
+                  tbbt1dump(node->Lchild, method);
+              if (HasChild(node, RIGHT))
+                  tbbt1dump(node->Rchild, method);
+              break;
+
+          case 1:   /* Post-Order Traversal */
+              if (HasChild(node, LEFT))
+                  tbbt1dump(node->Lchild, method);
+              if (HasChild(node, RIGHT))
+                  tbbt1dump(node->Rchild, method);
+              tbbtprint(node);
+              break;
+
+          case 0:   /* In-Order Traversal */
+          default:
+              if (HasChild(node, LEFT))
+                  tbbt1dump(node->Lchild, method);
+              tbbtprint(node);
+              if (HasChild(node, RIGHT))
+                  tbbt1dump(node->Rchild, method);
+              break;
+
+      }     /* end switch() */
+}   /* end tbbt1dump() */
+
+VOID
+tbbtdump(TBBT_TREE * tree, intn method)
+{
+    if (tree != NULL && *(TBBT_NODE **) tree != NULL)
+      {
+          printf("Number of nodes in the tree: %ld\n", tree->count);
+          tbbt1dump(tree->root, method);
+      }     /* end if */
+    else
+        printf("Tree is empty\n");
+}   /* end tbbtdump() */
+
+VOID
+tbbt_printNode(TBBT_NODE * node, VOID(*key_dump)(VOID *,VOID *))
+{
+
+    if (node == NULL)
+      {
+        printf("ERROR:  null node pointer\n");
+        return;
+      }
+    printf("node=%p, flags=%x, Lcnt=%ld, Rcnt=%ld\n", node, (unsigned)node->flags,
+           (long)node->lcnt, (long)node->rcnt);
+    printf("Lchild=%p, Rchild=%p, Parent=%p\n", node->Lchild, node->Rchild, node->Parent);
+    if (key_dump != NULL)
+      {
+        (*key_dump)(node->key,node->data);
+      }
+    fflush(stdout);
+#if 0
+    printf("Lcnt=%d, Rcnt=%d\n", (int) node->lcnt, (int) node->rcnt);
+    printf("*key=%d\n", (int) *(int32 *) (node->key));
+    printf("Lchild=%p, Rchild=%p, Parent=%p\n", node->Lchild, node->Rchild, node->Parent);
+#endif
+}   /* end tbbt_printNode() */
+
+VOID
+tbbt_dumpNode(TBBT_NODE *node, VOID (*key_dump)(VOID *,VOID *),
+                        intn method)
+{
+    if (node == NULL)
+        return;
+    switch (method)
+      {
+          case -1:      /* Pre-Order Traversal */
+              tbbt_printNode(node, key_dump);
+              if (HasChild(node, LEFT))
+                  tbbt_dumpNode(node->Lchild, key_dump, method);
+              if (HasChild(node, RIGHT))
+                  tbbt_dumpNode(node->Rchild, key_dump, method);
+              break;
+
+          case 1:   /* Post-Order Traversal */
+              if (HasChild(node, LEFT))
+                  tbbt_dumpNode(node->Lchild, key_dump, method);
+              if (HasChild(node, RIGHT))
+                  tbbt_dumpNode(node->Rchild, key_dump, method);
+              tbbt_printNode(node, key_dump);
+              break;
+
+          case 0:   /* In-Order Traversal */
+          default:
+              if (HasChild(node, LEFT))
+                  tbbt_dumpNode(node->Lchild, key_dump, method);
+              tbbt_printNode(node, key_dump);
+              if (HasChild(node, RIGHT))
+                  tbbt_dumpNode(node->Rchild, key_dump, method);
+              break;
+
+      }     /* end switch() */
+}   /* end tbbt_dumpNode() */
+
+VOID
+tbbt_dump(TBBT_TREE *ptree, VOID (*key_dump)(VOID *,VOID *), intn method)
+{
+	TBBT_TREE  *tree;
+
+	tree = (TBBT_TREE *) ptree;
+	printf("TBBT-tree dump  %p:\n\n",ptree);
+	printf("capacity = %ld\n",(long)tree->count);
+	printf("\n");
+	tbbt_dumpNode(tree->root,key_dump, method);
+	return;
+}
+
+/* Always returns NULL */
+TBBT_TREE  *
+tbbtdfree(TBBT_TREE * tree, VOID(*fd) (VOIDP /* item */), VOID(*fk) (VOIDP /* key */))
+{
+    if (tree == NULL)
+        return (NULL);
+
+    tbbtfree(&tree->root, fd, fk);
+    Free(tree);
+    return (NULL);
+}
+
+/* returns the number of nodes in the tree */
+long
+tbbtcount(TBBT_TREE * tree)
+{
+    if (tree == NULL)
+        return (-1);
+    else
+        return ((long)tree->count);
+}
+
+/******************************************************************************
+ NAME
+     tbbt_get_node - Gets a tbbt node
+
+ DESCRIPTION
+    Either gets a tbbt node from the free list (if there is one available)
+    or allocates a node.
+
+ RETURNS
+    Returns tbbt ptr if successful and NULL otherwise
+
+*******************************************************************************/
+static TBBT_NODE *tbbt_get_node(void)
+{
+    TBBT_NODE *ret_value=NULL;
+
+    if(tbbt_free_list!=NULL)
+      {
+        ret_value=tbbt_free_list;
+        tbbt_free_list=tbbt_free_list->Lchild;
+      } /* end if */
+    else
+        ret_value=(TBBT_NODE *)Alloc(1,TBBT_NODE);
+
+  return ret_value;
+}   /* end tbbt_get_node() */
+
+/******************************************************************************
+ NAME
+     tbbt_release_node - Releases a tbbt node
+
+ DESCRIPTION
+    Puts a tbbt node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+static void tbbt_release_node(TBBT_NODE *nod)
+{
+    /* Insert the atom at the beginning of the free list */
+    nod->Lchild=tbbt_free_list;
+    tbbt_free_list=nod;
+}   /* end tbbt_release_node() */
+
+/*--------------------------------------------------------------------------
+ NAME
+    tbbt_shutdown
+ PURPOSE
+    Terminate various static buffers.
+ USAGE
+    intn tbbt_shutdown()
+ RETURNS
+    Returns SUCCEED/FAIL
+ DESCRIPTION
+    Free various buffers allocated in the tbbt routines.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+intn 
+tbbt_shutdown(void)
+{
+    TBBT_NODE *curr;
+
+    /* Release the free-list if it exists */
+    if(tbbt_free_list!=NULL)
+      {
+        while(tbbt_free_list!=NULL)
+          {
+            curr=tbbt_free_list;
+            tbbt_free_list=tbbt_free_list->Lchild;
+            Free(curr);
+          } /* end while */
+      } /* end if */
+  return (SUCCEED);
+}	/* end tbbt_shutdown() */
+
diff --git a/hdf/src/tbbt.h b/hdf/src/tbbt.h
new file mode 100644
index 0000000..bd88009
--- /dev/null
+++ b/hdf/src/tbbt.h
@@ -0,0 +1,326 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: tbbt.h 6043 2014-01-21 21:09:03Z acheng $ */
+
+/* "tbbt.h" -- Data types/routines for threaded, balanced, binary trees. */
+/* Extended from Knuth 6.2.3, Algorithm A */
+
+#ifndef TBBT_H
+#define TBBT_H
+
+#include "H4api_adpt.h"
+
+#ifdef lint     /* lint always complains but may complain more if... */
+# define   TBBT_INTERNALS   /* TBBT_INTERNALS not always defined */
+#endif /* lint */
+
+typedef struct tbbt_node TBBT_NODE;
+
+/* Threaded node structure */
+struct tbbt_node
+  {
+      VOIDP       data;         /* Pointer to user data to be associated with node */
+      VOIDP       key;          /* Field to sort nodes on */
+
+#ifdef TBBT_INTERNALS
+# define   PARENT  0
+# define   LEFT    1
+# define   RIGHT   2
+      TBBT_NODE  *link[3];      /* Pointers to parent, left child, and right child */
+# define  Parent    link[PARENT]
+# define  Lchild    link[LEFT]
+# define  Rchild    link[RIGHT]
+# define  TBBT_FLAG unsigned long
+# define  TBBT_LEAF unsigned long
+      TBBT_FLAG   flags;        /* Combination of the following bit fields: */
+# define  TBBT_HEAVY(s) s       /* If the `s' sub-tree is deeper than the other */
+# define  TBBT_DOUBLE   4       /* If "heavy" sub-tree is two levels deeper */
+# define  TBBT_INTERN   8       /* If node is internal (has two children) */
+# define  TBBT_UNBAL    ( TBBT_HEAVY(LEFT) | TBBT_HEAVY(RIGHT) )
+# define  TBBT_FLAGS    ( TBBT_UNBAL | TBBT_INTERN | TBBT_DOUBLE )
+# define  TBBT_CHILD(s) ( TBBT_INTERN | TBBT_HEAVY(s) )
+      TBBT_LEAF   lcnt;         /* count of left children */
+      TBBT_LEAF   rcnt;         /* count of right children */
+# define  LeftCnt(node) ( (node)->lcnt )    /* Left descendants */
+# define  RightCnt(node) ( (node)->rcnt )   /* Left descendants */
+# define  Cnt(node,s)   ( LEFT==(s) ? LeftCnt(node) : RightCnt(node) )
+# define  HasChild(n,s) ( Cnt(n,s)>0 )
+# define  Heavy(n,s)    ( (s) & (LeftCnt(n)>RightCnt(n) ? LEFT : \
+                 LeftCnt(n)==RightCnt(n) ? 0 : RIGHT))
+# define  Intern(n)     ( LeftCnt(n) && RightCnt(n) )
+# define  UnBal(n)      ( LeftCnt(n)>RightCnt(n) ? LEFT : \
+                 LeftCnt(n)==RightCnt(n) ? 0 : RIGHT)
+# define  Double(n)     ( TBBT_DOUBLE & (n)->flags )
+# define  Other(side)   ( LEFT + RIGHT - (side) )
+# define  Delta(n,s)    (  ( Heavy(n,s) ? 1 : -1 )                          \
+                            *  ( Double(n) ? 2 : UnBal(n) ? 1 : 0 )  )
+# define  SetFlags(n,s,b,i)   (  ( -2<(b) && (b)<2 ? 0 : TBBT_DOUBLE )   \
+    |  ( 0>(b) ? TBBT_HEAVY(s) : (b)>0 ? TBBT_HEAVY(Other(s)) : 0 )        \
+    |  ( (i) ? TBBT_INTERN : 0 )  )
+  };
+
+/* Pointer to the tbbt node free list */
+static TBBT_NODE *tbbt_free_list=NULL;
+
+typedef struct tbbt_tree TBBT_TREE;
+/* Threaded tree structure */
+struct tbbt_tree
+  {
+      TBBT_NODE  *root;
+      unsigned long count;      /* The number of nodes in the tree currently */
+      uintn       fast_compare; /* use a faster in-line compare (with casts) instead of function call */
+      intn        (*compar) (VOIDP k1, VOIDP k2, intn cmparg);
+      intn        cmparg;
+#endif                          /* TBBT_INTERNALS */
+  };
+
+/* Define the "fast compare" values */
+#define TBBT_FAST_UINT16_COMPARE    1
+#define TBBT_FAST_INT32_COMPARE     2
+
+#ifndef TBBT_INTERNALS
+typedef TBBT_NODE **TBBT_TREE;
+#endif /* TBBT_INTERNALS */
+
+/* Return maximum of two scalar values (use arguments w/o side effects): */
+#define   Max(a,b)  ( (a) > (b) ? (a) : (b) )
+
+/* These routines are designed to allow use of a general-purpose balanced tree
+ * implimentation.  These trees are appropriate for maintaining in memory one
+ * or more lists of items, each list sorted according to key values (key values
+ * must form a "completely ordered set") where no two items in a single list
+ * can have the same key value.  The following operations are supported:
+ *     Create an empty list
+ *     Add an item to a list
+ *     Look up an item in a list by key value
+ *     Look up the Nth item in a list
+ *     Delete an item from a list
+ *     Find the first/last/next/previous item in a list
+ *     Destroy a list
+ * Each of the above operations requires Order(log(N)) time where N is the
+ * number of items in the list (except for list creation which requires
+ * constant time and list destruction which requires Order(N) time if the user-
+ * supplied free-data-item or free-key-value routines require constant time).
+ * Each of the above operations (except create and destroy) can be performed
+ * on a subtree.
+ *
+ * Each node of a tree has associated with it a generic pointer (void *) which
+ * is set to point to one such "item" and a generic pointer to point to that
+ * item's "key value".  The structure of the items and key values is up to the
+ * user to define.  The user must specify a method for comparing key values.
+ * This routine takes three arguments, two pointers to key values and a third
+ * integer argument.  You can specify a routine that expects pointers to "data
+ * items" rather than key values in which case the pointer to the key value in
+ * each node will be set equal to the pointer to the data item.
+ *
+ * Since the "data item" pointer is the first field of each tree node, these
+ * routines may be used without this "tbbt.h" file.  For example, assume "ITM"
+ * is the structre definition for the data items you want to store in lists:
+ * ITM ***tbbtdmake( int (*cmp)(void *,void *,int), int arg );
+ * ITM **root= NULL;        (* How to create an empty tree w/o tbbtdmake() *)
+ * ITM **tbbtdfind( ITM ***tree, void *key, ITM ***pp );
+ * ITM **tbbtfind( ITM **root, void *key, int (*cmp)(), int arg, ITM ***pp );
+ * ITM **tbbtdless( ITM ***tree, void *key, ITM ***pp );
+ * ITM **tbbtless( ITM **root, void *key, int (*cmp)(), int arg, ITM ***pp );
+ * ITM **tbbtindx( ITM **root, long indx );
+ * ITM **tbbtdins( ITM ***tree, ITM *item, void *key );
+ * ITM **tbbtins( ITM ***root, ITM *item, void *key, int (*cmp)(), int arg );
+ * ITM *tbbtrem( ITM ***root, ITM **node, void **kp );
+ * ITM **tbbtfirst( ITM **root ), **tbbtlast( ITM **root );
+ * ITM **tbbtnext( ITM **node ), **tbbtprev( ITM **node );
+ * ITM ***tbbtdfree( ITM ***tree, void (*df)(ITM *), void (*kf)(void *) );
+ * void tbbtfree( ITM ***root, void (*df)(ITM *), void (*kf)(void *) );
+ */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+HDFLIBAPI TBBT_TREE  *tbbtdmake
+                (intn (*compar) (VOIDP, VOIDP, intn), intn arg, uintn fast_compare);
+/* Allocates and initializes an empty threaded, balanced, binary tree and
+ * returns a pointer to the control structure for it.  You can also create
+ * empty trees without this function as long as you never use tbbtd* routines
+ * (tbbtdfind, tbbtdins, tbbtdfree) on them.
+ * Examples:
+ *     int keycmp();
+ *     TBBT_ROOT *root= tbbtdmake( keycmp, (int)keysiz , 0);
+ * or
+ *     void *root= tbbtdmake( strcmp, 0 , 0);
+ * or
+ *     void *root= tbbtdmake( keycmp, (int)keysiz , TBBT_FAST_UINT16_COMPARE);
+ * or
+ *     TBBT_NODE *root= NULL;        (* Don't use tbbtd* routines *)
+ * `cmp' is the routine to be used to compare two key values [in tbbtdfind()
+ * and tbbtdins()].  The arguments to `cmp' are the two keys to compare
+ * and `arg':  (*cmp)(k1,k2,arg).  `cmp' is expected to return 0 if its first
+ * two arguments point to identical key values, -1 (or any integer less than 0)
+ * if k1 points to a key value lower than that pointed to by k2, and 1 (or any
+ * integer greater than 0) otherwise.  If `cmp' is NULL, memcmp is used.  If
+ * `cmp' is NULL and `arg' is not greater than 0L, `1+strlen(key1)' is used in
+ * place of `arg' to emulate strcmp():  memcmp( k1, k2, 1+strlen(k1) ).  You
+ * can use strcmp() directly (as in the second example above) as long as your C
+ * compiler does not assume strcmp() will always be passed exactly 2 arguments
+ * (only newer, ANSI-influenced C compilers are likely to be able to make this
+ * kind of assumption).  You can also use a key comparison routine that expects
+ * pointers to data items rather than key values.
+ *  The "fast compare" option is for keys of simple numeric types (currently
+ *      uint16 and int32) and avoids the function call for faster searches in
+ *      some cases.  The key comparison routine is still required for some
+ *      insertion routines which use it.
+ *
+ * Most of the other routines expect a pointer to a root node of a tree, not
+ * a pointer to the tree's control structure (only tbbtdfind(), tbbtdins(),
+ * and tbbtdfree() expect pointers to control structures).  However TBBT_TREE
+ * is just defined as "**TBBT_NODE" (unless you have defined TBBT_INTERNALS so
+ * you have access to the internal structure of the nodes) so
+ *     TBBT_TREE *tree1= tbbtdmake( NULL, 0 );
+ * is equivalent to
+ *     TBBT_NODE **tree1= tbbtdmake( NULL, 0 );
+ * So could be used as:
+ *     node= tbbtdfind( tree1, key, NULL );
+ *     node= tbbtfind( *tree1, key, compar, arg, NULL );
+ *     node= tbbtdless( tree1, key, NULL );
+ *     node= tbbtless( *tree1, key, compar, arg, NULL );
+ *     node= tbbtdins( tree1, item, key );
+ *     node= tbbtins( tree1, item, key, compar, arg );
+ *     item= tbbtrem( tree1, tbbtdfind(tree1,key,NULL), NULL );
+ *     item= tbbtrem( tree1, tbbtfind(*tree1,key,compar,arg,NULL), NULL );
+ *     tree1= tbbtdfree( tree1, free, NULL );       (* or whatever *)
+ * while
+ *     TBBT_NODE *root= NULL;
+ * would be used like:
+ *     node= tbbtfind( root, key );
+ *     node= tbbtins( &root, item, key );
+ *     node= tbbtrem( &root, tbbtfind(root,key), NULL );
+ *     tbbtfree( &root, free, NULL );               (* or whatever *)
+ * Never use tbbtfree() on a tree allocated with tbbtdmake() or on a sub-tree
+ * of ANY tree.  Never use tbbtdfree() except on a tbbtdmake()d tree.
+ */
+
+HDFLIBAPI TBBT_NODE  *tbbtdfind
+                (TBBT_TREE * tree, VOIDP key, TBBT_NODE ** pp);
+HDFLIBAPI TBBT_NODE  *tbbtfind
+                (TBBT_NODE * root, VOIDP key, intn (*cmp) (VOIDP, VOIDP, intn),
+                 intn arg, TBBT_NODE ** pp);
+HDFLIBAPI TBBT_NODE  *tbbtdless
+                (TBBT_TREE * tree, VOIDP key, TBBT_NODE ** pp);
+HDFLIBAPI TBBT_NODE  *tbbtless
+                (TBBT_NODE * root, VOIDP key, intn (*cmp) (VOIDP, VOIDP, intn),
+                 intn arg, TBBT_NODE ** pp);
+/* Locate a node based on the key given.  A pointer to the node in the tree
+ * with a key value matching `key' is returned.  If no such node exists, NULL
+ * is returned.  Whether a node is found or not, if `pp' is not NULL, `*pp'
+ * will be set to point to the parent of the node we are looking for (or that
+ * node that would be the parent if the node is not found).  tbbtdfind() is
+ * used on trees created using tbbtdmake() (so that `cmp' and `arg' don't have
+ * to be passed).  tbbtfind() can be used on the root or any subtree of a tree
+ * create using tbbtdmake() and is used on any tree (or subtree) created with-
+ * out using tbbtdmake().  tbbtless() & tbbtdless() work exactly like tbbtfind()
+ * and tbbtdfind() except that they find the node with a key which is less than
+ * or equal to the key given to them.
+ */
+
+HDFLIBAPI TBBT_NODE  *tbbtindx
+                (TBBT_NODE * root, int32 indx);
+/* Locate the node that has `indx' nodes with lesser key values.  This is like
+ * an array lookup with the first item in the list having index 0.  For large
+ * values of `indx', this call is much faster than tbbtfirst() followed by
+ * `indx' tbbtnext()s.  Thus `tbbtindx(&root,0L)' is equivalent to (and almost
+ * as fast as) `tbbtfirst(root)'.
+ */
+
+HDFLIBAPI TBBT_NODE  *tbbtdins
+                (TBBT_TREE * tree, VOIDP item, VOIDP key);
+HDFLIBAPI TBBT_NODE  *tbbtins
+                (TBBT_NODE ** root, VOIDP item, VOIDP key, intn (*cmp) (VOIDP, VOIDP, intn), intn arg);
+/* Insert a new node to the tree having a key value of `key' and a data pointer
+ * of `item'.  If a node already exists in the tree with key value `key' or if
+ * malloc() fails, NULL is returned (no node is inserted), otherwise a pointer
+ * to the inserted node is returned.  `cmp' and `arg' are as for tbbtfind().
+ */
+
+HDFLIBAPI VOIDP       tbbtrem
+                (TBBT_NODE ** root, TBBT_NODE * node, VOIDP *kp);
+/* Remove the node pointed to by `node' from the tree with root `root'.  The
+ * data pointer for the deleted node is returned.  If the second argument is
+ * NULL, NULL is returned.  If `kp' is not NULL, `*kp' is set to point to the
+ * key value for the deleted node.  Examples:
+ *     data= tbbtrem( tree, tbbtdfind(tree,key), &kp );  free(data);  free(kp);
+ *     data= tbbtrem( &root, tbbtfind(root,key,compar,arg), NULL );
+ *     data= tbbtrem( &tree->root, tbbtdfind(tree,key), NULL );
+ */
+
+HDFLIBAPI TBBT_NODE  *tbbtfirst
+                (TBBT_NODE * root);
+HDFLIBAPI TBBT_NODE  *tbbtlast
+                (TBBT_NODE * root);
+/* Returns a pointer to node from the tree with the lowest(first)/highest(last)
+ * key value.  If the tree is empy NULL is returned.  Examples:
+ *     node= tbbtfirst(*tree);
+ *     node= tbbtfirst(root);
+ *     node= tbbtlast(tree->root);
+ *     node= tbbtlast(node);        (* Last node in a sub-tree *)
+ */
+
+HDFLIBAPI TBBT_NODE  *tbbtnext
+                (TBBT_NODE * node);
+HDFLIBAPI TBBT_NODE  *tbbtprev
+                (TBBT_NODE * node);
+/* Returns a pointer the node from the tree with the next highest (previous
+ * lowest) key value relative to the node pointed to by `node'.  If `node'
+ * points the last (first) node of the tree, NULL is returned.
+ */
+
+HDFLIBAPI TBBT_TREE  *tbbtdfree
+                (TBBT_TREE * tree, VOID(*fd) (VOIDP), VOID(*fk) (VOIDP));
+HDFLIBAPI VOID        tbbtfree
+                (TBBT_NODE ** root, VOID(*fd) (VOIDP), VOID(*fk) (VOIDP));
+/* Frees up an entire tree.  `fd' is a pointer to a function that frees/
+ * destroys data items, and `fk' is the same for key values.
+ *     void free();
+ *       tree= tbbtdfree( tree, free, free );
+ *       tbbtfree( &root, free, free );
+ * is a typical usage, where keys and data are individually malloc()d.  If `fk'
+ * is NULL, no action is done for the key values (they were allocated on the
+ * stack, as a part of each data item, or together with one malloc() call, for
+ * example) and likewise for `fd'.  tbbtdfree() always returns NULL and
+ * tbbtfree() always sets `root' to be NULL.
+ */
+
+HDFLIBAPI VOID        tbbtprint
+                (TBBT_NODE * node);
+/* Prints out the data in a node */
+
+HDFLIBAPI VOID        tbbtdump
+                (TBBT_TREE * tree, intn method);
+/* Prints an entire tree.  The method variable determines which sort of
+ * traversal is used:
+ *      -1 : Pre-Order Traversal
+ *       1 : Post-Order Traversal
+ *       0 : In-Order Traversal
+ */
+
+HDFLIBAPI long        tbbtcount
+                (TBBT_TREE * tree);
+
+/* Terminate the buffers used in the tbbt*() interface */
+HDFPUBLIC intn tbbt_shutdown(void);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* TBBT_H */
diff --git a/hdf/src/trace.h b/hdf/src/trace.h
new file mode 100644
index 0000000..a0a1ab7
--- /dev/null
+++ b/hdf/src/trace.h
@@ -0,0 +1,6 @@
+#define HDF_TRACE_ON( eventID )
+#define HDF_TRACE_OFF( eventID, p1, p2, p3 )
+#define HDF_MASK_TRACE_ON( mask, eventID )
+#define HDF_MASK_TRACE_OFF( mask, eventID, p1, p2, p3 )
+#define TRACE_ON(mask, eventID)
+#define TRACE_OFF(mask, eventID )
diff --git a/hdf/src/vattr.c b/hdf/src/vattr.c
new file mode 100644
index 0000000..d8c8c82
--- /dev/null
+++ b/hdf/src/vattr.c
@@ -0,0 +1,1701 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5899 $";
+#endif
+
+/* $Id: vattr.c 5899 2013-01-09 21:18:13Z bmribler $ */
+
+/**************************************************************
+*
+* vattr.c
+*
+* Handles vgroup and vdata attributes 
+*
+* Up to HDF4.0r2 vdata and vgroup version number is VSET_VERSION, 
+* defined as 3 in vg.h. With attributes or large fields
+*   or other new features, version number will be 4, VSET_NEW_VERSION. 
+* Attributes will be stored in vdatas. All attributes of a vgroup
+*    or a vdata will be included in the vgroup or the vdata header. 
+*
+* Changes in the vdata header in HDF files :
+*    if attr or other new features are assigned:
+*      o version number will be VSET_NEW_VERSION (4, 
+*          defined in vg.h)
+*      o the new DFTAG_VH looks like:
+*            
+*        interlace  number_records hdf_rec_size n_fields
+*          2 bytes        4              2           2
+*        datatype_field_n offset_field_n order_field_n fldnmlen_n
+*          2*n_fields        2*n_fields     2*n_fields  2*n_fields
+*        fldnm_n namelen name classlen class extag exref version
+*                  2            2             2     2      2
+*        more  flags  < nattrs  attr0_tag/ref attr1_tag/ref ...> 
+*         2      4         4         2/2            2/2          
+*        <other new featrues >  version  more extra_byte
+*                                 2       2      1 
+*
+*      o To make version number accessible without parsing the 
+*           variable length of new feature list, a dublicated
+*           version number and 3 bytes (the 'more' and the extra
+*           byte) will be added at the end of the VH. See below.
+*           The new code (version 4 or later) will get the 
+*           version number from the bottom
+*           while the old libraries get the version number from the
+*           middle of VH, after the field list and before the new 
+*           features list. The new features will be ignored by the 
+*           old library. Also, since the old libraries ignore
+*           the extra byte, there is no need to have the extra
+*           byte after the middle 'more' field.  
+*      o Add a field "flags" of  uint32, 
+*            bit 0 -- has attr
+*            bit 1 -- "large field"  <not implemented >
+*            bit 2 -- "interlaced data is appendable" <not impl'ed>
+*            bit 3-15  -- unused.
+*      o Fields follow the flags are:
+*            number_of_attrs this vdata has  (4 bytes)
+*            attr_index_list  (#_attrs * 8 bytes (4+2+2))
+*                 (field_n, avdtag, avdref) 
+*        the flags and attribute fields are added between the 
+*            middle version field and the bottom version field.
+*    if no new features:
+*        version number is still VSET_VERSION  and the old VH
+*             will be written out.
+*
+* Changes in the vgroup data in HDF files :
+*    If has attribute(s):
+*       o add a flag field, uint16,
+*           bit 0 -- has attr
+*           bit 1-15  -- unused.
+*       o version number will be changed to 4 
+*       o fields following the flag are:
+*           number_of_attrs 
+*           vg_attr_list
+*         the above fields are added preceding the version field
+*       o don't remove the current undocumented "Slush/Mistake byte"
+*         This byte is hard coded in vpackvg and vunpackvg. 
+*            in order to get version number which can be 
+*            either 3 or 4, the extra byte must be there )
+*    If no attribute:
+*       version number is still 3
+*       No changes in vgroup data
+*
+* Create 2 new types in vg.h:
+*     typedef struct dyn_vsattr_struct 
+*        {
+*            int32 field_n -- which field of the vdata. 0 for the 
+*                              entire vdata.
+*            uint16 atag, aref  -- tag/ref of the attr vdata
+*         } vs_attr_t;
+*          (If there are too many attrs and performance becomes a 
+*           problem, the vs_attr_t listed above can be replaced by an
+*           array of attr lists, each list contains attrs for 1 field.)
+*     typedef struct dyn_vgattr_struct
+*        {
+*            uint16 atag, aref  -- tag/ref of the attr vdata
+*         } vg_attr_t;
+*
+* Changes in the internal structure VDATA:
+*     add fields:
+*         uint32  flags;
+*         int32   nattrs;
+*         vd_attr_t *alist;
+*         intn new_h_sz;  --  set to 1 when VH size changed 
+*
+* Changes in the internal structure VGROUP:
+*     add fields:
+*         uint32 flags;
+*         int32  nattrs;
+*         vg_attr_t *alist;
+*
+* New routines:
+*   intn VSfindex(int32 vsid, char *fieldname, int32 *findex)
+*        find out the index of a field given the field name.
+*   intn VSsetattr(int32 vsid, int32 findex, char *attrname, 
+*                  int32 datatype, int32 count, void * values)
+*        set attr for a field of a vdata or for the vdata.
+*        if the attr already exists the new values will replace
+*           the current ones as far as the datatype and order
+*           are not changed.
+*   intn VSnattrs(int32 vsid)
+*        total number of attr for a vdata and its fields
+*   int32 VSfnattrs(int32 vsid, int32 findex) 
+*        number of attrs for a vdata or a field of it
+*   intn VSfindattr(int32 vsid, int32 findex, char *attrname)
+*        get index of an attribute with a given name
+*   intn VSattrinfo(int32 vsid, int32 findex, intn attrindex,
+*                   char *name, int32 *datatype, int32 *count,
+                    int32 *size);
+*        get info about an attribute
+*   intn VSgetattr(int32 vsid, int32 findex, intn attrindex, 
+*                  void * values)
+*        get values of an attribute
+*   intn VSisattr(int32 vsid)
+*        test if a vdata is an attribute of other object
+*   < int32 VSgetversion(int32 vsid) already defined in vio.c >
+*   <    get vset version of a vdata  >
+*   intn Vsetattr(int32 vgid,  char *attrname, int32 datatype,
+*                 int32 count, void * values) 
+*        set attr for a vgroup
+*   intn Vnattrs(int32 vgid)
+*        number of attrs for a vgroup
+*   intn Vnattrs2(int32 vgid)
+*        number of attrs for a vgroup, also including attrs created prior
+*        to the availability of Vdata and Vgroup attribute API routines
+*   intn Vfindattr(int32 vgid, char *attrname)
+*        get index of an attribute with a given name
+*   intn Vattrinfo(int32 vgid, intn attrindex, char *name, 
+*                  int32 *datatype, int32 *count, int32 *size)
+*        get info about an attribute
+*   intn Vattrinfo2(int32 vgid, intn attrindex, char *name, 
+*                  int32 *datatype, int32 *count, int32 *size)
+*        get info about an attribute - this function processes attributes
+*	 that are counted by Vnattrs2.
+*   intn Vgetattr(int32 vgid, intn attrindex, void * values)
+*        get values of an attribute
+*   intn Vgetattr2(int32 vgid, intn attrindex, void * values)
+*        get values of an attribute - this function processes attributes
+*	 that are counted by Vnattrs2.
+*   int32 Vgetversion(int32 vgid)
+*        get vset version of a vgroup
+* Private routines:
+*
+* Affected existing functions:
+*    vgp.c:vunpackvg--VPgetinfo
+*    vgp.c:VPgetinfo--Load_vfile--vinitialize
+*    vgp.c:vpackvg--Vdetach
+*    vgp.c:Vattach
+*    vgp.c:Vdestroynode--Remove_file--Vfinish
+*    vio.c:VSPgetinfo--Load_vfile--vinitialize 
+*    vio.c:vpackvs
+*    vio.c:vunpackvs
+*    vio.c:VSdetach
+*    vio.c:VSattach
+*    vio.c:VSdestroynode
+*    vconv.c:Vimakecompat--vmakecompat (no change. compat to ver. 3)
+*    
+* First draft on 7/31/96, modified on 8/6/96, 8/15/96
+*************************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+/* -----------------  VSfindex ---------------------
+NAME
+      VSfindex -- find index of a named field in a vdata
+USAGE
+      intn VSfindex(int32 vsid, char *fieldname, int32 *findex)
+      int32 vsid;    IN: vdata id which contains this field
+      const char *fieldname; IN: field name
+      int32 *findex; OUT: field index
+RETURNS
+      Returns SUCCEED if successful;
+              FAIL otherwise.
+DESCRIPTION
+      This routine searchs field names only. It doesn't
+      search the vdata name.  Use VSinquire() or VSgetname()
+      to find vdata name. 
+---------------------------------------------------- */
+intn VSfindex(int32 vsid, const char *fieldname, int32 *findex)
+{
+     CONSTR(FUNC, "VSfindex");
+     vsinstance_t *vs_inst;
+     VDATA *vs;
+     DYN_VWRITELIST *w;
+     int32 nflds;
+     int32 ret_value = SUCCEED;
+     intn i, found = 0;
+
+     HEclear();
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     vs = vs_inst->vs;
+     w = &vs->wlist;
+     nflds = w->n;
+     for (i=0; i<nflds; i++)   {
+#ifdef VDATA_FIELDS_ALL_UPPER
+         if (matchnocase(fieldname, w->name[i]))
+             { 
+               found = 1;
+               *findex = i;
+               break;
+             }
+#else
+         if (HDstrcmp(fieldname, w->name[i]) == 0)
+             { 
+               found = 1;
+               *findex = i;
+               break;
+             }
+#endif /* VDATA_FIELDS_ALL_UPPER */
+     }         
+     if (!found)  
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+      
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}       /* VSfindex */
+
+/* -------------- VSsetattr ---------------------------------
+NAME
+   VSsetattr -- Set attribute for a vdata or a field of a
+                     vdata
+USAGE
+   intn VSsetattr(int32 vsid, int32 findex, char *attrname,
+                 int32 datatype, int32 count, void * values)
+   int32 vsid;     IN: vdata access id
+   int32 findex; IN: number determined by assinging each field 
+                       in a record a number starting with 0; 
+                       _HDF_VDATA (-1) represents the entire vdata. 
+   const char *attrname;   IN: name of the attribute
+   int32 datatype;   IN: data type of the attribute
+   int32 count;      IN: number of values the attribute has
+   const void * values;     IN: a buffer which contains the values of 
+                           the attribute
+RETURNS
+   Returns SUCCEED if successful, FAIL otherwise.
+DESCRIPTION
+   Create a vdata to store this attribute.
+   If the field already has an attribute with the same name,
+   replace the current values with the new values if the 
+   new data type and order are the same as the current ones;
+   changes in data type or order will be considered as errors.
+   No limit on max number of attributes. (int32 is the final
+   limit.)
+-----------------------------------------------------------  */
+intn VSsetattr(int32 vsid, int32 findex, const char *attrname,
+                 int32 datatype, int32 count, const void * values)
+{
+     CONSTR(FUNC, "VSsetattr");
+     vsinstance_t *vs_inst, *attr_inst;
+     VDATA    *vs, *attr_vs;
+     DYN_VWRITELIST *w, *attr_w;
+     intn i;
+     int32 nattrs, ret_value = SUCCEED;
+     int32 attr_vs_ref, fid, attr_vsid;
+
+     HEclear();
+
+     /* check if id is valid vdata */
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+     /* check for null attribute name */
+     if (attrname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+     /* check for read access */
+     if (vs->access == 'r')
+        HGOTO_ERROR(DFE_BADATTACH, FAIL);
+
+     w = &(vs->wlist);
+     /* check field index */
+     if ((findex >= w->n || findex < 0) && (findex != _HDF_VDATA))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+     /* if the attr already exist for this field, check data type
+        and order */
+     nattrs = vs->nattrs;
+     fid = vs->f; /* assume attrs are in the same file */
+     if (nattrs && vs->alist != NULL)    {
+        for (i=0; i<nattrs; i++)  {
+            if (vs->alist[i].findex == findex) {
+               attr_vs_ref = (int32)vs->alist[i].aref;
+               attr_vsid = VSattach(fid, attr_vs_ref, "w");
+               if (attr_vsid == FAIL)
+                  HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+               if (NULL == (attr_inst=(vsinstance_t *)HAatom_object(attr_vsid)))
+                  HGOTO_ERROR(DFE_NOVS, FAIL);
+               if (NULL == (attr_vs = attr_inst->vs))
+                  HGOTO_ERROR(DFE_BADPTR, FAIL);
+               if (HDstrcmp(attr_vs->vsname, attrname) == 0)  {
+                   attr_w = &attr_vs->wlist;
+                   if (attr_w->n != 1 || datatype != attr_w->type[0] ||
+                      count != attr_w->order[0])   {
+                         VSdetach(attr_vsid);
+                         HGOTO_ERROR(DFE_BADATTR, FAIL);
+                    }  /* type or order changed */
+                   /* replace the values  */
+                   if (1 != VSwrite(attr_vsid, values, 1, FULL_INTERLACE)) {
+                       VSdetach(attr_vsid);
+                       HGOTO_ERROR(DFE_VSWRITE, FAIL);
+                   }
+                   if (FAIL == VSdetach(attr_vsid))
+                       HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+                   HGOTO_DONE(SUCCEED); 
+               }  /* attr exist */
+               if (FAIL == VSdetach(attr_vsid))
+                  HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+            } /* if findex */
+        }   /* for loop, not exists */ 
+     }
+     /* create a vdata to store the attribute */
+     if (FAIL == (attr_vs_ref = VHstoredatam(fid, ATTR_FIELD_NAME, 
+           values, 1, datatype, attrname,  _HDF_ATTRIBUTE, count)))
+        HGOTO_ERROR(DFE_VSCANTCREATE, FAIL);
+     /* add this attr to vs->alist */
+     if (vs->alist == NULL)    {
+        if (vs->nattrs > 0)
+           HGOTO_ERROR(DFE_BADATTR, FAIL); 
+        vs->alist=(vs_attr_t *)HDmalloc(sizeof(vs_attr_t));
+     }
+     else  
+        vs->alist = HDrealloc(vs->alist,(vs->nattrs+1) * sizeof(vs_attr_t));
+     if (vs->alist == NULL)  
+           HGOTO_ERROR(DFE_NOSPACE, FAIL);
+     vs->alist[vs->nattrs].findex = findex;
+     vs->alist[vs->nattrs].atag = DFTAG_VH;
+     vs->alist[vs->nattrs].aref = (uint16)attr_vs_ref; 
+     vs->nattrs++;
+     /* set attr flag and  version number */
+     vs->flags = vs->flags | VS_ATTR_SET;
+     vs->version = VSET_NEW_VERSION;
+     vs->marked = 1;
+     vs->new_h_sz = 1;
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* VSsetattr */
+
+
+/* ------------------ VSnattrs ------------------------ 
+NAME
+   VSnattrs -- get total number of attributes assigned for
+                  this vdata and its fields
+USAGE
+   intn VSnattrs(int32 vsid);
+   int32 vsid;   IN: access id of the vdata
+RETURNS
+   Returns total number of attributes assigned to this vdata
+   and its fields when successful, FAIL otherwise. 
+DESCRIPTION
+   Use VSfnattrs to get number of attributes for a field
+   or for the vdata ifself.
+--------------------------------------------------------  */
+intn VSnattrs(int32 vsid)
+{
+    CONSTR(FUNC, "VSnattrs");
+    vsinstance_t *vs_inst;
+    VDATA *vs;
+    int32 ret_value = SUCCEED;
+    
+     HEclear();
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     ret_value = vs->nattrs;
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* VSnattrs */
+
+/* ---------------- VSfnattrs -------------------------
+NAME
+   VSfnattrs -- get the number of attributes assigned to
+                  a vdata or a field of a vdata.
+USAGE
+   intn VSfnattrs(int32 vsid, int32 findex);
+   int32 vsid;   IN: access id of the vdata
+   int32 findex; IN: index of the field, 0 based. 
+                     Use _HDF_VDATA (-1) for the vdata itself. 
+RETURNS
+   Returns the number of attributes assigned to 
+   the specified field when successful, FAIL otherwise.
+DESCRIPTION
+   Use VSnattrs to get total number of attributes for all
+   fields and the vdata ifself.
+--------------------------------------------------------  */
+intn VSfnattrs(int32 vsid, int32 findex)
+{
+    CONSTR(FUNC, "VSfnattrs");
+    vsinstance_t *vs_inst;
+    VDATA *vs;
+    int32 ret_value = SUCCEED;
+    vs_attr_t *vs_alist;
+    intn i, nattrs, t_attrs;
+ 
+     HEclear();
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if ((findex > vs->wlist.n || findex < 0) && (findex != _HDF_VDATA))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+     t_attrs = vs->nattrs;
+     vs_alist = vs->alist;
+
+     nattrs = 0;
+     for (i=0; i<t_attrs; i++)  {
+         if (vs_alist->findex == findex)  
+            nattrs++;
+         vs_alist++;
+     }
+     ret_value = nattrs;
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* VSfattrs */
+              
+/* --------------  VSfindattr ---------------------
+NAME
+   VSfindattr -- get index of an attribute with given name
+                      for a field of a vdata or for the vdata itself
+USAGE
+   intn VSfindattr(int32 vsid, int32 findex, char *attrname)
+   int32 vsid;        IN: access id of the vdata
+   int32 findex;      IN: index of the field starting from 0;
+                          _HDF_VDATA (-1) for the vdata 
+   char *attrname;    IN: name of the attr
+RETURNS
+   Returns the index of the attr when successful, FAIL otherwise.
+DESCRIPTION
+
+------------------------------------------------------------  */
+intn VSfindattr(int32 vsid, int32 findex, const char *attrname)
+{
+     CONSTR(FUNC, "VSfindattr");
+     VDATA *vs, *attr_vs;
+     vsinstance_t *vs_inst, *attr_inst;
+     vs_attr_t *vs_alist;
+     int32 fid, attr_vsid;
+     int32 ret_value = FAIL;
+     intn i, nattrs, a_index, found;
+
+     HEclear();
+     /* check if id is valid vdata */
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+     /* check for null attribute name */
+     if (attrname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if ((findex >= vs->wlist.n || findex < 0) && (findex != _HDF_VDATA))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+     nattrs = vs->nattrs;
+     vs_alist = vs->alist;
+     if (nattrs == 0 || vs_alist == NULL)
+          /* no attrs or bad attr list */
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+    fid = vs->f;
+    found = 0;
+    a_index = -1;  
+    for (i=0; i<nattrs; i++)  {
+        if (vs_alist->findex == findex)  {
+           a_index++; /* index of fld attr */
+           if ((attr_vsid = VSattach(fid, (int32)vs_alist->aref, "r")) 
+               == FAIL)
+               HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+           if (HAatom_group(attr_vsid) != VSIDGROUP)  {
+               VSdetach(attr_vsid);
+               HGOTO_ERROR(DFE_ARGS, FAIL);
+           }
+           if (NULL == 
+              (attr_inst = (vsinstance_t *)HAatom_object(attr_vsid))) {
+               VSdetach(attr_vsid);
+               HGOTO_ERROR(DFE_NOVS, FAIL);
+           }
+           if (NULL == (attr_vs = attr_inst->vs) ||
+               HDstrncmp(attr_vs->vsclass, _HDF_ATTRIBUTE, 
+                             HDstrlen(_HDF_ATTRIBUTE)))  {
+               VSdetach(attr_vsid);
+               HGOTO_ERROR(DFE_BADATTR, FAIL);
+           }
+           if (!HDstrcmp(attr_vs->vsname, attrname)) {
+               ret_value = a_index;
+               found = 1;
+           }
+           if (VSdetach(attr_vsid) == FAIL)
+               HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+        }
+        if (found)
+               break;
+        vs_alist++;
+    }
+
+done:
+    if (ret_value == FAIL)
+       { /*  Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* VSfindattr */
+
+/* ------------- VSattrinfo --------------------------
+NAME
+   VSattrinfo -- get info of an attribute of a vdata/field
+USAGE
+   intn VSattrinfo(int32 vsid, int32 findex, intn attrindex,
+        char *name, int32 *datatype, int32 *count, int32 *size);
+   int32 vsid;      IN: vdata id
+   int32 findex;    IN: field index. _HDF_VDATA (-1) for the vdata
+   intn attrindex;  IN: which attr of the field/vdata 
+                        attrindex is 0-based
+   char *name;      OUT: attribute name
+   int32 *datatype; OUT: datatype of the attribute
+   int32 *count;    OUT: number of values
+   int32 *size;     OUT: size of the attr values on local machine
+RETURNS
+   Returns SUCCEED when successful, FAIL otherwise.
+DESCRIPTION
+   name, datatype or count can be NULL if which is not interested.
+--------------------------------------------------- */
+intn VSattrinfo(int32 vsid, int32 findex, intn attrindex, 
+     char *name, int32 *datatype, int32 *count, int32 *size)
+{
+
+     CONSTR(FUNC, "VSattrinfo");
+     VDATA *vs, *attr_vs;
+     vs_attr_t *vs_alist;
+     vsinstance_t *vs_inst, *attr_inst;
+     int32 attr_vsid;
+     int32 ret_value = SUCCEED;
+     intn i, nattrs, a_index, found;
+     DYN_VWRITELIST *w;
+     char *fldname;
+
+     HEclear();
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if ((findex >= vs->wlist.n || findex < 0) && (findex != _HDF_VDATA))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+     nattrs = vs->nattrs;
+     if (attrindex <0 || attrindex >= nattrs)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+     vs_alist = vs->alist;
+     if (nattrs == 0 || vs_alist == NULL)
+          /* no attrs or bad attr list */
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+    found = 0;
+    a_index = -1; 
+    for (i=0; i<nattrs; i++)  {
+        if (vs_alist->findex == findex)  {
+           a_index++; 
+           if (a_index == attrindex) {
+              found = 1;
+              break;
+           }
+        }
+        vs_alist++;
+    }
+    if (!found)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* found. get attr info */
+    if (FAIL == (attr_vsid = VSattach(vs->f, (int32)vs_alist->aref, "r")))
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (NULL == (attr_inst = (vsinstance_t *)HAatom_object(attr_vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (attr_vs = attr_inst->vs) ||
+          HDstrcmp(attr_vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (name) {
+       HDstrncpy(name, attr_vs->vsname, HDstrlen(attr_vs->vsname));
+       name[HDstrlen(attr_vs->vsname)] = '\0';
+    }
+    w = &(attr_vs->wlist);
+    fldname = w->name[0];
+    /* this vdata has 1 field */
+    if (w->n != 1 || HDstrcmp(fldname, ATTR_FIELD_NAME))
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (datatype) 
+        *datatype =  (int32)w->type[0];
+    if (count)
+        *count = (int32)w->order[0];
+    if (size)
+        *size = w->order[0] * (DFKNTsize(w->type[0] | DFNT_NATIVE));
+    if (FAIL == VSdetach(attr_vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* VSattrinfo */
+
+/* ----------------------  VSgetattr --------------------
+NAME
+   VSgetattr -- get values of a specified attribute
+USAGE
+   intn VSgetattr(int32 vsid, int32 findex, intn attrindex,
+                  void * values)
+   int32 vsid;     IN: vdata access id
+   int32 findex;   IN: field index; _HDF_VDATA (-1) for vdata
+   intn attrindex; IN: attribute index
+   void * values;  OUT: buffer holding attribute values.
+RETURNS
+   Returns SUCCEED if successful, FAIL otherwise
+DESCRIPTION
+
+--------------------------------------------------------- */
+intn VSgetattr(int32 vsid, int32 findex, intn attrindex,
+               void * values)
+{
+     CONSTR(FUNC, "VSgetattr");
+     VDATA *vs, *attr_vs;
+     vs_attr_t *vs_alist;
+     vsinstance_t *vs_inst, *attr_inst;
+     int32 fid, attr_vsid;
+     int32 ret_value = SUCCEED;
+     intn i, nattrs, a_index, found;
+     int32 n_recs, il;
+     char fields[FIELDNAMELENMAX+1];
+
+     HEclear();
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if ((findex >= vs->wlist.n || findex < 0) && (findex != _HDF_VDATA))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+     nattrs = vs->nattrs;
+     if (attrindex <0 || attrindex >= nattrs)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+     vs_alist = vs->alist;
+     if (nattrs == 0 || vs_alist == NULL)
+          /* no attrs or bad attr list */
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+     fid = vs->f;  /* assume attrs are in the same file */
+    found = 0;
+    a_index = -1; 
+    for (i=0; i<nattrs; i++)  {
+        if (vs_alist->findex == findex)  {
+           a_index++;
+           if (a_index == attrindex) {
+              found = 1;
+              break;
+           }
+        }
+        vs_alist++;
+    }
+    if (!found)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* found. get attr info */
+        if ((attr_vsid = VSattach(fid, (int32)vs_alist->aref, "r")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (HAatom_group(attr_vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* check correctness of attr vdata */
+    if (NULL == (attr_inst = (vsinstance_t *)HAatom_object(attr_vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (attr_vs = attr_inst->vs) ||
+          HDstrcmp(attr_vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (FAIL == VSinquire(attr_vsid, &n_recs, &il, fields, NULL, NULL))
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (HDstrcmp(fields, ATTR_FIELD_NAME) != 0)
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+    /* ready to read */
+    if (FAIL == VSsetfields(attr_vsid, fields))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+    if (FAIL == VSread(attr_vsid, (unsigned char *)values, n_recs, il))
+        HGOTO_ERROR(DFE_VSREAD, FAIL);
+    if (FAIL == VSdetach(attr_vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* VSgetattr */
+
+/* -------------------- VSisattr ----------------------
+NAME
+   VSisattr -- test if a vdata is an attribute of 
+                    other object
+USAGE
+   intn VSisattr(int32 vsid)
+   int32 vsid;    IN: vdata access id
+RETURNS
+   Returns TRUE if the vdata is an attribute,
+   FALSE otherwise
+DESCRIPTION
+
+-------------------------------------------------------- */
+intn VSisattr(int32 vsid)
+{
+     CONSTR(FUNC, "VSsetattr");
+     vsinstance_t *vs_inst;
+     VDATA    *vs;
+     int32  ret_value = FALSE;
+
+     HEclear();
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FALSE);
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FALSE);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FALSE);
+     if (HDstrcmp(vs->vsclass,  _HDF_ATTRIBUTE) == 0)
+        ret_value = TRUE;
+done:
+    if (ret_value == FALSE)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* VSisattr */
+
+/* -----------------  Vsetattr  -------------------------
+NAME 
+   Vsetattr -- set an attribute for a vgroup
+USAGE 
+   intn Vsetattr(int32 vgid,  char *attrname, int32 datatype,
+             int32 count, void * values) 
+   int32 vgid;        IN: access id of the vgroup
+   char *attrname;    IN: name of the attr
+   int32 datatype;    IN: datatype of the attr
+   int32 count;       IN: number of values the attr has
+   void * values;      IN: values of the attr
+RETURNS
+   Returns SUCCEED when successful, FAIL otherwise.
+DESCRIPTION
+   Create a vdata to store this attribute.
+   If the vgroup already has an attribute with the same name
+      and if the type and order are the same, use the new 
+      values to replace the current values. Any changes in 
+      datatype or order will be considered as an error.
+   No limit on max number of attributes. (int32 is the final
+      limit. 
+------------------------------------------------------------  */
+intn Vsetattr(int32 vgid, const char *attrname, int32 datatype,
+              int32 count, const void * values)
+{
+    CONSTR(FUNC, "Vsetattr");
+    VGROUP *vg; 
+    VDATA *vs;
+    vginstance_t *v;
+    vsinstance_t *vs_inst;
+    DYN_VWRITELIST *w;
+    int32 ret_value = SUCCEED;
+    int32 attr_vs_ref,fid, vsid;
+    intn i;
+
+    HEclear();
+
+    /* check if id is valid vgroup */
+    if (HAatom_group(vgid)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check for null attribute name */
+    if (attrname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vgid)))
+        HGOTO_ERROR(DFE_VTAB, FAIL);
+
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    if ((vg->otag != DFTAG_VG) || (vg->access != 'w'))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (vg->otag != DFTAG_VG)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+    
+    fid = vg->f;
+
+    if ((vg->alist != NULL && vg->nattrs == 0) ||
+        (vg->alist == NULL && vg->nattrs != 0))
+      HGOTO_ERROR(DFE_BADATTR, FAIL);
+ 
+    /* if the attr already exist, check data type and order. */ 
+   if (vg->alist != NULL) {
+       for (i=0; i<vg->nattrs; i++)  { 
+           if ((vsid = VSattach(fid, (int32)vg->alist[i].aref, "w")) == FAIL)
+               HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+           if (NULL == (vs_inst=(vsinstance_t *)HAatom_object(vsid)))  
+               HGOTO_ERROR(DFE_NOVS, FAIL);
+           if (NULL == (vs = vs_inst->vs))
+               HGOTO_ERROR(DFE_BADPTR, FAIL);
+           if (HDstrcmp(vs->vsname, attrname) == 0)  {
+               w = &vs->wlist;
+               if (w->n != 1 || w->type[0] != datatype ||
+                   w->order[0] != count)  {
+                        VSdetach(vsid);
+                        HGOTO_ERROR(DFE_BADATTR, FAIL);
+               }  /* type or order changed */
+               /* replace the values  */
+               if (1 != VSwrite(vsid, values, 1, FULL_INTERLACE)) {
+                   VSdetach(vsid);
+                   HGOTO_ERROR(DFE_VSWRITE, FAIL);
+               }
+               if (FAIL == VSdetach(vsid))
+                  HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+                  HGOTO_DONE(SUCCEED);
+           }  /* attr exist */
+           if (FAIL == VSdetach(vsid))
+               HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+       }   /* for loop, not exists */
+    }
+    /* create the attr_vdata and insert it into vg->alist */ 
+    if ((attr_vs_ref = VHstoredatam(fid, ATTR_FIELD_NAME, 
+          values, 1, datatype, attrname, _HDF_ATTRIBUTE, count)) 
+         == FAIL)  
+        HGOTO_ERROR(DFE_VSCANTCREATE, FAIL); 
+    /* add the attr to attr list */
+    if (vg->alist == NULL) 
+       vg->alist = (vg_attr_t *)HDmalloc(sizeof(vg_attr_t));
+    else 
+       /* not exist */
+       vg->alist = HDrealloc(vg->alist, (vg->nattrs + 1) * sizeof(vg_attr_t));
+    if (vg->alist == NULL)
+       HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    vg->nattrs++;
+    vg->flags = vg->flags | VG_ATTR_SET;
+    vg->version = VSET_NEW_VERSION;
+    vg->alist[vg->nattrs-1].atag = DFTAG_VH;
+    vg->alist[vg->nattrs-1].aref = (uint16)attr_vs_ref; 
+    vg->marked = 1;
+    /* list of refs of all attributes, it is only used when Vattrinfo2 is
+       invoked; see Vattrinfo2 function header for info. 2/4/2011 -BMR */
+    vg->old_alist = NULL;
+    vg->noldattrs = 0;
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vsetattr */
+
+/* -----------------  Vgetversion  -----------------------
+NAME 
+   Vgetversion -- gets vset version of a vgroup
+USAGE 
+   int32 Vgetversion(int32 vgid)
+   int32 vgid;     IN: vgroup access id
+RETURNS
+   Returns vset version number if successful, FAIL otherwise.
+DESCRIPTION
+   Version 4 (VSET_NEW_VERSION) allows attrs.
+   Version 2 (VSET_OLD_VERSION) is the old vset (before
+             it was merged into HDF3.2?)
+   Version 3 (VSET_VERSION) is the version between
+             HDF3.2 through HDF4.0r2.
+
+------------------------------------------------------------  */
+int32 Vgetversion(int32 vgid)
+{
+    CONSTR(FUNC, "Vgetversion");
+    VGROUP *vg;
+    vginstance_t *v;
+    int16 vg_version;
+    int32 ret_value = FAIL;
+
+    HEclear();
+    if (HAatom_group(vgid)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vgid)))
+        HGOTO_ERROR(DFE_VTAB, FAIL);
+
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+    vg_version = vg->version;
+    ret_value = (int32) vg_version;
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vgetversion */
+
+/* ---------------- Vnattrs ------------------------ 
+NAME
+   Vnattrs  -- get number of attributes for a vgroup
+USAGE
+   intn Vnattrs(int32 vgid)
+   int32 vgid;    IN: access id of the vgroup
+RETURNS
+   Returns number of attributes when successful, Fail otherwise.
+DESCRIPTION
+
+--------------------------------------------------  */
+intn Vnattrs(int32 vgid)
+{
+    CONSTR(FUNC, "Vnattrs");
+    VGROUP *vg;
+    vginstance_t *v;
+    int32 ret_value = SUCCEED;
+
+    HEclear();
+    if (HAatom_group(vgid) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *)HAatom_object(vgid)))
+        HGOTO_ERROR(DFE_VTAB, FAIL);
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+    if (vg->otag != DFTAG_VG)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+    ret_value = vg->nattrs;
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vnattrs */
+
+
+/* ---------------- Vnoldattrs ------------------------ 
+NAME
+   Vnoldattrs  -- get number of old-style attributes in a vgroup
+USAGE
+   intn Vnoldattrs(int32 vgid)
+   int32 vgid;    IN: access id of the vgroup
+RETURNS
+   Returns number of old-style attributes when successful, FAIL, otherwise.
+DESCRIPTION
+   There are two types of attributes for vgroups.  One is the old-style
+   that was created using methods other than the standard attribute API
+   function Vsetattr, which was introduced after HDF Version 4.0 Release
+   2, July 19, 1996.  Without the use of Vsetattr, an application could
+   simulate an attribute for a vgroup by creating and writing a vdata
+   of class _HDF_ATTRIBUTE and adding that vdata to the vgroup via
+   these calls:
+
+   vdata_ref = VHstoredatam(file_id, ATTR_FIELD_NAME, values, size, type,
+               attr_name, _HDF_ATTRIBUTE, order);
+   ret_value = Vaddtagref (vgroup_id, DFTAG_VH, vdata2_ref);
+
+   Note that a vgroup (and vdata) that has attribute created by Vsetattr
+   (and VSsetattr) will have a version number of VSET_NEW_VERSION (4)
+   while the other type will have version number of VSET_VERSION (3.)
+
+   While both types of attributes are stored as vdatas, the vdatas of
+   the new-style attributes are saved in a list of attribute tags/refs
+   of the vgroup, and the vdatas of the old-style attributes are saved
+   as elements of the vgroup.  Because of the different storages, the
+   new attribute functions would miss the old-style attributes.  Note
+   that the attribute in the SD API are created/stored using the old
+   approach.  Thus, V API would miss the SD attributes.
+
+   Two new fields are added to the internal structure vgroup_desc,
+   noldattrs and old_alist, for holding the number of old-style attributes
+   and their ref#s, respectively.  Vnoldattrs calls VSofclass to get
+   the number of old-style attributes and their ref numbers, then sets
+   these two fields when old-style attributes exist in the file before
+   returning the number of old-style attributes to the caller.
+   -BMR 2011/2/16
+
+--------------------------------------------------  */
+intn Vnoldattrs(int32 vgid)
+{
+    CONSTR(FUNC, "Vnoldattrs");
+    VGROUP *vg;
+    vginstance_t *v;
+    intn n_old_attrs=0;
+    intn ii;
+    uint16 *areflist=NULL;
+    int32 ret_value = 0;
+
+    HEclear();
+    if (HAatom_group(vgid) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get number of old-style attributes */
+    n_old_attrs = VSofclass(vgid, _HDF_ATTRIBUTE, 0, 0, NULL);
+
+    /* Note: a new attribute is stored in vdata of class _HDF_ATTRIBUTE too, but
+       it is only saved in the file as attribute (by tag/ref,) not as an element
+       of the vgroup.  Hence, vg->nattrs = 1, but vg->nvelt = 0 -BMR Feb, 2011*/
+
+    /* Store the ref numbers of old-style attributes into the list
+       vg->old_alist, for easy access later by Vattrinfo2 and Vgetattr2 */ 
+    if (n_old_attrs > 0)
+    {
+        /* Locate vg's index in vgtab */
+        if (NULL == (v = (vginstance_t *)HAatom_object(vgid)))
+            HGOTO_ERROR(DFE_VTAB, FAIL);
+        vg = v->vg;
+        if (vg == NULL)
+            HGOTO_ERROR(DFE_BADPTR, FAIL);
+        if (vg->otag != DFTAG_VG)
+            HGOTO_ERROR(DFE_ARGS,FAIL);
+
+	/* Establish the list of attribute refs if it is not done so already 
+	   or if it is outdated. */
+
+	/* temporary list of attr refs to pass into VSofclass */
+        areflist = (uint16 *) HDmalloc(sizeof(uint16) * n_old_attrs);
+	if (areflist == NULL)
+	    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+	/* Get ref numbers of old-style attributes belonging to this vg */
+	n_old_attrs = VSofclass(vgid, _HDF_ATTRIBUTE, 0, (uintn)n_old_attrs, areflist);
+	if (n_old_attrs == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+	/* Do nothing when the list exists and is current */
+	if (vg->old_alist != NULL && vg->noldattrs == n_old_attrs)
+	{
+	    ret_value = vg->noldattrs;
+	    HGOTO_DONE(vg->noldattrs);
+	}
+
+	/* Either list doesn't exist or exists but is not current */
+	else if (vg->noldattrs != n_old_attrs)
+	{
+	    /* List is outdated, i.e., more old style attributes had been added
+	       since the list was established, release it */
+	    if (vg->old_alist != NULL)
+		HDfree(vg->old_alist);
+
+	    /* Allocate new list */
+            vg->old_alist = (vg_attr_t *)HDmalloc(sizeof(vg_attr_t) * (n_old_attrs));
+	    if (vg->old_alist == NULL)
+		HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+	} /* not current */
+
+	/* Transfer ref nums to the vg_attr_t list for future accesses */
+        for (ii = 0; ii < n_old_attrs; ii++)
+	{
+	    vg->old_alist[ii].aref = areflist[ii];
+	    /* atag is not needed */
+	}
+	vg->noldattrs = n_old_attrs; /* record number of old-style attrs */
+
+	ret_value = vg->noldattrs;
+    } /* there are some old attributes */
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+    if (areflist != NULL)
+	HDfree(areflist);
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vnoldattrs */
+
+
+/* ---------------- Vnattrs2 ------------------------ 
+NAME
+   Vnattrs2  -- get number of old and new attributes for a vgroup
+USAGE
+   intn Vnattrs2(int32 vgid)
+   int32 vgid;    IN: access id of the vgroup
+RETURNS
+   Returns number of attributes when successful, FAIL, otherwise.
+DESCRIPTION
+   The returned number of attributes will include:
+	1. the attributes created by the Vgroup attribute API
+	   routines, that were added starting from Vgroups version
+	   VSET_NEW_VERSION, and
+	2. the attributes created using the combination of
+	   VHstoredatam and Vaddtagref/Vinsert, most likely prior to
+	   the availability of the attribute API routines.
+   More detailed description is available in the header of Vnoldattrs.
+
+   This function was added specifically to assist the HDF Mapping
+   project.  -BMR 2011/2/8
+
+--------------------------------------------------  */
+intn Vnattrs2(int32 vgid)
+{
+    CONSTR(FUNC, "Vnattrs2");
+    intn n_new_attrs=0, n_old_attrs=0;
+    int32 ret_value = SUCCEED;
+
+    HEclear();
+
+    /* Get number of new-style attributes */
+    n_new_attrs = Vnattrs(vgid);
+    if (n_new_attrs == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Get number of old-style attributes */
+    n_old_attrs = Vnoldattrs(vgid);
+    if (n_old_attrs == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Total number of attributes */
+    ret_value = n_old_attrs + n_new_attrs;
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vnattrs2 */
+
+
+/* -----------------  Vfindattr  -----------------------
+ NAME
+   Vfindattr -- get index of an attribute with given name
+ USAGE
+   intn Vfindattr(int32 vgid, char *attrname)
+   int32 vgid;        IN: access id of the vgroup
+   const char *attrname;    IN: name of the attr
+ RETURNS
+   Returns the index of the attr when successful, FAIL otherwise. 
+ DESCRIPTION
+------------------------------------------------------------  */
+intn Vfindattr(int32 vgid, const char *attrname)
+{
+    CONSTR(FUNC, "Vfindattr");
+    VGROUP *vg;
+    VDATA *vs;
+    vginstance_t *v;
+    vsinstance_t *vs_inst;
+    int32 fid, vsid;
+    int32 ret_value = FAIL;
+    intn i, found;
+
+    HEclear();
+
+    /* check if id is valid vgroup */
+    if (HAatom_group(vgid) != VGIDGROUP)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check for null attribute name */
+    if (attrname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *)HAatom_object(vgid)))
+       HGOTO_ERROR(DFE_VTAB, FAIL);
+    vg = v->vg;
+    fid = vg->f; 
+    if (vg == NULL)
+       HGOTO_ERROR(DFE_BADPTR, FAIL);
+    if (vg->otag != DFTAG_VG)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+    if (vg->nattrs == 0 || vg->alist == NULL)
+          /* no attrs or bad attr list */
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+    found = 0;
+    for (i=0; found == 0 && i<vg->nattrs; i++)  {
+        if ((vsid = VSattach(fid, (int32)vg->alist[i].aref, "r")) == FAIL)
+            HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+        if (HAatom_group(vsid) != VSIDGROUP)
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+        if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+            HGOTO_ERROR(DFE_NOVS, FAIL);    
+        if (NULL == (vs = vs_inst->vs) ||
+            HDstrcmp(vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+            HGOTO_ERROR(DFE_BADATTR, FAIL);
+        if (0 == HDstrcmp(vs->vsname, attrname)) {
+            ret_value = i;
+            found = 1;
+        }
+        if (VSdetach(vsid) == FAIL) 
+            HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+    }
+
+done:
+    if (ret_value == FAIL)
+    { /*  Error condition cleanup */
+    } /* end if */
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vfindattr */
+        
+/* ----------   Vattrinfo ----------------------
+NAME
+   Vattrinfo -- get info of a vgroup attribute
+USAGE
+   intn Vattrinfo(int32 vgid, intn attrindex, char *name,
+                  int32 *datatype, int32 *count, int32 *size)
+   int32 vgid;      IN: vgroup id
+   intn attrindex;  IN: which attr's info we want
+                             attrindex is 0-based
+   char *name;      OUT: attribute name 
+   int32 *datatype; OUT: datatype of the attribute
+   int32 *count;    OUT: number of values
+   int32 *size;     OUT: size of the attr values on local machine.
+
+RETURNS
+   Returns SUCCEED when successful, FAIL otherwise.
+DESCRIPTION
+   name, datatype or count can be NULL if which is
+   not interested.
+--------------------------------------------------- */
+intn Vattrinfo(int32 vgid, intn attrindex, char *name,
+             int32 *datatype, int32 *count, int32 *size)
+{
+    CONSTR(FUNC, "Vattrinfo");
+    VGROUP *vg;
+    VDATA *vs;
+    DYN_VWRITELIST  *w;
+/*    char fldname[FIELDNAMELENMAX + 1]; */
+    char *fldname;
+    vginstance_t *v;
+    vsinstance_t *vs_inst;
+    int32 fid, vsid;
+    int32 ret_value = SUCCEED;
+
+    HEclear();
+    if (HAatom_group(vgid) != VGIDGROUP)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *)HAatom_object(vgid)))
+       HGOTO_ERROR(DFE_VTAB, FAIL);
+    vg = v->vg;
+    fid = vg->f;
+    if (vg == NULL)
+       HGOTO_ERROR(DFE_BADPTR, FAIL);
+    if (vg->otag != DFTAG_VG)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+    if (vg->nattrs <= attrindex || vg->alist == NULL) 
+         /* not that many attrs or bad attr list */
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    if ((vsid = VSattach(fid, (int32)vg->alist[attrindex].aref, "r")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (vs = vs_inst->vs) ||
+          HDstrcmp(vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (name)  {
+        HDstrncpy(name, vs->vsname, HDstrlen(vs->vsname));
+        name[HDstrlen(vs->vsname)] = '\0';
+    }
+    w = &(vs->wlist);
+    fldname = w->name[0];
+    /* this vdata has 1 field */
+    if (w->n != 1 || HDstrcmp(fldname, ATTR_FIELD_NAME))  
+/*    if (w->n != 1 )   */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (datatype)
+       *datatype =  (int32)w->type[0];
+    if (count)
+       *count = (int32)w->order[0];
+    if (size)
+       *size = w->order[0] * (DFKNTsize(w->type[0] | DFNT_NATIVE));
+    if (FAIL == VSdetach(vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vattrinfo */
+
+
+/* ------------ Vattrinfo2 ----------------------
+NAME
+   Vattrinfo2 -- get info of a vgroup attribute
+USAGE
+   intn Vattrinfo2(int32 vgid, intn attrindex, char *name,
+                  int32 *datatype, int32 *count, int32 *size)
+   int32 vgid;      IN: vgroup id
+   intn attrindex;  IN: which attr's info we want, attrindex is 0-based
+   char *name;      OUT: attribute name 
+   int32 *datatype; OUT: datatype of the attribute
+   int32 *count;    OUT: number of values
+   int32 *size;     OUT: size of the attr values on local machine.
+
+RETURNS
+   Returns SUCCEED when successful, FAIL otherwise.
+DESCRIPTION
+   Vattrinfo2 is an updated version of Vattrinfo.  Both functions return
+   the information of an attribute belongging to the given vgroup.
+   However, unlike Vattrinfo, which only processes new-style attributes,
+   i.e., attributes created by Vsetattr, Vattrinfo2 also handles old-style
+   attributes.  In addition, Vattrinfo2 was written to assist the HDF
+   Mapping writer.  Thus, it is assumed that Vattrinfo2 is to be used in
+   a loop going through all the attributes of the vgroup, including
+   old-style and, perhaps, new-style attributes, if they exist.  Refer to
+   the function header of Vnattrs2 and Vnoldattrs for more detail.
+
+   If the vgroup has both types of attributes, the old-style attributes 
+   will be listed first, hence, the need for Vattrinfo2 to be used in a
+   loop.
+
+   Note that Vattrinfo2 must be used in conjunction with Vnattrs2, which
+   is an updated version of Vnattrs, or Vnoldattrs, which is invoked by
+   Vnattrs2.  Vnoldattrs finds old-style attributes and establishes the
+   list of their ref numbers for Vattrinfo2 to access.
+
+   Note that the arguments name, datatype or count can be NULL if which
+   is not interested.
+   -BMR 2011/2/16
+-------------------------------------------------------------- */
+intn Vattrinfo2(int32 vgid, intn attrindex, char *name, int32 *datatype,
+	int32 *count, int32 *size, int32 *nfields, uint16 *refnum)
+{
+    CONSTR(FUNC, "Vattrinfo2");
+    VGROUP *vg;
+    VDATA *vs;
+    DYN_VWRITELIST  *w;
+    vginstance_t *vg_inst;
+    vsinstance_t *vs_inst;
+    vg_attr_t *vg_alist=NULL;
+    int32 vsid;
+    intn adjusted_index;
+    int32 ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Make sure given object is a vgroup */
+    if (HAatom_group(vgid) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate vg's index in vgtab */
+    if (NULL == (vg_inst = (vginstance_t *)HAatom_object(vgid)))
+       HGOTO_ERROR(DFE_VTAB, FAIL);
+    vg = vg_inst->vg;
+    if (vg == NULL)
+       HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* Validate arguments */
+
+    if (attrindex < 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL); /* invalid attribute index given */
+
+    adjusted_index = attrindex;
+    if (adjusted_index < vg->noldattrs) /* index of old-style attribute */
+        vg_alist = vg->old_alist;  /* use old-attr list */
+    else if (adjusted_index >= vg->noldattrs &&
+	     adjusted_index < (vg->nattrs+vg->noldattrs))
+		 /* index of new-style attributes */
+    {
+        /* Adjust the index to accommodate for the old-style attributes
+	   preceding the new-style attribute list */
+	adjusted_index = adjusted_index - vg->noldattrs;
+        vg_alist = vg->alist;        /* use new-attr list */
+    }
+    else /* not that many attrs */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    if (vg_alist == NULL)
+        /* Bad attr list */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    /* Getting attribute information */
+
+    /* Get access to the vdata storing the attr, and obtain requested info */
+    if ((vsid = VSattach(vg->f, (int32)vg_alist[adjusted_index].aref, "r")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (vs = vs_inst->vs) ||
+          HDstrcmp(vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (name)  {
+        HDstrncpy(name, vs->vsname, HDstrlen(vs->vsname));
+        name[HDstrlen(vs->vsname)] = '\0';
+    }
+    w = &(vs->wlist);
+    if (datatype)
+       *datatype =  (int32)w->type[0];
+    if (count)
+       *count = (int32)w->order[0];
+    if (size)
+       *size = w->order[0] * (DFKNTsize(w->type[0] | DFNT_NATIVE));
+    if (nfields)
+       *nfields = (int32)w->n; /* Note: int32 to be consistent with VFnfields */
+    if (refnum)
+       *refnum = vs->oref;
+    if (FAIL == VSdetach(vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vattrinfo2 */
+
+/* ----------  Vgetattr  -----------------------
+NAME
+   Vgetattr -- read values of a vgroup attribute
+USAGE
+   intn Vgetattr(int32 vgid, intn attrindex, void * values)
+   int32 vgid;      IN: vgroup id
+   intn attrindex;  IN: index of the attribute
+   void * values;    OUT: where the values go
+RETURNS
+   Returns SUCCEED when successful, FAIL otherwise
+DESCRIPTION
+
+------------------------------------------------- */
+
+intn Vgetattr(int32 vgid, intn attrindex, void * values)
+{
+    CONSTR(FUNC, "Vgetattr");
+    VGROUP *vg;
+    VDATA *vs;
+    char fields[FIELDNAMELENMAX];
+    vginstance_t *v;
+    vsinstance_t *vs_inst;
+    int32 fid, vsid;
+    int32 n_recs, il;
+    int32 ret_value = SUCCEED;
+    
+    HEclear();
+    if (HAatom_group(vgid) != VGIDGROUP)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *)HAatom_object(vgid)))
+       HGOTO_ERROR(DFE_VTAB, FAIL);
+    vg = v->vg;
+    fid = vg->f;
+    if (vg == NULL)
+       HGOTO_ERROR(DFE_BADPTR, FAIL);
+    if (vg->otag != DFTAG_VG)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+    if (vg->nattrs <= attrindex || vg->alist == NULL) 
+          /* not that many attrs or bad attr_Vg tag/ref */
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    
+    if ((vsid = VSattach(fid, (int32)vg->alist[attrindex].aref, "r")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* check correctness of attr vdata */
+    if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (vs = vs_inst->vs) ||
+          HDstrcmp(vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (FAIL == VSinquire(vsid, &n_recs, &il, fields, NULL, NULL))
+        HGOTO_ERROR(DFE_BADATTR, FAIL);  
+/*    if (HDstrcmp(fields, ATTR_FIELD_NAME) != 0)
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+*/
+    /* ready to read */
+    if (FAIL == VSsetfields(vsid, ATTR_FIELD_NAME))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+    if (FAIL == VSread(vsid, (unsigned char *)values, n_recs, il))
+        HGOTO_ERROR(DFE_VSREAD, FAIL);
+    if (FAIL == VSdetach(vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vgetattr */
+
+/* ----------  Vgetattr2  -----------------------
+NAME
+   Vgetattr2 -- read values of a vgroup attribute
+		   (updated of Vgetattr)
+USAGE
+   intn Vgetattr2(int32 vgid, intn attrindex, void * values)
+   int32 vgid;      IN: vgroup id
+   intn attrindex;  IN: index of the attribute
+   void * values;  OUT: buffer for attribute values
+RETURNS
+   Returns SUCCEED when successful, FAIL otherwise
+DESCRIPTION
+   This function is an updated version of Vgetattr because,
+   beside processing an attribute that was created by the
+   Vsetattr, it also reads values of an attribute that was
+   created prior to Vsetattr by other method such as the
+   combination of VHstoredatam and Vaddtagref/Vinsert.
+   More detailed description is available in the function
+   header of Vnattrs2 and Vnoldattrs.
+   -BMR 2011/2/16
+------------------------------------------------- */
+intn Vgetattr2(int32 vgid, intn attrindex, void * values)
+{
+    CONSTR(FUNC, "Vgetattr2");
+    VGROUP *vg;
+    VDATA *vs;
+    char fields[FIELDNAMELENMAX];
+    vginstance_t *v;
+    vsinstance_t *vs_inst;
+    vg_attr_t *vg_alist=NULL;
+    intn adjusted_index;
+    int32 vsid=-1;
+    int32 n_recs, il;
+    int32 ret_value = SUCCEED;
+    
+    /* Clear error stack */
+    HEclear();
+
+    /* Make sure given object is a vgroup */
+    if (HAatom_group(vgid) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *)HAatom_object(vgid)))
+       HGOTO_ERROR(DFE_VTAB, FAIL);
+    vg = v->vg;
+    if (vg == NULL)
+       HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* Validate arguments */
+
+    if (attrindex < 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL); /* invalid attribute index given */
+
+    adjusted_index = attrindex;
+    if (adjusted_index < vg->noldattrs) /* index of old-style attribute */
+        vg_alist = vg->old_alist;  /* use old-attr list */
+    else if (adjusted_index >= vg->noldattrs &&
+	     adjusted_index < (vg->nattrs+vg->noldattrs))
+		 /* index of new-style attributes */
+    {
+        /* Adjust the index to accommodate for the old-style attributes
+	   preceding the new-style attribute list */
+	adjusted_index = adjusted_index - vg->noldattrs;
+        vg_alist = vg->alist;        /* use new-attr list */
+    }
+    else /* not that many attrs */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    if (vg_alist == NULL)
+        /* Bad attr list */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    /* Getting attribute information */
+
+    /* Get access to the vdata storing the attr, and obtain requested info */
+    if ((vsid = VSattach(vg->f, (int32)vg_alist[adjusted_index].aref, "r")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check correctness of attr vdata */
+    if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (vs = vs_inst->vs) ||
+          HDstrcmp(vs->vsclass, _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    /* Get vdata information */
+    if (FAIL == VSinquire(vsid, &n_recs, &il, fields, NULL, NULL))
+        HGOTO_ERROR(DFE_BADATTR, FAIL);  
+
+    /* Ready to read */
+
+    /* Some older attribute vdatas have field name as "AttrValues" instead
+       of the common "VALUES" (ATTR_FIELD_NAME) so we need to use what was
+       read by VSinquire instead of ATTR_FIELD_NAME -BMR 2011/2/11 (I'll look
+       for "AttrValues" in previous versions of the library, just in case) */
+     /* if (FAIL == VSsetfields(vsid, ATTR_FIELD_NAME))
+ */ 
+    if (FAIL == VSsetfields(vsid, fields))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+    if (FAIL == VSread(vsid, (unsigned char *)values, n_recs, il))
+        HGOTO_ERROR(DFE_VSREAD, FAIL);
+    if (FAIL == VSdetach(vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+    if (vsid != -1)
+        VSdetach(vsid);
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vgetattr2 */
+
diff --git a/hdf/src/vattr.h b/hdf/src/vattr.h
new file mode 100644
index 0000000..22002e9
--- /dev/null
+++ b/hdf/src/vattr.h
@@ -0,0 +1,34 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $ "
+#endif
+
+/***********************************************************
+ * vattr.h - vdata/vgroup attribute interface
+ *
+ ***********************************************************  */
+
+/* $Id: vattr.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+#ifndef _VATTR_H
+#define _VATTR_H
+
+#include "hdf.h"
+#include "vg.h"
+
+
+#endif
+
+
diff --git a/hdf/src/vattrf.c b/hdf/src/vattrf.c
new file mode 100644
index 0000000..a9b5add
--- /dev/null
+++ b/hdf/src/vattrf.c
@@ -0,0 +1,364 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: vattrf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/*
+   *
+   * vattrf.c
+   * Part of the HDF Vset attribute interface.
+   *
+   * C routines (short names) to be called from fortran
+   *
+   *
+   ******************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.h"
+#include "hproto_fortran.h"
+
+/* ----------------- vsfcfdx ---------------------- 
+ *  get field index
+ *  VSfindex -- vsfcfdx -- vsffidx
+ */
+
+FRETVAL(intf)
+nvsfcfdx(intf *vsid, _fcd fldnm, intf *findex,
+         intf *fldnmlen)
+{
+    intf  ret;
+    char *fld;
+
+    fld = HDf2cstring(fldnm, (intn) *fldnmlen);
+    if (!fld) return(FAIL);
+    ret = (intf) VSfindex((int32) *vsid, fld, (int32 *) findex);
+    HDfree(fld);
+    return(ret);
+}
+
+/* -------------------------------------------------
+ * vsfcsat -- set a numeric attr for a vdata or a field
+ *            of a vdata
+ * VSsetattr -- vsfcsat -- vsfsnat
+ */
+
+FRETVAL(intf)
+nvsfcsat(intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+         intf *count, intf *values, intf *attrnmlen)
+{
+    intf  ret;
+    char *attrname;
+    int32 cfindex;
+
+    attrname = HDf2cstring(attrnm, (intn) *attrnmlen);
+    if (!attrname) return(FAIL);
+    cfindex = *findex;
+    ret = (intf )VSsetattr((int32) *vsid, (int32) cfindex, attrname,
+              (int32) *dtype, (int32) *count, (VOIDP) values);
+    HDfree(attrname);
+    return(ret);
+} 
+
+/* ----------------------------------------------------
+ * vsfcsca -- set char attr for vdata or its field
+ * 
+ * VSsetattr -- vsfcsca -- vsfscat
+ */
+
+FRETVAL(intf)
+nvsfcsca(intf *vsid, intf *findex, _fcd attrnm, intf *dtype,
+         intf *count, _fcd values, intf *attrnmlen)
+{
+    intf ret;
+    char *attrname;
+    int32 cfindex;
+ 
+    attrname = HDf2cstring(attrnm, (intn) *attrnmlen);
+    if (!attrname) return(FAIL);
+    cfindex = *findex;
+    ret = (intf) VSsetattr((int32) *vsid, (int32) cfindex, attrname,
+          (int32) *dtype, (int32) *count, (VOIDP) _fcdtocp(values));
+    HDfree(attrname);
+    return(ret);
+}
+
+/* -------------------------------------------------------
+ * vsfnats -- get total number of attributes of a vdata and
+ *             its fields
+ * VSnattrs -- vsfnats
+ */
+
+FRETVAL(intf)
+nvsfnats(intf *vsid)
+{
+   intf ret;
+
+   ret = (intf) VSnattrs((int32) *vsid); 
+   return(ret);
+}
+
+/* -------------------------------------------------------
+ * vsffnas -- get number of attributes of a vdata or of a field
+ *
+ * VSfnattrs -- vsffnas
+ */
+
+FRETVAL(intf)
+nvsffnas(intf *vsid, intf *findex)
+{ 
+    intf ret;
+    int32 cfindex;
+
+    cfindex = *findex;
+    ret = (intf) VSfnattrs((int32) *vsid, (int32) cfindex);
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vsfcfda -- find attribute of a vdata of a field
+ *               of the vdata
+ *    VSfindattr -- vsfcfda -- vsffdat
+ */
+
+FRETVAL(intf)
+nvsfcfda(intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen)
+{
+    intf ret;
+    char *attrname;
+    int32 cfindex;
+
+    attrname = HDf2cstring(attrnm, (intn) *attrnmlen);
+    if (!attrname) return(FAIL);
+    cfindex = *findex;
+    
+    ret = (intf) VSfindattr((int32) *vsid, (int32) cfindex, attrname);
+    HDfree(attrname);
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vsfainf -- get attribute info
+ * VSattrinfo -- vsfcain -- vsfainf
+ */
+
+FRETVAL(intf)
+nvsfcain(intf *vsid, intf *findex, intf *aindex, _fcd attrname,
+         intf *dtype, intf *count, intf *size, intf *attrnamelen)
+{
+    CONSTR(FUNC, "vsfainf");
+    intf ret = FAIL;
+    /* temporary variables */
+    int32 cfindex;
+    int32 tdtype, tcount, tsize;
+    char  *tattrname;
+
+    cfindex = *findex;
+    /* Allocate space for fortran strings */
+    tattrname = (char *) HDmalloc(*attrnamelen + 1);
+    if (!tattrname)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    ret = (intf) VSattrinfo((int32) *vsid, (int32) cfindex, (int32) *aindex,
+          tattrname, &tdtype, &tcount, &tsize);
+    if (ret != FAIL){
+	/* move values from temporary space to fortran variables */
+	*dtype = tdtype;
+	*count = tcount;
+	*size = tsize;
+	/* convert C-string results back to Fortran strings */
+	HDpackFstring(tattrname, _fcdtocp(attrname), (intn) *attrnamelen);
+    }
+    HDfree(tattrname);
+    return(ret);
+}
+
+
+/* ---------------------------------------------------------
+ * vsfgnat -- get values of a numeric attribute 
+ * VSgetattr -- vsfgnat
+ */
+
+FRETVAL(intf)
+nvsfgnat(intf *vsid, intf *findex, intf *aindex, intf *values)
+{
+    intf ret;
+    int32 cfindex;
+
+    cfindex = *findex;
+    ret = (intf) VSgetattr((int32) *vsid,(int32) cfindex,(int32) *aindex,
+                           (VOIDP) values);
+    return(ret);
+}
+
+/* --------------------------------------------------------
+ * vsfgcat -- get values of a char type attribute 
+ * VSgetattr -- vsfgcat
+ */
+
+FRETVAL(intf)
+nvsfgcat(intf *vsid,intf *findex,intf *aindex,_fcd values)
+{
+    intf ret;
+    int32 cfindex;
+
+    cfindex = *findex;
+    ret = (intf )VSgetattr((int32) *vsid, cfindex, (int32) *aindex,
+                    (VOIDP) _fcdtocp(values));
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vsfisat -- test if a vdata is an attribute of other object
+ * VSisattr -- vsfisat
+ */
+
+FRETVAL(intf)
+nvsfisat(intf *vsid)
+{
+    intf ret;
+    ret = (intf) VSisattr((int32) *vsid);
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vfcsatt -- set a numeric attr for a vgroup
+ * Vsetattr -- vfcsatt -- vfsnatt
+ */
+
+FRETVAL(intf)
+nvfcsatt(intf *vgid, _fcd attrnm, intf *dtype,
+         intf *count, intf *values, intf *attrnmlen)
+{
+    intf  ret;
+    char *attrname;
+
+    attrname = HDf2cstring(attrnm, (intn) *attrnmlen);
+    if (!attrname) return(FAIL);
+    ret = (intf) Vsetattr((int32) *vgid, attrname, (int32) *dtype, 
+                   (int32) *count, (VOIDP) values);
+    HDfree(attrname);
+    return(ret);
+} 
+
+/* ----------------------------------------------------
+ * vfcscat -- set char attr for vgroup
+ * 
+ * Vsetattr -- vfcscat -- vfscatt
+ */
+
+FRETVAL(intf)
+nvfcscat(intf *vgid, _fcd attrnm, intf *dtype, intf *count, 
+         _fcd values, intf *attrnmlen)
+{
+    intf ret;
+    char *attrname;
+ 
+    attrname = HDf2cstring(attrnm, (intn) *attrnmlen);
+    if (!attrname) return(FAIL);
+    ret = (intf) Vsetattr((int32) *vgid, attrname, (int32) *dtype, 
+           (int32) *count, (VOIDP) _fcdtocp(values));
+    HDfree(attrname);
+    return(ret);
+}
+
+/* -------------------------------------------------------
+ * vfnatts -- get number of attributes of a vgroup 
+ * Vnattrs -- vfnatts
+ */
+
+FRETVAL(intf)
+nvfnatts(intf *vgid)
+{
+   intf ret;
+
+   ret = (intf) Vnattrs((int32) *vgid); 
+   return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vfcfdat -- find attribute of a vgroup
+ * Vfindattr -- vfcfdat -- vffdatt
+ */
+
+FRETVAL(intf)
+nvfcfdat(intf *vgid, _fcd attrnm, intf *attrnmlen)
+{
+    intf ret;
+    char *attrname;
+
+    attrname = HDf2cstring(attrnm, (intn) *attrnmlen);
+    if (!attrname) return(FAIL);
+    ret = (intf) Vfindattr((int32) *vgid, attrname);
+    HDfree(attrname);
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vfainf -- get attribute info
+ * Vattrinfo -- vfainfo
+ */
+
+FRETVAL(intf)
+nvfainfo(intf *vgid, intf *aindex, _fcd attrname,
+         intf *dtype, intf *count, intf *size)
+{
+    intf ret;
+    ret = (intf) Vattrinfo((int32) *vgid, (int32) *aindex,
+          _fcdtocp(attrname), (int32 *) dtype, (int32 *) count, 
+          (int32 *) size);
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vfgnatt -- get values of a numeric attribute 
+ * Vgetattr -- vfgnatt
+ */
+
+FRETVAL(intf)
+nvfgnatt(intf *vgid, intf *aindex, intf *values)
+{
+    intf ret;
+    ret = (intf) Vgetattr((int32) *vgid, *aindex,
+                    (VOIDP) values);
+    return(ret);
+}
+
+/* --------------------------------------------------------
+ * vfgcatt -- get values of a char type attribute 
+ * Vgetattr -- vfgcatt
+ */
+
+FRETVAL(intf)
+nvfgcatt(intf *vgid, intf *aindex, _fcd values)
+{
+    intf ret;
+    ret = (intf) Vgetattr((int32) *vgid,(int32) *aindex,(VOIDP) _fcdtocp(values));
+    return(ret);
+}
+
+/* ---------------------------------------------------------
+ * vfgver -- get version number of a vgroup
+ * Vgetversion -- vfgver
+ */
+
+FRETVAL(intf)
+nvfgver(intf *vgid)
+{
+    intf ret;
+    ret = (intf) Vgetversion((int32) *vgid);
+    return(ret);
+}
+
diff --git a/hdf/src/vattrff.f b/hdf/src/vattrff.f
new file mode 100644
index 0000000..5b3ef20
--- /dev/null
+++ b/hdf/src/vattrff.f
@@ -0,0 +1,135 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C***************************************************
+C
+C $Id: vattrff.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+C **************************************************
+C *
+C * vattrff.f
+C * Vset attribute Fortran routines
+C *
+C *************************************************
+
+C --------------- vsffidx ------------------------
+C    vsffidx -- find index of a named field in a vdata
+C    VSfindex -- vsfcfdx -- vsffidx
+C
+       integer function vsffidx(vsid, fldnm, fldidx) 
+       integer vsid
+       character*(*) fldnm
+       integer fldidx
+       integer vsfcfdx
+
+       vsffidx = vsfcfdx(vsid, fldnm, fldidx, 
+     +                  len(fldnm))
+       end
+C --------------- vsfsnat -------------------------
+C    vsfsnat -- set a numeric attribute for a vdata 
+C              or a field of a vdata
+C    VSsetattr -- vsfcsat -- vsfsnat
+C
+       integer function vsfsnat(vsid, findex,attrnm,dtype,
+     +                        count, values)
+       integer vsid, findex, dtype, count
+       character*(*) attrnm
+       integer  values
+       integer vsfcsat
+     
+       vsfsnat = vsfcsat(vsid, findex, attrnm, dtype,
+     +                count, values, len(attrnm))
+       end
+C --------------- vsfscat -------------------------
+C    vsfscat -- set a char type attribute for a vdata 
+C              or a field of a vdata
+C    VSsetattr -- vsfcsca -- vsfscat
+C
+       integer function vsfscat(vsid, findex,attrnm,dtype,
+     +                      count, values)
+       integer vsid, findex, dtype, count
+       character*(*) attrnm
+       character*(*) values
+       integer vsfcsca
+     
+       vsfscat = vsfcsca(vsid, findex, attrnm, dtype,
+     +         count, values, len(attrnm))
+       end
+C --------------- vsffdat -------------------------
+C    vsffdat -- find attribute of a vdata of a field
+C               of the vdata
+C    VSfindattr -- vsfcfda -- vsffdat
+C
+       integer function vsffdat(vsid, findex, attrnm)
+       integer vsid, findex
+       character*(*) attrnm
+       integer vsfcfda
+
+       vsffdat = vsfcfda(vsid, findex, attrnm, 
+     +                   len(attrnm))
+       end 
+C ------------------- vsfainf -------------------------
+C    vsfainf -- get attribute info
+C    VSattrinfo -- vsfcain -- vsfainf
+C
+       integer function vsfainf(vsid, findex, aindex, attrname,
+     +         dtype, count, size)
+       integer vsid, findex, aindex, dtype, count, size
+       character*(*) attrname
+       integer vsfcain
+
+       vsfainf = vsfcain(vsid, findex, aindex, attrname,
+     +                   dtype, count, size, len(attrname))
+       end 
+C ------------------- vfsnatt -------------------------
+C    vfsnatt -- set a numeric attr for a vgroup
+C    Vsetattr -- vfcsatt -- vfsnatt 
+C
+       integer function vfsnatt(vgid, attrnm, dtype, 
+     +                        count, values)
+       integer vgid, dtype, count, values
+       character*(*) attrnm
+       integer vfcsatt
+
+       vfsnatt = vfcsatt(vgid, attrnm, dtype,count,
+     +                  values, len(attrnm))
+       end
+C -------------- vfscatt -------------------------
+C    vfscatt -- set a char attr for a vgroup
+C    Vsetattr -- vfcscat -- vfscatt
+C
+       integer function vfscatt(vgid, attrnm, dtype,
+     +                        count, values)
+       integer vgid, dtype, count
+       character*(*) attrnm, values
+       integer vfcscat
+
+       vfscatt = vfcscat(vgid, attrnm, dtype,count,
+     +                  values, len(attrnm))
+       end
+C --------------- vffdatt ---------------------
+C    vffdatt -- find an attribute of a vgroup
+C    Vfindattr -- vfcfdat -- vffdatt
+C
+       integer function vffdatt(vg, attrnm)
+       integer vg
+       character*(*)   attrnm
+       integer vfcfdat
+
+       vffdatt = vfcfdat(vg, attrnm, len(attrnm))
+       end
+C --------------------------------------------
+
+ 
+
+     
diff --git a/hdf/src/vconv.c b/hdf/src/vconv.c
new file mode 100644
index 0000000..a136706
--- /dev/null
+++ b/hdf/src/vconv.c
@@ -0,0 +1,494 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5691 $";
+#endif
+
+/* $Id: vconv.c 5691 2011-09-19 16:02:14Z bmribler $ */
+
+/* obsolete code for HDF 3.2. 26/march/92 jason ng */
+/* except for the following routines:
+   *    vicheckcompat()
+   *    movebytes ()
+   *    oldunpackvg ()
+   *    oldunpackvs ()
+ map_from_old_types -- Convert an old type (i.e. LOCAL_INT to DFNT_ based types)
+
+ */
+
+/*
+   *
+   * vconv.c
+   * Part of the HDF Vset interface.
+ */
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+/*
+   ** ==================================================================
+   ** PRIVATE data areas and routines
+   ** ==================================================================
+   * */
+
+/*
+   * types used in defining a new field via a call to VSfdefine
+ */
+
+#define LOCAL_NOTYPE        0
+#define LOCAL_CHARTYPE      1   /* 8-bit ascii text stream */
+#define LOCAL_INTTYPE       2   /* 32-bit integers - don't use */
+#define LOCAL_FLOATTYPE     3   /* as opposed to DOUBLE */
+#define LOCAL_LONGTYPE      4   /* 32-bit integers */
+#define LOCAL_BYTETYPE      5   /* 8-bit byte stream - unsupported */
+#define LOCAL_SHORTTYPE     6   /* 16-bit integers - unsupported */
+#define LOCAL_DOUBLETYPE    7   /* as opposed to FLOAT - unsupported */
+
+/*
+   * actual LOCAL MACHINE sizes of the above types
+ */
+
+#define LOCAL_UNTYPEDSIZE  0
+#define LOCAL_CHARSIZE      sizeof(char)
+#define LOCAL_INTSIZE       sizeof(int)
+#define LOCAL_FLOATSIZE     sizeof(float)
+#define LOCAL_LONGSIZE      sizeof(long)
+#define LOCAL_BYTESIZE      sizeof(unsigned char)
+#define LOCAL_SHORTSIZE     sizeof(short)
+#define LOCAL_DOUBLESIZE    sizeof(double)
+
+/*
+   stores sizes of local machine's known types
+ */
+
+PRIVATE int16 local_sizetab[] =
+{
+    LOCAL_UNTYPEDSIZE,
+    LOCAL_CHARSIZE,
+    LOCAL_INTSIZE,
+    LOCAL_FLOATSIZE,
+    LOCAL_LONGSIZE,
+    LOCAL_BYTESIZE,
+    LOCAL_SHORTSIZE,
+    LOCAL_DOUBLESIZE
+};
+
+#define LOCALSIZETAB_SIZE sizeof(local_sizetab)/sizeof(int)
+
+/*
+ ** returns the machine size of a field type
+ ** returns FAIL if error
+ */
+PRIVATE int16
+VSIZEOF(int16 x)
+{
+    if (x < 0 || x > (int16)(LOCALSIZETAB_SIZE - 1))
+      {
+          return (FAIL);
+      }
+    else
+      {
+          return (local_sizetab[x]);
+      }
+}   /* VSIZEOF */
+
+
+/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
+/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
+/*                                                                    */
+/* routines for converting from vsets in v1.0 to v2.x                 */
+/*                                                                    */
+/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
+/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */
+
+/* ------------------------------------------------------------------ */
+
+PRIVATE void oldunpackvg(VGROUP * vg, uint8 buf[], int32 *size);
+PRIVATE void oldunpackvs(VDATA * vs, uint8 buf[], int32 *size);
+
+/*
+   *  this routine checks that the given OPENED file is compatible with
+   *    version 2.0 or later of the HDF Vset library .
+   *  RETURNS 1  if file already compatible with r2.
+   *          0  if not compatible.
+   *          -1 if error.
+ */
+int32
+vicheckcompat(HFILEID f)
+{
+    int16       foundold, foundnew;
+    int32       aid;
+
+    foundold = 0;
+    foundnew = 0;
+    /* locate any OLD vgs */
+    aid = Hstartread(f, (uint16) OLD_VGDESCTAG, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+        foundold++;
+        Hendaccess(aid);
+      }
+
+    /* locate any OLD vdatas */
+    aid = Hstartread(f, (uint16) OLD_VSDESCTAG, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+        foundold++;
+        Hendaccess(aid);
+      }
+
+    /* locate any NEW vgs */
+    aid = Hstartread(f, NEW_VGDESCTAG, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+        foundnew++;
+        Hendaccess(aid);
+      }
+
+    /* locate any NEW vdatas */
+    aid = Hstartread(f, NEW_VSDESCTAG, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+        foundnew++;
+        Hendaccess(aid);
+      }
+
+    HEclear();	/* clear the stack to remove faux failures - bug #655 */
+    if (foundold == 0)  /* has no old vset elements */
+        return (1);     /* just assume compatible */
+
+    if (foundnew > 0)
+        return (1);     /* file is already compatible */
+    else
+        return (0);     /* file is not compatible */
+}   /* vicheckcompat */
+
+/* ------------------------------------------------------------------ */
+/*
+   * This routine will modify a given OPENED file so that is becomes compatible
+   * with version 2.0 or later of the HDF Vset library.
+   * Note that the file is assumed to be not compatible to begin with.
+   * This routine will not check to see if the file is already compatible,
+   * but it is harmless to run an already-compatible file through again.
+   *
+   * However, be aware that each time, the file gets larger.
+   * Also, file must be opened with DFACC_ALL access.
+   *
+   * returns  1 if successful. if error, returns 0
+ */
+
+int32
+vimakecompat(HFILEID f)
+{
+    VGROUP     *vg;
+    VDATA      *vs;
+    uint8      *buf = NULL;     /* to store an old vdata or vgroup descriptor  */
+    int32       old_bsize = 0, bsize=0;
+    int32       aid;
+    int32       ret;
+    uintn       u;
+    uint16      tag=DFTAG_NULL, ref=DFTAG_NULL;
+    CONSTR(FUNC, "vimakecompat");
+
+    /* =============================================  */
+    /* --- read all vgs and convert each --- */
+
+    /* allocate space for vg */
+    if (NULL == (vg =VIget_vgroup_node()))
+        HRETURN_ERROR(DFE_NOSPACE, 0);
+    ret = aid = Hstartread(f, (uint16) OLD_VGDESCTAG, DFREF_WILDCARD);
+    while (ret != FAIL)
+      {
+          HQuerytagref(aid, &tag, &ref);
+          HQuerylength(aid, &bsize);
+          if (buf == NULL || bsize > old_bsize)
+            {
+                if (buf != NULL)
+                    HDfree((VOIDP) buf);
+                if ((buf = (uint8 *) HDmalloc(bsize)) == NULL)
+                    HRETURN_ERROR(DFE_NOSPACE, 0);
+                old_bsize = bsize;
+            }   /* end if */
+          ret = Hgetelement(f, (uint16) OLD_VGDESCTAG, ref, (uint8 *) buf);
+          if (ret == FAIL)
+            {
+                HDfree((VOIDP) buf);
+                HRETURN_ERROR(DFE_READERROR, 0)
+            }   /* end if */
+
+          oldunpackvg(vg, buf, &bsize);
+          /* add new items */
+          vg->vgclass = NULL;
+          /* vg->vgclass[0] = '\0'; */ 
+          vg->extag = 0;
+          vg->exref = 0;
+          vg->version = 2;  /* version 2 */
+          vg->more = 0;
+          /* inside each vgroup, change the old tags to new */
+          for (u = 0; u < (uintn)vg->nvelt; u++)
+              if (vg->tag[u] == OLD_VGDESCTAG)
+                  vg->tag[u] = NEW_VGDESCTAG;
+              else if (vg->tag[u] == OLD_VSDESCTAG)
+                  vg->tag[u] = NEW_VSDESCTAG;
+              else  /* BAD */
+                  HERROR(DFE_NOTINSET);
+          vpackvg(vg, buf, &bsize);
+
+          ret = Hputelement(f, VGDESCTAG, ref, (uint8 *) buf, bsize);
+          HDfree((VOIDP) buf);
+          if (ret == FAIL)
+              HRETURN_ERROR(DFE_WRITEERROR, 0);
+
+          ret = Hnextread(aid, (uint16) OLD_VGDESCTAG, DFREF_WILDCARD, DF_CURRENT);
+      }     /* while */
+    Hendaccess(aid);
+    VIrelease_vgroup_node(vg);
+
+    /* =============================================  */
+    /* --- read all vdata descs  and convert each --- */
+    /* --- then dup a tag for each vdata data elt --- */
+
+    old_bsize = 0;  /* reset state variables */
+    buf = NULL;
+    if ((vs = VSIget_vdata_node()) == NULL)
+        HRETURN_ERROR(DFE_NOSPACE, 0);
+    ret = aid = Hstartread(f, (uint16) OLD_VSDESCTAG, DFREF_WILDCARD);
+    while (ret != FAIL)
+      {
+
+          HQuerytagref(aid, &tag, &ref);
+          HQuerylength(aid, &bsize);
+          if (buf == NULL || bsize > old_bsize)
+            {
+                if (buf != NULL)
+                    HDfree((VOIDP) buf);
+                if ((buf = (uint8 *) HDmalloc(bsize)) == NULL)
+                    HRETURN_ERROR(DFE_NOSPACE, 0);
+                old_bsize = bsize;
+            }   /* end if */
+          ret = Hgetelement(f, tag, ref, (uint8 *) buf);
+          if (ret == FAIL)
+            {
+                HDfree((VOIDP) buf);
+                HRETURN_ERROR(DFE_READERROR, 0)
+            }   /* end if */
+
+          oldunpackvs(vs, buf, &bsize);
+
+          /* add new items */
+          vs->vsclass[0] = '\0';
+          vs->extag = 0;
+          vs->exref = 0;
+          vs->version = 2;  /* version 2 */
+          vs->more = 0;
+          vpackvs(vs, buf, &bsize);
+
+          ret = Hputelement(f, VSDESCTAG, ref, (uint8 *) buf, bsize);
+          if (ret == FAIL)
+            {
+                HDfree((VOIDP) buf);
+                HRETURN_ERROR(DFE_WRITEERROR, 0)
+            }   /* end if */
+
+          /* duplicate a tag to point to vdata data */
+          ret = Hdupdd(f, NEW_VSDATATAG, ref, (uint16) OLD_VSDATATAG, ref);
+          HDfree((VOIDP) buf);
+          if (ret == FAIL)
+              HRETURN_ERROR(DFE_DUPDD, 0);
+          ret = Hnextread(aid, (uint16) OLD_VSDESCTAG, DFREF_WILDCARD, DF_CURRENT);
+      }     /* while */
+
+    Hendaccess(aid);
+    VSIrelease_vdata_node(vs);
+
+    return (1);
+
+}   /* vimakecompat */
+
+/* ================================================================== */
+/*
+   *  this routine checks that the given file is compatible with
+   *    version 2.0 or later of the HDF Vset library .
+   *
+   *  All it does is to open the file, call vicheckcompat to do all the
+   *  checking, and then closes it.
+   *    See comments for vicheckcompat().
+
+   *  returns 1 if file already compatible with r2.
+   *          0 if not compatible.
+   *          -1 if error.
+ */
+
+int32
+vcheckcompat(char *fs)
+{
+
+    HFILEID     f;
+    int32       ret;
+    CONSTR(FUNC, "vcheckcompat");
+
+    f = Hopen(fs, DFACC_ALL, 0);
+    if (f == FAIL)
+        HRETURN_ERROR(DFE_BADOPEN, FAIL);
+    ret = vicheckcompat(f);
+    Hclose(f);
+
+    return (ret);
+}   /* vcheckcompat */
+
+/* ================================================================== */
+/*
+   * This routine will modify a given file so that is becomes compatible
+   * with version 2.0 or later of the HDF Vset library.
+   *
+   * All this routine does is to open the file, call vimakecompat to
+   * do all the conversion, and then to close the file.
+   * See comments for vimakecompat().
+   *
+   * returns  1 if successful. if error, returns 0
+ */
+
+int32
+vmakecompat(char *fs)
+{
+    HFILEID     f;
+    int32       ret;
+    CONSTR(FUNC, "vmakecompat");
+
+    f = Hopen(fs, DFACC_ALL, 0);
+    if (f == FAIL)
+        HRETURN_ERROR(DFE_BADOPEN, FAIL);
+    ret = vimakecompat(f);
+    Hclose(f);
+    return (ret);
+}   /* vmakecompat */
+
+/* ==================================================================== */
+
+static void
+oldunpackvg(VGROUP * vg, uint8 buf[], int32 *size)
+{
+    uint8      *bb;
+    int16       int16var;
+    uintn       i;
+#ifdef LATER
+    CONSTR(FUNC, "oldunpackvg");
+#endif
+
+    *size = *size;  /* dummy, so that compiler thinks it is used  */
+
+    bb = &buf[0];
+
+    /* retrieve nvelt */
+    INT16DECODE(bb, int16var);
+    vg->nvelt=(uint16)int16var;
+
+    /* retrieve the tags */
+    for (i = 0; i < (uintn)vg->nvelt; i++)
+        UINT16DECODE(bb, vg->tag[i]);
+
+    /* retrieve the refs */
+    for (i = 0; i < (uintn)vg->nvelt; i++)
+        UINT16DECODE(bb, vg->ref[i]);
+
+    /* retrieve vgname */
+    HDstrcpy(vg->vgname, (char *) bb);
+}   /* oldunpackvg */
+
+/* ================================================================= */
+
+static void
+oldunpackvs(VDATA * vs, uint8 buf[], int32 *size)
+{
+    uint8      *bb;
+    int16       int16var;
+    intn        i;
+#ifdef LATER
+    CONSTR(FUNC, "oldunpackvs");
+#endif
+
+    *size = *size;  /* dummy */
+
+    bb = &buf[0];
+
+    INT16DECODE(bb, vs->interlace);
+
+    INT32DECODE(bb, vs->nvertices);
+
+    UINT16DECODE(bb, vs->wlist.ivsize);
+
+    INT16DECODE(bb, int16var);
+    vs->wlist.n=(intn)int16var;
+
+    for (i = 0; i < vs->wlist.n; i++)   /* retrieve the type */
+        INT16DECODE(bb, vs->wlist.type[i]);
+
+    for (i = 0; i < vs->wlist.n; i++)   /* retrieve the isize */
+        UINT16DECODE(bb, vs->wlist.isize[i]);
+
+    for (i = 0; i < vs->wlist.n; i++)   /* retrieve the off */
+        UINT16DECODE(bb, vs->wlist.off[i]);
+
+    for (i = 0; i < vs->wlist.n; i++)   /* retrieve the order */
+        UINT16DECODE(bb, vs->wlist.order[i]);
+
+    for (i = 0; i < vs->wlist.n; i++)
+      {
+          HDstrcpy(vs->wlist.name[i], (char *) bb);
+          bb += (HDstrlen(vs->wlist.name[i]) + 1);
+      }
+
+    HDstrcpy(vs->vsname, (char *) bb);
+    bb += (HDstrlen(vs->vsname) + 1);
+
+    /* **EXTRA**  fill in the machine-dependent size fields */
+    for (i = 0; i < vs->wlist.n; i++) /* FAIL check on VSIZEOF()? */
+        vs->wlist.esize[i] = (uint16) (vs->wlist.order[i] * VSIZEOF((int16) vs->wlist.type[i]));
+
+}   /* oldunpackvs */
+
+/* ----------------------- map_from_old_types ------------------------------- */
+/*
+   Convert an old type (i.e. LOCAL_INT) to DFNT_ based types
+ */
+int16
+map_from_old_types(intn type)
+{
+    switch (type)
+      {
+          case LOCAL_CHARTYPE:
+              return DFNT_CHAR;
+
+          case LOCAL_BYTETYPE:
+              return DFNT_INT8;
+
+          case LOCAL_SHORTTYPE:
+          case LOCAL_INTTYPE:
+              return DFNT_INT16;
+
+          case LOCAL_LONGTYPE:
+              return DFNT_INT32;
+
+          case LOCAL_FLOATTYPE:
+              return DFNT_FLOAT32;
+
+          case LOCAL_DOUBLETYPE:
+              return DFNT_FLOAT64;
+
+          default:
+              return (int16) type;
+      }
+}   /* map_from_old_types */
+
+/* ------------------------------------------------------------------ */
diff --git a/hdf/src/vg.c b/hdf/src/vg.c
new file mode 100644
index 0000000..bf598d0
--- /dev/null
+++ b/hdf/src/vg.c
@@ -0,0 +1,1796 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5697 $";
+#endif
+/* vg.c,v 1.15.4.1 1993/10/26 19:25:07 georgev Exp */
+
+/*
+FILE  
+     vg.c
+     HDF vdata routines and some vgroup routines
+
+LOCAL ROUTINES
+==============
+ VSIgetvdatas      -- get vdatas of a specified class or created by user
+                      applications, i.e., not created by the library internally
+                      for storage.  Currently used by VSgetvdatas and VSofclass.
+EXPORTED ROUTINES
+=================
+     VSelts         -- number of elements in a vdata
+     VSgetinterlace -- returns the interlace type of the vdata
+     VSsetinterlace -- sets the vdata's interlace to full or none
+     VSgetfields    -- returns the fieldnames in a vdata
+     VSfexist       -- tests for existence of one or more fields in a vdata
+     VSsizeof       -- computes the byte size of the field(s) if a vdata
+     VSdump         -- prints contents of a vdata (for debugging)
+     VSsetname      -- associate a name with a vdata
+     VSsetclass     -- assigns a class name to a vdata
+     VSgetname      -- gets the vdata's name
+     VSgetclass     -- gets the vdata's class name
+     VSinquire      -- gets information about a vdata
+     VSisinternal   -- determines if a class name is for internal use only
+     VSlone         -- returns an array of refs of all lone vdatas in the file
+     Vlone          -- returns an array of refs of all lone vgroups in the file
+     Vfind          -- looks in the file for a vgroup with a given name 
+     VSfind         -- looks in the file for a vdata with a given name
+     Vfindclass     -- looks in the file and returns the ref of 
+                       the vgroup with the specified class
+     VSfindclass    -- looks in the file and returns the ref of the vdata 
+                       with specified class
+     VSsetblocksize -- sets the block size of the linked-block element.
+     VSsetnumblocks -- sets the number of blocks for a linked-block element.
+     VSgetblockinfo -- retrieves the block size and the number of blocks 
+		       of a linked-block element.
+     Vsetzap        -- maintaind for back compatibility
+
+PRIVATE FUNCTIONS
+=================
+     matchnocase    -- compares to strings, ignoring case
+     vscheckclass   -- checks if a given vdata has the specified class or if
+                       it is user-created, which means its class name is not
+                       one of the predefined HDF classes.
+
+PRIVATE functions manipulate vsdir and are used only within this file.
+PRIVATE data structures in here pertain to vdata in vsdir only.
+ */
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+/* These are used to determine whether a vdata had been created by the
+   library internally, that is, not created by user's application */
+#define HDF_NUM_INTERNAL_VDS	8
+const char *HDF_INTERNAL_VDS[] = {DIM_VALS, DIM_VALS01, _HDF_ATTRIBUTE,
+	_HDF_SDSVAR, _HDF_CRDVAR, "_HDF_CHK_TBL_", RIGATTRNAME, RIGATTRCLASS};
+
+/* Private functions */
+#ifdef VDATA_FIELDS_ALL_UPPER
+PRIVATE int32 matchnocase
+            (char *strx, char *stry);
+#endif /* VDATA_FIELDS_ALL_UPPER */
+
+#ifdef VDATA_FIELDS_ALL_UPPER
+/*-----------------------------------------------------------------
+NAME
+   matchnocase -  (PRIVATE) compares 2 strings, ignoring case 
+
+DESCRIPTION
+   Private routine. 
+
+RETURNS
+   if strings match return TRUE, 
+   else FALSE
+--------------------------------------------------------------------*/
+PRIVATE int32 
+matchnocase(char *strx, /* IN: first string to be compared */
+            char *stry  /* IN: second string to be compared */)
+{
+    int32  i;
+    int32  nx, ny; /* length of strings */
+
+    nx = HDstrlen(strx);
+    ny = HDstrlen(stry);
+
+    if (nx != ny)
+        return (FALSE);     /* different lengths */
+
+    for (i = 0; i < nx; i++, strx++, stry++)
+      {
+        if (toupper(*strx) != toupper(*stry))
+            return (FALSE); /* not identical */
+      }
+
+    return (TRUE);
+}   /* matchnocase */
+#endif /* VDATA_FIELDS_ALL_UPPER */
+
+/* ------------------------------------------------------------------
+NAME
+   VSelts -- get number of elements in a vdata
+
+DESCRIPTION
+   Gets the number of elements in the specified vdata
+
+RETURNS
+   On success returns the number of elements in the VDATA vkey; 
+   returns FAIL  on error.
+--------------------------------------------------------------------- */
+int32 
+VSelts(int32 vkey /* IN: vdata key */)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSelts");
+
+    /* make sure vdata key is part of vdata group */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != DFTAG_VH))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* return number of elements in vdata */
+    ret_value = (vs->nvertices);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSelts */
+
+/* ------------------------------------------------------------------
+NAME
+   VSgetinterlace -- gets interlace of the vdata vkey.
+
+DESCRIPTION
+   Gets the interlace scheme for the specified vdata.
+
+RETURNS
+   On success returns the interlace scheme used in the fil) of the 
+   specified vdata vkey.   returns FAIL on error.
+----------------------------------------------------------------------- */
+int32 
+VSgetinterlace(int32 vkey /* IN: vdata key */)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSgetinterlace");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* return interlace of vdata */
+    ret_value = ((int32) (vs->interlace));
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetinterlace */
+
+/*------------------------------------------------------------------
+NAME
+   VSsetinterlace --  sets the vdata's interlace to full or none.
+
+DESCRIPTION
+   Sets the interlace scheme for the vdata to one of
+   FULL_INTERLACE or NO_INTERLACE.
+
+RETURNS
+   SUCCEED/FAIL
+--------------------------------------------------------------------*/
+intn 
+VSsetinterlace(int32 vkey,     /* IN: vdata key */
+               int32 interlace /* IN: interlace for storing records */ )
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    intn         ret_value = SUCCEED;
+    CONSTR(FUNC, "VSsetinterlace");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* check if only read access, this is a failure */
+    if (vs->access == 'r')
+        HGOTO_ERROR(DFE_RDONLY, FAIL);
+
+    /* check if records have already been written out,
+       cannot reset interlace in this case */
+    if (vs->nvertices > 0)
+        HGOTO_ERROR(DFE_NORESET, FAIL);
+
+    /* currently only 2 kinds of interlaced schemes allowed. */
+    if (interlace == FULL_INTERLACE || interlace == NO_INTERLACE)
+      {
+          vs->interlace = (int16) interlace;
+          ret_value = SUCCEED;    /* ok */
+      }
+    else
+        ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSsetinterlace */
+
+/*------------------------------------------------------------------
+NAME
+   VSgetfields -- returns the name (if any) of all the fields in the vdata
+
+DESCRIPTION
+   Returns the names of all the fields in comma seperated string in
+   the argument 'fields'. (e.g., "PX,PY").
+
+RETURNS
+   Returns FAIL on error, 
+   else the number of fields in the vdata.
+----------------------------------------------------------------------*/
+int32 
+VSgetfields(int32 vkey,   /* IN: vdata key */
+            char *fields  /* OUT: comman seperated field name list */)
+{
+    int32        i;
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSgetfields");
+
+    /* check if a NULL field list is passed in, then return with
+       error (found while fixing bug #554) - BMR 4/30/01 */
+    if (fields == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* Got through Vdata and build the comman seperated string of field names */
+    fields[0] = '\0';
+    /* No special handling for 0-field vdatas, this algorithm should work fine. */
+    for (i = 0; i < vs->wlist.n; i++)
+      {   /* build the comma-separated string */
+          HDstrcat(fields, vs->wlist.name[i]);
+          if (i < vs->wlist.n - 1)
+              HDstrcat(fields, ",");
+      }
+
+    /* return number of fields */
+    ret_value = ((int32) vs->wlist.n);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetfields */
+
+/*------------------------------------------------------------------
+NAME
+   VSfexist -- tests for existence of 1 or more fields in a vdata.
+
+DESCRIPTION
+   The argument 'fields' is a string of comma-separated fieldnames 
+   (e.g. "PX,PY,PZ") to check for in vdata.
+
+RETURNS 
+   Returns SUCCEED if all fields exist 
+   else otherwise FAIL is returned.
+--------------------------------------------------------------------*/
+intn 
+VSfexist(int32 vkey,  /* IN: vdata key */
+         char *fields /* IN: names of fields to check for */)
+{
+    char          **av = NULL;
+    char           *s = NULL;
+    DYN_VWRITELIST *w = NULL;
+    vsinstance_t   *wi = NULL;
+    VDATA          *vs = NULL;
+    int32         ac;
+    int32         i, j;
+    int32         found;
+    intn          ret_value = SUCCEED;
+    CONSTR(FUNC, "VSfexist");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (wi = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* call scanattrs to parse the string */
+    if (scanattrs(fields, &ac, &av) < 0)
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+
+    /* get vdata itself and check it 
+       check also that more than one field in 'fields' */    
+    vs = wi->vs;
+    if ((vs == NULL) || (ac < 1))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* now check in vdata's field table for these field names */
+    w = &vs->wlist;
+    for (i = 0; i < ac; i++)
+      {
+          found = 0;
+          s = av[i];
+          /* No changes for 0-field Vdatas, this algorithm should work fine. */
+          for (j = 0; j < w->n; j++)
+            {
+#ifdef VDATA_FIELDS_ALL_UPPER
+                if (matchnocase(s, w->name[j]))
+                  {
+                      found = 1;
+                      break;
+                  }
+#else
+                if (HDstrcmp(s, w->name[j]) == 0)
+                  {
+                      found = 1;
+                      break;
+                  }
+#endif /* VDATA_FIELDS_ALL_UPPER */
+            }
+          if (!found)
+            HGOTO_DONE(FAIL);
+      }
+
+    ret_value = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VSfexist */
+
+/* -----------------------------------------------------------------
+NAME
+   VSsizeof - computes the byte size of the field(s) of a vdata.
+
+DESCRIPTION
+   The size is the actual size for the local architecture
+
+RETURNS
+   The byte size of the field(s), positive integer, on success; 
+   otherwise, returns FAIL.
+----------------------------------------------------------------- */
+int32 
+VSsizeof(int32 vkey,   /* IN vdata key */
+         char *fields  /* IN: Name(s) of the fields to check size of */ )
+{
+    int32       totalsize;
+    int32       i, j;
+    int32       found;
+    int32       ac;
+    char        **av = NULL;
+    vsinstance_t *w  = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSsizeof");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    totalsize = 0;
+    if (fields == NULL) /* default case? */
+      {   /* count all field sizes in vdata */
+        for (j = 0; j < vs->wlist.n; j++)	
+            totalsize += vs->wlist.esize[j];
+      }		
+    else
+      {  /* parse field string */
+        if ((scanattrs(fields, &ac, &av) < 0) || (ac < 1))
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+
+        for (i = 0; i < ac; i++)
+          {   /* check fields in vs */
+            for (found = 0, j = 0; j < vs->wlist.n; j++)	
+                if (!HDstrcmp(av[i], vs->wlist.name[j]))
+                  {
+                    totalsize += vs->wlist.esize[j];
+                    found = 1;
+                    break;
+                  }
+
+            if (!found)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+          }	/* end for */
+      }		/* end else */
+
+    /* return total size of vdata fields specified */
+    ret_value = totalsize;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSsizeof */
+
+/*----------------------------------------------------------------- 
+NAME
+   VSdump - prints contents of a vdata (for debugging) 
+
+DESCRIPTION
+    Prints contents of a vdata (for debugging) 
+
+RETURNS
+   No return codes.
+-------------------------------------------------------------------*/
+VOID 
+VSdump(int32 vkey /* IN: vdata key */)
+{
+    vkey = vkey;    /* suppress warning */
+}   /* VSdump */
+
+/*-------------------------------------------------------
+NAME
+   VSsetname - give a name to a vdata.
+
+DESCRIPTION
+   Truncates name to max length of VSNAMELENMAX
+   If new name is longer than the current name set new_h_sz,
+      so that VSdetach will delete the original vdata header
+      and write a new header. 
+
+RETURNS
+   SUCCEED/FAIL
+----------------------------------------------------------*/
+int32 
+VSsetname(int32 vkey,        /* IN: Vdata key */
+          const char *vsname /* IN: name to set for vdata*/)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32       curr_len;
+    int32       slen;
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "VSsetname");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check for null vdata name */
+    if (vsname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* get current length of vdata name */
+    if (vs->vsname != NULL)
+        curr_len = HDstrlen(vs->vsname);
+
+    /* check length of new name against MAX length */
+    if ((slen = HDstrlen(vsname)) > VSNAMELENMAX)
+      { /* truncate name */
+          HDstrncpy(vs->vsname, vsname, VSNAMELENMAX);
+          vs->vsname[VSNAMELENMAX] = '\0';
+      }
+    else /* copy whole name */
+        HDstrcpy(vs->vsname, vsname);
+
+    vs->marked = TRUE; /* mark vdata as being modified */
+
+    if (curr_len < slen) 
+        vs->new_h_sz = TRUE; /* mark vdata header size being changed */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSsetname */
+
+/* ------------------------------------------------------
+NAME
+   VSsetclass - give a class name to a vdata.
+
+DESCRIPTION
+   Truncates class name to max length of VSNAMELENMAX
+   If new class is longer than the current class set new_h_sz,
+   so that VSdetach will delete the original vdata header
+   and write a new header.
+
+RETURNS
+   SUCCEED/FAIL
+----------------------------------------------------------*/
+int32 
+VSsetclass(int32 vkey,         /* IN: vdata key */
+           const char *vsclass /* IN: class name to set for vdata */)
+{
+    vsinstance_t *w = NULL;
+    VDATA       *vs = NULL;
+    int32       curr_len;
+    int32       slen;
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "VSsetclass");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check for null vdata class */
+    if (vsclass == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* get current length of vdata class name */
+    curr_len = (intn)HDstrlen(vs->vsclass);
+
+    /* check length of new class name against MAX length */
+    if ((slen = (intn)HDstrlen(vsclass)) > VSNAMELENMAX)
+      {
+          HDstrncpy(vs->vsclass, vsclass, VSNAMELENMAX);
+          vs->vsclass[VSNAMELENMAX] = '\0';
+      }
+    else
+        HDstrcpy(vs->vsclass, vsclass);
+
+    vs->marked = TRUE; /* mark vdata as being modified */
+
+    if (curr_len < slen)
+        vs->new_h_sz = TRUE; /* mark vdata header size being changed */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSsetclass */
+
+/*------------------------------------------------------ 
+NAME
+   VSgetname - gets the vdata's name. 
+
+DESCRIPTION
+   Get vdata's name and comy it to 'vsname'. Space for
+   'vsname' must be allocated by user.
+
+RETURNS
+   SUCCEED/FAIL
+----------------------------------------------------------*/
+int32 
+VSgetname(int32 vkey,   /* IN: vdata key */
+          char *vsname  /* OUT: vdata name (allocated by user)*/)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSgetname");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check user allocated space */
+    if (vsname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* copy vdata name over */
+    HDstrcpy(vsname, vs->vsname);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetname */
+
+/*------------------------------------------------------ 
+NAME
+   VSgetclass - gets the vdata's class name.
+
+DESCRIPTION
+   Get vdata class name and copy over to 'vsclass'. Space
+   for 'vsclass' must be allocated by user.
+
+RETURNS
+   SUCCEED/FAIL
+---------------------------------------------------------- */
+int32 
+VSgetclass(int32 vkey,    /* IN: vdata key */
+           char *vsclass  /* OUT: class name for vdata (allocated by user) */ )
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32     ret_value = SUCCEED;
+    CONSTR(FUNC, "VSgetclass");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check user allocated space */
+    if (vsclass == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* copy class name over */
+    HDstrcpy(vsclass, vs->vsclass);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetclass */
+
+/* ------------------------------------------------------------------ 
+NAME
+   VSinquire - gets info about a vdata vkey:
+
+DESCRIPTION
+   Get information about Vdata. Space for 'fields' and 'vsname'
+   must be allocated by user.
+
+RETURNS
+   SUCCEED/FAIL
+
+------------------------------------------------------------------------*/
+intn 
+VSinquire(int32 vkey,       /* IN: vdata key */
+          int32 *nelt,      /* OUT: number of elements in vdata */
+          int32 *interlace, /* OUT: interlace scheme of vdata */
+          char *fields,     /* OUT: comma seperated string of field names */
+          int32 *eltsize,   /* OUT: total size of all fields in bytes */
+          char *vsname      /* OUT: name of vdata */)
+{
+  intn ret_value = SUCCEED;
+  intn status;
+  CONSTR(FUNC, "VSinquire");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* obtain the value for each parameter although the previous one
+       fails; ret_value should be FAIL if any of the parameters fails */
+    if (fields)
+      { /* we assume 'fields' space has been pre-allocated by user? */
+        status = VSgetfields(vkey, fields);
+        ret_value = (status == FAIL)? FAIL: ret_value;
+      }
+    if (nelt)
+      {
+        *nelt = VSelts(vkey);
+        ret_value = (*nelt == FAIL)? FAIL: ret_value;
+      }
+    if (interlace)
+      {
+        *interlace = VSgetinterlace(vkey);
+        ret_value = (*interlace == FAIL)? FAIL: ret_value;
+      }
+    if (eltsize)
+      {
+        *eltsize = VSsizeof(vkey, fields);
+        ret_value = (*eltsize == FAIL)? FAIL: ret_value;
+      }
+    if (vsname)
+      { /* we assume 'vsname' space as been pre-allocated by user? */
+        status = VSgetname(vkey, vsname);
+        ret_value = (status == FAIL)? FAIL: ret_value;
+      }
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return ret_value;   /* ok */
+
+}   /* VSinquire */
+
+/*-----------------------------------------------------------------
+NAME
+   VSlone - returns an array of refs of all lone vdatas in the file.
+
+DESCRIPTION
+   If 'idarray' is too small, routine will only fill 'idarray' with up
+   to 'asize' worth of refs.
+
+RETURNS
+   Returns FAIL if error else returns the total number of lone 
+   vdatas in the file.
+---------------------------------------------------------------------*/
+int32 
+VSlone(HFILEID f,     /* IN: file id */
+       int32 *idarray,/* OUT: array to return refs of lone vdatas? */
+       int32 asize    /* IN: size of 'idarray' */)
+{
+    int32   i;
+    int32   vgid;
+    int32   vsid;
+    int32   vstag;
+    int32   vkey;
+    uint8  *lonevdata = NULL;  /* lcl wrk area: stores flags of vdatas */
+    int32   nlone;             /* total number of lone vdatas */
+    int32   ret_value = SUCCEED;
+    CONSTR(FUNC, "VSlone");
+
+    /* -- allocate local space for vdata refs, init to zeros -- */
+    if (NULL == (lonevdata = (uint8 *) HDcalloc(MAX_REF , sizeof(uint8))))
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* -- look for all vdatas in the file, and flag (1) each -- */
+    vsid = -1;
+    while (FAIL != (vsid = VSgetid(f, vsid)))    /* until no more vdatas */
+        lonevdata[vsid] = 1;
+
+    /* -- Look through all vgroups, searching for vdatas -- */
+    /* -- increment its index in lonevdata if found -- */
+    vgid = -1;
+    while (FAIL != (vgid = Vgetid(f, vgid)))
+      {     /* until no more vgroups */
+        vkey = Vattach(f, vgid, "r"); /* attach to vgroup */
+        for (i = 0; i < Vntagrefs(vkey); i++)
+          {
+            Vgettagref(vkey, i, &vstag, &vsid); /* get tag/ref of element in vg */
+            if (vstag == (int32) DFTAG_VH)
+                lonevdata[vsid] = 0; /* set vdata as not lone vdata */
+          }
+        Vdetach(vkey); /* detach from vgroup */
+      }
+
+    /* -- check in lonevdata: it's a lone vdata if its flag is still 1 -- */
+    nlone = 0;
+    for (i = 0; i < (int32)MAX_REF; i++)
+      {
+        if (lonevdata[i])
+          { /* insert into idarray up till asize */
+            if (nlone < asize)  
+                idarray[nlone] = i; /* insert ref of vdata into idarray */
+            nlone++;
+          }
+      }
+
+    /* free up locally allocated space */
+    HDfree((VOIDP) lonevdata);
+
+    ret_value = nlone; /* return the TOTAL # of lone vdatas */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSlone */
+
+/*----------------------------------------------------------------- 
+NAME
+   Vlone  - returns an array of refs of all lone vgroups in the file.
+
+DESCRIPTION
+   If 'idarray' is too small, routine will only fill 'idarray' with up
+   to 'asize' worth of refs.
+
+RETURNS
+   Returns FAIL if error else returns the total number of lone
+   vgroups in the file
+---------------------------------------------------------------------*/
+int32 
+Vlone(HFILEID f,      /* IN: file id */
+      int32 *idarray, /* OUT: array to return refs of lone vgroups? */
+      int32 asize     /* IN: size of 'idarray' */)
+{
+    int32       i;
+    int32       vgid;
+    int32       vstag;
+    int32       id;
+    int32       vkey;
+    uint8      *lonevg = NULL;  /* local wrk area: stores flags of vgroups */
+    int32       nlone;          /* total number of lone vgroups */
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "Vlone");
+
+    /* -- allocate space for vgroup refs, init to zeroes -- */
+    if (NULL == (lonevg = (uint8 *) HDcalloc(MAX_REF , sizeof(uint8))))
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* -- look for all vgroups in the file, and flag (1) each -- */
+    id = -1;
+    while (FAIL != (id = Vgetid(f, id)))     /* until no more vgroups */
+        lonevg[id] = 1;
+
+    /* -- Look through all vgs, searching for vgroups -- */
+    /* -- increment its index in lonevg if found -- */
+    vgid = -1;
+    while (FAIL != (vgid = Vgetid(f, vgid)))
+      {     /* until no more vgroups */
+        vkey = Vattach(f, vgid, "r"); /* attach to vgroup */
+        id = -1;
+        for (i = 0; i < Vntagrefs(vkey); i++)
+          {
+            Vgettagref(vkey, i, &vstag, &id); /* get tag/ref of element in vg */
+            if (vstag == DFTAG_VG)
+                lonevg[id] = 0; /* set vgroup as not lone vgroup */
+          }
+        Vdetach(vkey); /* detach from vgroup */
+      }
+
+    /* -- check in lonevg: it's a lone vgroup if its flag is still 1 -- */
+    nlone = 0;
+    for (i = 0; i < (int32)MAX_REF; i++)
+      {
+        if (lonevg[i])
+          { /* insert into idarray up till asize */
+            if (nlone < asize)  
+                idarray[nlone] = i; /* insert ref of vgroup into idarray */
+            nlone++;
+          }
+      }
+
+    /* free up locally allocated space */
+    HDfree((VOIDP) lonevg);
+
+    ret_value = nlone; /* return the TOTAL # of lone vgroups */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vlone */
+
+/* ----------------------------------------------------------------- 
+NAME
+   Vfind -- looks in the file and returns the ref of 
+            the vgroup with name vgname 
+
+DESCRIPTION
+   Finds the vgroup with the specified name and returns the ref of
+   the vgroup if successful.
+
+RETURNS
+   Returns 0 if not found or on error. Otherwise, returns the 
+   vgroup's ref (a positive integer).
+-----------------------------------------------------------------------*/
+int32 
+Vfind(HFILEID f,          /* IN: file id */
+      const char *vgname  /* IN: name of vgroup to find */)
+{
+    int32        vgid = -1;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32       ret_value = 0;
+    CONSTR(FUNC, "Vfind");
+
+    /* check for null vgroup name */
+    if (vgname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* process through Vgroups in file */
+    while (FAIL != (vgid = Vgetid(f, vgid)))
+      { /* get instance of vgroup */
+        if((v = vginst(f,(uint16)vgid)) == NULL)
+            HGOTO_DONE(0);
+
+        /* get vgroup itself and check it */
+        vg = v->vg;
+        if (vg == NULL)
+            HGOTO_DONE(0);
+
+        /* compare vgroup name to 'vgname' if it had been set */
+	if (vg->vgname != NULL)
+            if (!HDstrcmp(vgname, vg->vgname)) 
+                HGOTO_DONE((int32)(vg->oref));  /* found the vgroup */
+      }
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* Vfind */
+
+/*------------------------------------------------------------------
+NAME
+   VSfind -- looks in the file and returns the ref of the vdata 
+             with name vsname 
+
+DESCRIPTION
+   Finds the vdata with the specified name and returns the ref of
+   the vdata if successfull.
+
+RETURNS
+   Returns 0 if not found, or on error. Otherwise, returns the vdata's 
+   ref (a positive integer).
+---------------------------------------------------------------------*/
+int32 
+VSfind(HFILEID f,          /* IN: file id */
+       const char *vsname  /* IN: name of vdata to find */)
+{
+    int32        vsid = -1;
+    vsinstance_t *v = NULL;
+    VDATA        *vs = NULL;
+    int32 ret_value = 0;
+    CONSTR(FUNC, "VSfind");
+
+    /* check for null vdata name */
+    if (vsname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* process through Vdatas in file */
+    while (FAIL != (vsid = VSgetid(f, vsid)))
+      { /* get instance of vdata */
+        if((v = vsinst(f,(uint16)vsid)) == NULL)
+            HGOTO_DONE(0);
+
+        /* get vdata itself and check it */
+        vs = v->vs;
+        if (vs == NULL)
+            HGOTO_DONE(0);
+
+        /* compare vdata name to 'vsname' if it had been set */
+        if (!HDstrcmp(vsname, vs->vsname)) 
+            HGOTO_DONE((int32)(vs->oref));  /* found the vdata */
+      }
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSfind */
+
+/* ----------------------------------------------------------------- 
+NAME
+   Vfindclass -- looks in the file and returns the ref of 
+                 the vgroup with class vgclass 
+
+DESCRIPTION
+   Finds the vgroup with the specified class and returns the ref
+   of the vgroup if successful.
+
+RETURNS
+   Returns 0 if not found, or error. Otherwise, returns the 
+   vgroup's ref (a positive integer).
+-----------------------------------------------------------------------*/
+int32 
+Vfindclass(HFILEID f,           /* IN: file id */
+           const char *vgclass  /* IN: class of vgroup to find */)
+{
+    int32        vgid = -1;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32       ret_value = 0;
+    CONSTR(FUNC, "Vfindclass");
+
+    /* check for null vgroup class */
+    if (vgclass == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* process through Vgroups in file */
+    while (FAIL != (vgid = Vgetid(f, vgid)))
+      { /* get instance of vgroup */
+        if((v = vginst(f,(uint16)vgid)) == NULL)
+            HGOTO_DONE(0);
+
+        /* get vgroup itself and check it */
+        vg = v->vg;
+        if (vg == NULL)
+            HGOTO_DONE(0);
+	/* Shouldn't we move on to the next vgroup instead of getting out?
+	   Same question for the above HGOTO_DONE. -BMR 9/12/2011 */
+
+        /* compare vgroup class to 'vgclass' if it had been set */
+	if (vg->vgclass != NULL)
+	    if (!HDstrcmp(vgclass, vg->vgclass)) 
+		HGOTO_DONE((int32)(vg->oref));  /* found the vgroup */
+      }
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;    
+}	/* Vfindclass */
+
+/*------------------------------------------------------------------
+NAME
+   VSfindclass -- looks in the file and returns the ref of the vdata 
+                  with class vsclass 
+
+DESCRIPTION
+   Finds the vdata with the specified class and returns the ref of 
+   the vdata if successful.
+
+RETURNS
+   Returns 0 if not found, or error. Otherwise, returns the vdata's 
+   ref (a positive integer).
+---------------------------------------------------------------------*/
+int32 
+VSfindclass(HFILEID f,           /* IN: file id */
+            const char *vsclass  /* IN: class of vdata to find */)
+{
+    int32        vsid = -1;
+    vsinstance_t *v = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = 0;
+    CONSTR(FUNC, "VSfindclass");
+
+    /* check for null vdata class */
+    if (vsclass == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* process through Vdatas in file */
+    while (FAIL != (vsid = VSgetid(f, vsid)))
+      { /* get instance of vdata */
+        if((v = vsinst(f,(uint16)vsid)) == NULL)
+            HGOTO_DONE(0);          /* error */
+
+        /* get vdata itself and check it */
+        vs = v->vs;
+        if (vs == NULL)
+            HGOTO_DONE(0);
+
+        /* compare vdata class to 'vsclass' if it had been set */
+        if (!HDstrcmp(vsclass, vs->vsclass)) 
+            HGOTO_DONE((int32)(vs->oref));  /* found the vdata */
+      }
+
+done:
+  if(ret_value == 0)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSfindclass */
+
+/* ----------------------------------------------------------------- 
+NAME
+   VSsetblocksize -- sets the block size of the linked-block element.
+
+DESCRIPTION
+   Sets the size of the blocks, that are after the first block, of a 
+   linked-block element used for storing a vdata.  This routine is 
+   to be called before the first write to the vdata to change the block 
+   size from the default value HDF_APPENDABLE_BLOCK_LEN (4096).  Once the
+   linked-block element is created, the block size cannot be changed.
+
+RETURNS
+   Returns SUCCEED/FAIL
+
+MODIFICATION
+   BMR - added in June 2001 to fix bug# 267
+
+---------------------------------------------------------------------*/
+intn
+VSsetblocksize(	int32 vkey, /* IN: vdata key */
+		int32 block_size) /* length to be used for each linked-block */
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    intn        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSsetblocksize");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if the given vdata id is part of vdata group */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* internal routine handles the actual setting */
+    if (HLsetblockinfo(vs->aid, block_size, -1) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}       /* VSsetblocksize */
+
+/* ----------------------------------------------------------------- 
+NAME
+   VSsetnumblocks -- sets the number of blocks for a linked-block element.
+
+DESCRIPTION
+   Sets the number of blocks of a linked-block element used for storing
+   a vdata.  This routine is to be called before the first write to the
+   vdata to change the number of blocks from the default value
+   HDF_APPENDABLE_BLOCK_NUM (16).  Once the linked-block element is
+   created, the number of blocks cannot be changed.
+
+RETURNS
+   Returns SUCCEED/FAIL
+
+MODIFICATION
+   BMR - added in June 2001 to fix bug# 267
+
+---------------------------------------------------------------------*/
+intn
+VSsetnumblocks( int32 vkey, /* IN: vdata key */
+		int32 num_blocks) /* number of blocks the element can have */
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    intn        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSsetnumblocks");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if the given vdata id is part of vdata group */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* internal routine handles the actual setting */
+    if (HLsetblockinfo(vs->aid, -1, num_blocks) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}       /* VSsetnumblocks */
+
+/* ----------------------------------------------------------------- 
+NAME
+   VSgetblockinfo -- retrieves the block size and the number of blocks 
+		     of a linked-block element.
+
+DESCRIPTION
+   Retrieves the block size and the number of blocks of a linked-block
+   element used for storing a vdata.  A NULL can be passed in for
+   unwanted value.
+
+RETURNS
+   Returns SUCCEED/FAIL
+
+MODIFICATION
+   BMR - added in June 2001 to fix bug# 267
+
+---------------------------------------------------------------------*/
+intn
+VSgetblockinfo(int32 vkey, /* IN: vdata id */
+               int32* block_size, /* OUT: length used for each linked-block */
+               int32* num_blocks) /* OUT: number of blocks the element has */
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    intn        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSgetblockinfo");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vdata is part of vdata group */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* internal routine handles the actual retrieval */
+    if (HLgetblockinfo(vs->aid, block_size, num_blocks) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}       /* VSgetblockinfo */
+
+/*******************************************************************************
+ NAME
+    VSisinternal  --  Determine if a vdata's class name is for internal only
+
+ RETURNS
+    Returns TRUE (1) if "classname" is one of the class names used for
+    vdata created by the the library and FALSE (0) otherwise.
+
+*******************************************************************************/
+intn
+VSisinternal(const char *classname)
+{
+    int  i;
+    intn ret_value = FALSE;
+
+    /* Check if this class name is one of the internal class name and return
+        TRUE, otherwise, return FALSE */
+    for (i=0; i < HDF_NUM_INTERNAL_VDS; i++) {
+        if (HDstrncmp(HDF_INTERNAL_VDS[i], classname, HDstrlen(HDF_INTERNAL_VDS[i])) == 0 ) {
+            ret_value = TRUE;
+            break;
+        }
+    }
+    return ret_value;
+}
+
+/*------------------------------------------------------------------
+NAME
+    VSofclass -- Get vdatas of a given class in a file or in a vgroup.
+
+DESCRIPTION
+    VSofclass retrieves n_vds vdatas by their reference numbers via the
+    caller-supplied array refarray.  It simply calls VSIgetvdatas to perform
+    the task.
+
+    The parameter n_vds provides the number of values that the refarray list
+    can hold and can be any positive number smaller than MAX_REF (65535).  If
+    n_vds is larger than the actual number of user-created vdatas, then only
+    the actual number of reference numbers will be retrieved.
+
+    The parameter start_vd indicates the vdata number to start at.
+    - When start_vd is 0, the retrieval starts at the beginning.
+    - When start_vd is between 0 and the number of vdatas that meet the
+      search criteria, VSofclass will start retrieving vdatas from
+      the vdata number start_vd.
+    - When start_vd is greater than the number of vdatas that meet the
+      search criteria, VSofclass will return FAIL.
+
+    When refarray argument is NULL, VSofclass will return the actual number
+    of vdatas that meet the search criteria without further processing.  This
+    allows application to find out the size of the array for proper allocation.
+   
+RETURNS
+    Returns
+	- 0 if none is found, or
+	- FAIL(-1) if error occurs, or
+	- the number of refs returned in refarray
+
+NOTE
+    This function was added originally to assist the hdf4 map writer because
+    Vnattrs does not handle attributes created via VHstoredatam and Vaddtagref.
+    -BMR - 2010/11/21
+---------------------------------------------------------------------*/
+intn
+VSofclass(int32 id,              /* IN: file id or vgroup id */
+	    const char *vsclass, /* IN: class to be queried */
+	    uintn start_vd,/* IN: vdata number to start retrieving */
+            uintn n_vds,	 /* IN: number of user-created vds to return */
+            uint16 *refarray	 /* IN/OUT: ref array to fill */)
+{
+    CONSTR(FUNC, "VSofclass");
+    intn      ret_value = 0;
+
+    /* clear error stack */
+    HEclear();
+
+    /* Make sure that proper size is passed in for the non-null array */
+    if (refarray != NULL && n_vds == 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    ret_value = VSIgetvdatas(id, vsclass, start_vd, n_vds, refarray);
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSofclass */
+
+/*******************************************************************************
+NAME
+   vscheckclass - (PRIVATE) checks if the given vdata has the specified class
+		 or if it is a user-created vdata.
+
+DESCRIPTION
+   This is common code to be used in VSIgetvdatas.
+
+RETURNS
+   if the vdata has the same class as 'vsclass' or is a user-created vdata,
+   return TRUE, else FALSE.
+   BMR - 2010/11/30
+*******************************************************************************/
+PRIVATE intn
+vscheckclass(int32 id, /* IN: vgroup id or file id */
+	    uint16 vs_ref, /* IN: reference number of vdata being checked */
+	    const char *vsclass  /* IN: class name to be queried or NULL for
+					 non-internal vdata */)
+{
+    CONSTR(FUNC, "vscheckclass");
+    vsinstance_t *vs_inst = NULL;
+    VDATA        *vs = NULL;
+    intn ret_value = FALSE;
+
+    /* get instance of vdata; if it's not found, continue to look for
+       other vdatas */
+    if((vs_inst = vsinst(id, (uint16)vs_ref)) == NULL)
+        HGOTO_DONE(FALSE);
+
+    /* get vdata itself and check */
+    vs = vs_inst->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* Make sure this vdata has a class name before checking */
+    if (vs->vsclass != NULL && HDstrlen(vs->vsclass) != 0)
+    {
+        /* If user-created vdatas are being checked for, then set flag
+           if this vdata is not internally created by the library */
+        if (vsclass == NULL)
+        {
+            if (VSisinternal(vs->vsclass) == FALSE)
+                ret_value = TRUE;
+        }
+        /* If a specific class is searched, set flag if this
+           vdata has that same class */
+        else
+        {
+            size_t len = HDstrlen(_HDF_CHK_TBL_CLASS);
+
+            /* Explanation of the comparison below:
+               Because a class name that starts with _HDF_CHK_TBL_CLASS
+               may have variable information appended to the end after
+               _HDF_CHK_TBL_CLASS, we need to compare up to the length
+               of _HDF_CHK_TBL_CLASS so that we can get all occurences
+               of the classes starting with _HDF_CHK_TBL_CLASS.  For
+               the non-_HDF_CHK_TBL_CLASS classes, we want to compare
+               the entire array of characters.  However, if specific
+               version of _HDF_CHK_TBL_CLASS is requested, this code
+               will need to be modified properly */
+
+            /* vsclass != _HDF_CHK_TBL_CLASS..., compare entire string*/
+            if (HDstrncmp(vsclass, _HDF_CHK_TBL_CLASS, len))
+                ret_value = HDstrcmp(vsclass, vs->vsclass) ? FALSE : TRUE;
+            else
+                ret_value = HDstrncmp(vsclass, vs->vsclass, len) ? FALSE : TRUE;
+        }
+    }
+    /* This vd doesn't have a class name, so it must be a user-created vd */
+    else
+    {
+        /* If user-created vdatas are being checked for, then set flag to
+           indicate that this vdata is user-created */
+        if (vsclass == NULL)
+            ret_value = TRUE;
+	/* If a specific class name is requested, then set flag to indicate
+	   that this vd is not what is being searched for */
+	else
+	    ret_value = FALSE;
+    }
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* vscheckclass */
+
+/*******************************************************************************
+NAME
+   VSIgetvdatas -- (PRIVATE) Get user-created vdata in a file or in a vgroup.
+
+DESCRIPTION
+    VSIgetvdatas retrieves n_vds vdatas by their reference numbers via the
+    caller-supplied array refarray.  When a vgroup id is specified, VSIgetvdatas
+    will only retrieve the vdatas immediately belong to the specified vgroup,
+    and not any sub-vgroups.
+
+    The parameter n_vds provides the number of values that the refarray list
+    can hold and can be any positive number smaller than MAX_REF (65535).  If
+    n_vds is larger than the actual number of user-created vdatas, then only
+    the actual number of reference numbers will be retrieved.
+
+    The parameter start_vd indicates the vdata number to start at.
+    - When start_vd is 0, the retrieval starts at the beginning.
+    - When start_vd is between 0 and the number of user-created vdatas in
+      the file or the vgroup, VSIgetvdatas will start retrieving vdatas from
+      the vdata number start_vd.
+    - When start_vd is greater than the number of user-created vdatas in the
+      file or the vgroup, VSIgetvdatas will return FAIL.
+
+    When refarray argument is NULL, VSIgetvdatas will return the actual number
+    of user-created vdatas without further processing.  This allows application
+    to find out the size of the array for proper allocation.
+   
+RETURNS
+    The number of user-created vdatas if successful and FAIL, otherwise.
+    BMR - 2010/07/10
+*******************************************************************************/
+intn
+VSIgetvdatas(int32 id,		 /* IN: file id or vgroup id */
+	    const char *vsclass, /* IN: a specific class or NULL for user-created vdatas */
+	    const uintn start_vd,/* IN: vdata number to start retrieving */
+            const uintn n_vds,	 /* IN: number of user-created vds to return */
+            uint16 *refarray	 /* IN/OUT: ref array to fill */)
+{
+    CONSTR(FUNC, "VSIgetvdatas");
+    vginstance_t *vg_inst = NULL;
+    group_t id_type = HAatom_group(id);    /* id is FIDGROUP or VGIDGROUP */
+    intn        nactual_vds=0, nfound_vds=0, ii;
+    VGROUP     *vg = NULL;
+    vfile_t    *vf = NULL;
+    int32	vs_ref;
+    int32       ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* Make sure that proper size is passed in for the non-null array */
+    if (refarray != NULL && n_vds == 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* The given id must be a file ID or a vgroup ID */
+    if (id_type != FIDGROUP && id_type != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If given id is a file id */
+    if (id_type == FIDGROUP)
+    {
+        /* get vdata file record */
+        if (NULL == (vf = Get_vfile(id)))
+            HGOTO_ERROR(DFE_FNF, FAIL);
+
+	/* Look through all vdatas, searching for user-created vdatas until
+	   no more vdatas in the file or the number of vdatas to be
+	   retrieved is reached */
+	nactual_vds = 0;/* number of user-created vdatas to be retrieved */
+	nfound_vds = 0;	/* number of user-created vdatas */
+	vs_ref = VSgetid(id, -1);  /* get ref number of first vd in the file */
+	while ((vs_ref != FAIL)	   /* there are more vdatas */
+		&& ((nactual_vds < n_vds) || (n_vds == 0))
+		&& (nactual_vds <= nfound_vds))
+	{
+	    intn found = FALSE;
+
+	    /* Check if the vdata either has the specified class (when vsclass
+	       is !NULL) or is a user-created vdata (when vsclass is NULL) */
+	    found = vscheckclass(id, (uint16)vs_ref, vsclass);
+
+            /* If this vs met the search criteria, record its ref# according to
+               caller's specifying of where to start and how many to retrieve */
+            if (found)
+            {
+                /* make sure to count only from vdata number start_vd */
+                if (nfound_vds >= start_vd)
+                    /* if caller requests for reference numbers */
+                    if (refarray != NULL)
+                    {
+                        refarray[nactual_vds] = (uint16)vs_ref;
+
+                        /* increment the actual number of user-created vds
+                           to be retrieved */
+                        nactual_vds++;
+                    }
+                    /* increment the number of user-created vds */
+                    nfound_vds++;
+                }
+	    /* Move forward to the next vdata in the file */
+	    vs_ref = VSgetid(id, vs_ref);
+	} /* while more vdatas in file */
+    } /* file id is given */
+
+    /* check if given id is a vgroup id */
+    else if (id_type == VGIDGROUP)
+    { /* vgroup id is given */
+
+	/* get the number of sub-vdatas belong to this vgroup */
+	int32 n_elements = Vntagrefs(id);
+	if (n_elements == FAIL)
+	    HGOTO_ERROR(DFE_GENAPP, FAIL);
+
+	/* get instance of vgroup */
+	if (NULL == (vg_inst = (vginstance_t *) HAatom_object(id)))
+	    HGOTO_ERROR(DFE_NOVS, FAIL);
+
+	/* get vgroup itself and check */
+	vg = vg_inst->vg;
+	if (vg == NULL)
+	    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+        /* get vdata file record */
+        if (NULL == (vf = Get_vfile(vg->f)))
+            HGOTO_ERROR(DFE_FNF, FAIL);
+
+	/* Go through the tag list vg->tag and find user-created vdatas, until
+	   no more sub-vdatas or the number of vdatas to be retrieved is
+	   reached */
+	nactual_vds = 0;/* number of user-created vdatas to be retrieved */
+	nfound_vds = 0;	/* number of user-created vdatas */
+        for (ii = 0; ii < n_elements && ((nactual_vds < n_vds) || (n_vds == 0))
+			&& nactual_vds <= nfound_vds; ii++)
+        {
+	    /* If an element is a vdata, then get access to it */
+            if (vg->tag[ii] == DFTAG_VH)
+	    {
+	        intn found = FALSE;
+
+	        found = vscheckclass((int32)vg->f, vg->ref[ii], vsclass);
+
+                /* If this vdata met the search criteria, record its ref#
+                   according to caller's specification of where to start and
+                   how many to retrieve */
+                if (found)
+		{
+		    /* Make sure to count only from vdata number start_vd */
+		    if (nfound_vds >= start_vd)
+			/* If caller requests for reference numbers */
+			if (refarray != NULL)
+			{
+			    refarray[nactual_vds] = (uint16)vg->ref[ii];
+
+			    /* Increment the actual number of vdatas to be
+			       retrieved */
+			    nactual_vds++;
+			}
+
+		    /* Increment number of vds that meet the search criteria */
+		    nfound_vds++;
+		}
+	    } /* this sub element is a vdata */
+        } /* for */
+    } /* vgroup id is given */
+
+    /* Flag if start_vd is beyond the number of user-created vdatas */
+    if (nfound_vds < start_vd)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If caller is asking for the number of vdatas only, return the
+	number of user-created vdatas, otherwise, return the number of
+	vdatas that are actually stored in refarray */
+    if (refarray == NULL)
+	ret_value = nfound_vds - start_vd;
+    else
+	ret_value = nactual_vds;
+
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSIgetvdatas */
+
+/*******************************************************************************
+NAME
+   VSgetvdatas -- Get user-created vdata in a file or in a vgroup.
+
+DESCRIPTION
+    VSgetvdatas retrieves n_vds vdatas by their reference numbers via the
+    caller-supplied array refarray.  When a vgroup id is specified, VSgetvdatas
+    will only retrieve the vdatas immediately belong to the specified vgroup,
+    and not any sub-vgroups.
+
+    The parameter n_vds provides the number of values that the refarray list
+    can hold and can be any positive number smaller than MAX_REF (65535).  If
+    n_vds is larger than the actual number of user-created vdatas, then only
+    the actual number of reference numbers will be retrieved.
+
+    The parameter start_vd indicates the vdata number to start at.
+    - When start_vd is 0, the retrieval starts at the beginning.
+    - When start_vd is between 0 and the number of user-created vdatas in
+      the file or the vgroup, VSgetvdatas will start retrieving vdatas from
+      the vdata number start_vd.
+    - When start_vd is greater than the number of user-created vdatas in the
+      file or the vgroup, VSgetvdatas will return FAIL.
+
+    When refarray argument is NULL, VSgetvdatas will return the actual number
+    of user-created vdatas without further processing.  This allows application
+    to find out the size of the array for proper allocation.
+   
+RETURNS
+    The number of user-created vdatas if successful and FAIL, otherwise.
+    -BMR - 2010/07/10
+
+MODIFICATION
+    - Made the original VSgetvdatas into a private function VSIgetvdatas so
+      that the code can be reused by VSofclass.  VSgetvdatas now simply calls
+      VSIgetvdatas. -BMR - 2010/11/17
+*******************************************************************************/
+intn
+VSgetvdatas(int32 id,		/* IN: file id or vgroup id */
+	    const uintn start_vd,/* IN: vdata number to start retrieving */
+            const uintn n_vds,	/* IN: number of user-created vds to return */
+            uint16 *refarray	/* IN/OUT: ref array to fill */)
+{
+    CONSTR(FUNC, "VSgetvdatas");
+    int32       ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* Make sure that proper size is passed in for the non-null array */
+    if (refarray != NULL && n_vds == 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Passing NULL in to VSIgetvdatas to get user-created vdatas */
+    ret_value = VSIgetvdatas(id, NULL, start_vd, n_vds, refarray);
+done:
+  if(ret_value == FAIL)
+    { /* Error condition cleanup */
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetvdatas */
+
+
+/* ------------------------------- Vsetzap -------------------------------- */
+/*
+ * Vsetzap: Useless now. Maintained for back compatibility.
+ */
+VOID 
+Vsetzap(void)
+{
+}
diff --git a/hdf/src/vg.h b/hdf/src/vg.h
new file mode 100644
index 0000000..f59d795
--- /dev/null
+++ b/hdf/src/vg.h
@@ -0,0 +1,73 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: vg.h 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*****************************************************************************
+*
+* vg.h
+*
+* Part of HDF VSet interface
+*
+* defines symbols and structures used in all v*.c files
+*
+* NOTES:
+* This include file depends on the basic HDF *.h files hdfi.h and hdf.h.
+* An 'S' in the comment means that that data field is saved in the HDF file.
+*
+******************************************************************************/
+
+#ifndef _VG_H
+#define _VG_H
+
+/* --------------  H D F    V S E T   tags  ---------------------------- */
+
+/* In what versions were these valid? */
+#define OLD_VGDESCTAG   61820   /* tag for a vgroup d */
+#define OLD_VSDESCTAG   61821   /* tag for a vdata descriptor */
+#define OLD_VSDATATAG   61822   /* tag for actual raw data of a vdata */
+
+/* re-define what new ones are. Don't know why there are two sets but
+   made them conform to what was in 'htags.h' */
+#define NEW_VGDESCTAG    DFTAG_VG
+#define NEW_VSDESCTAG    DFTAG_VH
+#define NEW_VSDATATAG    DFTAG_VS
+
+#define VGDESCTAG       NEW_VGDESCTAG
+#define VSDESCTAG       NEW_VSDESCTAG
+#define VSDATATAG       NEW_VSDATATAG
+
+#define _HDF_VSPACK 0
+#define _HDF_VSUNPACK 1
+#define VG_ATTR_SET 0x00000001  /* this vgroup has attribute(s) */
+#define VS_ATTR_SET 0x00000001  /* this vdata has attribute(s) */
+#define _HDF_VDATA -1		/* used in vdata attr interface
+                           findex to represent the entire vdata  */
+#define _HDF_ENTIRE_VDATA _HDF_VDATA /* if users have already  used
+                            _HDF_ENTIRE_VDATA since 4.1b1 was out */
+
+/* Size of the atom hash table */
+#define VATOM_HASH_SIZE 256
+
+/* .................................................................. */
+#define VSET_NEW_VERSION	4  /* if attr or other new features are set */
+#define VSET_VERSION		3  /* DO NOT CHANGE!! */
+#define VSET_OLD_VERSION	2  /* All version <= 2 use old type mappings */
+#define VSET_OLD_TYPES		VSET_OLD_VERSION  /* For backward compatibility */
+
+/* Only include the library header if the VSET_INTERFACE macro is defined */
+#ifdef VSET_INTERFACE
+#include "vgint.h"          /* Library VSet information header */
+#endif /* VSET_INTERFACE */
+
+#endif                          /* _VG_H */
diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c
new file mode 100644
index 0000000..c193781
--- /dev/null
+++ b/hdf/src/vgf.c
@@ -0,0 +1,1627 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5737 $";
+#endif
+
+/* $Id: vgf.c 5737 2012-01-06 04:52:28Z brtnfld $ */
+
+/*-----------------------------------------------------------------------------
+  FUNCTION NAMEING CONVENTION:(For the most part true)
+  ---------------------------------------------------
+  This file contains the HDF-style C stubs for the Vxxx interfaces i.e.
+  both Vgroups and Vdatas. They call the corresponding C-functions for 
+  the Vxxx interfaces.
+
+  The basic routines called by fortran will be of the form vfxxx.
+
+  If only a C stub is needed it will be named nvfxxx and have the FNAME()
+  function applied to it. There are a few exceptions where C stub is 
+  named for example ndfixxx or ndfxxx, oh well.
+
+  If a Fortran stub is also required the fortran stub will be called
+  vfxxx(vgff.f) and the one in here will be nvfxxxc and again be FNAME()ed
+
+-----------------------------------------------------------------------------*/
+
+/*
+   *
+   * vgf.c
+   * Part of the HDF VSet interface.
+   *
+   * C routines (short names) to be called from fortran
+   *
+   *
+   *********************************************************************** */
+
+#define VSET_INTERFACE
+#include "hdf.h"
+#include "hproto_fortran.h"
+
+/*
+   **  remove trailing blanks from a string. input argument is a  string
+   **  and *MUST* be a variable and not a constant!! For internal use only!!
+   **  Used only on Crays where the Fortran compiler will pad strings to the
+   **  nearest 8-byte boundary.
+ */
+
+void
+trimendblanks(char *ss)
+{
+    int32       i, n;
+
+    n = (int32)HDstrlen(ss);
+    for (i = n - 1; i >= 0; i--)
+      {
+          if (ss[i] != ' ')
+            {
+                ss[i + 1] = '\0';
+                break;
+            }
+      }
+}
+
+/* ================================================== */
+/*  VGROUP routines                                   */
+/* ================================================== */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfivopn
+ * Purpose: Fortran stub for dfvopen to call DFvsetopen to open HDF file
+ * Inputs:  name: name of file to open
+ *          access: access mode - integer with value DFACC_READ etc.
+ *          defdds: default number of DDs per header block
+ *          namelen: length of name
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers
+ * Invokes: Hopen
+ * Method:  Convert filename to C string, call Hopen
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfivopn(_fcd name, intf * acc_mode, intf * defdds, intf * namelen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(name, (intn) *namelen);
+    if (!fn) return(FAIL);
+    ret = (intf) Vopen(fn, (intn) *acc_mode, (int16) *defdds);
+    HDfree(fn);
+    return (ret);
+}   /* end ndfivopn() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    dfvclos
+ * Purpose: Call DFvsetclose to close HDF file
+ * Inputs:  file_id: handle to HDF file to close
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ * Invokes: Hclose
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ndfvclos(intf * file_id)
+{
+    return (Vclose((int32)*file_id));
+}   /* ndfvclos() */
+
+/*
+   **  attach to a vgroup and returns its ptr
+   **  related: Vattach--vatchc--VFATCH
+ */
+
+FRETVAL(intf)
+nvatchc(intf * f, intf * vgid, _fcd accesstype)
+{
+    int32       vkey;
+    char       *acc;
+
+    acc = HDf2cstring(accesstype, 1);
+    if (!acc) return(FAIL);
+
+    vkey = Vattach((int32)*f, *vgid, acc);
+    HDfree(acc);
+
+    return ((intf)vkey);
+}
+
+/* ------------------------------------------------------------------ */
+
+/*
+   **  detach from a vgroup
+   **  related: Vdetach--vdtchc--VFDTCH
+ */
+
+FRETVAL(intf)
+nvdtchc(intf * vkey)
+{
+    return (Vdetach(*vkey));
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  get the name of a vgroup
+   **  related: Vgetname--vgnamc--VFGNAM
+ */
+
+FRETVAL(intf)
+nvgnamc(intf * vkey, _fcd vgname)
+{
+    return (Vgetname(*vkey, _fcdtocp(vgname)));
+}   /* VGNAMC */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the class name of a vgroup
+   **  related: Vgetclass--vgclsc--VFGCLS
+ */
+
+FRETVAL(intf)
+nvgclsc(intf * vkey, _fcd vgclass)
+{
+    return (Vgetclass(*vkey, _fcdtocp(vgclass)));
+}   /* VGCLSC */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  general inquiry on a vgroup
+   **  related: Vinquire--vinqc--VFINQ
+ */
+
+FRETVAL(intf)
+nvinqc(intf * vkey, intf * nentries, _fcd vgname)
+{
+    return ((intf) Vinquire(*vkey, (int32 *) nentries, _fcdtocp(vgname)));
+}   /* VINQC */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  delete a vgroup from a file
+   **  related: Vdelete--vdelete--
+ */
+
+FRETVAL(intf)
+nvdelete(intf * f, intf * vkey)
+{
+    return ((intf) Vdelete((int32)*f, (int32)*vkey));
+}   /* nvdelete */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the id of the next vgroup in the file
+   **  related: Vgetid--vgidc--VFGID
+ */
+
+FRETVAL(intf)
+nvgidc(intf * f, intf * vgid)
+{
+    return ((intf) Vgetid((int32)*f, *vgid));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the id of the next entry in the vgroup
+   **  related: Vgetnext--vgnxtc--VFGNXT
+ */
+
+FRETVAL(intf)
+nvgnxtc(intf * vkey, intf * id)
+{
+    return (Vgetnext(*vkey, *id));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  sets the name of the vgroup
+   **  related: Vsetname--vsnamc--VFSNAM
+ */
+
+FRETVAL(intf)
+nvsnamc(intf * vkey, _fcd vgname, intf * vgnamelen)
+{
+    char       *name;
+    intf        ret;
+
+    name = HDf2cstring(vgname, (intn) *vgnamelen);
+    if (!name) return(FAIL);
+    /* trimendblanks(name); */
+    ret = (intf) Vsetname(*vkey, name);
+    HDfree(name);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  sets the class name of the vgroup
+   **  related: Vsetclass--vsclsc--VFSCLS
+ */
+
+FRETVAL(intf)
+nvsclsc(intf * vkey, _fcd vgclass, intf * vgclasslen)
+{
+    char       *tclass;
+    intf        ret;
+
+    tclass = HDf2cstring(vgclass, (intn) *vgclasslen);
+    if (!tclass) return(FAIL);
+    /* trimendblanks(tclass); */
+    ret = (intf) Vsetclass(*vkey, tclass);
+    HDfree(tclass);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  inserts a vset object (ie a vgroup or vdata ptr) into the given vgroup
+   **  related: Vinsert--vinsrtc--VFINSRT
+ */
+
+FRETVAL(intf)
+nvinsrtc(intf * vkey, intf * vobjptr)
+{
+    return ((intf) Vinsert(*vkey, *vobjptr));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  tests if a vset object (having id id) in a vgroup refers to a vgroup
+   **  related: Visvg--visvgc--VFISVG
+ */
+
+FRETVAL(intf)
+nvisvgc(intf * vkey, intf * id)
+{
+    return ((intf) Visvg(*vkey, *id));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  wrapper for Vstart
+ */
+
+FRETVAL(intf)
+nvfstart(intf * f)
+{
+    return (Vstart((int32) *f));
+}   /* nvfstart */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  wrapper for Vend
+ */
+
+FRETVAL(intf)
+nvfend(intf * f)
+{
+    return ((intf) Vend((int32) *f));
+}   /* nvfend */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  tests if an id in a vgroup refers to a vdata
+   **  related: Visvs--visvsc--VFISVS
+ */
+
+FRETVAL(intf)
+nvisvsc(intf * vkey, intf * id)
+{
+    return ((intf) Visvs(*vkey, *id));
+}
+
+/* ================================================== */
+/*  VDATA routines                                    */
+/* ================================================== */
+
+/*
+   **  attach to a vdata and returns its ptr
+   **  related: VSattach--vsatchc--VFATCH
+ */
+
+FRETVAL(intf)
+nvsatchc(intf * f, intf * vsid, _fcd accesstype)
+{
+    /* need not HDf2cstring since only first char is accessed. */
+    return(VSattach((int32) *f, *vsid, _fcdtocp(accesstype)));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  detach from a vdata
+   **  related: VSdetach--vsdtchc--VFDTCH
+ */
+
+FRETVAL(intf)
+nvsdtchc(intf * vkey)
+{
+    return (VSdetach(*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the ref # of a vdata
+   **  related: VSQueryref--vsqref--
+ */
+
+FRETVAL(intf)
+nvsqref(intf * vkey)
+{
+    return ((intf)VSQueryref((int32)*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the tag # of a vdata
+   **  related: VSQuerytag--vsqtag--
+ */
+
+FRETVAL(intf)
+nvsqtag(intf * vkey)
+{
+    return ((intf)VSQuerytag((int32)*vkey));
+}
+
+/* ----------------------------------------------------------------- */
+/*
+   **  get the version # of a vdata
+   **  related: VSgetversion--vsgver--
+ */
+
+FRETVAL(intf)
+nvsgver(intf * vkey)
+{
+    return ((intf)VSgetversion((int32)*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  seeks to a given element position in a vadata
+   **  related: VSseek--vsseekc--VSFSEEK
+ */
+
+FRETVAL(intf)
+nvsseekc(intf * vkey, intf * eltpos)
+{
+    return ((intf) VSseek(*vkey, *eltpos));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the name of a vdata
+   **  related: VSgetname--vsgnamc--VSFGNAM
+ */
+
+FRETVAL(intf)
+nvsgnamc(intf * vkey, _fcd vsname, intf *vsnamelen)
+{
+    CONSTR(FUNC, "vsgnamc");
+    char	*tvsname = NULL;
+    intn	status;
+
+    /* Allocate space for fortran strings */
+    tvsname = (char *) HDmalloc(*vsnamelen + 1);
+    if (!tvsname)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    status = VSgetname(*vkey, tvsname);
+
+    /* convert C-string results back to Fortran strings */
+    HDpackFstring(tvsname, _fcdtocp(vsname), (intn) *vsnamelen);
+    HDfree(tvsname);
+
+    return(status);
+}   /* VSGNAMC */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the class name of a vdata
+   **  related: VSgetclass--vsgclsc--VSFGCLS
+ */
+
+FRETVAL(intf)
+nvsgclsc(intf * vkey, _fcd vsclass, intf *vsclasslen)
+{
+    CONSTR(FUNC, "vsgclsc");
+    char	*tvsclass = NULL;
+    intn	status;
+
+    /* Allocate space for fortran strings */
+    tvsclass = (char *) HDmalloc(*vsclasslen + 1);
+    if (!tvsclass)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+
+    status = VSgetclass(*vkey, tvsclass);
+
+    /* convert C-string results back to Fortran strings */
+    HDpackFstring(tvsclass, _fcdtocp(vsclass), (intn) *vsclasslen);
+    HDfree(tvsclass);
+
+    return(status);
+}   /* VSGCLSC */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  general inquiry on a vdata
+   **  related: VSinquire--vsinqc--VSFINQ
+ */
+
+FRETVAL(intf)
+nvsinqc(intf * vkey, intf * nelt, intf * interlace, _fcd fields, intf * eltsize,
+        _fcd vsname, intf *fieldslen, intf *vsnamelen)
+{
+    CONSTR(FUNC, "vsinqc");
+    char	*tfields = NULL;
+    char	*tvsname = NULL;
+    intn	status;
+    int32	tnelt, til, teltsz;
+
+    /* Allocate space for fortran strings */
+    tfields = (char *) HDmalloc(*fieldslen + 1);
+    if (!tfields)
+        HRETURN_ERROR(DFE_NOSPACE, FAIL);
+    tvsname = (char *) HDmalloc(*vsnamelen + 1);
+    if (!tvsname){
+        HDfree(tfields);
+        HRETURN_ERROR(DFE_NOSPACE, FAIL)
+    }
+    
+    /* the following contains error for nelt, interlace and eltsize */
+    /* if int32 and intf are different in size. */
+    status = VSinquire(*vkey, &tnelt, &til, tfields, &teltsz, tvsname);
+    if (status != FAIL){
+	*nelt = tnelt;
+	*interlace = til;
+	*eltsize = teltsz;
+	/* convert C-string results back to Fortran strings */
+	HDpackFstring(tfields, _fcdtocp(fields), (intn) *fieldslen);
+	HDpackFstring(tvsname, _fcdtocp(vsname), (intn) *vsnamelen);
+    }
+    HDfree(tfields);
+    HDfree(tvsname);
+
+    return status;
+}   /* VSINQC */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  tests if given fields exist in the vdata
+   **  related: VSfexist--vsfexc--VSFEX
+ */
+
+FRETVAL(intf)
+nvsfexc(intf * vkey, _fcd fields, intf * fieldslen)
+{
+    intf        ret;
+    char       *flds;
+
+    flds = HDf2cstring(fields, (intn) *fieldslen);
+    if (!flds) return(FAIL);
+    /* trimendblanks(flds); */
+    ret = (int32) VSfexist(*vkey, flds);
+    HDfree(flds);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  looks for a named Vdata in a file
+   **  related: VSfind--vsfndc--VSFFND
+ */
+
+FRETVAL(intf)
+nvsfndc(intf * f, _fcd name, intf * namelen)
+{
+    intf        ret;
+    char       *cname;
+
+    cname = HDf2cstring(name, (intn) *namelen);
+    if (!cname) return(FAIL);
+    /* trimendblanks(flds); */
+    ret = (intf) VSfind(*f, cname);
+    HDfree(cname);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the id of the next vdata from the file
+   **  related: VSgetid--vsgidc--VSFGID
+ */
+
+FRETVAL(intf)
+nvsgidc(intf * f, intf * vsid)
+{
+    return ((intf) VSgetid(*f, *vsid));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  removes the vdata with id from the file
+   **  related: VSdelete--vsdltc--VSFDLTE
+ */
+
+FRETVAL(intf)
+nvsdltc(intf * f, intf * vsid)
+{
+    return ((intf) VSdelete(*f, *vsid));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  make it possible to append unlimitedly to an existing vdata
+   **  related: VSappendable--vsapp--
+ */
+
+FRETVAL(intf)
+nvsapp(intf * vkey, intf *blk)
+{
+    return ((intf) VSappendable((int32)*vkey,(int32)*blk));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  sets the name of a vdata
+   **  related: VSsetname--vssnamc--VSFSNAM
+ */
+
+FRETVAL(intf)
+nvssnamc(intf * vkey, _fcd vsname, intf * vsnamelen)
+{
+    char       *name;
+    intf        ret;
+
+    name = HDf2cstring(vsname, (intn) *vsnamelen);
+    if (!name) return(FAIL);
+    /* trimendblanks (name); */
+    ret = (intf) VSsetname(*vkey, name);
+    HDfree(name);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  sets the class name of the vdata
+   **  related: VSsetclass--vssclsc--VSFSCLS
+ */
+
+FRETVAL(intf)
+nvssclsc(intf * vkey, _fcd vsclass, intf * vsclasslen)
+{
+    char       *tclass;
+    intf        ret;
+
+    tclass = HDf2cstring(vsclass, (intn) *vsclasslen);
+    if (!tclass) return(FAIL);
+    /* trimendblanks(tclass); */
+    ret = (intf) VSsetclass(*vkey, tclass);
+    HDfree(tclass);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  sets the fields in a vdata for reading or writing
+   **  related: VSsetfields--vssfldc--VSFSFLD
+ */
+
+FRETVAL(intf)
+nvssfldc(intf * vkey, _fcd fields, intf * fieldslen)
+{
+    char       *flds;
+    intf        ret;
+
+    flds = HDf2cstring(fields, (intn) *fieldslen);
+    if (!flds) return(FAIL);
+    /* trimendblanks(flds); */
+    ret = (int32) VSsetfields(*vkey, flds);
+    HDfree(flds);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  sets the file interlace of a vdata
+   **  related: VSsetinterlace--vssintc--VSFSINT
+ */
+
+FRETVAL(intf)
+nvssintc(intf * vkey, intf * interlace)
+{
+    return ((intf) VSsetinterlace(*vkey, *interlace));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  defines a new field to be used in the vdata
+   **  related: VSfdefine--vsfdefc--VSFFDEF
+ */
+
+FRETVAL(intf)
+nvsfdefc(intf * vkey, _fcd field, intf * localtype, intf * order, intf * fieldlen)
+{
+    intf        ret;
+    char       *fld;
+
+    fld = HDf2cstring(field, (intn) *fieldlen);
+    if (!fld) return(FAIL);
+    /* trimendblanks(fld); */
+    ret = (int32) VSfdefine(*vkey, fld, *localtype, *order);
+    HDfree(fld);
+    return (ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    vssextfc
+ * Purpose: store data of a Vdata in an external file
+ * Inputs:  id: vdata id
+ *          name: name of external file
+ *          offset: Number of bytes from the beginning of the
+ *                    external file to where the data starts
+ *          namelen: length of name
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nvssextfc(intf *id, _fcd name, intf *offset, intf *namelen)
+{
+    char   *fn;
+    intf    ret;
+
+    fn = HDf2cstring(name, *namelen);
+    if (!fn) return(FAIL);
+    ret = (intf) VSsetexternalfile(*id, fn, *offset);
+    HDfree((VOIDP)fn);
+    return(ret);
+}
+
+
+/* ------------------------------------------------------------------ */
+/*
+   **  returns the number of fields in a vdata
+   **  related: VFnfields--vfnflds--
+ */
+
+FRETVAL(intf)
+nvfnflds(intf * vkey)
+{
+    return((intf) VFnfields((int32)*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the name of a given field in a vdata
+   **  related: VFfieldname--vffname--vffnamec
+ */
+
+FRETVAL(intf)
+nvffnamec(intf * vkey, intf * index, _fcd fname, intf *len)
+{
+    char *fieldname = NULL;
+    
+    if((fieldname=VFfieldname((int32)*vkey,(int32)*index))!=NULL)
+      {
+       /* HDstrcpy(_fcdtocp(fname),fieldname);*/
+        HDpackFstring(fieldname, _fcdtocp(fname), (intn) *len);
+        /* HDfree(fieldname); */
+        return(SUCCEED);
+      } /* end if */
+    else
+        return(FAIL);
+}   /* vffnamec */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the number-type of a given field in a vdata
+   **  related: VFfieldtype--vfftype--
+ */
+
+FRETVAL(intf)
+nvfftype(intf * vkey, intf * index)
+{
+    return((intf)VFfieldtype((int32)*vkey,(int32)*index));
+}   /* vfftype */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the internal (in memory) size of a given field in a vdata
+   **  related: VFfieldisize--vffisiz--
+ */
+
+FRETVAL(intf)
+nvffisiz(intf * vkey, intf * index)
+{
+    return((intf)VFfieldisize((int32)*vkey,(int32)*index));
+}   /* vffisiz */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the external (on disk) size of a given field in a vdata
+   **  related: VFfieldesize--vffesiz--
+ */
+
+FRETVAL(intf)
+nvffesiz(intf * vkey, intf * index)
+{
+    return((intf)VFfieldesize((int32)*vkey,(int32)*index));
+}   /* vffesiz */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  get the order of a given field in a vdata
+   **  related: VFfieldorder--vffordr--
+ */
+
+FRETVAL(intf)
+nvffordr(intf * vkey, intf * index)
+{
+    return((intf)VFfieldorder((int32)*vkey,(int32)*index));
+}   /* vffordr */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  reads records from a vdata into a char buffer
+   **  related: VSread--vsfrdc
+ */
+
+FRETVAL(intf)
+nvsfrdc(intf * vkey, _fcd cbuf, intf * nelt, intf * interlace)
+{
+    return ((intf) VSread(*vkey, (uint8 *) _fcdtocp(cbuf), *nelt, *interlace));
+}
+/* ------------------------------------------------------------------ */
+/*
+   **  reads records from a vdata into integer buffer 
+   **  related: VSread--vsfrd
+ */
+
+FRETVAL(intf)
+nvsfrd(intf * vkey, intf *buf, intf * nelt, intf * interlace)
+{
+    return ((intf) VSread(*vkey, (uint8 *) buf, *nelt, *interlace));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  reads from a vdata
+   **  related: VSread--vsreadc--VSFREAD
+ */
+
+FRETVAL(intf)
+nvsreadc(intf * vkey, uint8 *buf, intf * nelt, intf * interlace)
+{
+    return ((intf) VSread(*vkey, buf, *nelt, *interlace));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  writes to a vdata from a char buffer
+   **  related: VSwrite--vsfwrtc
+ */
+
+FRETVAL(intf)
+nvsfwrtc(intf * vkey, _fcd cbuf, intf * nelt, intf * interlace)
+{
+    return ((intf) VSwrite(*vkey, (uint8 *) _fcdtocp(cbuf), *nelt, 
+            *interlace));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  writes to a vdata from an integer buffer
+   **  related: VSwrite--vsfwrt
+ */
+
+FRETVAL(intf)
+nvsfwrt(intf * vkey, intf *buf, intf * nelt, intf * interlace)
+{
+    return ((intf) VSwrite(*vkey, (uint8 *)buf, *nelt, *interlace));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  writes to a vdata 
+   **  related: VSwrite--vswritc--VSFWRIT
+ */
+
+FRETVAL(intf)
+nvswritc(intf * vkey, uint8 *buf, intf * nelt, intf * interlace)
+{
+    return ((intf) VSwrite(*vkey, buf, *nelt, *interlace));
+}
+
+/* ======================================== */
+/* miscellaneous VDATA inquiry routines */
+/* ======================================== */
+/* undocumented */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the interlace of the vdata
+   **  related: VSgetinterlace--vsgintc--VSFGINT
+ */
+
+FRETVAL(intf)
+nvsgintc(intf * vkey)
+{
+    return ((intf) VSgetinterlace(*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the number of elements in the vdata
+   **  related: VSelts--vseltsc--VSFELTS
+ */
+
+FRETVAL(intf)
+nvseltsc(intf * vkey)
+{
+    return ((intf) VSelts(*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the fields in the vdata
+   **  related: VSgetfields--vsgfldc--VSFGFLD
+ */
+
+FRETVAL(intf)
+nvsgfldc(intf * vkey, _fcd fields)
+{
+    return ((intf) VSgetfields(*vkey, _fcdtocp(fields)));
+}   /* VSGFLDC */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  determines the (machine) size of the given fields
+   **  related: VSsizeof--vssizc--VSFSIZ
+ */
+
+FRETVAL(intf)
+nvssizc(intf * vkey, _fcd fields, intf * fieldslen)
+{
+    char       *flds;
+    intf        ret;
+
+    flds = HDf2cstring(fields, (intn) *fieldslen);
+    if (!flds) return(FAIL);
+    /* trimendblanks(flds); */
+    ret = VSsizeof(*vkey, flds);
+    HDfree(flds);
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  determines the no of entries in a vgroup
+   **  related: Ventries--ventsc--VFENTS
+ */
+
+FRETVAL(intf)
+nventsc(intf * f, intf * vgid)
+{
+    return ((intf) Ventries(*f, *vgid));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the refs of all lone vgroups in the file
+   **  related: Vlone--vlonec--VFLONE
+ */
+
+FRETVAL(intf)
+nvlonec(intf * f, intf * idarray, intf * asize)
+{
+    return ((intf) Vlone(*f, (int32 *)idarray, (int32) *asize));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the refs of all lone vdatas in the file
+   **  related: VSlone--vslonec--VSFLONE
+ */
+
+FRETVAL(intf)
+nvslonec(intf * f, intf * idarray, intf * asize)
+{
+    return (VSlone(*f, (int32 *)idarray, (int32) *asize));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the ref # of a vgroup for a given name
+   **  related: Vfind--vfindc--VFIND
+ */
+
+FRETVAL(intf)
+nvfindc(intf * f, _fcd name, intf * namelen)
+{
+    char *tmp_name;
+    intf ret;
+
+    tmp_name = HDf2cstring(name, (intn) *namelen);
+    if (!tmp_name) return(FAIL);
+
+    ret = (intf) Vfind((int32)*f, tmp_name);
+    HDfree(tmp_name);
+
+    return (ret);
+} /* end nvfindc() */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the ref # of a vgroup for a given class
+   **  related: Vfindclass--vfclassc--VFNDCLS
+ */
+
+FRETVAL(intf)
+nvfndclsc(intf * f, _fcd vgclass, intf * classlen)
+{
+    char *t_class;
+    intf ret;
+
+    t_class = HDf2cstring(vgclass, (intn) *classlen);
+    if (!t_class) return(FAIL);
+
+    ret = (intf) Vfindclass((int32)*f, t_class);
+    HDfree(t_class);
+
+    return (ret);
+} /* end nvfndclsc() */
+
+/*
+   ** ==================================================================
+   ** HIGH-LEVEL VSET ROUTINES --- VHxxxxx()
+   ** ==================================================================
+ */
+
+/*----------------------------------------------------------
+   **  store a simple dataset in a vdata
+   **  related: VHstoredata--vhsdc--vhfsd
+ */
+
+FRETVAL(intf)
+nvhsdc(intf * f, _fcd field, uint8 *buf, intf * n, intf * datatype, _fcd vsname,
+       _fcd vsclass, intf * fieldlen, intf * vsnamelen, intf * vsclasslen)
+{
+    char       *fld, *name, *tclass;
+    intf        ret_val;
+
+    fld = HDf2cstring(field, (intn) *fieldlen);
+    if (!fld) return(FAIL);
+    name = HDf2cstring(vsname, (intn) *vsnamelen);
+    if (!name){
+	HDfree(fld);
+	return(FAIL);
+    }
+    tclass = HDf2cstring(vsclass, (intn) *vsclasslen);
+    if (!tclass){
+	HDfree(fld);
+	HDfree(name);
+	return(FAIL);
+    }
+
+    ret_val = (intf) VHstoredata(*f, fld, buf, *n, *datatype, name, tclass);
+    HDfree(fld);
+    HDfree(name);
+    HDfree(tclass);
+
+    return (ret_val);
+}
+
+/*----------------------------------------------------------
+   **  store a simple char dataset in a vdata
+   **  related: VHstoredata--vhscdc--vhfscd
+ */
+
+FRETVAL(intf)
+nvhscdc(intf * f, _fcd field, _fcd cbuf, intf * n, intf * datatype, _fcd vsname,
+       _fcd vsclass, intf * fieldlen, intf * vsnamelen, intf * vsclasslen)
+{
+    if ((*datatype != DFNT_CHAR) && (*datatype != DFNT_UCHAR))
+        return FAIL;
+    return (nvhsdc(f, field, (uint8 *) _fcdtocp(cbuf), n, datatype,
+                  vsname, vsclass, fieldlen, vsnamelen, vsclasslen));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  store an aggregate char dataset in a vdata
+   **  related: VHstoredatam--vhscdmc--vhfscdm
+ */
+
+FRETVAL(intf)
+nvhscdmc(intf * f, _fcd field, _fcd cbuf, intf * n, intf * datatype,
+        _fcd vsname, _fcd vsclass, intf * order, intf * fieldlen,
+        intf * vsnamelen, intf * vsclasslen)
+{
+    if ((*datatype != DFNT_CHAR) && (*datatype != DFNT_UCHAR))
+        return FAIL;
+    return (nvhsdmc(f, field, (uint8 *) _fcdtocp(cbuf), n, datatype,
+            vsname, vsclass, order, fieldlen, vsnamelen, vsclasslen));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  store an aggregate dataset in a vdata
+   **  related: VHstoredatam--vhsdmc--vhfsdm
+ */
+
+FRETVAL(intf)
+nvhsdmc(intf * f, _fcd field, uint8 *buf, intf * n, intf * datatype,
+        _fcd vsname, _fcd vsclass, intf * order, intf * fieldlen,
+        intf * vsnamelen, intf * vsclasslen)
+{
+    char       *fld, *name, *tclass;
+    intf        ret_val;
+
+    fld = HDf2cstring(field, (intn) *fieldlen);
+    if (!fld) return(FAIL);
+    name = HDf2cstring(vsname, (intn) *vsnamelen);
+    if (!name){
+        HDfree(fld);
+        return(FAIL);
+    }
+    tclass = HDf2cstring(vsclass, (intn) *vsclasslen);
+    if (!tclass){
+        HDfree(fld);
+        HDfree(name);
+        return(FAIL);
+    }
+
+    ret_val = (intf) VHstoredatam(*f, fld, buf, *n, *datatype, name, 
+                        tclass, *order);
+    HDfree(fld);
+    HDfree(name);
+    HDfree(tclass);
+
+    return (ret_val);
+
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  make a new vgroup given several tag/ref pairs
+   **  related: VHmakegroup--vhmkgpc--vhfmkgp
+ */
+
+FRETVAL(intf)
+nvhmkgpc(intf * f, intf * tagarray, intf * refarray, intf * n, _fcd vgname,
+         _fcd vgclass, intf * vgnamelen, intf * vgclasslen)
+{
+    char       *gname, *gclass;
+    intf        ret_val;
+
+    gname = HDf2cstring(vgname, (intn) *vgnamelen);
+    if (!gname) return(FAIL);
+    gclass = HDf2cstring(vgclass, (intn) *vgclasslen);
+    if (!gclass){
+	HDfree(gname);
+	return(FAIL);
+    }
+
+    ret_val = (intf) VHmakegroup(*f, (int32 *) tagarray, (int32 *) refarray,
+                                 *n, gname, gclass);
+    HDfree(gname);
+    HDfree(gclass);
+
+    return (ret_val);
+}
+
+/* ================================================================== */
+/*
+   **  locate a field in a vdata that belongs to this VGROUP
+   **  related: Vflocate--vffloc--vflocc
+ */
+
+FRETVAL(intf)
+nvflocc(intf * vkey, _fcd field, intf * fieldlen)
+{
+    char       *fld;
+    intf        ret;
+
+    fld = HDf2cstring(field, (intn) *fieldlen);
+    if (!fld) return(FAIL);
+    /* trimendblanks(fld); */
+    ret = (int32) Vflocate(*vkey, fld);
+    HDfree(fld);
+
+    return (ret);
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  tests if a tag/ref pair is in a vgroup.
+   **  related: Vinqtagref--vinqtrc--vfinqtr
+ */
+
+FRETVAL(intf)
+nvinqtrc(intf * vkey, intf * tag, intf * ref)
+{
+    return ((intf) Vinqtagref(*vkey, *tag, *ref));
+}
+/* ------------------------------------------------------------------ */
+/*
+   **  gets the number of tag/refs stored in a vgroup
+   **  related: Vntagrefs--vntrc--VFNTR
+ */
+
+FRETVAL(intf)
+nvntrc(intf * vkey)
+{
+    return ((intf) Vntagrefs(*vkey));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  Returns the number of tags of a given type in a vgroup
+   **  related: Vnrefs--vnrefs--
+ */
+
+FRETVAL(intf)
+nvnrefs(intf * vkey, intf *tag)
+{
+    return((intf) Vnrefs((int32)*vkey, (int32)*tag));
+} /* end nvnrefs() */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  Return the ref of this vgroup
+   **  related: VQueryref--vqref--
+ */
+
+FRETVAL(intf)
+nvqref(intf * vkey)
+{
+    return((intf) VQueryref((int32)*vkey));
+} /* end nvqref() */
+
+/* ------------------------------------------------------------------ */
+/*
+   **  Return the ref of this vgroup
+   **  related: VQuerytag--vqtag--
+ */
+
+FRETVAL(intf)
+nvqtag(intf * vkey)
+{
+    return((intf) VQuerytag((int32)*vkey));
+} /* end nvqtag() */
+
+/* ------------------------------------------------------------------ */
+
+/*
+   **  returns all the tag/ref pairs in a vgroup
+   **  related: Vgettagrefs--vgttrsc--vfgttrs
+ */
+
+FRETVAL(intf)
+nvgttrsc(intf * vkey, intf * tagarray, intf * refarray, intf * n)
+{
+    return ((intf) Vgettagrefs(*vkey, (int32 *) tagarray, (int32 *) refarray, *n));
+}
+
+/* ------------------------------------------------------------------ */
+/*
+   **  returns a specified tag/ref pair in a vgroup
+   **  related: Vgettagref--vgttrc--vfgttr
+ */
+
+FRETVAL(intf)
+nvgttrc(intf * vkey, intf * which, intf * tag, intf * ref)
+{
+    return ((intf) Vgettagref(*vkey, *which, (int32 *) tag, (int32 *) ref));
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  tests if a tag/ref pair is in a vgroup.
+   **  related: Vinqtagref--vinqtrc--vfinqtr
+ */
+
+FRETVAL(intf)
+nvadtrc(intf * vkey, intf * tag, intf * ref)
+{
+    return ((intf) Vaddtagref(*vkey, *tag, *ref));
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  checks the number of elements in a vgroup
+   **  related: VSQuerycount--vsqfnelt
+ */
+
+FRETVAL(intf)
+nvsqfnelt(intf * vkey, intf * nelt)
+{
+    int32       ret_nelt=0;
+    intn        stat;
+
+    stat = VSQuerycount((int32) *vkey, &ret_nelt);
+
+    *nelt = (intf) ret_nelt;
+    return ((intf) stat);
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  checks the interlace of a vgroup
+   **  related: VSQueryinterlace--vsqfintr
+ */
+
+FRETVAL(intf)
+nvsqfintr(intf * vkey, intf * interlace)
+{
+    int32       ret_inter=0;
+    intn        stat;
+
+    stat = VSQueryinterlace((int32) *vkey, &ret_inter);
+
+    *interlace = (intf) ret_inter;
+    return ((intf) stat);
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  gets the names of the fields of a vgroup
+   **  related: VSQueryfields--vsqfflds
+ */
+
+FRETVAL(intf)
+nvsqfldsc(intf * vkey, _fcd fields, intf *fieldslen)
+{
+    char       *fld;
+    intf        ret;
+
+    fld= HDf2cstring(fields, (intn) *fieldslen);
+    if (!fld) return(FAIL);
+    ret = (intf) VSQueryfields((int32) *vkey, fld);
+    HDfree(fld);
+
+    return (ret);
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  checks the size of an element of a vgroup
+   **  related: VSQueryvsize--vsqfvsiz
+ */
+
+FRETVAL(intf)
+nvsqfvsiz(intf * vkey, intf * size)
+{
+    int32       ret_size=0;
+    intn        stat;
+
+    stat = VSQueryvsize((int32) *vkey, &ret_size);
+
+    *size = (intf) ret_size;
+    return ((intf) stat);
+}
+/* ------------------------------------------------------------------ */
+
+/*
+   **  gets the names of a vgroup
+   **  related: VSQueryname--vsqfname
+ */
+
+FRETVAL(intf)
+nvsqnamec(intf * vkey, _fcd name, intf *namelen)
+{
+    char       *nam;
+    intf        ret;
+
+    nam= HDf2cstring(name, (intn) *namelen);
+    if (!nam) return(FAIL);
+    ret = (intf) VSQueryname((int32) *vkey, nam);
+    HDfree(nam);
+
+    return (ret);
+}
+
+
+/* ------------------------------------------------------------------ */
+FRETVAL(intf)
+nvsfccpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz,
+        intf *nrecs, _fcd pckfld, _fcd fldbuf, intf *buflds_len, intf *fld_len)
+{      
+    char  *flds_in_buf;
+    char  *afield;
+    intf ret;
+    VOIDP fldbufpt[1];
+  
+    flds_in_buf=HDf2cstring(buflds, (intn) *buflds_len);
+    if (!flds_in_buf){
+	return(FAIL);
+    }
+    afield = HDf2cstring(pckfld, (intn) *fld_len);
+    if (!afield) {
+	HDfree(flds_in_buf);
+	return(FAIL);
+    }
+    if (*flds_in_buf == '\0'){
+	HDfree(flds_in_buf);
+        flds_in_buf = NULL;
+    }
+    if (*afield == '\0'){
+	HDfree(afield);
+        afield = NULL;
+    }
+    fldbufpt[0] = _fcdtocp(fldbuf);
+    ret = VSfpack((int32)*vs, (intn)*packtype, flds_in_buf, (VOIDP)buf, 
+         (intn)*bufsz, (intn)*nrecs, afield, fldbufpt);
+
+    if (flds_in_buf) HDfree(flds_in_buf);
+    if (afield) HDfree(afield);
+    return(ret);
+}
+
+
+/* ------------------------------------------------------------------ */
+FRETVAL(intf)
+nvsfncpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz,
+        intf *nrecs, _fcd pckfld, intf *fldbuf, intf *buflds_len, intf *fld_len)
+{     
+    char  *flds_in_buf;
+    char  *afield;
+    intf ret;
+    VOIDP fldbufpt[1];
+  
+    flds_in_buf=HDf2cstring(buflds, (intn) *buflds_len);
+    if (!flds_in_buf){
+	return(FAIL);
+    }
+    afield = HDf2cstring(pckfld, (intn) *fld_len);
+    if (!afield) {
+	HDfree(flds_in_buf);
+	return(FAIL);
+    }
+    if (*flds_in_buf == '\0'){
+	HDfree(flds_in_buf);
+        flds_in_buf = NULL;
+    }
+    if (*afield == '\0'){
+	HDfree(afield);
+        afield = NULL;
+    }
+    fldbufpt[0] = fldbuf;
+    ret = VSfpack((int32)*vs, (intn)*packtype, flds_in_buf, (VOIDP)buf, 
+                  (intn)*bufsz, (intn)*nrecs, afield, fldbufpt);
+
+    if (flds_in_buf) HDfree(flds_in_buf);
+    if (afield) HDfree(afield);
+    return(ret);
+}
+
+/*
+   **  C-stub for deleting a tag/ref pair in a vgroup.
+   **  related: called by vfdtr() and calls Vdeletetagref(), 
+   **  
+ */
+
+FRETVAL(intf)
+nvdtrc(intf * vkey, intf * tag, intf * ref)
+{
+    return ((intf) Vdeletetagref(*vkey, *tag, *ref));
+}
+
+/*------------------------------------------------------------------------
+ *       Name:      vscfcls 
+ *       Purpose:   calls VSfindclass 
+ *       Inputs:    id    -  file ID
+ *                  name  -  class of vdata to find  
+ *       Returns:   returns 0 if not found, or error. Otherwise, returns
+ *                  the vdata's ref number (a positive integer)
+ *       Related functions: vffcls, VSfindclass 
+ *       Users:     HDF Fortran programmers
+ ---------------------------------------------------------------------*/
+     FRETVAL (intf)
+#ifdef PROTOTYPE
+       nvscfcls( intf *id, _fcd name, intf *namelen )
+#else
+       nvscfcls (id, name, namelen)
+               intf   *id;
+              _fcd    name;
+               intf   *namelen;
+#endif /* PROTOTYPE */
+
+{
+       intf  fi_id;
+       intf  ret;
+       char  *class_name;
+
+       fi_id = *id;
+       class_name = HDf2cstring(name, (intn) *namelen);
+       if (!class_name) return(FAIL);
+
+       ret = VSfindclass( fi_id, class_name);
+       HDfree(class_name);
+       return(ret);
+} 
+/*------------------------------------------------------------------------
+ *       Name:      vscsetblsz
+ *       Purpose:   calls VSsetblocksize
+ *       Inputs:    id    -  vdata identifier
+ *                  block_size - size of the block
+ *       Returns:   0 if succeeds, -1 if fails
+ *       Users:     HDF Fortran programmers
+ ---------------------------------------------------------------------*/
+     FRETVAL (intf)
+#ifdef PROTOTYPE
+       nvscsetblsz( intf *id , intf *block_size)
+#else
+       nvscsetblsz (id, block_size)
+               intf   *id;
+               intf   *block_size;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret = -1;
+       intn c_ret;	
+
+       c_ret = VSsetblocksize( *id, *block_size);
+       if(c_ret == 0) ret = 0;
+       return(ret);
+} 
+/*------------------------------------------------------------------------
+ *       Name:      vscsetnmbl
+ *       Purpose:   calls VSsetnumblocks
+ *       Inputs:    id    -  vdata identifier
+ *                  num_blocks - number of blocks
+ *       Returns:   0 if succeeds, -1 if fails
+ *       Users:     HDF Fortran programmers
+ ---------------------------------------------------------------------*/
+     FRETVAL (intf)
+#ifdef PROTOTYPE
+       nvscsetnmbl( intf *id , intf *num_blocks)
+#else
+       nvscsetnmbl (id, num_blocks)
+               intf   *id;
+               intf   *num_blocks;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret;
+       intn  c_ret;
+
+       c_ret = VSsetnumblocks( *id, *num_blocks);
+       if(c_ret == 0) ret = 0;
+       return(ret);
+} 
+/*------------------------------------------------------------------------
+ *       Name:      vscgblinfo
+ *       Purpose:   calls VSgetblockinfo
+ *       Inputs:    id    -  vdata identifier
+ *                  block_size - size of the block
+ *                  num_blocks - number of blocks
+ *       Returns:   0 if succeeds, -1 if fails
+ *       Users:     HDF Fortran programmers
+ ---------------------------------------------------------------------*/
+     FRETVAL (intf)
+#ifdef PROTOTYPE
+       nvscgblinfo( intf *id , intf *block_size, intf *num_blocks)
+#else
+       nvscgblinfo (id, block_size, num_blocks)
+               intf   *id;
+               intf   *block_size; 
+               intf   *num_blocks;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret = -1;
+        intn c_ret;
+	int32 c_block_size;
+        int32 c_num_blocks;
+
+       c_ret = VSgetblockinfo( *id, &c_block_size, &c_num_blocks);
+       if (c_ret == 0) {
+       		*block_size = c_block_size;
+       	        *num_blocks = c_num_blocks;
+       	      	ret = 0;
+       }
+       return(ret);
+} 
+/*------------------------------------------------------------------------
+ *       Name:      vcgvgrp
+ *       Purpose:   calls Vgetvgroups
+ *       Inputs:    id       - vdata identifier
+ *                  start_vg - size of the block
+ *                  vg_count - number of blocks
+ *       Outputs:   refarray - Array to hold reference numbers 
+ *                             of retrieved vgroups
+ *       Returns:   0 if succeeds, -1 if fails
+ *       Users:     HDF Fortran programmers
+ ---------------------------------------------------------------------*/
+     FRETVAL (intf)
+#ifdef PROTOTYPE
+       nvcgvgrp(intf *id, intf *start_vg, intf *vg_count, intf *refarray)
+#else
+       nvcgvgrp(id, start_vg, vg_count, refarray)
+               intf   *id;
+               intf   *start_vg; 
+               intf   *vg_count;
+	       intf   *refarray;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret=-1;
+       uintn ii;
+       uint16 *c_refarray;
+
+       if(*vg_count == -1) {
+	 ret = (intf)Vgetvgroups((int32)*id, (uintn)*start_vg, 0, NULL );
+       }
+       else {
+	 c_refarray = (uint16 *)HDmalloc(sizeof(uint16)*(uintn)*vg_count);
+	 ret = (intf)Vgetvgroups((int32)*id, (uintn)*start_vg, (uintn)*vg_count, c_refarray );
+
+	 /* copy C refarray to the fortran refarray, converting uint16 to intf type */
+	 for (ii = 0; ii < (uintn)*vg_count; ii++)
+	   refarray[ii] = (intf)c_refarray[ii];
+	 
+	 if (c_refarray != NULL)
+	   HDfree(c_refarray);
+       }
+       return(ret);
+} 
+/*------------------------------------------------------------------------
+ *       Name:      vscgvdatas
+ *       Purpose:   calls  VSgetvdatas
+ *       Inputs:    id       - File identifier returned by Hopen or vgroup 
+ *                             identifier returned by Vattach
+ *                  start_vd - Vdata number to start retrieving at
+ *                  vd_count - Number of vdatas to be retrieved
+ *       Outputs:   refarray - Array to hold reference numbers of 
+ *                             retrieved vdatas 
+ *       Returns:   0 if succeeds, -1 if fails
+ *       Users:     HDF Fortran programmers
+ ---------------------------------------------------------------------*/
+     FRETVAL (intf)
+#ifdef PROTOTYPE
+       nvscgvdatas(intf *id, intf *start_vd, intf *vd_count, intf *refarray)
+#else
+       nvscgvdatas(id, start_vd, vd_count, refarray)
+               intf   *id;
+               intf   *start_vd; 
+               intf   *vd_count;
+	       intf   *refarray;
+#endif /* PROTOTYPE */
+
+{
+       intf   ret=-1;
+       uintn ii;
+       uint16 *c_refarray;
+
+       if(*vd_count == -1) {
+	 ret = (intf)VSgetvdatas((int32)*id, (uintn)*start_vd, 0, NULL );
+       }
+       else {
+	 c_refarray = (uint16 *)HDmalloc(sizeof(uint16)*(uintn)*vd_count);
+	 ret = (intf)VSgetvdatas((int32)*id, (uintn)*start_vd, (uintn)*vd_count, c_refarray );
+         /* copy C refarray to the fortran refarray, converting uint16 to intf type */
+	 for (ii = 0; ii < (uintn)*vd_count; ii++)
+	   refarray[ii] = (intf)c_refarray[ii];
+	 
+	 if (c_refarray != NULL)
+	   HDfree(c_refarray);
+       }
+
+       return(ret);
+} 
diff --git a/hdf/src/vgff.f b/hdf/src/vgff.f
new file mode 100644
index 0000000..c3e3949
--- /dev/null
+++ b/hdf/src/vgff.f
@@ -0,0 +1,892 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: vgff.f 5737 2012-01-06 04:52:28Z brtnfld $ 
+C     
+c **************************************************************************
+c *
+c * vgFf.f
+c * Part of the HDF VSet interface.
+c *
+c * Contains fortran routines callable from fortran programs.
+c *
+c **************************************************************************
+
+
+c   ============================================================
+c	 VGROUP ROUTINES
+c	============================================================
+
+c	attachs to a vgroup 	
+c	related: Vattach--vatchc--VFATCH
+
+      integer function vfatch(f, vgid, accesstype)
+      integer     f, vgid
+      character*1 accesstype
+      integer     vatchc
+
+      vfatch = vatchc (f, vgid, accesstype)
+      end
+
+c	------------------------------------------------------------
+c	detaches from a vgroup
+c	related: Vdetach--vdtchc--VFDTCH
+
+      integer function vfdtch (vg)
+      integer     vg
+      integer   vdtchc
+
+      vfdtch = vdtchc (vg)
+      end
+
+c	------------------------------------------------------------
+c	general inquiry on a vgroup
+c	related: Vgetname--vgnamc--VFGNAM
+
+      integer function vfgnam (vg, vgname)
+      integer         vg
+      character*(*)   vgname
+      integer         vgnamc
+
+      vfgnam = vgnamc (vg, vgname)
+      end
+c	------------------------------------------------------------
+c	get the class name of a vgroup
+c	related: Vgetclass--vgclsc--VFGCLS
+
+      integer function vfgcls (vg, vgclass)
+
+      integer   vg
+      character*(*)   vgclass
+      integer       vgclsc
+
+      vfgcls = vgclsc  (vg, vgclass)
+      end
+c   ------------------------------------------------------------
+c	general inquiry on a vgroup
+c	related: Vinquire--vinqc--VFINQ
+
+      integer   function    vfinq (vg, nentries, vgname)
+      integer   vg, nentries
+      character*(*)   vgname
+      integer   vinqc
+
+      vfinq = vinqc (vg, nentries, vgname)
+      end
+
+c   ------------------------------------------------------------
+c	gets the id of the next vgroup in the file
+c	related: Vgetid--vgidc--VFGID
+
+      integer   function    vfgid (f, vgid)
+      integer     f, vgid
+      integer     vgidc
+
+      vfgid = vgidc (f, vgid)
+      end
+
+c	------------------------------------------------------------
+c	gets the id of the next entry in the vgroup
+c	related: Vgetnext--vgnxtc--VFGNXT
+
+      integer   function    vfgnxt (vg, id)
+      integer   vg, id
+      integer   vgnxtc
+
+      vfgnxt = vgnxtc (vg, id)
+      end
+
+
+c	------------------------------------------------------------
+c	sets the name of the vgroup
+c	related: Vsetname--vsnamc--VFSNAM
+
+      integer function vfsnam (vg, vgname)
+      integer        vg
+      character*(*)  vgname
+      integer        vsnamc
+
+      vfsnam = vsnamc (vg, vgname, len(vgname))
+      end
+c   ------------------------------------------------------------
+c	sets the class name of the vgroup
+c	related: Vsetclass--vsclsc--VFSCLS
+
+      integer function vfscls (vg, vgclass)
+      integer       vg
+      character*(*) vgclass
+      integer       vsclsc
+
+      vfscls = vsclsc  (vg, vgclass, len(vgclass))
+      end
+
+c	------------------------------------------------------------
+c	inserts a vset entity (ie vgroup or vdata) into the given vgroup
+c	related: Vinsert--vinsrtc--VFINSRT
+
+      integer   function vfinsrt (vg, velt)
+      integer   vg, velt
+      integer   vinsrtc
+
+      vfinsrt = vinsrtc (vg, velt)
+      end
+
+c     ------------------------------------------------------------
+c     tests if an id in a vgroup is a vgroup
+c     related: Visvg--visvgc--vfisvg
+
+      integer function vfisvg (vg, id)
+      integer vg, id
+      integer visvgc
+
+      vfisvg = visvgc (vg, id)
+      end
+
+c     ------------------------------------------------------------
+c     tests if an id in a vgroup is a vdata
+c     related: Visvs--visvsc--vfisvs
+
+      integer   function vfisvs (vg, id)
+      integer   vg, id
+      integer   visvsc
+
+      vfisvs = visvsc (vg, id)
+      end
+
+
+
+c     ============================================================
+c      VDATA ROUTINES
+c     ============================================================
+
+c     attach to a vdata
+c     related: VSattach--vsatchc--vfatch
+
+      integer function vsfatch (f, vsid, accesstype)
+      integer     f, vsid
+      character*1 accesstype
+      integer     vsatchc
+
+      vsfatch = vsatchc (f, vsid, accesstype)
+      end
+
+c     ------------------------------------------------------------
+c     detach from a vdata
+c     related: VSdetach--vsdtchc--vfdtch
+
+      integer function vsfdtch (vs)
+      integer vs
+      integer vsdtchc
+
+      vsfdtch = vsdtchc (vs)
+      end
+
+c     ------------------------------------------------------------
+c     seeks to a given element position in a vadata
+c     related: VSseek--vsseekc--vsfseek
+
+      integer   function vsfseek (vs, eltpos )
+      integer   vs, eltpos
+      integer   vsseekc
+
+      vsfseek = vsseekc (vs, eltpos)
+      end
+
+c     ------------------------------------------------------------
+c     gets the name of a vdata
+c     related: VSgetname--vsgnamc--vsfgnam
+
+      integer function vsfgnam (vs, vsname)
+      integer       vs
+      character*(*) vsname
+      integer       vsgnamc
+
+      vsfgnam = vsgnamc (vs, vsname, len(vsname))
+      end
+
+c     ------------------------------------------------------------
+c     get the class name of a vdata
+c     related: VSgetclass--vsgclsc--vsfgcls
+
+      integer function vsfgcls (vs, vsclass)
+      integer       vs
+      character*(*) vsclass
+      integer       vsgclsc
+
+      vsfgcls = vsgclsc  (vs, vsclass, len(vsclass))
+      end
+
+c     ------------------------------------------------------------
+c     general inquiry on a vdata
+c     related: VSinquire--vsinqc--vsfinq
+
+      integer function vsfinq (vs,nvs,ilace,fields,vsize,vsname) 
+      integer        vs, nvs, ilace, vsize
+      character*(*)  fields, vsname
+      integer        vsinqc
+
+      vsfinq = vsinqc (vs, nvs, ilace, fields, vsize, vsname,
+     +             len(fields), len(vsname))
+      end
+
+c     ------------------------------------------------------------
+c     tests if given fields exist in the vdata
+c     related: VSfexist--vsfexc--vsfex
+
+      integer   function vsfex (vs, fields)
+      integer   vs
+      character*(*) fields
+      integer       vsfexc
+
+      vsfex = vsfexc (vs, fields, len(fields))
+      end
+
+c     ------------------------------------------------------------
+c     looks for a Vdata with a given name
+c     related: VSfind--vsfind--vsffnd
+
+      integer function vsffnd (vs, name)
+      integer       vs
+      character*(*) name
+      integer vsfndc
+
+      vsffnd = vsfndc (vs, name, len(name))
+      end
+
+c  ------------------------------------------------------------
+c     gets the id of the next vdata from the file
+c     related: VSgetid--vsgidc--vsfgid
+
+      integer  function vsfgid (f, vsid)
+      integer  f, vsid
+      integer  vsgidc
+
+      vsfgid = vsgidc (f, vsid)
+      end
+
+c  ------------------------------------------------------------
+c     remove the vdata with id from the file
+c     related: VSdelete--vsdltc--vsfdlte
+
+      integer  function vsfdlte (f, vsid)
+      integer     f, vsid
+      integer     vsdltc
+
+      vsfdlte = vsdltc (f, vsid)
+      end
+
+c     ------------------------------------------------------------
+c     sets the name of a vdata
+c     related: VSsetname--vssnamc--vsfsnam
+
+      integer function vsfsnam (vs, vsname)
+      integer       vs
+      character*(*) vsname
+      integer       vssnamc
+
+      vsfsnam = vssnamc (vs, vsname, len(vsname))
+      end
+
+c     ------------------------------------------------------------
+c     set the class name of a vdata
+c     related: VSsetclass--vssclsc--vsfscls
+
+      integer function vsfscls (vs, vsclass)
+      integer       vs
+      character*(*) vsclass
+      integer vssclsc
+
+      vsfscls = vssclsc  (vs, vsclass, len(vsclass))
+      end
+
+c     ------------------------------------------------------------
+c     sets the fields in a vdata for reading or writing
+c     related: VSsetfields--vssfldc--vsfsfld
+
+      integer function vsfsfld (vs, fields)
+      integer   vs
+      character*(*)  fields
+      integer        vssfldc
+
+      vsfsfld = vssfldc (vs, fields, len(fields))
+      end
+
+c     ------------------------------------------------------------
+c     sets the file interlace of a vdata
+c     related: VSsetinterlace--vssintc--vsfsint
+
+      integer   function vsfsint (vs, interlace)
+      integer   vs, interlace
+      integer   vssintc
+
+      vsfsint = vssintc (vs, interlace)
+      end
+
+c     ------------------------------------------------------------
+c     defines a new field to be used in the vdata
+c     related: VSfdefine--vsfdefc--vsffdef
+
+      integer function vsffdef (vs, field, localtype, order)
+
+      integer        vs, localtype, order
+      character*(*)  field
+      integer        vsfdefc
+
+      vsffdef = vsfdefc ( vs, field, localtype, order, len(field))
+
+      end
+
+c     ------------------------------------------------------------
+c     reads from a vdata
+c     related: VSread--vsreadc--vsfread
+
+      integer function vsfread (vs, buf, nelts , interlace)
+
+      integer    vs, nelts , interlace
+      character*(*)   buf
+      integer    vsreadc
+
+      vsfread = vsreadc (vs, buf, nelts, interlace)
+      end
+
+c     ------------------------------------------------------------
+c     writes to a vdata
+c     related: VSwrite--vswritc--vsfwrit
+
+      integer function vsfwrit (vs, buf, nelts, interlace)
+
+      integer       vs, nelts, interlace
+      character*(*) buf(*)
+      integer       vswritc
+
+      vsfwrit = vswritc (vs, buf, nelts, interlace)
+      end
+
+C----------------------------------------------------------------------
+C     Name: vsfsextf
+C     Purpose:  call vssextfc to store data in an external file
+C     Inputs:   vid: vdata id
+C               fname: name of external file
+C               offset: Number of bytes from the beginning of the
+C                       external file to where the data starts
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C     Related:  VSsetexternalfile--vssextfc--vsfsextf
+C----------------------------------------------------------------------
+
+      integer function vsfsextf(vid, fname, offset)
+
+      character*(*) fname
+      integer       vid, offset, vssextfc
+
+      vsfsextf = vssextfc(vid, fname, offset, len(fname))
+      return
+      end
+
+c     ===========================================
+c     MISCELLANEOUS USEFUL VDATA INQUIRY ROUTINES
+c     ===========================================
+c
+c     undocumented
+
+
+c     gets the interlace of a vdata
+c     related: VSgetinterlace--vsgintc--vsfgint
+
+      integer   function vsfgint (vs)
+      integer   vs
+      integer   vsgintc
+
+      vsfgint = vsgintc (vs)
+      end
+
+c     ------------------------------------------------------------
+c     gets the number of elements in a vdata
+c     related: VSelts--vseltsc--vsfelts
+
+      integer function vsfelts (vs)
+      integer vs
+      integer vseltsc
+
+      vsfelts = vseltsc (vs)
+      end
+
+c     ------------------------------------------------------------
+c     gets the fields in the vdata
+c     related: VSgetfields--vsgfldc--vsfgfld
+
+      integer function vsfgfld (vs, fields)
+      integer vs
+      character*(*) fields
+      integer  vsgfldc
+
+      vsfgfld = vsgfldc (vs, fields)
+      end
+
+c     ------------------------------------------------------------
+c 	determines the (machine) size of the given fields
+c     related: VSsizeof--vssizc--vsfsiz
+
+      integer function vsfsiz (vs, fields)
+      integer vs
+      character*(*) fields
+      integer vssizc
+
+      vsfsiz = vssizc (vs, fields, len(fields))
+      end
+
+c     ------------------------------------------------------------
+c     determines the no of entries in a vgroup
+c     related: Ventries--ventsc--vfents
+
+      integer function vfents (f, vgid)
+      integer f, vgid
+      integer ventsc 
+
+      vfents = ventsc (f, vgid)
+      end
+
+c     ------------------------------------------------------------
+c     gets the refs of all lone vgroups in the file
+c     related: Vlone--vlonec--vflone
+
+      integer function vflone (f, idarray, asize)
+      integer f
+      integer idarray(*)
+      integer asize
+      integer vlonec
+
+      vflone = vlonec  (f, idarray, asize)
+      end
+
+c     ------------------------------------------------------------
+c     gets the refs of all lone vdatas in the file
+c     related: VSlone--vslonec--vsflone
+
+      integer function vsflone (f, idarray, asize)
+      integer f
+      integer idarray(*)
+      integer asize
+      integer vslonec
+
+      vsflone = vslonec  (f, idarray, asize)
+      end
+
+c     ------------------------------------------------------------
+c     gets the ref # of a vgroup for a given name
+c     related: Vfind--vfindc--VFIND
+
+      integer function vfind(f,name)
+      integer f
+      character*(*)  name
+      integer vfindc
+
+      vfind = vfindc (f, name, len(name))
+      end
+
+c     ------------------------------------------------------------
+c     gets the ref # of a vgroup for a given class
+c     related: Vfindclass--vfndclsc--VFNDCLS
+
+      integer function vfndcls(f,class)
+      integer f
+      character*(*)  class
+      integer vfndclsc
+
+      vfndcls = vfndclsc (f, class, len(class))
+      end
+
+c     ------------------------------------------------------------
+c     store a simple dataset in a vdata
+c     related: VHstoredata--vhsdc--vhfsd
+
+      integer function vhfsd(f,field,buf,n,dtype,vsname,vsclass)
+      integer f
+      character*(*)  field
+      integer buf(*)
+      integer n, dtype
+      character*(*)  vsname, vsclass
+      integer vhsdc
+
+      vhfsd = vhsdc (f, field, buf, n, dtype, vsname, vsclass,
+     1            len(field), len(vsname), len(vsclass))
+      end
+
+c     ------------------------------------------------------------
+c     store an aggregate dataset in a vadata
+c     related: VHstoredatam--vhsdmc--vhfsdm
+
+      integer function vhfsdm (f,field,buf,n,dtype,vsname,vsclass,order)
+      integer f
+      character*(*)  field
+      integer        buf(*)
+      integer        n, dtype, order
+      character*(*)  vsname, vsclass
+      integer vhsdmc
+
+      vhfsdm = vhsdmc (f, field, buf, n, dtype, vsname,vsclass, order,
+     1             len(field), len(vsname), len(vsclass))
+      end
+
+c     ------------------------------------------------------------
+c     store a simple char dataset in a vdata
+c     related: VHstoredata--vhscdc--vhfscd
+
+      integer function vhfscd(f,field,cbuf,n,dtype,vsname,vsclass)
+      integer        f
+      character*(*)  field
+      character      cbuf(*)
+      integer        n, dtype
+      character*(*)  vsname, vsclass
+      integer vhscdc
+
+      vhfscd = vhscdc(f,field,cbuf,n,dtype,vsname,vsclass,
+     1            len(field), len(vsname), len(vsclass))
+      end
+
+c     ------------------------------------------------------------
+c     store an aggregate char dataset in a vadata
+c     related: VHstoredatam--vhscdmc--vhfscdm
+
+      integer function vhfscdm (f,field,cbuf,n,dtype,vsname,
+     1            vsclass,order)
+      integer        f
+      character*(*)  field
+      character      cbuf(*)
+      integer        n, dtype, order
+      character*(*)  vsname, vsclass
+      integer vhscdmc
+
+      vhfscdm = vhscdmc (f, field, cbuf, n, dtype, vsname,
+     1          vsclass, order, len(field), len(vsname), 
+     1          len(vsclass))
+      end
+
+c     ------------------------------------------------------------
+c     make a new vgroup given several tag/ref pairs
+c     related: VHmakegroup--vhmkgpc--vhfmkgp
+
+      integer function vhfmkgp(f,tagarray,refarray,n,vgname,vgclass)
+      integer f, n
+      integer tagarray(*), refarray(*)
+      character*(*)  vgname, vgclass
+      integer vhmkgpc 
+
+      vhfmkgp = vhmkgpc (f, tagarray, refarray , n, vgname, vgclass,
+     1                len(vgname), len(vgclass))
+      end
+
+c     ============================================================
+c     More vgroup routines
+
+c     locate a field in a vdata that belongs to this VGROUP	
+c     related: Vflocate--vffloc--vflocc
+
+      integer function vffloc  (vg, field)
+      integer vg
+      character*(*) field
+      integer vflocc
+      vffloc = vflocc (vg, field, len(field))
+      end
+
+c     ------------------------------------------------------------
+c     tests if a tag/ref pair is in a vgroup.
+c     related: Vinqtagref--vinqtrc--vfinqtr
+
+      integer function vfinqtr  (vg, tag, ref)
+      integer vg, tag, ref
+      integer vinqtrc
+      vfinqtr = vinqtrc (vg, tag, ref)
+      end
+
+c     ------------------------------------------------------------
+c     gets the number of tag/refs stored in a vgroup
+c     related: Velts--veltsc--vfelts
+
+      integer function vfntr (vg)
+      integer vg
+      integer vntrc 
+      vfntr = vntrc (vg)
+      end
+
+c     ------------------------------------------------------------
+c     returns all the tag/ref pairs in a vgroup
+c     related: Vgettagrefs--vgttrsc--vfgttrs
+
+      integer function vfgttrs (vg, tagarray, refarray, n)
+      integer vg, n
+      integer tagarray(*), refarray(*)
+      integer vgttrsc
+
+      vfgttrs = vgttrsc (vg, tagarray, refarray, n)
+      end
+c     ------------------------------------------------------------
+c     returns a specified tag/ref pair in a vgroup
+c     related: Vgettagref--vgttrc--vfgttr
+
+      integer function vfgttr (vg, which, tag, ref)
+      integer vg, which
+      integer tag, ref
+      integer vgttrc
+
+      vfgttr = vgttrc (vg, which, tag, ref)
+      end
+
+c     ------------------------------------------------------------
+c     add a tag/ref pair to a vgroup
+c     related: Vaddtagref--vadtrc--vfadtr
+
+      integer function vfadtr( vg, tag, ref)
+      integer vg, tag, ref
+      integer vadtrc
+
+      vfadtr = vadtrc  ( vg, tag, ref)
+      end
+
+c     ------------------------------------------------------------
+c     specific inquiry on a vdata, gets fields
+c     related: VSQueryfields--vsqfldsc--vsqfflds
+
+      integer function vsqfflds (vs,fields) 
+      integer vs
+      character*(*) fields
+      integer       vsqfldsc
+
+      vsqfflds = vsqfldsc (vs,fields, len(fields))
+      end
+
+c     ------------------------------------------------------------
+c     specific inquiry on a vdata, gets vdata name
+c     related: VSQueryname--vsqnamec--vsqfname
+
+      integer function vsqfname (vs,name) 
+      integer vs
+      character*(*) name
+      integer vsqnamec
+
+      vsqfname = vsqnamec (vs,name, len(name))
+      end
+
+c     ============================================================
+c     pack values of a numeric field into data buf
+c     related: VSfpack--vsfncpk--vsfnpak
+c     Use ' ' (blank char) for buflds if the the data buf contains
+c         all fields of the vdata
+c     paktype = _HDF_VSPACK(0) for packing
+c               _HDF_VSUNPACK(1) for unpacking
+
+      integer function vsfnpak(vs,packtype,buflds,buf,bufsz,
+     +                        nrecs,pckfld,fldbuf)
+      integer vs, bufsz, nrecs
+      integer buf, fldbuf
+      character*(*) buflds, pckfld
+      integer vsfncpk
+      
+      vsfnpak = vsfncpk(vs,packtype,buflds,buf,bufsz,nrecs,pckfld,
+     +                 fldbuf, len(buflds), len(pckfld)) 
+      end
+
+c     ============================================================
+c     pack values of a char field into data buf
+c     related: VSfpack--vsfccpk--vsfcpak
+c     Use ' ' (blank char) for buflds if the the data buf contains
+c         all fields of the vdata
+c     paktype = _HDF_VSPACK(0) for packing
+c               _HDF_VSUNPACK(1) for unpacking
+
+      integer function vsfcpak(vs,packtype,buflds,buf,bufsz,
+     +                        nrecs,pckfld,fldbuf)
+      integer vs, bufsz, nrecs
+      integer buf
+      character*(*) buflds, pckfld, fldbuf
+      integer vsfccpk
+      
+      vsfcpak = vsfccpk(vs,packtype,buflds,buf,bufsz,nrecs,pckfld,
+     +                 fldbuf, len(buflds), len(pckfld)) 
+      end
+c  
+
+c     ------------------------------------------------------------
+c     Delete a tag/ref pair in a vgroup.
+c     related: vfdtr()-->vdtrc()-->Vdeletetagref()
+
+      integer function vfdtr( vg, tag, ref)
+      integer vg, tag, ref
+      integer vdtrc
+
+      vfdtr = vdtrc  ( vg, tag, ref)
+      end
+C-------------------------------------------------------------------------
+C        Name:      vsffcls 
+C        Purpose:   looks in the file, finds the vdata 
+C                   with the specified class 
+C                   and returns the ref of the vdata with class vdclass 
+C        Inputs:    id       -  file ID
+C                   vdclass  -  class of vdata to find  
+C        Returns:   returns 0 if not found, or error. Otherwise, returns
+C                   the vdata's ref number (a positive integer)
+C        Calls:     vcffcls (C stub for VSfindclass function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function vsffcls(id, vdclass)
+C
+         INTEGER id
+         CHARACTER*(*) vdclass
+         INTEGER vscfcls 
+C
+         vsffcls = vscfcls(id,vdclass, len(vdclass)) 
+
+C
+         return 
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      vffname 
+C        Purpose:   returns the name of a vdata field 
+C        Inputs:    vdata_id - vdata identofoer
+C                   field_index - field index    
+C        Output:    field_name           
+C        Returns:   returns 0 on if successful and -1 otherwise  
+C        Calls:     vffnamec (C stub for VDfieldname function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function vffname(vdata_id, field_index, field_name)
+         INTEGER vdata_id, field_index
+         CHARACTER*(*) field_name
+         INTEGER vffnamec 
+         vffname = vffnamec(vdata_id, field_index, field_name,
+     .                      len(field_name)) 
+         return 
+         end
+C-------------------------------------------------------------------------
+C        Name:      vsfsetblsz
+C        Purpose:   sets the block size of the linked-block element
+C        Inputs:    id       -  vdata identifier
+C                   block_size - size of each block
+C        Returns:   returns 0 if succeeds and -1 if fails
+C        Calls:     vscsetblsz (C stub for VSsetblocksize function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function vsfsetblsz(id, block_size)
+C
+         INTEGER id, block_size
+         INTEGER vscsetblsz
+C
+         vsfsetblsz = vscsetblsz(id, block_size) 
+         return 
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      vsfsetnmbl
+C        Purpose:   sets the number of blocks for a linked-block element
+C        Inputs:    id       -  vdata identifier
+C                   num_blocks - number of blocks to be used for the linked-block
+C                                elements
+C        Returns:   returns 0 if succeeds and -1 if fails
+C        Calls:     vscsetnmbl (C stub for VSsetnumblocks function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function vsfsetnmbl(id, num_blocks)
+C
+         INTEGER id, num_blocks
+         INTEGER vscsetnmbl
+C
+         vsfsetnmbl = vscsetnmbl(id, num_blocks) 
+         return 
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      vsfgetblinfo
+C        Purpose:   retrieves the block size and the number of blocks
+C                   of a linked-block element.
+C        Inputs:    id       -  vdata identifier
+C        Outputs:   block_size - the linked-block size
+C                   num_blocks - number of blocks the element has
+C        Returns:   returns 0 if succeeds and -1 if fails
+C        Calls:     vscgetblinfo (C stub for VSgetblockinfo function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function vsfgetblinfo(id, block_size, num_blocks)
+C
+         INTEGER id, num_blocks, block_size
+         INTEGER vscgblinfo
+C
+         vsfgetblinfo = vscgblinfo(id, block_size, num_blocks) 
+         return 
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      vfgvgroups
+C        Purpose:   Retrieves reference numbers of vgroups in a file 
+C                   or in a vgroup. 
+C                   
+C        Inputs:    id       - File identifier returned by Hopen or 
+C                              vgroup identifier returned by 
+C                              Vattachvdata identifier
+C                   start_vg - Vgroup index to start retrieving at
+C                   vg_count - Number of vgroups to be retrieved,  
+C                              if vg_count = -1, then only function value
+C                              will be return and refarray will be ignored.    
+C        Outputs:   refarray - Array to hold reference numbers 
+C                              of retrieved vgroups 
+C        Returns:   Returns the actual number of vgroups retrieved 
+C                   if successful, and FAIL (-1) otherwise.
+C        Calls:     vcgvgrp (C stub for Vgetvgroups function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function vfgvgroups(id, start_vg, vg_count, refarray)
+C
+         IMPLICIT NONE
+         INTEGER id, start_vg, vg_count
+         INTEGER refarray(*)
+         INTEGER vcgvgrp
+C
+         vfgvgroups = vcgvgrp(id, start_vg, vg_count, refarray) 
+         return 
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      vsfgvdatas
+C        Purpose:   Retrieves reference numbers of vdatas in a file or 
+C                   in a vgroup.
+C                   
+C        Inputs:    id       - File identifier returned by Hopen or vgroup 
+C                              identifier returned by Vattach
+C                   start_vd - Vdata number to start retrieving at
+C                   vd_count - Number of vdatas to be retrieved, 
+C                              if vd_count = -1, then only the function
+C                              will be return and refarray will be ignored.
+C        Outputs:   refarray - Array to hold reference numbers of 
+C                              retrieved vdatas 
+C        Returns:   Returns the actual number of user-created vdatas 
+C                   retrieved if successful, and FAIL (-1) otherwise.
+C        Calls:     vscgvdatas (C stub for VSgetvdatas function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         INTEGER function vsfgvdatas(id, start_vd, vd_count, refarray)
+C
+         IMPLICIT NONE
+         INTEGER id, start_vd, vd_count
+         INTEGER refarray(*)
+         INTEGER vscgvdatas
+C
+         vsfgvdatas = vscgvdatas(id, start_vd, vd_count, refarray) 
+         return 
+         end
diff --git a/hdf/src/vgint.h b/hdf/src/vgint.h
new file mode 100644
index 0000000..9950776
--- /dev/null
+++ b/hdf/src/vgint.h
@@ -0,0 +1,306 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: vgint.h 5584 2011-04-13 18:25:06Z bmribler $ */
+
+/*****************************************************************************
+*
+* vgint.h
+*
+* Part of HDF VSet interface
+*
+* defines library private symbols and structures used in v*.c files
+*
+* NOTES:
+* This include file depends on the basic HDF *.h files hdfi.h and hdf.h.
+* An 'S' in the comment means that that data field is saved in the HDF file.
+*
+******************************************************************************/
+
+#ifndef _VGINT_H
+#define _VGINT_H
+
+#include "H4api_adpt.h"
+
+#include "hfile.h"
+
+/* Include file for Threaded, Balanced Binary Tree implementation */
+#include "tbbt.h"
+
+/*
+ * typedefs for VGROUP, VDATA and VSUBGROUP
+ */
+typedef struct vgroup_desc VGROUP;
+typedef struct vdata_desc VDATA;
+typedef VDATA VSUBGROUP;
+
+/*
+ * -----------------------------------------------------------------
+ * structures that are part of the VDATA structure
+ * -----------------------------------------------------------------
+ */
+
+typedef struct symdef_struct
+  {
+      char    *name;         /* symbol name */
+      int16    type;         /* whether int, char, float etc */
+      uint16   isize;        /* field size as stored in vdata */
+      uint16   order;        /* order of field */
+  }
+SYMDEF;
+
+typedef struct write_struct
+  {
+      intn     n;            /* S actual # fields in element */
+      uint16   ivsize;       /* S size of element as stored in vdata */
+
+      char     name[VSFIELDMAX][FIELDNAMELENMAX + 1]; /* S name of each field */
+
+      int16    len[VSFIELDMAX];   /* S length of each fieldname */
+      int16    type[VSFIELDMAX];  /* S field type */
+      uint16   off[VSFIELDMAX];   /* S field offset in element in vdata */
+      uint16   isize[VSFIELDMAX]; /* S internal (HDF) size [incl order] */
+      uint16   order[VSFIELDMAX]; /* S order of field */
+      uint16   esize[VSFIELDMAX]; /*  external (local machine) size [incl order] */
+  }
+VWRITELIST;
+
+typedef struct dyn_write_struct
+  {
+      intn     n;      /* S actual # fields in element */
+      uint16   ivsize; /* S size of element as stored in vdata */
+      char     **name; /* S name of each field */
+#ifndef OLD_WAY
+      uint16   *bptr;  /* Pointer to hold the beginning of the buffer */
+#endif /* OLD_WAY */
+      int16    *type;  /* S field type (into bptr buffer) */
+      uint16   *off;   /* S field offset in element in vdata (into bptr buffer) */
+      uint16   *isize; /* S internal (HDF) size [incl order] (into bptr buffer) */
+      uint16   *order; /* S order of field (into bptr buffer) */
+      uint16   *esize; /* external (local machine) size [incl order] (into bptr buffer) */
+  }
+DYN_VWRITELIST;
+
+/* If there are too many attrs and performance becomes a problem,
+   the vs_attr_t list defined below can be replaced by an
+   array of attr lists, each list contains attrs for 1 field.
+ */ 
+typedef struct dyn_vsattr_struct
+{
+      int32    findex;     /* which field this attr belongs to */
+      uint16   atag, aref; /* tag/ref pair of the attr     */
+} vs_attr_t;
+
+typedef struct dyn_vgattr_struct
+{
+      uint16   atag, aref; /* tag/ref pair of the attr     */
+} vg_attr_t;
+
+typedef struct dyn_read_struct
+{
+      intn      n;         /* # fields to read */
+      intn      *item;     /* index into vftable_struct */
+} DYN_VREADLIST;
+
+/*
+ *  -----------------------------------------------
+ *         V G R O U P     definition
+ *  -----------------------------------------------
+ */
+
+struct vgroup_desc
+  {
+      uint16      otag, oref;   /* tag-ref of this vgroup */
+      HFILEID     f;            /* HDF file id  */
+      uint16      nvelt;        /* S no of objects */
+      intn        access;       /* 'r' or 'w' */
+      uint16     *tag;          /* S tag of objects */
+      uint16     *ref;          /* S ref of objects */
+      char       *vgname;       /* S name of this vgroup */
+      char       *vgclass;      /* S class name of this vgroup */
+      intn        marked;       /* =1 if new info has been added to vgroup */
+      intn        new_vg;       /* =1 if this is a new Vgroup */
+      uint16      extag, exref; /* expansion tag-ref */
+      intn        msize;        /* max size of storage arrays */
+      uint32      flags;        /* indicate which version of VG should
+                                   be written to the file */
+      int32       nattrs;       /* number of attributes */
+      vg_attr_t  *alist;        /* index of new-style attributes, by Vsetattr */
+      int32       noldattrs;    /* number of old-style attributes */
+      vg_attr_t  *old_alist;    /* refs of attributes - only used in memory to
+				prevent repeated code in making the list; see
+				Voldnattrs's header for details -BMR 2/4/2011 */
+      vg_attr_t  *all_alist;    /* combined list; previous approach, only keep
+				just in case we come back to that approach; will
+				remove it once we decide not to go back 2/16/11 */
+      int16       version, more; /* version and "more" field */
+      struct vgroup_desc *next; /* pointer to next node (for free list only) */
+  };
+/* VGROUP */
+
+/*
+ *  -----------------------------------------------
+ *         V D A T A      definition
+ *  -----------------------------------------------
+ */
+
+struct vdata_desc
+  {
+      uint16      otag, oref;   /* tag,ref of this vdata */
+      HFILEID     f;            /* HDF file id */
+      intn        access;       /* 'r' or 'w' */
+      char        vsname[VSNAMELENMAX + 1];     /* S name of this vdata */
+      char        vsclass[VSNAMELENMAX + 1];    /* S class name of this vdata */
+      int16       interlace;    /* S  interlace as in file */
+      int32       nvertices;    /* S  #vertices in this vdata */
+      DYN_VWRITELIST  wlist;
+      DYN_VREADLIST   rlist;
+      int16       nusym;
+      SYMDEF      *usym;
+      intn        marked;       /* =1 if new info has been added to vdata */
+      intn        new_h_sz;     /* =1 if VH size changed, due to new attrs etc. */
+      intn        islinked;     /* =1 if vdata is a linked-block in file */
+
+      uint16      extag, exref; /* expansion tag-ref */
+      uint32      flags;     /* bit 0 -- has attr
+                                bit 1 -- "large field"
+                                bit 2 -- "interlaced data is appendable"
+                                bit 3-15  -- unused.   */
+      intn        nattrs;
+      vs_attr_t   *alist;    /* attribute list */
+      int16       version, more;    /* version and "more" field */
+      int32       aid;          /* access id - for LINKED blocks */
+      struct vs_instance_struct *instance;  /* ptr to the intance struct for this VData */
+      struct vdata_desc *next;  /* pointer to next node (for free list only) */
+  };                            /* VDATA */
+
+/* .................................................................. */
+/* Private data structures. Unlikely to be of interest to applications */
+/*
+   * These are just typedefs. Actual vfile_ts are declared PRIVATE and
+   * are not accessible by applications. However, you may change VFILEMAX
+   * to allow however many files to be opened.
+   *
+   * These are memory-resident copies of the tag-refs of the vgroups
+   * and vdatas for each file that is opened.
+   *
+ */
+
+/* this is a memory copy of a vg tag/ref found in the file */
+typedef struct vg_instance_struct
+  {
+      int32       key;          /* key to look up with the B-tree routines */
+      /* needs to be first in the structure */
+      uintn       ref;          /* ref # of this vgroup in the file */
+      /* needs to be second in the structure */
+      intn        nattach;      /* # of current attachs to this vgroup */
+      int32       nentries;     /* # of entries in that vgroup initially */
+      VGROUP     *vg;           /* points to the vg when it is attached */
+      struct vg_instance_struct *next;  /* pointer to next node (for free list only) */
+  }
+vginstance_t;
+
+/* this is a memory copy of a vs tag/ref found in the file */
+typedef struct vs_instance_struct
+  {
+      int32       key;          /* key to look up with the B-tree routines */
+      /* needs to be first in the structure */
+      uintn       ref;          /* ref # of this vdata in the file */
+      /* needs to be second in the structure */
+      intn        nattach;      /* # of current attachs to this vdata */
+      int32       nvertices;    /* # of elements in that vdata initially */
+      VDATA      *vs;           /* points to the vdata when it is attached */
+      struct vs_instance_struct *next;  /* pointer to next node (for free list only) */
+  }
+vsinstance_t;
+
+/* each vfile_t maintains 2 linked lists: one of vgs and one of vdatas
+ * that already exist or are just created for a given file.  */
+typedef struct vfiledir_struct
+  {
+      int32            f;       /* HDF File ID */
+
+      int32       vgtabn;       /* # of vg entries in vgtab so far */
+      TBBT_TREE  *vgtree;       /* Root of VGroup B-Tree */
+
+      int32       vstabn;       /* # of vs entries in vstab so far */
+      TBBT_TREE  *vstree;       /* Root of VSet B-Tree */
+      intn        access;       /* the number of active pointers to this file's Vstuff */
+  }
+vfile_t;
+
+/* .................................................................. */
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/*
+ * Library private routines for the VSet layer
+ */
+    VDATA *VSIget_vdata_node(void);
+
+    void VSIrelease_vdata_node(VDATA *v);
+
+    HDFLIBAPI vsinstance_t *VSIget_vsinstance_node(void);
+
+    HDFLIBAPI void VSIrelease_vsinstance_node(vsinstance_t *vs);
+
+    VGROUP *VIget_vgroup_node(void);
+
+    void VIrelease_vgroup_node(VGROUP *v);
+
+    HDFLIBAPI vginstance_t *VIget_vginstance_node(void);
+
+    HDFLIBAPI void VIrelease_vginstance_node(vginstance_t *vg);
+
+    HDFLIBAPI intn VPparse_shutdown(void);
+
+    HDFLIBAPI vfile_t *Get_vfile(HFILEID f);
+
+    HDFLIBAPI vsinstance_t *vsinst
+                (HFILEID f, uint16 vsid);
+
+    HDFLIBAPI vginstance_t *vginst
+            (HFILEID f, uint16 vgid);
+
+    HDFLIBAPI DYN_VWRITELIST *vswritelist
+                (int32 vskey);
+
+    HDFLIBAPI intn vpackvg
+                (VGROUP * vg, uint8 buf[], int32 * size);
+
+    HDFLIBAPI int32 vinsertpair
+                (VGROUP * vg, uint16 tag, uint16 ref);
+
+    HDFLIBAPI intn vpackvs
+                (VDATA * vs, uint8 buf[], int32 * size);
+
+    HDFLIBAPI VGROUP *VPgetinfo
+                (HFILEID f,uint16 ref);
+
+    HDFLIBAPI VDATA *VSPgetinfo
+                (HFILEID f,uint16 ref);
+
+    HDFLIBAPI int16 map_from_old_types
+                (intn type);
+
+    HDFLIBAPI void trimendblanks
+                (char *ss);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif                          /* c_plusplus || __cplusplus */
+
+#endif                          /* _VGINT_H */
diff --git a/hdf/src/vgp.c b/hdf/src/vgp.c
new file mode 100644
index 0000000..f96ca42
--- /dev/null
+++ b/hdf/src/vgp.c
@@ -0,0 +1,3656 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: vgp.c 5743 2012-01-11 16:27:15Z bmribler $ */
+/*****************************************************************************
+
+ file - vgp.c
+
+ Part of the Vset interface.
+ VGROUPs are handled by routines in here.
+
+
+LOCAL ROUTINES
+==============
+ VIget_vgroup_node -- allocate a new VGROUP record
+ VIrelease_vgroup_node -- Releases a vgroup node
+ VIget_vginstance_node -- allocate a new vginstance_t record
+ VIrelease_vginstance_node -- Releases a vginstance node
+ Get_vfile    -- get vgroup file record
+ New_vfile    -- create new vgroup file record
+ Load_vfile   -- loads vgtab table with info of all vgroups in file.
+ Remove_vfile -- removes the file ptr from the vfile[] table. 
+
+ VPgetinfo  --  Read in the "header" information about the Vgroup.
+ VIstart    --  V-level initialization routine
+ VPshutdown  --  Terminate various static buffers.
+
+EXPORTED ROUTINES
+=================
+ Following 4 routines are solely for B-tree routines.
+ vcompare     -- Compares two TBBT-tree keys for equality.  Similar to memcmp.
+ vprint       -- Prints out the key and reference number of VDatas and Vgroups
+ vdestroynode -- destroy vgroup node in TBBT
+ vfdestroynode  -- destroy vgroup file record node in TBBT
+ vtfreekey    -- Frees B-Tree index (actually doesn't anything at all)
+
+ Vinitialize  -- initialize Vxxx interface
+ Vfinish      -- end Vxxx access to file
+
+ vginstance   -- Looks thru vgtab for vgid and return the addr of the vg 
+                  instance where vgid is found. 
+ vexistvg     -- Tests if a vgroup with id "vgid" is in the file's vgtab.
+ vpackvg      -- Extracts fields from a VGROUP struct "vg" and packs the 
+                  fields into array buf in preparation for storage in the 
+                  HDF file.
+ vunpackvg    -- Unpacks the fields from a buf (ie a DFTAG_VG data object 
+                  just read in from the HDF file), into a VGROUP structure vg.
+
+ Vattach      -- Attaches to an existing vgroup or creates a new vgroup.
+ Vdetach      -- Detaches access to vg.    
+ Vinsert      -- Inserts a velt (vs or vg) into a vg 
+ Vflocate     -- Checks to see if the given field exists in a vdata 
+                  belonging to this vgroup.
+ Vinqtagref   -- Checks whether the given tag/ref pair already exists 
+                  in the vgroup.
+ Vntagrefs    -- Returns the number (0 or +ve integer) of tag/ref pairs 
+                  in a vgroup.
+ Vnrefs       --
+ Vgettagrefs  -- Returns n tag/ref pairs from the vgroup into the 
+                  caller-supplied arrays(tagrarray and refarray).
+ Vgettagref   -- Returns a specified tag/ref pair from the vgroup.
+ VQuerytag    -- Return the tag of this Vgroup.
+ VQueryref    -- Return the ref of this Vgroup.
+ Vaddtagref   -- Inserts a tag/ref pair into the attached vgroup vg.
+ vinsertpair  -- Inserts a tag/ref pair into the attached vgroup vg.
+ Ventries     -- Returns the num of entries (+ve integer) in the vgroup vgid.
+ Vsetname     -- Gives a name to the VGROUP vg.
+ Vsetclass    -- Assigns a class name to the VGROUP vg.
+ Visvg        -- Tests if the given entry in the vgroup vg is a VGROUP.
+ Visvs        -- Checks if an id in a vgroup refers to a VDATA.
+ Vgetid       -- Given a vgroup's id, returns the next vgroup's id in the file.
+ Vgetnext     -- Given the id of an entry from a vgroup vg, looks in vg 
+                  for the next entry after it, and returns its id.
+ Vgetnamelen  -- Retrieves the length of the vgroup's name.
+ Vgetclassnamelen  -- Retrieves the length of the vgroup's classname.
+ Vgetname     -- Returns the vgroup's name.
+ Vgetclass    -- Returns the vgroup's class name .
+ Vgetvgroups  -- Gets user-created vgroups in a file or in a vgroup
+ Vinquire     -- General inquiry routine for VGROUP. 
+ Vopen        -- This routine opens the HDF file and initializes it for 
+                  Vset operations.(i.e." Hopen(); Vinitialize(f)").
+ Vclose       -- This routine closes the HDF file, after it has freed 
+                  all memory and updated the file.
+                  (i.e." Vfinish(f); Hclose(f);").
+ Vdelete      -- Remove a Vgroup from its file.  This function will both 
+                  remove the Vgoup from the internal Vset data structures 
+                  as well as from the file.
+ Vdeletetagref - delete tag/ref pair in Vgroup
+
+ NOTE: Another pass needs to made through this file to update some of
+       the comments about certain sections of the code. -GV 9/8/97
+
+*************************************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+/* These are used to determine whether a vgroup had been created by the
+   library internally, that is, not created by user's application */
+#define HDF_NUM_INTERNAL_VGS        6
+const char *HDF_INTERNAL_VGS[] = {_HDF_VARIABLE, _HDF_DIMENSION,
+		 _HDF_UDIMENSION, _HDF_CDF, GR_NAME, RI_NAME};
+
+/* Prototypes */
+extern VOID vprint(VOIDP k1);
+
+PRIVATE intn Load_vfile
+            (HFILEID f);
+
+PRIVATE intn Remove_vfile
+            (HFILEID f);
+
+PRIVATE intn vunpackvg
+            (VGROUP * vg, uint8 buf[], intn len);
+
+PRIVATE intn VIstart(void);
+
+/*
+   * --------------------------------------------------------------------
+   * PRIVATE  data structure and routines.
+   *
+   * Info about all vgroups in the file are loaded into vgtab  at start;
+   * and the vg field set to NULL until that vgroup is attached,
+   * and reset back to NULL when that vgroup is detached.
+   * Info about all vdatas in the file are loaded into vstab  at start;
+   * and the vs field set to NULL until that vdata is attached,
+   * and reset back to NULL when that vdata is detached.
+   * --------------------------------------------------------------------
+ */
+
+TBBT_TREE *vtree = NULL;
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+/* Temporary buffer for I/O */
+PRIVATE uint32 Vgbufsize = 0;
+PRIVATE uint8  *Vgbuf = NULL;
+
+/* Pointers to the VGROUP & vginstance node free lists */
+static VGROUP       *vgroup_free_list     = NULL;
+static vginstance_t *vginstance_free_list = NULL;
+
+/*******************************************************************************
+ NAME
+    VIget_vgroup_node -- allocate a new VGROUP record
+
+ DESCRIPTION
+    Return a pointer to a new VGROUP to use for a new VGID.
+
+ RETURNS
+    returns VGROUP record pointer or NULL if failed.
+
+*******************************************************************************/
+VGROUP *
+VIget_vgroup_node(void)
+{
+    VGROUP   *ret_value = NULL;
+    CONSTR(FUNC, "VIget_vgroup_node");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Grab from free list if possible */
+    if(vgroup_free_list != NULL)
+      {
+        ret_value = vgroup_free_list;
+        vgroup_free_list = vgroup_free_list->next;
+      } /* end if */
+    else
+      {
+        if((ret_value = (VGROUP *)HDmalloc(sizeof(VGROUP))) == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end else */
+
+    /* Initialize to zeros */
+    HDmemset(ret_value,0,sizeof(VGROUP));
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* VIget_vgroup_node */
+
+/******************************************************************************
+ NAME
+   VIrelease_vgroup_node -- Releases a vgroup node
+
+ DESCRIPTION
+    Puts an VGROUP node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+void VIrelease_vgroup_node(VGROUP *vg)
+{
+#ifdef LATER
+    CONSTR(FUNC, "VIrelease_vgroup_node");	/* for HERROR */
+#endif /* LATER */
+
+    /* Insert the atom at the beginning of the free list */
+    vg->next         = vgroup_free_list;
+    vgroup_free_list = vg;
+
+}   /* end VIrelease_vgroup_node() */
+
+/******************************************************************************
+ NAME
+    VIget_vginstance_node -- allocate a new vginstance_t record
+
+ DESCRIPTION
+    Return an pointer to a new vginstance to use for a new VGID.
+
+ RETURNS
+    returns vginstance_t pointer or NULL if failed.
+*******************************************************************************/
+vginstance_t *
+VIget_vginstance_node(void)
+{
+    vginstance_t   *ret_value = NULL;
+    CONSTR(FUNC, "VIget_vginstance_node");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Grab from free list if possible */
+    if(vginstance_free_list != NULL)
+      {
+        ret_value = vginstance_free_list;
+        vginstance_free_list = vginstance_free_list->next;
+      } /* end if */
+    else
+      {
+        if((ret_value = (vginstance_t *)HDmalloc(sizeof(vginstance_t))) == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end else */
+
+    /* Initialize to zeros */
+    HDmemset(ret_value,0,sizeof(vginstance_t));
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* VIget_vginstance_node */
+
+/******************************************************************************
+ NAME
+    VIrelease_vginstance_node -- Releases a vginstance node
+
+ DESCRIPTION
+    Puts a vginstance node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+void 
+VIrelease_vginstance_node(vginstance_t *vg /* IN: vgroup instance to release */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "VIrelease_vginstance_node");	/* for HERROR */
+#endif /* LATER */
+
+    /* Insert the vsinstance at the beginning of the free list */
+    vg->next = vginstance_free_list;
+    vginstance_free_list = vg;
+
+}   /* end VIrelease_vginstance_node() */
+
+/*******************************************************************************
+NAME
+  Get_vfile  -- get vgroup file record
+
+DESCRIPTION
+   Looks in the TBBT vtree for the file ID of the file.
+
+RETURNS
+   Returns a pointer to the vfile_t for that file on success, otherwise NULL.
+
+*******************************************************************************/
+vfile_t *
+Get_vfile(HFILEID f /* IN: file handle */)
+{
+    VOIDP *t = NULL;       /* vfile_t pointer from tree */
+    int32 key = (int32)f;  /* initialize key to file handle */
+
+    /* find file record */
+    t = (VOIDP *) tbbtdfind(vtree, (VOIDP) &key, NULL);
+
+    return((vfile_t *)(t==NULL ? NULL : *t));
+} /* end Get_vfile() */
+
+        
+/*******************************************************************************
+NAME
+   New_vfile  -- create new vgroup file record
+
+DESCRIPTION
+   Creates vfile_t structure and adds it to the tree
+
+RETURNS
+   Returns a pointer to the vfile_t for that file on success, otherwise NULL.
+
+*******************************************************************************/
+PRIVATE vfile_t *
+New_vfile(HFILEID f /* IN: file handle */)
+{
+    vfile_t *v = NULL;
+    
+    /* Allocate the vfile_t structure */
+    if (NULL == (v = (vfile_t *) HDcalloc(1,sizeof(vfile_t))))
+      return(NULL);
+
+    /* Assign the file ID & insert into the tree */
+    v->f = f;
+
+    /* insert the vg instance in B-tree */
+    tbbtdins(vtree, (VOIDP) v, NULL);    
+
+    /* return vfile_t struct */
+    return(v); 
+} /* end New_vfile() */
+
+/*******************************************************************************
+NAME
+   Load_vfile -- loads vgtab table with info of all vgroups in file.
+
+DESCRIPTION
+   *** Only called by Vinitialize()  ***
+
+   loads vgtab table with info of all vgroups in file f.
+   Will allocate a new vfile_t, then proceed to load vg instances.
+
+RETURNS
+   RETURNS FAIL if error or no more file slots available.
+   RETURNS SUCCEED if ok.
+
+*******************************************************************************/
+PRIVATE intn
+Load_vfile(HFILEID f /* IN: file handle */)
+{
+    vfile_t      *vf = NULL;
+    vginstance_t *v = NULL;
+    vsinstance_t *w = NULL;
+    int32       aid;
+    int32       ret;
+    uint16      tag = DFTAG_NULL;
+    uint16      ref = DFTAG_NULL;
+    intn        ret_value = SUCCEED;
+    CONSTR(FUNC, "Load_vfile");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Check if vfile buffer has been allocated */
+    if (vtree == NULL)
+      {
+          vtree = tbbtdmake(vcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+          if (vtree == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* Initialize the atom groups for Vdatas and Vgroups */
+          if (HAinit_group(VSIDGROUP,VATOM_HASH_SIZE) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          if (HAinit_group(VGIDGROUP,VATOM_HASH_SIZE) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+      }
+
+    /* Grab the existing vfile_t structure first, otherwise create a new one */
+    if ((vf = Get_vfile(f)) == NULL)
+      {
+        if ((vf = New_vfile(f)) == NULL)
+            HGOTO_ERROR(DFE_FNF, FAIL);
+      }
+
+    /* the file is already loaded (opened twice) do nothing */
+    if (vf->access++)
+        HGOTO_DONE(SUCCEED);
+
+    /* load all the vg's  tag/refs from file */
+    vf->vgtabn = 0; /* intialize to number of current entries to zero */
+    vf->vgtree = tbbtdmake(vcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+    if (vf->vgtree == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    ret = aid = Hstartread(f, DFTAG_VG, DFREF_WILDCARD);
+    while (ret != FAIL)
+      {
+          /* get tag/ref for this vgroup */
+          HQuerytagref(aid, &tag, &ref);
+
+          /* get a vgroup struct to fill */
+          if (NULL == (v = VIget_vginstance_node()))
+            {
+                tbbtdfree(vf->vgtree, vdestroynode, NULL);
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          vf->vgtabn++; /* increment number of vgroups found in file */
+
+          v->key = (int32) ref;   /* set the key for the node */
+          v->ref = (uintn) ref;
+
+          /* get the header information */
+          v->vg = VPgetinfo(f,ref);  
+          if (v->vg == NULL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          /* insert the vg instance in B-tree */
+          tbbtdins(vf->vgtree, (VOIDP) v, NULL); 
+
+          /* get next vgroup */
+          ret = Hnextread(aid, DFTAG_VG, DFREF_WILDCARD, DF_CURRENT);
+      }
+
+    if (aid != FAIL)
+        Hendaccess(aid);
+
+    /* clear error stack - this is to remove the faux errors about DD not
+       found from when Hstartread is called on a new file */
+    HEclear();
+
+    /* load all the vs's  tag/refs from file */
+    vf->vstabn = 0;
+    vf->vstree = tbbtdmake(vcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+    if (vf->vstree == NULL)
+      {
+          tbbtdfree(vf->vgtree, vdestroynode, NULL);
+          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      }     /* end if */
+
+    ret = aid = Hstartread(f, VSDESCTAG, DFREF_WILDCARD);
+    while (ret != FAIL)
+      {
+          /* get tag/ref for this vdata */
+          HQuerytagref(aid, &tag, &ref);
+
+          /* attach new vs to file's vstab */
+          if (NULL == (w = VSIget_vsinstance_node()))
+            {
+                tbbtdfree(vf->vgtree, vdestroynode, NULL);
+                tbbtdfree(vf->vstree, vsdestroynode, NULL);
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          vf->vstabn++; /* increment number of vdatas found in file */
+
+          w->key = (int32) ref;   /* set the key for the node */
+          w->ref = (uintn)ref;
+
+          /* get the header information */
+          w->vs = VSPgetinfo(f,ref);  
+          if (w->vs == NULL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          w->nattach = 0;
+          w->nvertices = 0;
+
+          /* insert the vg instance in B-tree */
+          tbbtdins(vf->vstree, (VOIDP) w, NULL);    
+
+          /* get next vdata */
+          ret = Hnextread(aid, VSDESCTAG, DFREF_WILDCARD, DF_CURRENT);
+      }
+
+    if (aid != FAIL)
+        Hendaccess(aid);
+
+    /* clear error stack - this is to remove the faux errors about DD not
+       found from when Hstartread is called on a new file */
+    HEclear();
+
+    /* file may be incompatible with vset version 2.x. Need to check it */
+    if (((int32) 0 == vf->vgtabn) && ((int32) 0 == vf->vstabn))
+      {
+        if ((int32) 0 == vicheckcompat(f))
+          {     /* not compatible */
+#if 0
+              nvfile--;     /* delete the structure for that file */
+#endif
+              tbbtdfree(vf->vgtree, vdestroynode, NULL);
+              tbbtdfree(vf->vstree, vsdestroynode, NULL);
+              HGOTO_ERROR(DFE_BADOPEN, FAIL);
+          }
+      }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Load_vfile */
+
+/******************************************************************************
+NAME
+   Remove_vfile -- removes the file ptr from the vfile[] table. 
+
+DESCRIPTION
+   removes the file ptr from the vfile[] table.
+   *** Only called by Vfinish() ***
+
+RETURNS
+
+*******************************************************************************/
+PRIVATE intn
+Remove_vfile(HFILEID f /* IN: file handle */)
+{
+    VOIDP      *t  = NULL;
+    vfile_t    *vf = NULL;
+    intn       ret_value = SUCCEED;
+    CONSTR(FUNC, "Remove_vfile");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Check if vfile buffer has been allocated */
+    if (vtree == NULL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Figure out what file to work on */
+    if ((vf = Get_vfile(f)) == NULL)
+        HGOTO_ERROR(DFE_FNF, FAIL);
+
+    /* If someone still has an active pointer to this file 
+       we don't remove it. */
+    if (--vf->access)
+        HGOTO_DONE(SUCCEED);
+
+    /* clear out the tbbt's */
+    tbbtdfree(vf->vgtree, vdestroynode, NULL);
+    tbbtdfree(vf->vstree, vsdestroynode, NULL);
+
+    /* Find the node in the tree */
+    if (( t = (VOIDP *) tbbtdfind(vtree, (VOIDP) &f, NULL)) == NULL)
+        HGOTO_DONE(FAIL);
+
+    /* Delete the node and free the vfile_t stucture */
+    vf = tbbtrem((TBBT_NODE **) vtree, (TBBT_NODE *) t, NULL);
+    HDfree(vf);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Remove_vfile */
+
+/******************************************************************************
+NAME
+   vcompare  -- compare two TBBT keys for equality
+
+DESCRIPTION
+   Compares two B-tree keys for equality.  Similar to memcmp.
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+
+RETURNS
+
+*******************************************************************************/
+intn
+vcompare(VOIDP k1,   /* IN: first key to compare*/
+         VOIDP k2,   /* IN: second key to compare */
+         intn cmparg /* IN: not used */)
+{
+  /* shut compiler up */
+  cmparg = cmparg;
+
+  return (intn) ((*(int32 *)k1) - (*(int32 *)k2));    /* valid for integer keys */
+}   /* vcompare */
+
+/******************************************************************************
+NAME
+  vprint -- print key and reference number of vgroup/vdata node in TBBT
+
+DESCRIPTION
+   Prints out the key and reference number of VDatas and Vgroups
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+
+RETURNS
+
+*******************************************************************************/
+VOID
+vprint(VOIDP k1 /* IN: key to print */)
+{
+    printf("Ptr=%p, key=%d, ref=%d\n", 
+           k1, (int) ((vginstance_t *) k1)->key, (int) ((vginstance_t *) k1)->ref);
+}   /* vprint */
+
+/******************************************************************************
+NAME
+   vdestroynode -- destroy vgroup node in TBBT
+
+DESCRIPTION
+   Frees B-Tree nodes
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+
+RETURNS
+   Nothing
+
+*******************************************************************************/
+VOID
+vdestroynode(VOIDP n /* IN: node to free */)
+{
+    VGROUP     *vg = NULL;
+
+    if (n != NULL)
+      {
+          vg = ((vginstance_t *) n)->vg;
+          if (vg != NULL)
+            {
+                HDfree((VOIDP) vg->tag);
+                HDfree((VOIDP) vg->ref);
+
+                if (vg->vgname != NULL)
+                    HDfree((VOIDP) vg->vgname);
+
+                if (vg->vgclass != NULL)
+                    HDfree((VOIDP) vg->vgclass);
+
+                if (vg->alist != NULL)
+                    HDfree((VOIDP) vg->alist);
+
+		/* Free the old-style attr list and reset associated fields */
+                if (vg->old_alist != NULL)
+		{
+                    HDfree((VOIDP) vg->old_alist);
+		    vg->old_alist = NULL;
+		    vg->noldattrs = 0;
+		}
+
+                VIrelease_vgroup_node(vg);
+            }
+
+          VIrelease_vginstance_node((vginstance_t *)n);
+      } /* end if n */
+}   /* vdestroynode */
+
+/*******************************************************************************
+NAME
+   vfdestroynode  -- destroy vgroup file record node in TBBT
+
+DESCRIPTION
+   Frees B-Tree vfile_t nodes
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+
+RETURNS
+   Nothing
+
+*******************************************************************************/
+VOID
+vfdestroynode(VOIDP n /* IN: vfile_t record to free */)
+{
+    vfile_t      *vf = NULL;
+
+    if (n != NULL)
+      {
+          vf=(vfile_t *)n;
+
+          /* clear out the tbbt's */
+          tbbtdfree(vf->vgtree, vdestroynode, NULL);
+          tbbtdfree(vf->vstree, vsdestroynode, NULL);
+
+          HDfree(vf);
+      }
+}   /* vfdestroynode */
+
+#ifdef NOTNEEDED
+/* ---------------------------- vtfreekey ------------------------- */
+/*
+   Frees B-Tree index (actually doesn't anything at all)
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+ */
+VOID
+vtfreekey(VOIDP k)
+{
+    k = k;  /* i.e. do nothing */
+}   /* vtfreekey */
+#endif
+
+/*******************************************************************************
+NAME
+   Vinitialize  -- initialize Vxxx interface
+
+DESCRIPTION
+    Initialize Vxxx stuff/interface ?
+
+RETURNS
+    SUCCEED / FAIL
+
+*******************************************************************************/
+intn
+Vinitialize(HFILEID f /* IN: file handle */)
+{
+    intn   ret_value = SUCCEED;
+    CONSTR(FUNC, "Vinitialize");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+      {
+        if(VIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+      }
+
+    /* load Vxx stuff from file? */
+    if (Load_vfile(f) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* Vinitialize() */
+
+
+/*******************************************************************************
+NAME
+   Vfinish  -- end Vxxx access to file
+
+DESCRIPTION
+   End Vxxx acess to file?
+
+RETURNS
+   SUCCEED / FAIL
+
+*******************************************************************************/
+intn
+Vfinish(HFILEID f /* IN: file handle */)
+{
+  intn    ret_value = SUCCEED;
+  CONSTR(FUNC, "Vfinish");
+
+  /* clear error stack */
+  HEclear();
+
+  /* remove Vxxx file record ? */
+  if (Remove_vfile(f) == FAIL)
+      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* Vfinish() */
+
+/*******************************************************************************
+NAME
+   vginst
+
+DESCRIPTION
+   Looks thru vgtab for vgid and return the addr of the vg instance
+   where vgid is found.
+
+RETURNS
+   RETURNS NULL if error or not found.
+   RETURNS vginstance_t pointer if ok.
+   
+*******************************************************************************/
+vginstance_t *
+vginst(HFILEID f,   /* IN: file handle */
+       uint16 vgid  /* IN: vgroup id */)
+{
+    VOIDP        *t = NULL;
+    vfile_t      *vf = NULL;
+    vginstance_t *ret_value = NULL;
+    int32        key;
+    CONSTR(FUNC, "vginstance");
+
+    /* clear error stack */
+    HEclear();
+
+    /* get file Vxxx file record */
+    if (NULL == (vf = Get_vfile(f)))
+        HGOTO_ERROR(DFE_FNF, NULL);
+
+    /* tbbtdfind returns a pointer to the vginstance_t pointer */
+    key = (int32)vgid;
+    t = (VOIDP *) tbbtdfind(vf->vgtree, (VOIDP) &key, NULL);
+    if (t != NULL)
+      {
+        ret_value = ((vginstance_t *) * t);  /* return the actual vginstance_t ptr */
+        goto done;
+      }
+
+    /* we get here then we did find vgroup */
+    HGOTO_ERROR(DFE_NOMATCH, NULL);
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* vginst */
+
+/*******************************************************************************
+NAME
+   vexistvg
+
+DESCRIPTION
+   Tests if a vgroup with id vgid is in the file's vgtab.
+
+RETURNS
+   returns FAIL if not found,
+   returns TRUE if found.
+
+*******************************************************************************/
+int32
+vexistvg(HFILEID f,   /* IN: file handle */
+         uint16 vgid  /* IN: vgroup id */)
+{
+    int32   ret_value;
+#ifdef LATER
+    CONSTR(FUNC, "vexistvg");
+#endif
+
+    if (NULL == (vginstance_t *) vginst(f, vgid))
+        ret_value = (FAIL);
+    else
+        ret_value =  (TRUE);
+  
+  return ret_value;
+}   /* vexistvg */
+
+/* ==================================================================== */
+/*
+   * vpackvg() and vunpackvg() : Packing and unpacking routines.
+   * For use in retrieving and storing vgroups to/from the HDF file.
+   *
+   *    Fields of VGROUP  that gets stored in HDF as a DFTAG_VG data object:
+   *            int16           nvelt (no of entries )
+   *            char*           vgname
+   *            char*           vgclass
+   *            int16           tag[1..nvelt]
+   *            int16           ref[1..nvelt]
+   *    (fields for version 4) 
+   *            uint32   flags
+   *    (if bit0 of flags is set, the vg has attributes )
+   *            int32    nattrs
+   *            vg_attr_t alist[1..nattrs]
+ */
+/* ==================================================================== */
+
+/*******************************************************************************
+NAME
+   vpackvg
+
+DESCRIPTION
+   Extracts fields from a VGROUP struct vg and packs the fields
+   into array buf in preparation for storage in the HDF file.
+
+RETRUNS   
+   NO RETURN VALUES.
+
+*******************************************************************************/
+intn
+vpackvg(VGROUP * vg, /* IN: */
+        uint8 buf[], /* IN/OUT: */
+        int32 *size  /* IN/OUT: */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "vpackvg");
+#endif
+    uintn  i;
+    size_t slen = 0;
+    uint16 temp_len = 0;
+    uint8 *bb = NULL;
+    int32 ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    bb = &buf[0];
+
+    /* save nvelt */
+    UINT16ENCODE(bb, vg->nvelt);
+
+    /* save all tags */
+    for (i = 0; i < (uintn)vg->nvelt; i++)
+        UINT16ENCODE(bb, vg->tag[i]);
+
+    /* save all refs */
+    for (i = 0; i < (uintn)vg->nvelt; i++)
+        UINT16ENCODE(bb, vg->ref[i]);
+
+    /* save the vgnamelen and vgname - omit the null */
+    if (vg->vgname != NULL)
+        slen = HDstrlen(vg->vgname);
+    temp_len = slen > 0 ? slen : 0;
+    UINT16ENCODE(bb, temp_len);
+
+    if (vg->vgname != NULL)
+        HDstrcpy((char *) bb, vg->vgname);
+    bb += temp_len;
+
+    /* save the vgclasslen and vgclass- omit the null */
+    slen = 0;
+    if (vg->vgclass != NULL)
+        slen = HDstrlen(vg->vgclass);
+    temp_len = slen > 0 ? slen : 0;
+    UINT16ENCODE(bb, temp_len);
+
+    if (vg->vgclass != NULL)
+        HDstrcpy((char *) bb, vg->vgclass);
+    bb += temp_len;
+
+    /* save the expansion tag/ref pair */
+    UINT16ENCODE(bb, vg->extag);    /* the vg's expansion tag */
+    UINT16ENCODE(bb, vg->exref);    /* the vg's expansion ref */
+
+    if (vg->flags)  
+      {   /* save the flag and update version num */
+          if (vg->version < VSET_NEW_VERSION)   
+              vg->version = VSET_NEW_VERSION;
+
+          UINT32ENCODE(bb, vg->flags);
+
+          if (vg->flags & VG_ATTR_SET)  
+            {   /* save the attrs */
+                INT32ENCODE(bb, vg->nattrs);
+
+                for (i=0; i<(uintn)vg->nattrs; i++)  
+                  {
+                      UINT16ENCODE(bb, vg->alist[i].atag);
+                      UINT16ENCODE(bb, vg->alist[i].aref);
+                  }
+            }
+      }
+       
+    /*  save the vg's version field */
+    UINT16ENCODE(bb, vg->version);
+
+    /* save the vg's more field */
+    UINT16ENCODE(bb, vg->more);
+
+    /* returns the size of total fields saved */
+    *size = (int32) (bb - buf) + 1;     
+    *bb = 0;       /* NOTE: the '+1' part shouldn't be there */
+    /* but since files have been created with */
+    /* it there (and the size calc. wrong) it */
+    /* has to be left alone -QAK */
+
+#ifdef LATER
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+#endif /* LATER */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* vpackvg */
+
+/*******************************************************************************
+NAME
+   vunpackvg:
+
+DESCRIPTION
+   Unpacks the fields from a buf (ie a DFTAG_VG data object just
+   read in from the HDF file), into a VGROUP structure vg.
+   Will first zero out vg, unpack fields, then inits as much of
+   vg as it can.
+
+RETURNS   
+   NO RETURN VALUES
+
+*******************************************************************************/
+PRIVATE intn
+vunpackvg(VGROUP * vg, /* IN/OUT: */
+          uint8 buf[], /* IN: */ 
+          intn len     /* IN: */)
+{
+    uint8 *bb = NULL;
+    uintn u;
+    uint16 uint16var;
+    intn i;
+    int32 ret_value = SUCCEED;
+    CONSTR(FUNC, "vunpackvg");
+
+    /* clear error stack */
+    HEclear();
+
+    /* '5' is a magic number, the exact amount of space for 2 uint16's */
+    /* the magic number _should_ be '4', but the size of the Vgroup */
+    /* information is incorrectly calculated (in vpackvg() above) when the */
+    /* info is written to the file and it's too late to change it now :-( */
+    bb = &buf[len - 5];
+
+    UINT16DECODE(bb, uint16var);  /* retrieve the vg's version field */
+    vg->version=(int16)uint16var;
+
+    UINT16DECODE(bb, uint16var);     /* retrieve the vg's more field */
+    vg->more=(int16)uint16var;
+
+    bb = &buf[0];
+
+    /* retrieve nvelt */
+    if (vg->version <= 4)
+      {     /* current Vset version number */
+          UINT16DECODE(bb, vg->nvelt);
+
+          vg->msize = ((uintn)vg->nvelt > (uintn)MAXNVELT ? vg->nvelt : MAXNVELT);
+          vg->tag = (uint16 *) HDmalloc(vg->msize * sizeof(uint16));
+          vg->ref = (uint16 *) HDmalloc(vg->msize * sizeof(uint16));
+    
+          if ((vg->tag == NULL) || (vg->ref == NULL))
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* retrieve the tags */
+          for (u = 0; u < (uintn)vg->nvelt; u++)
+              UINT16DECODE(bb, vg->tag[u]);
+
+          /* retrieve the refs */
+          for (u = 0; u < (uintn)vg->nvelt; u++)
+              UINT16DECODE(bb, vg->ref[u]);
+
+          /* retrieve vgname (and its len)  */
+          UINT16DECODE(bb, uint16var);
+	  if (uint16var == 0)
+	      vg->vgname = NULL;
+	  else
+	  {
+	      vg->vgname = (char *)HDmalloc(uint16var+1);
+              HIstrncpy(vg->vgname, (char *) bb, (intn) uint16var + 1);
+              bb += (size_t)uint16var;
+	  }
+
+          /* retrieve vgclass (and its len)  */
+          UINT16DECODE(bb, uint16var);
+	  if (uint16var == 0)
+	      vg->vgclass = NULL;
+	  else
+	  {
+	      vg->vgclass = (char *)HDmalloc(uint16var+1);
+              HIstrncpy(vg->vgclass, (char *) bb, (intn) uint16var + 1);
+              bb += (size_t)uint16var;
+	  }
+
+          UINT16DECODE(bb, vg->extag);  /* retrieve the vg's expansion tag */
+          UINT16DECODE(bb, vg->exref);  /* retrieve the vg's expansion ref */
+
+          if (vg->version == VSET_NEW_VERSION) 
+            {
+                UINT32DECODE(bb, vg->flags);  /* retrieve new features in
+                                               version 4, or higher */
+                if (vg->flags & VG_ATTR_SET)   
+                  {   /* the vg has attrs */
+                      INT32DECODE(bb, vg->nattrs); 
+
+                      if (NULL == (vg->alist = HDmalloc(vg->nattrs * sizeof(vg_attr_t))))
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                      for (i = 0; i < vg->nattrs; i++) 
+                        {
+                            UINT16DECODE(bb, vg->alist[i].atag);
+                            UINT16DECODE(bb, vg->alist[i].aref);
+                        } /* for */
+                  }  /* attributes set */
+            }  /* new version */
+      }     /* end if */
+done: 
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+
+}   /* vunpackvg */
+
+/*******************************************************************************
+ NAME
+    VPgetinfo  --  Read in the "header" information about the Vgroup.
+
+ DESCRIPTION
+    This routine pre-reads the header information for a Vgroup into memory
+    so that it can be accessed more quickly by the routines that need it.
+
+ RETURNS
+    Return a pointer to a VGROUP filled with the Vgroup information on success,
+    NULL on failure.
+*******************************************************************************/
+VGROUP *
+VPgetinfo(HFILEID f,  /* IN: file handle */
+          uint16 ref  /* IN: ref of vgroup */)
+{
+    VGROUP         *vg = NULL;
+/*  intn          len;    intn mismatches Vgbufsize type -- uint32 */
+    size_t          len;
+    VGROUP *ret_value = NULL; /* FAIL */
+    CONSTR(FUNC, "VPgetinfo");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Find out how long the VGroup information is */
+    if (( len = Hlength(f, DFTAG_VG, (uint16) ref)) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL,NULL);
+ 
+    if(len > Vgbufsize)
+      {
+        Vgbufsize = len;
+
+        if (Vgbuf)
+            HDfree((VOIDP) Vgbuf);
+
+        if ((Vgbuf = (uint8 *) HDmalloc(Vgbufsize)) == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end if */
+
+    /* Get the raw Vgroup info */
+    if (Hgetelement(f, DFTAG_VG, (uint16)ref, Vgbuf) == (int32)FAIL) 
+        HGOTO_ERROR(DFE_NOMATCH,NULL);
+       
+    /* allocate space for vg */
+    if (NULL == (vg =VIget_vgroup_node()))
+        HGOTO_ERROR(DFE_NOSPACE,NULL);
+       
+    /* unpack vgpack into structure vg, and init  */
+    vg->f             = f;
+    vg->oref          = ref;
+    vg->otag          = DFTAG_VG;
+    if (FAIL == vunpackvg(vg,Vgbuf,len))
+         HGOTO_ERROR(DFE_INTERNAL, NULL);
+
+    /* return vgroup */
+    ret_value = vg;
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end VPgetinfo */
+
+/*******************************************************************************
+NAME
+  Vattach:
+
+DESCRIPTION
+   attaches to an existing vgroup or creates a new vgroup.
+   returns NULL if  error, else ptr to vgroup.
+
+   IGNORE accesstype. (but save it)
+
+   if vgid == -1,
+     create a NEW vg if vgdir is not full.
+     Also set nattach =1, nentries=0.
+   if vgid +ve,
+        look in vgdir to see if already attached,
+         if yes, incr nattach
+         if not, fetch from file. attach, set nattach=1, netries= val from file
+   
+       In any case, set marked flag to 0.
+
+RETRUNS
+     SUCCEED/FAIL
+
+*******************************************************************************/
+int32
+Vattach(HFILEID f,             /* IN: file handle */
+        int32 vgid,            /* IN: vgroup id */
+        const char *accesstype /* IN: access type */)
+{
+    VGROUP     *vg = NULL;
+    vginstance_t *v = NULL;
+    vfile_t    *vf = NULL;
+    filerec_t  *file_rec = NULL;       /* file record */
+    int16       acc_mode;
+    atom_t      ret_value = FAIL;
+    CONSTR(FUNC, "Vattach");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check file id */
+    if (f == FAIL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get Vxxx file record */
+    if ((vf = Get_vfile(f))==NULL)
+        HGOTO_ERROR(DFE_FNF, FAIL);
+
+    /* check access type to vgroup */
+    if (accesstype[0] == 'R' || accesstype[0]=='r')
+        acc_mode = 'r';
+    else if (accesstype[0] == 'W' || accesstype[0]=='w')
+        acc_mode = 'w';
+    else
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    /* convert file id to file record and check for write-permission */
+    file_rec = HAatom_object(f);
+    if((file_rec==NULL || acc_mode=='w') && !(file_rec->access&DFACC_WRITE))
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    if (vgid == -1)
+      {
+          /******* create a NEW vg in vgdir ******/
+          if (acc_mode == 'r')
+              HGOTO_ERROR(DFE_ARGS, FAIL);
+
+          /* allocate space for vg, & zero it out */
+          if ((vg = VIget_vgroup_node()) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          /* initialize new vg */
+          vg->msize = MAXNVELT;
+          vg->tag = (uint16 *) HDmalloc(vg->msize * sizeof(uint16));
+          vg->ref = (uint16 *) HDmalloc(vg->msize * sizeof(uint16));
+
+	  vg->vgname = NULL;
+	  vg->vgclass = NULL;
+
+          if ((vg->tag == NULL) || (vg->ref == NULL))
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          vg->f = f;
+          vg->otag = DFTAG_VG;
+          vg->oref = Hnewref(f);    /* create a new unique ref for it */
+          if (vg->oref == 0)
+              HGOTO_ERROR(DFE_NOREF, FAIL);
+
+          vg->access = (intn)acc_mode;
+
+          vg->marked = 1;
+
+	  /* number of old-style attributes and list of their refs, these
+	     are only used when Vnoldattrs is invoked; see Vnoldattrs func
+	     header for info. 2/4/2011 -BMR */
+          vg->old_alist = NULL;
+          vg->noldattrs = 0;
+
+          vg->new_vg = 1;
+          vg->version = VSET_VERSION;
+
+          /* attach new vg to file's vgtab  */
+          if (NULL == (v = VIget_vginstance_node()))
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          vf->vgtabn++;
+          v->key = (int32) vg->oref;  /* set the key for the node */
+          v->ref = (uintn)vg->oref;
+          v->vg = vg;
+          v->nattach = 1;
+          tbbtdins(vf->vgtree, (VOIDP) v, NULL);    /* insert the vg instance in B-tree */
+
+          ret_value=HAregister_atom(VGIDGROUP,v);
+      }
+    else
+      {
+          /******* access an EXISTING vg *********/
+          if (NULL == (v = vginst(f, (uint16) vgid)))
+              HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+          /* vg already attached.  inc nattach and return existing ptr */
+          if (v->nattach > 0)
+            {
+                v->vg->access = MAX(v->vg->access, acc_mode);
+                v->nattach++;
+            }
+          else
+            {
+              vg=v->vg;
+              vg->access = (intn)acc_mode;
+              vg->marked = 0;
+
+	      /* number of old-style attributes and list of their refs, these
+		 are only used when Vnoldattrs is invoked; see Vnoldattrs func
+		 header for info. 2/4/2011 -BMR */
+              vg->old_alist = NULL;
+              vg->noldattrs = 0;
+
+              /* attach vg to file's vgtab at the vg instance v */
+              v->nattach = 1;
+              v->nentries = (int32)vg->nvelt;
+            } /* end else */
+
+          ret_value=HAregister_atom(VGIDGROUP,v);
+      }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vattach */
+
+/*******************************************************************************
+NAME
+   Vdetach
+
+DESCRIPTION
+   Detaches access to vg.
+   
+     if marked flag is 1, write out vg to file.
+       if vg still has velts attached to it, cannot detach vg.
+       decr  nattach. if (nattach is 0), free vg from vg instance.
+       (check that no velts are still attached to vg before freeing)
+   
+     if attached with read access, just return.
+   
+    after detach, set marked flag to 0.
+
+RETURNS
+   SUCCEED / FAIL
+
+*******************************************************************************/
+int32
+Vdetach(int32 vkey /* IN: vgroup key */)
+{
+    VGROUP       *vg = NULL;
+    vginstance_t *v = NULL;
+    int32       vgpacksize;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Vdetach");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *)HAremove_atom(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check it */
+    vg = v->vg;
+    if ((vg == NULL) || (vg->otag != DFTAG_VG))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Now, only update the Vgroup if it has actually changed. */
+    /* Since only Vgroups with write-access are allowed to change, there is */
+    /* no reason to check for access... (I hope) -QAK */
+    if (vg->marked == 1)
+      {
+          size_t need, vgnamelen=0, vgclasslen=0;
+	  if (vg->vgname != NULL)
+	      vgnamelen = strlen(vg->vgname);
+
+	  if (vg->vgclass != NULL)
+	      vgclasslen = strlen(vg->vgclass);
+
+          need = sizeof(VGROUP)
+		+ vgnamelen	/* vgname dynamic, vpackvg omits null */
+		+ vgclasslen	/* vgclass dynamic, vpackvg omits null */
+		+ (size_t)vg->nvelt*4 + (size_t)vg->nattrs*sizeof(vg_attr_t) + 1;
+          if(need > Vgbufsize)
+            {
+                Vgbufsize = need;
+
+                if (Vgbuf)
+                    HDfree((VOIDP) Vgbuf);
+
+                if ((Vgbuf = (uint8 *) HDmalloc(Vgbufsize)) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            } /* end if */
+
+          if (FAIL == vpackvg(vg, Vgbuf, &vgpacksize))
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          /*
+           *  If vgroup alreay exists, try to re-use the same
+           *  tag/ref. This will cause the pointer to the original
+           *  vgroup to be lost but this is okay.
+           */
+          if(!vg->new_vg)
+            {
+                /* check if tag/ref exists in DD list already */
+                switch(HDcheck_tagref(vg->f, DFTAG_VG, vg->oref))
+                  {
+                  case 0: /* not found */
+                      break;
+                  case 1: /* found, reuse tag/ref */
+                      if (HDreuse_tagref(vg->f, DFTAG_VG, vg->oref) == FAIL)
+                          HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                      break;
+                  case -1: /* error */
+                      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                  default: /* should never get here */
+                      HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                  } 
+            }
+
+          /* write out vgroup */
+          if (Hputelement(vg->f, DFTAG_VG, vg->oref, Vgbuf, vgpacksize) == FAIL)
+              HERROR(DFE_WRITEERROR);
+
+          vg->marked = 0;
+          vg->new_vg = 0;
+      }
+
+    /* Free the old-style attribute list and reset associated fields */
+    if (vg->old_alist != NULL)
+    {
+	HDfree((VOIDP) vg->old_alist);
+	vg->old_alist = NULL;
+	vg->noldattrs = 0;
+    }
+
+    v->nattach--;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vdetach */
+
+/*******************************************************************************
+NAME
+   Vinsert
+
+DESCRIPTION
+   inserts a velt (vs or vg)  into a vg
+   
+   checks and prevents duplicate links.
+
+   Since multiple files are now possible, check that both vg and velt
+   are from the same file. else error.
+
+RETURNS
+    RETURNS entry position within vg (0 or +ve) or FAIL on error.
+
+*******************************************************************************/
+int32
+Vinsert(int32 vkey,      /* IN: vgroup key */
+        int32 insertkey  /* IN: */)
+{
+    VGROUP       *vg = NULL;
+    vginstance_t *v = NULL;
+    uint16      newtag = 0;
+    uint16      newref = 0;
+    int32       newfid;
+    uintn       u;
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "Vinsert");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check to see if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check it */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* check write access */
+    if (vg->otag != DFTAG_VG || vg->access != 'w')
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    newfid = FAIL;
+    if (HAatom_group(insertkey) == VSIDGROUP)
+      {   /* locate vs's index in vstab */
+        vsinstance_t *w;
+
+        if (NULL == (w = (vsinstance_t *) HAatom_object(insertkey)))
+            HGOTO_ERROR(DFE_NOVS, FAIL);
+
+        if (w->vs == NULL)
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+
+        newtag = DFTAG_VH;
+        newref = w->vs->oref;
+        newfid = w->vs->f;
+      }
+    else
+      {
+        vginstance_t *x;
+
+        if (HAatom_group(insertkey) == VGIDGROUP)
+          {   /* locate vs's index in vgtab */
+            if (NULL == (x = (vginstance_t *) HAatom_object(insertkey)))
+                HGOTO_ERROR(DFE_NOVS, FAIL);
+
+            if (x->vg == NULL)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            newtag = DFTAG_VG;
+            newref = x->vg->oref;
+            newfid = x->vg->f;
+          }
+      }
+
+    /* make sure we found something */
+    if (newfid == FAIL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (vg->f != newfid)
+        HGOTO_ERROR(DFE_DIFFFILES, FAIL);
+
+    /* check and prevent duplicate links */
+    for (u = 0; u < (uintn)vg->nvelt; u++)
+      {
+        if ((vg->ref[u] == newref) && (vg->tag[u] == newtag))
+            HGOTO_ERROR(DFE_DUPDD, FAIL);
+      }
+
+    /* Finally, ok to insert */
+    if (vinsertpair(vg, newtag, newref) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    ret_value = (vg->nvelt - 1);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vinsert */
+
+/*******************************************************************************
+NAME
+  Vflocate
+
+DESCRIPTION
+   Checks to see if the given field exists in a vdata belonging to this vgroup.
+
+   28-MAR-91 Jason Ng NCSA
+
+RETURNS
+   If found, returns the ref of the vdata.
+   If not found, or error, returns FAIL
+
+*******************************************************************************/
+int32
+Vflocate(int32 vkey,  /* IN: vdata key */
+         char *field  /* IN: field to locate */)
+{
+    uintn u;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32       vskey;
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "Vflocate");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    for (u = 0; u < (uintn)vg->nvelt; u++)
+      {
+          intn       s;
+
+          if (vg->tag[u] != VSDESCTAG)
+              continue;
+
+          vskey = VSattach(vg->f, (int32)vg->ref[u], "r");
+          if (vskey == FAIL)
+              HGOTO_DONE(FAIL);
+
+          s = VSfexist(vskey, field);
+
+          if (VSdetach(vskey) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          if (s == 1)
+              HGOTO_DONE((int32)vg->ref[u]);  /* found. return vdata's ref */
+      }
+
+    ret_value = (FAIL);  /* field not found */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vflocate */
+
+/*******************************************************************************
+NAME
+   Vinqtagref
+
+DESCRIPTION
+    Checks whether the given tag/ref pair already exists in the vgroup.
+    28-MAR-91 Jason Ng NCSA
+
+RETURNS
+    RETURNS TRUE if exist
+    RETURNS FALSE if not.
+
+*******************************************************************************/
+intn
+Vinqtagref(int32 vkey, /* IN: vgroup key */ 
+           int32 tag,  /* IN: tag to check in vgroup */
+           int32 ref   /* IN: ref to check in vgroup */) 
+{
+    uintn u;
+    uint16 ttag;
+    uint16 rref;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    intn       ret_value = FALSE;
+    CONSTR(FUNC, "Vinqtagref");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FALSE);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FALSE);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FALSE);
+
+    ttag = (uint16) tag;
+    rref = (uint16) ref;
+
+    for (u = 0; u < (uintn)vg->nvelt; u++)
+      {
+        if ((ttag == vg->tag[u]) && (rref == vg->ref[u]))
+          HGOTO_DONE(TRUE);
+      }
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vinqtagref */
+
+/*******************************************************************************
+ NAME
+   Vdeletetagref - delete tag/ref pair in Vgroup
+
+ DESCRIPTION
+    Deletes the given tag/ref pair from the Vgroup.  If the given tag/ref pair 
+    does not exist in the vgroup the routine will return FAIL. Users should use 
+    Vinqtagref() to check if the tag/ref pair exists before deleting.
+
+ RETURNS
+    Returns SUCCEED if the tag/ref pair is deleted from Vgroup and
+    FAIL if unsuccessful.
+
+ Author -GeorgeV 10/10/97
+*******************************************************************************/
+intn
+Vdeletetagref(int32 vkey, /* IN: vgroup key */ 
+              int32 tag,  /* IN: tag to delete in vgroup */
+              int32 ref   /* IN: ref to delete in vgroup */) 
+{
+    uintn         i,j;       /* loop indices */
+    uint16        ttag;      /* tag for comparison */
+    uint16        rref;      /* ref for comparison */
+    vginstance_t *v  = NULL; /* vgroup instance struct */
+    VGROUP       *vg = NULL; /* in-memory vgroup struct */
+    intn          ret_value = SUCCEED;
+    CONSTR(FUNC, "Vdeletetagref");
+
+   /* NOTE: Move the following comments to the DESCRIPTION of the
+            fcn when the issue with duplicate tag/refs is decided.
+
+    If duplicate tag/ref pairs exist, then it deletes the first occurence.
+    If the case of duplicate tag/ref pairs the user can call Vinqtagref() 
+    to see if there are more occurences and then delete them. */
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* set comparsion tag/ref pair */
+    ttag = (uint16) tag;
+    rref = (uint16) ref;
+
+    /* look through elements in vgroup */
+    for (i = 0; i < (uintn)vg->nvelt; i++)
+      { /* see if element tag/ref matches search tag/ref */
+          if ((ttag == vg->tag[i]) && (rref == vg->ref[i]))
+            { /* found tag/ref pair to delete. 
+                 If duplicate tag/ref pairs exist, then it deletes 
+                 the first occurence. If the case of duplicate tag/ref 
+                 pairs the user can call Vinqtagref() to see if there 
+                 are more occurences and then delete them.*/
+
+                /* check if element found is last one in vgroup */
+                if ( i != ((uintn)vg->nvelt - 1))
+                  { /* Basically shifts the contents of the array down by one. 
+                       This method will preserve the order without using
+                       extra memory for storage etc. If speed/performance
+                       is an issue you can use memove()/memcpy(). */
+                      for (j = i; j < (uintn)vg->nvelt - 1; j++)
+                        {
+                            vg->tag[j] = vg->tag[j+1];
+                            vg->ref[j] = vg->ref[j+1];
+                        }
+#if 0
+                      /* This method is quick but does not preserve the
+                         order of elements in a vgroup.
+                         swap i'th element with last one. */
+                      vg->tag[i] = vg->tag[(uintn)vg->nvelt - 1];
+                      vg->ref[i] = vg->ref[(uintn)vg->nvelt - 1];
+#endif
+
+                  }
+                /* else if last one , do nothing and allow the 
+                   number of elements to be decrementd. */
+
+                /* reset last ones, just to be sure  */
+                vg->tag[(uintn)vg->nvelt - 1] = DFTAG_NULL;
+                vg->ref[(uintn)vg->nvelt - 1] = 0; /* invalid ref */
+
+                vg->nvelt--; /* decrement number of elements in vgroup */
+                vg->marked = TRUE; /* mark vgroup as changed. 
+                                      forces re-writing of new vgroup. */
+                ret_value = SUCCEED;
+                goto done; /* we are done */
+            } /* if found */
+      } /* for all items in vgroup */
+
+    /* reaching here means tag/ref pair not found. The user
+       should have used Vinqtagref() before calling this fcn. 
+       Oh well...*/
+    ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vdeletetagref */
+
+/*******************************************************************************
+NAME
+   Vntagrefs
+
+DESCRIPTION
+    Returns the number (0 or +ve integer) of tag/ref pairs in a vgroup.
+    If error, returns FAIL
+    28-MAR-91 Jason Ng NCSA.
+
+RETURNS
+
+*******************************************************************************/
+int32
+Vntagrefs(int32 vkey /* IN: vgroup key */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Vntagrefs");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    ret_value = ((vg->otag == DFTAG_VG) ? (int32) vg->nvelt : FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vntagrefs */
+
+/*******************************************************************************
+NAME
+   Vnrefs
+
+DESCRIPTION
+   Returns the number (0 or +ve integer) of tags of a given type in a vgroup.
+   If error, returns FAIL
+   05-NOV-94 Quincey Koziol.
+
+RETURNS
+
+*******************************************************************************/
+int32
+Vnrefs(int32 vkey, /* IN: vgroup key */
+       int32 tag   /* IN: tag to find refs for */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    uint16 ttag = (uint16)tag;    /* alias for faster comparison */
+    uintn u;                    /* local counting variable */
+    int32     ret_value = 0;   /* zero refs to start */
+    CONSTR(FUNC, "Vnrefs");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check it */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    for (u = 0; u < (uintn)vg->nvelt; u++)
+      {
+        if (ttag == vg->tag[u])
+            ret_value++;
+      }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vnrefs */
+
+/*******************************************************************************
+NAME
+   Vgettagrefs
+
+DESCRIPTION
+    Returns n tag/ref pairs from the vgroup into the caller-supplied arrays
+    tagrarray and refarray.
+    n can be any +ve number, but arrays must be this big.
+    28-MAR-91 Jason Ng NCSA.
+   
+    NOTE: Do not confuse with Vgettagref().
+
+RETURNS
+    The total number of (0 or +ve #)  tag/ref pairs returned.
+   
+*******************************************************************************/
+int32
+Vgettagrefs(int32 vkey,       /* IN: vgroup key */
+            int32 tagarray[], /* IN/OUT: tag array to fill */
+            int32 refarray[], /* IN/OUT: ref array to fill */
+            int32 n           /* IN: number of pairs to return */)
+{
+    int32       i;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgettagrefs");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    if (n > (int32) vg->nvelt)
+        n = (int32)vg->nvelt;
+
+    for (i = 0; i < n; i++)
+      {
+          tagarray[i] = (int32) vg->tag[i];
+          refarray[i] = (int32) vg->ref[i];
+      }
+
+    ret_value = (n);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vgettagrefs */
+
+/*******************************************************************************
+NAME
+   Vgettagref
+
+DESCRIPTION
+   Returns a specified tag/ref pair from the vgroup.
+   User specifies an index.
+   12-MAY-91 Jason Ng NCSA.
+
+   NOTE: Do not confuse with Vgettagrefs().
+
+RETURNS
+   RETURNS FAIL if OK.
+   RETURNS SUCCEED if error.
+
+*******************************************************************************/
+intn
+Vgettagref(int32 vkey,   /* IN: vgroup key */
+           int32 which,  /* IN: hmm */
+           int32 *tag,   /* IN/OUT: tag to return */
+           int32 *ref    /* IN/OUT: ref to return */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    intn       ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgettagref");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    if (which < 0 || which > (int32) (vg->nvelt - 1))
+        HGOTO_ERROR(DFE_RANGE, FAIL);     /* range err */
+
+    *tag = (int32) vg->tag[which];
+    *ref = (int32) vg->ref[which];
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vgettagref */
+
+/*******************************************************************************
+NAME
+   VQuerytag
+
+DESCRIPTION
+  Return the tag of this Vgroup.
+  Return 0 on failure
+
+RETURNS
+
+*******************************************************************************/
+int32
+VQuerytag(int32 vkey /* IN: vgroup key */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgettagref");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    ret_value = ((int32) vg->otag);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* VQuerytag */
+
+/*******************************************************************************
+NAME
+   VQueryref
+
+DESCRIPTION
+   Return the ref of this Vgroup.
+   Return FAIL on failure
+
+RETURN
+*******************************************************************************/
+int32
+VQueryref(int32 vkey /* IN: vgroup id */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32     ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgettagref");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    ret_value = ((int32) vg->oref);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* VQueryref */
+
+/*******************************************************************************
+NAME
+  Vaddtagref
+
+DESCRIPTION
+  Inserts a tag/ref pair into the attached vgroup vg.
+  First checks that the tag/ref is unique. (6/20/96 Maybe the original
+   design required the uniqueness. However, the current code allows
+   duplication if NO_DUPLICATES is not defined. The SD interface needs
+   this feature to create SDS's with duplicated dimensions. For example
+   a 3D SDS has dimensions "time", "presure" and "presure".)
+  If error, returns FAIL or tag/ref is not inserted.
+  If OK, returns the total number of tag/refs in the vgroup (a +ve integer).
+  28-MAR-91 Jason Ng NCSA.
+
+RETURNS
+
+*******************************************************************************/
+int32
+Vaddtagref(int32 vkey, /* IN: vgroup key */
+           int32 tag,  /* IN: tag to add */
+           int32 ref   /* IN: ref to add */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+#ifdef NO_DUPLICATES
+    uintn        i;
+#endif /* NO_DUPLICATES */
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Vaddtagref");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+#ifdef NO_DUPLICATES
+    /* SD interface needs duplication if two dims have the same name.
+       So, don't remove the ifdef/endif pair.   */
+    /* make sure doesn't already exist in the Vgroup */
+    for (i = 0; i < vg->nvelt; i++)
+        if ((tag == vg->tag[i]) && (ref == vg->ref[i]))
+            HGOTO_DONE(FAIL);
+#endif  /* NO_DUPLICATES  */
+
+    ret_value = vinsertpair(vg, (uint16) tag, (uint16) ref);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vaddtagref */
+
+/*******************************************************************************
+NAME
+  vinsertpair
+
+DESCRIPTION
+   Inserts a tag/ref pair into the attached vgroup vg.
+   Expand the tag/ref space if necessary
+
+RETURNS
+    Returns the total number of tag/refs in the vgroup.
+
+*******************************************************************************/
+int32
+vinsertpair(VGROUP * vg, /* IN: vgroup struct */
+            uint16 tag,  /* IN: tag to insert */
+            uint16 ref   /* IN: ref to insert */)
+{
+    int32    ret_value = SUCCEED;
+    CONSTR(FUNC, "vinsertpair");
+
+    /* clear error stack */
+    HEclear();
+
+    if ((intn)vg->nvelt >= vg->msize)
+      {
+          vg->msize *= 2;
+
+          vg->tag = (uint16 *) HDrealloc((VOIDP) vg->tag, vg->msize * sizeof(uint16));
+          vg->ref = (uint16 *) HDrealloc((VOIDP) vg->ref, vg->msize * sizeof(uint16));
+
+          if ((vg->tag == NULL) || (vg->ref == NULL))
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      }
+
+    vg->tag[(uintn)vg->nvelt] = tag;
+    vg->ref[(uintn)vg->nvelt] = ref;
+    vg->nvelt++;
+
+    vg->marked = TRUE;
+    ret_value = ((int32) vg->nvelt);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* vinsertpair() */
+
+/*******************************************************************************
+NAME
+   Ventries
+
+DESCRIPTION
+    returns the no of entries (+ve integer) in the vgroup vgid.
+    vgid must be an actual id
+
+    undocumented
+
+RETURNS
+    RETURNS FAIL if error
+
+*******************************************************************************/
+int32
+Ventries(HFILEID f,  /* IN: file handle */
+         int32 vgid  /* IN: vgroup id */)
+{
+    vginstance_t *v = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "Ventries");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check vgroup id? */
+    if (vgid < 1)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if((v = vginst(f,(uint16)vgid))==NULL)
+        HGOTO_ERROR(DFE_NOMATCH,FAIL);          /* error */
+
+    if (v->vg != NULL)
+        ret_value = (int32)v->vg->nvelt;
+    else
+        ret_value = FAIL;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Ventries */
+
+/*******************************************************************************
+NAME
+   Vsetname
+
+DESCRIPTION
+   gives a name to the VGROUP vg.
+
+RETURNS
+    RETURN VALUES: SUCCEED for success, FAIL for failure (big suprise, eh?)
+   
+*******************************************************************************/
+int32
+Vsetname(int32 vkey,         /* IN: vgroup key */
+         const char *vgname  /* IN: name to set for vgroup */) 
+{
+    CONSTR(FUNC, "Vsetname");
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    size_t	  name_len;
+    int32	  ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid and if vgroup name is okay */
+    if (HAatom_group(vkey) != VGIDGROUP || vgname == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL || vg->access!='w')
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* copy the name over; if name exists, overwrite it */
+
+    name_len = HDstrlen(vgname); /* shortcut of length of the given name */
+
+    /* if name exists, release it */
+    if (vg->vgname != NULL) HDfree(vg->vgname);
+
+    /* allocate space for new name */
+    vg->vgname = (char *)HDmalloc(name_len+1);
+
+    /* check for unsuccessful allocation */
+    if (vg->vgname == NULL) HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* copy given name after allocation succeeded, with \0 terminated */
+    HIstrncpy(vg->vgname, vgname, name_len+1);
+
+    vg->marked = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vsetname */
+
+/*******************************************************************************
+NAME
+   Vsetclass
+
+DESCRIPTION
+    Assigns a class name to the VGROUP vg.
+   
+RETURNS
+    RETURN VALUES: SUCCEED for success, FAIL for failure
+
+MODIFICATION
+    2010/01/26 No longer truncates classname to max length of VGNAMELENMAX.
+   
+*******************************************************************************/
+int32
+Vsetclass(int32 vkey,          /* IN: vgroup key */
+          const char *vgclass  /* IN: class to set for vgroup */)
+{
+    CONSTR(FUNC, "Vsetclass");
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    size_t        classname_len;
+    int32         ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check if class is valid */
+    if (vgclass == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check. Also check write access to vgroup  */
+    vg = v->vg;
+    if (vg == NULL || vg->access != 'w')
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /*
+     * copy the class over; if class exists, overwrite it
+     */
+
+    classname_len = HDstrlen(vgclass); /* length of the given class name */
+
+    /* if name exists, release it */
+    if (vg->vgclass != NULL) HDfree(vg->vgclass);
+
+    /* allocate space for new name */
+    vg->vgclass = (char *)HDmalloc(classname_len+1);
+
+    /* check for unsuccessful allocation */
+    if (vg->vgclass == NULL) HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+    /* copy given class name after allocation succeeded, with \0 terminated */
+    HIstrncpy(vg->vgclass, vgclass, classname_len+1);
+
+    vg->marked = TRUE;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vsetclass */
+
+/*******************************************************************************
+NAME
+   Visvg
+
+DESCRIPTION
+   Tests if an entry in the vgroup vg is a VGROUP, given the entry's id.
+   
+RETURNS
+    RETURNS TRUE if so
+    RETURNS FALSE if not, or if error
+   
+*******************************************************************************/
+intn
+Visvg(int32 vkey, /* IN: vgroup key */
+      int32 id    /* IN: id of entry in vgroup */)
+{
+    uintn        u;
+    uint16       ID;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    intn         ret_value = FALSE; /* initialize to FALSE */
+    CONSTR(FUNC, "Visvg");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FALSE);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FALSE);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FALSE);
+
+    ID = (uint16) id; /* cast 32bit ID to 16bit id */
+
+    for (u = 0; u < (uintn)vg->nvelt; u++)
+      {
+        if (vg->ref[u] == ID &&     /* if the ids match, */
+            vg->tag[u] == DFTAG_VG)     /* and it is a vgroup */
+          {
+                HGOTO_DONE(TRUE);
+          }
+      }
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Visvg */
+
+/*******************************************************************************
+NAME
+   Visvs
+
+DESCRIPTION
+   Checks if an id in a vgroup refers to a VDATA
+
+RETURNS
+   RETURNS 1 if so
+   RETURNS 0 if not, or if error.
+
+*******************************************************************************/
+intn
+Visvs(int32 vkey, /* IN: vgroup key */
+      int32 id    /* IN: id of entry in vgroup */)
+{
+    intn         i;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    intn         ret_value = FALSE; /* initialize to false */
+    CONSTR(FUNC, "VSisvs");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FALSE);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FALSE);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FALSE);
+
+    i = (intn)vg->nvelt;
+    while (i)
+      {
+        if (vg->ref[--i] == (uint16) id && vg->tag[i] == VSDESCTAG)
+          HGOTO_DONE(TRUE);
+      }
+
+done:
+  if(ret_value == FALSE)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Visvs */
+
+/*******************************************************************************
+NAME
+   Vgetid
+
+DESCRIPTION
+   Given a vgroup's id, returns the next vgroup's id in the file f .
+   The call Vgetid(f,-1) returns the id of the FIRST vgroup in the file.
+
+   This id is actually the "ref" of the vgroup "tag/ref".
+
+RETURNS
+   RETURNS -1 if error
+   RETURNS the next vgroup's id (0 or +ve integer).
+   
+*******************************************************************************/
+int32
+Vgetid(HFILEID f,  /* IN: file handle */
+       int32 vgid  /* IN: vgroup id */)
+{
+    vginstance_t *v = NULL;
+    vfile_t      *vf = NULL;
+    VOIDP        *t = NULL;
+    int32        key;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgetid");
+
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup id is valid */
+    if (vgid < -1)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vgroup file record */
+    if (NULL == (vf = Get_vfile(f)))
+        HGOTO_ERROR(DFE_FNF, FAIL);
+
+    if (vgid == (-1))
+      {     /* check for magic value to return the first group */
+          if (vf->vgtree == NULL )
+              HGOTO_DONE(FAIL); /* just return FAIL, no error */
+
+          if (NULL == (t = (VOIDP *) tbbtfirst((TBBT_NODE *) * (vf->vgtree))))
+              HGOTO_DONE(FAIL); /* just return FAIL, no error */
+
+          /* t is assumed to valid at this point */
+          v = (vginstance_t *) * t;   /* get actual pointer to the vginstance_t */
+          HGOTO_DONE((int32)v->ref); /* rets 1st vgroup's ref */
+      }     
+    else /* vgid >= 0 */
+      {
+          /* look in vgtab for vgid */
+          /* tbbtdfind returns a pointer to the vginstance_t pointer */
+          key = (int32)vgid;
+          t = (VOIDP *) tbbtdfind(vf->vgtree, (VOIDP) &key, NULL);
+
+          if (t == NULL ||
+              t == (VOIDP *) tbbtlast((TBBT_NODE *) * (vf->vgtree)))  
+            { /* couldn't find the old vgid or at the end */
+              ret_value = (FAIL);  
+            }
+          else if (NULL == (t = (VOIDP *) tbbtnext((TBBT_NODE *) t))) /* get the next node in the tree */
+              ret_value = (FAIL);
+          else
+            {
+                v = (vginstance_t *) * t;     /* get actual pointer to the vginstance_t */
+                ret_value = (int32)v->ref;  /* rets next vgroup's ref */
+            }     /* end else */
+      }
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vgetid */
+
+/*******************************************************************************
+NAME
+   Vgetnext
+
+DESCRIPTION
+   Given the id of an entry from a vgroup vg, looks in vg for the next
+   entry after it, and returns its id.
+   The call Vgetnext (vg,-1) returns the id of the FIRST entry in the vgroup.
+
+   Vgetnext will look at only VSET elements in the vgroup.
+   To look at all links in a vgroup, use Vgettagrefs instead.
+
+  This id is actually the "ref" of the entry's "tag/ref".
+   
+RETURNS
+   RETURNS -1 if error
+   RETURNS the id of the next entry( 0 or +ve integer)  in the vgroup.
+   
+   
+*******************************************************************************/
+int32
+Vgetnext(int32 vkey, /* IN: vgroup key */
+         int32 id    /* IN: id of entry in vgroup */)
+{
+    uintn        u;
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32        ret_value = FAIL;
+    CONSTR(FUNC, "Vgetnext");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid. Also check if 'id' is valid */
+    if (HAatom_group(vkey) != VGIDGROUP || id < (-1))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check. */
+    vg = v->vg;
+    if ((vg == NULL) || (vg->otag != DFTAG_VG))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* hmm..if no elements we return FAIL */
+    if (vg->nvelt == 0)
+        HGOTO_DONE(FAIL);
+
+    /* if id is '-1' then the first entry in the vgroup is returned 
+       if it is a vgroup ? */
+    if (id == -1)
+      {
+          if ((vg->tag[0] == DFTAG_VG) || (vg->tag[0] == VSDESCTAG))
+              HGOTO_DONE((int32)vg->ref[0]);  /* id of first entry */
+      }     /* end if */
+
+    /* look in vgroup for 'id' */
+    for (u = 0; u < (uintn)vg->nvelt; u++)
+      { /* only look for vgroups? */
+        if ((vg->tag[u] == DFTAG_VG) || (vg->tag[u] == VSDESCTAG))
+          {
+              if (vg->ref[u] == (uint16) id)
+                {
+                    if (u == (uintn)(vg->nvelt - 1))
+                      {
+                        HGOTO_DONE(FAIL);
+                      } /* end if */
+                    else
+                      {
+                          if ((vg->tag[u + 1] == DFTAG_VG) || (vg->tag[u + 1] == VSDESCTAG))
+                            {
+                              HGOTO_DONE((int32)vg->ref[u + 1]);  /* return the id of next entry */
+                            }
+                          else
+                            {
+                              HGOTO_DONE(FAIL);
+                            }
+                      }     /* end else */
+                }   /* end if */
+          }     /* end if */
+      }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vgetnext  */
+
+/*******************************************************************************
+NAME
+   Vgetnamelen
+
+DESCRIPTION
+   Retrieves the length of the vgroup's name.
+
+RETURNS
+   Returns SUCCEED/FAIL
+   BMR - 2006/09/10
+   
+*******************************************************************************/
+int32
+Vgetnamelen(int32 vkey,   /* IN: vgroup key */
+	    uint16 *name_len /* OUT: length of vgroup's name */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgetnamelen");
+
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid and the vgname */
+    if (HAatom_group(vkey)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /*
+     * Obtain the name length
+     */
+
+    /* if there is no name... */
+    if (vg->vgname == NULL)
+	*name_len = 0;
+    /* if name had been set... */
+    else
+    {
+	size_t temp_len = HDstrlen(vg->vgname); /* shortcut */
+
+	/* return name's length if it is a valid value */
+	if (temp_len >= 0)
+            *name_len = (uint16)temp_len;
+	else /* unlikely, but just in case */
+	    ret_value = FAIL;
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vgetnamelen */
+
+/*******************************************************************************
+NAME
+   Vgetclassnamelen
+
+DESCRIPTION
+   Retrieves the length of the vgroup's name.
+
+RETURNS
+   Returns SUCCEED/FAIL
+   BMR - 2006/09/10
+   
+*******************************************************************************/
+int32
+Vgetclassnamelen(int32 vkey,   /* IN: vgroup key */
+	    uint16 *classname_len /* OUT: length of vgroup's classname */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    size_t       temp_len;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgetclassnamelen");
+
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid and the vgname */
+    if (HAatom_group(vkey)!=VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* obtain the class name length */
+    if (vg->vgclass == NULL)
+	*classname_len = 0;
+    /* if name had been set... */
+    else
+    {
+	size_t temp_len = HDstrlen(vg->vgclass); /* shortcut */
+
+	/* return class name's length if it is a valid value */
+	if (temp_len >= 0)
+            *classname_len = (uint16)temp_len;
+	else /* unlikely, but just in case */
+	    ret_value = FAIL;
+    }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vgetclassnamelen */
+
+/*******************************************************************************
+NAME
+   Vgetname
+
+DESCRIPTION
+   returns the vgroup's name
+   ASSUME that vgname has been allocated large enough to hold
+   the name
+
+RETURNS
+   SUCCEED / FAIL
+   
+*******************************************************************************/
+int32
+Vgetname(int32 vkey,   /* IN: vgroup key */
+         char *vgname  /* IN/OUT: vgroup name */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgetname");
+
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid and the vgname */
+    if (HAatom_group(vkey)!=VGIDGROUP || vgname==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* copy vgroup name over if it had been set */
+    if (vg->vgname != NULL)
+	HDstrcpy(vgname, vg->vgname);
+    else
+	vgname[0] = '\0';
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vgetname */
+
+/*******************************************************************************
+NAME
+   Vgetclass
+
+DESCRIPTION
+   returns the vgroup's class name
+   ASSUME that vgclass has been allocated large enough to hold
+   the name
+
+RETURNS
+   SUCCEED/FAIL
+
+*******************************************************************************/
+int32
+Vgetclass(int32 vkey,    /* IN: vgroup key */
+          char *vgclass  /* IN/OUT: vgroup class */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "Vgetclass");
+
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid and also vgroup class */
+    if (HAatom_group(vkey) != VGIDGROUP || vgclass==NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* copy class over if it had been set */
+    if (vg->vgclass != NULL)
+	HDstrcpy(vgclass, vg->vgclass);
+    else
+	vgclass[0] = '\0';
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vgetclass */
+
+/*******************************************************************************
+NAME
+   Vinquire
+
+DESCRIPTION
+   General inquiry routine for VGROUP.
+   output parameters:
+         nentries - no of entries in the vgroup
+         vgname  - the vgroup's name
+   
+RETURNS
+   RETURNS FAIL if error
+   RETURNS SUCCEED if ok
+
+*******************************************************************************/
+intn
+Vinquire(int32 vkey,        /* IN: vgroup key */
+         int32 *nentries,   /* IN/OUT: number of entries in vgroup */
+         char *vgname       /* IN/OUT: vgroup name */)
+{
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    intn    ret_value = SUCCEED;
+    CONSTR(FUNC, "Vinquire");
+
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* check tag of vgroup */
+    if (vg->otag != DFTAG_VG)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* copy vgroup name if requested.  Assumes 'vgname' has sufficient space */
+    if (vgname != NULL)
+        HDstrcpy(vgname, vg->vgname);
+
+    /* set number of entries in vgroup if requested */
+    if (nentries != NULL)
+        *nentries = (int32)vg->nvelt;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vinquire */
+
+
+/*******************************************************************************
+NAME
+   Vopen
+
+DESCRIPTION
+   This routine will replace the code segment " Hopen(); Vinitialize(f)".
+   Thus, if Vopen is used, do not call Vinitialize after that.
+   
+   Similar to Hopen().
+   
+   This routine opens the HDF file and initializes it for Vset operations.
+
+   See also Vclose().
+
+   By: Jason Ng 10 Aug 92
+
+RETURNS
+    RETURN VALUE:
+    if error:  -1 (FAIL).
+    if successful: the id of the file (>0).
+   
+*******************************************************************************/
+HFILEID
+Vopen(char *path,     /* IN: file name */
+      intn acc_mode,  /* IN: type of file access */
+      int16 ndds      /* IN: number of DD in a block */)
+{
+    HFILEID    ret_value=SUCCEED;
+    CONSTR(FUNC, "Vopen");
+
+    /* clear error stack */
+    HEclear();
+
+    /* use 'Hopen' to open file */
+    if ((ret_value = Hopen(path, acc_mode, ndds))== FAIL)
+      HGOTO_ERROR(DFE_BADOPEN,FAIL);
+
+    /* Initialize Vxx interface */
+    if(Vinitialize(ret_value)==FAIL)
+      HGOTO_ERROR(DFE_CANTINIT,FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* Vopen() */
+
+/*******************************************************************************
+NAME
+  Vclose
+
+DESCRIPTION
+   This routine will replace the code segment " Vfinish(f); Hclose(f);".
+   Thus, if Vclose is used, do not call Vfinish before that.
+   
+   This routine closes the HDF file, after it has freed all memory and
+   updated the file.
+   
+   See also Vopen().
+
+RETURNS
+   RETURN VALUE:  intn status - result of Hopen().
+   
+*******************************************************************************/
+intn
+Vclose(HFILEID f /* IN: file handle */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "Vclose");
+#endif
+    intn ret_value = SUCCEED;
+
+    if (Vfinish(f) == FAIL)
+        ret_value = FAIL;
+    else
+        ret_value = (Hclose(f));
+
+    return ret_value;
+} /* Vclose() */
+
+/*******************************************************************************
+NAME
+   Vdelete
+
+DESCRIPTION
+   Remove a Vgroup from its file.  This function will both remove the Vgoup
+   from the internal Vset data structures as well as from the file.
+
+   'vgid' here is actually the ref of the Vgroup.
+
+   (i.e. it calls tbbt_delete() and Hdeldd())
+
+RETURNS
+   Return FAIL / SUCCEED
+
+*******************************************************************************/
+int32
+Vdelete(int32 f,     /* IN: file handle */
+        int32 vgid   /* IN: vgroup id i.e. ref */)
+{
+    VOIDP       v;
+    vfile_t    *vf = NULL;
+    VOIDP      *t = NULL;
+    int32       key;
+    filerec_t  *file_rec = NULL;       /* file record */
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "Vdelete");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check vgroup id is valid */
+    if (vgid < 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* convert file id to file record */
+    if ((file_rec = HAatom_object(f)) == NULL)
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    /* check for write-permission to file*/
+    if(!(file_rec->access & DFACC_WRITE))
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    /* get vgroup file record */
+    if (NULL == (vf = Get_vfile(f)))
+        HGOTO_ERROR(DFE_FNF, FAIL);
+
+    /* find vgroup node in TBBT using it's ref */
+    key = (int32)vgid;
+    if (( t = (VOIDP *) tbbtdfind(vf->vgtree, (VOIDP) &key, NULL))== NULL)
+      HGOTO_DONE(FAIL);
+
+    /* remove vgroup node from TBBT */
+    if((v = tbbtrem((TBBT_NODE **) vf->vgtree, (TBBT_NODE *) t, NULL))!=NULL)
+        vdestroynode((VOIDP) v);
+
+    /* Delete vgroup from file */
+    if(Hdeldd(f, DFTAG_VG, (uint16) vgid) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* Vdelete */
+
+/*******************************************************************************
+ NAME
+    VIstart  --  V-level initialization routine
+
+ DESCRIPTION
+    Register the shut-down routines (VPshutdown & VSPshutdown) for call
+    with atexit.
+
+ RETURNS
+    Returns SUCCEED/FAIL
+*******************************************************************************/
+PRIVATE intn 
+VIstart(void)
+{
+    intn        ret_value = SUCCEED;
+    CONSTR(FUNC, "VIstart");    /* for HERROR */
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&VPshutdown) != 0)
+      HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&VSPshutdown) != 0)
+      HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+    return(ret_value);
+} /* end VIstart() */
+
+/*******************************************************************************
+ NAME
+    VPshutdown  --  Terminate various static buffers.
+
+ DESCRIPTION
+    Free various buffers allocated in the V routines.
+
+ RETURNS
+    Returns SUCCEED/FAIL
+
+*******************************************************************************/
+intn 
+VPshutdown(void)
+{
+    VGROUP       *v  = NULL;
+    vginstance_t *vg = NULL;
+    intn         ret_value = SUCCEED;
+    CONSTR(FUNC, "VPshutdown");
+
+    /* Release the vdata free-list if it exists */
+    if(vgroup_free_list != NULL)
+      {
+          while(vgroup_free_list != NULL)
+            {
+                v = vgroup_free_list;
+                vgroup_free_list = vgroup_free_list->next;
+                v->next = NULL;
+                HDfree(v);
+            } /* end while */
+      } /* end if */
+
+    /* Release the vginstance free-list if it exists */
+    if(vginstance_free_list != NULL)
+      {
+          while(vginstance_free_list != NULL)
+            {
+                vg = vginstance_free_list;
+                vginstance_free_list = vginstance_free_list->next;
+                vg->next = NULL;
+                HDfree(vg);
+            } /* end while */
+      } /* end if */
+
+    if(vtree != NULL)
+      {
+          /* Free the vfile tree */
+          tbbtdfree(vtree, vfdestroynode, NULL);
+
+          /* Destroy the atom groups for Vdatas and Vgroups */
+          if (HAdestroy_group(VSIDGROUP) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          if (HAdestroy_group(VGIDGROUP) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+          vtree = NULL;
+      } /* end if */
+
+    if(Vgbuf != NULL)
+      {
+          HDfree(Vgbuf);
+          Vgbuf = NULL;
+          Vgbufsize = 0;
+      } /* end if */
+
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+    return ret_value;
+} /* end VPshutdown() */
+
+
+/*******************************************************************************
+ NAME
+    Vgisinternal  --  Determine if a vgroup is internally created by the lib
+ RETURNS
+    Returns TRUE (1) if vkey is a vgroup that is internally created
+    by the library, FALSE (0) otherwise, and FAIL if failure occurs.
+
+ DESCRIPTION
+    Checks the class name of the given vgroup against the list of internal
+    vgroup class names, HDF_INTERNAL_VGS.
+
+    There is an exception where the vgroup does not have a class and has a name
+    set to GR_NAME.  The vgroup is actually an internal vgroup, representing a
+    GR file.  It was only a very brief gap in the revisions where this scenario
+    can happen, yet there is at least one test file generated during that
+    period, grtdfui83.hdf.
+*******************************************************************************/
+intn
+Vgisinternal(int32 vkey /* vgroup's identifier */)
+{
+    CONSTR(FUNC, "Vgisinternal");
+    vginstance_t *v = NULL;
+    VGROUP       *vg = NULL;
+    intn	  is_internal = FALSE;
+    intn	  ret_value = FALSE;
+
+    /* clear error stack */
+    HEclear();
+
+    /* Gheck if vgroup is valid */
+    if (HAatom_group(vkey) != VGIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get instance of vgroup */
+    if (NULL == (v = (vginstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* Get vgroup itself and check */
+    vg = v->vg;
+    if (vg == NULL)
+        HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+    /* Check for internal class name if it has been set */
+    if (vg->vgclass != NULL)
+    {
+	int  ii;
+
+	/* If this class name is one of the internal class name then return
+	   TRUE, otherwise, return FALSE */
+	ii = 0;
+	while (ii < HDF_NUM_INTERNAL_VGS && is_internal == FALSE)
+	{
+            size_t len = HDstrlen(HDF_INTERNAL_VGS[ii]);
+            if (HDstrncmp(HDF_INTERNAL_VGS[ii], vg->vgclass, len) == 0)
+		is_internal = TRUE;
+	    ii++;
+        }
+    }
+    else /* no class defined */
+    {
+	/* If class name is not set, check the vgroup's name to catch the case
+	   when the vgroup's name was set to GR_NAME.  See HDFFR-1297 (?) for
+	   details. -BMR 2012/1/6 */
+	/* Check vgroup name */
+	if (vg->vgname != NULL)
+	    if (HDstrncmp(vg->vgname, GR_NAME, HDstrlen(GR_NAME)) == 0)
+		is_internal = TRUE;
+    }
+    ret_value = is_internal;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+} /* Vgisinternal */
+
+
+/*******************************************************************************
+ NAME
+    Visinternal  --  Determine if a vgroup's class name is for internal only
+ RETURNS
+    Returns TRUE (1) if "classname" is one of the class names used for
+    vgroups created by the the library and FALSE (0) otherwise.
+
+ DESCRIPTION
+    Checks the given name against the list of internal vgroup class names,
+    HDF_INTERNAL_VGS.
+*******************************************************************************/
+intn
+Visinternal(const char *classname /* vgroup's class name */)
+{
+    int  i;
+    intn ret_value = FALSE;
+
+    /* Check if this class name is one of the internal class name and return
+	TRUE, otherwise, return FALSE */
+    for (i=0; i < HDF_NUM_INTERNAL_VGS; i++) {
+        if (HDstrncmp(HDF_INTERNAL_VGS[i], classname, HDstrlen(HDF_INTERNAL_VGS[i])) == 0 ) {
+            ret_value = TRUE;
+            break;
+        }
+    }
+    return ret_value;
+}
+
+/*******************************************************************************
+NAME
+    Vgetvgroups -- Get user-created vgroups in a file or in a vgroup
+RETURNS
+    The number of user-created vdatas if successful and FAIL, otherwise.
+
+DESCRIPTION
+    Vgetvgroups retrieves n_vgs vgroups by their reference numbers via the
+    caller-supplied array refarray.  When a vgroup id is specified, Vgetvgroups
+    will only retrieve the vgroups immediately belong to the specified vgroup,
+    and not any sub-vgroups.
+
+    The parameter n_vgs provides the number of values that the refarray list
+    can hold and can be any positive number smaller than MAX_REF (65535).  If
+    n_vgs is larger than the actual number of user-created vgroups, then only
+    the actual number of reference numbers will be retrieved.
+
+    The parameter start_vg indicates the vgroup number to start at.
+    - When start_vg is 0, the retrieval starts at the beginning.
+    - When start_vg is between 0 and the number of user-created vgroups in
+      the file or the specified vgroup, Vgetvgroups will start retrieving
+      vgroups from the vgroup number start_vg.
+    - When start_vg is greater than the number of user-created vgroups in the
+      file or the vgroup, Vgetvgroups will return FAIL.
+
+    When refarray argument is NULL, Vgetvgroups will return the actual number
+    of user-created vgroups without further processing.  This allows application
+    to find out the size of the array for proper allocation.
+
+    BMR - 2010/07/03
+*******************************************************************************/
+intn
+Vgetvgroups(int32 id,		/* IN: file id or vgroup id */
+	    uintn start_vg,	/* IN: reference number to start retrieving */
+            uintn n_vgs,	/* IN: number of user-created vgs to return */
+            uint16 *refarray	/* IN/OUT: ref array to fill */)
+{
+    CONSTR(FUNC, "Vgetvgroups");
+    vginstance_t *vg_inst = NULL;
+    int32    vg_ref;
+    intn     nactual_vgs, user_vgs, ii;
+    VGROUP  *vg = NULL;
+    intn     ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Make sure that proper size is passed in for the non-null array */
+    if (refarray != NULL && n_vgs == 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check if id is a file id */
+    if (HAatom_group(id) == FIDGROUP)
+    {
+	/* Look through all vgs, searching for user-created vgroups until
+	   no more vgroups in the file or the number of vgroups to be
+	   retrieved is reached */
+	nactual_vgs = 0;/* number of user-created vgroups to be retrieved */
+	user_vgs = 0;	/* number of user-created vgroups */
+	vg_ref = Vgetid(id, -1);  /* get ref number of first vg in the file */
+	while ((vg_ref != FAIL)   /* there are more vgroups */
+		&& ((nactual_vgs < n_vgs) || (n_vgs == 0))
+		&& (nactual_vgs <= user_vgs))
+	{
+            /* Get instance of vgroup; if it's not found, continue to look for
+                other vgroups */
+            if((vg_inst = vginst(id, (uint16)vg_ref)) == NULL)
+                continue;
+
+	    /* Get vgroup itself and check */
+	    vg = vg_inst->vg;
+	    if (vg == NULL)
+		HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+	    /* If this vgroup either does not have a class name, which means
+		it is a user-created vgroup, or has a class name and the class
+		name is not one of the internal class names, then record its
+		ref# according to caller's specification of where to start and
+		how many to retrieve */
+	    if (vg->vgclass == NULL ||
+	       (vg->vgclass != NULL && Visinternal(vg->vgclass) == FALSE))
+		{
+		    /* Make sure to count only from vgroup number start_vg */
+		    if (user_vgs >= start_vg)
+			/* If caller requests for reference numbers */
+			if (refarray != NULL)
+			{
+			    refarray[nactual_vgs] = (uint16)vg_ref;
+
+			    /* Increment the actual number of user-created vgs
+			       to be retrieved */
+			    nactual_vgs++;
+			}
+		    /* Increment the number of user-created vgs */
+		    user_vgs++;
+		}
+	    /* Move forward to the next vgroup in the file */
+	    vg_ref = Vgetid(id, vg_ref);
+	} /* while more vgroups in file */
+
+	/* Flag if start_vg is beyond the number of user-created vgroups */
+	if (user_vgs < start_vg)
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+
+	/* If caller is asking for the number of vgroups only, return the
+	   number of user-created vgroups, otherwise, return the number of
+	   vgroups that are actually stored in refarray */
+	if (refarray == NULL)
+	    ret_value = user_vgs;
+	else
+	    ret_value = nactual_vgs;
+    } /* file id is given */
+
+    /* Check if the given is a vgroup id */
+    else if (HAatom_group(id)==VGIDGROUP)
+    { /* vgroup id is given */
+
+	/* Get the number of sub-vgroups belong to this vgroup */
+	int32 n_elements = Vntagrefs(id);
+	if (n_elements == FAIL)
+	    HGOTO_ERROR(DFE_GENAPP, FAIL);
+
+	/* Get instance of vgroup */
+	if (NULL == (vg_inst = (vginstance_t *) HAatom_object(id)))
+	    HGOTO_ERROR(DFE_NOVS, FAIL);
+
+	/* Get vgroup itself and check */
+	vg = vg_inst->vg;
+	if (vg == NULL)
+	    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+	/* Go through the tag list vg->tag and find user-created vgroups, until
+	   no more sub-vgroups or the number of vgroups to be retrieved is
+	   reached */
+	nactual_vgs = 0;/* number of user-created vgroups to be retrieved */
+	user_vgs = 0;	/* number of user-created vgroups */
+        for (ii = 0;
+             ii < n_elements && ((nactual_vgs < n_vgs)|| (n_vgs == 0))
+                             && (nactual_vgs <= user_vgs);
+             ii++)
+        {
+	    /* If an element is a vgroup, then get access to it */
+            if (vg->tag[ii] == DFTAG_VG)
+	    {
+		vginstance_t *subv_inst = NULL;
+		VGROUP       *subvg = NULL;
+
+                /* Get instance of vgroup; if it's not found, continue to 
+		   other vgroups */
+                if((subv_inst = vginst(vg->f, (uint16)vg->ref[ii])) == NULL)
+                    continue;
+
+		/* Get vgroup itself and check */
+		subvg = subv_inst->vg;
+		if (subvg == NULL)
+		    HGOTO_ERROR(DFE_BADPTR, FAIL);
+
+		/* If this vgroup is internally created by the lib, then just
+		   skip it; otherwise, record its ref# according to caller's
+		   specification of where to start and how many to retrieve */
+		if (subvg->vgclass != NULL)
+		{
+		    /* Make sure this vgroup is not an internal one */
+		    if (Visinternal(subvg->vgclass) == FALSE)
+		    {
+			/* Make sure to count only from vg number start_vg */
+			if (user_vgs >= start_vg)
+			    /* If caller requests for reference numbers */
+			    if (refarray != NULL)
+			    {
+				refarray[nactual_vgs] = (uint16)vg->ref[ii];
+
+				/* Increment the actual number of user-created
+				   vgs to be retrieved */
+				nactual_vgs++;
+			    }
+
+			/* Increment the number of user-created vgs */
+			user_vgs++;
+		    }
+		}
+	    } /* this sub element is a vgroup */
+        } /* for */
+
+	/* Flag if start_vg is beyond the number of user-created vgroups */
+	if (user_vgs < start_vg)
+	    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+	/* If caller is asking for the number of vgroups only, return the
+	   number of user-created vgroups, otherwise, return the number of
+	   vgroups that are actually stored in refarray */
+	if (refarray == NULL)
+	    ret_value = user_vgs - (intn)start_vg;
+	else
+	    ret_value = nactual_vgs;
+    } /* vgroup id is given */
+    else
+    {
+ 	fprintf(stderr, "The given ID must be a file ID or a vgroup ID\n");
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    }
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* Vgetvgroups */
diff --git a/hdf/src/vhi.c b/hdf/src/vhi.c
new file mode 100644
index 0000000..3e3234f
--- /dev/null
+++ b/hdf/src/vhi.c
@@ -0,0 +1,211 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: vhi.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/*
+   * File
+   *       vhi.c
+   *       HDF Vset high-level access routines VHxxxx
+   *       Feb 92 - update to use H-routines
+   * Routines
+   *       VHstoredata  -- stores data in a field of a vdata in an HDF file
+   *       VHstoredatam -- stores data in a aggregated-typed field of a vdata
+   *       VHmakegroup  -- makes a vgroup from tag/ref pairs
+ */
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+/* ------------------------ VHstoredata -------------------------------
+   NAME
+   VHstoredata -- stores data in a field of a new vdata
+   USAGE
+   int32 VHstoredata (f, field, buf, n, datatype, vsname, vsclass)
+   HFILEID f;           IN: File id, returned from Hopen.
+   char *  field;       IN: Name of the field.
+   const uint8  *buf;       IN: Buffer of data to be stored in the field.
+   int32   n;           IN: Number of elements in buf to be written.
+   inter   datatype;    IN: Number type of the data to be written.
+   char *  vsname;      IN: Name of the new vdata.
+   char *  vsclass;     IN: Class of the new vdata.
+
+   RETURNS
+   On success returns reference number of the new vdata, a positive integer;
+   on failure returns -1.
+   DESCRIPTION
+   Stores 'n' elements of data from 'buf' as a field 'field' in a new vdata
+   called 'vsname' into the already opened HDF file (with file id 'f').
+   The datatype variable must be specified as a valid HDF type; n should not
+   be zero or negative.
+   Returns -1 if error; ref of that new vdata (a +ve integer) if successful.
+   ------------------------------------------------------------------------- */
+
+int32
+VHstoredata(HFILEID f, const char *field, const uint8 *buf, int32 n, int32 datatype,
+            const char *vsname, const char *vsclass)
+
+{
+#ifdef LATER
+    CONSTR(FUNC, "VHstoredata");
+#endif
+    int32       order = 1;
+    int32       ret_value;
+
+    ret_value = ((int32)VHstoredatam(f, field, buf, n, datatype, vsname, vsclass, order));
+
+    return ret_value;
+} /* end VHstoredata */
+
+/* ----------------------- VHstoredatam ----------------------------
+   NAME
+   VHstoredatam -- Same as VHstoredata but allows aggregate-typed field.
+   USAGE
+   int32 VHstoredata (f, field, buf, n, datatype, vsname, vsclass, order)
+   HFILEID f;           IN: File id, returned from Hopen.
+   char *  field;       IN: Name of the field.
+   uint8   buf[];       IN: Buffer of data to be stored in the field.
+   int32   n;           IN: Number of elements in buf to be written.
+   inter   datatype;    IN: Numter type of the data to be written.
+   char *  vsname;      IN: Name of the new vdata.
+   char *  vsclass;     IN: Class of the new vdata.
+   int32   order;       IN: Order of the field.
+
+   RETURNS
+   On success returns reference number of the new vdata, a positive integer;
+   on failure returns -1.
+   DESCRIPTION
+   Stores 'n' elements of data from 'buf' as a field 'field' in a new vdata
+   called 'vsname' into the already opened HDF file (with file id 'f').
+   The datatype variable must be specified as a valid HDF type;
+   n should not be zero or negative.
+   Returns -1 if error; ref of that new vdata (a +ve integer) if successful.
+   --------------------------------------------------------------------------- */
+
+int32
+VHstoredatam(HFILEID f, const char *field, const uint8 *buf, int32 n, int32 datatype, const char *vsname, const char *vsclass, int32 order)
+{
+    CONSTR(FUNC, "VHstoredatam");
+    int32       ref;
+    int32       vs;
+    int32       ret_value = SUCCEED;
+
+
+    if ((vs = VSattach(f, -1, "w")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+
+    if ( VSfdefine(vs, field, datatype, order) == FAIL)
+        HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+    if ( VSsetfields(vs, field) == FAIL)
+        HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+    if (n != VSwrite(vs, buf, n, FULL_INTERLACE))
+        HGOTO_ERROR(DFE_BADATTACH,FAIL);
+
+    if(VSsetname(vs, vsname)==FAIL)
+        HGOTO_ERROR(DFE_BADVSNAME,FAIL);
+
+    if(VSsetclass(vs, vsclass)==FAIL)
+        HGOTO_ERROR(DFE_BADVSCLASS,FAIL);
+
+    ref = VSQueryref(vs);
+    if(VSdetach(vs)==FAIL)
+        HGOTO_ERROR(DFE_CANTDETACH,FAIL);
+
+    ret_value = ((int32) ref);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VHstoredatam */
+
+/* ------------------------ VHmakegroup ------------------------------- */
+/*
+   NAME
+   VHmakegroup -- Creates a vgroup to store pairs of tag/ref.
+   USAGE
+   int32 VHmakegroup (f, tagarray, refarray , n, vgname, vgclass)
+   HFILEID f;           IN: File id, returned from Hopen.
+   int32   tagarray[];  IN: Array of tags to be stored in the vgroup.
+   int32   refarray[];  IN: Array of refs to be stored in the vgroup.
+   int32   n;           IN: Number of tags/refs in the tagarray/refarray.
+   char    * vgname;    IN: Name of the new vgroup.
+   char    * vgclass;   IN: Class of the new vgroup.
+
+   RETURNS
+   On success returns reference number of the new vgroup, a positive integer;
+   on failure returns -1.
+   DESCRIPTION
+   Takes an array of tags and and array of refs and create a vgroup to
+   store them. You tell it how many tag/ref pairs there are. You must
+   also give the vgroup a name.i Creating EMPTY vgroups is allowed.
+   VHmakegroup does bot check if a tag/ref is valid or exist,
+   but ALL tag/ref pairs MUST be unique.
+
+   Returns  -1 if error; ref of the new vgroup (a +ve integre) if ok.
+
+   --------------------------------------------------------------------------- */
+
+int32
+VHmakegroup(HFILEID f, int32 tagarray[], int32 refarray[], int32 n, const char *vgname, const char *vgclass)
+{
+    int32       ref, i;
+    int32       vg;
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "VHmakegroup");
+
+
+    if (( vg = Vattach(f, -1, "w"))== FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH,FAIL);
+
+    if(vgname!=NULL)
+        if(Vsetname(vg, vgname)==FAIL)
+            HGOTO_ERROR(DFE_BADVGNAME,FAIL);
+
+    if(vgclass!=NULL)
+        if(Vsetclass(vg, vgclass)==FAIL)
+            HGOTO_ERROR(DFE_BADVGCLASS,FAIL);
+
+    for (i = 0; i < n; i++)
+      {
+          if ( Vaddtagref(vg, tagarray[i], refarray[i]) == FAIL)
+              HGOTO_ERROR(DFE_CANTADDELEM,FAIL);
+      }
+
+    ref = VQueryref(vg);
+    if(Vdetach(vg)==FAIL)
+        HGOTO_ERROR(DFE_CANTDETACH,FAIL);
+
+    ret_value = (ref);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* VHmakegroup */
+
+/* ------------------------------------------------------------------ */
diff --git a/hdf/src/vio.c b/hdf/src/vio.c
new file mode 100644
index 0000000..6758ee7
--- /dev/null
+++ b/hdf/src/vio.c
@@ -0,0 +1,1598 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6026 $";
+#endif
+
+/* $Id: vio.c 6026 2014-01-16 15:16:16Z bmribler $ */
+
+/*****************************************************************************
+ file - vio.c
+
+ Part of the HDF Vset interface.
+
+ VDATAs are handled by routines in here.
+ PRIVATE functions manipulate vsdir and are used only within this file.
+ PRIVATE data structures in here pertain to vdatas in vsdir only.
+
+
+LOCAL ROUTINES
+ VSIget_vdata_node      -- allocate a new VDATA record
+ VSIrelease_vdata_node  -- Releases a vdata node
+ VSIget_vsinstance_node -- allocate a new vsinstance_t record
+ VSIrelease_vsinstance_node -- Releases a vsinstance node
+
+LIBRARY PRIVATE ROUTINES
+ VSPhshutdown  --  shutdown the Vset interface
+
+EXPORTED ROUTINES
+ vinst         -- Looks thru vstab for vsid and return the addr of the vdata 
+                   instance where vsid is found.
+ vexistvs      -- Tests if a vdata with id vsid is in the file's vstab.
+ vpackvs       -- Packs a VDATA structure into a compact form suitable for 
+                   storing in the HDF file.
+ vunpackvs     -- Convert a packed form(from HDF file) to a VDATA structure.
+                   This routine will also initalize the VDATA structure as 
+                   much as it can.
+ vsdestroynode -- Frees B-Tree nodes.
+ VSPgetinfo    -- Read in the "header" information about the Vdata.
+ VSattach      -- Attaches/Creates a new vs in vg depending on "vsid" value.
+ VSdetach      -- Detaches vs from vstab.
+ VSappendable  -- Make it possible to append unlimitedly to an existing VData.
+ VSgetid       -- Returns the id of the next VDATA from the file.
+ VSQuerytag    -- Return the 'otag' of the given Vdata.
+ VSQueryref    -- Return the ref of the given Vdata.
+ vswritelist   -- Return the writelist of a Vdata.
+ VSgetversion  -- Return the version number of a Vdata.
+ VSdelete      -- Remove a Vdata from its file.  This function will both 
+                   remove the Vdata from the internal Vset data structures 
+                   as well as from the file.
+
+ NOTE: Another pass needs to made through this file to update some of
+       the comments about certain sections of the code. -GV 9/8/97
+
+*************************************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+/* Private Function Prototypes */
+PRIVATE intn vunpackvs
+            (VDATA * vs, uint8 buf[], int32 len);
+
+/* Temporary buffer for I/O */
+PRIVATE uint32 Vhbufsize = 0;
+PRIVATE uint8 *Vhbuf = NULL;
+
+/* Pointers to the VDATA & vsinstance node free lists */
+static VDATA *vdata_free_list=NULL;
+static vsinstance_t *vsinstance_free_list=NULL;
+
+/* vpackvs is prototyped in vg.h since vconv.c needs to call it */
+
+/*******************************************************************************
+ NAME
+    VSIget_vdata_node -- allocate a new VDATA record
+
+ DESCRIPTION
+    Return an pointer to a new VDATA to use for a new VSID.
+
+ RETURNS
+    returns VDATA record pointer or NULL if failed.
+
+*******************************************************************************/
+VDATA *
+VSIget_vdata_node(void)
+{
+    VDATA   *ret_value = NULL;
+    CONSTR(FUNC, "VSIget_vdata_node");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Grab from free list if possible */
+    if(vdata_free_list != NULL)
+      {
+        ret_value       = vdata_free_list;
+        vdata_free_list = vdata_free_list->next;
+      } 
+    else /* allocate a new node */
+      {
+        if((ret_value=(VDATA *)HDmalloc(sizeof(VDATA)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end else */
+
+    /* Initialize to zeros */
+    HDmemset(ret_value,0,sizeof(VDATA));
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* VSIget_vdata_node */
+
+/******************************************************************************
+ NAME
+     VSIrelease_vdata_node -- Releases a vdata node
+
+ DESCRIPTION
+    Puts an VDATA node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+void 
+VSIrelease_vdata_node(VDATA *vs /* IN: vdata to release */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "VSIrelease_vdata_node");	/* for HERROR */
+#endif /* LATER */
+
+    /* Insert the atom at the beginning of the free list */
+    vs->next        = vdata_free_list;
+    vdata_free_list = vs;
+
+}   /* end VSIrelease_vdata_node() */
+
+/*******************************************************************************
+ NAME
+    VSIget_vsinstance_node -- allocate a new vsinstance_t record
+
+ DESCRIPTION
+    Return an pointer to a new VDATA to use for a new VSID.
+
+ RETURNS
+    returns vsinstance_t pointer or NULL if failed.
+*******************************************************************************/
+vsinstance_t *
+VSIget_vsinstance_node(void)
+{
+    vsinstance_t   *ret_value = NULL;
+    CONSTR(FUNC, "VSIget_vsinstance_node");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Grab from free list if possible */
+    if(vsinstance_free_list != NULL)
+      {
+        ret_value            = vsinstance_free_list;
+        vsinstance_free_list = vsinstance_free_list->next;
+      }  
+    else /* allocate a new vsinstance record */
+      {
+        if((ret_value=(vsinstance_t *)HDmalloc(sizeof(vsinstance_t)))==NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end else */
+
+    /* Initialize to zeros */
+    HDmemset(ret_value,0,sizeof(vsinstance_t));
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return(ret_value);
+}	/* VSIget_vsinstance_node */
+
+/******************************************************************************
+ NAME
+     VSIrelease_vsinstance_node -- Releases a vsinstance node
+
+ DESCRIPTION
+    Puts a vsinstance node into the free list
+
+ RETURNS
+    No return value
+
+*******************************************************************************/
+void 
+VSIrelease_vsinstance_node(vsinstance_t *vs /* IN: vinstance node to release */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "VSIrelease_vsinstance_node");	/* for HERROR */
+#endif /* LATER */
+
+    /* Insert the atom at the beginning of the free list */
+    vs->next             = vsinstance_free_list;
+    vsinstance_free_list = vs;
+
+}   /* end VSIrelease_vsinstance_node() */
+
+/*******************************************************************************
+ NAME
+    VSPhshutdown  -  shutdown the Vset interface 
+
+ DESCRIPTION
+    For completeness, when the VSet interface is shut-down, free the Vhbuf.
+
+ RETURNS
+    Returns SUCCEED/FAIL
+
+ COMMENTS, BUGS, ASSUMPTIONS
+    Should only ever be called by the "atexit" function HDFend
+*******************************************************************************/
+intn 
+VSPhshutdown(void)
+{
+    intn  ret_value = SUCCEED;
+    VDATA *v = NULL;
+    vsinstance_t *vs = NULL;
+
+    /* Release the vdata free-list if it exists */
+    if(vdata_free_list != NULL)
+      {
+        while(vdata_free_list != NULL)
+          {
+            v               = vdata_free_list;
+            vdata_free_list = vdata_free_list->next;
+            v->next = NULL; 
+            HDfree(v);
+          } /* end while */
+      } /* end if */
+
+    /* Release the vsinstance free-list if it exists */
+    if(vsinstance_free_list != NULL)
+      {
+        while(vsinstance_free_list != NULL)
+          {
+            vs                   = vsinstance_free_list;
+            vsinstance_free_list = vsinstance_free_list->next;
+            vs->next = NULL; 
+            HDfree(vs);
+          } /* end while */
+      } /* end if */
+
+    /* free buffer */
+    if(Vhbuf != NULL)
+      {
+          HDfree(Vhbuf);
+          Vhbuf = NULL;
+          Vhbufsize = 0;
+      } /* end if */
+
+    /* free the parsing buffer */
+    ret_value = VPparse_shutdown();
+
+  return ret_value;
+} /* end VSPhshutdown() */
+
+/*******************************************************************************
+NAME
+  vsint
+
+DESCRIPTION
+  Looks thru vstab for vsid and return the addr of the vdata instance
+  where vsid is found.
+
+RETURNS
+  RETURNS NULL if error or not found.
+  RETURNS vsinstance_t pointer if ok.
+   
+*******************************************************************************/
+vsinstance_t *
+vsinst(HFILEID f,  /* IN: File handle */
+       uint16 vsid /* IN: vdata id i.e. ref */)
+{
+    void *      *t = NULL;
+    vfile_t    *vf = NULL;
+    int32       key;
+    vsinstance_t *ret_value = NULL; /* FAIL */
+    CONSTR(FUNC, "vsinstance");
+
+    /* clear error stack */
+    HEclear();
+
+    /* Get Vdata file record? */
+    if (NULL == (vf = Get_vfile(f)))
+        HGOTO_ERROR(DFE_FNF, NULL);
+
+    /* tbbtdfind returns a pointer to the vsinstance_t pointer */
+    key = (int32)vsid;
+    if (( t = (void * *) tbbtdfind(vf->vstree, &key, NULL))== NULL)
+        HGOTO_ERROR(DFE_NOMATCH,NULL);
+
+    /* return the actual vsinstance_t ptr */
+    ret_value = ((vsinstance_t *) * t);  
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* vsinst */
+
+/*******************************************************************************
+NAME
+  vexistvs
+
+DESCRIPTION
+  Tests if a vdata with id vsid is in the file's vstab.
+
+RETURNS
+  returns FAIL if not found,
+  returns TRUE if found.
+*******************************************************************************/
+int32
+vexistvs(HFILEID f,  /* IN: file handle */
+         uint16 vsid /* IN: vdata id i.e. ref */)
+{
+  return ((NULL==vsinst(f, vsid)) ? FAIL : TRUE);
+}   /* vexistvs */
+
+/* ------------------------------------------------------------------ */
+/*
+   The following 2 routines, vpackvs and vunpackvs, packs and unpacks
+   a VDATA structure into a compact form suitable for storing in the HDF file.
+ */
+
+/****
+CONTENTS of VS stored in HDF file with tag VSDESCTAG:
+    int16       interlace
+    int32       nvertices
+    uint16       vsize
+    int16       nfields
+
+    uint16       isize[1..nfields] (internal size of each field)
+    uint16       off[1..nfields] (internal offset of each field)
+    char        fname[1..nfields][FIELDNAMELENMAX]
+    char        vsname[VSNAMELENMAX]
+    char        vsclass[VSNAMELENMAX]
+    uint16      extag, exref
+    uint32      flags (for vset version 4 or higher )
+    int32       nattrs (if bit0 of flags is set)
+    uint16      atags[1..nattrs], arefs[1..nattrs]
+    int16       version, more
+****/
+
+/* ------------------------------- vpackvs ----------------------------------- */
+/*
+   The following 2 PRIVATE routines, vpackvs and vunpackvs, packs and unpacks
+   a VDATA structure into a compact form suitable for storing in the HDF file.
+ */
+
+/****
+CONTENTS of VS stored in HDF file with tag DFTAG_VH:
+    int16       interlace
+    int32       nvertices
+    uint16      vsize
+    int16       nfields
+
+    uint16      isize[1..nfields] (internal size of each field)
+    uint16      off[1..nfields] (internal offset of each field)
+    char        fname[1..nfields][FIELDNAMELENMAX]
+    char        vsname[VSNAMELENMAX]
+    char        vsclass[VSNAMELENMAX]
+
+****/
+
+/*******************************************************************************
+NAME
+  vpackvs
+
+DESCRIPTION
+   convert a vs struct to a vspack suitable for storage in a HDF file
+
+RETURNS
+   always SUCCEED?
+
+*******************************************************************************/
+intn
+vpackvs(VDATA * vs,  /* IN/OUT: */
+        uint8 buf[], /* IN: */
+        int32 *size  /* OUT: */)
+{
+#ifdef LATER
+    CONSTR(FUNC, "vpackvg");
+#endif /* LATER */
+
+    int32 i;
+    int16 slen;
+    uint8 *bb = NULL;
+    intn  ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    bb = &buf[0];
+
+    /* save the interlace */
+    INT16ENCODE(bb, vs->interlace);
+
+    /* save nvertices */
+    INT32ENCODE(bb, vs->nvertices);
+
+    /* save ivsize */
+    UINT16ENCODE(bb, vs->wlist.ivsize);
+
+    /* save nfields */
+    INT16ENCODE(bb, vs->wlist.n);
+
+    /* Skip over all the "wheel-spinning" for 0-field vdatas */
+    if(vs->wlist.n>0)
+      { 
+        for (i = 0; i < vs->wlist.n; i++)   /* save the type */
+            INT16ENCODE(bb, vs->wlist.type[i]);
+
+        /* save the isize */
+        for (i = 0; i < vs->wlist.n; i++)
+            UINT16ENCODE(bb, vs->wlist.isize[i]);
+
+        for (i = 0; i < vs->wlist.n; i++)   /* save the offset */
+            UINT16ENCODE(bb, vs->wlist.off[i]);
+
+        for (i = 0; i < vs->wlist.n; i++)   /* save the order */
+            UINT16ENCODE(bb, vs->wlist.order[i]);
+
+        /* save each field length and name - omit the null */
+        for (i = 0; i < vs->wlist.n; i++)
+          {
+              slen = HDstrlen(vs->wlist.name[i]);
+              INT16ENCODE(bb, slen);
+
+              HDstrcpy((char *) bb, vs->wlist.name[i]);
+              bb += slen;
+          }
+      } /* end if */
+
+    /* save the vsnamelen and vsname - omit the null */
+    slen = HDstrlen(vs->vsname);
+    INT16ENCODE(bb, slen);
+
+    HDstrcpy((char *) bb, vs->vsname);
+    bb += slen;
+
+    /* save the vsclasslen and vsclass- omit the null */
+    slen = HDstrlen(vs->vsclass);
+    INT16ENCODE(bb, slen);
+
+    HDstrcpy((char *) bb, vs->vsclass);
+    bb += slen;
+
+    /* save the expansion tag/ref pair */
+    UINT16ENCODE(bb, vs->extag);
+    UINT16ENCODE(bb, vs->exref);
+
+    /* save the version field - to version_3 now if no new feature */
+    INT16ENCODE(bb, vs->version);
+
+    /* save the 'more' field - NONE now */
+    INT16ENCODE(bb, vs->more);
+
+    if (vs->flags != 0)   
+      {  /* save the flags and update version # */
+       UINT32ENCODE(bb, vs->flags);
+
+       if (vs->flags & VS_ATTR_SET) 
+         { /* save attributes */
+          INT32ENCODE(bb, vs->nattrs);
+
+          for (i = 0; i < vs->nattrs; i++)  
+            {
+              INT32ENCODE(bb, vs->alist[i].findex);
+              UINT16ENCODE(bb, vs->alist[i].atag);
+              UINT16ENCODE(bb, vs->alist[i].aref);
+            }   /* for */
+         }  /* attr set */ 
+      }     /* flags set */   
+
+   /* duplicate 'version' and 'more' - for new version of libraries */
+   /* see the documentation in vattr.c */
+    INT16ENCODE(bb, vs->version);
+
+    /* save the 'more' field - NONE now */
+    INT16ENCODE(bb, vs->more);
+
+    *size = (int32) (bb - buf) + 1;
+    *bb = 0;
+
+#ifdef LATER
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+#endif /* LATER */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* vpackvs */
+
+/*******************************************************************************
+NAME
+  vunpackvs
+
+DESCRIPTION
+   Convert a packed form(from HDF file)  to a VDATA structure.
+   This routine will also initalize the VDATA structure as much as it can.
+
+RETURNS
+   SUCCEED / FAIL
+
+*******************************************************************************/
+PRIVATE     intn
+vunpackvs(VDATA * vs, /* IN/OUT: */
+          uint8 buf[],/* IN: */ 
+          int32 len   /* IN: */)
+{
+    uint8      *bb = NULL;
+    int32       i;
+    int16       int16var, temp;
+    uint16      uint16var;
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "vunpackvs");
+
+    /* clear error stack */
+    HEclear();
+
+    /* '5' is a magic number, the exact amount of space for 2 uint16's */
+    /* the magic number _should_ be '4', but the size of the Vdata */
+    /* information is incorrectly calculated (in vpackvs() above) when the */
+    /* info is written to the file and it's too late to change it now :- ( */
+    /* get version number first -- this is different from version 3
+       vdata interface */
+    bb = &buf[len - 5];
+    UINT16DECODE(bb, uint16var); /* retrieve the vg's version field */
+
+    vs->version = (int16)uint16var;
+    UINT16DECODE(bb, uint16var);     /* retrieve the vg's more field */
+
+    vs->more = (int16)uint16var;
+    bb = &buf[0];
+
+    if (vs->version <= 4)   
+      { 
+          /* retrieve interlace */
+          INT16DECODE(bb, vs->interlace);
+
+          /* retrieve nvertices */
+          INT32DECODE(bb, vs->nvertices);
+
+          /* retrieve tore ivsize */
+          UINT16DECODE(bb, vs->wlist.ivsize);
+
+          /* retrieve nfields */
+          INT16DECODE(bb, int16var);
+          vs->wlist.n = (intn)int16var;
+
+          if(vs->wlist.n==0)
+            {   /* Special case for Vdata with 0 fields defined */
+              /* Initialize buffer to NULL & carry over to other arrays */
+              vs->wlist.bptr = NULL;
+              vs->wlist.type = NULL;
+              vs->wlist.off = NULL;
+              vs->wlist.isize = NULL;
+              vs->wlist.order = NULL;
+              vs->wlist.esize = NULL;
+
+              /* Initialize the array of pointers to field names to NULL also */
+              vs->wlist.name = NULL;
+            } /* end if */
+          else
+            { /* Allocate buffer to hold all the int16/uint16 arrays */
+              if(NULL==(vs->wlist.bptr = HDmalloc(sizeof(uint16)*(size_t)(vs->wlist.n*5))))
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+              /* Use buffer to support the other arrays */
+              vs->wlist.type = (int16 *)vs->wlist.bptr;
+              vs->wlist.off = (uint16 *)vs->wlist.type+vs->wlist.n;
+              vs->wlist.isize = vs->wlist.off+vs->wlist.n;
+              vs->wlist.order = vs->wlist.isize+vs->wlist.n;
+              vs->wlist.esize = vs->wlist.order+vs->wlist.n;
+
+              for (i = 0; i < vs->wlist.n; i++)   /* retrieve the type */
+                  INT16DECODE(bb, vs->wlist.type[i]);
+
+              for (i = 0; i < vs->wlist.n; i++)   /* retrieve the isize */
+                  UINT16DECODE(bb, vs->wlist.isize[i]);
+
+              for (i = 0; i < vs->wlist.n; i++)   /* retrieve the offset */
+                  UINT16DECODE(bb, vs->wlist.off[i]);
+
+              for (i = 0; i < vs->wlist.n; i++)   /* retrieve the order */
+                  UINT16DECODE(bb, vs->wlist.order[i]);
+
+              /* retrieve the field names (and each field name's length)  */
+              if(NULL==(vs->wlist.name = HDmalloc(sizeof(char *)*(size_t)vs->wlist.n)))
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+              for (i = 0; i < vs->wlist.n; i++) 
+                {
+                    INT16DECODE(bb, int16var);    /* this gives the length */
+                    if(NULL==(vs->wlist.name[i] = HDmalloc((int16var+1)*sizeof(char))))
+                        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                    HIstrncpy(vs->wlist.name[i], (char *) bb, int16var + 1);
+
+                    bb += (size_t)int16var;
+                }
+            } /* end else */
+
+          /* retrieve the vsname (and vsnamelen)  */
+          INT16DECODE(bb, int16var);  /* this gives the length */
+
+          HIstrncpy(vs->vsname, (char *) bb, int16var + 1);
+          bb += (size_t)int16var;
+
+          /* retrieve the vsclass (and vsclasslen)  */
+          INT16DECODE(bb, int16var);  /* this gives the length */
+
+          HIstrncpy(vs->vsclass, (char *) bb, int16var + 1);
+          bb += (size_t)int16var;
+
+          /* retrieve the expansion tag and ref */
+          UINT16DECODE(bb, vs->extag);
+          UINT16DECODE(bb, vs->exref);
+
+          /* retrieve the middle version field */
+          INT16DECODE(bb, temp);
+          if (temp != vs->version) 
+              HGOTO_ERROR(DFE_BADVH, FAIL);
+
+          /* retrieve the 'more' field */
+          INT16DECODE(bb, temp);
+          if (temp != vs->more) 
+              HGOTO_ERROR(DFE_BADVH, FAIL);
+
+          if (vs->version == VSET_NEW_VERSION) 
+            { /* new features exist */
+                UINT32DECODE(bb, vs->flags);
+                if (vs->flags & VS_ATTR_SET)  
+                  {    /* get attr info */
+                      INT32DECODE(bb, vs->nattrs);
+
+                      if (NULL == (vs->alist = (vs_attr_t *)HDmalloc(vs->nattrs*sizeof(vs_attr_t))))
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                      for (i=0; i<vs->nattrs; i++)  
+                        {
+                            INT32DECODE(bb, vs->alist[i].findex);
+                            UINT16DECODE(bb, vs->alist[i].atag); 
+                            UINT16DECODE(bb, vs->alist[i].aref); 
+                        }  /* for */
+                  }     /* attr set */
+            }   /* new version */
+
+          if (vs->version <= VSET_OLD_TYPES)
+            {
+                for (i = 0; i < vs->wlist.n; i++)   /* save the type */
+                    vs->wlist.type[i] = map_from_old_types((intn)vs->wlist.type[i]);
+            }
+
+          /* --- EXTRA --- fill in the machine-dependent size fields */
+          for (i = 0; i < vs->wlist.n; i++)
+            {
+                vs->wlist.esize[i] = (uint16) (vs->wlist.order[i] *
+                                               DFKNTsize((int32) vs->wlist.type[i] | (int32) DFNT_NATIVE));
+            }
+      }  /* if version <= 4 */
+
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+	  /* Normal function cleanup */
+  return ret_value;
+}   /* vunpackvs */
+
+/*******************************************************************************
+NAME
+   vsdestroynode
+
+DESCRIPTION
+   Frees B-Tree nodes
+
+   *** Only called by B-tree routines, should _not_ be called externally ***
+   *** unless you know what your are doing                               ***
+
+RETURNS
+   Nothing
+
+*******************************************************************************/
+void
+vsdestroynode(void * n /* IN: Node in TBBT-tree */)
+{
+    VDATA  *vs = NULL;
+    intn   i;
+
+    if (n != NULL)
+      {
+          vs = ((vsinstance_t *) n)->vs;
+          if (vs != NULL)
+            {
+                /* Free the dynamicly allocated VData fields */
+                for(i=0; i<vs->wlist.n; i++)
+                    HDfree(vs->wlist.name[i]);
+
+                HDfree(vs->wlist.name);
+                HDfree(vs->wlist.bptr);
+
+                if(vs->rlist.item != NULL)
+                    HDfree(vs->rlist.item);
+
+                if (vs->alist != NULL)
+                    HDfree(vs->alist);
+
+                VSIrelease_vdata_node(vs);
+            } /* end if */
+
+          /* relase this instance to the free list ? */
+          VSIrelease_vsinstance_node((vsinstance_t *)n);
+      } /* end if 'n' */
+
+}   /* vsdestroynode */
+
+/*******************************************************************************
+ NAME
+    VSPgetinfo -- Read in the "header" information about the Vdata.
+
+ DESCRIPTION
+    This routine pre-reads the header information for a Vdata into memory
+    so that it can be accessed more quickly by the routines that need it.
+
+ RETURNS
+    Return a pointer to a VDATA filled with the Vdata information on success,
+    NULL on failure.
+
+*******************************************************************************/
+VDATA *
+VSPgetinfo(HFILEID f, /* IN: file handle */
+           uint16 ref /* IN: ref of the Vdata */)
+{
+	VDATA 		*vs = NULL;   /* new vdata to be returned */
+  /* int32       vh_length;   int32 is mismatches Vhbuf's type -- uint32 */
+    size_t vh_length;         /* length of the vdata header */
+    VDATA *ret_value = NULL;  /* FAIL */
+    CONSTR(FUNC, "VSPgetinfo");
+
+    /* clear error stack */
+    HEclear();
+ 
+    /* get a free Vdata node? */
+    if ((vs = VSIget_vdata_node()) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, NULL);
+ 
+    /* need to fetch length of vdata from file */
+    if ((vh_length = Hlength(f,DFTAG_VH,ref)) == FAIL)
+        HGOTO_ERROR(DFE_BADLEN, NULL);
+
+    if(vh_length > Vhbufsize)
+      {
+        Vhbufsize = vh_length;
+
+        if (Vhbuf != NULL)
+            HDfree(Vhbuf);
+
+        if ((Vhbuf = (uint8 *) HDmalloc(Vhbufsize)) == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, NULL);
+      } /* end if */
+
+    /* get Vdata header from file */
+    if (Hgetelement(f,DFTAG_VH,ref,Vhbuf) == FAIL)
+        HGOTO_ERROR(DFE_NOVS, NULL);
+ 
+    /* init all other fields in vdata 
+       and then unpack the vdata */
+    vs->otag    = DFTAG_VH;
+    vs->oref    = ref;
+    vs->f       = f;
+    if (FAIL == vunpackvs (vs,Vhbuf, vh_length))
+        HGOTO_ERROR(DFE_INTERNAL, NULL);
+ 
+    /* return vdata */
+    ret_value = (vs);
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+} /* end VSPgetinfo() */
+
+
+/*******************************************************************************
+NAME
+   VSattach
+
+DESCRIPTION
+   NEW VSattach:
+   (a)  if vsid == -1
+       if "r" access return error.
+       if "w" access
+       create a new vs in vg and attach it.
+       add to vsdir, set nattach= 1, nvertices = 0.
+
+   (b)  if (vsid > 0)
+       if "r" access => look in vsdir
+       if not found,
+       fetch  vs from file, add to vsdir,
+       set nattach= 1, nvertices = val from file.
+       if found,
+       check access of found vs
+       if "w" => being written, unstable! forbidden
+       if "r" => ok. incr nattach.
+
+       if "w" access => new data may be added BUT must be same format
+       as existing vdata.
+       (ie. VSsetfields must match old format exactly!!)
+
+   Allows for seeks to write.
+
+   in all cases, set the marked flag to 0.
+   returns NULL if error.
+
+   OLD VSattach:
+   if vsid == -1, then
+   (a) if vg is "w", create a new vs in vg and attach it.
+   add to vsdir, set nattach= 1, nvertices = 0.
+   (b) if vg is "r", forbidden.
+   if vsid is +ve, then
+   (a) if vg is "w"  => new data may be added BUT must be same format
+   as existing vdata.
+   (ie. VSsetfields must match old format exactly!!)
+
+   (b) if vg is "r"  => look in vsdir
+   if not found,
+   fetch  vs from file, add to vsdir,
+   set nattach= 1, nvertices = val from file.
+   if found,
+   check access of found vs
+   if "w" => being written, unstable! forbidden
+   if "r" => ok. incr nattach.
+
+   in all cases, set the marked flag to 0.
+   returns NULL if error.
+
+RETURNS
+
+
+*******************************************************************************/
+int32 
+VSattach(HFILEID f,             /* IN: file handle */
+         int32 vsid,            /* IN: vdata id i.e. ref */
+         const char *accesstype /* IN: access type */)
+{
+    VDATA        *vs = NULL;    /* new vdata to be returned */
+    vsinstance_t *w = NULL;
+    vfile_t      *vf = NULL;
+    int32        acc_mode;
+    int32      ret_value = FAIL;
+    CONSTR(FUNC, "VSattach");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check file and vdata handles */
+    if ((f == FAIL) || (vsid < -1))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata file record */
+    if (NULL == (vf = Get_vfile(f)))
+        HGOTO_ERROR(DFE_FNF, FAIL);
+
+    /* check access type and covert to internal mode? */
+    if (accesstype[0] == 'R' || accesstype[0] == 'r')
+        acc_mode = 'r';
+    else if (accesstype[0] == 'W' || accesstype[0] == 'w')
+        acc_mode = 'w';
+    else
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    /*      */
+    if (vsid == -1)
+      {  /* ---------- VSID IS -1 ----------------------- 
+            if "r" access return error.
+            if "w" access
+            create a new vs in vg and attach it.
+            add to vsdir, set nattach= 1, nvertices = 0.
+          */
+          if (acc_mode == 'r')
+              HGOTO_ERROR(DFE_BADACC, FAIL);
+
+          /* otherwise 'w' */
+          /* allocate space for vs,  & zero it out  */
+          if ((vs = VSIget_vdata_node()) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          vs->otag = DFTAG_VH;
+          vs->oref = Hnewref(f);
+          if (vs->oref == 0)
+            {
+                VSIrelease_vdata_node(vs);
+                HGOTO_ERROR(DFE_NOREF, FAIL);
+            }
+
+          vs->interlace = FULL_INTERLACE;   /* DEFAULT */
+          vs->access = 'w';
+          vs->f = f;
+          vs->version = VSET_VERSION;
+
+          /* attach new vs to file's vstab */
+          if (NULL == (w = VSIget_vsinstance_node()))
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+          vf->vstabn++;
+          w->key = (int32) vs->oref;  /* set the key for the node */
+          w->ref = (uintn) vs->oref;
+          w->vs = vs;
+          w->nattach = 1;
+          w->nvertices = 0;
+
+          /* insert the vs instance in B-tree */
+          tbbtdins(vf->vstree, w, NULL);    
+
+          vs->instance = w;
+      }     /* end of case where vsid is -1 */
+    else
+      { /*  --------  VSID IS NON_NEGATIVE ------------- 
+            if "r" access => look in vsdir
+            if not found,
+            fetch  vs from file, add to vsdir,
+            set nattach= 1, nvertices = val from file.
+            if found,
+            check access of found vs
+            if "w" => being written, unstable! forbidden
+            if "r" => ok. incr nattach.
+
+            if "w" access => new data may be added BUT must be same format
+            as existing vdata.
+            (ie. VSsetfields must match old format exactly!!)
+
+            Allows for seeks to write.
+
+            in all cases, set the marked flag to 0.
+            returns NULL if error.
+        */
+
+        if (NULL == (w = vsinst(f, (uint16) vsid)))
+            HGOTO_ERROR(DFE_VTAB, FAIL);
+
+        if (acc_mode == 'r')
+          {     /* reading an existing vdata */
+              /* this vdata is already attached for 'r', ok to do so again */
+	      /* then reset the read position to the beginning of the vdata */
+              if (w->nattach && w->vs->access == 'r')
+		{
+		  accrec_t *access_rec;	/* access record */
+
+                  w->nattach++;
+
+		  /* get the access_rec pointer to reset position */
+		  if ((access_rec = HAatom_object(w->vs->aid)) == NULL)
+		      HGOTO_ERROR(DFE_ARGS, FAIL);
+		  access_rec->posn = 0;	/* to fix bugzilla #486 - BMR, Dec, 05 */
+		}
+              else
+                {
+                  vs = w->vs;
+
+                  vs->access = 'r';
+                  vs->aid = Hstartread(vs->f, VSDATATAG, vs->oref);
+                  if (vs->aid == FAIL)
+                    HGOTO_ERROR(DFE_BADAID, FAIL);
+
+                  vs->instance = w;
+
+                  /* attach vs to vsdir  at the vdata instance w */
+                  w->nattach = 1;
+                  w->nvertices = vs->nvertices;
+                } /* end else */
+          }		/* end of case where vsid is positive, and "r"  */
+        else
+          {		/* writing to an existing vdata */
+              if (w->nattach)	/* vdata previously attached before */
+                  HGOTO_ERROR(DFE_BADATTACH, FAIL);
+
+              vs = w->vs;
+
+              vs->access = 'w';
+              vs->aid = Hstartwrite(vs->f, VSDATATAG, vs->oref, 0);
+              if (vs->aid == FAIL)
+                HGOTO_ERROR(DFE_BADAID, FAIL);
+
+              vs->instance = w;
+              vs->new_h_sz = 0;
+
+              /* attach vs to vsdir  at the vdata instance w */
+              w->nattach = 1;
+              w->nvertices = vs->nvertices;
+          }		/* end of case where vsid is positive, and "w"  */
+      } /* end else */
+
+    /* register this vdata with group */
+    ret_value = HAregister_atom(VSIDGROUP,w);
+
+    /* Make VDatas appendable by default */
+    if (FAIL == VSappendable(ret_value,VDEFAULTBLKSIZE))
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* VSattach */
+
+/*******************************************************************************
+NAME
+  VSdetach
+
+DESCRIPTION
+   Detach vs from vstab.
+
+   if vs has "w" access,   ( <=> only attached ONCE! )
+   decr nattach.
+   if (nattach is not  0)  => bad error in code.
+   if nvertices (in vs) is 0) just free vs from vstab.
+
+   if marked flag is 1
+   write out vs to file and set marked flag to 0.
+   free vs from vsdir.
+
+   if vs has "r" access,   ( <=> only attached ONCE! )
+   decr nattach.
+   if (nattach is 0)   just free vs from vstab.
+
+RETURNS
+   SUCCEED / FAIL
+
+*******************************************************************************/
+int32 
+VSdetach(int32 vkey /* IN: vdata key? */)
+{
+    int32       i;
+    int32       ret;
+    int32       vspacksize;
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSdetach");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vdata is part of vdata group */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    w->nattach--; /* detach from vdata */
+
+    /* --- case where access was 'r' --- */
+    if (vs->access == 'r')
+      {
+          if (w->nattach == 0)
+            { /* end access to vdata */
+              if (Hendaccess(vs->aid) == FAIL)
+                  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	      vs->aid = FAIL;
+
+              /* remove from atom list */
+              if(HAremove_atom(vkey)==NULL)
+                  HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            } /* end if */
+
+          /* we are done */
+          HGOTO_DONE(SUCCEED);
+      }
+    else /* must be write */
+      {
+          /* --- case where access was 'w' --- */
+          if (w->nattach != 0)
+              HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+          if (vs->marked)
+            {	/* if marked , write out vdata's VSDESC to file */
+                size_t need;
+
+                need = sizeof(VWRITELIST) + 
+                       (size_t)vs->nattrs*sizeof(vs_attr_t) + sizeof(VDATA) + 1;
+        
+                if(need > Vhbufsize)
+                  {
+                      Vhbufsize = need;
+                      if (Vhbuf)
+                          HDfree(Vhbuf);
+
+                      if ((Vhbuf = HDmalloc(Vhbufsize)) == NULL)
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                  } /* end if */
+
+                if (FAIL == vpackvs(vs, Vhbuf, &vspacksize))
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+                /* if VH size changed we need to re-use the tag/ref
+                 * for new header. This will cause the pointer to the
+                 * original vdata header to be lost but this is okay.  */
+                if (vs->new_h_sz)
+                  { 
+                      /* check if tag/ref exists in DD list already */
+                      switch(HDcheck_tagref(vs->f, DFTAG_VH, vs->oref))
+                        {
+                        case 0: /* not found */
+                            break;
+                        case 1: /* found, reuse tag/ref */
+                            if (HDreuse_tagref(vs->f, DFTAG_VH, vs->oref) == FAIL)
+                                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                            break;
+                        case -1: /* error */
+                            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                        default: /* should never get here */
+                            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                        }
+                  }
+
+                /* write new one */
+                ret = Hputelement(vs->f, VSDESCTAG, vs->oref, Vhbuf, vspacksize);
+                if (ret == FAIL)
+                    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+                vs->marked = 0;
+                vs->new_h_sz = 0;
+            }
+
+          /* remove all defined symbols */
+          for (i = 0; i < vs->nusym; i++)
+              HDfree(vs->usym[i].name);
+
+          if(vs->usym!=NULL)
+              HDfree(vs->usym);   /* free the actual array */
+
+          vs->nusym = 0;
+          vs->usym=NULL;
+
+          /* end access to vdata */
+          if (Hendaccess(vs->aid) == FAIL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	  vs->aid = FAIL;
+
+          /* remove vdata from atom list */
+          if(HAremove_atom(vkey)==NULL)
+              HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+      } /* end of 'write' case */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VSdetach */
+
+/*******************************************************************************
+ NAME
+   VSappendable
+
+ DESCRIPTION
+    Make it possible to append unlimitedly to an existing VData
+ 
+  RETURNS   
+      SUCCEED, or FAIL for error
+*******************************************************************************/ 
+int32 
+VSappendable(int32 vkey, /* IN: vdata key */
+             int32 blk   /* IN: */)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VSappendable");
+
+    /* clear error stack */
+    HEclear();
+
+    /* shut compiler up */
+    blk = blk;
+
+    /* check vdata key is a valid */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get Vdata itself and check */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if(vs->aid == 0)
+        vs->aid = Hstartaccess(vs->f, VSDATATAG, vs->oref, DFACC_RDWR|DFACC_APPENDABLE);
+    else
+        ret_value = Happendable(vs->aid);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSappendable */
+
+/*******************************************************************************
+NAME
+   VSgetid
+
+DESCRIPTION
+   returns the id of the next  VDATA from the file f .
+   (vsid = -1 gets the 1st vDATA).
+
+RETURNS
+   RETURNS -1 on error.
+   RETURNS vdata id (0 or +ve integer)
+
+*******************************************************************************/
+int32
+VSgetid(HFILEID f,  /* IN: file handle */
+        int32 vsid  /* IN: vdata id i.e. ref */)
+{
+    vsinstance_t *w = NULL;
+    vfile_t      *vf = NULL;
+    void *        *t = NULL;
+    int32        key;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSgetid");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check valid vdata id */
+    if (vsid < -1)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata file record */
+    if (NULL == (vf = Get_vfile(f)))
+        HGOTO_ERROR(DFE_FNF, FAIL);
+
+    if (vsid == -1)
+      { /* vsid '-1' case */
+
+        if (vf->vstree==NULL) 
+            HGOTO_DONE(FAIL);
+
+        if ((t = (void **)tbbtfirst((TBBT_NODE *) * (vf->vstree))) == NULL)
+            HGOTO_DONE(FAIL);
+
+        /* we assume 't' is valid at this point */
+        w = (vsinstance_t *) * t; /* get actual pointer to the vsinstance_t */
+        HGOTO_DONE((int32)w->ref);/* rets 1st vdata's ref */
+      }
+    else /* vsid >= 0 */ 
+      {
+          /* tbbtdfind returns a pointer to the vsinstance_t pointer */
+          key = (int32)vsid;
+          t = (void * *) tbbtdfind(vf->vstree, &key, NULL);
+
+          if (t == NULL)  /* couldn't find the old vsid */
+              ret_value = (FAIL);
+          else if (NULL == (t = (void * *) tbbtnext((TBBT_NODE *) t)))  /* get the next node in the tree */
+              ret_value = (FAIL);
+          else
+            {
+                w = (vsinstance_t *) * t;   /* get actual pointer to the vsinstance_t */
+                ret_value = (int32)w->ref;  /* rets vdata's ref */
+            }     /* end else */
+      }
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSgetid */
+
+/*******************************************************************************
+NAME
+   VSQuerytag
+
+DESCRIPTION
+   get the 'otag' of the given Vdata
+
+RETURNS
+   Return the 'otag' of the given Vdata
+   Return FAIL on failure
+
+*******************************************************************************/
+int32
+VSQuerytag(int32 vkey /* IN: vdata key */)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VSQuerytag");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check vdata key is a valid */
+    if (HAatom_group(vkey) != VSIDGROUP)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,FAIL);
+
+    /* get Vdata itself and check */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* return otag of vdata */
+    ret_value = ((int32) vs->otag);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* VSQuerytag */
+
+/*******************************************************************************
+NAME
+  VSQueryref
+
+DESCRIPTION
+  get the ref of the the given Vdata
+
+RETURNS
+   Return the ref of the given Vdata
+   Return FAIL on failure
+
+*******************************************************************************/
+int32
+VSQueryref(int32 vkey /* IN: vdata key */)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VSQueryref");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check vdata key is a valid */
+    if (HAatom_group(vkey) != VSIDGROUP)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,FAIL);
+
+    /* get Vdata itself and check */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* return ref of vdata */
+    ret_value = ((int32) vs->oref);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}	/* VSQueryref */
+
+/*******************************************************************************
+NAME
+   vswritelist
+
+DESCRIPTION
+   get the 'writelist' of the given vdata
+
+RETURNS
+   return the 'writelist' of the vdata if successful else NULL
+
+*******************************************************************************/
+DYN_VWRITELIST *
+vswritelist(int32 vkey /* IN: vdata key */)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    DYN_VWRITELIST *ret_value = NULL; /* Failure */
+    CONSTR(FUNC, "VSwritelist");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check vdata key is a valid */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, NULL);
+
+    /* get Vdata itself and check */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+        HGOTO_ERROR(DFE_ARGS, NULL);
+
+    /* return 'writelist' */
+    ret_value = (&(vs->wlist));
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* vswritelist() */
+
+/*******************************************************************************
+NAME
+  VSgetversion
+
+DESCRIPTION
+  get the version nuber of the vdata
+
+RETURNS
+  return the version number if successful else '0'.
+
+*******************************************************************************/
+int32
+VSgetversion(int32 vkey /* IN: vdata key */)
+{
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VSgetversion");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check vdata key is a valid */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, 0);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, 0);
+
+    /* get Vdata itself and check */
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+        HGOTO_ERROR(DFE_ARGS, 0);
+
+    /* return version number */
+    ret_value = (int32)vs->version;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* end VSgetversion() */
+
+/*******************************************************************************
+NAME
+  VSdelete
+
+DESCRIPTION
+   Remove a Vdata from its file.  This function will both remove the Vdata
+   from the internal Vset data structures as well as from the file.
+   'vsid' is actually the 'ref' of the vdata.
+
+   (i.e. it calls tbbt_delete() and Hdeldd())
+
+RETURNS
+   Return FAIL / SUCCEED
+
+*******************************************************************************/
+int32
+VSdelete(int32 f,    /* IN: file handle */
+         int32 vsid  /* IN: vdata id i.e. ref */)
+{
+    void *       v;
+    vfile_t    *vf = NULL;
+    void *      *t = NULL;
+    int32       key;
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "VSdelete");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check valid vdata id */
+    if (vsid < -1)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata file record */
+    if (NULL == (vf = Get_vfile(f)))
+      HGOTO_ERROR(DFE_FNF,FAIL);
+
+    /* find vdata in TBBT using it's ref */
+    key = vsid;
+    if (( t = (void * *) tbbtdfind(vf->vstree, &key, NULL))== NULL)
+        HGOTO_DONE(FAIL);
+
+    /* remove vdata from TBBT */
+    v = tbbtrem((TBBT_NODE **) vf->vstree, (TBBT_NODE *) t, NULL);
+
+    /* destroy vdata node itself*/
+    if (v != NULL)
+        vsdestroynode(v);
+
+    /* delete vdata header and data from file */
+    if (Hdeldd(f, DFTAG_VS, (uint16) vsid) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    if (Hdeldd(f, DFTAG_VH, (uint16) vsid) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VSdelete */
diff --git a/hdf/src/vparse.c b/hdf/src/vparse.c
new file mode 100644
index 0000000..2ba3c58
--- /dev/null
+++ b/hdf/src/vparse.c
@@ -0,0 +1,181 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+/* $Id: vparse.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*****************************************************************************
+
+ file - vparse.c
+
+ Part of the HDF VSet interface.
+
+ NOTE: Another pass needs to made through this file to update some of
+       the comments about certain sections of the code. -GV 9/8/97
+
+************************************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+#define ISCOMMA(c) ( (c==',') ? 1:0 )
+
+PRIVATE char *symptr[VSFIELDMAX];       /* array of ptrs to tokens  ? */
+PRIVATE char sym[VSFIELDMAX][FIELDNAMELENMAX + 1];  /* array of tokens ? */
+PRIVATE intn nsym;              /* token index ? */
+
+/* Temporary buffer for I/O */
+PRIVATE uint32 Vpbufsize = 0;
+PRIVATE uint8 *Vpbuf = NULL;
+
+/*******************************************************************************
+ NAME
+   scanattrs
+
+ DESCRIPTION
+   Given a string (attrs) , the routine parses it into token strings,
+   and returns a ptr (attrv) to an array of ptrs where the tokens
+   are stored.  The number of tokens are returned in attrc.
+   
+   Currently used only by routines that manipulate field names.
+   As such each field string is truncated to a max length of
+   FIELDNAMELENMAX (as defined in hdf.h). For most cases, this
+   truncation doesn't happen because FIELDNAMELENMAX is a big number.
+   
+   Current implementation: all strings inputs converted to uppercase.
+   tokens must be separated by COMMAs.
+   
+   Tokens are stored in static area sym , and pointers are returned
+   to calling routine. Hence, tokens must be used before next call
+   to scanattrs.
+
+ RETURNS
+    Returns SUCCEED/FAIL
+
+*******************************************************************************/
+int32 
+scanattrs(const char *attrs, 
+          int32 *attrc, 
+          char ***attrv)
+{
+    CONSTR(FUNC, "scanattrs");
+    char *s, *s0, *ss;
+    intn len;
+    size_t slen = HDstrlen(attrs)+1;
+
+    if(slen>Vpbufsize)
+      {
+        Vpbufsize = slen;
+        if (Vpbuf)
+            HDfree((VOIDP) Vpbuf);
+        if ((Vpbuf = (uint8 *) HDmalloc(Vpbufsize)) == NULL)
+            HRETURN_ERROR(DFE_NOSPACE, FAIL);
+      } /* end if */
+
+    HDstrcpy((char *)Vpbuf,attrs);
+    s = (char *)Vpbuf;
+    nsym = 0;
+
+    s0 = s;
+    while (*s)
+      {
+
+#ifdef VDATA_FIELDS_ALL_UPPER
+          if (*s >= 'a' && *s <= 'z')
+              *s = (char) toupper(*s);
+#endif /* VDATA_FIELDS_ALL_UPPER */
+
+          if (ISCOMMA(*s))
+            {
+
+                /* make sure we've got a legitimate length */
+                len = (intn) (s - s0);
+                if (len <= 0)
+                    return (FAIL);
+
+                /* save that token */
+                ss = symptr[nsym] = sym[nsym];
+                nsym++;
+
+                /* shove the string into our static buffer.  YUCK! */
+                if (len > FIELDNAMELENMAX)
+                    len = FIELDNAMELENMAX;
+                HIstrncpy(ss, s0, len + 1);
+
+                /* skip over the comma */
+                s++;
+
+                /* skip over white space before the next field name */
+                while (*s && *s == ' ')
+                    s++;
+
+                /* keep track of the first character of the next token */
+                s0 = s;
+
+            }
+          else
+            {
+
+                /* move along --- nothing to see here */
+                s++;
+            }
+      }
+
+    /* save the last token */
+    len = (intn) (s - s0);
+    if (len <= 0)
+        return (FAIL);
+    ss = symptr[nsym] = sym[nsym];
+    nsym++;
+
+    if (len > FIELDNAMELENMAX)
+        len = FIELDNAMELENMAX;
+    HIstrncpy(ss, s0, len + 1);
+
+    symptr[nsym] = NULL;
+    *attrc = nsym;
+    *attrv = (char **) symptr;
+
+    return (SUCCEED);   /* ok */
+}   /* scanattrs */
+
+/*******************************************************************************
+ NAME
+    VPparse_shutdown  --  Free the Vpbuf buffer.
+
+ DESCRIPTION
+    For completeness, when the VSet interface is shut-down, free the Vpbuf.
+
+    Should only ever be called by the "atexit" function HDFend
+
+ RETURNS
+    Returns SUCCEED/FAIL
+
+*******************************************************************************/
+intn
+VPparse_shutdown(void)
+{
+    intn ret_value = SUCCEED;
+
+    if(Vpbuf != NULL)
+      {
+        HDfree(Vpbuf);
+        Vpbuf = NULL;
+        Vpbufsize = 0;
+      } /* end if */
+
+    return ret_value;
+} /* end VSPhshutdown() */
+
diff --git a/hdf/src/vrw.c b/hdf/src/vrw.c
new file mode 100644
index 0000000..e705fb6
--- /dev/null
+++ b/hdf/src/vrw.c
@@ -0,0 +1,802 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6026 $";
+#endif
+
+/* $Id: vrw.c 6026 2014-01-16 15:16:16Z bmribler $ */
+
+/***********************************************************************
+*
+* vrw.c
+* Part of the HDF VSet interface.
+* This module handles reading and writing of Vdatas.
+*
+
+LOCAL ROUTINES
+ VSPshutdown  --  Free the Vtbuf buffer.
+
+EXPORTED ROUTINES
+ VSseek  -- Seeks to an element boundary within a vdata i.e. 2nd element.
+ VSread  -- Reads a specified number of elements' worth of data from a vdata.
+             Data will be returned to you interlaced in the way you specified.
+ VSwrite -- Writes a specified number of elements' worth of data to a vdata.
+	     You must specify how your data in your buffer is interlaced.
+             Creates an aid, and writes it out if this is the first time.
+
+ NOTE: Another pass needs to made through this file to update some of
+       the comments about certain sections of the code. -GV 9/8/97
+
+************************************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.h"
+
+#ifndef MIN
+#define MIN(a,b)     ((a) < (b) ? (a) : (b))
+#endif /* MIN */
+
+PRIVATE uint32 Vtbufsize = 0;
+PRIVATE uint8 *Vtbuf = NULL;
+
+/*******************************************************************************
+ NAME
+    VSPshutdown  --  Free the Vtbuf buffer.
+
+ DESCRIPTION
+    For completeness, when the VSet interface is shut-down, free the Vtbuf.
+
+    Should only ever be called by the "atexit" function HDFend
+
+ RETURNS
+    Returns SUCCEED/FAIL
+
+*******************************************************************************/
+intn 
+VSPshutdown(void)
+{
+  intn  ret_value = SUCCEED;
+
+  /* free global buffers */
+  if(Vtbuf != NULL)
+    {
+      HDfree(Vtbuf);
+      Vtbuf = NULL;
+      Vtbufsize = 0;
+    } /* end if */
+
+  /* Clear the local buffers in vio.c */
+  ret_value = VSPhshutdown();
+
+  return ret_value;
+} /* end VSPshutdown() */
+
+/*******************************************************************************
+NAME
+   VSseek
+
+DESCRIPTION
+   Seeks to an element boundary within a vdata
+   Vdata must be attached with "r" or "w" access.
+   Specify eltpos = 0 for 1st element, 1 for 2nd element etc.
+
+   (eg  returns 5 if seek to the 6th element, etc)
+
+RETURNS
+   RETURNS FAIL on error
+   RETURNS position of element seeked to (0 or a +ve integer)
+
+*******************************************************************************/
+int32
+VSseek(int32 vkey,   /* IN: vdata key */
+       int32 eltpos  /* IN: element position in vdata */)
+{
+    int32        ret;
+    int32        offset;
+    vsinstance_t *w = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VSseek");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vdata is part of vdata group */
+    if (HAatom_group(vkey)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it. Check element postion also. */
+    vs = w->vs;
+    if ((vs == NULL) || (eltpos < 0))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Don't allow seeks in 0-field vdatas */
+    if (vs->wlist.n<=0)
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+
+    /* calculate offset of element in vdata */
+    offset = eltpos * vs->wlist.ivsize;
+
+    /* seek to element */
+    if (( ret = Hseek(vs->aid, offset, DF_START)) == FAIL)
+        HGOTO_ERROR(DFE_BADSEEK, FAIL);
+
+    ret_value = (eltpos);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VSseek */
+
+/*******************************************************************************
+NAME
+   VSread
+
+DESCRIPTION
+   Reads a specified number of elements' worth of data from a vdata.
+   Data will be returned to you interlaced in the way you specified.
+
+RETURNS
+   RETURNS FAIL if error
+   RETURNS the number of elements read (0 or a +ve integer).
+
+*******************************************************************************/
+int32 
+VSread(int32 vkey,       /* IN: vdata key */
+       uint8 buf[],      /* IN/OUT: space to put elements in */
+       int32 nelt,       /* IN: number of elements to read */
+       int32 interlace   /* IN: interlace to return elements in 'buf' */)
+{
+    intn isize = 0;
+    intn order = 0;
+    intn index = 0;
+    intn esize = 0;
+    intn hsize = 0;
+    uint8 *Src;
+    uint8 *b1 = NULL;
+    uint8 *b2 = NULL;
+    int32  i, j;
+    int32  nv;
+    int32  offset;
+    int32  type;
+    int32  uvsize;         /* size of "element" as NEEDED by user */
+    int32  total_bytes;     /* total number of bytes that need to be read in */
+    int32  bytes;           /* number of elements / bytes to read next time */
+    int32  chunk;           /* number of records in a buffer */
+    int32  done;            /* number of records to do / done */
+    DYN_VWRITELIST *w = NULL;
+    DYN_VREADLIST  *r = NULL;
+    vsinstance_t   *wi = NULL;
+    VDATA          *vs = NULL;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VSread");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vdata is part of vdata group */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (wi = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = wi->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check access id and number of vertices in vdata */
+    if ((vs->aid == 0) || (vs->nvertices == 0))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Don't allow reads in 0-field vdatas */
+    if (vs->wlist.n<=0)
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+
+    /* check if vdata exists in file */
+    if (vexistvs(vs->f, vs->oref) == FAIL)
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* check interlace parameter */
+    if (interlace != FULL_INTERLACE && interlace != NO_INTERLACE)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* read/write lists */
+    w = &(vs->wlist);
+    r = &(vs->rlist);
+    hsize = (intn)vs->wlist.ivsize;   /* size as stored in HDF */
+    total_bytes = hsize * nelt;
+
+    /*
+       Now, convert and repack field(s) from Vtbuf into buf.
+
+       This section of the code deals with interlacing. In all cases
+       the items for each of the fields are converted and shuffled
+       around from the internal buffer "Vtbuf" to the user's buffer
+       "buf".
+
+       There are 5 cases :
+       (A) user=NO_INTERLACE   & vdata=FULL_INTERLACE)
+       (B) user=NO_INTERLACE   & vdata=NO_INTERLACE)
+       (C) user=FULL_INTERLACE & vdata=FULL_INTERLACE)
+       (D) user=FULL_INTERLACE & vadat=NO_INTERLACE)
+       (E) SPECIAL CASE when only one field.
+
+       Cases (A)-(D) handles multiple fields.
+       Case (E) handles reading from a Vdata with a single field.
+
+       Cases (E) and (C) are the most frequently used.  Limit buffer
+       allocations to VDATA_BUFFER_MAX size so that we conserve
+       memory.  Doing this involves a certain degree of added code
+       complexity so don't bother doing it for the less frequent
+       cases.  Cases E and C have been rolled together since they are
+       very similar and both need the incremental writing.
+
+     */
+
+    /* ----------------------------------------------------------------- */
+    /* CASE  (E + C): Easy to unroll case */
+    if ((w->n == 1) || (interlace == FULL_INTERLACE && vs->interlace == FULL_INTERLACE))
+      {
+          /*
+           * figure out how many elements we can move at a time and
+           * make sure our buffer is big enough
+           */
+
+          if ((uint32) total_bytes < Vtbufsize)
+            {
+                chunk = nelt;
+            }
+          else
+            {
+                int32       buf_size;
+
+                /* we are bounded above by VDATA_BUFFER_MAX */
+                buf_size = MIN(total_bytes, VDATA_BUFFER_MAX);
+
+                /* make sure there is at least room for one record in our buffer */
+                chunk = buf_size / hsize + 1;
+
+                /* get a buffer big enough to hold the values */
+                Vtbufsize = (size_t)chunk * (size_t)hsize;
+                if (Vtbuf)
+                    HDfree(Vtbuf);
+                if ((Vtbuf = (uint8 *) HDmalloc(Vtbufsize)) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          done = 0;
+
+          /* set loop invariant parameters */
+          Src = buf;
+          bytes = hsize * chunk;
+
+          for (uvsize = 0, j = 0; j < r->n; j++)
+              uvsize += w->esize[r->item[j]];
+
+          while (done < nelt)
+            {
+
+            /* chunk has changed so update the byte counts */
+            if (nelt - done < chunk)
+              {
+                  chunk = nelt - done;
+                  bytes = hsize * chunk;
+              }
+
+            /* ================ start reading ============================== */
+            if ((nv = Hread(vs->aid, bytes, (uint8 *) Vtbuf)) != bytes)
+              {
+                  HERROR(DFE_READERROR);
+                  HEreport("Tried to read %d, only read %d", bytes, nv);
+                  HGOTO_DONE(FAIL);
+              }
+
+            /* CASE  (E): Only a single field in the Vdata */
+            if (w->n == 1)
+              {
+                  DFKconvert(Vtbuf,Src,w->type[0], (uint32) w->order[0] * (uint32)chunk, DFACC_READ, 0, 0);
+              }     /* case (e) */
+            /* ----------------------------------------------------------------- */
+            /* CASE  (C):  iu=full, iv=full */
+            else
+              {
+                  offset = 0;
+                  for (j = 0; j < r->n; j++)
+                    {
+                        i = r->item[j];
+                        b1 = Src + offset;
+                        b2 = Vtbuf + (size_t)w->off[i];
+                        type = (int32)w->type[r->item[j]];
+                        esize = (intn)w->esize[i];
+                        isize = (intn)w->isize[i];
+                        order = (intn)w->order[i];
+
+                        for (index = 0; index < order; index++)
+                          {
+                              DFKconvert(b2, b1, type, (uint32) chunk, DFACC_READ, (uint32) hsize, (uint32) uvsize);
+                              b1 += (int) esize / order;
+                              b2 += (int) isize / order;
+                          }
+                        offset += esize;
+                    }
+                } /* case (E) */
+
+                /* record what we've done and move to next group */
+                done += chunk;
+                Src += chunk * uvsize;
+            } /* end while */
+          }     /* case (C + E) */
+    else {
+	  /* 
+	   * Handle the other cases now.
+	   * These cases are less frequent so don't bother unrolling
+	   *   the loops for now.  As a result, we may get into memory
+	   *   problems since we may end up allocating a huge buffer
+	   */
+
+        /* alloc space (Vtbuf) for reading in the raw data from vdata */
+        if (Vtbufsize < (size_t)nelt * (size_t) hsize)
+          {
+              Vtbufsize = (size_t)nelt * (size_t) hsize;
+              if (Vtbuf)
+                  HDfree(Vtbuf);
+              if ((Vtbuf = (uint8 *) HDmalloc(Vtbufsize)) == NULL)
+                  HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          }
+
+        /* ================ start reading ============================== */
+
+        nv = Hread(vs->aid, nelt * hsize, (uint8 *) Vtbuf);
+
+        if (nv != nelt * hsize)
+          {
+              HERROR(DFE_READERROR);
+              HEreport("Tried to read %d, only read %d", nelt * hsize, nv);
+              HGOTO_DONE(FAIL);
+          }
+
+        /* ----------------------------------------------------------------- */
+        /* CASE  (A):  user=none, vdata=full */
+        if (interlace == NO_INTERLACE && vs->interlace == FULL_INTERLACE)
+          {
+              b1 = buf;
+              for (j = 0; j < r->n; j++)
+                {
+                    i = r->item[j];
+                    b2 = Vtbuf + (size_t)w->off[i];
+                    type = (int32)w->type[i];
+                    isize = (intn)w->isize[i];
+                    esize = (intn)w->esize[i];
+                    order = (intn)w->order[i];
+
+                    for (index = 0; index < order; index++)
+                      {
+                          DFKconvert(b2, b1, type, (uint32) nelt, DFACC_READ, (uint32) hsize, (uint32) esize);
+                          b2 += isize / order;
+                          b1 += esize / order;
+                      }
+                    b1 += ((nelt - 1) * esize);
+                }
+          }     /* case (a) */
+
+        /* ----------------------------------------------------------------- */
+        /* CASE  (B):  user=none, vdata=none */
+        else if (interlace == NO_INTERLACE && vs->interlace == NO_INTERLACE)
+          {
+              b1 = buf;
+              for (j = 0; j < r->n; j++)
+                {
+                    i = r->item[j];
+                    b2 = Vtbuf + (size_t)w->off[i] * (size_t)nelt;
+                    type = (int32)w->type[i];
+                    esize = (intn)w->esize[i];
+                    isize = (intn)w->isize[i];
+                    order = (intn)w->order[i];
+
+                    for (index = 0; index < order; index++)
+                      {
+                          DFKconvert(b2, b1, type, (uint32) nelt, DFACC_READ, (uint32) isize, (uint32) esize);
+                          b1 += esize / order;
+                          b2 += isize / order;
+                      }
+                    b1 += ((nelt - 1) * esize);
+                }
+          }     /* case (b) */
+
+        /* ----------------------------------------------------------------- */
+        /* CASE  (D):  user=full, vdata=none */
+        else if (interlace == FULL_INTERLACE && vs->interlace == NO_INTERLACE)
+          {
+
+              for (uvsize = 0, j = 0; j < r->n; j++)
+                  uvsize += w->esize[r->item[j]];
+
+              offset = 0;
+              for (j = 0; j < r->n; j++)
+                {
+                    i = r->item[j];
+                    b1 = buf + offset;
+                    b2 = Vtbuf + (size_t)w->off[i] * (size_t)nelt;
+                    type = (int32)w->type[i];
+                    isize = (intn)w->isize[i];
+                    esize = (intn)w->esize[i];
+                    order = (intn)w->order[i];
+
+                    for (index = 0; index < order; index++)
+                      {
+                          DFKconvert(b2, b1, type, (uint32) nelt, DFACC_READ, (uint32) isize, (uint32) uvsize);
+                          b1 += esize / order;
+                          b2 += isize / order;
+                      }
+                    offset += isize;
+                }
+          }     /* case (d) */
+      } /* end else, cases a, b, and d */
+
+    ret_value = (nelt);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSread */
+
+/*******************************************************************************
+NAME
+   VSwrite
+
+DESCRIPTION
+   Writes a specified number of elements' worth of data to a vdata.
+   You must specify how your data in your buffer is interlaced.
+
+   NEW
+   create an aid, and write out if this is the first time.
+   (otherwise) subsequent writes result in link-blocks.
+
+RETURNS
+   RETURNS FAIL if error
+   RETURNS the number of elements written (0 or a +ve integer).
+
+*******************************************************************************/
+int32 
+VSwrite(int32 vkey,         /* IN: vdata key */
+        const uint8 buf[],  /* IN: elements to write to vdata */
+        int32 nelt,         /* IN: number of elements */
+        int32 interlace     /* IN: interlace of elements 'buf' */)
+{
+    intn isize = 0;
+    intn order = 0;
+    intn index = 0;
+    intn esize = 0;
+    uint8 *dest = NULL;
+    const uint8 *src, *Src;
+    int32       j;
+    int32       type;
+    int32       offset;
+    int32       position = 0;
+    int32       new_size;
+    int32       status;
+    int32       total_bytes;    /* total number of bytes that need to be written out */
+    DYN_VWRITELIST *w = NULL;
+    int32       int_size;       /* size of "element" as needed by user in memory */
+    intn        hdf_size = 0;   /* size of record in HDF file */
+    vsinstance_t *wi = NULL;
+    VDATA        *vs = NULL;
+    int32       bytes;          /* number of elements / bytes to write next time */
+    int32       chunk;
+    int32       done;    /* number of records to do / done */
+    int32       ret_value = SUCCEED;
+    CONSTR(FUNC, "VSwrite");
+
+    /* clear error stack */
+    HEclear();
+
+    /* check if vdata is part of vdata group */
+    if (HAatom_group(vkey) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (wi = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it. Also check number of elements */
+    vs = wi->vs;
+    if ((nelt <= 0) || (vs == NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* check if write access to vdata */
+    if (vs->access != 'w')
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    /* check if vdata exists in the file */
+    if (FAIL == vexistvs(vs->f, vs->oref))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get write list */
+    w = & vs->wlist;
+    if (w->n == 0)
+      {
+          HERROR(DFE_NOVS);
+          HEreport("No fields set for writing");
+          HGOTO_DONE(FAIL);
+      }
+
+    /* check interlace of input buffer */
+    if (interlace != NO_INTERLACE && interlace != FULL_INTERLACE)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    hdf_size = (intn)w->ivsize;   /* as stored in HDF file */
+    total_bytes = hdf_size * nelt;
+
+    /* make sure we have a valid AID */
+    if (vs->aid == 0)
+      {
+#ifdef OLD_WAY
+          vs->aid = Hstartwrite(vs->f, DFTAG_VS, vs->oref, total_bytes);
+          if (vs->aid == FAIL)
+              HGOTO_ERROR(DFE_BADAID, FAIL);
+#else /* OLD_WAY */
+          HGOTO_ERROR(DFE_BADAID, FAIL);
+#endif /* OLD_WAY */
+      }
+
+    /*
+     * promote to link-block if vdata exists and is not already one
+     *  AND we are increasing its size
+     */
+    HQueryposition(vs->aid, &position);
+    new_size = (position / (intn)vs->wlist.ivsize) + nelt;
+
+    /* this should really be cached in the Vdata structure */
+    for (int_size = 0, j = 0; j < w->n; j++)
+        int_size += w->esize[j];
+
+    /*
+       First, convert and repack field(s) from Vtbuf into buf.
+
+       This section of the code deals with interlacing. In all cases
+       the items for each of the fields are converted and shuffled
+       around from the user's buffer "buf" to the internal's buffer
+       "Vtbuf".  The data in "Vtbuf" is then written out to the vdata.
+
+       There are 5 cases :
+       (A) user=NO_INTERLACE   & vdata=FULL_INTERLACE)
+       (B) user=NO_INTERLACE   & vdata=NO_INTERLACE)
+       (C) user=FULL_INTERLACE & vdata=FULL_INTERLACE)
+       (D) user=FULL_INTERLACE & vadat=NO_INTERLACE)
+       (E) SPECIAL CASE when only one field.
+
+       Cases (A)-(D) handles multiple fields
+       Case (E) handles single field Vdatas
+
+       Cases (E) and (C) are the most frequently used.  Limit buffer
+       allocations to VDATA_BUFFER_MAX size so that we conserve
+       memory.  Doing this involves a certain degree of added code
+       complexity so don't bother doing it for the less frequent
+       cases.  Cases E and C have been rolled together since they are
+       very similar and both need the incremental writing.
+
+       --------------------------------------------------------------------- */
+    /* CASE  (E + C): Easy to unroll case */
+    if ((w->n == 1) || (interlace == FULL_INTERLACE && vs->interlace == FULL_INTERLACE))
+      {
+
+          /*
+           * figure out how many elements we can move at a time and
+           * make sure our buffer is big enough
+           */
+
+          if ((uint32) total_bytes < Vtbufsize)
+            {
+                chunk = nelt;
+            }
+          else
+            {
+                int32       buf_size;
+
+                /* we are bounded above by VDATA_BUFFER_MAX */
+                buf_size = MIN(total_bytes, VDATA_BUFFER_MAX);
+
+                /* make sure there is at least room for one record in our buffer */
+                chunk = buf_size / hdf_size + 1;
+
+                /* get a buffer big enough to hold the values */
+                Vtbufsize = (size_t)chunk * (size_t)hdf_size;
+                if (Vtbuf)
+                    HDfree(Vtbuf);
+                if ((Vtbuf = (uint8 *) HDmalloc(Vtbufsize)) == NULL)
+                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
+            }
+
+          done = 0;
+
+          /* set loop invariant parameters */
+          Src = buf;
+          dest = Vtbuf;
+          bytes = hdf_size * chunk;
+
+          while (done < nelt)
+            {
+
+                /* chunk has changed so update the byte counts */
+                if (nelt - done < chunk)
+                  {
+                      chunk = nelt - done;
+                      bytes = hdf_size * chunk;
+                  }
+/*
+   printf("Case E/C: [%d,%d] writing %d (elems) %d bytes\n", done, nelt, chunk, bytes);
+ */
+
+                offset = 0;
+                for (j = 0; j < w->n; j++)
+                  {
+                      src = Src + offset;
+                      dest = Vtbuf + (size_t)w->off[j];
+                      type = (int32)w->type[j];
+                      esize = (intn)w->esize[j];
+                      isize = (intn)w->isize[j];
+                      order = (intn)w->order[j];
+
+                      for (index = 0; index < order; index++)
+                        {
+                            DFKconvert((VOIDP)src, dest, type, (uint32) chunk, DFACC_WRITE, (uint32) int_size, (uint32) hdf_size);
+                            dest += isize / order;
+                            src += esize / order;
+                        }
+                      offset += esize;
+                  }
+
+                /* write the converted data to the file */
+                status = Hwrite(vs->aid, bytes, (uint8 *) Vtbuf);
+                if (status != bytes)
+                    HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+                /* record what we've done and move to next group */
+                done += chunk;
+                Src += chunk * int_size;
+            }
+
+      }     /* case (C + E) */
+
+    else
+      {
+
+	  /* 
+	   * Handle the other cases now.
+	   * These cases are less frequent so don't bother unrolling
+	   *   the loops for now.  As a result, we may get into memory
+	   *   problems since we may end up allocating a huge buffer
+	   */
+
+	  /* alloc space (Vtbuf) for writing out the data */
+	  if (Vtbufsize < (uint32) total_bytes)
+	    {
+          Vtbufsize = (uint32)total_bytes;
+          if (Vtbuf)
+              HDfree(Vtbuf);
+          if ((Vtbuf = (uint8 *) HDmalloc(Vtbufsize)) == NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+	    }
+
+	  /* ----------------------------------------------------------------- */
+	  /* CASE  (A):  user=none, vdata=full */
+	  if (interlace == NO_INTERLACE && vs->interlace == FULL_INTERLACE)
+	    {
+
+		src = buf;
+		for (j = 0; j < w->n; j++)
+		  {
+		      dest = Vtbuf + (size_t)w->off[j];
+		      type = (int32)w->type[j];
+		      esize = (intn)w->esize[j];
+		      isize = (intn)w->isize[j];
+		      order = (intn)w->order[j];
+
+		      for (index = 0; index < order; index++) {
+			    DFKconvert((VOIDP)src, dest, type, (uint32) nelt, DFACC_WRITE, (uint32) esize, (uint32) hdf_size);
+			    src += esize / order;
+			    dest += isize / order;
+			  }
+		      src += ((nelt - 1) * esize);
+		  }
+
+	    }	/* case (a) */
+
+	  /* --------------------------------------------------------------------- */
+	  /* CASE  (B):  user=none, vdata=none */
+	  else if (interlace == NO_INTERLACE && vs->interlace == NO_INTERLACE)
+	    {
+
+		src = buf;
+		for (j = 0; j < w->n; j++)
+		  {
+		      dest = Vtbuf + w->off[j] * nelt;
+		      type = (int32)w->type[j];
+		      esize = (intn)w->esize[j];
+		      isize = (intn)w->isize[j];
+		      order = (intn)w->order[j];
+
+		      for (index = 0; index < order; index++) {
+			    DFKconvert((VOIDP)src, dest, type, (uint32) nelt, DFACC_WRITE, (uint32) esize, (uint32) isize);
+			    dest += isize / order;
+			    src += esize / order;
+			  }
+		      src += ((nelt - 1) * esize);
+		  }
+
+	    }	/* case (b) */
+
+	  /* ----------------------------------------------------------------- */
+	  /* CASE  (D):  user=full, vdata=none */
+	  else if (interlace == FULL_INTERLACE && vs->interlace == NO_INTERLACE)
+	    {
+		offset = 0;
+		for (j = 0; j < w->n; j++)
+		  {
+		      src = buf + offset;
+		      dest = Vtbuf + w->off[j] * nelt;
+		      type = (int32)w->type[j];
+		      isize = (intn)w->isize[j];
+		      esize = (intn)w->esize[j];
+		      order = (intn)w->order[j];
+
+		      for (index = 0; index < order; index++) {
+			    DFKconvert((VOIDP)src, dest, type, (uint32) nelt, DFACC_WRITE, (uint32) int_size, (uint32) isize);
+			    dest += isize / order;
+			    src += esize / order;
+  			  }
+		      offset += esize;
+		  }
+	    }	/* case (d) */
+
+	  status = Hwrite(vs->aid, total_bytes, (uint8 *) Vtbuf);
+	  if (status != total_bytes)
+	      HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+
+      }     /* cases a, b, and d */
+
+    /* update the internal structure to reflect write */
+    if (new_size > vs->nvertices)
+        vs->nvertices = new_size;
+    vs->marked = 1;
+
+    ret_value = (nelt);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VSwrite */
+
diff --git a/hdf/src/vsfld.c b/hdf/src/vsfld.c
new file mode 100644
index 0000000..bb30116
--- /dev/null
+++ b/hdf/src/vsfld.c
@@ -0,0 +1,1151 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5760 $";
+#endif
+
+/* $Id: vsfld.c 5760 2012-01-20 12:53:37Z bmribler $ */
+
+/*****************************************************************************
+* vsetf.c
+* Part of the HDF VSet interface.
+*
+
+LOCAL ROUTINES
+
+EXPORTED ROUTINES
+ VSIZEOF      -- returns the machine size of a field type.
+ VSsetfields  -- sets the fields in a vdata for reading or writing.
+                 Truncates each field to max length of FIELDNAMELENMAX.
+ VSfdefine    -- Defines a (one) new field within the vdata.
+ VFnfields    -- Return the number of fields in this Vdata.
+ VFfieldname  -- Return the name of the given field in this Vdata. 
+ VFfieldtype  -- Return the type of the given field in this Vdata.
+ VFfieldisize -- Return the internal (HDF) size of the given 
+                  field in this Vdata. 
+ VFfieldesize -- Return the external (local machine) size of the given 
+                  field in this Vdata.
+ VFfieldorder -- Return the order of the given field in this Vdata.
+ VSfpack      -- pack into or unpack from a buf the values of fully
+                  interlaced fields (of the entire record).
+
+************************************************************************/
+
+#define VSET_INTERFACE
+#include "hdf.h"
+#include <stdarg.h>
+
+/*
+   ** ==================================================================
+   ** PRIVATE data areas and routines
+   ** ==================================================================
+   * */
+
+static const SYMDEF rstab[] =
+{
+    {"PX", DFNT_FLOAT32, SIZE_FLOAT32, 1},
+    {"PY", DFNT_FLOAT32, SIZE_FLOAT32, 1},
+    {"PZ", DFNT_FLOAT32, SIZE_FLOAT32, 1},
+
+    {"IX", DFNT_INT32, SIZE_INT32, 1},
+    {"IY", DFNT_INT32, SIZE_INT32, 1},
+    {"IZ", DFNT_INT32, SIZE_INT32, 1},
+
+    {"NX", DFNT_FLOAT32, SIZE_FLOAT32, 1},
+    {"NY", DFNT_FLOAT32, SIZE_FLOAT32, 1},
+    {"NZ", DFNT_FLOAT32, SIZE_FLOAT32, 1},
+
+};
+
+#define NRESERVED ( sizeof(rstab)/sizeof(SYMDEF) )
+
+/* ------------------------------------------------------------------ */
+/*
+   ** sets the fields in a vdata for reading or writing
+   ** RETURNS FAIL if error, and SUCCEED if ok.
+   ** truncates each field to max length of  FIELDNAMELENMAX.
+ */
+intn 
+VSsetfields(int32 vkey, const char *fields)
+{
+    char      **av;
+    int32       ac, found;
+    intn j, i;
+    uint16       uj;
+    uint16       order;
+    int32       value;
+    DYN_VREADLIST  *rlist;
+    DYN_VWRITELIST *wlist;
+    vsinstance_t *w;
+    VDATA      *vs;
+    intn       ret_value = FAIL;
+    CONSTR(FUNC, "VSsetfields");
+
+    /* check if a NULL field list is passed in, then return with
+       error (bug #554) - BMR 4/30/01 */
+    if (fields == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if ((scanattrs(fields, &ac, &av) == FAIL) || (ac == 0))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+
+     /* check number of fields limit  */
+     if (ac > VSFIELDMAX)
+         HGOTO_ERROR(DFE_SYMSIZE,FAIL);
+
+    /*
+     * write to an empty vdata : set the write list but do not set the
+     *   read list cuz there is nothing there to read yet...
+     */
+    if (vs->access == 'w')
+       {
+        if (vs->nvertices == 0)
+           {
+              wlist=&(vs->wlist);
+              if (wlist->n == 0) /* fields not set yet, Sept. 96. */
+                /* do not re-set fields if they were already set. */
+              {
+                  wlist->ivsize = 0;
+                  wlist->n = 0;
+
+              /* allocate space for the internal WRITELIST structures */
+                  /* Allocate buffer to hold all the int16/uint16 arrays */
+                  if((wlist->bptr=HDmalloc(sizeof(uint16)*(size_t)(ac*5)))==NULL)
+                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+
+                  /* Use buffer to support the other arrays */
+                  wlist->type=(int16 *)wlist->bptr;
+                  wlist->off=(uint16 *)wlist->type+ac;
+                  wlist->isize=wlist->off+ac;
+                  wlist->order=wlist->isize+ac;
+                  wlist->esize=wlist->order+ac;
+                  if((wlist->name=HDmalloc(sizeof(char *)*(size_t)ac))==NULL)
+                    {
+                      HDfree(wlist->bptr);
+                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                    } /* end if */
+
+                  for (i = 0; i < ac; i++)
+                    {
+                        found = FALSE;
+                    /* --- first look in the user's symbol table --- */
+                        for (j = 0; j < vs->nusym; j++)
+                            if (!HDstrcmp(av[i], vs->usym[j].name))
+                              {
+                                  found = TRUE;
+                                
+                                  if((wlist->name[wlist->n]=HDstrdup(vs->usym[j].name))==NULL)
+                                   {
+                                      HDfree(wlist->name);
+                                      HDfree(wlist->bptr);
+                                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                    } /* end if */
+                                  order = vs->usym[j].order;
+                                  wlist->type[wlist->n] = vs->usym[j].type;
+                                  wlist->order[wlist->n] = order;
+
+                                  value = order * DFKNTsize(vs->usym[j].type | DFNT_NATIVE);
+                                  if (value == FAIL)
+                                      HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+                                  wlist->esize[wlist->n] = (uint16) value;
+
+                                  value = order * vs->usym[j].isize;
+                                  if (value > MAX_FIELD_SIZE)
+                                      HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+                                  wlist->isize[wlist->n] = (uint16) value;
+
+                                  value = (int32) wlist->ivsize + (int32) (wlist->isize[wlist->n]);
+                                  if (value > MAX_FIELD_SIZE)
+                                      HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+                                  wlist->ivsize = (uint16) value;
+
+                                  wlist->n++;
+                                  break;
+                              }
+
+                    /* --- now look in the reserved symbol table --- */
+                        if (!found)
+                          {
+                              for (j = 0; j < (intn)NRESERVED; j++)
+                                  if (!HDstrcmp(av[i], rstab[j].name))
+                                    {
+                                        found = TRUE;
+
+                                        if((wlist->name[wlist->n]=HDstrdup(rstab[j].name))==NULL)
+                                          {
+                                            HDfree(wlist->name);
+                                            HDfree(wlist->bptr);
+                                            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                          } /* end if */
+                                        order = rstab[j].order;
+                                        wlist->type[wlist->n] = rstab[j].type;
+                                        wlist->order[wlist->n] = order;
+                                        value = order * DFKNTsize(rstab[j].type | DFNT_NATIVE);
+                                        if (value == FAIL)
+                                          HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+                                        wlist->esize[wlist->n] = (uint16) value;
+                                        wlist->isize[wlist->n] = (uint16) (order * rstab[j].isize);
+                                        wlist->ivsize += (uint16) (wlist->isize[wlist->n]);
+                                        wlist->n++;
+                                        break;
+                                    }
+                          }
+                        if (!found)     /* field is not a defined field - error  */
+                            HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+                    }
+
+              /* *********************************************************** */
+              /* compute and save the fields' offsets */
+                   for (uj = 0, i = 0; i < wlist->n; i++)
+                    {
+                        wlist->off[i] = (uint16) uj;
+                        uj += wlist->isize[i];
+                    }
+
+                  vs->marked = TRUE; /* mark vdata as being modified */
+                  vs->new_h_sz = TRUE; /* mark vdata header size being changed */
+
+                  HGOTO_DONE(SUCCEED); /* OK */
+              } /* if wlist->n == 0 */
+          } /* writing to empty vdata */
+      } /* writing to vdata */
+
+    /*
+     *   No matter the access mode, if there are elements in the VData
+     *      we should set the read list
+     */
+    if (vs->nvertices > 0)
+      {
+          rlist = &(vs->rlist);
+          rlist->n = 0;
+          if(rlist->item!=NULL)
+              HDfree(rlist->item);
+          rlist->item=NULL;
+
+          /* Allocate enough space for the read list */
+          if((rlist->item=(intn *)HDmalloc(sizeof(intn)*(size_t)(ac)))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE, FAIL);
+          for (i = 0; i < ac; i++)
+            {
+                found = FALSE;
+                for (j = 0; j < vs->wlist.n; j++)
+                    if (!HDstrcmp(av[i], vs->wlist.name[j]))
+                      {     /*  see if field exist */
+                          found = TRUE;
+
+                          rlist->item[rlist->n] = j;    /* save as index into wlist->name */
+                          rlist->n++;
+                          break;
+                      }
+                if (!found)     /* field does not exist - error */
+                    HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+            }
+        ret_value=SUCCEED;
+      }     /* setting read list */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VSsetfields */
+
+/* ------------------------------------------------------------------ */
+/*
+   ** defines a (one) new field within the vdata
+   ** return FAIL if error
+   ** return SUCCEED if success
+ */
+intn 
+VSfdefine(int32 vkey, const char *field, int32 localtype, int32 order)
+{
+    char      **av;
+    int32       ac;
+    int16       isize, replacesym;
+    intn        usymid;
+    intn j;
+    vsinstance_t *w;
+    VDATA      *vs;
+    intn       ret_value = SUCCEED;
+    CONSTR(FUNC, "VSfdefine");
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    vs = w->vs;
+    if ((vs == NULL) || (scanattrs(field, &ac, &av) == FAIL) || (ac != 1))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* The order of a variable is stored in a 16-bit number, so have to keep this limit -QAK */
+    if (order < 1 || order > MAX_ORDER)
+        HGOTO_ERROR(DFE_BADORDER, FAIL);
+    /* don't forget to check for field size limit */
+    isize = (int16)DFKNTsize(localtype);
+    if ( (isize == FAIL) || (isize * order) > MAX_FIELD_SIZE )
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+
+    /*
+     ** check for any duplicates
+     */
+#ifdef OLD_WAY
+/* It's OK to over-ride pre-defined symbols with the user's own -QAK */
+    /* --- first look in the reserved symbol table --- */
+    for (j = 0; j < NRESERVED; j++)
+        if (!HDstrcmp(av[0], rstab[j].name))
+          {
+              if (localtype != rstab[j].type && order != rstab[j].order)
+                  break;
+          }
+#endif /* OLD_WAY */
+
+    /* --- then look in the user's symbol table --- */
+    for (replacesym = 0, j = 0; j < vs->nusym; j++)
+        if (!HDstrcmp(av[0], vs->usym[j].name))
+          {
+              if (localtype != rstab[j].type && order != rstab[j].order)
+                {
+                    replacesym = 1;
+                    break;
+                }
+          }
+
+    if (replacesym)
+        usymid = j;     /* new definition will replace old at this index */
+    else
+      {
+          SYMDEF *tmp_sym=vs->usym;  /* temp. pointer to the new symdef list */
+
+          usymid = (intn)vs->nusym;
+          /* use temporary pointer in case we run out of memory, so we don't loose original list */
+          if (tmp_sym == NULL)
+           {
+             if((tmp_sym=(SYMDEF *) HDmalloc(sizeof(SYMDEF)*(size_t)(usymid+1)))==NULL)
+              HGOTO_ERROR(DFE_NOSPACE,FAIL);
+            }
+          else
+            {
+              if((tmp_sym=(SYMDEF *) HDrealloc(tmp_sym,sizeof(SYMDEF)*(size_t)(usymid+1)))==NULL)
+                  HGOTO_ERROR(DFE_NOSPACE,FAIL);
+            }
+          vs->usym=tmp_sym;
+      } /* end else */
+
+      vs->usym[usymid].isize = (uint16) isize; /* ok, because number
+          type sizes are smaller than max(int16) */
+
+    /* Copy the symbol [field] information */
+    if ((vs->usym[usymid].name = (char *) HDstrdup(av[0]) ) == NULL)
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    vs->usym[usymid].type = (int16) localtype;
+    vs->usym[usymid].order = (uint16) order;
+
+    /* increment vs->nusym only if no user field has been redefined */
+    if (!replacesym)
+        vs->nusym++;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VSfdefine */
+
+/* ------------------------------ VFnfields ------------------------------- */
+/*
+   Return the number of fields in this Vdata
+   Return FAIL on failure
+ */
+int32
+VFnfields(int32 vkey)
+{
+    vsinstance_t *w;
+    VDATA      *vs;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VFnfields");
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,FAIL);
+
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    ret_value = ((int32) vs->wlist.n);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VFnfields */
+
+/* ----------------------------- VFfieldname ------------------------------ */
+/*
+   Return the name of the given field in this Vdata.
+   This is just a pointer to the string in local memory and is only guarenteed
+   to be valid as long as we are VSattached() to this Vdata
+
+   Return NULL on failure
+ */
+char       *
+VFfieldname(int32 vkey, int32 index)
+{
+    vsinstance_t *w;
+    VDATA      *vs;
+    char       *ret_value = NULL; /* FAIL */
+    CONSTR(FUNC, "VFfieldname");
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+      HGOTO_ERROR(DFE_ARGS,NULL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,NULL);
+
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,NULL);
+
+    if (vs->wlist.n == 0)
+      HGOTO_ERROR(DFE_BADFIELDS,NULL);
+
+    ret_value = ((char *) vs->wlist.name[index]);
+
+done:
+  if(ret_value == NULL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VFfieldname */
+
+/* ----------------------------- VFfieldtype ------------------------------ */
+/*
+   Return the type of the given field in this Vdata.
+
+   Return FAIL on failure
+ */
+int32
+VFfieldtype(int32 vkey, int32 index)
+{
+    vsinstance_t *w;
+    VDATA      *vs;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VFfeildtype");
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,FAIL);
+
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    if (vs->wlist.n == 0)
+      HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+    ret_value = ((int32) vs->wlist.type[index]);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VFfieldtype */
+
+/* ----------------------------- VFfieldisize ------------------------------ */
+/*
+   Return the internal size of the given field in this Vdata.
+   (internal to HDF file, see VWRITELIST in vg.h. 4/3/96) 
+
+   Return FAIL on failure
+ */
+int32
+VFfieldisize(int32 vkey, int32 index)
+{
+    vsinstance_t *w;
+    VDATA      *vs;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VFfieldisize");
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,FAIL);
+
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    if (vs->wlist.n == 0)
+      HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+    ret_value = ((int32) vs->wlist.isize[index]);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VFfieldisize */
+
+/* ----------------------------- VFfieldesize ------------------------------ */
+/*
+   Return the external size of the given field in this Vdata.
+   (external to HDF file, see VWRITELIST in vg.h. 4/3/96) 
+
+   Return FAIL on failure
+ */
+int32
+VFfieldesize(int32 vkey, int32 index)
+{
+    vsinstance_t *w;
+    VDATA      *vs;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VFfieldesize");
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,FAIL);
+
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    if (vs->wlist.n == 0)
+      HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+    ret_value = ((int32) vs->wlist.esize[index]);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}   /* VFfieldesize */
+
+/* ----------------------------- VFfieldorder ------------------------------ */
+/*
+   Return the order of the given field in this Vdata.
+
+   Return FAIL on failure
+ */
+int32
+VFfieldorder(int32 vkey, int32 index)
+{
+    vsinstance_t *w;
+    VDATA      *vs;
+    int32      ret_value = SUCCEED;
+    CONSTR(FUNC, "VFfieldorder");
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+      HGOTO_ERROR(DFE_NOVS,FAIL);
+
+    vs = w->vs;
+    if ((vs == NULL) || (vs->otag != VSDESCTAG))
+      HGOTO_ERROR(DFE_ARGS,FAIL);
+
+    if (vs->wlist.n == 0)
+      HGOTO_ERROR(DFE_BADFIELDS,FAIL);
+
+    ret_value = ((int32) vs->wlist.order[index]);
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}	/* VFfieldorder */
+
+/* -------------------------- VSsetexternalfile --------------------------- */
+/*
+
+ NAME
+	VSsetexternalfile -- store Vdat info in a separate file
+ USAGE
+	int32 VSsetexternalfile(id, filename, offset)
+        int32   id;                  IN: vdata ID
+        char  * filename;            IN: name of external file
+        int32   offset;              IN: offset in external file
+ RETURNS
+        Return SUCCEED or FAIL
+
+ DESCRIPTION
+        Specify that the actual data for this Vdata be stored in a 
+        separate file (an "external file" in HDF terms).
+
+        Only the data (as in VSwrite()) will be stored externally.  
+        Attributes and such will still be in the main file
+
+        IMPORTANT:  It is the user's responsibility to see that the 
+        separate files are transported with the main file.
+FORTRAN
+	vsfsextf
+
+--------------------------------------------------------------------------- */
+
+intn VSsetexternalfile(int32 vkey, const char *filename, int32 offset)
+{
+    CONSTR(FUNC, "VSsetexternalfile");
+    int32       ret_value = SUCCEED;
+
+    vsinstance_t *w;
+    VDATA      *vs;
+    intn       status;
+
+    if(!filename || offset < 0)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (HAatom_group(vkey)!=VSIDGROUP)
+	    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    vs = w->vs;
+    if (vs->access != 'w')
+        HGOTO_ERROR(DFE_BADACC, FAIL);
+
+    if (FAIL == vexistvs(vs->f, vs->oref))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    if(!w->ref)
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* no need to give a length since the element already exists */
+    /* The Data portion of a Vdata is always stored in linked blocks. */
+    /* So, use the special tag */
+    status = (intn)HXcreate(vs->f, (uint16)VSDATATAG, (uint16) w->ref,
+		      filename, offset, (int32)0);
+    if(status != FAIL)
+      {
+        if((vs->aid != 0) && (vs->aid != FAIL))
+            Hendaccess(vs->aid);
+        vs->aid = status;
+      }
+    else
+        ret_value = FAIL;
+
+done:
+    if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+    /* Normal function cleanup */
+
+    return ret_value;
+} /* VSsetexternalfile */
+
+/* -------------------------- VSgetexternalfile --------------------------- */
+/*
+
+ NAME
+	VSgetexternalfile -- gets external file name and offset
+ USAGE
+	int32 VSgetexternalfile(id, name_len, filename, offset)
+        int32  vkey;            IN: vdata ID
+	size_t name_len;        IN: length of buffer for external file name
+        char  *extfilename;     IN: external file name
+        int32 *offset;          IN: offset in external file
+ RETURNS
+        Returns length of the external file name or FAIL.  If the vdata
+	does not have external element, the length will be 0.
+
+ DESCRIPTION
+        IMPORTANT:  It is the user's responsibility to see that the 
+        separate files are transported with the main file.
+ FORTRAN
+	N/A
+
+--------------------------------------------------------------------------- */
+
+intn VSgetexternalfile(int32 vkey, uintn buf_size, char *ext_filename, int32 *offset)
+{
+    CONSTR(FUNC, "VSgetexternalfile");
+    vsinstance_t *w;
+    VDATA *vs;
+    sp_info_block_t info_block;
+    intn  actual_len = 0;
+    intn  ret_value = SUCCEED;
+
+    if (HAatom_group(vkey) != VSIDGROUP)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* Get the vdata structure */
+    vs = w->vs;
+
+    /* Vdata should have an aid */
+    if (vs->aid == 0 || vs->aid == FAIL)
+        HGOTO_ERROR(DFE_ARGS, FAIL)
+    else
+    {
+	HDmemset(&info_block, 0, sizeof(sp_info_block_t));
+
+	/* HDget_special_info gets the special type and the special info */
+        if (HDget_special_info(vs->aid, &info_block) == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL)
+
+	/* If the vdata has external element, return the external file info */
+	if (info_block.key == SPECIAL_EXT)
+	{
+	    /* If the file name is not available, the file is probably
+		corrupted, so we need to report it. */
+	    if (info_block.path == NULL || HDstrlen(info_block.path) <= 0)
+		ret_value = FAIL;
+	    else
+	    {
+		size_t ext_file_len = HDstrlen(info_block.path);
+
+		/* If caller requests the length of the external file name
+		   only, return the length */
+		if (buf_size == 0)
+		    actual_len = (intn)ext_file_len;
+		else
+		{
+		    /* Caller requests file name, so buffer must not be NULL */
+		    if (ext_filename == NULL)
+			HGOTO_ERROR(DFE_ARGS, FAIL);
+
+		    /* Get the name and its length */
+		    HDstrncpy(ext_filename, info_block.path, buf_size);
+		    actual_len = buf_size < ext_file_len ? buf_size : ext_file_len;
+
+		    /* Get the offset in the external file if it's requested */
+		    if (offset != NULL)
+			*offset = info_block.offset;
+		} /* buf_size != 0 */
+		ret_value = actual_len;
+	    }
+	}
+	/* Not external */
+	else
+	    ret_value = FAIL;
+    }
+done:
+    if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+    /* Normal function cleanup */
+    return ret_value;
+} /* VSgetexternalfile */
+
+/* -------------------------- VSgetexternalinfo --------------------------- */
+/*
+
+ NAME
+	VSgetexternalinfo -- gets external file name and offset
+ USAGE
+	int32 VSgetexternalinfo(id, name_len, filename, offset)
+        int32  vkey;            IN: vdata ID
+	uintn  buf_size;        IN: length of buffer for external file name
+        char  *extfilename;     IN: external file name
+        int32 *offset;          IN: offset in external file, where data starts
+        int32 *length;          IN: length of data in external file
+ RETURNS
+        Returns length of the external file name or FAIL.  If the vdata
+	does not have external element, the length will be 0.
+
+ DESCRIPTION
+	VSgetexternalinfo gets the external file's name and the external data's
+	offset and length, which specify the location and size of the data in
+	the external file.
+
+	buf_size specifies the size of the buffer ext_filename.  When buf_size
+	is 0, VSgetexternalinfo will simply return the length of the external
+	file name, and not the file name itself.
+
+	When the element is not special, VSgetexternalinfo will return 0.  If
+	the element is SPECIAL_EXT, but the external file name doesn't exist,
+	VSgetexternalinfo will return FAIL.
+
+        IMPORTANT:  It is the user's responsibility to see that the 
+        separate files are transported with the main file.
+ FORTRAN
+	N/A
+
+--------------------------------------------------------------------------- */
+
+intn VSgetexternalinfo(int32 vkey, uintn buf_size, char *ext_filename, int32 *offset, int32 *length)
+{
+    CONSTR(FUNC, "VSgetexternalinfo");
+    vsinstance_t *w;
+    VDATA *vs;
+    intn   actual_fname_len = 0;
+    intn   ret_value = SUCCEED;
+
+    if (HAatom_group(vkey) != VSIDGROUP)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Locate vs's index in vstab */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* Get the vdata structure */
+    vs = w->vs;
+
+    /* Vdata should have an aid */
+    if (vs->aid == 0 || vs->aid == FAIL)
+        HGOTO_ERROR(DFE_ARGS, FAIL)
+    else
+    {
+	intn retcode = 0;
+	sp_info_block_t info_block;
+	HDmemset(&info_block, 0, sizeof(sp_info_block_t));
+
+	/* Get the special info */
+	retcode = HDget_special_info(vs->aid, &info_block);
+
+	/* When HDget_special_info returns FAIL, it could be the element is not
+	   special or some failure occur internally, info_block.key will be
+	   FAIL in the former case */
+	if (retcode == FAIL)
+	{
+	    if (info_block.key == FAIL)
+		ret_value = 0;	/* not a special elem, no external file name */
+
+	    /* Some failure occurred in HDget_special_info */
+	    else
+		HGOTO_ERROR(DFE_ARGS, FAIL)
+	}
+
+	/* If the vdata has external element, get the external info */
+	else if (info_block.key == SPECIAL_EXT)
+	{
+	    /* If the file name is not available, the file is probably
+		corrupted, so we need to report it. */
+	    if (info_block.path == NULL || HDstrlen(info_block.path) <= 0)
+		ret_value = FAIL;
+	    else
+	    {
+		intn tmp_len = (intn)info_block.length_file_name;
+
+		/* If caller requests the length of the external file name
+		   only, return the length */
+		if (buf_size == 0)
+		    actual_fname_len = tmp_len;
+		else
+		{
+		    /* Caller requests file name, so buffer must not be NULL */
+		    if (ext_filename == NULL)
+			HGOTO_ERROR(DFE_ARGS, FAIL);
+
+		    /* Compute the length of the name to be returned: if
+		       requested buffer size is smaller, use that value for
+		       name's length, but that means file name could be
+		       truncated! */
+		    actual_fname_len = (intn)buf_size < tmp_len ? (intn)buf_size : tmp_len;
+
+		    /* Get the name */
+		    HDstrncpy(ext_filename, info_block.path, buf_size);
+
+		    /* Get offset/length of the external data if requested */
+		    if (offset != NULL)
+			*offset = info_block.offset;
+                    if (length != NULL)
+                        *length = info_block.length;
+		} /* buf_size != 0 */
+		ret_value = actual_fname_len;
+	    }
+	}
+	/* Special, but not external */
+	else
+	    ret_value = 0;	/* no external file name */
+    }
+done:
+    if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+    /* Normal function cleanup */
+    return ret_value;
+} /* VSgetexternalinfo */
+
+/*----------------------------------------------------------------- 
+NAME
+    VSfpack -- pack into or unpack from a buf the values of fully
+              interlaced fields.
+USAGE
+    intn VSfpack(int32 vsid, intn packtype, char *fields_in_buf,
+         void * buf, intn bufsz, intn n_records, char *fields, void * fldbufpt[])
+    int32 vsid; IN: vdata id.
+    intn packtype; IN: 
+         _HDF_VSPACK(0) -- pack field values into vdata buf;
+         _HDF_VSUNPACK(1) -- unpack vdata value into filed bufs.
+    char *fields_in_buf; IN: 
+         fields in buf to write to or read from vdata. NULL 
+         stands for all fields in the vdata.
+    void * buf; IN: buffer for vdata values.
+    intn bufsz; IN: buf size in byte.
+    intn n_records; IN: number of records to pack or unpack.
+    char *fields; IN: 
+         names of the fields to be pack/unpack. It may be a 
+         subset of the fields_in_buf. NULL stands for all 
+         fields in buf. 
+    void * fldbufpt[]; IN: array of pointers to field buffers.
+RETURNS
+    SUCCEED(0) on success; FIAL(-1) otherwise.
+DESCRIPTION
+    1. This pack/unpack routine is convenient for users. It also 
+       serves for FORTRAN programs to pack/unpack numeric and 
+       non-numeric fields.
+    2. The caller should supply correct number of field buffers, 
+       which should agree with the number of fields to be 
+       packed/unpacked. 
+    3. For packtype = _HDF_VSPACK, the calling sequence should be:
+          VSsetfields,  VSfpack, and VSwrite;
+       For packtype = _HDF_VSUNPACK, the calling sequence should be:
+          VSsetfields, VSread and VSfpack.
+*/
+
+/*---------------------------------------------------------*/
+
+intn VSfpack(int32 vsid, intn packtype, const char *fields_in_buf,
+         void * buf, intn bufsz, intn n_records, const char *fields, void * fldbufpt[])
+{
+    CONSTR(FUNC, "VSfpack");
+
+    int32 ac;
+    char **av, *s;
+    uint8 *bufp = (uint8 *)buf;
+    uint8 **fbufps=NULL;
+    int32 b_rec_size, *fmsizes=NULL, *foffs=NULL; 
+    intn i, j, found, ret_value = SUCCEED;
+    vsinstance_t *wi;
+    VDATA *vs;
+    DYN_VWRITELIST *w;
+    struct blist_t  { /* contains info about fields in buf */
+       intn n;       /* number of fields in buf     */
+       int32 *idx;  /* index of buf fields in vdata */
+       int32 *offs; /* offset of buf fields in buf */
+    }  blist;
+
+    if (HAatom_group(vsid)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* locate vs' index in vgtab */
+    if (NULL == (wi = (vsinstance_t *) HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    vs = wi->vs;
+    if (vs == NULL) 
+        HGOTO_ERROR(DFE_NOVS, FAIL); 
+    w = &vs->wlist;
+         /* build blist based on info in w */
+    if (fields_in_buf == NULL)   
+         ac = w->n;
+    else    {           /* build our own blist */
+       if (scanattrs(fields_in_buf, &ac, &av) == FAIL)
+           HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+       if ((av == NULL) || (ac < 1))
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+    } 
+    blist.n = ac;
+    blist.idx = (int32 *)HDmalloc((size_t)ac * sizeof(int32));
+    blist.offs = (int32 *)HDmalloc((size_t)ac * sizeof(int32));
+    if ((blist.idx == NULL) || (blist.offs == NULL))
+         HGOTO_ERROR(DFE_NOSPACE, FAIL);
+      /* fill arrays blist.msizes and blist.offs; calculate
+           buf record size */
+    b_rec_size = 0;
+    if (fields_in_buf != NULL) 
+        /* a subset of vdata fields are contained in buf */
+        for (i=0; i<ac; i++) {
+           /* look for the field in vdata fields */
+           found = 0;
+           s = av[i];
+           for (j=0; j< w->n; j++)  {
+#ifdef VDATA_FIELDS_ALL_UPPER
+               if (matchnocase(s, w->name[j]))
+               {
+                    found = 1;
+                    break;
+                }
+#else
+                if (HDstrcmp(s, w->name[j]) == 0)
+                {
+                     found = 1;
+                     break;
+                 }
+#endif /* VDATA_FIELDS_ALL_UPPER */
+            }     /* for j */
+            if (!found)
+                HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+               /* get field info */
+            blist.idx[i] = j;
+            blist.offs[i] =
+               (i==0? 0 : blist.offs[i-1] + w->esize[blist.idx[i-1]]);
+            b_rec_size += w->esize[j];
+        }  /* for i */
+    else  /* buf contains all vdata fields  */
+       for (i=0; i< ac; i++) {
+           blist.idx[i] = i;
+           blist.offs[i] =
+                (i==0? 0 : blist.offs[i-1] + w->esize[i-1]);
+           b_rec_size += w->esize[i];
+       }
+ 
+       /* check bufsz */
+    if (bufsz < b_rec_size * n_records)
+        HGOTO_ERROR(DFE_NOTENOUGH, FAIL);
+    if (fields != NULL) { /* convert field names into tokens. */
+        if (scanattrs(fields, &ac, &av) == FAIL )
+            HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+        if ((av == NULL) || (ac < 1))
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+    }
+    else 
+        ac = blist.n;
+       /* fill array of fmsizes, foffs, fbufps */
+    if ((fmsizes=(int32 *)HDmalloc((size_t)ac*sizeof(int32))) == NULL) 
+         HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    if ((foffs = (int32 *)HDmalloc((size_t)ac*sizeof(int32))) == NULL) 
+         HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    if ((fbufps=(uint8 **)HDmalloc((size_t)ac*sizeof(uint8 *))) == NULL) 
+         HGOTO_ERROR(DFE_NOSPACE, FAIL);
+    if (fields != NULL)  { /* a subset of buf fields */
+        for (i=0; i<ac; i++) {
+           /* find field info */
+           found = 0;
+           s = av[i];
+           for (j=0; j< blist.n; j++)  {
+#ifdef VDATA_FIELDS_ALL_UPPER
+               if (matchnocase(s, w->name[blist.idx[j]]))
+               {
+                    found = 1;
+                    break;
+                }
+#else
+                if (HDstrcmp(s, w->name[blist.idx[j]]) == 0)
+                {
+                     found = 1;
+                     break;
+                 }
+#endif /* VDATA_FIELDS_ALL_UPPER */
+            }     /* for */
+            if (!found)
+                HGOTO_ERROR(DFE_BADFIELDS, FAIL); 
+            fmsizes[i] = (int32)w->esize[blist.idx[j]];
+            foffs[i] = blist.offs[j];
+	    fbufps[i] = fldbufpt[i];
+            if (fbufps[i] == NULL)  
+                HGOTO_ERROR(DFE_BADPTR,FAIL);  
+        }
+    }
+    else
+    {     /* all buf fields */
+        for (i=0; i < ac; i++)   {
+            fmsizes[i] = (int32)w->esize[blist.idx[i]];
+            foffs[i] = blist.offs[i];
+	    fbufps[i] = fldbufpt[i];
+            if (fbufps[i] == NULL)  
+                HGOTO_ERROR(DFE_BADPTR,FAIL); 
+        }
+     }
+    if (packtype == _HDF_VSPACK ) {
+        /* memory copy fields data to vdata buf */    
+        for (i=0; i<n_records; i++)   {
+            for (j=0; j<ac; j++)       {
+                HDmemcpy(bufp + foffs[j], fbufps[j], fmsizes[j]);
+                fbufps[j] += fmsizes[j];
+            }
+            bufp += b_rec_size;
+        }
+    }
+    else  { /* unpack from buf to fields */
+        for (i=0; i<n_records; i++)   {
+            for (j=0; j<ac; j++)       {
+                HDmemcpy(fbufps[j], bufp + foffs[j], fmsizes[j]);
+                fbufps[j] += fmsizes[j];
+            }
+            bufp += b_rec_size;
+        }
+    }
+
+done:
+    if (ret_value == FAIL) {
+    }
+    if (blist.idx != NULL)
+       HDfree(blist.idx);
+    if (blist.offs != NULL)
+       HDfree(blist.offs);
+    if (fmsizes != NULL)
+       HDfree(fmsizes);
+    if (foffs != NULL)
+       HDfree(foffs);
+    if (fbufps != NULL)
+       HDfree(fbufps);
+
+  return ret_value;
+}       /* VSfpack */
+/*--------------------------------------------------------- */
diff --git a/hdf/test/CMakeLists.txt b/hdf/test/CMakeLists.txt
new file mode 100644
index 0000000..0358ac2
--- /dev/null
+++ b/hdf/test/CMakeLists.txt
@@ -0,0 +1,83 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_HDF_TEST C CXX)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_HDF_BINARY_DIR}
+    ${HDF4_HDFSOURCE_DIR}
+)
+LINK_DIRECTORIES (
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_HDF_BINARY_DIR}
+    ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+SET (testhdf_SRCS
+    ${HDF4_HDF_TEST_SOURCE_DIR}/testhdf.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/an.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/anfile.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/bitio.c  
+    ${HDF4_HDF_TEST_SOURCE_DIR}/blocks.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/chunks.c  
+    ${HDF4_HDF_TEST_SOURCE_DIR}/comp.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/conv.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/extelt.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/file.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/file1.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/litend.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/macros.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/man.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/mgr.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/nbit.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/rig.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/sdmms.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/sdnmms.c 
+    ${HDF4_HDF_TEST_SOURCE_DIR}/sdstr.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/slab.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tattdatainfo.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tbv.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tdatainfo.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tdfr8.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tdupimgs.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tmgrattr.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tmgrcomp.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tree.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tszip.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tusejpegfuncs.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tutils.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tvattr.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tvnameclass.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tvset.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/tvsfpack.c
+    ${HDF4_HDF_TEST_SOURCE_DIR}/vers.c
+  )
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+#-- Adding test for testhdf
+ADD_EXECUTABLE (testhdf ${testhdf_SRCS})
+TARGET_NAMING (testhdf ${LIB_TYPE})
+TARGET_C_PROPERTIES (testhdf " " " ")
+TARGET_LINK_LIBRARIES (testhdf ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+#-- Adding test for buffer
+IF (NOT WIN32)
+  ADD_EXECUTABLE (buffer ${HDF4_HDF_TEST_SOURCE_DIR}/buffer.c)
+  TARGET_NAMING (buffer ${LIB_TYPE})
+  TARGET_C_PROPERTIES (buffer " " " ")
+  TARGET_LINK_LIBRARIES (buffer ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (NOT WIN32)
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+
+INCLUDE (CMakeTests.cmake)
+
diff --git a/hdf/test/CMakeTests.cmake b/hdf/test/CMakeTests.cmake
new file mode 100644
index 0000000..831b88f
--- /dev/null
+++ b/hdf/test/CMakeTests.cmake
@@ -0,0 +1,193 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+  
+FILE (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/testdir)
+
+#-- Copy all the dat files from the test directory into the source directory
+SET (HDF4_REFERENCE_TEST_FILES
+    8bit.dat
+    bitio.dat
+    gr_r24.dat
+    greyjpeg.dat
+    jpeg.dat
+    litend.dat
+    nbit.dat
+    tmgr.dat
+    tvattr.dat
+    grtdfui83.hdf
+)
+
+FOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+   SET (dest "${PROJECT_BINARY_DIR}/test_files/${h4_file}")
+   #MESSAGE(STATUS " Copying ${h4_file}")
+   ADD_CUSTOM_COMMAND (
+       TARGET     testhdf 
+       POST_BUILD
+       COMMAND    ${CMAKE_COMMAND}
+       ARGS       -E copy_if_different ${HDF4_HDF_TEST_SOURCE_DIR}/test_files/${h4_file} ${dest}
+   )
+ENDFOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME testhdf-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        Block_info.hdf
+        ChunkedGR.hdf
+        ChunkedGR_DF.hdf
+        ChunkedGR_NO.hdf
+        ChunkedGR_RL.hdf
+        ChunkedGR_SK.hdf
+        datainfo_annot.hdf
+        datainfo_dfri.hdf
+        datainfo_images.hdf
+        datainfo_linkblock.hdf
+        datainfo_simple.hdf
+        gr2.hdf
+        gr_chunkcomp.hdf
+        gr_comp.hdf
+        gr_double_test.hdf
+        gr_gzip.hdf
+        gr_jpeg.hdf
+        gr_r8.hdf
+        nntcheck.hdf
+        ntcheck.hdf
+        RI_8.hdf
+        RI_16.hdf
+        RI_32.hdf
+        RI_fl32.hdf
+        RI_fl64.hdf
+        RIchunkedziped.hdf
+        s1w.hdf
+        s3w.hdf
+        s4w.hdf
+        sdstrings.hdf
+        swf32.hdf
+        swf64.hdf
+        swi8.hdf
+        swi16.hdf
+        swi32.hdf
+        swin.hdf
+        swui8.hdf
+        swui16.hdf
+        swui32.hdf
+        swuin.hdf
+        t.hdf
+        t1.hdf
+        t2.hdf
+        t3.hdf
+        t4.hdf
+        tbitio.hdf
+        tblocks.hdf
+        tchunks.hdf
+        tcomp.hdf
+        tdf24.hdf
+        tdfan.hdf
+        temp.hdf
+        thf.hdf
+        tjpeg.hdf
+        tlongnames.hdf
+        tman.hdf
+        tmgr.hdf
+        tmgratt.hdf
+        tmgrchk.hdf
+        tnbit.hdf
+        tref.hdf
+        tuservds.hdf
+        tuservgs.hdf
+        tvattr.hdf
+        tvpack.hdf
+        tvsempty.hdf
+        tvset.hdf
+        tvsetext.hdf
+        tx.hdf
+        Tables_External_File
+)
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (testhdf-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (testhdf-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "testhdf-clearall-objects")
+
+ADD_TEST (
+    NAME testhdf_thf0-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        thf0.hdf
+        thf1.hdf
+        thf2.hdf
+        thf3.hdf
+        thf4.hdf
+        thf5.hdf
+        thf6.hdf
+        thf7.hdf
+        thf8.hdf
+        thf9.hdf
+)
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (testhdf_thf0-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (testhdf_thf0-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "testhdf_thf0-clearall-objects")
+
+SET (thf_decade
+    1 2 3 4 5 6 7 8 9 10
+    11 12 13 14 15 16 17 18 19 20
+    21 22 23 24 25 26 27 28 29 30
+    31 32 33 34 35 36 37 38 39 40
+    41 42 43 44 45 46 47 48 49 50
+    51 52 53 54 55 56 57 58 59 60
+)
+FOREACH (decade ${thf_decade}) 
+  ADD_TEST (
+      NAME testhdf_thf${decade}-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          thf${decade}0.hdf
+          thf${decade}1.hdf
+          thf${decade}2.hdf
+          thf${decade}3.hdf
+          thf${decade}4.hdf
+          thf${decade}5.hdf
+          thf${decade}6.hdf
+          thf${decade}7.hdf
+          thf${decade}8.hdf
+          thf${decade}9.hdf
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (testhdf_thf${decade}-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (testhdf_thf${decade}-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "testhdf_thf${decade}-clearall-objects")
+ENDFOREACH (decade ${thf_decade}) 
+
+ADD_TEST (NAME testhdf COMMAND $<TARGET_FILE:testhdf>)
+SET (passRegex "All tests were successful")
+SET_PROPERTY (TEST testhdf PROPERTY PASS_REGULAR_EXPRESSION "${passRegex}")
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (testhdf PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (testhdf PROPERTIES LABELS ${PROJECT_NAME})
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "testhdf")
+
+#-- Adding test for buffer
+IF (NOT WIN32)
+  ADD_TEST (NAME buffer COMMAND $<TARGET_FILE:buffer>)
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (buffer PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (buffer PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "buffer")
+ENDIF (NOT WIN32)
+
+
diff --git a/hdf/test/Makefile.am b/hdf/test/Makefile.am
new file mode 100644
index 0000000..b954370
--- /dev/null
+++ b/hdf/test/Makefile.am
@@ -0,0 +1,62 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+AM_CPPFLAGS = -I$(top_srcdir)/hdf/src
+
+#############################################################################
+##                              Testing                                    ##
+#############################################################################
+
+if HDF_BUILD_FORTRAN
+TEST_PROG = testhdf buffer fortest
+check_PROGRAMS = testhdf buffer fortest fortestF
+else
+TEST_PROG = testhdf buffer
+check_PROGRAMS = testhdf buffer
+endif
+
+testhdf_SOURCES = an.c anfile.c bitio.c blocks.c chunks.c comp.c   \
+                  conv.c extelt.c file.c file1.c litend.c macros.c man.c    \
+                  mgr.c nbit.c rig.c sdmms.c sdnmms.c sdstr.c slab.c tbv.c  \
+                  tattdatainfo.c tdatainfo.c tdfr8.c tdupimgs.c testhdf.c   \
+		  tmgrattr.c tmgrcomp.c tree.c tszip.c tusejpegfuncs.c      \
+		  tutils.c tvattr.c tvnameclass.c tvset.c tvsfpack.c vers.c
+testhdf_LDADD = $(LIBHDF)
+testhdf_DEPENDENCIES = testdir $(LIBHDF) 
+
+buffer_LDADD = $(LIBHDF)
+buffer_DEPENDENCIES = $(LIBHDF)
+
+if HDF_BUILD_FORTRAN
+fortest_SOURCES = fortest.c
+fortest_LDADD = $(LIBHDF)
+fortest_DEPENDENCIES = testdir fortestF$(EXEEXT) $(LIBHDF)
+
+fortestF_SOURCES = forsupff.f forsupf.c fortestF.f manf.f mgrf.f slabwf.f   \
+                   t24f.f tanf.f tanfilef.f tpf.f tr8f.f tsdmmsf.f          \
+                   tsdnmmsf.f tsdnntf.f tsdntf.f tsdstrf.f tstubsf.f        \
+                   tvattrf.f tvsetf.f
+fortestF_LDADD = $(LIBHDF)
+fortestF_DEPENDENCIES = testdir $(LIBHDF)
+endif
+
+testdir:
+	-mkdir testdir
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += fortest.arg Fortran_err.dat testdir/t5.hdf Tables_External_File
+
+# Automake's distclean won't remove directories, so we can add an additional
+# hook target which will do so during 'make distclean'.
+distclean-local:
+	-rm -rf testdir
+
+DISTCLEANFILES = 
+
+include $(top_srcdir)/config/conclude.am
diff --git a/hdf/test/Makefile.in b/hdf/test/Makefile.in
new file mode 100644
index 0000000..c499e24
--- /dev/null
+++ b/hdf/test/Makefile.in
@@ -0,0 +1,874 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+ at HDF_BUILD_FORTRAN_FALSE@check_PROGRAMS = testhdf$(EXEEXT) \
+ at HDF_BUILD_FORTRAN_FALSE@	buffer$(EXEEXT)
+ at HDF_BUILD_FORTRAN_TRUE@check_PROGRAMS = testhdf$(EXEEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	buffer$(EXEEXT) fortest$(EXEEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	fortestF$(EXEEXT)
+TESTS = $(am__EXEEXT_1)
+subdir = hdf/test
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+buffer_SOURCES = buffer.c
+buffer_OBJECTS = buffer.$(OBJEXT)
+am__fortest_SOURCES_DIST = fortest.c
+ at HDF_BUILD_FORTRAN_TRUE@am_fortest_OBJECTS = fortest.$(OBJEXT)
+fortest_OBJECTS = $(am_fortest_OBJECTS)
+am__fortestF_SOURCES_DIST = forsupff.f forsupf.c fortestF.f manf.f \
+	mgrf.f slabwf.f t24f.f tanf.f tanfilef.f tpf.f tr8f.f \
+	tsdmmsf.f tsdnmmsf.f tsdnntf.f tsdntf.f tsdstrf.f tstubsf.f \
+	tvattrf.f tvsetf.f
+ at HDF_BUILD_FORTRAN_TRUE@am_fortestF_OBJECTS = forsupff.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	forsupf.$(OBJEXT) fortestF.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	manf.$(OBJEXT) mgrf.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	slabwf.$(OBJEXT) t24f.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	tanf.$(OBJEXT) tanfilef.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	tpf.$(OBJEXT) tr8f.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	tsdmmsf.$(OBJEXT) tsdnmmsf.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	tsdnntf.$(OBJEXT) tsdntf.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	tsdstrf.$(OBJEXT) tstubsf.$(OBJEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	tvattrf.$(OBJEXT) tvsetf.$(OBJEXT)
+fortestF_OBJECTS = $(am_fortestF_OBJECTS)
+am_testhdf_OBJECTS = an.$(OBJEXT) anfile.$(OBJEXT) bitio.$(OBJEXT) \
+	blocks.$(OBJEXT) chunks.$(OBJEXT) comp.$(OBJEXT) \
+	conv.$(OBJEXT) extelt.$(OBJEXT) file.$(OBJEXT) file1.$(OBJEXT) \
+	litend.$(OBJEXT) macros.$(OBJEXT) man.$(OBJEXT) mgr.$(OBJEXT) \
+	nbit.$(OBJEXT) rig.$(OBJEXT) sdmms.$(OBJEXT) sdnmms.$(OBJEXT) \
+	sdstr.$(OBJEXT) slab.$(OBJEXT) tbv.$(OBJEXT) \
+	tattdatainfo.$(OBJEXT) tdatainfo.$(OBJEXT) tdfr8.$(OBJEXT) \
+	tdupimgs.$(OBJEXT) testhdf.$(OBJEXT) tmgrattr.$(OBJEXT) \
+	tmgrcomp.$(OBJEXT) tree.$(OBJEXT) tszip.$(OBJEXT) \
+	tusejpegfuncs.$(OBJEXT) tutils.$(OBJEXT) tvattr.$(OBJEXT) \
+	tvnameclass.$(OBJEXT) tvset.$(OBJEXT) tvsfpack.$(OBJEXT) \
+	vers.$(OBJEXT)
+testhdf_OBJECTS = $(am_testhdf_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
+F77LD = $(F77)
+F77LINK = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = buffer.c $(fortest_SOURCES) $(fortestF_SOURCES) \
+	$(testhdf_SOURCES)
+DIST_SOURCES = buffer.c $(am__fortest_SOURCES_DIST) \
+	$(am__fortestF_SOURCES_DIST) $(testhdf_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+ at HDF_BUILD_FORTRAN_FALSE@am__EXEEXT_1 = testhdf$(EXEEXT) \
+ at HDF_BUILD_FORTRAN_FALSE@	buffer$(EXEEXT)
+ at HDF_BUILD_FORTRAN_TRUE@am__EXEEXT_1 = testhdf$(EXEEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@	buffer$(EXEEXT) fortest$(EXEEXT)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog fortest.arg Fortran_err.dat \
+	testdir/t5.hdf Tables_External_File
+AM_CPPFLAGS = -I$(top_srcdir)/hdf/src
+ at HDF_BUILD_FORTRAN_FALSE@TEST_PROG = testhdf buffer
+
+#############################################################################
+#############################################################################
+ at HDF_BUILD_FORTRAN_TRUE@TEST_PROG = testhdf buffer fortest
+testhdf_SOURCES = an.c anfile.c bitio.c blocks.c chunks.c comp.c   \
+                  conv.c extelt.c file.c file1.c litend.c macros.c man.c    \
+                  mgr.c nbit.c rig.c sdmms.c sdnmms.c sdstr.c slab.c tbv.c  \
+                  tattdatainfo.c tdatainfo.c tdfr8.c tdupimgs.c testhdf.c   \
+		  tmgrattr.c tmgrcomp.c tree.c tszip.c tusejpegfuncs.c      \
+		  tutils.c tvattr.c tvnameclass.c tvset.c tvsfpack.c vers.c
+
+testhdf_LDADD = $(LIBHDF)
+testhdf_DEPENDENCIES = testdir $(LIBHDF) 
+buffer_LDADD = $(LIBHDF)
+buffer_DEPENDENCIES = $(LIBHDF)
+ at HDF_BUILD_FORTRAN_TRUE@fortest_SOURCES = fortest.c
+ at HDF_BUILD_FORTRAN_TRUE@fortest_LDADD = $(LIBHDF)
+ at HDF_BUILD_FORTRAN_TRUE@fortest_DEPENDENCIES = testdir fortestF$(EXEEXT) $(LIBHDF)
+ at HDF_BUILD_FORTRAN_TRUE@fortestF_SOURCES = forsupff.f forsupf.c fortestF.f manf.f mgrf.f slabwf.f   \
+ at HDF_BUILD_FORTRAN_TRUE@                   t24f.f tanf.f tanfilef.f tpf.f tr8f.f tsdmmsf.f          \
+ at HDF_BUILD_FORTRAN_TRUE@                   tsdnmmsf.f tsdnntf.f tsdntf.f tsdstrf.f tstubsf.f        \
+ at HDF_BUILD_FORTRAN_TRUE@                   tvattrf.f tvsetf.f
+
+ at HDF_BUILD_FORTRAN_TRUE@fortestF_LDADD = $(LIBHDF)
+ at HDF_BUILD_FORTRAN_TRUE@fortestF_DEPENDENCIES = testdir $(LIBHDF)
+DISTCLEANFILES = 
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/test/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign hdf/test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+buffer$(EXEEXT): $(buffer_OBJECTS) $(buffer_DEPENDENCIES) $(EXTRA_buffer_DEPENDENCIES) 
+	@rm -f buffer$(EXEEXT)
+	$(LINK) $(buffer_OBJECTS) $(buffer_LDADD) $(LIBS)
+fortest$(EXEEXT): $(fortest_OBJECTS) $(fortest_DEPENDENCIES) $(EXTRA_fortest_DEPENDENCIES) 
+	@rm -f fortest$(EXEEXT)
+	$(LINK) $(fortest_OBJECTS) $(fortest_LDADD) $(LIBS)
+fortestF$(EXEEXT): $(fortestF_OBJECTS) $(fortestF_DEPENDENCIES) $(EXTRA_fortestF_DEPENDENCIES) 
+	@rm -f fortestF$(EXEEXT)
+	$(F77LINK) $(fortestF_OBJECTS) $(fortestF_LDADD) $(LIBS)
+testhdf$(EXEEXT): $(testhdf_OBJECTS) $(testhdf_DEPENDENCIES) $(EXTRA_testhdf_DEPENDENCIES) 
+	@rm -f testhdf$(EXEEXT)
+	$(LINK) $(testhdf_OBJECTS) $(testhdf_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/an.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/anfile.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bitio.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/blocks.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/buffer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/chunks.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/comp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/conv.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/extelt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file1.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/forsupf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fortest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/litend.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/macros.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/man.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mgr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nbit.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sdmms.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sdnmms.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sdstr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slab.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tattdatainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tbv.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tdatainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tdfr8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tdupimgs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/testhdf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tmgrattr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tmgrcomp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tree.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tszip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tusejpegfuncs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tutils.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tvattr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tvnameclass.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tvset.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tvsfpack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vers.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-local distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-checkPROGRAMS clean-generic clean-libtool \
+	cscopelist ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-local distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am
+
+
+testdir:
+	-mkdir testdir
+
+# Automake's distclean won't remove directories, so we can add an additional
+# hook target which will do so during 'make distclean'.
+distclean-local:
+	-rm -rf testdir
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdf/test/README b/hdf/test/README
new file mode 100644
index 0000000..97c198e
--- /dev/null
+++ b/hdf/test/README
@@ -0,0 +1,52 @@
+This directory contains the test suite for the basic library, libdf.a.
+After running the makefile at either the higher level or this level,
+you will find two executable programs, testhdf and fortest, in this 
+directory. Testhdf tests the C functions, while fortest the Fortran 
+interface. At the end of execution, each program reports how many 
+errors occurred. Please contact us at hdfhelp at ncsa.uiuc.edu 
+if the test fails on your machine.
+
+Special notes for fortest:
+"fortest" is just a C-code front to parse command line arguments.
+It produces a file, fortest.arg which contains lines of instruction
+to invoke the real fortran test which is called fortestF.  Each line
+in fortest.arg contains a command and a parameter.
+
+	Command		Parameter	Description
+	-------		---------	-----------
+
+	Test		Name		Test <Name>
+	Skip		Name		Skip test <Name>
+	Cleanup		String		How to cleanup *.hdf
+	Verbosity	Integer		Verbosity = <Integer>
+
+"fortest" then invokes "fortestF" with "fortest.arg" as input.
+
+Cleanup Commands
+----------------
+If <String> is Yes/No, it directs to delete the *.hdf files or not.
+If <String> is not Yes/No, it represents the system command to delete
+    the *.hdf files.  (NOTE: specifying a system command does not imply
+    Cleanup.)
+
+
+
+Verbosity convention
+--------------------
+
+The higher the verbosity value, the more information printed.
+So, output for a higher verbosity value also includes the output of 
+all lower verbosity values.
+
+    Value	Description
+    0		None:	No informational message.
+    1			"All tests passed"
+    2			Header of overall test
+    3		Default: header and results of individual test
+    4		
+    5		Low:	Major category of tests.
+    6
+    7		Medium:	Minor category of tests such as functions called.
+    8
+    9		High:	Highest level.  All information.
+
diff --git a/hdf/test/an.c b/hdf/test/an.c
new file mode 100644
index 0000000..69f153a
--- /dev/null
+++ b/hdf/test/an.c
@@ -0,0 +1,334 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: an.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/***********************************************************
+*
+* Test program: Stores annotations in a file
+* Writes several SDSs and corresponding RISs to a file.
+* Writes labels and descriptions for all but the first three SDSs.
+* Writes labels and descriptions for all RISs.
+*
+*************************************************************/
+
+#define TESTFILE "tdfan.hdf"
+
+#include "tproto.h"
+
+#define ISFIRST    (int)1
+#define NOTFIRST   (int)0
+#define MAXLEN_LAB     50
+#define MAXLEN_DESC  1000
+#define ROWS           10
+#define COLS           10
+#define REPS            32/*2*/   /* number of data sets to write to file */
+
+static VOID gen2Dfloat
+            (int height, int width, float *data);
+
+static VOID genimage
+            (int height, int width, float *data, uint8 *image);
+
+static VOID check_lab_desc
+            (uint16 tag, uint16 ref, char *label, char *desc);
+
+void
+test_an(void)
+{
+    char        labsds[MAXLEN_LAB], labris[MAXLEN_LAB], descsds[MAXLEN_DESC],
+                descris[MAXLEN_DESC];
+    uint8       pal[768];
+    uint8      *image, *newimage;
+    uint16      refnum;
+    int32       ret;
+    intn        rank;
+    int         j;
+    int32       dimsizes[2];
+    float      *data;
+
+/* set up object labels and descriptions */
+
+    HDstrcpy(labsds, "Object label #1: sds");
+    HDstrcpy(labris, "Object label #2: image");
+    HDstrcpy(descsds, "Object Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 \n");
+    HDstrcat(descsds, "             13 14 15 16 17 18 19 20 **END SDS DESCR**\n");
+    HDstrcpy(descris, "Object Descr #2: A B C D E F G H I J K L \n");
+    HDstrcat(descris, "                M N O **END IMAGE DESCR **\n");
+
+/***** generate float array and image *****/
+
+    data = (float *) HDmalloc(ROWS * COLS * sizeof(float));
+    image = (uint8 *) HDmalloc(ROWS * COLS * sizeof(char));
+    newimage = (uint8 *) HDmalloc(ROWS * COLS * sizeof(char));
+
+    dimsizes[0] = ROWS;
+    dimsizes[1] = COLS;
+
+    gen2Dfloat(ROWS, COLS, data);
+    genimage(ROWS, COLS, data, image);
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+
+/********  Write labels and descriptions *********/
+    MESSAGE(5, printf("***  Writing labels and descriptions with SDS and RIS ***\n");
+        );
+    for (j = 0; j < REPS; j++)
+      {
+
+          /* write out scientific data set */
+          ret = DFSDadddata(TESTFILE, 2, dimsizes, (VOIDP) data);
+          RESULT("DFSDadddata");
+
+          if ((j % 3) != 0)
+            {   /* write out annotations for 2 out of every 3 */
+                refnum = DFSDlastref();
+                ret = DFANputlabel(TESTFILE, DFTAG_SDG, refnum, labsds);
+                RESULT("DFANputlabel");
+                ret = DFANputdesc(TESTFILE, DFTAG_SDG, refnum,
+                                  descsds, (int32)HDstrlen(descsds));
+                RESULT("DFANputdesc");
+            }
+
+          ret = DFR8addimage(TESTFILE, (VOIDP) image, COLS, ROWS, 0);
+          RESULT("DFR8addimage");
+          refnum = DFR8lastref();
+          ret = DFANputlabel(TESTFILE, DFTAG_RIG, refnum, labris);
+          RESULT("DFANputlabel");
+          ret = DFANputdesc(TESTFILE, DFTAG_RIG, refnum, descris, (int32)HDstrlen(descris));
+          RESULT("DFANputdesc");
+      }
+
+/********  Read labels and descriptions *********/
+
+    MESSAGE(5, printf("*** Reading labels and descriptions for SDS and RIS ***\n");
+        );
+
+    for (j = 0; j < REPS; j++)
+      {
+
+          ret = DFSDgetdims(TESTFILE, &rank, dimsizes, 3);
+          RESULT("DFSDgetdims");
+          refnum = DFSDlastref();
+
+          if ((j % 3) != 0)     /* read in annotations for 2 out of every 3 */
+              check_lab_desc(DFTAG_SDG, refnum, labsds, descsds);
+
+          ret = DFR8getimage(TESTFILE, newimage, (int32) COLS, (int32) ROWS, pal);
+          RESULT("DFR8getimage");
+          refnum = DFR8lastref();
+          check_lab_desc(DFTAG_RIG, refnum, labris, descris);
+      }
+
+    HDfree((VOIDP) data);
+    HDfree((VOIDP) image);
+    HDfree((VOIDP) newimage);
+}
+
+/****************************************************************
+**
+**  gen2Dfloat:  generate 2-D data array
+**
+****************************************************************/
+static      VOID
+gen2Dfloat(int height, int width, float *data)
+{
+    int         i, j;
+    float      *pdata;
+
+    /* store one value per row, increasing by one for each row */
+    pdata = data;
+    for (i = 0; i < height; i++)
+        for (j = 0; j < width; j++)
+            *pdata++ = (float) (i + 1);
+
+}
+
+/****************************************************************
+**
+**  genimage:  generate image from 2-D float array
+**
+****************************************************************/
+static      VOID
+genimage(int height, int width, float *data, uint8 *image)
+{
+    int         i, limit;
+    float      *pdata, max, min, multiplier;
+
+    limit = height * width;
+    pdata = data;
+    max = min = *pdata;
+    for (i = 0; i < limit; i++, pdata++)
+      {
+          max = (max > *pdata) ? max : *pdata;
+          min = (min < *pdata) ? min : *pdata;
+      }
+    /* store one value per row, increasing by one for each row */
+    pdata = data;
+    multiplier = (float32) 255.0 / (max - min);
+    for (i = 0; i < limit; i++)
+        *image++ = (uint8) (((*pdata++) - min) * multiplier);
+
+}
+
+/****************************************************************
+**
+**  check_lab_desc:  read and compare label and description
+**                   with expected ones
+**
+****************************************************************/
+static      VOID
+check_lab_desc(uint16 tag, uint16 ref, char *label, char *desc)
+{
+    int32       inlablen, indesclen, ret;
+    char        inlabel[MAXLEN_LAB], *indesc;
+
+    inlablen = ret = DFANgetlablen(TESTFILE, tag, ref);
+    RESULT("DFANgetlablen");
+    if (inlablen != (int32) HDstrlen(label))
+      {
+          printf("\t>>>BAD LABEL LENGTH.\n\t       IS: %d\n\tSHOULD BE: %d<<<\n",
+                 (int) inlablen, (int) HDstrlen(label));
+          num_errs++;
+      }
+    ret = DFANgetlabel(TESTFILE, tag, ref, inlabel, MAXLEN_LAB);
+    RESULT("DFANgetlabel");
+    if (HDstrcmp(inlabel, label) != 0)
+      {
+          printf("\t>>>BAD LABEL. \n\t       IS: %s; \n\tSHOULD BE: %s<<<\n",
+                 inlabel, label);
+          num_errs++;
+      }
+
+    indesclen = ret = DFANgetdesclen(TESTFILE, tag, ref);
+    RESULT("DFANgetdesclen");
+    if (indesclen != (int32) HDstrlen(desc))
+      {
+          printf("\t>>>BAD DESCRIPTION LENGTH. \n\t       IS: %d", (int) indesclen);
+          printf("\n\tSHOULD BE: %d<<<\n", (int) HDstrlen(desc));
+          num_errs++;
+      }
+    else
+      {
+          indesc = (char *) HDmalloc(indesclen + 1);
+          ret = DFANgetdesc(TESTFILE, tag, ref, indesc, MAXLEN_DESC);
+          RESULT("DFANgetdesc");
+          indesc[indesclen] = '\0';
+          if (HDstrcmp(indesc, desc) != 0)
+            {
+                printf("\t>>>BAD DESCRIPTION.\n\t      IS: %s", indesc);
+                printf("\n\tSHOULD BE: %s<<<\n", desc);
+                num_errs++;
+            }
+          HDfree((VOIDP) indesc);
+      }
+}
+
+
+void
+test_an_2(void)
+{
+    char        labsds[MAXLEN_LAB], labris[MAXLEN_LAB], descsds[MAXLEN_DESC],
+                descris[MAXLEN_DESC];
+    uint8       pal[768];
+    uint8      *image, *newimage;
+    uint16      refnum;
+    int32       ret;
+    intn        rank;
+    int         j;
+    int32       dimsizes[2];
+    float      *data;
+
+/* set up object labels and descriptions */
+
+    HDstrcpy(labsds, "Object label #1: sds");
+    HDstrcpy(labris, "Object label #2: image");
+    HDstrcpy(descsds, "Object Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 \n");
+    HDstrcat(descsds, "             13 14 15 16 17 18 19 20 **END SDS DESCR**\n");
+    HDstrcpy(descris, "Object Descr #2: A B C D E F G H I J K L \n");
+    HDstrcat(descris, "                M N O **END IMAGE DESCR **\n");
+
+/***** generate float array and image *****/
+
+    data = (float *) HDmalloc(ROWS * COLS * sizeof(float));
+    image = (uint8 *) HDmalloc(ROWS * COLS * sizeof(char));
+    newimage = (uint8 *) HDmalloc(ROWS * COLS * sizeof(char));
+
+    dimsizes[0] = ROWS;
+    dimsizes[1] = COLS;
+
+    gen2Dfloat(ROWS, COLS, data);
+    genimage(ROWS, COLS, data, image);
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+
+/********  Write labels and descriptions *********/
+    MESSAGE(5, printf("***  Writing labels and descriptions with SDS and RIS ***\n");
+        );
+    for (j = 0; j < REPS; j++)
+      {
+
+          /* write out scientific data set */
+          ret = DFSDadddata(TESTFILE, 2, dimsizes, (VOIDP) data);
+          RESULT("DFSDadddata");
+
+          if ((j % 3) != 0)
+            {   /* write out annotations for 2 out of every 3 */
+                refnum = DFSDlastref();
+                ret = DFANputlabel(TESTFILE, DFTAG_SDG, refnum, labsds);
+                RESULT("DFANputlabel");
+                ret = DFANputdesc(TESTFILE, DFTAG_SDG, refnum,
+                                  descsds, (int32)HDstrlen(descsds));
+                RESULT("DFANputdesc");
+            }
+
+          ret = DFR8addimage(TESTFILE, (VOIDP) image, COLS, ROWS, 0);
+          RESULT("DFR8addimage");
+          refnum = DFR8lastref();
+          ret = DFANputlabel(TESTFILE, DFTAG_RIG, refnum, labris);
+          RESULT("DFANputlabel");
+          ret = DFANputdesc(TESTFILE, DFTAG_RIG, refnum, descris, (int32)HDstrlen(descris));
+          RESULT("DFANputdesc");
+      }
+
+/********  Read labels and descriptions *********/
+
+    MESSAGE(5, printf("*** Reading labels and descriptions for SDS and RIS ***\n");
+        );
+
+    for (j = 0; j < REPS; j++)
+      {
+
+          ret = DFSDgetdims(TESTFILE, &rank, dimsizes, 3);
+          RESULT("DFSDgetdims");
+          refnum = DFSDlastref();
+
+          if ((j % 3) != 0)     /* read in annotations for 2 out of every 3 */
+              check_lab_desc(DFTAG_SDG, refnum, labsds, descsds);
+
+          ret = DFR8getimage(TESTFILE, newimage, (int32) COLS, (int32) ROWS, pal);
+          RESULT("DFR8getimage");
+          refnum = DFR8lastref();
+          check_lab_desc(DFTAG_RIG, refnum, labris, descris);
+      }
+
+    HDfree((VOIDP) data);
+    HDfree((VOIDP) image);
+    HDfree((VOIDP) newimage);
+}
diff --git a/hdf/test/anfile.c b/hdf/test/anfile.c
new file mode 100644
index 0000000..4c60425
--- /dev/null
+++ b/hdf/test/anfile.c
@@ -0,0 +1,156 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: anfile.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+#include "tproto.h"
+#define TESTFILE "tdfan.hdf"
+
+#define ISFIRST    (int)1
+#define NOTFIRST   (int)0
+#define MAXLEN_LAB     50
+#define MAXLEN_DESC  1000
+
+static int  checkannlen
+            (int32 ret, const char *oldstr, const char *type, int32 testflag);
+
+static int  checkann
+            (const char *oldstr, const char *newstr, int32 ret, const char *type, int32 testflag);
+
+void
+test_anfile(void)
+{
+    char        lab1[MAXLEN_LAB], lab2[MAXLEN_LAB], desc1[MAXLEN_DESC], desc2[MAXLEN_DESC],
+                tempstr[MAXLEN_DESC];
+    int32       testflag = SUCCEED;
+    int32       file_id, ret;
+
+/* set up file labels and descriptions */
+
+    HDstrcpy(lab1, "File label #1: aaa");
+    HDstrcpy(lab2, "File label #2: bbbbbb");
+    HDstrcpy(desc1, "File Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 13\n");
+    HDstrcat(desc1, "              14 15 16 17 18 19 20 **END FILE DESCR**\n");
+    HDstrcpy(desc2, "File Descr #2: A B C D E F G H I J K L\n");
+    HDstrcat(desc2, "              M N O **END FILE DESCR**\n");
+
+/********  Write file labels and descriptions *********/
+
+    file_id = Hopen(TESTFILE, DFACC_CREATE, 0);
+    if (file_id == FAIL)
+        printf("\nUnable to open file %s for writing.\n\n", TESTFILE);
+
+    MESSAGE(5, puts("Writing file labels.");
+        );
+    ret = DFANaddfid(file_id, lab1);
+    RESULT("DFANaddfid");
+
+    ret = DFANaddfid(file_id, lab2);
+    RESULT("DFANaddfid");
+
+    MESSAGE(5, puts("Writing file descriptions.");
+        );
+    ret = DFANaddfds(file_id, desc1, (int32)HDstrlen(desc1));
+    RESULT("DFANaddfds");
+
+    ret = DFANaddfds(file_id, desc2, (int32)HDstrlen(desc2));
+    RESULT("DFANaddfds");
+
+    if (FAIL == Hclose(file_id))
+        printf("\nUnable to close file %s after writing.\n\n", TESTFILE);
+
+/********  Read file labels *********/
+
+    file_id = Hopen(TESTFILE, DFACC_READ, 0);
+    if (file_id == FAIL)
+        printf("\n\nUnable to open file %s for reading.\n\n", TESTFILE);
+
+    MESSAGE(5, puts("Reading length of first file label, followed by label.");
+        );
+    ret = DFANgetfidlen(file_id, ISFIRST);
+    RESULT("DFANgetfidlen");
+    checkannlen(ret, lab1, "label", testflag);
+
+    ret = DFANgetfid(file_id, tempstr, MAXLEN_LAB, ISFIRST);
+    RESULT("DFANgetfid");
+    checkann(lab1, tempstr, ret, "label", testflag);
+
+    MESSAGE(5, puts("Reading length of second file label, followed by label.");
+        );
+    ret = DFANgetfidlen(file_id, NOTFIRST);
+    RESULT("DFANgetfidlen");
+    checkannlen(ret, lab2, "label", testflag);
+
+    ret = DFANgetfid(file_id, tempstr, MAXLEN_LAB, NOTFIRST);
+    RESULT("DFANgetfid");
+    checkann(lab2, tempstr, ret, "label", testflag);
+
+/********  Read file descriptions *********/
+
+    MESSAGE(5, puts("Reading length of first file descr, followed by descr.");
+        );
+    ret = DFANgetfdslen(file_id, ISFIRST);
+    RESULT("DFANgetfdslen");
+    checkannlen(ret, desc1, "description", testflag);
+
+    ret = DFANgetfds(file_id, tempstr, MAXLEN_DESC, ISFIRST);
+    RESULT("DFANgetfds");
+    checkann(desc1, tempstr, ret, "description", testflag);
+
+    MESSAGE(5, puts("Reading length of second file descr, followed by descr.");
+        );
+    ret = DFANgetfdslen(file_id, NOTFIRST);
+    RESULT("DFANgetfdslen");
+    checkannlen(ret, desc2, "description", testflag);
+
+    ret = DFANgetfds(file_id, tempstr, MAXLEN_DESC, NOTFIRST);
+    RESULT("DFANgetfds");
+    checkann(desc2, tempstr, ret, "description", testflag);
+
+    if (FAIL == Hclose(file_id))
+        printf("\n\nUnable to close file %s after reading.\n\n", TESTFILE);
+
+}
+
+static int
+checkannlen(int32 ret, const char *oldstr, const char *type, int32 testflag)
+{
+    if ((ret >= 0) && (ret != (int32) HDstrlen(oldstr)))
+      {
+          printf("Length of %s is INCORRECT\n", type);
+          printf("It is:  %d\n", (int) ret);
+          printf("It should be: %d\n", (int) HDstrlen(oldstr));
+          testflag = FAIL;
+          return FAIL;
+      }
+    return SUCCEED;
+}
+
+static int
+checkann(const char *oldstr, const char *newstr, int32 ret, const char *type,
+         int32 testflag)
+{
+    if ((ret >= 0) && (0 != HDstrcmp(oldstr, newstr)))
+      {
+          printf("%s is INCORRECT.\n", type);
+          printf("It is:  %s\n", newstr);
+          printf("It should be: %s\n", oldstr);
+          testflag = FAIL;
+          return (FAIL);
+      }
+    return (SUCCEED);
+}
diff --git a/hdf/test/bitio.c b/hdf/test/bitio.c
new file mode 100644
index 0000000..b601ac2
--- /dev/null
+++ b/hdf/test/bitio.c
@@ -0,0 +1,445 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+   FILE
+   bitio.c
+   Test HDF bit-level I/O routines
+
+   REMARKS
+
+   DESIGN
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   10/19/93 - Started coding.
+ */
+
+/* $Id: bitio.c 5210 2009-08-21 20:27:12Z brtnfld $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5210 $";
+#endif
+
+#include "tproto.h"
+#include <time.h>
+
+#define TESTFILE_NAME "tbitio.hdf"
+#define DATAFILE_NAME "test_files/bitio.dat"
+
+/* Last ditch attempt to define this value... */
+#ifndef UINT_MAX
+#define UINT_MAX (unsigned)(-1)
+#endif
+
+#ifndef RAND_MAX
+#define RAND_MAX (UINT_MAX)
+#endif
+
+/* define aliases for random number generation */
+#define RAND rand
+#define SEED(a) srand(a)
+
+#define BUFSIZE     8192
+#define DATASIZE    4096
+#define NUM_BITS    32
+
+#define DATA_TAG_1      1000
+#define DATA_REF_1      1000
+
+#define BITIO_TAG_1     1500
+#define BITIO_REF_1     1500
+#define BITIO_TAG_2     2500
+#define BITIO_REF_2     2500
+#define BITIO_TAG_3     3500
+#define BITIO_REF_3     3500
+
+static uint8  outbuf[BUFSIZE],  inbuf[DATASIZE];
+
+static uint32  outbuf2[BUFSIZE],  inbuf2[BUFSIZE],  totbits[BUFSIZE];
+
+static uint32  maskbuf[] =
+{
+    0x00000000,
+    0x00000001, 0x00000003, 0x00000007, 0x0000000f,
+    0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
+    0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
+    0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
+    0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
+    0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
+    0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
+    0x1fffffffUL, 0x3fffffffUL, 0x7fffffffUL, 0xffffffffUL};
+
+static void test_bitio_write(void);
+static void test_bitio_read(void);
+static void test_bitio_seek(void);
+
+static void
+test_bitio_write(void)
+{
+    int32       fid;
+    int32       bitid1;
+    int32       ret;
+    intn        i;
+    uint32      tot_bits = 0;
+
+    MESSAGE(6, printf("Testing bitio write routines\n");
+        );
+    SEED((uintn) time(NULL));
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          totbits[i] = tot_bits;
+          tot_bits += (uint32) (outbuf[i] = (uint8) (((RAND() >> 4) % 32) + 1));    /* number of bits to output */
+          outbuf2[i] = (uintn)RAND() & maskbuf[outbuf[i]];     /* actual bits to output */
+      }     /* end for */
+
+    fid = Hopen(TESTFILE_NAME, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    bitid1 = Hstartbitwrite(fid, BITIO_TAG_1, BITIO_REF_1, 16);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitwrite");
+
+    ret = Hbitappendable(bitid1);
+    RESULT("Hbitappendable");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitwrite(bitid1, (intn)outbuf[i], (uint32) outbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitwrite");
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    bitid1 = Hstartbitread(fid, BITIO_TAG_1, BITIO_REF_1);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitread");
+      }     /* end for */
+    if (HDmemcmp(outbuf2, inbuf2, sizeof(int32) * BUFSIZE))
+      {
+          printf("Error in writing/reading bit I/O data\n");
+          HEprint(stdout, 0);
+          num_errs++;
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    ret = Hclose(fid);
+    RESULT("Hclose");
+}   /* test_bitio_write() */
+
+static void
+test_bitio_read(void)
+{
+    int32       fid;
+    int32       bitid1;
+    int32       ret;
+    intn        inbits;
+    uint32      tempbuf;
+    intn        i;
+    uint8      *test_ptr;
+    char        datafile[512] = "";
+    char       *srcdir = getenv("srcdir");
+
+    SEED((uintn) time(NULL));
+
+    MESSAGE(6, printf("Testing bitio read routines\n");
+        );
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(DATAFILE_NAME) + 1) < sizeof(datafile))) {
+        strcpy(datafile, srcdir);
+        strcat(datafile, "/");
+    }
+    strcat(datafile, DATAFILE_NAME);
+
+    fid = Hopen(datafile, DFACC_READ, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ret = Hgetelement(fid, DATA_TAG_1, DATA_REF_1, inbuf);
+    RESULT("Hgetelement");
+
+    ret = Hclose(fid);
+    RESULT("Hclose");
+
+    MESSAGE(8, printf("Reading 8 bits at a time\n");
+        );
+    fid = Hopen(datafile, DFACC_READ, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    bitid1 = Hstartbitread(fid, DATA_TAG_1, DATA_REF_1);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < DATASIZE; i++)
+      {
+          ret = Hbitread(bitid1, 8, &inbuf2[i]);
+          VERIFY_VOID(ret, 8, "Hbitread");
+      }     /* end for */
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    /* check the data */
+    for (i = 0; i < DATASIZE; i++)
+      {
+          if (inbuf[i] != (uint8) inbuf2[i])
+            {
+                printf("Error in reading bit I/O data at position %d\n", i);
+                num_errs++;
+            }   /* end for */
+      }     /* end for */
+
+    MESSAGE(8, printf("Read random # of bits at a time\n");
+        );
+    bitid1 = Hstartbitread(fid, DATA_TAG_1, DATA_REF_1);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    /* read in random #'s of bits */
+    for (i = 0; i < DATASIZE / (NUM_BITS / 8); i++)
+      {
+          inbits = ((RAND() >> 4) % NUM_BITS) + 1;  /* number of bits to input */
+          ret = Hbitread(bitid1, inbits, &inbuf2[i]);
+          VERIFY_VOID(ret, inbits, "Hbitread");
+          if (inbits < NUM_BITS)
+            {   /* if we've already grabbed 32-bit don't try for more */
+                inbits = NUM_BITS - inbits;
+                ret = Hbitread(bitid1, inbits, &tempbuf);
+                VERIFY_VOID(ret, inbits, "Hbitread");
+                inbuf2[i] <<= inbits;
+                inbuf2[i] |= tempbuf;
+            }   /* end if */
+      }     /* end for */
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    test_ptr = (uint8 *) HDmalloc((size_t)((DATASIZE / 4) * DFKNTsize(DFNT_UINT32)));
+    CHECK_VOID(test_ptr, NULL, "HDmalloc");
+
+    ret = DFKconvert(inbuf2, test_ptr, DFNT_UINT32, (DATASIZE / 4), DFACC_WRITE, 0, 0);
+    RESULT("DFKconvert");
+
+    /* check the data */
+    if (HDmemcmp(inbuf, test_ptr, DATASIZE) != 0)
+      {
+          printf("Error in reading bit I/O data\n");
+          HEprint(stdout, 0);
+          num_errs++;
+      }     /* end if */
+    HDfree(test_ptr);
+
+    ret = Hclose(fid);
+    RESULT("Hclose");
+}   /* test_bitio_read() */
+
+static void
+test_bitio_seek(void)
+{
+    int32       fid;
+    int32       bitid1;
+    int32       ret;
+    intn        i;
+
+    SEED((uintn) time(NULL));
+
+    MESSAGE(6, printf("Testing bitio seek routines\n");
+        );
+
+    fid = Hopen(TESTFILE_NAME, DFACC_READ | DFACC_WRITE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(8, printf("Seek & read from start of dataset\n");
+        );
+    bitid1 = Hstartbitread(fid, BITIO_TAG_1, BITIO_REF_1);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          CHECK_VOID(ret, FAIL, "Hbitseek");
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitread");
+          if (outbuf2[i] != inbuf2[i])
+              printf("outbuf[%d]=%u, outbuf2[%d]=%lu inbuf2[%d]=%lu, totbits[%d]=%lu\n", i, outbuf[i], i, (long) outbuf2[i], i, (long) inbuf2[i], i, (long) totbits[i]);
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    MESSAGE(8, printf("Seek & read from end of dataset\n");
+        );
+    bitid1 = Hstartbitread(fid, BITIO_TAG_1, BITIO_REF_1);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    for (i = BUFSIZE - 1; i >= 0; i--)
+      {
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          CHECK_VOID(ret, FAIL, "Hbitseek");
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitread");
+          if (outbuf2[i] != inbuf2[i])
+              printf("outbuf[%d]=%u, outbuf2[%d]=%lu inbuf2[%d]=%lu, totbits[%d]=%lu\n", i, outbuf[i], i, (long) outbuf2[i], i, (long) inbuf2[i], i, (long) totbits[i]);
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    MESSAGE(8, printf("Seek & write from start of dataset\n");
+        );
+    bitid1 = Hstartbitwrite(fid, BITIO_TAG_1, BITIO_REF_1, 16);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitwrite");
+
+    MESSAGE(9, printf("Writing new data to every other bit-sequence\n");
+        );
+    /* re-write every other sequence of bits in the dataset */
+    for (i = 0; i < BUFSIZE; i += 2)
+      {
+          outbuf2[i] = (uintn)RAND() & maskbuf[outbuf[i]];     /* actual bits to output */
+
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          CHECK_VOID(ret, FAIL, "Hbitseek");
+          ret = Hbitwrite(bitid1, (intn)outbuf[i], (uint32) outbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitwrite");
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    MESSAGE(9, printf("Verifying new data\n");
+        );
+    bitid1 = Hstartbitread(fid, BITIO_TAG_1, BITIO_REF_1);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          RESULT("Hbitseek");
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitread");
+          if (outbuf2[i] != inbuf2[i])
+              printf("outbuf[%d]=%u, outbuf2[%d]=%lu inbuf2[%d]=%lu, totbits[%d]=%lu\n", i, outbuf[i], i, (long) outbuf2[i], i, (long) inbuf2[i], i, (long) totbits[i]);
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    MESSAGE(8, printf("Seek & write from end of dataset\n");
+        );
+    bitid1 = Hstartbitwrite(fid, BITIO_TAG_1, BITIO_REF_1, 16);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitwrite");
+
+    MESSAGE(9, printf("Writing new data to every other bit-sequence from the end\n");
+        );
+    /* re-write every other sequence of bits in the dataset */
+    for (i = BUFSIZE - 1; i >= 0; i -= 2)
+      {
+          outbuf2[i] = (uintn)RAND() & maskbuf[outbuf[i]];     /* actual bits to output */
+
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          RESULT("Hbitseek");
+          ret = Hbitwrite(bitid1, (intn)outbuf[i], (uint32) outbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitwrite");
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    MESSAGE(9, printf("Verifying new data again\n");
+        );
+    bitid1 = Hstartbitread(fid, BITIO_TAG_1, BITIO_REF_1);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    for (i = 0; i < BUFSIZE; i++)
+      {
+          ret = Hbitseek(bitid1, (int32)(totbits[i] / 8), (intn) (totbits[i] % 8));
+          CHECK_VOID(ret, FAIL, "Hbitseek");
+          ret = Hbitread(bitid1, (intn)outbuf[i], &inbuf2[i]);
+          VERIFY_VOID((uint8) ret, outbuf[i], "Hbitread");
+          if (outbuf2[i] != inbuf2[i])
+              printf("outbuf[%d]=%u, outbuf2[%d]=%lu inbuf2[%d]=%lu, totbits[%d]=%lu\n", i, outbuf[i], i, (long) outbuf2[i], i, (long) inbuf2[i], i, (long) totbits[i]);
+      }     /* end for */
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    MESSAGE(8, printf("Write non-byte filling number of bits and seek to beginning\n");
+        );
+    bitid1 = Hstartbitwrite(fid, BITIO_TAG_3, BITIO_REF_3, 0);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitwrite");
+
+    ret = Hbitappendable(bitid1);
+    RESULT("Hbitappendable");
+
+    MESSAGE(9, printf("Writing 35 bits of data out\n"); );
+
+    ret = Hbitwrite(bitid1, 8, (uint32) outbuf[0]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 8, (uint32) outbuf[1]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 8, (uint32) outbuf[2]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 8, (uint32) outbuf[3]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitwrite");
+    ret = Hbitwrite(bitid1, 3, (uint32) outbuf[4]);
+    VERIFY_VOID((uint8) ret, 3, "Hbitwrite");
+
+    ret = Hbitseek(bitid1, 0, 0);
+    RESULT("Hbitseek");
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    /* Read those 35 bits back in */
+    bitid1 = Hstartbitread(fid, BITIO_TAG_3, BITIO_REF_3);
+    CHECK_VOID(bitid1, FAIL, "Hstartbitread");
+
+    ret = Hbitread(bitid1, 8, &inbuf2[0]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 8, &inbuf2[1]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 8, &inbuf2[2]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 8, &inbuf2[3]);
+    VERIFY_VOID((uint8) ret, 8, "Hbitread");
+    ret = Hbitread(bitid1, 3, &inbuf2[4]);
+    VERIFY_VOID((uint8) ret, 3, "Hbitread");
+
+    VERIFY_VOID(outbuf[0],inbuf2[0],"I/O Transfer");
+    VERIFY_VOID(outbuf[1],inbuf2[1],"I/O Transfer");
+    VERIFY_VOID(outbuf[2],inbuf2[2],"I/O Transfer");
+    VERIFY_VOID(outbuf[3],inbuf2[3],"I/O Transfer");
+    VERIFY_VOID((outbuf[4]&maskbuf[3]),inbuf2[4],"I/O Transfer");
+
+    ret = Hendbitaccess(bitid1, 0);
+    RESULT("Hbitendaccess");
+
+    ret = Hclose(fid);
+    RESULT("Hclose");
+}   /* test_bitio_seek() */
+
+void
+test_bitio(void)
+{
+    test_bitio_read();
+    test_bitio_write();
+    test_bitio_seek();
+}
diff --git a/hdf/test/blocks.c b/hdf/test/blocks.c
new file mode 100644
index 0000000..9f60f5e
--- /dev/null
+++ b/hdf/test/blocks.c
@@ -0,0 +1,312 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: blocks.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+#include "tproto.h"
+#define TESTFILE_NAME "tblocks.hdf"
+
+#define BUFSIZE 4096
+
+#define HLCONVERT_TAG 1500
+
+static uint8  outbuf[BUFSIZE],  inbuf[BUFSIZE];
+
+void
+test_hblocks(void)
+{
+    int32       fid, fid1;
+    int32       aid, aid1, aid2;
+    int32       fileid, length, offset, posn;
+    uint16      tag, ref;
+    int16       acc_mode, special;
+    register int i;
+    int32       ret;
+    intn        errors = 0;
+
+    for (i = 0; i < BUFSIZE; i++)
+        outbuf[i] = (char) (i % 256);
+
+    MESSAGE(5, printf("Creating a file %s\n", TESTFILE_NAME);
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Write an element and then promote to Linked Blocks\n");
+        );
+    ret = Hputelement(fid, (uint16) 1000, (uint16) 1,
+                      (const uint8 *)"element 1000 1 wrong ",
+                      (int32)HDstrlen("element 1000 1 wrong ") + 1);
+    CHECK_VOID(ret, FAIL, "Hputelement");
+
+    aid1 = HLcreate(fid, 1000, 1, 10, 10);
+    CHECK_VOID(aid1, FAIL, "HLcreate");
+
+    ret = Hseek(aid1, (int32)HDstrlen("element 1000 1 "), DF_START);
+    CHECK_VOID(ret, FAIL, "Hseek");
+
+    ret = Hwrite(aid1, (int32)HDstrlen("correct") + 1, "correct");
+    if (ret != (int32) HDstrlen("correct") + 1)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Create a new element as a Linked Block\n");
+        );
+    aid1 = HLcreate(fid, 1000, 4, 512, 2);
+    CHECK_VOID(aid1, FAIL, "HLcreate");
+
+    ret = Hwrite(aid1, BUFSIZE / 2, outbuf);
+    if (ret != BUFSIZE / 2)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    aid1 = HLcreate(fid, 1000, 2, 128, 16);
+    CHECK_VOID(aid1, FAIL, "HLcreate");
+
+    ret = Hwrite(aid1, (int32)HDstrlen("element 1000 2") + 1, "element 1000 2");
+    if (ret != (int32) HDstrlen("element 1000 2") + 1)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+    ret = Hgetelement(fid, (uint16) 1000, (uint16) 4, inbuf);
+    if (ret != BUFSIZE / 2)
+      {
+          fprintf(stderr, "ERROR(%d): Hgetelement returned the wrong length: %d\n", (int)__LINE__,(int) ret);
+          errors++;
+      }
+
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+
+    aid1 = HLcreate(fid, 1020, 2, 128, 4);
+    CHECK_VOID(aid1, FAIL, "HLcreate");
+
+    ret = Hwrite(aid1, BUFSIZE, outbuf);
+    if (ret != BUFSIZE)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing and re-opening file %s\n", TESTFILE_NAME);
+        );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    aid1 = Hstartread(fid, 1000, 1);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+      }
+
+    ret = Hread(aid1, length, inbuf);
+    if (ret != 23)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+      }
+
+    if (HDstrcmp((const char *) inbuf, (const char *) "element 1000 1 correct"))
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong data\n");
+          fprintf(stderr, "\t       Is: %s\n", (char *) inbuf);
+          fprintf(stderr, "\tShould be: element 1000 1 correct\n");
+          errors++;
+      }
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    ret = Hnextread(aid1, 1000, DFREF_WILDCARD, DF_CURRENT);
+    CHECK_VOID(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+      }
+
+    ret = Hnextread(aid1, DFTAG_WILDCARD, DFREF_WILDCARD, DF_START);
+    CHECK_VOID(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (special)
+      {
+          fprintf(stderr, "ERROR: Hinquire thinks a non-special element is special\n");
+          errors++;
+      }
+
+    ret = Hnextread(aid1, DFTAG_WILDCARD, 1151, DF_CURRENT);
+    if (ret != FAIL)
+      {
+          fprintf(stderr, "ERROR: Hnextread found object with bogus ref\n");
+          errors++;
+      }
+
+    ret = Hnextread(aid1, 1020, DFREF_WILDCARD, DF_CURRENT);
+    CHECK_VOID(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+      }
+
+    MESSAGE(5, printf("Writing to existing element\n");
+        );
+    aid2 = Hstartwrite(fid, 1000, 1, 4);
+    CHECK_VOID(aid2, FAIL, "Hstartwrite");
+
+    ret = Hwrite(aid2, 4, "ABCD");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+      }
+
+    /* let's try to write to a read element for fun */
+    ret = Hwrite(aid1, 4, "ABCD");
+    if (ret != FAIL)
+      {
+          fprintf(stderr, "ERROR: Hwrite allowed write to read access obj\n");
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Open a second id for file %s\n", TESTFILE_NAME);
+        );
+    fid1 = Hopen(TESTFILE_NAME, DFACC_READ, 0);
+    CHECK_VOID(fid1, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid1);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Closing the files\n");
+        );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    ret = Hclose(fid1);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Testing HLconvert function\n");
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_WRITE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ref = Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    aid = Hstartwrite(fid, HLCONVERT_TAG, ref, 5);
+    CHECK_VOID(aid, FAIL, "Hstartwrite");
+
+    ret = Hwrite(aid, 4, outbuf);
+    CHECK_VOID(ret, FAIL, "Hwrite");
+
+    ret = HLconvert(aid, 256, 10);
+    CHECK_VOID(ret, FAIL, "HLconvert");
+
+    ret = Hwrite(aid, 508, &outbuf[4]);
+    CHECK_VOID(ret, FAIL, "Hwrite");
+
+    ret = Hendaccess(aid);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    aid = Hstartread(fid, HLCONVERT_TAG, ref);
+    CHECK_VOID(aid, FAIL, "Hstartread");
+
+    ret = Hread(aid, 512, inbuf);
+    CHECK_VOID(ret, FAIL, "Hread");
+
+    ret = Hendaccess(aid);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    if (HDmemcmp(inbuf, outbuf, 512))
+      {
+          fprintf(stderr, "Error when reading data from HLconvert buffer\n");
+          errors++;
+      }
+
+    num_errs += errors;     /* increment global error count */
+}
diff --git a/hdf/test/buffer.c b/hdf/test/buffer.c
new file mode 100644
index 0000000..a6908d6
--- /dev/null
+++ b/hdf/test/buffer.c
@@ -0,0 +1,567 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+    FILE - buffer.c
+        Test HDF buffered data I/O routines
+
+    DESIGN
+        - Create a new data element and get a benchmark time for reading it in
+            various ways.
+        - Buffer the element and get times for the buffered element.
+        - Make a new external element and get benchmark times
+        - Buffer the external element and get times for the buffered element.
+        - Make a new compressed element and get benchmark times
+        - Buffer the compressed element and get times for the buffered element.
+        - Make a new linked block element and get benchmark times
+        - Buffer the linked block element and get times for the buffered element.
+    
+    BUGS/LIMITATIONS
+
+    EXPORTED ROUTINES
+
+    AUTHOR
+        Quincey Koziol
+
+    MODIFICATION HISTORY
+        12/11/98 - Wrote tests
+        12/20/06 - Compute the wallclock time and use the environment
+                   variable or macro HDF4_TESTPREFIX to add prefix to the
+                   testing files names. Also, it allows to specify the number
+                   of elements in buffer at the command line.
+
+ */
+
+/* $Id: buffer.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+#define TESTMASTER
+
+#include <sys/time.h>
+#include "hdf.h"
+#include "tutils.h"
+#include "hfile.h"
+
+#define TESTFILE_NAME "tbuffer.hdf"
+#define EXTFILE_NAME "tbuffer.dat"
+
+/* Size of data elements to create */
+#ifdef __CRAY_XT3__
+/* Use a smaller test size as small unbuffered IO is expensive in XT3. */
+/* This runs much faster in Lustre file system like /scratchN. elemsize 1000 */
+/* takes 3 minutes to run in /scratch3. 2006/6/20, -AKC- */
+#define ELEMSIZE 1000
+#else
+#define ELEMSIZE 16384
+#endif
+
+/* define aliases for random number generation */
+#define RAND rand
+#define SEED(a) srand((unsigned)(a))
+
+/* Tag to use for creating the test elements */
+#define BUFF_TAG 1000
+
+/* Number of tests */
+#define NUM_TESTS       4
+
+/* Factor for converting seconds to microseconds */
+#define FACTOR 1000000
+
+/* Number of timing tests to run */
+/* 0 - read/write entire buffer in one I/O operation */
+/* 1 - read/write entire buffer one byte at a time forwards */
+/* 2 - read/write entire buffer one byte at a time every other byte forwards */
+/* 3 - read/write entire buffer one byte at a time backwards */
+/* 4 - read/write entire buffer one byte at a time every other byte backwards */
+#define NUM_TIMINGS     5
+long read_time[NUM_TESTS][2];    /* 0 is unbuffered, 1 is buffered */
+long write_time[NUM_TESTS][2];   /* 0 is unbuffered, 1 is buffered */
+
+int32 elemsize;    /* Actual number of elements in buffer */
+
+/* I/O buffers */
+uint8 *out_buf;    /* Buffer for writing data */
+uint8 *in_buf;     /* Buffer for reading data */
+
+/* local function prototypes */
+static void init_buffer(void);
+static void usage(void);
+static char *fixname(const char *base_name, char *fullname, size_t size);
+static long read_test(int32 aid); 
+static long write_test(int32 aid,intn num_timings); 
+
+/* Initialize output buffer */
+static void
+init_buffer(void)
+{
+    intn        j;
+
+    SEED(time(NULL));
+    for (j = 0; j < elemsize; j++)
+      {
+          out_buf[j] = (uint8) RAND();
+      }     /* end for */
+}   /* init_buffers() */
+
+static void
+usage(void)
+{
+    printf("\nUsage: buffer [elemsize] \n\n");
+    printf("where elemsize is the number of elements in buffer (default: 1000 in Cray, 16384 in other platforms)\n");
+    printf("\n");
+}   /* end usage() */
+
+
+/*
+   Creates a file name from a file base name like 'test' and return it through
+   the FULLNAME (at most SIZE characters counting the null terminator). The
+   full name is created by prepending the contents of HDF4_TESTPREFIX
+   (separated from the base name by a slash). Returns NULL if BASENAME or
+   FULLNAME is the null pointer or if FULLNAME isn't large enough for the
+   result.
+*/
+static char *fixname(const char *base_name, char *fullname, size_t size)
+{
+    const char  *prefix = NULL;
+    char        *ptr, last = '\0';
+    size_t      i, j;
+
+    if (!base_name || !fullname || size<1)
+        return NULL;
+
+    memset(fullname, 0, size);
+
+    /* First use the environment variable, then try the constant */
+    prefix = getenv("HDF4_TESTPREFIX");
+
+#ifdef HDF4_TESTPREFIX
+    if (!prefix)
+        prefix = HDF4_TESTPREFIX;
+#endif
+
+    /* Prepend the prefix value to the base name */
+    if (prefix && *prefix) {
+        if (snprintf(fullname, size, "%s/%s", prefix, base_name)==(int)size)
+            /* Buffer is too small */
+            return NULL;
+    } /* end if */
+    else {
+        if (strlen(base_name) >= size)
+            /* Buffer is too small */
+            return NULL;
+        else
+            strcpy(fullname, base_name);
+    } /* end else*/
+
+    /* Remove any double slashes in the filename */
+    for (ptr = fullname, i = j = 0; ptr && i < size; i++, ptr++) {
+        if (*ptr != '/' || last != '/')
+            fullname[j++] = *ptr;
+        last = *ptr;
+    } /* end for */
+    return fullname;
+
+} /* end fixname() */
+
+
+static long 
+read_test(int32 aid)
+{
+    struct timeval start_time, end_time;     /* timing counts */
+    long acc_time;
+    int32       ret;
+    intn i;             /* local counting index */
+    intn timing;       /* Which timing test we are on */
+    intn err_count;     /* number of incorrect array positions */
+
+    acc_time=0;
+    for(timing=0; timing<NUM_TIMINGS; timing++) {
+
+        /* Seek to beginning of element */
+        ret=Hseek(aid,0,DF_START);
+        CHECK(ret, FAIL, "Hseek");
+
+        switch(timing) {
+            case 0:     /* Read entire buffer in one I/O operation */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                ret=Hread(aid,elemsize,in_buf);
+                VERIFY(ret, elemsize, "Hread");
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 1:     /* Read entire buffer one byte at a time forwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=0; i<elemsize; i++) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hread(aid,1,&in_buf[i]);
+                    VERIFY(ret, 1, "Hread");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 2:     /* Read entire buffer one byte at a time every one byte forwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=0; i<elemsize; i+=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hread(aid,1,&in_buf[i]);
+                    VERIFY(ret, 1, "Hread");
+                } /* end for */
+                for(i=1; i<elemsize; i+=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hread(aid,1,&in_buf[i]);
+                    VERIFY(ret, 1, "Hread");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 3:     /* Read entire buffer one byte at a time backwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=elemsize-1; i>=0; i--) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hread(aid,1,&in_buf[i]);
+                    VERIFY(ret, 1, "Hread");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 4:     /* Read entire buffer one byte at a time every one byte backwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=elemsize-1; i>=0; i-=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hread(aid,1,&in_buf[i]);
+                    VERIFY(ret, 1, "Hread");
+                } /* end for */
+                for(i=elemsize-2; i>=0; i-=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hread(aid,1,&in_buf[i]);
+                    VERIFY(ret, 1, "Hread");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+        } /* end switch */
+
+        /* Verify buffer contents */
+        for(err_count=0,i=0; i<elemsize; i++) {
+            if(out_buf[i]!=in_buf[i]) {
+                printf("Position (%d) read in is (%d), should be (%d)\n",i,(int)in_buf[i],(int)out_buf[i]);
+                num_errs++;
+                err_count++;
+                if(err_count>10)
+                    break;
+            } /* end if */
+        } /* end for */
+
+        /* Clear input buffer */
+        HDmemset(in_buf,0,elemsize);
+
+        /* Increment the total I/O time */
+        acc_time+=(end_time.tv_sec-start_time.tv_sec)*FACTOR+
+                  (end_time.tv_usec-start_time.tv_usec);
+    } /* end for */
+
+    return(acc_time);
+}   /* end read_test() */
+
+static long 
+write_test(int32 aid,intn num_timings)
+{
+    struct timeval start_time, end_time;     /* timing counts */
+    long acc_time;
+    int32       ret;
+    intn i;             /* local counting index */
+    intn timing;       /* Which timing test we are on */
+
+    acc_time=0;
+    for(timing=0; timing<num_timings; timing++) {
+
+        /* Refresh output buffer with new values */
+        init_buffer();
+
+        /* Seek to beginning of element */
+        ret=Hseek(aid,0,DF_START);
+        CHECK(ret, FAIL, "Hseek");
+
+        switch(timing) {
+            case 0:     /* Write entire buffer in one I/O operation */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                ret=Hwrite(aid,elemsize,out_buf);
+                VERIFY(ret, elemsize, "Hwrite");
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 1:     /* Write entire buffer one byte at a time forwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=0; i<elemsize; i++) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hwrite(aid,1,&out_buf[i]);
+                    VERIFY(ret, 1, "Hwrite");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 2:     /* Write entire buffer one byte at a time every one byte forwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=0; i<elemsize; i+=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hwrite(aid,1,&out_buf[i]);
+                    VERIFY(ret, 1, "Hwrite");
+                } /* end for */
+                for(i=1; i<elemsize; i+=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hwrite(aid,1,&out_buf[i]);
+                    VERIFY(ret, 1, "Hwrite");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 3:     /* Write entire buffer one byte at a time backwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=elemsize-1; i>=0; i--) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hwrite(aid,1,&out_buf[i]);
+                    VERIFY(ret, 1, "Hwrite");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+
+            case 4:     /* Write entire buffer one byte at a time every one byte backwards */
+                gettimeofday(&start_time,(struct timezone*)0);                
+                for(i=elemsize-1; i>=0; i-=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hwrite(aid,1,&out_buf[i]);
+                    VERIFY(ret, 1, "Hwrite");
+                } /* end for */
+                for(i=elemsize-2; i>=0; i-=2) {
+                    /* Seek to correct location within element */
+                    ret=Hseek(aid,i,DF_START);
+                    CHECK(ret, FAIL, "Hseek");
+
+                    ret=Hwrite(aid,1,&out_buf[i]);
+                    VERIFY(ret, 1, "Hwrite");
+                } /* end for */
+                gettimeofday(&end_time,(struct timezone*)0);                
+                break;
+        } /* end switch */
+
+        /* Seek to beginning of element */
+        ret=Hseek(aid,0,DF_START);
+        CHECK(ret, FAIL, "Hseek");
+
+        /* Read buffer contents */
+        ret=Hread(aid,elemsize,in_buf);
+        VERIFY(ret, elemsize, "Hread");
+
+        /* Verify buffer contents */
+        for(i=0; i<elemsize; i++) {
+            if(out_buf[i]!=in_buf[i]) {
+                printf("Position (%d) read in is (%d), should be (%d)\n",i,(int)in_buf[i],(int)out_buf[i]);
+                num_errs++;
+                break;
+            } /* end if */
+        } /* end for */
+
+
+        /* Clear input buffer */
+        HDmemset(in_buf,0,elemsize);
+
+        /* Increment the total I/O time */
+        acc_time+=(end_time.tv_sec-start_time.tv_sec)*FACTOR+
+                  (end_time.tv_usec-start_time.tv_usec);
+    } /* end for */
+
+    return(acc_time);
+}   /* end read_test() */
+
+int
+main(int argc, char *argv[])
+{
+    model_info  m_info;
+    comp_info   c_info;
+    uint16      ref_num;        /* reference number of the data written out */
+    int32       fid;            /* file ID of HDF file for testing */
+    int32       aid;            /* AID of element to test */
+    intn        test_num;
+    int32       ret;
+    char	hfilename[32];
+    char	extfilename[32];
+    int		CleanUp = 1;
+    int		Cache = 1;
+    uint32      lmajor, lminor, lrelease;
+    char	lstring[81];
+
+    /* Un-buffer the stdout and stderr */
+    setbuf(stderr, NULL);
+    setbuf(stdout, NULL);
+
+    if (argc>2) {
+        usage();
+        exit(1);
+    }
+    else 
+        elemsize = (argc==2)? (int32)atol(argv[1]):(int32)ELEMSIZE;
+
+    if (elemsize<=0) {
+        usage();
+        exit(1);
+    }
+
+    out_buf = malloc(elemsize * sizeof(uint8));
+    in_buf = malloc(elemsize * sizeof(uint8));    
+        
+    Verbosity = 4;  /* Default Verbosity is Low */
+
+    Hgetlibversion(&lmajor, &lminor, &lrelease, lstring);
+
+    printf("Built with HDF Library Version: %u.%u.%u, %s\n\n", (unsigned) lmajor,
+           (unsigned) lminor, (unsigned) lrelease, lstring);
+
+    MESSAGE(6, printf("Starting buffered element test (elemsize=%d)\n", elemsize);
+        )
+
+    if(Cache) /* turn on caching, unless we were instucted not to */
+        Hcache(CACHE_ALL_FILES,TRUE);
+
+    /* fill the buffer with interesting data to compress */
+    init_buffer();
+
+    fixname(TESTFILE_NAME, hfilename, sizeof hfilename);
+
+    /* open the HDF file */
+    fid = Hopen(hfilename, DFACC_ALL, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    /* Cycle through the different testing element types */
+    /* Performing timings on each type of buffer and record results for output */
+    /* if verbosity level is high enough */
+    for (test_num = 0; test_num < NUM_TESTS; test_num++)
+      {
+        /* Get a new reference number */
+        ref_num=Htagnewref(fid,BUFF_TAG);
+        CHECK(ref_num, 0, "Htagnewref");
+
+        /* Create the data element to perform the tests on */
+        switch(test_num) {
+            case 0:     /* create plain data element */
+                aid=Hstartaccess(fid,BUFF_TAG,ref_num,DFACC_RDWR);
+                CHECK(aid, FAIL, "Hstartaccess");
+                break;
+
+            case 1:     /* create external data element */
+		fixname(EXTFILE_NAME, extfilename, sizeof extfilename);
+                aid=HXcreate(fid,BUFF_TAG,ref_num,extfilename,0,elemsize);
+                CHECK(aid, FAIL, "HXcreate");
+                break;
+
+            case 2:     /* create compressed data element */
+                c_info.deflate.level=9;
+                aid=HCcreate(fid,BUFF_TAG,ref_num,COMP_MODEL_STDIO,&m_info,COMP_CODE_DEFLATE,&c_info);
+                CHECK(aid, FAIL, "HCcreate");
+                break;
+
+            case 3:     /* create linked-block data element */
+                aid=HLcreate(fid,BUFF_TAG,ref_num,HDF_APPENDABLE_BLOCK_LEN,HDF_APPENDABLE_BLOCK_NUM);
+                CHECK(aid, FAIL, "HLcreate");
+                break;
+
+        } /* end switch */
+
+        /* Write the initial data to the data element */
+        ret=Hwrite(aid,elemsize,out_buf);
+        VERIFY(ret, elemsize, "Hwrite");
+
+        /* Perform read timing tests on un-buffered data element */
+        read_time[test_num][0]=read_test(aid);
+        
+        /* Perform write timing tests on un-buffered data element */
+        /* Just write un-buffered compressed data in one block */
+        write_time[test_num][0]=write_test(aid,(test_num==2 ? 1 : NUM_TIMINGS));
+
+        /* Convert element to a buffered element */
+        ret=HBconvert(aid);
+        CHECK(ret, FAIL, "HBconvert");
+
+        /* Perform read timing tests on buffered data element */
+        read_time[test_num][1]=read_test(aid);
+
+        /* Perform write timing tests on un-buffered data element */
+        write_time[test_num][1]=write_test(aid,NUM_TIMINGS);
+
+        /* Close data element */
+        ret=Hendaccess(aid);
+        CHECK(ret, FAIL, "Hendaccess");
+
+        MESSAGE(3, {
+            printf("Unbuffered read time=%f seconds\n",((float)read_time[test_num][0]/FACTOR));
+            printf("Unbuffered write time=%f seconds\n",((float)write_time[test_num][0]/FACTOR));
+            printf("Buffered read time=%f seconds\n",((float)read_time[test_num][1]/FACTOR));
+            printf("Buffered write time=%f seconds\n",((float)write_time[test_num][1]/FACTOR));
+        }
+            )
+
+    }     /* end for */
+
+    /* close the HDF file */
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    /* Clean up files created */
+    if (CleanUp) {
+        remove(extfilename);
+        remove(hfilename);
+    }
+
+    free(out_buf);
+    free(in_buf);
+
+    MESSAGE(6, printf("Finished buffered element test\n");
+        )
+    exit(num_errs);
+    return num_errs;
+}   /* end main() */
diff --git a/hdf/test/chunks.c b/hdf/test/chunks.c
new file mode 100644
index 0000000..22763c6
--- /dev/null
+++ b/hdf/test/chunks.c
@@ -0,0 +1,2514 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6032 $";
+#endif
+
+/* $Id: chunks.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+/*
+ * This file tests the Special Chunking Element(HMCxxx) layer of the HDF library.
+ *
+ * NOTE: No failure conditions are tested yet....
+ *
+ * Outline of Tests done:
+ *    1. First test simple writing of 2-D element with no ghost/partial chunks.
+ *       4x4 array of uint8, each chunk 2x2(4 bytes) -> 4 chunks(16 bytes).
+ *       Write out 12 bytes to all 4 chunks with only partial writes
+ *       to the last 2 chunks..
+ *       Write again to last 2 chunks with whole data chunks 
+ *
+ *    2. Now create a new chunked 2-D element with same parameters
+ *       before but write to 2 chunks of element using whole chunks.
+ *       The rest of he data should contain fill values.
+ *
+ *    3. Create a new element but now there will be partial chunks
+ *       because chunk lengths are not an even multiple of dimesion lengths.
+ *       Set dimension to 4x4 array with 4 chunks where each chunk is 
+ *       3x2 = 6 bytes. Real data size is 16 bytes, size with chunks is 
+ *       6 bytes x 4 chunks = 24 bytes 
+ *
+ *    4. Now create 3-D chunked element with no partial chunks.
+ *       Write to only part of the chunked element. The rest
+ *       should be filled with fill values.
+ *       Set dimension to 4x6x8 array with 8 chunks 
+ *       where each chunk is 2x3x4= 24 bytes , read data size 192 bytes 
+ *       data size with chunks is 192 bytes also.
+ *
+ *    5. Now create another 3-D chunked element with partial chunks.
+ *       Write to part of element, rest is filled with fill value.
+ *       Set dimension to 4x6x8 array with 8 chunks , real data 192 bytes
+ *       where each chunk is 3x4x5= 60 bytes , 
+ *       data size with chunks is 60 bytes x 8 chunks = 480 bytes  
+ *
+ *    6. Now create 3-D chunked element with no partial chunks.
+ *       Write using HMCwriteChunk(). Read data back in first
+ *       using Hread() and verify. Then read data back in using
+ *       HMCreadChunk() and verify.
+ *       Set dimension to 2x3x4 array with 6 chunks 
+ *       where each chunk is 1x1x4= 4 bytes , total data size 24 bytes 
+ *
+ *    7. Now create 3-D chunked element with no partial chunks.
+ *       Set dimension to 2x3x4 array with 6 chunks. Number type is uint16 
+ *       where each chunk is 1x1x4= 4x2(nt_size) = 8 bytes , 
+ *       total data size 48 bytes 
+ *
+ *    8. Now create 3-D chunked element with no partial chunks.
+ *       Set dimension to 2x3x4 array with 6 chunks. Numbertype is float32 
+ *       where each chunk is 1x1x4= 4x4(nt_size) = 16 bytes , 
+ *       total data size 96 bytes .
+ *    
+ *    9. Create 4-D element with partial chunks.
+ *       Write only half the data out(5,000 bytes)
+ *       Set dimension to 10x10x10x10 array -> real data 10,000 bytes .
+ *       120 chunks with chunks of 2x3x4x5 = 120 bytes,
+ *       data size with chunks is 120 bytes x 120 chunks = 14,400 bytes 
+ *
+ *    10. *NOT ENABLED*
+ *       The rest of the tests here are commented out
+ *       They are some extra high order tests to replicate
+ *       some test done on EOS-DEM data 
+ *       Set dimension to 12000x12000 array with 2,500 chunks 
+ *       whith chunk of 240x240 = 57,600 bytes
+ *
+ *    11. Create a new element but now there will be partial chunks and Compression.
+ *       Set dimension to 4x4 array with 4 chunks where each chunk is 3x2 = 6 bytes.
+ *       Real data size is 16 bytes, size with chunks is 
+ *       6 bytes x 4 chunks = 24 bytes.
+ *       The element will be compressed with RLE scheme.
+ *
+ *    12. Now create 3-D chunked, Compressed element with no partial chunks.
+ *       Write using HMCwriteChunk(). Read data back in first
+ *       using Hread() and verify. Then read data back in using
+ *       HMCreadChunk() and verify.
+ *       Set dimension to 2x3x4 array with 6 chunks 
+ *       where each chunk is 1x1x4= 4 bytes , total data size 24 bytes 
+ *       The element is compressed using RLE scheme.
+ *
+ *  For all the tests the data is read back in and verified.
+ *
+ *  Routines tested using User level H-level calls:
+ *   Hstartread()         -> HMCPstread()
+ *   Hstartwrite()        -> HMCPstwrite()
+ *   Hread()              -> HMCPread()
+ *   Hwrite()             -> HMCPwrite()
+ *   Hseek()              -> HMCPseek()
+ *   Hendaccess()         -> HMCPendaccess()
+ *   Hinquire()           -> HMCPinquire()
+ *   HDget_special_info() -> HMCPinfo()
+ *
+ * Routines test by direct calling of Chunking routines:
+ *   HMCcreate()
+ *   HMCsetMaxCache()
+ *   HMCwriteChunk()
+ *   HMCreadChunk()
+ *
+ *
+ * Author -GeorgeV
+ *
+ */
+
+#include "tproto.h"
+#include "hchunks.h"
+
+#define TESTFILE_NAME "tchunks.hdf"
+#define BUFSIZE       12288
+
+/* Some static data buffers */
+static uint8  outbuf[BUFSIZE],  /* output data buffer */
+               inbuf[BUFSIZE];   /* input data buffer */
+
+/* used to verify data in Test 2. */
+static uint8  outbuf_2[16] = {0,0,2,3,0,0,6,7,8,9,0,0,12,13,0,0};
+
+/* used to in Tests 1,2 */
+static    uint8      cptr3[4] = {10,11,14,15};
+static    uint8      cptr2[4] = {8,9,12,13};
+static    uint8      cptr1[4] = {2,3,6,7};
+
+/* for writing/verifying some chunks used in Test 6*/
+static uint8  chunk1[4] = { 0, 1, 2, 3};
+
+static uint8  chunk2[4] = { 10, 11, 12, 13};
+
+static uint8  chunk3[4] = { 20, 21, 22, 23};
+
+static uint8  chunk4[4] = { 100, 101, 102, 103};
+
+static uint8  chunk5[4] = { 110, 111, 112, 113};
+
+static uint8  chunk6[4] = { 120, 121, 122, 123};
+
+/* datay layout of arrays in memory */
+/* for comparison in Test 8 */
+static float32  f32_data[2][3][4] =
+{
+    {
+        {(float32) 0.0, (float32) 1.0, (float32) 2.0, (float32) 3.0},
+        {(float32) 10.0, (float32) 11.0, (float32) 12.0, (float32) 13.0},
+        {(float32) 20.0, (float32) 21.0, (float32) 22.0, (float32) 23.0}},
+    {
+        {(float32) 100.0, (float32) 101.0, (float32) 102.0, (float32) 103.0},
+        {(float32) 110.0, (float32) 111.0, (float32) 112.0, (float32) 113.0},
+        {(float32) 120.0, (float32) 121.0, (float32) 122.0, (float32) 123.0}}};
+
+/* for comparison in Test 7 */
+static uint16  u16_data[2][3][4] =
+{
+    {
+        { 0, 1, 2, 3},
+        { 10, 11, 12, 13},
+        { 20, 21, 22, 23}},
+    {
+        { 100, 101, 102, 103},
+        { 110, 111, 112, 113},
+        { 120, 121, 122, 123}}};
+
+/* for comparison in Test 6 */
+static uint8  u8_data[2][3][4] =
+{
+    {
+        { 0, 1, 2, 3},
+        { 10, 11, 12, 13},
+        { 20, 21, 22, 23}},
+    {
+        { 100, 101, 102, 103},
+        { 110, 111, 112, 113},
+        { 120, 121, 122, 123}}};
+
+/*
+ * main entry point to tests the Special Chunking layer...
+ *
+ * -GeorgeV
+ */
+void
+test_chunks(void)
+{
+    int32       fid;
+    int32       aid1, aid2;
+    int32       fileid, length, offset, posn;
+    uint16      tag, ref;
+    int16       acc_mode, special;
+    register int i, j, k;
+#ifdef BIG_TEST
+    int32       x,y;
+    int32      nseek = 0;
+#endif
+    int32       ret;
+    HCHUNK_DEF   chunk[1];       /* Chunk definition, see 'hchunks.h' */
+    int32       dims[5];
+    int32      fill_val_len = 1;
+    uint8      fill_val_u8 = 0;      /* test 6 */
+    uint16     fill_val_u16 = 0;     /* test 7 */
+    float32    fill_val_f32 = (float32)0.0; /* test 8 */
+    uint8      inbuf_u8[2][3][4];
+    uint16     inbuf_u16[2][3][4];   /* input data buffer */
+    float32    inbuf_f32[2][3][4];   /* input data buffer */
+    sp_info_block_t info_block;      /* special info block */
+    comp_info  cinfo;
+    model_info minfo;
+    intn       errors = 0;
+
+    /* intialize out buffer */
+    for (i = 0; i < BUFSIZE; i++)
+        outbuf[i] = (char) (i % 256);
+
+    /* allocate space for chunk dimensions */
+    if ((chunk[0].pdims = (DIM_DEF *)HDmalloc(5*sizeof(DIM_DEF))) == NULL)
+      {
+          printf("test_chunks: error allocatin space for chunk dims\n");
+          errors++;
+          goto done;
+      }
+
+    /* Create file first */
+    MESSAGE(5, printf("Creating a file %s\n", TESTFILE_NAME); );
+    fid = Hopen(TESTFILE_NAME, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+
+    /*
+      1.First test simple writing of 2-D element with no ghost/partial chunks.
+      Set dimension to 4x4 array with 4 chunks 
+      where each chunk is 2x2.
+      Write out 12 bytes to all 4 chunks with only partial writes
+      to the last 2 chunks..
+      Write again to last 2 chunks with whole data chunks 
+      */
+    chunk[0].num_dims   = 2; /* 2-D */
+    chunk[0].chunk_size = 4; /* 2x2 = 4 bytes */
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+
+    chunk[0].pdims[0].dim_length   = 4;
+    chunk[0].pdims[0].chunk_length = 2;
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 4;
+    chunk[0].pdims[1].chunk_length = 2;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    MESSAGE(5, printf("Test 1. Create a new element as a 2-D, uint8 chunked element\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill,  chunk array */
+    aid1 = HMCcreate(fid, 1020, 2, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+#if 0
+    /* write 16 bytes out */
+    ret = Hwrite(aid1, 16, outbuf);
+    if (ret != 16)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote first 16 bytes to 2-D, uint8 chunked element to file\n"); );
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+#endif
+
+    /* write 12 bytes out */
+    ret = Hwrite(aid1, 12, outbuf);
+    if (ret != 12)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote first 12 bytes to 2-D, uint8 chunked element to file\n"); );
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 2-D chunked element again for writing\n"); );
+
+    /* Open file for writing last 2 chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start write access   tag,  ref */
+    aid1 = Hstartwrite(fid, 1020, 2, 16);
+    CHECK_VOID(aid1, FAIL, "Hstartwrite");
+
+    /* Try writing to last chunk in the element */
+    dims[0] = 1;
+    dims[1] = 1;
+    ret = HMCwriteChunk(aid1, dims, cptr3);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    MESSAGE(5, printf("Wrote to 4th chunk(4of4 chunks) in file\n"););
+
+    /* Try writing to 2nd to last chunk in the element */
+    dims[0] = 1;
+    dims[1] = 0;
+    ret = HMCwriteChunk(aid1, dims, cptr2);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    MESSAGE(5, printf("Wrote to 3 chunk (3of4 chunks) in file\n"););
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 2-D, uint8 chunked element again for reading \n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 2);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+    /* Check values from Hinquire */
+    if (ref != 2 || length != 16)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Get/Check special info data\n"); );
+
+    /* get special info about element */
+    ret = HDget_special_info(aid1, &info_block);
+    CHECK_VOID(aid1, FAIL, "HDget_special_info");
+
+    /* check special info */
+    if (info_block.ndims != chunk[0].num_dims /* 2-D */)
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+    /* check chunk_lengths */
+    if (info_block.cdims != NULL)
+      {
+          if ((info_block.cdims[0] != 2) || (info_block.cdims[1] != 2))
+            {
+                fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+                errors++;
+                goto done;
+            }
+
+          /* free allocated space by routine */
+          HDfree(info_block.cdims);
+      }
+    else
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 16, inbuf);
+    VERIFY_VOID(ret, 16, "Hread");
+    if (ret != 16)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 16 bytes of data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+
+      }
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* 
+       2. Now create a new chunked 2-D element with same parameters
+       before but write to 2 chunks of element using whole chunks.
+       The rest of he data should contain fill values.
+       */
+
+    /* Open file for writing again */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(5, printf("Test 2. Create another new element as a 2-D, uint8 chunked element\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 3, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* Try writing to 2 chunk in the element */
+    dims[0] = 1;
+    dims[1] = 0;
+    ret = HMCwriteChunk(aid1, dims, cptr2);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    MESSAGE(5, printf("Wrote to 3 chunk (3of4) in file\n"); );
+
+    /* Try writing to 1 chunk in the element */
+    dims[0] = 0;
+    dims[1] = 1;
+    ret = HMCwriteChunk(aid1, dims, cptr1);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    MESSAGE(5, printf("Wrote to 2nd chunk (2of4 chunks) in file\n"); );
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* Now reopen and read back 16 bytes */
+    MESSAGE(5, printf("Open 2-D, uint8 chunked element again for reading \n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 3);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 3 || length != 16)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 16, inbuf);
+    VERIFY_VOID(ret, 16, "Hread");
+    if (ret != 16)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data, check against 'outbuf_2'  
+       some of the data should be filled with fill value of 0 */
+    MESSAGE(5, printf("Verifying 16 bytes of data, there will be some fill values\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf_2[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf_2[i], inbuf[i]);
+                errors++;
+            }
+      }
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+    /* 
+       3. Create a new element but now there will be partial chunks
+       because chunk lengths are not an even multiple of dimesion lengths.
+       Set dimension to 4x4 array with 4 chunks where each chunk is 3x2 = 6 bytes.
+       Real data size is 16 bytes, size with chunks is 
+       6 bytes x 4 chunks = 24 bytes 
+       */
+    chunk[0].num_dims   = 2;
+    chunk[0].chunk_size = 6; /* 3x2 = 6 bytes */
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+
+    chunk[0].pdims[0].dim_length   = 4;
+    chunk[0].pdims[0].chunk_length = 3;  /* made this 3 */
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 4;
+    chunk[0].pdims[1].chunk_length = 2;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    /* Open file for writing odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(5, printf("Test 3. Create another new element as a 2-D, uint8 chunked element\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 5, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* write 16 bytes out */
+    ret = Hwrite(aid1, 16, outbuf);
+    VERIFY_VOID(ret, 16, "Hwrite");
+    if (ret != 16)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote to 4of4 chunks (16 bytes) in file\n"););
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 2-D, uint8 chunked element again for reading\n"); );
+
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 5);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 5 || length != 16)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 16, inbuf);
+    VERIFY_VOID(ret, 16, "Hread");
+    if (ret != 16)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 16 bytes of data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+    /* 
+       4. Now create 3-D chunked element with no partial chunks.
+       Write to only part of the chunked element. The rest
+       should be filled with fill values.
+       Set dimension to 4x6x8 array with 8 chunks 
+       where each chunk is 2x3x4= 24 bytes , total data size 192 bytes 
+       */
+    chunk[0].num_dims   = 3;
+    chunk[0].chunk_size = 24; /* 2x3x4 bytes */
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+
+    chunk[0].pdims[0].dim_length   = 4;
+    chunk[0].pdims[0].chunk_length = 2;  
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 6;
+    chunk[0].pdims[1].chunk_length = 3;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    chunk[0].pdims[2].dim_length   = 8;
+    chunk[0].pdims[2].chunk_length = 4;
+    chunk[0].pdims[2].distrib_type = 1;
+
+    /* Open file for writing last odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    MESSAGE(5, printf("Test 4. Create another new element as a 3-D, uint8 chunked element(192 bytes)\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      2,(int)chunk[0].pdims[2].dim_length, 
+                      2,(int)chunk[0].pdims[2].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 6, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* write only 112 bytes out */
+    ret = Hwrite(aid1, 112, outbuf);
+    VERIFY_VOID(ret, 112, "Hwrite");
+    if (ret != 112)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote 112of192 bytes to 3-D, uint8 chunked element \n"); );
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 3-D, uint8 chunked element again for reading\n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 6);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 6 || length != 192)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Get/Check special info data\n"); );
+
+    /* get special info about element */
+    ret = HDget_special_info(aid1, &info_block);
+    CHECK_VOID(aid1, FAIL, "HDget_special_info");
+
+    /* check special info */
+    if (info_block.ndims != chunk[0].num_dims /* 2-D */)
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+    /* check chunk_lengths */
+    if (info_block.cdims != NULL)
+      {
+          if ((info_block.cdims[0] != 2) 
+              || (info_block.cdims[1] != 3)
+              || (info_block.cdims[2] != 4))
+            {
+                fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+                errors++;
+                goto done;
+            }
+
+          /* free allocated space by routine */
+          HDfree(info_block.cdims);
+      }
+    else
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 112, inbuf);
+    VERIFY_VOID(ret, 112, "Hread");
+    if (ret != 112)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying first 112 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+    /* 
+       5. Now create another 3-D chunked element with partial chunks.
+       Write to part of element, rest is filled with fill value.
+       Set dimension to 4x6x8 array with 8 chunks , real data 192 bytes
+       where each chunk is 3x4x5= 60 bytes , 
+       data size with chunks is 60 bytes x 8 chunks = 480 bytes 
+       */
+    chunk[0].num_dims   = 3;
+    chunk[0].chunk_size = 60; /* 3x4x5 = 60 bytes */
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+
+    chunk[0].pdims[0].dim_length   = 4;
+    chunk[0].pdims[0].chunk_length = 3;  
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 6;
+    chunk[0].pdims[1].chunk_length = 4;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    chunk[0].pdims[2].dim_length   = 8;
+    chunk[0].pdims[2].chunk_length = 5;
+    chunk[0].pdims[2].distrib_type = 1;
+
+    /* set fill value to 1 */
+    fill_val_u8 = 1;
+    fill_val_len = 1;
+
+    /* Open file for writing last odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(5, printf("Test 5. Create another new element as a 3-D, uint8 chunked element(192bytes)\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      2,(int)chunk[0].pdims[2].dim_length, 
+                      2,(int)chunk[0].pdims[2].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 7, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* Set max chunks to cache to 3x4 = 12 chunks */
+    MESSAGE(5, printf("Set max # of chunks to cache for chunked element to 12 \n"); );
+    ret = HMCsetMaxcache(aid1, 12, 0);
+    VERIFY_VOID(ret, 12, "HMCsetMaxcache");
+    
+    /* write 112 bytes out */
+    ret = Hwrite(aid1, 112, outbuf);
+    VERIFY_VOID(ret, 112, "Hwrite");
+    if (ret != 112)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote 112of192 bytes to 3-D, uint8 chunked element \n"); );
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 3-D, uint8 chunked element again for reading\n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 7);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 7 || length != 192)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 112, inbuf);
+    VERIFY_VOID(ret, 112, "Hread");
+    if (ret != 112)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying data\n"););
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+    if (errors)
+        goto done;
+
+    /* read back 20 bytes now, they should be filled with fill values */
+    MESSAGE(5, printf("reading some more data\n"););
+    ret = Hread(aid1, 20, inbuf);
+    VERIFY_VOID(ret, 20, "Hread");
+    if (ret != 20)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying data, should be full of fill values\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != fill_val_u8)
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, fill_val_u8, inbuf[i]);
+                errors++;
+            }
+      }
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+    /* 
+       6. Now create 3-D chunked element with no partial chunks.
+       Write using HMCwriteChunk(). Read data back in first
+       using Hread() and verify. Then read data back in using
+       HMCreadChunk() and verify.
+       Set dimension to 2x3x4 array with 6 chunks 
+       where each chunk is 1x1x4= 4 bytes , total data size 24 bytes 
+       */
+    chunk[0].num_dims   = 3;
+    chunk[0].chunk_size = 4; /* 1x1x4 bytes */
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+#if 0
+    chunk[0].chunk_flag = SPECIAL_COMP; /* compression */
+    chunk[0].comp_type  = COMP_CODE_RLE; /* RLE */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* STDIO */
+    chunk[0].cinfo = &cinfo; /* nothing set */
+    chunk[0].minfo = &minfo; /* nothing set */
+#endif
+
+    chunk[0].pdims[0].dim_length   = 2;
+    chunk[0].pdims[0].chunk_length = 1;  
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 3;
+    chunk[0].pdims[1].chunk_length = 1;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    chunk[0].pdims[2].dim_length   = 4;
+    chunk[0].pdims[2].chunk_length = 4;
+    chunk[0].pdims[2].distrib_type = 0; /* NONE */
+
+    /* set fill value to 1 */
+    fill_val_u8 = 1;
+    fill_val_len = 1;
+
+    /* Open file for writing last odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    MESSAGE(5, printf("Test 6. Create another new element as a 3-D, uint8 chunked element(192 bytes)\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      2,(int)chunk[0].pdims[2].dim_length, 
+                      2,(int)chunk[0].pdims[2].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 12, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid2 = HMCcreate(fid, 1020, 18, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* write 24 bytes out */
+    ret = Hwrite(aid2, 24, u8_data);
+    if (ret != 24)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* write data out as chunks */
+    MESSAGE(5, printf("Writing to 3-D, uint8 chunked element using HMCwriteChunk\n"); );
+
+    /* Write data use SDwriteChunk */
+    dims[0] = 0;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk1);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk4);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk2);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk5);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk3);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk6);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* end access */
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 3-D, uint8 chunked element again for reading\n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 12);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* start read access   tag,  ref */
+    aid2 = Hstartread(fid, 1020, 18);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 12 || length != 24)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Get/Check special info data\n"); );
+
+    /* get special info about element */
+    ret = HDget_special_info(aid1, &info_block);
+    CHECK_VOID(aid1, FAIL, "HDget_special_info");
+
+    /* check special info */
+    if (info_block.ndims != chunk[0].num_dims /* 2-D */)
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+    /* check chunk_lengths */
+    if (info_block.cdims != NULL)
+      {
+          if ((info_block.cdims[0] != 1) 
+              || (info_block.cdims[1] != 1)
+              || (info_block.cdims[2] != 4))
+            {
+                fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+                errors++;
+                goto done;
+            }
+
+          /* free allocated space by routine */
+          HDfree(info_block.cdims);
+      }
+    else
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 24, inbuf_u8);
+    VERIFY_VOID(ret, 24, "Hread");
+    if (ret != 24)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 24 bytes data from Hread\n"); );
+    for (i = 0; i < 2; i++)
+      {
+        for (j = 0; j < 3; j++)
+          {
+            for (k = 0; k < 4; k++)
+              {
+                  if (inbuf_u8[i][j][k] != u8_data[i][j][k])
+                    {
+                        printf("Wrong data at inbuf_u8[%d][%d][%d], out %d in %d\n", 
+                               i,j,k, u8_data[i][j][k], inbuf_u8[i][j][k]);
+                        errors++;
+                    }
+              }
+          }
+      }
+
+    if (errors)
+        goto done;
+
+    MESSAGE(5, printf("Verifying 24 bytes using HMCreadChunk\n"); );
+    /* read data back as chunks */
+    dims[0] = 0;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk1 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk1[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk1[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 0;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk2 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk2[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk2[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 0;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk3 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk3[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk3[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 1;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk4 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk4[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk4[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 1;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk5 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk5[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk5[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 1;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk6 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk6[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk6[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* end access and close file */
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+    /* The following tests will work if Number type conversion
+       is done on the ouput data, punt for now since 'hdftest'
+       tests these same tests with number type conversion  */
+
+    /* 
+       7. Now create 3-D chunked element with no partial chunks.
+       Set dimension to 2x3x4 array with 6 chunks. Number type is uint16 
+       where each chunk is 1x1x4= 4x2(nt_size) = 8 bytes , 
+       total data size 48 bytes 
+       */
+    chunk[0].num_dims   = 3;
+    chunk[0].chunk_size = 4; /* 1x1x4 bytes, logical  */
+    chunk[0].nt_size    = 2; /* number type size, uint16 */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+#if 0
+    chunk[0].chunk_flag = SPECIAL_COMP; /* compression */
+    chunk[0].comp_type  = COMP_CODE_RLE; /* RLE */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* STDIO */
+    chunk[0].cinfo = &cinfo; /* nothing set */
+    chunk[0].minfo = &minfo; /* nothing set */
+#endif
+
+    chunk[0].pdims[0].dim_length   = 2;
+    chunk[0].pdims[0].chunk_length = 1;  
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 3;
+    chunk[0].pdims[1].chunk_length = 1;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    chunk[0].pdims[2].dim_length   = 4;
+    chunk[0].pdims[2].chunk_length = 4;
+    chunk[0].pdims[2].distrib_type = 0; /* NONE */
+
+    fill_val_len = 2;
+    fill_val_u16 = 0;
+
+    /* Open file for writing last odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    MESSAGE(5, printf("Test 7. Create another new element as a 3-D, uint16 chunked element(48 bytes)\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      2,(int)chunk[0].pdims[2].dim_length, 
+                      2,(int)chunk[0].pdims[2].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 14, 1, fill_val_len, &fill_val_u16, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* write 48 bytes out */
+    ret = Hwrite(aid1, 48, u16_data);
+    VERIFY_VOID(ret, 48, "Hwrite");
+    if (ret != 48)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote 48 bytes to 3-D, uint16 chunked element \n"); );
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 3-D, uint16 chunked element again for reading\n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 14);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 48, inbuf_u16);
+    VERIFY_VOID(ret, 48, "Hread");
+    if (ret != 48)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 48 bytes data\n"); );
+    for (i = 0; i < 2; i++)
+      {
+        for (j = 0; j < 3; j++)
+          {
+            for (k = 0; k < 4; k++)
+              {
+                  if (inbuf_u16[i][j][k] != u16_data[i][j][k])
+                    {
+                        printf("Wrong data at inbuf_u16[%d][%d][%d], out %d in %d\n", 
+                               i,j,k, u16_data[i][j][k], inbuf_u16[i][j][k]);
+                        errors++;
+                    }
+              }
+          }
+      }
+
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+    /* 
+       8. Now create 3-D chunked element with no partial chunks.
+       Set dimension to 2x3x4 array with 6 chunks. Numbertype is float32 
+       where each chunk is 1x1x4= 4x4(nt_size) = 16 bytes , 
+       total data size 96 bytes 
+       */
+    chunk[0].num_dims   = 3;
+    chunk[0].chunk_size = 4; /* 1x1x4 bytes, logical */
+    chunk[0].nt_size    = 4; /* number type size, float32 */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+#if 0
+    chunk[0].chunk_flag = SPECIAL_COMP; /* compression */
+    chunk[0].comp_type  = COMP_CODE_RLE; /* RLE */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* STDIO */
+    chunk[0].cinfo = &cinfo; /* nothing set */
+    chunk[0].minfo = &minfo; /* nothing set */
+#endif
+
+    chunk[0].pdims[0].dim_length   = 2;
+    chunk[0].pdims[0].chunk_length = 1;  
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 3;
+    chunk[0].pdims[1].chunk_length = 1;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    chunk[0].pdims[2].dim_length   = 4;
+    chunk[0].pdims[2].chunk_length = 4;
+    chunk[0].pdims[2].distrib_type = 0; /* NONE */
+
+    fill_val_len = 4;
+    fill_val_f32 = (float32)0.0;
+
+    /* Open file for writing last odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(5, printf("Test 8. Create another new element as a 3-D, float32 chunked element(96 bytes)\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      2,(int)chunk[0].pdims[2].dim_length, 
+                      2,(int)chunk[0].pdims[2].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 15, 1, fill_val_len, &fill_val_f32, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    if (aid1 == FAIL)
+      {
+        HEprint(stderr,0);
+        errors++;
+        goto done;
+      }
+
+    /* write 96 bytes out */
+    ret = Hwrite(aid1, 96, f32_data);
+    VERIFY_VOID(ret, 96, "Hwrite");
+    if (ret != 96)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote 96 bytes to 3-D, float32 chunked element \n"); );
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 3-D, float32 chunked element again for reading\n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 15);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 96, inbuf_f32);
+    VERIFY_VOID(ret, 96, "Hread");
+    if (ret != 96)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 96 bytes data\n"); );
+    for (i = 0; i < 2; i++)
+      {
+        for (j = 0; j < 3; j++)
+          {
+            for (k = 0; k < 4; k++)
+              {
+                  if (inbuf_f32[i][j][k] != f32_data[i][j][k])
+                    {
+                        printf("Wrong data at inbuf_f32[%d][%d][%d], out %f in %f\n", 
+                               i,j,k, f32_data[i][j][k], inbuf_f32[i][j][k]);
+                        errors++;
+                    }
+              }
+          }
+      }
+
+    if (errors)
+        goto done;
+
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* 
+       9. Create 4-D element with partial chunks.
+       Write only half the data out(5,000 bytes)
+       Set dimension to 10x10x10x10 array  real data 10,000 bytes .
+       120 chunks whit chunks of 2x3x4x5 = 120 bytes,
+       data size with chunks is 120 bytes x 120 chunks = 14,400 bytes 
+       */
+    chunk[0].num_dims   = 4;
+    chunk[0].chunk_size = 120;
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+#if 0
+    chunk[0].chunk_flag = SPECIAL_COMP; /* compression */
+    chunk[0].comp_type  = COMP_CODE_RLE; /* RLE */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* STDIO */
+    chunk[0].cinfo = &cinfo; /* nothing set */
+    chunk[0].minfo = &minfo; /* nothing set */
+#endif
+
+    chunk[0].pdims[0].dim_length   = 10;
+    chunk[0].pdims[0].chunk_length = 2;
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 10;
+    chunk[0].pdims[1].chunk_length = 3;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    chunk[0].pdims[2].dim_length   = 10;
+    chunk[0].pdims[2].chunk_length = 4;
+    chunk[0].pdims[2].distrib_type = 1;
+
+    chunk[0].pdims[3].dim_length   = 10;
+    chunk[0].pdims[3].chunk_length = 5;
+    chunk[0].pdims[3].distrib_type = 1;
+
+    /* set fill value to 1 */
+    fill_val_u8 = 1;
+    fill_val_len = 1;
+
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(5, printf("Test 9. Create another new element as a 4-D, uint8 chunked element\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      2,(int)chunk[0].pdims[2].dim_length, 
+                      2,(int)chunk[0].pdims[2].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      3,(int)chunk[0].pdims[3].dim_length, 
+                      3,(int)chunk[0].pdims[3].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 9, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* write 5000 bytes out */
+    ret = Hwrite(aid1, 5000, outbuf);
+    VERIFY_VOID(ret, 5000, "Hwrite");
+    if (ret != 5000)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote 5000of10000 bytes to 4-D chunked element \n"); );
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(5, printf("Open 4-D chunked element again for reading\n"); );
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 9);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 9 || length != 10000)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 5000 bytes of data\n"); );
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 5000, inbuf);
+    VERIFY_VOID(ret, 5000, "Hread");
+    if (ret != 5000)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+      }
+    if (errors)
+        goto done;
+
+    /* verify some more data */
+    MESSAGE(5, printf("seek to 7000 bytes in element and read 1000 bytes \n"); );
+
+    /* seek past initial write  buffer  */
+    ret = Hseek(aid1, 7000, 0);
+    VERIFY_VOID(ret, 0, "Hseek");
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 1000, inbuf);
+    VERIFY_VOID(ret, 1000, "Hread");
+    if (ret != 1000)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data, should be fill values */
+    MESSAGE(5, printf("Verifying 1000 bytes of data, should be fill values\n"); );
+
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != fill_val_u8)
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, fill_val_u8, inbuf[i]);
+                errors++;
+            }
+      }
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+#ifdef BIG_TEST
+
+    /* 
+       10. The rest of the tests here are commented out
+       They are some extra high order tests to replicate
+       some test done on EOS-DEM data  -GV.....
+       Set dimension to 12000x12000 array with 2,500 chunks 
+       whith chunk of 240x240 = 57,600 bytes
+       */
+    chunk[0].num_dims   = 2;
+    chunk[0].chunk_size = 57600;
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = 0; /* nothing set */
+    chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+    chunk[0].model_type = COMP_MODEL_STDIO; /* nothing set */
+    chunk[0].cinfo = NULL; /* nothing set */
+    chunk[0].minfo = NULL; /* nothing set */
+
+    chunk[0].pdims[0].dim_length   = 12000;
+    chunk[0].pdims[0].chunk_length = 240;
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 12000;
+    chunk[0].pdims[1].chunk_length = 240;
+    chunk[0].pdims[1].distrib_type = 1;
+
+#if 0
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+#endif
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 10, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    for (j = 0; j < 12000; j++)
+      {
+          printf("%d,",j);
+          /* write 12000 bytes out */
+          ret = Hwrite(aid1, 12000, outbuf);
+          if (ret != 12000)
+            {
+                fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+                errors++;
+            }
+      }
+    printf("\n");
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 10);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying data\n");
+            );
+
+    for (j = 0; j < 12000; j++)
+      {
+
+          if ((j % 1000) == 0)
+            {
+                printf("read %d,",j);
+                /* read back in buffer  */
+                ret = Hread(aid1, 12000, inbuf);
+
+                if (ret != 12000)
+                  {
+                      fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+                      errors++;
+                  }
+
+                for (i = 0; i < ret; i++)
+                  {
+                      if (inbuf[i] != outbuf[i])
+                        {
+                            printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                            errors++;
+                        }
+                  }
+            }
+          else
+            {
+                /* seek to next buffer  */
+                ret = Hseek(aid1, 12000, 1);
+                VERIFY_VOID(ret, 0, "Hseek");
+            }
+      }
+
+    /* Mimic read pattern of EOS-DEM test  behaviour */
+    x = 1000;
+    y = 1000;
+    nseek = (12000 * y) + x;
+    printf("seek to initial byte postion = %d \n",nseek);
+    /* seek to next buffer  */
+    ret = Hseek(aid1, nseek, 0);
+    VERIFY_VOID(ret, 0, "Hseek");
+
+    for (j = 0; j < 11; j++)
+      {
+          printf("read 2000x2000 square at x=%d,y=%d\n",x,y);
+
+          for (k = 0; k < 2000; k++)
+            {
+                /* read back in buffer  */
+                ret = Hread(aid1, 2000, inbuf);
+
+                if (ret != 2000)
+                  {
+                      fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+                      errors++;
+                  }
+
+                /* seek to next buffer  */
+                ret = Hseek(aid1, 10000, 1);
+                VERIFY_VOID(ret, 0, "Hseek");
+            }
+
+          x = x + 100;
+          y = y + 1000;
+          nseek = (12000 * y) + x;
+          printf("seek to next byte postion = %d\n",nseek);
+          /* seek to next buffer  */
+          ret = Hseek(aid1, nseek, 0);
+          VERIFY_VOID(ret, 0, "Hseek");
+      }
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n");
+            );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+#endif /* BIG_TEST */
+
+    /* 
+     Chunking with Compression testing..... 
+     */
+
+    /* 
+       11. Create a new element but now there will be partial chunks and Compression.
+       Set dimension to 4x4 array with 4 chunks where each chunk is 3x2 = 6 bytes.
+       Real data size is 16 bytes, size with chunks is 
+       6 bytes x 4 chunks = 24 bytes .
+
+       The element will be compressed with RLE scheme.
+
+       */
+    chunk[0].num_dims   = 2;
+    chunk[0].chunk_size = 6; /* 3x2 = 6 bytes */
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = SPECIAL_COMP; /* compression */
+#if 0
+    chunk[0].comp_type = COMP_CODE_SKPHUFF; /* Skipping Huffman */
+    cinfo.skphuff.skp_size = sizeof(uint8);
+
+    chunk[0].comp_type = COMP_CODE_DEFLATE; /* GZIP */
+    cinfo.deflate.level = 6;
+
+#endif
+    chunk[0].comp_type  = COMP_CODE_RLE; /* RLE */
+
+    chunk[0].model_type = COMP_MODEL_STDIO; /* STDIO */
+    chunk[0].cinfo = &cinfo; /* nothing set */
+    chunk[0].minfo = &minfo; /* nothing set */
+
+    chunk[0].pdims[0].dim_length   = 4;
+    chunk[0].pdims[0].chunk_length = 3;  /* made this 3 */
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 4;
+    chunk[0].pdims[1].chunk_length = 2;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    /* Open file for writing odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    MESSAGE(5, printf("Test 11. Create another new element as a 2-D, uint8 chunked, RLE Compressed element\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 20, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* write 16 bytes out */
+    ret = Hwrite(aid1, 16, outbuf);
+    VERIFY_VOID(ret, 16, "Hwrite");
+    if (ret != 16)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Wrote to 4of4 chunks (16 bytes) in file\n"););
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 2-D, uint8 chunked, RLE Compressed element again for reading\n"); );
+
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 20);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 20 || length != 16)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 16, inbuf);
+    VERIFY_VOID(ret, 16, "Hread");
+    if (ret != 16)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 16 bytes of data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+    if (errors)
+        goto done;
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"); );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* 
+       12. Now create 3-D chunked, Compressed element with no partial chunks.
+       Write using HMCwriteChunk(). Read data back in first
+       using Hread() and verify. Then read data back in using
+       HMCreadChunk() and verify.
+       Set dimension to 2x3x4 array with 6 chunks 
+       where each chunk is 1x1x4= 4 bytes , total data size 24 bytes 
+       
+       The element is compressed using RLE scheme.
+       */
+    chunk[0].num_dims   = 3;
+    chunk[0].chunk_size = 4; /* 1x1x4 bytes */
+    chunk[0].nt_size    = 1; /* number type size */
+    chunk[0].chunk_flag = SPECIAL_COMP; /* compression */
+#if 0
+
+    chunk[0].comp_type  = COMP_CODE_RLE; /* RLE */
+
+    chunk[0].comp_type = COMP_CODE_SKPHUFF; /* Skipping Huffman */
+    cinfo.skphuff.skp_size = sizeof(uint8);
+#endif
+    chunk[0].comp_type = COMP_CODE_DEFLATE; /* GZIP */
+    cinfo.deflate.level = 6;
+
+    chunk[0].model_type = COMP_MODEL_STDIO; /* STDIO */
+    chunk[0].cinfo = &cinfo; /* nothing set */
+    chunk[0].minfo = &minfo; /* nothing set */
+
+    chunk[0].pdims[0].dim_length   = 2;
+    chunk[0].pdims[0].chunk_length = 1;  
+    chunk[0].pdims[0].distrib_type = 1;
+
+    chunk[0].pdims[1].dim_length   = 3;
+    chunk[0].pdims[1].chunk_length = 1;
+    chunk[0].pdims[1].distrib_type = 1;
+
+    chunk[0].pdims[2].dim_length   = 4;
+    chunk[0].pdims[2].chunk_length = 4;
+    chunk[0].pdims[2].distrib_type = 0; /* NONE */
+
+    /* set fill value to 1 */
+    fill_val_u8 = 1;
+    fill_val_len = 1;
+
+    /* Open file for writing last odd size chunks now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    MESSAGE(5, printf("Test 12. Create another new element as a 3-D, uint8 chunked, GZIP Compressed element(192 bytes)\n"););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      0,(int)chunk[0].pdims[0].dim_length, 
+                      0,(int)chunk[0].pdims[0].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      1,(int)chunk[0].pdims[1].dim_length, 
+                      1,(int)chunk[0].pdims[1].chunk_length););
+    MESSAGE(5, printf(" dim_length[%d]=%d, chunk_length[%d]=%d \n",
+                      2,(int)chunk[0].pdims[2].dim_length, 
+                      2,(int)chunk[0].pdims[2].chunk_length););
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid1 = HMCcreate(fid, 1020, 21, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* Create element     tag, ref,  nlevels, fill_len, fill, chunk array */
+    aid2 = HMCcreate(fid, 1020, 22, 1, fill_val_len, &fill_val_u8, (HCHUNK_DEF *)chunk);
+    CHECK_VOID(aid1, FAIL, "HMCcreate");
+
+    /* write 24 bytes out */
+    ret = Hwrite(aid2, 24, u8_data);
+    if (ret != 24)
+      {
+          fprintf(stderr, "ERROR: Hwrite returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* write data out as chunks */
+    MESSAGE(5, printf("Writing to 3-D, uint8 chunked, GZIP Compressed element using HMCwriteChunk\n"); );
+
+    /* Write data use SDwriteChunk */
+    dims[0] = 0;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk1);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk4);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk2);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk5);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 0;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk3);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    dims[0] = 1;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCwriteChunk(aid1, dims, chunk6);
+    CHECK_VOID(ret, FAIL, "HMCwriteChunk");
+
+    /* end access */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* end access */
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the files\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Open 3-D, uint8 chunked, GZIP Compressed element again for reading\n"); );
+    /* Open file for reading now */
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* start read access   tag,  ref */
+    aid1 = Hstartread(fid, 1020, 21);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* start read access   tag,  ref */
+    aid2 = Hstartread(fid, 1020, 22);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    /* inquire about element */
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+
+    CHECK_VOID(ret, FAIL, "Hinquire");
+    if (!special)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not think element is special line %d\n",
+                  __LINE__);
+          errors++;
+          goto done;
+      }
+
+    /* Check values from Hinquire */
+    if ( ref != 21 || length != 24)
+      {
+          fprintf(stderr, "ERROR: Hinquire does not return the correct values \n");
+          fprintf(stderr, "       tag =%d, ref=%d, length=%d \n",tag,ref,(int)length);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Get/Check special info data\n"); );
+
+    /* get special info about element */
+    ret = HDget_special_info(aid1, &info_block);
+    CHECK_VOID(aid1, FAIL, "HDget_special_info");
+
+    /* check special info */
+    if (info_block.ndims != chunk[0].num_dims /* 2-D */)
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+    /* check chunk_lengths */
+    if (info_block.cdims != NULL)
+      {
+          if ((info_block.cdims[0] != 1) 
+              || (info_block.cdims[1] != 1)
+              || (info_block.cdims[2] != 4))
+            {
+                fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+                errors++;
+                goto done;
+            }
+
+          /* free allocated space by routine */
+          HDfree(info_block.cdims);
+      }
+    else
+      {
+          fprintf(stderr, "ERROR: HDget_specail_info does not return the correct values \n");
+          errors++;
+          goto done;
+      }
+
+
+    /* read back in buffer  */
+    ret = Hread(aid1, 24, inbuf_u8);
+    VERIFY_VOID(ret, 24, "Hread");
+    if (ret != 24)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    /* verify the data */
+    MESSAGE(5, printf("Verifying 24 bytes data from Hread\n"); );
+    for (i = 0; i < 2; i++)
+      {
+        for (j = 0; j < 3; j++)
+          {
+            for (k = 0; k < 4; k++)
+              {
+                  if (inbuf_u8[i][j][k] != u8_data[i][j][k])
+                    {
+                        printf("Wrong data at inbuf_u8[%d][%d][%d], out %d in %d\n", 
+                               i,j,k, u8_data[i][j][k], inbuf_u8[i][j][k]);
+                        errors++;
+                    }
+              }
+          }
+      }
+
+    if (errors)
+        goto done;
+
+    MESSAGE(5, printf("Verifying 24 bytes from uint8 chunked, GZIP Compressed element using HMCreadChunk\n"); );
+    /* read data back as chunks */
+    dims[0] = 0;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk1 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk1[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk1[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 0;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk2 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk2[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk2[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 0;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk3 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk3[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk3[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 1;
+    dims[1] = 0;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk4 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk4[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk4[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 1;
+    dims[1] = 1;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk5 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk5[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk5[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    dims[0] = 1;
+    dims[1] = 2;
+    dims[2] = 0;
+    ret = HMCreadChunk(aid2, dims, inbuf);
+    CHECK_VOID(ret, FAIL, "HMCreadChunk");
+    if (ret != 4)
+      {
+          fprintf(stderr, "ERROR: HMCreadChunk returned the wrong length: %d\n", (int) ret);
+          errors++;
+          goto done;
+      }
+
+    MESSAGE(5, printf("Verifying chunk6 4 bytes data\n"); );
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != chunk6[i])
+            {
+                printf("Wrong data at %d, out %d in %d\n", i, chunk6[i], inbuf[i]);
+                errors++;
+            }
+      }
+
+    /* end access and close file */
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* end access and close file */
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Closing the file\n"););
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+
+  done:
+    /* Don't forget to free dimensions allocate for chunk definition */
+    if (chunk[0].pdims != NULL)
+        HDfree(chunk[0].pdims);
+
+    num_errs += errors;     /* increment global error count */
+} /* test_chunks() */
diff --git a/hdf/test/comp.c b/hdf/test/comp.c
new file mode 100644
index 0000000..6bb6a6a
--- /dev/null
+++ b/hdf/test/comp.c
@@ -0,0 +1,486 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+   FILE - comp.c
+       Test HDF compressed data I/O routines
+
+   DESIGN
+       These are written to test all combinations of modeling and
+       encoding layers with different number types.
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES
+
+   AUTHOR
+       Quincey Koziol
+
+   MODIFICATION HISTORY
+       10/19/93 - Through this header in.
+ */
+
+/* $Id: comp.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+#include <time.h>
+#include "tproto.h"
+#include "hfile.h"
+
+#define TESTFILE_NAME "tcomp.hdf"
+
+#define BUFSIZE 4096
+
+/* last ditch attempt to define this value... */
+#ifndef UINT_MAX
+#define UINT_MAX (unsigned)(-1)
+#endif /* UINT_MAX */
+
+/* make a guess about RAND_MAX if it isn't defined... */
+#ifndef RAND_MAX
+#define RAND_MAX (UINT_MAX)
+#endif /* RAND_MAX */
+
+/* define aliases for random number generation */
+#define RAND rand
+#define SEED(a) srand((unsigned)(a))
+
+#define COMP_TAG 1000
+
+/* different modeling layers to test */
+comp_model_t test_models[] =
+{COMP_MODEL_STDIO};
+
+/* different compression layers to test */
+comp_coder_t test_coders[] =
+{
+    COMP_CODE_NONE
+    ,COMP_CODE_RLE
+    /*,COMP_CODE_NBIT *//* n-bit testing is done in it's own module, nbit.c */
+    ,COMP_CODE_SKPHUFF
+    ,COMP_CODE_DEFLATE
+};
+
+int32       test_ntypes[] =
+{
+    DFNT_INT8, DFNT_UINT8, DFNT_INT16, DFNT_UINT16, DFNT_INT32, DFNT_UINT32
+    };
+
+#define NUM_OUTBUFS 4   /* the number of different output buffers to test */
+/* outbuf #1 is all zeros (very easy to compress) */
+/* outbuf #2 is a fibonacci sequence (very hard to compress) */
+/* outbuf #3 is random data (also hard to compress) */
+/* outbuf #4 is random in the low byte and mostly static in the upper byte(s) */
+static int8  *outbuf_int8[NUM_OUTBUFS];
+static uint8  *outbuf_uint8[NUM_OUTBUFS];
+static int16  *outbuf_int16[NUM_OUTBUFS];
+static uint16  *outbuf_uint16[NUM_OUTBUFS];
+static int32  *outbuf_int32[NUM_OUTBUFS];
+static uint32  *outbuf_uint32[NUM_OUTBUFS];
+
+/* only need one input buffer per type of data */
+static int8  *inbuf_int8;
+static uint8  *inbuf_uint8;
+static int16  *inbuf_int16;
+static uint16  *inbuf_uint16;
+static int32  *inbuf_int32;
+static uint32  *inbuf_uint32;
+
+/* local function prototypes */
+static void init_model_info(comp_model_t m_type, model_info * m_info,
+                            int32 test_ntype);
+static void init_coder_info(comp_coder_t c_type, comp_info * c_info,
+                            int32 test_ntype);
+static void allocate_buffers(void);
+static void init_buffers(void);
+static void free_buffers(void);
+static uint16 write_data(int32 fid, comp_model_t m_type, model_info * m_info,
+                     comp_coder_t c_type, comp_info * c_info, intn test_num,
+                         int32 ntype);
+static void read_data(int32 fid, uint16 ref_num, intn test_num, int32 ntype);
+
+static void
+init_model_info(comp_model_t m_type, model_info * m_info, int32 test_ntype)
+{
+    /* shut the compiler up */
+    m_type = m_type;
+    m_info = m_info;
+    test_ntype = test_ntype;
+
+    switch (m_type)
+      {
+          case COMP_MODEL_STDIO:
+          default:
+              /* don't do anything for this case */
+              break;
+      }     /* end switch */
+}   /* end init_model_info() */
+
+static void
+init_coder_info(comp_coder_t c_type, comp_info * c_info, int32 test_ntype)
+{
+    switch (c_type)
+      {
+          case COMP_CODE_SKPHUFF:
+              c_info->skphuff.skp_size = DFKNTsize(test_ntype);
+              break;
+
+          case COMP_CODE_RLE:
+          case COMP_CODE_NONE:
+          default:
+              /* don't do anything for this case */
+              break;
+      }     /* end switch */
+}   /* end init_coder_info() */
+
+static void
+allocate_buffers(void)
+{
+    intn        i;
+
+    for (i = 0; i < NUM_OUTBUFS; i++)
+      {
+          outbuf_int8[i] = (int8 *) HDmalloc(BUFSIZE * sizeof(int8));
+          outbuf_uint8[i] = (uint8 *) HDmalloc(BUFSIZE * sizeof(uint8));
+          outbuf_int16[i] = (int16 *) HDmalloc(BUFSIZE * sizeof(int16));
+          outbuf_uint16[i] = (uint16 *) HDmalloc(BUFSIZE * sizeof(uint16));
+          outbuf_int32[i] = (int32 *) HDmalloc(BUFSIZE * sizeof(int32));
+          outbuf_uint32[i] = (uint32 *) HDmalloc(BUFSIZE * sizeof(uint32));
+      }     /* end for */
+    inbuf_int8 = (int8 *) HDcalloc(BUFSIZE, sizeof(int8));
+    inbuf_uint8 = (uint8 *) HDcalloc(BUFSIZE, sizeof(uint8));
+    inbuf_int16 = (int16 *) HDcalloc(BUFSIZE, sizeof(int16));
+    inbuf_uint16 = (uint16 *) HDcalloc(BUFSIZE, sizeof(uint16));
+    inbuf_int32 = (int32 *) HDcalloc(BUFSIZE, sizeof(int32));
+    inbuf_uint32 = (uint32 *) HDcalloc(BUFSIZE, sizeof(uint32));
+}   /* allocate_buffers() */
+
+static void
+init_buffers(void)
+{
+    intn        i, j;
+
+    for (i = 0; i < NUM_OUTBUFS; i++)
+      {
+          switch (i)
+            {
+                case 0: /* all zero filled */
+                    HDmemset(outbuf_int8[i], 0, BUFSIZE * sizeof(int8));
+                    HDmemset(outbuf_uint8[i], 0, BUFSIZE * sizeof(uint8));
+                    HDmemset(outbuf_int16[i], 0, BUFSIZE * sizeof(int16));
+                    HDmemset(outbuf_uint16[i], 0, BUFSIZE * sizeof(uint16));
+                    HDmemset(outbuf_int32[i], 0, BUFSIZE * sizeof(int32));
+                    HDmemset(outbuf_uint32[i], 0, BUFSIZE * sizeof(uint32));
+                    break;
+
+                case 1: /* fibonacci sequence */
+                    {
+                        uint32      last_fib, curr_fib, next_fib;
+
+                        for (j = 0, last_fib = 0, curr_fib = 1; j < BUFSIZE; j++)
+                          {
+                              outbuf_int8[i][j] = (int8) curr_fib;
+                              outbuf_uint8[i][j] = (uint8) curr_fib;
+                              outbuf_int16[i][j] = (int16) curr_fib;
+                              outbuf_uint16[i][j] = (uint16) curr_fib;
+                              outbuf_int32[i][j] = (int32) curr_fib;
+                              outbuf_uint32[i][j] = (uint32) curr_fib;
+                              next_fib = curr_fib + last_fib;
+                              last_fib = curr_fib;
+                              curr_fib = next_fib;
+                          }     /* end for */
+                    }   /* end case */
+                    break;
+
+                case 2: /* random #'s */
+                    {
+                        intn        r;
+
+                        SEED(time(NULL));
+                        for (j = 0; j < BUFSIZE; j++)
+                          {
+                              r = RAND();
+                              outbuf_int8[i][j] = (int8) (r - RAND_MAX / 2);
+                              outbuf_uint8[i][j] = (uint8) r;
+                              outbuf_int16[i][j] = (int16) (r - RAND_MAX / 2);
+                              outbuf_uint16[i][j] = (uint16) r;
+                              outbuf_int32[i][j] = (int32) (r - RAND_MAX / 2);
+                              outbuf_uint32[i][j] = (uint32) r;
+                          }     /* end for */
+                    }   /* end case */
+                    break;
+
+                case 3: /* random in the low byte and static in the upper */
+                    {
+                        uint32      r;
+
+                        SEED(time(NULL));
+                        for (j = 0; j < BUFSIZE; j++)
+                          {
+                              r = (uint32) RAND();
+                              r &= (uint32) 0xff;   /* make the lower byte random */
+                              r |= (uint32) (((j / 4) % 4) << 8);   /* make the upper bytes change slowly */
+                              outbuf_int8[i][j] = (int8) r;
+                              outbuf_uint8[i][j] = (uint8) r;
+                              outbuf_int16[i][j] = (int16) r;
+                              outbuf_uint16[i][j] = (uint16) r;
+                              outbuf_int32[i][j] = (int32) r;
+                              outbuf_uint32[i][j] = (uint32) r;
+                          }     /* end for */
+                    }   /* end case */
+                    break;
+            }   /* end switch */
+      }     /* end for */
+}   /* init_buffers() */
+
+static void
+free_buffers(void)
+{
+    intn        i;
+
+    for (i = 0; i < NUM_OUTBUFS; i++)
+      {
+          HDfree(outbuf_int8[i]);
+          HDfree(outbuf_uint8[i]);
+          HDfree(outbuf_int16[i]);
+          HDfree(outbuf_uint16[i]);
+          HDfree(outbuf_int32[i]);
+          HDfree(outbuf_uint32[i]);
+      }     /* end for */
+    HDfree(inbuf_int8);
+    HDfree(inbuf_uint8);
+    HDfree(inbuf_int16);
+    HDfree(inbuf_uint16);
+    HDfree(inbuf_int32);
+    HDfree(inbuf_uint32);
+}   /* free_buffers() */
+
+static uint16
+write_data(int32 fid, comp_model_t m_type, model_info * m_info,
+        comp_coder_t c_type, comp_info * c_info, intn test_num, int32 ntype)
+{
+    int32       aid;
+    uint16      ret_ref;
+    int32       err_ret;
+    int32       write_size;
+    VOIDP       data_ptr;
+
+    MESSAGE(8,
+            {
+            char *s = HDgetNTdesc(ntype);
+            printf("Writing data for test %d, ntype=%s, model_type=%d, coder_type=%d\n", (int) test_num, (s == NULL ? "Unknown" : s), (int) m_type, (int) c_type);
+            HDfree(s);
+            }
+    )
+        ret_ref = Hnewref(fid);
+    aid = HCcreate(fid, COMP_TAG, ret_ref, m_type, m_info, c_type, c_info);
+    CHECK(aid, FAIL, "HCcreate");
+    if (aid == FAIL)
+        return (0);
+
+    switch (ntype)
+      {
+          case DFNT_INT8:
+              data_ptr = (VOIDP) outbuf_int8[test_num];
+              break;
+          case DFNT_UINT8:
+              data_ptr = (VOIDP) outbuf_uint8[test_num];
+              break;
+          case DFNT_INT16:
+              data_ptr = (VOIDP) outbuf_int16[test_num];
+              break;
+          case DFNT_UINT16:
+              data_ptr = (VOIDP) outbuf_uint16[test_num];
+              break;
+          case DFNT_INT32:
+              data_ptr = (VOIDP) outbuf_int32[test_num];
+              break;
+          case DFNT_UINT32:
+              data_ptr = (VOIDP) outbuf_uint32[test_num];
+              break;
+          default:
+              return (0);
+      }     /* end switch */
+
+    write_size = BUFSIZE * DFKNTsize(ntype);
+    err_ret = Hwrite(aid, write_size, data_ptr);
+    if (err_ret != write_size)
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) err_ret);
+          HEprint(stdout, 0);
+          num_errs++;
+      }
+
+    err_ret = Hendaccess(aid);
+    CHECK(err_ret, FAIL, "Hendaccess");
+
+    return (ret_ref);
+}   /* end write_data() */
+
+static void
+read_data(int32 fid, uint16 ref_num, intn test_num, int32 ntype)
+{
+    int32       aid;
+    int32       err_ret;
+    int32       read_size;
+    VOIDP       out_ptr;
+    VOIDP       in_ptr;
+    sp_info_block_t info_block;
+    intn        i;
+
+    MESSAGE(8,
+            {
+            char *s = HDgetNTdesc(ntype);
+            printf("Reading data for test %d, ntype=%s\n", (int) test_num, (s == NULL ? "Unknown" : s));
+            HDfree(s);
+            }
+    )
+
+        aid = Hstartread(fid, COMP_TAG, ref_num);
+    CHECK_VOID(aid, FAIL, "Hstartread");
+    if (aid == FAIL)
+        return;
+
+    switch (ntype)
+      {
+          case DFNT_INT8:
+              out_ptr = (VOIDP) outbuf_int8[test_num];
+              in_ptr = (VOIDP) inbuf_int8;
+              break;
+          case DFNT_UINT8:
+              out_ptr = (VOIDP) outbuf_uint8[test_num];
+              in_ptr = (VOIDP) inbuf_uint8;
+              break;
+          case DFNT_INT16:
+              out_ptr = (VOIDP) outbuf_int16[test_num];
+              in_ptr = (VOIDP) inbuf_int16;
+              break;
+          case DFNT_UINT16:
+              out_ptr = (VOIDP) outbuf_uint16[test_num];
+              in_ptr = (VOIDP) inbuf_uint16;
+              break;
+          case DFNT_INT32:
+              out_ptr = (VOIDP) outbuf_int32[test_num];
+              in_ptr = (VOIDP) inbuf_int32;
+              break;
+          case DFNT_UINT32:
+              out_ptr = (VOIDP) outbuf_uint32[test_num];
+              in_ptr = (VOIDP) inbuf_uint32;
+              break;
+          default:
+              return;
+      }     /* end switch */
+
+    read_size = BUFSIZE * DFKNTsize(ntype);
+    err_ret = Hread(aid, read_size, in_ptr);
+    if (err_ret != read_size)
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) err_ret);
+          HEprint(stdout, 0);
+          num_errs++;
+      }     /* end if */
+
+    if (HDmemcmp(in_ptr, out_ptr, read_size) != 0)
+      {
+          char       *s = HDgetNTdesc(ntype);
+
+          HDget_special_info(aid, &info_block);
+          fprintf(stderr, "ERROR: Data from test: %d, number type: %s, model type: %d, coder type: %d differs\n", test_num, s, (int)info_block.model_type, (int)info_block.comp_type);
+          MESSAGE(8,
+	  for(i=0; i<read_size*DFKNTsize(ntype); i++) 
+	    {
+	      if(((char *)in_ptr)[i]!=((char *)out_ptr)[i]) 
+		  printf("byte %i differs, written:%d, read in:%d\n",i,((char *)out_ptr)[i],((char *)in_ptr)[i]);
+	    } /* end for */
+	  )
+          HDfree(s);
+          num_errs++;
+      }     /* end if */
+
+    err_ret = Hendaccess(aid);
+    CHECK_VOID(err_ret, FAIL, "Hendaccess");
+}   /* end read_data() */
+
+void
+test_comp(void)
+{
+    model_info  m_info;
+    comp_info   c_info;
+    uint16      ref_num;        /* reference number of the data written out */
+    int32       fid;            /* file ID of HDF file for testing */
+    intn        test_num, ntype_num, model_num, coder_num;
+    int32       ret;
+
+    MESSAGE(6, printf("Starting compression test\n");
+        )
+
+    /* allocate room for the input and output buffers */
+        allocate_buffers();
+
+    /* fill the buffers with interesting data to compress */
+    init_buffers();
+
+    /* open the HDF file */
+    fid = Hopen(TESTFILE_NAME, DFACC_ALL, 0);
+
+    /* Cycle through the different testing data, the number types, */
+    /* the different modeling layers and the different coding layers, */
+    /* in that order */
+    for (test_num = 0; test_num < NUM_OUTBUFS; test_num++)
+      {
+          for (ntype_num = 0; (size_t)ntype_num < (sizeof(test_ntypes) / sizeof(test_ntypes[0]));
+               ntype_num++)
+            {
+                for (model_num = 0;
+                 (size_t)model_num < (sizeof(test_models) / sizeof(test_models[0]));
+                     model_num++)
+                  {
+                      init_model_info(test_models[model_num], &m_info, test_ntypes[ntype_num]);
+                      for (coder_num = 0;
+                           (size_t)coder_num < (sizeof(test_coders) / sizeof(test_coders[0]));
+                           coder_num++)
+                        {
+                            init_coder_info(test_coders[coder_num], &c_info, test_ntypes[ntype_num]);
+
+                            ref_num = write_data(fid, test_models[model_num], &m_info, test_coders[coder_num], &c_info, test_num, test_ntypes[ntype_num]);
+                            read_data(fid, ref_num, test_num, test_ntypes[ntype_num]);
+                            MESSAGE(6,
+                                    {
+                                    int32 aid;
+                                    sp_info_block_t info_block;
+
+                                    aid = Hstartread(fid, COMP_TAG, ref_num);
+                                    HDget_special_info(aid, &info_block);
+                                    Hendaccess(aid);
+                                    printf("size of original HDF element=%ld\n", (long) Hlength(fid, COMP_TAG, ref_num));
+                                    printf("size of compressed HDF element=%ld\n", (long) info_block.comp_size);
+                                    }
+                            )
+                        }   /* end for */
+                  }     /* end for */
+            }   /* end for */
+      }     /* end for */
+
+    /* close the HDF file */
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* free the input and output buffers */
+    free_buffers();
+
+    MESSAGE(6, printf("Finished compression test\n");
+        )
+}   /* end test_comp() */
diff --git a/hdf/test/conv.c b/hdf/test/conv.c
new file mode 100644
index 0000000..bda4c39
--- /dev/null
+++ b/hdf/test/conv.c
@@ -0,0 +1,713 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: conv.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6036 $";
+#endif
+
+/*
+   FILE
+   conv.c
+   Test HDF Number-Type conversion routines
+
+   REMARKS
+
+   DESIGN
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   10/27/93 - Started coding.
+ */
+
+#include "tproto.h"
+#include <time.h>
+#ifdef I860
+typedef int clock_t;
+#define NO_TIMING
+#define UINT_MAX USI_MAX
+#endif /* I860 */
+
+/* last ditch attempt do define this value... */
+#ifndef UINT_MAX
+#define UINT_MAX (unsigned)(-1)
+#endif
+
+/* Substitute bogus value if CLOCKS_PER_SEC is unavailable */
+#ifndef CLOCKS_PER_SEC
+#define CLOCKS_PER_SEC -1
+#endif
+#ifndef RAND_MAX
+#define RAND_MAX (UINT_MAX)
+#endif
+
+#define TEST_SIZE 100001
+
+#define SOURCE_STRIDE   2   /* space out the strides for source & dest. */
+#define DEST_STRIDE     3
+
+/* define aliases for random number generation */
+#define RAND rand
+#define SEED(a) srand((unsigned)(a))
+
+#ifdef NO_TIMING
+#define clock() (0)
+#endif
+
+extern int Verbocity;
+
+/* Local variables */
+static int32 test_type[] =
+{0, DFNT_LITEND, DFNT_NATIVE};
+static const char *test_name[] =
+{"Big-Endian", "Little-Endian", "Native"};
+
+/* for those machines with imprecise IEEE<-> conversions, this should be */
+/* close enough */
+#define EPS64          ((float64)1.0E-14)
+#define EPS32          ((float32)1.0E-7)
+void
+test_conv(void)
+{
+    clock_t c1,c2,c3,c4;
+    uint8 *src_uint8,
+	  *dst_uint8,
+	  *dst2_uint8;
+    uint16 *src_uint16,
+	  *dst_uint16,
+	  *dst2_uint16;
+    uint32 *src_uint32,
+	  *dst_uint32,
+	  *dst2_uint32;
+    int8 *src_int8,
+	  *dst_int8,
+	  *dst2_int8;
+    int16 *src_int16,
+	  *dst_int16,
+	  *dst2_int16;
+    int32 *src_int32,
+	  *dst_int32,
+	  *dst2_int32;
+    float32 *src_float32,
+	  *dst_float32,
+	  *dst2_float32;
+    float64 *src_float64,
+	  *dst_float64,
+	  *dst2_float64;
+    intn i,r;
+    intn t;
+    int32 ret;
+
+    SEED((int)time(NULL));   /* seed with effectively random number */
+
+    for(t=0; (size_t)t<sizeof(test_type)/sizeof(int32); t++) {
+        MESSAGE(5,printf("Testing %s Number-Types\n",test_name[t]););
+        MESSAGE(6,printf("seeding int8 array\n"););
+
+        /* allocate arrays */
+        src_int8=(int8 *)HDmalloc(TEST_SIZE*sizeof(int8));
+        if(src_int8==NULL) {
+        	CHECK_VOID(src_int8,NULL,"HDmalloc");
+        	return;
+          } /* end if */
+        dst_int8=(int8 *)HDmalloc(TEST_SIZE*sizeof(int8));
+        if(dst_int8==NULL) {
+        	CHECK_VOID(dst_int8,NULL,"HDmalloc");
+        	return;
+          } /* end if */
+        dst2_int8=(int8 *)HDmalloc(TEST_SIZE*sizeof(int8));
+        if(dst2_int8==NULL) {
+            CHECK_VOID(dst2_int8,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++)
+            src_int8[i]=(int8)(RAND()-RAND_MAX/2);
+
+        MESSAGE(6,printf("converting %s int8 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_int8,(VOIDP)dst_int8,test_type[t]|DFNT_INT8,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int8 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s int8 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_int8,(VOIDP)dst2_int8,test_type[t]|DFNT_INT8,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int8 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+        if(HDmemcmp(src_int8,dst2_int8,TEST_SIZE*sizeof(int8))) {
+            printf("Error converting %s int8 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_int8,0xae,TEST_SIZE*sizeof(int8));
+        HDmemset(dst_int8,0xae,TEST_SIZE*sizeof(int8));
+        HDmemset(dst2_int8,0xae,TEST_SIZE*sizeof(int8));
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE)
+            src_int8[i]=(int8)(RAND()-RAND_MAX/2);
+
+        MESSAGE(6,printf("converting %s int8 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_int8,(VOIDP)dst_int8,test_type[t]|DFNT_INT8,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(int8),DEST_STRIDE*sizeof(int8));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int8 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s int8 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_int8,(VOIDP)dst2_int8,test_type[t]|DFNT_INT8,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(int8),SOURCE_STRIDE*sizeof(int8));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int8 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        if(HDmemcmp(src_int8,dst2_int8,(TEST_SIZE/2)*sizeof(int8))) {
+            printf("Error converting %s int8 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_int8);
+        HDfree((VOIDP)dst_int8);
+        HDfree((VOIDP)dst2_int8);
+
+        MESSAGE(6,printf("seeding %s uint8 array\n",test_name[t]););
+        src_uint8=(uint8 *)HDmalloc(TEST_SIZE*sizeof(uint8));
+        if(src_uint8==NULL) {
+            CHECK_VOID(src_uint8,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_uint8=(uint8 *)HDmalloc(TEST_SIZE*sizeof(uint8));
+        if(dst_uint8==NULL) {
+            CHECK_VOID(dst_uint8,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_uint8=(uint8 *)HDmalloc(TEST_SIZE*sizeof(uint8));
+        if(dst2_uint8==NULL) {
+            CHECK_VOID(dst2_uint8,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++)
+            src_uint8[i]=(uint8)RAND();
+
+        MESSAGE(6,printf("converting %s uint8 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_uint8,(VOIDP)dst_uint8,test_type[t]|DFNT_UINT8,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint8 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s uint8 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_uint8,(VOIDP)dst2_uint8,test_type[t]|DFNT_UINT8,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint8 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+        if(HDmemcmp(src_uint8,dst2_uint8,TEST_SIZE*sizeof(uint8))) {
+            printf("Error converting %s uint8 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_uint8,0xae,TEST_SIZE*sizeof(uint8));
+        HDmemset(dst_uint8,0xae,TEST_SIZE*sizeof(uint8));
+        HDmemset(dst2_uint8,0xae,TEST_SIZE*sizeof(uint8));
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE)
+            src_uint8[i]=(uint8)RAND();
+
+        MESSAGE(6,printf("converting %s uint8 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_uint8,(VOIDP)dst_uint8,test_type[t]|DFNT_UINT8,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(uint8),DEST_STRIDE*sizeof(uint8));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint8 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s uint8 array with %d/%d stride\n",test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_uint8,(VOIDP)dst2_uint8,test_type[t]|DFNT_UINT8,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(uint8),SOURCE_STRIDE*sizeof(uint8));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint8 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        if(HDmemcmp(src_uint8,dst2_uint8,(TEST_SIZE/2)*sizeof(uint8))) {
+            printf("Error converting %s uint8 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_uint8);
+        HDfree((VOIDP)dst_uint8);
+        HDfree((VOIDP)dst2_uint8);
+
+        MESSAGE(6,printf("seeding %s int16 array\n",test_name[t]););
+        src_int16=(int16 *)HDmalloc(TEST_SIZE*sizeof(int16));
+        if(src_int16==NULL) {
+            CHECK_VOID(src_int16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_int16=(int16 *)HDmalloc(TEST_SIZE*sizeof(int16));
+        if(dst_int16==NULL) {
+            CHECK_VOID(dst_int16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_int16=(int16 *)HDmalloc(TEST_SIZE*sizeof(int16));
+        if(dst2_int16==NULL) {
+            CHECK_VOID(dst2_int16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++)
+            src_int16[i]=(int16)(RAND()-RAND_MAX/2);
+
+        MESSAGE(6,printf("converting %s int16 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_int16,(VOIDP)dst_int16,test_type[t]|DFNT_INT16,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int16 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s int16 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_int16,(VOIDP)dst2_int16,test_type[t]|DFNT_INT16,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int16 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+        if(HDmemcmp(src_int16,dst2_int16,TEST_SIZE*sizeof(int16))) {
+            printf("Error converting %s int16 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_int16,0xae,TEST_SIZE*sizeof(int16));
+        HDmemset(dst_int16,0xae,TEST_SIZE*sizeof(int16));
+        HDmemset(dst2_int16,0xae,TEST_SIZE*sizeof(int16));
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE)
+            src_int16[i]=(int16)(RAND()-RAND_MAX/2);
+
+        MESSAGE(6,printf("converting %s int16 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_int16,(VOIDP)dst_int16,test_type[t]|DFNT_INT16,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(int16),DEST_STRIDE*sizeof(int16));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int16 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s int16 array with %d/%d stride\n",test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_int16,(VOIDP)dst2_int16,test_type[t]|DFNT_INT16,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(int16),SOURCE_STRIDE*sizeof(int16));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int16 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        if(HDmemcmp(src_int16,dst2_int16,(TEST_SIZE/2)*sizeof(int16))) {
+            printf("Error converting %s int16 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_int16);
+        HDfree((VOIDP)dst_int16);
+        HDfree((VOIDP)dst2_int16);
+
+        MESSAGE(6,printf("seeding %s uint16 array\n",test_name[t]););
+        src_uint16=(uint16 *)HDmalloc(TEST_SIZE*sizeof(uint16));
+        if(src_uint16==NULL) {
+            CHECK_VOID(src_uint16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_uint16=(uint16 *)HDmalloc(TEST_SIZE*sizeof(uint16));
+        if(dst_uint16==NULL) {
+            CHECK_VOID(dst_uint16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_uint16=(uint16 *)HDmalloc(TEST_SIZE*sizeof(uint16));
+        if(dst2_uint16==NULL) {
+            CHECK_VOID(dst2_uint16,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++)
+            src_uint16[i]=(uint16)RAND();
+
+        MESSAGE(6,printf("converting %s uint16 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_uint16,(VOIDP)dst_uint16,test_type[t]|DFNT_UINT16,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint16 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s uint16 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_uint16,(VOIDP)dst2_uint16,test_type[t]|DFNT_UINT16,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint16 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+        if(HDmemcmp(src_uint16,dst2_uint16,TEST_SIZE*sizeof(uint16))) {
+            printf("Error converting %s uint16 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_uint16,0xae,TEST_SIZE*sizeof(uint16));
+        HDmemset(dst_uint16,0xae,TEST_SIZE*sizeof(uint16));
+        HDmemset(dst2_uint16,0xae,TEST_SIZE*sizeof(uint16));
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE)
+            src_uint16[i]=(uint16)RAND();
+
+        MESSAGE(6,printf("converting %s uint16 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_uint16,(VOIDP)dst_uint16,test_type[t]|DFNT_UINT16,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(uint16),DEST_STRIDE*sizeof(uint16));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint16 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s uint16 array with %d/%d stride\n",test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_uint16,(VOIDP)dst2_uint16,test_type[t]|DFNT_UINT16,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(uint16),SOURCE_STRIDE*sizeof(uint16));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint16 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        if(HDmemcmp(src_uint16,dst2_uint16,(TEST_SIZE/2)*sizeof(uint16))) {
+            printf("Error converting %s uint16 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_uint16);
+        HDfree((VOIDP)dst_uint16);
+        HDfree((VOIDP)dst2_uint16);
+
+        MESSAGE(6,printf("seeding %s int32 array\n",test_name[t]););
+        src_int32=(int32 *)HDmalloc(TEST_SIZE*sizeof(int32));
+        if(src_int32==NULL) {
+            CHECK_VOID(src_int32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_int32=(int32 *)HDmalloc(TEST_SIZE*sizeof(int32));
+        if(dst_int32==NULL) {
+            CHECK_VOID(dst_int32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_int32=(int32 *)HDmalloc(TEST_SIZE*sizeof(int32));
+        if(dst2_int32==NULL) {
+            CHECK_VOID(dst2_int32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++)
+            src_int32[i]=(int32)(RAND()-RAND_MAX/2);
+
+        MESSAGE(6,printf("converting %s int32 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_int32,(VOIDP)dst_int32,test_type[t]|DFNT_INT32,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int32 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s int32 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_int32,(VOIDP)dst2_int32,test_type[t]|DFNT_INT32,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int32 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+        if(HDmemcmp(src_int32,dst2_int32,TEST_SIZE*sizeof(int32))) {
+            printf("Error converting %s int32 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_int32,0xae,TEST_SIZE*sizeof(int32));
+        HDmemset(dst_int32,0xae,TEST_SIZE*sizeof(int32));
+        HDmemset(dst2_int32,0xae,TEST_SIZE*sizeof(int32));
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE)
+            src_int32[i]=(int32)(RAND()-RAND_MAX/2);
+
+        MESSAGE(6,printf("converting %s int32 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_int32,(VOIDP)dst_int32,test_type[t]|DFNT_INT32,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(int32),DEST_STRIDE*sizeof(int32));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int32 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s int32 array with %d/%d stride\n",test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_int32,(VOIDP)dst2_int32,test_type[t]|DFNT_INT32,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(int32),SOURCE_STRIDE*sizeof(int32));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s int32 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        if(HDmemcmp(src_int32,dst2_int32,(TEST_SIZE/2)*sizeof(int32))) {
+            printf("Error converting %s int32 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_int32);
+        HDfree((VOIDP)dst_int32);
+        HDfree((VOIDP)dst2_int32);
+
+        MESSAGE(6,printf("seeding %s uint32 array\n",test_name[t]););
+        src_uint32=(uint32 *)HDmalloc(TEST_SIZE*sizeof(uint32));
+        if(src_uint32==NULL) {
+            CHECK_VOID(src_uint32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_uint32=(uint32 *)HDmalloc(TEST_SIZE*sizeof(uint32));
+        if(dst_uint32==NULL) {
+            CHECK_VOID(dst_uint32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_uint32=(uint32 *)HDmalloc(TEST_SIZE*sizeof(uint32));
+        if(dst2_uint32==NULL) {
+            CHECK_VOID(dst2_uint32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++)
+            src_uint32[i]=(uint32)RAND();
+
+        MESSAGE(6,printf("converting %s uint32 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_uint32,(VOIDP)dst_uint32,test_type[t]|DFNT_UINT32,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint32 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s uint32 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_uint32,(VOIDP)dst2_uint32,test_type[t]|DFNT_UINT32,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint32 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+        if(HDmemcmp(src_uint32,dst2_uint32,TEST_SIZE*sizeof(uint32))) {
+            printf("Error converting %s uint32 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_uint32,0xae,TEST_SIZE*sizeof(uint32));
+        HDmemset(dst_uint32,0xae,TEST_SIZE*sizeof(uint32));
+        HDmemset(dst2_uint32,0xae,TEST_SIZE*sizeof(uint32));
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE)
+            src_uint32[i]=(uint32)RAND();
+
+        MESSAGE(6,printf("converting %s uint32 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_uint32,(VOIDP)dst_uint32,test_type[t]|DFNT_UINT32,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(uint32),DEST_STRIDE*sizeof(uint32));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint32 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s uint32 array with %d/%d stride\n",test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_uint32,(VOIDP)dst2_uint32,test_type[t]|DFNT_UINT32,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(uint32),SOURCE_STRIDE*sizeof(uint32));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s uint32 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        if(HDmemcmp(src_uint32,dst2_uint32,(TEST_SIZE/2)*sizeof(uint32))) {
+            printf("Error converting %s uint32 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_uint32);
+        HDfree((VOIDP)dst_uint32);
+        HDfree((VOIDP)dst2_uint32);
+
+        MESSAGE(6,printf("seeding %s float32 array\n",test_name[t]););
+        src_float32=(float32 *)HDmalloc(TEST_SIZE*sizeof(float32));
+        if(src_float32==NULL) {
+            CHECK_VOID(src_float32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_float32=(float32 *)HDmalloc(TEST_SIZE*sizeof(float32));
+        if(dst_float32==NULL) {
+            CHECK_VOID(dst_float32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_float32=(float32 *)HDmalloc(TEST_SIZE*sizeof(float32));
+        if(dst2_float32==NULL) {
+            CHECK_VOID(dst2_float32,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++) {
+            src_float32[i]=(float32)(RAND()-RAND_MAX/2);
+            while((r=RAND())==0) /* don't divide by zero */
+                r=RAND();
+            src_float32[i]/=(float32)r;
+          } /* end for */
+
+        MESSAGE(6,printf("converting %s float32 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_float32,(VOIDP)dst_float32,test_type[t]|DFNT_FLOAT32,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float32 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s float32 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_float32,(VOIDP)dst2_float32,test_type[t]|DFNT_FLOAT32,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float32 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        if(HDmemcmp(src_float32,dst2_float32,TEST_SIZE*sizeof(float32))) {
+            printf("Error converting %s float32 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_float32,0xae,TEST_SIZE*sizeof(float32));
+        HDmemset(dst_float32,0xae,TEST_SIZE*sizeof(float32));
+        HDmemset(dst2_float32,0xae,TEST_SIZE*sizeof(float32));
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE) {
+            src_float32[i]=(float32)(RAND()-RAND_MAX/2);
+            while((r=RAND())==0) /* don't divide by zero */
+                r=RAND();
+            src_float32[i]/=(float32)r;
+          } /* end for */
+
+        MESSAGE(6,printf("converting %s float32 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_float32,(VOIDP)dst_float32,test_type[t]|DFNT_FLOAT32,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(float32),DEST_STRIDE*sizeof(float32));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float32 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s float32 array with %d/%d stride\n",test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_float32,(VOIDP)dst2_float32,test_type[t]|DFNT_FLOAT32,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(float32),SOURCE_STRIDE*sizeof(float32));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float32 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+
+        if(HDmemcmp(src_float32,dst2_float32,(TEST_SIZE/2)*sizeof(float32))) {
+            printf("Error converting %s float32 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_float32);
+        HDfree((VOIDP)dst_float32);
+        HDfree((VOIDP)dst2_float32);
+
+        MESSAGE(6,printf("seeding %s float64 array\n",test_name[t]););
+        src_float64=(float64 *)HDmalloc(TEST_SIZE*sizeof(float64));
+        if(src_float64==NULL) {
+            CHECK_VOID(src_float64,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst_float64=(float64 *)HDmalloc(TEST_SIZE*sizeof(float64));
+        if(dst_float64==NULL) {
+            CHECK_VOID(dst_float64,NULL,"HDmalloc");
+            return;
+          } /* end if */
+        dst2_float64=(float64 *)HDmalloc(TEST_SIZE*sizeof(float64));
+        if(dst2_float64==NULL) {
+            CHECK_VOID(dst2_float64,NULL,"HDmalloc");
+            return;
+          } /* end if */
+
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i++) {
+            src_float64[i]=(float64)(RAND()-RAND_MAX/2);
+            while((r=RAND())==0) /* don't divide by zero */
+                r=RAND();
+            src_float64[i]/=(float64)r;
+          } /* end for */
+
+        MESSAGE(6,printf("converting %s float64 array\n",test_name[t]););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_float64,(VOIDP)dst_float64,test_type[t]|DFNT_FLOAT64,TEST_SIZE,DFACC_WRITE,0,0);
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float64 values\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        MESSAGE(6,printf("re-converting %s float64 array\n",test_name[t]););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_float64,(VOIDP)dst2_float64,test_type[t]|DFNT_FLOAT64,TEST_SIZE,DFACC_READ,0,0);
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float64 values\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t]););
+
+        if(HDmemcmp(src_float64,dst2_float64,TEST_SIZE*sizeof(float64))) {
+            printf("Error converting %s float64 values!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        /* clear arrays for next test */
+        HDmemset(src_float64,0xae,TEST_SIZE*sizeof(float64));
+        HDmemset(dst_float64,0xae,TEST_SIZE*sizeof(float64));
+        HDmemset(dst2_float64,0xae,TEST_SIZE*sizeof(float64));
+        /* Seed arrays with random values */
+        for(i=0; i<TEST_SIZE; i+=SOURCE_STRIDE) {
+            src_float64[i]=(float64)(RAND()-RAND_MAX/2);
+            while((r=RAND())==0) /* don't divide by zero */
+                r=RAND();
+            src_float64[i]/=(float64)r;
+          } /* end for */
+
+        MESSAGE(6,printf("converting %s float64 array with %d/%d stride\n",test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+        c1=clock();
+        ret=DFKconvert((VOIDP)src_float64,(VOIDP)dst_float64,test_type[t]|DFNT_FLOAT64,TEST_SIZE/4,DFACC_WRITE,SOURCE_STRIDE*sizeof(float64),DEST_STRIDE*sizeof(float64));
+        c2=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float64 values with %d/%d stride\n",(int)(c2-c1),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],SOURCE_STRIDE,DEST_STRIDE););
+
+        MESSAGE(6,printf("re-converting %s float64 array with %d/%d stride\n",test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        c3=clock();
+        ret=DFKconvert((VOIDP)dst_float64,(VOIDP)dst2_float64,test_type[t]|DFNT_FLOAT64,TEST_SIZE/4,DFACC_READ,DEST_STRIDE*sizeof(float64),SOURCE_STRIDE*sizeof(float64));
+        c4=clock();
+        RESULT("DFKconvert");
+        MESSAGE(6,printf("%d/%d seconds to convert %d %s float64 values with %d/%d stride\n",(int)(c4-c3),(int)CLOCKS_PER_SEC,(int)TEST_SIZE,test_name[t],DEST_STRIDE,SOURCE_STRIDE););
+        if(HDmemcmp(src_float64,dst2_float64,(TEST_SIZE/2)*sizeof(float64))) {
+            printf("Error converting %s float64 values with strides!\n",test_name[t]);
+            HEprint(stdout,0);
+            num_errs++;
+          } /* end if */
+
+        HDfree((VOIDP)src_float64);
+        HDfree((VOIDP)dst_float64);
+        HDfree((VOIDP)dst2_float64);
+      } /* end for */
+
+}   /* end test_conv() */
diff --git a/hdf/test/egchi.res b/hdf/test/egchi.res
new file mode 100644
index 0000000..0c3d3de
--- /dev/null
+++ b/hdf/test/egchi.res
@@ -0,0 +1,49 @@
+#
+# NOTE:  This file was generated on a machine where the size of
+#   local ints and floats is 4 bytes.  On machines with different
+#   sizes the 'vsize=X' entries will be different.
+#
+
+FULL DUMP
+
+FILE: egchi.hdf
+
+vg:0 <1965/4> (This is an EMPTY vgroup {EXAMPLE}) has 0 entries:
+
+vg:1 <1965/5> (here is a vset with 4 links {EXAMPLE}) has 4 entries:
+  vs:0 <1962/2> nv=100 i=0 fld [PRES] vsize=4 (pressure vals {EXAMPLE})
+0: fld [PRES], type=5, order=1
+100.000000  100.000999  100.001999  100.002998  100.003998  100.004997  
+100.005997  100.007004  100.008003  100.009003  100.010002  100.011002  
+100.012001  100.013000  100.014000  100.014999  100.015999  100.016998  
+100.017998  100.018997  100.019997  100.021004  100.022003  100.023003  
+100.024002  100.025002  100.026001  100.027000  100.028000  100.028999  
+100.029999  100.030998  100.031998  100.032997  100.033997  100.035004  
+100.036003  100.037003  100.038002  100.039001  100.040001  100.041000  
+100.042000  100.042999  100.043999  100.044998  100.045998  100.046997  
+100.047997  100.049004  100.050003  100.051003  100.052002  100.053001  
+100.054001  100.055000  100.056000  100.056999  100.057999  100.058998  
+100.059998  100.060997  100.061996  100.063004  100.064003  100.065002  
+100.066002  100.067001  100.068001  100.069000  100.070000  100.070999  
+100.071999  100.072998  100.073997  100.074997  100.075996  100.077003  
+100.078003  100.079002  100.080002  100.081001  100.082001  100.083000  
+100.084000  100.084999  100.085999  100.086998  100.087997  100.088997  
+100.089996  100.091003  100.092003  100.093002  100.094002  100.095001  
+100.096001  100.097000  100.098000  100.098999  
+
+  vs:1 <1962/3> nv=60 i=0 fld [COLOR] vsize=12 (rgb colors {EXAMPLE})
+0: fld [COLOR], type=24, order=3
+0 100 200  1 101 201  2 102 202  3 103 203  4 104 204  5 105 205  
+6 106 206  7 107 207  8 108 208  9 109 209  10 110 210  11 111 211  
+12 112 212  13 113 213  14 114 214  15 115 215  16 116 216  17 117 217  
+18 118 218  19 119 219  20 120 220  21 121 221  22 122 222  23 123 223  
+24 124 224  25 125 225  26 126 226  27 127 227  28 128 228  29 129 229  
+30 130 230  31 131 231  32 132 232  33 133 233  34 134 234  35 135 235  
+36 136 236  37 137 237  38 138 238  39 139 239  40 140 240  41 141 241  
+42 142 242  43 143 243  44 144 244  45 145 245  46 146 246  47 147 247  
+48 148 248  49 149 249  50 150 250  51 151 251  52 152 252  53 153 253  
+54 154 254  55 155 255  56 156 256  57 157 257  58 158 258  59 159 259  
+
+
+  vg:2 <1965/4> ne=0 (This is an EMPTY vgroup {EXAMPLE})
+  --:3 <7777/1> Unknown Tag
diff --git a/hdf/test/egfhi.f b/hdf/test/egfhi.f
new file mode 100644
index 0000000..9620f2a
--- /dev/null
+++ b/hdf/test/egfhi.f
@@ -0,0 +1,152 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+C $Id: egfhi.f 4932 2007-09-07 17:17:23Z bmribler $
+C     
+C==========================================================   
+c
+c     HDF VSET Sample Program
+c     Jason NG NCSA FEB-28-92
+c     
+c     EGFHI.F
+c     Uses High-Level routines
+c     Creates a vset of 1 vgroup and 3 vdatas in the file 'egfhi.hdf'.
+c     
+c     
+c     ===========================================================
+      
+      program HIGHLEVEL
+      
+      print *, 'This program tests the Fortran Vset High-level'
+      print *, 'calls. It creates 3 vdatas, and then create a vgroup'
+      print *, 'that will be linked to the 3 vdatas.'
+      print *,' '
+      
+      call DOIT
+      
+      end
+      
+
+      
+      subroutine DOIT
+      
+c     Remove this fortran directive if your compiler doesn't support it.
+c     It forces an error message whenever a variable is not decalred.
+
+      IMPLICIT	NONE
+      
+      integer	idata(200)		
+      real	rdata(200)	
+      integer	conval(3,200)		
+      integer	tagarray(10), refarray(10) 
+
+c     --- declare the HDF and VSET routines used. This is compulsory!
+
+      external HOPEN, HCLOSE ,VHFSD, VHFSDM, VHFMKGP, VFSTART, VFEND
+      integer	HOPEN, VHFSD, VHFSDM, VHFMKGP
+      
+      integer 	f, i, j 
+      integer  vs1, vs2, vs3, vg
+      
+c     --- some defined constants. see "vg.h"
+      
+      integer 	LONGTYPE    
+      parameter 	(LONGTYPE=24)
+      integer 	REALTYPE	
+      
+      parameter 	(REALTYPE=5)
+      integer		VDATATAG
+      parameter 	(VDATATAG=1962)
+      integer 	FULLACC	
+      parameter 	(FULLACC=7)
+
+c     ------ generate some data -------
+      
+      do 111 i=1,200
+         rdata(i) = i *1.001 + 500
+         idata(i) = i
+ 111  continue
+      
+      do 112 i=1,100
+         do 114 j=1,3
+            conval(j,i) = i*j
+ 114     continue
+ 112  continue
+      
+c     ------- open hdf file ------
+      
+      f = HOPEN ('egfhi.hdf'//char(0), FULLACC, 0)
+      call VFSTART (f)
+      
+c     ------- store 100 floats as one field in one vdata  ------
+      vs1 = VHFSD (f, 'MP', rdata, 100, REALTYPE,  
+     +     'melting-points', 'test')
+      
+c     ------- store 120 integers as one field in one vdata  ------
+      vs2 = VHFSD (f, 'AGE', idata, 120, LONGTYPE,
+     +     'age-of-specimens', 'test')
+      
+      
+c     ------- store 100*3 values as one field (of order 3) -----
+c     ------- in one vdata  ------
+      vs3 = VHFSDM (f, 'PLIST', conval, 100, LONGTYPE, 
+     +     'connectivity triplets','test',3)
+      
+c     --------- messages  ----------------------
+      
+      if (vs1 .eq. -1) then 
+         print *,'error creating melting-point vdata' 
+      else 
+         print *, 'created vdata "melting-points" with 100 elements'
+      endif
+
+      if (vs2 .eq. -1) then 
+         print *,'error creating  "age-of-specimens" vdata' 
+      else 
+         print *, 'created vdata "age-of-specimens" with 120 elements'
+      endif
+      if (vs3 .eq. -1) then 
+         print *,'error creating  "connectivity triplets" vdata' 
+      else 
+         print *, 'created vdata "connectivity triplets" with '
+         print *, '   100 elements'
+      endif
+      
+c     ------ make a vgroup that has links to all the above vdatas ----  
+      
+      tagarray(1) = VDATATAG
+      refarray(1) = vs1
+      tagarray(2) = VDATATAG
+      refarray(2) = vs2
+      tagarray(3) = VDATATAG
+      refarray(3) = vs3
+      
+      vg = VHFMKGP(f,tagarray,refarray,3,
+     +     'vgroup with 3 vdatas (fortran)', 'test')
+      if (vg .eq. -1) then 
+         print *,'error creating  vgroup'
+      else 
+         print *, 'created vgroup that links all the 3 vdatas'
+      endif
+c     --- all done. close the file ---
+      call VFEND (f)
+      call HCLOSE (f)
+      
+      print *,' '
+      print *, 'SUCCESS: created file egfhi.hdf'
+      print *, 'Use the utility vshow to look at the results:'
+      print *, '       vshow egfhi.hdf +'
+      print *, 'Results should be as in the file egfhi.result'
+      print *,' '
+      
+      end
diff --git a/hdf/test/egfhi.res b/hdf/test/egfhi.res
new file mode 100644
index 0000000..e3f62db
--- /dev/null
+++ b/hdf/test/egfhi.res
@@ -0,0 +1,61 @@
+#
+# NOTE:  This file was generated on a machine where the size of
+#   local ints and floats is 4 bytes.  On machines with different
+#   sizes the 'vsize=X' entries will be different.
+#
+
+FULL DUMP
+
+FILE: egfhi.hdf
+
+vg:0 <1965/5> (vgroup with 3 vdatas (fortran) {test}) has 3 entries:
+  vs:0 <1962/2> nv=100 i=0 fld [MP] vsize=4 (melting-points {test})
+0: fld [MP], type=5, order=1
+501.001007  502.002014  503.002991  504.003998  505.005005  506.006012  
+507.006989  508.007996  509.009003  510.010010  511.010986  512.012024  
+513.013000  514.013977  515.015015  516.015991  517.017029  518.018005  
+519.018982  520.020020  521.020996  522.021973  523.023010  524.023987  
+525.025024  526.026001  527.026978  528.028015  529.028992  530.030029  
+531.031006  532.031982  533.033020  534.033997  535.034973  536.036011  
+537.036987  538.038025  539.039001  540.039978  541.041016  542.041992  
+543.043030  544.044006  545.044983  546.046021  547.046997  548.047974  
+549.049011  550.049988  551.051025  552.052002  553.052979  554.054016  
+555.054993  556.056030  557.057007  558.057983  559.059021  560.059998  
+561.060974  562.062012  563.062988  564.064026  565.065002  566.065979  
+567.067017  568.067993  569.069031  570.070007  571.070984  572.072021  
+573.072998  574.073975  575.075012  576.075989  577.077026  578.078003  
+579.078979  580.080017  581.080994  582.082031  583.083008  584.083984  
+585.085022  586.085999  587.086975  588.088013  589.088989  590.090027  
+591.091003  592.091980  593.093018  594.093994  595.095032  596.096008  
+597.096985  598.098022  599.098999  600.099976  
+
+  vs:1 <1962/3> nv=120 i=0 fld [AGE] vsize=4 (age-of-specimenstest {test})
+0: fld [AGE], type=24, order=1
+1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  
+20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  
+37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  
+54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  
+71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  
+88  89  90  91  92  93  94  95  96  97  98  99  100  101  102  103  
+104  105  106  107  108  109  110  111  112  113  114  115  116  117  
+118  119  120  
+
+  vs:2 <1962/4> nv=100 i=0 fld [PLIST] vsize=12 (connectivity triplets {test})
+0: fld [PLIST], type=24, order=3
+1 2 3  2 4 6  3 6 9  4 8 12  5 10 15  6 12 18  7 14 21  8 16 24  9 18 27  
+10 20 30  11 22 33  12 24 36  13 26 39  14 28 42  15 30 45  16 32 48  
+17 34 51  18 36 54  19 38 57  20 40 60  21 42 63  22 44 66  23 46 69  
+24 48 72  25 50 75  26 52 78  27 54 81  28 56 84  29 58 87  30 60 90  
+31 62 93  32 64 96  33 66 99  34 68 102  35 70 105  36 72 108  37 74 111  
+38 76 114  39 78 117  40 80 120  41 82 123  42 84 126  43 86 129  
+44 88 132  45 90 135  46 92 138  47 94 141  48 96 144  49 98 147  
+50 100 150  51 102 153  52 104 156  53 106 159  54 108 162  55 110 165  
+56 112 168  57 114 171  58 116 174  59 118 177  60 120 180  61 122 183  
+62 124 186  63 126 189  64 128 192  65 130 195  66 132 198  67 134 201  
+68 136 204  69 138 207  70 140 210  71 142 213  72 144 216  73 146 219  
+74 148 222  75 150 225  76 152 228  77 154 231  78 156 234  79 158 237  
+80 160 240  81 162 243  82 164 246  83 166 249  84 168 252  85 170 255  
+86 172 258  87 174 261  88 176 264  89 178 267  90 180 270  91 182 273  
+92 184 276  93 186 279  94 188 282  95 190 285  96 192 288  97 194 291  
+98 196 294  99 198 297  100 200 300  
+
diff --git a/hdf/test/extelt.c b/hdf/test/extelt.c
new file mode 100644
index 0000000..e43562d
--- /dev/null
+++ b/hdf/test/extelt.c
@@ -0,0 +1,495 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5201 $";
+#endif
+
+/* $Id: extelt.c 5201 2009-06-18 14:11:06Z bmribler $ */
+
+/*
+ * These is a first pass at rewriting how these tests for exteranl 
+ * elements were done -GV
+ */
+#include "tproto.h"
+#define TESTFILE_NAME "t.hdf"             /* file for first 4 series of tests */
+#define TESTFILE_NAME1 "tx.hdf"           /* file for last test */
+#define STRING         "element 1000 2"          /* 14 bytes */
+#define STRING2        "element 1000 1   wrong"  /* 22 bytes */
+#define STRING3        "element 1000 1 correct"  /* 22 bytes */
+
+#define BUF_SIZE        4096
+
+static uint8  outbuf[BUF_SIZE],  inbuf[BUF_SIZE];
+
+void
+test_hextelt(void)
+{
+    int32       fid, fid1;
+    int32       aid1, aid2;
+    int32       fileid, length, offset, posn;
+    uint16      tag, ref;
+    int16       acc_mode, special;
+    int         i;
+    int32       ret;
+    intn        errflag  = 0;
+    intn        errors = 0;
+
+    /* Initialize buffer */
+    for (i = 0; i < BUF_SIZE; i++)
+        outbuf[i] = (char) (i % 256);
+
+    /* Create header file */
+    MESSAGE(5, printf("Creating base file %s\n", TESTFILE_NAME);
+        );
+
+    fid = Hopen(TESTFILE_NAME, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Write first object to header file */
+    MESSAGE(5, printf("Writing object(%lu bytes) into base file\n",
+                      (unsigned long)HDstrlen(STRING2));
+            );
+    ret = Hputelement(fid, (uint16) 1000, (uint16) 1,
+                      (const uint8 *) STRING2,
+                      (int32)HDstrlen(STRING2) + 1);
+    CHECK_VOID(ret, FAIL, "Hputelement");
+
+    /* Promote the above object to an external object */
+    MESSAGE(5, printf("Promoting above object to external element in file #1\n");
+            );
+    aid1 = HXcreate(fid, 1000, 1, "t1.hdf", (int32) 0, (int32) 0);
+    CHECK_VOID(aid1, FAIL, "HXcreate");
+
+    ret = Hseek(aid1, (int32)HDstrlen("element 1000 1") + 1, DF_START);
+    CHECK_VOID(ret, FAIL, "Hseek");
+
+    /* Now verify that the new promoted object can be written to */
+    MESSAGE(5, printf("Writing to promoted object now in file #1 \n");
+            );
+
+    ret = Hwrite(aid1, (int32)HDstrlen("correct") + 1, "correct");
+    if (ret != (int32) HDstrlen("correct") + 1)
+      {
+          fprintf(stderr, "Hwrite failed (code %d)\n", (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Create a new external object of size 2000 bytes in a seperate file */
+    MESSAGE(5, printf("Creating an external element in file #2\n");
+        );
+    aid1 = HXcreate(fid, 1000, 4, "t2.hdf", (int32) 0, (int32) 0);
+    CHECK_VOID(aid1, FAIL, "HXcreate");
+
+    MESSAGE(5, printf("Writing 2000 bytes to file #2\n");
+        );
+    ret = Hwrite(aid1, 2000, outbuf);
+    CHECK_VOID(ret, FAIL, "Hwrite");
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Create a new external string object  in a seperate file */
+    MESSAGE(5, printf("Creating an external element in file #3\n");
+        );
+    aid1 = HXcreate(fid, 1000, 2, "t3.hdf", (int32) 0, (int32) 0);
+    CHECK_VOID(aid1, FAIL, "HXcreate");
+
+    MESSAGE(5, printf("Writing string '%s'(%lu bytes) to file #3\n", 
+                      STRING, (unsigned long)HDstrlen(STRING));
+        );
+    ret = Hwrite(aid1, (int32)HDstrlen(STRING) + 1, STRING);
+    if (ret != (int32) HDstrlen(STRING) + 1)
+      {
+          fprintf(stderr, "Hwrite failed (code %d)\n", (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Create a new external object that points to part of an existing element */
+    MESSAGE(5, printf("Creating an overlapping element that already exists in file #3\n");
+        );
+    aid2 = HXcreate(fid, 1001, 2, "t3.hdf", (int32) 8, (int32) 4);
+    CHECK_VOID(aid2, FAIL, "HXcreate");
+
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Create a new external object of size 4096 bytes */
+    MESSAGE(5, printf("Creating an external element in file #4\n");
+        );
+    aid1 = HXcreate(fid, 1020, 2, "t4.hdf", (int32) 0, (int32) 0);
+    CHECK_VOID(aid1, FAIL, "HXcreate");
+
+    MESSAGE(5, printf("Writing %d bytes to file #4\n", BUF_SIZE);
+        );
+    ret = Hwrite(aid1, BUF_SIZE, outbuf);
+    if (ret != BUF_SIZE)
+      {
+          fprintf(stderr, "Hwrite failed (code %d)\n", (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Close the file */
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* Now re-open for reading and verifying the elements */
+    MESSAGE(5, printf("Closing and re-opening base file %s\n", TESTFILE_NAME);
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(ret, FAIL, "Hopen");
+
+    /* Verify element in file #1 */
+    aid1 = Hstartread(fid, 1000, 1);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    MESSAGE(5, printf("Inquiring about external element in file #1\n");
+        );
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    for (i = 0; i < BUF_SIZE; i++)
+        inbuf[i] = '\0';
+
+    MESSAGE(5, printf("Reading external element in file #1\n");
+        );
+    ret = Hread(aid1, length, inbuf);
+    if (ret != length)
+      {
+          fprintf(stderr, "Hread failed (code %d)\n", (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+    MESSAGE(5, printf("Verifying data(%d bytes) in external element in file #1\n", (int)ret);
+        );
+    if (HDstrcmp((const char *) inbuf, (const char *) STRING3))
+      {
+          fprintf(stderr, "Error: Object stored in file #1 is wrong\n");
+          fprintf(stderr, "\t       Is: %s\n", (char *) inbuf);
+          fprintf(stderr, "\tShould be: %s\n",STRING3);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Verify element in file #2 */
+    aid1 = Hstartread(fid, 1000, 4);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    MESSAGE(5, printf("Inquiring about external element in file #2\n");
+        );
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    for (i = 0; i < BUF_SIZE; i++)
+        inbuf[i] = 0;
+
+    ret = Hgetelement(fid, (uint16) tag, (uint16) ref, inbuf);
+    if (ret != length)
+      {
+          fprintf(stderr, "Incorrect element size returned from Hgetelement: %d\n",
+                  (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+#if 0
+    ret = Hread(aid1, length, inbuf);
+    if (ret != 2000)
+      {
+          fprintf(stderr, "Incorrect element size returned from Hread: %d\n",
+                  (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+#endif
+    MESSAGE(5, printf("Verifying data(%d bytes) that was stored to file #2\n",(int)ret);
+        );
+
+    errflag = 0;
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                errflag = 1;
+                MESSAGE(8, printf("Wrong data at %d, out %d in %d\n", 
+                                  i, outbuf[i], inbuf[i]);
+                        );
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+    if (errflag)
+        fprintf(stderr,"Error: Wrong data in inbuf[] from external elment in file #2\n");
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Verify overlapping element in file #3 */
+    aid1 = Hstartread(fid, 1001, 2);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    MESSAGE(5, printf("Inquiring about overlaping external element in file #3\n");
+        );
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    for (i = 0; i < BUF_SIZE; i++)
+        inbuf[i] = '\0';
+
+    ret = Hgetelement(fid, (uint16) tag, (uint16) ref, inbuf);
+    if (ret != length)
+      {
+          fprintf(stderr, "Incorrect element size returned from Hgetelement: %d\n",
+                  (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+#if 0
+    ret = Hread(aid1, length, inbuf);
+    if (ret != length)
+      {
+          fprintf(stderr, "Incorrect element size returned from Hread: %d\n",
+                  (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+#endif
+    MESSAGE(5, printf("Verifying data(%d bytes) that was stored in overlapping element in file #3\n",(int)ret);
+        );
+
+    if (inbuf[0] != '1' ||
+        inbuf[1] != '0' ||
+        inbuf[2] != '0' ||
+        inbuf[3] != '0')
+      {
+          fprintf(stderr,"Error: One or more errors in overlapping element in file #3\n");
+          fprintf(stderr, "\t       is: %s\n", (char *) inbuf);
+          fprintf(stderr, "\tShould be: %s\n","1000");
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Verify the whole element in file #3 */
+    aid1 = Hstartread(fid, 1000, 2);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    MESSAGE(5, printf("Inquiring about external element in file #3\n");
+        );
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    for (i = 0; i < BUF_SIZE; i++)
+        inbuf[i] = '\0';
+
+    MESSAGE(5, printf("Reading whole external element in file #3\n");
+        );
+    ret = Hread(aid1, length, inbuf);
+    if (ret != length)
+      {
+          fprintf(stderr, "Hread failed (code %d)\n", (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+    MESSAGE(5, printf("Verifying data(%d bytes) in whole external element in file #3\n", (int)ret);
+        );
+    if (HDstrcmp((const char *) inbuf, (const char *) STRING))
+      {
+          fprintf(stderr, "Error: Object stored in file #3 is wrong\n");
+          fprintf(stderr, "\t       is: %s\n", (char *) inbuf);
+          fprintf(stderr, "\tShould be: %s\n",STRING);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Verify element in file #4 */
+    aid1 = Hstartread(fid, 1020, 2);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    MESSAGE(5, printf("Inquiring about access element in file #4\n");
+        );
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    for (i = 0; i < BUF_SIZE; i++)
+        inbuf[i] = 0;
+
+
+    ret = Hread(aid1, length, inbuf);
+    if (ret != length)
+      {
+          fprintf(stderr, "Incorrect element size returned from Hread: %d\n",
+                  (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+    MESSAGE(5, printf("Verifying data(%d bytes) in external element in file #4\n",(int)ret);
+        );
+
+    errflag  = 0;
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                errflag = 1;
+                MESSAGE(8, printf("Wrong data at %d, out %d in %d\n", 
+                                  i, outbuf[i], inbuf[i]);
+                        );
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+    if (errflag)
+        fprintf(stderr,"Error: Wrong data in inbuf[]  from external elment in file #4\n");
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Write to the first element in file #1 again */
+    MESSAGE(5, printf("Now writing again to external element in file #1\n");
+        );
+    aid2 = Hstartwrite(fid, 1000, 1, 4);
+    CHECK_VOID(aid2, FAIL, "Hstartwrite");
+
+    ret = Hwrite(aid2, 4, "ABCD");
+    if (ret != 4)
+      {
+          fprintf(stderr, "Hwrite failed (code %d)\n", (int) ret);
+          HEprint(stderr, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    /* Second file open rest for reading */
+    fid1 = Hopen(TESTFILE_NAME, DFACC_READ, 0);
+    CHECK_VOID(fid1, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid1);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    /* Close first open of file */
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* Close second open of file */
+    ret = Hclose(fid1);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /*==============================*/
+    /* Test External Path functions */
+    /*==============================*/
+    MESSAGE(5, printf("testing External Path functions\n");
+        );
+
+    /* start with a brand new file */
+    MESSAGE(5, printf("Creating header file %s for external element \n",
+                      TESTFILE_NAME1);
+        );
+    fid = Hopen(TESTFILE_NAME1, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ret = HXsetcreatedir("testdir");
+    CHECK_VOID(ret, FAIL, "HXsetcreatedir");
+   
+    MESSAGE(5, printf("Creating an external element in file testdir/t5.hdf\n");
+        );
+    aid1 = HXcreate(fid, 1000, 5, "t5.hdf", (int32) 0, (int32) 0);
+    CHECK_VOID(aid1, FAIL, "HXcreate");
+
+    MESSAGE(5, printf("Writing 2000 bytes to file t5.hdf\n");
+        );
+    ret = Hwrite(aid1, 2000, outbuf);
+    CHECK_VOID(ret, FAIL, "Hwrite");
+
+    MESSAGE(5, printf("Ending access to element and closing header file %s\n", 
+                      TESTFILE_NAME1);
+        );
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Re-open file and try read to external element.  Should fail the first time.\n");
+        );
+
+    fid = Hopen(TESTFILE_NAME1, DFACC_READ, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ret = Hgetelement(fid, (uint16) 1000, (uint16) 5, inbuf);
+    VERIFY_VOID(ret, FAIL, "Hgetelement");
+
+    ret = HXsetdir("nosuchdir|testdir");
+    CHECK_VOID(ret, FAIL, "HXsetdir");
+
+    MESSAGE(5, printf("Try read it again.  Should not fail this time.\n");
+        );
+
+    ret = Hgetelement(fid, (uint16) 1000, (uint16) 5, inbuf);
+    CHECK_VOID(ret, FAIL, "Hgetelement");
+
+    errflag  = 0;
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+            {
+                errflag = 1;
+                MESSAGE(8, printf("Wrong data at %d, out %d in %d\n",
+                                  i, outbuf[i], inbuf[i]);
+                        );
+                errors++;
+            }
+          inbuf[i] = '\0';
+      }
+    if (errflag)
+        fprintf(stderr,"Error: Wrong data in inbuf[]  from external elment in file #5\n" );
+
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    /* unset the external paths directory variables */
+    ret = HXsetcreatedir(NULL);
+    CHECK_VOID(ret, FAIL, "HXsetcreatedir");
+    ret = HXsetdir(NULL);
+    CHECK_VOID(ret, FAIL, "HXsetdir");
+
+    num_errs += errors;     /* increment global error count */
+}
+
diff --git a/hdf/test/file.c b/hdf/test/file.c
new file mode 100644
index 0000000..e645bd3
--- /dev/null
+++ b/hdf/test/file.c
@@ -0,0 +1,242 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: file.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+   * Hopen
+   ** Create a file.
+   ** Open an existing file.
+   *** Normally.
+   *** Read-only file with DFACC_WRITE.
+   ** Open non-existent file.
+   *** With DFACC_READ.
+   *** With DFACC_WRITE.
+   ** Create an illegal file.
+   ** Open the same file twice.
+   *** First with DFACC_WRITE then with DFACC_READ.
+   *** First with DFACC_WRITE then with DFACC_WRITE.
+   *** First with DFACC_READ and then with DFACC_WRITE.
+   *** First with DFACC_<any> and then with DFACC_CREATE.
+   ** Open more files than there is slots.
+
+   * Hclose
+   ** Close a proper file.
+   ** Close with an illegal file id.
+   *** Random file id.
+   *** Correct tag but bad slot.
+
+   * Hstartread
+   ** Normal.
+   ** With illegal file id.
+   ** With illegal tag/ref.
+   ** With wildcard.
+   ** Open more access elements than there is space.
+
+ */
+
+#include "tproto.h"
+#define TESTFILE_NAME "t.hdf"
+#define BUF_SIZE        4096
+
+static uint8  outbuf[BUF_SIZE],  inbuf[BUF_SIZE];
+
+void
+test_hfile(void)
+{
+    int32       fid, fid1;
+    int32       aid1, aid2;
+    int32       fileid, length, offset, posn;
+    uint16      tag, ref;
+    int16       acc_mode, special;
+    int32       ret;
+    int         i;
+    intn        errors = 0;
+    intn        ret_bool;
+
+    for (i = 0; i < BUF_SIZE; i++)
+        outbuf[i] = (char) (i % 256);
+
+    MESSAGE(5, printf("Creating a file %s\n", TESTFILE_NAME);
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ret_bool = (intn) Hishdf(TESTFILE_NAME);
+    CHECK_VOID(ret_bool, FALSE, "Hishdf");
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Reading / Writing to file\n");
+        );
+    ret = Hputelement(fid, (uint16) 100, 1,
+                  (const uint8 *) "testing 100 1", (int32)HDstrlen("testing 100 1") + 1);
+    CHECK_VOID(ret, FAIL, "Hputelement");
+
+    ret = Hputelement(fid, (uint16) 100, (uint16) 4, outbuf, 2000);
+    CHECK_VOID(ret, FAIL, "Hputelement");
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    ret = Hputelement(fid, (uint16) 103, (uint16) 2,
+                  (const uint8 *) "element 103 2", (int32)HDstrlen("element 103 2") + 1);
+    CHECK_VOID(ret, FAIL, "Hputlement");
+
+    ret = Hgetelement(fid, (uint16) 100, (uint16) 4, inbuf);
+    if (ret != 2000)
+      {
+          fprintf(stderr, "Line %d: Hgetelement returned wrong count: %d\n", (int)__LINE__, (int) ret);
+          errors++;
+      }
+
+    for (i = 0; i < ret; i++)
+      {
+          if (inbuf[i] != outbuf[i])
+              printf("Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+          inbuf[i] = '\0';
+      }
+
+    ret = Hputelement(fid, 102, 2, outbuf, BUF_SIZE);
+    CHECK_VOID(ret, FAIL, "Hputlement");
+
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    MESSAGE(5, printf("Closing and re-opening file %s\n", TESTFILE_NAME);
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    aid1 = Hstartread(fid, 100, 1);
+    CHECK_VOID(aid1, FAIL, "Hstartread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    MESSAGE(5, printf("Verifying data\n\n");
+        );
+    ret = Hread(aid1, length, inbuf);
+    if (ret != 14)
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong length: %d\n", (int) ret);
+          errors++;
+      }
+
+    if (HDstrcmp((const char *) inbuf, (const char *) "testing 100 1"))
+      {
+          fprintf(stderr, "ERROR: Hread returned the wrong data\n");
+          fprintf(stderr, "\t       Is: %s\n", (char *) inbuf);
+          fprintf(stderr, "\tShould be: testing 100 1\n");
+          errors++;
+      }
+
+    ret = (int32)Hnewref(fid);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    MESSAGE(5, printf("Testing a number of searching schemes\n");
+        );
+    ret = Hnextread(aid1, 100, DFREF_WILDCARD, DF_CURRENT);
+    CHECK_VOID(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    ret = Hnextread(aid1, 100, DFREF_WILDCARD, DF_CURRENT);
+    if (ret != FAIL)
+      {
+          fprintf(stderr, "ERROR: Found a non-existant element at line %d\n",
+                  __LINE__);
+          errors++;
+      }
+
+    ret = Hnextread(aid1, DFTAG_WILDCARD, DFREF_WILDCARD, DF_START);
+    CHECK_VOID(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    ret = Hnextread(aid1, DFTAG_WILDCARD, 3, DF_CURRENT);
+    if (ret != FAIL)
+      {
+          fprintf(stderr, "ERROR: Found a non-existant element at line %d\n",
+                  __LINE__);
+          errors++;
+      }
+
+    ret = Hnextread(aid1, DFTAG_WILDCARD, 2, DF_CURRENT);
+    CHECK_VOID(ret, FAIL, "Hnextread");
+
+    ret = Hinquire(aid1, &fileid, &tag, &ref, &length, &offset, &posn,
+                   &acc_mode, &special);
+    CHECK_VOID(ret, FAIL, "Hinquire");
+
+    aid2 = Hstartwrite(fid, 100, 1, 4);
+    if (aid2 == FAIL)
+      {
+          fprintf(stderr, "ERROR: was not allowed to startwrite on existing object\n");
+          errors++;
+      }
+
+    ret = Hwrite(aid1, 4, "ABCD");
+    if (ret != FAIL)
+      {
+          fprintf(stderr, "ERROR: was allowed to write to read access object\n");
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    ret = Hendaccess(aid2);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Attempting to gain multiple access to file (is allowed)\n");
+        );
+    fid1 = Hopen(TESTFILE_NAME, DFACC_READ, 0);
+    if (fid1 == FAIL)
+      {
+          fprintf(stderr, "ERROR: Failed to have two concurrent access to file\n");
+          errors++;
+      }
+
+    ret = (int32)Hnewref(fid1);
+    CHECK_VOID(ret, FAIL, "Hnewref");
+
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    ret = Hclose(fid1);
+    CHECK_VOID(ret, FAIL, "Hclose");
+
+    ret_bool = (intn) Hishdf(TESTFILE_NAME);
+    CHECK_VOID(ret_bool, FALSE, "Hishdf");
+
+    ret_bool = (intn) Hishdf(__FILE__);
+    CHECK_VOID(ret_bool, TRUE, "Hishdf");
+
+    ret_bool = (intn) Hishdf("qqqqqqqq.qqq");   /* I sure hope it isn't there */
+    CHECK_VOID(ret, TRUE, "Hishdf");
+
+}
diff --git a/hdf/test/file1.c b/hdf/test/file1.c
new file mode 100644
index 0000000..e5bbefa
--- /dev/null
+++ b/hdf/test/file1.c
@@ -0,0 +1,241 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: file1.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*
+   test opening files and access elements until limits are reached
+ */
+
+#include "tproto.h"
+#include "hfile.h"
+#define BIG 600
+#define TESTFILE_NAME "thf"
+#define TESTREF_NAME "tref.hdf"
+#define     MAX_REF_TESTED MAX_REF
+static int32  files[BIG];
+static int32  accs[BIG];
+
+static void test_file_limits(void);
+static void test_ref_limits(void);
+
+static void
+test_file_limits(void)
+{
+    int         i;
+    int32       ret;
+
+    MESSAGE(5, puts("Opening many files of same name");
+        );
+    for (i = 0; i < BIG; i++)
+      {
+          files[i] = Hopen("thf.hdf", DFACC_RDWR, 0);
+          if (files[i] < 0)
+            {
+/*            i++; */
+              break;
+            } /* end if */
+      }
+    MESSAGE(5, printf("Opening stopped at %d/%d files\n", i, BIG);
+        );
+
+    MESSAGE(5, puts("Closing all files");
+        );
+    for (i--; i >=0; i--)
+      {
+          ret = Hclose(files[i]);
+          if (ret < 0)
+              printf("Error closing file %d\n", i);
+      }
+    MESSAGE(5, puts("Closed files");
+        );
+
+    MESSAGE(5, puts("Opening many files of different names");
+        );
+    for (i = 0; i < BIG; i++)
+      {
+          char        fname[100];
+          sprintf(fname, "%s%1d.hdf", TESTFILE_NAME, i);
+          files[i] = Hopen(fname, DFACC_ALL, 0);
+          if (files[i] < 0)
+            {
+/*            i++; */
+              break;
+            } /* end if */
+      }
+    MESSAGE(5, printf("Opening stopped at %d/%d files\n", i, BIG);
+        );
+
+    MESSAGE(5, puts("Closing all files except first open");
+        );
+    for (i--; i > 0; i--)
+      {
+          ret = Hclose(files[i]);
+          if (ret < 0)
+              printf("Error closing file %d\n", i);
+      }
+    MESSAGE(5, puts("Closed files");
+        );
+
+    MESSAGE(5, puts("Opening write access elements");
+        );
+    for (i = 0; i < BIG; i++)
+      {
+          accs[i] = Hstartwrite(files[0], (uint16) 100, (uint16) i, 100L);
+          if (accs[i] < 0)
+              break;
+      }
+    MESSAGE(5, printf("Opening stoped at %d element\n", i);
+        );
+
+    MESSAGE(5, puts("Closing access elements");
+        );
+    for (i--; i >= 0; i--)
+      {
+          ret = Hendaccess(accs[i]);
+          if (ret < 0)
+              printf("Error ending access %d\n", i);
+      }
+    MESSAGE(5, puts("Ended access");
+        );
+
+    ret = Hclose(files[0]);
+} /* end test_file_limits() */
+
+#define TAG1    ((uint16)1000)
+#define TAG2    ((uint16)1001)
+
+static void
+test_ref_limits(void)
+{
+    int32 i;                /* local counting variable */
+    int32 fid;              /* file ID */
+    int32 iloop;
+
+    MESSAGE(6, printf("Testing reference # limits\n"););
+    MESSAGE(7, printf("Writing out data\n"););
+    /* Write out MAX_REF number of data items for each tag */
+    fid=Hopen(TESTREF_NAME, DFACC_CREATE, 512);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    if(fid!=FAIL)
+      {
+          iloop = MAX_REF_TESTED;
+          for(i=1; i<=(iloop/2)+5; i++)
+            {
+                int32 aid;
+                uint16 ref;
+                int32 data;
+                int32 ret;
+
+                /* Write out data to tag1 */
+                ref=Htagnewref(fid,TAG1);
+                CHECK_VOID(ref, 0, "Htagnewref");
+                aid=Hstartwrite(fid,TAG1,ref,sizeof(int32));
+                CHECK_VOID(aid, FAIL, "Hstartwrite");
+                data=(int32)ref;
+                ret=Hwrite(aid,sizeof(int32),&data);
+                CHECK_VOID(ret, FAIL, "Hwrite");
+                ret=Hendaccess(aid);
+                CHECK_VOID(ret, FAIL, "Hendaccess");
+
+                /* lets be a little smatter here */
+                if (ret == FAIL)
+                    break;
+
+                /* Write out data to tag2 */
+                ref=Htagnewref(fid,TAG2);
+                CHECK_VOID(ref, 0, "Htagnewref");
+                aid=Hstartwrite(fid,TAG2,ref,sizeof(int32));
+                CHECK_VOID(aid, FAIL, "Hstartwrite");
+                data=ref<<16;
+                ret=Hwrite(aid,sizeof(int32),&data);
+                CHECK_VOID(ret, FAIL, "Hwrite");
+                ret=Hendaccess(aid);
+                CHECK_VOID(ret, FAIL, "Hendaccess");
+                /* lets be a little smatter here */
+                if (ret == FAIL)
+                    break;
+
+            } /* end for */
+          Hclose(fid);
+
+        MESSAGE(7, printf("Verifying data\n"););
+        
+        /* Check the data written earlier */
+        fid=Hopen(TESTREF_NAME, DFACC_READ, 0);
+        CHECK_VOID(fid, FAIL, "Hopen");
+
+        if(fid!=FAIL)
+          {
+              uint16 ref;
+              int32 aid1,aid2;
+              int32 data;
+              int32 ret;
+
+              /* Read in data from tag1 */
+              aid1=Hstartread(fid,TAG1,DFREF_WILDCARD);
+              CHECK_VOID(aid1, FAIL, "Hstartread");
+              ret=Hread(aid1,sizeof(int32),&data);
+              CHECK_VOID(ret, FAIL, "Hread");
+              ret=Hinquire(aid1,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+              CHECK_VOID(ret, FAIL, "Hinquire");
+              VERIFY_VOID((uint16)data,ref,"Hread");
+
+              /* Read in data from tag2 */
+              aid2=Hstartread(fid,TAG2,DFREF_WILDCARD);
+              CHECK_VOID(aid2, FAIL, "Hstartread");
+              ret=Hread(aid2,sizeof(int32),&data);
+              CHECK_VOID(ret, FAIL, "Hread");
+              ret=Hinquire(aid2,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+              CHECK_VOID(ret, FAIL, "Hinquire");
+              VERIFY_VOID((uint32)data,(((uint32)ref)<<16),"Hread");
+
+              while(Hnextread(aid1,TAG1,DFTAG_WILDCARD,DF_CURRENT)!=FAIL)
+                {
+                    ret=Hread(aid1,sizeof(int32),&data);
+                    CHECK_VOID(ret, FAIL, "Hread");
+                    ret=Hinquire(aid1,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+                    CHECK_VOID(ret, FAIL, "Hinquire");
+                    VERIFY_VOID((uint16)data,ref,"Hread");
+
+                  if(Hnextread(aid2,TAG2,DFTAG_WILDCARD,DF_CURRENT)!=FAIL)
+                    {
+                        ret=Hread(aid2,sizeof(int32),&data);
+                        CHECK_VOID(ret, FAIL, "Hread");
+                        ret=Hinquire(aid2,NULL,NULL,&ref,NULL,NULL,NULL,NULL,NULL);
+                        CHECK_VOID(ret, FAIL, "Hinquire");
+                        VERIFY_VOID((uint32)data,(((uint32)ref)<<16),"Hread");
+                    } /* end while */
+                } /* end while */
+              ret=Hendaccess(aid1);
+              CHECK_VOID(ret, FAIL, "Hendaccess");
+
+              ret=Hendaccess(aid2);
+              CHECK_VOID(ret, FAIL, "Hendaccess");
+
+              Hclose(fid);
+          } /* end if */
+      } /* end if */
+} /* end test_ref_limits() */
+
+void
+test_hfile1(void)
+{
+    test_file_limits();
+    test_ref_limits();
+}
diff --git a/hdf/test/forsupf.c b/hdf/test/forsupf.c
new file mode 100644
index 0000000..5cbe6b5
--- /dev/null
+++ b/hdf/test/forsupf.c
@@ -0,0 +1,105 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 6036 $";
+#endif
+
+/* $Id: forsupf.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+#include "hdf.h"
+#include "fortest.h"
+
+/*-----------------------------------------------------------------------------
+ * Name:    getverb
+ * Purpose: Get the verbosity from the "HDF_VERBOSITY" environment variable
+ *          and return it to the FORTRAN calling routine.
+ * Inputs:  NONE
+ * Returns: verbosity level on success, FAIL on failure
+ * Users:   HDF Fortran programmers
+ * Invokes: HDgetenv
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+ngetverb(void)
+{
+    char *verb_str;
+    intn verb_level=FAIL;
+    verb_str=HDgetenv(FOR_VERB);
+
+    if(verb_str!=NULL)
+        verb_level=(intn)HDstrtol(verb_str,NULL,0); /* convert whole string using base 10 */
+    return((intf)verb_level);
+}   /* end getverb() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    hisystem
+ * Purpose: Invoke the system call to execute cmd
+ * Inputs:  cmd -- the command to execute
+ *          cmdlen -- command length
+ * Returns: Code returned by the system call
+ * Users:   HDF Fortran programmers
+ * Invokes: system
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nhisystem(_fcd cmd, intf *cmdlen)
+{
+    char       *fn;
+    intf        ret;
+
+    fn = HDf2cstring(cmd, (intn) *cmdlen);
+    if (!fn) return(FAIL);
+    ret = (intf) system(fn);
+    HDfree(fn);
+    return (ret);
+}   /* end nhisystem() */
+
+/*-----------------------------------------------------------------------------
+ * Name:    fixname
+ * Purpose: Fix name for srcdir build and test
+ * Inputs:  IN: name - original namea 
+ *          IN: name_len - name length
+ *          IN/OUT: name_out - buffer to hold modified name
+ *          IN/OUT: name_out_len - length of the buffer, and length of modified
+ *                  string. 
+ * Returns: 0 on success and -1 on failure  
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+FRETVAL(intf)
+nfixnamec(_fcd name, intf *name_len, _fcd name_out, intf *name_len_out)
+{
+    char       *c_name;
+    intf        ret;
+
+    char    testfile[1024] = "";
+    char   *srcdir = getenv("srcdir");
+
+    c_name = HDf2cstring(name, (intn) *name_len);
+    if (!c_name) return(FAIL);
+
+    /* Here comes Bill's code */
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(c_name) + 1) < sizeof(testfile))) {
+        strcpy(testfile, srcdir);
+        strcat(testfile, "/");
+    }
+    strcat(testfile, c_name);
+    *name_len_out = (intf) strlen(testfile);
+    HDpackFstring(testfile, _fcdtocp(name_out), *name_len_out);
+ 
+    ret = 0;
+    HDfree(c_name);
+    return (ret);
+}   /* end nfixname() */
diff --git a/hdf/test/forsupff.f b/hdf/test/forsupff.f
new file mode 100644
index 0000000..f84fc05
--- /dev/null
+++ b/hdf/test/forsupff.f
@@ -0,0 +1,326 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+C $Id: forsupff.f 6036 2014-01-20 17:28:01Z acheng $
+C
+C------------------------------------------------------------------------------
+C File:     forsupff.f
+C Purpose:  Fortran support routines for Fortran test routines
+C Invokes:  Nothing currently...
+C Contents: 
+C Remarks: none
+C------------------------------------------------------------------------------
+
+
+C------------------------------------------------------------------------------
+C Name: RESULT
+C Purpose:  Report on success of HDF routines
+C Inputs:   
+C       errval: value to check for error
+C       routine: name of routine tested
+C       num_failed: running sum of the number of failures
+C Returns: none
+C Users:    HDF Fortran programmers
+C Invokes: none
+C------------------------------------------------------------------------------
+      subroutine RESULT(errval, routine, num_failed)
+      implicit none
+      include '../src/hdf.inc'
+      include 'fortest.inc'
+
+      integer errval
+      character*(*)  routine
+      integer num_failed
+
+      if (errval .eq. FAIL) then
+          num_failed = num_failed + 1
+          print *, '    >>> ', routine, ' FAILED: ret = ',
+     *           errval, '    <<<'
+      else 
+          print *, routine, ' SUCCESSFUL'
+      endif
+
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: VRFY
+C Purpose:  Report on success of HDF routines, using verbosity
+C Inputs:   
+C       errval: value to check for error
+C       routine: name of routine tested
+C       num_failed: running sum of the number of failures
+C Returns: none
+C Users:    HDF Fortran programmers
+C Invokes: none
+C------------------------------------------------------------------------------
+      subroutine VRFY(errval, routine, num_failed)
+      implicit none
+      include '../src/hdf.inc'
+      include 'fortest.inc'
+
+      integer errval
+      character*(*)  routine
+      integer num_failed
+
+      if (errval .eq. FAIL) then
+          num_failed = num_failed + 1
+          print *, '    >>> ', routine, ' FAILED: ret = ',
+     *           errval, '    <<<'
+      else 
+          if (verbosity .ge. VERBO_HI) then
+              print *, routine, ' SUCCESSFUL'
+          endif
+      endif
+
+      return
+      end
+
+C------------------------------------------------------------------------------
+C Name: MESSAGE
+C Purpose:  Print something, depending on the verbosity level
+C Inputs:   
+C       priority: priority of message (lower values have higher priority)
+C       out_str: string to output
+C Returns: none
+C Users:    HDF Fortran programmers
+C Invokes: none
+C------------------------------------------------------------------------------
+      subroutine MESSAGE(priority, out_str)
+      implicit none
+      include 'fortest.inc'
+
+      integer priority
+      character*(*)  out_str
+
+      if (priority .le. Verbosity) then
+          print *, out_str
+      endif
+
+      return
+      end
+
+
+C***************************************************************
+C
+C  gen2Dfloat:  generate 2-D data array 
+C
+C***************************************************************
+      subroutine gen2Dfloat(height, width, data)
+      implicit none
+      include 'fortest.inc'
+
+      integer   height, width
+      real data(height,width)
+
+      integer i, j
+
+C     store one value per row, increasing by one for each row 
+      do 110 i=1, height
+          do 100 j=1, width
+             data(i, j) = float(i)
+  100     continue
+  110 continue
+      return
+      end
+
+
+C***************************************************************
+C
+C  genimage:  generate image from 2-D float array
+C
+C***************************************************************
+      subroutine genimage(height, width, data, image)
+      implicit none
+      include 'fortest.inc'
+
+      integer   height, width
+      real      data(height, width)
+      character image(height, width)
+
+      integer i, j
+      real   max, min, multiplier
+
+      max = data(1,1)
+      min = data(1,1)
+      do 110 i=1, height
+          do 100 j=1, width
+             if (max .gt. data(i,j)) max = data(i,j)
+             if (min .lt. data(i,j)) min = data(i,j)
+  100     continue
+  110 continue
+
+C     store one value per row, increasing by one for each row 
+      multiplier = 255.0 /(max-min)
+      do 210 i=1, height
+          do 200 j=1, width
+             image(i,j) = char( int((data(i,j)-min) * multiplier) )
+  200     continue
+  210 continue
+      return 
+      end
+
+
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+C
+C     SUBROUTINE errchkio
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine errchkio(err1, err2, err3, num_err, msg)
+      implicit none
+      include '../src/hdf.inc'
+      include 'fortest.inc'
+
+      integer err1, err2, err3, num_err
+      character*(*)  msg
+
+      if (err1.eq.FAIL .or. err2.eq.FAIL .or. err3.eq.FAIL) then
+          num_err = num_err + 1
+          print *
+          print *,'>>> Test failed for ',msg, ' <<<'
+          print *, '  err1=',err1, '   err2=',err2, '   err3=',err3
+      else
+          if (verbosity .ge. VERBO_HI) then
+            print *,'Test passed for ', msg
+          endif
+      endif
+
+      return
+      end
+
+      
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+C
+C     SUBROUTINE errchkarr
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine errchkarr(err1, err2, err3, num_err, type)
+      implicit none
+      include 'fortest.inc'
+
+      integer err1, err2, err3, num_err
+      character*(*)  type
+      
+      if (err1 .eq. 1) then
+        print *, '>>> Test failed for ', type, ' array' 
+        num_err = num_err + 1
+      else
+          if (verbosity .ge. VERBO_HI) then
+            print *, 'Test passed for ', type, ' array'
+          endif
+      endif
+
+      if (err2 .eq. 1) then
+        print *, '>>> Test failed for ',type, ' scales.'
+        num_err = num_err + 1
+      else
+          if (verbosity .ge. VERBO_HI) then
+            print *, 'Test passed for ', type, ' scales.'
+          endif
+      endif
+
+      if (err3 .eq. 1) then
+        print *, '>>> Test failed for ', type, ' max/min.'
+        num_err = num_err + 1
+      else
+          if (verbosity .ge. VERBO_HI) then
+            print *, 'Test passed for ', type, ' max/min.'
+          endif
+      endif
+
+      return
+      end
+
+       
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+C
+C     SUBROUTINE err_check
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine err_check(err, num_err, type)
+      implicit none
+      include 'fortest.inc'
+
+      integer err, num_err
+      character*(*) type
+
+      if (err .eq. 1) then 
+        print *,'>>> Test failed for ',type, ' array.'
+        num_err = num_err+1
+      else
+          if (verbosity .ge. VERBO_HI) then
+            print *,'Test passed for ', type, ' array.'
+          endif
+      endif
+
+      return
+      end
+
+
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+C
+C     SUBROUTINE ptestban
+C     Print the Test banner
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine ptestban(action, name)
+      implicit none
+      include 'fortest.inc'
+
+      character*(*) action, name
+
+      if (Verbosity .ge. VERBO_DEF) then
+      call MESSAGE(VERBO_LO,
+     +     '=====================================')
+      print *, action, ' -- ', name
+      call MESSAGE(VERBO_LO,
+     +     '=====================================')
+      endif
+
+      return
+      end
+
+
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+C
+C     SUBROUTINE hsystem(cmd)
+C     Invoke the unix system() function
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine hsystem(cmd)
+      implicit none
+
+      character*(*) cmd
+      integer retcode, hisystem
+
+      retcode = hisystem(cmd, len(cmd))
+      return
+      end
+
+
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+C
+C     SUBROUTINE fixname(name, name_out, name_out_len)
+C     Takes care of srcdir build
+C
+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
+      subroutine fixname(name, name_out, name_out_len)
+      implicit none
+
+      character*(*)  name
+      character*(*)  name_out
+      integer retcode, fixnamec, name_out_len
+
+      retcode = fixnamec(name, len(name), name_out, name_out_len)
+      return
+      end
diff --git a/hdf/test/fortest.c b/hdf/test/fortest.c
new file mode 100644
index 0000000..35133ab
--- /dev/null
+++ b/hdf/test/fortest.c
@@ -0,0 +1,235 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6036 $";
+#endif
+
+/* $Id: fortest.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+#define TESTMASTER
+
+#include "hdf.h"
+#include "tutils.h"
+#include "fortest.h"
+#define NUMOFTESTS 20
+
+static int InitTest(const char *TheName, const char *TheCall, const char *TheDescr);
+
+struct TestStruct
+  {
+      int         NumErrors;
+      char        Description[64];
+      int         SkipFlag;
+      char        Name[16];
+      char        Call[20];
+  }
+Test[NUMOFTESTS];
+
+static int
+InitTest(const char *TheName, const char *TheCall, const char *TheDescr)
+{
+    static int  Index = 0;
+
+    if (Index >= NUMOFTESTS){
+	printf("*** Too many tests.  Need to increase NUMOFTESTS (%d).\n",
+		NUMOFTESTS);
+	printf("\tRequest (%s) ignored.\n", TheName);
+    } else {
+	HDstrcpy(Test[Index].Description, TheDescr);
+	HDstrcpy(Test[Index].Name, TheName);
+	HDstrcpy(Test[Index].Call, TheCall);
+	Test[Index].NumErrors = -1;
+	Test[Index].SkipFlag = 0;
+	Index++;
+    }
+    return(Index);
+}
+
+int
+main(int argc, char *argv[])
+{
+    int         CLLoop;         /* Command Line Loop */
+    int         Loop, Loop1;
+    int         Summary = 0;
+    int         CleanUp = 1;
+    int         num_tests=0;
+    FILE	*cmdfile;
+    const char	*cmdfilename="fortest.arg";
+
+
+    printf(" ===========================================\n");
+    printf(" HDF Library Fortran Interface Tests Setup\n");
+    printf(" ===========================================\n");
+
+    num_tests=InitTest("slab", "slabwf", "");
+    num_tests=InitTest("r24", "t24f", "");
+    num_tests=InitTest("an", "tanf", "");
+    num_tests=InitTest("anfile", "tanfilef", "");
+    num_tests=InitTest("manf", "manf", "");
+    num_tests=InitTest("mgrf", "mgrf", "");
+    num_tests=InitTest("p", "tpf", "");
+    num_tests=InitTest("r8", "tr8f", "");
+    num_tests=InitTest("sdmms", "tsdmmsf", "");
+    num_tests=InitTest("sdnmms", "tsdnmmsf", "");
+    num_tests=InitTest("sdnnt", "tsdnntf", "");
+    num_tests=InitTest("sdnt", "tsdntf", "");
+    num_tests=InitTest("sdstr", "tsdstrf", "");
+    num_tests=InitTest("vsetf", "tvsetf", "");
+    num_tests=InitTest("vsetblock", "tvsetblock", "");
+    num_tests=InitTest("vgroups", "tvgroups", "");
+    num_tests=InitTest("vattrf", "tvattrf", "");
+/* The test is skipped when size of fortran integer is smaller than
+   the size of C pointer; this happens on the 64-bit DEC Alpha, Solaris, Altix
+   AIX and Mac Intel. We need a better fix; see Bugzilla #1694.
+*/ 
+#if defined DEC_ALPHA || defined _WIN32 || (defined SUN && defined _LP64) || defined __ia64  || defined __x86_64  || defined AIX5L64 || (__APPLE__ && __LP64__)
+    printf("   Skipping stubs\n");
+#else
+    num_tests=InitTest("stubs", "tstubsf", "");
+#endif
+
+    if ((cmdfile = fopen(cmdfilename, "w")) == NULL){
+	printf("***Can't write to cmdfile(%s)***\n", cmdfilename);
+	return(-1);
+    }
+
+    /* Default setting */
+    Verbosity = 3;  /* Default Verbosity is Low */
+    /* setup Cleanup Command */
+    fprintf(cmdfile, "%s %s\n", CLEAN_STR, CLEAN_CMD);
+
+    for (CLLoop = 1; CLLoop < argc; CLLoop++)
+      {
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-v") == 0)))
+            {
+                if (argv[CLLoop + 1][0] == 'l')
+                    Verbosity = 5;
+                else if (argv[CLLoop + 1][0] == 'm')
+                    Verbosity = 7;
+                else if (argv[CLLoop + 1][0] == 'h')
+                    Verbosity = 9;
+                else
+                    Verbosity = atoi(argv[CLLoop + 1]);
+		fprintf(cmdfile, "%s %d\n", VERBOSITY_STR, Verbosity);
+            }
+          if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-summary") == 0) ||
+                                  (HDstrcmp(argv[CLLoop], "-s") == 0)))
+            {
+                Summary = 1;
+            }
+          if ((argc > CLLoop) && (HDstrcmp(argv[CLLoop], "-help") == 0))
+            {
+                printf("Usage: fortest [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] \n");
+                printf("               [-[e]x[clude] name+] \n");
+                printf("               [-o[nly] name+] \n");
+                printf("               [-b[egin] name] \n");
+                printf("               [-s[ummary]]  \n");
+                printf("               [-c[leanno]]  \n");
+                printf("\n\n");
+                printf("verbose   controls the amount of information displayed\n");
+                printf("exclude   to exclude tests by name\n");
+                printf("only      to name tests which should be run\n");
+                printf("begin     start at the name of the test givin\n");
+                printf("summary   prints a summary of test results at the end\n");
+                printf("cleanno   does not delete *.hdf files after execution of tests\n");
+                printf("\n\n");
+                printf("This program currently tests the following: \n\n");
+                printf("%16s %s\n", "Name", "Description");
+                printf("%16s %s\n", "----", "-----------");
+                for (Loop = 0; Loop < num_tests; Loop++)
+                  {
+                      printf("%16s %s\n", Test[Loop].Name, Test[Loop].Description);
+                  }
+                printf("\n\n");
+                exit(0);
+            }
+          if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-cleanno") == 0) ||
+                                  (HDstrcmp(argv[CLLoop], "-c") == 0)))
+            {
+                CleanUp = 0;
+		fprintf(cmdfile, "%s %s\n", CLEAN_STR, "No");
+            }
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-exclude") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-x") == 0)))
+            {
+                Loop = CLLoop + 1;
+                while ((Loop < argc) && (argv[Loop][0] != '-'))
+                  {
+                      for (Loop1 = 0; Loop1 < num_tests; Loop1++)
+                        {
+                            if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
+                                Test[Loop1].SkipFlag = 1;
+                        }
+                      Loop++;
+                  }
+            }
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-begin") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-b") == 0)))
+            {
+                Loop = CLLoop + 1;
+                while ((Loop < argc) && (argv[Loop][0] != '-'))
+                  {
+                      for (Loop1 = 0; Loop1 < num_tests; Loop1++)
+                        {
+                            if (HDstrcmp(argv[Loop], Test[Loop1].Name) != 0)
+                                Test[Loop1].SkipFlag = 1;
+                            if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
+                                Loop1 = num_tests;
+                        }
+                      Loop++;
+                  }
+            }
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-only") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-o") == 0)))
+            {
+                for (Loop = 0; Loop < num_tests; Loop++)
+                  {
+                      Test[Loop].SkipFlag = 1;
+                  }
+                Loop = CLLoop + 1;
+                while ((Loop < argc) && (argv[Loop][0] != '-'))
+                  {
+                      for (Loop1 = 0; Loop1 < num_tests; Loop1++)
+                        {
+                            if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
+                                Test[Loop1].SkipFlag = 0;
+                        }
+                      Loop++;
+                  }
+            }
+      }
+
+    for (Loop = 0; Loop < num_tests; Loop++)
+      {
+          if (Test[Loop].SkipFlag)
+            {
+		fprintf(cmdfile, "%s %s\n", SKIP_STR, Test[Loop].Name);
+            }
+          else
+            {
+		fprintf(cmdfile, "%s %s\n", TEST_STR, Test[Loop].Name);
+            }
+      }
+
+    fclose(cmdfile);
+
+    /* flush stdout to gurantee output preceed those of fortestF */
+    fflush(stdout);
+
+#  ifndef CMAKE_INTDIR /* not built with cmake */
+    return (system("./fortestF"));
+#  else
+    return 0; /*(system("./fortestF"));*/
+#  endif
+}
diff --git a/hdf/test/fortest.h b/hdf/test/fortest.h
new file mode 100644
index 0000000..f4f1db3
--- /dev/null
+++ b/hdf/test/fortest.h
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: fortest.h 5444 2010-08-25 16:40:05Z byrn $ */
+
+#ifndef __FORTEST_H
+#define __FORTEST_H
+
+#include "H4api_adpt.h"
+#include "hdf.h"
+
+/* Verbosity Environment Variable */
+#define FOR_VERB    "HDF_FOR_VERBOSITY"
+
+#  define ngetverb      H4_F77_FUNC(getverb, GETVERB)
+#  define nhisystem     H4_F77_FUNC(hisystem, HISYSTEM)
+#  define nfixnamec     H4_F77_FUNC(fixnamec, FIXNAMEC) 
+
+/* FORTRAN support C-stubs for FORTRAN interface tests */
+
+HDFFCLIBAPI FRETVAL(intf) ngetverb(void);
+HDFFCLIBAPI FRETVAL(intf) nhisystem(_fcd cmd, intf *cmdlen);
+HDFFCLIBAPI FRETVAL(intf) nfixnamec(_fcd name, intf *name_len, _fcd name_out, intf *name_len_out);
+
+#endif /* __FORTEST_H */
+
diff --git a/hdf/test/fortest.inc b/hdf/test/fortest.inc
new file mode 100644
index 0000000..ac2bfa2
--- /dev/null
+++ b/hdf/test/fortest.inc
@@ -0,0 +1,51 @@
+C $Id: fortest.inc 6034 2014-01-19 06:59:14Z epourmal $
+C Common block definiton to be included by fortestF.f modules.  If your
+C fortran compile cannot do include, you need to replace each include
+C statement with this file.
+
+       common CleanUp, Verbosity, CleanUpCMD
+       logical CleanUp
+       character*80 CleanUpCMD
+       integer Verbosity
+C
+C Predefined verbosity levels.
+C
+C Convention:
+C 
+C The higher the verbosity value, the more information printed.
+C So, output for higher verbosity also include output of all lower
+C verbosity.
+C 
+C     Value Description
+C     0  None:No informational message.
+C     1  "All tests passed"
+C     2  Header of overall test
+C     3  Default: header and results of individual test
+C     4
+C     5  Low:Major category of tests.
+C     6
+C     7  Medium: Minor category of tests such as functions called.
+C     8
+C     9High: Highest level.  All information.
+
+      integer VERBO_NONE, VERBO_DEF, VERBO_LO, VERBO_MED, VERBO_HI
+      parameter (
+     + VERBO_NONE = 0,
+     + VERBO_DEF  = 3,
+     + VERBO_LO   = 5,
+     + VERBO_MED  = 7,
+     + VERBO_HI   = 9
+     +)
+
+      integer FALSE, TRUE
+      parameter (
+     + FALSE = 0,
+     + TRUE = 1
+     +)
+
+C Tests command file parameters.
+C cmdf: file unit number
+      integer      cmdf
+      character*30 cmdfilename
+      parameter (cmdf = 1)
+      parameter (cmdfilename = 'fortest.arg')
diff --git a/hdf/test/fortest.sav b/hdf/test/fortest.sav
new file mode 100644
index 0000000..943a8f2
--- /dev/null
+++ b/hdf/test/fortest.sav
@@ -0,0 +1,734 @@
+ \n  Writing the first 3 of 5 slabs to slab1wf.hdf
+  >>> All tests passed for slab1wf, run slab2wf <<< 
+  
+ \n   Writing the last 2 of 5 slabs to slab1wf.hdf
+    Verifying data 
+   >>> All tests passed <<< \n 
+  
+ Writing all 24 elements of data as slabs to slab3wf.hdf
+    Verifying data 
+   >>> All tests passed <<< \n
+  
+ Writing data as 1 slab to slab4wf.hdf
+    Verifying data 
+   >>> All tests passed <<< \n
+ \n   Writing data as 5 slabs to slabwf.hdf
+    Verifying data 
+   >>> All tests passed <<< \n
+ Setting il to 0
+ d2setil SUCCESSFUL
+  Putting buffer 1
+ d2pimg SUCCESSFUL
+ Setting il to 1
+ d2setil SUCCESSFUL
+ Adding buf1
+ d2aimg SUCCESSFUL
+ Setting il to 2
+ d2setil SUCCESSFUL
+ Adding buf2
+ d2aimg SUCCESSFUL
+ Restarting file
+ d2first SUCCESSFUL
+ Req il 0
+ d2reqil SUCCESSFUL
+ Getting dims
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 0
+ Getting image
+ d2gimg SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 1
+ Getting image
+ d2gimg SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 2
+ Getting image
+ d2gimg SUCCESSFUL
+ Restarting file
+ d2first SUCCESSFUL
+ Req il 1
+ d2reqil SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 0
+ Getting image
+ d2gimg SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 1
+ Getting image
+ d2gimg SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 2
+ Getting image
+ d2gimg SUCCESSFUL
+ Restarting file
+ d2first SUCCESSFUL
+ Req il 2
+ d2reqil SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 0
+ Getting image
+ d2gimg SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 1
+ Getting image
+ d2gimg SUCCESSFUL
+ Getting dimensions
+ d2gdims SUCCESSFUL
+ d1: 2 d2: 2 il: 2
+ Getting image
+ d2gimg SUCCESSFUL
+ 
+
+
+ ****** ALL TESTS SUCCESSFUL ******
+ dssdims SUCCESSFUL
+ ***  Writing labels & descriptions with SDS and RIS ***
+ dsadata SUCCESSFUL
+ daplab SUCCESSFUL
+ dapdesc SUCCESSFUL
+ d8aimg SUCCESSFUL
+ daplab SUCCESSFUL
+ dapdesc SUCCESSFUL
+ dsadata SUCCESSFUL
+ daplab SUCCESSFUL
+ dapdesc SUCCESSFUL
+ d8aimg SUCCESSFUL
+ daplab SUCCESSFUL
+ dapdesc SUCCESSFUL
+ 
+
+
+ *** Reading labels and descriptions for SDS and RIS ***
+ dsgdims SUCCESSFUL
+ dagllen SUCCESSFUL
+ daglab SUCCESSFUL
+ dagdlen SUCCESSFUL
+ dagdesc SUCCESSFUL
+ d8gimg SUCCESSFUL
+ dagllen SUCCESSFUL
+ daglab SUCCESSFUL
+ dagdlen SUCCESSFUL
+ dagdesc SUCCESSFUL
+ dsgdims SUCCESSFUL
+ dagllen SUCCESSFUL
+ daglab SUCCESSFUL
+ dagdlen SUCCESSFUL
+ dagdesc SUCCESSFUL
+ d8gimg SUCCESSFUL
+ dagllen SUCCESSFUL
+ daglab SUCCESSFUL
+ dagdlen SUCCESSFUL
+ dagdesc SUCCESSFUL
+ 
+
+
+ ***** ALL TESTS SUCCESSFUL ***** 
+ ****** Write file labels *******
+ hopen  SUCCESSFUL
+ daafid  SUCCESSFUL
+ daafid  SUCCESSFUL
+ ****** Write file descriptions *******
+ daafds  SUCCESSFUL
+ daafds  SUCCESSFUL
+ hclose  SUCCESSFUL
+ ****** Read length of the first file label ****
+ hopen-read  SUCCESSFUL
+ dagfidl  SUCCESSFUL
+ ******...followed by the label *****
+ dagfid  SUCCESSFUL
+ ****** Read length of the second file label ****
+ dagfidl  SUCCESSFUL
+ ******...followed by the label *****
+ dagfid  SUCCESSFUL
+ ****** Read length of the first file description ****
+ dagfdsl  SUCCESSFUL
+ ******...followed by the description *****
+ dagfds  SUCCESSFUL
+ ****** Read length of the second file description ****
+ dagfdsl  SUCCESSFUL
+ ******...followed by the description *****
+ dagfds  SUCCESSFUL
+ hclose  SUCCESSFUL
+ 
+
+
+ ***** ALL TESTS SUCCESSFUL ******
+ dssdims SUCCESSFUL
+ afstart SUCCESSFUL
+ affcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ affcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ affcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ affcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ ***  Writing labels & descriptions with SDS and RIS ***
+ dsadata SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ d8aimg SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ dsadata SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ d8aimg SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afcreate SUCCESSFUL
+ afwriteann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ 
+
+
+ *** Reading labels and descriptions for SDS and RIS ***
+ dsgdims SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ d8gimg SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ dsgdims SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ d8gimg SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afnumann SUCCESSFUL
+ afnumann SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlist SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ 
+
+
+ *** Reading file labels and descriptions ***
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afselect SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afselect SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ afstart SUCCESSFUL
+ affileinfo SUCCESSFUL
+ afselect SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afselect SUCCESSFUL
+ afannlen SUCCESSFUL
+ afreadann SUCCESSFUL
+ afendaccess SUCCESSFUL
+ afend SUCCESSFUL
+ 
+
+
+ ***** ALL TESTS SUCCESSFUL ***** 
+ Putting pal1 in new file.
+ dpppal  SUCCESSFUL
+ Getting ref1
+ ref1 is  2
+ Putting pal2 in file
+ dpapal  SUCCESSFUL
+ Getting ref2
+ ref2 is  3
+ Restarting palette interface
+ dprest  SUCCESSFUL
+ Reading pal1
+ dpgpal  SUCCESSFUL
+ Getting ref1
+ Last ref is  2
+ Reading pal2.
+ dpgpal  SUCCESSFUL
+ Getting ref2
+ Last ref is  3
+ Getting number of palettes
+ dpnpals  SUCCESSFUL
+ Number of palettes is: 2
+ Setting read ref to ref2.
+ dprref  SUCCESSFUL
+ Reading pal2
+ dpgpal  SUCCESSFUL
+ Setting read ref to ref1.
+ ref1 is:  2 ref2 is:  3
+ dprref  SUCCESSFUL
+ Reading pal1
+ dpgpal  SUCCESSFUL
+ Modifying pal1
+ Setting write ref to ref1
+ dpwref  SUCCESSFUL
+ Writing pal1
+ dpppal  SUCCESSFUL
+ last ref is:  2
+ setting read ref to ref1
+ dprref  SUCCESSFUL
+ Reading pal1
+ dpgpal  SUCCESSFUL
+ 
+
+
+ ***** ALL TESTS SUCCESSFUL *****
+ Setting palette 1
+ d8spal  SUCEESSFUL
+ Putting image 1 with pal 1, no compression
+ d8pimg  SUCEESSFUL
+ Getting ref1
+ ref1 is  2
+ Putting image 2 with pal 1, REL compression
+ d8aimg  SUCEESSFUL
+ Getting ref2
+ ref2 is  3
+ Setting palette 2
+ d8spal  SUCEESSFUL
+ Putting image 2 with pal 2, IMCOMP  compression
+ d8aimg  SUCEESSFUL
+ Getting ref3
+ ref3 is  4
+ Getting number of images
+ 3 images in the file
+ Restarting file
+ d8first  SUCEESSFUL
+ Getting dimensions of first image
+ d8gdims  SUCEESSFUL
+ Getting image 1
+ d8gimg  SUCEESSFUL
+ Checking image and palette
+ Image is correct
+ Palette is correct
+ Getting dimensions of image2
+ d8gdims  SUCEESSFUL
+ d1=  321 d2=  111 ispal=  1
+ Getting dimensions of image 3
+  d8gdims  SUCEESSFUL
+ d1=  321 d2=  111 ispal=  1
+ Getting image 3
+ d8gimg  SUCEESSFUL
+ setting read ref2
+ d8rref  SUCEESSFUL
+ Getting image 2
+ d8gimg  SUCEESSFUL
+ Checking image and palette
+ Image is correct
+ Palette is correct
+ Setting write ref1
+ d8wref  SUCEESSFUL
+ Setting palette 2
+ d8spal  SUCEESSFUL
+ Putting image 1 with pal 2, RLE
+ d8aimg  SUCEESSFUL
+ Setting read ref1
+ d8rref  SUCEESSFUL
+ Getting dimensions of first image
+ d8gdims  SUCEESSFUL
+ d1=  100 d2=  100 ispal=  1
+ Getting image 1
+ d8gimg  SUCEESSFUL
+ Checking image and palette
+ Image is correct
+ Palette is correct
+ 
+
+
+ ******  ALL TESTS SUCCESSFUL  *******
+ Creating arrays...
+ Writing arrays to single file...
+ Test passed for float64 write
+
+ Test passed for float32 write
+
+ Test passed for int8 write
+
+ Test passed for int16 write
+
+ Test passed for int32 write
+
+ Test passed for float64 read
+
+ Test passed for float32 read
+
+ Test passed for int8 read
+
+ Test passed for int16 read
+
+ Test passed for int32 read
+
+ Checking dimscales, max/min & arrays from single file
+
+ Test passed for float64 array
+ Test passed for float64 scales.
+ Test passed for float64 max/min.
+
+
+ Test passed for float32 array
+ Test passed for float32 scales.
+ Test passed for float32 max/min.
+
+
+ Test passed for int8 array
+ Test passed for int8 scales.
+ Test passed for int8 max/min.
+
+
+ Test passed for int16 array
+ Test passed for int16 scales.
+ Test passed for int16 max/min.
+
+
+ Test passed for int32 array
+ Test passed for int32 scales.
+ Test passed for int32 max/min.
+
+         >>> ALL TESTS PASSED <<<
+ Creating arrays...
+ Writing arrays to single file...
+ Test passed for float64 write
+
+ Test passed for float32 write
+
+ Test passed for int8 write
+
+ Test passed for int16 write
+
+ Test passed for int32 write
+
+ Test passed for float64 read
+
+ Test passed for float32 read
+
+ Test passed for int8 read
+
+ Test passed for int16 read
+
+ Test passed for int32 read
+
+ Checking dimscales, max/min & arrays from single file
+
+ Test passed for float64 array
+ Test passed for float64 scales.
+ Test passed for float64 max/min.
+
+
+ Test passed for float32 array
+ Test passed for float32 scales.
+ Test passed for float32 max/min.
+
+
+ Test passed for int8 array
+ Test passed for int8 scales.
+ Test passed for int8 max/min.
+
+
+ Test passed for int16 array
+ Test passed for int16 scales.
+ Test passed for int16 max/min.
+
+
+ Test passed for int32 array
+ Test passed for int32 scales.
+ Test passed for int32 max/min.
+
+         >>> ALL TESTS PASSED <<<
+ Creating arrays...
+ Testing arrays in individual files...
+ Write:  0    Read:  0
+ Test passed for float64 array.
+ Write:  0    Read:  0
+ Test passed for float32 array.
+ Write:  0    Read:  0
+ Test passed for int8 array.
+ Write:  0    Read:  0
+ Test passed for int16 array.
+ Write:  0    Read:  0
+ Test passed for int32 array.
+ Writing arrays to single file.
+ Error values: 
+              0
+              0
+              0
+              0
+              0
+ Reading arrays from single file... 
+ Error values: 
+              0
+              0
+              0
+              0
+              0
+ Checking arrays from single file...\n\n
+ Test passed for float64 array.
+ Test passed for float32 array.
+ Test passed for int8 array.
+ Test passed for int16 array.
+ Test passed for int32 array.
+
+         >>> ALL TESTS PASSED <<<
+
+
+ Creating arrays...
+ Testing arrays in individual files...
+ Write:  0    Read:  0
+ Test passed for float64 array.
+ Write:  0    Read:  0
+ Test passed for float32 array.
+ Write:  0    Read:  0
+ Test passed for int8 array.
+ Write:  0    Read:  0
+ Test passed for int16 array.
+ Write:  0    Read:  0
+ Test passed for int32 array.
+ Writing arrays to single file.
+ Error values: 
+ Add float64 ret:  0
+ Add float32 ret:  0
+ Add int8 ret:  0
+ Add int16 ret:  0
+ Add int32 ret:  0
+ Reading arrays from single file... 
+ Error values: 
+ Get f64 ret:  0
+ Get f32 ret:  0
+ Get int8 ret:  0
+ Get int16 ret:  0
+ Get int32 ret:  0
+ Checking arrays from single file...\n\n
+ Test passed for float64 array.
+ Test passed for float32 array.
+ Test passed for int8 array.
+ Test passed for int16 array.
+ Test passed for int32 array.
+
+         >>> ALL TESTS PASSED <<<
+
+
+ Creating arrays...
+ Test strings written so far
+ Test passed for Datalabel     
+ Test passed for Dataunit      
+ Test passed for Datafmt       
+ Test passed for Coordsys      
+ Test passed for f_dim1_label_b
+ Test passed for f_dim1_unit_b 
+ Test passed for f_dim1_fmt_b  
+ Test passed for f_dim2_label_a
+ Test passed for f_dim2_unit_a 
+ Test passed for f_dim2_fmt_a  
+ >>>> All Tests Passed.  >>>>
+
+FORTEST V0.2beta Built on: Mon Feb 8 1993 
+HDF Library Version: 4.0r0, NCSA HDF Version 4.0 Release 0, ?month? ?year?
+
+Testing  --  (slab1) 
+Testing  --  (slab2) 
+Testing  --  (slab3) 
+Testing  --  (slab4) 
+Testing  --  (slab) 
+Testing  --  (r24) 
+Testing  --  (an) 
+Testing  --  (anfile) 
+Testing  --  (manf) 
+Testing  --  (p) 
+Testing  --  (r8) 
+Testing  --  (sdmms) 
+Testing  --  (sdnmms) 
+Testing  --  (sdnnt) 
+Testing  --  (sdnt) 
+Testing  --  (sdstr) 
+
+
+
+Cleaning Up...
+
diff --git a/hdf/test/fortestF.f b/hdf/test/fortestF.f
new file mode 100644
index 0000000..6935f83
--- /dev/null
+++ b/hdf/test/fortestF.f
@@ -0,0 +1,299 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: fortestF.f 6036 2014-01-20 17:28:01Z acheng $
+C Interface to invoke tests for HDF Fortran interfaces.
+
+      Program main
+      implicit none
+      include 'fortest.inc'
+
+      integer nerror, retcode
+      character cmd*15, test*30
+      integer majorv, minorv, releaseno
+      character*80 relstr
+      integer hglibver
+      external hglibver
+
+C Default to cleanup *.hdf files and set verbosity to default value
+      CleanUp = .TRUE.
+      CleanUpCMD = 'rm -f *.hdf'
+      Verbosity = VERBO_DEF
+      nerror = 0
+C
+      print *, '==========================================='
+      print *, 'HDF Library Fortran Interface Tests Started'
+      print *, '==========================================='
+C
+C Show library version.
+      retcode = hglibver(majorv, minorv, releaseno, relstr)
+      if (retcode .eq. -1) then
+          print *, '*** hglibver failed ***'
+          nerror = nerror + 1
+      else
+          print 101, majorv, minorv, releaseno, relstr
+      endif
+C
+C assume majorv, minorv, releaseno are single digit numbers
+101   format('Built with HDF Library Version: ',I1,'.',I1,'.',I1,/A80)
+
+
+C Open command file
+      call opencmdf(retcode)
+      if (retcode .ne. 0) then
+          nerror = nerror + 1
+      else
+C
+C read and run one test command at a time
+         call getcmd(cmd, test, retcode)
+         do while (retcode .eq. 0)
+            call runcmd(cmd, test, retcode)
+            if (retcode .ne. 0) nerror = nerror + 1
+            call getcmd(cmd, test, retcode)
+         end do
+      end if
+
+      print *, '====================================='
+      if (nerror .ne. 0) then
+          print*, nerror, ' Fortran test(s) failed'
+      else
+          print*, 'All Fortran Interface Tests Passed'
+      endif
+      print *, '====================================='
+
+      if (CleanUp) call Hsystem(CleanUpCMD)
+
+      end
+
+
+C
+C Open the test command file
+C This is more general than reading from standard input file
+C which is often system dependent.
+C Retcode: 0 if everything is fine, else -1
+C
+      subroutine opencmdf(retcode)
+      implicit none
+      include 'fortest.inc'
+
+      integer retcode
+
+      retcode = 0
+      open(cmdf, FILE=cmdfilename, status='UNKNOWN',err=100)
+      return
+
+100   call MESSAGE(VERBO_NONE, 'failed to open command file')
+      retcode = -1
+      return
+      end
+
+C Get a test command.
+C Currently taking it from standard input.
+C If EOF encounters, set retcode = 1.  Else retcode = 0.
+C
+      subroutine getcmd(cmd, test, retcode)
+      implicit none
+      include 'fortest.inc'
+
+      character*(*) cmd, test
+      integer retcode
+
+      character*120 inline
+      integer linelen, i
+
+      retcode = 0
+
+      read(cmdf,11,END=100,err=100) inline
+C     print *, 'inline=', inline
+      linelen = len(inline)
+      i = index(inline, ' ')
+      if (i .le. 0) i = linelen+1
+      cmd = inline(1 : i - 1)
+
+      do while (i .le. linelen)
+          if (inline(i:i) .eq. ' ') then
+      i = i + 1
+          else
+      goto 50
+          endif
+      end do
+
+50    test = inline(i:linelen)
+
+      if (Verbosity .ge. VERBO_HI) then
+          print * , 'cmd=', cmd, ', test=', test
+      endif
+
+      retcode = 0
+      return
+
+100           close(cmdf)
+      retcode = 1
+      return
+C
+11    format(A120)
+      end
+    
+
+C Run the Fortran test command.
+C
+      subroutine runcmd(cmd, param, retcode)
+      implicit none
+      include 'fortest.inc'
+
+      character*(*) cmd, param
+
+      integer retcode
+C
+      retcode = 0
+
+C Parse command types
+C
+C Verbosity level command
+      if (cmd .EQ. 'Verbosity' .OR. cmd .EQ. 'verbosity') then
+          Verbosity = index('0123456789', param(1:1)) - 1
+          return
+      endif
+    
+
+C Cleanup command
+C If param is Yes/No, it directs to delete the *.hdf or not.
+C If param is not Yes/No, it represents the system command to delete
+C    the *.hdf.  (NB: specifying system command does not imply
+C    to Cleanup, i.e., it does not current CleanUp setting.
+C
+      if (cmd .EQ. 'Cleanup' .OR. cmd .EQ. 'cleanup') then
+          if (param .EQ. 'No' .OR. param .EQ. 'no') then
+      CleanUp = .FALSE.
+          else if (param .EQ. 'Yes' .OR. param .EQ. 'yes') then
+      CleanUp = .TRUE.
+          else
+      CleanUpCMD = param
+          endif
+          return
+      endif
+    
+C      print *, '====================================='
+C      print *, cmd, param
+C      print *, '====================================='
+
+C Skip command
+      if (cmd .EQ. 'Skip' .OR. cmd .EQ. 'skip') then
+          call ptestban('Skipping', param)
+          return
+      endif
+
+      if (cmd .NE. 'Test' .AND. cmd .NE. 'test') then
+          print *, 'Unknown Command: ', cmd, param
+          print *, 'Try one of "Skip", "Test", "Verbosity" or "Cleanup"'
+          retcode = -1
+          return
+      endif
+
+C Test command
+      if (param .EQ. 'slab') then
+          call slabwf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'r24') then
+          call t24f(retcode)
+          return
+      endif
+
+      if (param .EQ. 'an') then
+          call tanf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'anfile') then
+          call tanfilef(retcode)
+          return
+      endif
+
+      if (param .EQ. 'manf') then
+          call manf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'mgrf') then
+          call mgrf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'p') then
+          call tpf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'r8') then
+          call tr8f(retcode)
+          return
+      endif
+
+      if (param .EQ. 'sdmms') then
+          call tsdmmsf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'sdnmms') then
+          call tsdnmmsf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'sdnnt') then
+          call tsdnntf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'sdnt') then
+          call tsdntf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'sdstr') then
+          call tsdstrf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'vsetf') then
+          call tvsetf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'vsetblock') then
+          call tvsetblock(retcode)
+          return
+      endif
+
+      if (param .EQ. 'vgroups') then
+          call tvgroups(retcode)
+          return
+      endif
+
+      if (param .EQ. 'vattrf') then
+          call tvattrf(retcode)
+          return
+      endif
+
+      if (param .EQ. 'stubs') then
+          call tstubsf(retcode)
+          return
+      endif
+
+C
+      print *, 'Unknown Command: ', cmd, param
+      retcode = -1
+      return
+      end
+
diff --git a/hdf/test/gentest.c b/hdf/test/gentest.c
new file mode 100644
index 0000000..e164add
--- /dev/null
+++ b/hdf/test/gentest.c
@@ -0,0 +1,207 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: gentest.c 5210 2009-08-21 20:27:12Z brtnfld $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5210 $";
+#endif
+
+/*
+   FILE
+   gentest.c
+   Generate files for HDF testing.
+
+   REMARKS
+   This may be a bit of a kludge in some cases, because it's hard
+   to determine correct output if you don't know if the routine
+   you are generating the test is working yet.
+
+   DESIGN
+   Each test should have a seperate function which creates the datafiles
+   necessary for testing it.
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES
+   none
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   10/27/93 - Started coding.
+   1/20/94 - Added N-bit test generation.
+ */
+
+#include "hdf.h"
+
+/* Local definitions of filenames and tag/refs of data in them. */
+#define BITIO_NAME  "test_files/bitio.dat"
+#define BITIO_TAG1  1000
+#define BITIO_REF1  1000
+#define BITIO_SIZE1 4096
+
+#define NBIT_NAME   "test_files/nbit.dat"
+#define NBIT_TAG1   (uint16)1000
+#define NBIT_REF1   (uint16)1000
+#define NBIT_SIZE1  4096
+#define NBIT_BITS1  6
+
+static int gen_bitio_test(void);
+static int gen_nbit_test(void);
+
+/*--------------------------------------------------------------------------
+
+ NAME
+        gen_bitio_test -- create datafiles for bitio test
+ USAGE
+        int gen_bitio_test()
+ RETURNS
+        returns SUCCEED or FAIL
+ DESCRIPTION
+        Writes out a sample dataset to the bitio datafile so that
+        we can test bitio reading before bitio writing.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static int gen_bitio_test(void)
+{
+    int32       fid;            /* file ID of bitio HDF file */
+    uint8      *bit_data;       /* pointer to the data to store in the datafile */
+    intn        i;              /* local counting variable */
+
+    if ((fid = Hopen(BITIO_NAME, DFACC_CREATE, 0)) == FAIL)
+        return (FAIL);
+
+    if ((bit_data = (uint8 *) HDmalloc(BITIO_SIZE1 * sizeof(uint8))) == NULL)
+      {
+          Hclose(fid);
+          return (FAIL);
+      }     /* end if */
+
+    for (i = 0; i < BITIO_SIZE1; i++)   /* fill with pseudo-random data */
+        bit_data[i] = (uint8)((i * 3) % 256);
+
+    if (FAIL == Hputelement(fid, BITIO_TAG1, BITIO_REF1, bit_data, BITIO_SIZE1))
+      {
+          HDfree(bit_data);
+          Hclose(fid);
+          return (FAIL);
+      }     /* end if */
+
+    HDfree(bit_data);
+
+    if (FAIL == Hclose(fid))
+        return (FAIL);
+
+    return (SUCCEED);
+}   /* end gen_bitio_test() */
+
+/*--------------------------------------------------------------------------
+
+ NAME
+        gen_nbit_test -- create datafiles for n-bit test
+ USAGE
+        int gen_nbit_test()
+ RETURNS
+        returns SUCCEED or FAIL
+ DESCRIPTION
+        Writes out a sample dataset to a sample datafile so that
+        we can test n-bit writing before n-bit reading.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static int gen_nbit_test(void)
+{
+    int32       fid;            /* file ID of n-bit HDF file */
+    uint8      *nbit_data;      /* pointer to the initial data */
+    uint8      *out_data;       /* pointer to the data to store in the datafile */
+    uint32      store;          /* temporary storage for outgoing bits */
+    intn        store_bits;     /* number of bits stored */
+    uintn       out_num;        /* number of bytes to output */
+    intn        i;              /* local counting variable */
+
+    if ((fid = Hopen(NBIT_NAME, DFACC_CREATE, 0)) == FAIL)
+        return (FAIL);
+
+    if ((nbit_data = (uint8 *) HDmalloc(NBIT_SIZE1 * sizeof(uint8))) == NULL)
+      {
+          Hclose(fid);
+          return (FAIL);
+      }     /* end if */
+
+    if ((out_data = (uint8 *) HDmalloc(NBIT_SIZE1 * sizeof(uint8))) == NULL)
+      {
+          HDfree(nbit_data);
+          Hclose(fid);
+          return (FAIL);
+      }     /* end if */
+
+    for (i = 0; i < NBIT_SIZE1; i++)    /* fill with pseudo-random data */
+        nbit_data[i] = (uint8)((i * 3) % 64);
+
+    store = 0;
+    store_bits = 0;
+    out_num = 0;
+    for (i = 0; i < NBIT_SIZE1; i++)
+      {     /* pack the bits together */
+          store <<= NBIT_BITS1;
+          store |= (uint32)nbit_data[i] & (uint32)maskc[NBIT_BITS1];
+          store_bits += NBIT_BITS1;
+          if (store_bits >= (intn)BITNUM)
+            {   /* have at least a full byte */
+                out_data[out_num] = (uint8)((store >> (store_bits - (intn)BITNUM)) & (uint32)maskc[8]);
+                out_num++;
+                store_bits -= (intn)BITNUM;
+                store >>= BITNUM;
+            }   /* end if */
+      }     /* end for */
+    if (store_bits > 0)
+      {     /* push over any leftover bits to the left */
+          out_data[out_num] = (uint8)(store << ((intn)BITNUM - store_bits));
+          out_num++;
+      }     /* end if */
+
+    if (FAIL == Hputelement(fid, NBIT_TAG1, NBIT_REF1, out_data, (int32)out_num))
+      {
+          HDfree(nbit_data);
+          HDfree(out_data);
+          Hclose(fid);
+          return (FAIL);
+      }     /* end if */
+
+    HDfree(nbit_data);
+    HDfree(out_data);
+
+    if (FAIL == Hclose(fid))
+        return (FAIL);
+
+    return (SUCCEED);
+}   /* end gen_nbit_test() */
+
+int
+main(int argc, char *argv[])
+{
+    /* shut compiler up */
+    argc=argc; argv=argv;
+
+    gen_bitio_test();
+    gen_nbit_test();
+
+    return(0);
+}   /* end main() */
diff --git a/hdf/test/litend.c b/hdf/test/litend.c
new file mode 100644
index 0000000..b094e8f
--- /dev/null
+++ b/hdf/test/litend.c
@@ -0,0 +1,735 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5210 $";
+#endif
+
+/* $Id: litend.c 5210 2009-08-21 20:27:12Z brtnfld $ */
+
+#include "tproto.h"
+
+/* Internal Variables */
+#define CDIM_X  7
+#define CDIM_Y  9
+
+#define FILENAME    "test_files/litend.dat"
+#define TMPFILE     "temp.hdf"
+
+/* for those machines with imprecise IEEE<-> conversions, this should be */
+/* close enough */
+#define FLOAT64_FUDGE  ((float64)0.00000001)
+
+static int8  cdata_i8[CDIM_Y][CDIM_X];
+static uint8  cdata_u8[CDIM_Y][CDIM_X];
+static int16  cdata_i16[CDIM_Y][CDIM_X];
+static uint16  cdata_u16[CDIM_Y][CDIM_X];
+static int32  cdata_i32[CDIM_Y][CDIM_X];
+static uint32  cdata_u32[CDIM_Y][CDIM_X];
+static float32  cdata_f32[CDIM_Y][CDIM_X];
+static float64  cdata_f64[CDIM_Y][CDIM_X];
+
+static VOID init_cdata(void);
+static VOID wrapup_cdata(void);
+static VOID test_little_read(void);
+static VOID test_little_write(void);
+
+static VOID
+init_cdata(void)
+{
+    int         i, j;
+
+    for (i = 0; i < CDIM_Y; i++)
+        for (j = 0; j < CDIM_X; j++)
+          {
+              cdata_i8[i][j] = (int8) (i * 10 + j);
+              cdata_u8[i][j] = (uint8) (i * 10 + j);
+              cdata_i16[i][j] = (int16) (i * 10 + j);
+              cdata_u16[i][j] = (uint16) (i * 10 + j);
+              cdata_i32[i][j] = (int32) (i * 10 + j);
+              cdata_u32[i][j] = (uint32) (i * 10 + j);
+              cdata_f32[i][j] = (float32) (i * 10 + j);
+              cdata_f64[i][j] = (float64) (i * 10 + j);
+          }     /* end for */
+}   /* end init_cdata() */
+
+static VOID
+wrapup_cdata(void)
+{
+}   /* end wrapup_cdata() */
+
+static VOID
+test_little_read(void)
+{
+    intn rank;
+    int32 dimsizes[2];
+    int32 numbertype;
+    int8 *data_i8;
+    uint8 *data_u8;
+    int16 *data_i16;
+    uint16 *data_u16;
+    int32 *data_i32;
+    uint32 *data_u32;
+    float32 *data_f32;
+    float64 *data_f64;
+    int ret;
+
+    char        filename[512] = "";
+    char       *srcdir = getenv("srcdir");
+
+    MESSAGE(5,printf("Testing Little-Endian Read Routines\n"););
+
+    MESSAGE(10,printf("Testing Little-Endian INT8 Reading Routines\n"););
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(FILENAME) + 1) < sizeof(filename))) {
+        strcpy(filename, srcdir);
+        strcat(filename, "/");
+    }
+    strcat(filename, FILENAME);
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for INT8 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LINT8) {
+            fprintf(stderr, "Numbertype for INT8 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_i8=(int8 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(int8));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_i8);
+            RESULT("DFSDgetdata");
+
+            if(HDmemcmp(cdata_i8,data_i8,CDIM_X*CDIM_Y*sizeof(int8))) {
+                fprintf(stderr,"INT8 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+            HDfree((VOIDP)data_i8);
+          } /* end else */
+      } /* end else */
+
+    MESSAGE(10,printf("Testing Little-Endian UINT8 Reading Routines\n"););
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for UINT8 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LUINT8) {
+            fprintf(stderr, "Numbertype for UINT8 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_u8=(uint8 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(uint8));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_u8);
+            RESULT("DFSDgetdata");
+
+            if(HDmemcmp(cdata_u8,data_u8,CDIM_X*CDIM_Y*sizeof(uint8))) {
+                fprintf(stderr,"UINT8 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+            HDfree((VOIDP)data_u8);
+          } /* end else */
+      } /* end else */
+
+    MESSAGE(10,printf("Testing Little-Endian INT16 Reading Routines\n"););
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for INT16 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LINT16) {
+            fprintf(stderr, "Numbertype for INT16 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_i16=(int16 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(int16));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_i16);
+            RESULT("DFSDgetdata");
+
+            if(HDmemcmp(cdata_i16,data_i16,CDIM_X*CDIM_Y*sizeof(int16))) {
+                fprintf(stderr,"INT16 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+            HDfree((VOIDP)data_i16);
+          } /* end else */
+      } /* end else */
+
+    MESSAGE(10,printf("Testing Little-Endian UINT16 Reading Routines\n"););
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for UINT16 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LUINT16) {
+            fprintf(stderr, "Numbertype for UINT16 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_u16=(uint16 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(uint16));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_u16);
+            RESULT("DFSDgetdata");
+
+            if(HDmemcmp(cdata_u16,data_u16,CDIM_X*CDIM_Y*sizeof(uint16))) {
+                fprintf(stderr,"UINT16 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+            HDfree((VOIDP)data_u16);
+          } /* end else */
+      } /* end else */
+
+    MESSAGE(10,printf("Testing Little-Endian INT32 Reading Routines\n"););
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for INT32 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LINT32) {
+            fprintf(stderr, "Numbertype for INT32 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_i32=(int32 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(int32));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_i32);
+            RESULT("DFSDgetdata");
+
+            if(HDmemcmp(cdata_i32,data_i32,CDIM_X*CDIM_Y*sizeof(int32))) {
+                fprintf(stderr,"INT32 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+            HDfree((VOIDP)data_i32);
+          } /* end else */
+      } /* end else */
+
+    MESSAGE(10,printf("Testing Little-Endian UINT32 Reading Routines\n"););
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for UINT32 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LUINT32) {
+            fprintf(stderr, "Numbertype for UINT32 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_u32=(uint32 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(uint32));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_u32);
+            RESULT("DFSDgetdata");
+
+            if(HDmemcmp(cdata_u32,data_u32,CDIM_X*CDIM_Y*sizeof(uint32))) {
+                fprintf(stderr,"UINT32 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+            HDfree((VOIDP)data_u32);
+          } /* end else */
+      } /* end else */
+
+    MESSAGE(10,printf("Testing Little-Endian FLOAT32 Reading Routines\n"););
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for FLOAT32 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LFLOAT32) {
+            fprintf(stderr, "Numbertype for FLOAT32 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_f32=(float32 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(float32));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_f32);
+            RESULT("DFSDgetdata");
+
+            if(HDmemcmp(cdata_f32,data_f32,CDIM_X*CDIM_Y*sizeof(float32))) {
+                fprintf(stderr,"FLOAT32 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+            HDfree((VOIDP)data_f32);
+          } /* end else */
+      } /* end else */
+
+    MESSAGE(10,printf("Testing Little-Endian FLOAT64 Reading Routines\n"););
+
+    ret=DFSDgetdims(filename,&rank,dimsizes,2);
+    RESULT("DFSDgetdims");
+    if(dimsizes[0]!=CDIM_Y || dimsizes[1]!=CDIM_X) {
+        fprintf(stderr, "Dimensions for FLOAT64 data were incorrect\n");
+        num_errs++;
+      } /* end if */
+    else {
+        ret=DFSDgetNT(&numbertype);
+        RESULT("DFSDgetNT");
+        if(numbertype!=DFNT_LFLOAT64) {
+            fprintf(stderr, "Numbertype for FLOAT64 data were incorrect\n");
+            num_errs++;
+          } /* end if */
+        else {
+            data_f64=(float64 *)HDmalloc((size_t)(dimsizes[0]*dimsizes[1])*sizeof(float64));
+            ret=DFSDgetdata(filename,rank,dimsizes,(VOIDP)data_f64);
+            RESULT("DFSDgetdata");
+
+#if defined CONVEXNATIVE
+#ifdef OLD_WAY
+        if(Verbocity>9) {
+            intn i;
+            uint8 *u8_s=(uint8 *)cdata_f64,
+	        *u8_d2=(uint8 *)data_f64;
+
+            printf("cdata_f64:  ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_s[i]);
+            printf("\ndata_f64: ");
+            for(i=0; i<80; i++)
+              printf("%.2x ",u8_d2[i]);
+            printf("\n");
+        }
+#else /* OLD_WAY */
+{
+	intn i;
+	float64 *cd_f64=(float64 *)cdata_f64,
+		*d_f64=(float64 *)data_f64;
+
+	for(i=0; i<CDIM_X*CDIM_Y; i++) {
+	    if(d_f64[i]<(cd_f64[i]-FLOAT64_FUDGE)
+		|| d_f64[i]>(cd_f64[i]+FLOAT64_FUDGE)) {
+            fprintf(stderr,"FLOAT64 data was incorrect\n");
+printf("cd_f64[%d]=%lf, d_f64[%d]=%lf\n",i,cd_f64[i],i,d_f64[i]);
+{
+            intn j;
+            uint8 *u8_s=(uint8 *)&cd_f64[i],
+	        *u8_d2=(uint8 *)&d_f64[i];
+
+            printf("cdata_f64:  ");
+            for(j=0; j<sizeof(float64); j++)
+              printf("%.2x ",u8_s[j]);
+            printf("\ndata_f64: ");
+            for(j=0; j<sizeof(float64); j++)
+              printf("%.2x ",u8_d2[j]);
+            printf("\n");
+}
+              HEprint(stdout,0);
+              num_errs++;
+            } /* end if */
+	  } /* end for */
+}
+#endif /* OLD_WAY */
+#else
+            if(HDmemcmp(cdata_f64,data_f64,CDIM_X*CDIM_Y*sizeof(float64))) {
+                fprintf(stderr,"FLOAT64 data was incorrect\n");
+                num_errs++;
+              } /* end if */
+#endif /* Wierd machines */
+            HDfree((VOIDP)data_f64);
+          } /* end else */
+      } /* end else */
+}   /* end test_little_read */
+
+static VOID
+test_little_write(void)
+{
+    intn        rank;
+    int32       dimsizes[2];
+    int32       numbertype;
+    int8       *data_i8;
+    uint8      *data_u8;
+    int16      *data_i16;
+    uint16     *data_u16;
+    int32      *data_i32;
+    uint32     *data_u32;
+    float32    *data_f32;
+    float64    *data_f64;
+    int         ret;
+
+    MESSAGE(5, printf("Testing Little-Endian Write Routines\n");
+        );
+
+    rank = 2;
+    dimsizes[0] = CDIM_Y;
+    dimsizes[1] = CDIM_X;
+
+    MESSAGE(10, printf("Testing Little-Endian INT8 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LINT8);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_i8);
+    RESULT("DFSDadddata");
+
+    MESSAGE(10, printf("Testing Little-Endian UINT8 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LUINT8);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_u8);
+    RESULT("DFSDadddata");
+
+    MESSAGE(10, printf("Testing Little-Endian INT16 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LINT16);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_i16);
+    RESULT("DFSDadddata");
+
+    MESSAGE(10, printf("Testing Little-Endian UINT16 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LUINT16);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_u16);
+    RESULT("DFSDadddata");
+
+    MESSAGE(10, printf("Testing Little-Endian INT32 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LINT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_i32);
+    RESULT("DFSDadddata");
+
+    MESSAGE(10, printf("Testing Little-Endian UINT32 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LUINT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_u32);
+    RESULT("DFSDadddata");
+
+    MESSAGE(10, printf("Testing Little-Endian FLOAT32 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LFLOAT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_f32);
+    RESULT("DFSDadddata");
+
+    MESSAGE(10, printf("Testing Little-Endian FLOAT64 Writing Routines\n");
+        );
+
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+    ret = DFSDsetNT(DFNT_LFLOAT64);
+    RESULT("DFSDsetNT");
+    ret = DFSDadddata(TMPFILE, rank, dimsizes, (VOIDP) cdata_f64);
+    RESULT("DFSDadddata");
+
+    ret = DFSDrestart();
+    RESULT("DFSDrestart");
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for INT8 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LINT8)
+            {
+                fprintf(stderr, "Numbertype for INT8 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_i8 = (int8 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(int8));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_i8);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_i8, data_i8, CDIM_X * CDIM_Y * sizeof(int8)))
+                  {
+                      fprintf(stderr, "INT8 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_i8);
+            }   /* end else */
+      }     /* end else */
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for UINT8 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LUINT8)
+            {
+                fprintf(stderr, "Numbertype for UINT8 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_u8 = (uint8 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(uint8));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_u8);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_u8, data_u8, CDIM_X * CDIM_Y * sizeof(uint8)))
+                  {
+                      fprintf(stderr, "UINT8 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_u8);
+            }   /* end else */
+      }     /* end else */
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for INT16 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LINT16)
+            {
+                fprintf(stderr, "Numbertype for INT16 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_i16 = (int16 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(int16));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_i16);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_i16, data_i16, CDIM_X * CDIM_Y * sizeof(int16)))
+                  {
+                      fprintf(stderr, "INT16 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_i16);
+            }   /* end else */
+      }     /* end else */
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for UINT16 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LUINT16)
+            {
+                fprintf(stderr, "Numbertype for UINT16 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_u16 = (uint16 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(uint16));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_u16);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_u16, data_u16, CDIM_X * CDIM_Y * sizeof(uint16)))
+                  {
+                      fprintf(stderr, "UINT16 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_u16);
+            }   /* end else */
+      }     /* end else */
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for INT32 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LINT32)
+            {
+                fprintf(stderr, "Numbertype for INT32 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_i32 = (int32 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(int32));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_i32);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_i32, data_i32, CDIM_X * CDIM_Y * sizeof(int32)))
+                  {
+                      fprintf(stderr, "INT32 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_i32);
+            }   /* end else */
+      }     /* end else */
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for UINT32 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LUINT32)
+            {
+                fprintf(stderr, "Numbertype for UINT32 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_u32 = (uint32 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(uint32));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_u32);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_u32, data_u32, CDIM_X * CDIM_Y * sizeof(uint32)))
+                  {
+                      fprintf(stderr, "UINT32 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_u32);
+            }   /* end else */
+      }     /* end else */
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for FLOAT32 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LFLOAT32)
+            {
+                fprintf(stderr, "Numbertype for FLOAT32 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_f32 = (float32 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(float32));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_f32);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_f32, data_f32, CDIM_X * CDIM_Y * sizeof(float32)))
+                  {
+                      fprintf(stderr, "FLOAT32 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_f32);
+            }   /* end else */
+      }     /* end else */
+
+    ret = DFSDgetdims(TMPFILE, &rank, dimsizes, 2);
+    RESULT("DFSDgetdims");
+    if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X)
+      {
+          fprintf(stderr, "Dimensions for FLOAT64 data were incorrect\n");
+          num_errs++;
+      }     /* end if */
+    else
+      {
+          ret = DFSDgetNT(&numbertype);
+          RESULT("DFSDgetNT");
+          if (numbertype != DFNT_LFLOAT64)
+            {
+                fprintf(stderr, "Numbertype for FLOAT64 data were incorrect\n");
+                num_errs++;
+            }   /* end if */
+          else
+            {
+                data_f64 = (float64 *) HDmalloc((size_t)(dimsizes[0] * dimsizes[1]) * sizeof(float64));
+                ret = DFSDgetdata(TMPFILE, rank, dimsizes, (VOIDP) data_f64);
+                RESULT("DFSDgetdata");
+
+                if (HDmemcmp(cdata_f64, data_f64, CDIM_X * CDIM_Y * sizeof(float64)))
+                  {
+                      fprintf(stderr, "FLOAT64 data was incorrect\n");
+                      num_errs++;
+                  }     /* end if */
+                HDfree((VOIDP) data_f64);
+            }   /* end else */
+      }     /* end else */
+}   /* end test_little_write */
+
+void
+test_litend(void)
+{
+    init_cdata();
+
+    test_little_read();
+    test_little_write();
+
+    wrapup_cdata();
+}   /* end test_litend() */
diff --git a/hdf/test/macros.c b/hdf/test/macros.c
new file mode 100644
index 0000000..bd033a3
--- /dev/null
+++ b/hdf/test/macros.c
@@ -0,0 +1,188 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "tproto.h"
+
+#define INT16MAX 32767 /* 0x7fff */
+
+#define UINT16MAX 65535 /* 0xffff */
+
+#define INT32MAX 2147483647 /* 0x7fffffff */
+
+#define UINT32MAX 4294967295UL /* 0xffffffff */
+
+extern int Verbocity;
+
+void
+test_macros(void)
+{
+
+	signed char *p;
+	uint16 new16u, old16u, str16u;
+	int16 new16, old16, str16;
+	uint32 new32u, old32u, str32u;
+	int32 new32, old32, str32;
+	int i,j;
+	int errors1, errors2, errors3, errors4;
+	int errors = 0;
+
+	uint16 data1[10] = {0,1,2,3,4,UINT16MAX-4,UINT16MAX-3,UINT16MAX-2,UINT16MAX-1,UINT16MAX};
+
+	int16 data2[20] = {-INT16MAX-1,-INT16MAX,-INT16MAX+1,-INT16MAX+2,-INT16MAX+3,-INT16MAX+4,
+                          -4,-3,-2,-1,0,1,2,3,4,
+                          INT16MAX-4,INT16MAX-3,INT16MAX-2,INT16MAX-1,INT16MAX};
+
+	uint32 data3[10] = {0,1,2,3,4,UINT32MAX-4,UINT32MAX-3,UINT32MAX-2,UINT32MAX-1,UINT32MAX};
+
+	int32 data4[20] = {-INT32MAX-1,-INT32MAX,-INT32MAX+1,-INT32MAX+2,-INT32MAX+3,-INT32MAX+4,
+                          -4,-3,-2,-1,0,1,2,3,4,
+                          INT32MAX-4,INT32MAX-3,INT32MAX-2,INT32MAX-1,INT32MAX};
+
+	if (Verbosity > 5) printf("\n");
+	errors1 = 0;
+	for (j = 0; j < 10; j++ ){
+		old16u = data1[j];
+		p = (signed char *) &str16u;
+		UINT16ENCODE(p, old16u);
+		p = (signed char *) &str16u;
+		UINT16DECODE(p, new16u);
+
+		if ( old16u != new16u ) {
+			if (Verbosity > 8) {
+				printf("old16u = %d, %x\n", old16u, old16u);
+				printf("str: ");
+				p = (signed char *) &str16u;
+				for (i=0; i<sizeof(uint16); i++){
+					printf("%x ", 0xff & *p++);
+				}
+				printf("\n");
+				printf("new16u = %d, %x\n", new16u, new16u);
+				printf("\n");
+			}
+			errors1++;
+		}
+	}
+	if (Verbosity > 5) {
+		if (errors1 == 0) {
+			printf("UNSIGNED INTEGER16: SUCCESSFUL\n");
+		} else {
+			printf("UNSIGNED INTEGER16: %d ERRORS\n",errors1);
+		}
+	}
+
+	if (Verbosity > 5) printf("\n");
+	errors2 = 0;
+	for (j = 0; j < 20; j++ ){
+		old16 = data2[j];
+		p = (signed char *) &str16;
+		INT16ENCODE(p, old16);
+		p = (signed char *) &str16;
+		INT16DECODE(p, new16);
+
+		if ( old16 != new16 ) {
+			if (Verbosity > 8) {
+				printf("old16 = %d, %x\n", old16, old16);
+				printf("str: ");
+				p = (signed char *) &str16;
+				for (i=0; i<sizeof(int16); i++){
+					printf("%x ", 0xff & *p++);
+				}
+				printf("\n");
+				printf("new16 = %d, %x\n", new16, new16);
+				printf("\n");
+			}
+			errors2++;
+		}
+	}
+	if (Verbosity > 5) {
+		if (errors2 == 0) {
+			printf("SIGNED INTEGER16: SUCCESSFUL\n");
+		} else {
+			printf("SIGNED INTEGER16: %d ERRORS\n",errors2);
+		}
+	}
+
+	if (Verbosity > 5) printf("\n");
+	errors3 = 0;
+	for (j = 0; j < 10; j++ ){
+		old32u = data3[j];
+		p = (signed char *) &str32u;
+		UINT32ENCODE(p, old32u);
+		p = (signed char *) &str32u;
+		UINT32DECODE(p, new32u);
+
+		if ( old32u != new32u ) {
+			if (Verbosity > 8) {
+				printf("old32u = %u, %x\n", (unsigned)old32u, (unsigned)old32u);
+				printf("str: ");
+				p = (signed char *) &str32u;
+				for (i=0; i<sizeof(uint32); i++){
+					printf("%x ", 0xff & *p++);
+				}
+				printf("\n");
+				printf("new32u = %u, %x\n", (unsigned)new32u, (unsigned)new32u);
+				printf("\n");
+			}
+			errors3++;
+		}
+	}
+	if (Verbosity > 5) {
+		if (errors3 == 0) {
+			printf("UNSIGNED INTEGER32: SUCCESSFUL\n");
+		} else {
+			printf("UNSIGNED INTEGER32: %d ERRORS\n",errors3);
+		}
+	}
+
+	if (Verbosity > 5) printf("\n");
+	errors4 = 0;
+	for (j = 0; j < 20; j++ ){
+		old32 = data4[j];
+		p = (signed char *) &str32;
+		INT32ENCODE(p, old32);
+		p = (signed char *) &str32;
+		INT32DECODE(p, new32);
+
+		if ( old32 != new32 ) {
+			if (Verbosity > 8) {
+				printf("old32 = %d, %x\n", (int)old32, (unsigned)old32);
+				printf("str: ");
+				p = (signed char *) &str32;
+				for (i=0; i<sizeof(int32); i++){
+					printf("%x ", 0xff & *p++);
+				}
+				printf("\n");
+				printf("new32 = %d, %x\n", (int)new32, (unsigned)new32);
+				printf("\n");
+			}
+			errors4++;
+		}
+	}
+	if (Verbosity > 5) {
+		if (errors4 == 0) {
+			printf("SIGNED INTEGER32: SUCCESSFUL\n");
+		} else {
+			printf("SIGNED INTEGER32: %d ERRORS\n",errors4);
+		}
+	}
+
+	errors = errors1+errors2+errors3+errors4;
+	if (errors > 0) {
+		printf("            %d ERRORS were detected during (macros) Testing\n",errors);
+		num_errs += errors;
+	}
+
+
+}   /* end test_macros() */
+
+
diff --git a/hdf/test/man.c b/hdf/test/man.c
new file mode 100644
index 0000000..54a8074
--- /dev/null
+++ b/hdf/test/man.c
@@ -0,0 +1,961 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: man.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/***********************************************************
+*
+* Test program:  man
+*
+* This program stores annotations in a file using Multi-file interface ANxxx
+* It tests writing/reading file labels/descriptions and reading/writing 
+* anntotations to SDS's and RIS. The old interfaces for these elements
+* are used to write several SDSs and corresponding RISs to a file.
+* It doesn't test writing annotations for Vgroups or Vdata.
+* 
+*  NOTE: No verification of the SDS or RI data in the file
+*        is done i.e. data is not read back in.
+*
+* 1. Writes file labels and descriptions.
+*
+* 2. It writes labels and descriptions for all 2 out of 3 SDSs.
+*
+* 3. It writes labels and descriptions for all RISs.
+*
+* 4. Tests re-writing of annotation(only one type is tested but
+*    it should suffice to test the internals) while preserving
+*    original tag/ref of element.
+*
+*************************************************************/
+
+/* includes */
+#include "tproto.h"
+
+#define TESTFILE "tman.hdf" /* testfile to write annotations to */
+#define ROWS          10    /* row size of dataset/image */
+#define COLS          10    /* column size of dataset/image */
+#define REPS           3    /* number of images/data sets to write to file */
+
+/* File labels/desriptions to write */
+static const char *file_lab[3] =
+{"File label #1: aaa", 
+ "File label #2: bbbbbb",
+ "File label #3: cccc"};
+
+static const char *file_desc[2] =
+{"File Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 13"
+ "\n        14 15 16 17 18 19 20 **END FILE DESCR**\n",
+ "File Descr #2: A B C D E F G H I J K L \n"
+ "               M N O  **END FILE DESCR**\n"};
+
+/* Data labels /descriptions to write */
+static const char *labsds[2] = 
+{"Object label #1:  sds", 
+ "Object label #1.1:sds"};
+
+static const char *labris[2] = 
+{"Object label #2:  image", 
+ "Object label #2.1:image"};
+
+static const char *descsds[2] =
+{"Object Descr #1:   1  2  3  4  5  6  7  8  9 10 11 12 "
+ "\n       13 14 15 16 17 18 19 20 **END SDS DESCR**\n",
+ "Object Descr #1.1: 1  2  3  4  5  6  7  8  9 10 11 12 "
+ "\n       13 14 15 16 17 18 19 20 **END SDS DESCR**\n"};
+
+static const char *descris[2] = 
+{"Object Descr #2:   A B C D E F G H I J K L \n"
+ "                 M N O **END IMAGE DESCR **\n",
+ "Object Descr #2.1: A B C D E F G H I J K L \n"
+ "                 M N O **END IMAGE DESCR **\n"};
+
+/* fcn Prototypes */
+static VOID 
+genimage (int height, int width, float32 *data, uint8 *image);
+
+static VOID 
+gen2Dfloat (int height, int width, float32 *data);
+
+static int32
+check_fann(const char *fname);
+
+static int32
+check_lab_desc (const char *fname, uint16 tag, uint16 ref,const char* label[],
+                const char *desc[]);
+
+/****************************************************************
+**
+**  gen2Dfloat:  generate 2-D data array
+**
+****************************************************************/
+static      VOID
+gen2Dfloat(int height, int width, float32 *data)
+{
+    int    i, j;
+    float32  *pdata = NULL;
+
+    /* store one value per row, increasing by one for each row */
+    pdata = data;
+    for (i = 0; i < height; i++)
+        for (j = 0; j < width; j++)
+            *pdata++ = (float32) (i + 1);
+
+} /* gen2Dfloat() */
+
+/****************************************************************
+**
+**  genimage:  generate image from 2-D float array
+**
+****************************************************************/
+static      VOID
+genimage(int height, int width, float32 *data, uint8 *image)
+{
+    int    i, limit;
+    float32  *pdata = NULL;
+    float32  max, min, multiplier;
+
+    limit = height * width;
+    pdata = data;
+    max   = min = *pdata;
+    for (i = 0; i < limit; i++, pdata++)
+      {
+          max = (max > *pdata) ? max : *pdata;
+          min = (min < *pdata) ? min : *pdata;
+      }
+
+    /* store one value per row, increasing by one for each row */
+    pdata  = data;
+    multiplier = (float32) 255.0 / (max - min);
+    for (i = 0; i < limit; i++)
+        *image++ = (uint8) (((*pdata++) - min) * multiplier);
+} /* geniamge() */
+
+/****************************************************************
+**
+**  check_fann_rewrite:  Check rewriting a file label while
+**                       preserving original tag/ref of element 
+**
+****************************************************************/
+static int32
+check_fann_rewrite(const char *fname)
+{
+    int32 ret = SUCCEED;         /* return value */
+    int32 file_handle; /* file handle */
+    int32 an_handle;   /* annotation interface handle */
+    int32 ann_handle;  /* annotation handle */
+    int32 nflabs,      /* number of file labels */
+        nfdescs,     /* number of file descs */
+        nolabs,      /* total number of data labels */
+        nodescs;     /* total number of data descs */
+    int32 ann_len;     /* length of annotation */
+    uint16 atag;       /* annotation tag */
+    uint16 aref;       /* annotation ref */
+    char *ann_label = NULL; /* annotation label */
+    int32 ann_id;
+    uint16 ann_tag;
+    uint16 ann_ref;
+    uint16 b_ann_tag;
+    uint16 b_ann_ref;
+
+    /* open file again for writing */
+    ret = file_handle = Hopen(fname, DFACC_RDWR,0);
+    RESULT("Hopen");
+
+    /* Start annotation handling */
+    ret = an_handle = ANstart(file_handle);
+    RESULT("ANstart");
+
+    /* Get Info On Annotations In File */
+    ret = ANfileinfo(an_handle, &nflabs, &nfdescs, &nolabs, &nodescs);
+    RESULT("Anfileinfo");
+
+#ifdef AN_DEBUG
+    printf("There Are Nflabs=%d, Nfdescs=%d, Nolabs=%d, Nodescs=%d \n",nflabs,
+           nfdescs, nolabs, nodescs);
+#endif
+
+    /* get first label */
+    ann_handle = ret = ANselect(an_handle, 0, AN_FILE_LABEL);
+    RESULT("ANselect");
+
+    /* save tag ref here */
+    ret = ANget_tagref(an_handle,0,AN_FILE_LABEL,&b_ann_tag,&b_ann_ref);
+    RESULT("ANget_tagref");
+
+    /* rewrite it with 3rd label entry */
+    ret = ANwriteann(ann_handle, file_lab[2], (int32)HDstrlen(file_lab[2]));
+    RESULT("ANwriteann");
+
+    ret = ANendaccess(ann_handle);
+    RESULT("ANendaccess");
+
+    ret = ANend(an_handle);
+    RESULT("ANend");
+
+    /* Now get ready to read the first file label back in */
+
+    /* Start annotation handling */
+    ret = an_handle = ANstart(file_handle);
+    RESULT("ANstart");
+
+    /* read the first file label */
+    ann_handle = ret = ANselect(an_handle, 0, AN_FILE_LABEL);
+    RESULT("ANselect");
+
+    /* get file label length */
+    ann_len = ret = ANannlen(ann_handle);
+    RESULT("ANannlen");
+
+    /* see if this routine works */
+    ret = ANget_tagref(an_handle,0,AN_FILE_LABEL,&atag,&aref);
+    RESULT("ANget_tagref");
+
+    /* verify against previous tag/ref, should be the same as before
+       re-write */
+    if (b_ann_tag != atag || b_ann_ref != aref)
+      {
+          printf(">>> Failed to preseve tag/ref for rewriting of file label\n");
+          num_errs++;
+      }
+
+    /* see if this routine works. Use tag/ref from ANget_tagref() */
+    ann_id = ret = ANtagref2id(an_handle,atag,aref);
+    RESULT("ANtagref2id");
+
+    if (ann_id != ann_handle)
+      {
+          printf(">>> ANtagref2id failed to return valid annotation handle \n");
+          num_errs++;
+      }
+
+    /* see if this routine works. Use annotation id from ANtagref2id() */
+    ret = ANid2tagref(ann_id,&ann_tag,&ann_ref);
+    RESULT("ANid2tagref");
+
+    if (ann_tag != atag || ann_ref != aref)
+      {
+          printf(">>> ANid2tagref failed to return valid tag and ref \n");
+          num_errs++;
+      }
+
+    /* see if this routine works. Just a type, not specific. -BMR */
+    ann_tag = ANatype2tag (AN_DATA_DESC);
+    ret = (ann_tag != DFTAG_DIA) ? FAIL : 0;  /*these two statements may not */
+    RESULT("ANatype2tag");	/* be necessary but that seems like a pattern */
+				/* in the test so I put them here too. -BMR */
+
+    if (ann_tag != DFTAG_DIA)
+      {
+          printf(">>> ANatype2tag failed to return valid tag from a type \n");
+          num_errs++;
+      }
+
+    /* check ann length against 3rd label */
+    if (ann_len != (int32) HDstrlen(file_lab[2]))
+      {
+          printf("\t>>>BAD FILE LABEL LENGTH.\n\t    IS: %d\n\tSHOULD BE: %d<<<\n",
+                 (int) ann_len, (int) HDstrlen(file_lab[2]));
+          num_errs++;
+      }
+
+    /* allocate space for label */
+    if (ann_label == NULL)
+      {
+          if ((ann_label = (char *)HDmalloc((ann_len+1)*sizeof(char))) 
+              == NULL)
+            {
+                printf("Error: failed to allocate space to hold file label \n");
+                return FAIL;
+            }
+          HDmemset(ann_label,'\0', ann_len+1);
+      }
+      
+    /* read label */
+    ret = ANreadann(ann_handle, ann_label, ann_len+1);
+    RESULT("ANreadann");
+
+    /* end acces to label */
+    ret = ANendaccess(ann_handle);
+    RESULT("ANendaccess");      
+      
+    /* check read label against 3rd label*/
+    if (HDstrncmp((const char *)ann_label, (const char *)file_lab[2],(size_t)(ann_len+1)) != 0)
+      {
+          printf("\t>>>BAD FILE LABEL. \n\t       IS: %s; \n\tSHOULD BE: %s<<<\n",
+                 ann_label, file_lab[2]);
+          num_errs++;
+      }
+
+#ifdef AN_DEBUG
+    printf("found ann_len=%d, file label=%s\n", strlen(ann_label),ann_label);
+#endif
+
+    /* Clean up */
+    HDfree(ann_label); /* free up space */
+    ann_label = NULL;
+
+    /* end access to annotations */
+    ret = ANend(an_handle);
+    RESULT("ANend");
+
+    ret = Hclose(file_handle);   /* close file */
+    RESULT("Hclose");
+
+    return SUCCEED;
+} /* check_fann_rewrite() */
+
+/****************************************************************
+**
+**  check_fann:  Check file labels and descriptions in file
+**
+****************************************************************/
+static int32
+check_fann(const char *fname)
+{
+    int32 ret = SUCCEED;         /* return value */
+    int32 file_handle; /* file handle */
+    int32 an_handle;   /* annotation interface handle */
+    int32 ann_handle;  /* annotation handle */
+    int32 nflabs,      /* number of file labels */
+        nfdescs,     /* number of file descs */
+        nolabs,      /* total number of data labels */
+        nodescs;     /* total number of data descs */
+    int32 ann_len;     /* length of annotation */
+    uint16 atag;       /* annotation tag */
+    uint16 aref;       /* annotation ref */
+    char *ann_label = NULL; /* annotation label */
+    char *ann_desc = NULL;  /* annotation desc */
+    intn indx;
+    int32 ann_id;
+    uint16 ann_tag;
+    uint16 ann_ref;
+    intn  i;
+
+    /* open file again */
+    ret = file_handle = Hopen(fname, DFACC_READ,0);
+    RESULT("Hopen");
+
+    /* Start annotation handling */
+    ret = an_handle = ANstart(file_handle);
+    RESULT("ANstart");
+
+    /* Get Info On Annotations In File */
+    ret = ANfileinfo(an_handle, &nflabs, &nfdescs, &nolabs, &nodescs);
+    RESULT("Anfileinfo");
+
+#ifdef AN_DEBUG
+    printf("There Are Nflabs=%d, Nfdescs=%d, Nolabs=%d, Nodescs=%d \n",nflabs,
+           nfdescs, nolabs, nodescs);
+#endif
+
+    /* read file labels */
+    for (i = 0; i < nflabs; i++)
+      { /* select file label */
+          indx = i;
+          ann_handle = ret = ANselect(an_handle, indx, AN_FILE_LABEL);
+          RESULT("ANselect");
+
+          /* get file label length */
+          ann_len = ret = ANannlen(ann_handle);
+          RESULT("ANannlen");
+
+          /* see if this routine works */
+          ret = ANget_tagref(an_handle,indx,AN_FILE_LABEL,&atag,&aref);
+          RESULT("ANget_tagref");
+
+          /* see if this routine works. Use tag/ref from ANget_tagref() */
+          ann_id = ret = ANtagref2id(an_handle,atag,aref);
+          RESULT("ANtagref2id");
+
+          if (ann_id != ann_handle)
+            {
+                printf(">>> ANtagref2id failed to return valid annotation handle \n");
+                num_errs++;
+            }
+
+          /* see if this routine works. Use annotation id from ANtagref2id() */
+          ret = ANid2tagref(ann_id,&ann_tag,&ann_ref);
+          RESULT("ANid2tagref");
+
+          if (ann_tag != atag || ann_ref != aref)
+            {
+                printf(">>> ANid2tagref failed to return valid tag and ref \n");
+                num_errs++;
+            }
+
+          /* check ann length */
+          if (ann_len != (int32) HDstrlen(file_lab[i]))
+            {
+                printf("\t>>>BAD FILE LABEL LENGTH.\n\t    IS: %d\n\tSHOULD BE: %d<<<\n",
+                       (int) ann_len, (int) HDstrlen(file_lab[i]));
+                num_errs++;
+            }
+
+          /* allocate space for label */
+          if (ann_label == NULL)
+            {
+                if ((ann_label = (char *)HDmalloc((ann_len+1)*sizeof(char))) 
+                    == NULL)
+                  {
+                      printf("Error: failed to allocate space to hold file label \n");
+                      return FAIL;
+                  }
+                HDmemset(ann_label,'\0', ann_len+1);
+            }
+      
+          /* read label */
+          ret = ANreadann(ann_handle, ann_label, ann_len+1);
+          RESULT("ANreadann");
+
+          /* end acces to label */
+          ret = ANendaccess(ann_handle);
+          RESULT("ANendaccess");      
+      
+          /* check label */
+          if (HDstrncmp((const char *)ann_label, (const char *)file_lab[i],(size_t)(ann_len+1)) != 0)
+            {
+                printf("\t>>>BAD FILE LABEL. \n\t       IS: %s; \n\tSHOULD BE: %s<<<\n",
+                       ann_label, file_lab[i]);
+                num_errs++;
+            }
+
+#ifdef AN_DEBUG
+          printf("found ann_len=%d, file label=%s\n", strlen(ann_label),ann_label);
+#endif
+
+          HDfree(ann_label); /* free up space */
+          ann_label = NULL;
+      } /* end for nflabs */
+
+    /* read file descriptions */
+    for (i = 0; i < nfdescs; i++)
+      { /* select file label */
+          indx = i;
+          ann_handle = ret = ANselect(an_handle, indx, AN_FILE_DESC);
+          RESULT("ANselect");
+
+          /* get file label length */
+          ann_len = ret = ANannlen(ann_handle);
+          RESULT("ANannlen");
+        
+          /* check ann length */
+          if (ann_len != (int32) HDstrlen(file_desc[i]))
+            {
+                printf("\t>>>BAD FILE DESC LENGTH.\n\t    IS: %d\n\tSHOULD BE: %d<<<\n",
+                       (int) ann_len, (int) HDstrlen(file_desc[i]));
+                num_errs++;
+            }
+
+          /* allocate space for desc */
+          if (ann_desc == NULL)
+            {
+                if ((ann_desc = (char *)HDmalloc((ann_len+1)*sizeof(char))) 
+                    == NULL)
+                  {
+                      printf("Error: failed to allocate space to hold file desc  \n");
+                      return FAIL;
+                  }
+                HDmemset(ann_desc,'\0', ann_len+1);
+            }
+      
+          /* read desc */
+          ret = ANreadann(ann_handle, ann_desc, ann_len+1);
+          RESULT("ANreadann");
+
+          /* end access to desc */
+          ret = ANendaccess(ann_handle);
+          RESULT("ANendaccess");      
+            
+          /* check desc */
+          if (HDstrncmp((const char *)ann_desc,(const char *)file_desc[i],(size_t)(ann_len+1)) != 0)
+            {
+                printf("\t>>>BAD FILE DESC. \n\t       IS: %s; \n\tSHOULD BE: %s<<<\n",
+                       ann_desc, file_desc[i]);
+                num_errs++;
+            }
+
+#ifdef AN_DEBUG
+          printf("found ann_len=%d, file desc=%s\n", strlen(ann_desc),ann_desc);
+#endif
+
+          HDfree(ann_desc); /* free up space */
+          ann_desc = NULL;
+      } /* end for nfdescs */
+
+    /* Clean up */
+    if (ann_label != NULL)
+        HDfree(ann_label);
+    if (ann_desc != NULL)
+        HDfree(ann_desc);
+
+    /* end access to annotations */
+    ANend(an_handle);
+    Hclose(file_handle);   /* close file */
+
+    return SUCCEED;
+} /* check_fann() */
+
+
+/****************************************************************
+**
+**  check_lab_desc:  read and compare label and description
+**                   with expected ones
+**
+****************************************************************/
+static  int32
+check_lab_desc(const char *fname, uint16 tag, uint16 ref, const char *label[], 
+               const char *desc[])
+{
+    int32 ret = SUCCEED;         /* return value */
+    int32 file_handle; /* file handle */
+    int32 an_handle;   /* annotation interface handle */
+    int32 nflabs,      /* number of file labels */
+        nfdescs,     /* number of file descs */
+        nolabs,      /* total number of data labels */
+        nodescs;     /* total number of data descs */
+    int32 ann_len;     /* length of annotation */
+    char *ann_label = NULL; /* annotation label */
+    char *ann_desc = NULL;  /* annotation desc */
+    intn  num_dlabels,  /* number of data labels for an element */
+        num_ddescs;   /* number of data descs for an element */
+    int32 *dlabels = NULL; /* array of data lables for an element */
+    int32 *ddescs = NULL;  /* array of data descs for an element */
+    int i;
+
+    /* open file again */
+    ret = file_handle = Hopen(fname, DFACC_READ, 0);
+    RESULT("Hopen");
+
+    /* Start annotation interface */
+    ret = an_handle = ANstart(file_handle);
+    RESULT("ANstart");
+
+    /* Get Info On Annotations In File */
+    ret = ANfileinfo(an_handle, &nflabs, &nfdescs, &nolabs, &nodescs);
+    RESULT("Anfileinfo");
+#ifdef AN_DEBUG
+    printf("There Are Nflabs=%d, Nfdescs=%d, Nolabs=%d, Nodescs=%d \n",nflabs,
+           nfdescs, nolabs, nodescs);
+#endif
+
+    /* Get number of label annotations with this tag/ref */
+    num_dlabels = ret = ANnumann(an_handle, AN_DATA_LABEL, tag, ref);
+    RESULT("ANnumann");
+#ifdef AN_DEBUG
+    printf("there are %d data labels for tag=%d, ref=%d \n", num_dlabels, 
+           tag, ref);
+#endif
+
+    /* Get number of label descs with this tag/ref */
+    num_ddescs = ret = ANnumann(an_handle, AN_DATA_DESC, tag, ref);
+    RESULT("ANnumann"); 
+#ifdef AN_DEBUG
+    printf("There Are %d Data Descriptions For Tag=%d, Ref=%d \n", 
+           num_ddescs, tag, ref);
+#endif
+
+    /* allocate space for list of label annotation id's with this tag/ref */
+    if (num_dlabels == 0)
+      {
+          printf("Error: no data labels found\n");
+          num_errs++;
+      }
+    else
+      {
+          if ((dlabels = (int32 *)HDmalloc(num_dlabels * sizeof(int32))) == NULL)
+            {
+                printf("Error: failed to allocate space to hold data label ids\n");
+                return FAIL;
+            }
+      }
+
+    /* allocate space for list of description annotation id's with this tag/ref */
+    if (num_ddescs == 0)
+      {
+          printf("Error: no data descriptions found\n");
+          num_errs++;
+      }
+    else
+      {
+          if ((ddescs = (int32 *)HDmalloc(num_ddescs * sizeof(int32))) == NULL)
+            {
+                printf("Error: failed to allocate space to hold data descs ids\n");
+                return FAIL;
+            }
+      }
+
+    /* get list of label annotations id's with this tag/ref */
+    ret = ANannlist(an_handle, AN_DATA_LABEL, tag, ref, dlabels);
+    RESULT("ANannlist");
+    if (ret != num_dlabels)
+        printf("Error:ret!=nlabels there are %d data labels for tag=%d,ref=%d \n", 
+               num_dlabels, tag, ref);
+
+    /* get list of description annotations id's with this tag/ref */
+    ret = ANannlist(an_handle, AN_DATA_DESC, tag, ref, ddescs);
+    RESULT("ANannlist");
+    if (ret != num_ddescs)
+        printf("Error:ret!=ndescs there are %d data descss for tag=%d,ref=%d \n", 
+               num_ddescs, tag, ref);
+
+    /* loop through label list */
+    for (i = 0; i < num_dlabels; i++)
+      {
+          /* get annotation label length */
+          ann_len = ret = ANannlen(dlabels[i]);
+          RESULT("ANannlen");
+        
+          /* check ann length */
+          if (ann_len != (int32) HDstrlen(label[i]))
+            {
+                printf("\t>>>BAD DATA LABEL LENGTH.\n\t    IS: %d\n\tSHOULD BE: %d<<<\n",
+                       (int) ann_len, (int) HDstrlen(label[i]));
+                num_errs++;
+            }
+
+          /* allocate space for label */
+          if (ann_label == NULL)
+            {
+                if ((ann_label = (char *)HDmalloc((ann_len+1)*sizeof(char))) 
+                    == NULL)
+                  {
+                      printf("Error: failed to allocate space to hold data label \n");
+                      return FAIL;
+                  }
+                HDmemset(ann_label,'\0', ann_len+1);
+            }
+      
+          /* read label */
+          ret = ANreadann(dlabels[i], ann_label, ann_len+1);
+          RESULT("ANreadann");
+
+          /* end acces to label */
+          ret = ANendaccess(dlabels[i]);
+          RESULT("ANendaccess");      
+
+          /* check label */
+          if (HDstrncmp((const char *)ann_label, (const char *)label[i], (size_t)(ann_len+1)) != 0)
+            {
+                printf("\t>>>BAD DATA LABEL. \n\t       IS: %s; \n\tSHOULD BE: %s<<<\n",
+                       ann_label, label[i]);
+                num_errs++;
+            }
+
+#ifdef AN_DEBUG
+          printf("found data_len=%d, data label=%s\n", strlen(ann_label),ann_label);
+#endif
+
+          HDfree(ann_label); /* free up space */
+          ann_label = NULL;
+      } /* end for labels */
+
+    /* loop through desc list */
+    for (i = 0; i < num_ddescs; i++)
+      {
+          /* get desc length */
+          ann_len = ret = ANannlen(ddescs[i]);
+          RESULT("ANannlen");
+
+          /* check desc length */
+          if (ann_len != (int32) HDstrlen(desc[i]))
+            {
+                printf("\t>>>BAD DATA DESC LENGTH.\n\t    IS: %d\n\tSHOULD BE: %d<<<\n",
+                       (int) ann_len, (int) HDstrlen(desc[i]));
+                num_errs++;
+            }
+
+          /* allocate space for descritpion */
+          if (ann_desc == NULL)
+            {
+                if ((ann_desc = (char *)HDmalloc((ann_len+1)*sizeof(char))) 
+                    == NULL)
+                  {
+                      printf("Error: failed to allocate space to hold data desc \n");
+                      return FAIL;
+                  }
+                HDmemset(ann_desc,'\0', ann_len+1);
+            }
+
+          /* read description */
+          ret = ANreadann(ddescs[i], ann_desc, ann_len+1);
+          RESULT("ANreadann");
+
+          /* end access to desc */
+          ret = ANendaccess(ddescs[i]);
+          RESULT("ANendaccess");      
+
+          /* check desc */
+          if (HDstrncmp((const char *)ann_desc, (const char *)desc[i], (size_t)ann_len) != 0)
+            {
+                printf("\t>>>BAD DATA DESC. \n\t       IS: %s; \n\tSHOULD BE: %s<<<\n",
+                       ann_desc, desc[i]);
+                num_errs++;
+            }
+
+#ifdef AN_DEBUG
+          printf("found data desclen=%d, desc=%s\n", strlen(ann_desc),ann_desc);
+#endif
+
+          HDfree(ann_desc); /* free up space */
+          ann_desc = NULL;
+      } /* end for descs */
+    
+    /* free space */
+    if (dlabels != NULL)
+        HDfree(dlabels);
+    if (ddescs != NULL)
+        HDfree(ddescs);
+    if (ann_label != NULL)
+        HDfree(ann_label);
+    if (ann_desc != NULL)
+        HDfree(ann_desc);
+
+    /* End annotation interface */
+    ANend(an_handle);
+    Hclose(file_handle);   /* close file */
+  
+    return SUCCEED;
+} /* check_lab_desc() */
+
+/****************************************************************
+**
+**  test_man(): Main annotation test routine
+** 
+**  NOTES: Keep in mind the order in which labels/descriptiosn
+**         are written to the file to make sense of the indices
+**         returned by ANfileinfo().
+**  
+**  Steps in testing:
+**  1. Create arrays for SDS and RI
+**  2. Open/Create test file.
+**  3. Start Annotation inteface.
+**  4. Write file labels and descriptions.
+**  5. For 'REPs' count do
+**     A. create/write SDS(DFSDxxx) to file.
+**     B. Write 2 labels and 2 descriptons for SDS.
+**     C. Write image(DFR8xxx) to file
+**     D. Write 2 labels and 2 descriptions for RI.
+**  6. Close annotation inteface 
+**  7. Close file
+**  8. For 'REPs' count do
+**     A. Get dimesion and ref of SDS
+**     B. Verify label and descriptions for SDS ->check_lab_desc()
+**     C. Get image ref and image
+**     D. Verify label and descriptions for Image->check_lab_desc()
+**  9. Check file labels and descriptions->check_fann()
+** 10. Clean up.
+****************************************************************/
+void
+test_man(void)
+{
+    uint8  pal[768];
+    uint8  *image = NULL;
+    uint8  *newimage = NULL;
+    uint16 refnum;
+    int32  ret;
+    intn   rank;
+    int    i,j;
+    int32  dimsizes[2];
+    float32  *data = NULL;
+    int32   file_handle; /* file handle */
+    int32   an_handle;  /* annotation interface handle */
+    int32   ann_handle;  /* annotation handle */
+
+    /***** generate float array and image *****/
+    if ((data     = (float32 *) HDmalloc(ROWS * COLS * sizeof(float32))) == NULL)
+      {
+          fprintf(stderr,"Error: unable to allocate space\n");
+          return;
+      }
+    if ((image    = (uint8 *) HDmalloc(ROWS * COLS * sizeof(char))) == NULL)
+      {
+          fprintf(stderr,"Error: unable to allocate space\n");
+          return;
+      }
+    if ((newimage = (uint8 *) HDmalloc(ROWS * COLS * sizeof(char))) == NULL)
+      {
+          fprintf(stderr,"Error: unable to allocate space\n");
+          return;
+      }
+
+    /* dimensions of SDS/image */
+    dimsizes[0] = ROWS;
+    dimsizes[1] = COLS;
+
+    /* generate images */
+    gen2Dfloat(ROWS, COLS, data);
+    genimage(ROWS, COLS, data, image);
+
+    /* Start annotation Interface on file */
+    ret = file_handle = Hopen(TESTFILE, DFACC_CREATE,0);
+    RESULT("Hopen");
+    ret = an_handle = ANstart(file_handle);
+    RESULT("ANstart");
+
+    /********  Write file labels and descriptions *********/
+    MESSAGE(5, printf("***  Writing file labels and descriptions ***\n"););
+
+    /* create and write file labels */
+    for (i = 1; i >= 0; i--)
+      {
+          ret = ann_handle = ANcreatef(an_handle, AN_FILE_LABEL);
+          RESULT("ANcreatef");
+          ret = ANwriteann(ann_handle, file_lab[i], (int32)HDstrlen(file_lab[i]));
+          RESULT("ANwriteann");
+          ret = ANendaccess(ann_handle);
+          RESULT("ANendaccess");
+      }
+
+    /* create and write file descriptions */
+    for (i = 1; i >= 0; i--)
+      {
+          ret = ann_handle = ANcreatef(an_handle, AN_FILE_DESC);
+          RESULT("ANcreatef");
+          ret = ANwriteann(ann_handle, file_desc[i], (int32)HDstrlen(file_desc[i]));
+          RESULT("ANwriteann");
+          ret = ANendaccess(ann_handle);
+          RESULT("ANendaccess");
+      }
+
+    /* set dimensions for SDS */
+    ret = DFSDsetdims(2, dimsizes);
+    RESULT("DFSDsetdims");
+
+    /********  Write labels and descriptions *********/
+    MESSAGE(5, printf("***  Writing labels and descriptions along with SDS and RIS ***\n"););
+
+    for (j = 0; j < REPS; j++)
+      {
+          /* Set number type */
+          ret = DFSDsetNT(DFNT_FLOAT32);
+          RESULT("DFSDsetNT");
+
+          /* write out scientific data set first */
+          ret = DFSDadddata(TESTFILE, 2, dimsizes, (VOIDP) data);
+          RESULT("DFSDadddata");
+
+          /* write out annotations for 2 out of every 3 SDS */
+          if ((j % 2) != 0)
+            {   
+                refnum = DFSDlastref(); /* get ref of SDS */
+
+                /* create and write data labels */
+                for (i = 1; i >=0; i--)
+                  {
+                      ret = ann_handle = ANcreate(an_handle, DFTAG_NDG, refnum, 
+                                                  AN_DATA_LABEL);
+                      RESULT("ANcreate");
+                      ret = ANwriteann(ann_handle, labsds[i], (int32)HDstrlen(labsds[i]));
+                      RESULT("ANwriteann");
+                      ret = ANendaccess(ann_handle);
+                      RESULT("ANendaccess");
+                  }
+
+                /* create and write data descriptions */
+                for (i = 1; i >=0; i--)
+                  {
+                      ret = ann_handle = ANcreate(an_handle, DFTAG_NDG, refnum, 
+                                                  AN_DATA_DESC);
+                      RESULT("ANcreate");
+                      ret = ANwriteann(ann_handle, descsds[i], (int32)HDstrlen(descsds[i]));
+                      RESULT("ANwriteann");
+                      ret = ANendaccess(ann_handle);
+                      RESULT("ANendaccess");
+                  }
+            }
+
+          /* Write image out */
+          ret = DFR8addimage(TESTFILE, (VOIDP) image, COLS, ROWS, 0);
+          RESULT("DFR8addimage");
+
+          refnum = DFR8lastref(); /* get ref of image */
+
+          /* create and write image labels */
+          for (i = 1; i >=0; i--)
+            {
+                ret = ann_handle = ANcreate(an_handle, DFTAG_RIG, refnum, 
+                                            AN_DATA_LABEL);
+                RESULT("ANcreate");
+                ret = ANwriteann(ann_handle, labris[i], (int32)HDstrlen(labris[i]));
+                RESULT("ANwriteann");
+                ret = ANendaccess(ann_handle);
+                RESULT("ANendaccess");
+            }
+
+          /* create and write image descriptions */
+          for (i = 1; i >=0; i--)
+            {
+                ret = ann_handle = ANcreate(an_handle, DFTAG_RIG, refnum, 
+                                            AN_DATA_DESC);
+                RESULT("ANcreate");
+                ret = ANwriteann(ann_handle, descris[i], (int32)HDstrlen(descris[i]));
+                RESULT("ANwriteann");
+                ret = ANendaccess(ann_handle);
+                RESULT("ANendaccess");
+            }
+      } /* end for j */
+
+    /* End writing annotations */
+    ANend(an_handle);
+    Hclose(file_handle); /* close file */
+  
+    /********  Read labels and descriptions *********/
+    MESSAGE(5, printf("*** Reading labels and descriptions for SDS and RIS ***\n"););
+
+    for (j = 0; j < REPS; j++)
+      { /* get dims for SDS */
+          ret = DFSDgetdims(TESTFILE, &rank, dimsizes, 3);
+          RESULT("DFSDgetdims");
+
+          refnum = DFSDlastref(); /* now get ref of SDS */
+
+          /* Check data set labels/descriptions of SDS */
+          if ((j % 2) != 0)     /* read in annotations for 2 out of every 3 */
+            {
+                if (check_lab_desc(TESTFILE, DFTAG_NDG, refnum, labsds, descsds) == FAIL)
+                    return; /* end of test */
+            }
+
+          /* get image */
+          ret = DFR8getimage(TESTFILE, newimage, (int32) COLS, (int32) ROWS, pal);
+          RESULT("DFR8getimage");
+
+          refnum = DFR8lastref(); /* now get ref of image */
+
+          /* Check image labels/descriptions of image */
+          if (check_lab_desc(TESTFILE, DFTAG_RIG, refnum, labris, descris) == FAIL)
+              return; /* end of test */
+      }
+
+    /***************** Read file labels and descriptions */
+    MESSAGE(5, printf("*** Reading file label and descriptions ***\n"););
+
+    /* Verify file lables/descs */
+    if (check_fann(TESTFILE) == FAIL)
+        return; /* end of test */
+
+    /* check the re-writing of annotations works. 
+       Only file labels are tested but it should suffice to
+       test the internals */
+    if (check_fann_rewrite(TESTFILE) == FAIL)
+        return; /* end of test */
+
+    /* free up space */
+    HDfree((VOIDP) data);
+    HDfree((VOIDP) image);
+    HDfree((VOIDP) newimage);
+} /* test_man() */
diff --git a/hdf/test/manf.f b/hdf/test/manf.f
new file mode 100644
index 0000000..79796fe
--- /dev/null
+++ b/hdf/test/manf.f
@@ -0,0 +1,598 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: manf.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+      subroutine manf (number_failed)
+C
+C
+C  Test program: stores annotations in a file using fortran multi-file
+C                annotation interface.
+C                Writes several SDSs and corresponding RISs to a file.
+C                Writes labels and descriptions for all 2 out of 3 SDS
+C                Writes labels and descriptions for all RISs.
+C
+C  Input file:   none
+C  Output files: manf.hdf
+C
+      implicit none
+      include 'fortest.inc'
+
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'manf')
+
+      integer afstart, afend, afcreate, affcreate
+      integer afwriteann, afendaccess, hopen, hclose
+
+      integer dssdims, dsadata, dslref, dsgdims
+      integer d8aimg, DFR8lastref, d8gimg
+
+      integer numberfailed, ISFIRST, NOTFIRST, MAXLENLAB
+      integer MAXLEN_DESC, ROWS, COLS, REPS
+      integer DFTAG_SDG, DFTAG_RIG
+
+      parameter ( ISFIRST =        1, 
+     *            NOTFIRST =       0, 
+     *            MAXLENLAB =    30,
+     *            MAXLEN_DESC =  500, 
+     *            DFTAG_SDG   =  700,
+     *            DFTAG_RIG   =  306,
+     *            ROWS =          10, 
+     *            COLS =          10,
+     *            REPS =           2 )
+
+      integer refnum
+      integer ret
+      integer rank
+      integer j, dimsizes(2)
+      integer fhandle, anhandle, ahandle
+      integer  DFACC_CREATE, DFACC_READ
+      integer AN_DATA_LABEL, AN_DATA_DESC, AN_FILE_LABEL, AN_FILE_DESC
+
+      character*30 labsds, labsds2 
+      character*30 labris, labris2
+      character*500 descsds, descsds2
+      character*500 descris, descris2
+      character*35 lab1, lab2
+      character*100 desc1, desc2
+      character pal(768)
+      character*64 TESTFILE
+
+      character*1 CR
+      character image(ROWS, COLS), newimage(ROWS, COLS)
+      real      data(ROWS, COLS)
+
+
+      call ptestban('Testing', myname)
+      number_failed = 0
+      numberfailed =  0
+      CR = char(10)
+      DFACC_CREATE = 4
+      DFACC_READ   = 1
+      AN_DATA_LABEL = 0
+      AN_DATA_DESC  = 1
+      AN_FILE_LABEL = 2
+      AN_FILE_DESC  = 3
+      TESTFILE = 'manf.hdf'
+
+C *** set up file labels and descriptions ***
+      lab1 = 'File label #1: aaa'
+      lab2 = 'File label #2: bbbbbb'
+      desc1 = 'File descr #1: This is a test file annotation'
+      desc2 = 'File descr #2: One more test ...'
+
+C *** set up object labels and descriptions ***
+
+      labsds  = 'Object label #1: sds'
+      labsds2 = 'Object label #1: sds2'
+      labris  = 'Object label #2: image'
+      labris2 = 'Object label #2: image2'
+      descsds = 'Object Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 ' 
+     *          // CR // '                13 14 15 16 17 18 19 20 '
+     *          // ' **END SDS DESCR**'
+      descsds2 = 'Object Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 ' 
+     *          // CR // '                13 14 15 16 17 18 19 20 '
+     *          // ' **END SDS2 DESCR**'
+      descris = 'Object Descr #2: A B C D E F G H I J K L '
+     *          // CR // '                M N O **END IMAGE DESCR **'
+      descris2 = 'Object Descr #2: A B C D E F G H I J K L '
+     *          // CR // '                M N O **END IMAGE2 DESCR **'
+
+C  *** generate float array and image ***
+ 
+      rank = 2
+      dimsizes(1)=ROWS 
+      dimsizes(2)=COLS
+
+      call gen2Dfloat(ROWS, COLS, data)
+      call genimage(ROWS, COLS, data, image)
+
+      ret = dssdims(rank,dimsizes)
+      call VRFY(ret,'dssdims',number_failed)
+
+C  *** start annotation on file ***
+      fhandle = hopen(TESTFILE,DFACC_CREATE, 0)
+      ret = fhandle
+      call VRFY(ret,'fhanlde',number_failed)
+      ahandle = afstart(fhandle)
+      ret = ahandle
+      call VRFY(ret,'afstart',number_failed)
+
+C  *** write file 2 labels/ 2 descriptions ***
+      anhandle = affcreate(ahandle, AN_FILE_LABEL)
+      ret = anhandle
+      call VRFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,lab2,len(lab2))
+      call VRFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VRFY(ret, 'afendaccess', number_failed)
+
+      anhandle = affcreate(ahandle, AN_FILE_LABEL)
+      ret = anhandle
+      call VRFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,lab1,len(lab1))
+      call VRFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VRFY(ret, 'afendaccess', number_failed)
+
+      anhandle = affcreate(ahandle, AN_FILE_DESC)
+      ret = anhandle
+      call VRFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,desc2,len(desc2))
+      call VRFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VRFY(ret, 'afendaccess', number_failed)
+
+      anhandle = affcreate(ahandle, AN_FILE_DESC)
+      ret = anhandle
+      call VRFY(ret, 'affcreate', number_failed)
+      ret = afwriteann(anhandle,desc1,len(desc1))
+      call VRFY(ret, 'afwriteann', number_failed)
+      ret = afendaccess(anhandle)
+      call VRFY(ret, 'afendaccess', number_failed)
+
+C  ***  Write data labels and descriptions ***
+
+      call MESSAGE(VERBO_HI,
+     +    '***  Writing labels & descriptions with SDS and RIS ***')
+
+      do 100 j=1,REPS
+C  ***  write out scientific data set 
+         ret = dsadata(TESTFILE, rank,dimsizes, data)
+         call VRFY(ret, 'dsadata', number_failed)
+
+C ****    write out annotations for 2 out of every 3 
+         if (mod(j,3) .ne. 0) then 
+            refnum = dslref()
+
+C ********** Write out 2 labels for each SDS *****************
+            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_LABEL)
+            ret = anhandle
+            call VRFY(ret, 'afcreate', number_failed)
+            ret = afwriteann(anhandle,labsds2,len(labsds2))
+            call VRFY(ret, 'afwriteann', number_failed)
+            ret = afendaccess(anhandle)
+            call VRFY(ret, 'afendaccess', number_failed)
+
+            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_LABEL)
+            ret = anhandle
+            call VRFY(ret, 'afcreate', number_failed)
+            ret = afwriteann(anhandle,labsds,len(labsds))
+            call VRFY(ret, 'afwriteann', number_failed)
+            ret = afendaccess(anhandle)
+            call VRFY(ret, 'afendaccess', number_failed)
+
+C *********** Write out 2 descritptions for each SDS ***********
+            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_DESC)
+            ret = anhandle
+            call VRFY(ret, 'afcreate', number_failed)
+            ret = afwriteann(anhandle,descsds2,len(descsds2))
+            call VRFY(ret, 'afwriteann', number_failed)
+            ret = afendaccess(anhandle)
+            call VRFY(ret, 'afendaccess', number_failed)
+
+            anhandle = afcreate(ahandle,DFTAG_SDG,refnum,AN_DATA_DESC)
+            ret = anhandle
+            call VRFY(ret, 'afcreate', number_failed)
+            ret = afwriteann(anhandle,descsds,len(descsds))
+            call VRFY(ret, 'afwriteann', number_failed)
+            ret = afendaccess(anhandle)
+            call VRFY(ret, 'afendaccess', number_failed)
+
+         endif
+
+         ret = d8aimg(TESTFILE, image, COLS, ROWS, 0)
+         call VRFY(ret, 'd8aimg', number_failed)
+         refnum = DFR8lastref()
+
+C ********** Write out 2 labels for each Image *****************
+          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_LABEL)
+          ret = anhandle
+          call VRFY(ret, 'afcreate', number_failed)
+          ret = afwriteann(anhandle,labris2,len(labris2))
+          call VRFY(ret, 'afwriteann', number_failed)
+          ret = afendaccess(anhandle)
+          call VRFY(ret, 'afendaccess', number_failed)
+
+          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_LABEL)
+          ret = anhandle
+          call VRFY(ret, 'afcreate', number_failed)
+          ret = afwriteann(anhandle,labris,len(labris))
+          call VRFY(ret, 'afwriteann', number_failed)
+          ret = afendaccess(anhandle)
+          call VRFY(ret, 'afendaccess', number_failed)
+
+C *********** Write out 2 descritptions for each Image ***********
+          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_DESC)
+          ret = anhandle
+          call VRFY(ret, 'afcreate', number_failed)
+          ret = afwriteann(anhandle,descris2,len(descris2))
+          call VRFY(ret, 'afwriteann', number_failed)
+          ret = afendaccess(anhandle)
+          call VRFY(ret, 'afendaccess', number_failed)
+
+          anhandle = afcreate(ahandle, DFTAG_RIG, refnum, AN_DATA_DESC)
+          ret = anhandle
+          call VRFY(ret, 'afcreate', number_failed)
+          ret = afwriteann(anhandle,descris,len(descris))
+          call VRFY(ret, 'afwriteann', number_failed)
+          ret = afendaccess(anhandle)
+          call VRFY(ret, 'afendaccess', number_failed)
+
+  100 continue
+
+C ******* End writing annotatons **********
+      ret = afend(ahandle)
+      call VRFY(ret, 'afend', number_failed)
+      ret = hclose(fhandle)
+      call VRFY(ret, 'hclose', number_failed)
+
+
+C********  Read data labels and descriptions *********
+      call MESSAGE(VERBO_HI,
+     +    '*** Reading labels and descriptions for SDS and RIS ***')
+
+      do 200 j=1,REPS
+          ret = dsgdims(TESTFILE, rank,dimsizes,3)
+          call VRFY(ret, 'dsgdims', number_failed)
+          refnum = dslref()
+
+C ******  read in annotations for 2 out of every 3 
+          if (mod(j,3) .ne. 0) then
+              call man_check_lab_desc(TESTFILE, DFTAG_SDG, refnum, 
+     *                            labsds, descsds, numberfailed)
+
+              call man_check_lab_desc(TESTFILE, DFTAG_SDG, refnum, 
+     *                            labsds2, descsds2, numberfailed)
+          endif
+
+C ****    read annotations for images
+          ret = d8gimg(TESTFILE, newimage, COLS, ROWS, pal)
+          call VRFY(ret, 'd8gimg', number_failed)
+          refnum = DFR8lastref()
+          call man_check_lab_desc(TESTFILE, DFTAG_RIG, refnum, 
+     *                        labris, descris, numberfailed)
+
+          call man_check_lab_desc(TESTFILE, DFTAG_RIG, refnum, 
+     *                        labris2, descris2, numberfailed)
+      
+  200 continue
+
+C ****** Check file labels/descriptions *******
+      call MESSAGE(VERBO_HI,
+     +    '*** Reading file labels and descriptions ***')
+
+      call check_fan(TESTFILE, 0, lab1, desc1, numberfailed)
+      call check_fan(TESTFILE, 1, lab2, desc2, numberfailed)
+
+      if ( numberfailed .eq. 0 ) then
+          call MESSAGE(VERBO_HI,
+     +        '***** ALL ANxxx TESTS SUCCESSFUL ***** ')
+      else
+          print *,'***** ',numberfailed,' TESTS FAILED ***** '
+      endif
+
+      return
+      end
+
+
+C**************************************************************
+C
+C  man_check_lab_desc:  read and compare label and description
+C                   with expected ones
+C
+C**************************************************************
+      subroutine man_check_lab_desc(fname, tag, ref, label, desc, 
+     *                          num_failed)
+      implicit none
+      include 'fortest.inc'
+
+      character*(*) fname, label, desc
+      integer tag, ref, num_failed
+
+      integer MAXLENLAB, MAXLEN_DESC
+      parameter ( MAXLENLAB =    30,
+     *            MAXLEN_DESC =  500 )
+      character*15 ERR_FILE
+      parameter (ERR_FILE = 'Fortran_err.dat')
+
+      integer  inlablen, indesclen, ret
+
+      integer affileinfo, afnumann, afannlist, afannlen
+      integer afreadann, afstart, afend, afendaccess, hopen, hclose
+      integer hishdff, hestringf, heprntf
+      character*80 error_message
+
+      integer fileh, anh
+      integer nflabs, nfdescs, nolabs, nodescs
+      integer numdlabels, numddescs
+      integer annlen, j, found, fannlen
+      integer dlabels(2), ddescs(2)
+      character*30   inlabel, fannlabel
+      character*500 indesc, fanndesc
+      integer AN_DATA_LABEL, AN_DATA_DESC, AN_FILE_LABEL, AN_FILE_DESC
+      integer DFACC_READ
+      integer error_code
+      DFACC_READ = 1
+      AN_DATA_LABEL = 0
+      AN_DATA_DESC  = 1
+      AN_FILE_LABEL = 2
+      AN_FILE_DESC  = 3
+      error_code = 0
+
+C ***** Test if the file fname is an HDF file
+C
+C
+      ret = hishdff(fname)
+      if (ret .ne. 1) then
+          num_failed = num_failed + 1
+          write(*,*) 'HISHDFF function failed'
+      endif
+      ret = hestringf(error_code, error_message)
+      if (ret .ne. 0) then
+          num_failed = num_failed + 1
+          write(*,*) 'HESTRINGF function failed'
+          goto 1111
+      endif
+      if (error_message(1:len(error_message)) .ne. "No error") then
+          num_failed = num_failed + 1
+          write(*,*) 'HESTRINGF function failed'
+      endif
+1111  continue
+C
+C     Call hishdff with  file not being an hdf file. Call should return
+C     0 
+C
+      ret = hishdff('manf.f')
+      if (ret .ne. 0) then
+          num_failed = num_failed + 1
+          write(*,*) 'HISHDFF function failed'
+      endif
+C
+C *****  end of hishdff test
+C
+C *****start annotation access on file *****
+      fileh = hopen('nonexist', DFACC_READ,0)
+      ret = heprntf(ERR_FILE, 0)
+      fileh = hopen(fname, DFACC_READ,0)
+      ret = fileh
+      call VRFY(ret, 'hopen', num_failed)
+      anh = afstart(fileh)
+      ret = anh
+      call VRFY(ret, 'afstart', num_failed)
+
+      ret = affileinfo(anh,nflabs,nfdescs,nolabs,nodescs)
+      call VRFY(ret, 'affileinfo', num_failed)
+
+      numdlabels = afnumann(anh, AN_DATA_LABEL, tag, ref)
+      call VRFY(numdlabels, 'afnumann', num_failed)
+
+      numddescs = afnumann(anh, AN_DATA_DESC, tag, ref)
+      call VRFY(numddescs, 'afnumann', num_failed)
+
+      ret = afannlist(anh, AN_DATA_LABEL, tag, ref, dlabels)
+      call VRFY(ret, 'afannlist', num_failed)
+
+      ret = afannlist(anh, AN_DATA_DESC, tag, ref, ddescs)
+      call VRFY(ret, 'afannlist', num_failed)
+
+C ***** Look for label in list ******
+      found = 0
+      fannlen = 0
+      fannlabel = ' '
+      do 300 j=1, numdlabels
+         annlen = afannlen(dlabels(j))
+         call VRFY(annlen, 'afannlen', num_failed)
+
+         ret = afreadann(dlabels(j), inlabel, MAXLENLAB)
+         call VRFY(ret, 'afreadann', num_failed)
+         ret = afendaccess(dlabels(j))
+         call VRFY(ret, 'afendaccess', num_failed)
+
+         if (inlabel .eq. label) then
+            found = 1
+            inlablen = annlen
+            fannlabel = inlabel
+         endif
+
+  300 continue
+
+C ****** Check if we found label in list *****
+      if (inlablen .ne. len(label)) then
+         print *,'   >>>BAD LABEL LENGTH.'
+         print *,'                        IS: ', inlablen
+         print *,'                 SHOULD BE: ', len(label)
+         num_failed = num_failed + 1
+      endif
+
+      if (fannlabel .ne. label) then
+         print *,'   >>>BAD LABEL.'
+         print *,'                        IS: ', fannlabel
+         print *,'                 SHOULD BE: ', label
+         num_failed = num_failed + 1
+      endif
+
+C ***** look for description in list 
+      found = 0
+      fannlen = 0
+      fanndesc = ' '
+      do 400 j=1, numddescs
+         annlen = afannlen(ddescs(j))
+         call VRFY(annlen, 'afannlen', num_failed)
+
+         ret = afreadann(ddescs(j), indesc, MAXLEN_DESC)
+         call VRFY(ret, 'afreadann', num_failed)
+         ret = afendaccess(ddescs(j))
+         call VRFY(ret, 'afendaccess', num_failed)
+
+         if (indesc .eq. desc) then
+            found = 1
+            indesclen = annlen
+            fanndesc = indesc
+         endif
+
+  400 continue
+
+      if (indesclen .ne. len(desc)) then
+          print *,'   >>>BAD DESCRIPTION LENGTH.' 
+          print *,'                        IS: ', indesclen 
+          print *,'                 SHOULD BE: ', len(desc) 
+          num_failed = num_failed + 1 
+       endif
+
+       if (fanndesc .ne. desc) then
+          print *,'   >>>BAD DESCRIPTION.' 
+          print *,'                        IS: ', fanndesc 
+          print *,'                 SHOULD BE: ', desc 
+          num_failed = num_failed + 1 
+       endif
+
+C ****** close file *******
+      ret = afend(anh)
+      call VRFY(ret, 'afend', num_failed)
+      ret = hclose(fileh)
+      call VRFY(ret, 'hclose', num_failed)
+      ret = hclose(fileh)
+      ret = heprntf(ERR_FILE, 0)
+
+
+      return
+      end
+
+
+C************************************************************
+C
+C     SUBROUTINE check_fan
+C
+C************************************************************
+      subroutine check_fan(fname, index, label, desc, num_failed)
+      implicit none
+      include 'fortest.inc'
+
+      character*(*) fname, label, desc
+      integer index, num_failed
+
+      integer MAXLENFLAB, MAXLEN_FDESC
+      parameter ( MAXLENFLAB =    35,
+     *            MAXLEN_FDESC =  100 )
+
+      integer affileinfo, afselect, afannlen, afreadann
+      integer afstart, afend, afendaccess, hopen, hclose
+
+      integer ret
+      integer fileh, annh, anh
+      integer nflabs, nfdescs, nolabs, nodescs
+      integer fannlen
+      character*35 flabel
+      character*100 fdesc
+      integer AN_DATA_LABEL, AN_DATA_DESC, AN_FILE_LABEL, AN_FILE_DESC
+      integer DFACC_READ
+      DFACC_READ = 1
+      AN_DATA_LABEL = 0
+      AN_DATA_DESC  = 1
+      AN_FILE_LABEL = 2
+      AN_FILE_DESC  = 3
+
+C **** We check both file label/description
+      fileh = hopen(fname, DFACC_READ,0)
+      ret = fileh
+      call VRFY(ret, 'hopen', num_failed)
+      anh = afstart(fileh)
+      ret = anh
+      call VRFY(ret, 'afstart', num_failed)
+
+      ret = affileinfo(anh,nflabs,nfdescs,nolabs,nodescs)
+      call VRFY(ret, 'affileinfo', num_failed)
+
+C ***** Read file label **********
+      annh = afselect(anh, index, AN_FILE_LABEL)
+      call VRFY(ret, 'afselect', num_failed)
+
+      fannlen = afannlen(annh)
+      call VRFY(fannlen, 'afannlen', num_failed)
+
+      ret = afreadann(annh, flabel, fannlen)
+      call VRFY(ret, 'afreadann', num_failed)
+      ret = afendaccess(annh)
+      call VRFY(ret, 'afendaccess', num_failed)
+
+      if (fannlen .ne. len(label)) then
+         print *,'   >>>BAD LABEL LENGTH.'
+         print *,'                        IS: ', fannlen
+         print *,'                 SHOULD BE: ', len(label)
+         num_failed = num_failed + 1
+      endif
+
+      if (flabel .ne. label) then
+         print *,'   >>>BAD LABEL.'
+         print *,'                        IS: ', flabel
+         print *,'                 SHOULD BE: ', label
+         num_failed = num_failed + 1
+      endif
+
+C **** Read file description *****
+      annh = afselect(anh, index, AN_FILE_DESC)
+      call VRFY(ret, 'afselect', num_failed)
+
+      fannlen = afannlen(annh)
+      call VRFY(fannlen, 'afannlen', num_failed)
+
+      ret = afreadann(annh, fdesc, fannlen)
+      call VRFY(ret, 'afreadann', num_failed)
+      ret = afendaccess(annh)
+      call VRFY(ret, 'afendaccess', num_failed)
+
+      if (fannlen .ne. len(desc)) then
+          print *,'   >>>BAD DESCRIPTION LENGTH.' 
+          print *,'                        IS: ', fannlen 
+          print *,'                 SHOULD BE: ', len(desc) 
+          num_failed = num_failed + 1 
+       endif
+
+       if (fdesc .ne. desc) then
+          print *,'   >>>BAD DESCRIPTION.' 
+          print *,'                        IS: ', fdesc 
+          print *,'                 SHOULD BE: ', desc 
+          num_failed = num_failed + 1 
+       endif
+
+C ****** close file *******
+      ret = afend(anh)
+      call VRFY(ret, 'afend', num_failed)
+      ret = hclose(fileh)
+      call VRFY(ret, 'hclose', num_failed)
+
+      return
+      end
+
diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c
new file mode 100644
index 0000000..f718524
--- /dev/null
+++ b/hdf/test/mgr.c
@@ -0,0 +1,4093 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 5584 $";
+#endif
+
+/* $Id: mgr.c 5584 2011-04-13 18:25:06Z bmribler $ */
+
+/***********************************************************
+*
+* Test program:  mgr
+*
+* Test the multi-file raster image interface
+*
+*************************************************************/
+
+#define TESTFILE "tmgr.hdf"
+#define TESTFILE2 "tmgrchk.hdf"
+#define DATAFILE "test_files/tmgr.dat"
+
+#define MFGR_TESTER
+#include "tproto.h"
+#include "mfgr.h"
+
+/* Local pre-processor macros */
+#define XDIM    0
+#define YDIM    1
+#define MAX_IMG_NAME    64  /* Maximum length of image names for this test */
+
+/* Local Data to verify image information in datafile */
+const struct {
+    const char *name;
+    int32 ncomp;
+    int32 nt;
+    int32 il;
+    int32 dimsizes[2];
+    int32 n_attr;
+} datafile_info[]=
+  { /* This information applies to the "test_files/tmgr.dat" file */
+    {"Raster Image #0", 3, DFNT_UCHAR8, MFGR_INTERLACE_PIXEL, {13,15}, 2},
+    {"Raster Image #1", 3, DFNT_UCHAR8, MFGR_INTERLACE_LINE, {13,15}, 2},
+    {"Raster Image #2", 3, DFNT_UCHAR8, MFGR_INTERLACE_COMPONENT, {13,15}, 2},
+    {"Test Image #1", 4, DFNT_UINT16, MFGR_INTERLACE_PIXEL, {21,23}, 3},
+    {"Test Image #2", 2, DFNT_FLOAT64, MFGR_INTERLACE_PIXEL, {17,19}, 3}
+  };
+
+const uint8 image00[15][13][3]={
+{{0 ,0 ,0 },{1 ,1 ,1 },{2 ,2 ,2 },{3 ,3 ,3 },{4 ,4 ,4 },{5 ,5 ,5 },{6 ,6 ,6 },{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 }},
+{{1 ,1 ,1 },{2 ,2 ,2 },{3 ,3 ,3 },{4 ,4 ,4 },{5 ,5 ,5 },{6 ,6 ,6 },{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 }},
+{{2 ,2 ,2 },{3 ,3 ,3 },{4 ,4 ,4 },{5 ,5 ,5 },{6 ,6 ,6 },{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 }},
+{{3 ,3 ,3 },{4 ,4 ,4 },{5 ,5 ,5 },{6 ,6 ,6 },{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 }},
+{{4 ,4 ,4 },{5 ,5 ,5 },{6 ,6 ,6 },{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 }},
+{{5 ,5 ,5 },{6 ,6 ,6 },{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 }},
+{{6 ,6 ,6 },{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 }},
+{{7 ,7 ,7 },{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 }},
+{{8 ,8 ,8 },{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 },{20 ,20 ,20 }},
+{{9 ,9 ,9 },{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 },{20 ,20 ,20 },{21 ,21 ,21 }},
+{{10 ,10 ,10 },{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 },{20 ,20 ,20 },{21 ,21 ,21 },{22 ,22 ,22 }},
+{{11 ,11 ,11 },{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 },{20 ,20 ,20 },{21 ,21 ,21 },{22 ,22 ,22 },{23 ,23 ,23 }},
+{{12 ,12 ,12 },{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 },{20 ,20 ,20 },{21 ,21 ,21 },{22 ,22 ,22 },{23 ,23 ,23 },{24 ,24 ,24 }},
+{{13 ,13 ,13 },{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 },{20 ,20 ,20 },{21 ,21 ,21 },{22 ,22 ,22 },{23 ,23 ,23 },{24 ,24 ,24 },{25 ,25 ,25 }},
+{{14 ,14 ,14 },{15 ,15 ,15 },{16 ,16 ,16 },{17 ,17 ,17 },{18 ,18 ,18 },{19 ,19 ,19 },{20 ,20 ,20 },{21 ,21 ,21 },{22 ,22 ,22 },{23 ,23 ,23 },{24 ,24 ,24 },{25 ,25 ,25 },{26 ,26 ,26 }}
+};
+const uint8 image1[15][13][3]={
+{{0 ,1 ,2 },{3 ,4 ,5 },{6 ,7 ,8 },{9 ,10 ,11 },{12 ,0 ,1 },{2 ,3 ,4 },{5 ,6 ,7 },{8 ,9 ,10 },{11 ,12 ,0 },{1 ,2 ,3 },{4 ,5 ,6 },{7 ,8 ,9 },{10 ,11 ,12 }},
+{{1 ,1 ,3 },{3 ,5 ,5 },{7 ,7 ,9 },{9 ,11 ,11 },{13 ,1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 },{7 ,7 ,7 },{7 ,15 ,15 },{15 ,15 ,15 }},
+{{8 ,9 ,10 },{11 ,12 ,13 },{14 ,15 ,8 },{9 ,10 ,11 },{12 ,8 ,9 },{10 ,11 ,12 },{13 ,14 ,15 },{8 ,9 ,10 },{11 ,12 ,8 },{9 ,10 ,11 },{12 ,13 ,14 },{15 ,8 ,9 },{10 ,11 ,12 }},
+{{9 ,9 ,11 },{11 ,13 ,13 },{15 ,15 ,9 },{9 ,11 ,11 },{13 ,9 ,9 },{11 ,11 ,13 },{13 ,15 ,15 },{9 ,9 ,11 },{11 ,13 ,9 },{9 ,11 ,11 },{13 ,13 ,15 },{15 ,9 ,9 },{11 ,11 ,13 }},
+{{10 ,11 ,10 },{11 ,14 ,15 },{14 ,15 ,10 },{11 ,10 ,11 },{14 ,10 ,11 },{10 ,11 ,14 },{15 ,14 ,15 },{10 ,11 ,10 },{11 ,14 ,10 },{11 ,10 ,11 },{14 ,15 ,14 },{15 ,10 ,11 },{10 ,11 ,14 }},
+{{11 ,11 ,11 },{11 ,15 ,15 },{15 ,15 ,11 },{11 ,11 ,11 },{15 ,11 ,11 },{11 ,11 ,15 },{15 ,15 ,15 },{11 ,11 ,11 },{11 ,15 ,11 },{11 ,11 ,11 },{15 ,15 ,15 },{15 ,11 ,11 },{11 ,11 ,15 }},
+{{12 ,13 ,14 },{15 ,12 ,13 },{14 ,15 ,12 },{13 ,14 ,15 },{12 ,12 ,13 },{14 ,15 ,12 },{13 ,14 ,15 },{12 ,13 ,14 },{15 ,12 ,12 },{13 ,14 ,15 },{12 ,13 ,14 },{15 ,12 ,13 },{14 ,15 ,12 }},
+{{13 ,13 ,15 },{15 ,13 ,13 },{15 ,15 ,13 },{13 ,15 ,15 },{13 ,13 ,13 },{15 ,15 ,13 },{13 ,15 ,15 },{13 ,13 ,15 },{15 ,13 ,13 },{13 ,15 ,15 },{13 ,13 ,15 },{15 ,13 ,13 },{15 ,15 ,13 }},
+{{14 ,15 ,14 },{15 ,14 ,15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},{6.0,6.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}},
+{{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}},
+{{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}},
+{{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{6.0,6.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{9.0,9.0},{0.0,0.0}},
+{{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}}
+};
+
+static void test_mgr_init(void);
+static void test_mgr_image_b1a(int flag);
+static void test_mgr_image_b1b(int flag);
+static void test_mgr_image_b2a1aa(int flag);
+static void test_mgr_image_b2a1bb1(int flag);
+static void test_mgr_image_b2a1bb2(int flag);
+static void test_mgr_image_b2a1cc1(int flag);
+static void test_mgr_image_b2a1cc2(int flag);
+static void test_mgr_image_b2a2bb(int flag);
+static void test_mgr_image_b2a2cc(int flag);
+static void test_mgr_image_b2b1(int flag);
+static void test_mgr_image(int flag);
+static void test_mgr_index(int flag);
+static void test_mgr_interlace(int flag);
+static void test_mgr_lut(int flag);
+static void test_mgr_special(int flag);
+extern void test_mgr_attr();
+extern void test_mgr_compress();
+extern void test_mgr_dup_images();
+
+/* Test outline:
+    I. Interface Initialization
+        A. GRstart
+        B. GRend
+        C. GRfileinfo
+    II. Create Images
+        A. GRcreate/GRselect/GRendaccess w/GRgetiminfo
+        B. Write/Read images
+            1. With no Data
+                a. Default fill value
+                b. user defined fill value
+            2. With real Data
+                a. New Image
+                    1. With default fill value
+                        aa. Whole image
+                        bb. Sub-setted image
+                        cc. Sub-sampled image
+                    2. With user defined vill value
+                        aa. Whole image
+                        bb. Sub-setted image
+                        cc. Sub-sampled image
+                b. Existing Image
+                    1. Whole image
+                    2. Sub-setted image
+                    3. Sub-sampled image
+    III. ID/Ref/Index Functions
+        A. GRidtoref
+        B. GRreftoindex
+    IV. Interlace Functions [Need to be implemented]
+        A. GRreqlutil
+        B. GRreqimageil
+    V. Palette Functions
+        A. GRgetlutid w/GRgetlutinfo
+        B. Read/Write Palettes
+            1. GRwritelut
+            2. GRreadlut
+        C. GRluttoref
+    VI. Special Element Functions [Need to be implemented]
+        A. GRsetexternalfile
+        B. GRsetaccesstype
+    VII. Atribute Functions
+        A. GRattrinfo
+        B. Read/Write Attributes
+            1. GRsetattr
+            2. GRgetattr
+        C. GRfindattr
+    VIII. Old-Style Raster Image Access
+        A. Read data from RLE compressed image
+        B. Create RLE compressed image & write to it (not implemented)
+        C. Read data from 8-bit JPEG compressed image
+        D. Create 8-bit JPEG compressed image & write to it
+        E. Read data from 24-bit JPEG compressed image
+        F. Create 24-bit JPEG compressed image & write to it
+    IX. Compressed image Functions
+    X.  Chunking write/read test
+
+        
+*/
+
+/****************************************************************
+**
+**  test_mgr_init(): Multi-file Raster Initialization Test Routine
+** 
+**  I. Interface Initialization
+**      A. GRstart
+**      B. GRend
+**      C. GRfileinfo
+** 
+****************************************************************/
+static void
+test_mgr_init(void)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 n_datasets;       /* number of datasets */
+    int32 n_attrs;          /* number of attributes */
+    int32 ret;              /* generic return value */
+    char datafile[512] = "";
+    char *srcdir = getenv("srcdir");
+
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Initialization routines\n"););
+
+    MESSAGE(8, printf("Try creating a new file and checking it out\n"););
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(DATAFILE) + 1) < sizeof(datafile))) {
+        strcpy(datafile, srcdir);
+        strcat(datafile, "/");
+    }
+    strcat(datafile, DATAFILE);
+
+    /* Ok, now create a new file */
+    fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Try initializing the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    ret=(intn)GRfileinfo(grid,&n_datasets,&n_attrs);
+    CHECK_VOID(ret,FAIL,"GRfileinfo");
+
+    if(n_datasets!=0 || n_attrs!=0)
+      {
+          MESSAGE(3, printf("Error! Number of datasets/attributes in new file incorrect\n"););
+          num_errs++;
+      } /* end if */
+
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+
+    MESSAGE(8, printf("Try checking out an existing file\n"););
+
+    /* Ok, now check an existing file */
+
+    fid=Hopen(datafile,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Try initializing the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    ret=(intn)GRfileinfo(grid,&n_datasets,&n_attrs);
+    CHECK_VOID(ret,FAIL,"GRfileinfo");
+
+    if(n_datasets!=5 || n_attrs!=2)
+      {
+          MESSAGE(3, printf("Error! Number of datasets/attributes in existing file incorrect\n"););
+          num_errs++;
+      } /* end if */
+
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+}   /* end test_mgr_init() */
+
+/* Sub-tests for test_mgr_image() */
+static void test_mgr_image_b1a(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+/* B1a - Read/Write images - with no Data - Default Fill Value */
+    MESSAGE(8, printf("Check out I/O on image with no data, using the default fill value\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={4,5};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        float32 image[5][4][3]; /* space for the image data */
+        float32 image0[5][4][3]; /* space for the image data */
+        int32 start[2]; /* start of image data to grab */
+        int32 stride[2];/* stride of image data to grab */
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Empty Image",3,DFNT_FLOAT32,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+
+              /* Set Chunk cache to hold 3 chunks */
+              ret = GRsetchunkcache(riid, 3, 0);
+              CHECK_VOID(ret,FAIL,"GRsetchunkcache");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        HDmemset(image,255,(size_t)(dims[0]*dims[1]*3)*sizeof(float32));
+        /* '0' is the default fill value */
+        HDmemset(image0,0,(size_t)(dims[0]*dims[1]*3)*sizeof(float32));
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(image0)))
+          {
+              MESSAGE(3, printf("Error reading data for image with default fill value\n"););
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_image_b1a() */
+
+static void test_mgr_image_b1b(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+/* B1b - Read/Write images - with no Data - User-defined Fill Value */
+    MESSAGE(8, printf("Check out I/O on image with no data, using User Defined fill-value\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={5,7};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        float64 image[7][5][4]; /* space for the image data */
+        float64 fill_pixel[4]={1.3,-2.4,1000.3,.25};   /* pixel with fill values */
+        float64 image0[7][5][4]; /* space for the image data */
+        int32 start[2]; /* start of image data to grab */
+        int32 stride[2];/* stride of image data to grab */
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Empty Image2",4,DFNT_FLOAT64,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Set the fill-value */
+        ret=GRsetattr(riid,FILL_ATTR,DFNT_FLOAT64,sizeof(fill_pixel)/sizeof(float64),fill_pixel);
+        CHECK_VOID(ret,FAIL,"GRsetattr");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        HDmemset(image,0,(size_t)(dims[0]*dims[1]*4)*sizeof(float64));
+        /* fill the memory-only with the default pixel fill-value */
+        HDmemfill(image0,fill_pixel,sizeof(fill_pixel),sizeof(image0)/sizeof(fill_pixel));
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(image0)))
+          {
+              MESSAGE(3, printf("Error reading data for image with user defined fill-value\n"););
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_image_b1b() */
+
+static void test_mgr_image_b2a1aa(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+/* B2a1aa - Read/Write images - with real Data - New Image - with Default Fill Value - Whole Image */
+    MESSAGE(8, printf("Check out I/O on new image with real data, with Default fill-value, Whole Image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    3
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    8
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   2
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE int32
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_INT32
+
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={1,-2};   /* pixel with fill values */
+        TEST_VARTYPE fill_pixel2[TEST_NCOMP]={-2,1};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        int32 start[2]; /* start of image data to grab */
+        int32 stride[2];/* stride of image data to grab */
+        intn i,j;       /* local counting variables */
+
+        /* fill the memory-only with the default pixel fill-value */
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if((j%2)==0)
+                        HDmemcpy(&image0[i][j][0],fill_pixel,sizeof(fill_pixel));
+                    else
+                        HDmemcpy(&image0[i][j][0],fill_pixel2,sizeof(fill_pixel2));
+                } /* end for */
+          } /* end for */
+        HDmemcpy(image,image0,sizeof(image0));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a1aa",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(image0)))
+          {
+              MESSAGE(3, printf("%d:Error reading data for new image with default fill-value, whole image\n",__LINE__););
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_image_b2a1aa() */
+
+static void test_mgr_image_b2a1bb1(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+/* B2a1bb - Read/Write images - with real Data - New Image - with Default Fill Value - Sub-setted Image */
+    MESSAGE(8, printf("Check out I/O on new image with real data, with Default fill-value, Writing Sub-setted Image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    19
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    23
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   4
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE uint16
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_UINT16
+
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={40000,4800,3,1000};   /* pixel with fill values */
+        TEST_VARTYPE fill_pixel2[TEST_NCOMP]={1230,1,65000,35000};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE sub_image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE *sub_ptr;
+        int32 start[2]; /* start of image data to use */
+        int32 stride[2];/* stride of image data to use */
+        int32 count[2]; /* # of pixels of image data to use */
+        intn i,j,k;     /* local counting variables */
+
+        /* fill the memory-only with the default pixel fill-values */
+        HDmemset(image0,0,sizeof(image0));
+        sub_ptr=(TEST_VARTYPE *)sub_image;
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if(((i>(TEST_YDIM/3)) && (i<(2*TEST_YDIM/3)))
+                        && ((j>(TEST_XDIM/4)) && (j<(3*TEST_XDIM/4))))
+                      {
+                          if((j%2)==0)
+                              HDmemcpy(&image0[i][j][0],fill_pixel,sizeof(fill_pixel));
+                          else
+                              HDmemcpy(&image0[i][j][0],fill_pixel2,sizeof(fill_pixel2));
+                          HDmemcpy(sub_ptr,&image0[i][j][0],TEST_NCOMP*sizeof(TEST_VARTYPE));
+                          sub_ptr+=TEST_NCOMP;
+                      } /* end if */
+                } /* end for */
+          } /* end for */
+
+        /* initialize the disk buffer */
+        HDmemset(image,255,sizeof(image));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a1bb",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Create sub-setted window with only the filled pixels in it */
+        start[XDIM]=(TEST_XDIM/4)+1;
+        start[YDIM]=(TEST_YDIM/3)+1;
+        count[XDIM]=((3*TEST_XDIM/4)-(TEST_XDIM/4))-1;
+        count[YDIM]=((2*TEST_YDIM/3)-(TEST_YDIM/3))-1;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRwriteimage(riid,start,stride,count,sub_image);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Get the whole image back */
+        start[XDIM]=start[YDIM]=0;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(image0)))
+          {
+              MESSAGE(3, printf("%d:Error reading data for new image with default fill-value, sub-setted image\n",__LINE__););
+
+              MESSAGE(8, for(i=0; i<TEST_YDIM; i++) \
+                      for(j=0; j<TEST_XDIM; j++) \
+                          for(k=0; k<TEST_NCOMP; k++) \
+                              if(image[i][j][k]!=image0[i][j][k]) \
+                                  printf("Location: [%d][%d][%d] image=%u, image0=%u \n",i,j,k,(unsigned)image[i][j][k],(unsigned)image0[i][j][k]); );
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+} /* end test_mgr_image_b2a1bb1() */
+
+static void test_mgr_image_b2a1bb2(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+    MESSAGE(8, printf("Check out I/O on new image with real data, with Default fill-value, Reading Sub-setted Image\n"););
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    19
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    23
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   4
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE uint16
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_UINT16
+
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={40000,4800,3,1000};   /* pixel with fill values */
+        TEST_VARTYPE fill_pixel2[TEST_NCOMP]={1230,1,65000,35000};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE sub_image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE *sub_ptr;
+        int32 start[2]; /* start of image data to use */
+        int32 stride[2];/* stride of image data to use */
+        int32 count[2]; /* # of pixels of image data to use */
+        intn i,j;       /* local counting variables */
+
+        /* fill the memory-only with the default pixel fill-values */
+        HDmemset(image0,0,sizeof(image0));
+        sub_ptr=(TEST_VARTYPE *)sub_image;
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if((j%2)==0)
+                        HDmemcpy(&image0[i][j][0],fill_pixel,sizeof(fill_pixel));
+                    else
+                        HDmemcpy(&image0[i][j][0],fill_pixel2,sizeof(fill_pixel2));
+                    if(((i>(TEST_YDIM/3)) && (i<(2*TEST_YDIM/3)))
+                        && ((j>(TEST_XDIM/4)) && (j<(3*TEST_XDIM/4))))
+                      {
+                          HDmemcpy(sub_ptr,&image0[i][j][0],TEST_NCOMP*sizeof(TEST_VARTYPE));
+                          sub_ptr+=TEST_NCOMP;
+                      } /* end if */
+                } /* end for */
+          } /* end for */
+
+        /* initialize the disk buffer */
+        HDmemset(image,255,sizeof(image));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a1bb2",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+
+              /* Set Chunk cache to hold 3 chunks */
+              ret = GRsetchunkcache(riid, 3, 0);
+              CHECK_VOID(ret,FAIL,"GRsetchunkcache");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Create whole image */
+        start[XDIM]=start[YDIM]=0;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image0);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Get the sub-set image back */
+        start[XDIM]=(TEST_XDIM/4)+1;
+        start[YDIM]=(TEST_YDIM/3)+1;
+        count[XDIM]=((3*TEST_XDIM/4)-(TEST_XDIM/4))-1;
+        count[YDIM]=((2*TEST_YDIM/3)-(TEST_YDIM/3))-1;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRreadimage(riid,start,stride,count,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,sub_image,(size_t)(count[XDIM]*count[YDIM])*sizeof(fill_pixel)))
+          {
+              MESSAGE(3, printf("%d:Error reading data for new image with default fill-value, sub-setted image\n",__LINE__););
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+} /* end test_mgr_image_b2a1bb2() */
+
+static void test_mgr_image_b2a1cc1(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+/* B2a1cc - Read/Write images - with real Data - New Image - with Default Fill Value - Sub-sampled Image */
+    MESSAGE(8, printf("Check out I/O on new image with real data, with Default fill-value, Writing Sub-sampled Image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    19
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    23
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   5
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE int16
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_INT16
+
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={-20000,-1,4800,3,1000};   /* pixel with fill values */
+        TEST_VARTYPE fill_pixel2[TEST_NCOMP]={45,1230,1,32000,-32000};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE sub_image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE *sub_ptr;
+        int32 start[2]; /* start of image data to use */
+        int32 stride[2];/* stride of image data to use */
+        int32 count[2]; /* # of pixels of image data to use */
+        intn i,j,k;     /* local counting variables */
+
+        /* fill the memory-only with the default pixel fill-values */
+        HDmemset(image0,0,sizeof(TEST_VARTYPE)*(size_t)(TEST_YDIM*TEST_XDIM*TEST_NCOMP));
+        sub_ptr=(TEST_VARTYPE *)sub_image;
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if((i%2)!=0 && (j%2)!=0)
+                      {
+                          if((j%3)==0)
+                              HDmemcpy(&image0[i][j][0],fill_pixel,sizeof(TEST_VARTYPE)*TEST_NCOMP);
+                          else
+                              HDmemcpy(&image0[i][j][0],fill_pixel2,sizeof(TEST_VARTYPE)*TEST_NCOMP);
+                          HDmemcpy(sub_ptr,&image0[i][j][0],TEST_NCOMP*sizeof(TEST_VARTYPE));
+                          sub_ptr+=TEST_NCOMP;
+                      } /* end if */
+                } /* end for */
+          } /* end for */
+
+        /* initialize the disk buffer */
+        HDmemset(image,255,sizeof(TEST_VARTYPE)*(size_t)(TEST_YDIM*TEST_XDIM*TEST_NCOMP));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a1cc",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Create sub-sampled window with only the filled pixels in it */
+        start[XDIM]=1;
+        start[YDIM]=1;
+        count[XDIM]=TEST_XDIM/2;
+        count[YDIM]=TEST_YDIM/2;
+        stride[XDIM]=stride[YDIM]=2;
+        ret=GRwriteimage(riid,start,stride,count,sub_image);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Get the whole image back */
+        start[XDIM]=start[YDIM]=0;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(TEST_VARTYPE)*TEST_YDIM*TEST_XDIM*TEST_NCOMP))
+          {
+              MESSAGE(3, printf("%d:Error reading data for new image with default fill-value, sub-sampled image\n",__LINE__););
+
+              MESSAGE(8, for(i=0; i<TEST_YDIM; i++) \
+                      for(j=0; j<TEST_XDIM; j++) \
+                          for(k=0; k<TEST_NCOMP; k++) \
+                            if(image[i][j][k]!=image0[i][j][k]) \
+                                  printf("Location: [%d][%d][%d] image=%d, image0=%d \n",(int)i,(int)j,(int)k,(int)image[i][j][k],(int)image0[i][j][k]); );
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+}
+
+static void test_mgr_image_b2a1cc2(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+    MESSAGE(8, printf("Check out I/O on new image with real data, with Default fill-value, Reading Sub-sampled Image\n"););
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    19
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    23
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   4
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE uint32
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_UINT32
+
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={4000000,4800,3,1000};   /* pixel with fill values */
+        TEST_VARTYPE fill_pixel2[TEST_NCOMP]={1230,1,65000,350000};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE sub_image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE *sub_ptr;
+        int32 start[2]; /* start of image data to use */
+        int32 stride[2];/* stride of image data to use */
+        int32 count[2]; /* # of pixels of image data to use */
+        intn i,j;       /* local counting variables */
+
+        /* fill the memory-only with the default pixel fill-values */
+        HDmemset(image0,0,sizeof(image0));
+        sub_ptr=(TEST_VARTYPE *)sub_image;
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if((j%2)==0)
+                        HDmemcpy(&image0[i][j][0],fill_pixel,sizeof(fill_pixel));
+                    else
+                        HDmemcpy(&image0[i][j][0],fill_pixel2,sizeof(fill_pixel2));
+                    if((i%2) && (j%2))
+                      {
+                          HDmemcpy(sub_ptr,&image0[i][j][0],TEST_NCOMP*sizeof(TEST_VARTYPE));
+                          sub_ptr+=TEST_NCOMP;
+                      } /* end if */
+                } /* end for */
+          } /* end for */
+
+        /* initialize the disk buffer */
+        HDmemset(image,255,sizeof(image));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a1cc2",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Create whole image */
+        start[XDIM]=start[YDIM]=0;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image0);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Get the sub-sample image back */
+        start[XDIM]=1;
+        start[YDIM]=1;
+        count[XDIM]=TEST_XDIM/2;
+        count[YDIM]=TEST_YDIM/2;
+        stride[XDIM]=stride[YDIM]=2;
+        ret=GRreadimage(riid,start,stride,count,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,sub_image,(size_t)(count[XDIM]*count[YDIM])*sizeof(fill_pixel)))
+          {
+              MESSAGE(3, printf("%d:Error reading data for new image with default fill-value, sub-sampled image\n",__LINE__););
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+} /* end test_mgr_image_b2a1cc() */
+
+static void test_mgr_image_b2a2bb(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+/* B2a2bb - Read/Write images - with real Data - New Image - with User-Defined Fill Value - Sub-setted Image */
+    MESSAGE(8, printf("Check out I/O on new image with real data, with User-Defined fill-value, Writing Sub-setted Image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    19
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    23
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   4
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE float32
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_FLOAT32
+
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={(TEST_VARTYPE)-3.75,(TEST_VARTYPE)4.5,(TEST_VARTYPE)-0.375,(TEST_VARTYPE)100.125};   /* pixel with fill values */
+        TEST_VARTYPE pixel[TEST_NCOMP]={(TEST_VARTYPE)-20.00,(TEST_VARTYPE)4.875,(TEST_VARTYPE)0.125,(TEST_VARTYPE)1.0};   /* pixel with fill values */
+        TEST_VARTYPE pixel2[TEST_NCOMP]={(TEST_VARTYPE)1.25,(TEST_VARTYPE)1.0,(TEST_VARTYPE)-6500.0,(TEST_VARTYPE)350.0};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE sub_image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE *sub_ptr;
+        int32 start[2]; /* start of image data to use */
+        int32 stride[2];/* stride of image data to use */
+        int32 count[2]; /* # of pixels of image data to use */
+        intn i,j,k;     /* local counting variables */
+
+        /* fill the memory-only with the default pixel fill-values */
+        HDmemfill(image0,fill_pixel,sizeof(fill_pixel),sizeof(image0)/sizeof(fill_pixel));
+        sub_ptr=(TEST_VARTYPE *)sub_image;
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if(((i>(TEST_YDIM/3)) && (i<(2*TEST_YDIM/3)))
+                        && ((j>(TEST_XDIM/4)) && (j<(3*TEST_XDIM/4))))
+                      {
+                          if((j%2)==0)
+                              HDmemcpy(&image0[i][j][0],pixel,sizeof(pixel));
+                          else
+                              HDmemcpy(&image0[i][j][0],pixel2,sizeof(pixel2));
+                          HDmemcpy(sub_ptr,&image0[i][j][0],TEST_NCOMP*sizeof(TEST_VARTYPE));
+                          sub_ptr+=TEST_NCOMP;
+                      } /* end if */
+                } /* end for */
+          } /* end for */
+
+        /* initialize the disk buffer */
+        HDmemset(image,255,sizeof(image));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a2bb",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Set the fill-value */
+        ret=GRsetattr(riid,FILL_ATTR,TEST_NT,TEST_NCOMP,fill_pixel);
+        CHECK_VOID(ret,FAIL,"GRsetattr");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+
+        /* Create sub-setted window with only the filled pixels in it */
+        start[XDIM]=(TEST_XDIM/4)+1;
+        start[YDIM]=(TEST_YDIM/3)+1;
+        count[XDIM]=((3*TEST_XDIM/4)-(TEST_XDIM/4))-1;
+        count[YDIM]=((2*TEST_YDIM/3)-(TEST_YDIM/3))-1;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRwriteimage(riid,start,stride,count,sub_image);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Get the whole image back */
+        start[XDIM]=start[YDIM]=0;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(image0)))
+          {
+              MESSAGE(3, printf("Error reading data for new image with user-defined fill-value, sub-setted image\n"););
+
+              MESSAGE(8, for(i=0; i<TEST_YDIM; i++) \
+                      for(j=0; j<TEST_XDIM; j++) \
+                          for(k=0; k<TEST_NCOMP; k++) \
+                              if(image[i][j][k]!=image0[i][j][k]) \
+                                  printf("Location: [%d][%d][%d] image=%f, image0=%f \n",i,j,k,(double)image[i][j][k],(double)image0[i][j][k]); );
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+} /* end test_mgr_image_b2a2bb() */
+
+static void test_mgr_image_b2a2cc(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+
+/* B2a2cc - Read/Write images - with real Data - New Image - with User-Defined Fill Value - Sub-sampled Image */
+    MESSAGE(8, printf("Check out I/O on new image with real data, with User-Defined fill-value, Writing Sub-sampled Image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    19
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    23
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   5
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE int16
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_INT16
+
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={-3,4,-13,100,1200};   /* pixel with fill values */
+        TEST_VARTYPE pixel[TEST_NCOMP]={-20,4,0,1,-367};   /* pixel with fill values */
+        TEST_VARTYPE pixel2[TEST_NCOMP]={1,-11,-6500,350,20};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE sub_image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE *sub_ptr;
+        int32 start[2]; /* start of image data to use */
+        int32 stride[2];/* stride of image data to use */
+        int32 count[2]; /* # of pixels of image data to use */
+        intn i,j,k;     /* local counting variables */
+
+        /* fill the memory-only with the default pixel fill-values */
+        HDmemfill(image0,fill_pixel,sizeof(fill_pixel),sizeof(image0)/sizeof(fill_pixel));
+        sub_ptr=(TEST_VARTYPE *)sub_image;
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if((i%2)!=0 && (j%2)!=0)
+                      {
+                          if((j%3)==0)
+                              HDmemcpy(&image0[i][j][0],pixel,sizeof(TEST_VARTYPE)*TEST_NCOMP);
+                          else
+                              HDmemcpy(&image0[i][j][0],pixel2,sizeof(TEST_VARTYPE)*TEST_NCOMP);
+                          HDmemcpy(sub_ptr,&image0[i][j][0],TEST_NCOMP*sizeof(TEST_VARTYPE));
+                          sub_ptr+=TEST_NCOMP;
+                      } /* end if */
+                } /* end for */
+          } /* end for */
+
+        /* initialize the disk buffer */
+        HDmemset(image,255,sizeof(TEST_VARTYPE)*(size_t)(TEST_YDIM*TEST_XDIM*TEST_NCOMP));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a2cc",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Set the fill-value */
+        ret=GRsetattr(riid,FILL_ATTR,TEST_NT,TEST_NCOMP,fill_pixel);
+        CHECK_VOID(ret,FAIL,"GRsetattr");
+
+        /* Check if creating chunked GR */
+        if (flag)
+          {
+              /* Create chunked GR 
+                 chunk is 2x2 which will create 6 chunks */
+              cdims[0] = chunk_def.chunk_lengths[0] = 2;
+              cdims[1] = chunk_def.chunk_lengths[1] = 2;
+              ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+              CHECK_VOID(ret,FAIL,"GRsetchunk");
+          }
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        /* Create sub-sampled window with only the filled pixels in it */
+        start[XDIM]=1;
+        start[YDIM]=1;
+        count[XDIM]=TEST_XDIM/2;
+        count[YDIM]=TEST_YDIM/2;
+        stride[XDIM]=stride[YDIM]=2;
+        ret=GRwriteimage(riid,start,stride,count,sub_image);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Get the whole image back */
+        start[XDIM]=start[YDIM]=0;
+        stride[XDIM]=stride[YDIM]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(TEST_VARTYPE)*TEST_YDIM*TEST_XDIM*TEST_NCOMP))
+          {
+              MESSAGE(3, printf("Error reading data for new image with user-defined fill-value, sub-sampled image\n"););
+
+              MESSAGE(8, for(i=0; i<TEST_YDIM; i++) \
+                      for(j=0; j<TEST_XDIM; j++) \
+                          for(k=0; k<TEST_NCOMP; k++) \
+                            if(image[i][j][k]!=image0[i][j][k]) \
+                                  printf("Location: [%d][%d][%d] image=%d, image0=%d \n",(int)i,(int)j,(int)k,(int)image[i][j][k],(int)image0[i][j][k]); );
+              num_errs++;
+          } /* end if */
+
+        /* check if we are doing chunked tests */
+        if (flag)
+          {
+              /* Get chunk lengths */
+              ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+              CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+              rcdims = rchunk_def.chunk_lengths;
+
+              /* check chunk lengths and to see if GR is chunked */
+              if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+                {
+                    fprintf(stderr, "Chunk Test. GRgetchunkinfo returned wrong values\n");
+                    fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+                    fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+                    fprintf(stderr, "cflags =%d \n", (int)cflags );
+                }
+
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+} /* end test_mgr_image_b2a2cc() */
+
+static void test_mgr_image_b2b1(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    char datafile[512] = "";
+    char *srcdir = getenv("srcdir");
+
+/* B2b1 - Read/Write images - with real Data - Existing Image - Whole Image */
+    MESSAGE(8, printf("Check out I/O from Existing Image - Whole Image\n"););
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(DATAFILE) + 1) < sizeof(datafile))) {
+        strcpy(datafile, srcdir);
+        strcat(datafile, "/");
+    }
+    strcat(datafile, DATAFILE);
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(datafile,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Try initializing the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 n_datasets;       /* number of datasets */
+        int32 n_attrs;          /* number of attributes */
+        intn i;     /* local counting variables */
+        
+        ret=(intn)GRfileinfo(grid,&n_datasets,&n_attrs);
+        CHECK_VOID(ret,FAIL,"GRfileinfo");
+
+        for(i=0; i<n_datasets; i++)
+          {
+              int32 riid;               /* RI ID for an image */
+              char name[MAX_IMG_NAME];  /* storage for the image's name */
+              int32 ncomp;              /* number of components */
+              int32 nt;                 /* NT of the components */
+              int32 il;                 /* interlace of the image data */
+              int32 dimsizes[2];        /* dimension sizes of the image */
+              int32 n_attr;             /* number of attributes with each image */
+              VOIDP img_data;           /* buffer for the image data */
+
+              /* Attach to the image */
+              riid=GRselect(grid,i);
+              CHECK_VOID(riid,FAIL,"GRselect");
+
+              /* Get the Image information */
+              *name='\0';
+              ret=GRgetiminfo(riid,name,&ncomp,&nt,&il,dimsizes,&n_attr);
+              CHECK_VOID(ret,FAIL,"GRgetiminfo");
+
+              /* Check the name for correctness */
+              if(HDstrcmp(name,datafile_info[i].name))
+                {
+                    MESSAGE(3, printf("Error! Name for image %d is: %s, should be %s\n",i,name,datafile_info[i].name););
+                    num_errs++;
+                } /* end if */
+
+              /* Check the # of components */
+              if(ncomp!=datafile_info[i].ncomp)
+                {
+                    MESSAGE(3, printf("Error! Number of components for image %d is: %ld, should be %ld\n",i,(long)ncomp,(long)datafile_info[i].ncomp););
+                    num_errs++;
+                } /* end if */
+
+              /* Check the NT of components */
+              if(nt!=datafile_info[i].nt)
+                {
+                    MESSAGE(3, printf("Error! NT of components for image %d is: %ld, should be %ld\n",i,(long)nt,(long)datafile_info[i].nt););
+                    num_errs++;
+                } /* end if */
+
+              /* Check the interlace of components */
+              if(il!=datafile_info[i].il)
+                {
+                    MESSAGE(3, printf("Error! Interlace of components for image %d is: %ld, should be %ld\n",i,(long)il,(long)datafile_info[i].il););
+                    num_errs++;
+                } /* end if */
+
+              /* Check the x-dimension of the image */
+              if(dimsizes[XDIM]!=datafile_info[i].dimsizes[XDIM])
+                {
+                    MESSAGE(3, printf("Error! X-dim of image %d is: %ld, should be %ld\n",i,(long)dimsizes[XDIM],(long)datafile_info[i].dimsizes[XDIM]););
+                    num_errs++;
+                } /* end if */
+
+              /* Check the y-dimension of the image */
+              if(dimsizes[YDIM]!=datafile_info[i].dimsizes[YDIM])
+                {
+                    MESSAGE(3, printf("Error! Y-dim of image %d is: %ld, should be %ld\n",i,(long)dimsizes[YDIM],(long)datafile_info[i].dimsizes[YDIM]););
+                    num_errs++;
+                } /* end if */
+
+              /* Check the # of attributes of the image */
+              if(n_attr!=datafile_info[i].n_attr)
+                {
+                    MESSAGE(3, printf("Error! # of attributes for image %d is: %ld, should be %ld\n",i,(long)n_attr,(long)datafile_info[i].n_attr););
+                    num_errs++;
+                } /* end if */
+
+              /* Check the image data itself */
+              {
+                  int32 start[2];
+                  int32 stride[2];
+
+                    img_data=HDmalloc((size_t)(dimsizes[0]*dimsizes[1]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+                    CHECK_VOID(img_data,NULL,"HDmalloc");
+
+                    HDmemset(img_data,0,(size_t)(dimsizes[0]*dimsizes[1]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+
+                    start[0]=start[1]=0;
+                    stride[0]=stride[1]=1;
+                    ret=GRreadimage(riid,start,stride,dimsizes,img_data);
+                    CHECK_VOID(ret,FAIL,"GRreadimage");
+
+                    switch(i)
+                      {
+                          case 0:
+                              if(0!=HDmemcmp(img_data,image00,sizeof(image00)))
+                                {
+                                    MESSAGE(3, printf("Error reading data for image %d\n",i););
+                                    num_errs++;
+                                } /* end if */
+                              break;
+
+                          case 1:
+                              if(0!=HDmemcmp(img_data,image1,sizeof(image1)))
+                                {
+                                    MESSAGE(3, printf("Error reading data for image %d\n",i););
+                                    num_errs++;
+                                } /* end if */
+                              break;
+
+                          case 2:
+                              if(0!=HDmemcmp(img_data,image2,sizeof(image2)))
+                                {
+                                    MESSAGE(3, printf("Error reading data for image %d\n",i););
+                                    num_errs++;
+                                } /* end if */
+                              break;
+
+                          case 3:
+                              if(0!=HDmemcmp(img_data,image3,sizeof(image3)))
+                                {
+                                    MESSAGE(3, printf("Error reading data for image %d\n",i););
+                                    num_errs++;
+                                } /* end if */
+                              break;
+
+                          case 4:
+                              if(0!=HDmemcmp(img_data,image4,sizeof(image4)))
+                                {
+                                    MESSAGE(3, printf("Error reading data for image %d\n",i););
+                                    num_errs++;
+                                } /* end if */
+                              break;
+
+                      } /* end switch */
+
+                    HDfree(img_data);
+              } /* end block */
+
+              /* End access to the image */
+              ret=GRendaccess(riid);
+              CHECK_VOID(ret,FAIL,"GRendaccess");
+          } /* end for */
+      } /* end block */
+
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+} /* end test_mgr_image_b2b1() */
+
+static void test_mgr_image_chunk(int flag)
+{
+    int32   cdims[2] = {1,1};    /* chunk dims */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    int32     cflags;            /* chunk flags */
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+#ifdef TEST_XDIM
+#undef TEST_XDIM
+#endif /* TEST_XDIM */
+#define TEST_XDIM    3
+#ifdef TEST_YDIM
+#undef TEST_YDIM
+#endif /* TEST_YDIM */
+#define TEST_YDIM    8
+#ifdef TEST_NCOMP
+#undef TEST_NCOMP
+#endif /* TEST_NCOMP */
+#define TEST_NCOMP   2
+#ifdef TEST_VARTYPE
+#undef TEST_VARTYPE
+#endif /* TEST_VARTYPE */
+#define TEST_VARTYPE int32
+#ifdef TEST_NT
+#undef TEST_NT
+#endif /* TEST_NT */
+#define TEST_NT      DFNT_INT32
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={TEST_XDIM,TEST_YDIM};    /* dimensions for the empty image */
+        uint16 ref;     /* RI ref #. */
+        int32 index;    /* RI index # */
+        TEST_VARTYPE image[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        TEST_VARTYPE fill_pixel[TEST_NCOMP]={1,-2};   /* pixel with fill values */
+        TEST_VARTYPE fill_pixel2[TEST_NCOMP]={-2,1};   /* pixel with fill values */
+        TEST_VARTYPE image0[TEST_YDIM][TEST_XDIM][TEST_NCOMP]; /* space for the image data */
+        int32 start[2]; /* start of image data to grab */
+        int32 stride[2];/* stride of image data to grab */
+        intn i,j;       /* local counting variables */
+
+
+        /* fill the memory-only with the default pixel fill-value */
+        for(i=0; i<TEST_YDIM; i++)
+          {
+              for(j=0; j<TEST_XDIM; j++)
+                {
+                    if((j%2)==0)
+                        HDmemcpy(&image0[i][j][0],fill_pixel,sizeof(fill_pixel));
+                    else
+                        HDmemcpy(&image0[i][j][0],fill_pixel2,sizeof(fill_pixel2));
+                } /* end for */
+          } /* end for */
+        HDmemcpy(image,image0,sizeof(image0));
+
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Chunk Image B2a1aa",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+        /* Create chunked GR 
+           chunk is 2x2 which will create 6 chunks */
+        cdims[0] = chunk_def.chunk_lengths[0] = 2;
+        cdims[1] = chunk_def.chunk_lengths[1] = 2;
+        ret = GRsetchunk(riid, chunk_def, HDF_CHUNK);
+        CHECK_VOID(ret,FAIL,"GRsetchunk");
+
+        /* Set Chunk cache to hold 2 chunks */
+        ret = GRsetchunkcache(riid, 2, 0);
+        CHECK_VOID(ret,FAIL,"GRsetchunkcache");
+
+        /* Save the ref. # for later access */
+        ref=GRidtoref(riid);
+        CHECK_VOID(ref,(uint16)FAIL,"GRidtoref");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRwriteimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRwriteimage");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+
+        /* Shut down the GR interface */
+        ret=GRend(grid);
+        CHECK_VOID(ret,FAIL,"GRend");
+
+        /* Initialize the GR interface again */
+        grid=GRstart(fid);
+        CHECK_VOID(grid,FAIL,"GRstart");
+
+#if 0
+        /* Create empty image with default fill value */
+        riid=GRcreate(grid,"Test Image B2a1aa",TEST_NCOMP,TEST_NT,MFGR_INTERLACE_PIXEL,dims);
+        CHECK_VOID(riid,FAIL,"GRcreate");
+
+#endif
+
+        /* Get the index of the newly created image */
+        index=GRreftoindex(grid,ref);
+        CHECK_VOID(index,FAIL,"GRreftoindex");
+
+        /* Select the newly created image */
+        riid=GRselect(grid,index);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        if(0!=HDmemcmp(image,image0,sizeof(image0)))
+          {
+              MESSAGE(3, printf("%d:Error reading data for new image with default fill-value, whole image\n",__LINE__););
+              num_errs++;
+          } /* end if */
+
+        /* Get chunk lengths */
+        ret = GRgetchunkinfo(riid, &rchunk_def, &cflags);
+        CHECK_VOID(ret,FAIL,"GRgetchunkinfo");
+
+        rcdims = rchunk_def.chunk_lengths;
+
+        /* check chunk lengths and to see if GR is chunked */
+        if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+          {
+              fprintf(stderr, "Chunk Test 1. GRgetchunkinfo returned wrong values\n");
+              fprintf(stderr, "cdims[0]=%d,cdims[1]=%d \n",(int)cdims[0],(int)cdims[1]);
+              fprintf(stderr, "rcdims[0]=%d,rcdims[1]=%d \n",(int)rcdims[0],(int)rcdims[1]);
+              fprintf(stderr, "cflags =%d \n", (int)cflags );
+          }
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+
+#if 0
+
+    /* Create chunked GR 
+       chunk is 3x2 which will create 6 chunks.
+       Use GZIP compression */
+    cdims[0] = chunk_def.comp.chunk_lengths[0] = 3;
+    cdims[1] = chunk_def.comp.chunk_lengths[1] = 2;
+#if 0
+    chunk_def.comp.comp_type = COMP_CODE_RLE;   /* RLE */
+
+    chunk_def.comp.comp_type = COMP_CODE_SKPHUFF; /* Skipping Huffman */
+    chunk_def.comp.cinfo.skphuff.skp_size = sizeof(uint16);
+#endif
+    chunk_def.comp.comp_type = COMP_CODE_DEFLATE; /* GZIP */
+    chunk_def.comp.cinfo.deflate.level = 6;
+
+    status = GRsetchunk(riid8, chunk_def, HDF_CHUNK | HDF_COMP);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Error! Chunk Test 7. Failed to create new chunked, GZIP Compressed data set\n");
+        num_err++;
+        goto test8;
+      }
+#endif
+
+} /* end test_mgr_image_chunk() */
+
+/****************************************************************
+**
+**  test_mgr_image(): Multi-file Raster Image I/O Test Routine
+**  II. Create Images
+**      A. GRcreate/GRselect/GRendaccess w/GRgetiminfo
+**      B. Write/Read images
+**          1. With no Data
+**              a. Default fill value
+**              b. user defined fill value
+**          2. With real Data
+**              a. New Image
+**                  1. With default fill value
+**                      aa. Whole image
+**                      bb. Sub-setted image
+**                      cc. Sub-sampled image
+**                  2. With user defined vill value
+**                      aa. Whole image
+**                      bb. Sub-setted image
+**                      cc. Sub-sampled image
+**              b. Existing Image
+**                  1. Whole image
+**                  2. Sub-setted image
+**                  3. Sub-sampled image
+** 
+****************************************************************/
+static void
+test_mgr_image(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Image I/O routines\n"););
+    test_mgr_image_b1a(flag);
+    test_mgr_image_b1b(flag);
+    test_mgr_image_b2a1aa(flag);
+    test_mgr_image_b2a1bb1(flag);
+    test_mgr_image_b2a1bb2(flag);
+    test_mgr_image_b2a1cc1(flag);
+    test_mgr_image_b2a1cc2(flag);
+    test_mgr_image_b2a2bb(flag);
+    test_mgr_image_b2a2cc(flag);
+    test_mgr_image_b2b1(flag);
+#if 0
+    test_mgr_image_chunk(flag);
+#endif
+}   /* end test_mgr_image() */
+
+/****************************************************************
+**
+**  test_mgr_index(): Multi-file Raster ID/Ref/Index Test Routine
+** 
+**  III. ID/Ref/Index Functions
+**      A. GRidtoref
+**      B. GRreftoindex
+** 
+****************************************************************/
+static void
+test_mgr_index(int flag)
+{
+    /* output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-File Raster id/ref/index routines\n"););
+
+/* I believe that these are adequately tested in the test_mgr_image routine -QAK */
+}   /* end test_mgr_index() */
+
+/****************************************************************
+**
+**  test_mgr_interlace(): Multi-file Raster Interlace Test Routine
+** 
+**  IV. Interlace Functions [Need to be implemented]
+**      A. GRreqlutil - tested in the palette test below.
+**      B. GRreqimageil
+** 
+****************************************************************/
+static void
+test_mgr_interlace(int flag)
+{
+    int32 fid;              /* hdf file id */
+    int32 grid;             /* grid for the interface */
+    int32 n_datasets;       /* number of datasets */
+    int32 n_attrs;          /* number of attributes */
+    int32 ret;              /* generic return value */
+    VOIDP image;            /* image to retrieve */
+
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Interlace routines\n"););
+
+    /* open up the existing datafile and get the image information from it */
+    if (flag)
+        fid=Hopen(TESTFILE2,DFACC_RDWR,0);
+    else
+        fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* initialize the gr interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        intn i,j;     /* local counting variables */
+        
+        ret=(intn)GRfileinfo(grid,&n_datasets,&n_attrs);
+        CHECK_VOID(ret,FAIL,"GRfileinfo");
+
+        for(i=0; i<n_datasets; i++)
+          {
+              int32 riid;               /* RI ID for an image */
+              char name[MAX_IMG_NAME];  /* storage for the image's name */
+              int32 ncomp;              /* number of components */
+              int32 nt;                 /* NT of the components */
+              int32 il;                 /* interlace of the image data */
+              int32 start[2];
+              int32 stride[2];
+              int32 dimsizes[2];        /* dimension sizes of the image */
+              int32 n_attr;             /* number of attributes with each image */
+              VOIDP img_data;           /* buffer for the image data */
+
+              /* Attach to the image */
+              riid=GRselect(grid,i);
+              CHECK_VOID(riid,FAIL,"GRselect");
+
+              /* Get the Image information */
+              *name='\0';
+              ret=GRgetiminfo(riid,name,&ncomp,&nt,&il,dimsizes,&n_attr);
+              CHECK_VOID(ret,FAIL,"GRgetiminfo");
+
+              image=HDmalloc((size_t)(dimsizes[XDIM]*dimsizes[YDIM]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+              CHECK_VOID(image,NULL,"HDmalloc");
+
+              start[0]=start[1]=0;
+              stride[0]=stride[1]=1;
+              ret=GRreadimage(riid,start,stride,dimsizes,image);
+
+              /* Check the image data itself */
+              for(j=(intn)MFGR_INTERLACE_PIXEL; j<=(intn)MFGR_INTERLACE_COMPONENT; j++)
+                {
+                    VOIDP pixel_buf;
+
+                    img_data=HDmalloc((size_t)(dimsizes[0]*dimsizes[1]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+                    CHECK_VOID(img_data,NULL,"HDmalloc");
+
+                    pixel_buf=HDmalloc((size_t)(dimsizes[0]*dimsizes[1]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+                    CHECK_VOID(pixel_buf,NULL,"HDmalloc");
+
+                    HDmemset(img_data,0,(size_t)(dimsizes[0]*dimsizes[1]*ncomp*DFKNTsize(nt|DFNT_NATIVE)));
+
+                    ret=GRreqimageil(riid,j);
+                    CHECK_VOID(ret,FAIL,"GRreqimageil");
+
+                    start[0]=start[1]=0;
+                    stride[0]=stride[1]=1;
+                    ret=GRreadimage(riid,start,stride,dimsizes,img_data);
+                    CHECK_VOID(ret,FAIL,"GRreadimage");
+
+                    GRIil_convert(image,MFGR_INTERLACE_PIXEL,pixel_buf,(gr_interlace_t)j,dimsizes,ncomp,nt);
+                    if(0!=HDmemcmp(img_data,pixel_buf,
+                          (size_t)(dimsizes[XDIM]*dimsizes[YDIM]*ncomp*DFKNTsize(nt|DFNT_NATIVE))))
+                      {
+                          MESSAGE(3, printf("Error reading data for image %d, j=%d\n",i,j););
+                          num_errs++;
+                      } /* end if */
+                    HDfree(img_data);
+                    HDfree(pixel_buf);
+                } /* end for */
+
+              HDfree(image);
+
+              /* End access to the image */
+              ret=GRendaccess(riid);
+              CHECK_VOID(ret,FAIL,"GRendaccess");
+          } /* end for */
+      } /* end block */
+    
+    /* shut down the gr interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+}   /* end test_mgr_interlace() */
+
+/****************************************************************
+**
+**  test_mgr_lut_a(): Multi-file Raster LUT/Palette Test Routine
+** 
+**  V. Palette Functions
+**      A. GRgetlutid w/GRgetlutinfo
+**      B. Read/Write Palettes
+**          1. GRwritelut
+**          2. GRreadlut
+**	C. GRluttoref
+** 
+****************************************************************/
+static void
+test_mgr_lut_a(int flag)
+{
+    int32 fid;              /* hdf file id */
+    int32 grid;             /* grid for the interface */
+    int32 ret;              /* generic return value */
+
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Palette routines\n"););
+
+    /* open up the existing datafile and get the image information from it */
+    fid=Hopen(TESTFILE,DFACC_RDWR,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* initialize the gr interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+/* pick up here -QAK2 */
+    {
+        intn i,j;     /* local counting variables */
+        int32 riid;               /* RI ID for an image */
+        int32 lutid;              /* RI ID for an image */
+        char name[MAX_IMG_NAME];  /* storage for the image's name */
+        int32 ncomp;              /* number of components */
+        int32 pal_ncomp;          /* number of palette components */
+        int32 nt;                 /* NT of the components */
+        int32 pal_nt;             /* NT of the palette components */
+        int32 il;                 /* interlace of the image data */
+        int32 pal_il;             /* interlace of the palette data */
+        int32 dimsizes[2];        /* dimension sizes of the image */
+        int32 pal_entries;        /* number of entries in the palette */
+        int32 n_attr;             /* number of attributes with each image */
+        uint8 *tmp_data;          /* temporary buffer pointer */
+        VOIDP pal_data;           /* buffer for the palette data */
+        uint16 pal_ref;		  /* reference number of the palette */
+
+        /* Attach to the image */
+        riid=GRselect(grid,0);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Get the Image information */
+        *name='\0';
+        ret=GRgetiminfo(riid,name,&ncomp,&nt,&il,dimsizes,&n_attr);
+        CHECK_VOID(ret,FAIL,"GRgetiminfo");
+
+        /* Get the number of palettes */
+        ret=GRgetnluts(riid);
+        VERIFY_VOID(ret,0,"GRgetnluts");
+
+        lutid=GRgetlutid(riid,0);
+        CHECK_VOID(lutid,FAIL,"GRgetlutid");
+        
+        /* Get the Palette information */
+        ret=GRgetlutinfo(lutid,&pal_ncomp,&pal_nt,&pal_il,&pal_entries);
+        CHECK_VOID(ret,FAIL,"GRgetlutinfo");
+
+        /* Check the palette values, they should all be "nil" values */
+        if(pal_ncomp!=0)
+          {
+              MESSAGE(3, printf("Error! Incorrect palette components\n"););
+              num_errs++;
+          } /* end if */
+        if(pal_nt!=DFNT_NONE)
+          {
+              MESSAGE(3, printf("Error! Incorrect palette number-type\n"););
+              num_errs++;
+          } /* end if */
+        if(pal_il!=(-1))
+          {
+              MESSAGE(3, printf("Error! Incorrect palette interlace, pal_il=%d\n",(int)pal_il););
+              num_errs++;
+          } /* end if */
+        if(pal_entries!=0)
+          {
+              MESSAGE(3, printf("Error! Incorrect palette # of entries\n"););
+              num_errs++;
+          } /* end if */
+
+        /* Set the palette components */
+        pal_ncomp=3;
+        pal_nt=DFNT_UINT8;
+        pal_il=(int32)MFGR_INTERLACE_PIXEL;
+        pal_entries=256;
+
+        pal_data=HDmalloc((size_t)(pal_entries*pal_ncomp*DFKNTsize(pal_nt|DFNT_NATIVE)));
+        CHECK_VOID(pal_data,NULL,"HDmalloc");
+
+        /* Initialize the palette data, in 'pixel' interlace */
+        tmp_data=(uint8 *)pal_data;
+        for(j=0; j<pal_entries; j++)
+            for(i=0; i<pal_ncomp; i++)
+                *tmp_data++=(uint8)(j*i);
+
+        /* Write the palette out */
+        ret=GRwritelut(lutid,pal_ncomp,pal_nt,pal_il,pal_entries,pal_data);
+        CHECK_VOID(ret,FAIL,"GRwritelut");
+
+        /* Check the image data itself */
+        for(j=(intn)MFGR_INTERLACE_PIXEL; j<=(intn)MFGR_INTERLACE_COMPONENT; j++)
+          {
+              VOIDP pixel_buf;
+              int32 dimsizes2[2];
+
+              tmp_data=HDmalloc((size_t)(pal_entries*pal_ncomp*DFKNTsize(pal_nt|DFNT_NATIVE)));
+              CHECK_VOID(tmp_data,NULL,"HDmalloc");
+
+              pixel_buf=HDmalloc((size_t)(pal_entries*pal_ncomp*DFKNTsize(pal_nt|DFNT_NATIVE)));
+              CHECK_VOID(pixel_buf,NULL,"HDmalloc");
+
+              HDmemset(tmp_data,0,(size_t)(pal_entries*pal_ncomp*DFKNTsize(pal_nt|DFNT_NATIVE)));
+
+              ret=GRreqlutil(lutid,j);
+              CHECK_VOID(ret,FAIL,"GRreqlutil");
+
+              ret=GRreadlut(lutid,tmp_data);
+
+              dimsizes2[XDIM]=1;
+              dimsizes2[YDIM]=pal_entries;
+              GRIil_convert(pal_data,MFGR_INTERLACE_PIXEL,pixel_buf,(gr_interlace_t)j,dimsizes2,pal_ncomp,pal_nt);
+              if(0!=HDmemcmp(tmp_data,pixel_buf,
+                    (size_t)(pal_entries*pal_ncomp*DFKNTsize(pal_nt|DFNT_NATIVE))))
+                {
+                    MESSAGE(3, printf("Error reading data for palette j=%d\n",j););
+                    num_errs++;
+                } /* end if */
+              HDfree(tmp_data);
+              HDfree(pixel_buf);
+          } /* end for */
+
+        HDfree(pal_data);
+
+	/* This lutid should yield a valid reference number, which is not 0 - BMR */ 
+        pal_ref=GRluttoref(lutid);
+        CHECK_VOID(pal_ref,0,"GRluttoref");
+
+	/* Now, this bogus lutid should cause GRluttoref to return a 0 - BMR */
+        pal_ref=GRluttoref(0);
+        VERIFY_VOID(pal_ref,0,"GRluttoref");
+        
+        /* End access to the image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+      } /* end block */
+    
+    /* shut down the gr interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+}   /* end test_mgr_lut_a() */
+
+#define GR_LUTBFILE "gr2.hdf"
+#define GR_LUTB_X_LENGTH 15 
+#define GR_LUTB_Y_LENGTH 10 
+
+/****************************************************************
+**
+**  test_mgr_lut_b(): Multi-file Raster LUT/Palette Test Routine
+** 
+**  V. Palette Functions - Test for writing palette with no image data to
+**      file.
+** 
+****************************************************************/
+static void
+test_mgr_lut_b(int flag)
+{
+	int32 gr_id, ri_id, file_id, pal_id, status, num_entries, ri_idx=0;
+	int32 data_type, ncomp, num_comp, interlace_mode; 
+	uint8 palette_data[256*3];
+	uint8 r_palette_data[256*3];
+	intn i;
+    int32 dims[2]={GR_LUTB_X_LENGTH,GR_LUTB_Y_LENGTH};
+
+	/* Create and open the file. */
+	file_id = Hopen(GR_LUTBFILE, DFACC_CREATE, 0);
+    CHECK_VOID(file_id,FAIL,"Hopen");
+
+	/* Initiate the GR interface. */
+	gr_id = GRstart(file_id);
+    CHECK_VOID(gr_id,FAIL,"GRstart");
+
+    ncomp = 1;
+    dims[0] = 20;
+    dims[1] = 20;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+
+    ri_id = GRcreate (gr_id, "Image_1", ncomp, DFNT_UINT8, interlace_mode, dims);
+    CHECK_VOID(ri_id,FAIL,"GRcreate");
+ 
+	/* Initialize the palette to grayscale. */
+	for (i = 0; i < 256; i++) {
+	 	palette_data[i * 3] = i;
+	 	palette_data[i * 3 + 1] = i;
+	 	palette_data[i * 3 + 2] = i;
+	}
+
+	/* Set palette characteristics. */
+	data_type = DFNT_UINT8;
+	num_entries = 256;
+	num_comp = 3;
+
+	/* Get the id for the palette. */
+	pal_id = GRgetlutid(ri_id, ri_idx);
+    CHECK_VOID(pal_id,FAIL,"GRgetlutid");
+
+	/* Write the palette to file. */
+	status = GRwritelut(pal_id, num_comp, data_type, interlace_mode, num_entries, (VOIDP)palette_data);
+    CHECK_VOID(status,FAIL,"GRgetlutid");
+
+    status = GRendaccess(ri_id);
+    CHECK_VOID(status,FAIL,"GRendaccess");
+ 
+    status = GRend(gr_id);
+    CHECK_VOID(status,FAIL,"GRend");
+ 
+	status = Hclose(file_id);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+	file_id = Hopen(GR_LUTBFILE, DFACC_READ, 0);
+    CHECK_VOID(file_id,FAIL,"Hopen");
+
+    gr_id = GRstart(file_id);
+    CHECK_VOID(gr_id,FAIL,"GRstart");
+ 
+    ri_idx = GRnametoindex(gr_id, "Image_1");
+    CHECK_VOID(ri_idx,FAIL,"GRnametoindex");
+ 
+    ri_id = GRselect (gr_id, ri_idx);
+    CHECK_VOID(ri_id,FAIL,"GRselect");
+ 
+    pal_id = GRgetlutid(ri_id, ri_idx);
+    CHECK_VOID(pal_id,FAIL,"GRgetlutid");
+
+	/* Read the palette data. */
+	status = GRreadlut(pal_id, (VOIDP)r_palette_data);
+    CHECK_VOID(status,FAIL,"GRreadlut");
+
+    /* Verify correct palette contents */
+    if(HDmemcmp(palette_data,r_palette_data,256*3)!=0) {
+        MESSAGE(3, printf("Error reading data for palette\n"););
+        num_errs++;
+    } /* end if */
+
+
+	/* Terminate access to the image. */
+	status = GRendaccess(ri_id);
+    CHECK_VOID(status,FAIL,"GRendaccess");
+
+	/* Terminate access to the GR interface. */
+	status = GRend(gr_id);
+    CHECK_VOID(status,FAIL,"GRend");
+
+	/* Close the file. */
+	status = Hclose(file_id);
+    CHECK_VOID(status,FAIL,"Hclose");
+}   /* end test_mgr_lut_b() */
+
+/****************************************************************
+**
+**  test_mgr_lut(): Multi-file Raster LUT/Palette Test Routine
+** 
+**  V. Palette Functions
+**      A. GRgetlutid w/GRgetlutinfo
+**      B. Read/Write Palettes
+**          1. GRwritelut
+**          2. GRreadlut
+**	C. GRluttoref
+** 
+****************************************************************/
+static void
+test_mgr_lut(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Palette routines\n"););
+
+    test_mgr_lut_a(flag);
+    test_mgr_lut_b(flag);
+}   /* end test_mgr_lut() */
+
+/****************************************************************
+**
+**  test_mgr_special(): Multi-file Raster Special Element Test Routine
+** 
+**  VI. Special Element Functions [Need to be implemented]
+**      A. GRsetexternalfile
+**      B. GRsetaccesstype
+** 
+****************************************************************/
+static void
+test_mgr_special(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Special Element routines\n"););
+}   /* end test_mgr_special() */
+
+/****************************************************************
+**
+**  test_mgr_attr_old(): Multi-file Raster Attribute Test Routine
+** 
+**  VII. Atribute Functions
+**      A. GRattrinfo
+**      B. Read/Write Attributes
+**          1. GRsetattr
+**          2. GRgetattr
+**      C. GRfindattr
+** 
+****************************************************************/
+static void
+test_mgr_attr_old(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Attribute routines\n"););
+
+/* I believe that these are adequately tested in the test_mgr_image routine -QAK */
+}   /* end test_mgr_attr_old() */
+
+#define OLDRLEFILE  "test_files/8bit.dat"
+#define OLDGREYJPEGFILE  "test_files/greyjpeg.dat"
+#define OLDJPEGFILE  "test_files/jpeg.dat"
+#define JPEGX   46
+#define JPEGY   23
+
+static const uint8  jpeg_8bit_j80[JPEGY][JPEGX] =
+{
+    {200, 200, 200, 200, 200, 200, 200, 200, 202, 202, 201, 201, 201, 200, 200, 200, 201, 201, 200, 200, 200, 201, 202, 202, 202, 202, 201, 200, 200, 200, 200, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 199, 200, 200, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 200, 200, 201, 201, 201, 200, 200, 201, 201, 201, 200, 199, 199, 199, 199, 200, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 202, 202, 202, 201, 200, 199, 202, 202, 202, 202, 202, 200, 199, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 201, 200, 200, 200, 199, 199, 200, 200, 200, 201, 201, 200, 200, 200, 200, 200, 201, 201, 201, 200, 200, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 198, 198, 198, 199, 199, 198, 198, 198, 199, 200, 201, 197, 197, 197, 198, 198, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 200, 200, 201, 202, 202, 203, 201, 200, 199, 198, 199, 201, 204, 205, 203, 202, 200, 199, 198, 200, 202, 203, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 201, 202, 203, 205, 207, 208, 209, 205, 203, 201, 200, 202, 205, 208, 211, 214, 211, 206, 202, 200, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {199, 199, 198, 199, 200, 202, 204, 205, 202, 200, 197, 198, 201, 204, 205, 205, 220, 204, 207, 222, 225, 201, 206, 213, 205, 218, 219, 224, 222, 198, 222, 208, 222, 208, 235, 201, 189, 204, 198, 202, 199, 201, 209, 192, 192, 217}, 
+    {200, 200, 199, 199, 200, 201, 202, 203, 210, 208, 205, 203, 201, 197, 191, 186, 170, 212, 216, 191, 222, 217, 218, 185, 216, 226, 200, 193, 207, 232, 193, 221, 210, 124, 127, 218, 223, 192, 197, 207, 207, 209, 210, 220, 209, 184}, 
+    {202, 201, 201, 200, 200, 200, 201, 201, 196, 197, 200, 203, 203, 200, 195, 191, 196, 180, 168, 123, 34, 66, 56, 74, 57, 83, 73, 81, 94, 221, 72, 64, 120, 119, 83, 100, 207, 190, 198, 198, 94, 44, 57, 50, 213, 215}, 
+    {54, 54, 54, 53, 53, 54, 54, 54, 49, 51, 55, 59, 62, 63, 63, 62, 54, 110, 65, 43, 69, 40, 54, 36, 53, 67, 57, 65, 66, 61, 94, 83, 83, 69, 102, 99, 64, 214, 195, 90, 28, 46, 63, 51, 43, 57}, 
+    {52, 52, 53, 54, 54, 55, 55, 55, 56, 54, 51, 48, 47, 46, 48, 49, 56, 63, 48, 72, 67, 55, 51, 65, 50, 48, 46, 70, 49, 67, 63, 86, 59, 107, 60, 73, 40, 44, 102, 36, 40, 218, 192, 165, 101, 44}, 
+    {198, 199, 200, 201, 202, 202, 202, 202, 199, 197, 194, 190, 188, 190, 194, 198, 196, 151, 88, 202, 61, 71, 148, 169, 165, 188, 139, 77, 86, 70, 81, 84, 163, 226, 206, 184, 52, 46, 48, 165, 204, 189, 179, 213, 208, 79}, 
+    {199, 200, 201, 202, 202, 201, 200, 199, 201, 203, 204, 205, 206, 209, 214, 218, 218, 198, 195, 199, 182, 201, 202, 206, 201, 228, 240, 191, 131, 121, 110, 221, 211, 208, 207, 198, 213, 231, 204, 220, 197, 211, 207, 194, 207, 213}, 
+    {201, 202, 202, 203, 202, 200, 199, 197, 199, 202, 206, 206, 204, 202, 202, 203, 205, 195, 210, 199, 211, 220, 210, 224, 224, 204, 215, 205, 227, 218, 229, 220, 203, 201, 199, 202, 206, 206, 195, 205, 203, 194, 202, 197, 210, 190}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 203, 206, 210, 213, 213, 210, 206, 203, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 198, 199, 201, 202, 202, 201, 199, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 198, 197, 197, 198, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 202, 201, 200, 199, 199, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 199, 199, 199, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 198, 199, 200, 201, 201, 200, 199, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 202, 202, 202, 202, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200} 
+};
+
+static const uint8  jpeg_24bit_j80[JPEGY][JPEGX][3] =
+{
+    252, 106, 0, 252, 106, 0, 252, 106, 0, 252, 106, 0, 253, 105, 0, 253, 105, 0, 255, 104, 0, 
+    255, 104, 0, 255, 105, 0, 255, 105, 0, 255, 105, 0, 255, 104, 0, 255, 104, 0, 255, 103, 0, 
+    255, 102, 0, 252, 106, 0, 237, 111, 0, 235, 114, 0, 246, 111, 0, 248, 111, 0, 241, 114, 0, 
+    243, 111, 0, 251, 103, 3, 255, 99, 4, 255, 105, 7, 255, 106, 4, 248, 110, 1, 250, 108, 0, 
+    255, 99, 1, 255, 97, 6, 255, 101, 13, 251, 104, 9, 251, 106, 0, 248, 108, 0, 245, 109, 1, 
+    239, 110, 6, 235, 111, 11, 234, 111, 17, 239, 107, 22, 245, 107, 9, 255, 106, 0, 
+    255, 105, 0, 255, 102, 0, 255, 101, 0, 255, 101, 0, 255, 101, 0, 
+
+    252, 105, 0, 252, 105, 0, 252, 105, 0, 252, 105, 0, 252, 105, 0, 253, 105, 0, 253, 105, 0, 
+    253, 105, 0, 253, 102, 0, 253, 102, 0, 254, 101, 0, 254, 101, 0, 255, 102, 0, 255, 102, 0, 
+    255, 101, 0, 253, 105, 0, 245, 109, 0, 243, 109, 0, 247, 105, 0, 248, 104, 0, 246, 105, 0, 
+    251, 106, 1, 255, 104, 4, 255, 105, 5, 251, 98, 0, 248, 102, 0, 246, 105, 0, 251, 105, 0, 
+    255, 101, 0, 255, 100, 2, 254, 104, 9, 251, 105, 6, 252, 106, 0, 252, 106, 0, 253, 105, 0, 
+    251, 105, 4, 246, 106, 9, 244, 106, 15, 245, 105, 20, 251, 104, 11, 255, 104, 0, 
+    255, 104, 0, 255, 102, 0, 255, 102, 0, 255, 104, 0, 255, 105, 0, 
+
+    251, 105, 4, 251, 105, 4, 251, 105, 4, 251, 105, 4, 251, 105, 4, 252, 104, 4, 252, 104, 4, 
+    252, 104, 4, 252, 103, 3, 253, 104, 4, 253, 104, 4, 253, 104, 4, 253, 104, 4, 254, 105, 5, 
+    254, 105, 5, 255, 105, 2, 255, 105, 0, 255, 103, 0, 255, 102, 0, 255, 99, 0, 255, 97, 1, 
+    255, 98, 3, 255, 102, 4, 255, 105, 1, 251, 104, 0, 251, 107, 0, 255, 108, 0, 255, 107, 0, 
+    255, 104, 0, 255, 104, 0, 250, 105, 0, 247, 105, 0, 253, 106, 0, 255, 103, 0, 255, 96, 0, 
+    255, 94, 4, 255, 95, 6, 255, 98, 9, 255, 98, 17, 255, 99, 13, 255, 99, 2, 255, 100, 0, 
+    255, 103, 4, 248, 106, 8, 241, 109, 9, 237, 111, 9, 
+
+    252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 253, 104, 4, 252, 104, 4, 253, 104, 4, 
+    253, 104, 4, 255, 106, 6, 255, 106, 6, 255, 106, 6, 254, 105, 5, 254, 105, 5, 253, 104, 4, 
+    253, 104, 4, 255, 102, 1, 255, 98, 0, 255, 97, 0, 255, 100, 3, 255, 98, 9, 255, 95, 12, 
+    255, 95, 9, 255, 98, 2, 252, 101, 0, 252, 108, 0, 254, 108, 0, 255, 103, 0, 255, 103, 0, 
+    255, 103, 0, 253, 106, 0, 244, 109, 0, 244, 107, 0, 255, 105, 0, 255, 99, 0, 255, 95, 0, 
+    255, 94, 1, 255, 94, 6, 255, 96, 8, 255, 98, 11, 255, 99, 9, 255, 98, 8, 255, 99, 6, 
+    255, 102, 8, 248, 105, 11, 241, 108, 15, 238, 109, 17, 
+
+    255, 102, 1, 255, 102, 1, 255, 102, 1, 255, 103, 1, 255, 102, 1, 255, 103, 1, 255, 102, 1, 
+    255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 
+    255, 103, 1, 255, 99, 1, 255, 93, 1, 255, 92, 6, 255, 93, 18, 255, 93, 23, 255, 92, 26, 
+    255, 95, 20, 242, 105, 11, 237, 108, 4, 244, 105, 0, 255, 100, 0, 255, 90, 5, 255, 91, 7, 
+    254, 99, 6, 245, 108, 2, 239, 114, 0, 244, 112, 1, 255, 99, 15, 255, 96, 15, 255, 101, 1, 
+    255, 102, 0, 255, 102, 9, 253, 103, 9, 255, 103, 2, 255, 103, 1, 255, 100, 6, 255, 99, 4, 
+    255, 100, 0, 255, 101, 0, 255, 100, 9, 255, 100, 15, 
+
+    255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 
+    255, 101, 1, 255, 102, 1, 255, 102, 1, 255, 103, 2, 255, 103, 2, 255, 104, 3, 255, 105, 3, 
+    255, 105, 4, 255, 104, 5, 255, 100, 11, 255, 97, 16, 255, 94, 19, 255, 93, 22, 255, 95, 21, 
+    254, 102, 19, 239, 115, 15, 238, 120, 14, 248, 108, 10, 255, 100, 11, 255, 88, 16, 
+    255, 89, 15, 255, 100, 11, 244, 107, 3, 240, 111, 0, 245, 107, 0, 255, 98, 18, 255, 96, 18, 
+    255, 103, 1, 251, 106, 0, 248, 105, 9, 246, 106, 8, 248, 108, 0, 251, 107, 0, 255, 103, 4, 
+    255, 101, 4, 255, 101, 0, 255, 100, 0, 255, 99, 4, 255, 98, 9, 
+
+    255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 101, 2, 
+    255, 101, 2, 255, 104, 4, 255, 104, 4, 255, 103, 3, 255, 102, 2, 255, 102, 2, 254, 102, 1, 
+    254, 100, 0, 251, 101, 4, 250, 103, 10, 255, 101, 11, 255, 99, 7, 255, 100, 3, 255, 102, 0, 
+    250, 105, 0, 229, 112, 0, 230, 109, 2, 247, 98, 4, 255, 91, 8, 255, 85, 8, 255, 89, 7, 
+    255, 100, 3, 253, 105, 0, 253, 103, 0, 255, 100, 0, 255, 99, 9, 255, 99, 9, 255, 102, 1, 
+    255, 104, 0, 249, 106, 4, 245, 108, 2, 242, 112, 0, 244, 111, 0, 248, 106, 4, 251, 105, 6, 
+    253, 105, 0, 255, 105, 0, 255, 103, 1, 255, 102, 4, 
+
+    255, 99, 4, 255, 99, 4, 255, 99, 4, 255, 100, 4, 255, 99, 4, 255, 100, 4, 255, 100, 4, 
+    255, 101, 4, 255, 102, 5, 255, 101, 4, 255, 98, 1, 250, 96, 0, 246, 92, 0, 242, 90, 0, 
+    240, 86, 0, 236, 86, 0, 235, 92, 0, 244, 96, 0, 255, 96, 0, 255, 97, 0, 255, 97, 0, 
+    248, 92, 0, 222, 87, 0, 214, 78, 0, 229, 68, 0, 248, 67, 0, 255, 72, 0, 255, 81, 0, 
+    255, 94, 3, 255, 99, 5, 255, 97, 9, 255, 98, 9, 255, 101, 13, 249, 104, 15, 249, 104, 13, 
+    249, 105, 9, 248, 106, 6, 246, 108, 1, 245, 110, 0, 245, 110, 0, 248, 106, 6, 249, 105, 9, 
+    251, 105, 2, 253, 105, 0, 255, 103, 0, 255, 103, 0, 
+
+    255, 98, 7, 255, 98, 6, 255, 98, 6, 255, 99, 6, 255, 94, 2, 252, 89, 0, 252, 89, 0, 
+    253, 93, 0, 254, 94, 0, 254, 95, 1, 255, 96, 2, 254, 97, 2, 253, 96, 1, 250, 96, 0, 
+    250, 93, 0, 246, 93, 0, 234, 86, 0, 229, 71, 0, 249, 64, 0, 247, 51, 0, 222, 30, 0, 
+    255, 73, 0, 255, 83, 0, 242, 72, 0, 241, 67, 0, 243, 64, 0, 242, 60, 0, 228, 41, 0, 
+    219, 28, 0, 255, 83, 26, 246, 56, 8, 223, 52, 0, 197, 60, 0, 174, 54, 0, 185, 64, 0, 
+    233, 105, 30, 239, 101, 10, 251, 105, 4, 255, 110, 10, 248, 94, 0, 249, 98, 7, 255, 111, 25, 
+    239, 83, 0, 255, 105, 13, 255, 99, 0, 255, 100, 0, 
+
+    237, 105, 43, 234, 104, 42, 235, 105, 43, 236, 106, 44, 234, 104, 42, 228, 100, 37, 
+    229, 101, 38, 232, 104, 41, 214, 89, 25, 224, 99, 35, 235, 111, 47, 243, 119, 55, 
+    244, 120, 56, 244, 122, 57, 246, 124, 59, 244, 130, 59, 228, 126, 44, 235, 132, 53, 
+    220, 100, 37, 210, 84, 36, 208, 85, 54, 185, 62, 46, 193, 64, 58, 253, 126, 119, 
+    196, 79, 61, 156, 47, 18, 181, 78, 37, 229, 120, 81, 215, 89, 64, 185, 62, 47, 178, 73, 70, 
+    192, 114, 102, 156, 111, 72, 222, 190, 139, 232, 195, 150, 109, 49, 0, 203, 101, 26, 
+    236, 106, 20, 250, 104, 19, 232, 90, 24, 188, 75, 43, 183, 83, 68, 185, 83, 68, 183, 70, 40, 
+    203, 68, 13, 247, 100, 33, 
+
+    176, 117, 113, 174, 116, 112, 176, 118, 114, 178, 120, 116, 177, 119, 115, 175, 117, 113, 
+    176, 118, 114, 178, 123, 118, 178, 123, 118, 174, 119, 114, 163, 108, 103, 150, 97, 91, 
+    146, 93, 87, 162, 109, 103, 190, 137, 131, 203, 166, 148, 192, 185, 141, 174, 190, 145, 
+    168, 193, 172, 180, 214, 226, 10, 45, 101, 87, 110, 206, 64, 61, 192, 100, 92, 229, 
+    84, 94, 209, 92, 118, 202, 105, 143, 190, 108, 147, 176, 147, 170, 204, 74, 112, 151, 
+    89, 171, 219, 34, 144, 181, 110, 227, 237, 115, 232, 223, 76, 187, 168, 130, 191, 157, 
+    157, 124, 71, 216, 124, 57, 226, 108, 36, 207, 113, 87, 142, 120, 193, 54, 69, 186, 
+    48, 66, 168, 78, 66, 150, 155, 87, 144, 190, 95, 139, 
+
+    91, 67, 91, 89, 65, 89, 90, 66, 90, 93, 69, 93, 93, 69, 93, 92, 68, 92, 92, 70, 93, 
+    95, 73, 96, 96, 74, 97, 95, 73, 96, 92, 68, 92, 85, 63, 86, 83, 61, 84, 93, 71, 94, 
+    113, 91, 114, 119, 113, 123, 85, 113, 91, 133, 192, 174, 82, 171, 185, 4, 111, 165, 
+    0, 108, 211, 0, 58, 198, 13, 72, 238, 0, 40, 205, 11, 77, 217, 47, 127, 240, 0, 95, 181, 
+    32, 134, 208, 33, 129, 206, 13, 135, 212, 0, 168, 243, 12, 203, 255, 0, 143, 162, 
+    44, 194, 192, 86, 226, 213, 123, 220, 209, 91, 110, 116, 155, 123, 124, 199, 145, 119, 
+    188, 145, 154, 43, 40, 143, 10, 34, 166, 49, 83, 180, 21, 42, 125, 57, 44, 134, 99, 70, 163, 
+
+
+    95, 70, 92, 91, 66, 88, 93, 65, 88, 95, 67, 90, 96, 68, 91, 94, 66, 89, 95, 67, 90, 
+    98, 70, 93, 84, 56, 79, 88, 60, 83, 94, 64, 88, 94, 66, 89, 91, 63, 86, 85, 57, 80, 
+    78, 50, 73, 70, 50, 61, 92, 90, 78, 43, 72, 70, 5, 73, 118, 22, 115, 195, 23, 124, 232, 
+    27, 117, 231, 56, 114, 211, 40, 83, 162, 28, 74, 134, 0, 51, 114, 0, 64, 144, 18, 97, 190, 
+    19, 114, 220, 2, 128, 228, 0, 159, 235, 37, 205, 242, 70, 177, 167, 124, 193, 162, 
+    52, 106, 80, 61, 109, 129, 8, 60, 162, 14, 64, 179, 139, 181, 239, 31, 41, 77, 83, 30, 84, 
+    180, 109, 139, 192, 142, 109, 234, 217, 189, 158, 185, 232, 2, 52, 137, 
+
+    183, 122, 117, 178, 117, 112, 178, 115, 110, 180, 117, 112, 181, 118, 113, 179, 116, 111, 
+    179, 116, 111, 181, 118, 113, 191, 126, 122, 190, 125, 121, 191, 126, 122, 196, 131, 127, 
+    205, 137, 134, 207, 139, 136, 205, 137, 134, 199, 136, 127, 173, 116, 96, 249, 217, 204, 
+    181, 186, 205, 123, 151, 190, 64, 97, 150, 88, 110, 159, 206, 203, 230, 181, 160, 175, 
+    255, 230, 238, 133, 110, 126, 235, 230, 255, 88, 111, 165, 83, 137, 201, 57, 137, 198, 
+    59, 159, 208, 87, 166, 183, 202, 217, 184, 99, 76, 24, 165, 128, 84, 207, 177, 185, 
+    56, 58, 159, 43, 62, 180, 53, 75, 133, 235, 218, 236, 186, 84, 80, 227, 96, 50, 243, 136, 30, 
+    189, 124, 30, 131, 128, 121, 117, 145, 182, 
+
+    238, 109, 51, 232, 103, 45, 229, 100, 42, 231, 102, 44, 234, 104, 46, 232, 102, 44, 
+    234, 101, 44, 236, 103, 46, 248, 113, 57, 243, 108, 52, 237, 102, 46, 232, 97, 41, 
+    227, 90, 35, 217, 80, 25, 203, 66, 11, 192, 55, 1, 201, 66, 18, 226, 102, 50, 229, 127, 61, 
+    226, 135, 64, 223, 130, 63, 221, 116, 58, 231, 108, 66, 244, 103, 73, 227, 68, 46, 
+    197, 48, 24, 154, 42, 5, 202, 134, 89, 232, 210, 161, 193, 179, 144, 242, 195, 189, 
+    158, 81, 71, 148, 43, 0, 240, 117, 50, 211, 76, 10, 215, 80, 35, 195, 67, 66, 178, 57, 62, 
+    187, 72, 45, 187, 63, 11, 255, 108, 38, 250, 97, 3, 255, 126, 3, 244, 120, 6, 204, 100, 29, 
+    193, 98, 50, 
+
+    255, 101, 10, 255, 96, 5, 251, 92, 1, 253, 94, 3, 255, 95, 5, 255, 95, 5, 255, 95, 5, 
+    255, 95, 6, 255, 91, 2, 250, 86, 0, 246, 81, 0, 246, 81, 0, 250, 85, 0, 255, 91, 2, 
+    255, 93, 5, 255, 92, 11, 255, 88, 18, 253, 86, 8, 255, 100, 0, 249, 96, 0, 239, 80, 0, 
+    247, 81, 0, 238, 62, 0, 222, 30, 0, 227, 20, 0, 255, 72, 15, 231, 69, 0, 198, 74, 0, 
+    168, 82, 0, 174, 88, 1, 169, 39, 0, 191, 36, 0, 255, 102, 34, 255, 91, 10, 255, 98, 15, 
+    255, 95, 15, 251, 67, 3, 255, 80, 15, 255, 85, 9, 255, 96, 6, 255, 91, 0, 255, 110, 0, 
+    248, 94, 0, 254, 101, 0, 245, 92, 0, 255, 103, 10, 
+
+    255, 104, 6, 255, 104, 6, 255, 103, 5, 255, 102, 4, 255, 101, 3, 253, 99, 1, 253, 99, 1, 
+    254, 97, 0, 255, 101, 4, 255, 101, 4, 255, 101, 4, 255, 101, 4, 255, 101, 4, 255, 101, 4, 
+    255, 101, 4, 255, 100, 6, 250, 86, 0, 245, 80, 0, 232, 73, 0, 226, 67, 0, 230, 69, 0, 
+    240, 77, 0, 254, 86, 0, 255, 93, 6, 255, 95, 12, 255, 94, 10, 255, 96, 4, 245, 99, 0, 
+    235, 103, 2, 237, 104, 9, 248, 102, 19, 255, 101, 19, 255, 101, 9, 255, 101, 6, 255, 101, 4, 
+    255, 100, 4, 255, 99, 9, 255, 99, 9, 255, 100, 6, 255, 101, 2, 255, 102, 0, 255, 103, 0, 
+    255, 104, 0, 255, 104, 0, 255, 104, 1, 255, 103, 2, 
+
+    255, 105, 2, 255, 105, 2, 255, 104, 1, 255, 104, 1, 254, 103, 0, 253, 102, 0, 252, 101, 0, 
+    252, 101, 0, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 104, 6, 255, 103, 5, 255, 100, 2, 255, 99, 1, 255, 99, 1, 
+    255, 102, 4, 255, 106, 8, 255, 109, 10, 255, 102, 3, 255, 101, 2, 255, 99, 0, 255, 99, 0, 
+    255, 99, 0, 255, 100, 0, 255, 102, 2, 255, 103, 3, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 254, 103, 0, 254, 103, 0, 254, 103, 0, 
+    254, 103, 0, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 100, 1, 255, 100, 2, 255, 101, 3, 255, 101, 3, 255, 101, 3, 
+    255, 100, 2, 255, 99, 1, 255, 99, 0, 255, 103, 4, 255, 103, 3, 255, 103, 3, 255, 102, 2, 
+    255, 102, 2, 255, 103, 3, 255, 103, 3, 255, 104, 4, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 103, 4, 255, 102, 3, 255, 99, 1, 255, 99, 0, 255, 98, 0, 
+    255, 99, 0, 255, 100, 1, 255, 101, 1, 255, 103, 3, 255, 103, 3, 255, 104, 4, 255, 104, 4, 
+    255, 104, 4, 255, 104, 4, 255, 103, 3, 255, 103, 3, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    254, 103, 0, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 106, 6, 255, 105, 5, 255, 102, 3, 255, 102, 2, 255, 102, 2, 
+    255, 103, 3, 255, 105, 5, 255, 106, 6, 255, 102, 2, 255, 102, 2, 255, 103, 3, 255, 104, 3, 
+    255, 104, 3, 255, 104, 3, 255, 103, 2, 255, 103, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 251, 97, 0, 252, 98, 0, 255, 100, 0, 255, 101, 1, 255, 102, 2, 
+    255, 101, 1, 254, 100, 0, 253, 99, 0, 255, 101, 1, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 254, 102, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 253, 102, 0, 255, 104, 1, 255, 105, 3, 255, 108, 5, 255, 108, 5, 
+    255, 107, 4, 255, 105, 2, 254, 103, 0, 255, 104, 1, 253, 104, 1, 253, 104, 1, 253, 104, 1, 
+    253, 104, 1, 253, 104, 1, 253, 104, 1, 253, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1 
+};
+
+/* Sub-tests for test_mgr_old() */
+static void test_mgr_old_a(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    char oldrlefile[512] = "";
+    char *srcdir = getenv("srcdir");
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(OLDRLEFILE) + 1) < sizeof(oldrlefile))) {
+        strcpy(oldrlefile, srcdir);
+        strcat(oldrlefile, "/");
+    }
+    strcat(oldrlefile, OLDRLEFILE);
+
+/* A - Read RLE compressed data from old raster image file */
+    MESSAGE(8, printf("Read RLE compressed image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(oldrlefile,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={10,10};    /* dimensions for the empty image */
+        uint8 image[10][10]; /* space for the image data */
+        uint8 image0[10][10]; /* space for the image data */
+        int32 start[2]; /* start of image data to grab */
+        int32 stride[2];/* stride of image data to grab */
+        intn i,j;       /* indices */
+
+        /* Initialize data we are looking for in image */
+        for (i = 0; i < 10; i++)
+            for (j = 0; j < 10; j++)
+                image0[i][j] = (uint8) (i + j);
+
+        /* Get the first image in this file */
+        riid=GRselect(grid,0);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image,image0,10*10)!=0) {
+            MESSAGE(3, printf("Error reading data for RLE compressed image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_old_a() */
+
+static void test_mgr_old_c(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    char oldgreyjpegfile[512] = "";
+    char *srcdir = getenv("srcdir");
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(OLDGREYJPEGFILE) + 1) < sizeof(oldgreyjpegfile))) {
+        strcpy(oldgreyjpegfile, srcdir);
+        strcat(oldgreyjpegfile, "/");
+    }
+    strcat(oldgreyjpegfile, OLDGREYJPEGFILE);
+
+/* C - Read 8-bit JPEG compressed data from old raster image file */
+    MESSAGE(8, printf("Read 8-bit JPEG compressed image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(oldgreyjpegfile,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={JPEGX,JPEGY};    /* dimensions for the empty image */
+        uint8 image[JPEGY][JPEGX]; /* space for the image data */
+        int32 start[2]; /* start of image data to grab */
+        int32 stride[2];/* stride of image data to grab */
+
+        /* Get the first image in this file */
+        riid=GRselect(grid,0);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image,jpeg_8bit_j80,JPEGY*JPEGX)!=0) {
+            MESSAGE(3, printf("Error reading data for 8-bit JPEG compressed image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_old_c() */
+
+static void test_mgr_old_e(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    char oldjpegfile[512] = "";
+    char *srcdir = getenv("srcdir");
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(OLDJPEGFILE) + 1) < sizeof(oldjpegfile))) {
+        strcpy(oldjpegfile, srcdir);
+        strcat(oldjpegfile, "/");
+    }
+    strcat(oldjpegfile, OLDJPEGFILE);
+
+/* E - Read 24-bit JPEG compressed data from old raster image file */
+    MESSAGE(8, printf("Read 24-bit JPEG compressed image\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(oldjpegfile,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={JPEGX,JPEGY};    /* dimensions for the empty image */
+        uint8 image[JPEGY][JPEGX][3]; /* space for the image data */
+        int32 start[2]; /* start of image data to grab */
+        int32 stride[2];/* stride of image data to grab */
+
+        /* Get the first image in this file */
+        riid=GRselect(grid,0);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image,jpeg_24bit_j80,JPEGY*JPEGX*3)!=0) {
+            /*  MESSAGE(3, printf("Error reading data for 24-bit JPEG compressed image\n"););
+            num_errs++;
+ */ 
+        } /* end if */
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_old_e() */
+
+/****************************************************************
+**
+**  test_mgr_old(): Multi-file Raster Old-style Image Access tests
+** 
+**  VIII. Old-style raster image tests
+**      A. Read data from RLE compressed image
+**      B. Create RLE compressed image & write to it (not implemented)
+**      C. Read data from 8-bit JPEG compressed image
+**      D. Create 8-bit JPEG compressed image & write to it
+**      E. Read data from 24-bit JPEG compressed image
+**      F. Create 24-bit JPEG compressed image & write to it
+** 
+****************************************************************/
+static void
+test_mgr_old(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster Old-Style Access\n"););
+    test_mgr_old_a(flag);
+#ifdef NOT_IMPLEMENTED
+    test_mgr_old_b(flag);
+#endif
+    test_mgr_old_c(flag);
+#ifdef NOT_IMPLEMENTED
+    test_mgr_old_d(flag);
+#endif
+    test_mgr_old_e(flag);
+#ifdef NOT_IMPLEMENTED
+    test_mgr_old_f(flag);
+#endif /* NOT_YET */
+
+}   /* end test_mgr_old() */
+
+#define GR_R24FILE    "test_files/gr_r24.dat"
+#define GR_R24XDIM      8
+#define GR_R24YDIM      10
+
+/* Sub-tests for test_mgr_r24() */
+static void test_mgr_r24_a(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    char gr_r24file[512] = "";
+    char *srcdir = getenv("srcdir");
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(GR_R24FILE) + 1) < sizeof(gr_r24file))) {
+        strcpy(gr_r24file, srcdir);
+        strcat(gr_r24file, "/");
+    }
+    strcat(gr_r24file, GR_R24FILE);
+
+/* A - Write/Read DF24 image */
+    MESSAGE(8, printf("Operate on DF24 images\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(gr_r24file,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={GR_R24XDIM,GR_R24YDIM};    /* dimensions for the empty image */
+        uint8 image[GR_R24YDIM][GR_R24XDIM][3]; /* space for the image data */
+        uint8 image0[GR_R24YDIM][GR_R24XDIM][3]; /* space for the image data */
+        int32 start[2];     /* start of image data to grab */
+        int32 stride[2];    /* stride of image data to grab */
+        int32 ncomp;        /* Number of components in the DF24 image */
+        int32 nt;           /* Number-type of the DF24 image */
+        int32 dimsizes[2];  /* Dimensions of the DF24 image */
+        intn  i,j,k;                 /* indices */
+	intn  is_mappedable;/* TRUE if the image is mapped-able (hmap project)*/
+	intn  name_generated; /* TRUE if the image has name generated by lib */
+
+        /* Initialize data we are going to write out */
+        for(i=0; i<GR_R24YDIM; i++)
+            for(j=0; j<GR_R24XDIM; j++)
+                for(k=0; k<3; k++)
+                    image[i][j][k]=(k+1)*j;
+
+        /* Get the first image in this file */
+        riid=GRselect(grid,0);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Check the image information */
+        ret=GRgetiminfo(riid,NULL,&ncomp,&nt,NULL,dimsizes,NULL);
+        CHECK_VOID(ret,FAIL,"GRgetiminfo");
+        VERIFY_VOID(ncomp,3,"GRgetiminfo");
+        VERIFY_VOID(nt,DFNT_UCHAR8,"GRgetiminfo");
+        VERIFY_VOID(dimsizes[0],dims[0],"GRgetiminfo");
+        VERIFY_VOID(dimsizes[1],dims[1],"GRgetiminfo");
+
+        /* Test GR2bmapped on this image, should not be mapped-able because */
+        /* ncomp=3. (For hmap project only) */
+        ret = GR2bmapped(riid, &is_mappedable, &name_generated);
+        CHECK_VOID(ret, FAIL, "GR2bmapped");
+        VERIFY_VOID(is_mappedable, FALSE, "GR2bmapped");
+        VERIFY_VOID(name_generated, TRUE, "GR2bmapped");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image0);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image,image0,GR_R24YDIM*GR_R24XDIM*3)!=0) {
+            MESSAGE(3, printf("Error reading data for DF24 image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_r24_a() */
+
+/****************************************************************
+**
+**  test_mgr_r24(): Multi-file Raster/DF24 Compatibility Tests
+** 
+**  X. Multi-File Raster/DF24 Compatibility Tests
+**      A. Read/Write DF24 Image
+** 
+****************************************************************/
+static void
+test_mgr_r24(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster/DF24 Compatibility\n"););
+
+    test_mgr_r24_a(flag);
+
+}   /* end test_mgr_r24() */
+
+#define GR_R8FILE    "gr_r8.hdf"
+#define GR_R8XDIM      8
+#define GR_R8YDIM      10
+
+/* Sub-tests for test_mgr_r8() */
+static void test_mgr_r8_a(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    uint8 palette[256][3];
+    uint8 picture[GR_R8YDIM][GR_R8XDIM];
+    intn  i,j;              /* indices */
+
+/* A - Write/Read DF8 image with palette */
+    MESSAGE(8, printf("Operate on DF8 images\n"););
+
+    /* initialize the palette */
+    for (i = 0; i < 256; i++)
+    {
+        for (j = 0; j < 3; j++)
+        {
+            palette[i][j] = i;
+        }
+    }
+
+    /* initialize the image */
+    for (j = 0; j < GR_R8XDIM; j++)
+    {
+        for (i = 0; i < GR_R8YDIM; i++)
+        {
+            picture[i][j] = i+j;
+        }
+    }
+
+    /* Write out the test data */
+    ret = DFR8setpalette((VOIDP) palette);
+    CHECK_VOID(ret,FAIL,"DFR8setpalette");
+    ret = DFR8putimage(GR_R8FILE, (VOIDP) picture, GR_R8XDIM, GR_R8YDIM, COMP_RLE);
+    CHECK_VOID(ret,FAIL,"DFR8putimage");
+
+    /* Open up the existing datafile and get the image information from it */
+    fid=Hopen(GR_R8FILE,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the image */
+        int32 pal_id;     /* Palette ID for the LUT */
+        int32 dims[2]={GR_R8XDIM,GR_R8YDIM};    /* dimensions for the empty image */
+        uint8 image[GR_R8YDIM][GR_R8XDIM]; /* space for the image data */
+        uint8 image0[GR_R8YDIM][GR_R8XDIM]; /* space for the image data */
+        int32 start[2];     /* start of image data to grab */
+        int32 stride[2];    /* stride of image data to grab */
+        int32 ncomp;        /* Number of components in the DFR8 image */
+        int32 nt;           /* Number-type of the DFR8 image */
+        int32 dimsizes[2];  /* Dimensions of the DFR8 image */
+        int32 interlace;    /* Palette interlace */
+        int32 num_entries;  /* Number of palette entries */
+	intn  is_mappedable;/* TRUE if the image is mapped-able (hmap project)*/
+        intn  name_generated; /* TRUE if the image has name generated by lib */
+
+        /* Initialize data we are expecting to read in */
+        for(i=0; i<GR_R8YDIM; i++)
+            for(j=0; j<GR_R8XDIM; j++)
+                image[i][j]=i+j;
+
+        /* Get the first image in this file */
+        riid=GRselect(grid,0);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Check the image information */
+        ret=GRgetiminfo(riid,NULL,&ncomp,&nt,NULL,dimsizes,NULL);
+        CHECK_VOID(ret,FAIL,"GRgetiminfo");
+        VERIFY_VOID(ncomp,1,"GRgetiminfo");
+        VERIFY_VOID(nt,DFNT_UCHAR8,"GRgetiminfo");
+        VERIFY_VOID(dimsizes[0],dims[0],"GRgetiminfo");
+        VERIFY_VOID(dimsizes[1],dims[1],"GRgetiminfo");
+
+        /* Test GR2bmapped on this image, should be mapped-able */
+        /* (For hmap project only) */
+        ret = GR2bmapped(riid, &is_mappedable, &name_generated);
+        CHECK_VOID(ret, FAIL, "GR2bmapped");
+        VERIFY_VOID(is_mappedable, TRUE, "GR2bmapped");
+        VERIFY_VOID(name_generated, TRUE, "GR2bmapped");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image0);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image,image0,GR_R8YDIM*GR_R8XDIM)!=0) {
+            MESSAGE(3, printf("Error reading data for DF8 image\n"););
+            num_errs++;
+        } /* end if */
+
+        pal_id = GRgetlutid(riid, 0);
+        CHECK_VOID(pal_id,FAIL,"GRgetlutid");
+
+        ncomp=nt=0;
+        ret = GRgetlutinfo(pal_id, &ncomp, &nt, &interlace, &num_entries);
+        CHECK_VOID(ret,FAIL,"GRgetlutinfo");
+        VERIFY_VOID(ncomp,3,"GRgetlutinfo");
+        VERIFY_VOID(nt,DFNT_UINT8,"GRgetlutinfo");
+        VERIFY_VOID(interlace,0,"GRgetlutinfo");
+        VERIFY_VOID(num_entries,256,"GRgetlutinfo");
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+
+} /* end test_mgr_r8_a() */
+
+
+/****************************************************************
+**
+**  test_mgr_r8(): Multi-file Raster/DF8 Compatibility Tests
+** 
+**  XI. Multi-File Raster/DF8 Compatibility Tests
+**      A. Read/Write DF8 Image with palette
+** 
+****************************************************************/
+static void
+test_mgr_r8(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster/DF8 Compatibility\n"););
+
+    test_mgr_r8_a(flag);
+
+}   /* end test_mgr_r8() */
+
+#ifdef LATER
+#define GR_DFPFILE    "gr_pal.hdf"
+
+/* Initialization for test_mgr_pal() */
+static void test_mgr_pal_init(void)
+{
+    uint8 pal1[256][3];      /* Palette data to write out */
+    uint8 pal2[256][3];      /* Palette data to write out */
+    intn i,j;                /* indices */
+
+    for(i=0; i<256; i++)
+        for(j=0; j<3; j++) {
+            pal1[i][j]=i;
+            pal2[i][j]=(j==0 ? i : (255-i));
+        } /* end for */
+
+    DFPputpal(GR_DFPFILE,pal1,0,"w");
+    DFPaddpal(GR_DFPFILE,pal2);
+}
+
+/* Sub-tests for test_mgr_pal() */
+static void test_mgr_pal_a(int flag)
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    char gr_r24file[512] = "";
+    char *srcdir = getenv("srcdir");
+
+ fprintf(stderr, "test_mgr_pal_a...\n");
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(GR_R24FILE) + 1) < sizeof(gr_r24file))) {
+        strcpy(gr_r24file, srcdir);
+        strcat(gr_r24file, "/");
+    }
+    strcat(gr_r24file, GR_R24FILE);
+
+/* A - Write/Read DFP palette */
+    MESSAGE(8, printf("Operate on DFP palette\n"););
+
+    /* Open up the existing datafile and get the palette information from it */
+    fid=Hopen(gr_r24file,DFACC_READ,0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize the GR interface */
+    grid=GRstart(fid);
+    CHECK_VOID(grid,FAIL,"GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        int32 dims[2]={GR_R24XDIM,GR_R24YDIM};    /* dimensions for the empty image */
+        uint8 image[GR_R24YDIM][GR_R24XDIM][3]; /* space for the image data */
+        uint8 image0[GR_R24YDIM][GR_R24XDIM][3]; /* space for the image data */
+        int32 start[2];     /* start of image data to grab */
+        int32 stride[2];    /* stride of image data to grab */
+        int32 ncomp;        /* Number of components in the DF24 image */
+        int32 nt;           /* Number-type of the DF24 image */
+        int32 dimsizes[2];  /* Dimensions of the DF24 image */
+        intn i,j,k;                 /* indices */
+
+        /* Initialize data we are going to write out */
+        for(i=0; i<GR_R24YDIM; i++)
+            for(j=0; j<GR_R24XDIM; j++)
+                for(k=0; k<3; k++)
+                    image[i][j][k]=(k+1)*j;
+
+        /* Get the first image in this file */
+        riid=GRselect(grid,0);
+        CHECK_VOID(riid,FAIL,"GRselect");
+
+        /* Check the image information */
+        ret=GRgetiminfo(riid,NULL,&ncomp,&nt,NULL,dimsizes,NULL);
+        CHECK_VOID(ret,FAIL,"GRgetiminfo");
+        VERIFY_VOID(ncomp,3,"GRgetiminfo");
+        VERIFY_VOID(nt,DFNT_UCHAR8,"GRgetiminfo");
+        VERIFY_VOID(dimsizes[0],dims[0],"GRgetiminfo");
+        VERIFY_VOID(dimsizes[1],dims[1],"GRgetiminfo");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret=GRreadimage(riid,start,stride,dims,image0);
+        CHECK_VOID(ret,FAIL,"GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image,image0,GR_R24YDIM*GR_R24XDIM*3)!=0) {
+            MESSAGE(3, printf("Error reading data for DF24 image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the empty image */
+        ret=GRendaccess(riid);
+        CHECK_VOID(ret,FAIL,"GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret=GRend(grid);
+    CHECK_VOID(ret,FAIL,"GRend");
+
+    /* Close the file */
+    ret=Hclose(fid);
+    CHECK_VOID(ret,FAIL,"Hclose");
+} /* end test_mgr_pal_a() */
+
+/****************************************************************
+**
+**  test_mgr_pal(): Multi-file Raster/DFP Compatibility Tests
+** 
+**  XII. Multi-File Raster/DFP Compatibility Tests
+**      A. Read/Write DFP palettes
+** 
+****************************************************************/
+static void
+test_mgr_pal(int flag)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing Multi-file Raster/DFP Compatibility\n"););
+
+    test_mgr_pal_init();
+    test_mgr_pal_a(flag);
+
+}   /* end test_mgr_pal() */
+#endif /* LATER */
+
+static void 
+test_mgr_chunkwr_pixelone()
+{
+   /*
+    * This function tests GR chunking write/read operations for the
+    * following types of compressions:
+    *                COMP_NONE
+    *                COMP_CODE_RLE
+    *                COMP_CODE_SKPHUFF
+    *                COMP_CODE_DEFLATE
+    * and PIXEL interlace mode.
+    */                    
+#define  CHUNKFILE     "ChunkedGR.hdf"
+#define  X_LENGTH      10    /* number of columns in the image */
+#define  Y_LENGTH      6     /* number of rows in the image */
+#define  N_COMPS       3     /* number of components in the image */
+#define  COMP_METH     4     /* number of compression methods used - 4 (0-based) */
+
+   /************************* Variable declaration **************************/
+
+   intn  status;         /* status for functions returning an intn */
+   int32 file_id,        /* HDF file identifier */
+         gr_id,          /* GR interface identifier */
+         ri_id[4],       /* raster image identifier */
+         origin[2],      /* start position to write for each dimension */
+         dim_sizes[2],   /* dimension sizes of the image array */
+         interlace_mode, /* interlace mode of the image */
+         data_type,      /* data type of the image data */
+         comp_flag,      /* compression flag */
+         index,
+         i;
+   int32 start[2],
+         stride[2],
+         edge[2];
+   int16 data_out[3*Y_LENGTH*X_LENGTH];
+   char *image_name[] = { "Image_NO", "Image_RL", "Image_Sk", "Image_DF"};
+   HDF_CHUNK_DEF chunk_def;
+   int16 chunk_buf[18];
+
+   int16 chunk00[] = {        110, 111, 112, 120, 121, 122,
+                              130, 131, 132, 140, 141, 142,
+                              150, 151, 152, 160, 161, 162 };
+ 
+ 
+   int16 chunk01[] = {    210, 211, 212, 220, 221, 222,
+                          230, 231, 232, 240, 241, 242,
+                          250, 251, 252, 260, 261, 262};
+ 
+   int16 chunk14[] = {    1010, 1011, 1012, 1020, 1021, 1022,
+                          1030, 1031, 1032, 1040, 1041, 1042,
+                          1050, 1051, 1052, 1060, 1061, 1062};
+
+   int16 data[]    = {
+                110, 111, 112, 120, 121, 122, 210, 211, 212, 220, 221, 222, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 131, 132, 140, 
+                141, 142, 230, 231, 232, 240, 241, 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 151, 152, 160, 161, 162, 250, 251, 
+                252, 260, 261, 262, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                1010, 1011, 1012, 1020, 1021, 1022, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1030, 1031, 1032, 1040, 1041, 
+                1042, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 1050, 1051, 1052, 1060, 1061, 1062 }; 
+
+
+   /********************** End of variable declaration **********************/
+   /*
+   * Create and open the file.
+   */
+   file_id = Hopen (CHUNKFILE, DFACC_WRITE, 0);
+   CHECK_VOID(file_id, FAIL, "Hopen");
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+   CHECK_VOID(gr_id, FAIL, "GRstart");
+
+   /*
+   * Set the data type, interlace mode, and dimensions of the image.
+   */
+   data_type = DFNT_INT16;
+   interlace_mode = MFGR_INTERLACE_PIXEL;
+   dim_sizes[0] = Y_LENGTH;
+   dim_sizes[1] = X_LENGTH;
+
+   for (i = 0; i < COMP_METH; i++ ) {  
+
+   /*
+   * Create the raster image array.
+   */
+   ri_id[i] = GRcreate (gr_id, image_name[i], N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+   CHECK_VOID(ri_id[i], FAIL, "GRcreate");
+
+   /* 
+   * Create chunked image array.
+   */
+   switch (i) {
+              case 0: 
+                      comp_flag = HDF_CHUNK;
+                      chunk_def.chunk_lengths[0] = 3;
+                      chunk_def.chunk_lengths[1] = 2;
+                      break;
+              case 1 :
+                      comp_flag = HDF_CHUNK | HDF_COMP;
+                      chunk_def.comp.chunk_lengths[0] = 3;
+                      chunk_def.comp.chunk_lengths[1] = 2;
+                      chunk_def.comp.comp_type = COMP_CODE_RLE;
+                      break;
+              case 2 :
+                {
+                      comp_flag = HDF_CHUNK | HDF_COMP;
+                      chunk_def.comp.chunk_lengths[0] = 3;
+                      chunk_def.comp.chunk_lengths[1] = 2;
+                      chunk_def.comp.comp_type = COMP_CODE_SKPHUFF;
+                      chunk_def.comp.cinfo.skphuff.skp_size = 2;
+                      break;
+                }
+              case 3 :
+                { 
+                      comp_flag = HDF_CHUNK | HDF_COMP;
+                      chunk_def.comp.chunk_lengths[0] = 3;
+                      chunk_def.comp.chunk_lengths[1] = 2;
+                      chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+                      chunk_def.comp.cinfo.deflate.level = 6;
+                      break;
+                }
+              default:
+                {
+                      printf("Error\n");
+                      break;
+                }
+
+   } /* end switch */
+    
+   status = GRsetchunk(ri_id[i], chunk_def, comp_flag);
+   CHECK_VOID(status, FAIL, "GRsetchunk");
+
+   /*
+   * Write first data chunk ( 0, 0 ). 
+   */
+   origin[0] = origin[1] = 0;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk00);
+   CHECK_VOID(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write second data chunk ( 0, 1 ). 
+   */
+   origin[0] = 0; origin[1] = 1;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk01);
+   CHECK_VOID(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write third data chunk ( 1, 4 ). 
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk14);
+   CHECK_VOID(status, FAIL, "GRwritechunk");
+   /*
+   * Read third chunk back.
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRreadchunk(ri_id[i], origin, (VOIDP)chunk_buf);
+   CHECK_VOID(status, FAIL, "GRreadchunk");
+
+   /*
+   * Terminate access to the GR interface and close the HDF file.
+   */
+   status = GRendaccess (ri_id[i]);
+   CHECK_VOID(status, FAIL, "GRendaccess");
+ }  /* end for*/
+   status = GRend (gr_id);
+   CHECK_VOID(status, FAIL, "GRend");
+   status = Hclose (file_id);
+   CHECK_VOID(status, FAIL, "Hclose");
+
+    /* 
+    * Open the file.
+    */
+
+    file_id = Hopen (CHUNKFILE, DFACC_WRITE, 0); 
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+   CHECK_VOID(gr_id, FAIL, "GRstart");
+
+   for (i = 0; i < COMP_METH; i++ ) { 
+
+   /*
+   * Find the index of the specified image.
+   */
+   index = GRnametoindex(gr_id, image_name[i]);
+   CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+   /* 
+   * Select the image.
+   */
+   ri_id[i] = GRselect(gr_id, index);
+   CHECK_VOID(ri_id[i], FAIL, "GRselect");
+
+   /*
+   * Read third chunk back.
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRreadchunk(ri_id[i], origin, (VOIDP)chunk_buf);
+   CHECK_VOID(status, FAIL, "GRreadchunk");
+   if (0 != HDmemcmp(chunk_buf, chunk14 , sizeof(chunk14)))
+      {
+            MESSAGE(3, printf("%d: Error in reading chunk\n",__LINE__););
+            MESSAGE(3, printf("%d: Compression method\n", (int)i););
+            num_errs++;
+      } /* end if */
+   /*
+   * Read the whole image.
+   */
+   start[0] = start[1] = 0;
+   stride[0] = stride[1] = 1;
+   edge[0] = Y_LENGTH;
+   edge[1] = X_LENGTH;
+   status = GRreadimage(ri_id[i], start, stride, edge, (VOIDP)data_out);
+   CHECK_VOID(status, FAIL, "GRreadimage");
+   if (0!= HDmemcmp(data_out, data, sizeof(data)))
+      {
+            MESSAGE(3, printf("%d: Error reading data for the whole image\n",__LINE__););
+            MESSAGE(3, printf("%d: Compression method\n", (int)i););
+            num_errs++;
+      } /* end if */
+
+   status = GRendaccess (ri_id[i]);
+   CHECK_VOID(status, FAIL, "GRendaccess");
+
+   } /* end for */    
+   /*
+   * Terminate access to the GR interface and close the HDF file.
+   */
+   status = GRend (gr_id);
+   CHECK_VOID(status, FAIL, "GRend");
+   status = Hclose (file_id);
+   CHECK_VOID(status, FAIL, "Hclose");
+}
+static void 
+test_mgr_chunkwr_pixel(int flag)
+{
+   /*
+    * This function tests GR chunking write/read operations for the
+    * following types of compressions:
+    *                COMP_NONE
+    *                COMP_CODE_RLE
+    *                COMP_CODE_SKPHUFF
+    *                COMP_CODE_DEFLATE
+    * and PIXEL interlace mode.
+    */                    
+/* Writing images to one file does not work , we will write each image to
+   the different files
+#define  FILE_NAME     "ChunkedGR.hdf"
+*/
+#define  X_LENGTH      10    /* number of columns in the image */
+#define  Y_LENGTH      6     /* number of rows in the image */
+#define  N_COMPS       3     /* number of components in the image */
+#define  COMP_METH     4     /* number of compression methods used - 4 (0-based) */
+
+   /************************* Variable declaration **************************/
+
+   intn  status;         /* status for functions returning an intn */
+   int32 file_id,        /* HDF file identifier */
+         gr_id,          /* GR interface identifier */
+         ri_id[4],       /* raster image identifier */
+         origin[2],      /* start position to write for each dimension */
+         dim_sizes[2],   /* dimension sizes of the image array */
+         interlace_mode, /* interlace mode of the image */
+         data_type,      /* data type of the image data */
+         comp_flag,      /* compression flag */
+         index,
+         i;
+   int32 start[2],
+         stride[2],
+         edge[2];
+   intn  is_mappedable;  /* TRUE if the image is mapped-able (hmap project)*/
+   intn  name_generated; /* TRUE if the image has name generated by lib */
+   int16 data_out[3*Y_LENGTH*X_LENGTH];
+   char *image_name[] = { "Image_NO", "Image_RL", "Image_Sk", "Image_DF"};
+   char *file_name[] = { "ChunkedGR_NO.hdf", 
+                          "ChunkedGR_RL.hdf",
+                          "ChunkedGR_SK.hdf",
+                          "ChunkedGR_DF.hdf" };
+   HDF_CHUNK_DEF chunk_def;
+   int16 chunk_buf[18];
+
+   int16 chunk00[] = {        110, 111, 112, 120, 121, 122,
+                              130, 131, 132, 140, 141, 142,
+                              150, 151, 152, 160, 161, 162 };
+ 
+ 
+   int16 chunk01[] = {    210, 211, 212, 220, 221, 222,
+                          230, 231, 232, 240, 241, 242,
+                          250, 251, 252, 260, 261, 262};
+ 
+   int16 chunk14[] = {    1010, 1011, 1012, 1020, 1021, 1022,
+                          1030, 1031, 1032, 1040, 1041, 1042,
+                          1050, 1051, 1052, 1060, 1061, 1062};
+
+   int16 data[]    = {
+                110, 111, 112, 120, 121, 122, 210, 211, 212, 220, 221, 222, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 131, 132, 140, 
+                141, 142, 230, 231, 232, 240, 241, 242, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 151, 152, 160, 161, 162, 250, 251, 
+                252, 260, 261, 262, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                1010, 1011, 1012, 1020, 1021, 1022, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1030, 1031, 1032, 1040, 1041, 
+                1042, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 1050, 1051, 1052, 1060, 1061, 1062 }; 
+
+
+   /********************** End of variable declaration **********************/
+
+   i = flag;
+   /*
+   * Create and open the file.
+   */
+   /*  This call is commented out, since writing to one file does not work
+   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0);
+   */
+   file_id = Hopen (file_name[i], DFACC_CREATE, 0);
+   CHECK_VOID(file_id, FAIL, "Hopen");
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+   CHECK_VOID(gr_id, FAIL, "GRstart");
+
+   /*
+   * Set the data type, interlace mode, and dimensions of the image.
+   */
+   data_type = DFNT_INT16;
+   interlace_mode = MFGR_INTERLACE_PIXEL;
+   dim_sizes[0] = Y_LENGTH;
+   dim_sizes[1] = X_LENGTH;
+
+  /* for (i = 0; i < COMP_METH; i++ ) { */ 
+
+   /*
+   * Create the raster image array.
+   */
+   ri_id[i] = GRcreate (gr_id, image_name[i], N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+   CHECK_VOID(ri_id[i], FAIL, "GRcreate");
+
+   /* 
+   * Create chunked image array.
+   */
+   switch (i) {
+              case 0: 
+                      comp_flag = HDF_CHUNK;
+                      chunk_def.chunk_lengths[0] = 3;
+                      chunk_def.chunk_lengths[1] = 2;
+                      break;
+              case 1 :
+                      comp_flag = HDF_CHUNK | HDF_COMP;
+                      chunk_def.comp.chunk_lengths[0] = 3;
+                      chunk_def.comp.chunk_lengths[1] = 2;
+                      chunk_def.comp.comp_type = COMP_CODE_RLE;
+                      break;
+              case 2 :
+                {
+                      comp_flag = HDF_CHUNK | HDF_COMP;
+                      chunk_def.comp.chunk_lengths[0] = 3;
+                      chunk_def.comp.chunk_lengths[1] = 2;
+                      chunk_def.comp.comp_type = COMP_CODE_SKPHUFF;
+                      chunk_def.comp.cinfo.skphuff.skp_size = 2;
+                      break;
+                }
+              case 3 :
+                { 
+                      comp_flag = HDF_CHUNK | HDF_COMP;
+                      chunk_def.comp.chunk_lengths[0] = 3;
+                      chunk_def.comp.chunk_lengths[1] = 2;
+                      chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+                      chunk_def.comp.cinfo.deflate.level = 6;
+                      break;
+                }
+              default:
+                {
+                      printf("Error\n");
+                      break;
+                }
+
+   } /* end switch */
+    
+   status = GRsetchunk(ri_id[i], chunk_def, comp_flag);
+   CHECK_VOID(status, FAIL, "GRsetchunk");
+
+   /*
+   * Write first data chunk ( 0, 0 ). 
+   */
+   origin[0] = origin[1] = 0;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk00);
+   CHECK_VOID(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write second data chunk ( 0, 1 ). 
+   */
+   origin[0] = 0; origin[1] = 1;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk01);
+   CHECK_VOID(status, FAIL, "GRwritechunk");
+
+   /*
+   * Write third data chunk ( 1, 4 ). 
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRwritechunk(ri_id[i], origin, (VOIDP)chunk14);
+   CHECK_VOID(status, FAIL, "GRwritechunk");
+   /*
+   * Read third chunk back.
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRreadchunk(ri_id[i], origin, (VOIDP)chunk_buf);
+
+   /*
+   * Terminate access to the GR interface and close the HDF file.
+   */
+   status = GRendaccess (ri_id[i]);
+   CHECK_VOID(status, FAIL, "GRendaccess");
+/* } */ /* end for*/
+   status = GRend (gr_id);
+   CHECK_VOID(status, FAIL, "GRend");
+   status = Hclose (file_id);
+   CHECK_VOID(status, FAIL, "Hclose");
+
+    /* 
+    * Open the file.
+    */
+
+/* This does not work, GRreadchunk will fail!
+    file_id = Hopen (FILE_NAME, DFACC_READ, 0);
+*/
+ /*   file_id = Hopen (FILE_NAME, DFACC_WRITE, 0); */
+    file_id = Hopen (file_name[i], DFACC_WRITE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+   /*
+   * Initialize the GR interface.
+   */
+   gr_id = GRstart (file_id);
+   CHECK_VOID(gr_id, FAIL, "GRstart");
+
+   /*for (i = 0; i < COMP_METH; i++ ) { */
+
+   /*
+   * Find the index of the specified image.
+   */
+   index = GRnametoindex(gr_id, image_name[i]);
+   CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+   /* 
+   * Select the image.
+   */
+   ri_id[i] = GRselect(gr_id, index);
+   CHECK_VOID(ri_id[i], FAIL, "GRselect");
+   /*
+   * Read third chunk back.
+   */
+   origin[0] = 1; origin[1] = 4;
+   status = GRreadchunk(ri_id[i], origin, (VOIDP)chunk_buf);
+   CHECK_VOID(status, FAIL, "GRreadchunk");
+   if (0 != HDmemcmp(chunk_buf, chunk14 , sizeof(chunk14)))
+      {
+            MESSAGE(3, printf("%d: Error in reading chunk\n",__LINE__););
+            MESSAGE(3, printf("%d: Compression method\n", (int)i););
+            num_errs++;
+      } /* end if */
+   /*
+   * Read the whole image.
+   */
+   start[0] = start[1] = 0;
+   stride[0] = stride[1] = 1;
+   edge[0] = Y_LENGTH;
+   edge[1] = X_LENGTH;
+   status = GRreadimage(ri_id[i], start, stride, edge, (VOIDP)data_out);
+   CHECK_VOID(status, FAIL, "GRreadimage");
+   if (0!= HDmemcmp(data_out, data, sizeof(data)))
+      {
+            MESSAGE(3, printf("%d: Error reading data for the whole image\n",__LINE__););
+            MESSAGE(3, printf("%d: Compression method\n", (int)i););
+            num_errs++;
+      } /* end if */
+
+   /* Test GR2bmapped on this image, should not be mapped-able because it has */
+   /* chunking storage. (For hmap project only) */
+   status = GR2bmapped(ri_id[i], &is_mappedable, &name_generated);
+   CHECK_VOID(status, FAIL, "GR2bmapped");
+   VERIFY_VOID(is_mappedable, FALSE, "GR2bmapped");
+   VERIFY_VOID(name_generated, FALSE, "GR2bmapped");
+
+   status = GRendaccess (ri_id[i]);
+   CHECK_VOID(status, FAIL, "GRendaccess");
+
+   /*} *//* end for */    
+   /*
+   * Terminate access to the GR interface and close the HDF file.
+   */
+   status = GRend (gr_id);
+   CHECK_VOID(status, FAIL, "GRend");
+   status = Hclose (file_id);
+   CHECK_VOID(status, FAIL, "Hclose");
+}
+
+
+/****************************************************************
+**
+**  test_mgr_chunkwr(): GR chunking test 
+** 
+**  XIII. GR write/read chunking test with enabled compression and
+**       different interlace modes.
+**
+**      A. Write/read GR chunks with different kinds of compressions
+**         and PIXEL Interlace Mode  (test_mgr_chunkrw_pixel) 
+**   
+** 
+****************************************************************/
+static void 
+test_mgr_chunkwr(void)
+{
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing GR chunking WRITE/READ\n"););
+    
+    test_mgr_chunkwr_pixelone();
+    test_mgr_chunkwr_pixel(0);
+    test_mgr_chunkwr_pixel(1);
+    test_mgr_chunkwr_pixel(2);
+    test_mgr_chunkwr_pixel(3);
+
+}   /* end test_mgr_chunkwr() */
+
+/****************************************************************
+**
+**  test_mgr(): Main multi-file raster image test routine
+** 
+****************************************************************/
+void
+test_mgr(void)
+{
+    /*
+        Each major outline portion has its own main function:
+        I. Interface Initialization      - test_mgr_init
+        II. Create Images                - test_mgr_image
+        III. ID/Ref/Index Functions      - test_mgr_index
+        IV. Interlace Functions          - test_mgr_interlace
+        V. Palette Functions             - test_mgr_lut
+        VI. Special Element Functions    - test_mgr_special
+        VII. Atribute Functions          - test_mgr_attr (tmgrattr.c)
+        VIII. Access to old-style images - test_mgr_old
+        IX. Compressed Image Functions   - test_mgr_compress (tmgrcomp.c)
+        X. DF24 Compatibility tests      - test_mgr_r24
+        XI. DF8 Compatibility tests      - test_mgr_r8
+	XII. DFP Compatibility tests     - test_mgr_pal
+        XIII.  Chunking write/read test
+            with enabled compression     - test_mgr_chunkwr
+	XIV. Szip Compression test       - test_mgr_szip
+
+    */
+
+    /* Output message about test being performed */
+    MESSAGE(5, printf("Testing Multi-file Raster routines\n"););
+    test_mgr_init();
+    test_mgr_image(0); /* normal GR */
+    test_mgr_image(1); /* chunked GR */
+    test_mgr_index(0);
+    test_mgr_interlace(0); /* read from normal GR */
+    test_mgr_interlace(1); /* read from chunked GR */
+    test_mgr_lut(0);
+    test_mgr_special(0);
+    test_mgr_attr();
+    test_mgr_old(0);
+    test_mgr_compress();
+    test_mgr_r24(0);
+    test_mgr_r8(0);
+#ifdef LATER
+    test_mgr_pal(0);    /* read in old-style DFP palette tests */
+#endif /* LATER */
+    test_mgr_chunkwr();
+
+#ifdef H4_HAVE_LIBSZ   /* szlib present */
+    test_mgr_szip();   /* write/read with szip compression */
+#else                  /* skip szip test it and report */
+    fprintf(stderr, "         -- ***** GR SZIP test skipped *****\n");
+#endif
+
+    /* Added after fixing bug #814 to test eliminating of duplicate images */
+    test_mgr_dup_images();
+
+}   /* test_mgr() */
+
diff --git a/hdf/test/mgrf.f b/hdf/test/mgrf.f
new file mode 100644
index 0000000..2903d79
--- /dev/null
+++ b/hdf/test/mgrf.f
@@ -0,0 +1,1610 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: mgrf.f 6034 2014-01-19 06:59:14Z epourmal $
+C
+       subroutine mgrf (num_err)
+C
+C Test Program: 
+C   Tests the multi-file GR interface.
+C Input file: none
+C Output file: tmgrf.hdf
+C
+C
+      implicit none
+      include 'fortest.inc'
+
+      integer num_err
+C
+C  ---chunking and compression errors ----------
+      integer err_grchunk, err_grwrchunk, err_grcompress
+C  ---------------------------------------------
+C
+      character*20 myname
+      parameter (myname = 'mgrf')
+
+      integer hopen, hclose
+      integer mgstart, mgfinfo, mgend, mgcreat, mgselct 
+      integer mgn2ndx, mggiinf, mgwrimg, mgrdimg, mgendac
+      integer mgid2rf, mgr2idx, mgrltil, mgrimil, mggltid
+c     integer mgwrlut, mgrdlut
+      integer mgglinf, mgwclut, mgrclut
+c      integer mgsattr
+      integer mgatinf, mggattr, mgfndat
+      integer mgscatt, mgsnatt, mggcatt, mggnatt
+      integer mgwcimg, mgrcimg
+      integer mggnluts
+      
+      integer MFGR_INTERLACE_PIXEL, MFGR_INTERLACE_LINE,
+     *      MFGR_INTERLACE_COMPONENT
+
+      parameter(MFGR_INTERLACE_PIXEL = 0,
+     *          MFGR_INTERLACE_LINE = 1,
+     *          MFGR_INTERLACE_COMPONENT = 2)
+
+      integer DFACC_READ, DFACC_WRITE, DFACC_CREATE, DFACC_ALL  
+      integer DFACC_RDONLY, DFACC_RDWR, DFACC_CLOBBER
+
+      parameter(DFACC_READ        = 1,
+     *          DFACC_WRITE       = 2,
+     *          DFACC_CREATE      = 4,
+     *          DFACC_ALL         = 7,
+     *          DFACC_RDONLY      = 1,
+     *          DFACC_RDWR = 3,
+     *          DFACC_CLOBBER = 4)
+
+      integer DFNT_INT8,  DFNT_UINT8, 
+     *        DFNT_INT16, DFNT_UINT16,
+     *        DFNT_INT32, DFNT_UINT32, 
+     *        DFNT_INT64, DFNT_UINT64,
+     *        DFNT_INT128,DFNT_UINT128,
+     *        DFNT_CHAR8, DFNT_UCHAR8
+ 
+      parameter(DFNT_INT8       = 20,
+     *          DFNT_UINT8      = 21,
+     *          DFNT_INT16      = 22,
+     *          DFNT_UINT16     = 23,
+     *          DFNT_INT32      = 24,
+     *          DFNT_UINT32     = 25,
+     *          DFNT_INT64      = 26,
+     *          DFNT_UINT64     = 27,
+     *          DFNT_INT128     = 28,
+     *          DFNT_UINT128    = 29,
+     *          DFNT_CHAR8      = 4,
+     *          DFNT_UCHAR8     = 3)
+      integer il
+      character*80 TESTFILE
+      character*80 IMAGE1, IMAGE2, IMAGEC, IMAGEC_2
+      character*80 ATNAME1, ATNAME_N, ATNAME_C
+      character*80 ATNAME2, ATNAME2_N, ATNAME2_C
+      character*1 CR
+      character buf(3, 2, 2), buf1(2, 3, 2), buf2(2, 2, 3)
+      character in(3,2,2), in1(2, 3, 2), in2(2, 2, 3)
+      integer   outbuf(4), outbuf1(4), outbuf2(4)
+      integer   inbuf(4), inbuf1(4), inbuf2(4)
+      equivalence (outbuf, buf), (outbuf1, buf1), (outbuf2,buf2)
+      equivalence (inbuf, in), (inbuf1, in1), (inbuf2,in2)
+      character pal(3,256), in_pal(3,256), in_pal2(256,3)
+      integer   file_id, gr_id, ri_id, pal_id, index, index2
+      integer   n_datasets, n_attrs, ref
+      integer   n_comp, nt
+      integer   dims(2), start(2), stride(2)
+      integer*4 attr(5), attr2(5), attr2_n(5)
+      character attr_c(6), attr2_c(6)
+      character cbuf(2,3,4), icbuf(2,3,4)
+      integer i, j, k, ret, number_failed
+      integer n_pal
+
+      DATA attr_c/'A','T','T','R','_','C'/
+      DATA cbuf/'A','B','C','D','E','F','G','H','I','J','K','L',
+     +          'M','N','O','P','Q','R','S','T','U','V','W','X'/
+
+      call ptestban('Testing', myname)
+      num_err = 0
+      TESTFILE = 'tmgrf.hdf'
+      IMAGE1 = 'Image #1'
+      IMAGEC = 'Image_c #1'
+      ATNAME1 = 'Attr. #1'
+      ATNAME_N = 'Numeric Attr. #1'
+      ATNAME_C = 'Character Attr. #1'
+      CR = char(10)
+      number_failed = 0
+
+C Initialize the arrays
+C Initialize the image arrays
+      do 150 i=1, 2
+          do 2 j=1, 2
+              buf(1, j, i) = char(i+j)
+              buf(2, j, i) = char(i+j)
+              buf(3, j, i) = char(i+j)
+              buf1(j, 1, i) = char(i-j)
+              buf1(j, 2, i) = char(i-j)
+              buf1(j, 3, i) = char(i-j)
+              buf2(j, i, 1) = char(2*i - j)
+              buf2(j, i, 2) = char(2*i - j)
+              buf2(j, i, 3) = char(2*i - j)
+2       continue
+150   continue
+      do 157 i=1,2
+          do 156 j=1,3
+             do 155 k=1,4
+                 icbuf(i,j,k) = ' '
+155          continue
+156       continue
+157   continue
+
+C Initialize the palette array
+      do 160 i=1, 256
+          do 3 j=1, 3
+              pal(j,i)=char(i+j)
+3       continue
+160   continue
+C Initialize the attribute
+      do 170 i=1, 5
+          attr(i)=i*21
+170   continue
+
+C Open the file
+      file_id=hopen(TESTFILE, DFACC_ALL, 0)
+      call VRFY(file_id,'hopen',number_failed)
+      gr_id=mgstart(file_id)
+      call VRFY(gr_id,'mgstart',number_failed)
+
+C Create an image
+      call MESSAGE(5,'Creating an image')
+      dims(1)=2
+      dims(2)=2
+      ri_id = mgcreat(gr_id,IMAGE1,3,DFNT_UINT8,MFGR_INTERLACE_PIXEL,
+     *          dims)
+      call VRFY(ri_id,'mgcreat',number_failed)
+
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Writing image data')
+      ret = mgwrimg(ri_id,start,stride,dims,outbuf)
+      call VRFY(ret,'mgwrimg',number_failed)
+
+C Store a palette with the image
+      call MESSAGE(5,'Writing palette data')
+      pal_id = mggltid(ri_id, 0)
+      call VRFY(pal_id,'mggltid',number_failed)
+      ret = mgwclut(pal_id,3,DFNT_UINT8,MFGR_INTERLACE_PIXEL,256,pal)
+      call VRFY(ret,'mgwclut',number_failed)
+
+C Store an attribute with the image
+      call MESSAGE(5,'Writing numeric attribute data')
+      ret = mgsnatt(ri_id,ATNAME1,DFNT_INT32,5,attr)
+      call VRFY(ret,'mgsnatt',number_failed)
+
+C Store a numeric attribute with the image
+      call MESSAGE(5,'Writing numeric attribute data')
+      ret = mgsnatt(ri_id,ATNAME_N,DFNT_INT32,5,attr)
+      call VRFY(ret,'mgsnatt',number_failed)
+
+C Store a character attribute with the image
+      call MESSAGE(5,'Writing numeric attribute data')
+      ret = mgscatt(ri_id,ATNAME_C,DFNT_CHAR8,6,attr_c)
+      call VRFY(ret,'mgscatt',number_failed)
+
+C End access to the image
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C Create a character type image
+      call MESSAGE(5,'Creating a character type image')
+      dims(1)=2
+      dims(2)=2
+      ri_id = mgcreat(gr_id,IMAGEC,3,DFNT_CHAR8,MFGR_INTERLACE_PIXEL,
+     *          dims)
+      call VRFY(ri_id,'mgcreat',number_failed)
+
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Writing character image data')
+      ret = mgwcimg(ri_id,start,stride,dims,cbuf)
+      call VRFY(ret,'mgwcimg',number_failed)
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C End access to the GR interface
+      ret = mgend(gr_id)
+      call VRFY(ret,'mgend',number_failed)
+
+C Close the file
+      ret = hclose(file_id)
+      call VRFY(ret,'hclose',number_failed)
+
+C Re-open the file
+      file_id=hopen(TESTFILE, DFACC_ALL, 0)
+      call VRFY(file_id,'hopen',number_failed)
+      gr_id=mgstart(file_id)
+      call VRFY(gr_id,'mgstart',number_failed)
+
+C Get info about the file
+      call MESSAGE(5,'Getting GR file information')
+      ret = mgfinfo(gr_id,n_datasets,n_attrs)
+      call VRFY(ret,'mgfinfo',number_failed)
+
+C Select an image
+      call MESSAGE(5,'Selecting an image')
+      index = mgn2ndx(gr_id, IMAGE1)
+      call VRFY(index,'mgn2ndx',number_failed)
+      ri_id = mgselct(gr_id,index)
+      call VRFY(ri_id,'mgselct',number_failed)
+      n_pal = mggnluts(ri_id)
+      call VRFY(ri_id,'mggnluts',number_failed)
+      if(n_pal .ne. 1) then
+         print *, 'Wrong number of palettes returned for IMAGE1'
+      endif
+C Get info about the image
+      call MESSAGE(5,'Getting image information')
+      ret = mggiinf(ri_id,IMAGE2,n_comp,nt,il,dims,n_attrs)
+      call VRFY(ret,'mggiinf',number_failed)
+      ref = mgid2rf(ri_id)
+      call VRFY(ref,'mgid2rf',number_failed)
+      index2 = mgr2idx(gr_id,ref)
+      call VRFY(index2,'mgr2idx',number_failed)
+
+C Check image reading
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Reading image data')
+      ret = mgrdimg(ri_id,start,stride,dims,inbuf)
+      call VRFY(ret,'mgrdimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_LINE)
+      call VRFY(ret,'mgrimil',number_failed)
+      ret = mgrdimg(ri_id,start,stride,dims,inbuf1)
+      call VRFY(ret,'mgrdimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_COMPONENT)
+      call VRFY(ret,'mgrimil',number_failed)
+      ret = mgrdimg(ri_id,start,stride,dims,inbuf2)
+      call VRFY(ret,'mgrdimg',number_failed)
+
+C Check palette reading
+      pal_id = mggltid(ri_id, 0)
+      call VRFY(pal_id,'mggltid',number_failed)
+      call MESSAGE(5,'Reading palette data')
+      ret = mgglinf(pal_id,n_comp,nt,il,i)
+      call VRFY(ret,'mgglinf',number_failed)
+      ret = mgrclut(pal_id,in_pal)
+      call VRFY(ret,'mgrclut',number_failed)
+      ret = mgrltil(pal_id,MFGR_INTERLACE_COMPONENT)
+      call VRFY(ret,'mgrltil',number_failed)
+      ret = mgrclut(pal_id,in_pal2)
+      call VRFY(ret,'mgrclut',number_failed)
+
+C Check attribute reading
+      index = mgfndat(ri_id,ATNAME1)
+      call VRFY(index,'mgfndat',number_failed)
+      call MESSAGE(5,'Reading attribute data')
+      ret = mgatinf(ri_id,index,ATNAME2,nt,i)
+      call VRFY(ret,'mgatinf',number_failed)
+      ret = mggattr(ri_id,index,attr2)
+      call VRFY(ret,'mggattr',number_failed)
+
+C Check numeric attr
+      index = mgfndat(ri_id, ATNAME_N)
+      call VRFY(index,'mgfndat',number_failed)
+      call MESSAGE(5,'Reading attribute data')
+      ret = mgatinf(ri_id,index,ATNAME2_N,nt,i)
+      call VRFY(ret,'mgatinf',number_failed)
+      ret = mggnatt(ri_id,index,attr2_n)
+      call VRFY(ret,'mggnatt',number_failed)
+
+C Check character attr
+      index = mgfndat(ri_id, ATNAME_C)
+      call VRFY(index,'mgfndat',number_failed)
+      call MESSAGE(5,'Reading attribute data')
+      ret = mgatinf(ri_id,index,ATNAME2_C,nt,i)
+      call VRFY(ret,'mgatinf',number_failed)
+      ret = mggcatt(ri_id,index,attr2_c)
+      call VRFY(ret,'mggcatt',number_failed)
+
+C End access to the image
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C Select a character image
+      call MESSAGE(5,'Selecting a char type image')
+      index = mgn2ndx(gr_id, IMAGEC)
+      call VRFY(index,'mgn2ndx',number_failed)
+      ri_id = mgselct(gr_id,index)
+      call VRFY(ri_id,'mgselct',number_failed)
+      n_pal = mggnluts(ri_id)
+      call VRFY(ri_id,'mggnluts',number_failed)
+      if(n_pal .ne. 0) then
+         print *,'Wrong number of palettes returned for IMAGEC'
+      endif
+
+C Get info about the image
+      call MESSAGE(5,'Getting image information')
+      ret = mggiinf(ri_id,IMAGEC_2,n_comp,nt,il,dims,n_attrs)
+      call VRFY(ret,'mggiinf',number_failed)
+      ref = mgid2rf(ri_id)
+      call VRFY(ref,'mgid2rf',number_failed)
+      index2 = mgr2idx(gr_id,ref)
+      call VRFY(index2,'mgr2idx',number_failed)
+
+C Check image reading
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Reading image data')
+
+      call VRFY(ret,'mgrdimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_LINE)
+      call VRFY(ret,'mgrimil',number_failed)
+      ret = mgrcimg(ri_id,start,stride,dims,icbuf)
+      call VRFY(ret,'mgrcimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_COMPONENT)
+      call VRFY(ret,'mgrimil',number_failed)
+
+C End access to the image
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C End access to the GR interface
+      ret = mgend(gr_id)
+      call VRFY(ret,'mgend',number_failed)
+
+C Close the file
+      ret = hclose(file_id)
+      call VRFY(ret,'hclose',number_failed)
+
+C
+C     GR chunking and compression tests. Added by EIP 1/13/98
+C
+C     ----Chunking test
+C          creates the following files:
+C                        GRchunked1.hdf
+      err_grchunk = 0
+      call test_grchunk(err_grchunk)
+      if (err_grchunk .ne. 0) then
+         number_failed = number_failed + 1
+         print *, '*******mgrf: test_grchunk failed********'
+      endif
+
+
+C     ----Chunking write/read test
+C          creates the following files:
+C                        GRchunked2.hdf
+      err_grwrchunk = 0
+      call test_grwrchunk(err_grwrchunk)
+      if (err_grwrchunk .ne. 0) then
+         number_failed = number_failed + 1
+         print *, '*******mgrf: test_grwrchunk failed********'
+      endif
+
+
+C     ----Compression test
+C
+C          creates the following files:
+C                        GRcompressed.hdf
+      err_grcompress = 0
+      call test_grcompress(err_grcompress)
+      if (err_grcompress .ne. 0) then
+         number_failed = number_failed + 1
+         print *, '*******mgrf: test_grcompress failed*******'
+      endif
+C
+      if (number_failed .eq. 0) then 
+	  if (Verbosity .gt. 6) then
+	      print *, CR, CR
+	      print *, '****** ALL TESTS SUCCESSFUL ******'
+	  endif
+      else
+          print *, '****** ', number_failed, ' TESTS FAILED  ******'
+      endif
+      return
+      end 
+CD
+CD----All lines started with CD should be deleted after GR bug that prevents
+CD----writing multiple images to the file is fixed.
+CD 
+      subroutine test_grchunk( err_grchunk )
+      implicit none
+      integer N_COMP_TYPES, N_COMP_ARG, NCOMP
+      integer MFGR_INTERLACE_PIXEL 
+      parameter(N_COMP_TYPES = 4, N_COMP_ARG =1)
+      parameter(NCOMP = 2, MFGR_INTERLACE_PIXEL = 0)
+      integer ri_id(N_COMP_TYPES),
+     .        gr_id,
+     .        file_id
+      integer dims(2), start(2), edges(2), stride(2)
+      integer err_grchunk
+      integer i, j, status, il, k, i_comp, index
+      integer flags, maxcache, nc_out
+      character*14 file
+      character*12 name(N_COMP_TYPES)
+      integer n_images, n_file_attrs
+C
+C---GR interface functions
+C
+      integer mgstart, mgcreat, mgwrimg, mgsnatt,
+     .        mgrdimg, mgfinfo, mgn2ndx, mgselct, mgendac, mgend
+C
+C---GR chunking functions 
+C
+      integer mggichnk, 
+     .        mgscchnk,
+     .        mgschnk
+C
+      integer hopen, hclose
+      integer DFACC_CREATE, 
+     .        DFACC_READ,
+     .        DFACC_WRITE
+      integer DFNT_INT32
+      integer X_LENGTH, Y_LENGTH
+      integer X_CH_LENGTH, Y_CH_LENGTH
+      parameter (DFACC_CREATE = 4,
+     .           DFACC_READ   = 1,
+     .           DFACC_WRITE  = 2)
+      parameter (DFNT_INT32   = 24)
+      parameter (X_LENGTH     = 9,
+     .           Y_LENGTH     = 4,
+     .           X_CH_LENGTH  = 3,
+     .           Y_CH_LENGTH  = 2) 
+C
+C---Compression types and parameters arrays 
+C
+      integer comp_type(N_COMP_TYPES), comp_type_out(N_COMP_TYPES)
+      integer comp_prm(N_COMP_ARG)
+C
+C---Compression parameters
+C
+      integer COMP_CODE_NONE,
+     .          COMP_CODE_RLE,
+     .          COMP_CODE_SKPHUFF,
+     .          COMP_CODE_DEFLATE,
+     .          SKPHUFF_SKP_SIZE,
+     .          DEFLATE_LEVEL
+
+      parameter(COMP_CODE_NONE    = 0,
+     .          COMP_CODE_RLE     = 1,
+     .          COMP_CODE_SKPHUFF = 3,
+     .          COMP_CODE_DEFLATE = 4)
+      parameter (DEFLATE_LEVEL = 1,
+     .           SKPHUFF_SKP_SIZE = 2)
+C
+C---Data
+C 
+      integer*4 image_data(NCOMP, X_LENGTH, Y_LENGTH)
+      integer*4 image_data_out(NCOMP,X_LENGTH,Y_LENGTH)
+C
+C---Default pixel value
+C
+      integer*4 pixel_value(2)
+C
+C---Chunking dimension arrays
+C
+      integer ch_dims(2), ch_dims_out(2)
+C
+C----We will write four images using different compression methods to
+C    one file.
+C
+       file = 'GRchunked1.hdf'
+C
+C   No compresion
+C
+      name(1) = 'Nocomp_data'    
+      comp_type(1) = COMP_CODE_NONE
+      comp_type_out(1) = 0
+C
+C   RLE compresion
+C
+      name(2) = 'Rlcomp_data'    
+      comp_type(2) = COMP_CODE_RLE
+      comp_type_out(2) = 1 
+C
+C   Adaptive Huffman compresion
+C
+      name(3) = 'Hucomp_data'    
+      comp_type(3) = COMP_CODE_SKPHUFF
+      comp_type_out(3) = 1 
+C
+C   GZIP compression
+C
+      name(4) = 'Gzcomp_data'    
+      comp_type(4) = COMP_CODE_DEFLATE
+      comp_type_out(4) = 1 
+C
+C  Data initialization
+C 
+      do 30 j = 1, Y_LENGTH
+         do 20 i = 1, X_LENGTH
+           do 10 k = 1, NCOMP
+            image_data(k, i, j) = i + j - 1
+10         continue
+20    continue
+30    continue
+C
+C  Initialize compression argument array
+C
+      do 35 i = 1, N_COMP_ARG
+          comp_prm(i) = 0
+35    continue
+C
+C---Define chunk dimensions
+C
+         ch_dims(1) = X_CH_LENGTH 
+         ch_dims(2) = Y_CH_LENGTH 
+C
+C   Main loop through different compression types
+C
+C
+C     Create and a file and initiate GR interface.
+C
+      file_id = hopen(file, DFACC_CREATE, 0)
+      if(file_id .le. 0) then
+         print *, 'hopen failed to create a file'
+         err_grchunk = err_grchunk +1
+         goto 2223
+      endif 
+      gr_id = mgstart(file_id)
+      if(gr_id .le. 0) then
+         print *, 'mgstart failed to initialise GR interface'
+         err_grchunk = err_grchunk +1
+         goto 2222
+      endif 
+
+      do 1000 i_comp=1, N_COMP_TYPES
+C
+
+C     Define the number of components and dimensions of the image.
+
+      il = MFGR_INTERLACE_PIXEL
+      dims(1) = X_LENGTH
+      dims(2) = Y_LENGTH
+
+C     Create the data set.
+
+      ri_id(i_comp) = mgcreat(gr_id, name(i_comp), NCOMP,
+     .                        DFNT_INT32, il, dims)
+      if(ri_id(i_comp) .le. 0) then
+         print *, 'mgcreat failed to create ', i_comp, 'GR dataset'
+         err_grchunk = err_grchunk +1
+         goto 1000
+      endif
+
+C
+C---Set pixel value
+C
+      pixel_value(1) = 0
+      pixel_value(2) = 0
+C
+C---Fill the image array with the default pixel value
+C
+      status = mgsnatt(ri_id(i_comp), 'FillValue', DFNT_INT32,
+     .                 ncomp, pixel_value) 
+      if(status .ne. 0) then
+         print *, 'mgsnatt failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+
+C
+C---Define chunked GR
+C
+      if (i_comp. eq. 3) comp_prm(1) = SKPHUFF_SKP_SIZE
+      if (i_comp. eq. 4) comp_prm(1) =  DEFLATE_LEVEL
+      status = mgschnk (ri_id(i_comp), ch_dims,
+     .                  comp_type(i_comp),comp_prm)
+      if(status .ne. 0) then
+         print *, 'mgschnk failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C---Set chunk cache to hold maximum of 3 chunks
+C
+      maxcache = 3
+      flags = 0
+      status = mgscchnk (ri_id(i_comp), maxcache, flags) 
+      if(status .ne. 3) then
+         print *, 'mgscchnk failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Define the location, pattern, and size of the data set
+C     that will be written to.
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+
+C     Write the stored data to the image array.
+      status = mgwrimg(ri_id(i_comp), start, stride, edges, image_data)
+      if(status .ne. 0) then
+         print *, 'mgwrimg failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+1000  continue
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id)
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id)
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+
+
+
+C
+C     Open the file.
+C
+      file_id = hopen(file, DFACC_READ, 0)
+      if(file_id .eq. -1) then
+         print *, 'hopen failed to access the file'
+         err_grchunk = err_grchunk +1
+         goto 2223
+      endif 
+C
+C     Initiate the GR interface and select first data set.
+C
+      gr_id = mgstart(file_id)
+      if(gr_id .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+         goto 2222
+      endif 
+C
+C     Check that file contains 4 GR datasets and has 0 file attributes.
+C
+      status = mgfinfo(gr_id, n_images, n_file_attrs)
+      if(status .ne. 0) then
+         print *, 'mgfinfo failed '
+         err_grchunk = err_grchunk +1
+      goto 2222
+      endif 
+      if(n_images .ne. 4) then
+         print *, 'Wrong number of images returned '
+         err_grchunk = err_grchunk +1
+      goto 2222
+      endif 
+      if(n_file_attrs .ne. 0) then
+         print *, 'Wrong number of file attributes returned '
+         err_grchunk = err_grchunk +1
+      endif 
+
+      do 2000 i_comp=1, n_images
+C      ri_id(i_comp) = mgselct(gr_id(i_comp), index)
+C
+C     Find an index using image's name.
+C
+      index = mgn2ndx(gr_id, name(i_comp))
+      if(index .lt. 0 .or. index .gt. 3) then
+         print *, 'Wrong index range '
+         err_grchunk = err_grchunk +1
+      goto 2222
+      endif 
+
+      ri_id(i_comp) = mgselct(gr_id, index)
+      if(ri_id(i_comp) .eq. -1) then
+         print *, 'mgselct failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+         goto 1999
+      endif 
+C
+C     Read the stored data to the image array.
+C
+      status = mgrdimg(ri_id(i_comp), start, stride, edges,
+     .                  image_data_out)
+      if(status .ne. 0) then
+         print *, 'mgrdimg failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C--- Compare the data we read with the original data
+C
+      do 60 j = 1, Y_LENGTH
+         do 50 i = 1, X_LENGTH
+           do 40 k = 1, ncomp
+            if(image_data(k, i, j).ne.image_data_out(k,i,j)) then
+             print *, 'data is wrong'
+             err_grchunk = err_grchunk +1
+            endif 
+40         continue
+50    continue
+60    continue
+C
+C   Check chunking info
+C
+       status = mggichnk(ri_id(i_comp), ch_dims_out,
+     .                   nc_out)
+      if(status .ne. 0) then
+         print *, 'mggichnk failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+       if (comp_type_out(i_comp) .ne. nc_out) then
+          print *, 'mggichnk returns wrong compression type for',
+     .              i_comp, '-th data set'
+          err_grchunk = err_grchunk + 1
+       endif
+       if ( (ch_dims(1) .ne. ch_dims_out(1)) .or.
+     .      (ch_dims(2) .ne. ch_dims_out(2))) then
+          print *, 'mggichnk returns wrong chunk dimensions for',
+     .              i_comp, '-th data set'
+          err_grchunk = err_grchunk + 1
+       endif
+
+  
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+1999  continue
+C
+2000  continue
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id)
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+2222  continue
+C
+C     Close the file.
+C
+      status = hclose(file_id)
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+2223  continue
+      return
+      end
+C
+C     GR compression test
+C
+      subroutine test_grcompress( err_grcompress )
+      implicit none
+      integer N_COMP_TYPES, N_COMP_ARG, NCOMP
+C      parameter(N_COMP_TYPES = 4, N_COMP_ARG =1)
+      parameter(N_COMP_TYPES = 5, N_COMP_ARG = 2)
+      integer MFGR_INTERLACE_PIXEL
+      parameter(NCOMP = 3, MFGR_INTERLACE_PIXEL = 0)
+      integer ri_id(N_COMP_TYPES),
+     .        gr_id,
+     .        file_id
+      integer dims(2), start(2), edges(2), stride(2)
+      integer i, j, k, status, il, i_comp, index
+      integer err_grcompress
+C      character*12 file(N_COMP_TYPES)
+      character*16 file
+      character*12 name(N_COMP_TYPES)
+C
+C---GR interface functions
+C
+      integer mgstart, mgcreat, mgwrimg, mgn2ndx,
+     .        mgsnatt,
+     .        mgrdimg, mgselct, mgendac, mgend
+C
+C---GR compression function 
+C
+      integer mgscompress, mggcompress
+C
+      integer hopen, hclose
+      integer DFACC_CREATE, 
+     .        DFACC_READ,
+     .        DFACC_WRITE
+      integer DFNT_INT32
+      integer X_LENGTH, Y_LENGTH
+      integer X_CH_LENGTH, Y_CH_LENGTH
+      parameter (DFACC_CREATE = 4,
+     .           DFACC_READ   = 1,
+     .           DFACC_WRITE  = 2)
+      parameter (DFNT_INT32   = 24)
+      parameter (X_LENGTH     = 9,
+     .           Y_LENGTH     = 4,
+     .           X_CH_LENGTH  = 3,
+     .           Y_CH_LENGTH  = 2) 
+C
+C---Compression types and parameters arrays 
+C
+      integer comp_type(N_COMP_TYPES), comp_type_out
+      integer comp_prm(N_COMP_ARG), comp_prm_out(N_COMP_ARG)
+C
+C---Compression parameters
+C
+      integer COMP_CODE_NONE,
+     .          COMP_CODE_RLE,
+     .          COMP_CODE_SKPHUFF,
+     .          COMP_CODE_DEFLATE,
+     .          SKPHUFF_SKP_SIZE,
+     .          DEFLATE_LEVEL,
+     .          COMP_CODE_JPEG,
+     .          JPEG_QUALITY,
+     .          JPEG_COMPATIBILITY
+
+      parameter(COMP_CODE_NONE    = 0,
+     .          COMP_CODE_RLE     = 1,
+     .          COMP_CODE_SKPHUFF = 3,
+     .          COMP_CODE_DEFLATE = 4,
+     .          COMP_CODE_JPEG = 7)
+      parameter (DEFLATE_LEVEL = 6,
+     .           SKPHUFF_SKP_SIZE = 2)
+      parameter (JPEG_QUALITY = 100,
+     .           JPEG_COMPATIBILITY = 1)
+C
+C---Data
+C 
+      integer*4 image_data(NCOMP, X_LENGTH, Y_LENGTH)
+      integer*4 image_data_out(NCOMP,X_LENGTH,Y_LENGTH)
+C
+C---Default pixel value
+C
+      integer*4 pixel_value(NCOMP)
+C
+C---We will write/read to four different files corresponding to the
+C   different compression types.
+      file = 'GRcompressed.hdf'
+C
+C   No compresion
+C
+      name(1) = 'Nocomp_data'    
+      comp_type(1) = COMP_CODE_NONE
+C
+C   RLE compresion
+C
+      name(2) = 'Rlcomp_data'    
+      comp_type(2) = COMP_CODE_RLE
+C
+C   Adaptive Huffman compresion
+C
+      name(3) = 'Hucomp_data'    
+      comp_type(3) = COMP_CODE_SKPHUFF
+C
+C   GZIP compression
+C
+      name(4) = 'Gzcomp_data'    
+      comp_type(4) = COMP_CODE_DEFLATE
+C
+C   JPEG compression
+C
+      name(5) = 'Jpcomp_data'    
+      comp_type(5) = COMP_CODE_JPEG
+C
+C  Data initialization
+C 
+      do 30 j = 1, Y_LENGTH
+         do 20 i = 1, X_LENGTH
+           do 10 k = 1, NCOMP
+            image_data(k, i, j) = i + j - 1
+10         continue
+20    continue
+30    continue
+C
+C  Initialize compression argument array
+C
+      do 35 i = 1, N_COMP_ARG
+          comp_prm(i) = 0
+35    continue
+C
+C---Set pixel value
+C
+      do 305 i = 1, NCOMP
+           pixel_value(i) = 0
+305   continue
+C
+C   Main loop through different compression types
+C
+
+C
+C     Create and open the file.
+C
+      file_id = hopen(file, DFACC_CREATE, 0)
+      if(file_id .eq. -1) then
+         print *, 'hopen failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Initiate the GR interface.
+C
+C      gr_id(i_comp) = mgstart(file_id(i_comp))
+C      if(gr_id(i_comp) .eq. -1) then
+      gr_id = mgstart(file_id)
+      if(gr_id .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th dataset' 
+         err_grcompress = err_grcompress +1
+      endif 
+
+      do 1000 i_comp=1, N_COMP_TYPES
+C     Define the number of components and dimensions of the image.
+
+      il = MFGR_INTERLACE_PIXEL
+      dims(1) = X_LENGTH
+      dims(2) = Y_LENGTH
+
+C     Create the data set.
+
+      ri_id(i_comp) = mgcreat(gr_id, name(i_comp), NCOMP,
+     .                        DFNT_INT32, il, dims)
+      if(ri_id(i_comp) .eq. -1) then
+         print *, 'mgcreat failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+
+C
+C---Fill the image array with the default pixel value
+C
+      status = mgsnatt(ri_id(i_comp), 'FillValue', DFNT_INT32,
+     .                 ncomp, pixel_value) 
+      if(status .ne. 0) then
+         print *, 'mgsnatt failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+
+C
+C---Set compression
+C
+      if (i_comp. eq. 3) comp_prm(1) = SKPHUFF_SKP_SIZE
+      if (i_comp. eq. 4) comp_prm(1) =  DEFLATE_LEVEL
+      if (i_comp. eq. 5) then       
+          comp_prm(1) = JPEG_QUALITY
+          comp_prm(2) = JPEG_COMPATIBILITY
+      endif
+      status = mgscompress (ri_id(i_comp), 
+     .                  comp_type(i_comp),comp_prm)
+      if(status .ne. 0) then
+         print *, 'mgscompress failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Define the location, pattern, and size of the data set
+C     that will be written to.
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+
+C     Write the stored data to the image array.
+      status = mgwrimg(ri_id(i_comp), start, stride, edges, image_data)
+      if(status .ne. 0) then
+         print *, 'mgwrimg failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+1000  continue
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id)
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id)
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+
+
+
+C
+C     Open the file.
+C
+      file_id = hopen(file, DFACC_READ, 0)
+      if(file_id .eq. -1) then
+         print *, 'hopen failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Initiate the GR interface and select first data set.
+C
+      gr_id = mgstart(file_id)
+      if(gr_id .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+      do 2000 i_comp=1, N_COMP_TYPES 
+      index = mgn2ndx(gr_id, name(i_comp))
+      if(index .eq. -1 ) then
+         print *, 'mgn2ndx failed for',  name(i_comp), ' data set'
+         err_grcompress = err_grcompress +1
+      endif 
+      ri_id(i_comp) = mgselct(gr_id, index)
+      if(ri_id(i_comp) .eq. -1) then
+         print *, 'mgselct failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+         goto 1999
+      endif 
+C
+C  Find out type of compression used and compression parameters.
+C
+       status = mggcompress(ri_id(i_comp), comp_type_out, comp_prm_out)
+       if (status .eq. -1) then
+            print *, 'mggcompress failed for', i, ' -th dataset'
+                err_grcompress = err_grcompress + 1
+            endif
+            if (name(i_comp) .eq. 'Nocomp_data') then
+                if (comp_type_out .ne. COMP_CODE_NONE) then
+            print *, 'wrong compression type for Nocomp_data dataset'
+                err_grcompress = err_grcompress + 1
+                endif
+            endif
+            if (name(i_comp) .eq. 'Rlcomp_data') then
+                if (comp_type_out .ne. COMP_CODE_RLE) then
+            print *, 'wrong compression type for Rlcomp_data dataset'
+                err_grcompress = err_grcompress + 1
+                endif
+            endif
+            if (name(i_comp) .eq. 'Hucomp_data') then
+                if (comp_type_out .ne. COMP_CODE_SKPHUFF) then
+            print *, 'wrong compression type for Hucomp_data dataset'
+                err_grcompress = err_grcompress + 1
+                endif
+                if (comp_prm_out(1). ne. skphuff_skp_size) then
+         print *, 'wrong compression parameter for Hucomp_data dataset'
+                err_grcompress = err_grcompress + 1
+                endif
+
+            endif
+            if (name(i_comp) .eq. 'Gzcomp_data') then
+                if (comp_type_out .ne. COMP_CODE_DEFLATE) then
+          print *, 'wrong compression type for Gzcomp_data dataset'
+                endif
+                if (comp_prm_out(1). ne. deflate_level) then
+          print *, 'wrong compression parameter for Gzcomp_data dataset'
+                err_grcompress = err_grcompress + 1
+                endif
+            endif
+            if (name(i_comp) .eq. 'Jpcomp_data') then
+                if (comp_type_out .ne. COMP_CODE_JPEG) then
+            print *, 'wrong compression type for Jpcomp_data dataset'
+                err_grcompress = err_grcompress + 1
+                endif
+            goto 1111
+            endif
+C
+C     Read the stored data to the image array.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+      status = mgrdimg(ri_id(i_comp), start, stride, edges,
+     .                  image_data_out)
+      if(status .ne. 0) then
+         print *, 'mgrdimg failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C--- Compare the data we read with the original data
+C
+      do 60 j = 1, Y_LENGTH
+         do 50 i = 1, X_LENGTH
+           do 40 k = 1, ncomp
+            if(image_data(k, i, j).ne.image_data_out(k,i,j)) then
+             print *, 'data is wrong'
+             err_grcompress = err_grcompress +1
+            endif 
+40         continue
+50    continue
+60    continue
+
+1111  continue  
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+1999  continue
+2000  continue
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id)
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id)
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+      return
+      end
+
+      subroutine test_grwrchunk( err_grwrchunk )
+C
+C---This subroutine tests GR write/read functions
+C
+      implicit none
+      integer N_COMP_TYPES, N_COMP_ARG, NCOMP
+      integer MFGR_INTERLACE_PIXEL 
+      parameter(N_COMP_TYPES = 4, N_COMP_ARG =1)
+      parameter(NCOMP = 3, MFGR_INTERLACE_PIXEL = 0)
+      integer ri_id(N_COMP_TYPES),
+     .        gr_id,
+     .        file_id
+      integer dims(2), start(2), edges(2), stride(2)
+      integer err_grwrchunk
+      integer i, j, status, il, k, i_comp, index
+C      character*13 file(N_COMP_TYPES)
+      character*14 file
+      character*12 name(N_COMP_TYPES)
+C
+C---GR interface functions
+C
+      integer mgstart, mgcreat, mgsnatt,
+     .        mgrdimg, mgn2ndx, mgselct, mgendac, mgend, mgfinfo,
+     .        mggcompress
+C
+C---GR chunking functions 
+C
+      integer mgwchnk, 
+     .        mgrchnk,
+     .        mgschnk
+C
+      integer hopen, hclose
+      integer DFACC_CREATE, 
+     .        DFACC_READ,
+     .        DFACC_WRITE
+      integer DFNT_INT32
+      integer X_LENGTH, Y_LENGTH
+      integer X_CH_LENGTH, Y_CH_LENGTH
+      parameter (DFACC_CREATE = 4,
+     .           DFACC_READ   = 1,
+     .           DFACC_WRITE  = 2)
+      parameter (DFNT_INT32   = 24)
+      parameter (X_LENGTH     = 6,
+     .           Y_LENGTH     = 10,
+     .           X_CH_LENGTH  = 3,
+     .           Y_CH_LENGTH  = 2) 
+C
+C---Compression types and parameters arrays 
+C
+      integer comp_type(N_COMP_TYPES), comp_type_out(N_COMP_TYPES)
+      integer comp_typegr
+      integer comp_prm(N_COMP_ARG)
+      integer comp_prm_out(N_COMP_ARG)
+C
+C---Compression parameters
+C
+      integer COMP_CODE_NONE,
+     .          COMP_CODE_RLE,
+     .          COMP_CODE_SKPHUFF,
+     .          COMP_CODE_DEFLATE,
+     .          SKPHUFF_SKP_SIZE,
+     .          DEFLATE_LEVEL
+
+      parameter(COMP_CODE_NONE    = 0,
+     .          COMP_CODE_RLE     = 1,
+     .          COMP_CODE_SKPHUFF = 3,
+     .          COMP_CODE_DEFLATE = 4)
+      parameter (DEFLATE_LEVEL = 6,
+     .           SKPHUFF_SKP_SIZE = 3)
+C
+C---Data
+C 
+      integer*4 chunk11(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*4 chunk21(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*4 chunk52(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*4 chunk52_out(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*4 data_org(NCOMP* X_LENGTH*Y_LENGTH)
+       
+      integer*4 image_data_out(NCOMP,X_LENGTH,Y_LENGTH)
+      integer*4 data_arr(NCOMP,X_LENGTH,Y_LENGTH)
+      integer n_images, n_file_attrs
+      equivalence (data_org(1), data_arr(1,1,1))
+C
+C---Default pixel value
+C
+      integer*4 pixel_value(3)
+C
+C---Chunking dimension arrays
+C
+      integer ch_dims(2)
+C
+C---We will write/read to four different files corresponding to the
+C   different compression types.
+C
+C   We will try to write to one file GRchunked2.hdf
+       file = 'GRchunked2.hdf'
+C   No compresion
+C
+      name(1) = 'Nocomp_data'    
+      comp_type(1) = COMP_CODE_NONE
+      comp_type_out(1) = 0
+C
+C   RLE compresion
+C
+      name(2) = 'Rlcomp_data'    
+      comp_type(2) = COMP_CODE_RLE
+      comp_type_out(2) = 1 
+C
+C   Adaptive Huffman compresion
+C
+      name(3) = 'Hucomp_data'    
+      comp_type(3) = COMP_CODE_SKPHUFF
+      comp_type_out(3) = 1 
+C
+C   GZIP compression
+C
+      name(4) = 'Gzcomp_data'    
+      comp_type(4) = COMP_CODE_DEFLATE
+      comp_type_out(4) = 1 
+C
+C  Data initialization
+C 
+      data chunk11 / 110, 111, 112, 120, 121, 122,
+     .                130, 131, 132, 140, 141, 142,
+     .                150, 151, 152, 160, 161, 162/
+      data chunk21 /  210, 211, 212, 220, 221, 222,
+     .                230, 231, 232, 240, 241, 242,
+     .                250, 251, 252, 260, 261, 262/
+      data chunk52 / 1010, 1011, 1012, 1020, 1021, 1022,
+     .                1030, 1031, 1032, 1040, 1041, 1042,
+     .                1050, 1051, 1052, 1060, 1061, 1062/
+      data data_org /
+     .     110, 111, 112, 120, 121, 122, 210, 211, 212, 220, 221, 222,
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 130, 131, 132, 140, 141, 142,
+     .     230, 231, 232, 240, 241, 242, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+     .     150, 151, 152, 160, 161, 162, 250, 251, 252, 260, 261, 262,
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 1010, 1011, 1012, 1020, 1021, 1022, 
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+     .     1030, 1031, 1032, 1040, 1041, 1042, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .     0, 0, 0, 0, 0, 0, 1050, 1051, 1052, 1060, 1061, 1062/
+C
+C  Initialize compression argument array
+C
+      do 35 i = 1, N_COMP_ARG
+          comp_prm(i) = 0
+35    continue
+C
+C---Define chunk dimensions
+C
+         ch_dims(1) = Y_CH_LENGTH 
+         ch_dims(2) = X_CH_LENGTH 
+C
+C   Main loop through different compression types
+C
+C
+C     Create and open the file.
+C
+C
+C     Initiate the GR interface.
+C
+      file_id = hopen(file, DFACC_CREATE, 0)
+      gr_id = mgstart(file_id)
+
+      do 1000 i_comp=1, N_COMP_TYPES
+
+C     Define the number of components and dimensions of the image.
+
+      il = MFGR_INTERLACE_PIXEL
+      dims(1) = X_LENGTH
+      dims(2) = Y_LENGTH
+
+C     Create the data set.
+
+      ri_id(i_comp) = mgcreat(gr_id, name(i_comp), NCOMP,
+     .                        DFNT_INT32, il, dims)
+
+C
+C---Set pixel value
+C
+      pixel_value(1) = 0
+      pixel_value(2) = 0
+      pixel_value(3) = 0
+C
+C---Fill the image array with the default pixel value
+C
+      status = mgsnatt(ri_id(i_comp), 'FillValue', DFNT_INT32,
+     .                 ncomp, pixel_value) 
+      if(status .ne. 0) then
+         print *, 'mgsnatt failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+
+C
+C---Define chunked GR
+C
+      if (i_comp. eq. 3) comp_prm(1) = SKPHUFF_SKP_SIZE
+      if (i_comp. eq. 4) comp_prm(1) =  DEFLATE_LEVEL
+      status = mgschnk (ri_id(i_comp), ch_dims,
+     .                  comp_type(i_comp),comp_prm)
+      if(status .ne. 0) then
+         print *, 'mgschnk failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Define the location of the first chunk 
+C     that will be written to.
+      start(1) = 1 
+      start(2) = 1 
+
+C     Write the stored data to the image array.
+      status = mgwchnk(ri_id(i_comp), start, chunk11)
+      if(status .ne. 0) then
+         print *, 'mgwchnk failed for', i_comp, 
+     .            '-th data set, first chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Define the location of the first chunk 
+C     that will be written to.
+      start(1) = 2 
+      start(2) = 1 
+
+C     Write the stored data to the image array.
+      status = mgwchnk(ri_id(i_comp), start, chunk21)
+      if(status .ne. 0) then
+         print *, 'mgwchnk failed for', i_comp, 
+     .            '-th data set, second chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Define the location of the first chunk 
+C     that will be written to.
+      start(1) = 5 
+      start(2) = 2 
+
+C     Write the stored data to the image array.
+      status = mgwchnk(ri_id(i_comp), start, chunk52)
+      if(status .ne. 0) then
+         print *, 'mgwchnk failed for', i_comp, 
+     .            '-th data set, third chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+1000  continue
+C
+C     Terminate access to the GR interface.
+C
+C      status = mgend(gr_id(i_comp))
+      status = mgend(gr_id)
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id)
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+
+      file_id = hopen(file, DFACC_READ, 0)
+      if(file_id .eq. -1) then
+         print *, 'hopen failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Initiate the GR interface and select first data set.
+C
+      gr_id = mgstart(file_id)
+      if(gr_id .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Find number of images in the file ( should be 4)
+C
+      status = mgfinfo(gr_id, n_images, n_file_attrs)
+      if(status .ne. 0) then
+         print *, 'mgfinfo failed '
+         err_grwrchunk = err_grwrchunk +1
+      goto 2222
+      endif 
+      if(n_images .ne. 4) then
+         print *, 'Wrong number of images returned '
+         err_grwrchunk = err_grwrchunk +1
+      goto 2222
+      endif 
+      if(n_file_attrs .ne. 0) then
+         print *, 'Wrong number of file attributes returned '
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+
+      do 2000 i_comp=1, n_images 
+
+C
+C     Find an index using image's name.
+C
+      index = mgn2ndx(gr_id, name(i_comp))
+      if(index .lt. 0 .or. index .gt. 3) then
+         print *, 'Wrong index range '
+         err_grwrchunk = err_grwrchunk +1
+      goto 2222 
+      endif 
+      ri_id(i_comp) = mgselct(gr_id, index)
+      if( ri_id(i_comp) .eq. -1) then
+         print *, 'mgselct failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+         goto 2000 
+      endif 
+      status = mggcompress(ri_id(i_comp), comp_typegr, comp_prm_out)
+      if (status .eq. -1) then
+      print *, 'mggcompress failed for', i, ' -th dataset'
+         err_grwrchunk = err_grwrchunk +1
+      endif
+      
+            if (name(i_comp) .eq. 'Nocomp_data') then
+                if (comp_typegr .ne. COMP_CODE_NONE) then
+            print *, 'wrong compression type for Nocomp_data dataset'
+                err_grwrchunk = err_grwrchunk +1
+                endif
+            endif
+            if (name(i_comp) .eq. 'Rlcomp_data') then
+                if (comp_typegr .ne. COMP_CODE_RLE) then
+            print *, 'wrong compression type for Rlcomp_data dataset'
+                err_grwrchunk = err_grwrchunk +1
+                endif
+            endif
+            if (name(i_comp) .eq. 'Hucomp_data') then
+                if (comp_typegr .ne. COMP_CODE_SKPHUFF) then
+            print *, 'wrong compression type for Hucomp_data dataset'
+                err_grwrchunk = err_grwrchunk +1
+                endif
+                if (comp_prm_out(1). ne. skphuff_skp_size) then
+         print *, 'wrong compression parameter for Hucomp_data dataset'
+                err_grwrchunk = err_grwrchunk +1
+                endif
+
+            endif
+            if (name(i_comp) .eq. 'Gzcomp_data') then
+                if (comp_typegr .ne. COMP_CODE_DEFLATE) then
+          print *, 'wrong compression type for Gzcomp_data dataset'
+                endif
+                if (comp_prm_out(1). ne. deflate_level) then
+          print *, 'wrong compression parameter for Gzcomp_data dataset'
+                err_grwrchunk = err_grwrchunk +1
+                endif
+            endif
+C
+C     Read the stored data to the image array.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+      status = mgrdimg(ri_id(i_comp), start, stride, edges,
+     .                  image_data_out)
+      if(status .ne. 0) then
+         print *, 'mgrdimg failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C--- Compare the data we read with the original data
+C
+      do 60 j = 1, Y_LENGTH
+         do 50 i = 1, X_LENGTH
+           do 40 k = 1, ncomp
+            if(data_arr(k, i, j).ne.image_data_out(k,i,j)) then
+             print *, 'data is wrong'
+             err_grwrchunk = err_grwrchunk +1
+            endif 
+40         continue
+50    continue
+60    continue
+  
+C
+C--- Read the third chunk back and compare it with original data.
+C
+
+      start(1) = 5 
+      start(2) = 2 
+      status = mgrchnk(ri_id(i_comp), start, chunk52_out)
+      if(status .ne. 0) then
+         print *, 'mgrchnk failed for', i_comp, 
+     .            '-th data set, third chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+      do 401 j = 1, NCOMP*X_CH_LENGTH*Y_CH_LENGTH
+           if(chunk52(j).ne.chunk52_out(j)) then
+             print *, 'read chunk''s data is wrong'
+             err_grwrchunk = err_grwrchunk +1
+            endif
+401         continue
+
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+1999  continue
+2000  continue
+
+2222  continue
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id)
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id)
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+      return
+      end
diff --git a/hdf/test/mgrf_sunOS.f b/hdf/test/mgrf_sunOS.f
new file mode 100644
index 0000000..7da7eb3
--- /dev/null
+++ b/hdf/test/mgrf_sunOS.f
@@ -0,0 +1,1464 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: mgrf_sunOS.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+       subroutine mgrf (num_err)
+C
+C Test Program: 
+C   Tests the multi-file GR interface.
+C Input file: none
+C Output file: tmgrf.hdf
+C
+C
+      implicit none
+      include 'fortest.inc'
+
+      integer num_err
+C
+C  ---chunking and compression errors ----------
+      integer err_grchunk, err_grwrchunk, err_grcompress
+C  ---------------------------------------------
+C
+      character*20 myname
+      parameter (myname = 'mgrf')
+
+      integer hopen, hclose
+      integer mgstart, mgfinfo, mgend, mgcreat, mgselct 
+      integer mgn2ndx, mggiinf, mgwrimg, mgrdimg, mgendac
+      integer mgid2rf, mgr2idx, mgrltil, mgrimil, mggltid
+c     integer mgwrlut, mgrdlut
+      integer mgglinf, mgwclut, mgrclut
+c      integer mgsattr
+	integer mgatinf, mggattr, mgfndat
+      integer mgscatt, mgsnatt, mggcatt, mggnatt
+      integer mgwcimg, mgrcimg
+      integer MFGR_INTERLACE_PIXEL, MFGR_INTERLACE_LINE,
+     *      MFGR_INTERLACE_COMPONENT
+
+      parameter(MFGR_INTERLACE_PIXEL	= 0,
+     *		MFGR_INTERLACE_LINE	= 1,
+     * 		MFGR_INTERLACE_COMPONENT	= 2)
+
+      integer 	DFACC_READ, DFACC_WRITE, DFACC_CREATE, DFACC_ALL  
+      integer	DFACC_RDONLY, DFACC_RDWR, DFACC_CLOBBER
+
+      parameter(DFACC_READ       	 = 1,
+     *		DFACC_WRITE      	 = 2,
+     *		DFACC_CREATE     	 = 4,
+     *		DFACC_ALL        	 = 7,
+     *		DFACC_RDONLY		 = 1,
+     *		DFACC_RDWR		 = 3,
+     *		DFACC_CLOBBER		 = 4)
+
+      integer 	DFNT_INT8,  DFNT_UINT8, 
+     *		DFNT_INT16, DFNT_UINT16,
+     *		DFNT_INT32, DFNT_UINT32, 
+     *          DFNT_INT64, DFNT_UINT64,
+     *          DFNT_INT128,DFNT_UINT128,
+     *          DFNT_CHAR8, DFNT_UCHAR8
+ 
+      parameter(DFNT_INT8	= 20,
+     *		DFNT_UINT8	= 21,
+     *		DFNT_INT16	= 22,
+     *		DFNT_UINT16	= 23,
+     *		DFNT_INT32	= 24,
+     *		DFNT_UINT32	= 25,
+     *		DFNT_INT64	= 26,
+     *		DFNT_UINT64	= 27,
+     *		DFNT_INT128	= 28,
+     *		DFNT_UINT128	= 29,
+     *          DFNT_CHAR8      =  4,
+     *          DFNT_UCHAR8     =  3)
+      integer il
+      character*80 TESTFILE
+      character*80 IMAGE1, IMAGE2, IMAGEC, IMAGEC_2
+      character*80 ATNAME1, ATNAME_N, ATNAME_C
+      character*80 ATNAME2, ATNAME2_N, ATNAME2_C
+      character*1 CR
+      character buf(3, 2, 2), buf1(2, 3, 2), buf2(2, 2, 3)
+      character in(3,2,2), in1(2, 3, 2), in2(2, 2, 3)
+      integer   outbuf(4), outbuf1(4), outbuf2(4)
+      integer   inbuf(4), inbuf1(4), inbuf2(4)
+      equivalence (outbuf, buf), (outbuf1, buf1), (outbuf2,buf2)
+      equivalence (inbuf, in), (inbuf1, in1), (inbuf2,in2)
+      character pal(3,256), in_pal(3,256), in_pal2(256,3)
+      integer   file_id, gr_id, ri_id, pal_id, index, index2
+      integer   n_datasets, n_attrs, ref
+      integer   n_comp, nt
+      integer   dims(2), start(2), stride(2)
+      integer*4 attr(5), attr2(5), attr2_n(5)
+      character attr_c(6), attr2_c(6)
+      character cbuf(2,3,4), icbuf(2,3,4)
+      integer i, j, k, ret, number_failed
+
+      DATA attr_c/'A','T','T','R','_','C'/
+      DATA cbuf/'A','B','C','D','E','F','G','H','I','J','K','L',
+     +          'M','N','O','P','Q','R','S','T','U','V','W','X'/
+
+      call ptestban('Testing', myname)
+      num_err = 0
+      TESTFILE = 'tmgrf.hdf'
+      IMAGE1 = 'Image #1'
+      IMAGEC = 'Image_c #1'
+      ATNAME1 = 'Attr. #1'
+      ATNAME_N = 'Numeric Attr. #1'
+      ATNAME_C = 'Character Attr. #1'
+      CR = char(10)
+      number_failed = 0
+
+C Initialize the arrays
+C Initialize the image arrays
+      do 150 i=1, 2
+          do 2 j=1, 2
+              buf(1, j, i) = char(i+j)
+              buf(2, j, i) = char(i+j)
+              buf(3, j, i) = char(i+j)
+              buf1(j, 1, i) = char(i-j)
+              buf1(j, 2, i) = char(i-j)
+              buf1(j, 3, i) = char(i-j)
+              buf2(j, i, 1) = char(2*i - j)
+              buf2(j, i, 2) = char(2*i - j)
+              buf2(j, i, 3) = char(2*i - j)
+2       continue
+150   continue
+      do 157 i=1,2
+          do 156 j=1,3
+             do 155 k=1,4
+                 icbuf(k, j, i) = ' '
+155          continue
+156       continue
+157   continue
+
+C Initialize the palette array
+      do 160 i=1, 256
+          do 3 j=1, 3
+              pal(j,i)=char(i+j)
+3       continue
+160   continue
+C Initialize the attribute
+      do 170 i=1, 5
+          attr(i)=i*21
+170   continue
+
+C Open the file
+      file_id=hopen(TESTFILE, DFACC_ALL, 0)
+      call VRFY(file_id,'hopen',number_failed)
+      gr_id=mgstart(file_id)
+      call VRFY(gr_id,'mgstart',number_failed)
+
+C Create an image
+      call MESSAGE(5,'Creating an image')
+      dims(1)=2
+      dims(2)=2
+      ri_id = mgcreat(gr_id,IMAGE1,3,DFNT_UINT8,MFGR_INTERLACE_PIXEL,
+     *          dims)
+      call VRFY(ri_id,'mgcreat',number_failed)
+
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Writing image data')
+      ret = mgwrimg(ri_id,start,stride,dims,outbuf)
+      call VRFY(ret,'mgwrimg',number_failed)
+
+C Store a palette with the image
+      call MESSAGE(5,'Writing palette data')
+      pal_id = mggltid(ri_id, 0)
+      call VRFY(pal_id,'mggltid',number_failed)
+      ret = mgwclut(pal_id,3,DFNT_UINT8,MFGR_INTERLACE_PIXEL,256,pal)
+      call VRFY(ret,'mgwclut',number_failed)
+
+C Store an attribute with the image
+      call MESSAGE(5,'Writing numeric attribute data')
+      ret = mgsnatt(ri_id,ATNAME1,DFNT_INT32,5,attr)
+      call VRFY(ret,'mgsnatt',number_failed)
+
+C Store a numeric attribute with the image
+      call MESSAGE(5,'Writing numeric attribute data')
+      ret = mgsnatt(ri_id,ATNAME_N,DFNT_INT32,5,attr)
+      call VRFY(ret,'mgsnatt',number_failed)
+
+C Store a character attribute with the image
+      call MESSAGE(5,'Writing numeric attribute data')
+      ret = mgscatt(ri_id,ATNAME_C,DFNT_CHAR8,6,attr_c)
+      call VRFY(ret,'mgscatt',number_failed)
+
+C End access to the image
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C Create a character type image
+      call MESSAGE(5,'Creating a character type image')
+      dims(1)=2
+      dims(2)=2
+      ri_id = mgcreat(gr_id,IMAGEC,3,DFNT_CHAR8,MFGR_INTERLACE_PIXEL,
+     *          dims)
+      call VRFY(ri_id,'mgcreat',number_failed)
+
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Writing character image data')
+      ret = mgwcimg(ri_id,start,stride,dims,cbuf)
+      call VRFY(ret,'mgwcimg',number_failed)
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C End access to the GR interface
+      ret = mgend(gr_id)
+      call VRFY(ret,'mgend',number_failed)
+
+C Close the file
+      ret = hclose(file_id)
+      call VRFY(ret,'hclose',number_failed)
+
+C Re-open the file
+      file_id=hopen(TESTFILE, DFACC_ALL, 0)
+      call VRFY(file_id,'hopen',number_failed)
+      gr_id=mgstart(file_id)
+      call VRFY(gr_id,'mgstart',number_failed)
+
+C Get info about the file
+      call MESSAGE(5,'Getting GR file information')
+      ret = mgfinfo(gr_id,n_datasets,n_attrs)
+      call VRFY(ret,'mgfinfo',number_failed)
+
+C Select an image
+      call MESSAGE(5,'Selecting an image')
+      index = mgn2ndx(gr_id, IMAGE1)
+      call VRFY(index,'mgn2ndx',number_failed)
+      ri_id = mgselct(gr_id,index)
+      call VRFY(ri_id,'mgselct',number_failed)
+
+C Get info about the image
+      call MESSAGE(5,'Getting image information')
+      ret = mggiinf(ri_id,IMAGE2,n_comp,nt,il,dims,n_attrs)
+      call VRFY(ret,'mggiinf',number_failed)
+      ref = mgid2rf(ri_id)
+      call VRFY(ref,'mgid2rf',number_failed)
+      index2 = mgr2idx(gr_id,ref)
+      call VRFY(index2,'mgr2idx',number_failed)
+
+C Check image reading
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Reading image data')
+      ret = mgrdimg(ri_id,start,stride,dims,inbuf)
+      call VRFY(ret,'mgrdimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_LINE)
+      call VRFY(ret,'mgrimil',number_failed)
+      ret = mgrdimg(ri_id,start,stride,dims,inbuf1)
+      call VRFY(ret,'mgrdimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_COMPONENT)
+      call VRFY(ret,'mgrimil',number_failed)
+      ret = mgrdimg(ri_id,start,stride,dims,inbuf2)
+      call VRFY(ret,'mgrdimg',number_failed)
+
+C Check palette reading
+      pal_id = mggltid(ri_id, 0)
+      call VRFY(pal_id,'mggltid',number_failed)
+      call MESSAGE(5,'Reading palette data')
+      ret = mgglinf(pal_id,n_comp,nt,il,i)
+      call VRFY(ret,'mgglinf',number_failed)
+      ret = mgrclut(pal_id,in_pal)
+      call VRFY(ret,'mgrclut',number_failed)
+      ret = mgrltil(pal_id,MFGR_INTERLACE_COMPONENT)
+      call VRFY(ret,'mgrltil',number_failed)
+      ret = mgrclut(pal_id,in_pal2)
+      call VRFY(ret,'mgrclut',number_failed)
+
+C Check attribute reading
+      index = mgfndat(ri_id,ATNAME1)
+      call VRFY(index,'mgfndat',number_failed)
+      call MESSAGE(5,'Reading attribute data')
+      ret = mgatinf(ri_id,index,ATNAME2,nt,i)
+      call VRFY(ret,'mgatinf',number_failed)
+      ret = mggattr(ri_id,index,attr2)
+      call VRFY(ret,'mggattr',number_failed)
+
+C Check numeric attr
+      index = mgfndat(ri_id, ATNAME_N)
+      call VRFY(index,'mgfndat',number_failed)
+      call MESSAGE(5,'Reading attribute data')
+      ret = mgatinf(ri_id,index,ATNAME2_N,nt,i)
+      call VRFY(ret,'mgatinf',number_failed)
+      ret = mggnatt(ri_id,index,attr2_n)
+      call VRFY(ret,'mggnatt',number_failed)
+
+C Check character attr
+      index = mgfndat(ri_id, ATNAME_C)
+      call VRFY(index,'mgfndat',number_failed)
+      call MESSAGE(5,'Reading attribute data')
+      ret = mgatinf(ri_id,index,ATNAME2_C,nt,i)
+      call VRFY(ret,'mgatinf',number_failed)
+      ret = mggcatt(ri_id,index,attr2_c)
+      call VRFY(ret,'mggcatt',number_failed)
+
+C End access to the image
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C Select a character image
+      call MESSAGE(5,'Selecting a char type image')
+      index = mgn2ndx(gr_id, IMAGEC)
+      call VRFY(index,'mgn2ndx',number_failed)
+      ri_id = mgselct(gr_id,index)
+      call VRFY(ri_id,'mgselct',number_failed)
+
+C Get info about the image
+      call MESSAGE(5,'Getting image information')
+      ret = mggiinf(ri_id,IMAGEC_2,n_comp,nt,il,dims,n_attrs)
+      call VRFY(ret,'mggiinf',number_failed)
+      ref = mgid2rf(ri_id)
+      call VRFY(ref,'mgid2rf',number_failed)
+      index2 = mgr2idx(gr_id,ref)
+      call VRFY(index2,'mgr2idx',number_failed)
+
+C Check image reading
+      start(1)=0
+      start(2)=0
+      stride(1)=1
+      stride(2)=1
+      call MESSAGE(5,'Reading image data')
+
+      call VRFY(ret,'mgrdimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_LINE)
+      call VRFY(ret,'mgrimil',number_failed)
+      ret = mgrcimg(ri_id,start,stride,dims,icbuf)
+      call VRFY(ret,'mgrcimg',number_failed)
+      ret = mgrimil(ri_id,MFGR_INTERLACE_COMPONENT)
+      call VRFY(ret,'mgrimil',number_failed)
+
+C End access to the image
+      ret = mgendac(ri_id)
+      call VRFY(ret,'mgendac',number_failed)
+
+C End access to the GR interface
+      ret = mgend(gr_id)
+      call VRFY(ret,'mgend',number_failed)
+
+C Close the file
+      ret = hclose(file_id)
+      call VRFY(ret,'hclose',number_failed)
+
+C
+C     GR chunking and compression tests. Added by EIP 1/13/98
+C
+C     ----Chunking test
+C          creates the following files:
+C                       grch_no.hdf
+C                       grch_rl.hdf
+C                       grch_sk.hdf
+C                       grch_gz.hdf
+      err_grchunk = 0
+      call test_grchunk(err_grchunk)
+      if (err_grchunk .ne. 0) then
+         number_failed = number_failed + 1
+         print *, '*******mgrf: test_grchunk failed********'
+      endif
+
+
+C     ----Chunking write/read test
+C          creates the following files:
+C                       grchwr_no.hdf
+C                       grchwr_rl.hdf
+C                       grchwr_sk.hdf
+C                       grchwr_gz.hdf
+      err_grwrchunk = 0
+      call test_grwrchunk(err_grwrchunk)
+      if (err_grwrchunk .ne. 0) then
+         number_failed = number_failed + 1
+         print *, '*******mgrf: test_grwrchunk failed********'
+      endif
+
+
+C     ----Compression test
+C
+C          creates the following files:
+C                       gr_no.hdf
+C                       gr_rl.hdf
+C                       gr_sk.hdf
+C                       gr_gz.hdf
+      err_grcompress = 0
+      call test_grcompress(err_grcompress)
+      if (err_grcompress .ne. 0) then
+         number_failed = number_failed + 1
+         print *, '*******mgrf: test_grcompress failed*******'
+      endif
+C
+      if (number_failed .eq. 0) then 
+	  if (Verbosity .gt. 6) then
+	      print *, CR, CR
+	      print *, '****** ALL TESTS SUCCESSFUL ******'
+	  endif
+      else
+          print *, '****** ', number_failed, ' TESTS FAILED  ******'
+      endif
+      return
+      end 
+
+      subroutine test_grchunk( err_grchunk )
+      implicit none
+      integer N_COMP_TYPES, N_COMP_ARG, NCOMP
+      integer MFGR_INTERLACE_PIXEL 
+      parameter(N_COMP_TYPES = 4, N_COMP_ARG =1)
+      parameter(NCOMP = 2, MFGR_INTERLACE_PIXEL = 0)
+      integer ri_id(N_COMP_TYPES),
+     .        gr_id(N_COMP_TYPES),
+     .        file_id(N_COMP_TYPES)
+      integer dims(2), start(2), edges(2), stride(2)
+      integer err_grchunk
+      integer i, j, status, il, k, i_comp, index
+      integer flags, maxcache, nc_out
+      character*12 file(N_COMP_TYPES)
+      character*12 name(N_COMP_TYPES)
+C
+C---GR interface functions
+C
+      integer mgstart, mgcreat, mgwrimg, mgsnatt,
+     .        mgrdimg, mgselct, mgendac, mgend
+C
+C---GR chunking functions 
+C
+      integer mggichnk, 
+     .        mgscchnk,
+     .        mgschnk
+C
+      integer hopen, hclose
+      integer DFACC_CREATE, 
+     .        DFACC_READ,
+     .        DFACC_WRITE
+      integer DFNT_INT16
+      integer X_LENGTH, Y_LENGTH
+      integer X_CH_LENGTH, Y_CH_LENGTH
+      parameter (DFACC_CREATE = 4,
+     .           DFACC_READ   = 1,
+     .           DFACC_WRITE  = 2)
+      parameter (DFNT_INT16   = 22)
+      parameter (X_LENGTH     = 9,
+     .           Y_LENGTH     = 4,
+     .           X_CH_LENGTH  = 3,
+     .           Y_CH_LENGTH  = 2) 
+C
+C---Compression types and parameters arrays 
+C
+      integer comp_type(N_COMP_TYPES), comp_type_out(N_COMP_TYPES)
+      integer comp_prm(N_COMP_ARG)
+C
+C---Compression parameters
+C
+      integer COMP_CODE_NONE,
+     .          COMP_CODE_RLE,
+     .          COMP_CODE_SKPHUFF,
+     .          COMP_CODE_DEFLATE,
+     .          SKPHUFF_SKP_SIZE,
+     .          DEFLATE_LEVEL
+
+      parameter(COMP_CODE_NONE    = 0,
+     .          COMP_CODE_RLE     = 1,
+     .          COMP_CODE_SKPHUFF = 3,
+     .          COMP_CODE_DEFLATE = 4)
+      parameter (DEFLATE_LEVEL = 1,
+     .           SKPHUFF_SKP_SIZE = 2)
+C
+C---Data
+C 
+      integer*2 image_data(NCOMP, X_LENGTH, Y_LENGTH)
+      integer*2 image_data_out(NCOMP,X_LENGTH,Y_LENGTH)
+C
+C---Default pixel value
+C
+      integer*2 pixel_value(2)
+C
+C---Chunking dimension arrays
+C
+      integer ch_dims(2), ch_dims_out(2)
+C
+C---We will write/read to four different files corresponding to the
+C   different compression types.
+C
+C   No compresion
+C
+      file(1) = 'grch_no.hdf'
+      name(1) = 'Nocomp_data'    
+      comp_type(1) = COMP_CODE_NONE
+      comp_type_out(1) = 0
+C
+C   RLE compresion
+C
+      file(2) = 'grch_rl.hdf'
+      name(2) = 'Rlcomp_data'    
+      comp_type(2) = COMP_CODE_RLE
+      comp_type_out(2) = 1 
+C
+C   Adaptive Huffman compresion
+C
+      file(3) = 'grch_sk.hdf'
+      name(3) = 'Hucomp_data'    
+      comp_type(3) = COMP_CODE_SKPHUFF
+      comp_type_out(3) = 1 
+C
+C   GZIP compression
+C
+      file(4) = 'grch_gz.hdf'
+      name(4) = 'Gzcomp_data'    
+      comp_type(4) = COMP_CODE_DEFLATE
+      comp_type_out(4) = 1 
+C
+C  Data initialization
+C 
+      do 30 j = 1, Y_LENGTH
+         do 20 i = 1, X_LENGTH
+           do 10 k = 1, NCOMP
+            image_data(k, i, j) = i + j - 1
+10         continue
+20    continue
+30    continue
+C
+C  Initialize compression argument array
+C
+      do 35 i = 1, N_COMP_ARG
+          comp_prm(i) = 0
+35    continue
+C
+C---Define chunk dimensions
+C
+         ch_dims(1) = X_CH_LENGTH 
+         ch_dims(2) = Y_CH_LENGTH 
+C
+C   Main loop through different compression types
+C
+
+      do 1000 i_comp=1, N_COMP_TYPES
+C
+C     Create and open the file.
+C
+      file_id(i_comp) = hopen(file(i_comp), DFACC_CREATE, 0)
+C
+C     Initiate the GR interface.
+C
+      gr_id(i_comp) = mgstart(file_id(i_comp))
+
+C     Define the number of components and dimensions of the image.
+
+      il = MFGR_INTERLACE_PIXEL
+      dims(1) = X_LENGTH
+      dims(2) = Y_LENGTH
+
+C     Create the data set.
+
+      ri_id(i_comp) = mgcreat(gr_id(i_comp), name(i_comp), NCOMP,
+     .                        DFNT_INT16, il, dims)
+
+C
+C---Set pixel value
+C
+      pixel_value(1) = 0
+      pixel_value(2) = 0
+C
+C---Fill the image array with the default pixel value
+C
+      status = mgsnatt(ri_id(i_comp), 'FillValue', DFNT_INT16,
+     .                 ncomp, pixel_value) 
+      if(status .ne. 0) then
+         print *, 'mgsnatt failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+
+C
+C---Define chunked GR
+C
+      if (i_comp. eq. 3) comp_prm(1) = SKPHUFF_SKP_SIZE
+      if (i_comp. eq. 4) comp_prm(1) =  DEFLATE_LEVEL
+      status = mgschnk (ri_id(i_comp), ch_dims,
+     .                  comp_type(i_comp),comp_prm)
+      if(status .ne. 0) then
+         print *, 'mgschnk failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C---Set chunk cache to hold maximum of 3 chunks
+C
+      maxcache = 3
+      flags = 0
+      status = mgscchnk (ri_id(i_comp), maxcache, flags) 
+      if(status .ne. 3) then
+         print *, 'mgscchnk failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Define the location, pattern, and size of the data set
+C     that will be written to.
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+
+C     Write the stored data to the image array.
+      status = mgwrimg(ri_id(i_comp), start, stride, edges, image_data)
+      if(status .ne. 0) then
+         print *, 'mgwrimg failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+
+1000  continue
+
+
+      do 2000 i_comp=1, N_COMP_TYPES
+C
+C     Open the file.
+C
+      file_id(i_comp) = hopen(file(i_comp), DFACC_READ, 0)
+      if(status .eq. -1) then
+         print *, 'hopen failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Initiate the GR interface and select first data set.
+C
+      gr_id(i_comp) = mgstart(file_id(i_comp))
+      if(status .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+      index = 0
+      ri_id(i_comp) = mgselct(gr_id(i_comp), index)
+      if(status .eq. -1) then
+         print *, 'mgselct failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Read the stored data to the image array.
+C
+      status = mgrdimg(ri_id(i_comp), start, stride, edges,
+     .                  image_data_out)
+      if(status .ne. 0) then
+         print *, 'mgrdimg failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C--- Compare the data we read with the original data
+C
+      do 60 j = 1, Y_LENGTH
+         do 50 i = 1, X_LENGTH
+           do 40 k = 1, ncomp
+            if(image_data(k, i, j).ne.image_data_out(k,i,j)) then
+             print *, 'data is wrong'
+             err_grchunk = err_grchunk +1
+            endif 
+40         continue
+50    continue
+60    continue
+C
+C   Check chunking info
+C
+       status = mggichnk(ri_id(i_comp), ch_dims_out,
+     .                   nc_out)
+      if(status .ne. 0) then
+         print *, 'mggichnk failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+       if (comp_type_out(i_comp) .ne. nc_out) then
+          print *, 'mggichnk returns wrong compression type for',
+     .              i_comp, '-th data set'
+          err_grchunk = err_grchunk + 1
+       endif
+       if ( (ch_dims(1) .ne. ch_dims_out(1)) .or.
+     .      (ch_dims(2) .ne. ch_dims_out(2))) then
+          print *, 'mggichnk returns wrong chunk dimensions for',
+     .              i_comp, '-th data set'
+          err_grchunk = err_grchunk + 1
+       endif
+
+  
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grchunk = err_grchunk +1
+      endif 
+2000  continue
+      return
+      end
+C
+C     GR compression test
+C
+      subroutine test_grcompress( err_grcompress )
+      implicit none
+      integer N_COMP_TYPES, N_COMP_ARG, NCOMP
+      parameter(N_COMP_TYPES = 4, N_COMP_ARG =1)
+      integer MFGR_INTERLACE_PIXEL
+      parameter(NCOMP = 2, MFGR_INTERLACE_PIXEL = 0)
+      integer ri_id(N_COMP_TYPES),
+     .        gr_id(N_COMP_TYPES),
+     .        file_id(N_COMP_TYPES)
+      integer dims(2), start(2), edges(2), stride(2)
+      integer i, j, k, status, il, i_comp, index
+      integer err_grcompress
+      character*12 file(N_COMP_TYPES)
+      character*12 name(N_COMP_TYPES)
+C
+C---GR interface functions
+C
+      integer mgstart, mgcreat, mgwrimg, mgn2ndx,
+     .        mgsnatt,
+     .        mgrdimg, mgselct, mgendac, mgend
+C
+C---GR compression function 
+C
+      integer mgscompress
+C
+      integer hopen, hclose
+      integer DFACC_CREATE, 
+     .        DFACC_READ,
+     .        DFACC_WRITE
+      integer DFNT_INT16
+      integer X_LENGTH, Y_LENGTH
+      integer X_CH_LENGTH, Y_CH_LENGTH
+      parameter (DFACC_CREATE = 4,
+     .           DFACC_READ   = 1,
+     .           DFACC_WRITE  = 2)
+      parameter (DFNT_INT16   = 22)
+      parameter (X_LENGTH     = 9,
+     .           Y_LENGTH     = 4,
+     .           X_CH_LENGTH  = 3,
+     .           Y_CH_LENGTH  = 2) 
+C
+C---Compression types and parameters arrays 
+C
+      integer comp_type(N_COMP_TYPES)
+      integer comp_prm(N_COMP_ARG)
+C
+C---Compression parameters
+C
+      integer COMP_CODE_NONE,
+     .          COMP_CODE_RLE,
+     .          COMP_CODE_SKPHUFF,
+     .          COMP_CODE_DEFLATE,
+     .          SKPHUFF_SKP_SIZE,
+     .          DEFLATE_LEVEL
+
+      parameter(COMP_CODE_NONE    = 0,
+     .          COMP_CODE_RLE     = 1,
+     .          COMP_CODE_SKPHUFF = 3,
+     .          COMP_CODE_DEFLATE = 4)
+      parameter (DEFLATE_LEVEL = 1,
+     .           SKPHUFF_SKP_SIZE = 2)
+C
+C---Data
+C 
+      integer*2 image_data(NCOMP, X_LENGTH, Y_LENGTH)
+      integer*2 image_data_out(NCOMP,X_LENGTH,Y_LENGTH)
+C
+C---Default pixel value
+C
+      integer*2 pixel_value(2)
+C
+C---We will write/read to four different files corresponding to the
+C   different compression types.
+C
+C   No compresion
+C
+      file(1) = 'gr_no.hdf'
+      name(1) = 'Nocomp_data'    
+      comp_type(1) = COMP_CODE_NONE
+C
+C   RLE compresion
+C
+      file(2) = 'gr_rl.hdf'
+      name(2) = 'Rlcomp_data'    
+      comp_type(2) = COMP_CODE_RLE
+C
+C   Adaptive Huffman compresion
+C
+      file(3) = 'gr_sk.hdf'
+      name(3) = 'Hucomp_data'    
+      comp_type(3) = COMP_CODE_SKPHUFF
+C
+C   GZIP compression
+C
+      file(4) = 'gr_gz.hdf'
+      name(4) = 'Gzcomp_data'    
+      comp_type(4) = COMP_CODE_DEFLATE
+C
+C  Data initialization
+C 
+      do 30 j = 1, Y_LENGTH
+         do 20 i = 1, X_LENGTH
+           do 10 k = 1, NCOMP
+            image_data(k, i, j) = i + j - 1
+10         continue
+20    continue
+30    continue
+C
+C  Initialize compression argument array
+C
+      do 35 i = 1, N_COMP_ARG
+          comp_prm(i) = 0
+35    continue
+C
+C   Main loop through different compression types
+C
+
+      do 1000 i_comp=1, N_COMP_TYPES
+C
+C     Create and open the file.
+C
+      file_id(i_comp) = hopen(file(i_comp), DFACC_CREATE, 0)
+      if(file_id(i_comp) .eq. -1) then
+         print *, 'hopen failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Initiate the GR interface.
+C
+      gr_id(i_comp) = mgstart(file_id(i_comp))
+      if(gr_id(i_comp) .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+
+C     Define the number of components and dimensions of the image.
+
+      il = MFGR_INTERLACE_PIXEL
+      dims(1) = X_LENGTH
+      dims(2) = Y_LENGTH
+
+C     Create the data set.
+
+      ri_id(i_comp) = mgcreat(gr_id(i_comp), name(i_comp), NCOMP,
+     .                        DFNT_INT16, il, dims)
+      if(ri_id(i_comp) .eq. -1) then
+         print *, 'mgcreat failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+
+C
+C---Set pixel value
+C
+      pixel_value(1) = 0
+      pixel_value(2) = 0
+C
+C---Fill the image array with the default pixel value
+C
+      status = mgsnatt(ri_id(i_comp), 'FillValue', DFNT_INT16,
+     .                 ncomp, pixel_value) 
+      if(status .ne. 0) then
+         print *, 'mgsnatt failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+
+C
+C---Set compression
+C
+      if (i_comp. eq. 3) comp_prm(1) = SKPHUFF_SKP_SIZE
+      if (i_comp. eq. 4) comp_prm(1) =  DEFLATE_LEVEL
+      status = mgscompress (ri_id(i_comp), 
+     .                  comp_type(i_comp),comp_prm)
+      if(status .ne. 0) then
+         print *, 'mgscompress failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Define the location, pattern, and size of the data set
+C     that will be written to.
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+
+C     Write the stored data to the image array..
+      status = mgwrimg(ri_id(i_comp), start, stride, edges, image_data)
+      if(status .ne. 0) then
+         print *, 'mgwrimg failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+
+1000  continue
+
+
+      do 2000 i_comp=1, N_COMP_TYPES
+C
+C     Open the file.
+C
+      file_id(i_comp) = hopen(file(i_comp), DFACC_READ, 0)
+      if(file_id(i_comp) .eq. -1) then
+         print *, 'hopen failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Initiate the GR interface and select first data set.
+C
+      gr_id(i_comp) = mgstart(file_id(i_comp))
+      if(gr_id(i_comp) .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+      index = mgn2ndx(gr_id(i_comp), name(i_comp))
+      if(index .eq. -1) then
+         print *, 'mgn2ndx failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+      ri_id(i_comp) = mgselct(gr_id(i_comp), index)
+      if(ri_id(i_comp) .eq. -1) then
+         print *, 'mgselct failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Read the stored data to the image array.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+      status = mgrdimg(ri_id(i_comp), start, stride, edges,
+     .                  image_data_out)
+      if(status .ne. 0) then
+         print *, 'mgrdimg failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C--- Compare the data we read with the original data
+C
+      do 60 j = 1, Y_LENGTH
+         do 50 i = 1, X_LENGTH
+           do 40 k = 1, ncomp
+            if(image_data(k, i, j).ne.image_data_out(k,i,j)) then
+             print *, 'data is wrong'
+             err_grcompress = err_grcompress +1
+            endif 
+40         continue
+50    continue
+60    continue
+
+  
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grcompress = err_grcompress +1
+      endif 
+2000  continue
+      return
+      end
+
+      subroutine test_grwrchunk( err_grwrchunk )
+C
+C---This subroutine tests GR write/read functions
+C
+      implicit none
+      integer N_COMP_TYPES, N_COMP_ARG, NCOMP
+      integer MFGR_INTERLACE_PIXEL 
+      parameter(N_COMP_TYPES = 4, N_COMP_ARG =1)
+      parameter(NCOMP = 3, MFGR_INTERLACE_PIXEL = 0)
+      integer ri_id(N_COMP_TYPES),
+     .        gr_id(N_COMP_TYPES),
+     .        file_id(N_COMP_TYPES)
+      integer dims(2), start(2), edges(2), stride(2)
+      integer err_grwrchunk
+      integer i, j, status, il, k, i_comp, index
+      character*13 file(N_COMP_TYPES)
+      character*12 name(N_COMP_TYPES)
+C
+C---GR interface functions
+C
+      integer mgstart, mgcreat, mgsnatt,
+     .        mgrdimg, mgselct, mgendac, mgend
+C
+C---GR chunking functions 
+C
+      integer mgwchnk, 
+     .        mgrchnk,
+     .        mgschnk
+C
+      integer hopen, hclose
+      integer DFACC_CREATE, 
+     .        DFACC_READ,
+     .        DFACC_WRITE
+      integer DFNT_INT16
+      integer X_LENGTH, Y_LENGTH
+      integer X_CH_LENGTH, Y_CH_LENGTH
+      parameter (DFACC_CREATE = 4,
+     .           DFACC_READ   = 1,
+     .           DFACC_WRITE  = 2)
+      parameter (DFNT_INT16   = 22)
+      parameter (X_LENGTH     = 6,
+     .           Y_LENGTH     = 10,
+     .           X_CH_LENGTH  = 3,
+     .           Y_CH_LENGTH  = 2) 
+C
+C---Compression types and parameters arrays 
+C
+      integer comp_type(N_COMP_TYPES), comp_type_out(N_COMP_TYPES)
+      integer comp_prm(N_COMP_ARG)
+C
+C---Compression parameters
+C
+      integer COMP_CODE_NONE,
+     .          COMP_CODE_RLE,
+     .          COMP_CODE_SKPHUFF,
+     .          COMP_CODE_DEFLATE,
+     .          SKPHUFF_SKP_SIZE,
+     .          DEFLATE_LEVEL
+
+      parameter(COMP_CODE_NONE    = 0,
+     .          COMP_CODE_RLE     = 1,
+     .          COMP_CODE_SKPHUFF = 3,
+     .          COMP_CODE_DEFLATE = 4)
+      parameter (DEFLATE_LEVEL = 1,
+     .           SKPHUFF_SKP_SIZE = 2)
+C
+C---Data
+C 
+      integer*2 chunk11(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*2 chunk21(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*2 chunk52(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*2 chunk52_out(NCOMP* X_CH_LENGTH*Y_CH_LENGTH)
+      integer*2 data_org(NCOMP* X_LENGTH*Y_LENGTH)
+      integer*2 data_org1(30)
+      integer*2 data_org2(30)
+      integer*2 data_org3(30)
+      integer*2 data_org4(30)
+      integer*2 data_org5(30)
+      integer*2 data_org6(30)
+       
+      integer*2 image_data_out(NCOMP,X_LENGTH,Y_LENGTH)
+      integer*2 data_arr(NCOMP,X_LENGTH,Y_LENGTH)
+C
+C---Those statemnets were created for SunOS since the 
+C   compiler does not support multiple continuation lines
+C   needed for data initilization in DATA statement.
+C   This file should be used only on SunOS and
+C   should be deleted from CVS as soon as we drop SunOS support.
+C        EP 5/5/99
+C
+      equivalence (data_org(1), data_arr(1,1,1))
+      equivalence (data_org(1), data_org1(1))
+      equivalence (data_org(31), data_org2(1))
+      equivalence (data_org(61), data_org3(1))
+      equivalence (data_org(91), data_org4(1))
+      equivalence (data_org(121), data_org5(1))
+      equivalence (data_org(151), data_org6(1))
+C
+C---Default pixel value
+C
+      integer*2 pixel_value(3)
+C
+C---Chunking dimension arrays
+C
+      integer ch_dims(2)
+C
+C---We will write/read to four different files corresponding to the
+C   different compression types.
+C
+C   No compresion
+C
+      file(1) = 'grchwr_no.hdf'
+      name(1) = 'Nocomp_data'    
+      comp_type(1) = COMP_CODE_NONE
+      comp_type_out(1) = 0
+C
+C   RLE compresion
+C
+      file(2) = 'grchwr_rl.hdf'
+      name(2) = 'Rlcomp_data'    
+      comp_type(2) = COMP_CODE_RLE
+      comp_type_out(2) = 1 
+C
+C   Adaptive Huffman compresion
+C
+      file(3) = 'grchwr_sk.hdf'
+      name(3) = 'Hucomp_data'    
+      comp_type(3) = COMP_CODE_SKPHUFF
+      comp_type_out(3) = 1 
+C
+C   GZIP compression
+C
+      file(4) = 'grchwr_gz.hdf'
+      name(4) = 'Gzcomp_data'    
+      comp_type(4) = COMP_CODE_DEFLATE
+      comp_type_out(4) = 1 
+C
+C  Data initialization
+C 
+      data chunk11 / 110, 111, 112, 120, 121, 122,
+     .                130, 131, 132, 140, 141, 142,
+     .                150, 151, 152, 160, 161, 162/ 
+      data  chunk21 /
+     .                210, 211, 212, 220, 221, 222,
+     .                230, 231, 232, 240, 241, 242,
+     .                250, 251, 252, 260, 261, 262
+     .              /
+      data  chunk52 /
+     .                1010, 1011, 1012, 1020, 1021, 1022,
+     .                1030, 1031, 1032, 1040, 1041, 1042,
+     .                1050, 1051, 1052, 1060, 1061, 1062
+     .              /
+
+      data  data_org1  
+     .              / 110, 111, 112, 120, 121, 122, 
+     .                210, 211, 212, 220, 221, 222, 0,
+     .                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+     .                 0, 0, 0, 0, 0, 0, 0 /
+
+      data  data_org2    
+     .              / 130, 131, 132, 140,
+     .                141, 142, 230, 231, 232, 240, 241, 242, 
+     .                0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .                0, 0, 0, 0, 0, 0, 0, 0, 0 /
+
+       data data_org3          
+     .              / 150, 151, 152, 160, 161, 162, 250, 251,
+     .                252, 260, 261, 262, 0, 0, 0, 0, 0, 0, 0, 
+     .                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0/
+
+       data data_org4      
+     .              / 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+     .                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .                1010, 1011, 1012, 1020, 1021, 1022 /
+
+       data data_org5      
+     .              / 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+     .                1030, 1031, 1032, 1040, 1041, 1042/
+
+       data data_org6    
+     .              / 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+     .                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+     .                0, 1050, 1051, 1052, 1060, 1061, 1062 /
+
+C
+C  Initialize compression argument array
+C
+      do 35 i = 1, N_COMP_ARG
+          comp_prm(i) = 0
+35    continue
+C
+C---Define chunk dimensions
+C
+         ch_dims(1) = Y_CH_LENGTH 
+         ch_dims(2) = X_CH_LENGTH 
+C
+C   Main loop through different compression types
+C
+
+      do 1000 i_comp=1, N_COMP_TYPES
+C
+C     Create and open the file.
+C
+      file_id(i_comp) = hopen(file(i_comp), DFACC_CREATE, 0)
+C
+C     Initiate the GR interface.
+C
+      gr_id(i_comp) = mgstart(file_id(i_comp))
+
+C     Define the number of components and dimensions of the image.
+
+      il = MFGR_INTERLACE_PIXEL
+      dims(1) = X_LENGTH
+      dims(2) = Y_LENGTH
+
+C     Create the data set.
+
+      ri_id(i_comp) = mgcreat(gr_id(i_comp), name(i_comp), NCOMP,
+     .                        DFNT_INT16, il, dims)
+
+C
+C---Set pixel value
+C
+      pixel_value(1) = 0
+      pixel_value(2) = 0
+      pixel_value(3) = 0
+C
+C---Fill the image array with the default pixel value
+C
+      status = mgsnatt(ri_id(i_comp), 'FillValue', DFNT_INT16,
+     .                 ncomp, pixel_value) 
+      if(status .ne. 0) then
+         print *, 'mgsnatt failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+
+C
+C---Define chunked GR
+C
+      if (i_comp. eq. 3) comp_prm(1) = SKPHUFF_SKP_SIZE
+      if (i_comp. eq. 4) comp_prm(1) =  DEFLATE_LEVEL
+      status = mgschnk (ri_id(i_comp), ch_dims,
+     .                  comp_type(i_comp),comp_prm)
+      if(status .ne. 0) then
+         print *, 'mgschnk failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Define the location of the first chunk 
+C     that will be written to.
+      start(1) = 1 
+      start(2) = 1 
+
+C     Write the stored data to the image array.
+      status = mgwchnk(ri_id(i_comp), start, chunk11)
+      if(status .ne. 0) then
+         print *, 'mgwchnk failed for', i_comp, 
+     .            '-th data set, first chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Define the location of the first chunk 
+C     that will be written to.
+      start(1) = 2 
+      start(2) = 1 
+
+C     Write the stored data to the image array.
+      status = mgwchnk(ri_id(i_comp), start, chunk21)
+      if(status .ne. 0) then
+         print *, 'mgwchnk failed for', i_comp, 
+     .            '-th data set, second chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Define the location of the first chunk 
+C     that will be written to.
+      start(1) = 5 
+      start(2) = 2 
+
+C     Write the stored data to the image array.
+      status = mgwchnk(ri_id(i_comp), start, chunk52)
+      if(status .ne. 0) then
+         print *, 'mgwchnk failed for', i_comp, 
+     .            '-th data set, third chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+
+1000  continue
+
+
+      do 2000 i_comp=1, N_COMP_TYPES
+C
+C     Open the file.
+C
+      file_id(i_comp) = hopen(file(i_comp), DFACC_READ, 0)
+      if(status .eq. -1) then
+         print *, 'hopen failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Initiate the GR interface and select first data set.
+C
+      gr_id(i_comp) = mgstart(file_id(i_comp))
+      if(status .eq. -1) then
+         print *, 'mgstart failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+      index = 0
+      ri_id(i_comp) = mgselct(gr_id(i_comp), index)
+      if(status .eq. -1) then
+         print *, 'mgselct failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Read the stored data to the image array.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+      status = mgrdimg(ri_id(i_comp), start, stride, edges,
+     .                  image_data_out)
+      if(status .ne. 0) then
+         print *, 'mgrdimg failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C--- Compare the data we read with the original data
+C
+      do 60 j = 1, Y_LENGTH
+         do 50 i = 1, X_LENGTH
+           do 40 k = 1, ncomp
+            if(data_arr(k, i, j).ne.image_data_out(k,i,j)) then
+             print *, 'data is wrong'
+             err_grwrchunk = err_grwrchunk +1
+            endif 
+40         continue
+50    continue
+60    continue
+  
+C
+C--- Read the third chunk back and compare it with original data.
+C
+
+      start(1) = 5 
+      start(2) = 2 
+      status = mgrchnk(ri_id(i_comp), start, chunk52_out)
+      if(status .ne. 0) then
+         print *, 'mgrchnk failed for', i_comp, 
+     .            '-th data set, third chunk'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+      do 401 j = 1, NCOMP*X_CH_LENGTH*Y_CH_LENGTH
+           if(chunk52(j).ne.chunk52_out(j)) then
+             print *, 'read chunk''s data is wrong'
+             err_grwrchunk = err_grwrchunk +1
+            endif
+401         continue
+
+C
+C     Terminate access to the array.
+C
+      status = mgendac(ri_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgendac failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Terminate access to the GR interface.
+C
+      status = mgend(gr_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'mgend failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+C
+C     Close the file.
+C
+      status = hclose(file_id(i_comp))
+      if(status .ne. 0) then
+         print *, 'hclose failed for', i_comp, '-th data set'
+         err_grwrchunk = err_grwrchunk +1
+      endif 
+2000  continue
+      return
+      end
+
+
diff --git a/hdf/test/nbit.c b/hdf/test/nbit.c
new file mode 100644
index 0000000..b155ae8
--- /dev/null
+++ b/hdf/test/nbit.c
@@ -0,0 +1,1144 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+   FILE
+   nbit.c
+   Test HDF N-Bit dataset I/O routines
+
+   REMARKS
+   These tests depend on the bitio layer, the compression layer and
+   the SD layer...
+
+   DESIGN
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   1/19/94 - Started coding
+ */
+
+/* $Id: nbit.c 5210 2009-08-21 20:27:12Z brtnfld $ */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5210 $";
+#endif
+
+#include "tproto.h"
+#define TESTFILE_NAME "tnbit.hdf"
+#define DATAFILE_NAME "test_files/nbit.dat"
+
+#define NBIT_TAG1   1000
+#define NBIT_REF1   1000
+#define NBIT_SIZE1  4096
+#define NBIT_BITS1  6
+#define NBIT_MASK1  0x3f
+
+#define NBIT_TAG2   1001
+#define NBIT_REF2   1001
+#define NBIT_SIZE2  4096
+#define NBIT_BITS2  6
+#define NBIT_MASK2  0x3f
+
+#define NBIT_TAG3   1002
+#define NBIT_REF3   1002
+#define NBIT_SIZE3  4096
+#define NBIT_BITS3  12
+#define NBIT_MASK3A 0x0fff
+#define NBIT_MASK3B 0xffff
+
+#define NBIT_TAG4   1003
+#define NBIT_REF4   1003
+#define NBIT_SIZE4  4096
+#define NBIT_BITS4  14
+#define NBIT_MASK4A 0xffff
+#define NBIT_MASK4B 0xffff
+
+#define NBIT_TAG5   1004
+#define NBIT_REF5   1004
+#define NBIT_SIZE5  4096
+#define NBIT_BITS5  27
+#define NBIT_MASK5A 0x07ffffff
+#define NBIT_MASK5B 0xffffffffUL
+
+#define NBIT_TAG6   1005
+#define NBIT_REF6   1005
+#define NBIT_SIZE6  4096
+#define NBIT_BITS6  29
+#define NBIT_MASK6A 0xffffffffUL
+#define NBIT_MASK6B 0xffffffffUL
+
+#define NBIT_TAG7   1006
+#define NBIT_REF7   1006
+#define NBIT_SIZE7  4096
+#define NBIT_BITS7  4
+#define NBIT_OFF7   6
+#define NBIT_MASK7A 0x78
+#define NBIT_MASK7B 0x87
+
+#define NBIT_TAG8   1007
+#define NBIT_REF8   1007
+#define NBIT_SIZE8  4096
+#define NBIT_BITS8  4
+#define NBIT_OFF8   5
+#define NBIT_MASK8  0x03
+
+#define NBIT_TAG9   1008
+#define NBIT_REF9   1008
+#define NBIT_SIZE9  4096
+#define NBIT_BITS9  8
+#define NBIT_OFF9   12
+#define NBIT_MASK9A 0xe01f
+#define NBIT_MASK9B 0xffff
+
+#define NBIT_TAG10   1009
+#define NBIT_REF10   1009
+#define NBIT_SIZE10  4096
+#define NBIT_BITS10  9
+#define NBIT_OFF10   10
+#define NBIT_MASK10A 0x0003
+#define NBIT_MASK10B 0xffff
+
+#define NBIT_TAG11   1010
+#define NBIT_REF11   1010
+#define NBIT_SIZE11  4096
+#define NBIT_BITS11  18
+#define NBIT_OFF11   27
+#define NBIT_MASK11A 0xf00003ffUL
+#define NBIT_MASK11B 0xffffffffUL
+
+#define NBIT_TAG12   1011
+#define NBIT_REF12   1011
+#define NBIT_SIZE12  4096
+#define NBIT_BITS12  27
+#define NBIT_OFF12   31
+#define NBIT_MASK12A 0x0000001f
+#define NBIT_MASK12B 0xffffffffUL
+
+static void test_nbit1(int32 fid);
+static void test_nbit2(int32 fid);
+static void test_nbit3(int32 fid);
+static void test_nbit4(int32 fid);
+static void test_nbit5(int32 fid);
+static void test_nbit6(int32 fid);
+static void test_nbit7(int32 fid);
+static void test_nbit8(int32 fid);
+static void test_nbit9(int32 fid);
+static void test_nbit10(int32 fid);
+static void test_nbit11(int32 fid);
+static void test_nbit12(int32 fid);
+
+static void
+test_nbit1(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    uint8      *outbuf, *inbuf;
+    uint8       test_val;
+
+    outbuf = (uint8 *) HDmalloc(NBIT_SIZE1 * sizeof(uint8));
+    inbuf = (uint8 *) HDmalloc(NBIT_SIZE1 * sizeof(uint8));
+
+    for (i = 0; i < NBIT_SIZE1; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (uint8) (i * 3);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as an unsigned 8-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_UINT8;
+    c_info.nbit.sign_ext = FALSE;
+    c_info.nbit.fill_one = FALSE;
+    c_info.nbit.start_bit = NBIT_BITS1 - 1;
+    c_info.nbit.bit_len = NBIT_BITS1;
+    aid1 = HCcreate(fid, NBIT_TAG1, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = Hwrite(aid1, NBIT_SIZE1, outbuf);
+    if (ret != NBIT_SIZE1)
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+    ret = Hgetelement(fid, NBIT_TAG1, (uint16) ref1, inbuf);
+    if (ret != NBIT_SIZE1)
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    for (i = 0; i < NBIT_SIZE1; i++)
+      {
+          test_val = (uint8) (outbuf[i] & NBIT_MASK1);
+          if ((uint8) inbuf[i] != (uint8) test_val)
+            {
+                printf("test_nbit1: Wrong data at %d, out (%d)%d in %d\n", i, outbuf[i], test_val, inbuf[i]);
+                errors++;
+            }
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit2(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    int8       *outbuf, *inbuf;
+
+    outbuf = (int8 *) HDmalloc(NBIT_SIZE2 * sizeof(int8));
+    inbuf = (int8 *) HDmalloc(NBIT_SIZE2 * sizeof(int8));
+
+    for (i = 0; i < NBIT_SIZE2; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (int8) (((i * 3) % 64) - 32);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a signed 8-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_INT8;
+    c_info.nbit.sign_ext = TRUE;
+    c_info.nbit.fill_one = FALSE;
+    c_info.nbit.start_bit = NBIT_BITS2 - 1;
+    c_info.nbit.bit_len = NBIT_BITS2;
+    aid1 = HCcreate(fid, NBIT_TAG2, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = Hwrite(aid1, NBIT_SIZE2, (uint8  *) outbuf);
+    if (ret != NBIT_SIZE2)
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+    ret = Hgetelement(fid, NBIT_TAG2, (uint16) ref1, (uint8  *) inbuf);
+    if (ret != NBIT_SIZE2)
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    for (i = 0; i < ret; i++)
+      {
+          if ((int8) inbuf[i] != (int8) outbuf[i])
+            {
+                printf("test_nbit2: Wrong data at %d, out %d in %d\n", i, outbuf[i], inbuf[i]);
+                errors++;
+            }
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit3(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    uint16     *outbuf, *inbuf;
+    uint16      test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (uint16 *) HDmalloc(NBIT_SIZE3 * sizeof(uint16));
+    inbuf = (uint16 *) HDmalloc(NBIT_SIZE3 * sizeof(uint16));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE3 * (size_t)DFKNTsize(DFNT_UINT16));
+
+    for (i = 0; i < NBIT_SIZE3; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (uint16) (i * 3);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a unsigned 16-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_UINT16;
+    c_info.nbit.sign_ext = FALSE;
+    c_info.nbit.fill_one = FALSE;
+    c_info.nbit.start_bit = NBIT_BITS3 - 1;
+    c_info.nbit.bit_len = NBIT_BITS3;
+    aid1 = HCcreate(fid, NBIT_TAG3, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT16, NBIT_SIZE3, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+    ret = Hwrite(aid1, NBIT_SIZE3 * DFKNTsize(DFNT_UINT16), convbuf);
+    if (ret != NBIT_SIZE3 * DFKNTsize(DFNT_UINT16))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_UINT16) * NBIT_SIZE3);
+    ret = Hgetelement(fid, NBIT_TAG3, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE3 * DFKNTsize(DFNT_UINT16))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_UINT16, NBIT_SIZE3, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+    for (i = 0; i < NBIT_SIZE3; i++)
+      {
+          test_out = (uint16) (outbuf[i] & NBIT_MASK3A);
+          test_in = (uint16) (inbuf[i] & NBIT_MASK3B);
+#ifndef TESTING
+          if ((int16) test_in != (int16) test_out)
+            {
+                printf("test_nbit3: Wrong data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit4(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    int16      *outbuf, *inbuf;
+    int16       test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (int16 *) HDmalloc(NBIT_SIZE4 * sizeof(int16));
+    inbuf = (int16 *) HDmalloc(NBIT_SIZE4 * sizeof(int16));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE4 * (size_t)DFKNTsize(DFNT_INT16));
+
+    for (i = 0; i < NBIT_SIZE4; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (int16) (((i * 3) % (64 * 256)) - (32 * 256));
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a signed 16-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_INT16;
+    c_info.nbit.sign_ext = TRUE;
+    c_info.nbit.fill_one = FALSE;
+    c_info.nbit.start_bit = NBIT_BITS4 - 1;
+    c_info.nbit.bit_len = NBIT_BITS4;
+    aid1 = HCcreate(fid, NBIT_TAG4, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT16, NBIT_SIZE4, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    ret = Hwrite(aid1, NBIT_SIZE4 * DFKNTsize(DFNT_INT16), convbuf);
+    if (ret != NBIT_SIZE4 * DFKNTsize(DFNT_INT16))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_INT16) * NBIT_SIZE4);
+
+    ret = Hgetelement(fid, NBIT_TAG4, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE4 * DFKNTsize(DFNT_INT16))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_INT16, NBIT_SIZE4, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+    for (i = 0; i < NBIT_SIZE4; i++)
+      {
+          test_out = (int16) (outbuf[i] & NBIT_MASK4A);
+          test_in = (int16) (inbuf[i] & NBIT_MASK4B);
+#ifndef TESTING
+          if ((int16) test_in != (int16) test_out)
+            {
+                printf("test_nbit4: Wrong data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit5(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    uint32     *outbuf, *inbuf;
+    uint32      test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (uint32 *) HDmalloc(NBIT_SIZE5 * sizeof(uint32));
+    inbuf = (uint32 *) HDmalloc(NBIT_SIZE5 * sizeof(uint32));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE5 * (size_t)DFKNTsize(DFNT_UINT32));
+
+    for (i = 0; i < NBIT_SIZE5; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (uint32)(i * 300000);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a unsigned 32-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_UINT32;
+    c_info.nbit.sign_ext = FALSE;
+    c_info.nbit.fill_one = FALSE;
+    c_info.nbit.start_bit = NBIT_BITS5 - 1;
+    c_info.nbit.bit_len = NBIT_BITS5;
+    aid1 = HCcreate(fid, NBIT_TAG5, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT32, NBIT_SIZE5, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    ret = Hwrite(aid1, NBIT_SIZE5 * DFKNTsize(DFNT_UINT32), convbuf);
+    if (ret != NBIT_SIZE5 * DFKNTsize(DFNT_UINT32))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_UINT32) * NBIT_SIZE5);
+
+    ret = Hgetelement(fid, NBIT_TAG5, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE5 * DFKNTsize(DFNT_UINT32))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_UINT32, NBIT_SIZE5, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    for (i = 0; i < NBIT_SIZE5; i++)
+      {
+          test_out = outbuf[i] & NBIT_MASK5A;
+          test_in = (uintn)inbuf[i] & (uintn)NBIT_MASK5B;
+#ifndef TESTING
+          if ((uint32) test_in != (uint32) test_out)
+            {
+                printf("test_nbit5: Wrong data at %d, out (%lu)%lu in (%lu)%lu\n", i, (unsigned long) outbuf[i], (unsigned long) test_out, (unsigned long) inbuf[i], (unsigned long) test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit6(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    int32      *outbuf, *inbuf;
+    int32       test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (int32 *) HDmalloc(NBIT_SIZE6 * sizeof(int32));
+    inbuf = (int32 *) HDmalloc(NBIT_SIZE6 * sizeof(int32));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE6 * (size_t)DFKNTsize(DFNT_INT32));
+
+    for (i = 0; i < NBIT_SIZE6; i++)    /* fill with pseudo-random data */
+        outbuf[i] = ((i * 300001) % ((int32) 16 * 256 * 256 * 256)) - ((int32) 8 * 256 * 256 * 256);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a signed 32-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_INT32;
+    c_info.nbit.sign_ext = TRUE;
+    c_info.nbit.fill_one = FALSE;
+    c_info.nbit.start_bit = NBIT_BITS6 - 1;
+    c_info.nbit.bit_len = NBIT_BITS6;
+    aid1 = HCcreate(fid, NBIT_TAG6, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT32, NBIT_SIZE6, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    ret = Hwrite(aid1, NBIT_SIZE6 * DFKNTsize(DFNT_INT32), convbuf);
+    if (ret != NBIT_SIZE6 * DFKNTsize(DFNT_INT32))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_INT32) * NBIT_SIZE6);
+
+    ret = Hgetelement(fid, NBIT_TAG6, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE6 * DFKNTsize(DFNT_INT32))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_INT32, NBIT_SIZE6, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    for (i = 0; i < NBIT_SIZE6; i++)
+      {
+          test_out = (int32)((uintn)outbuf[i] & (uintn)NBIT_MASK6A);
+          test_in = (int32)((uintn)inbuf[i] & (uintn)NBIT_MASK6B);
+#ifndef TESTING
+          if ((int32) test_in != (int32) test_out)
+            {
+                printf("test_nbit6: Wrong data at %d, out (%ld)%ld in (%ld)%ld\n", i, (long) outbuf[i], (long) test_out, (long) inbuf[i], (long) test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit7(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    uint8      *outbuf, *inbuf;
+    uint8       test_val;
+
+    outbuf = (uint8 *) HDmalloc(NBIT_SIZE7 * sizeof(uint8));
+    inbuf = (uint8 *) HDmalloc(NBIT_SIZE7 * sizeof(uint8));
+
+    for (i = 0; i < NBIT_SIZE7; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (uint8) (i * 3);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a unsigned 8-bit n-bit element with filled ones\n");
+        );
+    c_info.nbit.nt = DFNT_UINT8;
+    c_info.nbit.sign_ext = FALSE;
+    c_info.nbit.fill_one = TRUE;
+    c_info.nbit.start_bit = NBIT_OFF7;
+    c_info.nbit.bit_len = NBIT_BITS7;
+    aid1 = HCcreate(fid, NBIT_TAG7, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = Hwrite(aid1, NBIT_SIZE7, outbuf);
+    if (ret != NBIT_SIZE7)
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+    ret = Hgetelement(fid, NBIT_TAG7, (uint16) ref1, inbuf);
+    if (ret != NBIT_SIZE7)
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    for (i = 0; i < ret; i++)
+      {
+          test_val = (uint8) ((outbuf[i] & NBIT_MASK7A) | NBIT_MASK7B);
+          if ((uint8) inbuf[i] != (uint8) test_val)
+            {
+                printf("test_nbit7: Wrong data at %d, out (%d)%d in %d\n", i, outbuf[i], test_val, inbuf[i]);
+                errors++;
+            }
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit8(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    int8       *outbuf, *inbuf;
+    int8        test_val;
+
+    outbuf = (int8 *) HDmalloc(NBIT_SIZE8 * sizeof(int8));
+    inbuf = (int8 *) HDmalloc(NBIT_SIZE8 * sizeof(int8));
+
+    for (i = 0; i < NBIT_SIZE8; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (int8) ((((i * 3) % 16) - 8) << 2);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a signed 8-bit n-bit element with filled ones\n");
+        );
+    c_info.nbit.nt = DFNT_INT8;
+    c_info.nbit.sign_ext = TRUE;
+    c_info.nbit.fill_one = TRUE;
+    c_info.nbit.start_bit = NBIT_OFF8;
+    c_info.nbit.bit_len = NBIT_BITS8;
+    aid1 = HCcreate(fid, NBIT_TAG8, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = Hwrite(aid1, NBIT_SIZE8, (uint8  *) outbuf);
+    if (ret != NBIT_SIZE8)
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+    ret = Hgetelement(fid, NBIT_TAG8, (uint16) ref1, (uint8  *) inbuf);
+    if (ret != NBIT_SIZE8)
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    for (i = 0; i < ret; i++)
+      {
+          test_val = (int8) (outbuf[i] | NBIT_MASK8);
+          if ((int8) inbuf[i] != (int8) test_val)
+            {
+                printf("test_nbit8: Wrong data at %d, out (%d:%x)%d in %d\n", i, outbuf[i], outbuf[i], test_val, inbuf[i]);
+                errors++;
+            }
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit9(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    uint16     *outbuf, *inbuf;
+    uint16      test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (uint16 *) HDmalloc(NBIT_SIZE9 * sizeof(uint16));
+    inbuf = (uint16 *) HDmalloc(NBIT_SIZE9 * sizeof(uint16));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE9 * (size_t)DFKNTsize(DFNT_UINT16));
+
+    for (i = 0; i < NBIT_SIZE9; i++)    /* fill with pseudo-random data */
+        outbuf[i] = (uint16) (i * 3);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a unsigned 16-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_UINT16;
+    c_info.nbit.sign_ext = FALSE;
+    c_info.nbit.fill_one = TRUE;
+    c_info.nbit.start_bit = NBIT_OFF9;
+    c_info.nbit.bit_len = NBIT_BITS9;
+    aid1 = HCcreate(fid, NBIT_TAG9, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT16, NBIT_SIZE9, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    ret = Hwrite(aid1, NBIT_SIZE9 * DFKNTsize(DFNT_UINT16), convbuf);
+    if (ret != NBIT_SIZE9 * DFKNTsize(DFNT_UINT16))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_UINT16) * NBIT_SIZE9);
+
+    ret = Hgetelement(fid, NBIT_TAG9, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE9 * DFKNTsize(DFNT_UINT16))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_UINT16, NBIT_SIZE9, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    for (i = 0; i < NBIT_SIZE9; i++)
+      {
+          test_out = (uint16) ((outbuf[i] | NBIT_MASK9A) & NBIT_MASK9B);
+          test_in = (uint16) (inbuf[i] & NBIT_MASK9B);
+#ifndef TESTING
+          if ((uint16) test_in != (uint16) test_out)
+            {
+                printf("test_nbit9: Wrong data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_val, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit10(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    int16      *outbuf, *inbuf;
+    int16       test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (int16 *) HDmalloc(NBIT_SIZE10 * sizeof(int16));
+    inbuf = (int16 *) HDmalloc(NBIT_SIZE10 * sizeof(int16));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE10 * (size_t)DFKNTsize(DFNT_UINT16));
+
+    for (i = 0; i < NBIT_SIZE10; i++)   /* fill with pseudo-random data */
+        outbuf[i] = (int16) ((((i * 3) % (2 * 256)) - (256)) << ((NBIT_OFF10 - NBIT_BITS10) + 1));
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a signed 16-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_INT16;
+    c_info.nbit.sign_ext = TRUE;
+    c_info.nbit.fill_one = TRUE;
+    c_info.nbit.start_bit = NBIT_OFF10;
+    c_info.nbit.bit_len = NBIT_BITS10;
+    aid1 = HCcreate(fid, NBIT_TAG10, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT16, NBIT_SIZE10, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    ret = Hwrite(aid1, NBIT_SIZE10 * DFKNTsize(DFNT_INT16), convbuf);
+    if (ret != NBIT_SIZE10 * DFKNTsize(DFNT_INT16))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_INT16) * NBIT_SIZE10);
+
+    ret = Hgetelement(fid, NBIT_TAG10, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE10 * DFKNTsize(DFNT_INT16))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_INT16, NBIT_SIZE10, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    for (i = 0; i < NBIT_SIZE10; i++)
+      {
+/* intel windows c++ compiler has a bug when masking outbuf[i], it extends the
+ * signed bit to all bits of higher 16 bit, so don't use MASK for intel windows
+ * c++ compiler. Kent Yang 09/02/02
+ * The same error occur in the Unix Intel Compiler. Albert Cheng 10/26/02
+ */
+/* Apparently Intel compiler bug was fixed and the fix below causes problems
+ * when optimization is used. We decided to go to the original code that
+ * works now with Intel 7.0 and Intel 7.1 compilers on both UNIX and Windows  
+ * EIP 12/2/03
+#if (defined __INTEL_COMPILER || defined __ICL)
+     test_out = (int16)(outbuf[i] | NBIT_MASK10A);
+#else
+     test_out = (int16) ((outbuf[i] | NBIT_MASK10A) & NBIT_MASK10B);
+#endif
+*/
+     test_out = (int16) ((outbuf[i] | NBIT_MASK10A) & NBIT_MASK10B);
+          test_in = (int16) (inbuf[i] & NBIT_MASK10B);
+/* The following ifdef block fixes a compiler bug on the */
+/* HP9000, leave it in! -QAK */
+#ifdef HP9000
+          {
+              char       *t;
+              t = (char *) &test_out;
+              t = (char *) &test_in;
+          }
+#endif /* HP9000 */
+#ifndef TESTING
+          if ((int16) test_in != (int16) test_out)
+            {
+                printf("test_nbit10: Wrong data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit11(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    uint32     *outbuf, *inbuf;
+    uint32      test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (uint32 *) HDmalloc(NBIT_SIZE11 * sizeof(uint32));
+    inbuf = (uint32 *) HDmalloc(NBIT_SIZE11 * sizeof(uint32));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE11 * (size_t)DFKNTsize(DFNT_UINT32));
+
+    for (i = 0; i < NBIT_SIZE11; i++)   /* fill with pseudo-random data */
+        outbuf[i] = (uint32)(i * 304327);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a unsigned 32-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_UINT32;
+    c_info.nbit.sign_ext = FALSE;
+    c_info.nbit.fill_one = TRUE;
+    c_info.nbit.start_bit = NBIT_OFF11;
+    c_info.nbit.bit_len = NBIT_BITS11;
+    aid1 = HCcreate(fid, NBIT_TAG11, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_UINT32, NBIT_SIZE11, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    ret = Hwrite(aid1, NBIT_SIZE11 * DFKNTsize(DFNT_UINT32), convbuf);
+    if (ret != NBIT_SIZE11 * DFKNTsize(DFNT_UINT32))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_UINT32) * NBIT_SIZE11);
+
+    ret = Hgetelement(fid, NBIT_TAG11, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE11 * DFKNTsize(DFNT_UINT32))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_UINT32, NBIT_SIZE11, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    for (i = 0; i < NBIT_SIZE11; i++)
+      {
+          test_out = (outbuf[i] | (uintn)NBIT_MASK11A) & (uintn)NBIT_MASK11B;
+          test_in = inbuf[i] & (uintn)NBIT_MASK11B;
+#ifndef TESTING
+          if ((uint32) test_in != (uint32) test_out)
+            {
+                printf("test_nbit11: Wrong data at %d, out (%lu)%lu in (%lu)%lu\n", i, (unsigned long) outbuf[i], (unsigned long) test_out, (unsigned long) inbuf[i], (unsigned long) test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%u)%u in (%u)%u\n", i, outbuf[i], test_out, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+static void
+test_nbit12(int32 fid)
+{
+    int32       aid1;
+    uint16      ref1;
+    int i;
+    int32       ret;
+    intn        errors = 0;
+    model_info  m_info;
+    comp_info   c_info;
+    int32      *outbuf, *inbuf;
+    int32       test_out, test_in;
+    uint8      *convbuf;
+
+    outbuf = (int32 *) HDmalloc(NBIT_SIZE12 * sizeof(int32));
+    inbuf = (int32 *) HDmalloc(NBIT_SIZE12 * sizeof(int32));
+    convbuf = (uint8 *) HDmalloc(NBIT_SIZE12 * (size_t)DFKNTsize(DFNT_INT32));
+
+    for (i = 0; i < NBIT_SIZE12; i++)   /* fill with pseudo-random data */
+        outbuf[i] = (((i * 300001) % ((int32) 4 * 256 * 256 * 256)) - ((int32) 2 * 256 * 256 * 256)) << ((NBIT_OFF10 - NBIT_BITS10) + 1);
+
+    ref1 = Hnewref(fid);
+    CHECK_VOID(ref1, 0, "Hnewref");
+
+    MESSAGE(5, printf("Create a new element as a signed 32-bit n-bit element\n");
+        );
+    c_info.nbit.nt = DFNT_INT32;
+    c_info.nbit.sign_ext = TRUE;
+    c_info.nbit.fill_one = TRUE;
+    c_info.nbit.start_bit = NBIT_OFF12;
+    c_info.nbit.bit_len = NBIT_BITS12;
+    aid1 = HCcreate(fid, NBIT_TAG12, ref1, COMP_MODEL_STDIO, &m_info,
+                    COMP_CODE_NBIT, &c_info);
+    CHECK_VOID(aid1, FAIL, "HCcreate");
+
+    ret = DFKconvert(outbuf, convbuf, DFNT_INT32, NBIT_SIZE12, DFACC_WRITE, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    ret = Hwrite(aid1, NBIT_SIZE12 * DFKNTsize(DFNT_INT32), convbuf);
+    if (ret != NBIT_SIZE12 * DFKNTsize(DFNT_INT32))
+      {
+          fprintf(stderr, "ERROR(%d): Hwrite returned the wrong length: %d\n", __LINE__, (int) ret);
+          HEprint(stdout, 0);
+          errors++;
+      }
+
+    ret = Hendaccess(aid1);
+    CHECK_VOID(ret, FAIL, "Hendaccess");
+
+    MESSAGE(5, printf("Verifying data\n");
+        );
+
+    HDmemset(convbuf, 0, DFKNTsize(DFNT_INT32) * NBIT_SIZE12);
+
+    ret = Hgetelement(fid, NBIT_TAG12, (uint16) ref1, convbuf);
+    if (ret != NBIT_SIZE12 * DFKNTsize(DFNT_INT32))
+      {
+          HEprint(stderr, 0);
+          fprintf(stderr, "ERROR: (%d) Hgetelement returned the wrong length: %d\n", __LINE__, (int) ret);
+          errors++;
+      }
+
+    ret = DFKconvert(convbuf, inbuf, DFNT_INT32, NBIT_SIZE12, DFACC_READ, 0, 0);
+    CHECK_VOID(ret, FAIL, "DFKconvert");
+
+    for (i = 0; i < NBIT_SIZE12; i++)
+      {
+          test_out = (int32)(((uintn)outbuf[i] | (uintn)NBIT_MASK12A) & (uintn)NBIT_MASK12B);
+          test_in = (int32)((uintn)inbuf[i] & (uintn)NBIT_MASK12B);
+#ifndef TESTING
+          if ((int32) test_in != (int32) test_out)
+            {
+                printf("test_nbit12: Wrong data at %d, out (%ld)%ld in (%ld)%ld\n", i, (long) outbuf[i], (long) test_out, (long) inbuf[i], (long) test_in);
+                errors++;
+            }
+#else
+          printf("data at %d, out (%d)%d in (%d)%d\n", i, outbuf[i], test_out, inbuf[i], test_in);
+#endif
+      }
+    HDfree(outbuf);
+    HDfree(inbuf);
+    HDfree(convbuf);
+    num_errs += errors;
+}
+
+void
+test_nbit(void)
+{
+    int32       fid;
+    int32       ret;
+
+    MESSAGE(5, printf("Creating a file %s\n", TESTFILE_NAME);
+        );
+    fid = Hopen(TESTFILE_NAME, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    test_nbit1(fid);    /* basic uint8 test */
+    test_nbit2(fid);    /* basic int8 test */
+    test_nbit3(fid);    /* basic uint16 test */
+    test_nbit4(fid);    /* basic int16 test */
+    test_nbit5(fid);    /* basic uint32 test */
+    test_nbit6(fid);    /* basic int32 test */
+
+    test_nbit7(fid);    /* advanced uint8 with fill-ones test */
+    test_nbit8(fid);    /* advanced int8 with fill-ones test */
+    test_nbit9(fid);    /* advanced uint16 with fill-ones test */
+    test_nbit10(fid);   /* advanced int16 with fill-ones test */
+    test_nbit11(fid);   /* advanced uint32 with fill-ones test */
+    test_nbit12(fid);   /* advanced int32 with fill-ones test */
+
+    MESSAGE(5, printf("Closing the files\n");
+        );
+    ret = Hclose(fid);
+    CHECK_VOID(ret, FAIL, "Hclose");
+}
diff --git a/hdf/test/rig.c b/hdf/test/rig.c
new file mode 100644
index 0000000..aa16f5e
--- /dev/null
+++ b/hdf/test/rig.c
@@ -0,0 +1,2007 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5830 $";
+#endif
+
+/* $Id: rig.c 5830 2012-07-19 09:08:48Z bmribler $ */
+
+#include "tproto.h"
+
+#define XSIZE 13
+#define YSIZE 15
+#define TESTFILE "tdf24.hdf"
+
+#define JPEGX   46
+#define JPEGY   23
+#define NCOMPS  3
+#define JPEGFILE "tjpeg.hdf"
+#define NONHDF_JPEGFILE "tnonhdf_jpeg.hdf"
+
+static const uint8  jpeg_8bit_orig[JPEGY][JPEGX] =
+{
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 201, 201, 201, 200, 200, 200, 200, 200, 200, 201, 202, 204, 206, 208, 208, 206, 202, 201, 200, 200, 204, 210, 212, 214, 212, 206, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 201, 202, 204, 203, 201, 202, 200, 199, 200, 202, 202, 203, 204, 207, 210, 213, 218, 222, 209, 205, 207, 209, 212, 215, 220, 225, 203, 212, 216, 218, 221, 223, 201, 201, 200, 200, 200, 200, 201, 200, 200, 201, 201},
+    {200, 200, 199, 200, 200, 201, 203, 206, 207, 206, 202, 197, 193, 193, 193, 192, 193, 199, 204, 205, 210, 219, 214, 193, 213, 225, 209, 196, 206, 222, 204, 208, 211, 121, 127, 229, 206, 196, 198, 207, 211, 212, 214, 215, 211, 196},
+    {200, 201, 200, 200, 199, 200, 200, 198, 198, 199, 202, 207, 209, 211, 195, 180, 182, 182, 170, 111, 39, 71, 58, 64, 69, 73, 72, 82, 92, 213, 83, 73, 126, 111, 89, 92, 209, 197, 198, 201, 81, 51, 56, 55, 210, 208},
+    {54, 53, 54, 55, 53, 51, 56, 55, 50, 54, 53, 49, 54, 55, 64, 66, 63, 105, 78, 51, 59, 39, 49, 45, 50, 66, 58, 67, 67, 71, 73, 87, 68, 80, 94, 113, 67, 202, 194, 90, 42, 39, 59, 43, 44, 58},
+    {54, 52, 51, 53, 55, 56, 53, 57, 55, 57, 51, 51, 53, 50, 46, 50, 55, 51, 45, 68, 66, 63, 67, 50, 57, 38, 47, 56, 62, 65, 65, 87, 74, 110, 59, 63, 45, 47, 98, 40, 41, 199, 199, 170, 109, 43},
+    {198, 198, 200, 201, 199, 203, 202, 201, 199, 197, 197, 192, 190, 190, 191, 195, 202, 153, 101, 197, 61, 69, 138, 182, 154, 202, 154, 73, 76, 71, 83, 83, 150, 231, 203, 179, 49, 53, 47, 162, 208, 203, 185, 199, 203, 83},
+    {199, 200, 204, 202, 202, 200, 199, 197, 195, 198, 200, 202, 207, 211, 216, 219, 214, 199, 193, 192, 195, 195, 199, 205, 207, 218, 229, 196, 138, 121, 116, 213, 233, 197, 207, 211, 212, 215, 216, 216, 199, 197, 199, 201, 209, 211},
+    {200, 201, 201, 202, 201, 201, 201, 201, 203, 206, 206, 207, 206, 201, 202, 202, 203, 202, 203, 205, 208, 211, 214, 221, 225, 209, 211, 213, 217, 220, 224, 225, 200, 200, 200, 201, 207, 209, 202, 200, 201, 201, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 201, 202, 203, 201, 200, 200, 200, 200, 200, 200, 200, 203, 209, 212, 214, 214, 211, 203, 200, 200, 200, 200, 202, 204, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200},
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}
+};
+
+static const uint8  jpeg_8bit_j80[JPEGY][JPEGX] =
+{
+    {200, 200, 200, 200, 200, 200, 200, 200, 202, 202, 201, 201, 201, 200, 200, 200, 201, 201, 200, 200, 200, 201, 202, 202, 202, 202, 201, 200, 200, 200, 200, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 199, 200, 200, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 200, 200, 201, 201, 201, 200, 200, 201, 201, 201, 200, 199, 199, 199, 199, 200, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 202, 202, 202, 201, 200, 199, 202, 202, 202, 202, 202, 200, 199, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 201, 200, 200, 200, 199, 199, 200, 200, 200, 201, 201, 200, 200, 200, 200, 200, 201, 201, 201, 200, 200, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 198, 198, 198, 199, 199, 198, 198, 198, 199, 200, 201, 197, 197, 197, 198, 198, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 200, 200, 201, 202, 202, 203, 201, 200, 199, 198, 199, 201, 204, 205, 203, 202, 200, 199, 198, 200, 202, 203, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 201, 202, 203, 205, 207, 208, 209, 205, 203, 201, 200, 202, 205, 208, 211, 214, 211, 206, 202, 200, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {199, 199, 198, 199, 200, 202, 204, 205, 202, 200, 197, 198, 201, 204, 205, 205, 220, 204, 207, 222, 225, 201, 206, 213, 205, 218, 219, 224, 222, 198, 222, 208, 222, 208, 235, 201, 189, 204, 198, 202, 199, 201, 209, 192, 192, 217}, 
+    {200, 200, 199, 199, 200, 201, 202, 203, 210, 208, 205, 203, 201, 197, 191, 186, 170, 212, 216, 191, 222, 217, 218, 185, 216, 226, 200, 193, 207, 232, 193, 221, 210, 124, 127, 218, 223, 192, 197, 207, 207, 209, 210, 220, 209, 184}, 
+    {202, 201, 201, 200, 200, 200, 201, 201, 196, 197, 200, 203, 203, 200, 195, 191, 196, 180, 168, 123, 34, 66, 56, 74, 57, 83, 73, 81, 94, 221, 72, 64, 120, 119, 83, 100, 207, 190, 198, 198, 94, 44, 57, 50, 213, 215}, 
+    {54, 54, 54, 53, 53, 54, 54, 54, 49, 51, 55, 59, 62, 63, 63, 62, 54, 110, 65, 43, 69, 40, 54, 36, 53, 67, 57, 65, 66, 61, 94, 83, 83, 69, 102, 99, 64, 214, 195, 90, 28, 46, 63, 51, 43, 57}, 
+    {52, 52, 53, 54, 54, 55, 55, 55, 56, 54, 51, 48, 47, 46, 48, 49, 56, 63, 48, 72, 67, 55, 51, 65, 50, 48, 46, 70, 49, 67, 63, 86, 59, 107, 60, 73, 40, 44, 102, 36, 40, 218, 192, 165, 101, 44}, 
+    {198, 199, 200, 201, 202, 202, 202, 202, 199, 197, 194, 190, 188, 190, 194, 198, 196, 151, 88, 202, 61, 71, 148, 169, 165, 188, 139, 77, 86, 70, 81, 84, 163, 226, 206, 184, 52, 46, 48, 165, 204, 189, 179, 213, 208, 79}, 
+    {199, 200, 201, 202, 202, 201, 200, 199, 201, 203, 204, 205, 206, 209, 214, 218, 218, 198, 195, 199, 182, 201, 202, 206, 201, 228, 240, 191, 131, 121, 110, 221, 211, 208, 207, 198, 213, 231, 204, 220, 197, 211, 207, 194, 207, 213}, 
+    {201, 202, 202, 203, 202, 200, 199, 197, 199, 202, 206, 206, 204, 202, 202, 203, 205, 195, 210, 199, 211, 220, 210, 224, 224, 204, 215, 205, 227, 218, 229, 220, 203, 201, 199, 202, 206, 206, 195, 205, 203, 194, 202, 197, 210, 190}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 203, 206, 210, 213, 213, 210, 206, 203, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 198, 199, 201, 202, 202, 201, 199, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 198, 197, 197, 198, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 202, 201, 200, 199, 199, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 199, 199, 199, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 198, 199, 200, 201, 201, 200, 199, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 202, 202, 202, 202, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200} 
+};
+
+static const uint8  jpeg_8bit_j30[JPEGY][JPEGX] =
+{
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {202, 202, 202, 202, 202, 202, 202, 202, 196, 196, 197, 198, 200, 201, 202, 202, 203, 206, 220, 234, 226, 203, 192, 196, 226, 219, 212, 213, 219, 222, 219, 214, 213, 224, 225, 214, 206, 207, 207, 202, 213, 205, 195, 188, 190, 199}, 
+    {203, 203, 203, 203, 203, 203, 203, 203, 221, 219, 214, 207, 200, 193, 188, 185, 186, 206, 207, 186, 187, 214, 229, 222, 219, 205, 195, 203, 219, 221, 203, 183, 192, 141, 135, 187, 212, 183, 168, 185, 208, 218, 230, 234, 226, 209}, 
+    {203, 203, 203, 203, 203, 203, 203, 203, 207, 207, 207, 207, 207, 207, 207, 207, 170, 194, 165, 90, 57, 75, 72, 37, 99, 84, 79, 97, 124, 132, 112, 87, 128, 88, 84, 143, 202, 215, 201, 193, 67, 50, 51, 97, 167, 215}, 
+    {53, 53, 53, 53, 53, 53, 53, 53, 44, 46, 49, 53, 57, 61, 64, 66, 74, 93, 87, 54, 35, 41, 36, 17, 40, 34, 35, 49, 71, 84, 82, 75, 54, 92, 90, 63, 100, 176, 178, 120, 62, 60, 57, 54, 53, 54}, 
+    {53, 53, 53, 53, 53, 53, 53, 53, 61, 60, 57, 53, 48, 44, 41, 40, 63, 48, 53, 73, 72, 55, 64, 92, 76, 78, 75, 63, 51, 53, 70, 87, 71, 125, 117, 41, 10, 50, 67, 38, 38, 120, 193, 179, 97, 32}, 
+    {203, 203, 203, 203, 203, 203, 203, 203, 199, 199, 199, 199, 199, 199, 199, 199, 191, 141, 120, 133, 117, 79, 93, 144, 149, 151, 138, 101, 60, 46, 66, 92, 181, 178, 176, 154, 98, 57, 82, 137, 223, 239, 247, 222, 169, 112}, 
+    {203, 203, 203, 203, 203, 203, 203, 203, 184, 187, 192, 198, 205, 212, 217, 220, 228, 206, 197, 206, 204, 197, 218, 253, 227, 228, 216, 186, 154, 143, 158, 178, 233, 209, 215, 238, 214, 170, 186, 244, 203, 167, 141, 160, 208, 240}, 
+    {202, 202, 202, 202, 202, 202, 202, 202, 209, 208, 208, 206, 205, 204, 203, 203, 184, 203, 212, 205, 202, 209, 210, 202, 219, 220, 218, 212, 208, 212, 225, 237, 192, 198, 200, 200, 207, 215, 209, 196, 180, 208, 233, 225, 197, 182}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 206, 206, 206, 206, 206, 206, 206, 206, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 205, 205, 205, 205, 205, 205, 205, 205, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 204, 204, 204, 204, 204, 204, 204, 204, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 203, 203, 203, 203, 203, 203, 203, 203, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 202, 202, 202, 202, 202, 202, 202, 202, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, 
+    {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199} 
+};
+
+static const uint8  jpeg_8bit_j75[JPEGY][JPEGX] =
+{
+    {200, 200, 200, 200, 200, 200, 200, 200, 198, 198, 198, 199, 199, 200, 200, 200, 202, 202, 200, 199, 199, 199, 199, 200, 199, 199, 200, 201, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 200, 200, 200, 200, 200, 200, 202, 202, 201, 201, 200, 200, 200, 200, 201, 201, 202, 202, 201, 201, 200, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 200, 200, 200, 200, 200, 200, 201, 202, 202, 202, 202, 201, 200, 200, 203, 203, 202, 202, 201, 200, 200, 199, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 199, 199, 200, 201, 202, 202, 201, 200, 199, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 199, 199, 198, 198, 198, 198, 198, 198, 199, 199, 200, 200, 200, 199, 199, 199, 199, 198, 198, 199, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 198, 198, 198, 199, 199, 200, 200, 200, 200, 200, 199, 199, 199, 200, 201, 202, 201, 200, 199, 198, 198, 200, 201, 203, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 198, 199, 199, 201, 202, 203, 204, 204, 204, 202, 200, 199, 200, 202, 204, 206, 207, 205, 203, 200, 199, 200, 201, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 199, 200, 201, 202, 204, 206, 207, 207, 207, 205, 202, 200, 200, 203, 207, 210, 213, 210, 207, 203, 201, 200, 200, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {202, 201, 200, 199, 200, 201, 203, 204, 202, 199, 196, 196, 200, 203, 203, 202, 205, 222, 189, 234, 214, 209, 216, 203, 204, 212, 224, 210, 226, 204, 214, 215, 219, 218, 214, 203, 200, 207, 189, 209, 194, 211, 188, 199, 211, 185}, 
+    {202, 201, 200, 200, 200, 202, 203, 204, 212, 208, 204, 201, 199, 195, 190, 186, 186, 215, 205, 196, 218, 218, 206, 197, 223, 224, 188, 217, 204, 225, 195, 205, 211, 118, 158, 234, 196, 204, 194, 209, 208, 210, 216, 224, 211, 194}, 
+    {198, 198, 198, 197, 198, 199, 200, 200, 199, 199, 200, 202, 204, 203, 200, 197, 176, 184, 165, 126, 21, 66, 63, 65, 66, 68, 78, 78, 89, 200, 87, 66, 117, 120, 65, 94, 212, 196, 206, 197, 80, 49, 56, 45, 206, 205}, 
+    {54, 54, 54, 54, 55, 55, 56, 56, 49, 50, 53, 57, 60, 62, 62, 62, 63, 91, 80, 31, 78, 53, 41, 53, 63, 64, 48, 65, 75, 79, 80, 89, 83, 90, 90, 109, 76, 202, 178, 94, 41, 52, 47, 58, 50, 65}, 
+    {54, 54, 55, 55, 56, 56, 56, 56, 59, 57, 55, 51, 48, 46, 46, 46, 62, 67, 49, 72, 82, 42, 55, 61, 42, 30, 65, 48, 66, 64, 53, 82, 53, 115, 63, 58, 46, 52, 86, 43, 34, 200, 200, 149, 103, 61}, 
+    {197, 197, 198, 199, 200, 199, 199, 199, 197, 197, 196, 194, 192, 193, 196, 199, 187, 139, 105, 206, 44, 86, 158, 165, 167, 210, 135, 91, 55, 64, 104, 85, 172, 219, 206, 182, 36, 55, 59, 163, 211, 188, 208, 207, 212, 63}, 
+    {199, 200, 201, 203, 203, 203, 202, 201, 192, 196, 200, 203, 205, 209, 214, 218, 237, 203, 178, 202, 187, 178, 206, 212, 202, 216, 224, 204, 133, 129, 121, 199, 221, 204, 209, 216, 207, 206, 228, 202, 183, 218, 188, 176, 208, 219}, 
+    {198, 199, 201, 202, 203, 202, 201, 200, 202, 205, 209, 208, 204, 201, 201, 202, 198, 195, 207, 203, 219, 218, 210, 215, 226, 210, 214, 214, 211, 226, 201, 238, 208, 188, 212, 192, 209, 217, 199, 201, 209, 192, 207, 206, 207, 195}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 202, 206, 211, 215, 215, 211, 206, 202, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 198, 199, 201, 203, 203, 201, 199, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 201, 200, 199, 198, 198, 199, 200, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 203, 202, 201, 199, 199, 201, 202, 203, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 198, 198, 198, 199, 199, 198, 198, 198, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 197, 198, 199, 200, 200, 199, 198, 197, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, 
+    {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 202, 202, 202, 202, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200} 
+};
+
+ /* const uint8  jpeg_24bit_orig[JPEGY][JPEGX][3] =
+ */ 
+const uint8  jpeg_24bit_orig[JPEGY*JPEGX*3] =
+{
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 99, 0, 255, 99, 0, 255, 99, 0, 255, 103, 0, 255, 103, 0,
+    255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 99, 0, 255, 95, 0, 255, 87, 0, 255, 79, 0, 255,
+    71, 0, 255, 71, 0, 255, 79, 0, 255, 95, 0, 255, 99, 0, 255, 103, 0, 255, 103, 0, 255, 87, 0, 255, 63, 0,
+    255, 55, 0, 255, 47, 0, 255, 55, 0, 255, 79, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 99, 0, 255, 95, 0, 255, 87, 0, 255, 91, 0, 255, 99, 0, 255, 95, 0, 255, 103, 0,
+    255, 107, 0, 255, 103, 0, 255, 95, 0, 255, 95, 0, 255, 91, 0, 255, 87, 0, 255, 75, 0, 255, 63, 0, 255,
+    51, 0, 255, 31, 0, 255, 15, 0, 255, 67, 0, 255, 83, 0, 255, 75, 0, 255, 67, 0, 255, 55, 0, 255, 43, 0,
+    255, 23, 0, 255, 3, 0, 255, 91, 0, 255, 55, 0, 255, 39, 0, 255, 31, 0, 255, 19, 0, 255, 11, 0, 255, 99, 0,
+    255, 99, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 99, 0, 255, 103, 0, 255, 103, 0,
+    255, 99, 0, 255, 99, 0, 255, 103, 0, 255, 103, 0, 255, 107, 0, 255, 103, 0, 255, 103, 0, 255, 99, 0,
+    255, 91, 0, 255, 79, 0, 255, 75, 0, 255, 79, 0, 255, 95, 0, 255, 115, 0, 255, 131, 0, 255, 131, 0, 255,
+    131, 0, 255, 135, 0, 255, 131, 0, 255, 107, 0, 255, 87, 0, 255, 83, 0, 255, 63, 0, 255, 27, 0, 255, 47,
+    0, 255, 131, 0, 255, 51, 0, 255, 3, 0, 255, 67, 0, 255, 119, 0, 255, 79, 0, 255, 15, 0, 255, 87, 0, 255,
+    71, 0, 255, 59, 0, 91, 255, 163, 115, 255, 139, 241, 0, 0, 255, 79, 0, 255, 119, 0, 255, 111, 0, 255,
+    75, 0, 255, 59, 0, 255, 55, 0, 255, 47, 0, 255, 43, 0, 255, 59, 0, 255, 119, 0, 255, 103, 0, 255, 99, 0,
+    255, 103, 0, 255, 103, 0, 255, 107, 0, 255, 103, 0, 255, 103, 0, 255, 111, 0, 255, 111, 0, 255, 107, 0,
+    255, 95, 0, 255, 75, 0, 255, 67, 0, 255, 59, 0, 255, 123, 0, 255, 183, 0, 255, 175, 0, 255, 175, 0, 255,
+    223, 0, 51, 255, 203, 0, 23, 255, 0, 151, 255, 0, 99, 255, 0, 123, 255, 0, 143, 255, 0, 159, 255, 0,
+    155, 255, 0, 195, 255, 0, 235, 255, 255, 51, 0, 0, 199, 255, 0, 159, 255, 111, 255, 143, 51, 255, 203,
+    0, 223, 255, 0, 235, 255, 255, 67, 0, 255, 115, 0, 255, 111, 0, 255, 99, 0, 0, 191, 255, 0, 71, 255, 0,
+    91, 255, 0, 87, 255, 255, 63, 0, 255, 71, 0, 0, 83, 255, 0, 79, 255, 0, 83, 255, 0, 87, 255, 0, 79, 255,
+    0, 71, 255, 0, 91, 255, 0, 87, 255, 0, 67, 255, 0, 83, 255, 0, 79, 255, 0, 63, 255, 0, 83, 255, 0, 87,
+    255, 0, 123, 255, 0, 131, 255, 0, 119, 255, 27, 255, 227, 0, 179, 255, 0, 71, 255, 0, 103, 255, 0, 23,
+    255, 0, 63, 255, 0, 47, 255, 0, 67, 255, 0, 131, 255, 0, 99, 255, 0, 135, 255, 0, 135, 255, 0, 151, 255,
+    0, 159, 255, 0, 215, 255, 0, 139, 255, 0, 187, 255, 0, 243, 255, 59, 255, 195, 0, 135, 255, 255, 95, 0,
+    255, 127, 0, 0, 227, 255, 0, 35, 255, 0, 23, 255, 0, 103, 255, 0, 39, 255, 0, 43, 255, 0, 99, 255, 0, 83,
+    255, 0, 75, 255, 0, 71, 255, 0, 79, 255, 0, 87, 255, 0, 91, 255, 0, 79, 255, 0, 95, 255, 0, 87, 255, 0,
+    95, 255, 0, 71, 255, 0, 71, 255, 0, 79, 255, 0, 67, 255, 0, 51, 255, 0, 67, 255, 0, 87, 255, 0, 71, 255,
+    0, 47, 255, 0, 139, 255, 0, 131, 255, 0, 119, 255, 0, 135, 255, 0, 67, 255, 0, 95, 255, 0, 19, 255, 0,
+    55, 255, 0, 91, 255, 0, 115, 255, 0, 127, 255, 0, 127, 255, 0, 215, 255, 0, 163, 255, 47, 255, 207, 0,
+    103, 255, 0, 119, 255, 0, 47, 255, 0, 55, 255, 0, 255, 255, 0, 27, 255, 0, 31, 255, 255, 107, 0, 255,
+    107, 0, 255, 223, 0, 43, 255, 211, 0, 39, 255, 255, 111, 0, 255, 111, 0, 255, 103, 0, 255, 99, 0, 255,
+    107, 0, 255, 91, 0, 255, 95, 0, 255, 99, 0, 255, 107, 0, 255, 115, 0, 255, 115, 0, 255, 135, 0, 255,
+    143, 0, 255, 143, 0, 255, 139, 0, 255, 123, 0, 255, 95, 0, 219, 255, 35, 11, 255, 243, 255, 115, 0, 0,
+    111, 255, 0, 143, 255, 159, 255, 95, 255, 175, 0, 223, 255, 31, 255, 95, 0, 223, 255, 31, 0, 159, 255,
+    0, 171, 255, 0, 151, 255, 0, 199, 255, 0, 199, 255, 207, 255, 47, 233, 0, 0, 255, 91, 0, 255, 187, 0, 0,
+    63, 255, 0, 79, 255, 0, 55, 255, 255, 255, 0, 255, 71, 0, 255, 91, 0, 255, 163, 0, 255, 107, 0, 255, 91,
+    0, 0, 199, 255, 255, 107, 0, 255, 103, 0, 255, 87, 0, 255, 95, 0, 255, 95, 0, 255, 103, 0, 255, 107, 0,
+    255, 115, 0, 255, 123, 0, 255, 111, 0, 255, 103, 0, 255, 95, 0, 255, 75, 0, 255, 59, 0, 255, 39, 0, 255,
+    27, 0, 255, 47, 0, 255, 107, 0, 255, 131, 0, 255, 135, 0, 255, 123, 0, 255, 123, 0, 255, 107, 0, 255,
+    83, 0, 255, 75, 0, 255, 31, 0, 241, 0, 0, 255, 119, 0, 159, 255, 95, 91, 255, 163, 71, 255, 183, 255,
+    51, 0, 224, 0, 0, 255, 115, 0, 255, 75, 0, 255, 59, 0, 255, 55, 0, 255, 43, 0, 255, 39, 0, 255, 39, 0,
+    255, 107, 0, 255, 115, 0, 255, 107, 0, 255, 99, 0, 255, 67, 0, 255, 59, 0, 255, 103, 0, 255, 99, 0, 255,
+    99, 0, 255, 95, 0, 255, 99, 0, 255, 99, 0, 255, 99, 0, 255, 99, 0, 255, 91, 0, 255, 79, 0, 255, 79, 0,
+    255, 75, 0, 255, 79, 0, 255, 99, 0, 255, 95, 0, 255, 95, 0, 255, 91, 0, 255, 95, 0, 255, 91, 0, 255, 83,
+    0, 255, 71, 0, 255, 59, 0, 255, 47, 0, 255, 19, 0, 255, 3, 0, 255, 67, 0, 255, 59, 0, 255, 51, 0, 255, 35,
+    0, 255, 23, 0, 255, 7, 0, 255, 3, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 99, 0, 255, 75, 0, 255,
+    67, 0, 255, 95, 0, 255, 103, 0, 255, 99, 0, 255, 99, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103,
+    0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 99, 0, 255, 95, 0, 255, 91, 0,
+    255, 99, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0,
+    255, 91, 0, 255, 67, 0, 255, 55, 0, 255, 47, 0, 255, 47, 0, 255, 59, 0, 255, 91, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 95, 0, 255, 87, 0, 255, 95, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255,
+    103, 0, 255, 103, 0
+};
+
+static const uint8  jpeg_24bit_j80[JPEGY][JPEGX][3] =
+{
+    252, 106, 0, 252, 106, 0, 252, 106, 0, 252, 106, 0, 253, 105, 0, 253, 105, 0, 255, 104, 0, 
+    255, 104, 0, 255, 105, 0, 255, 105, 0, 255, 105, 0, 255, 104, 0, 255, 104, 0, 255, 103, 0, 
+    255, 102, 0, 252, 106, 0, 237, 111, 0, 235, 114, 0, 246, 111, 0, 248, 111, 0, 241, 114, 0, 
+    243, 111, 0, 251, 103, 3, 255, 99, 4, 255, 105, 7, 255, 106, 4, 248, 110, 1, 250, 108, 0, 
+    255, 99, 1, 255, 97, 6, 255, 101, 13, 251, 104, 9, 251, 106, 0, 248, 108, 0, 245, 109, 1, 
+    239, 110, 6, 235, 111, 11, 234, 111, 17, 239, 107, 22, 245, 107, 9, 255, 106, 0, 
+    255, 105, 0, 255, 102, 0, 255, 101, 0, 255, 101, 0, 255, 101, 0, 
+
+    252, 105, 0, 252, 105, 0, 252, 105, 0, 252, 105, 0, 252, 105, 0, 253, 105, 0, 253, 105, 0, 
+    253, 105, 0, 253, 102, 0, 253, 102, 0, 254, 101, 0, 254, 101, 0, 255, 102, 0, 255, 102, 0, 
+    255, 101, 0, 253, 105, 0, 245, 109, 0, 243, 109, 0, 247, 105, 0, 248, 104, 0, 246, 105, 0, 
+    251, 106, 1, 255, 104, 4, 255, 105, 5, 251, 98, 0, 248, 102, 0, 246, 105, 0, 251, 105, 0, 
+    255, 101, 0, 255, 100, 2, 254, 104, 9, 251, 105, 6, 252, 106, 0, 252, 106, 0, 253, 105, 0, 
+    251, 105, 4, 246, 106, 9, 244, 106, 15, 245, 105, 20, 251, 104, 11, 255, 104, 0, 
+    255, 104, 0, 255, 102, 0, 255, 102, 0, 255, 104, 0, 255, 105, 0, 
+
+    251, 105, 4, 251, 105, 4, 251, 105, 4, 251, 105, 4, 251, 105, 4, 252, 104, 4, 252, 104, 4, 
+    252, 104, 4, 252, 103, 3, 253, 104, 4, 253, 104, 4, 253, 104, 4, 253, 104, 4, 254, 105, 5, 
+    254, 105, 5, 255, 105, 2, 255, 105, 0, 255, 103, 0, 255, 102, 0, 255, 99, 0, 255, 97, 1, 
+    255, 98, 3, 255, 102, 4, 255, 105, 1, 251, 104, 0, 251, 107, 0, 255, 108, 0, 255, 107, 0, 
+    255, 104, 0, 255, 104, 0, 250, 105, 0, 247, 105, 0, 253, 106, 0, 255, 103, 0, 255, 96, 0, 
+    255, 94, 4, 255, 95, 6, 255, 98, 9, 255, 98, 17, 255, 99, 13, 255, 99, 2, 255, 100, 0, 
+    255, 103, 4, 248, 106, 8, 241, 109, 9, 237, 111, 9, 
+
+    252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 253, 104, 4, 252, 104, 4, 253, 104, 4, 
+    253, 104, 4, 255, 106, 6, 255, 106, 6, 255, 106, 6, 254, 105, 5, 254, 105, 5, 253, 104, 4, 
+    253, 104, 4, 255, 102, 1, 255, 98, 0, 255, 97, 0, 255, 100, 3, 255, 98, 9, 255, 95, 12, 
+    255, 95, 9, 255, 98, 2, 252, 101, 0, 252, 108, 0, 254, 108, 0, 255, 103, 0, 255, 103, 0, 
+    255, 103, 0, 253, 106, 0, 244, 109, 0, 244, 107, 0, 255, 105, 0, 255, 99, 0, 255, 95, 0, 
+    255, 94, 1, 255, 94, 6, 255, 96, 8, 255, 98, 11, 255, 99, 9, 255, 98, 8, 255, 99, 6, 
+    255, 102, 8, 248, 105, 11, 241, 108, 15, 238, 109, 17, 
+
+    255, 102, 1, 255, 102, 1, 255, 102, 1, 255, 103, 1, 255, 102, 1, 255, 103, 1, 255, 102, 1, 
+    255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 255, 103, 1, 
+    255, 103, 1, 255, 99, 1, 255, 93, 1, 255, 92, 6, 255, 93, 18, 255, 93, 23, 255, 92, 26, 
+    255, 95, 20, 242, 105, 11, 237, 108, 4, 244, 105, 0, 255, 100, 0, 255, 90, 5, 255, 91, 7, 
+    254, 99, 6, 245, 108, 2, 239, 114, 0, 244, 112, 1, 255, 99, 15, 255, 96, 15, 255, 101, 1, 
+    255, 102, 0, 255, 102, 9, 253, 103, 9, 255, 103, 2, 255, 103, 1, 255, 100, 6, 255, 99, 4, 
+    255, 100, 0, 255, 101, 0, 255, 100, 9, 255, 100, 15, 
+
+    255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 255, 101, 1, 
+    255, 101, 1, 255, 102, 1, 255, 102, 1, 255, 103, 2, 255, 103, 2, 255, 104, 3, 255, 105, 3, 
+    255, 105, 4, 255, 104, 5, 255, 100, 11, 255, 97, 16, 255, 94, 19, 255, 93, 22, 255, 95, 21, 
+    254, 102, 19, 239, 115, 15, 238, 120, 14, 248, 108, 10, 255, 100, 11, 255, 88, 16, 
+    255, 89, 15, 255, 100, 11, 244, 107, 3, 240, 111, 0, 245, 107, 0, 255, 98, 18, 255, 96, 18, 
+    255, 103, 1, 251, 106, 0, 248, 105, 9, 246, 106, 8, 248, 108, 0, 251, 107, 0, 255, 103, 4, 
+    255, 101, 4, 255, 101, 0, 255, 100, 0, 255, 99, 4, 255, 98, 9, 
+
+    255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 100, 2, 255, 101, 2, 
+    255, 101, 2, 255, 104, 4, 255, 104, 4, 255, 103, 3, 255, 102, 2, 255, 102, 2, 254, 102, 1, 
+    254, 100, 0, 251, 101, 4, 250, 103, 10, 255, 101, 11, 255, 99, 7, 255, 100, 3, 255, 102, 0, 
+    250, 105, 0, 229, 112, 0, 230, 109, 2, 247, 98, 4, 255, 91, 8, 255, 85, 8, 255, 89, 7, 
+    255, 100, 3, 253, 105, 0, 253, 103, 0, 255, 100, 0, 255, 99, 9, 255, 99, 9, 255, 102, 1, 
+    255, 104, 0, 249, 106, 4, 245, 108, 2, 242, 112, 0, 244, 111, 0, 248, 106, 4, 251, 105, 6, 
+    253, 105, 0, 255, 105, 0, 255, 103, 1, 255, 102, 4, 
+
+    255, 99, 4, 255, 99, 4, 255, 99, 4, 255, 100, 4, 255, 99, 4, 255, 100, 4, 255, 100, 4, 
+    255, 101, 4, 255, 102, 5, 255, 101, 4, 255, 98, 1, 250, 96, 0, 246, 92, 0, 242, 90, 0, 
+    240, 86, 0, 236, 86, 0, 235, 92, 0, 244, 96, 0, 255, 96, 0, 255, 97, 0, 255, 97, 0, 
+    248, 92, 0, 222, 87, 0, 214, 78, 0, 229, 68, 0, 248, 67, 0, 255, 72, 0, 255, 81, 0, 
+    255, 94, 3, 255, 99, 5, 255, 97, 9, 255, 98, 9, 255, 101, 13, 249, 104, 15, 249, 104, 13, 
+    249, 105, 9, 248, 106, 6, 246, 108, 1, 245, 110, 0, 245, 110, 0, 248, 106, 6, 249, 105, 9, 
+    251, 105, 2, 253, 105, 0, 255, 103, 0, 255, 103, 0, 
+
+    255, 98, 7, 255, 98, 6, 255, 98, 6, 255, 99, 6, 255, 94, 2, 252, 89, 0, 252, 89, 0, 
+    253, 93, 0, 254, 94, 0, 254, 95, 1, 255, 96, 2, 254, 97, 2, 253, 96, 1, 250, 96, 0, 
+    250, 93, 0, 246, 93, 0, 234, 86, 0, 229, 71, 0, 249, 64, 0, 247, 51, 0, 222, 30, 0, 
+    255, 73, 0, 255, 83, 0, 242, 72, 0, 241, 67, 0, 243, 64, 0, 242, 60, 0, 228, 41, 0, 
+    219, 28, 0, 255, 83, 26, 246, 56, 8, 223, 52, 0, 197, 60, 0, 174, 54, 0, 185, 64, 0, 
+    233, 105, 30, 239, 101, 10, 251, 105, 4, 255, 110, 10, 248, 94, 0, 249, 98, 7, 255, 111, 25, 
+    239, 83, 0, 255, 105, 13, 255, 99, 0, 255, 100, 0, 
+
+    237, 105, 43, 234, 104, 42, 235, 105, 43, 236, 106, 44, 234, 104, 42, 228, 100, 37, 
+    229, 101, 38, 232, 104, 41, 214, 89, 25, 224, 99, 35, 235, 111, 47, 243, 119, 55, 
+    244, 120, 56, 244, 122, 57, 246, 124, 59, 244, 130, 59, 228, 126, 44, 235, 132, 53, 
+    220, 100, 37, 210, 84, 36, 208, 85, 54, 185, 62, 46, 193, 64, 58, 253, 126, 119, 
+    196, 79, 61, 156, 47, 18, 181, 78, 37, 229, 120, 81, 215, 89, 64, 185, 62, 47, 178, 73, 70, 
+    192, 114, 102, 156, 111, 72, 222, 190, 139, 232, 195, 150, 109, 49, 0, 203, 101, 26, 
+    236, 106, 20, 250, 104, 19, 232, 90, 24, 188, 75, 43, 183, 83, 68, 185, 83, 68, 183, 70, 40, 
+    203, 68, 13, 247, 100, 33, 
+
+    176, 117, 113, 174, 116, 112, 176, 118, 114, 178, 120, 116, 177, 119, 115, 175, 117, 113, 
+    176, 118, 114, 178, 123, 118, 178, 123, 118, 174, 119, 114, 163, 108, 103, 150, 97, 91, 
+    146, 93, 87, 162, 109, 103, 190, 137, 131, 203, 166, 148, 192, 185, 141, 174, 190, 145, 
+    168, 193, 172, 180, 214, 226, 10, 45, 101, 87, 110, 206, 64, 61, 192, 100, 92, 229, 
+    84, 94, 209, 92, 118, 202, 105, 143, 190, 108, 147, 176, 147, 170, 204, 74, 112, 151, 
+    89, 171, 219, 34, 144, 181, 110, 227, 237, 115, 232, 223, 76, 187, 168, 130, 191, 157, 
+    157, 124, 71, 216, 124, 57, 226, 108, 36, 207, 113, 87, 142, 120, 193, 54, 69, 186, 
+    48, 66, 168, 78, 66, 150, 155, 87, 144, 190, 95, 139, 
+
+    91, 67, 91, 89, 65, 89, 90, 66, 90, 93, 69, 93, 93, 69, 93, 92, 68, 92, 92, 70, 93, 
+    95, 73, 96, 96, 74, 97, 95, 73, 96, 92, 68, 92, 85, 63, 86, 83, 61, 84, 93, 71, 94, 
+    113, 91, 114, 119, 113, 123, 85, 113, 91, 133, 192, 174, 82, 171, 185, 4, 111, 165, 
+    0, 108, 211, 0, 58, 198, 13, 72, 238, 0, 40, 205, 11, 77, 217, 47, 127, 240, 0, 95, 181, 
+    32, 134, 208, 33, 129, 206, 13, 135, 212, 0, 168, 243, 12, 203, 255, 0, 143, 162, 
+    44, 194, 192, 86, 226, 213, 123, 220, 209, 91, 110, 116, 155, 123, 124, 199, 145, 119, 
+    188, 145, 154, 43, 40, 143, 10, 34, 166, 49, 83, 180, 21, 42, 125, 57, 44, 134, 99, 70, 163, 
+
+
+    95, 70, 92, 91, 66, 88, 93, 65, 88, 95, 67, 90, 96, 68, 91, 94, 66, 89, 95, 67, 90, 
+    98, 70, 93, 84, 56, 79, 88, 60, 83, 94, 64, 88, 94, 66, 89, 91, 63, 86, 85, 57, 80, 
+    78, 50, 73, 70, 50, 61, 92, 90, 78, 43, 72, 70, 5, 73, 118, 22, 115, 195, 23, 124, 232, 
+    27, 117, 231, 56, 114, 211, 40, 83, 162, 28, 74, 134, 0, 51, 114, 0, 64, 144, 18, 97, 190, 
+    19, 114, 220, 2, 128, 228, 0, 159, 235, 37, 205, 242, 70, 177, 167, 124, 193, 162, 
+    52, 106, 80, 61, 109, 129, 8, 60, 162, 14, 64, 179, 139, 181, 239, 31, 41, 77, 83, 30, 84, 
+    180, 109, 139, 192, 142, 109, 234, 217, 189, 158, 185, 232, 2, 52, 137, 
+
+    183, 122, 117, 178, 117, 112, 178, 115, 110, 180, 117, 112, 181, 118, 113, 179, 116, 111, 
+    179, 116, 111, 181, 118, 113, 191, 126, 122, 190, 125, 121, 191, 126, 122, 196, 131, 127, 
+    205, 137, 134, 207, 139, 136, 205, 137, 134, 199, 136, 127, 173, 116, 96, 249, 217, 204, 
+    181, 186, 205, 123, 151, 190, 64, 97, 150, 88, 110, 159, 206, 203, 230, 181, 160, 175, 
+    255, 230, 238, 133, 110, 126, 235, 230, 255, 88, 111, 165, 83, 137, 201, 57, 137, 198, 
+    59, 159, 208, 87, 166, 183, 202, 217, 184, 99, 76, 24, 165, 128, 84, 207, 177, 185, 
+    56, 58, 159, 43, 62, 180, 53, 75, 133, 235, 218, 236, 186, 84, 80, 227, 96, 50, 243, 136, 30, 
+    189, 124, 30, 131, 128, 121, 117, 145, 182, 
+
+    238, 109, 51, 232, 103, 45, 229, 100, 42, 231, 102, 44, 234, 104, 46, 232, 102, 44, 
+    234, 101, 44, 236, 103, 46, 248, 113, 57, 243, 108, 52, 237, 102, 46, 232, 97, 41, 
+    227, 90, 35, 217, 80, 25, 203, 66, 11, 192, 55, 1, 201, 66, 18, 226, 102, 50, 229, 127, 61, 
+    226, 135, 64, 223, 130, 63, 221, 116, 58, 231, 108, 66, 244, 103, 73, 227, 68, 46, 
+    197, 48, 24, 154, 42, 5, 202, 134, 89, 232, 210, 161, 193, 179, 144, 242, 195, 189, 
+    158, 81, 71, 148, 43, 0, 240, 117, 50, 211, 76, 10, 215, 80, 35, 195, 67, 66, 178, 57, 62, 
+    187, 72, 45, 187, 63, 11, 255, 108, 38, 250, 97, 3, 255, 126, 3, 244, 120, 6, 204, 100, 29, 
+    193, 98, 50, 
+
+    255, 101, 10, 255, 96, 5, 251, 92, 1, 253, 94, 3, 255, 95, 5, 255, 95, 5, 255, 95, 5, 
+    255, 95, 6, 255, 91, 2, 250, 86, 0, 246, 81, 0, 246, 81, 0, 250, 85, 0, 255, 91, 2, 
+    255, 93, 5, 255, 92, 11, 255, 88, 18, 253, 86, 8, 255, 100, 0, 249, 96, 0, 239, 80, 0, 
+    247, 81, 0, 238, 62, 0, 222, 30, 0, 227, 20, 0, 255, 72, 15, 231, 69, 0, 198, 74, 0, 
+    168, 82, 0, 174, 88, 1, 169, 39, 0, 191, 36, 0, 255, 102, 34, 255, 91, 10, 255, 98, 15, 
+    255, 95, 15, 251, 67, 3, 255, 80, 15, 255, 85, 9, 255, 96, 6, 255, 91, 0, 255, 110, 0, 
+    248, 94, 0, 254, 101, 0, 245, 92, 0, 255, 103, 10, 
+
+    255, 104, 6, 255, 104, 6, 255, 103, 5, 255, 102, 4, 255, 101, 3, 253, 99, 1, 253, 99, 1, 
+    254, 97, 0, 255, 101, 4, 255, 101, 4, 255, 101, 4, 255, 101, 4, 255, 101, 4, 255, 101, 4, 
+    255, 101, 4, 255, 100, 6, 250, 86, 0, 245, 80, 0, 232, 73, 0, 226, 67, 0, 230, 69, 0, 
+    240, 77, 0, 254, 86, 0, 255, 93, 6, 255, 95, 12, 255, 94, 10, 255, 96, 4, 245, 99, 0, 
+    235, 103, 2, 237, 104, 9, 248, 102, 19, 255, 101, 19, 255, 101, 9, 255, 101, 6, 255, 101, 4, 
+    255, 100, 4, 255, 99, 9, 255, 99, 9, 255, 100, 6, 255, 101, 2, 255, 102, 0, 255, 103, 0, 
+    255, 104, 0, 255, 104, 0, 255, 104, 1, 255, 103, 2, 
+
+    255, 105, 2, 255, 105, 2, 255, 104, 1, 255, 104, 1, 254, 103, 0, 253, 102, 0, 252, 101, 0, 
+    252, 101, 0, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 104, 6, 255, 103, 5, 255, 100, 2, 255, 99, 1, 255, 99, 1, 
+    255, 102, 4, 255, 106, 8, 255, 109, 10, 255, 102, 3, 255, 101, 2, 255, 99, 0, 255, 99, 0, 
+    255, 99, 0, 255, 100, 0, 255, 102, 2, 255, 103, 3, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 254, 103, 0, 254, 103, 0, 254, 103, 0, 
+    254, 103, 0, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 100, 1, 255, 100, 2, 255, 101, 3, 255, 101, 3, 255, 101, 3, 
+    255, 100, 2, 255, 99, 1, 255, 99, 0, 255, 103, 4, 255, 103, 3, 255, 103, 3, 255, 102, 2, 
+    255, 102, 2, 255, 103, 3, 255, 103, 3, 255, 104, 4, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 103, 4, 255, 102, 3, 255, 99, 1, 255, 99, 0, 255, 98, 0, 
+    255, 99, 0, 255, 100, 1, 255, 101, 1, 255, 103, 3, 255, 103, 3, 255, 104, 4, 255, 104, 4, 
+    255, 104, 4, 255, 104, 4, 255, 103, 3, 255, 103, 3, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    254, 103, 0, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 103, 1, 255, 106, 6, 255, 105, 5, 255, 102, 3, 255, 102, 2, 255, 102, 2, 
+    255, 103, 3, 255, 105, 5, 255, 106, 6, 255, 102, 2, 255, 102, 2, 255, 103, 3, 255, 104, 3, 
+    255, 104, 3, 255, 104, 3, 255, 103, 2, 255, 103, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 251, 97, 0, 252, 98, 0, 255, 100, 0, 255, 101, 1, 255, 102, 2, 
+    255, 101, 1, 254, 100, 0, 253, 99, 0, 255, 101, 1, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 254, 102, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 253, 102, 0, 255, 104, 1, 255, 105, 3, 255, 108, 5, 255, 108, 5, 
+    255, 107, 4, 255, 105, 2, 254, 103, 0, 255, 104, 1, 253, 104, 1, 253, 104, 1, 253, 104, 1, 
+    253, 104, 1, 253, 104, 1, 253, 104, 1, 253, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1, 
+    255, 104, 1, 255, 104, 1, 255, 104, 1, 255, 104, 1 
+};
+
+static const uint8  jpeg_24bit_j30[JPEGY][JPEGX][3] =
+{
+    235, 112, 16, 235, 112, 16, 235, 112, 16, 235, 112, 16, 235, 112, 16, 235, 112, 16, 
+    235, 112, 16, 235, 112, 16, 230, 107, 11, 231, 108, 12, 232, 109, 13, 234, 111, 15, 
+    236, 113, 17, 238, 115, 19, 239, 116, 20, 247, 113, 24, 255, 100, 25, 255, 95, 30, 
+    255, 96, 32, 255, 96, 35, 255, 95, 41, 255, 95, 42, 255, 95, 46, 255, 95, 46, 252, 88, 37, 
+    254, 88, 36, 255, 90, 32, 255, 90, 28, 255, 91, 25, 255, 92, 21, 255, 93, 17, 255, 98, 14, 
+    250, 106, 10, 247, 107, 12, 255, 100, 19, 255, 96, 25, 255, 93, 30, 255, 95, 30, 
+    255, 99, 28, 242, 108, 23, 228, 116, 16, 215, 124, 10, 210, 127, 9, 210, 127, 9, 
+    217, 122, 16, 221, 119, 18, 
+
+    245, 110, 3, 245, 110, 3, 245, 110, 3, 245, 110, 3, 245, 110, 3, 245, 110, 3, 245, 110, 3, 
+    245, 110, 3, 241, 106, 0, 241, 106, 0, 242, 107, 0, 244, 109, 2, 245, 110, 3, 247, 112, 5, 
+    248, 113, 6, 251, 112, 9, 250, 102, 6, 253, 99, 9, 251, 100, 11, 251, 99, 15, 250, 99, 20, 
+    249, 99, 23, 249, 98, 25, 249, 98, 25, 249, 98, 25, 250, 98, 22, 251, 98, 18, 255, 99, 14, 
+    255, 99, 8, 255, 100, 4, 255, 100, 1, 255, 100, 0, 255, 102, 0, 255, 101, 3, 255, 99, 7, 
+    255, 98, 12, 255, 99, 14, 255, 101, 16, 252, 104, 14, 247, 107, 10, 242, 111, 5, 
+    238, 114, 2, 235, 116, 0, 233, 116, 2, 235, 115, 5, 236, 113, 7, 
+
+    255, 104, 0, 255, 104, 0, 255, 104, 0, 255, 104, 0, 255, 104, 0, 255, 104, 0, 255, 104, 0, 
+    255, 104, 0, 255, 100, 0, 255, 100, 0, 255, 101, 0, 255, 102, 0, 255, 103, 0, 255, 104, 0, 
+    255, 105, 0, 255, 109, 0, 243, 110, 0, 238, 112, 0, 236, 113, 0, 236, 112, 0, 235, 112, 0, 
+    235, 111, 0, 235, 111, 0, 235, 111, 0, 241, 117, 0, 242, 116, 0, 243, 115, 0, 244, 116, 0, 
+    245, 115, 0, 245, 114, 0, 246, 114, 0, 255, 107, 0, 255, 94, 0, 255, 90, 0, 255, 97, 0, 
+    255, 104, 0, 247, 112, 0, 242, 115, 0, 246, 113, 0, 255, 108, 0, 255, 99, 0, 255, 94, 0, 
+    255, 92, 0, 255, 94, 0, 255, 100, 0, 255, 103, 0, 
+
+    255, 103, 0, 255, 104, 0, 255, 103, 0, 255, 104, 0, 255, 103, 0, 255, 104, 0, 255, 103, 0, 
+    255, 104, 0, 255, 99, 0, 255, 101, 0, 255, 100, 0, 255, 101, 0, 255, 101, 0, 255, 102, 0, 
+    255, 101, 0, 255, 105, 0, 251, 113, 0, 244, 116, 0, 244, 116, 0, 244, 115, 0, 242, 115, 0, 
+    242, 114, 0, 242, 114, 0, 244, 113, 0, 249, 118, 0, 249, 118, 0, 249, 117, 0, 248, 117, 0, 
+    248, 116, 0, 247, 116, 0, 248, 115, 0, 255, 108, 0, 255, 97, 0, 255, 93, 0, 255, 99, 0, 
+    255, 105, 0, 252, 113, 0, 249, 114, 0, 253, 111, 0, 255, 106, 0, 255, 97, 0, 255, 93, 0, 
+    255, 90, 0, 255, 92, 0, 255, 97, 0, 255, 100, 0, 
+
+    255, 106, 0, 254, 106, 0, 255, 106, 0, 254, 106, 0, 255, 106, 0, 254, 106, 0, 255, 106, 0, 
+    254, 106, 0, 253, 103, 0, 251, 103, 0, 253, 103, 0, 250, 102, 0, 252, 102, 0, 250, 102, 0, 
+    251, 101, 0, 252, 101, 0, 255, 107, 0, 255, 106, 0, 255, 105, 0, 255, 105, 0, 255, 104, 0, 
+    255, 103, 0, 255, 102, 0, 255, 101, 0, 255, 100, 0, 255, 100, 0, 255, 101, 0, 255, 102, 0, 
+    255, 103, 0, 255, 102, 0, 255, 103, 0, 255, 106, 0, 236, 111, 21, 233, 111, 26, 250, 107, 5, 
+    255, 104, 0, 255, 101, 0, 255, 100, 0, 255, 101, 0, 255, 103, 0, 249, 106, 14, 238, 108, 30, 
+    232, 109, 39, 235, 109, 35, 246, 106, 19, 252, 105, 10, 
+
+    250, 107, 5, 250, 107, 5, 250, 107, 5, 250, 107, 5, 250, 107, 5, 250, 107, 5, 250, 107, 5, 
+    250, 107, 5, 248, 105, 3, 247, 104, 2, 246, 103, 1, 245, 102, 0, 244, 101, 0, 243, 100, 0, 
+    242, 99, 0, 246, 98, 0, 255, 103, 0, 255, 101, 0, 255, 99, 0, 255, 98, 0, 255, 97, 0, 
+    255, 96, 3, 255, 94, 7, 255, 94, 9, 255, 87, 2, 255, 88, 0, 255, 90, 0, 255, 94, 0, 
+    255, 95, 0, 255, 98, 0, 255, 101, 0, 252, 107, 0, 222, 119, 18, 217, 120, 25, 235, 112, 16, 
+    253, 105, 7, 255, 98, 0, 255, 96, 0, 255, 97, 3, 255, 102, 9, 242, 108, 19, 229, 113, 26, 
+    224, 115, 30, 226, 114, 28, 240, 109, 21, 247, 106, 18, 
+
+    252, 106, 7, 252, 106, 7, 252, 106, 7, 252, 106, 7, 252, 106, 7, 252, 106, 7, 252, 106, 7, 
+    252, 106, 7, 250, 104, 5, 249, 103, 4, 248, 102, 3, 247, 101, 2, 245, 99, 0, 244, 98, 0, 
+    242, 96, 0, 243, 96, 0, 247, 100, 0, 249, 99, 0, 250, 98, 0, 252, 96, 0, 253, 94, 0, 
+    254, 93, 5, 255, 91, 9, 255, 90, 12, 244, 81, 2, 244, 83, 3, 246, 87, 3, 246, 92, 2, 
+    247, 99, 3, 248, 105, 3, 249, 108, 2, 245, 115, 0, 233, 120, 0, 229, 121, 0, 231, 115, 14, 
+    232, 110, 37, 235, 104, 58, 239, 101, 64, 245, 101, 51, 250, 102, 32, 254, 105, 2, 
+    255, 108, 0, 255, 109, 0, 255, 108, 0, 255, 104, 0, 255, 102, 5, 
+
+    255, 103, 5, 255, 104, 5, 255, 103, 5, 255, 104, 5, 255, 103, 5, 255, 104, 5, 255, 103, 5, 
+    255, 104, 5, 255, 101, 3, 253, 101, 2, 253, 99, 1, 250, 98, 0, 249, 95, 0, 247, 95, 0, 
+    246, 92, 0, 247, 91, 0, 247, 88, 0, 250, 86, 0, 252, 84, 0, 253, 83, 0, 255, 80, 4, 
+    255, 79, 9, 255, 77, 14, 255, 77, 18, 248, 67, 10, 249, 70, 12, 248, 76, 12, 248, 83, 15, 
+    251, 91, 17, 251, 98, 18, 252, 104, 18, 249, 110, 5, 242, 116, 0, 236, 118, 0, 228, 117, 12, 
+    222, 114, 39, 219, 111, 62, 224, 108, 67, 235, 105, 55, 249, 102, 32, 255, 101, 0, 
+    255, 99, 0, 255, 99, 0, 255, 99, 0, 255, 98, 0, 255, 99, 5, 
+
+    255, 97, 0, 255, 97, 0, 255, 97, 0, 255, 97, 0, 255, 97, 0, 255, 97, 0, 255, 97, 0, 
+    255, 97, 0, 245, 82, 0, 255, 96, 0, 255, 111, 10, 255, 114, 13, 255, 106, 5, 255, 98, 0, 
+    255, 96, 0, 255, 95, 1, 255, 84, 4, 255, 62, 0, 245, 31, 0, 234, 18, 0, 255, 36, 0, 
+    255, 66, 26, 255, 71, 38, 255, 56, 29, 255, 80, 55, 255, 35, 10, 225, 6, 0, 231, 21, 0, 
+    254, 53, 11, 255, 64, 16, 244, 57, 4, 224, 55, 0, 204, 62, 0, 204, 82, 0, 164, 52, 0, 
+    208, 103, 0, 255, 160, 52, 219, 108, 3, 217, 87, 0, 255, 128, 37, 255, 100, 20, 255, 93, 18, 
+    255, 88, 19, 255, 91, 20, 255, 97, 19, 255, 99, 18, 
+
+    233, 101, 29, 233, 101, 29, 233, 101, 29, 233, 101, 29, 233, 101, 29, 233, 101, 29, 
+    233, 101, 29, 233, 101, 29, 225, 93, 21, 232, 100, 28, 239, 107, 35, 239, 107, 35, 
+    236, 104, 32, 238, 106, 34, 248, 116, 44, 255, 124, 59, 235, 101, 50, 255, 122, 80, 
+    255, 121, 87, 233, 85, 59, 202, 47, 29, 200, 42, 33, 221, 58, 59, 236, 73, 78, 182, 21, 29, 
+    210, 53, 60, 243, 94, 96, 243, 105, 102, 207, 79, 70, 173, 56, 39, 186, 75, 55, 215, 117, 90, 
+    197, 116, 86, 234, 162, 114, 248, 174, 103, 124, 45, 0, 139, 53, 0, 251, 155, 43, 
+    217, 104, 10, 203, 76, 5, 205, 63, 25, 204, 54, 39, 207, 54, 49, 217, 66, 57, 227, 87, 54, 
+    233, 96, 52, 
+
+    186, 122, 110, 186, 122, 110, 186, 122, 110, 186, 122, 110, 186, 122, 110, 186, 122, 110, 
+    186, 122, 110, 186, 122, 110, 180, 116, 104, 180, 116, 104, 177, 113, 101, 173, 109, 97, 
+    175, 111, 99, 188, 124, 112, 207, 143, 131, 202, 169, 154, 150, 174, 158, 163, 213, 201, 
+    177, 219, 215, 137, 175, 178, 88, 117, 131, 70, 92, 115, 80, 99, 131, 93, 111, 149, 
+    95, 114, 156, 103, 131, 170, 120, 156, 192, 122, 171, 201, 94, 156, 179, 59, 132, 149, 
+    49, 131, 143, 68, 144, 158, 133, 189, 216, 174, 205, 225, 149, 151, 140, 234, 208, 171, 
+    226, 170, 113, 165, 93, 35, 241, 163, 124, 195, 123, 111, 155, 97, 122, 123, 79, 130, 
+    96, 60, 124, 92, 57, 115, 118, 73, 102, 146, 98, 114, 
+
+    91, 68, 94, 89, 69, 94, 91, 68, 94, 89, 69, 94, 91, 68, 94, 89, 69, 94, 91, 68, 94, 
+    89, 69, 94, 84, 61, 87, 78, 58, 83, 74, 51, 77, 69, 49, 74, 75, 52, 78, 85, 65, 90, 
+    103, 80, 106, 86, 104, 124, 53, 149, 161, 34, 166, 178, 27, 152, 172, 5, 123, 151, 
+    0, 99, 138, 0, 88, 138, 0, 75, 136, 0, 60, 127, 0, 96, 165, 0, 87, 155, 0, 94, 158, 
+    0, 124, 182, 9, 154, 207, 17, 175, 220, 30, 198, 237, 60, 212, 249, 38, 146, 182, 
+    39, 114, 145, 184, 230, 254, 118, 136, 158, 83, 71, 91, 193, 165, 187, 150, 117, 148, 
+    135, 107, 147, 74, 60, 111, 72, 68, 127, 66, 74, 136, 63, 72, 131, 61, 65, 113, 61, 62, 106, 
+
+
+    78, 71, 113, 77, 72, 113, 78, 71, 113, 77, 72, 113, 78, 71, 113, 77, 72, 113, 78, 71, 113, 
+    77, 72, 113, 79, 72, 114, 74, 69, 110, 72, 65, 107, 70, 65, 106, 74, 67, 109, 76, 71, 112, 
+    80, 73, 115, 60, 84, 122, 38, 121, 153, 28, 137, 168, 27, 129, 169, 16, 108, 159, 
+    16, 97, 160, 29, 103, 176, 36, 104, 187, 30, 97, 186, 19, 89, 184, 19, 100, 192, 
+    20, 114, 202, 8, 117, 199, 0, 105, 182, 0, 108, 177, 0, 148, 212, 64, 192, 229, 90, 170, 159, 
+    128, 184, 171, 49, 108, 142, 74, 129, 209, 7, 56, 175, 0, 20, 152, 142, 161, 255, 
+    106, 108, 195, 51, 36, 77, 113, 90, 96, 176, 152, 140, 187, 172, 165, 140, 145, 167, 
+    86, 100, 137, 
+
+    172, 124, 136, 171, 125, 136, 172, 124, 136, 171, 125, 136, 172, 124, 136, 171, 125, 136, 
+    172, 124, 136, 171, 125, 136, 185, 137, 149, 181, 135, 146, 179, 131, 143, 179, 133, 144, 
+    182, 134, 146, 179, 133, 144, 172, 124, 136, 149, 123, 132, 108, 126, 128, 135, 170, 172, 
+    162, 190, 201, 147, 165, 187, 126, 132, 166, 135, 134, 178, 169, 161, 218, 195, 186, 249, 
+    176, 171, 238, 150, 155, 221, 131, 151, 212, 128, 163, 219, 114, 166, 214, 84, 151, 193, 
+    60, 138, 174, 69, 133, 142, 206, 228, 189, 64, 71, 30, 118, 131, 139, 135, 151, 202, 
+    90, 105, 196, 58, 61, 164, 49, 33, 122, 225, 187, 246, 150, 90, 102, 200, 129, 107, 
+    241, 170, 128, 233, 173, 136, 183, 149, 140, 145, 124, 129, 
+
+    241, 96, 31, 240, 97, 31, 241, 96, 31, 240, 97, 31, 241, 96, 31, 240, 97, 31, 241, 96, 31, 
+    240, 97, 31, 255, 111, 46, 247, 104, 38, 242, 97, 32, 241, 98, 32, 246, 101, 36, 
+    244, 101, 35, 237, 92, 27, 217, 88, 20, 184, 87, 8, 212, 125, 46, 240, 143, 74, 229, 123, 65, 
+    212, 94, 48, 216, 89, 54, 232, 100, 77, 243, 110, 93, 233, 103, 90, 192, 72, 58, 
+    177, 71, 55, 215, 127, 105, 255, 191, 160, 255, 205, 167, 217, 174, 131, 183, 139, 92, 
+    99, 39, 0, 208, 135, 80, 180, 96, 34, 179, 81, 16, 193, 78, 13, 193, 65, 2, 237, 98, 43, 
+    195, 48, 4, 242, 95, 61, 236, 93, 63, 219, 84, 55, 193, 69, 35, 174, 61, 17, 178, 72, 20, 
+
+
+    255, 91, 0, 255, 91, 0, 255, 91, 0, 255, 91, 0, 255, 91, 0, 255, 91, 0, 255, 91, 0, 
+    255, 91, 0, 255, 97, 0, 255, 86, 0, 255, 74, 0, 255, 73, 0, 255, 80, 0, 255, 83, 0, 
+    255, 79, 0, 248, 76, 0, 254, 98, 0, 249, 100, 0, 247, 90, 0, 250, 87, 0, 255, 92, 3, 
+    255, 91, 9, 242, 58, 0, 204, 19, 0, 217, 35, 0, 214, 41, 0, 220, 57, 0, 223, 72, 1, 
+    202, 66, 0, 173, 48, 0, 162, 46, 0, 169, 58, 0, 227, 114, 46, 244, 122, 49, 242, 104, 6, 
+    230, 75, 0, 255, 96, 0, 255, 78, 0, 236, 47, 0, 255, 117, 18, 255, 99, 30, 255, 94, 44, 
+    255, 94, 53, 255, 100, 51, 255, 107, 34, 254, 104, 19, 
+
+    255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 
+    255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 
+    255, 102, 0, 255, 102, 0, 253, 100, 0, 244, 93, 0, 234, 81, 0, 228, 72, 0, 229, 71, 0, 
+    238, 78, 0, 251, 88, 0, 255, 96, 5, 255, 100, 10, 255, 101, 10, 255, 102, 10, 254, 104, 10, 
+    252, 105, 10, 249, 106, 10, 247, 107, 10, 246, 107, 12, 246, 107, 16, 247, 106, 14, 
+    253, 105, 5, 255, 105, 0, 255, 104, 0, 255, 103, 0, 255, 101, 0, 255, 101, 0, 255, 100, 9, 
+    255, 100, 16, 255, 101, 19, 254, 102, 18, 254, 104, 10, 254, 104, 7, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 111, 8, 255, 106, 3, 249, 98, 0, 243, 92, 0, 243, 92, 0, 
+    249, 98, 0, 255, 106, 3, 255, 111, 8, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 112, 9, 255, 110, 7, 255, 108, 5, 255, 106, 3, 255, 106, 3, 
+    255, 108, 5, 255, 110, 7, 255, 112, 9, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 252, 101, 0, 254, 103, 0, 255, 104, 1, 255, 105, 2, 255, 105, 2, 
+    255, 104, 1, 254, 103, 0, 252, 101, 0, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 247, 96, 0, 250, 99, 0, 253, 102, 0, 255, 104, 1, 255, 104, 1, 
+    253, 102, 0, 250, 99, 0, 247, 96, 0, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 253, 102, 0, 255, 104, 1, 255, 106, 3, 255, 108, 5, 255, 108, 5, 
+    255, 106, 3, 255, 104, 1, 253, 102, 0, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 107, 4, 255, 106, 3, 255, 106, 3, 255, 105, 2, 255, 105, 2, 
+    255, 106, 3, 255, 106, 3, 255, 107, 4, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2, 
+    255, 105, 2, 255, 105, 2, 255, 105, 2, 255, 105, 2 
+};
+
+static const uint8  jpeg_24bit_j75[JPEGY][JPEGX][3] =
+{
+    252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 
+    252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 252, 104, 4, 
+    252, 104, 4, 246, 108, 1, 241, 118, 0, 237, 119, 0, 242, 112, 0, 250, 104, 1, 255, 96, 3, 
+    255, 94, 5, 255, 97, 10, 255, 103, 13, 246, 107, 14, 247, 106, 16, 255, 97, 15, 255, 91, 11, 
+    255, 87, 6, 255, 93, 0, 255, 105, 0, 252, 112, 0, 253, 107, 0, 251, 108, 0, 245, 110, 0, 
+    242, 110, 1, 248, 105, 13, 251, 104, 11, 255, 104, 0, 253, 106, 0, 249, 107, 0, 249, 108, 0, 
+    253, 108, 0, 255, 106, 0, 255, 101, 0, 255, 98, 0, 
+
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 251, 99, 0, 252, 100, 0, 252, 100, 0, 253, 101, 0, 254, 102, 1, 255, 103, 2, 
+    255, 103, 2, 252, 107, 2, 238, 108, 0, 236, 109, 0, 246, 105, 0, 255, 100, 0, 255, 95, 3, 
+    255, 94, 3, 255, 98, 3, 254, 101, 5, 244, 106, 5, 246, 106, 8, 255, 99, 8, 255, 94, 5, 
+    255, 91, 3, 255, 94, 0, 250, 102, 0, 245, 104, 0, 255, 103, 0, 255, 103, 0, 249, 108, 0, 
+    246, 109, 0, 249, 106, 2, 252, 104, 4, 255, 103, 1, 255, 104, 0, 251, 106, 0, 251, 107, 0, 
+    255, 106, 0, 255, 104, 0, 255, 101, 0, 255, 100, 1, 
+
+    255, 101, 0, 255, 101, 0, 255, 101, 0, 255, 101, 0, 255, 101, 0, 255, 101, 0, 255, 101, 0, 
+    255, 101, 0, 255, 101, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 103, 1, 255, 103, 1, 
+    255, 103, 1, 255, 105, 3, 247, 104, 2, 250, 104, 3, 255, 100, 5, 255, 96, 6, 255, 95, 4, 
+    255, 97, 2, 255, 103, 0, 248, 106, 0, 245, 110, 0, 249, 109, 0, 255, 106, 0, 255, 104, 0, 
+    255, 103, 4, 253, 103, 6, 242, 106, 7, 245, 102, 8, 255, 95, 9, 255, 95, 2, 255, 103, 0, 
+    253, 108, 0, 252, 109, 0, 253, 107, 0, 255, 100, 9, 255, 100, 11, 255, 105, 0, 255, 105, 0, 
+    255, 100, 15, 255, 99, 24, 251, 102, 18, 249, 103, 17, 
+
+    255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 255, 102, 0, 
+    255, 102, 0, 255, 106, 0, 255, 105, 0, 255, 105, 0, 255, 104, 0, 255, 103, 0, 255, 103, 0, 
+    255, 102, 0, 255, 103, 0, 255, 107, 11, 255, 104, 11, 255, 97, 5, 255, 94, 0, 255, 96, 0, 
+    255, 100, 0, 250, 106, 0, 243, 109, 0, 246, 110, 0, 249, 109, 0, 253, 107, 0, 253, 108, 0, 
+    249, 109, 0, 244, 112, 4, 241, 111, 15, 248, 107, 19, 255, 96, 15, 255, 95, 6, 255, 100, 0, 
+    255, 104, 0, 255, 106, 0, 255, 105, 0, 255, 100, 17, 255, 99, 15, 255, 103, 0, 255, 103, 0, 
+    255, 99, 13, 255, 99, 22, 249, 103, 18, 245, 105, 17, 
+
+    252, 106, 0, 252, 106, 0, 252, 106, 0, 252, 106, 0, 252, 106, 0, 252, 106, 0, 252, 106, 0, 
+    252, 106, 0, 251, 105, 0, 251, 105, 0, 251, 105, 0, 251, 105, 0, 251, 105, 0, 250, 104, 0, 
+    250, 104, 0, 249, 104, 0, 252, 105, 9, 255, 100, 6, 255, 93, 0, 255, 93, 0, 255, 98, 0, 
+    255, 106, 0, 241, 112, 0, 239, 114, 0, 249, 110, 0, 252, 107, 0, 250, 106, 0, 246, 106, 0, 
+    236, 111, 0, 236, 113, 0, 240, 112, 5, 246, 110, 11, 251, 104, 11, 255, 101, 8, 255, 97, 2, 
+    255, 97, 2, 255, 99, 11, 253, 101, 17, 249, 103, 18, 253, 103, 9, 255, 101, 0, 255, 100, 0, 
+    255, 101, 0, 255, 103, 0, 255, 104, 0, 251, 106, 1, 
+
+    251, 106, 0, 251, 106, 0, 251, 106, 0, 251, 106, 0, 251, 106, 0, 251, 106, 0, 251, 106, 0, 
+    251, 106, 0, 250, 105, 0, 250, 105, 0, 251, 106, 0, 251, 106, 0, 252, 107, 0, 253, 108, 0, 
+    253, 108, 0, 254, 109, 4, 250, 104, 5, 255, 100, 1, 255, 95, 0, 255, 98, 0, 255, 106, 0, 
+    255, 112, 0, 245, 117, 0, 244, 118, 0, 255, 110, 1, 255, 106, 4, 255, 105, 3, 253, 106, 0, 
+    244, 110, 0, 243, 112, 0, 250, 110, 0, 254, 110, 0, 249, 107, 0, 255, 104, 1, 255, 97, 2, 
+    255, 95, 9, 255, 98, 20, 249, 103, 20, 242, 108, 9, 246, 107, 2, 255, 101, 0, 255, 98, 0, 
+    255, 102, 0, 255, 104, 0, 255, 105, 0, 252, 105, 0, 
+
+    255, 101, 8, 255, 101, 8, 255, 101, 8, 255, 101, 8, 255, 101, 8, 255, 101, 8, 255, 101, 8, 
+    255, 101, 8, 255, 103, 10, 255, 102, 9, 255, 102, 9, 255, 101, 8, 255, 100, 7, 255, 100, 7, 
+    255, 99, 6, 254, 100, 2, 249, 101, 0, 255, 102, 0, 255, 99, 4, 255, 102, 7, 255, 105, 5, 
+    253, 108, 0, 242, 109, 0, 240, 104, 0, 251, 93, 2, 255, 90, 17, 255, 89, 32, 255, 93, 37, 
+    255, 101, 27, 255, 105, 10, 255, 106, 0, 255, 106, 0, 255, 104, 0, 255, 102, 0, 255, 96, 0, 
+    255, 96, 6, 252, 103, 13, 242, 109, 8, 235, 116, 0, 238, 114, 0, 252, 103, 13, 255, 98, 17, 
+    255, 102, 0, 255, 104, 0, 252, 104, 4, 251, 104, 8, 
+
+    255, 99, 11, 255, 100, 9, 255, 99, 11, 255, 100, 9, 255, 99, 11, 255, 100, 9, 255, 99, 11, 
+    255, 100, 9, 255, 100, 12, 255, 99, 8, 255, 96, 8, 252, 93, 2, 248, 88, 0, 245, 86, 0, 
+    242, 82, 0, 242, 81, 0, 252, 88, 0, 255, 92, 0, 255, 93, 7, 255, 95, 15, 255, 95, 12, 
+    247, 89, 2, 235, 82, 0, 233, 73, 0, 237, 65, 0, 248, 64, 10, 255, 70, 32, 255, 78, 42, 
+    255, 86, 37, 255, 90, 20, 255, 94, 0, 255, 96, 0, 255, 104, 0, 255, 104, 0, 255, 99, 4, 
+    255, 99, 9, 251, 104, 9, 242, 110, 2, 238, 114, 0, 241, 112, 0, 251, 103, 15, 255, 100, 18, 
+    255, 102, 8, 255, 103, 2, 252, 104, 4, 252, 104, 4, 
+
+    255, 106, 11, 255, 103, 6, 255, 102, 7, 255, 103, 6, 255, 101, 6, 252, 95, 0, 250, 93, 0, 
+    251, 94, 0, 254, 97, 2, 255, 99, 2, 255, 103, 8, 255, 104, 7, 255, 103, 8, 255, 100, 3, 
+    253, 96, 1, 255, 89, 0, 255, 72, 0, 253, 56, 0, 248, 64, 0, 231, 53, 0, 202, 24, 0, 
+    255, 74, 9, 255, 81, 26, 255, 67, 16, 255, 64, 16, 247, 49, 4, 255, 64, 21, 217, 10, 0, 
+    242, 33, 0, 255, 62, 15, 255, 66, 17, 220, 46, 0, 188, 52, 0, 201, 78, 0, 194, 59, 0, 
+    241, 98, 19, 244, 97, 4, 255, 115, 17, 253, 105, 9, 253, 103, 6, 252, 101, 0, 255, 109, 4, 
+    254, 102, 1, 251, 100, 0, 248, 97, 0, 248, 98, 0, 
+
+    232, 107, 41, 229, 104, 38, 228, 103, 37, 231, 106, 40, 230, 105, 39, 226, 101, 35, 
+    224, 99, 33, 227, 102, 36, 208, 83, 17, 219, 94, 28, 231, 106, 40, 237, 112, 46, 
+    238, 113, 47, 240, 115, 49, 246, 121, 55, 255, 124, 60, 255, 112, 55, 250, 111, 56, 
+    214, 99, 44, 192, 87, 42, 220, 108, 86, 175, 51, 49, 184, 45, 64, 248, 106, 130, 
+    195, 63, 76, 171, 46, 42, 197, 72, 50, 235, 110, 80, 211, 81, 55, 185, 60, 40, 195, 84, 77, 
+    189, 106, 90, 150, 106, 59, 221, 188, 134, 233, 184, 141, 118, 45, 0, 227, 117, 38, 
+    249, 115, 30, 237, 90, 20, 230, 92, 30, 197, 86, 30, 192, 97, 49, 172, 78, 42, 180, 79, 35, 
+    214, 98, 25, 242, 118, 30, 
+
+    187, 117, 119, 185, 115, 117, 185, 115, 117, 188, 118, 120, 189, 119, 121, 186, 116, 118, 
+    186, 116, 118, 189, 119, 121, 194, 124, 126, 191, 121, 123, 182, 112, 114, 169, 99, 101, 
+    163, 93, 95, 177, 107, 109, 206, 136, 138, 220, 166, 154, 191, 167, 129, 181, 188, 144, 
+    175, 214, 185, 157, 204, 210, 0, 29, 85, 108, 126, 226, 86, 84, 219, 84, 82, 218, 
+    90, 108, 218, 77, 111, 183, 100, 145, 174, 109, 162, 166, 136, 190, 192, 60, 124, 133, 
+    79, 160, 189, 46, 148, 173, 106, 225, 231, 117, 237, 238, 83, 184, 196, 152, 199, 193, 
+    139, 102, 49, 216, 125, 55, 230, 113, 59, 206, 113, 98, 133, 110, 162, 58, 74, 162, 
+    38, 56, 156, 76, 73, 150, 136, 91, 112, 161, 94, 86, 
+
+    99, 64, 97, 96, 61, 93, 96, 61, 94, 99, 64, 96, 100, 65, 98, 97, 62, 94, 98, 63, 96, 
+    102, 67, 99, 93, 58, 91, 97, 62, 94, 99, 64, 97, 95, 60, 92, 92, 57, 90, 98, 63, 95, 
+    113, 78, 111, 114, 100, 115, 96, 125, 103, 135, 203, 178, 82, 179, 185, 0, 103, 149, 
+    11, 108, 205, 0, 29, 164, 12, 72, 230, 0, 53, 205, 0, 76, 194, 30, 130, 215, 0, 110, 160, 
+    6, 136, 170, 4, 142, 178, 12, 163, 206, 0, 169, 228, 33, 207, 255, 0, 153, 175, 28, 179, 196, 
+    67, 197, 231, 127, 212, 243, 86, 99, 108, 162, 124, 123, 203, 142, 141, 189, 139, 166, 
+    51, 47, 131, 9, 36, 143, 70, 103, 206, 28, 54, 138, 47, 51, 99, 109, 102, 135, 
+
+    94, 69, 98, 91, 67, 93, 90, 65, 94, 92, 68, 94, 92, 67, 96, 89, 65, 91, 90, 65, 94, 
+    94, 70, 96, 89, 64, 93, 91, 67, 93, 93, 68, 97, 92, 68, 94, 88, 63, 92, 83, 59, 85, 
+    79, 54, 83, 69, 58, 74, 65, 80, 75, 35, 75, 77, 4, 67, 111, 41, 112, 190, 40, 109, 213, 
+    61, 122, 229, 67, 114, 202, 26, 71, 138, 35, 89, 133, 0, 66, 102, 0, 79, 125, 3, 109, 167, 
+    1, 123, 198, 0, 132, 216, 0, 140, 225, 44, 180, 238, 71, 164, 169, 149, 212, 204, 
+    56, 102, 125, 69, 105, 167, 25, 61, 171, 20, 49, 169, 168, 183, 255, 41, 31, 94, 
+    85, 35, 70, 163, 102, 107, 161, 116, 87, 222, 208, 182, 153, 182, 196, 16, 66, 101, 
+
+
+    182, 127, 124, 178, 123, 120, 176, 121, 118, 177, 122, 119, 176, 121, 118, 174, 119, 116, 
+    175, 120, 117, 178, 123, 120, 185, 130, 127, 181, 126, 123, 180, 125, 122, 185, 130, 127, 
+    193, 138, 135, 200, 145, 142, 201, 146, 143, 195, 146, 139, 162, 125, 107, 246, 223, 215, 
+    166, 161, 181, 167, 172, 210, 81, 92, 138, 102, 107, 147, 211, 202, 221, 195, 176, 180, 
+    255, 233, 231, 140, 128, 130, 189, 200, 222, 111, 146, 184, 96, 156, 210, 34, 108, 171, 
+    102, 182, 245, 113, 169, 204, 202, 205, 184, 97, 69, 30, 160, 122, 109, 187, 158, 188, 
+    60, 56, 151, 65, 72, 186, 50, 50, 136, 240, 208, 247, 185, 91, 66, 240, 123, 53, 
+    248, 144, 45, 207, 139, 56, 145, 132, 113, 127, 141, 152, 
+
+    235, 106, 48, 230, 101, 43, 228, 99, 41, 230, 101, 43, 229, 100, 42, 227, 98, 40, 
+    229, 100, 42, 233, 104, 46, 242, 113, 55, 239, 110, 52, 235, 106, 48, 232, 103, 45, 
+    226, 97, 39, 210, 81, 23, 189, 60, 2, 174, 45, 0, 197, 72, 14, 230, 115, 52, 222, 117, 49, 
+    226, 134, 61, 206, 124, 50, 219, 132, 63, 216, 106, 55, 226, 93, 58, 230, 78, 57, 
+    175, 27, 13, 176, 59, 39, 205, 121, 97, 230, 180, 155, 248, 213, 193, 212, 172, 164, 
+    138, 73, 53, 146, 39, 0, 254, 130, 58, 208, 91, 14, 205, 93, 29, 198, 94, 57, 153, 51, 29, 
+    176, 66, 49, 197, 78, 36, 249, 116, 23, 245, 104, 0, 253, 111, 3, 243, 105, 17, 218, 93, 39, 
+    199, 81, 45, 
+
+    255, 100, 11, 255, 96, 6, 255, 94, 5, 255, 96, 6, 255, 96, 7, 255, 95, 5, 255, 97, 8, 
+    255, 102, 12, 255, 95, 6, 249, 88, 0, 242, 78, 0, 238, 77, 0, 246, 82, 0, 253, 92, 2, 
+    255, 98, 9, 255, 101, 12, 255, 91, 6, 248, 87, 0, 255, 101, 0, 244, 100, 0, 220, 85, 0, 
+    231, 91, 0, 232, 72, 0, 217, 38, 0, 221, 19, 0, 255, 77, 35, 234, 59, 4, 210, 63, 0, 
+    192, 76, 1, 164, 57, 0, 161, 47, 0, 187, 54, 0, 255, 107, 31, 249, 81, 0, 255, 112, 7, 
+    253, 101, 0, 227, 74, 0, 239, 84, 0, 255, 99, 21, 253, 93, 5, 250, 98, 0, 255, 106, 0, 
+    255, 109, 0, 255, 91, 0, 255, 89, 12, 255, 102, 32, 
+
+    255, 102, 5, 255, 103, 5, 255, 102, 5, 255, 102, 4, 255, 101, 4, 255, 101, 3, 255, 100, 3, 
+    255, 101, 3, 255, 101, 4, 255, 102, 4, 255, 101, 4, 255, 102, 4, 255, 101, 4, 255, 102, 4, 
+    255, 101, 4, 255, 101, 4, 251, 92, 0, 244, 86, 0, 233, 77, 0, 225, 72, 0, 223, 75, 0, 
+    234, 83, 0, 250, 93, 0, 255, 98, 9, 255, 96, 14, 255, 95, 15, 255, 96, 11, 252, 98, 10, 
+    245, 102, 10, 243, 104, 13, 246, 104, 18, 252, 104, 18, 255, 101, 9, 255, 101, 4, 
+    255, 103, 1, 255, 104, 1, 255, 103, 2, 255, 103, 4, 255, 101, 8, 255, 102, 6, 255, 104, 0, 
+    255, 104, 0, 255, 102, 0, 255, 101, 4, 255, 100, 8, 255, 100, 9, 
+
+    255, 104, 3, 255, 104, 3, 255, 104, 3, 255, 103, 2, 255, 103, 2, 254, 102, 1, 254, 102, 1, 
+    254, 102, 1, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 99, 0, 254, 98, 0, 253, 97, 0, 253, 97, 0, 254, 98, 0, 
+    255, 100, 0, 255, 103, 3, 255, 105, 5, 255, 103, 3, 255, 102, 2, 255, 100, 0, 255, 99, 0, 
+    255, 99, 0, 255, 100, 0, 255, 102, 2, 255, 103, 3, 255, 102, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+
+    255, 104, 3, 255, 104, 3, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 254, 102, 1, 
+    254, 102, 1, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 100, 0, 255, 102, 2, 255, 106, 6, 255, 108, 8, 255, 109, 9, 
+    255, 107, 7, 255, 105, 5, 255, 103, 3, 255, 103, 3, 255, 102, 2, 255, 101, 1, 255, 100, 0, 
+    255, 100, 0, 255, 101, 1, 255, 102, 2, 255, 103, 3, 255, 102, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 3, 255, 102, 2, 255, 102, 2, 255, 101, 1, 255, 101, 1, 
+    255, 101, 1, 255, 102, 2, 255, 102, 2, 255, 103, 3, 255, 102, 2, 255, 101, 1, 255, 101, 1, 
+    255, 101, 1, 255, 101, 1, 255, 102, 2, 255, 103, 3, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 106, 6, 255, 104, 4, 255, 102, 2, 255, 101, 1, 255, 101, 1, 
+    255, 101, 1, 255, 103, 3, 255, 104, 4, 255, 103, 3, 255, 102, 2, 255, 102, 2, 255, 102, 2, 
+    255, 102, 2, 255, 102, 2, 255, 102, 2, 255, 103, 3, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+
+    254, 102, 1, 254, 102, 1, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 104, 3, 
+    255, 104, 3, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 102, 2, 255, 103, 3, 255, 104, 4, 255, 106, 6, 255, 105, 5, 
+    255, 104, 4, 255, 102, 2, 255, 101, 1, 255, 103, 3, 255, 103, 3, 255, 103, 3, 255, 103, 3, 
+    255, 103, 3, 255, 103, 3, 255, 103, 3, 255, 103, 3, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+
+    254, 102, 1, 254, 102, 1, 254, 102, 1, 255, 103, 2, 255, 103, 2, 255, 104, 3, 255, 104, 3, 
+    255, 104, 3, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 252, 98, 0, 254, 100, 0, 255, 102, 2, 255, 103, 3, 255, 103, 3, 
+    255, 102, 2, 255, 101, 1, 253, 99, 0, 255, 102, 2, 255, 103, 3, 255, 103, 3, 255, 103, 3, 
+    255, 103, 3, 255, 103, 3, 255, 103, 3, 255, 102, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2, 
+    255, 103, 2, 255, 103, 2, 255, 103, 2, 255, 103, 2 
+};
+
+void test_GRgetcomptype(); /* in "tdfr8.c" */
+static VOID check_im_pal(int32 oldx, int32 oldy, int32 newx, int32 newy,
+             uint8 *oldim, uint8 *newim, uint8 *oldpal, uint8 *newpal);
+
+/* These two functions are in tusejpegfuncs.c.  They use JPEG functions directly
+   to compress and decompress the same data as in test_r24_jpeg, to verify that
+   the DFR24 API work correctly regardless which JPEG library is used */
+intn comp_using_jpeglib(char *filename, long *file_offset, int im_height,
+        int im_width, int im_ncomps, int quality, uint8 *written_buffer);
+intn decomp_using_jpeglib(char *filename, long file_offset, int im_height,
+        int im_width, int im_ncomps, uint8 *read_buffer);
+void test_r24_jpeg(void);
+
+/* ------------------------------- test_r24 ------------------------------- */
+
+void
+test_r24(void)
+{
+    int32       xd, yd;
+    intn        il;
+    int         Error;
+    char        buf[YSIZE][XSIZE][3];
+    char        buf1[YSIZE][3][XSIZE];
+    char        buf2[3][YSIZE][XSIZE];
+    char        in[YSIZE][XSIZE][3];
+    char        in1[YSIZE][3][XSIZE];
+    char        in2[3][YSIZE][XSIZE];
+    int         i, j, ret;
+    uint16      ref0, ref1, ref2;
+    uint8      *jpeg_24bit_temp;
+
+    jpeg_24bit_temp = (uint8 *) HDmalloc(JPEGX * JPEGY * 3);
+    if (!jpeg_24bit_temp)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+          {
+              buf[i][j][0] = buf[i][j][1] = buf[i][j][2] = (char) (i + j);
+              buf1[i][0][j] = buf1[i][1][j] = buf1[i][2][j] = (char) (i | j);
+              buf2[0][i][j] = buf2[1][i][j] = buf2[2][i][j] = (char) (i ^ j);
+          }
+
+    MESSAGE(5, printf("Writing 24bit images with differing interlacing\n");
+        );
+
+    ret = DF24setil(DFIL_PIXEL);
+    RESULT("DF24setil");
+    ret = DF24putimage(TESTFILE, &(buf[0][0][0]), XSIZE, YSIZE);
+    RESULT("DF24putimage");
+    ref0 = DF24lastref();
+
+    ret = DF24setil(DFIL_LINE);
+    RESULT("DF24setil");
+    ret = DF24addimage(TESTFILE, &(buf1[0][0][0]), XSIZE, YSIZE);
+    RESULT("DF24addimage");
+    ref1 = DF24lastref();
+
+    ret = DF24setil(DFIL_PLANE);
+    RESULT("DF24setil");
+    ret = DF24addimage(TESTFILE, &(buf2[0][0][0]), XSIZE, YSIZE);
+    RESULT("DF24addimage");
+    ref2 = DF24lastref();
+
+    if ((ret = DF24nimages(TESTFILE)) != 3)
+      {
+          fprintf(stderr, "  >>> DF24nimages() gives wrong number: %d <<<\n", ret);
+          num_errs++;
+      }
+
+    /* read image 0 */
+
+    MESSAGE(5, printf("Reading and verifying 24bit images\n");
+        );
+
+    ret = DF24restart();
+    RESULT("DF24restart");
+    ret = DF24reqil(DFIL_PIXEL);
+    RESULT("DF24reqil");
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+    if (ret == FAIL)
+        HEprint(stderr, 0);
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 0)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 0\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in[i][j][0] != buf[i][j][0]
+                || in[i][j][1] != buf[i][j][1]
+                || in[i][j][2] != buf[i][j][2])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          printf("in:\n");
+          for (i = 0; i < YSIZE; i++)
+            {
+                for (j = 0; j < XSIZE; j++)
+                    printf("(%d,%d,%d)", (int) in[i][j][0], (int) in[i][j][1], (int) in[i][j][2]);
+                printf("\n");
+            }
+          printf("buf:\n");
+          for (i = 0; i < YSIZE; i++)
+            {
+                for (j = 0; j < XSIZE; j++)
+                    printf("(%d,%d,%d)", (int) buf[i][j][0], (int) buf[i][j][1], (int) buf[i][j][2]);
+                printf("\n");
+            }
+          fprintf(stderr, "Image 0 was incorrect\n");
+          num_errs++;
+      }
+
+    if (ref0 != DF24lastref())
+      {
+          fprintf(stderr, "Bogus lastref for image 0\n");
+          num_errs++;
+      }
+
+    /* read image 1 */
+
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 1)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 1\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in[i][j][0] != buf1[i][0][j]
+                || in[i][j][1] != buf1[i][1][j]
+                || in[i][j][2] != buf1[i][2][j])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 1 was incorrect\n");
+          num_errs++;
+      }
+
+    if (ref1 != DF24lastref())
+      {
+          fprintf(stderr, "Bogus lastref for image 1\n");
+          num_errs++;
+      }
+
+    /* read image 2 */
+
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 2)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 2\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in[i][j][0] != buf2[0][i][j]
+                || in[i][j][1] != buf2[1][i][j]
+                || in[i][j][2] != buf2[2][i][j])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 2 was incorrect\n");
+          num_errs++;
+      }
+
+    if (ref2 != DF24lastref())
+      {
+          fprintf(stderr, "Bogus lastref for image 2\n");
+          num_errs++;
+      }
+
+    ret = DF24restart();
+    RESULT("DF24restart");
+
+    /* read image 3 */
+
+    ret = DF24reqil(DFIL_LINE);
+    RESULT("DF24reqil");
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 0)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 3\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in1, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in1[i][0][j] != buf[i][j][0]
+                || in1[i][1][j] != buf[i][j][1]
+                || in1[i][2][j] != buf[i][j][2])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 3 was incorrect\n");
+          num_errs++;
+      }
+
+    /* read image 4 */
+
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 1)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 4\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in1, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in1[i][0][j] != buf1[i][0][j]
+                || in1[i][1][j] != buf1[i][1][j]
+                || in1[i][2][j] != buf1[i][2][j])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 4 was incorrect\n");
+          num_errs++;
+      }
+
+    /* read image 5 */
+
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 2)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 5\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in1, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in1[i][0][j] != buf2[0][i][j]
+                || in1[i][1][j] != buf2[1][i][j]
+                || in1[i][2][j] != buf2[2][i][j])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 5 was incorrect\n");
+          num_errs++;
+      }
+
+    /* read image 6 */
+
+    ret = DF24restart();
+    RESULT("DF24restart");
+
+    ret = DF24reqil(DFIL_PLANE);
+    RESULT("DF24reqil");
+
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 0)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 6\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in2, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in2[0][i][j] != buf[i][j][0]
+                || in2[1][i][j] != buf[i][j][1]
+                || in2[2][i][j] != buf[i][j][2])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 6 was incorrect\n");
+          num_errs++;
+      }
+
+    /* read image 7 */
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 1)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 7\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in2, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in2[0][i][j] != buf1[i][0][j]
+                || in2[1][i][j] != buf1[i][1][j]
+                || in2[2][i][j] != buf1[i][2][j])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 7 was incorrect\n");
+          num_errs++;
+      }
+
+    /* read image 8 */
+
+    ret = DF24getdims(TESTFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != XSIZE) || (yd != YSIZE) || il != 2)
+      {
+          fprintf(stderr, "Returned meta-data is wrong for image 8\n");
+          num_errs++;
+      }
+
+    ret = DF24getimage(TESTFILE, in2, XSIZE, YSIZE);
+    RESULT("DF24getimage");
+    Error = FALSE;
+    for (i = 0; i < YSIZE; i++)
+        for (j = 0; j < XSIZE; j++)
+            if (in2[0][i][j] != buf2[0][i][j]
+                || in2[1][i][j] != buf2[1][i][j]
+                || in2[2][i][j] != buf2[2][i][j])
+              {
+                  Error = TRUE;
+              }
+
+    if (Error)
+      {
+          fprintf(stderr, "Image 8 was incorrect\n");
+          num_errs++;
+      }
+
+    HDfree(jpeg_24bit_temp);
+
+    /* Test 24-bit images with JPEG compression */
+    test_r24_jpeg();
+}
+
+/**********************************************************************
+ Utility function: read_binary_block
+ Description:
+	read_binary_block opens the given file in binary mode, seeks
+	to the specified offset, then reads into the provided buffer
+	nitems of values.
+***********************************************************************/
+size_t
+read_binary_block(
+	const char *filename,	/* file to be read */
+	int32 offset,		/* position to start reading from */
+	size_t nitems,		/* number of bytes to read */
+	uint8 *buffer)		/* buffer to store the binary data in */
+{
+    FILE *fd;
+    size_t readlen=0;   /* number of bytes actually read */
+
+    /* Open the file to read binary data */
+    if ((fd = fopen(filename, "rb")) == NULL) {
+      fprintf(stderr, "can't open %s\n", filename);
+      exit(1);
+    }
+
+    /* Forward to the specified offset to start reading */
+    if (fseek(fd, (off_t)offset, SEEK_SET) == -1)
+    {
+        fprintf(stderr, "can't seek offset %d\n", (int)offset);
+        exit(1);
+    }
+
+    /* Read in the specified block of data */
+    readlen = fread((void*)buffer, 1, nitems, fd);
+    return(readlen);
+}
+
+/* ------------------------------- test_r24_jpeg ------------------------------- */
+
+#define N_IMAGES 3
+void
+test_r24_jpeg(void)
+{
+    int32     fid, grid,	/* file ID and GR interface ID */
+              riid;		/* raster image ID */
+    comp_info cinfo;		/* compression information for the JPEG */
+    int32     xd, yd;		/* image's dimensions */
+    intn      il;		/* image's interlace */
+    long      begin_offset=0,	/* offset at the beginning of image's data */
+	      end_offset=0;	/* offset at the end of image's data */
+    uint8    *jpeg_24bit_temp;	/* buffer for 24-bit image data */
+    uint8     jpeglib_readbuf[JPEGY*JPEGX*NCOMPS];
+				/* buffer for data read by JPEG function */
+    int32     offset, length;	/* offset/length in the HDF file */
+    int32     nonhdf_offset;	/* offset in the nonHDF file */
+    intn      status;		/* status returned from GR routines */
+    intn      ii;		/* indices */
+    int32     n_images, n_fattrs; /* number of images and number of file attrs */
+    uint8    *hdf_buffer,	/* buffer of data read from HDF file */
+	     *nonhdf_buffer;	/* buffer of data read from non-HDF file */
+    int       ret;
+
+    /* Allocate buffer for DF24getimage to store read data */
+    jpeg_24bit_temp = (uint8 *) HDmalloc(JPEGX * JPEGY * 3);
+    if (!jpeg_24bit_temp)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    MESSAGE(5, printf("\nStoring 24-bit images with JPEG compression\n");
+        );
+
+    ret = DF24setil(DFIL_PIXEL);
+    RESULT("DF24setil");
+
+    MESSAGE(6, printf("Storing first image with JPEG quality 80\n");
+        );
+    cinfo.jpeg.quality = 80;
+    cinfo.jpeg.force_baseline = TRUE;
+    DF24setcompress(COMP_JPEG, &cinfo);
+    ret = DF24putimage((const char *)JPEGFILE, jpeg_24bit_orig, JPEGX, JPEGY);
+    RESULT("DF24putimage");
+
+    MESSAGE(6, printf("Storing second image with JPEG quality 30\n");
+        );
+    cinfo.jpeg.quality = 30;
+    cinfo.jpeg.force_baseline = TRUE;
+    DF24setcompress(COMP_JPEG, &cinfo);
+    ret = DF24addimage((const char *)JPEGFILE, jpeg_24bit_orig, JPEGX, JPEGY);
+    RESULT("DF24addimage");
+
+    MESSAGE(6, printf("Storing third image with JPEG default quality of 75\n");
+        );
+    cinfo.jpeg.quality = 75;
+    cinfo.jpeg.force_baseline = TRUE;
+    DF24setcompress(COMP_JPEG, &cinfo);
+    ret = DF24addimage((const char *)JPEGFILE, jpeg_24bit_orig, JPEGX, JPEGY);
+    RESULT("DF24addimage");
+
+    if (DF24nimages(JPEGFILE) != 3)
+      {
+          fprintf(stderr, "  >>> DF24nimages() gives wrong number for JPEG images<<<\n");
+          num_errs++;
+      }
+
+    MESSAGE(5, printf("\nReading and verifying 24bit JPEG'ed images\n\n");
+        );
+
+    ret = DF24restart();
+    RESULT("DF24restart");
+
+    ret = DF24reqil(DFIL_PIXEL);
+    RESULT("DF24reqil");
+
+    /* Get dimensions of first image */
+    ret = DF24getdims(JPEGFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != JPEGX) || (yd != JPEGY))
+      {
+          fprintf(stderr, "Returned meta-data is wrong for JPEG quality 80 image\n");
+          fprintf(stderr, "xd=%d, yd=%d\n", (int)xd, (int)yd);
+          num_errs++;
+      }
+
+    ret = DF24getimage(JPEGFILE, jpeg_24bit_temp, JPEGX, JPEGY);
+    RESULT("DF24getimage");
+
+    /* Compress the same data using the JPEG library directly, with quality 80 */
+    comp_using_jpeglib(NONHDF_JPEGFILE, &end_offset, JPEGY, JPEGX, NCOMPS, 80, jpeg_24bit_orig);
+
+    /* Read back the data using JPEG library directly */
+    decomp_using_jpeglib(NONHDF_JPEGFILE, begin_offset, JPEGY, JPEGX, NCOMPS, jpeglib_readbuf);
+
+    /* Compare data decompressed by HDF against that by JPEG lib, the buffers
+       should be identical */
+    if (HDmemcmp(jpeg_24bit_temp, jpeglib_readbuf, JPEGY*JPEGX*NCOMPS))
+    {
+	fprintf(stderr, "24-bit JPEG quality 80 image was incorrect\n");
+	print_mismatched(jpeg_24bit_temp, jpeglib_readbuf, JPEGY*JPEGX*NCOMPS);
+	num_errs++;
+    }
+
+#if 0 /* will remove after finish revising JPEG tests */
+    if ((ret = fuzzy_memcmp(jpeg_24bit_temp, jpeg_24bit_j80, sizeof(jpeg_24bit_orig), JPEG_FUZZ)) != 0)
+      {
+          fprintf(stderr, "24-bit JPEG quality 80 image was incorrect\n");
+          fprintf(stderr, "ret=%d, sizeof(jpeg_24bit_orig)=%u\n", (int) ret, (unsigned) sizeof(jpeg_24bit_orig));
+          num_errs++;
+      }
+#endif
+
+    /* Get dimensions of second image */
+    ret = DF24getdims(JPEGFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != JPEGX) || (yd != JPEGY))
+      {
+          fprintf(stderr, "Returned meta-data is wrong for JPEG quality 30 image\n");
+          fprintf(stderr, "xd=%d, yd=%d\n", (int)xd, (int)yd);
+          num_errs++;
+      }
+
+    ret = DF24getimage(JPEGFILE, jpeg_24bit_temp, JPEGX, JPEGY);
+    RESULT("DF24getimage");
+
+    begin_offset = end_offset;
+
+    /* Compress the same data using the JPEG library directly, with quality 30 */
+    comp_using_jpeglib(NONHDF_JPEGFILE, &end_offset, JPEGY, JPEGX, NCOMPS, 30, jpeg_24bit_orig);
+
+    /* Read back the data using JPEG library directly */
+    decomp_using_jpeglib(NONHDF_JPEGFILE, begin_offset, JPEGY, JPEGX, NCOMPS, jpeglib_readbuf);
+
+    /* Compare data decompressed by HDF against that by JPEG lib, the buffers
+       should be identical */
+    if (HDmemcmp(jpeg_24bit_temp, jpeglib_readbuf, JPEGY*JPEGX*NCOMPS))
+    {
+	fprintf(stderr, "24-bit JPEG quality 30 image was incorrect\n");
+	print_mismatched(jpeg_24bit_temp, jpeglib_readbuf, JPEGY*JPEGX*NCOMPS);
+	num_errs++;
+    }
+
+#if 0
+    if ((ret = fuzzy_memcmp(jpeg_24bit_temp, jpeg_24bit_j30, sizeof(jpeg_24bit_orig), JPEG_FUZZ)) != 0)
+      {
+          fprintf(stderr, "24-bit JPEG quality 30 image was incorrect\n");
+          fprintf(stderr, "ret=%d, sizeof(jpeg_24bit_orig)=%u\n", (int) ret, (unsigned) sizeof(jpeg_24bit_orig));
+          num_errs++;
+      }
+#endif
+
+    /* Get dimensions of third image */
+    ret = DF24getdims(JPEGFILE, &xd, &yd, &il);
+    RESULT("DF24getdims");
+
+    if ((xd != JPEGX) || (yd != JPEGY))
+      {
+          fprintf(stderr, "Returned meta-data is wrong for JPEG quality 75 image\n");
+          fprintf(stderr, "xd=%d, yd=%d\n", (int)xd, (int)yd);
+          num_errs++;
+      }
+
+    ret = DF24getimage(JPEGFILE, jpeg_24bit_temp, JPEGX, JPEGY);
+    RESULT("DF24getimage");
+
+    begin_offset = end_offset;
+
+    /* Compress the same data using the JPEG library directly, with quality 75 */
+    comp_using_jpeglib(NONHDF_JPEGFILE, &end_offset, JPEGY, JPEGX, NCOMPS, 75, jpeg_24bit_orig);
+
+    /* Read back the data using JPEG library directly */
+    decomp_using_jpeglib(NONHDF_JPEGFILE, begin_offset, JPEGY, JPEGX, NCOMPS, jpeglib_readbuf);
+
+    /* Compare data decompressed by HDF against that by JPEG lib, the buffers
+       should be identical */
+    if (HDmemcmp(jpeg_24bit_temp, jpeglib_readbuf, JPEGY*JPEGX*NCOMPS))
+    {
+	fprintf(stderr, "24-bit JPEG quality 75 image was incorrect\n");
+	print_mismatched(jpeg_24bit_temp, jpeglib_readbuf, JPEGY*JPEGX*NCOMPS);
+	num_errs++;
+    }
+
+#if 0
+    if ((ret = fuzzy_memcmp(jpeg_24bit_temp, jpeg_24bit_j75, sizeof(jpeg_24bit_orig), JPEG_FUZZ)) != 0)
+      {
+          fprintf(stderr, "24-bit JPEG quality 75 image was incorrect\n");
+          fprintf(stderr, "ret=%d, sizeof(jpeg_24bit_orig)=%u\n", (int) ret, (unsigned) sizeof(jpeg_24bit_orig));
+          num_errs++;
+      }
+#endif
+
+    HDfree(jpeg_24bit_temp);
+
+
+    /********************************************************************
+      Verify raw data in HDF and NON-HDF files using offsets and lengths.
+    ********************************************************************/
+
+   /* Re-open the file with GR interface */
+    fid = Hopen (JPEGFILE, DFACC_RDONLY, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    grid = GRstart (fid);
+    CHECK_VOID(grid, FAIL, "GRstart");
+
+    /* Get the number of images in the file */
+    status = GRfileinfo(grid, &n_images, &n_fattrs);
+    CHECK_VOID(status, FAIL, "GRfileinfo");
+    VERIFY_VOID(n_images, N_IMAGES, "GRfileinfo");
+
+    /* Open each image and get its data information.  Read the block of
+       binary data from the HDF file and the non-HDF file.  Then, verify
+       that the two buffers are identical.  Note that the non-HDF file only
+       contains the image data, thus the offset will start at 0. */
+    nonhdf_offset = 0;
+    for (ii = 0; ii < n_images; ii++)
+    {
+	size_t read_len=0;
+
+	/* Get access to each image */
+	riid = GRselect(grid, ii);
+	CHECK_VOID(riid, FAIL, "GRselect");
+
+	/* Get the image's data information */
+	status = GRgetdatainfo(riid, 0, 1, &offset, &length);
+	CHECK_VOID(status, FAIL, "GRgetdatainfo");
+
+	/* Allocate buffers for the data from the HDF file and non-HDF file */
+	hdf_buffer = (uint8 *) HDmalloc(length * sizeof(uint8));
+	CHECK_ALLOC(hdf_buffer, "hdf_buffer", "test_r24_jpeg" );
+	nonhdf_buffer = (uint8 *) HDmalloc(length * sizeof(uint8));
+	CHECK_ALLOC(nonhdf_buffer, "nonhdf_buffer", "test_r24_jpeg" );
+
+	/* Read the block of data from the HDF file using offset/length returned by
+	   GRgetdatainfo and verify that the specified length of data was read */
+	read_len = read_binary_block(JPEGFILE, offset, length, hdf_buffer);
+	VERIFY_VOID(read_len, (size_t)length, "read_binary_block");
+
+	/* Read the block of data from the non-HDF file using nonhdf_offset and
+	   the length returned by GRgetdatainfo and verify that the specified
+	   length of data was read */
+	read_len = read_binary_block(NONHDF_JPEGFILE, nonhdf_offset, length, nonhdf_buffer);
+	VERIFY_VOID(read_len, (size_t)length, "read_binary_block");
+
+	/* Compare compressed data from the HDF file against that from the
+	   non-HDF file.  The two buffers should be identical */
+	if (HDmemcmp(hdf_buffer, nonhdf_buffer, length))
+	{
+	    /* Display any mismatched values for debugging */
+	    print_mismatched(hdf_buffer, nonhdf_buffer, length);
+	    num_errs++;
+	}
+
+	/* Move forward to the next set of non-HDF data, equivalent to the next
+	   image in the HDF file JPEGFILE */
+	nonhdf_offset = nonhdf_offset + length;
+
+	/* Close the image */
+	status = GRendaccess(riid);
+	CHECK_VOID(status, FAIL, "GRendaccess");
+    } /* for n_images */
+
+    /* Terminate access to the GR interface and close the file */
+    status = GRend(grid);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+}
+
+static VOID
+check_im_pal(int32 oldx, int32 oldy, int32 newx, int32 newy,
+             uint8 *oldim, uint8 *newim, uint8 *oldpal, uint8 *newpal)
+{
+    int         error;
+    int         x, y;
+    uint8      *op, *np;
+
+    MESSAGE(5, printf("Checking image and palette.\n");
+        );
+
+    op = (uint8 *) oldim;
+    np = (uint8 *) newim;
+    if (newx != oldx || newy != oldy)
+        printf("        >>> DIMENSIONS WRONG <<<\n\n");
+    error = FALSE;
+    for (x = 0; x < oldx; x++)
+        for (y = 0; y < oldy; y++)
+          {
+              if (*op != *np)
+                {
+                    printf("\t>>>Error at %d %d, orig image=%d; new image=%d<<<\n",
+                           x, y, *op, *np);
+                    error = TRUE;
+                }
+              op++;
+              np++;
+          }
+    if (error)
+      {
+          printf("    >>> Image is wrong. <<<\n");
+          num_errs++;
+      }
+
+    error = FALSE;
+    for (x = 0; x < 768; x++)
+        if (oldpal[x] != newpal[x])
+          {
+              printf("\t>>>Pal error at %d, orig pal %u new pal %u<<<\n",
+                     x, oldpal[x], newpal[x]);
+              error = TRUE;
+          }
+    if (error)
+      {
+          printf("    >>> Palette is wrong. <<<\n");
+          num_errs++;
+      }
+}
+
+/* ------------------------------- test_r8 -------------------------------- */
+
+#define XD1 10
+#define YD1 10
+#define XD2 7
+#define YD2 11
+#define XD3 8
+#define YD3 12
+#define TESTFILE_R8  "tdfr8.hdf"
+void
+test_r8(void)
+{
+    comp_info   cinfo;          /* compression information for the JPEG */
+    uint8      *im3, *ii3;
+    uint8      *im2, *ii2;
+    uint8      *im1, *ii1;
+    uint8      *pal1, *pal2, *ipal;
+
+    int         x, y;
+    int         ret, num_images = 0;
+    uint16      ref1, ref2;
+    int32       xd, yd;
+    int         ispal;
+    uint8      *jpeg_8bit_temp;
+
+    im1 = (uint8 *) HDmalloc(XD1 * YD1 * sizeof(uint8));
+    ii1 = (uint8 *) HDmalloc(XD1 * YD1 * sizeof(uint8));
+    if (!im1 || !ii1)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    im2 = (uint8 *) HDmalloc(XD2 * YD2 * sizeof(uint8));
+    ii2 = (uint8 *) HDmalloc(XD2 * YD2 * sizeof(uint8));
+    if (!im2 || !ii2)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    im3 = (uint8 *) HDmalloc(XD3 * YD3 * sizeof(uint8));
+    ii3 = (uint8 *) HDmalloc(XD3 * YD3 * sizeof(uint8));
+    if (!im3 || !ii3)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    pal1 = (uint8 *) HDmalloc(768 * sizeof(char));
+    pal2 = (uint8 *) HDmalloc(768 * sizeof(char));
+    ipal = (uint8 *) HDmalloc(768 * sizeof(char));
+    if (!ipal || !pal1 || !pal2)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    jpeg_8bit_temp = (uint8 *) HDmalloc(JPEGX * JPEGY);
+    if (!jpeg_8bit_temp)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    for (y = 0; y < YD1; y++)
+        for (x = 0; x < XD1; x++)
+            im1[y * XD1 + x] = (uint8) (x + y);
+    for (y = 0; y < YD2; y++)
+        for (x = 0; x < XD2; x++)
+            im2[y * XD2 + x] = (uint8) ((2 * x + y) - 256 * ((2 * x + y) / 256));
+    for (y = 0; y < YD3; y++)
+        for (x = 0; x < XD3; x++)
+            im3[y * XD3 + x] = (uint8) ((3 * x + y) - 256 * ((3 * x + y) / 256));
+    for (x = 0; x < 256; x++)
+      {
+          pal1[3 * x] = (uint8) x;
+          pal1[3 * x + 1] = (uint8) x;
+          pal1[3 * x + 2] = (uint8) x;
+          pal2[x] = (uint8) x;
+          pal2[x + 256] = (uint8) x;
+          pal2[x + 512] = (uint8) x;
+      }
+
+    /* start here */
+
+    MESSAGE(5, printf("Storing 8bit raster images\n");
+        );
+    ret = DFR8setpalette(pal1);
+    RESULT("DFR8setpalette");
+
+    MESSAGE(5, printf("Putting image with no compression\n");
+        );
+    ret = DFR8putimage(TESTFILE_R8, im1, XD1, YD1, 0);
+    RESULT("DFR8putimage");
+    num_images++;
+    ref1 = DFR8lastref();
+
+    MESSAGE(5, printf("Putting image RLE compression\n");
+        );
+    ret = DFR8addimage(TESTFILE_R8, im2, XD2, YD2, DFTAG_RLE);
+    RESULT("DFR8addimage");
+    num_images++;
+    ref2 = DFR8lastref();
+
+#ifdef DONT_TEST_IMCOMP     /* QAK */
+    ret = DFR8setpalette(pal2);
+    RESULT("DFR8setpalette");
+    MESSAGE(5, printf("Putting image IMCOMP compression\n");
+        );
+    ret = DFR8addimage(TESTFILE_R8, im3, XD3, YD3, DFTAG_IMCOMP);
+    RESULT("DFR8addimage");
+    num_images++;
+    ref3 = DFR8lastref();
+#endif /* DONT_TEST_IMCOMP */     /* QAK */
+
+    ret = DFR8nimages(TESTFILE_R8);
+    if (ret != num_images)
+      {
+          fprintf(stderr, "        >>> WRONG NUMBER OF IMAGES <<<\n");
+          num_errs++;
+      }
+
+    MESSAGE(5, printf("Reading and verifying 8bit raster images\n");
+        );
+
+    ret = DFR8restart();
+    RESULT("DFR8restart");
+
+    MESSAGE(5, printf("Verifying uncompressed image\n");
+        );
+
+    ret = DFR8getdims(TESTFILE_R8, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+    ret = DFR8getimage(TESTFILE_R8, (uint8 *) ii1, (int32) XD1, (int32) YD1, ipal);
+    RESULT("DFR8getimage");
+    check_im_pal(XD1, YD1, xd, yd, im1, ii1, pal1, ipal);
+
+    MESSAGE(5, printf("Verifying RLE compressed image\n");
+        );
+
+    ret = DFR8getdims(TESTFILE_R8, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+
+#ifdef DONT_TEST_IMCOMP /* QAK */
+    MESSAGE(5, printf("Verifying IMCOMP compressed image\n");
+        );
+
+    ret = DFR8getdims(TESTFILE_R8, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+    ret = DFR8getimage(TESTFILE_R8, (uint8 *) ii3, (int32) XD3, (int32) YD3, ipal);
+    RESULT("DFR8getimage");
+#endif /* DONT_TEST_IMCOMP */     /* QAK */
+
+    MESSAGE(5, printf("Rechecking RLE image\n");
+        );
+
+    ret = DFR8readref(TESTFILE_R8, ref2);
+    RESULT("DFR8readref");
+    ret = DFR8getimage(TESTFILE_R8, (uint8 *) ii2, (int32) XD2, (int32) YD2, ipal);
+    RESULT("DFR8getimage");
+    check_im_pal(XD2, YD2, XD2, YD2, im2, ii2, pal1, ipal);
+
+    MESSAGE(5, printf("Changing palette of first image\n");
+        );
+
+    ret = DFR8writeref(TESTFILE_R8, ref1);
+    RESULT("DFR8writeref");
+    ret = DFR8setpalette(pal2);
+    RESULT("DFR8setpalette");
+    ret = DFR8addimage(TESTFILE_R8, im1, XD1, YD1, DFTAG_RLE);
+    RESULT("DFR8addimage");
+
+    MESSAGE(5, printf("Verifying palette change\n");
+        );
+
+    ret = DFR8readref(TESTFILE_R8, ref1);
+    RESULT("DFR8readref");
+    ret = DFR8getdims(TESTFILE_R8, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+    ret = DFR8getimage(TESTFILE_R8, (uint8 *) ii1, (int32) XD1, (int32) YD1, ipal);
+    RESULT("DFR8getimage");
+    check_im_pal(XD1, YD1, xd, yd, im1, ii1, pal2, ipal);
+
+    MESSAGE(5, printf("\nStoring 8-bit images with JPEG compression\n");
+        );
+
+    MESSAGE(6, printf("Storing first image with JPEG quality 80\n");
+        );
+    cinfo.jpeg.quality = 80;
+    cinfo.jpeg.force_baseline = TRUE;
+    DFR8setcompress(COMP_JPEG, &cinfo);
+    ret = DFR8putimage(JPEGFILE, jpeg_8bit_orig, JPEGX, JPEGY, COMP_JPEG);
+    RESULT("DFR8putimage");
+
+    MESSAGE(6, printf("Storing second image with JPEG quality 30\n");
+        );
+    cinfo.jpeg.quality = 30;
+    cinfo.jpeg.force_baseline = TRUE;
+    DFR8setcompress(COMP_JPEG, &cinfo);
+    ret = DFR8addimage(JPEGFILE, jpeg_8bit_orig, JPEGX, JPEGY, COMP_JPEG);
+    RESULT("DFR8addimage");
+
+    MESSAGE(6, printf("Storing third image with JPEG default quality of 75\n");
+        );
+    ret = DFR8addimage(JPEGFILE, jpeg_8bit_orig, JPEGX, JPEGY, COMP_JPEG);
+    RESULT("DFR8addimage");
+
+    MESSAGE(5, printf("\nReading and verifying 8-bit JPEG'ed images\n\n");
+        );
+
+    ret = DFR8restart();
+    RESULT("DFR8restart");
+
+    ret = DFR8getdims(JPEGFILE, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+
+    if ((xd != JPEGX) || (yd != JPEGY))
+      {
+          fprintf(stderr, "Returned meta-data is wrong for JPEG quality 80 image\n");
+          num_errs++;
+      }
+
+    ret = DFR8getimage(JPEGFILE, (uint8 *) jpeg_8bit_temp, JPEGX, JPEGY, NULL);
+    RESULT("DFR8getimage");
+
+    if (HDmemcmp(jpeg_8bit_temp, jpeg_8bit_j80, sizeof(jpeg_8bit_orig)))
+      {
+          fprintf(stderr, "8-bit JPEG quality 80 image was incorrect\n");
+          num_errs++;
+      }
+
+    ret = DFR8getdims(JPEGFILE, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+
+    if ((xd != JPEGX) || (yd != JPEGY))
+      {
+          fprintf(stderr, "Returned meta-data is wrong for JPEG quality 30 image\n");
+          num_errs++;
+      }
+
+    ret = DFR8getimage(JPEGFILE, (uint8 *) jpeg_8bit_temp, JPEGX, JPEGY, NULL);
+    RESULT("DFR8getimage");
+
+    if (HDmemcmp(jpeg_8bit_temp, jpeg_8bit_j30, sizeof(jpeg_8bit_orig)))
+      {
+          fprintf(stderr, "8-bit JPEG quality 30 image was incorrect\n");
+          num_errs++;
+      }
+
+    ret = DFR8getdims(JPEGFILE, &xd, &yd, &ispal);
+    RESULT("DFR8getdims");
+
+    if ((xd != JPEGX) || (yd != JPEGY))
+      {
+          fprintf(stderr, "Returned meta-data is wrong for JPEG quality 75 image\n");
+          num_errs++;
+      }
+
+    ret = DFR8getimage(JPEGFILE, (uint8 *) jpeg_8bit_temp, JPEGX, JPEGY, NULL);
+    RESULT("DFR8getimage");
+
+    if (HDmemcmp(jpeg_8bit_temp, jpeg_8bit_j75, sizeof(jpeg_8bit_orig)))
+      {
+          fprintf(stderr, "8-bit JPEG quality 75 image was incorrect\n");
+          num_errs++;
+      }
+
+    HDfree(im1);
+    HDfree(ii1);
+    HDfree(im2);
+    HDfree(ii2);
+    HDfree(im3);
+    HDfree(ii3);
+    HDfree(pal1);
+    HDfree(pal2);
+    HDfree(ipal);
+    HDfree(jpeg_8bit_temp);
+
+    /* Temporarily call to test GRgetcomptype() for hmap project; these tests
+       will need to be reformatted. Mar 13, 2011 -BMR */
+    test_GRgetcomptype();
+}
+
+void
+test_pal(void)
+{
+    int         i;
+    int         ret;
+    uint16      ref1, ref2;
+
+    uint8       *pal1, *pal2, *ipal;
+
+    pal1 = (uint8 *) HDmalloc(768 * sizeof(uint8));
+    pal2 = (uint8 *) HDmalloc(768 * sizeof(uint8));
+    ipal = (uint8 *) HDmalloc(768 * sizeof(uint8));
+    if (!ipal || !pal1 || !pal2)
+      {
+          fprintf(stderr, "Out of memory!\n");
+          exit(1);
+      }
+
+    for (i = 0; i < 256; i++)
+      {
+          pal1[3 * i] = (uint8) i;
+          pal1[3 * i + 1] = (uint8) i;
+          pal1[3 * i + 2] = (uint8) i;
+          pal2[i] = (uint8) i;
+          pal2[i + 256] = (uint8) i;
+          pal2[i + 512] = (uint8) i;
+      }
+
+    MESSAGE(5, printf("Adding palettes to a file\n");
+        );
+
+    ret = DFPputpal(TESTFILE, pal1, 0, "w");
+    RESULT("DFPputpal");
+    ref1 = DFPlastref();
+
+    ret = DFPaddpal(TESTFILE, pal2);
+    RESULT("DFPaddpal");
+    ref2 = DFPlastref();
+
+    MESSAGE(5, printf("Reading and verifying palettes\n");
+        );
+
+    ret = DFPrestart();
+    RESULT("DFPrestart");
+
+    /* read and check palette 1 */
+    ret = DFPgetpal(TESTFILE, ipal);
+    RESULT("DFPgetpal");
+    if(HDmemcmp(ipal,pal1,768)!=0)
+        for (i = 0; i < 768; i++)
+            if ((uint8)pal1[i] != (uint8)ipal[i])
+                printf("Error at %d, ipal %d pal1 %d\n", (int)i, (int)ipal[i], (int)pal1[i]);
+
+    if (ref1 != DFPlastref())
+      {
+          fprintf(stderr, "  >>> DFPlastref() bad for palette 1 <<<\n");
+          num_errs++;
+      }
+
+    /* read and check palette 2 */
+    ret = DFPgetpal(TESTFILE, ipal);
+    RESULT("DFPgetpal");
+    if(HDmemcmp(ipal,pal2,768)!=0)
+        for (i = 0; i < 768; i++)
+            if ((uint8)ipal[i] != (uint8)pal2[i])
+                printf("Error at %d, ipal %d pal2 %d\n", (int)i, (int)ipal[i], (int)pal2[i]);
+
+    if (ref2 != DFPlastref())
+      {
+          fprintf(stderr, "  >>> DFPlastref() bad for palette 2 <<<\n");
+          num_errs++;
+      }
+
+    if (DFPnpals(TESTFILE) != 2)
+      {
+          fprintf(stderr, "  >>> DFPnpals() gives wrong number <<<\n");
+          num_errs++;
+      }
+
+    /* recheck palette number 2 */
+    ret = DFPreadref(TESTFILE, ref2);
+    RESULT("DFPreadref");
+    ret = DFPgetpal(TESTFILE, ipal);
+    RESULT("DFPgetpal");
+    if(HDmemcmp(ipal,pal2,768)!=0)
+        for (i = 0; i < 768; i++)
+            if (ipal[i] != pal2[i])
+                printf("Error at %d, ipal %d pal2 %d\n", i, ipal[i], pal2[i]);
+
+    /* recheck palette number 1 */
+    ret = DFPreadref(TESTFILE, ref1);
+    RESULT("DFPreadref");
+    ret = DFPgetpal(TESTFILE, ipal);
+    RESULT("DFPgetpal");
+    if(HDmemcmp(ipal,pal1,768)!=0)
+        for (i = 0; i < 768; i++)
+            if (ipal[i] != pal1[i])
+                printf("Error at %d, ipal %d pal1 %d\n", i, ipal[i], pal1[i]);
+
+    MESSAGE(5, printf("Modifying first palette\n");
+        );
+    for (i = 0; i < 256; i++)
+        pal1[i + 256] = (uint8) (255 - i);
+    ret = DFPwriteref(TESTFILE, ref1);
+    RESULT("DFPwriteref");
+
+    ret = DFPputpal(TESTFILE, pal1, 1, "a");
+    RESULT("DFPputpal");
+
+    ret = DFPreadref(TESTFILE, ref1);
+    RESULT("DFPreafref");
+
+    ret = DFPgetpal(TESTFILE, ipal);
+    RESULT("DFPgetpal");
+    if(HDmemcmp(ipal,pal1,768)!=0)
+        for (i = 0; i < 768; i++)
+            if (ipal[i] != pal1[i])
+                printf("(%d) Error at %d, ipal %d pal1 %d\n", __LINE__,i, ipal[i], pal1[i]);
+    HDfree(pal1);
+    HDfree(pal2);
+    HDfree(ipal);
+}
diff --git a/hdf/test/sdmms.c b/hdf/test/sdmms.c
new file mode 100644
index 0000000..b902dde
--- /dev/null
+++ b/hdf/test/sdmms.c
@@ -0,0 +1,461 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6035 $";
+#endif
+
+/* $Id: sdmms.c 6035 2014-01-19 07:19:17Z bmribler $ */
+
+#include "tproto.h"
+
+static float32  f32[10][10],  tf32[10][10];
+static float32  f32scale[10],  tf32scale[10];
+static float32 f32max = (float32) 40.0, f32min = (float32) 0.0;
+static float32 tf32max, tf32min;
+
+static int8  i8[10][10],  ti8[10][10];
+static int8  i8scale[10],  ti8scale[10];
+static int8 i8max = 127, i8min = -128;
+static int8 ti8max, ti8min;
+
+static uint8  ui8[10][10],  tui8[10][10];
+static uint8  ui8scale[10],  tui8scale[10];
+static uint8 ui8max = 255, ui8min = 0;
+static uint8 tui8max, tui8min;
+
+static int16  i16[10][10],  ti16[10][10];
+static int16  i16scale[10],  ti16scale[10];
+static int16 i16max = 1200, i16min = -1200;
+static int16 ti16max, ti16min;
+
+static uint16  ui16[10][10],  tui16[10][10];
+static uint16  ui16scale[10],  tui16scale[10];
+static uint16 ui16max = 20000, ui16min = 0;
+static uint16 tui16max, tui16min;
+
+static int32  i32[10][10],  ti32[10][10];
+static int32  i32scale[10],  ti32scale[10];
+static int32 i32max = 99999999, i32min = -999999999;
+static int32 ti32max, ti32min;
+
+static uint32  ui32[10][10],  tui32[10][10];
+static uint32  ui32scale[10],  tui32scale[10];
+static uint32 ui32max = 999999999, ui32min = 0;
+static uint32 tui32max, tui32min;
+
+static float64 cal1, cal2, cal3, cal4;
+static int32 cal5;
+
+static float64 ical1, ical2, ical3, ical4;
+static int32 ical5;
+
+void
+test_sdmms(void)
+{
+    uint32      i, j;
+    int		err, err1, err2, ret;
+    intn        rank;
+    int32       dims[2];
+
+    rank = 2;
+    dims[0] = 10;
+    dims[1] = 10;
+
+    MESSAGE(5, printf("Creating arrays...\n");
+        );
+
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+            {
+                f32[i][j] = (float32)((i * 40) + j);   /* range: 0 ~ 4-billion */
+
+                i8[i][j] = (int8) ((i * 20) - 100 + j);     /* range: 0 ~ 100 */
+                ui8[i][j] = (uint8) ((i * 20) + j);     /* range: 0 ~ 200 */
+
+                i16[i][j] = (int16) ((i * 6000) - 30000 + j);   /* range: 0 ~ 30000 */
+                ui16[i][j] = (uint16) ((i * 6000) + j);     /* range: 0 ~ 60000 */
+
+                i32[i][j] = (int32) ((i * 60000) - 300000 + j);     /* range: 0 ~ 2-billion */
+                ui32[i][j] = (uint32) ((i * 400000000U) + j);    /* range: 0 ~ 4-billion */
+            }
+
+          f32scale[i] = (float32) ((i * 40) + j);   /* range: 0 ~ 4-billion */
+
+          i8scale[i] = (int8) ((i * 20) - 100 + j);     /* range: 0 ~ 100 */
+          ui8scale[i] = (uint8) ((i * 20) + j);     /* range: 0 ~ 200 */
+
+          i16scale[i] = (int16) ((i * 6000) - 30000 + j);   /* range: 0 ~ 30000 */
+          ui16scale[i] = (uint16) ((i * 6000) + j);     /* range: 0 ~ 60000 */
+
+          i32scale[i] = (int32) ((i * 60000) - 300000 + j);     /* range: 0 ~ 2-billion */
+          ui32scale[i] = (uint32) ((i * 400000000U) + j);    /* range: 0 ~ 4-billion */
+      }
+
+    cal1 = (float64) 10.0;
+    cal2 = (float64) 0.0;
+    cal3 = (float64) 27.0;
+    cal4 = (float64) 1.5;
+    cal5 = (int32) DFNT_INT16;
+
+    ret = DFSDsetdims(rank, dims);
+    RESULT("DFSDsetdims");
+    MESSAGE(5, printf("Writing arrays to single file...\n");
+        );
+    ret = DFSDsetNT(DFNT_FLOAT32);
+    RESULT("DFSDsetNT");
+
+    ret = DFSDsetdimscale(1, (int32) 10, (void *) f32scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &f32max, (VOIDP) &f32min);
+    RESULT("DFSDsetrange");
+    ret = DFSDsetcal(cal1, cal2, cal3, cal4, cal5);
+    RESULT("DFSDsetcal");
+    ret = DFSDputdata("ntcheck.hdf", rank, dims, (VOIDP) f32);
+    RESULT("DFSDputdata");
+
+    ret = DFSDsetNT(DFNT_INT8);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (void *) i8scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &i8max, (VOIDP) &i8min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("ntcheck.hdf", rank, dims, (VOIDP) i8);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_UINT8);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (void *) ui8scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &ui8max, (VOIDP) &ui8min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("ntcheck.hdf", rank, dims, (VOIDP) ui8);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_INT16);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (void *) i16scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &i16max, (VOIDP) &i16min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("ntcheck.hdf", rank, dims, (VOIDP) i16);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_UINT16);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (void *) ui16scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &ui16max, (VOIDP) &ui16min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("ntcheck.hdf", rank, dims, (VOIDP) ui16);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_INT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (void *) i32scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &i32max, (VOIDP) &i32min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("ntcheck.hdf", rank, dims, (VOIDP) i32);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_UINT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (void *) ui32scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &ui32max, (VOIDP) &ui32min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("ntcheck.hdf", rank, dims, (VOIDP) ui32);
+    RESULT("DFSDadddata");
+
+    MESSAGE(5, printf("Reading arrays from single file...\n");
+        );
+
+    ret = DFSDgetdata("ntcheck.hdf", rank, dims, (VOIDP) tf32);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (void *) tf32scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tf32max, (VOIDP) &tf32min);
+    RESULT("DFSDgetrange");
+    ret = DFSDgetcal(&ical1, &ical2, &ical3, &ical4, &ical5);
+    RESULT("DFSDgetcal");
+
+    ret = DFSDgetdata("ntcheck.hdf", rank, dims, (VOIDP) ti8);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (void *) ti8scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &ti8max, (VOIDP) &ti8min);
+    RESULT("DFSDgetrange");
+
+    /* this test should return FAIL so that we can verify that
+       when we don't store calibration info we don't get any
+       info returned */
+    ret = DFSDgetcal(&ical1, &ical2, &ical3, &ical4, &ical5);
+    CHECK_VOID(ret, SUCCEED, "DFSDgetcal");
+
+    ret = DFSDgetdata("ntcheck.hdf", rank, dims, (VOIDP) tui8);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (void *) tui8scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tui8max, (VOIDP) &tui8min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("ntcheck.hdf", rank, dims, (VOIDP) ti16);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (void *) ti16scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &ti16max, (VOIDP) &ti16min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("ntcheck.hdf", rank, dims, (VOIDP) tui16);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (void *) tui16scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tui16max, (VOIDP) &tui16min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("ntcheck.hdf", rank, dims, (VOIDP) ti32);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (void *) ti32scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &ti32max, (VOIDP) &ti32min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("ntcheck.hdf", rank, dims, (VOIDP) tui32);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (void *) tui32scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tui32max, (VOIDP) &tui32min);
+    RESULT("DFSDgetrange");
+
+    MESSAGE(5, printf("Checking arrays from single file...\n\n");
+        );
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (f32[i][j] != tf32[i][j])
+                  err = 1;
+          if (f32scale[i] != tf32scale[i])
+              err2 = 1;
+      }
+    if ((f32max != tf32max) || (f32min != tf32min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5,
+            {
+            if (err == 1)
+            printf(">>> Test failed for float32 array.\n");
+            else
+            printf("Test passed for float32 array.\n");
+            }
+    ) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for float32 scales.\n");
+            else
+            printf("Test passed for float32 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for float32 max/min.\n");
+            else
+            printf("Test passed for float32 max/min.\n");) ;
+
+    if ((cal1 != ical1) ||
+        (cal2 != ical2) ||
+        (cal3 != ical3) ||
+        (cal4 != ical4) ||
+        (cal5 != ical5))
+      {
+          MESSAGE(5, printf(">>> Test failed for float32 calibration.\n");
+              );
+          MESSAGE(5, printf(" Is %f %f %f %f %d\n", ical1, ical2, ical3, ical4, (int) ical5);
+              );
+          MESSAGE(5, printf(" sld be %f %f %f %f %d\n", cal1, cal2, cal3, cal4, (int) cal5);
+              );
+      }
+    else
+        MESSAGE(5, printf("Test passed for float32 calibration.\n");
+        );
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (i8[i][j] != ti8[i][j])
+                  err = 1;
+          if (i8scale[i] != ti8scale[i])
+              err2 = 1;
+      }
+    if ((i8max != ti8max) || (i8min != ti8min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for int8 array.\n");
+            else
+            printf("Test passed for int8 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for int8 scales.\n");
+            else
+            printf("Test passed for int8 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for int8 max/min.\n");
+            else
+            printf("Test passed for int8 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (ui8[i][j] != tui8[i][j])
+                  err = 1;
+          if (ui8scale[i] != tui8scale[i])
+              err2 = 1;
+      }
+    if ((ui8max != tui8max) || (ui8min != tui8min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for uint8 array.\n");
+            else
+            printf("Test passed for uint8 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for uint8 scales.\n");
+            else
+            printf("Test passed for uint8 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for uint8 max/min.\n");
+            else
+            printf("Test passed for uint8 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (i16[i][j] != ti16[i][j])
+                  err = 1;
+          if (i16scale[i] != ti16scale[i])
+              err2 = 1;
+      }
+    if ((i16max != ti16max) || (i16min != ti16min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for int16 array.\n");
+            else
+            printf("Test passed for int16 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for int16 scales.\n");
+            else
+            printf("Test passed for int16 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for int16 max/min.\n");
+            else
+            printf("Test passed for int16 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (ui16[i][j] != tui16[i][j])
+                  err = 1;
+          if (ui16scale[i] != tui16scale[i])
+              err2 = 1;
+      }
+    if ((ui16max != tui16max) || (ui16min != tui16min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for uint16 array.\n");
+            else
+            printf("Test passed for uint16 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for uint16 scales.\n");
+            else
+            printf("Test passed for uint16 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for uint16 max/min.\n");
+            else
+            printf("Test passed for uint16 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (i32[i][j] != ti32[i][j])
+                  err = 1;
+          if (i32scale[i] != ti32scale[i])
+              err2 = 1;
+      }
+    if ((i32max != ti32max) || (i32min != ti32min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for int32 array.\n");
+            else
+            printf("Test passed for int32 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for int32 scales.\n");
+            else
+            printf("Test passed for int32 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for int32 max/min.\n");
+            else
+            printf("Test passed for int32 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (ui32[i][j] != tui32[i][j])
+                  err = 1;
+          if (ui32scale[i] != tui32scale[i])
+              err2 = 1;
+      }
+    if ((ui32max != tui32max) || (ui32min != tui32min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for uint32 array.\n");
+            else
+            printf("Test passed for uint32 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for uint32 scales.\n");
+            else
+            printf("Test passed for uint32 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for uint32 max/min.\n");
+            else
+            printf("Test passed for uint32 max/min.\n");) ;
+
+}
diff --git a/hdf/test/sdnmms.c b/hdf/test/sdnmms.c
new file mode 100644
index 0000000..a88e472
--- /dev/null
+++ b/hdf/test/sdnmms.c
@@ -0,0 +1,473 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: sdnmms.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+#include "tproto.h"
+
+static float64  f64[10][10],  tf64[10][10];
+static float64  f64scale[10],  tf64scale[10];
+static float64 f64max = (float64) 40.0, f64min = (float64) 0.0;
+static float64 tf64max, tf64min;
+
+static float32  f32[10][10],  tf32[10][10];
+static float32  f32scale[10],  tf32scale[10];
+static float32 f32max = (float32) 40.0, f32min = (float32) 0.0;
+static float32 tf32max, tf32min;
+
+static int8  i8[10][10],  ti8[10][10];
+static int8  i8scale[10],  ti8scale[10];
+static int8 i8max = 127, i8min = -128;
+static int8 ti8max, ti8min;
+
+static uint8  ui8[10][10],  tui8[10][10];
+static uint8  ui8scale[10],  tui8scale[10];
+static uint8 ui8max = 255, ui8min = 0;
+static uint8 tui8max, tui8min;
+
+static int16  i16[10][10],  ti16[10][10];
+static int16  i16scale[10],  ti16scale[10];
+static int16 i16max = 1200, i16min = -1200;
+static int16 ti16max, ti16min;
+
+static uint16  ui16[10][10],  tui16[10][10];
+static uint16  ui16scale[10],  tui16scale[10];
+static uint16 ui16max = 20000, ui16min = 0;
+static uint16 tui16max, tui16min;
+
+static int32  i32[10][10],  ti32[10][10];
+static int32  i32scale[10],  ti32scale[10];
+static int32 i32max = 99999999, i32min = -999999999;
+static int32 ti32max, ti32min;
+
+static uint32  ui32[10][10],  tui32[10][10];
+static uint32  ui32scale[10],  tui32scale[10];
+static uint32 ui32max = 999999999, ui32min = 0;
+static uint32 tui32max, tui32min;
+
+void
+test_sdnmms(void)
+{
+    int         i, j, err, err1, err2, ret;
+    intn        rank;
+    int32       dims[2];
+
+    rank = 2;
+    dims[0] = 10;
+    dims[1] = 10;
+
+    MESSAGE(5, printf("Creating arrays...\n");
+        );
+
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+            {
+
+                f64[i][j] = (float64)((i * 40) + j);   /* range: 0 ~ 4-billion */
+
+                f32[i][j] = (float32)((i * 40) + j);   /* range: 0 ~ 4-billion */
+
+                i8[i][j] = (int8) ((i * 10) + j);   /* range: 0 ~ 100 */
+                ui8[i][j] = (uint8) ((i * 20) + j);     /* range: 0 ~ 200 */
+
+                i16[i][j] = (int16) ((i * 3000) + j);   /* range: 0 ~ 30000 */
+                ui16[i][j] = (uint16) ((i * 6000) + j);     /* range: 0 ~ 60000 */
+
+                i32[i][j] = (int32) ((i * 20) + j);     /* range: 0 ~ 2-billion */
+                ui32[i][j] = (uint32) ((i * 40) + j);   /* range: 0 ~ 4-billion */
+            }
+
+          f64scale[i] = (float64)((i * 40) + j);   /* range: 0 ~ 4-billion */
+
+          f32scale[i] = (float32) ((i * 40) + j);   /* range: 0 ~ 4-billion */
+
+          i8scale[i] = (int8) ((i * 10) + j);   /* range: 0 ~ 100 */
+          ui8scale[i] = (uint8) ((i * 20) + j);     /* range: 0 ~ 200 */
+
+          i16scale[i] = (int16) ((i * 3000) + j);   /* range: 0 ~ 30000 */
+          ui16scale[i] = (uint16) ((i * 6000) + j);     /* range: 0 ~ 60000 */
+
+          i32scale[i] = (int32) ((i * 20) + j);     /* range: 0 ~ 2-billion */
+          ui32scale[i] = (uint32) ((i * 40) + j);   /* range: 0 ~ 4-billion */
+      }
+
+    ret = DFSDsetdims(rank, dims);
+    RESULT("DFSDsetdims");
+
+    MESSAGE(5, printf("Writing arrays to single file...\n");
+        );
+
+    ret = DFSDsetNT(DFNT_NFLOAT64);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) f64scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &f64max, (VOIDP) &f64min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) f64);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_NFLOAT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) f32scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &f32max, (VOIDP) &f32min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) f32);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_NINT8);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) i8scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &i8max, (VOIDP) &i8min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) i8);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_NUINT8);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) ui8scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &ui8max, (VOIDP) &ui8min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) ui8);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_NINT16);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) i16scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &i16max, (VOIDP) &i16min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) i16);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_NUINT16);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) ui16scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &ui16max, (VOIDP) &ui16min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) ui16);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_NINT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) i32scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &i32max, (VOIDP) &i32min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) i32);
+    RESULT("DFSDadddata");
+
+    ret = DFSDsetNT(DFNT_NUINT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdimscale(1, (int32) 10, (VOIDP) ui32scale);
+    RESULT("DFSDsetdimscale");
+    ret = DFSDsetrange((VOIDP) &ui32max, (VOIDP) &ui32min);
+    RESULT("DFSDsetrange");
+    ret = DFSDadddata("nntcheck.hdf", rank, dims, (VOIDP) ui32);
+    RESULT("DFSDadddata");
+
+    MESSAGE(5, printf("Reading arrays from single file...\n");
+        );
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) tf64);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) tf64scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tf64max, (VOIDP) &tf64min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) tf32);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) tf32scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tf32max, (VOIDP) &tf32min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) ti8);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) ti8scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &ti8max, (VOIDP) &ti8min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) tui8);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) tui8scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tui8max, (VOIDP) &tui8min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) ti16);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) ti16scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &ti16max, (VOIDP) &ti16min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) tui16);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) tui16scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tui16max, (VOIDP) &tui16min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) ti32);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) ti32scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &ti32max, (VOIDP) &ti32min);
+    RESULT("DFSDgetrange");
+
+    ret = DFSDgetdata("nntcheck.hdf", rank, dims, (VOIDP) tui32);
+    RESULT("DFSDgetdata");
+    ret = DFSDgetdimscale(1, (int32) 10, (VOIDP) tui32scale);
+    RESULT("DFSDgetdimscale");
+    ret = DFSDgetrange((VOIDP) &tui32max, (VOIDP) &tui32min);
+    RESULT("DFSDgetrange");
+
+    MESSAGE(5, printf("Checking arrays from single file...\n\n");
+        );
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (f64[i][j] != tf64[i][j])
+                  err = 1;
+          if (f64scale[i] != tf64scale[i])
+              err2 = 1;
+      }
+    if ((f64max != tf64max) || (f64min != tf64min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for float64 array.\n");
+            else
+            printf("Test passed for float64 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for float64 scales.\n");
+            else
+            printf("Test passed for float64 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for float64 max/min.\n");
+            else
+            printf("Test passed for float64 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (f32[i][j] != tf32[i][j])
+                  err = 1;
+          if (f32scale[i] != tf32scale[i])
+              err2 = 1;
+      }
+    if ((f32max != tf32max) || (f32min != tf32min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for float32 array.\n");
+            else
+            printf("Test passed for float32 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for float32 scales.\n");
+            else
+            printf("Test passed for float32 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for float32 max/min.\n");
+            else
+            printf("Test passed for float32 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (i8[i][j] != ti8[i][j])
+                  err = 1;
+          if (i8scale[i] != ti8scale[i])
+              err2 = 1;
+      }
+    if ((i8max != ti8max) || (i8min != ti8min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for int8 array.\n");
+            else
+            printf("Test passed for int8 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for int8 scales.\n");
+            else
+            printf("Test passed for int8 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for int8 max/min.\n");
+            else
+            printf("Test passed for int8 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (ui8[i][j] != tui8[i][j])
+                  err = 1;
+          if (ui8scale[i] != tui8scale[i])
+              err2 = 1;
+      }
+    if ((ui8max != tui8max) || (ui8min != tui8min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for uint8 array.\n");
+            else
+            printf("Test passed for uint8 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for uint8 scales.\n");
+            else
+            printf("Test passed for uint8 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for uint8 max/min.\n");
+            else
+            printf("Test passed for uint8 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (i16[i][j] != ti16[i][j])
+                  err = 1;
+          if (i16scale[i] != ti16scale[i])
+              err2 = 1;
+      }
+    if ((i16max != ti16max) || (i16min != ti16min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for int16 array.\n");
+            else
+            printf("Test passed for int16 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for int16 scales.\n");
+            else
+            printf("Test passed for int16 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for int16 max/min.\n");
+            else
+            printf("Test passed for int16 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (ui16[i][j] != tui16[i][j])
+                  err = 1;
+          if (ui16scale[i] != tui16scale[i])
+              err2 = 1;
+      }
+    if ((ui16max != tui16max) || (ui16min != tui16min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for uint16 array.\n");
+            else
+            printf("Test passed for uint16 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for uint16 scales.\n");
+            else
+            printf("Test passed for uint16 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for uint16 max/min.\n");
+            else
+            printf("Test passed for uint16 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (i32[i][j] != ti32[i][j])
+                  err = 1;
+          if (i32scale[i] != ti32scale[i])
+              err2 = 1;
+      }
+    if ((i32max != ti32max) || (i32min != ti32min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for int32 array.\n");
+            else
+            printf("Test passed for int32 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for int32 scales.\n");
+            else
+            printf("Test passed for int32 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for int32 max/min.\n");
+            else
+            printf("Test passed for int32 max/min.\n");) ;
+
+    err = 0;
+    err1 = 0;
+    err2 = 0;
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+              if (ui32[i][j] != tui32[i][j])
+                  err = 1;
+          if (ui32scale[i] != tui32scale[i])
+              err2 = 1;
+      }
+    if ((ui32max != tui32max) || (ui32min != tui32min))
+        err1 = 1;
+
+    num_errs += err + err1 + err2;
+    MESSAGE(5, if (err == 1)
+            printf(">>> Test failed for uint32 array.\n");
+            else
+            printf("Test passed for uint32 array.\n");) ;
+    MESSAGE(5, if (err2 == 1)
+            printf(">>> Test failed for uint32 scales.\n");
+            else
+            printf("Test passed for uint32 scales.\n");) ;
+    MESSAGE(5, if (err1 == 1)
+            printf(">>> Test failed for uint32 max/min.\n");
+            else
+            printf("Test passed for uint32 max/min.\n");) ;
+
+}
diff --git a/hdf/test/sdstr.c b/hdf/test/sdstr.c
new file mode 100644
index 0000000..8715c54
--- /dev/null
+++ b/hdf/test/sdstr.c
@@ -0,0 +1,144 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: sdstr.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/***************************************************************
+**
+** This program tests correctness of writing and read datastrings
+** and dimension strings.
+** To avoid the '\0' inserted by HDstrncpy, compare the first 14
+** characters of output and input strings in subroutine compare()
+**
+****************************************************************/
+
+#include "tproto.h"
+
+static int  number_failed = 0;
+
+static VOID compare
+            (const char *outstring, const char *instring);
+
+void
+test_tsdstr(void)
+{
+    int         i, j, ret;
+    intn        rank;
+    int32       dims[2];
+    float32     f32[10][10], tf32[10][10];
+    const char *datalabel = "Datalabel", *dataunit = "Dataunit", *datafmt = "Datafmt",
+               *coordsys = "coordsys";
+    char        in_datalabel[256], in_dataunit[256], in_datafmt[256], in_coordsys[256];
+
+    const char  *dimlabels[2], *dimunits[2], *dimfmts[2];
+    char        in_dimlabels[2][256], in_dimunits[2][256], in_dimfmts[2][256];
+
+    rank = 2;
+    dims[0] = 10;
+    dims[1] = 10;
+
+    dimlabels[0] = "c_dim1_label_a";
+    dimunits[0] = "c_dim1_unit_a";
+    dimfmts[0] = "c_dim1_fmt_a";
+
+    dimlabels[1] = "c_dim2_label_b";
+    dimunits[1] = "c_dim2_unit_b";
+    dimfmts[1] = "c_dim2_fmt_b";
+
+    MESSAGE(5, printf("Creating arrays...\n");
+        );
+
+    for (i = 0; i < 10; i++)
+      {
+          for (j = 0; j < 10; j++)
+            {
+                f32[i][j] = (float32)((i * 10) + j);   /* range: 0 ~ 4-billion */
+            }
+      }
+
+    ret = DFSDsetdims(rank, dims);
+    RESULT("DFSDsetdims");
+    /* individual files */
+    MESSAGE(5, printf("Testing arrays in individual files...\n");
+        );
+
+    ret = DFSDsetNT(DFNT_NFLOAT32);
+    RESULT("DFSDsetNT");
+    ret = DFSDsetdims(rank, dims);
+    RESULT("DFSDsetdims");
+
+    ret = DFSDsetdatastrs(datalabel, dataunit, datafmt, coordsys);
+    RESULT("DFSDsetdatastrs");
+    ret = DFSDsetdimstrs(1, dimlabels[0], dimunits[0], dimfmts[0]);
+    RESULT("DFSDsetdimstrs");
+    ret = DFSDsetdimstrs(2, dimlabels[1], dimunits[1], dimfmts[1]);
+    RESULT("DFSDsetdimstrs");
+
+    ret = DFSDputdata("sdstrings.hdf", rank, dims, (VOIDP) f32);
+    RESULT("DFSDputdata");
+
+    ret = DFSDgetdata("sdstrings.hdf", rank, dims, (VOIDP) tf32);
+    RESULT("DFSDgetdata");
+
+    ret = DFSDgetdatastrs(in_datalabel, in_dataunit, in_datafmt, in_coordsys);
+    RESULT("DFSDgetdatastrs");
+    ret = DFSDgetdimstrs(1, in_dimlabels[0], in_dimunits[0], in_dimfmts[0]);
+    RESULT("DFSDgetdimstrs");
+    ret = DFSDgetdimstrs(2, in_dimlabels[1], in_dimunits[1], in_dimfmts[1]);
+    RESULT("DFSDgetdimstrs");
+
+    compare(datalabel, in_datalabel);
+    compare(dataunit, in_dataunit);
+    compare(datafmt, in_datafmt);
+    compare(coordsys, in_coordsys);
+
+    compare(dimlabels[0], in_dimlabels[0]);
+    compare(dimunits[0], in_dimunits[0]);
+    compare(dimfmts[0], in_dimfmts[0]);
+
+    compare(dimlabels[1], in_dimlabels[1]);
+    compare(dimunits[1], in_dimunits[1]);
+    compare(dimfmts[1], in_dimfmts[1]);
+
+    if (number_failed > 0)
+      {
+          MESSAGE(7, printf("\n\t>>> %d TESTS FAILED <<<\n\n", number_failed);
+              )
+      }
+    else
+        MESSAGE(7, printf("\n\t>>> ALL TESTS PASSED <<<\n\n");
+        )
+
+        num_errs = num_errs + number_failed;
+
+}
+
+static      VOID
+compare(const char *outstring, const char *instring)
+{
+    if (0 == HDstrcmp(outstring, instring))
+        MESSAGE(5, printf("Test passed for %s\n", outstring);
+        )
+        else
+      {
+          MESSAGE(5, printf(">>> Test failed for %s\n", outstring);
+              );
+          MESSAGE(5, printf("    Input string =  %s\n", instring);
+              );
+          number_failed++;
+      }
+}
diff --git a/hdf/test/slab.c b/hdf/test/slab.c
new file mode 100644
index 0000000..0ff1321
--- /dev/null
+++ b/hdf/test/slab.c
@@ -0,0 +1,2874 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Id: slab.c 4932 2007-09-07 17:17:23Z bmribler $";
+#endif
+
+/* $Id */
+
+/***************************************************************************
+*
+* Slab test routines slabw(), slabwf64(), slabwui16(), slabwui8(),
+*  slab1w(), slab2w(), slab3w(), slab4w()
+*
+***************************************************************************/
+/* slabwin & slabwuin do not work for all machines */
+
+#include "tproto.h"
+
+/* Internal variables */
+static int32  rank = 3;
+
+static float64  maxf64 = 123.0;
+static float64  minf64 = -1.0;
+static float64  fillf64 = 1.0;
+
+static float32  maxf32 = (float32) 123.0;
+static float32  minf32 = (float32) -1.0;
+static float32  fillf32 = (float32) 1.0;
+
+static int32  maxin = 123;
+static int32  minin = -1;
+static int32  fillin = 1;
+
+static uint32  maxuin = 123;
+static uint32  minuin = 2;
+static uint32  filluin = 1;
+
+static int32  maxi32 = 123;
+static int32  mini32 = -1;
+static int32  filli32 = 1;
+
+static uint32  maxui32 = 123;
+static uint32  minui32 = 2;
+static uint32  fillui32 = 1;
+
+static int16  maxi16 = 123;
+static int16  mini16 = -1;
+static int16  filli16 = 1;
+
+static uint16  maxui16 = 123;
+static uint16  minui16 = 2;
+static uint16  fillui16 = 1;
+
+static int8  maxi8 = 123;
+static int8  mini8 = -1;
+static int8  filli8 = 1;
+
+static uint8  maxui8 = 123;
+static uint8  minui8 = 2;
+static uint8  fillui8 = 1;
+
+/* Dimensions of slab */
+static int32  size_dims[3] =
+{2, 3, 4};                      /* size of slab dims */
+static int32  start_dims[3] =
+{1, 1, 1};                      /* starting dims  */
+static int32  stride[3] =
+{0, 0, 0};
+static int32  d_dims[3] =
+{0, 0, 0};
+
+/* luf for planes, rows and cols  */
+static const char  *lpln = "Time";
+static const char  *upln = "Second";
+static const char  *fpln = "Int32";
+static const char  *lrow = "Line";
+static const char  *urow = "Inch";
+static const char  *frow = "Int16";
+static const char  *lcol = "Column";
+static const char  *ucol = "Cm";
+static const char  *fcol = "Int32";
+
+/* scales for planes, rows, and cols */
+static float64  scplnf64[2] =
+{0.0, 100.0};
+static float64  scrowf64[3] =
+{0.0, 10.0, 20.0};
+static float64  sccolf64[4] =
+{0.0, 1.0, 2.0, 3.0};
+
+static float32  scplnf32[2] =
+{(float32) 0.0, (float32) 100.0};
+static float32  scrowf32[3] =
+{(float32) 0.0, (float32) 10.0, (float32) 20.0};
+static float32  sccolf32[4] =
+{(float32) 0.0, (float32) 1.0, (float32) 2.0, (float32) 3.0};
+
+static int32  scplnin[2] =
+{0, 100};
+static int32  scrowin[3] =
+{0, 10, 20};
+static int32  sccolin[4] =
+{0, 1, 2, 3};
+
+static uint32  scplnuin[2] =
+{0, 100};
+static uint32  scrowuin[3] =
+{0, 10, 20};
+static uint32  sccoluin[4] =
+{0, 1, 2, 3};
+
+static int32  scplni32[2] =
+{0, 100};
+static int32  scrowi32[3] =
+{0, 10, 20};
+static int32  sccoli32[4] =
+{0, 1, 2, 3};
+
+static uint32  scplnui32[2] =
+{0, 100};
+static uint32  scrowui32[3] =
+{0, 10, 20};
+static uint32  sccolui32[4] =
+{0, 1, 2, 3};
+
+static int16  scplni16[2] =
+{0, 100};
+static int16  scrowi16[3] =
+{0, 10, 20};
+static int16  sccoli16[4] =
+{0, 1, 2, 3};
+
+static uint16  scplnui16[2] =
+{0, 100};
+static uint16  scrowui16[3] =
+{0, 10, 20};
+static uint16  sccolui16[4] =
+{0, 1, 2, 3};
+
+static int8  scplni8[2] =
+{0, 100};
+static int8  scrowi8[3] =
+{0, 10, 20};
+static int8  sccoli8[4] =
+{0, 1, 2, 3};
+
+static uint8  scplnui8[2] =
+{0, 100};
+static uint8  scrowui8[3] =
+{0, 10, 20};
+static uint8  sccolui8[4] =
+{0, 1, 2, 3};
+
+/* Slabs for slabw(), slab1w(), slab2w() */
+static float32  slabw1[1][1][3] =
+{
+    {
+        {(float32) 110.0, (float32) 111.0, (float32) 112.0}}};
+static float32  slabw2[2][1][3] =
+{
+    {
+        {(float32) 20.0, (float32) 21.0, (float32) 22.0}},
+    {
+        {(float32) 120.0, (float32) 121.0, (float32) 122.0}}};
+static float32  slabw3[1][2][3] =
+{
+    {
+        {(float32) 0.0, (float32) 1.0, (float32) 2.0},
+        {(float32) 10.0, (float32) 11.0, (float32) 12.0}}};
+static float32  slabw4[1][1][3] =
+{
+    {
+        {(float32) 100.0, (float32) 101.0, (float32) 102.0}}};
+static float32  slabw5[2][3][1] =
+{
+    {
+        {(float32) 3.0},
+        {(float32) 13.0},
+        {(float32) 23.0}},
+    {
+        {(float32) 103.0},
+        {(float32) 113.0},
+        {(float32) 123.0}}};
+
+static float64  slabw1f64[1][1][3] =
+{
+    {
+        {110.0, 111.0, 112.0}}};
+static float64  slabw2f64[2][1][3] =
+{
+    {
+        {20.0, 21.0, 22.0}},
+    {
+        {120.0, 121.0, 122.0}}};
+static float64  slabw3f64[1][2][3] =
+{
+    {
+        {0.0, 1.0, 2.0},
+        {10.0, 11.0, 12.0}}};
+static float64  slabw4f64[1][1][3] =
+{
+    {
+        {100.0, 101.0, 102.0}}};
+static float64  slabw5f64[2][3][1] =
+{
+    {
+        {3.0},
+        {13.0},
+        {23.0}},
+    {
+        {103.0},
+        {113.0},
+        {123.0}}};
+
+static int32  slabw1in[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static int32  slabw2in[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static int32  slabw3in[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static int32  slabw4in[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static int32  slabw5in[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+
+static uint32  slabw1uin[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static uint32  slabw2uin[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static uint32  slabw3uin[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static uint32  slabw4uin[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static uint32  slabw5uin[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+
+static int32  slabw1i32[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static int32  slabw2i32[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static int32  slabw3i32[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static int32  slabw4i32[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static int32  slabw5i32[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+
+static uint32  slabw1ui32[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static uint32  slabw2ui32[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static uint32  slabw3ui32[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static uint32  slabw4ui32[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static uint32  slabw5ui32[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+
+static int16  slabw1i16[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static int16  slabw2i16[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static int16  slabw3i16[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static int16  slabw4i16[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static int16  slabw5i16[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+
+static uint16  slabw1ui16[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static uint16  slabw2ui16[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static uint16  slabw3ui16[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static uint16  slabw4ui16[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static uint16  slabw5ui16[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+
+static int8  slabw1i8[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static int8  slabw2i8[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static int8  slabw3i8[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static int8  slabw4i8[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static int8  slabw5i8[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+
+static uint8  slabw1ui8[1][1][3] =
+{
+    {
+        {110, 111, 112}}};
+static uint8  slabw2ui8[2][1][3] =
+{
+    {
+        {20, 21, 22}},
+    {
+        {120, 121, 122}}};
+static uint8  slabw3ui8[1][2][3] =
+{
+    {
+        {0, 1, 2},
+        {10, 11, 12}}};
+static uint8  slabw4ui8[1][1][3] =
+{
+    {
+        {100, 101, 102}}};
+static uint8  slabw5ui8[2][3][1] =
+{
+    {
+        {3},
+        {13},
+        {23}},
+    {
+        {103},
+        {113},
+        {123}}};
+/* Slabs for slab3w() */
+static float32  slab1[1][1][1] =
+{
+    {
+        {(float32) 0.0}}};
+static float32  slab2[1][1][1] =
+{
+    {
+        {(float32) 1.0}}};
+static float32  slab3[1][1][1] =
+{
+    {
+        {(float32) 2.0}}};
+static float32  slab4[1][1][1] =
+{
+    {
+        {(float32) 3.0}}};
+static float32  slab5[1][1][1] =
+{
+    {
+        {(float32) 10.0}}};
+static float32  slab6[1][1][1] =
+{
+    {
+        {(float32) 11.0}}};
+static float32  slab7[1][1][1] =
+{
+    {
+        {(float32) 12.0}}};
+static float32  slab8[1][1][1] =
+{
+    {
+        {(float32) 13.0}}};
+static float32  slab9[1][1][1] =
+{
+    {
+        {(float32) 20.0}}};
+static float32  slab10[1][1][1] =
+{
+    {
+        {(float32) 21.0}}};
+static float32  slab11[1][1][1] =
+{
+    {
+        {(float32) 22.0}}};
+static float32  slab12[1][1][1] =
+{
+    {
+        {(float32) 23.0}}};
+static float32  slab13[1][1][1] =
+{
+    {
+        {(float32) 100.0}}};
+static float32  slab14[1][1][1] =
+{
+    {
+        {(float32) 101.0}}};
+static float32  slab15[1][1][1] =
+{
+    {
+        {(float32) 102.0}}};
+static float32  slab16[1][1][1] =
+{
+    {
+        {(float32) 103.0}}};
+static float32  slab17[1][1][1] =
+{
+    {
+        {(float32) 110.0}}};
+static float32  slab18[1][1][1] =
+{
+    {
+        {(float32) 111.0}}};
+static float32  slab19[1][1][1] =
+{
+    {
+        {(float32) 112.0}}};
+static float32  slab20[1][1][1] =
+{
+    {
+        {(float32) 113.0}}};
+static float32  slab21[1][1][1] =
+{
+    {
+        {(float32) 120.0}}};
+static float32  slab22[1][1][1] =
+{
+    {
+        {(float32) 121.0}}};
+static float32  slab23[1][1][1] =
+{
+    {
+        {(float32) 122.0}}};
+static float32  slab24[1][1][1] =
+{
+    {
+        {(float32) 123.0}}};
+
+/* data array in memory  */
+static float32  fdata[2][3][4] =
+{
+    {
+        {(float32) 0.0, (float32) 1.0, (float32) 2.0, (float32) 3.0},
+        {(float32) 10.0, (float32) 11.0, (float32) 12.0, (float32) 13.0},
+        {(float32) 20.0, (float32) 21.0, (float32) 22.0, (float32) 23.0}},
+    {
+        {(float32) 100.0, (float32) 101.0, (float32) 102.0, (float32) 103.0},
+        {(float32) 110.0, (float32) 111.0, (float32) 112.0, (float32) 113.0},
+     {(float32) 120.0, (float32) 121.0, (float32) 122.0, (float32) 123.0}}};
+static float64  f64data[2][3][4] =
+{
+    {
+        {0.0, 1.0, 2.0, 3.0},
+        {10.0, 11.0, 12.0, 13.0},
+        {20.0, 21.0, 22.0, 23.0}},
+    {
+        {100.0, 101.0, 102.0, 103.0},
+        {110.0, 111.0, 112.0, 113.0},
+        {120.0, 121.0, 122.0, 123.0}}};
+static int32  indata[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+static uint32  uindata[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+static int32  i32data[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+static uint32  ui32data[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+static int16  i16data[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+static uint16  ui16data[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+static int8  i8data[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+static uint8  ui8data[2][3][4] =
+{
+    {
+        {0, 1, 2, 3},
+        {10, 11, 12, 13},
+        {20, 21, 22, 23}},
+    {
+        {100, 101, 102, 103},
+        {110, 111, 112, 113},
+        {120, 121, 122, 123}}};
+/* Output files */
+static const char  *swf32 = "swf32.hdf";
+static const char  *swf64 = "swf64.hdf";
+static const char  *swin = "swin.hdf";
+static const char  *swuin = "swuin.hdf";
+static const char  *swi32 = "swi32.hdf";
+static const char  *swui32 = "swui32.hdf";
+static const char  *swi16 = "swi16.hdf";
+static const char  *swui16 = "swui16.hdf";
+static const char  *swi8 = "swi8.hdf";
+static const char  *swui8 = "swui8.hdf";
+static const char  *sw1 = "s1w.hdf";
+static const char  *sw3 = "s3w.hdf";
+static const char  *sw4 = "s4w.hdf";
+
+static int slabwf32(void);
+static int slabwf64(void);
+static int slabwin(void);
+static int slabwuin(void);
+static int slabwi32(void);
+static int slabwui32(void);
+static int slabwi16(void);
+static int slabwui16(void);
+static int slabwi8(void);
+static int slabwui8(void);
+static int slab1w(void);
+static int slab2w(void);
+static int slab3w(void);
+static int slab4w(void);
+
+/*
+   ** Write data set to slabw.hdf as 5 hyperslabs.
+ */
+static int
+slabwf32(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    float32     sdata[2][3][4]; /* Data array read from from file */
+    float32     lfill=(float32)0.0;
+
+    MESSAGE(10, printf("\n slabwf32:  Writing 5 slabs to slabwf32.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxf32, (VOIDP) &minf32);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &fillf32);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swf32);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swf32, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != fillf32)
+        num_err++;
+    MESSAGE(10, printf("\n       fill value =: %f \n", lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwf32:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != fdata[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%f, ", sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwf32 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwf32:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write float64 data set to slabw.hdf as 5 hyperslabs.
+ */
+static int
+slabwf64(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    float64     sdata[2][3][4]; /* Data array read from from file */
+    float64     lfill=(float64)0.0;
+
+    MESSAGE(10, printf("\n slabwf64:  Writing 5 slabs to slabwf64.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_FLOAT64);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnf64);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowf64);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolf64);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxf64, (VOIDP) &minf64);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &fillf64);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swf64);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1f64);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2f64);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3f64);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4f64);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5f64);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swf64, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != fillf64)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %f \n", (float) lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwf64:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != f64data[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%f, ", (float) sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwf64 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwf64:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write int32 data set as native data type to slabwin.hdf as 5 hyperslabs.
+ */
+static int
+slabwin(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    int32        sdata[2][3][4]; /* Data array read from from file */
+    int32        lfill=0;
+
+    MESSAGE(10, printf("\n slabwin:  Writing 5 slabs to slabwin.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_NINT32);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnin);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowin);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolin);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxin, (VOIDP) &minin);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &fillin);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swin);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1in);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2in);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3in);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4in);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5in);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swin, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != fillin)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %d \n", (int)lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwin:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != indata[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%u, ", (unsigned)sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwin <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwin:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write uint32 data set as native data type to slabwuin.hdf as 5 hyperslabs.
+ */
+static int
+slabwuin(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    uint32       sdata[2][3][4]; /* Data array read from from file */
+    uint32       lfill=0;
+
+    MESSAGE(10, printf("\n slabwuin:  Writing 5 slabs to slabwuin.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_NUINT32);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnuin);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowuin);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccoluin);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxuin, (VOIDP) &minuin);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &filluin);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swuin);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1uin);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2uin);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3uin);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4uin);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5uin);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swuin, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != filluin)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %u \n", (unsigned)lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwin:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != uindata[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%u, ", (unsigned)sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwuin <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwuin:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write int32 data set to slabwi32.hdf as 5 hyperslabs.
+ */
+static int
+slabwi32(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    int32       sdata[2][3][4]; /* Data array read from from file */
+    int32       lfill=(int32)0;
+
+    MESSAGE(10, printf("\n slabwi32:  Writing 5 slabs to slabwi32.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_INT32);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplni32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowi32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccoli32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxi32, (VOIDP) &mini32);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &filli32);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swi32);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1i32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2i32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3i32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4i32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5i32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swi32, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != filli32)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %d \n", (int) lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwi32:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != i32data[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%d, ", (int) sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwi32 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwi32:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write uint32 data set to slabwui32.hdf as 5 hyperslabs.
+ */
+static int
+slabwui32(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    uint32      sdata[2][3][4]; /* Data array read from from file */
+    uint32      lfill=(uint32)0;
+
+    MESSAGE(10, printf("\n slabwui32:  Writing 5 slabs to slabwui32.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_UINT32);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnui32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowui32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolui32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxui32, (VOIDP) &minui32);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &fillui32);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swui32);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1ui32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2ui32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3ui32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4ui32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5ui32);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swui32, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != fillui32)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %u \n", (unsigned) lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwui32:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != ui32data[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%u, ", (unsigned) sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwui32 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwui32:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write int16 data set to slabwi16.hdf as 5 hyperslabs.
+ */
+static int
+slabwi16(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    int16       sdata[2][3][4]; /* Data array read from from file */
+    int16       lfill=(int16)0;
+
+    MESSAGE(10, printf("\n slabwi16:  Writing 5 slabs to slabwi16.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_INT16);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplni16);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowi16);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccoli16);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxi16, (VOIDP) &mini16);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &filli16);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swi16);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1i16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2i16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3i16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4i16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5i16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swi16, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != filli16)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %d \n", lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwi16:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != i16data[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%d, ", sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwi16 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwi16:  %d wrong values in slab.  \n", (int) num_err);
+        )
+
+        return (int) num_err;
+}
+
+/*
+   ** Write uint16 data set to slabwui16.hdf as 5 hyperslabs.
+ */
+static int
+slabwui16(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    uint16      sdata[2][3][4]; /* Data array read from from file */
+    uint16      lfill=(uint16)0;
+
+    MESSAGE(10, printf("\n slabwui16:  Writing 5 slabs to slabwui16.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_UINT16);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnui16);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowui16);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolui16);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxui16, (VOIDP) &minui16);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &fillui16);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swui16);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1ui16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2ui16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3ui16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4ui16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5ui16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swui16, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != fillui16)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %u \n", lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwui16:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != ui16data[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%u, ", sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwui16 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwui16:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write int8 data set to slabwi8.hdf as 5 hyperslabs.
+ */
+static int
+slabwi8(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    int8        sdata[2][3][4]; /* Data array read from from file */
+    int8        lfill=(int8)0;
+
+    MESSAGE(10, printf("\n slabwi8:  Writing 5 slabs to slabwi8.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_INT8);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplni8);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowi8);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccoli8);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxi8, (VOIDP) &mini8);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &filli8);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swi8);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1i8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2i8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3i8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4i8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5i8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swi8, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != filli8)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %d \n", (int) lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwi8:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != i8data[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%d, ", (int) sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwi8 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwi8:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+/*
+   ** Write uint8 data set to slabw.hdf as 5 hyperslabs.
+ */
+static int
+slabwui8(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    uint8       sdata[2][3][4]; /* Data array read from from file */
+    uint8       lfill=(uint8)0;
+
+    MESSAGE(10, printf("\n slabwui8:  Writing 5 slabs to slabwui8.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    ret = DFSDsetNT(DFNT_UINT8);
+    CHECK(ret, FAIL, "DFSDsetNT");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnui8);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowui8);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolui8);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write data out using slabs with
+       ** each slab in different order to the file "slab.hdf"
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxui8, (VOIDP) &minui8);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &fillui8);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+
+    ret = DFSDstartslab(swui8);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1ui8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2ui8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3ui8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4ui8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5ui8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(swui8, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+    if (lfill != fillui8)
+        num_err += 1;
+    MESSAGE(10, printf("\n       fill value =: %u \n", (unsigned) lfill);
+        );
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n      slabwui8:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n  Verifying data  \n");
+        );
+    MESSAGE(10, printf("sdata = ");
+        );
+    num_err = 0;
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != ui8data[i][j][k])
+                      num_err += 1;
+                  MESSAGE(10, printf("%u, ", (unsigned) sdata[i][j][k]);
+                      );
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n       >>> All tests passed for slabwui8 <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slabwui8:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+static int
+slab1w(void)
+{
+    int32       ret = 0;
+    int32       num_err = 0;
+
+    MESSAGE(10, printf("\n slab1w: Writing the first 3 of 5 slabs to slab1w.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /* Set fill value */
+    ret = DFSDsetfillvalue((VOIDP) &fillf32);
+    CHECK(ret, FAIL, "DFSDsetfillvalue");
+    MESSAGE(10, printf("\n        slab1w: Setting fill value =%f \n", fillf32);
+        );
+
+    /*
+       ** write each slab in different order
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxf32, (VOIDP) &minf32);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    ret = DFSDstartslab(sw1);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw1);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 2;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw3);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw5);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    if (num_err == 0)
+        MESSAGE(10, printf("\n        >>> All tests passed for slab1w, now run slab2w <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n         slab1w:  %d failures.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+static int
+slab2w(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    float32     sdata[2][3][4]; /* Data array read from from file */
+    float32     lfill=(float32)0.0;
+    intn        trank;
+
+    MESSAGE(10, printf("\n slab2w:  Writing the last 2 of 5 slabs to slab1w.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    /* Get dimensions */
+    ret = DFSDgetdims(sw1, &trank, size_dims, 3);
+    CHECK(ret, FAIL, "DFSDgetdims");
+
+    /* Get fill value */
+    ret = DFSDgetfillvalue((VOIDP) &lfill);
+    CHECK(ret, FAIL, "DFSDgetfillvalue");
+
+    MESSAGE(10, printf("\n       fill value =: %f \n", lfill);
+        );
+
+    /* Call Writeref() first */
+    ret = DFSDwriteref(sw1, 2);
+    CHECK(ret, FAIL, "DFSDwriteref");
+
+    /*
+       ** write each slab in different order
+     */
+    ret = DFSDstartslab(sw1);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw2);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 3;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slabw4);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(sw1, start_dims, size_dims, stride, (VOIDP) sdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n        slab2w:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n         Verifying data \n");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (sdata[i][j][k] != fdata[i][j][k])
+                      num_err++;
+              }
+
+    if (num_err == 0)
+        MESSAGE(10, printf("\n        >>> All tests passed for slab2w <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n        slab2w:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+static int
+slab3w(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    float32     adata[2][3][4]; /* Data array read from from file */
+
+    MESSAGE(10, printf("\n slab3w: Writing all 24 elements of data as slabs to slab3w.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /*
+       ** write each element in different order
+     */
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxf32, (VOIDP) &minf32);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    ret = DFSDstartslab(sw3);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 4;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab20);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab21);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 3;
+    start_dims[2] = 2;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab22);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 3;
+    start_dims[2] = 3;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab23);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 3;
+    start_dims[2] = 4;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab24);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 2;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab6);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 3;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab7);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 4;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab8);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab9);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 2;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab10);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab16);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab17);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 2;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab18);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 2;
+    start_dims[2] = 3;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab19);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 3;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab11);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 3;
+    start_dims[2] = 4;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab12);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab13);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 2;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab14);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    start_dims[2] = 3;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab15);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab1);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 2;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab2);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 3;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab3);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 4;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab4);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 1;
+    size_dims[0] = 1;
+    size_dims[1] = 1;
+    size_dims[2] = 1;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) slab5);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(sw3, start_dims, size_dims, stride, (VOIDP) adata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n        slab3w:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n        Verifying data  \n");
+        );
+    MESSAGE(10, printf("adata = ");
+        );
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (adata[i][j][k] != fdata[i][j][k])
+                      num_err++;
+                  MESSAGE(10, printf("%f, ", adata[i][j][k]);
+                      );
+              }
+
+    if (num_err == 0)
+        MESSAGE(10, printf("\n        >>> All tests passed for slab3w <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n       slab3w:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) num_err;
+}
+
+static int
+slab4w(void)
+{
+    int32       i, j, k;
+    int32       ret = 0;
+    int32       num_err = 0;
+    float32     bdata[2][3][4]; /* Data array read from from file */
+
+    MESSAGE(10, printf("\n slab4w: Writing data as 1 slab to slab4w.hdf \n");
+        );
+
+    ret = DFSDclear();
+    CHECK(ret, FAIL, "DFSDclear");
+
+    /* First set dimensions */
+    ret = DFSDsetdims((intn) rank, size_dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set dimension strings */
+    ret = DFSDsetdimstrs(1, lpln, upln, fpln);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(2, lrow, urow, frow);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    ret = DFSDsetdimstrs(3, lcol, ucol, fcol);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Set dimension scales */
+    ret = DFSDsetdimscale(1, size_dims[0], (VOIDP) scplnf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, size_dims[1], (VOIDP) scrowf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(3, size_dims[2], (VOIDP) sccolf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    /* Set max, min range */
+    ret = DFSDsetrange((VOIDP) &maxf32, (VOIDP) &minf32);
+    CHECK(ret, FAIL, "DFSDsetrange");
+
+    ret = DFSDstartslab(sw4);
+    CHECK(ret, FAIL, "DFSDstartslab");
+
+    /* write out all the data to hdf file */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    ret = DFSDwriteslab(start_dims, stride, size_dims, (VOIDP) fdata);
+    CHECK(ret, FAIL, "DFSDwriteslab");
+
+    ret = DFSDendslab();
+    CHECK(ret, FAIL, "DFSDendslab");
+
+    /* Verify correctness of slab written */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 1;
+    size_dims[0] = 2;
+    size_dims[1] = 3;
+    size_dims[2] = 4;
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    ret = DFSDreadslab(sw4, start_dims, size_dims, stride, (VOIDP) bdata, d_dims);
+    CHECK(ret, FAIL, "DFSDreadslab");
+
+    if (num_err != 0)
+        MESSAGE(10, printf("\n        slab4w:  %d failures.  \n", (int) num_err);
+        );
+
+    MESSAGE(10, printf("\n          Verifying data  \n");
+        );
+
+    for (i = 0; i < d_dims[0]; i++)
+        for (j = 0; j < d_dims[1]; j++)
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (bdata[i][j][k] != fdata[i][j][k])
+                      num_err++;
+              }
+    if (num_err == 0)
+        MESSAGE(10, printf("\n          >>> All tests passed for slab4w <<< \n");
+        )
+        else
+        MESSAGE(10, printf("\n          slab4w:  %d wrong values in slab.  \n", (int) num_err);
+        );
+
+    return (int) (num_err);
+}
+
+/*
+   ** Main slab call to all other slab functions
+ */
+void
+test_slab(void)
+{
+    num_errs += slabwf32();
+    num_errs += slabwf64();
+    num_errs += slabwin();
+    num_errs += slabwuin();
+    num_errs += slabwi32();
+    num_errs += slabwui32();
+    num_errs += slabwi16();
+    num_errs += slabwui16();
+    num_errs += slabwi8();
+    num_errs += slabwui8();
+    num_errs += slab1w();
+    num_errs += slab2w();
+    num_errs += slab3w();
+    num_errs += slab4w();
+}
diff --git a/hdf/test/slabwf.f b/hdf/test/slabwf.f
new file mode 100644
index 0000000..8bac9af
--- /dev/null
+++ b/hdf/test/slabwf.f
@@ -0,0 +1,533 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: slabwf.f 6034 2014-01-19 06:59:14Z epourmal $
+C
+      subroutine slabwf (num_err)
+C
+C Program to write data set using the DFSDxxx interface
+C 
+C Output files: slabwf.hdf, slab1wf, slab4wf
+
+      implicit none
+      include 'fortest.inc'
+      include '../src/hdf.inc'
+      include '../src/dffunc.inc'
+
+      integer num_err
+      character*20 myname
+      parameter (myname = 'slab')
+
+      integer ret, np, nr,nc, di(3), st(3), sz(3), sr(3)
+      integer rank
+C
+C FLOAT32 data variables.  FLOAT32 corresponds to real*4.
+C If the fortran compiler does not handle real*4,
+C change them to the right sizes if possible.
+      real*4  scpln(2), scrow(3), sccol(4), da(4,3,2)
+      real*4  slab1(3,1,1), slab2(3,1,2), slab3(3,2,1)
+      real*4  slab4(3,1,1), slab5(1,3,2)
+      real*4  sa(4,3,2)
+      real*4    fillvalue
+C
+      integer i, j, k
+      character*10 lcol,ucol,fcol,lrow,urow,frow,lpln,upln,fpln
+      character*30 fn, sn, sn1, sn2, sn4
+      integer fnlen
+      integer nref
+      integer number_failed
+
+      call ptestban('Testing', myname)
+      number_failed = 0
+
+      di(1) = 4
+      di(2) = 3
+      di(3) = 2
+      np = 2
+      nr = 3
+      nc = 4
+      rank = 3
+      scpln(1) =   0.0
+      scpln(2) = 100.0
+      scrow(1) =   0.0
+      scrow(2) =  10.0
+      scrow(3) =  20.0
+      sccol(1) =   0.0
+      sccol(2) =   1.0
+      sccol(3) =   2.0
+      sccol(4) =   3.0
+      lcol = 'Column'
+      ucol = 'Cm'
+      fcol = 'Int32'
+      lrow = 'Line'
+      urow = 'Inch'
+      frow = 'Int16'
+      lpln = 'Time'
+      upln = 'Second'
+      fpln = 'Int32'
+      fn = 'slabf.hdf'
+      sn = 'slabwf.hdf'
+      fillvalue = 1.0
+      fnlen = 30
+      slab1(1,1,1) = 110.0
+      slab1(2,1,1) = 111.0
+      slab1(3,1,1) = 112.0
+
+      slab2(1,1,1) = 20.0
+      slab2(2,1,1) = 21.0
+      slab2(3,1,1) = 22.0
+      slab2(1,1,2) = 120.0
+      slab2(2,1,2) = 121.0
+      slab2(3,1,2) = 122.0
+
+      slab3(1,1,1) = 0.0
+      slab3(2,1,1) = 1.0
+      slab3(3,1,1) = 2.0
+      slab3(1,2,1) = 10.0
+      slab3(2,2,1) = 11.0
+      slab3(3,2,1) = 12.0
+
+      slab4(1,1,1) = 100.0
+      slab4(2,1,1) = 101.0
+      slab4(3,1,1) = 102.0
+
+      slab5(1,1,1) = 3.0
+      slab5(1,2,1) = 13.0
+      slab5(1,3,1) = 23.0
+      slab5(1,1,2) = 103.0
+      slab5(1,2,2) = 113.0
+      slab5(1,3,2) = 123.0
+      
+      do 200 i=1, np
+         do 180 j=1, nr
+            do 150 k=1, nc
+            da(k,j,i) = scpln(i) + scrow(j) + sccol(k)
+C           print *, da(k,j,i)
+150   continue
+180   continue
+200   continue
+
+      call MESSAGE(5,'Writing data as 5 slabs to slabwf.hdf')
+C      print *,'\n   Writing data as 5 slabs to slabwf.hdf'
+
+      num_err = 0
+
+C Set number type, dimension stuff etc
+      ret = dssnt(DFNT_FLOAT32)
+      call VRFY(ret,'dssnt',number_failed)
+
+      ret = dssdims(rank, di)
+      call VRFY(ret,'dssdim',number_failed)
+
+      ret = dssdist(1, lcol, ucol, fcol)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdist(2, lrow, urow, frow)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdist(3, lpln, upln, fpln)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdisc(1, di(1),  sccol)
+      call VRFY(ret,'dssdisc',number_failed)
+
+      ret = dssdisc(2, di(2), scrow)
+      call VRFY(ret,'dssdisc',number_failed)
+
+      ret = dssdisc(3, di(3), scpln)
+      call VRFY(ret,'dssdisc',number_failed)
+C 
+C Write it slab by slab   
+C 
+
+C     set the Fill value
+      ret = dssfill(fillvalue)
+      call VRFY(ret,'dssfile',number_failed)
+
+      sr(1) = 0
+      sr(2) = 0
+      sr(3) = 0
+      ret = dssdims(rank, di)
+      call VRFY(ret,'dssdim',number_failed)
+
+      ret = dssslab(sn)
+      call VRFY(ret,'dssslab',number_failed)
+      st(1) = 1
+      st(2) = 2
+      st(3) = 2
+      sz(1) = 3
+      sz(2) = 1
+      sz(3) = 1
+      ret = dswslab(st, sr, sz,slab1)
+      call VRFY(ret,'dswslab',number_failed)
+      st(1) = 1
+      st(2) = 3
+      st(3) = 1
+      sz(1) = 3
+      sz(2) = 1
+      sz(3) = 2
+      ret = dswslab(st, sr, sz, slab2)
+      call VRFY(ret,'dswslab',number_failed)
+      st(1) = 1
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 3
+      sz(2) = 2
+      sz(3) = 1
+      ret = dswslab(st, sr, sz, slab3)
+      call VRFY(ret,'dswslab',number_failed)
+      st(1) = 1
+      st(2) = 1
+      st(3) = 2
+      sz(1) = 3
+      sz(2) = 1
+      sz(3) = 1
+      ret = dswslab(st, sr, sz, slab4)
+      call VRFY(ret,'dswslab',number_failed)
+      st(1) = 4
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 1
+      sz(2) = 3
+      sz(3) = 2
+      ret = dswslab(st, sr, sz, slab5)
+      call VRFY(ret,'dswslab',number_failed)
+
+      ret = dseslab()
+      call VRFY(ret,'dseslab',number_failed)
+C
+C Retrieve slab for verification
+C
+      st(1) = 1
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 4
+      sz(2) = 3
+      sz(3) = 2
+      sr(1) = 4
+      sr(2) = 3
+      sr(3) = 2
+      ret = dsrslab(sn, st, sz, st, sa, sr)
+      call VRFY(ret,'dsrslab',number_failed)
+
+      num_err = number_failed
+
+      if ( num_err .ne. 0) then
+         print *,'number of failures =',num_err
+      endif
+     
+      call MESSAGE(5,'   Verifying data ')
+
+      num_err = 0
+      do 500 i=1, np
+         do 400 j=1, nr
+            do 300 k=1, nc
+             if ( da(k,j,i) .ne. sa(k,j,i)) then
+                 num_err = num_err + 1
+                 if (Verbosity .ge. VERBO_DEF) then
+                call MESSAGE(VERBO_DEF, '  *** data error *** ')
+                     print *, '(k,j,i) = (', k,',', j,',', i,')',
+     +                     ' da=',da(k,j,i), ', sa=',sa(k,j,i)
+                 endif
+             endif
+300   continue
+400   continue
+500   continue
+
+      if (num_err .ne. 0) then
+           print *,'slabwf: number of wrong values in slab =',num_err
+      else
+           call MESSAGE(VERBO_HI, '  *** slabwf passed *** ')
+      endif
+
+C
+C   slab1wf test
+C
+C      call MESSAGE(5,'Writing the first 3 of 5 slabs to slab1wf.hdf')
+C      print *,'\n  Writing the first 3 of 5 slabs to slab1wf.hdf'
+      sn1 = 'slab1wf.hdf'
+
+C Clear old info fist
+      ret = dsclear()
+      call VRFY(ret,'dsclear',number_failed)
+
+C Set dimension stuff etc
+      call MESSAGE(5,'Calling dssdim to set info on SDS')
+      ret = dssdims(rank, di)
+      call VRFY(ret,'dssgdim',number_failed)
+
+      ret = dssdist(1, lcol, ucol, fcol)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdist(2, lrow, urow, frow)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdist(3, lpln, upln, fpln)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdisc(1, di(1),  sccol)
+      call VRFY(ret,'dssdisc',number_failed)
+
+      ret = dssdisc(2, di(2), scrow)
+      call VRFY(ret,'dssdisc',number_failed)
+
+      ret = dssdisc(3, di(3), scpln)
+      call VRFY(ret,'dssdisc',number_failed)
+C 
+C Write it slab by slab   
+C 
+      sr(1) = 0
+      sr(2) = 0
+      sr(3) = 0
+      ret = dssdims(rank, di)
+      call VRFY(ret,'dssdims',number_failed)
+
+      ret = dssslab(sn1)
+      call VRFY(ret,'dssslab',number_failed)
+      st(1) = 1
+      st(2) = 2
+      st(3) = 2
+      sz(1) = 3
+      sz(2) = 1
+      sz(3) = 1
+      ret = dswslab(st, sr, sz,slab1)
+      call VRFY(ret,'dswslab',number_failed)
+      st(1) = 1
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 3
+      sz(2) = 2
+      sz(3) = 1
+      ret = dswslab(st, sr, sz, slab3)
+      call VRFY(ret,'dswslab',number_failed)
+      st(1) = 4
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 1
+      sz(2) = 3
+      sz(3) = 2
+      ret = dswslab(st, sr, sz, slab5)
+      call VRFY(ret,'dswslab',number_failed)
+
+      ret = dseslab()
+      call VRFY(ret,'dseslab',number_failed)
+
+
+      num_err = number_failed 
+      if (num_err .ne. 0) then
+           print *,'number of failures =',num_err
+      else
+           call MESSAGE(VERBO_HI, '  *** slab1wf passed *** ')
+      endif
+
+C
+C  slab2wf test
+C
+C      call MESSAGE(5,'Writing the last 2 of 5 slabs to slab1wf.hdf')
+C      print *,'\n   Writing the last 2 of 5 slabs to slab1wf.hdf'
+      sn2 = 'slab1wf.hdf'
+C set ref of SDS to write to
+      nref = 2
+
+C 
+C Fisrt clear all previous info and restarot to beginning of file
+C 
+      ret = dsclear()
+      call VRFY(ret,'dsclear',number_failed)
+
+      ret = dfsdrestart()
+      call VRFY(ret,'dfsdrestart',number_failed)
+
+C Get relavant info on SDS
+
+      call MESSAGE(5,'Calling dsigdim to get info on SDS')
+      ret = dsgdims(sn2, rank, sz, rank)
+      call VRFY(ret,'dsigdim',number_failed)
+
+C      call MESSAGE(5,'Calling dswref to ref o SDS to write to')
+C     set SDS to write to
+      ret = dswref(sn2, nref)
+      call VRFY(ret,'dswref',number_failed)
+
+      call MESSAGE(5,'Calling dssslab to start access on SDS')
+      ret = dssslab(sn2)
+      call VRFY(ret,'dssslab',number_failed)
+      st(1) = 1
+      st(2) = 3
+      st(3) = 1
+      sz(1) = 3
+      sz(2) = 1
+      sz(3) = 2
+C      call MESSAGE(5,'Calling dswslab to write 4of5 slabs to SDS')
+      ret = dswslab(st, sr, sz, slab2)
+      call VRFY(ret,'dswslab',number_failed)
+      st(1) = 1
+      st(2) = 1
+      st(3) = 2
+      sz(1) = 3
+      sz(2) = 1
+      sz(3) = 1
+C      call MESSAGE(5,'Calling dswslab to write 5of5 slabs to SDS')
+      ret = dswslab(st, sr, sz, slab4)
+      call VRFY(ret,'dswslab',number_failed)
+
+      call MESSAGE(5,'Calling dseslab to end access to SDS')
+      ret = dseslab()
+      call VRFY(ret,'dseslab',number_failed)
+
+      if ( num_err .ne. 0) then
+         print *,'number of failures =',num_err
+      endif
+
+C
+C Retrieve slab for verification
+C
+      st(1) = 1
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 4
+      sz(2) = 3
+      sz(3) = 2
+      sr(1) = 4
+      sr(2) = 3
+      sr(3) = 2
+      num_err = 0
+C      call MESSAGE(5,'Calling dsrslab to start read access to SDS')
+      ret = dsrslab(sn2, st, sz, st, sa, sr)
+      call VRFY(ret,'dsrslab',number_failed)
+
+      num_err = number_failed
+
+      if ( num_err .ne. 0) then
+         print *,'number of failures =',num_err
+      endif
+
+      call MESSAGE(5,'   Verifying data ')
+
+      num_err = 0
+      do 800 i=1, np
+         do 700 j=1, nr
+            do 600 k=1, nc
+             if ( da(k,j,i) .ne. sa(k,j,i)) then
+                 num_err = num_err + 1
+             endif
+C            print *, 'da() ',da(k,j,i)
+C            print *, 'sa() ',sa(k,j,i)
+600   continue
+700   continue
+800   continue
+
+      if (num_err .ne. 0) then
+           print *,'slab2wf: number of wrong values in slab =',num_err
+      else
+           call MESSAGE(VERBO_HI, '  *** slab2wf passed ***  ')
+      endif
+
+C
+C  slab4wf test
+C
+      call MESSAGE(5,'Writing data as 1 slab to slab4wf.hdf')
+C      print *,'Writing data as 1 slab to slab4wf.hdf'
+      sn4 = 'slab4wf.hdf'
+C
+C Clear previous info
+
+      ret = dsclear()
+      call VRFY(ret,'dsclear',number_failed)
+
+C Set relevant info
+
+      ret = dssdims(rank, di)
+      call VRFY(ret,'dssgdim',number_failed)
+
+      ret = dssdist(1, lcol, ucol, fcol)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdist(2, lrow, urow, frow)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdist(3, lpln, upln, fpln)
+      call VRFY(ret,'dssdist',number_failed)
+
+      ret = dssdisc(1, di(1),  sccol)
+      call VRFY(ret,'dssdisc',number_failed)
+
+      ret = dssdisc(2, di(2), scrow)
+      call VRFY(ret,'dssdisc',number_failed)
+
+      ret = dssdisc(3, di(3), scpln)
+      call VRFY(ret,'dssdisc',number_failed)
+C 
+C Write it as one slab    
+C 
+
+      ret = dssslab(sn4)
+      call VRFY(ret,'dssslab',number_failed)
+      st(1) = 1
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 4
+      sz(2) = 3
+      sz(3) = 2
+      ret = dswslab(st, sr, sz, da)
+      call VRFY(ret,'dswslab',number_failed)
+
+      ret = dseslab()
+      call VRFY(ret,'dseslab',number_failed)
+C
+C Retrieve slab for verification
+C
+      st(1) = 1
+      st(2) = 1
+      st(3) = 1
+      sz(1) = 4
+      sz(2) = 3
+      sz(3) = 2
+      sr(1) = 4
+      sr(2) = 3
+      sr(3) = 2
+      ret = dsrslab(sn4, st, sz, st, sa, sr)
+      call VRFY(ret,'dsrslab',number_failed)
+
+      num_err = number_failed
+
+      if ( num_err .ne. 0) then
+         print *,'number of failures =',num_err
+      endif
+
+      call MESSAGE(5,'   Verifying data ')
+
+      num_err = 0
+      do 902 i=1, np
+         do 901 j=1, nr
+            do 900 k=1, nc
+             if ( da(k,j,i) .ne. sa(k,j,i)) then
+                 num_err = num_err + 1
+             endif
+C            print *, 'da() ',da(k,j,i)
+C            print *, 'sa() ',sa(k,j,i)
+900   continue
+901   continue
+902   continue
+
+      if (num_err .ne. 0) then
+           print *,'slab4wf: number of wrong values in slab =',num_err
+      else
+           call MESSAGE(VERBO_HI, '  *** slab4wf passed *** ')
+      endif
+
+C
+C
+      return 
+      end
+
diff --git a/hdf/test/t24f.f b/hdf/test/t24f.f
new file mode 100644
index 0000000..fd3677b
--- /dev/null
+++ b/hdf/test/t24f.f
@@ -0,0 +1,248 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: t24f.f 6034 2014-01-19 06:59:14Z epourmal $
+C
+      subroutine t24f (number_failed)
+      implicit none
+      include 'fortest.inc'
+      include '../src/dffunc.inc'
+C
+C Test Program: 
+C     		Writes 24-bit raster images with specified interlace 
+C		   code to a file.
+C		Reads the images and their dimensions from the file.
+C Input file: none
+C Output file: tdf24f.hdf
+C
+C
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'r24')
+
+
+      integer d1, d2, il
+      character*80 TESTFILE
+      character*1 CR
+      character buf(3, 2, 2), buf1(2, 3, 2), buf2(2, 2, 3)
+      character in(3,2,2), in1(2, 3, 2), in2(2, 2, 3)
+      integer i, j, k, ret
+
+      call ptestban('Testing', myname)
+      TESTFILE = 'tdf24f.hdf'
+      CR = char(10)
+      number_failed = 0
+
+      do 150 i=1, 2
+          do 2 j=1, 2
+              buf(1, j, i) = char(i+j)
+              buf(2, j, i) = char(i+j)
+              buf(3, j, i) = char(i+j)
+              buf1(j, 1, i) = char(i-j)
+              buf1(j, 2, i) = char(i-j)
+              buf1(j, 3, i) = char(i-j)
+              buf2(j, i, 1) = char(2*i - j)
+              buf2(j, i, 2) = char(2*i - j)
+              buf2(j, i, 3) = char(2*i - j)
+2       continue
+150   continue
+      call MESSAGE(VERBO_HI, 'Setting il to 0')
+      ret = d2setil(0)
+      call VRFY(ret, 'd2setil',number_failed)
+      call MESSAGE(VERBO_HI, ' Putting buffer 1')
+      ret = d2pimg(TESTFILE, buf, 2, 2)
+      call VRFY(ret, 'd2pimg',number_failed)
+      call MESSAGE(VERBO_HI, 'Setting il to 1')
+      ret = d2setil(1)
+      call VRFY(ret, 'd2setil',number_failed)
+      call MESSAGE(VERBO_HI, 'Adding buf1')
+      ret = d2aimg(TESTFILE, buf1, 2, 2)
+      call VRFY(ret, 'd2aimg',number_failed)
+      call MESSAGE(VERBO_HI, 'Setting il to 2')
+      ret = d2setil(2)
+      call VRFY(ret, 'd2setil',number_failed)
+      call MESSAGE(VERBO_HI, 'Adding buf2')
+      ret = d2aimg(TESTFILE, buf2, 2, 2)
+      call VRFY(ret, 'd2aimg',number_failed)
+      call MESSAGE(VERBO_HI, 'Restarting file')
+      ret = d2first()
+      call VRFY(ret, 'd2first',number_failed)
+      call MESSAGE(VERBO_HI, 'Req il 0')
+      ret = d2reqil(0)
+      call VRFY(ret, 'd2reqil',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting dims')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE, in, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 200 i=1, 2
+          do 180 j=1, 2
+              do 160 k=1,3
+                  if (in(k,j,i) .ne. buf(k,j,i)) then
+                  print *, 'Error at  ', k, j, i
+                  endif
+160           continue
+180       continue
+200   continue
+  
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 250 i=1, 2
+          do 220 j=1, 2
+              do 210 k = 1, 3
+                  if (in(k,j,i) .ne. buf1(j,k,i) ) then
+                      print *, 'Error at  ', k, j, i
+                  endif
+210           continue
+220       continue
+250   continue
+
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 300 i=1, 2
+          do 280 j=1, 2
+              do 260 k = 1, 3
+                  if (in(k,j,i) .ne. buf2(j,i,k)) then
+                      print *, 'Error at  ', k, j, i
+                  endif
+260           continue
+280       continue
+300   continue
+
+      call MESSAGE(VERBO_HI, 'Restarting file')
+      ret = d2first()
+      call VRFY(ret, 'd2first',number_failed)
+      call MESSAGE(VERBO_HI, 'Req il 1')
+      ret = d2reqil(1)
+      call VRFY(ret, 'd2reqil',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in1, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 350 i=1, 2
+          do 320 j=1, 2
+              do 310 k=1,3
+                 if (in1(j,k,i) .ne. buf(k,j,i)) then
+                     print *, 'Error at  ', k, j, i
+                 endif
+310           continue
+320       continue
+350   continue
+
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in1, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 400 i=1, 2
+          do 380 j=1, 2
+              do 360 k = 1, 3
+                  if (in1(j,k,i) .ne. buf1(j,k,i)) then
+                      print *, 'Error at  ', k,j,i
+                  endif
+360           continue
+380       continue
+400   continue
+
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in1, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 450 i=1, 2
+          do 420 j=1, 2
+              do 410 k =1, 3  
+                  if (in1(j,k,i) .ne. buf2(j,i,k)) then
+                      print *, 'Error at  ', k, j, i
+                  endif
+410           continue
+420       continue
+450   continue
+
+      call MESSAGE(VERBO_HI, 'Restarting file')
+      ret = d2first()
+      call VRFY(ret, 'd2first',number_failed)
+      call MESSAGE(VERBO_HI, 'Req il 2')
+      ret = d2reqil(2)
+      call VRFY(ret, 'd2reqil',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in2, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 500 i=1, 2
+          do 480 j=1, 2
+              do 460 k=1, 3
+                  if (in2(j,i,k) .ne. buf(k,j,i)) then
+                      print *, 'Error at  ', k, j, i 
+                  endif
+460           continue
+480       continue
+500   continue
+
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in2, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 550 i=1, 2
+          do 520 j=1, 2
+              do 510 k = 1,3
+                  if (in2(j,i,k) .ne. buf1(j,k,i)) then
+                      print *, 'Error at  ', k, j, i
+                  endif
+510           continue
+520       continue
+550   continue
+
+      call MESSAGE(VERBO_HI, 'Getting dimensions')
+      ret = d2gdims(TESTFILE, d1, d2, il)
+      call VRFY(ret, 'd2gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image')
+      ret = d2gimg(TESTFILE,  in2, 2, 2)
+      call VRFY(ret, 'd2gimg',number_failed)
+      do 600 i=1, 2
+          do 580 j=1, 2
+              do 560 k = 1, 3
+                  if (in2(j,i,k) .ne. buf2(j,i,k)) then
+                      print *, 'Error at  ', k, j, i
+                  endif
+560           continue
+580       continue
+600   continue
+
+      if (number_failed .eq. 0) then 
+          call MESSAGE(VERBO_DEF + 1,
+     +   '****** ALL TESTS SUCCESSFUL ******')
+      else
+          print *, '****** ', number_failed, ' TESTS FAILES  ******'
+      endif
+
+      return 
+      end
+
diff --git a/hdf/test/tanf.f b/hdf/test/tanf.f
new file mode 100644
index 0000000..75e453e
--- /dev/null
+++ b/hdf/test/tanf.f
@@ -0,0 +1,234 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tanf.f 5322 2010-01-19 06:26:11Z brtnfld $
+C
+      subroutine tanf (number_failed)
+C
+C
+C  Test program: stores annotations in a file.
+C                Writes several SDSs and corresponding RISs to a file.
+C                Writes labels and descriptions for all but the first 
+C                   three SDSs.
+C                Writes labels and descriptions for all RISs.
+C
+C  Input file:  none
+C  Output files: tdfanF.hdf
+C
+C  Possible bug:  When reading in a label, we have to give it a 
+C                 length that is one greater than MAXLEN_LAB. This
+C                 may be due to a bug in dfan.c in DFANIgetann().
+C
+C                 This was addressed in BUG 1640: Added isfortran 
+C                 flag to DFANIgetann to avoid termination 
+C                 of the string with the null character when the routine 
+C                 is call from FORTRAN, hence no longer need to add one.
+C
+
+      implicit none
+      include 'fortest.inc'
+
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'an')
+
+      integer daplab, dapdesc  
+      integer dssdims, dsadata, dslref, dsgdims
+      integer d8aimg, DFR8lastref, d8gimg
+
+      integer ISFIRST, NOTFIRST, MAXLEN_LAB
+      integer MAXLEN_DESC, ROWS, COLS, REPS
+      integer DFTAG_SDG, DFTAG_RIG
+
+      parameter ( ISFIRST =        1, 
+     *            NOTFIRST =       0, 
+     *            MAXLEN_LAB =    30,
+     *            MAXLEN_DESC =  500, 
+     *            DFTAG_SDG   =  700,
+     *            DFTAG_RIG   =  306,
+     *            ROWS =          10, 
+     *            COLS =          10,
+     *            REPS =           2 )
+
+      integer refnum
+      integer ret
+      integer rank
+      integer j, dimsizes(2)
+
+      character*30 labsds, labris
+      character*500 descsds, descris
+      character pal(768)
+      character*64 TESTFILE
+
+      character*1 CR
+      character image(ROWS, COLS), newimage(ROWS, COLS)
+      real      data(ROWS, COLS)
+
+
+      call ptestban('Testing', myname)
+      number_failed =  0
+      CR = char(10)
+      TESTFILE = 'tdfanF.hdf'
+
+C *** set up object labels and descriptions ***
+
+      labsds = 'Object label #1: sds'
+      labris = 'Object label #2: image'
+      descsds = 'Object Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 ' 
+     *          // CR // '                13 14 15 16 17 18 19 20 '
+     *          // ' **END SDS DESCR**'
+      descris = 'Object Descr #2: A B C D E F G H I J K L '
+     *          // CR // '                M N O **END IMAGE DESCR **'
+
+C  *** generate float array and image ***
+ 
+      rank = 2
+      dimsizes(1)=ROWS 
+      dimsizes(2)=COLS
+
+      call gen2Dfloat(ROWS, COLS, data)
+      call genimage(ROWS, COLS, data, image)
+
+      ret = dssdims(rank,dimsizes)
+      call VRFY(ret, 'dssdims', number_failed)
+
+C  ***  Write labels and descriptions ***
+
+      call MESSAGE(VERBO_MED,
+     +        '***  Writing labels & descriptions with SDS and RIS ***')
+
+      do 100 j=1,REPS
+C         write out scientific data set 
+          ret = dsadata(TESTFILE, rank,dimsizes, data)
+          call VRFY(ret, 'dsadata', number_failed)
+
+C         write out annotations for 2 out of every 3 
+          if (mod(j,3) .ne. 0) then 
+              refnum = dslref()
+              ret = daplab(TESTFILE, DFTAG_SDG, refnum, labsds)
+              call VRFY(ret, 'daplab', number_failed)
+              ret = dapdesc(TESTFILE, DFTAG_SDG, refnum, 
+     *                                     descsds, len(descsds))
+              call VRFY(ret, 'dapdesc', number_failed)
+          endif
+
+          ret = d8aimg(TESTFILE, image, COLS, ROWS, 0)
+          call VRFY(ret, 'd8aimg', number_failed)
+          refnum = DFR8lastref()
+          ret = daplab(TESTFILE, DFTAG_RIG, refnum, labris)
+          call VRFY(ret, 'daplab', number_failed)
+          ret = dapdesc(TESTFILE,DFTAG_RIG,refnum, descris, 
+     *                                                 len(descris))
+          call VRFY(ret, 'dapdesc', number_failed)
+  100 continue
+
+
+C********  Read labels and descriptions *********
+
+      call MESSAGE(VERBO_MED,
+     +        '*** Reading labels and descriptions for SDS and RIS ***')
+
+      do 200 j=1,REPS
+
+          ret = dsgdims(TESTFILE, rank,dimsizes,3)
+          call VRFY(ret, 'dsgdims', number_failed)
+          refnum = dslref()
+
+C         read in annotations for 2 out of every 3 
+          if (mod(j,3) .ne. 0) then
+              call an_check_lab_desc(TESTFILE, DFTAG_SDG, refnum, 
+     *                                  labsds, descsds, number_failed)
+          endif
+
+          ret = d8gimg(TESTFILE, newimage, COLS, ROWS, pal)
+          call VRFY(ret, 'd8gimg', number_failed)
+          refnum = DFR8lastref()
+          call an_check_lab_desc(TESTFILE, DFTAG_RIG, refnum, 
+     *                                labris, descris, number_failed)
+      
+  200 continue
+
+      if ( number_failed .eq. 0 ) then
+          call MESSAGE(VERBO_HI,
+     +        '***** ALL DFAN TESTS SUCCESSFUL ***** ')
+      else
+          print *,'***** ',number_failed,' TESTS FAILED ***** '
+      endif
+
+      return
+      end
+
+
+C**************************************************************
+C
+C  an_check_lab_desc:  read and compare label and description
+C                   with expected ones
+C
+C**************************************************************
+      subroutine an_check_lab_desc(filename, tag, ref, label, desc, 
+     *                                                   number_failed)
+      implicit none
+      include 'fortest.inc'
+
+      character*(*) filename, label, desc
+      integer tag, ref, number_failed
+
+      integer MAXLEN_LAB, MAXLEN_DESC
+      parameter ( MAXLEN_LAB =    30,
+     *            MAXLEN_DESC =  500 )
+
+      integer daglab, dagllen, dagdlen, dagdesc
+      integer  inlablen, indesclen, ret
+      character*30   inlabel
+      character*500 indesc
+
+      inlablen =  dagllen(filename, tag, ref)
+      call VRFY(inlablen, 'dagllen', number_failed)
+
+      if (inlablen .ne. len(label)) then
+          print *,'   >>>BAD LABEL LENGTH.'
+          print *,'                        IS: ', inlablen
+          print *,'                 SHOULD BE: ', len(label)
+          number_failed = number_failed + 1
+      endif
+
+      ret = daglab(filename, tag, ref, inlabel, MAXLEN_LAB)
+      call VRFY(ret, 'daglab', number_failed)
+      if (inlabel .ne. label) then
+          print *,'   >>>BAD LABEL.'
+          print *,'                        IS: ', inlabel
+          print *,'                 SHOULD BE: ', label
+          number_failed = number_failed + 1
+      endif
+
+      indesclen = dagdlen(filename, tag, ref)
+      call VRFY(indesclen, 'dagdlen', number_failed)
+      if (indesclen .ne. len(desc)) then
+          print *,'   >>>BAD DESCRIPTION LENGTH.' 
+          print *,'                        IS: ', indesclen 
+          print *,'                 SHOULD BE: ', len(desc) 
+          number_failed = number_failed + 1 
+      else 
+          ret = dagdesc(filename, tag, ref, indesc, MAXLEN_DESC)
+          call VRFY(ret, 'dagdesc', number_failed)
+          if (indesc .ne. desc) then
+              print *,'   >>>BAD DESCRIPTION.' 
+              print *,'                        IS: ', indesc 
+              print *,'                 SHOULD BE: ', desc 
+              number_failed = number_failed + 1 
+          endif
+      endif
+
+      return
+      end
+
diff --git a/hdf/test/tanfilef.f b/hdf/test/tanfilef.f
new file mode 100644
index 0000000..3cc2bb9
--- /dev/null
+++ b/hdf/test/tanfilef.f
@@ -0,0 +1,210 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tanfilef.f 4932 2007-09-07 17:17:23Z bmribler $
+C
+      subroutine tanfilef (number_failed)
+C
+C
+C  Test program:
+C                Writes file labels and descriptions in a file.
+C                Reads the  labels and descriptions from the file
+C
+C  Input file:  none
+C  Output files: tdfanflF.hdf
+C
+C  Possible bug:  When reading in a label, we have to give it a
+C                 length that is one greater than MAXLEN_LAB. This
+C                 may be due to a bug in dfan.c in DFANIgetann().
+C
+
+      implicit none
+      include 'fortest.inc'
+
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'anfile')
+
+      integer daafid, daafds,dagfidl,dagfid
+      integer dagfdsl, dagfds, hopen, hclose
+      integer ret
+      integer ISFIRST, NOFIRST, MAXLEN_LAB, MAXLEN_DESC
+      integer fid, DFACC_CREATE, DFACC_READ
+
+      character*35 lab1, lab2
+      character*35 templab
+      character*100 desc1, desc2, tempstr
+      character*64 TESTFILE
+      character*1 CR
+
+      call ptestban('Testing', myname)
+      ISFIRST = 1
+      NOFIRST = 0
+      number_failed = 0
+      TESTFILE = 'tdfanflF.hdf'
+      CR = char(10)
+      MAXLEN_LAB = 35
+      MAXLEN_DESC = 100
+      DFACC_CREATE = 4
+      DFACC_READ = 1
+
+      lab1 = 'File label #1: aaa'
+      lab2 = 'File label #2: bbbbbb'
+      desc1 = 'File descr #1: This is a test file annotation'
+      desc2 = 'File descr #2: One more test ...'
+
+      call MESSAGE(VERBO_HI, '****** Write file labels *******')
+      fid = hopen(TESTFILE, DFACC_CREATE, 0)
+      call VRFY(fid, 'hopen', number_failed)
+      ret = daafid(fid, lab1)
+      call VRFY(ret, 'daafid', number_failed)
+
+      ret = daafid(fid, lab2)
+      call VRFY(ret, 'daafid', number_failed)
+
+      call MESSAGE(VERBO_HI, '****** Write file descriptions *******')
+      ret = daafds(fid, desc1, len(desc1))
+      call VRFY(ret, 'daafds', number_failed)
+
+      ret = daafds(fid, desc2, len(desc2))
+      call VRFY(ret, 'daafds', number_failed)
+
+      ret = hclose(fid)
+      call VRFY(ret, 'hclose', number_failed)
+
+      call MESSAGE(VERBO_HI,
+     +    '****** Read length of the first file label ****')
+      fid = hopen(TESTFILE, DFACC_READ, 0)
+      call VRFY(fid, 'hopen-read', number_failed)
+      ret = dagfidl(fid, ISFIRST)
+      call VRFY(ret, 'dagfidl', number_failed)
+      call checklen(ret, lab1,  'label'  )
+
+      call MESSAGE(VERBO_HI, '******...followed by the label *****')
+      ret = dagfid(fid, templab, MAXLEN_LAB, ISFIRST)
+
+      call VRFY(ret, 'dagfid', number_failed)
+      call checklab(lab1, templab, ret, 'label')
+
+      call MESSAGE(VERBO_HI,
+     +    '****** Read length of the second file label ****')
+      ret = dagfidl(fid, NOFIRST)
+      call VRFY(ret, 'dagfidl', number_failed)
+      call checklen(ret, lab2, 'label')
+
+      call MESSAGE(VERBO_HI, '******...followed by the label *****')
+      ret = dagfid(fid, templab, MAXLEN_LAB, NOFIRST)
+      call VRFY(ret, 'dagfid', number_failed)
+      call checklab(lab2, templab, ret, 'label')
+
+      call MESSAGE(VERBO_HI,
+     +    '****** Read length of the first file description ****')
+      ret = dagfdsl(fid, ISFIRST)
+      call VRFY(ret, 'dagfdsl', number_failed)
+      call checklen(ret, desc1, 'description' )
+
+      call MESSAGE(VERBO_HI,
+     +    '******...followed by the description *****')
+      ret = dagfds(fid, tempstr, MAXLEN_DESC, ISFIRST)
+      call VRFY(ret, 'dagfds', number_failed)
+      call checkann(desc1, tempstr, ret, 'description')
+
+      call MESSAGE(VERBO_HI,
+     +    '****** Read length of the second file description ****')
+      ret = dagfdsl(fid, NOFIRST)
+      call VRFY(ret, 'dagfdsl', number_failed)
+      call checklen(ret, desc2, 'description' )
+
+      call MESSAGE(VERBO_HI,
+     +    '******...followed by the description *****')
+      ret = dagfds(fid, tempstr, MAXLEN_DESC, NOFIRST)
+      call VRFY(ret, 'dagfds', number_failed)
+      call checkann(desc2, tempstr, ret, 'description')
+
+      ret = hclose(fid)
+      call VRFY(ret, 'hclose', number_failed)
+
+      if (number_failed .eq. 0) then
+         call MESSAGE(VERBO_HI,
+     +    '***** ALL DFANFILE TESTS SUCCESSFUL ******')
+      else
+         print *, '********', number_failed, ' TESTS FAILED'
+      endif
+
+
+      return
+      end
+
+
+C*********************************************
+C
+C  checklen
+C
+C*********************************************
+
+      subroutine checklen(ret, oldstr, type)
+      implicit none
+      character*(*) type, oldstr
+      integer ret
+
+      integer oldlen
+
+      oldlen = len(oldstr)
+      if (ret .ge. 0 .and.  ret .ne. oldlen) then
+          print *, 'Length of ', type, ' is ', len(oldstr),
+     *             ' instead of ', ret
+      endif
+      return
+      end
+
+C***********************************************
+C
+C  checkann
+C
+C***********************************************
+
+      subroutine checkann(oldstr, newstr, ret, type)
+      implicit none
+      character*90  oldstr, newstr
+      character*(*) type
+      integer ret
+
+
+      if (ret .ge. 0 .and. oldstr .ne. newstr) then
+          print *, type, ' is incorrect.'
+          print *, ' It should be <', oldstr, '>'
+          print *, ' instead of   <', newstr, '>'
+      endif
+      return
+      end
+
+C***********************************************
+C
+C  checklab
+C
+C***********************************************
+
+      subroutine checklab(oldstr, newstr, ret, type)
+      implicit none
+      character*30  oldstr, newstr
+      character*(*) type
+      integer ret
+
+
+      if (ret .ge. 0 .and. oldstr .ne. newstr) then
+          print *, type, ' is incorrect.'
+          print *, ' It should be <', oldstr, '>'
+          print *, ' instead of   <', newstr, '>'
+      endif
+      return
+      end
diff --git a/hdf/test/tattdatainfo.c b/hdf/test/tattdatainfo.c
new file mode 100644
index 0000000..2e6b9b0
--- /dev/null
+++ b/hdf/test/tattdatainfo.c
@@ -0,0 +1,676 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tattdatainfo.c - tests the functions VSgetattdatainfo, Vgetattdatainfo,
+ *		    and GRgetattdatainfo.
+ * Structure of the file:
+ *    test_attdatainfo - test driver
+ *	test_vvsattrs     - tests attributes on vgroups and vdatas
+ *	test_vgmixedattrs - tests handling vgroup attributes created with and 
+ *			    without Vsetattr
+ *	test_grattrs      - tests attributes on GR file and raster images
+ * -BMR, Aug 2010
+ ****************************************************************************/
+
+#include "hdf.h"
+#include "tdatainfo.h"
+#include "tutils.h"
+
+static void test_vvsattrs();
+static void test_vgmixedattrs();
+static void test_grattrs();
+
+/****************************************************************************
+   Name: test_vvsattrs() - tests getting attribute data information from
+			   vdatas and vgroups
+
+   Description:
+	This routine performs the following steps:
+	- Create a new file with the V interface
+	- Creates several vgroups and vdatas, and forms some arbitrary
+	  structures among these elements.
+	- Add some attributes to various vgroups and vdatas.
+	- Retrieve offset/length of the data of some attributes.
+	- Reopen the file without HDF4 library.
+	- Read in attribute's data using the previously recorded
+	  offsets/lengths and verify the data
+   BMR - Aug 2010
+ ****************************************************************************/
+#define ATTRFILE "tattdatainfo.hdf"
+#define NUM_VDATAS 3
+#define NUM_VGROUPS 3
+#define ATTNAME1 "Attribute 1"
+#define ATTNAME2 "Attribute 2"
+#define ATTNAME3 "Attribute 3"
+#define ATTNAME4 "Attribute 4"
+#define ATTNAME5 "Attribute 5"
+#define ATTNAME6 "Attribute 6"
+#define ATTNAME7 "Attribute 7"
+
+#define FLDNAME1 "Field1"	/* contains one char */
+#define FLDNAME2 "Field2"	/* contains three chars */
+#define FLDNAME3 "Field3"	/* contains two ints */
+#define FLDNAME4 "Field4"	/* contains one float */
+#define	FIELD_NAME_LIST1	"Field1,Field2"
+#define	FIELD_NAME_LIST2	"Field3,Field4"
+
+static void
+test_vvsattrs()
+{
+    int32 fid;          /* File ID */
+    int32 vgroup0_id, vgroup1_id, vgroup2_id; /* Various vgroup IDs */
+    int32 vdata0_id, vdata1_id, vdata2_id;    /* Various vdata IDs */
+    int32 fldindex;
+    int32 ref_list[NUM_VGROUPS], vdref_list[NUM_VDATAS];
+    int32 offset, length;
+    char vgclass[20];
+    int ii;
+    intn  status;	/* returned status */
+    intn  status_32;	/* returned status for functions returning an int32! */
+
+    /* Attributes to be set for various elements */
+    uint32 attr1[4] = {4, 5, 6, 7};
+    char attr2[8] = {'V','g','r','o','u','p','0','\0'};
+    char attr3[7] = {'V','d','a', 't', 'a', '0', '\0'};
+    char attr4[7] = {'F','i','e', 'l', 'd', '1', '\0'};
+
+    /* Create HDF file and initialize the interface. */
+    fid = Hopen(ATTRFILE, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status, FAIL, "Vstart");
+
+    /* Create NUM_VGROUPS vgroups and set classname */
+    for (ii = 0; ii < NUM_VGROUPS; ii++)
+    {
+	int32 vgroup_id, vgroup_ref;
+
+	/* Create a vgroup. */
+	vgroup_id = Vattach(fid, -1, "w");
+	CHECK_VOID(vgroup_id, FAIL, "Vattach");
+
+	/* Record its reference number for later access */
+	vgroup_ref = VQueryref(vgroup_id);
+	CHECK_VOID(vgroup_ref, FAIL, "VQueryref:vgroup_id");
+	ref_list[ii] = vgroup_ref;
+
+	/* Set its class name */
+	sprintf(vgclass, "VG-CLASS-%d", ii);
+	status_32 = Vsetclass(vgroup_id, vgclass);
+	CHECK_VOID(status_32, FAIL, "Vsetclass");
+
+	/* Detach it */
+	status_32 = Vdetach(vgroup_id);
+	CHECK_VOID(status_32, FAIL, "Vdetach");
+    }
+
+    /* Create NUM_VDATAS vgroups and set classname */
+    for (ii = 0; ii < NUM_VDATAS; ii++)
+    {
+	int32 vdata_id, vdata_ref;
+
+	/* Create a vdata. */
+	vdata_id = VSattach(fid, -1, "w");
+	CHECK_VOID(vdata_id, FAIL, "VSattach");
+
+	/* Record its reference number for later access */
+	vdata_ref = VSQueryref(vdata_id);
+	CHECK_VOID(vdata_ref, FAIL, "VSQueryref:vdata_id");
+	vdref_list[ii] = vdata_ref;
+
+	/* Set its class name */
+	sprintf(vgclass, "VS-CLASS-%d", ii);
+	status_32 = VSsetclass(vdata_id, vgclass);
+	CHECK_VOID(status_32, FAIL, "VSsetclass");
+
+	/* Detach it */
+	status_32 = VSdetach(vdata_id);
+	CHECK_VOID(status_32, FAIL, "VSdetach");
+    }
+
+    /* Insert some vdatas/vgroups into some other vgroups to build some sort of
+	vgroup/vdata structure */
+
+    /* Insert "VD-CLASS-1" and "VD-CLASS-2" into "VG-CLASS-0" */
+    vgroup0_id = Vattach(fid, ref_list[0], "w");  /* "VG-CLASS-0" */
+    CHECK_VOID(vgroup0_id, FAIL, "Vattach");
+    vdata1_id = VSattach(fid, vdref_list[1], "w");  /* "VD-CLASS-1" */
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+    vdata2_id = VSattach(fid, vdref_list[2], "w");  /* "VD-CLASS-2" */
+    CHECK_VOID(vdata2_id, FAIL, "VSattach");
+
+    /* Define fields for vdata1 and vdata2 */
+    status = VSfdefine(vdata1_id, FLDNAME1, DFNT_CHAR8, 1);
+    CHECK_VOID(status, FAIL, "VSfdefine");
+    status = VSfdefine(vdata1_id, FLDNAME2, DFNT_CHAR8, 3);
+    CHECK_VOID(status, FAIL, "VSfdefine");
+    status = VSsetfields(vdata1_id, FIELD_NAME_LIST1);
+    CHECK_VOID(status, FAIL, "VSsetfields");
+
+    status = VSfdefine(vdata2_id, FLDNAME3, DFNT_INT32, 2);
+    CHECK_VOID(status, FAIL, "VSfdefine");
+    status = VSfdefine(vdata2_id, FLDNAME4, DFNT_FLOAT, 1);
+    CHECK_VOID(status, FAIL, "VSfdefine");
+    status = VSsetfields(vdata2_id, FIELD_NAME_LIST2);
+    CHECK_VOID(status, FAIL, "VSsetfields");
+
+    status_32 = Vinsert(vgroup0_id, vdata1_id);
+    CHECK_VOID(status_32, FAIL, "Vinsert vdata1_id into vgroup0_id");
+    status_32 = Vinsert(vgroup0_id, vdata2_id);
+    CHECK_VOID(status_32, FAIL, "Vinsert vdata2_id into vgroup0_id");
+
+    /* Insert "VD-CLASS-0", "VG-CLASS-0", and "VG-CLASS-1" into "VG-CLASS-2" */
+    vdata0_id = VSattach(fid, vdref_list[0], "w");
+    CHECK_VOID(vdata0_id, FAIL, "Vattach");
+    vgroup1_id = Vattach(fid, ref_list[1], "w");  /* "VG-CLASS-1" */
+    CHECK_VOID(vgroup1_id, FAIL, "Vattach");
+    vgroup2_id = Vattach(fid, ref_list[2], "w");  /* "VG-CLASS-2" */
+    CHECK_VOID(vgroup2_id, FAIL, "Vattach");
+
+    status_32 = Vinsert(vgroup2_id, vdata0_id);
+    CHECK_VOID(status_32, FAIL, "Vinsert vdata0_id into vgroup2_id");
+    status_32 = Vinsert(vgroup2_id, vgroup0_id);
+    CHECK_VOID(status_32, FAIL, "Vinsert vgroup0_id into vgroup2_id");
+    status_32 = Vinsert(vgroup2_id, vgroup1_id);
+    CHECK_VOID(status_32, FAIL, "Vinsert vgroup1_id into vgroup2_id");
+
+    /***************************************/
+    /* Set attributes for various elements */
+    /***************************************/
+
+    /* Set two attributes for vgroup0 */
+    status = Vsetattr(vgroup0_id, ATTNAME1, DFNT_UINT32, 4, attr1);
+    CHECK_VOID(status, FAIL, "Vsetattr vgroup0_id");
+    status = Vsetattr(vgroup0_id, ATTNAME2, DFNT_CHAR8, 8, attr2);
+    CHECK_VOID(status, FAIL, "Vsetattr vgroup0_id");
+
+    /* Set attribute for vdata0 */
+    status = VSsetattr(vdata0_id, _HDF_VDATA, ATTNAME3, DFNT_CHAR8, 7, attr3);
+    CHECK_VOID(status, FAIL, "VSsetattr vdata0_id");
+
+    /* Set attribute for vdata1/field1 */
+    status = VSfindex(vdata1_id, FLDNAME1, &fldindex);
+    CHECK_VOID(status, FAIL, "VSfindex vdata1_id");
+    VERIFY_VOID(fldindex, 0, "VSfindex vdata1_id");
+
+    /* Set attribute to field FLDNAME1*/
+    status = VSsetattr(vdata1_id, fldindex, ATTNAME4, DFNT_CHAR8, 7, attr4);
+    CHECK_VOID(status, FAIL, "VSsetattr vdata1_id");
+
+    /* Change values of existing attribute */
+     /* Vsetattr(vgid, ATTNAME1, DFNT_UINT32, 2, &attr1[2]))
+ */ 
+    /* Terminate access to any opened elements */
+    status_32 = Vdetach(vgroup0_id);
+    CHECK_VOID(status_32, FAIL, "Vdetach vgroup0_id");
+    status_32 = Vdetach(vgroup1_id);
+    CHECK_VOID(status_32, FAIL, "Vdetach vgroup1_id");
+    status_32 = Vdetach(vgroup2_id);
+    CHECK_VOID(status_32, FAIL, "Vdetach vgroup2_id");
+
+    status_32 = VSdetach(vdata0_id);
+    CHECK_VOID(status_32, FAIL, "VSdetach vdata0_id");
+    status_32 = VSdetach(vdata1_id);
+    CHECK_VOID(status_32, FAIL, "VSdetach vdata1_id");
+    status_32 = VSdetach(vdata2_id);
+    CHECK_VOID(status_32, FAIL, "VSdetach vdata2_id");
+
+    /* Terminate access to the V interface and close the HDF file.  */
+    status = Vend (fid);
+    CHECK_VOID(status, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /**************************************************************
+	The following elements have attributes:
+	vgroup0: attr1 and attr2
+	vdata0: attr3
+	FLDNAME1 of vdata1: attr4
+    ***************************************************************/
+
+    /* Open the file to test Vgetattdatainfo and VSgetattdatainfo */
+    fid = Hopen(ATTRFILE, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status, FAIL, "Vstart");
+
+    /* Attach to vgroup0, vdata0, and vdata1 for attribute's data info */
+    vgroup0_id = Vattach(fid, ref_list[0], "w");  /* "VG-CLASS-0" */
+    CHECK_VOID(vgroup0_id, FAIL, "Vattach");
+    vdata0_id = VSattach(fid, vdref_list[0], "w");  /* "VD-CLASS-0" */
+    CHECK_VOID(vdata0_id, FAIL, "Vattach");
+    vdata1_id = VSattach(fid, vdref_list[1], "w");  /* "VD-CLASS-1" */
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+
+    /* Get data info of the first attribute from vdata0 */
+    status = VSgetattdatainfo(vdata0_id, _HDF_VDATA, 0, &offset, &length);
+    CHECK_VOID(status, FAIL, "VSgetattdatainfo");
+
+    /* Read and verify an attribute without using HDF4 library */
+    status = readnoHDF_char(ATTRFILE, offset, length, attr3);
+    CHECK_STATUS(status, FAIL, "Verifying data without HDF4 library failed");
+
+    /* Reset offset/length */
+    offset = length = 0;
+
+    /* Get data info of the first attribute from vdata1/FLDNAME1 */
+    status = VSgetattdatainfo(vdata1_id, 0, 0, &offset, &length);
+    CHECK_VOID(status, FAIL, "VSgetattdatainfo");
+
+    /* Read and verify an attribute without using HDF4 library */
+    status = readnoHDF_char(ATTRFILE, offset, length, attr4);
+    CHECK_STATUS(status, FAIL, "Verifying data without HDF4 library failed");
+
+    /* Get data info of the first attributes from vgroup0 */
+    status = Vgetattdatainfo(vgroup0_id, 0, &offset, &length);
+    CHECK_VOID(status, FAIL, "Vgetattdatainfo");
+
+    /* Reset offset/length */
+    offset = length = 0;
+
+    /* Get data info of the second attributes from vgroup0 */
+    status = Vgetattdatainfo(vgroup0_id, 1, &offset, &length);
+    CHECK_VOID(status, FAIL, "Vgetattdatainfo");
+
+    /* Read and verify an attribute without using HDF4 library */
+    status = readnoHDF_char("tattdatainfo.hdf", offset, length, attr2);
+    CHECK_STATUS(status, FAIL, "Verifying data without HDF4 library failed");
+
+    /* Terminate access to any opened elements */
+    status_32 = Vdetach(vgroup0_id);
+    CHECK_VOID(status_32, FAIL, "Vdetach vgroup0_id");
+    status_32 = VSdetach(vdata0_id);
+    CHECK_VOID(status_32, FAIL, "VSdetach vdata0_id");
+    status_32 = VSdetach(vdata1_id);
+    CHECK_VOID(status_32, FAIL, "VSdetach vdata1_id");
+
+    /* Terminate access to the V interface and close the HDF file.  */
+    status = Vend (fid);
+    CHECK_VOID(status, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+} /* test_vvsattrs() */
+
+static void
+test_vgmixedattrs()
+{
+    int32 fid;          /* File ID */
+    int32 vgroup_id, vgroup_ref;
+    int32 n_attrs;
+    int32 ref_list[NUM_VGROUPS], vdref_list[NUM_VDATAS];
+    int32 offsets[10], lengths[10];  /* offsets and lengths of attrs' data */
+    /* Note: each array element is associated with an individual attribute, not
+       a data element block; data of an attribute only has one pair of off/len*/
+    char vgclass[20];
+    int ii;
+    int32 attr_ref;
+    intn  status;	/* returned status */
+    intn  status_32;	/* returned status for functions returning an int32! */
+
+    /* Attribute names to be checked against */
+    char aname_check[5][20] = {ATTNAME1, ATTNAME2, ATTNAME5, ATTNAME6, ATTNAME7};
+
+    /* Attributes to be set for various elements */
+    uint32 attr1[4] = {4, 5, 6, 7}; /* copied from test_vvsattrs, only to
+					verify previously added attribute */
+    char attr2[12] = {'V','G','0',' ','n','e','w','a','t','t','r','\0'};
+    char attr3[13] = {'V','G','0',' ','o','l','d','a','t','t','r','0','\0'};
+    char attr4[13] = {'V','G','0',' ','o','l','d','a','t','t','r','1','\0'};
+
+    /* Create HDF file and initialize the interface. */
+    fid = Hopen(ATTRFILE, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status, FAIL, "Vstart");
+
+	/* Get access to first vgroup. */
+    vgroup_ref = Vgetid(fid, -1);
+    CHECK_VOID(vgroup_ref, FAIL, "Vgetid");
+    vgroup_id = Vattach(fid, vgroup_ref, "w");
+    CHECK_VOID(vgroup_id, FAIL, "Vattach");
+
+    /* Current number of attributes belong to this vgroup */
+    n_attrs = Vnattrs(vgroup_id);
+    CHECK_VOID(n_attrs, FAIL, "Vnattrs");
+    VERIFY_VOID(n_attrs, 2, "Vnattrs");
+    for (ii = 0; ii < n_attrs; ii++)
+    {
+	char aname[20];
+	int32 atype, acount, asize;
+	status = Vattrinfo(vgroup_id, ii, aname, &atype, &acount, &asize);
+        /* HDstrncmp(iattrname, ATTNAME1, HDstrlen(ATTNAME1)) != 0) */
+    }
+    n_attrs = Vnoldattrs(vgroup_id);
+    VERIFY_VOID(n_attrs, 0, "Vnoldattrs");
+
+    /* Now, add one attribute with Vsetattr, and two attributes with
+	VHstoredatam/Vaddtagref combination */
+
+    /* Add one new-style attribute */
+    status = Vsetattr(vgroup_id, ATTNAME5, DFNT_CHAR8, 12, attr2);
+    CHECK_VOID(status, FAIL, "Vsetattr vgroup_id");
+
+    /* Add two old-style attributes */
+    attr_ref = VHstoredatam(fid, ATTR_FIELD_NAME, (unsigned char *) attr3, 1,
+                          DFNT_CHAR8, ATTNAME6, _HDF_ATTRIBUTE, 13);
+    CHECK_VOID(attr_ref, FAIL, "VHstoredatam");
+    status = Vaddtagref(vgroup_id, DFTAG_VH, attr_ref);
+    CHECK_VOID(status, FAIL, "Vaddtagref");
+
+    attr_ref = VHstoredatam(fid, ATTR_FIELD_NAME, (unsigned char *) attr4, 1,
+                          DFNT_CHAR8, ATTNAME7, _HDF_ATTRIBUTE, 13);
+    CHECK_VOID(attr_ref, FAIL, "VHstoredatam");
+    status = Vaddtagref(vgroup_id, DFTAG_VH, attr_ref);
+    CHECK_VOID(status, FAIL, "Vaddtagref");
+
+    /* Terminate access to any opened elements */
+    status_32 = Vdetach(vgroup_id);
+    CHECK_VOID(status_32, FAIL, "Vdetach vgroup_id");
+
+    /* Terminate access to the V interface and close the HDF file.  */
+    status = Vend (fid);
+    CHECK_VOID(status, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /**************************************************************
+	The following element has changed:
+	vgroup0: 2 attrs from previous test function, then attr2 of
+	new style and attr3 and attr4 of old style here
+    ***************************************************************/
+
+
+    /* Re-open the file to test Vnattrs2, Vattrinfo2, Vgetattr2, and
+	Vgetattdatainfo */
+    fid = Hopen(ATTRFILE, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status, FAIL, "Vstart");
+
+    /* Attach to vgroup0 for attribute info and data */
+    vgroup_id = Vattach(fid, vgroup_ref, "w");  /* "VG-CLASS-0" */
+    CHECK_VOID(vgroup_id, FAIL, "Vattach");
+
+    /* Vnattrs returns number of attributes added by Vsetattr */
+    n_attrs = Vnattrs(vgroup_id);
+    VERIFY_VOID(n_attrs, 3, "Vnattrs");
+
+    /* Vnoldattrs returns number of attrs added by VHstoredatam/Vaddtagref */
+    n_attrs = Vnoldattrs(vgroup_id);
+    VERIFY_VOID(n_attrs, 2, "Vnoldattrs");
+
+    /* Vnattrs2 returns total number of attrs, regardless how they were added */
+    n_attrs = Vnattrs2(vgroup_id);
+    VERIFY_VOID(n_attrs, 5, "Vnattrs2");
+
+    /* Test Vattrinfo2 and Vgetattr2 on each attribute */
+    for (ii = 0; ii < n_attrs; ii++)
+    {
+	char aname[20], values[100];
+	int32 atype, acount, asize, n_fields;
+	uint16 refnum;
+	int jj;
+	char cvalues[20];
+	int32 ivalues[10];
+	char *check_attr_names[5] = {"Attribute 6", "Attribute 7", "Attribute 1"
+					, "Attribute 2", "Attribute 5"};
+	char *check_attr_values[5] = {"VG0 oldattr0", "VG0 oldattr1",
+			"", /* int values, added by test_vvsattrs with attr1 */
+			"Vgroup0", /* added by test_vvsattrs with attr2 */
+			"VG0 newattr"};
+
+	/* Get attribute information and verify its name and number of fields,
+	   which should be 1 */
+	status = Vattrinfo2(vgroup_id, ii, aname, &atype, &acount, &asize,
+			&n_fields, &refnum);
+	VERIFY_CHAR_VOID(aname, check_attr_names[ii], "Vattrinfo2");
+	VERIFY_VOID(n_fields, 1, "Vattrinfo2");
+
+	/* Test Vgetattr2 to make sure it works with mixed attributes */
+	switch (atype)
+	{
+	  case DFNT_CHAR:
+	    /* Get and verify values of a char attribute */
+	    status = Vgetattr2(vgroup_id, ii, (void *)cvalues);
+	    VERIFY_CHAR_VOID(cvalues, check_attr_values[ii], "Vgetattr2 char");
+
+	    /* Add an extra test for Vgetattdatainfo */
+
+	    /* Get data info and verify number of data block */
+	    status = Vgetattdatainfo(vgroup_id, ii, &offsets[ii], &lengths[ii]);
+	    CHECK_VOID(status, FAIL, "Vgetattdatainfo");
+	    VERIFY_VOID(status, 1, "Vgetattdatainfo");
+
+	    /* Read and verify data of an attr without using HDF4 library */
+	    status = readnoHDF_char(ATTRFILE, offsets[ii], lengths[ii], check_attr_values[ii]);
+	    CHECK_STATUS(status, FAIL, "Verifying data without HDF4 library failed");
+
+	    break;
+	  case DFNT_UINT32:
+	    /* Get and verify values of an int attribute */
+	    status = Vgetattr2(vgroup_id, ii, (void *)ivalues);
+	    for (jj = 0; jj < acount; jj++)
+		VERIFY_VOID(ivalues[jj], attr1[jj], "Vgetattr2 int");
+	    break;
+	  default:
+	    fprintf(stderr, "type %d is not handled!\n", atype);
+	    break;
+	}
+    }
+
+    /* Terminate access to the vgroup */
+    status_32 = Vdetach(vgroup_id);
+    CHECK_VOID(status_32, FAIL, "Vdetach vgroup_id");
+
+    /* Terminate access to the V interface and close the HDF file.  */
+    status = Vend (fid);
+    CHECK_VOID(status, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+} /* test_vgmixedattrs() */
+
+
+/****************************************************************************
+   Name: test_grattrs() - tests getting attribute data information from
+			   GR file and raster images
+
+   Description:
+	This routine performs the following steps:
+	- Create a new file with the GR interface
+	- Creates and write two raster images with GRcreate and GRwritedata
+	- Set two attributes to the file
+	- Set one attribute to each of the images
+	- Terminate access to images and file
+	- Reopen the file and images to retrieve their attribute's data info
+	- Call readnoHDF_char to open the file without HDF library then
+	  read in attributes having char data using the previously recorded
+	  offsets/lengths and verify the data
+   BMR - Sep 2010
+ ****************************************************************************/
+#define GRATTRFILE	"tgrattrdatainfo.hdf"
+#define	IMAGE_NAME	"Image Array 1"
+#define	F_ATT1_NAME	"File Attribute 1"
+#define	F_ATT2_NAME	"File Attribute 2"
+#define	RI_ATT1_NAME	"Image Attribute 1"
+#define	RI_ATT2_NAME	"Image Attribute 2"
+#define	F_ATT1_VAL	"Contents of First FILE attribute"
+#define	F_ATT2_VAL	"Contents of Second FILE attribute"
+#define	F_ATT1_COUNT	32
+#define	F_ATT2_COUNT	33
+#define	RI_ATT1_VAL	"Contents of IMAGE's First Attribute"
+#define	RI_ATT1_COUNT	35
+#define	RI_ATT2_COUNT	6
+#define	X_LENGTH	10	/* number of columns in the image */
+#define	Y_LENGTH	5	/* number of rows in the image */
+#define	N_COMPS		1	/* number of components in the image */
+
+static void
+test_grattrs()
+{
+    int32 file_id,	/* HDF file identifier */
+	  gr_id,	/* GR interface identifier */
+	  ri_id,	/* raster image identifier */
+	  num_type,	/* number type of the image values */
+          start[2],	/* where to start to write for each dimension  */
+          edges[2],	/* how long to write for each dimension */
+	  dimsizes[2],	/* sizes of the two dimensions of the image array   */
+	  interlace_mode,/* interlace mode of the image */
+	  ii, jj;
+    intn  status;
+    int16 ri_att2_val[RI_ATT2_COUNT] = {1, 2, 3, 4, 5, 6};
+    int8  image_buf[Y_LENGTH][X_LENGTH][N_COMPS];
+    int32 offsets[4], lengths[4];  /* offsets and lengths of attrs' data */
+    /* Note: each array element is associated with an individual attribute, not
+       a data element block; data of an attribute only has one pair of off/len*/
+
+    /********************** End of variable declaration **********************/
+
+    /* Create and open the file. */
+    file_id = Hopen (GRATTRFILE, DFACC_CREATE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface. */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Set the number type, interlace mode, and dimensions of the image. */
+    interlace_mode = MFGR_INTERLACE_LINE;
+    dimsizes[0] = X_LENGTH;
+    dimsizes[1] = Y_LENGTH;
+
+    /* Create a raster image array. */
+    ri_id = GRcreate(gr_id, IMAGE_NAME, N_COMPS, DFNT_INT8, 
+   				interlace_mode, dimsizes);
+    CHECK_VOID(ri_id, FAIL, "GRcreate");
+
+    /* Fill the image data buffer with values. */
+    for (ii = 0; ii < Y_LENGTH; ii++)
+    {
+      for (jj = 0; jj < X_LENGTH; jj++)
+      {
+         image_buf[ii][jj][0] = (ii + jj) + 1;     /* first component */
+      }
+    }
+
+    /* Define the size of the data to be written, i.e., start from the origin
+    * and go as long as the length of each dimension. */
+    start[0] = start[1] = 0;
+    edges[0] = X_LENGTH;
+    edges[1] = Y_LENGTH;
+
+    /* Write the data into the image array and terminate access to the RI. */
+    status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)image_buf);
+    CHECK_VOID(status, FAIL, "GRwriteimage");
+    status = GRendaccess(ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Set two file attributes to the file with names, data types, numbers of 
+    * values, and values of the attributes specified. */
+    status = GRsetattr(gr_id, F_ATT1_NAME, DFNT_CHAR8, F_ATT1_COUNT, F_ATT1_VAL); 
+    CHECK_VOID(status, FAIL, "GRsetattr F_ATT1_NAME");
+
+    status = GRsetattr(gr_id, F_ATT2_NAME, DFNT_CHAR8, F_ATT2_COUNT, F_ATT2_VAL);
+    CHECK_VOID(status, FAIL, "GRsetattr F_ATT2_NAME");
+
+    /* Get access to the first and only image in the file */
+    ri_id = GRselect(gr_id, 0);
+    CHECK_VOID(ri_id, FAIL, "GRselect index 0");
+
+    /* Set two attribute to the image with names, data types, numbers of 
+    * values, and values of the attributes specified. */
+    status = GRsetattr(ri_id, RI_ATT1_NAME, DFNT_CHAR8, RI_ATT1_COUNT, RI_ATT1_VAL);
+    CHECK_VOID(status, FAIL, "GRsetattr RI_ATT1_NAME");
+
+    status = GRsetattr(ri_id, RI_ATT2_NAME, DFNT_INT16, RI_ATT2_COUNT, (VOIDP)ri_att2_val);
+    CHECK_VOID(status, FAIL, "GRsetattr RI_ATT2_NAME");
+
+    /* Terminate access to the raster image and to the GR interface and 
+    * close the HDF file. */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /* Re-open the file, get data info of some attributes, then verify their
+       data */
+
+    /* Open the HDF file and initialize the GR interface. */
+    file_id = Hopen(GRATTRFILE, DFACC_RDONLY, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen GRATTRFILE");
+    gr_id = GRstart(file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart GRATTRFILE");
+
+    /* Get access to the image, first and only */
+    ri_id = GRselect(gr_id, 0);
+    CHECK_VOID(ri_id, FAIL, "GRselect index 0");
+
+    /* Get data info of file attr and store them in offsets/lengths[0,1] */
+    status = GRgetattdatainfo(gr_id, 0, &offsets[0], &lengths[0]);
+    CHECK_VOID(status, FAIL, "GRgetattdatainfo");
+    status = GRgetattdatainfo(gr_id, 1, &offsets[1], &lengths[1]);
+    CHECK_VOID(status, FAIL, "GRgetattdatainfo");
+
+    /* Get data info of image attr and store them in offsets/lengths[2,3] */
+    status = GRgetattdatainfo(ri_id, 0, &offsets[2], &lengths[2]);
+    CHECK_VOID(status, FAIL, "GRgetattdatainfo");
+    status = GRgetattdatainfo(ri_id, 1, &offsets[3], &lengths[3]);
+    CHECK_VOID(status, FAIL, "GRgetattdatainfo");
+
+    /* This image should be mapped-able by the HDF4 map writer because even
+       though it was created by GR, it has 8-bit data, 1 compnonent, and no
+       compression */
+    {
+	intn is_mappedable;
+	intn name_generated;
+
+        status = GR2bmapped(ri_id, &is_mappedable, &name_generated);
+        CHECK_VOID(status, FAIL, "GR2bmapped");
+        VERIFY_VOID(is_mappedable, TRUE, "GR2bmapped");
+        VERIFY_VOID(name_generated, FALSE, "GR2bmapped");
+    }
+
+    /* Terminate access to the image and to the GR interface and close the
+     * HDF file. */
+    status = GRendaccess(ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+    status = GRend(gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /* Verify data of attributes without the use of HDF4 library */
+    status = readnoHDF_char(GRATTRFILE, offsets[0], lengths[0], F_ATT1_VAL);
+    CHECK_STATUS(status, FAIL, "Verifying data without HDF4 library failed");
+    status = readnoHDF_char(GRATTRFILE, offsets[1], lengths[1], F_ATT2_VAL);
+    CHECK_STATUS(status, FAIL, "Verifying data without HDF4 library failed");
+    status = readnoHDF_char(GRATTRFILE, offsets[2], lengths[2], RI_ATT1_VAL);
+    CHECK_STATUS(status, FAIL, "Verifying data without HDF4 library failed");
+    /* Note: readnoHDF_char is defined in tdatainfo.c */
+} /* test_grattrs() */
+
+/* Test driver for testing the public functions VSgetattdatainfo, 
+   Vgetattdatainfo, and GRgetattdatainfo. */
+void
+test_attdatainfo()
+{
+    /* Test attributes on vgroups and vdatas */
+    test_vvsattrs();
+
+    /* Test handling vgroup attributes created without Vsetattr */
+    test_vgmixedattrs();
+
+    /* Test GR API attributes */
+    test_grattrs();
+}
diff --git a/hdf/test/tbv.c b/hdf/test/tbv.c
new file mode 100644
index 0000000..3aa5db5
--- /dev/null
+++ b/hdf/test/tbv.c
@@ -0,0 +1,231 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5201 $";
+#endif
+
+/* $Id: tbv.c 5201 2009-06-18 14:11:06Z bmribler $ */
+
+/*
+   FILE
+   tbv.c
+   Test HDF bit-vector (bv) routines.
+
+   REMARKS
+
+   DESIGN
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   12/11/95 - Started coding.
+ */
+
+#include "tproto.h"
+#include "bitvect.h"
+
+static void test_1(void);
+static void test_2(void);
+static void test_3(void);
+
+/* Basic creation & deletion tests */
+static void test_1(void)
+{
+    bv_ptr b;
+    int32 size;
+    uint32 flags;
+    intn ret;
+
+    MESSAGE(6, printf("Testing basic bit-vector creation & deletion\n"););
+
+    MESSAGE(7, printf("Create a bit-vector with all defaults\n"););
+    b=bv_new(-1,0); /* test basic default creation */
+    CHECK_VOID(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY_VOID(size,BV_DEFAULT_BITS,"bv_size");
+    flags=bv_flags(b);
+    CHECK_VOID(flags,(uint32)FAIL,"bv_flags");
+    MESSAGE(8, printf("Bit-vector flags=%lx\n",(unsigned long)flags););
+    ret=bv_delete(b);
+    CHECK_VOID(ret,FAIL,"bv_delete");
+
+    MESSAGE(7, printf("Create an extendable bit-vector with large # of bits\n"););
+    b=bv_new(80000,BV_EXTENDABLE); /* test creation */
+    CHECK_VOID(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY_VOID(size,80000,"bv_size");
+    flags=bv_flags(b);
+    CHECK_VOID(flags,(uint32)FAIL,"bv_flags");
+    MESSAGE(8, printf("Bit-vector flags=%lx\n",(unsigned long)flags););
+    ret=bv_delete(b);
+    CHECK_VOID(ret,FAIL,"bv_delete");
+} /* end test_1 */
+
+/* Basic set & get tests */
+static void test_2(void)
+{
+    bv_ptr b;
+    int32 size;
+    uint32 flags;
+    intn ret;
+
+    MESSAGE(6, printf("Testing basic bit-vector set & get \n"););
+
+    MESSAGE(7, printf("Create a bit-vector with all defaults\n"););
+    b=bv_new(-1,0); /* test basic default creation */
+    CHECK_VOID(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY_VOID(size,BV_DEFAULT_BITS,"bv_size");
+    flags=bv_flags(b);
+    CHECK_VOID(flags,(uint32)FAIL,"bv_flags");
+    MESSAGE(8, printf("Bit-vector flags=%lx\n",(unsigned long)flags););
+    /* Check setting bits */
+    ret=bv_set(b,13,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+    ret=bv_set(b,3,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+    ret=bv_set(b,150,BV_TRUE);
+    VERIFY_VOID(ret,FAIL,"bv_set");
+    /* Check getting bits */
+    ret=bv_get(b,2);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,3);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,0);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,13);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,-1);
+    VERIFY_VOID(ret,FAIL,"bv_get");
+    ret=bv_delete(b);
+    CHECK_VOID(ret,FAIL,"bv_delete");
+
+    MESSAGE(7, printf("Create an extendable bit-vector with large # of bits\n"););
+    b=bv_new(1000,BV_EXTENDABLE); /* test creation */
+    CHECK_VOID(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY_VOID(size,1000,"bv_size");
+    flags=bv_flags(b);
+    CHECK_VOID(flags,(uint32)FAIL,"bv_flags");
+    MESSAGE(8, printf("Bit-vector flags=%lx\n",(unsigned long)flags););
+    /* Check setting bits */
+    ret=bv_set(b,13,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+    ret=bv_set(b,3,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+    ret=bv_set(b,1050,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+    /* Check getting bits */
+    ret=bv_get(b,2);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,3);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,0);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,13);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,1040);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,1050);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+    ret=bv_delete(b);
+    CHECK_VOID(ret,FAIL,"bv_delete");
+} /* end test_2 */
+
+/* Advanced set & get tests */
+static void test_3(void)
+{
+    bv_ptr b;
+    int32 size;
+    uint32 flags;
+    intn ret;
+
+    MESSAGE(6, printf("Testing basic bit-vector set & get \n"););
+
+    MESSAGE(7, printf("Create an extendable bit-vector\n"););
+    b=bv_new(-1,BV_EXTENDABLE); /* test creation */
+    CHECK_VOID(b,NULL,"bv_new");
+    size=bv_size(b);
+    MESSAGE(8, printf("Bit-vector size=%d\n",(int)size););
+    VERIFY_VOID(size,BV_DEFAULT_BITS,"bv_size");
+    flags=bv_flags(b);
+    CHECK_VOID(flags,(uint32)FAIL,"bv_flags");
+    MESSAGE(8, printf("Bit-vector flags=%lx\n",(unsigned long)flags););
+
+    /* Check setting bits */
+    ret=bv_set(b,13,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+    ret=bv_set(b,3,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+    ret=bv_set(b,150,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+
+    /* Check getting bits */
+    ret=bv_get(b,2);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,3);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,0);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,13);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+    ret=bv_get(b,140);
+    VERIFY_VOID(ret,BV_FALSE,"bv_get");
+    ret=bv_get(b,150);
+    VERIFY_VOID(ret,BV_TRUE,"bv_get");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK_VOID(size,FAIL,"bv_find");
+    MESSAGE(8, printf("First 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK_VOID(size,FAIL,"bv_find");
+    MESSAGE(8, printf("Second 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK_VOID(size,FAIL,"bv_find");
+    MESSAGE(8, printf("Third 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+
+    size=bv_find(b,-1,BV_FALSE);
+    CHECK_VOID(size,FAIL,"bv_find");
+    MESSAGE(8, printf("Fourth 0 found at: %lu\n",(unsigned long)size););
+    ret=bv_set(b,size,BV_TRUE);
+    CHECK_VOID(ret,FAIL,"bv_set");
+
+    ret=bv_delete(b);
+    CHECK_VOID(ret,FAIL,"bv_delete");
+} /* end test_3 */
+
+void test_bitvect(void)
+{
+    test_1();   /* basic creation & deletion tests */
+    test_2();   /* basic set & get testing */
+    test_3();   /* advanced set & get testing */
+}   /* end test_bitvect() */
+
diff --git a/hdf/test/tdatainfo.c b/hdf/test/tdatainfo.c
new file mode 100644
index 0000000..0a078df
--- /dev/null
+++ b/hdf/test/tdatainfo.c
@@ -0,0 +1,1574 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tdatainfo.c - tests the functions VSgetdatainfo, ANgetdatainfo,
+ *			GRgetdatainfo, and Hgetntinfo
+ * Structure of the file:
+ *    test_datainfo - test driver
+ *	test_simple_vs   - test VSgetdatainfo with data stored in one
+ *			   contiguous block
+ *	test_append_vs   - test VSgetdatainfo with data stored in linked blocks
+ *	test_annotation  - test ANgetdatainfo
+ *	test_oneblock_ri - test GRgetdatainfo with images stored in one
+ *			   contiguous block, with and without compression
+ *	test_dfr8_24     - test GRgetdatainfo with RI8 and RI24
+ *	test_getntinfo   - test Hgetntinfo
+ ****************************************************************************/
+
+#ifndef MFAN_TESTER
+#define MFAN_TESTER	/* to use MFAN API */
+#endif
+
+#include "hdf.h"
+#include "tdatainfo.h"
+#include "tproto.h"
+
+static void test_simple_vs();
+static void test_append_vs();
+static void test_annotation();
+static void test_oneblock_ri();
+static void test_dfr8_24();
+static void test_getntinfo();
+static void test_getpalinfo();
+
+/***********************************************************************
+  NOTE: At this time, some of the offsets in these tests are verified
+	by hard-coding.  When adding new data to the files in exiting
+	tests, please either add data at the bottom of the files or
+	change the hard-coded offsets appropriately, using the values
+	from the error messages.  However, you'll need to verify the
+	correctness of these values first using the command 'od' on
+	the hdf file.
+*************************************************************************/
+
+/* Structure to hold annotation datainfo temporarily */
+typedef struct
+  {
+	char anntext[100]; /* values of the annotation */
+	int32 offset; /* offset of data block */
+	int32 length; /* length of data block */
+  } t_ann_info_t;
+
+/* Functions to access t_hdfdatainfo_t, defined in ./tdatainfo.h */
+
+/* alloc_info is a utility function that allocates t_hdf_datainfo_t's members*/
+intn alloc_info(t_hdf_datainfo_t *info, uintn info_count)
+{
+    info->offsets = (int32 *) HDmalloc(info_count * sizeof(int32));
+    if (info->offsets == NULL)
+        return -1;
+    info->lengths = (int32 *) HDmalloc(info_count * sizeof(int32));
+    if (info->lengths == NULL)
+        return -1;
+    return 0;
+}
+
+void free_info(t_hdf_datainfo_t *info)
+{
+    if (info != NULL) {
+        if (info->offsets != NULL)
+            HDfree(info->offsets);
+        if (info->lengths != NULL)
+            HDfree(info->lengths);
+    }
+}
+
+/****************************************************************************
+   Name: test_simple_vs() - tests non-special Vdatas
+
+   Description:
+	This routine creates and writes contiguous data to vdatas and verifies
+        some data and data information with VSgetdatainfo.  The tests include
+        the following vdatas:
+	- a single field vdata with int32 values
+	- a multiple field/multiple order vdata with all int32 values
+	- a single field vdata with character values
+	Only the character vdata's values are verified against the original
+	buffer.  The other two were verified by examining the hdf file using
+	od. (Todo 1)
+   BMR - Jul 2010
+ ****************************************************************************/
+#define SIMPLE_FILE	"tdatainfo_simple.hdf"   /* data file */
+#define NONSPECIAL_VS	"Non-Special Vdata"
+#define CONTCLASS_NAME	"Contiguous Vdata"
+#define LINKED_BLOCK	"Linked-block Vdata"
+#define FIELD1_NAME	"Field1"	/* contains three integers */
+#define FIELD2_NAME	"Field2"	/* contains one integer */
+#define FIELD3_NAME	"Field3"	/* contains two integers */
+#define	FIELD_NAME_LIST	"Field1,Field2,Field3"
+#define ORDER_1 	3	/* order of first field of 1st vdata */
+#define ORDER_2 	1	/* order of second field of 1st vdata */
+#define ORDER_3 	2	/* order of third field of 1st vdata */
+#define	BLOCK_SIZE	80	/* arbitrary number for block size */
+#define	NUM_BLOCKS	8	/* arbitrary number for number of blocks */
+#define N_VALS_PER_REC_1   1    /* # of values per record in single vdata */
+#define N_VALS_PER_REC_2 (ORDER_1+ORDER_2+ORDER_3) /* # of vals/rec. in multiple vdata */
+#define N_RECORDS	5	/* number of records to be written to the
+				   vdatas at every write */
+static void
+test_simple_vs()
+{
+    int32 fid,		/* File ID */
+	  vsid,		/* Vdata ID */
+	  vs_ref,	/* Vdata ref# */
+	  n_records,	/* number of records actually written to vdata */
+	  data_buf0[N_RECORDS][N_VALS_PER_REC_1], /* for single vdata's data */
+	  data_buf1[N_RECORDS][N_VALS_PER_REC_2]; /* for multiple vdata's data*/
+    char  data_buf2[N_RECORDS] = {'H', '4', 'M', 'A', 'P'};
+    int16 rec_num;	/* current record number */
+    int32 offset, length; /* offset/length buffers for single block of data */
+    intn  n_blocks;	/* number of blocks a vdata has */
+#ifdef NOTUSED
+    t_hdf_datainfo_t vs_info; /* data structure to hold offset/length arrays and
+	some other information about the data */
+#endif
+    int32 status;	/* Status values from routines */
+    intn status_n;	/* Status values from routines */
+
+    /* Open the HDF file and initialize the interface. */
+    fid = Hopen(SIMPLE_FILE, DFACC_CREATE, 0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Create and write to the first vdata using high-level func VHstoredata */
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+	data_buf0[rec_num][0] = 5 + rec_num;
+
+    vs_ref = VHstoredata(fid, "Only field", (const uint8 *)data_buf0, N_RECORDS, DFNT_INT32, "One Field One Order", CONTCLASS_NAME);
+
+    /*
+     * Get access to the vdata just created then get and verify offset/length
+     * of its data
+     */
+
+    vsid = VSattach (fid, vs_ref, "w");
+    CHECK_VOID(vsid, FAIL, "VSattach");
+
+    /* Get the number of data blocks first, should be 1 */
+    n_blocks = VSgetdatainfo(vsid, 0, 0, NULL, NULL);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+    VERIFY_VOID(n_blocks, 1, "VSgetdatainfo");
+
+    /* Get the offset/length of the data, should be 294/20 */
+    n_blocks = VSgetdatainfo(vsid, 0, n_blocks, &offset, &length);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+
+    /* Verify offset/length */
+    VERIFY_VOID(offset, 294, "VSgetdatainfo offset from 'One Field One Order'");
+    VERIFY_VOID(length, 20, "VSgetdatainfo length from 'One Field One Order'");
+
+    status = VSdetach (vsid);
+    CHECK_VOID(status, FAIL, "VSdetach");
+
+    /*
+     * Create a multi-field/multi-order vdata, named NONSPECIAL_VS, in class
+     * CONTCLASS_NAME, write data to it, then get and verify its data's
+     * offsets/lengths
+     */
+    vsid = VSattach (fid, -1, "w");
+    CHECK_VOID(vsid, FAIL, "VSattach");
+
+    /* Set name and class name of the vdata. */
+    status = VSsetname (vsid, NONSPECIAL_VS);
+    CHECK_VOID(status, FAIL, "VSsetname");
+    status = VSsetclass (vsid, CONTCLASS_NAME);
+    CHECK_VOID(status, FAIL, "VSsetclass");
+
+    /* Record its reference number for later access before detaching it */
+    vs_ref = VSQueryref(vsid);
+    CHECK_VOID(vs_ref, FAIL, "VSQueryref");
+    status = VSdetach (vsid);
+    CHECK_VOID(status, FAIL, "VSdetach");
+
+    /* Attach to vdata NONSPECIAL_VS to write data, but first verify that
+	number of data blocks is 0 */
+    vsid = VSattach (fid, vs_ref, "w");
+    CHECK_VOID(vsid, FAIL, "VSattach");
+
+    n_blocks = VSgetdatainfo(vsid, 0, 0, NULL, NULL);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+    VERIFY_VOID(n_blocks, 0, "VSgetdatainfo");
+
+    /* Define the fields in the vdata */
+    status_n = VSfdefine (vsid, FIELD1_NAME, DFNT_INT32, ORDER_1);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (vsid, FIELD2_NAME, DFNT_INT32, ORDER_2);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (vsid, FIELD3_NAME, DFNT_INT32, ORDER_3);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSsetfields (vsid, FIELD_NAME_LIST);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+
+    /* 
+     * Buffer the data by the record for fully interlaced mode.  Note that the
+     * first three elements contain the three values of the first field, the
+     * fourth element contains the value of the second field, and the last two
+     * elements contain the two values of the third field.
+     */
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+    {
+        data_buf1[rec_num][0] = 2; /* easier to inspect the binary file using */
+        data_buf1[rec_num][1] = 2; /* a simple value */
+        data_buf1[rec_num][2] = 2;
+        data_buf1[rec_num][3] = 2;
+        data_buf1[rec_num][4] = 2;
+        data_buf1[rec_num][5] = 2;
+        /*  data_buf1[rec_num][0] = 1 + rec_num;
+        data_buf1[rec_num][1] = 2 + rec_num;
+        data_buf1[rec_num][2] = 3 + rec_num;
+        data_buf1[rec_num][3] = 10 + rec_num;
+        data_buf1[rec_num][4] = 10;
+        data_buf1[rec_num][5] = 65;
+ */ 
+    }
+
+    /* Set the block size and the number of blocks */
+    status_n = VSsetblocksize(vsid, BLOCK_SIZE);
+    CHECK_VOID(status_n, FAIL, "VSsetblocksize");
+    status_n = VSsetnumblocks(vsid, NUM_BLOCKS);
+    CHECK_VOID(status_n, FAIL, "VSsetnumblocks");
+
+    /* Write the data from data_buf1 to the non special vdata */
+    n_records = VSwrite(vsid, (uint8 *)data_buf1, N_RECORDS, FULL_INTERLACE);
+    VERIFY_VOID(n_records, N_RECORDS, "VSwrite");
+
+    n_blocks = VSgetdatainfo(vsid, 0, 0, NULL, NULL);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+    VERIFY_VOID(n_blocks, 1, "VSgetdatainfo");
+
+    n_blocks = VSgetdatainfo(vsid, 0, n_blocks, &offset, &length);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+
+    /* Verify offset/length */
+    VERIFY_VOID(offset, 456, "VSgetdatainfo offset from NONSPECIAL_VS");
+    VERIFY_VOID(length, 120, "VSgetdatainfo length from NONSPECIAL_VS");
+
+    status_n = VSdetach(vsid);
+    CHECK_VOID(status_n, FAIL, "VSdetach");
+
+    /* Create and write to another simple vdata, named 'Characters Only', in
+	class CONTCLASS_NAME */
+    vs_ref = VHstoredata(fid, "Only field", (const uint8 *)data_buf2,
+		 N_RECORDS, DFNT_CHAR, "Characters Only", CONTCLASS_NAME); 
+    CHECK_VOID(vs_ref, FAIL, "VHstoredata");
+
+
+    /* Attach to vdata 'Characters Only' and get offset and length of its data */
+    vsid = VSattach(fid, vs_ref, "r");
+
+    n_blocks = VSgetdatainfo(vsid, 0, 0, NULL, NULL);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+    VERIFY_VOID(n_blocks, 1, "VSgetdatainfo NONSPECIAL_VS");
+
+#ifdef NOTUSED
+    /* Allocate space to record the vdata's data info */
+    if (alloc_info(&vs_info, n_blocks) == -1)
+        exit(1);
+
+    /* Record various info */
+    vs_info.n_values = 5;
+    vs_info.numtype = DFNT_CHAR;
+#endif
+
+    /* Get offset/length */
+    n_blocks = VSgetdatainfo(vsid, 0, n_blocks, &offset, &length);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+
+    /* Close everything */
+    status = VSdetach (vsid);
+    CHECK_VOID(status, FAIL, "VSdetach");
+
+    status_n = Vend(fid);
+    CHECK_VOID(status_n,FAIL, "Vend");
+
+    status_n = Hclose(fid);
+    CHECK_VOID(status_n,FAIL, "Hclose");
+
+    /* Open the file with fopen, read data at the offset obtained and verify
+       the values */
+    status_n = readnoHDF_char(SIMPLE_FILE, offset, length, data_buf2);
+    if (status_n == FAIL)
+	fprintf(stderr, "Attempt reading data without HDF4 library failed at line %d\n", __LINE__);
+} /* test_simple_vs() */
+
+
+/****************************************************************************
+   Name: test_append_vs() - tests Vdatas with linked-blocks
+
+   Description:
+	This routine creates and writes data to an appendable vdata and
+	verifies its data information with VSgetdatainfo.  The tests include
+        the following:
+	- create and write to an appendable vdata
+	- create and write to a simple vdata
+	- add data to the appendable vdata
+	- use VSgetdatainfo to get offsets/lengths of the linked-blocks of data
+   BMR - Jul 2010
+ ****************************************************************************/
+#define APPEND_FILE	"tdatainfo_linkblock.hdf"   /* data file */
+#define APPENDABLE_VD	"Appendable Vdata"
+static void
+test_append_vs()
+{
+    int32 fid;       /* file ID */
+    int32 apvsid;    /* vdata IDs */
+    int32 vs1_ref,   /* vdata ref# */
+   	 n_records,  /* number of records written to vdata */
+         data_buf0[N_RECORDS][N_VALS_PER_REC_1], /* for "Very Simple Vdata" */
+         data_buf1[N_RECORDS][N_VALS_PER_REC_2]; /* for first vdata's data */
+    int16 rec_num;      /* current record number */
+    intn n_blocks;
+    t_hdf_datainfo_t vs_info;
+    int32 status;       /* Status values from routines */
+    intn status_n;       /* Status values from routines */
+
+    /* Open the HDF file. */
+    fid = Hopen(APPEND_FILE, DFACC_CREATE, 0);
+    CHECK_VOID(fid,FAIL, "Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status_n = Vstart(fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    /* Create the first vdata */
+    apvsid = VSattach (fid, -1, "w");
+    CHECK_VOID(apvsid, FAIL, "VSattach");
+
+    vs1_ref = VSQueryref(apvsid);
+    CHECK_VOID(vs1_ref, FAIL, "VSQueryref:apvsid");
+
+    status = VSdetach (apvsid);
+    CHECK_VOID(status, FAIL, "VSdetach");
+
+    apvsid = VSattach (fid, vs1_ref, "w");
+    CHECK_VOID(apvsid, FAIL, "VSattach");
+
+    /* Set name and class name of the vdata. */
+    status = VSsetname (apvsid, APPENDABLE_VD);
+    CHECK_VOID(status, FAIL, "VSsetname");
+    status = VSsetclass (apvsid, LINKED_BLOCK);
+    CHECK_VOID(status, FAIL, "VSsetclass");
+
+    n_blocks = VSgetdatainfo(apvsid, 0, 0, NULL, NULL);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+    VERIFY_VOID(n_blocks, 0, "VSgetdatainfo");
+
+    /* Introduce each field's name, data type, and order.  This is the first
+      part in defining a field.  */
+    status_n = VSfdefine (apvsid, FIELD1_NAME, DFNT_INT32, ORDER_1);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (apvsid, FIELD2_NAME, DFNT_INT32, ORDER_2);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (apvsid, FIELD3_NAME, DFNT_INT32, ORDER_3);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+
+    /* Finalize the definition of the fields. */
+    status_n = VSsetfields (apvsid, FIELD_NAME_LIST);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+
+    /* 
+     * Buffer the data by the record for fully interlaced mode.  Note that the
+     * first three elements contain the three values of the first field, the
+     * fourth element contains the value of the second field, and the last two
+     * elements contain the two values of the third field.
+     */
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+    {
+        data_buf1[rec_num][0] = 5;	/* easier to inspect the bin file */
+        data_buf1[rec_num][1] = 5;
+        data_buf1[rec_num][2] = 5;
+        data_buf1[rec_num][3] = 5;
+        data_buf1[rec_num][4] = 5;
+        data_buf1[rec_num][5] = 5;
+
+	 /* data_buf1[rec_num][0] = 1 + rec_num;
+        data_buf1[rec_num][1] = 2 + rec_num;
+        data_buf1[rec_num][2] = 3 + rec_num;
+        data_buf1[rec_num][3] = 10 + rec_num;
+        data_buf1[rec_num][4] = 10;
+        data_buf1[rec_num][5] = 65;
+ */ 
+    }
+
+    /* Set the block size and the number of blocks the first vdata */
+    status_n = VSsetblocksize(apvsid, BLOCK_SIZE);
+    CHECK_VOID(status_n, FAIL, "VSsetblocksize");
+    status_n = VSsetnumblocks(apvsid, NUM_BLOCKS);
+    CHECK_VOID(status_n, FAIL, "VSsetnumblocks");
+
+    /* Write the data from data_buf1 to vdata APPENDABLE_VD the first time */
+    n_records = VSwrite(apvsid, (uint8 *)data_buf1, N_RECORDS, FULL_INTERLACE);
+    VERIFY_VOID(n_records, N_RECORDS, "VSwrite");
+
+    n_blocks = VSgetdatainfo(apvsid, 0, 0, NULL, NULL);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+
+    /* Allocate space to record the vdata's data info */
+    if (alloc_info(&vs_info, n_blocks) == -1)
+        exit(1);
+
+    /* Get offset and lengths of the data */
+    n_blocks = VSgetdatainfo(apvsid, 0, n_blocks, vs_info.offsets, vs_info.lengths);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+    free_info(&vs_info);
+
+    /* Get the reference number of this vdata for later use */
+    vs1_ref = VSQueryref(apvsid);
+    CHECK_VOID(vs1_ref, FAIL, "VSQueryref");
+
+    /* Make another simple vdata to cause linked-blocks */
+    {
+	int32 vd2_ref;
+
+	for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+	    data_buf0[rec_num][0] = 10 + rec_num;
+
+	/* Create and write to another very simple vdata */
+	vd2_ref = VHstoredata(fid, "Field 1", (const uint8 *)data_buf0, N_RECORDS, DFNT_INT32, "Another One Field One Order", "Very Simple Vdata");
+    }
+
+    /* Make up the second batch of data for the appendable vdata */
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+    {
+        data_buf1[rec_num][0] = 100 + rec_num;
+        data_buf1[rec_num][1] = 200 + rec_num;
+        data_buf1[rec_num][2] = 300 + rec_num;
+        data_buf1[rec_num][3] = 1000 + rec_num;
+        data_buf1[rec_num][4] = 1000;
+        data_buf1[rec_num][5] = 6500;
+    }
+    /* Write the data to vdata APPENDABLE_VD the second time */
+    n_records = VSwrite(apvsid, (uint8 *)data_buf1, N_RECORDS, FULL_INTERLACE);
+    VERIFY_VOID(n_records, N_RECORDS, "VSwrite");
+
+    /* Detach this vdata and attach to it again, just to make sure meta-data
+       is recorded; it may not be necessary but it doesn't hurt */
+    status = VSdetach (apvsid);
+    CHECK_VOID(status, FAIL, "VSdetach");
+    apvsid = VSattach (fid, vs1_ref, "w");
+    CHECK_VOID(apvsid, FAIL, "VSattach");
+
+    /* Get the number of data blocks the vdata currently has */
+    n_blocks = VSgetdatainfo(apvsid, 0, 0, NULL, NULL);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+    VERIFY_VOID(n_blocks, 3, "VSgetdatainfo");
+
+    /* Allocate space to record the vdata's data info */
+    if (alloc_info(&vs_info, n_blocks) == -1)
+        exit(1);
+
+    /* Record various info to be used in verifying data later */
+    vs_info.n_values = 30;
+    vs_info.numtype = DFNT_INT32;
+
+    /* Get and verify offsets and lengths of data */
+    n_blocks = VSgetdatainfo(apvsid, 0, n_blocks, vs_info.offsets, vs_info.lengths);
+    CHECK_VOID(n_blocks, FAIL, "VSgetdatainfo");
+
+    {
+	int ii;
+	int32 check_offsets[] = {294, 556, 636};
+	int32 check_lengths[] = {120, 80, 40}; /* last chunk is not completely filled */
+	for (ii = 0; ii < n_blocks; ii++)
+	{
+	    VERIFY_VOID(vs_info.offsets[ii], check_offsets[ii], "VSgetdatainfo offset");
+	    VERIFY_VOID(vs_info.lengths[ii], check_lengths[ii], "VSgetdatainfo length");
+	}
+    }
+    /* Verifying data read without HDF4 library */
+    /* NOT YET */
+
+    /* Release memory */
+    free_info(&vs_info);
+
+    /* Close everything */
+    status = VSdetach (apvsid);
+    CHECK_VOID(status, FAIL, "Vdetach");
+    status = Vend(fid);
+    CHECK_VOID(status, FAIL, "Vend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+} /* test_append_vs */
+
+
+/*******************************************************************
+  Name: readnoHDF_char - utility routine to read and verify character
+			data without HDF4 library
+
+  Description:
+	readnoHDF_char opens the file and reads in data at the specified
+	offset.  The read data is compared against the original data passed
+	by caller.  If any mis-match occurs, an error message will be
+	displayed but the process will continue.
+
+  Parameters:
+	char *filename	IN: name of the file
+	int32 offset	IN: where to start read data
+	int32 length	IN: how long to read the data
+
+  Return value:
+	SUCCEED/FAIL
+  BMR - Jul 2010
+********************************************************************/
+intn readnoHDF_char(const char *filename, const int32 offset, const int32 length, const char *orig_buf)
+{
+    FILE  *fd;		/* file descriptor */
+    size_t readlen=0;	/* number of bytes actually read */
+    char *readcbuf;
+    intn ret_value = SUCCEED;
+
+    /* Open the file for reading without SD API */
+    fd = fopen(filename, "r");
+    if (fd == NULL)
+    {
+	fprintf(stderr, "readnoHDF_char: unable to open file %s", filename);
+        ret_value = FAIL;
+    }
+
+    /* Forward to the position of the first block of data */
+    if (fseek(fd, (off_t)offset, SEEK_SET) == -1)
+    {
+        fprintf(stderr, "readnoHDF_char: unable to seek offset %d\n",
+                (int)offset);
+        ret_value = FAIL;
+    }
+
+    /* Allocate buffers for SDS' data */
+    readcbuf = (char *) HDmalloc(length * sizeof(char));
+    if (readcbuf == NULL)
+    {
+	fprintf(stderr, "readnoHDF_char: allocation readcbuf failed\n");
+        ret_value = FAIL;
+    }
+
+    /* Read in this block of data */
+    readlen = fread((void*)readcbuf, 1, length, fd);
+    if (readlen > 0)
+    {
+        /* Compare data read without HDF4 lib against the original buffer */
+	if (HDstrncmp(readcbuf, orig_buf, readlen) != 0)
+	    fprintf(stderr, "Failure: non-HDF reading got different values than written values\n   >>> written = %s\n   >>> read = %s\n", orig_buf, readcbuf);
+    }
+    HDfree(readcbuf);
+    /* Close the file */
+    if (fclose(fd) == -1)
+    {
+	fprintf(stderr, "readnoHDF_char: unable to close file %s", filename);
+        ret_value = FAIL;
+    }
+    return ret_value;
+}
+
+/*******************************************************************
+  Name: get_annot_datainfo - utility routine to get datainfo of
+	an annotation
+
+  Description:
+	get_annot_datainfo gets access to each annotation, then attempts to 
+	get the offset/length of its data.  If successful, increment the
+	data info count and eventually returns that number to caller.  If
+	failure occurs, simply return FAIL and all the previous data info
+	will be discarded by the caller.
+
+  Parameters:
+	int32 an_id		IN: annotation ID
+	ann_type annot_type	IN: type of the annotations
+	int32 num_anns		IN: number of annotations of the specified type,
+				    currently only 1, but will be adjusted after
+				    the last parameter become arrays of strings
+	t_ann_info_t *ann_info	OUT: structure that holds ann data info
+	intn ann_info_num	IN: indicates where in ann_info to start
+				    storing info 
+	char* ann_text		IN: text of the annotation (this will be changed
+				    to array of strings when time permits)
+
+  Return value:
+	The number of annotations whose data info is successfully retrieved
+	and stored in ann_info or FAIL if failure occurs.
+********************************************************************/
+intn get_annot_datainfo(int32 an_id, ann_type annot_type, int32 num_anns, t_ann_info_t *ann_info, intn ann_info_num, char* ann_text)
+{
+    int32 ann_id, ann_index;
+    intn status_n, ret_value = 0;
+
+    /* Get the annotation. */
+    for (ann_index = 0; ann_index < num_anns; ann_index++)
+    {
+	/* Get the identifier of the current annotation. */
+	ann_id = ANselect (an_id, ann_index, annot_type);
+	CHECK(ann_id, FAIL, "ANselect");
+
+	/* Get annotation's data info. */
+	status_n = ANgetdatainfo(ann_id, &ann_info[ann_info_num].offset, &ann_info[ann_info_num].length);
+	CHECK(status_n, FAIL, "ANgetdatainfo");
+
+	/* Store annotation text for later checking against data read from
+	   the file without HDF4 library */
+	HDstrcpy(ann_info[ann_info_num].anntext, ann_text);
+
+	/* Terminate access to the current annotation. */
+	status_n = ANendaccess (ann_id);
+	CHECK(status_n, FAIL, "ANendaccess");
+
+	/* Number of annotations whose datainfo is retrieved */
+	ret_value++;
+    }
+    return(ret_value);
+} /* get_annot_datainfo */
+
+
+/****************************************************************************
+   Name: test_annotation() - tests getting data info of annotations
+
+   Description:
+	This routine tests getting data info of file label and description,
+	and data label and description.
+	- add a file label and a file description
+	- create a vgroup then add a data label and a data description to it
+	- use the utility routine get_annot_datainfo to record the offset,
+	  length, and annotation text
+	- use utility routine readnoHDF_char to read the annotation text
+	  without the use of the HDF4 library and verify the correctness of
+	  the read data
+
+	Todo 2: Should add more annotations so there will be multiple annots
+	for an object or file.  get_annot_datainfo needs to be fixed to
+	accommodate this.
+   BMR - Aug 2010
+   NOTE:
+	It is near the end of H4 Mapping project and Ruth had said there were
+	no annotation for Vgroup and Vdata, so the continuation of these tests
+	is not that critical anymore.  For SDS, SDgetanndatainfo handles
+	annotations already.  BMR - Jan 2011
+ ****************************************************************************/
+#define ANNOT_FILE	"tdatainfo_annot.hdf"   /* data file */
+#define	VG_NAME		"AN Vgroup"
+#define	FILE_LABEL_TXT	"General HDF objects"
+#define	FILE_DESC_TXT	"This is an HDF file that contains general HDF objects"
+#define	DATA_LABEL_TXT	"Common AN Vgroup"
+#define	DATA_DESC_TXT	"This is a vgroup that is used to test data annotations"
+static void
+test_annotation()
+{
+    int32 fid,		/* file ID */
+	  an_id, 	/* AN interface ID */
+	  file_label_id, 	/* file label ID */
+	  file_desc_id, 	/* file description ID */
+	  data_label_id, 	/* data label ID */
+	  data_desc_id, 	/* data description ID */
+	  vgroup_id;	/* vgroup ID */
+    uint16 vgroup_tag, vgroup_ref; /* vgroup tag/ref */
+    t_ann_info_t ann_info[4];	/* temporary storage of annotation info */
+    intn  status_n;	/* returned status for functions returning an intn  */
+    int32 status;	/* returned status for functions returning an int32 */
+
+    /* Create the HDF file. */
+    fid = Hopen (ANNOT_FILE, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the AN interface. */
+    an_id = ANstart(fid);
+    CHECK_VOID(an_id, FAIL, "ANstart");
+
+    /* Create and write a file label. */
+    file_label_id = ANcreatef(an_id, AN_FILE_LABEL);
+    CHECK_VOID(file_label_id, FAIL, "ANcreatef");
+    status = ANwriteann(file_label_id, FILE_LABEL_TXT, strlen (FILE_LABEL_TXT));
+    CHECK_VOID(status, FAIL, "ANwriteann");
+
+    /* Create and write a file description. */
+    file_desc_id = ANcreatef(an_id, AN_FILE_DESC);
+    CHECK_VOID(file_desc_id, FAIL, "ANcreatef");
+    status = ANwriteann(file_desc_id, FILE_DESC_TXT, strlen (FILE_DESC_TXT));
+    CHECK_VOID(status, FAIL, "ANwriteann");
+
+    /* Create a vgroup to add annotation to it. */
+    status_n = Vstart(fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+    vgroup_id = Vattach(fid, -1, "w");
+    CHECK_VOID(vgroup_id, FAIL, "Vattach");
+    status = Vsetname (vgroup_id, VG_NAME);
+    CHECK_VOID(status, FAIL, "Vsetname");
+
+    /* Get the tag and ref number of the vgroup for ANcreate. */
+    vgroup_tag = (uint16) VQuerytag (vgroup_id);
+    CHECK_VOID(vgroup_tag, 0, "VQuerytag");
+    vgroup_ref = (uint16) VQueryref (vgroup_id);
+    CHECK_VOID(vgroup_ref, 0, "VQueryref");
+
+    /* Add a data label to the vgroup. */
+    data_label_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_LABEL);
+    CHECK_VOID(data_label_id, FAIL, "ANcreate");
+    status = ANwriteann(data_label_id, DATA_LABEL_TXT, strlen(DATA_LABEL_TXT));
+    CHECK_VOID(status, FAIL, "ANwriteann");
+
+    /* Add a data description to the vgroup. */
+    data_desc_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_DESC);
+    CHECK_VOID(data_desc_id, FAIL, "ANcreate");
+    status = ANwriteann(data_desc_id, DATA_DESC_TXT, strlen(DATA_DESC_TXT));
+    CHECK_VOID(status, FAIL, "ANwriteann");
+
+    /* Terminate access to each annotation. */
+    status_n = ANendaccess(file_label_id);
+    CHECK_VOID(status_n, FAIL, "ANendaccess");
+    status_n = ANendaccess(file_desc_id);
+    CHECK_VOID(status_n, FAIL, "ANendaccess");
+    status_n = ANendaccess(data_label_id);
+    CHECK_VOID(status_n, FAIL, "ANendaccess");
+    status_n = ANendaccess(data_desc_id);
+    CHECK_VOID(status_n, FAIL, "ANendaccess");
+
+    /* Teminate access to the vgroup and to the V interface. */
+    status = Vdetach(vgroup_id);
+    status_n = Vend(fid);
+
+    /* Terminate access to the AN interface and close the HDF file. */
+    status = ANend(an_id);
+    CHECK_VOID(status, FAIL, "ANend");
+    status_n = Hclose (fid);
+    CHECK_VOID(status_n, FAIL, "Hclose");
+
+    /* Open the file and read in location/size of all annotations */
+
+    {
+	int32 ann_index,	/* annotation index */
+	      n_file_labels,	/* numbers of file labels */
+	      n_file_descs,	/* numbers of file descs */
+	      n_data_labels,	/* numbers of data labels */
+	      n_data_descs;	/* numbers of data descs */
+	intn  num_anns = 0, ann_info_num = 0;
+
+	/* Open the file. */
+	fid = Hopen (ANNOT_FILE, DFACC_RDONLY, 0);
+	CHECK_VOID(fid, FAIL, "Hopen");
+
+	/* Initialize the AN interface. */
+	an_id = ANstart(fid);
+	CHECK_VOID(an_id, FAIL, "ANstart");
+
+	/* Get the number of data/file labels/descriptions */
+	status_n = ANfileinfo (an_id, &n_file_labels, &n_file_descs,
+                        &n_data_labels, &n_data_descs);
+	CHECK_VOID(status_n, FAIL, "ANfileinfo");
+	VERIFY_VOID(n_file_labels, 1, "ANfileinfo");
+	VERIFY_VOID(n_file_descs, 1, "ANfileinfo");
+	VERIFY_VOID(n_data_labels, 1, "ANfileinfo");
+	VERIFY_VOID(n_data_descs, 1, "ANfileinfo");
+
+	/* Get access to each annotation then call ANgetdatainfo to retrieve
+	   the offset/length of the annotation data */
+
+	/* Explanation of some parameters to get_annot_datainfo:
+	   3rd parameter - number of annotations of the specified type,
+	   currently only 1, but will adjust the last parameter to have arrays
+	   of character strings when have time.
+	   4th parameter - ann_info_num indicates where in ann_info to start
+	   storing info */
+
+	/* AN_DATA_LABEL */
+	num_anns = get_annot_datainfo(an_id, AN_DATA_LABEL, 1, ann_info, ann_info_num, DATA_LABEL_TXT);
+	CHECK_VOID(num_anns, FAIL, "get_annot_datainfo");
+	VERIFY_VOID(num_anns, 1, "get_annot_datainfo");
+	ann_info_num = ann_info_num + num_anns;
+
+	/* AN_DATA_DESC */
+	num_anns = get_annot_datainfo(an_id, AN_DATA_DESC, 1, ann_info, ann_info_num, DATA_DESC_TXT);
+	CHECK_VOID(num_anns, FAIL, "get_annot_datainfo");
+	VERIFY_VOID(num_anns, 1, "get_annot_datainfo");
+	ann_info_num = ann_info_num + num_anns;
+
+	/* AN_FILE_LABEL */
+	num_anns = get_annot_datainfo(an_id, AN_FILE_LABEL, 1, ann_info, ann_info_num, FILE_LABEL_TXT);
+	CHECK_VOID(num_anns, FAIL, "get_annot_datainfo");
+	VERIFY_VOID(num_anns, 1, "get_annot_datainfo");
+	ann_info_num = ann_info_num + num_anns;
+
+	/* AN_FILE_DESC */
+	num_anns = get_annot_datainfo(an_id, AN_FILE_DESC, 1, ann_info, ann_info_num, FILE_DESC_TXT);
+	CHECK_VOID(num_anns, FAIL, "get_annot_datainfo");
+	VERIFY_VOID(num_anns, 1, "get_annot_datainfo");
+	ann_info_num = ann_info_num + num_anns;
+
+	/* Terminate access to the AN interface and close the HDF file. */
+	status = ANend(an_id);
+	CHECK_VOID(status, FAIL, "ANend");
+	status_n = Hclose (fid);
+	CHECK_VOID(status_n, FAIL, "Hclose");
+
+	/* calling readnoHDF_char to verify data without the use of HDF lib */
+
+	for (ann_index = 0; ann_index < ann_info_num; ann_index++)
+	{
+	    /* Open the file with fopen, read data at the offset obtained and 
+	       verify the values */
+	    status_n = readnoHDF_char(ANNOT_FILE, ann_info[ann_index].offset,
+		    ann_info[ann_index].length, ann_info[ann_index].anntext);
+	    if (status_n == FAIL)
+		fprintf(stderr, "Attempt reading data without HDF4 library failed at line %d\n", __LINE__);
+	}
+    }
+} /* test_annotation */
+
+/****************************************************************************
+   Name: test_oneblock_ri() - tests non-linked-block images
+
+   Description:
+	This routine creates and writes data to images and verifies
+        some data and data information with GRgetdatainfo.  The tests include
+        the following images:
+	- a simple, non-compressed image
+	- three images with RLE, Skipping-Huffman, and Deflate compression
+	Only the non-compressed image's values are verified against the original
+	buffer.  The other three were verified by debugging, additional
+	decompression code needed for further verification (Todo 2)
+
+   Note: Incomplete, waiting for schema design
+   BMR - Aug 2010
+ ****************************************************************************/
+#define IMAGE_FILE	"tdatainfo_images.hdf"   /* data file */
+#define	NONCOMP_IMAGE	"Image with No Compression"
+#define	RLE_IMAGE	"Image with RLE Compression"
+#define	DEFLATE_IMAGE	"Image with Deflate Compression"
+#define	SKPHUFF_IMAGE	"Image with Skphuff Compression"
+#define	JPEG_IMAGE	"Image with JPEG Compression"
+#define	SKPHUFF_SKIPSIZE	28
+#define	DEFLATE_LEVEL	7
+#define WIDTH		5
+#define LENGTH		5
+#define N_IMAGES	4
+
+/* Convenient function to create and write to an image, used by
+   test_oneblock_ri */
+static intn make_comp_image( 
+	int32 grid,
+	char* img_name,
+	char start_char,  /* first value in the image, for variety of data */
+	int32 comp_type,  /* compression method */
+	comp_info* cinfo) /* compression parameters */
+{
+    int32 riid;         /* raster image ID */
+    int32 dims[2]={WIDTH,LENGTH};	/* dimensions for the image */
+    char image0[WIDTH][LENGTH];		/* image data */
+    int32 start[2];	/* start of image data to grab */
+    int32 stride[2];	/* stride of image data to grab */
+    intn ii, jj;	/* indices */
+    intn status;        /* generic return value */
+    intn ret_value=SUCCEED;
+
+    /* Initialize data we are going to write out, each image created by this
+       convenient function will use the same data pattern with the first value
+       given by the caller  */
+    for (ii = 0; ii < WIDTH; ii++)
+        for (jj = 0; jj < LENGTH; jj++)
+            image0[ii][jj] = start_char + jj;
+
+    /* Create the image with 1 component, type char, pixel interlace, and
+       dimension WIDTHxLENGTH */
+    riid = GRcreate(grid, img_name, 1, DFNT_CHAR, MFGR_INTERLACE_PIXEL, dims);
+    CHECK(riid, FAIL, "GRcreate");
+
+    /* Set compression as instructed */
+    if (comp_type != COMP_CODE_NONE)
+    {
+	status = GRsetcompress(riid, comp_type, cinfo);
+	CHECK(status, FAIL, "GRsetcompress");
+    }
+
+    /* Write the entire image data out */
+    start[0] = start[1] = 0;
+    stride[0] = stride[1] = 1;
+    status = GRwriteimage(riid, start, stride, dims, image0);
+    CHECK(status, FAIL, "GRreadimage");
+
+    /* Close the first image */
+    status = GRendaccess(riid);
+    CHECK(status, FAIL, "GRendaccess");
+
+    return ret_value;
+}
+
+static void
+test_oneblock_ri()
+{
+    int32 fid, grid,	/* file ID and GR interface ID */
+	  riid;		/* raster image ID */
+    int32 offset, length; /* offset/length buffers for single block of data */
+    intn  status;	/* status returned from routines */
+    intn ii;		/* indices */
+    int32 n_images, n_fattrs;
+    comp_info cinfo;    /* Compression parameters - union */
+    /* offsets/lengths to be used to verify offsets/lengths returned by
+       GRgetdatainfo - confirmed by the command "od" on the hdf file */
+    static int32 image_data_offsets[N_IMAGES] = {309, 363, 426, 486};
+    static int32 image_data_lengths[N_IMAGES] = {25, 26, 29, 16};
+
+    /****************************************************************
+      Create a file in GR interface then create and write several
+      images with and without compression.
+    ****************************************************************/
+
+    /* Create the HDF file and initialize the interface. */
+    fid = Hopen(IMAGE_FILE, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    grid = GRstart(fid);
+    CHECK_VOID(grid, FAIL, "GRstart");
+
+    /* Create and write the non-compressed image to this file */
+    status = make_comp_image(grid, NONCOMP_IMAGE, 'n', COMP_CODE_NONE, &cinfo);
+
+    /* Create and write 3 more images: RLE, Deflate, and Skipping Huffman */
+
+    /* No compression info for the RLE image */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+
+    /* Create and write the RLE compressed image to this file, starting the
+       data values with the letter 'r' */
+    status = make_comp_image(grid, RLE_IMAGE, 'r', COMP_CODE_RLE, &cinfo);
+
+    /* Set the compression info for the image with Skipping Huffman method */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    cinfo.skphuff.skp_size = SKPHUFF_SKIPSIZE;
+
+    /* Create and write the Skipping Huffman compressed image to this file,
+       starting the data values with the letter 's' */
+    status = make_comp_image(grid, SKPHUFF_IMAGE, 's', COMP_CODE_SKPHUFF, &cinfo);
+
+    /* Set the compression info for the image with Deflate method */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    cinfo.deflate.level = DEFLATE_LEVEL;
+
+    /* Create and write the Deflate compressed image to this file, starting the
+       data values with the letter 'd' */
+    status = make_comp_image(grid, DEFLATE_IMAGE, 'd', COMP_CODE_DEFLATE, &cinfo);
+
+    /* Set the compression method for the image with JPEG method */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    cinfo.jpeg.quality = 100;
+    cinfo.jpeg.force_baseline = 1;
+
+    /* Create and write the JPEG compressed image to this file, starting the
+       data values with the letter 'j' - more work to be done for JPEG */
+     /* status = make_comp_image(grid, JPEG_IMAGE, 'j', COMP_CODE_JPEG, &cinfo);
+ */ 
+
+    /* Terminate access to the GR interface and close the file */
+    status = GRend(grid);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /****************************************************************
+      Re-open the file to read the images and their data information
+    ****************************************************************/
+
+   /* Re-open the file and initialize the GR interface */
+    fid = Hopen (IMAGE_FILE, DFACC_RDONLY, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    grid = GRstart (fid);
+    CHECK_VOID(grid, FAIL, "GRstart");
+
+    /* Get the number of images in the file */
+    status = GRfileinfo(grid, &n_images, &n_fattrs);
+    CHECK_VOID(status, FAIL, "GRfileinfo");
+    VERIFY_VOID(n_images, N_IMAGES, "GRfileinfo");
+
+    /* Open each image then get and verify its data information.  Note that
+	currently, the offsets and lengths are obtained from debugging
+	and the command od on the file */
+    for (ii = 0; ii < n_images; ii++)
+    {
+	riid = GRselect(grid, ii);
+	CHECK_VOID(riid, FAIL, "GRselect");
+
+	status = GRgetdatainfo(riid, 0, 1, &offset, &length);
+	CHECK_VOID(status, FAIL, "GRgetdatainfo");
+	VERIFY_VOID(offset, image_data_offsets[ii], "GRgetdatainfo");
+	VERIFY_VOID(length, image_data_lengths[ii], "GRgetdatainfo");
+
+	/* Only verify data of the first image, which has non-compressed data. */
+	if (ii == 0)
+	{
+	    intn jj, kk;
+	    char buffer[WIDTH][LENGTH], check_image[WIDTH*LENGTH];
+	    for (kk = 0; kk < WIDTH; kk++)
+		for (jj = 0; jj < LENGTH; jj++)
+		    buffer[kk][jj] = 'n' + jj;
+
+	    /* Work around to pass check_image into readnoHDF_char w/o warning*/
+	    HDmemcpy(check_image, buffer, WIDTH*LENGTH);
+
+	    /* Open the file with fopen, read data at the offset obtained and verify
+	       the values */
+	    status = readnoHDF_char(IMAGE_FILE, offset, length, check_image);
+	    if (status == FAIL)
+		fprintf(stderr, "Attempt reading data without HDF4 library failed at line %d\n", __LINE__);
+	}
+
+	/* Close the image */
+	status = GRendaccess(riid);
+	CHECK_VOID(status, FAIL, "GRendaccess");
+    } /* for n_images */
+
+    /* Terminate access to the GR interface and close the file */
+    status = GRend(grid);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+} /* end test_oneblock_ri */
+
+#define IMAGE_DF_FILE	"tdatainfo_dfri.hdf"	/* data file for DFR APIs */
+#define N_DF_IMAGES	2	/* number of DF images in the file, 1 RI8 &
+				   1 RI24 */
+static void
+test_dfr8_24()
+{
+    int32 fid, grid,	/* file ID and GR interface ID */
+	  riid;		/* raster image ID */
+    int32 offset, length; /* offset/length buffers for single block of data */
+    intn  status;	/* status returned from routines */
+    intn ii, jj;	/* indices */
+    int32 n_images, n_fattrs;
+    char  buf[WIDTH][LENGTH][3];
+
+    /* offsets/lengths to be used to verify offsets/lengths returned by
+       GRgetdatainfo - confirmed by the command "od" on the hdf file */
+    static int32 image_data_offsets[N_IMAGES] = {294, 1132};
+    static int32 image_data_lengths[N_IMAGES] = {30, 75};
+
+    /* Initialize the 8-bit image array */
+    static uint8 raster_data[WIDTH][LENGTH] =
+	{{1, 2, 3, 4, 5},
+	 {5, 4, 3, 2, 1},
+	 {1, 2, 3, 4, 5},
+	 {5, 4, 3, 2, 1},
+	 {6, 4, 2, 0, 2}};
+
+   /* Write the 8-bit raster image to file */
+   status = DFR8putimage(IMAGE_DF_FILE, raster_data, WIDTH, LENGTH, COMP_RLE);
+
+    /* Initialize the 24-bit image array */
+    for (ii = 0; ii < WIDTH; ii++)
+	for (jj = 0; jj < LENGTH; jj++)
+	{
+	    buf[ii][jj][0] = buf[ii][jj][1] = buf[ii][jj][2] = (char)(ii + jj);
+	}
+
+    /* Set interlace for the 24-bit RI */
+    status = DF24setil(DFIL_PIXEL);
+
+    /* Make sure that no compression is being used - the variable Grcompr is
+       global in dfgr.c so its value is inherited from other tests in the lib
+       and causes this image to be compressed with JPEG unintentionally.  We
+       want to be able to see the data to verify it with "od" */
+    status = DF24setcompress(COMP_NONE, NULL);
+
+    /* Write the 24-bit raster image to file */
+    status = DF24addimage(IMAGE_DF_FILE, &(buf[0][0][0]), WIDTH, LENGTH);
+
+
+    /****************************************************************
+      Re-open the file to read the images and their data information
+     ****************************************************************/
+    /* Re-open the file and initialize the GR interface */
+    fid = Hopen (IMAGE_DF_FILE, DFACC_RDONLY, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    grid = GRstart (fid);
+    CHECK_VOID(grid, FAIL, "GRstart");
+
+    /* Get the number of images in the file */
+    status = GRfileinfo(grid, &n_images, &n_fattrs);
+    CHECK_VOID(status, FAIL, "GRfileinfo");
+    VERIFY_VOID(n_images, N_DF_IMAGES, "GRfileinfo");
+
+    /* Open each image then get and verify its data information.  Note that
+	currently, the offsets and lengths are obtained from debugging
+	and the command od on the file */
+    for (ii = 0; ii < n_images; ii++)
+    {
+	uintn info_count = 0;
+
+	riid = GRselect(grid, ii);
+	CHECK_VOID(riid, FAIL, "GRselect");
+
+	/* Get the number of data blocks and verify; should be 1 */
+	info_count = GRgetdatainfo(riid, 0, 0, NULL, NULL);
+	CHECK_VOID(info_count, FAIL, "GRgetdatainfo");
+	VERIFY_VOID(info_count, 1, "GRgetdatainfo");
+
+	/* Get offset/length of the image and verify with pre-determined
+	   values */
+	info_count = GRgetdatainfo(riid, 0, info_count, &offset, &length);
+	CHECK_VOID(info_count, FAIL, "GRgetdatainfo");
+	VERIFY_VOID(offset, image_data_offsets[ii], "GRgetdatainfo");
+	VERIFY_VOID(length, image_data_lengths[ii], "GRgetdatainfo");
+
+	/* Close the image */
+	status = GRendaccess(riid);
+	CHECK_VOID(status, FAIL, "GRendaccess");
+    } /* for n_images */
+
+    /* Terminate access to the GR interface and close the file */
+    status = GRend(grid);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+}  /* test_dfr8_24 */
+
+#if 0
+/* clang does not like CHECK_VOID which does not return any value. */
+/* So, coding is wrong but this function is not used at all.*/
+/* So, screen it out for now. -AKC 2013/01/18 */
+ /* intn check_dds(char *fname, char *msg)
+ */ 
+intn check_dds(int32 grid, char *msg)
+{
+    intn n_pals = 0;
+    hdf_ddinfo_t *palinfo_array = NULL;
+    uint8 *inbuf;
+    intn  status;       /* status returned from routines */
+    intn ii, jj;        /* indices */
+
+    n_pals = 0;
+    n_pals = GRgetpalinfo(grid, 0, NULL);
+    CHECK_VOID(n_pals, FAIL, "GRgetpalinfo");
+
+    palinfo_array = (hdf_ddinfo_t *) HDmalloc(n_pals * sizeof(hdf_ddinfo_t));
+    CHECK_ALLOC(palinfo_array, "palinfo_array", "test_getpalinfo");
+
+    n_pals = GRgetpalinfo(grid, n_pals, palinfo_array);
+    CHECK_VOID(n_pals, FAIL, "GRgetpalinfo");
+
+    fprintf(stderr, "GRgetpalinfo return pal count = %d\n", n_pals);
+    fprintf(stderr, "tag    ref    offset  length \n");
+    for (ii = 0; ii < n_pals; ii++)
+       fprintf(stderr, "%d    %d      %d       %d\n", palinfo_array[ii].tag,
+    palinfo_array[ii].ref, palinfo_array[ii].offset, palinfo_array[ii].length);
+
+    return 0;
+}
+#endif
+
+
+/*************************************************************************
+ test_getpalinfo() - tests GRgetpalinfo
+ Need documentation
+**************************************************************************/
+#define  IMAGE_DFPAL_FILE  "tdatainfo_pal.hdf"
+#define  IMAGE_WITH_PAL    "GR Image with Palette"
+#define  IMAGE2_WITH_PAL   "Second GR Image w/pal"
+#define  ANO_IMAGE_NAME    "ANO_IMAGE_NAME"
+#define  LASTIMAGE_NOPAL   "Last GR Image: no pal"
+#define  N_COMPS_IMG       2       /* number of image components */
+#define  N_ENTRIES         256     /* number of entries in the palette */
+#define  N_COMPS_PAL       3       /* number of palette's components */
+
+static void
+test_getpalinfo()
+{
+    int32 fid, grid,	/* file ID and GR interface ID */
+	      riid, palid,  /* raster image ID and palette ID */
+          interlace_mode, 
+          start[2],     /* where to start to write for each dimension  */
+          edges[2],     /* specifies how long to write for each dimension */
+          dim_sizes[2];  /* sizes of the two dimensions of the image array */
+    uint8 image_buf[WIDTH][LENGTH][N_COMPS_IMG]; /* data of raster image */
+    uint8 palette_buf1[N_ENTRIES][N_COMPS_PAL];  /* for LUT mostly */
+    uint8 palette_buf2[N_ENTRIES][N_COMPS_PAL];
+    uint8 paletteA[N_ENTRIES*N_COMPS_PAL],  /* for IP8 mostly */
+	      paletteB[N_ENTRIES*N_COMPS_PAL],
+	      paletteD[N_ENTRIES*N_COMPS_PAL];
+    intn  n_pals = 0; /* number of palettes, returned by DFPnpals and GRgetpalinfo */
+    hdf_ddinfo_t *palinfo_array = NULL; /* list of palette DDs */
+    uint8 *inbuf;	/* palette data read back in */
+    intn  ii, jj;	/* indices */
+    intn  status;	/* status returned from routines */
+
+    /* Initialize the 8-bit image array */
+    static uint8 raster_data[WIDTH][LENGTH] =
+	{ 1, 2, 3, 4, 5,
+	  5, 4, 3, 2, 1,
+	  1, 2, 3, 4, 5,
+	  5, 4, 3, 2, 1,
+	  6, 4, 2, 0, 2 };
+     
+    /* Palettes are added in the following means and order:
+	paletteA (DFPputpal)
+	paletteB (DFPputpal)
+	paletteA (DFR8setpalette/DFR8addimage)
+	palette_buf1 (GRwritelut) for image named IMAGE_WITH_PAL
+	palette_buf2 (GRwritelut) for image named IMAGE2_WITH_PAL
+	paletteB (DFR8setpalette/DFR8addimage)
+	paletteD (DFPputpal)
+	paletteB (DFPputpal)
+	paletteD (DFPputpal)
+	palette_buf2 (GRwritelut) for image named IMAGE2_WITH_PAL
+	paletteD (DFPputpal)
+    */
+    /* Add two palettes with DFP API. */ 
+    status = DFPputpal(IMAGE_DFPAL_FILE, paletteA, 0, "w"); 
+    CHECK_VOID(status, FAIL, "DFPputpal");
+
+    status = DFPputpal(IMAGE_DFPAL_FILE, paletteB, 0, "a"); 
+    CHECK_VOID(status, FAIL, "DFPputpal");
+
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 2, "DFPputpal");  /* 2 palettes from 2 DFPputpal's */
+
+    /* Specify palette to be used with subsequent 8-bit images */
+    status = DFR8setpalette(paletteA);
+    CHECK_VOID(status, FAIL, "DFR8setpalette");
+
+    /* Write an 8-bit raster image to the file */
+    status = DFR8addimage(IMAGE_DFPAL_FILE, raster_data, WIDTH, LENGTH, COMP_RLE);
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Get the number of palettes using DFP API */
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 3, "DFPputpal");
+    /* 3 palettes: 2 DFPputpal's + DFR8setpalette/DFR8addimage combo */
+
+    /* Write another 8-bit raster image to file, without calling another
+       DFR8setpalette, that means this image is using the same palette as the
+       previous image.  This is when only 201 is created */
+    status = DFR8addimage(IMAGE_DFPAL_FILE, raster_data, WIDTH, LENGTH, COMP_RLE);
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Thus, the number of palettes returned by DFPnpals should be the same as
+       from the last call to DFPnpals */
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 3, "DFPputpal");
+
+    /****************************************************************
+	Re-open the file in GR interface, add a few images with
+	palettes, then test GRgetpalinfo on the palettes
+     ****************************************************************/
+
+    /* Re-open the file and initialize the GR interface */
+    fid = Hopen (IMAGE_DFPAL_FILE, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    grid = GRstart (fid);
+    CHECK_VOID(grid, FAIL, "GRstart");
+
+    /* Define the dimensions and interlace mode of the image */
+    dim_sizes[0] = LENGTH;
+    dim_sizes[1] = WIDTH;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+
+    /* Create an image named IMAGE_WITH_PAL */
+    riid = GRcreate (grid, IMAGE_WITH_PAL, N_COMPS_IMG, DFNT_UINT8, 
+                     interlace_mode, dim_sizes);
+
+    /* Fill the image data buffer with values */
+    for (ii = 0; ii < WIDTH; ii++)
+    {
+       for (jj = 0; jj < LENGTH; jj++)
+       {
+          image_buf[ii][jj][0] = (ii + jj) + 1;
+          image_buf[ii][jj][1] = (ii + jj) + 2;
+       }
+     }
+
+    /* Define the size of the data to be written */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+
+    /* Write the data in the buffer into the image array */
+    status = GRwriteimage (riid, start, NULL, edges, (VOIDP)image_buf);
+
+    /* Initialize the palette data */
+    for (ii = 0; ii < N_ENTRIES; ii++) {
+        palette_buf1[ii][0] = ii;
+        palette_buf1[ii][1] = 0;
+        palette_buf1[ii][2] = 8;
+    }
+
+    /* Get the identifier of the palette attached to the image IMAGE_WITH_PAL */
+    palid = GRgetlutid (riid, 0);
+
+    /* Write data to the palette. */
+    status = GRwritelut (palid, N_COMPS_PAL, DFNT_UINT8, interlace_mode,
+                         N_ENTRIES, (VOIDP)palette_buf1);
+
+    /* DFPnpals now sees another palette */
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 4, "DFPputpal");
+
+    /* Terminate access to the first image */
+    status = GRendaccess (riid);
+
+    /* Create another image named IMAGE2_WITH_PAL */
+    riid = GRcreate (grid, IMAGE2_WITH_PAL, N_COMPS_IMG, DFNT_UINT8, 
+                     interlace_mode, dim_sizes);
+
+    /* Write the data in the buffer into the image array */
+    status = GRwriteimage (riid, start, NULL, edges, (VOIDP)image_buf);
+
+    /* Get the id of the palette attached to the image IMAGE2_WITH_PAL */
+    palid = GRgetlutid (riid, 0);
+
+    /* Initialize the palette for second image */
+    for (ii = 0; ii < N_ENTRIES; ii++) {
+	palette_buf2[ii][0] = 2;
+	palette_buf2[ii][1] = 4;
+	palette_buf2[ii][2] = 8;
+    }
+
+    /* Write data to the palette */
+    status = GRwritelut (palid, N_COMPS_PAL, DFNT_UINT8, interlace_mode,
+                         N_ENTRIES, (VOIDP)palette_buf2);
+
+    /* DFPnpals now sees another palette */
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 5, "DFPputpal");
+
+    /* Terminate access to this image */
+    status = GRendaccess (riid);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Create another image named LASTIMAGE_NOPAL */
+    riid = GRcreate (grid, LASTIMAGE_NOPAL, N_COMPS_IMG, DFNT_UINT8, 
+                     interlace_mode, dim_sizes);
+    CHECK_VOID(riid, FAIL, "GRcreate");
+
+    /* Write the data in the buffer into the image array */
+    status = GRwriteimage (riid, start, NULL, edges, (VOIDP)image_buf);
+    CHECK_VOID(status, FAIL, "GRwriteimage");
+
+    /* Terminate access to the image */
+    status = GRendaccess (riid);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    status = DFR8setpalette(paletteB);
+    CHECK_VOID(status, FAIL, "DFR8setpalette");
+
+    /* Write another 8-bit raster image to file */
+    status = DFR8addimage(IMAGE_DFPAL_FILE, raster_data, WIDTH, LENGTH, COMP_RLE);
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* DFR8setpalette/DFR8addimage just added another palette, so DFPnpals now
+       returns 6 */
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 6, "DFPputpal");
+
+    status = DFPputpal(IMAGE_DFPAL_FILE, paletteD, 0, "a"); 
+    CHECK_VOID(status, FAIL, "DFPputpal");
+
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 7, "DFPnpals");
+
+    status = DFPputpal(IMAGE_DFPAL_FILE, paletteB, 0, "a"); 
+    CHECK_VOID(status, FAIL, "DFPputpal");
+
+    status = DFPputpal(IMAGE_DFPAL_FILE, paletteD, 0, "a"); 
+    CHECK_VOID(status, FAIL, "DFPputpal");
+
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 9, "DFPputpal");
+
+    /* Create another image named ANO_IMAGE_NAME. */
+    riid = GRcreate (grid, ANO_IMAGE_NAME, N_COMPS_IMG, DFNT_UINT8, 
+                      interlace_mode, dim_sizes);
+    CHECK_VOID(riid, FAIL, "GRcreate");
+
+    /* Write the data in the buffer into the image array. */
+    status = GRwriteimage (riid, start, NULL, edges, (VOIDP)image_buf);
+    CHECK_VOID(status, FAIL, "GRwriteimage");
+
+    /* Get the identifier of the palette attached to the image ANO_IMAGE_NAME */
+    palid = GRgetlutid (riid, 0);
+    CHECK_VOID(palid, FAIL, "GRgetlutid");
+
+    /* Write data to the palette. */
+    status = GRwritelut (palid, N_COMPS_PAL, DFNT_UINT8, interlace_mode,
+                         N_ENTRIES, (VOIDP)palette_buf2);
+
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 10, "DFPputpal");
+
+   status = GRendaccess (riid);
+
+    status = DFPputpal(IMAGE_DFPAL_FILE, paletteD, 0, "a"); 
+    CHECK_VOID(status, FAIL, "DFPputpal");
+
+    n_pals = DFPnpals(IMAGE_DFPAL_FILE);
+    CHECK_VOID(n_pals, FAIL, "DFPnpals");
+    VERIFY_VOID(n_pals, 11, "DFPputpal");
+
+    /* Assuming that this file has been written exactly in this manner, this
+       is what the palette DDs would look like at this point:
+	tag    ref    offset  length
+	201    1      294       768
+	301    1      294       768
+	201    2      1062      768
+	301    2      1062      768
+	301    3      1860      768
+	201    3      1860      768
+	201    4      1860      768
+	301    4      2973      768 <- cannot be read by DFPgetpal
+	301    5      3806      768 <- cannot be read by DFPgetpal
+	301    8      4669      768
+	201    8      4669      768
+	201    5      5449      768
+	201    6      6217      768
+	301    6      6217      768
+	201    7      7183      768
+	301    7      7183      768
+	301    9      8016      768 <- cannot be read by DFPgetpal
+	201    9      8784      768
+ */
+
+    /* Read some palettes */
+    {
+
+    /* Call GRgetpalinfo the first time, passing in NULL for the palette array, 
+       to get the number of palettes in the file */
+    n_pals = 0;
+    n_pals = GRgetpalinfo(grid, 0, NULL);
+    CHECK_VOID(n_pals, FAIL, "GRgetpalinfo");
+
+    palinfo_array = (hdf_ddinfo_t *) HDmalloc(n_pals * sizeof(hdf_ddinfo_t));
+    CHECK_ALLOC(palinfo_array, "palinfo_array", "test_getpalinfo");
+
+    n_pals = GRgetpalinfo(grid, n_pals, palinfo_array);
+    CHECK_VOID(n_pals, FAIL, "GRgetpalinfo");
+
+    /* Read and verify data of the first palette which is pointed to by both
+       data identifiers 201/ref and 301/ref */
+     /* inbuf = (uint8 *) HDmalloc(palinfo_array[0].length * sizeof(uint8));
+ */ 
+    inbuf = (uint8 *) HDmalloc(palinfo_array[0].length);
+    CHECK_ALLOC(inbuf, "inbuf", "test_getpalinfo");
+    status = Hgetelement(fid, palinfo_array[0].tag, palinfo_array[0].ref, inbuf);
+    CHECK_VOID(status, FAIL, "Hgetelement");
+
+    if (HDmemcmp(inbuf, paletteA, palinfo_array[0].length)!=0)
+	fprintf(stderr, "palette data pointed by tag/ref = %d/%d at offset/length = %d/%d differs from written\n", palinfo_array[0].tag, palinfo_array[0].ref, palinfo_array[0].offset, palinfo_array[0].length);
+
+    /* Read and verify data of the palette pointed to by 301/4.  This is the
+       data element that was not revealed by DFPgetpal because the tag/ref pair
+       201/4 is associated with a different offset */
+
+     /* inbuf = (uint8 *) HDmalloc(palinfo_array[7].length * sizeof(uint8));
+ */ 
+    inbuf = (uint8 *) HDmalloc(palinfo_array[7].length);
+    CHECK_ALLOC(inbuf, "inbuf", "test_getpalinfo");
+    status = Hgetelement(fid, palinfo_array[7].tag, palinfo_array[7].ref, inbuf);
+    CHECK_VOID(status, FAIL, "Hgetelement");
+
+    if (HDmemcmp(inbuf, palette_buf1, palinfo_array[7].length)!=0)
+	fprintf(stderr, "palette data pointed by tag/ref = %d/%d at offset/length = %d/%d differs from written\n", palinfo_array[7].tag, palinfo_array[7].ref, palinfo_array[7].offset, palinfo_array[7].length);
+    }
+
+    /* Terminate access to the GR interface and close the file */
+    status = GRend(grid);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+}  /* test_getpalinfo */
+
+
+/****************************************************************************
+   Name: test_getntinfo() - tests getting number type's information
+
+   Description:
+	This routine simply calls Hgetntinfo with various types and verifies
+	the information retrieved.
+   BMR - Aug 2010
+ ****************************************************************************/
+static void
+test_getntinfo()
+{
+    hdf_ntinfo_t nt_info;
+    intn status = SUCCEED;
+
+    status = Hgetntinfo(DFNT_UINT8, &nt_info);
+    CHECK_VOID(status, FAIL, "Hgetntinfo DFNT_UINT8");
+    VERIFY_CHAR_VOID(nt_info.type_name, "uint8", "Hgetntinfo DFNT_UINT8");
+    VERIFY_CHAR_VOID(nt_info.byte_order, "bigEndian", "Hgetntinfo DFNT_UINT8");
+    
+    status = Hgetntinfo(DFNT_CHAR16, &nt_info);
+    CHECK_VOID(status, FAIL, "Hgetntinfo DFNT_CHAR16");
+    VERIFY_CHAR_VOID(nt_info.type_name, "char16", "Hgetntinfo DFNT_CHAR16");
+    VERIFY_CHAR_VOID(nt_info.byte_order, "bigEndian", "Hgetntinfo DFNT_CHAR16");
+    
+    /* Native */
+    status = Hgetntinfo(DFNT_NFLOAT32, &nt_info);
+    CHECK_VOID(status, FAIL, "Hgetntinfo DFNT_NFLOAT32");
+    VERIFY_CHAR_VOID(nt_info.type_name, "float32", "Hgetntinfo DFNT_NFLOAT32");
+    VERIFY_CHAR_VOID(nt_info.byte_order, "bigEndian", "Hgetntinfo DFNT_NFLOAT32");
+    
+    /* Little endian */
+    status = Hgetntinfo(DFNT_LFLOAT32, &nt_info);
+    CHECK_VOID(status, FAIL, "Hgetntinfo DFNT_LFLOAT32");
+    VERIFY_CHAR_VOID(nt_info.type_name, "float32", "Hgetntinfo DFNT_LFLOAT32");
+    VERIFY_CHAR_VOID(nt_info.byte_order, "littleEndian", "Hgetntinfo DFNT_LFLOAT32");
+    
+    /* Little endian backward compatible */
+    status = Hgetntinfo(DFNT_LCHAR, &nt_info);
+    CHECK_VOID(status, FAIL, "Hgetntinfo DFNT_LCHAR");
+    VERIFY_CHAR_VOID(nt_info.type_name, "char8", "Hgetntinfo DFNT_LCHAR");
+    VERIFY_CHAR_VOID(nt_info.byte_order, "littleEndian", "Hgetntinfo DFNT_LCHAR");
+    
+    /* Backward compatible */
+    status = Hgetntinfo(DFNT_DOUBLE, &nt_info);
+    CHECK_VOID(status, FAIL, "Hgetntinfo DFNT_DOUBLE");
+    VERIFY_CHAR_VOID(nt_info.type_name, "float64", "Hgetntinfo DFNT_DOUBLE");
+    VERIFY_CHAR_VOID(nt_info.byte_order, "bigEndian", "Hgetntinfo DFNT_DOUBLE");
+    
+    /* Native backward compatible */
+    status = Hgetntinfo(DFNT_NUCHAR, &nt_info);
+    CHECK_VOID(status, FAIL, "Hgetntinfo DFNT_NUCHAR");
+    VERIFY_CHAR_VOID(nt_info.type_name, "uchar8", "Hgetntinfo DFNT_NUCHAR");
+    VERIFY_CHAR_VOID(nt_info.byte_order, "bigEndian", "Hgetntinfo DFNT_NUCHAR");
+} /* test_getntinfo */
+
+/* Test driver for testing the public functions VSgetdatainfo, ANgetdatainfo,
+   GRgetdatainfo, and Hgetntinfo. */
+void
+test_datainfo()
+{
+    /* Test VSgetdatainfo with data stored in one contiguous block */
+    test_simple_vs();
+
+    /* Test VSgetdatainfo with data might be stored in linked blocks */
+    test_append_vs();
+
+    /* Test ANgetdatainfo */
+    test_annotation();
+
+    /* Test GRgetdatainfo with images stored in one contiguous block, with
+       and without compression */
+    test_oneblock_ri();
+
+    /* Test GRgetdatainfo with RI8 and RI24 */
+    test_dfr8_24();
+
+    /* Test GRgetpalinfo with RI8 and GR */
+    test_getpalinfo();
+
+    /* Test Hgetntinfo */
+    test_getntinfo();
+}
diff --git a/hdf/test/tdatainfo.h b/hdf/test/tdatainfo.h
new file mode 100644
index 0000000..3bbbb78
--- /dev/null
+++ b/hdf/test/tdatainfo.h
@@ -0,0 +1,35 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: tutils.h 5335 2010-01-28 06:28:23Z bmribler $ */
+
+#ifndef _TDATAINFO_H
+#define _TDATAINFO_H
+
+typedef struct
+  {
+        int32 numtype;  /* number type of data */
+        int32 n_values; /* number of values in an SDS, a vdata, or an RI image*/
+        int32* offsets; /* offset(s) of data block(s) */
+        int32* lengths; /* length(s) of data block(s) */
+  }
+t_hdf_datainfo_t;
+
+/* Utility functions to allocate and deallocate hdf_datainfo_t's members*/
+intn alloc_info(t_hdf_datainfo_t *info, uintn info_count);
+void free_info(t_hdf_datainfo_t *info);
+
+/* Other utility functions */
+intn readnoHDF_char(const char *filename, const int32 offset, const int32 length, const char *orig_buf);
+
+#endif /* _TDATAINFO_H */
diff --git a/hdf/test/tdfr8.c b/hdf/test/tdfr8.c
new file mode 100644
index 0000000..dbb9ddc
--- /dev/null
+++ b/hdf/test/tdfr8.c
@@ -0,0 +1,229 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/************************************************************************
+ * tdfr8.c - test file for images of DFR8 API
+ *************************************************************************/
+
+#include "hdf.h"
+#include "tproto.h"	/* for utility macros */
+
+/************************************************************************
+   Name: test_GRgetcomptype() - test GRgetcomptype for hmap project
+
+   Description:
+	This routine uses DFR8 API to create the following images:
+	+ Name image0 with no compression and no palette
+	+ Name image1 with no compression and no palette
+	+ Name image2 with no compression and with palette
+	+ Name image3 with no compression and with palette
+	+ Name image4 with RLE compression and with palette
+	+ Name image5 with RLE compression and with palette
+	+ Name image6 with IMCOMP compression and with palette
+	+ Name image7 with IMCOMP compression and with palette
+	* Name image8 with JPEG compression and with palette
+	+ Name image9 with JPEG compression and with palette
+	+ Name image10 with RLE compression and with palette
+	+ Name image11 with RLE compression and with palette
+	All have same data in rasters and in palette (when used)
+	Note: This part of the test was adopted from Ruth's test program.  
+
+	The function GRgetcomptype will be call on each image and the returned
+	compression type will be verified against the list of compressions used.
+   BMR - Mar 12, 2011
+**************************************************************************/
+#define FILE_NAME	"tGRgetcomptype.hdf"
+#define HEIGHT		3
+#define WIDTH		8
+#define N_IMAGES	12
+#define N_ENTRIES	256
+#define N_COMPONENTS	3
+
+void
+test_GRgetcomptype()
+{
+    intn  ii;
+    int   row, col;
+    int   entry, component;
+    uint8 raster[HEIGHT][WIDTH];
+    uint8 palette[N_ENTRIES*N_COMPONENTS],
+	  temp_pal[N_ENTRIES][N_COMPONENTS];
+    int32 file_id, gr_id, ri_id;
+    int32 num_images=0, num_fattrs=0;
+    intn  status;
+    comp_coder_t comp_type;
+    comp_info compress_info;
+
+    /* used to verify the compression type of the images */
+    comp_coder_t check_comp[N_IMAGES] = {COMP_CODE_NONE, COMP_CODE_NONE,
+		COMP_CODE_NONE, COMP_CODE_NONE, COMP_CODE_RLE, COMP_CODE_RLE,
+		COMP_CODE_IMCOMP, COMP_CODE_IMCOMP, COMP_CODE_JPEG,
+		COMP_CODE_JPEG, COMP_CODE_RLE, COMP_CODE_RLE};
+
+    /* used to verify whether an image should be mapped */
+    intn maplist[N_IMAGES] = {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE};
+
+    /* Initialize the raster image array */
+    for ( row = 0; row < HEIGHT; row++ ) {
+        for ( col = 0; col < WIDTH; col++ ) {
+            raster[row][col] = row*10 + col;
+        }
+    }
+        
+    /* 
+     * Initialize the palette array (256 entries of RGB components)
+     * We want our test case to be easy to see, so only turn
+     * on colors for values we have in raster image.
+     * Red for first row; Green for second row; Blue for third row
+     * -RA
+     */
+    for ( entry = 0; entry < N_ENTRIES; entry++ ) {
+        for ( component = 0; component < N_COMPONENTS; component++ )
+	{
+            if (( 0 <= entry ) && ( entry <= 7 ))
+	    {   /* values in first row of raster */
+                temp_pal[entry][0] = 255;    /* Red */
+                temp_pal[entry][1] = 0;      /* Green */
+                temp_pal[entry][2] = 0;      /* Blue */
+            } else if (( 10 <= entry ) && ( entry <= 17)) 
+	    {   /* values in second row of raster */
+                temp_pal[entry][0] = 0;       /* Red */
+                temp_pal[entry][1] = 255;     /* Green */
+                temp_pal[entry][2] = 0;       /* Blue */
+            } else if (( 20 <= entry ) && ( entry <= 27)) 
+	    {   /* values in third row of raster */
+                temp_pal[entry][0] = 0;       /* Red */
+                temp_pal[entry][1] = 0;       /* Green */
+                temp_pal[entry][2] = 255;     /* Blue */
+            } else 
+	    {   /* all else (don't expect) will be black */
+                temp_pal[entry][0] = 0;       /* Red */
+                temp_pal[entry][1] = 0;       /* Green */
+                temp_pal[entry][2] = 0;       /* Blue */
+            }
+        }
+    }
+
+    /* Work around to pass "palette" into DFR8setpalette w/o compiler warning.*/
+    HDmemcpy(palette, temp_pal, N_ENTRIES*N_COMPONENTS);
+
+    /* Write image0 to the HDF4 file with no compression and no palette
+     * Note that the order of args 3 and 4 is width then height.  */
+    status = DFR8putimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_NONE );
+    CHECK_VOID(status, FAIL, "DFR8putimage");
+
+    /* Write image1 to the HDF4 file with no compression and no palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_NONE );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Set the palette */
+    status = DFR8setpalette( palette );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image2 with no compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_NONE );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image3 with no compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_NONE );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image4 with RLE compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_RLE );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image5 with RLE compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_RLE );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image6 with IMCOMP compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_IMCOMP );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image7 with IMCOMP compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_IMCOMP );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image8 with JPEG compression and with palette */
+    compress_info.jpeg.quality = 60;
+    compress_info.jpeg.force_baseline = 1;
+    status = DFR8setcompress( COMP_JPEG, &compress_info );
+    CHECK_VOID(status, FAIL, "DFR8setcompress");
+
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_JPEG );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image9 with JPEG compression and with palette */
+    compress_info.jpeg.quality = 60;
+    compress_info.jpeg.force_baseline = 1;
+    status = DFR8setcompress( COMP_JPEG, &compress_info );
+    CHECK_VOID(status, FAIL, "DFR8setcompress");
+
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_JPEG );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image10 with RLE compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_RLE );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+    /* Write image11 with RLE compression and with palette */
+    status = DFR8addimage( FILE_NAME, raster, WIDTH, HEIGHT, COMP_RLE );
+    CHECK_VOID(status, FAIL, "DFR8addimage");
+
+
+    /* Open the file in GR interface and verify the compression type of each
+	image in the file */
+
+    /* Open the file and initialize the GR interface */
+    file_id = Hopen(FILE_NAME, DFACC_READ, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+    gr_id = GRstart(file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Get the number of images in the file */
+    status = GRfileinfo(gr_id, &num_images, &num_fattrs);
+    CHECK_VOID(status, FAIL, "GRfileinfo");
+
+    /* Verify compression type of each image */
+    for (ii = 0; ii < num_images; ii++)
+    {
+        intn  is_mappedable;/* TRUE if the image is mapped-able (hmap project)*/
+        intn  name_generated; /* TRUE if the image has name generated by lib */
+
+	ri_id = GRselect(gr_id, ii);
+	CHECK_VOID(ri_id, FAIL, "GRselect");
+
+	/* Get image's compression type */
+	status = GRgetcomptype(ri_id, &comp_type);
+	CHECK_VOID(status, FAIL, "GRgetcomptype");
+
+        /* Test GR2bmapped on this image (For hmap project only) */
+        status = GR2bmapped(ri_id, &is_mappedable, &name_generated);
+        CHECK_VOID(status, FAIL, "GR2bmapped");
+        VERIFY_VOID(is_mappedable, maplist[ii], "GR2bmapped");
+        VERIFY_VOID(name_generated, TRUE, "GR2bmapped");
+
+	/* Verify compression type */
+  	if (comp_type != check_comp[ii])
+	VERIFY_VOID(check_comp[ii], comp_type, "GRgetcomptype");
+
+	status = GRendaccess(ri_id);
+	CHECK_VOID(status, FAIL, "GRendaccess");
+    }
+
+    /* Terminate access to the file */
+    status = GRend(gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+} /* test_GRgetcomptype */
diff --git a/hdf/test/tdupimgs.c b/hdf/test/tdupimgs.c
new file mode 100644
index 0000000..b1cdffb
--- /dev/null
+++ b/hdf/test/tdupimgs.c
@@ -0,0 +1,174 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf.h"
+#include <stdio.h>
+#include "tutils.h"
+
+#define FILE_NAME     "gr_double_test.hdf"
+#define IMAGE_COMP    "Compressed Image"
+#define IMAGE_CHUNK   "Chunked Image"
+#define IMAGE_CMP_CHK "Comp_Chunked Image"
+#define  N_COMPS  3  /* number of components in the image */
+#define N_IMAGES  3  /* currently, 3 images in the file, must be updated as needed */
+#define X_LENGTH 10
+#define Y_LENGTH 10
+
+extern void test_mgr_dup_images()
+{
+    int32 fid, grid, riid, il = MFGR_INTERLACE_PIXEL;
+    int32 start[2], stride[2], edges[2],dims[2];
+    uint8 image_data[X_LENGTH][Y_LENGTH]; 
+    intn i, j; 
+    intn status; 
+    int32 n_datasets;       /* number of datasets */
+    int32 n_attrs;          /* number of attributes */
+
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing eliminating duplicate images\n"););
+
+    MESSAGE(8, printf("Try creating a new file and checking it out\n"););
+
+    /* Create the file. */
+    fid = Hopen(FILE_NAME, DFACC_CREATE, 0); 
+    CHECK_VOID(fid, FAIL,"Hopen");
+
+    /* Initiate the GR interface. */
+    grid = GRstart(fid); 
+    CHECK_VOID(grid, FAIL, "GRstart");
+
+    /* Define the location, pattern, and size of the data set */
+    dims[0] = X_LENGTH;
+    dims[1] = Y_LENGTH;
+    for (i = 0; i < 2; i++) 
+    {
+	start[i] = 0; 
+	edges[i] = dims[i]; 
+    }
+
+    /* Initialize data we are going to write out, same for all images */
+    for (i = 0; i < Y_LENGTH; i++)
+	for (j = 0; j < X_LENGTH; j++)
+	    image_data[i][j] = (uint8) (i + j);
+
+    /**** Make an image with compressed data ****/
+    {
+	comp_info cinfo;
+	int32 comp_type;
+
+        /* Create the first image in this file */
+        riid=GRcreate(grid, IMAGE_COMP, 1, DFNT_UINT8, il, dims);
+        CHECK_VOID(riid, FAIL, "GRcreate");
+
+        /* Set the compression method for the image */
+        comp_type=COMP_CODE_DEFLATE;
+        cinfo.deflate.level=7;
+        status = GRsetcompress(riid, comp_type, &cinfo);
+        CHECK_VOID(status, FAIL, "GRsetcompress");
+
+        /* Write the whole image out */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        status = GRwriteimage(riid, start, stride, dims, image_data);
+        CHECK_VOID(status, FAIL, "GRreadimage");
+
+        /* Close the image */
+        status = GRendaccess(riid);
+	CHECK_VOID(status, FAIL, "GRendaccess");
+    }
+
+    /**** Make an image with chunked  data ****/
+    {
+	int32 comp_flag;
+	HDF_CHUNK_DEF c_def; 
+
+	/* Create the second image */
+	riid=GRcreate(grid, IMAGE_CHUNK, N_COMPS, DFNT_UINT8, il, dims);
+	CHECK_VOID(riid, FAIL, "GRcreate");
+
+	/* Make it chunked image */
+	comp_flag = HDF_CHUNK;
+	c_def.chunk_lengths[0] = 3;
+	c_def.chunk_lengths[1] = 2;
+
+	status = GRsetchunk(riid, c_def, comp_flag);
+	CHECK_VOID(status, FAIL, "GRsetchunk");
+
+	/* Write data to the entire image */
+	start[0]=start[1]=0;
+	stride[0]=stride[1]=1;
+	status = GRwriteimage(riid, start, stride, dims, image_data);
+	CHECK_VOID(status, FAIL, "GRwriteimage");
+
+	/* Terminate access to this image */
+	status = GRendaccess (riid);
+	CHECK_VOID(status, FAIL, "GRendaccess");
+    } /* finish creating an image with chunked data */
+
+    /**** Make a GR image with chunked and DEFLATE compressed data */
+    {
+	int32 comp_flag;
+	HDF_CHUNK_DEF c_def; 
+
+	/* Create the image */
+	riid = GRcreate(grid, IMAGE_CMP_CHK, 3, DFNT_UINT8, il, dims); 
+	CHECK_VOID(riid, FAIL, "GRcreate");
+
+	/* Define the location, pattern, and size of the data set */
+	for (i = 0; i < 2; i++) 
+	{ 
+	    c_def.comp.chunk_lengths[i]=dims[i]/2; 
+	} 
+
+	/* Set info for compression/chunk */
+	c_def.comp.comp_type = COMP_CODE_DEFLATE;
+	comp_flag = HDF_CHUNK|HDF_COMP;
+	c_def.comp.cinfo.deflate.level = 9;
+	status = GRsetchunk(riid,c_def,comp_flag);
+	CHECK_VOID(status, FAIL, "GRsetchunk");
+
+	/* Write the stored data to the image array */
+	status = GRwriteimage(riid, start, NULL, edges, (VOIDP)image_data);
+	CHECK_VOID(status, FAIL, "GRwriteimage");
+
+	/* Terminate access to the image */
+	status = GRendaccess(riid);
+	CHECK_VOID(status, FAIL, "GRendaccess");
+    }
+
+    /* Terminate access to the file */
+    status = GRend(grid);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /* Open the file again and check its info */
+    fid = Hopen(FILE_NAME, DFACC_READ, 0); 
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initiate the GR interface. */
+    grid = GRstart(fid); 
+    CHECK_VOID(grid, FAIL, "GRstart");
+
+    /* There currently should only be 3 images in the file */
+    status = GRfileinfo(grid,&n_datasets,&n_attrs);
+    CHECK_VOID(status, FAIL, "GRfileinfo");
+    VERIFY_VOID(n_datasets, N_IMAGES, "GRfileinfo");
+
+    /* Terminate access to the file */
+    status = GRend(grid);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+}
+
diff --git a/hdf/test/test_files/8bit.dat b/hdf/test/test_files/8bit.dat
new file mode 100644
index 0000000..32962f5
Binary files /dev/null and b/hdf/test/test_files/8bit.dat differ
diff --git a/hdf/test/test_files/README b/hdf/test/test_files/README
new file mode 100644
index 0000000..b8a384b
--- /dev/null
+++ b/hdf/test/test_files/README
@@ -0,0 +1,4 @@
+BMR: The file grtdfui83.hdf is added here to test Vgisinternal for the case
+     where a GR vgroup does not have a class name as "RIG0.0" but only a name
+     as such.  This is a very rare case because the file can only be generated
+     by the library versions sometimes in 1995.  2012/1/10
diff --git a/hdf/test/test_files/bitio.dat b/hdf/test/test_files/bitio.dat
new file mode 100644
index 0000000..f574a3c
Binary files /dev/null and b/hdf/test/test_files/bitio.dat differ
diff --git a/hdf/test/test_files/gr_r24.dat b/hdf/test/test_files/gr_r24.dat
new file mode 100644
index 0000000..6fac5c5
Binary files /dev/null and b/hdf/test/test_files/gr_r24.dat differ
diff --git a/hdf/test/test_files/greyjpeg.dat b/hdf/test/test_files/greyjpeg.dat
new file mode 100644
index 0000000..b4ca8a0
Binary files /dev/null and b/hdf/test/test_files/greyjpeg.dat differ
diff --git a/hdf/test/test_files/grtdfui83.hdf b/hdf/test/test_files/grtdfui83.hdf
new file mode 100644
index 0000000..883a904
Binary files /dev/null and b/hdf/test/test_files/grtdfui83.hdf differ
diff --git a/hdf/test/test_files/jpeg.dat b/hdf/test/test_files/jpeg.dat
new file mode 100644
index 0000000..32e46de
Binary files /dev/null and b/hdf/test/test_files/jpeg.dat differ
diff --git a/hdf/test/test_files/litend.dat b/hdf/test/test_files/litend.dat
new file mode 100644
index 0000000..e8955b1
Binary files /dev/null and b/hdf/test/test_files/litend.dat differ
diff --git a/hdf/test/test_files/nbit.dat b/hdf/test/test_files/nbit.dat
new file mode 100644
index 0000000..79d71c0
Binary files /dev/null and b/hdf/test/test_files/nbit.dat differ
diff --git a/hdf/test/test_files/tmgr.dat b/hdf/test/test_files/tmgr.dat
new file mode 100644
index 0000000..5b7044b
Binary files /dev/null and b/hdf/test/test_files/tmgr.dat differ
diff --git a/hdf/test/test_files/tvattr.dat b/hdf/test/test_files/tvattr.dat
new file mode 100644
index 0000000..d47ea03
Binary files /dev/null and b/hdf/test/test_files/tvattr.dat differ
diff --git a/hdf/test/testhdf.c b/hdf/test/testhdf.c
new file mode 100644
index 0000000..2ad115a
--- /dev/null
+++ b/hdf/test/testhdf.c
@@ -0,0 +1,315 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6036 $";
+#endif
+
+/* $Id: testhdf.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+/*
+   FILE
+   testhdf.c
+   HDF testing framework main file.
+
+   REMARKS
+   General test wrapper for HDF base library test programs
+
+   DESIGN
+   Each test function should be implemented as function having
+   no parameters and returning void (i.e. no return value).  They
+   should be put into the list of InitTest() calls in main()
+   below.  Functions which depend on other functionality should
+   be placed below the InitTest() call for the base functionality
+   testing.
+   Each test module should include tproto.h and define a unique
+   set of names for test files they create.
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES/VARIABLES:
+   Two variables are exported: num_errs, and Verbosity.
+
+ */
+
+#define MAXNUMOFTESTS 35
+#define TESTMASTER
+
+/* Internal Variables */
+static int  Index = 0;
+
+/* ANY new test needs to have a prototype in tproto.h */
+#include "tproto.h"
+
+struct TestStruct
+  {
+      int         NumErrors;
+      char        Description[64];
+      int         SkipFlag;
+      char        Name[16];
+      VOID        (*Call) (void);
+  }
+         Test[MAXNUMOFTESTS];
+
+static void
+InitTest(const char *TheName, VOID(*TheCall) (void), const char *TheDescr);
+static void usage(void);
+
+static void
+InitTest(const char *TheName, VOID(*TheCall) (void), const char *TheDescr)
+{
+    if (Index >= MAXNUMOFTESTS)
+      {
+          printf("Uh-oh, too many tests added, increase MAXNUMOFTEST!\n");
+          exit(0);
+      }     /* end if */
+    HDstrcpy(Test[Index].Description, TheDescr);
+    HDstrcpy(Test[Index].Name, TheName);
+    Test[Index].Call = TheCall;
+    Test[Index].NumErrors = -1;
+    Test[Index].SkipFlag = 0;
+    Index++;
+}
+
+static void
+usage(void)
+{
+    intn        i;
+
+    printf("Usage: testhdf [-v[erbose] (l[ow]|m[edium]|h[igh]|0-10)] \n");
+    printf("               [-[e]x[clude] name+] \n");
+    printf("               [-o[nly] name+] \n");
+    printf("               [-b[egin] name] \n");
+    printf("               [-s[ummary]]  \n");
+    printf("               [-c[leanoff]]  \n");
+    printf("               [-n[ocaching]]  \n");
+    printf("               [-h[elp]]  \n");
+    printf("\n\n");
+    printf("verbose   controls the amount of information displayed\n");
+    printf("exclude   to exclude tests by name\n");
+    printf("only      to name tests which should be run\n");
+    printf("begin     start at the name of the test givin\n");
+    printf("summary   prints a summary of test results at the end\n");
+    printf("cleanoff  does not delete *.hdf files after execution of tests\n");
+    printf("nocaching do not turn on low-level DD caching\n");
+    printf("help      print out this information\n");
+    printf("\n\n");
+    printf("This program currently tests the following: \n\n");
+    printf("%16s %s\n", "Name", "Description");
+    printf("%16s %s\n", "----", "-----------");
+    for (i = 0; i < Index; i++)
+        printf("%16s %s\n", Test[i].Name, Test[i].Description);
+    printf("\n\n");
+}   /* end usage() */
+
+int
+main(int argc, char *argv[])
+{
+    int         CLLoop;         /* Command Line Loop */
+    int         Loop, Loop1;
+    int         Summary = 0;
+    int         CleanUp = 1;
+    int         Cache = 1;
+    uint32      lmajor, lminor, lrelease;
+    char        lstring[81];
+
+    /* Un-buffer the stdout and stderr */
+    setbuf(stderr, NULL);
+    setbuf(stdout, NULL);
+    /* Tests are generally arranged from least to most complexity... */
+#if !(defined _WIN32)
+    InitTest("bitvect", test_bitvect, "Bit-Vector routines");
+    InitTest("tbbt", test_tbbt, "Threaded Balanced Binary Trees");
+#endif
+    InitTest("vers", test_vers, "VERSION OF LIBRARY");
+    InitTest("hfile", test_hfile, "HFILE");
+    InitTest("hfile1", test_hfile1, "HFILE LIMITS");
+    InitTest("hblocks", test_hblocks, "HBLOCKS");
+    InitTest("extelt", test_hextelt, "EXTERNAL ELEMENTS");
+    InitTest("comp", test_comp, "COMPRESSED ELEMENTS");
+    InitTest("chunks", test_chunks, "Chunks");
+#ifdef LATER
+    InitTest("vblocks", test_hvblocks, "Variable Length Linked Blocks");
+#endif /* LATER */
+    InitTest("bitio", test_bitio, "BIT I/O");
+    InitTest("8bit", test_r8, "8BIT RASTER IMAGE INTERFACE");
+    InitTest("pal", test_pal, "PALETTE INTERFACE");
+    InitTest("24bit", test_r24, "24BIT RASTER IMAGE INTERFACE");
+    InitTest("macros", test_macros, "ENCODING/DECODING INTERFACE");
+    InitTest("conv", test_conv, "CONVERSION INTERFACE");
+    InitTest("sdmms", test_sdmms, "SDMMS");
+    InitTest("sdnmms", test_sdnmms, "SDNMMS");
+    InitTest("sdstr", test_tsdstr, "DATASTRINGS");
+    InitTest("slabs", test_slab, "HYPERSLAB INTERFACE");
+    InitTest("anot", test_an, "ANNOTATIONS");
+    InitTest("anot_2", test_an_2, "UPDATE ANNOTATIONS");
+    InitTest("anfile", test_anfile, "FILE ANNOTATIONS");
+    InitTest("manot", test_man, "MULTI-ANNOTATIONS");
+    InitTest("nbit", test_nbit, "N-Bit Dataset Interface");
+    InitTest("litend", test_litend, "LITTLE-ENDIAN INTERFACE");
+    InitTest("vset", test_vsets, "VSET InterfaceTest");
+    InitTest("vnameclass", test_vnameclass, "VSET Name and Class");
+    InitTest("vattr", test_vset_attr, "VSET AttributeTest");
+    InitTest("vsfpack", test_vspack, "Vdata fields pack Test");
+    InitTest("datainfo", test_datainfo, "Getting Raw Data's Spatial Information");
+    InitTest("attdatainfo", test_attdatainfo, "Getting Raw Data's Spatial Information of Attributes");
+    InitTest("mfgr", test_mgr, "Multi-File Generic Raster Image Interface");
+
+    Verbosity = 4;  /* Default Verbosity is Low */
+    Hgetlibversion(&lmajor, &lminor, &lrelease, lstring);
+
+    printf("\nFor help use: testhdf -help\n");
+    printf("Built with HDF Library Version: %u.%u.%u, %s\n\n", (unsigned) lmajor,
+           (unsigned) lminor, (unsigned) lrelease, lstring);
+    for (CLLoop = 1; CLLoop < argc; CLLoop++)
+      {
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-verbose") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-v") == 0)))
+            {
+                if (argv[CLLoop + 1][0] == 'l')
+                    Verbosity = 4;
+                else if (argv[CLLoop + 1][0] == 'm')
+                    Verbosity = 6;
+                else if (argv[CLLoop + 1][0] == 'h')
+                    Verbosity = 10;
+                else
+                    Verbosity = atoi(argv[CLLoop + 1]);
+            }   /* end if */
+          if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-summary") == 0) ||
+                                  (HDstrcmp(argv[CLLoop], "-s") == 0)))
+              Summary = 1;
+
+          if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-help") == 0) ||
+                                  (HDstrcmp(argv[CLLoop], "-h") == 0)))
+            {
+                usage();
+                exit(0);
+            }
+
+          if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-cleanoff") == 0) ||
+                                  (HDstrcmp(argv[CLLoop], "-c") == 0)))
+              CleanUp = 0;
+
+          if ((argc > CLLoop) && ((HDstrcmp(argv[CLLoop], "-nocache") == 0) ||
+                                  (HDstrcmp(argv[CLLoop], "-n") == 0)))
+              Cache = 0;
+
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-exclude") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-x") == 0)))
+            {
+                Loop = CLLoop + 1;
+                while ((Loop < argc) && (argv[Loop][0] != '-'))
+                  {
+                      for (Loop1 = 0; Loop1 < Index; Loop1++)
+                          if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
+                              Test[Loop1].SkipFlag = 1;
+                      Loop++;
+                  }     /* end while */
+            }   /* end if */
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-begin") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-b") == 0)))
+            {
+                Loop = CLLoop + 1;
+                while ((Loop < argc) && (argv[Loop][0] != '-'))
+                  {
+                      for (Loop1 = 0; Loop1 < Index; Loop1++)
+                        {
+                            if (HDstrcmp(argv[Loop], Test[Loop1].Name) != 0)
+                                Test[Loop1].SkipFlag = 1;
+                            if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
+                                Loop1 = Index;
+                        }   /* end for */
+                      Loop++;
+                  }     /* end while */
+            }   /* end if */
+          if ((argc > CLLoop + 1) && ((HDstrcmp(argv[CLLoop], "-only") == 0) ||
+                                      (HDstrcmp(argv[CLLoop], "-o") == 0)))
+            {
+                for (Loop = 0; Loop < Index; Loop++)
+                    Test[Loop].SkipFlag = 1;
+                Loop = CLLoop + 1;
+                while ((Loop < argc) && (argv[Loop][0] != '-'))
+                  {
+                      for (Loop1 = 0; Loop1 < Index; Loop1++)
+                          if (HDstrcmp(argv[Loop], Test[Loop1].Name) == 0)
+                              Test[Loop1].SkipFlag = 0;
+                      Loop++;
+                  }     /* end while */
+            }   /* end if */
+      }     /* end for */
+
+    if(Cache) /* turn on caching, unless we were instucted not to */
+	Hcache(CACHE_ALL_FILES,TRUE);
+
+    for (Loop = 0; Loop < Index; Loop++)
+      {
+          if (Test[Loop].SkipFlag)
+            {
+                MESSAGE(2, printf("Skipping -- %s \n", Test[Loop].Description);
+                    );
+            }
+          else
+            {
+                MESSAGE(2, printf("Testing  -- %s (%s) \n", Test[Loop].Description,
+                                  Test[Loop].Name);
+                    );
+                MESSAGE(5, printf("===============================================\n");
+                    );
+                Test[Loop].NumErrors = num_errs;
+                (*Test[Loop].Call) ();
+                Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
+                MESSAGE(5, printf("===============================================\n");
+                    );
+                MESSAGE(5, printf("There were %d errors detected.\n\n", (int) Test[Loop].NumErrors);
+                    );
+            }   /* end else */
+      }     /* end for */
+
+    MESSAGE(2, printf("\n\n");
+        )
+        if (num_errs)
+        printf("!!! %d Error(s) were detected !!!\n\n", (int) num_errs);
+    else
+        printf("All tests were successful. \n\n");
+
+    if (Summary)
+      {
+          printf("Summary of Test Results:\n");
+          printf("Name of Test     Errors Description of Test\n");
+          printf("---------------- ------ --------------------------------------\n");
+
+          for (Loop = 0; Loop < Index; Loop++)
+            {
+                if (Test[Loop].NumErrors == -1)
+                    printf("%16s %6s %s\n", Test[Loop].Name, "N/A", Test[Loop].Description);
+                else
+                    printf("%16s %6d %s\n", Test[Loop].Name, (int) Test[Loop].NumErrors,
+                           Test[Loop].Description);
+            }   /* end for */
+          printf("\n\n");
+      }     /* end if */
+
+    if (CleanUp)
+      {
+          MESSAGE(2, printf("\nCleaning Up...\n\n");
+              );
+#if !(defined DOS386 || defined WIN386)
+          system("rm -f *.hdf *.tmp");
+#else   /* OLD_WAY */
+          remove("*.hdf");
+          remove("*.tmp");
+#endif  /* OLD_WAY */
+      }     /* end if */
+    exit(num_errs);
+    return num_errs;
+}   /* end main() */
diff --git a/hdf/test/tmgrattr.c b/hdf/test/tmgrattr.c
new file mode 100644
index 0000000..095956e
--- /dev/null
+++ b/hdf/test/tmgrattr.c
@@ -0,0 +1,488 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tmgrattr.c - tests the attribute functions for the multi-file GR interface
+ * Structure of the file:
+ *    test_mgr_attr - test driver
+ *        test_mgr_fillvalues - tests with fill value attributes
+ *        test_mgr_userattr - tests with user-defined attributes
+ *
+****************************************************************************/
+
+#include "hdf.h"
+#include <stdio.h>
+#include "tutils.h"
+
+#include "tproto.h"
+#define TESTFILE "tmgratt.hdf"
+
+#define	F_ATT1_VAL	"Contents of First FILE Attribute"
+#define	IMAGE1_NAME	"Image 1"
+#define	F_ATT1_NAME	"File Attribute 1"
+#define	F_ATT2_NAME	"File Attribute 2"
+#define	RI_ATT1_NAME	"Image Attribute 1"
+#define	RI_ATT2_NAME	"Image Attribute 2"
+#define	F_ATT1_N_VALUES	32
+#define	F_ATT2_N_VALUES	5
+#define N_COMPS		4
+#define	RI_ATT1_VAL	"Contents of IMAGE1's First Attribute"
+#define	RI_ATT_N_VALUES		4
+#define	RI_ATT1_N_VALUES	36
+#define	RI_ATT2_N_VALUES	6
+
+/* Pixel with fill values */
+static float32 fill_pixel[RI_ATT_N_VALUES]={1.3,-2.4,1000.3,.25};
+static uint8 file_attr_2[F_ATT2_N_VALUES] = {1, 2, 3, 4, 5};
+
+/********************************************************************
+   Name: test_mgr_fillvalues()
+
+   Description:
+	This test routine sets fill values to an RI with GRsetattr
+	then reads the values back with GRgetattr and verifies them.
+
+   Return value:
+	The number of errors occurred in this routine.
+
+*********************************************************************/
+static int test_mgr_fillvalues()
+{
+    int32 fid;		/* HDF file ID */
+    int32 grid;		/* ID for the GR interface */
+    int32 riid;		/* ID for the RI image */
+    int32 attr_index;	/* attribute index */
+    int32 dims[2]={5,7};    /* dimensions used on all images */
+    uint16 ref;		/* RI reference number */
+    int32 ri_index;	/* RI index */
+    float32 image[7][5][N_COMPS]; /* space for the image data */
+    VOIDP read_fill_vals=NULL;   /* space for fill values read from attr */
+    float32 image0[7][5][N_COMPS]; /* space for the image data */
+    int32 start[2];	/* start of image data to grab */
+    int32 stride[2];	/* stride of image data to grab */
+    char attr_name[H4_MAX_GR_NAME];
+    int32 ntype, n_values;
+    hdf_ntinfo_t nt_info;  /* struct containing name and byte order of a num type */
+    int32 ret;		/* generic return value */
+    int   num_errs = 0; /* number of errors so far */
+
+    MESSAGE(8, printf("Reading fill-value attribute\n"););
+
+    fid = Hopen(TESTFILE, DFACC_CREATE, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    grid = GRstart(fid);
+    CHECK(grid, FAIL, "GRstart");
+
+    {
+        /* Create empty image with default fill-values */
+        riid = GRcreate(grid, IMAGE1_NAME, N_COMPS, DFNT_FLOAT32, MFGR_INTERLACE_PIXEL, dims);
+        CHECK(riid, FAIL, "GRcreate");
+
+        /* Set the fill-value */
+        ret = GRsetattr(riid, FILL_ATTR, DFNT_FLOAT32, RI_ATT_N_VALUES, fill_pixel);
+        CHECK(ret, FAIL, "GRsetattr");
+
+        /* Save the ref. # for later access */
+        ref = GRidtoref(riid);
+        CHECK(ref, (uint16)FAIL, "GRidtoref");
+
+        /* Close the empty image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+
+        /* Get the index of the newly created image */
+        ri_index = GRreftoindex(grid, ref);
+        CHECK(ri_index, FAIL, "GRreftoindex");
+
+        /* Select the newly created image */
+        riid = GRselect(grid, ri_index);
+        CHECK(riid, FAIL, "GRselect");
+
+        /* Buffer to read image's data in */
+        HDmemset(image, 0, (size_t)(dims[0]*dims[1]* N_COMPS)*sizeof(float32));
+
+        /* Fill the memory-only with the default pixel fill-value */
+        HDmemfill(image0, fill_pixel, sizeof(fill_pixel), sizeof(image0) / sizeof(fill_pixel));
+
+        /* Read and verify image's data, should only be fill-values */
+        start[0] = start[1] = 0;
+        stride[0] = stride[1] = 1;
+        ret = GRreadimage(riid, start, stride, dims, image);
+        CHECK(ret, FAIL, "GRreadimage");
+
+        if (HDmemcmp(image, image0, sizeof(image0)) != 0) {
+            MESSAGE(3, printf("Error reading data for image with user defined fill-values\n"););
+            num_errs++;
+        }
+
+        /* Find the image's attribute named FILL_ATTR */
+        attr_index = GRfindattr(riid, FILL_ATTR);
+        VERIFY(attr_index, 0, "GRfindattr");
+
+        /* Get information about the current attribute. */
+        ret = GRattrinfo(riid, attr_index, attr_name, &ntype, &n_values);
+        CHECK(ret, FAIL, "GRattrinfo");
+        VERIFY(attr_index, 0, "GRattrinfo");
+        VERIFY(ntype, DFNT_FLOAT32, "GRattrinfo");
+        VERIFY(n_values, RI_ATT_N_VALUES, "GRattrinfo");
+        VERIFY_CHAR(attr_name, FILL_ATTR, "GRattrinfo");
+
+        /* Allocate a buffer to hold the attribute data. */
+        read_fill_vals = HDmalloc (n_values * sizeof (float32));
+        if (read_fill_vals == NULL) {
+            fprintf(stderr, "Unable to allocate space for attribute data.\n");
+            exit(1);
+        }
+
+        /* Piggy-back a test for Hgetntinfo */
+        ret = Hgetntinfo(ntype, &nt_info);
+        CHECK(ret, FAIL, "Hgetntinfo");
+        VERIFY_CHAR(nt_info.type_name, "float32", "Hgetntinfo");
+
+        /* Read and verify the attribute's data */
+        ret = GRgetattr(riid, attr_index, (VOIDP) read_fill_vals);
+        CHECK(ret, FAIL, "GRgetattr");
+
+        if (HDmemcmp(fill_pixel, read_fill_vals, RI_ATT_N_VALUES) != 0) {
+            MESSAGE(3, printf("Error reading values of attribute FILL_ATTR\n"););
+            num_errs++;
+        } /* end if */
+    
+        if (read_fill_vals != NULL)
+            HDfree(read_fill_vals);
+
+        /* Close the empty image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+    }
+
+    /* Shut down the GR interface */
+    ret = GRend(grid);
+    CHECK(ret, FAIL, "GRend");
+
+    /* Close the file */
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* end test_mgr_fillvalues() */
+
+
+/********************************************************************
+   Name: test_mgr_userattr()
+
+   Description:
+	This test routine creates user-define attributes to the file
+	and to an RI with GRsetattr then reads the values back with
+	GRgetattr and verifies them.
+
+   Return value:
+	The number of errors occurred in this routine.
+
+*********************************************************************/
+static int test_mgr_userattr()
+{
+    int32 grid, riid, fid,
+	  ri_index,
+          f_att_index,     /* index of file attributes */
+          ri_att_index,    /* index of raster image attributes */
+          n_values,        /* number of values in an attribute */
+          n_rimages,       /* number of raster images in the file */
+          n_file_attrs;    /* number of file attributes */
+    char  attr_name[H4_MAX_GR_NAME];  /* buffer to hold the attribute name */
+    char  ri_name[H4_MAX_GR_NAME];  /* buffer to hold the image name */
+    int32 ncomp;           /* number of components */
+    int32 ntype;           /* number type of the components */
+    int32 il;              /* interlace of the image data */
+    int32 dims[2];	   /* dimension sizes of the image */
+    int32 n_attrs;         /* number of attributes with each image */
+    int16 ri_attr_2[RI_ATT2_N_VALUES] = {1, 2, 3, 4, 5, 6};
+    VOIDP data_buf;        /* buffer to hold the attribute values */
+    hdf_ntinfo_t nt_info;  /* struct containing name and byte order of a num type */
+    intn  status;          /* status for functions returning an intn */
+    int   num_errs = 0;    /* number of errors so far */
+
+    MESSAGE(8, printf("Reading user-defined attribute\n"););
+
+    fid = Hopen(TESTFILE, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    grid = GRstart(fid);
+    CHECK(grid, FAIL, "GRstart");
+
+    /* Set two file attributes. */
+    status = GRsetattr(grid, F_ATT1_NAME, DFNT_CHAR8, F_ATT1_N_VALUES, F_ATT1_VAL); 
+    CHECK(status, FAIL, "GRsetattr");
+
+    status = GRsetattr(grid, F_ATT2_NAME, DFNT_UINT8, F_ATT2_N_VALUES, (VOIDP)file_attr_2);
+    CHECK(status, FAIL, "GRsetattr");
+
+    /* Obtain the index of the image named IMAGE1_NAME. */
+    ri_index = GRnametoindex(grid, IMAGE1_NAME);
+    CHECK(ri_index, FAIL, "GRnametoindex");
+
+    /* Obtain the identifier of this image. */
+    riid = GRselect(grid, ri_index);
+    CHECK(riid, FAIL, "GRselect");
+
+    /* Set two attributes to the image. */
+    status = GRsetattr(riid, RI_ATT1_NAME, DFNT_CHAR8, RI_ATT1_N_VALUES, RI_ATT1_VAL);
+    CHECK(status, FAIL, "GRsetattr");
+
+    status = GRsetattr(riid, RI_ATT2_NAME, DFNT_INT16, RI_ATT2_N_VALUES, (VOIDP)ri_attr_2);
+    CHECK(status, FAIL, "GRsetattr");
+
+    /* Terminate accesses, and close the HDF file. */
+    status = GRendaccess(riid);
+    CHECK(status, FAIL, "GRendaccess");
+    status = GRend(grid);
+    CHECK(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Reopen the file again to read the attributes and verify their values.*/
+    fid = Hopen(TESTFILE, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    grid = GRstart(fid);
+    CHECK(grid, FAIL, "GRstart");
+
+    /* Verify the number of file attributes */
+    status = GRfileinfo (grid, &n_rimages, &n_file_attrs);
+    CHECK(status, FAIL, "GRfileinfo");
+
+    /* Read each file attribute and verify its values */
+    if (status != FAIL && n_file_attrs > 0)
+    {
+	for (f_att_index = 0; f_att_index < n_file_attrs; f_att_index++)
+	{
+	    /* Get information about the current file attribute. */
+	    status = GRattrinfo (grid, f_att_index, attr_name, &ntype,
+                              &n_values);
+	    CHECK(status, FAIL, "GRattrinfo");
+
+	    /* Allocate a buffer to hold the file attribute data.  Knowledge
+	     * about the data type is assumed to be available from the previous
+	     * part of the test where the correspondent GRsetattr was called. */
+	    switch (ntype) {
+	      case DFNT_CHAR8:
+		data_buf = malloc (n_values * sizeof (char8));
+		if (data_buf == NULL)
+		{
+		    fprintf(stderr, "test_mgr_userattr: Failed to allocate memory for data buffer for char8.\n");
+		    exit (1);
+		}
+		break;
+	      case DFNT_UINT8:
+		data_buf = malloc (n_values * sizeof (uint8));
+		if (data_buf == NULL)
+		{
+		    fprintf(stderr, "test_mgr_userattr: Failed to allocate memory for data buffer for uint8.\n");
+		    exit (1);
+		}
+		break;
+	      default:
+		{
+		    fprintf (stderr, "test_mgr_userattr: Unable to determine data type to allocate data buffer.\n");
+		    exit (1);
+		}
+	    } /* switch */
+
+	    /* Read and verify the attribute values. */
+	    status = GRgetattr (grid, f_att_index, (VOIDP)data_buf);
+	    CHECK(status, FAIL, "GRgetattr");
+
+	    switch (ntype) {
+	      case DFNT_CHAR8:
+		if (HDmemcmp(data_buf, F_ATT1_VAL, n_values) != 0)
+		{
+		    MESSAGE(3, printf("Error reading values of attribute %s\n",
+				attr_name););
+		    num_errs++;
+		} /* end if */
+
+		/* Piggy-back a test for Hgetntinfo */
+		status = Hgetntinfo(ntype, &nt_info);
+		CHECK(status, FAIL, "Hgetntinfo");
+		VERIFY_CHAR(nt_info.type_name, "char8", "Hgetntinfo");
+		break;
+	      case DFNT_UINT8:
+		if (HDmemcmp(data_buf, file_attr_2, n_values) != 0)
+		{
+		    MESSAGE(3, printf("Error reading values of attribute %s\n",
+				attr_name););
+		    num_errs++;
+		} /* end if */
+
+		/* Piggy-back a test for Hgetntinfo */
+		status = Hgetntinfo(ntype, &nt_info);
+		CHECK(status, FAIL, "Hgetntinfo");
+		VERIFY_CHAR(nt_info.type_name, "uint8", "Hgetntinfo");
+		break;
+	      default:
+		{
+		    fprintf (stderr, "test_mgr_userattr: Unable to determine data type to verify data.\n");
+		    exit (1);
+		}
+	    } /* switch */
+
+	    /* Free the space allocated for the data buffer. */
+	    HDfree(data_buf);
+
+	} /* for */
+    } /* if */
+
+    /* Obtain the index of the image named IMAGE1_NAME. */
+    ri_index = GRnametoindex(grid, IMAGE1_NAME);
+    CHECK(ri_index, FAIL, "GRnametoindex");
+
+    /* Obtain the identifier of this image. */
+    riid = GRselect(grid, ri_index);
+    CHECK(riid, FAIL, "GRselect");
+
+    /* Get the image information */
+    status = GRgetiminfo(riid, ri_name, &ncomp, &ntype, &il, dims, &n_attrs);
+    CHECK(status, FAIL, "GRgetiminfo");
+
+    /* Verify each attribute's values */
+    if (status != FAIL && n_attrs > 0)
+    {
+	for (ri_att_index = 0; ri_att_index < n_attrs; ri_att_index++)
+	{
+	    /* Get information about the current attribute. */
+	    status = GRattrinfo (riid, ri_att_index, attr_name, &ntype,
+                              &n_values);
+	    CHECK(status, FAIL, "GRattrinfo");
+
+	    /* Allocate a buffer to hold the attribute data.  Knowledge about
+	     * the data type is assumed to be available from the previous
+	     * part of the test where the correspondent GRsetattr was called. */
+	    switch (ntype) {
+	      case DFNT_FLOAT32:
+		data_buf = malloc (n_values * sizeof (float32));
+		if (data_buf == NULL)
+		{
+		    fprintf(stderr, "test_mgr_userattr: Failed to allocate memory for data buffer for float32.\n");
+		    exit (1);
+		}
+		break;
+	      case DFNT_CHAR8:
+		data_buf = malloc (n_values * sizeof (char8));
+		if (data_buf == NULL)
+		{
+		    fprintf(stderr, "test_mgr_userattr: Failed to allocate memory for data buffer for char8.\n");
+		    exit (1);
+		}
+		break;
+	      case DFNT_INT16:
+		data_buf = malloc (n_values * sizeof (int16));
+		if (data_buf == NULL)
+		{
+		    fprintf(stderr, "test_mgr_userattr: Failed to allocate memory for data buffer for int16.\n");
+		    exit (1);
+		}
+		break;
+	      default:
+		{
+		    fprintf (stderr, "test_mgr_userattr: Unable to determine data type to allocate data buffer.\n");
+		    exit (1);
+		}
+	    } /* switch */
+
+	    /* Read and verify the attribute values. */
+	    status = GRgetattr (riid, ri_att_index, (VOIDP)data_buf);
+	    CHECK(status, FAIL, "GRgetattr");
+
+	    /* Verify values from the attribute.
+	     * Knowledge about the data type is assumed to be available from
+	     * the previous part of the test. */
+	    switch (ntype) {
+	      case DFNT_FLOAT32:
+		if (HDmemcmp(fill_pixel, data_buf, RI_ATT_N_VALUES) != 0)
+		{
+		    MESSAGE(3, printf("Error reading values of attribute FILL_ATTR\n"););
+		    num_errs++;
+		} /* end if */
+		break;
+	      case DFNT_CHAR8:
+		if (HDmemcmp(RI_ATT1_VAL, data_buf, RI_ATT1_N_VALUES) != 0)
+		{
+		    MESSAGE(3, printf("Error reading values of attribute FILL_ATTR\n"););
+		    num_errs++;
+		} /* end if */
+		break;
+	      case DFNT_INT16:
+		if (HDmemcmp(ri_attr_2, data_buf, RI_ATT2_N_VALUES) != 0)
+		{
+		    MESSAGE(3, printf("Error reading values of attribute FILL_ATTR\n"););
+		    num_errs++;
+		} /* end if */
+		break;
+	      default:
+		{
+		    fprintf (stderr, "test_mgr_userattr: Unable to determine data type to read attribute data.\n");
+		    exit (1);
+		}
+	    } /* switch */
+
+	    /* Free the space allocated for the data buffer. */
+	    HDfree(data_buf);
+
+	} /* for */
+    } /* if */
+    /* Terminate accesses, and close the HDF file. */
+    status = GRendaccess(riid);
+    CHECK(status, FAIL, "GRendaccess");
+    status = GRend(grid);
+    CHECK(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return(num_errs);
+} /* test_mgr_userattr */
+
+/****************************************************************
+**
+**  test_mgr_attr(): Main multi-file raster attribute test routine
+**
+**  VII. Atribute Functions
+**      A. GRattrinfo
+**      B. Read/Write Attributes
+**          1. GRsetattr
+**          2. GRgetattr
+**      C. GRfindattr
+**
+**  test_mgr_attr is invoked by test_mgr in mgr.c.
+**
+****************************************************************/
+/* Test driver for testing attributes in multi-file GR interface */
+extern void test_mgr_attr()
+{
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    MESSAGE(5, printf("Testing Multi-file Raster Attribute routines\n"););
+
+    /* Test attribute functions with fill-values attributes */
+    num_errs = num_errs + test_mgr_fillvalues();
+
+    /* Test attribute functions with user-defined attributes */
+    num_errs = num_errs + test_mgr_userattr();
+
+    if (num_errs != 0) { H4_FAILED(); }
+}   /* test_mgr_attr() */
diff --git a/hdf/test/tmgrcomp.c b/hdf/test/tmgrcomp.c
new file mode 100644
index 0000000..97afa8b
--- /dev/null
+++ b/hdf/test/tmgrcomp.c
@@ -0,0 +1,1039 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf.h"
+#include <stdio.h>
+#include "tutils.h"
+
+#define GZIPFILE    "gr_gzip.hdf"
+#define JPEGFILE    "gr_jpeg.hdf"
+
+/****************************************************************************
+ * tmgrcomp.c - tests the compression functions for the multi-file GR interface
+ * Structure of the file:
+ *    test_mgr_compress - test driver
+ *	  test_mgr_compress_a - tests with GZIP compressed image
+ *	  test_mgr_compress_b - tests with 8-bit JPEG compressed image
+ *	  test_mgr_compress_c - tests with 24-bit JPEG compressed image
+ *	  test_get_compress - tests getting comp info with compressed image
+ *	  test_mgr_chunk_compress - tests getting comp info with chunked
+ *				and compressed image
+ * Modification:
+ *	Nov 23, 2009: Moved out from mgr.c. - BMR
+*****************************************************************************/
+
+/* Create/Write/Read GZIP compressed image */
+static int test_mgr_compress_a()
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int   num_errs = 0;    /* number of errors so far */
+
+    MESSAGE(8, printf("Operate on gzip compressed images\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid = Hopen(GZIPFILE, DFACC_ALL, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    grid = GRstart(fid);
+    CHECK(grid, FAIL, "GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        comp_coder_t comp_type;            /* Compression method */
+        comp_info cinfo;            /* Compression parameters */
+        int32 dims[2]={10, 10};    /* dimensions for the empty image */
+        uint8 image[10][10]; /* space for the image data */
+        uint8 image0[10][10]; /* space for the image data */
+        int32 start[2];     /* start of image data to grab */
+        int32 stride[2];    /* stride of image data to grab */
+        int32 count[2];     /* Size of image data to operate on */
+        intn i, j;       /* indices */
+
+        /* Initialize data we are going to write out */
+        for (i = 0; i < 10; i++)
+            for (j = 0; j < 10; j++)
+                image0[i][j] = (uint8) (i + j);
+
+        /* Get the first image in this file */
+        riid = GRcreate(grid, "image1", 1, DFNT_UINT8, MFGR_INTERLACE_PIXEL, dims);
+        CHECK(riid, FAIL, "GRcreate");
+
+        /* Set the compression method for the image */
+        comp_type=COMP_CODE_DEFLATE;
+        cinfo.deflate.level=7;
+        ret = GRsetcompress(riid, comp_type, &cinfo);
+        CHECK(ret, FAIL, "GRsetcompress");
+
+        /* Write the whole image out */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret = GRwriteimage(riid, start, stride, dims, image0);
+        CHECK(ret, FAIL, "GRreadimage");
+
+        /* Close the empty image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+
+        /* Check that the image made it out correctly */
+
+        /* Get the first image in this file */
+        riid = GRselect(grid, 0);
+        CHECK(riid, FAIL, "GRselect");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret = GRreadimage(riid, start, stride, dims, image);
+        CHECK(ret, FAIL, "GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image, image0, 10*10)!=0) {
+            MESSAGE(3, printf("Error reading data for gzip compressed image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the empty image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+
+        /* Check for compressing image in the middle of writing data */
+
+        /* Get the first image in this file */
+        riid = GRcreate(grid, "image2", 1, DFNT_UINT8, MFGR_INTERLACE_PIXEL, dims);
+        CHECK(riid, FAIL, "GRcreate");
+
+        /* Write half of the image out */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        count[0]=10; count[1]=5;
+        ret = GRwriteimage(riid, start, stride, count, image0);
+        CHECK(ret, FAIL, "GRwriteimage");
+
+        /* Set the compression method for the image */
+        comp_type=COMP_CODE_DEFLATE;
+        cinfo.deflate.level=7;
+        ret = GRsetcompress(riid, comp_type, &cinfo);
+        CHECK(ret, FAIL, "GRsetcompress");
+
+        /* Write the second half of the image out */
+        start[0]=0; start[1]=5;
+        stride[0]=stride[1]=1;
+        count[0]=10; count[1]=5;
+        ret = GRwriteimage(riid, start, stride, count, &image0[5][0]);
+        CHECK(ret, FAIL, "GRwriteimage");
+
+        /* Close the empty image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+
+        /* Check that the image made it out correctly */
+        HDmemset(image, 0, 10*10);
+
+        /* Get the second image in this file */
+        riid = GRselect(grid, 1);
+        CHECK(riid, FAIL, "GRselect");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret = GRreadimage(riid, start, stride, dims, image);
+        CHECK(ret, FAIL, "GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image, image0, 10*10)!=0) {
+            MESSAGE(3, printf("Error reading 2nd data for gzip compressed image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the empty image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+    }
+    
+    /* Shut down the GR interface */
+    ret = GRend(grid);
+    CHECK(ret, FAIL, "GRend");
+
+    /* Close the file */
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return(num_errs);
+} /* end test_mgr_compress_a() */
+
+/* Create/Write/Read 8-bit JPEG compressed image */
+static int test_mgr_compress_b()
+{
+    int32 fid;              /* HDF file ID */
+    int32 grid;             /* GRID for the interface */
+    int32 ret;              /* generic return value */
+    int   num_errs = 0;    /* number of errors so far */
+
+    MESSAGE(8, printf("Operate on 8-bit JPEG compressed images\n"););
+
+    /* Open up the existing datafile and get the image information from it */
+    fid = Hopen(JPEGFILE, DFACC_ALL, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    grid = GRstart(fid);
+    CHECK(grid, FAIL, "GRstart");
+
+    {
+        int32 riid;     /* RI ID for the new image */
+        comp_coder_t comp_type;            /* Compression method */
+        comp_info cinfo;            /* Compression parameters */
+        int32 dims[2]={10, 10};    /* dimensions for the empty image */
+        int32 dims_out[2];          /* Buffer for retrieving dimensions */
+        uint8 image[10][10]; /* space for the image data */
+        uint8 image0[10][10]; /* space for the image data */
+        int32 start[2];     /* start of image data to grab */
+        int32 stride[2];    /* stride of image data to grab */
+        int32 n_images, n_file_attrs;   /* File information variables */
+        int32 interlace_mode, n_comps, n_attrs, datatype; /* Image information */
+        char name[30];      /* Buffer for retrieving image name */
+        uint8 attr;         /* Attribute data */
+#ifdef NOT_IMPLEMENTED
+        int32 count[2];     /* Size of image data to operate on */
+#endif /* NOT_IMPLEMENTED */
+        intn i, j;       /* indices */
+
+        /* Initialize data we are going to write out */
+        for (i = 0; i < 10; i++)
+            for (j = 0; j < 10; j++)
+                image0[i][j] = (uint8) (i + j);
+
+        /* Get the first image in this file */
+        riid = GRcreate(grid, "image1", 1, DFNT_UINT8, MFGR_INTERLACE_PIXEL, dims);
+        CHECK(riid, FAIL, "GRcreate");
+
+        attr = 100;
+        ret = GRsetattr(riid, "JPEG_quality", DFNT_UINT8, 1, &attr);
+        CHECK(ret, FAIL, "GRsetattr");
+
+        /* Set the compression method for the image */
+        comp_type=COMP_CODE_JPEG;
+        cinfo.jpeg.quality=100;
+        cinfo.jpeg.force_baseline=1;
+        ret = GRsetcompress(riid, comp_type, &cinfo);
+        CHECK(ret, FAIL, "GRsetcompress");
+
+        /* Write the whole image out */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret = GRwriteimage(riid, start, stride, dims, image0);
+        CHECK(ret, FAIL, "GRwriteimage");
+
+        /* Close the image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+
+        /* Close the interface */
+        ret = GRend(grid);
+        CHECK(ret, FAIL, "GRend");
+
+        /* Check that the image made it out correctly */
+
+        /* Re-open the interface */
+        grid = GRstart(fid);
+        CHECK(grid, FAIL, "GRstart");
+
+        /* Get the file information */
+        ret = GRfileinfo(grid, &n_images, &n_file_attrs);
+        CHECK(ret, FAIL, "GRfileinfo");
+        if (n_images != 1) {
+            MESSAGE(3, printf("Wrong number of images found!\n"););
+            num_errs++;
+        }
+
+        /* Check the name of the image in the file */
+        ret = GRnametoindex(grid, "image1");
+        CHECK(ret, FAIL, "GRnametoindex");
+
+        /* Get the first image in this file */
+        riid = GRselect(grid, 0);
+        CHECK(riid, FAIL, "GRselect");
+
+        /* Get the attribute information */
+        ret = GRgetiminfo(riid, name, &n_comps, &datatype, &interlace_mode, dims_out, &n_attrs);
+        CHECK(ret, FAIL, "GRgetiminfo");
+        if (n_attrs != 1) {
+            MESSAGE(3, printf("Wrong number of attributes!\n"););
+            num_errs++;
+        }
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret = GRreadimage(riid, start, stride, dims, image);
+        CHECK(ret, FAIL, "GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image, image0, 10*10)!=0) {
+            MESSAGE(3, printf("Error reading data for gzip compressed image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+
+#ifdef NOT_IMPLEMENTED
+        /* Check for compressing image in the middle of writing data */
+
+        /* Get the first image in this file */
+        riid = GRcreate(grid, "image2", 1, DFNT_UINT8, MFGR_INTERLACE_PIXEL, dims);
+        CHECK(riid, FAIL, "GRcreate");
+
+        /* Write half of the image out */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        count[0]=10; count[1]=5;
+        ret = GRwriteimage(riid, start, stride, count, image0);
+        CHECK(ret, FAIL, "GRwriteimage");
+
+        /* Set the compression method for the image */
+        comp_type=COMP_CODE_JPEG;
+        cinfo.jpeg.quality=100;
+        cinfo.jpeg.force_baseline=1;
+        ret = GRsetcompress(riid, comp_type, &cinfo);
+        CHECK(ret, FAIL, "GRsetcompress");
+
+        /* Write the second half of the image out */
+        start[0]=0; start[1]=5;
+        stride[0]=stride[1]=1;
+        count[0]=10; count[1]=5;
+        ret = GRwriteimage(riid, start, stride, count, &image0[5][0]);
+        CHECK(ret, FAIL, "GRwriteimage");
+
+        /* Close the empty image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+
+        /* Check that the image made it out correctly */
+        HDmemset(image, 0, 10*10);
+
+        /* Get the second image in this file */
+        riid = GRselect(grid, 1);
+        CHECK(riid, FAIL, "GRselect");
+
+        /* Read the whole image in */
+        start[0]=start[1]=0;
+        stride[0]=stride[1]=1;
+        ret = GRreadimage(riid, start, stride, dims, image);
+        CHECK(ret, FAIL, "GRreadimage");
+
+        /* Verify correct image contents */
+        if(HDmemcmp(image, image0, 10*10)!=0) {
+            MESSAGE(3, printf("Error reading 2nd data for gzip compressed image\n"););
+            num_errs++;
+        } /* end if */
+
+        /* Close the image */
+        ret = GRendaccess(riid);
+        CHECK(ret, FAIL, "GRendaccess");
+#endif /* NOT_IMPLEMENTED */
+    }
+    
+    /* Shut down the GR interface */
+    ret = GRend(grid);
+    CHECK(ret, FAIL, "GRend");
+
+    /* Close the file */
+    ret = Hclose(fid);
+    CHECK(ret, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return(num_errs);
+} /* end test_mgr_compress_b() */
+
+/* Create/Write/Read 24-bit JPEG compressed image */
+static int test_mgr_compress_c()
+{
+    intn  status;         /* status for functions returning an intn */
+    int32 file_id,        /* HDF file identifier */
+          gr_id,          /* GR interface identifier */
+          ri_id,          /* raster image identifier */
+          start[2],       /* start position to write for each dimension */
+          edges[2],       /* number of elements to be written along each dimension */
+          dim_sizes[2],   /* dimension sizes of the image array */
+          interlace_mode, /* interlace mode of the image */
+          data_type,      /* data type of the image data */
+          i, j;
+    uint8 image_buf[128][128][3];
+    uint8 read_buf[128][128][3];
+    comp_info  c_info;
+    char gname[60];
+    int32 n_comps, dt, im, dims[2], na;
+    int   num_errs = 0;    /* number of errors so far */
+ 
+    MESSAGE(8, printf("Operate on 24-bit JPEG compressed images\n"););
+
+    /* Create and open the file and initialize GR interface */
+    file_id = Hopen(JPEGFILE, DFACC_CREATE, 0);
+    CHECK(file_id, FAIL, "Hopen");
+
+    gr_id = GRstart(file_id);
+    CHECK(gr_id, FAIL, "GRstart");
+ 
+    /* Set data type, interlace mode, and dimensions of image */
+    data_type = DFNT_UINT8;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_sizes[0] = 128;
+    dim_sizes[1] = 128;
+ 
+    /* Create the raster image array */
+    ri_id = GRcreate(gr_id, "24-bit JPEG", 3, data_type, interlace_mode, dim_sizes);
+    CHECK(ri_id, FAIL, "GRcreate");
+ 
+    /* Set JPEG compression */
+    c_info.jpeg.quality=75;
+    c_info.jpeg.force_baseline=1;
+    status = GRsetcompress(ri_id, COMP_CODE_JPEG, &c_info);
+    CHECK(status, FAIL, "GRsetcompress");
+ 
+    /* Fill the image data buffer with values */
+    for (i = 0; i < 128; i++)
+       for (j = 0; j < 128; j++)
+       {
+          image_buf[i][j][0] = (i+j) + 1;    
+          image_buf[i][j][1] = (i+j) + 1;    
+          image_buf[i][j][2] = (i+j) + 1;    
+       }
+ 
+    /* Write data in the buffer into the image array */
+    start[0] = start[1] = 0;
+    edges[0] = 128;
+    edges[1] = 128;
+    status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)image_buf);
+    CHECK(status, FAIL, "GRwriteimage");
+ 
+    /* Terminate access to raster image and to GR interface */
+    status = GRendaccess(ri_id);
+    CHECK(status, FAIL, "GRendaccess");
+
+    status = GRend(gr_id);
+    CHECK(status, FAIL, "GRend");
+ 
+    /* Start access to the GR interface and get access to the first RI */
+    gr_id = GRstart(file_id);
+    CHECK(gr_id, FAIL, "GRstart");
+ 
+    ri_id = GRselect(gr_id, 0);
+    CHECK(ri_id, FAIL, "GRselect");
+ 
+    /* Get and verify information about this image */
+    status = GRgetiminfo(ri_id, gname, &n_comps, &dt, &im, dims, &na);
+    CHECK(status, FAIL, "GRreadimage");
+    VERIFY(n_comps, 3, "GRgetiminfo");
+    VERIFY(dt, DFNT_UINT8, "GRgetiminfo");
+    VERIFY(dim_sizes[0], dims[0], "GRgetiminfo");
+    VERIFY(dim_sizes[1], dims[1], "GRgetiminfo");
+    VERIFY(na, 0, "GRgetiminfo");
+ 
+    /* Read back data */
+    start[0] = start[1] = 0;
+    edges[0] = 128;
+    edges[1] = 128;
+    status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)read_buf);
+    CHECK(status, FAIL, "GRreadimage");
+ 
+    /* Verify correct image contents */
+    if(fuzzy_memcmp(image_buf, read_buf, 128*128*3, JPEG_FUZZ)!=0) {
+        MESSAGE(3, printf("tmgrcomp: Error reading data for 24-bit JPEG compressed image\n"););
+        num_errs++;
+    } /* end if */
+
+    /* Terminate access to raster image and to GR */
+    /* interface and, close the HDF file.         */
+    status = GRendaccess(ri_id);
+    CHECK(status, FAIL, "GRendaccess");
+
+    status = GRend(gr_id);
+    CHECK(status, FAIL, "GRend");
+
+    status = Hclose(file_id);
+    CHECK(status, FAIL, "Hclose");
+ 
+    /* Return the number of errors that's been kept track of so far */
+    return(num_errs);
+} /* end test_mgr_compress_c() */
+
+/*--------------------------------------------------------------------------
+    The following 2 routines are added when bug# 307 was fixed:
+
+    - test_get_compress: tests the new functionality, getting compression
+                information of compressed image data.  The test
+        + creates a file and four compressed images written to the file, 
+          then closes the file.
+        + re-opens the file, then reads and verifies each image's
+          compression information
+        The four images are created using the following compression
+        methods in that order: RLE, Skipping Huffman, Deflate, and JPEG.
+        For simplicity, all four images use the same data sample.
+
+    - make_comp_image: is a helper that test_get_compress uses to create
+                several compressed images.
+
+ -BMR (Sept 7, 01)
+--------------------------------------------------------------------------*/
+
+#define	COMPFILE	"gr_comp.hdf"
+#define	RLE_IMAGE	"Image with RLE Compression"
+#define	DEFLATE_IMAGE	"Image with Deflate Compression"
+#define	SKPHUFF_IMAGE	"Image with Skphuff Compression"
+#define	JPEG_IMAGE	"Image with JPEG Compression"
+#define	DEFLATE_LEVEL		7  /* arbitrary */
+#define	SKPHUFF_SKIPSIZE	28  /* arbitrary */
+
+static intn make_comp_image( 
+		int32 grid, 
+		char* img_name, 
+		comp_coder_t comp_type,    /* Compression method */
+		comp_info* cinfo, 
+		char* message)    /* Compression parameters */
+{
+    int32 riid;         /* RI ID of the working image */
+    int32 dims[2]={10, 10};	/* dimensions for the empty image */
+    uint8 image_data[10][10];	/* space for the image data */
+    int32 start[2];		/* start of image data to grab */
+    int32 stride[2];	/* stride of image data to grab */
+    intn i, j;		/* indices */
+    intn ret_value;        /* generic return value */
+
+    /* Initialize data we are going to write out */
+    for (i = 0; i < 10; i++)
+        for (j = 0; j < 10; j++)
+            image_data[i][j] = (uint8) (i + j + 10);
+
+    /* Create the image */
+    riid = GRcreate(grid, img_name, 1, DFNT_UINT8, MFGR_INTERLACE_PIXEL, dims);
+    if (riid == FAIL)
+    {
+	strcpy(message, "make_comp_image::GRcreate");
+	return FAIL;
+    }
+
+    /* Set the compression as provided */
+    ret_value = GRsetcompress(riid, comp_type, cinfo);
+    if (ret_value == FAIL)
+    {
+	strcpy(message, "make_comp_image::GRsetcompress");
+	return FAIL;
+    }
+
+    /* Write the image out */
+    start[0] = start[1] = 0;
+    stride[0] = stride[1] = 1;
+    ret_value = GRwriteimage(riid, start, stride, dims, image_data);
+    if (ret_value == FAIL)
+    {
+	strcpy(message, "make_comp_image::GRwriteimage");
+	return FAIL;
+    }
+
+    /* Close the image */
+    ret_value = GRendaccess(riid);
+    if (ret_value == FAIL)
+    {
+	strcpy(message, "make_comp_image::GRendaccess");
+	return FAIL;
+    }
+
+    return SUCCEED;
+}
+
+static int test_get_compress()
+{
+    int32 fid;          /* HDF file ID */
+    int32 grid;         /* GRID for the interface */
+    int32 riid;     	/* RI ID of the working image */
+    comp_coder_t comp_type;    /* Compression method */
+    comp_info cinfo;    /* Compression parameters - union */
+    char  err_func[80];	/* name of the functions where failure occurs */
+    intn  status;       /* generic return value */
+    int   num_errs = 0; /* number of errors so far */
+
+/* D - Retrieve compression information of compressed images */
+    MESSAGE(8, printf("Verify the compression information of compressed images\n"););
+
+    /*
+     * Create a new file and several images with different compression
+     * schemes then close the images and the file
+     */
+
+    /* Create an hdf file, and initiate the GR interface */
+    fid = Hopen(COMPFILE, DFACC_CREATE, (int16)0);
+    CHECK(fid, FAIL, "Hopen");
+
+    grid = GRstart(fid);
+    CHECK(grid, FAIL, "GRstart");
+
+    /* Create and write 4 images, with RLE, deflate, skipping huffman, 
+       and JPEG compression methods. */
+
+    /* No compression info for the RLE image */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+
+    /* Create and write the first compressed image in this file */
+    status = make_comp_image(grid, RLE_IMAGE, COMP_CODE_RLE, &cinfo, err_func);
+    CHECK(status, FAIL, err_func);
+
+    /* Set the compression info for the second image with skipping 
+       huffman method */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    cinfo.skphuff.skp_size = SKPHUFF_SKIPSIZE;
+
+    /* Create and write the second compressed image in this file */
+    status = make_comp_image(grid, SKPHUFF_IMAGE, COMP_CODE_SKPHUFF, &cinfo, err_func);
+    CHECK(status, FAIL, err_func);
+
+    /* Set the compression info for the third image with deflate method */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    cinfo.deflate.level = DEFLATE_LEVEL;
+
+    /* Create and write the third compressed image in this file */
+    status = make_comp_image(grid, DEFLATE_IMAGE, COMP_CODE_DEFLATE, &cinfo, err_func);
+    CHECK(status, FAIL, err_func);
+
+    /* Set the compression method for the fourth image */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    cinfo.jpeg.quality = 100;	/* won't be able to retrieved anyway */
+    cinfo.jpeg.force_baseline = 1;
+
+    /* Create and write the fourth compressed image in this file */
+    status = make_comp_image(grid, JPEG_IMAGE, COMP_CODE_JPEG, &cinfo, err_func);
+    CHECK(status, FAIL, err_func);
+
+    /* Terminate access to the GR interface and close the file */
+    status = GRend(grid);
+    CHECK(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /*
+     * Re-open the file COMPFILE, and retrieve the compression information
+     * of its two images 
+     */
+    fid = Hopen(COMPFILE, DFACC_READ, 0);
+    CHECK(fid, FAIL, "Hopen");
+
+    grid = GRstart(fid);
+    CHECK(grid, FAIL, "GRstart");
+
+    /* get access to the first image */
+    riid = GRselect(grid, 0);
+    CHECK(riid, FAIL, "GRselect");
+
+    /* First image uses RLE compression method, so no info will be
+       retrieved */
+    status = GRgetcompinfo(riid, &comp_type, &cinfo);
+    CHECK(status, FAIL, "GRgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_RLE, "GRgetcompinfo");
+
+    /* end access to the first image */
+    status = GRendaccess(riid);
+    CHECK(status, FAIL, "GRendaccess");
+
+    /* get the compression info of the second image, and then check 
+     * the values against the values set earlier, which are:
+     *		comp_type = COMP_CODE_SKPHUFF 
+     *		skp_size = SKPHUFF_SKIPSIZE
+     */
+
+    /* get access to the second image */
+    riid = GRselect(grid, 1);
+    CHECK(riid, FAIL, "GRselect");
+
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = GRgetcompinfo(riid, &comp_type, &cinfo);
+    CHECK(status, FAIL, "GRgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "GRgetcompinfo");
+    VERIFY(cinfo.skphuff.skp_size, SKPHUFF_SKIPSIZE, "GRgetcompinfo");
+
+    /* end access to the second image */
+    status = GRendaccess(riid);
+    CHECK(status, FAIL, "GRendaccess");
+
+    /* get the compression info of the third image, and then check 
+       the values against the values set earlier, which are:
+		comp_type = COMP_CODE_DEFLATE 
+		level = DEFLATE_LEVEL
+    */
+
+    /* get access to the third image */
+    riid = GRselect(grid, 2);
+    CHECK(riid, FAIL, "GRselect");
+
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = GRgetcompinfo(riid, &comp_type, &cinfo);
+    CHECK(status, FAIL, "GRgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_DEFLATE, "GRgetcompinfo");
+    VERIFY(cinfo.deflate.level, DEFLATE_LEVEL, "GRgetcompinfo");
+
+    /* Terminate access to the third image */
+    status = GRendaccess(riid);
+    CHECK(status, FAIL, "GRendaccess");
+
+    /* get access to the fourth image */
+    riid = GRselect(grid, 3);
+    CHECK(riid, FAIL, "GRselect");
+
+    /* get the compression info of the second image, but only check 
+       the compression type value against that being set earlier 
+       ('quality' and 'force_baseline' are currently not retrievable) */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = GRgetcompinfo(riid, &comp_type, &cinfo);
+    CHECK(status, FAIL, "GRgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_JPEG, "GRgetcompinfo");
+    VERIFY(cinfo.jpeg.quality, 0, "GRgetcompinfo");
+    VERIFY(cinfo.jpeg.force_baseline, 0, "GRgetcompinfo");
+
+    /* Terminate access to the third image */
+    status = GRendaccess(riid);
+    CHECK(status, FAIL, "GRendaccess");
+
+    /* Terminate access and close the file */
+    status = GRend(grid);
+    CHECK(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return(num_errs);
+} /* end test_get_compress */
+
+/*--------------------------------------------------------------------------
+    The test routine test_mgr_chunk_compress is added when bug# 307 was 
+    fixed.
+
+    test_mgr_chunk_compress tests the new functionality, getting 
+    compression information of compressed chunked image data.  It 
+        + creates the file CHKCOMPFILE and adds four compressed chunked 
+	  images to it, then closes the file.
+        + re-opens the file, then reads and verifies each chunked image's
+          compression information
+        The first image is only chunked and not compressed.
+        The last three chunked images are compressed using the following
+        methods in that order: RLE, Skipping Huffman, Deflate.
+        For simplicity, all four images use the same data sample.
+    Note: At this time JPEG is not working correctly for chunked images, 
+    but when it is, its tests should be added to this routines (and to 
+    test_mgr_chunkwr_pixelone as well) appropriately, i.e. another image 
+    should be added to the image list.
+
+ -BMR (Oct 7, 01)
+--------------------------------------------------------------------------*/
+
+static int test_mgr_chunk_compress()
+{
+#define  CHKCOMPFILE  "gr_chunkcomp.hdf"
+#define  X_LENGTH     10    /* number of columns in the image */
+#define  Y_LENGTH     6     /* number of rows in the image */
+#define  N_COMPS      3     /* number of components in the image */
+#define  N_IMAGES     4     /* number of images tested used - 5 comp. methods */
+
+   /************************* Variable declaration **************************/
+
+   intn  status;         /* status for functions returning an intn */
+   int32 file_id,        /* HDF file identifier */
+         gr_id,          /* GR interface identifier */
+         ri_id[N_IMAGES],       /* raster image identifier */
+         origin[2],      /* start position to write for each dimension */
+         dim_sizes[2],   /* dimension sizes of the image array */
+         interlace_mode, /* interlace mode of the image */
+         data_type,      /* data type of the image data */
+         comp_flag,      /* compression flag */
+         index, 
+         img_num;
+   int32 start[2], 
+         stride[2], 
+         edge[2];
+   comp_info cinfo;    /* Compression parameters - union */
+    int   num_errs = 0;    /* number of errors so far */
+
+   comp_coder_t comp_type;
+   int16 data_out[3*Y_LENGTH*X_LENGTH];
+   char *image_name[] = { "Image_NO", "Image_RL", "Image_Sk", "Image_DF"};
+   HDF_CHUNK_DEF chunk_def[N_IMAGES];
+   int16 chunk_buf[18];
+
+   int16 chunk00[] = {        110, 111, 112, 120, 121, 122, 
+                              130, 131, 132, 140, 141, 142, 
+                              150, 151, 152, 160, 161, 162 };
+ 
+   int16 chunk01[] = {    210, 211, 212, 220, 221, 222, 
+                          230, 231, 232, 240, 241, 242, 
+                          250, 251, 252, 260, 261, 262};
+ 
+   int16 chunk14[] = {    1010, 1011, 1012, 1020, 1021, 1022, 
+                          1030, 1031, 1032, 1040, 1041, 1042, 
+                          1050, 1051, 1052, 1060, 1061, 1062};
+
+   int16 data[]    = {
+                110, 111, 112, 120, 121, 122, 210, 211, 212, 220, 221, 222,
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+		130, 131, 132, 140, 141, 142, 230, 231, 232, 240, 241, 242,
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+		150, 151, 152, 160, 161, 162, 250, 251, 252, 260, 261, 262,
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+		 0, 0, 0, 0, 0, 0, 0, 0, 
+                1010, 1011, 1012, 1020, 1021, 1022, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1030, 1031, 1032, 1040, 1041, 
+                1042, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+                0, 1050, 1051, 1052, 1060, 1061, 1062 }; 
+
+
+   /********************** End of variable declaration **********************/
+
+/* E - Retrieve compression information of chunked compressed images */
+    MESSAGE(8, printf("Verify the compression information of compressed images\n"););
+
+   /* Create and open the file. */
+   file_id = Hopen(CHKCOMPFILE, DFACC_CREATE, 0);
+   CHECK(file_id, FAIL, "Hopen");
+
+   /* Initialize the GR interface. */
+   gr_id = GRstart(file_id);
+   CHECK(gr_id, FAIL, "GRstart");
+
+   /* Set the data type, interlace mode, and dimensions of the image. */
+   data_type = DFNT_INT16;
+   interlace_mode = MFGR_INTERLACE_PIXEL;
+   dim_sizes[0] = Y_LENGTH;
+   dim_sizes[1] = X_LENGTH;
+
+   for (img_num = 0; img_num < N_IMAGES; img_num++ ) {  
+
+   /* Create the raster image array. */
+   ri_id[img_num] = GRcreate(gr_id, image_name[img_num], N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+   CHECK(ri_id[img_num], FAIL, "GRcreate");
+
+   /* Create chunked image array. */
+   switch (img_num) {
+	case 0: 
+		comp_flag = HDF_CHUNK;
+		chunk_def[img_num].chunk_lengths[0] = 3;
+		chunk_def[img_num].chunk_lengths[1] = 2;
+		break;
+	case 1 :
+		comp_flag = HDF_CHUNK | HDF_COMP;
+		chunk_def[img_num].comp.chunk_lengths[0] = 3;
+		chunk_def[img_num].comp.chunk_lengths[1] = 2;
+		chunk_def[img_num].comp.comp_type = COMP_CODE_RLE;
+		break;
+	case 2 :
+		comp_flag = HDF_CHUNK | HDF_COMP;
+		chunk_def[img_num].comp.chunk_lengths[0] = 3;
+		chunk_def[img_num].comp.chunk_lengths[1] = 2;
+		chunk_def[img_num].comp.comp_type = COMP_CODE_SKPHUFF;
+		chunk_def[img_num].comp.cinfo.skphuff.skp_size = 2;
+		break;
+	case 3 :
+		comp_flag = HDF_CHUNK | HDF_COMP;
+		chunk_def[img_num].comp.chunk_lengths[0] = 3;
+		chunk_def[img_num].comp.chunk_lengths[1] = 2;
+		chunk_def[img_num].comp.comp_type = COMP_CODE_DEFLATE;
+		chunk_def[img_num].comp.cinfo.deflate.level = 6;
+		break;
+#ifdef NOT_WORKING
+	/* JPEG compression for chunked images is not working correctly 
+	   yet.  Add test here when it is */
+	case 4 :
+		comp_flag = HDF_CHUNK | HDF_COMP;
+		chunk_def[img_num].comp.chunk_lengths[0] = 3;
+		chunk_def[img_num].comp.chunk_lengths[1] = 2;
+		chunk_def[img_num].comp.comp_type = COMP_CODE_JPEG;
+		chunk_def[img_num].comp.cinfo.jpeg.quality = 5;
+		chunk_def[img_num].comp.cinfo.jpeg.force_baseline = 8;
+		break;
+#endif
+	default:
+		printf("Error\n");
+		break;
+
+   } /* end switch */
+    
+   status = GRsetchunk(ri_id[img_num], chunk_def[img_num], comp_flag);
+   CHECK(status, FAIL, "GRsetchunk");
+
+   /* Write first data chunk ( 0, 0 ). */
+   origin[0] = origin[1] = 0;
+   status = GRwritechunk(ri_id[img_num], origin, (VOIDP)chunk00);
+   CHECK(status, FAIL, "GRwritechunk");
+
+   /* Write second data chunk ( 0, 1 ). */
+   origin[0] = 0; origin[1] = 1;
+   status = GRwritechunk(ri_id[img_num], origin, (VOIDP)chunk01);
+   CHECK(status, FAIL, "GRwritechunk");
+
+   /* Write third data chunk ( 1, 4 ). */
+   origin[0] = 1; origin[1] = 4;
+   status = GRwritechunk(ri_id[img_num], origin, (VOIDP)chunk14);
+   CHECK(status, FAIL, "GRwritechunk");
+
+   /* Read third chunk back. */
+   origin[0] = 1; origin[1] = 4;
+   status = GRreadchunk(ri_id[img_num], origin, (VOIDP)chunk_buf);
+   CHECK(status, FAIL, "GRreadchunk");
+
+   /* Terminate access to the GR interface and close the HDF file. */
+   status = GRendaccess(ri_id[img_num]);
+   CHECK(status, FAIL, "GRendaccess");
+ }  /* end for */
+
+   status = GRend(gr_id);
+   CHECK(status, FAIL, "GRend");
+   status = Hclose(file_id);
+   CHECK(status, FAIL, "Hclose");
+
+    /* Open the file. */
+
+    file_id = Hopen(CHKCOMPFILE, DFACC_WRITE, 0); 
+    CHECK(file_id, FAIL, "Hopen");
+
+   /* Initialize the GR interface. */
+   gr_id = GRstart(file_id);
+   CHECK(gr_id, FAIL, "GRstart");
+
+   for (img_num = 0; img_num < N_IMAGES; img_num++ ) {  
+
+   /* Find the index of the specified image. */
+   index = GRnametoindex(gr_id, image_name[img_num]);
+   CHECK(index, FAIL, "GRnametoindex");
+   
+   /* Select the image. */
+   ri_id[img_num] = GRselect(gr_id, index);
+   CHECK(ri_id[img_num], FAIL, "GRselect");
+
+   /* Get and verify the image's compression information */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+
+    status = GRgetcompinfo(ri_id[img_num], &comp_type, &cinfo);
+    CHECK(status, FAIL, "GRgetcompinfo");
+    switch (img_num) {
+	case 0: 
+	    VERIFY(comp_type, COMP_CODE_NONE, "GRgetcompinfo");
+	    break;
+	case 1 :
+	    VERIFY(comp_type, COMP_CODE_RLE, "GRgetcompinfo");
+	    break;
+	case 2 :
+	    VERIFY(comp_type, COMP_CODE_SKPHUFF, "GRgetcompinfo");
+	    VERIFY(cinfo.skphuff.skp_size, 
+		   chunk_def[img_num].comp.cinfo.skphuff.skp_size, "GRgetcompinfo");
+	    break;
+	case 3 :
+	    VERIFY(comp_type, COMP_CODE_DEFLATE, "GRgetcompinfo");
+	    VERIFY(cinfo.deflate.level, 
+		   chunk_def[img_num].comp.cinfo.deflate.level, "GRgetcompinfo");
+	    break;
+#ifdef NOT_WORKING
+	/* JPEG is not working correctly yet.  Add test here when it is */
+	case 4 :  /* only return comp type for JPEG */
+	    VERIFY(comp_type, COMP_CODE_JPEG, "GRgetcompinfo");
+	    break;
+#endif
+	default:
+	    printf("Error\n");
+	    break;
+   } /* end switch */
+
+   /* Read third chunk back. */
+   origin[0] = 1; origin[1] = 4;
+   status = GRreadchunk(ri_id[img_num], origin, (VOIDP)chunk_buf);
+   CHECK(status, FAIL, "GRreadchunk");
+   if (0 != HDmemcmp(chunk_buf, chunk14 , sizeof(chunk14)))
+      {
+            MESSAGE(3, printf("Error in reading chunk at line %d\n", __LINE__););
+            MESSAGE(3, printf("Image #%d\n", (int)img_num););
+            num_errs++;
+      } /* end if */
+
+   /* Read the whole image. */
+   start[0] = start[1] = 0;
+   stride[0] = stride[1] = 1;
+   edge[0] = Y_LENGTH;
+   edge[1] = X_LENGTH;
+   status = GRreadimage(ri_id[img_num], start, stride, edge, (VOIDP)data_out);
+   CHECK(status, FAIL, "GRreadimage");
+   if (0!= HDmemcmp(data_out, data, sizeof(data)))
+      {
+            MESSAGE(3, printf("%d: Error reading data for the whole image\n", __LINE__););
+            MESSAGE(3, printf("%d: Compression method\n", (int)img_num););
+            num_errs++;
+      } /* end if */
+
+   status = GRendaccess(ri_id[img_num]);
+   CHECK(status, FAIL, "GRendaccess");
+
+   } /* end for */    
+
+   /* Terminate access to the GR interface and close the HDF file. */
+   status = GRend(gr_id);
+   CHECK(status, FAIL, "GRend");
+   status = Hclose(file_id);
+   CHECK(status, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return(num_errs);
+}  /* end of test_mgr_chunk_compress */
+
+
+/****************************************************************
+**
+**  test_mgr_compress(): Multi-file Raster Compression tests
+** 
+**  IX. Compressed image tests
+**      A. Create/Read/Write gzip compressed Image
+**      B. Create/Read/Write 8-bit JPEG compressed Image
+**      C. Create/Read/Write 24-bit JPEG compressed Image
+**      D. Retrieve various compression information of compressed Image
+**	E. Retrieve various compression info. of compressed, chunked images
+** 
+****************************************************************/
+extern void test_mgr_compress()
+{
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    MESSAGE(5, printf("Testing Multi-file Raster Compression Functions\n"););
+
+    /* Test compression functions on GZIP compressed image */
+    num_errs = num_errs + test_mgr_compress_a();
+
+    /* Test compression functions on 8-bit JPEG compressed image */
+    num_errs = num_errs + test_mgr_compress_b();
+
+    /* Test compression functions on 24-bit JPEG compressed image */
+    num_errs = num_errs + test_mgr_compress_c();
+
+    /* Test retrieving various compression information of compressed image */
+    num_errs = num_errs + test_get_compress();
+
+    /* Test retrieving various compression information of chunked and
+       compressed image */
+    num_errs = num_errs + test_mgr_chunk_compress();
+
+    if (num_errs != 0) { H4_FAILED(); }
+}   /* end test_mgr_compress() */
diff --git a/hdf/test/tpf.f b/hdf/test/tpf.f
new file mode 100644
index 0000000..446de39
--- /dev/null
+++ b/hdf/test/tpf.f
@@ -0,0 +1,232 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tpf.f 6034 2014-01-19 06:59:14Z epourmal $
+C
+      subroutine tpf (number_failed)
+C      program tpff 
+      implicit none
+      include 'fortest.inc'
+C
+C
+C Test program: Writes palettes in a file.
+C               Reads palettes from the file.
+C               Writes palette with specified reference number.
+C               Reads palette with specified reference number.
+C
+C Input file: none
+C
+C Output file: tpalf.hdf
+C
+C
+
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'p')
+
+      integer dpppal, dpapal, dprest, dpgpal, dpnpals
+      integer dprref, dpwref
+      integer dplref
+
+      character*64 TESTFILE
+      character*1 CR
+      character pal1(768), pal2(768), ipal(768)
+      integer ret, ref 
+      integer ref1, ref2, newref1, newref2
+      integer i
+
+
+      call ptestban('Testing', myname)
+      TESTFILE = 'tpalf.hdf'
+      CR = char(10)
+      number_failed = 0
+      ref = 0
+C
+C Initialize pal1 as {1, 2, 3, 4, 5, ...}
+C Initialize pal2 as {1, 1, 1, 2, 2, 2, ...}
+      do 100 i = 0, 255
+          pal1(3*i + 1) = char(i)
+          pal1(3*i + 2) = char(i) 
+          pal1(3*i + 3) = char(i)
+          pal2(i + 1) = char(i) 
+          pal2(i + 256 + 1) = char(i) 
+          pal2(i + 512 + 1) = char(i) 
+100   continue
+
+C
+C Write out pal1, then pal2.
+C Keep their ref number in ref1 and ref2.
+      call MESSAGE(VERBO_HI, 'Putting pal1 in new file.')
+      ret = dpppal(TESTFILE, pal1, 0, 'w')
+      call VRFY(ret, 'dpppal', number_failed)
+
+      call MESSAGE(VERBO_HI, 'Getting ref1')
+      ref1 = dplref()
+      ref = ref1*1
+      call VRFY(ref, 'dplref', number_failed)
+C VRFY expects an integer, but ref1 is only integer*2.  The
+C expression promotes it to an integer expression.
+
+      call MESSAGE(VERBO_HI, 'Putting pal2 in file')
+      ret = dpapal(TESTFILE, pal2)
+      call VRFY(ret, 'dpapal', number_failed)
+
+      call MESSAGE(VERBO_HI, 'Getting ref2')
+      ref2 = dplref()
+      ref = ref2*1
+      call VRFY(ref, 'dplref', number_failed)
+     
+C
+C Reset the palettes for reading
+      call MESSAGE(VERBO_HI, 'Restarting palette interface')
+      ret = dprest()
+      call VRFY(ret, 'dprest', number_failed)
+
+C
+C Get palette 1 and match it with pal1
+      call MESSAGE(VERBO_HI, 'Reading pal1')
+      ret = dpgpal(TESTFILE, ipal)
+      call VRFY(ret, 'dpgpal', number_failed)
+      do 200 i=1, 768
+          if (ipal(i) .ne. pal1(i))  then
+              print *, 'Error at ', i, ', ipal:', ipal(i), 
+     *                 '      pal1(i):', pal1(i)
+          endif
+200   continue
+      
+C
+C verify the ref number is updated correctly too
+      call MESSAGE(VERBO_HI, 'Getting newref1')
+      newref1 =  dplref()
+      if (newref1 .ne. ref1) then
+	print *, 'Error: newref1 is ', newref1, ', should be ', ref1
+	number_failed = number_failed + 1
+      endif
+
+C
+C Get palette 2 and match it with pal2
+      call MESSAGE(VERBO_HI, 'Reading pal2.')
+      ret = dpgpal(TESTFILE, ipal)
+      call VRFY(ret, 'dpgpal', number_failed)
+      do 300 i=1, 768
+          if (ipal(i) .ne. pal2(i)) then
+              print *, 'Error at ', i, ', ipal:', ipal(i),
+     *                 '      pal2:', pal2(i)
+          endif
+300   continue
+
+C
+C Again verify the ref number
+      call MESSAGE(VERBO_HI, 'Getting ref2')
+      newref2 =  dplref()
+      if (newref2 .ne. ref2) then
+	print *, 'Error: newref2 is ', newref2, ', should be ', ref2
+	number_failed = number_failed + 1
+      endif
+
+C
+C Check number of palettes
+      call MESSAGE(VERBO_HI, 'Getting number of palettes')
+      ret = dpnpals(TESTFILE)
+      if (ret .ne. 2) then
+	print *, 'Error: number of palette is ', ret, ', should be 2'
+	number_failed = number_failed + 1
+      endif
+
+C
+C Explicitly set to palette of ref2 for reading
+      call MESSAGE(VERBO_HI, 'Setting read ref to ref2.')
+      ret = dprref(TESTFILE, ref2)
+      call VRFY(ret, 'dprref', number_failed)
+      
+      call MESSAGE(VERBO_HI, 'Reading pal2')
+      ret = dpgpal(TESTFILE, ipal)
+      call VRFY(ret, 'dpgpal', number_failed)
+
+      newref2 =  dplref()
+      if (newref2 .ne. ref2) then
+         print *, 'Error: newref2 is ', newref2, ', should be ', ref2
+         number_failed = number_failed + 1
+      endif
+
+C
+C match it with pal2
+      do 400 i=1, 768
+          if (ipal(i) .ne. pal2(i)) then
+              print *,  'Error at ', i, ', ipal:', ipal(i),
+     *                 '      pal2:', pal2(i)
+          endif
+400   continue
+
+C
+C Explicitly set to palette of ref1 for reading
+      call MESSAGE(VERBO_HI, 'Setting read ref to ref1.')
+      ret = dprref(TESTFILE, ref1)
+      call VRFY(ret, 'dprref', number_failed)
+
+      call MESSAGE(VERBO_HI, 'Reading pal1')
+      ret = dpgpal(TESTFILE, ipal)
+      call VRFY(ret, 'dpgpal', number_failed)
+
+      newref1 =  dplref()
+      if (newref1 .ne. ref1) then
+          print *, 'Error: newref1 is ', newref1, ', should be ', ref1
+          number_failed = number_failed + 1
+      endif
+      
+C
+C match it with pal1
+      do 500 i=1, 768
+          if (ipal(i) .ne. pal1(i)) then
+              print *,  'Error at ', i, ', ipal:', ipal(i),
+     *                 '      pal1:', pal1(i)
+          endif
+500   continue
+
+C
+C Modify the middle chunk of pal1 and replace its file copy.
+      call MESSAGE(VERBO_HI, 'Modifying pal1')
+      do 600 i=1,256
+          pal1(i+256) = char(256-i)
+600   continue
+
+      call MESSAGE(VERBO_HI, 'Setting write ref to ref1')
+      ret = dpwref(TESTFILE, ref1)
+      call VRFY(ret, 'dpwref', number_failed)
+      call MESSAGE(VERBO_HI, 'Writing pal1')
+      ret = dpppal(TESTFILE, pal1, 1, 'a')
+      call VRFY(ret, 'dpppal', number_failed)
+      ret=dplref()
+C     print *,'last ref is: ', ret
+      call MESSAGE(VERBO_HI, 'setting read ref to ref1')
+      ret = dprref(TESTFILE, ref1)
+      call VRFY(ret, 'dprref', number_failed)
+      call MESSAGE(VERBO_HI, 'Reading pal1')
+      ret = dpgpal(TESTFILE, ipal)
+      call VRFY(ret, 'dpgpal', number_failed)
+      do 700 i=1, 768
+          if (ipal(i) .ne. pal1(i)) then
+              print *,  'Error at ', i, ', ipal:', ipal(i),
+     *                 '      pal1:', pal1(i)
+          endif
+700   continue
+
+      if (number_failed .eq. 0) then 
+          call MESSAGE(VERBO_DEF + 1,
+     +                '****** ALL TESTS SUCCESSFUL ******')
+      else
+          print *, '****** ', number_failed, ' TESTS FAILES  ******'
+      endif
+
+      return
+      end
diff --git a/hdf/test/tproto.h b/hdf/test/tproto.h
new file mode 100644
index 0000000..f711c04
--- /dev/null
+++ b/hdf/test/tproto.h
@@ -0,0 +1,60 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: tproto.h 5692 2011-09-19 16:05:25Z bmribler $ */
+
+#ifndef _TPROTO_H
+#define _TPROTO_H
+
+#include "hdf.h"
+#include "tutils.h"
+
+void        test_an(void);
+void        test_an_2(void);
+void        test_anfile(void);
+void        test_man(void);
+void        test_hblocks(void);
+void        test_hextelt(void);
+void        test_hfile(void);
+void        test_hfile1(void);
+void        test_r24(void);
+void        test_GR(void);
+void        test_r8(void);
+void        test_pal(void);
+void        test_sdmms(void);
+void        test_sdnmms(void);
+void        test_tsdstr(void);
+void        test_vers(void);
+void        test_slab(void);
+void        test_litend(void);
+void        test_vsets(void);
+void        test_vnameclass(void);
+void        test_vset_attr(void);
+void        test_vspack(void);
+void        test_comp(void);
+void        test_bitio(void);
+void        test_tbbt(void);
+void        test_macros(void);
+void        test_conv(void);
+void        test_nbit(void);
+void        test_mgr(void);
+void        test_mgr_attr(void);
+void        test_mgr_compress(void);
+void        test_bitvect(void);
+void        test_chunks(void);
+void        test_buffer(void);
+void        test_datainfo(void);
+void        test_datainfo(void);
+void        test_attdatainfo(void);
+
+#endif /* _TPROTO_H */
diff --git a/hdf/test/tr8f.f b/hdf/test/tr8f.f
new file mode 100644
index 0000000..3af565d
--- /dev/null
+++ b/hdf/test/tr8f.f
@@ -0,0 +1,275 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tr8f.f 6034 2014-01-19 06:59:14Z epourmal $
+C
+      subroutine tr8f (number_failed)
+      implicit none
+      include 'fortest.inc'
+C
+C Test program:
+C      Writes images together with pals to a file.
+C      Reads images from the file.
+C      Writes and reads images with speicfied ref's.
+C Input file: none
+C Output file: tdfr8f.hdf
+C
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'r8')
+
+      integer d8spal, d8pimg, d8aimg, d8gdims, d8nims
+      integer d8gimg, d8rref, d8wref, d8first, d8lref
+      integer DFTAG_RLE, DFTAG_IMCOMP
+
+      character im1(100,100), im2(321, 111)
+      character ii1(100, 100), ii2(321, 111)
+      character pal1(768), pal2(768), ipal(768)
+      character*64 TESTFILE
+      character*1 CR
+
+      integer x, y, ret, num_images
+      integer d1, d2, ispal
+      integer ref1, ref2, ref3
+
+      call ptestban('Testing', myname)
+      DFTAG_RLE = 11
+      DFTAG_IMCOMP = 12
+      TESTFILE = 'tdfr8f.hdf' 
+      number_failed = 0
+      num_images = 0
+      CR = char(10)  
+
+      do 120 x=1, 100
+          do 100 y=1, 100
+              im1(y,x) = char(x+y)
+100       continue
+120   continue
+
+      do 180 x=1, 111
+          do 150 y=1, 321
+              im2(y,x) = char(y-x)
+150       continue
+180   continue
+
+      do 200 x=1, 256
+          pal1(3*x - 2) = char(x)
+          pal1(3*x - 1) = char(x)
+          pal1(3*x ) = char(x)
+          pal2(x) = char(x)
+          pal2(x+256) = char(x)
+          pal2(x+512) = char(x)
+200   continue
+
+C Start here
+
+      call MESSAGE(VERBO_HI, 'Setting palette 1')
+      ret = d8spal(pal1)
+      call VRFY(ret, 'd8spal',number_failed)
+      call MESSAGE(VERBO_HI,
+     +     'Putting image 1 with pal 1, no compression')
+      ret=d8pimg(TESTFILE, im1, 100, 100, 0)
+      call VRFY(ret, 'd8pimg',number_failed)
+      num_images = num_images + 1
+      call MESSAGE(VERBO_HI, 'Getting ref1')
+      ref1 = d8lref()
+      
+      call MESSAGE(VERBO_HI,
+     +     'Putting image 2 with pal 1, REL compression')
+      ret=d8aimg(TESTFILE, im2, 321, 111, DFTAG_RLE)
+      call VRFY(ret, 'd8aimg',number_failed)
+      num_images = num_images + 1
+      call MESSAGE(VERBO_HI, 'Getting ref2')
+      ref2 = d8lref()
+      
+      call MESSAGE(VERBO_HI, 'Setting palette 2')
+      ret = d8spal(pal2)
+      call VRFY(ret, 'd8spal',number_failed)
+      call MESSAGE(VERBO_HI,
+     +    'Putting image 2 with pal 2, IMCOMP  compression')
+      ret=d8aimg(TESTFILE, im2, 321, 111, DFTAG_IMCOMP)
+      call VRFY(ret, 'd8aimg',number_failed)
+      num_images = num_images + 1
+      call MESSAGE(VERBO_HI, 'Getting ref3')
+      ref3 = d8lref()
+      
+      call MESSAGE(VERBO_HI, 'Getting number of images')
+      ret = d8nims(TESTFILE)
+      if (ret .ne. num_images) then 
+          print *, '    >>>> WRONG NUMBER OF IMAGES  <<<   '
+      else 
+	  if (Verbosity .ge. VERBO_HI) then
+	      print *, ret, ' images in the file'
+	  endif
+      endif
+      call MESSAGE(VERBO_HI, 'Restarting file')
+      ret = d8first()
+      call VRFY(ret, 'd8first',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting dimensions of first image')
+      ret=d8gdims(TESTFILE, d1, d2, ispal)
+      call VRFY(ret, 'd8gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image 1')
+      ret=d8gimg(TESTFILE, ii1, 100, 100, ipal)
+      call VRFY(ret, 'd8gimg',number_failed)
+      call check_im1_pal(100, 100, d1, d2, im1, ii1, pal1, ipal)
+      call MESSAGE(VERBO_HI, 'Getting dimensions of image2')
+      ret=d8gdims(TESTFILE, d1, d2, ispal)
+      call VRFY(ret, 'd8gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting dimensions of image 3')
+      ret=d8gdims(TESTFILE, d1, d2, ispal)
+      call VRFY(ret, ' d8gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image 3')
+      ret = d8gimg(TESTFILE, ii2, 321, 111, ipal)
+      call VRFY(ret, 'd8gimg',number_failed)
+
+      call MESSAGE(VERBO_HI, 'setting read ref2')
+      ret = d8rref(TESTFILE, ref2)
+      call VRFY(ret, 'd8rref',number_failed)
+
+      call MESSAGE(VERBO_HI, 'Getting image 2')
+      ret = d8gimg(TESTFILE, ii2, 321, 111,ipal)
+      call VRFY(ret, 'd8gimg',number_failed)
+      call check_im2_pal(321,111,321, 111, im2, ii2, pal1, ipal)
+      call MESSAGE(VERBO_HI,'Setting write ref1')
+      ret = d8wref(TESTFILE, ref1)
+      call VRFY(ret, 'd8wref',number_failed)
+      call MESSAGE(VERBO_HI, 'Setting palette 2')
+      ret = d8spal(pal2)
+      call VRFY(ret, 'd8spal',number_failed)
+      call MESSAGE(VERBO_HI,'Putting image 1 with pal 2, RLE')
+      ret = d8aimg(TESTFILE, im1, 100, 100, DFTAG_RLE)
+      call VRFY(ret, 'd8aimg',number_failed)
+      call MESSAGE(VERBO_HI, 'Setting read ref1')
+      ret = d8rref(TESTFILE, ref1)
+      call VRFY(ret, 'd8rref',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting dimensions of first image')
+      ret = d8gdims(TESTFILE, d1, d2, ispal)
+      call VRFY(ret, 'd8gdims',number_failed)
+      call MESSAGE(VERBO_HI, 'Getting image 1')
+      ret = d8gimg(TESTFILE, ii1, d1, d2, ipal)
+      call VRFY(ret, 'd8gimg',number_failed)
+      call check_im1_pal(100, 100, d1, d2, im1, ii1, pal2, ipal)
+
+      if (number_failed .eq. 0) then
+          call MESSAGE(VERBO_HI, '****** ALL TESTS SUCCESSFUL *******')
+      else 
+          print *, '****' , number_failed, ' TESTS FAILED ****'
+      endif
+
+      return
+      end
+
+C********************************************************
+C
+C check_im1_pal
+C 
+C********************************************************
+
+      subroutine check_im1_pal(od1,od2,nd1,nd2,oim,nim,opal,npal)
+      implicit none
+      include 'fortest.inc'
+
+      integer od1, od2, nd1, nd2
+      character oim(100, 100), nim(100, 100)
+      character opal(768), npal(768)
+
+
+      integer prob, i, j
+      
+      prob = 0 
+      call MESSAGE(VERBO_HI, 'Checking image and palette')
+
+      if (od1 .ne. nd1 .OR. od2 .ne. nd2) then
+          print *, '    >>> DIMENSIONS WRONG <<<    '
+          prob = 1
+      endif
+      do 520 j=1, 100
+          do 500 i=1,100
+              if (oim(i,j) .ne. nim(i,j)) then
+                print *, '     ERROR at ', i, j,' old image: ',
+     *                    oim(i,j), ' new image: ', nim(i,j)
+                  prob = 1
+              endif
+500       continue
+520   continue
+       
+      if (prob .eq. 0) then
+          call MESSAGE(VERBO_HI, 'Image is correct')
+      endif
+
+      prob = 0
+      do 550 i=1,768
+          if (opal(i) .ne. npal(i)) then
+              print *, '    ERROR at ',i, 'old pal: ', opal(i),
+     *                  ' new pal: ', npal(i)
+          prob = 1
+      endif
+550   continue
+      if (prob .eq. 0) then
+          call MESSAGE(VERBO_HI, 'Palette is correct')
+      endif
+      return
+      end
+
+    
+C********************************************************
+C
+C check_im2_pal
+C 
+C********************************************************
+
+      subroutine check_im2_pal(od1,od2,nd1,nd2,oim,nim,opal,npal)
+      implicit none
+      include 'fortest.inc'
+
+      integer od1, od2, nd1, nd2
+      character oim(321, 111), nim(321, 111)
+      character opal(768), npal(768)
+
+
+      integer prob, i, j
+      
+      prob = 0
+      call MESSAGE(VERBO_HI, 'Checking image and palette')
+
+      if (od1 .ne. nd1 .OR. od2 .ne. nd2) then
+          print *, '    >>> DIMENSIONS WRONG <<<    '
+          prob = 1
+      endif
+      do 520 j=1, 111
+          do 500 i=1,321
+              if (oim(i,j) .ne. nim(i,j)) then
+                  print *, '     ERROR at ', i, j,' old image: ',
+     *                    oim(i,j), ' new image: ', nim(i,j)
+                  prob = 1
+              endif
+500       continue
+520   continue
+       
+      if (prob .eq. 0) then
+          call MESSAGE(VERBO_HI, 'Image is correct')
+      endif
+
+      prob = 0
+      do 550 i=1,768
+          if (opal(i) .ne. npal(i)) then
+              print *, '    ERROR at ',i, 'old pal: ', opal(i),
+     *                  ' new pal: ', npal(i)
+          prob = 1
+      endif
+550   continue
+      if (prob .eq. 0) then
+          call MESSAGE(VERBO_HI, 'Palette is correct')
+      endif
+      return
+      end
diff --git a/hdf/test/tree.c b/hdf/test/tree.c
new file mode 100644
index 0000000..8424879
--- /dev/null
+++ b/hdf/test/tree.c
@@ -0,0 +1,151 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: tree.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+   FILE
+   tree.c
+   Test HDF Threaded-Balanced-Binary Tree (tbbt) routines.
+
+   REMARKS
+
+   DESIGN
+
+   BUGS/LIMITATIONS
+
+   EXPORTED ROUTINES
+
+   AUTHOR
+   Quincey Koziol
+
+   MODIFICATION HISTORY
+   10/21/93 - Started coding.
+ */
+
+#include <time.h>
+#include "tproto.h"
+#include "tbbt.h"
+
+#define MAX_TEST_SIZE 31    /* maximum number of elements to insert */
+#define NUM_TEST_RUNS 100   /* number of times to insert & remove each size */
+
+#define SEED(s)      (srand(s))
+#define RandInt(a,b) ((rand()%(((b)-(a))+1))+(a))
+
+PRIVATE VOID swap_arr
+            (int32 *arr, intn a, intn b);
+
+intn tcompare
+            (VOIDP k1, VOIDP k2, intn cmparg);
+
+PRIVATE     VOID
+swap_arr(int32 *arr, intn a, intn b)
+{
+    int32       t;
+
+    if (a != b)
+      {
+          t = arr[a];
+          arr[a] = arr[b];
+          arr[b] = t;
+      }     /* end if */
+}   /* end swap_arr() */
+
+intn
+tcompare(VOIDP k1, VOIDP k2, intn cmparg)
+{
+    /* shut compiler up */
+    cmparg=cmparg;
+    return ((intn) ((*(int32 *) k1) - (*(int32 *) k2)));
+}
+
+void
+test_tbbt(void)
+{
+    intn        test_size;
+    intn        i, j;
+    int32       ins_arr[MAX_TEST_SIZE];
+    int32       rem_arr[MAX_TEST_SIZE];
+    intn        t;
+    TBBT_TREE  *tree;
+    VOIDP      *r;
+
+    t = (intn)time(NULL);
+    SEED((uintn)t);
+
+    for (test_size = 3; test_size <= MAX_TEST_SIZE; test_size++)
+      {
+          MESSAGE(7, printf("\nTesting trees with %d elements\n", test_size);
+              );
+          MESSAGE(8, printf("Testing tree #:");
+              );
+          for (j = 0; j < NUM_TEST_RUNS; j++)
+            {
+                MESSAGE(8, printf(" %d", j);
+                    );
+                for (i = 0; i < test_size; i++)
+                  {     /* initialize the arrays */
+                      ins_arr[i] = i;
+                      rem_arr[i] = i;
+                  }     /* end for */
+                for (i = 0; i < test_size; i++)
+                  {     /* shuffle the arrays */
+                      t = RandInt(i, test_size - 1);
+                      swap_arr(ins_arr, i, t);
+                      t = RandInt(i, test_size - 1);
+                      swap_arr(rem_arr, i, t);
+                  }     /* end for */
+
+                if (Verbosity > 9)
+                  {
+                      printf("ins_arr: \n");
+                      for (i = 0; i < test_size; i++)   /* print the arrays */
+                          printf("%d \n", (int) ins_arr[i]);
+                      printf("\nrem_arr: \n");
+                      for (i = 0; i < test_size; i++)   /* print the arrays */
+                          printf("%d \n", (int) rem_arr[i]);
+                      printf("\n");
+                  }     /* end if */
+
+                tree = tbbtdmake(tcompare, sizeof(int32),0);
+                for (i = 0; i < test_size; i++)
+                  {
+                      MESSAGE(9, printf("inserting %d\n", (int) ins_arr[i]);
+                          );
+                      tbbtdins(tree, (VOIDP) &ins_arr[i], NULL);
+                      MESSAGE(9, tbbtdump(tree, -1);
+                          );
+                  }
+                MESSAGE(9, tbbtdump(tree, -1);
+                    );
+                for (i = 0; i < test_size; i++)
+                  {
+                      int32       key;
+
+                      key = rem_arr[i];
+                      r = (VOIDP *) tbbtdfind(tree, (VOIDP) &key, NULL);
+                      MESSAGE(9, printf("removing %d\n", (int) key);
+                          );
+                      tbbtrem((TBBT_NODE **) tree, (TBBT_NODE *) r, NULL);
+                      MESSAGE(9, tbbtdump(tree, -1);
+                          );
+                  }     /* end for */
+                tbbtdfree(tree, NULL, NULL);
+            }   /* end for */
+      }     /* end for */
+}   /* end test_tbbt() */
diff --git a/hdf/test/tsdmmsf.f b/hdf/test/tsdmmsf.f
new file mode 100644
index 0000000..1cb85fb
--- /dev/null
+++ b/hdf/test/tsdmmsf.f
@@ -0,0 +1,321 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tsdmmsf.f 6036 2014-01-20 17:28:01Z acheng $
+C
+      subroutine tsdmmsf (number_failed)
+C
+C
+C  Program to test writing SDSs with different types of data and
+C  scales and max/min values.
+C
+C  Input file:  none
+C  Output files: o0, o1, ... o6
+C
+      implicit none
+      include 'fortest.inc'
+   
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'sdmms')
+      
+      integer dsgdata, dsadata, dssdims, dssrang, dsgrang, dssnt
+      integer dssdisc, dsgdisc, dsscal, dsgcal
+
+      real*8 f64(10,10), tf64(10,10)
+      real*8 f64scale(10), tf64scale(10)
+      real*8 f64max, f64min, tf64max, tf64min
+
+      real*8 cal,  cale,  ioff,  ioffe
+      real*8 ical, icale, iioff, iioffe
+      integer*4 ctype, ictype
+
+      real*4 f32(10,10), tf32(10,10)
+      real*4 f32scale(10), tf32scale(10)
+      real*4 f32max, f32min, tf32max, tf32min
+
+      character i8(10,10), ti8(10,10)
+      character i8scale(10), ti8scale(10), i8max, i8min
+      character ti8max, ti8min
+C Align the Character variables with the surrogate names.
+C Need to do this because HDF always assume int8 is a packed 8 bits
+C quantities of precisely 1 byte big.  Integer*1 may have memory size
+C as large as a normal integer (e.g. Cray).
+C Cannot just use the character variables as for some compilers,
+C the argument address of a character argument is not compatible with
+C that of a numerial argument.
+
+      integer surri8, surri8max, surri8min, surri8scale
+      integer surrti8, surrti8max, surrti8min, surrti8scale
+      equivalence (i8, surri8)
+      equivalence (i8scale, surri8scale)
+      equivalence (i8min, surri8min)
+      equivalence (i8max, surri8max)
+      equivalence (ti8, surrti8)
+      equivalence (ti8scale, surrti8scale)
+      equivalence (ti8min, surrti8min)
+      equivalence (ti8max, surrti8max)
+
+      integer*2 i16(10,10), ti16(10,10)
+      integer*2 i16scale(10), ti16scale(10), i16max, i16min
+      integer*2 ti16max, ti16min
+
+      integer*4 i32(10,10), ti32(10,10)
+      integer*4 i32scale(10), ti32scale(10), i32max, i32min
+      integer*4 ti32max, ti32min
+
+      integer i, j, err, err1, err2, err3, err4
+      integer rank, dims(2)
+      integer DFNT_FLOAT64, DFNT_FLOAT32, DFNT_INT8, DFNT_INT16
+      integer DFNT_INT32
+
+      call ptestban('Testing', myname)
+      f64max = 40.0
+      f64min = 0.0
+      f32max = 40.0
+      f32min = 0.0
+      i8max = char(127)
+C NOTE: If you get a compile error on the "char(-128)" line, substitute
+C       the "char(0)" line.  Its not quite as thorough a test, but...
+      i8min = char(0)
+C      i8min = char(-128)
+      i16max = 1200
+      i16min = -1200
+      i32max = 99999999
+      i32min = -999999999
+      
+      rank = 2
+      dims(1) = 10
+      dims(2) = 10
+      number_failed = 0
+      DFNT_FLOAT64 = 6
+      DFNT_FLOAT32 = 5
+      DFNT_INT8 = 20
+      DFNT_INT16 = 22
+      DFNT_INT32 = 24
+      
+C
+C Set up some calibration info
+C
+      cal   = 10.0
+      cale  = 35.235
+      ioff  = 16.75
+      ioffe = 47.8
+      ctype = DFNT_INT16
+
+      call MESSAGE(5, 'Creating arrays...')
+      
+      do 110 i=1,10
+          do 100 j=1,10
+            f64(i,j) = (i * 40) + j
+            f32(i,j) = (i * 40) + j
+            i8(i,j) = char( (i * 10) + j )
+            i16(i,j) = (i * 3000) + j
+            i32(i,j) = (i * 20) + j
+  100     continue
+          f64scale(i) = (i * 40) + j
+          f32scale(i) = (i * 40) + j
+          i8scale(i) = char((i * 10) + j)
+      	  i16scale(i) = (i * 3000) + j
+      	  i32scale(i) = (i * 20) + j
+  110 continue
+
+      err1 = dssdims(rank, dims)
+      
+C
+C  Writing dimscale, max/min, and arrays to a single file 
+C
+      call MESSAGE(5, 'Writing arrays to single file...')
+
+      err  = dssnt(DFNT_FLOAT64)
+      err1 = dssdisc(1, 10, f64scale)
+      err2 = dssrang(f64max, f64min)
+      err4 = dsscal(cal, cale, ioff, ioffe, ctype)
+      err3 = dsadata('of.hdf', rank, dims, f64)
+      call errchkio(err1, err2, err3, number_failed, 'float64 write')
+
+      if(err4.eq.(-1)) then
+         number_failed = number_failed + 1
+         print *, '>>> Setting calibration failed'
+      endif
+
+      err  = dssnt(DFNT_FLOAT32)
+      err1 = dssdisc(1, 10, f32scale)
+      err2 = dssrang(f32max, f32min)
+      err3 = dsadata('of.hdf', rank, dims, f32)
+      call errchkio(err1, err2, err3, number_failed, 'float32 write')
+
+      err  = dssnt(DFNT_INT8)
+      err1 = dssdisc(1, 10, surri8scale)
+      err2 = dssrang(surri8max, surri8min)
+      err3 = dsadata('of.hdf', rank, dims, surri8)
+      call errchkio(err1, err2, err3, number_failed, 'int8 write')
+      
+      
+      err  = dssnt(DFNT_INT16)
+      err1 = dssdisc(1, 10, i16scale)
+      err2 = dssrang(i16max, i16min)
+      err3 = dsadata('of.hdf', rank, dims, i16)
+      call errchkio(err1, err2, err3, number_failed, 'int16 write')
+      
+      err  = dssnt(DFNT_INT32)
+      err1 = dssdisc(1, 10, i32scale)
+      err2 = dssrang(i32max, i32min)
+      err3 = dsadata('of.hdf', rank, dims, i32)
+      call errchkio(err1, err2, err3, number_failed, 'int32 write')
+      
+C
+C  Reading back dimscales, max/min, and arrays from single file
+C
+      err1 = dsgdata('of.hdf', rank, dims, tf64)
+      err2 = dsgdisc(1, 10, tf64scale)
+      err3 = dsgrang(tf64max, tf64min)
+      err4 = dsgcal(ical, icale, iioff, iioffe, ictype) 
+      call errchkio(err1, err2, err3, number_failed, 'float64 read')
+
+      if(err4.eq.(-1)) then
+         number_failed = number_failed + 1
+         print *, '>>> Reading calibration failed'
+      endif
+      
+      if((cal.ne.ical).or.(cale.ne.icale)) then
+         if((ioff.ne.iioff).or.(ioff.ne.iioffe)) then
+            if(ctype.ne.ictype) then
+               print *, '>>>Returned calibration values are wrong'
+               print *, ical, icale
+               print *, iioff, iioffe
+               print *, ictype 
+               print *, cal, cale
+               print *, ioff, ioffe
+               print *, ctype
+               number_failed = number_failed + 1
+            endif
+         endif
+      endif
+
+      err1 = dsgdata('of.hdf', rank, dims, tf32)
+      err2 = dsgdisc(1, 10, tf32scale)
+      err3 = dsgrang(tf32max, tf32min)
+      err4 = dsgcal(ical, icale, iioff, iioffe, ictype) 
+      call errchkio(err1, err2, err3, number_failed, 'float32 read')
+
+      if(err4.ne.(-1)) then
+         number_failed = number_failed + 1
+         print *, '>>> Read calibration where none stored'
+      endif
+      
+      err1 = dsgdata('of.hdf', rank, dims, surrti8)
+      err2 = dsgdisc(1, 10, surrti8scale)
+      err3 = dsgrang(surrti8max, surrti8min)
+      call errchkio(err1, err2, err3, number_failed, 'int8 read')
+      
+      err1 = dsgdata('of.hdf', rank, dims, ti16)
+      err2 = dsgdisc(1, 10, ti16scale)
+      err3 = dsgrang(ti16max, ti16min)
+      call errchkio(err1, err2, err3, number_failed, 'int16 read')
+      
+      err1 = dsgdata('of.hdf', rank, dims, ti32)
+      err2 = dsgdisc(1, 10, ti32scale)
+      err3 = dsgrang(ti32max, ti32min)
+      call errchkio(err1, err2, err3, number_failed, 'int32 read')
+      
+C
+C  Checking dimscales, max/min and arrays from single file
+C
+      call MESSAGE(5,
+     +    'Checking dimscales, max/min & arrays from single file')
+
+C  float64
+      err1 = 0
+      err2 = 0
+      err3 = 0
+      do 1010 i=1,10
+         do 1000 j=1,10
+           if (f64(i,j) .ne. tf64(i,j)) err1 = 1
+ 1000    continue
+
+         if (f64scale(i) .ne. tf64scale(i)) err2 = 1
+ 1010 continue
+
+      if ((f64max .ne. tf64max) .or. (f64min .ne. tf64min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'float64')
+
+C  float32
+      err1 = 0
+      err2 = 0
+      err3 = 0
+      do 1030 i=1,10
+         do 1020 j=1,10
+           if (f32(i,j) .ne. tf32(i,j)) err1 = 1
+ 1020    continue
+         if (f32scale(i) .ne. tf32scale(i)) err2 = 1
+ 1030 continue
+
+      if ((f32max .ne. tf32max) .or. (f32min .ne. tf32min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'float32')
+
+C  int8
+      err1 = 0
+      err2 = 0
+      err3 = 0
+      do 1110 i=1,10
+         do 1100 j=1,10
+           if (i8(i,j) .ne. ti8(i,j)) err1 = 1
+ 1100    continue
+         if (i8scale(i) .ne. ti8scale(i)) err2 = 1
+ 1110 continue
+
+      if ((i8max .ne. ti8max) .or. (i8min .ne. ti8min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'int8')
+
+C  int16
+      err1 = 0
+      err2 = 0
+      err3 = 0
+       do 1210 i=1,10
+         do 1200 j=1,10
+           if (i16(i,j) .ne. ti16(i,j)) err1 = 1
+ 1200    continue
+         if (i16scale(i) .ne. ti16scale(i)) err2 = 1
+ 1210 continue
+
+      if ((i16max .ne. ti16max) .or. (i16min .ne. ti16min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'int16')
+
+C  int32
+      err1 = 0
+      err2 = 0
+      err3 = 0
+       do 1310 i=1,10
+         do 1300 j=1,10
+           if (i32(i,j) .ne. ti32(i,j)) err1 = 1
+ 1300    continue
+      if (i32scale(i) .ne. ti32scale(i)) err2 = 1
+ 1310 continue
+
+      if ((i32max .ne. ti32max) .or. (i32min .ne. ti32min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'int32')
+C
+C  Sum up
+C
+      
+      if (number_failed .gt. 0 ) then
+          print *, '        >>> ', number_failed, ' TESTS FAILED <<<'
+      else
+          if (verbosity .ge. VERBO_HI) then
+              print *, '        >>> ALL TESTS PASSED <<<'
+         endif
+      endif
+
+      return
+      end
diff --git a/hdf/test/tsdnmmsf.f b/hdf/test/tsdnmmsf.f
new file mode 100644
index 0000000..a5016e1
--- /dev/null
+++ b/hdf/test/tsdnmmsf.f
@@ -0,0 +1,283 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tsdnmmsf.f 6036 2014-01-20 17:28:01Z acheng $
+C
+      subroutine tsdnmmsf (number_failed)
+      implicit none
+C
+C
+C  Program to test writing SDSs with different types of data and
+C  scales and max/min values.
+C
+C  Input file:  none
+C  Output files: fon.hdf
+C
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'sdnmms')
+   
+      integer dsgdata, dsadata, dssdims, dssrang, dsgrang, dssnt
+      integer dssdisc, dsgdisc
+
+      real*8 f64(10,10), tf64(10,10)
+      real*8 f64scale(10), tf64scale(10)
+      real*8 f64max, f64min, tf64max, tf64min
+
+      real*4 f32(10,10), tf32(10,10)
+      real*4 f32scale(10), tf32scale(10)
+      real*4 f32max, f32min, tf32max, tf32min
+
+      characteri8(10,10), ti8(10,10)
+      character i8scale(10), ti8scale(10), i8max, i8min
+      character ti8max, ti8min
+C Align the Character variables with the surrogate names.
+C Need to do this because HDF always assume int8 is a packed 8 bits
+C quantities of precisely 1 byte big.  Integer*1 may have memory size
+C as large as a normal integer (e.g. Cray).
+C Cannot just use the character variables as for some compilers,
+C the argument address of a character argument is not compatible with
+C that of a numerial argument.
+
+      integer surri8, surri8max, surri8min, surri8scale
+      integer surrti8, surrti8max, surrti8min, surrti8scale
+      equivalence (i8, surri8)
+      equivalence (i8scale, surri8scale)
+      equivalence (i8min, surri8min)
+      equivalence (i8max, surri8max)
+      equivalence (ti8, surrti8)
+      equivalence (ti8scale, surrti8scale)
+      equivalence (ti8min, surrti8min)
+      equivalence (ti8max, surrti8max)
+
+      integer*2 i16(10,10), ti16(10,10)
+      integer*2 i16scale(10), ti16scale(10), i16max, i16min
+      integer*2 ti16max, ti16min
+
+      integer*4 i32(10,10), ti32(10,10)
+      integer*4 i32scale(10), ti32scale(10), i32max, i32min
+      integer*4 ti32max, ti32min
+
+      integer i, j, err, err1, err2, err3
+      integer rank, dims(2)
+      integer DFNT_NFLOAT64, DFNT_NFLOAT32, DFNT_NINT8, DFNT_NINT16
+      integer DFNT_NINT32,  DFNT_NATIVE
+      integer DFNT_FLOAT64, DFNT_FLOAT32, DFNT_INT8, DFNT_INT16
+      integer DFNT_INT32 
+
+
+      call ptestban('Testing', myname)
+      f64max = 40.0
+      f64min = 0.0
+      f32max = 40.0
+      f32min = 0.0
+      i8max = char(127)
+C NOTE: If you get a compile error on the "char(-128)" line, substitute
+C       the "char(0)" line.  Its not quite as thorough a test, but...
+      i8min = char(0)
+C      i8min = char(-128)
+      i16max = 1200
+      i16min = -1200
+      i32max = 99999999
+      i32min = -999999999
+      
+      rank = 2
+      dims(1) = 10
+      dims(2) = 10
+      number_failed = 0
+      DFNT_FLOAT64 = 6
+      DFNT_FLOAT32 = 5
+      DFNT_INT8 = 20
+      DFNT_INT16 = 22
+      DFNT_INT32 = 24
+      DFNT_NATIVE = 4096
+
+C These should really use a logical OR to compute these values
+C However, OR() is not really that portable
+
+      DFNT_NFLOAT64 = DFNT_NATIVE + DFNT_FLOAT64
+      DFNT_NFLOAT32 = DFNT_NATIVE + DFNT_FLOAT32
+      DFNT_NINT8 =    DFNT_NATIVE + DFNT_INT8
+      DFNT_NINT16 =   DFNT_NATIVE + DFNT_INT16
+      DFNT_NINT32 =   DFNT_NATIVE + DFNT_INT32
+      
+      call MESSAGE(5, 'Creating arrays...')
+      
+      do 110 i=1,10
+          do 100 j=1,10
+            f64(i,j) = (i * 40) + j
+            f32(i,j) = (i * 40) + j
+             i8(i,j) = char( (i * 10) + j )
+            i16(i,j) = (i * 3000) + j
+            i32(i,j) = (i * 20) + j
+  100     continue
+          f64scale(i) = (i * 40) + j
+          f32scale(i) = (i * 40) + j
+          i8scale(i) = char((i * 10) + j)
+          i16scale(i) = (i * 3000) + j
+          i32scale(i) = (i * 20) + j
+  110 continue
+
+      err1 = dssdims(rank, dims)
+      
+C
+C  Writing dimscale, max/min, and arrays to a single file 
+C
+      call MESSAGE(5, 'Writing arrays to single file...')
+
+      err  = dssnt(DFNT_NFLOAT64)
+      err1 = dssdisc(1, 10, f64scale)
+      err2 = dssrang(f64max, f64min)
+      err3 = dsadata('fon.hdf', rank, dims, f64)
+      call errchkio(err1, err2, err3, number_failed, 'float64 write')
+      
+      err  = dssnt(DFNT_NFLOAT32)
+      err1 = dssdisc(1, 10, f32scale)
+      err2 = dssrang(f32max, f32min)
+      err3 = dsadata('fon.hdf', rank, dims, f32)
+      call errchkio(err1, err2, err3, number_failed, 'float32 write')
+
+      err  = dssnt(DFNT_NINT8)
+      err1 = dssdisc(1, 10, surri8scale)
+      err2 = dssrang(surri8max, surri8min)
+      err3 = dsadata('fon.hdf', rank, dims, surri8)
+      call errchkio(err1, err2, err3, number_failed, 'int8 write')
+      
+      
+      err  = dssnt(DFNT_NINT16)
+      err1 = dssdisc(1, 10, i16scale)
+      err2 = dssrang(i16max, i16min)
+      err3 = dsadata('fon.hdf', rank, dims, i16)
+      call errchkio(err1, err2, err3, number_failed, 'int16 write')
+      
+      err  = dssnt(DFNT_NINT32)
+      err1 = dssdisc(1, 10, i32scale)
+      err2 = dssrang(i32max, i32min)
+      err3 = dsadata('fon.hdf', rank, dims, i32)
+      call errchkio(err1, err2, err3, number_failed, 'int32 write')
+      
+C
+C  Reading back dimscales, max/min, and arrays from single file
+C
+      err1 = dsgdata('fon.hdf', rank, dims, tf64)
+      err2 = dsgdisc(1, 10, tf64scale)
+      err3 = dsgrang(tf64max, tf64min)
+      call errchkio(err1, err2, err3, number_failed, 'float64 read')
+     
+      err1 = dsgdata('fon.hdf', rank, dims, tf32) 
+      err2 = dsgdisc(1, 10, tf32scale)
+      err3 = dsgrang(tf32max, tf32min)
+      call errchkio(err1, err2, err3, number_failed, 'float32 read')
+      
+      err1 = dsgdata('fon.hdf', rank, dims, surrti8)
+      err2 = dsgdisc(1, 10, surrti8scale)
+      err3 = dsgrang(surrti8max, surrti8min)
+      call errchkio(err1, err2, err3, number_failed, 'int8 read')
+      
+      err1 = dsgdata('fon.hdf', rank, dims, ti16)
+      err2 = dsgdisc(1, 10, ti16scale)
+      err3 = dsgrang(ti16max, ti16min)
+      call errchkio(err1, err2, err3, number_failed, 'int16 read')
+      
+      err1 = dsgdata('fon.hdf', rank, dims, ti32)
+      err2 = dsgdisc(1, 10, ti32scale)
+      err3 = dsgrang(ti32max, ti32min)
+      call errchkio(err1, err2, err3, number_failed, 'int32 read')
+      
+C
+C  Checking dimscales, max/min and arrays from single file
+C
+      call MESSAGE(5,
+     +    'Checking dimscales, max/min & arrays from single file')
+
+C  float64
+      err1 = 0
+      err2 = 0
+      err3 = 0
+      do 1010 i=1,10
+         do 1000 j=1,10
+           if (f64(i,j) .ne. tf64(i,j)) err1 = 1
+ 1000    continue
+        if (f64scale(i) .ne. tf64scale(i)) err2 = 1
+ 1010 continue
+
+      if ((f64max .ne. tf64max) .or. (f64min .ne. tf64min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'float64')
+
+C  float32
+      err1 = 0
+      err2 = 0
+      err3 = 0
+      do 1030 i=1,10
+         do 1020 j=1,10
+           if (f32(i,j) .ne. tf32(i,j)) err1 = 1
+ 1020    continue
+         if (f32scale(i) .ne. tf32scale(i)) err2 = 1
+ 1030 continue
+
+      if ((f32max .ne. tf32max) .or. (f32min .ne. tf32min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'float32')
+
+C  int8
+      err1 = 0
+      err2 = 0
+      err3 = 0
+      do 1110 i=1,10
+         do 1100 j=1,10
+           if (i8(i,j) .ne. ti8(i,j)) err1 = 1
+ 1100    continue
+         if (i8scale(i) .ne. ti8scale(i)) err2 = 1
+ 1110 continue
+
+      if ((i8max .ne. ti8max) .or. (i8min .ne. ti8min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'int8')
+
+C  int16
+      err1 = 0
+      err2 = 0
+      err3 = 0   
+      do 1210 i=1,10
+         do 1200 j=1,10
+           if (i16(i,j) .ne. ti16(i,j)) err1 = 1
+ 1200    continue
+         if (i16scale(i) .ne. ti16scale(i)) err2 = 1
+ 1210 continue
+
+      if ((i16max .ne. ti16max) .or. (i16min .ne. ti16min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'int16')
+
+C  int32
+      err1 = 0
+      err2 = 0
+      err3 = 0   
+      do 1310 i=1,10
+         do 1300 j=1,10
+           if (i32(i,j) .ne. ti32(i,j)) err1 = 1
+ 1300    continue
+      	 if (i32scale(i) .ne. ti32scale(i)) err2 = 1
+ 1310 continue
+
+      if ((i32max .ne. ti32max) .or. (i32min .ne. ti32min)) err3 = 1
+      call errchkarr(err1, err2, err3, number_failed, 'int32')
+C
+C  Sum up
+C
+      
+      if (number_failed .gt. 0 ) then
+          print *, '        >>> ', number_failed, ' TESTS FAILED <<<'
+      else
+          call MESSAGE(5, '        >>> ALL TESTS PASSED <<<')
+      endif
+
+      return
+      end
diff --git a/hdf/test/tsdnntf.f b/hdf/test/tsdnntf.f
new file mode 100644
index 0000000..a2cc077
--- /dev/null
+++ b/hdf/test/tsdnntf.f
@@ -0,0 +1,262 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tsdnntf.f 6036 2014-01-20 17:28:01Z acheng $
+C
+      subroutine tsdnntf (number_failed)
+C
+C
+C  Program to test writing SDSs with different types of data.
+C
+C  Input file:  none
+C  Output files:  fo1.hdf, fo2.hdf, ...fo5.hdf, fo.hdf
+C
+
+      implicit none
+      include 'fortest.inc'
+
+      integer number_failed
+      character*20  myname
+      parameter (myname = 'sdnnt')
+
+      integer dspdata, dsgdata, dsadata, dssdims, dssnt
+      
+      real*8 f64(10,10), tf64(10,10)
+      real*4 f32(10,10), tf32(10,10)
+      integer*2 i16(10,10), ti16(10,10)
+      integer*4 i32(10,10), ti32(10,10)
+      
+      character i8(10,10), ti8(10,10)
+      
+      integer i, j, err
+      integer rank
+      integer dims(2)
+      integer DFNT_FLOAT64, DFNT_FLOAT32, DFNT_INT8, DFNT_INT16
+      integer DFNT_INT32
+      integer DFNT_NFLOAT64, DFNT_NFLOAT32, DFNT_NINT8
+      integer DFNT_NINT16, DFNT_NINT32, DFNT_NATIVE
+      
+      call ptestban('Testing', myname)
+      DFNT_FLOAT64 = 6
+      DFNT_FLOAT32 = 5
+      DFNT_INT8 = 20
+      DFNT_INT16 = 22
+      DFNT_INT32 = 24
+      DFNT_NATIVE = 4096
+      
+C These should really use a logical OR to compute these values
+C However, OR() is not really that portable
+
+      DFNT_NFLOAT64 = DFNT_NATIVE + DFNT_FLOAT64
+      DFNT_NFLOAT32 = DFNT_NATIVE + DFNT_FLOAT32
+      DFNT_NINT8 =    DFNT_NATIVE + DFNT_INT8
+      DFNT_NINT16 =   DFNT_NATIVE + DFNT_INT16
+      DFNT_NINT32 =   DFNT_NATIVE + DFNT_INT32
+
+      rank = 2
+      dims(1) = 10
+      dims(2) = 10
+      number_failed = 0
+ 
+      call MESSAGE(5, 'Creating arrays...')
+  
+      do 110 i=1,10
+          do 100 j=1,10
+            f64(i,j) = (i * 10) + j
+  	    f32(i,j) = (i * 10) + j
+  	    i8(i,j) = char( (i * 10) + j )
+  	    i16(i,j) = (i * 10) + j
+  	    i32(i,j) = (i * 10) + j
+  100     continue
+  110 continue
+  
+      err = dssdims(rank, dims)
+  
+C  individual files 
+      call MESSAGE(5, 'Testing arrays in individual files...')
+  
+      err = dssnt(DFNT_NFLOAT64)
+      call VRFY(err, 'dssnt (float64)', number_failed)
+      err = dspdata('fo1.hdf', rank, dims, f64)
+      call VRFY(err, 'dspdata (float64)', number_failed)
+      err = dsgdata('fo1.hdf', rank, dims, tf64)
+      call VRFY(err, 'dsgdata (float64)', number_failed)
+      err = 0
+      do 160 i=1,10
+          do 150 j=1,10
+  	    if (f64(i,j).ne.tf64(i,j)) err = 1
+  	    tf64(i,j) = 0.0
+  150     continue
+  160 continue
+
+      call err_check(err, number_failed, 'float64')
+
+      err = dssnt(DFNT_NFLOAT32)
+      call VRFY(err, 'dssnt (float32)', number_failed)
+      err = dspdata('fo2.hdf', rank, dims, f32)
+      call VRFY(err, 'dspdata (float32)', number_failed)
+      err = dsgdata('fo2.hdf', rank, dims, tf32)
+      call VRFY(err, 'dsgdata (float32)', number_failed)
+      err = 0
+      do 210 i=1,10
+         do 200 j=1,10
+             if (f32(i,j).ne.tf32(i,j)) err = 1
+             tf32(i,j) = 0.0
+ 200      continue
+ 210   continue
+       
+       call err_check(err, number_failed, 'float32')
+       
+      err = dssnt(DFNT_NINT8)
+      call VRFY(err, 'dssnt (int8)', number_failed)
+      err = dspdata('fo3.hdf', rank, dims, i8)
+      call VRFY(err, 'dspdata (int8)', number_failed)
+      err = dsgdata('fo3.hdf', rank, dims, ti8)
+      call VRFY(err, 'dsgdata (int8)', number_failed)
+      err = 0
+      do 310 i=1,10
+         do 300 j=1,10
+             if (i8(i,j).ne.ti8(i,j)) err = 1
+             ti8(i,j) = char(0)
+ 300      continue
+ 310  continue
+       
+      call err_check(err, number_failed, 'int8')
+       
+      err = dssnt(DFNT_NINT16)
+      call VRFY(err, 'dssnt (int16)', number_failed)
+      err = dspdata('fo4.hdf', rank, dims, i16)
+      call VRFY(err, 'dspdata (int16)', number_failed)
+      err = dsgdata('fo4.hdf', rank, dims, ti16)
+      call VRFY(err, 'dsgdata (int16)', number_failed)
+      err = 0
+      do 410 i=1,10
+          do 400 j=1,10
+             if (i16(i,j).ne.ti16(i,j)) err = 1
+             ti16(i,j) = 0
+ 400      continue
+ 410  continue
+       
+      call err_check(err, number_failed, 'int16')
+       
+      err = dssnt(DFNT_NINT32)
+      call VRFY(err, 'dssnt (int32)', number_failed)
+      err = dspdata('fo5.hdf', rank, dims, i32)
+      call VRFY(err, 'dspdata (int32)', number_failed)
+      err = dsgdata('fo5.hdf', rank, dims, ti32)
+      call VRFY(err, 'dsgdata (int32)', number_failed)
+      err = 0
+      do 510 i=1,10
+          do 500 j=1,10
+             if (i32(i,j).ne.ti32(i,j)) err = 1
+             ti32(i,j) = 0
+ 500      continue
+ 510  continue
+       
+      call err_check(err, number_failed, 'int32')
+       
+       
+C     
+      call MESSAGE(5, 'Writing arrays to single file.')
+C     
+      err = dssnt(DFNT_NFLOAT64)
+      err = dsadata('fo.hdf', rank, dims, f64)
+      call VRFY(err, 'dsadata (f64)', number_failed)
+       
+      err = dssnt(DFNT_NFLOAT32)
+      err = dsadata('fo.hdf', rank, dims, f32)
+      call VRFY(err, 'dsadata (f32)', number_failed)
+       
+      err = dssnt(DFNT_NINT8)
+      err = dsadata('fo.hdf', rank, dims, i8)
+      call VRFY(err, 'dsadata (i8)', number_failed)
+       
+      err = dssnt(DFNT_NINT16)
+      err = dsadata('fo.hdf', rank, dims, i16)
+      call VRFY(err, 'dsadata (i16)', number_failed)
+       
+      err = dssnt(DFNT_NINT32)
+      err = dsadata('fo.hdf', rank, dims, i32)
+      call VRFY(err, 'dsadata (i32)', number_failed)
+       
+C     
+      call MESSAGE(5, 'Reading arrays from single file... ')
+C     
+      err = dsgdata('fo.hdf', rank, dims, tf64)
+      call VRFY(err, 'dsgdata (tf64)', number_failed)
+      err = dsgdata('fo.hdf', rank, dims, tf32)
+      call VRFY(err, 'dsgdata (tf32)', number_failed)
+      err = dsgdata('fo.hdf', rank, dims, ti8)
+      call VRFY(err, 'dsgdata (ti8)', number_failed)
+      err = dsgdata('fo.hdf', rank, dims, ti16)
+      call VRFY(err, 'dsgdata (ti16)', number_failed)
+      err = dsgdata('fo.hdf', rank, dims, ti32)
+      call VRFY(err, 'dsgdata (ti32)', number_failed)
+       
+C     
+      call MESSAGE(5, 'Checking arrays from single file...\n\n')
+       
+      err = 0
+      do 910 i=1,10
+          do 900 j=1,10
+             if (f64(i,j) .ne. tf64(i,j)) err = 1
+ 900     continue
+ 910  continue
+       
+      call err_check(err, number_failed, 'float64')
+C     
+       
+      err = 0
+      do 1010 i=1,10
+          do 1000 j=1,10
+             if (f32(i,j) .ne. tf32(i,j)) err = 1
+ 1000     continue
+ 1010 continue
+       
+      call err_check(err, number_failed, 'float32')
+C     
+      err = 0
+      do 1110 i=1,10
+          do 1100 j=1,10
+             if (i8(i,j) .ne. ti8(i,j)) err = 1
+ 1100     continue
+ 1110 continue
+       
+      call err_check(err, number_failed, 'int8')
+C     
+      err = 0
+      do 1210 i=1,10
+          do 1200 j=1,10
+             if (i16(i,j) .ne. ti16(i,j)) err = 1
+ 1200     continue
+ 1210 continue
+       
+      call err_check(err, number_failed, 'int16')
+C     
+      err = 0
+      do 1310 i=1,10
+          do 1300 j=1,10
+             if (i32(i,j) .ne. ti32(i,j)) err = 1
+ 1300     continue
+ 1310 continue
+       
+      call err_check(err, number_failed, 'int32')
+C     
+      if (number_failed .gt. 0 ) then
+          print *,'        >>> ', number_failed, ' TESTS FAILED <<<'
+      else
+          call MESSAGE(VERBO_HI, '        >>> ALL TESTS PASSED <<<')
+      endif
+       
+      return
+      end
diff --git a/hdf/test/tsdntf.f b/hdf/test/tsdntf.f
new file mode 100644
index 0000000..f1d7a1b
--- /dev/null
+++ b/hdf/test/tsdntf.f
@@ -0,0 +1,249 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tsdntf.f 6036 2014-01-20 17:28:01Z acheng $
+C
+      subroutine tsdntf (number_failed)
+C
+C
+C  Program to test writing SDSs with different types of data.
+C
+C  Input file:  none
+C  Output files:  o.hdf.1, o.hdf.2, ... o.hdf.5
+C
+      implicit none
+      include 'fortest.inc'
+
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'sdnt')
+
+      integer dspdata, dsgdata, dsadata, dssdims, dssnt
+
+      real*8 f64(10,10), tf64(10,10)
+      real*4 f32(10,10), tf32(10,10)
+      integer*2 i16(10,10), ti16(10,10)
+      integer*4 i32(10,10), ti32(10,10)
+
+      character i8(10,10), ti8(10,10)
+
+      
+      integer i, j, err
+      integer rank
+      integer dims(2)
+      integer DFNT_FLOAT64, DFNT_FLOAT32, DFNT_INT8
+      integer DFNT_INT16, DFNT_INT32
+  
+      call ptestban('Testing', myname)
+      number_failed = 0
+      DFNT_FLOAT64 = 6
+      DFNT_FLOAT32 = 5
+      DFNT_INT8 = 20
+      DFNT_INT16 = 22
+      DFNT_INT32 = 24
+      rank = 2
+      dims(1) = 10
+      dims(2) = 10
+  
+      call MESSAGE(5, 'Creating arrays...')
+  
+      do 110 i=1,10
+          do 100 j=1,10
+            f64(i,j) = (i * 10) + j
+  	    f32(i,j) = (i * 10) + j
+  	    i8(i,j) = char( (i * 10) + j )
+  	    i16(i,j) = (i * 10) + j
+  	    i32(i,j) = (i * 10) + j
+  100     continue
+  110 continue
+  
+      err = dssdims(rank, dims)
+  
+C  individual files 
+      call MESSAGE(5, 'Testing arrays in individual files...')
+  
+      err = dssnt(DFNT_FLOAT64)
+      call VRFY(err, 'dssnt (float64)', number_failed)
+      err = dspdata('o1.hdf', rank, dims, f64)
+      call VRFY(err, 'dspdata (float64)', number_failed)
+      err = dsgdata('o1.hdf', rank, dims, tf64)
+      call VRFY(err, 'dsgdata (float64)', number_failed)
+      err = 0
+      do 160 i=1,10
+          do 150 j=1,10
+  	    if (f64(i,j).ne.tf64(i,j)) err = 1
+  	    tf64(i,j) = 0.0
+  150     continue
+  160 continue
+
+      call err_check(err, number_failed, 'float64')
+
+      err = dssnt(DFNT_FLOAT32)
+      call VRFY(err, 'dssnt (float32)', number_failed)
+      err = dspdata('o2.hdf', rank, dims, f32)
+      call VRFY(err, 'dspdata (float32)', number_failed)
+      err = dsgdata('o2.hdf', rank, dims, tf32)
+      call VRFY(err, 'dsgdata (float32)', number_failed)
+      err = 0
+      do 210 i=1,10
+          do 200 j=1,10
+            if (f32(i,j).ne.tf32(i,j)) err = 1
+            tf32(i,j) = 0.0
+  200     continue
+  210 continue
+
+      call err_check(err, number_failed, 'float32')
+
+      err = dssnt(DFNT_INT8)
+      call VRFY(err, 'dssnt (int8)', number_failed)
+      err = dspdata('o3.hdf', rank, dims, i8)
+      call VRFY(err, 'dspdata (int8)', number_failed)
+      err = dsgdata('o3.hdf', rank, dims, ti8)
+      call VRFY(err, 'dsgdata (int8)', number_failed)
+      err = 0
+      do 310 i=1,10
+          do 300 j=1,10
+            if (i8(i,j).ne.ti8(i,j)) err = 1
+          ti8(i,j) = char(0)
+  300     continue
+  310 continue
+
+      call err_check(err, number_failed, 'int8')
+
+      err = dssnt(DFNT_INT16)
+      call VRFY(err, 'dssnt (int16)', number_failed)
+      err = dspdata('o4.hdf', rank, dims, i16)
+      call VRFY(err, 'dspdata (int16)', number_failed)
+      err = dsgdata('o4.hdf', rank, dims, ti16)
+      call VRFY(err, 'dsgdata (int16)', number_failed)
+      err = 0
+      do 410 i=1,10
+          do 400 j=1,10
+            if (i16(i,j).ne.ti16(i,j)) err = 1
+            ti16(i,j) = 0
+  400     continue
+  410 continue
+
+      call err_check(err, number_failed, 'int16')
+
+      err = dssnt(DFNT_INT32)
+      call VRFY(err, 'dssnt (int32)', number_failed)
+      err = dspdata('o5.hdf', rank, dims, i32)
+      call VRFY(err, 'dspdata (int32)', number_failed)
+      err = dsgdata('o5.hdf', rank, dims, ti32)
+      call VRFY(err, 'dsgdata (int32)', number_failed)
+      err = 0
+      do 510 i=1,10
+          do 500 j=1,10
+            if (i32(i,j).ne.ti32(i,j)) err = 1
+            ti32(i,j) = 0
+  500     continue
+  510 continue
+
+      call err_check(err, number_failed, 'int32')
+
+
+C 
+      call MESSAGE(5, 'Writing arrays to single file.')
+C
+      err = dssnt(DFNT_FLOAT64)
+      err = dsadata('ntf.hdf', rank, dims, f64)
+      call VRFY(err, 'dsadata (f64)', number_failed)
+       
+      err = dssnt(DFNT_FLOAT32)
+      err = dsadata('ntf.hdf', rank, dims, f32)
+      call VRFY(err, 'dsadata (f32)', number_failed)
+       
+      err = dssnt(DFNT_INT8)
+      err = dsadata('ntf.hdf', rank, dims, i8)
+      call VRFY(err, 'dsadata (i8)', number_failed)
+       
+      err = dssnt(DFNT_INT16)
+      err = dsadata('ntf.hdf', rank, dims, i16)
+      call VRFY(err, 'dsadata (i16)', number_failed)
+       
+      err = dssnt(DFNT_INT32)
+      err = dsadata('ntf.hdf', rank, dims, i32)
+      call VRFY(err, 'dsadata (i32)', number_failed)
+       
+C 
+      call MESSAGE(5, 'Reading arrays from single file... ')
+C
+      err = dsgdata('ntf.hdf', rank, dims, tf64)
+      call VRFY(err, 'dsgdata (tf64)', number_failed)
+      err = dsgdata('ntf.hdf', rank, dims, tf32)
+      call VRFY(err, 'dsgdata (tf32)', number_failed)
+      err = dsgdata('ntf.hdf', rank, dims, ti8)
+      call VRFY(err, 'dsgdata (ti8)', number_failed)
+      err = dsgdata('ntf.hdf', rank, dims, ti16)
+      call VRFY(err, 'dsgdata (ti16)', number_failed)
+      err = dsgdata('ntf.hdf', rank, dims, ti32)
+      call VRFY(err, 'dsgdata (ti32)', number_failed)
+       
+C 
+      call MESSAGE(5, 'Checking arrays from single file...\n\n')
+
+      err = 0
+      do 910 i=1,10
+         do 900 j=1,10
+           if (f64(i,j) .ne. tf64(i,j)) err = 1
+  900    continue
+  910 continue
+
+      call err_check(err, number_failed, 'float64')
+C 
+
+      err = 0
+      do 1010 i=1,10
+         do 1000 j=1,10
+           if (f32(i,j) .ne. tf32(i,j)) err = 1
+ 1000    continue
+ 1010 continue
+
+      call err_check(err, number_failed, 'float32')
+C 
+      err = 0
+      do 1110 i=1,10
+         do 1100 j=1,10
+           if (i8(i,j) .ne. ti8(i,j)) err = 1
+ 1100    continue
+ 1110 continue
+
+      call err_check(err, number_failed, 'int8')
+C 
+      err = 0
+      do 1210 i=1,10
+         do 1200 j=1,10
+           if (i16(i,j) .ne. ti16(i,j)) err = 1
+ 1200    continue
+ 1210 continue
+
+      call err_check(err, number_failed, 'int16')
+C 
+      err = 0
+      do 1310 i=1,10
+         do 1300 j=1,10
+           if (i32(i,j) .ne. ti32(i,j)) err = 1
+ 1300    continue
+ 1310 continue
+
+      call err_check(err, number_failed, 'int32')
+C 
+      if (number_failed .gt. 0 ) then
+        print *,'        >>> ', number_failed, ' TESTS FAILED <<<'
+      else
+        call MESSAGE(VERBO_HI, '        >>> ALL TESTS PASSED <<<')
+      endif
+
+      return
+      end  
diff --git a/hdf/test/tsdstrf.f b/hdf/test/tsdstrf.f
new file mode 100644
index 0000000..d40eb44
--- /dev/null
+++ b/hdf/test/tsdstrf.f
@@ -0,0 +1,132 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C
+C $Id: tsdstrf.f 6034 2014-01-19 06:59:14Z epourmal $
+C
+      subroutine tsdstrf (num_failed)
+      implicit none
+C
+C This program tests correctness of writing and read datastrings
+C and dimension strings.
+C To avoid the '\0' inserted by HDstrncpy, compare the first 14
+C characters of output and input strings in subroutine compare()
+      integer num_failed
+      character*20 myname
+      parameter (myname = 'sdstr')
+
+      integer rank, i, j, ret, err
+      integer dims(2)
+      integer dssnt, dssdims, dssdast, dssdist, dspdata
+      integer dsgdast, dsgdist, dsgdata, DFNT_NFLOAT32
+      real    f32(10,10), inf32(10,10)
+      character*15 datalabel, dataunit, datafmt, coordsys
+      character*15 dimlabels(2), dimunits(2), dimfmts(2)
+      character*16 indatalabel, indataunit, indatafmt, incoordsys
+      character*16 indimlabels(2), indimunits(2), indimfmts(2)
+      character*15 fn
+
+      call ptestban('Testing', myname)
+      DFNT_NFLOAT32 = 4096+5
+      rank = 2
+      dims(1) = 10
+      dims(2) = 10
+      datalabel = 'Datalabel'
+      dataunit = 'Dataunit'
+      datafmt = 'Datafmt'
+      coordsys = 'Coordsys'
+      dimlabels(1) = 'f_dim1_label_b'
+      dimunits(1) =  'f_dim1_unit_b '
+      dimfmts(1) =   'f_dim1_fmt_b  '
+      dimlabels(2) = 'f_dim2_label_a'
+      dimunits(2) =  'f_dim2_unit_a '
+      dimfmts(2) =   'f_dim2_fmt_a  '
+      fn = 'sdstrsf.hdf'
+
+      err = 0
+      num_failed = 0
+
+      call MESSAGE(5, 'Creating arrays...')
+
+      do 110 i=1,dims(2)
+          do 100 j=1,dims(1) 
+             f32(j,i) = (i*10) + j
+100       continue
+110   continue
+
+      ret = dssdims(rank, dims)
+      err = err + ret
+      ret = dssnt(DFNT_NFLOAT32)
+      err = err + ret
+      ret = dssdast(datalabel, dataunit, datafmt, coordsys)
+      err = err + ret
+      ret = dssdist(1, dimlabels(1), dimunits(1), dimfmts(1))
+      err = err + ret
+      ret = dssdist(2, dimlabels(2), dimunits(2), dimfmts(2))
+      err = err + ret
+      ret = dspdata(fn, rank,dims, f32)
+      err = err + ret
+
+      call MESSAGE(5, 'Test strings written so far')
+
+      ret = dsgdata(fn, rank, dims, inf32)
+      err = err + ret
+      ret = dsgdast(indatalabel, indataunit, indatafmt, incoordsys)
+      err = err + ret
+      ret = dsgdist(1, indimlabels(1), indimunits(1), indimfmts(1))
+      err = err + ret
+      ret = dsgdist(2, indimlabels(2), indimunits(2), indimfmts(2))
+      err = err + ret
+
+      call compare(datalabel, indatalabel, num_failed)
+      call compare(dataunit, indataunit, num_failed)
+      call compare(datafmt, indatafmt, num_failed)
+      call compare(coordsys, incoordsys, num_failed)
+      do 150 i=1,2
+          call compare(dimlabels(i), indimlabels(i), num_failed)
+          call compare(dimunits(i), indimunits(i), num_failed)
+          call compare(dimfmts(i), indimfmts(i), num_failed)
+150   continue
+
+      if ((err .eq. 0) .and. (num_failed .eq. 0)) then
+          call MESSAGE(5, '>>>> All Tests Passed.  >>>>')
+      else
+          print *, abs(err),' calls returned -1'
+          print *, num_failed, ' values incorrect.'
+      endif
+
+      return
+      end
+
+     
+
+      subroutine compare(outstring, instring, num)
+      implicit none
+      include 'fortest.inc'
+
+      character*14 outstring, instring
+      integer      num
+C
+C Note, outstring and instring are of length 14 instead of 15.
+C
+ 
+      if (outstring .ne. instring) then
+          print *, 'Test failed for <', outstring,'>'
+          print *, '      HDF says= <', instring,'>'
+          num= num+ 1
+      else
+         if (Verbosity .ge. VERBO_HI) then
+            print *, 'Test passed for ', outstring
+         endif
+      endif
+      return
+      end
diff --git a/hdf/test/tstubsf.f b/hdf/test/tstubsf.f
new file mode 100644
index 0000000..73b4cb7
--- /dev/null
+++ b/hdf/test/tstubsf.f
@@ -0,0 +1,424 @@
+C****************************************************************************
+C* $Id: tstubsf.f 6034 2014-01-19 06:59:14Z epourmal $                       *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+      subroutine tstubsf (nerrors)
+      implicit none
+      include 'fortest.inc'
+
+      integer nerrors
+      character*20  myname
+      parameter (myname = 'stubs')
+
+      character ar0*10
+      character ar1*9
+      character ar2*30
+      character ar3*8
+
+      character in*20
+
+      integer dfile
+      integer dfinfo(16)
+      integer dlist(128)
+      integer a0size, a1size, a2size, a3size
+      integer ret, err, i, nd, dfenum, tag, ref, length
+
+      integer t255
+      integer t127
+      integer r1
+      integer r3
+      integer r7
+
+      integer dfaccess, dfopen, dfclose, dfdesc, dfdup, dfdel, dfread,
+     +     dfwrite, dfupdate, dfget, dfput, dfsfind, dffind,
+     +     dferrno, dfishdf, dfnewref, dfnumber, dfstat
+
+      data t255 /255/
+      data t127 /127/
+      data r1   /1/
+      data r3   /3/
+      data r7   /7/
+
+      data ar0 /'Testing...'/
+      data ar1 /'...one...'/
+      data ar2 /'...two...'/
+      data ar3 /'...three'/
+
+
+      call ptestban('Testing', myname)
+      nerrors = 0
+      a0size = len(ar0)
+      a1size = len(ar1)
+      a2size = len(ar2)
+      a3size = len(ar3)
+
+C      print *, 'This program will test the DF emulation layer'
+C      print *, 'of HDF 3.2 and beyond (FORTRAN version).  Many'
+C      print *, 'routines will be tested individually.  Each test'
+C      print *, 'will report its name and results.  If all goes'
+C      print *, 'well, all of the results will begin with "Success".'
+C      print *, 'If a test fails, the results line will begin with'
+C      print *, '">>>Failure".  An error count is kept and printed'
+C      print *, 'out at the end.'
+C      print *, 'Hit <return> to continue.'
+C      read(5,100) in
+C 100  format(a)
+C      in(1:20) = '                    '
+
+      call MESSAGE(VERBO_MED, 'Testing dferrno...')
+      ret = dferrno()
+      if (ret .ne. 0) then
+         print *, '>>>Failure:  Returned ', ret, ' rather than 0.'
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfishdf... (should fail)')
+      ret = dfishdf('tstubsF.hdf')
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+C       print *, 'Success:  dfishdf failed with DFerror = ', dfenum
+        call MESSAGE(VERBO_HI, 'Success:  dfishdf did fail')
+      else
+         print *, '>>>Failure:  Non-existent file looks like HDF file.'
+         print *, '   Maybe was a pre-existing file named "tstubsF.hdf"'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfopen... (new file)')
+      dfile = dfopen('tstubsF.hdf', 6, 0)
+      dfenum = dferrno()
+      if (dfile .eq. 0) then
+         print *, '>>>Failure:  Error ', dfenum, ' opening file.'
+         print *, '   Quiting.'
+         return
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfclose...')
+      ret = dfclose(dfile)
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         print *, '>>>Failure:  could not close file.'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED,
+     +    'Testing dfclose... (invalid file; should fail)')
+      ret = dfclose(dfile)
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         call MESSAGE(VERBO_HI, 'Success: dfclose did fail')
+      else
+         print *, '>>>Failure:  Close allowed on unopened file.'
+         nerrors = nerrors + 1
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfopen... (existing file)')
+      dfile = dfopen('tstubsF.hdf', 2, 0)
+      dfenum = dferrno()
+      if (dfile .eq. 0) then
+         print *, '>>>Failure:  Error ', dfenum, ' opening file.'
+         print *, '   Quiting.'
+         return
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfput...')
+      ret = dfput(dfile, t255, r1, ar0, a0size)
+      dfenum = dferrno()
+      if (ret .ne. a0size) then
+         print *, '>>>Failure:  DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfget...')
+      ret = dfget(dfile, t255, r1, in)
+      dfenum = dferrno()
+      if (ret .ne. a0size) then
+         print *, '>>>Failure:  read ', ret, ' of ', a0size, ' bytes.'
+         print *, '   String read:  ', in
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         err = 0
+         do 10 i=1, a0size
+         if (in(i:i) .ne. ar0(i:i)) err = 1
+ 10      continue
+         if (err .eq. 1) then
+            print *, '>>>Failure:  strings differ.'
+            print *, '   String written:  ', ar0
+            print *, '   String read:     ', in
+            nerrors = nerrors + 1
+         else
+            call MESSAGE(VERBO_HI,
+     +     'Success:  string read is the same as written.')
+         endif
+      endif
+
+      in(1:20) = '                    '
+
+      call MESSAGE(VERBO_MED, 'Testing dfaccess (write)...')
+      ret = dfaccess(dfile, t255, r3, 'w')
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         print *, '>>>Failure:'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfread... (should fail)')
+      ret = dfread(dfile, in, 5)
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         call MESSAGE(VERBO_HI, 'Success:  dfread did fail')
+      else
+         print *, '>>>Failure:  Read allowed on write element.'
+         nerrors = nerrors + 1
+      endif
+      in(1:20) = '                    '
+
+      call MESSAGE(VERBO_MED, 'Testing dfwrite...')
+      ret = dfwrite(dfile, ar1, a1size)
+      dfenum = dferrno()
+      if (ret .ne. a1size) then
+         print *, '>>>Failure:  wrote ', ret, ' of ', a1size, ' bytes.'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfaccess (read)...')
+      ret = dfaccess(dfile, t255, r3, 'r')
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         print *, '>>>Failure:'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfwrite... (should fail)')
+      ret = dfwrite(dfile, in, 5)
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         call MESSAGE(VERBO_HI, 'Success:  dfwrite did fail')
+      else
+         print *, '>>>Failure:  write allowed on read element.'
+         nerrors = nerrors + 1
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfread...')
+      ret = dfread(dfile, in, a1size)
+      dfenum = dferrno()
+      if (ret .ne. a1size) then
+         print *, '>>>Failure:  read ', ret, ' of ', a1size, ' bytes.'
+         print *, '   String read:  ', in
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         err = 0
+         do 40 i=1, a1size
+           if (in(i:i) .ne. ar1(i:i)) err = 1
+ 40      continue
+         if (err .eq. 1) then
+           print *, '>>>Failure:  strings differ.'
+           print *, '   String written:  ', ar1
+           print *, '   String read:     ', in
+           nerrors = nerrors + 1
+         else
+           call MESSAGE(VERBO_HI,
+     +    'Success:  string read is the same as written.')
+        endif
+      endif
+      in(1:20) = '                    '
+
+      call MESSAGE(VERBO_MED, 'Testing dfnumber...')
+      nd = dfnumber(dfile, t255)
+      dfenum = dferrno()
+      if (nd .ne. 2) then
+         print *, '>>>Failure:'
+         print *, '   Saw ', nd, ' occurrances of tag 255 not than 2.'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfdesc...')
+      ret = dfdesc(dfile, dlist, 0, 5)
+      dfenum = dferrno()
+C
+C  add one for version tag
+C
+      if (ret .ne. (nd + 1)) then
+         print *, '>>>Failure:  Returned ', ret, ' rather than ', nd+1
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfupdate')
+      ret = dfupdate(dfile)
+      dfenum = dferrno()
+      if (ret .ne. 0) then
+         print *, '>>>Failure:'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfstat')
+      ret = dfstat(dfile, dfinfo)
+      dfenum = dferrno()
+      if (ret .ne. 0) then
+         print *, '>>>Failure:'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfnewref...')
+      ret = dfnewref(dfile)
+      dfenum = dferrno()
+      if (ret .ne. 4) then
+         print *, '>>>Failure:  Returned ref. ', ret, ' instead of 4'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfdup...')
+      ret = dfdup(dfile, 127, r7, t255, r3)
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         print *, '>>>Failure:'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         ret = dfnumber(dfile, t127)
+         dfenum = dferrno()
+      if (ret .ne. 1) then
+           print *, '>>>Failure:  duplicated tag not found.'
+           print *, '   DFerror = ', dfenum
+           nerrors = nerrors + 1
+      else
+           call MESSAGE(VERBO_HI, 'Success!')
+        endif
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfdel...')
+      ret = dfdel(dfile, t127, r7)
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         print *, '>>>Failure:'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         ret = dfnumber(dfile, t127)
+         dfenum = dferrno()
+         if (ret .ne. 0) then
+            print *, '>>>Failure:  found ', ret, ' deleted tags.'
+            print *, '   DFerror = ', dfenum
+            nerrors = nerrors + 1
+         else
+            call MESSAGE(VERBO_HI, 'Success!')
+       endif
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dfsfind...')
+      ret = dfsfind(dfile, 254, 0)
+      dfenum = dferrno()
+      if (ret .eq. -1) then
+         print *, '>>>Failure:'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      else
+         call MESSAGE(VERBO_HI, 'Success!')
+      endif
+
+      call MESSAGE(VERBO_MED, 'Testing dffind...')
+      ret = dfdup(dfile, 254, 4, 255, 3)
+      if (ret .ne. 0) then
+         print *, '>>>DFdup 1 failed.'
+      endif
+      ret = dfdup(dfile, 254, 5, 255, 3)
+      if (ret .ne. 0) then
+         print *, '>>>DFdup 2 failed.'
+      endif
+      ret = dfdup(dfile, 254, 6, 255, 3)
+      if (ret .ne. 0) then
+         print *, '>>>DFdup 3 failed.'
+      endif
+      do 200 i=4,6
+         ret = dffind(dfile, tag, ref, length)
+         dfenum = dferrno()
+         if (ret .eq. -1) then
+            print *, '>>>Failure on find #', i
+            print *, '   DFerror = ', dfenum
+            nerrors = nerrors + 1
+         else
+            if ((tag .ne. 254) .or. (ref .ne. i) .or.
+     +           (length .ne. a1size)) then
+               print *, '>>>Failure:  tag/ref found is not correct.'
+               print *, '   Looking for:'
+               print *, '      tag:      254'
+               print *, '      ref:    ', i
+               print *, '      length: ', a1size
+               print *, '   Found:'
+               print *, '      tag:    ', tag
+               print *, '      ref:    ', ref
+               print *, '      length: ', length
+               nerrors = nerrors + 1
+            else
+               call MESSAGE(VERBO_HI, 'Success!')
+            endif
+         endif
+ 200  continue
+
+      ret = dfclose(dfile)
+      dfenum = dferrno()
+      if (ret .ne. 0) then
+         print *, '>>>Failure:  dfclose failed (probably from open aid)'
+         print *, '   DFerror = ', dfenum
+         nerrors = nerrors + 1
+      endif
+
+      if (nerrors .ne. 0) then
+          print *, '   ', nerrors, ' errors were encountered.'
+      else
+          if (verbosity .ge. VERBO_HI) then
+             print *, '        >>> ALL TESTS PASSED <<<'
+          endif
+      endif
+
+      return
+      end
diff --git a/hdf/test/tszip.c b/hdf/test/tszip.c
new file mode 100644
index 0000000..233b399
--- /dev/null
+++ b/hdf/test/tszip.c
@@ -0,0 +1,1153 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ *  SZIP support eliminated for HDF4.2R1
+ */
+#include <hdf.h>
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+#include "tutils.h"
+
+
+/*
+ *  NOTE: these tests should be elaborated:
+ *     - use NN and EC options
+ *     - bigger datasets
+ *     - more data types
+ */     
+
+#define  FILE_NAME8     "RI_8_sziped.hdf"
+#define  FILE_NAME16    "RI_16_sziped.hdf"
+#define  FILE_NAME32    "RI_32_sziped.hdf"
+#define  FILE_NAMEfl32  "RI_fl32_sziped.hdf"
+#define  FILE_NAMEfl64  "RI_fl64_sziped.hdf"
+#define  WIDTH 		10    /* number of columns in the image */
+#define  LENGTH		6     /* number of rows in the image */
+#define  N_COMPS	3     /* number of components in the image */
+#define  IMAGE_NAME 	"Sziped_Image"
+
+/* 
+ * Sub-tests for test_mgr_szip():
+ *  test_szip_RI8bit()
+ *  test_szip_RI16bit()
+ *  test_szip_RI32bit()
+ *  test_szip_RIfl32bit()
+ *  test_szip_RIfl64bit()
+ *  test_szip_chunk()
+ */
+
+/* 
+ * Write/Read szip compressed image with 8-bit integer data
+ */
+static void 
+test_szip_RI8bit()
+{
+#ifdef H4_HAVE_LIBSZ
+   /************************* Variable declaration **************************/
+
+    intn  status;         /* status for functions returning an intn */
+    int32 file_id,        /* HDF file identifier */
+          gr_id,          /* GR interface identifier */
+          ri_id,       	  /* raster image identifier */
+          dim_sizes[2],   /* dimension sizes of the image array */
+          interlace_mode, /* interlace mode of the image */
+          data_type,      /* data type of the image data */
+          index;
+    int32 start[2],
+          edges[2];
+    uint32 comp_config;
+    comp_info cinfo;    /* Compression parameters - union */
+ 
+    comp_coder_t comp_type;
+    int8 out_data[LENGTH][WIDTH][N_COMPS];
+    int8 in_data[LENGTH][WIDTH][N_COMPS]    = {
+		10, 11, 12, 13, 14, 15, 40, 41, 42, 43, 44, 45,  0,
+                 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+		 0,  0,  0,  0, 20, 21, 22, 23, 24, 25, 50, 51, 52, 
+		53, 54, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0, 30, 31, 32, 33, 34, 
+		35, 60, 61, 62, 63, 64, 65,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 70, 71, 72, 
+		73, 74, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0, 80, 81, 82, 83, 84, 85,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0, 90, 91, 92, 93, 94, 95};
+
+
+    /********************** End of variable declaration **********************/
+
+    HCget_config_info(COMP_CODE_SZIP, &comp_config);
+    CHECK_VOID( (comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED),0, "SZIP Compression not available" );
+
+    /* Create and open the file for sziped data */
+    file_id = Hopen (FILE_NAME8, DFACC_CREATE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Set the data type, interlace mode, and dimensions of the image */
+    data_type = DFNT_INT8;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_sizes[0] = WIDTH;
+    dim_sizes[1] = LENGTH;
+
+    /* Create the raster image array */
+    ri_id = GRcreate (gr_id, IMAGE_NAME, N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+    CHECK_VOID(ri_id, FAIL, "GRcreate:Failed to create a raster image for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+
+    /* Initializate for SZIP */
+    comp_type = COMP_CODE_SZIP;
+    cinfo.szip.pixels_per_block = 2;
+    cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    cinfo.szip.pixels = 0;
+    cinfo.szip.pixels_per_scanline = 0;
+    cinfo.szip.bits_per_pixel = 0;
+
+    /* Set the compression */
+    status = GRsetcompress(ri_id, comp_type, &cinfo);
+    if ((comp_config & COMP_ENCODER_ENABLED) == COMP_ENCODER_ENABLED) {
+	/* should work */
+        CHECK_VOID(status, FAIL, "GRsetcompress");
+    } else {
+       /* skip rest of test?? */
+        /* Terminate access to the raster image */
+        status = GRendaccess (ri_id);
+        CHECK_VOID(status, FAIL, "GRendaccess");
+
+        /* Terminate access to the GR interface and close the HDF file */
+        status = GRend (gr_id);
+        CHECK_VOID(status, FAIL, "GRend");
+        status = Hclose (file_id);
+        CHECK_VOID(status, FAIL, "Hclose");
+        MESSAGE(1,printf("test_szip_RI8bit(): %s\n",SKIP_STR););
+       return;  
+    }
+
+    status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK_VOID(status, FAIL, "GRwriteimage");
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Terminate access to the GR interface and close the file to
+       flush the compressed info to the file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file */
+    file_id = Hopen (FILE_NAME8, DFACC_WRITE, 0); 
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Find the index of the specified image */
+    index = GRnametoindex(gr_id, IMAGE_NAME);
+    CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+    /* Select the image */
+    ri_id = GRselect(gr_id, index);
+    CHECK_VOID(ri_id, FAIL, "GRselect");
+
+    /* Get and verify the image's compression information */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo,  0, sizeof(cinfo)) ;
+
+    status = GRgetcompinfo(ri_id, &comp_type, &cinfo);
+    CHECK_VOID(status, FAIL, "GRgetcompinfo");
+    VERIFY_VOID(comp_type, COMP_CODE_SZIP, "GRgetcompinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the whole image */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+    status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK_VOID(status, FAIL, "GRreadimage");
+
+    /* Compare read data against input data */
+    if (0!= HDmemcmp(out_data, in_data, sizeof(in_data)))
+        printf("Error in reading the whole image \n" );
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Terminate access to the GR interface and close the HDF file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+#endif
+}  /* end of test_szip_RI8bit */
+
+/* 
+ * Write/Read szip compressed image with 16-bit integer data
+ */
+static void 
+test_szip_RI16bit()
+{
+#ifdef H4_HAVE_LIBSZ
+   /************************* Variable declaration **************************/
+
+    intn  status;         /* status for functions returning an intn */
+    int32 file_id,        /* HDF file identifier */
+          gr_id,          /* GR interface identifier */
+          ri_id,       	  /* raster image identifier */
+          dim_sizes[2],   /* dimension sizes of the image array */
+          interlace_mode, /* interlace mode of the image */
+          data_type,      /* data type of the image data */
+          index;
+    int32 start[2],
+          edges[2];
+    comp_info cinfo;    /* Compression parameters - union */
+    uint32 comp_config;
+    comp_coder_t comp_type;
+    int16 out_data[LENGTH][WIDTH][N_COMPS];
+    int16 in_data[LENGTH][WIDTH][N_COMPS]    = {
+		10, 11, 12, 13, 14, 15, 40, 41, 42, 43, 44, 45,  0,
+                 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+		 0,  0,  0,  0, 20, 21, 22, 23, 24, 25, 50, 51, 52, 
+		53, 54, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0, 30, 31, 32, 33, 34, 
+		35, 60, 61, 62, 63, 64, 65,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 70, 71, 72, 
+		73, 74, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0, 80, 81, 82, 83, 84, 85,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0, 90, 91, 92, 93, 94, 95};
+
+
+    /********************** End of variable declaration **********************/
+
+    HCget_config_info(COMP_CODE_SZIP, &comp_config);
+    CHECK_VOID( (comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED),0, "SZIP Compression not available" );
+
+    /* Create and open the file for sziped data */
+    file_id = Hopen (FILE_NAME16, DFACC_CREATE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Set the data type, interlace mode, and dimensions of the image */
+    data_type = DFNT_INT16;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_sizes[0] = WIDTH;
+    dim_sizes[1] = LENGTH;
+
+    /* Create the raster image array */
+    ri_id = GRcreate (gr_id, IMAGE_NAME, N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+    CHECK_VOID(ri_id, FAIL, "GRcreate:Failed to create a raster image for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+
+    /* Initializate for SZIP */
+    comp_type = COMP_CODE_SZIP;
+    cinfo.szip.pixels_per_block = 2;
+    cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    cinfo.szip.pixels = 0;
+    cinfo.szip.pixels_per_scanline = 0;
+    cinfo.szip.bits_per_pixel = 0;
+ 
+    /* Set the compression */
+    status = GRsetcompress(ri_id, comp_type, &cinfo);
+    if ((comp_config & COMP_ENCODER_ENABLED) == COMP_ENCODER_ENABLED) {
+	/* should work */
+       CHECK_VOID(status, FAIL, "GRsetcompress");
+    } else {
+       /* skip rest of test?? */
+        /* Terminate access to the raster image */
+        status = GRendaccess (ri_id);
+        CHECK_VOID(status, FAIL, "GRendaccess");
+
+        /* Terminate access to the GR interface and close the HDF file */
+        status = GRend (gr_id);
+        CHECK_VOID(status, FAIL, "GRend");
+        status = Hclose (file_id);
+        CHECK_VOID(status, FAIL, "Hclose");
+        MESSAGE(1,printf("test_szip_RI16bit(): %s\n",SKIP_STR););
+       return;  
+    }
+
+    status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK_VOID(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+   /* Terminate access to the GR interface and close the file to
+      flush the compressed info to the file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file */
+    file_id = Hopen (FILE_NAME16, DFACC_WRITE, 0); 
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Find the index of the specified image */
+    index = GRnametoindex(gr_id, IMAGE_NAME);
+    CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+    /* Select the image */
+    ri_id = GRselect(gr_id, index);
+    CHECK_VOID(ri_id, FAIL, "GRselect");
+
+    /* Get and verify the image's compression information */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo,  0, sizeof(cinfo)) ;
+
+    status = GRgetcompinfo(ri_id, &comp_type, &cinfo);
+    CHECK_VOID(status, FAIL, "GRgetcompinfo");
+    VERIFY_VOID(comp_type, COMP_CODE_SZIP, "GRgetcompinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the whole image */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+    status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK_VOID(status, FAIL, "GRreadimage");
+
+    /* Compare read data against input data */
+    if (0!= HDmemcmp(out_data, in_data, sizeof(in_data)))
+        printf("Error in reading the whole image \n" );
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Terminate access to the GR interface and close the HDF file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+#endif
+}  /* end of test_szip_RI16bit */
+
+/* 
+ * Write/Read szip compressed image with 32-bit integer data
+ */
+static void 
+test_szip_RI32bit()
+{
+#ifdef H4_HAVE_LIBSZ
+   /************************* Variable declaration **************************/
+
+    intn  status;         /* status for functions returning an intn */
+    int32 file_id,        /* HDF file identifier */
+          gr_id,          /* GR interface identifier */
+          ri_id,       	  /* raster image identifier */
+          dim_sizes[2],   /* dimension sizes of the image array */
+          interlace_mode, /* interlace mode of the image */
+          data_type,      /* data type of the image data */
+          index;
+    int32 start[2],
+          edges[2];
+    comp_info cinfo;    /* Compression parameters - union */
+    uint32 comp_config;
+    comp_coder_t comp_type;
+    int32 out_data[LENGTH][WIDTH][N_COMPS];
+    int32 in_data[LENGTH][WIDTH][N_COMPS]    = {
+		10, 11, 12, 13, 14, 15, 40, 41, 42, 43, 44, 45,  0,
+                 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+		 0,  0,  0,  0, 20, 21, 22, 23, 24, 25, 50, 51, 52, 
+		53, 54, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0, 30, 31, 32, 33, 34, 
+		35, 60, 61, 62, 63, 64, 65,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 70, 71, 72, 
+		73, 74, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0, 80, 81, 82, 83, 84, 85,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0, 90, 91, 92, 93, 94, 95};
+
+
+   /********************** End of variable declaration **********************/
+
+    HCget_config_info(COMP_CODE_SZIP, &comp_config);
+    CHECK_VOID( (comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED),0, "SZIP Compression not available" );
+
+    /* Create and open the file for sziped data */
+    file_id = Hopen (FILE_NAME32, DFACC_CREATE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Set the data type, interlace mode, and dimensions of the image */
+    data_type = DFNT_INT32;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_sizes[0] = WIDTH;
+    dim_sizes[1] = LENGTH;
+ 
+    /* Create the raster image array */
+    ri_id = GRcreate (gr_id, IMAGE_NAME, N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+    CHECK_VOID(ri_id, FAIL, "GRcreate:Failed to create a raster image for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+
+    /* Initializate for SZIP */
+    comp_type = COMP_CODE_SZIP;
+    cinfo.szip.pixels_per_block = 2;
+    cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    cinfo.szip.pixels = 0;
+    cinfo.szip.pixels_per_scanline = 0;
+    cinfo.szip.bits_per_pixel = 0;
+
+    /* Set the compression */
+    status = GRsetcompress(ri_id, comp_type, &cinfo);
+    if ((comp_config & COMP_ENCODER_ENABLED) == COMP_ENCODER_ENABLED) {
+	/* should work */
+       CHECK_VOID(status, FAIL, "GRsetcompress");
+    } else {
+       /* skip rest of test?? */
+        /* Terminate access to the raster image */
+        status = GRendaccess (ri_id);
+        CHECK_VOID(status, FAIL, "GRendaccess");
+
+        /* Terminate access to the GR interface and close the HDF file */
+        status = GRend (gr_id);
+        CHECK_VOID(status, FAIL, "GRend");
+        status = Hclose (file_id);
+        CHECK_VOID(status, FAIL, "Hclose");
+        MESSAGE(1,printf("test_szip_RI32bit(): %s\n",SKIP_STR););
+       return;  
+    }
+
+    status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK_VOID(status, FAIL, "GRwriteimage");
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+   /* Terminate access to the GR interface and close the file to
+      flush the compressed info to the file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file */
+    file_id = Hopen (FILE_NAME32, DFACC_WRITE, 0); 
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Find the index of the specified image */
+    index = GRnametoindex(gr_id, IMAGE_NAME);
+    CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+    /* Select the image */
+    ri_id = GRselect(gr_id, index);
+    CHECK_VOID(ri_id, FAIL, "GRselect");
+
+    /* Get and verify the image's compression information */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo,  0, sizeof(cinfo)) ;
+
+    status = GRgetcompinfo(ri_id, &comp_type, &cinfo);
+    CHECK_VOID(status, FAIL, "GRgetcompinfo");
+    VERIFY_VOID(comp_type, COMP_CODE_SZIP, "GRgetcompinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the whole image */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+    status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK_VOID(status, FAIL, "GRreadimage");
+
+    /* Compare read data against input data */
+    if (0!= HDmemcmp(out_data, in_data, sizeof(in_data)))
+        printf("Error in reading the whole image \n" );
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Terminate access to the GR interface and close the HDF file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+#endif
+}  /* end of test_szip_RI32bit */
+
+/* 
+ * Write/Read szip compressed image with 32-bit floating point data
+ */
+static void 
+test_szip_RIfl32bit()
+{
+#ifdef H4_HAVE_LIBSZ
+   /************************* Variable declaration **************************/
+
+    intn  status;         /* status for functions returning an intn */
+    int32 file_id,        /* HDF file identifier */
+          gr_id,          /* GR interface identifier */
+          ri_id,       	  /* raster image identifier */
+          dim_sizes[2],   /* dimension sizes of the image array */
+          interlace_mode, /* interlace mode of the image */
+          data_type,      /* data type of the image data */
+          index;
+    int32 start[2],
+          edges[2];
+    comp_info cinfo;    /* Compression parameters - union */
+    uint32 comp_config;
+
+    comp_coder_t comp_type;
+    float32 out_data[LENGTH][WIDTH][N_COMPS];
+    float32 in_data[LENGTH][WIDTH][N_COMPS]    = {
+		10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0,  0.0,
+                 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 
+		 0.0,  0.0,  0.0,  0.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 50.0, 51.0, 52.0, 
+		53.0, 54.0, 55.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 30.0, 31.0, 32.0, 33.0, 34.0, 
+		35.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 70.0, 71.0, 72.0, 
+		73.0, 74.0, 75.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0, 90.0, 91.0, 92.0, 93.0, 94.0, 95.0};
+
+
+   /********************** End of variable declaration **********************/
+
+    HCget_config_info(COMP_CODE_SZIP, &comp_config);
+    CHECK_VOID( (comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED),0, "SZIP Compression not available" );
+
+    /* Create and open the file for sziped data */
+    file_id = Hopen (FILE_NAMEfl32, DFACC_CREATE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Set the data type, interlace mode, and dimensions of the image */
+    data_type = DFNT_FLOAT32;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_sizes[0] = WIDTH;
+    dim_sizes[1] = LENGTH;
+
+    /* Create the raster image array */
+    ri_id = GRcreate (gr_id, IMAGE_NAME, N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+    CHECK_VOID(ri_id, FAIL, "GRcreate:Failed to create a raster image for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+
+    /* Initializate for SZIP */
+    comp_type = COMP_CODE_SZIP;
+    cinfo.szip.pixels_per_block = 2;
+
+    cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    cinfo.szip.pixels = 0;
+    cinfo.szip.pixels_per_scanline = 0;
+    cinfo.szip.bits_per_pixel = 0;
+ 
+    /* Set the compression */
+    status = GRsetcompress(ri_id, comp_type, &cinfo);
+    if ((comp_config & COMP_ENCODER_ENABLED) == COMP_ENCODER_ENABLED) {
+	/* should work */
+       CHECK_VOID(status, FAIL, "GRsetcompress");
+    } else {
+       /* skip rest of test?? */
+        /* Terminate access to the raster image */
+        status = GRendaccess (ri_id);
+        CHECK_VOID(status, FAIL, "GRendaccess");
+
+        /* Terminate access to the GR interface and close the HDF file */
+        status = GRend (gr_id);
+        CHECK_VOID(status, FAIL, "GRend");
+        status = Hclose (file_id);
+        CHECK_VOID(status, FAIL, "Hclose");
+        MESSAGE(1,printf("test_szip_RIfl32bit(): %s\n",SKIP_STR););
+       return;  
+    }
+
+    status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK_VOID(status, FAIL, "GRwriteimage");
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+   /* Terminate access to the GR interface and close the file to
+      flush the compressed info to the file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file */
+    file_id = Hopen (FILE_NAMEfl32, DFACC_WRITE, 0); 
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Find the index of the specified image */
+    index = GRnametoindex(gr_id, IMAGE_NAME);
+    CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+    /* Select the image */
+    ri_id = GRselect(gr_id, index);
+    CHECK_VOID(ri_id, FAIL, "GRselect");
+
+    /* Get and verify the image's compression information */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo,  0, sizeof(cinfo)) ;
+
+    status = GRgetcompinfo(ri_id, &comp_type, &cinfo);
+    CHECK_VOID(status, FAIL, "GRgetcompinfo");
+    VERIFY_VOID(comp_type, COMP_CODE_SZIP, "GRgetcompinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the whole image */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+    status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK_VOID(status, FAIL, "GRreadimage");
+
+    /* Compare read data against input data */
+    if (0!= HDmemcmp(out_data, in_data, sizeof(in_data)))
+        printf("Error in reading the whole image \n" );
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Terminate access to the GR interface and close the HDF file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+#endif
+}  /* end of test_szip_RIfl32bit */
+
+/* 
+ * Write/Read szip compressed image with 64-bit floating point data
+ */
+static void 
+test_szip_RIfl64bit()
+{
+#ifdef H4_HAVE_LIBSZ
+   /************************* Variable declaration **************************/
+
+    intn  status;         /* status for functions returning an intn */
+    int32 file_id,        /* HDF file identifier */
+          gr_id,          /* GR interface identifier */
+          ri_id,       	  /* raster image identifier */
+          dim_sizes[2],   /* dimension sizes of the image array */
+          interlace_mode, /* interlace mode of the image */
+          data_type,      /* data type of the image data */
+          index;
+    int32 start[2],
+          edges[2];
+    comp_info cinfo;    /* Compression parameters - union */
+    uint32 comp_config;
+    comp_coder_t comp_type;
+    float64 out_data[LENGTH][WIDTH][N_COMPS];
+    float64 in_data[LENGTH][WIDTH][N_COMPS]    = {
+		10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0,  0.0,
+                 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 
+		 0.0,  0.0,  0.0,  0.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 50.0, 51.0, 52.0, 
+		53.0, 54.0, 55.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 30.0, 31.0, 32.0, 33.0, 34.0, 
+		35.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0, 70.0, 71.0, 72.0, 
+		73.0, 74.0, 75.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0, 80.0, 81.0, 82.0, 83.0, 84.0, 85.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  0.0,  
+		 0.0,  0.0,  0.0,  0.0,  0.0, 90.0, 91.0, 92.0, 93.0, 94.0, 95.0};
+
+
+    /********************** End of variable declaration **********************/
+
+    HCget_config_info(COMP_CODE_SZIP, &comp_config);
+    CHECK_VOID( (comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED),0, "SZIP Compression not available" );
+
+    /* Create and open the file for sziped data */
+    /* Create and open the file for sziped data */
+    file_id = Hopen (FILE_NAMEfl64, DFACC_CREATE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Set the data type, interlace mode, and dimensions of the image */
+    data_type = DFNT_FLOAT64;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_sizes[0] = WIDTH;
+    dim_sizes[1] = LENGTH;
+ 
+    /* Create the raster image array */
+    ri_id = GRcreate (gr_id, IMAGE_NAME, N_COMPS, data_type, 
+                     interlace_mode, dim_sizes);
+    CHECK_VOID(ri_id, FAIL, "GRcreate:Failed to create a raster image for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+ 
+    /* Initializate for SZIP */
+    comp_type = COMP_CODE_SZIP;
+    cinfo.szip.pixels_per_block = 2;
+ 
+    cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    cinfo.szip.pixels = 0;
+    cinfo.szip.pixels_per_scanline = 0;
+    cinfo.szip.bits_per_pixel = 0;
+
+    /* Set the compression */
+    status = GRsetcompress(ri_id, comp_type, &cinfo);
+    if ((comp_config & COMP_ENCODER_ENABLED) == COMP_ENCODER_ENABLED) {
+	/* should work */
+       CHECK_VOID(status, FAIL, "GRsetcompress");
+    } else {
+       /* skip rest of test?? */
+        /* Terminate access to the raster image */
+        status = GRendaccess (ri_id);
+        CHECK_VOID(status, FAIL, "GRendaccess");
+
+        /* Terminate access to the GR interface and close the HDF file */
+        status = GRend (gr_id);
+        CHECK_VOID(status, FAIL, "GRend");
+        status = Hclose (file_id);
+        CHECK_VOID(status, FAIL, "Hclose");
+        MESSAGE(1,printf("test_szip_RIfl64bit(): %s\n",SKIP_STR););
+       return;  
+    }
+
+    status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK_VOID(status, FAIL, "GRwriteimage");
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Terminate access to the GR interface and close the file to
+      flush the compressed info to the file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file */
+    file_id = Hopen (FILE_NAMEfl64, DFACC_WRITE, 0); 
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Find the index of the specified image */
+    index = GRnametoindex(gr_id, IMAGE_NAME);
+    CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+    /* Select the image */
+    ri_id = GRselect(gr_id, index);
+    CHECK_VOID(ri_id, FAIL, "GRselect");
+
+    /* Get and verify the image's compression information */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo,  0, sizeof(cinfo)) ;
+
+    status = GRgetcompinfo(ri_id, &comp_type, &cinfo);
+    CHECK_VOID(status, FAIL, "GRgetcompinfo");
+    VERIFY_VOID(comp_type, COMP_CODE_SZIP, "GRgetcompinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the whole image */
+    start[0] = start[1] = 0;
+    edges[0] = WIDTH;
+    edges[1] = LENGTH;
+    status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK_VOID(status, FAIL, "GRreadimage");
+
+    /* Compare read data against input data */
+    if (0!= HDmemcmp(out_data, in_data, sizeof(in_data)))
+        printf("Error in reading the whole image \n" );
+
+    /* Terminate access to the raster image */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+
+    /* Terminate access to the GR interface and close the HDF file */
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+#endif
+}  /* end of test_szip_RIfl64bit */
+
+/*
+* This function tests GR chunking write/read operations for the
+* szip compressions
+*/                    
+#define  CHKSZIPFILE	"RIchunkedsziped.hdf"
+#define  WIDTH_CH	10    /* number of columns in the image */
+#define  LENGTH_CH	 6    /* number of rows in the image */
+
+static void 
+test_szip_chunk()
+{
+#ifdef H4_HAVE_LIBSZ
+
+    /************************* Variable declaration **************************/
+
+    intn  status;         /* status for functions returning an intn */
+    int32 file_id,        /* HDF file identifier */
+          gr_id,          /* GR interface identifier */
+          ri_id,       /* raster image identifier */
+          origin[2],      /* start position to write for each dimension */
+          dim_sizes[2],   /* dimension sizes of the image array */
+          interlace_mode, /* interlace mode of the image */
+          data_type,      /* data type of the image data */
+          comp_flag,      /* compression flag */
+          index;
+    int32 start[2],
+          stride[2],
+          edge[2];
+    comp_info cinfo_out;    /* Compression parameters - union */
+    uint32 comp_config;
+    comp_coder_t comp_type;
+    int8 data_out[N_COMPS*LENGTH_CH*WIDTH_CH];
+    char *image_name = "Image_chunked_sziped";
+    HDF_CHUNK_DEF chunk_def;
+    int8 chunk_buf[18];
+
+    /* 
+     * Initialize data for RI
+     */
+    int8 chunk00[] = {10, 11, 12, 13, 14, 15,
+                      20, 21, 22, 23, 24, 25,
+                      30, 31, 32, 33, 34, 35 };
+ 
+ 
+    int8 chunk01[] = {40, 41, 42, 43, 44, 45,
+                      50, 51, 52, 53, 54, 55,
+                      60, 61, 62, 63, 64, 65};
+ 
+    int8 chunk14[] = {70, 71, 72, 73, 74, 75,
+                      80, 81, 82, 83, 84, 85,
+                      90, 91, 92, 93, 94, 95};
+
+    int8 data[]    = {
+		10, 11, 12, 13, 14, 15, 40, 41, 42, 43, 44, 45,  0,
+                 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 
+		 0,  0,  0,  0, 20, 21, 22, 23, 24, 25, 50, 51, 52, 
+		53, 54, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0, 30, 31, 32, 33, 34, 
+		35, 60, 61, 62, 63, 64, 65,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 70, 71, 72, 
+		73, 74, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0, 80, 81, 82, 83, 84, 85,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  
+		 0,  0,  0,  0,  0, 90, 91, 92, 93, 94, 95};
+
+
+    /********************** End of variable declaration **********************/
+
+    HCget_config_info(COMP_CODE_SZIP, &comp_config);
+    CHECK_VOID( (comp_config & COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED),0, "SZIP Compression not available" );
+
+    /* Create and open the file for chunked and sziped data. */
+    file_id = Hopen (CHKSZIPFILE, DFACC_CREATE, 0);
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface. */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+
+    /* Set the data type, interlace mode, and dimensions of the image. */
+    data_type = DFNT_INT8;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_sizes[0] = LENGTH_CH;
+    dim_sizes[1] = WIDTH_CH;
+ 
+    /* Create the raster image array. */
+    ri_id = GRcreate (gr_id, image_name, N_COMPS, data_type, 
+                      interlace_mode, dim_sizes);
+    CHECK_VOID(ri_id, FAIL, "GRcreate");
+ 
+    /* Create chunked image array. */
+    comp_flag = HDF_CHUNK | HDF_COMP;
+    chunk_def.comp.chunk_lengths[0] = 3;
+    chunk_def.comp.chunk_lengths[1] = 2;
+    chunk_def.comp.comp_type = COMP_CODE_SZIP;
+    chunk_def.comp.cinfo.szip.pixels_per_block = 2;
+
+    chunk_def.comp.cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    chunk_def.comp.cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    chunk_def.comp.cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    chunk_def.comp.cinfo.szip.pixels = 0;
+    chunk_def.comp.cinfo.szip.pixels_per_scanline = 0;
+    chunk_def.comp.cinfo.szip.bits_per_pixel = 0;
+ 
+    status = GRsetchunk(ri_id, chunk_def, comp_flag);
+    if ((comp_config & COMP_ENCODER_ENABLED) == COMP_ENCODER_ENABLED) {
+	/* should work */
+       CHECK_VOID(status, FAIL, "GRsetchunk");
+    } else {
+       /* skip rest of test?? */
+        /* Terminate access to the raster image */
+        status = GRendaccess (ri_id);
+        CHECK_VOID(status, FAIL, "GRendaccess");
+
+        /* Terminate access to the GR interface and close the HDF file */
+        status = GRend (gr_id);
+        CHECK_VOID(status, FAIL, "GRend");
+        status = Hclose (file_id);
+        CHECK_VOID(status, FAIL, "Hclose");
+        MESSAGE(1,printf("test_szip_chunk(): %s\n",SKIP_STR););
+       return;  
+    }
+
+    /* Write first data chunk ( 0, 0 ). */
+    origin[0] = origin[1] = 0;
+    status = GRwritechunk(ri_id, origin, (VOIDP)chunk00);
+    CHECK_VOID(status, FAIL, "GRwritechunk");
+ 
+    /* Write second data chunk ( 0, 1 ). */
+    origin[0] = 0; origin[1] = 1;
+    status = GRwritechunk(ri_id, origin, (VOIDP)chunk01);
+    CHECK_VOID(status, FAIL, "GRwritechunk");
+
+    /* Write third data chunk ( 1, 4 ). */
+    origin[0] = 1; origin[1] = 4;
+    status = GRwritechunk(ri_id, origin, (VOIDP)chunk14);
+    CHECK_VOID(status, FAIL, "GRwritechunk");
+
+    /* Terminate accesses and close the HDF file. */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file.  */
+    file_id = Hopen (CHKSZIPFILE, DFACC_WRITE, 0); 
+    CHECK_VOID(file_id, FAIL, "Hopen");
+
+    /* Initialize the GR interface. */
+    gr_id = GRstart (file_id);
+    CHECK_VOID(gr_id, FAIL, "GRstart");
+ 
+    /* Find the index of the specified image. */
+    index = GRnametoindex(gr_id, image_name);
+    CHECK_VOID(index, FAIL, "GRnametoindex");
+   
+    /* Select the image. */
+    ri_id = GRselect(gr_id, index);
+    CHECK_VOID(ri_id, FAIL, "GRselect");
+
+    /* Get and verify the image's compression information. */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo_out,  0, sizeof(cinfo_out)) ;
+
+    status = GRgetcompinfo(ri_id, &comp_type, &cinfo_out);
+    CHECK_VOID(status, FAIL, "GRgetcompinfo");
+    VERIFY_VOID(comp_type, COMP_CODE_SZIP, "GRgetcompinfo");
+
+    /* Read first chunk back and compare with input chunk. */
+    origin[0] = 0; origin[1] = 0;
+    status = GRreadchunk(ri_id, origin, (VOIDP)chunk_buf);
+    CHECK_VOID(status, FAIL, "GRreadchunk");
+    if (0 != HDmemcmp(chunk_buf, chunk00 , sizeof(chunk00)))
+    {
+	printf("Error in reading chunk 00\n" );
+        num_errs++;
+    }
+
+    /* Read second chunk back and compare with input chunk. */
+    origin[0] = 0; origin[1] = 1;
+    status = GRreadchunk(ri_id, origin, (VOIDP)chunk_buf);
+    CHECK_VOID(status, FAIL, "GRreadchunk");
+    if (0 != HDmemcmp(chunk_buf, chunk01 , sizeof(chunk01)))
+    {
+        printf("Error in reading chunk 01\n" );
+        num_errs++;
+    }
+
+    /* Read third chunk back and compare with input chunk. */
+    origin[0] = 1; origin[1] = 4;
+    status = GRreadchunk(ri_id, origin, (VOIDP)chunk_buf);
+    CHECK_VOID(status, FAIL, "GRreadchunk");
+    if (0 != HDmemcmp(chunk_buf, chunk14 , sizeof(chunk14)))
+    {
+        printf("Error in reading chunk 14\n" );
+        num_errs++;
+    }
+
+    /* Read the whole image. */
+    start[0] = start[1] = 0;
+    stride[0] = stride[1] = 1;
+    edge[0] = LENGTH_CH;
+    edge[1] = WIDTH_CH;
+    status = GRreadimage(ri_id, start, stride, edge, (VOIDP)data_out);
+    CHECK_VOID(status, FAIL, "GRreadimage");
+    if (0!= HDmemcmp(data_out, data, sizeof(data)))
+    {
+        printf("Error in reading the whole image \n" );
+        num_errs++;
+    }
+
+    /* Terminate accesses and close the HDF file. */
+    status = GRendaccess (ri_id);
+    CHECK_VOID(status, FAIL, "GRendaccess");
+    status = GRend (gr_id);
+    CHECK_VOID(status, FAIL, "GRend");
+    status = Hclose (file_id);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+#endif
+}  /* end of test_szip_chunk */
+
+/****************************************************************
+ * 
+ *   test_mgr_szip(): SZIP Compression tests
+ * 
+ *   XIV. GR write/read szip compression tests with different data types
+ *        and with chunked data
+ *       A. Write/Read szip compressed image with 8-bit integer data type
+ *       B. Write/Read szip compressed image with 16-bit integer data type
+ *       C. Write/Read szip compressed image with 32-bit integer data type
+ *       D. Write/Read szip compressed image with 32-bit floating point data type
+ *       E. Write/Read szip compressed image with 64-bit floating point data type
+ *       F. Write/Read image with chunked and sziped data
+ * 
+ * ****************************************************************/
+extern void
+test_mgr_szip()
+{
+#ifdef H4_HAVE_LIBSZ
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Testing GR szip compression WRITE/READ\n"););
+
+    test_szip_RI8bit();
+    test_szip_RI16bit();
+    test_szip_RI32bit();
+    test_szip_RIfl32bit();
+    test_szip_RIfl64bit();
+    test_szip_chunk();
+#else
+    /* Output message about test being performed */
+    MESSAGE(6, printf("Skipping GR szip compression WRITE/READ\n"););
+#endif
+} 
diff --git a/hdf/test/tusejpegfuncs.c b/hdf/test/tusejpegfuncs.c
new file mode 100644
index 0000000..3cb3c0c
--- /dev/null
+++ b/hdf/test/tusejpegfuncs.c
@@ -0,0 +1,236 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * The test functions in this file are derived from an example included in   *
+ * the JPEG package by The Independent JPEG Group                            *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <stdio.h>
+#include "jpeglib.h"
+#include "tproto.h"
+
+#define ABS(x)  ((int)(x)<0 ? (-x) : x)
+
+/************************************************************************
+   Name: comp_using_jpeglib() - compresses a buffer using JPEG functions
+
+   Description:
+        This routine uses functions from the JPEG library directly to
+	compress the provided image buffer and writes the compressed image
+	to the specified file.
+   Return value:
+        The number of errors occurred in this routine.
+   Apr 11, 2011 -BMR
+*************************************************************************/
+intn comp_using_jpeglib(
+	char *filename,		/* file to write compressed data in */
+	long *file_offset,	/* end offset of previous data and indicating where
+				   to start writing data in this round */
+	int im_height,		/* image's height */
+	int im_width,		/* image's width */
+	int im_ncomps,		/* image's number of components */
+	int quality,		/* JPEG quality value */
+	uint8 *written_buffer)	/* data to be compressed */
+{
+    FILE * outfile;		/* target file */
+    JSAMPROW row_pointer[1];	/* pointer to JSAMPLE row[s] */
+    int row_stride;		/* physical row width in image buffer */
+
+    /* JPEG object for JPEG compression parameters and pointers to working space
+       (which is allocated as needed by the JPEG library). */ 
+    struct jpeg_compress_struct cinfo;
+
+    /* This struct represents a JPEG error handler.  It is declared separately
+     * because applications often want to supply a specialized error handler
+     * (see the second half of this file for an example).  But here we just
+     * take the easy way out and use the standard error handler, which will
+     * print a message on stderr and call exit() if compression fails.
+     * Note that this struct must live as long as the main JPEG parameter
+     * struct, to avoid dangling-pointer problems.
+     */
+    struct jpeg_error_mgr jerr;
+  
+    /* Initialize JPEG compression object */
+  
+    /* We have to set up the error handler first, in case the initialization
+     * step fails.  (Unlikely, but it could happen if you are out of memory.)
+     * This routine fills in the contents of struct jerr, and returns jerr's
+     * address which we place into the link field in cinfo.
+     */
+    cinfo.err = jpeg_std_error(&jerr);
+  
+    /* Initialize the JPEG compression object. */
+    jpeg_create_compress(&cinfo);
+  
+    /* Open the output file to write binary data */
+    if ((outfile = fopen(filename, "ab")) == NULL)
+    {
+      fprintf(stderr, "can't open %s\n", filename);
+      exit(1);
+    }
+
+    /* Forward to the position to write data */
+    if (fseek(outfile, (off_t)*file_offset, SEEK_SET) == -1)
+    {
+        fprintf(stderr, "can't seek offset %d\n", (int)*file_offset);
+        exit(1);
+    }
+
+    /* Specify output file */
+    jpeg_stdio_dest(&cinfo, outfile);
+  
+    /* Set parameters for compression */
+  
+    /* Supply a description of the input image.
+     * Four fields of the cinfo struct must be filled in:
+     */
+    cinfo.image_width = im_width; 	/* image width and height, in pixels */
+    cinfo.image_height = im_height;
+    cinfo.input_components = im_ncomps;/* # of color components per pixel */
+    cinfo.in_color_space = JCS_RGB; 	/* colorspace of input image */
+  
+    /* Set default compression parameters.  At least cinfo.in_color_space must
+       be set before calling jpeg_set_defaults, since the defaults depend on the
+       source color space */
+    jpeg_set_defaults(&cinfo);
+
+    /* Set quality (quantization table) scaling */
+    jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
+
+    /* Start compressor */
+
+    /* TRUE ensures that we will write a complete interchange-JPEG file.
+     * From JPEG: Pass TRUE unless you are very sure of what you're doing. */
+    jpeg_start_compress(&cinfo, TRUE);
+
+    row_stride = im_width * im_ncomps;/* JSAMPLEs per row in written_buffer */
+
+    /* While there are more scan line in the buffer */
+    while (cinfo.next_scanline < cinfo.image_height)
+    {
+    /* jpeg_write_scanlines expects an array of pointers to scanlines.
+     * Here the array is only one element long, but you could pass
+     * more than one scanline at a time if that's more convenient.
+     */
+	row_pointer[0] = &written_buffer[cinfo.next_scanline * row_stride];
+	(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
+    }
+
+    /* Finish compression */
+    jpeg_finish_compress(&cinfo);
+
+    /* Get the current file offset to return */
+    *file_offset = ftell(outfile);
+
+    /* Close the file */
+    fclose(outfile);
+
+    /* Release JPEG compression object */
+    /* This is an important step since it will release a good deal of memory. */
+    jpeg_destroy_compress(&cinfo);
+
+    return 0;
+} /* comp_using_jpeglib */
+
+/***************************************************************************
+   Name: decomp_using_jpeglib() - decompresses a buffer using JPEG functions
+
+   Description:
+        This routine uses functions from the JPEG library directly to
+	decompress the data read from the specified file and store the
+	uncompressed data in the provided buffer.
+   Return value:
+        The number of errors occurred in this routine.
+   Apr 11, 2011 -BMR
+****************************************************************************/
+intn decomp_using_jpeglib(
+	char *filename,		/* file to read compressed data from */
+	long file_offset,	/* offset in the file to start reading */
+	int im_height,		/* image's height */
+	int im_width,		/* image's width */
+	int im_ncomps,		/* image's number of components */
+	uint8 *read_buffer)	/* buffer to store decompressed data */
+{
+    /* This struct contains the JPEG decompression parameters and pointers to
+     * working space (which is allocated as needed by the JPEG library).
+     */
+    struct jpeg_decompress_struct cinfo; /* JPEG compression info */
+    struct jpeg_error_mgr jerr_pub; /* JPEG error handler */
+    FILE * infile;	/* source file */
+    JSAMPARRAY buffer;	/* Output row buffer */
+    int row_stride;	/* physical row width in output buffer */
+    uint8 *local_buf = NULL, *ptr = NULL;
+
+    /* Open the output file to write binary data */
+    if ((infile = fopen(filename, "rb")) == NULL)
+    {
+	fprintf(stderr, "can't open %s\n", filename);
+	exit(1);
+    }
+
+    /* Forward to the specified position to write data */
+    if (fseek(infile, (off_t)file_offset, SEEK_SET) == -1)
+    {
+        fprintf(stderr, "can't seek offset %d\n", (int)file_offset);
+        exit(1);
+    }
+
+    /* Allocate local buffer to hold read values until all reading is done
+       before copying into caller's buffer */
+    local_buf = HDmalloc(im_height * im_width * im_ncomps * sizeof(uint8));
+    CHECK_ALLOC(local_buf, "local_buf", "decomp_using_jpeglib" );
+
+    /* Set up the JPEG error routines */
+    cinfo.err = jpeg_std_error(&jerr_pub);
+
+    /* Initialize the JPEG decompression object. */
+    jpeg_create_decompress(&cinfo);
+
+    /* Specify input file */
+    jpeg_stdio_src(&cinfo, infile);
+
+    /* Read file parameters */
+    (void) jpeg_read_header(&cinfo, TRUE);
+    /* We can ignore the return value from jpeg_read_header since
+     *   (a) suspension is not possible with the stdio data source, and
+     *   (b) we passed TRUE to reject a tables-only JPEG file as an error.
+     * See libjpeg.doc for more info.
+     */
+
+    /* Start decompressor */
+    (void) jpeg_start_decompress(&cinfo);
+    /* the return value is ignored here since suspension is not possible
+     * with the stdio data source (from JPEG example) */
+
+    /* Number of values per row */
+    row_stride = cinfo.output_width * cinfo.output_components;
+
+    /* Make a one-row-high array to read a row of values,  JSAMPLEs per row */
+    buffer = (*cinfo.mem->alloc_sarray)
+		((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
+
+    ptr = local_buf; /* index into the buffer */
+
+    /* Read each scanline until all are read */
+    while (cinfo.output_scanline < cinfo.output_height)
+    {
+	/* jpeg_read_scanlines expects an array of pointers to scanlines. */
+	(void) jpeg_read_scanlines(&cinfo, buffer, 1);
+
+	/* Saved read line to the local buffer */
+	memcpy(ptr, buffer[0], row_stride); 
+	ptr = ptr + row_stride;
+    }
+
+    /* Copying values from local buffer to caller's buffer after success */
+    memcpy(read_buffer, local_buf, im_height*im_width*im_ncomps);
+    HDfree(local_buf);
+
+    /* Finish decompression */
+    (void) jpeg_finish_decompress(&cinfo);
+
+    /* Release JPEG decompression object */
+    jpeg_destroy_decompress(&cinfo);
+
+    /* Close the file */
+    fclose(infile);
+
+    return 0;
+} /* decomp_using_jpeglib */
diff --git a/hdf/test/tutils.c b/hdf/test/tutils.c
new file mode 100644
index 0000000..cc82658
--- /dev/null
+++ b/hdf/test/tutils.c
@@ -0,0 +1,91 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf.h"
+#include "tutils.h"
+
+intn fuzzy_memcmp(const void *s1, const void *s2, int32 len, intn fuzz_factor)
+{
+    const uint8 *t1 = (const uint8 *) s1;
+    const uint8 *t2 = (const uint8 *) s2;
+
+    while (len > 0 && (int) ABS(*t2 - *t1) <= fuzz_factor)
+      {
+          t1++;
+          t2++;
+          len--;
+      }     /* end while */
+    if (len == 0)
+        return (0);
+    else
+      {
+          return ((intn) (*t1 - *t2));
+      }
+}   /* end fuzzy_memcmp() */
+
+void print_mismatched(const void *s1, const void *s2, int32 size2cmp)
+{
+    int ii, jj, nn=0, kk;
+    const uint8 *t1 = (const uint8 *) s1;
+    const uint8 *t2 = (const uint8 *) s2;
+
+    for (ii = 0; ii < size2cmp; ii++)
+      {
+        if (ABS(*t1 - *t2) > 0)
+            fprintf(stderr, "item#%d: HDF(%d) - JPEG(%d)\n", ii, *t1, *t2);
+          t1++;
+          t2++;
+      }
+}
+
+/* Generate the correct name for the test file, by prepending the source path
+   if it exists, otherwise, assume it is the local directory */
+   /* NOTE: should move all utilities into mfutil.c or something like that */
+intn make_datafilename(char* basename, char* testfile, unsigned int size)
+{
+    char *srcdir = getenv("srcdir");
+    char *tempfile = NULL;
+
+    tempfile = (char *) HDmalloc(sizeof(char *) * (size+1));
+    HDmemset(tempfile, '\0', size+1);
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(basename) + 1) < size))
+    {
+        strcpy(tempfile, srcdir);
+        strcat(tempfile, "/");
+    }
+
+    /* Windows doesn't set srcdir, and generates files in a different relative
+       path, so we need to special case here.  It is best to look for the
+       testfile in the same path, and the Windows test script will make sure
+       to put it there first.  - SJW 2007/09/19 (from tnetcdf.c) */
+#ifndef _WIN32
+    /* This is to get to the file when the library was built without srcdir
+       option and the test is ran by ./hdftest in the test src directory
+       instead of by make check.  - BMR 2007/08/09 */
+    if (srcdir == NULL)
+        strcpy(tempfile, "./");
+#endif /* _WIN32 */
+
+    /* Name of data file */
+    strcat(tempfile, basename);
+
+    /* Verify that file name is not NULL */
+    if (tempfile == NULL || tempfile[0] == '\0')
+        return FAIL;
+
+    /* File name is generated, return it */
+    HDstrcpy(testfile, tempfile);
+    return SUCCEED;
+}
diff --git a/hdf/test/tutils.h b/hdf/test/tutils.h
new file mode 100644
index 0000000..478659c
--- /dev/null
+++ b/hdf/test/tutils.h
@@ -0,0 +1,139 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: tutils.h 6036 2014-01-20 17:28:01Z acheng $ */
+
+#ifndef _TUTILS_H
+#define _TUTILS_H
+
+/* Define these for use in all the tests */
+#ifndef TESTMASTER
+extern
+#endif
+int         num_errs
+#ifdef TESTMASTER
+= 0
+#endif
+,           Verbosity
+#ifdef TESTMASTER
+= 0
+#endif
+           ;
+
+/* Use %ld to print the value because long could cover most cases. */
+/* Used to make certain a return value _is_not_ a value.  If not ture, */
+/* print error messages, increment num_err and return. */
+#define CHECK(ret, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",where,(int)__LINE__,__FILE__,(long)ret);\
+if(ret == val) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, (int)__LINE__,__FILE__); num_errs++; return num_errs;} \
+} while(0)
+
+#define CHECK_VOID(ret, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",where,(int)__LINE__,__FILE__,(long)ret);\
+if(ret == val) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, (int)__LINE__,__FILE__); num_errs++; return;} \
+} while(0)
+
+/* Same as CHECK except no return but continue. */
+#define CHECK_CONT(ret, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",where,(int)__LINE__,__FILE__,(long)ret);\
+if(ret == val) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, (int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+/* If values match, display message supplied by caller. */
+#define CHECK_STATUS(status, val, msg) \
+do { if(status == val) printf("   %s failed at line %4d in %s\n", msg,(int)__LINE__,__FILE__);\
+} while(0)
+
+/* Used to validate that 'buffer' has been successfully allocated */
+#define CHECK_ALLOC(buffer, buf_name, func_name ) { \
+      if (buffer == NULL) {\
+         fprintf(stderr,"in %s: space allocation for %s failed.  Terminated!\n",\
+                func_name, buf_name ); \
+         exit(1); }  \
+}
+
+/* Used to make certain a return value _is_ a value */
+#define VERIFY(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %ld \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(x != val) {printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++; return(num_errs);} \
+} while(0)
+
+/* Same as VERIFY except return without a value. */
+#define VERIFY_VOID(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %ld \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(x != val) {printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++; return;} \
+} while(0)
+
+/* Same as VERIFY except no return but continue. */
+#define VERIFY_CONT(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %ld \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(x != val) {printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+/* Same as VERIFY except that the value has type char* */
+#define VERIFY_CHAR(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %s \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(HDstrcmp(x, val) != 0) {printf("*** UNEXPECTED VALUE from %s is %s at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++; return(num_errs);} \
+} while(0)
+
+/* Same as VERIFY_CHAR except return without a value. */
+#define VERIFY_CHAR_VOID(x, val, where) \
+do {if (Verbosity>9) printf("   Call to HDF routine: %15s at line %4d in %s had value %s \n",where,(int)__LINE__,__FILE__,(long)x);\
+if(HDstrncmp(x, val, HDstrlen(val)) != 0) {printf("*** UNEXPECTED VALUE from %s is %s at line %4d in %s\n", where, (long)x,(int)__LINE__,__FILE__); num_errs++; return;} \
+} while(0)
+
+#define RESULT(a) \
+do { \
+if (Verbosity>8) printf("   Call to HDF routine: %15s at line %4d in %s returned %ld \n",a,(int)__LINE__,__FILE__,(long)ret); \
+if (Verbosity>9) HEprint(stdout,0); \
+if(ret == FAIL) {printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", a, (long)ret,(int)__LINE__,__FILE__); num_errs++;} \
+} while(0)
+
+#define MESSAGE(v,a) {if (Verbosity>v) {a}}
+
+/* definitions for command strings */
+#define VERBOSITY_STR	"Verbosity"
+#define SKIP_STR	"Skip"
+#define TEST_STR	"Test"
+#define CLEAN_STR	"Cleanup"
+
+/* Output notices */
+#define H4_PASSED()        {puts(" PASSED");fflush(stdout);}
+#define H4_FAILED()        {puts("*FAILED*");fflush(stdout);}
+#define H4_WARNING()       {puts("*WARNING*");fflush(stdout);}
+#define H4_SKIPPED()       {puts(" -SKIP-");fflush(stdout);}
+
+/* Definition for JPEG tests */
+#ifdef DEC_ALPHA
+#define JPEG_FUZZ 13
+#else
+#define JPEG_FUZZ 1
+#endif
+
+#define ABS(x)  ((int)(x)<0 ? (-x) : x)
+
+intn fuzzy_memcmp(const void *s1, const void *s2, int32 len, intn fuzz_factor);
+void print_mismatched(const void *s1, const void *s2, int32 size2cmp);
+
+/* Generate the correct name for the test file, by prepending the source path
+   if it exists, otherwise, assume it is the local directory */
+intn make_datafilename(char* basename, char* testfile, unsigned int size);
+
+/* System command to use for Cleanup */
+#   ifdef _WIN32
+#   define CLEAN_CMD  "del *.hdf"   
+#   else
+/* default is Unix */
+#   define CLEAN_CMD	"rm -f *.hdf"
+#   endif  /* _WIN32  */
+#endif /* _TUTILS_H */
diff --git a/hdf/test/tv1.res b/hdf/test/tv1.res
new file mode 100644
index 0000000..77623ff
--- /dev/null
+++ b/hdf/test/tv1.res
@@ -0,0 +1,50 @@
+#
+# NOTE:  This file was generated on a machine where the size of
+#   local ints and floats is 4 bytes.  On machines with different
+#   sizes the 'vsize=X' entries will be different.
+#
+
+FULL DUMP
+
+FILE: tv1.hdf
+
+vg:0 <1965/2> (test_vgroup#0 {}) has 0 entries:
+
+vg:1 <1965/3> (test_vgroup#1 {}) has 0 entries:
+
+vg:2 <1965/4> (test_vgroup#2 {}) has 0 entries:
+
+vg:3 <1965/5> (test_vgroup#3 {}) has 0 entries:
+
+vg:4 <1965/6> (test_vgroup#4 {}) has 0 entries:
+Lone vdatas:
+L vs:7 <1962/7> nv=5 i=0 fld [PRESS] vsize=4 (vdata#0 {})
+0: fld [PRESS], type=5, order=1
+500.000000  501.000000  504.000000  509.000000  516.000000  
+
+L vs:8 <1962/8> nv=10 i=0 fld [PRESS] vsize=4 (vdata#1 {})
+0: fld [PRESS], type=5, order=1
+1000.000000  1001.000000  1004.000000  1009.000000  1016.000000  1025.000000  
+1036.000000  1049.000000  1064.000000  1081.000000  
+
+L vs:9 <1962/9> nv=15 i=0 fld [PRESS] vsize=4 (vdata#2 {})
+0: fld [PRESS], type=5, order=1
+1500.000000  1501.000000  1504.000000  1509.000000  1516.000000  1525.000000  
+1536.000000  1549.000000  1564.000000  1581.000000  1600.000000  1621.000000  
+1644.000000  1669.000000  1696.000000  
+
+L vs:10 <1962/10> nv=20 i=0 fld [PRESS] vsize=4 (vdata#3 {})
+0: fld [PRESS], type=5, order=1
+2000.000000  2001.000000  2004.000000  2009.000000  2016.000000  2025.000000  
+2036.000000  2049.000000  2064.000000  2081.000000  2100.000000  2121.000000  
+2144.000000  2169.000000  2196.000000  2225.000000  2256.000000  2289.000000  
+2324.000000  2361.000000  
+
+L vs:11 <1962/11> nv=25 i=0 fld [PRESS] vsize=4 (vdata#4 {})
+0: fld [PRESS], type=5, order=1
+2500.000000  2501.000000  2504.000000  2509.000000  2516.000000  2525.000000  
+2536.000000  2549.000000  2564.000000  2581.000000  2600.000000  2621.000000  
+2644.000000  2669.000000  2696.000000  2725.000000  2756.000000  2789.000000  
+2824.000000  2861.000000  2900.000000  2941.000000  2984.000000  3029.000000  
+3076.000000  
+
diff --git a/hdf/test/tv2.res b/hdf/test/tv2.res
new file mode 100644
index 0000000..859fcc8
--- /dev/null
+++ b/hdf/test/tv2.res
@@ -0,0 +1,14 @@
+
+FILE: tv2a.hdf
+
+vg:0 <1965/2> (ALASKA {FIGURES}) has 3 entries:
+  vs:0 <1962/3> nv=20 i=0 fld [DOLLARS] vsize=4 (GNP {FIGURES})
+  vs:1 <1962/4> nv=20 i=0 fld [DOLLARS] vsize=4 (INCOME {FIGURES})
+  vs:2 <1962/5> nv=20 i=0 fld [DOLLARS] vsize=4 (SALESTAX {FIGURES})
+
+FILE: tv2b.hdf
+
+vg:0 <1965/2> (MISSISSIPPI {FIGURES}) has 3 entries:
+  vs:0 <1962/3> nv=15 i=0 fld [DOLLARS] vsize=4 (GNP {FIGURES})
+  vs:1 <1962/4> nv=15 i=0 fld [DOLLARS] vsize=4 (INCOME {FIGURES})
+  vs:2 <1962/5> nv=15 i=0 fld [DOLLARS] vsize=4 (SALESTAX {FIGURES})
diff --git a/hdf/test/tvattr.c b/hdf/test/tvattr.c
new file mode 100644
index 0000000..b6b6e5f
--- /dev/null
+++ b/hdf/test/tvattr.c
@@ -0,0 +1,855 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5912 $";
+#endif
+
+/* $Id: tvattr.c 5912 2013-01-24 23:30:00Z bmribler $ */
+
+/**************************************************************
+*
+* tvattr.c
+*
+* This program tests routines in hdf/src/vattr.c.  Those routines
+*  set or change attributes for a vgroup, a vdata or a field of 
+*  a vdata; get info about an attribute; read values of an attr.
+*
+* create_vset_stuff() creates 1 empty vgroup and 1 vgroup having 1 
+*  vdata. write_vattr() adds attributes to the vgroups, vdata and
+*  the fields of the vdata. It then creates new vdata and vgroup,
+*  and adds attrs to them.  read_vattr reads the attributes back,
+*  and check their correctness.  
+*
+* test_readattrtwice: tests the fix of bugzilla #486, which a 
+*	subsequent read of an attribute failed. - BMR - Dec, 2005.
+*
+**************************************************************/
+#include "hdf.h"
+#include "tproto.h"
+#include "vg.h"
+#include <math.h>
+
+#define FILENAME   "tvattr.hdf"
+#define VGNAME0    "vgname0"
+#define VGNAME1    "vgname1"
+#define VGNAME2    "vgname2"
+#define VSNAME0    "vsname0"
+#define VSNAME1    "vsname1"
+#define VSNAME2    "vsname2"
+#define VSCLASS0   "vsclass0"
+#define VGCLASS2   "vgclass2"
+#define FLDNAME0   "fldname0"
+#define FLDNAME1   "fldname1"
+#define FLDNAME2   "fldname2"
+#define FLDNAMES   "fldname0,fldname1"
+#define FLDNAMES_1 "fldname1,fldname2"
+#define N_RECS     3
+#define ATTNAME1   "attname1"
+#define ATTNAME2   "attname2"
+#define ATTNAME3   "attname3"
+#define ATTNAME4   "attname4"
+#define ATTNAME5   "attname5"
+#define ATTNAME6   "attname6"
+#define ATTNAME7   "attname7"
+#define ATTNAME8   "attname8"
+#define ATTNAME9   "attname9"
+#define ATTNAME10  "attname10"
+#define EPS64     (float64)1.0E-14
+#define EPS32     (float32)1.0E-7
+#define MAX_HDF4_NAME_LENGTH 256
+
+int32 data1[6]={0,-1,10,11,20,21}, idata1[6];
+char  data2[6] = {'A','B','C','D','E','F'}, idata2[6];
+uint16 attr2[2] = {16, 32}, iattr2[2];
+uint32 attr1[4] = {100, 132, 10032, 10064}, iattr1[2];
+char   attr3[6] = {'m','N','p', 'S', 't', '\0'}, iattr3[6];
+float32 attr4[2] = {(float32)32.001, (float32)-34.002}, iattr4[2];
+float64 attr5[2] = {64.12345, -64.12345}, iattr5[2];
+
+static intn create_vset_stuff(void);
+static intn write_vattrs(void);
+static intn read_vattrs(void);
+static void test_readattrtwice(void);
+
+/* create vdatas and vgroups */
+
+static intn create_vset_stuff(void)
+{
+   int32 fid, vgid, vsid;
+
+   if (FAIL == (fid = Hopen(FILENAME, DFACC_CREATE, 0))) {
+         num_errs++;
+         return FAIL;
+      } 
+   if (Vstart(fid) == FAIL)  {
+         num_errs++;
+         return FAIL;
+      } 
+   /* Vgroup Generation */
+   if (FAIL == (vgid = (Vattach(fid, -1, "w"))))   {
+         num_errs++;
+         return FAIL;
+      } 
+   if (FAIL == Vsetname(vgid, VGNAME0)) {
+         num_errs++;
+         return FAIL;
+      } 
+   if (FAIL == Vdetach(vgid)) {
+         num_errs++;
+         return FAIL;
+      } 
+   /* create a vgroup and a vdata, insert the vdata into the vgroup */
+   if (FAIL == (vgid = (Vattach(fid, -1, "w"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vsetname(vgid, VGNAME1)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == (vsid = (VSattach(fid, -1, "w"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSsetname(vsid, VSNAME1)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSfdefine(vsid, FLDNAME1, DFNT_CHAR8, 1)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSfdefine(vsid, FLDNAME2, DFNT_CHAR8, 1)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSsetfields(vsid, FLDNAMES_1)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (N_RECS != VSwrite(vsid, (unsigned char *)data2, N_RECS, FULL_INTERLACE)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vinsert(vgid, vsid)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSdetach(vsid)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vdetach(vgid)) {
+         num_errs++;
+         return FAIL;
+      }
+   /* close the file */
+   if (FAIL == Vend(fid))  {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Hclose(fid)) {
+         num_errs++;
+         return FAIL;
+      }
+   return SUCCEED;
+} /* create_vset_stuff */
+
+/* test attribute routines */
+static intn write_vattrs(void)
+{
+   int32 fid, vgid, vsid;
+   int32 vsref, vgref;
+   int32 fldindex, vsversion;
+   intn  n_flds;
+   
+    /* add attrs to the 1 vg */
+   if (FAIL == (fid = Hopen(FILENAME, DFACC_RDWR, -1))) {
+         num_errs++;
+         return FAIL;
+      }
+   if (Vstart(fid) == FAIL)  {
+         num_errs++;
+         return FAIL;
+      }
+
+   if (FAIL == (vgref = Vgetid(fid, -1)))  {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == (vgid = Vattach(fid, vgref, "w")))  {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vsetattr(vgid, ATTNAME1, DFNT_UINT32, 2, attr1)) {
+         num_errs++;
+         printf(">>> Vsetattr1 failed\n");
+      }
+   /* change data type of existing attr, should fail */
+   if (FAIL != Vsetattr(vgid, ATTNAME1, DFNT_UINT16, 2, attr2)) {
+         num_errs++;
+         printf(">>> Vsetattr1 changes attr type, should failed\n");
+      }
+   /* change order of existing attr, should fail */
+   if (FAIL != Vsetattr(vgid, ATTNAME1, DFNT_UINT32, 1, attr1)) {
+         num_errs++;
+         printf(">>> Vsetattr changes attr order, should failed\n");
+      }
+   /* change values of existing attr */
+   if (FAIL == Vsetattr(vgid, ATTNAME1, DFNT_UINT32, 2, &attr1[2])) {
+       num_errs++;
+       printf(">>> Vsetattr failed in changing attr values.\n");
+      }
+
+   if (FAIL == Vsetattr(vgid, ATTNAME2, DFNT_UINT16, 2, attr2)) { 
+         num_errs++;
+         printf(">>> Vsetattr2 failed\n");
+      }
+   if (FAIL == Vdetach(vgid)) {
+         num_errs++;
+         return FAIL;
+      }
+   /* add attr to vdata */
+   if (FAIL == (vsref = VSfind(fid, VSNAME1)))  {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == (vsid = VSattach(fid, vsref, "w")))  {
+         num_errs++;
+         return FAIL;
+      }
+   if (VSET_VERSION != (vsversion = VSgetversion(vsid))) {
+         num_errs++;
+         printf(">>> Wrong version, should be 3, got %d \n", (int)vsversion);
+      }
+   /* check number of fields */
+   if (2 != (n_flds = VFnfields(vsid)))  {
+         num_errs++;
+         printf(">>> Wrong number of fields, should be 2, got %d.\n",
+                      n_flds);
+      }
+   /* search for non-existing field  */
+   if (FAIL != VSfindex(vsid, FLDNAME0, &fldindex)) {
+         num_errs++;
+         printf(">>> Search for non-existing field, should fail.\n");
+      }
+   if (FAIL == VSsetattr(vsid, _HDF_VDATA, ATTNAME3, DFNT_CHAR8, 3, attr3)) {
+         num_errs++;
+         printf(">>> VSsetattr3 failed\n");
+      }
+   if (FAIL == VSfindex(vsid, FLDNAME1, &fldindex) ||
+       fldindex != 0) {
+         num_errs++;
+         printf(">>> VSfindex  failed in search for FLDNAME1 .\n");
+      }
+   if (FAIL == VSsetattr(vsid, 0, ATTNAME4, DFNT_FLOAT32,1, attr4)) {
+         num_errs++;
+         printf(">>> VSsetattr4 failed\n");
+      }
+   if (FAIL == VSfindex(vsid, FLDNAME2, &fldindex) ||
+       fldindex != 1) { 
+         num_errs++;
+         printf(">>> VSfindex  failed in search for FLDNAME2 .\n");
+      }
+   if (FAIL == VSsetattr(vsid, 1, ATTNAME5, DFNT_FLOAT32,1, attr4)) {
+         num_errs++;
+         printf(">>> VSsetattr5 failed\n");
+      }
+   if (FAIL != VSsetattr(vsid, 2, ATTNAME3, DFNT_CHAR8,5, attr3)) {
+         num_errs++;
+         printf(">>> Set attr for non-existing field, should fail\n");
+      }
+   if (FAIL != VSsetattr(vsid, -2, ATTNAME3, DFNT_CHAR8,5, attr3)) {
+         num_errs++;
+         printf(">>> Set attr for non-existing field, should fail\n");
+      }
+
+   /* set same attr name to different fields */
+   if (FAIL == VSsetattr(vsid, _HDF_VDATA, ATTNAME4, DFNT_FLOAT32,1, attr4)) {
+         num_errs++;
+         printf(">>> VSsetattr6 failed\n");
+      }
+   if (FAIL == VSsetattr(vsid, 0, ATTNAME5, DFNT_FLOAT64,1, attr5)) {
+         num_errs++;
+         printf(">>> VSsetattr5 failed\n");
+      }
+   /* create an attribute with the same name as an existing vdata */
+   if (FAIL == VSsetattr(vsid, 0, VSNAME1, DFNT_FLOAT64,1, attr5)) {
+         num_errs++;
+         printf(">>> VSsetattr7 failed\n");
+      }
+   if (VSET_NEW_VERSION != (vsversion = VSgetversion(vsid))) {
+         num_errs++;
+         printf(">>> Wrong version, should be 4, got %d \n", (int)vsversion);
+      }
+   /* change datatype of existing attr, should fail */
+   if (FAIL != VSsetattr(vsid, 0, ATTNAME5, DFNT_FLOAT32,1, attr4)) {
+         num_errs++;
+         printf(">>> VSsetattr changes attr type, should fail.\n");
+      }
+   /* change order of existing attr, should fail */
+   if (FAIL != VSsetattr(vsid, 0, ATTNAME5, DFNT_FLOAT64,2, attr5)) {
+         num_errs++;
+         printf(">>> VSsetattr changes attr order, should fail.\n");
+      }
+   /* change values of existing attr */
+   if (FAIL == VSsetattr(vsid, 0, ATTNAME5, DFNT_FLOAT64,1, &attr5[1])) {
+         num_errs++;
+         printf(">>> VSsetattr failed in changing attr values.\n");
+      }
+   if (FAIL == VSdetach(vsid)) {
+         num_errs++;
+         return FAIL;
+      }
+
+     /* create lone vdata  and add attributes to it */
+   if (FAIL == (vsid = (VSattach(fid, -1, "w"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSsetname(vsid, VSNAME0)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSfdefine(vsid, FLDNAME0, DFNT_INT32, 1)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSfdefine(vsid, FLDNAME1, DFNT_INT32, 1)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSsetfields(vsid, FLDNAMES)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (N_RECS != VSwrite(vsid, (unsigned char *)data1, N_RECS, 
+       FULL_INTERLACE)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == VSfindex(vsid, FLDNAME0, &fldindex)) {
+         num_errs++;
+         printf(">>> VSfindex failed in searching for FLDNAME0.\n");
+      }
+   if (FAIL == VSsetattr(vsid, 0, ATTNAME6, DFNT_FLOAT32,1, attr4)) {
+         num_errs++;
+         printf(">>> VSsetattr6 failed\n");
+      }
+
+   if (FAIL == VSsetattr(vsid, _HDF_VDATA, ATTNAME7, DFNT_CHAR8,3, attr3)) {
+         num_errs++;
+         printf(">>> VSsetattr7 failed\n");
+      }
+   if (FAIL == VSfindex(vsid, FLDNAME1, &fldindex) ||
+       fldindex != 1) {
+         num_errs++;
+         printf(">>> VSfindex  failed in searching for FLDNAME1.\n");
+      }
+   if (FAIL == VSsetattr(vsid, 0, ATTNAME8, DFNT_FLOAT32,1, attr4)) {
+         num_errs++;
+         printf(">>> VSsetattr8 failed\n");
+      }
+  if (FAIL == VSdetach(vsid)) {
+         num_errs++;
+         return FAIL;
+      }
+  /* attach again, and modify attr */
+  if (FAIL == (vsref = VSfind(fid, VSNAME0)))  {
+         num_errs++;
+         return FAIL;
+      }
+  if (FAIL == (vsid = VSattach(fid, vsref, "w")))  {
+         num_errs++;
+         return FAIL;
+      }
+  if (FAIL == VSsetclass(vsid, VSCLASS0)) {
+         num_errs++;
+         return FAIL;
+      }
+  if (FAIL == VSsetattr(vsid, 1, ATTNAME8, DFNT_FLOAT32,1, &attr4[1])) {
+         num_errs++;
+         printf(">>> VSsetattr failed in modifying attr8.\n");
+      }
+  if (FAIL == VSsetattr(vsid, 0, ATTNAME9, DFNT_CHAR8,5, attr3)) {
+         num_errs++;
+         printf(">>> VSsetattr9  field. \n");
+      }
+  if (FAIL == VSdetach(vsid)) {
+         num_errs++;
+         return FAIL;
+  }
+  /* attach again with "r" access to test VSsetattr on "r" access vdata 
+     BMR - Nov 4, 2004 */
+  if (FAIL == (vsref = VSfind(fid, VSNAME0)))  {
+         num_errs++;
+         return FAIL;
+      }
+  if (FAIL == (vsid = VSattach(fid, vsref, "r")))  {
+         num_errs++;
+         return FAIL;
+      }
+  if (FAIL != VSsetattr(vsid, 1, "NO ATTRIBUTE", DFNT_FLOAT32,1, &attr4[1])) {
+         num_errs++;
+         printf(">>> VSsetattr did not fail on read access vdata.\n");
+      }
+  if (FAIL == VSdetach(vsid)) {
+         num_errs++;
+         return FAIL;
+  }
+   /* create vgroup and add attrs */
+   if (FAIL == (vgid = (Vattach(fid, -1, "w"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vsetname(vgid, VGNAME2)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vaddtagref(vgid, DFTAG_VH, vsref))  {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vsetclass(vgid, VGCLASS2)) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vdetach(vgid)) {
+         num_errs++;
+         return FAIL;
+      }
+   /* attach again, add attr */
+   if (FAIL == (vgref = Vfind(fid, VGNAME2)))   {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == (vgid = (Vattach(fid, vgref, "w"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Vsetattr(vgid, ATTNAME9, DFNT_UINT32, 1, attr1)) {
+         num_errs++;
+         printf(">>> Vsetattr1 failed\n");
+      }
+   /* change data type of existing attr, should fail */
+   if (FAIL != Vsetattr(vgid, ATTNAME9, DFNT_UINT16, 1, attr2)) {
+         num_errs++;
+         printf(">>> Vsetattr changes attr type, should failed\n");
+      }
+   if (FAIL == Vsetattr(vgid, ATTNAME10, DFNT_UINT16, 2, attr2)) {
+         num_errs++;
+         printf(">>> Vsetattr1 failed\n");
+      }
+   if (FAIL == Vdetach(vgid)) {
+         num_errs++;
+         printf(">>> Vdetach failed in vgname2.\n");
+      }
+
+   if (FAIL == Vend(fid))   {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == Hclose(fid))  {
+         num_errs++;
+         return FAIL;
+      }
+   return SUCCEED;
+}  /* write_vattr */
+
+/*  Test reading routines */
+static intn read_vattrs(void)
+{
+   int32 fid, vgid, vsid, vgref, vsref;
+   intn n_vgattrs, n_vsattrs, n_fldattrs;
+   intn  iattrindex, ret;
+   int32 i_type, i_count, i_size, iversion;
+   char iattrname[FIELDNAMELENMAX+1];
+
+   if (FAIL == (fid = Hopen(FILENAME, DFACC_RDONLY, 0))) {
+         num_errs++;
+         return FAIL;
+      }
+   if (Vstart(fid) == FAIL)  {
+         num_errs++;
+         return FAIL;
+      }
+   /* Read vgroup attrs first */
+   if (FAIL == (vgref = Vfind(fid, VGNAME0))) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == (vgid = (Vattach(fid, vgref, "r"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if ((iversion = Vgetversion(vgid)) < VSET_NEW_VERSION) {
+         num_errs++;
+         printf(">>> Wrong Vgroup version, should be %d, got %d.\n", 
+                      VSET_NEW_VERSION, (int)iversion); 
+      }
+   if (FAIL == (n_vgattrs = Vnattrs(vgid)) || n_vgattrs != 2) {
+         num_errs++;
+         printf(">>> Wrong num of Vgroup0 attrs, should be %d, got %d.\n", 
+                 2, n_vgattrs);
+   }
+   if (0 != (iattrindex = Vfindattr(vgid, ATTNAME1)))  {
+         num_errs++;
+         printf(">>> attname1 should be 0th attr of vgname0, ");
+         printf("not %d.\n", iattrindex);
+      }
+   if (FAIL == Vattrinfo(vgid,0,iattrname,&i_type,&i_count,&i_size) ||
+       HDstrncmp(iattrname, ATTNAME1, HDstrlen(ATTNAME1)) != 0 ||
+       i_type != DFNT_UINT32 || i_count != 2 ||
+       i_size != i_count * DFKNTsize(DFNT_UINT32 | DFNT_NATIVE))   {
+         num_errs++;
+         printf(">>> Wrong attrinfo for attname1 of vgname0; \
+             got %s %d %d %d.\n", iattrname, (int)i_type,(int)i_count,(int)i_size);
+      }
+   if (FAIL == Vgetattr(vgid, 0, iattr1) ||
+       iattr1[0] != attr1[2] || iattr1[1] != attr1[3])  {
+         num_errs++;
+         printf(">>> Wrong values for attname1 of vgname0; ");
+         printf("got %u %u, should be %u %u.\n", (unsigned)iattr1[0],
+             (unsigned)iattr1[1], (unsigned)attr1[2], (unsigned)attr1[3]);
+      }
+
+   if (FAIL == Vattrinfo(vgid,1,iattrname,&i_type,&i_count,&i_size) ||
+       HDstrncmp(iattrname, ATTNAME2,HDstrlen(ATTNAME2)) != 0 ||
+       i_type != DFNT_UINT16 || i_count != 2 ||
+       i_size != i_count * DFKNTsize(DFNT_UINT16 | DFNT_NATIVE))   {
+         num_errs++;
+         printf(">>> Wrong attrinfo for attname2 of vgname0; \
+            got %s %d %d %d.\n", iattrname, (int)i_type,(int)i_count,(int)i_size);
+      }
+   if (FAIL == Vgetattr(vgid, 1, iattr2) ||
+       iattr2[0] != attr2[0] || iattr2[1] != attr2[1])  {
+         num_errs++;
+         printf(">>> Wrong values for attname2 of vgname0; \
+                     got %u %u, should be %u %u.\n",
+                     iattr2[0], iattr2[1], attr2[0], attr2[1]);
+      }
+   if (FAIL == Vdetach(vgid))  {
+         num_errs++;
+         printf(">>>Vdetach failed in vgname0.\n");
+   }
+   /* VGNAME1 has no attr */
+   if (FAIL == (vgref = Vfind(fid, VGNAME1))) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == (vgid = (Vattach(fid, vgref, "r"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if ((iversion = Vgetversion(vgid)) != VSET_VERSION) {
+         num_errs++;
+         printf(">>> Wrong Vgroup version, should be %d, got %d.\n",
+                      VSET_VERSION, (int)iversion);
+      }
+   if (FAIL == (n_vgattrs = Vnattrs(vgid)) || n_vgattrs != 0) {
+         num_errs++;
+         printf(">>> Wrong num of Vgroup1 attrs, should be %d, got %d.\n",
+             0, n_vgattrs);
+   }
+   if (FAIL == Vdetach(vgid))  {
+         num_errs++;
+         printf(">>>Vdetach failed in detaching vgname1.\n");
+   }
+   /* VSNAME0 has 5 attrs */
+   if (FAIL == (vsref = VSfind(fid, VSNAME0))) {
+       num_errs++;
+       return FAIL;
+      }
+   if (FAIL == (vsid = (VSattach(fid, vsref, "r"))))   {
+       num_errs++;
+       return FAIL;
+      }
+   if ((iversion = VSgetversion(vsid)) != VSET_NEW_VERSION) {
+       num_errs++;
+       printf(">>> Wrong Vdata version, should be %d, got %d.\n",
+                      VSET_NEW_VERSION, (int)iversion);
+      }
+   if (FAIL == (n_vsattrs = VSnattrs(vsid)) || n_vsattrs != 5) {
+       num_errs++;
+       printf(">>> Wrong num of Vsname0 attrs, should be %d, got %d.\n",
+                 5, n_vsattrs);
+   }
+   /* get num of attrs of fld 1 */
+   if (FAIL == (n_fldattrs = VSfnattrs(vsid, 1)) || n_fldattrs != 1) {
+        num_errs++;
+        printf(">>> Wrong num of Vsname0 fld 1 attrs, ");
+        printf("should be %d, got %d.\n ", 1, n_vsattrs);
+   }
+   /* read the 3rd attr of fld 0. The attr is char type. */
+   if ((FAIL == VSattrinfo(vsid, 0, 2, iattrname,
+               &i_type, &i_count, &i_size)) ||
+               (HDstrcmp(iattrname, ATTNAME9) != 0) ||
+               (i_type != DFNT_CHAR8) ||
+               (i_count != 5) || (i_size != 5)) {
+        num_errs++;
+        printf(">>> Wrong attrinfo for attname9 of vsname0 fld0; ");
+        printf(" got  %s %d %d %d.\n", iattrname, (int)i_type,
+                 (int)i_count, (int)i_size);
+   }
+   if (FAIL == VSgetattr(vsid, 0, 2, iattr3) ||
+       iattr3[0] != attr3[0] || iattr3[1] != attr3[1] ||
+       iattr3[2] != attr3[2] || iattr3[3] != attr3[3] ||
+       iattr3[4] != attr3[4] )  {
+         num_errs++;
+         printf(">>> Wrong values for attname9  of vsname0; \
+                     got %5s, should be %5s.\n",
+                     iattr3, attr3);
+   }
+   if (FAIL == VSdetach(vsid))  {
+       num_errs++;
+       printf(">>>Vsdetach failed in vsname0.\n");
+   }
+   /* VSNAME1 has 2 attrs, fld0  has 3 and fld1 has 1 attr */
+   if (FAIL == (vsref = VSfind(fid, VSNAME1))) {
+         num_errs++;
+         return FAIL;
+      }
+   if (FAIL == (vsid = (VSattach(fid, vsref, "r"))))   {
+         num_errs++;
+         return FAIL;
+      }
+   if ((iversion = VSgetversion(vsid)) != VSET_NEW_VERSION) {
+         num_errs++;
+         printf(">>> Wrong Vdata version, should be %d, got %d.\n",
+                      VSET_NEW_VERSION, (int)iversion);
+      }
+   if (FAIL == (n_vsattrs = VSnattrs(vsid)) || n_vsattrs != 6) {
+         num_errs++;
+         printf(">>> Wrong num of Vsname1 attrs, should be %d, ",6);
+         printf("got %d.\n", n_vsattrs);
+   }
+   if (FAIL == (n_fldattrs = VSfnattrs(vsid, _HDF_VDATA)) || n_fldattrs != 2) {
+        num_errs++;
+        printf(">>> Wrong num of Vsname1 vdata attrs, ");
+        printf("should be %d, got %d.\n ", 2, n_fldattrs);
+   }
+   /* look for non-existing attr, should fail */
+   if (FAIL != (iattrindex = VSfindattr(vsid, _HDF_VDATA, ATTNAME9))) {
+        num_errs++;
+        printf(">>> attname9 is not an attr of vdata vsname1, ");
+        printf(" should fail.\n");
+   }
+   /* use wrong findex, should fail */
+   if (FAIL != (iattrindex = VSfindattr(vsid, 3, ATTNAME9))) {
+        num_errs++;
+        printf(">>> Vdata vsname1 has only 2 fields, ");
+        printf(" should fail.\n");
+   }
+   /* use wrong findex, should fail */
+   if (FAIL != VSattrinfo(vsid, 4, 0, NULL, &i_type, &i_count,
+                          &i_size)) {
+        num_errs++;
+        printf(">>> Vdata vsname1 has only 2 fields, should fail.\n");
+   }
+   /* use wrong attrindex, should fail */
+   if (FAIL != VSattrinfo(vsid, 1, 3, iattrname, &i_type, &i_count, NULL)) {
+        num_errs++;
+        printf(">>> Field1 of vsname1 has only 1 attr, should fail.\n");
+   }
+   /* use wrong findex, should fail */
+   if (FAIL != VSgetattr(vsid, 4, 0, iattr1)) {
+        num_errs++;
+        printf(">>> Vdata vsname1 has only 2 fields, should fail.\n");
+   }
+   /* use wrong attrindex, should fail */
+   if (FAIL != VSgetattr(vsid, 1, 3, iattr1)) {
+        num_errs++;
+        printf(">>> Field1 of vsname1 has only 1 attr, should fail.\n");
+   }
+
+   /* get the 2nd attr  */
+   if ((FAIL == (iattrindex = VSfindattr(vsid, _HDF_VDATA, ATTNAME4))) ||
+             (iattrindex != 1))  {
+        num_errs++;
+        printf(">>> attname4 should be index 1 of vsname1, not %d.\n",
+                     iattrindex);
+   }
+   if ((FAIL == VSattrinfo(vsid, _HDF_VDATA, iattrindex, iattrname, 
+               &i_type, &i_count, &i_size)) || 
+               (HDstrcmp(iattrname, ATTNAME4) != 0) ||
+               (i_type != DFNT_FLOAT32) || (i_count != 1) || 
+               (i_size != DFKNTsize(DFNT_FLOAT | DFNT_NATIVE))) {
+        num_errs++;
+        printf(">>> Wrong attrinfo for attname4 of vdata vsname1; ");
+        printf(" got  %s %d %d.\n", iattrname, (int)i_type,(int)i_count);
+   }
+   if (FAIL == VSgetattr(vsid, _HDF_VDATA, 1, iattr4) ||
+       (fabs((double)(iattr4[0] - attr4[0])) > fabs((double)(attr4[0]*EPS32))))  {
+         num_errs++;
+         printf(">>> Wrong values for attname4  of vsname1; \
+                     got %f, should be %f.\n",
+                     iattr4[0], attr4[0]);
+   }
+   if (FALSE != VSisattr(vsid)) {
+      num_errs++;
+      printf(">>> VSisattr failed. Vsname1 is not attribute vdata.\n"); 
+   }
+   /* get  the 3rd attr of fld0. The attr name is VSNAME1 */
+   if ((FAIL == (iattrindex = VSfindattr(vsid, 0, VSNAME1))) ||
+             (iattrindex != 2))  {
+        num_errs++;
+        printf(">>> VSNAME1 should be index 2 of fld 0 of vsname1,");
+        printf("  not %d.\n", iattrindex);
+   }
+   if ((FAIL == VSattrinfo(vsid, 0, iattrindex, iattrname,
+               &i_type, &i_count, &i_size)) ||
+               (HDstrcmp(iattrname, VSNAME1) != 0) ||
+               (i_type != DFNT_FLOAT64) || (i_count != 1) || 
+               (i_size != DFKNTsize(DFNT_FLOAT64 | DFNT_NATIVE))) {
+        num_errs++;
+        printf(">>> Wrong attrinfo for VSNAME1 of fld 0 of vdata vsname1; ");
+        printf(" got  %s %d %d.\n", iattrname, (int)i_type,(int)i_count);
+   }
+   if (FAIL == VSgetattr(vsid, 0, 2, iattr5) ||
+       (fabs((double)(iattr5[0] - attr5[0])) > fabs((double)(attr5[0]*EPS64))) )  {
+         num_errs++;
+         printf(">>> Wrong values for attr VSNAME1  of fld 0 of vsname1; \
+                     got %f, should be %f.\n",
+                     iattr5[0], attr5[0]);
+   }
+   if (FAIL == VSdetach(vsid))  {
+      num_errs++;
+      printf(">>>VSdetach failed in vsname1.\n");
+   }
+   /* test VSisattr for attr vdata */
+   if (FAIL == (vsref = VSfind(fid, ATTNAME10))) {
+       num_errs++;
+       return FAIL;
+      }
+   if (FAIL == (vsid = (VSattach(fid, vsref, "r"))))   {
+       num_errs++;
+       return FAIL;
+      }
+   if (TRUE != VSisattr(vsid)) {
+      num_errs++;
+      printf(">>> VSisattr failed. ATTNAME10 is an attribute vdata.\n");
+   }
+   if (VSET_VERSION != (iversion = VSgetversion(vsid)))  {
+        num_errs++;
+        printf(">>> Wrong vdata version. ATTNAME10 should be of ");
+        printf(" %d, got %d\n", VSET_VERSION, (int)iversion);
+   }
+   ret = VSdetach(vsid);
+   CHECK(ret, FAIL, "VSdetach");
+   ret = Vend(fid);
+   CHECK(ret, FAIL, "Vend");
+   ret = Hclose(fid);
+   CHECK(ret, FAIL, "Hclose");  
+
+   return 0;
+}
+
+static void test_readattrtwice(void)
+{
+    int32 file_id, vsref, vsid;
+    int32 findex, fattr_index;
+    int32 data_type, count, size; 
+    int32 nfields, num_attrs, num_fattrs;
+    char name[MAX_HDF4_NAME_LENGTH + 1];
+    char *buffer;
+    int k;
+    intn ret;
+
+    file_id = Hopen(FILENAME, DFACC_READ, 0);
+    CHECK_VOID(file_id,FAIL,"Hopen:FILENAME");
+
+    ret = Vstart(file_id);
+    CHECK_VOID(ret,FAIL,"Vstart:file_id");
+
+    /* get the first vdata */
+    vsref = VSgetid(file_id, -1);
+    if (vsref == FAIL) {
+        num_errs++;
+        printf(">>> VSgetid was unable to find first Vdata\n");
+    }
+
+    /* read attributes of each vdata and its fields, then go to next vdata */
+    while (vsref != -1) {
+        vsid = VSattach(file_id, vsref, "r");
+        CHECK_VOID(vsid,FAIL,"VSattach");
+
+        num_attrs = VSfnattrs(vsid, _HDF_VDATA);
+        CHECK_VOID(num_attrs,FAIL,"VSfnattrs");
+
+        for (k = 0; k < num_attrs; k++) {
+            ret = VSattrinfo(vsid, _HDF_VDATA, k, name, &data_type, &count, &size);
+            CHECK_VOID(ret,FAIL,"VSattrinfo");
+
+            buffer = HDmalloc(size+1);
+            CHECK_VOID(buffer,NULL,"HDmalloc");
+
+            ret = VSgetattr(vsid, _HDF_VDATA, k, buffer);
+            CHECK_VOID(ret,FAIL,"VSgetattr");
+
+            ret = VSgetattr(vsid, _HDF_VDATA, k, buffer);
+            if (ret == FAIL) {
+                num_errs++;
+                printf(">>> Reading attribute twice failed - (bugzilla 486)\n");
+            }
+            HDfree(buffer);
+
+            nfields = VFnfields(vsid);
+            CHECK_VOID(nfields,FAIL,"VFnfields");
+
+            for (findex = 0; findex < nfields; findex++) {
+                num_fattrs = VSfnattrs(vsid, findex);
+                CHECK_VOID(num_fattrs,FAIL,"VSfnattrs");
+
+                for (fattr_index = 0; fattr_index < num_fattrs; fattr_index++) {
+                    ret = VSattrinfo(vsid, findex, fattr_index, name, &data_type, &count, &size);
+                    CHECK_VOID(ret,FAIL,"VSattrinfo");
+
+                    buffer = HDmalloc(size);
+                    CHECK_VOID(buffer,NULL,"HDmalloc");
+
+                    ret = VSgetattr(vsid, findex, fattr_index, buffer);
+                    CHECK_VOID(ret,FAIL,"VSgetattr");
+
+                    ret = VSgetattr(vsid, findex, fattr_index, buffer);
+                    if (ret == FAIL) {
+                        num_errs++;
+                        printf(">>> Reading attribute twice failed - (bugzilla 486)\n");
+                    }
+
+                    HDfree(buffer);
+                } /* for fattr_index */
+            } /* for findex */
+        } /* for k */
+
+        ret = VSdetach(vsid);
+        CHECK_VOID(ret,FAIL,"VSdetach");
+
+        /* find next vdata */
+        vsref = VSgetid(file_id, vsref);
+    }
+    ret = Vend(file_id);
+    CHECK_VOID(ret,FAIL,"VSdetach");
+    ret = Hclose(file_id);
+    CHECK_VOID(ret,FAIL,"Hclose");
+}   /* test_readattrtwice */
+
+/* main test driver */
+void
+test_vset_attr(void)   
+{
+   create_vset_stuff();
+   write_vattrs();
+   read_vattrs(); 
+   test_readattrtwice();
+} /* test_vset_attr */
diff --git a/hdf/test/tvattrf.f b/hdf/test/tvattrf.f
new file mode 100644
index 0000000..b83e849
--- /dev/null
+++ b/hdf/test/tvattrf.f
@@ -0,0 +1,327 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C***************************************************
+C
+C $Id: tvattrf.f 5212 2009-08-21 20:49:45Z brtnfld $
+C
+C **************************************************
+C *
+C * tvattrf.f
+C * test Vset attribute Fortran API 
+C *
+C *************************************************
+       subroutine tvattrf (number_failed)
+C       program tvattrf 
+C Test Program:
+C   Tests the vdata and vgroup attribute interface
+C Input file: test_files/tvattr.dat
+C Output file: tvattrf.hdf
+
+      implicit none
+      include 'fortest.inc'
+
+      integer number_failed
+
+      integer len_in
+      character*1024 ifn_out
+      character*25 myname, ifn, ofn
+      parameter (myname = 'vattrf',
+     +           ifn = 'test_files/tvattr.dat' ,
+     +           ofn = 'tvattrf.hdf'
+     +          )  
+      integer vsffidx, vsfsnat, vsfscat, vsfnats
+      integer vsffnas, vsffdat, vsfainf, vsfgnat
+      integer vsfgcat, vsfisat, vfnflds
+      integer vfsnatt, vfscatt, vfnatts
+      integer vffdatt, vfainfo, vfgnatt, vfgcatt
+      integer vfgver
+      integer hopen, hclose, vfatch, vfdtch, vfstart
+      integer vfend, vsfatch, vsfdtch, vfgid, vsgver
+      integer vsffnd, vhfsd
+
+      integer nattrs, itype, icount, imsize, vsver
+      integer fid1, vsid, vgid, vsref, vgref
+      integer ret, findex, vsbuf, aindex
+      integer fixname
+C
+C iattri is for int32 values
+C iattrs is for int16 values
+C iattrr, RATTR1 are for float32 values
+C iattrg, GATTR1 are for float64 values
+      integer*4 iattri(5)
+      integer*2 iattrs(6)
+      real*4    iattrr(5), feps, RATTR1, abs
+      real*8    iattrg(5)
+      double precision geps, GATTR1, dabs
+      character*10  iattrc
+      character*20 iattrnm
+     
+      integer DFACC_CREATE, DFACC_RDWR, DFACC_READ, DFNT_CHAR
+      integer DFNT_INT32, DFNT_FLOAT32 
+      integer VSET_VERSION, VSET_NEW_VERSION
+      integer HDF_VDATA
+
+      parameter (DFACC_CREATE = 4,
+     +           DFACC_RDWR = 3,
+     +           DFACC_READ = 1,
+     +           DFNT_CHAR = 4,
+     +           DFNT_INT32 = 24,
+     +           DFNT_FLOAT32 = 5,
+     +           VSET_VERSION = 3,
+     +           VSET_NEW_VERSION = 4,
+     +           HDF_VDATA = -1,
+     +           GATTR1 = -64.123450D0,
+     +           RATTR1 = 32.0099,
+     +           feps = 1.0E-5,
+     +           geps = 1.0D-9
+     +          )
+
+      DATA vsbuf/200/
+      DATA iattrc/' '/
+
+      call ptestban('Testing', myname)
+C      number_failed = 0
+C Open the file 
+      len_in = len(ifn_out)
+      ret = fixname(ifn, ifn_out, len_in)
+      fid1 = hopen(ifn_out(1:len_in), DFACC_READ, 0)
+      call VRFY(fid1, 'hopen', number_failed)
+      ret = vfstart(fid1)
+      call VRFY(ret, 'vfstart', number_failed)
+      vsref = vsffnd(fid1, 'vsname1')
+      call VRFY(vsref, 'vsffnd', number_failed)
+      vsid = vsfatch(fid1, vsref, 'r')
+      call VRFY(vsid, 'vsfatch', number_failed)
+      vsver = vsgver(vsid)
+      if (vsver .ne. VSET_NEW_VERSION) then
+         call MESSAGE(1, 'Wrong version number of vsname1')
+         number_failed = number_failed + 1
+      endif
+      ret = vsfisat(vsid)
+      if (ret .ne. FALSE) then
+         call MESSAGE(1, 'Vsname1 is not an attr.')
+         number_failed = number_failed + 1
+      endif
+      ret = vfnflds(vsid)
+      if (ret .ne. 2) then
+         call MESSAGE(1, 'Wrong number of fields of vsname1')
+         number_failed = number_failed + 1
+      endif
+      nattrs = vsfnats(vsid)
+      if (nattrs .ne. 6) then
+         call MESSAGE(1, 'Wrong number of total attrs for vsname1')
+         number_failed = number_failed + 1
+      endif
+      nattrs = vsffnas(vsid, HDF_VDATA)
+      if (nattrs .ne. 2) then
+         call MESSAGE(1, 'Wrong number of attrs for vsname1')
+         number_failed = number_failed + 1
+      endif
+C get the 0th attr 
+      aindex = 0
+      findex = HDF_VDATA
+      ret = vsffdat(vsid, findex, 'attname3') 
+      call VRFY(ret, 'vsffdat', number_failed)
+      ret = vsfainf(vsid, findex, aindex, iattrnm,
+     + itype, icount, imsize)
+      call VRFY(ret, 'vsfainf', number_failed)
+      if ((itype .ne. DFNT_CHAR) .or. (icount .ne. 3)) then
+         call MESSAGE(1, 'Wrong info of char attr for vsname1')
+         number_failed = number_failed + 1
+      endif
+      iattrc = '          '
+      ret = vsfgcat(vsid, findex, aindex, iattrc)
+      call VRFY(ret, 'vsfgcat', number_failed)
+C      if ((iattrc(1) .ne. 'm') .or. (iattrc(2) .ne. 'N') 
+C    +    .or. (iattrc(3) .ne. 'p'))  then
+      if (iattrc .ne. 'mNp') then
+         call MESSAGE(1,'Wrong values of char attr for vsname1')
+         number_failed = number_failed + 1
+      endif
+C get the 1st attr of fld 0
+      aindex = 1
+      findex = 0
+      ret = vsffidx(vsid, 'fldname1', findex)
+      call VRFY(ret, 'vsffidx', number_failed)
+      if (findex .ne. 0) then
+         call MESSAGE(1, 'Wrong findex of fldname1 of  vsname1')
+         number_failed = number_failed + 1
+      endif
+C
+      ret = vsfgnat(vsid, findex, aindex, iattrg)
+      call VRFY(ret, 'vsfgnatt1', number_failed)
+      if (dabs(iattrg(1)-GATTR1) .gt. dabs(geps * GATTR1)) 
+     +          then
+         call MESSAGE(1, 'Wrong double attr for vsname1')
+         number_failed = number_failed + 1
+      print *, 'should be: ',GATTR1,' get: ',iattrg(1)
+      endif
+      ret = vsfdtch(vsid)
+      call VRFY(ret, 'vsfdtch', number_failed)
+C get next vdata and test vsfisat 
+      vsref = vsffnd(fid1, 'attname1')
+      vsid = vsfatch(fid1, vsref, 'r')
+      call VRFY(ret, 'vsfatch', number_failed)
+      ret = vsfisat(vsid)
+      if (ret .ne. TRUE) then
+         call MESSAGE(1, 'vsfisat failed.   ')
+         number_failed = number_failed + 1
+      endif
+      ret = vsfdtch(vsid)
+      call VRFY(ret, 'vsfdtch', number_failed)
+C test vgroup routines
+      vgref = vfgid(fid1, -1)
+      call VRFY(vgref, 'vfgid',number_failed)
+      vgid = vfatch(fid1, vgref, 'r')
+      call VRFY(vgid, 'vfatch',number_failed)
+      ret = vfgver(vgid)
+      call VRFY(ret, 'vfgver',number_failed)
+      if (ret .ne. VSET_NEW_VERSION) then
+         call MESSAGE(1, 'vfgver failed.   ')
+         number_failed = number_failed + 1
+      endif
+      nattrs = vfnatts(vgid)
+      if (nattrs .ne. 2) then
+         call MESSAGE(1, 'vfnatts failed.   ')
+         number_failed = number_failed + 1
+      endif
+      ret = vfainfo(vgid,0,iattrnm,itype,icount,imsize)
+      call VRFY(ret, 'vfainfo',number_failed)
+      ret = vfgnatt(vgid, 0, iattri)
+      call VRFY(ret, 'vfgnatt',number_failed)
+      if (iattri(1) .ne. 10032 .or. iattri(2) .ne. 10064)
+     +      then
+         call MESSAGE(1, 'vfgnatt failed.   ')
+         number_failed = number_failed + 1
+      endif
+C get attname2
+      ret = vffdatt(vgid, 'attname2')
+      call VRFY(ret, 'vffdatt',number_failed)
+      ret = vfgnatt(vgid, ret, iattrs)
+      call VRFY(ret, 'vfgnatt',number_failed)
+      if (iattrs(1) .ne. 16 .or. iattrs(2) .ne. 32)
+     +       then
+         call MESSAGE(1, 'vfgnatt failed.   ')
+         number_failed = number_failed + 1
+      endif
+C finish reading existing attrs
+      ret = vfdtch(vgid)
+      call VRFY(ret, 'vfdtch',number_failed)
+      ret = vfend(fid1)
+      call VRFY(ret, 'vfend',number_failed)
+      ret = hclose(fid1)
+      call VRFY(ret, 'hclose1',number_failed)
+C write attributes
+      fid1 = hopen(ofn, DFACC_CREATE, 0)
+      call VRFY(fid1, 'hopen',number_failed)
+      ret =  vfstart(fid1)
+      call VRFY(ret, 'vfstart', number_failed)
+C vgroup attrs
+      vgid = vfatch(fid1, -1, 'w')
+      call VRFY(ret, 'vfatch', number_failed)
+      ret = vfscatt(vgid, 'vgcattr0', DFNT_CHAR, 4, 'cat0')
+      call VRFY(ret, 'vfscatt', number_failed)
+      ret = vfsnatt(vgid,'vgattr1',DFNT_FLOAT32,1,RATTR1)
+      call VRFY(ret, 'vfsnatt', number_failed)
+      ret = vfdtch(vgid)
+      call VRFY(ret, 'vfdtch', number_failed)
+C vdata attrs
+      vsref = vhfsd(fid1, 'vsfld0', vsbuf, 1, DFNT_INT32,
+     +              'vs0', 'test_vdata')
+      call VRFY(ret, 'vhfsd', number_failed)
+      vsid = vsfatch(fid1, vsref, 'w')
+      call VRFY(ret, 'vsfatch', number_failed)
+      ret = vsfscat(vsid, HDF_VDATA, 'vscattr0', DFNT_CHAR, 3,
+     +              'at2')
+      call VRFY(ret, 'vfscatt', number_failed)
+      ret = vsfsnat(vsid, 0, 'vsattr1', DFNT_FLOAT32, 1, 
+     +             RATTR1)
+      call VRFY(ret, 'vsfsnat', number_failed)
+      ret = vsfdtch(vsid) 
+      call VRFY(ret, 'vsfdtch', number_failed)
+      ret = vfend(fid1)
+      call VRFY(ret, 'vfend',number_failed)
+      ret = hclose(fid1)
+      call VRFY(ret, 'hclose2',number_failed)
+C read the new attrs back
+      fid1 = hopen(ofn, DFACC_RDWR, 0)
+      call VRFY(fid1, 'hopen',number_failed)
+      ret =  vfstart(fid1)
+      call VRFY(ret, 'vfstart', number_failed)
+C vgroup attrs
+      vgref = vfgid(fid1, -1)
+      call VRFY(ret, 'vfgid', number_failed)
+      vgid = vfatch(fid1, vgref, 'w')
+      call VRFY(ret, 'vfatch', number_failed)
+      iattrc = '          '
+      ret = vfgcatt(vgid, 0, iattrc)
+      call VRFY(ret, 'vfgcatt', number_failed)
+C      if (iattrc(1) .ne. 'a' .or. iattrc(2) .ne. 't'
+C     +     .or. iattrc(3) .ne. '0') then
+      if (iattrc .ne. 'cat0') then
+         call MESSAGE(1, 'Wrong values of char attr for vg')
+         number_failed = number_failed + 1
+      endif
+      ret = vfgnatt(vgid, 1, iattrr)
+      call VRFY(ret, 'vfgnatt', number_failed)
+      if (abs(iattrr(1)-RATTR1) .gt. abs(RATTR1*feps)) 
+     +          then
+         call MESSAGE(1, 'Wrong values of real attr for vg')
+         number_failed = number_failed + 1
+      endif
+      ret = vfdtch(vgid)
+      call VRFY(ret, 'vfdtch', number_failed)
+C vdata attrs
+      vsref = vsffnd(fid1, 'vs0')
+      call VRFY(ret, 'vsffnd', number_failed)
+      vsid = vsfatch(fid1, vsref, 'w')
+      call VRFY(ret, 'vsfatch', number_failed)
+      iattrc = '          '
+      ret = vsfgcat(vsid, HDF_VDATA, 0, iattrc)
+      call VRFY(ret, 'vsfgcat', number_failed)
+C      if (iattrc(1) .ne. 'a' .or. iattrc(2) .ne. 't'
+C     +     .or. iattrc(3) .ne. '2') then
+      if (iattrc .ne. 'at2') then
+         call MESSAGE(1, 'Wrong values of char attr for vs')
+         number_failed = number_failed + 1
+         print *, iattrc, 'at2'
+      endif
+      ret = vsfgnat(vsid, 0, 0, iattrr)
+      call VRFY(ret, 'vsfgnatt2', number_failed)
+      if (abs(iattrr(1)-RATTR1) .gt. abs(RATTR1*feps)) 
+     +          then
+         call MESSAGE(1, 'Wrong values of real attr for vs')
+         number_failed = number_failed + 1
+      endif
+      ret = vsfdtch(vsid)
+      call VRFY(ret, 'vsfdtch', number_failed)
+      ret = vfend(fid1)
+      call VRFY(ret, 'vfend',number_failed)
+      ret = hclose(fid1)
+      call VRFY(ret, 'hclose3',number_failed)
+      return
+      end
+
+
+
+
+
+
+
+
+
+       
+
+     
+        
+     
diff --git a/hdf/test/tvnameclass.c b/hdf/test/tvnameclass.c
new file mode 100644
index 0000000..e2543f8
--- /dev/null
+++ b/hdf/test/tvnameclass.c
@@ -0,0 +1,372 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Tests for vgroup's and vdata's name and class name.
+ */
+#include "hdf.h"
+#include "hfile.h"
+#include "tproto.h"
+#include "tutils.h"
+
+#define LONGNAMES "tlongnames.hdf"
+#define NONAMECLASS "tundefined.hdf"
+#define VGROUP1 "VGROUP1"
+#define VG_LONGNAME "Vgroup with more than 64 characters in length, 74 characters to be exact!"
+#define VG_LONGCLASS "Very long class name to classify all Vgroups with more than 64 characters in name"
+
+static void test_vglongnames(void);
+static void test_novgclass(void);
+
+static void
+test_vglongnames(void)
+{
+    int32 file_id;      /* File ID */
+    int32 vg1;          /* Vdata ID */
+    int32 ref;          /* Vdata ref */
+    uint16 name_len;	/* Length of a vgroup's name or class name */
+    char *vgname, *vgclass;
+    intn is_internal;
+    int32 status;       /* Status values from routines */
+
+    /* Open the HDF file. */
+    file_id = Hopen(LONGNAMES, DFACC_CREATE, 0);
+    CHECK_VOID(file_id,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Create a new vgroup. */
+    vg1 = Vattach(file_id, -1, "w");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    status=Vsetname(vg1, VG_LONGNAME);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status=Vsetclass(vg1, VG_LONGCLASS);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    /* Create another vgroup of the same class. */
+    vg1 = Vattach(file_id, -1, "w");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    status=Vsetname(vg1, VGROUP1);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status=Vsetclass(vg1, VG_LONGCLASS);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(file_id);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(file_id);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+    /* Re-open the HDF file. */
+    file_id = Hopen(LONGNAMES, DFACC_RDWR, 0);
+    CHECK_VOID(file_id,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Find the long name vgroup. */
+    ref=Vfind(file_id,VG_LONGNAME);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vg1 = Vattach(file_id, ref, "r");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    /* Test Vgisinternal */
+    is_internal = Vgisinternal(vg1);
+    CHECK_VOID(is_internal, FAIL, "Vgisinternal");
+    VERIFY_VOID(is_internal, FALSE, "Vgisinternal");
+    
+    /* get the vgroup's name */
+    status = Vgetnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgname = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgname, "vgname", "test_vglongnames" );
+
+    status=Vgetname(vg1, vgname);
+    CHECK_VOID(status,FAIL,"VSgetname");
+    VERIFY_CHAR_VOID(vgname, VG_LONGNAME, "Vgetname");
+
+    if (vgname != NULL)
+        HDfree(vgname);
+
+    /* get the vgroup's class */
+    status = Vgetclassnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgclass = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames" );
+
+    status=Vgetclass(vg1, vgclass);
+    CHECK_VOID(status,FAIL,"VSgetclass");
+    VERIFY_CHAR_VOID(vgclass, VG_LONGCLASS, "Vgetclass");
+
+    if (vgclass != NULL)
+        HDfree(vgclass);
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    /* Find the vgroup VGROUP1. */
+    ref=Vfind(file_id,VGROUP1);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vg1 = Vattach(file_id, ref, "r");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    /* get the vgroup's name */
+    status = Vgetnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgname = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgname, "vgname", "test_vglongnames" );
+
+    status=Vgetname(vg1, vgname);
+    CHECK_VOID(status,FAIL,"VSgetname");
+
+    if (HDstrcmp(vgname, VGROUP1)) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup name : %s\n", vgname);
+    }
+
+    if (vgname != NULL)
+        HDfree(vgname);
+
+    /* get the vgroup's class */
+    status = Vgetclassnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgclass = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames" );
+
+    status=Vgetclass(vg1, vgclass);
+    CHECK_VOID(status,FAIL,"VSgetclass");
+
+    if (HDstrcmp(vgclass, VG_LONGCLASS)) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup class : %s\n", vgclass);
+    }
+
+    if (vgclass != NULL)
+        HDfree(vgclass);
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(file_id);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(file_id);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+} /* test_vglongnames() */
+
+static void
+test_undefined(void)
+{
+    int32 status;       /* Status values from routines */
+    int32 file_id;          /* File ID */
+    int32 vg1;          /* Vdata ID */
+    int32 ref;          /* Vdata ref */
+    intn is_internal;   /* to test Vgisinternal */
+    uint16 name_len;	/* Length of a vgroup's name or class name */
+    /* to simulate calls to Vgetclass/Vgetname in older applications */
+    char vgname[VGNAMELENMAX+1], vgclass[VGNAMELENMAX+1];
+
+    /* Open the HDF file. */
+    file_id = Hopen(NONAMECLASS, DFACC_CREATE, 0);
+    CHECK_VOID(file_id,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Create a vgroup which will have name set but not class */
+    vg1 = Vattach(file_id, -1, "w");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    status=Vsetname(vg1, VG_LONGNAME);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    /* Create another vgroup which will have class but not name */
+    vg1 = Vattach(file_id, -1, "w");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    status=Vsetclass(vg1, VG_LONGCLASS);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(file_id);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(file_id);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+    /* Re-open the HDF file. */
+    file_id = Hopen(NONAMECLASS, DFACC_RDWR, 0);
+    CHECK_VOID(file_id,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(file_id);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Find the long name vgroup. */
+    ref=Vfind(file_id,VG_LONGNAME);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vg1 = Vattach(file_id, ref, "r");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    /* Test Vgisinternal */
+    is_internal = Vgisinternal(vg1);
+    CHECK_VOID(is_internal, FAIL, "Vgisinternal");
+    VERIFY_VOID(is_internal, FALSE, "Vgisinternal");
+    
+    /* Try getting the vgroup's class without calling first Vgetclassnamelen.
+       This shows that bug HDFFR-1288 is fixed. */
+    status=Vgetclass(vg1, vgclass);
+    CHECK_VOID(status,FAIL,"Vgetclass");
+    VERIFY_VOID(HDstrlen(vgclass), 0, "VSgetclass");
+
+    /* The length of the class name should be 0 */
+    status = Vgetclassnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetclassnamelen");
+    VERIFY_VOID(name_len, 0, "VSgetclassnamelen");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    /* Find the vgroup with class VG_LONGCLASS.  This vgroup doesn't have a name */
+    ref=Vfindclass(file_id, VG_LONGCLASS);
+    CHECK_VOID(ref,FAIL,"VSfindclass");
+
+    vg1 = Vattach(file_id, ref, "r");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    /* Try getting the vgroup's name without calling first Vgetclassnamelen.
+       Similar to class name in bug HDFFR-1288. */
+    status=Vgetname(vg1, vgname);
+    CHECK_VOID(status,FAIL,"Vgetname");
+    VERIFY_VOID(HDstrlen(vgname), 0, "VSgetname");
+
+    /* The length of the name should be 0 */
+    status = Vgetnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+    VERIFY_VOID(name_len, 0, "VSgetnamelen");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(file_id);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(file_id);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+} /* test_undefined() */
+
+
+/****************************************************************************
+ * test_vgisinternal - tests the API function Vgisinternal
+ *   - Use an existing GR file created during the period when GR vgroup had no
+ *	class name, and had name set to GR_NAME
+ *   - Get each vgroup, verify that it is internal or not
+ * Jan 6, 2012 -BMR
+****************************************************************************/
+
+#define GR_FILE    "test_files/grtdfui83.hdf"
+static void
+test_vgisinternal()
+{
+    int32   fid, vgroup_id;
+    intn    is_internal = FALSE;
+    int32   vref = -1;
+    intn    ii, status;
+    char testfile[H4_MAX_NC_NAME] = "";
+    char    internal_array2[2] = {TRUE, TRUE};
+    intn    num_errs = 0;     /* number of errors so far */
+
+    /* Use a GR file to test Vgisinternal on internal vgroups */
+
+    /* The file GR_FILE is an existing file in the test_files directory,
+       make_datafilename builds the file name with correct path */
+    if (make_datafilename(GR_FILE, testfile, H4_MAX_NC_NAME) != FAIL)
+    {
+	/* Open the old GR file and initialize the V interface */
+	fid = Hopen(testfile, DFACC_READ, 0);
+	CHECK_VOID(fid, FAIL, "Hopen: grtdfui83.hdf");
+	status = Vstart(fid);
+	CHECK_VOID(status, FAIL, "Vstart");
+
+	ii = 0;
+	while ((vref = Vgetid(fid, vref)) != FAIL)
+	{     /* until no more vgroups */
+	    vgroup_id = Vattach(fid, vref, "r"); /* attach to vgroup */
+
+	    /* Test that the current vgroup is or is not internal as specified
+	       in the array internal_array2 */
+	    is_internal = Vgisinternal(vgroup_id);
+	    CHECK_VOID(is_internal, FAIL, "Vgisinternal");
+  	    VERIFY_VOID(is_internal, internal_array2[ii], "Vgisinternal");
+
+	    status = Vdetach(vgroup_id);
+	    CHECK_VOID(status, FAIL, "Vdetach");
+
+	    ii++; /* increment vgroup index */
+	}
+
+	/* Terminate access to the V interface and close the file */
+	status = Vend(fid);
+	CHECK_VOID(status, FAIL, "Vend");
+	status = Hclose(fid);
+	CHECK_VOID(status, FAIL, "Hclose");
+    }
+    else
+    {
+	fprintf(stderr, "ERROR>>> Unable to make filename for %s\n", GR_FILE);
+	H4_FAILED()
+    }
+}   /* test_vgisinternal */
+
+void
+test_vnameclass(void)
+{
+    int32       status;
+
+    /* test Vgroups with name and class that have more than 64 characters */
+    test_vglongnames();
+
+    /* test Vgetname and Vgetclass when either name or class is not defined. */
+    test_undefined();
+
+    /* test Vgisinternal when there is no class name */
+    test_vgisinternal();
+}   /* test_vnameclass */
diff --git a/hdf/test/tvset.c b/hdf/test/tvset.c
new file mode 100644
index 0000000..ae07d26
--- /dev/null
+++ b/hdf/test/tvset.c
@@ -0,0 +1,3530 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: tvset.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*
+ *
+ * Vset tests 
+ *
+ *
+ * This file needs another pass at making sure all the return
+ * values from function calls are checked in addtion to
+ * verifying that the proper tests are performed on all Vxx fcns - GV 9/5/97
+ *
+ */
+#include "hdf.h"
+#include "hfile.h"
+#include "tproto.h"
+
+#define VDATA_COUNT  256   /* make this many Vdatas to check for memory leaks */
+
+#define FNAME0		"tvset.hdf"
+#define EXTFNM		"tvsetext.hdf"
+#define EMPTYNM		"tvsempty.hdf"
+#define LONGNAMES	"tlongnames.hdf"
+#define LKBLK_FILE	"tvsblkinfo.hdf"
+
+#define FIELD1		"FIELD_name_HERE"
+#define FIELD1_UPPER	"FIELD_NAME_HERE"
+#define FIELD2		"DIFFERENT_FIELD_NAME"
+
+#define FIELD1_NAME	"Field1"	/* contains three integers */
+#define FIELD2_NAME	"Field2"	/* contains one integer */
+#define FIELD3_NAME	"Field3"	/* contains two integers */
+#define	FIELD_NAME_LIST	"Field1,Field2,Field3"
+#define ORDER_1 	3	/* order of first field of 1st vdata */
+#define ORDER_2 	1	/* order of second field of 1st vdata */
+#define ORDER_3 	2	/* order of third field of 1st vdata */
+#define ST		"STATION_NAME"
+#define VL		"VALUES"
+#define FL		"FLOATS"
+#define MX		"STATION_NAME,VALUES,FLOATS"
+#define EMPTY_VDATA	"Empty"
+#define VGROUP1		"VGROUP1"
+#define VG_LONGNAME "Vgroup with more than 64 characters in length, 74 characters to be exact!"
+#define VG_LONGCLASS "Very long class name to classify all Vgroups with more than 64 characters in name"
+#define APPENDABLE_VDATA "Appendable"
+
+static int32 write_vset_stuff(void);
+static int32 read_vset_stuff(void);
+static void test_vsdelete(void);
+static void test_vdelete(void);
+static void test_vdeletetagref(void);
+static void test_emptyvdata(void);
+static void test_vglongnames(void);
+static void test_getvgroups(void);
+static void test_getvdatas(void);
+static void test_blockinfo_oneLB(void);
+static void test_blockinfo_multLBs(void);
+static void test_VSofclass(void);
+
+/* write some stuff to the file */
+static int32
+write_vset_stuff(void)
+{
+    int32       status;
+    int32       fid, aid;
+    int32       vg1, vg2;
+    int32       vs1;
+    int32       count, i, j, num, max_order;
+    int32       ibuf[2000];     /* integer buffer */
+    float32     fbuf[2000];     /* floating point buffer */
+    char        gbuf[2000];     /* generic buffer */
+    uint8       *gbuf1 = NULL;   /* buffer for uint8 */
+    float32     *gbuf2 = NULL;   /* buffer for float32 */
+    const char *name;
+    char       *p;
+    char8       c;
+    float32     f;
+
+    /* allocate these buffers dynamically and not off the stack
+       as they were previously handled */
+    if (gbuf1 == NULL)
+     {
+       gbuf1 = (uint8 *)HDmalloc(sizeof(uint8)*65536);
+     }
+
+    if (gbuf2 == NULL)
+     {
+       gbuf2 = (float32 *)HDmalloc(sizeof(float32)*20000);
+     }
+
+
+    fid = Hopen(FNAME0, DFACC_CREATE, 100);
+    if (fid == FAIL)
+      {
+          num_errs++;
+          return FAIL;
+      }
+
+    if (Vstart(fid) == FAIL)
+      {
+          num_errs++;
+          return FAIL;
+      }
+
+    /*
+
+     * Vgroup Generation routines
+     *
+     */
+
+    /*
+     *  start simple --- create a simple Vgroup
+     */
+    vg1 = Vattach(fid, -1, "w");
+    if(vg1 == FAIL)
+      {
+          num_errs++;
+          printf(">>> Failed creating initial Vgroup\n");
+      }
+
+    status = Vsetname(vg1, "Simple Vgroup");
+    CHECK(status,FAIL,"Vsetname:vg1");
+
+    status = Vsetclass(vg1, "Test object");
+    CHECK(status,FAIL,"Vsetclass:vg1");
+
+    MESSAGE(5, printf("created Vgroup %s (empty)\n", "Simple Vgroup"););
+
+    /*
+     * Lets do some more complex ones now
+     */
+    vg2 = Vattach(fid, -1, "w");
+    if(vg2 == FAIL)
+      {
+          num_errs++;
+          printf(">>> Failed creating second Vgroup\n");
+      }
+
+    /* keep track of how many in Vgroup */
+    num = 0;
+
+    /* add first group into the other */
+    status = Vinsert(vg2, vg1);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vinsert failed\n");
+      }
+    else
+        num++;
+
+    /* add a bogus element */
+    status = Vaddtagref(vg2, (int32) 1000, (int32) 12345);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vaddtagref failed for bogus element\n");
+      }
+    else
+        num++;
+
+    /* create an element and insert that */
+    aid = Hstartwrite(fid, (uint16) 123, (uint16) 1234, 10);
+    if (aid == FAIL)
+      {
+          num_errs++;
+          printf(">>> Hstartwrite failed\n");
+      }
+
+    status = Hendaccess(aid);
+    CHECK(status,FAIL,"Hendaccess:aid");
+
+    /* add an existing HDF element */
+    status = Vaddtagref(vg2, (int32) 123, (int32) 1234);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vaddtagref failed for legit element\n");
+      }
+    else
+        num++;
+
+#ifdef NO_DUPLICATES
+    /* attempt to add an element already in the Vgroup */
+    status = Vaddtagref(vg2, (int32) 123, (int32) 1234);
+    if (status != FAIL)
+      {
+          num_errs++;
+          printf(">>> Vaddtagref added a duplicate element\n");
+      }
+
+    /* check that the number is correct */
+    if (num != Vntagrefs(vg2))
+      {
+          num_errs++;
+          printf(">>> Vntagrefs returned %d was expecting %d\n", Vntagrefs(vg2), num);
+      }
+#endif /* NO_DUPLICATES */
+
+    /* lets check the contents */
+    /* look for a valid one first */
+    if (Vinqtagref(vg2, 1000, 12345) == FALSE)
+      {
+          num_errs++;
+          printf(">>> Vinqtagref couldn't find valid element\n");
+      }
+
+    /* look for a bogus one */
+    if (Vinqtagref(vg2, 1000, 123456) != FALSE)
+      {
+          num_errs++;
+          printf(">>> Vinqtagref found a bogus element\n");
+      }
+
+    status = Vsetname(vg2, "Second Vgroup");
+    CHECK(status,FAIL,"Vsetname:for vg2");
+
+    Vsetclass(vg2, "Test object");
+    CHECK(status,FAIL,"Vsetclass: for vg2");
+
+    status = Vdetach(vg1);
+    CHECK(status,FAIL,"Vdetach:vg1");
+
+    status = Vdetach(vg2);
+    CHECK(status,FAIL,"Vdetach:vg2");
+
+    MESSAGE(5, printf("created Vgroup %s with %d elements\n", "Second Vgroup", 
+                      (int) num););
+
+    /*
+
+     * Vdata Generation routines
+     *
+     */
+
+    /* Float32 Vdata */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach");
+
+    name = "Float Vdata";
+    status=VSsetname(vs1, name);
+    CHECK(status,FAIL,"VSsetname");
+
+    status=VSsetclass(vs1, "Test object");
+    CHECK(status,FAIL,"VSsetclass");
+
+    status=VSfdefine(vs1, FIELD1, DFNT_FLOAT32, 1);
+    CHECK(status,FAIL,"VSfdefine");
+
+    /* Verify that VSsetfields will return FAIL when passing in a NULL
+       for field name list (bug #554) - BMR 5/17/01 */
+    status = VSsetfields(vs1, NULL);
+    VERIFY(status, FAIL, "VSsetfields");
+
+    status = VSsetfields(vs1, FIELD1);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+
+    /* create some bogus data */
+    for (i = 0, count = 100; i < count; i++)
+        fbuf[i] = (float32) i;
+
+    /* store it */
+    status = VSwrite(vs1, (unsigned char *) fbuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSwrite:vs1");
+
+    /* Test VSgetexternalfile on a vdata without external element */
+    /*  status = VSgetexternalfile(vs1, 0, NULL, NULL);
+    VERIFY_VOID(status, FAIL, "VSgetexternalfile");
+ */ 
+
+    /* Test VSgetexternalinfo on a vdata without external element */
+    status = VSgetexternalinfo(vs1, 0, NULL, NULL, NULL);
+    VERIFY(status, 0, "VSgetexternalinfo");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+    
+    MESSAGE(5, printf("created VDATA %s with %d elements\n", name, (int) count););
+
+    /* Int32 Vdata */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    name = "Integer Vdata";
+    status = VSsetname(vs1, name);
+    CHECK(status,FAIL,"VSsetname:vs1");
+
+    status = VSsetclass(vs1, "Test object");
+    CHECK(status,FAIL,"VSsetclass:vs1");
+
+    status = VSfdefine(vs1, FIELD2, DFNT_INT32, 2);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSsetfields(vs1, FIELD2);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+    /* change this vdata to store in an external file */
+    status = VSsetexternalfile(vs1, EXTFNM, (int32) 0);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSsetexternalfile failed\n");
+      }
+
+    /* create some bogus data */
+    for (i = 0, count = 100; i < 2 * count; i++)
+        ibuf[i] = i;
+
+    /* store it */
+    status = VSwrite(vs1, (unsigned char *) ibuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSwrite:vs1");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    MESSAGE(5, printf("created VDATA %s with %d elements\n", 
+                      name, (int) count); );
+
+    /* Int32 and Float32 Vdata */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    name = "Mixed Vdata";
+    status = VSsetname(vs1, name);
+    CHECK(status,FAIL,"VSsetname:vs1");
+
+    status = VSsetclass(vs1, "No class specified");
+    CHECK(status,FAIL,"VSsetclass:vs1");
+
+    status = VSfdefine(vs1, "A", DFNT_FLOAT32, 1);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSfdefine(vs1, "B", DFNT_INT32, 1);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSsetfields(vs1, "A, B");
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+
+    /* create some bogus data */
+    p = gbuf;
+    for (i = 0, count = 100; i < count; i++)
+      {
+          float32     tf = (float32) (i * 2);
+          HDmemcpy(p, &tf, sizeof(float32));
+          p += sizeof(float32);
+          HDmemcpy(p, &i, sizeof(int32));
+          p += sizeof(int32);
+      }
+
+    /* store it */
+    status = VSwrite(vs1, (unsigned char *) gbuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSwrite:vs1");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    MESSAGE(5, printf("created VDATA %s with %d elements\n", 
+                      name, (int) count););
+
+    /* mixed order Vdata */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    name = "Multi-Order Vdata";
+    status = VSsetname(vs1, name);
+    CHECK(status,FAIL,"VSsetname:vs1");
+
+    status = VSsetclass(vs1, "No class specified");
+    CHECK(status,FAIL,"VSsetclass:vs1");
+
+    status = VSfdefine(vs1, ST, DFNT_CHAR8, 2);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSfdefine(vs1, VL, DFNT_INT32, 3);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSfdefine(vs1, FL, DFNT_FLOAT32, 1);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSsetfields(vs1, MX);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+
+    /* create some bogus data */
+    p = gbuf;
+    c = 'a';
+    j = 0;
+    f = (float32) 15.5;
+    for (i = 0, count = 10; i < count; i++)
+      {
+          HDmemcpy(p, &c, sizeof(char8));
+          p += sizeof(char8);
+          c++;
+          HDmemcpy(p, &c, sizeof(char8));
+          p += sizeof(char8);
+          c++;
+          HDmemcpy(p, &j, sizeof(int32));
+          p += sizeof(int32);
+          j++;
+          HDmemcpy(p, &j, sizeof(int32));
+          p += sizeof(int32);
+          j++;
+          HDmemcpy(p, &j, sizeof(int32));
+          p += sizeof(int32);
+          j++;
+          HDmemcpy(p, &f, sizeof(float32));
+          p += sizeof(float32);
+          f += (float32) 0.5;
+      }
+
+    /* store it */
+    status = VSwrite(vs1, (unsigned char *) gbuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSwrite:vs1");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    MESSAGE(5, printf("created VDATA %s with %d elements\n", 
+                      name, (int) count););
+
+    /* test MAX_ORDER and MAX_FIELD_SIZE */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    name = "Max_Order Vdata";
+    status = VSsetname(vs1, name);
+    CHECK(status,FAIL,"VSsetname:vs1");
+
+    status = VSfdefine(vs1, "max_order", DFNT_UINT8, MAX_ORDER);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSsetfields(vs1, "max_order");
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+
+    /* create some bogus data */
+    for (i = 0; i < MAX_ORDER; i++)
+         gbuf1[i] = (uint8)(i % 256);
+
+    status = VSwrite(vs1, (unsigned char *) gbuf1, 1, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSwrite:vs1");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    MESSAGE(5, printf("created VDATA %s with %d order\n", 
+                      name, (int)MAX_ORDER););
+
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    name = "Max_Fldsize Vdata";
+    status = VSsetname(vs1, name);
+    CHECK(status,FAIL,"VSsetname:vs1");
+
+    max_order = MAX_FIELD_SIZE/SIZE_FLOAT32;
+    status = VSfdefine(vs1, "max_fldsize", DFNT_FLOAT32, max_order);
+    CHECK(status,FAIL,"VSfdefine:vs1");
+
+    status = VSsetfields(vs1, "max_fldsize");
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+    
+    /* create some bogus data */
+    for (i = 0; i < max_order; i++)
+         gbuf2[i] = (float32)i * (float32)0.11; 
+
+    status = VSwrite(vs1, (unsigned char *) gbuf2, 1, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSwrite:vs1");
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    MESSAGE(5, printf("created VDATA %s with %d order\n", 
+                      name, (int)max_order););
+
+    /* create vdata exceeding MAX_FIELD_SIZE, should fail */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    name = "Bad_Fldsize Vdata";
+    status = VSsetname(vs1, name);
+    CHECK(status,FAIL,"VSsetname:vs1");
+
+    max_order = MAX_FIELD_SIZE/SIZE_FLOAT32 + 1;
+    status = VSfdefine(vs1, "bad_fldsize", DFNT_FLOAT32, max_order);
+    if (status != FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+
+    status = VSsetfields(vs1, "bad_fldsize");
+    if (status != FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", name);
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    /* create a whole bunch of Vdatas to check for memory leakage */
+    for (i = 0; i < VDATA_COUNT; i++)
+      {
+          char        name2[80];
+          vs1 = VSattach(fid, -1, "w");
+          if (vs1 == FAIL)
+            {
+                num_errs++;
+                printf(">>> Vsattach failed on loop %d\n", (int) i);
+                continue;
+            }
+          sprintf(name2, "VdataLoop-%d", (int) i);
+          status = VSsetname(vs1, name2);
+          CHECK(status,FAIL,"VSsetname:vs1");
+
+          status = VSfdefine(vs1, "A", DFNT_CHAR8, 1);
+          if (status == FAIL)
+            {
+                num_errs++;
+                printf(">>> VSfdefine failed on loop %d\n", (int) i);
+                continue;
+            }
+          status = VSsetfields(vs1, "A");
+          if (status == FAIL)
+            {
+                num_errs++;
+                printf(">>> VSsetfields failed on loop %d\n", (int) i);
+                continue;
+            }
+          status = VSwrite(vs1, (unsigned char *) name2, 1, FULL_INTERLACE);
+          CHECK(status,FAIL,"VSwrite:vs1");
+
+          status = VSdetach(vs1);
+          CHECK(status,FAIL,"VSdetach:vs1");
+      }
+
+    status = Vend(fid);
+    CHECK(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK(status,FAIL,"Hclose:vs1");
+
+    HDfree(gbuf1);
+    HDfree(gbuf2);
+
+    return SUCCEED;
+
+}   /* write_vset_stuff */
+
+/* read everything back in and check it */
+static int32
+read_vset_stuff(void)
+{
+    int32       ibuf[2000];     /* integer buffer */
+    float32     fbuf[2000];     /* floating point buffer */
+    char        gbuf[2000];     /* generic buffer */
+    int32       list[50];
+    int32       tags[100], refs[100], tag, ref;
+    char        vsname[512], vsclass[512], fields[512];
+    char       *vgname, *vgclass;
+    char       *p;
+    int32       fid;
+    int32       vg1;
+    int32       vs1;
+    int32       status, num, i, count, intr, sz;
+    float32     fl_expected;
+    int32       in_expected;
+    char8       c_expected;
+    uint16	name_len;
+
+    fid = Hopen(FNAME0, DFACC_RDONLY, 0);
+    if (fid == FAIL)
+      {
+          num_errs++;
+          return FAIL;
+      }
+
+    status = Vstart(fid);
+    CHECK(status,FAIL,"Vstart:fid");
+
+    /*
+     *   Verify the Vgroups
+     */
+
+    /* test Vlone */
+    num = 1;
+    status = Vlone(fid, list, 10);
+    if (status != num)
+      {
+          num_errs++;
+          printf(">>> Vlone found %d was expecting %d\n", (int) status, (int) num);
+      }
+
+    /* test Vgetname and Vgetclass */
+    vg1 = Vattach(fid, list[0], "r");
+    if(vg1 == FAIL)
+      {
+          num_errs++;
+          printf(">>> Was not able to attach (r) Vgroup %d\n", (int) list[0]);
+      }
+
+    status = Vgetnamelen(vg1, &name_len);
+    CHECK(status,FAIL,"Vgetnamelen:vg1");
+
+    vgname = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgname, "vgname", "read_vset_stuff");
+    
+    status = Vgetname(vg1, vgname);
+    CHECK(status,FAIL,"Vgetname:vg1");
+
+    status = Vgetclassnamelen(vg1, &name_len);
+    CHECK(status,FAIL,"Vgetclassnamelen:vg1");
+
+    vgclass = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgclass, "vgclass", "read_vset_stuff");
+    
+    status = Vgetclass(vg1, vgclass);
+    CHECK(status,FAIL,"Vgetclass:vg1");
+
+    if (HDstrcmp(vgname, "Second Vgroup")) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup name : %s\n", vgname);
+    }
+
+    if (vgname != NULL)
+        HDfree(vgname);
+
+    if (HDstrcmp(vgclass, "Test object")) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup class : %s\n", vgclass);
+    }
+
+    if (vgclass != NULL)
+        HDfree(vgclass);
+
+    num = 3;
+    status = Vgettagrefs(vg1, tags, refs, 100);
+    if (status == FAIL) {
+        num_errs++;
+        printf(">>> Vgettagrefs found %d was expecting %d\n", (int) status,
+                (int) num);
+    }
+
+    for (i = 0; i < num; i++) {
+        status = Vgettagref(vg1, i, &tag, &ref);
+        if (status == FAIL) {
+            num_errs++;
+            printf(">>> Vgettagref failed on call %d\n", (int) i);
+        }
+
+        if (tag != tags[i]) {
+            num_errs++;
+            printf(">>> Vgettagref Tag #%d disagrees %d %d\n", (int) i,
+                    (int) tag, (int) tags[i]);
+        }
+
+        if (ref != refs[i]) {
+            num_errs++;
+            printf(">>> Vgettagref Ref #%d disagrees %d %d\n", (int) i,
+                    (int) ref, (int) refs[i]);
+        }
+
+    }
+
+    status = Vdetach(vg1);
+    CHECK(status,FAIL,"Vdetach:vg1");
+
+    /* test Vgetid */
+    ref = Vgetid(fid, -1);
+    if (ref == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vgetid was unable to find first Vgroup\n");
+      }
+
+    ref = Vgetid(fid, ref);
+    if (ref != list[0])
+      {
+          num_errs++;
+          printf(">>> Vgetid was unable to find second Vgroup (should have been first lone one)\n");
+      }
+
+    /*
+
+     *   Verify the Vdatas
+     *
+     */
+
+    /* test VSgetid */
+    ref = VSgetid(fid, -1);
+    if (ref == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSgetid was unable to find first Vdata\n");
+      }
+
+    /* read in the first data and verify metadata and contents */
+    vs1 = VSattach(fid, ref, "r");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    status = VSgetname(vs1, vsname);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, vsclass);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(vsname, "Float Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", vsname);
+      }
+
+    if (HDstrcmp(vsclass, "Test object"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", vsclass);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, vsname);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSinquire failed on float Vdata\n");
+      }
+
+    if (HDstrcmp(vsname, "Float Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Float Vdata name (VSinquire) : %s\n", vsname);
+      }
+
+    if (count != 100)
+      {
+          num_errs++;
+          printf(">>> Got wrong count %d expecting 100\n", (int) count);
+      }
+
+    if ((size_t)sz != sizeof(float32))
+      {
+          num_errs++;
+          printf(">>> Got wrong data size %d should be sizeof(float32)\n", (int) sz);
+      }
+
+#ifndef VDATA_FIELDS_ALL_UPPER
+    if (HDstrcmp(fields, FIELD1))
+      {
+          num_errs++;
+          printf(">>> Got bogus field name %s\n", fields);
+      }
+#else
+    if (HDstrcmp(fields, FIELD1_UPPER))
+      {
+          num_errs++;
+          printf(">>> Got bogus field name %s\n", fields);
+      }
+#endif /* VDATA_FIELDS_ALL_UPPER */
+
+    /* read it */
+    status = VSsetfields(vs1, fields);
+    CHECK(status,FAIL,"VSsetfields:vs1");
+
+    for (i = 0; i < count; i++)
+        fbuf[i] = (float32)0.0;
+
+    status = VSread(vs1, (unsigned char *) fbuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSread:vs1");
+
+    /* verify */
+    for (i = 0; i < count; i++)
+      {
+          if (fbuf[i] != (float32) i)
+            {
+                num_errs++;
+                printf(">>> Float value %d was expecting %d got %f\n", (int) i, (int) i, fbuf[i]);
+            }
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    /* Move to the next one (integers) */
+    ref = VSgetid(fid, ref);
+    if (ref == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSgetid was unable to find second Vdata\n");
+      }
+
+    /* read in the first data and verify metadata and contents */
+    vs1 = VSattach(fid, ref, "r");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    status = VSgetname(vs1, vsname);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, vsclass);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(vsname, "Integer Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", vsname);
+      }
+
+    if (HDstrcmp(vsclass, "Test object"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", vsclass);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, vsname);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSinquire failed on float Vdata\n");
+      }
+
+    if (HDstrcmp(vsname, "Integer Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Integer Vdata name (VSinquire) : %s\n", vsname);
+      }
+
+    if (count != 100)
+      {
+          num_errs++;
+          printf(">>> Got wrong count %d expecting 100\n", (int) count);
+      }
+
+    if ((size_t)sz != 2 * sizeof(int32))
+      {
+          num_errs++;
+          printf(">>> Got wrong data size %d should be 2 * sizeof(int32)\n", (int) sz);
+      }
+
+    if (HDstrcmp(fields, FIELD2))
+      {
+          num_errs++;
+          printf(">>> Got bogus field name %s\n", fields);
+      }
+
+    /* read it */
+    status = VSsetfields(vs1, fields);
+    CHECK(status,FAIL,"VSsetfields:vs1");
+
+    for (i = 0; i < 2 * count; i++)
+        ibuf[i] = 0;
+
+    status = VSread(vs1, (unsigned char *) ibuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSread:vs1");
+
+    /* verify */
+    for (i = 0; i < 2 * count; i++)
+      {
+          if (ibuf[i] != i)
+            {
+                num_errs++;
+                printf(">>> Int value %d was expecting %d got %d\n", (int) i, (int) i, (int) ibuf[i]);
+            }
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+#ifndef HAVE_FMPOOL 
+/* Commented out this test when using the file caching.This is beacause this 
+   test opens the external file directly without using HDF calls. As a result
+   the file memory pool buffer that was created for this external file will 
+   not be shared with this low-level call as the low-level file cache open 
+   creates a unique pool for every call. It is upto the programmer
+   then to share the file pool. -GeorgeV
+ */
+
+    /* testing VSsetexternalfile by reading the external file directly */
+    {   hdf_file_t fd;
+        int j;
+        int32 ival;
+
+        /* low level open of external file */
+        fd = HI_OPEN(EXTFNM, DFACC_RDONLY);
+        if (OPENERR(fd))
+          {
+              num_errs++;
+              printf(">>> Reopen External file %s failed\n", EXTFNM);
+          }
+        else
+          {
+              status = HI_READ(fd, gbuf, (2*count*DFKNTsize(DFNT_INT32)));
+              if (status == FAIL)
+                {
+                    num_errs++;
+                    printf(">>> Reading External file data failed\n");
+                }
+              else
+                {
+
+                    j = 0;
+                    for (i = 0; i < 2 * count; i++)
+                      {
+                          ival = 0xff & gbuf[j++];
+                          ival = ival<<8 | (0xff & gbuf[j++]);
+                          ival = ival<<8 | (0xff & gbuf[j++]);
+                          ival = ival<<8 | (0xff & gbuf[j++]);
+                          
+                          if (ival != i)
+                            {
+                                num_errs++;
+                                printf(">>> External value %d was expecting %d got %d\n",
+                                       (int) i, (int) i, (int) ival);
+                            }
+                      }
+                }
+              /* low level close of external file */
+              HI_CLOSE(fd);
+          }
+    }
+#endif /* HAVE_FMPOOL */
+
+    /* Move to the next one (integers + floats) */
+    ref = VSgetid(fid, ref);
+    if (ref == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSgetid was unable to find third Vdata\n");
+      }
+
+    /* read in the first data and verify metadata and contents */
+    vs1 = VSattach(fid, ref, "r");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    status = VSgetname(vs1, vsname);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, vsclass);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(vsname, "Mixed Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", vsname);
+      }
+
+    if (HDstrcmp(vsclass, "No class specified"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", vsclass);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, vsname);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSinquire failed on float Vdata\n");
+      }
+
+    if (HDstrcmp(vsname, "Mixed Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Mixed Vdata name (VSinquire) : %s\n", vsname);
+      }
+
+    if (count != 100)
+      {
+          num_errs++;
+          printf(">>> Got wrong count %d expecting 100\n", (int) count);
+      }
+
+    if ((size_t)sz != sizeof(int32) + sizeof(float32))
+      {
+          num_errs++;
+          printf(">>> Got wrong data size %d should be sizeof(int32) + sizeof(float32)\n", (int) sz);
+      }
+
+    if (HDstrcmp(fields, "A,B"))
+      {
+          num_errs++;
+          printf(">>> Got bogus field name %s\n", fields);
+      }
+
+    /* read it */
+    status = VSsetfields(vs1, fields);
+    CHECK(status,FAIL,"VSsetfields:vs1");
+
+    for (i = 0; i < 1000; i++)
+        gbuf[i] = 0;
+
+    status = VSread(vs1, (unsigned char *) gbuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSread:vs1");
+
+    /* verify */
+    p = gbuf;
+    for (i = 0; i < count; i++)
+      {
+          float32     fl=(float32)0.0;
+          int32       in=(int32)0;
+
+          HDmemcpy(&fl, p, sizeof(float32));
+          p += sizeof(float32);
+          HDmemcpy(&in, p, sizeof(int32));
+          p += sizeof(int32);
+
+          if (in != i)
+            {
+                num_errs++;
+                printf(">>> Mixed int value %d was expecting %d got %d\n", (int) i, (int) i, (int) in);
+            }
+
+          if (fl != (float32) (i * 2))
+            {
+                num_errs++;
+                printf(">>> Mixed float value %d was expecting %d got %f\n", (int) i, (int) i, fl);
+            }
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    /* Move to the next one (multi-order) */
+    ref = VSgetid(fid, ref);
+    if (ref == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSgetid was unable to find multi-order Vdata\n");
+      }
+
+    /* read in the first data and verify metadata and contents */
+    vs1 = VSattach(fid, ref, "r");
+    CHECK(vs1,FAIL,"VSattach:vs1");
+
+    status = VSgetname(vs1, vsname);
+    CHECK(status,FAIL,"VSgetname:vs1");
+
+    status = VSgetclass(vs1, vsclass);
+    CHECK(status,FAIL,"VSgetclass:vs1");
+
+    if (HDstrcmp(vsname, "Multi-Order Vdata"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name (VSgetname) : %s\n", vsname);
+      }
+
+    if (HDstrcmp(vsclass, "No class specified"))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata class : %s\n", vsclass);
+      }
+
+    status = VSinquire(vs1, &count, &intr, fields, &sz, vsname);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSinquire failed on multi-order Vdata\n");
+      }
+
+    if (count != 10)
+      {
+          num_errs++;
+          printf(">>> Got wrong count %d expecting 10\n", (int) count);
+      }
+
+    if (HDstrcmp(fields, MX))
+      {
+          num_errs++;
+          printf(">>> Got bogus field name %s\n", fields);
+      }
+
+    /*
+     * verify - read in all fields
+     */
+
+    /* read it */
+    status = VSsetfields(vs1, fields);
+    CHECK(status,FAIL,"VSsetfields:vs1");
+
+    for (i = 0; i < 1000; i++)
+        gbuf[i] = 0;
+
+    status = VSread(vs1, (unsigned char *) gbuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSread:vs1");
+
+    p = gbuf;
+    fl_expected = (float32) 15.5;
+    in_expected = 0;
+    c_expected = 'a';
+
+    for (i = 0; i < count; i++)
+      {
+          float32     fl=(float32)0.0;
+          int32       in=(int32)0;
+          char8       c=(char8)0;
+
+          /* read and verify characters */
+          HDmemcpy(&c, p, sizeof(char8));
+          p += sizeof(char8);
+
+          if (c != c_expected)
+            {
+                num_errs++;
+                printf(">>> Multi-order char value %d.0 was expecting %c got %c\n", (int) i, c_expected, c);
+            }
+          c_expected++;
+
+          HDmemcpy(&c, p, sizeof(char8));
+          p += sizeof(char8);
+
+          if (c != c_expected)
+            {
+                num_errs++;
+                printf(">>> Multi-order char value %d.1 was expecting %c got %c\n", (int) i, c_expected, c);
+            }
+          c_expected++;
+
+          /* read and verify integers */
+          HDmemcpy(&in, p, sizeof(int32));
+          p += sizeof(int32);
+
+          if (in != in_expected)
+            {
+                num_errs++;
+                printf(">>> Multi-order int value %d.0 was expecting %d got %d\n", (int) i, (int) in_expected, (int) in);
+            }
+          in_expected++;
+          HDmemcpy(&in, p, sizeof(int32));
+          p += sizeof(int32);
+
+          if (in != in_expected)
+            {
+                num_errs++;
+                printf(">>> Multi-order int value %d.1 was expecting %d got %d\n", (int) i, (int) in_expected, (int) in);
+            }
+          in_expected++;
+          HDmemcpy(&in, p, sizeof(int32));
+          p += sizeof(int32);
+
+          if (in != in_expected)
+            {
+                num_errs++;
+                printf(">>> Multi-order int value %d.2 was expecting %d got %d\n", (int) i, (int) in_expected, (int) in);
+            }
+          in_expected++;
+
+          /* read and verify floating point value */
+          HDmemcpy(&fl, p, sizeof(float32));
+          p += sizeof(float32);
+
+          if (fl != fl_expected)
+            {
+                num_errs++;
+                printf(">>> Multi-order float value %d was expecting %f got %f\n", (int) i, fl_expected, fl);
+            }
+          fl_expected += (float32) 0.5;
+
+      }
+
+    /*
+     * verify - just read in the character field with FULL_INTERLACE
+     */
+
+    /* read it */
+    status = VSseek(vs1, 0);
+    CHECK(status,FAIL,"VSseek:vs1");
+
+    status = VSsetfields(vs1, ST);
+    CHECK(status,FAIL,"VSsetfields:vs1");
+
+    for (i = 0; i < 1000; i++)
+        gbuf[i] = 0;
+
+    status = VSread(vs1, (unsigned char *) gbuf, count, FULL_INTERLACE);
+    CHECK(status,FAIL,"VSread:vs1");
+
+    p = gbuf;
+    c_expected = 'a';
+
+    for (i = 0; i < count; i++)
+      {
+          char8       c='\0';
+
+          /* read and verify characters */
+          HDmemcpy(&c, p, sizeof(char8));
+          p += sizeof(char8);
+
+          if (c != c_expected)
+            {
+                num_errs++;
+                printf(">>> FULL_INTERLACE read char value %d.0 (%c) got %c %d\n", (int) i, c_expected, c, c);
+            }
+          c_expected++;
+
+          HDmemcpy(&c, p, sizeof(char8));
+          p += sizeof(char8);
+
+          if (c != c_expected)
+            {
+                num_errs++;
+                printf(">>> FULL_INTERLACE read char value %d.1 (%c) %c got %c\n", (int) i, c_expected, c, c);
+            }
+          c_expected++;
+
+      }
+
+    /*
+     * verify - just read in the character field with NO_INTERLACE
+     */
+
+    /* read it */
+    status = VSseek(vs1, 0);
+    CHECK(status,FAIL,"VSseek:vs1");
+
+    status = VSsetfields(vs1, ST);
+    CHECK(status,FAIL,"VSsetfields:vs1");
+
+    for (i = 0; i < 1000; i++)
+        gbuf[i] = 0;
+
+    status = VSread(vs1, (unsigned char *) gbuf, count, NO_INTERLACE);
+    CHECK(status,FAIL,"VSread:vs1");
+
+    p = gbuf;
+    c_expected = 'a';
+
+    for (i = 0; i < count; i++)
+      {
+          char8       c='\0';
+
+          /* read and verify characters */
+          HDmemcpy(&c, p, sizeof(char8));
+          p += sizeof(char8);
+
+          if (c != c_expected)
+            {
+                num_errs++;
+                printf(">>> NO_INTERLACE read char value %d.0 (%c) got %c\n", (int) i, c_expected, c);
+            }
+          c_expected++;
+
+          HDmemcpy(&c, p, sizeof(char8));
+          p += sizeof(char8);
+
+          if (c != c_expected)
+            {
+                num_errs++;
+                printf(">>> NO_INTERLACE read char value %d.1 (%c) %c got\n", (int) i, c_expected, c);
+            }
+          c_expected++;
+
+      }
+
+    /* verify that VSfind does not mess up the AIDs of attached Vdatas */
+    status = VSfind(fid, "foo");
+    CHECK(status,FAIL,"VSfind:fid");
+
+    if (VSseek(vs1, 0) == FAIL)
+      {
+          num_errs++;
+          printf(">>> VSseek failed after VSfind call\n");
+      }
+
+    status = VSdetach(vs1);
+    CHECK(status,FAIL,"VSdetach:vs1");
+
+    status = Vend(fid);
+    CHECK(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK(status,FAIL,"Hclose:fid");
+
+    return SUCCEED;
+}   /* read_vset_stuff */
+
+/*
+   Testing VSdelete for vdatas.
+   Modification:
+	2011/12/22: added a test for VSgetexternalinfo on non-external vdata.
+ */
+static void
+test_vsdelete(void)
+{
+#define FIELD_NAME     "Field Entries"
+#define NUMBER_OF_ROWS 10
+#define ORDER           3
+    int32  fid;
+    int32  vdata_id;
+    int32  status;
+    int32  num_of_elements;
+    int16  vdata_buf[NUMBER_OF_ROWS * ORDER];
+    int32  v_ref;
+    intn   i;
+
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* Create a new vdata. */
+    vdata_id = VSattach(fid, -1, "w");
+    CHECK_VOID(vdata_id,FAIL,"VSattach:vdata_id");
+          
+    /* Define the field data name, type and order. */
+    status = VSfdefine(vdata_id, FIELD_NAME, DFNT_INT16, ORDER);
+    CHECK_VOID(status,FAIL,"VSfdefine:vdata_id");
+
+    /* Specify the field(s) that will be written to. */
+    status = VSsetfields(vdata_id, FIELD_NAME);
+    CHECK_VOID(status,FAIL,"VSsetfields:vdata_id");
+
+    /* Generate the Vset data. */
+    for (i = 0; i < NUMBER_OF_ROWS * ORDER; i+=ORDER) 
+      {
+          vdata_buf[i] = i;
+          vdata_buf[i + 1] = i + 1;
+          vdata_buf[i + 2] = i + 2;
+      }
+
+    /* Write the data to the Vset. */
+    num_of_elements = VSwrite(vdata_id, (const uint8 *)vdata_buf, 
+                              NUMBER_OF_ROWS, FULL_INTERLACE);
+    CHECK_VOID(num_of_elements,FAIL,"VSwrite:");
+
+    /* Set the name and class. */
+    status = VSsetname(vdata_id, "Vdata should have been deleted");
+    CHECK_VOID(status,FAIL,"VSsetname:vdata_id");
+
+    status = VSsetclass(vdata_id, "Vdata should have been deleted");
+    CHECK_VOID(status,FAIL,"VSsetclass:vdata_id");
+
+    /* get ref of Vdata */
+    v_ref = VSQueryref(vdata_id);
+    CHECK_VOID(v_ref,FAIL,"VSQueryref:vdata_id");
+
+    /* Terminate access to the vdata. */
+    status = VSdetach(vdata_id);
+    CHECK_VOID(status,FAIL,"VSdetach:vdata_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+    /* Now open the file again and delete the vdata */
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* attach to Vdata */
+    vdata_id = VSattach(fid, v_ref, "w");
+    CHECK_VOID(vdata_id,FAIL,"VSattach:vdata_id");
+
+    /* Test VSgetexternalinfo on this vdata that doesn't have external
+       element, should return 0 for length of external file name */
+    {
+	intn name_len = 0;
+	name_len = VSgetexternalinfo(vdata_id, 0, NULL, NULL, NULL);
+	VERIFY_VOID(name_len, 0, "VSgetexternalinfo:vdata_id");
+    }
+
+    /* Delete this Vdata */
+    status = VSdelete(fid, v_ref);
+    CHECK_VOID(status,FAIL,"VSdelete:vdata_id");
+
+    /* Terminate access to the vdata. */
+    status = VSdetach(vdata_id);
+    CHECK_VOID(status,FAIL,"VSdetach:vdata_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+    /* Now open file again and try to attach to vdata with 'v_ref'.
+       The VSattach should fail. */
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDONLY, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent the vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* Try to attach to Vdata. This should fail now */
+    vdata_id = VSattach(fid, v_ref, "w");
+    if (vdata_id != FAIL)
+      {
+          num_errs++;
+          printf(">>> VSdelete failed to delete vdata \n");
+      }
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+} /* test_vsdelete */
+
+/* Testing Vdelete for vgroups. */ 
+static void
+test_vdelete(void)
+{
+    int32 fid;
+    int32 vgroup_id;
+    int32 status;
+    int32 vg_ref;
+
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* Create a new vgroup. */
+    vgroup_id = Vattach(fid, -1, "w");
+    CHECK_VOID(vgroup_id,FAIL,"Vattach:vgroup_id");
+          
+    /* Set the name and class. */
+    status = Vsetname(vgroup_id, "Vgroup should have been deleted");
+    CHECK_VOID(status,FAIL,"Vsetname:vgroup_id");
+
+    status = Vsetclass(vgroup_id, "Vgroup should have been deleted");
+    CHECK_VOID(status,FAIL,"Vsetclass:vgroup_id");
+
+    /* get ref of vgroup */
+    vg_ref = VQueryref(vgroup_id);
+    CHECK_VOID(vg_ref,FAIL,"VQueryref:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK_VOID(status,FAIL,"Vdetach:vgroup_id");
+    
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+    /* Now open the file again and delete the vgroup */
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* attach to vgroup */
+    vgroup_id = Vattach(fid, vg_ref, "w");
+    CHECK_VOID(vgroup_id,FAIL,"Vattach:vgroup_id");
+
+    /* delete this vgroup */
+    status = Vdelete(fid, vg_ref);
+    CHECK_VOID(status,FAIL,"Vdelete:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK_VOID(status,FAIL,"VSdetach:vgroup_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+    /* Now open file again and try to attach to vgroup with 'vg_ref'.
+       The Vattach should fail. */
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDONLY, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent the vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* Try to attach to vgroup. This should fail now */
+    vgroup_id = Vattach(fid, vg_ref, "w");
+    if(vgroup_id != FAIL)
+      {
+          num_errs++;
+          printf(">>> Vdelete failed to delete vdata \n");
+      }
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+} /* test_vdelete */
+
+/* Testing Vdeletetagref() for vgroups. */ 
+static void
+test_vdeletetagref(void)
+{
+    int32 fid;
+    int32 vgroup_id;
+    int32 status;
+    int32 vg_ref;
+
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* Create a new vgroup. */
+    vgroup_id = Vattach(fid, -1, "w");
+    CHECK_VOID(vgroup_id,FAIL,"Vattach:vgroup_id");
+          
+    /* Set the name and class. */
+    status = Vsetname(vgroup_id, "Vgroup to delete elements from");
+    CHECK_VOID(status,FAIL,"Vsetname:vgroup_id");
+
+    status = Vsetclass(vgroup_id, "Vgroup to delete elements from");
+    CHECK_VOID(status,FAIL,"Vsetclass:vgroup_id");
+
+    /* add a few tag/ref pairs to Vgroup */
+    status = Vaddtagref(vgroup_id, 1000, 12345);
+    CHECK_VOID(status,FAIL,"Vaddtagref");
+    status = Vaddtagref(vgroup_id, 1000, 12346);
+    CHECK_VOID(status,FAIL,"Vaddtagref");
+
+#ifndef NO_DUPLICATES
+    /* duplicate tag/ref pairs allowed. 
+       So add a duplicate */
+    status = Vaddtagref(vgroup_id, 1000, 12346);
+    CHECK_VOID(status,FAIL,"Vaddtagref");
+
+#endif /* NO_DUPLICATES */
+
+    status = Vaddtagref(vgroup_id, 2000, 12345);
+    CHECK_VOID(status,FAIL,"Vaddtagref");
+    status = Vaddtagref(vgroup_id, 2000, 12346);
+    CHECK_VOID(status,FAIL,"Vaddtagref");
+
+    status = Vaddtagref(vgroup_id, 3000, 12345);
+    CHECK_VOID(status,FAIL,"Vaddtagref");
+    status = Vaddtagref(vgroup_id, 3000, 12346);
+    CHECK_VOID(status,FAIL,"Vaddtagref");
+
+    /* get ref of vgroup */
+    vg_ref = VQueryref(vgroup_id);
+    CHECK_VOID(vg_ref,FAIL,"VQueryref:vgroup_id");
+
+    /* delete one item in vgroup during this round */
+    status = Vdeletetagref(vgroup_id, 1000, 12346);
+    CHECK_VOID(status,FAIL,"Vdeletetagref:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK_VOID(status,FAIL,"Vdetach:vgroup_id");
+    
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+    /* Now open the file again and delete two elements in the vgroup
+       during this round. */
+
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* attach to vgroup */
+    vgroup_id = Vattach(fid, vg_ref, "w");
+    CHECK_VOID(vgroup_id,FAIL,"Vattach:vgroup_id");
+
+#ifndef NO_DUPLICATES
+    /* inquire about number of elments in Vgroup.
+       There should only be 6 of them including one duplicate. */
+    if (6 != Vntagrefs(vgroup_id))
+      {
+          num_errs++;
+          printf(">>> Vntagrefs returned %d was expecting %d\n", 
+                 (int)Vntagrefs(vgroup_id),6);
+      }
+
+    /* delete a duplicate in this vgroup */
+    status = Vdeletetagref(vgroup_id, 1000, 12346);
+    CHECK_VOID(status,FAIL,"Vdeletetagref:vgroup_id");
+#else /* NO_DUPLICATES */
+    /* inquire about number of elments in Vgroup.
+       There should only be 5 of them since no duplicates . */
+    if (5 != Vntagrefs(vgroup_id))
+      {
+          num_errs++;
+          printf(">>> Vntagrefs returned %d was expecting %d\n", 
+                 (int)Vntagrefs(vgroup_id),5);
+      }
+#endif /* NO_DUPLICATES */
+
+    /* delete some tag/refs in this vgroup */
+    status = Vdeletetagref(vgroup_id, 2000, 12346);
+    CHECK_VOID(status,FAIL,"Vdeletetagref:vgroup_id");
+
+    /* this should be the last element in the vgroup if I have
+       the order right */
+    status = Vdeletetagref(vgroup_id, 3000, 12346);
+    CHECK_VOID(status,FAIL,"Vdeletetagref:vgroup_id");
+
+    /* Terminate access to the vgroup. */
+    status = Vdetach(vgroup_id);
+    CHECK_VOID(status,FAIL,"VSdetach:vgroup_id");
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+    /* Now open file again and try to attach to vgroup with 'vg_ref'.
+       There should only be 3 elements left in Vgroup left . */
+
+    /* Open the HDF file. */
+    fid = Hopen(FNAME0, DFACC_RDONLY, 0);
+    CHECK_VOID(fid,FAIL,"Hopen:tvset.hdf");
+
+    /* Initialize HDF for subsequent the vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart:fid");
+
+    /* attach to vgroup, read only */
+    vgroup_id = Vattach(fid, vg_ref, "r");
+    CHECK_VOID(vgroup_id,FAIL,"Vattach:vgroup_id");
+
+    /* inquire about number of elments left in Vgroup.
+       There should only be 3 of them now. */
+    if (3 != Vntagrefs(vgroup_id))
+      {
+          num_errs++;
+          printf(">>> Vntagrefs returned %d was expecting %d\n", 
+                 (int)Vntagrefs(vgroup_id), 3);
+      }
+
+    /* check tag/ref pair of those 3 elements */
+    if (Vinqtagref(vgroup_id, 1000, 12345) == FALSE)
+      {
+          num_errs++;
+          printf(">>> Vinqtagref couldn't find valid element\n");
+      }
+    if (Vinqtagref(vgroup_id, 2000, 12345) == FALSE)
+      {
+          num_errs++;
+          printf(">>> Vinqtagref couldn't find valid element\n");
+      }
+    if (Vinqtagref(vgroup_id, 3000, 12345) == FALSE)
+      {
+          num_errs++;
+          printf(">>> Vinqtagref couldn't find valid element\n");
+      }
+
+    /* Terminate access to the Vxxx interface and close the file. */
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend:fid");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose:fid");
+
+} /* test_vdeletetagref */
+
+static void
+test_emptyvdata(void)
+{
+    int32 status;       /* Status values from routines */
+    int32 fid;          /* File ID */
+    int32 vs1;          /* Vdata ID */
+    int32 ref;          /* Vdata ref */
+    char  vsname[VSNAMELENMAX], fields[FIELDNAMELENMAX*VSFIELDMAX];
+
+    /* Open the HDF file. */
+    fid = Hopen(EMPTYNM, DFACC_CREATE, 0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Create a new vdata. */
+    vs1 = VSattach(fid, -1, "w");
+    CHECK_VOID(vs1,FAIL,"VSattach");
+
+    status=VSsetname(vs1, EMPTY_VDATA);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status = VSdetach(vs1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+    MESSAGE(5, printf("created empty VDATA %s\n", EMPTY_VDATA););
+
+    /* Re-open the HDF file. */
+    fid = Hopen(EMPTYNM, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Find the empty vdata. */
+    ref=VSfind(fid,EMPTY_VDATA);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vs1 = VSattach(fid, ref, "r");
+    CHECK_VOID(vs1,FAIL,"VSattach");
+
+    status=VSgetname(vs1, vsname);
+    CHECK_VOID(status,FAIL,"VSgetname");
+
+    if (HDstrcmp(vsname, EMPTY_VDATA))
+      {
+          num_errs++;
+          printf(">>> Got bogus Vdata name : %s\n", vsname);
+      }
+
+    status=VFnfields(vs1);
+    VERIFY_VOID(status,0,"VFnfields");
+
+    /* Verify that VSgetfields will return FAIL when passing in a NULL
+       for field name list (from bug #554), although this might never 
+       happen - BMR 5/17/01 */
+    status = VSgetfields(vs1, NULL);
+    VERIFY_VOID(status, FAIL, "VSgetfields");
+
+    status=VSgetfields(vs1,fields);
+    CHECK_VOID(status,FAIL,"VSgetfields");
+
+    if (HDstrcmp(fields, ""))
+      {
+          num_errs++;
+          printf(">>> Got bogus field names : %s\n", fields);
+      }
+
+    status = VSdetach(vs1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+    MESSAGE(5, printf("read back in empty VDATA %s\n", EMPTY_VDATA););
+
+    /* Re-open the HDF file. */
+    fid = Hopen(EMPTYNM, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Find the empty vdata. */
+    ref=VSfind(fid,EMPTY_VDATA);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vs1 = VSattach(fid, ref, "w");
+    CHECK_VOID(vs1,FAIL,"VSattach");
+
+    /* Write out simple vdata fields */
+    status=VSfdefine(vs1, FIELD1, DFNT_FLOAT32, 1);
+    CHECK_VOID(status,FAIL,"VSfdefine");
+
+    status = VSfdefine(vs1, FIELD2, DFNT_INT32, 2);
+    CHECK_VOID(status,FAIL,"VSfdefine");
+
+    status = VSsetfields(vs1, FIELD1","FIELD2);
+    if (status == FAIL)
+      {
+          num_errs++;
+          printf(">>> Vsetfields failed for %s\n", vsname);
+      }
+
+    status = VSdetach(vs1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+    MESSAGE(5, printf("changed empty VDATA %s to have two fields\n", EMPTY_VDATA););
+
+    /* Re-open the HDF file. */
+    fid = Hopen(EMPTYNM, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Find the empty vdata. */
+    ref=VSfind(fid,EMPTY_VDATA);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vs1 = VSattach(fid, ref, "r");
+    CHECK_VOID(vs1,FAIL,"VSattach");
+
+    status=VFnfields(vs1);
+    VERIFY_VOID(status,2,"VFnfields");
+
+    status=VSgetfields(vs1,fields);
+    CHECK_VOID(status,FAIL,"VSgetfields");
+
+    if (HDstrcmp(fields, FIELD1","FIELD2))
+      {
+          num_errs++;
+          printf(">>> Got bogus field names : %s\n", fields);
+      }
+
+    status = VSdetach(vs1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+} /* test_emptyvdata() */
+
+static void
+test_vglongnames(void)
+{
+    int32 status;       /* Status values from routines */
+    int32 fid;          /* File ID */
+    int32 vg1;          /* Vdata ID */
+    int32 ref;          /* Vdata ref */
+    uint16 name_len;	/* Length of a vgroup's name or class name */
+    char *vgname, *vgclass;
+
+    /* Open the HDF file. */
+    fid = Hopen(LONGNAMES, DFACC_CREATE, 0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Create a new vgroup. */
+    vg1 = Vattach(fid, -1, "w");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    status=Vsetname(vg1, VG_LONGNAME);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status=Vsetclass(vg1, VG_LONGCLASS);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    /* Create another vgroup of the same class. */
+    vg1 = Vattach(fid, -1, "w");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    status=Vsetname(vg1, VGROUP1);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status=Vsetclass(vg1, VG_LONGCLASS);
+    CHECK_VOID(status,FAIL,"VSsetname");
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+    /* Re-open the HDF file. */
+    fid = Hopen(LONGNAMES, DFACC_RDWR, 0);
+    CHECK_VOID(fid,FAIL,"Hopen");
+
+    /* Initialize HDF for subsequent vgroup/vdata access. */
+    status = Vstart(fid);
+    CHECK_VOID(status,FAIL,"Vstart");
+
+    /* Find the long name vgroup. */
+    ref=Vfind(fid,VG_LONGNAME);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vg1 = Vattach(fid, ref, "r");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    /* get the vgroup's name */
+    status = Vgetnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgname = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgname, "vgname", "test_vglongnames" );
+
+    status=Vgetname(vg1, vgname);
+    CHECK_VOID(status,FAIL,"VSgetname");
+
+    if (HDstrcmp(vgname, VG_LONGNAME)) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup name : %s\n", vgname);
+    }
+
+    if (vgname != NULL)
+        HDfree(vgname);
+
+    /* get the vgroup's class */
+    status = Vgetclassnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgclass = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames" );
+
+    status=Vgetclass(vg1, vgclass);
+    CHECK_VOID(status,FAIL,"VSgetclass");
+
+    if (HDstrcmp(vgclass, VG_LONGCLASS)) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup class : %s\n", vgclass);
+    }
+
+    if (vgclass != NULL)
+        HDfree(vgclass);
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    /* Find the vgroup VGROUP1. */
+    ref=Vfind(fid,VGROUP1);
+    CHECK_VOID(ref,FAIL,"VSfind");
+
+    vg1 = Vattach(fid, ref, "r");
+    CHECK_VOID(vg1,FAIL,"VSattach");
+
+    /* get the vgroup's name */
+    status = Vgetnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgname = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgname, "vgname", "test_vglongnames" );
+
+    status=Vgetname(vg1, vgname);
+    CHECK_VOID(status,FAIL,"VSgetname");
+
+    if (HDstrcmp(vgname, VGROUP1)) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup name : %s\n", vgname);
+    }
+
+    if (vgname != NULL)
+        HDfree(vgname);
+
+    /* get the vgroup's class */
+    status = Vgetclassnamelen(vg1, &name_len);
+    CHECK_VOID(status,FAIL,"Vgetnamelen");
+
+    vgclass = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames" );
+
+    status=Vgetclass(vg1, vgclass);
+    CHECK_VOID(status,FAIL,"VSgetclass");
+
+    if (HDstrcmp(vgclass, VG_LONGCLASS)) {
+        num_errs++;
+        printf(">>> Got bogus Vgroup class : %s\n", vgclass);
+    }
+
+    if (vgclass != NULL)
+        HDfree(vgclass);
+
+    status = Vdetach(vg1);
+    CHECK_VOID(status,FAIL,"Vdetach");
+    
+    status = Vend(fid);
+    CHECK_VOID(status,FAIL,"Vend");
+
+    status = Hclose(fid);
+    CHECK_VOID(status,FAIL,"Hclose");
+
+} /* test_vglongnames() */
+
+#define USERVGROUPS "tuservgs.hdf"
+#define NUM_VGROUPS 10
+static void
+test_getvgroups(void)
+{
+    int32 fid;          /* File ID */
+    int32 vgroup_id, vgroup0_id, vgroup1_id, vgroup2_id,
+	  vgroup3_id, vgroup4_id, vgroup5_id;	/* Various vgroup IDs */
+    int32 vgroup_ref;   /* Vgroup ref */
+    uintn n_vgs=0;
+    uint16 *refarray;
+    int32 ref_list[NUM_VGROUPS];
+    char vgclass[20];
+    int ii;
+    int32 status;       /* Status values from routines */
+    intn  status_n;	/* returned status for functions returning an intn  */
+
+
+    /* Create HDF file and initialize the interface. */
+    fid = Hopen(USERVGROUPS, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status, FAIL, "Vstart");
+
+    /* Create NUM_VGROUPS vgroups and set classname */
+    for (ii = 0; ii < NUM_VGROUPS; ii++) {
+        /* Create a vgroup. */
+        vgroup_id = Vattach(fid, -1, "w");
+        CHECK_VOID(vgroup_id, FAIL, "Vattach");
+
+        /* Record its reference number for later access */
+        vgroup_ref = VQueryref(vgroup_id);
+        CHECK_VOID(vgroup_ref, FAIL, "VQueryref:vgroup_id");
+        ref_list[ii] = vgroup_ref;
+
+        /* Set its class name */
+        sprintf(vgclass, "VG-CLASS-%d", ii);
+        status = Vsetclass(vgroup_id, vgclass);
+        CHECK_VOID(status, FAIL, "Vsetclass");
+
+        /* Detach it */
+        status = Vdetach(vgroup_id);
+        CHECK_VOID(status, FAIL, "Vdetach");
+    }
+
+    /* Insert some vgroups into some other vgroups to build some sort of
+	vgroup structure */
+
+    /* Insert "VG-CLASS-1" and "VG-CLASS-2" into "VG-CLASS-0" */
+    vgroup0_id = Vattach(fid, ref_list[0], "w");
+    CHECK_VOID(vgroup0_id, FAIL, "Vattach");
+    vgroup1_id = Vattach(fid, ref_list[1], "w");
+    CHECK_VOID(vgroup1_id, FAIL, "Vattach");
+    vgroup2_id = Vattach(fid, ref_list[2], "w");
+    CHECK_VOID(vgroup2_id, FAIL, "Vattach");
+    status = Vinsert(vgroup0_id, vgroup1_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup1_id into vgroup0_id");
+    status = Vinsert(vgroup0_id, vgroup2_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup2_id into vgroup0_id");
+
+    /* Insert "VG-CLASS-3", "VG-CLASS-4", and "VG-CLASS-5" into "VG-CLASS-1" */
+    vgroup3_id = Vattach(fid, ref_list[3], "w");
+    CHECK_VOID(vgroup3_id, FAIL, "Vattach");
+    vgroup4_id = Vattach(fid, ref_list[4], "w");
+    CHECK_VOID(vgroup4_id, FAIL, "Vattach");
+    vgroup5_id = Vattach(fid, ref_list[5], "w");
+    CHECK_VOID(vgroup5_id, FAIL, "Vattach");
+    status = Vinsert(vgroup1_id, vgroup3_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup3_id into vgroup1_id");
+    status = Vinsert(vgroup1_id, vgroup4_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup4_id into vgroup1_id");
+    status = Vinsert(vgroup1_id, vgroup5_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup5_id into vgroup1_id");
+
+    /**************************************************************
+	The vgroup structure should look like this:
+		vg0	vg6  vg7  vg8  vg9
+		 |
+		/ \
+	      vg1  vg2
+               |
+             / | \
+            /  |  \
+         vg3  vg4  vg5
+
+    Calling Vgetvgroups on the file should return all ten vgroups.
+    Calling Vgetvgroups on vg0 should return 2, vg1 and vg2.
+    Calling Vgetvgroups on vg1 should return 3, vg3, vg4, and vg5
+    Calling Vgetvgroups on vg6, vg7, vg8, and vg9 should return 0
+    ***************************************************************/
+
+    /* Get and verify the number of vgroups in the file */
+    n_vgs = Vgetvgroups(fid, 0, 0, NULL);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups fid");
+    VERIFY_VOID(n_vgs, NUM_VGROUPS, "Vgetvgroups fid");
+
+    /* Allocate space to retrieve the reference numbers of n_vgs vgroups */
+    refarray = (uint16 *)HDmalloc(sizeof(uint16)*n_vgs);
+
+    /* Get all the vgroups in the file */
+    n_vgs = Vgetvgroups(fid, 0, n_vgs, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups fid");
+    VERIFY_VOID(n_vgs, NUM_VGROUPS, "Vgetvgroups fid");
+
+    /* Verify refarray from this Vgetvgroups, it should contain:
+	2  3  4  5  6  7  8  9  10  11 */ 
+    {
+        uint16 result[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* Get 5 vgroups starting from vgroup number 5 */
+    n_vgs = Vgetvgroups(fid, 5, 5, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups fid (5,5)");
+    VERIFY_VOID(n_vgs, 5, "Vgetvgroups fid (5,5)");
+
+    /* Verify refarray from this Vgetvgroups, it should contain:
+	7  8  9  10  11 */
+    {
+        uint16 result[] = {7, 8, 9, 10, 11};
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* Get and verify the number of vgroups in vgroup0_id */
+    n_vgs = Vgetvgroups(vgroup0_id, 0, 0, NULL);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup0_id");
+    VERIFY_VOID(n_vgs, 2, "Vgetvgroups vgroup0_id");
+
+    /* Get all the vgroups in vgroup0_id (refarray already allocated to max */
+    n_vgs = Vgetvgroups(vgroup0_id, 0, n_vgs, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup0_id");
+    VERIFY_VOID(n_vgs, 2, "Vgetvgroups vgroup0_id");
+
+    /* Verify refarray from this Vgetvgroups, it should contain: 3  4 */ 
+    {
+        uint16 result[] = {3, 4};
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* Get and verify the number of vgroups in vgroup1_id */
+    n_vgs = Vgetvgroups(vgroup1_id, 0, 0, NULL);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup1_id");
+    VERIFY_VOID(n_vgs, 3, "Vgetvgroups vgroup1_id");
+
+    /* Get all the vgroups in vgroup1_id */
+    n_vgs = Vgetvgroups(vgroup1_id, 0, n_vgs, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup1_id");
+    VERIFY_VOID(n_vgs, 3, "Vgetvgroups vgroup1_id");
+
+    /* Verify refarray from this Vgetvgroups, it should contain: 5  6  7 */ 
+    {
+        uint16 result[] = {5, 6, 7};
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* This vgroup should have no sub-vgroup */
+    n_vgs = Vgetvgroups(vgroup5_id, 0, 0, NULL);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup5_id");
+    VERIFY_VOID(n_vgs, 0, "Vgetvgroups vgroup5_id");
+
+    /* These vgroups are not needed anymore.  */
+    status = Vdetach(vgroup2_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup2_id");
+    status = Vdetach(vgroup3_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup3_id");
+    status = Vdetach(vgroup4_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup4_id");
+    status = Vdetach(vgroup5_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup5_id");
+
+    /* Change class name of vg6 and vg7 to an internal class name to
+       simulate that they are internally created by the library. */
+    vgroup_id = Vattach(fid, ref_list[6], "w");
+    CHECK_VOID(vgroup_id, FAIL, "Vattach vg6");
+    status = Vsetclass(vgroup_id, _HDF_VARIABLE);
+    CHECK_VOID(status, FAIL, "Vsetclass _HDF_VARIABLE");
+    status = Vdetach(vgroup_id);
+    CHECK_VOID(status, FAIL, "Vdetach vg6");
+
+    vgroup_id = Vattach(fid, ref_list[7], "w");
+    CHECK_VOID(vgroup_id, FAIL, "Vattach vg7");
+    status = Vsetclass(vgroup_id, _HDF_DIMENSION);
+    CHECK_VOID(status, FAIL, "Vsetclass _HDF_DIMENSION");
+    status = Vdetach(vgroup_id);
+    CHECK_VOID(status, FAIL, "Vdetach vg7");
+
+    /**************************************************************
+    Calling Vgetvgroups on the file now should return 8 because vg6
+    and vg7 are no longer seen as user-created vgroups due to their
+    class name change.
+    ***************************************************************/
+
+    /* Get the number of vgroups in the file, which shouldn't include the
+	simulated internal vgroups */
+    n_vgs = Vgetvgroups(fid, 0, 0, NULL);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups fid");
+    VERIFY_VOID(n_vgs, 8, "Vgetvgroups fid");
+
+    /* Get these vgroups */
+    n_vgs = Vgetvgroups(fid, 0, n_vgs, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups fid");
+    VERIFY_VOID(n_vgs, 8, "Vgetvgroups fid");
+
+    /* Verify refarray from this Vgetvgroups, it should contain:
+	2  3  4  5  6  7  10  11 */ 
+    {
+        uint16 result[] = { 2, 3, 4, 5, 6, 7, 10, 11 };
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* Get 5 vgroups starting from vgroup number 5, the result shouldn't
+	include the simulated internal vgroups */
+    n_vgs = Vgetvgroups(fid, 5, 5, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups fid");
+    VERIFY_VOID(n_vgs, 3, "Vgetvgroups fid");
+
+    /* Verify refarray from this Vgetvgroups, it should contain: 7  10  11 */ 
+    {
+        uint16 result[] = { 7, 10, 11 };
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* Check on vgroup0_id again */
+    n_vgs = Vgetvgroups(vgroup0_id, 0, 0, NULL);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup0_id");
+    VERIFY_VOID(n_vgs, 2, "Vgetvgroups vgroup0_id");
+
+    n_vgs = Vgetvgroups(vgroup0_id, 0, n_vgs, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup0_id");
+    VERIFY_VOID(n_vgs, 2, "Vgetvgroups vgroup0_id");
+
+    /* Verify refarray from this Vgetvgroups, it should contain: 3  4 */ 
+    {
+        uint16 result[] = { 3, 4 };
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* Passing in more info count (3) than the actual number of vgrous to
+	be retrieved (1) */
+    n_vgs = Vgetvgroups(vgroup1_id, 2, 3, refarray);
+    CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup1_id");
+    VERIFY_VOID(n_vgs, 1, "Vgetvgroups vgroup1_id");
+
+    /* Verify refarray from this Vgetvgroups, it should contain: 7 */ 
+    {
+        uint16 result[] = { 7 };
+        for (ii = 0; ii < n_vgs; ii++)
+            if (refarray[ii] != result[ii])
+                fprintf(stderr, "test_getvgroups: incorrect vgroup retrieved at line %d - ref# %d should be %d\n", __LINE__, refarray[ii], result[ii]);
+    }
+
+    /* Passing in info count as 0 for a non-null array, should fail */
+    n_vgs = Vgetvgroups(fid, 0, 0, refarray);
+    VERIFY_VOID(n_vgs, FAIL, "Vgetvgroups with info_count = 0");
+
+    /* Passing in the starting vgroup beyond the number of user-created vgroups,
+       should fail */
+    n_vgs = Vgetvgroups(fid, 9, 3, refarray);
+    VERIFY_VOID(n_vgs, FAIL, "Vgetvgroups with start_vg = 9");
+
+    if (refarray != NULL)
+        HDfree(refarray);
+
+    /* Terminate access to the V interface and close the HDF file.  */
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+    status_n = Hclose (fid);
+    CHECK_VOID(status_n, FAIL, "Hclose");
+} /* test_getvgroups() */
+
+intn check_vgs(int32 id,
+	   uintn start_vg,
+	   uintn n_vgs,
+	   char *ident_text, /* just for debugging, remove when done */
+	   uintn resultcount,   /* expected number of vgroups */
+	   uint16 *resultarray) /* array containing expected values */
+{
+    uint16 *refarray=NULL;
+    uintn count=0, ii;
+    char message[30];
+    intn ret_value=SUCCEED;
+
+    HDstrcpy(message, "Vgetvgroups: ");
+    HDstrcat(message, ident_text);
+
+    /* Get and verify the number of vgroups in the file */
+    count = Vgetvgroups(id, start_vg, n_vgs, NULL);
+    CHECK(count, FAIL, "Vgetvgroups");
+    VERIFY(count, resultcount, "Vgetvgroups");
+
+    /* Allocate space to retrieve the reference numbers of 'count' vgroups */
+    refarray = (uint16 *)HDmalloc(sizeof(uint16)*count);
+    if (refarray == NULL) {
+        fprintf(stderr, "check_vgs: Allocation refarray failed\n");
+        return (-1);
+    }
+
+    /* Get all the vgroups in the file */
+    count = Vgetvgroups(id, start_vg, count, refarray);
+    CHECK(count, FAIL, "Vgetvgroups");
+    VERIFY(count, resultcount, "Vgetvgroups");
+
+    for (ii = 0; ii < count; ii++)
+	if (refarray[ii] != resultarray[ii])
+	    fprintf(stderr, "%s: at index %d - read value=%d, should be %d\n",
+		ident_text, ii, refarray[ii], resultarray[ii]);
+
+    if (refarray != NULL)
+        HDfree(refarray);
+
+    return ret_value;
+}
+
+intn check_vds(int32 id,
+	   uintn start_vd,
+	   uintn n_vds,
+	   char *ident_text, /* just for debugging, remove when done */
+	   uintn resultcount,   /* expected number of vdatas */
+	   uint16 *resultarray) /* array containing expected values */
+{
+    uint16 *refarray=NULL;
+    uintn count=0, ii;
+    char message[30];
+    intn ret_value=SUCCEED;
+
+    HDstrcpy(message, "VSgetvdatas: ");
+    HDstrcat(message, ident_text);
+
+    /* Get and verify the number of vdatas in the file */
+    count = VSgetvdatas(id, start_vd, n_vds, NULL);
+    CHECK(count, FAIL, message);
+    VERIFY(count, resultcount, message);
+
+    /* Allocate space to retrieve the reference numbers of 'count' vdatas */
+    refarray = (uint16 *)HDmalloc(sizeof(uint16)*count);
+    if (refarray == NULL) {
+        fprintf(stderr, "check_vds: Allocation refarray failed\n");
+        return (-1);
+    }
+
+    /* Get all the vdatas in the file */
+    count = VSgetvdatas(id, start_vd, count, refarray);
+    CHECK(count, FAIL, message);
+    VERIFY(count, resultcount, message);
+
+    for (ii = 0; ii < count; ii++)
+	if (refarray[ii] != resultarray[ii])
+	    fprintf(stderr, "%s: at index %d - read value=%d, should be %d\n",
+		ident_text, ii, refarray[ii], resultarray[ii]);
+
+    if (refarray != NULL)
+        HDfree(refarray);
+    
+    return ret_value;
+}
+
+#define USERVDATAS "tuservds.hdf"
+#define NUM_VDATAS 8
+static void
+test_getvdatas(void)
+{
+    int32 vgroup_id;
+    int32 vgroup_ref;
+    int32 vdata_id;
+    int32 vdata_ref;
+    int32 fid;          /* File ID */
+    int32 vgroup0_id, vgroup1_id, vgroup2_id, vgroup4_id,
+	  vgroup6_id, vgroup7_id, vgroup9_id;	/* Various vgroup IDs */
+    int32 vdata1_id, vdata2_id, vdata3_id, vdata4_id, vdata5_id,
+	  vdata6_id, vdata7_id;    /* Various vdata IDs */
+    uintn n_vgs=0;
+    int32 ref_list[NUM_VGROUPS], vdref_list[NUM_VDATAS];
+    char vgclass[20];
+    int ii;
+    int32 status;       /* Status values from routines */
+    intn  status_n;	/* returned status for functions returning an intn  */
+
+    /* Create HDF file and initialize the interface. */
+    fid = Hopen(USERVDATAS, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status, FAIL, "Vstart");
+
+    /* Create NUM_VGROUPS vgroups and set classname */
+    for (ii = 0; ii < NUM_VGROUPS; ii++)
+    {
+	/* Create a vgroup. */
+	vgroup_id = Vattach(fid, -1, "w");
+	CHECK_VOID(vgroup_id, FAIL, "Vattach");
+
+	/* Record its reference number for later access */
+	vgroup_ref = VQueryref(vgroup_id);
+	CHECK_VOID(vgroup_ref, FAIL, "VQueryref:vgroup_id");
+	ref_list[ii] = vgroup_ref;
+
+	/* Set its class name */
+	sprintf(vgclass, "VG-CLASS-%d", ii);
+	status = Vsetclass(vgroup_id, vgclass);
+	CHECK_VOID(status, FAIL, "Vsetclass");
+
+	/* Detach it */
+	status = Vdetach(vgroup_id);
+	CHECK_VOID(status, FAIL, "Vdetach");
+    }
+
+    /* Create NUM_VDATAS vgroups and set classname */
+    for (ii = 0; ii < NUM_VDATAS; ii++)
+    {
+	/* Create a vdata. */
+	vdata_id = VSattach(fid, -1, "w");
+	CHECK_VOID(vdata_id, FAIL, "VSattach");
+
+	/* Record its reference number for later access */
+	vdata_ref = VSQueryref(vdata_id);
+	CHECK_VOID(vdata_ref, FAIL, "VSQueryref:vdata_id");
+	vdref_list[ii] = vdata_ref;
+
+	/* Set its class name */
+	sprintf(vgclass, "VS-CLASS-%d", ii);
+	status = VSsetclass(vdata_id, vgclass);
+	CHECK_VOID(status, FAIL, "VSsetclass");
+
+	/* Detach it */
+	status = VSdetach(vdata_id);
+	CHECK_VOID(status, FAIL, "VSdetach");
+    }
+
+    /* Insert some vdatas/vgroups into some other vgroups to build some sort of
+	vgroup/vdata structure */
+
+    /* Insert "VD-CLASS-1" and "VD-CLASS-2" into "VG-CLASS-0" */
+    vgroup0_id = Vattach(fid, ref_list[0], "w");  /* "VG-CLASS-0" */
+    CHECK_VOID(vgroup0_id, FAIL, "Vattach");
+    vdata1_id = VSattach(fid, vdref_list[1], "w");  /* "VD-CLASS-1" */
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+    vdata2_id = VSattach(fid, vdref_list[2], "w");  /* "VD-CLASS-2" */
+    CHECK_VOID(vdata2_id, FAIL, "VSattach");
+
+    status = Vinsert(vgroup0_id, vdata1_id);
+    CHECK_VOID(status, FAIL, "Vinsert vdata1_id into vgroup0_id");
+    status = Vinsert(vgroup0_id, vdata2_id);
+    CHECK_VOID(status, FAIL, "Vinsert vdata2_id into vgroup0_id");
+
+    /* Insert "VG-CLASS-7" and "VG-CLASS-9" into "VG-CLASS-0" */
+    vgroup7_id = Vattach(fid, ref_list[7], "w");
+    CHECK_VOID(vgroup7_id, FAIL, "Vattach");
+    vgroup9_id = Vattach(fid, ref_list[9], "w");
+    CHECK_VOID(vgroup9_id, FAIL, "Vattach");
+
+    status = Vinsert(vgroup0_id, vgroup7_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup7_id into vgroup0_id");
+    status = Vinsert(vgroup0_id, vgroup9_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup9_id into vgroup0_id");
+
+    /* Insert "VD-CLASS-3", "VD-CLASS-4", and "VD-CLASS-5" into "VG-CLASS-9" */
+    vdata3_id = VSattach(fid, vdref_list[3], "w");
+    CHECK_VOID(vdata3_id, FAIL, "Vattach");
+    vdata4_id = VSattach(fid, vdref_list[4], "w");
+    CHECK_VOID(vdata4_id, FAIL, "Vattach");
+    vdata5_id = VSattach(fid, vdref_list[5], "w");
+    CHECK_VOID(vdata4_id, FAIL, "Vattach");
+
+    status = Vinsert(vgroup9_id, vdata3_id);
+    CHECK_VOID(status, FAIL, "Vinsert vdata3_id into vgroup9_id");
+    status = Vinsert(vgroup9_id, vdata4_id);
+    CHECK_VOID(status, FAIL, "Vinsert vdata4_id into vgroup9_id");
+    status = Vinsert(vgroup9_id, vdata5_id);
+    CHECK_VOID(status, FAIL, "Vinsert vdata5_id into vgroup9_id");
+
+    /* Insert "VG-CLASS-4", "VG-CLASS-6", and "VD-CLASS-7" into "VG-CLASS-1" */
+    vgroup1_id = Vattach(fid, ref_list[1], "w");
+    CHECK_VOID(vgroup1_id, FAIL, "Vattach");
+    vgroup4_id = Vattach(fid, ref_list[4], "w");
+    CHECK_VOID(vgroup4_id, FAIL, "Vattach");
+    vgroup6_id = Vattach(fid, ref_list[6], "w");
+    CHECK_VOID(vgroup6_id, FAIL, "Vattach");
+    vdata7_id = VSattach(fid, vdref_list[7], "w");
+    CHECK_VOID(vdata7_id, FAIL, "VSattach");
+
+    status = Vinsert(vgroup1_id, vgroup4_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup4_id into vgroup1_id");
+    status = Vinsert(vgroup1_id, vgroup6_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup6_id into vgroup1_id");
+    status = Vinsert(vgroup1_id, vdata7_id);
+    CHECK_VOID(status, FAIL, "Vinsert vdata7_id into vgroup1_id");
+
+    /* Insert "VD-CLASS-6", "VG-CLASS-2" into "VG-CLASS-6" */
+    vdata6_id = VSattach(fid, vdref_list[6], "w");
+    CHECK_VOID(vdata6_id, FAIL, "VSattach");
+    vgroup2_id = Vattach(fid, ref_list[2], "w");
+    CHECK_VOID(vgroup2_id, FAIL, "Vattach");
+
+    status = Vinsert(vgroup6_id, vgroup2_id);
+    CHECK_VOID(status, FAIL, "Vinsert vgroup2_id into vgroup6_id");
+    status = Vinsert(vgroup6_id, vdata6_id);
+    CHECK_VOID(status, FAIL, "Vinsert vdata6_id into vgroup6_id");
+
+    status = Vdetach(vgroup0_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup0_id");
+    status = Vdetach(vgroup1_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup1_id");
+    status = Vdetach(vgroup2_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup2_id");
+    status = Vdetach(vgroup4_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup4_id");
+    status = Vdetach(vgroup6_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup6_id");
+    status = Vdetach(vgroup7_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup7_id");
+    status = Vdetach(vgroup9_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup9_id");
+
+    status = VSdetach(vdata1_id);
+    CHECK_VOID(status, FAIL, "VSdetach vdata1_id");
+    status = VSdetach(vdata2_id);
+    CHECK_VOID(status, FAIL, "VSdetach vdata2_id");
+    status = VSdetach(vdata3_id);
+    CHECK_VOID(status, FAIL, "VSdetach vdata3_id");
+    status = VSdetach(vdata4_id);
+    CHECK_VOID(status, FAIL, "VSdetach vdata4_id");
+    status = VSdetach(vdata5_id);
+    CHECK_VOID(status, FAIL, "VSdetach vdata5_id");
+    status = VSdetach(vdata6_id);
+    CHECK_VOID(status, FAIL, "VSdetach vdata6_id");
+    status = VSdetach(vdata7_id);
+    CHECK_VOID(status, FAIL, "VSdetach vdata7_id");
+
+    /* Terminate access to the V interface and close the HDF file.  */
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+    status_n = Hclose (fid);
+    CHECK_VOID(status_n, FAIL, "Hclose");
+
+    /**************************************************************
+	The vgroup structure should look like this:
+	       vg0	            vg1 
+                |                    |
+	   +--+-+-----+            / | \
+           |          |           /  |  \
+          /\         / \        vg4 vg6 vd7
+         /  \       /   \            |
+        vd1 vd2   vg7  vg9          / \  
+                        |          /   \     
+                      / | \       /     \     
+                     /  |  \     vd6   vg2   
+                  vd3  vd4  vd5
+                  
+
+    Calling Vgetvgroups on the file should return all NUM_VGROUPS vgroups
+    Calling VSgetvdatas on the file should return all NUM_VDATAS vdatas
+    Calling Vgetvgroups on vg0 should return 2, vg7 and vg9
+    Calling VSgetvdatas on vg0 should return 2, vd1 and vd2
+    Calling Vgetvgroups on vg1 should return 2, vg4 and vg6
+    Calling VSgetvdatas on vg1 should return 1, vd7
+    Calling Vgetvgroups on vg6 should return 1, vg2
+    Calling VSgetvdatas on vg6 should return 1, vd6
+    Calling Vgetvgroups on vg9 should return 0
+    Calling Vgetvgroups on vg7 should return 0
+    Calling VSgetvdatas on vg9 starting at 2, with n_vds=2, should return 1, vd5
+    Calling Vgetvgroups on vg1 starting at 1, with n_vgs=3, should return 1, vg6
+
+    ***************************************************************/
+
+    /* Open the file to test Vgetvgroups and Vgetdatas */
+    fid = Hopen(USERVDATAS, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+    status = Vstart(fid);
+    CHECK_VOID(status, FAIL, "Vstart");
+
+    /* Test getting all vgroups in the file: fid, start_vg=0, n_vgs=0 */
+    {
+	uint16 result[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+	status = check_vgs(fid, 0, 0, "file, 0, 0", NUM_VGROUPS, result);
+	CHECK_VOID(status, FAIL, "Vgetvgroups fid");
+    }
+
+    /* Test getting all vdatas in the file: fid, start_vd=0, n_vds=0 */
+    {
+	uint16 result[] = {12, 13, 14, 15, 16, 17, 18, 19};
+	status = check_vds(fid, 0, 0, "file, 0, 0", NUM_VDATAS, result);
+	CHECK_VOID(status, FAIL, "VSgetvdatas fid");
+    }
+
+    vgroup0_id = Vattach(fid, ref_list[0], "w");  /* "VG-CLASS-0" */
+    CHECK_VOID(vgroup0_id, FAIL, "Vattach vgroup0_id");
+
+    /* Test getting vgroups in vg0: vgroup0_id, start_vd=0, n_vds=0 */
+    {
+	uint16 result[] = {9, 11};
+	status = check_vgs(vgroup0_id, 0, 0, "vgroup0_id, 0, 0", 2, result);
+	CHECK_VOID(status, FAIL, "VSgetvgroups vgroup0_id");
+    }
+
+    /* Test getting vdatas in vg0: vgroup0_id, start_vd=0, n_vds=0 */
+    {
+	uint16 result[] = {13, 14};
+	status = check_vds(vgroup0_id, 0, 0, "vgroup0_id, 0, 0", 2, result);
+	CHECK_VOID(status, FAIL, "VSgetvdatas fid");
+    }
+
+    vgroup1_id = Vattach(fid, ref_list[1], "w");  /* "VG-CLASS-1" */
+    CHECK_VOID(vgroup1_id, FAIL, "Vattach vgroup1_id");
+
+    /* Test getting vgroups in vg1: vgroup1_id, start_vd=0, n_vds=0 */
+    {
+	uint16 result[] = {6, 8}; /* vg4 and vg6 */
+	status = check_vgs(vgroup1_id, 0, 0, "vgroup1_id, 0, 0", 2, result);
+	CHECK_VOID(status, FAIL, "Vgetvgroups vgroup1_id");
+    }
+
+    /* Test getting vdatas in vg1: vgroup1_id, start_vd=0, n_vds=0 */
+    {
+	uint16 result[] = {19}; /* vd7 */
+	status = check_vds(vgroup1_id, 0, 0, "vgroup1_id, 0, 0", 1, result);
+	CHECK_VOID(status, FAIL, "VSgetvdata vgroup1_id");
+    }
+
+    vgroup6_id = Vattach(fid, ref_list[6], "w");  /* "VG-CLASS-6" */
+    CHECK_VOID(vgroup6_id, FAIL, "Vattach vgroup6_id");
+
+    /* Test getting vgroups in vg6: vgroup6_id, start_vd=0, n_vds=0 */
+    {
+	uint16 result[] = {4}; /* vg2 */
+	status = check_vgs(vgroup6_id, 0, 0, "vgroup6_id, 0, 0", 1, result);
+	CHECK_VOID(status, FAIL, "Vgetvgroups vgroup6_id");
+    }
+
+    /* Test getting vdatas in vg6: vgroup6_id, start_vd=0, n_vds=0 */
+    {
+	uint16 result[] = {18}; /* vd6 */
+	status = check_vds(vgroup6_id, 0, 0, "vgroup6_id, 0, 0", 1, result);
+	CHECK_VOID(status, FAIL, "VSgetvdata vgroup6_id");
+    }
+
+    /* Test getting vgroups in vg9: vgroup9_id, start_vd=0, n_vds=0 */
+    vgroup9_id = Vattach(fid, ref_list[9], "w");  /* "VG-CLASS-9" */
+    CHECK_VOID(vgroup9_id, FAIL, "Vattach vgroup9_id");
+    {
+	n_vgs = Vgetvgroups(vgroup9_id, 0, 0, NULL);
+	CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup9_id");
+	VERIFY_VOID(n_vgs, 0, "Vgetvgroups vgroup9_id");
+    }
+
+    /* Test getting vgroups in vg7: vgroup7_id, start_vd=0, n_vds=0 */
+    vgroup7_id = Vattach(fid, ref_list[7], "w");  /* "VG-CLASS-7" */
+    CHECK_VOID(vgroup7_id, FAIL, "Vattach vgroup7_id");
+    {
+	n_vgs = Vgetvgroups(vgroup7_id, 0, 0, NULL);
+	CHECK_VOID(n_vgs, FAIL, "Vgetvgroups vgroup7_id");
+	VERIFY_VOID(n_vgs, 0, "Vgetvgroups vgroup7_id");
+    }
+
+    /* Test getting vdatas in vg9: vgroup9_id, start_vd=2, n_vds=2 */
+    {
+	uint16 result[] = {17}; /* vd5 */
+	status = check_vds(vgroup9_id, 2, 2, "vgroup9_id, 2, 2", 1, result);
+	CHECK_VOID(status, FAIL, "VSgetvdata vgroup9_id");
+    }
+
+    /* Test getting vgroups in vg1: vgroup1_id, start_vd=1, n_vds=3 */
+    {
+	uint16 result[] = {8}; /* vg6 */
+	status = check_vgs(vgroup1_id, 1, 3, "vgroup1_id, 1, 3", 1, result);
+	CHECK_VOID(status, FAIL, "Vgetvgroups vgroup1_id");
+    }
+
+    status = Vdetach(vgroup0_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup0_id");
+    status = Vdetach(vgroup1_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup1_id");
+    status = Vdetach(vgroup6_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup6_id");
+    status = Vdetach(vgroup7_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup7_id");
+    status = Vdetach(vgroup9_id);
+    CHECK_VOID(status, FAIL, "Vdetach vgroup9_id");
+
+    /* Terminate access to the V interface and close the HDF file.  */
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+    status_n = Hclose (fid);
+    CHECK_VOID(status_n, FAIL, "Hclose");
+} /* test_getvgroups() */
+
+/*************************** test_extfile ***************************
+
+This test routine creates an hdf file, "tvset_ext.hdf" (excerpted and
+modified from Ruth's program used in hmap project), and creates and
+writes a vdata with external element.  The external file is named
+Tables_External_File.
+
+***********************************************************************/
+
+#define EXTFILE		"tvset_ext.hdf"
+#define EXTERNAL_FILE	"Tables_External_File"
+#define MULTI_NAME	"Table AR with Attributes in External File"
+#define CLASSMULTI_NAME	"Multi-Type, Multi-Entries per Cell, Store By Row in External File"
+#define NROWS		5	/* number of records to be written to the
+				   vdatas at every write */
+static void
+test_extfile(void) 
+{
+    int32   fid, vdata1_id,
+	    vdata_ref = -1;  /* ref number of a vdata, set to -1 to create  */
+    int32   vdata1_ref;
+    int32   offset = -1, length = -1;
+    char    hibuf[2] = "hi";
+    char    byebuf[3] = "bye";
+    char   *extfile_name;
+    void*   columnPtrs[3]; 
+    int	    bufsize;
+    void*   databuf;
+    void*   databuf2;
+    intn    name_len = 0;
+    intn    status_n;	/* returned status for functions returning an intn  */
+    int32   status;	/* returned status for functions returning an int32 */
+    char8   col1buf[NROWS][2] = { {'A', 'B'}, 
+				      {'B', 'C'},
+				      {'C', 'D'},
+				      {'D', 'E'},
+				      {'E', 'F'} };
+    uint16  col2buf[NROWS] = {1, 2, 3, 4, 5};	
+    float32 col3buf[NROWS][2] = { {.01, .1},
+				    {.02, .2},
+				    {.03, .3},
+				    {.04, .4},
+				    {.05, .5} };
+
+
+    /* Create the HDF file for data used in this test routine */
+    fid = Hopen (EXTFILE, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the VS interface */
+    status_n = Vstart (fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    /*
+     * Compute the buffer size that will be needed to hold the data for the
+     * mixed-data columns.   Allocate the buffers.
+     */
+    bufsize = (2*sizeof(char8) + sizeof(uint16) + 2*sizeof(float32)) * NROWS;
+    databuf = malloc( (unsigned)bufsize );
+
+    /* Initialize the pointers to the column data. */
+    columnPtrs[0] = &col1buf[0][0];
+    columnPtrs[1] = &col2buf[0];
+    columnPtrs[2] = &col3buf[0][0];
+
+    /* Create the first vdata */
+    vdata1_id = VSattach(fid, vdata_ref, "w");
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+
+    /* Set name and class name of the vdata. */
+    status = VSsetname(vdata1_id, MULTI_NAME);
+    CHECK_VOID(status, FAIL, "VSsetname");
+    status = VSsetclass(vdata1_id, CLASSMULTI_NAME);
+    CHECK_VOID(status, FAIL, "VSsetclass");
+
+    status = VSsetexternalfile( vdata1_id, EXTERNAL_FILE, 10 );
+    CHECK_VOID(status, FAIL, "VSsetexternalfile");
+
+    /* Introduce each field's name, data type, and order.  This is the first
+      part in defining a field.  */
+    status_n = VSfdefine (vdata1_id, FIELD1_NAME, DFNT_CHAR8, ORDER_3);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (vdata1_id, FIELD2_NAME, DFNT_UINT16, ORDER_2);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (vdata1_id, FIELD3_NAME, DFNT_LFLOAT32, ORDER_3);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+
+    /* Finalize the definition of the fields. */
+    status_n = VSsetfields (vdata1_id, FIELD_NAME_LIST);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+
+    /* Pack the buffer that will be used to write the data to the file. */
+    status = VSfpack( vdata1_id, _HDF_VSPACK, NULL, databuf, bufsize, NROWS, NULL, columnPtrs);
+    CHECK_VOID(status, FAIL, "VSfpack");
+
+    /* Write to the vdata in FULL_INTERLACE */
+    status = VSwrite( vdata1_id, databuf, NROWS, FULL_INTERLACE );
+    CHECK_VOID(status, FAIL, "VSwrite");
+
+    /* Add Attribute for vdata */
+    status = VSsetattr( vdata1_id, _HDF_VDATA, "HDF4 Attribute Table",
+                        DFNT_CHAR8, 2, &hibuf );
+    CHECK_VOID(status, FAIL, "VSsetattr");
+
+    /* Add Attribute for Column C */
+    status = VSsetattr( vdata1_id, 2, "HDF4 Attribute Field 3",
+                        DFNT_CHAR8, 3, &byebuf );
+    CHECK_VOID(status, FAIL, "VSsetattr");
+
+    /* Get vdata ref */
+    vdata1_ref = VSQueryref(vdata1_id);
+    CHECK_VOID(vdata1_ref, FAIL, "VSQueryref");
+
+    status_n = VSdetach( vdata1_id );
+    CHECK_VOID(status_n, FAIL, "VSdetach");
+
+    HDfree(databuf);
+
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /* Reopen the file and the vdata and verify external file information */
+
+    /* Open the HDF file */
+    fid = Hopen (EXTFILE, DFACC_RDONLY, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the VS interface */
+    status_n = Vstart (fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    /* Create the first vdata */
+    vdata1_id = VSattach(fid, vdata1_ref, "r");
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+
+    { /* This is an old test, will be removed when VSgetexternalfile is */
+    /* Get the length of the external file name first - VSgetexternalfile
+       is deprecated as of 4.2.7 */
+    name_len = VSgetexternalfile(vdata1_id, 0, NULL, NULL);
+    VERIFY_VOID(name_len, (intn)HDstrlen(EXTERNAL_FILE), "VSgetexternalfile");
+
+    extfile_name = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(extfile_name, "extfile_name", "test_extfile");
+    
+    /* Old function: Get the external file name - VSgetexternalfile
+       is deprecated as of 4.2.7 */
+    name_len = VSgetexternalfile(vdata1_id, name_len+1, extfile_name, &offset);
+    VERIFY_VOID(name_len, (intn)HDstrlen(EXTERNAL_FILE), "VSgetexternalfile");
+    VERIFY_CHAR_VOID(extfile_name, EXTERNAL_FILE, "VSgetexternalfile");
+    HDfree(extfile_name);
+    } /* old test */
+
+    /* Get the length of the external file name first */
+    name_len = VSgetexternalinfo(vdata1_id, 0, NULL, NULL, NULL);
+    VERIFY_VOID(name_len, (intn)HDstrlen(EXTERNAL_FILE), "VSgetexternalinfo");
+
+    extfile_name = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+    CHECK_ALLOC(extfile_name, "extfile_name", "test_extfile");
+    
+    /* Get the external file name */
+    name_len = VSgetexternalinfo(vdata1_id, name_len+1, extfile_name, &offset, &length);
+    VERIFY_VOID(name_len, (intn)HDstrlen(EXTERNAL_FILE), "VSgetexternalinfo");
+    VERIFY_CHAR_VOID(extfile_name, EXTERNAL_FILE, "VSgetexternalinfo");
+    HDfree(extfile_name);
+
+    /* Test passing in smaller buffer for external file name than actual;
+       name should be truncated */
+    {
+	/* Make a shorter string to verify later */
+        char *short_name = (char *) HDmalloc(sizeof(char *) * (name_len));
+        HDmemset(short_name, '\0', name_len);
+        HDstrncpy(short_name, EXTERNAL_FILE, name_len-2);
+
+	/* Prepare buffer for external file name in the following test */
+	extfile_name = (char *) HDmalloc(sizeof(char *) * (name_len-1));
+        HDmemset(extfile_name, '\0', name_len);
+
+        /* Call VSgetexternalinfo again with smaller buffer size and make sure
+           VSgetexternalinfo reads the name truncated to the given buffer size*/
+        name_len = VSgetexternalinfo(vdata1_id, name_len-2, extfile_name, &offset, &length);
+        VERIFY_VOID(name_len, (intn)HDstrlen(extfile_name), "VSgetexternalinfo");
+        VERIFY_CHAR_VOID(extfile_name, short_name, "VSgetexternalinfo");
+        HDfree(short_name);
+        HDfree(extfile_name);
+    }
+
+    /* Release resources */
+    status_n = VSdetach( vdata1_id );
+    CHECK_VOID(status_n, FAIL, "VSdetach");
+
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+} /* test_extfile() */
+
+/****************************************************************************
+   Name: test_blockinfo_oneLB() - tests setting/getting block info in the
+                           simple case, only one linked block storage occur
+
+   Description:
+	The test does the following steps:
+	- Create the file and the first vdata, "Appendable Vdata"
+	- Test calling VSsetblocksize with invalid values and verify that failures occur
+	- Set block size and number of blocks to BLOCK_SIZE1 and NUM_BLOCKS for this vdata
+	- Close the vdata and the file
+	- Reopen the file and the first vdata, "Appendable Vdata"
+	- Verify that the block size of this vdata remains the default,
+  	  HDF_APPENDABLE_BLOCK_LEN.  This shows when no data and no linked-block
+  	  storage created, the block size remains as the default.
+	- Call VSsetblocksize again with BLOCK_SIZE1 and NUM_BLOCKS
+	- Write 5 records to this vdata
+	- Create and write 5 records to the second vdata, "Another Vdata".  The
+  	  purpose of this second vdata is to cause the subsequent write to the
+  	  first vdata to promote the first vdata's storage to a linked-block element.
+	- Append 5 records to the first vdata. 
+	- Verify that the block size is changed to BLOCK_SIZE1 and number of
+  	  blocks to NUM_BLOCKS
+	- Close both vdatas and the file.
+
+   BMR - Jan 2014
+ ****************************************************************************/
+#define APPENDABLE_VD	"Appendable Vdata"
+#define ANOTHER_VD	"Another Vdata"
+#define CLASS_NAME	"Linked-block Vdata"
+#define ANOTHER_FD	"Another field"	/* contains one integer */
+#define	ANOTHER_FD_LIST	"Another field"
+#define N_RECORDS	5	/* number of records to be written to the
+				   vdatas at every write */
+#define N_VALS_PER_REC_2   1    /* # of values per record in the 2nd vdata */
+#define N_VALS_PER_REC_1 (ORDER_1+ORDER_2+ORDER_3) /* # of vals/rec. in 1st vd*/
+#define	BLOCK_SIZE1	20	/* arbitrary number for block size */
+#define	BLOCK_SIZE2	100	/* arbitrary number for block size */
+#define	NUM_BLOCKS	8	/* arbitrary number for number of blocks */
+
+static void
+test_blockinfo_oneLB(void) 
+{
+    intn  status_n;	/* returned status for functions returning an intn  */
+    int32 status;	/* returned status for functions returning an int32 */
+    int16 rec_num;	/* current record number */
+    int32 record_pos;
+    int32 fid, vdata1_id, vdata2_id,
+	  vdata_ref = -1,  /* ref number of a vdata, set to -1 to create  */
+   	  num_of_records,  /* number of records actually written to vdata */
+          data_buf1[N_RECORDS][N_VALS_PER_REC_1], /* for first vdata's data */
+	  data_buf2[N_RECORDS][N_VALS_PER_REC_2], /* for second vdata's data */
+	  block_size, num_blocks; /* retrieved by VSgetblockinfo */
+    intn  n_vds = 0;
+    uint16 *refarray = NULL;
+
+    /* Create the HDF file for data used in this test routine */
+    fid = Hopen (LKBLK_FILE, DFACC_CREATE, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the VS interface */
+    status_n = Vstart (fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    /* Create the first vdata */
+    vdata1_id = VSattach(fid, vdata_ref, "w");
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+
+    /* Set name and class name of the vdata. */
+    status = VSsetname (vdata1_id, APPENDABLE_VD);
+    CHECK_VOID(status, FAIL, "VSsetname");
+    status = VSsetclass (vdata1_id, CLASS_NAME);
+    CHECK_VOID(status, FAIL, "VSsetclass");
+
+    /* Introduce each field's name, data type, and order.  This is the first
+      part in defining a field.  */
+    status_n = VSfdefine (vdata1_id, FIELD1_NAME, DFNT_INT32, ORDER_1);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (vdata1_id, FIELD2_NAME, DFNT_INT32, ORDER_2);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSfdefine (vdata1_id, FIELD3_NAME, DFNT_INT32, ORDER_3);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+
+    /* Finalize the definition of the fields. */
+    status_n = VSsetfields (vdata1_id, FIELD_NAME_LIST);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+
+    /* 
+     * Buffer the data by the record for fully interlaced mode.  Note that the
+     * first three elements contain the three values of the first field, the
+     * fourth element contains the value of the second field, and the last two
+     * elements contain the two values of the third field.
+     */
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+    {
+        data_buf1[rec_num][0] = 1 + rec_num;
+        data_buf1[rec_num][1] = 2 + rec_num;
+        data_buf1[rec_num][2] = 3 + rec_num;
+        data_buf1[rec_num][3] = 10 + rec_num;
+        data_buf1[rec_num][4] = 10;
+        data_buf1[rec_num][5] = 65;
+    }
+
+    status_n = VSgetblockinfo (vdata1_id, &block_size, NULL);
+    CHECK_VOID(status_n, FAIL, "VSgetblockinfo");
+    VERIFY_VOID(block_size, HDF_APPENDABLE_BLOCK_LEN, "VSgetblockinfo");
+
+    /* Test for invalid arguments passed in these functions */
+    status_n = VSsetblocksize(vdata1_id, -2);
+    VERIFY_VOID(status_n, FAIL, "VSsetblocksize");
+    status_n = VSsetnumblocks(vdata1_id, 0);
+    VERIFY_VOID(status_n, FAIL, "VSsetnumblocks");
+
+    /* Set the block size and the number of blocks the first vdata */
+    status_n = VSsetblocksize(vdata1_id, BLOCK_SIZE1);
+    CHECK_VOID(status_n, FAIL, "VSsetblocksize");
+    status_n = VSsetnumblocks(vdata1_id, NUM_BLOCKS);
+    CHECK_VOID(status_n, FAIL, "VSsetnumblocks");
+
+    status = VSdetach (vdata1_id);
+    CHECK_VOID(status, FAIL, "Vdetach");
+
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /******************************************************************
+     * Reopen the file, and the vdata APPENDABLE_VDATA, verify that block
+     * size is still the default, then set block size again, and attempt
+     * to write data and test for block information.
+     ******************************************************************/
+
+    fid = Hopen(LKBLK_FILE, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the VS interface */
+    status_n = Vstart (fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    vdata_ref = -1;
+    vdata_ref = VSfind(fid, APPENDABLE_VD);
+    CHECK_VOID(vdata_ref, FAIL, "VSfind");
+
+    vdata1_id = VSattach(fid, vdata_ref, "w");
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+
+    status_n = VSgetblockinfo (vdata1_id, &block_size, NULL);
+    CHECK_VOID(status_n, FAIL, "VSgetblockinfo");
+    VERIFY_VOID(block_size, HDF_APPENDABLE_BLOCK_LEN, "VSgetblockinfo");
+
+    /* Set the block size and the number of blocks the first vdata */
+    status_n = VSsetblocksize(vdata1_id, BLOCK_SIZE1);
+    CHECK_VOID(status_n, FAIL, "VSsetblocksize");
+    status_n = VSsetnumblocks(vdata1_id, NUM_BLOCKS);
+    CHECK_VOID(status_n, FAIL, "VSsetnumblocks");
+
+    /* Write the data from data_buf1 to the vdata with full interlacing mode. */
+    num_of_records = VSwrite(vdata1_id, (uint8 *)data_buf1, N_RECORDS, 
+				FULL_INTERLACE);
+    VERIFY_VOID(num_of_records, N_RECORDS, "VSwrite:vdata1_id");
+
+    /* The block size should change properly */
+    status_n = VSgetblockinfo (vdata1_id, &block_size, &num_blocks);
+    CHECK_VOID(status_n, FAIL, "VSgetblockinfo");
+    VERIFY_VOID(block_size, BLOCK_SIZE1, "VSgetblockinfo");
+
+    /******************************************************************
+     * Creates and writes another vdata right after APPENDABLE_VDATA.
+     * This will cause the storage of APPENDABLE_VDATA to be promoted to a
+     * linked-block element if a subsequent write to APPENDABLE_VDATA occurs. 
+     ******************************************************************/
+ 
+    /* Create another vdata. */
+    vdata_ref = -1;
+    vdata2_id = VSattach(fid, vdata_ref, "w");
+    CHECK_VOID(vdata2_id, FAIL, "VSattach");
+
+    /* Set name and class name of the vdata. */
+    status = VSsetname (vdata2_id, ANOTHER_VD);
+    CHECK_VOID(status, FAIL, "VSsetname");
+    status = VSsetclass (vdata2_id, CLASS_NAME);
+    CHECK_VOID(status, FAIL, "VSsetclass");
+
+    /* Define the vdata's field. */
+    status_n = VSfdefine (vdata2_id, ANOTHER_FD, DFNT_INT32, ORDER_2);
+    CHECK_VOID(status_n, FAIL, "VSfdefine");
+    status_n = VSsetfields (vdata2_id, ANOTHER_FD_LIST);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+
+    /* Buffer the data for ANOTHER_VDATA */
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+    {
+        data_buf2[rec_num][0] = 100 + rec_num;
+    }
+
+    /* Write the data from data_buf2 to the second vdata with full 
+       interlacing mode. */
+    num_of_records = VSwrite(vdata2_id, (uint8 *)data_buf2, N_RECORDS, 
+				FULL_INTERLACE);
+    VERIFY_VOID(num_of_records, N_RECORDS, "VSwrite:vdata2_id");
+
+    /******************************************************************
+     * Writes more data to APPENDABLE_VDATA, i.e. first vdata.  Its
+     * storage will be promoted to a linked-block element.
+     ******************************************************************/
+
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+    {
+        data_buf1[rec_num][0] = 10 + rec_num;
+        data_buf1[rec_num][1] = 20 + rec_num;
+        data_buf1[rec_num][2] = 30 + rec_num;
+        data_buf1[rec_num][3] = 100 + rec_num;
+        data_buf1[rec_num][4] = 100;
+        data_buf1[rec_num][5] = 650;
+    }
+
+    /* Append the data to the first vdata. */
+    record_pos = VSseek(vdata1_id, N_RECORDS);
+    num_of_records = VSwrite(vdata1_id, (uint8 *)data_buf1, N_RECORDS, 
+				FULL_INTERLACE); 
+    VERIFY_VOID(num_of_records, N_RECORDS, "VSwrite:vdata1_id");
+
+    /* Retrieve the first vdata's block size and number of blocks and 
+       verify them */
+    status_n = VSgetblockinfo (vdata1_id, &block_size, &num_blocks);
+    CHECK_VOID(status_n, FAIL, "VSgetblockinfo");
+    VERIFY_VOID(block_size, BLOCK_SIZE1, "VSgetblockinfo");
+    VERIFY_VOID(num_blocks, NUM_BLOCKS, "VSgetblockinfo");
+
+    /* Terminate access to the vdatas and to the VS interface, then 
+       close the HDF file. */
+    status = VSdetach (vdata1_id);
+    CHECK_VOID(status, FAIL, "Vdetach");
+
+    status = VSdetach (vdata2_id);
+    CHECK_VOID(status, FAIL, "Vdetach");
+
+    /* Terminate access to the V interface and close the file. */
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+} /* test_blockinfo_oneLB() */
+
+
+/****************************************************************************
+   Name: test_blocksize_multLBs() - tests setting block info in the case of
+                           multiple linked block element
+
+   Description:
+	The test opens the file again, open the first vdata, "Appendable Vdata",
+	- Open the file and the first vdata, APPENDABLE_VD.
+	- Verify that the block size had changed to BLOCK_SIZE1 and number of
+  	  blocks to NUM_BLOCKS
+	- Attempt to change the block size to something else, and verify that it
+  	  is not changed, then close the vdata.
+	- Open the second vdata, ANOTHER_VD.
+	- Verify that the block size and number of blocks are the default values,
+  	  HDF_APPENDABLE_BLOCK_LEN and HDF_APPENDABLE_BLOCK_NUM.
+	- Change block size to BLOCK_SIZE2
+	- Append 5 records to ANOTHER_VD, which triggers its storage to be
+  	  converted into a linked-block element.
+	- Close the vdata and the file.
+	- Open the file to verify block info stay changed.
+   BMR - Jan 2014
+ ****************************************************************************/
+static void
+test_blockinfo_multLBs(void) 
+{
+    intn  status_n;	/* returned status for functions returning an intn  */
+    int32 status;	/* returned status for functions returning an int32 */
+    int16 rec_num;	/* current record number */
+    int32 record_pos;
+    int32 fid, vdata1_id, vdata2_id,
+	  vdata_ref = -1,  /* ref number of a vdata, set to -1 to create  */
+   	  num_of_records,  /* number of records actually written to vdata */
+          data_buf1[N_RECORDS][N_VALS_PER_REC_1], /* for first vdata's data */
+	  data_buf2[N_RECORDS][N_VALS_PER_REC_2], /* for second vdata's data */
+	  block_size, num_blocks; /* retrieved by VSgetblockinfo */
+    intn  n_vds = 0;
+    uint16 *refarray = NULL;
+
+    /******************************************************************
+     * Reopen the file, and the vdata APPENDABLE_VDATA, then append more
+     * data and test for block information.
+     ******************************************************************/
+
+    fid = Hopen(LKBLK_FILE, DFACC_RDWR, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the VS interface */
+    status_n = Vstart (fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    /* Locate and open vdata APPENDABLE_VD */
+    vdata_ref = -1;
+    vdata_ref = VSfind(fid, APPENDABLE_VD);
+    CHECK_VOID(vdata_ref, FAIL, "VSfind");
+
+    vdata1_id = VSattach(fid, vdata_ref, "w");
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+
+    /* Retrieve the first vdata's block size and number of blocks and 
+       verify them again.  This used to return the old value. (HDFFR-1357) */
+    status_n = VSgetblockinfo (vdata1_id, &block_size, &num_blocks);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+    VERIFY_VOID(block_size, BLOCK_SIZE1, "VSgetblockinfo");
+    VERIFY_VOID(num_blocks, NUM_BLOCKS, "VSgetblockinfo");
+
+    /* Set the block size to the first vdata again, but this is when vdata
+       already has a linked-block element.  If the block size is different
+       than the previously specified block size, then the change will not
+       take effect. */
+    status_n = VSsetblocksize(vdata1_id, BLOCK_SIZE1+100);
+    CHECK_VOID(status_n, FAIL, "VSsetblocksize");
+
+    /* Retrieve the first vdata's block size and verify that it did not
+       change */
+    status_n = VSgetblockinfo (vdata1_id, &block_size, NULL);
+    CHECK_VOID(status_n, FAIL, "VSgetblockinfo");
+    VERIFY_VOID(block_size, BLOCK_SIZE1, "VSgetblockinfo");
+
+    /* Close the vdata */
+    status = VSdetach (vdata1_id);
+    CHECK_VOID(status, FAIL, "Vdetach");
+
+    /* Next test:
+	Open the second vdata, ANOTHER_VD, check block size, set block
+	size, write to it, then check block size again */
+
+    /* Locate and open the vdata ANOTHER_VD */
+    vdata_ref = -1;
+    vdata_ref = VSfind(fid, ANOTHER_VD);
+    CHECK_VOID(vdata_ref, FAIL, "VSfind");
+    vdata2_id = VSattach(fid, vdata_ref, "w");
+    CHECK_VOID(vdata2_id, FAIL, "VSattach");
+
+    /* Check block size of ANOTHER_VD */
+    status_n = VSgetblockinfo (vdata2_id, &block_size, &num_blocks);
+    VERIFY_VOID(block_size, HDF_APPENDABLE_BLOCK_LEN, "VSgetblockinfo");
+
+    /* Set the block size to ANOTHER_VD to BLOCK_SIZE2 */
+    status_n = VSsetblocksize(vdata2_id, BLOCK_SIZE2);
+    CHECK_VOID(status_n, FAIL, "VSsetblocksize");
+
+    /* Retrieve the block size of ANOTHER_VD */
+    status_n = VSgetblockinfo (vdata2_id, &block_size, NULL);
+    CHECK_VOID(status_n, FAIL, "VSgetblockinfo");
+    VERIFY_VOID(block_size, BLOCK_SIZE2, "VSgetblockinfo");
+
+    /* Buffer the data for ANOTHER_VDATA */
+    for (rec_num = 0; rec_num < N_RECORDS; rec_num++)
+    {
+        data_buf2[rec_num][0] = 200 + rec_num;
+    }
+
+    /* Write the data from data_buf2 to the vdata with full interlacing mode. */
+    record_pos = VSseek(vdata2_id, N_RECORDS);
+    num_of_records = VSwrite(vdata2_id, (uint8 *)data_buf2, N_RECORDS, 
+				FULL_INTERLACE);
+    VERIFY_VOID(num_of_records, N_RECORDS, "VSwrite:vdata2_id");
+
+    /* Retrieve the first vdata's block size and number of blocks and 
+       verify them */
+    status_n = VSgetblockinfo (vdata2_id, &block_size, &num_blocks);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+    VERIFY_VOID(block_size, BLOCK_SIZE2, "VSgetblockinfo");
+
+    /* Close the vdata and file */
+    status = VSdetach (vdata2_id);
+    CHECK_VOID(status, FAIL, "Vdetach");
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+    /*
+     * Open the file one more time and verify the block size and number
+     * of blocks of the vdatas that have linked-block storage.
+     */
+    /* Open file again. */
+    fid = Hopen(LKBLK_FILE, DFACC_RDONLY, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the VS interface */
+    status_n = Vstart (fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    /* Locate and open vdata APPENDABLE_VD. */
+    vdata_ref = -1;
+    vdata_ref = VSfind(fid, APPENDABLE_VD);
+    CHECK_VOID(vdata_ref, FAIL, "VSfind");
+    vdata1_id = VSattach(fid, vdata_ref, "r");
+    CHECK_VOID(vdata1_id, FAIL, "VSattach");
+
+    /* Verify its block size and number of blks. */
+    status_n = VSgetblockinfo (vdata1_id, &block_size, &num_blocks);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+    VERIFY_VOID(block_size, BLOCK_SIZE1, "VSgetblockinfo");
+    VERIFY_VOID(num_blocks, NUM_BLOCKS, "VSgetblockinfo");
+
+    /* Close APPENDABLE_VD. */
+    status = VSdetach (vdata1_id);
+    CHECK_VOID(status, FAIL, "Vdetach");
+
+    /* Locate and open vdata ANOTHER_VD, and verify its block size and number of blks. */
+    vdata_ref = -1;
+    vdata_ref = VSfind(fid, ANOTHER_VD);
+    CHECK_VOID(vdata_ref, FAIL, "VSfind");
+    vdata2_id = VSattach(fid, vdata_ref, "r");
+    CHECK_VOID(vdata2_id, FAIL, "VSattach");
+
+    /* Verify its block size and number of blks. */
+    status_n = VSgetblockinfo (vdata2_id, &block_size, &num_blocks);
+    CHECK_VOID(status_n, FAIL, "VSsetfields");
+    VERIFY_VOID(block_size, BLOCK_SIZE2, "VSgetblockinfo");
+    VERIFY_VOID(num_blocks, HDF_APPENDABLE_BLOCK_NUM, "VSgetblockinfo");
+
+    /* Close ANOTHER_VD and the file. */
+    status = VSdetach (vdata2_id);
+    CHECK_VOID(status, FAIL, "Vdetach");
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+} /* test_blockinfo_multLBs() */
+
+/*
+ * This test is here to use the file LKBLK_FILE, but it will be moved to
+ * another file in the future when more organization is done for tests.
+ * This function tests that VSofclass gets the reference numbers of the
+ * vdatas belonging to a class.
+ */
+static void
+test_VSofclass()
+{
+    intn  status_n;	/* returned status for functions returning an intn  */
+    int32 status;	/* returned status for functions returning an int32 */
+    int16 rec_num;	/* current record number */
+    int32 record_pos;
+    int32 fid, vdata1_id, vdata2_id,
+	  vdata_ref = -1,  /* ref number of a vdata, set to -1 to create  */
+   	  num_of_records,  /* number of records actually written to vdata */
+          data_buf1[N_RECORDS][N_VALS_PER_REC_1], /* for first vdata's data */
+	  data_buf2[N_RECORDS][N_VALS_PER_REC_2], /* for second vdata's data */
+	  block_size, num_blocks; /* retrieved by VSgetblockinfo */
+    intn  n_vds = 0;
+    uint16 *refarray = NULL;
+
+    /* Open file LKBLK_FILE for reading. */
+    fid = Hopen(LKBLK_FILE, DFACC_RDONLY, 0);
+    CHECK_VOID(fid, FAIL, "Hopen");
+
+    /* Initialize the VS interface */
+    status_n = Vstart (fid);
+    CHECK_VOID(status_n, FAIL, "Vstart");
+
+    /* VSofclass returns the number of vdatas belonging to CLASS_NAME correctly */
+    n_vds = VSofclass(fid, CLASS_NAME, 0, 0, NULL);
+    VERIFY_VOID(n_vds, 2, "VSofclass");
+
+    /* Allocate space for the ref array to pass into VSofclass. */
+    refarray = (uint16 *)HDmalloc(sizeof(uint16) * n_vds);
+    CHECK_ALLOC(refarray, "refarray", "test_blockinfo_multLBs" );
+
+    /* The following tests rely on the reference numbers of the two vdatas of
+       class CLASS_NAME.  If data is added to the file before these vdatas,
+       the reference numbers (2 and 3 below) need to be adjusted accordingly or
+       tests will fail -BMR (will have a better tests later) */
+    n_vds = VSofclass(fid, CLASS_NAME, 0, n_vds, refarray);
+    VERIFY_VOID(refarray [0], 2, "VSofclass");
+    VERIFY_VOID(refarray [1], 3, "VSofclass");
+
+    refarray [0] = refarray[1] = 0;
+    n_vds = VSofclass(fid, CLASS_NAME, 0, 1, refarray);
+    VERIFY_VOID(refarray [0], 2, "VSofclass");
+    VERIFY_VOID(refarray [1], 0, "VSofclass");
+
+    n_vds = VSofclass(fid, CLASS_NAME, 1, n_vds, refarray);
+    VERIFY_VOID(refarray [0], 3, "VSofclass");
+    VERIFY_VOID(refarray [1], 0, "VSofclass");
+
+    /* Terminate access to the V interface and close the file. */
+    status_n = Vend (fid);
+    CHECK_VOID(status_n, FAIL, "Vend");
+    status = Hclose (fid);
+    CHECK_VOID(status, FAIL, "Hclose");
+
+} /* test_VSofclass */
+
+/*************************** test_blockinfo ***************************
+
+   Name: ttest_blockinfo() - tests setting/getting block info for a vdata
+
+   Description:
+   This test creates an hdf file, "Block_info.hdf", and creates and
+   writes two vdatas in a way that one of the vdatas, then later the
+   other one, will be promoted to linked-block elements.
+
+   The first vdata is named "Appendable Vdata", and belongs to a class,
+   named "Linked-block Vdata".  The fields of the vdata include "Field1",
+   "Field2", and "Field3" and all data are integer.  "Field1" has an order
+   of 3, "Field2" has an order of 1, and "Field3" has an order of 2.
+
+   The second vdata named "Another Vdata", and also belongs to class
+   "Linked-block Vdata".  This vdata has only one field of order 1 and
+   its data are integer.
+
+   test_blockinfo is divided into two parts:
+	test_blockinfo_oneLB
+	test_blockinfo_multLBs
+
+***********************************************************************/
+    /* This test is perhaps more suitable somewhere else or in a file by
+       itself, but keep it here for now since we're running out of time...*/
+void
+test_blockinfo(void)
+{
+    int32 status;
+
+    /* test the case of setting block size doesn't have effect until linked-
+       block element is created */
+    test_blockinfo_oneLB();
+
+    /* test functionality about set/get linked-block information */
+    test_blockinfo_multLBs();
+
+    /* test VSofclass; relies on the file created and written by the tests
+       in test_blockinfo_oneLB and test_blockinfo_multLBs */
+    test_VSofclass();
+
+}   /* test_blockinfo */
+
+/* main test driver */
+void
+test_vsets(void)
+{
+    int32       status;
+
+    status = write_vset_stuff();
+    if (status == FAIL)
+        return;
+
+    status = read_vset_stuff();
+    if (status == FAIL)
+        return;
+
+    /* test VSdelete() */
+    test_vsdelete();
+
+    /* test Vdelete() */
+    test_vdelete();
+   
+    /* test Vdeletetagref() */
+    test_vdeletetagref();
+
+    /* test Vdatas with no fields defined */
+    test_emptyvdata();
+
+    /* test Vgroups with name and class that have more than 64 characters */
+    test_vglongnames();
+
+    /* test functionality about set/get linked-block information */
+    test_blockinfo();
+
+    /* test Vgetgroups - getting user-created vgroups */
+    test_getvgroups();
+
+    /* test VSgetvdatas - getting user-created vdatas */
+    test_getvdatas();
+
+    /* test_extfile - getting external file information */
+    test_extfile();
+}   /* test_vsets */
+
+/* TODO:
+   - should either making all the other test functions to return status as
+     read_vset_stuff() and write_vset_stuff, or making these two void.
+   - review each test function and add header/comments
+   BMR - Jan 16, 2014
+*/
diff --git a/hdf/test/tvsetf.f b/hdf/test/tvsetf.f
new file mode 100644
index 0000000..0a47975
--- /dev/null
+++ b/hdf/test/tvsetf.f
@@ -0,0 +1,1033 @@
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C* Copyright by The HDF Group.                                               *
+C* Copyright by the Board of Trustees of the University of Illinois.         *
+C* All rights reserved.                                                      *
+C*                                                                           *
+C* This file is part of HDF.  The full HDF copyright notice, including       *
+C* terms governing use, modification, and redistribution, is contained in    *
+C* the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C* of the source code distribution tree; Copyright.html can be found at      *
+C* http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C* access to either file, you may request a copy from help at hdfgroup.org.     *
+C* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+C*
+C*********************************************************************
+C $Id: tvsetf.f 5753 2012-01-18 17:44:10Z epourmal $
+C*********************************************************************
+C      test vset Fortran data types
+C
+      subroutine tvsetf (number_failed)
+C Test Program:
+C   Tests the vdata and vgroup interface
+C Input file: none
+C Output file: tvsetf1.hdf
+
+      implicit none
+      include 'fortest.inc'
+      include '../src/hdf.inc'
+      include '../src/dffunc.inc'
+
+      integer number_failed
+      character*20 myname
+      parameter (myname = 'vsetf')
+
+      integer fid1, vgid1, vgid2, vsid1, vsid2
+      integer vgref1, vsref1, vsref2, vref, vsref22
+      integer vsize, found
+      integer ret,ntrs,i,il,nelts
+      integer*4 dbuf(320),idbuf(320),ddata4(10),iddata4(10)
+      integer*2 ddata1(10), iddata1(10)
+      integer*2 ddata2(10),iddata2(10)
+      integer*4 tags(10), refs(10)
+      real      fdata(10), ifdata(10)
+      double precision gdata1(10)
+      double precision igdata1(10)
+      double precision geps
+      real   feps
+
+      character*11 fn1
+      character*64 vname
+      character*9  fields1
+      character*10 fields2
+      character*31 fields3
+      character*15 cdata, icdata
+      character*7  field_name
+      parameter (
+     +           feps = 1.0E-5,
+     +           geps = 1.0D-9
+     +          )
+C-------------------------------------------------------------------------
+C    These definitions are added to test hglibver and hgfilver functions
+C
+      integer major_v, minor_v, release
+      character*80 hdfstring
+C-------------------------------------------------------------------------     
+      DATA ddata1/10,11,12,13,14,15,16,17,18,19/
+      DATA ddata2/20,21,22,23,24,25,26,27,28,29/
+      DATA ddata4/40,41,42,43,44,45,46,47,48,49/
+      DATA fdata/5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,5.8,5.9/
+      DATA gdata1/6.0,6.1,6.2,6.3,6.4,6.5,6.6,6.7,6.8,6.9/
+
+      call ptestban('Testing', myname)
+      cdata = 'abcdebcdefcdefg'
+      fn1 = 'tvsetf1.hdf'
+
+C Open the file
+      fid1 = hopen(fn1, DFACC_CREATE, 0)
+      call VRFY(fid1,'hopen',number_failed)
+      ret = vfstart(fid1)
+      call VRFY(ret,'vfstart',number_failed)
+C Create a vgroup
+      call MESSAGE(5,'Creating a vgroup')
+      vgid1 = vfatch(fid1, -1, 'w')
+      call VRFY(vgid1, 'vfatch', number_failed)
+      ret = vfsnam(vgid1, 'Top Vgroup')
+      call VRFY(ret,'vfsnam',number_failed)
+      ret = vfscls(vgid1, 'Test Object')
+      call VRFY(ret,'vfscls',number_failed)
+
+C Add a vgroup to it
+      call MESSAGE(5,'Add a vgroup to the Top vgroup')
+      vgid2 = vfatch(fid1, -1, 'w')
+      call VRFY(vgid2, 'vfatch', number_failed)
+      ret = vfinsrt(vgid1, vgid2)
+      call VRFY(ret, 'vfinsrt', number_failed)
+
+      ret = vfdtch(vgid1)
+      call VRFY(ret,'vfdtch',number_failed)
+      ret = vfdtch(vgid2)
+      call VRFY(ret,'vfdtch',number_failed)
+
+      ret = vfend(fid1)
+      call VRFY(ret,'vfend',number_failed)
+      ret = hclose(fid1)
+      call VRFY(ret,'hclose',number_failed)
+
+C      add a vdatas in vgroup1
+      call MESSAGE(5,'Creating a char vdata')
+      fid1 =  hopen(fn1, DFACC_RDWR, 0)
+      call VRFY(fid1,'hopen',number_failed)
+      ret = vfstart(fid1)
+      call VRFY(ret,'vfstart',number_failed)
+      vgref1 = vfgid(fid1, -1)
+      call VRFY(vgref1,'vfgid',number_failed)
+C
+C     Find group with the name 'Top Vgroup'
+C
+      ret = vfind(fid1, 'Top Vgroup')
+      if (ret .le. 0) then
+          number_failed = number_failed + 1
+          call MESSAGE(3, 'Top Vgroup is not found. ')
+      endif 
+      vgid1 = vfatch(fid1, vgref1, 'w')
+      call VRFY(vgid1,'vfatch',number_failed)
+C      create a single field (char) vdata
+      vsid1 = vsfatch(fid1, -1, 'w')
+      call VRFY(vsid1,'vsfatch',number_failed)
+      ret = vsffdef(vsid1, 'char type', DFNT_CHAR, 5)
+      call VRFY(ret,'vsffdef',number_failed)
+      ret = vsfsfld(vsid1, 'char type')
+      call VRFY(ret,'vsfsfld',number_failed)
+C      Use vsfwrtc to write the values
+      ret = vsfwrtc(vsid1, cdata, 3, FULL_INTERLACE)
+      call VRFY(ret,'vsfwrtc',number_failed)
+      ret = vsfdtch(vsid1)
+      call VRFY(ret,'vsfdtch',number_failed)
+C      create a single field int16 vdata
+      call MESSAGE(5,'Creating an int16 vdata')
+      vsid1 = vsfatch(fid1, -1, 'w')
+      call VRFY(vsid1,'vsfatch',number_failed)
+      ret = vsffdef(vsid1, 'int16 type', DFNT_INT16, 2)
+      call VRFY(ret,'vsffdef',number_failed)
+      ret = vsfsfld(vsid1, 'int16 type')
+      call VRFY(ret,'vsfsfld',number_failed)
+C      Use vsfwrt to write the values
+      ret = vsfwrt(vsid1, ddata1, 5, FULL_INTERLACE)
+      call VRFY(ret,'vsfwrt',number_failed)
+      ret = vsfdtch(vsid1)
+      call VRFY(ret,'vsfdtch',number_failed)
+C      use vhfscd and vhfscdm to create char vdata
+      call MESSAGE(5,'Using vhfscd/vsfscdm to create vdatas')
+      ret = vhfscd(fid1,'char1',cdata,5,DFNT_CHAR,'c1','c')
+      call VRFY(ret,'vhfscd',number_failed)
+      ret = vhfscdm(fid1,'char3',cdata,5,DFNT_CHAR,'c3','s',3)
+      call VRFY(ret,'vhfscdm',number_failed)
+
+C      create a five-field vdata, 2*int32,2*double,2*float32,
+C             2*int16 and 3*char type 
+      call MESSAGE(5,'Creating a five_field vdata')
+      vsid2 = vsfatch(fid1, -1, 'w')
+      call VRFY(vsid2,'vsfatch',number_failed)
+      ret = vsfsnam(vsid2, 'mixed type')
+      call VRFY(ret,'vsfsnam',number_failed)
+      ret = vsfscls(vsid2, 'test NT')
+      call VRFY(ret,'vsfscls',number_failed)
+      ret = vsffdef(vsid2, 'int32', DFNT_INT32, 2)
+      call VRFY(ret,'vsffdef',number_failed)
+      ret = vsffdef(vsid2, 'double', DFNT_FLOAT64, 2)
+      call VRFY(ret,'vsffdef',number_failed)
+      ret = vsffdef(vsid2, 'float32', DFNT_FLOAT32, 2)
+      call VRFY(ret,'vsffdef',number_failed)
+      ret = vsffdef(vsid2, 'int16', DFNT_INT16, 2)
+      call VRFY(ret,'vsffdef',number_failed)
+      ret = vsffdef(vsid2, 'char', DFNT_CHAR, 3)
+      call VRFY(ret,'vsffdef',number_failed)
+      ret = vsfsfld(vsid2, 'int32,double,float32,int16,char')
+      call VRFY(ret,'vsfsfld',number_failed)
+C     pack the fields into data buf
+      ret = vsfnpak(vsid2, HDF_VSPACK,
+     +             'int32,double,float32,int16,char', dbuf,
+     +             320*4,5,'int32',ddata4)
+      call VRFY(ret,'vsfnpak',number_failed)
+      ret = vsfnpak(vsid2, HDF_VSPACK,
+     +             ' ', dbuf, 320*4, 5,'double',gdata1)
+      call VRFY(ret,'vsfnpak',number_failed)
+      ret = vsfnpak(vsid2, HDF_VSPACK,
+     +             ' ', dbuf, 320*4, 5,'float32',fdata)
+      call VRFY(ret,'vsfnpak',number_failed)
+      ret = vsfnpak(vsid2, HDF_VSPACK,
+     +             ' ', dbuf, 320*4,5,'int16',ddata2)
+      call VRFY(ret,'vsfnpak',number_failed)
+      ret = vsfcpak(vsid2, HDF_VSPACK,
+C    +             'int32,double,float32,int16,char', dbuf,
+     +             ' ', dbuf, 320*4, 5,'char',cdata)
+      call VRFY(ret,'vsfcpak',number_failed)
+      ret = vsfwrt(vsid2, dbuf, 5, FULL_INTERLACE)
+      call VRFY(ret,'vsfwrt',number_failed)
+      ret = vsfdtch(vsid2)
+      call VRFY(ret,'vsfdtch',number_failed)
+
+C     insert vdata1 into vgroup1
+      call MESSAGE(5,'Inserting vdata1 into top vgroup')
+      vsref1 = vsfgid(fid1, -1)
+      call VRFY(vsref1, 'vsfgid', number_failed)
+      vsref2  = vsffnd(fid1, 'mixed type')
+      call VRFY(vsref2, 'vsffnd', number_failed)
+      ret = vfadtr(vgid1, DFTAG_VH, vsref1)
+      call VRFY(ret, 'vfadtr', number_failed)
+      ret = vfdtch(vgid1)
+      call VRFY(ret,'vfdtch',number_failed)
+      ret = vfend(fid1)
+      call VRFY(ret,'vfend',number_failed)
+      ret = hclose(fid1)
+      call VRFY(ret,'hclose',number_failed)
+
+C     read data back
+      call MESSAGE(5,'Readng data back')
+      fid1 = hopen(fn1, DFACC_RDWR, 0)
+      call VRFY(fid1,'hopen',number_failed)
+      ret = vfstart(fid1)
+      call VRFY(ret,'vfstart',number_failed)
+      vgref1 = vfgid(fid1, -1)
+      call VRFY(vgref1, 'vfgid', number_failed)
+      vgid1 = vfatch(fid1, vgref1,'w')
+      call VRFY(vgid1, 'vfatch', number_failed)
+      ntrs = vfgttrs(vgid1, tags, refs, 10)
+      call VRFY(ntrs, 'vfgttrs', number_failed)
+      if (ntrs .ne. 2) then
+         number_failed = number_failed + 1
+         call MESSAGE(3,'Wrong number of tag/refs. ')
+      endif
+C     look for the first vdata
+      found = FALSE
+      vref = -1
+      do 20 i = 1, ntrs
+         if (found .eq. FALSE) then
+             vref = vfgnxt(vgid1,vref)
+             call VRFY(vref, 'vref', number_failed)
+             found = vfisvs(vgid1, vref)
+         endif
+20    continue
+      if (found .eq. TRUE) then
+         vsid1 = vsfatch(fid1, vref, 'w')
+         call VRFY(vsid1,'vsfatch',number_failed)
+         ret = vsfinq(vsid1, nelts,il,fields1,vsize,vname)
+         call VRFY(ret,'vsfinq',number_failed)
+         if (nelts .ne. 3) then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong number of records. ') 
+         endif
+         if (il .ne. FULL_INTERLACE) then
+             number_failed = number_failed + 1
+              call MESSAGE(3,'Wrong interlace ')
+         endif
+         if (fields1 .ne. 'char type') then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong field names. ')
+         endif
+         if (vsize .ne. 5) then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong vsize. ')
+         endif
+         ret = vsfsfld(vsid1, 'char type')
+         call VRFY(ret,'vsfsfld',number_failed)
+         ret = vsfrdc(vsid1, icdata, 3, FULL_INTERLACE)
+         call VRFY(ret,'vsfrdc',number_failed)
+         if (icdata .ne. 'abcdebcdefcdefg') then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong icdata. Correct: abcdebcdefcdefg')
+         endif
+         ret = vsfdtch(vsid1)
+         call VRFY(ret,'vsfdtch',number_failed)
+C     not found, print error message
+      else
+         call MESSAGE(3,'Not found char type vdata. ')
+      endif
+
+C     read the second vdata
+      call MESSAGE(5,'Reading the int16 vdata')
+      vsref1 = vsfgid(fid1, vref)
+      call VRFY(vsref1, 'vsfgid', number_failed)
+      vsid1 = vsfatch(fid1, vsref1, 'w')
+      call VRFY(vsid1,'vsfatch',number_failed)
+      ret = vsfinq(vsid1, nelts,il, fields2,vsize,vname)
+      call VRFY(ret,'vsfinq',number_failed)
+      if (nelts .ne. 5) then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong number of records. ')
+      endif
+      if (il .ne. FULL_INTERLACE) then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong interlace. ')
+      endif
+      if (fields2 .ne. 'int16 type') then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong fields. ')
+      endif
+      ret = vsfsfld(vsid1, 'int16 type')
+      call VRFY(ret,'vsfsfld',number_failed)
+      ret = vsfrd(vsid1, iddata1, 5, FULL_INTERLACE)
+      call VRFY(ret,'vsfrd',number_failed)
+      do 40 i=1,10 
+          if (iddata1(i) .ne. (9+i)) then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong data. ')  
+          endif
+40    continue
+      ret = vsfdtch(vsid1)
+      call VRFY(ret,'vsfdtch',number_failed)
+C     read the 'c1' vdata
+      vsref1 = vsffnd(fid1, 'c1')
+      call VRFY(vsref1, 'vsffnd', number_failed)
+      vsid1 = vsfatch(fid1, vsref1, 'w')
+      call VRFY(vsid1, 'vsfatch', number_failed)
+      ret = vsfsfld(vsid1, 'char1')
+      call VRFY(ret, 'vsfsfld', number_failed)
+      ret = vsfrd(vsid1, idbuf, 5,FULL_INTERLACE)
+      call VRFY(ret, 'vsfrd', number_failed)
+      icdata = '               '
+      ret = vsfcpak(vsid1,HDF_VSUNPACK,' ',idbuf,320*4,
+     +        5, ' ', icdata)
+      call VRFY(ret, 'vsfcpak', number_failed)
+      if (icdata .ne. 'abcde          ')  then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong icdata. ')
+      endif
+      ret = vsfdtch(vsid1)
+      call VRFY(ret,'vsfdtch',number_failed)
+C     read the 'c3' vdata
+      vsref1 = vsffnd(fid1, 'c3')
+      call VRFY(vsref1, 'vsffnd', number_failed)
+      vsid1 = vsfatch(fid1, vsref1, 'w')
+      call VRFY(vsid1, 'vsfatch', number_failed)
+      ret = vsfsfld(vsid1, 'char3') 
+      call VRFY(ret, 'vsfsfld', number_failed)
+      ret = vsfrd(vsid1, idbuf, 5,FULL_INTERLACE)
+      call VRFY(ret, 'vsfrd', number_failed)
+      icdata = '               '
+      ret = vsfcpak(vsid1,HDF_VSUNPACK,' ',idbuf,320*4,
+     +        5, ' ', icdata)
+      call VRFY(ret, 'vsfcpak', number_failed)
+      if (icdata .ne. 'abcdebcdefcdefg')  then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong data. ')
+      endif 
+      ret = vsfdtch(vsid1)
+      call VRFY(ret,'vsfdtch',number_failed)
+ 
+C     read the 'mixed type' vdata
+      vsref2 = vsffnd(fid1, 'mixed type')
+      call VRFY(vsref2, 'vsffnd', number_failed)
+      vsref22 = vsffcls(fid1, 'test NT')
+      call VRFY(vsref22, 'vsffcls', number_failed)
+      vsid2 = vsfatch(fid1, vsref2, 'w')
+      call VRFY(vsid2, 'vsfatch', number_failed)
+C
+C     This piece of the code exercises VF interface function
+C     Added by E. Pourmal 1/22/99
+C
+C      
+C     Find the total number of the fields in the vdata.
+C
+      ret = vfnflds (vsid2)
+      if (ret .ne. 5) then
+          number_failed = number_failed + 1
+          call MESSAGE(3, 'Wrong number of the vdata fileds. ')
+      endif 
+C
+C     Find the datatype of the first field (should be DFNT_INT32)
+C
+      ret = vfftype(vsid2, 0)
+      if (ret. ne. DFNT_INT32) then
+          number_failed = number_failed + 1
+          call MESSAGE(3, 'Wrong field datatype returned. ')
+      endif
+C
+C     Find the order of the second field (should be 2)
+C
+      ret = vffordr(vsid2, 1)
+      if (ret .ne. 2) then
+          number_failed = number_failed + 1
+          call MESSAGE(3, 'Wrong field order returned. ') 
+      endif
+C
+C     Find the name of the third field (should be 'float32')
+C
+      ret = vffname(vsid2, 2, field_name)
+      if (ret .ne. 0 .or. field_name .ne. 'float32') then
+          number_failed = number_failed + 1
+          call MESSAGE(3, 'Cannot return name of the field. ') 
+      endif
+C
+C     Find the size as stored in memory of the fourth vdata field.
+C
+      ret = vffisiz(vsid2, 3)
+      call VRFY(ret, 'vffisiz', number_failed)
+C
+C     Find th esize as stored in file of the fifth vdata field.
+C
+      ret = vffesiz(vsid2, 4)
+      call VRFY(ret, 'vffesiz', number_failed)
+C
+C     The end of the VF interface test.  Two last calls should be tested
+C     more carefully, i.e. what the correct ret values are ??????????
+C
+
+      ret = vsfinq(vsid2, nelts,il, fields3,vsize,vname)
+      call VRFY(ret, 'vsfinq', number_failed)
+      if (nelts .ne. 5) then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong number of records. ')
+      endif
+      if (il .ne. FULL_INTERLACE) then
+          number_failed = number_failed + 1
+          call MESSAGE(3, 'Wrong interlace. ')
+      endif
+      if (fields3 .ne. 'int32,double,float32,int16,char') then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong fields. ')
+      endif
+      ret = vsfsfld(vsid2, 'int32,double,float32,int16,char')
+      call VRFY(ret, 'vsfsfld', number_failed)
+      ret = vsfrd(vsid2, idbuf, 3, FULL_INTERLACE)
+      call VRFY(ret, 'vsfrd', number_failed)
+      ret = vsfnpak(vsid2, HDF_VSUNPACK,
+     +             ' ', idbuf, 320*4,3,'int32',iddata4)
+      call VRFY(ret, 'vsfnpak', number_failed)
+      ret = vsfnpak(vsid2, HDF_VSUNPACK,
+     +             ' ', idbuf, 320*4,3,'double',igdata1)
+      call VRFY(ret, 'vsfnpak', number_failed)
+      ret = vsfnpak(vsid2, HDF_VSUNPACK,
+     +             ' ', idbuf, 320*4,3,'float32',ifdata)
+      call VRFY(ret, 'vsfnpak', number_failed)
+      ret = vsfnpak(vsid2, HDF_VSUNPACK,
+     +             ' ', idbuf, 320*4,3,'int16',iddata2)
+      call VRFY(ret, 'vsfnpak', number_failed)
+      icdata = '               '
+      ret = vsfcpak(vsid2, HDF_VSUNPACK,
+     +             'int32,double,float32,int16,char', idbuf,
+     +             320*4,3,'char',icdata)
+      call VRFY(ret, 'vsfcpak', number_failed)
+
+      do 45 i=1,3
+         if (iddata4(i) .ne. (39+i)) then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong data. ')
+         endif
+         if (iddata2(i) .ne. (19+i)) then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong data. ')
+         endif
+45    continue
+      do 50 i = 1, 3
+         if (abs(gdata1(i) - igdata1(i)) .GE.
+     +        gdata1(i)*geps)  then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong data. ')
+         endif
+         if (abs(fdata(i) - ifdata(i)) .GE.
+     +        fdata(i)*feps)  then
+             number_failed = number_failed + 1
+             call MESSAGE(3,'Wrong data. ')
+         endif
+50    continue
+      if (icdata .ne. 'abcdebcde      ') then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong data. ')
+      endif
+C     read field 'char' only, test pckfld ' '
+      ret = vsfsfld(vsid2, 'char')
+      call VRFY(ret, 'vsfsfld', number_failed)
+      ret = vsfrd(vsid2, idbuf, 2, FULL_INTERLACE)
+      call VRFY(ret, 'vsfrd', number_failed)
+      icdata = '               '
+      ret = vsfcpak(vsid2, HDF_VSUNPACK,
+     +             'char', idbuf, 320*4,2,' ',icdata)
+      call VRFY(ret, 'vsfcpak', number_failed)
+      if (icdata .ne. 'fcdefg         ') then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong data. ')
+      endif
+
+      ret = vsfdtch(vsid2)
+      call VRFY(ret,'vsfdtch',number_failed)
+      ret = vfdtch(vgid1)
+      call VRFY(ret,'vsfdtch',number_failed)
+      ret = vfend(fid1)
+      call VRFY(ret,'vfend',number_failed)
+      ret = hclose(fid1)
+      call VRFY(ret, 'hclose', number_failed)
+C
+C     Testing deleting a tag/ref pair from Vgroups using vfdtr()
+C     Not as extensive as the C-version of the similar test because
+C     for now some the fortran versions of Vgroup routines are missing.
+C
+C Open the file for writing
+      fid1 = hopen(fn1, DFACC_RDWR, 0)
+      call VRFY(fid1,'hopen',number_failed)
+C
+C-----Test hglibver and hgfilver functions.
+C
+      ret = hglibver(major_v, minor_v, release, hdfstring)
+      call VRFY(ret, 'hglibver', number_failed)
+      ret = hgfilver(fid1, major_v, minor_v, release, hdfstring)
+      call VRFY(ret, 'hgfilver', number_failed)
+
+      ret = vfstart(fid1)
+      call VRFY(ret,'vfstart',number_failed)
+
+C Create a vgroup to add a bogus element to.
+      call MESSAGE(5,'Creating a vgroup')
+      vgid1 = vfatch(fid1, -1, 'w')
+      call VRFY(vgid1, 'vfatch', number_failed)
+      ret = vfsnam(vgid1, 'Vgroup to delete from')
+      call VRFY(ret,'vfsnam',number_failed)
+      ret = vfscls(vgid1, 'Vgroup to delete from')
+      call VRFY(ret,'vfscls',number_failed)
+
+C     Add a bogus element to the vgroup
+      ret = vfadtr(vgid1, 5000, 1234)
+      call VRFY(ret, 'vfadtr', number_failed)
+
+C     Now delete it again just make sure the call does not fail
+C     The C-version of the tests does a better job overall.
+
+      ret = vfdtr(vgid1, 5000, 1234)
+      call VRFY(ret, 'vfdtr', number_failed)
+
+C     Detach from vgroup
+      ret = vfdtch(vgid1)
+      call VRFY(ret,'vfdtch',number_failed)
+
+C     Close Vxxx interface down
+      ret = vfend(fid1)
+      call VRFY(ret,'vfend',number_failed)
+
+C     Close file
+      ret = hclose(fid1)
+      call VRFY(ret,'hclose',number_failed)
+
+      return
+      end
+C
+C This subroutine tests vsfsetblsz, vsfsetnm, vsfgetinfo functions
+C
+C It creates and writes multi-component Vdata and single-component Vdata; 
+C then it sets sizes and number of blocks
+C for multi-component Vdata's link block and appends to the Vdata.
+C File is then closed and reponened once more; block information
+C is retrieved for the multi-component Vdata.
+C
+      subroutine tvsetblock(number_failed)
+      implicit none
+      character*20 myname
+      parameter (myname = 'vsetblock')
+      integer number_failed
+C
+C     Parameter declaration
+C
+      character*22 FILE_NAME
+      character*9  CLASS1_NAME
+      character*9  CLASS2_NAME
+      character*11 VDATA1_NAME
+      character*12 VDATA2_NAME
+      character*22 FIELD1_NAME
+      character*21 FIELD2_NAME
+      integer      N_RECORDS_1, N_RECORDS_2
+      integer      ORDER_2
+      integer      FULL_INTERLACE
+C
+      parameter (FILE_NAME   = 'Vdatas_blocks_test.hdf',
+     +           CLASS1_NAME = '5x1 Array',
+     +           CLASS2_NAME = '6x4 Array',
+     +           VDATA1_NAME = 'First Vdata',
+     +           VDATA2_NAME = 'Second Vdata',
+     +           FIELD1_NAME = 'Single-component Field',
+     +           FIELD2_NAME = 'Multi-component Field')
+      parameter (N_RECORDS_1 = 5,
+     +           N_RECORDS_2 = 256,
+     +           ORDER_2     = 2,
+     +           FULL_INTERLACE = 0)               
+   
+      integer DFACC_WRITE, DFNT_CHAR8, DFNT_INT32
+      parameter (DFACC_WRITE = 2,
+     +           DFNT_CHAR8  = 4,
+     +           DFNT_INT32  = 24)
+      integer BLOCK_SIZE, NUM_BLOCKS
+      parameter (BLOCK_SIZE = 256,
+     +           NUM_BLOCKS = 3)
+      
+C
+C     Function declaration
+C
+      integer hopen, hclose
+      integer vfstart, vhfscd, vhfsdm, vfend 
+      integer vsfsetblsz, vsfsetnmbl, vsfgetblinfo
+      integer vsfatch, vsfdtch, vsffnd, vsfwrt, vsfrd, vsfseek
+
+C
+C**** Variable declaration *******************************************
+C
+      integer   status, return_flag
+      integer   file_id
+      integer   vdata1_ref, vdata2_ref 
+      integer   vdata2_id 
+      character vdata1_buf(N_RECORDS_1)
+      integer   vdata2_buf(ORDER_2, N_RECORDS_2)
+      integer   buf(ORDER_2)
+      integer   i, j
+      integer   block_size_out, num_blocks_out
+      integer   n_records
+      data vdata1_buf /'V','D','A','T','A'/
+C
+C**** End of variable declaration ************************************
+      call ptestban('Testing', myname)
+C
+C     Initialize vdata2_buf
+C
+      do i = 1, N_RECORDS_2
+         do j = 1, ORDER_2
+            vdata2_buf(j,i) = j + i
+         enddo
+      enddo
+C
+C
+C     Open the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+      call VRFY(file_id,'hopen',number_failed)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+      call VRFY(status,'vfstart',number_failed)
+C
+C     Create multi-component vdata and populate it with data from vdata2_buf array.
+C     
+      vdata2_ref = vhfsdm(file_id, FIELD2_NAME, vdata2_buf, N_RECORDS_2,
+     +                    DFNT_INT32, VDATA2_NAME, CLASS2_NAME,
+     +                    ORDER_2)
+      call VRFY(vdata2_ref,'vhfsdm',number_failed)
+C
+C     Create single-component vdata and populate it with data from vdata1_buf array.
+C     
+      vdata1_ref = vhfscd(file_id, FIELD1_NAME, vdata1_buf, N_RECORDS_1,
+     +                    DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME)
+      call VRFY(vdata1_ref,'vhfscd',number_failed)
+C
+C     Terminate access to the VS interface and close the HDF file.
+C
+      status = vfend(file_id)
+      call VRFY(status,'vfend',number_failed)
+      status = hclose(file_id)
+      call VRFY(status,'hclose',number_failed)
+      if (number_failed .gt. 0) goto 1000
+C
+C     Reopen the HDF file for writing.
+C
+      file_id = hopen(FILE_NAME, DFACC_WRITE, 0)
+      call VRFY(file_id,'hopen',number_failed)
+C
+C     Initialize the VS interface.
+C
+      status = vfstart(file_id) 
+      call VRFY(status,'vfstart',number_failed)
+C
+C     Attach to the multi-component Vdata
+C
+      vdata2_ref = vsffnd(file_id, VDATA2_NAME) 
+      call VRFY(vdata2_ref,'vsffnd',number_failed)
+      vdata2_id = vsfatch(file_id, vdata2_ref, 'w')
+      status = vsfsetblsz(vdata2_id, BLOCK_SIZE) 
+      call VRFY(status,'vsfsetblsz',number_failed)
+      status = vsfsetnmbl(vdata2_id, NUM_BLOCKS) 
+      call VRFY(status,'vsfsetblnm',number_failed)
+C
+C     Append to the multi-component Vdata 
+C
+      n_records = vsfseek(vdata2_id, N_RECORDS_2-1)
+      call VRFY(n_records,'vsfseek',number_failed)
+      n_records = 1
+      status = vsfrd(vdata2_id, buf, n_records, FULL_INTERLACE)
+      call VRFY(status,'vsfrd',number_failed)
+       
+      n_records = N_RECORDS_2
+      status = vsfwrt(vdata2_id, vdata2_buf, n_records,
+     +                FULL_INTERLACE)
+      if (status .ne. N_RECORDS_2) then
+          number_failed = number_failed + 1
+          call MESSAGE(3,'Wrong number of records added ')
+          call MESSAGE(3,'Append to multi-component Vdata failed ')
+      endif
+      call VRFY(vdata2_id,'vsfatch',number_failed)
+      status = vsfgetblinfo(vdata2_id, block_size_out, num_blocks_out)
+      if (block_size_out .ne. BLOCK_SIZE .or. 
+     +    num_blocks_out .ne. NUM_BLOCKS) then
+          call MESSAGE(3,'Linked-block info is wrong ')
+          number_failed = number_failed + 1
+      endif
+      status = vsfdtch(vdata2_id)
+      call VRFY(status,'vsfdtch',number_failed)
+      status = vfend(file_id)
+      call VRFY(status,'vfend',number_failed)
+      status = hclose(file_id)
+      call VRFY(status,'hclose',number_failed)
+
+1000  continue
+      return
+      end
+C
+C This subroutine tests functions vfgvgroups and vsfgvdatas
+C
+      subroutine tvgroups(number_failed)
+
+      implicit none
+      include '../src/hdf.inc'
+
+      integer number_failed
+      integer fid 
+      integer vgroup_id, vgroup0_id, vgroup1_id, vgroup2_id
+      integer vgroup3_id, vgroup4_id, vgroup5_id 
+      integer vgroup_ref
+      integer vdata_id, vdata_ref
+      integer vdata1_id, vdata2_id
+      integer n_vgs, n_vds
+      integer num_vgroups
+      parameter (num_vgroups = 10)
+      integer refarray(num_vgroups)
+      integer num_vdatas
+      parameter (num_vdatas = 8)
+      character*12 uservgroups
+      parameter (uservgroups = 'tuservgs.hdf')
+      integer ref_list(num_vgroups), vdref_list(num_vdatas)
+      character*20 vgclass
+      integer ii
+      character*2 ichr2
+      integer status
+
+      character*20 myname
+      parameter (myname = 'vgroups')
+C
+C     Function declaration
+C
+      integer hopen, hclose, vfend
+      integer vfstart, vfatch, vqref, vfscls, vfdtch
+      integer vfinsrt, vfgvgroups
+      integer vsfgvdatas, vsqref, vsfatch, vsfscls, vsfdtch
+      integer result(10)
+
+      call ptestban('Testing', myname)
+
+      n_vgs=0
+
+C     Create HDF file and initialize the interface.
+      fid = hopen(uservgroups, DFACC_CREATE, 0)
+      call VRFY(fid,'hfopen',number_failed)
+      status = vfstart(fid)
+      call VRFY(fid,'vfstart',number_failed)
+C     Create NUM_VGROUPS vgroups and set classname
+      do ii = 1,  num_vgroups
+C       Create a vgroup.
+        vgroup_id = vfatch(fid, -1, "w")
+        call VRFY(vgroup_id,'vfatch',number_failed)
+
+C       Record its reference number for later access
+        vgroup_ref = vqref(vgroup_id)
+        call VRFY( vgroup_ref,'vqref',number_failed)
+        ref_list(ii) = vgroup_ref
+
+C       Set its class name
+        write(ichr2,'(I2.2)') ii
+        vgclass = "VG-CLASS-"//ichr2
+        status = vfscls(vgroup_id, vgclass)
+        call VRFY(status,'vfscls',number_failed)
+
+C       Detach it
+        status = vfdtch(vgroup_id)
+        call VRFY(status,'vfdtch',number_failed) 
+      enddo
+
+C Insert some vgroups into some other vgroups to build some sort of
+C vgroup structure
+
+C Insert "VG-CLASS-1" and "VG-CLASS-2" into "VG-CLASS-0"
+
+      vgroup0_id = vfatch(fid,  ref_list(1), "w")
+      call VRFY(vgroup0_id,'vfatch',number_failed)
+      vgroup1_id = vfatch(fid,  ref_list(2), "w")
+      call VRFY(vgroup1_id,'vfatch',number_failed)
+      vgroup2_id = vfatch(fid,  ref_list(3), "w")
+      call VRFY(vgroup2_id,'vfatch',number_failed)
+
+      status = vfinsrt(vgroup0_id, vgroup1_id)
+      call VRFY(status,'vfinsrt',number_failed)
+      status = vfinsrt(vgroup0_id, vgroup2_id)
+      call VRFY(status,'vfinsrt',number_failed)
+
+C Insert "VG-CLASS-3", "VG-CLASS-4", and "VG-CLASS-5" into "VG-CLASS-1"
+
+      vgroup3_id = vfatch(fid,  ref_list(4), "w")
+      call VRFY(vgroup3_id,'vfatch',number_failed)
+      vgroup4_id = vfatch(fid,  ref_list(5), "w")
+      call VRFY(vgroup4_id,'vfatch',number_failed)
+      vgroup5_id = vfatch(fid,  ref_list(6), "w")
+      call VRFY(vgroup5_id,'vfatch',number_failed)
+
+      status = vfinsrt(vgroup1_id, vgroup3_id)
+      call VRFY(status,'vfinsrt',number_failed)
+      status = vfinsrt(vgroup1_id, vgroup4_id)
+      call VRFY(status,'vfinsrt',number_failed)
+      status = vfinsrt(vgroup1_id, vgroup5_id)
+      call VRFY(status,'vfinsrt',number_failed)
+
+C     **************************************************************
+C      The vgroup structure should look like this:
+C     		vg0	vg6  vg7  vg8  vg9
+C     		 |
+C     		/ \
+C     	      vg1  vg2
+C                  |
+C                / | \
+C               /  |  \
+C            vg3  vg4  vg5
+C     
+C      Calling Vgetvgroups on the file should return all ten vgroups.
+C      Calling Vgetvgroups on vg0 should return 2, vg1 and vg2.
+C      Calling Vgetvgroups on vg1 should return 3, vg3, vg4, and vg5
+C      Calling Vgetvgroups on vg6, vg7, vg8, and vg9 should return 0
+C     ***************************************************************
+
+C     Get and verify the number of vgroups in the file
+      n_vgs = vfgvgroups(fid, 0, -1, refarray)
+      call VRFY(n_vgs,'vfgvgroups',number_failed)
+      if(n_vgs.ne.num_vgroups)then
+         call MESSAGE(3,'Wrong number of vgroups returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     Check if setting start_vg to non-zero with vg_count = -1 returns
+C     the correct n_vgs
+
+      n_vgs = vfgvgroups(fid, 5, -1, refarray)
+      call VRFY(n_vgs,'vfgvgroups',number_failed)
+      if(n_vgs.ne.num_vgroups)then
+         call MESSAGE(3,'Wrong number of vgroups returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     Get all the vgroups in the file
+      n_vgs = vfgvgroups(fid, 0,  n_vgs, refarray)
+      call VRFY(n_vgs,'vfgvgroups',number_failed)
+
+C     Verify refarray from this vfgvgroups, it should contain:
+C     2  3  4  5  6  7  10  11
+
+      result = (/2, 3, 4, 5, 6, 7, 8, 9, 10, 11/)
+
+      do ii = 1, n_vgs
+         if( refarray(ii).ne.result(ii) )then
+          call MESSAGE(3,'Incorrect vgroup retrieved ')
+          number_failed = number_failed + 1
+       endif
+      enddo
+
+      call VRFY(n_vgs,'vfgvgroups',number_failed)
+      if(n_vgs.ne.num_vgroups)then
+         call MESSAGE(3,'Wrong number of vgroups returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     Get 5 vgroups starting from vgroup number 5, the result shouldn't
+C     include the simulated internal vgroups
+       
+      n_vgs = vfgvgroups(fid, 5, 5, refarray)
+      call VRFY(n_vgs,'vfgvgroups',number_failed)
+      if(n_vgs.ne.5)then
+         call MESSAGE(3,'Wrong number of vgroups returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     Verify refarray from this Vgetvgroups, 
+C     it should contain: 7, 8, 9, 10, 11
+
+      result = (/7, 8, 9, 10, 11, 0, 0, 0, 0, 0/)
+      do ii = 1, n_vgs
+         if( refarray(ii).ne.result(ii) )then
+            call MESSAGE(3,'Incorrect vgroup retrieved ')
+            number_failed = number_failed + 1
+         endif
+      enddo
+      
+C     Passing in info count as 0, should fail
+      n_vgs = vfgvgroups(fid, 0, 0, refarray)
+      if(n_vgs.ne.-1)then
+         call MESSAGE(3,'Wrong number of vgroups status returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     This vgroup should have no sub-vgroup
+      n_vgs = vfgvgroups(vgroup5_id, 0, -1, refarray)
+      if(n_vgs.ne.0)then
+         call MESSAGE(3,'Wrong number of vgroups status returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     Passing in the starting vgroup beyond the number of 
+C     user-created vgroups, should fail
+      n_vgs =  vfgvgroups(fid, 11, 3, refarray)
+      if(n_vgs.ne.-1)then
+         call MESSAGE(3,'Wrong number of vgroups status returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     Create NUM_VDATAS vgroups and set classname
+
+      do ii = 1, num_vdatas
+
+C       Create a vdata.
+        vdata_id = vsfatch(fid, -1, "w")
+        call VRFY(vdata_id,'vsfatch',number_failed)
+
+C       Record its reference number for later access
+        vdata_ref = vsqref(vdata_id)
+        call VRFY(vdata_ref,'vsqref',number_failed)
+        vdref_list(ii) = vdata_ref;
+
+C       Set its class name
+        write(ichr2,'(I2.2)') ii
+        vgclass = "VS-CLASS-"//ichr2
+        status = vsfscls(vdata_id, vgclass)
+        call VRFY(status,'vsfscls',number_failed)
+
+C       Detach it
+        status = vsfdtch(vdata_id)
+        call VRFY(status,'vsfdtch',number_failed)
+
+      end do
+
+      vdata1_id = vsfatch(fid, vdref_list(2), "w")
+      call VRFY(status,'vsfatch',number_failed)
+ 
+      vdata2_id = vsfatch(fid, vdref_list(3), "w")
+      call VRFY(status,'vsfatch',number_failed)
+
+      status = vfinsrt(vgroup0_id, vdata1_id)
+      call VRFY(status,'vfinsrt vdata1_id -> vgroup0_id',number_failed)
+      status = vfinsrt(vgroup0_id, vdata2_id)
+      call VRFY(status,'vfinsrt vdata2_id -> vgroup0_id',number_failed)
+
+      status = vfdtch(vgroup0_id)
+      call VRFY(status,'vfdtch vgroup0_id')
+      status = vfdtch(vgroup1_id)
+      call VRFY(status,'vfdtch vgroup1_id')
+
+C     Test getting all vdatas: fid, start_vd=0, n_vds=0
+
+      n_vds = vsfgvdatas(fid, 0, -1, refarray)
+      if(n_vds.ne.num_vdatas)then
+         call MESSAGE(3,'Wrong number of vdatas status returned ')
+         number_failed = number_failed + 1
+      endif
+
+      n_vds = vsfgvdatas(fid, 0, n_vds, refarray)
+      if(n_vds.ne.num_vdatas)then
+         call MESSAGE(3,'Wrong number of vdatas status returned ')
+         number_failed = number_failed + 1
+      endif
+      result = (/12, 13, 14, 15, 16, 17, 18, 19, 0, 0/)
+      do ii = 1, n_vds
+         if( refarray(ii).ne.result(ii) )then
+            call MESSAGE(3,'Incorrect vdatas retrieved ')
+            number_failed = number_failed + 1
+         endif
+      enddo
+      vgroup0_id = vfatch(fid,  ref_list(1), "w")
+      call VRFY(vgroup0_id,'vfatch',number_failed)
+
+C     Test getting vdatas in vg0: vgroup0_id, start_vd=0, n_vds=0
+
+      n_vds = vsfgvdatas(vgroup0_id, 0, -1, refarray)
+      if(n_vds.ne.2)then
+         call MESSAGE(3,'Wrong number of vdatas status returned ')
+         number_failed = number_failed + 1
+      endif
+
+      n_vds = vsfgvdatas(vgroup0_id, 0, n_vds, refarray)
+      if(n_vds.ne.2)then
+         call MESSAGE(3,'Wrong number of vdatas status returned ')
+         number_failed = number_failed + 1
+      endif
+      result = (/13, 14, 0, 0, 0, 0, 0, 0, 0, 0/)
+      do ii = 1, n_vds
+         if( refarray(ii).ne.result(ii) )then
+            call MESSAGE(3,'Incorrect vdatas retrieved ')
+            number_failed = number_failed + 1
+         endif
+      enddo
+
+C     Passing in vd_count as 0, should fail
+      n_vds = vsfgvdatas(fid, 0, 0, refarray)
+      if(n_vds.ne.-1)then
+         call MESSAGE(3,'Wrong number of vgroups status returned ')
+         number_failed = number_failed + 1
+      endif
+C     This vgroup should have no sub-vdatas
+      n_vds = vsfgvdatas(vgroup5_id, 0, -1, refarray)
+      if(n_vds.ne.0)then
+         call MESSAGE(3,'Wrong number of vgroups status returned ')
+         number_failed = number_failed + 1
+      endif
+C     Passing in the starting vgroup beyond the number 
+C     of user-created vgroups, should fail
+      n_vds = vsfgvdatas(fid, 10, 3, refarray)
+      if(n_vds.ne.-1)then
+         call MESSAGE(3,'Wrong number of vgroups status returned ')
+         number_failed = number_failed + 1
+      endif
+
+C     Terminate access
+      
+      status = vfdtch(vgroup0_id)
+      call VRFY(status,'vfdtch vgroup0_id')
+      status = vsfdtch(vdata1_id)
+      call VRFY(status,'vsfdtch vdata1_id')
+      status = vsfdtch(vdata2_id)
+      call VRFY(status,'vsfdtch vdata2_id')
+
+C     Terminate access to the V interface and close the HDF file.
+      status = vfend(fid)
+      call VRFY(status,'vfend',number_failed)
+      status = hclose(fid)
+      call VRFY(status,'vclose',number_failed)
+
+      end
diff --git a/hdf/test/tvsfpack.c b/hdf/test/tvsfpack.c
new file mode 100644
index 0000000..acd7108
--- /dev/null
+++ b/hdf/test/tvsfpack.c
@@ -0,0 +1,335 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include <math.h>
+#include "vg.h"
+#include "tproto.h"
+#define NRECORDS 5
+#define EPS     0.00001
+
+#define FIELD_1 "Ident"
+#define FIELD_2 "Temp"
+#define FIELD_3 "Speed"
+#define FIELD_4 "Height"
+#define FIELD_NAMES "Ident,Temp,Speed,Height"
+#define FILENAME    "tvpack.hdf"
+struct {
+    char         ident;
+    float32      temp;
+    int16        speed;
+    float32      height;
+} source[NRECORDS];
+
+int32      file_id, vdata_id, istat, msize = 0;
+uint8      *databuf, *pntr;
+VOIDP	   databufptr[10];	/* make sure its size can hold all fields */
+
+float32    tempdata[NRECORDS], itemp[NRECORDS];
+float32    heightdata[NRECORDS], iheight[NRECORDS];
+int16      speeddata[NRECORDS], ispeed[NRECORDS];
+char       identdata[NRECORDS], iident[NRECORDS];
+int        i, j, rec_size;
+int32      vdata_ref, in_recs, iil, irec_size;
+char       ifields[256];
+
+static int32 fpack(void);
+static int32 funpack(void);
+
+static int32 
+fpack(void)
+{
+    /* Open the HDF file. */
+    file_id = Hopen(FILENAME, DFACC_CREATE, 0);
+
+    /* Initialize the Vset interface. */
+    Vstart(file_id);
+
+    /* Create a new Vdata. */
+    vdata_id = VSattach(file_id, -1, "w");
+
+    /* Define the field to write. */
+    istat = VSfdefine(vdata_id, FIELD_1, DFNT_CHAR8, 1);
+    istat = VSfdefine(vdata_id, FIELD_2, DFNT_FLOAT32, 1);
+    istat = VSfdefine(vdata_id, FIELD_3, DFNT_INT16, 1);
+    istat = VSfdefine(vdata_id, FIELD_4, DFNT_FLOAT32, 1);
+
+    /* Set the Vdata name. */
+    VSsetname(vdata_id, "myvdata");
+   /* Set the Vdata class. */
+    VSsetclass(vdata_id, "pack");
+
+    /* Set the field names. */
+    istat = VSsetfields(vdata_id, FIELD_NAMES);
+    rec_size = 2*sizeof(float32) + sizeof(int16) + sizeof(char);
+
+    databuf = (uint8 *) HDmalloc(((2 * sizeof(float32))
+                + sizeof(int16) + sizeof(char)) * NRECORDS);
+
+    pntr = databuf;
+    /* pack a record at a time */
+    for (i = 0; i < NRECORDS; i++) {
+        source[i].temp = (float32)1.11 * (float32)(i+1);
+        source[i].height = (float32)2.22 * (float32)(i+1);
+        source[i].speed = (int16)i;
+        source[i].ident = (char)('A' + i);
+         /* test error checks  */ 
+        if (i==0) {
+	    /* test not enough vdata buffer size */
+	    databufptr[0] = &source[i].ident;
+	    databufptr[1] = &source[i].temp;
+	    databufptr[2] = &source[i].speed;
+	    databufptr[3] = &source[i].height;
+            istat = VSfpack(vdata_id,_HDF_VSPACK, NULL, pntr, 1,
+                   1, NULL, databufptr);
+            if (istat != FAIL)  {
+                num_errs++;
+                printf(">>> VSfpack failed in checking bufsz %d\n", i);
+            }
+            pntr = databuf;
+	    /* test wrong field name */
+	    databufptr[0] = &source[i].ident;
+	    databufptr[1] = &source[i].temp;
+	    databufptr[2] = &source[i].speed;
+	    databufptr[3] = &source[i].height;
+            istat = VSfpack(vdata_id,_HDF_VSPACK, NULL, pntr, rec_size,
+                 1,"Idents,Temp,Speed,Height" , databufptr);
+            if (istat != FAIL)  {
+                num_errs++;
+                printf(">>> VSfpack failed in checking field names.\n");
+            }
+            pntr = databuf;
+        }
+          /* normal test */
+	databufptr[0] = &source[i].ident;
+	databufptr[1] = &source[i].temp;
+	databufptr[2] = &source[i].speed;
+	databufptr[3] = &source[i].height;
+        istat = VSfpack(vdata_id,_HDF_VSPACK, NULL, pntr, rec_size,
+                   1, NULL, databufptr);
+        if (istat == FAIL)  {
+            num_errs++;
+            printf(">>> VSfpack failed in packing record %d\n", i);
+        }
+ 
+        pntr += rec_size;
+    }
+    /* Write the data to the Vset object. */
+    istat = VSwrite(vdata_id, databuf, NRECORDS, FULL_INTERLACE);
+    if (istat != NRECORDS)  {
+         num_errs++;
+         printf(">>> VSwrite failed in write %d records.\n", NRECORDS);
+    }
+
+    /* pack a field at a time */
+    pntr = databuf;
+    for (i = 0; i < NRECORDS; i++) {
+        source[i].temp = (float32)3.33 * (float32)(i+1);
+        source[i].height = (float32)4.44 * (float32)(i+1);
+        source[i].speed = (int16)(2*i);
+        source[i].ident = (char)('a' + i);
+	databufptr[0] = &source[i].speed;
+        istat = VSfpack(vdata_id,_HDF_VSPACK,NULL, pntr,rec_size,
+                   1, FIELD_3, databufptr);
+        if (istat == FAIL)  {
+            num_errs++;
+            printf(">>> VSfpack failed in packing speed.\n");
+        }
+	databufptr[0] = &source[i].ident;
+        istat = VSfpack(vdata_id,_HDF_VSPACK,NULL, pntr,rec_size,
+                   1, FIELD_1, databufptr);
+        if (istat == FAIL)  {
+            num_errs++;
+            printf(">>> VSfpack failed in packing ident.\n");
+        }
+	databufptr[0] = &source[i].temp;
+        istat = VSfpack(vdata_id,_HDF_VSPACK,NULL, pntr,rec_size,
+                   1, FIELD_2, databufptr);
+        if (istat == FAIL)  {
+            num_errs++;
+            printf(">>> VSfpack failed in packing temp.\n");
+        }
+	databufptr[0] = &source[i].height;
+        istat = VSfpack(vdata_id,_HDF_VSPACK,NULL, pntr,rec_size,
+                   1, FIELD_4, databufptr);
+        if (istat == FAIL)  {
+            num_errs++;
+            printf(">>> VSfpack failed in packing height.\n");
+        }
+        pntr += rec_size;
+    }
+    /* Write the data to the Vset object. */
+    istat = VSwrite(vdata_id, databuf, NRECORDS, FULL_INTERLACE);
+    if (istat != NRECORDS)  {
+         num_errs++;
+         printf(">>> VSwrite failed in write %d records.\n", NRECORDS);
+    }
+
+    /*
+    * Terminate access to the Vdata, the Vset interface
+    * and the HDF file.
+    */
+    VSdetach(vdata_id);
+    Vend(file_id);
+    istat = Hclose(file_id);
+    return SUCCEED;
+}
+
+static int32
+funpack(void)
+{
+    /* read data back */
+
+    /* Open the HDF file. */
+    file_id = Hopen(FILENAME, DFACC_RDWR, 0);
+
+    /* Initialize the Vset interface. */
+    Vstart(file_id);
+    vdata_ref = VSfind(file_id, "myvdata"); 
+    if (vdata_ref == 0)  {
+         num_errs++;
+         printf(">>> VSfind failed in finding myvdata.\n");
+    }
+    vdata_id = VSattach(file_id, vdata_ref, "w");
+    if (vdata_id == FAIL) {
+         num_errs++;
+         printf(">>> VSattach failed in attaching myvdata.\n");
+    }
+    istat = VSinquire(vdata_id, &in_recs, &iil, ifields, &irec_size,
+                       NULL);
+    if (istat == FAIL) {     
+         num_errs++;     
+         printf(">>> VSinquire failed in for myvdata.\n");
+    }     
+    if ((in_recs != 2*NRECORDS) || (irec_size != rec_size)) {
+         num_errs++;
+         printf(">>> VSinquire got wrong info for myvdata.\n");
+    }
+    istat = VSsetfields(vdata_id, ifields);
+    istat = VSread(vdata_id, databuf, NRECORDS, iil);
+    pntr = databuf;
+    databufptr[0] = iident;
+    databufptr[1] = itemp;
+    databufptr[2] = ispeed;
+    databufptr[3] = iheight;
+    istat = VSfpack(vdata_id,_HDF_VSUNPACK,NULL,pntr,rec_size*NRECORDS,
+                     NRECORDS, NULL, databufptr);
+    if (istat == FAIL)  {
+         num_errs++;
+         printf(">>> VSfpack failed in unpacking 1st set.\n");
+    }
+
+    for (i=0; i<NRECORDS; i++)  
+         if ((iident[i] != (char)('A'+i)) || (fabs((double)(itemp[i] - (float32)1.11*(float32)(i+1))) > EPS) ||
+            (ispeed[i] != i) || (fabs((double)(iheight[i] - (float32)2.22*(float32)(i+1))) > EPS))  {
+            num_errs++;
+            printf(">>> Wrong data1 after VSfpack.\n");
+        }
+    /* check the second set of records */
+    istat = VSread(vdata_id, databuf, NRECORDS, iil);
+    pntr = databuf;
+    databufptr[0] = itemp;
+    databufptr[1] = iident;
+    istat = VSfpack(vdata_id, _HDF_VSUNPACK, NULL, pntr, 
+                     rec_size*NRECORDS, NRECORDS, "Temp,Ident", 
+                     databufptr);
+    if (istat == FAIL)  {
+         num_errs++;
+         printf(">>> VSfpack failed in unpacking temp & ident.\n");
+    }
+    databufptr[0] = iheight;
+    databufptr[1] = ispeed;
+    istat = VSfpack(vdata_id, _HDF_VSUNPACK, NULL, pntr, 
+                     rec_size*NRECORDS, NRECORDS, "Height,Speed", 
+                     databufptr);
+    if (istat == FAIL)  {
+         num_errs++;
+         printf(">>> VSfpack failed in unpacking height & speed.\n");
+    }
+ 
+    for (i=0; i<NRECORDS; i++)  
+         if ((iident[i] != (char)('a'+i)) || (fabs((double)(itemp[i] - (float32)3.33*(float32)(i+1))) > EPS) ||
+            (ispeed[i] != 2*i) || (fabs((double)(iheight[i] - (float32)4.44*(float32)(i+1))) > EPS))  {
+            num_errs++;
+            printf(">>> Wrong data2 after VSfpack.\n");
+        }
+         /*
+    * Terminate access to the Vdata, the Vset interface
+    * and the HDF file.
+    */
+    VSdetach(vdata_id);
+    /* buf contains only subset of vdata fields  */
+    vdata_id = VSattach(file_id, vdata_ref, "w");
+    istat = VSsetfields(vdata_id, "Height,Speed,Ident");
+    if (istat == FAIL) {
+            num_errs++;
+            printf(">>> VSsetfields failed in set 3 flds.\n");
+    }
+    istat = VSread(vdata_id, databuf, NRECORDS, FULL_INTERLACE);
+    if (istat == FAIL) {
+            num_errs++;
+            printf(">>> VSread failed in reading 3 flds.\n");
+    }
+    pntr = databuf;
+    databufptr[0] = iheight;
+    databufptr[1] = ispeed;
+    databufptr[2] = iident;
+    istat = VSfpack(vdata_id, _HDF_VSUNPACK, "Height,Speed,Ident",
+                pntr, rec_size*NRECORDS, NRECORDS, NULL, databufptr);
+    if (istat == FAIL)  {
+         num_errs++;
+         printf(">>> VSfpack failed in unpacking 1st subset.\n");
+    }
+    for (i=0; i<NRECORDS; i++)
+         if ((iident[i] != 'A'+i) || (ispeed[i] != i) || 
+              (fabs((double)(iheight[i] - (float32)2.22*(float32)(i+1))) > EPS))  {
+            num_errs++;
+            printf(">>> Wrong subset data1 after VSfpack.\n");
+        }
+    /* check the second subset of records */
+    istat = VSread(vdata_id, databuf, NRECORDS, FULL_INTERLACE);
+    pntr = databuf;
+    databufptr[0] = iident;
+    databufptr[1] = ispeed;
+    databufptr[2] = iheight;
+    istat = VSfpack(vdata_id, _HDF_VSUNPACK, "Height,Speed,Ident",
+               pntr, rec_size*NRECORDS, NRECORDS, "Ident,Speed,Height",
+               databufptr);
+    if (istat == FAIL)  {
+         num_errs++;
+         printf(">>> VSfpack failed in unpacking 2nd subset\n");
+    }
+    for (i=0; i<NRECORDS; i++)
+         if ((iident[i] != (char)('a'+i)) || (ispeed[i] != 2*i) || 
+              (fabs((double)(iheight[i] - (float32)4.44*(float32)(i+1))) > EPS)) {
+            num_errs++;
+            printf(">>> Wrong subset data2 after VSfpack.\n");
+        }
+ 
+    VSdetach(vdata_id);
+    Vend(file_id);
+    Hclose(file_id);
+    HDfree(databuf);
+    return SUCCEED;
+}
+/* main test driver */
+void
+test_vspack(void)
+{
+     
+    if (fpack() == FAIL)
+        return;
+
+    if  (funpack() == FAIL)
+        return;
+}  /* test_vspack */ 
diff --git a/hdf/test/vers.c b/hdf/test/vers.c
new file mode 100644
index 0000000..f8ee58e
--- /dev/null
+++ b/hdf/test/vers.c
@@ -0,0 +1,45 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4932 $";
+#endif
+
+/* $Id: vers.c 4932 2007-09-07 17:17:23Z bmribler $ */
+
+/*
+   ***********************************************************************
+   ** get version string from an HDF file
+   ***********************************************************************
+ */
+
+#include <stdio.h>
+#include "tproto.h"
+
+void
+test_vers(void)
+{
+    int         ret;
+    uint32      lmajor, lminor, lrelease;
+    char        lstring[81];
+
+    ret = Hgetlibversion(&lmajor, &lminor, &lrelease, lstring);
+    RESULT("Hgetlibversion");
+    MESSAGE(5, printf("Library Version\n");
+        );
+    MESSAGE(5, printf("---------------\n");
+        );
+    MESSAGE(5, printf("Major:\t\t%u\nMinor:\t\t%u\nRelease:\t%u\nString:\t\t\"%s\"\n", (unsigned) lmajor, (unsigned) lminor, (unsigned) lrelease, lstring);
+        );
+
+}
diff --git a/hdf/util/CMakeLists.txt b/hdf/util/CMakeLists.txt
new file mode 100644
index 0000000..b157e85
--- /dev/null
+++ b/hdf/util/CMakeLists.txt
@@ -0,0 +1,211 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_HDF_UTIL C CXX)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_TOOLS)
+  #-- Adding tool hdfls
+  ADD_EXECUTABLE (hdfls ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c)
+  TARGET_NAMING (hdfls ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdfls " " " ")
+  TARGET_LINK_LIBRARIES (hdfls ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdfed
+  SET (hdfed_SRCS
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/he_cntrl.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/he_disp.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/he_file.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/he_main.c
+  )
+  
+  ADD_EXECUTABLE (hdfed ${hdfed_SRCS})
+  TARGET_NAMING (hdfed ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdfed " " " ")
+  TARGET_LINK_LIBRARIES (hdfed ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_TOOLS)
+
+IF (HDF4_BUILD_UTILS)
+  #-- Adding utility hdf2gif
+  SET (hdf2gif_SRCS
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2gif.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfgifwr.c
+  )
+  
+  ADD_EXECUTABLE (hdf2gif ${hdf2gif_SRCS})
+  TARGET_NAMING (hdf2gif ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdf2gif " " " ")
+  TARGET_LINK_LIBRARIES (hdf2gif ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility gif2hdf
+  SET (gif2hdf_SRCS
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/gif2hdf.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/gif2mem.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/gifread.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/decompress.c
+      ${HDF4_HDF_UTIL_SOURCE_DIR}/writehdf.c
+ )
+  
+  ADD_EXECUTABLE (gif2hdf ${gif2hdf_SRCS})
+  TARGET_NAMING (gif2hdf ${LIB_TYPE})
+  TARGET_C_PROPERTIES (gif2hdf " " " ")
+  TARGET_LINK_LIBRARIES (gif2hdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdf24to8
+  ADD_EXECUTABLE (hdf24to8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c)
+  TARGET_NAMING (hdf24to8 ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdf24to8 " " " ")
+  TARGET_LINK_LIBRARIES (hdf24to8 ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdftor8
+  ADD_EXECUTABLE (hdftor8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c)
+  TARGET_NAMING (hdftor8 ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdftor8 " " " ")
+  TARGET_LINK_LIBRARIES (hdftor8 ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility ristosds
+  ADD_EXECUTABLE (ristosds ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c)
+  TARGET_NAMING (ristosds ${LIB_TYPE})
+  TARGET_C_PROPERTIES (ristosds " " " ")
+  TARGET_LINK_LIBRARIES (ristosds ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdfpack
+  ADD_EXECUTABLE (hdfpack ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c)
+  TARGET_NAMING (hdfpack ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdfpack " " " ")
+  TARGET_LINK_LIBRARIES (hdfpack ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility paltohdf
+  ADD_EXECUTABLE (paltohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c)
+  TARGET_NAMING (paltohdf ${LIB_TYPE})
+  TARGET_C_PROPERTIES (paltohdf " " " ")
+  TARGET_LINK_LIBRARIES (paltohdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdftopal
+  ADD_EXECUTABLE (hdftopal ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c)
+  TARGET_NAMING (hdftopal ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdftopal " " " ")
+  TARGET_LINK_LIBRARIES (hdftopal ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility r8tohdf
+  ADD_EXECUTABLE (r8tohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c)
+  TARGET_NAMING (r8tohdf ${LIB_TYPE})
+  TARGET_C_PROPERTIES (r8tohdf " " " ")
+  TARGET_LINK_LIBRARIES (r8tohdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdfcomp
+  ADD_EXECUTABLE (hdfcomp ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c)
+  TARGET_NAMING (hdfcomp ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdfcomp " " " ")
+  TARGET_LINK_LIBRARIES (hdfcomp ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility jpeg2hdf
+  ADD_EXECUTABLE (jpeg2hdf ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c)
+  TARGET_NAMING (jpeg2hdf ${LIB_TYPE})
+  TARGET_C_PROPERTIES (jpeg2hdf " " " ")
+  TARGET_LINK_LIBRARIES (jpeg2hdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdf2jpeg
+  ADD_EXECUTABLE (hdf2jpeg ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c)
+  TARGET_NAMING (hdf2jpeg ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdf2jpeg " " " ")
+  TARGET_LINK_LIBRARIES (hdf2jpeg ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdf8to24
+  ADD_EXECUTABLE (hdf8to24 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c)
+  TARGET_NAMING (hdf8to24 ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdf8to24 " " " ")
+  TARGET_LINK_LIBRARIES (hdf8to24 ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility hdfunpac
+  ADD_EXECUTABLE (hdfunpac ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c)
+  TARGET_NAMING (hdfunpac ${LIB_TYPE})
+  TARGET_C_PROPERTIES (hdfunpac " " " ")
+  TARGET_LINK_LIBRARIES (hdfunpac ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility vmake
+  ADD_EXECUTABLE (vmake ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c)
+  TARGET_NAMING (vmake ${LIB_TYPE})
+  TARGET_C_PROPERTIES (vmake " " " ")
+  TARGET_LINK_LIBRARIES (vmake ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+
+  #-- Adding utility vshow
+  ADD_EXECUTABLE (vshow ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c)
+  TARGET_NAMING (vshow ${LIB_TYPE})
+  TARGET_C_PROPERTIES (vshow " " " ")
+  TARGET_LINK_LIBRARIES (vshow ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_UTILS)
+
+IF (BUILD_TESTING AND HDF4_BUILD_UTILS)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING AND HDF4_BUILD_UTILS)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+IF (HDF4_BUILD_TOOLS)
+  INSTALL_PROGRAM_PDB (hdfls ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+  INSTALL_PROGRAM_PDB (hdfed ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+
+  INSTALL (
+      TARGETS
+          hdfls
+          hdfed
+      RUNTIME DESTINATION
+          ${HDF4_INSTALL_TOOLS_BIN_DIR}
+      COMPONENT
+          toolsapplications
+  )
+ENDIF (HDF4_BUILD_TOOLS)
+
+IF (HDF4_BUILD_UTILS)
+  INSTALL_PROGRAM_PDB (gif2hdf ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdf2gif ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdf2jpeg ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdf24to8 ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdf8to24 ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdfcomp ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdfpack ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdftopal ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdftor8 ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (hdfunpac ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (jpeg2hdf ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (paltohdf ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (r8tohdf ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (ristosds ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (vmake ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  INSTALL_PROGRAM_PDB (vshow ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
+  
+  INSTALL (
+      TARGETS
+          gif2hdf
+          hdf2gif
+          hdf2jpeg
+          hdf24to8
+          hdf8to24
+          hdfcomp
+          hdfpack
+          hdftopal
+          hdftor8
+          hdfunpac
+          jpeg2hdf
+          paltohdf
+          r8tohdf
+          ristosds
+          vmake
+          vshow
+      RUNTIME DESTINATION
+          ${HDF4_INSTALL_UTILS_BIN_DIR}
+      COMPONENT
+          utilsapplications
+  )
+ENDIF (HDF4_BUILD_UTILS)
diff --git a/hdf/util/CMakeTests.cmake b/hdf/util/CMakeTests.cmake
new file mode 100644
index 0000000..fa30f4d
--- /dev/null
+++ b/hdf/util/CMakeTests.cmake
@@ -0,0 +1,486 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+  
+##############################################################################
+# --------------------------------------------------------------------
+# Copy all the files from the test directory into the source directory
+# --------------------------------------------------------------------
+##############################################################################
+
+IF (HDF4_BUILD_TOOLS)
+  #-- Copy all the hdfls data files from the source directory into the test directory
+  SET (HDF4_LS_TEST_FILES
+      hdfcomp.out1.1
+      hdfcomp.out1.2
+      hdfed.input1
+#      hdfed.out1
+      hdfpack.out1.1
+      hdfpack.out1.2
+      hdftor8.out1
+      jpeg2hdf.out1
+      ristosds.input1
+      ristosds.out1
+  )
+  
+  FOREACH (h4_file ${HDF4_LS_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfls
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_LS_TEST_FILES})
+  
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfls
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfed-w.out1 ${PROJECT_BINARY_DIR}/hdfed.out1
+    )
+  ELSE (WIN32 AND NOT CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfls
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfed.out1 ${PROJECT_BINARY_DIR}/hdfed.out1
+    )
+  ENDIF (WIN32 AND NOT CYGWIN)
+
+  #-- Copy all the hdfed data files from the source directory into the test directory
+  SET (HDF4_HDFED_TEST_FILES
+      storm110.hdf
+      ntcheck.hdf
+  )
+  FOREACH (h4_file ${HDF4_HDFED_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfed
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_HDFED_TEST_FILES})
+ENDIF (HDF4_BUILD_TOOLS)
+
+  #-- Copy all the hdf2gif data files from the source directory into the test directory
+  SET (HDF4_HDF2GIF_TEST_FILES
+      skull.hdf
+  )
+  FOREACH (h4_file ${HDF4_HDF2GIF_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdf2gif
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_HDF2GIF_TEST_FILES})
+
+  #-- Copy all the gif2hdf data files from the source directory into the test directory
+  SET (HDF4_GIF2HDF_TEST_FILES
+      SunWheel.gif
+      bttrfly.gif
+  )
+  FOREACH (h4_file ${HDF4_GIF2HDF_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     gif2hdf
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_GIF2HDF_TEST_FILES})
+
+  #-- Copy all the hdftor8 data files from the source directory into the test directory
+  SET (HDF4_HDFTOR8_TEST_FILES
+      head.r24
+      head.r8
+  )
+  FOREACH (h4_file ${HDF4_HDFTOR8_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdftor8
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_HDFTOR8_TEST_FILES})
+
+  #-- Copy all the ristosds data files from the source directory into the test directory
+  SET (HDF4_RISTOSDS_TEST_FILES
+      storm110.hdf
+      storm120.hdf
+      storm130.hdf
+  )
+  FOREACH (h4_file ${HDF4_RISTOSDS_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     ristosds
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_RISTOSDS_TEST_FILES})
+
+  #-- Copy all the hdfpack data files from the source directory into the test directory
+  SET (HDF4_HDFPACK_TEST_FILES
+      test.hdf
+  )
+  FOREACH (h4_file ${HDF4_HDFPACK_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfpack
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_HDFPACK_TEST_FILES})
+
+  #-- Copy all the paltohdf data files from the source directory into the test directory
+  SET (HDF4_PALTOHDF_TEST_FILES
+      palette.raw
+  )
+  FOREACH (h4_file ${HDF4_PALTOHDF_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     paltohdf
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_PALTOHDF_TEST_FILES})
+
+  #-- Copy all the r8tohdf data files from the source directory into the test directory
+  SET (HDF4_R8TOHDF_TEST_FILES
+      storm110.raw
+      storm120.raw
+      storm130.raw
+      storm140.raw
+  )
+  FOREACH (h4_file ${HDF4_R8TOHDF_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     r8tohdf
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_R8TOHDF_TEST_FILES})
+
+  #-- Copy all the hdfcomp data files from the source directory into the test directory
+  SET (HDF4_HDFCOMP_TEST_FILES
+      storm110.hdf
+      storm120.hdf
+      storm130.hdf
+  )
+  FOREACH (h4_file ${HDF4_HDFCOMP_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfcomp
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_HDFCOMP_TEST_FILES})
+
+  #-- Copy all the jpeg2hdf data files from the source directory into the test directory
+  SET (HDF4_JPEG2HDF_TEST_FILES
+      jpeg_img.jpg
+  )
+  FOREACH (h4_file ${HDF4_JPEG2HDF_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     jpeg2hdf
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_JPEG2HDF_TEST_FILES})
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S  M A C R O S                               ###
+##############################################################################
+##############################################################################
+
+IF (HDF4_BUILD_TOOLS)
+  MACRO (ADD_LS_TEST_NOL testfile resultfile resultcode)
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HDFLS_NOL-${testfile} COMMAND $<TARGET_FILE:hdfls> ${testfile})
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HDFLS_NOL-${testfile}
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdfls>"
+              -D "TEST_ARGS:STRING=${testfile}"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+              -D "TEST_OUTPUT=${testfile}.tmp"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_FILTER:STRING=(File library|String)[^\n]+\n"
+              -D "TEST_REFERENCE=${resultfile}"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDFLS_NOL-${testfile} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDFLS_NOL-${testfile} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "HDFLS_NOL-${testfile}")
+  ENDMACRO (ADD_LS_TEST_NOL)
+
+  MACRO (ADD_LS_TEST testfile resultfile resultcode)
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HDFLS-${testfile} COMMAND $<TARGET_FILE:hdfls> -l ${testfile})
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HDFLS-${testfile}
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdfls>"
+              -D "TEST_ARGS:STRING=-l;${testfile}"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+              -D "TEST_OUTPUT=${testfile}.tmp"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_FILTER:STRING=(File library|String)[^\n]+\n"
+              -D "TEST_REFERENCE=${resultfile}"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDFLS-${testfile} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDFLS-${testfile} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "HDFLS-${testfile}")
+  ENDMACRO (ADD_LS_TEST)
+
+  MACRO (ADD_H4_TEST_ED testfile resultfile resultcode)
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HEDIT-${testfile} COMMAND $<TARGET_FILE:hdfed> -batch)
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HEDIT-${testfile}
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdfed>"
+              -D "TEST_ARGS:STRING=-batch"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+              -D "TEST_INPUT=${testfile}"
+              -D "TEST_OUTPUT=${testfile}.tmp"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_REFERENCE=${resultfile}"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HEDIT-${testfile} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HEDIT-${testfile} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "HEDIT-${testfile}")
+  ENDMACRO (ADD_H4_TEST_ED)
+ENDIF (HDF4_BUILD_TOOLS)
+
+  MACRO (ADD_H4_TEST testname testfile)
+    ADD_TEST (NAME ${testname} COMMAND $<TARGET_FILE:${testfile}> ${ARGN})
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (${testname} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (${testname} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "${testname}")
+  ENDMACRO (ADD_H4_TEST)
+
+  MACRO (ADD_CMP_TEST testname reffile testfile)
+    ADD_TEST (NAME ${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${reffile} ${testfile})
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (${testname} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (${testname} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "${testname}")
+  ENDMACRO (ADD_CMP_TEST)
+
+  MACRO (ADD_H4Q_TEST testname testfile)
+    ADD_TEST (NAME ${testname} COMMAND $<TARGET_FILE:${testfile}> ${ARGN} > /dev/null 2>&1)
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (${testname} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (${testname} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "${testname}")
+  ENDMACRO (ADD_H4Q_TEST)
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME hdfgif-clear-refs
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          skull.gif
+          SunWheel.hdf
+          bttrfly.hdf
+          head8.hdf
+          img001-263.328
+          hdfed.input1.tmp
+          hdfed.input1.tmp.err
+          storm.hdf
+          ristosds.input1.tmp
+          ristosds.input1.tmp.err
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfgif-clear-refs PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfgif-clear-refs PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "hdfgif-clear-refs")
+
+  ADD_H4_TEST (testhdf2gif hdf2gif skull.hdf skull.gif)
+  ADD_H4_TEST (testgif2hdf-sunwheel gif2hdf SunWheel.gif SunWheel.hdf)
+  ADD_H4_TEST (testgif2hdf-butterfly gif2hdf bttrfly.gif bttrfly.hdf)
+
+  ADD_H4_TEST (testhdf24to8 hdf24to8 head.r24 head8.hdf)
+  ADD_H4_TEST (testhdftor8 hdftor8 head8.hdf)
+  ADD_CMP_TEST (hdfr8comp img001-263.328 head.r8)
+
+  IF (HDF4_BUILD_TOOLS)
+    ADD_H4_TEST_ED (hdfed.input1 hdfed.out1 0)
+  ENDIF (HDF4_BUILD_TOOLS)
+
+  ADD_H4Q_TEST (testristosds ristosds storm110.hdf storm120.hdf storm130.hdf -o storm.hdf)
+  IF (HDF4_BUILD_TOOLS)
+    ADD_H4_TEST_ED (ristosds.input1 ristosds.out1 0)
+  ENDIF (HDF4_BUILD_TOOLS)
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME hdfpack-clear-refs
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          test.pck
+          test.blk
+          test.hdf.tmp
+          test.hdf.tmp.err
+          test.pck.tmp
+          test.pck.tmp.err
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfpack-clear-refs PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfpack-clear-refs PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "hdfpack-clear-refs")
+
+  ADD_H4_TEST (testhdfpack hdfpack test.hdf test.pck)
+  ADD_H4_TEST (testhdfpack-block hdfpack -b test.hdf test.blk)
+  IF (HDF4_BUILD_TOOLS)
+    ADD_LS_TEST_NOL (test.hdf hdfpack.out1.1 0)
+    ADD_LS_TEST_NOL (test.pck hdfpack.out1.2 0)
+  ENDIF (HDF4_BUILD_TOOLS)
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME hdfpalette-clear-refs
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          pal001
+          pal005
+          palette.hdf
+          palette.raw.new
+          storm.hdf
+          storm.hdf.tmp
+          storm.hdf.tmp.err
+          img001-057.057
+          img002-057.057
+          img003-057.057
+          img004-057.057
+          img005-057.057
+          allstorms.hdf
+          allstorms.hdf.tmp
+          allstorms.hdf.tmp.err
+          allcomp.hdf
+          allcomp.hdf.tmp
+          allcomp.hdf.tmp.err
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfpalette-clear-refs PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfpalette-clear-refs PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "hdfpalette-clear-refs")
+
+  ADD_H4_TEST (testpaltohdf paltohdf palette.raw palette.hdf)
+  ADD_H4_TEST (testhdftopal hdftopal palette.hdf palette.raw.new)
+  ADD_CMP_TEST (palettecomp palette.raw palette.raw.new)
+
+  ADD_H4_TEST (testr8tohdf-storm r8tohdf 57 57 storm.hdf storm110.raw storm120.raw storm130.raw storm140.raw)
+  ADD_H4_TEST (testr8tohdf-palette r8tohdf 57 57 storm.hdf -p palette.raw -i storm110.raw)
+  ADD_H4_TEST (testhdftor8-storm hdftor8 storm.hdf)
+  IF (HDF4_BUILD_TOOLS)
+    ADD_LS_TEST (storm.hdf hdftor8.out1 0)
+  ENDIF (HDF4_BUILD_TOOLS)
+
+  ADD_CMP_TEST (storm110comp img001-057.057  storm110.raw)
+  ADD_CMP_TEST (storm120comp img002-057.057  storm120.raw)
+  ADD_CMP_TEST (storm130comp img003-057.057  storm130.raw)
+  ADD_CMP_TEST (storm140comp img004-057.057  storm140.raw)
+
+  ADD_H4_TEST (testhdfcomp-storms hdfcomp allstorms.hdf storm110.hdf storm120.hdf storm130.hdf)
+  ADD_H4_TEST (testhdfcomp hdfcomp allcomp.hdf -c storm110.hdf storm120.hdf storm130.hdf)
+  IF (HDF4_BUILD_TOOLS)
+    ADD_LS_TEST (allstorms.hdf hdfcomp.out1.1 0)
+    ADD_LS_TEST (allcomp.hdf hdfcomp.out1.2 0)
+  ENDIF (HDF4_BUILD_TOOLS)
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME hdfjpeg-clear-refs
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          jpeg.hdf
+          jpeg.hdf.tmp
+          jpeg.hdf.tmp.err
+          jpeg2.jpg
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfjpeg-clear-refs PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfjpeg-clear-refs PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "hdfjpeg-clear-refs")
+
+  ADD_H4_TEST (testjpeg2hdf jpeg2hdf jpeg_img.jpg jpeg.hdf)
+  ADD_H4_TEST (testhdf2jpeg hdf2jpeg jpeg.hdf jpeg2.jpg)
+  IF (HDF4_BUILD_TOOLS)
+    ADD_LS_TEST (jpeg.hdf jpeg2hdf.out1 0)
+  ENDIF (HDF4_BUILD_TOOLS)
+  ADD_CMP_TEST (jpeg2comp jpeg_img.jpg jpeg2.jpg)
+
+#  ADD_H4_TEST (hdf8to24 hdf8to24)
+
+#  ADD_H4_TEST (hdfunpac hdfunpac)
+
+#  ADD_H4_TEST (vmake vmake)
+
+#  ADD_H4_TEST (vshow vshow)
diff --git a/hdf/util/HELINK.OPT b/hdf/util/HELINK.OPT
new file mode 100644
index 0000000..eba99f8
--- /dev/null
+++ b/hdf/util/HELINK.OPT
@@ -0,0 +1,2 @@
+sys$common:[syslib]tpushr/share
+
diff --git a/hdf/util/MacProjects/PalToHDF.project.hqx b/hdf/util/MacProjects/PalToHDF.project.hqx
new file mode 100644
index 0000000..f541cc3
--- /dev/null
+++ b/hdf/util/MacProjects/PalToHDF.project.hqx
@@ -0,0 +1,871 @@
+(This file must be converted with BinHex 4.0)
+
+:%&"KE&4[5%4',R"bEfTPBh3!68e3FN0A588!!!!!SQB!!!!!qf4MEfpX!!!!!J!
+!!#J!!*c#!!#FkJ!!"A`!!!!f!3!!!!!!!!!!!!!!!!!!3J!!!%-!!!"%!!!!43!
+!!$i!!!""!!!!4J!!!%F!!!")!!!!23!!!%!!!!"*!!!!9!!!!&8!!!"@!!!!5J!
+!!%X!!!"-!!!!63!!!%i!!!"2!!!!8!!!!&%!!!"5!!!!8`!!!$m!!!"A!!!!@!!
+!!&N!!!"D!!!!"3!!!!B!!!!(!!!!#!!!!!%!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!+Z!!!!!j`FQ9Q!"Hp,!!!!1d!!!!!!!!!!"#Z!!!
+!aR"bC at B!'"#h!!!!lJ!!!!!!!!!!#XB!!!!iF(*PCJ!AF0S!!!$[!!!!!!!!!!!
++rJ!!!!a`FQ9Q!"Fla3!!!2!!!!!!!!!!!%)+!!!"fR"bC at B!&b%'!!!!m3!!!!!
+!!!!!#`S!!!!-F(*PCJ!A23X!!!$b!!!!!!!!!!!fi`!!!'*`FQ9Q!"I9VJ!!!2-
+!!!!!!!!!!!X@!!!!1("bC at B!&jX#!!!!p!!!!!!!!!!!#di!!!!0F(*PCJ!AU8m
+!!!$e!!!!!!!!!!!,@`!!!"4`FQ9Q!"He(!!!!2B!!!!!!!!!!!`Y!!!!#R"bC at B
+!&fJ'!!!!p`!!!!!!!!!!1eB!!!$%F(*PCJ!ATX!!!!$i!!!!!!!!!!"$j!!!!4C
+`FQ9Q!"H5DJ!!!2N!!!!!!!!!!%6k!!!!ZR"bC at B!&jbq!!!!qJ!!!!!!!!!!%A3
+!!!!ZF(*PCJ!APpJ!!!$l!!!!!!!!!!"([J!!!Ja`FQ9Q!"IZ%3!!!2`!!%qI!!!
+:
diff --git a/hdf/util/MacProjects/R8ToHDF.project.hqx b/hdf/util/MacProjects/R8ToHDF.project.hqx
new file mode 100644
index 0000000..ae63390
--- /dev/null
+++ b/hdf/util/MacProjects/R8ToHDF.project.hqx
@@ -0,0 +1,1001 @@
+(This file must be converted with BinHex 4.0)
+
+:$e)i9'p)4%BZF(*[DQ9MG!"069"b3eG*43!!!!#keJ!!!!"ZAf0[Ef`!!!!#!!!
+!+!!!Y6)!!,9D!!!&I!!!!$B"!!!!!!!!!!!!!!!!!!"#!!!!3`!!!%3!!!"&!!!
+!2J!!!%%!!!"'!!!!4`!!!%J!!!!p!!!!3!!!!%N!!!"8!!!!93!!!&B!!!"+!!!
+!5`!!!%`!!!"0!!!!6J!!!%m!!!"3!!!!83!!!&)!!!"6!!!!2`!!!&F!!!"B!!!
+!@3!!!&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9
+Q!"QL%3!!!4)!!!!!!!!!!%)+!!!#$("bC at B!'IB2!!!"%`!!Pf!!!!:
diff --git a/hdf/util/MacProjects/RISToHDF.project.hqx b/hdf/util/MacProjects/RISToHDF.project.hqx
new file mode 100644
index 0000000..8abac06
--- /dev/null
+++ b/hdf/util/MacProjects/RISToHDF.project.hqx
@@ -0,0 +1,964 @@
+(This file must be converted with BinHex 4.0)
+
+:%&**8e4[5%4',R"bEfTPBh3!68e3FN0A588!!!!!XqB!!!!!&HpMEfpX!!!!!J!
+!!#J!!+j#!!#ZDJ!!"A`!!!!f!3!!!!!!!!!!!!!!!!!!3J!!!%-!!!"%!!!!43!
+!!$i!!!""!!!!4J!!!%F!!!")!!!!23!!!%!!!!"*!!!!9!!!!&8!!!"@!!!!5J!
+!!%X!!!"-!!!!63!!!%i!!!"2!!!!8!!!!&%!!!"5!!!!8`!!!$m!!!"A!!!!@!!
+!!&N!!!"D!!!!"3!!!!B!!!!(!!!!#!!!!!%!!!!%!!!!#3!!!!S!!!!,!!!!!!!
+!!!-!!!!-!!!!$3!!!!i!!!!2!!!!%!!!!"%!!!!5!!!!%`!!!"3!!!!9!!!!&J!
+!!"F!!!!B!!!!'3!!!!)!!!!D!!!!'`!!!"`!!!!G!!!!*!!!!#8!!!!Q!!!!*`!
+!!#!!!!!M!!!!+!!!!#N!!!!U!!!!(`!!!#)!!!!V!!!!,!!!!#d!!!!Z!!!!,`!
+!!$!!!!!a!!!!-J!!!$-!!!!d!!!!03!!!$B!!!!h!!!!1!!!!#%!!!!j!!!!1J!
+!!$X!!!!m!!!!G`!!!(J!!!"j!!!!HJ!!!(-!!!"f!!!!H`!!!(`!!!"p!!!!FJ!
+!!(8!!!"q!!!!I`!!!)!!!!#"!!!!JJ!!!)-!!!#%!!!!K3!!!)B!!!#(!!!!L!!
+!!(3!!!#1!!!!M`!!!*!!!!!!N3!!!)S!!!#0!!!!NJ!!!*-!!!#8!!!!L3!!!)`
+!!!#9!!!!PJ!!!*F!!!#B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3b!!!!#kF(*PCJ!
+C9Q`!!!%S!!!!!!!!!!"$fJ!!!#j`FQ9Q!"Q)MJ!!!5N!!!!!!!!!!%3)!!!#$("
+bC at B!'HG,!!!"+J!!pN8!!!:
diff --git a/hdf/util/MacProjects/fp2hdf.project.hqx b/hdf/util/MacProjects/fp2hdf.project.hqx
new file mode 100644
index 0000000..7ed4352
--- /dev/null
+++ b/hdf/util/MacProjects/fp2hdf.project.hqx
@@ -0,0 +1,780 @@
+(This file must be converted with BinHex 4.0)
+
+:$QC`-QKNCLj`FQpUC at 0d!%e08(*$9dP&!!!!!*&Q!!!!!0$BBfp[E!!!!!)!!!!
+S!!#,`J!!LqS!!!9m!!!!0J%!!!!!!!!!!!!!!!!!!!!!!!!"Bb4#3J!!!#%!!!!
+#!!!!!!!!!$m!!!!$FfJ)8!!!!'!!!!!%!fRZd!!!!(m!!!!&#N&NC!!!!*d!!!!
+'8'PZ8J!!!,S!!!!(B9"[D3!!!0`!!!!)68PdC3!!!2J!!!!*G&*PF`!!!48!!!!
++6 at 9ZG3!!!68!!!!,G%0[EJ!!!98!!!!-3fpZG!!!!@d!!!!0Eh0P3`!!!BX!!!!
+1D at aX3`!!!DJ!!!!28fK[G`!!!FB!!!!35'PNC3!!!Gm!!!!46 at pfC3!!!J)!!!!
+54f9d3`!!!L-!!!!6CA4$8J!!!N3!!!!8HQ9$E`!!!Q%!!!!9E'PdC3!!!S-!!!!
+ at 4f9d3`!!!Tm!!!!AG%08D3!!!VJ!!!!BG'a at B3!!!Y8!!!!CD at j$G!!!![-!!!!
+D3h4X#`!!!a%!!!!EE(9P#3!!!c%!!!!FE!P6C3!!!di!!!!G9'9cG!!!!fS!!!!
+H4(*KC`!!!iF!!!!I9(*KB`!!!jN!!!!J$%4bB3!!!lS!!!!K!!!"J!!!!pJ!!!!
+L!!!!"J!!!rN!!!!MVhK&A`!!""J!!!!N!!!!!!!!"$B!!!!P!!!!!!!!"&-!!!!
+Q!!!!!!!!"(8!!!!R!!!!!!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!0F(*PCJ!3l4i!!!##!!!!!!!!!!!4GJ!!!"4`FQ9Q!"#KE3!!!)-!!!!!!!!
+!!!RV!!!!#R"bC at B!%&S9!!!!K!!!!!!!!!!!0Ki!!!$%F(*PCJ!3HqB!!!#&!!!
+!!!!!!!!l9J!!!4C`FQ9Q!""r'J!!!)B!!!!!!!!!!%2N!!!!ZR"bC at B!%,m4!!!
+!K`!!!!!!!!!!%BS!!!!ZF(*PCJ!3+Ki!!!#)!!!!!!!!!!"%RJ!!!Ja`FQ9Q!""
+VcJ!!!)N!!,Lm!!!:
diff --git a/hdf/util/MacProjects/hdf24to8.project.hqx b/hdf/util/MacProjects/hdf24to8.project.hqx
new file mode 100644
index 0000000..d4b3023
--- /dev/null
+++ b/hdf/util/MacProjects/hdf24to8.project.hqx
@@ -0,0 +1,780 @@
+(This file must be converted with BinHex 4.0)
+
+:%'KNCM)dG'mi,R"bEfTPBh3!68e3FN0A588!!!!!N at B!!!!!bY&MEfpX!!!!!J!
+!!#J!!)[#!!#,kJ!!"A`!!!!f!3!!!!!!!!!!!!!!!!!!!!!!!!&M*%*#!!!!)3!
+!!!)!!!!!!!!!2`!!!!0cD!K3!!!!B!!!!!3$DHl3!!!!I`!!!!8+3 at 4N!!!!R3!
+!!!C3D at j5!!!!ZJ!!!!GK8'pT!!!!h!!!!!K05A4P!!!!q!!!!!Pd8Q9c!!!"&3!
+!!!T0C at je!!!"03!!!!Yd3fpZ!!!"93!!!!a$Efjd!!!"E3!!!!e[Ff9$!!!"L`!
+!!!jTE'a$!!!"U!!!!!p6D'ph!!!"aJ!!!"")D at 4P!!!"h`!!!"&0EhCP!!!#!J!
+!!"*(CA4$!!!#)`!!!"0PG%05!!!#4!!!!"4kC80[!!!#B3!!!"9XDA4P!!!#J`!
+!!"C(CA4$!!!#R`!!!"Gd3e4T!!!#Z!!!!"KdE&CK!!!#e3!!!"PTEN0d!!!#m`!
+!!"T$G'`,!!!$%3!!!"YXG at 8*!!!$-3!!!"aX#90P!!!$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!62SF!!!#5!!!!!!!!!!!,f!!!!$K`FQ9
+Q!"-Xq3!!!*-!!!!!!!!!!!R'!!!!$("bC at B!%VKI!!!!P!!!!!!!!!!!4li!!!(
+DF(*PCJ!64C`!!!#9!!!!!!!!!!!*dJ!!!!a`FQ9Q!",K'`!!!*B!!!!!!!!!!"%
+8!!!!BR"bC at B!%h4S!!!!P`!!!!!!!!!!$"!!!!!iF(*PCJ!6$'F!!!#B!!!!!!!
+!!!!*hJ!!!!e`FQ9Q!"-4d!!!!*N!!!!!!!!!!"&f!!!!&("bC at B!%eq"!!!!QJ!
+!!!!!!!!!#HX!!!!+F(*PCJ!5j5S!!!#E!!!!!!!!!!!ef!!!!-4`FQ9Q!",i'!!
+!!*`!!!!!!!!!!$Y@!!!"&R"bC at B!%XH%!!!!R3!!!!!!!!!!0T`!!!#kF(*PCJ!
+5M%J!!!#H!!!!!!!!!!!4LJ!!!#j`FQ9Q!"+Pc3!!!*m!!!!!!!!!!%rB!!!#$("
+bC at B!%[&C!!!!S!!!`'X!!!:
diff --git a/hdf/util/MacProjects/hdfcomp.project.hqx b/hdf/util/MacProjects/hdfcomp.project.hqx
new file mode 100644
index 0000000..cd62aef
--- /dev/null
+++ b/hdf/util/MacProjects/hdfcomp.project.hqx
@@ -0,0 +1,807 @@
+(This file must be converted with BinHex 4.0)
+
+:$fKNCQ0[EA!ZF(*[DQ9MG!"069"b3eG*43!!!!#@CJ!!!!"'I at 0[Ef`!!!!#!!!
+!+!!!N!$#!!#3!1S!!!9m!!!!0J%!!!!!!!!!!!!!!!!!!!!!!!!"Bb4#3J!!!#%
+!!!!#!!!!!!!!!$m!!!!$FfJ)8!!!!'!!!!!%!fRZd!!!!(m!!!!&#N&NC!!!!*d
+!!!!'8'PZ8J!!!,S!!!!(B9"[D3!!!0`!!!!)68PdC3!!!2J!!!!*G&*PF`!!!48
+!!!!+6 at 9ZG3!!!68!!!!,G%0[EJ!!!98!!!!-3fpZG!!!!@d!!!!0Eh0P3`!!!BX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`FQ9Q!"1I#!!!!,B!!!!!!!!!!%Hq!!!#$("bC at B!%caU!!!!Y`!!ST8!!!:
+
diff --git a/hdf/util/MacProjects/hdfed.project.hqx b/hdf/util/MacProjects/hdfed.project.hqx
new file mode 100644
index 0000000..94496ec
--- /dev/null
+++ b/hdf/util/MacProjects/hdfed.project.hqx
@@ -0,0 +1,780 @@
+(This file must be converted with BinHex 4.0)
+
+:$@KNCQ9N,R"bEfTPBh3!68e3FN0A588!!!!!N at B!!!!!HrCMEfpX!!!!!J!!!#J
+!!)[#!!#,kJ!!"A`!!!!f!3!!!!!!!!!!!!!!!!!!!!!!!!&M*%*#!!!!)3!!!!)
+!!!!!!!!!2`!!!!0cD!K3!!!!B!!!!!3$DHl3!!!!I`!!!!8+3 at 4N!!!!R3!!!!C
+3D at j5!!!!ZJ!!!!GK8'pT!!!!h!!!!!K05A4P!!!!q!!!!!Pd8Q9c!!!"&3!!!!T
+0C at je!!!"03!!!!Yd3fpZ!!!"93!!!!a$Efjd!!!"E3!!!!e[Ff9$!!!"L`!!!!j
+TE'a$!!!"U!!!!!p6D'ph!!!"aJ!!!"")D at 4P!!!"h`!!!"&0EhCP!!!#!J!!!"*
+(CA4$!!!#)`!!!"0PG%05!!!#4!!!!"4kC80[!!!#B3!!!"9XDA4P!!!#J`!!!"C
+(CA4$!!!#R`!!!"Gd3e4T!!!#Z!!!!"KdE&CK!!!#e3!!!"PTEN0d!!!#m`!!!"T
+$G'`,!!!$%3!!!"YXG at 8*!!!$-3!!!"aX#90P!!!$6J!!!"e8CA0d!!!$DJ!!!"j
+%FQ&R!!!$K`!!!"p8FQ&M!!!$Q3!!!#!-4(*K!!!$ZJ!!!#%!!!'!!!!$f!!!!#)
+!!!!'!!!$q3!!!#1[H%9I!!!%'!!!!#3!!!!!!!!%0J!!!#8!!!!!!!!%8`!!!#B
+!!!!!!!!%G3!!!#F!!!!!!!!%N3!!!#J!!!!!!!!%VJ!!!#N!!!!!!!!%cJ!!!#S
+!!!!!!!!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!!!!J`!!!!!!!!!
+!#FB!!!!+F(*PCJ!D)d!!!!#%!!!!!!!!!!!f(J!!!-4`FQ9Q!"R[X3!!!)8!!!!
+!!!!!!%2N!!!"&R"bC at B!'KV*!!!!KJ!!!!!!!!!!1mB!!!#kF(*PCJ!D2Nd!!!#
+(!!!!!!!!!!!4GJ!!!#j`FQ9Q!"Ucm!!!!)J!!!!!!!!!!%6k!!!#$("bC at B!'X6
+I!!!!L3!!bfX!!!:
diff --git a/hdf/util/MacProjects/hdfls.project.hqx b/hdf/util/MacProjects/hdfls.project.hqx
new file mode 100644
index 0000000..dedd8d0
--- /dev/null
+++ b/hdf/util/MacProjects/hdfls.project.hqx
@@ -0,0 +1,780 @@
+(This file must be converted with BinHex 4.0)
+
+:$@KNCQac,R"bEfTPBh3!68e3FN0A588!!!!!N at B!!!!!kLPMEfpX!!!!!J!!!#J
+!!)[#!!#,kJ!!"A`!!!!f!3!!!!!!!!!!!!!!!!!!!!!!!!&M*%*#!!!!)3!!!!)
+!!!!!!!!!2`!!!!0cD!K3!!!!B!!!!!3$DHl3!!!!I`!!!!8+3 at 4N!!!!R3!!!!C
+3D at j5!!!!ZJ!!!!GK8'pT!!!!h!!!!!K05A4P!!!!q!!!!!Pd8Q9c!!!"&3!!!!T
+0C at je!!!"03!!!!Yd3fpZ!!!"93!!!!a$Efjd!!!"E3!!!!e[Ff9$!!!"L`!!!!j
+TE'a$!!!"U!!!!!p6D'ph!!!"aJ!!!"")D at 4P!!!"h`!!!"&0EhCP!!!#!J!!!"*
+(CA4$!!!#)`!!!"0PG%05!!!#4!!!!"4kC80[!!!#B3!!!"9XDA4P!!!#J`!!!"C
+(CA4$!!!#R`!!!"Gd3e4T!!!#Z!!!!"KdE&CK!!!#e3!!!"PTEN0d!!!#m`!!!"T
+$G'`,!!!$%3!!!"YXG at 8*!!!$-3!!!"aX#90P!!!$6J!!!"e8CA0d!!!$DJ!!!"j
+%FQ&R!!!$K`!!!"p8FQ&M!!!$Q3!!!#!-4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(*PCJ!
+&PpB!!!"R!!!!!!!!!!!-$J!!!!a`FQ9Q!!9'e!!!!'J!!!!!!!!!!"$S!!!!BR"
+bC at B!"25Y!!!!D3!!!!!!!!!!%8S!!!!iF(*PCJ!&5k3!!!"U!!!!!!!!!!!-'J!
+!!!e`FQ9Q!!6C+J!!!'X!!!!!!!!!!!`R!!!!&("bC at B!"4ZC!!!!E!!!!!!!!!!
+!$$X!!!!+F(*PCJ!&Uhd!!!"Y!!!!!!!!!!!imJ!!!-4`FQ9Q!!9@#3!!!'i!!!!
+!!!!!!$Qf!!!"&R"bC at B!"6dY!!!!E`!!!!!!!!!!1X`!!!#kF(*PCJ!&-eJ!!!"
+`!!!!!!!!!!!4JJ!!!#j`FQ9Q!!6,J3!!!(%!!!!!!!!!!%)+!!!#$("bC at B!"@l
+B!!!!FJ!!hHF!!!:
diff --git a/hdf/util/MacProjects/hdfpack.project.hqx b/hdf/util/MacProjects/hdfpack.project.hqx
new file mode 100644
index 0000000..ca7bb92
--- /dev/null
+++ b/hdf/util/MacProjects/hdfpack.project.hqx
@@ -0,0 +1,817 @@
+(This file must be converted with BinHex 4.0)
+
+:$fKNCR"KBfXZF(*[DQ9MG!"069"b3eG*43!!!!#BFJ!!!!!4"'0[Ef`!!!!#!!!
+!+!!!NXi!!*,f!!!&I!!!!$B"!!!!!!!!!!!!!!!!!!!!!!!!!@-N3N)!!!!K!!!
+!!J!!!!!!!!!r!!!!!h0S#&!!!!"J!!!!"!0TlY!!!!"r!!!!"3T"C'3!!!#G!!!
+!"P"TEP)!!!#k!!!!"f&3EfN!!!$F!!!!#%e*G'8!!!$i!!!!#A45CA-!!!%9!!!
+!#NePER8!!!%e!!!!#h4$Efi!!!&9!!!!$%0[ER3!!!&Y!!!!$@pcC8-!!!',!!!
+!$QPXE%-!!!'S!!!!$e0SEhF!!!('!!!!%%KTC'8!!!(I!!!!%8e[GQ8!!!)#!!!
+!%NGPG%-!!!)M!!!!%f9d3e)!!!*%!!!!&(TP3fm!!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!!,R"bC at B
+!%l(@!!!!c3!!!!!!!!!!N!$U!!!#$("bC at B!%pVa!!!!cJ!!Rjd!!!:
diff --git a/hdf/util/MacProjects/hdftoR8.project.hqx b/hdf/util/MacProjects/hdftoR8.project.hqx
new file mode 100644
index 0000000..974f3f0
--- /dev/null
+++ b/hdf/util/MacProjects/hdftoR8.project.hqx
@@ -0,0 +1,870 @@
+(This file must be converted with BinHex 4.0)
+
+:$fKNCR4[8MJZF(*[DQ9MG!"069"b3eG*43!!!!#LCJ!!!!!$5f0[Ef`!!!!#!!!
+!+!!!R-)!!*cU!!!&I!!!!$B"!!!!!!!!!!!!!!!!!!"#!!!!3`!!!%3!!!"&!!!
+!2J!!!%%!!!"'!!!!4`!!!%J!!!!p!!!!3!!!!%N!!!"8!!!!93!!!&B!!!"+!!!
+!5`!!!%`!!!"0!!!!6J!!!%m!!!"3!!!!83!!!&)!!!"6!!!!2`!!!&F!!!"B!!!
+!@3!!!&S!!!!&!!!!"J!!!!F!!!!)!!!!!3!!!!3!!!!*!!!!#J!!!!X!!!!!!!!
+!!`!!!!`!!!!0!!!!$J!!!!m!!!!3!!!!%3!!!")!!!!6!!!!&!!!!"8!!!!@!!!
+!&`!!!"J!!!!C!!!!!J!!!"S!!!!E!!!!(!!!!"d!!!!N!!!!*3!!!#B!!!!R!!!
+!)!!!!#-!!!!S!!!!+3!!!#S!!!!I!!!!)J!!!#X!!!!X!!!!,3!!!#i!!!![!!!
+!-!!!!$%!!!!b!!!!-`!!!$3!!!!e!!!!0J!!!$F!!!!i!!!!)3!!!$N!!!!k!!!
+!1`!!!$`!!!"h!!!!H!!!!(N!!!"k!!!!F`!!!(B!!!"l!!!!I!!!!(d!!!"b!!!
+!G3!!!(i!!!"r!!!!J!!!!)%!!!##!!!!J`!!!)3!!!#&!!!!KJ!!!)F!!!#)!!!
+!G!!!!)i!!!#2!!!!N!!!!!#4!!!!LJ!!!)d!!!#5!!!!N`!!!*3!!!#*!!!!M!!
+!!*8!!!#@!!!!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ca%!!!$l!!!!!!!!!!"([J!!!Ja`FQ9Q!"E053!!!2`!!$+i!!!:
diff --git a/hdf/util/MacProjects/hdftopal.project.hqx b/hdf/util/MacProjects/hdftopal.project.hqx
new file mode 100644
index 0000000..5d6314e
--- /dev/null
+++ b/hdf/util/MacProjects/hdftopal.project.hqx
@@ -0,0 +1,981 @@
+(This file must be converted with BinHex 4.0)
+
+:%'KNCR4[F'&X,R"bEfTPBh3!68e3FN0A588!!!!!Yb!!!!!!QTjMEfpX!!!!!J!
+!!#J!!,&m!!#aT!!!"A`!!!!f!3!!!!!!!!!!!!!!!!!!3J!!!%-!!!"%!!!!43!
+!!$i!!!""!!!!4J!!!%F!!!")!!!!23!!!%!!!!"*!!!!9!!!!&8!!!"@!!!!5J!
+!!%X!!!"-!!!!63!!!%i!!!"2!!!!8!!!!&%!!!"5!!!!8`!!!$m!!!"A!!!!@!!
+!!&N!!!"D!!!!"3!!!!B!!!!(!!!!#!!!!!%!!!!%!!!!#3!!!!S!!!!,!!!!!!!
+!!!-!!!!-!!!!$3!!!!i!!!!2!!!!%!!!!"%!!!!5!!!!%`!!!"3!!!!9!!!!&J!
+!!"F!!!!B!!!!'3!!!!)!!!!D!!!!'`!!!"`!!!!G!!!!*!!!!#8!!!!Q!!!!*`!
+!!#!!!!!M!!!!+!!!!#N!!!!U!!!!(`!!!#)!!!!V!!!!,!!!!#d!!!!Z!!!!,`!
+!!$!!!!!a!!!!-J!!!$-!!!!d!!!!03!!!$B!!!!h!!!!1!!!!#%!!!!j!!!!1J!
+!!$X!!!!m!!!!G`!!!(J!!!"j!!!!HJ!!!(-!!!"f!!!!H`!!!(`!!!"p!!!!FJ!
+!!(8!!!"q!!!!I`!!!)!!!!#"!!!!JJ!!!)-!!!#%!!!!K3!!!)B!!!#(!!!!L!!
+!!(3!!!#1!!!!M`!!!*!!!!!!N3!!!)S!!!#0!!!!NJ!!!*-!!!#8!!!!L3!!!)`
+!!!#9!!!!PJ!!!*F!!!#B!!!!Q3!!!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`!!!$J!!!!!!!!!!!l9J!!!-4
+`FQ9Q!"ECR!!!!1%!!!!!!!!!!%2N!!!"&R"bC at B!&T(V!!!!iJ!!!!!!!!!!42S
+!!!#kF(*PCJ!@be`!!!$M!!!!!!!!!!!4G!!!!#j`FQ9Q!"ELK!!!!13!!!!!!!!
+!!%Hq!!!#$("bC at B!&bJf!!!!j3!!q-3!!!:
diff --git a/hdf/util/MacProjects/vshow.project.hqx b/hdf/util/MacProjects/vshow.project.hqx
new file mode 100644
index 0000000..99c64a8
--- /dev/null
+++ b/hdf/util/MacProjects/vshow.project.hqx
@@ -0,0 +1,807 @@
+(This file must be converted with BinHex 4.0)
+
+:$ACcD'ph,R"bEfTPBh3!68e3FN0A588!!!!!PQB!!!!!hkpMEfpX!!!!!J!!!#J
+!!*!!`J!!N!$U!!!&I!!!!$B"!!!!!!!!!!!!!!!!!!!!!!!!!@-N3N)!!!!K!!!
+!!J!!!!!!!!!r!!!!!h0S#&!!!!"J!!!!"!0TlY!!!!"r!!!!"3T"C'3!!!#G!!!
+!"P"TEP)!!!#k!!!!"f&3EfN!!!$F!!!!#%e*G'8!!!$i!!!!#A45CA-!!!%9!!!
+!#NePER8!!!%e!!!!#h4$Efi!!!&9!!!!$%0[ER3!!!&Y!!!!$@pcC8-!!!',!!!
+!$QPXE%-!!!'S!!!!$e0SEhF!!!('!!!!%%KTC'8!!!(I!!!!%8e[GQ8!!!)#!!!
+!%NGPG%-!!!)M!!!!%f9d3e)!!!*%!!!!&(TP3fm!!!*K!!!!&@aTG'8!!!+$!!!
+!&NGPG%-!!!+I!!!!&h4$9'N!!!+i!!!!'(4X9Q%!!!,9!!!!'@PZ3h3!!!,c!!!
+!'N0dE!X!!!-4!!!!'faeC3N!!!-a!!!!('`*8f8!!!01!!!!(94PFh3!!!0U!!!
+!(N4bB at F!!!1(!!!!(e4bB at -!!!1C!!!!)!a%FQ%!!!1k!!!!)3!!!B!!!!2B!!!
+!)J!!!!B!!!2j!!!!)kpi49m!!!3B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!!!!!!!!4+!!
+!!#j`FQ9Q!"U(F`!!!*m!!!!!!!!!!%5H!!!#$("bC at B!'R)i!!!!S!!!3Bd!!!:
+
diff --git a/hdf/util/Makefile.am b/hdf/util/Makefile.am
new file mode 100644
index 0000000..119c1a9
--- /dev/null
+++ b/hdf/util/Makefile.am
@@ -0,0 +1,137 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+AM_CPPFLAGS=-I$(top_srcdir)/hdf/src
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+bin_PROGRAMS = gif2hdf hdf2gif hdf2jpeg hdf24to8 hdf8to24 hdfcomp hdfed     \
+               hdfls hdfpack hdftopal hdftor8 hdfunpac jpeg2hdf paltohdf    \
+               r8tohdf ristosds vmake vshow 
+
+if HDF_BUILD_FORTRAN
+bin_SCRIPTS = h4redeploy h4cc h4fc
+else
+bin_SCRIPTS = h4redeploy h4cc
+endif
+
+gif2hdf_SOURCES = gif2hdf.c gif2mem.c gifread.c decompress.c writehdf.c
+gif2hdf_LDADD = $(LIBHDF)
+gif2hdf_DEPENDENCIES = $(LIBHDF)
+gif2hdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdf2gif_SOURCES = hdf2gif.c hdfgifwr.c
+hdf2gif_LDADD = $(LIBHDF)
+hdf2gif_DEPENDENCIES = $(LIBHDF)
+hdf2gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdf2jpeg_SOURCES = hdf2jpeg.c
+hdf2jpeg_LDADD = $(LIBHDF)
+hdf2jpeg_DEPENDENCIES = $(LIBHDF)
+hdf2jpeg_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdf24to8_SOURCES = hdf24to8.c
+hdf24to8_LDADD = $(LIBHDF)
+hdf24to8_DEPENDENCIES = $(LIBHDF)
+hdf24to8_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdf8to24_SOURCES = hdf8to24.c
+hdf8to24_LDADD = $(LIBHDF)
+hdf8to24_DEPENDENCIES = $(LIBHDF)
+hdf8to24_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdfcomp_SOURCES = hdfcomp.c
+hdfcomp_LDADD = $(LIBHDF)
+hdfcomp_DEPENDENCIES = $(LIBHDF)
+hdfcomp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdfed_SOURCES = he_cntrl.c he_disp.c he_file.c he_main.c
+hdfed_LDADD = $(LIBHDF)
+hdfed_DEPENDENCIES = $(LIBHDF)
+hdfed_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdfls_SOURCES = hdfls.c
+hdfls_LDADD = $(LIBHDF)
+hdfls_DEPENDENCIES = $(LIBHDF)
+hdfls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdfpack_SOURCES = hdfpack.c
+hdfpack_LDADD = $(LIBHDF)
+hdfpack_DEPENDENCIES = $(LIBHDF)
+hdfpack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdftopal_SOURCES = hdftopal.c
+hdftopal_LDADD = $(LIBHDF)
+hdftopal_DEPENDENCIES = $(LIBHDF)
+hdftopal_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdftor8_SOURCES = hdftor8.c
+hdftor8_LDADD = $(LIBHDF)
+hdftor8_DEPENDENCIES = $(LIBHDF)
+hdftor8_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+hdfunpac_SOURCES = hdfunpac.c
+hdfunpac_LDADD = $(LIBHDF)
+hdfunpac_DEPENDENCIES = $(LIBHDF)
+hdfunpac_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+jpeg2hdf_SOURCES = jpeg2hdf.c
+jpeg2hdf_LDADD = $(LIBHDF)
+jpeg2hdf_DEPENDENCIES = $(LIBHDF)
+jpeg2hdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+paltohdf_SOURCES = paltohdf.c
+paltohdf_LDADD = $(LIBHDF)
+paltohdf_DEPENDENCIES = $(LIBHDF)
+paltohdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+r8tohdf_SOURCES = r8tohdf.c
+r8tohdf_LDADD = $(LIBHDF)
+r8tohdf_DEPENDENCIES = $(LIBHDF)
+r8tohdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+ristosds_SOURCES = ristosds.c
+ristosds_LDADD = $(LIBHDF)
+ristosds_DEPENDENCIES = $(LIBHDF)
+ristosds_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+vmake_SOURCES = vmake.c
+vmake_LDADD = $(LIBHDF)
+vmake_DEPENDENCIES = $(LIBHDF)
+vmake_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+vshow_SOURCES = vshow.c
+vshow_LDADD = ../src/libdf.la
+vshow_DEPENDENCIES = ../src/libdf.la
+vshow_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+##                   Testing -- Here there be dragons.                     ##
+#############################################################################
+
+TEST_SCRIPT = testutil.sh
+check_SCRIPTS = testutil.sh
+check_PROGRAMS = $(bin_PROGRAMS)
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += gif_hdf_temp/bttrfly.hdf gif_hdf_temp/skull.gif    \
+                 gif_hdf_temp/SunWheel.hdf
+
+# Automake's distclean won't remove directories, so we can add an additional
+# hook target which will do so during 'make distclean'.
+distclean-local:
+	-rm -rf gif_hdf_temp
+
+DISTCLEANFILES =
+
+include $(top_srcdir)/config/conclude.am
+                 
diff --git a/hdf/util/Makefile.in b/hdf/util/Makefile.in
new file mode 100644
index 0000000..eac4969
--- /dev/null
+++ b/hdf/util/Makefile.in
@@ -0,0 +1,1130 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/h4cc.in $(srcdir)/h4fc.in $(srcdir)/h4redeploy.in \
+	$(srcdir)/testutil.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+bin_PROGRAMS = gif2hdf$(EXEEXT) hdf2gif$(EXEEXT) hdf2jpeg$(EXEEXT) \
+	hdf24to8$(EXEEXT) hdf8to24$(EXEEXT) hdfcomp$(EXEEXT) \
+	hdfed$(EXEEXT) hdfls$(EXEEXT) hdfpack$(EXEEXT) \
+	hdftopal$(EXEEXT) hdftor8$(EXEEXT) hdfunpac$(EXEEXT) \
+	jpeg2hdf$(EXEEXT) paltohdf$(EXEEXT) r8tohdf$(EXEEXT) \
+	ristosds$(EXEEXT) vmake$(EXEEXT) vshow$(EXEEXT)
+TESTS = $(TEST_SCRIPT)
+subdir = hdf/util
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = h4cc h4fc h4redeploy testutil.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_gif2hdf_OBJECTS = gif2hdf.$(OBJEXT) gif2mem.$(OBJEXT) \
+	gifread.$(OBJEXT) decompress.$(OBJEXT) writehdf.$(OBJEXT)
+gif2hdf_OBJECTS = $(am_gif2hdf_OBJECTS)
+gif2hdf_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(gif2hdf_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdf24to8_OBJECTS = hdf24to8.$(OBJEXT)
+hdf24to8_OBJECTS = $(am_hdf24to8_OBJECTS)
+hdf24to8_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdf24to8_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdf2gif_OBJECTS = hdf2gif.$(OBJEXT) hdfgifwr.$(OBJEXT)
+hdf2gif_OBJECTS = $(am_hdf2gif_OBJECTS)
+hdf2gif_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdf2gif_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdf2jpeg_OBJECTS = hdf2jpeg.$(OBJEXT)
+hdf2jpeg_OBJECTS = $(am_hdf2jpeg_OBJECTS)
+hdf2jpeg_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdf2jpeg_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdf8to24_OBJECTS = hdf8to24.$(OBJEXT)
+hdf8to24_OBJECTS = $(am_hdf8to24_OBJECTS)
+hdf8to24_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdf8to24_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdfcomp_OBJECTS = hdfcomp.$(OBJEXT)
+hdfcomp_OBJECTS = $(am_hdfcomp_OBJECTS)
+hdfcomp_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdfcomp_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdfed_OBJECTS = he_cntrl.$(OBJEXT) he_disp.$(OBJEXT) \
+	he_file.$(OBJEXT) he_main.$(OBJEXT)
+hdfed_OBJECTS = $(am_hdfed_OBJECTS)
+hdfed_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdfed_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdfls_OBJECTS = hdfls.$(OBJEXT)
+hdfls_OBJECTS = $(am_hdfls_OBJECTS)
+hdfls_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdfls_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdfpack_OBJECTS = hdfpack.$(OBJEXT)
+hdfpack_OBJECTS = $(am_hdfpack_OBJECTS)
+hdfpack_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdfpack_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdftopal_OBJECTS = hdftopal.$(OBJEXT)
+hdftopal_OBJECTS = $(am_hdftopal_OBJECTS)
+hdftopal_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdftopal_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdftor8_OBJECTS = hdftor8.$(OBJEXT)
+hdftor8_OBJECTS = $(am_hdftor8_OBJECTS)
+hdftor8_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdftor8_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdfunpac_OBJECTS = hdfunpac.$(OBJEXT)
+hdfunpac_OBJECTS = $(am_hdfunpac_OBJECTS)
+hdfunpac_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdfunpac_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_jpeg2hdf_OBJECTS = jpeg2hdf.$(OBJEXT)
+jpeg2hdf_OBJECTS = $(am_jpeg2hdf_OBJECTS)
+jpeg2hdf_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(jpeg2hdf_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_paltohdf_OBJECTS = paltohdf.$(OBJEXT)
+paltohdf_OBJECTS = $(am_paltohdf_OBJECTS)
+paltohdf_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(paltohdf_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_r8tohdf_OBJECTS = r8tohdf.$(OBJEXT)
+r8tohdf_OBJECTS = $(am_r8tohdf_OBJECTS)
+r8tohdf_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(r8tohdf_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_ristosds_OBJECTS = ristosds.$(OBJEXT)
+ristosds_OBJECTS = $(am_ristosds_OBJECTS)
+ristosds_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ristosds_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_vmake_OBJECTS = vmake.$(OBJEXT)
+vmake_OBJECTS = $(am_vmake_OBJECTS)
+vmake_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(vmake_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_vshow_OBJECTS = vshow.$(OBJEXT)
+vshow_OBJECTS = $(am_vshow_OBJECTS)
+vshow_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(vshow_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+SCRIPTS = $(bin_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(gif2hdf_SOURCES) $(hdf24to8_SOURCES) $(hdf2gif_SOURCES) \
+	$(hdf2jpeg_SOURCES) $(hdf8to24_SOURCES) $(hdfcomp_SOURCES) \
+	$(hdfed_SOURCES) $(hdfls_SOURCES) $(hdfpack_SOURCES) \
+	$(hdftopal_SOURCES) $(hdftor8_SOURCES) $(hdfunpac_SOURCES) \
+	$(jpeg2hdf_SOURCES) $(paltohdf_SOURCES) $(r8tohdf_SOURCES) \
+	$(ristosds_SOURCES) $(vmake_SOURCES) $(vshow_SOURCES)
+DIST_SOURCES = $(gif2hdf_SOURCES) $(hdf24to8_SOURCES) \
+	$(hdf2gif_SOURCES) $(hdf2jpeg_SOURCES) $(hdf8to24_SOURCES) \
+	$(hdfcomp_SOURCES) $(hdfed_SOURCES) $(hdfls_SOURCES) \
+	$(hdfpack_SOURCES) $(hdftopal_SOURCES) $(hdftor8_SOURCES) \
+	$(hdfunpac_SOURCES) $(jpeg2hdf_SOURCES) $(paltohdf_SOURCES) \
+	$(r8tohdf_SOURCES) $(ristosds_SOURCES) $(vmake_SOURCES) \
+	$(vshow_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog gif_hdf_temp/bttrfly.hdf \
+	gif_hdf_temp/skull.gif gif_hdf_temp/SunWheel.hdf
+AM_CPPFLAGS = -I$(top_srcdir)/hdf/src
+ at HDF_BUILD_FORTRAN_FALSE@bin_SCRIPTS = h4redeploy h4cc
+ at HDF_BUILD_FORTRAN_TRUE@bin_SCRIPTS = h4redeploy h4cc h4fc
+gif2hdf_SOURCES = gif2hdf.c gif2mem.c gifread.c decompress.c writehdf.c
+gif2hdf_LDADD = $(LIBHDF)
+gif2hdf_DEPENDENCIES = $(LIBHDF)
+gif2hdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdf2gif_SOURCES = hdf2gif.c hdfgifwr.c
+hdf2gif_LDADD = $(LIBHDF)
+hdf2gif_DEPENDENCIES = $(LIBHDF)
+hdf2gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdf2jpeg_SOURCES = hdf2jpeg.c
+hdf2jpeg_LDADD = $(LIBHDF)
+hdf2jpeg_DEPENDENCIES = $(LIBHDF)
+hdf2jpeg_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdf24to8_SOURCES = hdf24to8.c
+hdf24to8_LDADD = $(LIBHDF)
+hdf24to8_DEPENDENCIES = $(LIBHDF)
+hdf24to8_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdf8to24_SOURCES = hdf8to24.c
+hdf8to24_LDADD = $(LIBHDF)
+hdf8to24_DEPENDENCIES = $(LIBHDF)
+hdf8to24_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdfcomp_SOURCES = hdfcomp.c
+hdfcomp_LDADD = $(LIBHDF)
+hdfcomp_DEPENDENCIES = $(LIBHDF)
+hdfcomp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdfed_SOURCES = he_cntrl.c he_disp.c he_file.c he_main.c
+hdfed_LDADD = $(LIBHDF)
+hdfed_DEPENDENCIES = $(LIBHDF)
+hdfed_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdfls_SOURCES = hdfls.c
+hdfls_LDADD = $(LIBHDF)
+hdfls_DEPENDENCIES = $(LIBHDF)
+hdfls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdfpack_SOURCES = hdfpack.c
+hdfpack_LDADD = $(LIBHDF)
+hdfpack_DEPENDENCIES = $(LIBHDF)
+hdfpack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdftopal_SOURCES = hdftopal.c
+hdftopal_LDADD = $(LIBHDF)
+hdftopal_DEPENDENCIES = $(LIBHDF)
+hdftopal_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdftor8_SOURCES = hdftor8.c
+hdftor8_LDADD = $(LIBHDF)
+hdftor8_DEPENDENCIES = $(LIBHDF)
+hdftor8_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdfunpac_SOURCES = hdfunpac.c
+hdfunpac_LDADD = $(LIBHDF)
+hdfunpac_DEPENDENCIES = $(LIBHDF)
+hdfunpac_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+jpeg2hdf_SOURCES = jpeg2hdf.c
+jpeg2hdf_LDADD = $(LIBHDF)
+jpeg2hdf_DEPENDENCIES = $(LIBHDF)
+jpeg2hdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+paltohdf_SOURCES = paltohdf.c
+paltohdf_LDADD = $(LIBHDF)
+paltohdf_DEPENDENCIES = $(LIBHDF)
+paltohdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+r8tohdf_SOURCES = r8tohdf.c
+r8tohdf_LDADD = $(LIBHDF)
+r8tohdf_DEPENDENCIES = $(LIBHDF)
+r8tohdf_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+ristosds_SOURCES = ristosds.c
+ristosds_LDADD = $(LIBHDF)
+ristosds_DEPENDENCIES = $(LIBHDF)
+ristosds_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+vmake_SOURCES = vmake.c
+vmake_LDADD = $(LIBHDF)
+vmake_DEPENDENCIES = $(LIBHDF)
+vmake_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+vshow_SOURCES = vshow.c
+vshow_LDADD = ../src/libdf.la
+vshow_DEPENDENCIES = ../src/libdf.la
+vshow_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+#############################################################################
+TEST_SCRIPT = testutil.sh
+check_SCRIPTS = testutil.sh
+check_PROGRAMS = $(bin_PROGRAMS)
+DISTCLEANFILES = 
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/util/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign hdf/util/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+h4cc: $(top_builddir)/config.status $(srcdir)/h4cc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+h4fc: $(top_builddir)/config.status $(srcdir)/h4fc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+h4redeploy: $(top_builddir)/config.status $(srcdir)/h4redeploy.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+testutil.sh: $(top_builddir)/config.status $(srcdir)/testutil.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+gif2hdf$(EXEEXT): $(gif2hdf_OBJECTS) $(gif2hdf_DEPENDENCIES) $(EXTRA_gif2hdf_DEPENDENCIES) 
+	@rm -f gif2hdf$(EXEEXT)
+	$(gif2hdf_LINK) $(gif2hdf_OBJECTS) $(gif2hdf_LDADD) $(LIBS)
+hdf24to8$(EXEEXT): $(hdf24to8_OBJECTS) $(hdf24to8_DEPENDENCIES) $(EXTRA_hdf24to8_DEPENDENCIES) 
+	@rm -f hdf24to8$(EXEEXT)
+	$(hdf24to8_LINK) $(hdf24to8_OBJECTS) $(hdf24to8_LDADD) $(LIBS)
+hdf2gif$(EXEEXT): $(hdf2gif_OBJECTS) $(hdf2gif_DEPENDENCIES) $(EXTRA_hdf2gif_DEPENDENCIES) 
+	@rm -f hdf2gif$(EXEEXT)
+	$(hdf2gif_LINK) $(hdf2gif_OBJECTS) $(hdf2gif_LDADD) $(LIBS)
+hdf2jpeg$(EXEEXT): $(hdf2jpeg_OBJECTS) $(hdf2jpeg_DEPENDENCIES) $(EXTRA_hdf2jpeg_DEPENDENCIES) 
+	@rm -f hdf2jpeg$(EXEEXT)
+	$(hdf2jpeg_LINK) $(hdf2jpeg_OBJECTS) $(hdf2jpeg_LDADD) $(LIBS)
+hdf8to24$(EXEEXT): $(hdf8to24_OBJECTS) $(hdf8to24_DEPENDENCIES) $(EXTRA_hdf8to24_DEPENDENCIES) 
+	@rm -f hdf8to24$(EXEEXT)
+	$(hdf8to24_LINK) $(hdf8to24_OBJECTS) $(hdf8to24_LDADD) $(LIBS)
+hdfcomp$(EXEEXT): $(hdfcomp_OBJECTS) $(hdfcomp_DEPENDENCIES) $(EXTRA_hdfcomp_DEPENDENCIES) 
+	@rm -f hdfcomp$(EXEEXT)
+	$(hdfcomp_LINK) $(hdfcomp_OBJECTS) $(hdfcomp_LDADD) $(LIBS)
+hdfed$(EXEEXT): $(hdfed_OBJECTS) $(hdfed_DEPENDENCIES) $(EXTRA_hdfed_DEPENDENCIES) 
+	@rm -f hdfed$(EXEEXT)
+	$(hdfed_LINK) $(hdfed_OBJECTS) $(hdfed_LDADD) $(LIBS)
+hdfls$(EXEEXT): $(hdfls_OBJECTS) $(hdfls_DEPENDENCIES) $(EXTRA_hdfls_DEPENDENCIES) 
+	@rm -f hdfls$(EXEEXT)
+	$(hdfls_LINK) $(hdfls_OBJECTS) $(hdfls_LDADD) $(LIBS)
+hdfpack$(EXEEXT): $(hdfpack_OBJECTS) $(hdfpack_DEPENDENCIES) $(EXTRA_hdfpack_DEPENDENCIES) 
+	@rm -f hdfpack$(EXEEXT)
+	$(hdfpack_LINK) $(hdfpack_OBJECTS) $(hdfpack_LDADD) $(LIBS)
+hdftopal$(EXEEXT): $(hdftopal_OBJECTS) $(hdftopal_DEPENDENCIES) $(EXTRA_hdftopal_DEPENDENCIES) 
+	@rm -f hdftopal$(EXEEXT)
+	$(hdftopal_LINK) $(hdftopal_OBJECTS) $(hdftopal_LDADD) $(LIBS)
+hdftor8$(EXEEXT): $(hdftor8_OBJECTS) $(hdftor8_DEPENDENCIES) $(EXTRA_hdftor8_DEPENDENCIES) 
+	@rm -f hdftor8$(EXEEXT)
+	$(hdftor8_LINK) $(hdftor8_OBJECTS) $(hdftor8_LDADD) $(LIBS)
+hdfunpac$(EXEEXT): $(hdfunpac_OBJECTS) $(hdfunpac_DEPENDENCIES) $(EXTRA_hdfunpac_DEPENDENCIES) 
+	@rm -f hdfunpac$(EXEEXT)
+	$(hdfunpac_LINK) $(hdfunpac_OBJECTS) $(hdfunpac_LDADD) $(LIBS)
+jpeg2hdf$(EXEEXT): $(jpeg2hdf_OBJECTS) $(jpeg2hdf_DEPENDENCIES) $(EXTRA_jpeg2hdf_DEPENDENCIES) 
+	@rm -f jpeg2hdf$(EXEEXT)
+	$(jpeg2hdf_LINK) $(jpeg2hdf_OBJECTS) $(jpeg2hdf_LDADD) $(LIBS)
+paltohdf$(EXEEXT): $(paltohdf_OBJECTS) $(paltohdf_DEPENDENCIES) $(EXTRA_paltohdf_DEPENDENCIES) 
+	@rm -f paltohdf$(EXEEXT)
+	$(paltohdf_LINK) $(paltohdf_OBJECTS) $(paltohdf_LDADD) $(LIBS)
+r8tohdf$(EXEEXT): $(r8tohdf_OBJECTS) $(r8tohdf_DEPENDENCIES) $(EXTRA_r8tohdf_DEPENDENCIES) 
+	@rm -f r8tohdf$(EXEEXT)
+	$(r8tohdf_LINK) $(r8tohdf_OBJECTS) $(r8tohdf_LDADD) $(LIBS)
+ristosds$(EXEEXT): $(ristosds_OBJECTS) $(ristosds_DEPENDENCIES) $(EXTRA_ristosds_DEPENDENCIES) 
+	@rm -f ristosds$(EXEEXT)
+	$(ristosds_LINK) $(ristosds_OBJECTS) $(ristosds_LDADD) $(LIBS)
+vmake$(EXEEXT): $(vmake_OBJECTS) $(vmake_DEPENDENCIES) $(EXTRA_vmake_DEPENDENCIES) 
+	@rm -f vmake$(EXEEXT)
+	$(vmake_LINK) $(vmake_OBJECTS) $(vmake_LDADD) $(LIBS)
+vshow$(EXEEXT): $(vshow_OBJECTS) $(vshow_DEPENDENCIES) $(EXTRA_vshow_DEPENDENCIES) 
+	@rm -f vshow$(EXEEXT)
+	$(vshow_LINK) $(vshow_OBJECTS) $(vshow_LDADD) $(LIBS)
+install-binSCRIPTS: $(bin_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-binSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/decompress.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gif2hdf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gif2mem.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gifread.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf24to8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf2gif.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf2jpeg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdf8to24.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfcomp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfgifwr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfls.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfpack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdftopal.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdftor8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfunpac.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he_cntrl.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he_disp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he_file.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/he_main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jpeg2hdf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/paltohdf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/r8tohdf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ristosds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vmake.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vshow.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/writehdf.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) $(SCRIPTS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-local distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-binSCRIPTS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool cscopelist ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-local \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-binSCRIPTS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS uninstall-binSCRIPTS
+
+
+# Automake's distclean won't remove directories, so we can add an additional
+# hook target which will do so during 'make distclean'.
+distclean-local:
+	-rm -rf gif_hdf_temp
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/hdf/util/README b/hdf/util/README
new file mode 100644
index 0000000..4aac3fe
--- /dev/null
+++ b/hdf/util/README
@@ -0,0 +1,45 @@
+In this directory there are hdf utility programs, makefiles, and a 
+subdirectory, testfiles/, which contains all the data files needed to test
+the utilities. 
+
+The utilities are:
+
+    . hdf24to8 -- converts 24-bit raster images to hdf 8-bit images
+
+    . hdfcomp -- re-compresses an 8-bit raster hdf file
+   
+    . hdfls -- lists basic information about an hdf file
+
+    . hdfpack --  compacts an hdf file
+
+    . hdftopal -- extracts a palette from an hdf file
+  
+    . hdftor8 -- extracts 8-bit raster images and palettes from an
+                 hdf file
+
+    . hdfed -- hdf file editor
+
+    . hdfunpac - unpacks an HDF file by exporting the scientific
+                 data elements (DFTAG_SD) to external object
+                 elements.  This is a utility for external file
+                 handling for the parallel I/O interface on the CM5.
+
+    . paltohdf -- converts a raw palette to hdf
+
+    . r8tohdf -- converts 8-bit raster images to hdf
+
+    . ristosds -- converts a series of raster image hdf files into a
+                  single 3D sds hdf file. 
+
+    . vmake -- creates vsets 
+
+    . vshow -- dumps out vsets in an hdf file
+
+    . jpeg2hdf -- converts jpeg images to hdf raster images
+
+    . hdf2jpeg -- converts hdf raster images to jpeg images
+
+    . fp2hdf -- converts 2D and 3D floating point data sets into HDF SDS.
+
+
+
diff --git a/hdf/util/README.TST b/hdf/util/README.TST
new file mode 100644
index 0000000..beb3062
--- /dev/null
+++ b/hdf/util/README.TST
@@ -0,0 +1,436 @@
+All the input data files needed to test the utilities
+are in the subdirectory testfiles/. 
+
+
+Instructions on testing the HDF utility programs:
+
+
+hdf24to8 -- converts 24-bit raster images to hdf 8-bit images
+
+   Copy head.r24.Z from the testfiles/ directory to the util/ directory.
+   
+   Type: uncompress head.r24.Z
+
+   Execute the following in the util/ directory: 
+
+        cp testfiles/head.r24.Z .
+        uncompress head.r24.Z
+        ./hdf24to8 head.r24 head8.hdf
+
+   View head8.hdf using any visualization tool available (mosaic, collage, etc).
+
+   Delete head.r24 and head8.hdf when you are done.
+
+        rm head.r24 head8.hdf
+
+
+hdfed -- hdf file editor
+
+   Copy the file storm110.hdf from the testfiles/ directory to the 
+   util/ directory.
+
+   Execute the following in the util/ directory:
+       
+        cp testfiles/storm110.hdf .
+        ./hdfed storm110.hdf
+
+        Running interactively, type the following commands:
+
+                info -all
+                prev tag = 300
+                info -long
+                dump -short
+
+        The latter two commands should result in the following responses:
+
+         (6)    Image Dimensions              : (Tag 300)
+                Ref: 110, Offset: 3459, Length: 20 (bytes)
+       0:          0         57          0         57        106        110
+      12:          1          0          0          0
+
+
+        Type help and experiment.  Most of the information can be verified
+        with hdfls.  Be sure to type 'close' then 'quit' when you are finished
+        and delete storm110.hdf when you are done.
+
+            rm storm110.hdf
+
+        Copy ntcheck.hdf from the testfiles/ directory to the util/ directory.
+  
+        Execute the following in the util/ directory:
+
+            cp testfiles/ntcheck.hdf .
+            ./hdfed ntcheck.hdf
+
+        ntcheck.hdf will be used as an input file to test the dump function. 
+
+        The command:
+
+          dump -help
+
+        displays the list of formats supported by hdfed. 
+
+        Commands:
+
+          prev tag=<tag>  ref=<ref>
+
+        and
+
+          next tag=<rag> ref=<ref> 
+
+        move you back and forth among the objects.
+        
+          info -all 
+                
+        gives the tag and reference numbers for each object.
+
+	  
+        Look at the data in various objects and verify the data type.
+        For example:
+
+          next tag = 702  ref = 2      
+           
+          You will be past this data object and will receive the message
+          "Reached end of file. Not moved."  Repeat the command using prev 
+          instead of next.
+                         
+          dump -float
+
+          The first 5 lines of output should read as follows:
+
+             0:    0.000000e+00   1.000000e+00   2.000000e+00   3.000000e+00
+            16:    4.000000e+00   5.000000e+00   6.000000e+00   7.000000e+00
+            32:    8.000000e+00   9.000000e+00   4.000000e+01   4.100000e+01
+            48:    4.200000e+01   4.300000e+01   4.400000e+01   4.500000e+01
+            64:    4.600000e+01   4.700000e+01   4.800000e+01   4.900000e+01
+         	
+
+	      next tag = 702  ref = 6     
+
+          dump -short
+
+          The first 5 lines of output should read as follows:
+  
+           0:          0          1          2          3          4          5
+          12:          6          7          8          9       6000       6001
+          24:       6002       6003       6004       6005       6006       6007
+          36:       6008       6009      12000      12001      12002      12003
+          48:      12004      12005      12006      12007      12008      12009
+
+ 
+        The following is a cross reference of ref number and data type if you
+        want to experiment: 
+
+           
+         ref		number type
+
+
+	  2		DFNT_FLOAT32
+
+  	  3		DFNT_INT8
+
+	  4		DFNT_UINT8
+
+	  5		DFNT_INT16
+
+	  6		DFNT_UINT16
+
+	  7		DFNT_INT32
+
+	  8		DFNT_UINT32
+
+        Type 'close' and 'quit' when you are finished.
+        Delete ntcheck.hdf.
+
+            rm ntcheck.hdf
+
+ristosds -- converts a series raster image hdf files into a
+                  single 3D sds hdf file.
+
+   Copy the three HDF files storm110.hdf, storm120.hdf, and
+   storm130.hdf from the testfiles/ directory.
+
+   Execute the following in the util/ directory:
+ 
+    cp testfiles/storm110.hdf testfiles/storm120.hdf testfiles/storm130.hdf .
+    ./ristosds storm*.hdf -o storm.hdf
+ 
+   Compare storm110.hdf with storm.hdf using the following commands:
+   
+        hdfed storm.hdf
+        prev tag = 702
+	info -long
+    (*)	dump -length 20 -byte
+	close
+	open storm110.hdf
+	prev tag = 302
+        info -long
+   (**)	dump -length 20 -byte
+   	close
+        quit
+
+   * In storm.hdf tag 702's element should be 9747 bytes.
+
+  ** In storm110.hdf tag 302's element should be 1/3 of
+     9747, which is 3249.  (It is a 57x57 image.)
+
+     Compare the first few numbers in storm110's image
+     with the first few numbers in storm.hdf's SDS.  
+     They should be the same. 
+
+     Remove storm*.hdf from the util/ directory before continuing.
+
+         rm storm*.hdf
+
+hdfpack --  compacts an hdf file
+
+   Copy the file test.hdf from the testfiles/ directory.
+
+   Execute the following in the util/ directory:
+
+        cp testfiles/test.hdf .
+        ./hdfpack test.hdf test.pck
+        ./hdfpack -b test.hdf test.blk
+
+   Use hdfls to get a listing of test.hdf and test.pck.  The only
+   difference between the 2 listings should be that test.pck
+   shouldn't have any special elements and it also shouldn't 
+   have any "Linked Block Indicators."
+
+          ./hdfls test.hdf
+          ./hdfls test.pck
+
+   The file sizes should be as follows:
+
+       test.hdf - 11795 
+       test.pck - 6747 
+       test.blk - 7599
+  
+   Depending on the platform, the file sizes may be one byte off 
+   for test.pck and test.blk.
+  
+   Remove test.cdf, test.blk, and test.pck.
+
+       rm test.hdf test.blk test.pck
+
+hdftopal/paltohdf  -- converts between a raw palette and an hdf
+
+   Copy the file palette.raw from the testfiles/ directory.
+
+   Execute the following in the util/ directory:
+      
+        cp testfiles/palette.raw .
+        ./paltohdf palette.raw palette.hdf
+        ./hdftopal palette.hdf palette.raw.new
+
+   Use hdfls with the '-l' option to examine palette.hdf.
+   It should have an 'Image Palette-8' and an 'Image Palette,'
+   both with length 768 bytes.  They should also have the same
+   reference number.
+
+   Use the Unix utility 'cmp' or something similar to do a byte-for-byte
+   comparison of palette.raw and palette.raw.new.  They should be
+   identical.
+
+      cmp palette.raw palette.raw.new
+
+   Remove palette.*.
+
+      rm palette.*
+         
+	
+r8tohdf/hdftor8 -- converts between 8-bit raster images and hdf files
+
+   Copy the files storm*.raw and palette.raw from the testfiles/ directory.
+
+   Execute the following in the util/ directory:
+
+        cp testfiles/storm*.raw .
+        ./r8tohdf 57 57 storm.hdf storm*.raw
+        ./r8tohdf 57 57 storm.hdf -p palette.raw -i storm110.raw
+        ./hdftor8 storm.hdf
+
+   Use hdfls with the '-l' option to examine storm.hdf.  It should
+   contain five raster image sets, one of which will be compressed
+   under IMCOMP compression.  (If you do not put the '-p' in the
+   second r8tohdf command above, you should get an error message.)
+   The non-compressed raster images should be the same length as
+   the raw raster files.  The compressed will be about 25% of that
+   size.
+
+   Use the Unix utility 'cmp' or something similar to do byte-for-byte
+   comparisons on the raw raster files produced by hdftor8:
+             
+         cmp img001-057.057  storm110.raw   
+         cmp img002-057.057  storm120.raw
+         cmp img003-057.057  storm130.raw
+         cmp img004-057.057  storm140.raw
+
+   There should be one more img* file than you had at the start.  One of the
+   img files may not compare exactly with any one of the raw rasters, and the 
+   rest will compare with one of the other raw rasters.  There is no guarantee
+   about the order of the produced raw rasters, but it is likely they will be 
+   produced in the order in which they went into the file, which would be
+   increasing numerical order, with the compressed image last.
+
+   Remove storm* and img* when you are done.
+
+         rm storm* img*
+
+hdfcomp -- re-compress 8-bit raster hdf file
+
+   Copy the files storm*.hdf from the testfiles/ directory.
+
+   Execute:
+
+        cp testfiles/storm*.hdf .
+        ./hdfcomp allstorms.hdf storm*.hdf
+        ./hdfcomp allcomp.hdf -c storm*.hdf
+
+   Use hdfls with the '-l' option to examine the two HDF files.  The first,
+   allstorms.hdf, should simply hold the raster together in one file,
+   with no compression.  You can use hdfls to check the original files.
+   The second file, allcomp.hdf, should hold all the rasters in a
+   compress format.  Run-Length Encoding (RLE) compression will result
+   in modest savings - about 10% to 15% for these files.
+
+   Remove allstorms.hdf and allcomp.hdf.
+
+        rm storm*.hdf all*.hdf
+
+jpeg2hdf/hdf2jpeg
+
+   Copy the file jpeg_img.jpg from the testfiles/ directory.
+
+   Execute:
+
+        cp testfiles/jpeg_img.jpg .
+        ./jpeg2hdf jpeg_img.jpg jpeg.hdf
+        ./hdf2jpeg jpeg.hdf jpeg2.jpg
+
+   Use hdfls with the '-l' option to examine the HDF file.  It should
+   contain one raster image set, which will be compressed with JPEG
+   compression.  The JPEG compressed image will be 2922 bytes in size.
+
+   Use the Unix utility 'cmp' or something similar to do byte-for-byte
+   comparisons on the produced raw raster files by hdf2jpeg.  The
+   initial jpeg_img.jpg file should be an exact match for the new
+   jpeg2.jpg file.
+
+        cmp jpeg_img.jpg jpeg2.jpg
+
+   Remove jpeg.hdf, jpeg_img.jpg, and jpeg2.jpg.
+
+        rm jpeg.hdf jpeg_img.jpg jpeg2.jpg
+
+fp2hdf -- converts floating point 2D/3D datasets into hdf SDS or RIS.
+
+   To test this utility you must first create the ASCII and binary test 
+   files with the fptest program.  Then run fp2hdf on the test files that 
+   get created, and analyze the output.  Following are the steps to 
+   do this:
+
+   1. Run fptest to create 2D/3D ASCII/binary test files:  
+
+        ./fptest
+
+                   FILE    TYPE    DIMENSIONS 
+                   ----    ----    ----------
+                   ctxtr2  TEXT    3x4
+                   ctxtr3  TEXT    5x3x4
+                   cb32r2  FP32    3x4
+                   cb32r3  FP32    5x3x4
+                   cb64r2  FP64    3x4
+                   cb64r3  FP64    5x3x4
+
+     Following are the values of the dimension scales and arrays that 
+     get created:
+
+     row scale values start at 11 and increment by 1 => 11, 12, 13
+     column scale values start at 21 and increment by 2 => 21, 23, 25, 27
+     plane scale values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+
+     data element value = row scale value + column scale value [+ plane 
+                          scale value, if rank=3]
+
+     For an array of [3][4], data values are:
+
+      3.200000E+01  3.400000E+01  3.600000E+01  3.800000E+01
+      3.300000E+01  3.500000E+01  3.700000E+01  3.900000E+01
+      3.400000E+01  3.600000E+01  3.800000E+01  4.000000E+01
+ 
+     For array of [5][3][4], data values are:
+ 
+      8.300000E+01  8.500000E+01  8.700000E+01  8.900000E+01
+      8.400000E+01  8.600000E+01  8.800000E+01  9.000000E+01
+      8.500000E+01  8.700000E+01  8.900000E+01  9.100000E+01
+ 
+      8.800000E+01  9.000000E+01  9.200000E+01  9.400000E+01
+      8.900000E+01  9.100000E+01  9.300000E+01  9.500000E+01
+      9.000000E+01  9.200000E+01  9.400000E+01  9.600000E+01
+
+      9.300000E+01  9.500000E+01  9.700000E+01  9.900000E+01
+      9.400000E+01  9.600000E+01  9.800000E+01  1.000000E+02
+      9.500000E+01  9.700000E+01  9.900000E+01  1.010000E+02
+
+      9.800000E+01  1.000000E+02  1.020000E+02  1.040000E+02
+      9.900000E+01  1.010000E+02  1.030000E+02  1.050000E+02
+      1.000000E+02  1.020000E+02  1.040000E+02  1.060000E+02
+
+      1.030000E+02  1.050000E+02  1.070000E+02  1.090000E+02
+      1.040000E+02  1.060000E+02  1.080000E+02  1.100000E+02
+      1.050000E+02  1.070000E+02  1.090000E+02  1.110000E+02
+
+   2. Run fp2hdf on the test files that were created:
+    
+      ./fp2hdf ctxtr2 -o ctxtr2.hdf
+      ./fp2hdf ctxtr3 -o ctxtr3.hdf
+      ./fp2hdf cb32r2 -o cb32r2.hdf
+      ./fp2hdf cb32r3 -o cb32r3.hdf
+      ./fp2hdf cb64r2 -o cb64r2.hdf
+      ./fp2hdf cb64r3 -o cb64r3.hdf
+      ./fp2hdf ctxtr2 -o ctxtr2_ris.hdf -raster -e 50 50
+      ./fp2hdf cb64r2 -o cb64r2_ris.hdf -raster -i 50 50 -f
+
+   3. Use hdfls and hdfed to verify the correctness of the output 
+      *.hdf files.  The rank, dimension size, number type, 
+      dimension scale and data values should agree with those
+      listed in item 1 above. 
+
+      You can also use the hdp command.  To use hdp from the
+      util/ directory, type:
+   
+       For an SDS:
+
+        ../../mfhdf/dumper/hdp dumpsds <hdf filename>
+
+       For a raster image:
+  
+        ../../mfhdf/dumper/hdp dumprig <hdf filename>
+
+      Collage can also be used to display the *.hdf files.
+      Display the spreadsheet and compare the values to those
+      in Item 1.  For the Raster Images, display the image; 
+      the values are interpolated, and will not match the
+      values as show in Item 1.  
+
+        ctxtr2.hdf -- 2D SDS, display spreadsheet
+        ctxtr3.hdf -- 3D SDS, display spreadsheet along z axis.
+        cb32r2.hdf -- 2D SDS, display spreadsheet
+        cb32r3.hdf -- 3D SDS, display spreadsheet along z axis
+        cb64r2.hdf -- 2D SDS, display spreadsheet
+        cb64r3.hdf -- 3D SDS, display spreadsheet along z axis
+        ctxtr2_ris.hdf -- RIS, display image
+        cb64r2_ris.hdf -- 2D SDS, display spreadsheet
+                          RIS, display image 
+   
+   4. Remove ctxtr* and cb*.  
+
+       rm ctxtr* cb* *.hdf
+                   
+
+
+
+
+
+
diff --git a/hdf/util/README.fp2hdf b/hdf/util/README.fp2hdf
new file mode 100644
index 0000000..f031cfe
--- /dev/null
+++ b/hdf/util/README.fp2hdf
@@ -0,0 +1,19 @@
+
+This revision of fptohdf, which we are calling fp2hdf,  supports native
+mode floating point (both single and double precision), and 3D floating 
+point data sets.
+
+For these additions we owe our thanks to Bob Weaver and colleagues
+at INEL.
+
+You should be able to compile fp2hdf, as well as the two programs
+for generating test data, by executing "make".  Note: you will
+need to change some of the definitions in the makefile to conform
+to your system.
+
+Except for Makefile, fp2hdf.c, and this README file, all of the
+files in this directory are for testing fp2hdf and illustrating
+its use.
+
+Mike Folk
+
diff --git a/hdf/util/README.fp2hdf.test b/hdf/util/README.fp2hdf.test
new file mode 100644
index 0000000..e4b05f0
--- /dev/null
+++ b/hdf/util/README.fp2hdf.test
@@ -0,0 +1,63 @@
+
+
+
+There are two sets of input files for testing fp2hdf.  These files
+are used by the script fp2hdf.test.
+
+I. The first set consists of 2-D data sets that produce images that are 
+cross-hatched with 10 vertical and 10 horizontal lines.  These files
+use the following naming conventions:
+
+   't' prefix means it's a text file
+   'h' prefix means it's an hdf file
+   'h' at the end means horizontal scale is not uniform
+   'v' at the end means vertical scale is not uniform
+   'n' at the end means no scales are stored in the file
+   dimensions are given between  prefix and postfix
+
+The names of the files: (which are stored in the testfiles/fp2hdf directory)
+                    t100x100  
+                    h100x100  
+                    h100x100h 
+                    h100x100hv
+                    h60x75    
+                    h60x75v   
+                    h60x75n   
+
+II. The second set are generated by the programs ftest.c and ftest.F. 
+They are small files with 2-D and 3-D data sets that are easily 
+examined by eye.  Those that begin with the letter 'c' are 
+produced with the program ftest.c, and those that begin with 'f'
+were produced with ftest.F.
+
+                   ctxtr2, type 'TEXT', size 3x4
+                   ctxtr3, type 'TEXT', size 3x4x5
+                   cb32r2, type 'FP32', size 3x4
+                   cb32r3, type 'FP32', size 3x4x5
+                   cb64r2, type 'FP64', size 3x4
+                   cb64r3, type 'FP64', size 3x4x5
+     
+                   ftxtr2, type 'TEXT', size 3x4
+                   ftxtr3, type 'TEXT', size 3x4x5
+                   fb32r2, type 'FP32', size 3x4
+                   fb32r3, type 'FP32', size 3x4x5
+                   fb64r2, type 'FP64', size 3x4
+                   fb64r3, type 'FP64', size 3x4x5
+
+Contents of the arrays:
+
+  row    values start at 11 and increment by 1 => 11, 12, 13
+  column values start at 21 and increment by 2 => 21, 23, 25, 27
+  plane  values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+
+  data element value = row value + column value [+ plane value, if rank=3]
+     
+
+Output files can be examined with hdfls to see if basic
+contents are there.  Those with raster images can be displayed
+using NCSA Image, DataScope, etc.  Those with floating point
+data can be examined using hdfed or DataScope.
+
+
+
+
diff --git a/hdf/util/decompress.c b/hdf/util/decompress.c
new file mode 100644
index 0000000..dc1ee37
--- /dev/null
+++ b/hdf/util/decompress.c
@@ -0,0 +1,316 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "gif.h"
+
+#define NEXTBYTE (*ptr++)
+#define IMAGESEP 0x2c
+#define INTERLACEMASK 0x40
+#define COLORMAPMASK 0x80
+#define False 0
+#define True 1
+
+WORD           iWIDE,iHIGH,eWIDE,eHIGH,expand,numcols,strip,nostrip;
+unsigned long  cols[256];
+char           *cmd;
+
+FILE *fp;
+
+static int BitOffset = 0,	/* Bit Offset of next code */
+XC = 0, YC = 0,				/* Output X and Y coords of current pixel */
+Pass = 0,					/* Used by output routine if WORDerlaced pic */
+OutCount = 0,				/* Decompressor output 'stack count' */
+#ifdef UNUSED
+RWidth, RHeight,			/* screen dimensions */
+LeftOfs, TopOfs,			/* image offset */
+BitsPerPixel,				/* Bits per pixel, read from GIF header */
+ColorMapSize,				/* number of colors */
+Background,					/* background color */
+#endif /* UNUSED */
+IWidth, IHeight,			/* image dimensions */
+BytesPerScanline,			/* Bytes per scanline in output raster */
+CodeSize,					/* Code size, read from GIF header */
+InitCodeSize,				/* Starting code size, used during Clear */
+Code,						/* Value returned by ReadCode */
+MaxCode,					/* limiting value for current code size */
+ClearCode,					/* GIF clear code */
+EOFCode,					/* GIF end-of-information code */
+CurCode, OldCode, InCode,	/* Decompressor variables */
+FirstFree,					/* First free code, generated per GIF spec */
+FreeCode,					/* Decompressor, next free slot in hash table */
+FinChar,					/* Decompressor variable */
+DataMask,					/* AND mask for data size */
+ReadMask;                   /* Code AND mask for current code size */
+
+/*MODIFICATIONS*/
+BYTE tempbyte[10];
+BYTE * tempBYTEptr[10];
+WORD tempint[10];
+WORD ImageCount = 0;
+/*END MODIFICATION*/
+
+boolean Interlace, HasColormap;
+
+
+BYTE *Image;			/* The result array */
+BYTE *RawGIF;			/* The heap array to hold it, raw */
+BYTE *Raster;			/* The raster data stream, unblocked */
+
+/* The hash table used by the decompressor */
+
+int Prefix[4096];
+int Suffix[4096];
+
+/* An output array used by the decompressor */
+
+int OutCode[1025];
+
+/* The color map, read from the GIF header */
+
+int  numused;
+
+/* Fetch the next code from the raster data stream.  The codes can be
+* any length from 3 to 12 bits, packed WORDo 8-bit BYTEs, so we have to
+* maWORDain our location in the Raster array as a BIT Offset.  We compute
+* the BYTE Offset WORDo the raster array by dividing this by 8, pick up
+* three BYTEs, compute the bit Offset WORDo our 24-bit chunk, shift to
+* bring the desired code to the bottom, then mask it off and return it. 
+*/
+int ReadCode(void)
+{
+	int RawCode, ByteOffset;
+	
+    ByteOffset = BitOffset / 8;
+    RawCode = Raster[ByteOffset] + (0x100 * Raster[ByteOffset + 1]);
+    if (CodeSize >= 8)
+		RawCode += (0x10000 * Raster[ByteOffset + 2]);
+    RawCode >>= (BitOffset % 8);
+    BitOffset += CodeSize;
+    return(RawCode & ReadMask);
+}
+
+
+void AddToPixel(Index)
+BYTE Index;
+{
+    if (YC<IHeight)
+        *(Image + YC * BytesPerScanline + XC) = Index;
+	
+
+    
+    /* Update the X-coordinate, and if it overflows, update the Y-coordinate */
+    if (++XC == IWidth) {
+		
+	/* If a non-WORDerlaced picture, just increment YC to the next scan line. 
+	* If it's WORDerlaced, deal with the WORDerlace as described in the GIF
+	* spec.  Put the decoded scan line out to the screen if we haven't gone
+	* past the bottom of it.
+		*/
+		
+		XC = 0;
+		if (!Interlace) YC++;
+		else {
+			switch (Pass) {
+			case 0:
+				YC += 8;
+				if (YC >= IHeight) {
+					Pass++;
+					YC = 4;
+				}
+				break;
+			case 1:
+				YC += 8;
+				if (YC >= IHeight) {
+					Pass++;
+					YC = 2;
+				}
+				break;
+				
+			case 2:
+				YC += 4;
+				if (YC >= IHeight) {
+					Pass++;
+					YC = 1;
+				}
+				break;
+			case 3:
+				YC += 2;
+				break;
+			default:
+				break;
+			}
+		}
+    }
+}
+
+/* Main routine.  Convert a GIF image to an HDF image */
+
+BYTE* Decompress(GifImageDesc , GifHead)
+GIFIMAGEDESC *GifImageDesc;
+GIFHEAD      *GifHead;
+{
+	int i;
+
+	XC = 0; 
+	YC = 0;
+	Pass = 0;
+	OutCount = 0;
+	BitOffset = 0;
+	
+	DataMask = (WORD)((1L << ((GifHead->PackedField & 0x07) +1)) -1);
+	Raster = GifImageDesc->GIFImage;
+	
+	
+	/* Check for image seperator */
+	
+	/* Now read in values from the image descriptor */
+	IWidth = GifImageDesc->ImageWidth;
+	IHeight = GifImageDesc->ImageHeight;
+	Interlace = GifImageDesc->PackedField & 0x20;
+	
+	/* Note that I ignore the possible existence of a local color map.
+	* I'm told there aren't many files around that use them, and the spec
+	* says it's defined for future use.  This could lead to an error
+	* reading some files. 
+	*/
+	
+	/* Start reading the raster data. First we get the WORDial code size
+	* and compute decompressor constant values, based on this code size.
+	*/
+	
+	CodeSize = GifImageDesc->CodeSize;
+	ClearCode = (1 << CodeSize);
+	EOFCode = ClearCode + 1;
+	FreeCode = FirstFree = ClearCode + 2;
+	
+	/* The GIF spec has it that the code size is the code size used to
+	* compute the above values is the code size given in the file, but the
+	* code size used in compression/decompression is the code size given in
+	* the file plus one. (thus the ++).
+	*/
+	
+	CodeSize++;
+	InitCodeSize = CodeSize;
+	MaxCode = (1 << CodeSize);
+	ReadMask = MaxCode - 1;
+	
+	/* Read the raster data.  Here we just transpose it from the GIF array
+	* to the Raster array, turning it from a series of blocks WORDo one long
+	* data stream, which makes life much easier for ReadCode().
+	*/
+	
+	
+	
+	/*    free(RawGIF);		 We're not done just yet - change made */
+	
+	/* Allocate the Image */
+	
+	if (!(Image = (BYTE *)malloc(IWidth*IHeight))) {
+		printf("Out of memory");
+		exit(-1);
+	}
+	
+	BytesPerScanline = IWidth;
+	
+	/* Decompress the file, continuing until you see the GIF EOF code.
+	* One obvious enhancement is to add checking for corrupt files here.
+	*/
+	
+	Code = ReadCode();
+	while (Code != EOFCode) {
+		
+	/* Clear code sets everything back to its initial value, then reads the
+	* immediately subsequent code as uncompressed data.
+		*/
+		
+		if (Code == ClearCode) {
+			CodeSize = InitCodeSize;
+			MaxCode = (1 << CodeSize);
+			ReadMask = MaxCode - 1;
+			FreeCode = FirstFree;
+			CurCode = OldCode = Code = ReadCode();
+			FinChar = CurCode & DataMask;
+			AddToPixel(FinChar);
+		}
+		else {
+			
+			/* If not a clear code, then must be data: save same as CurCode and InCode */
+			
+			CurCode = InCode = Code;
+			
+			/* If greater or equal to FreeCode, not in the hash table yet;
+			* repeat the last character decoded
+			*/
+			
+			if (CurCode >= FreeCode) {
+				CurCode = OldCode;
+				OutCode[OutCount++] = FinChar;
+			}
+			
+			/* Unless this code is raw data, pursue the chain poWORDed to by CurCode
+			* through the hash table to its end; each code in the chain puts its
+			* associated output code on the output queue.
+			*/
+			
+			while (CurCode > DataMask) {
+				if (OutCount > 1024) {
+					/*return error message*/	
+				}
+				OutCode[OutCount++] = Suffix[CurCode];
+				CurCode = Prefix[CurCode];
+			}
+			
+			/* The last code in the chain is treated as raw data. */
+			
+			FinChar = CurCode & DataMask;
+			OutCode[OutCount++] = FinChar;
+			
+			/* Now we put the data out to the Output routine.
+			* It's been stacked LIFO, so deal with it that way...
+			*/
+			
+			for (i = OutCount - 1; i >= 0; i--)
+				AddToPixel(OutCode[i]);
+			OutCount = 0;
+			
+			/* Build the hash table on-the-fly. No table is stored in the file. */
+			
+			Prefix[FreeCode] = OldCode;
+			Suffix[FreeCode] = FinChar;
+			OldCode = InCode;
+			
+			/* PoWORD to the next slot in the table.  If we exceed the current
+			* MaxCode value, increment the code size unless it's already 12.  If it
+			* is, do nothing: the next code decompressed better be CLEAR
+			*/
+			
+			FreeCode++;
+			if (FreeCode >= MaxCode) {
+				if (CodeSize < 12) {
+					CodeSize++;
+					MaxCode *= 2;
+					ReadMask = (1 << CodeSize) - 1;
+				}
+			}
+		}
+		Code = ReadCode();
+	}
+
+	return Image;	
+}
+
+
diff --git a/hdf/util/fp2hdf.c b/hdf/util/fp2hdf.c
new file mode 100644
index 0000000..d35308e
--- /dev/null
+++ b/hdf/util/fp2hdf.c
@@ -0,0 +1,2286 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Name:
+ *      fp2hdf
+ *
+ * Purpose:
+ *      To convert floating point data to HDF Scientific Data Set (SDS)
+ *      and/or 8-bit Raster Image Set (RIS8) format, storing the results
+ *      in an HDF file.  The image data can be scaled about the mean value.
+ *
+ *                                  -----------
+ *      floating point data        |           | ----------> RIS8
+ *      (SDS, ASCII text, or  ---> |  fp2hdf   |   and/or
+ *      native floating point)     |           | ----------> SDS
+ *                                  -----------
+ *
+ * Synopsis:
+ *      fp2hdf -h[elp], OR
+ *      fp2hdf <infile> [<infile>...] -o[utfile] <outfile>
+ *             [-r[aster] [ras_opts ...]] [-f[loat]]
+ *
+ *      -h[elp]:
+ *              Print a helpful summary of usage, and exit.
+ *
+ *      <infile(s)>:
+ *              Input file(s), containing a single two-dimensional or
+ *              three-dimensional floating point array in either ASCII
+ *              text, native floating point, or HDF SDS format.  If an
+ *              HDF file is used for input, it must contain an SDS.
+ *              The SDS need only contain a dimension record and the
+ *              data, but if it also contains maximum and minimum values
+ *              and/or scales for each axis, these will be used.  If the
+ *              input format is ASCII text or native floating point, see
+ *              "Notes" below on how it must be organized.
+ *
+ *      -o[utfile] <outfile>:
+ *              Data from one or more input files are stored as one or
+ *              more data sets and/or images in one HDF output file,
+ *              "outfile".
+ *
+ *      -r[aster]:
+ *              Store output as a raster image set in the output file.
+ *
+ *      -f[loat]:
+ *              Store output as a scientific data set in the output file.
+ *              This is the default if the "-r" option is not specified.
+ *
+ *      ras_opts ...
+ *
+ *      -e[xpand] <horiz> <vert> [<depth>]:
+ *              Expand float data via pixel replication to produce the
+ *              image(s).  "horiz" and "vert" give the horizontal and
+ *              vertical resolution of the image(s) to be produced; and
+ *              optionally, "depth" gives the number of images or depth
+ *              planes (for 3D input data).
+ *
+ *      -i[nterp] <horiz> <vert> [<depth>]:
+ *              Apply bilinear, or trilinear, interpolation to the float
+ *              data to produce the image(s).  "horiz", "vert", and "depth"
+ *              must be greater than or equal to the dimensions of the
+ *              original dataset.
+ *      If max and min are supplied in input file, this option clips
+ *      values that are greater than max or less then min, setting
+ *      them to the max and min, respectively.
+ *
+ *      -p[alfile] <palfile>:
+ *              Store the palette with the image.  Get the palette from
+ *              "palfile"; which may be an HDF file containing a palette,
+ *              or a file containing a raw palette.
+ *
+ *      -m[ean] <mean>:
+ *              If a floating point mean value is given, the image will be
+ *              scaled about the mean.  The new extremes (newmax and newmin),
+ *              as given by:
+ *
+ *                 newmax = mean + max(abs(max-mean), abs(mean-min))
+ *                 newmin = mean - max(abs(max-mean), abs(mean-min))
+ *
+ *              will be equidistant from the mean value.  If no mean value
+ *              is given, then the mean will be:  0.5 * (max + min)
+ *
+ * Notes:
+ *      If the input file format is ASCII text or native floating point, it
+ *      must have the following input fields:
+ *
+ *              format
+ *              nplanes
+ *              nrows
+ *              ncols
+ *              max_value
+ *              min_value
+ *              [plane1 plane2 plane3 ...]
+ *              row1 row2 row3 ...
+ *              col1 col2 col3 ...
+ *              data1 data2 data3 ...
+ *              ...
+ *
+ *      Where:
+ *              format:
+ *                      Format designator ("TEXT", "FP32" or "FP64").
+ *              nplanes:
+ *                      Dimension of the depth axis ("1" for 2D input).
+ *              nrows:
+ *                      Dimension of the vertical axis.
+ *              ncols:
+ *                      Dimension of the horizontal axis.
+ *              max_value:
+ *                      Maximum data value.
+ *              min_value:
+ *                      Minimum data value.
+ *              plane1, plane2, plane3, ...:
+ *                      Scales for depth axis.
+ *              row1, row2, row3, ...:
+ *                      Scales for the vertical axis.
+ *              col1, col2, col3, ...:
+ *                      Scales for the horizontal axis.
+ *              data1, data2, data3, ...:
+ *                      The data ordered by rows, left to right and top
+ *                      to bottom; then optionally, ordered by planes,
+ *                      front to back.
+ *
+ *      For FP32 and FP64 input format, "format", "nplanes", "nrows", "ncols",
+ *      and "nplanes" are native integers; where "format" is the integer
+ *      representation of the appropriate 4-character string (0x46503332 for
+ *      "FP32" and 0x46503634 for "FP64").  The remaining input fields are
+ *      composed of native 32-bit floating point values for FP32 input format,
+ *      or native 64-bit floating point values for FP64 input format.
+ *
+ * Source Availability:
+ *      This program is in the public domain, and was developed and made
+ *      available by the National Center for Supercomputing Applications,
+ *      University of Illinois, Urbana-Champaign (ftp.ncsa.uiuc.edu).
+ *
+ * History:
+ *      Beta version:                                           17-May-89
+ *              (by Mike Folk mfolk at ncsa.uiuc.edu)
+ *      Revision to put in the mean option:                     15-Sep-89
+ *              (by Glen Mortensen gam at inel.gov)
+ *      Officially released:                                    01-Dec-89
+ *              (by NCSA ftp.ncsa.uiuc.edu)
+ *      Revision to fix some bugs:                              16-Mar-90
+ *              (by Mike Folk mfolk at ncsa.uiuc.edu)
+ *      Revision to support 3D and native fp input:             15-May-90
+ *              (by Bob Weaver baw at inel.gov)
+ *      Revision to fix bug in interp() :                    17-Oct-90
+ *              (by Fred Walsteijn nwalstyn at fys.ruu.n)
+ *      Revision to fix bug in interp() :                    23-Nov-90
+ *              Now it clips values outside of max and min.
+ *              (by Fred Walsteijn nwalstyn at fys.ruu.n)
+ *      Revision to start to use HDF 3.2 (and 3.3) library:  22-Jun-93
+ *              Still lots to do to support other number types.
+ *              (by Chris Houck chouck at ncsa.uiuc.edu)
+ *
+ */
+
+#include "hdf.h"
+#include <stdio.h>
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+#include <string.h>
+#include <ctype.h>
+
+#ifdef _WIN32
+#include <sys/stat.h>
+#include <fcntl.h>
+#endif
+
+/*
+ * global macros
+ */
+#define EXPAND      1   /* -e: expand image with pixel replication */
+#define INTERP      2   /* -i: expand image with interpolation */
+
+/*
+ * structure definition for command line options
+ */
+struct Options
+  {
+      char      **infiles;      /* pointer to list of input file names */
+      char        outfile[32];  /* output file name */
+      char        palfile[32];  /* palette file name, if any */
+      int         fcount;       /* number of input files */
+      int         to_float;     /* float output is desired */
+      int         to_image;     /* image output is desired */
+      int         pal;          /* output palette with image */
+      int         ctm;          /* color transform method: EXPAND or INTERP */
+      int         exh;          /* horizontal expansion factor */
+      int         exv;          /* vertical expansion factor */
+      int         exd;          /* depth expansion factor */
+      int         hres;         /* horizontal resolution of output image */
+      int         vres;         /* vertical resolution of output image */
+      int         dres;         /* depth resolution of output image */
+      int         mean;         /* scale image around a mean */
+      float32     meanval;      /* mean value to scale the image around */
+  };
+
+/*
+ * structure definition for the input data
+ */
+struct Input
+  {
+      int         is_hdf;       /* HDF file format flag */
+      int         is_text;      /* ASCII text format flag */
+      int         is_fp32;      /* 32-bit native floating point format flag */
+      int         is_fp64;      /* 64-bit native floating point format flag */
+      int         rank;         /* number of input data dimensions */
+      int         dims[3];      /* input dimensions - ncols, nrows, nplanes */
+      int         is_vscale;    /* vertical axis scales in the input */
+      int         is_hscale;    /* horizontal axis scales in the input */
+      int         is_dscale;    /* depth axis scales in the input */
+      float32     max;          /* maximum value of the data */
+      float32     min;          /* minimum value of the data */
+      float32    *hscale;       /* horizontal scales */
+      float32    *vscale;       /* vertical scales */
+      float32    *dscale;       /* depth scales */
+      VOIDP       data;         /* input data */
+  };
+
+/*
+ * structure definition for the output raster images
+ */
+struct Raster
+  {
+      int         hres;         /* horizontal resolution of the image */
+      int         vres;         /* vertical resolution of the image */
+      int         dres;         /* depth resolution of the image */
+      unsigned char *image;
+  };
+
+/*
+ * state table tokens
+ */
+#define FILNAME 0   /* filename */
+#define OPT_o   1   /* output filename */
+#define OPT_r   2   /* convert to image */
+#define OPT_e   3   /* expand image via pixel replication */
+#define OPT_i   4   /* make interpolated image */
+#define NUMBR   5   /* resolution of enlarged image */
+#define OPT_p   6   /* palette filename */
+#define OPT_f   7   /* convert to float (default) */
+#define OPT_h   8   /* request for explanation */
+#define OPT_m   9   /* mean to scale around */
+#define ERR 20  /* invalid token */
+
+/*
+ * state table for parsing the command line.
+ */
+static int  state_table[17][10] =
+{
+
+    /* token ordering:
+       FILNAME      OPT_o   OPT_r   OPT_e   OPT_i   NUMBR   OPT_p   OPT_f
+       OPT_h        OPT_m   */
+
+    /* state 0: start */
+    {1, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    14, ERR},
+
+    /* state 1: input files */
+    {1, 2, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR},
+
+    /* state 2: -o[utfile] */
+    {3, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR},
+
+    /* state 3: outfile */
+    {ERR, ERR, 4, ERR, ERR, ERR, ERR, 13,
+    ERR, ERR},
+
+    /* state 4: -r[aster] */
+    {ERR, ERR, ERR, 5, 9, ERR, 10, 12,
+    ERR, 15},
+
+    /* state 5: -e[xpand] */
+    {ERR, ERR, ERR, ERR, ERR, 6, ERR, ERR,
+    ERR, ERR},
+
+    /* state 6: -e[xpand] or -i[nterp] option argument */
+    {ERR, ERR, ERR, ERR, ERR, 7, ERR, ERR,
+    ERR, ERR},
+
+    /* state 7: -e[xpand] or -i[nterp] option argument */
+    {ERR, ERR, ERR, ERR, ERR, 8, 10, 12,
+    ERR, 15},
+
+    /* state 8: -e[xpand] or -i[nterp] option argument */
+    {ERR, ERR, ERR, ERR, ERR, ERR, 10, 12,
+    ERR, 15},
+
+    /* state 9: -i[nterp] */
+    {ERR, ERR, ERR, ERR, ERR, 6, ERR, ERR,
+    ERR, ERR},
+
+    /* state 10: -p[alfile] */
+    {11, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR},
+
+    /* state 11: palfile */
+    {ERR, ERR, ERR, 5, 9, ERR, ERR, 12,
+    ERR, 15},
+
+    /* state 12: -f[loat] (after -r[aster]) */
+    {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR},
+
+    /* state 13: -f[loat] */
+    {ERR, ERR, 4, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR},
+
+    /* state 14: -h[elp] */
+    {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR},
+
+    /* state 15: -m[ean] */
+    {ERR, ERR, ERR, ERR, ERR, 16, ERR, ERR,
+    ERR, ERR},
+
+    /* state 16: mean */
+    {ERR, ERR, ERR, 5, 9, ERR, 10, 12,
+    ERR, ERR}
+};
+
+/* static local functions */
+static int  gtoken(char *s);
+static int  process(struct Options *opt);
+static int  gfloat(char *infile, FILE * strm, float32 *fp32, struct Input *in);
+static int  gint(char *infile, FILE * strm, int *ival, struct Input *in);
+static int  isnum(char *s);
+static int  gdata(char *infile, struct Input *in, FILE *strm, int *is_maxmin);
+static int  gdimen(char *infile, struct Input *inp, FILE *strm);
+static int  gmaxmin(char *infile, struct Input *in, FILE *strm, int *is_maxmin);
+static int  gscale(char *infile, struct Input *in, FILE *strm, int *is_scale);
+static int  gtype(char *infile, struct Input *in, FILE **strm);
+static int  indexes(float32 *scale, int dim, int *idx, int res);
+static int  interp(struct Input *in, struct Raster *im);
+static int  palette(char *palfile);
+static int  pixrep(struct Input *in, struct Raster *im);
+
+/*
+ * functions with non-integer return types
+ */
+void        help(char *);
+void        mean(struct Input *, struct Options *);
+void        usage(char *);
+
+/*
+ * Name:
+ *      main
+ *
+ * Purpose:
+ *      The driver for "fp2hdf".
+ */
+int
+main(int argc, char *argv[])
+{
+    struct Options opt;
+    int         i;
+    int         outfile_named = FALSE;
+    int         token;
+    int         state = 0;
+
+    
+    const char *err1 = "Invalid number of arguments:  %d.\n";
+    const char *err2 = "Error in state table.\n";
+    const char *err3 = "No output file given.\n";
+    const char *err4 = "Program aborted.\n";
+
+#ifdef _WIN32
+	_fmode = _O_BINARY;
+#endif
+
+    /*
+     * set 'stdout' and 'stderr' to line-buffering mode
+     */
+    (void) setvbuf(stderr, (char *) NULL, _IOLBF, 0);
+    (void) setvbuf(stdout, (char *) NULL, _IOLBF, 0);
+
+    /*
+     * validate the number of command line arguments
+     */
+    if (argc < 2)
+      {
+          (void) fprintf(stderr, err1, argc);
+          usage(argv[0]);
+          goto err;
+      }
+
+    opt.to_image = FALSE;   /* default: no image */
+    opt.to_float = FALSE;   /* default: make float if no image */
+			    /* Set FALSE here.  Will be set TRUE */
+			    /* after confirming image option is not set.  */
+    opt.ctm = EXPAND;   /* default: pixel replication */
+    opt.hres = 0;   /* default: no expansion values */
+    opt.vres = 0;
+    opt.dres = 0;
+    opt.pal = FALSE;    /* default: no palette */
+    opt.mean = FALSE;   /* default: no mean given */
+    opt.fcount = 0;     /* to count number of input files */
+
+    /*
+     * parse the command line
+     */
+    for (i = 1; i < argc; i++)
+      {
+          if ((token = gtoken(argv[i])) == ERR)
+            {
+                usage(argv[0]);
+                goto err;
+            }
+          state = state_table[state][token];
+          switch (state)
+            {
+                case 1: /* counting input files */
+                    opt.fcount++;
+                    break;
+                case 2: /* -o found; look for outfile */
+                    break;
+                case 3: /* get outfile name */
+                    (void) HDstrcpy(opt.outfile, argv[i]);
+                    outfile_named = TRUE;
+                    break;
+                case 4: /* -r found */
+                    opt.to_image = TRUE;
+                    break;
+                case 5: /* -e found */
+                    opt.ctm = EXPAND;
+                    break;
+                case 6: /* horizontal resolution */
+                    opt.hres = atoi(argv[i]);
+                    break;
+                case 7: /* vertical resolution */
+                    opt.vres = atoi(argv[i]);
+                    break;
+                case 8: /* depth resolution */
+                    opt.dres = atoi(argv[i]);
+                    break;
+                case 9: /* -i found */
+                    opt.ctm = INTERP;
+                    break;
+                case 10:    /* -p found */
+                    opt.pal = TRUE;
+                    break;
+                case 11:    /* get pal filename */
+                    (void) HDstrcpy(opt.palfile, argv[i]);
+                    break;
+                case 12:    /* -f found (after a -r) */
+                case 13:    /* -f found (no -r yet) */
+                    opt.to_float = TRUE;
+                    break;
+                case 14:    /* -h found; help, then exit */
+                    help(argv[0]);
+                    exit(0);
+                case 15:    /* -m found */
+                    opt.mean = TRUE;
+                    break;
+                case 16:    /* mean value */
+                    opt.meanval = (float32)atof(argv[i]);
+                    break;
+                case ERR:   /* command syntax error */
+                default:
+                    (void) fprintf(stderr, err2);
+                    usage(argv[0]);
+                    goto err;
+            }
+      }
+
+    /*
+     * make sure an output file was specified
+     */
+    if (!outfile_named)
+      {
+          (void) fprintf(stderr, err3);
+          usage(argv[0]);
+          goto err;
+      }
+
+    if (!opt.to_image)
+        opt.to_float = TRUE;
+    opt.infiles = argv + 1;
+
+    /*
+     * process the input files
+     */
+    if (process(&opt))
+        goto err;
+
+    return(0);
+
+  err:
+    (void) fprintf(stderr, err4);
+    return(1);
+}
+
+/*
+ * Name:
+ *      gdata
+ *
+ * Purpose:
+ *      Get the input data.
+ */
+static int
+gdata(char *infile, struct Input *in, FILE *strm, int *is_maxmin)
+{
+    int32       i, j, k;
+    float32    *fp32;
+    int32       hdfdims[3];     /* order: ZYX or YX */
+    int32       len = in->dims[0] * in->dims[1] * in->dims[2];
+
+    const char *err1 = "Unable to get input data from file: %s.\n";
+
+    /*
+     * extract the input data from the input file
+     */
+    if (in->is_hdf == TRUE)
+      {
+          /*
+           * hdfdims is ordered: ZYX or YX
+           * in->dims is ordered: XYZ
+           */
+          if (in->rank == 2)
+            {
+                hdfdims[0] = in->dims[1];
+                hdfdims[1] = in->dims[0];
+            }
+          else
+            {
+                hdfdims[0] = in->dims[2];
+                hdfdims[1] = in->dims[1];
+                hdfdims[2] = in->dims[0];
+            }
+
+          if (DFSDgetdata(infile, in->rank, hdfdims, in->data))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+    else
+      {
+          for (k = 0, fp32 = (float32 *) in->data; k < in->dims[2]; k++)
+            {
+                for (j = 0; j < in->dims[1]; j++)
+                  {
+                      for (i = 0; i < in->dims[0]; i++, fp32++)
+                        {
+                            if (gfloat(infile, strm, fp32, in))
+                              {
+                                  (void) fprintf(stderr, err1, infile);
+                                  goto err;
+                              }
+                        }
+                  }
+            }
+          (void) fclose(strm);
+      }
+
+    /*
+     * derive the max/min values, if needed
+     */
+    if (*is_maxmin == FALSE)
+      {
+          in->min = in->max = *(float32 *) in->data;
+          for (i = 1; i < len; i++)
+            {
+                if (((float32 *) in->data)[i] > in->max)
+                    in->max = ((float32 *) in->data)[i];
+                if (((float32 *) in->data)[i] < in->min)
+                    in->min = ((float32 *) in->data)[i];
+            }
+          *is_maxmin = TRUE;
+      }
+
+#ifdef  DEBUG
+    (void) printf("\tdata:");
+    for (k = 0, fp32 = in->data; k < in->dims[2]; k++)
+      {
+          (void) printf("\n");
+          for (j = 0; j < in->dims[1]; j++)
+            {
+                (void) printf("\n\t");
+                for (i = 0; i < in->dims[0]; i++, fp32++)
+                    (void) printf("%E ", *fp32);
+            }
+      }
+    (void) printf("\n\n\n");
+#endif /* DEBUG */
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gdimen
+ *
+ * Purpose:
+ *      Determine the input data dimensions.
+ */
+static int
+gdimen(char *infile, struct Input *inp, FILE *strm)
+{
+    int32       hdfdims[3];     /* order: ZYX or YX */
+    int32       nt;             /* number type of input file */
+
+    const char *err1 = "Unable to get data dimensions from file: %s.\n";
+    const char *err2 = "Invalid data rank of %d in file: %s.\n";
+    const char *err3 = "Dimension(s) is less than '2' in file: %s.\n";
+    const char *err4 = "Unexpected number type from file: %s.\n";
+
+    /*
+     * extract the rank and dimensions of the HDF input file
+     */
+    if (inp->is_hdf == TRUE)
+      {
+          if (DFSDgetdims(infile, &inp->rank, hdfdims, 3) == FAIL)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+
+          /* don't know how to deal with other numbers yet */
+          if (DFSDgetNT(&nt) == FAIL || nt != DFNT_FLOAT32)
+            {
+                (void) fprintf(stderr, err4, infile);
+                goto err;
+            }
+
+          /*
+           * hdfdims is ordered: ZYX or YX
+           * inp->dims is ordered: XYZ
+           */
+          if (inp->rank == 2)
+            {
+                inp->dims[0] = hdfdims[1];
+                inp->dims[1] = hdfdims[0];
+                inp->dims[2] = 1;
+            }
+          else if (inp->rank == 3)
+            {
+                inp->dims[0] = hdfdims[2];
+                inp->dims[1] = hdfdims[1];
+                inp->dims[2] = hdfdims[0];
+            }
+          else
+            {
+                (void) fprintf(stderr, err2, inp->rank, infile);
+                goto err;
+            }
+
+          /*
+           * get the rank and dimensions from a TEXT or native floating point
+           * format input file
+           */
+      }
+    else
+      {
+          if (gint(infile, strm, &inp->dims[2], inp))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          if (inp->dims[2] > 1)
+              inp->rank = 3;
+          else
+              inp->rank = 2;
+          if (gint(infile, strm, &inp->dims[1], inp))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          if (gint(infile, strm, &inp->dims[0], inp))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+
+    /*
+     * validate dimension sizes
+     */
+    if ((inp->dims[0] < 2) || (inp->dims[1] < 2))
+      {
+          (void) fprintf(stderr, err3, infile);
+          goto err;
+      }
+
+#ifdef  DEBUG
+    (void) printf("\nInput Information ...\n\n");
+    (void) printf("\trank:\n\n\t%d\n\n", inp->rank);
+    (void) printf("\tdimensions (nplanes,nrows,ncols):\n\n");
+    (void) printf("\t%d %d %d\n\n", inp->dims[2], inp->dims[1], inp->dims[0]);
+#endif /* DEBUG */
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gfloat
+ *
+ * Purpose:
+ *      Read in a single floating point value from the input stream.  The
+ *      input format may either be ASCII text , 32-bit native floating point,
+ *      or 64-bit native floating point.
+ */
+static int
+gfloat(char *infile, FILE * strm, float32 *fp32, struct Input *in)
+{
+    float64     fp64=0.0;
+
+    const char *err1 = "Unable to get 'float' value from file: %s.\n";
+
+    if (in->is_text == TRUE)
+      {
+
+		if (fscanf(strm, "%e", fp32) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+    else if (in->is_fp32 == TRUE)
+      {
+		
+          if (fread((char *) fp32, sizeof(float32), 1, strm) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+    else
+      {
+          if (fread((char *) &fp64, sizeof(float64), 1, strm) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          *fp32 = (float32) fp64;
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gint
+ *
+ * Purpose:
+ *      Read in a single integer value from the input stream.  The input
+ *      format may either be ASCII text or a native BCD of type integer.
+ */
+static int
+gint(char *infile, FILE * strm, int *ival, struct Input *in)
+{
+    const char *err1 = "Unable to get 'int' value from file: %s.\n";
+
+    /*
+     * process TEXT-formatted input
+     */
+    if (in->is_text == TRUE)
+      {
+          if (fscanf(strm, "%d", ival) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+
+          /*
+           * process BCD-formatted input
+           */
+      }
+    else
+      {
+          if (fread((char *) ival, sizeof(int), 1, strm) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gmaxmin
+ *
+ * Purpose:
+ *      Extract the maximum and minimum data values from the input file.
+ */
+static int
+gmaxmin(char *infile, struct Input *in, FILE *strm, int *is_maxmin)
+{
+    const char *err1 = "Unable to get max/min values from file: %s.\n";
+
+    /*
+     * extract the max/min values from the input file
+     */
+    if (in->is_hdf == TRUE)
+      {
+          if (!DFSDgetrange(&in->max, &in->min))
+              if (in->max > in->min)
+                  *is_maxmin = TRUE;
+      }
+    else
+      {
+          if (gfloat(infile, strm, &in->max, in))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          if (gfloat(infile, strm, &in->min, in))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          if (in->max > in->min)
+              *is_maxmin = TRUE;
+      }
+
+#ifdef  DEBUG
+    (void) printf("\tinput maximum/minimum values:\n\n");
+    (void) printf("\t%E %E\n\n", in->max, in->min);
+#endif /* DEBUG */
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gscale
+ *
+ * Purpose:
+ *      Determine the scale for each axis.
+ */
+static int
+gscale(char *infile, struct Input *in, FILE *strm, int *is_scale)
+{
+    int         i;
+    int32       hdfdims[3];     /* order: ZYX or YX */
+
+    const char *err1 = "Unable to get axis scale from file: %s.\n";
+
+    *is_scale = TRUE;
+
+    /*
+     * hdfdims is ordered: ZYX or YX
+     * in->dims is ordered: XYZ
+     */
+    if (in->rank == 2)
+      {
+          hdfdims[0] = in->dims[1];
+          hdfdims[1] = in->dims[0];
+      }
+    else
+      {
+          hdfdims[0] = in->dims[2];
+          hdfdims[1] = in->dims[1];
+          hdfdims[2] = in->dims[0];
+      }
+
+    /*
+     * extract the scale values from the input file
+     */
+    if (in->is_hdf == TRUE)
+      {
+          if (in->rank == 2)
+            {
+                if (DFSDgetdimscale(1, hdfdims[0], in->vscale))
+                  {
+                      *is_scale = FALSE;
+                      for (i = 0; i <= hdfdims[0]; i++)
+                          in->vscale[i] = (float32) i;
+                  }
+                if (DFSDgetdimscale(2, hdfdims[1], in->hscale))
+                  {
+                      *is_scale = FALSE;
+                      for (i = 0; i <= hdfdims[1]; i++)
+                          in->hscale[i] = (float32) i;
+                  }
+            }
+          else
+            {
+                if (DFSDgetdimscale(1, hdfdims[0], in->dscale))
+                  {
+                      *is_scale = FALSE;
+                      for (i = 0; i <= hdfdims[0]; i++)
+                          in->dscale[i] = (float32) i;
+                  }
+                if (DFSDgetdimscale(2, hdfdims[1], in->vscale))
+                  {
+                      *is_scale = FALSE;
+                      for (i = 0; i <= hdfdims[1]; i++)
+                          in->vscale[i] = (float32) i;
+                  }
+                if (DFSDgetdimscale(3, hdfdims[2], in->hscale))
+                  {
+                      *is_scale = FALSE;
+                      for (i = 0; i <= hdfdims[2]; i++)
+                          in->hscale[i] = (float32) i;
+                  }
+            }
+      }
+    else
+      {
+          if (in->rank == 2)
+            {
+                for (i = 0; i < hdfdims[0]; i++)
+                  {
+                      if (gfloat(infile, strm, &in->vscale[i], in))
+                        {
+                            (void) fprintf(stderr, err1, infile);
+                            goto err;
+                        }
+                  }
+                in->vscale[i] = in->vscale[i - 1];
+                for (i = 0; i < hdfdims[1]; i++)
+                  {
+                      if (gfloat(infile, strm, &in->hscale[i], in))
+                        {
+                            (void) fprintf(stderr, err1, infile);
+                            goto err;
+                        }
+                  }
+                in->hscale[i] = in->hscale[i - 1];
+            }
+          else
+            {
+                for (i = 0; i < hdfdims[0]; i++)
+                  {
+                      if (gfloat(infile, strm, &in->dscale[i], in))
+                        {
+                            (void) fprintf(stderr, err1, infile);
+                            goto err;
+                        }
+                  }
+                in->dscale[i] = in->dscale[i - 1];
+                for (i = 0; i < hdfdims[1]; i++)
+                  {
+                      if (gfloat(infile, strm, &in->vscale[i], in))
+                        {
+                            (void) fprintf(stderr, err1, infile);
+                            goto err;
+                        }
+                  }
+                in->vscale[i] = in->vscale[i - 1];
+                for (i = 0; i < hdfdims[2]; i++)
+                  {
+                      if (gfloat(infile, strm, &in->hscale[i], in))
+                        {
+                            (void) fprintf(stderr, err1, infile);
+                            goto err;
+                        }
+                  }
+                in->hscale[i] = in->hscale[i - 1];
+            }
+      }
+
+#ifdef  DEBUG
+    if (in->rank == 2)
+      {
+          (void) printf("\tscales of the axes (vert,horiz):\n\n\t");
+          for (i = 0; i < hdfdims[0]; i++)
+              (void) printf("%E ", in->vscale[i]);
+          (void) printf("\n\t");
+          for (i = 0; i < hdfdims[1]; i++)
+              (void) printf("%E ", in->hscale[i]);
+      }
+    else
+      {
+          (void) printf("\tscales of the axes (depth,vert,horiz):\n\n\t");
+          for (i = 0; i < hdfdims[0]; i++)
+              (void) printf("%E ", in->dscale[i]);
+          (void) printf("\n\t");
+          for (i = 0; i < hdfdims[1]; i++)
+              (void) printf("%E ", in->vscale[i]);
+          (void) printf("\n\t");
+          for (i = 0; i < hdfdims[2]; i++)
+              (void) printf("%E ", in->hscale[i]);
+      }
+    (void) printf("\n\n\n");
+#endif /* DEBUG */
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gtoken
+ *
+ * Purpose:
+ *      Return the token identifier associated with the command line
+ *      argument.
+ */
+static int
+gtoken(char *s)
+{
+    size_t      len;
+    int         token;
+
+    const char *err1 = "Illegal argument: %s.\n";
+
+    /*
+     * identify the token type
+     */
+    if (s[0] == '-')
+      {     /* option name (or negative number) */
+          token = ERR;
+          len = HDstrlen(&s[1]);
+          switch (s[1])
+            {
+                case 'o':
+                    if (!HDstrncmp("outfile", &s[1], len))
+                        token = OPT_o;
+                    break;
+                case 'r':
+                    if (!HDstrncmp("raster", &s[1], len))
+                        token = OPT_r;
+                    break;
+                case 'e':
+                    if (!HDstrncmp("expand", &s[1], len))
+                        token = OPT_e;
+                    break;
+                case 'i':
+                    if (!HDstrncmp("interp", &s[1], len))
+                        token = OPT_i;
+                    break;
+                case 'p':
+                    if (!HDstrncmp("palfile", &s[1], len))
+                        token = OPT_p;
+                    break;
+                case 'f':
+                    if (!HDstrncmp("float", &s[1], len))
+                        token = OPT_f;
+                    break;
+                case 'h':
+                    if (!HDstrncmp("help", &s[1], len))
+                        token = OPT_h;
+                    break;
+                case 'm':
+                    if (!HDstrncmp("mean", &s[1], len))
+                        token = OPT_m;
+                    break;
+                default:
+                    if (isnum(s))   /* negative number? */
+                        token = NUMBR;
+            }
+          if (token == ERR)
+              (void) fprintf(stderr, err1, s);
+
+      }
+    else if (isnum(s))  /* positive number */
+        token = NUMBR;
+    else    /* filename */
+        token = FILNAME;
+
+    return (token);
+}
+
+/*
+ * Name:
+ *      gtype
+ *
+ * Purpose:
+ *      Determine the type of the input file (HDF, TEXT, FP32 or FP64).
+ */
+static int
+gtype(char *infile, struct Input *in, FILE **strm)
+{
+    char        buf[8];
+
+    const char *err1 = "Unable to open file: %s.\n";
+    const char *err2 = "Unable to get format tag from file: %s.\n";
+    const char *err3 = "Invalid file format in file: %s.\n";
+
+    /*
+     * determine the input file format
+     */
+    if (Hishdf(infile))
+        in->is_hdf = TRUE;
+    else
+      {
+          if ((*strm = fopen(infile, "r")) == NULL)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          if (fread(buf, 4, 1, *strm) != 1)
+            {
+                (void) fprintf(stderr, err2, infile);
+                goto err;
+            }
+          if (!HDmemcmp("TEXT", buf, 4) || !HDmemcmp("text", buf, 4)) {
+#ifdef _WIN32
+			  _fmode = _O_TEXT;
+#endif
+              in->is_text = TRUE;
+		  }
+          else
+            {
+                rewind(*strm);
+                if (fread(buf, sizeof(int), 1, *strm) != 1)
+                  {
+                      (void) fprintf(stderr, err2, infile);
+                      goto err;
+                  }
+                if (!HDmemcmp("FP32", buf, 4) || !HDmemcmp("fp32", buf, 4))
+                    in->is_fp32 = TRUE;
+                else if (!HDmemcmp("FP64", buf, 4) ||
+                         !HDmemcmp("fp64", buf, 4))
+                    in->is_fp64 = TRUE;
+                else
+                  {
+                      (void) fprintf(stderr, err3, infile);
+                      goto err;
+                  }
+		
+            }
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      help
+ *
+ * Purpose:
+ *      Print a helpful summary of command usage and features.
+ */
+void
+help(char *name)
+{
+    (void) printf("Name:\n");
+    (void) printf("\t%s\n\n", name);
+    (void) printf("Purpose:\n");
+    (void) printf("\tTo convert floating point data to HDF Scientific ");
+    (void) printf("Data Set (SDS)\n");
+    (void) printf("\tand/or 8-bit Raster Image Set (RIS8) format, ");
+    (void) printf("storing the results\n");
+    (void) printf("\tin an HDF file.  The image data can be scaled ");
+    (void) printf("about a mean value.\n\n");
+    (void) printf("Version:\n");
+    (void) printf("\tv1.1 (Apr 30, 1990)\n\n");
+    (void) printf("Synopsis:\n");
+    (void) printf("\t%s -h[elp], OR\n", name);
+    (void) printf("\t%s <infile> [<infile>...] -o[utfile] ", name);
+    (void) printf("<outfile>\n");
+    (void) printf("\t\t[-r[aster] [ras_opts ...]] [-f[loat]]\n\n");
+    (void) printf("\t-h[elp]:\n");
+    (void) printf("\t\tPrint a helpful summary of usage, and exit.\n\n");
+    (void) printf("\tinfile(s):\n");
+    (void) printf("\t\tInput file(s), containing a single ");
+    (void) printf("two-dimensional or\n");
+    (void) printf("\t\tthree-dimensional floating point array in ");
+    (void) printf("either ASCII\n");
+    (void) printf("\t\ttext, native floating point, or HDF SDS format.  ");
+    (void) printf("If an\n");
+    (void) printf("\t\tHDF file is used for input, it must contain an ");
+    (void) printf("SDS.\n");
+    (void) printf("\t\tThe SDS need only contain a dimension record and ");
+    (void) printf("the\n");
+    (void) printf("\t\tdata, but if it also contains maximum and ");
+    (void) printf("minimum values\n");
+    (void) printf("\t\tand/or scales for each axis, these will be ");
+    (void) printf("used.  If the\n");
+    (void) printf("\t\tinput format is ASCII text or native floating ");
+    (void) printf("point, see\n");
+    (void) printf("\t\t\"Notes\" below on how it must be organized.\n\n");
+    (void) printf("\t-o[utfile] <outfile>:\n");
+    (void) printf("\t\tData from one or more input files are stored as ");
+    (void) printf("one or\n");
+    (void) printf("\t\tmore data sets and/or images in one HDF output ");
+    (void) printf("file,\n\t\t\"outfile\".\n\n");
+    (void) printf("\t-r[aster]:\n");
+    (void) printf("\t\tStore output as a raster image set in the ");
+    (void) printf("output file\n\n");
+    (void) printf("\t-f[loat]:\n");
+    (void) printf("\t\tStore output as a scientific data set in the ");
+    (void) printf("the output file.\n");
+    (void) printf("\t\tThis is the default if the \"-r\" option is not ");
+    (void) printf("specified.\n\n");
+    (void) printf("\tras_opts ...\n\n");
+    (void) printf("\t-e[xpand] <horiz> <vert> [<depth>]:\n");
+    (void) printf("\t\tExpand float data via pixel replication to ");
+    (void) printf("produce the\n");
+    (void) printf("\t\timage(s).  \"horiz\" and \"vert\" give the ");
+    (void) printf("horizontal and\n");
+    (void) printf("\t\tvertical resolution of the image(s) to be ");
+    (void) printf("produced; and\n");
+    (void) printf("\t\toptionally, \"depth\" gives the number of ");
+    (void) printf("images or depth\n");
+    (void) printf("\t\tplanes (for 3D input data).\n\n");
+    (void) printf("\t-i[nterp] <horiz> <vert> [<depth>]:\n");
+    (void) printf("\t\tApply bilinear, or trilinear, interpolation to ");
+    (void) printf("the float\n");
+    (void) printf("\t\tdata to produce the image(s).  \"horiz\", ");
+    (void) printf("\"vert\", and \"depth\"\n");
+    (void) printf("\t\tmust be greater than or equal to the dimensions ");
+    (void) printf("of the\n");
+    (void) printf("\t\toriginal dataset.\n\n");
+    (void) printf("\t-p[alfile] <palfile>:\n");
+    (void) printf("\t\tStore the palette with the image.  Get the ");
+    (void) printf("palette from\n");
+    (void) printf("\t\t\"palfile\"; which may be an HDF file containing ");
+    (void) printf("a palette,\n");
+    (void) printf("\t\tor a file containing a raw palette.\n\n");
+    (void) printf("\t-m[ean] <mean>:\n");
+    (void) printf("\t\tIf a floating point mean value is given, the ");
+    (void) printf("image will be\n");
+    (void) printf("\t\tscaled about the mean.  The new extremes ");
+    (void) printf("(newmax and newmin),\n");
+    (void) printf("\t\tas given by:\n\n");
+    (void) printf("\t\t   newmax = mean + max(abs(max-mean), ");
+    (void) printf("abs(mean-min))\n");
+    (void) printf("\t\t   newmin = mean - max(abs(max-mean), ");
+    (void) printf("abs(mean-min))\n\n");
+    (void) printf("\t\twill be equidistant from the mean value.  If ");
+    (void) printf("no mean value\n");
+    (void) printf("\t\tis given, then the mean will be:  0.5 * (max ");
+    (void) printf("+ min)\n\n");
+    (void) printf("Notes:\n");
+    (void) printf("\tIf the input file format is ASCII text or native ");
+    (void) printf("floating point, it\n");
+    (void) printf("\tmust have the following input fields:\n\n");
+    (void) printf("\t\tformat\n");
+    (void) printf("\t\tnplanes\n");
+    (void) printf("\t\tnrows\n");
+    (void) printf("\t\tncols\n");
+    (void) printf("\t\tmax_value\n");
+    (void) printf("\t\tmin_value\n");
+    (void) printf("\t\t[plane1 plane2 plane3 ...]\n");
+    (void) printf("\t\trow1 row2 row3 ...\n");
+    (void) printf("\t\tcol1 col2 col3 ...\n");
+    (void) printf("\t\tdata1 data2 data3 ...\n");
+    (void) printf("\t\t...\n\n");
+    (void) printf("\tWhere:\n");
+    (void) printf("\t\tformat:\n");
+    (void) printf("\t\t\tFormat designator (\"TEXT\", \"FP32\" or ");
+    (void) printf("\"FP64\").\n");
+    (void) printf("\t\tnplanes:\n");
+    (void) printf("\t\t\tDimension of the depth axis (\"1\" for 2D ");
+    (void) printf("input).\n");
+    (void) printf("\t\tnrows:\n");
+    (void) printf("\t\t\tDimension of the vertical axis.\n");
+    (void) printf("\t\tncols:\n");
+    (void) printf("\t\t\tDimension of the horizontal axis.\n");
+    (void) printf("\t\tmax_value:\n");
+    (void) printf("\t\t\tMaximum data value.\n");
+    (void) printf("\t\tmin_value:\n");
+    (void) printf("\t\t\tMinimum data value.\n");
+    (void) printf("\t\tplane1, plane2, plane3, ...:\n");
+    (void) printf("\t\t\tScales for depth axis.\n");
+    (void) printf("\t\trow1, row2, row3, ...:\n");
+    (void) printf("\t\t\tScales for the vertical axis.\n");
+    (void) printf("\t\tcol1, col2, col3, ...:\n");
+    (void) printf("\t\t\tScales for the horizontal axis.\n");
+    (void) printf("\t\tdata1, data2, data3, ...:\n");
+    (void) printf("\t\t\tThe data ordered by rows, left to right and ");
+    (void) printf("top\n");
+    (void) printf("\t\t\tto bottom; then optionally, ordered by planes,\n");
+    (void) printf("\t\t\tfront to back.\n\n");
+    (void) printf("\tFor FP32 and FP64 input format, \"format\", ");
+    (void) printf("\"nplanes\", \"nrows\", \"ncols\",\n");
+    (void) printf("\tand \"nplanes\" are native integers; where ");
+    (void) printf("\"format\" is the integer\n");
+    (void) printf("\trepresentation of the appropriate 4-character ");
+    (void) printf("string (0x46503332 for\n");
+    (void) printf("\t\"FP32\" and 0x46503634 for \"FP64\").  The ");
+    (void) printf("remaining input fields are\n");
+    (void) printf("\tcomposed of native 32-bit floating point values for ");
+    (void) printf("FP32 input format,\n");
+    (void) printf("\tor native 64-bit floating point values for FP64 ");
+    (void) printf("input format.\n\n");
+    (void) printf("Examples:\n");
+    (void) printf("\tConvert floating point data in \"f1.txt\" to SDS ");
+    (void) printf("format, and store it\n");
+    (void) printf("\tas an SDS in HDF file \"o1\":\n\n");
+    (void) printf("\t\t%s f1.txt -o o1\n\n", name);
+    (void) printf("\tConvert floating point data in \"f2.hdf\" to ");
+    (void) printf("8-bit raster format, and\n");
+    (void) printf("\tstore it as an RIS8 in HDF file \"o2\":\n\n");
+    (void) printf("\t\t%s f2.hdf -o o2 -r\n\n", name);
+    (void) printf("\tConvert floating point data in \"f3.bin\" to ");
+    (void) printf("8-bit raster format and\n");
+    (void) printf("\tSDS format, and store both the RIS8 and the SDS ");
+    (void) printf("in HDF file \"o3\":\n\n");
+    (void) printf("\t\t%s f3.bin -o o3 -r -f\n\n", name);
+    (void) printf("\tConvert floating point data in \"f4\" to a ");
+    (void) printf("500x600 raster image, and\n");
+    (void) printf("\tstore the RIS8 in HDF file \"o4\".  Also store a ");
+    (void) printf("palette from \"palfile\"\n");
+    (void) printf("\twith the image:\n\n");
+    (void) printf("\t\t%s f4 -o o4 -r -e 500 600 -p palfile\n\n", name);
+    (void) printf("\tConvert floating point data in \"f5\" to 200 ");
+    (void) printf("planes of 500x600 raster\n");
+    (void) printf("\timages, and store the RIS8 in HDF file \"o5\".  ");
+    (void) printf("Also scale the image\n");
+    (void) printf("\tdata so that it is centered about a mean value ");
+    (void) printf("of 10.0:\n\n");
+    (void) printf("\t\t%s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name);
+
+    return;
+}
+
+/*
+ * Name:
+ *      indexes
+ *
+ * Purpose:
+ *      For each pixel location along an axis, determine the nearest
+ *      scale value neighbor.  Return a list of indexes into the scale
+ *      array.
+ */
+static int
+indexes(float32 *scale, int dim, int *idx, int res)
+{
+    int         i, j;
+    float32    *midpt;
+    float32     loc;
+    float32     delta;
+
+    const char *err1 = "Unable to allocate dynamic memory.\n";
+
+    /*
+     * determine the midpoints between scale values
+     */
+    if ((midpt = (float32 *) HDmalloc((size_t) dim * sizeof(float32))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    for (i = 0; i < dim - 1; i++)
+        midpt[i] = (scale[i] + scale[i + 1]) * (float32)0.5;
+    midpt[dim - 1] = scale[dim - 1] + (scale[dim - 1] - midpt[dim - 2]);
+
+    /*
+     * determine the distance between pixel locations
+     */
+    delta = (scale[dim - 1] - scale[0]) / (float32)(res - 1);
+
+    /*
+     * compute indexes, keeping the index the same until the location
+     * extends beyond the midpoint
+     */
+    for (i = 1, j = 0, idx[0] = 0, loc = scale[0]; i < res; i++)
+      {
+          loc += delta;
+          idx[i] = idx[i - 1];
+          while (loc >= midpt[j])
+            {
+                idx[i] += 1;
+                j += 1;
+            }
+      }
+
+    /*
+     * free dynamically allocated memory
+     */
+    HDfree((char *) midpt);
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      interp
+ *
+ * Purpose:
+ *      Use a bilinear, or trilinear, interpolation scheme to construct
+ *      the raster image(s).
+ *
+ *  Bug revision:  the line that previously read:
+ *
+ *      hratio[i] = ((hrange > 0) ? 1.0 : -1.0) * (in->hscale[j+1] -
+ *                    loc) / (in->hscale[j+1] - in->hscale[j]);
+ *    has been changed to read:
+ *      hratio[i] = (in->hscale[j+1] - loc) / (in->hscale[j+1] - in->hscale[j]);
+ *
+ *    Similar changes were made to the corresponding lines for
+ *    computing vratio and dratio.
+ *
+ *  Bug revision: If values occur that are outside the ranges of the
+ *    max and min values provided, these values are now "clipped" to
+ *    be the same as the max and min, respectively.
+ */
+
+static int
+interp(struct Input *in, struct Raster *im)
+{
+    int         i, j, k, m;
+    int        *hinc, *voff, *doff = NULL;
+    float32     pix;
+    float32     loc;
+    float32     range;
+    float32     ratio;
+    float32     hrange, vrange, drange = (float32)0.0;
+    float32     hdelta, vdelta, ddelta = (float32)0.0;
+    float32     t1, t2, t3, t4, t5, t6;
+    float32    *hratio, *vratio, *dratio = NULL;
+    float32    *pt[8];
+    unsigned char *ip = im->image;
+
+    const char *err1 = "Unable to allocate dynamic memory.\n";
+
+    /*
+     * determine the range of pixel locations
+     */
+    range = in->max - in->min;
+    ratio = (float32)237.9 / range;
+    hrange = in->hscale[in->dims[0] - 1] - in->hscale[0];
+    vrange = in->vscale[in->dims[1] - 1] - in->vscale[0];
+    if (in->rank == 3)
+        drange = in->dscale[in->dims[2] - 1] - in->dscale[0];
+
+    /*
+     * determine the distance between pixel locations
+     */
+    hdelta = hrange / (float32)(im->hres - 1);
+    vdelta = vrange / (float32)(im->vres - 1);
+    if (in->rank == 3)
+        ddelta = drange / (float32)(im->dres - 1);
+
+    /*
+     * allocate dynamic memory for the interpolation ratio buffers
+     */
+    if ((hratio = (float32 *) HDmalloc((size_t) im->hres * sizeof(float32))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if ((vratio = (float32 *) HDmalloc((unsigned int) im->vres *
+                                         sizeof(float32))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if (in->rank == 3)
+      {
+          if ((dratio = (float32 *) HDmalloc((unsigned int) im->dres *
+                                               sizeof(float32))) == NULL)
+            {
+                (void) fprintf(stderr, err1);
+                goto err;
+            }
+      }
+
+    /*
+     * allocate dynamic memory for the pixel location offset/increment
+     * buffers
+     */
+    if ((hinc = (int *) HDmalloc((unsigned int) im->hres *
+                                   sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if ((voff = (int *) HDmalloc((unsigned int) (im->vres + 1) *
+                                   sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if (in->rank == 3)
+      {
+          if ((doff = (int *) HDmalloc((unsigned int) (im->dres + 1) *
+                                         sizeof(int))) == NULL)
+            {
+                (void) fprintf(stderr, err1);
+                goto err;
+            }
+      }
+
+    /*
+     * compute the interpolation ratios and pixel location
+     * offsets/increments for each axis
+     */
+    for (i = 0, j = 0; i < im->hres; i++)
+      {
+          loc = hdelta * (float) i + in->hscale[0];
+          hinc[i] = 0;
+          while ((j < (in->dims[0] - 2)) && ((hrange > (float32)0.0) ?
+                     (in->hscale[j + 1] < loc) : (in->hscale[j + 1] > loc)))
+            {
+                hinc[i] += 1;
+                j += 1;
+            }
+          hratio[i] = (in->hscale[j + 1] - loc) / (in->hscale[j + 1] - in->hscale[j]);
+      }
+    for (i = 0, j = 0, voff[0] = 0; i < im->vres; i++)
+      {
+          loc = vdelta * (float) i + in->vscale[0];
+          while ((j < (in->dims[1] - 2)) && ((vrange > (float32)0.0) ?
+                     (in->vscale[j + 1] < loc) : (in->vscale[j + 1] > loc)))
+            {
+                voff[i] += 1;
+                j += 1;
+            }
+          vratio[i] = (in->vscale[j + 1] - loc) / (in->vscale[j + 1] - in->vscale[j]);
+          voff[i + 1] = voff[i];
+      }
+    if (in->rank == 3)
+      {
+          for (i = 0, j = 0, doff[0] = 0; i < im->dres; i++)
+            {
+                loc = ddelta * (float) i + in->dscale[0];
+                while ((j < (in->dims[2] - 2)) && ((drange > (float32)0.0) ?
+                     (in->dscale[j + 1] < loc) : (in->dscale[j + 1] > loc)))
+                  {
+                      doff[i] += 1;
+                      j += 1;
+                  }
+                dratio[i] = (in->dscale[j + 1] - loc) /
+                    (in->dscale[j + 1] - in->dscale[j]);
+                doff[i + 1] = doff[i];
+            }
+      }
+
+    /*
+     * do the interpolation for each point in the target image, taking
+     * advantage of the fact that the target is evenly spaced along each
+     * axis
+     */
+    if (in->rank == 2)
+      {
+          for (i = 0; i < im->vres; i++)
+            {
+                pt[0] = (float32 *) in->data + (in->dims[0] * voff[i]);
+                pt[1] = pt[0] + 1;
+                pt[2] = pt[0] + in->dims[0];
+                pt[3] = pt[2] + 1;
+                for (j = 0; j < im->hres; j++)
+                  {
+                      for (m = 0; m < 4; m++)
+                          pt[m] += hinc[j];
+                      t1 = *pt[2] - ((*pt[2] - *pt[0]) * vratio[i]);
+                      t2 = *pt[3] - ((*pt[3] - *pt[1]) * vratio[i]);
+                      pix = t2 - ((t2 - t1) * hratio[j]);
+                      if (pix > in->max)
+                          pix = in->max;    /* clip (bug fix) */
+                      if (pix < in->min)
+                          pix = in->min;    /* ditto */
+                      *ip++ = (unsigned char)((ratio * (pix - in->min)) + (float32)1.5);
+                  }
+            }
+      }
+    else
+      {     /* rank == 3 */
+          for (i = 0; i < im->dres; i++)
+            {
+                for (j = 0; j < im->vres; j++)
+                  {
+                      pt[0] = (float32 *) in->data + (in->dims[0] * voff[j]) +
+                          (in->dims[0] * in->dims[1] * doff[i]);
+                      pt[1] = pt[0] + 1;
+                      pt[2] = pt[0] + in->dims[0];
+                      pt[3] = pt[2] + 1;
+                      pt[4] = pt[0] + (in->dims[0] * in->dims[1]);
+                      pt[5] = pt[4] + 1;
+                      pt[6] = pt[4] + in->dims[0];
+                      pt[7] = pt[6] + 1;
+                      for (k = 0; k < im->hres; k++)
+                        {
+                            for (m = 0; m < 8; m++)
+                                pt[m] += hinc[k];
+                            t1 = *pt[4] - ((*pt[4] - *pt[0]) *
+                                           dratio[i]);
+                            t2 = *pt[6] - ((*pt[6] - *pt[2]) *
+                                           dratio[i]);
+                            t3 = *pt[5] - ((*pt[5] - *pt[1]) *
+                                           dratio[i]);
+                            t4 = *pt[7] - ((*pt[7] - *pt[3]) *
+                                           dratio[i]);
+                            t5 = t2 - ((t2 - t1) * vratio[j]);
+                            t6 = t4 - ((t4 - t3) * vratio[j]);
+                            pix = t6 - ((t6 - t5) * hratio[k]);
+                            if (pix > in->max)
+                                pix = in->max;  /* clip (bug fix) */
+                            if (pix < in->min)
+                                pix = in->min;  /* ditto */
+                            *ip++ = (unsigned char)((ratio * (pix - in->min)) + (float32)1.5);
+                        }
+                  }
+            }
+      }
+
+    /*
+     * free dynamically allocated memory
+     */
+    HDfree((char *) hratio);
+    HDfree((char *) vratio);
+    if (in->rank == 3)
+        HDfree((char *) dratio);
+    HDfree((char *) hinc);
+    HDfree((char *) voff);
+    if (in->rank == 3)
+        HDfree((char *) doff);
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      isnum
+ *
+ * Purpose:
+ *      Determine whether or not the string is representative of an
+ *      integer or floating point number.  If it is, a non-zero value
+ *      is returned.  A leading (-) to denote sign is acceptable.
+ */
+static int
+isnum(char *s)
+{
+    char       *cp;
+    int         rval = FALSE;
+
+    /*
+     * check to see if its a floating point number
+     */
+    cp = s;
+    (void) strtod(s, &cp);
+    if ((*cp == '\0') && (cp != s))
+        rval = TRUE;
+
+    /*
+     * check to see if its an integer number (radix 8, 10, or 16)
+     */
+    else
+      {
+          cp = s;
+          (void) strtol(s, &cp, 0);
+          if ((*cp == '\0') && (cp != s))
+              rval = TRUE;
+      }
+
+    return (rval);
+}
+
+/*
+ * Name:
+ *      mean
+ *
+ * Purpose:
+ *      Reset the maximum and minimum data values to be symmetric about
+ *      the user-specified mean value.
+ */
+void
+mean(struct Input *in,struct Options * opt)
+{
+    float32     delta, delta_max, delta_min;
+
+    delta_max = (float32)fabs((double)(in->max - opt->meanval));
+    delta_min = (float32)fabs((double)(opt->meanval - in->min));
+    delta = (delta_max > delta_min) ? delta_max : delta_min;
+
+    in->max = opt->meanval + delta;
+    in->min = opt->meanval - delta;
+
+    return;
+}
+
+/*
+ * Name:
+ *      palette
+ *
+ * Purpose:
+ *      Process the (user specified) palette input file.
+ */
+static int
+palette(char *palfile)
+{
+    unsigned char *color;
+    unsigned char pal[1024], red[256], green[256], blue[256];
+    FILE       *strm;
+    int         i;
+
+    const char *err1 = "Unable to get palette from file: %s.\n";
+    const char *err2 = "Unable to open palette file: %s.\n";
+    const char *err3 = "Unable to set default palette.\n";
+
+    /*
+     * extract a palette from an HDF file
+     */
+    if (Hishdf(palfile))
+      {
+          if (DFPgetpal(palfile, pal))
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+
+          /*
+           * read in a raw palette file
+           */
+      }
+    else
+      {
+          if ((strm = fopen(palfile, "r")) == NULL)
+            {
+                (void) fprintf(stderr, err2, palfile);
+                goto err;
+            }
+          if (fread((char *) red, 1, 256, strm) != 256)
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+          else if (fread((char *) green, 1, 256, strm) != 256)
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+          else if (fread((char *) blue, 1, 256, strm) != 256)
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+          (void) fclose(strm);
+
+          /*
+           * interleave the R,G,B values
+           */
+          color = pal;
+          for (i = 0; i < 256; i++)
+            {
+                *color++ = red[i];
+                *color++ = green[i];
+                *color++ = blue[i];
+            }
+      }
+
+    /*
+     * set up the palette as the default for subsequent images
+     */
+    if (DFR8setpalette(pal))
+      {
+          (void) fprintf(stderr, err3);
+          goto err;
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      pixrep
+ *
+ * Purpose:
+ *      Expand the image(s) to the desired resolution using pixel
+ *      replication.
+ */
+static int
+pixrep(struct Input *in, struct Raster *im)
+{
+    int        *hidx, *vidx, *didx;
+    int         ovidx, odidx;
+    int         dummy;
+    int32       i, j, k;
+    float32    *dp;
+    float32     range;
+    float32     ratio;
+    unsigned char *ip, *plane, *row, *pix;
+
+    const char *err1 = "Unable to dynamically allocate memory.\n";
+
+    dp = (float32 *) in->data;
+    ip = im->image;
+    range = in->max - in->min;
+    ratio = (float32)237.9 / range;
+
+    /*
+     * determine the scale indexes of the horizontal pixel locations
+     */
+    if ((hidx = (int *) HDmalloc((unsigned int) (im->hres + 1) * sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+
+    if (indexes(in->hscale, in->dims[0], hidx, im->hres))
+        goto err;
+
+    /*
+     * determine the scale indexes of the vertical pixel locations
+     */
+    if ((vidx = (int *) HDmalloc((unsigned int) (im->vres + 1) *
+                                   sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+
+    if (indexes(in->vscale, in->dims[1], vidx, im->vres))
+        goto err;
+
+    /*
+     * determine the scale indexes of the depth plane locations
+     */
+    dummy = 0;
+    didx = &dummy;
+    if (in->rank == 3)
+      {
+          if ((didx = (int *) HDmalloc((unsigned int) (im->dres + 1) *
+                                         sizeof(int))) == NULL)
+            {
+                (void) fprintf(stderr, err1);
+                goto err;
+            }
+
+          if (indexes(in->dscale, in->dims[2], didx, im->dres))
+              goto err;
+      }
+
+    /*
+     * compute the expanded image
+     */
+    if ((pix = (unsigned char *) HDmalloc((unsigned int) (in->dims[0] + 1))) ==
+        NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    for (k = 0, odidx = didx[0] - 1; k < im->dres; k++)
+      {
+          /*
+           * construct a new depth plane
+           */
+          if (didx[k] > odidx)
+            {
+                for (j = 0, ovidx = vidx[0] - 1; j < im->vres; j++)
+                  {
+                      /*
+                       * construct a new row
+                       */
+                      if (vidx[j] > ovidx)
+                        {
+                            for (i = 0; i < in->dims[0]; i++)
+                                pix[i] = (unsigned char )((ratio * (*dp++ - in->min)) + (float32)1.5);
+                            for (i = 0; i < im->hres; i++)
+                                *ip++ = pix[hidx[i]];
+                            /*
+                             * repeat the previous row
+                             */
+                        }
+                      else
+                        {
+                            row = ip - im->hres;
+                            for (i = 0; i < im->hres; i++)
+                                *ip++ = *row++;
+                        }
+                      ovidx = vidx[j];
+                  }
+                /*
+                 * repeat the previous depth plane
+                 */
+            }
+          else
+            {
+                plane = ip - (im->hres * im->vres);
+                for (j = 0; j < im->vres; j++)
+                    for (i = 0; i < im->hres; i++)
+                        *ip++ = plane[(j * im->hres) + i];
+            }
+          odidx = didx[k];
+      }
+
+    /*
+     * free dynamically allocated space
+     */
+    HDfree((char *) hidx);
+    HDfree((char *) vidx);
+    if (in->rank == 3)
+        HDfree((char *) didx);
+    HDfree((char *) pix);
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      process
+ *
+ * Purpose:
+ *      Process each input file.
+ */
+static int
+process(struct Options *opt)
+{
+    struct Input in;
+    struct Raster im;
+    unsigned char *ip;
+    int         i, j;
+    int         is_maxmin;
+    int         is_scale;
+    int32       hdfdims[3];     /* order: ZYX or YX */
+    int32       len;
+    FILE       *strm;
+    int32       hdf;
+#ifdef  DEBUG
+    int         h, v, d;
+#endif /* DEBUG */
+
+    const char *err1 = "Error creating HDF output file: %s.\n";
+    const char *err2 = "Unable to dynamically allocate memory.\n";
+    const char *err3a = "Warning: cannot make image smaller using -e ";
+    const char *err3b = "option.\n\t %s resolution will be made the ";
+    const char *err3c = "same as %s dimension of the\n\t dataset, ";
+    const char *err3d = "which is: %d.\n\n";
+    const char *err4 = "Unable to write an RIS8 to the HDF output file\n";
+    const char *err5 = "Unable to write an SDS to the HDF output file\n";
+
+    /*
+     * process the palette file (if one was specified)
+     */
+    if (opt->pal == TRUE)
+        if (palette(opt->palfile))
+            goto err;
+
+    /*
+     * create the HDF output file
+     */
+    if ((hdf = Hopen(opt->outfile, DFACC_CREATE, 0)) == FAIL)
+      {
+          (void) fprintf(stderr, err1, opt->outfile);
+          goto err;
+      }
+    (void) Hclose(hdf);
+
+    /*
+     * main loop: process input files, one per pass
+     */
+    for (i = 0; i < opt->fcount; i++)
+      {
+          /*
+           * initialize key parameters
+           */
+          in.is_hdf = FALSE;
+          in.is_text = FALSE;
+          in.is_fp32 = FALSE;
+          in.is_fp64 = FALSE;
+          is_maxmin = FALSE;
+          is_scale = FALSE;
+
+          /*
+           * get the file type, input data dimensions, and input data
+           * max/min values
+           */
+          if (gtype(opt->infiles[i], &in, &strm))
+              goto err;
+          if (gdimen(opt->infiles[i], &in, strm))
+              goto err;
+          if (gmaxmin(opt->infiles[i], &in, strm, &is_maxmin))
+              goto err;
+
+          /*
+           * get the scale for each axis
+           */
+          if ((in.hscale = (float32 *) HDmalloc((size_t)
+                             (in.dims[0] + 1) * sizeof(float32))) == NULL)
+            {
+                (void) fprintf(stderr, err2);
+                goto err;
+            }
+          if ((in.vscale = (float32 *) HDmalloc((size_t)
+                             (in.dims[1] + 1) * sizeof(float32))) == NULL)
+            {
+                (void) fprintf(stderr, err2);
+                goto err;
+            }
+          if (in.rank == 3)
+            {
+                if ((in.dscale = (float32 *) HDmalloc((size_t)
+                             (in.dims[2] + 1) * sizeof(float32))) == NULL)
+                  {
+                      (void) fprintf(stderr, err2);
+                      goto err;
+                  }
+            }
+          if (gscale(opt->infiles[i], &in, strm, &is_scale))
+              goto err;
+
+          /*
+           * get the input data
+           */
+          len = in.dims[0] * in.dims[1] * in.dims[2];
+          if ((in.data = (VOIDP) HDmalloc((size_t) len *
+                                                 sizeof(float32))) == NULL)
+            {
+                (void) fprintf(stderr, err2);
+                goto err;
+            }
+          if (gdata(opt->infiles[i], &in, strm, &is_maxmin))
+              goto err;
+
+          /*
+           * put the input data in the HDF output file, in SDS format
+           */
+          if (opt->to_float == TRUE)
+            {
+                /*
+                 * hdfdims is ordered: ZYX or YX
+                 * in.dims is ordered: XYZ
+                 */
+                if (in.rank == 2)
+                  {
+                      hdfdims[0] = in.dims[1];
+                      hdfdims[1] = in.dims[0];
+                  }
+                else
+                  {
+                      hdfdims[0] = in.dims[2];
+                      hdfdims[1] = in.dims[1];
+                      hdfdims[2] = in.dims[0];
+                  }
+
+                if (DFSDsetNT(DFNT_FLOAT32))
+                  {
+                      (void) fprintf(stderr, err5);
+                      goto err;
+                  }
+                if (is_scale == TRUE)
+                  {
+                      if (DFSDsetdims(in.rank, hdfdims))
+                        {
+                            (void) fprintf(stderr, err5);
+                            goto err;
+                        }
+                      if (DFSDsetrange(&in.max, &in.min))
+                        {
+                            (void) fprintf(stderr, err5);
+                            goto err;
+                        }
+                      if (in.rank == 2)
+                        {
+                            if (DFSDsetdimscale(1, hdfdims[0],
+                                                in.vscale))
+                              {
+                                  (void) fprintf(stderr, err5);
+                                  goto err;
+                              }
+                            if (DFSDsetdimscale(2, hdfdims[1],
+                                                in.hscale))
+                              {
+                                  (void) fprintf(stderr, err5);
+                                  goto err;
+                              }
+                        }
+                      else
+                        {
+                            if (DFSDsetdimscale(1, hdfdims[0],
+                                                in.dscale))
+                              {
+                                  (void) fprintf(stderr, err5);
+                                  goto err;
+                              }
+                            if (DFSDsetdimscale(2, hdfdims[1],
+                                                in.vscale))
+                              {
+                                  (void) fprintf(stderr, err5);
+                                  goto err;
+                              }
+                            if (DFSDsetdimscale(3, hdfdims[2],
+                                                in.hscale))
+                              {
+                                  (void) fprintf(stderr, err5);
+                                  goto err;
+                              }
+                        }
+                  }
+                if (DFSDadddata(opt->outfile, in.rank, hdfdims, in.data))
+                  {
+                      (void) fprintf(stderr, err5);
+                      goto err;
+                  }
+            }
+
+          /*
+           * put the input data in the HDF output file, in RIS8 format
+           */
+          if (opt->to_image == TRUE)
+            {
+                /*
+                 * allocate a buffer for the output image
+                 */
+                im.hres = (opt->hres == 0) ? in.dims[0] : opt->hres;
+                if ((im.hres < in.dims[0]) && (opt->ctm == EXPAND))
+                  {
+                      (void) fprintf(stderr, err3a);
+                      (void) fprintf(stderr, err3b, "Horiz.");
+                      (void) fprintf(stderr, err3c, "horiz.");
+                      (void) fprintf(stderr, err3d, in.dims[0]);
+                      im.hres = in.dims[0];
+                      opt->hres = in.dims[0];
+                  }
+                im.vres = (opt->vres == 0) ? in.dims[1] : opt->vres;
+                if ((im.vres < in.dims[1]) && (opt->ctm == EXPAND))
+                  {
+                      (void) fprintf(stderr, err3a);
+                      (void) fprintf(stderr, err3b, "Vert.");
+                      (void) fprintf(stderr, err3c, "vert.");
+                      (void) fprintf(stderr, err3d, in.dims[1]);
+                      im.vres = in.dims[1];
+                      opt->vres = in.dims[1];
+                  }
+                im.dres = 1;
+                if (in.rank == 3)
+                  {
+                      im.dres = (opt->dres == 0) ? in.dims[2] :
+                          opt->dres;
+                      if ((im.dres < in.dims[2]) &&
+                          (opt->ctm == EXPAND))
+                        {
+                            (void) fprintf(stderr, err3a);
+                            (void) fprintf(stderr, err3b, "Depth");
+                            (void) fprintf(stderr, err3c, "depth");
+                            (void) fprintf(stderr, err3d,
+                                           in.dims[2]);
+                            im.dres = in.dims[2];
+                            opt->dres = in.dims[2];
+                        }
+                  }
+                len = im.hres * im.vres * im.dres;
+                if ((im.image = (unsigned char *) HDmalloc((unsigned
+                                                         int) len)) == NULL)
+                  {
+                      (void) fprintf(stderr, err2);
+                      goto err;
+                  }
+
+                /*
+                 * reset max/min symmetrically about the mean value
+                 */
+                if (opt->mean == TRUE)
+                    mean(&in, opt);
+
+                /*
+                 * perform pixel replication or interpolation
+                 */
+                if (opt->ctm == EXPAND)
+                  {
+                      if (pixrep(&in, &im))
+                          goto err;
+                  }
+                else
+                  {     /* INTERP */
+                      if (interp(&in, &im))
+                          goto err;
+                  }
+
+                len = im.hres * im.vres;
+                for (j = 0, ip = im.image; j < im.dres; j++, ip += len)
+                  {
+                      if (DFR8addimage(opt->outfile, ip, im.hres,
+                                       im.vres, DFTAG_RLE))
+                        {
+                            (void) fprintf(stderr, err4);
+                            goto err;
+                        }
+                  }
+
+#ifdef  DEBUG
+                (void) printf("Output Raster Information ...\n\n");
+                (void) printf("\tresolution (horiz,vert,[depth]):\n\n");
+                if (in.rank == 2)
+                    (void) printf("\t%d %d\n\n", im.hres, im.vres);
+                else
+                    (void) printf("\t%d %d %d\n\n", im.hres,
+                                  im.vres, im.dres);
+                if (opt->mean == TRUE)
+                  {
+                      (void) printf("\tadjusted max/min values:\n\n");
+                      (void) printf("\t%f %f\n\n", in.max, in.min);
+                  }
+                (void) printf("\tcolor index values:");
+                for (d = 0, ip = im.image; d < im.dres; d++)
+                  {
+                      (void) printf("\n");
+                      for (v = 0; v < im.vres; v++)
+                        {
+                            (void) printf("\n");
+                            for (h = 0; h < im.hres; h++, ip++)
+                                (void) printf("\t%d", *ip);
+                        }
+                  }
+                (void) printf("\n");
+#endif /* DEBUG */
+            }
+
+          /*
+           * free dynamically allocated space
+           */
+          HDfree((char *) in.hscale);
+          HDfree((char *) in.vscale);
+          if (in.rank == 3)
+              HDfree((char *) in.dscale);
+          HDfree((char *) in.data);
+          if (opt->to_image == TRUE)
+              HDfree((char *) im.image);
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      usage
+ *
+ * Purpose:
+ *      Print a summary of command usage.
+ */
+void
+usage(char *name)
+{
+    (void) fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name);
+    (void) fprintf(stderr, "\t%s <infile> [<infile>...] ", name);
+    (void) fprintf(stderr, "-o[utfile] <outfile> [options...]\n\n");
+    (void) fprintf(stderr, "\toptions...\n");
+    (void) fprintf(stderr, "\t    -r[aster]:\n");
+    (void) fprintf(stderr, "\t        produce an image.  Could be ");
+    (void) fprintf(stderr, "followed by:\n");
+    (void) fprintf(stderr, "\t        -e[xpand] <horiz> <vert> ");
+    (void) fprintf(stderr, "[<depth>]:\n");
+    (void) fprintf(stderr, "\t            resolution with pixel ");
+    (void) fprintf(stderr, "replication\n");
+    (void) fprintf(stderr, "\t        -i[nterp] <horiz> <vert> ");
+    (void) fprintf(stderr, "[<depth>]:\n");
+    (void) fprintf(stderr, "\t            resolution with interpolation\n");
+    (void) fprintf(stderr, "\t        -p[alfile] <palfile>:\n");
+    (void) fprintf(stderr, "\t            include palette from palfile\n");
+    (void) fprintf(stderr, "\t        -m[ean] <meanval>:\n");
+    (void) fprintf(stderr, "\t            mean value to scale image ");
+    (void) fprintf(stderr, "around\n");
+    (void) fprintf(stderr, "\t    -f[loat]:\n");
+    (void) fprintf(stderr, "\t        produce floating point data\n\n");
+
+    return;
+}
diff --git a/hdf/util/fp2hdf.input1 b/hdf/util/fp2hdf.input1
new file mode 100644
index 0000000..68dd25a
--- /dev/null
+++ b/hdf/util/fp2hdf.input1
@@ -0,0 +1,49 @@
+open cb32r2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb32r3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r2_ris.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr2_ris.hdf
+prev tag = 30
+next tag = 303
+info
+dump -byte
+close
+quit
diff --git a/hdf/util/fp2hdf.input1-32 b/hdf/util/fp2hdf.input1-32
new file mode 100644
index 0000000..34bb824
--- /dev/null
+++ b/hdf/util/fp2hdf.input1-32
@@ -0,0 +1,37 @@
+open cb64r2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r2_ris.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr2_ris.hdf
+prev tag = 30
+next tag = 303
+info
+dump -byte
+close
+quit
diff --git a/hdf/util/fp2hdf.out1 b/hdf/util/fp2hdf.out1
new file mode 100644
index 0000000..96d7e3c
--- /dev/null
+++ b/hdf/util/fp2hdf.out1
@@ -0,0 +1,242 @@
+ctxtr2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      22 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	      48 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      30 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+ctxtr3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      30 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	     240 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      51 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+cb32r2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      22 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	      48 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      30 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+cb32r3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      30 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	     240 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      51 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+cb64r2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      22 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	      48 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      30 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+cb64r3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      30 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	     240 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      51 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+ctxtr2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      2	     400 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      2	     400 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+
+cb64r2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      3	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      3	    2550 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      3	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      3	    2550 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      3	       8 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      22 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	      48 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      30 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
diff --git a/hdf/util/fp2hdf.out1-32 b/hdf/util/fp2hdf.out1-32
new file mode 100644
index 0000000..1d658c5
--- /dev/null
+++ b/hdf/util/fp2hdf.out1-32
@@ -0,0 +1,184 @@
+ctxtr2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      22 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	      48 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      30 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+ctxtr3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      30 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	     240 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      51 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+cb64r2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      22 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	      48 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      30 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+cb64r3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      30 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	     240 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      51 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
+ctxtr2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      2	     400 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      2	     400 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+
+cb64r2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      3	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      3	    2550 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      3	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      3	    2550 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      3	       8 bytes
+
+Scientific Data Group         : (tag 700)
+	Ref no      2	      20 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no      2	      22 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      2	      48 bytes
+
+SciData scales                : (tag 703)
+	Ref no      2	      30 bytes
+
+SciData max/min               : (tag 707)
+	Ref no      2	       8 bytes
+
+Links related to the dataset  : (tag 710)
+	Ref no      2	       8 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      20 bytes
+
diff --git a/hdf/util/fp2hdf.out2 b/hdf/util/fp2hdf.out2
new file mode 100644
index 0000000..43a4816
--- /dev/null
+++ b/hdf/util/fp2hdf.out2
@@ -0,0 +1,123 @@
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    3.200000e+01   3.400000e+01   3.600000e+01   3.800000e+01
+      16:    3.300000e+01   3.500000e+01   3.700000e+01   3.900000e+01
+      32:    3.400000e+01   3.600000e+01   3.800000e+01   4.000000e+01
+      48: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    8.300000e+01   8.500000e+01   8.700000e+01   8.900000e+01
+      16:    8.400000e+01   8.600000e+01   8.800000e+01   9.000000e+01
+      32:    8.500000e+01   8.700000e+01   8.900000e+01   9.100000e+01
+      48:    8.800000e+01   9.000000e+01   9.200000e+01   9.400000e+01
+      64:    8.900000e+01   9.100000e+01   9.300000e+01   9.500000e+01
+      80:    9.000000e+01   9.200000e+01   9.400000e+01   9.600000e+01
+      96:    9.300000e+01   9.500000e+01   9.700000e+01   9.900000e+01
+     112:    9.400000e+01   9.600000e+01   9.800000e+01   1.000000e+02
+     128:    9.500000e+01   9.700000e+01   9.900000e+01   1.010000e+02
+     144:    9.800000e+01   1.000000e+02   1.020000e+02   1.040000e+02
+     160:    9.900000e+01   1.010000e+02   1.030000e+02   1.050000e+02
+     176:    1.000000e+02   1.020000e+02   1.040000e+02   1.060000e+02
+     192:    1.030000e+02   1.050000e+02   1.070000e+02   1.090000e+02
+     208:    1.040000e+02   1.060000e+02   1.080000e+02   1.100000e+02
+     224:    1.050000e+02   1.070000e+02   1.090000e+02   1.110000e+02
+     240: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    3.200000e+01   3.400000e+01   3.600000e+01   3.800000e+01
+      16:    3.300000e+01   3.500000e+01   3.700000e+01   3.900000e+01
+      32:    3.400000e+01   3.600000e+01   3.800000e+01   4.000000e+01
+      48: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    8.300000e+01   8.500000e+01   8.700000e+01   8.900000e+01
+      16:    8.400000e+01   8.600000e+01   8.800000e+01   9.000000e+01
+      32:    8.500000e+01   8.700000e+01   8.900000e+01   9.100000e+01
+      48:    8.800000e+01   9.000000e+01   9.200000e+01   9.400000e+01
+      64:    8.900000e+01   9.100000e+01   9.300000e+01   9.500000e+01
+      80:    9.000000e+01   9.200000e+01   9.400000e+01   9.600000e+01
+      96:    9.300000e+01   9.500000e+01   9.700000e+01   9.900000e+01
+     112:    9.400000e+01   9.600000e+01   9.800000e+01   1.000000e+02
+     128:    9.500000e+01   9.700000e+01   9.900000e+01   1.010000e+02
+     144:    9.800000e+01   1.000000e+02   1.020000e+02   1.040000e+02
+     160:    9.900000e+01   1.010000e+02   1.030000e+02   1.050000e+02
+     176:    1.000000e+02   1.020000e+02   1.040000e+02   1.060000e+02
+     192:    1.030000e+02   1.050000e+02   1.070000e+02   1.090000e+02
+     208:    1.040000e+02   1.060000e+02   1.080000e+02   1.100000e+02
+     224:    1.050000e+02   1.070000e+02   1.090000e+02   1.110000e+02
+     240: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    3.200000e+01   3.400000e+01   3.600000e+01   3.800000e+01
+      16:    3.300000e+01   3.500000e+01   3.700000e+01   3.900000e+01
+      32:    3.400000e+01   3.600000e+01   3.800000e+01   4.000000e+01
+      48: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    8.300000e+01   8.500000e+01   8.700000e+01   8.900000e+01
+      16:    8.400000e+01   8.600000e+01   8.800000e+01   9.000000e+01
+      32:    8.500000e+01   8.700000e+01   8.900000e+01   9.100000e+01
+      48:    8.800000e+01   9.000000e+01   9.200000e+01   9.400000e+01
+      64:    8.900000e+01   9.100000e+01   9.300000e+01   9.500000e+01
+      80:    9.000000e+01   9.200000e+01   9.400000e+01   9.600000e+01
+      96:    9.300000e+01   9.500000e+01   9.700000e+01   9.900000e+01
+     112:    9.400000e+01   9.600000e+01   9.800000e+01   1.000000e+02
+     128:    9.500000e+01   9.700000e+01   9.900000e+01   1.010000e+02
+     144:    9.800000e+01   1.000000e+02   1.020000e+02   1.040000e+02
+     160:    9.900000e+01   1.010000e+02   1.030000e+02   1.050000e+02
+     176:    1.000000e+02   1.020000e+02   1.040000e+02   1.060000e+02
+     192:    1.030000e+02   1.050000e+02   1.070000e+02   1.090000e+02
+     208:    1.040000e+02   1.060000e+02   1.080000e+02   1.100000e+02
+     224:    1.050000e+02   1.070000e+02   1.090000e+02   1.110000e+02
+     240: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    3.200000e+01   3.400000e+01   3.600000e+01   3.800000e+01
+      16:    3.300000e+01   3.500000e+01   3.700000e+01   3.900000e+01
+      32:    3.400000e+01   3.600000e+01   3.800000e+01   4.000000e+01
+      48: 
+ (2) 	Compressed Image              : (Tag 303) Ref 2
+       0:    137      1    144     60    144    120    137    179 
+       8:    137      1    144     60    144    120    137    179 
+      16:    137      1    144     60    144    120    137    179 
+      24:    137      1    144     60    144    120    137    179 
+      32:    137      1    144     60    144    120    137    179 
+      40:    137      1    144     60    144    120    137    179 
+      48:    137      1    144     60    144    120    137    179 
+      56:    137      1    144     60    144    120    137    179 
+      64:    137      1    144     60    144    120    137    179 
+      72:    137      1    144     60    144    120    137    179 
+      80:    137      1    144     60    144    120    137    179 
+      88:    137      1    144     60    144    120    137    179 
+      96:    137      1    144     60    144    120    137    179 
+     104:    137     31    144     90    144    150    137    209 
+     112:    137     31    144     90    144    150    137    209 
+     120:    137     31    144     90    144    150    137    209 
+     128:    137     31    144     90    144    150    137    209 
+     136:    137     31    144     90    144    150    137    209 
+     144:    137     31    144     90    144    150    137    209 
+     152:    137     31    144     90    144    150    137    209 
+     160:    137     31    144     90    144    150    137    209 
+     168:    137     31    144     90    144    150    137    209 
+     176:    137     31    144     90    144    150    137    209 
+     184:    137     31    144     90    144    150    137    209 
+     192:    137     31    144     90    144    150    137    209 
+     200:    137     31    144     90    144    150    137    209 
+     208:    137     31    144     90    144    150    137    209 
+     216:    137     31    144     90    144    150    137    209 
+     224:    137     31    144     90    144    150    137    209 
+     232:    137     31    144     90    144    150    137    209 
+     240:    137     31    144     90    144    150    137    209 
+     248:    137     31    144     90    144    150    137    209 
+     256:    137     31    144     90    144    150    137    209 
+     264:    137     31    144     90    144    150    137    209 
+     272:    137     31    144     90    144    150    137    209 
+     280:    137     31    144     90    144    150    137    209 
+     288:    137     31    144     90    144    150    137    209 
+     296:    137     60    144    120    144    179    137    239 
+     304:    137     60    144    120    144    179    137    239 
+     312:    137     60    144    120    144    179    137    239 
+     320:    137     60    144    120    144    179    137    239 
+     328:    137     60    144    120    144    179    137    239 
+     336:    137     60    144    120    144    179    137    239 
+     344:    137     60    144    120    144    179    137    239 
+     352:    137     60    144    120    144    179    137    239 
+     360:    137     60    144    120    144    179    137    239 
+     368:    137     60    144    120    144    179    137    239 
+     376:    137     60    144    120    144    179    137    239 
+     384:    137     60    144    120    144    179    137    239 
+     392:    137     60    144    120    144    179    137    239 
+     400: 
diff --git a/hdf/util/fp2hdf.out2-32 b/hdf/util/fp2hdf.out2-32
new file mode 100644
index 0000000..da4def6
--- /dev/null
+++ b/hdf/util/fp2hdf.out2-32
@@ -0,0 +1,101 @@
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    3.200000e+01   3.400000e+01   3.600000e+01   3.800000e+01
+      16:    3.300000e+01   3.500000e+01   3.700000e+01   3.900000e+01
+      32:    3.400000e+01   3.600000e+01   3.800000e+01   4.000000e+01
+      48: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    8.300000e+01   8.500000e+01   8.700000e+01   8.900000e+01
+      16:    8.400000e+01   8.600000e+01   8.800000e+01   9.000000e+01
+      32:    8.500000e+01   8.700000e+01   8.900000e+01   9.100000e+01
+      48:    8.800000e+01   9.000000e+01   9.200000e+01   9.400000e+01
+      64:    8.900000e+01   9.100000e+01   9.300000e+01   9.500000e+01
+      80:    9.000000e+01   9.200000e+01   9.400000e+01   9.600000e+01
+      96:    9.300000e+01   9.500000e+01   9.700000e+01   9.900000e+01
+     112:    9.400000e+01   9.600000e+01   9.800000e+01   1.000000e+02
+     128:    9.500000e+01   9.700000e+01   9.900000e+01   1.010000e+02
+     144:    9.800000e+01   1.000000e+02   1.020000e+02   1.040000e+02
+     160:    9.900000e+01   1.010000e+02   1.030000e+02   1.050000e+02
+     176:    1.000000e+02   1.020000e+02   1.040000e+02   1.060000e+02
+     192:    1.030000e+02   1.050000e+02   1.070000e+02   1.090000e+02
+     208:    1.040000e+02   1.060000e+02   1.080000e+02   1.100000e+02
+     224:    1.050000e+02   1.070000e+02   1.090000e+02   1.110000e+02
+     240: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    3.200000e+01   3.400000e+01   3.600000e+01   3.800000e+01
+      16:    3.300000e+01   3.500000e+01   3.700000e+01   3.900000e+01
+      32:    3.400000e+01   3.600000e+01   3.800000e+01   4.000000e+01
+      48: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    8.300000e+01   8.500000e+01   8.700000e+01   8.900000e+01
+      16:    8.400000e+01   8.600000e+01   8.800000e+01   9.000000e+01
+      32:    8.500000e+01   8.700000e+01   8.900000e+01   9.100000e+01
+      48:    8.800000e+01   9.000000e+01   9.200000e+01   9.400000e+01
+      64:    8.900000e+01   9.100000e+01   9.300000e+01   9.500000e+01
+      80:    9.000000e+01   9.200000e+01   9.400000e+01   9.600000e+01
+      96:    9.300000e+01   9.500000e+01   9.700000e+01   9.900000e+01
+     112:    9.400000e+01   9.600000e+01   9.800000e+01   1.000000e+02
+     128:    9.500000e+01   9.700000e+01   9.900000e+01   1.010000e+02
+     144:    9.800000e+01   1.000000e+02   1.020000e+02   1.040000e+02
+     160:    9.900000e+01   1.010000e+02   1.030000e+02   1.050000e+02
+     176:    1.000000e+02   1.020000e+02   1.040000e+02   1.060000e+02
+     192:    1.030000e+02   1.050000e+02   1.070000e+02   1.090000e+02
+     208:    1.040000e+02   1.060000e+02   1.080000e+02   1.100000e+02
+     224:    1.050000e+02   1.070000e+02   1.090000e+02   1.110000e+02
+     240: 
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+       0:    3.200000e+01   3.400000e+01   3.600000e+01   3.800000e+01
+      16:    3.300000e+01   3.500000e+01   3.700000e+01   3.900000e+01
+      32:    3.400000e+01   3.600000e+01   3.800000e+01   4.000000e+01
+      48: 
+ (2) 	Compressed Image              : (Tag 303) Ref 2
+       0:    137      1    144     60    144    120    137    179 
+       8:    137      1    144     60    144    120    137    179 
+      16:    137      1    144     60    144    120    137    179 
+      24:    137      1    144     60    144    120    137    179 
+      32:    137      1    144     60    144    120    137    179 
+      40:    137      1    144     60    144    120    137    179 
+      48:    137      1    144     60    144    120    137    179 
+      56:    137      1    144     60    144    120    137    179 
+      64:    137      1    144     60    144    120    137    179 
+      72:    137      1    144     60    144    120    137    179 
+      80:    137      1    144     60    144    120    137    179 
+      88:    137      1    144     60    144    120    137    179 
+      96:    137      1    144     60    144    120    137    179 
+     104:    137     31    144     90    144    150    137    209 
+     112:    137     31    144     90    144    150    137    209 
+     120:    137     31    144     90    144    150    137    209 
+     128:    137     31    144     90    144    150    137    209 
+     136:    137     31    144     90    144    150    137    209 
+     144:    137     31    144     90    144    150    137    209 
+     152:    137     31    144     90    144    150    137    209 
+     160:    137     31    144     90    144    150    137    209 
+     168:    137     31    144     90    144    150    137    209 
+     176:    137     31    144     90    144    150    137    209 
+     184:    137     31    144     90    144    150    137    209 
+     192:    137     31    144     90    144    150    137    209 
+     200:    137     31    144     90    144    150    137    209 
+     208:    137     31    144     90    144    150    137    209 
+     216:    137     31    144     90    144    150    137    209 
+     224:    137     31    144     90    144    150    137    209 
+     232:    137     31    144     90    144    150    137    209 
+     240:    137     31    144     90    144    150    137    209 
+     248:    137     31    144     90    144    150    137    209 
+     256:    137     31    144     90    144    150    137    209 
+     264:    137     31    144     90    144    150    137    209 
+     272:    137     31    144     90    144    150    137    209 
+     280:    137     31    144     90    144    150    137    209 
+     288:    137     31    144     90    144    150    137    209 
+     296:    137     60    144    120    144    179    137    239 
+     304:    137     60    144    120    144    179    137    239 
+     312:    137     60    144    120    144    179    137    239 
+     320:    137     60    144    120    144    179    137    239 
+     328:    137     60    144    120    144    179    137    239 
+     336:    137     60    144    120    144    179    137    239 
+     344:    137     60    144    120    144    179    137    239 
+     352:    137     60    144    120    144    179    137    239 
+     360:    137     60    144    120    144    179    137    239 
+     368:    137     60    144    120    144    179    137    239 
+     376:    137     60    144    120    144    179    137    239 
+     384:    137     60    144    120    144    179    137    239 
+     392:    137     60    144    120    144    179    137    239 
+     400: 
diff --git a/hdf/util/fp2hdf.test b/hdf/util/fp2hdf.test
new file mode 100644
index 0000000..3a2e412
--- /dev/null
+++ b/hdf/util/fp2hdf.test
@@ -0,0 +1,128 @@
+#! /bin/csh -f 
+#                   Script for testing fp2hdf
+#
+# The input files used in this script for testing fp2hdf are 
+# described in the file README.test.      
+#
+# Output files can be examined with hdfls to see if basic
+# contents are there.  Those with raster images can be displayed
+# using NCSA Image, DataScope, etc.  Those with floating point
+# data can be examined using hdfed or DataScope.
+# 
+# Note: these tests are not exhaustive.  You may want to add some
+# of your own, especially if you are doing something a little
+# different from what we are testing for.  You may also want to 
+# eliminate some of these tests if they are not relevant.
+# 
+set echo
+# text (100x100) => SDS only 
+./fp2hdf testfiles/fp2hdf/t100x100 -o o1 
+#
+# text => image only
+./fp2hdf testfiles/fp2hdf/t100x100 -o o2 -r
+#
+# text => SDS and image
+./fp2hdf testfiles/fp2hdf/t100x100 -o o3 -r -f
+#
+# hdf (100x100) => SDS and image
+./fp2hdf testfiles/fp2hdf/h100x100 -o o4 -r -f
+#
+# hdf => SDS and image w palette
+./fp2hdf testfiles/fp2hdf/h100x100 -o o5 -f -r -p testfiles/fp2hdf/pal.hdf
+#
+# hdf => 200x200 image, pixel replication 
+./fp2hdf testfiles/fp2hdf/h100x100 -o o6 -r -e 200 200
+#
+# hdf => 200x200 image, bilinear interporlation 
+./fp2hdf testfiles/fp2hdf/h100x100 -o o7 -r -i 200 200
+#
+# hdf => 40x120 interpolated image w palette
+./fp2hdf testfiles/fp2hdf/h100x100 -o o8 -r -i 40 120 -p testfiles/fp2hdf/pal.hdf
+#
+# hdf => 40x120 pixel rep image w palette (should generate and error)
+./fp2hdf testfiles/fp2hdf/h100x100 -o o9 -r -e 40 120 -p testfiles/fp2hdf/pal.hdf
+#
+# hdf (60x75) => 120x160 pixel rep image w palette
+./fp2hdf testfiles/fp2hdf/h60x75 -o o10 -r -e 120 160 -p testfiles/fp2hdf/pal.hdf
+#
+# hdf (100x100, horizontal scale is non-uniform) => SDS and image w palette
+./fp2hdf testfiles/fp2hdf/h100x100h -o o11 -f -r -p testfiles/fp2hdf/pal.hdf
+#
+# hdf (100x100, horiz and vert scales are non-uniform) => SDS and image w pal
+./fp2hdf testfiles/fp2hdf/h100x100hv -o o12 -f -r -p testfiles/fp2hdf/pal.hdf
+#
+# hdf (60x75 vert scale is non-uniform) => 120x160 image with palette
+./fp2hdf testfiles/fp2hdf/h60x75v -o o13 -r -e 120 160 -p testfiles/fp2hdf/pal.hdf
+#
+# hdf (60x75 no scales) => 120x150 pixel rep image with palette
+./fp2hdf testfiles/fp2hdf/h60x75n -o o14 -r -e 120 150 -p testfiles/fp2hdf/pal.hdf
+#
+# From several files => a file with 100x100 images for all of them
+./fp2hdf testfiles/fp2hdf/t100x100 testfiles/fp2hdf/h100x100 testfiles/fp2hdf/h100x100h testfiles/fp2hdf/h100x100hv testfiles/fp2hdf/h60x75 testfiles/fp2hdf/h60x75v -o o15 -r -e 100 100
+#
+# Now do test on the other set of input files
+#
+# C: text (3x4) => SDS 
+./fp2hdf ctxtr2 -o o20 
+#
+# C: text (3x4x5) => SDS 
+./fp2hdf ctxtr3 -o o21
+#
+# C: binary 32-bit (3x4) => SDS
+./fp2hdf cb32r2 -o o22 
+#
+# C: binary 32-bit (3x4x5) => SDS 
+./fp2hdf cb32r3 -o o23 
+#
+# C: binary 64-bit (3x4) => SDS 
+./fp2hdf cb64r2 -o o24 
+#
+# C: binary 64-bit (3x4x5) => SDS 
+./fp2hdf cb64r3 -o o25 
+#
+# C: text (3x4) => image
+./fp2hdf ctxtr2 -o o26 -raster -e 50 50 
+#
+# C: binary (3x4) => image and SDS
+./fp2hdf cb64r2 -o o27 -raster -i 50 50 -f
+#
+# 
+# Fortran: text (3x4) => SDS 
+./fp2hdf ftxtr2 -o o30 
+#
+# Fortran: text (3x4x5) => SDS 
+./fp2hdf ftxtr3 -o o31
+#
+# Fortran: binary 32-bit (3x4) => SDS
+./fp2hdf fb32r2 -o o32 
+#
+# Fortran: binary 32-bit (3x4x5) => SDS 
+./fp2hdf fb32r3 -o o33 
+#
+# Fortran: binary 64-bit (3x4) => SDS 
+./fp2hdf fb64r2 -o o34 
+#
+# Fortran: binary 64-bit (3x4x5) => SDS 
+./fp2hdf fb64r3 -o o35 
+#
+# Fortran: text (3x4) => image
+./fp2hdf ftxtr2 -o o36 -raster -e 50 50 
+#
+# Fortran: binary (3x4) => image and SDS
+./fp2hdf fb64r2 -o o37 -raster -i 50 50 -f
+#
+# 
+# Compare files o20-o27 with o30-o37.  They should be the same.
+#
+cmp o20 o30
+cmp o21 o31
+cmp o22 o32
+cmp o23 o33
+cmp o24 o34
+cmp o25 o35
+cmp o26 o36
+cmp o27 o37
+
+unset echo
+
+
diff --git a/hdf/util/fp2hdf.test.result b/hdf/util/fp2hdf.test.result
new file mode 100644
index 0000000..7a517a2
--- /dev/null
+++ b/hdf/util/fp2hdf.test.result
@@ -0,0 +1,47 @@
+********** This is approximately with should be written  **********
+********** to the screen when you run fp2hdf.test.       **********
+
+fp2hdf t100x100 -o o1
+fp2hdf t100x100 -o o2 -r
+fp2hdf t100x100 -o o3 -r -f
+fp2hdf h100x100 -o o4 -r -f
+fp2hdf h100x100 -o o5 -f -r -p pal.hdf
+fp2hdf h100x100 -o o6 -r -e 200 200
+fp2hdf h100x100 -o o7 -r -i 200 200
+fp2hdf h100x100 -o o8 -r -i 40 120 -p pal.hdf
+fp2hdf h100x100 -o o9 -r -e 40 120 -p pal.hdf
+Warning: cannot make image smaller using -e option.
+         Horiz. resolution will be made the same as horiz. dimension of the
+         dataset, which is: 100.
+
+fp2hdf h60x75 -o o10 -r -e 120 160 -p pal.hdf
+fp2hdf h100x100h -o o11 -f -r -p pal.hdf
+fp2hdf h100x100hv -o o12 -f -r -p pal.hdf
+fp2hdf h60x75v -o o13 -r -e 120 160 -p pal.hdf
+fp2hdf h60x75n -o o14 -r -e 120 150 -p pal.hdf
+fp2hdf t100x100 h100x100 h100x100h h100x100hv h60x75 h60x75v -o o15 -r -e 100 10
+0
+fp2hdf ctxtr2 -o o20
+fp2hdf ctxtr3 -o o21
+fp2hdf cb32r2 -o o22
+fp2hdf cb32r3 -o o23
+fp2hdf cb64r2 -o o24
+fp2hdf cb64r3 -o o25
+fp2hdf ctxtr2 -o o26 -raster -e 50 50
+fp2hdf cb64r2 -o o27 -raster -i 50 50 -f
+fp2hdf ftxtr2 -o o30
+fp2hdf ftxtr3 -o o31
+fp2hdf fb32r2 -o o32
+fp2hdf fb32r3 -o o33
+fp2hdf fb64r2 -o o34
+fp2hdf fb64r3 -o o35
+fp2hdf ftxtr2 -o o36 -raster -e 50 50
+fp2hdf fb64r2 -o o37 -raster -i 50 50 -f
+cmp o20 o30
+cmp o21 o31
+cmp o22 o32
+cmp o23 o33
+cmp o24 o34
+cmp o25 o35
+cmp o26 o36
+cmp o27 o37
diff --git a/hdf/util/fptest.c b/hdf/util/fptest.c
new file mode 100644
index 0000000..0d1d8b5
--- /dev/null
+++ b/hdf/util/fptest.c
@@ -0,0 +1,271 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include "hdf.h"
+
+#ifdef _WIN32
+#include <sys/stat.h>
+#include <fcntl.h>
+#endif
+
+/*
+ * Name:
+ *      fptest
+ *
+ * Description:
+ *      This program creates six floating point files that can be
+ *      used to test the fp2hdf program.
+ *
+ *      June 1, 1990
+ *      Bob Weaver, baw at inel.gov
+ *
+ *      The file names that are created are named:
+ *              ctxtr2, type 'TEXT', size 3x4
+ *              ctxtr3, type 'TEXT', size 3x4x5
+ *              cb32r2, type 'FP32', size 3x4
+ *              cb32r3, type 'FP32', size 3x4x5
+ *              cb64r2, type 'FP64', size 3x4
+ *              cb64r3, type 'FP64', size 3x4x5
+ *
+ *      row     values start at 11 and increment by 1 => 11, 12, 13
+ *      column  values start at 21 and increment by 2 => 21, 23, 25, 27
+ *      plane   values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+ *
+ *      data element value = row value + column value [+ plane value, if rank=3]
+ */
+int
+main(int argc, char * argv[] )
+{
+    int         nrow = 3, ncol = 4, npln = 5, ione = 1;
+    int         i, j, k;
+    FILE       *sp;
+
+    float32     b32r2[3][4], b32r3[5][3][4];
+    float32     row4[3], col4[4], pln4[5];
+    float32     rowo4 = (float32)11.0e0, colo4 = (float32)21.0e0, plno4 = (float32)51.0e0;
+    float32     rowi4 = (float32)1.0e0, coli4 = (float32)2.0e0, plni4 = (float32)5.0e0;
+    float32     ezero = (float32)0.0e0;
+
+    float64     b64r2[3][4], b64r3[5][3][4];
+    float64     row8[3], col8[4], pln8[5];
+    float64     rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0;
+    float64     rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0;
+    float64     dzero = 0.0e0;
+
+    const char *text = "TEXT";
+    const char *fp32 = "FP32";
+    const char *fp64 = "FP64";
+
+    /* shut compiler up */
+    argv=argv; argc=argc;
+
+    /*
+     * initialize the row, column, and plane vectors
+     *
+     * row values start at 11 and increment by 1 => 11, 12, 13
+     * column values start at 21 and increment by 2 => 21, 23, 25, 27
+     * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+     */
+
+    row4[0] = rowo4;
+    col4[0] = colo4;
+    pln4[0] = plno4;
+    row8[0] = rowo8;
+    col8[0] = colo8;
+    pln8[0] = plno8;
+
+    for (i = 1; i < nrow; i++)
+      {
+          row4[i] = row4[i - 1] + rowi4;
+          row8[i] = row8[i - 1] + rowi8;
+      }
+    for (j = 1; j < ncol; j++)
+      {
+          col4[j] = col4[j - 1] + coli4;
+          col8[j] = col8[j - 1] + coli8;
+      }
+    for (k = 1; k < npln; k++)
+      {
+          pln4[k] = pln4[k - 1] + plni4;
+          pln8[k] = pln8[k - 1] + plni8;
+      }
+
+    /*
+     * build array elements - rank 2
+     *
+     * element value = sum of row value and col values
+     */
+
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+            {
+                b32r2[i][j] = row4[i] + col4[j];
+                b64r2[i][j] = row8[i] + col8[j];
+            }
+      }
+
+    /*
+     * build array elements - rank 3
+     *
+     * element value = sum of row value, col, and plane values
+     */
+
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+            {
+                for (k = 0; k < npln; k++)
+                  {
+                      b32r3[k][i][j] = row4[i] + col4[j] + pln4[k];
+                      b64r3[k][i][j] = row8[i] + col8[j] + pln8[k];
+                  }
+            }
+      }
+
+    /*
+     * text file - rank 2 & 3
+     */
+
+/* For WINDOWS platform, file mode should be set explicitly. 
+   For text mode, set it to Text; for binary mode, set it to BINARY. */
+
+#ifdef _WIN32
+     _fmode = _O_TEXT;
+#endif
+    sp = fopen("ctxtr2", "w");
+    (void) fprintf(sp, "%s\n", text);
+    (void) fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol);
+    (void) fprintf(sp, "%14.6E%14.6E\n", ezero, ezero);
+    for (i = 0; i < nrow; i++)
+        (void) fprintf(sp, "%14.6E", row4[i]);
+    (void) fprintf(sp, "\n");
+    for (j = 0; j < ncol; j++)
+        (void) fprintf(sp, "%14.6E", col4[j]);
+    (void) fprintf(sp, "\n");
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+              (void) fprintf(sp, "%14.6E", b32r2[i][j]);
+          (void) fprintf(sp, "\n");
+      }
+    (void) fclose(sp);
+
+    sp = fopen("ctxtr3", "w");
+    (void) fprintf(sp, "%s\n", text);
+    (void) fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol);
+    (void) fprintf(sp, "%14.6E%14.6E\n", ezero, ezero);
+    for (k = 0; k < npln; k++)
+        (void) fprintf(sp, "%14.6E", pln4[k]);
+    (void) fprintf(sp, "\n");
+    for (i = 0; i < nrow; i++)
+        (void) fprintf(sp, "%14.6E", row4[i]);
+    (void) fprintf(sp, "\n");
+    for (j = 0; j < ncol; j++)
+        (void) fprintf(sp, "%14.6E", col4[j]);
+    (void) fprintf(sp, "\n");
+    for (k = 0; k < npln; k++)
+        for (i = 0; i < nrow; i++)
+          {
+              for (j = 0; j < ncol; j++)
+                  (void) fprintf(sp, "%14.6E", b32r3[k][i][j]);
+              (void) fprintf(sp, "\n");
+          }
+    (void) fclose(sp);
+
+    /*
+     * binary 32-bit file - rank 2 & 3
+     */
+#ifdef _WIN32                                                                                       
+   _fmode = _O_BINARY;
+#endif 
+    sp = fopen("cb32r2", "w");
+    (void) fwrite(fp32, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ione, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4[i], sizeof(float32), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4[j], sizeof(float32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b32r2[i][j], sizeof(float32), 1,
+                          sp);
+    (void) fclose(sp);
+
+    sp = fopen("cb32r3", "w");
+    (void) fwrite(fp32, sizeof(int), 1, sp);
+    (void) fwrite((char *) &npln, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    for (k = 0; k < npln; k++)
+        (void) fwrite((char *) &pln4[k], sizeof(float32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4[i], sizeof(float32), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4[j], sizeof(float32), 1, sp);
+    for (k = 0; k < npln; k++)
+        for (i = 0; i < nrow; i++)
+            for (j = 0; j < ncol; j++)
+                (void) fwrite((char *) &b32r3[k][i][j],
+                              sizeof(float32), 1, sp);
+    (void) fclose(sp);
+
+    /*
+     * binary 64-bit file - rank 2 & 3
+     */
+
+    sp = fopen("cb64r2", "w");
+    (void) fwrite(fp64, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ione, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row8[i], sizeof(float64), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col8[j], sizeof(float64), 1, sp);
+    for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b64r2[i][j], sizeof(float64), 1,
+                          sp);
+    (void) fclose(sp);
+
+    sp = fopen("cb64r3", "w");
+    (void) fwrite(fp64, sizeof(int), 1, sp);
+    (void) fwrite((char *) &npln, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    for (k = 0; k < npln; k++)
+        (void) fwrite((char *) &pln8[k], sizeof(float64), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row8[i], sizeof(float64), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col8[j], sizeof(float64), 1, sp);
+    for (k = 0; k < npln; k++)
+        for (i = 0; i < nrow; i++)
+            for (j = 0; j < ncol; j++)
+                (void) fwrite((char *) &b64r3[k][i][j],
+                              sizeof(float64), 1, sp);
+    (void) fclose(sp);
+    return (0);
+}
diff --git a/hdf/util/getopt.c b/hdf/util/getopt.c
new file mode 100644
index 0000000..7a4673b
--- /dev/null
+++ b/hdf/util/getopt.c
@@ -0,0 +1,757 @@
+/* Getopt for GNU.
+   NOTE: getopt is now part of the C library, so if you don't know what
+   "Keep this file name-space clean" means, talk to roland at gnu.ai.mit.edu
+   before changing it!
+
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
+   	Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option) any
+   later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+

+#ifdef HAVE_CONFIG_H
+#if defined (emacs) || defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
+   (which it would do because it found this file in $srcdir).  */
+#include <config.h>
+#else
+#include "config.h"
+#endif
+#endif
+
+#ifndef __STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.  */
+#ifndef _NO_PROTO
+#define _NO_PROTO
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef	__GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+   contain conflicting prototypes for getopt.  */
+#include <stdlib.h>
+#endif	/* GNU C library.  */
+
+/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
+   long-named option.  Because this is not POSIX.2 compliant, it is
+   being phased out.  */
+/* #define GETOPT_COMPAT */
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
+
+   As `getopt' works, it permutes the elements of ARGV so that,
+   when it is done, all the options precede everything else.  Thus
+   all application programs are extended to handle flexible argument order.
+
+   Setting the environment variable POSIXLY_CORRECT disables permutation.
+   Then the behavior is completely standard.
+
+   GNU application programs can use a third alternative mode in which
+   they can distinguish the relative order of options and other arguments.  */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg = 0;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns EOF, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* XXX 1003.2 says this must be 1 before any call.  */
+int optind = 0;
+
+/* The next char to be scanned in the option-element
+   in which the last option character we returned was found.
+   This allows us to pick up the scan where we left off.
+
+   If this is zero, or a null string, it means resume the scan
+   by advancing to the next ARGV-element.  */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+   so that eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written to
+   expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were written
+   to expect options and other ARGV-elements in any order and that care about
+   the ordering of the two.  We describe each non-option ARGV-element
+   as if it were the argument of an option with character code 1.
+   Using `-' as the first character of the list of option characters
+   selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return EOF with `optind' != ARGC.  */
+
+static enum
+{
+  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+

+#ifdef	__GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+   because there are many ways it can cause trouble.
+   On some systems, it contains special magic macros that don't work
+   in GCC.  */
+#include <string.h>
+#define	my_index	strchr
+#else
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+char *getenv ();
+
+static char *
+my_index (str, chr)
+     const char *str;
+     int chr;
+{
+  while (*str)
+    {
+      if (*str == chr)
+	return (char *) str;
+      str++;
+    }
+  return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+   If not using GCC, it is ok not to declare it.
+   (Supposedly there are some machines where it might get a warning,
+   but changing this conditional to __STDC__ is too risky.)  */
+#ifdef __GNUC__
+#ifdef IN_GCC
+#include "gstddef.h"
+#else
+#include <stddef.h>
+#endif
+extern size_t strlen (const char *);
+#endif
+
+#endif				/* GNU C library.  */
+

+/* Handle permutation of arguments.  */
+
+/* Describe the part of ARGV that contains non-options that have
+   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+   `last_nonopt' is the index after the last of them.  */
+
+static int first_nonopt;
+static int last_nonopt;
+
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+static void
+exchange (argv)
+     char **argv;
+{
+  int bottom = first_nonopt;
+  int middle = last_nonopt;
+  int top = optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+	{
+	  /* Bottom segment is the short one.  */
+	  int len = middle - bottom;
+	  register int i;
+
+	  /* Swap it with the top part of the top segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[top - (middle - bottom) + i];
+	      argv[top - (middle - bottom) + i] = tem;
+	    }
+	  /* Exclude the moved bottom segment from further swapping.  */
+	  top -= len;
+	}
+      else
+	{
+	  /* Top segment is the short one.  */
+	  int len = top - middle;
+	  register int i;
+
+	  /* Swap it with the bottom part of the bottom segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[middle + i];
+	      argv[middle + i] = tem;
+	    }
+	  /* Exclude the moved top segment from further swapping.  */
+	  bottom += len;
+	}
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  first_nonopt += (optind - last_nonopt);
+  last_nonopt = optind;
+}
+

+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If `getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If `getopt' finds another option character, it returns that character,
+   updating `optind' and `nextchar' so that the next call to `getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, `getopt' returns `EOF'.
+   Then `optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set `opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in `optarg', otherwise `optarg' is set to zero.
+
+   If OPTSTRING starts with `-' or `+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with `--' instead of `-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a `=', or else the in next ARGV-element.
+   When `getopt' finds a long-named option, it returns 0 if that option's
+   `flag' field is nonzero, the value of the option's `val' field
+   if the `flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of `struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+     const struct option *longopts;
+     int *longind;
+     int long_only;
+{
+  int option_index;
+
+  optarg = 0;
+
+  /* Initialize the internal data when the first call is made.
+     Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+
+  if (optind == 0)
+    {
+      first_nonopt = last_nonopt = optind = 1;
+
+      nextchar = NULL;
+
+      /* Determine how to handle the ordering of options and nonoptions.  */
+
+      if (optstring[0] == '-')
+	{
+	  ordering = RETURN_IN_ORDER;
+	  ++optstring;
+	}
+      else if (optstring[0] == '+')
+	{
+	  ordering = REQUIRE_ORDER;
+	  ++optstring;
+	}
+      else if (getenv ("POSIXLY_CORRECT") != NULL)
+	ordering = REQUIRE_ORDER;
+      else
+	ordering = PERMUTE;
+    }
+
+  if (nextchar == NULL || *nextchar == '\0')
+    {
+      if (ordering == PERMUTE)
+	{
+	  /* If we have just processed some options following some non-options,
+	     exchange them so that the options come first.  */
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (last_nonopt != optind)
+	    first_nonopt = optind;
+
+	  /* Now skip any additional non-options
+	     and extend the range of non-options previously skipped.  */
+
+	  while (optind < argc
+		 && (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#ifdef GETOPT_COMPAT
+		 && (longopts == NULL
+		     || argv[optind][0] != '+' || argv[optind][1] == '\0')
+#endif				/* GETOPT_COMPAT */
+		 )
+	    optind++;
+	  last_nonopt = optind;
+	}
+
+      /* Special ARGV-element `--' means premature end of options.
+	 Skip it like a null option,
+	 then exchange with previous non-options as if it were an option,
+	 then skip everything else like a non-option.  */
+
+      if (optind != argc && !strcmp (argv[optind], "--"))
+	{
+	  optind++;
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (first_nonopt == last_nonopt)
+	    first_nonopt = optind;
+	  last_nonopt = argc;
+
+	  optind = argc;
+	}
+
+      /* If we have done all the ARGV-elements, stop the scan
+	 and back over any non-options that we skipped and permuted.  */
+
+      if (optind == argc)
+	{
+	  /* Set the next-arg-index to point at the non-options
+	     that we previously skipped, so the caller will digest them.  */
+	  if (first_nonopt != last_nonopt)
+	    optind = first_nonopt;
+	  return EOF;
+	}
+
+      /* If we have come to a non-option and did not permute it,
+	 either stop the scan or describe it to the caller and pass it by.  */
+
+      if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
+#ifdef GETOPT_COMPAT
+	  && (longopts == NULL
+	      || argv[optind][0] != '+' || argv[optind][1] == '\0')
+#endif				/* GETOPT_COMPAT */
+	  )
+	{
+	  if (ordering == REQUIRE_ORDER)
+	    return EOF;
+	  optarg = argv[optind++];
+	  return 1;
+	}
+
+      /* We have found another option-ARGV-element.
+	 Start decoding its characters.  */
+
+      nextchar = (argv[optind] + 1
+		  + (longopts != NULL && argv[optind][1] == '-'));
+    }
+
+  if (longopts != NULL
+      && ((argv[optind][0] == '-'
+	   && (argv[optind][1] == '-' || long_only))
+#ifdef GETOPT_COMPAT
+	  || argv[optind][0] == '+'
+#endif				/* GETOPT_COMPAT */
+	  ))
+    {
+      const struct option *p;
+      char *s = nextchar;
+      int exact = 0;
+      int ambig = 0;
+      const struct option *pfound = NULL;
+      int indfound;
+
+      while (*s && *s != '=')
+	s++;
+
+      /* Test all options for either exact match or abbreviated matches.  */
+      for (p = longopts, option_index = 0; p->name;
+	   p++, option_index++)
+	if (!strncmp (p->name, nextchar, s - nextchar))
+	  {
+	    if (s - nextchar == strlen (p->name))
+	      {
+		/* Exact match found.  */
+		pfound = p;
+		indfound = option_index;
+		exact = 1;
+		break;
+	      }
+	    else if (pfound == NULL)
+	      {
+		/* First nonexact match found.  */
+		pfound = p;
+		indfound = option_index;
+	      }
+	    else
+	      /* Second nonexact match found.  */
+	      ambig = 1;
+	  }
+
+      if (ambig && !exact)
+	{
+	  if (opterr)
+	    fprintf (stderr, "%s: option `%s' is ambiguous\n",
+		     argv[0], argv[optind]);
+	  nextchar += strlen (nextchar);
+	  optind++;
+	  return '?';
+	}
+
+      if (pfound != NULL)
+	{
+	  option_index = indfound;
+	  optind++;
+	  if (*s)
+	    {
+	      /* Don't test has_arg with >, because some C compilers don't
+		 allow it to be used on enums.  */
+	      if (pfound->has_arg)
+		optarg = s + 1;
+	      else
+		{
+		  if (opterr)
+		    {
+		      if (argv[optind - 1][1] == '-')
+			/* --option */
+			fprintf (stderr,
+				 "%s: option `--%s' doesn't allow an argument\n",
+				 argv[0], pfound->name);
+		      else
+			/* +option or -option */
+			fprintf (stderr,
+			     "%s: option `%c%s' doesn't allow an argument\n",
+			     argv[0], argv[optind - 1][0], pfound->name);
+		    }
+		  nextchar += strlen (nextchar);
+		  return '?';
+		}
+	    }
+	  else if (pfound->has_arg == 1)
+	    {
+	      if (optind < argc)
+		optarg = argv[optind++];
+	      else
+		{
+		  if (opterr)
+		    fprintf (stderr, "%s: option `%s' requires an argument\n",
+			     argv[0], argv[optind - 1]);
+		  nextchar += strlen (nextchar);
+		  return optstring[0] == ':' ? ':' : '?';
+		}
+	    }
+	  nextchar += strlen (nextchar);
+	  if (longind != NULL)
+	    *longind = option_index;
+	  if (pfound->flag)
+	    {
+	      *(pfound->flag) = pfound->val;
+	      return 0;
+	    }
+	  return pfound->val;
+	}
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+	 or the option starts with '--' or is not a valid short
+	 option, then it's an error.
+	 Otherwise interpret it as a short option.  */
+      if (!long_only || argv[optind][1] == '-'
+#ifdef GETOPT_COMPAT
+	  || argv[optind][0] == '+'
+#endif				/* GETOPT_COMPAT */
+	  || my_index (optstring, *nextchar) == NULL)
+	{
+	  if (opterr)
+	    {
+	      if (argv[optind][1] == '-')
+		/* --option */
+		fprintf (stderr, "%s: unrecognized option `--%s'\n",
+			 argv[0], nextchar);
+	      else
+		/* +option or -option */
+		fprintf (stderr, "%s: unrecognized option `%c%s'\n",
+			 argv[0], argv[optind][0], nextchar);
+	    }
+	  nextchar = (char *) "";
+	  optind++;
+	  return '?';
+	}
+    }
+
+  /* Look at and handle the next option-character.  */
+
+  {
+    char c = *nextchar++;
+    char *temp = my_index (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*nextchar == '\0')
+      ++optind;
+
+    if (temp == NULL || c == ':')
+      {
+	if (opterr)
+	  {
+#if 0
+	    if (c < 040 || c >= 0177)
+	      fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
+		       argv[0], c);
+	    else
+	      fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
+#else
+	    /* 1003.2 specifies the format of this message.  */
+	    fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
+#endif
+	  }
+	optopt = c;
+	return '?';
+      }
+    if (temp[1] == ':')
+      {
+	if (temp[2] == ':')
+	  {
+	    /* This is an option that accepts an argument optionally.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		optind++;
+	      }
+	    else
+	      optarg = 0;
+	    nextchar = NULL;
+	  }
+	else
+	  {
+	    /* This is an option that requires an argument.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		/* If we end this ARGV-element by taking the rest as an arg,
+		   we must advance to the next element now.  */
+		optind++;
+	      }
+	    else if (optind == argc)
+	      {
+		if (opterr)
+		  {
+#if 0
+		    fprintf (stderr, "%s: option `-%c' requires an argument\n",
+			     argv[0], c);
+#else
+		    /* 1003.2 specifies the format of this message.  */
+		    fprintf (stderr, "%s: option requires an argument -- %c\n",
+			     argv[0], c);
+#endif
+		  }
+		optopt = c;
+		if (optstring[0] == ':')
+		  c = ':';
+		else
+		  c = '?';
+	      }
+	    else
+	      /* We already incremented `optind' once;
+		 increment it again when taking next ARGV-elt as argument.  */
+	      optarg = argv[optind++];
+	    nextchar = NULL;
+	  }
+      }
+    return c;
+  }
+}
+
+int
+getopt (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  return _getopt_internal (argc, argv, optstring,
+			   (const struct option *) 0,
+			   (int *) 0,
+			   0);
+}
+
+#endif	/* _LIBC or not __GNU_LIBRARY__.  */
+

+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == EOF)
+	break;
+
+      switch (c)
+	{
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff --git a/hdf/util/getopt1.c b/hdf/util/getopt1.c
new file mode 100644
index 0000000..f784b57
--- /dev/null
+++ b/hdf/util/getopt1.c
@@ -0,0 +1,187 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
+	Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 2, or (at your option) any
+   later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+

+#ifdef HAVE_CONFIG_H
+#if defined (emacs) || defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
+   (which it would do because it found this file in $srcdir).  */
+#include <config.h>
+#else
+#include "config.h"
+#endif
+#endif
+
+#include "getopt.h"
+
+#ifndef __STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#else
+char *getenv ();
+#endif
+
+#ifndef	NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+
+#endif	/* _LIBC or not __GNU_LIBRARY__.  */
+

+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static struct option long_options[] =
+      {
+	{"add", 1, 0, 0},
+	{"append", 0, 0, 0},
+	{"delete", 1, 0, 0},
+	{"verbose", 0, 0, 0},
+	{"create", 0, 0, 0},
+	{"file", 1, 0, 0},
+	{0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+		       long_options, &option_index);
+      if (c == EOF)
+	break;
+
+      switch (c)
+	{
+	case 0:
+	  printf ("option %s", long_options[option_index].name);
+	  if (optarg)
+	    printf (" with arg %s", optarg);
+	  printf ("\n");
+	  break;
+
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case 'd':
+	  printf ("option d with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff --git a/hdf/util/gif.h b/hdf/util/gif.h
new file mode 100644
index 0000000..5c8d4d0
--- /dev/null
+++ b/hdf/util/gif.h
@@ -0,0 +1,163 @@
+/****************************************************************************\
+**  Title:       GIF.H                                                      **
+**  Purpose:     GIF Header file                                            **
+**  Version:     1.0                                                        **
+**  Date:        March 1992                                                 **
+**  Author:      James D. Murray, Anaheim, CA, USA                          **
+**  C Compilers: Borland C++ v2.0, Microsoft C v6.00a                       **
+**                                                                          **
+**  This file contains the header structures for the GIF image              **
+**  file format.                                                            **
+**                                                                          **
+**                                                                          **
+**  Copyright (C) 1991 by Graphics Software Labs.  All rights reserved.     **
+\****************************************************************************/
+
+#include "hdf.h"
+#ifndef GIF_H
+#define GIF_H   1
+
+#define MAX_PAL 768
+
+/*#include "datatype.h"         Data type definitions */
+
+
+typedef uint8  BYTE;
+typedef uint16 WORD;
+typedef char   CHAR;
+typedef uint8  boolean;
+
+#define false 0;
+#define true 1;
+
+/* Set the EndianOrder.
+** The GIF Reader file should do this.
+** Set EndianOrder = 0 if machine is little endian
+**     EndianOrder = 1 if machine is big endian.
+*/
+extern int  EndianOrder;	
+                                                            
+/*
+**  The GIF header format.
+**
+**  This structure actually contains the header, logical screen
+**  descriptor, and the global color table for the GIF image.
+*/
+typedef struct _GifHeader       /* Offset   Description            */
+{
+    BYTE        PackedField;    /*  0Ah     Color Information      */
+	WORD		TableSize;
+	BYTE        ImageCount;     /*  Keep a count of the number of images	*/
+	BYTE		CommentCount;
+	BYTE		ApplicationCount;
+	BYTE		PlainTextCount;
+	BYTE		HDFPalette[256][3];
+	BYTE		HeaderDump[6];	/*	BYTE array to dump header contents		*/	
+	BYTE		LSDDump[7];		/*	Logical Screen Descriptor dump			*/
+} GIFHEAD;                      
+
+
+/*
+**  The GIF Image Descriptor.
+*/
+typedef struct _GifImageDescriptor
+{
+    WORD        ImageWidth;         /* Width of the image in pixels           */
+    WORD        ImageHeight;        /* Height of the image in pixels          */
+    BYTE        PackedField;        /* Image and Color Table Data Information */
+	WORD		TableSize;
+	WORD		CodeSize;			/* Minimum LZW CodeSize for image data    */
+	BYTE		HDFPalette[256][3];
+	BYTE		GIDDump[9];			/* GifImageDescriptor dump				  */
+
+	BYTE		*Image;				/* Decompressed Raster Image			  */
+	BYTE 	    *GIFImage;
+} GIFIMAGEDESC;
+
+
+/*
+**  GIF 89a Graphic Control Extension Block
+*/
+typedef struct _GifGraphicControlExtension
+{
+	BYTE	GCEDump[5];			/* Graphic Control Extension Dump		*/
+} GIFGRAPHICCONTROL;
+
+
+/*
+**  GIF 89a Plain Text Extension Block
+*/
+typedef struct _GifPlainTextExtension
+{
+	BYTE	PTEDump[15];		/* Plain Text Extension Dump			*/
+    BYTE   *PlainTextData;      /* Plain Text data sub-blocks           */
+	WORD	DataSize;
+} GIFPLAINTEXT;
+
+
+/*
+**  GIF 89a Application Extension Block
+*/
+typedef struct _GifApplicationExtension
+{
+	BYTE	AEDump[14];			/* Application Extension Dump			*/
+    BYTE   *ApplicationData;    /* Application data sub-blocks          */
+	WORD	DataSize;
+} GIFAPPLICATION;
+
+/*
+**  GIF 89a Comment Extension Block
+*/
+typedef struct _GifCommentExtension
+{
+	BYTE	CEDump[2];			/* Comment Extension Dump				*/
+    BYTE   *CommentData;        /* Comment data sub-blocks              */
+	WORD	DataSize;
+    BYTE    Terminator;         /* Block Terminator (always 0)          */
+} GIFCOMMENT;
+
+/*
+** GIF to HDF Memory Struct
+** Purpose : The gif to hdf structure is used to pass all the 
+**           gif data to the memory, which gets caught by the hdf driver
+**           Its the drivers job to put the data in the appropriate places 
+**           in the HDF file.
+**           I have assumed that the ImageDescriptors and GraphicControls follow
+**           one another, ie. I have not associated them with each other. The driver
+**           must assume a 1-1 correspondance. The same discussion with plain text
+**           extension.
+*/
+typedef struct _GifToMem
+{
+	GIFHEAD            *GifHeader;
+	GIFIMAGEDESC      **GifImageDesc;
+	GIFGRAPHICCONTROL **GifGraphicControlExtension;
+	GIFPLAINTEXT      **GifPlainTextExtension;
+	GIFAPPLICATION    **GifApplicationExtension;
+	GIFCOMMENT        **GifCommentExtension;
+} GIFTOMEM;
+
+
+/*
+**  Function Prototypes
+*/
+/* GIF2MEM.C */
+GIFTOMEM Gif2Mem(BYTE *);
+
+/* GIFREAD.C */
+int ReadGifHeader(GIFHEAD *, BYTE **);
+int ReadGifImageDesc(GIFIMAGEDESC *, BYTE **);
+int ReadGifGraphicControl(GIFGRAPHICCONTROL *, BYTE **);
+int ReadGifPlainText(GIFPLAINTEXT *, BYTE **);
+int ReadGifApplication(GIFAPPLICATION *, BYTE **);
+int ReadGifComment(GIFCOMMENT *, BYTE **);
+
+/* WRITEHDF.C */
+int WriteHDF(GIFTOMEM , CHAR * , CHAR *);
+
+BYTE *ReadDataSubBlocks(BYTE ** , WORD *);
+BYTE *Decompress (GIFIMAGEDESC * , GIFHEAD *);
+BYTE GetByte(BYTE *);
+WORD GetWord(BYTE *);
+#endif  /* GIF_H */
+
diff --git a/hdf/util/gif2hdf.c b/hdf/util/gif2hdf.c
new file mode 100644
index 0000000..59175f6
--- /dev/null
+++ b/hdf/util/gif2hdf.c
@@ -0,0 +1,119 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <hdf.h>
+#include "gif.h"
+#include <string.h>
+int
+main(argv , argc)
+int argv;
+char *argc[];
+{
+	
+	GIFTOMEM GifMemoryStruct;
+	GIFIMAGEDESC gifImageDesc;
+
+	FILE *fpGif;
+	int32 i,ImageCount;
+	int32 filesize;
+	BYTE *MemGif;
+	BYTE *StartPos;
+	char GIFFileName[256];
+	char HDFFileName[256];
+
+	/* Initialize all GifMemoryStruct pointers to null
+	** to prevent hassles later on
+	*/
+	GifMemoryStruct.GifHeader                  = NULL;
+	GifMemoryStruct.GifImageDesc               = NULL;
+	GifMemoryStruct.GifGraphicControlExtension = NULL;
+	GifMemoryStruct.GifPlainTextExtension      = NULL;
+	GifMemoryStruct.GifApplicationExtension    = NULL;
+	GifMemoryStruct.GifCommentExtension        = NULL;
+	
+	
+	if (argv<3)
+	{
+		printf("\n\nWrong Usage. Use:\ngif2hdf <GIFFILE> <HDFFILE>\n\n");
+		return(-1);
+	}
+	
+	
+
+	strncpy(GIFFileName , argc[1] , VSNAMELENMAX - 1);
+	strncpy(HDFFileName , argc[2] , VSNAMELENMAX - 1);
+	GIFFileName[VSNAMELENMAX - 1] = '\0';
+	HDFFileName[VSNAMELENMAX - 1] = '\0';
+
+	if (!(fpGif = fopen(GIFFileName,"rb"))) {
+		printf("Unable to open GIF file for reading.\n");
+		printf("Filename (including path) must be less than %d charachters in length\n",VSNAMELENMAX);
+		exit(-1);
+	}
+
+	/* Get the whole file into memory. Mem's much faster than I/O */
+	fseek(fpGif, 0L , 2);
+	filesize = ftell(fpGif);
+	fseek(fpGif, 0L , 0);
+	if (filesize == 0) printf("File Size Zero");
+	if (!(MemGif = StartPos = (BYTE *)malloc(filesize))) {
+		printf("Out of memory");
+		exit (-1);
+	}
+	if (fread(MemGif,filesize,1,fpGif) != 1) {
+		printf("Corrupted Input File");
+		exit(-1);
+	}
+
+	fseek(fpGif,0L,0);
+
+	/*
+	** Call Gif2Mem and break the whole file into parts.
+	** Gif2Mem also calls decompresses the images so we don't 
+	** have to worry about that
+	*/
+	GifMemoryStruct = Gif2Mem(MemGif);
+	if (ferror(fpGif)) {
+		printf("File Stream Error\n\n");
+		exit(-1);
+	}
+	fclose(fpGif);
+	
+	/* Call WriteHDF from here. Go ahead and change WriteHDF to write 
+	** whatever format you want
+	*/
+	if (WriteHDF(GifMemoryStruct , argc[2] , argc[1]))
+		printf("HDF Write Error\n\n");
+	
+	/* Free all buffers */
+	ImageCount = (int32)(GifMemoryStruct.GifHeader)->ImageCount;
+
+	for(i = 0 ; i < ImageCount ; i++)
+	{
+		gifImageDesc = *(GifMemoryStruct.GifImageDesc[i]);
+		if (gifImageDesc.Image != NULL)
+			free(gifImageDesc.Image);
+	
+		if (GifMemoryStruct.GifGraphicControlExtension[i] != NULL)
+			free(GifMemoryStruct.GifGraphicControlExtension[i]);
+		
+	}
+	free(StartPos);
+
+	free (GifMemoryStruct.GifHeader);
+	
+	if (GifMemoryStruct.GifApplicationExtension != NULL)
+		free (GifMemoryStruct.GifApplicationExtension);
+
+	return (0);
+}
diff --git a/hdf/util/gif2mem.c b/hdf/util/gif2mem.c
new file mode 100644
index 0000000..688ffca
--- /dev/null
+++ b/hdf/util/gif2mem.c
@@ -0,0 +1,358 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ 
+/*
+** This file contains snippets of code from James Murray's original file
+** to display the GIF header information, but most of it has been modified to
+** suit gif2hdf
+*/
+
+
+
+/****************************************************************************\
+**  Title:       GIFHEAD.C                                                  **
+**  Purpose:     Display the data in a GIF image file.                      **
+**  Version:     1.0                                                        **
+**  Date:        March 1992                                                 **
+**  Author:      James D. Murray, Anaheim, CA, USA                          **
+**  C Compilers: Borland C++ v2.0, Microsoft C v6.00a                       **
+**                                                                          **
+**  GIFHEAD displays all real information contained within a GIF image      **
+**  file, including all color tables and extension block information.       **
+**  GIFHEAD reads both GIF 87a abd 89a-format files.                        **
+**                                                                          **
+**  Copyright (C) 1991-92 by Graphics Software Labs.  All rights reserved.  **
+\****************************************************************************/
+#include <stdio.h>
+#include "gif.h"
+#include <hdf.h>
+
+#define GIF_VERSION                     "1.00"
+extern int EndianOrder;
+
+GIFTOMEM
+Gif2Mem(MemGif)
+BYTE *MemGif;
+{
+	/*
+	** The gif structure outline for passing data to memory
+	** is given in gif.h
+	** These pointers are redunant, should take them out in ver. 2
+	*/
+    GIFHEAD            *gifHead;           /* GIF Header structure            */
+    GIFIMAGEDESC      **gifImageDesc;      /* Logical Image Descriptor struct */
+    GIFPLAINTEXT      **gifPlainText;      /* Plain Text Extension structure  */
+    GIFAPPLICATION    **gifApplication;    /* Application Extension structure */
+    GIFCOMMENT        **gifComment;        /* Comment Extension structure     */
+    GIFGRAPHICCONTROL **gifGraphicControl; /* Graphic Control Extension strct */
+
+	GIFTOMEM GifMemoryStruct;
+	
+
+
+    register WORD i;        /* Loop counter                                 */
+    BYTE Identifier;        /* Extension block identifier holder            */
+    BYTE Label;             /* Extension block label holder                 */
+    BYTE ImageCount;        /* Count of the number of images in the file    */
+	BYTE ImageArray;		/* Keep the size of the array to store Images	*/
+	BYTE CommentCount;
+	BYTE CommentArray;
+	BYTE ApplicationCount;
+	BYTE ApplicationArray;
+	BYTE PlainTextCount;
+	BYTE PlainTextArray;
+	BYTE GCEflag;
+	BYTE aTemp;
+	BYTE j;
+
+	BYTE w;			/* Two more variables needed only while testing */
+	BYTE *b;		/* Endian Ordering								*/
+
+	/* Allocate memory for the GIF structures           */
+	/* Plug the structs into GifMemoryStruct at the end */
+	/****************************************************/
+	if (!(gifHead = (GIFHEAD *)malloc(sizeof(GIFHEAD))))
+	{
+		printf("Could not allocate memory for gifHead\n");
+		exit(-1);
+	}
+	
+	/*
+	** The next three have to grow dynamically so we leave them
+	** for now and let realloc handle it later on.
+	*/
+	gifImageDesc      = NULL;
+	gifPlainText      = NULL;
+	gifGraphicControl = NULL;
+	gifComment        = NULL;
+	gifApplication    = NULL;
+
+	/******************************/
+	/* Memory allocation complete */
+    
+
+	/* Carry out Endian Testing and set Endian Order */
+	w = 0x0001;
+	b = (BYTE *) &w;
+	EndianOrder = (b[0] ? 1 : 0);
+
+    /* Read the GIF image file header information */
+    ReadGifHeader(gifHead, &MemGif);
+	
+    /* Check for FILE stream error */
+	/*
+    if (ferror(fpGif))
+    {
+        fputs("GIFHEAD: Error reading header information!\n", stderr);
+        exit(-3);
+    }
+	*/
+
+    /*
+    ** Identify, read, and display block information.
+    */
+	ImageCount       = ImageArray       = 0;
+	CommentCount     = CommentArray     = 0;
+	ApplicationCount = ApplicationArray = 0;
+	PlainTextCount   = PlainTextArray   = 0;
+	GCEflag          = 0;
+
+    for (;;)
+    {
+        Identifier = *MemGif++;
+		
+        switch (Identifier)
+		{
+		case 0x3B:  /* Trailer */
+			/* The counts are stored to make it easier while
+			** putting stuff into the HDF file and then
+			** deallocating space.
+			*/
+			gifHead->ImageCount       = ImageCount;
+			gifHead->CommentCount     = CommentCount;
+			gifHead->ApplicationCount = ApplicationCount;
+			gifHead->PlainTextCount   = PlainTextCount;
+
+			/* putting stuff into the gif2mem structure */
+			GifMemoryStruct.GifHeader = gifHead;
+			GifMemoryStruct.GifImageDesc = gifImageDesc;
+			GifMemoryStruct.GifPlainTextExtension = gifPlainText;
+			GifMemoryStruct.GifApplicationExtension = gifApplication;
+			GifMemoryStruct.GifCommentExtension = gifComment;
+			GifMemoryStruct.GifGraphicControlExtension = gifGraphicControl;
+			
+			/* return the struct */
+			return GifMemoryStruct;
+			
+			
+			
+		case 0x2C:  /* Image Descriptor */
+			/* If there was no image descriptor before this increase image count.
+			** If an imagedescriptor was present, reset GCEflag 
+			*/
+			if (GCEflag == 0) 
+				ImageCount++;
+			else
+				GCEflag = 0;
+
+			if (ImageCount > ImageArray) {
+				aTemp = ImageArray;
+				ImageArray = (ImageArray << 1) + 1;
+				if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc , sizeof(GIFIMAGEDESC *) * ImageArray)))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+				if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray)))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+
+				for (j = aTemp ; j < ImageArray ; j++) {
+					gifGraphicControl[j] = NULL;
+					gifImageDesc[j] = NULL;
+				}
+			}
+
+			if(!(gifImageDesc[ImageCount-1] = (GIFIMAGEDESC*)malloc(sizeof(GIFIMAGEDESC))))
+			{
+				printf("Out of memory!");
+				exit(-1);
+			}
+			
+
+			if (ReadGifImageDesc(gifImageDesc[ImageCount-1], &MemGif) == -1)
+				fputs("Error reading Image Descriptor information\n", stderr);
+		
+			/*
+			** Decompress the Image
+			*/
+			gifImageDesc[ImageCount-1]->Image = Decompress(gifImageDesc[ImageCount-1] , gifHead);
+			free(gifImageDesc[ImageCount-1]->GIFImage);
+
+			/* 
+			** Convert the local palette into an HDF compatible palette
+			** In case the local color table is present, it is written out as the HDFPalette
+			** If it is absent the global table is written as the HDFPalette.
+			*/
+			if (!((gifImageDesc[ImageCount-1]->PackedField) & 0x80))
+			{
+				/* Check to see if the global color table exists.... */
+				if (gifHead->PackedField & 0x80) {
+					for (i=0 ; i<gifHead->TableSize ; i++)
+					{
+						gifImageDesc[ImageCount-1]->HDFPalette[i][0] = gifHead->HDFPalette[i][0];
+						gifImageDesc[ImageCount-1]->HDFPalette[i][1] = gifHead->HDFPalette[i][1];
+						gifImageDesc[ImageCount-1]->HDFPalette[i][2] = gifHead->HDFPalette[i][2];
+					}
+				}
+				gifImageDesc[ImageCount-1]->TableSize = gifHead->TableSize;
+			}
+
+			break;
+			
+		case 0x21:  /* Extension Block */  
+			Label = *MemGif++;
+			switch (Label)
+			{
+			case 0x01:  /* Plain Text Extension */
+				puts("Plain Text Extension\n");
+				
+				PlainTextCount++;
+				if (PlainTextCount > PlainTextArray)
+					PlainTextArray = (PlainTextArray << 1) + 1;
+
+				if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray)))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+				
+				if(!(gifPlainText[PlainTextCount - 1] = (GIFPLAINTEXT*)malloc(sizeof(GIFPLAINTEXT))))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+				
+
+
+				if (ReadGifPlainText(gifPlainText[PlainTextCount - 1], &MemGif))
+					fprintf(stderr,
+					"Error reading Plain Text Extension information.\n");
+				
+				break;
+				
+			case 0xFE:  /* Comment Extension */
+				CommentCount++;
+				if (CommentCount > CommentArray)
+					CommentArray = (CommentArray << 1) + 1;
+
+				if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray)))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+				
+				if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT))))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+				
+
+				if (ReadGifComment(gifComment[CommentCount - 1], &MemGif))
+					fprintf(stderr,
+					"Error reading Comment Extension information\n");
+				break;
+				
+			case 0xF9:  /* Graphic Control Extension */
+				if (GCEflag == 0 )
+					ImageCount++;
+
+				GCEflag = 1;
+
+				if (ImageCount > ImageArray) {
+					aTemp = ImageArray;
+					ImageArray = (ImageArray << 1) + 1;
+					if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray)))
+					{
+						printf("Out of memory!");
+						exit(-1);
+					}
+					if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc , sizeof(GIFIMAGEDESC *) * ImageArray)))
+					{
+						printf("Out of memory!");
+						exit(-1);
+					}
+					for (j = aTemp ; j < ImageArray ; j++) {
+						gifGraphicControl[j] = NULL;
+						gifImageDesc[j]      = NULL;
+					}
+				}
+				
+				if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL))))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+				
+				
+				if (ReadGifGraphicControl(gifGraphicControl[ImageCount-1], &MemGif))
+					fprintf(stderr,
+					"Error reading Graphic Control Extension information\n");
+				
+				if (!*MemGif++ == 0)
+					fprintf(stderr,
+					"Error reading Graphic Control Extension\n");
+
+				break;
+				
+			case 0xFF:  /* Application Extension */
+				ApplicationCount++;
+				if (ApplicationCount > ApplicationArray)
+					ApplicationArray = (ApplicationArray << 1) + 1;
+				
+				if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray)))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+				
+				if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION))))
+				{
+					printf("Out of memory!");
+					exit(-1);
+				}
+
+				
+				if (ReadGifApplication(gifApplication[ApplicationCount - 1], &MemGif))
+					fprintf(stderr,
+					"Error reading Application Extension information\n");		
+				break;
+				
+			default:
+				
+				printf("Unknown Extension Label: 0x%02x\n", Label);
+				break;
+			}
+			break;
+            default:
+                fprintf(stderr, "Unknown Block Separator Character: 0x%02x\n",
+					Identifier);
+        }
+	}
+	
+	
+}
diff --git a/hdf/util/gifread.c b/hdf/util/gifread.c
new file mode 100644
index 0000000..559eb80
--- /dev/null
+++ b/hdf/util/gifread.c
@@ -0,0 +1,427 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ 
+/****************************************************************************\
+**  Title:       GIFREAD.C                                                  **
+**  Purpose:     Read the information from a GIF file.                      **
+**  Version:     1.0                                                        **
+**  Date:        March 1992                                                 **
+**  Author:      James D. Murray, Anaheim, CA  USA                          **
+**  C Compilers: Borland C++ v2.0, Microsoft C v6.00a                       **
+**                                                                          **
+**  This module contains six functions which read various data structures   **
+**  stored in GIF 87a and 89a-format files.                                 **
+**                                                                          **
+**  This module contains the following functions:                           **
+**                                                                          **
+**      ReadGifHeader         - Read a GIF image file Header                **
+**      ReadGifImageDesc      - Read a GIF Local Image Descriptor           **
+**      ReadGifGraphicControl - Read a GIF Graphic Control Extension block  **
+**      ReadGifPlainText      - Read a GIF Plain Text Extension block       **
+**      ReadGifApplication    - Read a GIF Application Extension block      **
+**      ReadGifComment        - Read a GIF Comment Extension block          **
+**      ReadDataSubBlocks     - Read one or more GIF data sub-blocks        **
+**                                                                          **
+**  Copyright (C) 1991,92 by Graphics Software Labs.  All rights reserved.  **
+\****************************************************************************/
+#include <stdio.h>                
+#include <stdlib.h>               
+#include "gif.h"                  
+
+/* External global variables */   
+/* WORD (*GetWord)(FILE *);
+** DWORD (*GetDword)(FILE *);
+*/
+int EndianOrder;
+int i;
+
+
+WORD 
+GetWord (MemGif)
+BYTE *MemGif;
+{
+	register WORD w;
+	if (EndianOrder == 1) /* LittleEndian */
+	{
+		w  = (WORD) (*MemGif++ & 0xFF);
+		w |= (WORD) ((*MemGif++ & 0xFF) << 0x08);
+	}
+	else
+	{
+		w = (WORD) (*MemGif++ & 0xFF);
+		w = ((WORD) (*MemGif++ & 0xFF)) | (w << 0x08);
+	}
+	return w;
+}
+
+BYTE
+GetByte (MemGif)
+BYTE *MemGif;
+{	
+	return *MemGif;
+}
+
+/*
+**  Read a GIF image BYTE Header.
+**
+**  This function reads the Header, Logical Screen Descriptor, and
+**  Global Color Table (if any) from a GIF image file.  The information
+**  is stored in a GIFHEAD structure.
+**
+**  Returns: -1 if a FILE stream error occured during the read,
+**           otherwise 0 if no error occured.
+*/
+int
+ReadGifHeader(GifHead, MemGif2)
+GIFHEAD *GifHead;       /* Pointer to GIF header structure  */
+BYTE    **MemGif2;       /* GIF image file input FILE stream */
+{
+    register WORD i;    /* Loop counter                                */
+    WORD tableSize;     /* Number of entires in the Global Color Table */
+	
+	GifHead->TableSize = 0;
+	for (i = 0 ; i < 6 ; i++) {
+		GifHead->HeaderDump[i] = *(*MemGif2)++;
+	}
+	if (strncmp((char *)GifHead->HeaderDump , "GIF" , 3)) {
+		printf("The file does not appear to be a valid GIF file.\n");
+		exit(-1);
+	}
+	
+	for (i = 0 ; i < 7 ; i++) {
+		GifHead->LSDDump[i] = *(*MemGif2)++;
+	}
+
+	GifHead->PackedField = GifHead->LSDDump[4];
+	/* Check if a Global Color Table is present */
+    if (GifHead->PackedField & 0x80)
+    {
+        /* Read number of color table entries */
+        tableSize = (WORD) (1L << ((GifHead->PackedField & 0x07) + 1));
+		GifHead->TableSize = tableSize;
+        /* Read the Global Color Table */
+		/* 
+		** There are some changes made here apart from just
+		** reading in the global color table as would
+		** seem intuitively obvious.
+		** The colors are stored in the bottom part of the 
+		** palette as opposed to the top
+		*/
+
+        for (i = 0; i < tableSize; i++)
+        {
+            GifHead->HDFPalette[i][0] = *(*MemGif2)++;
+            GifHead->HDFPalette[i][1] = *(*MemGif2)++;
+            GifHead->HDFPalette[i][2] = *(*MemGif2)++;
+        }
+    }
+
+    /* Check for a FILE stream error */
+	/*
+    if (ferror(FpGif))
+        return(-1); 
+	*/
+
+    return(0);          /* No FILE stream error occured */
+}
+
+
+/*
+**  Read a GIF Local Image Descriptor.
+**
+**  This function reads the Local Image Descriptor, and Local Color
+**  Table (if any) from a GIF image file.  The information is stored
+**  in a GIFIMAGEDESC structure.
+**
+**  Note that the ImageSeparator field value in the GIFIMAGEDESC
+**  structure is assigned by the function calling ReadGifImageDesc().
+**
+**  Returns: -1 if a FILE stream error occured during the read,
+**           otherwise 0 if no error occured.
+*/
+int
+ReadGifImageDesc(GifImageDesc, MemGif2)
+GIFIMAGEDESC *GifImageDesc; /* Pointer to GIF image descriptor structure  */
+BYTE         **MemGif2;     /* GIF image file input FILE stream           */
+{
+    register WORD i;        /* Loop counter                               */
+    WORD tableSize;         /* Number of entries in the Local Color Table */
+	BYTE Interlace;         /* PackedField & 0x20 gives information on interlacing */
+	BYTE *TempPtr;
+	int	 ch , ch1;
+
+	GifImageDesc->TableSize = 0;
+	for (i = 0 ; i < 9 ; i++) {
+		GifImageDesc->GIDDump[i] = *(*MemGif2)++;
+	}
+	
+	/*
+	** Get the relevant fields. I need ImageWidth and Height actively hence I have
+	** taken information from those fields. I intend to keep the GifImageDesc data
+	** structure as it is so that anyone needing the rest of the fields can do so 
+	** quickly.
+	*/
+
+	if (EndianOrder == 1) /* LittleEndian */
+	{
+		GifImageDesc->ImageWidth  = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
+		GifImageDesc->ImageWidth |= (WORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08);
+
+		GifImageDesc->ImageHeight  = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
+		GifImageDesc->ImageHeight |= (WORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08);
+
+	}
+	else
+	{
+		GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF);
+		GifImageDesc->ImageWidth = ((WORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+
+		GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF);
+		GifImageDesc->ImageHeight = ((WORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08);
+		
+
+	}
+	
+	GifImageDesc->PackedField = GifImageDesc->GIDDump[8];
+
+	Interlace = GifImageDesc->PackedField & 0x20;
+
+    /* Check if a Local Color Table is present */
+    if (GifImageDesc->PackedField & 0x80)
+    {
+        /* Read number of color table entries */
+        tableSize = (WORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1));
+		GifImageDesc->TableSize = tableSize;
+        /* Read the Local Color Table */
+        for (i = 0; i < tableSize; i++)
+        {
+            GifImageDesc->HDFPalette[i][0] = *(*MemGif2)++;
+            GifImageDesc->HDFPalette[i][1] = *(*MemGif2)++;
+            GifImageDesc->HDFPalette[i][2] = *(*MemGif2)++;
+        }
+    }
+
+	/*
+	** Get LZW minimum Code Size
+	*/
+	GifImageDesc->CodeSize = (WORD)*(*MemGif2)++;
+
+	/*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/
+	if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) {
+		printf("Out of memory");
+		exit(-1);
+	}
+	
+
+	TempPtr = GifImageDesc->GIFImage;
+	do
+	{
+		ch = ch1 = (int)*(*MemGif2)++;
+		while (ch--) *TempPtr++ = *(*MemGif2)++;
+	}
+	while (ch1);
+
+
+    return(0);          /* No FILE stream error occured */
+}
+
+
+/*
+**  Read a GIF Graphic Control Extension block.
+**
+**  Note that the Introducer and Label field values in the GIFGRAPHICCONTROL
+**  structure are assigned by the function calling ReadGifGraphicControl().
+**
+**  Returns: -1 if a FILE stream error occured during the read,
+**           otherwise 0 if no error occured.
+*/
+int
+ReadGifGraphicControl(GifGraphicControl, MemGif2)
+GIFGRAPHICCONTROL *GifGraphicControl; /* Pointer to GC Extension structure */
+BYTE              **MemGif2;          /* GIF image file input FILE stream  */
+{
+
+    
+	for (i = 0 ; i < 5 ; i++) {
+		GifGraphicControl->GCEDump[i] = *(*MemGif2)++;
+	}
+
+    return(0);          /* No FILE stream error occured */
+}
+
+
+/*
+**  Read a GIF Plain Text Extension block.
+**
+**  Note that the Introducer and Label field values in the GIFLPLAINTEXT
+**  structure are assigned by the function calling ReadGifPlainText().
+**
+**  Returns: -1 if a FILE stream error occured during the read,
+**           otherwise 0 if no error occured.
+*/
+int
+ReadGifPlainText(GifPlainText, MemGif2)
+GIFPLAINTEXT *GifPlainText; /* Pointer to Plain Text Extension structure */
+BYTE         **MemGif2;       /* GIF image file input FILE stream          */
+{
+	for (i = 0 ; i < 13 ; i++) {
+		GifPlainText->PTEDump[i] = *(*MemGif2)++;
+	}
+
+    /* Read in the Plain Text data sub-blocks */
+    if (!(GifPlainText->PlainTextData = ReadDataSubBlocks(MemGif2 , &(GifPlainText->DataSize))))
+        return(1);
+
+    /* 
+	GifPlainText->Terminator       = 0;
+	*/
+
+    /* Check for a FILE stream error */
+	/*
+    if (ferror(FpGif))
+        return(-1);
+	*/
+
+    return(0);          /* No FILE stream error occured */
+}
+
+
+/*
+**  Read a GIF Application Extension block.
+**
+**  Note that the Introducer and Label field values in the GIFAPPLICATION
+**  structure are assigned by the function calling ReadGifApplication().
+**
+**  Returns: -1 if a FILE stream error occured during the read,
+**           otherwise 0 if no error occured.
+*/
+int
+ReadGifApplication(GifApplication, MemGif2)
+GIFAPPLICATION *GifApplication; /* Pointer to Application Extension structure */
+BYTE           **MemGif2;          /* GIF image file input FILE stream           */
+{
+	for (i = 0 ; i < 12 ; i++) {
+		GifApplication->AEDump[i] = *(*MemGif2)++;
+	}
+
+    /* Read in the Plain Text data sub-blocks */
+    if (!(GifApplication->ApplicationData = ReadDataSubBlocks(MemGif2 , &(GifApplication->DataSize))))
+        return(1);
+	/*
+    GifApplication->Terminator     = 0;
+	*/
+    
+	/* Check for a FILE stream error */
+	/*
+    if (ferror(FpGif))
+        return(-1);
+	*/
+
+    return(0);          /* No FILE stream error occured */
+}
+
+
+/*
+**  Read a GIF Comment Extension block.
+**
+**  Note that the Introducer and Label field values in the GIFCOMMENT
+**  structure are assigned by the function calling ReadGifComment().
+**
+**  Returns: -1 if a FILE stream error occured during the read,
+**           otherwise 0 if no error occured.
+*/
+int
+ReadGifComment(GifComment, MemGif2)
+GIFCOMMENT *GifComment; /* Pointer to GIF Comment Extension structure */
+BYTE       **MemGif2;      /* GIF image file input FILE stream           */
+{
+	
+    /* Read in the Plain Text data sub-blocks */
+    if (!(GifComment->CommentData = ReadDataSubBlocks(MemGif2 , &(GifComment->DataSize))))
+        return(1);
+
+    GifComment->Terminator = 0;
+    
+    return(0);          /* No FILE stream error occured */
+}
+
+
+/*
+**  Read one or more GIF data sub-blocks and write the information
+**  to a buffer.
+**
+**  A GIF "sub-block" is a single count byte followed by 1 to 255
+**  additional data bytes.
+**
+**  Returns: A NULL pointer if a memory allocation error occured,
+**           otherwise a valid pointer if no error occured.
+*/
+BYTE *
+ReadDataSubBlocks(MemGif2 , DSize)
+BYTE **MemGif2;        /* GIF image file input FILE stream              */
+WORD *DSize;
+{
+    BYTE *ptr1;     /* Pointer used to "walk the heap"               */
+    BYTE *ptr2;     /* Pointer used to mark the top of the heap      */
+    BYTE dataSize;  /* Size of the current data sub-block being read */
+    WORD bufSize;   /* Total size of the Plain Text data buffer      */
+	int tempcount = 0;
+
+	bufSize = 0;				/* The output buffer is empty          */
+	
+    dataSize = *(*MemGif2)++;		/* Get the size of the first sub-block */
+	
+    /* Allocate initial data buffer */
+    if (!(ptr1 = ptr2 = (BYTE *) malloc(dataSize + 1))) {
+		printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed");
+        return((BYTE *) NULL);
+	}
+    for (;;)
+    {
+		tempcount++;
+        bufSize += (dataSize);  /* Running total of the buffer size */
+		*DSize = bufSize;
+
+#ifdef NO
+        *ptr1++ = dataSize;			/* Write the data count */
+#endif
+        while (dataSize--)			/* Read/write the Plain Text data */
+             *ptr1++ = *(*MemGif2)++;
+        
+        /* Check if there is another data sub-block */
+        if ((dataSize = *(*MemGif2)++) == 0)
+            break;  /* Block Terminator encountered */
+		
+        /* Increase the buffer size to accomodate the next sub-block */
+        if (!(ptr1 = ptr2 = (BYTE *) realloc(ptr2, bufSize + dataSize + 1)))
+            return((BYTE *) NULL);
+		
+
+		ptr1 += bufSize;			/* Move pointer to the end of the data */
+		
+	
+    }
+
+#ifdef NO
+    *ptr1++ = (BYTE) NULL;			/* Add NULL to simulate Terminator value */
+#endif
+   	*ptr1++ = '\0';
+	
+    return(ptr2);					/* Return a pointer to the sub-block data */
+}
+
+
+
+
+
diff --git a/hdf/util/h4cc.in b/hdf/util/h4cc.in
new file mode 100755
index 0000000..e445f4a
--- /dev/null
+++ b/hdf/util/h4cc.in
@@ -0,0 +1,246 @@
+#! /bin/sh
+##
+## Copyright by the Board of Trustees of the University of Illinois.
+## All rights reserved.
+##
+
+############################################################################
+##                                                                        ##
+## Things You May Have to Modify:                                         ##
+##                                                                        ##
+## If the following paths don't point to the place were HDF4 is installed ##
+## on your system (i.e., you received a binary distribution or moved the  ##
+## files from the originally installed directory to another directory)    ##
+## then modify them accordingly to represent the new paths.               ##
+##                                                                        ##
+############################################################################
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+includedir="@includedir@"
+
+############################################################################
+##                                                                        ##
+## You shouldn't have to modify anything below this line.                 ##
+##                                                                        ##
+############################################################################
+
+host_os="@host_os@"
+
+prog_name="`basename $0`"
+
+allargs=""
+compile_args=""
+libraries=""
+link_args=""
+link_objs=""
+
+do_link="yes"
+do_compile="no"
+dash_o="no"
+dash_c="no"
+get_output_file="no"
+
+SHOW="eval"
+CCBASE="@CC@"
+CLINKERBASE="@CC@"
+CFLAGS="@CFLAGS@"
+CPPFLAGS="@CPPFLAGS@"
+LDFLAGS="@LDFLAGS@"
+LIBS="@LIBS@"
+
+CC="${HDF4_CC:-$CCBASE}"
+CLINKER="${HDF4_CLINKER:-$CLINKERBASE}"
+
+USE_SHARED_LIB="${HDF4_USE_SHLIB:-no}"
+
+usage() {
+  # A wonderfully informative "usage" message.
+  echo "usage: $prog_name [OPTIONS] <compile line>"
+  echo "  OPTIONS:"
+  echo "    -help        This help message."
+  echo "    -echo        Show all the shell commands executed"
+  echo "    -prefix=DIR  Prefix directory to find HDF4 lib/ and include/"
+  echo "                   subdirectories [default: $prefix]"
+  echo "    -show        Show the commands without executing them"
+  echo "    -shlib       Compile with shared HDF4 libraries."
+  echo "    -noshlib     Compile with static HDF4 libraries [default]"
+  echo " "
+  echo "  <compile line>  - the normal compile line options for your compiler."
+  echo "                    $prog_name uses the same compiler you used to compile"
+  echo "                    HDF4. Check with your compiler's man pages for more"
+  echo "                    information on which options are needed."
+  echo " "
+  echo " You can override the compiler, linker, and whether or not to use static"
+  echo " or shared libraries to compile your program by setting the following"
+  echo " environment variables accordingly:"
+  echo " "
+  echo "   HDF4_CC                  -  use a different C compiler"
+  echo "   HDF4_CLINKER             -  use a different linker"
+  echo "   HDF4_USE_SHLIB=[yes|no]  -  use shared or static version of the HDF4 library"
+  echo "                                 [default: no]"
+  echo " "
+  exit 1
+}
+
+if test "$#" = "0"; then
+  # No parameters specified, issue usage statement and exit.
+  usage
+fi
+
+for arg in $@ ; do
+  if test "x$get_output_file" = "xyes"; then
+    link_args="$link_args $arg"
+    output_file="$arg"
+    get_output_file="no"
+    continue
+  fi
+
+  case "$arg" in
+    -c)
+      allargs="$allargs $arg"
+      compile_args="$compile_args $arg"
+
+      if test "x$do_link" = "xyes" -a -n "$output_file"; then
+        compile_args="$compile_args -o $outputfile"
+      fi
+
+      do_link="no"
+      dash_c="yes"
+      ;;
+    -o)
+      allargs="$allargs $arg"
+      dash_o="yes"
+
+      if test "x$dash_c" = "xyes"; then
+        compile_args="$compile_args $arg"
+      else
+        link_args="$link_args $arg"
+        do_link="yes"
+        get_output_file="yes"
+      fi
+      ;;
+    -E|-M)
+      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=\(.*\)'`"
+      ;;
+    -echo)
+      set -x
+      ;;
+    -show)
+      SHOW="echo"
+      ;;
+    -shlib)
+      USE_SHARED_LIB="yes"
+      ;;
+    -noshlib)
+      USE_SHARED_LIB="no"
+      ;;
+    -help)
+      usage
+      ;;
+    *\"*)
+      qarg="'"$arg"'"
+      allargs="$allargs $qarg"
+      ;;
+    *\'*)
+      qarg='\"'"$arg"'\"'
+      allargs="$allargs $qarg"
+      ;;
+    *)
+      allargs="$allargs $qarg"
+
+      if test -s "$arg"; then
+        ext=`expr "$arg" : '.*\(\..*\)'`
+
+        if test "x$ext" = "x.c"; then
+          do_compile="yes"
+          compile_args="$compile_args $arg"
+          fname=`basename $arg .c`
+          link_objs="$link_objs $fname.o"
+        elif test "x$ext" = "x.o"; then
+          if test "x$dash_c" = "xyes"; then
+            compile_args="$compile_args $arg"
+          else
+            do_link="yes"
+            link_objs="$link_objs $arg"
+          fi
+        elif test "x$ext" = "x.a"; then
+          # This is an archive that we're linking in
+          libraries=" $libraries $arg "
+        else
+          compile_args="$compile_args $arg"
+          link_args="$link_args $arg"
+        fi
+      else
+        compile_args="$compile_args $arg"
+        link_args="$link_args $arg"
+      fi
+      ;;
+  esac
+done
+
+if test "x$do_compile" = "xyes"; then
+  if test "x$dash_c" != "xyes"; then
+    compile_args="-c $compile_args"
+  fi
+
+  $SHOW $CC -I$includedir $CPPFLAGS $CFLAGS $compile_args
+  status=$?
+
+  if test "$status" != "0"; then
+    exit $status
+  fi
+fi
+
+if test "x$do_link" = "xyes"; then
+  libraries=" $libraries -lmfhdf -ldf "
+  link_args="$link_args -L${libdir}"
+
+  if test "x$USE_SHARED_LIB" != "xyes"; then
+    # The "-ldf" & "-lmfhdf" flags are in here already...This is a static
+    # compile though, so change it to the static version (.a) of the library.
+    new_libraries=""
+    for lib in $libraries; do
+      case "$lib" in
+        -ldf)
+          new_libraries="$new_libraries ${libdir}/libdf.a"
+          ;;
+        -lmfhdf)
+          new_libraries="$new_libraries ${libdir}/libmfhdf.a"
+          ;;
+        *)
+          new_libraries="$new_libraries $lib"
+          ;;
+      esac
+    done
+    libraries="$new_libraries"
+  fi
+
+  for lib in $libraries; do
+    if echo $link_args | grep " $lib " > /dev/null ||
+       echo $link_args | grep " $lib$" > /dev/null; then
+      :
+    else
+      link_args="$link_args $lib "
+    fi
+  done
+
+  # The LIBS are just a bunch of -l* libraries necessary for the HDF4
+  # module. It's okay if they're included twice in the compile line.
+  link_args="$link_args $LIBS"
+
+  $SHOW $CLINKER $CFLAGS $LDFLAGS $link_objs $link_args
+  status=$?
+fi
+
+exit $status
diff --git a/hdf/util/h4fc.in b/hdf/util/h4fc.in
new file mode 100755
index 0000000..2eb5929
--- /dev/null
+++ b/hdf/util/h4fc.in
@@ -0,0 +1,213 @@
+#! /bin/sh
+##
+## Copyright by the Board of Trustees of the University of Illinois.
+## All rights reserved.
+##
+
+############################################################################
+##                                                                        ##
+## Things You May Have to Modify:                                         ##
+##                                                                        ##
+## If the following paths don't point to the place were HDF4 is installed ##
+## on your system (i.e., you received a binary distribution or moved the  ##
+## files from the originally installed directory to another directory)    ##
+## then modify them accordingly to represent the new paths.               ##
+##                                                                        ##
+############################################################################
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+includedir="@includedir@"
+
+############################################################################
+##                                                                        ##
+## You shouldn't have to modify anything below this line.                 ##
+##                                                                        ##
+############################################################################
+
+host_os="@host_os@"
+
+prog_name="`basename $0`"
+
+allargs=""
+compile_args=""
+libraries=""
+link_args=""
+link_objs=""
+
+do_link="yes"
+do_compile="no"
+dash_o="no"
+dash_c="no"
+get_output_file="no"
+
+SHOW="eval"
+F77BASE="@F77@"
+F77LINKERBASE="@F77@"
+FFLAGS="@FFLAGS@"
+LDFLAGS="@LDFLAGS@"
+LIBS="@LIBS@"
+
+F77="${HDF4_F77:-$F77BASE}"
+F77LINKER="${HDF4_F77LINKER:-$F77LINKERBASE}"
+
+usage() {
+  # A wonderfully informative "usage" message.
+  echo "usage: $prog_name [OPTIONS] <compile line>"
+  echo "  OPTIONS:"
+  echo "    -help        This help message."
+  echo "    -echo        Show all the shell commands executed"
+  echo "    -prefix=DIR  Prefix directory to find HDF4 lib/ and include/"
+  echo "                   subdirectories [default: $prefix]"
+  echo "    -show        Show the commands without executing them"
+  echo " "
+  echo "  <compile line>  - the normal compile line options for your compiler."
+  echo "                    $prog_name uses the same compiler you used to compile"
+  echo "                    HDF4. Check with your compiler's man pages for more"
+  echo "                    information on which options are needed."
+  echo " "
+  echo " You can override the compiler, linker, and whether or not to use static"
+  echo " or shared libraries to compile your program by setting the following"
+  echo " environment variables accordingly:"
+  echo " "
+  echo "   HDF4_F77                 -  use a different Fortran 77 compiler"
+  echo "   HDF4_F77LINKER           -  use a different linker"
+  echo " "
+  exit 1
+}
+
+if test "$#" = "0"; then
+  # No parameters specified, issue usage statement and exit.
+  usage
+fi
+
+for arg in $@ ; do
+  if test "x$get_output_file" = "xyes"; then
+    link_args="$link_args $arg"
+    output_file="$arg"
+    get_output_file="no"
+    continue
+  fi
+
+  case "$arg" in
+    -c)
+      allargs="$allargs $arg"
+      compile_args="$compile_args $arg"
+
+      if test "x$do_link" = "xyes" -a -n "$output_file"; then
+        compile_args="$compile_args -o $outputfile"
+      fi
+
+      do_link="no"
+      dash_c="yes"
+      ;;
+    -o)
+      allargs="$allargs $arg"
+      dash_o="yes"
+
+      if test "x$dash_c" = "xyes"; then
+        compile_args="$compile_args $arg"
+      else
+        link_args="$link_args $arg"
+        do_link="yes"
+        get_output_file="yes"
+      fi
+      ;;
+    -E|-M)
+      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=\(.*\)'`"
+      ;;
+    -echo)
+      set -x
+      ;;
+    -show)
+      SHOW="echo"
+      ;;
+    -help)
+      usage
+      ;;
+    *\"*)
+      qarg="'"$arg"'"
+      allargs="$allargs $qarg"
+      ;;
+    *\'*)
+      qarg='\"'"$arg"'\"'
+      allargs="$allargs $qarg"
+      ;;
+    *)
+      allargs="$allargs $qarg"
+
+      if test -s "$arg"; then
+        ext=`expr "$arg" : '.*\(\..*\)'`
+        if [ "$ext" = ".f" -o "$ext" = ".F" -o "$ext" = ".f90" -o \
+             "$ext" = ".for" -o "$ext" = ".FOR" -o "$ext" = ".F90" ] ; then       
+          do_compile="yes"
+          compile_args="$compile_args $arg"
+          fname=`basename $arg $ext`
+          link_objs="$link_objs $fname.o"
+        elif test "x$ext" = "x.o"; then
+          if test "x$dash_c" = "xyes"; then
+            compile_args="$compile_args $arg"
+          else
+            do_link="yes"
+            link_objs="$link_objs $arg"
+          fi
+        elif test "x$ext" = "x.a"; then
+          # This is an archive that we're linking in
+          libraries=" $libraries $arg "
+        else
+          compile_args="$compile_args $arg"
+          link_args="$link_args $arg"
+        fi
+      else
+        compile_args="$compile_args $arg"
+        link_args="$link_args $arg"
+      fi
+      ;;
+  esac
+done
+
+if test "x$do_compile" = "xyes"; then
+  if test "x$dash_c" != "xyes"; then
+    compile_args="-c $compile_args"
+  fi
+
+  $SHOW $F77 -I$includedir $FFLAGS $compile_args
+  status=$?
+
+  if test "$status" != "0"; then
+    exit $status
+  fi
+fi
+
+if test "x$do_link" = "xyes"; then
+  libraries=" $libraries -lmfhdf -ldf "
+  link_args="$link_args -L${libdir}"
+
+  for lib in $libraries; do
+    if echo $link_args | grep " $lib " > /dev/null ||
+       echo $link_args | grep " $lib$" > /dev/null; then
+      :
+    else
+      link_args="$link_args $lib "
+    fi
+  done
+
+  # The LIBS are just a bunch of -l* libraries necessary for the HDF4
+  # module. It's okay if they're included twice in the compile line.
+  link_args="$link_args $LIBS"
+
+  $SHOW $F77LINKER $FFLAGS $LDFLAGS $link_objs $link_args
+  status=$?
+fi
+
+exit $status
diff --git a/hdf/util/h4redeploy.in b/hdf/util/h4redeploy.in
new file mode 100755
index 0000000..aee75f2
--- /dev/null
+++ b/hdf/util/h4redeploy.in
@@ -0,0 +1,166 @@
+#! /bin/sh
+##
+## Copyright by the Board of Trustees of the University of Illinois.
+## All rights reserved.
+##
+
+## Update HDF4 compiler tools after the HDF4 software has been installed
+## in a new location.
+## For help page, use "h5redeploy -help"
+
+# Function definitions
+
+# show help page
+usage() {
+  # A wonderfully informative "usage" message.
+  echo "usage: $prog_name [OPTIONS]"
+  echo "  OPTIONS:"
+  echo "    -help|help   This help message"
+  echo "    -echo        Show all the shell commands executed"
+  echo "    -force       No prompt, just do it"
+  echo "    -prefix=DIR  New directory to find HDF4 lib/ and include/"
+  echo "                   subdirectories [default: current directory]"
+  echo "    -tool=TOOL   Tool to update. TOOL must be in the current"
+  echo "                   directory and writable. [default: $h4tools]"
+  echo "    -show        Show the commands without executing them"
+  echo " "
+  exit 1
+}
+
+# display variable values
+dump_vars(){
+    echo "====Showing all variable values====="
+    echo prefix=$prefix
+    echo h4tools=$h4tools
+    echo "====End Showing====="
+}
+
+# show actions to be taken
+show_action()
+{
+    echo "Update the following tools because they are now installed at a new directory"
+    for t in $foundtools; do
+	echo "${t}:"
+	echo "   current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`"
+	echo "   new     setting="\""$prefix"\"
+    done
+}
+
+
+# Report Error message
+ERROR()
+{
+    echo "***ERROR***"
+    echo "$1"
+}
+
+# Main
+#
+# Initialization
+h4tools="h4cc h4fc"	# possible hdf4 tools
+foundtools=		# tools found and will be modified
+fmode=			# force mode, default is off
+prefix=`(cd ..;pwd)`
+
+# Parse options
+for arg in $@ ; do
+  case "$arg" in
+    -prefix=*)
+      prefix="`expr "$arg" : '-prefix=\(.*\)'`"
+      ;;
+    -echo)
+      set -x
+      ;;
+    -show)
+      SHOW="echo"
+      ;;
+    -tool=*)
+      h4tools="`expr "$arg" : '-tool=\(.*\)'`"
+      ;;
+    -help|help)
+      usage
+      ;;
+    -force)
+      fmode=yes
+      ;;
+    *)
+      ERROR "Unknown Option($arg)"
+      usage
+      exit 1
+      ;;
+  esac
+done
+
+# Sanity checks
+if [ ! -d $prefix ]; then
+    ERROR "prefix($prefix) is not an existing directory"
+    exit 1
+fi
+
+for x in $h4tools; do
+    if [ -f $x ]; then
+	foundtools="$foundtools $x"
+	if [ ! -w $x ]; then
+	    ERROR "h5tool($x) is not writable"
+	    exit 1
+	fi
+    fi
+done
+
+if [ -z "$foundtools" ]; then
+    ERROR "found no tools to modify"
+    exit 1
+fi
+
+# Show actions to be taken and get consent
+show_action
+# Ask confirmation unless fmode is on
+if [ x-$fmode = x- ]; then
+    echo "Continue? (yes/no)"
+    read ansx
+    ans=`echo $ansx | tr "[A-Z]" "[a-z]"`
+    if [ x-$ans != x-yes ]; then
+	echo ABORT.  No tools changed.
+	exit 1
+    fi
+fi
+
+
+# Create the update commands
+CMDFILE=/tmp/h5redeploy.$$
+touch $CMDFILE
+chmod 0600 $CMDFILE
+echo "/^prefix/c"                 >> $CMDFILE
+echo prefix=\""$prefix"\"         >> $CMDFILE
+echo .                            >> $CMDFILE
+(echo w; echo q)                  >> $CMDFILE
+
+
+# Update them
+if [ "$SHOW" = "echo" ]; then
+    echo "===Update commands are:===="
+    cat $CMDFILE
+    echo "===End Update commands====="
+fi
+
+for t in $foundtools; do
+    echo Update $t ...
+    COMMAND="ed - $t"
+    if [ "$SHOW" = "echo" ]; then
+	echo $COMMAND
+    else
+	$COMMAND < $CMDFILE
+    fi
+done
+
+
+# Cleanup
+rm -f $CMDFILE
+exit 0
+
+# Some possible future features to add
+# CCBASE - Name of the alternative C compiler
+# CLINKERBASE - Name of the alternative linker
+# LDFLAGS   - Path to different libraries your application will link with
+#     (this path should include the path to the zlib library)
+# LIBS      - Libraries your application will link with
diff --git a/hdf/util/hdf24to8.c b/hdf/util/hdf24to8.c
new file mode 100644
index 0000000..823c25a
--- /dev/null
+++ b/hdf/util/hdf24to8.c
@@ -0,0 +1,352 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdf24to8.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/**************************************************************************
+* hdf24hdf8 Quantizes a HDF RGB 24 bit "pixel" image into a 8 bit image
+*               with RGB palette and stores it as a HDF 8-bit raster image
+*               file.
+*
+*  usage:        hdf24hdf8 r24_file hdf8_file
+*
+*               On Input:
+*               --------
+*
+*               hdf24_file  - File containing the HDF RGB 24-bit
+*                             raster image.
+*
+*               On Output:
+*               ---------
+*
+*               hdf8_file   - HDF file with one 8-bit raster image set,
+*                             i.e. 8-bit image, dimensions, and
+*                             RGB palette.
+*
+* by:           NCSA
+* date(s):        May 89, Jun 89, Aug 89, May 90
+*
+****************************************************************************/
+
+typedef unsigned char UCHAR;
+typedef unsigned int UINT;
+
+#define     NCOLORS     256
+#define     PALSIZE     3 * NCOLORS
+#define     COMPRESSION 0   /* no compression */
+
+#include <stdio.h>
+
+#ifdef UNIX
+#include <sys/file.h>
+#endif
+
+#include "hdf.h"
+
+#define USAGE   fprintf (stderr, "usage: hdf24hdf8 hdf24_file hdf8_file\n")
+
+int         main
+            (int, char *a[]);
+int         r24r8
+            (int32, int32, unsigned char *, unsigned char *, int, unsigned char *);
+
+int
+main(int argc, char *argv[])
+{
+    int         i;
+    int32       x_dim, y_dim, size;
+    int         interlace;
+    uint8      *r24, *r8, *pal;
+    uint8       hdfpal[PALSIZE], *p;
+
+    if (argc != 3)
+      {
+          USAGE;
+          exit(1);
+      }
+
+    /* Get the HDF R24 image */
+
+    if (DF24getdims(argv[1], &x_dim, &y_dim, &interlace) < 0)
+      {
+          fprintf(stderr, "error: %s is not an HDF file or ",
+                  argv[1]);
+          fprintf(stderr, "it does not contain a R24 image\n");
+          exit(-1);
+      }
+
+    size = x_dim * y_dim;
+
+    if ((r24 = (UCHAR *) HDmalloc(size * 3)) == NULL)
+      {
+          fprintf(stderr, "error: malloc to hold r24 image failed\n");
+          exit(-1);
+      }
+
+    if (DF24getimage(argv[1], (VOIDP) r24, x_dim, y_dim) < 0)
+      {
+          fprintf(stderr, "error: DF24getimage failed\n");
+          exit(-1);
+      }
+
+    if ((r8 = (UCHAR *) HDmalloc(size)) == NULL)
+      {
+          fprintf(stderr, "error: malloc to hold r8 image failed\n");
+          exit(-1);
+      }
+    if ((pal = (UCHAR *) HDmalloc(PALSIZE)) == NULL)
+      {
+          fprintf(stderr, "error: malloc to hold palette failed\n");
+          exit(-1);
+      }
+
+    if (r24r8(x_dim, y_dim, r24, r8, NCOLORS, pal) == -1)
+      {
+          fprintf(stderr, "error: quantization failed\n");
+          exit(-1);
+      }
+
+    /* rearrange palette to conform to HDF requirements */
+    p = hdfpal;
+    for (i = 0; i < NCOLORS; i++)
+      {
+          *p++ = pal[i];
+          *p++ = pal[i + NCOLORS];
+          *p++ = pal[i + NCOLORS * 2];
+      }
+    if (DFR8setpalette(hdfpal) == -1)
+      {
+          HEprint(stderr, 0);
+          exit(-1);
+      }
+    if (DFR8putimage(argv[2], (VOIDP) r8, x_dim, y_dim, COMPRESSION) == -1)
+      {
+          HEprint(stderr, 0);
+          exit(-1);
+      }
+
+    HDfree((char *) r24);
+    HDfree((char *) r8);
+    HDfree((char *) pal);
+
+    return 0;
+}
+
+int
+r24r8(int32 xres, int32 yres, UCHAR * dat24, UCHAR * dat8, int cres, UCHAR * cdat)
+{
+    int         ct, xct, yct;
+    int         rres, rd, rr, rn, rct;
+    int         gres, gd, gr, gn, gct;
+    int         bres, bd, br, bn, bct;
+    int         coff;
+    UINT       *idat[2];
+    UINT       *cp, *np;
+    UCHAR      *dip, *dop, *rp, *gp, *bp;
+
+    if ((idat[0] = (UINT *) HDmalloc((size_t)(6 * xres) * sizeof(UINT))) == NULL)
+      {
+          fprintf(stderr, "error: Memory allocation fault\n");
+          return -1;
+      }
+    idat[1] = idat[0] + (3 * xres);
+
+    rres = 6;
+    gres = 7;
+    bres = 6;
+    coff = 2;
+
+    rr = gr = br = 255;
+    rn = rres - 1;
+    gn = gres - 1;
+    bn = bres - 1;
+
+    rp = cdat + coff;
+    gp = rp + cres;
+    bp = gp + cres;
+
+    for (rct = 0; rct < rres; rct++)
+      {
+          for (gct = 0; gct < gres; gct++)
+            {
+                for (bct = 0; bct < bres; bct++)
+                  {
+                      *rp++ = (UCHAR) (rr * rct / rn);
+                      *gp++ = (UCHAR) (gr * gct / gn);
+                      *bp++ = (UCHAR) (br * bct / bn);
+                  }
+            }
+      }
+
+    rp = cdat;
+    gp = rp + cres;
+    bp = gp + cres;
+    cp = idat[0];
+    np = idat[1];
+    dip = dat24;
+    dop = dat8;
+
+    for (xct = (intn) (3 * xres); --xct >= 0;)
+        *cp++ = (UINT)*dip++;
+
+    for (yct = 0; yct < (yres - 1); yct++)
+      {
+          np = idat[(yct + 1) % 2];
+          for (xct = (intn) (3 * xres); --xct >= 0;)
+              *np++ = (UINT)*dip++;
+
+          cp = idat[yct % 2];
+          np = idat[(yct + 1) % 2];
+
+          if ((rct = ((int)cp[0] * rn / rr)) > rn)
+              rct = rn;
+          if ((gct = ((int)cp[1] * gn / gr)) > gn)
+              gct = gn;
+          if ((bct = ((int)cp[2] * bn / br)) > bn)
+              bct = bn;
+
+          *dop++ = (UCHAR) (ct = (rct * gres + gct) * bres + bct + coff);
+
+          rd = (int)cp[0] - rp[ct];
+          gd = (int)cp[1] - gp[ct];
+          bd = (int)cp[2] - bp[ct];
+
+          cp += 3;
+          np += 3;
+
+          cp[0] += (UINT)(rd * 7 / 16);
+          cp[1] += (UINT)(gd * 7 / 16);
+          cp[2] += (UINT)(bd * 7 / 16);
+          np[-3] += (UINT)(rd * 5 / 16);
+          np[-2] += (UINT)(gd * 5 / 16);
+          np[-1] += (UINT)(bd * 5 / 16);
+          np[0] += (UINT)(rd / 16);
+          np[1] += (UINT)(gd / 16);
+          np[2] += (UINT)(bd / 16);
+
+          for (xct = 2; xct < xres; xct++)
+            {
+                if ((rct = ((int)cp[0] * rn / rr)) > rn)
+                    rct = rn;
+                if ((gct = ((int)cp[1] * gn / gr)) > gn)
+                    gct = gn;
+                if ((bct = ((int)cp[2] * bn / br)) > bn)
+                    bct = bn;
+
+                *dop++ = (UCHAR) (ct = (rct * gres + gct) * bres + bct + coff);
+
+                rd = (int)cp[0] - rp[ct];
+                gd = (int)cp[1] - gp[ct];
+                bd = (int)cp[2] - bp[ct];
+
+                cp += 3;
+                np += 3;
+
+                cp[0] += (UINT)(rd * 7 / 16);
+                cp[1] += (UINT)(gd * 7 / 16);
+                cp[2] += (UINT)(bd * 7 / 16);
+                np[-6] += (UINT)(rd * 3 / 16);
+                np[-5] += (UINT)(gd * 3 / 16);
+                np[-4] += (UINT)(bd * 3 / 16);
+                np[-3] += (UINT)(rd * 5 / 16);
+                np[-2] += (UINT)(gd * 5 / 16);
+                np[-1] += (UINT)(bd * 5 / 16);
+                np[0] += (UINT)(rd / 16);
+                np[1] += (UINT)(gd / 16);
+                np[2] += (UINT)(bd / 16);
+
+            }
+
+          if ((rct = ((int)cp[0] * rn / rr)) > rn)
+              rct = rn;
+          if ((gct = ((int)cp[1] * gn / gr)) > gn)
+              gct = gn;
+          if ((bct = ((int)cp[2] * bn / br)) > bn)
+              bct = bn;
+
+          *dop++ = (UCHAR) (ct = (rct * gres + gct) * bres + bct + coff);
+
+          rd = (int)cp[0] - rp[ct];
+          gd = (int)cp[1] - gp[ct];
+          bd = (int)cp[2] - bp[ct];
+
+          cp += 3;
+          np += 3;
+
+          np[-6] += (UINT)(rd * 3 / 16);
+          np[-5] += (UINT)(gd * 3 / 16);
+          np[-4] += (UINT)(bd * 3 / 16);
+          np[-3] += (UINT)(rd * 5 / 16);
+          np[-2] += (UINT)(gd * 5 / 16);
+          np[-1] += (UINT)(bd * 5 / 16);
+      }
+
+    cp = idat[yct % 2];
+
+    if ((rct = ((int)cp[0] * rn / rr)) > rn)
+        rct = rn;
+    if ((gct = ((int)cp[1] * gn / gr)) > gn)
+        gct = gn;
+    if ((bct = ((int)cp[2] * bn / br)) > bn)
+        bct = bn;
+
+    *dop++ = (UCHAR) (ct = (rct * gres + gct) * bres + bct + coff);
+
+    rd = (int)cp[0] - rp[ct];
+    gd = (int)cp[1] - gp[ct];
+    bd = (int)cp[2] - bp[ct];
+
+    cp += 3;
+
+    cp[0] += (UINT)(rd * 7 / 16);
+    cp[1] += (UINT)(gd * 7 / 16);
+    cp[2] += (UINT)(bd * 7 / 16);
+
+    for (xct = 2; xct < xres; xct++)
+      {
+          if ((rct = ((int)cp[0] * rn / rr)) > rn)
+              rct = rn;
+          if ((gct = ((int)cp[1] * gn / gr)) > gn)
+              gct = gn;
+          if ((bct = ((int)cp[2] * bn / br)) > bn)
+              bct = bn;
+
+          *dop++ = (UCHAR) (ct = (rct * gres + gct) * bres + bct + coff);
+
+          rd = (int)cp[0] - rp[ct];
+          gd = (int)cp[1] - gp[ct];
+          bd = (int)cp[2] - bp[ct];
+
+          cp += 3;
+
+          cp[0] += (UINT)(rd * 7 / 16);
+          cp[1] += (UINT)(gd * 7 / 16);
+          cp[2] += (UINT)(bd * 7 / 16);
+      }
+
+    if ((rct = ((int)cp[0] * rn / rr)) > rn)
+        rct = rn;
+    if ((gct = ((int)cp[1] * gn / gr)) > gn)
+        gct = gn;
+    if ((bct = ((int)cp[2] * bn / br)) > bn)
+        bct = bn;
+
+    *dop++ = (UCHAR) ((rct * gres + gct) * bres + bct + coff);
+
+    HDfree(idat[0]);
+    return 0;
+}
diff --git a/hdf/util/hdf2gif.c b/hdf/util/hdf2gif.c
new file mode 100644
index 0000000..fb4670c
--- /dev/null
+++ b/hdf/util/hdf2gif.c
@@ -0,0 +1,365 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "gif.h"
+#include <stdio.h>
+
+#define HDFNAME "laser.hdf"
+#define VGROUPCLASS "RIG0.0"
+#define GIFNAME "temp.gif"
+
+extern int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap,
+    BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel);
+
+int EndianOrder;
+
+VOID
+PutByte(b , fpGif)
+BYTE b;
+FILE *fpGif;
+{
+	if (fputc(b , fpGif) == EOF) {
+		printf("File Writing Error, cannot continue");
+		exit(-1);
+	}
+}
+
+VOID
+WordToByte(w , b)
+WORD w;
+BYTE *b;
+{
+	if (EndianOrder == 0) /* Big Endian */
+	{
+		b[0] = w & 0xFF00;
+		b[1] = w & 0xFF;
+	}
+	else /* Little Endian */
+	{
+		b[0] = w & 0xFF;
+		b[1] = w & 0xFF00;
+	}
+}
+
+VOID
+putword(w, fp)
+int w;
+FILE *fp;
+{
+	/* writes a 16-bit integer in GIF order (LSB first) */
+	
+	fputc(w &0xff, fp);
+    
+	fputc((w>>8)&0xff,fp);
+}
+
+int main(int argc , char **argv) {
+	
+	intn  status;       /* status for functions returning an intn */
+	int32 file_id,      /* HDF file identifier */
+		gr_id,          /* GR interface identifier */
+		ri_id,
+		pal_id,
+		start[2],       /* start position to write for each dimension */			
+		stride[2],
+		dim_sizes[2],   /* dimension sizes of the image array */
+		interlace_mode, /* interlace mode of the image */
+		data_type,      /* data type of the image data */
+		i,
+		index;
+	
+	char  gr_name[256];
+	
+	FILE *fpGif;
+	
+	int32 ncomp;
+	int32 num_attrs;
+	int32 num_entries;
+	int32 n_images;
+	int32 n_fileattributes;
+	
+	BYTE *Image;
+	/* compression structs */
+	
+	char *HDFName;
+	char *GIFName;
+	/* reference variables */
+	
+	int has_local_palette; /* treated as a flag */
+	int loop_times; /* number of times to loop, i'm going to treat it as a yes or no */
+	
+	BYTE* b;
+	BYTE  x;
+	
+	BYTE  GlobalPalette[256][3];
+	BYTE  Red[256];
+	BYTE  Green[256];
+	BYTE  Blue[256];
+	
+	int   RWidth, RHeight;
+	int   LeftOfs, TopOfs;
+	int   ColorMapSize, InitCodeSize, Background, BitsPerPixel;
+	int   j,nc;
+	int	  w,h;
+	int   numcols = 256;
+	int   CountDown;
+	int   curx , cury;
+	int   time_out;
+	
+	BYTE pc2nc[256] , r1[256] , g1[256] , b1[256];
+	if (argc < 3) {
+		printf("Wrong number of arguments.\nUsage:\nhdf2gif <hdf file> <gif file>\n");
+		exit (-1);
+	}
+	
+	HDFName = argv[1];
+	GIFName = argv[2];
+	/* Set a default 10 ms time between two consequetive images in case of multiple image file */
+	if (argc > 3)
+		time_out = atoi(argv[3]);
+	else
+		time_out = 10; 
+	
+	/* Do Endian Order testing and set Endian Order */
+	x = 0x0001;
+	b = (BYTE *) &w;
+	EndianOrder = (b[0] ? 1:0);
+	
+	start[0] = start[1] = 0;
+	stride[0] = stride[1] = 1;
+	
+	/*Start HDF file*/
+	file_id = Hopen(HDFName, DFACC_READ, 0);
+	if(file_id == -1) {
+		printf("Unable to open HDF file");
+		status = HEvalue(1);
+		printf(HEstring(status));
+		exit(0);
+	}
+	
+	if (!(fpGif = fopen(GIFName , "wb"))) {
+		printf("Error opening gif file for output. Aborting.\n");
+		exit (-1);
+	}
+	
+	/* Open the hdf file using the GR interface and retrieve the images from it
+	** Note that for now the images have to be 8 bit. If they are 24 bit this 
+	** program cannot handle it. I shall try to include it, if not please
+	** refer to the file hdf2gif.c in the source code for the remormat utility.
+	** There you should find the code to convert 24 bit images to 8 bit (GIF)
+	*/
+	gr_id = GRstart(file_id);
+	
+	if ((status = GRfileinfo(gr_id , &n_images , &n_fileattributes)) == -1) {
+		status = HEvalue(1);
+		printf(HEstring(status));
+		exit(0);
+	}
+	
+	if (n_images < 1) {
+		printf("Error: No GRimages found in hdf file. Aborting.\n");
+		exit (-1);
+	}
+	
+	
+	Background = 0;
+	for (index = 0 ; index < n_images ; index++) {
+		
+		has_local_palette = true;
+		ri_id = GRselect(gr_id , index);
+		if ((pal_id = GRgetlutid(ri_id , 0)) == -1)
+			has_local_palette = false;
+		
+		if (has_local_palette) {
+			status = GRgetlutinfo(pal_id , &ncomp , &data_type , &interlace_mode , &num_entries);
+			status = GRreadlut(pal_id , (VOIDP)&GlobalPalette);
+		}
+		
+		status = GRgetiminfo(ri_id , gr_name , &ncomp , &data_type , &interlace_mode , dim_sizes , &num_attrs);
+		if (!(data_type == DFNT_CHAR || data_type == DFNT_UCHAR || data_type == DFNT_INT8 || data_type == DFNT_UINT8 || data_type == DFNT_NINT8 || data_type == DFNT_NUINT8)) {
+			printf("The GR data type of image %s in the hdf file appears not to be 8-bit. Trying next image...\n", gr_name);
+			continue;
+		}
+		
+		/* BUG FIX 601 - pkamat */
+		if (1 != ncomp) {  /* not an 8-bit image */ 
+		  if (3 == ncomp) { /* 24-bit image */
+		    printf("The GR data type of image %s in the hdf file appears to be a 24-bit image. ", gr_name);
+		    printf("Use hdf2jpeg to convert this image. Trying next image... \n");
+		    continue;
+                  }
+		  printf("The GR data type of image %s in the hdf file does not appear to be a 8-bit image. ", gr_name);
+		  printf("Trying next image... \n");	
+		  continue;
+		}	
+		/* End BUG FIX 601 */ 
+		
+		Image = (BYTE *)malloc(dim_sizes[0] * dim_sizes[1]);
+		status = GRreadimage(ri_id , start , stride , dim_sizes , Image);
+		w = dim_sizes[0];
+		h = dim_sizes[1];
+		
+		/* If the first image does not have a palette, I make my own global color table
+		** Obviously this is not the best thing to do, better steps would be:
+		** 1. Check for either a global palette or a global attribute called palette
+		** 2. Check for palettes in any of the other images.
+		*/
+		if (!has_local_palette) {
+			for (i = 0 ; i < 256 ; i++) {
+				Red[i] = 255 - i;
+				Green[i] = 255 - i;
+				Blue[i] = 255 - i;
+			}
+		}
+		else {
+			for (i = 0 ; i < 256 ; i++){
+				Red[i] = GlobalPalette[i][0];
+				Green[i] = GlobalPalette[i][1];
+				Blue[i] = GlobalPalette[i][2];
+			}
+		}
+		
+		for (i=0; i<256; i++) { pc2nc[i] = r1[i] = g1[i] = b1[i] = 0; }
+		/* compute number of unique colors */
+		nc = 0;
+		for (i=0; i<numcols; i++) {
+			/* see if color #i is already used */
+			for (j=0; j<i; j++) {
+				if (Red[i] == Red[j] && Green[i] == Green[j] && 
+					Blue[i] == Blue[j]) break;
+			}
+			if (j==i) {  /* wasn't found */
+				pc2nc[i] = nc;
+				r1[nc] = Red[i];
+				g1[nc] = Green[i];
+				b1[nc] = Blue[i];
+				nc++;
+			}
+			else pc2nc[i] = pc2nc[j];
+		}
+		/* figure out 'BitsPerPixel' */
+		for (i=1; i<8; i++) {
+			if ( (1<<i) >= nc) break;
+		}
+		BitsPerPixel = i;
+		ColorMapSize = 1 << BitsPerPixel;
+		
+		RWidth  = dim_sizes[0];
+		RHeight = dim_sizes[1];
+		LeftOfs = TopOfs = 0;
+		
+		CountDown = w * h;    /* # of pixels we'll be doing */
+		
+		if (BitsPerPixel <= 1) InitCodeSize = 2;
+		else InitCodeSize = BitsPerPixel;
+		
+		curx = cury = 0;
+		
+		if (!fpGif) {
+			fprintf(stderr,  "WriteGIF: file not open for writing\n" );
+			return (1);
+		}
+		
+		/* If it is the first image we do all the header stuff that isn't required for the
+		** rest of the images. 
+        */
+		if (index == 0) {
+			/* Write out the GIF header and logical screen descriptor */
+			if (n_images > 0) {
+				fwrite("GIF89a", 1, 6, fpGif);    /* the GIF magic number */
+				loop_times = 0;
+			}
+			else {
+				fwrite("GIF87a", 1, 6, fpGif);    /* the GIF magic number */
+				loop_times = 1;
+			}
+			
+			putword(RWidth, fpGif);           /* screen descriptor */
+			putword(RHeight, fpGif);
+			
+			i = 0x00;	                 /* No, there is no color map */
+			i |= (8-1)<<4;                 /* OR in the color resolution (hardwired 8) */
+			i |= (BitsPerPixel - 1);       /* OR in the # of bits per pixel */
+			fputc(i,fpGif);          
+			
+			fputc(Background,fpGif);         /* background color */
+			
+			fputc(0, fpGif);                  /* future expansion byte */
+			
+			
+			/* If loop_times is 0 , put in the application extension to make the gif anime loop
+			** indefinitely
+			*/
+			if (!loop_times) {
+				fputc(0x21 , fpGif);
+				fputc(0xFF , fpGif);
+				fputc(11 , fpGif);
+				fwrite("NETSCAPE2.0" , 1 , 11 , fpGif);
+				fputc(3 , fpGif);
+				fputc(1 , fpGif);
+				fputc(0 , fpGif);
+				fputc(0 , fpGif);
+				fputc(0 , fpGif);
+				
+			}
+			
+			
+		}
+		
+		if (n_images > 1) {
+			/* write a graphic control block */
+			fputc(0x21 , fpGif);
+			fputc(0xF9 , fpGif);
+			fputc(4 , fpGif);
+			fputc(4 , fpGif);
+			putword(time_out , fpGif);
+			fputc(255, fpGif);
+			fputc(0 , fpGif);
+		}
+		
+		/* Put Image Descriptor
+		** Hardwiring Left Offset and Top Offset to 0x00
+		*/
+		
+		fputc   (0x2c , fpGif);
+		putword (0x00 , fpGif);
+		putword (0x00  , fpGif);
+		putword (RWidth   , fpGif);
+		putword (RHeight  , fpGif);
+		if (has_local_palette) {
+			fputc   ((0x80 | (BitsPerPixel - 1)) , fpGif);
+			for (i=0; i<ColorMapSize; i++) {       /* write out Global colormap */
+				fputc(r1[i], fpGif);
+				fputc(g1[i], fpGif);
+				fputc(b1[i], fpGif);
+			}
+		}
+		else 
+			fputc (0x00 , fpGif);
+		
+		fputc (InitCodeSize , fpGif);
+		
+		i = hdfWriteGIF(fpGif , Image , 0 , dim_sizes[0] , dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel);
+		fputc(0x00 , fpGif);		
+		free (Image);
+		status = GRendaccess (ri_id);
+	} 
+	
+	fputc(';',fpGif);                    /* Write GIF file terminator */
+	status = GRend (gr_id);
+	
+	/* Close the HDF file */
+	status = Hclose (file_id);
+	fclose (fpGif);
+	return(0);
+}
diff --git a/hdf/util/hdf2jpeg.c b/hdf/util/hdf2jpeg.c
new file mode 100644
index 0000000..683be7a
--- /dev/null
+++ b/hdf/util/hdf2jpeg.c
@@ -0,0 +1,377 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdf2jpeg.c 6013 2014-01-10 21:19:02Z acheng $ */
+#include "hdf.h"
+#include "hfile.h"
+
+/* Size of the file buffer to copy through */
+#define MAX_FILE_BUF    16384
+
+PRIVATE uint8 file_buf[MAX_FILE_BUF];   /* size of the buffer to copy through */
+
+static VOID usage(void);
+
+static VOID
+usage(void)
+{
+    printf("USAGE: hdf2jpeg <input HDF file> <output JPEG file template>\n");
+    printf("        <input HDF file> : the HDF file to extract JPEG images from\n");
+    printf("        <output JPEG file template> : template for the name \n");
+    printf("                                      of the JPEG file(s) to contain\n");
+    printf("                                      the images extracted from the HDF\n");
+    printf("                                      file.  The name may contain\n");
+    printf("                                      the special character: '#'\n");
+    printf("                                      The '#' character will be replaced\n");
+    printf("                                      by the reference number of the HDF\n");
+    printf("                                      image being extracted.\n");
+    printf("                                      The default format is: file.#.jpg\n");
+    exit(1);
+}   /* end usage() */
+
+int
+main(int argc, char *argv[])
+{
+    int32       fid, aid, data_aid;
+    int         n, status;
+    FILE       *jfif_file;      /* file ptr for the JFIF file to create */
+    dd_t        image_desc;
+    intn        jfif_formatted = 0;     /* whether the jfif filename has a'#' in it */
+    char        jfif_name[128]; /* name of the JPEG file to create */
+    char        scratch[128];   /* name of the JPEG file to create */
+    char       *jfif_char;      /* location of the '#' char */
+
+    /*
+     * If a file name has not been supplied print the usage message
+     */
+    if (argc < 3)
+        usage();
+
+    if ((jfif_char = (char *) HDstrchr(argv[2], '#')) == NULL)
+        HDstrcpy(jfif_name, argv[2]);   /* copy the JPEG file name */
+    else
+      {
+          if (jfif_char > argv[2])
+            {   /* copy initial portion */
+                HDstrncpy(jfif_name, argv[2], (size_t) (jfif_char - argv[2]));
+                jfif_name[jfif_char - argv[2]] = '\0';  /* terminate the string */
+            }   /* end if */
+          HDstrcat(jfif_name, "%d");    /* append formatter */
+          HDstrcat(jfif_name, jfif_char + 1);   /* complete the name */
+          jfif_formatted = TRUE;
+      }     /* end else */
+
+    fid = Hopen(argv[1], DFACC_READ, -1);
+    if (fid == FAIL)
+      {
+          printf("Error opening HDF file: %s\n", argv[1]);
+          exit(1);
+      }     /* end if */
+
+    n = 0;
+    aid = Hstartread(fid, DFTAG_JPEG, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+          do
+            {
+                n++;    /* increment the number of images found */
+                Hinquire(aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                if (Hread(aid, image_desc.length, file_buf) != image_desc.length)
+                  {
+                      printf("Error reading %d'th JPEG image from HDF file\n", n);
+                      exit(1);
+                  }     /* end if */
+                if (jfif_formatted == TRUE)
+                  {
+                      sprintf(scratch, jfif_name, image_desc.ref);
+                      jfif_file = fopen(scratch, "wb");
+                  }     /* end if */
+                else
+                  {
+                      jfif_file = fopen(jfif_name, "wb");
+                  }     /* end else */
+                if (jfif_file == NULL)
+                  {
+                      printf("error opening JFIF output file\n");
+                      exit(1);
+                  }     /* end if */
+                if (fwrite(file_buf, sizeof(uint8), (size_t) image_desc.length,
+                           jfif_file) != (size_t) image_desc.length)
+                  {
+                      printf("Error writing to JPEG file\n");
+                      exit(1);
+                  }     /* end if */
+                data_aid = Hstartread(fid, DFTAG_CI, image_desc.ref);
+                Hinquire(data_aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                while (image_desc.length > MAX_FILE_BUF)
+                  {
+                      if (Hread(data_aid, MAX_FILE_BUF, file_buf) != (int32) (MAX_FILE_BUF))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), MAX_FILE_BUF, jfif_file)
+                          != MAX_FILE_BUF)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                      image_desc.length -= MAX_FILE_BUF;
+                  }     /* end while */
+                if (image_desc.length > 0)
+                  {
+                      if (Hread(data_aid, image_desc.length, file_buf)
+                          != (int32) (image_desc.length))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), (size_t) image_desc.length, jfif_file)
+                          !=          (size_t) image_desc.length)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                  }     /* end if */
+                Hendaccess(data_aid);   /* let go of the JPEG data AID */
+                fclose(jfif_file);  /* close the JFIF file */
+                status = Hnextread(aid, DFTAG_JPEG, DFREF_WILDCARD, DF_CURRENT);
+
+            }
+          while (status == SUCCEED);
+          Hendaccess(aid);
+      }     /* end if */
+
+    aid = Hstartread(fid, DFTAG_GREYJPEG, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+          do
+            {
+                n++;    /* increment the number of images found */
+                Hinquire(aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                if (Hread(aid, image_desc.length, file_buf) != image_desc.length)
+                  {
+                      printf("Error reading %d'th JPEG image from HDF file\n", n);
+                      exit(1);
+                  }     /* end if */
+                if (jfif_formatted == TRUE)
+                  {
+                      sprintf(scratch, jfif_name, image_desc.ref);
+                      jfif_file = fopen(scratch, "wb");
+                  }     /* end if */
+                else
+                  {
+                      jfif_file = fopen(jfif_name, "wb");
+                  }     /* end else */
+                if (jfif_file == NULL)
+                  {
+                      printf("error opening JFIF output file\n");
+                      exit(1);
+                  }     /* end if */
+                if (fwrite(file_buf, sizeof(uint8), (size_t) image_desc.length,
+                           jfif_file) != (size_t) image_desc.length)
+                  {
+                      printf("Error writing to JPEG file\n");
+                      exit(1);
+                  }     /* end if */
+                data_aid = Hstartread(fid, DFTAG_CI, image_desc.ref);
+                Hinquire(data_aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                while (image_desc.length > MAX_FILE_BUF)
+                  {
+                      if (Hread(data_aid, MAX_FILE_BUF, file_buf) != (int32) (MAX_FILE_BUF))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), MAX_FILE_BUF, jfif_file)
+                          !=          (size_t) MAX_FILE_BUF)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                      image_desc.length -= MAX_FILE_BUF;
+                  }     /* end while */
+                if (image_desc.length > 0)
+                  {
+                      if (Hread(data_aid, image_desc.length, file_buf)
+                          != (int32) (image_desc.length))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), (size_t) image_desc.length, jfif_file)
+                          !=          (size_t) image_desc.length)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                  }     /* end if */
+                Hendaccess(data_aid);   /* let go of the JPEG data AID */
+                fclose(jfif_file);  /* close the JFIF file */
+                status = Hnextread(aid, DFTAG_GREYJPEG, DFREF_WILDCARD, DF_CURRENT);
+
+            }
+          while (status == SUCCEED);
+          Hendaccess(aid);
+      }     /* end if */
+
+    /* Handle new-style JPEG5 images */
+    aid = Hstartread(fid, DFTAG_JPEG5, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+          do
+            {
+                Hinquire(aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                n++;    /* increment the number of images found */
+                if (jfif_formatted == TRUE)
+                  {
+                      sprintf(scratch, jfif_name, image_desc.ref);
+                      jfif_file = fopen(scratch, "wb");
+                  }     /* end if */
+                else
+                  {
+                      jfif_file = fopen(jfif_name, "wb");
+                  }     /* end else */
+                if (jfif_file == NULL)
+                  {
+                      printf("error opening JFIF output file\n");
+                      exit(1);
+                  }     /* end if */
+                data_aid = Hstartread(fid, DFTAG_CI, image_desc.ref);
+                Hinquire(data_aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                while (image_desc.length > MAX_FILE_BUF)
+                  {
+                      if (Hread(data_aid, MAX_FILE_BUF, file_buf) != (int32) (MAX_FILE_BUF))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), MAX_FILE_BUF, jfif_file)
+                          != MAX_FILE_BUF)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                      image_desc.length -= MAX_FILE_BUF;
+                  }     /* end while */
+                if (image_desc.length > 0)
+                  {
+                      if (Hread(data_aid, image_desc.length, file_buf)
+                          != (int32) (image_desc.length))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), (size_t) image_desc.length, jfif_file)
+                          !=          (size_t) image_desc.length)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                  }     /* end if */
+                Hendaccess(data_aid);   /* let go of the JPEG data AID */
+                fclose(jfif_file);  /* close the JFIF file */
+                status = Hnextread(aid, DFTAG_JPEG5, DFREF_WILDCARD, DF_CURRENT);
+
+            }
+          while (status == SUCCEED);
+          Hendaccess(aid);
+      }     /* end if */
+
+    /* Handle new-style GREYJPEG5 images */
+    aid = Hstartread(fid, DFTAG_GREYJPEG5, DFREF_WILDCARD);
+    if (aid != FAIL)
+      {
+          do
+            {
+                n++;    /* increment the number of images found */
+                Hinquire(aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                if (jfif_formatted == TRUE)
+                  {
+                      sprintf(scratch, jfif_name, image_desc.ref);
+                      jfif_file = fopen(scratch, "wb");
+                  }     /* end if */
+                else
+                  {
+                      jfif_file = fopen(jfif_name, "wb");
+                  }     /* end else */
+                if (jfif_file == NULL)
+                  {
+                      printf("error opening JFIF output file\n");
+                      exit(1);
+                  }     /* end if */
+                data_aid = Hstartread(fid, DFTAG_CI, image_desc.ref);
+                Hinquire(data_aid, NULL, &image_desc.tag, &image_desc.ref,
+                         &image_desc.length, &image_desc.offset,
+                         NULL, NULL, NULL);
+                while (image_desc.length > MAX_FILE_BUF)
+                  {
+                      if (Hread(data_aid, MAX_FILE_BUF, file_buf) != (int32) (MAX_FILE_BUF))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), MAX_FILE_BUF, jfif_file)
+                          !=          (size_t) MAX_FILE_BUF)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                      image_desc.length -= MAX_FILE_BUF;
+                  }     /* end while */
+                if (image_desc.length > 0)
+                  {
+                      if (Hread(data_aid, image_desc.length, file_buf)
+                          != (int32) (image_desc.length))
+                        {
+                            printf("Error reading JPEG image data from HDF file\n");
+                            exit(1);
+                        }   /* end if */
+                      if (fwrite(file_buf, sizeof(uint8), (size_t) image_desc.length, jfif_file)
+                          !=          (size_t) image_desc.length)
+                        {
+                            printf("Error writing JPEG image data\n");
+                            exit(1);
+                        }   /* end if */
+                  }     /* end if */
+                Hendaccess(data_aid);   /* let go of the JPEG data AID */
+                fclose(jfif_file);  /* close the JFIF file */
+                status = Hnextread(aid, DFTAG_GREYJPEG5, DFREF_WILDCARD, DF_CURRENT);
+
+            }
+          while (status == SUCCEED);
+          Hendaccess(aid);
+      }     /* end if */
+
+    if (n == 0)
+        printf("Error, no JPEG images found in HDF file\n");
+    return (0);
+}
diff --git a/hdf/util/hdf8to24.c b/hdf/util/hdf8to24.c
new file mode 100644
index 0000000..fe156cc
--- /dev/null
+++ b/hdf/util/hdf8to24.c
@@ -0,0 +1,354 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdf8to24.c 6013 2014-01-10 21:19:02Z acheng $ */
+#include "hdf.h"
+#ifndef I860
+#include <stdlib.h>
+#include <string.h>
+#endif /* I860 */
+
+/* Exception checking macro */
+#define EXCHECK(a,b)    if(a) goto b
+
+/* Static variables */
+uint8       red_comp[256], green_comp[256], blue_comp[256];
+
+comp_info   cinfo;              /* compression structure */
+
+static intn
+magnify(uint8 *from_buffer, uint8 *to_buffer, int32 from_x0,
+        int32 from_y0, int32 from_x1, int32 from_y1, int32 from_width,
+        int32 from_height, int32 to_width, int32 to_height);
+
+static intn
+convert8to24(uint8 *img8_buf, uint8 *img24_buf, int32 img_xdim,
+             int32 img_ydim);
+
+static VOID usage(void);
+
+/**********************************************************************
+*  Function :   magnify
+*  Purpose  :   Magnify an image by independant X and Y magnification
+*                   factors.  Note that the coordinates which specify
+*                   the area in the "from" image are _inclusive_, i.e.
+*                   if you would like to magnify the entire image, the
+*                   "from" coordinates should be specified as:
+*                   (0,0) and ((width-1),(height-1)), where "width"
+*                   and "height" are the width and height of the image
+*                   (respectively) in pixels.
+*  Parameters   :
+*           from_buffer - pointer to the buffer which contains the image
+*                           to magnify
+*           to_buffer - pointer to the buffer in which to place the
+*                           magnified image
+*           from_x0, from_y0 - Upper Left Corner (ULC) of the rectangular
+*                           area in the image to magnify
+*           from_x1, from_y1 - Lower Right Corner (LRC) of the rectangular
+*                           area in the image to magnify
+*           from_width, from_height - the width and height of the image
+*                           to magnify (or "from" image)
+*           to_width, to_height - the width and height of the magnified
+*                           image (or "to" image)
+*  Returns  :   (TRUE) for success, (FALSE) for error
+*  Calls    :
+*  Called by    :
+**********************************************************************/
+static intn
+magnify(uint8 *from_buffer, uint8 *to_buffer, int32 from_x0,
+        int32 from_y0, int32 from_x1, int32 from_y1, int32 from_width,
+        int32 from_height, int32 to_width, int32 to_height)
+{
+    uint8      *buf_off,        /* the current offset into the magnified data */
+               *last_buf,       /* pointer to the last useful magnified line */
+               *y_off,          /* the y offset into the data block */
+               *last_y_coor,    /* pointer to the last line copied */
+              **y_coor;         /* pointers to image data */
+    float64     temp_val,       /* temporary value for holding double results */
+                wind_width,     /* the width of the window to magnify */
+                wind_height;    /* the height of the window to magnify */
+    int32       u, v;           /* local unsigned counting variables */
+    int32      *x_coor,         /* the X coor. lookup table */
+               *x_coor_temp;    /* temporary pointer to the x lookup table */
+
+    if (from_width == 0 || from_height == 0)    /* check for bad image dimensions */
+        return (FALSE);
+    if (to_width == 0 || to_height == 0)    /* check for bad image dimensions */
+        return (FALSE);
+    if (from_x0 > from_x1 || from_y0 > from_y1)     /* check for an invalid window */
+        return (FALSE);
+
+/* find width and height of the window to magnify */
+    wind_width = (float64)((from_x1 - from_x0) + 1);
+    wind_height = (float64)((from_y1 - from_y0) + 1);
+
+/* allocate room for the x coordinate lookup table */
+    x_coor = (int32 *) HDmalloc((int32) ((size_t)to_width * sizeof(int32)));
+    EXCHECK(x_coor == NULL, XCoorFailed);   /* check if malloc() failed */
+    temp_val = wind_width / (float64) to_width;
+    for (u = 0; u < to_width; u++)  /* calculate the x coordinate lookup table */
+        x_coor[u] = ((uint16) ((float64) u * temp_val) + from_x0);
+
+/* allocate room for the array of pointers */
+    y_coor = (uint8 **) HDmalloc((int32) ((size_t)to_height * sizeof(uint8 *)));
+    EXCHECK(y_coor == NULL, YCoorFailed);   /* check if malloc() failed */
+    temp_val = wind_height / (float64) to_height;
+    for (u = 0; u < to_height; u++)     /* calculate the y coordinates */
+        y_coor[u] = from_buffer + ((uint32) ((float64) u * temp_val) + (uint32)from_y0) * (uint32)from_width;
+
+    last_buf = to_buffer;   /* set the previous line pointer */
+    buf_off = to_buffer;    /* set the pointer to the "to" image */
+    last_y_coor = NULL;     /* force to calculate the first line */
+
+    for (u = 0; u < to_height; u++)
+      {     /* go through each magnified line */
+/* if this line is not the same as the previous one, then make it again */
+          if (y_coor[u] != last_y_coor)
+            {
+                last_y_coor = y_off = y_coor[u];
+                x_coor_temp = x_coor;   /* assign the temporary pointer */
+                last_buf = buf_off;     /* set the pointer to the previous line */
+                for (v = 0; v < to_width; v++)  /* go through each line magnifying it */
+                    *buf_off++ = y_off[*x_coor_temp++];
+            }   /* end if */
+/* this line is the same as the previous one, just copy it */
+          else
+            {
+                HDmemcpy(buf_off, last_buf, to_width);  /* copy the previous line */
+                buf_off += to_width;    /* advance the buffer offset pointer */
+            }   /* end else */
+      }     /* end for */
+    HDfree((char *) y_coor);
+    HDfree((char *) x_coor);
+    return (TRUE);
+
+  YCoorFailed:      /* Failed to allocate memory for the Y coor. lookup table */
+    HDfree((VOIDP) x_coor);
+  XCoorFailed:      /* Failed to allocate memory for the X coor. lookup table */
+    return (FALSE);
+}   /* end magnify() */
+
+/**********************************************************************
+*  Function :   convert8to24
+*  Purpose  :   Convert an 8-bit image to a 24-bit image, using the
+*                   palette components already set up.
+*  Parameters   :
+*           img_8_buf - pointer to the buffer which contains the 8-bit image
+*           img24_buf - pointer to the buffer in which to place the
+*                           24-bit image
+*           img_xdim, img_ydim - the width and height of the images
+*  Returns  :   (TRUE) for success, (FALSE) for error
+*  Calls    :
+*  Called by    :
+**********************************************************************/
+static intn
+convert8to24(uint8 *img8_buf, uint8 *img24_buf, int32 img_xdim,
+             int32 img_ydim)
+{
+    uint32      pixels;         /* local counting variable */
+
+    if (img_xdim <= 0 || img_ydim <= 0)     /* check for bad image dimensions */
+        return (FALSE);
+    if (img8_buf == NULL || img24_buf == NULL)  /* check for invalid images */
+        return (FALSE);
+
+    pixels = (uint32)(img_xdim * img_ydim);   /* get the number of pixels to process */
+    while (pixels > 0)
+      {     /* do all the pixels */
+          *img24_buf++ = red_comp[*img8_buf];
+          *img24_buf++ = green_comp[*img8_buf];
+          *img24_buf++ = blue_comp[*img8_buf];
+          img8_buf++;
+          pixels--;
+      }     /* end while */
+    return (TRUE);
+}   /* end convert8to24() */
+
+static VOID
+usage(void)
+{
+    printf("USAGE: make24 [-s<scale>] [-j] <input HDF file> <output HDF file>\n");
+    printf("    -s<scale> : set scale for magnifying the 8-bit input file.\n");
+    printf("                scales between 0 and 1 shrink the image, scales\n");
+    printf("                greater than 1 expand the image.  Defaults to 1\n");
+    printf("    -j[quality] : use JPEG compression to store the 24-bit image\n");
+    printf("                Defaults to no compression, or quality level\n");
+    printf("                75, if no quality is specified\n");
+    printf("    <input HDF file>  : HDF file which contains an 8-bit image\n");
+    printf("    <output HDF file> : HDF file to store the 24-bit image\n");
+    exit(1);
+}   /* end usage() */
+
+int
+main(int argc, char *argv[])
+{
+    intn        do_jpeg = FALSE;    /* flag to indicate JPEG compression */
+    intn        jpeg_qual = 75; /* JPEG quality factor */
+    intn        do_scale = FALSE;   /* flag to indicate whether to scale images */
+    float32     img_scale = (float32) 1.0;  /* scaling factor */
+    int32       xdim, ydim;     /* dimensions of the image to convert */
+    intn        ispal;          /* whether there's a palette with the image */
+    uint8      *img_buf;        /* buffer to store the image in */
+    uint8      *img24_buf;      /* buffer to store the 24-bit image in */
+    uint8      *pal_buf = NULL; /* buffer to store the palette in */
+    intn        file = 1;       /* the arguement the files start at */
+    intn        i;              /* local counting variable */
+
+    if (argc < 3)
+        usage();
+
+    if (argv[1][0] == '-' || argv[1][0] == '/')
+      {     /* check command line */
+          if ((argv[1][1] != 's' && argv[1][1] != 'j') || argc < 4)
+              usage();
+
+          while (argv[file][0] == '-' || argv[file][0] == '/')
+            {
+                switch (argv[file][1])
+                  {
+                      case 's':
+                          if ((img_scale = (float32) atof(&argv[file][2])) <= (float32)0.0)
+                            {   /* check for valid scale */
+                                printf("Bad scale, must be greater than 0\n");
+                                return (1);
+                            }   /* end if */
+                          do_scale = TRUE;
+                          break;
+
+                      case 'j':
+                          if ((jpeg_qual = atoi(&argv[file][2])) <= 0 || jpeg_qual > 100)
+                            {
+                                printf("Bad JPEG quality setting, should be between\n");
+                                printf("1 and 100, using default value of 75\n");
+                                jpeg_qual = 75;
+                            }   /* end if */
+                          do_jpeg = TRUE;
+                          break;
+
+                      default:
+                          usage();
+
+                  }     /* end switch */
+                file++;
+            }   /* end while */
+      }     /* end if */
+
+    /* get the image dimensions */
+    if (DFR8getdims(argv[file], &xdim, &ydim, &ispal) == FAIL)
+      {
+          printf("Error, bad dimensions in file: %s\n", argv[file]);
+          HEprint(stdout, 0);
+          return (1);
+      }     /* end if */
+
+    if ((img_buf = (uint8 *) HDmalloc((size_t)(xdim * ydim))) == NULL)
+      {
+          printf("Error, cannot allocate space for %dx%d image\n", (int)xdim, (int)ydim);
+          return (1);
+      }     /* end if */
+
+    if (ispal)
+      {
+          if ((pal_buf = (uint8 *) HDmalloc(768)) == NULL)
+            {
+                printf("Error, cannot allocate space for image palette\n");
+                return (1);
+            }   /* end if */
+      }     /* end if */
+    else
+        printf("No palette associated with image, using default grey scale converion\n");
+
+    if (DFR8getimage(argv[file], img_buf, xdim, ydim, (ispal ? pal_buf : NULL)) == FAIL)
+      {
+          printf("Error reading image\n");
+          HEprint(stdout, 0);
+          return (1);
+      }     /* end if */
+
+    if (do_scale)
+      {     /* check whether we should scale the image */
+          uint8      *scaled_image;     /* storage for the scaled image */
+          int32       new_xdim, new_ydim;   /* the new image's x and y dim. */
+
+          new_xdim = (int32) (img_scale * (float32)xdim);    /* calc. new image's dimensions */
+          new_ydim = (int32) (img_scale * (float32)ydim);
+          if ((scaled_image = (uint8 *) HDmalloc((size_t)(new_xdim * new_ydim))) == NULL)
+            {
+                printf("Error, cannot allocate space for %dx%d scaled image\n", (int)new_xdim, (int)new_ydim);
+                return (1);
+            }   /* end if */
+          if (!magnify(img_buf, scaled_image, 0, 0, xdim - 1, ydim - 1, xdim, ydim, new_xdim, new_ydim))
+            {
+                printf("Error scaling image, out of memory or bad dimensions\n");
+                return (1);
+            }   /* end if */
+          HDfree((VOIDP) img_buf);     /* free the old image */
+
+          img_buf = scaled_image;   /* use the new image for further processing */
+          xdim = new_xdim;
+          ydim = new_ydim;
+      }     /* end if */
+
+    /* Generate the RGB components for the 8 -> 24 bit converter */
+    if (ispal)
+      {
+          uint8      *pal_ptr = pal_buf;    /* temporary pointer into the palette */
+
+          for (i = 0; i < 256; i++)
+            {
+                red_comp[i] = *pal_ptr++;
+                green_comp[i] = *pal_ptr++;
+                blue_comp[i] = *pal_ptr++;
+            }   /* end for */
+      }     /* end if */
+    else
+      {     /* no palette, use a greyscale palette */
+          for (i = 0; i < 256; i++)
+              red_comp[i] = green_comp[i] = blue_comp[i] = (uint8) i;
+      }     /* end else */
+
+    /* allocate space for the 24-bit image */
+    if ((img24_buf = (uint8 *) HDmalloc((size_t)(xdim * ydim * 3))) == NULL)
+      {
+          printf("Error, cannot allocate space for %dx%d 24-bit image\n", (int)xdim, (int)ydim);
+          return (1);
+      }     /* end if */
+
+    /* convert the image */
+    if (!convert8to24(img_buf, img24_buf, xdim, ydim))
+      {
+          printf("Error converting 8-bit image to 24-bit image\n");
+          return (1);
+      }     /* end if */
+
+    if (do_jpeg)
+      {     /* set up JPEG compression if necessary */
+          cinfo.jpeg.quality = jpeg_qual;   /* set JPEG comp. parameters */
+          cinfo.jpeg.force_baseline = TRUE;
+          DF24setcompress(COMP_JPEG, &cinfo);   /* set compression parameters */
+      }     /* end if */
+
+    /* store 24-bit image */
+    if (DF24putimage(argv[file + 1], (VOIDP) img24_buf, xdim, ydim) == FAIL)
+      {
+          printf("Error storing 24-bit image\n");
+          HEprint(stdout, 0);
+          return (1);
+      }     /* end if */
+
+    return (0);
+}   /* end make24 */
diff --git a/hdf/util/hdfcomp.c b/hdf/util/hdfcomp.c
new file mode 100644
index 0000000..ea69982
--- /dev/null
+++ b/hdf/util/hdfcomp.c
@@ -0,0 +1,245 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 6013 $";
+#endif
+
+/* $Id: hdfcomp.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*
+*  hdfcomp.c
+*  Re-compress Raster-8 HDF file
+*/
+#include "hdf.h"
+
+uint8 *space;
+uint8 palette[768];
+int32 xdim, ydim;
+int ispal;
+
+int main(int argc, char *argv[]) 
+{
+    int i;
+    char *outfile;
+    intn jpeg_qual=75;      /* JPEG quality factor */
+    uint16 prevref, writeref, compress = (uint16) 0;
+    comp_info cinfo;        /* compression structure */
+    int32 out_fid;          /* file ID for the output file */
+    intn copy_flabel,       /* flag to indicate to copy file labels */
+        copy_fdesc,         /* flag to indicate to copy file descriptions */
+        copy_ilabel,        /* flag to indicate to copy image labels */
+        copy_idesc;         /* flag to indicate to copy image descriptions */
+    char *annbuf=NULL;      /* buffer to store annotations in */
+    int32 annbuflen=0;      /* length of the annotation buffer */
+
+    if (argc < 3) { 
+        printf("%s,  version: 1.3   date: October 15, 1994\n", argv[0]);
+        printf("  This utility will read in raster-8 images from an\n");
+        printf("  HDF file and create a new HDF containing the\n");
+        printf("  images in a compressed format.  Images will be\n");
+        printf("  appended to outfile, if it exists.\n\n");
+        printf("Usage:\n");
+        printf(" hdfcomp outfile {[-c],[-r],[-i],[-j<quality>]} imagefile ...\n");
+        printf("                 {[-c],[-r],[-i],[-j<quality>]} imagefile\n");
+        printf("         -r: Store without compression (default)\n");
+        printf("         -c: Store using RLE compression\n");
+        printf("         -i: Store using IMCOMP compression (requires a");
+        printf(" palette in the HDF file)\n");
+        printf("         -j<quality>: Store using JPEG compression\n");
+        printf("            with a quality factor from 1-100, 75 default\n");
+        exit(1);
+    }
+
+    outfile = argv[1];
+
+    /* open the output file so that we can write Annotations into it easily */
+    if((out_fid=Hopen(outfile,DFACC_ALL,0))==FAIL) {
+        printf("Error opening output file: %s\n",outfile);
+        exit(1);
+      } /* end if */
+
+    for (i = 2; i < argc; i++) {
+        /* turn all the flags on (default settings) */
+        copy_flabel=copy_fdesc=copy_ilabel=copy_idesc=TRUE;
+
+        if (*argv[i] == '-') {
+            switch (argv[i][1]) {
+                case 'r':               /* raster */
+                    compress = (uint16) 0;
+                    break;
+                case 'c':               /* RLE */
+                    compress = COMP_RLE;
+                    break;
+                case 'i':               /* IMCOMP */
+                    compress = COMP_IMCOMP;
+                    break;
+                case 'j':               /* JPEG */
+                    compress = COMP_JPEG;
+                    if((jpeg_qual=atoi(&argv[i][2]))<=0 || jpeg_qual>100) {
+                        printf("Bad JPEG quality setting, should be between\n");
+                        printf("1 and 100, using default value of 75\n");
+                        jpeg_qual=75;
+                      } /* end if */
+                    cinfo.jpeg.quality=jpeg_qual;   /* set JPEG parameters */
+                    cinfo.jpeg.force_baseline=TRUE;
+                    break;
+                default:
+                    printf("Illegal option: %s, skipping....\n", argv[i]);   
+                    break;
+            }
+        }
+        else { /* file name */
+            /* copy the file annotations and labels over */
+            if(copy_flabel==TRUE || copy_fdesc==TRUE) {
+                intn isfirst;   /* flip-flop for first image */
+                int32 annlen;   /* length of the annotation to copy */
+                int32 old_fid;  /* file ID for the old and new files */
+
+                if((old_fid=Hopen(argv[i],DFACC_READ,0))==FAIL) {
+                    printf("Error opening input file: %s, skipping to next file\n",argv[i]);
+                    continue;
+                  } /* end if */
+                if(copy_flabel==TRUE) {
+                    isfirst=1;
+                    while((annlen=DFANgetfidlen(old_fid,isfirst))!=FAIL) {
+                        if(annbuflen==0 || annlen>annbuflen) {
+                            if(annbuflen!=0)
+                                HDfree(annbuf);
+                            if((annbuf=(char *)HDmalloc(annlen))==NULL) {
+                                printf("Error allocating buffer for annotation, aborting!\n");
+                                exit(1);
+                              } /* end if */
+                            annbuflen=annlen;
+                          } /* end if */
+                        if(DFANgetfid(old_fid,annbuf,annbuflen,isfirst)==FAIL) 
+                            printf("Error reading file annotation from file:%s, continuing\n",argv[i]);
+                        else {
+                            if(DFANaddfid(out_fid,annbuf)==FAIL)
+                                printf("Error wriring annotation to file:%s, continuing\n",outfile);
+                          } /* end else */
+                        isfirst=0; /* get the next label from the file */
+                      } /* end while */
+                  } /* end if */
+                if(copy_fdesc==TRUE) {
+                    isfirst=1; 
+                    while((annlen=DFANgetfdslen(old_fid,isfirst))!=FAIL) {
+                        if(annbuflen==0 || annlen>annbuflen) {
+                            if(annbuflen!=0)
+                                HDfree(annbuf);
+                            if((annbuf=(char *)HDmalloc(annlen))==NULL) {
+                                printf("Error allocating buffer for annotation, aborting!\n");
+                                exit(1);
+                              } /* end if */
+                            annbuflen=annlen;
+                          } /* end if */
+                        if(DFANgetfds(old_fid,annbuf,annbuflen,isfirst)==FAIL) 
+                            printf("Error reading file annotation from file:%s, continuing\n",argv[i]);
+                        else {
+                            if(DFANaddfds(out_fid,annbuf,annlen)==FAIL)
+                                printf("Error wriring annotation to file:%s, continuing\n",outfile);
+                          } /* end else */
+                        isfirst=0; /* get the next label from the file */
+                      } /* end while */
+                  } /* end if */
+              } /* end if */
+
+
+            /* copy the images over */
+            while (DFR8getdims(argv[i], &xdim, &ydim, &ispal) >= 0) {
+                prevref = DFR8lastref();
+                if ((space = (uint8 *) HDmalloc((size_t)(xdim * ydim))) == NULL) {
+                    printf("Not enough memory to convert image");
+                    exit(1);
+                }
+
+                if (DFR8getimage(argv[i], space, xdim, ydim, palette) < 0) {
+                    printf("Error reading image from file %s\n", argv[i]);
+                    exit(1);
+                }
+                if (ispal)
+                    DFR8setpalette((uint8 *) palette);
+                else if (compress == DFTAG_IMC) {
+                    printf("Couldn't find palette for IMCOMP compression\n");
+                    exit(1);
+                }
+
+                writeref=Hnewref(out_fid);
+                DFR8writeref(outfile, writeref);
+
+                if(compress)
+                    DFR8setcompress((int32)compress,&cinfo);
+                if (DFR8addimage(outfile, (VOIDP) space,
+                        xdim, ydim, compress)<0) {
+                    printf("Error writing image to file %s\n", outfile);
+                    exit(1);
+                }
+
+                /* sequence through the annotations for this image */
+                if(copy_ilabel==TRUE || copy_idesc==TRUE) {
+                    uint16 image_tag=DFTAG_RIG; /* tag to look for image annotations with */
+                    int32 annlen;   /* length of the annotation to copy */
+
+                    if(copy_ilabel==TRUE) {
+                        if((annlen=DFANgetlablen(argv[i],image_tag,prevref))!=FAIL) {
+                            if(annbuflen==0 || annlen>annbuflen) {
+                                if(annbuflen!=0)
+                                    HDfree(annbuf);
+                                if((annbuf=(char *)HDmalloc(annlen))==NULL) {
+                                    printf("Error allocating buffer for annotation, aborting!\n");
+                                    exit(1);
+                                  } /* end if */
+                                annbuflen=annlen;
+                              } /* end if */
+                            if(DFANgetlabel(argv[i],image_tag,prevref,annbuf,annbuflen)==FAIL)
+                                printf("Error reading annotation from file:%s, continuing\n",argv[i]);
+                            else
+                                if(DFANputlabel(outfile,image_tag,writeref,annbuf)==FAIL)
+                                    printf("Error writing annotation to file:%s, continuing\n",outfile);
+                          } /* end if */
+                      } /* end if */
+                    if(copy_idesc==TRUE) {
+                        if((annlen=DFANgetdesclen(argv[i],image_tag,prevref))!=FAIL) {
+                            if(annbuflen==0 || annlen>annbuflen) {
+                                if(annbuflen!=0)
+                                    HDfree(annbuf);
+                                if((annbuf=(char *)HDmalloc(annlen))==NULL) {
+                                    printf("Error allocating buffer for annotation, aborting!\n");
+                                    exit(1);
+                                  } /* end if */
+                                annbuflen=annlen;
+                              } /* end if */
+                            if(DFANgetdesc(argv[i],image_tag,prevref,annbuf,annbuflen)==FAIL)
+                                printf("Error reading annotation from file:%s, continuing\n",argv[i]);
+                            else
+                                if(DFANputdesc(outfile,image_tag,writeref,annbuf,annlen)==FAIL)
+                                    printf("Error writing annotation to file:%s, continuing\n",outfile);
+                          } /* end if */
+                      } /* end if */
+                  } /* end if */
+
+                /* sequence past this image */
+                DFR8readref(argv[i], prevref);
+                DFR8getdims(argv[i], &xdim, &ydim, &ispal);
+
+                HDfree((VOIDP)space);
+            }
+        }
+    }
+
+    Hclose(out_fid); /* remember to close the file */
+    if(annbuflen!=0)    /* and free the buffer space */
+        HDfree(annbuf);
+
+    return(0);
+}
diff --git a/hdf/util/hdfcomp.out1 b/hdf/util/hdfcomp.out1
new file mode 100644
index 0000000..4900cf3
--- /dev/null
+++ b/hdf/util/hdfcomp.out1
@@ -0,0 +1,70 @@
+allstorms.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+Raster Image-8                : (tag 202)
+	Ref no      2	    3249 bytes
+	Ref no      3	    3249 bytes
+	Ref no      4	    3249 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+	Ref no      3	      20 bytes
+	Ref no      4	      20 bytes
+
+Raster Image Data             : (tag 302)
+	Ref no      2	    3249 bytes
+	Ref no      3	    3249 bytes
+	Ref no      4	    3249 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+	Ref no      3	       8 bytes
+	Ref no      4	       8 bytes
+
+allcomp.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      2	    2921 bytes
+	Ref no      3	    3058 bytes
+	Ref no      4	    3156 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+	Ref no      3	      20 bytes
+	Ref no      4	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      2	    2921 bytes
+	Ref no      3	    3058 bytes
+	Ref no      4	    3156 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+	Ref no      3	       8 bytes
+	Ref no      4	       8 bytes
+
diff --git a/hdf/util/hdfcomp.out1.1 b/hdf/util/hdfcomp.out1.1
new file mode 100644
index 0000000..853f9ee
--- /dev/null
+++ b/hdf/util/hdfcomp.out1.1
@@ -0,0 +1,35 @@
+allstorms.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+Raster Image-8                : (tag 202)
+	Ref no      2	    3249 bytes
+	Ref no      3	    3249 bytes
+	Ref no      4	    3249 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+	Ref no      3	      20 bytes
+	Ref no      4	      20 bytes
+
+Raster Image Data             : (tag 302)
+	Ref no      2	    3249 bytes
+	Ref no      3	    3249 bytes
+	Ref no      4	    3249 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+	Ref no      3	       8 bytes
+	Ref no      4	       8 bytes
+
diff --git a/hdf/util/hdfcomp.out1.2 b/hdf/util/hdfcomp.out1.2
new file mode 100644
index 0000000..b0d51ec
--- /dev/null
+++ b/hdf/util/hdfcomp.out1.2
@@ -0,0 +1,35 @@
+allcomp.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+	Ref no      3	       4 bytes
+	Ref no      4	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      2	    2921 bytes
+	Ref no      3	    3058 bytes
+	Ref no      4	    3156 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+	Ref no      3	      20 bytes
+	Ref no      4	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      2	    2921 bytes
+	Ref no      3	    3058 bytes
+	Ref no      4	    3156 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+	Ref no      3	       8 bytes
+	Ref no      4	       8 bytes
+
diff --git a/hdf/util/hdfed-w.out1 b/hdf/util/hdfed-w.out1
new file mode 100644
index 0000000..cc53a4d
--- /dev/null
+++ b/hdf/util/hdfed-w.out1
@@ -0,0 +1,104 @@
+ (1) 	Machine type                  : (Tag 107) Ref 4369
+ (2) 	Raster Image Data             : (Tag 302) Ref 110
+ (3) 	Raster Image-8                : (Tag 202) Ref 110
+ (4) 	Number type                   : (Tag 106) Ref 110
+ (5) 	Image Dimensions-8            : (Tag 200) Ref 110
+ (6) 	Image Dimensions              : (Tag 300) Ref 110
+*(7) 	Raster Image Group            : (Tag 306) Ref 110
+ (6) 	Image Dimensions              : (Tag 300)
+	Ref: 110, Offset: 3459, Length: 20 (bytes)
+       0:          0         57          0         57        106        110 
+      12:          1          0          0          0 
+ (1) 	Version Descriptor            : (Tag 30) Ref 1
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+ (3) 	Number type                   : (Tag 106) Ref 2
+ (4) 	SciData dimension record      : (Tag 701) Ref 2
+ (5) 	SciData scales                : (Tag 703) Ref 2
+ (6) 	SciData max/min               : (Tag 707) Ref 2
+ (7) 	Calibration information       : (Tag 731) Ref 2
+ (8) 	Links related to the dataset  : (Tag 710) Ref 2
+*(9) 	Numeric Data Group            : (Tag 720) Ref 2
+ (10) 	Scientific Data Group         : (Tag 700) Ref 2
+ (11) 	Scientific Data               : (Tag 702) Ref 3
+ (12) 	Number type                   : (Tag 106) Ref 3
+ (13) 	SciData dimension record      : (Tag 701) Ref 3
+ (14) 	SciData scales                : (Tag 703) Ref 3
+ (15) 	SciData max/min               : (Tag 707) Ref 3
+ (16) 	Numeric Data Group            : (Tag 720) Ref 3
+ (17) 	Scientific Data               : (Tag 702) Ref 4
+ (18) 	Number type                   : (Tag 106) Ref 4
+ (19) 	SciData dimension record      : (Tag 701) Ref 4
+ (20) 	SciData scales                : (Tag 703) Ref 4
+ (21) 	SciData max/min               : (Tag 707) Ref 4
+ (22) 	Numeric Data Group            : (Tag 720) Ref 4
+ (23) 	Scientific Data               : (Tag 702) Ref 5
+ (24) 	Number type                   : (Tag 106) Ref 5
+ (25) 	SciData dimension record      : (Tag 701) Ref 5
+ (26) 	SciData scales                : (Tag 703) Ref 5
+ (27) 	SciData max/min               : (Tag 707) Ref 5
+ (28) 	Numeric Data Group            : (Tag 720) Ref 5
+ (29) 	Scientific Data               : (Tag 702) Ref 6
+ (30) 	Number type                   : (Tag 106) Ref 6
+ (31) 	SciData dimension record      : (Tag 701) Ref 6
+ (32) 	SciData scales                : (Tag 703) Ref 6
+ (33) 	SciData max/min               : (Tag 707) Ref 6
+ (34) 	Numeric Data Group            : (Tag 720) Ref 6
+ (35) 	Scientific Data               : (Tag 702) Ref 7
+ (36) 	Number type                   : (Tag 106) Ref 7
+ (37) 	SciData dimension record      : (Tag 701) Ref 7
+ (38) 	SciData scales                : (Tag 703) Ref 7
+ (39) 	SciData max/min               : (Tag 707) Ref 7
+ (40) 	Numeric Data Group            : (Tag 720) Ref 7
+ (41) 	Scientific Data               : (Tag 702) Ref 8
+ (42) 	Number type                   : (Tag 106) Ref 8
+ (43) 	SciData dimension record      : (Tag 701) Ref 8
+ (44) 	SciData scales                : (Tag 703) Ref 8
+ (45) 	SciData max/min               : (Tag 707) Ref 8
+ (46) 	Numeric Data Group            : (Tag 720) Ref 8
+ (2) 	Scientific Data               : (Tag 702)
+	Ref: 2, Offset: 294, Length: 400 (bytes)
+       0:   0.000000e+000  1.000000e+000  2.000000e+000  3.000000e+000
+      16:   4.000000e+000  5.000000e+000  6.000000e+000  7.000000e+000
+      32:   8.000000e+000  9.000000e+000  4.000000e+001  4.100000e+001
+      48:   4.200000e+001  4.300000e+001  4.400000e+001  4.500000e+001
+      64:   4.600000e+001  4.700000e+001  4.800000e+001  4.900000e+001
+      80:   8.000000e+001  8.100000e+001  8.200000e+001  8.300000e+001
+      96:   8.400000e+001  8.500000e+001  8.600000e+001  8.700000e+001
+     112:   8.800000e+001  8.900000e+001  1.200000e+002  1.210000e+002
+     128:   1.220000e+002  1.230000e+002  1.240000e+002  1.250000e+002
+     144:   1.260000e+002  1.270000e+002  1.280000e+002  1.290000e+002
+     160:   1.600000e+002  1.610000e+002  1.620000e+002  1.630000e+002
+     176:   1.640000e+002  1.650000e+002  1.660000e+002  1.670000e+002
+     192:   1.680000e+002  1.690000e+002  2.000000e+002  2.010000e+002
+     208:   2.020000e+002  2.030000e+002  2.040000e+002  2.050000e+002
+     224:   2.060000e+002  2.070000e+002  2.080000e+002  2.090000e+002
+     240:   2.400000e+002  2.410000e+002  2.420000e+002  2.430000e+002
+     256:   2.440000e+002  2.450000e+002  2.460000e+002  2.470000e+002
+     272:   2.480000e+002  2.490000e+002  2.800000e+002  2.810000e+002
+     288:   2.820000e+002  2.830000e+002  2.840000e+002  2.850000e+002
+     304:   2.860000e+002  2.870000e+002  2.880000e+002  2.890000e+002
+     320:   3.200000e+002  3.210000e+002  3.220000e+002  3.230000e+002
+     336:   3.240000e+002  3.250000e+002  3.260000e+002  3.270000e+002
+     352:   3.280000e+002  3.290000e+002  3.600000e+002  3.610000e+002
+     368:   3.620000e+002  3.630000e+002  3.640000e+002  3.650000e+002
+     384:   3.660000e+002  3.670000e+002  3.680000e+002  3.690000e+002
+     400: 
+ (29) 	Scientific Data               : (Tag 702)
+	Ref: 6, Offset: 1616, Length: 200 (bytes)
+       0:          0          1          2          3          4          5 
+      12:          6          7          8          9       6000       6001 
+      24:       6002       6003       6004       6005       6006       6007 
+      36:       6008       6009      12000      12001      12002      12003 
+      48:      12004      12005      12006      12007      12008      12009 
+      60:      18000      18001      18002      18003      18004      18005 
+      72:      18006      18007      18008      18009      24000      24001 
+      84:      24002      24003      24004      24005      24006      24007 
+      96:      24008      24009      30000      30001      30002      30003 
+     108:      30004      30005      30006      30007      30008      30009 
+     120:     -29536     -29535     -29534     -29533     -29532     -29531 
+     132:     -29530     -29529     -29528     -29527     -23536     -23535 
+     144:     -23534     -23533     -23532     -23531     -23530     -23529 
+     156:     -23528     -23527     -17536     -17535     -17534     -17533 
+     168:     -17532     -17531     -17530     -17529     -17528     -17527 
+     180:     -11536     -11535     -11534     -11533     -11532     -11531 
+     192:     -11530     -11529     -11528     -11527 
diff --git a/hdf/util/hdfed.input1 b/hdf/util/hdfed.input1
new file mode 100644
index 0000000..088e116
--- /dev/null
+++ b/hdf/util/hdfed.input1
@@ -0,0 +1,17 @@
+open storm110.hdf
+info -all
+prev tag = 300
+info -long
+dump -short
+close
+open ntcheck.hdf
+info -all
+prev tag = 30   ref = 1
+next tag = 702  ref = 2
+info -long
+dump -float
+next tag = 702  ref = 6
+info -long
+dump -short
+close
+quit
diff --git a/hdf/util/hdfed.out1 b/hdf/util/hdfed.out1
new file mode 100644
index 0000000..15a862e
--- /dev/null
+++ b/hdf/util/hdfed.out1
@@ -0,0 +1,104 @@
+ (1) 	Machine type                  : (Tag 107) Ref 4369
+ (2) 	Raster Image Data             : (Tag 302) Ref 110
+ (3) 	Raster Image-8                : (Tag 202) Ref 110
+ (4) 	Number type                   : (Tag 106) Ref 110
+ (5) 	Image Dimensions-8            : (Tag 200) Ref 110
+ (6) 	Image Dimensions              : (Tag 300) Ref 110
+*(7) 	Raster Image Group            : (Tag 306) Ref 110
+ (6) 	Image Dimensions              : (Tag 300)
+	Ref: 110, Offset: 3459, Length: 20 (bytes)
+       0:          0         57          0         57        106        110 
+      12:          1          0          0          0 
+ (1) 	Version Descriptor            : (Tag 30) Ref 1
+ (2) 	Scientific Data               : (Tag 702) Ref 2
+ (3) 	Number type                   : (Tag 106) Ref 2
+ (4) 	SciData dimension record      : (Tag 701) Ref 2
+ (5) 	SciData scales                : (Tag 703) Ref 2
+ (6) 	SciData max/min               : (Tag 707) Ref 2
+ (7) 	Calibration information       : (Tag 731) Ref 2
+ (8) 	Links related to the dataset  : (Tag 710) Ref 2
+*(9) 	Numeric Data Group            : (Tag 720) Ref 2
+ (10) 	Scientific Data Group         : (Tag 700) Ref 2
+ (11) 	Scientific Data               : (Tag 702) Ref 3
+ (12) 	Number type                   : (Tag 106) Ref 3
+ (13) 	SciData dimension record      : (Tag 701) Ref 3
+ (14) 	SciData scales                : (Tag 703) Ref 3
+ (15) 	SciData max/min               : (Tag 707) Ref 3
+ (16) 	Numeric Data Group            : (Tag 720) Ref 3
+ (17) 	Scientific Data               : (Tag 702) Ref 4
+ (18) 	Number type                   : (Tag 106) Ref 4
+ (19) 	SciData dimension record      : (Tag 701) Ref 4
+ (20) 	SciData scales                : (Tag 703) Ref 4
+ (21) 	SciData max/min               : (Tag 707) Ref 4
+ (22) 	Numeric Data Group            : (Tag 720) Ref 4
+ (23) 	Scientific Data               : (Tag 702) Ref 5
+ (24) 	Number type                   : (Tag 106) Ref 5
+ (25) 	SciData dimension record      : (Tag 701) Ref 5
+ (26) 	SciData scales                : (Tag 703) Ref 5
+ (27) 	SciData max/min               : (Tag 707) Ref 5
+ (28) 	Numeric Data Group            : (Tag 720) Ref 5
+ (29) 	Scientific Data               : (Tag 702) Ref 6
+ (30) 	Number type                   : (Tag 106) Ref 6
+ (31) 	SciData dimension record      : (Tag 701) Ref 6
+ (32) 	SciData scales                : (Tag 703) Ref 6
+ (33) 	SciData max/min               : (Tag 707) Ref 6
+ (34) 	Numeric Data Group            : (Tag 720) Ref 6
+ (35) 	Scientific Data               : (Tag 702) Ref 7
+ (36) 	Number type                   : (Tag 106) Ref 7
+ (37) 	SciData dimension record      : (Tag 701) Ref 7
+ (38) 	SciData scales                : (Tag 703) Ref 7
+ (39) 	SciData max/min               : (Tag 707) Ref 7
+ (40) 	Numeric Data Group            : (Tag 720) Ref 7
+ (41) 	Scientific Data               : (Tag 702) Ref 8
+ (42) 	Number type                   : (Tag 106) Ref 8
+ (43) 	SciData dimension record      : (Tag 701) Ref 8
+ (44) 	SciData scales                : (Tag 703) Ref 8
+ (45) 	SciData max/min               : (Tag 707) Ref 8
+ (46) 	Numeric Data Group            : (Tag 720) Ref 8
+ (2) 	Scientific Data               : (Tag 702)
+	Ref: 2, Offset: 294, Length: 400 (bytes)
+       0:    0.000000e+00   1.000000e+00   2.000000e+00   3.000000e+00
+      16:    4.000000e+00   5.000000e+00   6.000000e+00   7.000000e+00
+      32:    8.000000e+00   9.000000e+00   4.000000e+01   4.100000e+01
+      48:    4.200000e+01   4.300000e+01   4.400000e+01   4.500000e+01
+      64:    4.600000e+01   4.700000e+01   4.800000e+01   4.900000e+01
+      80:    8.000000e+01   8.100000e+01   8.200000e+01   8.300000e+01
+      96:    8.400000e+01   8.500000e+01   8.600000e+01   8.700000e+01
+     112:    8.800000e+01   8.900000e+01   1.200000e+02   1.210000e+02
+     128:    1.220000e+02   1.230000e+02   1.240000e+02   1.250000e+02
+     144:    1.260000e+02   1.270000e+02   1.280000e+02   1.290000e+02
+     160:    1.600000e+02   1.610000e+02   1.620000e+02   1.630000e+02
+     176:    1.640000e+02   1.650000e+02   1.660000e+02   1.670000e+02
+     192:    1.680000e+02   1.690000e+02   2.000000e+02   2.010000e+02
+     208:    2.020000e+02   2.030000e+02   2.040000e+02   2.050000e+02
+     224:    2.060000e+02   2.070000e+02   2.080000e+02   2.090000e+02
+     240:    2.400000e+02   2.410000e+02   2.420000e+02   2.430000e+02
+     256:    2.440000e+02   2.450000e+02   2.460000e+02   2.470000e+02
+     272:    2.480000e+02   2.490000e+02   2.800000e+02   2.810000e+02
+     288:    2.820000e+02   2.830000e+02   2.840000e+02   2.850000e+02
+     304:    2.860000e+02   2.870000e+02   2.880000e+02   2.890000e+02
+     320:    3.200000e+02   3.210000e+02   3.220000e+02   3.230000e+02
+     336:    3.240000e+02   3.250000e+02   3.260000e+02   3.270000e+02
+     352:    3.280000e+02   3.290000e+02   3.600000e+02   3.610000e+02
+     368:    3.620000e+02   3.630000e+02   3.640000e+02   3.650000e+02
+     384:    3.660000e+02   3.670000e+02   3.680000e+02   3.690000e+02
+     400: 
+ (29) 	Scientific Data               : (Tag 702)
+	Ref: 6, Offset: 1616, Length: 200 (bytes)
+       0:          0          1          2          3          4          5 
+      12:          6          7          8          9       6000       6001 
+      24:       6002       6003       6004       6005       6006       6007 
+      36:       6008       6009      12000      12001      12002      12003 
+      48:      12004      12005      12006      12007      12008      12009 
+      60:      18000      18001      18002      18003      18004      18005 
+      72:      18006      18007      18008      18009      24000      24001 
+      84:      24002      24003      24004      24005      24006      24007 
+      96:      24008      24009      30000      30001      30002      30003 
+     108:      30004      30005      30006      30007      30008      30009 
+     120:     -29536     -29535     -29534     -29533     -29532     -29531 
+     132:     -29530     -29529     -29528     -29527     -23536     -23535 
+     144:     -23534     -23533     -23532     -23531     -23530     -23529 
+     156:     -23528     -23527     -17536     -17535     -17534     -17533 
+     168:     -17532     -17531     -17530     -17529     -17528     -17527 
+     180:     -11536     -11535     -11534     -11533     -11532     -11531 
+     192:     -11530     -11529     -11528     -11527 
diff --git a/hdf/util/hdfgifwr.c b/hdf/util/hdfgifwr.c
new file mode 100644
index 0000000..6eea17c
--- /dev/null
+++ b/hdf/util/hdfgifwr.c
@@ -0,0 +1,533 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+ 
+/*
+ * hdfgifwr.c  - handles writing of GIF files.  
+ * 
+ * Contains: 
+ *   hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols, colorstyle,
+ *            comment)
+ *
+ * Note: slightly brain-damaged, in that it'll only write non-interlaced 
+ *       GIF files (in the interests of speed, or something)
+ *
+ */
+
+
+
+/*****************************************************************
+ * Portions of this code Copyright (C) 1989 by Michael Mauldin.
+ * Permission is granted to use this file in whole or in
+ * part for any purpose, educational, recreational or commercial,
+ * provided that this copyright notice is retained unchanged.
+ * This software is available to all free of charge by anonymous
+ * FTP and in the UUNET archives.
+ *
+ *
+ * Authors:  Michael Mauldin (mlm at cs.cmu.edu)
+ *           David Rowley (mgardi at watdcsu.waterloo.edu)
+ *
+ * Based on: compress.c - File compression ala IEEE Computer, June 1984.
+ *
+ *	Spencer W. Thomas       (decvax!harpo!utah-cs!utah-gr!thomas)
+ *	Jim McKie               (decvax!mcvax!jim)
+ *	Steve Davies            (decvax!vax135!petsd!peora!srd)
+ *	Ken Turkowski           (decvax!decwrl!turtlevax!ken)
+ *	James A. Woods          (decvax!ihnp4!ames!jaw)
+ *	Joe Orost               (decvax!vax135!petsd!joe)
+ *****************************************************************/
+ 
+
+#include <stdio.h>
+#include "gif.h"
+#include <stdlib.h>
+#include <string.h>
+
+typedef BYTE		byte;
+typedef long int	count_int;
+
+/* indicies into conv24MB */
+#define CONV24_8BIT  0
+#define CONV24_24BIT 1
+#define CONV24_SEP1  2
+#define CONV24_LOCK  3
+#define CONV24_SEP2  4
+#define CONV24_FAST  5
+#define CONV24_SLOW  6
+#define CONV24_BEST  7
+#define CONV24_MAX   8
+
+/* values 'picType' can take */
+#define PIC8  CONV24_8BIT
+#define PIC24 CONV24_24BIT
+
+/* MONO returns total intensity of r,g,b components */
+#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5)  /*.33R+ .5G+ .17B*/
+
+static int  Width, Height;
+static int  curx, cury;
+static long CountDown;
+static int  Interlace;
+
+#ifdef __STDC__
+static void putword(int, FILE *);
+static void compress(int, FILE *, byte *, int);
+static void output(int);
+static void cl_block(void);
+static void cl_hash(count_int);
+static void char_init(void);
+static void char_out(int);
+static void flush_char(void);
+#else
+static void putword(), compress(), output(), cl_block(), cl_hash();
+static void char_init(), char_out(), flush_char();
+#endif
+
+static byte pc2nc[256],r1[256],g1[256],b1[256];
+
+void xvbzero(s, len)
+     char *s;
+     int   len;
+{
+  for ( ; len>0; len--) *s++ = 0;
+}
+
+/*************************************************************/
+int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap,  numcols, colorstyle, BitsPerPixel)
+    FILE *fp;
+    byte *pic;
+    int   ptype, w,h;
+    byte *rmap, *gmap, *bmap , *pc2ncmap;
+    int   numcols, colorstyle;
+    int	  BitsPerPixel;
+{
+  int   RWidth, RHeight;
+  int   LeftOfs, TopOfs;
+  int   ColorMapSize, InitCodeSize, Background;
+  int   i;
+  byte *pic8;
+  pic8 = pic;
+  
+  Interlace = 0;
+  Background = 0;
+  
+  for (i=0; i<256; i++) { 
+	  pc2nc[i] = pc2ncmap[i];
+	  r1[i] = rmap[i];
+	  g1[i] = gmap[i];
+	  b1[i] = bmap[i];
+  }
+
+  ColorMapSize = 1 << BitsPerPixel;
+	
+  RWidth  = Width  = w;
+  RHeight = Height = h;
+  LeftOfs = TopOfs = 0;
+	
+  CountDown = w * h;    /* # of pixels we'll be doing */
+
+  if (BitsPerPixel <= 1) InitCodeSize = 2;
+     else InitCodeSize = BitsPerPixel;
+
+  curx = cury = 0;
+
+  if (!fp) {
+    fprintf(stderr,  "WriteGIF: file not open for writing\n" );
+    return (1);
+  }
+
+  compress(InitCodeSize+1, fp, pic8, w*h);
+
+
+  if (ferror(fp)) return -1;
+  return (0);
+}
+
+
+
+
+/******************************/
+static void putword(w, fp)
+int w;
+FILE *fp;
+{
+  /* writes a 16-bit integer in GIF order (LSB first) */
+  
+  fputc(w &0xff, fp);
+    
+  fputc((w>>8)&0xff,fp);
+}
+
+
+
+
+/***********************************************************************/
+static unsigned long cur_accum = 0;
+static int           cur_bits = 0;
+
+#define MAXCODE(n_bits)     ( (1 << (n_bits)) - 1)
+#define min(a,b)        ((a>b) ? b : a)
+#define XV_BITS	12    /* BITS was already defined on some systems */
+#define MSDOS	1
+#define HSIZE  5003            /* 80% occupancy */
+
+typedef unsigned char   char_type;
+static int n_bits;                    /* number of bits/code */
+static int maxbits = XV_BITS;         /* user settable max # bits/code */
+static int maxcode;                   /* maximum code, given n_bits */
+static int maxmaxcode = 1 << XV_BITS; /* NEVER generate this */
+
+static  count_int      htab [HSIZE];
+static  unsigned short codetab [HSIZE];
+#define HashTabOf(i)   htab[i]
+#define CodeTabOf(i)   codetab[i]
+
+static int hsize = HSIZE;            /* for dynamic table sizing */
+
+/*
+ * To save much memory, we overlay the table used by compress() with those
+ * used by decompress().  The tab_prefix table is the same size and type
+ * as the codetab.  The tab_suffix table needs 2**BITS characters.  We
+ * get this from the beginning of htab.  The output stack uses the rest
+ * of htab, and contains characters.  There is plenty of room for any
+ * possible stack (stack used to be 8000 characters).
+ */
+
+#define tab_prefixof(i) CodeTabOf(i)
+#define tab_suffixof(i)        ((char_type *)(htab))[i]
+#define de_stack               ((char_type *)&tab_suffixof(1<<XV_BITS))
+
+static int free_ent = 0;                  /* first unused entry */
+
+/*
+ * block compression parameters -- after all codes are used up,
+ * and compression rate changes, start over.
+ */
+static int clear_flg = 0;
+
+static long int in_count = 1;            /* length of input */
+static long int out_count = 0;           /* # of codes output (for debugging) */
+
+/*
+ * compress stdin to stdout
+ *
+ * Algorithm:  use open addressing double hashing (no chaining) on the 
+ * prefix code / next character combination.  We do a variant of Knuth's
+ * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
+ * secondary probe.  Here, the modular division first probe is gives way
+ * to a faster exclusive-or manipulation.  Also do block compression with
+ * an adaptive reset, whereby the code table is cleared when the compression
+ * ratio decreases, but after the table fills.  The variable-length output
+ * codes are re-sized at this point, and a special CLEAR code is generated
+ * for the decompressor.  Late addition:  construct the table according to
+ * file size for noticeable speed improvement on small files.  Please direct
+ * questions about this implementation to ames!jaw.
+ */
+
+static int g_init_bits;
+static FILE *g_outfile;
+
+static int ClearCode;
+static int EOFCode;
+
+/********************************************************/
+static void compress(init_bits, outfile, data, len)
+int   init_bits;
+FILE *outfile;
+byte *data;
+int   len;
+{
+  register long fcode;
+  register int i = 0;
+  register int c;
+  register int ent;
+  register int disp;
+  register int hsize_reg;
+  register int hshift;
+
+  /*
+   * Set up the globals:  g_init_bits - initial number of bits
+   *                      g_outfile   - pointer to output file
+   */
+  g_init_bits = init_bits;
+  g_outfile   = outfile;
+
+  /* initialize 'compress' globals */
+  maxbits = XV_BITS;
+  maxmaxcode = 1<<XV_BITS;
+  xvbzero((char *) htab,    sizeof(htab));
+  xvbzero((char *) codetab, sizeof(codetab));
+  hsize = HSIZE;
+  free_ent = 0;
+  clear_flg = 0;
+  in_count = 1;
+  out_count = 0;
+  cur_accum = 0;
+  cur_bits = 0;
+
+
+  /*
+   * Set up the necessary values
+   */
+  out_count = 0;
+  clear_flg = 0;
+  in_count = 1;
+  maxcode = MAXCODE(n_bits = g_init_bits);
+
+  ClearCode = (1 << (init_bits - 1));
+  EOFCode = ClearCode + 1;
+  free_ent = ClearCode + 2;
+
+  char_init();
+  ent = pc2nc[*data++];  len--;
+
+  hshift = 0;
+  for ( fcode = (long) hsize;  fcode < 65536L; fcode *= 2L )
+    hshift++;
+  hshift = 8 - hshift;                /* set hash code range bound */
+
+  hsize_reg = hsize;
+  cl_hash( (count_int) hsize_reg);            /* clear hash table */
+
+  output(ClearCode);
+    
+  while (len) {
+    c = pc2nc[*data++];  len--;
+    in_count++;
+
+    fcode = (long) ( ( (long) c << maxbits) + ent);
+    i = (((int) c << hshift) ^ ent);    /* xor hashing */
+
+    if ( HashTabOf (i) == fcode ) {
+      ent = CodeTabOf (i);
+      continue;
+    }
+
+    else if ( (long)HashTabOf (i) < 0 )      /* empty slot */
+      goto nomatch;
+
+    disp = hsize_reg - i;           /* secondary hash (after G. Knott) */
+    if ( i == 0 )
+      disp = 1;
+
+probe:
+    if ( (i -= disp) < 0 )
+      i += hsize_reg;
+
+    if ( HashTabOf (i) == fcode ) {
+      ent = CodeTabOf (i);
+      continue;
+    }
+
+    if ( (long)HashTabOf (i) >= 0 ) 
+      goto probe;
+
+nomatch:
+    output(ent);
+    out_count++;
+    ent = c;
+
+    if ( free_ent < maxmaxcode ) {
+      CodeTabOf (i) = free_ent++; /* code -> hashtable */
+      HashTabOf (i) = fcode;
+    }
+    else
+      cl_block();
+  }
+
+  /* Put out the final code */
+  output(ent);
+  out_count++;
+  output(EOFCode);
+}
+
+
+/*****************************************************************
+ * TAG( output )
+ *
+ * Output the given code.
+ * Inputs:
+ *      code:   A n_bits-bit integer.  If == -1, then EOF.  This assumes
+ *              that n_bits =< (long)wordsize - 1.
+ * Outputs:
+ *      Outputs code to the file.
+ * Assumptions:
+ *      Chars are 8 bits long.
+ * Algorithm:
+ *      Maintain a BITS character long buffer (so that 8 codes will
+ * fit in it exactly).  Use the VAX insv instruction to insert each
+ * code in turn.  When the buffer fills up empty it and start over.
+ */
+
+static
+unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
+                                  0x001F, 0x003F, 0x007F, 0x00FF,
+                                  0x01FF, 0x03FF, 0x07FF, 0x0FFF,
+                                  0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
+
+static void output(code)
+int code;
+{
+  cur_accum &= masks[cur_bits];
+
+  if (cur_bits > 0)
+    cur_accum |= ((long)code << cur_bits);
+  else
+    cur_accum = code;
+	
+  cur_bits += n_bits;
+
+  while( cur_bits >= 8 ) {
+    char_out( (unsigned int) (cur_accum & 0xff) );
+    cur_accum >>= 8;
+    cur_bits -= 8;
+  }
+
+  /*
+   * If the next entry is going to be too big for the code size,
+   * then increase it, if possible.
+   */
+
+  if (free_ent > maxcode || clear_flg) {
+
+    if( clear_flg ) {
+      maxcode = MAXCODE (n_bits = g_init_bits);
+      clear_flg = 0;
+    }
+    else {
+      n_bits++;
+      if ( n_bits == maxbits )
+	maxcode = maxmaxcode;
+      else
+	maxcode = MAXCODE(n_bits);
+    }
+  }
+	
+  if( code == EOFCode ) {
+    /* At EOF, write the rest of the buffer */
+    while( cur_bits > 0 ) {
+      char_out( (unsigned int)(cur_accum & 0xff) );
+      cur_accum >>= 8;
+      cur_bits -= 8;
+    }
+
+    flush_char();
+	
+    fflush( g_outfile );
+
+#ifdef FOO
+    if( ferror( g_outfile ) ) 
+      FatalError("unable to write GIF file");
+#endif
+  }
+}
+
+
+/********************************/
+static void cl_block ()             /* table clear for block compress */
+{
+  /* Clear out the hash table */
+
+  cl_hash ( (count_int) hsize );
+  free_ent = ClearCode + 2;
+  clear_flg = 1;
+
+  output(ClearCode);
+}
+
+
+/********************************/
+static void cl_hash(hsize)          /* reset code table */
+register count_int hsize;
+{
+  register count_int *htab_p = htab+hsize;
+  register long i;
+  register long m1 = -1;
+
+  i = hsize - 16;
+  do {                            /* might use Sys V memset(3) here */
+    *(htab_p-16) = m1;
+    *(htab_p-15) = m1;
+    *(htab_p-14) = m1;
+    *(htab_p-13) = m1;
+    *(htab_p-12) = m1;
+    *(htab_p-11) = m1;
+    *(htab_p-10) = m1;
+    *(htab_p-9) = m1;
+    *(htab_p-8) = m1;
+    *(htab_p-7) = m1;
+    *(htab_p-6) = m1;
+    *(htab_p-5) = m1;
+    *(htab_p-4) = m1;
+    *(htab_p-3) = m1;
+    *(htab_p-2) = m1;
+    *(htab_p-1) = m1;
+    htab_p -= 16;
+  } while ((i -= 16) >= 0);
+
+  for ( i += 16; i > 0; i-- )
+    *--htab_p = m1;
+}
+
+
+/******************************************************************************
+ *
+ * GIF Specific routines
+ *
+ ******************************************************************************/
+
+/*
+ * Number of characters so far in this 'packet'
+ */
+static int a_count;
+
+/*
+ * Set up the 'byte output' routine
+ */
+static void char_init()
+{
+	a_count = 0;
+}
+
+/*
+ * Define the storage for the packet accumulator
+ */
+static char accum[ 256 ];
+
+/*
+ * Add a character to the end of the current packet, and if it is 254
+ * characters, flush the packet to disk.
+ */
+static void char_out(c)
+int c;
+{
+  accum[ a_count++ ] = c;
+  if( a_count >= 254 ) 
+    flush_char();
+}
+
+/*
+ * Flush the packet to disk, and reset the accumulator
+ */
+static void flush_char()
+{
+  if( a_count > 0 ) {
+    fputc( a_count, g_outfile );
+    fwrite( accum, 1, a_count, g_outfile );
+    a_count = 0;
+  }
+}	
+
+
+
diff --git a/hdf/util/hdfls.c b/hdf/util/hdfls.c
new file mode 100644
index 0000000..08f8447
--- /dev/null
+++ b/hdf/util/hdfls.c
@@ -0,0 +1,624 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdfls.c 6013 2014-01-10 21:19:02Z acheng $ */
+#include "hdf.h"
+#include "hfile.h"
+
+#define MAXBUFF 8192
+
+dd_t       *desc_buf;
+
+intn
+debug = FALSE,      /* Debugging is off by default */
+    ddblocks = FALSE,   /* DD block dumping is off by default */
+#ifdef DISKBLOCK_DEBUG
+    diskblock_check = FALSE,   /* check disk-block boundaries */
+#endif /* DISKBLOCK_DEBUG */
+    sort = TRUE,        /* Sorting is on by default */
+    longout = FALSE,    /* short output by default */
+    labels = FALSE,     /* no label info by default */
+    special = FALSE,    /* no special info by default */
+    groups = FALSE;     /* no group info by default */
+static intn v_init_done = FALSE;    /* whether the Vset interface has been */
+/* initialized for this file */
+uint16      only_tag = DFTAG_NULL;  /* by default print info about all tags */
+
+char       *file_name;          /* name of current file being listed */
+
+int         compare (const void *, const void *);
+int         main (int, char *a[]);
+void        lprint (int32, dd_t *, int);
+void        print_item (int32, dd_t *, intn);
+void	    printfilever (int32 file_id);
+void        usage(char *argv[]);
+int         dumpDD(void);
+
+int
+compare(const void * aa, const void * bb)
+{
+    const dd_t *a = (const dd_t *) aa;
+    const dd_t *b = (const dd_t *) bb;
+
+    if (a->tag > b->tag)
+        return (1);
+    if (a->tag < b->tag)
+        return (-1);
+    if (a->ref > b->ref)
+        return (1);
+    if (a->ref < b->ref)
+        return (-1);
+    return (0);
+}
+
+void
+print_item(int32 fid, dd_t *desc_list, intn n)
+{
+    intn        status;
+    int32       len;
+    char       *name, *label_str;
+    intn        i;   /* loop variable*/
+
+    printf("\tRef no %6d\t%8d bytes\n", (int)desc_list[n].ref, (int)desc_list[n].length);
+
+    /* print out labels and annotations if desired */
+    if (labels)
+      {     /* read in all of the labels */
+          len = DFANgetlablen(file_name, desc_list[n].tag, desc_list[n].ref);
+          if (len != FAIL)
+            {
+                label_str = (char *) HDmalloc((uint32) len + 1);
+                status = DFANgetlabel(file_name, desc_list[n].tag, desc_list[n].ref, label_str, len + 1);
+                label_str[len] = '\0';
+                if (status == FAIL)
+                    printf("\t  Unable to read label\n");
+                else
+                    printf("\t  Label: %s\n", label_str);
+                HDfree(label_str);
+            }
+
+          /* read in all of the annotations */
+          len = DFANgetdesclen(file_name, desc_list[n].tag, desc_list[n].ref);
+          if (len != FAIL)
+            {
+                label_str = (char *) HDmalloc((uint32) len + 1);
+                status = DFANgetdesc(file_name, desc_list[n].tag, desc_list[n].ref, label_str, len + 1);
+                label_str[len] = '\0';
+                if (status == FAIL)
+                    printf("\t  Unable to read description\n");
+                else
+                    printf("\t  Description: %s\n", label_str);
+                HDfree(label_str);
+            }
+      }
+
+    if ((special) && (SPECIALTAG(desc_list[n].tag)))
+      {     /* print out special info if desired */
+          sp_info_block_t info;
+          int32       aid, ret;
+
+          aid = Hstartread(fid, desc_list[n].tag, desc_list[n].ref);
+          if (aid == FAIL)
+              return;
+
+          ret = HDget_special_info(aid, &info);
+          if ((ret == FAIL) || (info.key == FAIL))
+              return;
+
+          switch (info.key)
+            {
+            case SPECIAL_LINKED:
+                printf("\tLinked Block: first %ld standard %ld per unit %ld\n",
+                       (long) info.first_len, (long) info.block_len,
+                       (long) info.nblocks);
+                break;
+
+            case SPECIAL_EXT:
+                printf("\tExternal File: path %s  offset %ld\n", info.path,
+                       (long) info.offset);
+                break;
+
+            case SPECIAL_COMP:
+                printf("\tCompressed Element: compression type: %s  modeling type %s\n",
+                       (info.comp_type == COMP_CODE_NONE ? "None" :
+                        (info.comp_type == COMP_CODE_RLE ? "Run-Length" :
+                         (info.comp_type == COMP_CODE_NBIT ? "N-Bit" : 
+                          (info.comp_type == COMP_CODE_SKPHUFF ? "Skipping Huffman" : 
+                           (info.comp_type == COMP_CODE_DEFLATE ? "Deflated" : 
+                            "Unknown"))))),
+                       (info.model_type == COMP_MODEL_STDIO ? "Standard" : "Unknown"));
+                break;
+
+             case SPECIAL_CHUNKED:
+                printf("\tChunked Element: \n \tlogical size: %ld\n \tnumber of dimensions: %ld \n",
+                       (long) info.chunk_size, (long) info.ndims);
+                printf("\tarray of chunk lengths for each dimension:");
+                    for(i=0; i < info.ndims; i++)
+                               printf("\t %ld", (long) info.cdims[i]);
+                printf("\n");
+                HDfree(info.cdims);
+                break;
+
+            default:
+                printf("\tDo not understand special element type %d\n",
+                       info.key);
+                break;
+            }
+          Hendaccess(aid);
+      }
+
+    if ((groups) && (desc_list[n].tag == DFTAG_RIG || desc_list[n].tag == DFTAG_SDG
+                     || desc_list[n].tag == DFTAG_NDG || desc_list[n].tag == DFTAG_VG))
+      {     /* print groups */
+          if (desc_list[n].tag != DFTAG_VG)
+            {   /* groups other than Vgroups */
+                int32       GroupID;
+                DFdi        elmt;
+
+                printf("\tContents:\n");
+                if ((GroupID = DFdiread(fid, desc_list[n].tag, desc_list[n].ref)) >= 0)
+                  {
+                      while (!DFdiget(GroupID, &elmt.tag, &elmt.ref))
+                        {
+                            name = (char *) HDgettagsname(elmt.tag);
+                            if (!name)
+                                printf("\t\t%-30s: (tag=%6d) ref=%d\n", "Unknown Tag",
+                                       elmt.tag, elmt.ref);
+                            else
+                              {
+                                  printf("\t\t%-30s: (tag=%6d) ref=%d\n", name,
+                                         elmt.tag, elmt.ref);
+                                  HDfree(name);
+                              } /* end else */
+                        }   /* end while */
+                  }     /* end if */
+                else
+                    printf("\t\tNone!\n");
+            }   /* end if */
+          else
+            {   /* dump Vgroup tag/refs */
+                int32       ntagrefs;
+                int32       vkey;
+                int32      *tag_arr, *ref_arr;
+                intn        i;
+
+                if (v_init_done == FALSE)
+                  {     /* init the V routines */
+                      v_init_done = TRUE;
+                      Vinitialize(fid);
+                  }     /* end if */
+                if ((vkey = Vattach(fid, (int32)desc_list[n].ref, "r")) != FAIL)
+                  {
+                      ntagrefs = Vntagrefs(vkey);
+                      printf("\tContents: %d items\n", (int) ntagrefs);
+                      if (ntagrefs > 0)
+                        {
+                            tag_arr = (int32 *) HDmalloc(sizeof(int32) * (size_t)ntagrefs);
+                            ref_arr = (int32 *) HDmalloc(sizeof(int32) * (size_t)ntagrefs);
+                            if (tag_arr == NULL || ref_arr == NULL)
+                              {
+                                  HDfree(tag_arr);
+                                  HDfree(ref_arr);
+                              }     /* end if */
+                            else
+                              {
+                                  if (Vgettagrefs(vkey, tag_arr, ref_arr, ntagrefs) != FAIL)
+                                    {
+                                        for (i = 0; i < ntagrefs; i++)
+                                          {
+                                              name = (char *) HDgettagsname((uint16) tag_arr[i]);
+                                              if (!name)
+                                                  printf("\t\t%-30s: (tag=%6d) ref=%d\n",
+                                                         "Unknown Tag", (int) tag_arr[i], (int) ref_arr[i]);
+                                              else
+                                                {
+                                                    printf("\t\t%-30s: (tag=%6d) ref=%d\n",
+                                                           name, (int) tag_arr[i], (int) ref_arr[i]);
+                                                    HDfree(name);
+                                                } /* end else */
+                                          }     /* end for */
+                                    }   /* end if */
+                                  HDfree(tag_arr);
+                                  HDfree(ref_arr);
+                              }     /* end else */
+                        }   /* end if */
+                      Vdetach(vkey);
+                  }     /* end if */
+            }   /* end else */
+      }     /* dumping groups */
+}   /* print_item */
+
+void
+lprint(int32 fid, dd_t *desc_tmp, int num)
+{
+    intn        j = 0, empty = 0;
+    uint16      prev = 0;
+    char       *name;
+
+    while (j < num)
+      {
+          if (desc_tmp[j].tag == DFTAG_NULL)
+            {
+                empty++;
+                j++;
+                continue;   /* don't print anything now */
+            }
+
+          /*
+           * skip this tag if the user only wants to see some tags and
+           *  this is not one of them
+           */
+          if (only_tag != DFTAG_NULL && only_tag != desc_tmp[j].tag)
+            {
+                j++;
+                continue;
+            }
+
+          /*
+          ** Find and print text description of this tag
+          */
+          name = (char *) HDgettagsname(desc_tmp[j].tag);
+          if (!name)
+              printf("\n%-30s: (tag %d)\n", "Unknown Tag", desc_tmp[j].tag);
+          else
+            {
+                printf("\n%-30s: (tag %d)\n", name, desc_tmp[j].tag);
+                HDfree(name);
+            } /* end else */
+
+          /*
+          ** Print out reference number information
+          */
+          prev = desc_tmp[j].tag;
+          if (longout)
+            {
+                while (desc_tmp[j].tag == prev && j < num)
+                  {
+                      print_item(fid, desc_tmp, j);
+                      j++;
+                  }
+            }
+          else
+            {
+                printf("\tRef nos:");
+                while (desc_tmp[j].tag == (uint16) prev && j < num)
+                  {
+                      printf(" %d", desc_tmp[j].ref);
+                      j++;
+                  }
+            }
+      }
+
+    if (empty)
+        printf("\nEmpty (tag %d): %d slots\n", DFTAG_NULL, empty);
+}
+
+
+/* print the library version of the file */
+void printfilever(int32 file_id)
+{
+    uint32 major, minor, release;
+    char string[LIBVSTR_LEN+1];
+
+    if (Hgetfileversion(file_id, &major, &minor, &release, string) == SUCCEED)
+      {
+          string[LIBVSTR_LEN] = '\0';		/* make it a null terminated string */
+          printf("File library version: ");
+          printf("Major= %u, Minor=%u, Release=%u\nString=%s\n",
+                 (unsigned)major, (unsigned)minor, (unsigned)release, string);
+      }
+    else
+        printf("(Does not have libraray version information)\n");
+}
+
+/* print command usage */
+void usage(char *argv[])
+{
+    printf("%s,  version: 2.0   date: March 1, 1994\n", argv[0]);
+#ifdef DISKBLOCK_DEBUG
+    printf("%s [-o] [-l] [-d] [-v] [-g] [-s] [-h] [-x] [-t #] fn ....\n", argv[0]);
+#else /* DISKBLOCK_DEBUG */
+    printf("%s [-o] [-l] [-d] [-v] [-g] [-s] [-h] [-t #] fn ....\n", argv[0]);
+#endif /* DISKBLOCK_DEBUG */
+    printf("        This program displays information about the");
+    printf(" data elements in\n");
+    printf("        HDF file.\n");
+    printf("    -d: offset & length info of each element in the file\n");
+    printf("    -o: Ordered - display in reference number order\n");
+    printf("    -l: Long format - display more information\n");
+    printf("    -v: Verbose format - display text of annotations and labels.\n");
+    printf("        (Verbose format automatically puts you in Long format).\n");
+    printf("    -t #: List only information about a specific type of tag.\n");
+    printf("          For example '%s -t 700 foo.hdf' \n", argv[0]);
+    printf("          will list information only about Scientific Data\n");
+    printf("          Groups.\n");
+    printf("    -s: Give detailed descriptions of \"special elements\"\n");
+    printf("    -g: List items in groups\n");
+    printf("    -h: Dump DD Block information\n");
+#ifdef DISKBLOCK_DEBUG
+    printf("    -x: Check disk block boundaries (also dumps DD blocks)\n");
+#endif /* DISKBLOCK_DEBUG */
+}
+
+/* dump the DD blocks */
+int dumpDD(void)
+{
+    hdf_file_t file_id;    /* stdio file ID */
+    int32 next_block=MAGICLEN;
+    uint8 *ddbuf;         /* buffer to store the DD information */
+    uint8 buf[NDDS_SZ+OFFSET_SZ]; /* buffer to hold DD block info */
+    uint8 *b;
+    int16 n_dds;          /* number of DDs in the current block */
+    uint16 tag,ref;       /* DD tag & ref */
+    int32 off,len;        /* DD offset & length */
+    intn l;               /* local counting variable */
+
+    file_id=HI_OPEN(file_name,DFACC_READ);
+    if(OPENERR(file_id))
+      {
+          printf("Error opening file: %s\n",file_name);
+          return(FAIL);
+      } /* end if */
+    while(next_block!=0)
+      {
+          if(HI_SEEK(file_id,next_block)==FAIL)
+            {
+                printf("Error seeking in file: %s\n",file_name);
+                return(FAIL);
+            } /* end if */
+          if(HI_READ(file_id,buf,NDDS_SZ+OFFSET_SZ)==FAIL)
+            {
+                printf("Error reading in file: %s\n",file_name);
+                return(FAIL);
+            } /* end if */
+          printf("current block: %ld,",(long)next_block);
+          b=buf;
+          INT16DECODE(b,n_dds);
+          INT32DECODE(b,next_block);
+          printf(" size of block: %ld, number of DDs:%d, next block: %ld\n",(long)(NDDS_SZ+OFFSET_SZ+(n_dds*DD_SZ)),(int)n_dds,(long)next_block);
+
+          ddbuf=(uint8 *)HDmalloc(n_dds*DD_SZ);
+          if(HI_READ(file_id,ddbuf,n_dds*DD_SZ)==FAIL)
+            {
+                printf("Error reading in file: %s\n",file_name);
+                return(FAIL);
+            } /* end if */
+          b=ddbuf;
+          for(l=0; l<n_dds; l++)
+            {
+#ifdef DISKBLOCK_DEBUG
+                uint8 block_head[DISKBLOCK_HSIZE];
+                uint8 block_tail[DISKBLOCK_TSIZE];
+#endif /* DISKBLOCK_DEBUG */
+
+                UINT16DECODE(b, tag);
+                UINT16DECODE(b, ref);
+                INT32DECODE(b, off);
+                INT32DECODE(b, len);
+                printf("\t[%5d] tag=%5u ref=%5u offset=%10ld length=%10ld\n",(int)l,(unsigned)tag,(unsigned)ref,(long)off,(long)len);
+#ifdef DISKBLOCK_DEBUG
+                if((tag!=DFTAG_NULL && tag!=DFTAG_FREE) &&
+                   (len!=INVALID_LENGTH && off!=INVALID_OFFSET))
+                  {
+                      if(HI_SEEK(file_id,off-DISKBLOCK_HSIZE)==FAIL)
+                        {
+                            printf("Error seeking in file: %s\n",file_name);
+                            return(FAIL);
+                        } /* end if */
+                      if(HI_READ(file_id,block_head,DISKBLOCK_HSIZE)==FAIL)
+                        {
+                            printf("Error reading in file: %s\n",file_name);
+                            return(FAIL);
+                        } /* end if */
+                      if(HDmemcmp(block_head,diskblock_header,DISKBLOCK_HSIZE)!=0)
+                        {
+                            intn k;
+
+                            printf("Header wrong for disk block!\n");
+                            for(k=0; k<DISKBLOCK_HSIZE; k++)
+                              {
+                                  printf("\tbyte: %d, current: %x, correct: %x\n",k,(unsigned)block_head[k],(unsigned)diskblock_header[k]);
+                              } /* end for */
+                        } /* end if */
+                      if(HI_SEEK(file_id,off+len)==FAIL)
+                        {
+                            printf("Error seeking in file: %s\n",file_name);
+                            return(FAIL);
+                        } /* end if */
+                      if(HI_READ(file_id,block_tail,DISKBLOCK_TSIZE)==FAIL)
+                        {
+                            printf("Error reading in file: %s\n",file_name);
+                            return(FAIL);
+                        } /* end if */
+                      if(HDmemcmp(block_tail,diskblock_tail,DISKBLOCK_TSIZE)!=0)
+                        {
+                            intn k;
+
+                            printf("Tail wrong for disk block!\n");
+                            for(k=0; k<DISKBLOCK_HSIZE; k++)
+                              {
+                                  printf("\tbyte: %d, current: %x, correct: %x\n",k,(unsigned)block_tail[k],(unsigned)diskblock_tail[k]);
+                              } /* end for */
+                        } /* end if */
+                  } /* end if */
+#endif /* DISKBLOCK_DEBUG */
+            } /* end for */
+          HDfree(ddbuf);
+      } /* end while */
+    HI_CLOSE(file_id);
+    return(SUCCEED);
+}
+
+int
+main(int argc, char *argv[])
+{
+    int32       fid, aid;
+    int         i = 1, j, n, status;
+
+    while ((i < argc) && (argv[i][0] == '-'))
+      {
+          switch (argv[i][1])
+            {
+            case 'o':   /* give non ordered output */
+                sort = FALSE;
+                break;
+
+            case 'd':   /* go into debugging mode */
+                debug = TRUE;
+                break;
+
+            case 'h':   /* dump the dd blocks */
+                ddblocks = TRUE;
+                break;
+
+#ifdef DISKBLOCK_DEBUG
+            case 'x':   /* check the disk-block boundaries (implies dumping dd blocks) */
+                diskblock_check = TRUE;
+                ddblocks = TRUE;
+                break;
+#endif /* DISKBLOCK_DEBUG */
+
+            case 'v':   /* print labels for elements */
+                labels = TRUE;
+                longout = TRUE;
+                break;
+
+            case 'l':   /* give long output */
+                longout = TRUE;
+                break;
+
+            case 's':   /* give info on special elements */
+                special = TRUE;
+                longout = TRUE;
+                break;
+
+            case 'g':   /* give info on groups */
+                groups = TRUE;
+                longout = TRUE;
+                break;
+
+            case 't':
+                if (argv[i][2] != '\0')
+                    only_tag = (uint16) atoi(&(argv[i][2]));
+                else
+                    only_tag = (uint16) atoi(&(argv[++i][0]));
+                break;
+
+            default:
+                printf("Unknown option : -%c\n", argv[1][1]);
+                break;
+            }
+          i++;
+      }
+
+    /*
+     * If a file name has not been supplied print the usage message
+     */
+    if (i == argc)
+      {
+          usage(argv);
+          exit(1);
+      }
+
+    desc_buf = (dd_t *) HDcalloc(MAXBUFF, sizeof(dd_t));
+
+    while (i < argc)
+      {
+          file_name = argv[i];
+          printf("%s:\n", file_name);
+
+          /* Dump the DD blocks, if asked */
+          if(ddblocks==TRUE)
+            {
+                if (dumpDD() == FAIL){
+                    i++;
+                    continue;
+                }
+            } /* end if */
+
+          fid = Hopen(file_name, DFACC_READ, -1);
+          if (fid == FAIL)
+            {
+                if (HEvalue(1) == DFE_NOTDFFILE)
+                  {
+                      printf("\tNot an HDF file.\n");
+                      i++;
+                      continue;
+                  }
+                else
+                  {
+                      HEprint(stderr, 0);
+                  }
+            }
+
+          printfilever(fid);
+
+          aid = Hstartread(fid, DFTAG_WILDCARD, DFREF_WILDCARD);
+          if (aid == FAIL)
+            {
+                HEprint(stderr, 0);
+                i++;
+                continue;
+            }
+
+          status = SUCCEED;
+          for (n = 0; (n < MAXBUFF) && (status != FAIL); n++)
+            {
+                Hinquire(aid, NULL, &desc_buf[n].tag, &desc_buf[n].ref, &desc_buf[n].length,
+                         &desc_buf[n].offset, NULL, NULL, NULL);
+                status = Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT);
+            }
+
+          if (debug)
+            {
+                printf("\n");
+                for (j = 0; j < n; j++)
+                  {
+                      printf("%6d) tag %6d ref %6d ", j, desc_buf[j].tag, desc_buf[j].ref);
+                      printf(" offset %10d length %10d\n", (int)desc_buf[j].offset, (int)desc_buf[j].length);
+                  }
+            }
+
+          if (sort)
+              qsort((char *) desc_buf, (size_t)n, sizeof(dd_t), compare);
+
+          v_init_done = FALSE;
+
+          lprint(fid, desc_buf, n);
+
+          if (v_init_done == TRUE)
+              Vfinish(fid);
+
+          if (Hendaccess(aid) == FAIL)
+              HEprint(stderr, 0);
+
+          if (Hclose(fid) == FAIL)
+              HEprint(stderr, 0);
+
+          i++;
+          printf("\n");
+
+          if (n >= MAXBUFF)
+              fprintf(stderr,
+                      "Warning:  File may have more DD's than hdfls can display\n");
+      }
+
+    HDfree(desc_buf);
+
+    return (0);
+}
diff --git a/hdf/util/hdfpack.c b/hdf/util/hdfpack.c
new file mode 100644
index 0000000..dbe6197
--- /dev/null
+++ b/hdf/util/hdfpack.c
@@ -0,0 +1,657 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdfpack.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*
+   ** FILE
+   **   hdfpack.c
+   ** USAGE
+   **   hdfpack [options] <infile> <outfile>
+   ** DESCRIPTION
+   **   This program will compact an HDF file by reading in all the data
+   **   elements in the file and writing them out to a new file.
+   **      Options are:
+   **          -b  Don't coalesce linked-block elements
+   **          -i  Interactive mode; prompt for each linked-block element
+   **          -d# Force the output file to have # DDs per DD block
+   **          -t# Force output file to have # linked blocks per table entry
+   **          -x  Keep external objects external
+   **          -r <from> <to> rename external objects
+   **      Only one of options b and i can be specified.
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   Both arguments must be supplied to the program and they cannot be
+   **   identical.
+   **   You must have enough additional disk space for the compacted file.
+ */
+
+#include "hdf.h"
+#include "herr.h"
+#include "hfile.h"
+#include <stdio.h>
+#include <string.h>
+
+typedef struct mydd_t
+  {
+      uint16      tag;
+      uint16      ref;
+      int32       offset;
+      int32       length;
+      int16       special;
+  }
+mydd_t;
+
+/* Static function prototypes */
+int         promptblocks
+            (mydd_t * dd);
+
+VOID        copy_blocks
+            (mydd_t * dd, int32 infile, int32 outfile);
+
+VOID        merge_blocks
+            (mydd_t * dd, int32 infile, int32 outfile);
+
+int         main
+            (int, char *a[]);
+static VOID usage
+            (char *);
+static VOID hdferror
+            (void);
+static VOID error
+            (const char *);
+int         desc_comp
+            (const void *d1, const void *d2);
+
+unsigned char *data;
+char        invoke[81];
+int32       data_size;
+int32       nblk = 0;
+char       *from_file = NULL;
+char       *to_file = NULL;
+
+int
+main(int argc, char *argv[])
+{
+    int         i, num_desc, fnum, merge;
+    int32       infile, outfile, aid, ret;
+    mydd_t     *dlist;
+    int32       oldoff, oldlen;
+    int         blocks = 1;
+    int         intr = 0;
+    int16       ndds = 0;
+    int         optset = 0;
+    intn        external = FALSE;
+    char       *tmp, fname[2][80];
+    CONSTR(FUNC, "main");
+
+/*
+   **   Get invocation name of program
+ */
+    tmp = (char *) NULL;
+    HDstrcpy(invoke, strtok(argv[0], "/]\\\0"));
+    for (;;)
+      {
+          if (tmp != NULL)
+              HDstrcpy(invoke, tmp);
+          if ((tmp = strtok((char *) NULL, "/]\\\0")) == NULL)
+              break;
+      }
+
+    if (argc < 3)
+      {
+          usage(invoke);
+          exit(1);
+      }
+
+/*
+   **   Get option flags
+ */
+    fnum = 0;
+    i = 1;
+    while (i < argc)
+      {
+          if (argv[i][0] == '-')
+            {
+                switch (argv[i][1])
+                  {
+                      case 'b':
+                          if (optset == 0)
+                            {
+                                blocks = 0;
+                                optset = 1;
+                            }
+                          else
+                            {
+                                error("incompatible options: -i and -b");
+                            }
+                          break;
+                      case 'i':
+                          if (optset == 0)
+                            {
+                                intr = 1;
+                                blocks = 0;
+                                optset = 1;
+                            }
+                          else
+                            {
+                                error("incompatible options: -i and -b");
+                            }
+                          break;
+                      case 'd':
+                          ndds = (int16) atoi(&argv[i][2]);
+                          break;
+                      case 't':
+                          nblk = atoi(&argv[i][2]);
+                          break;
+                      case 'x':
+                          external = TRUE;
+                          break;
+                      case 'r':
+                          from_file = argv[++i];
+                          to_file = argv[++i];
+                          break;
+                      default:
+                          fprintf(stderr, "Unknown option -%c ignored\n", argv[i][1]);
+                          break;
+                  }
+            }
+          else
+            {
+                if (fnum < 2)
+                  {
+                      HDstrcpy(fname[fnum], argv[i]);
+                      fnum++;
+                  }
+            }
+          i++;
+      }
+
+/*
+   **   Enough [unique] file arguments?
+ */
+    if ((fnum != 2) || (HDstrcmp(fname[0], fname[1]) == 0))
+      {
+          error("need 2 unique file names");
+      }
+
+    if (from_file && to_file)
+        printf("Going to rename external file %s to %s\n", from_file, to_file);
+
+/*
+   **   Check to make sure input file is HDF
+ */
+    ret = (int) Hishdf(fname[0]);
+    if (ret == FALSE)
+        hdferror();
+
+/*
+   **   Open input and output files
+ */
+    infile = Hopen(fname[0], DFACC_READ, 0);
+
+    if (infile == FAIL)
+        hdferror();
+
+    outfile = Hopen(fname[1], DFACC_CREATE, ndds);
+
+    if (outfile == FAIL)
+        hdferror();
+
+/*
+   **   See how many data elements there
+   **   are and make room for their DD's
+ */
+    num_desc = (int) Hnumber(infile, DFTAG_WILDCARD);
+    if (num_desc == FAIL)
+        hdferror();
+
+    dlist = (mydd_t *) HDmalloc(num_desc * sizeof(*dlist));
+    if (dlist == NULL)
+        error("\tWow!  That file must be HUGE!\n\tThere isn't enough memory to hold the DD's.\n");
+
+/*
+   **   Allocate data buffer - try 1 Meg first, work down
+ */
+    data_size = 1048576;    /* 1 MB */
+    data = NULL;
+    while ((data = (unsigned char *) HDmalloc(data_size)) == NULL)
+        data_size /= 2;     /* okay then, cut request by half */
+
+/*
+   **   Get all DD's for data elements
+ */
+    aid = Hstartread(infile, DFTAG_WILDCARD, DFREF_WILDCARD);
+    if (aid == FAIL)
+      {
+          printf("MAJOR PROBLEM: Hstartread for DD's; line %d\n", __LINE__);
+          hdferror();
+      }
+    for (i = 0; i < num_desc; i++)
+      {
+
+          /*
+           * Get data about the current one
+           */
+          Hinquire(aid, NULL, &dlist[i].tag, &dlist[i].ref, &dlist[i].length,
+                   &dlist[i].offset, NULL, NULL, &dlist[i].special);
+
+          /*
+           * Move to the next one
+           */
+          ret = Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT);
+
+          /*
+           * Fail if there are none left and we expect more
+           */
+          if ((ret == FAIL) && (i + 1 < num_desc))
+            {
+                printf("MAJOR PROBLEM: DDs; only got %d of %d; line %d\n", i, num_desc, __LINE__);
+                hdferror();
+            }
+      }
+
+    /*
+     * Close the access element
+     */
+    ret = Hendaccess(aid);
+    if (ret == FAIL)
+        hdferror();
+
+/*
+   **   Sort DD's by offset to make it easy to
+   **   find DD's that point to the same data
+ */
+    qsort((char *) dlist, (size_t)num_desc, sizeof(*dlist), desc_comp);
+
+    oldoff = -2;
+    oldlen = -2;
+    for (i = 0; i < num_desc; i++)
+      {
+          if (((dlist[i].tag != DFTAG_NULL) && (dlist[i].tag != DFTAG_VERSION))
+              && (dlist[i].tag != DFTAG_LINKED))
+            {
+                if ((dlist[i].offset != oldoff) || (dlist[i].length != oldlen))
+                  {
+/*
+   **   if this DD points to different data, read the data
+   **   from the old file and write it to the new file
+ */
+                      switch (dlist[i].special)
+                        {
+                            case SPECIAL_LINKED:
+                                if (intr == 1)
+                                    merge = promptblocks(&dlist[i]);
+                                else
+                                    merge = blocks;
+                                if (merge == 0)
+                                  {
+                                      copy_blocks(&dlist[i], infile, outfile);
+                                  }
+                                else
+                                  {
+                                      merge_blocks(&dlist[i], infile, outfile);
+                                  }
+                                break;
+                            case SPECIAL_EXT:
+                                if (external)
+                                  {
+                                      sp_info_block_t info;
+                                      int32       aid1, new_aid;
+                                      char       *name;
+
+                                      /* get file name and offset */
+                                      aid1 = Hstartread(infile, dlist[i].tag, dlist[i].ref);
+                                      if (aid1 == FAIL)
+                                          continue;
+
+                                      ret = HDget_special_info(aid1, &info);
+                                      if ((ret == FAIL) || (info.key != SPECIAL_EXT))
+                                          continue;
+
+                                      /* see if should be renamed */
+                                      if (from_file && !HDstrcmp(info.path, from_file))
+                                          name = to_file;
+                                      else
+                                          name = info.path;
+
+                                      /* create the new one */
+                                      new_aid = HXcreate(outfile, BASETAG(dlist[i].tag),
+                                            dlist[i].ref, name, info.offset,
+                                                         dlist[i].length);
+
+                                      /* close the elements */
+                                      Hendaccess(aid1);
+                                      Hendaccess(new_aid);
+
+                                  }
+                                else
+                                  {
+                                      /* pull into the file */
+                                      merge_blocks(&dlist[i], infile, outfile);
+                                  }
+                                break;
+                            case SPECIAL_COMP:  /* This code assumes that you'd like to leave the compressed data that way and not expand it */
+                                {
+                                    int32 aid, len;
+                                    VOIDP *buf;
+
+                                    /* Read in old compressed data description */
+                                    if((aid=Hstartaccess(infile,dlist[i].tag,dlist[i].ref,DFACC_READ))==FAIL)
+                                        continue;
+                                    HQuerylength(aid,&len);
+                                    buf=HDmalloc(len);
+                                    Hread(aid,len,buf);
+                                    Hendaccess(aid);
+
+                                    /* Write compressed data description into new file */
+                                    if((aid=Hstartaccess(outfile,dlist[i].tag,dlist[i].ref,DFACC_WRITE))==FAIL)
+                                        continue;
+                                    Hwrite(aid,len,buf);
+                                    Hendaccess(aid);
+                                    HDfree(buf);
+                                }
+                                break;
+                            default:
+                                merge_blocks(&dlist[i], infile, outfile);
+                                break;
+                        }   /* switch (special) */
+                  }
+                else
+                  {
+/*
+   **   otherwise, just make a new DD for same data
+ */
+                      ret = Hdupdd(outfile, dlist[i].tag, dlist[i].ref,
+                                   dlist[i - 1].tag, dlist[i - 1].ref);
+                      if (ret == FAIL)
+                        {
+                            HERROR(DFE_GENAPP);
+                            hdferror();
+                        }
+                  }
+            }
+/*
+   **   save offset of data to check against next DD
+ */
+          oldoff = dlist[i].offset;
+      }
+
+/*
+   **   Rename any matching external elements
+ */
+    if (from_file && to_file)
+      {
+
+      }
+
+/*
+   **   done; close files
+ */
+    Hclose(infile);
+    Hclose(outfile);
+
+    return (0);
+}
+
+/*
+   ** NAME
+   **      promptblocks
+ */
+int
+promptblocks(mydd_t * dd)
+{
+    char        ans[80];
+
+    printf("Would you like to coalesce the following linked-block element:\n");
+    printf("\ttag = %d\n\tref = %d\n(y/n): ", dd->tag, dd->ref);
+    fgets(ans,80,stdin);
+    if ((ans[0] == 'y') || (ans[0] == 'Y'))
+        return (1);
+    else
+        return (0);
+}
+
+/*
+   ** NAME
+   **      copy_blocks -- move a linked-block element; preserve blocking
+ */
+VOID
+copy_blocks(mydd_t * dd, int32 infile, int32 outfile)
+{
+    int32       inaid, ret, rdret, outaid;
+    sp_info_block_t info;
+    CONSTR(FUNC, "copy_blocks");
+
+    inaid = Hstartread(infile, dd->tag, dd->ref);
+    ret = HDget_special_info(inaid, &info);
+    if ((ret != SUCCEED) || (info.key != SPECIAL_LINKED))
+      {
+          HERROR(DFE_GENAPP);
+          hdferror();
+      }
+/*
+   **  copy first block
+ */
+    outaid = Hstartwrite(outfile, BASETAG(dd->tag), dd->ref, info.first_len);
+    if (outaid == FAIL)
+      {
+          HERROR(DFE_GENAPP);
+          hdferror();
+      }
+    rdret = 0;
+    while (rdret < info.first_len)
+      {
+          ret = Hread(inaid,
+           (data_size < info.first_len) ? data_size : info.first_len, data);
+          if (ret == FAIL)
+            {
+                HERROR(DFE_GENAPP);
+                hdferror();
+            }
+          rdret += ret;
+          ret = Hwrite(outaid, ret, data);
+          if (ret == FAIL)
+            {
+                HERROR(DFE_GENAPP);
+                hdferror();
+            }
+      }
+    ret = Hendaccess(outaid);
+/*
+   **  promote to linked-block element
+ */
+    if (nblk > 0)
+        info.nblocks = nblk;
+
+    outaid = HLcreate(outfile, BASETAG(dd->tag), dd->ref, info.block_len, info.nblocks);
+    if (outaid == FAIL)
+      {
+          HERROR(DFE_GENAPP);
+          hdferror();
+      }
+/*
+   **  copy remaining blocks
+ */
+    rdret = data_size;
+    while (rdret == data_size)
+      {
+          rdret = Hread(inaid, data_size, data);
+          if (rdret == FAIL)
+            {
+                HERROR(DFE_GENAPP);
+                hdferror();
+            }
+          if (rdret != 0)
+            {
+                ret = Hwrite(outaid, rdret, data);
+                if (ret == FAIL)
+                  {
+                      HERROR(DFE_GENAPP);
+                      hdferror();
+                  }
+            }
+      }
+    Hendaccess(outaid);
+}
+
+/*
+   ** NAME
+   **      merge_blocks
+ */
+VOID
+merge_blocks(mydd_t * dd, int32 infile, int32 outfile)
+{
+    int32       inaid, outaid, ret, len;
+    CONSTR(FUNC, "merge_blocks");
+
+    inaid = Hstartread(infile, dd->tag, dd->ref);
+    if (inaid == FAIL)
+      {
+          HERROR(DFE_GENAPP);
+          hdferror();
+      }
+
+    outaid = Hstartaccess(outfile,BASETAG(dd->tag),dd->ref,DFACC_WRITE);
+    if (outaid == FAIL)
+      {
+          HERROR(DFE_GENAPP);
+          hdferror();
+      }
+
+    while (dd->length > 0)
+      {
+          dd->length -= (len = Hread(inaid, data_size, data));
+          if (len == FAIL)
+            {
+                HERROR(DFE_GENAPP);
+                hdferror();
+            }
+          ret = Hwrite(outaid, len, data);
+          if (ret == FAIL)
+            {
+                HERROR(DFE_GENAPP);
+                hdferror();
+            }
+      }
+
+    ret = Hendaccess(inaid);
+    if (ret == FAIL)
+      {
+          HERROR(DFE_GENAPP);
+          hdferror();
+      }
+
+    ret = Hendaccess(outaid);
+    if (ret == FAIL)
+      {
+          HERROR(DFE_GENAPP);
+          hdferror();
+      }
+}
+
+/*
+   ** NAME
+   **   usage -- print out usage template
+   ** USAGE
+   **   int usage()
+   ** RETURNS
+   **   none
+   ** DESCRIPTION
+   **   Print hdfpack's usage template to stdout.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+ */
+static      VOID
+usage(char *name)
+{
+    fprintf(stderr, "Usage:  %s [-i | -b] [-d#] [-t#] [-x] [-r <from> <to>] <infile> <outfile>\n", name);
+    fprintf(stderr, "\t-t# : reset the linked block sizing\n");
+    fprintf(stderr, "\t-d# : reset the number of DDs per DD block\n");
+    fprintf(stderr, "\t-i  : interactively merge linked blocks\n");
+    fprintf(stderr, "\t-b  : maintain linked blocking sizes\n");
+    fprintf(stderr, "\t-x  : keep external elements external\n");
+    fprintf(stderr, "\t-r <from> <to> :\n");
+    fprintf(stderr, "\t      change external element names matching <from> to <to>\n");
+}
+
+/*
+   ** NAME
+   **   hdferror -- print out HDF error number
+   ** USAGE
+   **   int hdferror()
+   ** RETURNS
+   **   none
+   ** DESCRIPTION
+   **   Print an HDF error number to stderr.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   This routine terminates the program with code 1.
+   ** EXAMPLES
+ */
+static      VOID
+hdferror(void)
+{
+    HEprint(stderr, 0);
+    exit(1);
+}
+
+/*
+   ** NAME
+   **      error -- print error to stderr
+   ** USAGE
+   **      int error(string);
+   **      char *string;           IN: pointer to error description string
+   ** RETURNS
+   **   none
+   ** DESCRIPTION
+   **   Print an HDF error number to stderr.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   This routine terminates the program with code 1.
+   ** EXAMPLES
+ */
+static      VOID
+error(const char *string)
+{
+    fprintf(stderr, "%s: %s\n", invoke, string);
+    exit(1);
+}
+
+/*
+   ** NAME
+   **   desc_comp -- compare two DD's by offset
+   ** USAGE
+   **   int desc_cmp(d1, d2)
+   **   mydd_t *d1              IN: pointer to a DD
+   **   mydd_t *d2              IN: pointer to a DD
+   ** RETURNS
+   **   A number less than, greater than, or equal to 0, according to
+   **   whether d1's offset is less than, greater than, or equal to
+   **   d2's offset.
+   ** DESCRIPTION
+   **   A pointer to this routine is passed to qsort() as the comparison
+   **   function for the sort.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   ** EXAMPLES
+ */
+int
+desc_comp(const void *d1, const void *d2)
+{
+    return ((int) (((const mydd_t *) d1)->offset - ((const mydd_t *) d2)->offset));
+}
diff --git a/hdf/util/hdfpack.out1 b/hdf/util/hdfpack.out1
new file mode 100644
index 0000000..32515f2
--- /dev/null
+++ b/hdf/util/hdfpack.out1
@@ -0,0 +1,40 @@
+test.hdf:
+
+Linked Blocks Indicator       : (tag 20)
+	Ref nos: 59 60 61 113 114 115 116 117 118 119 120
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 133 141 150 158 167
+SciData dimension record      : (tag 701)
+	Ref nos: 133 141 150 158 167
+Scientific Data               : (tag 702)
+	Ref nos: 58
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 4 5 6
+Vdata                         : (tag 1962)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vdata Storage                 : (tag 1963)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vgroup                        : (tag 1965)
+	Ref nos: 122 124 126 134 142 151 159 168 171
+Special Scientific Data       : (tag 17086)
+	Ref nos: 59 113 116 119
+test.pck:
+
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 133 141 150 158 167
+SciData dimension record      : (tag 701)
+	Ref nos: 133 141 150 158 167
+Scientific Data               : (tag 702)
+	Ref nos: 58 59 113 116 119
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 4 5 6
+Vdata                         : (tag 1962)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vdata Storage                 : (tag 1963)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vgroup                        : (tag 1965)
+	Ref nos: 122 124 126 134 142 151 159 168 171
diff --git a/hdf/util/hdfpack.out1.1 b/hdf/util/hdfpack.out1.1
new file mode 100644
index 0000000..bfa0678
--- /dev/null
+++ b/hdf/util/hdfpack.out1.1
@@ -0,0 +1,22 @@
+test.hdf:
+
+Linked Blocks Indicator       : (tag 20)
+	Ref nos: 59 60 61 113 114 115 116 117 118 119 120
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 133 141 150 158 167
+SciData dimension record      : (tag 701)
+	Ref nos: 133 141 150 158 167
+Scientific Data               : (tag 702)
+	Ref nos: 58
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 4 5 6
+Vdata                         : (tag 1962)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vdata Storage                 : (tag 1963)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vgroup                        : (tag 1965)
+	Ref nos: 122 124 126 134 142 151 159 168 171
+Special Scientific Data       : (tag 17086)
+	Ref nos: 59 113 116 119
diff --git a/hdf/util/hdfpack.out1.2 b/hdf/util/hdfpack.out1.2
new file mode 100644
index 0000000..79203ce
--- /dev/null
+++ b/hdf/util/hdfpack.out1.2
@@ -0,0 +1,18 @@
+test.pck:
+
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 133 141 150 158 167
+SciData dimension record      : (tag 701)
+	Ref nos: 133 141 150 158 167
+Scientific Data               : (tag 702)
+	Ref nos: 58 59 113 116 119
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 4 5 6
+Vdata                         : (tag 1962)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vdata Storage                 : (tag 1963)
+	Ref nos: 121 123 125 127 128 129 130 131 132 135 136 137 138 139 140 143 144 145 146 147 148 149 152 153 154 155 156 157 160 161 162 163 164 165 166 169 170
+Vgroup                        : (tag 1965)
+	Ref nos: 122 124 126 134 142 151 159 168 171
diff --git a/hdf/util/hdfrseq.c b/hdf/util/hdfrseq.c
new file mode 100644
index 0000000..1685ea3
--- /dev/null
+++ b/hdf/util/hdfrseq.c
@@ -0,0 +1,706 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdfrseq.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*    hdfrseq
+   *  Sequencer for NCSA Hierarchical Data Format files
+   *
+   *  Display images on a remote ICR terminal
+   *  in sequence, suitable for onscreen animation.  Can expand the image size
+   *  on the fly.
+   *
+   *  This version now supports displaying an image in a window on a Silicon
+   *  Graphics Iris 4D workstation.  There are bugs in this code (possibly due
+   *  to evolving system software combined with old code).
+   *
+   *  National Center for Supercomputing Applications
+   *  University of Illinois, Urbana-Champaign
+   *
+   *  by Tim Krauskopf
+   *  first version of seq 7/11/86
+   *  modifications        2/20/87
+   *  re-write             6/21/88
+   *  Iris 4D support      6/24/89  Mike Krogh
+   *  Line padding              9/25/89  Chin-Chau Low
+   *  In-between versions re-written by Gaige B. Paulsen and Swami Natarajan
+   *  ANSI-fication & relegation to remote-only use
+   *                    6/9/92   Doug Ilg
+   *
+   *  This program is in the public domain
+   *
+ */
+#include "hdf.h"    /* HDF includes */
+
+#ifdef IRIS4
+#include <gl.h>
+#include <device.h>
+#endif
+
+#ifndef IRIS4
+#define  SCRX    1152
+#define  SCRY    900
+#endif
+
+#ifdef IRIS4
+#define  SCRX    1280
+#define  SCRY    1024
+#endif
+
+#define  LUSAGE   printf("\nUsage: %s [-s] [-l] [-e exp] [-p xwhere ywhere] file1 file2 . . .\n",argv[0])
+#define  RUSAGE   printf("\nUsage: %s [-s] [-l] [-e exp] file1 file2 . . .\n",argv[0])
+#define USAGE   if (remote) { RUSAGE; } else { LUSAGE; }
+
+int
+            oldcf = 0,          /* old value of compression flag */
+            oldx = 0, oldy = 0, /* old values of xdim and ydim */
+            coldx = 0, coldy = 0,   /* old values of xdim and ydim for CI8s */
+            xwhere = 0, ywhere = 0,     /* where to put it on the screen */
+            step = 0,           /* single step? */
+            remote = 0,         /* should use ICR for remote display */
+            large = 0,          /* should make images as large as possible */
+            center = 1,         /* should center the images */
+            startpic = 1,       /* for parameter counts */
+            oldxs = 0, oldys = 0,   /* old sizes */
+            xsize = 0, ysize = 0,   /* what final size on screen, after blow-up */
+            xfact = 1, yfact = 1;   /* what factor for blowing up the picture */
+
+int32       xdim = 0, ydim = 0; /* size of image on disk */
+
+#ifdef NEEDPAD
+int         xpad;
+#endif
+
+#ifdef IRIS4
+int         GID;
+unsigned short *img = NULL;
+int         WINDOW_OPEN = 0;
+int16       idev, qvalue;
+int         attached = 1;
+#endif
+
+char
+            rgb[768],           /* storage for a palette */
+           *wherebig = NULL,    /* where to store small image */
+           *wheresmall = NULL;  /* where to store image-related stuff */
+
+int         main(int, char *a[]);
+int         getspace(void);
+int         getpix(void);
+int         largeset(void);
+int         showpic(char *);
+int         piximage(int);
+int         rimage(int);
+int         bigimg(unsigned char *, unsigned char *);
+int         rleit(char *, char *, int);
+
+/*************************************************************************/
+/*  hdfseq
+   *   Load the images from the specified files.
+   *   Create the internal storage if needed.
+   *
+   *   Search pattern for files:
+   *       RIG images in file
+   *       RI8 and CI8 images in file
+ */
+int
+main(int argc, char *argv[])
+{
+    int         i, filearg;
+
+/*
+   *  Check to see if we are displaying on a local console or on a
+   *  remote ICR.  This program does double duty.
+ */
+    i = HDstrlen(argv[0]);
+    if (HDstrncmp("hdfseq", argv[0] + i - 6, 6))
+        remote = 1;
+
+/*
+   *  Are there enough parameters?  Give user information on calling.
+ */
+    if (argc < 2)
+      {
+          printf("%s,  version: 1.0   date: December 1, 1988\n", argv[0]);
+          if (remote)
+            {
+                printf(" This utility displays sequences of raster-8 images\n");
+                printf(" from HDF files on a remote device using NCSA's\n");
+                printf(" Interactive Color Raster protocol.\n\n");
+            }
+          if (!remote)
+            {
+#ifdef SUN
+                printf(" This utility displays sequences of raster-8 images\n");
+                printf(" from HDF files on the Sun console running Sunview.\n");
+#endif
+#ifdef IRIS4
+                printf(" This utility displays sequences of raster-8 images\n");
+                printf(" from HDF files on the Iris console running 4Sight.\n");
+#endif
+                printf("\n");
+            }
+          USAGE;
+          puts(" -l              make image as large as possible");
+          puts(" -e expansion    expand image by a certain factor");
+          if (!remote)
+              puts(" -p xloc yloc    position on screen");
+          puts(" -s              step through images");
+          exit(1);
+      }
+
+/*
+   *  work on parms
+ */
+    for (i = 1; i < argc; i++)
+      {     /* look at each parm */
+          if (*argv[i] == '-')
+              switch (*(argv[i] + 1))
+                {
+                    case 'p':   /* special position on screen */
+                        center = 0;     /* don't center */
+                        xwhere = atoi(argv[++i]);
+                        ywhere = atoi(argv[++i]);
+                        if (xwhere > SCRX || ywhere > SCRY)
+                          {
+                              puts("\n Invalid position ");
+                              USAGE;
+                              exit(1);
+                          }
+                        startpic += 3;
+                        break;
+                    case 'e':
+                        xfact = yfact = atoi(argv[++i]);
+                        if (xfact < 1)
+                          {
+                              xfact = 1;
+                              yfact = 1;
+                          }
+                        startpic += 2;
+                        break;
+                    case 'l':   /* large pic */
+                        large = 1;
+                        startpic++;
+                        break;
+                    case 's':   /* step through pics */
+                        step = 1;
+                        startpic++;
+                        break;
+                    default:
+                        USAGE;
+                        exit(1);
+                }
+      }
+
+/*
+   *  Process each of the files in the command string.
+   *
+ */
+    for (filearg = startpic; filearg < argc; filearg++)
+        showpic(argv[filearg]);
+
+#ifdef IRIS4
+    if ((!remote) && (img))     /* make sure we have an image */
+        while (1)
+          {
+              idev = qread(&qvalue);
+              if (idev == REDRAW)
+                {
+                    reshapeviewport();
+                    if (img != NULL)
+                      {
+                          rectwrite(0, 0, (xdim - 1), (ydim - 1), img);
+                          swapbuffers();
+                      }
+                }
+          }
+#endif
+
+    exit(0);
+}
+
+/*************************************************************************/
+/*  getspace
+   *  Provide enough space in the space pointers for the operations
+   *  to all work.
+ */
+int
+getspace(void)
+{
+
+/*
+   *  Don't allocate anything if the image is the same size as before.
+ */
+    if (oldx != xdim || oldy != ydim)
+      {
+          oldx = xdim;
+          oldy = ydim;
+
+          if (wheresmall)
+              HDfree(wheresmall);
+
+          if (NULL == (wheresmall = (char *) HDmalloc(xdim * ydim)))
+            {
+                puts(" Cannot allocate memory, fatal error");
+                exit(1);
+            }
+
+      }
+    return (0);
+}
+
+#ifdef IRIS4
+/*
+   *  Allocate the space for the image if displaying locally
+ */
+getpix(void)
+{
+/*
+   *  Allocation will take place because xsize and ysize will
+   *  be set before calling this routine.
+   *
+ */
+    if (!remote && (oldxs != xsize || oldys != ysize))
+      {
+          oldxs = xsize;
+          oldys = ysize;
+          if (img)
+              HDfree(img);
+          if ((img = (unsigned short *) HDmalloc(xdim * ydim * sizeof(short))) == NULL)
+            {
+                puts(" Cannot allocate memory, fatal error");
+                exit(1);
+            }
+
+      }
+    return (0);
+}
+#endif
+
+/*************************************************************************/
+/*  largeset
+   *  Set up the xfact, yfact, xsize and ysize for expanding the image
+   *  locally.
+   *
+ */
+int
+largeset(void)
+{
+
+    if (large)
+      {
+          xfact = SCRX / xdim;  /* how much blow-up can we do? */
+          yfact = SCRY / ydim;  /* calculate expansion factor  */
+          if (xfact > yfact)
+              xfact = yfact;
+          else
+              yfact = xfact;
+      }
+
+    xsize = xfact * xdim;   /* re-calculate actual pixel dimensions */
+    ysize = yfact * ydim;
+
+#ifdef NEEDPAD  /* add padding for byte boundary */
+    xpad = BYTEBOUND - xsize % BYTEBOUND;
+    if (xpad == BYTEBOUND)
+        xpad = 0;
+    else
+        xsize += xpad;
+#ifdef DEBUG
+    printf("xpad %d\n", xpad);
+#endif /*DEBUG */
+    return (xfact > 1 || yfact > 1 || xpad > 0);    /* is expansion necessary? */
+#endif /*NEEDPAD */
+
+#ifndef NEEDPAD     /* make sure there is only 1 return stmt */
+    return (xfact > 1 || yfact > 1);    /* is expansion necessary? */
+#endif /*NEEDPAD */
+}
+
+/*************************************************************************/
+/*  showpic
+   *  For each file, search for the components that we can display.
+   *  Display them according to the remote flag on or off.
+   *
+ */
+int
+showpic(char *filename)
+{
+    int         ispal, r8_exists;
+
+    oldx = xdim;
+    oldy = ydim;    /* save old values */
+
+    if (-1 == Hishdf(filename))
+      {
+          printf("\'%s\' is not an HDF Format Data File.\n", filename);
+          return (0);
+      }
+/*
+   *  Search for all RIGs in this file.
+   *  Process each RIG and display.
+ */
+    r8_exists = FALSE;
+    while (1)
+      {
+          if (DFR8getdims(filename, &xdim, &ydim, &ispal) < 0)
+            {
+                if (!r8_exists)
+                    printf("There are no 8-bit images in the file %s\n", filename);
+                break;  /* all RIGs processed */
+            }
+          r8_exists = TRUE;     /* at least one 8-bit image found */
+
+#ifdef DEBUG
+          printf("xdim %d ydim %d\n", xdim, ydim);
+#endif /*DEBUG */
+#ifdef IRIS4
+          if (!remote)
+            {
+                largeset();     /* set expansion needs */
+                getspace();     /* get local space for pre-expansion */
+                getpix();   /* allocate memory */
+            }
+#endif
+
+          if (remote)
+              getspace();   /* get space for image in mem */
+
+/*
+   *  Try to successfully load the palette and image from the file
+ */
+          if (!DFR8getimage(filename, (uint8 *) wheresmall, xdim, ydim, (uint8 *) rgb))
+            {
+                if (remote)
+                    rimage(ispal);  /* display remote image with [palette] */
+#ifdef IRIS4
+                else
+                    piximage(ispal);    /* display image on Iris with [palette] */
+#endif
+            }
+          else
+              puts(" Error loading image");
+
+      }
+
+    return (0);
+
+}
+
+#ifdef IRIS4
+/***********************************************************************/
+/*  piximage
+   *  On the Iris console, display the image as the parameters specify.
+   *  Handles centering (center)
+   *  Uses xwhere and ywhere, xsize and ysize.
+   *  Performs expansion if xfact or yfact > 1
+   *  Takes the palette from the rgb[] if asked to.
+   *  Will pause if step=1.
+ */
+piximage(int usepal)
+{
+    char       *pp;
+    int         r, g, b;
+    int         j, j1, j2, k;
+
+/*
+   *  compute centering values, based on new size
+ */
+    if (center)
+      {
+          xwhere = (SCRX - xsize) / 2;
+          ywhere = (SCRY - ysize) / 2;
+          if (xwhere < 0)
+              xwhere = 0;
+          if (ywhere < 0)
+              ywhere = 0;
+      }
+
+    if (!WINDOW_OPEN)
+      {
+          WINDOW_OPEN = 1;
+          if (step)
+            {
+                printf("Press <enter> to step through images or");
+                printf(" 'Q' to quit.\n");
+            }
+          prefposition(xwhere, (xwhere + xsize), ywhere, (ywhere + ysize));
+          GID = winopen("hdfseq");  /* open the window */
+          shademodel(FLAT);     /* don't worry about shading */
+          doublebuffer();
+          multimap();
+          gconfig();
+          setmap(4);
+          color(BLACK);
+          clear();
+          qdevice(REDRAW);
+          if (step)
+            {
+                qdevice(QKEY);
+                qdevice(RETKEY);
+                qdevice(INPUTCHANGE);
+            }
+      }
+
+/*
+   * Process window movement events.
+ */
+    while (qtest())
+      {
+          idev = qread(&qvalue);
+          if (idev == REDRAW)
+            {
+                reshapeviewport();
+                if (img != NULL)
+                  {
+                      rectwrite(0, 0, (xdim - 1), (ydim - 1), img);
+                      swapbuffers();
+                  }
+            }
+          if (idev == INPUTCHANGE)
+              attached = qvalue;
+      }
+
+/*
+   *  Do the image expansion, if called for.
+ */
+    if (xfact > 1 || yfact > 1)
+        rectzoom((float32) xfact, (float) yfact);   /* let the iris scale it */
+
+/*
+   *  Set the display palette to the new palette.
+ */
+
+    if (usepal)
+      {
+          pp = rgb;
+          for (j = 0; j < 256; j++)
+            {
+                r = (int) (*pp++);
+                g = (int) (*pp++);
+                b = (int) (*pp++);
+                mapcolor(j, r, g, b);   /* change the system palette */
+            }
+      }
+
+/*
+   * Convert image data to iris pixel format
+   * flip it upside down and convert to short integers.
+ */
+
+    for (j = 0; j < ydim; j++)
+      {
+          j1 = (ydim - j - 1) * xdim;
+          j2 = j * xdim;
+          for (k = 0; k < xdim; k++)
+              *(img + j1 + k) = (short) (*(wheresmall + j2 + k));
+      }
+
+    rectwrite(0, 0, (xdim - 1), (ydim - 1), img);
+    swapbuffers();
+
+    if (step)
+      {
+          while (1)
+            {
+                idev = qread(&qvalue);
+                if (idev == REDRAW)
+                  {
+                      reshapeviewport();
+                      if (img != NULL)
+                        {
+                            rectwrite(0, 0, (xdim - 1), (ydim - 1), img);
+                            swapbuffers();
+                        }
+                  }
+                if (idev == QKEY)
+                    exit(0);
+                if (idev == RETKEY)
+                    break;
+                if (idev == INPUTCHANGE)
+                    attached = qvalue;
+            }
+      }
+
+}
+#endif
+
+/*****************************************************************************/
+/*  rimage
+   *  Remote display of the image using the ICR.
+   *  Just print the codes to stdout using the protocol.
+ */
+int
+rimage(int usepal)
+{
+    int         i, j, newxsize;
+    char       *space, *thisline, *thischar;
+    unsigned char c;
+
+/*
+   *  Open the window with the W command
+ */
+
+    (void) printf("\033^W;%d;%d;%ld;%ld;0;rseq^", xwhere, ywhere, (long) (xdim * xfact), (long) (ydim * yfact));
+
+/*
+   *  If a palette should be used, send it with the M command.
+ */
+    if (usepal)
+      {
+          (void) printf("\033^M;0;256;768;rseq^");  /* start map */
+
+          thischar = rgb;
+          for (j = 0; j < 768; j++)
+            {
+                c = *thischar++;
+                if (c > 31 && c < 123)
+                  {
+                      putchar(c);
+                  }
+                else
+                  {
+                      putchar((c >> 6) + 123);
+                      putchar((c & 0x3f) + 32);
+                  }
+            }
+      }
+
+/*
+   *  Send the data for the image with RLE encoding for efficiency.
+   *  Encode each line and send it.
+ */
+    space = (char *) HDmalloc(ydim + 100);
+    thisline = wheresmall;
+
+    for (i = 0; i < ydim; i++)
+      {
+          newxsize = rleit(thisline, space, xdim);
+          thisline += xdim;     /* increment to next line */
+
+          (void) printf("\033^R;0;%d;%d;%d;rseq^", i * xfact, xfact, newxsize);
+
+          thischar = space;
+          for (j = 0; j < newxsize; j++)
+            {
+
+/***********************************************************************/
+/*  Encoding of bytes:
+   *
+   *  123 precedes #'s 0-63
+   *  124 precedes #'s 64-127
+   *  125 precedes #'s 128-191
+   *  126 precedes #'s 192-255
+   *  overall:  realchar = (specialchar - 123)*64 + (char-32)
+   *            specialchar = r div 64 + 123
+   *            char = r mod 64 + 32
+ */
+/***********************************************************************/
+
+                c = *thischar++;    /* get byte to send */
+
+                if (c > 31 && c < 123)
+                  {
+                      putchar(c);
+                  }
+                else
+                  {
+                      putchar((c >> 6) + 123);
+                      putchar((c & 0x3f) + 32);
+                  }
+            }
+      }
+
+/*
+   *  pause for the user
+ */
+    if (step)
+      {
+          printf("Press return to continue, 'q' return to quit");
+          if ('q' == getchar())
+              exit(0);
+      }
+
+    HDfree(space);
+    return (0);
+}
+
+/********************************************************************/
+/*  rleit
+   *  compress the data to go out with a simple run-length encoded scheme.
+   *
+ */
+int
+rleit(char *buf, char *bufto, int len)
+{
+    char *p, *q, *cfoll, *clead;
+    char       *begp;
+    int         i;
+
+    p = buf;
+    cfoll = bufto;  /* place to copy to */
+    clead = cfoll + 1;
+
+    begp = p;
+    while (len > 0)
+      {     /* encode stuff until gone */
+
+          q = p + 1;
+          i = len - 1;
+          while (*p == *q && i + 120 > len && i)
+            {
+                q++;
+                i--;
+            }
+
+          if (q > p + 2)
+            {   /* three in a row */
+                if (p > begp)
+                  {
+                      *cfoll = p - begp;
+                      cfoll = clead;
+                  }
+                *cfoll++ = 128 | (q - p);   /* len of seq */
+                *cfoll++ = *p;  /* char of seq */
+                len -= q - p;   /* subtract len of seq */
+                p = q;
+                clead = cfoll + 1;
+                begp = p;
+            }
+          else
+            {
+                *clead++ = *p++;    /* copy one char */
+                len--;
+                if (p > begp + 120)
+                  {
+                      *cfoll = p - begp;
+                      cfoll = clead++;
+                      begp = p;
+                  }
+            }
+
+      }
+/*
+   *  fill in last bytecount
+ */
+    if (p > begp)
+        *cfoll = (p - begp);
+    else
+        clead--;    /* don't need count position */
+
+    return ((int) (clead - bufto));     /* how many stored as encoded */
+}
diff --git a/hdf/util/hdftopal.c b/hdf/util/hdftopal.c
new file mode 100644
index 0000000..9115103
--- /dev/null
+++ b/hdf/util/hdftopal.c
@@ -0,0 +1,96 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdftopal.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*
+   *  hdftopal.c
+   *       Version: 1.0   date: August 1, 1989
+   *       This utility converts a palette from an HDF file
+   *       to a raw palette in a raw palette file.
+   *       The outgoing palette will have 768 bytes: First
+   *       256 red values, then 256 greens, then 256 blues.
+   *
+   *  by Mike Folk
+   *  first version of hdftopal:   8/01/89
+   *
+   *  This program is in the public domain
+   *
+ */
+#include "hdf.h"
+
+int         main(int argc, char *argv[]);
+int         rawpalconv(char *hdffile, char *rawpalfile);
+
+int
+main(int argc, char *argv[])
+{
+    if (argc != 3)
+      {
+          printf("Usage:\n");
+          printf("   %s hdffile rawpalfile \n\n", argv[0]);
+          printf("%s,  version: 1.1   date: July 1, 1992\n\n", argv[0]);
+          printf("   This utility converts a palette from an HDF file \n");
+          printf("   to a raw palette in a raw palette file.\n\n");
+          printf("   The outgoing palette will have 768 bytes: First \n");
+          printf("   256 red values, then 256 greens, then 256 blues.\n\n");
+          exit(1);
+      }
+
+    rawpalconv(argv[1], argv[2]);
+    return (0);
+}
+
+/*
+ *      rawpalconv(palfile, outfile) sets the palette
+ */
+
+int
+rawpalconv(char *hdffile, char *rawpalfile)
+{
+    uint8       palspace[1024], reds[256], greens[256], blues[256], *p;
+    FILE       *fp;
+    int         j, ret;
+
+    ret = DFPgetpal(hdffile, (char *) palspace);
+    if (ret < 0)
+      {
+          printf("Error in reading file %s\n", hdffile);
+          exit(1);
+      }
+
+    p = palspace;
+    for (j = 0; j < 256; j++)
+      {
+          reds[j] = *p++;
+          greens[j] = *p++;
+          blues[j] = *p++;
+      }
+
+    fp = fopen(rawpalfile, "wb");
+    if (fp == NULL)
+      {
+          printf("Error opening raw palette file %s\n", rawpalfile);
+          exit(1);
+      }
+
+    fwrite(reds, 1, 256, fp);
+    fwrite(greens, 1, 256, fp);
+    fwrite(blues, 1, 256, fp);
+    fclose(fp);
+    return (0);
+}
diff --git a/hdf/util/hdftor8.c b/hdf/util/hdftor8.c
new file mode 100644
index 0000000..3855a91
--- /dev/null
+++ b/hdf/util/hdftor8.c
@@ -0,0 +1,397 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdftor8.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*
+ * hdftor8.c
+ * Extract images from HDF file to raster files
+ */
+
+#include "hdf.h"
+
+#define PALETTE_SIZE    768     /* size of palette array */
+#define COLOR_SIZE  256     /* size of palette color array */
+                /* COLOR_SIZE == PALETTE_SIZE / 3 */
+
+#define INTERACTIVE 'i'     /* interactive option */
+#define RASTER_FILE 'r'     /* raster filename template */
+#define PALETTE_FILE    'p'     /* palette filename template */
+#define VERBOSE     'v'     /* verbose option */
+
+#define TEMPLATE_NUMBER '#'     /* image or palette number positions */
+#define TEMPLATE_XDIM   '@'     /* image x dim positions */
+#define TEMPLATE_YDIM   '%'     /* image y dim positions */
+
+const char  D_RASTER_TEM[] = "img#- at .%";    /* default raster file name template */
+const char  D_PALETTE_TEM[] = "pal#";   /*  default palette file name template */
+
+int         interactive;        /* interactive option */
+int         verbose;            /* verbose option */
+
+int         main
+            (int argc, char *argv[]);
+void        putRaster
+            (const char *template, int32 xdim, int32 ydim, int imageNumber, uint8 *image);
+void        putPalette
+            (const char *template, int imageNumber, uint8 *palette);
+void        convert
+            (const char *template, int imageNumber, int32 xdim, int32 ydim, char *stringOut);
+void        fillStr
+            (const char **template, char **stringOut, char *string, char specialChar);
+char       *newSpace
+            (int32 size);
+const char       *getTemplate
+            (const char *type, int imageNumber);
+
+int
+main(int argc, char *argv[])
+{
+    int         i, imageNumber, ispal, err_val;
+    int32       xdim, ydim;
+    char       *hdfFile;
+    uint8      *image, palette[PALETTE_SIZE];
+    const char *rasterTemplate = NULL, *paletteTemplate = NULL;
+
+    if (argc < 2)
+      {
+          printf("%s,  version: 1.1   date: July 1, 1992\n", argv[0]);
+          printf("\tThis utility extracts all raster-8 images and/or\n");
+          printf("\tpalettes from an HDF file and stores them in two sets of\n");
+          printf("\tfiles containing only images and palettes, respectively.\n");
+          printf("Usage:\n");
+          printf("hdftor8 hdf_file [-i] [-v] [-r image_file] [-p pal_file]\n");
+          printf("\t-i: interactive (specify filenames interactively)\n");
+          printf("\t-v: verbose (provide descriptive messages)\n");
+          printf("\tImages and palettes are placed in the specified files\n");
+          printf("\tThe names of these files may contain special characters\n");
+          printf("\t\twhich will be replaced by numbers:\n");
+          printf("\t #    replace with image or palette number\n");
+          printf("\t @    replace with x dim of image\n");
+          printf("\t %%    replace with y dim of image\n");
+          printf("\tIf not specified, image filename defaults to img#- at .%%\n");
+          printf("\tIf not specified, palette filename defaults to pal.#\n\n");
+          exit(1);
+      }
+
+    hdfFile = argv[1];
+
+    for (i = 2; i < argc; i++)
+      {
+          if (*argv[i] == '-')
+            {
+                switch (argv[i][1])
+                  {
+                      case INTERACTIVE:
+                          interactive = TRUE;
+                          break;
+                      case RASTER_FILE:
+                          rasterTemplate = argv[++i];
+                          break;
+                      case PALETTE_FILE:
+                          paletteTemplate = argv[++i];
+                          break;
+                      case VERBOSE:
+                          verbose = TRUE;
+                          break;
+                      default:
+                          printf("Illegal option: %s, skipping...\n", argv[i]);
+                          break;
+                  }
+            }
+          else
+              printf("Illegal option: %s, skipping...\n", argv[i]);
+      }
+
+    if (!rasterTemplate && !interactive)
+        rasterTemplate = D_RASTER_TEM;
+    if (!paletteTemplate && !interactive)
+        paletteTemplate = D_PALETTE_TEM;
+
+    for (imageNumber = 1; !DFR8getdims(hdfFile, &xdim, &ydim, &ispal);)
+      {
+          image = (uint8 *) newSpace(xdim * ydim);
+          if (verbose)
+            {
+                if (ispal)
+                    printf("Getting image and palette %d.\n", imageNumber);
+                else
+                    printf("Getting image %d.\n", imageNumber);
+                printf("Image dimensions : %d * %d\n", (int)xdim, (int)ydim);
+            }
+          if (!DFR8getimage(hdfFile, image, xdim, ydim, palette))
+            {
+                putRaster(rasterTemplate, xdim, ydim, imageNumber, image);
+                if (ispal)
+                    putPalette(paletteTemplate, imageNumber, palette);
+                imageNumber++;
+            }
+          else
+              break;
+      }
+
+    err_val = (int)HEvalue(1);
+    if ((err_val != DFE_NOMATCH) && (err_val != DFE_NONE))
+      {
+          if (verbose)
+              HEprint(stderr, 0);
+          exit(1);
+      }
+    return (0);
+}
+
+/*
+ * putRaster
+ *
+ * Write the image to a raster image file.
+ *
+ * INPUT:
+ *        template : pointer to template string
+ *        xdim : x dimension of image
+ *        ydim : y dimension of image
+ *        imageNumber : (need I say more?)
+ *        image : pointer to image array
+ */
+void
+putRaster(const char *template, int32 xdim, int32 ydim, int imageNumber,
+          uint8 *image)
+{
+    FILE       *fd;
+    char        fileName[DF_MAXFNLEN];
+
+    if (!template)  /* can assume interactive (see main) */
+        template = getTemplate("image", imageNumber);
+
+    convert(template, imageNumber, xdim, ydim, fileName);
+
+    if (verbose)
+        printf("Writing into image file : %s\n", fileName);
+
+    if ((fd = fopen(fileName, "wb")) == NULL)
+      {
+          puts("Unable to open file. Exiting...");
+          exit(1);
+      }
+    if (fwrite(image, (size_t) xdim, (size_t) ydim, fd) != (unsigned) ydim)
+      {
+          puts("Unable to write to file. Exiting...");
+          exit(1);
+      }
+    if (fclose(fd))
+      {
+          puts("Unable to close file. Exiting...");
+          exit(1);
+      }
+}
+
+/*
+ * putPalette
+ *
+ * Write palette array out to palette file.
+ *
+ * INPUT:
+ *        template : palette filename template
+ *        imageNumber : Yes, the number of the image
+ *        palette : pointer to the palette array
+ */
+void
+putPalette(const char *template, int imageNumber, uint8 *palette)
+{
+    int         i;
+    FILE       *fd;
+    char        fileName[DF_MAXFNLEN], reds[COLOR_SIZE];
+    char        greens[COLOR_SIZE], blues[COLOR_SIZE];
+
+    if (!template)  /* can assume interactive (see main) */
+        template = getTemplate("palette", imageNumber);
+
+    convert(template, imageNumber, (int32) 1, (int32) 768, fileName);
+
+    if (verbose)
+        printf("Writing into palette file : %s\n", fileName);
+
+    if ((fd = fopen(fileName, "wb")) == NULL)
+      {
+          puts("Unable to open file. Exiting...");
+          exit(1);
+      }
+
+    for (i = 0; i < COLOR_SIZE; i++)
+      {
+          reds[i] = *palette++;
+          greens[i] = *palette++;
+          blues[i] = *palette++;
+      }
+    if (fwrite(reds, 1, COLOR_SIZE, fd) != COLOR_SIZE)
+      {
+          printf("Unable to write to file. Exiting...");
+          exit(1);
+      }
+    if (fwrite(greens, 1, COLOR_SIZE, fd) != COLOR_SIZE)
+      {
+          printf("Unable to write to file. Exiting...");
+          exit(1);
+      }
+    if (fwrite(blues, 1, COLOR_SIZE, fd) != COLOR_SIZE)
+      {
+          printf("Unable to write to file. Exiting...");
+          exit(1);
+      }
+    if (fclose(fd))
+      {
+          printf("Unable to close file. Exiting...");
+          exit(1);
+      }
+}
+
+/*
+ * convert
+ *
+ * Determine the file name given the template, imageNumber, x dimension
+ * and y dimension. Replaces template special characters with the
+ * corresponding numbers.
+ *
+ * INPUT:
+ *        template : file name template
+ *        imageNumber :
+ *        xdim : x dimension of image
+ *        ydim : y dimension of image
+ * OUTPUT:
+ *        stringOut : the concocted file name
+ */
+void
+convert(const char *template, int imageNumber, int32 xdim, int32 ydim,
+        char *stringOut)
+{
+    char        numStr[20], xStr[20], yStr[20];
+
+    sprintf(numStr, "%03d", imageNumber);
+    sprintf(xStr, "%03d", (int)xdim);
+    sprintf(yStr, "%03d", (int)ydim);
+
+    for (; (*template);)
+      {
+          switch (*template)
+            {
+                case TEMPLATE_NUMBER:
+                    fillStr(&template, &stringOut, numStr, TEMPLATE_NUMBER);
+                    break;
+                case TEMPLATE_XDIM:
+                    fillStr(&template, &stringOut, xStr, TEMPLATE_XDIM);
+                    break;
+                case TEMPLATE_YDIM:
+                    fillStr(&template, &stringOut, yStr, TEMPLATE_YDIM);
+                    break;
+                default:
+                    *stringOut++ = *template++;
+            }
+      }
+    *stringOut = '\0';
+}
+
+/*
+ * fillStr
+ *
+ * Fill a string of special characters with a number string.
+ * If the number string is shorter than the number of special characters
+ * then the string is padded with '0' on the left. Else the number of the
+ * special characters is ignored.
+ *
+ * INPUT:
+ *        template : pointer to pointer of string template
+ *        string : pointer to the number string
+ *        specialChar : the special character we are replacing
+ * OUTPUT:
+ *        stringOut : pointer to pointer of converted string (not really)
+ * BUG: Both the pointer to the template string and the pointer to the
+ *        comverted string are moved to after the position of the conversion.
+ */
+void
+fillStr(const char **template, char **stringOut, char *string, char specialChar)
+{
+    int         templateLen, stringLen, i;
+
+    for (templateLen = 1; *(++(*template)) == specialChar; templateLen++) ;
+    stringLen = (int)HDstrlen(string);
+
+    for (i = templateLen - stringLen; i > 0; i--)
+        *(*stringOut)++ = '0';
+
+    for (; (*string);)
+        *(*stringOut)++ = *string++;
+}
+
+/*
+ * newSpace
+ *
+ * Allocate a space with little wastage
+ *
+ * INPUT:
+ *        size : size of space request
+ * RETURN:
+ *        pointer to the space allocated
+ *
+ * BUG: This routine can only handle one request at any time,
+ *        a second call cannot be made while the space is still
+ *        in use (somewhere else).
+ */
+char       *
+newSpace(int32 size)
+{
+    static int32 oldSize = 0;   /* must be static */
+    static char *oldSpace = NULL;   /* must be static */
+
+    if (size >= oldSize)
+      {
+          if (oldSpace != NULL)
+              HDfree(oldSpace);
+          if ((oldSpace = (char *) HDmalloc((uint32) size)) == NULL)
+            {
+                puts("Out of memory. Abort.");
+                exit(1);
+            }
+          oldSize = size;
+      }
+
+    return oldSpace;
+}
+
+/*
+ * getTemplate
+ *
+ * Ask the user for a file name template string.
+ *
+ * INPUT:
+ *        type : a description string of the type of file,
+ *                i.e. image or palette.
+ *        imageNumber :
+ * RETURN:
+ *        pointer to template string
+ * BUG: This routine can only handle one request at any time,
+ *        a second call cannot be made while the template is still
+ *        in use (somewhere else).
+ */
+const char       *
+getTemplate(const char *type, int imageNumber)
+{
+    static char template[DF_MAXFNLEN];
+
+    printf("This is %s %d.\nWhat template would you like?\n",
+           type, imageNumber);
+    scanf("%s", template);
+    return template;
+}
diff --git a/hdf/util/hdftor8.out1 b/hdf/util/hdftor8.out1
new file mode 100644
index 0000000..09ba7a9
--- /dev/null
+++ b/hdf/util/hdftor8.out1
@@ -0,0 +1,48 @@
+storm.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+	Ref no      6	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+	Ref no      6	       4 bytes
+
+Image Palette-8               : (tag 201)
+	Ref no      6	     768 bytes
+
+Raster Image-8                : (tag 202)
+	Ref no      2	    3249 bytes
+	Ref no      3	    3249 bytes
+	Ref no      4	    3249 bytes
+	Ref no      5	    3249 bytes
+
+Imcomp Image-8                : (tag 204)
+	Ref no      6	     812 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+	Ref no      6	      20 bytes
+
+Image Palette                 : (tag 301)
+	Ref no      6	     768 bytes
+
+Raster Image Data             : (tag 302)
+	Ref no      2	    3249 bytes
+	Ref no      3	    3249 bytes
+	Ref no      4	    3249 bytes
+	Ref no      5	    3249 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      6	     812 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+	Ref no      3	       8 bytes
+	Ref no      4	       8 bytes
+	Ref no      5	       8 bytes
+	Ref no      6	      12 bytes
+
diff --git a/hdf/util/hdfunpac.c b/hdf/util/hdfunpac.c
new file mode 100644
index 0000000..07a79fc
--- /dev/null
+++ b/hdf/util/hdfunpac.c
@@ -0,0 +1,218 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdfunpac.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*
+   ** FILE
+   **   hdfunpac.c
+   ** USAGE
+   **   hdfunpac [options] <hdffile>
+   ** DESCRIPTION
+   **   This program unpacks an HDF file by exporting the scientific data
+   **   elements (DFTAG_SD) to external object elements.
+   **      Options are:
+   **           -d <datafile> Use <datafile> as the external filename.
+   **              Default is "DataFile".
+ */
+
+#include "hdf.h"
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#define DefaultDatafile "DataFile"
+
+/* Prototypes declaration */
+int         main
+            (int, char *a[]);
+void        hdferror
+            (void);
+void        error
+            (const char *);
+void        usage
+            (void);
+
+/* variables */
+char       *progname;           /* the name this program is invoked, i.e. argv[0] */
+
+int
+main(int argc, char *argv[])
+{
+    int32       infile, aid, ret;
+    char       *filename;
+    char        datafilename[DF_MAXFNLEN];
+
+    uint16      tag;
+    uint16      ref;
+    int32       offset, fileoffset;
+    int32       length;
+    int16       special;
+
+    /* Get invocation name of program */
+    progname = *argv++;
+    argc--;
+
+    /* parse arguments */
+    while (argc > 0 && **argv == '-')
+      {
+          switch ((*argv)[1])
+            {
+                case 'd':
+                    argc--;
+                    argv++;
+                    if (argc > 0)
+                      {
+                          strcpy(datafilename, *argv++);
+                          argc--;
+                      }
+                    else
+                      {
+                          usage();
+                          exit(1);
+                      }
+                    break;
+                default:
+                    usage();
+                    exit(1);
+            }
+      }
+
+    if (argc == 1)
+      {
+          filename = *argv++;
+          argc--;
+      }
+    else
+      {
+          usage();
+          exit(1);
+      }
+
+    if (datafilename[0] == '\0')
+        strcpy(datafilename, DefaultDatafile);
+
+    /* Check to make sure input file is HDF */
+    ret = (int) Hishdf(filename);
+    if (ret == FALSE)
+      {
+          error("given file is not an HDF file\n");
+      }
+
+    /* check if datafile already exists.  If so, set offset to its length. */
+    {
+        struct stat buf;
+        if (stat(datafilename, &buf) == 0)
+          {
+              printf("External file %s already exists.  Using append mode.\n", datafilename);
+              fileoffset = (int32)buf.st_size;
+          }
+        else
+            fileoffset = 0;
+    }
+
+    /* Open HDF file */
+    infile = Hopen(filename, DFACC_RDWR, 0);
+    if (infile == FAIL)
+      {
+          error("Can't open the HDF file\n");
+      }
+
+    /* Process the file */
+    ret = aid = Hstartread(infile, DFTAG_SD, DFREF_WILDCARD);
+    while (ret != FAIL)
+      {
+          /*
+           * Get data about the current one
+           */
+          ret = Hinquire(aid, NULL, &tag, &ref, &length, &offset, NULL, NULL, &special);
+
+          /* check the tag value since external element object are returned the same. */
+          if (tag == DFTAG_SD)
+            {
+                printf("moving Scientific Data (%d,%d) to %s\n", tag, ref, datafilename);
+                ret = HXcreate(infile, tag, ref, datafilename, fileoffset, length);
+                fileoffset += length;
+            }
+
+          /*
+           * Move to the next one
+           */
+          ret = Hnextread(aid, DFTAG_SD, DFREF_WILDCARD, DF_CURRENT);
+      }
+
+    /*
+     * Close the access element
+     */
+    ret = Hendaccess(aid);
+    if (ret == FAIL)
+        hdferror();
+
+    /* done; close files */
+    Hclose(infile);
+    return (0);
+}
+
+/*
+   ** NAME
+   **   hdferror -- print out HDF error number
+   ** USAGE
+   **   int hdferror()
+   ** RETURNS
+   **   none
+   ** DESCRIPTION
+   **   Print an HDF error number to stderr.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   This routine terminates the program with code 1.
+   ** EXAMPLES
+ */
+void
+hdferror(void)
+{
+    HEprint(stderr, 0);
+    exit(1);
+}
+
+/*
+   ** NAME
+   **      error -- print error to stderr
+   ** USAGE
+   **      int error(string);
+   **      char *string;           IN: pointer to error description string
+   ** RETURNS
+   **   none
+   ** DESCRIPTION
+   **   Print an HDF error number to stderr.
+   ** GLOBAL VARIABLES
+   ** COMMENTS, BUGS, ASSUMPTIONS
+   **   This routine terminates the program with code 1.
+   ** EXAMPLES
+ */
+void
+error(const char *string)
+{
+    fprintf(stderr, "%s: %s\n", progname, string);
+    exit(1);
+}
+
+void
+usage(void)
+{
+    fprintf(stderr, "Usage: %s [-d <datafilename>] <hdffile>\n", progname);
+}
diff --git a/hdf/util/he.h b/hdf/util/he.h
new file mode 100644
index 0000000..a24f012
--- /dev/null
+++ b/hdf/util/he.h
@@ -0,0 +1,193 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: he.h 6036 2014-01-20 17:28:01Z acheng $ */
+
+/* he.h -- header file for HDFedit */
+#include "hdf.h"
+#include <ctype.h>
+#include <stdio.h>
+/* #include <sys/wait.h> */
+
+#include <string.h>
+
+/*
+ * the following may not exist on all systems it should define stuff
+ * like fork(), and other system calls
+ */
+#if defined (IBM6000) || defined (SUN)
+#include <unistd.h>
+#endif /* Unix std libs */
+#if defined HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef DEBUG
+#define ASSERT(e) {if(!(e)){fprintf(stderr,"Assertion failed: file %s, line %d\n",__FILE__,__LINE__);exit(1);}}
+#define NOT_REACHED() {fprintf(stderr,"Should not reach: file %s, line %d\n",__FILE__,__LINE__);exit(1);}
+#else
+#define ASSERT(e)   /* empty assertion */
+#define NOT_REACHED()   /* empty */
+#endif /* DEBUG */
+
+#define HE_ARG_SZ 30
+#define HE_DESC_SZ 8192
+#define HE_COLOR_SZ 256
+#define HE_PALETTE_SZ 768
+#define HE_BUF_SZ 1024
+
+/* return status */
+#define HE_OK 0
+#define HE_FAIL -1
+#define YES 1
+#define NO 0
+
+/* options */
+#define HE_AMBIG -2
+#define HE_NOTFOUND -1
+#define HE_ALL 1
+#define HE_BACKUP 2
+#define HE_HELP 3
+#define HE_LONGOUT 4
+#define HE_NOBACKUP 5
+#define HE_REMOTE 6
+#define HE_VERBOSE 7
+#define HE_FILE 8
+#define HE_KEEP 9
+#define HE_POSITION 10
+#define HE_EXPANSION 11
+#define HE_LARGE 12
+#define HE_RDONLY 13
+#define HE_BATCH 14
+#define HE_OFFSET 15
+#define HE_ASCII 16
+#define HE_OCTAL 17
+#define HE_HEX 18
+#define HE_DECIMAL 19
+#define HE_FLOAT 20
+#define HE_DIMS 21
+#define HE_IMAGE 22
+#define HE_PALETTE 23
+#define HE_RASTER 24
+#define HE_RLE 25
+#define HE_IMCOMP 26
+#define HE_DOGROUP 27
+#define HE_LENGTH 28
+#define HE_ATTACHTO 29
+#define HE_LABEL 30
+#define HE_DESCRIPTOR 31
+#define HE_EDITOR 32
+
+#define HE_BYTE    33
+#define HE_SHORT   34
+#define HE_DOUBLE  35
+#define HE_RAW     36
+#define HE_USHORT  37
+#define HE_UDECIMAL 38
+
+/* label bits for predicate keys */
+#define HE_PREDICATE 0x8000
+#define HE_COMPARATOR 0x4000
+
+/* predicate keys */
+#define HEK_NULL 0
+#define HEK_TAG 1
+#define HEK_REF 2
+#define HEK_EQUAL 3
+#define HEK_NEQUAL 4
+#define HEK_GRT 5
+#define HEK_GEQUAL 6
+#define HEK_LESST 7
+#define HEK_LEQUAL 8
+#define HEK_ALL 9
+#define HEK_SUCCEED 10
+#define HEK_FAIL 11
+#define HEK_GROUP 12
+
+/* argument type */
+#define HE_NUMBER 1
+#define HE_STRING 2
+
+typedef int (*HE_FUNC) (void *);
+
+typedef struct he_cmd
+  {
+      int         argc;
+      char       *argv[HE_ARG_SZ];
+      HE_FUNC     func;
+      struct he_cmd *sub, *next;
+  }
+HE_CMD;
+
+typedef struct he_pred
+  {
+      int         key, Comp, argType;
+      union
+        {
+            int         i;
+            char       *str;
+        }
+      arg;
+  }
+HE_PRED;
+
+typedef struct DFdesc_str
+  {
+      uint16      tag, ref;
+      int32       length, offset;
+  }
+DFdesc     , *DFdesc_ptr;
+
+typedef struct tag_ref_struct
+  {
+      uint16      tag;
+      uint16      ref;
+  }
+tag_ref    , *tag_ref_ptr;
+
+typedef struct he_group
+  {
+      int         desc;
+      int         size;
+      tag_ref_ptr ddList;
+  }
+HE_GROUP;
+
+extern int  he_status;
+extern int  he_numDesc;
+extern int  he_currDesc;
+extern int  he_numGrp;
+extern int  he_remote;
+extern char *he_file;
+extern DFdesc he_desc[];
+extern HE_GROUP he_grp[];
+
+/*
+ *  ----------------- Convenient Macros ---------------------
+ */
+
+#define unkOpt(st)     fprintf(stderr,"Unknown option: %s.\n",st)
+#define unkArg(st)     fprintf(stderr,"Unknown argument: %s.\n",st)
+#define ambigOpt(st)   fprintf(stderr,"Ambigupus option: %s.\n",st)
+#define irrOpt(st)     fprintf(stderr,"Irrelevant option: %s.\n",st)
+#define noFile()      fprintf(stderr,"No file is opened.\n")
+
+#define isAnnot(t)    (t == DFTAG_DIL || t == DFTAG_DIA)
+#define isRig(t)      (t == DFTAG_RIG)
+#define currTag       (he_desc[he_currDesc].tag)
+#define currGrpNo     (desc2Grp(he_currDesc))
+#define currDesc      ((DFdesc*) he_desc + he_currDesc)
+
+#include "he_proto.h"
+
+/* end of he.h */
diff --git a/hdf/util/he_cntrl.c b/hdf/util/he_cntrl.c
new file mode 100644
index 0000000..0b6e49d
--- /dev/null
+++ b/hdf/util/he_cntrl.c
@@ -0,0 +1,1740 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4937 $";
+#endif
+
+/* $Id: he_cntrl.c 4937 2007-09-10 16:36:16Z pvn $ */
+
+/* ------ he-cntrl.c ------
+   This file contains much of the contol mechanisms for HDFed
+   - Many of the command line functions
+   - The parsing functions
+   - predicate handling
+ */
+
+#include "he.h"
+
+/* --- HEif --- executes commands if predicates are satisfied */
+int
+HEif(HE_CMD * cmd)
+{
+    HE_PRED    *pred;           /* predicates */
+    HE_CMD     *cmdTail;        /* last cmd we've seen in the sublist */
+
+    if (cmd->argc == 2 && !HDstrcmp(cmd->argv[1], "-help"))
+      {
+          puts("if [<predicates>]");
+          puts("  <commands>*");
+          puts("end");
+          puts("\tExecutes commands if predicates are satisfied by element");
+          return HE_OK;
+      }
+
+    /* parse the predicates on this command */
+    pred = parsePred(cmd->argc, cmd->argv);
+    if (!pred)
+        return FAIL;
+
+    /* execute the sub list only is the predicates are satisfied */
+    if (satPred(currDesc, pred))
+      {
+          /* go through sub-list until an end is encountered */
+          for (cmdTail = cmd->sub;
+               cmdTail && HDstrcmp(cmdTail->argv[0], "end");
+               cmdTail = cmdTail->next)
+              if (cmdTail->func)
+                  he_status = (*cmdTail->func) (cmdTail);
+              else
+                {
+                    fprintf(stderr, "Unrecognized command: %s\n", cmd->argv[0]);
+                    return FAIL;
+                }
+      }
+    return HE_OK;
+}
+
+/* --- HEselect --- step through all the elements in a file and execute if
+   predicates are satisfied */
+int
+HEselect(HE_CMD * cmd)
+{
+    int         t_currDesc;     /* tmp var */
+    HE_PRED    *pred;           /* predicate structure */
+    HE_CMD     *cmdTail;        /* last cmd we've seen in the sublist */
+
+    if (cmd->argc == 2 && !HDstrcmp(cmd->argv[1], "-help"))
+      {
+          puts("select [<predicates>]");
+          puts("  <commands>*");
+          puts("end");
+          puts("\tSteps through all elements in the file that satisfies the");
+          puts("\tpredicates and execute the commands on them.");
+          return HE_OK;
+      }
+
+    /* generate predicate structure for this predicate list */
+    pred = parsePred(cmd->argc, cmd->argv);
+    if (!pred)
+        return FAIL;
+
+    /* save the curr desc index */
+    t_currDesc = he_currDesc;
+
+    /* step through all elements */
+    for (he_currDesc = 0; he_currDesc < he_numDesc; he_currDesc++)
+        if (currTag != DFTAG_NULL && satPred(currDesc, pred)) {
+            for (cmdTail = cmd->sub; HDstrcmp(cmdTail->argv[0], "end");
+                 cmdTail = cmdTail->next)
+                if (cmdTail->func)
+                    he_status = (*cmdTail->func) (cmdTail);
+                else
+                  {
+                      fprintf(stderr, "Unrecognized command: %s\n",
+                              cmdTail->argv[0]);
+                      he_status = FAIL;
+                  }
+        }
+
+    /* restore he_currDesc */
+    he_currDesc = t_currDesc;
+
+    return HE_OK;
+}
+
+/* --- move to the next item --- */
+
+extern HE_PRED *he_predicates;
+
+int
+HEnext(HE_CMD * cmd)
+{
+    int         tmp;
+    HE_PRED    *predicates;
+
+    if (cmd->argc == 2 && !HDstrcmp(cmd->argv[1], "-help"))
+      {
+          puts("next [<predicates>]");
+          puts("\tMove to the next element that satisfies the predicate");
+          return HE_OK;
+      }
+
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_FAIL;
+      }
+
+    predicates = parsePred(cmd->argc, cmd->argv);
+
+    /* the following code assumes that parsePred() returns NULL if error, */
+    /* a predicate struct with no key if empty predicate list */
+    if (!predicates)
+        return HE_FAIL;
+
+    /* replace this only if it is non-empty */
+    if (predicates[0].key != 0)
+      {
+          if (he_predicates)
+              HDfree(he_predicates);
+          he_predicates = predicates;
+      }
+
+    tmp = he_currDesc;
+    do
+      {
+          if (tmp >= he_numDesc - 1)
+            {
+                fprintf(stderr, "Reached end of file. Not moved.\n");
+                return HE_FAIL;
+            }
+          tmp++;
+      }
+    while (he_desc[tmp].tag == DFTAG_NULL ||
+           !satPred(he_desc + tmp, he_predicates));
+
+    he_currDesc = tmp;
+
+    return HE_OK;
+}
+
+/* ---------- Move to previous item -------------- */
+
+int
+HEprev(HE_CMD * cmd)
+{
+    int         tmp;
+    HE_PRED    *predicates;
+
+    if (cmd->argc == 2 && !HDstrcmp(cmd->argv[1], "-help"))
+      {
+          puts("prev [<predicates>]");
+          puts("\tMove to the next element that satisfies the predicate");
+          return HE_OK;
+      }
+
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_FAIL;
+      }
+
+    predicates = parsePred(cmd->argc, cmd->argv);
+
+    /* the following code assumes that parsePred() returns NULL if error,
+       a predicate struct with no key if empty predicate list */
+    if (!predicates)
+        return HE_FAIL;
+
+    if (predicates[0].key != 0)
+      {
+          if (he_predicates)
+              HDfree(he_predicates);
+          he_predicates = predicates;
+      }
+
+    tmp = he_currDesc;
+    do
+      {
+          if (tmp <= 0)
+            {
+                fprintf(stderr, "Reached beginning of file. Not moved.\n");
+                return HE_FAIL;
+            }
+          tmp--;
+      }
+    while (he_desc[tmp].tag == DFTAG_NULL ||
+           !satPred(he_desc + tmp, he_predicates));
+    he_currDesc = tmp;
+
+    return HE_OK;
+}
+
+/* ----------- routines to call od on some objects ----------- */
+
+int
+HEdump(HE_CMD * cmd)
+{
+    int i;
+    int         offset = 0, raw = 0;
+    char        format[] = "-o";
+    int32       length = 0;     /* zero is special, means all */
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] == '-')
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      printf("dump [-offset <offset>] [-length <len>]\n");
+                      printf("\t[-decimal|-short|-byte|-hexadecimal|-float|-double|-ascii|\n");
+                      printf("\t[-udecimal|-ushort|-octal|]\n");
+                      printf("\tDisplay the contents of the current object\n");
+                      printf("\t-offset            Start offset\n");
+                      printf("\t-length            Length (bytes) to look at\n");
+                      printf("\t-decimal           Decimal format [32 bit integers]\n");
+                      printf("\t-short             Decimal format   [16 bit integers]\n");
+                      printf("\t-byte              Decimal format    [8 bit integers]\n");
+                      printf("\t-hexadecimal       Hexadecimal format\n");
+                      printf("\t-float             Float format   [32 bit floats]\n");
+                      printf("\t-double            Float format  [64 bit floats]\n");
+                      printf("\t-ascii             Ascii format\n");
+                      printf("\t-udecimal          Unsigned Decimal format [32 bit integers]\n");
+                      printf("\t-ushort            Unsigned Decimal format   [16 bit integers]\n");
+                      printf("\t-octal             Octal format [Default]\n");
+                      return HE_OK;
+                  case HE_OFFSET:
+                      offset = atoi(cmd->argv[++i]);
+                      break;
+                  case HE_LENGTH:
+                      length = atoi(cmd->argv[++i]);
+                      if (length <= 0)
+                        {
+                            fprintf(stderr, "Illegal length: %s, ignored.\n",
+                                    cmd->argv[i]);
+                            length = 0;
+                        }
+                      break;
+                  case HE_DECIMAL:
+                      HDstrcpy(format,"-i");
+                      break;
+                  case HE_UDECIMAL:
+                      HDstrcpy(format,"-d");
+                      break;
+                  case HE_SHORT:
+                      HDstrcpy(format,"-j");
+                      break;
+                  case HE_USHORT:
+                      HDstrcpy(format,"-s");
+                      break;
+                  case HE_BYTE:
+                      HDstrcpy(format,"-b");
+                      break;
+                  case HE_OCTAL:
+                      HDstrcpy(format,"-o");
+                      break;
+                  case HE_HEX:
+                      HDstrcpy(format,"-x");
+                      break;
+                  case HE_FLOAT:
+                      HDstrcpy(format,"-f");
+                      break;
+                  case HE_DOUBLE:
+                      HDstrcpy(format,"-e");
+                      break;
+                  case HE_ASCII:
+                      HDstrcpy(format,"-a");
+                      break;
+                  case HE_RAW:
+                      raw = DFNT_NATIVE;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return HE_FAIL;
+              }
+        else
+          {
+              unkArg(cmd->argv[i]);
+              return HE_FAIL;
+          }
+    return HEIdump(length, offset, format, raw);
+}
+
+#define MAX_LINE 60
+
+/*
+ * Run 'od' on a segment of the current data element
+ */
+int
+HEIdump(int32 length, int offset, char *format, int raw_flag)
+{
+    int32       eltLength;
+    int32 i;
+    int len = 0;
+    char       *data;
+
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_FAIL;
+      }
+
+    eltLength = getElement(he_currDesc, &data);
+    if (eltLength <= 0)
+      {
+          fprintf(stderr, "Unable to get element.\n");
+          return HE_FAIL;
+      }
+
+    /* adjust the offset, negative offset implies starting from end. then
+       check to see if offset is in range */
+    if (offset < 0)
+        offset += (int) eltLength;
+    if (offset < 0 || offset > eltLength)
+      {
+          fprintf(stderr, "Illegal offset. Setting offset to 0.\n");
+          offset = 0;
+      }
+
+    /* adjust the length if it falls beyond the end of the element */
+    if (length == 0 || length > (eltLength - offset))
+        length = eltLength - offset;
+
+    /*
+     * Dump the data to the console
+     */
+
+    switch (format[1])
+      {
+
+          case 'i':
+              {
+                  int32 *idata;
+                  idata = (int32 *) HDmalloc(length / 4 * sizeof(int32));
+
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) idata, DFNT_INT32 | raw_flag,
+                             length / 4, DFACC_READ, 0, 0);
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / 4; i++)
+                    {
+                        printf("%11d ", (int) idata[i]);
+                        if (++len > 4)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * 4));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) idata);
+              }
+              break;
+
+          case 'd':
+              {
+                  uint32 *idata;
+                  idata = (uint32 *) HDmalloc(length / 4 * sizeof(int32));
+
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) idata, DFNT_UINT32 | raw_flag,
+                             length / 4, DFACC_READ, 0, 0);
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / 4; i++)
+                    {
+                        printf("%11u ", (int) idata[i]);
+                        if (++len > 4)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * 4));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) idata);
+              }
+              break;
+          case 'j':
+              {
+                  int16 *sdata;
+                  sdata = (int16 *) HDmalloc(length / 2 * sizeof(int16));
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) sdata, DFNT_INT16 | raw_flag,
+                             length / 2, DFACC_READ, 0, 0);
+
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / 2; i++)
+                    {
+                        printf("%10d ", sdata[i]);
+                        if (++len > 5)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * 2));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) sdata);
+              }
+              break;
+
+          case 's':
+              {
+                  uint16 *sdata;
+                  sdata = (uint16 *) HDmalloc(length / 2 * sizeof(uint16));
+
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) sdata, DFNT_UINT16 | raw_flag,
+                             length / 2, DFACC_READ, 0, 0);
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / 2; i++)
+                    {
+                        printf("%10d ", sdata[i]);
+                        if (++len > 5)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * 2));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) sdata);
+              }
+              break;
+
+          case 'b':
+              {
+                  uint8 *bdata;
+                  bdata = (uint8 *) HDmalloc(length);
+
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) bdata, DFNT_UINT8 | raw_flag,
+                             length, DFACC_READ, 0, 0);
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length; i++)
+                    {
+                        printf("%6d ", bdata[i]);
+                        if (++len > 7)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1)));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) bdata);
+              }
+              break;
+
+          case 'x':
+              {
+                  intn *idata;
+                  intn        sizeintn;
+
+                  sizeintn = sizeof(intn);
+                  idata = (intn *) HDmalloc((size_t)(length / 4 * sizeintn));
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) idata, DFNT_NINT32 | raw_flag,
+                             length / 4, DFACC_READ, 0, 0);
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / sizeintn; i++)
+                    {
+                        printf("%10x ", idata[i]);
+                        if (++len > 5)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * sizeintn));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) idata);
+              }
+              break;
+
+          case 'o':
+              {
+                  intn *idata;
+                  intn        sizeintn;
+
+                  sizeintn = sizeof(intn);
+                  idata = (intn *) HDmalloc((size_t)(length / 4 * sizeintn));
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) idata, DFNT_NINT32 | raw_flag,
+                             length / 4, DFACC_READ, 0, 0);
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / sizeintn; i++)
+                    {
+                        printf("%10o ", idata[i]);
+                        if (++len > 4)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * sizeintn));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) idata);
+              }
+              break;
+
+          case 'a':
+              {
+                  char *cdata;
+                  cdata = (char *) (data + offset);
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length; i++)
+                    {
+                        if (cdata[i] != '\0')
+                            printf("%c", cdata[i]);
+                        else
+                            printf(" ");
+                        if (++len > 40)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1)));
+                          }
+                    }
+                  printf("\n");
+              }
+              break;
+
+          case 'f':
+              {
+                  float32 *fdata;
+                  fdata = (float32 *) HDmalloc(length / 4 * sizeof(float32));
+
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) fdata, DFNT_FLOAT32 | raw_flag,
+                             length / 4, DFACC_READ, 0, 0);
+
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / 4; i++)
+                    {
+                        printf("%15e", fdata[i]);
+                        if (++len > 3)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * 4));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) fdata);
+              }
+              break;
+
+          case 'e':
+              {
+                  float64 *fdata;
+                  fdata = (float64 *) HDmalloc(length / 8 * sizeof(float64));
+
+                  DFKconvert((VOIDP) (data + offset), (VOIDP) fdata, DFNT_FLOAT64 | raw_flag,
+                             length / 8, DFACC_READ, 0, 0);
+
+                  printf("%8d: ", offset);
+                  for (i = 0; i < length / 8; i++)
+                    {
+                        printf("%30e", fdata[i]);
+                        if (++len > 1)
+                          {
+                              len = 0;
+                              printf("\n%8d: ", (int) (offset + (i + 1) * 8));
+                          }
+                    }
+                  printf("\n");
+                  HDfree((VOIDP) fdata);
+              }
+              break;
+
+          default:
+              printf("Doing the default thang\n");
+              break;
+
+      }
+
+    HDfree(data);
+
+    return HE_OK;
+}
+
+/* ------------------ Print 'info' ----------------- */
+
+int
+HEinfo(HE_CMD * cmd)
+{
+    int i;
+    int         all = NO;
+    int         longout = NO;
+    int         group = NO;
+    int         label = NO;
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] == '-')
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      puts("info [-all] [-long] [-group] [-label]");
+                      puts("\t-all\t\tShow info for all elements in file");
+                      puts("\t-long\t\tShow more info");
+                      puts("\t-group\t\tOrganize info in group(s)");
+                      puts("\t-label\t\tShow label if any");
+                      return HE_OK;
+                  case HE_LONGOUT:
+                      longout = YES;
+                      break;
+                  case HE_ALL:
+                      all = YES;
+                      break;
+                  case HE_LABEL:
+                      label = YES;
+                      break;
+                  case HE_DOGROUP:
+                      group = YES;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return HE_FAIL;
+              }
+        else
+          {
+              unkArg(cmd->argv[i]);
+              return HE_FAIL;
+          }
+    return info(all, longout, group, label);
+}
+
+/*
+ *Show info about data elements
+ */
+int
+info(int all, int longout, int group, int label)
+{
+    int         idx;
+    int         empty = 0;
+    int         start, end;
+    int         d;
+    int        *mark;
+    int i, j;
+
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_OK;
+      }
+
+    if (!group || (!isGrp(currTag) && !all))
+      {
+          if (all)
+            {
+                start = 0;
+                end = he_numDesc - 1;
+            }
+          else
+              start = end = he_currDesc;
+
+          for (i = start; i <= end; i++)
+              if (he_desc[i].tag == DFTAG_NULL)
+                  empty++;
+              else
+                {
+                    if (all && i == he_currDesc)
+                        printf("*");
+                    else
+                        printf(" ");
+                    printf("(%d) ", i + 1);     /* 1 based */
+                    infoDesc(i, longout, label);
+                }
+
+          if (empty > 0)
+              printf("Empty (tag %d) : %d slots.\n", DFTAG_NULL, empty);
+      }
+    else
+      {
+          mark = (int *) HDcalloc(he_numDesc, sizeof(int));
+
+          if (all)
+            {
+                start = 0;
+                end = he_numGrp - 1;
+            }
+          else
+            {
+                if (he_numGrp == 0)
+                  {
+                      fprintf(stderr, "There is no group in this file.\n");
+                      return HE_FAIL;
+                  }
+                start = end = currGrpNo;
+            }
+          for (i = start; i <= end; i++)
+            {
+                printf("**Group %d:\n", i + 1);     /* 1 based */
+                idx = he_grp[i].desc;
+                infoDesc(idx, longout, label);
+
+                mark[idx] = YES;
+
+                for (j = 0; j < he_grp[i].size; j++)
+                    if ((d = findDesc(he_grp[i].ddList + j)) >= 0)
+                      {
+                          mark[d] = 1;
+                          infoDesc(d, longout, 0);
+                      }
+                    else
+                        fprintf(stderr,
+                            "**Tag: %d, Ref: %d not in descriptors list!\n",
+                                he_grp[i].ddList[j].tag,
+                                he_grp[i].ddList[j].ref);
+            }
+          if (all)
+            {
+                puts("\n**These do not belong to any group:");
+                for (i = 0; i < he_numDesc; i++)
+                    if (!mark[i]) {
+                        if (he_desc[i].tag == DFTAG_NULL)
+                            empty++;
+                        else
+                            infoDesc(i, longout, label);
+                    }
+
+                if (empty > 0)
+                    printf("Empty (tag %d) : %d slots.\n", DFTAG_NULL, empty);
+            }
+      }
+    return HE_OK;
+}
+
+void
+infoDesc(int desc, int longout, int label)
+{
+    char       *s;
+    char *name;
+
+    name = HDgettagsname(he_desc[desc].tag);
+    if (!name)
+        printf("\t%-30s: (Tag %d)", "Unknown Tag", he_desc[desc].tag);
+    else
+      {
+          printf("\t%-30s: (Tag %d)", name, he_desc[desc].tag);
+          HDfree(name);
+      } /* end else */
+
+    if (longout)
+        printf("\n\tRef: %d, Offset: %ld, Length: %ld (bytes)\n",
+               he_desc[desc].ref, (long) he_desc[desc].offset, (long) he_desc[desc].length);
+    else
+        printf(" Ref %d\n", he_desc[desc].ref);
+    if (label)
+      {
+          getAnn(HE_LABEL, he_desc[desc].tag, he_desc[desc].ref, &s);
+          if (s != NULL)
+              printf("\tLabel: %s\n", s);
+      }
+}
+
+/* ---------- HEdelete --- 'stub' function for delete */
+int
+HEdelete(HE_CMD * cmd)
+{
+    if (cmd->argc < 2)
+        return delete(he_currDesc);
+    else
+      {
+          if (cmd->argv[1][0] != '-')
+            {
+                unkArg(cmd->argv[1]);
+                return HE_FAIL;
+            }
+          else
+              switch (findOpt(cmd->argv[1] + 1))
+                {
+                    case HE_HELP:
+                        puts("delete");
+                        puts("\tDelete this element or group.");
+                        return HE_OK;
+                    case HE_NOTFOUND:
+                        unkOpt(cmd->argv[1]);
+                        return HE_FAIL;
+                    case HE_AMBIG:
+                        ambigOpt(cmd->argv[1]);
+                        return HE_FAIL;
+                    default:
+                        irrOpt(cmd->argv[1]);
+                        return HE_FAIL;
+                }
+      }
+}
+
+/* delete -- deletes a group and its elts or an elt from current hdf file */
+int
+delete(int curr)
+{
+    int         ret;
+
+    /* check if any file is open */
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_FAIL;
+      }
+
+    /* call the actual routine to do it, the update the descriptor list */
+    ret = recurseDel(curr);
+    updateDesc();
+
+    return ret;
+}
+
+/* recurseDel -- this function recursively tries to delete some elts from
+   a file. if the current elt is a group, it will call itself on the elts
+   of the group. else, it will check if any group references the elt, and
+   actually deletes it if there is no other references */
+int
+recurseDel(int curr)
+{
+    int         d, currGrp;
+    int i;
+
+    if (isGrp(he_desc[curr].tag))
+      {
+          /* if this is a group, do its elts then itself */
+
+          /* find the index of the group */
+          currGrp = desc2Grp(curr);
+
+          /* step through the elts of this group */
+          for (i = 0; i < he_grp[currGrp].size; i++)
+            {
+                d = findDesc(he_grp[currGrp].ddList + i);
+                if (d >= 0)
+                  {
+                      /* null this so it will not report that this is a multiple
+                       * copy of itself */
+                      he_grp[currGrp].ddList[i].tag = DFTAG_NULL;
+                      he_grp[currGrp].ddList[i].ref = 0;
+
+                      /* Try to delete this component */
+                      if (recurseDel(d) < 0)
+                          return HE_FAIL;
+                  }
+            }
+          /* tried all components, now delete self */
+          if (!hasReference(curr))
+              if (deleteDesc(curr) < 0)
+                  return HE_FAIL;
+      }
+    else
+        /* not a group, actually delete this only if there is no group
+           referencing it */
+    if (!hasReference(curr))
+        if (deleteDesc(curr) < 0)
+            return HE_FAIL;
+    return HE_OK;
+}
+
+/* some char const for the get/parse routines */
+#define CR '\n'
+#define SPACE ' '
+#define TAB '\t'
+#define QUOTE '"'
+#define BREAK '\003'    /* C-c */
+#define ESCAPE '\\'     /* Quote escape */
+#define COMMENT '!'     /* Comment a line if first character */
+
+/* max line size -- change this if you type longer than this in one line */
+#define HE_LINE_SZ 512
+
+/* command separator */
+#define HE_SEPARATOR ';'
+
+/* is this in batch mode or interactive? */
+int         he_batch = NO;
+
+/* nesting when if/select is encountered */
+int         he_nestLevel = 0;
+
+/* prompt is actually "he"<he_prompt><space> */
+const char  *he_prompt = ">";
+#define he_nestChar '>'
+
+/* table to associate command to the function --
+   add additional functions anywhere in the table BEFORE the
+   Marker {0,0} entry */
+struct
+  {
+      const char *str;
+      HE_FUNC     func;
+  }
+he_funcTab[] =
+{
+    {
+        "open", (HE_FUNC) HEopen
+    }
+    ,
+    {
+        "close", (HE_FUNC) HEclose
+    }
+    ,
+    {
+        "next", (HE_FUNC) HEnext
+    }
+    ,
+    {
+        "prev", (HE_FUNC) HEprev
+    }
+    ,
+    {
+        "alias", (HE_FUNC) HEalias
+    }
+    ,
+    {
+        "unalias", (HE_FUNC) HEunalias
+    }
+    ,
+    {
+        "display", (HE_FUNC) HEdisplay
+    }
+    ,
+    {
+        "info", (HE_FUNC) HEinfo
+    }
+    ,
+    {
+        "list", (HE_FUNC) HEinfo
+    }
+    ,
+    {
+        "if", (HE_FUNC) HEif
+    }
+    ,
+    {
+        "select", (HE_FUNC) HEselect
+    }
+    ,
+    {
+        "wait", (HE_FUNC) HEwait
+    }
+    ,
+    {
+        "delete", (HE_FUNC) HEdelete
+    }
+    ,
+    {
+        "quit", (HE_FUNC) HEquit
+    }
+    ,
+    {
+        "dump", (HE_FUNC) HEdump
+    }
+    ,
+    {
+        "getr8", (HE_FUNC) HEgetR8
+    }
+    ,
+    {
+        "putr8", (HE_FUNC) HEputR8
+    }
+    ,
+    {
+        "put", (HE_FUNC) HEput
+    }
+    ,
+    {
+        "revert", (HE_FUNC) HErevert
+    }
+    ,
+    {
+        "write", (HE_FUNC) HEwrite
+    }
+    ,
+    {
+        "annotate", (HE_FUNC) HEannotate
+    }
+    ,
+    {
+        "help", (HE_FUNC) HEhelp
+    }
+    ,
+    {
+        "end", (HE_FUNC) 0
+    }
+    ,
+};
+
+HE_FUNC
+findFunc(char *fword)
+{
+    unsigned    len;
+    int         found = -1;
+    uintn i;
+
+    len = HDstrlen((const char *) fword);
+
+    for (i = 0; i < sizeof(he_funcTab) / sizeof(he_funcTab[0]); i++)
+        if (!HDstrncmp(he_funcTab[i].str, (const char *) fword, len))
+          {
+              /* check for exact match */
+              if (HDstrlen(he_funcTab[i].str) == len)
+                  return he_funcTab[i].func;
+
+              if (found < 0)
+                  found = (int)i;
+              else
+                {
+                    fprintf(stderr, "Ambiguous command: %s.\n", fword);
+                    return NULL;
+                }
+          }
+
+    if (found < 0)
+        return NULL;
+    else
+        return he_funcTab[found].func;
+}
+
+/* prompt -- printout prompt according to the nesting level */
+void
+prompt(void)
+{
+
+    if (!he_nestLevel)
+        printf("hdfed%s ", he_prompt);
+    else
+      {
+          int i;
+
+          printf("     %s ", he_prompt);
+          for (i = he_nestLevel; i; i--)
+              putchar(he_nestChar);
+          putchar(' ');
+      }
+
+}
+
+/* reads a line of input into p */
+/* Skips all initial spaces and empty commands */
+/* always returns with at least a word in p, unless eof */
+/* if eof and p is not empty, return HE_OK, else if no word, return EOF */
+int
+getLine(char *p)
+{
+    static int  ch = 0;
+
+    do
+      {
+          if (!he_batch && (ch != EOF))
+              prompt();
+          ch = getc(stdin);
+          if (ch == COMMENT)
+            {
+                /* Skip this line */
+                do
+                    ch = getchar();
+                while ((ch != CR) && (ch != EOF));
+            }
+          else
+              while ((ch == SPACE) || (ch == TAB) || (ch == HE_SEPARATOR))
+                  ch = getchar();
+          if (ch == EOF)
+              return EOF;
+      }
+    while (ch == CR);
+
+    while ((ch != EOF) && (ch != CR))
+        switch (ch)
+          {
+              case ESCAPE:
+                  ch = getchar();
+                  if (!(ch == CR))
+                      *p++ = (char) ch;
+                  ch = getchar();
+                  break;
+              case QUOTE:
+                  ch = getchar();
+                  while (ch != QUOTE)
+                    {
+                        if (ch == ESCAPE)
+                            ch = getchar();
+                        *p++ = (char) ch;
+                        ch = getchar();
+                    }
+                  ch = getchar();   /* Skip over the QUOTE */
+                  break;
+              case SPACE:
+              case TAB:
+                  *p++ = SPACE;
+                  while ((ch == SPACE) || (ch == TAB))
+                      ch = getchar();
+                  break;
+              case HE_SEPARATOR:
+                  if (!isspace((int)*(p - 1)))
+                      *p++ = SPACE;
+                  *p++ = HE_SEPARATOR;
+                  ch = SPACE;   /* Ensure next is a space */
+                  break;
+              default:
+                  *p++ = (char) ch;
+                  ch = getchar();
+                  break;
+          }
+
+    *p++ = '\0';
+    return ch;
+}
+
+/* copy the next (space-delimited) word and advance the pointer as a
+   side effect */
+char       *
+nextWord(char **p)
+{
+    char       *word;
+    char *s, *q;
+    unsigned    len;
+
+    q = *p;
+    while (*q && isspace((int)*q))
+        q++;
+    if (!(*q))
+      {
+          *p = q;
+          return NULL;
+      }
+
+    s = q;
+    while (*s && !isspace((int)*s))
+        s++;
+    len = (unsigned) (s - q);
+
+    word = (char *) HDmalloc(len + 1);
+    HDstrncpy(word, q, len);
+    word[len] = '\0';
+
+    *p = s;
+    while (**p && (isspace((int)**p)))
+        (*p)++;
+
+    return word;
+}
+
+HE_CMD     *
+parseCmd(char **p)
+{
+    char       *word;
+    HE_CMD     *cmd;
+    HE_CMD     *aliasCmd;
+    HE_CMD     *cmdTail;
+
+    if (!(**p))
+        return NULL;
+
+    cmd = (HE_CMD *) HDcalloc(1, sizeof(HE_CMD));
+    cmd->next = cmd->sub = (HE_CMD *) NULL;
+    cmd->argc = 1;
+    cmd->argv[0] = nextWord(p);
+
+    if ((aliasCmd = findAlias(cmd->argv[0])) != NULL)
+        cmd = aliasCmd;
+    else
+        cmd->func = findFunc(cmd->argv[0]);
+
+    if ((cmd->func == (HE_FUNC) HEalias) ||
+        (cmd->func == (HE_FUNC) HEwait))
+      {
+          /* let the alias command handle the parsing */
+          cmd->argv[1] = copyStr(*p);
+          cmd->argc = 2;
+
+          **p = '\0';
+      }
+    else
+      {
+          cmdTail = cmd;
+          while (cmdTail->next)
+              cmdTail = cmdTail->next;
+
+          for (word = nextWord(p); word && HDstrcmp(word, ";");
+               word = nextWord(p), cmdTail->argc++)
+              cmdTail->argv[cmdTail->argc] = word;
+
+          while (**p && (isspace((int)**p) || (**p == ';')))
+              (*p)++;
+      }
+    return cmd;
+}
+
+/* Inputs a line and returns cmd list of line */
+HE_CMD     *
+parse(void)
+{
+    static char line[HE_LINE_SZ];
+    static char *ptr;
+    int         notDone = 1;
+    HE_CMD     *cmd;
+    HE_CMD     *cmdTail;
+
+    if (getLine(line) == EOF)
+        return NULL;
+    ptr = line;
+
+    cmdTail = cmd = parseCmd(&ptr);
+    while (cmdTail->next)
+        cmdTail = cmdTail->next;
+
+    while (notDone)
+      {
+          cmdTail->next = parseCmd(&ptr);
+          notDone = (cmdTail->next != NULL);
+          while (cmdTail->next)
+              cmdTail = cmdTail->next;
+      }
+    return cmd;
+}
+
+HE_CMD     *
+getCmd(void)
+{
+    static HE_CMD *cmdList;
+    HE_CMD     *cmd;
+    HE_CMD     *cmdTail;
+
+    if (!cmdList)
+        cmdList = parse();
+    if (!cmdList)
+        return NULL;
+
+    cmd = cmdList;
+    if (cmdList)
+        cmdList = cmdList->next;
+    cmd->next = (HE_CMD *) NULL;    /* Cut off links since these will be */
+    /* accessed later */
+
+    if (cmd && ((cmd->func == (HE_FUNC) HEif) ||
+                (cmd->func == (HE_FUNC) HEselect)) &&
+        !((cmd->argc > 1) && (cmd->argv[1][0] == '-') &&
+          (findOpt(cmd->argv[1] + 1) == HE_HELP)))
+      {
+          he_nestLevel++;
+
+          cmd->sub = getCmd();
+          for (cmdTail = cmd->sub;
+               cmdTail && HDstrcmp(cmdTail->argv[0], "end");    /* while != "end" */
+               cmdTail = cmdTail->next)
+              cmdTail->next = getCmd();
+
+          he_nestLevel--;
+      }
+    return cmd;
+}
+
+#define HE_ALIAS_SZ 256
+
+struct he_alias
+{
+    char       *str;
+    HE_CMD     *cmd;
+}
+he_aliasTab[HE_ALIAS_SZ];
+
+int         he_numAlias = 0;
+
+int
+setAlias(char *str, HE_CMD * cmd)
+{
+    int i;
+
+    for (i = 0; i < he_numAlias; i++)
+        if (!HDstrcmp(str, he_aliasTab[i].str))
+          {
+              he_aliasTab[i].cmd = cmd;
+              return HE_OK;
+          }
+    if (he_numAlias == HE_ALIAS_SZ)
+      {
+          fprintf(stderr, "Alias table full.\n");
+          return HE_FAIL;
+      }
+    he_aliasTab[he_numAlias].str = str;
+    he_aliasTab[he_numAlias++].cmd = cmd;
+
+    return HE_OK;
+}
+
+HE_CMD     *
+mkDupCmd(HE_CMD * cmd)
+{
+    int i;
+    HE_CMD     *dupCmd;
+
+    dupCmd = (HE_CMD *) HDcalloc(1, sizeof(HE_CMD));
+    dupCmd->func = cmd->func;
+    dupCmd->argc = cmd->argc;
+    dupCmd->next = dupCmd->sub = (HE_CMD *) NULL;
+    for (i = 0; i < cmd->argc; i++)
+        dupCmd->argv[i] = copyStr(cmd->argv[i]);
+
+    return dupCmd;
+}
+
+HE_CMD     *
+findAlias(char *str)
+{
+    int i;
+    HE_CMD     *cmd;
+    HE_CMD     *dupCmd;
+    HE_CMD     *cmdTail;
+
+    for (i = 0; i < he_numAlias; i++)
+        if (!HDstrcmp(str, he_aliasTab[i].str))
+          {
+              cmd = he_aliasTab[i].cmd;
+              dupCmd = mkDupCmd(cmd);
+
+              cmd = cmd->next;
+              for (cmdTail = dupCmd; cmd;
+                   cmd = cmd->next, cmdTail = cmdTail->next)
+                  cmdTail->next = mkDupCmd(cmd);
+
+              return dupCmd;
+          }
+    return NULL;
+}
+
+int
+HEunalias(HE_CMD * cmd)
+{
+    int a, i, j;
+
+    for (a = 1; a < cmd->argc; a++)
+        for (i = 0; i < he_numAlias; i++)
+            if (!HDstrcmp(cmd->argv[a], he_aliasTab[i].str))
+              {
+                  he_numAlias--;
+                  for (j = i; j < he_numAlias; j++)
+                    {
+                        he_aliasTab[j].str = he_aliasTab[j + 1].str;
+                        he_aliasTab[j].cmd = he_aliasTab[j + 1].cmd;
+                    }
+                  break;
+              }
+    return HE_OK;
+}
+
+void
+printAlias(char *word, HE_CMD * cmd)
+{
+    int j;
+
+    printf("%s:", word);
+    for (; cmd; cmd = cmd->next)
+      {
+          printf("\t");
+          for (j = 0; j < cmd->argc; j++)
+              printf("%s ", cmd->argv[j]);
+          puts("");
+      }
+}
+
+int
+HEalias(HE_CMD * cmd)
+{
+    char       *s;
+    char       *word;
+    int i;
+    HE_CMD     *cmdTail;
+
+    s = cmd->argv[1];
+    word = nextWord(&s);
+
+    if (!word)
+      {
+          for (i = 0; i < he_numAlias; i++)
+              printAlias(he_aliasTab[i].str, he_aliasTab[i].cmd);
+          return HE_OK;
+      }
+
+    cmd = parseCmd(&s);
+    if (!cmd)
+      {
+          cmd = findAlias(word);
+          printAlias(word, cmd);
+          return HE_OK;
+      }
+    for (cmdTail = cmd; cmdTail->next; cmdTail = cmdTail->next)     /*EMPTY */
+        ;
+    while ((cmdTail->next = parseCmd(&s)) != NULL)
+        for (; cmdTail->next; cmdTail = cmdTail->next)  /*EMPTY */
+            ;
+    return setAlias(word, cmd);
+}
+
+HE_PRED    *he_predicates;
+
+/* resetPred -- for setting the he_predicates to point to a pred
+   of only group, this is the default when a file is opened */
+int
+resetPred(void)
+{
+    if (he_predicates != NULL)
+        HDfree(he_predicates);
+
+    he_predicates = (HE_PRED *) HDcalloc(2, sizeof(HE_PRED));
+    he_predicates[0].key = HEK_GROUP;
+    he_predicates[1].key = 0;
+
+    return HE_OK;
+}
+
+struct
+{
+    const char *str;
+    int         key;
+}
+he_keyTab[] =
+{
+    {
+        "!=", HEK_NEQUAL | HE_COMPARATOR
+    }
+    ,
+    {
+        "<", HEK_LESST | HE_COMPARATOR
+    }
+    ,
+    {
+        "<=", HEK_LEQUAL | HE_COMPARATOR
+    }
+    ,
+    {
+        "==", HEK_EQUAL | HE_COMPARATOR
+    }
+    ,
+    {
+        ">", HEK_GRT | HE_COMPARATOR
+    }
+    ,
+    {
+        ">=", HEK_GEQUAL | HE_COMPARATOR
+    }
+    ,
+    {
+        "all", HEK_ALL | HE_PREDICATE
+    }
+    ,
+    {
+        "any", HEK_ALL | HE_PREDICATE
+    }
+    ,
+    {
+        "ref", HEK_REF | HE_PREDICATE
+    }
+    ,
+    {
+        "succeed", HEK_SUCCEED | HE_PREDICATE
+    }
+    ,
+    {
+        "fail", HEK_FAIL | HE_PREDICATE
+    }
+    ,
+    {
+        "tag", HEK_TAG | HE_PREDICATE
+    }
+    ,
+    {
+        "group", HEK_GROUP | HE_PREDICATE
+    }
+    ,
+/* Finish this later */
+};
+
+int
+findKey(char *word)
+{
+    uintn i;
+    unsigned    len;
+    int         found = -1;
+
+    len = HDstrlen(word);
+
+    for (i = 0; i < sizeof(he_keyTab) / sizeof(he_keyTab[0]); i++)
+        if (!HDstrncmp(he_keyTab[i].str, word, len))
+          {
+              /* if this is an exact match, just return */
+              if (HDstrlen(he_keyTab[i].str) == len)
+                  return he_keyTab[i].key;
+              if (found < 0)
+                  found = (int)i;
+              else
+                {
+                    fprintf(stderr, "Ambiguous: %s.\n", word);
+                    return HE_NOTFOUND;
+                }
+          }
+    if (found < 0)
+      {
+          fprintf(stderr, "Predicate/comparator: %s not found.\n", word);
+          return HE_NOTFOUND;
+      }
+    return he_keyTab[found].key;
+}
+
+int
+isNumber(char *s)
+{
+    for (; *s; s++)
+        if (!isdigit((int) *s))
+            return NO;
+
+    return YES;
+}
+
+#define HE_PRED_SZ HE_ARG_SZ
+
+HE_PRED    *
+parsePred(int argc, char *argv[])
+{
+    HE_PRED    *pred;
+    int         predNum = -1;
+    int         state = 0;
+    int         key = 0;
+    int i;
+    char       *s;
+    char       *tok;
+
+    pred = (HE_PRED *) HDcalloc(HE_PRED_SZ, sizeof(HE_PRED));
+
+    for (i = 1; i < argc; i++)
+      {
+          s = argv[i];
+          while (*s)
+            {
+                if (state != 2)
+                    tok = nextToken(&s);
+                else
+                    tok = nextWord(&s);
+                if (!tok)
+                    break;
+
+                if (state != 2)
+                  {
+                      if ((key = findKey(tok)) == HE_NOTFOUND)
+                        {
+                            HDfree(pred);
+                            return NULL;
+                        }
+                      HDfree(tok);
+                  }
+
+                switch (state)
+                  {
+                      case 0:
+                          /* Ready to accept a predicate */
+                          if (!(key & HE_PREDICATE))
+                            {
+                                fprintf(stderr, "Parse error: %s.\n", argv[i]);
+                                HDfree(pred);
+                                return NULL;
+                            }
+                          pred[++predNum].key = key & ~(HE_PREDICATE | HE_COMPARATOR);
+                          state = 1;
+                          break;
+
+                      case 1:
+                          /* Can be a comparator for previous pred or a new predicate */
+                          if (key & HE_PREDICATE)
+                            {
+                                pred[++predNum].key =
+                                    key & ~(HE_PREDICATE | HE_COMPARATOR);
+
+                            }
+                          else if (key & HE_COMPARATOR)
+                            {
+                                pred[predNum].Comp =
+                                    key & ~(HE_PREDICATE | HE_COMPARATOR);
+                                state = 2;
+                            }
+                          else
+                            {
+                                fprintf(stderr, "Parse error: %s.\n", argv[i]);
+                                HDfree(pred);
+                                return NULL;
+                            }
+                          break;
+
+                      case 2:
+                          /* Looking for an argument */
+                          if (isNumber(tok))
+                            {
+                                pred[predNum].argType = HE_NUMBER;
+                                pred[predNum].arg.i = atoi(tok);
+                            }
+                          else
+                            {
+                                pred[predNum].argType = HE_STRING;
+                                pred[predNum].arg.str = copyStr(tok);
+                            }
+                          state = 0;
+                          break;
+
+                      default:
+                          NOT_REACHED();
+                          break;
+                  }
+            }
+      }
+    pred[++predNum].key = 0;
+
+    return pred;
+}
+
+int
+satPred(DFdesc * desc, HE_PRED pred[])
+{
+    int         i;
+
+    if (!pred)
+        return YES;
+    for (i = 0; pred[i].key; i++)
+      {
+          switch (pred[i].key)
+            {
+                case HEK_ALL:
+                    return YES;     /* Always satisfied */
+                case HEK_GROUP:
+                    if (!isGrp(desc->tag))
+                        return NO;
+                    break;
+                case HEK_TAG:
+                    if (pred[i].argType != HE_NUMBER)
+                      {
+                          fprintf(stderr, "Argument to tag predicate not a number.");
+                          return NO;
+                      }
+                    if (!numCompare((int) desc->tag, pred[i].Comp, pred[i].arg.i))
+                        return NO;
+                    break;
+                case HEK_REF:
+                    if (pred[i].argType != HE_NUMBER)
+                      {
+                          fprintf(stderr, "Argument to ref predicate not a number.");
+                          return NO;
+                      }
+                    if (!numCompare((int) desc->ref, pred[i].Comp, pred[i].arg.i))
+                        return NO;
+                    break;
+                case HEK_SUCCEED:
+                    return (he_status == 0);
+                case HEK_FAIL:
+                    return (he_status != 0);
+                default:
+                    NOT_REACHED();
+                    break;
+            }
+      }
+
+    return 1;
+}
+
+char       *
+nextToken(char **p)
+{
+    char *s, *q;
+    char       *tok;
+
+    if (!(**p))
+        return NULL;
+
+    s = *p;
+
+    if (isalnum((int)**p))
+        while (isalnum((int)*s))
+            s++;
+    else
+        while (*s && !isalnum((int)*s))
+            s++;
+
+    q = tok = (char *) HDmalloc((s - (*p)) + 1);
+    while (*p != s)
+        *q++ = *(*p)++;
+    *q = '\0';
+
+    return tok;
+}
+
+int
+numCompare(int n1, int Comp, int n2)
+{
+    switch (Comp)
+      {
+          case HEK_EQUAL:
+              return (n1 == n2);
+
+          case HEK_NEQUAL:
+              return (n1 != n2);
+
+          case HEK_GRT:
+              return (n1 > n2);
+
+          case HEK_GEQUAL:
+              return (n1 >= n2);
+
+          case HEK_LESST:
+              return (n1 < n2);
+
+          case HEK_LEQUAL:
+              return (n1 <= n2);
+
+          default:
+              NOT_REACHED();
+              break;
+      }
+    return NO;
+}
+
+/* end of cntrl.c */
diff --git a/hdf/util/he_disp.c b/hdf/util/he_disp.c
new file mode 100644
index 0000000..98da557
--- /dev/null
+++ b/hdf/util/he_disp.c
@@ -0,0 +1,410 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 4937 $";
+#endif
+
+/* $Id: he_disp.c 4937 2007-09-10 16:36:16Z pvn $ */
+
+/* display.c -- contains code for displaying an image using ICR
+ * this code is plucked from hdfrseq.c
+ */
+#include "he.h"
+
+#define SCRX 1152
+#define SCRY 900
+
+/* HEdisplay -- stub function for displaying an image using ICR */
+int
+HEdisplay(HE_CMD * cmd)
+{
+#ifndef IBM6000
+    int i;
+    int         center = 1;
+    int         xwhere = 0;
+    int         ywhere = 0;
+    int         factor = 1;
+    int         large = 0;
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] == '-')
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      printf("display [-position <xpos> <ypos>] [-expansion <exp>] [-large]\n");
+                      printf("\t-position\tImage position on console screen\n");
+                      printf("\t-expansion\tImage expansion factor\n");
+                      printf("\t-large\t\tMake image as large as posible\n");
+                      return HE_OK;
+                  case HE_POSITION:
+                      center = 0;
+                      xwhere = atoi(cmd->argv[++i]);
+                      ywhere = atoi(cmd->argv[++i]);
+                      if ((xwhere < 0) || (xwhere > SCRX) ||
+                          (ywhere < 0) || (ywhere > SCRY))
+                        {
+                            fprintf(stderr, "Invalid position.\n");
+                            return HE_FAIL;
+                        }
+                      break;
+
+                  case HE_EXPANSION:
+                      factor = atoi(cmd->argv[++i]);
+                      if (factor < 1)
+                          factor = 1;
+                      break;
+
+                  case HE_LARGE:
+                      large = 1;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return HE_FAIL;
+              }
+        else
+          {
+              unkArg(cmd->argv[i]);
+              return HE_FAIL;
+          }
+    return display(center, xwhere, ywhere, factor, large);
+#else
+    printf("Display routines do not work on this platform.\n");
+    return 1;
+#endif
+}
+
+void
+goTo(int desc)
+{
+    /* goto element of he_desc[desc] */
+    /* ask swami */
+
+    /* right now this only works for r8 */
+    DFR8readref(he_file, he_desc[desc].ref);
+}
+
+#ifndef IBM6000     /* Skip it all */
+
+int         oldcf = 0;          /* old value of compression flag */
+int32       oldx = 0, oldy = 0; /* old values of xdim and ydim */
+int         coldx = 0, coldy = 0;   /* old values of xdim and ydim for CI8s */
+int32       xdim = 0, ydim = 0; /* size of image on disk */
+int         xwhere, ywhere;     /* where to put it on the screen */
+int         ispal;
+int         large;              /* should make images as large as possible */
+int         center;             /* should center the images */
+int         oldxs = 0, oldys = 0;   /* old sizes */
+int         xsize = 0, ysize = 0;   /* what final size on screen, after blow-up */
+int         factor;
+
+unsigned char rgb[768];         /* storage for a palette */
+char       *wherebig = NULL;    /* where to store small image */
+uint8      *wheresmall = NULL;  /* where to store image-related stuff */
+
+int
+getSpace(void)
+{
+    /*
+     *  Don't allocate anything if the image is the same size as before.
+     */
+    if (oldx != xdim || oldy != ydim)
+      {
+          oldx = xdim;
+          oldy = ydim;
+
+          if (wheresmall)
+              HDfree(wheresmall);
+
+          if (NULL == (wheresmall = (uint8 *) HDmalloc((size_t)(xdim * ydim))))
+            {
+                printf(" Cannot allocate memory, fatal error\n");
+                exit(1);
+            }
+
+      }
+    return (0);
+}
+
+/*************************************************************************/
+/*  largeset
+ *  Set up the xfact, yfact, xsize and ysize for expanding the image
+ *  locally.
+ *
+ */
+int
+largeSet(void)
+{
+    int
+                tmp;
+
+    if (large)
+      {
+          factor = (int) (SCRX / xdim);     /* how much blow-up can we do? */
+          /* calculate expansion factor  */
+          tmp = (int) (SCRY / ydim);
+
+          /* take minimum expansion factor */
+          if (factor > tmp)
+              factor = tmp;
+      }
+
+    xsize = (int) (factor * xdim);  /* re-calculate actual pixel dimensions */
+    ysize = (int) (factor * ydim);
+
+    return (factor > 1);    /* is expansion necessary? */
+}
+
+int
+display(int c, int x, int y, int f, int l)
+{
+
+    center = c;
+    xwhere = x;
+    ywhere = y;
+    factor = f;
+    large = l;
+
+    if (!isRig(he_desc[he_currDesc].tag))
+      {
+
+          fprintf(stderr, "Current element not a image group.\n");
+          return HE_FAIL;
+      }
+
+    goTo(he_currDesc);
+
+    if (DFR8getdims(he_file, &xdim, &ydim, &ispal) < 0)
+      {
+          fprintf(stderr, "Error getting image group.\n");
+          return HE_FAIL;
+      }
+
+    if (he_remote)
+        getSpace();     /* get space for image in mem */
+
+/*
+   *  Try to successfully load the palette and image from the file
+ */
+    if (DFR8getimage(he_file, wheresmall, xdim, ydim, rgb) < 0)
+      {
+          fprintf(stderr, "Error getting image group.\n");
+          return HE_FAIL;
+      }
+
+    if (he_remote)
+        rImage(ispal);  /* display remote image with [palette] */
+
+    return HE_OK;
+
+}
+
+/*****************************************************************************/
+/*  rimage
+   *  Remote display of the image using the ICR.
+   *  Just print the codes to stdout using the protocol.
+ */
+int
+rImage(int usepal)
+{
+    int         i, j, newxsize;
+    int8       *thisline, *space, *thischar;
+    unsigned char c;
+
+/*
+   *  Open the window with the W command
+ */
+
+    printf("\033^W;%d;%d;%ld;%ld;0;rseq^", xwhere, ywhere, (long) (xdim * factor), (long) (ydim * factor));
+
+/*
+   *  If a palette should be used, send it with the M command.
+ */
+    if (usepal)
+      {
+          (void) printf("\033^M;0;256;768;rseq^");  /* start map */
+
+          thischar = (int8 *) rgb;
+          for (j = 0; j < 768; j++)
+            {
+                c = (unsigned char)*thischar++;
+                if ((unsigned)c > (unsigned)31 && (unsigned)c < (unsigned)123)
+                  {
+                      putchar((int)c);
+                  }
+                else
+                  {
+                      putchar((int)(((unsigned)c >> 6) + (unsigned)123));
+                      putchar((int)((c & 0x3f) + 32));
+                  }
+            }
+      }
+
+/*
+   *  Send the data for the image with RLE encoding for efficiency.
+   *  Encode each line and send it.
+ */
+    space = (int8 *) HDmalloc(ydim + 128);
+    thisline = (int8 *) wheresmall;
+
+    for (i = 0; i < ydim; i++)
+      {
+          newxsize = rleIt((char *) thisline, (char *) space, (int) xdim);
+          thisline += xdim;     /* increment to next line */
+
+          (void) printf("\033^R;0;%d;%d;%d;rseq^", i * factor, factor, newxsize);
+
+          thischar = space;
+          for (j = 0; j < newxsize; j++)
+            {
+
+/***********************************************************************/
+/*  Encoding of bytes:
+   *
+   *  123 precedes #'s 0-63
+   *  124 precedes #'s 64-127
+   *  125 precedes #'s 128-191
+   *  126 precedes #'s 192-255
+   *  overall:  realchar = (specialchar - 123)*64 + (char-32)
+   *            specialchar = r div 64 + 123
+   *            char = r mod 64 + 32
+ */
+/***********************************************************************/
+
+                c = (unsigned char)*thischar++;    /* get byte to send */
+
+                if ((unsigned)c > (unsigned)31 && (unsigned)c < (unsigned)123)
+                  {
+                      putchar((int)c);
+                  }
+                else
+                  {
+                      putchar((int)((unsigned)(c >> 6) + (unsigned)123));
+                      putchar((int)((c & 0x3f) + 32));
+                  }
+            }
+      }
+
+/*
+   *  pause for the user
+ */
+
+    HDfree(space);
+    return HE_OK;
+}
+
+/*****************************************************************************/
+/* expandimg
+   *  copy an image memory to memory, expanding byte by byte to get a larger image.
+   *  no aliasing, just byte replication
+ */
+int
+bigImg(unsigned char *targ, unsigned char *src)
+{
+    int i, j, line;
+    unsigned char *p, *q, *oldq;
+
+    for (line = 0; line < ydim; line++)
+      {
+          p = src + line * xdim;
+          oldq = q = targ + line * xsize * factor;
+
+          for (i = 0; i < xdim; i++, p++)
+              for (j = 0; j < factor; j++)
+                  *q++ = *p;
+
+          for (i = 1; i < factor; i++)
+            {
+                HDmemcpy(q, oldq, xsize);   /* make one copy of the line */
+                q += xsize;
+            }
+
+      }
+    return HE_OK;
+}
+
+/********************************************************************/
+/*  rleit
+   *  compress the data to go out with a simple run-length encoded scheme.
+   *
+ */
+int
+rleIt(char *buf, char *bufto, int len)
+{
+    char *p, *q, *cfoll, *clead;
+    char       *begp;
+    int         i;
+
+    p = buf;
+    cfoll = bufto;  /* place to copy to */
+    clead = cfoll + 1;
+
+    begp = p;
+    while (len > 0)
+      {     /* encode stuff until gone */
+
+          q = p + 1;
+          i = len - 1;
+          while (*p == *q && i + 120 > len && i)
+            {
+                q++;
+                i--;
+            }
+
+          if (q > p + 2)
+            {   /* three in a row */
+                if (p > begp)
+                  {
+                      *cfoll = (char) (p - begp);
+                      cfoll = clead;
+                  }
+                *cfoll++ = (char) (128 | (q - p));  /* len of seq */
+                *cfoll++ = *p;  /* char of seq */
+                len -= (int) (q - p);   /* subtract len of seq */
+                p = q;
+                clead = cfoll + 1;
+                begp = p;
+            }
+          else
+            {
+                *clead++ = *p++;    /* copy one char */
+                len--;
+                if (p > begp + 120)
+                  {
+                      *cfoll = (char) (p - begp);
+                      cfoll = clead++;
+                      begp = p;
+                  }
+            }
+
+      }
+/*
+   *  fill in last bytecount
+ */
+    if (p > begp)
+        *cfoll = (char) (p - begp);
+    else
+        clead--;    /* don't need count position */
+
+    return ((int) (clead - bufto));     /* how many stored as encoded */
+}
+
+#endif /* IBM6000 */
+
+/* end of display.c */
diff --git a/hdf/util/he_file.c b/hdf/util/he_file.c
new file mode 100644
index 0000000..a2a1aff
--- /dev/null
+++ b/hdf/util/he_file.c
@@ -0,0 +1,620 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: he_file.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/* --- he-file.c  --- file and annotation manipulation routines */
+#include "he.h"
+
+/* get the prototype for the wait() func. */
+#if defined SUN | defined HP9000 | defined IRIX | defined UNIX386
+#include <sys/wait.h>
+#endif /* SUN | HP9000 */
+#if defined _POSIX_SOURCE | defined IRIX
+#include <unistd.h>
+#endif
+
+int
+HEannotate(HE_CMD * cmd)
+{
+    int i;
+    const char       *editor = NULL;
+    int         ann = HE_LABEL;
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] == '-')
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      puts("annotate [-label|-descriptor] [-editor <editor>]");
+                      puts("\tEdit an annotation");
+                      puts("\t-label\t\tEdit label (default)");
+                      puts("\t-descriptor\tEdit descriptor");
+                      puts("\t-editor\t\tUse editor (default EDITOR env value)");
+                      return HE_OK;
+                  case HE_LABEL:
+                      ann = HE_LABEL;
+                      break;
+                  case HE_DESCRIPTOR:
+                      ann = HE_DESCRIPTOR;
+                      break;
+                  case HE_EDITOR:
+                      if (++i < cmd->argc)
+                          editor = cmd->argv[i];
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return HE_FAIL;
+              }
+        else
+          {
+              unkArg(cmd->argv[i]);
+              return HE_FAIL;
+          }
+    return annotate(editor, ann);
+}
+
+/* Edit annontations (labels and descriptions) for the
+ * current data element */
+int
+annotate(const char *editor, int ann)
+{
+
+    int32       len;            /* length of annotation */
+    char       *buf;            /* annotation buffer */
+    char       *file;           /* tmp file name */
+    int i;
+    int         ret;
+
+    /* check if any hdf file is open
+     */
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_FAIL;
+      }
+
+    /* Get the annotation from hdf file
+     */
+    len = getAnn(ann, currTag, he_desc[he_currDesc].ref, &buf);
+
+    (void) getTmpName(&file);
+
+    /* if there is prior annotation, put it into the tmp file
+     */
+    if (len > 0 && buf != NULL)
+      {
+          /* doctor the buffer a little for the editors
+           */
+          if (ann == HE_LABEL)
+              buf[len] = '\n';
+          else
+              len--;
+          writeToFile(file, buf, len + 1);
+          HDfree(buf);
+      }
+
+    /* make sure some editor will be used
+       * defaults to /usr/bin/ex
+       * but should be made a comple time option
+     */
+    if (editor == NULL)
+      {
+          editor = (char *) getenv("EDITOR");
+          if (editor == NULL)
+              editor = "/usr/bin/ex";
+      }
+    /* Use the fork/wait or system methods if supported, else no support. */
+#if defined(H4_HAVE_FORK) && defined(H4_HAVE_WAIT)
+    if (fork() == 0)
+      {
+          /* this is the child */
+          if (execl(editor, editor, file, 0) == -1)
+              fprintf(stderr, "Error while editing label.\n");
+
+          /* return control to the parent if exec fails
+           */
+          exit(0);
+      }
+
+    /* the parent waits for the child to die */
+    wait(0);
+#elif defined(H4_HAVE_SYSTEM)
+    {   char    cmd[256];
+        if (HDstrlen(editor) > 100) {
+            fprintf(stderr, "Environment variable EDITOR too big\n");
+        }
+        else {
+            sprintf(cmd, "%s %s", editor, file);
+            system(cmd);
+        }
+    }
+#endif
+
+    /* read in edited annotation
+     */
+    len = readFromFile(file, &buf);
+    if (len <= 0 || buf == NULL)
+        return len;
+
+    /* doctor the buffer for standard format
+     */
+    if (ann == HE_LABEL)
+      {
+          /* take out control characters from the end */
+          for (i = len; i >= 0 && !isgraph((int)buf[i]); i--)
+              ;
+          buf[i + 1] = '\0';
+      }
+
+    /* forget the tmp file
+     */
+    removeFile(file);
+
+    /* write annotation to the hdf file
+     */
+    ret = putAnn(ann, currTag, he_desc[he_currDesc].ref, buf, len);
+    updateDesc();
+
+    /* clean up
+     */
+    HDfree(buf);
+    return ret;
+}
+
+extern int  he_backup;
+
+int
+HEopen(HE_CMD * cmd)
+{
+    int         backup = YES;
+    int i;
+    char       *file = NULL;
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] != '-')
+          {
+              if (!file)
+                  file = cmd->argv[i];
+              else
+                {
+                    fprintf(stderr, "Only one file allowed.\n");
+                    return FAIL;
+                }
+          }
+        else
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      puts("open <file> [-nobackup]");
+                      puts("\t-nobackup\tDon't make a backup for this file.");
+                      return HE_OK;
+                  case HE_NOBACKUP:
+                      backup = 0;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return FAIL;
+              }
+
+    if (!file)
+      {
+          fprintf(stderr, "Please specify a file name.\n");
+          return FAIL;
+      }
+
+    return openFile(file, backup);
+}
+
+/* openFile -- Internal open file routine. */
+/* Called by:   HEopen, main */
+/* Returns:     HE_OK and FAIL */
+int
+openFile(char *file, int backup)
+{
+    ASSERT(file);
+
+    /* only allow one file at a time */
+    if (fileOpen())
+      {
+          fprintf(stderr, "File: %s is still open. Close before reopening.\n",
+                  he_file);
+          return FAIL;
+      }
+
+    /* Make backup first if necessary */
+    if (backup)
+      {
+          if (backupFile(file) < 0)
+              return FAIL;
+          he_backup = 1;
+      }
+    else
+        he_backup = 0;
+
+    if (initFile(file) < 0)
+        return FAIL;
+
+    return HE_OK;
+}
+
+/* HEclose -- close current file */
+/* Called by HEdoCmd */
+int
+HEclose(HE_CMD * cmd)
+{
+    int i;
+    int         keep = NO;
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] != '-')
+          {
+              unkArg(cmd->argv[i]);
+              return FAIL;
+          }
+        else
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      puts("close [-keep]");
+                      puts("\t-keep\t\tDon't delete the backup file.");
+                      return HE_OK;
+                  case HE_KEEP:
+                      keep = YES;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return FAIL;
+              }
+
+    return closeFile(keep);
+}
+
+int
+HErevert(HE_CMD * cmd)
+{
+    if (cmd->argc < 2)
+        return revert();
+
+    if (cmd->argv[1][0] != '-' || findOpt(cmd->argv[1] + 1) == HE_HELP)
+      {
+          puts("revert");
+          puts("\tDiscard all changes.");
+          return HE_OK;
+      }
+    return HE_FAIL;
+}
+
+int
+HEwrite(HE_CMD * cmd)
+{
+    int i;
+    char       *file;
+    uint16      ref = 0;
+    uint16      tag = 0;
+
+    if (cmd->argc < 2 ||
+        (cmd->argv[1][0] == '-' && findOpt(cmd->argv[1] + 1) == HE_HELP))
+      {
+          puts("write <file> [-attachto <atag> <aref>]");
+          puts("\tWrite an element or group into another HDF file");
+          puts("\t-attchto\tONLY for writing annontations");
+          puts("\t\t\tWhat element to attach annotation to");
+          return HE_OK;
+      }
+
+    file = cmd->argv[1];
+    for (i = 2; i < cmd->argc; i++)
+        if (cmd->argv[i][0] != '-')
+            file = cmd->argv[i];
+        else
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_ATTACHTO:
+                      tag = (uint16) atoi(cmd->argv[++i]);
+                      ref = (uint16) atoi(cmd->argv[++i]);
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return HE_FAIL;
+              }
+    return writ(file, tag, ref);
+}
+
+int
+writ(char *file, uint16 tag, uint16 ref)
+{
+    int         ret;
+    uint16      ref1;
+
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_FAIL;
+      }
+    if (!HDstrcmp(file, he_file))
+      {
+          fprintf(stderr, "Cannot write to self.\n");
+          return HE_FAIL;
+      }
+
+    /* handle special cases */
+    if (isAnnot(currTag))
+        return writeAnnot(file, tag, ref);
+    if (isGrp(currTag))
+        return writeGrp(file);
+
+    if (getNewRef(file, &ref1) < 0)
+        return HE_FAIL;
+
+    ret = writeElt(file, ref1, he_currDesc);
+    return ret;
+}
+
+/* --------------------------- get a r8 from a file ----------------------- */
+
+int
+HEgetR8(HE_CMD * cmd)
+{
+    int i;
+    int         xdim = 0, ydim = 0;
+    char       *image, *pal = NULL;
+    int         compress = 0;
+
+    if (cmd->argc < 4 ||
+        (cmd->argv[1][0] == '-' && findOpt(cmd->argv[1] + 1) == HE_HELP))
+      {
+          puts("getr8 <image> <xdim> <ydim> [-palette <palette>] [-raster|-rle|-imcomp]");
+          puts("\tGet a r8 group from raw files");
+          puts("\t-palette\tRaw palette file");
+          puts("\t-raster\t\tNo compression (default)");
+          puts("\t-rle\t\tRun-length compression");
+          puts("\t-imcomp\t\tImcomp compression");
+          return HE_OK;
+      }
+    image = cmd->argv[1];
+    xdim = atoi(cmd->argv[2]);
+    ydim = atoi(cmd->argv[3]);
+
+    for (i = 4; i < cmd->argc; i++)
+        if (cmd->argv[i][0] == '-')
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_PALETTE:
+                      pal = cmd->argv[++i];
+                      break;
+                  case HE_RASTER:
+                      compress = 0;
+                      break;
+                  case HE_RLE:
+                      compress = HE_RLE;
+                      break;
+                  case HE_IMCOMP:
+                      compress = HE_IMCOMP;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return FAIL;
+              }
+        else
+          {
+              unkArg(cmd->argv[i]);
+              return FAIL;
+          }
+
+    if (!image)
+      {
+          fprintf(stderr, "No image file specified.\n");
+          return FAIL;
+      }
+    if (xdim == 0 || ydim == 0)
+      {
+          fprintf(stderr, "No dimensions specified.\n");
+          return FAIL;
+      }
+    return getR8(xdim, ydim, image, pal, compress);
+}
+
+/* --------------- generic put routines ---------------------- */
+
+int
+HEput(HE_CMD * cmd)
+{
+    int i;
+    int         verbose = NO;
+    char       *template = (char *)"elt#.@";
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] == '-')
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      puts("put [-file <file>] [-verbose]");
+                      puts("\tPut the raw binary of this element in a file");
+                      puts("\t-file\t\tOut file name (default \"elt#.@\")");
+                      puts("\t-verbose\tOutput diagnostic info");
+                      return HE_OK;
+                  case HE_FILE:
+                      template = cmd->argv[++i];
+                      break;
+                  case HE_VERBOSE:
+                      verbose = YES;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return HE_FAIL;
+              }
+        else
+          {
+              unkArg(cmd->argv[i]);
+              return HE_FAIL;
+          }
+    return put(template, verbose);
+}
+
+int
+put(char *template, int verbose)
+{
+    int         length;
+    char       *data;
+    int         ret;
+
+    length = (int) getElement(he_currDesc, &data);
+    if ((length <= 0) || (data == NULL))
+        return HE_FAIL;
+    ret = putWithTempl(template, he_currDesc, length, 1, data, length,
+                       verbose);
+    HDfree(data);
+
+    return ret;
+}
+
+/* ------------------ routines to put an r8 into a file --------------------- */
+
+int
+HEputR8(HE_CMD * cmd)
+{
+    int i;
+    int         verbose = NO;
+    char       *image = "img#. at .%";
+    char       *pal = "pal#";
+
+    for (i = 1; i < cmd->argc; i++)
+        if (cmd->argv[i][0] == '-')
+            switch (findOpt(cmd->argv[i] + 1))
+              {
+                  case HE_HELP:
+                      puts("putr8 [-image <img>] [-palette <pal>] [-verbose]");
+                      puts("\tPut an r8 group into raw image and palette files");
+                      puts("\t-image\t\tImage file name template (default \"img#. at .%\")");
+                      puts("\t-palette\tPalette file name template (default \"pal#\")");
+                      puts("\t-verbose\tTo give output of steps taken");
+                      return HE_OK;
+                  case HE_IMAGE:
+                      image = cmd->argv[++i];
+                      break;
+                  case HE_PALETTE:
+                      pal = cmd->argv[++i];
+                      break;
+                  case HE_VERBOSE:
+                      verbose = YES;
+                      break;
+                  case HE_NOTFOUND:
+                      unkOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  case HE_AMBIG:
+                      ambigOpt(cmd->argv[i]);
+                      return HE_FAIL;
+                  default:
+                      irrOpt(cmd->argv[i]);
+                      return HE_FAIL;
+              }
+        else
+          {
+              unkArg(cmd->argv[i]);
+              return HE_FAIL;
+          }
+    return putR8(image, pal, verbose);
+}
+
+int
+putR8(char *image, char *pal, int verbose)
+{
+    int         ret;
+    int32       xdim, ydim;
+    char       *palette;
+    char       *raster;
+
+    if (!fileOpen())
+      {
+          noFile();
+          return HE_FAIL;
+      }
+    if (!isRig(currTag))
+      {
+          fprintf(stderr, "Current element not an image group.");
+          return HE_FAIL;
+      }
+    getCurrRig(&xdim, &ydim, &palette, &raster);
+    if (raster == NULL)
+      {
+          fprintf(stderr, "Cannot find raster.\n");
+          return HE_FAIL;
+      }
+    ret = putWithTempl(image, he_currDesc, (int) xdim, (int) ydim, raster, (int) (xdim * ydim),
+                       verbose);
+    HDfree(raster);
+    if (ret < 0)
+        return HE_FAIL;
+    if (palette != NULL)
+      {
+          int i;
+          char        p[HE_PALETTE_SZ];
+
+          for (i = 0; i < HE_COLOR_SZ; i++)
+            {
+                p[i] = *palette++;
+                p[HE_COLOR_SZ + i] = *palette++;
+                p[2 * HE_COLOR_SZ + i] = *palette++;
+            }
+          ret = putWithTempl(pal, he_currDesc, (int) xdim, (int) ydim, p,
+                             HE_PALETTE_SZ, verbose);
+          HDfree(palette);
+          if (ret < 0)
+              return HE_FAIL;
+      }
+
+    return HE_OK;
+}
+
+/* end of he-file.c */
diff --git a/hdf/util/he_main.c b/hdf/util/he_main.c
new file mode 100644
index 0000000..74e40bc
--- /dev/null
+++ b/hdf/util/he_main.c
@@ -0,0 +1,1277 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6036 $";
+#endif
+
+/* $Id: he_main.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+/******************************************************************************
+ * he - HDF editor
+ *
+ * This program has a long history, starting with its creation as a tool to
+ * help HDF developers work at a low-level on HDF files.  It has evolved into
+ * user-level program, though it is still designed for small editing tasks on
+ * HDF files.
+ *
+ * he allows sophisticated HDF users to manipulate the elements in an HDF file.
+ * These manipulations include selecting groups and showing information about
+ * them, dumping them to the output, writing them to new files, deleting them,
+ * inserting them, replacing, say, the palette of an r8 group, and editing the
+ * text labels and descriptions of any element.
+ *
+ * he will NOT allow the user to *arbitrarily* modify binary data in the file
+ * or any element, though it allows modification of tag and reference numbers
+ * within strict constraints.  The user should not attempt to alter individual
+ * bytes.  It is acceptable, however, to replace an element with another of
+ * the same type.
+ *
+ * he can be used both interactively or in "batch" mode.  Here is a sample
+ * batch program:
+ *
+ *      #!/bin/csh -f
+ *      set file=$1
+ *      shift
+ *      he -batch $file -nobackup << EOF
+ *      info -all -group $*
+ *      close
+ *      quit
+ *      EOF
+ *
+ * This makes use of C-shell variable substitution to pass a filename to he,
+ * invokes he, and then lists out on separate lines the commands to give once
+ * he is running.  The $* trailing the info command is also C-shell variable
+ * substitution.
+ *
+ * List of commands:       annotate   dump    if      open    putr8    unalias
+ *                         close      getr8   info    prev    revert   wait
+ *                         delete     help    next    put     select   write
+ *                         display
+ *
+ * Predicates are of the form TAG = 3 IMAGE_SIZE < 1000  LABEL = "abc"
+ * Type <command> -help for usage of <command>.  DO NOT type the command
+ * without arguments and expect help.  Some commands delete objects and do not
+ * need any arguments.  If you are learning to use he, try it on an expendable
+ * file.
+ *****************************************************************************/
+/* ------ he.c ------- main() main HDF interfacing routines */
+
+#include "he.h"
+
+#include <stdio.h>
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+/* the return status of last command executed */
+int         he_status = HE_OK;
+
+/* is this on the console or remote terminals?
+   this should eventually be detected automatically */
+int         he_remote = YES;
+
+/* is this batch mode or interactive? */
+extern int  he_batch;
+
+int
+main(int argc, char *argv[])
+{
+    int         backup = YES;   /* Backup files when opening? */
+    int i;
+    char       *fileName = NULL;
+
+    for (i = 1; i < argc; i++)
+      {
+          if (argv[i][0] == '-')
+            {
+                switch (findOpt(argv[i] + 1))
+                  {
+                      case HE_HELP:
+                          printf("he [<file>] [-nobackup] [-batch]\n");
+                          help();
+                          quit(0);
+                          break;
+                      case HE_BATCH:
+                          he_batch = YES;
+                          break;
+                      case HE_REMOTE:
+                          he_remote = YES;
+                          break;
+                      case HE_NOBACKUP:
+                          backup = NO;
+                          break;
+                      case HE_BACKUP:
+                          backup = YES;
+                          break;
+                      case HE_NOTFOUND:
+                          unkOpt(argv[i]);
+                          quit(1);  /* does not return */
+                          break;
+                      case HE_AMBIG:
+                          ambigOpt(argv[i]);
+                          quit(1);
+                          break;
+                      default:
+                          irrOpt(argv[i]);
+                          quit(1);  /* does not return */
+                          break;
+                  }
+            }
+          else
+            {
+                /* Must be a filename */
+                if (!fileName)
+                    fileName = argv[i];
+                else
+                    fprintf(stderr, "Single file only. %s not open.\n", argv[i]);
+            }
+      }
+
+    /* if there is a file name given in the command line, open it */
+
+    if (fileName)
+        he_status = openFile(fileName, backup);
+
+    /* read, execute loop */
+    cmdLoop();
+
+    if (fileOpen())
+        closeFile(YES);     /* close with keep */
+    quit(0);
+    return 0;
+}
+
+/* cmdLoop -- read commands and execute them */
+void
+cmdLoop(void)
+{
+    HE_CMD     *cmd;
+
+    for (cmd = getCmd(); cmd; cmd = getCmd())
+      {
+          if (cmd->func)
+              he_status = (*cmd->func) (cmd);
+          else
+            {
+                fprintf(stderr, "Unknown command: %s.\n", cmd->argv[0]);
+                he_status = HE_FAIL;
+            }
+          deleteCmd(cmd);
+      }
+}
+
+int         he_currDesc;
+int         he_numDesc;
+int         he_numGrp;
+int         he_backup;
+char       *he_file;
+DFdesc      he_desc[HE_DESC_SZ];
+HE_GROUP    he_grp[HE_DESC_SZ];
+
+int32
+getElement(int desc, char **pdata)
+{
+    int32       length;
+    int32       fid;
+
+    length = he_desc[desc].length;
+
+    /* alloc memory to read the element in */
+    *pdata = (char *) HDmalloc(length);
+    if (*pdata == NULL)
+        return FAIL;
+
+    /* read in the element and check for error */
+    if ((fid = Hopen(he_file, DFACC_READ, 0)) == (int32) NULL)
+      {
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+    if (Hgetelement(fid, he_desc[desc].tag, he_desc[desc].ref, (unsigned char *) (*pdata)) < 0)
+      {
+          HDfree(*pdata);
+          fprintf(stderr, "Cannot read element.\n");
+          return FAIL;
+      }
+    Hclose(fid);
+    return length;
+}
+
+/* the tmp directory, currently set for unix */
+#define TDIR "/tmp/"
+
+int
+getTmpName(char **pname)
+{
+    int         length;
+    static int  count = 0;
+    char        s[32];
+
+    (void) sprintf(s, "%she%d.%d", TDIR, (int)getpid(), count);
+    count++;
+
+    length = (int)HDstrlen(s);
+    if (length <= 0)
+        return FAIL;
+
+    *pname = (char *) HDmalloc(length + 1);
+    HDstrcpy(*pname, s);
+
+    return length;
+}
+
+int
+writeToFile(char *file, char *data, int32 length)
+{
+    FILE       *fd;
+    int         written;
+
+    fd = fopen(file, "w");
+    if (fd == NULL)
+        return FAIL;
+
+    written = (int)fwrite(data, sizeof(char), (size_t) length, fd);
+    if (written != length)
+      {
+          fprintf(stderr, "Error in write.\n");
+          return FAIL;
+      }
+    fclose(fd);
+
+    return HE_OK;
+}
+
+int
+removeFile(char *file)
+{
+    return remove((const char *) file);
+}
+
+/* is a file currently opened */
+int
+fileOpen(void)
+{
+    return (he_file != NULL);
+}
+
+char       *
+backupName(const char *file)
+{
+    return catStr(file, "$hdfed$");
+}
+
+int
+backupFile(char *file)
+{
+    char       *back;           /* backup file name */
+
+    back = backupName(file);
+    return copyFile(file, back);
+}
+
+int
+copyFile(char *from, char *to)
+{
+    int         num_read;
+    char        buf[HE_BUF_SZ]; /* copying buffer */
+    FILE       *fp;
+    FILE       *bfp;
+
+    /* open the hdf file for backing up */
+    if ((fp = fopen(from, "r")) == NULL)
+      {
+          fprintf(stderr, "Unable to open file: <%s>\n", from);
+          return FAIL;
+      }
+    if ((bfp = fopen(to, "w")) == NULL)
+      {
+          fclose(fp);
+          fprintf(stderr, "Unable to open backup file.\n");
+          return FAIL;
+      }
+    /* copy the contents from hdf file to backup file */
+    while ((num_read = (int)fread(buf, 1, HE_BUF_SZ, fp)) > 0)
+        fwrite(buf, 1, (size_t)num_read, bfp);
+
+    fclose(fp);
+    fclose(bfp);
+
+    return HE_OK;
+}
+
+int
+updateDesc(void)
+{
+    int32      fid;
+    int32       groupID;
+    int32       aid, status;
+    int i, j;
+
+    if ((fid = Hopen(he_file, DFACC_READ, 0)) == 0)
+      {
+          printf("failed opening\n");
+          HEprint(stdout, 0);
+          return FAIL;
+      }
+
+    aid = Hstartread(fid, DFTAG_WILDCARD, DFREF_WILDCARD);
+    if (aid == FAIL)
+      {
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+
+    status = SUCCEED;
+    for (i = 0; (i < HE_DESC_SZ) && (status != FAIL); i++)
+      {
+          Hinquire(aid, NULL, &he_desc[i].tag, &he_desc[i].ref, &he_desc[i].length,
+                   &he_desc[i].offset, NULL, (int16 *) NULL, (int16 *) NULL);
+          status = Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT);
+      }
+    he_numDesc = i;
+
+    /* get informations about the groups */
+    he_numGrp = 0;
+    for (i = 0; i < he_numDesc; i++)
+      {
+          if (isGrp(he_desc[i].tag))
+            {
+                he_grp[he_numGrp].desc = i;
+/*                he_grp[he_numGrp].size = (int) (he_desc[i].length / sizeof(tag_ref));
+                he_grp[he_numGrp].ddList = (tag_ref_ptr) HDmalloc(he_desc[i].length);
+*/
+                he_grp[he_numGrp].size = (int) (he_desc[i].length / 4);
+                he_grp[he_numGrp].ddList = (tag_ref_ptr) HDmalloc(he_grp[he_numGrp].size*sizeof(tag_ref));
+
+                if (!he_grp[he_numGrp].ddList)
+                  {
+                      fprintf(stderr, "Out of memory. Closing file.\n");
+                      closeFile(1);     /* keep the backup */
+                      return FAIL;
+                  }
+                groupID = DFdiread(fid, he_desc[i].tag, he_desc[i].ref);
+                if (groupID < 0)
+                  {
+                      HEprint(stderr, 0);
+                      return FAIL;
+                  }
+                for (j = 0; j < he_grp[he_numGrp].size; j++)
+                    DFdiget(groupID, &he_grp[he_numGrp].ddList[j].tag,
+                            &he_grp[he_numGrp].ddList[j].ref);
+
+                he_numGrp++;
+            }
+      }
+    Hendaccess(aid);
+    Hclose(fid);
+    return SUCCEED;
+}
+
+int
+initFile(char *file)
+{
+    if (he_file)
+        HDfree(he_file);
+    he_file = copyStr(file);
+
+    if (updateDesc() < 0)
+        return FAIL;
+
+    /* if there are groups in this file, go to the first group tag */
+    /* otherwise, just go to the first element */
+    if (he_numGrp > 0)
+        he_currDesc = he_grp[0].desc;
+    else
+        he_currDesc = 0;
+
+    return resetPred();
+}
+
+int
+closeFile(int keep)
+{
+    int i;
+    char       *back;
+
+    if (!fileOpen())
+      {
+          fprintf(stderr, "No open file to close.\n");
+          return FAIL;
+      }
+    /* free some dynamic storages */
+    if (he_backup && !keep)
+      {
+          back = backupName(he_file);
+          (void) removeFile(back);
+          HDfree(back);
+      }
+    HDfree(he_file);
+    he_file = NULL;
+    for (i = 0; i < he_numGrp; i++)
+        HDfree(he_grp[i].ddList);
+
+    return HE_OK;
+}
+
+int
+getR8(int xdim, int ydim, char *image, char *pal, int compress)
+{
+    FILE       *fp;
+    int32       length;
+    char       *buf;
+
+    if (!fileOpen())
+      {
+          noFile();
+          return FAIL;
+      }
+    if (pal)
+        if (setPal(pal) < 0)
+            /* Error already signalled by setPal */
+            return FAIL;
+
+    length = xdim * ydim;
+    buf = (char *) HDmalloc(length);
+
+    if ((fp = fopen(image, "r")) == NULL)
+      {
+          fprintf(stderr, "Error opening image file: %s.\n", image);
+          return FAIL;
+      }
+    if (fread(buf, (size_t)xdim, (size_t)ydim, fp) < (size_t)ydim)
+      {
+          fprintf(stderr, "Error reading image file: %s.\n", image);
+          return FAIL;
+      }
+    fclose(fp);
+
+    if (DFR8addimage(he_file, buf, (int32) xdim, (int32) ydim, (uint16) compress) < 0)
+      {
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+    HDfree(buf);
+
+    if (updateDesc() < 0)
+        return FAIL;
+
+    return HE_OK;
+}
+
+int
+setPal(char *pal)
+{
+    FILE       *fp;
+    char        reds[HE_COLOR_SZ], greens[HE_COLOR_SZ], blues[HE_COLOR_SZ];
+    char        palette[HE_PALETTE_SZ];
+    char *p;
+    int i;
+
+    if ((fp = fopen(pal, "r")) == NULL)
+      {
+          fprintf(stderr, "Error opening palette file: %s.\n", pal);
+          return FAIL;
+      }
+    if (fread(reds, 1, HE_COLOR_SZ, fp) < HE_COLOR_SZ ||
+        fread(greens, 1, HE_COLOR_SZ, fp) < HE_COLOR_SZ ||
+        fread(blues, 1, HE_COLOR_SZ, fp) < HE_COLOR_SZ)
+      {
+          fprintf(stderr, "Error reading palette file: %s.\n", pal);
+          return FAIL;
+      }
+
+    /* convert sun palette to hdf palette */
+    p = palette;
+    for (i = 0; i < HE_COLOR_SZ; i++)
+      {
+          *p++ = reds[i];
+          *p++ = greens[i];
+          *p++ = blues[i];
+      }
+
+    if (DFR8setpalette((uint8 *) palette) < 0)
+      {
+          fputs("Error setting palette.\n", stderr);
+          return FAIL;
+      }
+
+    return HE_OK;
+}
+
+int
+findDesc(tag_ref_ptr dd)
+{
+    int i;
+
+    for (i = 0; i < he_numDesc; i++)
+        if ((he_desc[i].tag == dd->tag) && (he_desc[i].ref == dd->ref))
+            return i;
+
+    return FAIL;
+}
+
+int
+desc2Grp(int desc)
+{
+    int i;
+
+    for (i = 0; i < he_numGrp; i++)
+        if (he_grp[i].desc == desc)
+            return i;
+
+    NOT_REACHED();
+    return FAIL;
+}
+
+int
+hasReference(int desc)
+{
+    int i, j;
+
+    for (i = 0; i < he_numGrp; i++)
+        for (j = 0; j < he_grp[i].size; j++)
+            if (he_grp[i].ddList[j].tag == he_desc[desc].tag &&
+                he_grp[i].ddList[j].ref == he_desc[desc].ref)
+                return YES;
+    return NO;
+}
+
+int
+deleteDesc(int desc)
+{
+    int32       fid;
+
+    if ((fid = Hopen(he_file, DFACC_WRITE, 0)) == (int32) NULL)
+      {
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+
+    if (Hdeldd(fid, he_desc[desc].tag, he_desc[desc].ref) == FAIL)
+      {
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+    return Hclose(fid);
+}
+
+int
+getCurrRig(int32 *pXdim, int32 *pYdim, char **pPalette, char **pRaster)
+{
+    int         ispal;
+
+    goTo(he_currDesc);
+
+    if (DFR8getdims(he_file, pXdim, pYdim, &ispal) < 0)
+      {
+          fprintf(stderr, "Error getting image group.\n");
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+    if (ispal)
+        *pPalette = (char *) HDmalloc(HE_PALETTE_SZ);
+    else
+        *pPalette = (char *) NULL;
+    *pRaster = (char *) HDmalloc((size_t)(*pXdim) * (size_t)(*pYdim));
+
+    if (DFR8getimage(he_file, (unsigned char *) *pRaster, *pXdim, *pYdim,
+                     (unsigned char *) *pPalette) == FAIL)
+      {
+          fprintf(stderr, "Error getting image group.\n");
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+
+    return HE_OK;
+}
+
+int
+putWithTempl(char *template, int n1, int n2, int n3, char *data, int length, int verbose)
+{
+    char       *file;
+    int         ret;
+
+    convertTemplate(template, n1, n2, n3, &file);
+    if (verbose)
+        printf("Writing to file: %s\n", file);
+    ret = writeToFile(file, data, length);
+    HDfree(file);
+
+    return ret;
+}
+
+int
+revert(void)
+{
+    char       *back;
+
+    back = backupName(he_file);
+    if (copyFile(back, he_file) < 0)
+        return FAIL;
+    return initFile(he_file);
+}
+
+int
+writeElt(char *file, uint16 ref, int elt)
+{
+    int         ret;
+    char       *data;
+    int32       eltLength;
+    char       *p;
+    uint16      rank;
+    int i;
+    uint16      ntTag;
+    uint16      ntRef;
+    tag_ref_ptr ntDesc;
+    int         nt;
+
+    eltLength = getElement(elt, &data);
+    if (eltLength <= 0)
+      {
+          fprintf(stderr, "Cannot get element: tag %d ref %d.\n",
+                  he_desc[elt].tag, he_desc[elt].ref);
+          return FAIL;
+      }
+    /* special case */
+
+    if (he_desc[elt].tag == DFTAG_SDD)
+      {
+
+          /* lots of hack here */
+          /* assume that the number types are of the same ref as this elt */
+          p = data;
+
+          /* get the rank */
+          /* NOTE: UINT16READ and UINT16WRITE advances p */
+          UINT16DECODE(p, rank);
+          /* move to the NT of the data */
+          p += (rank * 4);
+          UINT16DECODE(p, ntTag);
+          UINT16DECODE(p, ntRef);
+
+          /* set up to write the number type element */
+          ntDesc = (tag_ref_ptr) HDmalloc(sizeof(tag_ref));
+          ntDesc->tag = ntTag;
+          ntDesc->ref = ntRef;
+          nt = findDesc(ntDesc);
+          HDfree(ntDesc);
+          writeElt(file, ref, nt);
+
+          p -= 2;
+          UINT16ENCODE(p, ref);
+          /* do the NT of scales */
+          for (i = 0; (uint16) i < rank; i++)
+            {
+                p += 2;
+                UINT16ENCODE(p, ref);
+            }
+      }
+
+    ret = putElement(file, he_desc[elt].tag, ref, data, eltLength);
+    HDfree(data);
+    return ret;
+}
+
+int
+putElement(char *file, uint16 tag, uint16 ref, char *data, int32 len)
+{
+    int32       ret;
+    int32       fid;
+
+    if ((fid = Hopen(file, DFACC_READ | DFACC_WRITE, 0)) == FAIL)
+        /* a little tricky here */
+        if (HEvalue(0) != DFE_FNF || (fid = Hopen(file, DFACC_ALL, 0)) == FAIL)
+          {
+              HEprint(stderr, 0);
+              return FAIL;
+          }
+    if ((ret = Hputelement(fid, tag, ref, (unsigned char *) data, len)) < 0)
+      {
+          HEprint(stderr, 0);
+          return (int) ret;
+      }
+    return Hclose(fid);
+}
+
+int
+writeGrp(char *file)
+{
+    int i;
+    uint16      ref;
+    int         grp;
+    int         elt;
+    int         ret;
+    int32       fid;
+    int32       gid;
+
+    getNewRef(file, &ref);
+
+    grp = currGrpNo;
+    gid = DFdisetup(he_grp[grp].size);
+    for (i = 0; i < he_grp[grp].size; i++)
+      {
+          elt = findDesc(he_grp[grp].ddList + i);
+          if (elt >= 0)
+              writeElt(file, ref, elt);
+          /* update the group dd list */
+          DFdiput(gid, he_grp[grp].ddList[i].tag, ref);
+      }
+    /* do the group now */
+
+    if ((fid = Hopen(file, DFACC_READ | DFACC_WRITE, 0)) == FAIL)
+      {
+          HEprint(stderr, 0);
+          return FAIL;
+      }
+    if ((ret = DFdiwrite(fid, gid, currTag, ref)) < 0)
+      {
+          HEprint(stderr, 0);
+          return ret;
+      }
+    return Hclose(fid);
+}
+
+int
+getNewRef(char *file, uint16 *pRef)
+{
+    int32       fid;
+
+    if ((fid = Hopen(file, DFACC_READ | DFACC_WRITE, 0)) == FAIL)
+        /* a little tricky here */
+        if (HEvalue(0) != DFE_FNF || (fid = Hopen(file, DFACC_ALL, 0)) == FAIL)
+          {
+              HEprint(stderr, 0);
+              return FAIL;
+          }
+    *pRef = Hnewref(fid);
+    return Hclose(fid);
+}
+
+int
+writeAnnot(char *file, uint16 tag, uint16 ref)
+{
+    char       *data;
+    int32       eltLength;
+    intn        tmp;
+    char       *p;
+    uint16      newRef;
+
+    while (tag == 0)
+      {
+          printf("Attach to what tag? (> 0)");
+          scanf("%d", &tmp);
+          tag = (uint16) tmp;
+      }
+
+    while (ref == 0)
+      {
+          printf("Attach to what ref? (> 0)");
+          scanf("%d", &tmp);
+          ref = (uint16) tmp;
+      }
+
+    eltLength = getElement(he_currDesc, &data);
+    if (eltLength <= 0)
+      {
+          fprintf(stderr, "Cannot get element: tag %d ref %d.\n",
+                  he_desc[he_currDesc].tag, he_desc[he_currDesc].ref);
+          return FAIL;
+      }
+
+    p = data;
+
+    /*
+     *  This is really ugly...
+     */
+    UINT16ENCODE(p, tag);
+    UINT16ENCODE(p, ref);
+
+    if (getNewRef(file, &newRef) < 0)
+      {
+          fprintf(stderr, "Error getting new ref number.\n");
+          return FAIL;
+      }
+
+    return putElement(file, he_desc[he_currDesc].tag, newRef, data, eltLength);
+}
+
+int32
+getAnn(int ann, uint16 tag, uint16 ref, char **pBuf)
+{
+    int32       len;
+
+    if (ann == HE_LABEL)
+      {
+          len = DFANgetlablen(he_file, tag, ref);
+          if (len > 0)
+            {
+                *pBuf = (char *) HDmalloc((size_t)(len + 1));
+                DFANgetlabel(he_file, tag, ref, *pBuf, len + 1);
+            }
+          else
+              *pBuf = NULL;
+      }
+    else
+      {
+          len = DFANgetdesclen(he_file, tag, ref);
+          if (len > 0)
+            {
+                *pBuf = (char *) HDmalloc((size_t)len);
+                DFANgetdesc(he_file, tag, ref, *pBuf, len);
+            }
+          else
+              *pBuf = NULL;
+      }
+    return len;
+}
+
+int
+putAnn(int ann, uint16 tag, uint16 ref, char *buf, int32 len)
+{
+    int         ret;
+
+    if (ann == HE_LABEL)
+        ret = DFANputlabel(he_file, tag, ref, buf);
+    else
+        ret = DFANputdesc(he_file, tag, ref, buf, len);
+    if (ret < 0)
+        HEprint(stderr, 0);
+
+    return ret;
+}
+
+int32
+readFromFile(char *file, char **pBuf)
+{
+    FILE       *fp;
+    int32       soFar;
+    int32       bufLen;
+    int32       num_read;
+
+    fp = fopen(file, "r");
+    if (fp == NULL)
+        return FAIL;
+
+    soFar = 0;
+    bufLen = 0;
+    for (num_read = HE_BUF_SZ; num_read == HE_BUF_SZ; soFar += num_read)
+      {
+          bufLen += HE_BUF_SZ;
+          if (bufLen == HE_BUF_SZ)
+              *pBuf = (char *) HDmalloc(bufLen);
+          else
+              *pBuf = (char *) HDrealloc(*pBuf, bufLen);
+          if (*pBuf == NULL)
+              return FAIL;
+
+          num_read = (int32)fread((*pBuf) + soFar, 1, HE_BUF_SZ, fp);
+      }
+    *pBuf = (char *) HDrealloc(*pBuf, soFar + 1);
+    (*pBuf)[soFar] = '\0';
+    fclose(fp);
+    return soFar;
+}
+
+/* ---- table for operators -------- */
+struct
+{
+    const char *str;
+    int         key;
+}
+he_optTab[] =
+{
+    {
+        "readonly", HE_RDONLY
+    }
+    ,
+    {
+        "all", HE_ALL
+    }
+    ,
+    {
+        "backup", HE_BACKUP
+    }
+    ,
+    {
+        "batch", HE_BATCH
+    }
+    ,
+    {
+        "help", HE_HELP
+    }
+    ,
+    {
+        "longout", HE_LONGOUT
+    }
+    ,
+    {
+        "nobackup", HE_NOBACKUP
+    }
+    ,
+    {
+        "remote", HE_REMOTE
+    }
+    ,
+    {
+        "verbose", HE_VERBOSE
+    }
+    ,
+    {
+        "position", HE_POSITION
+    }
+    ,
+    {
+        "expansion", HE_EXPANSION
+    }
+    ,
+    {
+        "large", HE_LARGE
+    }
+    ,
+    {
+        "offset", HE_OFFSET
+    }
+    ,
+    {
+        "ascii", HE_ASCII
+    }
+    ,
+    {
+        "octal", HE_OCTAL
+    }
+    ,
+    {
+        "hexadecimal", HE_HEX
+    }
+    ,
+    {
+        "decimal", HE_DECIMAL
+    }
+    ,
+    {
+        "float", HE_FLOAT
+    }
+    ,
+    {
+        "dimensions", HE_DIMS
+    }
+    ,
+    {
+        "image", HE_IMAGE
+    }
+    ,
+    {
+        "palette", HE_PALETTE
+    }
+    ,
+    {
+        "raster", HE_RASTER
+    }
+    ,
+    {
+        "rle", HE_RLE
+    }
+    ,
+    {
+        "compress", HE_RLE
+    }
+    ,
+    {
+        "imcomp", HE_IMCOMP
+    }
+    ,
+    {
+        "group", HE_DOGROUP
+    }
+    ,
+    {
+        "file", HE_FILE
+    }
+    ,
+    {
+        "keep", HE_KEEP
+    }
+    ,
+    {
+        "length", HE_LENGTH
+    }
+    ,
+    {
+        "attachto", HE_ATTACHTO
+    }
+    ,
+    {
+        "label", HE_LABEL
+    }
+    ,
+    {
+        "descriptor", HE_DESCRIPTOR
+    }
+    ,
+    {
+        "editor", HE_EDITOR
+    }
+    ,
+    {
+        "byte", HE_BYTE
+    }
+    ,
+    {
+        "short", HE_SHORT
+    }
+    ,
+    {
+        "double", HE_DOUBLE
+    }
+    ,
+    {
+        "ushort", HE_USHORT
+    }
+    ,
+    {
+        "udecimal", HE_UDECIMAL
+    }
+    ,
+    {
+        "raw", HE_RAW
+    }
+    ,
+};
+
+int
+findOpt(char *word)
+{
+    unsigned    len;
+    int         found = -1;
+    uintn i;
+
+    len = HDstrlen(word);
+
+    for (i = 0; i < sizeof(he_optTab) / sizeof(he_optTab[0]); i++)
+        if (!HDstrncmp(he_optTab[i].str, word, len))
+          {
+              /* exact match */
+              if (HDstrlen(he_optTab[i].str) == len)
+                  return he_optTab[i].key;
+
+              if (found < 0)
+                  found = (int)i;
+              else
+                  return HE_AMBIG;
+          }
+
+    if (found < 0)
+        return HE_NOTFOUND;
+
+    return he_optTab[found].key;
+}
+
+char       *
+catStr(const char *s, const char *s1)
+{
+    char       *t;
+
+    t = (char *) HDmalloc(HDstrlen(s) + HDstrlen(s1) + 1);
+    HDstrcpy(t, s);
+    HDstrcat(t, s1);
+    return t;
+}
+
+char       *
+copyStr(char *s)
+{
+    char       *t;
+
+    t = (char *) HDmalloc(HDstrlen(s) + 1);
+    HDstrcpy(t, s);
+    return t;
+}
+
+int
+isGrp(uint16 tag)
+{
+    switch (tag)
+      {
+          case DFTAG_RIG:
+          case DFTAG_SDG:
+          case DFTAG_NDG:
+              /* and other group tags */
+              return 1;
+          default:
+              return 0;
+      }
+}
+
+int
+HEquit(HE_CMD * cmd)
+{
+    if (cmd->argc > 1)
+      {
+          puts("quit");
+          puts("\tQuits this application.");
+          return HE_OK;
+      }
+    return quit(0);
+}
+
+int
+quit(int status)
+{
+    if (fileOpen())
+      {
+          if (closeFile(0) < 0)
+              return HE_FAIL;
+      }
+    exit(status);
+    return(status);	/* never excuted.  Just to shut up some comilers */
+}
+
+int
+HEhelp(HE_CMD * dummy)
+{
+    /* shut compiler up */
+    dummy = dummy;
+
+    help();
+    return HE_OK;
+}
+
+void
+help(void)
+{
+    /* print some help informations */
+    printf("hdfed allows sophisticated HDF users to manipulate the elements in");
+    printf(" an HDF file.\nThese manipulations include selecting groups and ");
+    printf("showing information about\nthem, dumping them to the output, ");
+    printf("writing them to new files, deleting them,\ninserting them, ");
+    printf("replacing, say, the palette of an r8 group, and editing the\n");
+    printf("text labels and descriptions of any element.\n\n");
+
+    printf("hdfed will NOT allow the user to *arbitrarily* modify binary data ");
+    printf("in the file or\nany element, though it allows modification of tag ");
+    printf("and reference numbers within\nstrict constraints.  The user should");
+    printf(" not attempt to alter individual bytes.  It\nis acceptable,");
+    printf(" however, to replace an element with another of the same type.\n\n");
+
+    printf("hdfed can be used both interactively or in 'batch' mode.  See the ");
+    printf("\"HDF Calling\nInterfaces and Utilities\" manual section on hdfed ");
+    printf("for an example.\n\n");
+
+    printf("List of commands:");
+    printf("\tannotate   dump    if      open    putr8    unalias\n");
+    printf("\t\t\tclose      getr8   info    prev    revert   wait\n");
+    printf("\t\t\tdelete     help    next    put     select   write\n");
+
+    printf("\nPredicates for 'if' 'select' 'next' and 'prev' are of the form\n");
+    printf("\ttag = 3 ref = 2 image_size < 1000 label = \"abc\"\n");
+    printf("Type <command> -help for usage of <command>.  DO NOT type the");
+    printf(" command without\narguments and expect help.  Some commands delete");
+    printf(" objects and do not need any\narguments.  If you are learning to ");
+    printf("use hdfed, try it on an expendable file.\n");
+
+}
+
+int
+HEwait(HE_CMD * cmd)
+{
+    int         c;
+
+    if (cmd->argv[1][0] == '-' && findOpt(cmd->argv[1] + 1) == HE_HELP)
+      {
+          printf("wait [<message>]\n");
+          printf("\tPrints message and then wait for user to hit return\n");
+          return HE_OK;
+      }
+
+    printf("%s\nPress return to continue.", cmd->argv[1]);
+    do
+        c = getchar();
+    while (c != '\n');
+
+    return HE_OK;
+}
+
+void
+deleteCmd(HE_CMD * cmd)
+{
+    intn i;
+
+    if (cmd == NULL)
+        return;
+    if (cmd->next != NULL)
+        deleteCmd(cmd->next);
+    if (cmd->sub != NULL)
+        deleteCmd(cmd->sub);
+    for (i = 0; i < cmd->argc; i++)
+        if (cmd->argv[i] != NULL)
+            HDfree(cmd->argv[i]);
+    HDfree(cmd);
+}
+
+/* -------------- routines to manipulate templates --------------------- */
+
+#define TEMPLATE_CHAR1 '#'
+#define TEMPLATE_CHAR2 '@'
+#define TEMPLATE_CHAR3 '%'
+
+void
+convertTemplate(char *template, int n1, int n2, int n3, char **pname)
+{
+    char        s1[20], s2[20], s3[20];
+    char       *t;
+
+    sprintf(s1, "%1d", n1);
+    sprintf(s2, "%1d", n2);
+    sprintf(s3, "%1d", n3);
+
+    *pname = t = (char *) HDmalloc(HDstrlen(template) + 61);
+
+    while (*template)
+        switch (*template)
+          {
+              case TEMPLATE_CHAR1:
+                  fillTemplate(&template, &t, s1, TEMPLATE_CHAR1);
+                  break;
+              case TEMPLATE_CHAR2:
+                  fillTemplate(&template, &t, s2, TEMPLATE_CHAR2);
+                  break;
+              case TEMPLATE_CHAR3:
+                  fillTemplate(&template, &t, s3, TEMPLATE_CHAR3);
+                  break;
+              default:
+                  *t++ = *template++;
+          }
+    *t = '\0';
+}
+
+void
+fillTemplate(char **template, char **pout, char *s, char templateChar)
+{
+    int         templateLen, sLen;
+
+    /* count length of template to replace */
+    for (templateLen = 0; **template == templateChar;
+         (*template)++, templateLen++) ;
+    sLen = (int)HDstrlen(s);
+
+    /* fill with zero's if the space reserved in template is
+       longer than the length of s */
+    for (; templateLen > sLen; templateLen--)
+        *(*pout)++ = '0';
+
+    while (*s)
+        *(*pout)++ = *s++;
+}
+
+/* end of he-main.c */
diff --git a/hdf/util/he_proto.h b/hdf/util/he_proto.h
new file mode 100644
index 0000000..946c143
--- /dev/null
+++ b/hdf/util/he_proto.h
@@ -0,0 +1,309 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: he_proto.h 4937 2007-09-10 16:36:16Z pvn $ */
+
+/* Prototypes for hdfed functions */
+int         HEalias
+            (HE_CMD * cmd);
+
+int         HEannotate
+            (HE_CMD * cmd);
+
+int         HEclose
+            (HE_CMD * cmd);
+
+int         HEdelete
+            (HE_CMD * cmd);
+
+int         HEdisplay
+            (HE_CMD * cmd);
+
+int         HEdump
+            (HE_CMD * cmd);
+
+int         HEgetR8
+            (HE_CMD * cmd);
+
+int         HEhelp
+            (HE_CMD * cmd);
+
+int         HEif
+            (HE_CMD * cmd);
+
+int         HEinfo
+            (HE_CMD * cmd);
+
+int         HEnext
+            (HE_CMD * cmd);
+
+int         HEopen
+            (HE_CMD * cmd);
+
+int         HEprev
+            (HE_CMD * cmd);
+
+int         HEput
+            (HE_CMD * cmd);
+
+int         HEputR8
+            (HE_CMD * cmd);
+
+int         HEquit
+            (HE_CMD * cmd);
+
+int         HErevert
+            (HE_CMD * cmd);
+
+int         HEselect
+            (HE_CMD * cmd);
+
+int         HEunalias
+            (HE_CMD * cmd);
+
+int         HEwait
+            (HE_CMD * cmd);
+
+int         HEwrite
+            (HE_CMD * cmd);
+
+int         annotate
+            (const char *editor, int ann);
+
+int         backupFile
+            (char *file);
+
+char       *backupName
+            (const char *file);
+
+int         bigImg
+            (unsigned char *targ, unsigned char *src);
+
+char       *catStr
+            (const char *s1, const char *s2);
+
+int         closeFile
+            (int keep);
+
+void        cmdLoop
+            (void);
+
+void        convertTemplate
+            (char *template, int n1, int n2, int n3, char **pname);
+
+int         copyFile
+            (char *from, char *to);
+
+char       *copyStr
+            (char *str);
+
+int         delete
+            (int curr);
+
+void        deleteCmd
+            (HE_CMD * cmd);
+
+int         deleteDesc
+            (int desc);
+
+int         desc2Grp
+            (int desc);
+
+int         display
+            (int c, int x, int y, int f, int l);
+
+int         HEIdump
+            (int32 length, int offset, char *foramt, int raw);
+
+int         fileOpen
+            (void);
+
+void        fillTemplate
+            (char **template, char **pout, char *s, char templateChar);
+
+HE_CMD     *findAlias
+            (char *str);
+
+int         findDesc
+            (tag_ref_ptr dd);
+
+HE_FUNC     findFunc
+            (char *word);
+
+int         findKey
+            (char *word);
+
+int         findOpt
+            (char *word);
+
+int32       getAnn
+            (int ann, uint16 tag, uint16 ref, char **pBuf);
+
+HE_CMD     *getCmd
+            (void);
+
+int         getCurrRig
+            (int32 *pXdim, int32 *pYdim, char **pPalette, char **pRaster);
+
+int32       getElement
+            (int desc, char **pdata);
+
+int         getLine
+            (char *);
+
+int         getNewRef
+            (char *file, uint16 *pRef);
+
+int         getPix
+            (void);
+
+int         getR8
+            (int xdim, int ydim, char *image, char *pal, int compress);
+
+int         getSpace
+            (void);
+
+int         getTmpName
+            (char **pname);
+
+void        goTo
+            (int desc);
+
+int         hasReference
+            (int desc);
+
+void        help
+            (void);
+
+int         info
+            (int all, int longout, int group, int label);
+
+void        infoDesc
+            (int desc, int longout, int label);
+
+int         initFile
+            (char *file);
+
+int         isGrp
+            (uint16 tag);
+
+int         isNumber
+            (char *s);
+
+int         largeSet
+            (void);
+
+int         main
+            (int argc, char *argv[]);
+
+HE_CMD     *mkDupCmd
+            (HE_CMD * cmd);
+
+char       *nextToken
+            (char **p);
+
+char       *nextWord
+            (char **p);
+
+int         numCompare
+            (int n1, int Comp, int n2);
+
+int         od
+            (char *format, char *file);
+
+int         openFile
+            (char *file, int backup);
+
+HE_CMD     *parse
+            (void);
+
+HE_CMD     *parseCmd
+            (char **p);
+
+HE_PRED    *parsePred
+            (int argc, char *argv[]);
+
+int         pixImage
+            (int usepal);
+
+void        printAlias
+            (char *word, HE_CMD * cmd);
+
+void        prompt
+            (void);
+
+int         put
+            (char *template, int verbose);
+
+int         putAnn
+            (int ann, uint16 tag, uint16 ref, char *buf, int32 len);
+
+int         putElement
+            (char *file, uint16 tag, uint16 ref, char *data, int32 len);
+
+int         putR8
+            (char *image, char *pal, int verbose);
+
+int         putWithTempl
+            (char *template, int n1, int n2, int n3, char *data, int length, int verbose);
+
+int         quit
+            (int status);
+
+int         rImage
+            (int usepal);
+
+int32       readFromFile
+            (char *file, char **pBuf);
+
+int         recurseDel
+            (int curr);
+
+int         removeFile
+            (char *file);
+
+int         resetPred
+            (void);
+
+int         revert
+            (void);
+
+int         rleIt
+            (char *buf, char *bufto, int len);
+
+int         satPred
+            (DFdesc * desc, HE_PRED pred[]);
+
+int         setAlias
+            (char *str, HE_CMD * cmd);
+
+int         setPal
+            (char *pal);
+
+int         updateDesc
+            (void);
+
+int         writ
+            (char *file, uint16 tag, uint16 ref);
+
+int         writeAnnot
+            (char *file, uint16 tag, uint16 ref);
+
+int         writeElt
+            (char *file, uint16 ref, int elt);
+
+int         writeGrp
+            (char *file);
+
+int         writeToFile
+            (char *file, char *data, int32 length);
diff --git a/hdf/util/jpeg2hdf.c b/hdf/util/jpeg2hdf.c
new file mode 100644
index 0000000..802d885
--- /dev/null
+++ b/hdf/util/jpeg2hdf.c
@@ -0,0 +1,570 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: jpeg2hdf.c 6013 2014-01-10 21:19:02Z acheng $ */
+#include "hdf.h"
+#ifndef I860
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#endif /* I860 */
+
+/* Size of the file buffer to copy through */
+#define MAX_FILE_BUF    16384
+
+typedef enum
+  {                             /* JPEG marker codes */
+      M_SOF0 = 0xc0,
+      M_SOF1 = 0xc1,
+      M_SOF2 = 0xc2,
+      M_SOF3 = 0xc3,
+
+      M_SOF5 = 0xc5,
+      M_SOF6 = 0xc6,
+      M_SOF7 = 0xc7,
+
+      M_JPG = 0xc8,
+      M_SOF9 = 0xc9,
+      M_SOF10 = 0xca,
+      M_SOF11 = 0xcb,
+
+      M_SOF13 = 0xcd,
+      M_SOF14 = 0xce,
+      M_SOF15 = 0xcf,
+
+      M_DHT = 0xc4,
+
+      M_DAC = 0xcc,
+
+      M_RST0 = 0xd0,
+      M_RST1 = 0xd1,
+      M_RST2 = 0xd2,
+      M_RST3 = 0xd3,
+      M_RST4 = 0xd4,
+      M_RST5 = 0xd5,
+      M_RST6 = 0xd6,
+      M_RST7 = 0xd7,
+
+      M_SOI = 0xd8,
+      M_EOI = 0xd9,
+      M_SOS = 0xda,
+      M_DQT = 0xdb,
+      M_DNL = 0xdc,
+      M_DRI = 0xdd,
+      M_DHP = 0xde,
+      M_EXP = 0xdf,
+
+      M_APP0 = 0xe0,
+      M_APP15 = 0xef,
+
+      M_JPG0 = 0xf0,
+      M_JPG13 = 0xfd,
+      M_COM = 0xfe,
+
+      M_TEM = 0x01,
+
+      M_ERROR = 0x100
+  }
+JPEG_MARKER;
+
+PRIVATE int32 num_bytes;        /* number of bytes until the SOS code. */
+PRIVATE int32 image_width = 0;  /* width of the JPEG image in pixels */
+PRIVATE int32 image_height = 0; /* height of the JPEG image in pixels */
+PRIVATE intn num_components = 0;    /* number of components in the JPEG image */
+PRIVATE uint8 file_buf[MAX_FILE_BUF];   /* size of the buffer to copy through */
+
+/*
+ * Routines to parse JPEG markers & save away the useful info.
+ */
+
+static intn
+jgetc(FILE * f)
+/* Get a 2-byte unsigned integer (e.g., a marker parameter length field) */
+{
+    intn        a;
+
+    a = fgetc(f);
+    if (a != EOF)
+        num_bytes++;
+    return (a);
+}
+
+static int32
+get_2bytes(FILE * f)
+/* Get a 2-byte unsigned integer (e.g., a marker parameter length field) */
+{
+    int32       a;
+
+    a = jgetc(f);
+    return (a << 8) + jgetc(f);
+}
+
+static      VOID
+get_sof(FILE * f)
+/* Process a SOFn marker */
+{
+    short       ci;
+    int         data_precision;
+
+    (VOID) get_2bytes(f);
+
+    data_precision = jgetc(f);
+    image_height = get_2bytes(f);
+    image_width = get_2bytes(f);
+    num_components = jgetc(f);
+
+    for (ci = 0; ci < num_components; ci++)
+      {
+          jgetc(f);
+          jgetc(f);
+          jgetc(f);
+      }
+}
+
+static      VOID
+skip_variable(FILE * f)
+/* Skip over an unknown or uninteresting variable-length marker */
+{
+    int32       length;
+
+    length = get_2bytes(f);
+
+    for (length -= 2; length > 0; length--)
+        (VOID) jgetc(f);
+}
+
+static intn
+next_marker(FILE * f)
+/* Find the next JPEG marker */
+/* Note that the output might not be a valid marker code, */
+/* but it will never be 0 or FF */
+{
+    intn        c, nbytes;
+
+    nbytes = 0;
+    do
+      {
+          do
+            {   /* skip any non-FF bytes */
+                nbytes++;
+                c = jgetc(f);
+            }
+          while (c != 0xFF);
+          do
+            {   /* skip any duplicate FFs */
+                nbytes++;
+                c = jgetc(f);
+            }
+          while (c == 0xFF);
+      }
+    while (c == 0);     /* repeat if it was a stuffed FF/00 */
+
+    return c;
+}
+
+static      JPEG_MARKER
+process_tables(FILE * f)
+/* Scan and process JPEG markers that can appear in any order */
+/* Return when an SOI, EOI, SOFn, or SOS is found */
+{
+    int         c;
+
+    while (TRUE)
+      {
+          c = next_marker(f);
+
+          switch (c)
+            {
+                case M_EOI:
+                    return ((JPEG_MARKER) c);
+
+                case M_SOF0:
+                case M_SOF1:
+                case M_SOF9:
+                    get_sof(f);
+                    return ((JPEG_MARKER) c);
+
+                case M_RST0:    /* these are all parameterless */
+                case M_RST1:
+                case M_RST2:
+                case M_RST3:
+                case M_RST4:
+                case M_RST5:
+                case M_RST6:
+                case M_RST7:
+                case M_TEM:
+                    break;
+
+                default:    /* must be DNL, DHP, EXP, APPn, JPGn, COM, or RESn */
+                    skip_variable(f);
+                    break;
+            }
+      }
+}
+
+/*
+ * Initialize and read the file header (everything through the SOF marker).
+ */
+
+static int32
+read_file_header(FILE * f)
+{
+    int         c;
+
+    num_bytes = 0;  /* reset the number of bytes into the file we are */
+
+    /* Demand an SOI marker at the start of the file --- otherwise it's
+     * probably not a JPEG file at all.  If the user interface wants to support
+     * nonstandard headers in front of the SOI, it must skip over them itself
+     * before calling jpeg_decompress().
+     */
+    if (jgetc(f) != 0xFF || jgetc(f) != M_SOI)
+        return (0);
+
+    /* Process markers until SOF */
+    c = (int)process_tables(f);
+
+    switch (c)
+      {
+          case M_SOF0:      /* ok, now we know the correct number of bytes to grab */
+          case M_SOF1:
+          case M_SOF9:
+#ifdef OLD_WAY
+              return (num_bytes - 2);
+#else
+              return (num_bytes);
+#endif
+
+          default:
+              return (0);
+      }
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    DFJPEGaddrig
+ * Purpose: Write RIG struct for the new JPEG image out to HDF file
+ * Inputs:  file_id: HDF file pointer
+ *          ref: ref to write RIG with
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   hopefully only routines in this utility
+ * Invokes: DFdistart, DFdiadd, DFdiend, DFputelement
+ * Remarks: another really, really, nasty hack brought to you by QAK in the
+ *          interest of not decompressing the JPEG image before stuffing it
+ *          into the HDF file...
+ *---------------------------------------------------------------------------*/
+
+static intn
+DFJPEGaddrig(int32 file_id, uint16 ref, uint16 ctag)
+{
+#ifdef OLD_WAY
+    char       *FUNC = "DFJPEGaddrig";
+#endif
+    uint8       ntstring[4];
+#ifdef OLD_WAY
+    int32       lutsize;
+#endif
+    int32       GroupID;
+    uint8      *p;
+
+    ntstring[0] = DFNT_VERSION;     /* version */
+    ntstring[1] = DFNT_UCHAR;   /* type */
+    ntstring[2] = 8;    /* width: RIG data is 8-bit chars */
+    ntstring[3] = DFNTC_BYTE;   /* class: data are numeric values */
+    if (Hputelement(file_id, DFTAG_NT, ref,
+                    (uint8 *) ntstring, (int32) 4) == FAIL)
+        return FAIL;
+#ifdef OLD_WAY
+    rig->datadesc[IMAGE].nt.tag = DFTAG_NT;
+    rig->datadesc[IMAGE].nt.ref = ref;
+
+    if (Ref.dims[IMAGE] == 0)
+      {
+#endif
+          p = file_buf;
+          INT32ENCODE(p, image_width);  /* width */
+          INT32ENCODE(p, image_height);     /* height */
+          UINT16ENCODE(p, DFTAG_NT);    /* number type */
+          UINT16ENCODE(p, ref);
+          INT16ENCODE(p, num_components);   /* number of components */
+          INT16ENCODE(p, 0);    /* interlace scheme */
+          UINT16ENCODE(p, ctag);    /* compression type */
+          UINT16ENCODE(p, ref);
+          if (Hputelement(file_id, DFTAG_ID, ref,
+                          file_buf, (int32) (p - file_buf)) == FAIL)
+              return FAIL;
+
+#ifdef OLD_WAY
+          Ref.dims[IMAGE] = ref;
+      }
+    if (!Ref.lut)
+      {     /* associated lut not written to this file */
+          if (Grlutdata == NULL)
+            {   /* no lut associated */
+                HERROR(DFE_ARGS);
+                return FAIL;
+            }
+          lutsize = Grwrite.datadesc[LUT].xdim * Grwrite.datadesc[LUT].ydim *
+              Grwrite.datadesc[LUT].ncomponents;
+          if (Hputelement(file_id, DFTAG_LUT, ref,
+                          Grlutdata, (int32) lutsize) == FAIL)
+              return FAIL;
+          rig->data[LUT].tag = DFTAG_LUT;
+          rig->data[LUT].ref = ref;
+          Ref.lut = ref;
+      }
+
+    if (Ref.dims[LUT] == 0)
+      {
+          uint8      *p;
+          p = GRtbuf;
+          INT32ENCODE(p, rig->datadesc[LUT].xdim);
+          INT32ENCODE(p, rig->datadesc[LUT].ydim);
+          UINT16ENCODE(p, rig->datadesc[LUT].nt.tag);
+          UINT16ENCODE(p, rig->datadesc[LUT].nt.ref);
+          INT16ENCODE(p, rig->datadesc[LUT].ncomponents);
+          INT16ENCODE(p, rig->datadesc[LUT].interlace);
+          UINT16ENCODE(p, rig->datadesc[LUT].compr.tag);
+          UINT16ENCODE(p, rig->datadesc[LUT].compr.ref);
+          if (Hputelement(file_id, DFTAG_LD, ref,
+                          GRtbuf, (int32) (p - GRtbuf)) == FAIL)
+              return FAIL;
+          Ref.dims[LUT] = ref;
+      }
+#endif
+
+    /* prepare to start writing rig */
+    /* ### NOTE: the parameter to this call may go away */
+    if ((GroupID = DFdisetup(10)) == FAIL)
+        return FAIL;    /* max 10 tag/refs in set */
+    /* add tag/ref to RIG - image description, image and lookup table */
+    if (DFdiput(GroupID, DFTAG_ID, ref) == FAIL)
+        return FAIL;
+
+    if (DFdiput(GroupID, DFTAG_CI, ref) == FAIL)
+        return FAIL;
+
+#ifdef OLD_WAY
+    if ((Ref.dims[LUT] > 0)
+        && (DFdiput(GroupID, DFTAG_LD, (uint16) Ref.dims[LUT]) == FAIL))
+        return FAIL;
+
+    if ((Ref.lut > 0)
+      && (DFdiput(GroupID, rig->data[LUT].tag, rig->data[LUT].ref) == FAIL))
+        return FAIL;
+#endif
+
+    /* write out RIG */
+    return (DFdiwrite(file_id, GroupID, DFTAG_RIG, ref));
+}
+
+static      VOID
+usage(void)
+{
+    printf("USAGE: jpeg2hdf <input JPEG file> <output HDF file>\n");
+    printf("    <input JPEG file> : JPEG file containing input image \n");
+    printf("    <output HDF file> : HDF file to store the image\n");
+    exit(1);
+}   /* end usage() */
+
+int
+main(int argc, char *argv[])
+{
+    int32       off_image;      /* offset of the JPEG image in the JFIF file */
+    int32       file_len;       /* total length of the JPEG file */
+#ifdef OLD_WAY
+    int32       image_len;      /* length of the image in the JPEG file (in bytes) */
+#endif /* OLD_WAY */
+    FILE       *jfif_file;      /* file handle of the JFIF image */
+    int32       file_id;        /* HDF file ID of the file to write */
+    uint16      wtag;           /* tag number to use for the image */
+    uint16      wref;           /* reference number to use for the image */
+    uint16      ctag;           /* tag for the compression to do */
+    int32       aid;            /* access ID for the JPEG image to stuff */
+
+    if (argc != 3)
+        usage();
+
+    if (argv[1][0] == '-' || argv[1][0] == '/')     /* check command line */
+        usage();
+
+    jfif_file = fopen(argv[1], "rb");
+    if (jfif_file == NULL)
+      {
+          printf("Error opening JPEG file: %s\n", argv[1]);
+          exit(1);
+      }     /* end if */
+
+    off_image = read_file_header(jfif_file);
+    if (off_image == 0 || image_width <= 0 || image_height <= 0 || num_components <= 0)
+      {
+          printf("Error reading JPEG file: %s, could not find a JFIF header\n",
+                 argv[1]);
+          exit(1);
+      }     /* end if */
+
+    if (!fseek(jfif_file, 0, SEEK_END))
+      {
+          file_len = (int32)ftell(jfif_file);
+#ifdef OLD_WAY
+          image_len = file_len - off_image;
+#endif /* OLD_WAY */
+          fseek(jfif_file, 0, SEEK_SET);    /* go back to beginning of JFIF file */
+      }     /* end if */
+    else
+      {
+          printf("Error, cannot fseek in %s(?!)\n", argv[1]);
+          exit(1);
+      }     /* end else */
+
+    if ((file_id = Hopen(argv[2], DFACC_RDWR, 0)) != FAIL)
+      {
+          wref = Hnewref(file_id);
+          if (!wref)
+            {
+                printf("Error getting a reference number for HDF file: %s\n", argv[2]);
+                Hclose(file_id);
+                exit(1);
+            }   /* end if */
+          wtag = DFTAG_CI;  /* yes, this is a compressed image */
+#ifdef OLD_WAY
+          if (num_components == 1)
+              ctag = DFTAG_GREYJPEG;
+          else if (num_components == 3)
+              ctag = DFTAG_JPEG;
+#else /* OLD_WAY */
+          if (num_components == 1)
+              ctag = DFTAG_GREYJPEG5;
+          else if (num_components == 3)
+              ctag = DFTAG_JPEG5;
+#endif /* OLD_WAY */
+          else
+            {
+                printf("Error, cannot support JPEG file containing %d components\n",
+                       num_components);
+                Hclose(file_id);
+                exit(1);
+            }   /* end else */
+#ifdef OLD_WAY
+          if (fread(file_buf, sizeof(uint8), (size_t) off_image, jfif_file)
+              !=          (size_t) off_image)
+            {
+                printf("Error reading JFIF header from %s\n", argv[1]);
+                exit(1);
+            }   /* end if */
+          if (Hputelement(file_id, ctag, wref, file_buf, off_image) == FAIL)
+            {
+                printf("Error writing JPEG header to HDF file: %s\n", argv[2]);
+                exit(1);
+            }   /* end if */
+          if ((aid = Hstartwrite(file_id, wtag, wref, image_len)) == FAIL)
+            {
+                printf("Error from Hstartwrite() for JPEG image data\n");
+                exit(1);
+            }   /* end if */
+          while (image_len > MAX_FILE_BUF)
+            {
+                if (fread(file_buf, sizeof(uint8), MAX_FILE_BUF, jfif_file) !=
+                    MAX_FILE_BUF)
+                  {
+                      printf("Error reading JFIF image data from %s\n", argv[1]);
+                      exit(1);
+                  }     /* end if */
+                if (Hwrite(aid, MAX_FILE_BUF, file_buf) != (int32) (MAX_FILE_BUF))
+                  {
+                      printf("Error writing JPEG image data to HDF file\n");
+                      exit(1);
+                  }     /* end if */
+                image_len -= MAX_FILE_BUF;
+            }   /* end while */
+          if (image_len > 0)
+            {
+                if (fread(file_buf, sizeof(uint8), (size_t) image_len, jfif_file)
+                    !=          (size_t) image_len)
+                  {
+                      printf("Error reading JFIF image data from %s\n", argv[1]);
+                      exit(1);
+                  }     /* end if */
+                if (Hwrite(aid, image_len, file_buf) != (int32) (image_len))
+                  {
+                      printf("Error writing last of JPEG image data to HDF file\n");
+                      exit(1);
+                  }     /* end if */
+            }   /* end if */
+          Hendaccess(aid);  /* done with JPEG data, create RIG */
+          if (DFJPEGaddrig(file_id, wref, ctag) == FAIL)
+            {
+                printf("Error writing JPEG RIG information\n");
+                exit(1);
+            }   /* end if */
+#else /* OLD_WAY */
+          if ((aid=Hstartwrite(file_id, ctag, wref, 0)) == FAIL)
+            {
+                printf("Error writing JPEG header to HDF file: %s\n", argv[2]);
+                exit(1);
+            }   /* end if */
+          Hendaccess(aid);
+          if ((aid = Hstartwrite(file_id, wtag, wref, file_len)) == FAIL)
+            {
+                printf("Error from Hstartwrite() for JPEG image data\n");
+                exit(1);
+            }   /* end if */
+          while (file_len > MAX_FILE_BUF)
+            {
+                if (fread(file_buf, sizeof(uint8), MAX_FILE_BUF, jfif_file) !=
+                    MAX_FILE_BUF)
+                  {
+                      printf("Error reading JFIF image data from %s\n", argv[1]);
+                      exit(1);
+                  }     /* end if */
+                if (Hwrite(aid, MAX_FILE_BUF, file_buf) != (int32) (MAX_FILE_BUF))
+                  {
+                      printf("Error writing JPEG image data to HDF file\n");
+                      exit(1);
+                  }     /* end if */
+                file_len -= MAX_FILE_BUF;
+            }   /* end while */
+          if (file_len > 0)
+            {
+                if (fread(file_buf, sizeof(uint8), (size_t) file_len, jfif_file)
+                    !=          (size_t) file_len)
+                  {
+                      printf("Error reading JFIF image data from %s\n", argv[1]);
+                      exit(1);
+                  }     /* end if */
+                if (Hwrite(aid, file_len, file_buf) != (int32) (file_len))
+                  {
+                      printf("Error writing last of JPEG image data to HDF file\n");
+                      exit(1);
+                  }     /* end if */
+            }   /* end if */
+          Hendaccess(aid);  /* done with JPEG data, create RIG */
+          if (DFJPEGaddrig(file_id, wref, ctag) == FAIL)
+            {
+                printf("Error writing JPEG RIG information\n");
+                exit(1);
+            }   /* end if */
+#endif /* OLD_WAY */
+          Hclose(file_id);
+      }     /* end if */
+    else
+      {
+          printf("Error opening HDF file: %s\b", argv[2]);
+          exit(1);
+      }     /* end else */
+
+    return (0);
+}   /* end jpeg2hdf */
diff --git a/hdf/util/jpeg2hdf.out1 b/hdf/util/jpeg2hdf.out1
new file mode 100644
index 0000000..a6a3b8b
--- /dev/null
+++ b/hdf/util/jpeg2hdf.out1
@@ -0,0 +1,20 @@
+jpeg.hdf:
+
+24-bit JPEG Encoding          : (tag 15)
+	Ref no      2	       0 bytes
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      2	    2922 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+
diff --git a/hdf/util/paltohdf.c b/hdf/util/paltohdf.c
new file mode 100644
index 0000000..fa99c7e
--- /dev/null
+++ b/hdf/util/paltohdf.c
@@ -0,0 +1,96 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#) $Revision: 6013 $"
+#endif
+
+/* $Id: paltohdf.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*
+   *  paltohdf.c
+   *       Version: 1.0   date: August 1, 1989
+   *       This utility converts a raw palette to hdf format
+   *       The incoming palette is assumed to have 768 bytes:
+   *          256 red values, 256 greens, and 256 blues.
+   *          The palette in the HDF file will have the RGB values
+   *          interlaced: RGB RGB ... (This is standard HDF format.)
+   *
+   *  by Mike Folk
+   *  first version of paltohdf:   8/01/89
+   *
+   *  This program is in the public domain
+ */
+#include "hdf.h"
+
+int main(int argc, char *argv[]);
+int         palconv(char *palfile, char *outfile);
+
+int
+main(int argc, char *argv[])
+{
+    if (argc != 3)
+      {
+          printf("Usage:\n");
+          printf("   %s rawpalfile hdffile \n\n", argv[0]);
+          printf("%s,  version: 1.1   date: July 1, 1992\n\n", argv[0]);
+          printf("\tThis utility converts a raw palette to hdf format \n\n");
+          printf("\tThe incoming palette is assumed to have 768 bytes:\n");
+          printf("\t256 red values, 256 greens, and 256 blues.\n\n");
+          printf("\tThe palette in the HDF file will have the RGB values\n");
+          printf("\tinterlaced: RGB RGB ... (standard HDF format).\n\n");
+          exit(1);
+      }
+
+    palconv(argv[1], argv[2]);
+    return (0);
+}
+
+/*
+ *    palconv(palfile, outfile) sets the palette
+ */
+
+int
+palconv(char *palfile, char *outfile)
+{
+    unsigned char palspace[1024], reds[256], greens[256], blues[256], *p;
+    FILE       *fp;
+    int         j, ret;
+
+    fp = fopen(palfile, "r");
+    if (fp == NULL)
+      {
+          printf(" Error opening palette file %s\n", palfile);
+          exit(1);
+      }
+    fread(reds, 1, 256, fp);
+    fread(greens, 1, 256, fp);
+    fread(blues, 1, 256, fp);
+    fclose(fp);
+
+    p = palspace;
+    for (j = 0; j < 256; j++)
+      {
+          *p++ = reds[j];
+          *p++ = greens[j];
+          *p++ = blues[j];
+      }
+
+    ret = DFPaddpal(outfile, (VOIDP) palspace);
+    if (ret < 0)
+      {
+          printf(" Error: %d, in writing palette %s\n", ret, palfile);
+          exit(1);
+      }
+    return (0);
+}
diff --git a/hdf/util/r8tohdf.c b/hdf/util/r8tohdf.c
new file mode 100644
index 0000000..8d6bb69
--- /dev/null
+++ b/hdf/util/r8tohdf.c
@@ -0,0 +1,199 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: r8tohdf.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*
+   *  r8tohdf.c
+   *  Encoding of raster images in HDF files
+ */
+
+/* The intrepretation of arguments has changed a little.  A -p introduces a
+   palette which will be used for subsequent images, till another -p.
+   -i and -c introduce a series of images/compressed images */
+#include "hdf.h"
+
+int32       xdim, ydim;
+
+int         main(int argc, char *argv[]);
+int         palconv(char *palfile);
+int         imconv(char *outfile, char *imfile, uint16 compress);
+
+int
+main(int argc, char *argv[])
+{
+    int         i, is_pal = 0, image = 1;
+    char       *outfile;
+    uint16      compress = (uint16) 0;
+
+    if (argc < 5)
+      {
+          printf("%s,  version: 1.1   date: July 1, 1992\n", argv[0]);
+          printf("   This utility converts one or more raw raster-8 images to\n");
+          printf("   HDF RIS8 format and writes them to an HDF file.\n\n");
+          printf("Usage:\n");
+          printf("  %s xdim ydim outfile [-p palfile] ", argv[0]);
+          printf("{[-r],[-c],[-i]} imagefile\n");
+          printf("\t\t\t\t... [-p palfile] {[-r],[-c],[-i]} imagefile ...\n");
+          printf("  -r: Store without compression (default)\n");
+          printf("  -c: Store using RLE compression\n");
+          printf("  -i: Store using IMCOMP compression\n\n");
+          printf("* r8tohdf can take any number of images and palettes\n");
+          printf("* Compression, palette, apply to all subsequent images.\n");
+          printf("* All images are assumed to be the same dimensions.\n\n");
+          exit(1);
+      }
+
+    xdim = atoi(argv[1]);
+    ydim = atoi(argv[2]);
+
+    if (xdim < 1 || ydim < 1)
+      {
+          printf("Must specify xdim and ydim\n");
+          exit(1);
+      }
+
+    outfile = argv[3];
+
+    for (i = 4; i < argc; i++)
+      {
+          if (*argv[i] == '-')
+            {
+                switch (argv[i][1])
+                  {
+                      case 'p': /* palette */
+                          is_pal = 1;
+                          image = 0;
+                          break;
+                      case 'r': /* raster */
+                          image = 1;
+                          compress = (uint16) 0;
+                          break;
+                      case 'c': /* RLE */
+                          image = 1;
+                          compress = DFTAG_RLE;
+                          break;
+                      case 'i': /* IMCOMP */
+                          image = 1;
+                          compress = DFTAG_IMC;
+                          break;
+                      default:
+                          printf("Illegal option: %s, skipping....\n", argv[i]);
+                          break;
+                  }
+            }
+          else
+            {   /* file name */
+                if (image)
+                  {
+                      if (compress == DFTAG_IMC && is_pal == 0)
+                        {
+                            printf("Illegal options.  If imcomp compression (-i) ");
+                            printf("chosen, you must supply a palette.\n");
+                            printf("Program aborted.\n");
+                            exit(1);
+                        }
+                      imconv(outfile, argv[i], compress);
+                  }
+                else
+                  {
+                      palconv(argv[i]);
+                      image = 1;
+                  }
+            }
+      }
+    return (0);
+}
+
+/*
+ *  palconv(file) sets the palette
+ */
+
+int
+palconv(char *palfile)
+{
+    uint8       palspace[1024], reds[256], greens[256], blues[256];
+    uint8      *p;
+    FILE       *fp;
+    int         j, ret;
+
+    fp = fopen(palfile, "rb");
+    if (fp == NULL)
+      {
+          printf(" Error opening palette file %s\n", palfile);
+          exit(1);
+      }
+    fread(reds, 1, 256, fp);
+    fread(greens, 1, 256, fp);
+    fread(blues, 1, 256, fp);
+    fclose(fp);
+
+    p = palspace;
+    for (j = 0; j < 256; j++)
+      {
+          *p++ = reds[j];
+          *p++ = greens[j];
+          *p++ = blues[j];
+      }
+
+    ret = DFR8setpalette(palspace);
+    if (ret < 0)
+      {
+          printf(" Error: %d, in writing palette %s\n", ret, palfile);
+          exit(1);
+      }
+    return (0);
+}
+
+int
+imconv(char *outfile, char *imfile, uint16 compress)
+{
+    int         ret;
+    char       *space;
+    FILE       *fp;
+
+    if ((fp = fopen(imfile, "rb")) == NULL)
+      {
+          printf("Error opening image file\n");
+          exit(1);
+      }
+
+    if ((space = (char *) HDmalloc((size_t) (xdim * ydim))) == NULL)
+      {
+          printf("Not enough memory to convert image\n");
+          exit(1);
+      }
+
+    if ((ret = (int)fread(space, (size_t) xdim, (size_t) ydim, fp)) <= 0)
+      {
+          printf("Cannot read image file\n");
+          fclose(fp);
+          exit(1);
+      }
+
+    ret = DFR8addimage(outfile, space, xdim, ydim, compress);
+
+    if (ret < 0)
+      {
+          printf(" Error: %d, in writing image %s\n", HEvalue(1), outfile);
+          exit(1);
+      }
+
+    HDfree(space);
+    fclose(fp);
+    return (0);
+}
diff --git a/hdf/util/ristosds.c b/hdf/util/ristosds.c
new file mode 100644
index 0000000..ddb1cf2
--- /dev/null
+++ b/hdf/util/ristosds.c
@@ -0,0 +1,211 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: ristosds.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/* This program converts a series raster image hdf files into   */
+/* a single 3D sds hdf file. Each ris hdf file contains one     */
+/* or more raster images. All images should be of the same      */
+/* dimension sizes. And, if there is a palette associated to    */
+/* the images, the palette should be included in the first      */
+/* ris file. Any subsequent palettes will be ignored.           */
+/* Sept. 23, 1991                                               */
+
+/*   USAGE: ristosds infile{ infile} -o outfile                 */
+#include "hdf.h"
+
+#define r_imgae 2;
+#define r_sds   3;
+#define USAGE "ristosds infile{ infile} -o outfile"
+
+int         main
+            (int, char *a[]);
+int         cntimage
+            (char *filename, int32 *p_w, int32 *p_h, int *n_images);
+VOID        finishing
+            (void);
+
+int
+main(int argc, char *argv[])
+{
+    int         i, j;
+    int         nimg, nimg0;    /* nimg, nimg0 -- number of images        */
+    int32       w, h;           /* w, h -- width and height of images */
+    int         ret, n_infile, getoutfile, ispal;
+    int32       dimsizes[3];
+    char       *infile, *outfile, **argv_infile;
+    uint8      *indata, *indata0, palette[768];
+    uint8      *outdata, *outdata0;
+
+    if (argc < 4)
+      {
+          printf("Usage %s.\n", USAGE);
+          finishing();
+      }
+    /* initialization   */
+
+    nimg = 0;
+    w = h = 0;
+    n_infile = 0;   /* count number of input files   */
+    getoutfile = 0;
+    argv_infile = &argv[1];     /* save start address of input file names. */
+
+    /* Count total number of images to be converted.   */
+
+    while (--argc > 1)
+      {     /* reach -o. go to get output file name */
+          infile = *++argv;
+          if (infile[0] == '-')
+            {
+                getoutfile = 1;
+                break;
+            }
+          else
+            {
+                n_infile++;
+                ret = cntimage(infile, &w, &h, &nimg);
+                if (ret != 0)
+                    finishing();
+            }
+      }
+
+    nimg0 = nimg;
+    printf("Total number of images: %d.\n", nimg);
+
+    /* get output file name     */
+
+    argc--;
+
+    if (getoutfile == 0 || argc < 1)
+      {     /* is -o or outfile missing?    */
+          printf("Bad command line. \n\n\t\t %s\n", USAGE);
+          finishing();
+      }
+
+    outfile = *++argv;
+
+    /* read in images from all input files.     */
+
+    outdata0 = outdata = (uint8 *) HDmalloc((size_t)(nimg * w * h) * (sizeof(uint8)));
+    if (outdata0 == NULL)
+      {
+          printf("Not enough space. \n\n\n");
+          finishing();
+      }
+    indata0 = indata = (uint8 *) HDmalloc((size_t)(nimg * w * h) * sizeof(uint8));
+    if (indata0 == NULL)
+      {
+          printf("Not enough space. \n\n\n");
+          finishing();
+      }
+    infile = *argv_infile;
+    ret = DFR8getdims(infile, &w, &h, &ispal);
+    if (ispal)
+      {
+          DFPgetpal(infile, (char *) palette);
+          DFR8restart();    /* in case the palette is not at the  */
+          /* beginning of the first input file  */
+          DFPputpal(outfile, (char *) palette, 0, "a");
+      }
+    while (nimg > 0)
+      {
+          indata = indata0;     /* Restart from the beginning of the buf */
+          ret = DFR8getimage(infile, indata, w, h, palette);
+          if (ret != 0)
+            {   /* end of file. open next one   */
+                n_infile--;
+                if (n_infile < 1)
+                  {
+                      printf("Inconsistent number of files and images\n");
+                      finishing();
+                  }
+                infile = *++argv_infile;
+                ret = DFR8getimage(infile, indata, w, h, palette);
+                if (ret != 0)
+                    finishing();
+            }
+
+          /* convert image data into floating point and store in the array  */
+
+          for (i = 0; i < w; i++)
+              for (j = 0; j < h; j++)
+                  *outdata++ = *indata++;
+          nimg--;
+      }
+    
+    dimsizes[0] = nimg0;
+    dimsizes[1] = h;
+    dimsizes[2] = w;
+    if (DFSDsetNT(DFNT_UINT8) == FAIL)
+        finishing();
+    ret = DFSDadddata(outfile, 3, dimsizes, (VOIDP) outdata0);
+    HDfree(outdata0);
+    HDfree(indata0);
+    if (ret != 0)
+        finishing();
+    return (0);
+}
+
+VOID
+finishing(void)
+{
+    printf("end of ristosds.\n");
+    exit(1);
+}
+
+/* count # of images  */
+
+int
+cntimage(char *filename, int32 *p_w, int32 *p_h, int *n_images)
+
+{
+    int32       ret, width, height;
+    int         ispal, dimerror;
+
+    dimerror = 0;
+
+    ret = DFR8getdims(filename, &width, &height, &ispal);
+    if (ret == FAIL)
+      {
+          HEprint(stderr, 0);
+          finishing();
+      }
+    if (*p_w == 0 && *p_h == 0)
+      {     /* the first time  */
+          *p_w = width;
+          *p_h = height;
+      }
+    while (ret == 0)
+      {     /* count # of images and check dims    */
+          if ((width != *p_w) || (height != *p_h))
+            {
+                printf("Inconsistent dims: %s .\n", filename);
+                dimerror = -1;
+                break;
+            }
+          *n_images = *n_images + 1;
+          ret = DFR8getdims(filename, &width, &height, &ispal);
+      }
+
+    /* ready to return   */
+
+    DFR8restart();
+    if (dimerror == -1)
+        return (-1);
+    else
+        return (0);
+}
diff --git a/hdf/util/ristosds.input1 b/hdf/util/ristosds.input1
new file mode 100644
index 0000000..8cfe91a
--- /dev/null
+++ b/hdf/util/ristosds.input1
@@ -0,0 +1,11 @@
+open storm.hdf
+prev tag = 702
+info -long
+dump -length 20 -byte
+close
+open storm110.hdf
+prev tag = 302
+info -long
+dump -length 20 -byte
+close
+quit
diff --git a/hdf/util/ristosds.out1 b/hdf/util/ristosds.out1
new file mode 100644
index 0000000..fbc470c
--- /dev/null
+++ b/hdf/util/ristosds.out1
@@ -0,0 +1,10 @@
+ (2) 	Scientific Data               : (Tag 702)
+	Ref: 2, Offset: 294, Length: 9747 (bytes)
+       0:     82     82     81     81     80     79     79     79 
+       8:     78     78     78     78     78     78     78     78 
+      16:     78     78     78     78 
+ (2) 	Raster Image Data             : (Tag 302)
+	Ref: 110, Offset: 202, Length: 3249 (bytes)
+       0:     82     82     81     81     80     79     79     79 
+       8:     78     78     78     78     78     78     78     78 
+      16:     78     78     78     78 
diff --git a/hdf/util/testfiles/README b/hdf/util/testfiles/README
new file mode 100644
index 0000000..3bf27ce
--- /dev/null
+++ b/hdf/util/testfiles/README
@@ -0,0 +1,64 @@
+This directory contains files that can be used for testing hdf.
+
+File types can be determined by their extensions:
+
+	.hdf	- HDF file.  Could contain any number of different HDF objects
+	.r24	- HDF file containing one or more 24-bit raster image sets
+	.r8	- HDF file containing one or more 8-bit raster image sets,
+		      with color palettes possible also included
+	.sd	- HDF file containing one or more scientific data sets
+	.pal	- HDF file containing one or more color palettes
+	.raw	- non-HDF file containing binary data (image, float data, etc.)
+	.txt	- non-HDF file containing ascii data
+	.Z	- files compressed with Unix compress. Use uncompress
+		      to uncompress them.
+
+
+
+head.r24      - isosurface rendering of human head
+palette.raw   - contains a raw palette
+storm110.raw  - raw image of data from storm simulation
+storm120.raw  - raw image of data from storm simulation
+storm130.raw  - raw image of data from storm simulation
+storm140.raw  - raw image of data from storm simulation
+storm110.hdf  - hdf image of data from storm simulation
+storm120.hdf  - hdf image of data from storm simulation
+storm130.hdf  - hdf image of data from storm simulation
+storm140.hdf  - hdf image of data from storm simulation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hdf/util/testfiles/SunWheel.gif b/hdf/util/testfiles/SunWheel.gif
new file mode 100644
index 0000000..019886c
Binary files /dev/null and b/hdf/util/testfiles/SunWheel.gif differ
diff --git a/hdf/util/testfiles/bttrfly.gif b/hdf/util/testfiles/bttrfly.gif
new file mode 100644
index 0000000..8e5bd85
Binary files /dev/null and b/hdf/util/testfiles/bttrfly.gif differ
diff --git a/hdf/util/testfiles/fp2hdf/h100x100 b/hdf/util/testfiles/fp2hdf/h100x100
new file mode 100644
index 0000000..7eb1b8a
Binary files /dev/null and b/hdf/util/testfiles/fp2hdf/h100x100 differ
diff --git a/hdf/util/testfiles/fp2hdf/h100x100h b/hdf/util/testfiles/fp2hdf/h100x100h
new file mode 100644
index 0000000..8414155
Binary files /dev/null and b/hdf/util/testfiles/fp2hdf/h100x100h differ
diff --git a/hdf/util/testfiles/fp2hdf/h100x100hv b/hdf/util/testfiles/fp2hdf/h100x100hv
new file mode 100644
index 0000000..a00dd30
Binary files /dev/null and b/hdf/util/testfiles/fp2hdf/h100x100hv differ
diff --git a/hdf/util/testfiles/fp2hdf/h60x75 b/hdf/util/testfiles/fp2hdf/h60x75
new file mode 100644
index 0000000..b90282d
Binary files /dev/null and b/hdf/util/testfiles/fp2hdf/h60x75 differ
diff --git a/hdf/util/testfiles/fp2hdf/h60x75n b/hdf/util/testfiles/fp2hdf/h60x75n
new file mode 100644
index 0000000..1e08e21
Binary files /dev/null and b/hdf/util/testfiles/fp2hdf/h60x75n differ
diff --git a/hdf/util/testfiles/fp2hdf/h60x75v b/hdf/util/testfiles/fp2hdf/h60x75v
new file mode 100644
index 0000000..5c80df7
Binary files /dev/null and b/hdf/util/testfiles/fp2hdf/h60x75v differ
diff --git a/hdf/util/testfiles/fp2hdf/pal.hdf b/hdf/util/testfiles/fp2hdf/pal.hdf
new file mode 100644
index 0000000..c938493
Binary files /dev/null and b/hdf/util/testfiles/fp2hdf/pal.hdf differ
diff --git a/hdf/util/testfiles/fp2hdf/t100x100 b/hdf/util/testfiles/fp2hdf/t100x100
new file mode 100644
index 0000000..01eb38b
--- /dev/null
+++ b/hdf/util/testfiles/fp2hdf/t100x100
@@ -0,0 +1,6 @@
+TEXT
+1 100 100
+ 100.000000 0.000000
+ 0.000000 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000 9.000000 10.000000 11.000000 12.000000 13.000000 14.000000 15.000000 16.000000 17.000000 18.000000 19.000000 20.000000 21.000000 22.000000 23.000000 24.000000 25.000000 26.000000 27.000000 28.000000 29.000000 30.000000 31.000000 32.000000 33.000000 34.000000 35.000000 36.000000 37.000000 38.000000 39.000000 40.000000 41.000000 42.000000 43.000000 44.000000 45.000000 46.000000 47.000000 48.000000 49.000000 5 [...]
+0.000000 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000 9.000000 10.000000 11.000000 12.000000 13.000000 14.000000 15.000000 16.000000 17.000000 18.000000 19.000000 20.000000 21.000000 22.000000 23.000000 24.000000 25.000000 26.000000 27.000000 28.000000 29.000000 30.000000 31.000000 32.000000 33.000000 34.000000 35.000000 36.000000 37.000000 38.000000 39.000000 40.000000 41.000000 42.000000 43.000000 44.000000 45.000000 46.000000 47.000000 48.000000 49.000000 50 [...]
+   0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    0.0    [...]
diff --git a/hdf/util/testfiles/head.r24 b/hdf/util/testfiles/head.r24
new file mode 100644
index 0000000..e6d5a5c
Binary files /dev/null and b/hdf/util/testfiles/head.r24 differ
diff --git a/hdf/util/testfiles/head.r8 b/hdf/util/testfiles/head.r8
new file mode 100644
index 0000000..3b5988f
--- /dev/null
+++ b/hdf/util/testfiles/head.r8
@@ -0,0 +1 @@
+ [...]
\ No newline at end of file
diff --git a/hdf/util/testfiles/jet2.hdf b/hdf/util/testfiles/jet2.hdf
new file mode 100644
index 0000000..3b20ff3
Binary files /dev/null and b/hdf/util/testfiles/jet2.hdf differ
diff --git a/hdf/util/testfiles/jpeg_img.jpg b/hdf/util/testfiles/jpeg_img.jpg
new file mode 100644
index 0000000..d323ffd
Binary files /dev/null and b/hdf/util/testfiles/jpeg_img.jpg differ
diff --git a/hdf/util/testfiles/ntcheck.hdf b/hdf/util/testfiles/ntcheck.hdf
new file mode 100644
index 0000000..dd71bd3
Binary files /dev/null and b/hdf/util/testfiles/ntcheck.hdf differ
diff --git a/hdf/util/testfiles/palette.raw b/hdf/util/testfiles/palette.raw
new file mode 100644
index 0000000..e86ad05
Binary files /dev/null and b/hdf/util/testfiles/palette.raw differ
diff --git a/hdf/util/testfiles/skull.hdf b/hdf/util/testfiles/skull.hdf
new file mode 100644
index 0000000..121ac94
Binary files /dev/null and b/hdf/util/testfiles/skull.hdf differ
diff --git a/hdf/util/testfiles/storm110.hdf b/hdf/util/testfiles/storm110.hdf
new file mode 100644
index 0000000..7322caf
Binary files /dev/null and b/hdf/util/testfiles/storm110.hdf differ
diff --git a/hdf/util/testfiles/storm110.raw b/hdf/util/testfiles/storm110.raw
new file mode 100644
index 0000000..846b6fa
--- /dev/null
+++ b/hdf/util/testfiles/storm110.raw
@@ -0,0 +1 @@
+RRQQPOOONNNNNNNNNNNNOOPQRSSTUVWXYZZZZYXXWVUTTTTTTTTUUUUVVQPPPOONNNMMNNNNNNNNNNOPQRRSTUVWXYZZZZYXWWVUTTTTTTTTUUUUVVOOOONNNMMMMMMMMMMMMNNOPPQRSTUVWXYZZZZYXWVVUTTTTTTTTUUUUVVNNOONNMMMLLLLLMMMMMMNNOPQRSSTVWXYYZZYYXWVVUTTTTTTTTUUUUVVMNOONNMMLLLLLLLLLLMMMNOPPQRSTUVXXYYYYYXWVUUTTTTTTTTUUUUVWNOOOONNMMLLLLLLLLLLMMNNOPQRSTUVWXYYYYXXWVUUTTTTTTTTUUUUVWQQPPOONNMMLLLLLLLLLLMMNOPQQRSUVWXXYYXXWWVUTTTTTTTTTUUUVVWSSRQPOONNMMMLLLLLLLLMMNNOPQRSTUVWXXXXXWVUUTTTTTTTTTUUUVVWWVTSQPPONNNMMMLLLLLLLMMNOPPQRTUVWXXX [...]
\ No newline at end of file
diff --git a/hdf/util/testfiles/storm120.hdf b/hdf/util/testfiles/storm120.hdf
new file mode 100644
index 0000000..3778ab0
Binary files /dev/null and b/hdf/util/testfiles/storm120.hdf differ
diff --git a/hdf/util/testfiles/storm120.raw b/hdf/util/testfiles/storm120.raw
new file mode 100644
index 0000000..94143a1
--- /dev/null
+++ b/hdf/util/testfiles/storm120.raw
@@ -0,0 +1 @@
+RRRRQQQPPPOOOOOOPQRSUVXY[]^___^\YVRNKHFFGIKMNPRSUVWWXXXYYRRRRQQQPPPOOOOOOPQRSUVXY[]^___^\YVRNKHFFGIKMNPRSUVWWXXXYYRRRRQQQPPPOOOOOOPQRSTVXY[]^___^\YVRNKHFFGIKMNPRSUVWWXXXYYRRRQQQQPPPOOOOOOPQRSTVXY[]^___^\YVRNJHFFGIKMNPRSUVWWXXXYYRRRQQQPPPPOOOOOOPQRSTVXY[\^___]\YVRNJHFFGIKLNPRSUVWXXXYYYRRRQQQPPPPOOOOOOPQRSTVXY[\^___]\YVRNJHFFGIKLNPRSUVWXXXYYYRRQQQQPPPOOOOOOOPPRSTVWY[\^^_^]\YVRNJHFFGIKLNPRSUVWXXXYYYRRQQQQPPPOOOOOOOPPQSTVWY[\^^_^]\YVRNKHFFGIKLNPRSUVWXXYYYZRQQQQPPPPOOONNOOPPQSTVWY[\]^_^]\YVRN [...]
\ No newline at end of file
diff --git a/hdf/util/testfiles/storm130.hdf b/hdf/util/testfiles/storm130.hdf
new file mode 100644
index 0000000..36fd8e3
Binary files /dev/null and b/hdf/util/testfiles/storm130.hdf differ
diff --git a/hdf/util/testfiles/storm130.raw b/hdf/util/testfiles/storm130.raw
new file mode 100644
index 0000000..28eaa0b
--- /dev/null
+++ b/hdf/util/testfiles/storm130.raw
@@ -0,0 +1 @@
+UTTTUUUTTTUUUVVWXYYZ[\\]^^_``aaa`_]ZVQKFDEGKOSVX[\^_``aaaUTTTUUUTTTUUUVVWXYYZ[\\]^__``aaa`_]ZVQKFDEGKOSVX[\^_``aaaUTTUUUUUUUUUUVVWXYZZ[\\]^__``aaa`_]ZVQKFDEGKOSVXZ\^_``aaaTTTTUUUUTUUUUVVWXYZZ[\\]^__`aaaa`_]ZVQKFDEGKOSVXZ\]__`aaaTTTTUUUTTUUUUVVWXYZ[[\]]^_``aaaa`_]ZVQKFDEGKOSVXZ\]^_``aaTTTTUUUUUUUVVVWXXYZ[[\]]^_``aaaa`_][WQKFDEGKORVXZ\]^_```aTTTTUUUUUUUUVVWXXYZ[\\]^^_``aaaa`_][WQKFDEGKORUXZ\]^__```TTTTUUUUUUUVVVWXXYZ[\]]^^_`aaaaaa_][WQKFDEGJNRUXZ[]^^__``TSTUUUUUUUVVVWXXYZ[[\]]^__`aaaaaa_][ [...]
\ No newline at end of file
diff --git a/hdf/util/testfiles/storm140.raw b/hdf/util/testfiles/storm140.raw
new file mode 100644
index 0000000..6b8085c
--- /dev/null
+++ b/hdf/util/testfiles/storm140.raw
@@ -0,0 +1 @@
+\ZYYXXYYYYYYXXXXXXXXXXXXXYYYZZZZZ[[\\\\]^`chhc^^`bceeffff\[YYYYYYYYYYXXXXXXXXXXXXXYYYZZZZZ[[\\\\]^`chhc^^`bceeffff\[ZYYYYYYYYYYXXXXXXXXXXXXYYYZZZZZ[[\\\\]^`chhb^^`bceeffff][ZYYYYYYYYYYYYXXXXXXXXXYYYYZZZZZ[[\\\\]^`chhb^^`bceeffff][ZZYYYYZYYYYYYYYYYYYYXYYYYZZZZZZ[[\\\\]^`chhb^]`bceeefff^\[ZZZZZZZZZZYYYYYYYYYYYYYZZZZZZ[[[\\\\]^_cghb^]_acdeeeee^][[ZZZZZZZZZZZYYYYYYYYYYZZZZZZ[[[[\\\\]^_cghb^]_acdeeeee_]\[[[[[[[[[ZZZZZZZZYYYYZZZZZ[[[[[\\\\\]^_cghb^]_acddeedd`^]\\\\\\\[[[[[ZZZZZZZZZZZZ[[[[[[[\\ [...]
\ No newline at end of file
diff --git a/hdf/util/testfiles/test.cdf b/hdf/util/testfiles/test.cdf
new file mode 100644
index 0000000..70d9490
Binary files /dev/null and b/hdf/util/testfiles/test.cdf differ
diff --git a/hdf/util/testfiles/test.hdf b/hdf/util/testfiles/test.hdf
new file mode 100644
index 0000000..4674fdd
Binary files /dev/null and b/hdf/util/testfiles/test.hdf differ
diff --git a/hdf/util/testfiles/tvattr.hdf b/hdf/util/testfiles/tvattr.hdf
new file mode 100644
index 0000000..d47ea03
Binary files /dev/null and b/hdf/util/testfiles/tvattr.hdf differ
diff --git a/hdf/util/testutil.sh.in b/hdf/util/testutil.sh.in
new file mode 100755
index 0000000..d0d97ce
--- /dev/null
+++ b/hdf/util/testutil.sh.in
@@ -0,0 +1,432 @@
+#!/bin/sh 
+# HDF Utilities Test script
+# Usage: testutil.sh [machine-type]
+
+srcdir=@srcdir@
+
+machinetype="$1"
+
+# Check if target machine supports 32 bits datatype.
+# "true" is TRUE; "" means FALSE.
+case $machinetype in
+    *unicos*) has32="";;
+    *) has32="true";;
+esac
+
+# initialize errors variable
+errors=0
+haserr=0
+
+# setup hdfed command which is used often
+HDFED='./hdfed'
+HDFEDCMD="$HDFED -batch"		# use -batch mode for no prompt
+SED="sed -e /library/,/String/d"  # filter out the library version
+
+echo ""
+echo "=============================="
+echo "HDF Utilities tests started"
+echo "=============================="
+
+# gif2hdf and hdf2gif 
+if [ -f gif2hdf -a -f hdf2gif ]; then
+  echo "** Testing gif2hdf and hdf2gif  ***"
+  /bin/rm -rf gif_hdf_temp
+  /bin/mkdir gif_hdf_temp
+  $TESTS_ENVIRONMENT ./hdf2gif $srcdir/testfiles/skull.hdf  gif_hdf_temp/skull.gif
+  $TESTS_ENVIRONMENT ./gif2hdf $srcdir/testfiles/SunWheel.gif  gif_hdf_temp/SunWheel.hdf
+  $TESTS_ENVIRONMENT ./gif2hdf $srcdir/testfiles/bttrfly.gif  gif_hdf_temp/bttrfly.hdf
+else
+  echo "** hdf2gif or gif2hdf is not available ***";
+fi
+
+echo " *********************** NOTE ****************************"
+echo " Use WEB Browser and JHV to compare "
+echo " $srcdir/testfiles/SunWheel.gif and $srcdir/testfiles/bttrfly.gif "
+echo " with gif_hdf_temp/SunWheel.hdf and gif_hdf_temp/bttrfly.hdf"
+echo " "
+echo " Use JHV  and WEB Browser to compare "
+echo " $srcdir/testfiles/skull.hdf and gif_hdf_temp/skull.gif"
+echo " ********************* END NOTE **************************"
+echo ""
+
+errors=0
+
+# hdf24to8
+# "uncompress" utiltiy became obsolete; replaced with gunzip EIP 2004/12/01
+# gunzip not available on Windows; simply untarring files SJW 2007/7/31
+if [ -f hdf24to8 -a -f hdftor8 ]; then
+  echo "** Testing hdf24to8  ***"
+  /bin/rm -f head.r24 head.r8 head8.hdf img001-263.328 pal001
+  #cp $srcdir/testfiles/head.r24.Z $srcdir/testfiles/head.r8.Z .
+  cp $srcdir/testfiles/head.r24 $srcdir/testfiles/head.r8 .
+  $TESTS_ENVIRONMENT ./hdf24to8 head.r24 head8.hdf
+  $TESTS_ENVIRONMENT ./hdftor8 head8.hdf
+  cmp img001-263.328 head.r8 || errors=1
+  /bin/rm -f head.r24 head.r8 head8.hdf img001-263.328 pal001
+else
+  echo "** hdf24to8 or hdftor8 is not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " hdf24to8 might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo " /bin/rm -f head.r24 head.r8 head8.hdf img001-263.328 pal001"
+  echo " cp $srcdir/testfiles/head.r24 $srcdir/testfiles/head.r8 . "
+  echo " ./hdf24to8 head.r24 head8.hdf "
+  echo " ./hdftor8 head8.hdf "
+  echo " cmp img001-263.328 head.r8 " 
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+# hdfed
+if [ -f $HDFED ]; then
+  echo "** Testing hdfed  ***"
+  /bin/rm -f storm110.hdf ntcheck.hdf hdfed.tmp
+  cp $srcdir/testfiles/storm110.hdf $srcdir/testfiles/ntcheck.hdf .
+  $TESTS_ENVIRONMENT $HDFEDCMD < $srcdir/hdfed.input1 > hdfed.tmp 2>&1
+  diff hdfed.tmp $srcdir/hdfed.out1 || errors=1
+  /bin/rm -f storm110.hdf ntcheck.hdf hdfed.tmp
+else
+  echo "** hdfed not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " hdfed might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo "/bin/rm -f storm110.hdf ntcheck.hdf hdfed.tmp "
+  echo "cp $srcdir/testfiles/storm110.hdf $srcdir/testfiles/ntcheck.hdf . "
+  echo "$HDFEDCMD < $srcdir/hdfed.input1 >& hdfed.tmp "
+  echo "diff hdfed.tmp $srcdir/hdfed.out1 "
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+# ristosds
+if [ -f ristosds -a -f $HDFED ]; then
+  echo "** Testing ristosds  ***"
+  /bin/rm -f storm*.hdf hdfed.tmp1
+  cp $srcdir/testfiles/storm110.hdf $srcdir/testfiles/storm120.hdf $srcdir/testfiles/storm130.hdf .
+  $TESTS_ENVIRONMENT ./ristosds storm*.hdf -o storm.hdf > /dev/null 2>&1
+  $TESTS_ENVIRONMENT $HDFEDCMD < $srcdir/ristosds.input1 > hdfed.tmp1 2>&1
+  diff  hdfed.tmp1 $srcdir/ristosds.out1 || errors=1
+  /bin/rm -f storm*.hdf hdfed.tmp1
+else
+  echo "** ristosds or hdfed not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " ristosds might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo " /bin/rm -f storm*.hdf hdfed.tmp1 "
+  echo " cp $srcdir/testfiles/storm110.hdf $srcdir/testfiles/storm120.hdf $srcdir/testfiles/storm130.hdf . "
+  echo "./ristosds storm*.hdf -o storm.hdf "
+  echo "$HDFEDCMD < $srcdir/ristosds.input1 >& hdfed.tmp1 "
+  echo " diff  hdfed.tmp1 $srcdir/ristosds.out1"
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+
+#hdfpack
+if [ -f hdfpack -a -f hdfls ]; then
+  echo "** Testing hdfpack  ***"
+  /bin/rm -f test.hdf test.blk test.pck hdfls.tmp1
+  cp $srcdir/testfiles/test.hdf .
+  $TESTS_ENVIRONMENT ./hdfpack test.hdf test.pck
+  $TESTS_ENVIRONMENT ./hdfpack -b test.hdf test.blk
+  ($TESTS_ENVIRONMENT ./hdfls test.hdf | $SED ) > hdfls.tmp1 2>&1
+  ($TESTS_ENVIRONMENT ./hdfls test.pck | $SED ) >> hdfls.tmp1 2>&1
+  diff  hdfls.tmp1 $srcdir/hdfpack.out1 || errors=1
+  /bin/rm -f test.hdf test.blk test.pck hdfls.tmp1
+else
+  echo "** hdfpack or hdfls not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " hdfpack might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo "/bin/rm -f test.hdf test.blk test.pck hdfls.tmp1 "
+  echo " cp $srcdir/testfiles/test.hdf . "
+  echo "./hdfpack test.hdf test.pck "
+  echo "./hdfpack -b test.hdf test.blk "
+  echo "(./hdfls test.hdf | $SED ) >& hdfls.tmp1"
+  echo "(./hdfls test.pck | $SED ) >>& hdfls.tmp1"
+  echo " diff hdfls.tmp1 $srcdir/hdfpack.out1 "
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+#hdftopal/paltohdf
+if [ -f  hdftopal -a -f paltohdf ]; then
+  echo "** Testing hdftopal/paltohdf  ***"
+  /bin/rm -f palette.* 
+  cp $srcdir/testfiles/palette.raw .
+  $TESTS_ENVIRONMENT ./paltohdf palette.raw palette.hdf
+  $TESTS_ENVIRONMENT ./hdftopal palette.hdf palette.raw.new
+  cmp palette.raw palette.raw.new || errors=1
+  /bin/rm -f palette.* 
+else
+  echo "** hdftopal or paltohdf not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " hdftopal or paltohdf might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo " /bin/rm -f palette.* "
+  echo " cp $srcdir/testfiles/palette.raw . "
+  echo "./paltohdf palette.raw palette.hdf "
+  echo "./hdftopal palette.hdf palette.raw.new "
+  echo "cmp palette.raw palette.raw.new "
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+# r8tohdf/hdftor8
+if [ -f r8tohdf -a -f hdftor8 -a -f hdfls ]; then
+  echo "** Testing r8tohdf/hdftor8  ***"
+  /bin/rm -f storm* img* palette.raw hdfls.tmp2 pal005
+  cp $srcdir/testfiles/storm*.raw $srcdir/testfiles/palette.raw .
+  $TESTS_ENVIRONMENT ./r8tohdf 57 57 storm.hdf storm*.raw
+  $TESTS_ENVIRONMENT ./r8tohdf 57 57 storm.hdf -p palette.raw -i storm110.raw
+  $TESTS_ENVIRONMENT ./hdftor8 storm.hdf
+  ($TESTS_ENVIRONMENT ./hdfls -l storm.hdf | $SED) > hdfls.tmp2 2>&1
+  diff  hdfls.tmp2 $srcdir/hdftor8.out1 || errors=1
+  cmp img001-057.057  storm110.raw || errors=1
+  cmp img002-057.057  storm120.raw || errors=1
+  cmp img003-057.057  storm130.raw || errors=1
+  cmp img004-057.057  storm140.raw || errors=1
+  /bin/rm -f storm* img* palette.raw hdfls.tmp2 pal005
+else
+  echo "** r8tohdf, hdftor8 or hdfls not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " r8tohdf or hdftor8 might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo "/bin/rm -f storm* img* palette.raw hdfls.tmp2 pal005 "
+  echo "cp $srcdir/testfiles/storm*.raw $srcdir/testfiles/palette.raw . "
+  echo "./r8tohdf 57 57 storm.hdf storm*.raw "
+  echo "./r8tohdf 57 57 storm.hdf -p palette.raw -i storm110.raw "
+  echo "./hdftor8 storm.hdf "
+  echo "(./hdfls -l storm.hdf | $SED) >& hdfls.tmp2 "
+  echo " diff hdfls.tmp2 $srcdir/hdftor8.out1 "
+  echo "cmp img001-057.057  storm110.raw "
+  echo "cmp img002-057.057  storm120.raw "
+  echo "cmp img003-057.057  storm130.raw "
+  echo "cmp img004-057.057  storm140.raw "
+  echo " ******* END NOTE *************"
+  echo ""
+ errors=0
+fi
+
+# hdfcomp
+if [ -f  hdfcomp -a -f hdfls ]; then
+  echo "** Testing hdfcomp  ***"
+  /bin/rm -f storm*.hdf all*.hdf hdfls.tmp3
+  cp $srcdir/testfiles/storm*.hdf .
+  $TESTS_ENVIRONMENT ./hdfcomp allstorms.hdf storm*.hdf
+  $TESTS_ENVIRONMENT ./hdfcomp allcomp.hdf -c storm*.hdf
+  ($TESTS_ENVIRONMENT ./hdfls -l allstorms.hdf | $SED) > hdfls.tmp3 2>&1
+  ($TESTS_ENVIRONMENT ./hdfls -l allcomp.hdf | $SED) >> hdfls.tmp3 2>&1
+  diff  hdfls.tmp3 $srcdir/hdfcomp.out1 || errors=1
+  /bin/rm -f storm*.hdf all*.hdf hdfls.tmp3
+else
+  echo "** hdfcomp or hdfls not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " hdfcomp might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo "/bin/rm -f storm*.hdf all*.hdf hdfls.tmp3 "
+  echo "cp $srcdir/testfiles/storm*.hdf . "
+  echo "./hdfcomp allstorms.hdf storm*.hdf "
+  echo "./hdfcomp allcomp.hdf -c storm*.hdf "
+  echo "(./hdfls -l allstorms.hdf | $SED) >& hdfls.tmp3 "
+  echo "(./hdfls -l allcomp.hdf | $SED) >>& hdfls.tmp3 "
+  echo "diff hdfls.tmp3 $srcdir/hdfcomp.out1 "
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+#jpeg2hdf/hdf2jpeg
+if [ -f jpeg2hdf -a -f hdf2jpeg -a -f hdfls ]; then
+  echo "** Testing jpeg2hdf/hdf2jpeg  ***"
+  /bin/rm -f jpeg.hdf jpeg_img.jpg jpeg2.jpg hdfls.tmp4
+  cp $srcdir/testfiles/jpeg_img.jpg .
+  $TESTS_ENVIRONMENT ./jpeg2hdf jpeg_img.jpg jpeg.hdf
+  $TESTS_ENVIRONMENT ./hdf2jpeg jpeg.hdf jpeg2.jpg
+  ($TESTS_ENVIRONMENT ./hdfls -l jpeg.hdf | $SED) > hdfls.tmp4 2>&1
+  diff  hdfls.tmp4 $srcdir/jpeg2hdf.out1 || errors=1
+  cmp jpeg_img.jpg jpeg2.jpg || errors=1
+  /bin/rm -f jpeg.hdf jpeg_img.jpg jpeg2.jpg hdfls.tmp4
+else
+  echo "** jpeg2hdf, hdf2jpeg or hdfls  not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " jpeg2hdf or hdf2jpeg might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo "/bin/rm -f jpeg.hdf jpeg_img.jpg jpeg2.jpg hdfls.tmp4 "
+  echo "cp $srcdir/testfiles/jpeg_img.jpg . "
+  echo "./jpeg2hdf jpeg_img.jpg jpeg.hdf "
+  echo "./hdf2jpeg jpeg.hdf jpeg2.jpg "
+  echo "(./hdfls -l jpeg.hdf | $SED) >& hdfls.tmp4 "
+  echo "diff hdfls.tmp4 $srcdir/jpeg2hdf.out1 "
+  echo "cmp jpeg_img.jpg jpeg2.jpg "
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+##
+##  fp2hdf is now called hdfimport, and is in mfhdf/hdfimport
+##
+ # # fp2hdf
+ # if [ -f fp2hdf -a -f hdfls -a -f $HDFED ]; then
+ # echo "** Testing fp2hdf  ***"
+ # if [ ! "$has32" ]; then
+ #     echo "    $machinetype does not support float32."
+ #     echo "    float32 tests skipped."
+ # fi
+ # 
+ # /bin/rm -f ctxtr* cb* *.hdf hdfls.tmp5 hdfed.tmp6
+ # ./fptest
+ # ./fp2hdf ctxtr2 -o ctxtr2.hdf
+ # ./fp2hdf ctxtr3 -o ctxtr3.hdf
+ # if [ "$has32" ]; then
+ # ./fp2hdf cb32r2 -o cb32r2.hdf
+ # ./fp2hdf cb32r3 -o cb32r3.hdf
+ # fi
+ # ./fp2hdf cb64r2 -o cb64r2.hdf
+ # ./fp2hdf cb64r3 -o cb64r3.hdf
+ # ./fp2hdf ctxtr2 -o ctxtr2_ris.hdf -raster -e 50 50
+ # ./fp2hdf cb64r2 -o cb64r2_ris.hdf -raster -i 50 50 -f
+ # (./hdfls -l ctxtr2.hdf | $SED) > hdfls.tmp5 2>&1
+ # (./hdfls -l ctxtr3.hdf | $SED) >> hdfls.tmp5 2>&1
+ # if [ "$has32" ]; then
+ # (./hdfls -l cb32r2.hdf | $SED) >> hdfls.tmp5 2>&1
+ # (./hdfls -l cb32r3.hdf | $SED) >> hdfls.tmp5 2>&1
+ # fi
+ # (./hdfls -l cb64r2.hdf | $SED) >> hdfls.tmp5 2>&1
+ # (./hdfls -l cb64r3.hdf | $SED) >> hdfls.tmp5 2>&1
+ # (./hdfls -l ctxtr2_ris.hdf | $SED) >> hdfls.tmp5 2>&1
+ # (./hdfls -l cb64r2_ris.hdf | $SED) >> hdfls.tmp5 2>&1
+ # if [ "$has32" ]; then
+ #     diff  hdfls.tmp5 $srcdir/fp2hdf.out1 || errors=1
+ #     $HDFEDCMD < $srcdir/fp2hdf.input1 > hdfed.tmp6 2>&1
+ #     diff  hdfed.tmp6 $srcdir/fp2hdf.out2 || errors=1
+ # else
+ #     diff  hdfls.tmp5 $srcdir/fp2hdf.out1-32 || errors=1
+ #     $HDFEDCMD < $srcdir/fp2hdf.input1-32 > hdfed.tmp6 2>&1
+ #     diff  hdfed.tmp6 $srcdir/fp2hdf.out2-32 || errors=1
+ # fi
+ # /bin/rm -f ctxtr* cb* *.hdf hdfls.tmp5 hdfed.tmp6
+ # else
+ # echo "** fp2hdf, hdfed or hdfls not available ***"
+ # fi
+ # 
+ # if [ $errors -eq 1 ]; then
+ #   haserr=1
+ #   echo " ********* NOTE ***************"
+ #   echo " fp2hdf might have failed ***"
+ #   echo " The above errors could be formatting "
+ #   echo " problems which can be ignored "
+ #   echo " please run the following by hand to verify "
+ #   echo " "
+ #   echo "  /bin/rm -f ctxtr* cb* *.hdf hdfls.tmp5 hdfed.tmp6"
+ #   echo " ./fptest "
+ #   echo " ./fp2hdf ctxtr2 -o ctxtr2.hdf "
+ #   echo " ./fp2hdf ctxtr3 -o ctxtr3.hdf "
+ #   if [ "$has32" ]; then
+ #   echo " ./fp2hdf cb32r2 -o cb32r2.hdf "
+ #   echo " ./fp2hdf cb32r3 -o cb32r3.hdf "
+ #   fi
+ #   echo " ./fp2hdf cb64r2 -o cb64r2.hdf "
+ #   echo " ./fp2hdf cb64r3 -o cb64r3.hdf "
+ #   echo " ./fp2hdf ctxtr2 -o ctxtr2_ris.hdf -raster -e 50 50 "
+ #   echo " ./fp2hdf cb64r2 -o cb64r2_ris.hdf -raster -i 50 50 -f "
+ #   echo "( ./hdfls -l ctxtr2.hdf | $SED) >&  hdfls.tmp5 "
+ #   echo "( ./hdfls -l ctxtr3.hdf | $SED) >>& hdfls.tmp5 "
+ #   if [ "$has32" ]; then
+ #   echo "( ./hdfls -l cb32r2.hdf | $SED) >>& hdfls.tmp5 "
+ #   echo "( ./hdfls -l cb32r3.hdf | $SED) >>& hdfls.tmp5 "
+ #   fi
+ #   echo "( ./hdfls -l cb64r2.hdf | $SED) >>& hdfls.tmp5 "
+ #   echo "( ./hdfls -l cb64r3.hdf | $SED) >>& hdfls.tmp5 "
+ #   echo "( ./hdfls -l ctxtr2_ris.hdf | $SED) >>& hdfls.tmp5 "
+ #   echo "( ./hdfls -l cb64r2_ris.hdf | $SED) >>& hdfls.tmp5 "
+ #   if [ "$has32" ]; then
+ #   echo " diff hdfls.tmp5 $srcdir/fp2hdf.out1 "
+ #   echo " $HDFEDCMD < $srcdir/fp2hdf.input1 >& hdfed.tmp6 "
+ #   echo " diff hdfed.tmp6 $srcdir/fp2hdf.out2 "
+ #   else
+ #   echo " diff hdfls.tmp5 $srcdir/fp2hdf.out1-32 "
+ #   echo " $HDFEDCMD < $srcdir/fp2hdf.input1-32 >& hdfed.tmp6 "
+ #   echo " diff hdfed.tmp6 $srcdir/fp2hdf.out2-32 "
+ #   fi
+ #   echo " ******* END NOTE *************"
+ #   echo ""
+ #   errors=0
+ # fi
+
+#
+# Check errors result
+if [ $haserr -eq 0 ]; then
+  echo "=============================="
+  echo "HDF Utilities tests passed."
+  echo "=============================="
+else
+  echo "**************************************"
+  echo "HDF Utilities tests encountered errors"
+  echo "**************************************"
+fi
+
+echo ""
+exit $haserr
diff --git a/hdf/util/vcompat.c b/hdf/util/vcompat.c
new file mode 100644
index 0000000..ffeed97
--- /dev/null
+++ b/hdf/util/vcompat.c
@@ -0,0 +1,43 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: vcompat.c 6013 2014-01-10 21:19:02Z acheng $ */
+#include <stdio.h>
+#include "hdf.h"
+
+int
+main(int argc, char *argv[])
+{
+    if (argc != 2)
+      {
+          fprintf(stderr, "%s: converts HDF vset v1.0 files to v2.0\n", argv[0]);
+          fprintf(stderr, "Usage: %s hdf-file\n", argv[0]);
+          exit(0);
+      }
+
+    if (0 == vcheckcompat(argv[1]))
+      {
+          vmakecompat(argv[1]);
+          fprintf(stderr, "file [%s] is now compatible\n", argv[1]);
+      }
+    else
+        fprintf(stderr, "file [%s] already compatible with r2.0\n", argv[1]);
+
+    return (0);
+}   /* main */
+
+/* ------------------------------------------------------------------ */
diff --git a/hdf/util/vmake.c b/hdf/util/vmake.c
new file mode 100644
index 0000000..01e34bf
--- /dev/null
+++ b/hdf/util/vmake.c
@@ -0,0 +1,613 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: vmake.c 6013 2014-01-10 21:19:02Z acheng $ */
+
+/*****************************************************************************
+*
+* vmake.c
+*
+*   HDF Vset utility.
+*
+*   vmake:  utility creates vsets. May be used in 3 ways:
+*           (1) add a new vgroup.
+*           (2) add a new vdata from ascii data.
+*           (3) link vgroups and vdatas to a vgroup.
+*
+*    USAGE:
+*           (1)     vmake file vgname
+*           (2) vmake file vsname {format} {ascii data stream}
+*           (3) vmake file -l vgref v1 v2 ... vn
+*
+*
+******************************************************************************/
+
+#include "hdf.h"
+
+/*
+ * Prototypes of local functions
+ */
+int32       vsetlink
+            (char *hfile, int32 vgid, int32 ids[], int32 n);
+
+int32       vgadd
+            (char *hfile, char *vgname);
+
+int32       inpdata
+            (unsigned char **bp);
+
+void        vsadd
+            (char *hfile, char *vsname, char *format);
+
+int32       scanit
+            (char *string, char ***fields, int32 **type, int32 **order);
+
+int32       savfld
+            (char *ss, int p1, int p2);
+
+int32       compact
+            (char *ss, char *dd);
+
+int32       savtype
+            (char *ss, int p1, int p2);
+
+int32       separate
+            (char *ss, char *fmt, int32 *num);
+
+int         show_help_msg
+            (void);
+
+void showfmttypes 
+            (void);
+
+/*
+ *  Main entry point
+ */
+int
+main(int ac, char **av)
+{
+
+    char       *hfile, *vgname, *vsname, *fmt;
+
+    if (ac < 3)
+      {
+          show_help_msg();
+          exit(0);
+      }
+    else if (ac == 3)
+      {
+          if (!HDstrcmp(av[2], "-l"))
+            {
+                show_help_msg();
+                exit(0);
+            }
+          hfile = av[1];
+          vgname = av[2];
+          vgadd(hfile, vgname);
+      }
+
+    else if (ac == 4)
+      {
+          if (!HDstrcmp(av[2], "-l"))
+            {
+                show_help_msg();
+                exit(0);
+            }
+          hfile = av[1];
+          vsname = av[2];
+          fmt = av[3];
+          vsadd(hfile, vsname, fmt);
+      }
+
+    else if (!HDstrcmp(av[2], "-l"))
+      {
+          int         i;
+          int32       n;
+          int32       vgref, ids[50];
+
+          hfile = av[1];
+          sscanf(av[3], "%d", (int *)&vgref);
+          for (n = 0, i = 4; i < ac; i++, n++)
+            {
+                sscanf(av[i], "%d", (int *)&ids[n]);
+            }
+          vsetlink(hfile, vgref, ids, n);
+      }
+    else
+      {
+          show_help_msg();
+          exit(0);
+      }
+    return (0);
+}   /* main */
+
+void
+showfmttypes(void)
+{
+    fprintf(stderr, "\tvalid fmt types: \n");
+    fprintf(stderr, "\t  c - char    (char in HDF file)    \n");
+    fprintf(stderr, "\t  b - byte    (int8 in HDF file)    \n");
+    fprintf(stderr, "\t  s - short   (int16 in HDF file)   \n");
+    fprintf(stderr, "\t  l - long    (int32 in HDF file)   \n");
+    fprintf(stderr, "\t  f - float   (float32 in HDF file) \n");
+}
+
+int
+show_help_msg(void)
+{
+
+    printf("\nvmake: creates vsets.\n");
+    printf("\nUSAGE:\n");
+
+    printf(" (1) vmake file vgname             (adds a new vgroup)\n");
+    printf(" (2) vmake file vsname format      (adds a new vdata)\n");
+    printf(" (3) vmake file -l vgref v1 .. vn  (links v1 v2 .. vn into vgref)\n");
+
+    printf("\nwhere\n");
+    printf("  vgref is the ref of a vgroup\n");
+    printf("  v1,..,vn are refs of vgroups and vdatas\n");
+    printf("  format is <field=fmt,field=fmt,..>\n");
+    printf("    field is any text string\n");
+    printf("    fmt is one of the following optionally preceded by a decimal.\n");
+    showfmttypes();
+
+    printf("\nTo create a vdata, vmake reads ascii data from stdin\n");
+
+    printf("EXAMPLES:\n");
+    printf("\t cat dat.txt | vmake hh.hdf \"triangles\" \"PLIST3=3l\"\n");
+    printf("\t vmake abc.hdf \"xyvals\" \"X=d,Y=f\" < abc.dat\n");
+    printf("\n");
+
+    return (1);
+
+}   /* show_help_msg */
+
+/* ------------------------------------------------------- */
+
+int32
+vsetlink(char *hfile, int32 vgid, int32 ids[], int32 n)
+{
+    HFILEID     f;
+    int32       vgmain, vg;
+    int32       vs;
+    int32       err = 0;
+    int32       i;
+
+    f = Hopen(hfile, DFACC_ALL, 0);
+    if (f == FAIL)
+      {
+          fprintf(stderr, "cannot open %s.  \n", hfile);
+          exit(0);
+      }
+    Vinitialize(f);
+    vgmain = Vattach(f, vgid, "w");
+    if (vgmain == FAIL)
+      {
+          fprintf(stderr, "0\n");
+          Vfinish(f);
+          Hclose(f);
+          exit(-1);
+      }
+
+    for (i = 0; i < n; i++)
+      {
+          if (-1 != vexistvg(f, (uint16) ids[i]))
+            {
+                if ((vg = Vattach(f, ids[i], "r")) != FAIL)
+                  {
+                      if (Vinsert(vgmain, vg) == -1)
+                        {   /*  is really VGROUP* */
+                            err = 1;
+                            fprintf(stderr, "insert a vg (%d)fails!!\n", (int) ids[i]);
+                        }
+                      Vdetach(vg);
+                  }
+            }
+          else if (-1 != vexistvs(f, (uint16) ids[i]))
+            {
+                if ((vs = VSattach(f, ids[i], "r")) != FAIL)
+                  {
+                      if (Vinsert(vgmain, vs) == FAIL)
+                        {
+                            err = 1;
+                            fprintf(stderr, "insert a vs (%d)fails!!\n", (int) ids[i]);
+                        }
+                      VSdetach(vs);
+                  }
+            }
+          else
+            {
+                fprintf(stderr, "no such vgroup or vdata [%d]\n", (int) ids[i]);
+                err = 1;
+            }
+      }
+
+    Vdetach(vgmain);
+    Vfinish(f);
+    Hclose(f);
+
+    if (err)
+        exit(-1);
+    else
+        fprintf(stderr, "1\n");     /* success */
+    return (1);
+}   /* vsetlink */
+
+/* ------------------------------------------------------- */
+/*
+   add a (new) vgroup to the file
+ */
+
+int32
+vgadd(char *hfile, char *vgname)
+{
+    HFILEID     f;
+    int32       ref;
+    int32       vg;
+
+    f = Hopen(hfile, DFACC_ALL, 0);
+    if (f == FAIL)
+      {
+          fprintf(stderr, "cannot open %s. \n", hfile);
+          exit(0);
+      }
+    Vinitialize(f);
+    vg = Vattach(f, -1, "w");
+    if (vg == FAIL)
+      {
+          fprintf(stderr, "cannot attach vg\n");
+          exit(0);
+      }
+    ref = VQueryref(vg);
+    Vsetname(vg, vgname);
+    Vdetach(vg);
+    Vfinish(f);
+    Hclose(f);
+    fprintf(stderr, "%d\n", (int) ref);
+    return (1);
+
+}   /* vgadd */
+
+/* ------------------------------------------------------- */
+/*
+   add a (new) vdata to the file.
+   Data will be ascii and will come in from stdin
+   according to the format (c-style).
+ */
+void
+vsadd(char *hfile, char *vsname, char *format)
+{
+    int32       ret, i, n, nwritten;
+    unsigned char *buf;
+    char      **fields;
+    int32      *type, *order, nfld;
+    char        allfields[100];
+    HFILEID     f;
+    int32       vs;
+    int32       ref, ftype;
+
+    nfld = scanit(format, &fields, &type, &order);
+    if (nfld < 1)
+      {
+          fprintf(stderr, "bad fields\n");
+          exit(-1);
+      }
+
+    if ((f = Hopen(hfile, DFACC_ALL, 0)) == FAIL)
+      {
+          fprintf(stderr, "cannot open %s.  \n", hfile);
+          exit(-1);
+      }
+    Vinitialize(f);
+    vs = VSattach(f, -1, "w");
+    ref = VSQueryref(vs);
+
+    printf("vsadd: ref is %d\n", (int) ref);
+
+    allfields[0] = '\0';
+    for (i = 0; i < nfld; i++)
+      {
+          switch (type[i])
+            {
+                case 'c':
+                    ftype = DFNT_CHAR;
+                    break;
+                case 's':
+                    ftype = DFNT_INT16;
+                    break;
+                case 'f':
+                    ftype = DFNT_FLOAT32;
+                    break;
+                case 'l':
+                    ftype = DFNT_INT32;
+                    break;
+                case 'b':
+                    ftype = DFNT_INT8;
+                    break;
+                case 'D':
+                    ftype = DFNT_DOUBLE;
+                    break;
+
+                default:
+                    fprintf(stderr, "bad type [%c]\n", (char) type[i]);
+                    showfmttypes();
+                    exit(-1);
+                    break;
+            }
+          ret = VSfdefine(vs, fields[i], ftype, order[i]);
+          HDstrcat(allfields, fields[i]);
+          HDstrcat(allfields, ",");
+      }
+
+    i = (int32)HDstrlen(allfields);
+    allfields[i - 1] = '\0';    /* remove last comma */
+
+    VSsetname(vs, vsname);
+    ret = VSsetfields(vs, allfields);
+
+    nwritten = 0;
+    while ((n = inpdata(&buf)) > 0)
+      {
+          /*  printf("inpdata rets n=%d .. ",n); */
+          ret = VSwrite(vs, buf, n, FULL_INTERLACE);
+          printf("+%d  \n", (int) ret);
+          nwritten += n;
+          if (ret < 1)
+              fprintf(stderr, "Vswrite stat=%d\n", (int) ret);
+      }
+    VSdetach(vs);
+    Vfinish(f);
+    Hclose(f);
+    fprintf(stderr, "%d, %d\n", (int) ref, (int) nwritten);
+    return;
+
+}   /* vsadd */
+
+/* ------------------------------------------------------------------ */
+/* This part of the code deals with formatting stdin input data.      */
+/* ------------------------------------------------------------------ */
+
+#include <stdio.h>
+
+#define MAXVAR 32
+static char *fldptr[MAXVAR];
+static char flds[MAXVAR][100];
+static char fmts[MAXVAR];
+static int32 fords[MAXVAR];
+static int32 ftyp[MAXVAR];
+static int  ntotal = 0;
+
+/* scanf functions */
+static int32
+inplong(VOIDP x)
+{
+    int32       val, ret;
+
+    ret = scanf("%d ", (int *)&val);
+    *(int32 *)x = (int32) val;
+    return (ret);
+}
+
+static int32
+inpshort(VOIDP x)
+{
+    int         ret, val;
+
+    ret = scanf("%d ", &val);
+    *(int16 *)x = (int16) val;
+    return (ret);
+}
+
+static int32
+inpbyte(VOIDP x)
+{
+    int         ret;
+    int         val;
+
+    ret = scanf("%d ", &val);
+    *(int8 *)x = (int8) val;
+    return (ret);
+}
+
+static int32
+inpfloat(VOIDP x)
+{
+    int         ret;
+    float       val;
+
+    ret = scanf("%f ", &val);
+    *(float32 *)x = (float32) val;
+    return (ret);
+}
+
+static int32
+inpchar(VOIDP x)
+{
+    return (scanf("%c ", (char *)x));
+}
+
+#define BUFSIZE 40000
+unsigned char inpbuffer[BUFSIZE];
+
+int32
+inpdata(unsigned char **bp)
+{
+    int32       totalsize, nread, t, i, j, k;
+    unsigned char *b;
+    int32       maxrec;
+    int32       (*inpfn[MAXVAR]) (VOIDP);
+    int32       inpsiz[MAXVAR];
+
+    for (i = 0; i < ntotal; i++)
+      {
+          switch (fmts[i])
+            {
+
+                case 'c':
+                    inpfn[i] = inpchar;
+                    inpsiz[i] = sizeof(char);
+                    break;
+
+                case 'b':
+                    inpfn[i] = inpbyte;
+                    inpsiz[i] = sizeof(int8);
+                    break;
+
+                case 's':
+                    inpfn[i] = inpshort;
+                    inpsiz[i] = sizeof(short);
+                    break;
+
+                case 'l':
+                    inpfn[i] = inplong;
+                    inpsiz[i] = sizeof(long);
+                    break;
+
+                case 'f':
+                    inpfn[i] = inpfloat;
+                    inpsiz[i] = sizeof(float);
+                    break;
+
+                default:
+                    printf("inpdata: fmt routine for [%c] not ready\n", fmts[i]);
+            }
+      }
+    for (totalsize = 0, i = 0; i < ntotal; i++)
+        totalsize += (fords[i] * inpsiz[i]);
+    maxrec = BUFSIZE / totalsize - 1;
+
+    /* begin reading in the ascii data from stdin */
+
+    *bp = b = inpbuffer;
+    for (nread = 0, j = 0; j < maxrec; j++, nread++)
+      {
+          for (i = 0; i < ntotal; i++)
+            {
+                for (k = 0; k < fords[i]; k++)
+                  {
+                      t = (inpfn[i]) (b);
+                      if (t == EOF)
+                          return (nread);
+                      b += inpsiz[i];
+                  }
+            }
+      }
+
+    return (nread);     /* no of recs read */
+
+}   /* inpdata */
+
+int32
+scanit(char *string, char ***fields, int32 **type, int32 **order)
+{
+    int32       ns, i;
+    int32       p1, p2;
+    char        ss[300];
+    int32       c;
+
+    compact(string, ss);
+    ns = (int32)HDstrlen(ss);
+    ss[ns++] = ',';
+
+    p1 = p2 = 0;
+    for (i = 0; i < ns; i++)
+      {
+          c = (int32)ss[i];
+          if (c == '=')
+            {
+                p2 = i;
+                savfld(ss, (int) p1, (int) (p2 - 1));
+                p1 = p2 + 1;
+            }
+          else if (c == ',')
+            {
+                p2 = i;
+                savtype(ss, (int) p1, (int) (p2 - 1));
+                p1 = p2 + 1;
+            }
+      }
+    for (i = 0; i < ntotal; i++)
+      {
+          fldptr[i] = flds[i];
+          ftyp[i] = (int32)fmts[i];
+      }
+
+    *type = ftyp;
+    *order = fords;
+    *fields = fldptr;
+    return (ntotal);
+
+}   /* scanit */
+
+int32
+compact(char *ss, char *dd)
+{
+    int         i, t, n = (int)HDstrlen(ss);
+    for (t = 0, i = 0; i < n; i++)
+        if (ss[i] != ' ')
+          {
+              dd[t++] = ss[i];
+          }
+    dd[t] = '\0';
+    return (1);
+}
+
+/* ------------------------------------------------------------------ */
+int32
+savfld(char *ss, int p1, int p2)
+{
+    int32       t = p2 - p1 + 1;
+
+    HDstrncpy(flds[ntotal], &ss[p1], (size_t) t);
+    flds[ntotal][t] = '\0';
+    return (1);
+}   /* savfld */
+
+int32
+savtype(char *ss, int p1, int p2)
+{
+    char        temp[20];
+    int32       t = p2 - p1 + 1;
+    HDstrncpy(temp, &ss[p1], (size_t)(p2 - p1 + 1));
+    temp[t] = '\0';
+    separate(temp, &fmts[ntotal], &fords[ntotal]);
+    ntotal++;
+    return (1);
+
+}
+
+int32
+separate(char *ss, char *fmt, int32 *num)
+{
+    int32       i, n;
+    i = 0;
+    n = (int32)HDstrlen(ss);
+    while (i < n)
+      {
+          if (ss[i] < '0' || ss[i] > '9')
+              break;
+          i++;
+      }
+    if (i > 0)
+        sscanf(ss, "%d", (int *)num);
+    else
+        *num = 1;
+    *fmt = ss[i];
+    return (1);
+}
+
+/* ------------------------------------------------------------------ */
diff --git a/hdf/util/vshow.c b/hdf/util/vshow.c
new file mode 100644
index 0000000..bf7aea5
--- /dev/null
+++ b/hdf/util/vshow.c
@@ -0,0 +1,810 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: vshow.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*****************************************************************************
+*
+* vshow.c
+*
+*   HDF Vset utility.
+*
+*   vshow:  dumps out vsets in a hdf file.
+*
+*   Usage:  vshow file [+|-[n]]
+*       the '+' option indicates a full dump
+*       the '-' option indicates a full dump with one record per line
+*       'n' means only for the nth vdata.
+*
+*
+******************************************************************************/
+#define VSET_INTERFACE
+#include "hdf.h"
+
+static int  condensed;
+
+static int32 vsdumpfull
+            (int32 vs);
+
+static int32 fmtbyte
+            (char *x);
+static int32 fmtchar
+            (char *x);
+
+#ifdef UNUSED
+static int32 fmtint
+            (char *x);
+#endif /* UNUSED */
+
+static int32 fmtfloat
+            (char *x);
+
+static int32 fmtulong
+            (char *x);
+
+static int32 fmtlong
+            (char *x);
+
+static int32 fmtshort
+            (char *x);
+
+static int32 fmtdouble
+            (char *x);
+
+static intn dumpattr
+            (int32 vid, intn full, intn isvs);
+
+int
+main(int ac, char **av)
+{
+    int32       vg, vgt;
+    int32       vgotag, vgoref;
+    int32       vs;
+    int32       vsotag, vsoref;
+    HFILEID     f;
+    int32       vgid = -1;
+    int32       vsid = -1;
+    int32       vsno = 0;
+    int32       vstag;
+
+    int32       i, t, nvg, n, ne, nv, interlace, vsize;
+    int32      *lonevs;         /* array to store refs of all lone vdatas */
+    int32       nlone;          /* total number of lone vdatas */
+    uint16	name_len;	/* length of vgroup's name or classname */
+
+    char        fields[VSFIELDMAX*FIELDNAMELENMAX];
+    char        *vgname, *vgclass;
+    char        vsname[VSNAMELENMAX];
+    char        vsclass[VSNAMELENMAX];
+    char *name;
+    int32       fulldump = 0, full;
+
+    if (ac == 3)
+        if (av[2][0] == '-' || av[2][0] == '+')
+          {
+              sscanf(&(av[2][1]), "%d", (int *)&vsno);
+              if (vsno == 0)
+                {
+                    printf("FULL DUMP\n");
+                }
+              else
+                {
+                    printf("FULL DUMP on vs#%ld\n", (long) vsno);
+                }
+              fulldump = 1;
+              if (av[2][0] == '+')
+                  condensed = 1;
+              else
+                  condensed = 0;
+          }
+
+    if (ac < 2)
+      {
+          printf("%s: dumps HDF vsets info from hdf file\n", av[0]);
+          printf("usage: %s file [+|-[n]]\n", av[0]);
+          printf("\t +  gives full dump of all vdatas.\n");
+          printf("\t -  gives full dump of all vdatas one record per line.\n");
+          printf("\t n  gives full dump of vdata with id n.\n");
+          exit(0);
+      }
+
+    if ((f = Hopen(av[1], DFACC_READ, 0)) == FAIL)
+    {
+        printf("\nFile (%s) failed to open.\n", av[1]);
+        exit(0);
+    }
+
+    Vstart(f);
+    printf("\nFILE: %s\n", av[1]);
+
+    nvg = 0;
+    while ((vgid = Vgetid(f, vgid)) != -1)
+      {
+          vg = Vattach(f, vgid, "r");
+          if (vg == FAIL)
+            {
+                printf("cannot open vg id=%d\n", (int) vgid);
+            }
+          /* get the length of the vgname to allocate enough space */
+          Vgetnamelen(vg, &name_len);
+          vgname = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+	  if (vgname == NULL)
+	  {
+             printf("Error: Out of memory. Cannot allocate %d bytes space. Quit.\n", name_len+1);
+             return(0);
+          }
+          Vinquire(vg, &n, vgname);
+          if (HDstrlen(vgname) == 0)
+              HDstrcat(vgname, "NoName");
+
+          vgotag = VQuerytag(vg);
+          vgoref = VQueryref(vg);
+
+          /* get the length of the vgname to allocate enough space */
+          Vgetclassnamelen(vg, &name_len);
+          vgclass = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+	  if (vgclass == NULL)
+	  {
+             printf("Error: Out of memory. Cannot allocate %d bytes space. Quit.\n", name_len+1);
+             return(0);
+          }
+          Vgetclass(vg, vgclass);
+          if (HDstrlen(vgclass) == 0)
+              HDstrcat(vgclass, "NoClass");
+
+          printf("\nvg:%d <%d/%d> (%s {%s}) has %d entries:\n",
+           (int) nvg, (int) vgotag, (int) vgoref, vgname, vgclass, (int) n);
+          dumpattr(vg, fulldump, 0);
+          for (t = 0; t < Vntagrefs(vg); t++)
+            {
+                Vgettagref(vg, t, &vstag, &vsid);
+
+                /* ------ V D A T A ---------- */
+                if (vstag == VSDESCTAG)
+                  {
+                      vs = VSattach(f, vsid, "r");
+
+                      if (vs == FAIL)
+                        {
+                            printf("cannot open vs id=%d\n", (int) vsid);
+                            continue;
+                        }
+
+                      VSinquire(vs, &nv, &interlace, fields, &vsize, vsname);
+                      vsotag = VSQuerytag(vs);
+                      vsoref = VSQueryref(vs);
+                      if (HDstrlen(vsname) == 0)
+                          HDstrcat(vsname, "NoName");
+                      VSgetclass(vs, vsclass);
+                      printf("  vs:%d <%d/%d> nv=%d i=%d fld [%s] vsize=%d (%s {%s})\n",
+                             (int) t, (int) vsotag, (int) vsoref, (int) nv, (int) interlace, fields, (int) vsize, vsname, vsclass);
+
+                      if (fulldump && vsno == 0)
+                          vsdumpfull(vs);
+                      else if (fulldump && vsno == vsoref)
+                          vsdumpfull(vs);
+                      /* dump attributes */
+                      full = fulldump && (vsno == 0 || vsno == vsoref);
+                      dumpattr(vs, full, 1);
+                                         
+                      VSdetach(vs);
+                  }
+                else if (vstag == DFTAG_VG)
+                  {
+                      /* ------ V G R O U P ----- */
+                      vgt = Vattach(f, vsid, "r");
+
+                      if (vgt == FAIL)
+                        {
+                            printf("cannot open vg id=%d\n", (int) vsid);
+                            continue;
+                        }
+
+                      /* get length of the vgclass to allocate enough space */
+                      Vgetclassnamelen(vgt, &name_len);
+                      vgclass = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+	              if (vgclass == NULL)
+	              {
+                         printf("Error: Out of memory. Cannot allocate %d bytes space. Quit.\n", name_len+1);
+                         return(0);
+                      }
+                      Vgetclass(vg, vgclass);
+                      if (HDstrlen(vgclass) == 0)
+                          HDstrcat(vgclass, "NoClass");
+
+                      /* get length of the vgname to allocate enough space */
+                      Vgetnamelen(vgt, &name_len);
+                      vgname = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+	              if (vgname == NULL)
+	              {
+                         printf("Error: Out of memory. Cannot allocate %d bytes space. Quit.\n", name_len+1);
+                         return(0);
+                      }
+                      Vinquire(vgt, &ne, vgname);
+                      if (HDstrlen(vgname) == 0)
+                          HDstrcat(vgname, "NoName");
+                      vgotag = VQuerytag(vgt);
+                      vgoref = VQueryref(vgt);
+                      Vgetclass(vgt, vgclass);
+                      printf("  vg:%d <%d/%d> ne=%d (%s {%s})\n",
+                             (int) t, (int) vgotag, (int) vgoref, (int) ne, vgname, vgclass);
+                      dumpattr(vg, fulldump, 0);
+                      Vdetach(vgt);
+                  }
+                else
+                  {
+                      name = HDgettagsname((uint16) vstag);
+                      if (!name)
+                          printf("  --:%d <%d/%d> %s\n", (int) t, (int) vstag, (int) vsid, "Unknown Tag");
+                      else
+                        {
+                            printf("  --:%d <%d/%d> %s\n", (int) t, (int) vstag, (int) vsid, name);
+                            HDfree(name);
+                        } /* end else */
+                  }
+            }   /* while */
+
+          Vdetach(vg);
+          nvg++;
+
+      }     /* while */
+
+    if (nvg == 0)
+      {
+          printf("No vgroups in this file\n");
+      }
+
+    nlone = VSlone(f, NULL, 0);
+    if (nlone > 0)
+      {
+
+          printf("Lone vdatas:\n");
+          if (NULL == (lonevs = (int32 *) HDmalloc(sizeof(int) * (size_t)nlone)))
+            {
+                printf("%s: File has %d lone vdatas but ", av[0], (int) nlone);
+                printf("cannot alloc lonevs space. Quit.\n");
+                exit(0);
+            }
+
+          VSlone(f, lonevs, nlone);
+          for (i = 0; i < nlone; i++)
+            {
+                vsid = lonevs[i];
+                if (FAIL == (vs = VSattach(f, lonevs[i], "r")))
+                  {
+                      printf("cannot open vs id=%d\n", (int) vsid);
+                      continue;
+                  }
+                VSinquire(vs, &nv, &interlace, fields, &vsize, vsname);
+                if (HDstrlen(vsname) == 0)
+                    HDstrcat(vsname, "NoName");
+                vsotag = VSQuerytag(vs);
+                vsoref = VSQueryref(vs);
+                VSgetclass(vs, vsclass);
+                printf("L vs:%d <%d/%d> nv=%d i=%d fld [%s] vsize=%d (%s {%s})\n",
+                       (int) vsid, (int) vsotag, (int) vsoref, (int) nv, (int) interlace, fields, (int) vsize, vsname, vsclass);
+                if (fulldump && vsno == 0)
+                    vsdumpfull(vs);
+                else if (fulldump && vsno == vsoref)
+                    vsdumpfull(vs);
+                full = fulldump && ( vsno == 0 || vsno == vsoref);
+                dumpattr(vs, full, 1);
+                VSdetach(vs);
+            }
+          HDfree(lonevs);
+      }
+
+    Vend(f);
+    Hclose(f);
+
+    return (0);
+
+}   /* main */
+
+static int32 cn = 0;
+
+/* ------------------------------------------------ */
+/* printing functions used by vsdumpfull(). */
+static int32
+fmtbyte(char *x)
+{
+    cn += printf("%02x ", *x);
+    return (1);
+}
+
+static int32
+fmtchar(char *x)
+{
+    cn++;
+    putchar(*x);
+    return (1);
+}
+
+#ifdef UNUSED
+static int32
+fmtint(char *x)
+{
+    int         i = 0;
+    HDmemcpy(&i, x, sizeof(int32));
+    cn += printf("%d", i);
+    return (1);
+}
+#endif /* UNUSED */
+
+static int32
+fmtfloat(char *x)
+{
+    float       f = (float)0.0;
+    HDmemcpy(&f, x, sizeof(float32));
+    cn += printf("%f", f);
+    return (1);
+}
+
+static int32
+fmtulong(char *x)
+{
+    unsigned    l = 0;
+    HDmemcpy(&l, x, sizeof(int32));
+    cn += printf("%u", l);
+    return (1);
+}
+
+static int32
+fmtlong(char *x)
+{
+    long        l = 0;
+    HDmemcpy(&l, x, sizeof(int32));
+    cn += printf("%ld", l);
+    return (1);
+}
+
+static int32
+fmtshort(char *x)
+{
+    short       s = 0;
+    HDmemcpy(&s, x, sizeof(int16));
+    cn += printf("%d", s);
+    return (1);
+}
+
+static int32
+fmtdouble(char *x)
+{
+    double      d = 0.0;
+    HDmemcpy(&d, x, sizeof(float64));
+    cn += printf("%f", d);
+    return (1);
+}
+
+#define BUFFER 1000000
+
+/* ------------------------------------------------ */
+
+static int32
+vsdumpfull(int32 vs)
+{
+    char        fields[VSFIELDMAX*FIELDNAMELENMAX]; 
+    char        vsname[100];
+    int32       j, i, t, interlace, nv, vsize;
+    uint8      *bb, *b;
+    DYN_VWRITELIST *w;
+    int32       (*fmtfn[VSFIELDMAX]) (char *);
+    int32       off[VSFIELDMAX];
+    int32       order[VSFIELDMAX];
+
+    int32       bufsize;        /* size of the buffer we are using */
+    int32       chunk;          /* number of rows that will fit in the buffer */
+    int32       done;           /* number of rows we have done */
+    int32       count;          /* number of rows to do this time through the loop */
+
+    int32       nf;             /* number of fields in this Vdata */
+
+    VSinquire(vs, &nv, &interlace, fields, &vsize, vsname);
+
+    if (nv * vsize > BUFFER)
+      {
+          bufsize = BUFFER;
+          chunk = BUFFER / vsize;
+      }
+    else
+      {
+          bufsize = nv * vsize;
+          chunk = nv;
+      }
+
+    done = 0;
+    bb = (uint8 *) HDmalloc(bufsize);
+    if (bb == NULL)
+      {
+          printf("vsdumpfull malloc error\n");
+          return (0);
+      }
+
+    VSsetfields(vs, fields);
+
+    w = vswritelist(vs);
+
+    nf = w->n;
+    for (i = 0; i < w->n; i++)
+      {
+          printf("%d: fld [%s], type=%d, order=%d\n", (int) i, w->name[i], w->type[i], w->order[i]);
+
+          order[i] = (int32)w->order[i];
+          off[i] = DFKNTsize(w->type[i] | DFNT_NATIVE);
+
+          switch (w->type[i])
+            {
+
+                case DFNT_CHAR:
+                case DFNT_UCHAR:
+                    fmtfn[i] = fmtchar;
+                    break;
+
+                case DFNT_UINT8:
+                case DFNT_INT8:
+                    fmtfn[i] = fmtbyte;
+                    break;
+
+                case DFNT_UINT16:
+                case DFNT_INT16:
+                    fmtfn[i] = fmtshort;
+                    break;
+
+                case DFNT_UINT32:
+                      fmtfn[i] = fmtulong;
+                      break;
+
+                case DFNT_INT32:
+                    fmtfn[i] = fmtlong;
+                    break;
+
+                case DFNT_FLOAT32:
+                    fmtfn[i] = fmtfloat;
+                    break;
+
+                case DFNT_FLOAT64:
+                    fmtfn[i] = fmtdouble;
+                    break;
+
+                default:
+                    fprintf(stderr, "sorry, type [%d] not supported\n", (int) w->type[i]);
+                    break;
+
+            }
+      }
+
+    cn = 0;
+
+    done = count = 0;
+    while (done != nv)
+      {
+
+          /* figure out how many to read this time */
+          if ((nv - done) > chunk)
+              count = chunk;
+          else
+              count = nv - done;
+
+          /* read and update bookkeeping */
+          VSread(vs, bb, count, interlace);
+          done += count;
+          b = bb;
+
+          /* print out the data */
+          for (j = 0; j < count; j++)
+            {
+                for (i = 0; i < nf; i++)
+                  {
+                      for (t = 0; t < order[i]; t++)
+                        {
+                            (fmtfn[i]) ((char *)b);
+                            b += off[i];
+                            putchar(' ');
+                            cn++;
+                        }
+                      putchar(' ');
+                      cn++;
+                  }
+
+                /*
+                 * if condensed == TRUE put as many as possible on one line else
+                 *   put one record per line
+                 */
+                if (condensed)
+                  {
+                      if (cn > 65)
+                        {
+                            putchar('\n');
+                            cn = 0;
+                        }
+                  }
+                else
+                  {
+                      putchar('\n');
+                  }
+            }
+
+      }
+
+    /* ============================================ */
+
+    HDfree(bb);
+    printf("\n");
+
+    return (1);
+
+}   /* vsdumpfull */
+/* ------------------------------------------------ */
+static intn dumpattr(int32 vid, intn full, intn isvs)
+{
+   intn i, j, k, cn=0;
+   VDATA *vs;
+   vsinstance_t *vs_inst;
+   VGROUP *vg;
+   vginstance_t *v;
+   intn ret, nattrs, f_nattrs, alloc_flag=0;
+   vs_attr_t *vs_alist;
+   vg_attr_t *v_alist;
+   int32 i_type, i_count, i_size, off;
+   uint8 *buf=NULL, *ptr;
+   int32 (*fmtfn)(char *) =NULL;
+   char name[FIELDNAMELENMAX+1];
+   intn ret_val = SUCCEED;
+   uint8 attrbuf[BUFFER];
+
+   if (isvs)  {
+      vs_inst = (vsinstance_t *)HAatom_object(vid);
+      if (vs_inst == NULL)  {
+         printf(">>>dumpattr:failed in getting vdata instance.\n");
+         ret_val = FAIL;
+         goto done;
+      } 
+      vs = vs_inst->vs;
+      if (vs == NULL)  {
+         printf(">>>dumpattr:Failed in getting vs. \n");
+         ret_val = FAIL;
+         goto done;
+      }
+      if (0 == (nattrs = VSnattrs(vid))) {
+          printf(" 0 attributes.\n");
+          ret_val = SUCCEED;
+          goto done;
+      }
+      vs_alist = vs->alist;
+      if (!full) {
+          printf("     %d attributes:  attr_tag/ref     attr_of_field\n",
+                       nattrs);
+          for (i=0; i<nattrs; i++)  {
+             if (vs_alist->findex != (int)_HDF_VDATA)
+                 printf("     %d:               %d/%d               %d\n",
+                 i, vs_alist->atag, vs_alist->aref,(int)vs_alist->findex);
+             else
+                 printf("     %d:               %d/%d         %s\n",
+                 i, vs_alist->atag, vs_alist->aref, "VDATA");
+             vs_alist++;
+         }
+         ret_val = SUCCEED;
+         goto done;
+      }
+      printf("%d attributes:\n", nattrs);
+      for (j=-1; j<vs->wlist.n; j++)  
+      {	  int32 temp;
+
+	  temp = (j == -1) ? (int)_HDF_VDATA : j;
+          f_nattrs = VSfnattrs(vid, temp);
+          if (f_nattrs == 0) continue;  /* no attr for this field */
+          if (j == -1)
+              printf("   Attrs of vdata:\n");
+          else
+  	      printf("   Attrs of field %d:\n", j);
+          for (i = 0; i<f_nattrs; i++)  {   /* dump the attrs */
+              ret = VSattrinfo(vid, temp, i, name, &i_type, &i_count, &i_size);
+              if (ret == FAIL) {
+                 printf(">>>dumpattr: failed in getting attr info.\n");
+                 continue;
+              }
+              printf("     %d: name=%s type=%d count=%d size=%d\n",
+                       i, name, (int)i_type, (int)i_count, (int)i_size);
+              if (i_size > BUFFER) {
+                  if (NULL == (buf = HDmalloc(i_size)))  {
+                     printf(">>>dumpattr:can't allocate buf.\n");
+                     continue;
+                  }
+                  alloc_flag = 1;
+                  if ( FAIL==VSgetattr(vid, temp, i, buf)) {
+                     printf(">>>dympattr: failed in VSgetattr.\n");
+                     continue;
+                  }
+              }
+              else 
+              {
+                 if ( FAIL==VSgetattr(vid, temp, i, attrbuf)) {
+                     printf(">>>dympattr: failed in VSgetattr.\n");
+                     continue;
+                  }
+              }
+              /* format output */
+              switch (i_type)  {
+                 case DFNT_CHAR:
+                 case DFNT_UCHAR:
+                      fmtfn = fmtchar;
+                      break;
+                 case DFNT_UINT8:
+                 case DFNT_INT8:
+                      fmtfn = fmtbyte;
+                      break;
+                 case DFNT_UINT16:
+                 case DFNT_INT16:
+                      fmtfn = fmtshort;
+                      break;
+                 case DFNT_UINT32:
+                      fmtfn = fmtulong;
+                      break;
+                 case DFNT_INT32:
+                      fmtfn = fmtlong;
+                      break;
+                 case DFNT_FLOAT32:
+                      fmtfn = fmtfloat;
+                      break;
+                 case DFNT_FLOAT64:
+                      fmtfn = fmtdouble;
+                      break;
+                default:
+                    printf(">>>dumpattr: sorry, type [%d] not supported\n", (int) i_type);
+                    break;
+              }
+              off = DFKNTsize(i_type | DFNT_NATIVE);
+              ptr = (alloc_flag) ? buf : attrbuf;
+              putchar('\t');
+              cn = 0;
+              for (k=0; k<i_count; k++)  {
+                  fmtfn((char *)ptr);
+                  ptr += off;
+                  putchar(' ');
+                  cn++;
+                  if (cn > 55)  {
+                     putchar('\n');
+                     putchar('\t');
+                     cn = 0;
+                  }
+              }
+              if (cn) putchar('\n');
+              if (alloc_flag) {
+                 if ( buf != NULL) 
+                    HDfree(buf);
+                 alloc_flag = 0;
+              }
+          }  /*  attr */
+      }   /* field   */
+   }  /* isvs */
+
+   else {  /* vgroup */
+      v = (vginstance_t *)HAatom_object(vid);
+      if (v== NULL)  {
+         printf(">>>dumpattr:failed in getting vgroup instance.\n");
+         ret_val = FAIL;
+         goto done;
+      } 
+      vg = v->vg;
+      if (vg == NULL)  {
+         printf(">>>dumpattr:Failed in getting vg. \n");
+         ret_val = FAIL;
+         goto done;
+      }
+      if (0 == (nattrs = Vnattrs(vid)))  {
+          printf("  0 attributes.\n");
+          ret_val = SUCCEED;
+          goto done;
+      }
+      v_alist = vg->alist;
+      if (!full) {
+          printf("%d attributes:       attr_tag/ref  \n", nattrs);
+          for (i=0; i<nattrs; i++)  {
+             printf("     %d:               %d/%d    \n",
+                 i, v_alist->atag, v_alist->aref);
+             v_alist++;
+         }
+          ret_val = SUCCEED;
+          goto done;
+      }
+      printf("%d attributes:\n", nattrs);
+      for (i = 0; i<nattrs; i++)  {   /* dump the attrs */
+          ret = Vattrinfo(vid, i, name, &i_type, &i_count, &i_size);
+          if (ret == FAIL) {
+              printf(">>>dumpattr: failed in getting attr info.\n");
+              continue;
+          }
+          printf("   %d: name=%s type=%d count=%d size=%d\n",
+                     i,  name, (int)i_type, (int)i_count, (int)i_size);
+          if (i_size > BUFFER) {
+              if (NULL == (buf = HDmalloc(i_size)))  {
+                 printf(">>>dumpattr:can't allocate buf.\n");
+                 continue;
+              }
+              alloc_flag = 1;
+              if ( FAIL == Vgetattr(vid, i, buf)) {
+                 printf(">>>dympattr: failed in Vgetattr.\n");
+                 continue;
+              }
+          }
+          else 
+          {
+             if ( FAIL == Vgetattr(vid, i, attrbuf)) {
+                 printf(">>>dympattr: failed in Vgetattr.\n");
+                 continue;
+              }
+          }
+          /* format output */
+          switch (i_type)  {
+             case DFNT_CHAR:
+             case DFNT_UCHAR:
+                  fmtfn = fmtchar;
+                  break;
+             case DFNT_UINT8:
+             case DFNT_INT8:
+                  fmtfn = fmtbyte;
+                  break;
+             case DFNT_UINT16:
+             case DFNT_INT16:
+                  fmtfn = fmtshort;
+                  break;
+             case DFNT_UINT32:
+                  fmtfn = fmtulong;
+                  break;
+             case DFNT_INT32:
+                  fmtfn = fmtlong;
+                  break;
+             case DFNT_FLOAT32:
+                  fmtfn = fmtfloat;
+                  break;
+             case DFNT_FLOAT64:
+                  fmtfn = fmtdouble;
+                  break;
+             default:
+                printf(">>>dumpattr: sorry, type [%d] not supported\n", (int) i_type);
+                break;
+          }
+          off = DFKNTsize(i_type | DFNT_NATIVE);
+          ptr = (alloc_flag) ? buf : attrbuf;
+          putchar('\t');
+          cn = 0;
+          for (k=0; k<i_count; k++)  {
+              fmtfn((char *)ptr);
+              ptr += off;
+              putchar(' ');
+              cn++;
+              if (cn > 55)  {
+                 putchar('\n');
+                 putchar('\t');
+                 cn = 0;
+              }
+          }
+          if (cn) putchar('\n');
+          if (alloc_flag) {
+             if ( buf != NULL) 
+                HDfree(buf);
+             alloc_flag = 0;
+          }
+      }  /*  attr */
+   }  /* vgroup */
+   
+   ret_val = SUCCEED;
+
+done:
+   return ret_val;
+}                   
+/* ------------------------------------- */
diff --git a/hdf/util/writehdf.c b/hdf/util/writehdf.c
new file mode 100644
index 0000000..42ebc4c
--- /dev/null
+++ b/hdf/util/writehdf.c
@@ -0,0 +1,215 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <hdf.h>
+#include "gif.h"
+#include <string.h>
+#include <stdlib.h>
+
+int
+WriteHDF(GifMemoryStruct, HDFName , GIFFileName)
+GIFTOMEM GifMemoryStruct;
+char     *HDFName;
+char     *GIFFileName;
+{
+	GIFHEAD            gifHead;           /* GIF Header structure            */
+    GIFIMAGEDESC	   gifImageDesc;      /* Logical Image Descriptor struct */
+
+	
+	intn  status;       /* status for functions returning an intn */
+	int32 file_id,      /* HDF file identifier */
+		gr_id,          /* GR interface identifier */
+		ri_id,
+		vgroup_id,		/* VGroup interface identifier */
+		pal_id,
+		start[2],       /* start position to write for each dimension */			
+		edges[2],       /* number of elements to be written along each dimension */
+		dim_sizes[2],   /* dimension sizes of the image array */
+		interlace_mode, /* interlace mode of the image */
+		data_type,      /* data type of the image data */
+		ImageCount,
+		CommentCount,
+		ApplicationCount,
+		PlainTextCount,
+		i;
+
+
+	/* compression structs */
+	uint32 comp_type;	/* compression type */
+	comp_info c_info;	/* the compression information for setcompress */
+
+	char ImageName[256];	/* Image name for the GR Image */
+	char CommentName[256];
+	char ApplicationName[256];
+	char PlainTextName[256];
+	
+	/* reference variables */
+	uint32 gr_ref;		/* GR reference for the VGroup */
+
+	/* Setting compression to gzip. If you want to change compression
+	** type or params change it here
+	*/
+	c_info.deflate.level = 6;
+	comp_type = COMP_CODE_NONE;
+	data_type = DFNT_UINT8;
+	interlace_mode = MFGR_INTERLACE_PIXEL;
+
+	/* Get the stuff from the GIFMem data struct */
+	gifHead = *(GifMemoryStruct.GifHeader);
+
+	ImageCount = (int32)gifHead.ImageCount;
+	CommentCount = (int32)gifHead.CommentCount;
+	ApplicationCount = (int32)gifHead.ApplicationCount;
+	PlainTextCount = (int32)gifHead.PlainTextCount;
+
+	/*Start HDF file*/
+	file_id = Hopen(HDFName, DFACC_CREATE, 0);
+	if(file_id == -1) {
+		printf("Unable to create HDF file");
+		status = HEvalue(1);
+		printf(HEstring(status));
+		exit(0);
+	}
+
+	if ((status = Vstart(file_id)) == -1) {
+		printf("Could not start VGroup interface\n");
+		printf(HEstring(HEvalue(1)));
+		exit(-1);
+	}
+
+	vgroup_id = Vattach(file_id , -1 , "w");
+	
+	status = Vsetname(vgroup_id , GIFFileName);
+	
+	status = Vsetclass(vgroup_id , "GIF");
+	
+	
+	/* Put the global palette in as an attribute to the vgroup */
+	if (gifHead.PackedField & 0x80) {
+		status = Vsetattr (vgroup_id, "Global Palette" , DFNT_UINT8, 3 * gifHead.TableSize , (VOIDP)gifHead.HDFPalette);
+		if (status) {
+			printf("Could not add global palette.\n");
+			printf(HEstring(HEvalue(1)));
+		}
+	}
+	for (i = 0 ; i < CommentCount ; i++) {
+		sprintf(CommentName , "Comment Extension Data %d" , (int)i);
+		status = Vsetattr (vgroup_id , CommentName , DFNT_CHAR8 , (int32)(GifMemoryStruct.GifCommentExtension[i])->DataSize , (VOIDP)(GifMemoryStruct.GifCommentExtension[i])->CommentData);
+		free(GifMemoryStruct.GifCommentExtension[i]);
+	}
+	free(GifMemoryStruct.GifCommentExtension);
+	
+	for (i = 0 ; i < ApplicationCount ; i++) {
+		sprintf(ApplicationName , "Application Extension Data %d", (int)i);
+		status = Vsetattr (vgroup_id , ApplicationName , DFNT_CHAR8 , (int32)(GifMemoryStruct.GifApplicationExtension[i])->DataSize , (VOIDP)(GifMemoryStruct.GifApplicationExtension[i])->ApplicationData);
+		sprintf(ApplicationName , "Application Extension Dump %d", (int)i);
+		status = Vsetattr (vgroup_id , ApplicationName , DFNT_CHAR8 , (int32)11, (VOIDP)(GifMemoryStruct.GifApplicationExtension[i])->AEDump);
+	}
+
+	for (i = 0 ; i < PlainTextCount ; i++) {
+		sprintf(PlainTextName , "PlainText Extension Data %d", (int)i);
+		status = Vsetattr (vgroup_id , PlainTextName , DFNT_CHAR8 , (int32)(GifMemoryStruct.GifPlainTextExtension[i])->DataSize , (VOIDP)(GifMemoryStruct.GifPlainTextExtension[i])->PlainTextData);
+		sprintf(PlainTextName , "PlainText Extension Dump %d", (int)i);
+		status = Vsetattr (vgroup_id , PlainTextName , DFNT_CHAR8 , (int32)15, (VOIDP)(GifMemoryStruct.GifPlainTextExtension[i])->PTEDump);
+	}
+
+	gr_id = GRstart(file_id);
+	/* Add GR images into VGroup */
+	for(i = 0 ; i < ImageCount ; i++)
+	{
+		
+		gifImageDesc = *(GifMemoryStruct.GifImageDesc[i]);
+		
+		dim_sizes[0] = gifImageDesc.ImageWidth;
+		dim_sizes[1] = gifImageDesc.ImageHeight;
+		
+		start[0] = start[1] = 0;
+		edges[0] = gifImageDesc.ImageWidth;
+		edges[1] = gifImageDesc.ImageHeight;
+		
+		/* Create GR Image */
+		sprintf(ImageName,"Image%d",(int)i);
+		ri_id = GRcreate (gr_id, ImageName, 1, data_type, interlace_mode, dim_sizes);
+
+		/* GRSetCompress */
+		if ((status = GRsetcompress(ri_id, comp_type, &c_info)) == -1) {
+			printf("Error occured while setting compression\n");
+			printf(HEstring(HEvalue(1)));
+			exit(-1);
+		}
+
+		/* Write the GR Image */
+		if ((status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)gifImageDesc.Image)) == -1) {
+			printf("Error occured while trying to write GR image\n");
+			printf(HEstring(HEvalue(1)));
+			exit(-1);
+		}
+
+		/* Create palette */
+		pal_id = GRgetlutid (ri_id , 0);
+
+		if ((status = GRwritelut (pal_id , 3, DFNT_UINT8, interlace_mode, 256, (VOIDP)gifImageDesc.HDFPalette)) == -1) {
+			printf("Could not write palette\n");
+			printf(HEstring(HEvalue(1)));
+			exit(-1);
+		}
+		
+		/* Put both image and palette in VGroup */
+		gr_ref = GRidtoref(ri_id);
+		
+		if ((status = GRendaccess(ri_id)) == -1) {
+			printf("Could not terminate GR access\n");
+			printf(HEstring(HEvalue(1)));
+			exit(-1);
+		}
+
+		
+		
+		/* Adding GR to vgroup */
+		if((status = Vaddtagref(vgroup_id,(int32)1965,gr_ref))==-1) {
+			printf("Could not add tag to Vgroup");
+			printf(HEstring(HEvalue(1)));
+		}
+
+		
+	}
+
+	/* Terminate GR access */
+	if ((status = GRend (gr_id))==-1) {
+		printf("Could not end GR access\n");
+		printf(HEstring(HEvalue(1)));
+		printf("Trying to continue (file may be corrupt)...\n");
+	}
+	
+	/* Terminate access to the VGroup */
+	if ((status = Vdetach(vgroup_id))==-1) {
+		printf("Could not detach Vgroup\n");
+		printf(HEstring(HEvalue(1)));
+		printf("Trying to continure (file may be corrupt)...\n");
+	}
+
+	/* Terminate access to the V interface */
+	if ((status = Vend(file_id))==-1) {
+		printf("Could not end VGroup access\n");
+		printf(HEstring(HEvalue(1)));
+		printf("Trying to continure (file may be corrupt)... \n");
+	}
+
+	/* Close the HDF file */
+	if ((status = Hclose (file_id))==-1) {
+		printf("Could not close HDF file. Fatal Error");
+		printf(HEstring(HEvalue(1)));
+		return(-1);
+	}
+	return(0);
+}
diff --git a/libhdf4.settings.in b/libhdf4.settings.in
new file mode 100644
index 0000000..1d9bbb9
--- /dev/null
+++ b/libhdf4.settings.in
@@ -0,0 +1,38 @@
+	    SUMMARY OF THE HDF4 CONFIGURATION
+	    =================================
+
+General Information:
+-------------------
+		   HDF4 Version: @H4_VERSION@
+		  Configured on: @CONFIG_DATE@
+		  Configured by: @CONFIG_USER@
+		 Configure mode: @CONFIG_MODE@
+		    Host system: @host_cpu at -@host_vendor at -@host_os@
+              Uname information: @UNAME_INFO@
+		      Libraries: @STATIC_SHARED@
+	     Installation point: @prefix@
+
+Compiling Options:
+------------------
+               Compilation Mode: @CONFIG_MODE@
+                     C compiler: @CC_VERSION@
+                         CFLAGS: @CFLAGS@
+                       CPPFLAGS: @CPPFLAGS@
+               Shared Libraries: @enable_shared@
+               Static Libraries: @enable_static@
+  Statically Linked Executables: @STATIC_EXEC@
+                        LDFLAGS: @LDFLAGS@
+ 	 	Extra libraries: @LIBS@
+ 		       Archiver: @AR@
+ 		 	 Ranlib: @RANLIB@
+
+Languages:
+----------
+                        Fortran: @BUILD_FORTRAN@
+ at HDF_BUILD_FORTRAN_TRUE@               Fortran Compiler: @F77_VERSION@
+ at HDF_BUILD_FORTRAN_TRUE@                         FFLAGS: @FFLAGS@
+
+Features:
+---------
+               SZIP compression: @SZIP_INFO@
+   Support for netCDF API 2.3.2: @BUILD_NETCDF@
diff --git a/m4/libtool.m4 b/m4/libtool.m4
new file mode 100644
index 0000000..44e0ecf
--- /dev/null
+++ b/m4/libtool.m4
@@ -0,0 +1,7982 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool at gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Go],			[_LT_LANG(GO)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[23]].*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2.*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+haiku*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux # correct to gnu/linux during the next big refactor
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux # correct to gnu/linux during the next big refactor
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux # correct to gnu/linux during the next big refactor
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux # correct to gnu/linux during the next big refactor
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t at _DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd*)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+        *Intel*\ [[CF]]*Compiler*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
+	*Portland\ Group*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    esac
+    ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2.*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd2.*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
new file mode 100644
index 0000000..5d9acd8
--- /dev/null
+++ b/m4/ltoptions.m4
@@ -0,0 +1,384 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/m4/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
new file mode 100644
index 0000000..07a8602
--- /dev/null
+++ b/m4/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
new file mode 100644
index 0000000..c573da9
--- /dev/null
+++ b/m4/lt~obsolete.m4
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..a2c642f
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,3 @@
+include $(top_srcdir)/config/commence.am
+
+man1_MANS = hdf.1 
diff --git a/man/Makefile.in b/man/Makefile.in
new file mode 100644
index 0000000..4e89bc5
--- /dev/null
+++ b/man/Makefile.in
@@ -0,0 +1,525 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am
+subdir = man
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)"
+NROFF = nroff
+MANS = $(man1_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+man1_MANS = hdf.1 
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-man1: $(man1_MANS)
+	@$(NORMAL_INSTALL)
+	@list1='$(man1_MANS)'; \
+	list2=''; \
+	test -n "$(man1dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.1[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@list='$(MANS)'; if test -n "$$list"; then \
+	  list=`for p in $$list; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+	  if test -n "$$list" && \
+	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+	    echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
+	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+	    echo "       typically 'make maintainer-clean' will remove them" >&2; \
+	    exit 1; \
+	  else :; fi; \
+	else :; fi
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+installdirs:
+	for dir in "$(DESTDIR)$(man1dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-man1 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	uninstall uninstall-am uninstall-man uninstall-man1
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/man/gr_chunk.3 b/man/gr_chunk.3
new file mode 100644
index 0000000..77ae132
--- /dev/null
+++ b/man/gr_chunk.3
@@ -0,0 +1,244 @@
+.\" WARNING! THIS FILE WAS GENERATED AUTOMATICALLY BY c2man!
+.\" DO NOT EDIT! CHANGES MADE TO THIS FILE WILL BE LOST!
+.TH "mfhdf" 3 "16 October 1997" "c2man hproto.h"
+.SH "NAME"
+GRsetchunk,
+GRgetchunkinfo,
+GRetchunkcache \- GR Chunking Routines
+.SH "SYNOPSIS"
+.ft B
+#include <hdf.h>
+.sp
+extern intn GRsetchunk
+.br
+(
+.br
+	int32 riid,
+.br
+	HDF_CHUNK_DEF chunk_def,
+.br
+	int32 flags
+.br
+);
+.sp
+extern intn GRgetchunkinfo
+.br
+(
+.br
+	int32 riid,
+.br
+	HDF_CHUNK_DEF *chunk_def,
+.br
+	int32 *flags
+.br
+);
+.sp
+extern intn GRsetchunkcache
+.br
+(
+.br
+	int32 riid,
+.br
+	int32 maxcache,
+.br
+	int32 flags
+.br
+);
+.ft R
+.SH "PARAMETERS"
+.TP
+.B "int32 riid"
+IN: raseter access id.
+.TP
+.B "HDF_CHUNK_DEF chunk_def"
+IN: chunk definition.
+.TP
+.BR "int32 flags" "	(GRsetchunk)"
+IN: flags.
+.TP
+.B "HDF_CHUNK_DEF *chunk_def"
+IN/OUT: chunk definition.
+.TP
+.B "int32 *flags"
+IN/OUT: flags.
+.TP
+.B "int32 maxcache"
+IN: max number of chunks to cache.
+.TP
+.BR "int32 flags" "	(GRsetchunkcache)"
+IN: flags = 0, HDF_CACHEALL.
+.SH "DESCRIPTION"
+.SS "GRsetchunk"
+This routine makes the GR a chunked GR according to the chunk
+definition passed in.
+
+The dataset currently cannot be special already i.e. NBIT,
+COMPRESSED, or EXTERNAL. This is an Error.
+
+The defintion of the "HDF_CHUNK_DEF" union with relvant fields is:
+.nf
+
+typedef union hdf_chunk_def_u
+{
+int32  chunk_lengths[2];  Chunk lengths along each dimension.
+       {
+         int32     chunk_lengths[2]; Chunk lengths along each dimension.
+         int32     comp_type;        Compression type
+         comp_info cinfo;            Compression info struct
+       }comp;
+} HDF_CHUNK_DEF
+.fi
+
+The variable agruement 'flags' is a bit-or'd value which can currently be 'HDF_CHUNK' or 'HDF_CHUNK | HDF_COMP'.
+
+The simplist is the 'chunk_lengths' array specifiying chunk 
+lengths for each dimension where the 'flags' argument set to 
+'HDF_CHUNK';
+
+COMPRESSION is set by using the 'HDF_CHUNK_DEF' union to set the
+appropriate compression information along with the required chunk lengths
+for each dimension. The compression information is the same as 
+that set in 'GRsetcompress()'. The bit-or'd 'flags' argument' is set to 
+'HDF_CHUNK | HDF_COMP'.
+
+See the example in pseudo-C below for further usage.
+
+The maximum number of Chunks in an HDF file is 65,535.
+
+The performance of the GRxxx interface with chunking is greatly
+affected by the users access pattern over the image and by
+the maximum number of chunks set in the chunk cache. The cache contains 
+the Least Recently Used(LRU cache replacment policy) chunks. See the
+routine GRsetchunkcache() for further info on the chunk cache and how 
+to set the maximum number of chunks in the chunk cache. A default chunk 
+cache is always created.
+
+The following example shows the organization of chunks for a 2D array.
+
+e.g. 4x4 array with 2x2 chunks. The array shows the layout of
+chunks in the chunk array.
+
+.nf
+
+    4 ---------------------
+      |         |         |
+Y     |  (0,1)  |  (1,1)  |
+^     |         |         |
+|   2 ---------------------
+|     |         |         |
+|     |  (0,0)  |  (1,0)  |
+|     |         |         |
+|     ---------------------
+|     0         2         4
+---------------> X
+
+ --Without compression--:
+{
+ HDF_CHUNK_DEF chunk_def;
+ .......
+ -- Set chunk lengths --
+ chunk_def.chunk_lengths[0]= 2;
+ chunk_def.chunk_lengths[1]= 2;
+
+ -- Set Chunking --
+ GRsetchunk(riid, chunk_def, HDF_CHUNK);
+ ......
+}
+
+ --With compression--:
+{
+ HDF_CHUNK_DEF chunk_def;
+ .......
+ -- Set chunk lengths first --
+ chunk_def.chunk_lengths[0]= 2;
+ chunk_def.chunk_lengths[1]= 2;
+
+ -- Set compression --
+ chunk_def.comp.cinfo.deflate.level = 9;
+ chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+ -- Set Chunking with Compression --
+ GRsetchunk(riid, chunk_def, HDF_CHUNK | HDF_COMP);
+ ......
+}.
+.fi
+
+.SS "GRgetchunkinfo"
+This routine gets any special information on the GR. If its chunked,
+chunked and compressed or just a regular GR. Currently it will only
+fill the array of chunk lengths for each dimension as specified in
+the "HDF_CHUNK_DEF" union. It does not tell you the type of compression
+or the compression parameters used. You can pass in a NULL for "chunk_def"
+if don't want the chunk lengths for each dimension.
+Additionaly if successfull it will return a bit-or'd value in "flags"
+indicating if the GR is:
+.nf
+
+       Chunked                  -> flags = HDF_CHUNK
+       Chunked and compressed   -> flags = HDF_CHUNK | HDF_COMP
+       Non-chunked              -> flags = HDF_NONE
+
+e.g. 4x4 array - Pseudo-C
+{
+ int32   rcdims[3];
+ HDF_CHUNK_DEF rchunk_def;
+ int32   cflags;
+ ...
+ rchunk_def.chunk_lengths = rcdims;
+ GRgetchunkinfo(sdsid, &rchunk_def, &cflags);
+ ...
+}.
+.fi
+
+.SS "GRsetchunkcache"
+Set the maximum number of chunks to cache.
+
+The cache contains the Least Recently Used(LRU cache replacment policy)
+chunks. This routine allows the setting of maximum number of chunks that
+can be cached, "maxcache".
+
+The performance of the GRxxx interface with chunking is greatly
+affected by the users access pattern over the dataset and by
+the maximum number of chunks set in the chunk cache. The number chunks
+that can be set in the cache is process memory limited. It is a good
+idea to always set the maximum number of chunks in the cache as the
+default heuristic does not take into account the memory available for
+the application.
+
+By default when the GR is created as a chunked element the
+maximum number of chunks in the cache "maxcache" is set to the number of
+chunks along the last dimension.
+
+The values set here affects the current object's caching behaviour.
+
+If the chunk cache is full and "maxcache" is greater then the
+current "maxcache" value, then the chunk cache is reset to the 
+new "maxcache" value, else the chunk cache remains at the 
+current "maxcache" value.
+
+If the chunk cache is not full, then the chunk cache is set to the
+new "maxcache" value only if the new "maxcache" value is greater than the
+current number of chunks in the cache.
+
+Use flags argument of "HDF_CACHEALL" if the whole object is to be cached
+in memory, otherwise pass in zero(0). Currently you can only
+pass in zero.
+
+See GRsetchunk() for a description of the organization of chunks in a GR .
+
+.SH "RETURNS"
+.SS "GRsetchunk"
+SUCCEED/FAIL.
+.SS "GRgetchunkinfo"
+SUCCEED/FAIL.
+.SS "GRsetchunkcache"
+Returns the 'maxcache' value for the chunk cache if successful
+and FAIL otherwise.
+.SH "NAME"
+.SS "GRsetchunk"
+GRsetchunk   -- make GR a chunked GR.
+.SS "GRgetchunkinfo"
+GRgetchunkinfo -- get Info on GR.
+.SS "GRsetchunkcache"
+GRsetchunkcache -- maximum number of chunks to cache.
+
+
diff --git a/man/hdf.1 b/man/hdf.1
new file mode 100644
index 0000000..c4fd3bd
--- /dev/null
+++ b/man/hdf.1
@@ -0,0 +1,173 @@
+.\" $Id: hdf.1 6079 2014-02-08 00:29:03Z bmribler $
+.TH HDF 1 "February 2014" "THG HDF 4.2.10"
+.SH NAME
+hdf \- Hierarchical Data Format library
+.SH SYNOPSIS
+.ft B
+-lmfhdf -ldf -ljpeg -lz [ -lsz ]
+.sp 0
+{HDFLIBDIR}/libmfhdf.a {HDFLIBDIR}/libdf.a {JPEGLIBDIR}/libjpeg.a 
+.sp 0
+{GZIPLIBDIR}/libz.a [{SZIPLIBDIR}/libsz.a]
+
+.SH DESCRIPTION
+HDF is a multi-object file format that facilitates the transfer of various 
+types of scientific data between machines and operating systems.  See
+http://www.hdfgroup.org/release4/platforms.html for a list of platforms
+currently supported.
+
+HDF allows self-definitions of data content and easy extensibility for
+future enhancements or compatibility with other standard formats. HDF
+includes Fortran and C calling interfaces, and utilities for manipulating,
+viewing, and analyzing data in HDF files. The HDF library contains
+interfaces for storing and retrieving compressed or uncompressed 8-bit
+and 24-bit raster images with palettes, n-Dimensional scientific datasets
+and binary tables. An interface is also included that allows arbitrary
+grouping of other HDF objects.
+
+.SS "HDF Raster Images"
+HDF supports the storing of both 8-bit and 24-bit raster images.  Beside
+storing information about the dimensions and palette of a raster image, HDF
+supports raster image compression.  In previous versions of HDF
+(DF interfaces,) Run-length encoding and Imcomp compression were both
+supported.  The currently supported compression methods include simple
+RLE, N-bit, Skipping huffman, Gzip, Szip, and JPEG.  Although no longer
+support Imcomp compression, the library can read images with Imcomp compression.
+
+.SS "HDF Scientific Data Sets"
+Scientific Data Sets (SDSs) are useful for storing n-Dimensional gridded data.
+The actual data in the dataset can be of any of the "standard" number types: 
+8, 16 and 32bit signed and unsigned integers and 32 and 64bit floating point 
+values.  In addition, a certain amount of meta-data can be stored with an 
+SDS including: 
+.nf 
+
+  o The coordinate system to use when interpreting or displaying the data.
+  o Scales to be used for each dimension.
+  o Labels for each dimension and the dataset as a whole.
+  o Units for each dimension and the data.
+  o The valid max and min values for the data. 
+  o Calibration information for the data.
+  o Fill or missing value information. 
+  o Ability of having more than one file open at a time.
+  o A more general framework for meta-data within the SDS data-model
+    (allowing 'name = value' style meta-data.)
+  o Support for an "unlimited dimension" in the SDS data-model, making
+    it possible to append planes to an array along one dimension.
+.fi
+.SS "HDF Annotations"
+Any object in an HDF file can have annotations associated with it.  There are a
+number of types of annotations: 
+.nf
+
+  o Labels are assumed to be short strings giving the "name" of a 
+    data object. 
+  o Descriptions are longer text segments that are useful for giving 
+    more indepth information about a data object 
+  o File annotations are assumed to apply to all of the objects in a 
+    single file.
+.fi
+.SS "HDF Vset Interfaces"
+The Vset module provides
+interfaces to two basic HDF building blocks.  Vgroups are generic grouping
+elements allowing a user to associate related objects within an HDF file.  As
+Vgroups can contain other Vgroups, it is possible to build a hierarchical file.
+Vdatas are data structures made up of fields and records.  Data is organized into "fields" within each 
+Vdata.  Each field is identified by a unique "fieldname".  The type of each 
+field may be any of the basic number types that HDF supports.  Fields of 
+different types may exist within the same Vdata.  
+
+By combining Vdatas in Vgroups it is possible to represent higher level data
+constructs: mesh data, multi-variate datasets, sparse matrices, finite-element
+data, spreadsheets, splines, non-Cartesian coordinate data, etc.
+
+.SS "HDF and netCDF"
+Starting with HDF version 3.3, netCDF v.2.3.2 of Unidata is supported with the
+SD multifile interface. SD and netCDF interfaces can read both netCDF files
+and multi-dimensional arrays (SDS) stored in the HDF4 files transparently.
+For more information, see Chapter 3, "Scientific Data Sets", of the HDF
+User's Guide.
+
+To disable netCDF interfaces in the HDF library, configure the library using
+--disable-netcdf flag and rebuild it.
+
+.SS "EXAMPLES"
+All HDF routines require the header "hdf.h" to be included in the C
+source file, unless if the SD routines are used, then the header "mfhdf.h"
+should be included instead.
+
+Fortran programs should use "dffunc.inc" for all interfaces, "mffunc.inc"
+for the SD interfaces, and "hdf.inc" for non-SD interfaces.
+
+To compile a program that makes HDF calls on most Unix platforms.
+
+   (FORTRAN):
+.na 
+   {HDFLIBDIR}/bin/h4fc myprog.f 
+
+   (C):
+.na 
+   {HDFLIBDIR}/bin/h4cc myprog.c 
+
+.fi
+
+.SH DOCUMENTATION
+
+The HDF web site is located at http://www.hdfgroup.org/.
+
+For the vast majority of users, the "HDF User's Guide" and 
+"HDF Reference Manual" should be sufficient. 
+
+These documents can be viewed or downloaded at
+.sp 0
+http://www.hdfgroup.org/products/hdf4/.
+
+
+.SH VENDOR
+The HDF Group
+.sp 0
+1800 South Oak Street, Suite 203
+.sp 0
+Champaign, IL 61820
+.sp 0
+USA 
+.sp 0
+www.hdfgroup.org
+
+.SH VERSION
+4.2.10 
+.SH LICENSE & SOURCE AVAILABILITY
+Copyright by The HDF Group.
+.sp 0
+Copyright by the Board of Trustees of the University of Illinois.
+
+All rights reserved.
+
+This file is part of HDF.  The full HDF 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
+.sp 0
+http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have
+access to either file, you may request a copy from 
+.sp 0
+help at hdfgroup.org.
+
+.SH CONTACT & HELP
+The HDF Group
+.sp 0
+Email: help at hdfgroup.org
+
+.SH FILES
+.PD 0
+.TP 30
+.B /usr/local/lib/hdf/{libmfhdf.a,libdf.a,libjpeg.a,libz.a [,libsz.a]}
+hdf libraries
+.TP 30
+.B /usr/local/bin
+Location of most hdf utilities
+.TP 30
+.B /usr/local/include/hdf
+Location of include file hdf.h, mfhdf.h, and others
+.PD
+
diff --git a/man/hdfunpac.1 b/man/hdfunpac.1
new file mode 100644
index 0000000..81b1012
--- /dev/null
+++ b/man/hdfunpac.1
@@ -0,0 +1,27 @@
+.\" $Id: hdfunpac.1 1802 1995-07-25 01:53:23Z sxu $
+.TH HDFUNPAC 1 "July 1995" "NCSA HDF 4.0"
+.SH NAME
+hdfunpac \- Unpack an HDF file
+.SH SYNOPSIS
+.B hdfunpac
+[
+.B \-d
+.I datafile
+]
+.I hdffile
+.SH DESCRIPTION
+.B hdfunpac
+unpacks an HDF file by exporting the scientific data elements (DFTAG_SD)
+to external object elements.
+The external file is
+.B DataFile
+by default.
+.SH OPTIONS
+.TP
+.BI \-d " datafile"
+Use
+.I datafile
+as the external file name.  Default is
+.B DataFile.
+.SH SEE ALSO
+.BR hdf (1)
diff --git a/mfhdf/CMakeLists.txt b/mfhdf/CMakeLists.txt
new file mode 100644
index 0000000..111e126
--- /dev/null
+++ b/mfhdf/CMakeLists.txt
@@ -0,0 +1,21 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF)
+
+#-----------------------------------------------------------------------------
+# Option to build HDF4 Tools
+#-----------------------------------------------------------------------------
+IF (EXISTS "${HDF4_MFHDF_SOURCE_DIR}/dumper" AND IS_DIRECTORY "${HDF4_MFHDF_SOURCE_DIR}/dumper")
+  OPTION (HDF4_BUILD_TOOLS  "Build HDF4 Tools" OFF)
+  IF (HDF4_BUILD_TOOLS)
+    SET (NCGEN_UTILITY 0)
+    ADD_SUBDIRECTORY (${HDF4_MFHDF_SOURCE_DIR}/dumper      ${HDF4_MFHDF_BINARY_DIR}/dumper)
+    ADD_SUBDIRECTORY (${HDF4_MFHDF_SOURCE_DIR}/hdfimport   ${HDF4_MFHDF_BINARY_DIR}/hdfimport)
+    ADD_SUBDIRECTORY (${HDF4_MFHDF_SOURCE_DIR}/hdiff       ${HDF4_MFHDF_BINARY_DIR}/hdiff)
+    ADD_SUBDIRECTORY (${HDF4_MFHDF_SOURCE_DIR}/hrepack     ${HDF4_MFHDF_BINARY_DIR}/hrepack)
+    ADD_SUBDIRECTORY (${HDF4_MFHDF_SOURCE_DIR}/ncgen       ${HDF4_MFHDF_BINARY_DIR}/ncgen)
+    ADD_SUBDIRECTORY (${HDF4_MFHDF_SOURCE_DIR}/ncdump      ${HDF4_MFHDF_BINARY_DIR}/ncdump)
+    IF (BUILD_TESTING)
+      ADD_SUBDIRECTORY (${HDF4_MFHDF_SOURCE_DIR}/nctest    ${HDF4_MFHDF_BINARY_DIR}/nctest)
+    ENDIF (BUILD_TESTING )
+  ENDIF (HDF4_BUILD_TOOLS)
+ENDIF (EXISTS "${HDF4_MFHDF_SOURCE_DIR}/dumper" AND IS_DIRECTORY "${HDF4_MFHDF_SOURCE_DIR}/dumper")
diff --git a/mfhdf/COPYRIGHT b/mfhdf/COPYRIGHT
new file mode 100644
index 0000000..bbc25a7
--- /dev/null
+++ b/mfhdf/COPYRIGHT
@@ -0,0 +1,31 @@
+Copyright 1993 University Corporation for Atmospheric Research/Unidata
+
+Portions of this software were developed by the Unidata Program at the 
+University Corporation for Atmospheric Research.
+
+Access and use of this software shall impose the following obligations
+and understandings on the user. The user is granted the right, without
+any fee or cost, to use, copy, modify, alter, enhance and distribute
+this software, and any derivative works thereof, and its supporting
+documentation for any purpose whatsoever, provided that this entire
+notice appears in all copies of the software, derivative works and
+supporting documentation.  Further, UCAR requests that the user credit
+UCAR/Unidata in any publications that result from the use of this
+software or in any product that includes this software, although this
+is not an obligation. The names UCAR and/or Unidata, however, may not 
+be used in any advertising or publicity to endorse or promote any 
+products or commercial entity unless specific written permission is 
+obtained from UCAR/Unidata. The user also understands that 
+UCAR/Unidata is not obligated to provide the user with any support, 
+consulting, training or assistance of any kind with regard to the use, 
+operation and performance of this software nor to provide the user 
+with any updates, revisions, new versions or "bug fixes."
+
+THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
+INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/mfhdf/FAQ b/mfhdf/FAQ
new file mode 100644
index 0000000..f15d696
--- /dev/null
+++ b/mfhdf/FAQ
@@ -0,0 +1,581 @@
+From: General Support <support at unidata.ucar.edu>                 
+Subject: netCDF FAQ
+
+
+                 Frequently Asked Questions About netCDF
+
+This article contains answers to some of the most frequently asked netCDF
+questions on the netcdfgroup mailing list and in the email sent to
+support at unidata.ucar.edu.  The list is archived in pub/netcdf/FAQ on
+unidata.ucar.edu, and is currently maintained by Russ Rew
+(russ at unidata.ucar.edu).
+
+List of Questions:
+
+    1:  What Is netCDF?
+    2:  How do I get the netCDF software package?
+    3:  What does netCDF run on?
+    4:  When will the next version be available?  What changes are included?
+    5:  What is the connection between netCDF and CDF?
+    6:  What is the connection between netCDF and HDF?
+    7:  Is netCDF available for the Apple Macintosh?
+    8:  What are some references to netCDF?
+    9:  What are the files in pub/netcdf/ on unidata.ucar.edu?
+    10: Why do I get XDR error messages when trying to write data?
+    11: What is the best way to represent [some particular data] using netCDF?
+    12: Are there plans to add facilities for data compression to netCDF?
+    13: What utilities are available for netCDF?
+    14: What is the status of implementing additional netCDF operators?
+    15: Is there a mailing list for netCDF discussions and questions?
+    16: How do I make a bug report?
+    17: Is there any WAIS or gopher access to netCDF information?
+    18: How widely is netCDF used?
+
+1:  What Is netCDF?
+
+A:  NetCDF (network Common Data Form) is an interface for scientific data
+    access and a freely-distributed software library that provides an
+    implementation of the interface.  It was developed by Glenn Davis, Russ
+    Rew, and Steve Emmerson at the Unidata Program Center in Boulder,
+    Colorado.  The netCDF library also defines a machine-independent format
+    for representing scientific data.  Together, the interface, library, and
+    format support the creation, access, and sharing of scientific data.
+
+    netCDF data is:
+
+    - Self-Describing.  A netCDF file includes information about the data it
+      contains.
+
+    - Network-transparent.  A netCDF file is represented in a form that can
+      be accessed by computers with different ways of storing integers,
+      characters, and floating-point numbers.
+
+    - Direct-access.  A small subset of a large dataset may be accessed
+      efficiently, without first reading through all the preceding data.
+
+    - Appendable.  Data can be appended to a netCDF dataset along one
+      dimension without copying the dataset or redefining its structure.
+      The structure of a netCDF dataset can be changed, though this
+      sometimes causes the dataset to be copied.
+
+    - Sharable.  One writer and multiple readers may simultaneously access
+      the same netCDF file.
+
+2:  How do I get the netCDF software package?
+
+A:  Via anonymous FTP from
+
+	host:	unidata.ucar.edu [128.117.140.3]
+	file:	pub/netcdf/netcdf.tar.Z
+
+    Make sure the file is transmitted in BINARY mode.  This is version 2.3.2,
+    last updated in June 1993.
+
+3:  What does netCDF run on?
+
+A:  Version 2.3.2 of netCDF has been tested on the following platforms:
+
+	CRAY Y-MP	  UNICOS 6.1.6
+	DEC Alpha	  OSF/1 1.2
+	DEC VAX		  VMS 5.5-2
+	DEC VAX		  Ultrix 4.3
+	DECstation 3000	  Ultrix 4.3
+	HP-9000/7xx	  HPUX 9.0
+	IBM PS/2	  MSDOS 5.0
+	IBM PS/2	  OS/2 1.2
+	IBM RS-6000	  AIX 3.2
+	NeXT		  NeXTOS 3.0
+	SGI Iris	  IRIX 4.0.5F
+	SPARCstation	  Solaris 2.1
+	SPARCstation	  SunOS 4.1.3
+
+    The experience of outside developers indicates that netCDF is relatively
+    easy to port to any system that has a C compiler and an XDR library
+    (eXternal Data Representation, used for NFS and usually supplied by
+    vendors).
+
+4:  What has changed since the netCDF 2.2 release in December 1991?
+
+A:  NetCDF 2.3, made available in April 1993, contains bug fixes, portability
+    enhancements, performance enhancements, and a few new capabilities.
+
+    Some new optimizations for the library result in significant speedups
+    for accessing cross-sections involving non-contiguous data.
+
+    New capabilities include some additional interfaces that provide a more
+    general form of hyperslab access.  This supports sub-sampling along
+    specified dimensions and a mapping between the points of the hyperslab
+    and the memory locations of the corresponding values.  In a generalized
+    hyperslab, an index mapping vector is used to define the mapping between
+    points in the generalized hyperslab and the memory locations of the
+    corresponding values, so data values that are written or read need no
+    longer be contiguous in memory.
+
+    There are also some new interfaces that can be used to write, read, and
+    inquire about records, where a record may contain multiple variables of
+    different types and shapes.  Where before you had to access a record's
+    worth of data using multiple calls, now you will be able to use a single
+    call.
+
+    The ncdump utility supports several new command-line options including
+    the ability to specify for which variables data values will be output,
+    to provide brief annotations in the form of CDL comments to identify
+    data values for large multidimensional variables, or to provide full
+    annotations in the form of trailing CDL comments for every data value.
+
+    The current release also includes a prototype implementation of a C++
+    interface for the netCDF data access library.  It provides all the
+    functionality of the previous C interface, improves type safety by
+    eliminating use of void* pointers, and is somewhat simpler to use than
+    the C interface.  With the C++ interface, no IDs are needed for netCDF
+    components, there is no need to specify types when creating attributes,
+    and less indirection is required for dealing with dimensions.  However,
+    since this is a prototype interface and implementation, it may be
+    changed before a supported version is released.
+
+5:  What is the connection between netCDF and CDF?
+
+A:  CDF was developed at the NASA Space Science Data Center at Goddard, and
+    is freely available.  It was originally a VMS FORTRAN interface for
+    scientific data access.  Unidata reimplemented the library from scratch
+    to use XDR for a machine-independent representation, designed the CDL
+    text representation for netCDF data, wrote a User's Guide and made other
+    additions including aggregate data access, single-file implementation,
+    named dimensions, and variable-specific attributes.
+
+    NetCDF and CDF have evolved independently.  CDF now supports many of the
+    same features as netCDF (aggregate data access, XDR representation,
+    single-file representation, variable-specific attributes), but some
+    differences remain (netCDF doesn't support native-mode representation,
+    CDF doesn't support named dimensions).  There is no compatibility
+    between data in CDF and netCDF form, and as yet no translation software
+    exists to convert data in one form to data in the other form.
+
+6:  What is the connection between netCDF and HDF?
+
+A:  The National Center for Supercomputing Applications (NCSA) developed the
+    HDF software and makes it freely available.  HDF is an extensible data
+    format for self-describing files that was developed independently of
+    netCDF.  Applications and utilities based on HDF are available that
+    support raster-image manipulation and display and browsing through
+    multidimensional scientific data. The HDF software includes a package of
+    routines for accessing each HDF data type, as well as a lower-level
+    interface for building packages to support new types.  HDF supports both
+    C and Fortran interfaces, and it has been successfully ported to a wide
+    variety of machine architectures and operating systems.  HDF emphasizes
+    a single common format for data, on which many interfaces can be built.
+
+    NCSA has implemented software that provides a netCDF interface to HDF.
+    With this software, it is possible to use the netCDF calling interface
+    to place data into an HDF file.  The netCDF calling interface has not
+    changed and netCDF files stored in XDR format are readable, so existing
+    programs and data will still be usable (although programs will need to
+    be relinked to the new library).  There is currently no support for the
+    mixing of HDF and netCDF structures.  For example, a raster image can
+    exist in the same file as a netCDF object, but you have to use the
+    Raster Image interface to read the image and the netCDF interface to
+    read the netCDF object.  The other HDF interfaces are currently being
+    modified to allow multi-file access, closer integration with the netCDF
+    interface will probably be delayed until the end of that project.
+
+    Eventually, it may be possible to integrate netCDF objects with the
+    rest of the HDF tool suite.  Such an integration will then allow tools
+    written for netCDF and tools written for HDF to both interact
+    intelligently with the new data files.
+   
+7:  Is netCDF available for the Apple Macintosh?
+
+A:  Unidata doesn't test or maintain a version of netCDF for Macintoshes,
+    but see the files in the directory pub/netcdf/mac/ on unidata.ucar.edu
+    for notes and Macintosh MPW makefiles for porting netCDF to an Apple
+    Macintosh. These were contributed by Chuck Denham, U.S. Geological
+    Survey.
+
+8:  What are some references to netCDF?
+
+A:  Hard-copies of some of these are available from the Unidata Program
+    Center, P.O. Box 3000, Boulder, CO 80307-3000:
+
+    Rew, R.  K., G. P.  Davis, and S. Emmerson, NetCDF User's Guide, An
+    Interface for Data Access, Version 2.3, April 1993.  (Available from
+    Unidata or by anonymous FTP from unidata.ucar.edu in the file
+    pub/netcdf/guide.ps.Z)
+
+    Rew, R. K. and G. P. Davis, "NetCDF: An Interface for Scientific Data
+    Access," IEEE Computer Graphics and Applications, Vol. 10, No. 4,
+    pp. 76-82, July 1990.
+
+    Rew, R. K. and G. P. Davis, "The Unidata netCDF: Software for Scientific
+    Data Access," Sixth International Conference on Interactive Information
+    and Processing Systems for Meteorology, Oceanography, and Hydrology,
+    Anaheim, California, American Meteorology Society, February 1990.
+
+    Jenter, H. L. and R. P. Signell, 1992. "NetCDF: A Freely-Available
+    Software-Solution to Data-Access Problems for Numerical Modelers".
+    Proceedings of the American Society of Civil Engineers Conference on
+    Estuarine and Coastal Modeling. Tampa, Florida.  (Also available via
+    anonymous FTP from sparky.er.usgs.gov in the file pub/netcdf.asce.ps)
+
+    Fulker, D. W., "Unidata Strawman for Storing Earth-Referencing Data,"
+    Seventh International Conference on Interactive Information and
+    Processing Systems for Meteorology, Oceanography, and Hydrology, New
+    Orleans, La., American Meteorology Society, January 1991.
+
+    Brown, S. A, M. Folk, G. Goucher, and R. Rew, "Software for Portable
+    Scientific Data Management," Computers in Physics, American Institute of
+    Physics, Vol. 7, No. 3, May/June 1993, pp. 304-308.
+
+9:  What are the files in pub/netcdf/ on unidata.ucar.edu?
+
+A:  File                         Purpose
+
+    README                 general information about netCDF
+
+    FAQ			   this file of frequently asked questions
+
+    utilities.txt          a list of software packages currently available or
+			   under development for manipulating and displaying
+			   netCDF data
+
+    guide.ps.Z             a compressed PostScript file of the NetCDF User's
+			   Guide.  This is included in the netcdf.tar.Z
+			   distribution, so you don't need both.
+
+    ncprogs.ps             a draft PostScript document describing an initial
+			   set of netCDF operator and utility programs under
+			   development
+
+    ncprogs.txt            an ASCII version of ncprogs.ps
+
+    conventions.txt	   a draft document of some proposed netCDF
+			   conventions
+
+    cdl/                   a directory containing some examples of CDL files
+			   (an ASCII representation for netCDF files).
+
+    msdos/		   a directory containing executables and binaries for
+			   netCDF under MSDOS 5.0.  These can also be built
+			   from the sources in netcdf.tar.Z, if you have the
+			   necessary Microsoft compilers.
+
+    mac/		   a directory containing notes and Macintosh MPW
+			   makefiles for porting netCDF to an Apple
+			   Macintosh.  These were contributed by Chuck
+			   Denham, U.S.  Geological Survey.
+
+10: Why do I get XDR error messages when trying to write data?
+
+A:  Probably due to a write error, perhaps because of exceeding disk quotas,
+    a full device, or permission problems.  The netCDF library is usually
+    built on a vendor-supplied XDR library layer.  Sometimes errors occur in
+    the XDR layer rather than the netCDF layer, and in this case the error
+    messages from the XDR layer can be cryptic.  For example, if the user is
+    writing data and exceeds a disk space quota, this might be detected
+    first in the XDR layer.  Although we try to catch and elaborate on
+    errors that occur in the XDR layer, sometimes there is not enough
+    information passed up to calling routines from the XDR layer to make
+    construction of a meaningful error message possible.
+
+11: What is the best way to represent [some particular data] using netCDF?
+
+A:  There are many ways to represent the same information in any
+    general-purpose data model.  Choices left up to the user in the case of
+    netCDF include which information to represent as variables or as
+    variable attributes; what names to choose for variables, dimensions, and
+    attributes; what order to use for the dimensions of multidimensional
+    variables; what variables to include in the same netCDF file; and how to
+    use variable attributes to capture the structure and meaning of data.
+    We provide some guidelines in the NetCDF User's Guide (e.g Section
+    2.3.2, ``Differences between Attributes and Variables''), but we've
+    found that a little experience helps.  Occasionally we have decided it
+    was useful to change the structure of netCDF files after experience with
+    how the data is used.
+
+12: Are there plans to add facilities for data compression to netCDF?
+
+A:  We have no plans to add data compression to netCDF (although we do hope
+    to eventually add a form of transparent data packing on write and
+    unpacking on read whenever the reserved attributes "_Nbits", "_Scale",
+    and "_Offset" are defined).
+
+    Hyperslab access and direct access to individual array values conflict
+    with most simple compression schemes.  With netCDF, the elements of an
+    array variable can be filled in any order or as cross-sections in any
+    direction.  NetCDF permits writing elements in one order and reading
+    them later in different orders.
+
+    Some compression methods require that all the data to be compressed are
+    known before starting the compression.  Techniques like run-length
+    encoding or anything that depends on exploiting similarities in nearby
+    values can't be used if nearby values aren't all known at the time some
+    of the data are to be written.
+
+    An alternative that can be implemented above the netCDF library is to
+    adopt a convention for compressed data that uses a "compression"
+    attribute to encode the method of compression, e.g.
+
+	    x:compression = "rle" ;
+
+    for run-length encoding of the data in a variable x.  Then when you
+    write the data, compress them into a bland array of bytes and write all
+    the bytes.  Note that it would be difficult to define the size of such a
+    variable in advance, since its compressed size depends on its values.
+    You would also have to give up on hyperslab access for such variables,
+    but instead read the compressed array in all at once and uncompress it
+    before using it.
+
+13: What utilities are available for netCDF?
+
+A:  The only utilities available in the current netCDF distribution from
+    Unidata are ncdump and ncgen, for converting netCDF files to an ASCII
+    human-readable form and for converting from the ASCII human-readable
+    form back to a binary netCDF file or a C or FORTRAN program for
+    generating the netCDF file.  In addition, the first release of the
+    netcdf operators package, containing three general-purpose netCDF
+    operators, is available from unidata.ucar.edu in the file
+    ncopers.tar.Z.  See the description of the file utilities.txt in the
+    answer to the question above on important files in /pub/netcdf on
+    unidata.ucar.edu for more information.
+
+14: What is the status of implementing additional netCDF operators?
+
+A:  Work on additional netCDF operators has been suspended until we can get
+    more programmer resources, due to a higher priority recently placed on
+    development of an event-driven network data distribution system.
+    Volunteers to implement one or more of the netCDF operators are hereby
+    solicited.  We will coordinate community efforts to avoid duplication of
+    effort, so before you volunteer to work on one of the planned netCDF
+    operators, please contact support at unidata.ucar.edu to find out if
+    someone else is already working on it.
+
+15: Is there a mailing list for netCDF discussions and questions?
+
+A:  Yes - there are two.  The mailing list
+
+        netcdfgroup at unidata.ucar.edu
+
+    has over two hundred readers and gateways; you can subscribe or
+    unsubscribe to the mailing list by sending mail to
+
+        netcdfgroup-adm at unidata.ucar.edu
+
+    If you would prefer to get only a single daily digest of the postings to
+    the netcdfgroup mailing list, subscribe instead to the netcdfdigest
+    mailing list by sending a request to
+
+	netcdfdigest-adm at unidata.ucar.edu
+
+    All the postings to the netcdfgroup mailing list are archived in the
+    file mail-archives/netcdfgroup available via anonymous FTP from
+    unidata.ucar.edu.
+
+16: How do I make a bug report?
+
+A:  If you find a bug, send a description to 
+
+        support at unidata.ucar.edu
+
+    This is also a better address to use for questions or discussions about
+    netCDF that you think are not appropriate for the entire netcdfgroup
+    mailing list.
+
+17: Is there any WAIS or gopher access to netCDF information?
+
+A:  Yes, `netcdf-group.src' is a WAIS source that provides a full-text
+    search of the netcdfgroup mailing list archive and is registered with
+    think.com for general use.
+
+    Another WAIS source, `unidata-support-netcdf.src', provides a
+    full-text search of the support questions and answers about netCDF
+    provided by Unidata support staff.
+
+    Both of these WAIS servers and access to other information about Unidata
+    can be accessed most easily through the Unidata gopher server at
+    gopher.unidata.ucar.edu.
+
+18: How widely is netCDF used?
+
+A:  The netcdfgroup and netcdfdigest mailing lists have 290 addresses (some
+    of which are aliases to more addresses) in fifteen countries.  Several
+    groups have adopted netCDF as a standard way to represent some forms of
+    scientific data.
+
+    The global ocean modeling effort at Los Alamos National Laboratory
+    (LANL), as part of the DOE CHAMMP effort and one of the DOE Grand
+    Challenges, has selected netCDF as the archival format for its
+    computational data.  An effort to bring netCDF up on the parallel disks
+    on the CM-5 is planned to begin shortly.
+
+    The National Center for Supercomputing Applications has incorporated the
+    netCDF 2.3 interfaces into the latest release of their HDF software,
+    permitting HDF tools that use this interface to be applied to netCDF
+    datasets that are either XDR- or HDF-encoded.
+
+    The Computer Planning Committee of NOAA's Pacific Marine Environmental
+    Laboratory (PMEL) endorsed netCDF as the preferred data format for the
+    Laboratory in early 1993.  PMEL has developed the EPIC system for
+    management, display and analysis of oceanographic time series and
+    hydrographic data.  EPIC utilizes netCDF as its primary data format.
+    EPIC toolkits for netCDF include a data file I/O library, which is
+    layered on top of the netCDF library, a netCDF calculator (nccalc)
+    linked with a scientific graphics package (PPLUS), and a suite of
+    display and analysis programs for oceanographic data.
+
+    Lamont-Doherty Earth Observatory of Columbia University has converted
+    all Marine Geophysics data (gravity, magnetics and bathymetry) acquired
+    in the past 40 years by scientists at L-DEO as well as at other
+    institutions to netCDF.  A package of programs to access, maintain and
+    display those files has also been completed.  The software package is
+    available via FTP (pub/cdf/MGG_CDF.tar.Z on lamont.ldeo.columbia.edu)
+
+    The Generic Mapping Tools (GMT), a Unix-based set of tools for data
+    manipulation and display using PostScript, make use of netCDF for
+    storage of 2-D gridded data sets.  GMT is used worldwide by about 3000
+    scientists, according to the developers.
+
+    The Models-3 Project, being cooperatively pursued by the EPA's
+    Atmospheric Research Laboratory and by North Carolina Supercomputing
+    Center, is using an environmental-modeling-specific applications
+    programming interface on top of UCAR's netCDF as the means for
+    persistent storage of both observational and model-output data, as well
+    as for storing sets of data-file-structure definitions and (prototype,
+    so far) data-dependency graphs for scheduling the sets of programs which
+    constitute their environmental models.
+
+    A group in the Atmospheric Chemistry Division at NCAR that deals with
+    UARS (Upper Atmospheric Research Satellite) data uses netCDF for their
+    binary data format.  Output from NCAR's High Altitude Observatory
+    Division Thermospheric General Circulation Model (TGCM) and related
+    models are converted to netCDF files for post-model visualization and
+    diagnostic codes.  NCAR's Research Aviation Facility will use netCDF to
+    distribute all aircraft data, if performance tests on writing high rate
+    data are satisfactory.
+    
+    NCAR's Research Data Program uses netCDF as the primary file format for
+    data archived and used in the "zeb" display and analysis system.  Quick
+    look data from various projects is distributed by RDP in netCDF.  NetCDF
+    is also the file format used by the (zeb-based) Integrated Sounding
+    System.
+
+    PolyPaint is an interactive 3D visualization package from NCAR.
+    PolyPaint V 3.4 uses netCDF for data sets, and storage of geometry
+    information.  PolyPaint+ alpha-version, being developed jointly by
+    NCAR/MMM and LASP with funding from AISRP/NASA uses netCDF and DataHub
+    from JPL.
+
+    DataHub from JPL, with funding from AISRP/NASA identifies and converts
+    between a variety of data format, CDF, HDF, MMM/netCDF, FITS, PDS, ...
+    Work is under way to support conversion from a variety of NASA data
+    formats to netCDF used by the PolyPaint+ visualization system from
+    NCAR's MMM division.  (JPL Contact for DataHub: Tom Handley,
+    thandley at spacemouse.jpl.nasa.gov)
+
+    A major component of the US Climate and Global Change program is the
+    TOGA-TAO Array in the tropical Pacific, which proposes to maintain
+    approximately 70 moored ATLAS wind and thermistor chain and current
+    meter buoys, spanning the Pacific ocean from 95W to 137E in the
+    equatorial wave guide.  The TAO Project Office, at PMEL, has developed
+    distribution and display software for the real-time data from the TAO
+    buoys, in a point-and-click UNIX workstation environment.  This software
+    is distributed nationally and internationally.  All data is stored and
+    distributed in netCDF format.  All graphics displays and animations are
+    produced with the EPIC tools for working with netCDF data files.
+
+    The US Geological Survey's Branch of Atlantic Marine Geology uses netCDF
+    to access a variety of scientific data sets, including output from
+    circulation and sediment tranport models, sonar imagery, digital
+    elevation models, and environmental sensor data.  It is currently
+    investigating the utility of using netCDF for data distribution on
+    CDROM.
+
+    At the Woods Hole Oceanographic Institution, netCDF is used in several
+    areas.  Ships in the UNOLS fleet are recording measurements from the
+    IMET systems in netCDF form.  These data include wind, barometer,
+    humidity, air and sea temperature, precipitation, short wave radiation,
+    and GPS navigation.  Data sets from these systems taken during the WOCE
+    experiments in the Pacific have been archived recently at NCAR.  Also,
+    measurements from a diverse set of instruments deployed on buoys for the
+    Subduction, TOGA/COARE, and several other experiments are translated
+    into netCDF form for processing and archival.  Reports that describe the
+    software systems used for these processing activities are available from
+    WHOI.
+
+    Scripps Institution of Oceanography (SIO) and the University Corporation
+    for Atmospheric Research (UCAR) conducted a multi-platform climate field
+    project during March of this year based in Nadi, Fiji.  All data from
+    this experiment will be archived using Unidata's netCDF before release
+    to the scientific community.
+
+    The Oregon State University Oceanographic research vessel WECOMA uses
+    the netCDF library for primary scientific data logging.  This includes
+    navigational, meteorological, and other miscellaneous data.  This
+    logging is part of a client/server system for data distribution,
+    display, and management known as XMIDAS.  More details of the system are
+    available from oce.orst.edu in the directory /pub/Wecoma, including a
+    sample netCDF created data file from a Wecoma cruise.
+
+    NOAA's Forecast System Laboratories have adopted netCDF as a data access
+    interface for some of their systems and applications.
+
+    A researcher at CSIRO Division of Oceanography in Australia is using
+    netCDF for input and output files for a three dimensional coastal and
+    estuarine hydrodynamic model.
+    
+    A general purpose finite element data model (referred to as EXODUS II)
+    utilizing netCDF has been developed at Sandia National Laboratories.  It
+    consists of a C and FORTRAN application programming interface (API) to
+    read and write geometry and results (including time varying data) for
+    finite element analyses.  For more information, contact Larry Schoof
+    (laschoo at somnet.sandia.gov).
+
+    NetCDF is the defacto standard for Analytical Data Interchange and
+    Storage Standards (ADISS) for chromatography and mass spectrometry.
+    NetCDF has been adopted by the Analytical Instrument Association (AIA),
+    which includes all major analytical laboratory instrument vendors
+    worldwide.  ADISS supplies the Analytical Information Model on which the
+    information content of these standards is based.  The main uses of
+    ADISS/netCDF by end users have been data communications and archival.
+
+    The AIA Standards Committee is currently developing an ADISS Data
+    Dictionary for infrared spectroscopy.  The AIA expects to use netCDF for
+    implementing data interchange.
+
+    Another committee is developing an ADISS Data Dictionary for nuclear
+    magnetic resonance and magnetic resonance imaging spectroscopy.  After
+    sufficient performance testing is completed, netCDF may be used for
+    native storage for NMR, as well as data communications.  Testing is
+    expected to be completed at the end of summer 1993.
+
+    Several commercial analysis and data visualization packages have been
+    adapted to access netCDF data, including Spyglass Dicer, IBM
+    Visualization Data Explorer, Research Systems' IDL, and Wavefront's Data
+    Visualizer.
+
+    SuperComputer Systems Engineering and Services Company (SSESCO) decided
+    that for all future releases of their scientific visualization software,
+    savi3D, netCDF will be the `native' format.  SSESCO has implemented a
+    meta-file layer on top of the netCDF library, called MRAF.  It handles
+    multiple netCDF files as well as automatic max-min calculations,
+    time-varying gridded, particle, and discrete data, logical groupings for
+    discrete data, and an overall simplified and flexible interface for
+    storing scientific data.  MRAF is being used by the DOE at the
+    Hanford-Meterological Site for observational data and will be used for
+    their weather-modelling.  SSESCO is also working with meterologists
+    around the US and France who will be moving to netCDF before the end of
+    the year (mostly users of savi3D).
+
+    The VISAGE visualization system, developed at the General Electric
+    Corporate Research and Development, (Schroeder, WJ et al, "VISAGE: An
+    Object-Oriented Scientific Visualization System", Proceedings of
+    Visualization `92 Conference) uses netCDF as the preferred format.
+    VISAGE is used at GE Corporate R&D, GE Aircraft Engine, GE Canada, GE
+    Power Generation, as well as ETH Zurich, Switzerland, MQS In Chieti,
+    Italy, and Rensselaer Polytechnic Institute in Troy, New York.
+
+    GE has another application called "Decimate" that does polygon
+    reduction/decimation (Schroeder,WJ et al, "Decimation of Triangle
+    Meshes", Proceedings of SIGGRAPH `92).  Again, this application uses
+    netCDF as a preferred format.  Decimate is currently licensed to
+    Cyberware, Inc., makers of 3D laser digitizing hardware.  Decimate is
+    currently bundled with the scanners, and will soon be available as a
+    commercial product.
diff --git a/mfhdf/Makefile.am b/mfhdf/Makefile.am
new file mode 100644
index 0000000..0d0e4e7
--- /dev/null
+++ b/mfhdf/Makefile.am
@@ -0,0 +1,35 @@
+include $(top_srcdir)/config/commence.am
+
+if HDF_BUILD_XDR
+XDR_DIR = xdr
+else
+XDR_DIR =
+endif
+
+if HDF_BUILD_FORTRAN
+FORTRAN_DIR = fortran
+else
+FORTRAN_DIR =
+endif
+
+# src folder in root Makefile, build other folders now
+SUBDIRS = $(XDR_DIR) libsrc $(FORTRAN_DIR) test ncdump ncgen dumper hdfimport hdiff hrepack nctest
+
+DIST_SUBDIRS = xdr libsrc fortran test ncdump ncgen dumper hdfimport hdiff hrepack nctest examples
+
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples $(FORTRAN_DIR); do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
diff --git a/mfhdf/Makefile.in b/mfhdf/Makefile.in
new file mode 100644
index 0000000..9c8844e
--- /dev/null
+++ b/mfhdf/Makefile.in
@@ -0,0 +1,647 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am THANKS
+subdir = mfhdf
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+ at HDF_BUILD_XDR_FALSE@XDR_DIR = 
+ at HDF_BUILD_XDR_TRUE@XDR_DIR = xdr
+ at HDF_BUILD_FORTRAN_FALSE@FORTRAN_DIR = 
+ at HDF_BUILD_FORTRAN_TRUE@FORTRAN_DIR = fortran
+
+# src folder in root Makefile, build other folders now
+SUBDIRS = $(XDR_DIR) libsrc $(FORTRAN_DIR) test ncdump ncgen dumper hdfimport hdiff hrepack nctest
+DIST_SUBDIRS = xdr libsrc fortran test ncdump ncgen dumper hdfimport hdiff hrepack nctest examples
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+cscopelist-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+		am__skip_mode_fix=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+	cscopelist-recursive ctags-recursive install-am install-strip \
+	tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	cscopelist cscopelist-recursive ctags ctags-recursive \
+	distclean distclean-generic distclean-libtool distclean-tags \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installcheck-local \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am
+
+
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples $(FORTRAN_DIR); do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/README b/mfhdf/README
new file mode 100644
index 0000000..2c2bdea
--- /dev/null
+++ b/mfhdf/README
@@ -0,0 +1,123 @@
+Unidata netCDF was integrated with HDF early in HDF's history.  
+
+The COPYRIGHT file in this directory is the Unidata netCDF copyright and
+license file from Version 2.3.2, in 1993.  For those interested, the 
+Unidata netCDF README from the same release appears below. 
+
+Unidata netCDF Version 2.3.2 is the version integrated with this version 
+of HDF.
+
+--------------------------------------------------------------------------
+Unidata netCDF README
+--------------------------------------------------------------------------
+
+                               Unidata netCDF
+                               Version 2.3.2
+                                 June 1993
+
+The Unidata network Common Data Form (netCDF) is an interface for scientific
+data access and a freely-distributed software library that provides an
+implementation of the interface.  The netCDF library also defines a
+machine-independent format for representing scientific data.  Together, the
+interface, library, and format support the creation, access, and sharing of
+scientific data.  The current netCDF software provides common C and FORTRAN
+interfaces for applications and data.  It has been tested on various common
+platforms, including several versions of UNIX, VMS, MSDOS, and OS/2.
+
+NetCDF files are self-describing, network-transparent, directly accessible,
+and extendible.  `Self-describing' means that a netCDF file includes
+information about the data it contains.  `Network-transparent' means that a
+netCDF file is represented in a form that can be accessed by computers with
+different ways of storing integers, characters, and floating-point numbers.
+`Direct-access' means that a small subset of a large dataset may be accessed
+efficiently, without first reading through all the preceding data.
+`Extendible' means that data can be appended to a netCDF dataset without
+copying it or redefining its structure.
+
+NetCDF is useful for supporting access to diverse kinds of scientific
+data in heterogeneous networking environments and for writing application
+software that does not depend on application-specific formats.  A variety
+of analysis and display packages have been developed to analyze and
+display data in netCDF form.
+
+You can obtain a copy of the latest version of netCDF software using
+anonymous FTP from
+
+        host: unidata.ucar.edu
+        file: pub/netcdf/netcdf.tar.Z
+
+Included in this distribution are: the C source for the netCDF data
+access library, sources for the FORTRAN jacket library for various
+systems, documentation for the netCDF library and utilities in the form
+of a netCDF User's Guide, source for the netCDF utilities ncdump and
+ncgen, a directory of test programs to verify the correct implementation
+of the netCDF library in new environments, and a directory of XDR
+(eXternal Data Representation) source code for environments that do not
+support XDR.
+
+Other files available for anonymous FTP from the pub/netcdf/ directory of
+unidata.ucar.edu include
+
+ README                 general information about netCDF
+
+ FAQ                    Frequently Asked Questions (with answers) about
+                        netCDF.
+
+ utilities.txt          a list of software packages currently available or
+                        under development for manipulating and displaying
+                        netCDF data
+
+ guide.ps.Z             a compressed PostScript file of the NetCDF User's
+                        Guide.  This is included in the netcdf.tar.Z
+                        distribution, so you don't need both.
+
+ ncprogs.ps             a draft PostScript document describing an initial
+                        set of netCDF operator and utility programs under
+                        development
+                        
+ ncprogs.txt            an ASCII version of ncprogs.ps
+
+ conventions.info       a draft document of some proposed netCDF conventions
+
+ cdl/                   a directory containing some examples of CDL files
+                        (an ASCII representation for netCDF files).
+
+ msdos/                 a directory containing executables and binaries for
+                        netCDF under MSDOS 5.0.  These can also be built
+                        from the sources in netcdf.tar.Z, if you have the
+                        necessary Microsoft compilers.
+
+ mac/                   a directory containing notes and Macintosh MPW
+                        makefiles for porting netCDF to an Apple Macintosh.
+                        These were contributed by Chuck Denham, U.S.
+                        Geological Survey.
+
+Current netCDF plans include the design and implementation of a
+C++ interface, implementation of netCDF operator and utility programs,
+and transparent support for packed netCDF data.
+
+A mailing list, netcdfgroup at unidata.ucar.edu, exists for discussion of
+the netCDF interface and announcements about netCDF bugs, fixes, and
+enhancements.  To subscribe, send a request to
+
+        netcdfgroup-adm at unidata.ucar.edu
+
+An archive of past postings to the netcdfgroup mailing list is available
+for anonymous FTP from the file mail-archives/netcdfgroup of
+unidata.ucar.edu.
+
+A recent paper that provides a good introduction to the use of netCDF
+appeared in
+
+  Jenter, H. L. and R. P. Signell, 1992. "NetCDF: A Freely-Available
+  Software-Solution to Data-Access Problems for Numerical Modelers".
+  Proceedings of the American Society of Civil Engineers Conference on
+  Estuarine and Coastal Modeling. Tampa, Florida.
+
+This paper is available via anonymous FTP from
+
+        host: crusty.er.usgs.gov
+        file: pub/netcdf.asce.ps
+
+Specific questions about netCDF that are not of interest to the
+netcdfgroup mailing list may be sent to support at unidata.ucar.edu.
diff --git a/mfhdf/THANKS b/mfhdf/THANKS
new file mode 100644
index 0000000..9790446
--- /dev/null
+++ b/mfhdf/THANKS
@@ -0,0 +1,78 @@
+This THANKS file is from Unidata netCDF Version 2.3.2.
+(No attempt has been made to update contact information.)
+------------------------------------------------------------------------
+
+The NASA CDF data model, to which netCDF owes much, was developed by
+Michael Gough and Lloyd Treinish.  Joe Fahle designed a C version for a
+CDF-like interface and discussions with Joe provided much of the
+inspiration for the original netCDF C interface.  The netCDF C library
+was written by Glenn Davis.  The nctest test suite, ncdump, ncgen, and
+C++ interface were written by Russ Rew.  The XDR library is from Sun
+Microsystems.  The FORTRAN jackets and FORTRAN test code were written by
+Cathy Cormack.  The port library, configure-based installation system,
+and generalized hyperslab access implementation and test code are by
+Steve Emmerson.
+
+The following people have contributed bug reports, fixes, good
+suggestions, descriptions of use, and other kinds of useful support:
+
+Ethan Alpert                    ethan at niwot.scd.ucar.EDU
+Dr. Kenneth P. Bowman           bowman at csrp.tamu.edu
+Bill Boyd                       boyd at mmm.ucar.edu
+Mark Bradford                   mark at typhoon.ofps.ucar.edu
+Morrell Chance                  chance at theory.pppl.gov
+Carlie J. Coats, Jr.            coats at ncsc.org
+Jon Corbet                      corbet at stout.atd.ucar.EDU
+Harvey Davies                   hld at atmos.dar.csiro.au
+Charles R. Denham               cdenham at nobska.er.usgs.gov
+Steve Diggs                     sdiggs at ucsd.edu
+Harry Edmon                     harry at atmos.washington.edu
+Joe Fahle                       jhf at loreto.seaspace.com
+Gabor Fichtinger                gabor at chpc.utexas.edu
+Glenn Flierl                    glenn at mead.mit.edu
+Mike Folk                       mfolk at ncsa.uiuc.edu
+David W. Forslund               dwf at lanl.gov
+Ben Foster                      foster at ncar.ucar.edu
+Gary Granger                    granger at stout.atd.ucar.edu
+Steve Hankin                    hankin at noaapmel.gov
+Bill Hart                       hart at ocean.ml.csiro.au
+Edward J. Hartnett              ejh at khonshu.colorado.edu
+Donn Hines                      donn at lanl.gov
+Tim Holt                        holtt at oce.orst.edu
+Chris Houck                     chouck at ncsa.uiuc.edu
+Harry Jenter                    hjenter at stress.er.usgs.gov
+Susan Jesuroga                  jesuroga at comet.ucar.edu
+Tomas Johannesson               tj at os.is
+John Kemp                       kemp at uiatma.atmos.uiuc.edu
+Bruce Langdon                   langdon at laura.llnl.gov
+Angel Li                        angel at miami.rsmas.miami.edu
+Brian Lincoln                   blincoln at SESSCO.com
+Jeffery W. Long                 jwlong at llnl.gov
+Dave Lucas                      dave at nwra.com
+Lawrence Lyjak                  lvl at acd.ucar.EDU
+Rich Lysakowski                 lysakowski at duggan.enet.dec.com
+Marinna Martini                 mmartini at nobska.er.usgs.gov
+Ron Melton                      rb_melton at pnl.gov
+Roy Mendelssohn                 mendelssohn at ssurf.ucsd.edu
+Barb Mihalas                    bmihalas at ncsa.uiuc.edu
+Rakesh Mithal                   rakesh at lamont.ldgo.columbia.edu
+Skip Montanaro                  montanaro at crd.ge.com
+Peter Neelin                    neelin at pet.mni.mcgill.ca
+Dan Packman                     pack at ncar.ucar.edu
+Dr. Louise Perkins              perkins at pimms.mit.edu
+Ron Pfaff                       rtp at woodsy.lanl.gov
+Ken Prada                       kegp at isdl.whoi.edu
+Mark Rivers                     rivers at bnlx26.nsls.bnl.gov
+Randolph Roesler                rdr at mda.ca
+Larry A. Schoof                 laschoo at sass577.endo.sandia.gov
+Rich Schramm                    scri at mbari.org
+William J. Schroeder            schroeder at crd.ge.com
+Keith Searight                  keith at uiatma.atmos.uiuc.edu
+Richard P. Signell              rsignell at crusty.er.usgs.gov
+Nancy Soreide                   nns at noaapmel.gov
+Lloyd Treinish                  lloydt at watson.ibm.com
+Tom Umeda                       TUmeda at baaqmd.gov
+Stephen Walker                  walker at ml.csiro.au
+Chris Webster                   chris at chinook.atd.ucar.EDU
+Paul Wessel                     wessel at kiawe.soest.hawaii.edu
+David Wojtowicz                 davidw at uiatma.atmos.uiuc.edu
diff --git a/mfhdf/build.bat b/mfhdf/build.bat
new file mode 100644
index 0000000..3efe838
--- /dev/null
+++ b/mfhdf/build.bat
@@ -0,0 +1 @@
+nmake /f msoft.mk xdr libsrc nctest fortran ncgen ncdump
diff --git a/mfhdf/dumper/CMakeLists.txt b/mfhdf/dumper/CMakeLists.txt
new file mode 100644
index 0000000..f4afcad
--- /dev/null
+++ b/mfhdf/dumper/CMakeLists.txt
@@ -0,0 +1,63 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_DUMPER)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+
+ADD_DEFINITIONS (-DHDF)
+
+SET (hdp_SRCS
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_dump.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_gr.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_list.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_rig.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_sds.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_util.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_vd.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/hdp_vg.c
+    ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/show.c
+)
+  
+ADD_EXECUTABLE (hdp ${hdp_SRCS})
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+  TARGET_LINK_LIBRARIES (hdp ${HDF4_MF_XDR_LIB_TARGET})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_C_PROPERTIES (hdp " " " ")
+TARGET_LINK_LIBRARIES (hdp ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+TARGET_NAMING (hdp ${LIB_TYPE})
+IF (WIN32)
+  SET_TARGET_PROPERTIES (hdp PROPERTIES LINK_FLAGS "/STACK:10000000")
+ENDIF (WIN32)
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+INSTALL_PROGRAM_PDB (hdp ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+
+INSTALL (
+    TARGETS
+        hdp
+    RUNTIME DESTINATION
+        ${HDF4_INSTALL_TOOLS_BIN_DIR}
+    COMPONENT
+        toolsapplications
+)
diff --git a/mfhdf/dumper/CMakeTests.cmake b/mfhdf/dumper/CMakeTests.cmake
new file mode 100644
index 0000000..71aa2ab
--- /dev/null
+++ b/mfhdf/dumper/CMakeTests.cmake
@@ -0,0 +1,401 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+  
+  #-- Copy all the data files from the test directory into the source directory
+  SET (HDF4_REFERENCE_TEST_FILES
+      ctxtr2r.hdf
+      Example6.hdf
+      grtdfi322.hdf
+      grtdfui162.hdf
+      grtdfui82.hdf
+      grtdfui83.hdf
+      grtdfui84.hdf
+      Image_with_Palette.hdf
+      IMCOMP.hdf
+      LongDataset.hdf
+      sds_compressed.hdf
+      sds_empty_many.hdf
+      sds1_dim1_samename.hdf
+      sds2_dim1_samename.hdf
+      SDSlongname.hdf
+      star.hdf
+      swf32_fileattr.hdf
+      swf32.hdf
+      swi16.hdf
+      swi8.hdf
+      Tables.hdf
+      Tables_External_File
+      tdata.hdf
+      tdf24.hdf
+      tdfr8f.hdf
+      test.hdf
+      tvattr.hdf
+      tvset.hdf
+      VGlongname.hdf
+      vslongname.hdf
+      Roy.nc
+  )
+  
+  SET (HDF4_REFERENCE_FILES
+      dumpgr-1.out
+      dumpgr-10.out
+      dumpgr-11.out
+      dumpgr-12.out
+      dumpgr-13.out
+      dumpgr-14.out
+      dumpgr-15.out
+      dumpgr-16.out
+      dumpgr-17.out
+      dumpgr-18.out
+      dumpgr-19.out
+      dumpgr-2.out
+      dumpgr-20.out
+      dumpgr-3.out
+      dumpgr-4.out
+      dumpgr-5.out
+      dumpgr-6.out
+      dumpgr-7.out
+      dumpgr-8.out
+      dumpgr-9.out
+      dumprig-1.out
+      dumprig-2.out
+      dumprig-3.out
+      dumprig-4.out
+      dumprig-5.out
+      dumprig-6.out
+      dumpsds-1.out
+      dumpsds-10.out
+      dumpsds-11.out
+      dumpsds-12.out
+      dumpsds-13.out
+      dumpsds-14.out
+      dumpsds-15.out
+      dumpsds-15szip.out
+      dumpsds-16.out
+      dumpsds-17.out
+      dumpsds-18.out
+      dumpsds-2.out
+      dumpsds-3.out
+      dumpsds-4.out
+      dumpsds-5.out
+      dumpsds-6.out
+      dumpsds-7.out
+      dumpsds-8.out
+      dumpsds-9.out
+      dumpvd-1.out
+      dumpvd-10.out
+      dumpvd-11.out
+      dumpvd-12.out
+      dumpvd-13.out
+      dumpvd-14.out
+      dumpvd-2.out
+      dumpvd-3.out
+      dumpvd-4.out
+      dumpvd-5.out
+      dumpvd-6.out
+      dumpvd-7.out
+      dumpvd-8.out
+      dumpvd-9.out
+      dumpvg-1.out
+      dumpvg-10.out
+      dumpvg-11.out
+      dumpvg-12.out
+      dumpvg-13.out
+      dumpvg-14.out
+      dumpvg-15.out
+      dumpvg-16.out
+      dumpvg-17.out
+      dumpvg-2.out
+      dumpvg-3.out
+      dumpvg-4.out
+      dumpvg-5.out
+      dumpvg-6.out
+      dumpvg-7.out
+      dumpvg-8.out
+      dumpvg-9.out
+      list-1.out
+      list-10.out
+      list-2.out
+      list-3.out
+      list-4.out
+      list-5.out
+      list-6.out
+      list-7.out
+      list-8.out
+      list-9.out
+  )
+ 
+  FOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdp 
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+
+  FOREACH (out_file ${HDF4_REFERENCE_FILES})
+    SET (outdest "${PROJECT_BINARY_DIR}/${out_file}")
+    #MESSAGE (STATUS " Translating ${out_file}")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdp
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/testfiles/${out_file} ${outdest}
+    )
+  ENDFOREACH (out_file ${HDF4_REFERENCE_FILES})
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S  M A C R O S                               ###
+##############################################################################
+##############################################################################
+
+  MACRO (ADD_H4_TEST resultfile resultcode)
+    # Remove any output file left over from previous test run
+    ADD_TEST (
+        NAME HDP-${resultfile}-clearall-objects
+        COMMAND ${CMAKE_COMMAND}
+            -E remove ${resultfile}.tst ${resultfile}.tst.err
+    )
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDP-${resultfile}-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDP-${resultfile}-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HDP-${resultfile} COMMAND $<TARGET_FILE:hdp> ${ARGN})
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HDP-${resultfile}
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdp>"
+              -D "TEST_ARGS:STRING=${ARGN}"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+              -D "TEST_OUTPUT=${resultfile}.tst"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_REFERENCE=${resultfile}.out"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    SET_TESTS_PROPERTIES (HDP-${resultfile} PROPERTIES DEPENDS HDP-${resultfile}-clearall-objects LABELS ${PROJECT_NAME})
+    SET (last_test "HDP-${resultfile}")
+  ENDMACRO (ADD_H4_TEST file)
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+  
+  ADD_H4_TEST (list-1 0 list tdata.hdf)
+  ADD_H4_TEST (list-2 0 list -l tdata.hdf)
+  ADD_H4_TEST (list-3 0 list -d tdata.hdf)
+  ADD_H4_TEST (list-4 0 list -e tdata.hdf)
+  ADD_H4_TEST (list-5 0 list -t 720 tdata.hdf)
+  ADD_H4_TEST (list-6 0 list -d -t "Numeric Data Group" tdata.hdf)
+  ADD_H4_TEST (list-7 0 list -g tdata.hdf)
+  ADD_H4_TEST (list-8 0 list -a tdata.hdf)
+  ADD_H4_TEST (list-9 0 list -a Example6.hdf)
+  ADD_H4_TEST (list-10 0 list -n Example6.hdf)
+
+  # Test 1 prints all datasets
+  ADD_H4_TEST (dumpsds-1 0 dumpsds swf32.hdf)
+
+  # Tests 2 and 3 print datasets given their indices
+  ADD_H4_TEST (dumpsds-2 0 dumpsds -i 2 swf32.hdf)
+  ADD_H4_TEST (dumpsds-3 0 dumpsds -i 1,3 swf32.hdf)
+
+  # Test 4 should fail with error message: "SD with name Time: not found"
+  ADD_H4_TEST (dumpsds-4 0 dumpsds -n Time swf32.hdf)
+
+  # Test 5 prints datasets given their names 
+  ADD_H4_TEST (dumpsds-5 0 dumpsds -n fakeDim0,Data-Set-2 swf32.hdf)
+
+  # Test 6 prints datasets given their ref numbers
+  ADD_H4_TEST (dumpsds-6 0 dumpsds -r 3,2 swf32.hdf)
+
+  # Test 7 prints only data of the datasets selected by their ref numbers
+  ADD_H4_TEST (dumpsds-7 0 dumpsds -r 3,2 -d swf32.hdf)
+
+  # Test 8 prints only header information
+  ADD_H4_TEST (dumpsds-8 0 dumpsds -h swf32_fileattr.hdf)
+
+  # Test 9 prints data in clean format, no \digit's
+  ADD_H4_TEST (dumpsds-9 0 dumpsds -c swf32_fileattr.hdf)
+
+  # Test 10 prints contents of file without file attribute's data
+  ADD_H4_TEST (dumpsds-10 0 dumpsds -g swf32_fileattr.hdf)
+
+  # Test 11 prints contents of file without local attribute's data
+  ADD_H4_TEST (dumpsds-11 0 dumpsds -l swf32_fileattr.hdf)
+
+  # Test 12 prints a dataset by name and the name is very long
+  ADD_H4_TEST (dumpsds-12 0 dumpsds -h -n "The name of this dataset is long and it is used to test the new variable length name feature." SDSlongname.hdf)
+
+  # Test 13 prints contents of file when a dimension has the same name as its SDS
+  ADD_H4_TEST (dumpsds-13 0 dumpsds sds1_dim1_samename.hdf)
+
+  # Test 14 prints contents of file when a dimension has the same name as 
+  # that of another SDS
+  ADD_H4_TEST (dumpsds-14 0 dumpsds sds2_dim1_samename.hdf)
+
+  # Test 15 prints headers of all data sets with various compression method to
+  # test displaying compression information
+
+  IF (HDF4_ENABLE_SZIP_SUPPORT)
+    ADD_H4_TEST (dumpsds-15szip 0 dumpsds sds_compressed.hdf)
+  ELSE (HDF4_ENABLE_SZIP_SUPPORT)
+    ADD_H4_TEST (dumpsds-15 0 dumpsds sds_compressed.hdf)
+  ENDIF (HDF4_ENABLE_SZIP_SUPPORT)
+
+  # Test 16 prints SDSs in index order, by default
+  ADD_H4_TEST (dumpsds-16 0 dumpsds -h -i 39,36 -n data34,data27 -r 36,37 -i 0,1 -n data6,data9,data4,data3 -r 16,17,15 -i 23,22,21 sds_empty_many.hdf)
+
+  # Test 17 prints SDSs in the order they were specified, when flag -k is present
+  # as a request to 'k'eep the specified order
+  ADD_H4_TEST (dumpsds-17 0 dumpsds -k -h -i 39,36 -n data34,data27 -r 36,37 -i 0,1 -n data6,data9,data4,data3 -r 16,17,15 -i 23,22,21 sds_empty_many.hdf)
+
+  # Test 18 reads a few small datasets in a netCDF file
+  ADD_H4_TEST (dumpsds-18 0 dumpsds -i 0,1,2 Roy.nc)
+
+  ADD_H4_TEST (dumprig-1 0 dumprig tdf24.hdf)
+  ADD_H4_TEST (dumprig-2 0 dumprig -i 1,2 tdf24.hdf)
+  ADD_H4_TEST (dumprig-3 0 dumprig -i 1,3 tdf24.hdf)     # '-i 3' is invalid
+  ADD_H4_TEST (dumprig-4 0 dumprig -m 24 tdf24.hdf)
+  ADD_H4_TEST (dumprig-5 0 dumprig -r 3,4 tdf24.hdf)
+  ADD_H4_TEST (dumprig-6 0 dumprig -r 3,4 -d tdf24.hdf)
+
+  # Test command dumpvd
+  ADD_H4_TEST (dumpvd-1 0 dumpvd tvset.hdf)
+  ADD_H4_TEST (dumpvd-2 0 dumpvd -i 1,3,5 tvset.hdf)
+  ADD_H4_TEST (dumpvd-3 0 dumpvd -r 1238,1239,1251,1252 tvset.hdf)
+  ADD_H4_TEST (dumpvd-4 0 dumpvd -n "Multi-Order Vdata" tvset.hdf)
+  ADD_H4_TEST (dumpvd-5 0 dumpvd -n "Mixed Vdata,Integer Vdata" tvset.hdf)
+  ADD_H4_TEST (dumpvd-6 0 dumpvd -c "Test object,No class specified" tvset.hdf)
+  ADD_H4_TEST (dumpvd-7 0 dumpvd -f B tvset.hdf)
+  ADD_H4_TEST (dumpvd-8 0 dumpvd -f "STATION_NAME,FLOATS" tvset.hdf)
+  ADD_H4_TEST (dumpvd-9 0 dumpvd -f "STATION_NAME,FLOATS" -d tvset.hdf)
+  ADD_H4_TEST (dumpvd-10 0 dumpvd tvattr.hdf)
+
+  # Tests 11 and 12 print out the vdatas of classes "SDSVar" and "CoordVar"
+  # to test the fix of bugzilla 624 (these are new classes used to distinguish
+  # between SDS and coordinate variables)
+  ADD_H4_TEST (dumpvd-11 0 dumpvd -c "SDSVar" sds1_dim1_samename.hdf)
+  ADD_H4_TEST (dumpvd-12 0 dumpvd -c "CoordVar" sds1_dim1_samename.hdf)
+
+  # Added test #13 to test long vdata's name and class, HDFFR-1267 - BMR 5/15/11
+  ADD_H4_TEST (dumpvd-13 0 dumpvd vslongname.hdf)
+
+  # Added test #14 to test the detection of external file, HDFFR-1266.  The
+  # external file is Tables_External_File and when the file is removed from the
+  # current directory, the test will fail with the name of the file displayed in
+  # the error message. - BMR 6/10/11
+  ADD_H4_TEST (dumpvd-14 0 dumpvd Tables.hdf)
+
+  # Test command dumpvg
+  ADD_H4_TEST (dumpvg-1 0 dumpvg tvset.hdf)
+  ADD_H4_TEST (dumpvg-2 0 dumpvg -i 0,1 tvset.hdf)
+  ADD_H4_TEST (dumpvg-3 0 dumpvg -r 3 tvset.hdf)
+  ADD_H4_TEST (dumpvg-4 0 dumpvg -n "Simple Vgroup" tvset.hdf)
+  ADD_H4_TEST (dumpvg-5 0 dumpvg -c "Test object" tvset.hdf)
+  ADD_H4_TEST (dumpvg-6 0 dumpvg -i 1,3,5 tdata.hdf)
+  ADD_H4_TEST (dumpvg-7 0 dumpvg -r 32,39 tdata.hdf)
+  ADD_H4_TEST (dumpvg-8 0 dumpvg -n nsamp,tdata.hdf tdata.hdf)
+  ADD_H4_TEST (dumpvg-9 0 dumpvg -c CDF0.0 tdata.hdf)
+
+  # Added option -h to the following test; this option has always 
+  # failed; just fixed it - BMR 8/1/00
+  ADD_H4_TEST (dumpvg-10 0 dumpvg -h -c Dim0.0,Var0.0 tdata.hdf)
+
+  # this following test is removed since option -d is removed
+  #  ADD_H4_TEST (dumpvg-11 0 dumpvg -c Dim0.0,Var0.0 -d tdata.hdf)
+
+  # moved test #12 up to #11, consequently - BMR 7/25/00
+  ADD_H4_TEST (dumpvg-11 0 dumpvg tvattr.hdf)
+
+  # Added these two tests for the new feature: vgroup has variable length 
+  # name - BMR 10/27/06
+  # Note that the dumpvg-13 test searches for an SDS also
+  ADD_H4_TEST (dumpvg-12 0 dumpvg VGlongname.hdf)
+  ADD_H4_TEST (dumpvg-13 0 dumpvg -n "SD Vgroup - this vgroup has an sds as a member and it is actually meant to test long vgroup name" VGlongname.hdf)
+
+  # Prints contents of file when a dimension has the same name as its SDS 
+  ADD_H4_TEST (dumpvg-14 0 dumpvg sds1_dim1_samename.hdf)
+
+  # Prints contents of file when a dimension has the same name as that 
+  # of another SDS
+  ADD_H4_TEST (dumpvg-15 0 dumpvg sds2_dim1_samename.hdf)
+
+# Verify the fix for bug HDFFR-197 and a vgroup with ref=0 (some old RI stuff)
+  ADD_H4_TEST (dumpvg-16 0 dumpvg -h grtdfi322.hdf)
+  ADD_H4_TEST (dumpvg-17 0 dumpvg grtdfi322.hdf)
+  
+  # Test command dumpgr
+  ADD_H4_TEST (dumpgr-1 0 dumpgr grtdfui82.hdf)
+  ADD_H4_TEST (dumpgr-2 0 dumpgr -i 0,1,3 grtdfui82.hdf)
+  ADD_H4_TEST (dumpgr-3 0 dumpgr -i 0 grtdfui82.hdf)
+  ADD_H4_TEST (dumpgr-4 0 dumpgr -n Image_array_5 grtdfui82.hdf)
+  ADD_H4_TEST (dumpgr-5 0 dumpgr -r 6,2,3 grtdfui82.hdf)
+  ADD_H4_TEST (dumpgr-6 0 dumpgr -r 6 -d  grtdfui82.hdf)
+  ADD_H4_TEST (dumpgr-7 0 dumpgr -o my.dat grtdfui82.hdf)
+  ADD_TEST (
+      NAME HDP-clear-my.dat
+      COMMAND    ${CMAKE_COMMAND}
+      -E remove 
+      my.dat
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HDP-clear-my.dat PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HDP-clear-my.dat PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "HDP-clear-my.dat")
+  ADD_H4_TEST (dumpgr-8 0 dumpgr -o mybin.dat  -b grtdfui82.hdf)
+  ADD_TEST (
+      NAME HDP-clear-mybin.dat
+      COMMAND    ${CMAKE_COMMAND}
+      -E remove 
+      mybin.dat
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HDP-clear-mybin.dat PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HDP-clear-mybin.dat PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "HDP-clear-mybin.dat")
+  ADD_H4_TEST (dumpgr-9 0 dumpgr grtdfui83.hdf)
+  ADD_H4_TEST (dumpgr-10 0 dumpgr grtdfui84.hdf)
+  ADD_H4_TEST (dumpgr-11 0 dumpgr grtdfui162.hdf)
+
+  # Test 12 shows that file attribute is printed
+  ADD_H4_TEST (dumpgr-12 0 dumpgr grtdfi322.hdf)
+
+  # Tests 13, 14, and 15 test option -h, which was not included in any
+  # of the previous tests, and the new options -p and -pd, printing palette
+  # with or without palette information 
+  ADD_H4_TEST (dumpgr-13 0 dumpgr -p Image_with_Palette.hdf)
+  ADD_H4_TEST (dumpgr-14 0 dumpgr -h Image_with_Palette.hdf)
+  ADD_H4_TEST (dumpgr-15 0 dumpgr -r 2,4 -pd Image_with_Palette.hdf)
+
+  # Test 16: to test new option -s, printing data as stream
+  ADD_H4_TEST (dumpgr-16 0 dumpgr -r 6 -d -s grtdfui82.hdf)
+
+  # Test 17: to test new option -m (interlace mode = LINE)
+  ADD_H4_TEST (dumpgr-17 0 dumpgr -r 6 -m 1 grtdfui82.hdf)
+
+  # Test 18: to test new option -c (printing attribute data in clean format)
+  ADD_H4_TEST (dumpgr-18 0 dumpgr -c grtdfi322.hdf)
+
+  # Test 19: to test new options -g and -l (suppress all attribute data)
+  ADD_H4_TEST (dumpgr-19 0 dumpgr -g -l grtdfi322.hdf)
+
+  # Test 20: to test dumpgr successfully detect IMCOMP compression type
+  ADD_H4_TEST (dumpgr-20 0 dumpgr IMCOMP.hdf)
diff --git a/mfhdf/dumper/Makefile.am b/mfhdf/dumper/Makefile.am
new file mode 100644
index 0000000..b5e774d
--- /dev/null
+++ b/mfhdf/dumper/Makefile.am
@@ -0,0 +1,35 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+## Add hdp specific linker flags here
+hdp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+bin_PROGRAMS = hdp
+
+## Information for building the "hdp" program
+hdp_SOURCES = hdp.c hdp_dump.c hdp_gr.c hdp_list.c hdp_rig.c hdp_sds.c      \
+              hdp_util.c hdp_vd.c hdp_vg.c show.c
+hdp_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+hdp_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+##                   Testing -- Here there be dragons.                     ##
+#############################################################################
+
+TEST_SCRIPT = testhdp.sh
+check_SCRIPTS = testhdp.sh
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/dumper/Makefile.in b/mfhdf/dumper/Makefile.in
new file mode 100644
index 0000000..dadb7f5
--- /dev/null
+++ b/mfhdf/dumper/Makefile.in
@@ -0,0 +1,806 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/testhdp.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+bin_PROGRAMS = hdp$(EXEEXT)
+TESTS = $(TEST_SCRIPT)
+subdir = mfhdf/dumper
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = testhdp.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_hdp_OBJECTS = hdp.$(OBJEXT) hdp_dump.$(OBJEXT) hdp_gr.$(OBJEXT) \
+	hdp_list.$(OBJEXT) hdp_rig.$(OBJEXT) hdp_sds.$(OBJEXT) \
+	hdp_util.$(OBJEXT) hdp_vd.$(OBJEXT) hdp_vg.$(OBJEXT) \
+	show.$(OBJEXT)
+hdp_OBJECTS = $(am_hdp_OBJECTS)
+hdp_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdp_LDFLAGS) \
+	$(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(hdp_SOURCES)
+DIST_SOURCES = $(hdp_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+hdp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdp_SOURCES = hdp.c hdp_dump.c hdp_gr.c hdp_list.c hdp_rig.c hdp_sds.c      \
+              hdp_util.c hdp_vd.c hdp_vg.c show.c
+
+hdp_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+hdp_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+#############################################################################
+TEST_SCRIPT = testhdp.sh
+check_SCRIPTS = testhdp.sh
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/dumper/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/dumper/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+testhdp.sh: $(top_builddir)/config.status $(srcdir)/testhdp.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+hdp$(EXEEXT): $(hdp_OBJECTS) $(hdp_DEPENDENCIES) $(EXTRA_hdp_DEPENDENCIES) 
+	@rm -f hdp$(EXEEXT)
+	$(hdp_LINK) $(hdp_OBJECTS) $(hdp_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_dump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_gr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_list.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_rig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_sds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_util.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_vd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdp_vg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/show.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-binPROGRAMS clean-generic clean-libtool cscopelist \
+	ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/dumper/README b/mfhdf/dumper/README
new file mode 100644
index 0000000..263f065
--- /dev/null
+++ b/mfhdf/dumper/README
@@ -0,0 +1,21 @@
+		README for the HDF dumper directory
+
+This directory contains source and data files for hdp, an HDF dumper.
+File hdp.txt explains hdp commands and command options. Hdp will be
+automatically compiled and installed when you run 'make' and
+'make install' from the top level.
+
+A file named testhdf.sh and a group of .hdf files are included for 
+testing.   Run the test with the command "make test".
+
+Please send your bug reports, comments and suggestions to 
+hdfhelp at hdfgroup.org
+
+----------------- History of data files ------------------
+
+Below is a list describing how some of the hdf files in this directory
+were generated.
+
+sds_compressed.hdf: by test_various_comps() in mfhdf/libsrc/tcomp.c
+sds_szipped.hdf: by gen_sds_szipped.c
+
diff --git a/mfhdf/dumper/TEST b/mfhdf/dumper/TEST
new file mode 100644
index 0000000..e5b0e24
--- /dev/null
+++ b/mfhdf/dumper/TEST
@@ -0,0 +1,65 @@
+
+The following commands can be used for testing.
+
+(1)  hdp list tdata.hdf
+     hdp list -l tdata.hdf
+     hdp list -d tdata.hdf
+     hdp list -e tdata.hdf
+     hdp list -t 720 tdata.hdf
+     hdp list -d -t "Numeric Data Group" tdata.hdf
+     hdp list -g tdata.hdf
+     hdp list -a tdata.hdf
+     hdp list -a Example6.hdf
+     hdp list -n Example6.hdf
+
+
+(2) hdp dumpsds swf32.hdf
+    hdp dumpsds -i 2 swf32.hdf
+    hdp dumpsds -i 1,3 swf32.hdf
+    hdp dumpsds -n Time swf32.hdf /* This command should fail with
+       error message: "SD with name Time: not found"     */
+    hdp dumpsds -n fakeDim0,Data-Set-2 swf32.hdf
+    hdp dumpsds -r 3,2 swf32.hdf
+    hdp dumpsds -r 3,2 -d swf32.hdf
+
+(3) hdp dumprig tdf24.hdf
+    hdp dumprig -i 1,2 tdf24.hdf
+    hdp dumprig -i 1,3 tdf24.hdf /* '-i 3' is invalid   */
+    hdp dumprig -m 24 tdf24.hdf
+    hdp dumprig -r 3,4 tdf24.hdf
+    hdp dumprig -r 3,4 -d tdf24.hdf
+
+(4) hdp dumpvd tvset.hdf
+    hdp dumpvd -i 1,3,5 tvset.hdf
+    hdp dumpvd -r 1238,1239,1251,1252 tvset.hdf
+    hdp dumpvd -n "Multi-Order Vdata" tvset.hdf
+    hdp dumpvd -n "Mixed Vdata","Integer Vdata" tvset.hdf
+    hdp dumpvd -c "Test object","No class specified" tvset.hdf
+    hdp dumpvd -f B tvset.hdf
+    hdp dumpvd -f "STATION_NAME","FLOATS" tvset.hdf
+    hdp dumpvd -f "STATION_NAME","FLOATS" -d tvset.hdf
+
+(5) hdp dumpvg tvset.hdf
+    hdp dumpvg -i 0,1 tvset.hdf
+    hdp dumpvg -r 3 tvset.hdf
+    hdp dumpvg -n "Simple Vgroup" tvset.hdf
+    hdp dumpvg -c "Test object" tvset.hdf
+    hdp dumpvg -i 1,3,5 tdata.hdf
+    hdp dumpvg -r 32,39 tdata.hdf
+    hdp dumpvg -n nsamp,tdata.hdf tdata.hdf
+    hdp dumpvg -c CDF0.0 tdata.hdf
+    hdp dumpvg -c Dim0.0,Var0.0 tdata.hdf
+    hdp dumpvg -c Dim0.0,Var0.0 -d tdata.hdf
+
+(6) hdp dumpgr grtdfui82.hdf
+    hdp dumpgr -i 0,1,3 grtdfui82.hdf
+    hdp dumpgr -i 0 grtdfui82.hdf
+    hdp dumpgr -n Image_array_5 grtdfui82.hdf
+    hdp dumpgr -r 6,2,3 grtdfui82.hdf
+    hdp dumpgr -r 6 -d  grtdfui82.hdf
+    hdp dumpgr -o my.dat grtdfui82.hdf
+    hdp dumpgr -o mybin.dat  -b grtdfui82.hdf
+    hdp dumpgr grtdfui83.hdf
+    hdp dumpgr grtdfui84.hdf
+    hdp dumpgr grtdfui162.hdf
+    hdp dumpgr grtdfi322.hdf
diff --git a/mfhdf/dumper/hdp.c b/mfhdf/dumper/hdp.c
new file mode 100644
index 0000000..06740e0
--- /dev/null
+++ b/mfhdf/dumper/hdp.c
@@ -0,0 +1,455 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6013 $";
+#endif
+
+/* $Id: hdp.c 6013 2014-01-10 21:19:02Z acheng $ */
+#define HDP_MASTER
+#define VSET_INTERFACE
+#include "hdp.h"
+#include "local_nc.h"	/* to use some definitions */
+
+/* Print the usage message about this utility */
+static void 
+usage(intn argc, char *argv[])
+{
+    printf("%s, %s\n\n", argv[0], LIBVER_STRING );
+    printf("Usage: hdp [-H] command [command options] <filelist>\n");
+    printf("\t -H  Display usage information about the specified command.\n");
+    printf("\t     If no command is specified, -H lists all commands.\n");
+    printf("\t Commands:\n");
+    printf("\t     list \tlists contents of files in <filelist>\n");
+    printf("\t     dumpsds\tdisplays data of SDSs in <filelist>\n");
+    printf("\t     dumpvd\tdisplays data of vdatas in <filelist>. \n");
+    printf("\t     dumpvg\tdisplays data of vgroups in <filelist>. \n");
+    printf("\t     dumprig\tdisplays data of RIs (DFR8 and DFR24) in <filelist>. \n");
+    printf("\t     dumpgr\tdisplays data of RIs in <filelist>. \n");
+    printf("\t <filelist>\tlist of hdf file names, separated by spaces.\n");
+}
+
+void
+init_dump_opts(dump_info_t * dump_opts)
+{
+    dump_opts->filter = DALL; /* default dump all GRs */
+    dump_opts->by_index.num_list = NULL; /* no index given */
+    dump_opts->by_index.num_items = 0;
+    dump_opts->by_ref.num_list = NULL; /* no ref# given */
+    dump_opts->by_ref.num_items = 0;
+    dump_opts->by_name.str_list = NULL; /* no name given */
+    dump_opts->by_name.num_items = 0;
+    dump_opts->by_class.str_list = NULL; /* no class given */
+    dump_opts->by_class.num_items = 0;
+    dump_opts->contents = DVERBOSE;   /* default dump all information */
+    dump_opts->dump_to_file = FALSE;          /* don't dump to output file */
+    dump_opts->file_format = DASCII;    /* default output is ASCII file */
+    dump_opts->file_type = HDF_FILE;    /* assuming an HDF file is provided */
+    dump_opts->print_pal = FALSE;     /* GR only, don't print palette */
+    dump_opts->keep_order = FALSE;
+    dump_opts->all_types = NULL;
+
+    /* no specific dataset requested, default to dump all datasets */
+    dump_opts->num_chosen = NO_SPECIFIC;
+
+    /* print output aligned, using carriage returns */
+    dump_opts->as_stream = FALSE;
+
+    /* print space characters (LF, FF, CR, space, tabs...) in \digit format */
+    dump_opts->clean_output = FALSE;
+
+    /* print data starting at column 16 unless reset otherwise */
+    dump_opts->firstln_indent = 16;
+
+    /* print data on a continuous line starting at column 16 unless 
+       reset otherwise */
+    dump_opts->contln_indent = 16;
+
+    /* GR only, print data using interlace at creation */
+    dump_opts->interlace = NO_SPECIFIC;
+
+    /* GR & SD only, print data of global attributes unless -g is given */
+    dump_opts->no_gattr_data = FALSE;
+
+    /* GR & SD only, print data of local attributes unless -l is given */
+    dump_opts->no_lattr_data = FALSE;
+
+    HDstrcpy(dump_opts->file_name, "\0");
+}       /* end init_dump_opts() */
+
+
+int 
+main(int argc, char *argv[])
+{
+    command_t   cmd;			/* command to perform */
+    intn        curr_arg;		/* current cmd line argument */
+    dump_opt_t  glob_opts;		/* global options for all commands */
+    intn        j;				/* local counting variables */
+
+    HDmemset(&glob_opts, 0, sizeof(dump_opt_t));
+
+    if (argc < 2)
+      {
+          usage(argc, argv);
+          exit(1);
+      }		/* end if */
+
+    curr_arg = 1;
+/*  printf("Argument 0: %s\n",argv[0]);
+    printf("Argument 1: %s\n",argv[1]);
+    */
+    while (curr_arg < argc && (argv[curr_arg][0] == '-'))
+      {
+              /*  while(curr_arg<argc && (argv[curr_arg][0]=='-' || argv[curr_arg][0]=='/')) {  */
+          switch (argv[curr_arg][1])
+            {
+            case 'H':
+                    /*     case 'h':  *//*    Print help for a given command */
+                if (curr_arg < argc - 1)
+                  {
+                      glob_opts.help = TRUE;	/* for displaying options. */
+                      break;
+                  }
+            default:
+                usage(argc, argv);	/* Display the general usage. */
+                exit(1);
+            }	/* end switch */
+          curr_arg++;
+      }		/* end while */
+
+    for (j = 0, cmd = HELP; j < (sizeof(commands) / sizeof(const char *)); j++, cmd++)
+      {
+          if (HDstrcmp(argv[curr_arg], commands[j]) == 0)
+              break;
+      }		/* end for */
+
+/* printf("cmd=%d\n",(int)cmd);
+   printf("command=%s\n",argv[curr_arg]);
+   */
+    curr_arg++;
+
+	/* must be a legit command */
+    switch (cmd)
+      {
+      case LIST:
+          if (FAIL == do_list(curr_arg, argc, argv, glob_opts.help))
+              exit(1);
+          break;
+
+      case DUMPSDS:
+          if (FAIL == do_dumpsds(curr_arg, argc, argv, glob_opts.help))
+              exit(1);
+          break;
+
+      case DUMPRIG:
+	  /* BMR: retire dumprig, have dumpgr do the work */
+          if (FAIL == do_dumprig(curr_arg, argc, argv, glob_opts.help)) 
+/*
+	  fprintf( stderr, ">>> Please make a note that dumprig is no longer available.\n");
+	  fprintf( stderr, "    The command dumpgr is and should be used in its place.\n" );
+          if (FAIL == do_dumpgr(curr_arg, argc, argv, glob_opts.help)) */
+              exit(1);
+          break;
+
+      case DUMPVG:
+          if (FAIL == do_dumpvg(curr_arg, argc, argv, glob_opts.help))
+              exit(1);
+          break;
+
+      case DUMPVD:
+          if (FAIL == do_dumpvd(curr_arg, argc, argv, glob_opts.help))
+              exit(1);
+          break;
+
+      case DUMPGR:
+          if (FAIL == do_dumpgr(curr_arg, argc, argv, glob_opts.help))
+              exit(1);
+          break;
+
+      case HELP:
+      case NONE:
+          usage(argc, argv);
+          break;
+
+      default:
+          printf("Invalid command!, cmd=%d\n", (int) cmd);
+          exit(1);
+          break;
+      }		/* end switch */
+
+    return (0);
+}
+
+/* -----------------------------------------------------------------
+NAME
+   VShdfsize - computes the byte size of the field(s) of a vdata.
+
+DESCRIPTION
+   The size is the byte size of the fields of a vdata in a hdf file.
+   This routine is very similar to the HDF API routine VSsizeof except
+   it uses (struct vdata_desc).wlist.isize to compute the field size
+   instead of (struct vdata_desc).wlist.esize as VSsizeof.
+
+RETURNS
+   The byte size of the field(s), positive integer, on success; 
+   otherwise, returns FAIL.
+----------------------------------------------------------------- */
+int32 
+VShdfsize(int32 vkey,   /* IN vdata key */
+         char *fields  /* IN: Name(s) of the fields to check size of */ )
+{
+    int32       totalsize;
+    int32       i, j;
+    int32       found;
+    int32       ac;
+    char        **av = NULL;
+    vsinstance_t *w  = NULL;
+    VDATA        *vs = NULL;
+    int32        ret_value = SUCCEED;
+    CONSTR(FUNC, "VShdfsize");
+
+    /* check key is valid vdata */
+    if (HAatom_group(vkey)!=VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get vdata instance */
+    if (NULL == (w = (vsinstance_t *) HAatom_object(vkey)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+
+    /* get vdata itself and check it */
+    vs = w->vs;
+    if (vs == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    totalsize = 0;
+    if (fields == NULL) /* default case? */
+      {   /* count all field sizes in vdata */
+        for (j = 0; j < vs->wlist.n; j++)	
+            totalsize += vs->wlist.isize[j];
+      }		
+    else if (fields[0] != '\0')  /* implies: return 0 for empty 'fields' */
+      {  /* parse field string */
+        if ((scanattrs(fields, &ac, &av) < 0) || (ac < 1))
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+
+        for (i = 0; i < ac; i++)
+          {   /* check fields in vs */
+            for (found = 0, j = 0; j < vs->wlist.n; j++)	
+                if (!HDstrcmp(av[i], vs->wlist.name[j]))
+                  {
+                    totalsize += vs->wlist.isize[j];
+                    found = 1;
+                    break;
+                  }
+
+            if (!found)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+          }	/* end for */
+      }		/* end else */
+
+    /* return total size of vdata fields specified */
+    ret_value = totalsize;
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}   /* VShdfsize */
+
+
+/* ------------- VSattrhdfsize --------------------------
+NAME
+       VSattrhdfsize -- get hdfsize of a vdata attribute
+USAGE
+      intn VSattrhdfsize(int32 vsid, int32 findex, intn attrindex, int32 *size);
+      int32 vsid;      IN: vdata id
+      int32 findex;    IN: field index. _HDF_VDATA (-1) for the vdata
+      intn attrindex;  IN: which attr of the field/vdata 
+                           attrindex is 0-based
+      int32 *size;     OUT: size of the attr values in hdf files.
+RETURNS
+        Returns SUCCEED when successful, FAIL otherwise.
+DESCRIPTION
+        size can be NULL if which is not interested.
+--------------------------------------------------- */
+intn VSattrhdfsize(int32 vsid, int32 findex, intn attrindex, int32 *size)
+{
+
+     CONSTR(FUNC, "VSattrhdfsize");
+     VDATA *vs, *attr_vs;
+     vs_attr_t *vs_alist;
+     vsinstance_t *vs_inst, *attr_inst;
+     int32 attr_vsid;
+     int32 ret_value = SUCCEED;
+     intn i, nattrs, a_index, found;
+     DYN_VWRITELIST *w;
+
+     HEclear();
+     if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+     /* locate vs' index in vstab */
+     if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if (NULL == (vs = vs_inst->vs))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+     if ((findex >= vs->wlist.n || findex < 0) && (findex != _HDF_VDATA))
+        HGOTO_ERROR(DFE_BADFIELDS, FAIL);
+     nattrs = vs->nattrs;
+     if (attrindex <0 || attrindex >= nattrs)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+     vs_alist = vs->alist;
+     if (nattrs == 0 || vs_alist == NULL)
+          /* no attrs or bad attr list */
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+    found = 0;
+    a_index = -1; 
+    for (i=0; i<nattrs; i++)  {
+        if (vs_alist->findex == findex)  {
+           a_index++; 
+           if (a_index == attrindex) {
+              found = 1;
+              break;
+           }
+        }
+        vs_alist++;
+    }
+    if (!found)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* found. get attr info */
+    if (FAIL == (attr_vsid = VSattach(vs->f, (int32)vs_alist->aref, "r")))
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (NULL == (attr_inst = (vsinstance_t *)HAatom_object(attr_vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (attr_vs = attr_inst->vs) ||
+          HDstrcmp(attr_vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    w = &(attr_vs->wlist);
+    /* this vdata has 1 field */
+    if (w->n != 1 || HDstrcmp(w->name[0], ATTR_FIELD_NAME))
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (size)
+        *size = w->order[0] * (DFKNTsize(w->type[0]));
+    if (FAIL == VSdetach(attr_vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+
+  return ret_value;
+}  /* VSattrhdfsize */
+
+/* ----------   Vattrhdfsize ----------------------
+NAME
+       Vattrhdfsize -- get hdfsize of a vgroup attribute
+USAGE
+        intn Vattrhdfsize(int32 vgid, intn attrindex, int32 *size)
+        int32 vgid;      IN: vgroup id
+        intn attrindex;  IN: which attr's info we want
+                             attrindex is 0-based
+        int32 *size;     OUT: size of the attr values in hdf files.
+
+RETURNS
+        Returns SUCCEED when successful, FAIL otherwise.
+DESCRIPTION
+        size can be NULL if which is not interested.
+--------------------------------------------------- */
+intn Vattrhdfsize(int32 vgid, intn attrindex, int32 *size)
+{
+    CONSTR(FUNC, "Vattrhdfsize");
+    VGROUP *vg;
+    VDATA *vs;
+    DYN_VWRITELIST  *w;
+    vginstance_t *v;
+    vsinstance_t *vs_inst;
+    vg_attr_t *vg_alist=NULL;
+    intn adjusted_index;
+    int32 fid, vsid;
+    int32 ret_value = SUCCEED;
+
+    HEclear();
+    if (HAatom_group(vgid) != VGIDGROUP)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+    /* locate vg's index in vgtab */
+    if (NULL == (v = (vginstance_t *)HAatom_object(vgid)))
+       HGOTO_ERROR(DFE_VTAB, FAIL);
+    vg = v->vg;
+    fid = vg->f;
+    if (vg == NULL)
+       HGOTO_ERROR(DFE_BADPTR, FAIL);
+    if (vg->otag != DFTAG_VG)
+       HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Validate arguments */
+
+    /* Check given index */
+    if (attrindex < 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL); /* invalid attribute index given */
+
+    /* Check attribute list; it's complicated here to work around the old/new-style
+       attribute issue, see headers of Vnattrs2, Vattrinfo2 in src for details */
+    adjusted_index = attrindex;
+    if (adjusted_index < vg->noldattrs) /* index of old-style attribute */
+        vg_alist = vg->old_alist;  /* use old-attr list */
+    else if (adjusted_index >= vg->noldattrs &&
+             adjusted_index < (vg->nattrs+vg->noldattrs))
+                 /* index of new-style attributes */
+    {
+        /* Adjust the index to accommodate for the old-style attributes
+           preceding the new-style attribute list */
+        adjusted_index = adjusted_index - vg->noldattrs;
+        vg_alist = vg->alist;        /* use new-attr list */
+    }
+    else /* not that many attrs */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    if (vg_alist == NULL)
+        /* Bad attr list */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    /* Get access to the vdata storing the attr, and obtain requested info */
+    if ((vsid = VSattach(fid, (int32)vg_alist[attrindex].aref, "r")) == FAIL)
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    if (HAatom_group(vsid) != VSIDGROUP)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    if (NULL == (vs_inst = (vsinstance_t *)HAatom_object(vsid)))
+        HGOTO_ERROR(DFE_NOVS, FAIL);
+    if (NULL == (vs = vs_inst->vs) ||
+          HDstrcmp(vs->vsclass,  _HDF_ATTRIBUTE) != 0)
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+
+    w = &(vs->wlist);
+    /* this vdata has 1 field */
+    if (w->n != 1 || HDstrcmp(w->name[0], ATTR_FIELD_NAME))  
+/*    if (w->n != 1 )   */
+        HGOTO_ERROR(DFE_BADATTR, FAIL);
+    if (size)
+       *size = w->order[0] * (DFKNTsize(w->type[0]));
+    if (FAIL == VSdetach(vsid))
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+done:
+    if (ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;
+}  /* Vattrhdfsize */
diff --git a/mfhdf/dumper/hdp.h b/mfhdf/dumper/hdp.h
new file mode 100644
index 0000000..2b5a3bc
--- /dev/null
+++ b/mfhdf/dumper/hdp.h
@@ -0,0 +1,617 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5706 $";
+#endif
+
+/* $Id: hdp.h 5706 2011-11-01 18:23:02Z bmribler $ */
+
+#ifndef __HDP_H
+#define __HDP_H
+
+#include "hdf.h"
+#include "hfile.h"
+
+/* Global Variables (ick) */
+#ifndef HDP_MASTER
+extern
+#endif							/* !HDP_MASTER */
+intn        vinit_done
+#ifdef HDP_MASTER
+= FALSE							/* indicates Vsets have been init'ed for the current file */
+#endif							/* HDP_MASTER */
+           ;
+
+/* Global Definitions */
+#define MAXCHOICES 50
+#ifndef MAXNAMELEN
+#define MAXNAMELEN 100
+#endif /* !MAXNAMELEN */
+#define MAXCLASSLEN 100
+#define MAXPERLINE 65	/* max # of chars per line in the output */
+#define MAXRANK 100
+#define MAXFNLEN 256
+#define CONDENSE 1
+#define NO_SPECIFIC -1     /* no specific datasets are requested */
+#define	ATTR_INDENT	0	/* # of spaces in front of attribute data */
+#define ATTR_CONT_INDENT  25	/* # of spaces in front of attribute data 
+					on a continuous line */
+#define	DATA_INDENT	16	/* # of spaces in front of dataset data */
+#define DATA_CONT_INDENT  16	/* # of spaces in front of dataset data 
+					on a continuous line */
+
+/* Free a char pointer if it's not NULL, then set it to NULL */
+#define SAFE_FREE(ptr) {	\
+	if (ptr != NULL)	\
+	{ HDfree((VOIDP)ptr);	\
+	  ptr = NULL; }}
+
+/* ERROR_GOTO_n macros are used to facilitate error printing.  Each
+   macro prints the given message to the stderr, then uses the HDF 
+   library macro HGOTO_DONE to set the variable ret_value to FAIL
+   and jump to label "done"
+	ERROR_GOTO_0 is used for fprintf with no parameters.
+	ERROR_GOTO_1 is used for fprintf with 1 parameter.
+	ERROR_GOTO_2 is used for fprintf with 2 parameters.
+	ERROR_GOTO_3 is used for fprintf with 3 parameters.
+	ERROR_GOTO_4 is used for fprintf with 4 parameters.
+	ERROR_GOTO_5 is used for fprintf with 5 parameters.
+	ERROR_GOTO_6 is used for fprintf with 6 parameters.
+*/
+#define ERROR_GOTO_0(txt) { \
+	fprintf(stderr, "\nHDP ERROR>>> %s", txt); \
+	fprintf(stderr, ".\n"); \
+	HGOTO_DONE( FAIL ); }
+#define ERROR_GOTO_1(txt, par1 ) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1 ); \
+	fprintf(stderr, ".\n"); \
+	HGOTO_DONE( FAIL ); }
+#define ERROR_GOTO_2(txt, par1, par2) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2); \
+	fprintf(stderr, ".\n"); \
+	HGOTO_DONE( FAIL ); }
+#define ERROR_GOTO_3(txt, par1, par2, par3) { \
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3); \
+	fprintf(stderr, ".\n"); \
+	HGOTO_DONE( FAIL ); }
+#define ERROR_GOTO_4(txt, par1, par2, par3, par4) { \
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3, par4); \
+	fprintf(stderr, ".\n"); \
+	HGOTO_DONE( FAIL ); }
+#define ERROR_GOTO_5(txt, par1, par2, par3, par4, par5) { \
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3, par4, par5); \
+	fprintf(stderr, ".\n"); \
+	HGOTO_DONE( FAIL ); }
+#define ERROR_GOTO_6(txt, par1, par2, par3, par4, par5, par6) { \
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3, par4, par5, par6); \
+	fprintf(stderr, ".\n"); \
+	HGOTO_DONE( FAIL ); }
+
+/* ERROR_CONT_n macros are used to facilitate error printing.  Each
+   macro prints the given message to the stderr, then "continue"s.
+   Note: at this time, set ret_value to FAIL, but if it turns out
+   that there are cases where ret_value should be SUCCEED, then 
+   add another argument 'ret' (=FAIL/SUCCEED) to set ret_value to
+   appropriate value.
+   Note: having extra \n after Continued. separates the following
+   output from the error messages.
+	ERROR_CONT_0 is used for fprintf with no parameters.
+	ERROR_CONT_1 is used for fprintf with 1 parameter.
+	ERROR_CONT_2 is used for fprintf with 2 parameters.
+	ERROR_CONT_3 is used for fprintf with 3 parameters.
+	ERROR_CONT_4 is used for fprintf with 4 parameters.
+	ERROR_CONT_5 is used for fprintf with 5 parameters.
+	ERROR_CONT_6 is used for fprintf with 6 parameters.
+*/
+#define ERROR_CONT_0(txt) { \
+	fprintf(stderr, "\nHDP ERROR>>> ", txt ); \
+	fprintf(stderr, ".  Continued.\n\n"); \
+	ret_value = FAIL; \
+	continue; }
+#define ERROR_CONT_1(txt, par1 ) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1 ); \
+	fprintf(stderr, ".  Continued.\n\n"); \
+	ret_value = FAIL; \
+	continue; }
+#define ERROR_CONT_2(txt, par1, par2 ) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2); \
+	fprintf(stderr, ".  Continued.\n\n"); \
+	ret_value = FAIL; \
+	continue; }
+#define ERROR_CONT_3(txt, par1, par2, par3 ) { \
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3); \
+	fprintf(stderr, ".  Continued.\n\n"); \
+	ret_value = FAIL; \
+	continue; }
+#define ERROR_CONT_4(txt, par1, par2, par3, par4 ) { \
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3, par4); \
+	fprintf(stderr, ".  Continued.\n\n"); \
+	ret_value = FAIL; \
+	continue; }
+
+/* ERROR_CONT_END is used to facilitate error handling when an error
+   occurs on a vdata.  It prints the provided error message to the
+   stderr, end access to the vdata, then continue */
+#define ERROR_CONT_END(txt, par1, par2, vd_id ) { \
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2 ); \
+	fprintf(stderr, ".  Continued.\n\n"); \
+	ret_value = FAIL; \
+        VSdetach(vd_id); \
+        vd_id = FAIL; /* reset */ \
+	continue; }
+
+/* ERROR_BREAK_n macros are used to facilitate error printing.  Each
+   macro prints the given message to the stderr, then sets the variable
+   ret_value to the given value and "break"s.
+	ERROR_BREAK_0 is used for fprintf with no parameters.
+	ERROR_BREAK_1 is used for fprintf with 1 parameter.
+	ERROR_BREAK_2 is used for fprintf with 2 parameters.
+	ERROR_BREAK_3 is used for fprintf with 3 parameters.
+	ERROR_BREAK_4 is used for fprintf with 4 parameters.
+	ERROR_BREAK_5 is used for fprintf with 5 parameters.
+	ERROR_BREAK_6 is used for fprintf with 6 parameters.
+*/
+#define ERROR_BREAK_0(txt, ret) { \
+	fprintf(stderr, "\nHDP ERROR>>> %s", txt); \
+	fprintf(stderr, ".\n"); \
+	ret_value = ret; \
+	break; }
+#define ERROR_BREAK_1(txt, par1, ret ) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1 ); \
+	fprintf(stderr, ".\n"); \
+	ret_value = ret; \
+	break; }
+#define ERROR_BREAK_2(txt, par1, par2, ret) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2); \
+	fprintf(stderr, ".\n"); \
+	ret_value = ret; \
+	break; }
+#define ERROR_BREAK_3(txt, par1, par2, par3, ret) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3 ); \
+	fprintf(stderr, ".\n"); \
+	ret_value = ret; \
+	break; }
+#define ERROR_BREAK_4(txt, par1, par2, par3, par4, ret) {	\
+	fprintf(stderr, "\nHDP ERROR>>> "); \
+	fprintf(stderr, txt, par1, par2, par3, par4 ); \
+	fprintf(stderr, ".\n"); \
+	ret_value = ret; \
+	break; }
+
+/* ERROR_NOTIFY macros are used to display a failure but does not do 
+   anything else except setting ret_value to FAIL so that the failure
+   can be traced back to the caller.
+*/
+#define ERROR_NOTIFY_2(txt, par1, par2) { \
+	fprintf(stderr, "\nHDP ERROR>>> " ); \
+	fprintf(stderr, txt, par1, par2 ); \
+	fprintf(stderr, ".\n"); \
+	ret_value = FAIL; }
+#define ERROR_NOTIFY_3(txt, par1, par2, par3) { \
+	fprintf(stderr, "\nHDP ERROR>>> " ); \
+	fprintf(stderr, txt, par1, par2, par3 ); \
+	fprintf(stderr, ".\n"); \
+	ret_value = FAIL; }
+
+/* CHECK_POS makes sure that number is > 0 so we are not going to
+   allocate 0 elements.  Macro is used here instead of function call
+   so if we decide to change exit(1) to goto done and return FAIL,
+   it will be possible */
+#define CHECK_POS( number, buf_size_name, func_name ) { \
+     if( number <= 0 ) { \
+        fprintf(stderr, "in %s: Attempting to allocate 0 items using '%s'!\n",\
+		func_name, buf_size_name ); \
+	exit(1); } \
+}
+
+/* CHECK_ALLOC macro validates that 'buffer' has been successfully
+   allocated; if the allocation fails, exit the application after displaying
+   an appropriate message.  Macro is used here to simplify the validation
+   and to facilitate maintenance, i.e., if decide to change from exit(1)
+   to goto "done" and return with FAIL in all allocation failure cases, it
+   will be possible.
+*/
+#define CHECK_ALLOC(buffer, buf_name, func_name ) { \
+      if (buffer == NULL) {\
+         fprintf(stderr,"in %s: space allocation for %s failed.  Terminated!\n",\
+		func_name, buf_name ); \
+         exit(1); }  \
+}
+
+/* Add enum and string for new commands to both of the variables below. */
+/* Preserve the correct/corresponding ordering */
+typedef enum
+  {
+	  HELP, LIST, DUMPSDS, DUMPRIG, DUMPVG, DUMPVD, DUMPGR, NONE
+  }
+command_t;
+#ifndef HDP_MASTER
+extern
+#endif							/* !HDP_MASTER */
+const char *commands[]
+#ifdef HDP_MASTER
+=
+{
+	"help",
+	"list",
+	"dumpsds",
+	"dumprig",
+	"dumpvg",
+	"dumpvd",
+	"dumpgr"
+}
+#endif							/* HDP_MASTER */
+           ;
+
+/* Global options structure */
+typedef struct
+  {
+	  intn        help;			/* Print help on this command */
+  }
+dump_opt_t;
+
+typedef enum
+  {
+	  OTAG, OFILE, OGROUP, ONAME
+  }
+sort_t;							/* The order tag/refs are sorted */
+
+/* 'list' command option structure */
+typedef struct
+  {
+	  sort_t      order;		/* The sort order tag/refs are printed in */
+	  enum
+		{
+			VSHORT, VLONG, VDEBUG
+		}
+	  verbosity;				/* verbosity level of list */
+	  enum
+		{
+			LNONE, LTAGNUM, LTAGNAME, LGROUP
+		}
+	  limit;					/* How to limit tag/refs */
+	  intn        class;		/* Whether to dump class information */
+	  intn        name;			/* Whether to dump name information */
+	  intn        desc;			/* Whether to dump description information */
+	  intn        spec;			/* Whether to dump special element information */
+	  intn        group;		/* Whether to dump group information */
+	  uint16      limit_tag;	/* tag # to limit search to */
+	  char       *limit_name;	/* tag name to limit search to */
+  }
+list_info_t;
+
+/* Which dataset to dump */
+/* BMR: added defined values to fix exclusive problem - 1/23/99 */
+typedef enum
+  {
+	  DALL=0, DINDEX=1, DREFNUM=2, DNAME=4, DCLASS=8, DFIELDS=16 
+  }
+filter_t;
+
+/* What type of information being stored */
+typedef enum
+  {
+	  INVALID=0, IS_INDEX, IS_REFNUM, IS_NAME, IS_CLASS, IS_FIELD
+  }
+info_type_t;
+
+/* Which contents to dump */
+typedef enum
+  {
+	  DVERBOSE, DHEADER, DDATA
+  }
+content_t;
+
+/* What kind of data to dump to file */
+typedef enum
+  {
+	  DASCII, DBINARY
+  }
+file_format_t;
+
+/* BMR: numerical filter structure; used to hold a list of indices or
+   reference numbers and the number of indices or reference numbers
+   given - 1/23/99 */
+typedef struct
+{
+	int32 *num_list;
+	int32 num_items;
+}
+number_filter_t;
+
+/* BMR: character filter structure; used to hold a list of names or class names 
+   and the number of names or class names given - 1/23/99 */
+typedef struct
+{
+	char **str_list;
+	int32 num_items;
+}
+char_filter_t;
+
+typedef struct
+{
+	int index;
+	int refnum;
+	char *name;
+	char *classname;
+	info_type_t type_of_info;
+}
+obj_chosen_t;
+
+/* 'dumpsds' command option structure */
+/* BMR: added fields to hold indices, reference numbers, names, and classes
+   separately - 1/23/99 */
+typedef struct
+{
+   filter_t    filter;		/* which data object to dump */
+   intn      *filter_num;       /* ref #'s or indices to use as filter */
+   char      **filter_str;      /* names or classes to use as filter */
+   number_filter_t by_index;	/* data objects requested by index */
+   number_filter_t by_ref;	/* data objects requested by reference number */
+   char_filter_t by_name;	/* data objects requested by name */
+   char_filter_t by_class;	/* data objects requested by class name */
+   char_filter_t by_field;	/* data objects requested by field - only VD */
+   obj_chosen_t  *all_types;	/* list of all datasets chosen and in the order
+				   specified by the user */
+   int32       num_chosen;	/* number of items specified at command line,
+	which can be different from the number of objects being printed due
+	to multiple objects of the same name or class name (-1==NO_SPECIFIC) */
+   content_t   contents;        /* what contents to dump */
+   intn        keep_order;	/* whether to dump the datasets in the same
+				   order as specified by the user */
+   intn        dump_to_file;	/* whether to dump to a file */
+   file_format_t file_format;	/* Is data written in ASCII or binary */
+   intn	       as_stream;	/* whether carriage return added to output data lines */
+   intn	       clean_output;	/* whether to print space characters as they 
+				   are or to print in \digit format */
+   intn	       firstln_indent;	/* col# where data starts on the first line*/ 
+   intn	       contln_indent;	/* col# where data continues on the next line*/ 
+   char        file_name[MAXFNLEN];/* Name of file to dump into */
+   char        ifile_name[MAXFNLEN];/* Name of input file being processed */
+
+   intn        print_pal;	/* for GR only: TRUE if option -p selected */
+   gr_interlace_t interlace;	/* user's choice of interlace mode to print data in */
+   intn	       no_lattr_data;	/* GR & SD only: TRUE if option -l selected */
+   intn	       no_gattr_data;	/* GR & SD only: TRUE if option -g selected */
+   intn	       file_type;	/* netCDF, HDF, or other, which hdp doesn't process */
+  }
+dump_info_t;
+
+/* Filename list structure */
+typedef struct
+  {
+	  intn        max_files;	/* the number of files in the file list */
+	  intn        curr_file;	/* the current file */
+	  char      **file_arr;		/* pointer to the filename information */
+  }
+filelist_t;
+
+/* Group info structure */
+typedef struct
+  {
+	  intn        max_dds;		/* the number of DDs in the group */
+	  intn        curr_dd;		/* The current DD */
+	  DFdi       *dd_arr;		/* array to hold the DDs in the group */
+  }
+groupinfo_t;
+
+/* DD info structure */
+typedef struct
+  {
+	uint16  tag, ref;	/* tag and ref of object */
+	int32   offset, length;	/* offset and length of object in file */
+	int32   index;		/* index of the object in the file */
+	uintn   is_group:1,	/* flag to indicate item is a group */
+	        is_special:1,	/* flag to indicate item is a special element */
+	        has_label:1,	/* flag to indicate item has a label */
+	        has_desc:1;	/* flag to indicate item has a desc. */
+	intn    no_element;	/* TRUE if group_info is NULL */
+	groupinfo_t     *group_info;/* pointer to group information */
+	sp_info_block_t *spec_info;/* pointer to special element information */
+  }
+objinfo_t;
+#define CHECK_SPECIAL   0x0001	/* Look for spec. elem. when building dd list */
+#define CHECK_GROUP     0x0002	/* Look for groups when building dd list */
+#define CHECK_LABEL     0x0004	/* Look for anno. labels when building dd list */
+#define CHECK_DESC      0x0008	/* Look for anno. desc. when building dd list */
+
+/* DD list structure */
+typedef struct
+  {
+	  intn        max_obj;		/* the number of dds in the obj list */
+	  intn        curr_obj;		/* the current obj */
+	  uint32      options;		/* storage for options used to build the dd list */
+	  objinfo_t **srt_obj_arr;	/* the sorted dd/object information array */
+	  objinfo_t  *raw_obj_arr;	/* the raw dd/object information array */
+  }
+objlist_t;
+
+/* hdp_vd.c */
+
+/* Vdata information: used to hold various information of a vdata to 
+   facilitate parameter passing */
+typedef struct
+  {
+	int32   index;			/* vdata index */
+	int32   nvf;			/* number of records in the vdata */
+	int32   interlace;		/* interlace mode of the vdata */
+	int32   vsize;			/* record size of the vdata */
+	int32   ref;			/* vdata ref# */
+	int32   tag;			/* vdata tag */
+	char    clss[VSNAMELENMAX+1];	/* vdata class */
+	char    name[VSNAMELENMAX+1];	/* vdata name */
+  }
+vd_info_t;
+
+/* hdp_vg.c */
+
+#define NUM_VGS 20;
+
+typedef struct 
+{
+	int32  index;
+	int32  displayed;
+	int32  treedisplayed;   /* BMR: added to do the loop - 01/16/99 */
+	char  *vg_name;		/* vgroup name, variable length - 10/26/06 */
+	int32  n_entries;	/* added for convenience - 10/26/06 */
+	char **children;
+	char **type;
+}
+vg_info_t;
+
+/* hdp.c */
+extern int32 VShdfsize(int32 vkey, char *fields);
+extern intn VSattrhdfsize(int32 vsid, int32 findex, intn attrindex,int32 *size);
+extern intn Vattrhdfsize(int32 vsid, intn attrindex, int32 *size);
+
+/* hdp_list.c */
+/*extern intn print_data_annotations(const char *fname, int32 an_id, ann_type annot_type, uint16 tag, uint16 ref);*/
+extern intn print_all_data_labels(const char *fname, int32 an_id);
+extern intn print_all_data_descs(const char *fname, int32 an_id);
+extern intn do_list(intn curr_arg, intn argc, char *argv[], int help);
+extern intn print_all_file_labels(const char *fname, int32 an_id);
+extern intn print_file_descs(const char *f_name, int32 an_id );
+/*intn print_annots_by_object( const char *fname, int32 an_id, ann_type annot_type, uint16 tag, uint16 ref);
+intn print_annots_in_file( int32 an_id, char* fname, int32 n_annotations, ann_type annot_type );
+*/
+intn print_all_file_descs(const char *fname, list_info_t* list_opts, /* for print_SDattrs */ int32 an_id);
+intn print_data_labels( const char *fname, int32 an_id, uint16 tag, uint16 ref);
+intn print_data_descs( const char *fname, int32 an_id, uint16 tag, uint16 ref);
+
+/* hdp_sds.c */
+void dumpsds_usage(intn argc, char *argv[]);
+intn parse_dumpsds_opts(dump_info_t *dumpsds_opts, intn *curr_arg, intn argc, char *argv[]);
+intn do_dumpsds(intn curr_arg, intn argc, char *argv[], intn help);
+intn dsd(dump_info_t *dumpsds_opts, intn curr_arg, intn argc, char *argv[]);
+int32 sdsdumpfull(int32 sds_id, dump_info_t *dumpsds_opts, int32 rank, int32 dimsizes[], int32 nt, FILE *fp);
+intn printSDS_ASCII(int32 sd_id, dump_info_t *dumpsds_opts, int32 sds_index, FILE *fp);
+intn printSDS_BINARY(int32 sd_id, dump_info_t *dumpsds_opts, int32 sds_index, FILE *fp);
+intn get_SDSindex_list(int32 sd_id, dump_info_t *dumpsds_opts, int32 **sds_chosen, intn *index_error);
+char *comp_method_txt(comp_coder_t comp_type);
+intn option_mask_string(int32 options_mask, char* opt_mask_strg);
+intn print_comp_info(FILE *fp, int32 sds_id, comp_coder_t *comp_type);
+void resetSDS(int32 *sds_id, int32 sds_index, char *curr_file_name);
+
+/* hdp_rig.c */
+extern intn do_dumprig(intn curr_arg, intn argc, char *argv[], intn help);
+
+/* hdp_vg.c */
+extern intn do_dumpvg(intn curr_arg, intn argc, char *argv[], intn help);
+extern intn print_data_annots(int32 file_id, const char *file_name, int32 tag, int32 ref);
+extern intn print_file_annotations( int32 file_id, const char *file_name );
+void print_fields( char *fields, char *field_title, FILE *fp );
+/* hdp_vd.c */
+intn do_dumpvd(intn curr_arg, intn argc, char *argv[], intn help);
+intn parse_dumpvd_opts(dump_info_t * dumpvd_opts, intn *curr_arg, intn argc, char *argv[], char *flds_chosen[MAXCHOICES], int *dumpallfields);
+
+/* hdp_gr.c */
+intn do_dumpgr(intn curr_arg, intn argc, char *argv[], intn help);
+intn parse_dumpgr_opts(dump_info_t *dumpgr_opts, intn *curr_arg, intn argc, char *argv[]);
+
+/* hdp_dump.c */
+extern intn fmtchar(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtuchar8(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtbyte(unsigned char *x, file_format_t ft, FILE * ofp);
+extern intn fmtint(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtshort(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtint8(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtuint8(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtint16(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtuint16(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtint32(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtuint32(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtfloat32(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn fmtfloat64(VOIDP x, file_format_t ft, FILE * ofp);
+extern intn dumpfull(int32 nt, dump_info_t * dump_opts, int32 cnt, VOIDP databuf, FILE * ofp, intn indent, intn cont_indent );
+extern intn dumpclean(int32 nt, dump_info_t * dump_opts, int32 cnt, VOIDP databuf, FILE * ofp );
+extern int32 dumpGR_SDattr(int32 nt, dump_info_t * dump_opts, int32 cnt, VOIDP databuf, FILE * ofp);
+
+/* show.c */
+extern int32 dumpvd(int32 vd, file_format_t ft, int data_only, FILE *fp, 
+                    char separater[2],int32 flds_indices[VSFIELDMAX], 
+                    int dumpallfields);
+extern intn dumpattr(int32 vid, int32 findex, intn isvs, file_format_t ft, FILE *fp);
+
+/* hdp_util.c */
+	/* misc. functions */
+
+void init_dump_opts(dump_info_t *dump_opts);
+void parse_number_opts( char *argv[], int *curr_arg, number_filter_t *filter);
+void parse_string_opts( char *argv[], int *curr_arg, char_filter_t *filter);
+void parse_value_opts( char *argv[], int *curr_arg, dump_info_t **dump_opts,
+                   info_type_t info_type);
+extern char *tagnum_to_name(intn num);
+extern intn tagname_to_num(const char *name);
+extern void sort(int32 *chosen, int32 choices);
+int sort_obj_list_by_tag(const void *, const void *);
+int int32_compare(const void *, const void *);
+
+	/* filename list functions */
+extern filelist_t *make_file_list(intn curr_arg, intn argc, char *argv[]);
+extern char *get_next_file(filelist_t * f_list, intn advance);
+
+	/* memory management functions */
+extern int32* free_num_list(int32 *num_list);
+extern char** free_str_list(char **str_list, int32 num_items);
+extern vg_info_t** free_vginfo_list(vg_info_t** list, int32 num_items);
+extern vg_info_t* free_node_vg_info_t(vg_info_t* aNode);
+void free_obj_chosen_t_list(obj_chosen_t **nodelist, int32 num_items);
+extern void free_file_list(filelist_t * f_list);
+
+	/* group list functions */
+extern groupinfo_t *make_group_list(int32 fid, uint16 tag, uint16 ref);
+extern DFdi *get_next_group(groupinfo_t * g_list, intn advance);
+extern int32 get_group_max(groupinfo_t * g_list);
+extern void free_group_list(groupinfo_t * g_list);
+	/* object list functions */
+extern objlist_t *make_obj_list(int32 fid, uint32 options);
+extern objinfo_t *get_next_obj(objlist_t * o_list, intn advance);
+extern objinfo_t *goto_nth_obj(objlist_t * o_list, intn n);
+extern void reset_obj_list(objlist_t * o_list);
+extern void resetBuff(VOIDP *buf);
+extern void free_obj_list(objlist_t * o_list);
+extern void sort_obj_list(objlist_t * o_list, sort_t sort_type);
+extern intn print_SDattrs( int32 sd_id, FILE *fp, int32 n_file_attrs, dump_info_t *dumpsds_opts );
+extern intn print_SDSattrs( int32 sds_id, int32 nattrs, FILE *fp, dump_info_t *dumpsds_opts);
+
+extern intn print_GRattrs( int32 gr_id, int32 n_file_attrs, FILE *fp, dump_info_t *dumpgr_opts );
+extern intn print_RIattrs( int32 ri_id, intn ri_index, int32 nattrs, FILE *fp, dump_info_t *dumpgr_opts);
+
+extern void alloc_index_list( int32 **index_list, int32 num_chosen );
+
+#define PPSTR( name, str) { \
+   printf( " %s: %s\n", name, str ); }
+#define PPNUM( name, num) { \
+   printf(" %s: %d\n", name, num ); }
+#define PSTR( name, str) { \
+   fprintf(stderr, " %s: %s\n", name, str ); }
+#define PNUM( name, num) { \
+   fprintf(stderr, " %s: %d\n", name, num ); }
+/***************** end remove when done ******************/
+
+#endif /* __HDP_H */
diff --git a/mfhdf/dumper/hdp.mak b/mfhdf/dumper/hdp.mak
new file mode 100644
index 0000000..36e7e56
--- /dev/null
+++ b/mfhdf/dumper/hdp.mak
@@ -0,0 +1,241 @@
+# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+!IF "$(CFG)" == ""
+CFG=Win32 Debug
+!MESSAGE No configuration specified.  Defaulting to Win32 Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line.  For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "hdp.mak" CFG="Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+################################################################################
+# Begin Project
+# PROP Target_Last_Scanned "Win32 Debug"
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "WinRel"
+# PROP BASE Intermediate_Dir "WinRel"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : .\hdp.exe .\hdp.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\xdr" /I "..\libsrc" /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "HDF" /D "NO_SYS_XDR_INC" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /W3 /GX /O2 /I "..\xdr" /I "..\libsrc" /I "..\..\hdf\src" /I\
+ "..\..\hdf\jpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "HDF" /D\
+ "NO_SYS_XDR_INC" /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"hdp.bsc" 
+
+.\hdp.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	.\hdp_sds.obj \
+	.\hdp_list.obj \
+	.\hdp.obj \
+	.\hdp_util.obj \
+	.\hdp_vg.obj \
+	.\show.obj \
+	.\hdp_vd.obj \
+	.\hdp_rig.obj \
+	.\hdp_dump.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"hdp.pdb" /MACHINE:I386\
+ /OUT:$(OUTDIR)/"hdp.exe" 
+
+.\hdp.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "WinDebug"
+# PROP BASE Intermediate_Dir "WinDebug"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : .\hdp.exe .\hdp.bsc
+
+# ADD BASE CPP /nologo /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /W3 /GX /Zi /Od /I "..\xdr" /I "..\libsrc" /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HDF" /D "NO_SYS_XDR_INC" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /W3 /GX /Zi /Od /I "..\xdr" /I "..\libsrc" /I "..\..\hdf\src"\
+ /I "..\..\hdf\jpeg" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "HDF" /D\
+ "NO_SYS_XDR_INC" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"hdp.pdb" /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"hdp.bsc" 
+
+.\hdp.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	.\hdp_sds.obj \
+	.\hdp_list.obj \
+	.\hdp.obj \
+	.\hdp_util.obj \
+	.\hdp_vg.obj \
+	.\show.obj \
+	.\hdp_vd.obj \
+	.\hdp_rig.obj \
+	.\hdp_dump.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"hdp.pdb" /DEBUG\
+ /MACHINE:I386 /OUT:$(OUTDIR)/"hdp.exe" 
+
+.\hdp.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Group "Source Files"
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp_sds.c
+
+.\hdp_sds.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp_list.c
+
+.\hdp_list.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp.c
+
+.\hdp.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp_util.c
+
+.\hdp_util.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp_vg.c
+
+.\hdp_vg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\show.c
+
+.\show.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp_vd.c
+
+.\hdp_vd.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp_rig.c
+
+.\hdp_rig.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\hdp_dump.c
+
+.\hdp_dump.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################
diff --git a/mfhdf/dumper/hdp.txt b/mfhdf/dumper/hdp.txt
new file mode 100644
index 0000000..0109530
--- /dev/null
+++ b/mfhdf/dumper/hdp.txt
@@ -0,0 +1,243 @@
+           hdp -- HDF dumper 
+
+
+NAME
+     hdp - HDF dumper
+
+SYNOPSIS
+     hdp [hdp options] hdp command [command options] <filename list>
+
+DESCRIPTION
+     
+     hdp is a command line utility designed for quick display of 
+     contents and data of HDF3.3 objects. It can list the contents 
+     of hdf files at various levels with different details. It can 
+     also dump the data of one or more specific objects in the file. 
+
+
+HDP OPTIONS
+
+    Currently, there is only one option.
+
+    -H  Display usage information about the specified command.
+        If no command is specified, -H lists all available commands.
+
+
+HDP COMMANDS
+
+     hdp currently has two types of commands: list and dump. Other 
+     types of commands such as those for editing may be added in the
+     future.
+     
+     hdp list <filename list>
+         lists contents of files in <filename list> 
+
+     hdp dumpsds <filename list>
+         displays data of NDGs and SDGs in the listed files.
+
+     hdp dumpvd <filename list>
+         displays data of vdatas in the listed files.
+   
+     hdp dumpvg <filename list>
+         displays data of objects in vgroups in the listed files.
+
+     hdp dumprig <filename list>
+         displays data of RIGs in the listed files.
+
+     hdp dumpgr <filename list>
+         displays data of general RIGs in the listed files.
+
+HDP COMMAND OPTIONS
+
+(Note: options preceeded by an * have not yet been implemented.)
+
+
+     hdp list [format options] [content ops] [filter ops] [order ops] 
+	      <filename list>
+     --------------------------------------------------------------------------
+
+      Format options
+          decide how the info of objects will be presented on the screen.
+       
+        -s  (short format) under each tag #, all ref's of that tag are listed
+            in one or more lines, same as the output of hdfls. (default)
+
+        -l  (long format) one object per line. Each line contains tag-name, 
+            tag/ref and the index of this tag in the file.(e.g., the ith NDG 
+	    in the file).
+
+        -d  debug format, one object per line. Each line contains tag_name,
+            tag/ref, index, offset, and length, same as the output of hdfls -d.
+
+	no	tagname	   tag	  ref	index/tag	offset	length
+        --      -------    ---    ---   ---------       ------  ------
+
+	1	DFTAG_NT   106      2      1          
+        2       DFTAG_SD   701      3      1
+        ...
+
+
+         Content options
+              allow contents be displayed.
+  
+            -n  display the name or label of the object, if there is any.
+                -n puts you in -l format automatically.
+
+            -c  display the class of the object, if there is any. -l format.
+
+            -a  display description of the object, if there is any. -l format.
+
+         Filter options
+              select certain type of objects to display, default is all.
+
+            -g  display groups only. Objects which do not belong to 
+                any group will not be displayed. Nested groups will be
+                displayed in tree format.
+
+            -t <number>  display objects with specified tag number . e.g. 
+                         720 for NDG.
+            -t <name>    display objects with specified tag name.
+
+         Order options
+              sort the output list in different orders.
+ 
+            -ot  by tag # (default)
+            -of  by the order in file DDlist.
+            -og  by group
+            -on  by name(label)
+
+    hdp dumpsds [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which SDS to dump.
+
+             -i <index>   dump SDS's with indices specified in <index>; indices
+			  correspond to the order of the SDS in the file
+             -r <ref>     dump SDS's with reference numbers specified in <ref>
+             -n <name>    dump SDS's with names specified in <name>
+             -a           dump all SDS's in the file. (default)
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only, no tag/ref 
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+           * -b         binary file
+             -t         ascii text file (default)
+
+          Note: any combination of an option from each of the three categories
+		can be used; but no more than one option from one category is 
+		allowed.
+
+    hdp dumpvd [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which vdata to dump.
+
+             -i <index>   dump vdatas with indices in <index>; indices 
+			  correspond to the order of the vdatas in the 
+			  files
+             -r <ref>     dump vdatas with reference numbers specified in
+			  <ref>
+             -n <name>    dump vdatas with names specified in <name>
+             -c <class>   dump vdatas with classes specified in <class>
+             -a           dump all vdatas in the file. (default)
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only, no tag/ref
+             -f <fields> dump data of specified fields
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+           * -b         binary file
+             -t         text ascii file (default)
+
+    hdp dumpvg [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which vgroups to dump.
+
+             -i <index>   dump vgroups with indices specified in <index>; 
+			  indices correspond to the order of the vgroups 
+			  specified in the files
+             -r <ref>     dump vgroups with reference numbers specified in <ref>
+             -n <name>    dump vgroups with names specified in <name>
+             -c <class>   dump vgroups with classes specified in <class>
+             -a           dump all vgroups in the file. (default)
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+           * -b         binary file
+             -t         text ascii file (default)
+
+    Note: Unless the "-d" option is specified, a graphical representation of
+	  the file will be given after the data has been displayed. 
+
+    hdp dumprig [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which RIG to dump.
+
+             -i <index>   dump RIGs with indices specified in <index>; 
+			  indices correspond to the order of the RIGs 
+			  specified in the files
+             -r <ref>     dump RIGs with reference numbers specified in <ref>
+             -a           dump all RIGs in the file. (default)
+             -m  8|24     dump the RIGs of 8-bit or 24-bit. By default all
+                             RIGs in the file will be dumped
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+             -b         binary file
+             -t         text ascii file (default)
+
+    hdp dumpgr [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which general RIGs to dump.
+
+             -i <index>   dump general RIG's with indices specified in 
+                          <index>; indices correspond to the order of 
+                          the RIG in the file
+             -r <ref>     dump general RIG's with reference numbers 
+                          specified in <ref>
+             -n <name>    dump general RIG's with names specified in <name>
+             -a           dump all general RIG's in the file. (default)
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only, no tag/ref
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+             -b         binary file
+             -t         ascii text file (default)
+
+          Note: any combination of an option from each of the three categories
+                can be used; but no more than one option from one category is
+                allowed.
diff --git a/mfhdf/dumper/hdp_dump.c b/mfhdf/dumper/hdp_dump.c
new file mode 100644
index 0000000..aafe9aa
--- /dev/null
+++ b/mfhdf/dumper/hdp_dump.c
@@ -0,0 +1,579 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "$Revision: 5706 $";
+#endif
+
+/* $Id: hdp_dump.c 5706 2011-11-01 18:23:02Z bmribler $ */
+
+#include <stdio.h>
+#include "mfhdf.h"
+#include "hdp.h"
+#include <ctype.h>
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+
+#define	CARRIAGE_RETURN	13
+#define	LINE_FEED	10
+#define	HORIZONTAL_TAB	9
+
+typedef intn (*fmtfunct_t) (VOIDP, file_format_t, FILE *);
+fmtfunct_t select_func(int32 nt);
+
+/* 
+ * printing functions copied from vshow.c and used by sdsdumpfull(). 
+ *
+ * Please pay attention to the data types used in the print/output routines.
+ * Make sure the data type being dumped matches arguments in 'fwrite()' .etc.
+ *
+ */
+
+intn 
+fmtbyte(unsigned char *x, /* assumption: byte is the same as unsigned char */
+        file_format_t    ff, 
+        FILE          *ofp)
+{
+    unsigned char s;
+
+    if(ff == DASCII)
+      return (fprintf(ofp, "%02x ", (unsigned) *x));
+    else
+      { 
+          s = (unsigned char) *x;
+          return(fwrite(&s, sizeof(unsigned char),1,ofp));
+      }
+}
+
+intn 
+fmtint8(VOIDP       x,  /* assumption: int8 is same as signed char */
+        file_format_t ff, 
+        FILE       *ofp)
+{
+    int8 s;
+
+    if(ff == DASCII)
+        return (fprintf(ofp, "%d", (int) *((signed char *) x)));
+    else
+      {
+          s = (int8) *((signed char *) x);
+          return(fwrite(&s, sizeof(int8), 1, ofp));
+      }
+}
+
+intn 
+fmtuint8(VOIDP       x, /* assumption: uint8 is same as unsigned char */
+         file_format_t ff, 
+         FILE       *ofp)
+{
+    uint8 s;
+
+    if(ff == DASCII)
+        return (fprintf(ofp, "%u", (unsigned) *((unsigned char *) x)));
+    else
+      { 
+          s = (uint8) *((unsigned char *) x);
+          return(fwrite(&s, sizeof(uint8), 1, ofp));
+      } 
+}
+
+intn 
+fmtint16(VOIDP       x, 
+         file_format_t ff, 
+         FILE       *ofp)
+{
+    int16 s;
+
+    HDmemcpy(&s, x, sizeof(int16));
+
+    if(ff == DASCII)
+        return (fprintf(ofp, "%d", (int) s));
+    else
+        return(fwrite(&s, sizeof(int16), 1, ofp));
+}
+
+intn 
+fmtuint16(VOIDP       x, 
+          file_format_t ff, 
+          FILE       *ofp)
+{
+    uint16      s;
+
+    HDmemcpy(&s, x, sizeof(uint16));
+
+    if(ff == DASCII)
+        return (fprintf(ofp, "%u", (unsigned) s));
+    else
+        return(fwrite(&s, sizeof(uint16), 1, ofp));
+}
+
+intn 
+fmtchar(VOIDP       x, 
+        file_format_t ff, 
+        FILE       *ofp)
+{
+   if (isprint(*(unsigned char *) x))
+   {
+      putc(*((char *) x), ofp);
+      return (1);
+   }
+   else
+   {
+      putc('\\', ofp);
+      return (1 + fprintf(ofp, "%03o", *((uchar8 *) x)));
+   }		
+}
+
+intn 
+fmtuchar8(VOIDP       x, /* assumption: uchar8 is same as unsigned char */
+          file_format_t ff, 
+          FILE       *ofp)
+{   
+    uchar8 s;
+
+    if(ff == DASCII) 
+	/* replace %o with %d by Elena's suggestion: it doesn't make
+	   sense to print in octal - BMR 06/23/00 */
+        return (fprintf(ofp, "%d", *((uchar8 *) x)));
+    else
+      { 
+          s = (uchar8) *((unsigned char *)x);
+          return(fwrite(&s, sizeof(uchar8),1, ofp));
+      }
+}
+
+intn 
+fmtint(VOIDP       x, /* assumption: int is same as 'intn' */
+       file_format_t ff, 
+       FILE       *ofp)
+{
+    intn        i;
+
+    HDmemcpy(&i, x, sizeof(intn));
+
+    if(ff == DASCII) 
+        return (fprintf(ofp, "%d", (int) i));
+    else
+        return(fwrite(&i, sizeof(intn), 1, ofp));
+}
+
+#define FLOAT32_EPSILON ((float32)1.0e-20)
+intn 
+fmtfloat32(VOIDP       x, 
+           file_format_t ff, 
+           FILE       *ofp)
+{
+    float32     fdata;
+
+    HDmemcpy(&fdata, x, sizeof(float32));
+
+    if(ff == DASCII)
+      {
+          if (fabs(fdata - FILL_FLOAT) <= FLOAT32_EPSILON)
+              return (fprintf(ofp, "FloatInf"));
+          else
+              return (fprintf(ofp, "%f", fdata));
+      }
+    else
+      {
+          return(fwrite(&fdata, sizeof(float32), 1, ofp));
+      }
+}
+
+intn 
+fmtint32(VOIDP       x, 
+         file_format_t ff, 
+         FILE       *ofp)
+{
+    int32       l;
+
+    HDmemcpy(&l, x, sizeof(int32));
+
+    if(ff == DASCII)
+        return (fprintf(ofp, "%ld", (long) l));
+    else
+        return(fwrite(&l, sizeof(int32), 1, ofp));
+}
+
+intn 
+fmtuint32(VOIDP       x, 
+          file_format_t ff, 
+          FILE       *ofp)
+{
+    uint32      l;
+
+    HDmemcpy(&l, x, sizeof(uint32));
+
+    if(ff == DASCII)
+        return (fprintf(ofp, "%lu", (unsigned long) l));
+    else
+        return(fwrite(&l, sizeof(uint32), 1, ofp));
+}
+
+intn 
+fmtshort(VOIDP       x, 
+         file_format_t ff, 
+         FILE       *ofp)
+{
+    short s;
+
+    HDmemcpy(&s, x, sizeof(short));
+
+    if(ff == DASCII)
+        return (fprintf(ofp, "%d", (int) s));
+    else
+        return(fwrite(&s, sizeof(short), 1, ofp));
+}
+
+#define FLOAT64_EPSILON ((float64)1.0e-20)
+intn 
+fmtfloat64(VOIDP       x, 
+           file_format_t ff, 
+           FILE       *ofp)
+{
+    float64     d;
+
+    HDmemcpy(&d, x, sizeof(float64));
+
+    if(ff == DASCII)
+      {
+          if (fabs(d - FILL_DOUBLE) <= FLOAT64_EPSILON)
+              return (fprintf(ofp, "DoubleInf"));
+          else
+             return (fprintf(ofp, "%f", d));
+      }
+    else
+      {
+          return(fwrite(&d, sizeof(float64), 1, ofp));
+      }
+}
+
+fmtfunct_t select_func(
+		int32 nt)
+{
+   switch (nt & 0xff )
+   {
+      case DFNT_CHAR:
+          return( fmtchar );
+          break;
+      case DFNT_UCHAR:
+          return( fmtuchar8 );
+          break;
+      case DFNT_UINT8:
+          return( fmtuint8 );
+          break;
+      case DFNT_INT8:
+          return( fmtint8 );
+          break;
+      case DFNT_UINT16:
+          return( fmtuint16 );
+          break;
+      case DFNT_INT16:
+          return( fmtint16 );
+          break;
+      case DFNT_UINT32:
+          return( fmtuint32 );
+          break;
+      case DFNT_INT32:
+          return( fmtint32 );
+          break;
+      case DFNT_FLOAT32:
+          return( fmtfloat32 );
+          break;
+      case DFNT_FLOAT64:
+          return( fmtfloat64 );
+          break;
+      default:
+          fprintf(stderr, "HDP does not support type [%d].  Use signed character printing function.\n", (int) nt);
+	  return( fmtchar );
+   }		/* end switch */
+}  /* select_func */
+
+intn 
+dumpfull(int32       nt, 
+	 dump_info_t* dump_opts,
+         int32       cnt,     /* number of items in 'databuf' ? */
+         VOIDP       databuf, 
+         FILE       *ofp,
+	 intn	indent,		/* indentation on the first line */
+	 intn	cont_indent )	/* indentation on the continuous lines */
+{
+   intn    i;
+   VOIDP   bufptr = NULL;
+   fmtfunct_t fmtfunct = NULL;
+   int32   off;
+   intn    cn;
+   file_format_t ff = dump_opts->file_format;
+   intn    ret_value = SUCCEED;
+
+   /* check inputs */
+   if( NULL == databuf )
+      ERROR_GOTO_1( "in %s: Data buffer to be dumped is NULL", "dumpfull" );
+   if( NULL == ofp )
+      ERROR_GOTO_1( "in %s: Output file pointer is NULL", "dumpfull" );
+    
+   /* select the appropriate function to print data elements depending
+      on the data number type */
+   fmtfunct = select_func( nt );
+
+   /* assign to variables used in loop below (?)*/
+   bufptr = databuf;
+   off = DFKNTsize(nt | DFNT_NATIVE); /* what is offset for data type */
+   if (off == FAIL)
+      ERROR_GOTO_2("in %s: Failed to find native size of type [%d]", 
+			"dumpfull", (int)nt );
+
+   cn = cont_indent; /* current column number, cont_indent because that's
+			where the data actually starts */
+
+   /* check if we're dumping data in ASCII or Binary mode. */
+   if(ff == DASCII)
+   {
+      /* print spaces in front of data on the first line */
+      for (i = 0; i < indent; i++)
+	 putc(' ', ofp);
+
+      if (nt != DFNT_CHAR)
+      {
+         for (i = 0; i < cnt && bufptr != NULL; i++)
+         {
+            cn += fmtfunct(bufptr, ff, ofp); /* dump item to file */
+            bufptr = (char *) bufptr + off;
+            putc(' ', ofp);
+            cn++;
+
+            /* temporary fix bad alignment algo in dumpfull by
+               adding i < cnt-1 to remove extra line - BMR 4/10/99 */
+	    if( !dump_opts->as_stream ) /* add \n after MAXPERLINE chars */
+               if (cn > MAXPERLINE && i < cnt-1 )
+               {
+                  putc('\n', ofp);
+
+		  /* print spaces in front of data on the continuous line */
+                  for (cn = 0; cn < cont_indent; cn++)
+                      putc(' ', ofp);
+               }	/* end if */
+         }	 /* end for every item in buffer */
+      }		
+      else /* DFNT_CHAR */
+      {
+         for (i = 0; i < cnt && bufptr != NULL; i++)
+         {
+            cn += fmtfunct(bufptr, ff, ofp); /* dump item to file */
+            bufptr = (char *) bufptr + off;
+	    if( !dump_opts->as_stream ) /* add \n after MAXPERLINE chars */
+               if (cn > MAXPERLINE )
+               {
+                  putc('\n', ofp);
+
+		  /* print spaces in front of data on the continuous line */
+                  for (cn = 0; cn < cont_indent; cn++)
+                      putc(' ', ofp);
+               }		/* end if */
+         }	/* end for every item in buffer */
+      }		/* end else DFNT_CHAR */
+
+      putc('\n', ofp); /* newline after a dataset or attribute */
+
+   } /* end DASCII  */
+   else /*  Binary   */
+   {
+      for (i = 0; i < cnt && bufptr != NULL; i++)
+      {
+         cn += fmtfunct(bufptr, ff, ofp); /* dump item to file */
+         bufptr = (char *) bufptr + off; /* increment by offset? */
+         /* cn++; I don't see any reason of this increment being here 9/4/00*/
+      } /* end for all items in buffer */
+   }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* dumpfull */
+
+intn 
+dumpclean(int32       nt, 
+	 dump_info_t* dump_opts,
+         int32       cnt,     /* number of items in 'databuf' ? */
+         VOIDP       databuf, 
+         FILE       *ofp)
+{
+   intn    i;
+   VOIDP   bufptr = NULL;
+   int32   off;
+   intn    cn;		/* # of characters being printed on a line */
+   intn small_attr = TRUE;    /* data buffer of the attribute is small */
+   intn    is_null;	/* TRUE if current character is a null  */
+   char* tempptr;	/* used in finding CR or LF in data buffer */
+   intn    ret_value = SUCCEED;
+
+   /* check inputs */
+   if( NULL == databuf )
+      ERROR_GOTO_1( "in %s: Data buffer to be dumped is NULL", "dumpclean" );
+   if( NULL == ofp )
+      ERROR_GOTO_1( "in %s: Output file pointer is NULL", "dumpclean" );
+    
+   /* assign to variables used in loop below (?)*/
+   bufptr = databuf;
+   off = DFKNTsize(nt | DFNT_NATIVE); /* what is offset for data type */
+   if (off == FAIL)
+      ERROR_GOTO_2("in %s: Failed to find native size of type [%d]", 
+			"dumpclean", (int)nt );
+
+   /* set char counter to the col. #, where the first attr value will be
+      printed in the case it is printed on the same line with "Value =" */
+   cn = ATTR_CONT_INDENT;  /* this is the default */
+
+   is_null = FALSE; /* no null character is reached yet */
+
+   /***********************************************************************
+    * Requirement for printing attribute data (BMR - Oct 5, 2000):
+    * if the attribute is large, print all data at the left most column; 
+    * otherwise (small attribute), print the first line of the data 
+    * next to the title, i.e. "Value = ", and indent the succeeding lines 
+    * ATTR_CONT_INDENT spaces.
+    * Large attribute: buffer size is >= MAXPERLINE and the buffer 
+    * contains at least one \n (LF) or \r (CR).
+    * Small attribute: buffer size is < MAXPERLINE or the buffer doesn't
+    * contain any \n (LF) or \r (CR) among the data. 
+    ***********************************************************************/
+
+   /* Setting variables to prepare for the printing */
+
+   /* check the size of the buffer first, if it's shorter than MAXPERLINE
+      then set flag small_attr.  If the buffer size is larger, then 
+      proceed to the next segment which determines whether the attribute
+      is small or large using the space char. criteria. */
+
+   if( cnt < MAXPERLINE )
+      small_attr = TRUE;
+
+   /* if the buffer contains at least one \n (LF) or \r (CR), reset
+      flag small_attr to indicate the attribute is considred large. */
+   else /* space char. criteria */
+   {
+      tempptr = strchr( (char *) bufptr, '\n'); /* find the first linefeed */
+      if( tempptr != NULL) /* if an LF is found within the data buffer */
+      {
+         putc('\n', ofp); /* start first line of data on the next line */
+         small_attr = FALSE; /* indicate data buffer contains CRs or LFs */
+      }
+      else    /* no LF, maybe CR is there */
+      {
+         tempptr = strchr( (char *) bufptr, '\r');
+         if( tempptr != NULL) /* if a CR is found within the data buffer */
+         {
+            putc('\n', ofp); /* start first line of data on the next line */
+            small_attr = FALSE; /* indicate data buffer contains CRs or LFs */
+         }
+      }
+   }  /* space char. criteria */
+
+   /* for each character in the buffer, print it accordingly */
+   for (i = 0; i < cnt; i++)
+   {
+      /* if number of characters printed on the current line reaches
+         the max defined and the data buffer doesn't contain any LF or
+         CR, print a new line and indent appropriately.
+	 Note: this statement is at the top here is to prevent the
+	 extra line and indentation when the last line of the attribute
+	 data just reached MAXPERLINE */
+      if (cn >= MAXPERLINE && small_attr )
+      {
+         putc('\n', ofp);
+         for (cn = 0; cn < ATTR_CONT_INDENT; cn++)
+            putc(' ', ofp);
+      }	/* end if */
+
+      /* if the current character is printable */
+      if (isprint(*(unsigned char *) bufptr))
+      {
+	 /* if there has been null characters before this non-null char,
+	    print "..." */
+	 if( is_null )
+	 {
+            cn = cn + fprintf( ofp, " ... " );
+	    is_null = FALSE; /* reset flag */
+	 }
+
+	 /* then print the current non-null character */
+         putc(*((char *) bufptr), ofp);
+         cn++;  /* increment character count */
+      }
+
+      /* when a \0 is reached, do not print it, set flag for its existence,
+	 so when a non-null char is reached, "..." can be printed */
+      else if( *(unsigned char *) bufptr == '\0')
+         is_null = TRUE;
+
+      /* when a space character, such as LF, CR, or tab, is reached, print
+         it and increment the character counter accordingly */
+      else if( isspace(*(unsigned char *) bufptr))
+      {
+         /* when either LF or CR exists in the data buffer, character
+            counter, cn, is no longer needed since we don't need to keep
+            track of the number of chars being printed on a line anymore.
+            Yet, for logical purpose, reset it here just as a new line 
+	    of data starts */
+         if( *(unsigned char *) bufptr == CARRIAGE_RETURN 
+            || *(unsigned char *) bufptr == LINE_FEED )
+	 {
+            putc('\n', ofp); /* print \n for both CR and LF, otherwise, CR=^M*/
+            cn = 0;  /* indicating that next data element will be printed
+			   at column 1 */
+	 }
+         else if( *(unsigned char *) bufptr == HORIZONTAL_TAB )
+         {
+            putc(*((char *) bufptr), ofp);
+            cn = cn + 8;   /* compensate for the tab, at most 8 chars */
+         }
+
+         /* keep this else here to take care of other isspace cases, fill in
+	    more cases as need; if all cases are taken care of, remove else */
+         else
+         {
+            putc('\\', ofp);
+            cn = cn + fprintf(ofp, "%03o", *((uchar8 *) bufptr));
+         }		
+      }
+      else
+      {
+/* this should be printed as binary intstead of \digits */
+         putc('\\', ofp);
+         cn = cn + fprintf(ofp, "%03o", *((uchar8 *) bufptr));
+      }		
+
+      /* advance the buffer pointer */
+      bufptr = (char *) bufptr + off;
+
+       /* Move here to avoid internal compiler error on Cray J90 -QAK */
+       if(bufptr==NULL)
+           break;
+   }	/* end for every item in buffer */
+
+   putc('\n', ofp); /* newline */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* dumpclean */
+
diff --git a/mfhdf/dumper/hdp_gr.c b/mfhdf/dumper/hdp_gr.c
new file mode 100644
index 0000000..c56052d
--- /dev/null
+++ b/mfhdf/dumper/hdp_gr.c
@@ -0,0 +1,1387 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)Revision";
+#endif
+
+/* $Id: hdp_gr.c 5831 2012-07-20 07:03:42Z bmribler $ */
+
+#include <stdio.h>
+#include "mfhdf.h"
+#include "mfgr.h"
+#include "hdp.h"
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+
+#define  N_ENTRIES      256     /* number of elements of each color */
+
+void dumpgr_usage(intn  argc, char *argv[]);
+int32 get_RIindex_list(int32 gr_id, dump_info_t *dumpgr_opts, 
+			int32 **gr_chosen, intn *index_error);
+intn print_PaletteInfo(int32 ri_id, int32 num_pals, FILE *fp);
+intn print_Palette(int32 ri_id, int32 num_pals, FILE *fp, dump_info_t *dumpgr_opts);
+intn printGR_ASCII(int32 gr_id, dump_info_t *dumpgr_opts, int32 ndsets,
+	int32 *gr_chosen, int32 num_ri_chosen, FILE *fp);
+intn printGR_BINARY(int32 gr_id, dump_info_t *dumpgr_opts, int32 num_ri_chosen,
+		int32 ndsets, int32 *gr_chosen, FILE *fp);
+const char* Il_mode_text(gr_interlace_t interlace_mode);
+intn grdumpfull(int32 ri_id, dump_info_t *dumpgr_opts, int32 ncomps,
+           int32 dimsizes[], int32 nt, FILE *fp);
+void closeGR(int32 *file_id, int32 *gr_id, int32 **gr_chosen);
+intn dgr(dump_info_t *dumpgr_opts, intn curr_arg, intn argc, char *argv[]);
+
+void dumpgr_usage(intn  argc, char *argv[])
+{
+    printf("Usage:\n");
+    printf("%s dumpgr [-a|-i <indices>|-r <refs>|-n <names>] [-m <interlace>] [-dhvcs] [-p|-pd] [-o <filename>] [-bx] <filelist>\n", argv[0]);
+    printf("\t-a\tDump all RIs in the file (default)\n");
+    printf("\t-i <indices>\tDump the <indices>th RIs in the file \n");
+    printf("\t-r <refs>\tDump the RIs with reference number <refs>\n");
+    printf("\t-n <names>\tDump the RIs with name <names>\n");
+    printf("\t-m <interlace>\tDump data in interlace mode <interlace= 0, 1, or 2>\n");
+    printf("\t-d\tDump data only, no tag/ref, formatted to input to hp2hdf\n");
+    printf("\t-h\tDump header only, no data - exclusive with -p and -pd\n");
+    printf("\t-v\tDump everything including all annotations (default)\n");
+    printf("\t-c\tPrint space characters as they are, not \\digit\n");
+    printf("\t-g\tDo not print data of file (global) attributes\n"); 
+    printf("\t-l\tDo not print data of local attributes\n"); 
+    printf("\t-s\tDo not add carriage return to a long line - dump it as a stream\n");
+    printf("\t-p\tDump palette's information and data - exclusive with -h\n");
+    printf("\t-pd\tDump palette's data only - exclusive with -h\n");
+    printf("\t-o <filename>\tOutput to file <filename>\n");
+    printf("\t-b\tBinary format of output\n");
+    printf("\t-x\tAscii text format of output (default)\n");
+    printf("\t<filelist>\tList of hdf file names, separated by spaces\n");
+}       /* end list_usage() */
+intn 
+parse_dumpgr_opts(dump_info_t *dumpgr_opts, 
+                  intn        *curr_arg, 
+                  intn         argc, 
+                  char        *argv[] )
+{
+   gr_interlace_t user_interlace; /* temporary store user's interlace mode */
+   intn ret_value = SUCCEED;
+
+   /* traverse the command and process each option */
+#if defined(WIN386) || defined(DOS386)
+   while ((*curr_arg < argc) && ((argv[*curr_arg][0] == '-') ||
+				 (argv[*curr_arg][0] == '/')))
+#else
+   while ((*curr_arg < argc) && (argv[*curr_arg][0] == '-'))
+#endif /* for the use of / as option on PC */
+   {
+      switch (argv[*curr_arg][1])
+      {
+         case 'a':	/* dump all, default */
+             dumpgr_opts->filter = DALL;
+
+             /* indicate that no specific images requested, will dump all */
+             dumpgr_opts->num_chosen = NO_SPECIFIC;
+             (*curr_arg)++;
+             break;
+            
+         case 'i':	/* dump by index */
+             dumpgr_opts->filter |= DINDEX;  /* set bit DINDEX */
+             (*curr_arg)++;
+
+             /* parse and store the given indices in structure by_index */
+             parse_number_opts( argv, curr_arg, &dumpgr_opts->by_index);
+             (*curr_arg)++;
+             break;
+
+         case 'r':	/* dump by reference */
+             dumpgr_opts->filter |= DREFNUM; /* set bit DREFNUM */
+             (*curr_arg)++;
+
+             /* parse and store the given ref numbers in structure by_ref */
+             parse_number_opts( argv, curr_arg, &dumpgr_opts->by_ref);
+             (*curr_arg)++;
+             break;
+
+         case 'n':	/* dump by names */
+             dumpgr_opts->filter |= DNAME;   /* set bit DNAME */
+             (*curr_arg)++;
+
+             /* parse and store the given names in structure by_name */
+             parse_string_opts( argv, curr_arg, &dumpgr_opts->by_name);
+             (*curr_arg)++;
+             break;
+
+         case 'm':	/* dump data in different interlace than at creation */
+             (*curr_arg)++;  /* move forward to interlace option input */
+             user_interlace = atoi( argv[*curr_arg] );
+	     if( user_interlace == MFGR_INTERLACE_PIXEL || 
+		 user_interlace == MFGR_INTERLACE_LINE || 
+		 user_interlace == MFGR_INTERLACE_COMPONENT )
+		dumpgr_opts->interlace = user_interlace; /* store interlace */
+	     else
+	     {
+                printf("Invalid input for interlace option %s\n", argv[*curr_arg]);
+		HGOTO_DONE( FAIL );
+	     }
+             (*curr_arg)++;  /* move forward to next option */
+             break;
+
+         case 'd':	/* dump data only */
+             dumpgr_opts->contents = DDATA;
+             (*curr_arg)++;
+             break;
+
+         case 'h':	/* no annotations nor data */
+	     /* make sure -p is not also given */
+	     if( dumpgr_opts->print_pal )
+		ERROR_GOTO_0( "Option -h must not be used together with either -p or -pd" );
+
+             dumpgr_opts->contents = DHEADER;
+             (*curr_arg)++;
+             break;
+
+         case 'v':	/* dump all info, default */
+             dumpgr_opts->contents = DVERBOSE;
+             (*curr_arg)++;
+             break;
+
+         case 's':      /* do not add carriage returns to output data lines */
+             dumpgr_opts->as_stream = TRUE;
+             (*curr_arg)++;
+             break; 
+
+         case 'c':      /* print space characters as they are, not \\digit */
+             dumpgr_opts->clean_output = TRUE;
+             (*curr_arg)++;
+             break; 
+
+         case 'g':      /* suppress file (global) attr data, print its header */
+                dumpgr_opts->no_gattr_data = TRUE;
+                (*curr_arg)++;
+                break;
+
+         case 'l':      /* suppress local attr data, only print its header */
+                dumpgr_opts->no_lattr_data = TRUE;
+                (*curr_arg)++;
+                break;
+
+         case 'o':   /* specify output file */
+             dumpgr_opts->dump_to_file = TRUE;
+
+             /* Get file name */
+             HDstrcpy(dumpgr_opts->file_name, argv[++(*curr_arg)]);
+
+             (*curr_arg)++;
+             break;
+
+         case 'b':   /* dump data in binary */
+             dumpgr_opts->file_format = DBINARY;
+             (*curr_arg)++;
+             break;
+
+         case 'x':   /* dump data in ascii, also default */
+             dumpgr_opts->file_format = DASCII;
+             (*curr_arg)++;
+             break;
+
+         case 'p':   /* dump palette data */
+	     /* make sure -h is not also given */
+	     if( dumpgr_opts->contents == DHEADER )
+		ERROR_GOTO_0( "Option -h must not be used together with either -p or -pd" );
+
+             dumpgr_opts->print_pal = TRUE;
+
+	     /* if the current option is -pd, then pal data only is requested */
+	     if( argv[*curr_arg][2] == 'd' ) /* \0 if only -p */
+	     {
+		dumpgr_opts->contents = DDATA;
+	     }
+             (*curr_arg)++;
+
+             break;
+
+         default:	/* invalid dumpgr option */
+             printf("HDP ERROR>>> Invalid dumpgr option %s\n", argv[*curr_arg]);
+	     HGOTO_DONE( FAIL );
+         }   /* end switch */
+      }	 /* end while */
+   
+   /* add the number of images requested by index, by ref#, and by name
+      to have a total number of requested images */
+   dumpgr_opts->num_chosen = dumpgr_opts->by_index.num_items +
+                             dumpgr_opts->by_ref.num_items +
+                             dumpgr_opts->by_name.num_items;
+done:
+   if (ret_value == FAIL)
+   { /* Failure cleanup */
+      /* free the lists for given indices, ref#s, and names if
+         they had been allocated */
+      free_num_list(dumpgr_opts->by_index.num_list );
+      free_num_list(dumpgr_opts->by_ref.num_list );
+      free_str_list(dumpgr_opts->by_name.str_list, dumpgr_opts->by_name.num_items);
+   }
+   /* Normal cleanup */
+
+   return ret_value;
+}	/* end parse_dumpgr_opts */
+
+intn grdumpfull(int32        ri_id, 
+           dump_info_t  *dumpgr_opts,
+           int32        ncomps,	/* "ncomps" is the number of components 
+                                   in each element of the data set */
+           int32        dimsizes[], /*  size of dimension "i". */
+           int32        nt, 
+           FILE        *fp)
+{
+   VOIDP  buf = NULL;
+   int32  numtype,
+          eltsz,
+          read_nelts,
+         *start = NULL,  /* starting location to be read */
+         *edge = NULL,   /* # of values to be read in each dim */
+         *stride = NULL; /* # of values to be skipped b/w readings */
+   intn   status, ret_value = SUCCEED;
+
+   /* Compute the number of the bytes for each value. */
+   numtype = nt & DFNT_MASK;
+   eltsz = DFKNTsize(numtype | DFNT_NATIVE)*ncomps;
+    
+   read_nelts = dimsizes[0]*dimsizes[1];
+
+   /* make sure we are not allocating 0 elements, ie. number of 
+      elements is positive */
+   CHECK_POS( read_nelts, "read_nelts", "grdumpfull" );
+   CHECK_POS( eltsz, "eltsz", "grdumpfull" );
+   CHECK_POS( ncomps, "ncomps", "grdumpfull" );
+
+   buf = (VOIDP) HDmalloc(read_nelts * eltsz);
+   CHECK_ALLOC( buf, "buf", "grdumpfull" );
+
+   start = (int32 *) HDmalloc(2 * sizeof(int32));
+   CHECK_ALLOC( start, "start", "grdumpfull" );
+
+   edge = (int32 *) HDmalloc(2 * sizeof(int32));
+   CHECK_ALLOC( edge, "edge", "grdumpfull" );
+
+   stride = (int32 *) HDmalloc(2 * sizeof(int32));
+   CHECK_ALLOC( stride, "stride", "grdumpfull" );
+
+   start[0]=start[1]=0;
+   edge[0]=dimsizes[0];
+   edge[1]=dimsizes[1];
+   stride[0]=1;
+   stride[1]=1;
+ 
+   /* if the user requests that the data is printed in a different 
+      interlace mode from that at the creation of the image, set the 
+      interlace mode of the image to be stored in memory when read */
+   if( dumpgr_opts->interlace != NO_SPECIFIC )
+   {
+      status = GRreqimageil( ri_id, dumpgr_opts->interlace );
+      if( status == FAIL )
+         ERROR_GOTO_2( "in %s: GRreqimageil failed for ri_id(%d)",
+                  "grdumpfull", (int)ri_id );
+   }
+
+   status = GRreadimage(ri_id, start, stride, edge, buf);
+   if ( status == FAIL )
+      ERROR_GOTO_2( "in %s: GRreadimage failed for ri_id(%d)",
+                  "grdumpfull", (int)ri_id );
+
+   /* if printing data only, print with no indentation */
+   if( dumpgr_opts->contents == DDATA )
+      status = dumpfull( nt, dumpgr_opts, read_nelts*ncomps, buf, fp, 0, 0);
+   else 
+      status = dumpfull( nt, dumpgr_opts, read_nelts*ncomps, buf, fp,
+				DATA_INDENT, DATA_CONT_INDENT );
+   if( status == FAIL )
+      ERROR_GOTO_2( "in %s: dumpfull failed for ri_id(%d)",
+                  "grdumpfull", (int)ri_id );
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    if (edge != NULL)
+        HDfree((VOIDP) edge);
+    if (start != NULL)
+        HDfree((VOIDP) start);
+    if (stride != NULL)
+        HDfree((VOIDP) stride);
+    if (buf != NULL)
+        HDfree((VOIDP) buf);
+
+    return ret_value;
+}	/* grdumpfull */
+
+/* compose the list of indices of the requested vgroups although some
+   vgroups are requested by ref# or name.
+   The routine returns:
+        - the number of vgroups to be processed, or
+        - NO_SPECIFIC if all vgroups are to be processed, or
+        - 0 if none.
+   If there are any errors, the parameter index_error will return TRUE */
+int32 get_RIindex_list(
+	int32 gr_id,
+	dump_info_t *dumpgr_opts, 
+	int32 **gr_chosen,/* array of indices of RIs to be processed */
+	intn *index_error )
+{
+   int32    index,         /* index of an image */
+            ri_count = 0;  /* number of RIs to be processed */
+   filter_t filter = dumpgr_opts->filter; /* temporary name */
+   int32    num_ri_chosen = dumpgr_opts->num_chosen;
+   intn     i, 
+            ret_value = 0;
+
+   /* if no specific images are requested, return the image count as 
+      NO_SPECIFIC (-1) to indicate that all images are to be dumped */
+   if( filter == DALL )
+      HGOTO_DONE( NO_SPECIFIC );
+
+   /* if specific images were requested, allocate space for the array 
+      of indices */
+   if (num_ri_chosen > 0)
+      alloc_index_list( gr_chosen, num_ri_chosen );
+
+   /* else, no chosen images but filter is not DALL, it shouldn't be this
+      combination, return image count as NO_SPECIFIC to dumpall */
+   else
+      HGOTO_DONE( NO_SPECIFIC );
+
+   /* if there are some images requested by index, store the indices
+      in the array gr_chosen */
+   if( filter & DINDEX )
+      for (i = 0; i < dumpgr_opts->by_index.num_items; i++)
+      {
+         /* Note: Don't replace this with HDmemcpy unless you change the 
+            sizes of the objects correctly -QAK */
+         (*gr_chosen)[ri_count] = dumpgr_opts->by_index.num_list[i];
+         ri_count++;
+      }
+
+   /* if there are some images requested by ref#, convert the ref#s
+      to indices and store them in the array gr_chosen */
+   if( filter & DREFNUM ) 
+      for (i = 0; i < dumpgr_opts->by_ref.num_items; i++)
+      {
+         index = GRreftoindex(gr_id, (uint16)dumpgr_opts->by_ref.num_list[i]);
+                
+         if (index == FAIL)
+         {
+            printf("Image with reference number %d: not found\n", 
+				(int)dumpgr_opts->by_ref.num_list[i]);
+            *index_error = TRUE;     
+         }
+         else
+         {
+            (*gr_chosen)[ri_count] = index;
+            ri_count++;
+         }
+      }             
+
+   /* if there are some images requested by name, convert the names to
+      indices and store them in the array gr_chosen */
+   if( filter & DNAME )
+      for (i = 0; i < dumpgr_opts->by_name.num_items; i++)
+      {
+         index = GRnametoindex(gr_id, dumpgr_opts->by_name.str_list[i]);
+         if (index == FAIL)
+         {
+            printf("Image with name '%s': not found\n", dumpgr_opts->by_name.str_list[i]);
+            *index_error = TRUE;
+         }
+         else
+         {
+            (*gr_chosen)[ri_count] = index;
+            ri_count++;
+         }
+      }
+
+   ret_value = ri_count;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* end of get_RIindex_list */
+
+/* prints all GR file attributes in the current file */
+intn
+print_GRattrs( 
+	int32 gr_id,
+	int32 n_file_attrs,
+	FILE *fp,
+	dump_info_t *dumpgr_opts )
+{
+   int32 attr_index,
+         attr_count,
+         attr_nt,
+         attr_buf_size;
+   char  attr_name[MAXNAMELEN],
+        *attr_nt_desc = NULL;
+   VOIDP attr_buf = NULL;
+   intn  printed = FALSE;  /* whether file attr title has been printed */
+   intn  status,           /* status from called routine */
+         ret_value = SUCCEED;
+
+   /* for each file attribute, print its info and values */
+   for (attr_index = 0; attr_index < n_file_attrs; attr_index++)
+   {
+      /* get the current attr's name, number type, and number of values */
+      status = GRattrinfo(gr_id, attr_index, attr_name, &attr_nt, &attr_count);
+      if (FAIL == status ) /* to the next attribute */
+         ERROR_CONT_2( "in %s: GRattrinfo failed for %d'th attribute", 
+			"print_GRattrs", (int)attr_index );
+
+      /* get number type description of the attribute */
+      attr_nt_desc = HDgetNTdesc(attr_nt);
+      if (NULL == attr_nt_desc)
+         ERROR_CONT_2( "in %s: HDgetNTdesc failed for %d'th attribute", 
+		"print_GRattr", (int)attr_index );
+
+      /* print a title line for file attributes if it's not printed
+         yet and set flag so it won't be printed again */
+      if( !printed )
+      {
+         fprintf(fp, "\n    File attributes:\n");
+         printed = TRUE;
+      }
+
+      /* display the attribute's information then free buffer */
+      fprintf(fp, "\t Attr%d: Name = %s\n", (int) attr_index, attr_name);
+      fprintf(fp, "\t\t Type = %s \n\t\t Count= %d\n", 
+			attr_nt_desc, (int) attr_count);
+      resetBuff(( VOIDP *) &attr_nt_desc ); 
+
+      /* display the attribute's values unless user chose to suppress them */
+      if( dumpgr_opts->no_gattr_data == FALSE )
+      {
+         /* to be sure that attr_buf is free before reuse since sometimes we
+            have to break the current loop and continue to the next item */
+         resetBuff( &attr_buf );
+
+         /* calculate the buffer size of the attribute using the number of
+            values in the attribute and its value size */
+         attr_buf_size = DFKNTsize(attr_nt) * attr_count;
+
+         /* make sure we are not allocating 0 elements */
+         CHECK_POS( attr_buf_size, "attr_buf_size", "print_GRattrs" );
+
+         /* allocate space for the attribute's values */
+         attr_buf = (VOIDP) HDmalloc(attr_buf_size);
+         CHECK_ALLOC( attr_buf, "attr_buf", "print_GRattrs" );
+
+         /* read the values of the attribute into the buffer */
+         status = GRgetattr( gr_id, attr_index, attr_buf );
+         if (status == FAIL)
+            ERROR_CONT_2( "in %s: GRgetattr failed for %d'th attribute", 
+		"print_GRattr", (int)attr_index );
+
+         /* display the attribute's values */
+         fprintf(fp, "\t\t Value = ");
+
+         /* if the user wishes to have clean output, i.e. option -c is
+            selected - Note that this option is only applicable to DFNT_CHAR
+            type, the option will be ignored for other types */
+         if( dumpgr_opts->clean_output && attr_nt == DFNT_CHAR )
+         {
+            status = dumpclean(attr_nt, dumpgr_opts, attr_count, attr_buf, fp);
+            if( status == FAIL )
+               ERROR_CONT_2( "in %s: dumpclean failed for %d'th attribute",
+                   "print_GRattr", (int)attr_index );
+
+         }
+         else  /* show tab, lf, null char... in octal as \011, \012, \000... */
+         {
+            status = dumpfull(attr_nt, dumpgr_opts, attr_count, attr_buf, fp,
+			ATTR_INDENT, ATTR_CONT_INDENT );
+            if( status == FAIL )
+               ERROR_CONT_2( "in %s: dumpfull failed for %d'th attribute",
+                   "print_GRattr", (int)attr_index );
+         }
+         /* free buffer and reset it to NULL */
+      }  /* end of if no file attributes */
+   } /* for all attributes of GR */
+
+   return ret_value;
+} /* end of print_GRattrs */
+
+intn
+print_RIattrs( 
+	int32 ri_id,
+	intn ri_index,
+	int32 nattrs,
+	FILE *fp,
+	dump_info_t* dumpgr_opts )
+{
+   int32 attr_index,
+         attr_count,
+         attr_nt,
+         attr_buf_size;
+   char  attr_name[MAXNAMELEN],
+        *attr_nt_desc = NULL;
+   VOIDP attr_buf=NULL;
+   intn  status,   /* status returned from a called routine */
+         ret_value = SUCCEED;  /* returned value of print_RIattrs */
+
+   /* for each attribute, display its info and data */
+   for (attr_index = 0; attr_index < nattrs; attr_index++)
+   {
+      /* get the current attr's name, number type, and number of values */
+      status = GRattrinfo(ri_id, attr_index, attr_name, &attr_nt, &attr_count);
+      if (FAIL == status) /* go to next attribute */
+         ERROR_CONT_3( "in %s: GRattrinfo failed for %d'th attribute of %d'th RI", 
+			"print_RIattrs", (int)attr_index, (int)ri_index );
+
+      /* get number type description of the attribute */
+      attr_nt_desc = HDgetNTdesc(attr_nt);
+      if (NULL == attr_nt_desc)  /* go to the next attribute */
+         ERROR_CONT_3( "in %s: HDgetNTdesc failed for %d'th attribute of %d'th RI", 
+			"print_RIattrs", (int)attr_index, (int)ri_index );
+
+      /* display the attribute's information then free buffer */
+      fprintf(fp, "\t Attr%d: Name = %s\n", (int) attr_index, attr_name);
+      fprintf(fp, "\t\t Type = %s \n\t\t Count= %d\n", attr_nt_desc, (int) attr_count);
+
+      /* free buffer and reset it to NULL */
+      resetBuff((VOIDP *) &attr_nt_desc );
+
+      /* display the attribute's values unless user chose to suppress them */
+      if( dumpgr_opts->no_lattr_data == FALSE )
+      {
+         /* to be sure that attr_buf is free before reuse since sometimes we
+            have to break the current loop and continue to the next item */
+         resetBuff( &attr_buf );
+
+         /* calculate the buffer size of the attribute using the number of 
+            values in the attribute and its value size */
+         attr_buf_size = DFKNTsize(attr_nt) * attr_count;
+
+         /* make sure we are not allocating 0 elements */
+         CHECK_POS( attr_buf_size, "attr_buf_size", "print_RIattrs" );
+
+         /* allocate space for attribute's values */
+         attr_buf = (VOIDP) HDmalloc(attr_buf_size);
+         CHECK_ALLOC( attr_buf, "attr_buf", "print_RIattrs" );
+
+         /* read the values of the attribute into buffer attr_buf */
+         status = GRgetattr( ri_id, attr_index, attr_buf );
+         if (status == FAIL)  /* go to the next attribute */
+            ERROR_CONT_3( "in %s: GRgetattr failed for %d'th attribute of %d'th RI", 
+			"print_RIattrs", (int)attr_index, (int)ri_index );
+
+         /* display the attribute's values then free buffer */
+         fprintf(fp, "\t\t Value = ");
+
+         /* if the user wishes to have clean output, i.e. option -c is selected */
+         /* Note that this option is only applicable to DFNT_CHAR type, the
+            option will be ignored for other types */
+         if( dumpgr_opts->clean_output && attr_nt == DFNT_CHAR )
+         {
+            status = dumpclean(attr_nt, dumpgr_opts, attr_count, attr_buf, fp);
+            if( status == FAIL )
+               ERROR_CONT_3( "in %s: dumpclean failed for %d'th attribute of %d'th RI", 
+			"print_RIattrs", (int)attr_index, (int)ri_index );
+         }
+         else  /* show tab, lf, null char... in octal as \011, \012, \000... */
+         {
+            status = dumpfull(attr_nt, dumpgr_opts, attr_count, attr_buf, fp,
+			ATTR_INDENT, ATTR_CONT_INDENT );
+            if( status == FAIL )
+               ERROR_CONT_3( "in %s: dumpfull failed for %d'th attribute of %d'th RI", 
+			"print_RIattrs", (int)attr_index, (int)ri_index );
+         }
+      }  /* end of if no local attributes */
+   } /* for all attributes of an RI */
+
+   return ret_value;
+} /* end of print_RIattrs */
+
+/* Displays the palette information only.  Note that HDF supports only
+   256 colors.  Each color is defined by its 3 components. Therefore,
+   verifying the value of n_entries and n_comps is not necessary and
+   the buffer to hold the palette data can be static.  However,
+   if more values or colors are added to the model, these parameters
+   must be checked to allocate sufficient space when reading a palette
+   and the palette number should be printed */
+intn print_PaletteInfo(
+        int32 ri_id,
+        int32 num_pals, /* number of palettes, currently only 1 */
+        FILE *fp )
+{
+   int32 pal_id = FAIL,
+         pal_index,
+         data_type,
+         n_comps,
+         n_entries,
+         interlace_mode;
+   intn  status, ret_value = SUCCEED;
+
+   /* Check the number of palettes */
+   if((num_pals=GRgetnluts(ri_id))<0)
+         ERROR_GOTO_2( "in %s: GRgetnluts failed for raster image ID #%d",
+                        "print_PaletteInfo", (int)ri_id);
+
+   /* if there are no palette data, print message for both cases:
+      header-only and verbose (data+header) */
+   if(num_pals==0) {
+        fprintf( fp, "\t No palette\n");
+   } /* end if */
+   else {
+      /* display each palette of an RI */
+      for( pal_index = 0; pal_index < num_pals; pal_index++ )
+      {
+          /* Get the identifier of the palette attached to the image. */
+         pal_id = GRgetlutid (ri_id, pal_index);
+         if( pal_id == FAIL ) /* continue to the next palette */
+             ERROR_CONT_2( "in %s: GRgetlutid failed for palette #%d",
+                            "print_PaletteInfo", (int)pal_index);
+
+         /* Obtain and display information about the palette. */
+         status = GRgetlutinfo (pal_id, &n_comps, &data_type, &interlace_mode,
+                                &n_entries);
+         if( status == FAIL ) /* continue to the next palette */
+             ERROR_CONT_2( "in %s: GRgetlutinfo failed for palette #%d",
+                            "print_PaletteInfo", (int)pal_index);
+
+         /* if there are palette data, print header info */
+         fprintf (fp, "\t Palette: %d components; %d entries\n",
+                        (int)n_comps, (int)n_entries);
+
+      } /* end of for each palette */
+   } /* end else */
+
+done:
+   if (ret_value == FAIL)
+   { /* Failure cleanup */
+   }
+   return( ret_value );
+}  /* end of print_PaletteInfo */
+
+/* Displays the palette data.  Note that HDF supports only 256 colors.
+   Each color is defined by its 3 components. Therefore,
+   verifying the value of n_entries and n_comps is not necessary and
+   the buffer to hold the palette data can be static.  However,
+   if more values or colors are added to the model, these parameters
+   must be checked to allocate sufficient space when reading a palette */
+intn print_Palette(
+	int32 ri_id, 
+	int32 num_pals, /* number of palettes, currently only 1 */
+	FILE *fp,
+	dump_info_t *dumpgr_opts )
+{
+   int32 pal_id = FAIL,
+         pal_index,
+         data_type,
+         n_comps,
+         n_entries,
+         interlace_mode;
+   uint8 palette_data[N_ENTRIES][3];  /* static because of fixed size */
+   uint16 ri_ref;
+   intn  status, ret_value = SUCCEED;
+
+   /* Get the ref# of the image, for displaying output */
+   ri_ref = GRidtoref(ri_id);
+
+   /* Check the number of palettes */
+   if((num_pals=GRgetnluts(ri_id))<0)
+         ERROR_GOTO_2( "in %s: GRgetnluts failed for raster image with ref#=%d",
+                        "print_Palette", (int)ri_ref);
+
+   /* if there are no palette data, print message for both cases:
+      header-only and verbose (data+header) */
+   if(num_pals==0) {
+      if( dumpgr_opts->contents != DDATA )
+         fprintf( fp, "\n\t Raster Image Ref. = %d\n\t No palette data\n", 
+			  (int)ri_ref);
+   } /* end if */
+   else {
+      /* display each palette of an RI */
+      for( pal_index = 0; pal_index < num_pals; pal_index++ )
+      {
+         /* Get the identifier of the palette attached to the image. */
+         pal_id = GRgetlutid (ri_id, pal_index);
+         if( pal_id == FAIL ) /* continue to the next palette */
+             ERROR_CONT_2( "in %s: GRgetlutid failed for palette #%d",
+                            "print_Palette", (int)pal_index);
+
+         /* Read the palette data. */
+         status = GRreadlut (pal_id, (VOIDP)palette_data);
+         if( status == FAIL ) { /* continue to the next palette */
+             ERROR_CONT_2( "in %s: GRreadlut failed for palette #%d",
+                            "print_Palette", (int)pal_index); }
+
+         /* Obtain and display information about the palette. */
+         status = GRgetlutinfo (pal_id, &n_comps, &data_type, 
+				&interlace_mode, &n_entries);
+         if( status == FAIL ) /* continue to the next palette */
+             ERROR_CONT_2( "in %s: GRgetlutinfo failed for palette #%d",
+                           "print_Palette", (int)pal_index);
+
+         /* if there are palette data, print header info when not 
+             data-only and print palette data when not header-only */
+	 switch (dumpgr_opts->contents)
+	 {
+	    /* Note that case DHEADER is not presented because option -h
+	       is not allowed with -p or -pd */
+	    case DVERBOSE:
+		 fprintf (fp, "\n\t Raster Image Ref. = %d\n", (int)ri_ref);
+		 fprintf (fp, "\t Palette: %d components; %d entries\n", 
+                         (int)n_comps, (int)n_entries);
+
+		 /* display the palette data with the title line and 
+		    indent the data with DATA_INDENT and DATA_CONT_INDENT */
+		 fprintf (fp, "\t Palette Data: \n");
+		 status = dumpfull(data_type, dumpgr_opts, n_entries*n_comps,
+		    	  palette_data, fp, DATA_INDENT, DATA_CONT_INDENT );
+                 if( status == FAIL )
+                    ERROR_GOTO_2( "in %s: dumpfull failed for palette #%d", 
+			     "print_Palette", (int)pal_index);
+		 break;
+
+	    case DDATA:
+		 /* print palette data with no title and indentation */
+		 status = dumpfull(data_type, dumpgr_opts, 
+			  n_entries*n_comps, palette_data, fp, 0, 0 );
+                 if( status == FAIL )
+                    ERROR_GOTO_2( "in %s: dumpfull failed for palette #%d",
+                         "print_Palette", (int)pal_index );
+		 break;
+	    default:
+		 printf("Unknown output type option \n" );
+	  } /* end switch */
+      } /* end for each palette */
+   } /* end else */
+
+done:
+   if (ret_value == FAIL)
+   { /* Failure cleanup */
+   }
+   /* Normal cleanup */
+   return ret_value;
+}  /* end of print_Palette */
+
+const char* Il_mode_text( gr_interlace_t interlace_mode )
+{
+   switch( interlace_mode )
+   {
+	case MFGR_INTERLACE_PIXEL:
+	   return("PIXEL");
+	case MFGR_INTERLACE_LINE:
+	   return("LINE");
+	case MFGR_INTERLACE_COMPONENT: 
+           return("COMPONENT");
+	default:
+	   return("INVALID");
+   } /* end switch */
+}
+
+
+/*
+ * Prints compression method and compression information of an image.
+ * Once, adding the compression information part, combine this and the SD
+ * version, print_comp_info.
+ * BMR - Jul, 2012
+ */
+intn print_grcomp_info(
+	FILE *fp,
+	int32 ri_id)
+{
+    comp_info c_info;                /* Compression structure */
+    comp_coder_t comp_type = COMP_CODE_NONE;
+    int32 comp_size=0, orig_size=0;  /* compressed and original sizes */
+    intn status = FAIL;	    /* returned status from a called function */
+
+    /* Get compression info */
+    HDmemset(&c_info, 0, sizeof(c_info));
+    status = GRgetcompinfo(ri_id, &comp_type, &c_info);
+
+   /* if getting comp info succeeds, proceed to print out appropriate 
+      compression information */
+   if (status != FAIL)
+   {
+      /* print compression method or "NONE" */
+      fprintf(fp, "\t Compression method = %s\n", comp_method_txt(comp_type));
+
+#if 0 /* need to fix output of tests after 4.2.8 to display comp info */
+      switch (comp_type)
+      {
+        case COMP_CODE_NONE:
+        case COMP_CODE_JPEG:
+        case COMP_CODE_RLE:
+        case COMP_CODE_IMCOMP:
+	    break;
+        case COMP_CODE_SKPHUFF:
+	    fprintf(fp, "\t\t Skipping unit size = %d\n", c_info.skphuff.skp_size);
+	    break;
+	case COMP_CODE_DEFLATE:
+	    fprintf(fp, "\t\t Deflate level = %d\n", c_info.deflate.level);
+	    break;
+	case COMP_CODE_SZIP:
+	{
+	    char mask_strg[160]; /* 160 is to cover all options and number val*/
+	    if (option_mask_string(c_info.szip.options_mask, mask_strg) != FAIL)
+		fprintf(fp, "\t\t Option mask = %s\n", mask_strg);
+	    else
+		fprintf(fp, "\t\t Option mask might be invalid = %d\n", (int)c_info.szip.options_mask);
+	    fprintf(fp, "\t\t Pixels per block = %d\n", (int)c_info.szip.pixels_per_block);
+	    fprintf(fp, "\t\t Pixels per scanline = %d\n", (int)c_info.szip.pixels_per_scanline);
+	    fprintf(fp, "\t\t Bits per pixel = %d\n", (int)c_info.szip.bits_per_pixel);
+	    fprintf(fp, "\t\t Pixels = %d\n", (int)c_info.szip.pixels);
+	    break;
+	}
+        default:
+	    /* nothing */
+	    break;
+      } /* switch */
+#endif
+   }
+   else
+      fprintf(fp, "\t Compression method = <Unable to get compression method>\n");
+
+    return(status);
+} /* print_grcomp_info */
+
+intn printGR_ASCII( 
+	int32 gr_id,
+	dump_info_t *dumpgr_opts,
+	int32 ndsets,        /* number of images in the file */
+	int32 *gr_chosen,    /* list of images' indices */
+	int32 num_ri_chosen, /* number of indices in gr_chosen */
+	FILE *fp )
+{
+   int32 ri_id = FAIL,       /* image id, always reset to FAIL when not used */
+         ri_ref,             /* ref# of an image */
+         ri_index,           /* index of images in the file */
+         ri_count,           /* count of images being printed */
+         nt,                 /* number type of an image */
+         il,                 /* interlace mode of an image */
+         ncomps,             /* number of components in an image */
+         dimsizes[MAXRANK],  /* dimension sizes of an image */
+         nattrs;             /* number of attributes assigned to an image */
+   char  name[MAXNAMELEN],   /* name of an image */
+         curr_file_name[MAXFNLEN], /* current input (hdf) file's name */
+        *nt_desc = NULL;     /* ??? */
+   intn  dumpall = FALSE,    /* TRUE when no specific images requested */
+         status,             /* status returned from a routine */
+         ret_value = SUCCEED;/* returned value of printGR_ASCII */
+
+   /* temp. name for curr input file name for ease of use */
+   HDstrcpy( curr_file_name, dumpgr_opts->ifile_name );
+
+   /* when there are no images specified, dumper dumps all images */
+   if (num_ri_chosen == NO_SPECIFIC)  /* NO_SPECIFIC = -1 */
+      dumpall = TRUE;
+   else
+      sort(gr_chosen, num_ri_chosen); /* otherwise, sort the list */
+
+   /* for each valid index, if the user requests to dump all images or 
+      if there are more requested images to be processed, process the 
+      indexed image */
+   ri_count = 0;    /* no images has been processed yet */
+   for (ri_index = 0; ri_index < ndsets /* validate index */
+        && (dumpall                     /* either all images are dumped */
+        || ri_count < num_ri_chosen);   /* or more requested images */
+        ri_index++)
+   {
+      /* if the user neither requests dump all nor the current image */
+      if ((!dumpall) && (ri_index != gr_chosen[ri_count]))
+         continue; /* go to the next image in the file  */
+
+      ri_count++;  /* count the # of images being processed */
+
+      /* Reset variables. */
+      HDmemset(dimsizes, 0, sizeof(int32) * MAXRANK);
+
+      /* get access to the current image */
+      ri_id = GRselect(gr_id, ri_index);
+      if (ri_id == FAIL) /* to the next image */
+         ERROR_CONT_2( "in %s: GRselect failed for %d'th RI", 
+			"printGR_ASCII", (int)ri_index );
+
+      /* get image's information */
+      status = GRgetiminfo(ri_id, name, &ncomps, &nt, &il, dimsizes, &nattrs);
+      if( FAIL == status )
+      {
+         fprintf(stderr,"in %s: GRgetiminfo failed for %d'th RI",
+			"printGR_ASCII", (int)ri_index );
+
+         /* end access to the current image before going on to the next */
+         if (FAIL == GRendaccess(ri_id))
+            fprintf( stderr,"in %s: GRendaccess failed for %d'th RI",
+			"printGR_ASCII", (int)ri_index );
+
+         ri_id = FAIL;  /* reset image id */
+         continue; /* to the next image */
+      }
+
+      /* print image palette's info and data or data only depending on
+         the content's option (-pd or -p, taken care by print_Palette) */
+      if( dumpgr_opts->print_pal )  /* set when -p or -pd is given */
+      {
+         /* Note: currently only 1 pal assigned to an image, 2nd arg. */
+         status = print_Palette( ri_id, 1, fp, dumpgr_opts );
+	 if( status == FAIL )
+	    ERROR_BREAK_2("in %s: Printing image's palette failed for RI #%d",
+			"printGR_ASCII", (int)ri_index, FAIL );
+      }
+      else /* only happen when neither -p nor -pd were given */
+      {
+
+         /* print the current image as specified by user's options */
+         switch (dumpgr_opts->contents)
+         {
+            case DVERBOSE:
+            case DHEADER:
+               nt_desc = HDgetNTdesc(nt);
+               if (NULL == nt_desc)
+                  ERROR_BREAK_2( "in %s: HDgetNTdesc failed for %d'th RI",
+      			"printGR_ASCII", (int)ri_index, FAIL );
+
+               /* display image's info then free the buffer no longer needed */
+               fprintf(fp, "\n\t Image  Name = %s\n\t Index = ", name);
+               fprintf(fp, "%d\n\t Type= %s\n", (int)ri_index, nt_desc);
+
+               resetBuff(( VOIDP *) &nt_desc ); 
+
+               /* get the image's ref# from its id */
+               if ((ri_ref = GRidtoref(ri_id)) == FAIL)
+                  ERROR_BREAK_2( "in %s: GRidtoref failed for %d'th RI",
+			"printGR_ASCII", (int)ri_index, FAIL );
+
+               /* print more image's info */
+               fprintf(fp, "\t width=%d; height=%d\n", (int) dimsizes[0], (int) dimsizes[1]);
+               fprintf(fp, "\t Ref. = %d\n", (int) ri_ref);
+               fprintf(fp, "\t ncomps = %d\n\t Interlace mode= %s\n",
+			(int) ncomps, Il_mode_text((gr_interlace_t)il) );
+
+	       /* print the palette info now so it won't be lost after the 
+	          image data; currently, only 1 palette per image (2nd arg.) */
+	       status = print_PaletteInfo( ri_id, 1, fp );
+               if( status == FAIL )
+		   ERROR_BREAK_2( "in %s: Printing image's palette information failed for %d'th RI",
+			"printGR_ASCII", (int)ri_index, FAIL );
+
+	       /* Print compression method or "NONE" */
+	       status = print_grcomp_info(fp, ri_id);
+
+               /* Print image attributes */
+               fprintf(fp, "\t Number of attributes = %d\n", (int) nattrs );
+               status = print_RIattrs(ri_id, ri_index, nattrs, fp, dumpgr_opts );
+               if( status == FAIL )
+		   ERROR_BREAK_2( "in %s: Printing image's attributes failed for %d'th RI",
+			"printGR_ASCII", (int)ri_index, FAIL );
+
+               if (dumpgr_opts->contents == DHEADER)
+                  break; /* break out for header only */
+
+            case DDATA:
+               if (dumpgr_opts->contents != DDATA)
+                  fprintf(fp, "\t Data : \n");
+
+               if (ncomps > 0 && dimsizes[0] != 0)
+               {
+                  /* print the current image's data */
+                  status = grdumpfull( ri_id, dumpgr_opts, ncomps, dimsizes, nt, fp);
+                  if ( status == FAIL )
+		     ERROR_BREAK_2( "in %s: Printing image's data failed for %d'th RI",
+			"printGR_ASCII", (int)ri_index, FAIL );
+               }
+               else
+               {
+                  fprintf(fp, "\t\t No data written.\n");
+               }
+               break; /* data section */
+            default:
+               printf("Unknown output type option \n" );
+         } /* switch  on contents */
+      } /* end if when neither -p nor -pd given */
+
+      /* end access to the current image */
+      if (FAIL == GRendaccess(ri_id))    
+         fprintf(stderr,"in %s: GRendaccess failed for %d'th RI",
+			"printGR_ASCII", (int)ri_index );
+      ri_id = FAIL;  /* reset image id */
+   }	/* for ndsets  */
+
+   /* Normal cleanup */
+   resetBuff(( VOIDP *) &nt_desc ); 
+
+   return ret_value; /* status of calls */
+} /* end of printGR_ASCII */
+
+intn printGR_BINARY(
+		int32 gr_id,
+		dump_info_t *dumpgr_opts,
+		int32 num_ri_chosen,     /* # of indices in gr_chosen */
+		int32 ndsets,            /* # of images in the file */
+		int32 *gr_chosen,        /* list of images' indices */
+		FILE *fp )
+{
+   intn  dumpall = FALSE;    /* TRUE when no specific images requested */
+   int32 ri_index,           /* index of images in the file */
+         ri_count,           /* count of images being printed */
+         nt,                 /* number type of an image */
+         il,                 /* interlace mode of an image */
+         ncomps,             /* number of components in an image */
+         dimsizes[MAXRANK],  /* dimension sizes of an image */
+         ri_id = FAIL,       /* image id, always reset to FAIL when not used */
+         nattrs;             /* number of attributes assigned to an image */
+   char  name[MAXNAMELEN],   /* name of an image */
+         curr_file_name[MAXFNLEN]; /* current input (hdf) file's name */
+   intn  status,             /* status returned from a routine */
+         ret_value = SUCCEED;/* return value of printGR_ASCII */
+
+   /* temp. name for curr input file name for ease of use */
+   HDstrcpy( curr_file_name, dumpgr_opts->ifile_name );
+
+   /* default content option to DDATA when output is binary because
+      no header info will be printed in binary format */
+   dumpgr_opts->contents = DDATA;
+
+   /* when there are no images specified, dumper dumps all images */
+   if (num_ri_chosen == (NO_SPECIFIC))
+      dumpall = TRUE;
+   else
+      sort(gr_chosen, num_ri_chosen); /* otherwise, sort the list */
+
+   /* for each valid index, display the image's data
+      if the user request to dump all images or if there are more
+      requested images to be processed */
+   ri_count = 0;  /* no requested image has been processed yet */
+   for (ri_index = 0; ri_index < ndsets /* validate index */
+        && ( dumpall                /* either all images are dumped */
+        || ri_count < num_ri_chosen); /* or more requested images */
+        ri_index++)
+   {
+      /* if the user neither requests dump all nor the current images */
+      if ((!dumpall) && (ri_index != gr_chosen[ri_count]))
+         continue; /* go to the next image in the file */
+
+      ri_count++;  /* count the # of images being processed */
+
+      /* Reset variables. */
+      HDmemset(dimsizes, 0, sizeof(int32) * MAXRANK);
+
+      /* get access to the current image */
+      ri_id = GRselect(gr_id, ri_index);
+      if (ri_id == FAIL) /* to the next image */
+         ERROR_CONT_2( "in %s: GRselect failed for %d'th RI", 
+			"printGR_BINARY", (int)ri_index );
+
+      /* get image's information */
+      status = GRgetiminfo(ri_id, name, &ncomps, &nt, &il, dimsizes, &nattrs);
+      if( status == FAIL )
+      {
+         fprintf( stderr, "in %s: GRgetiminfo failed for %d'th RI",
+			"printGR_BINARY", (int)ri_index );
+
+	 /* end access to the current image before going to the next one */
+         if( GRendaccess(ri_id) == FAIL )    
+            fprintf( stderr, "in %s: GRendaccess failed for %d'th RI",
+			"printGR_BINARY", (int)ri_index );
+         ri_id = FAIL;  /* reset image id */
+         continue; /* to the next image */
+      }
+
+      /* print image palette's data */
+      if( dumpgr_opts->print_pal )
+      {
+         /* Note: currently only 1 pal assigned to an image, 2nd arg. */
+         status = print_Palette( ri_id, 1, fp, dumpgr_opts );
+         if ( status == FAIL )
+            ERROR_BREAK_2( "in %s: Printing image's palette failed for %d'th RI",
+			"printGR_BINARY", (int)ri_index, FAIL );
+      }
+
+      /* output data in binary format if palette printing is not requested  */
+      else if (ncomps > 0 && dimsizes[0] != 0)
+      {
+         /* print the current image's data */
+         status = grdumpfull(ri_id, dumpgr_opts, ncomps, dimsizes, nt, fp);
+         if ( status == FAIL )
+            ERROR_BREAK_2( "in %s: Printing image's data failed for %d'th RI",
+			"printGR_BINARY", (int)ri_index, FAIL );
+      }
+
+      /* end access to the current image */
+      if (FAIL == GRendaccess(ri_id))
+         fprintf(stderr,"in %s: GRendaccess failed for %d'th RI",
+			"printGR_BINARY", (int)ri_index );
+      ri_id = FAIL;  /* reset image id */
+   }  /* for ndsets */
+
+   return ret_value;
+} /* end of printGR_BINARY */
+
+/* closeGR combines the processes of GRend, Hclose, freeing the list
+   of numbers, and resetting all ids after validating the ids first.
+   When either GRend or Hclose fails, closeGR prints an informative
+   message then resetting the ids as normal since these failures are
+   highly unlikely and since the files are opened as read-only, it's 
+   safe to go on. */
+void closeGR(int32 *file_id,     /* will be returned as a FAIL */
+	     int32 *gr_id,       /* will be returned as a FAIL */
+	     int32 **gr_chosen ) /* will be returned as a NULL */
+{
+   if( *gr_id != FAIL )
+   {
+      if (FAIL == GRend(*gr_id))
+         fprintf(stderr,"in closeGR: GRend failed for the current file\n" );
+      *gr_id = FAIL; /* reset */
+   }
+
+   if( *file_id != FAIL )
+   {
+      if (FAIL == Hclose(*file_id))
+         fprintf(stderr,"in closeGR: Hclose failed for the current file\n" );
+      *file_id = FAIL; /* reset */
+   }
+
+   if( *gr_chosen != NULL )
+   {
+      HDfree( *gr_chosen );
+      *gr_chosen = NULL;
+   } /* end if */
+
+} /* end of closeGR */
+
+intn dgr(dump_info_t *dumpgr_opts, 
+	 intn         curr_arg, 
+	 intn         argc, 
+	 char        *argv[] )
+{
+    int32 file_id = FAIL,	/* current hdf file id */
+          gr_id = FAIL,		/* interface id */
+         *gr_chosen = NULL,	/* index list of requested images */
+          num_ri_chosen,	/* # of requested images */
+          nglb_attrs,		/* # of file attributes */
+          ndsets;		/* # of images in the file */
+    FILE *fp = NULL;		/* output file pointer */
+    char  file_name[MAXFNLEN];	/* current hdf file name */
+    intn  index_error=FALSE,	/* indicate an error in getting index list */
+          status,		/* status returned from a called routine */
+          ret_value = SUCCEED;	/* returned value of dgr */
+
+   /* check for missing input file name */
+   if( curr_arg >= argc )
+      ERROR_GOTO_0( "Missing input file name.  Please try again" );
+
+   /* going through each input file, open the file, try to compose the list
+      of indices of the images in the file that are requested, then read and
+      display information and data of each image in the specified manner */
+   while (curr_arg < argc)
+   {
+      intn isHDF = TRUE;  /* FALSE, if current file is not HDF file */
+
+      HDstrcpy(file_name, argv[curr_arg]);   /* get file name */
+      HDstrcpy( dumpgr_opts->ifile_name, file_name ); /* record file name */
+      curr_arg++;   /* forward the pointer to the current argument */
+
+      /* ensure that file_id, gr_id, and gr_chosen are all reset before
+         using because sometimes we have to break out a cycle; this'll
+         help avoiding the chore at every one of those instances */ 
+      closeGR( &file_id, &gr_id, &gr_chosen ); 
+
+      /* Print an informative message and skip this file if it is not 
+         an HDF file */
+      isHDF = Hishdf(file_name);
+      if (isHDF == FALSE)
+      {
+         /* if there are no more files to be processed, print error
+            message, then returns with FAIL */
+         if( curr_arg == argc )
+            {ERROR_GOTO_1( "in dgr: %s is not an HDF file", file_name);}
+         else /* print message, then continue processing the next file */
+            {ERROR_CONT_1( "in dgr: %s is not an HDF file", file_name);}
+      }
+
+      /* open current hdf file for processing */
+      file_id = Hopen(file_name, DFACC_RDONLY, 0);
+      if (file_id == FAIL)
+      {
+         /* if there are no more files to be processed, print error
+            message, then returns with FAIL */
+         if( curr_arg == argc )
+            {ERROR_GOTO_1( "in dgr: Failure in opening file %s", file_name);}
+         else /* print message, then continue processing the next file */
+            ERROR_CONT_1( "in dgr: Failure in opening file %s", file_name );
+      }
+
+      /* initiate GR interface, if fail, probably something fatal, returns
+         with FAIL */
+      gr_id = GRstart(file_id);
+      if (FAIL == gr_id)
+         ERROR_GOTO_1( "in dgr: GRstart failed for file %s", file_name);
+
+      /* BMR: compose the list of indices of RIs to be processed in the current
+         file: gr_chosen is the list and return the number of items in it */
+      num_ri_chosen = get_RIindex_list(gr_id, dumpgr_opts, &gr_chosen, &index_error);
+
+      /* if there are errors with the given indices, ref#s, or names of
+         the requested images, and yields no valid images, then close the
+         interface and the input file, and move on to the next file */ 
+      if (index_error && num_ri_chosen==0)
+         continue;	/* to the next file */
+
+      /* obtain number of images in the file and number of file attributes,
+         ndsets will be used to process the images, nglb_attrs will be 
+         used to print file attributes */
+      status = GRfileinfo(gr_id, &ndsets, &nglb_attrs);
+      if (status == FAIL) /* to the next file */
+         ERROR_CONT_1( "in dgr: GRfileinfo failed for file %s", file_name);
+
+      fp = stdout;  /* assume that output option is not given */
+
+      /* display images in requested format for the current file */
+      switch(dumpgr_opts->file_format)
+      {
+         case DASCII:       /* ASCII file */
+            /* open output file for ASCII or direct to standard output */
+            if (dumpgr_opts->dump_to_file)
+            {
+               fp = fopen( dumpgr_opts->file_name, "w");
+               if( fp == NULL )
+               {
+                  fprintf( stderr, "Unable to open output file %s\n", 
+                           dumpgr_opts->file_name );
+                  exit(1);          /* terminate hdp */
+               }
+            }
+            /* display the name and global attributes of the current file if 
+               data only option is not selected */
+            if (dumpgr_opts->contents != DDATA)
+            {
+               fprintf(fp, "File name: %s \n", file_name );
+         
+               /* print GR file attributes */
+               if( nglb_attrs > 0 )  /* save overhead */
+               { 
+                  status = print_GRattrs( gr_id, nglb_attrs, fp, dumpgr_opts );
+                  if( status == FAIL )
+                     ERROR_BREAK_1( "in dgr: print_GRattrs failed for file %s",
+                              file_name, FAIL );
+               } 
+            }
+            /* print RIs'data and information as requested */
+            if( ndsets > 0 )
+            {
+               status = printGR_ASCII( gr_id, dumpgr_opts, ndsets, 
+                                       gr_chosen, num_ri_chosen, fp );
+               if( status == FAIL ) /* to the next file */
+                  ERROR_BREAK_1( "in dgr: printGR_ASCII failed for file %s", 
+                                    file_name, FAIL );
+            }
+            else
+               if( dumpgr_opts->contents != DDATA )
+                  fprintf( stderr, "File %s has no images\n", file_name );
+
+            break; /* ASCII */
+
+         case DBINARY:       /* binary file */
+            /* open output file for ASCII or print to screen */
+            if (dumpgr_opts->dump_to_file)
+            {
+               fp = fopen(dumpgr_opts->file_name, "wb");
+               if( fp == NULL )
+               {
+                  fprintf( stderr, "Unable to open output file %s\n", 
+                           dumpgr_opts->file_name );
+                  exit(1);          /* terminate hdp */
+               }
+            }
+
+            status = printGR_BINARY( gr_id, dumpgr_opts, num_ri_chosen, ndsets, 
+                               gr_chosen, fp );
+            if( status == FAIL )
+               ERROR_BREAK_1( "in dgr: printGR_BINARY failed for file %s", 
+                                 file_name, FAIL );
+            break; /* BINARY */
+
+         default:
+            printf("Output file type must be either ascii or binary only\n" );
+         } /* switch for output format */
+                       
+      /* cleaning up before going on to the next file */
+      closeGR( &file_id, &gr_id, &gr_chosen ); 
+   }  /* while more files to process */
+
+   /* close output file only if option -o is given */
+   if (fp != NULL && dumpgr_opts->dump_to_file)
+      fclose(fp);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup  */
+      }
+    /* Normal cleanup */
+    closeGR( &file_id, &gr_id, &gr_chosen );
+
+    return ret_value;
+}	/* dgr */
+
+intn do_dumpgr(intn  curr_arg, 
+               intn  argc, 
+               char *argv[], 
+               intn  help)
+{
+   dump_info_t dumpgr_opts;	/* dumpgr options */
+   intn status, ret_value = SUCCEED;
+
+   /* initialize the structure that holds user's options and inputs */
+   init_dump_opts(&dumpgr_opts);
+
+   /* command line: hdp help */
+   if( help == TRUE )
+   {
+      dumpgr_usage(argc, argv);
+      goto done;
+   }		/* end if */
+
+   /* incomplete command */
+   if( curr_arg >= argc )
+   {
+      dumpgr_usage(argc, argv);
+      ERROR_GOTO_0( "in do_dumpgr: command is incomplete");
+   }		/* end if */
+
+   /* parse the user's command and store the inputs in dumpgr_opts */
+   status = parse_dumpgr_opts( &dumpgr_opts, &curr_arg, argc, argv );
+   if( status == FAIL )
+   {
+      dumpgr_usage(argc, argv);
+      ERROR_GOTO_0( "in do_dumpgr: parse_dumpgr_opts is unable to parse command");
+   }
+
+   /* display data and information as specified in dumpgr_opts */
+   status = dgr( &dumpgr_opts, curr_arg, argc, argv );
+   if( status == FAIL )
+      ERROR_GOTO_0( "in do_dumpgr: dgr failed" );
+
+done:
+   if (ret_value == FAIL)
+   { /* Failure cleanup */
+   }
+    /* Normal cleanup */
+
+   /* free the lists for given indices, ref#s, and names if
+      they had been allocated */
+   free_num_list(dumpgr_opts.by_index.num_list );
+   free_num_list(dumpgr_opts.by_ref.num_list );
+   free_str_list(dumpgr_opts.by_name.str_list, dumpgr_opts.by_name.num_items);
+
+   return ret_value;
+}  /* end do_dumpgr() */
diff --git a/mfhdf/dumper/hdp_list.c b/mfhdf/dumper/hdp_list.c
new file mode 100644
index 0000000..7e038bc
--- /dev/null
+++ b/mfhdf/dumper/hdp_list.c
@@ -0,0 +1,1250 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5706 $";
+#endif
+
+/* $Id: hdp_list.c 5706 2011-11-01 18:23:02Z bmribler $ */
+
+#include "mfhdf.h"
+#include "hdp.h"
+#include <ctype.h>
+
+#define NUM_FIELD_WIDTH 5
+#define TAGNAME_FIELD_WIDTH 20
+#define TAG_FIELD_WIDTH 8
+#define REF_FIELD_WIDTH 8
+#define INDEX_FIELD_WIDTH 12
+#define OFFSET_FIELD_WIDTH 12
+#define LENGTH_FIELD_WIDTH 12
+#define LABEL_FIELD_WIDTH 15
+#define DESC_FIELD_WIDTH 15
+
+static intn parse_list_opts(list_info_t * list_opts, intn curr_arg, 
+                intn argc, char *argv[]);
+intn print_annots_by_object(const char *fname, int32 an_id, 
+		ann_type annot_type, uint16 tag, uint16 ref);
+intn print_annots_in_file(int32 an_id, const char* fname,
+		int32 n_annotations, ann_type annot_type);
+
+static void
+list_usage(intn argc, 
+           char *argv[])
+{
+    printf("Usage:\n");
+    printf("%s list [-acensldg] [-o<f|g|t|n>] [-t tag] <filelist>\n", argv[0]);
+    printf("\t-a\tPrint annotations of items (sets long output)\n");
+    printf("\t-c\tPrint classes of items (sets long output)\n");
+    printf("\t-n\tPrint names or labels of items (sets long output)\n");
+    printf("\t-e\tPrint special element information of items (sets long output)\n");
+    printf("\t-s\tShort output (default)\n");
+    printf("\t-l\tLong output\n");
+    printf("\t-d\tDebugging output\n");
+    printf("\t-g\tPrint groups only\n");
+    printf("\t-t <number>\tPrint items of with a given tag number\n");
+    printf("\t-t <name>\tPrint items of with a given tag name\n");
+    printf("\t-of\tPrint items in the order found in the file\n");
+    printf("\t-og\tPrint items in group order\n");
+    printf("\t-ot\tPrint items in tag order (default)\n");
+#if 0 /* No longer possible since objects can have more than one label 
+       * -GV 6/12/97 */
+    printf("\t-on\tPrint items in name or label order\n");
+#endif
+    printf("\t<filelist>\tList of hdf file names, separated by spaces\n");
+}	/* end list_usage() */
+
+static void
+init_list_opts(list_info_t * list_opts)
+{
+    list_opts->order = OTAG;	/* default ordering is by tag */
+    list_opts->verbosity = VSHORT;	/* default verbosity is a short list */
+    list_opts->limit = LNONE;	/* default is all the tag/refs */
+    list_opts->class = FALSE;	/* don't dump class information */
+    list_opts->name = FALSE;	/* don't dump name information */
+    list_opts->desc = FALSE;	/* don't dump annotation information */
+    list_opts->spec = FALSE;	/* don't dump special element information */
+    list_opts->group = FALSE;	/* don't dump group information */
+    list_opts->limit_tag = 0;	/* initialize... */
+}	/* end init_list_opts() */
+
+static intn
+parse_list_opts(list_info_t * list_opts, 
+		intn curr_arg, 
+		intn argc, 
+		char *argv[])
+{
+    intn ret = SUCCEED;
+
+    for (; curr_arg < argc; curr_arg++)
+      {
+#if defined(WIN386) || defined(DOS386)
+          if (argv[curr_arg][0] == '-' || argv[curr_arg][0] == '/')
+#else
+          if (argv[curr_arg][0] == '-' )
+#endif /* for DOS/WINDOWS */
+            {
+                ret++;
+                switch (argv[curr_arg][1])
+                  {
+                  case 'a':	/* print annotations */
+                      list_opts->desc = TRUE;	/* dump description information */
+                      if (list_opts->verbosity == VSHORT)
+                          list_opts->verbosity = VLONG;		/* verbosity is a long list */
+                      break;
+
+                  case 'c':	/* print classes */
+                      list_opts->class = TRUE;	/* dump class information */
+                      if (list_opts->verbosity == VSHORT)
+                          list_opts->verbosity = VLONG;		/* verbosity is a long list */
+                      break;
+
+                  case 'n':	/* print names */
+                      list_opts->name = TRUE;	/* dump name/label information */
+                      if (list_opts->verbosity == VSHORT)
+                          list_opts->verbosity = VLONG;		/* verbosity is a long list */
+                      break;
+
+                  case 'e':	/* print special element info */
+                      list_opts->spec = TRUE;	/* dump special element information */
+                      if (list_opts->verbosity == VSHORT)
+                          list_opts->verbosity = VLONG;		/* verbosity is a long list */
+                      break;
+
+                  case 's':	/* short output */
+                      list_opts->verbosity = VSHORT;	/* verbosity is short */
+                      break;
+
+                  case 'l':	/* long output */
+                      list_opts->verbosity = VLONG;		/* verbosity is long */
+                      break;
+
+                  case 'd':	/* debugging output */
+                      list_opts->verbosity = VDEBUG;	/* verbosity is debug */
+                      break;
+
+                  case 'g':	/* print only groups */
+#ifdef LATER
+                      list_opts->limit = LGROUP;	/* limit to group output */
+#endif
+                      list_opts->group = TRUE;	/* dump group info */
+                      if (list_opts->verbosity == VSHORT)
+                          list_opts->verbosity = VLONG;		/* verbosity is long */
+                      break;
+
+                  case 't':	/* print only items of one tag */
+                      curr_arg++;
+                      ret++;
+                      if (isdigit(argv[curr_arg][0]))
+                        {
+                            list_opts->limit = LTAGNUM;		/* limit to tag name output */
+                            list_opts->limit_tag = atoi(argv[curr_arg]);
+                            list_opts->limit_name = tagnum_to_name(list_opts->limit_tag);
+                        }	/* end if */
+                      else
+                        {	/* must be a tag name */
+                            list_opts->limit = LTAGNAME;	/* limit to tag name output */
+                            list_opts->limit_name = HDstrdup(argv[curr_arg]);
+                            list_opts->limit_tag = tagname_to_num(list_opts->limit_name);
+                            if (list_opts->limit_tag == DFTAG_NULL)
+                              {
+                                  printf("ERROR: invalid tag name: %s\n", list_opts->limit_name);
+                                  return (FAIL);
+                              }		/* end if */
+                        }	/* end else */
+                      break;
+
+                  case 'o':	/* order the items in some way */
+                      switch (argv[curr_arg][2])
+                        {
+                        case 'g':
+                            list_opts->order = OGROUP;	/* ordering is by group */
+                            break;
+
+                        case 't':
+                            list_opts->order = OTAG;	/* ordering is by tag */
+                            break;
+
+                        case 'f':
+                            list_opts->order = OFILE;	/* ordering is by file */
+                            break;
+
+#if 0 /* No longer possible since objects can have more than one label 
+       * -GV 6/12/97 */
+                        case 'n':
+                            list_opts->order = ONAME;	/* ordering is by name */
+                            break;
+#endif
+                        default:
+                            printf("ERROR: Invalid list ordering!\n");
+                            return (FAIL);
+                        }	/* end switch */
+                      break;
+
+                  default:		/* invalid list option */
+                      printf("ERROR: Invalid list option!\n");
+                      return (FAIL);
+                  }		/* end switch */
+            }	/* end if */
+      }		/* end for */
+
+    return (ret);
+}	/* end parse_list_opts */
+
+static void
+print_list_header(list_info_t * list_opts)
+{
+    switch (list_opts->verbosity)
+      {
+      case VSHORT:		/* short output */
+              /* no header */
+          break;
+
+      case VLONG:	/* long output */
+          printf("%*s%*s%*s%*s%*s\n",
+                 NUM_FIELD_WIDTH, "no",
+                 TAGNAME_FIELD_WIDTH, "tagname",
+                 TAG_FIELD_WIDTH, "tag", REF_FIELD_WIDTH, "ref",
+                 INDEX_FIELD_WIDTH, "  index_by_tag");
+          break;
+
+      case VDEBUG:		/* debugging output */
+          printf("%*s%*s%*s%*s%*s%*s%*s\n",
+                 NUM_FIELD_WIDTH, "no",
+                 TAGNAME_FIELD_WIDTH, "tagname",
+                 TAG_FIELD_WIDTH, "tag", REF_FIELD_WIDTH, "ref",
+                 INDEX_FIELD_WIDTH, "  index_by_tag",
+                 OFFSET_FIELD_WIDTH, "offset",
+                 LENGTH_FIELD_WIDTH, "length");
+          break;
+      }		/* end switch() */
+}	/* end print_list_header() */
+
+/* Exported
+ * print all data annotations, which are either data labels or data
+   descriptions, for object with tag/ref
+   This routine is used by print_data_labels and print_data_descs
+   for common code */
+intn
+print_annots_by_object(const char *fname,
+                       int32 an_id, 
+                       ann_type annot_type,
+                       uint16 tag, 
+                       uint16 ref)
+{
+   intn  i;
+   char  *buf = NULL;
+   int32  ann_num;
+   int32  ann_length;
+   int32  ann_id = FAIL;
+   int32 *ann_list = NULL;
+   char *annot_type_text = "invalid";	/* "label" or "description" */
+   char *func_name = "print_annots_by_object"; /* used to print error msg */
+   char error_item[256];	/* holds tag, ref, and fname for error msg */
+   intn   ret_value = SUCCEED;
+
+   /* stores the current values tag, ref, and file name in error_item,
+	just to simplify the error printing statement */
+   sprintf( error_item, "object tag=%d, ref=%d, in file %s", tag, ref, fname ); 
+
+   /* validate annotation type before processing */
+   if( annot_type == AN_DATA_LABEL )
+      annot_type_text = "label";
+   else if( annot_type == AN_DATA_DESC )
+      annot_type_text = "description";
+   else
+      ERROR_GOTO_2("%s: invalid annotation type for\n             %s\n",
+		  				func_name, error_item );
+
+   /* find number of labels for object with tag/ref */
+   ann_num = ANnumann(an_id, annot_type, tag, ref);
+   if (FAIL == ann_num)
+      ERROR_GOTO_2("%s: ANnumann failed for object %s\n",
+	 					func_name, error_item );
+
+   if (ann_num > 0 )
+   { /* print data annotation */
+
+      /* allocate space for all label/description id's for data object */
+      ann_list = HDmalloc(ann_num*sizeof(int32));
+      CHECK_ALLOC( ann_list, "ann_list", func_name );
+
+      /* retrieve all the data objects label/description handles and 
+	 store them in the buffer ann_list */
+      if (FAIL == ANannlist( an_id, annot_type, tag, ref, ann_list ))
+         ERROR_GOTO_2("%s: ANannlist failed for %s\n",
+	 	func_name, error_item );
+
+      /* for every data label/description */
+      for(i = 0; i < ann_num; i++)
+      {
+         ann_id = ann_list[i];  /* get next annotation id */
+
+         ann_length =  ANannlen(ann_id); /* get annotation length */
+         if (FAIL == ann_length)
+	    ERROR_GOTO_4( "%s: ANannlen failed for\n               %d'th data %s for %s\n", 
+		func_name, i, annot_type_text, error_item );
+
+	 /* allocate space for the data annotation */
+         buf = HDcalloc((ann_length+1) * sizeof(char),1);
+         CHECK_ALLOC( buf, "buf", func_name );
+
+         buf[ann_length] = '\0';
+
+	 /* read annotation data */
+         if (FAIL == ANreadann(ann_id, buf, ann_length+1))
+            ERROR_GOTO_4( "%s: ANreadann failed on the %d'th data %s for\n               %s\n", func_name, i, annot_type_text, error_item );
+
+	 /* print the annotation with title depending on annotation type */
+	 if( annot_type == AN_DATA_LABEL )
+            printf("%*s%s\n", LABEL_FIELD_WIDTH, " Name/Label=", buf);
+	 else /* annot_type == AN_DATA_DESC -already checked for else */
+            printf("%*s%s\n", LABEL_FIELD_WIDTH, "  Description=", buf);
+
+         /* end access */
+         if (FAIL == ANendaccess(ann_id))
+            ERROR_GOTO_4( "%s: ANendaccess failed on the %d'th data %s \n              for %s\n", func_name, i, annot_type_text, error_item );
+
+         /* reset id and free space for data label/description */
+         ann_id = FAIL;
+         HDfree(buf);
+         buf = NULL;
+      } /* end for every data label/description */
+        
+      /* cleanup */
+      HDfree(ann_list);
+      ann_list = NULL;
+   }  /* end if num_ann > 0 */
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (ann_id != FAIL)
+              ANendaccess(ann_id);        
+          if (buf != NULL)
+              HDfree(buf);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* print_annots_by_object() */
+
+/* print all data labels for object with tag/ref */
+intn
+print_data_labels(const char *fname,
+                  int32 an_id, 
+                  uint16 tag, 
+                  uint16 ref)
+{
+   intn ret_value = SUCCEED;
+
+   ret_value = print_annots_by_object(fname, an_id, AN_DATA_LABEL, tag, ref);
+   if( ret_value == FAIL )
+      ERROR_GOTO_0( "in print_data_labels\n" );
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* end print_data_labels */
+
+/* print all data descriptions for object with tag/ref */
+intn
+print_data_descs(const char *fname,
+                 int32 an_id, 
+                 uint16 tag, 
+                 uint16 ref)
+{
+   intn ret_value = SUCCEED;
+
+   ret_value = print_annots_by_object(fname, an_id, AN_DATA_DESC, tag, ref);
+   if( ret_value == FAIL )
+      ERROR_GOTO_0( "in print_data_descs\n" );
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* end print_data_descs */
+
+/* Prints all annotations in the file.
+   This routine is used by print_all_data_labels, print_all_data_descs, 
+print_all_file_labels, and print_all_file_descs for the common code. */
+intn
+print_annots_in_file(int32 an_id,
+                     const char* fname,
+                     int32 n_annotations,
+                     ann_type annot_type)
+{
+   intn i;
+   int32 len;
+   char* annotation = NULL;
+   char* func_name = "print_annots_in_file";
+   int32 ann_id = FAIL;
+   char *annot_type_text = "invalid";	/* "label" or "description" */
+   intn   ret_value = SUCCEED;
+
+   /* validate annotation type before processing */
+   if( annot_type == AN_DATA_LABEL )
+      annot_type_text = "Data Label";
+   else if( annot_type == AN_DATA_DESC )
+      annot_type_text = "Data Description";
+   else if( annot_type == AN_FILE_LABEL )
+      annot_type_text = "File Label";
+   else if( annot_type == AN_FILE_DESC )
+      annot_type_text = "File Description";
+   else
+      ERROR_GOTO_2("%s: invalid annotation type for file %s\n",
+		  				func_name, fname );
+
+   /* for all annot_type annotations in the file */
+   for(i = 0; i< n_annotations; i++) 
+   {  
+      /* select i'th annotation */
+      ann_id = ANselect(an_id, i, annot_type );
+      if (FAIL == ann_id)
+         ERROR_GOTO_4("%s: ANselect failed on the %d'th %s for file %s\n",
+			func_name, i, annot_type_text, fname);
+
+      /* get length of i'th annotation */
+      len = ANannlen(ann_id);
+      if (FAIL == len)
+         ERROR_GOTO_4("%s: ANannlen failed on the %d'th %s for file %s\n",
+			func_name, i, annot_type_text, fname);
+
+      /* allocate space for an annotation */
+      annotation = (char *) HDcalloc(len + 1,1);
+      CHECK_ALLOC( annotation, "annotation", func_name );
+
+      /* read in annotation and print it */
+      if(ANreadann(ann_id, annotation, len+1)!= FAIL)
+          printf("%s #%ld: %s\n", annot_type_text, (long)i, annotation);
+      else
+         ERROR_GOTO_4("%s: ANreadann failed on the %d'th %s for file %s\n", 
+			func_name, i, annot_type_text, fname);
+
+      /* end access */
+      if (FAIL == ANendaccess(ann_id))
+         ERROR_GOTO_4("%s: ANendaccess failed on the %d'th %s for file %s\n", 
+			func_name, i, annot_type_text, fname);
+
+      /* reset id and free space for annotation */
+      ann_id = FAIL;
+      HDfree(annotation);
+      annotation = NULL;
+   } /* end for every annotation in file */ 
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (ann_id != FAIL)
+              ANendaccess(ann_id);
+          if (annotation != NULL)
+              HDfree(annotation);
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+} /* end print_annots_in_file */
+
+/* Exported
+ * Prints all data labels in file */
+intn
+print_all_data_labels(const char *fname, 
+                      int32 an_id)
+{
+   int32 n_file_label;
+   int32 n_data_label;
+   int32 n_file_desc;
+   int32 n_data_desc;
+   intn  ret_value = SUCCEED;
+
+   /* find out how many file labels/descs and data labels/descs in file */
+   if (FAIL == ANfileinfo(an_id, &n_file_label, &n_file_desc, &n_data_label, 
+                          &n_data_desc))
+      ERROR_GOTO_1("print_all_data_labels: ANfileinfo failed for file %s\n",
+					fname);
+
+   /* prints all the data labels in the file */
+   ret_value = print_annots_in_file( an_id, fname, n_data_label, AN_DATA_LABEL );
+   if( ret_value == FAIL )
+      ERROR_GOTO_0("in print_all_data_labels\n" );
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* print_all_data_labels() */
+
+/* Exported
+ * Prints all data descriptions in file */
+intn
+print_all_data_descs(const char *fname, 
+                     int32 an_id)
+{
+    int32 len;
+    char *desc = NULL;
+    int32 ann_id = FAIL;
+    intn i;
+    int32 n_file_label;
+    int32 n_file_desc;
+    int32 n_data_label;
+    int32 n_data_desc;
+    intn  ret_value = SUCCEED;
+
+    /* find out how many file labels/descs and data labels/descs in file */
+    if (FAIL == ANfileinfo(an_id, &n_file_label, &n_file_desc, &n_data_label, 
+                           &n_data_desc))
+      {
+          fprintf(stderr,"ANfileinfo failed for file %s\n", fname);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* for all data descs */
+    for(i = 0; i< n_data_desc; i++) 
+      {  
+          /* select i'th data desc */
+          ann_id = ANselect(an_id, i, AN_DATA_DESC);
+          if (FAIL == ann_id)
+            {
+                fprintf(stderr,"ANselect failed for %d'th data description in file %s\n", i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* get length of i'th data desc */
+          len = ANannlen(ann_id);
+          if (FAIL == len)
+            {
+                fprintf(stderr,"ANannlen failed for %d'th data description in file %s\n", i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* allocate room for a data desc */
+          desc = (char *) HDcalloc(len + 1,1);
+          CHECK_ALLOC( desc, "desc", "print_all_data_descs" );
+
+          /* read in data desc and print it */
+          if(ANreadann(ann_id, desc, len+1)!= FAIL)
+              printf("Data ID Annotation #%ld: %s\n", (long)i, desc);
+          else
+            {
+                fprintf(stderr,"ANreadann failed for %d'th data description in file %s\n",i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* end access */
+          if (FAIL == ANendaccess(ann_id))
+            {
+                fprintf(stderr,"ANendaccess failed for %d'th data description in file %s\n",i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* reset id and free space for desc */
+          ann_id = FAIL;
+          HDfree(desc);
+          desc = NULL;
+      } /* end for every data desc */ 
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    if (ann_id != FAIL)
+        ANendaccess(ann_id);        
+    if (desc != NULL)
+        HDfree(desc);
+
+    return ret_value;
+} /* print_all_data_descs() */
+
+intn
+print_all_file_labels(const char *fname, 
+                      int32 an_id)
+{
+    int32 len;
+    char *label = NULL;
+    intn i;
+    int32 ann_id = FAIL;
+    int32 n_file_label;
+    int32 n_file_desc;
+    int32 n_data_label;
+    int32 n_data_desc;
+    intn  ret_value = SUCCEED;
+
+    /* find out how many file labels/descs and data labels/descs in file */
+    if (FAIL == ANfileinfo(an_id, &n_file_label, &n_file_desc, &n_data_label, 
+                      &n_data_desc))
+      {
+          fprintf(stderr,"ANfileinfo failed for file %s\n", fname);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* for all file labels */
+    for(i = 0; i< n_file_label; i++) 
+      {  
+          /* select i'th file label */
+          ann_id = ANselect(an_id, i, AN_FILE_LABEL);
+          if (FAIL == ann_id)
+            {
+                fprintf(stderr,"ANselect failed for %d'th label for file %s\n", i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* get length of i'th file label */
+          len = ANannlen(ann_id);
+          if (FAIL == len)
+            {
+                fprintf(stderr,"ANannlen failed for %d'th label for file %s\n",i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* allocate room for the file label */
+          label = (char *) HDcalloc(len + 1,1); 
+          CHECK_ALLOC( label, "label", "print_all_data_labels" );
+
+          /* read in file label and print it */
+          if(ANreadann(ann_id, label, len+1)!= FAIL)
+              printf("File Label #%ld: %s\n", (long)i, label);
+          else
+            {
+                fprintf(stderr,"ANreadann failed for %d'th label for file %s\n", i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* end access */
+          if (FAIL == ANendaccess(ann_id))
+            {
+                fprintf(stderr,"ANendaccess failed for %d'th label for file %s\n",i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* reset id and free space for label */
+          ann_id = FAIL;
+          HDfree(label);
+          label = NULL;
+      } /* end for every file label */ 
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    if (ann_id != FAIL)
+        ANendaccess(ann_id);        
+    if (label != NULL)
+        HDfree(label);
+
+    return ret_value;
+}	/* end print_all_file_labels() */
+
+intn
+print_all_file_descs(const char *fname, 
+                     list_info_t* list_opts, /* for print_SDattrs */
+                     int32 an_id)
+{
+    /* file desc */
+    int32       len; 
+    char       *desc = NULL;
+    int32       ann_id = FAIL;
+    intn       i;
+    int32       n_file_label;
+    int32       n_file_desc;
+    int32       n_data_label;
+    int32       n_data_desc;
+    /* SDS */
+    int32       sd_fid = FAIL;
+    int32       ndsets, nattrs;
+    char       *attr_nt_desc = NULL;
+    VOIDP       attr_buf = NULL;
+    intn        ret_value = SUCCEED;
+
+    /* find out how many file labels/descs and data labels/descs in file */
+    if (FAIL == ANfileinfo(an_id, &n_file_label, &n_file_desc, &n_data_label, 
+                           &n_data_desc))
+      {
+          fprintf(stderr,"ANfileinfo failed for file %s \n",fname);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* for all file descs */
+    for(i = 0; i< n_file_desc; i++) 
+      {  
+          /* select i'th file desc */
+          ann_id = ANselect(an_id, i, AN_FILE_DESC);
+          if (FAIL == ann_id)
+            {
+                fprintf(stderr,"ANselect failed for %d'th desc for file %s \n",i, fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* get length of i'th file desc */
+          len = ANannlen(ann_id);
+          if (FAIL == len)
+            {
+                fprintf(stderr,"ANannlen failed for %d'th desc for file %s \n",i,fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* allocate room for the file desc */
+          desc = (char *) HDcalloc(len + 1,1);
+          CHECK_ALLOC( desc, "desc", "print_all_file_descs" );
+
+          /* read in file desc and print it */
+          if(ANreadann(ann_id, desc, len+1)!= FAIL)
+              printf("File description #%ld: %s\n", (long)i, desc);
+          else
+            {
+                fprintf(stderr,"ANreadann failed for %d'th desc for file %s \n",i,fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* end access */
+          if (FAIL == ANendaccess(ann_id))
+            {
+                fprintf(stderr,"ANendaccess failed for %d'th desc for file %s \n",i,fname);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* reset id and free space for label */
+          ann_id = FAIL;
+          HDfree(desc);
+          desc = NULL;
+      } /* end for every file desc */ 
+
+    /* all SDS global attributes are considered file descriptions */
+    if ((sd_fid = SDstart(fname, DFACC_READ)) != FAIL)
+      { /* SD global attributes */
+	  dump_info_t dump_opts;
+	  init_dump_opts( &dump_opts );
+          if (SDfileinfo(sd_fid, &ndsets, &nattrs) != FAIL)
+	  {
+	     /* BMR: installed input file name to opts for dumpfull 
+                in print_SDattrs to use - 6/16/2000 */
+             print_SDattrs( sd_fid, stdout, nattrs, &dump_opts );
+               /* temporary use stdout until fixing hdp_list to print
+                  to a FILE *fp */
+	  }
+          else
+            {
+                fprintf(stderr,"Failure in SDfileinfo for file %s\n",
+fname);
+                ret_value = FAIL;
+                goto done;
+            }
+          if (FAIL == SDend(sd_fid))
+             fprintf(stderr, "SDend failed for the current file\n" );
+          sd_fid = FAIL; /* reset */
+      }         /* end if  SDstart */
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (ann_id != FAIL)
+              ANendaccess(ann_id);        
+          if (desc != NULL)
+              HDfree(desc);
+          if (attr_nt_desc != NULL)
+              HDfree(attr_nt_desc);
+          if (attr_buf != NULL)
+              HDfree((VOIDP) attr_buf);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+}	/* end print_all_file_descs() */
+
+/* BMR: use part of print_all_file_descs for this routine to just print
+   the file annotations because print_all_file_descs also prints SD
+   file attributes.  Probably will separate SD file attributes when
+   adding GR file attributes */
+intn 
+print_file_descs(const char *f_name,
+                 int32 an_id ) 
+{
+    /* file desc */
+    int32       len; 
+    char       *desc = NULL;
+    int32       ann_id = FAIL;
+    intn       i;
+    int32       n_file_label;
+    int32       n_file_desc;
+    int32       n_data_label;
+    int32       n_data_desc;
+    intn        ret_value = SUCCEED;
+
+    /* find out how many file labels/descs and data labels/descs in file */
+    if (FAIL == ANfileinfo(an_id, &n_file_label, &n_file_desc, &n_data_label, 
+                           &n_data_desc))
+      {
+          fprintf(stderr,"ANfileinfo failed for file %s \n",f_name);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* for all file descs */
+    for(i = 0; i< n_file_desc; i++) 
+      {  
+          /* select i'th file desc */
+          ann_id = ANselect(an_id, i, AN_FILE_DESC);
+          if (FAIL == ann_id)
+            {
+                fprintf(stderr,"ANselect failed for %d'th desc for file %s \n",i, f_name);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* get length of i'th file desc */
+          len = ANannlen(ann_id);
+          if (FAIL == len)
+            {
+                fprintf(stderr,"ANannlen failed for %d'th desc for file %s \n",i,f_name);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* allocate room for the file desc */
+          desc = (char *) HDcalloc(len + 1,1);
+          CHECK_ALLOC( desc, "desc", "print_file_descs" );
+
+          /* read in file desc and print it */
+          if(ANreadann(ann_id, desc, len+1)!= FAIL)
+              printf("File description #%ld: %s\n", (long)i, desc);
+          else
+            {
+                fprintf(stderr,"ANreadann failed for %d'th desc for file %s \n",i,f_name);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* end access */
+          if (FAIL == ANendaccess(ann_id))
+            {
+                fprintf(stderr,"ANendaccess failed for %d'th desc for file %s \n",i,f_name);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* reset id and free space for label */
+          ann_id = FAIL;
+          HDfree(desc);
+          desc = NULL;
+      } /* end for every file desc */ 
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (ann_id != FAIL)
+              ANendaccess(ann_id);        
+          if (desc != NULL)
+              HDfree(desc);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+}	/* end print_all_file_descs() */
+
+/* prints all relevant information that an HDF object can have
+   including annotations */
+static intn
+print_list_obj(const char *fname,
+               list_info_t *l_opts, 
+               objinfo_t * o_info, 
+               intn o_num, 
+               int32 an_id)
+{
+    int32  i;
+    char  *s = NULL;
+    char  *buf = NULL;
+    intn   ret_value = SUCCEED;
+
+    switch (l_opts->verbosity)
+      {
+      case VSHORT:		/* short output */
+          /* handled elsewhere */
+          break;
+
+      case VLONG:	/* long output */
+          printf("%*d%*s%*d%*d%*ld\n",
+                 NUM_FIELD_WIDTH, o_num,
+                 TAGNAME_FIELD_WIDTH,
+                 ((s = HDgettagsname(o_info->tag)) == NULL ? HDstrdup("Unknown") : s),
+                 TAG_FIELD_WIDTH, o_info->tag, REF_FIELD_WIDTH, o_info->ref,
+                 INDEX_FIELD_WIDTH, (long) o_info->index);
+          HDfree(s);	/* free tagname string */
+          s = NULL;
+          break;
+
+      case VDEBUG:		/* debugging output */
+          printf("%*d%*s%*d%*d%*ld%*ld%*ld\n",
+                 NUM_FIELD_WIDTH, o_num,
+                 TAGNAME_FIELD_WIDTH,
+                 ((s = HDgettagsname(o_info->tag)) == NULL ? HDstrdup("Unknown") : s),
+                 TAG_FIELD_WIDTH, o_info->tag, REF_FIELD_WIDTH, o_info->ref,
+                 INDEX_FIELD_WIDTH, (long) o_info->index,
+                 OFFSET_FIELD_WIDTH, (long) o_info->offset,
+                 LENGTH_FIELD_WIDTH, (long) o_info->length);
+          HDfree(s);	/* free tagname string */
+          s = NULL;
+          break;
+      }		/* end switch */
+
+   /* find data labels for object if any */
+   if (l_opts->name == TRUE)
+      if (FAIL == print_data_labels(fname, an_id, o_info->tag, o_info->ref))
+         ERROR_GOTO_0("in print_list_obj\n");
+
+   if (l_opts->class == TRUE)
+      {
+      }		/* end if */
+
+   /* find data descs for object if any */
+   if (l_opts->desc == TRUE )
+      if (FAIL == print_data_descs(fname, an_id, o_info->tag, o_info->ref))
+         ERROR_GOTO_0("in print_list_obj\n");
+
+   if (l_opts->spec == TRUE && o_info->is_special)
+   {
+      switch (o_info->spec_info->key)
+      {
+         case SPECIAL_LINKED:
+             printf("\tLinked Block: first %ld standard %ld per unit %ld\n",
+                   (long) o_info->spec_info->first_len,
+                   (long) o_info->spec_info->block_len,
+                   (long) o_info->spec_info->nblocks);
+             break;
+
+         case SPECIAL_EXT:
+             printf("\tExternal File: path %s  offset %ld\n",
+                   o_info->spec_info->path, (long) o_info->spec_info->offset);
+             break;
+
+         case SPECIAL_COMP:
+             printf("\tCompressed Element: compression type: %s  modeling type %s\n",
+                   (o_info->spec_info->comp_type == COMP_CODE_NONE ? "None" :
+                   (o_info->spec_info->comp_type == COMP_CODE_RLE ? "Run-Length" :
+                   (o_info->spec_info->comp_type == COMP_CODE_NBIT ? "N-Bit" : "Unknown"))),
+                   (o_info->spec_info->model_type == COMP_MODEL_STDIO ? "Standard" : "Unknown"));
+             break;
+
+         case SPECIAL_CHUNKED:
+             printf("\tChunked element: chunk size %d, ndims %d, [",
+                   (intn)o_info->spec_info->chunk_size,  (intn)o_info->spec_info->ndims);
+             for (i = 0; i < o_info->spec_info->ndims; i++)
+             {
+                 printf("%d",(intn)o_info->spec_info->cdims[i]);
+                 if(i != (o_info->spec_info->ndims -1 ))
+                     printf(",");
+             }
+             printf("]\n");
+             break;
+
+         default:
+             printf("\t Do not understand special element type %d \n",
+                   o_info->spec_info->key);
+             break;
+         }	/* end switch */
+      }	 /* end if */
+
+/* BMR 8/1/00: added no_element test to make sure group_info is not NULL */
+/*
+   if (l_opts->group == TRUE && o_info->is_group && o_info->no_element != FALSE)
+*/
+   if (l_opts->group == TRUE && o_info->is_group )
+   {
+      DFdi       *g_obj = NULL;
+      int32       num;
+
+      if ((num = get_group_max(o_info->group_info)) != FAIL)
+      {
+         printf("\tContents: (%ld objects)\n", (long) num);
+         g_obj = get_next_group(o_info->group_info, 0);
+         while (g_obj != NULL)
+         {
+            printf("\t\t%-30s: (tag=%6d) ref=%d\n",
+                  ((s = HDgettagsname(g_obj->tag)) == NULL ? HDstrdup("Unknown") : s),
+            g_obj->tag, g_obj->ref);
+            HDfree(s);	/* free tagname string */
+            s = NULL;
+            g_obj = get_next_group(o_info->group_info, 1);
+         }		/* end while */
+      }	/* end if */
+   }		/* end if */
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (s != NULL)
+              HDfree(s);
+          if (buf != NULL)
+              HDfree(buf);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+}/* print_list_obj() */
+
+
+/* print the library version of the file */
+static void 
+printfilever(int32 file_id)
+{
+    uint32 major, minor, release;
+    char string[LIBVSTR_LEN+1];
+
+    if (Hgetfileversion(file_id, &major, &minor, &release, string) == SUCCEED)
+      {
+        string[LIBVSTR_LEN] = '\0';	/* make it a null terminated string */
+        printf("Last modified with %s\n\n", string);
+      }
+    else
+        printf("(Has no library version information)\n\n");
+}
+
+/* low level object listing routine for HDF file */
+intn
+do_list(intn curr_arg, 
+	intn argc, 
+	char *argv[], 
+	intn  help )
+{
+   list_info_t list_opts;	/* list options */
+   filelist_t *f_list = NULL;	/* list of files to dump */
+   objlist_t  *o_list = NULL;	/* list of DD objects in a file */
+   objinfo_t  *o_info = NULL;	/* pointer to a DD object */
+   char       *f_name = NULL;	/* current file name to list */
+   int32       fid = FAIL;	/* HDF file ID */
+   intn        obj_num;		/* number of the object we are displaying */
+   intn        status;		/* status from various function calls */
+   char       *s = NULL;	/* temporary character pointer */
+   int32       an_id = FAIL;	/* annotation interface handle */
+   intn        ret_value = SUCCEED;
+
+   if (help == TRUE )
+   {
+      list_usage(argc, argv);
+      goto done;
+   }  /* end if */
+
+   /* incomplete command */
+   if( curr_arg >= argc )
+   {
+      list_usage(argc, argv);
+      ret_value = FAIL; /* so caller can be traced in debugging */
+      goto done;
+   }
+
+   init_list_opts(&list_opts);
+   if ((status = parse_list_opts(&list_opts, curr_arg, argc, argv)) == FAIL)
+   {
+      list_usage(argc, argv);
+      ret_value = FAIL;
+      goto done;
+   }  /* end if */
+
+   curr_arg += status;
+   if (curr_arg >= argc || (f_list = make_file_list(curr_arg, argc, argv)) == NULL)
+   {
+      fprintf(stderr,"ERROR: No files to dump!\n");
+      list_usage(argc, argv);
+      ret_value = FAIL;
+      goto done;
+   }  /* end if */
+
+   /* process each file */
+   f_name = get_next_file(f_list, 0);
+   while (f_name != NULL)
+   {
+      int label_flag, desc_flag;
+      vinit_done = FALSE; 	/* reset global Vset variable */
+      obj_num = 0;	/* number of the object we are displaying */
+      fid = FAIL;
+      an_id = FAIL;
+
+      if ((fid = Hopen(f_name, DFACC_READ, 0)) != FAIL)
+      {
+         an_id = ANstart(fid);
+         if (FAIL == an_id)
+	    ERROR_GOTO_1( "do_list: ANstart failed for file %s \n", f_name );
+
+	 label_flag = desc_flag = 0;
+         if( list_opts.name == TRUE )
+	    label_flag = CHECK_LABEL;
+         if( list_opts.desc == TRUE )
+	    desc_flag = CHECK_DESC;
+
+         /* make list of all objects in file */
+         o_list = make_obj_list(fid, label_flag | desc_flag |
+                                   CHECK_GROUP | CHECK_SPECIAL);
+
+         /* if there are any object in the file, print annotations if
+	    requested, then the object information as requested */
+         if (o_list != NULL)
+         {
+            /* print out filename, etc. */
+            printf("File: %s\n", f_name);
+            printfilever(fid);
+
+            /* print file labels if requested */
+            if (list_opts.name == TRUE)
+               if (FAIL == print_all_file_labels(f_name, an_id))
+                  ERROR_GOTO_0( "in do_list\n" );
+
+            /* print file descriptions if requested */
+            if (list_opts.desc == TRUE)
+               if (FAIL == print_all_file_descs(f_name, &list_opts, an_id))
+                  ERROR_GOTO_0( "in do_list\n" );
+
+            /* sort list of objects in requested order */
+            sort_obj_list(o_list, list_opts.order);
+
+            /* print out list header according to options */
+            print_list_header(&list_opts);
+
+            /* Special case for short output */
+            if (list_opts.verbosity == VSHORT)
+            {
+               uint16      last_tag = 0;
+
+               o_info = get_next_obj(o_list, 0);  /* get first DD object */
+               while (o_info != NULL)
+               {
+                  if( (list_opts.limit == LGROUP || list_opts.limit == LNONE) 
+                      || list_opts.limit_tag == o_info->tag)
+                  {
+                     if (o_info->tag != last_tag)
+                     {
+                        s = HDgettagsname(o_info->tag);
+                        if( s == NULL )
+                           s = HDstrdup("Unknown");
+
+                        printf("%s%-*s: (tag %d)\n", 
+				(last_tag == 0 ? "" : "\n"),
+                                TAGNAME_FIELD_WIDTH, s, o_info->tag);
+                        last_tag = o_info->tag;
+                        printf("\tRef nos: ");
+                        HDfree(s);	/* free tagname string */
+                        s = NULL; /* reset */
+                     }		/* end if */
+                     printf("%d ", o_info->ref);
+                  }	/* end if */
+
+                  /* advance to the next DD object */
+                  o_info = get_next_obj(o_list, 1);
+               }  /* end while o_info */
+               printf("\n");
+            }	/* end if verbosity */
+
+            else /* must be verbose output */
+            {
+                /* Loop through all the objects in the file */
+                o_info = get_next_obj(o_list, 0);  /* get first DD object */
+                while (o_info != NULL)
+                {
+                   switch (list_opts.limit)
+                   {
+                      default:
+                      case LNONE:
+                      case LGROUP:
+                          if (FAIL == print_list_obj(f_name, &list_opts, 
+						o_info, obj_num,an_id))
+                             ERROR_GOTO_0("in do_list\n");
+                          break;
+
+                       case LTAGNUM:
+                       case LTAGNAME:
+                           if (list_opts.limit_tag == o_info->tag)
+                              if (FAIL == print_list_obj(f_name, &list_opts, 
+						o_info, obj_num, an_id))
+                           	 ERROR_GOTO_0("in do_list\n");
+                           break;
+                   }	/* end switch */
+                   obj_num++;
+                   o_info = get_next_obj(o_list, 1); /* advance to next DD object */
+                }		/*end while */
+             }	/* end else */
+
+             /* free the object list */
+             free_obj_list(o_list);
+             o_list = NULL;
+         }	/* end if o_list */
+
+          /* cleanup section */
+          if (vinit_done == TRUE)
+             if (FAIL == Vfinish(fid))
+                ERROR_GOTO_1("do_list: Vfinish failed for file %s\n", f_name);
+
+          if (FAIL == ANend(an_id))
+             ERROR_GOTO_1("do_list: ANend failed for file %s\n", f_name);
+          an_id = FAIL; /* reset */
+
+          if (Hclose(fid) == FAIL)
+             ERROR_GOTO_1("do_list: Hclose failed for file %s\n", f_name);
+          fid = FAIL; /* reset */
+
+       }	/* end if */
+       else
+          ERROR_GOTO_1("in do_list: Hopen failed - possible invalid file name: %s", f_name);
+
+       /* next file processing */
+       /* get next file to process */
+       f_name = get_next_file(f_list, 1);
+   }		/* end while processing files*/
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (fid != FAIL) /* check if file open still */
+            {
+                Hclose(fid);
+                fid = FAIL;
+            }
+          if (an_id != FAIL) /* check if annotation handle still open */
+            {
+                ANend(an_id);
+                an_id = FAIL;
+            }
+          if (s != NULL)
+              HDfree(s);
+          if (o_list != NULL)
+              free_obj_list(o_list);
+      }
+    /* Normal cleanup */
+    if (f_list != NULL)
+        free_file_list(f_list);
+
+    return ret_value;
+}	/* end do_list() */
diff --git a/mfhdf/dumper/hdp_rig.c b/mfhdf/dumper/hdp_rig.c
new file mode 100644
index 0000000..7f866c7
--- /dev/null
+++ b/mfhdf/dumper/hdp_rig.c
@@ -0,0 +1,711 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5706 $";
+#endif
+
+/* $Id: hdp_rig.c 5706 2011-11-01 18:23:02Z bmribler $ */
+
+#include <stdio.h>
+#include "mfhdf.h"
+#include "hdp.h"
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+
+#define IMAGE 1
+
+static void 
+dumprig_usage(intn argc, 
+              char *argv[])
+{
+    printf("Usage:\n");
+#ifdef LATER
+    printf("%s dumprig [-a|-i <indices>|-n <names>|-r <refs>] [-dhvc] [-o <filename> [-bx]] <filelist>\n", argv[0]);
+#endif
+    printf("%s dumprig [-a|-i <indices>|-m <n>|-r <refs>] [-dhv] [-o <filename> [-bx]] <filelist>\n", argv[0]);
+    printf("\t-a\tDump all RIGs in the file (default)\n");
+    printf("\t-i <indices>\tDump the RIGs at positions listed in <indices>\n");
+#ifdef LATER
+    printf("\t-n <names>\tDump the RIGs with name listed in <names>\n");
+#endif
+    printf("\t-m <n>\tDump the 8- or 24-bit RIGs only, <n> may be 8 or 24 \n");
+    printf("\t-r <refs>\tDump the RIGs with reference number listed in <refs>\n");
+    printf("\t-d\tDump data only, no tag/ref, formatted to input to hp2hdf\n");
+    printf("\t-h\tDump header only, no annotation for elements nor data\n");
+    printf("\t-v\tDump everything including all annotations (default)\n");
+    printf("\t-c\tDo not add a carriage return to a long data line\n");
+    printf("\t-o <filename>\tOutput to file <filename>\n");
+    printf("\t-b\tBinary format of output\n");
+    printf("\t-x\tAscii text format of output (default)\n");
+    printf("\t<filelist>\tList of hdf file names, separated by spaces\n");
+}	/* end list_usage() */
+
+static void 
+init_dumprig_opts(dump_info_t * dumprig_opts)
+{
+    dumprig_opts->filter = DALL;	/* default dump all RIGs */
+    dumprig_opts->filter_num = NULL;	/* not by reference nor by index */
+    dumprig_opts->filter_str = NULL;	/* no strings */
+    dumprig_opts->num_chosen = (-1);	/* default dump all items */
+    dumprig_opts->contents = DVERBOSE;	/* default dump all information */
+    dumprig_opts->dump_to_file = FALSE;		/* don't dump to output file */
+    dumprig_opts->file_format = DASCII;	/* default output is ASCII file */
+    dumprig_opts->as_stream = FALSE; /* print output aligned, using carriage returns */
+    dumprig_opts->print_pal = FALSE;     /* GR only, don't print palette */
+
+    /* print output aligned, using carriage returns */
+    dumprig_opts->as_stream = FALSE;
+
+    /* print space characters (LF, FF, CR, space, tabs...) in \digit format */
+    dumprig_opts->clean_output = FALSE;
+
+    /* print data starting at column 5 unless reset otherwise */
+    dumprig_opts->firstln_indent = 5;  /* Note: only for dump_rig, so 
+					testfiles won't need to be changed */
+
+    /* print data on a continuous line starting at column 5 unless
+       reset otherwise */
+    dumprig_opts->contln_indent = 5;  /* Note: only for dump_rig, so 
+					testfiles won't need to be changed */
+
+    /* GR only, print data using interlace at creation */
+    dumprig_opts->interlace = NO_SPECIFIC;
+
+    /* GR & SD only, print data of global attributes unless -g is given */
+    dumprig_opts->no_gattr_data = FALSE;
+
+    /* GR & SD only, print data of local attributes unless -l is given */
+    dumprig_opts->no_lattr_data = FALSE;
+
+    HDstrcpy(dumprig_opts->file_name, "\0");
+}	/* end init_list_opts() */
+
+static intn 
+parse_dumprig_opts(dump_info_t *dumprig_opts, 
+                   intn        *curr_arg,
+                   intn         argc, 
+                   char        *argv[], 
+                   int         *model)
+{
+    int32  i;
+    int32  numItems;
+    char  *tempPtr = NULL;
+    char  *ptr = NULL;
+
+    if (*curr_arg >= argc)
+        return (FAIL);
+
+    while ((*curr_arg < argc) && (argv[*curr_arg][0] == '-'))
+      {
+          switch (argv[*curr_arg][1])
+            {
+            case 'a':	/* dump all, default */
+                dumprig_opts->filter = DALL;
+                (*curr_arg)++;
+                break;
+
+            case 'm':	/* dump the rigs with model specified as 8-bit or 24-bit */
+                (*curr_arg)++;
+                *model = atoi(argv[*curr_arg]);
+                if (((*model) != 8) && ((*model) != 24))
+                  {
+                      printf("%s-bit raster model: not available.\n", argv[*curr_arg]);
+                      exit(1);
+                  }
+                (*curr_arg)++;
+                break;
+
+            case 'i':	/* dump by index */
+            case 'r':	/* dump by reference */
+                if ((argv[*curr_arg][1]) == 'i')
+                    dumprig_opts->filter = DINDEX;
+                else
+                    dumprig_opts->filter = DREFNUM;
+                (*curr_arg)++;
+
+                ptr = argv[*curr_arg];
+
+                /* check if it's the end of the command */
+                if( ptr == NULL )
+                {
+                   printf("Missing values for option\n");
+                   exit(1);
+                }
+                numItems = 0;
+                while ((tempPtr = HDstrchr(ptr, ',')) != NULL)
+                  {
+                      numItems++;
+                      ptr=tempPtr+1;
+                  }		/* end while */
+                if (*ptr != '\0')	/* count the last item */
+                    numItems++;
+
+                dumprig_opts->filter_num = (intn *) HDmalloc(sizeof(intn) * numItems);
+                if (dumprig_opts->filter_num == NULL)
+                  {
+                      printf("Not enough memory!\n");
+                      exit(-1);
+                  }
+
+                ptr = argv[*curr_arg];
+                i = 0;
+                while ((tempPtr = HDstrchr(ptr, ',')) != NULL)
+                  {
+                      *tempPtr = '\0';
+                      dumprig_opts->filter_num[i] = atoi(ptr);
+                      ptr = tempPtr + 1;
+                      i++;
+                  }
+                dumprig_opts->filter_num[i] = atoi(ptr);	/* get the last item */
+                dumprig_opts->num_chosen = numItems;	/* save the number of items */
+
+                (*curr_arg)++;
+                break;
+
+            case 'd':	/* dump data only */
+                dumprig_opts->contents = DDATA;
+                (*curr_arg)++;
+                break;
+
+            case 'h':	/* no annotations nor data */
+                dumprig_opts->contents = DHEADER;
+                (*curr_arg)++;
+                break;
+
+            case 'v':	/* dump all info */
+                dumprig_opts->contents = DVERBOSE;
+                (*curr_arg)++;
+                break;
+
+            case 'c':   /* do not add carriage returns to output data lines */
+                dumprig_opts->as_stream = TRUE;
+                (*curr_arg)++;
+                break;    
+
+            case 'o':   /* specify output file */
+                dumprig_opts->dump_to_file = TRUE;
+
+                /* Get file name */
+                HDstrcpy(dumprig_opts->file_name, argv[++(*curr_arg)]);
+
+                (*curr_arg)++;
+                break;
+
+            case 'b':   /* dump data in binary */
+                dumprig_opts->file_format = DBINARY;
+                (*curr_arg)++;
+                break;
+
+            case 'x':   /* dump data in ascii, also default */
+                dumprig_opts->file_format = DASCII;
+                (*curr_arg)++;
+                break;
+
+            default:	/* invalid dumprig option */
+                printf("Warning: Invalid dumprig option %s\n", argv[*curr_arg]);
+                return (FAIL);
+            }	/* end switch */
+      }		/* end while */
+    return (SUCCEED);
+}	/* end parse_dumprig_opts */
+
+
+static intn 
+drig(dump_info_t *dumprig_opts, 
+     intn         curr_arg, 
+     intn         argc,
+     char        *argv[], 
+     int          model)
+{
+    int32      *rig_chosen = NULL;
+    int32       num_rig_chosen;
+    int32       width, height;
+    int32       ndsets;
+    int32       temp;
+    intn        i, k, x;
+    char        file_name[MAXFNLEN];
+    FILE       *fp = NULL;
+    VOIDP       image = NULL;
+    int         dumpall = 0;
+    int         ncomps;
+    int         il;
+    file_format_t ff;
+    intn        ret_value = SUCCEED;
+
+    while (curr_arg < argc)
+      {		/* Examine all files. */
+          HDstrcpy(file_name, argv[curr_arg]);
+          curr_arg++;
+
+          num_rig_chosen = dumprig_opts->num_chosen;
+          if (num_rig_chosen > 0)
+            {
+                if ((rig_chosen = (int32 *) HDmalloc(sizeof(int32) * num_rig_chosen)) == NULL)
+                  {
+                      fprintf(stderr,"Memory allocation error\n");
+                      ret_value = FAIL;
+                      goto done;
+                  }		/* end if */
+
+                k = (-1);
+                HDmemfill(rig_chosen, &k, sizeof(int32), num_rig_chosen);
+            }	/* end if */
+
+          /* Determine which RIGs are to be displayed. */
+          if (dumprig_opts->filter == DINDEX)
+            {
+                for (i = 0; i < dumprig_opts->num_chosen; i++)
+                    rig_chosen[i] = dumprig_opts->filter_num[i];
+                sort(rig_chosen, num_rig_chosen);  /* DREFNUM doesn't need this */ 
+            }	/* end if */
+
+          /* ASCII or Binary? */
+          ff = dumprig_opts->file_format;
+          switch(ff)
+            {
+            case DASCII:   /*  ASCII  file   */
+
+                /* Get the name of the output file. */
+                if (dumprig_opts->dump_to_file)
+                    fp = fopen(dumprig_opts->file_name, "w");
+                else
+                    fp = stdout;
+                if (dumprig_opts->contents != DDATA)
+                    fprintf(fp, "File name: %s \n\n", file_name);
+
+                /* Determine the number of images in a file. */
+                if (model == 8)
+                  { /* raster 8 */
+                      if ((ndsets = DFR8nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+                else if (model == 24)
+                  { /* raster 24 */
+                      if ((ndsets = DF24nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+                else /* try both 8 and 24 */
+                  {
+                      if ((temp = DFR8nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      if ((ndsets = DF24nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      ndsets += temp;
+                  }
+
+                if (num_rig_chosen == -1)/* If all RIGs will be dumped, set the flag. */
+                    dumpall = 1;
+
+                x = 0;	/* Used as the index of the array of "rig_chosen[x]". */
+
+                /* can only check index range here */
+                for(i=0; 
+                    i < dumprig_opts->num_chosen && dumprig_opts->filter == DINDEX; 
+                    i++)
+                  {
+                      if((dumprig_opts->filter_num[i] > ndsets)
+                         ||(dumprig_opts->filter_num[i] < 0))
+                        {
+                            fprintf(stderr,"\nThe index number %d is out of range\n",
+                                    dumprig_opts->filter_num[i]);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+
+                for (i = 0; 
+                     i < ndsets && (dumpall!=0 || x < dumprig_opts->num_chosen); 
+                     i++)
+                  {	/* Examine all RIGs. */
+                      int     compressed;
+                      int     has_pal;
+                      int32   eltsz;
+                      int32   read_nelts;
+                      uint16  rig_ref;
+                      uint16  compr_type;
+
+                      /* get dimensions of ri */
+                      if (FAIL == DFGRgetimdims(file_name, &width, &height, &ncomps, &il))
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      /* Determine the size of each element; "ncomps" is 1 for an
+                         8-bit image or 3 for a 24-bit image. */
+                      eltsz = DFKNTsize(DFNT_UINT8 | DFNT_NATIVE) * ncomps;
+                      read_nelts = width * height;	/* Number of elements to be read in. */
+                      if ((image = (VOIDP) HDmalloc(read_nelts * eltsz)) == NULL)
+                        {
+                            fprintf(stderr,"Not enough memory!\n");
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+/*DFGRreqimil( 1 );*/
+                      if (DFGRIgetimlut((const char *) file_name, image, width,
+                                               height, IMAGE, 0, &compressed, &compr_type, &has_pal) == -1)
+                        {
+                            fprintf(stderr,"DFGRIgetimlut: Read error for file %s\n",file_name);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      rig_ref = DFGRIlastref();	/* Determine the reference of the image just read. */
+
+                      /* If the user has specificed the reference option, then 
+                         something has to be done. 
+                         Note: the reason why the following part was not done  
+                         inside the above "switch" statement is that the reference 
+                         number of a raster image cannot be appropriately retrieved
+                         before actually reading in a raster image. */
+                      if (dumprig_opts->filter == DREFNUM)
+                        {
+                            int         ref_found = 0, m;
+
+                            /* Determine if the image just read has the reference specified by the user. */
+                            for (m = 0; m < dumprig_opts->num_chosen; m++)
+                              {
+                                if (dumprig_opts->filter_num[m] == rig_ref)
+                                    ref_found = 1; /* found image */
+                              }
+
+                            if (!ref_found)
+                              {	/* If no match, then the current image is
+                                   not what the user wants and so skip it. */
+                                  HDfree((VOIDP) image);
+                                  image = NULL; /* reset */
+                                  continue;
+                              }
+                        }
+
+                      /* If not all images are to be dumped out and the current image
+                         is not what the user wants or if the user has specified a 
+                         model and the model of the current image is not that one, then
+                         skip the current image. */
+                      if (((dumprig_opts->filter == DINDEX) 
+                           && (i != rig_chosen[x])) 
+                          || (((ncomps * 8) != model) && (model != 0)))
+                        {
+                            HDfree((VOIDP) image);
+                            image = NULL; /* reset */
+                            continue;
+                        }
+
+                      /* Determine what to be dumped out. */
+                      switch (dumprig_opts->contents)
+                        {
+                        case DVERBOSE:
+                        case DHEADER:
+                            fprintf(fp, "Data model: %d-bit raster image ", ncomps * 8);
+			    /* 24-bit images do not have palette */
+                            if ((ncomps != 3) && has_pal)
+                                fprintf(fp, "with palette.\n");
+                            else
+                                fprintf(fp, "without palette.\n");
+                            fprintf(fp, "\twidth=%d;  height=%d\n", (int) width, (int) height);
+                            fprintf(fp, "\treference=%d\n", (int) rig_ref);
+                            /* check compression if any */
+                            if (compressed)
+                              {
+                                  fprintf(fp, "\t*data is compressed with ");
+                                  switch (compr_type)
+                                    {
+                                    case DFTAG_RLE:
+                                        fprintf(fp, "RLE compression scheme.\n");
+                                        break;
+                                    case DFTAG_IMCOMP:
+                                        fprintf(fp, "IMCOMP conmpression scheme.\n");
+                                        break;
+                                    case DFTAG_JPEG:
+                                    case DFTAG_JPEG5:
+                                        fprintf(fp, "JPEG conmpression scheme (24-bit data.)\n");
+                                        break;
+                                    case DFTAG_GREYJPEG:
+                                    case DFTAG_GREYJPEG5:
+                                        fprintf(fp, "JPEG conmpression scheme (8-bit data.)\n");
+                                        break;
+                                    default:
+                                        fprintf(fp, "unknown scheme.");
+                                        break;
+                                    }		/* switch */
+                                  fprintf(fp, "\n");
+                              }	/* if (compressed) */
+                            else
+                                fprintf(fp, "\t*data is not compressed.\n");
+
+                            if (dumprig_opts->contents == DHEADER)
+                                break;
+                        case DDATA:
+                            if (dumprig_opts->contents != DDATA)
+                                fprintf(fp, "\tData : \n");
+                            if (FAIL == dumpfull(DFNT_UINT8, dumprig_opts, read_nelts*eltsz, image, fp, 5, 5))
+                              {
+                                  fprintf(stderr,"dumpfull: failed to dump %d'th image data for file %s",
+                                          i,file_name);
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                            HDfree((VOIDP) image);
+                            image = NULL; /* reset */
+                            break;
+                        default:
+                            printf("dumping RIG, unknown option \n");
+                            ret_value = FAIL;
+                            goto done;
+                        }		/* switch  */
+
+                      if(dumpall!=1 && i == rig_chosen[x])
+                          x++;
+
+                  }	/* for every image in file  */
+
+                break; /* ASCII */
+
+            case DBINARY:       /* binary  file  */
+                /* Get the name of the output file. */
+                if (dumprig_opts->dump_to_file)
+                    fp = fopen(dumprig_opts->file_name, "wb");
+                else
+                    fp = stdout;
+
+                /* Determine the number of images in a file. */
+                if (model == 8)
+                  { /* raster 8 */
+                      if ((ndsets = DFR8nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+                else if (model == 24)
+                  { /* raster 24 */
+                      if ((ndsets = DF24nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+                else /* try both 8 and 24 */
+                  {
+                      if ((temp = DFR8nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      if ((ndsets = DF24nimages(file_name)) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      ndsets += temp;
+                  }
+
+		/* If all RIGs will be dumped, set the flag. */
+                if (num_rig_chosen == -1)
+                    dumpall = 1;
+
+                x = 0;	/* Used as the index of the array of "rig_chosen[x]". */
+
+                /* can only check index range here */
+                for(i=0; i < dumprig_opts->num_chosen && dumprig_opts->filter == DINDEX; i++)
+                  { 
+                      if((rig_chosen[i] > ndsets)||(rig_chosen[i]<0))
+                        {
+                            fprintf(stderr,"\nThe index %d is out of range\n",(int)rig_chosen[i]);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+
+                for (i = 0; 
+                     i < ndsets && (dumpall!=0 || x<dumprig_opts->num_chosen); 
+                     i++)
+                  {	/* Examine all RIGs. */
+                      int    compressed;
+                      int    has_pal;
+                      int32  eltsz;
+                      int32  read_nelts;
+                      uint16 rig_ref;
+                      uint16 compr_type;
+
+                      if (FAIL == DFGRgetimdims(file_name, &width, &height, &ncomps, &il))
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+
+                      /* Determine the size of each element; "ncomps" is 1 for an
+                         8-bit image or 3 for a 24-bit image. */
+                      eltsz = DFKNTsize(DFNT_UINT8 | DFNT_NATIVE) * ncomps;
+                      read_nelts = width * height;	/* Number of elements to be read in. */
+                      if ((image = (VOIDP) HDmalloc(read_nelts * eltsz)) == NULL)
+                        {
+                            fprintf(stderr,"Not enough memory!\n");
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      if (DFGRIgetimlut((const char *) file_name, image, width,
+                                               height, IMAGE, 0, &compressed, &compr_type, &has_pal) == -1)
+                        {
+                            fprintf(stderr,"DFGRIgetimlut: Read error for file %s\n",file_name);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      rig_ref = DFGRIlastref();	/* Determine the reference of the image just read. */
+
+                      /* If the user has specificed the reference option, then 
+                         something has to be done. 
+                         Note: the reason why the following part was not done  
+                         inside the above "switch" statement is that the reference 
+                         number of a raster image cannot be appropriately retrieved
+                         before actually reading in a raster image. */
+                      if (dumprig_opts->filter == DREFNUM)
+                        {
+                            int         ref_found = 0, m;
+
+                            /* Determine if the image just read has the reference specified by the user. */
+                            for (m = 0; m < dumprig_opts->num_chosen; m++)
+                              {
+                                if (dumprig_opts->filter_num[m] == rig_ref)
+                                    ref_found = 1; /* found it */
+                              }
+
+                            if (!ref_found)
+                              {	/* If no match, then the current image is
+                                   not what the user wants and so skip it. */
+                                  HDfree((VOIDP) image);
+                                  image = NULL; /* reset */
+                                  continue;
+                              }
+                        }
+
+                      /* If not all images are to be dumped out and the current image
+                         is not what the user wants or if the user has specified a 
+                         model and the model of the current image is not that one, then
+                         skip the current image. */
+                      if (((dumprig_opts->filter == DINDEX) && (i != rig_chosen[x])) || 
+                          (((ncomps * 8) != model) && (model != 0)))
+                        {
+                            HDfree((VOIDP) image);
+                            image = NULL; /* reset */
+                            continue;
+                        }
+
+                                 
+                      if (FAIL == dumpfull(DFNT_UINT8, dumprig_opts, read_nelts*ncomps, image, fp, 5, 5))
+                        {
+                            fprintf(stderr,"dumpfull: failed to dump %d'th image data for file %s",
+                                    i,file_name);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      HDfree((VOIDP) image);
+                      image = NULL; /* reset */
+                 
+                      if(dumpall!=1 && i == rig_chosen[x])
+                          x++;
+                  }	/* for every image in file  */
+
+                break; /* BINARY */
+            default:
+                printf("dumping RIG, unknown output file option \n");
+                ret_value = FAIL;
+                goto done;
+            }   /* switch for output file   */
+
+          if (rig_chosen != NULL)
+            {
+                HDfree(rig_chosen);
+                rig_chosen = NULL;
+            } /* end if */
+
+          if (dumprig_opts->dump_to_file)
+              fclose(fp);
+      }		/* while processing files  */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (image != NULL)
+              HDfree(image);
+          if (rig_chosen != NULL)
+              HDfree(rig_chosen);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+}	/* drig */
+
+intn 
+do_dumprig(intn  curr_arg, 
+           intn  argc, 
+           char *argv[], 
+           intn  help)
+{
+    dump_info_t dumprig_opts;	/* dumprig options */
+    int         model = 0;
+    intn        ret_value = SUCCEED;
+
+    if (help == TRUE)
+      {
+          dumprig_usage(argc, argv);
+          goto done;
+      }		/* end if */
+
+   /* initialize the structure that holds user's options and inputs */
+    init_dumprig_opts(&dumprig_opts);
+
+
+    if (parse_dumprig_opts(&dumprig_opts, &curr_arg, argc, argv, &model) == FAIL)
+      {
+          dumprig_usage(argc, argv);
+          ret_value = FAIL;
+          goto done;
+      }		/* end if */
+
+    if (drig(&dumprig_opts, curr_arg, argc, argv, model) == FAIL)
+      {
+          fprintf(stderr,"Failure in drig.\n");
+          ret_value = FAIL;
+          goto done;
+      }
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    if(dumprig_opts.filter_num != NULL)
+      HDfree(dumprig_opts.filter_num);
+
+    return ret_value;
+}	/* end do_dumprig() */
+
diff --git a/mfhdf/dumper/hdp_sds.c b/mfhdf/dumper/hdp_sds.c
new file mode 100644
index 0000000..60c47e2
--- /dev/null
+++ b/mfhdf/dumper/hdp_sds.c
@@ -0,0 +1,1468 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)Revision";
+#endif
+
+/* $Id: hdp_sds.c 5886 2012-10-06 04:23:07Z bmribler $ */
+
+#include <stdio.h>
+#include "mfhdf.h"
+#include "hdp.h"
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+intn have_szip = 1;
+#else
+intn have_szip = 0;
+#endif
+#include "cszip.h"
+#include "local_nc.h"	/* to use some definitions */
+
+void dumpsds_usage(intn argc, 
+              char *argv[])
+{
+    printf("Usage:\n");
+    printf("%s dumpsds [-k][-a|-i <indices>|-r <refs>|-n <names>] [-cdhvs] [-o <filename>] [-bx] <filelist>\n", argv[0]);
+    printf("\t-k\tDump SDSs in the given order, must be specified before -i/-r/-n\n");
+    printf("\t-a\tDump all SDSs in the file (default)\n");
+    printf("\t-i <indices>\tDump the SDSs at positions listed in <indices>\n");
+    printf("\t-r <refs>\tDump the SDSs with reference number listed in <refs>\n");
+    printf("\t-n <names>\tDump the SDSs with name listed in <names>\n");
+    printf("\t-d\tDump data only, no tag/ref, formatted to input to hp2hdf\n");
+    printf("\t-h\tDump header only, no annotation for elements nor data\n");
+    printf("\t-v\tDump everything including all annotations (default)\n");
+    printf("\t-c\tPrint space characters as they are, not \\digit\n");
+    printf("\t-g\tDo not print data of file (global) attributes\n");
+    printf("\t-l\tDo not print data of local attributes\n");
+    printf("\t-s\tDo not add carriage return to a long line - dump it as a stream\n");
+    printf("\t-o <filename>\tOutput to file <filename>\n");
+    printf("\t-b\tBinary format of output\n");
+    printf("\t-x\tAscii text format of output (default)\n");
+    printf("\t<filelist>\tList of hdf file names, separated by spaces\n");
+}	/* end list_usage() */
+
+intn parse_dumpsds_opts(dump_info_t *dumpsds_opts, 
+                   intn *curr_arg, 
+                   intn argc,
+                   char *argv[])
+{
+   intn ret_value = SUCCEED;
+
+   /* traverse the command and process each option */
+#if defined(WIN386) || defined(DOS386)
+   while ((*curr_arg < argc) && ((argv[*curr_arg][0] == '-') ||
+                                 (argv[*curr_arg][0] == '/')))
+#else
+   while ((*curr_arg < argc) && (argv[*curr_arg][0] == '-'))
+#endif /* for the use of / as option on PC */
+   {
+      switch (argv[*curr_arg][1])
+      {
+	 case 'k':	/* dump SDSs in the order they were given */
+/* need to document that this option must be provided before any -i, -r, -n */
+	    dumpsds_opts->keep_order = TRUE;
+            (*curr_arg)++;
+	    break;
+
+         case 'a':	/* dump all, default */
+            dumpsds_opts->filter = DALL;
+
+            /* indicate that no specific SDS requested, will dump all */
+            dumpsds_opts->num_chosen = NO_SPECIFIC;
+            (*curr_arg)++;
+            break;
+
+         case 'i':	/* dump by index */
+            (*curr_arg)++; /* go to the parameters for this flag */
+
+            /* Parse and store the given indices in structure all_types */
+	    parse_value_opts(argv, curr_arg, &dumpsds_opts, IS_INDEX);
+            (*curr_arg)++;
+            break;
+
+         case 'r':	/* dump by reference */
+            (*curr_arg)++; /* go to the parameters for this flag */
+
+            /* Parse and store the given ref numbers in structure all_types */
+	    parse_value_opts(argv, curr_arg, &dumpsds_opts, IS_REFNUM);
+            (*curr_arg)++;
+            break;
+
+         case 'n':	/* dump by names */
+            (*curr_arg)++; /* go to the parameters for this flag */
+
+            /* Parse and store the given names in structure all_types */
+	    parse_value_opts(argv, curr_arg, &dumpsds_opts, IS_NAME);
+            (*curr_arg)++;
+            break;
+
+         case 'd':	/* dump data only */
+                dumpsds_opts->contents = DDATA;
+                (*curr_arg)++;
+                break;
+
+         case 'h':	/* no annotations nor data */
+                dumpsds_opts->contents = DHEADER;
+                (*curr_arg)++;
+                break;
+
+         case 'v':	/* dump all info */
+                dumpsds_opts->contents = DVERBOSE;
+                (*curr_arg)++;
+                break;
+
+         case 's':	/* do not add carriage returns to output data lines */
+                dumpsds_opts->as_stream = TRUE;
+                (*curr_arg)++;
+                break;
+
+         case 'c':	/* print space characters as they are, not \digit */
+                dumpsds_opts->clean_output = TRUE;
+                (*curr_arg)++;
+                break;
+
+         case 'g':	/* suppress file (global) attr data, print its header */
+                dumpsds_opts->no_gattr_data = TRUE;
+                (*curr_arg)++;
+                break;
+
+         case 'l':	/* suppress local attr data, only print its header */
+                dumpsds_opts->no_lattr_data = TRUE;
+                (*curr_arg)++;
+                break;
+
+         case 'o':   /* specify output file */
+                dumpsds_opts->dump_to_file = TRUE;
+
+                /* Get file name */
+                HDstrcpy(dumpsds_opts->file_name, argv[++(*curr_arg)]);
+
+                (*curr_arg)++;
+                break;
+
+         case 'b':   /* dump data in binary */
+                dumpsds_opts->file_format = DBINARY;
+                (*curr_arg)++;
+                break;
+
+         case 'x':   /* dump data in ascii, also default */
+                dumpsds_opts->file_format = DASCII;
+                (*curr_arg)++;
+                break;
+
+         default:    /* invalid dumpsds option */
+                printf("HDP ERROR>>> Invalid dumpsds option %s\n", argv[*curr_arg]);
+                HGOTO_DONE(FAIL);
+            }	/* end switch */
+      }		/* end while */
+
+done:
+   if (ret_value == FAIL)
+   { /* Failure cleanup */
+      /* free the list if it had been allocated */
+      free_obj_chosen_t_list(&dumpsds_opts->all_types, dumpsds_opts->num_chosen);
+   }
+   /* Normal cleanup */
+   return (ret_value);
+}	/* end parse_dumpsds_opts */
+
+/* sdsdumpfull prints a single SDS */
+int32 sdsdumpfull( int32        sds_id, 
+             dump_info_t *dumpsds_opts,
+             int32        rank, 
+             int32        dimsizes[], 
+             int32        nt, 
+             FILE        *fp)
+{
+	/* "rank" is the number of dimensions and 
+	   "dimsizes[i]" is size of dimension "i". */
+   int32    j, i;
+   VOIDP    buf = NULL;		/* holds one row of data */
+   int32    numtype;
+   int32    eltsz;
+   int32    read_nelts;		/* number of elements in one row */
+   int32    done;			/* number of rows we have done */
+   int32   *left = NULL;
+   int32   *start = NULL;
+   int32   *edge = NULL;
+   intn     emptySDS = TRUE;
+   file_format_t ff;
+   intn     status = FAIL;
+   int32    status32 = FAIL;
+   int32    ret_value = SUCCEED;
+
+   /* temp. names for ease of use */
+   ff = dumpsds_opts->file_format;
+
+   /* Compute the number of the bytes for each value. */
+   numtype = nt & DFNT_MASK;
+   eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+
+   read_nelts = dimsizes[rank - 1];
+
+   /* make sure we are not allocating 0 elements */
+   CHECK_POS( read_nelts, "read_nelts", "sdsdumpfull" );
+   CHECK_POS( eltsz, "eltsz", "sdsdumpfull" );
+   CHECK_POS( rank, "rank", "sdsdumpfull" );
+
+   buf = (VOIDP) HDmalloc(read_nelts * eltsz);
+   CHECK_ALLOC( buf, "buf", "sdsdumpfull" );
+
+   left = (int32 *) HDmalloc(rank * sizeof(int32));
+   CHECK_ALLOC( left, "left", "sdsdumpfull" );
+
+   start = (int32 *) HDmalloc(rank * sizeof(int32));
+   CHECK_ALLOC( start, "start", "sdsdumpfull" );
+
+   edge = (int32 *) HDmalloc(rank * sizeof(int32));
+   CHECK_ALLOC( edge, "edge", "sdsdumpfull" );
+
+/* BMR - how come this doesn't have stride as for GR? */
+    for (i = 0; i < rank; i++)
+   {
+          start[i] = 0;		/* Starting location to read the data. */
+          left[i] = dimsizes[i];
+          edge[i] = 1;	/* Number of values to read in each dimension. */
+   }
+
+   /* so that the last edge has many elements as the last dimension??? */
+   edge[rank - 1] = dimsizes[rank - 1];
+
+   /* check if the SDS has data before proceeding if the file is HDF file */
+   /* see bug HDFFR- regarding non-HDF files */
+   if (dumpsds_opts->file_type == HDF_FILE)
+   {
+      status32 = SDcheckempty( sds_id, &emptySDS );
+      if( status32 == FAIL )
+         ERROR_GOTO_2( "in %s: SDcheckempty failed for sds_id(%d)",
+			"sdsdumpfull", (int) sds_id );
+      if( emptySDS )
+      {
+         if( ff == DASCII ) /* what about binary??? - BMR */
+            fprintf( fp, "                No data written.\n" );
+         HGOTO_DONE( SUCCEED );  /* because the dump for this SDS is */
+      			/* successful although it's empty -> next SDS */
+      }
+   } /* file is HDF */
+
+   /* Should handle the case of rank==0 here. -BMR */
+
+   if (rank == 1)
+   { /* If there is only one dimension, then dump the data
+               and the job is done. */
+      if (FAIL == SDreaddata(sds_id, start, NULL, edge, buf))
+      {
+	 /* If the data set has external element, get the external file
+	    name to provide information */
+	 intn extfile_namelen = SDgetexternalfile(sds_id, 0, NULL, NULL);
+	 if (extfile_namelen > 0)
+	 {
+	    char *extfile_name = NULL;
+	    extfile_name = (char *)HDmalloc(sizeof(char *)*(extfile_namelen+1));
+	    CHECK_ALLOC(extfile_name, "extfile_name", "sdsdumpfull" );
+
+	    /* Get the external file information, we don't need offset here */
+	    extfile_namelen = SDgetexternalfile(sds_id, extfile_namelen, extfile_name, NULL);
+            ERROR_GOTO_3( "in %s: SDreaddata failed for sds_id(%d) with external file %s.  Please verify the file exists in the same directory.",
+			"sdsdumpfull", (int)sds_id, extfile_name);
+	 }
+	 else
+            ERROR_GOTO_2( "in %s: SDreaddata failed for sds_id(%d)",
+			"sdsdumpfull", (int)sds_id );
+      }
+
+      /* if printing data only, print with no indentation */
+      if( dumpsds_opts->contents == DDATA )
+         status = dumpfull(numtype, dumpsds_opts, read_nelts, buf, fp,
+				0, 0 );
+      else
+         status = dumpfull(numtype, dumpsds_opts, read_nelts, buf, fp,
+				DATA_INDENT, DATA_CONT_INDENT );
+      if( FAIL == status )
+         ERROR_GOTO_2( "in %s: dumpfull failed for sds_id(%d)",
+                        "sdsdumpfull", (int)sds_id );
+   }
+   else if (rank > 1)
+   {
+      done = 0;
+
+      /* In each iteration, a row in dumped and "left[]" is modified 
+	accordingly(?) */
+      while (!done)
+      {
+         if (FAIL == SDreaddata(sds_id, start, NULL, edge, buf))
+         {
+	    /* If the data set has external element, get the external file
+	       name to provide information */
+	    intn extfile_namelen = SDgetexternalfile(sds_id, 0, NULL, NULL);
+	    if (extfile_namelen > 0)
+	    {
+	       char *extfile_name = NULL;
+	       extfile_name = (char *)HDmalloc(sizeof(char *)*(extfile_namelen+1));
+	       CHECK_ALLOC(extfile_name, "extfile_name", "sdsdumpfull" );
+
+	       /* Get the external file information, we don't need offset here */
+	       extfile_namelen = SDgetexternalfile(sds_id, extfile_namelen, extfile_name, NULL);
+               ERROR_GOTO_3( "in %s: SDreaddata failed for sds_id(%d) with external file %s.  Please verify the file exists in the same directory.",
+			"sdsdumpfull", (int)sds_id, extfile_name);
+	    }
+	    else
+               ERROR_GOTO_2( "in %s: SDreaddata failed for sds_id(%d)",
+                        "sdsdumpfull", (int)sds_id );
+        }
+
+         /* if printing data only, print with no indentation */
+         if( dumpsds_opts->contents == DDATA )
+            status = dumpfull(numtype, dumpsds_opts, read_nelts, buf, fp,
+				0, 0 );
+         else
+            status = dumpfull(numtype, dumpsds_opts, read_nelts, buf, fp,
+				DATA_INDENT, DATA_CONT_INDENT );
+
+         if( FAIL == status )
+            ERROR_GOTO_2( "in %s: dumpfull failed for sds_id(%d)",
+                        "sdsdumpfull", (int)sds_id );
+
+         /* Modify the values for "start[]" and "left[]" that are to be used
+            for dumping the next row. */
+
+         /* The following index variable "j" starts from "rank-2" because:
+               (1) the range is from 0 to rank-1
+               (2) each element in dimension rank-1 is just an element in a row
+            which is read in each time, and so we don't have to compute
+            the "start" of it. */
+
+         for (j = rank - 2; j >= 0; j--)
+         {		/* Examine each dimension. */
+            if (--left[j] > 0)
+	    {  /* Proceed in the same dimension; as long as there are
+	       elements in this dimension, this loop breaks here after the
+	       last element in the current dimension has been subtracted,
+	       we substract one for the next lower dimension and reset
+	       "left[j]" to be the size of dimension j. */
+                 start[j]++;
+                 break;
+            }
+            else
+            {  /* Nothing left in the current dimension.  So, subtract one
+               from the (j-1)th dimension and reset the value of "left[j]". */
+
+               left[j] = dimsizes[j];
+               start[j] = 0;
+               if (j == 0)
+                  done = 1;
+
+   	       /* someone added an extra line b/w two dims of data for nice format;
+		  this causes 1 extra line at the end of the output but I still
+		  don't understand the logic here so I left it alone; just 
+		  removed the spaces attempting to line up the data. BMR 7/13/00 */
+               /*if( ff==DASCII && !dumpsds_opts->as_stream )*/
+               if( ff==DASCII )
+                  if (j == rank - 2)
+                     fprintf(fp, "\n");
+            }
+         }  /* for j */
+      }	 /* while   */
+   }  /* else */
+
+   /* add an extra line between two datasets for pretty format 
+      this also causes 1 extra line at the end of the output! */
+    /*if (ff == DASCII && !dumpsds_opts->as_stream )*/
+    if (ff == DASCII )
+        fprintf(fp, "\n");
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    if (edge != NULL)
+        HDfree((VOIDP) edge);
+    if (start != NULL)
+        HDfree((VOIDP) start);
+    if (left != NULL)
+        HDfree((VOIDP) left);
+    if (buf != NULL)
+        HDfree((VOIDP) buf);    
+
+    return ret_value;
+}	/* sdsdumpfull */
+
+/* compose the list of indices of the requested SDSs although some
+   SDSs are requested by ref# or name.
+   The routine returns:
+        - the number of SDSs to be processed, or
+        - NO_SPECIFIC if all SDSs are to be processed, or
+        - 0 if none.
+   If any failure occurs, the parameter index_error will be set to TRUE
+*/
+intn get_SDSindex_list( 
+        int32 sd_id, 
+        dump_info_t *dumpsds_opts,
+        int32 **sds_chosen,/* array of indices of SDSs to be processed */
+        intn *index_error )
+{
+    intn     ii;
+    int32    sds_index,          /* index of an SDS */
+             sds_count = 0,  /* number of SDSs to be processed */
+             num_sds_chosen = dumpsds_opts->num_chosen;
+    intn     ret_value = 0;  /* assume that no SDS will be processed */
+
+    /* if no specific datasets are requested, return the SDS count as 
+       NO_SPECIFIC (-1) to indicate that all datasets are to be dumped */
+    if (dumpsds_opts->num_chosen == NO_SPECIFIC)
+	HGOTO_DONE( NO_SPECIFIC );
+
+    /* if specific datasets were requested, allocate space for the array
+       of indices */
+    if (num_sds_chosen > 0)
+	alloc_index_list( sds_chosen, num_sds_chosen );
+
+    /* else, no chosen SDSs but filter is not DALL, it shouldn't be this
+       combination, return SDS count as NO_SPECIFIC to dump all */
+    else
+	HGOTO_DONE( NO_SPECIFIC );
+
+    for (ii = 0; ii < num_sds_chosen; ii++)
+    {
+int jj;
+	/* if the current chosen SDS was requested by its index, store the
+	index in the array sds_chosen */
+	switch (dumpsds_opts->all_types[ii].type_of_info)
+	{
+	  case IS_INDEX:
+	    (*sds_chosen)[ii] = dumpsds_opts->all_types[ii].index;
+	    sds_count++;
+	  break;
+
+	  /* if the current chosen SDS was requested by its ref#, convert the
+	     ref# to index and store the index in the array sds_chosen */
+	  case IS_REFNUM:
+	    sds_index = SDreftoindex(sd_id, dumpsds_opts->all_types[ii].refnum);
+	    if (sds_index == FAIL)
+	    {
+	        printf( "SDS with reference number %d: not found\n",
+                               (int)dumpsds_opts->all_types[ii].refnum);
+	        *index_error = TRUE; /* error */
+	    }
+	    else
+	    {
+	        (*sds_chosen)[sds_count] = sds_index;
+	        sds_count++;
+	    }
+	    break;
+
+	  /* if the current chosen SDS was requested by its name, convert the
+	     name to index and store the index in the array sds_chosen */
+	  case IS_NAME:
+	    sds_index = SDnametoindex(sd_id, dumpsds_opts->all_types[ii].name);
+/* NOTE: should handle the case of more than one var of the same name too */
+	    if (sds_index == FAIL)
+	    {
+                printf( "SDS with name '%s': not found\n",
+                              dumpsds_opts->all_types[ii].name);
+                *index_error = TRUE; /* error */
+	    }
+	    else
+	    {
+                (*sds_chosen)[sds_count] = sds_index;
+                sds_count++;
+	    }
+	    break;
+
+	  default:
+	    fprintf(stderr, "in get_SDSindex_list: Info should only be an index, ref number, or name of an SDS\n");
+	    *index_error = TRUE; /* error */
+	} /* end switch */
+    } /* end for loop */
+
+    ret_value = sds_count;
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* end of get_SDSindex_list */
+
+/* Displays all SD file attributes */
+intn print_SDattrs( int32 sd_id,
+               FILE *fp,
+               int32 n_file_attrs,
+	       dump_info_t* dumpsds_opts )
+{
+   int32 attr_index,
+         attr_count,
+         attr_nt,
+         attr_buf_size;
+   char  attr_name[MAXNAMELEN],
+        *attr_nt_desc = NULL;
+   VOIDP attr_buf=NULL;
+   intn  printed = FALSE; /* whether file attr title has been printed */
+   intn  status = FAIL,          /* status from a called routine */
+         ret_value = SUCCEED;
+
+   /* for each file attribute, print its info and values */
+   for (attr_index = 0; attr_index < n_file_attrs; attr_index++)
+   {
+      /* get the current attr's name, number type, and number of values */
+      status = SDattrinfo(sd_id, attr_index, attr_name, &attr_nt, &attr_count);
+      if( status == FAIL )
+         ERROR_CONT_2( "in %s: SDattrinfo failed for %d'th attribute", 
+			"print_SDattrs", (int)attr_index );
+     
+      /* get number type description of the attribute */
+      attr_nt_desc = HDgetNTdesc(attr_nt);
+      if (attr_nt_desc == NULL)
+         ERROR_CONT_2( "in %s: HDgetNTdesc failed for %d'th attribute", 
+			"print_SDattrs", (int)attr_index );
+
+      /* print a title line for file attributes if it's not printed
+         yet and set flag so it won't be printed again */
+      if( !printed )
+      {
+         fprintf( fp, "\nFile attributes:\n" );
+         printed = TRUE;
+      }
+
+      /* display the attribute's information */
+      fprintf(fp,"\t Attr%i: Name = %s\n", (int) attr_index, attr_name);
+      fprintf(fp,"\t\t Type = %s \n\t\t Count= %i\n", attr_nt_desc, (int) attr_count);
+      resetBuff((VOIDP) &attr_nt_desc);
+
+      /* display the attribute's values unless user chose to suppress them or
+	there are no values stored */
+      if (dumpsds_opts->no_gattr_data == FALSE && attr_count != 0)
+      {
+         /* to be sure that attr_buf is free before reuse since sometimes we
+            have to break the current loop and continue to the next item */
+         resetBuff( &attr_buf );
+
+	 /* calculate the buffer size of the attribute using the number of
+	    values in the attribute and its value size */
+	 attr_buf_size = DFKNTsize(attr_nt) * attr_count;
+
+	 /* make sure we are not allocating 0 elements */
+	 CHECK_POS( attr_buf_size, "attr_buf_size", "print_SDattrs" );
+
+	 /* allocate space for the attribute's values */
+	 attr_buf = (VOIDP) HDmalloc(attr_buf_size);
+
+	 /* if allocation fails, handle the failure */
+	 CHECK_ALLOC( attr_buf, "attr_buf", "print_SDattrs" );
+
+	 /* read the values of the attribute into the buffer attr_buf */
+	 status = SDreadattr(sd_id, attr_index, attr_buf);
+	 if( status == FAIL )
+	    ERROR_CONT_2( "in %s: SDreadattr failed for %d'th attribute", 
+			"print_SDattrs", (int)attr_index );
+
+	 fprintf( fp,"\t\t Value = ");
+
+	 /* if the user wishes to have clean output, i.e. option -c is 
+	    selected - Note that this option is only applicable to DFNT_CHAR 
+	    type, the option will be ignored for other types */
+	 if( dumpsds_opts->clean_output && attr_nt == DFNT_CHAR )
+	 {
+	    status = dumpclean(attr_nt, dumpsds_opts, attr_count, attr_buf, fp);
+	    if( status == FAIL )
+		ERROR_CONT_2( "in %s: dumpclean failed for %d'th attribute", 
+			"print_SDattrs", (int)attr_index );
+	 }
+	 else  /* show tab, lf, null char... in octal as \011, \012, \000... */
+	 {
+	    status = dumpfull(attr_nt, dumpsds_opts, attr_count, attr_buf, fp,
+				ATTR_INDENT, ATTR_CONT_INDENT );
+	    if( status == FAIL )
+		ERROR_CONT_2( "in %s: dumpfull failed for %d'th attribute", 
+			"print_SDattrs", (int)attr_index );
+	 }
+      }  /* end of if no file attributes */
+   }  /* for each file attribute */
+
+   return( ret_value );
+}   /* end of print_SDattrs */
+
+intn print_SDSattrs( int32 sds_id,
+                int32 nattrs,
+                FILE *fp,
+	        dump_info_t *dumpsds_opts)
+{
+   int32 attr_index,
+         attr_count,
+         attr_nt,
+         attr_buf_size;
+   char  attr_name[MAXNAMELEN],
+        *attr_nt_desc = NULL;
+   VOIDP attr_buf=NULL;
+   intn  status = FAIL,   /* status returned from a called routine */
+         ret_value = SUCCEED; /* returned value of print_SDSattrs */
+
+   /* for each attribute, display its info and data */
+   for (attr_index = 0; attr_index < nattrs; attr_index++)
+   {
+      /* get the current attr's name, number type, and number of values */
+      status = SDattrinfo(sds_id, attr_index, attr_name, &attr_nt, &attr_count);
+      if (status == FAIL)
+         ERROR_CONT_2( "in %s: SDattrinfo failed for %d'th attribute", 
+			"print_SDSattrs", (int)attr_index );
+
+      /* calculate the buffer size of the attribute using the number of
+         values in the attribute and its value size */
+      attr_buf_size = DFKNTsize(attr_nt|DFNT_NATIVE) * attr_count;
+
+      /* make sure we are not allocating 0 elements */
+      CHECK_POS( attr_buf_size, "attr_buf_size", "print_SDSattrs" );
+
+      /* get number type description of the attribute */
+      attr_nt_desc = HDgetNTdesc(attr_nt);
+      if (attr_nt_desc == NULL)
+         ERROR_CONT_2( "in %s: HDgetNTdesc failed for %d'th attribute", 
+			"print_SDSattrs", (int)attr_index );
+
+      /* display the attribute's information */
+      fprintf(fp, "\t Attr%d: Name = %s\n", (int) attr_index, attr_name);
+      fprintf(fp, "\t\t Type = %s \n\t\t Count= %d\n", 
+			attr_nt_desc, (int) attr_count);
+
+      /* free buffer and reset it to NULL */
+      resetBuff((VOIDP) &attr_nt_desc);
+
+      /* display the attribute's values unless user chose to suppress them 
+	 or there are no values stored */
+      if (dumpsds_opts->no_lattr_data == FALSE && attr_count != 0)
+      {
+         /* to be sure that attr_buf is free before reuse since sometimes we
+            have to break the current loop and continue to the next item */
+         resetBuff( &attr_buf );
+
+	 /* allocate space for attribute's values */
+	 attr_buf = (VOIDP) HDmalloc(attr_buf_size);
+	 CHECK_ALLOC( attr_buf, "attr_buf", "print_SDSattrs" );
+
+	 /* read the values of the attribute into buffer attr_buf */
+	 status = SDreadattr(sds_id, attr_index, attr_buf);
+	 if (status == FAIL)
+            ERROR_CONT_2( "in %s: SDreadattr failed for %d'th attribute", 
+			"print_SDSattrs", (int)attr_index );
+
+	 fprintf(fp, "\t\t Value = ");
+
+	 /* if the user wishes to have clean output, i.e. option -c is 
+	    selected - Note that this option is only applicable to DFNT_CHAR 
+	    type, the option will be ignored for other types */
+	 if( dumpsds_opts->clean_output && attr_nt == DFNT_CHAR )
+	 {
+            status = dumpclean(attr_nt, dumpsds_opts, attr_count, attr_buf, fp);
+            if( status == FAIL )
+                ERROR_CONT_2( "in %s: dumpclean failed for %d'th attribute", 
+			"print_SDSattrs", (int)attr_index );
+	 }
+	 else  /* show tab, lf, null char... in octal as \011, \012, \000... */
+	 {
+            status = dumpfull(attr_nt, dumpsds_opts, attr_count, attr_buf, fp,
+				ATTR_INDENT, ATTR_CONT_INDENT );
+            if( status == FAIL )
+                ERROR_CONT_2( "in %s: dumpfull failed for %d'th attribute", 
+			"print_SDSattrs", (int)attr_index );
+	 }
+      }  /* end of if no local attributes */
+   } /* for each attribute */
+
+   return( ret_value );
+} /* end of print_SDSattrs */
+
+void resetSDS(
+	int32 *sds_id,
+	int32  sds_index,
+	char  *curr_file_name )
+{
+   if( *sds_id != FAIL )
+   {
+      if( FAIL == SDendaccess( *sds_id ))
+         fprintf(stderr,"SDendaccess failed for %d'th SDS in file %s\n",
+                    (int)sds_index, curr_file_name );
+      *sds_id = FAIL;
+   }
+}  /* end of resetSDS */
+
+/*
+ * Forms a string containing all the szip encoding schemes and other options
+ * that are set in the parameter options_mask.  BMR - bugzilla 1202 - Jul, 2008
+ */
+intn option_mask_string(int32 options_mask, char* opt_mask_strg)
+{
+    intn ret_value = SUCCEED;
+    char numval[10];
+
+    strcpy(opt_mask_strg, "");	/* init string to empty string */
+
+    /* just in case options_mask is invalid */
+    if (options_mask == 0)
+	ret_value = FAIL;
+
+    /* mask options_mask with each szip encoding schemes and options to 
+       form the associate option mask string */
+    if ((options_mask & H4_SZ_ALLOW_K13_OPTION_MASK) != 0)
+	strcpy(opt_mask_strg, "H4_SZ_ALLOW_K13_OPTION_MASK");
+    if ((options_mask & H4_SZ_CHIP_OPTION_MASK) != 0)
+    {
+	if (strlen(opt_mask_strg) > 0)
+	{
+	    strcat(opt_mask_strg, "|");
+	    strcat(opt_mask_strg, "H4_SZ_CHIP_OPTION_MASK");
+	}
+	else
+	    strcpy(opt_mask_strg, "H4_SZ_CHIP_OPTION_MASK");
+    }
+    if ((options_mask & H4_SZ_EC_OPTION_MASK) != 0)
+    {
+	if (strlen(opt_mask_strg) > 0)
+	{
+	    strcat(opt_mask_strg, "|");
+	    strcat(opt_mask_strg, "H4_SZ_EC_OPTION_MASK");
+	}
+	else
+	    strcpy(opt_mask_strg, "H4_SZ_EC_OPTION_MASK");
+    }
+    if ((options_mask & H4_SZ_LSB_OPTION_MASK) != 0)
+    {
+	if (strlen(opt_mask_strg) > 0)
+	{
+	    strcat(opt_mask_strg, "|");
+	    strcat(opt_mask_strg, "H4_SZ_LSB_OPTION_MASK");
+	}
+	else
+	    strcpy(opt_mask_strg, "H4_SZ_LSB_OPTION_MASK");
+    }
+    if ((options_mask & H4_SZ_MSB_OPTION_MASK) != 0)
+    {
+	if (strlen(opt_mask_strg) > 0)
+	{
+	    strcat(opt_mask_strg, "|");
+	    strcat(opt_mask_strg, "H4_SZ_MSB_OPTION_MASK");
+	}
+	else
+	    strcpy(opt_mask_strg, "H4_SZ_MSB_OPTION_MASK");
+    }
+    if ((options_mask & H4_SZ_NN_OPTION_MASK) != 0)
+    {
+	if (strlen(opt_mask_strg) > 0)
+	{
+	    strcat(opt_mask_strg, "|");
+	    strcat(opt_mask_strg, "H4_SZ_NN_OPTION_MASK");
+	}
+	else
+	    strcpy(opt_mask_strg, "H4_SZ_NN_OPTION_MASK");
+    }
+    if ((options_mask & H4_SZ_RAW_OPTION_MASK) != 0)
+    {
+	if (strlen(opt_mask_strg) > 0)
+	{
+	    strcat(opt_mask_strg, "|");
+	    strcat(opt_mask_strg, "H4_SZ_RAW_OPTION_MASK");
+	}
+	else
+	    strcpy(opt_mask_strg, "H4_SZ_RAW_OPTION_MASK");
+    }
+
+    /* also print the numerical value of the options mask */
+    sprintf(numval, " (%d)", options_mask);
+    strcat (opt_mask_strg, numval);
+
+    return(ret_value);
+}   /* option_mask_string */
+ /* #endif
+ */ 
+
+/*
+ * Prints compression method and compression information of a data set.
+ * BMR - bugzilla 1202 - Jul, 2008
+ */
+intn print_comp_info(
+	FILE *fp,
+	int32 sds_id,
+	comp_coder_t *comp_type)
+{
+   comp_info c_info;                /* Compression structure */
+   int32 comp_size=0, orig_size=0;  /* compressed and original sizes */
+   intn status = FAIL;	    /* returned status from a called function */
+
+   /* get compression info */
+   HDmemset(&c_info, 0, sizeof(c_info));
+   status = SDgetcompinfo(sds_id, comp_type, &c_info);
+
+   /* if getting comp info succeeds, proceed to print out appropriate 
+      compression information */
+   if (status != FAIL)
+   {
+      /* print compression method or "NONE" */
+      fprintf(fp, "\t Compression method = %s\n", comp_method_txt(*comp_type));
+
+      switch (*comp_type)
+      {
+        case COMP_CODE_SKPHUFF:
+	    fprintf(fp, "\t\t Skipping unit size = %d\n", c_info.skphuff.skp_size);
+	    break;
+	case COMP_CODE_DEFLATE:
+	    fprintf(fp, "\t\t Deflate level = %d\n", c_info.deflate.level);
+	    break;
+	case COMP_CODE_SZIP:
+	{
+	    char mask_strg[160]; /* 160 is to cover all options and number val*/
+	    if (option_mask_string(c_info.szip.options_mask, mask_strg) != FAIL)
+		fprintf(fp, "\t\t Option mask = %s\n", mask_strg);
+	    else
+		fprintf(fp, "\t\t Option mask might be invalid = %d\n", (int)c_info.szip.options_mask);
+	    fprintf(fp, "\t\t Pixels per block = %d\n", (int)c_info.szip.pixels_per_block);
+	    fprintf(fp, "\t\t Pixels per scanline = %d\n", (int)c_info.szip.pixels_per_scanline);
+	    fprintf(fp, "\t\t Bits per pixel = %d\n", (int)c_info.szip.bits_per_pixel);
+	    fprintf(fp, "\t\t Pixels = %d\n", (int)c_info.szip.pixels);
+	    break;
+	}
+        default:
+	    /* nothing */
+	    break;
+      } /* switch */
+   }
+   else
+      fprintf(fp, "\t Compression method = <Unable to get compression method>\n");
+
+   /* print compression ratio */
+   if (*comp_type != COMP_CODE_NONE)
+   {
+   status = SDgetdatasize(sds_id, &comp_size, &orig_size);
+   if (status != FAIL)
+   {
+      /* calculate and print compression ratio */
+      if (comp_size > 0 && orig_size > 0)
+      {
+         double orig=orig_size, comp=comp_size, ratio = 0.00;
+	 ratio = orig/comp;
+	 fprintf(fp, "\t Compression ratio (original:compressed) = %.2f:1\n", ratio);
+      }
+      else if (comp_size == 0 && orig_size == 0)
+      {
+	 fprintf(fp, "\t Compression ratio = <No data written yet!\n");
+      }
+      else  /* any size < 0 means something wrong */
+	 fprintf(fp, "\t Compression ratio = <Unable to get data sizes\n");
+   }
+   else
+      fprintf(fp, "\t Compression ratio = <Unable to determine compression ratio>\n");
+   }
+   return(status);
+} /* print_comp_info */
+
+
+/* printSDS_ASCII prints all of the requested SDSs in the file */
+intn printSDS_ASCII( 
+	int32 sd_id,
+	dump_info_t *dumpsds_opts,
+	int32 sds_index,    /* index of the SDS */
+	FILE *fp )
+{
+   int32 sds_id = FAIL, /* SDS id, always reset to FAIL when not used */
+         sds_ref,       /* ref# of an SDS */
+         dim_id = FAIL, /* id of an SDS dimension */
+         rank,          /* number of dimensions of an SDS */
+         nt,            /* number type of an SDS */
+         nattrs,        /* # of attributes assigned to an SDS */
+         dimsizes[MAXRANK],     /* SDS dimensions */
+         dimNT[MAXRANK],        /* number type of dimension */
+         dimnattr[MAXRANK];     /* # of attributes of a dim */
+   char  dim_nm[MAXNAMELEN],    /* dimension name */
+         *sdsname = NULL,	/* SDS name */
+         *nt_desc = NULL,       /* SDS's or dim's num type description */
+         *attr_nt_desc = NULL,  /* attr's nt description */
+         curr_file_name[MAXFNLEN]; /* curr hdf file name */
+   uint16 name_len=0;
+   comp_coder_t comp_type = COMP_CODE_NONE;
+   intn  isdimvar,      /* TRUE if curr SDS is used for a dim */
+         j,
+         status = FAIL,		/* status returned from a routine */
+         ret_value = SUCCEED;	/* returned value of printSDS_ASCII */
+
+      /* Reset variables. */
+      HDmemset(dimsizes, 0, sizeof(int32) * MAXRANK);
+      HDmemset(dimNT, 0, sizeof(int32) * MAXRANK);
+      HDmemset(dimnattr, 0, sizeof(int32) * MAXRANK);
+
+      /* get access to the current dataset */
+      sds_id = SDselect(sd_id, sds_index);
+      if (sds_id == FAIL)
+         ERROR_GOTO_3( "in %s: %s failed for %d'th SDS",
+                      "printSDS_ASCII", "SDselect", (int)sds_index );
+
+      status = SDgetnamelen(sds_id, &name_len);
+      if( FAIL == status )
+      {
+         ERROR_GOTO_3( "in %s: %s failed for %d'th SDS",
+			"printSDS_ASCII", "SDgetnamelen", (int)sds_index );
+      }
+
+      /* allocate space for sds name */
+      sdsname = (char *) HDmalloc(name_len+1);
+      CHECK_ALLOC( sdsname, "sdsname", "printSDS_ASCII" );
+
+      /* get dataset's information */
+      status = SDgetinfo(sds_id, sdsname, &rank, dimsizes, &nt, &nattrs);
+      if( status == FAIL )
+      {
+         ERROR_GOTO_3( "in %s: %s failed for %d'th SDS", 
+                       "printSDS_ASCII", "SDgetinfo", (int)sds_index );
+      }
+
+      /* BMR: it seems like this whole block of code is to get number
+         type of dim0, all the other info will be discarded */
+      isdimvar = (SDiscoordvar(sds_id)) ? TRUE : FALSE;
+      if (isdimvar) 
+      { /* use dim0 nt instead of dimvar nt, because when no dim values 
+           dimvar nt was set to float32 by default */
+         int32 size, num_attrs;
+
+         /* get dimension id for accessing */
+         dim_id = SDgetdimid(sds_id, 0);
+         if( dim_id == FAIL )
+         {
+            ERROR_GOTO_3( "in %s: %s failed for %d'th SDS", 
+                       "printSDS_ASCII", "SDgetdimid", (int)sds_index );
+         }
+
+         /* get information of current dimension */
+         if( SDdiminfo(dim_id, NULL, &size, &nt, &num_attrs) == FAIL )
+         {
+            ERROR_GOTO_3( "in %s: %s failed for %d'th SDS", 
+                       "printSDS_ASCII", "SDdiminfo", (int)sds_index );
+         }
+      }                                                       
+      /* print the current SDS's as specified by user's options */
+      switch (dumpsds_opts->contents)
+      {
+         case DVERBOSE:
+         case DHEADER:
+            nt_desc = HDgetNTdesc(nt);
+            if (nt_desc == NULL)
+            {
+               ERROR_BREAK_3( "in %s: %s failed for %d'th SDS", 
+			"printSDS_ASCII", "HDgetNTdesc", (int)sds_index, FAIL );
+               /* did this one fail on allocation and need exit(1)? */
+            }
+
+            /* Note: a variable can be used to hold an SDS or a dimension. */
+            /* display dimension info if the variable is used to contain a
+               dimension */
+            if (isdimvar)
+            {
+               fprintf(fp, "\nDimension Variable Name = %s\n\t ", sdsname);
+               fprintf(fp, "Index = %d\n\t Scale Type= %s\n", 
+						(int)sds_index, nt_desc);
+            }
+            /* display the SDS info, otherwise */
+            else
+            {
+               fprintf(fp, "\nVariable Name = %s\n\t Index = ", sdsname);
+               fprintf(fp, "%d\n\t Type= %s\n", (int)sds_index, nt_desc);
+            }
+
+            resetBuff((VOIDP) &nt_desc );  /* done with nt_desc */
+
+	    /* If the current file is not a netCDF, print the SDS' ref#
+	       and compression information */
+	    if(dumpsds_opts->file_type == HDF_FILE)
+	    {
+		/* get SDS's ref# from its id */
+	  	sds_ref = SDidtoref(sds_id);
+		if (sds_ref == FAIL)
+		    ERROR_BREAK_3( "in %s: %s failed for %d'th SDS", 
+			"printSDS_ASCII", "SDidtoref", (int)sds_index, FAIL );
+		fprintf(fp, "\t Ref. = %d\n", (int) sds_ref);
+
+                /* print compression method and info or "NONE" */
+		status = print_comp_info(fp, sds_id, &comp_type);
+		if (status == FAIL)
+		{
+                    ERROR_GOTO_3( "in %s: %s failed for %d'th SDS",
+                       "printSDS_ASCII", "print_comp_info", (int)sds_index );
+                }
+            }
+            fprintf(fp, "\t Rank = %d\n\t Number of attributes = %d\n",
+                                        (int) rank, (int) nattrs);
+
+            /* print each dimension of the current SDS */
+            for (j = 0; j < rank; j++)
+            {
+               int32 size;    /* size of the current dimension */
+
+               /* get current dimension id for access */
+               if (FAIL == (dim_id = SDgetdimid(sds_id, j)))
+                  ERROR_BREAK_3( "in %s: %s failed for %d'th SDS", 
+			"printSDS_ASCII", "SDgetdimid", (int)sds_index, FAIL );
+
+               /* get information of current dimension */
+               ret_value = SDdiminfo(dim_id,dim_nm,&size,&(dimNT[j]),&(dimnattr[j]));
+               if (FAIL == ret_value )
+                  ERROR_BREAK_4( "in %s: %s failed for %d'th dimension of %d'th SDS", 
+			"printSDS_ASCII", "SDdiminfo", j, (int)sds_index, FAIL );
+
+               fprintf(fp, "\t Dim%d: Name=%s\n", (int) j, dim_nm);
+               if (size == 0)
+               {
+                  fprintf(fp, "\t\t Size = UNLIMITED ");
+                  fprintf(fp, "(currently %d)\n", (int) dimsizes[j]);
+               }
+               else
+                  fprintf(fp, "\t\t Size = %d\n", (int) dimsizes[j]);
+
+               /* don't print type and # of attrs for dim var */
+               if (isdimvar == 0)
+               {  
+                  attr_nt_desc = HDgetNTdesc(dimNT[j]);
+                  if (attr_nt_desc == NULL)
+                     ERROR_BREAK_4( "in %s: %s failed for %d'th dimension of %d'th SDS", 
+		     "printSDS_ASCII", "HDgetNTdesc", j, (int)sds_index, FAIL);
+
+                  fprintf(fp, "\t\t Scale Type = %s\n", attr_nt_desc);
+                  fprintf(fp, "\t\t Number of attributes = %d\n", (int) dimnattr[j]);
+                  resetBuff((VOIDP) &attr_nt_desc);
+               }
+            } /* end each for dimension */
+
+            /* print dataset's attributes */
+            status = print_SDSattrs(sds_id, nattrs, fp, dumpsds_opts);
+            if( status == FAIL )
+               ERROR_BREAK_3( "in %s: %s failed for %d'th SDS",
+		"printSDS_ASCII", "print_SDSattrs", (int)sds_index, FAIL );
+
+            /* header only, don't go into case DDATA */
+            if (dumpsds_opts->contents == DHEADER)
+               break;
+
+            /* case DDATA doesn't need this */
+            fprintf(fp, "\t Data : \n");
+
+         case DDATA:
+	    if (comp_type == COMP_CODE_SZIP && have_szip == 0)
+	    {
+		fprintf(fp, "\t\t <SZIP library is not available>\n");
+		fprintf(fp, "\t\t <Unable to read SZIP compressed data>\n");
+	    }
+	    else {
+            if (rank > 0 && dimsizes[0] != 0)
+            {
+               if (!isdimvar || nt != 0)
+               { /* no dump if dimvar w/o scale values */
+                  status = sdsdumpfull( sds_id, dumpsds_opts, rank, dimsizes, nt, fp);
+                  if( FAIL == status )
+                     ERROR_BREAK_3( "in %s: %s failed for %d'th SDS", 
+			"printSDS_ASCII", "sdsdumpfull", (int)sds_index, FAIL );
+               }
+            } }
+            break;
+         default:
+            printf("Output format must be either -d, -h, or -v only.\n");
+      }	 /* switch  */
+
+      resetSDS( &sds_id, sds_index, curr_file_name ); /* end access to current SDS */
+      SAFE_FREE(sdsname);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+        if (sds_id != FAIL)
+            SDendaccess(sds_id);
+	SAFE_FREE(sdsname);
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* end of printSDS_ASCII() */
+
+intn printSDS_BINARY(
+	int32 sd_id,
+	dump_info_t *dumpsds_opts,
+	int32 sds_index,    /* index of the SDS */
+	FILE *fp )
+{
+   int32 sds_id=FAIL,
+         dimsizes[MAXRANK],
+         rank,
+         nt,
+         nattrs;
+   char  curr_file_name[MAXFNLEN];
+   comp_coder_t comp_type=COMP_CODE_NONE;
+   intn  status=FAIL,
+         ret_value=SUCCEED;
+   
+    /* temp. names for file type and curr input file name for ease of use */
+    HDstrcpy( curr_file_name, dumpsds_opts->ifile_name );
+
+    /* Reset variable */
+    HDmemset(dimsizes, 0, sizeof(int32) * MAXRANK);
+
+    sds_id = SDselect(sd_id, sds_index);
+    if (sds_id == FAIL)
+         ERROR_GOTO_3( "in %s: %s failed for %d'th SDS",
+			"printSDS_BINARY", "SDselect", (int)sds_index );
+
+    status = SDgetinfo(sds_id, NULL, &rank, dimsizes, &nt, &nattrs);
+    if( FAIL == status )
+    {
+	resetSDS( &sds_id, sds_index, curr_file_name );
+	ERROR_GOTO_3( "in %s: %s failed for %d'th SDS",
+			"printSDS_BINARY", "SDgetinfo", (int)sds_index );
+    }
+
+    /* get compression method and if szipped compressed data is being read,
+       make sure that szip library is available before reading */
+    status = SDgetcomptype(sds_id, &comp_type);
+    if (comp_type == COMP_CODE_SZIP && have_szip == 0)
+    {
+	fprintf(fp, "\t\t <SZIP library is not available>\n");
+	fprintf(fp, "\t\t <Unable to read SZIP compressed data>\n");
+    }
+    else { /* can output data to binary file   */
+	if (rank > 0 && dimsizes[0] != 0)
+	{
+	    status = sdsdumpfull(sds_id, dumpsds_opts, rank, dimsizes, nt, fp);
+            if( FAIL == status )
+               ERROR_GOTO_3( "in %s: %s failed for %d'th SDS", 
+			"printSDS_BINARY", "sdsdumpfull", (int)sds_index );
+	}
+    } /* can output data */
+    resetSDS( &sds_id, sds_index, curr_file_name );
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (sds_id != FAIL)
+              SDendaccess(sds_id);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* end of printSDS_BINARY */
+
+intn dsd(dump_info_t *dumpsds_opts, 
+    intn         curr_arg, 
+    intn         argc, 
+    char        *argv[])
+{
+   int32  sd_id=FAIL,
+         *sds_chosen=NULL,
+          num_sds_chosen,
+          ndsets,
+          n_file_attrs;
+   char   file_name[MAXFNLEN];
+   FILE  *fp=NULL;
+   file_format_t ff = dumpsds_opts->file_format;
+   intn   index_error=0,
+	  ii,
+          status=FAIL,
+          ret_value=SUCCEED;
+
+   /* check for missing input file name */
+   if( curr_arg >= argc )
+   {
+      fprintf( stderr, "Missing input file name.  Please try again.\n");
+      return( FAIL ); /* nothing to be cleaned up at this point */
+   }
+
+   /* going through each input file, open the file, try to compose the list
+      of indices of the SDSs in the file that are requested, then read and
+      display information and data of each SDS in the specified manner */
+   while (curr_arg < argc)
+   {
+      HDstrcpy(file_name, argv[curr_arg]); /* get current file name */
+      HDstrcpy( dumpsds_opts->ifile_name, file_name ); /* record file name */
+      curr_arg++; /* move argument pointer forward */
+
+      if (HDisnetcdf(file_name)) /* record if file is netCDF */
+         dumpsds_opts->file_type = netCDF_FILE;
+      else if (Hishdf(file_name)) /* record if file is HDF */
+         dumpsds_opts->file_type = HDF_FILE;
+      else
+      {
+         /* if there are no more files to be processed, print informative
+            message, then returns with FAIL */
+	 if( curr_arg == argc )
+	    {ERROR_GOTO_1( "in dsd: %s is not an HDF or netCDF file", file_name);}
+         else /* print message, then continue processing the next file */
+            {ERROR_CONT_1( "in dsd: %s is not an HDF or netCDF file", file_name);}
+      }
+	 
+      /* open current hdf file with error check, if fail, go to next file */
+      sd_id = SDstart(file_name, DFACC_RDONLY);
+      if (sd_id == FAIL)
+      {
+	 /* if there are no more files to be processed, print error 
+	    message, then returns with FAIL */
+	 if( curr_arg == argc )
+            {ERROR_GOTO_1( "in dsd: Failure in opening file %s", file_name);}
+	 else /* print message, then continue processing the next file */
+            ERROR_CONT_1( "in dsd: Failure in opening file %s", file_name );
+      }
+
+      /* compose the list of indices of SDSs to be processed in the current 
+         file: sds_chosen is the list and return value is the number of items
+	 in the list */
+      num_sds_chosen = get_SDSindex_list( sd_id, dumpsds_opts, &sds_chosen, &index_error );
+
+      /* if there are errors with the given indices, ref#s, or names of the
+         requested datasets, and so the input yields no valid datasets,
+         then close the interface and the input file, and move on to the
+         next file */
+      if (index_error && num_sds_chosen == 0)
+      {
+         if(sds_chosen!=NULL)
+         {
+            HDfree(sds_chosen);
+            sds_chosen=NULL;
+         } /* end if */
+         if( FAIL == SDend(sd_id))
+            fprintf( stderr, "in dsd: SDend failed in closing file %s\n",
+			file_name );
+         continue; /* to the next file */
+      } /* end if */
+
+      /* obtain number of datasets in the file and number of file
+	attributes, ndsets will be used to process the datasets,
+	n_file_attrs will be used to print file attributes */
+      status = SDfileinfo(sd_id, &ndsets, &n_file_attrs);
+      if (status == FAIL)
+	  ERROR_GOTO_2( "in dsd: %s failed for file %s", "SDfileinfo", file_name);
+
+      fp = stdout;                /* assume no output file given */
+
+      /* ASCII or binary dump? */
+      switch( ff )
+      {
+         case DASCII:       /* ASCII file */
+            /* open output file for ASCII or direct to standard output */
+            if (dumpsds_opts->dump_to_file)
+               fp = fopen(dumpsds_opts->file_name, "w");
+
+            /* display the name and global attributes of the current file if
+               data only option is not selected */
+            if (dumpsds_opts->contents != DDATA)
+            {
+               fprintf(fp, "File name: %s \n", file_name);
+
+               /* print SD file attributes */
+               status = print_SDattrs( sd_id, fp, n_file_attrs, dumpsds_opts );
+               if( status == FAIL )
+                  ERROR_CONT_2( "in dsd: %s failed for file %s", file_name, "print_SDattrs" );
+            }
+
+	    /* If the user requests to dump the SDSs in the order they were
+	       given, -k given */
+	    if (dumpsds_opts->keep_order)
+	    {
+		for (ii = 0; ii < num_sds_chosen; ii++)
+		{
+		    /* Print the current SDS in ASCII format */
+		    status = printSDS_ASCII(sd_id, dumpsds_opts, sds_chosen[ii], fp);
+		    if( status == FAIL )
+			fprintf( stderr, "HDP ERROR>>> in dsd: %s failed for file %s\n", 
+				"printSDS_ASCII", file_name );
+		}
+	    } /* if: -k given */
+
+	    else /* no -k */
+	    {
+		int32 sds_count, sds_index;
+		intn dumpall = FALSE;
+
+		/* if only specific datasets were requested, sort the list
+		   to dump them in index order */
+		if (num_sds_chosen == NO_SPECIFIC )
+		    dumpall = TRUE;
+		else
+		    sort(sds_chosen, num_sds_chosen);
+
+		sds_count = 0;   /* no SDS has been processed yet */
+		/* For each index, if the user requests to dump all SDSs or if
+		   there are more requested SDSs, process the curr SDS */
+		for (sds_index = 0; sds_index < ndsets  /* validate index */
+		     && (dumpall      /* either all datasets are dumped or */
+		     || sds_count < num_sds_chosen);/* or more requested SDSs */
+		     sds_index++)
+		{
+		/* If the user neither requests dump all nor the current SDS */
+		if ((!dumpall) && (sds_index != sds_chosen[sds_count]))
+		    continue; /* skip */
+
+		/* Count the # of datasets being processed */
+		sds_count++;
+
+		/* Print the current SDS in ASCII format */
+		status = printSDS_ASCII(sd_id, dumpsds_opts, sds_index, fp);
+		if( status == FAIL )
+		    fprintf(stderr,
+				"HDP ERROR>>> in dsd: %s failed for file %s\n", 
+				"printSDS_ASCII", file_name );
+		}
+	    } /* else: no -k */
+
+            /* Close output file only if option -o is given */
+            if (dumpsds_opts->dump_to_file)
+               fclose(fp);                       
+            break;
+
+         case DBINARY:       /* binary file */
+             /* Get output file name  */
+             if (dumpsds_opts->dump_to_file)
+                 fp = fopen(dumpsds_opts->file_name, "wb");
+
+	    /* If the user requests to dump the SDSs in the order they were
+	       given, -k given */
+	    if (dumpsds_opts->keep_order)
+	    {
+		for (ii = 0; ii < num_sds_chosen; ii++)
+		{
+		    /* Print the current SDS in BINARY format */
+		    status = printSDS_BINARY(sd_id, dumpsds_opts, sds_chosen[ii], fp);
+		    if( status == FAIL )
+			fprintf( stderr, "HDP ERROR>>> in dsd: %s failed for file %s\n", 
+				"printSDS_BINARY", file_name );
+		}
+	    } /* if: -k given */
+
+	    else /* no -k */
+	    {
+		int32 sds_count, sds_index;
+		intn dumpall = FALSE;
+
+		/* if only specific datasets were requested, sort the list
+		   to dump them in index order */
+		if (num_sds_chosen == NO_SPECIFIC )
+		    dumpall = TRUE;
+		else
+		    sort(sds_chosen, num_sds_chosen);
+
+		sds_count = 0;   /* no SDS has been processed yet */
+		/* For each index, if the user requests to dump all SDSs or if
+		   there are more requested SDSs, process the curr SDS */
+		for (sds_index = 0; sds_index < ndsets  /* validate index */
+		     && (dumpall      /* either all datasets are dumped or */
+		     || sds_count < num_sds_chosen);/* or more requested SDSs */
+		     sds_index++)
+		{
+		/* If the user neither requests dump all nor the current SDS */
+		if ((!dumpall) && (sds_index != sds_chosen[sds_count]))
+		    continue; /* skip */
+
+		/* Count the # of datasets being processed */
+		sds_count++;
+
+		/* Print the current SDS in BINARY format */
+		status = printSDS_BINARY(sd_id, dumpsds_opts, sds_index, fp);
+		if( status == FAIL )
+		    fprintf(stderr,
+				"HDP ERROR>>> in dsd: %s failed for file %s\n", 
+				"printSDS_BINARY", file_name );
+		}
+	    } /* else: no -k */
+
+            /* Close output file only if option -o is given */
+            if (dumpsds_opts->dump_to_file)
+               fclose(fp);                       
+            break;
+
+         default:
+            printf("Output file type must be either ascii or binary only\n");
+      } /* switch for output file */
+
+      if (sds_chosen != NULL)
+      {
+         HDfree(sds_chosen);
+         sds_chosen = NULL;
+      } /* end if */
+
+      if (FAIL == SDend(sd_id))
+         ERROR_CONT_1( "in dsd: SDend failed for file %s", file_name );
+      sd_id = FAIL; /* reset */
+
+   }  /* while processing files  */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (sd_id != FAIL)
+              SDend(sd_id);
+
+          if (fp != NULL && fp != stdout)
+              fclose(fp);                       
+
+	  SAFE_FREE(sds_chosen);
+      }
+    /* Normal cleanup */
+    return ret_value;
+}	/* dsd */
+
+/* Exported */
+intn do_dumpsds(intn  curr_arg, 
+           intn  argc, 
+           char *argv[], 
+           intn  help )
+{
+    dump_info_t dumpsds_opts;	/* dumpsds options */
+    intn status=FAIL, ret_value=SUCCEED;
+
+   /* initialize the structure that holds user's options and inputs */
+   init_dump_opts(&dumpsds_opts);
+
+   /* command line: hdp help */
+   if (help == TRUE)
+   {
+      dumpsds_usage(argc, argv);
+      goto done;
+   }  /* end if */
+
+   /* incomplete command */
+   if( curr_arg >= argc )
+   {
+      dumpsds_usage(argc, argv);
+      ERROR_GOTO_0( "in do_dumpsds: command is incomplete");
+   }            /* end if */
+
+   /* parse the user's command and store the inputs in dumpsds_opts */
+   status = parse_dumpsds_opts( &dumpsds_opts, &curr_arg, argc, argv );
+   if( status == FAIL )
+   {
+      dumpsds_usage(argc, argv);
+      ret_value = FAIL; /* so caller can be traced in debugging */
+      goto done; /* skip dsd */
+   }
+
+   /* display data and information as specified in dumpsds_opts */
+   status = dsd( &dumpsds_opts, curr_arg, argc, argv );
+   if( status == FAIL )
+      ERROR_GOTO_0( "in do_dumpsds: dsd failed" );
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    /* free the list of structs containg info of selected SDSs */
+    free_obj_chosen_t_list(&dumpsds_opts.all_types, dumpsds_opts.num_chosen);
+
+   return ret_value;
+}	/* end do_dumpsds() */
+
diff --git a/mfhdf/dumper/hdp_util.c b/mfhdf/dumper/hdp_util.c
new file mode 100644
index 0000000..0f56489
--- /dev/null
+++ b/mfhdf/dumper/hdp_util.c
@@ -0,0 +1,1004 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)1.1";
+#endif
+
+/* hdp_util.c,v 1.1 1994/04/18 15:49:18 georgev Exp */
+
+#include "hdp.h"
+
+const char *unknown_tag = "Unknown Tag";
+
+char       *
+tagnum_to_name(intn num)
+{
+    char       *ret;
+
+    if (num < 0)
+	ret = NULL;
+    else
+	ret = HDgettagsname((uint16)num);
+    if (ret == NULL)
+        ret = HDstrdup(unknown_tag);
+    return (ret);
+}	/* end tagnum_to_name() */
+
+intn tagname_to_num(const char *name)
+{
+    return (HDgettagnum(name));
+}	/* end tagname_to_num() */
+
+/*
+ *  Routines to create a list of file names from the command line
+ */
+/* assumes that curr_arg is pointing to the first file name */
+filelist_t *
+make_file_list(intn curr_arg, intn argc, char *argv[])
+{
+    intn        i;
+    filelist_t *ret;
+
+    if (curr_arg > argc)	/* consistency check */
+        return (NULL);
+
+   ret = (filelist_t *) HDmalloc(sizeof(filelist_t));
+    if (ret == NULL)
+      {
+          fprintf(stderr, "make_file_list: space allocation failed\n");
+          return (NULL);
+      }
+    ret->file_arr = (char **) HDmalloc(sizeof(char *) * ((argc - curr_arg) + 1));
+    if (ret->file_arr == NULL)
+      {
+          fprintf(stderr, "make_file_list: space allocation failed\n");
+          HDfree(ret);
+          return (NULL);
+      }		/* end if */
+
+    ret->max_files = (argc - curr_arg);
+    ret->curr_file = 0;
+    for (i = 0; curr_arg < argc; i++, curr_arg++)
+        ret->file_arr[i] = HDstrdup(argv[curr_arg]);
+    return (ret);
+}	/* end make_file_list() */
+
+char * get_next_file(filelist_t * f_list, intn advance)
+{
+    if (advance)
+        f_list->curr_file++;
+    if (f_list->curr_file >= f_list->max_files)
+        return (NULL);
+    return (f_list->file_arr[f_list->curr_file]);
+}	/* end get_next_file() */
+
+/* free_node_vg_info_t frees a node of vgroup info */
+vg_info_t* free_node_vg_info_t(
+                vg_info_t* aNode)
+{
+   intn i;
+
+   if( aNode != NULL )
+   {
+      if (aNode->children != NULL)
+      {
+         for (i = 0; i < aNode->n_entries; i++)
+            if (aNode->children[i] != NULL)
+	    {
+                HDfree(aNode->children[i]);
+		aNode->children[i] = NULL;
+	    }
+         HDfree( aNode->children );
+	 aNode->children = NULL;
+      }
+      if (aNode->type != NULL)
+      {
+         for (i = 0; i < aNode->n_entries; i++)
+            if (aNode->type[i] != NULL)
+	    {
+                HDfree(aNode->type[i]);
+		aNode->type[i] = NULL;
+	    }
+         HDfree( aNode->type );
+	 aNode->type = NULL;
+      }
+      if (aNode->vg_name != NULL)
+      {
+         HDfree(aNode->vg_name);
+	 aNode->vg_name = NULL;
+      }
+      HDfree(aNode);
+      aNode = NULL;
+   }
+   return(NULL);
+}  /* end of free_node_vg_info_t */
+
+/* free_struct_list use HDfree to free the list of vgroup info structs */
+vg_info_t ** free_vginfo_list( 
+		vg_info_t **nodelist,
+		int32 num_items )
+{
+   intn i;
+
+   /* if the list is not NULL, free each node then reset the list to NULL */
+   if (nodelist != NULL)
+   {
+      for (i = 0; i < num_items; i++)
+         if (nodelist[i] != NULL)
+            nodelist[i] = free_node_vg_info_t(nodelist[i]);
+      HDfree(nodelist);
+   }
+   return( NULL );
+}  /* end of free_vginfo_list */
+
+/* free_struct_list use HDfree to free the list of vgroup info structs */
+obj_chosen_t ** free_node_obj_chosen_t( 
+		obj_chosen_t *aNode)
+{
+   if( aNode != NULL )
+   {
+      if (aNode->name != NULL)
+      {
+		fprintf(stderr, " namd = %s \n", aNode->name);
+         HDfree( aNode->name );
+      }
+      if (aNode->classname != NULL)
+      {
+         HDfree( aNode->classname );
+      }
+      HDfree(aNode);
+   }
+   return(NULL);
+}  /* end of free_vginfo_list */
+
+/* free_struct_list use HDfree to free the list of vgroup info structs */
+void free_obj_chosen_t_list( 
+		obj_chosen_t **nodelist,
+		int32 num_items )
+{
+   intn i;
+
+   /* if the list is not NULL, free each node then reset the list to NULL */
+   if ((*nodelist) != NULL)
+   {
+      for (i = 0; i < num_items; i++)
+      {
+	    if ((*nodelist)[i].name != NULL)
+	    {
+		HDfree((*nodelist)[i].name);
+	    }
+	    if ((*nodelist)[i].classname != NULL)
+	    {
+		HDfree((*nodelist)[i].classname);
+	    }
+      }
+      HDfree((*nodelist));
+      (*nodelist) = NULL;
+   }
+}  /* end of free_vginfo_list */
+
+/* free_str_list use HDfree to free the list of strings of characters */
+char** free_str_list( char **str_list,
+               int32 num_items )
+{
+   intn i;
+
+   if( str_list != NULL)
+   {
+      for( i = 0; i < num_items; i++ )
+         if (str_list[i] != NULL)
+            HDfree(str_list[i]);
+      HDfree( str_list );
+   }
+   return( NULL );
+}  /* end of free_str_list */
+
+/* free_num_list use HDfree to free the list of integers; this routine
+   is short but can be used in many different places and very convenient */
+int32* free_num_list( int32 *num_list )
+{
+   if( num_list != NULL)
+      HDfree( num_list );
+   return( NULL );
+}  /* end of free_num_list */
+
+void 
+free_file_list(filelist_t * f_list)
+{
+    intn        i;
+
+    for (i = 0; i < f_list->max_files; i++)
+        HDfree(f_list->file_arr[i]);
+    HDfree(f_list->file_arr);
+    HDfree(f_list);
+}	/* end free_file_list() */
+
+/*
+ *  Routines to manipulate group lists
+ */
+groupinfo_t *
+make_group_list(int32 fid, uint16 tag, uint16 ref)
+{
+    intn        nobj;
+    intn        i;
+    groupinfo_t *ret;
+    int32       gid;
+
+    if (tag == DFTAG_RIG || tag == DFTAG_SDG || tag == DFTAG_NDG)
+      {
+          if ((gid = DFdiread(fid, tag, ref)) == FAIL)
+              return (NULL);
+          if ((nobj = DFdinobj(gid)) == FAIL)
+              return (NULL);
+          if ((ret = (groupinfo_t *) HDmalloc(sizeof(groupinfo_t))) == NULL)
+            {
+                fprintf(stderr, "make_group_list: space allocation failed\n");
+                return (NULL);
+            }
+          ret->max_dds = nobj;
+          ret->curr_dd = 0;
+          if (nobj > 0)
+            {
+                if ((ret->dd_arr = (DFdi *) HDmalloc(sizeof(DFdi) * nobj)) == NULL)
+                  {
+                      fprintf(stderr, "make_group_list: space allocation failed\n");
+                      HDfree(ret);
+                      return (NULL);
+                  }		/* end if */
+                for (i = 0; i < nobj; i++)
+                  {
+                      if (DFdiget(gid, &ret->dd_arr[i].tag, &ret->dd_arr[i].ref) == FAIL)
+                        {
+                            HDfree(ret->dd_arr);
+                            HDfree(ret);
+                            return (NULL);
+                        }	/* end if */
+                  }		/* end for */
+            }	/* end if */
+          else
+            {	/* paranoia sets in... */
+                ret->max_dds = ret->curr_dd = 0;
+                ret->dd_arr = NULL;
+            }	/* end else */
+      }		/* end if */
+    else
+      {		/* check for Vgroup? */
+          int32       vkey;
+
+/* Yes, I know this wastes time, but at least it allows uniform access */
+/* to both types of groups in HDF files... */
+          if (vinit_done == FALSE)
+            {	/* check whether we've already init'ed Vsets */
+                vinit_done = TRUE;
+                Vinitialize(fid);
+            }	/* end if */
+          if ((vkey = Vattach(fid, ref, "r")) != FAIL)
+            {
+                if ((nobj = Vntagrefs(vkey)) != FAIL)
+                  {
+		   if( nobj > 0 ) { /* Albert fixed */
+                      int32      *temp_tag;
+                      int32      *temp_ref;
+
+                      if ((temp_tag = (int32 *) HDmalloc(sizeof(int32) * nobj)) == NULL)
+                        {
+			    fprintf(stderr, "make_group_list: space allocation failed\n");
+                            Vdetach(vkey);
+                            return (NULL);
+                        }	/* end if */
+                      if ((temp_ref = (int32 *) HDmalloc(sizeof(int32) * nobj)) == NULL)
+                        {
+			    fprintf(stderr, "make_group_list: space allocation failed\n");
+
+                            Vdetach(vkey);
+                            HDfree(temp_tag);
+                            return (NULL);
+                        }	/* end if */
+
+                      if (Vgettagrefs(vkey, temp_tag, temp_ref, nobj) == FAIL)
+                        {
+                            Vdetach(vkey);
+                            HDfree(temp_tag);
+                            HDfree(temp_ref);
+                            return (NULL);
+                        }	/* end if */
+
+                      if ((ret = (groupinfo_t *) HDmalloc(sizeof(groupinfo_t))) == NULL)
+                        {
+			    fprintf(stderr, "make_group_list: space allocation failed\n");
+
+                            Vdetach(vkey);
+                            HDfree(temp_tag);
+                            HDfree(temp_ref);
+                            return (NULL);
+                        }	/* end if */
+                      ret->max_dds = nobj;
+                      ret->curr_dd = 0;
+                      if ((ret->dd_arr = (DFdi *) HDmalloc(sizeof(DFdi) * nobj)) == NULL)
+                        {
+			    fprintf(stderr, "make_group_list: space allocation failed\n");
+
+                            Vdetach(vkey);
+                            HDfree(temp_tag);
+                            HDfree(temp_ref);
+                            HDfree(ret);
+                            return (NULL);
+                        }	/* end if */
+
+                      for (i = 0; i < nobj; i++)
+                        {
+                            ret->dd_arr[i].tag = (uint16) temp_tag[i];
+                            ret->dd_arr[i].ref = (uint16) temp_ref[i];
+                        }	/* end for */
+
+                      HDfree(temp_tag);
+                      HDfree(temp_ref);
+		    } /* if nobj > 0 */
+                  /* BMR: 7/28/00 must add this one, otherwise, HDfree fails later */
+                  else /* nobj <= 0 */
+                     return( NULL );
+                  }		/* end if */
+                else	/* bad vkey? */
+                    return (NULL);
+                Vdetach(vkey);	/* release the Vgroup */
+            }	/* end if */
+          else	/* failed to attach */
+              return (NULL);
+      }		/* end else */
+    return (ret);
+}	/* end make_group_list() */
+
+DFdi       *
+get_next_group(groupinfo_t * g_list, intn advance)
+{
+    if (advance)
+        g_list->curr_dd++;
+    if (g_list->curr_dd >= g_list->max_dds)
+        return (NULL);
+    return (&g_list->dd_arr[g_list->curr_dd]);
+}	/* end get_next_group() */
+
+int32 
+get_group_max(groupinfo_t * g_list)
+{
+    if (g_list != NULL)
+        return (g_list->max_dds);
+    return (FAIL);
+}	/* end get_group_max() */
+
+void 
+free_group_list(groupinfo_t * g_list)
+{
+   if( g_list != NULL )
+   {
+      if( g_list->dd_arr != NULL )
+         HDfree(g_list->dd_arr); 
+      HDfree(g_list);
+   }
+}	/* end free_group_list() */
+
+/*
+ *  Routines to manipulate tag/ref lists
+ */
+
+objlist_t  *
+make_obj_list(int32 fid, uint32 options)
+{
+    intn        nobj;		/* number of DDs in the file */
+    int32       status;		/* status of various HDF calls */
+    int32       aid;		/* temporary AID to use while getting DD info */
+    int16       tmp_spec;	/* temporary storage for special status */
+    objlist_t  *obj_ret;	/* pointer to the dd list to return */
+    objinfo_t  *obj_ptr;	/* temporary pointer to a working DD object */
+    sp_info_block_t info;	/* temp. storage for special elem. info */
+    intn        n, m;		/* local counting variable */
+
+   /* get the number of all objects in the file */
+    nobj = Hnumber(fid, DFTAG_WILDCARD);
+    if (nobj == FAIL || nobj <= 0 )  /* BMR: added check for nobj<=0 */
+        return (NULL);
+
+   /* allocate space for the object list - exit at failure??? */
+    if ((obj_ret = (objlist_t *) HDmalloc(sizeof(objlist_t))) == NULL)
+      {
+	  fprintf(stderr, "make_obj_list: space allocation failed\n");
+          return (NULL);
+      }
+
+    obj_ret->max_obj = nobj;	/* set the number of objects */
+    obj_ret->curr_obj = 0;
+    obj_ret->raw_obj_arr = (objinfo_t *) HDmalloc(sizeof(objinfo_t) * nobj);
+
+/* should it exit on failure ??? */
+    if( obj_ret->raw_obj_arr == NULL)
+      {
+	  fprintf(stderr, "make_obj_list: space allocation failed\n");
+          HDfree(obj_ret);
+          return (NULL);
+      }		/* end if */
+
+   /* Clear array of dd/object information */
+   HDmemset(obj_ret->raw_obj_arr, 0, sizeof(objinfo_t) * nobj);
+
+   /*
+    * Read all the tag/ref's in the file into an array 
+   */
+   /* start the reading of an access element */
+   aid = Hstartread(fid, DFTAG_WILDCARD, DFREF_WILDCARD);
+   if (aid == FAIL)
+   {
+      HEprint(stderr, 0);
+      HDfree(obj_ret->raw_obj_arr);
+      HDfree(obj_ret);
+      return (NULL);
+   }		/* end if */
+
+   /* for each element */
+   for (n = 0, status = SUCCEED; (n < nobj) && (status != FAIL); n++)
+   {
+      Hinquire(aid, NULL, &(obj_ret->raw_obj_arr[n].tag),
+               &(obj_ret->raw_obj_arr[n].ref), &(obj_ret->raw_obj_arr[n].length),
+               &(obj_ret->raw_obj_arr[n].offset), NULL, NULL, &tmp_spec);
+      if (options & CHECK_SPECIAL)
+      {	/* are we looking for spec. elem. ? */
+         obj_ret->raw_obj_arr[n].is_special = (tmp_spec != 0);
+         if (obj_ret->raw_obj_arr[n].is_special)
+         {		/* get the special info. */
+            if ((status = HDget_special_info(aid, &info)) == FAIL)
+            {
+               obj_ret->raw_obj_arr[n].is_special = 0;
+                        }	/* end if */
+            else
+            {	/* copy over special information we found */
+               obj_ret->raw_obj_arr[n].spec_info = (sp_info_block_t *) HDmalloc(sizeof(sp_info_block_t)); 
+               if( obj_ret->raw_obj_arr[n].spec_info == NULL)
+               {
+                   fprintf(stderr, "make_obj_list: space allocation failed\n");
+                   obj_ret->raw_obj_arr[n].is_special = 0;
+               }
+               else
+                  HDmemcpy(obj_ret->raw_obj_arr[n].spec_info, &info, sizeof(sp_info_block_t));
+            }	/* end else */
+         }  /* end if */
+      }	 /* end if */
+      status = Hnextread(aid, DFTAG_WILDCARD, DFREF_WILDCARD, DF_CURRENT);
+   }  /* end for */
+
+   if (Hendaccess(aid) == FAIL)
+   {
+      HEprint(stderr, 0);
+      HDfree(obj_ret->raw_obj_arr);
+      HDfree(obj_ret);
+      return (NULL);
+   }  /* end if */
+
+   /* Post-process the list of dd/objects, adding more information */
+   /*  Also set up the pointers for the sorted list to be manipulated later */
+
+   obj_ret->srt_obj_arr = (objinfo_t **) HDmalloc(sizeof(objinfo_t *) * nobj);
+   if( obj_ret->srt_obj_arr == NULL )
+   {
+      fprintf(stderr, "make_obj_list: space allocation failed\n");
+      HDfree(obj_ret->raw_obj_arr);
+      HDfree(obj_ret);
+      return (NULL);
+   }  /* end if */
+
+   /* Loop for more information */
+   for (n = 0; n < nobj; n++)
+   {
+      obj_ptr = obj_ret->srt_obj_arr[n] = &obj_ret->raw_obj_arr[n];
+
+      /* set the index value to a flag for later */
+      obj_ptr->index = (-1);
+
+      /* check for a group */
+      if (options & CHECK_GROUP)
+      {	/* are we looking for groups ? */
+         if (obj_ptr->tag == DFTAG_RIG || obj_ptr->tag == DFTAG_SDG
+             || obj_ptr->tag == DFTAG_NDG || obj_ptr->tag == DFTAG_VG)
+         {
+            obj_ptr->is_group = TRUE;
+            obj_ptr->group_info = make_group_list(fid, obj_ptr->tag, obj_ptr->ref);
+            if( obj_ptr->group_info == NULL )
+            {
+	    /* do not free these because even this element has no group
+	       list, it still can be displayd */
+/*
+               HDfree(obj_ret->raw_obj_arr);
+               HDfree(obj_ret);
+               return (NULL); 
+*/
+            }	/* end if */
+         }		/* end if */
+      }	/* end if */
+   }		/* end for */
+
+   /* Loop once more to figure out the index information */
+   for (n = 0, obj_ptr = &obj_ret->raw_obj_arr[0]; n < nobj; n++, obj_ptr++)
+   {
+      if (obj_ptr->index == (-1))
+      {	/* first object of this type in the file */
+         int32       temp_index = 0;
+         objinfo_t  *temp_ptr;	/* temporary pointer to a working DD object */
+
+	 /* the object gets index of 0 */
+         obj_ptr->index = 0;
+
+         /* look for other objects of this tag */
+         for (m = n, temp_ptr = obj_ptr + 1; m+1 < nobj; m++, temp_ptr++)
+         {
+            if (temp_ptr->tag == obj_ptr->tag)
+               temp_ptr->index = ++temp_index;	/* set next index */
+         } 		/* end for */
+      }	/* end if */
+   }		/* end for */
+
+   obj_ret->options = options;
+   return (obj_ret);
+}  /* end make_dd_list() */
+
+objinfo_t* get_next_obj(
+		objlist_t * o_list, intn advance )
+{
+   if( advance )
+      o_list->curr_obj++;
+   if( o_list->curr_obj >= o_list->max_obj )
+      return (NULL);
+   return( o_list->srt_obj_arr[o_list->curr_obj] );
+}	/* end get_next_obj() */
+
+objinfo_t* goto_nth_obj( 
+		objlist_t * o_list, intn n )
+{
+   if( n >= 0 && n < o_list->max_obj )
+      o_list->curr_obj = n;
+   return( o_list->srt_obj_arr[o_list->curr_obj] );
+}  /* end goto_nth_obj() */
+
+void reset_obj_list( 
+		objlist_t * o_list )
+{
+   if( o_list != NULL )
+      o_list->curr_obj = 0;
+}  /* end reset_obj_list() */
+
+void free_obj_list( 
+		objlist_t * o_list )
+{
+   intn        i;	/* local counting variable */
+   objinfo_t  *obj_ptr;	/* temporary pointer to a working DD object */
+
+   /* BMR: verify that o_list is not nil before accessing */
+   if( o_list != NULL )
+   { 
+      for (i = 0, obj_ptr = o_list->raw_obj_arr; i < o_list->max_obj; 
+							i++, obj_ptr++)
+      {
+         /* group_info can be NULL while is_group is set, how to handle 
+	    this one??? BMR 8/1/2000 
+	    if( obj_ptr->is_group && obj_ptr->group_info != NULL ) */
+         if( obj_ptr->is_group )
+            free_group_list( obj_ptr->group_info );
+         if( obj_ptr->is_special )
+            HDfree( obj_ptr->spec_info );
+      }		/* end for */
+      HDfree(o_list->srt_obj_arr);
+      HDfree(o_list->raw_obj_arr);
+      HDfree(o_list);
+   }
+   else
+       fprintf(stderr, ">>>free_obj_list failed - attempting to free a NULL list \n");
+}	/* end free_obj_list() */
+
+int sort_obj_list_by_tag(const void *p1, const void *p2)
+{
+   const objinfo_t *a = (const objinfo_t *) *((const void **) p1);
+   const objinfo_t *b = (const objinfo_t *) *((const void **) p2);
+
+   if (a->tag > b->tag)
+      return (1);
+   if (a->tag < b->tag)
+      return (-1);
+   if (a->ref > b->ref)
+      return (1);
+   if (a->ref < b->ref)
+      return (-1);
+   return (0);
+}	/* end sort_obj_info_by_tag() */
+
+#if 0 /* No longer possible since objects can have more than one label 
+       * -GV 6/12/97 */
+int sort_obj_list_by_name(const void *p1, const void *p2)
+{
+    const objinfo_t *a = (const objinfo_t *) *((void **) p1);
+    const objinfo_t *b = (const objinfo_t *) *((void **) p2);
+
+	/* Any label has priority over no label, else sort alphabetically */
+    if (a->has_label)
+      {
+          if (b->has_label)
+              return (HDstrcmp(a->lab_info, b->lab_info));
+          else
+              return (1);
+      }		/* end if */
+    else
+      {
+          if (b->has_label)
+              return (-1);
+          else
+              return (0);
+      }		/* end else */
+}	/* end sort_obj_info_by_tag() */
+#endif
+
+void sort_obj_list(objlist_t * o_list, sort_t sort_type)
+{
+   switch (sort_type)
+   {
+#if 0 /* No longer possible since objects can have more than one label 
+       * -GV 6/12/97 */
+      case ONAME:	/* sort by name order */
+          qsort(o_list->srt_obj_arr, o_list->max_obj, sizeof(objinfo_t *), sort_obj_list_by_name);
+          break;
+#endif
+      case OGROUP:		/* sort by group order */
+          break;	/* not currently implemented */
+
+      case OTAG:	/* sort by tag order */
+          qsort(o_list->srt_obj_arr, o_list->max_obj, sizeof(objinfo_t *), sort_obj_list_by_tag);
+          break;
+
+      case OFILE:	/* sort by file order */
+      default:
+          break;
+   }  /* end switch() */
+}  /* end sort_obj_list() */
+
+/* Misc. utility functions */
+int int32_compare(const void *a, const void *b)
+{
+   if (*(const int32 *) a > *(const int32 *) b)
+      return (1);
+   else if (*(const int32 *) a < *(const int32 *) b)
+      return (-1);
+   else
+      return (0);
+}  /* end int32_compare() */
+
+void sort(int32 *chosen, int32 choices)
+{
+    qsort((void *) chosen, choices, sizeof(int32), int32_compare);
+}
+
+/* resetBuff frees the passed-in pointer and resets it to NULL,
+   if it is not NULL.  Its purpose is to make cleaning up simpler 
+   throughout the entire dumper */
+void resetBuff( VOIDP *ptr )
+{
+   if( *ptr != NULL )
+   {
+      HDfree(*ptr);
+      *ptr = NULL;
+   }
+}
+
+/* parse_number_opts take a list of numbers separated by commas then 
+   retrieves the numbers and stores them in the structure provided by
+   the caller.  This routine is used by all the routines
+   parse_dumpxx_opts to parse the index or ref list that accompanies
+   option -i or -r */
+void
+parse_number_opts( char *argv[],
+                   int *curr_arg, 
+                   number_filter_t *filter)
+{
+   int32 numItems = 0, i;
+   char *tempPtr = NULL;
+   char *ptr = NULL;
+   int32 *newlist;
+
+   /* put a temp ptr at the beginning of the given list of numbers, 
+      separated by commas, for example, 1,2,3 */
+   ptr = argv[*curr_arg];
+
+   /* check if it's the end of the command */
+   if( ptr == NULL )
+   {
+      printf("Missing values for option\n");
+      exit(1);
+   }
+
+   /* then traverse the list and count the number of items in it */
+   while ((tempPtr = HDstrchr(ptr, ',')) != NULL)
+   {
+      numItems++;       /* count number of items in the list */
+      ptr = tempPtr + 1;/* forward pointer to next item, after a comma */
+   }  /* end while */
+   if (*ptr != '\0')	/* count the last item */
+      numItems++;
+
+   if (filter->num_list != NULL)
+   {
+	/* Update number of items that will be in the list */
+	numItems = numItems + filter->num_items;
+
+        /* Allocate a new list */
+        newlist = (int32 *) HDmalloc(sizeof(intn) * numItems);
+	CHECK_ALLOC(newlist, "newlist", "parse_number_opts" );
+
+        /* If filter->num_list is already allocated, transfer pointers over
+	   to the new list and deallocate the old list of pointers */
+        if (filter->num_list != NULL)
+        {
+            for (i=0; i < filter->num_items; i++)
+                newlist[i] = filter->num_list[i];
+            HDfree(filter->num_list);
+        }
+
+        /* Set _cdfs to the new list */
+        filter->num_list = newlist;
+        newlist = NULL;
+   }
+
+   else
+   {
+	/* allocate space to hold all the items in the list */
+	filter->num_list = (int32 *) HDmalloc(sizeof(intn) * numItems);
+	CHECK_ALLOC(filter->num_list, "filter->num_list", "parse_number_opts" );
+   }
+
+   /* go back to the beginning of the list and read in the numbers */
+   ptr = argv[*curr_arg];
+   i = 0;  /* index of the list */
+   while ( i < numItems )
+   {
+      tempPtr = HDstrchr(ptr, ',');
+      if( tempPtr != NULL )
+         *tempPtr = '\0';  /* end the string of digits */
+      filter->num_list[i] = atoi(ptr);  /* convert string to digits */
+      ptr = tempPtr + 1;
+      i++;
+   }
+   filter->num_items = numItems;   /* save the number of items */
+}  /* parse_number_opts */
+
+/* parse_string_opts take a list of strings separated by commas then 
+   retrieves the strings and stores them in the structure provided by
+   the caller.  This routine is used by all the routines 
+   parse_dumpxx_opts to parse the name or class list that accompanies
+   option -n or -c */
+void
+parse_string_opts( char *argv[],
+                   int *curr_arg, 
+                   char_filter_t *filter)
+{
+   int32 numItems = 0, i;
+   char *tempPtr = NULL;
+   char *ptr = NULL;
+
+   /* put a temp pointer at the beginning of the list of strings,
+      separated by commas */
+   ptr = argv[*curr_arg];
+
+   /* check if it's the end of the command */
+   if( ptr == NULL )
+   {
+      printf("Missing values for option\n");
+      exit(1);
+   }
+
+   /* then traverse the list and count the number of strings in it */
+   while ((tempPtr = HDstrchr(ptr, ',')) != NULL)
+   {
+      numItems++;
+      ptr=tempPtr+1;
+   }  /* end while */
+   if (*ptr != '\0')	/* count the last item */
+      numItems++;
+
+   /* allocate space to hold pointers that will point to the given strings */
+   filter->str_list = (char **) HDmalloc(sizeof(char *) * numItems);
+   CHECK_ALLOC( filter->str_list, "filter->str_list", "parse_string_opts" );
+
+   /* go back to the beginning of the list and read in the given strings */
+   ptr = argv[*curr_arg];
+   i = 0;  /* init the index of the list */
+   while ( i < numItems )
+   {
+      tempPtr = HDstrchr(ptr, ','); /* find the end of a string */
+      if( tempPtr != NULL )
+         *tempPtr = '\0';  /* end the string with a NULL char */
+
+      /* allocate space for each string */
+      filter->str_list[i] = (char *)HDmalloc(sizeof(char) * (HDstrlen(ptr)+1));
+      CHECK_ALLOC( filter->str_list[i], "filter->str_list[i]", "parse_string_opts" );
+      HDstrcpy(filter->str_list[i], ptr);  /* get the current string */
+      ptr = tempPtr + 1;  /* move pointer to next item or end of list */
+      i++;
+   }  /* end while */
+
+   filter->num_items = numItems;	/* save the number of items */
+
+} /* parse_string_opts */
+
+void init_obj_chosen_node(obj_chosen_t *aNode)
+{
+    aNode->index = -1;
+    aNode->refnum = -1;
+    aNode->name = NULL;
+    aNode->classname = NULL;
+    aNode->type_of_info = INVALID;
+}
+
+void parse_value_opts( char *argv[],
+                   int *curr_arg, 
+                   dump_info_t **dump_opts,
+		   info_type_t info_type)
+{
+   int32 numItems = 0, i;
+   char *tempPtr = NULL;
+   char *ptr = NULL;
+   obj_chosen_t *newlist;
+
+   /* put a temp ptr at the beginning of the given list of numbers, 
+      separated by commas, for example, 1,2,3 */
+   ptr = argv[*curr_arg];
+
+   /* check if it's the end of the command */
+   if( ptr == NULL )
+   {
+      printf("Missing values for option\n");
+      exit(1);
+   }
+
+   /* then traverse the list and count the number of items in it */
+   while ((tempPtr = HDstrchr(ptr, ',')) != NULL)
+   {
+      numItems++;       /* count number of items in the list */
+      ptr = tempPtr + 1;/* forward pointer to next item, after a comma */
+   }  /* end while */
+   if (*ptr != '\0')	/* count the last item */
+      numItems++;
+
+   if ((*dump_opts)->all_types != NULL)
+   {
+	/* Update number of chosen SDSs so far */
+	numItems = numItems + (*dump_opts)->num_chosen;
+ 
+        /* Allocate a new list */
+        newlist = (obj_chosen_t *) HDmalloc(sizeof(obj_chosen_t) * numItems);
+	CHECK_ALLOC(newlist, "newlist", "parse_value_opts" );
+
+        /* transfer pointers from (*dump_opts)->all_types over to the new list
+	   and deallocate the old list of pointers */
+        for (i=0; i < (*dump_opts)->num_chosen; i++)
+            newlist[i] = (*dump_opts)->all_types[i];
+	for (i=(*dump_opts)->num_chosen; i < numItems; i++)
+		init_obj_chosen_node(&newlist[i]);
+
+        /* Set (*dump_opts)->all_types to the new list */
+        (*dump_opts)->all_types = newlist;
+        newlist = NULL;
+   }
+   else
+   {
+	/* allocate space to hold all the items in the list */
+	(*dump_opts)->all_types = (obj_chosen_t *) HDmalloc(sizeof(obj_chosen_t) * numItems);
+	CHECK_ALLOC((*dump_opts)->all_types, "filter", "parse_value_opts" );
+
+	/* Initialize all nodes */
+	for (i=0; i < numItems; i++)
+	    init_obj_chosen_node(&(*dump_opts)->all_types[i]);
+   }
+
+   /* go back to the beginning of the list and read in the numbers */
+   ptr = argv[*curr_arg];
+
+   /* index of the list, it should start at 0 or at the number of SDSs chosen so far */
+   i = (*dump_opts)->num_chosen != NO_SPECIFIC ? (*dump_opts)->num_chosen : 0;
+   while ( i < numItems )
+   {
+	tempPtr = HDstrchr(ptr, ',');
+	if (tempPtr != NULL)
+	    *tempPtr = '\0';  /* end the string of digits */
+	switch (info_type)
+	{
+	  case IS_INDEX:
+	  /* convert the string of characters to digits and store for refnum */
+	    (*dump_opts)->all_types[i].index = atoi(ptr);
+	    break;
+
+	  case IS_REFNUM:
+	  /* convert the string of characters to digits and store for refnum */
+	    (*dump_opts)->all_types[i].refnum = atoi(ptr);
+	    break;
+
+	  case IS_NAME:
+	  /* get the current string of characters for name */
+	    (*dump_opts)->all_types[i].name = (char *)HDmalloc(sizeof(char) * (HDstrlen(ptr)+1));
+	    CHECK_ALLOC((*dump_opts)->all_types[i].name, "(*dump_opts)->all_types[i].name", "parse_string_opts" );
+	    HDstrcpy((*dump_opts)->all_types[i].name, ptr);
+	    break;
+
+	  case IS_CLASS:
+	  /* get the current string of characters for class name */
+	    (*dump_opts)->all_types[i].classname = (char *)HDmalloc(sizeof(char) * (HDstrlen(ptr)+1));
+	    CHECK_ALLOC((*dump_opts)->all_types[i].classname, "(*dump_opts)->all_types[i].classname", "parse_string_opts" );
+	    HDstrcpy((*dump_opts)->all_types[i].classname, ptr);
+	    break;
+
+	  default:
+	  /* shouldn't be anything else */
+	    fprintf(stderr, "Calling function passed in incorrect info_type_t: %%d\n", info_type);
+	    exit(1);
+	    break;
+	} /* end of switch */
+	(*dump_opts)->all_types[i].type_of_info = info_type;
+	ptr = tempPtr + 1;
+	i++;
+   }
+   (*dump_opts)->num_chosen = numItems;   /* save the number of chosen SDSs so far */
+}  /* parse_value_opts */
+
+/* validate_pos makes sure that number is > 0 so we are not going to
+   allocate 0 elements
+   This routine is replaced by the macro called CHECK_POS just because
+   the error checkings are being done that way! 7/27/00 
+*/
+
+/* if there are any specific datasets requested, alloc_index_list
+   allocates space for the list of indices of these requested items */
+void
+alloc_index_list(
+        int32 **index_list,
+        int32 num_chosen )
+{
+   int32 i = -1;        /* used to pass into HDmemfill as dummmy? */
+
+   *index_list = (int32 *) HDmalloc(sizeof(int32) * num_chosen);
+   CHECK_ALLOC( *index_list, "index_list", "alloc_index_list" );
+
+   i = (-1);
+   HDmemfill(*index_list, &i, sizeof(int32), num_chosen);
+}  /* end of alloc_index_list */
+
+/* Given a compression type code, returns a character string that
+   indicates that compression method. */
+char
+*comp_method_txt(comp_coder_t comp_type)
+{
+    switch (comp_type)
+    {
+        case COMP_CODE_NONE:
+            return ("NONE");
+        case COMP_CODE_RLE:
+            return ("RLE");
+        case COMP_CODE_NBIT:
+            return ("NBIT");
+        case COMP_CODE_SKPHUFF:
+            return ("SKPHUFF");
+        case COMP_CODE_DEFLATE:
+            return ("DEFLATE");
+        case COMP_CODE_SZIP:
+            return ("SZIP");
+        case COMP_CODE_JPEG:
+            return ("JPEG");
+        case COMP_CODE_IMCOMP:
+            return ("IMCOMP");
+        default:
+            return ("INVALID");
+    }
+}
+
diff --git a/mfhdf/dumper/hdp_vd.c b/mfhdf/dumper/hdp_vd.c
new file mode 100644
index 0000000..c0835a5
--- /dev/null
+++ b/mfhdf/dumper/hdp_vd.c
@@ -0,0 +1,1109 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: hdp_vd.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+#include "hdp.h"
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+
+void 
+dumpvd_usage(intn argc, 
+             char *argv[])
+{
+   printf("Usage:\n");
+   printf("%s dumpvd [-a|-i <indices>|-r <refs>|-n <names>|-c <classes>|-f <f1, f2,..>] [-dhv] [-o <filename>] [-bx] <filelist>\n", argv[0]);
+   printf("\t-a\tDump all VDs in the file (default)\n");
+   printf("\t-i <indices>\tDump the VDs at positions listed in <indices>\n");
+   printf("\t-r <refs>\tDump the VDs with reference number listed in <refs>\n");
+   printf("\t-n <names>\tDump the VDs with name listed in <names>\n");
+   printf("\t-c <classes>\tDump the VDs with class listed in <classes>\n");
+   printf("\t-f <f1, f2,..> \tDump based on fields in vdata header\n");
+   printf("\t-d\tDump data only, no tag/ref, formatted to input to hp2hdf\n");
+   printf("\t-h\tDump header only, no annotation for elements nor data\n");
+   printf("\t-v\tDump everything including all annotations (default)\n");
+   printf("\t-o <filename>\tOutput to file <filename>\n");
+   printf("\t-b\tBinary format of output\n");
+   printf("\t-x\tAscii text format of output (default)\n");
+   printf("\t<filelist>\tList of hdf file names, separated by spaces\n");
+}	/* end dumpvd_usage() */
+
+intn 
+parse_dumpvd_opts(dump_info_t *dumpvd_opts, 
+                  intn *curr_arg, 
+                  intn  argc,
+                  char *argv[], 
+                  char *flds_chosen[MAXCHOICES],
+                  int  *dumpallfields)
+{
+   int32       i, lastItem;
+   char       *tempPtr, *ptr;
+
+   /* traverse the command and process each option */
+#if defined(WIN386) || defined(DOS386)
+   while ((*curr_arg < argc) && ((argv[*curr_arg][0] == '-') ||
+                                 (argv[*curr_arg][0] == '/')))
+#else
+   while ((*curr_arg < argc) && (argv[*curr_arg][0] == '-'))
+#endif /* for the use of / as option on PC */
+   {
+      switch (argv[*curr_arg][1])
+      {
+         case 'a':	/* dump all, default */
+             dumpvd_opts->filter = DALL;
+
+             /* indicate that no specific vdata requested, will dump all */
+             dumpvd_opts->num_chosen = NO_SPECIFIC;
+             (*curr_arg)++;
+             break;
+
+         case 'i':	/* dump by index */
+             dumpvd_opts->filter |= DINDEX;  /* set bit DINDEX */
+             (*curr_arg)++;
+
+             /* parse and store the given indices in structure by_index */
+             parse_number_opts( argv, curr_arg, &dumpvd_opts->by_index);
+             (*curr_arg)++;
+             break;
+
+         case 'r':	/* dump by reference */
+             dumpvd_opts->filter |= DREFNUM; /* set bit DREFNUM */
+             (*curr_arg)++;
+
+             /* parse and store the given ref numbers in structure
+by_ref */
+             parse_number_opts( argv, curr_arg, &dumpvd_opts->by_ref);
+             (*curr_arg)++;
+             break;
+
+         case 'n':	/* dump by names */
+             dumpvd_opts->filter |= DNAME;   /* set bit DNAME */
+             (*curr_arg)++;
+
+             /* parse and store the given names in structure by_name */
+             parse_string_opts( argv, curr_arg, &dumpvd_opts->by_name);
+             (*curr_arg)++;
+             break;
+
+         case 'c':	/* dump by class */
+             dumpvd_opts->filter |= DCLASS;   /* set bit DCLASS */
+             (*curr_arg)++;
+
+             /* parse and store the given classes in structure by_class */
+             parse_string_opts( argv, curr_arg, &dumpvd_opts->by_class);
+             (*curr_arg)++;
+             break;
+
+         case 'f':	/* dump a subset of the fields */
+             if (dumpvd_opts->filter == DALL) /* not necessary to set this */
+                dumpvd_opts->filter = DFIELDS;/* leave it here anyway */
+             *dumpallfields = 0;  /*???*/
+             (*curr_arg)++;
+
+             lastItem = 0;
+             ptr = argv[*curr_arg];
+             for (i = 0; !lastItem; i++)
+             {
+                tempPtr = HDstrchr(ptr, ',');
+                if (tempPtr == NULL)
+                   lastItem = 1;
+                else
+                   *tempPtr = '\0';
+                flds_chosen[i] = (char *) HDmalloc(sizeof(char) * (HDstrlen(ptr)+1));
+		CHECK_ALLOC( flds_chosen[i], "flds_chosen[i]", "parse_dumpvd_opts" );
+
+/*
+                if (flds_chosen[i] == NULL)
+                {
+                   fprintf(stderr,"Failure in parse_dumpvd_opts: Not enough memory!\n");
+                   exit(1);
+                }
+*/
+                HDstrcpy(flds_chosen[i], ptr);
+                ptr = tempPtr + 1;
+             }
+             flds_chosen[i] = NULL;
+             (*curr_arg)++;
+             break;
+
+         case 'd':	/* dump data only */
+                dumpvd_opts->contents = DDATA;
+                (*curr_arg)++;
+                break;
+
+         case 'h':	/* no annotations nor data */
+                dumpvd_opts->contents = DHEADER;
+                (*curr_arg)++;
+                break;
+
+         case 'v':	/* dump all info */
+                dumpvd_opts->contents = DVERBOSE;
+                (*curr_arg)++;
+                break;
+
+         case 'o':	/* specify output file */
+             dumpvd_opts->dump_to_file = TRUE;
+
+             /* Get file name */
+             HDstrcpy(dumpvd_opts->file_name, argv[++(*curr_arg)]);
+
+             (*curr_arg)++;
+             break;
+
+         case 'b':   /* dump data in binary */
+             dumpvd_opts->file_format = DBINARY;
+             (*curr_arg)++;
+             break;
+
+         case 'x':   /* dump data in ascii, also default */
+             dumpvd_opts->file_format = DASCII;
+             (*curr_arg)++;
+             break;
+
+         default:	/* invalid dumpvd option */
+                printf("Warning: Invalid dumpvd option %s\n", argv[*curr_arg]);
+                return (FAIL);
+            }	/* end switch */
+      }		/* end while */
+
+   /* add the number of vdatas requested by index, by ref#, and by name
+      to have a total number of requested vdatas */
+   dumpvd_opts->num_chosen = dumpvd_opts->by_index.num_items +
+                             dumpvd_opts->by_ref.num_items +
+                             dumpvd_opts->by_name.num_items +
+                             dumpvd_opts->by_class.num_items;
+
+    return (SUCCEED);
+}	/* end parse_dumpvd_opts */
+
+/* VSref_index returns the index of a vdata given the vdata's ref# 
+   or returns FAIL, if the ref# is not found */
+int32 
+VSref_index(int32 file_id, 
+            int32 vd_ref)
+{
+   int32  find_ref = -1;
+   int    index    = 0; /* index is zero based? */
+   int32  ret_value = FAIL;   
+
+   while ((find_ref = VSgetid(file_id, find_ref)) != FAIL)
+   {
+      if (find_ref == vd_ref)
+      {
+         ret_value = index;
+         goto done; /* found, done */
+      }
+      index++;
+   }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+}	/* VSref_index */
+
+/* VSstr_index returns the index of a vdata given the vdata's name or
+   class, if the name is not found, and returns FAIL, otherwise.  */
+int32 
+VSstr_index(int32 file_id, 
+            char *filter_str, /* searched vd's name or class */
+            int   is_name, /* TRUE if searching for name, FALSE if class */
+            int32 *find_ref, /* current ref#, will return next found */
+            int32 *index)  /* index of the vdata w/ref# *find_ref */
+{
+   int32  vdata_id = FAIL;
+   char   vdata_name[MAXNAMELEN];
+   int32  ret_value = SUCCEED;
+
+   /* starting from the ref# *find_ref, search for the vdata having a
+      name or class the same as the given string filter_str; when no
+      more vdata to search, return FAIL */
+   while ((*find_ref = VSgetid(file_id, *find_ref)) != FAIL)
+   {
+  /* printf("VSstr_index: *find_ref = %d\n", *find_ref);
+ */ 
+      vdata_id = VSattach(file_id, *find_ref, "r");
+      if (FAIL == vdata_id)
+	 ERROR_GOTO_2( "in %s: VSattach failed for vdata with ref#=%d",
+		"VSstr_index", (int)*find_ref );
+
+      /* if the string searched is a vdata's name */
+      if (is_name)
+      {
+         if (FAIL == VSgetname(vdata_id, vdata_name))
+	    ERROR_GOTO_2( "in %s: VSgetname failed for vdata with ref#=%d",
+		"VSstr_index", (int)*find_ref );
+      }
+      /* or the string searched is a vdata's class */
+      else
+      {
+         if (FAIL == VSgetclass(vdata_id, vdata_name))
+	 ERROR_GOTO_2( "in %s: VSgetclass failed for vdata with ref#=%d",
+		"VSstr_index", (int)*find_ref );
+      }
+
+      if (FAIL == VSdetach(vdata_id))
+	 ERROR_GOTO_2( "in %s: VSdetach failed for vdata with ref#=%d",
+		"VSstr_index", (int)*find_ref );
+
+      /* if the vd's name or vd's class is the given string, return the
+         index of the vdata found */
+      if (HDstrcmp(vdata_name, filter_str) == 0)
+      {
+         /* store the current index to return first */
+         ret_value = (*index);
+
+         /* then increment index for next vdata - same class vdatas*/
+         (*index)++;
+         goto done; /* succeeded */
+      }
+      else
+	 ret_value = FAIL;
+
+      /* Note: in either case, increment the index for the next vdata */
+      (*index)++;
+   } /* end while getting vdatas */
+
+   /* when VSgetid returned FAIL in while above, search should stop */
+   ret_value = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+} /* VSstr_index() */
+
+/* compose the list of indices of the requested vdatas although some
+   vdatas are requested by ref# or name.
+   The routine returns:
+        - the number of vdatas to be processed, or
+        - NO_SPECIFIC if all vdatas are to be processed, or
+        - 0 if none.
+   If there are any errors, the parameter index_error will return TRUE */
+int32
+choose_vd(dump_info_t * dumpvd_opts, 
+          int32 **vd_chosen,
+          int32 file_id, 
+          int *index_error)
+{
+   int32  i,
+          index,
+          find_ref,
+          number,
+          num_vd_chosen = dumpvd_opts->num_chosen,
+          vd_count = 0; 
+   filter_t filter = dumpvd_opts->filter; /* temporary name */
+   intn   ret_value = 0;
+
+   /* if no specific vdatas are requested, return vdata count as 
+      NO_SPECIFIC (-1) */
+   if( filter == DALL )
+      HGOTO_DONE( NO_SPECIFIC );
+
+   /* if specific vdatas were requested, allocate space for the array
+      of indices */
+   if (num_vd_chosen > 0)
+      alloc_index_list( vd_chosen, num_vd_chosen );
+
+   /* else, no chosen vdatas but filter is not DALL, it shouldn't be this
+      combination, return vdata count as NO_SPECIFIC to dump all */
+   else
+      HGOTO_DONE( NO_SPECIFIC );
+
+   /* if there are some vdatas requested by index, store the indices in
+      the array provided by the caller */
+   if( filter & DINDEX )
+      for (i = 0; i<dumpvd_opts->by_index.num_items; i++)
+      {
+         (*vd_chosen)[vd_count] = dumpvd_opts->by_index.num_list[i];
+         vd_count++;
+      }
+          
+   /* if there are some vdatas requested by ref#, store the indices in
+      the array provided by the caller */
+   if( filter & DREFNUM )
+      for (i = 0; i<dumpvd_opts->by_ref.num_items; i++)
+      {
+         index = VSref_index(file_id, dumpvd_opts->by_ref.num_list[i]);
+         if (index == FAIL)
+         {
+            printf("Vdata with reference number %d: not found\n", 
+                                   (int)dumpvd_opts->by_ref.num_list[i]);
+            *index_error = TRUE; /* index error */
+         }
+         else
+         {
+            (*vd_chosen)[vd_count] = index;
+            vd_count++;
+         }
+      }	/* for */
+
+   /* if there are some vdatas requested by name, store the indices in
+      the array provided by the caller */
+   if( filter & DNAME )
+      for (i = 0; i<dumpvd_opts->by_name.num_items; i++)
+      {
+         find_ref = -1;
+         number = 0;
+         index = VSstr_index(file_id, dumpvd_opts->by_name.str_list[i], 1, &find_ref, &number);
+         if (index == FAIL)
+         {
+            printf("Vdata with name '%s': not found\n", 
+                         dumpvd_opts->by_name.str_list[i]);
+            *index_error = TRUE;
+         }
+         else
+         {
+            (*vd_chosen)[vd_count] = index;
+            vd_count++;
+         }
+      }	/* for */
+
+   /* if there are some vdatas requested by class, store the indices in
+      the array provided by the caller */
+   if( filter & DCLASS )
+      for (i = 0; i < dumpvd_opts->by_class.num_items; i++)
+      {
+         int32       found = FALSE;
+
+         find_ref = -1;
+         number = 0;
+         while ((index = VSstr_index(file_id, dumpvd_opts->by_class.str_list[i], 0, &find_ref, &number)) != FAIL)
+         {
+            if (vd_count < num_vd_chosen)
+               (*vd_chosen)[vd_count] = index;
+            else
+            {
+               *vd_chosen = (int32 *) HDrealloc(*vd_chosen,sizeof(int32) * (num_vd_chosen+1));
+               if (*vd_chosen == NULL)
+               {
+                  fprintf(stderr,"Failure in choose_vd: Memory re-allocation error\n");
+                  exit(1);
+               }		/* end if */
+               (*vd_chosen)[vd_count] = index;
+               num_vd_chosen++;
+            }
+            vd_count++;
+            found = TRUE;
+         }
+         if (!found)
+         {
+            printf("Vdata with class %s: not found\n", dumpvd_opts->by_class.str_list[i]);
+            *index_error = TRUE; /* index error */
+         }
+      }	/* for */
+
+      if( filter == DFIELDS )	/* Don't have to worry about which chosen fields yet. */
+      {}
+
+   ret_value = vd_count; /* actual number of vdatas to be processed; might
+    be different from dumpvd_opts->num_chosen because of the non-unique
+    class name */
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+}	/* choose_vd */
+
+void printHeader( 
+		FILE* fp,
+		char* fldstring,
+		char* fields,
+		vd_info_t* curr_vd )
+{ 
+   fprintf(fp, "Vdata: %d\n", (int) curr_vd->index );
+   if( curr_vd->tag == FAIL )	/* print vdata tag */
+      fprintf(fp, "   tag = <Undefined>; ");
+   else
+      fprintf(fp, "   tag = %d; ", (int) curr_vd->tag);
+
+   /* print reference number without checking because it's from
+      VSgetid and has been checked by the calling routine */
+   fprintf(fp, "reference = %d;\n", (int) curr_vd->ref);
+
+   if( curr_vd->nvf == FAIL ) /* print number of records in the vdata */
+      fprintf(fp, "   number of records = <Undefined>; ");
+   else
+      fprintf(fp, "   number of records = %d;", (int) curr_vd->nvf);
+
+   if( curr_vd->interlace == FAIL ) /* print interlace mode */
+      fprintf(fp, "   interlace = <Undefined>;\n");
+   else
+      if( curr_vd->interlace == 0 )
+	  fprintf(fp, " interlace = FULL_INTERLACE (0);\n");
+      else if( curr_vd->interlace == 1 )
+	  fprintf(fp, "   interlace = NO_INTERLACE;\n");
+      else
+	  fprintf(fp, "   interlace = <Unknown interlace mode (%d)>;\n", 
+				(int) curr_vd->interlace);
+                     
+   /* print the list of field names of the vdata if it's available */
+   /* The list of field names can be very long and would look very 
+      messy when being displayed if it were to be dumped out at once. 
+      print_fields displays a list in a nice way even if the list is 
+      long.  The second parameter specifies how the field name list 
+      begins; it's needed because dumpvg also uses this routine and 
+      has different indentation format than dumpvd */
+   print_fields( fields, "   fields = ", fp );
+
+   fprintf(fp, "   record size (in bytes) = %d;\n", (int)curr_vd->vsize);
+
+   if( curr_vd->name[0] == '\0' ) /* print vdata name */
+      fprintf(fp, "   name = <Undefined>; ");
+   else
+      fprintf(fp, "   name = %s;", curr_vd->name);
+
+   /* print class name - Note that vdclass can be NULL */
+   if( curr_vd->clss[0] == '\0' || curr_vd->clss == NULL )
+      fprintf(fp, " class = <Undefined>;\n");
+   else
+      fprintf(fp, " class = %s;\n", curr_vd->clss);
+
+} /* end of printHeader */
+
+intn getFieldIndices( 
+		char* fields, 
+		char *flds_chosen[MAXCHOICES],
+		int32* flds_indices )
+{
+   int32 lastItem = 0;  /* whether the last field in the list 'fields' is reached */
+   int32 fld_name_idx;  /* index for the list of field names */
+   int32 idx = 0;	      /* index for the array of field indices */
+   char  *tempPtr = NULL;  /* temp ptr to mark the end of a field name in the list */
+   char  *ptr = NULL;	/* used to forward to next field name in the field name list */
+   char  fldstring[MAXNAMELEN]; /* holds a field name extracted from field name list */
+   int32 i;
+   intn  flds_match = 0;
+   intn  ret_value = SUCCEED;
+   char   tempflds[VSFIELDMAX*FIELDNAMELENMAX];
+
+   /* make copy of the field name list retrieved by VSinquire to use 
+      in processing the field names */
+   HDstrcpy(tempflds, fields);
+
+   ptr = tempflds;		/* used to forward the field names */
+
+   i = (-1);	/* dummy? */
+   HDmemfill(flds_indices, &i, sizeof(int32), MAXCHOICES);
+
+   /* Extract each field name from the list of fields of the 
+      current record. */
+   for (fld_name_idx = 0; !lastItem; fld_name_idx++)
+   {
+      /* look for a comma in the fields */
+      tempPtr = HDstrchr(ptr, ','); 
+
+      /* if no comma is found, that means the last field name is reached */
+      if (tempPtr == NULL)
+         lastItem = 1;	/* set flag */
+
+      /* otherwise, add null to end the extracted field name */
+      else
+         *tempPtr = '\0';
+
+      /* extract that field into fldstring */
+      HDstrcpy(fldstring, ptr);
+
+      /* forward the pointer to the next field name in the list */
+      ptr = tempPtr + 1;
+
+      /* Compare the extracted field name with each of the names
+         of the fields having been chosen. */
+      for( i = 0; flds_chosen[i] != NULL; i++)
+      {
+         if (!HDstrcmp(flds_chosen[i], fldstring))
+         {
+            flds_indices[idx] = fld_name_idx;
+            idx++;
+            flds_match = 1;
+         }
+      }		/* for (i...) */
+   }	/* for (fld_name_idx...) */
+
+   /* return the flag indicating whether any given fields exist */
+   ret_value = flds_match;
+
+   return ret_value;
+} /* end of getFieldIndices */
+
+intn
+dumpvd_ascii(dump_info_t * dumpvd_opts, 
+             int32 file_id,
+             const char  *file_name,
+	     FILE* fp,
+             int32 num_vd_chosen, 
+             char *flds_chosen[MAXCHOICES],
+             int32 *vd_chosen,
+             int dumpallfields)
+{
+   int32       flds_indices[MAXCHOICES];
+   int32       i;
+   int32       vd_chosen_idx;	/* index for vd_chosen array */
+   int32       nvf;
+   int32       interlace;
+   int32       vsize;
+   int32       vdata_ref = -1;
+   int32       vdata_tag;
+   char        vdclass[VSNAMELENMAX+1];
+   char        vdname[VSNAMELENMAX+1];
+   char        fldstring[MAXNAMELEN];
+   intn        dumpall = 0;
+   file_format_t ff = DASCII;
+   vd_info_t   curr_vd;
+   int32       vd_id = FAIL;
+   int32       an_handle   = FAIL;
+   intn        status = SUCCEED, ret_value = SUCCEED;
+   char        fields[VSFIELDMAX*FIELDNAMELENMAX];
+
+   if (dumpvd_opts->contents != DDATA)
+   {
+      fprintf(fp, "File name: %s \n\n", file_name);
+
+      /* print file annotations */
+      status = print_file_annotations( file_id, file_name );
+      if( status == FAIL )
+      ERROR_GOTO_2( "in %s: Failure in printing file annotations for file %s",
+			"dumpvd_ascii", file_name );
+   }
+   vd_chosen_idx = 0;	/* start at the beginning of vd_chosen */
+
+   /* Determine if all VDs are to be dumped out. */
+   if (num_vd_chosen <= 0)	/* If so, set the corresponding flag. */
+       dumpall = 1;
+   else
+       /* Otherwise, sort the indices of the chosen VDs in increasing 
+          order so that they will be dumped out in such order */
+      sort(vd_chosen,num_vd_chosen);
+
+   /* Examine each VD, which is identified by its ref# returned by VSgetid */
+   for (i = 0; 
+	   (vdata_ref = VSgetid(file_id, vdata_ref)) != FAIL
+	&& (dumpall!=0 || vd_chosen_idx < num_vd_chosen); 
+	i++)
+   {
+      intn  data_only;	    /* indicates whether to print data only */
+      intn  flds_match = 0;  /* indicates whether any requested fields exist,
+		or if no field requested, set to 1 means dump all fields */
+      char sep[2];	    /* the character that is used to separate 2 fields */
+
+      /* Only dump the info of the chosen VDs or all of the VDs if none
+         has been selected. */
+      if ((!dumpall) && (i != vd_chosen[vd_chosen_idx]))
+          continue; /* skip */
+
+      vd_chosen_idx++;	/* One vdata has been located; so go to the next one in 
+                   the array. */
+      vd_id = VSattach(file_id, vdata_ref, "r");
+      if (vd_id == FAIL) /* continue to the next vdata */
+	 ERROR_CONT_2( "in %s: VSattach failed for vdata_ref#=%d", 
+                        "dumpvd_ascii", (int) vdata_ref );
+
+      /* Note: each of the parameters retuned by a query routine below 
+	 must be checked before being used */
+
+      /* Retrieves general information about the vdata.  Note that NULL is
+	 passed in for vdata's record size because it is not needed and 
+	 attempting to retrieve it causes failure when the vdata doesn't
+	 have any fields defined.  (bug #626) - BMR Mar 12, 02 */
+      if (FAIL == VSinquire( vd_id, &nvf, &interlace, fields, NULL, vdname ))
+	 ERROR_CONT_END( "in %s: VSinquire failed for vdata with ref#=%d", 
+                        "dumpvd_ascii", (int) vdata_ref, vd_id );
+
+      /* Get the HDF size of the specified fields of the vdata; VShdfsize 
+	 returns 0 if there are no fields previously defined */
+         vsize = VShdfsize( vd_id, fields );
+         if (vsize == FAIL)
+             ERROR_CONT_END( "in %s: VShdfsize failed for vdata with ref#=%d",
+			 "dumpvd_ascii", (int) vdata_ref, vd_id );
+
+      if (FAIL == (vdata_tag = VSQuerytag(vd_id)))
+         ERROR_CONT_END( "in %s: VSQuerytag failed for vdata with ref#=%d", 
+                        "dumpvd_ascii", (int) vdata_ref, vd_id );
+
+      if (FAIL == VSgetclass(vd_id, vdclass))
+         ERROR_CONT_END( "in %s: VSgetclass failed for vdata with ref#=%d",
+                        "dumpvd_ascii", (int) vdata_ref, vd_id );
+
+      /* If one or more fields were specified by the user, then find out
+         what they were, determine their corresponding indices in 
+         "fields", and store these indices in the array "flds_indices" so
+         that they can be used to determine whether a field should be
+         dumped later on. */
+      if (flds_chosen[0] != NULL)
+	 flds_match = getFieldIndices( fields, flds_chosen, flds_indices );
+
+      /* If no fields were chosen, all fields are to be dumped out, and
+         so all fields match. */
+      else /* if (flds_chosen[0] == NULL) */
+         flds_match = 1;
+
+      if (flds_match)
+      {
+         switch (dumpvd_opts->contents)
+         {
+             case DVERBOSE: /* dump all information */
+             case DHEADER:	 /* header only, no attributes, annotations 
+                                    or data */
+		/* store the vdata info into the vd_info_t struct for convenience */
+		curr_vd.index = i;        	/* vdata index */
+		curr_vd.nvf = nvf;        	/* number of records in the vdata */
+		curr_vd.interlace = interlace;  /* interlace mode of the vdata */
+		curr_vd.vsize = vsize;    	/* record size of the vdata */
+		curr_vd.ref = vdata_ref;  	/* vdata ref# */
+		curr_vd.tag = vdata_tag;  	/* vdata tag */
+		HDstrcpy( curr_vd.clss, vdclass );   /* vdata class */
+		HDstrcpy( curr_vd.name, vdname );     /* vdata name */
+		printHeader( fp, fldstring, fields, &curr_vd );
+
+                /* proceed to printing data if not printing header only */
+                if (dumpvd_opts->contents != DHEADER)
+                {
+                   /* dump vdata attributes */
+                   status = dumpattr(vd_id, _HDF_VDATA, 1, ff, fp);
+                   if( FAIL == status )
+                      ERROR_BREAK_3( "in %s: %s failed for attributes of vdata with ref#=%d",
+                                    "dumpvd_ascii", "dumpattr", (int) vdata_ref, FAIL );
+
+                   /* dump all the annotations for this vdata */
+                   status = print_data_annots( file_id, file_name, vdata_tag, vdata_ref );
+                   if( FAIL == status )
+                      ERROR_BREAK_3( "in %s: %s failed for attributes of vdata with ref#=%d",
+                           "dumpvd_ascii", "print_data_annots", (int) vdata_ref, FAIL );
+
+                   /* BMR - 6/30/98 to fix bug #236: if no fields are defined or 
+		      no data is written, break out and don't fall through */
+                   if ( fields[0] == '\0' || nvf == 0 )
+                   {
+                      fprintf(fp, "   No data written\n\n");
+                      break;
+                   }
+                }
+                else /* only header, no attributes, annotations or data */
+                    break; /* break out and don't fall through */
+
+                      /* note that we fall through if not printing header only */
+             case DDATA:	/* data only */
+                if (dumpvd_opts->contents == DDATA)
+                {
+                   data_only = 1;
+                   HDstrcpy(sep, "");
+                }
+                else
+                {
+                   data_only = 0;
+                   HDstrcpy(sep, ";");
+                }
+
+                /* Only the chosen or all fields will be dumped out. */
+                status = dumpvd(vd_id, ff, data_only, fp, sep, flds_indices, dumpallfields);
+                if( FAIL == status )
+                   ERROR_BREAK_2( "in %s: dumpvd failed for vdata with ref#=%d",
+                                 "dumpvd_ascii", (int) vdata_ref, FAIL );
+		break; /* out of DDATA */
+
+             default:
+                printf("dumping vdata in file %s, unknown option %d\n",
+			file_name, dumpvd_opts->contents);
+         }   /* switch */
+      }
+
+      if (FAIL == VSdetach(vd_id))
+         fprintf(stderr,"in %s: VSdetach failed on vdata with ref#=%d", 
+                        "dumpvd_ascii", (int) vdata_ref );
+      /* just simply goes to the next vdata */
+
+      vd_id = FAIL; /* reset */
+
+   }	/* for each vdata */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (an_handle != FAIL)
+              ANend(an_handle);
+
+          if (vd_id != FAIL)
+              VSdetach(vd_id);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* dumpvd_ascii() */
+
+
+intn
+dumpvd_binary(dump_info_t * dumpvd_opts, 
+              int32 file_id,
+              const char  *file_name,
+	      FILE* fp,
+              int32 num_vd_chosen, 
+              char *flds_chosen[MAXCHOICES],
+              int32 *vd_chosen,
+              int dumpallfields)
+{
+   int32       flds_indices[MAXCHOICES];
+   int32       i, vd_chosen_idx;
+   int32       nvf;
+   int32       interlace;
+   int32       vdata_ref = -1;
+   char        vdname[VSNAMELENMAX+1];
+   intn        dumpall = 0;
+   file_format_t ff = DBINARY;
+   int32       vd_id = FAIL;
+   intn        status;
+   intn        ret_value = SUCCEED;
+   char        fields[VSFIELDMAX*FIELDNAMELENMAX]; 
+
+    vd_chosen_idx = 0;	/* "vd_chosen_idx" is used to index the array of "vd_chosen". */
+
+    /* Determine if all VDs are to be dumped out. */
+    if (num_vd_chosen <= 0)	/* If so, set the corresponding flag. */
+        dumpall = 1;
+    else
+      {
+        /* Otherwise, sort the indices of the chosen VDs in increasing 
+                       order so that they will be dumped out in such order. */
+        sort(vd_chosen,num_vd_chosen);
+      }
+
+    /* Examine each VD. */
+   for (i = 0; 
+         (vdata_ref = VSgetid(file_id, vdata_ref)) != -1 
+         && (dumpall != 0 || vd_chosen_idx < num_vd_chosen); 
+         i++)
+   {
+      int  data_only, flds_match = 0;
+      char sep[2];	/* character used to separate fields */
+
+      /* Only dump the info of the chosen VDs or all of the VDs if none
+         has been selected. */
+      if ((!dumpall) && (i != vd_chosen[vd_chosen_idx]))
+         continue; /* skip */
+
+      vd_chosen_idx++;	/* One vdata has been located; so go to the next one in 
+                   the array.  ???*/
+
+      /* Select the next vdata for processing */
+      vd_id = VSattach(file_id, vdata_ref, "r");
+      if (vd_id == FAIL)  /* continue to the next vdata */
+         ERROR_CONT_2( "in %s: VSattach failed for vdata with ref#=%d", 
+                        "dumpvd_binary", (int) vdata_ref );
+
+      status = VSinquire(vd_id, &nvf, &interlace, fields, NULL, vdname);
+      if( FAIL == status ) /* end access to vd_id and cont. to next vdata */
+         ERROR_CONT_END( "in %s: VSinquire failed for vdata with ref#=%d", 
+                        "dumpvd_binary", (int) vdata_ref, vd_id );
+
+      /* BMR - 7/1/98 realized while fixing bug #236.
+         Skip binary printing if the vdata is empty */
+      if (fields[0] == '\0' || nvf == 0 )
+	 fprintf(stderr,"in %s: Vdata with ref#=%d is empty.\n",
+                        "dumpvd_binary", (int) vdata_ref );
+
+      else /* vdata is not empty */
+      {
+	 /* removed calls to VSQuerytag and VSgetclass - not useful in
+	    dumping by binary - BMR 8/23/00) */
+
+         /* If one or more fields were specified by the user, then find out
+            what they were, determine their corresponding indices in 
+            "fields", and store these indices in the array "flds_indices" so
+            that they can be used to determine whether a field should be
+            dumped later on. */
+         if (flds_chosen[0] != NULL)
+	    flds_match = getFieldIndices( fields, flds_chosen, flds_indices );
+
+         /* If no fields were chosen, all fields are to be dumped out, and
+            so all fields match. */
+         else /* if (flds_chosen[0] == NULL) */
+            flds_match = 1;
+
+         if (flds_match)
+         {
+	    /* BMR: removed the if statement to determine if data_only
+	       should be set; set data_only in either case */
+            data_only = 1;
+            HDstrcpy(sep, "");
+
+            /* Only the chosen or all fields will be dumped out. */
+            if (FAIL == dumpvd(vd_id, ff, data_only, fp, sep, flds_indices, dumpallfields))
+               ERROR_CONT_END( "in %s: Failure in dumping data for vdata with ref#=%d", 
+                              "dumpvd_binary", (int) vdata_ref, vd_id );
+         }
+      } /* end of if (fields[0] == '\0' || nvf == 0 ) */
+                      
+      if (FAIL == VSdetach(vd_id))
+         fprintf(stderr,"in %s: VSdetach failed on vdata with ref#=%d", 
+                        "dumpvd_binary", (int) vdata_ref );
+
+      vd_id = FAIL; /* reset */
+
+   }	/* for each vdata */
+
+   /* Normal cleanup */
+
+   return( ret_value );
+} /* dumpvd_binary */
+
+/* closeVD combines the processes of Vend, Hclose, freeing the list
+   of numbers, and resetting all ids, after validating the ids first.
+   When either Vend or Hclose fails, closeVD prints an informative
+   message then resetting the ids as normal since these failures are
+   highly unlikely and since the files are opened as read-only, it's
+   safe to go on. */
+void
+closeVD(
+    int32 *file_id,     /* will be returned as a FAIL */
+    int32 **vd_chosen,  /* will be returned as a NULL */
+    const char  *curr_file_name )
+{
+   if( *file_id != FAIL )
+   {
+      if (FAIL == Vend(*file_id))
+         fprintf(stderr,"Failure in closeVD: Vend failed for file %s\n",
+                         curr_file_name );
+      if (FAIL == Hclose(*file_id))
+         fprintf(stderr,"Failure in closeVD: Hclose failed for file %s\n",
+                         curr_file_name );
+      *file_id = FAIL; /* reset */
+   }
+
+   if( *vd_chosen != NULL )
+   {
+      HDfree( *vd_chosen );
+      *vd_chosen = NULL;
+   } /* end if */
+
+} /* end of closeVD */
+
+intn 
+dvd(dump_info_t * dumpvd_opts, 
+    intn curr_arg,
+    intn argc, 
+    char *argv[], 
+    char *flds_chosen[MAXCHOICES], 
+    int dumpallfields)
+{
+    int32       file_id = FAIL;
+    char        file_name[MAXFNLEN];
+    int32      *vd_chosen = NULL;
+    FILE       *fp = NULL;
+    int32       num_vd_chosen;
+    intn        index_error = 0;
+    file_format_t ff;
+    intn        status;
+    intn        ret_value = SUCCEED;
+
+   /* check for missing input file name */
+   if( curr_arg >= argc ) /* goto done with FAIL */
+      ERROR_GOTO_0( "Missing input file name.  Please try again.\n" );
+
+   while (curr_arg < argc)
+   {	/* Loop until all specified files have been processed */
+
+      intn isHDF = TRUE;  /* FALSE, if current file is not HDF file */
+
+      /* get file name */
+      HDstrcpy(file_name, argv[curr_arg]); 
+
+      /* record for later use */
+      HDstrcpy( dumpvd_opts->ifile_name, file_name );
+      curr_arg++;
+
+      closeVD( &file_id, &vd_chosen, file_name );
+
+      /* Print an informative message and skip this file if it is not
+         an HDF file */
+      isHDF = Hishdf(file_name);
+      if (isHDF == FALSE)
+      {
+         /* if there are no more files to be processed, print error
+            message, then returns with FAIL */
+         if( curr_arg == argc )
+            {ERROR_GOTO_1( "in dvd: %s is not an HDF file", file_name);}
+         else /* print message, then continue processing the next file */
+            {ERROR_CONT_1( "in dvd: %s is not an HDF file", file_name);}
+      }
+
+      /* open current hdf file with error check, if fail, go to next file */
+      file_id = Hopen(file_name, DFACC_READ, 0);
+      if (file_id == FAIL)
+      {
+         /* if there are no more files to be processed, print error
+            message, then returns with FAIL */
+         if( curr_arg == argc )
+            {ERROR_GOTO_1( "in dvd: Failure in opening file %s", file_name);}
+         /* otherwise, print message, then continue processing the next file */
+         else
+            ERROR_CONT_1( "in dvd: Failure in opening file %s", file_name );
+      }
+
+      /* initiate VG interface; if fail, probably something fatal, returns
+         with FAIL */
+      if (FAIL == Vstart(file_id))
+         ERROR_GOTO_1( "in dvd: Vstart failed for file %s\n", file_name);
+
+      /* Find out which VDs have been chosen. */
+      num_vd_chosen = choose_vd(dumpvd_opts, &vd_chosen, file_id, &index_error);
+
+      /* if there are no valid indices, move on to the next file */
+      if (index_error && num_vd_chosen == 0)
+         continue;   /* to the next file, closeVG before opening next file
+                        takes care of Vend, Hclose, and free vg_chosen */
+
+      ff = dumpvd_opts->file_format;
+      fp = stdout;	/* default file pointer to the standard output */
+      switch(ff)
+      {
+          case DASCII:  /*    ASCII file   */
+
+	     /* set output file */
+	     if (dumpvd_opts->dump_to_file)
+	        fp = fopen(dumpvd_opts->file_name, "w");
+
+             status = dumpvd_ascii(dumpvd_opts, file_id, file_name, fp,
+                      num_vd_chosen, flds_chosen, vd_chosen, dumpallfields);
+             if( FAIL == status )
+                ERROR_BREAK_0( "in dvd: dumpvd_ascii returned failure", FAIL );
+             break;
+          case DBINARY:   /*  binary file, not fully tested yet  */
+
+    	     /* Get output file name.  */
+    	     if (dumpvd_opts->dump_to_file)
+                fp = fopen(dumpvd_opts->file_name, "wb");
+
+             status = dumpvd_binary(dumpvd_opts, file_id, file_name, fp,
+                      num_vd_chosen, flds_chosen, vd_chosen, dumpallfields);
+             if( FAIL == status )
+                ERROR_BREAK_0( "in dvd: dumpvd_binary returned failure", FAIL );
+
+             break;
+          default:
+             printf("dumping vdata, unknown ouput file option \n");
+             ret_value = FAIL;
+      }    /* switch for output file   */
+
+      if(vd_chosen != NULL)
+      {
+         HDfree(vd_chosen);
+         vd_chosen = NULL;
+      } 
+
+      if (dumpvd_opts->dump_to_file)
+         fclose(fp);
+
+      if (FAIL == Vend(file_id))
+         ERROR_CONT_1( "in dvd: Vend failed on file %s\n", file_name);
+
+      if (FAIL == Hclose(file_id))
+         ERROR_CONT_1( "in dvd: Hclose failed on file %s\n", file_name);
+
+      file_id = FAIL; /* reset */
+
+   }	/* while processing files  */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (file_id != FAIL)
+            {
+                Vend(file_id);
+                Hclose(file_id);
+            }
+
+          if(vd_chosen != NULL)
+            {
+                HDfree(vd_chosen);
+                vd_chosen = NULL;
+            } 
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+}	/* dvd */
+
+/* exported */
+intn
+do_dumpvd(intn curr_arg, 
+          intn argc, 
+          char *argv[], 
+          intn help)
+{
+    dump_info_t dumpvd_opts;	/* dumpvd options */
+    char       *flds_chosen[MAXCHOICES];
+    int         dumpallfields;
+    intn status, ret_value = SUCCEED;
+
+    flds_chosen[0] = NULL;
+    dumpallfields = 1;
+
+   /* initialize the structure that holds user's options and inputs */
+    init_dump_opts(&dumpvd_opts);
+
+    if (help == TRUE)
+      {
+          dumpvd_usage(argc, argv);
+          goto done;
+      }		
+
+   /* incomplete command */
+   if( curr_arg >= argc )
+   {
+      dumpvd_usage(argc, argv);
+      ERROR_GOTO_0( "in do_dumpvd: command is incomplete");
+   }            /* end if */
+
+   /* parse the user's command and store the inputs in dumpvd_opts */
+   status = parse_dumpvd_opts(&dumpvd_opts, &curr_arg, argc, argv, flds_chosen, &dumpallfields);
+   if( status == FAIL )
+   {
+      dumpvd_usage(argc, argv);
+      ret_value = FAIL; /* return status to caller */
+      goto done;  /* skip dvd */
+   }
+
+   /* display data and information as specified in dumpvd_opts */
+   status = dvd(&dumpvd_opts, curr_arg, argc, argv, flds_chosen, dumpallfields);
+   if( status == FAIL )
+      ERROR_GOTO_0( "in do_dumpvd: dvd failed" );
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+   /* free the lists for given indices, ref#s, names, and classes if
+      they had been allocated */
+   free_num_list(dumpvd_opts.by_index.num_list );
+   free_num_list(dumpvd_opts.by_ref.num_list );
+   free_str_list(dumpvd_opts.by_name.str_list, dumpvd_opts.by_name.num_items);
+   free_str_list(dumpvd_opts.by_class.str_list, dumpvd_opts.by_class.num_items);
+
+   return ret_value;
+}	/* end do_dumpvd() */
+
diff --git a/mfhdf/dumper/hdp_vg.c b/mfhdf/dumper/hdp_vg.c
new file mode 100644
index 0000000..7f237d2
--- /dev/null
+++ b/mfhdf/dumper/hdp_vg.c
@@ -0,0 +1,1624 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: hdp_vg.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+#include "hdp.h"
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+#include "vg.h"
+
+#define NONAME_LEN 12
+
+void dumpvg_usage(intn argc, char *argv[]);
+int32 Vref_index(int32 file_id, int32 vg_ref);
+int32 Vname_ref(int32 file_id, char *searched_name, int32 *find_ref, int32 *index);
+int32 Vstr_ref(int32 file_id, char *searched_str, int is_name, int32 *find_ref, int32 *index);
+int32 Vindex_ref(int32 file_id, int32 sear_index);
+void resetVG(int32 *vg_id, const char  *curr_file_name);
+void display(vg_info_t *ptr, int32 level, vg_info_t **list, int32 num_nodes, int32 root_index, int32 firstchild, FILE *fp);
+intn get_VGandInfo(int32 *vg_id, int32 file_id, int32 vg_ref, const char *file_name, int32 *n_entries, char **vgname, char **vgclass);
+char **alloc_list_of_strings(int32 num_entries);
+char *alloc_strg_of_chars(char *strg);
+int32 get_VGindex_list(int32 file_id, dump_info_t *dumpvg_opts, int32 **vg_chosen, intn *index_error);
+void closeVG(int32 *file_id, int32 **vg_chosen, const char  *curr_file_name);
+intn vgBuildGraph(int32 vg_id, int32 file_id, int32 num_entries, const char* file_name, vg_info_t *aNode, intn *skipfile);
+intn dvg(dump_info_t *dumpvg_opts, intn curr_arg, intn argc, char *argv[]);
+intn vgdumpfull(int32 vg_id, dump_info_t *dumpvg_opts, int32 file_id, 
+           int32 num_entries, FILE *fp,  vg_info_t *aNode, intn *skipfile);
+
+/* display the usage of command dumpvg */
+void dumpvg_usage(intn argc, 
+             char *argv[])
+{
+    printf("Usage:\n");
+    printf("%s dumpvg [-a|-i <indices>|-r <refs>|-n <names>|-c <classes>] [-hv] [-o <filename>] <filelist>\n", argv[0]);
+    printf("\t-a\tDump all VGs in the file (default)\n");
+    printf("\t-i <indices>\tDump the VGs at position listed in <indices>\n");
+    printf("\t-r <refs>\tDump the VGs with reference number listed in <refs>\n");
+    printf("\t-n <names>\tDump the VGs with name listed in <names>\n");
+    printf("\t-c <class>\tDump the VGs with class listed in <classes>\n");
+/*  printf("\t-d\tDump data only, no tag/ref, formatted to input to hp2hdf\n");
+*/  printf("\t-h\tDump header only, no annotation for elements nor data\n");
+    printf("\t-v\tDump everything including all annotations (default)\n");
+    printf("\t-o <filename>\tOutput to file <filename>\n");
+/*  printf("\t-x\tAscii text format of output (default)\n"); */
+    printf("\t<filelist>\tList of hdf file names, separated by spaces\n");
+}   /* end dumpvg_usage() */
+
+intn parse_dumpvg_opts(dump_info_t *dumpvg_opts, 
+                  intn *curr_arg, 
+                  intn  argc,
+                  char *argv[]) 
+{
+   intn ret_value = SUCCEED;
+
+   /* traverse the command and process each option */
+#if defined(WIN386) || defined(DOS386)
+   while ((*curr_arg < argc) && ((argv[*curr_arg][0] == '-') ||
+                                 (argv[*curr_arg][0] == '/')))
+#else
+   while ((*curr_arg < argc) && (argv[*curr_arg][0] == '-'))
+#endif /* for the use of / as option on PC */
+   {
+      switch (argv[*curr_arg][1])
+      {
+         case 'a':	/* dump all, default */
+             dumpvg_opts->filter = DALL;
+
+             /* indicate that no specific images requested, will dump all */
+             dumpvg_opts->num_chosen = NO_SPECIFIC;
+             (*curr_arg)++;
+             break;
+
+         case 'i':	/* dump by index */
+             (*curr_arg)++; /* go to the parameters for this flag */
+
+             /* Parse and store the given indices in structure all_types */
+             parse_value_opts(argv, curr_arg, &dumpvg_opts, IS_INDEX);
+             (*curr_arg)++;
+             break;
+
+         case 'r':	/* dump by reference */
+             (*curr_arg)++; /* go to the parameters for this flag */
+
+             /* Parse and store the given ref numbers in structure all_types */
+             parse_value_opts(argv, curr_arg, &dumpvg_opts, IS_REFNUM);
+             (*curr_arg)++;
+             break;
+
+         case 'n':	/* dump by names */
+             (*curr_arg)++; /* go to the parameters for this flag */
+
+             /* Parse and store the given names in structure all_types */
+             parse_value_opts(argv, curr_arg, &dumpvg_opts, IS_NAME);
+             (*curr_arg)++;
+             break;
+
+         case 'c':	/* dump by class */
+             (*curr_arg)++; /* go to the parameters for this flag */
+
+             /* Parse and store the given classnames in structure all_types */
+             parse_value_opts(argv, curr_arg, &dumpvg_opts, IS_CLASS);
+             (*curr_arg)++;
+             break;
+
+         case 'd':	/* dump data only */
+             dumpvg_opts->contents = DDATA;
+             (*curr_arg)++;
+             printf("Warning>>> option -d is being removed from dumpvg.\n");
+             printf("Please contact hdfhelp at ncsa.uiuc.edu if you would like to keep it.\n\n");
+	     exit(1);
+
+         case 'h':	/* no annotations nor data */
+             dumpvg_opts->contents = DHEADER;
+             (*curr_arg)++;
+             break;
+
+         case 'v':	/* dump all info */
+             dumpvg_opts->contents = DVERBOSE;
+             (*curr_arg)++;
+             break;
+
+         case 'o':	/* specify output file */
+             dumpvg_opts->dump_to_file = TRUE;
+
+             /* Get file name */
+             HDstrcpy(dumpvg_opts->file_name, argv[++(*curr_arg)]);
+
+             (*curr_arg)++;
+             break;
+
+         case 'b':   /* dump data in binary - should be removed */ 
+             printf("Warning>>> option -b has been removed from dumpvg.\n");
+             printf("Please contact hdfhelp at ncsa.uiuc.edu for further assistance.\n");
+	     exit(1);
+
+         case 'x':   /* dump data in ascii, also default */
+             dumpvg_opts->file_format = DASCII;
+             (*curr_arg)++;
+             break;
+
+         default:	/* invalid dumpvg option */
+             printf("HDP ERROR>>> Invalid dumpvg option %s\n", argv[*curr_arg]);
+             HGOTO_DONE(FAIL);
+      }	/* end switch */
+   }		/* end while */
+
+done:
+   if (ret_value == FAIL)
+   { /* Failure cleanup */
+      /* free the list if it had been allocated */
+      free_obj_chosen_t_list(&dumpvg_opts->all_types, dumpvg_opts->num_chosen);
+   }
+   /* Normal cleanup */
+   return (ret_value);
+}	/* end parse_dumpvg_opts */
+
+/* Given an index, Vindex_ref returns the vgroup's reference number or FAIL */
+int32 Vindex_ref(int32 file_id, 
+           int32 sear_index)
+{
+    int32  find_ref = -1;
+    int    index = 0;
+    intn   found = FALSE;
+    int32  ret_value = FAIL;   
+
+    while (!found && index != -1)
+    {
+	find_ref = Vgetid(file_id, find_ref);
+
+	/* Searched ref# doesn't exist */
+	if (find_ref == FAIL)
+	    index = -1;
+
+	/* Valid ref# returned and its index is the searched one */
+	else if (index == sear_index)
+	{
+	    /* Make sure the ref# is not invalid */
+	    if (find_ref != -1)
+	    {
+		found = TRUE;
+		ret_value = find_ref;
+	    }
+	    else
+		printf("Warning>>> vgroup at index %d has an invalid ref# %d.\n"
+			, sear_index, find_ref);
+	}
+	/* Valid ref# returned but its index is not the searched one, go to
+	   next vgroup */
+	else
+	    index++;
+    }
+    return ret_value;
+}	/* Vindex_ref */
+
+/* Given a ref#, Vref_index searches for the vgroup that has this ref#
+and returns the vgroup's index or FAIL */
+int32 Vref_index(int32 file_id, 
+           int32 vg_ref)
+{
+    int32  find_ref = -1;
+    int    index = 0;
+    int32  ret_value = FAIL;   
+
+   while ((find_ref = Vgetid(file_id, find_ref)) != FAIL)
+   {
+      if (find_ref == vg_ref)
+      {
+         ret_value = index;
+         goto done; /* found , done */
+      }
+      index++;
+   }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+}	/* Vref_index */
+
+int32 Vstr_ref(int32 file_id, 
+           char *searched_str, /* vg's class name */
+	   int is_name,
+	   int32 *find_ref,
+           int32 *index)  /* index of the vgroup w/ref# *find_ref */
+{
+    int32  vg_id = FAIL;
+    char  *name = NULL;
+    uint16 name_len = 0;
+    int32  status_32 = FAIL;
+    int32  ret_value = FAIL;
+
+   /* starting from the ref# *find_ref, search for the vgroup having a
+      name or class the same as the given string searched_name; when no 
+      more vgroups to search, return FAIL */
+   while ((*find_ref = Vgetid(file_id, *find_ref)) != FAIL)
+   {
+	vg_id = Vattach(file_id, *find_ref, "r");
+	if (FAIL == vg_id)
+	    ERROR_GOTO_2( "in %s: Vattach failed for vgroup with ref#(%d)",
+                "Vstr_ref", (int)*find_ref );
+
+	/* get the length of the vgname to allocate enough space */
+	if (is_name)
+	    status_32 = Vgetnamelen(vg_id, &name_len);
+	else
+	    status_32 = Vgetclassnamelen(vg_id, &name_len);
+	if (FAIL == status_32) /* go to done and return a FAIL */
+	{
+	    ERROR_GOTO_2( "in %s: Vgetclassnamelen failed for vg ref=%d",
+                "Vstr_ref", (int)*find_ref );
+	}
+	name = (char *) HDmalloc(sizeof(char) * (name_len+1));
+	/* If allocation fails, Vstr_ref simply terminates hdp. */
+	CHECK_ALLOC(name, "vgroup classname", "Vstr_ref");
+
+	if (name_len > 0)
+	{
+	    if (is_name)
+	    {
+		if (FAIL == Vgetname(vg_id, name))
+		    ERROR_GOTO_2("in %s: Vgetclass failed for vgroup with ref#(%d)",
+                "Vstr_ref", (int)*find_ref);
+	    }
+	    else
+	    {
+		if (FAIL == Vgetclass(vg_id, name))
+		    ERROR_GOTO_2("in %s: Vgetclass failed for vgroup with ref#(%d)",
+                "Vstr_ref", (int)*find_ref);
+	    }
+
+	    if (FAIL == Vdetach(vg_id))
+		ERROR_GOTO_2("in %s: Vdetach failed for vgroup with ref#(%d)",
+                "Vstr_ref", (int)*find_ref);
+
+	    /* if the vg's name or vg's class is the given string, return the
+	    index of the vgroup found */
+	    if (HDstrcmp(name, searched_str) == 0)
+	    {
+		/* return the current ref# */
+		ret_value = *find_ref;
+		/* increment index for next vgroup - same class vgroups*/
+		(*index)++;
+		goto done;
+	    }
+	    (*index)++;
+	} /* name_len > 0 */
+
+	SAFE_FREE(name);	/* free name and set it to NULL */
+   } /* end while getting vgroups */
+
+   /* when VSgetid returned FAIL in while above, search should stop */
+   ret_value = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+	SAFE_FREE(name);	/* free name and set it to NULL */
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+} /* Vstr_ref() */
+
+/* resetVG calls Vdetach to end access to a vgroup with error checking
+   and resets the vgroup id to FAIL.  If failure occurs, resetVG 
+   print an error message in the stderr to help debugging */
+void
+resetVG( int32 *vg_id,
+         const char  *curr_file_name )
+{
+   if( *vg_id != FAIL )
+   {
+      if( FAIL == Vdetach( *vg_id ))
+         fprintf(stderr,"in resetVG: Vdetach failed for vg_id(%d) in file %s\n",
+                    (int)*vg_id, curr_file_name );
+      *vg_id = FAIL;
+   }
+}  /* end of resetVG */
+
+/* recursively display a vgroup with subtrees.  The parameter root_index
+is the index of the node of which the initial display is called.  The
+recursion is continued until this node is visited again; this way, infinite
+loop will be eliminated; or until all of its children are displayed */
+void display(vg_info_t *ptr, 
+        int32       level,  /* level of decendants - for indentation */
+        vg_info_t **list, 
+        int32       num_nodes, 
+        int32       root_index, /* index of the node starting the tree */
+        int32       firstchild,
+        FILE       *fp )
+{
+    char *name = NULL;
+    int   i, k, x, z;
+    int   num = 1;
+
+   level++;
+   if (!firstchild)   /* take care of the indentations */
+   {
+      for (k = 0; k < level; k++)
+      {
+         for (z = 0; z < num; z++)
+            fprintf( fp, "\t");
+      }
+   }
+   else
+      for (z = 0; z < num; z++)
+         fprintf( fp, "\t");
+
+   if (level > 0)  /* only print -- on subtrees */
+      fprintf( fp, "-- ");
+
+   /* every vg is printed here, except the one that indicates a loop */
+   fprintf( fp, "vg%d ", (int)ptr->index);
+
+   /* if this vgroup does not have any element, go to next line */
+   if (ptr->children == NULL)
+      fprintf( fp, "\n");
+   else
+   {
+
+   /* if this vgroup has not been displayed before, print it and its
+      subtree */
+   if (!ptr->displayed)
+   {
+      ptr->displayed = TRUE;  /* so this item will not be printed again */
+      for (i = 0; i < ptr->n_entries && ptr->children[i] != NULL; i++)
+      {
+         if (i == 0)
+            firstchild = TRUE;
+         else
+            firstchild = FALSE;
+
+         name = ptr->children[i];
+
+         if ((HDstrcmp(ptr->type[i], "vd")) 
+                    && (HDstrcmp(ptr->children[i], "***")))
+         {
+            x = 0;
+            while (HDstrcmp(name, list[x]->vg_name))
+            {
+               x++;
+            }
+
+            /* BMR: stop when the current node is the same as the one 
+               that starts this whole graph, i.e, loop starts */
+            if( list[x]->index != root_index ) 
+               display(list[x], level, list, num_nodes, root_index,firstchild,fp);
+
+            /* BMR: if the loop has started, only print the node's name 
+               and an '*' to indicate a loop */
+            else
+            {
+               if( i > 0)
+               {
+                  for (k = 0; k < level+1; k++)
+                  {
+                     for (z = 0; z < num; z++)
+                        fprintf( fp, "\t");
+                  }
+                  fprintf( fp, "-- vg%d (*)\n", (int)list[x]->index);
+               }
+               else
+                  fprintf( fp, " -- vg%d (*)\n", (int)list[x]->index);
+            }
+         }		
+         else  /* this node is a vdata */
+         {
+            if (i > 0)
+            {
+               for (k = 0; k < level + 1; k++)
+               {
+                  for (z = 0; z < num; z++)
+                     fprintf( fp, "\t");
+               }
+            }
+
+            if (firstchild)
+            {
+               for (z = 0; z < num; z++)
+                  fprintf( fp, "\t");
+            }
+
+            fprintf( fp, "-- ");
+                          /* fprintf( fp, "%s%d ", ptr->type[i], i); */
+            fprintf( fp, "%s  \n", ptr->type[i]);
+         }
+      }	/* for (i...) */
+   }  /* if (!ptr->displayed) */
+   else
+      fprintf( fp, "\n");
+   } /* has subnodes */
+   /* Reset for the next node in the list - BMR, 01/16/99 */
+   ptr->displayed = FALSE;
+}  /* display */
+
+/* get_VGandInfo attaches to vgroup with ref# vg_ref, and retrieves the 
+   vgroup's id.  If attaching successful, the routine reads the vgroup's 
+   tag, name, class, and number of entries; otherwise, it will set the
+   vgroup's id to FAIL and returns to the caller with status FAIL.
+   If any other failure occurs, get_VGandInfo will return the status
+   as FAIL after completing its processing. */
+intn get_VGandInfo( int32 *vg_id,
+               int32  file_id,
+               int32  vg_ref,
+               const  char *file_name,
+               int32 *n_entries,
+               char  **vgname,
+               char  **vgclass )
+{
+   intn status, ret_value = SUCCEED;
+   int32 status_32;
+   uint16 name_len = 0;
+
+    /* detach the current vgroup if it's attached to cover the case 
+      where a library routine fails and must continue to the next vgroup
+      without detaching the failed vgroup */
+    resetVG( vg_id, file_name );
+
+    *vg_id = Vattach(file_id, vg_ref, "r");
+    if( *vg_id == FAIL) /* go to done and return a FAIL */
+	ERROR_GOTO_2( "in %s: Vattach failed for vgroup ref=%d", 
+		"get_VGandInfo", (int) vg_ref );
+
+    /* get the length of the vgname to allocate enough space */
+    status_32 = Vgetnamelen(*vg_id, &name_len);
+    if (FAIL == status_32) /* go to done and return a FAIL */
+    {
+      ERROR_GOTO_2( "in %s: Vgetnamelen failed for vg ref=%d",
+                "get_VGandInfo", (int) vg_ref );
+    }
+    if (name_len > 0)
+    {
+	*vgname = (char *) HDmalloc(sizeof(char) * (name_len+1));
+
+	/* If allocation fails, get_VGandInfo simply terminates hdp. */
+	CHECK_ALLOC(*vgname, "*vgname", "get_VGandInfo" );
+
+	status = Vinquire(*vg_id, n_entries, *vgname);
+	if (FAIL == status) /* go to done and return a FAIL */
+	{
+	    *n_entries = -1;
+	    ERROR_GOTO_2( "in %s: Vinquire failed for vg ref=%d",
+		"get_VGandInfo", (int) vg_ref );
+	}
+    }
+   else
+    {
+	*vgname = (char *) HDmalloc(sizeof(char) * (NONAME_LEN));
+	HDstrcpy( *vgname, "<Undefined>" );
+	status = Vinquire(*vg_id, n_entries, NULL);
+	if (FAIL == status) /* go to done and return a FAIL */
+	{
+	    *n_entries = -1;
+	    ERROR_GOTO_2( "in %s: Vinquire failed for vg ref=%d",
+		"get_VGandInfo", (int) vg_ref );
+	}
+    }
+
+    /* get the length of the vgclass to allocate enough space */
+    status_32 = Vgetclassnamelen(*vg_id, &name_len);
+    if (FAIL == status_32) /* go to done and return a FAIL */
+    {
+      ERROR_GOTO_2( "in %s: Vgetclassnamelen failed for vg ref=%d",
+                "get_VGandInfo", (int) vg_ref );
+    }
+    if (name_len > 0)
+    {
+	*vgclass = (char *) HDmalloc(sizeof(char) * (name_len+1));
+
+	/* If allocation fails, get_VGandInfo simply terminates hdp. */
+	CHECK_ALLOC(*vgclass, "*vgclass", "get_VGandInfo" );
+
+	status_32 = Vgetclass(*vg_id, *vgclass);
+	if( FAIL == status_32 ) /* go to done and return a FAIL */
+	{
+	    ERROR_GOTO_2( "in %s: Vgetclass failed for vgroup ref#=%d",
+		"get_VGandInfo", (int) vg_ref );
+	}
+    }
+    else
+    {
+	*vgclass = (char *) HDmalloc(sizeof(char) * (NONAME_LEN));
+	HDstrcpy( *vgclass, "<Undefined>" );
+    }
+
+done:
+   if( ret_value == FAIL )
+   {
+	if (*vgname != NULL)
+	{
+	    HDfree((VOIDP)*vgname); /* free temp memory */
+	    *vgname = NULL;
+	}
+	if (*vgclass != NULL)
+	{
+	    HDfree((VOIDP)*vgclass); /* free temp memory */
+	    *vgclass = NULL;
+	}
+   }
+   /* Normal cleanup */
+
+   return( ret_value );
+} /* end of get_VGandInfo */
+
+intn 
+print_data_annots( int32 file_id,
+                const char *file_name,
+                int32 tag,
+                int32 ref )
+{
+   int32  an_id = FAIL;
+   intn   ret_value = SUCCEED;
+
+   if ((an_id = ANstart(file_id)) == FAIL)
+      ERROR_GOTO_2( "in %s: ANstart failed for file %s\n", 
+		"print_data_annots", file_name);
+                                  
+   /* print labels of vgroup if any */
+   if (FAIL == print_data_labels(file_name, an_id, (uint16)tag, (uint16)ref))
+      ERROR_GOTO_3( "in %s: print_data_labels failed for vg_ref(%d) in file %s\n", 
+		"print_data_annots", (int) ref, file_name);
+
+   /* print descriptions of vgroup if any */
+   if (FAIL == print_data_descs(file_name, an_id, (uint16)tag, (uint16)ref))
+      ERROR_GOTO_3( "in %s: print_data_descs failed for vg-ref(%d) in file %s\n", 
+		"print_data_annots", (int) ref, file_name);
+
+   /* close annotation interface */
+   if (FAIL == ANend(an_id))
+      ERROR_GOTO_2( "in %s: ANend failed for file %s\n", 
+		"print_data_annots", file_name);
+
+done:
+   if( ret_value == FAIL )
+   {
+      if (an_id != FAIL)
+         ANend(an_id);
+   }
+   /* Normal cleanup */
+   return( ret_value );
+} /* end of print_data_annots */
+
+/* alloc_list_of_strings allocates a list of num_entries char pointers 
+   and initializes the pointers to NULL.  If allocation fails, 
+   alloc_list_of_strings simply terminates hdp. */
+char **alloc_list_of_strings(
+	int32 num_entries)
+{
+   char **ptr=NULL;
+   intn i;
+
+   /* I don't know why +1 here and only i<num_entries at for loop - BMR*/
+   /* probably, +1 so that HDmalloc won't fail when num_entries = 0, was */
+   /* added in r1842.  But, that means possible memory leak! */
+   ptr = (char **) HDmalloc(sizeof(char *) * (num_entries));
+
+   /* If allocation fails, alloc_list_of_string simply terminates hdp. */
+   CHECK_ALLOC( ptr, "ptr", "alloc_list_of_strings" );
+
+   /* Init. all strings to NULL */
+   for (i = 0; i < num_entries; i++)
+      ptr[i] = NULL;
+
+   return( ptr );
+}  /* end of alloc_list_of_strings */
+
+char *alloc_strg_of_chars(
+        char *strg )
+{
+   char *ptr=NULL;
+
+   ptr = (char *) HDmalloc(sizeof(char) * (HDstrlen(strg)+1));
+
+   /* If allocation fails, alloc_list_of_string simply terminates hdp. */
+   CHECK_ALLOC( ptr, "ptr", "alloc_strg_of_chars" );
+
+   HDstrcpy(ptr, strg);  /* copy given string */
+
+   return(ptr);
+}
+
+/* print_fields displays the vdata's fields in an aligned format,
+   particularly when there are many fields and/or fields names are
+   lengthy */
+void print_fields( char *fields,
+	char *field_title,	/* */
+	FILE *fp )
+{
+   int32  lastItem = 0, i,
+          count = 0;
+   char  *ptr=NULL, *tempPtr=NULL,
+          fldname[MAXNAMELEN],
+	  tempflds[VSFIELDMAX*FIELDNAMELENMAX];
+
+   /* if fields are not defined by VSsetfields and VSfdefine */
+   if( fields[0] == '\0' || fields == NULL )
+      fprintf( fp, "%s <Undefined>;\n", field_title );
+
+   else
+   { /* there are fields to print */
+      fprintf(fp, "%s[", field_title );
+      HDstrcpy(tempflds, fields);	/* tempflds can be manipulated */
+      ptr = tempflds;			/* traverse tempflds with ptr */
+
+      /* traverse the temporary fieldname list to obtain and print each
+       * field name; use ',' to locate individual field names, and each 
+       * line should not exceed 50 characters beside the alignment */
+      for (i = 0; !lastItem; i++)
+      {
+         tempPtr = HDstrchr(ptr, ',');  /* locate next separator */
+         if (tempPtr == NULL)
+            lastItem = 1;	/* set flag for end of list */
+         else
+            *tempPtr = '\0';	/* change ',' to null to obtain field name */
+         HDstrcpy(fldname, ptr);	/* obtain current field name */
+         count += HDstrlen(fldname);	/* increment current # of chars on line */
+         if (count > 50)
+         {
+	    /* print alignment for the subsequent lines */
+            fprintf(fp, "\n\t          ");
+
+	    /* include the skipped field from previous line */
+            count = HDstrlen(fldname);  
+         }
+         fprintf(fp, "%s", fldname);  /* print the current field name */
+         if (!lastItem)
+            fprintf(fp, ", ");	/* print a comma if it's not the last field name */
+         ptr = tempPtr + 1;	/* move ptr beyond last field name */
+      }  /* end of for loop */
+      fprintf(fp, "];\n");
+   }  /* there are fields to print */
+   
+}  /* end of print_fields */
+
+/* compose the list of indices of the requested vgroups although some
+   vgroups are requested by ref# or name.
+   The routine returns:
+	- the number of vgroups to be processed, or
+	- NO_SPECIFIC if all vgroups are to be processed, or 
+	- 0 if none.
+   If there are any errors, the parameter index_error will return TRUE */
+int32 get_VGindex_list( 
+	int32 file_id,
+	dump_info_t *dumpvg_opts,
+	int32 **vg_chosen,
+	intn *index_error )
+{
+   intn     ii, jj;
+   int32    index,
+            find_ref,
+            vg_count = 0,
+            num_vg_chosen = dumpvg_opts->num_chosen,
+	    found = FALSE,
+            ref_num;
+   intn     ret_value = 0;
+
+   /* if no specific vgroups are requested, return vgroup count 
+      as NO_SPECIFIC (-1) */
+   if (num_vg_chosen == NO_SPECIFIC)
+      { HGOTO_DONE(NO_SPECIFIC); }
+
+   /* if specific vgroups were requested, allocate space for the array
+      of indices */
+   else
+      alloc_index_list(vg_chosen, num_vg_chosen);
+
+    /* Go through the list of all info given by flags -i, -r, -n, and -c, and
+       convert the info to reference numbers and store them in vg_chosen */
+    for (ii = 0; ii < dumpvg_opts->num_chosen; ii++)
+    {
+	switch (dumpvg_opts->all_types[ii].type_of_info)
+	{
+	  /* if the current chosen VG was requested by its index, store the
+	     index in the array vg_chosen */
+	case IS_INDEX:
+	    ref_num = Vindex_ref(file_id, dumpvg_opts->all_types[ii].index);
+	    (*vg_chosen)[ii] = ref_num;  /* Vindex_ref verified ref_num */
+	    vg_count++;
+	  break;
+
+	  /* if the current chosen VG was requested by its ref#, convert the
+             ref# to index and store the index in the array vg_chosen */
+	case IS_REFNUM:
+	    (*vg_chosen)[ii] = dumpvg_opts->all_types[ii].refnum;
+	    vg_count++;
+	    break;
+
+	  /* if the current chosen VG was requested by its name, find all
+             vgroups in the file with the same name and store their refs
+	     in *vg_chosen */
+	case IS_NAME:
+	  index = 0;
+	  /* Find first vgroup of name all_types[ii].name */
+	  find_ref = Vfind(file_id, dumpvg_opts->all_types[ii].name);
+
+	  /* Then find all vgroups of the same name */
+	  while (find_ref != 0 && find_ref != -1)
+	  {
+            if (vg_count < num_vg_chosen)
+               (*vg_chosen)[vg_count] = find_ref;
+            else
+            {
+               /* reallocate the array vg_chosen to hold multiple
+                  vgroups since name is not unique b/w vgroups */
+               *vg_chosen = (int32 *)HDrealloc(*vg_chosen, sizeof(int32)*(num_vg_chosen+1));
+               if( *vg_chosen == NULL)
+               {
+                  fprintf(stderr,"Failure in get_VGindex_list: Not enough memory!\n");
+                  exit(1);
+               }  /* end if */
+
+               (*vg_chosen)[vg_count] = find_ref;
+               num_vg_chosen++;
+            }
+            found = TRUE;
+            vg_count++;
+            find_ref = Vstr_ref(file_id, dumpvg_opts->all_types[ii].name, 1, &find_ref, &index);
+         }
+         if (!found)
+         {
+            printf( "Vgroup with name '%s': not found\n", 
+                           dumpvg_opts->all_types[ii].name);
+            *index_error = 1; /* error */
+	    goto done;
+         }
+	    break;
+
+	  /* if the current chosen VG was requested by its class, convert the
+             class to index and store the index in the array vg_chosen */
+	case IS_CLASS:
+	  index = 0;
+
+	    /* Find the first class with the all_type[ii].classname */
+	  find_ref = Vfindclass(file_id, dumpvg_opts->all_types[ii].classname);
+
+	  /* Then look for all the vgroups of the same class */
+	  while (find_ref != 0 && find_ref != -1)
+	  {
+            if (vg_count < num_vg_chosen)
+               (*vg_chosen)[vg_count] = find_ref;
+            else
+            {
+               /* reallocate the array vg_chosen to hold multiple
+                  vgroups since class name is not unique b/w vgroups */
+               *vg_chosen = (int32 *)HDrealloc(*vg_chosen, sizeof(int32)*(num_vg_chosen+1));
+               if( *vg_chosen == NULL)
+               {
+                  fprintf(stderr,"Failure in get_VGindex_list: Not enough memory!\n");
+                  exit(1);
+               }  /* end if */
+
+               (*vg_chosen)[vg_count] = find_ref;
+               num_vg_chosen++;
+            }
+            found = TRUE;
+            vg_count++;
+            find_ref = Vstr_ref(file_id, dumpvg_opts->all_types[ii].classname, 0, &find_ref, &index);
+	  }
+         if (!found)
+         {
+            printf( "Vgroup with class '%s': not found\n", 
+                           dumpvg_opts->all_types[ii].classname);
+            *index_error = 1; /* error */
+	    goto done;
+         }
+	break;
+	  default:
+	    fprintf(stderr, "in get_VGindex_list: Info should only be an index, ref number, name, or class of a Vgroup\n");
+	    *index_error = TRUE; /* error */
+	} /* end switch */
+    } /* end for loop */
+
+   ret_value = vg_count; /* actual number of vgroups to be processed; might
+                            be different from dumpvg_opts->num_chosen 
+                            because of the non-unique class name */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+/* need to free vg_chosen here */
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* end of get_VGindex_list */
+
+
+/* print_file_annotations manage the AN interface and simply calls the
+   two routines print_all_file_labels and print_file_descs defined in
+   hdp_list.c to display the file annotations of the current file */
+intn print_file_annotations( int32 file_id, const char* file_name )
+{
+   int32 an_id = FAIL;
+   intn  status = SUCCEED, ret_value = SUCCEED;
+
+   /* initiate the annotation interface */
+   an_id = ANstart(file_id);
+   if (FAIL == an_id)
+      ERROR_GOTO_0( "in print_file_annotations: ANstart failed");
+
+   /* print file labels if any */
+   status = print_all_file_labels( file_name, an_id );
+   if( status == FAIL )
+      ERROR_GOTO_0( "in print_file_annotations: print_all_file_labels failed");
+
+   /* print file descriptions if any */
+   status = print_file_descs( file_name, an_id );
+   if( status == FAIL )
+      ERROR_GOTO_0( "in print_file_annotations: print_file_descs failed");
+
+   /* close annotation interface */
+   if (FAIL == ANend( an_id ))
+      ERROR_GOTO_0( "in print_file_annotations: ANend failed" );
+
+done:
+   if( ret_value == FAIL )
+   {
+      if (an_id != FAIL)
+         if (FAIL == ANend( an_id ))
+            fprintf(stderr,"ANend failed for an_id(%d) for file %s\n",
+                                    (int)an_id, file_name);
+   }
+   /* Normal cleanup */
+   return( ret_value );
+}  /* end of print_file_annotations */
+
+/* closeVG combines the processes of Vend, Hclose, freeing the list
+   of numbers, and resetting all ids, after validating the ids first.
+   When either Vend or Hclose fails, closeVG prints an informative
+   message then resetting the ids as normal since these failures are
+   highly unlikely and since the files are opened as read-only, it's
+   safe to go on. */
+void closeVG(
+    int32 *file_id,     /* will be returned as a FAIL */
+    int32 **vg_chosen,  /* will be returned as a NULL */
+    const char  *curr_file_name )
+{
+   if( *file_id != FAIL )
+   {
+      if (FAIL == Vend(*file_id))
+         fprintf(stderr,"Failure in closeVG: Vend failed for file %s\n",
+                         curr_file_name );
+      if (FAIL == Hclose(*file_id))
+         fprintf(stderr,"Failure in closeVG: Hclose failed for file %s\n",
+                         curr_file_name );
+      *file_id = FAIL; /* reset */
+   }
+   SAFE_FREE(*vg_chosen);  /* safely free vg_chosen list and set it to NULL */
+
+} /* end of closeVG */
+
+intn vgBuildGraph(int32        vg_id, 
+           int32        file_id, 
+           int32        num_entries, 
+	   const char* file_name,
+           vg_info_t *aNode,
+           intn         *skipfile)
+{
+    int32  vs;
+    char   vsname[MAXNAMELEN];
+    char  *vgname = NULL;
+    char  *vgclass = NULL;
+    char  *name = NULL;
+    int32  vgt = FAIL;
+    int32  entry_num;
+    int32  elem_ref = FAIL;
+    int32  elem_n_entries;
+    int32  elem_tag;
+    int32  vg_ref;
+    intn   status, ret_value = SUCCEED;
+
+   aNode->n_entries = num_entries;
+if (num_entries != 0)
+{
+   /* allocate and init memory for storing children's and type's info */
+   aNode->children = alloc_list_of_strings(num_entries);
+   aNode->type = alloc_list_of_strings(num_entries);
+
+   /* get the current vgroup's ref# for error message */
+   vg_ref = VQueryref( vg_id );
+   if( vg_ref == FAIL )
+      ERROR_GOTO_2( "in %s: VQueryref failed for vgroup with id=%d",
+		"vgBuildGraph", (int) vg_id );
+
+   for (entry_num = 0; entry_num < num_entries; entry_num++)
+   {
+      status = Vgettagref(vg_id, entry_num, &elem_tag, &elem_ref);
+      if( FAIL == status )
+         ERROR_CONT_2( "in %s: Vgettagref failed for the %d'th entry", 
+                "vgBuildGraph", (int) entry_num );
+
+      if( elem_ref == 0 )  /* taken care of ref=0 in tdfr8f and tdf24 for now */
+      {
+         /* add the name and type of this element to the current graph */
+         aNode->children[entry_num] = alloc_strg_of_chars("***");
+         aNode->type[entry_num] = alloc_strg_of_chars("<vg/ref=0>");
+      }
+      else if (elem_tag == DFTAG_VG)
+      { /* vgroup */
+
+         /* get the current vgroup and its information */
+         status = get_VGandInfo( &vgt, file_id, elem_ref, file_name, 
+				 &elem_n_entries, &vgname, &vgclass );
+         if( status == FAIL )
+            ERROR_NOTIFY_3( "in %s: %s failed in getting vgroup with ref#=%d",
+		"vgBuildGraph", "get_VGandInfo", (int)vg_ref );
+
+         /* although get_VGandInfo failed to get a valid id for this vgroup,
+	    the node for the vgroup is not affected, so build it anyway */
+         if( vgt == FAIL )
+         {
+            *skipfile = TRUE; /* severe failure, skip this file */
+	    ERROR_NOTIFY_3( "in %s: %s failed to return a valid vgroup id for the %d'th entry",
+			"vgBuildGraph", "get_VGandInfo", (int) entry_num );
+         }
+
+	 /* vgroup has no name */
+         if (HDstrlen(vgname) == 0 || vgname == NULL)
+	 {
+	    vgname = (char *) HDmalloc(sizeof(char) * (NONAME_LEN));
+            HDstrcat(vgname, "<Undefined>");
+	 }
+
+         resetVG( &vgt, file_name );
+
+         /* add the name and type of this element to the current graph */
+         aNode->children[entry_num] = alloc_strg_of_chars( vgname );
+         aNode->type[entry_num] = alloc_strg_of_chars( "vg" );
+
+      }	/* if current element is vgroup */
+      else if (elem_tag == VSDESCTAG)
+      { /* vdata */
+	 /* add type of this element to the current graph */
+         aNode->type[entry_num] = alloc_strg_of_chars( "vd" );
+
+         vs = VSattach(file_id, elem_ref, "r");
+         if (vs == FAIL)
+         {
+            /* add Invalid for the name of this element to the current graph */
+            aNode->children[entry_num] = alloc_strg_of_chars( "<Invalid>" );
+
+            ERROR_CONT_2( "in %s: VSattach failed for vdata with ref#=%d", 
+			"vgBuildGraph", (int) elem_ref );
+         }
+         else /* VSattach didn't fail */
+         {
+               /* get vdata's name for graphical rep. preparation only */
+               if (FAIL == VSgetname(vs, vsname))
+               {
+                  ERROR_NOTIFY_2( "in %s: VSgetname failed for vdata with ref#=%d", 
+			"vgBuildGraph", (int) elem_ref );
+
+                  /* set vdata's name to undefined */
+      		  HDstrcpy( vsname, "<Invalid>" );
+               }
+
+            if (FAIL == VSdetach(vs))
+               ERROR_NOTIFY_2( "in %s: VSdetach failed for vdata with ref#=%d", 
+			"vgBuildGraph", (int) elem_ref );
+         }  /* if VSattach doesn't fail */
+
+         /* vdata has no name */
+         if (HDstrlen(vsname) == 0)
+            HDstrcat(vsname, "<Undefined>");
+
+         /* add the name of this element to the current graph */
+         aNode->children[entry_num] = alloc_strg_of_chars( vsname );
+
+      }  /* if current element is a vdata */
+      else /* else something else */
+      {
+         name = HDgettagsname((uint16) elem_tag);
+         if (!name)
+            name = HDstrdup("Unknown Tag");
+
+         /* add the name and type of this element to the current graph */
+         aNode->children[entry_num] = alloc_strg_of_chars( "***" );
+
+         if (!strcmp(name, "Unknown Tag"))
+         {
+            aNode->type[entry_num] = alloc_strg_of_chars( "Unknown Object");
+         }
+         else
+            aNode->type[entry_num] = name;
+
+      }  /* something else */
+   }  /* for */
+}
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+	aNode = free_node_vg_info_t(aNode);
+      }
+    /* Normal cleanup */
+    SAFE_FREE(vgname);	/* free vg name and set it to NULL */
+    SAFE_FREE(vgclass);	/* free vg class name and set it to NULL */
+    return ret_value;
+}	/* vgBuildGraph */
+
+intn vgdumpfull(int32        vg_id, 
+           dump_info_t *dumpvg_opts,
+           int32        file_id, 
+           int32        num_entries, 
+           FILE        *fp,  
+           vg_info_t *aNode, 
+           intn         *skipfile)
+{
+    int32  vgt = FAIL;
+    int32  vg_ref;
+    int32  entry_num;
+    int32  elem_tag;
+    int32  elem_ref = FAIL;
+    int32  elem_n_entries;
+    int    found = 0;
+    int32  vs;
+    int32  nv;
+    int32  interlace;
+    int32  vsize;
+    char   vsname[MAXNAMELEN];
+    char   vsclass[VSNAMELENMAX+1];
+    char  *vgname = NULL;
+    char  *vgclass = NULL;
+    char  *name = NULL;
+    char  *file_name = dumpvg_opts->ifile_name;
+    intn   status, ret_value = SUCCEED;
+    char   fields[VSFIELDMAX*FIELDNAMELENMAX];
+
+   aNode->n_entries = num_entries;
+if (num_entries != 0)
+{
+   /* allocate and init memory for storing children's and type's info */
+   aNode->children = alloc_list_of_strings( num_entries );
+   aNode->type = alloc_list_of_strings( num_entries );
+
+   /* get the current vgroup's ref# for error message */
+   vg_ref = VQueryref( vg_id );
+   if( vg_ref == FAIL )
+      ERROR_GOTO_2( "in %s: VQueryref failed for vgroup with id=%d",
+		"vgdumpfull", (int) vg_id );
+
+   for (entry_num = 0; entry_num < num_entries; entry_num++)
+   {
+      status = Vgettagref(vg_id, entry_num, &elem_tag, &elem_ref);
+      if( FAIL == status )
+         ERROR_CONT_2( "in %s: Vgettagref failed for the %d'th entry", 
+                "vgdumpfull", (int) entry_num );
+
+      found = 1;
+      if( elem_ref == 0 )  /* taken care of ref=0 in tdfr8f and tdf24 for now */
+      {
+         fprintf(fp, "     #%d (Vgroup)\n", (int) entry_num );
+         fprintf(fp, "\ttag = %d;", (int) elem_tag);
+         fprintf(fp, "reference = %d;\n", (int) elem_ref );
+
+         /* add the name and type of this element to the current graph */
+         aNode->children[entry_num] = alloc_strg_of_chars("***");
+         aNode->type[entry_num] = alloc_strg_of_chars("<vg/ref=0>");
+      }
+
+      else if (elem_tag == DFTAG_VG)
+      { /* vgroup */
+         /* get the current vgroup and its information */
+         status = get_VGandInfo( &vgt, file_id, elem_ref, file_name, &elem_n_entries, &vgname, &vgclass );
+         if( status == FAIL )
+	    ERROR_GOTO_3( "in %s: %s failed in getting vgroup with ref#=%d",
+                "vgdumpfull", "get_VGandInfo", (int) vg_ref );
+
+         /* since the succeeding processing depends on this vg id, we 
+            decided to just skip the current file.  Note that elem_n_entries 
+            is not checked here since it does not effect the following 
+            processing as in the case of the parent's vgroup */
+         if( vgt == FAIL )
+         {
+            /* return to caller to go to next file */
+            *skipfile = TRUE;
+	    ERROR_GOTO_3( "in %s: %s failed to return a valid vgroup id for the %d'th entry",
+                "vgdumpfull", "get_VGandInfo", (int) entry_num );
+         }
+	 /* vgroup has no name */
+         if (HDstrlen(vgname) == 0 || vgname == NULL)
+	 {
+	    vgname = (char *) HDmalloc(sizeof(char) * (NONAME_LEN));
+            HDstrcat(vgname, "<Undefined>");
+	 }
+
+         /* add the name and type of this element to the current graph */
+         aNode->children[entry_num] = alloc_strg_of_chars( vgname );
+         aNode->type[entry_num] = alloc_strg_of_chars( "vg" );
+
+         /* print the entry's info */ 
+         fprintf(fp, "     #%d (Vgroup)\n", (int) entry_num );
+         fprintf(fp, "\ttag = %d; ", (int) elem_tag);
+         fprintf(fp, "reference = %d;\n", (int) elem_ref );
+         fprintf(fp, "\tnumber of entries = %d;\n", (int) elem_n_entries);
+         fprintf(fp, "\tname = %s; class = %s\n", vgname, vgclass);
+
+         /* dump attributes for vgroup */
+         status = dumpattr(vgt, 0, 0, dumpvg_opts->file_format, fp);
+         if( FAIL == status )
+            ERROR_CONT_3( "in %s: %s failed to dump attributes for vgroup with ref#=%d",
+		"vgdumpfull", "dumpattr", (int) elem_ref );
+
+         /* dump all of the annotations for this vgroup */
+         status = print_data_annots( file_id, file_name, elem_tag, elem_ref );
+         if( FAIL == status )
+            ERROR_CONT_3( "in %s: %s failed to dump annotations for vgroup with ref#=%d",
+		"vgdumpfull", "print_data_annots", (int) elem_ref );
+
+         resetVG( &vgt, file_name );
+
+      }	/* if current element is vgroup */
+      else if (elem_tag == VSDESCTAG)
+      { /* vdata */
+
+         vs = VSattach(file_id, elem_ref, "r");
+         if (vs == FAIL)
+            ERROR_CONT_2( "in %s: VSattach failed for vdata with ref#=%d", 
+                                 "vgdumpfull", (int) elem_ref );
+
+         /* get and print vdata's information */
+         status = VSinquire(vs, &nv, &interlace, fields, &vsize, vsname);
+         if( FAIL == status )
+            ERROR_CONT_2( "in %s: VSinquire failed for vdata with ref#=%d", 
+                                 "vgdumpfull", (int) elem_ref );
+   
+         vsize = VShdfsize(vs, fields);
+         if (vsize == FAIL)
+            ERROR_CONT_2( "in %s: VShdfsize failed for vdata with ref#=%d", 
+                                 "vgdumpfull", (int) elem_ref );
+
+	 /* vdata has no name */
+         if (HDstrlen(vsname) == 0)
+               HDstrcat(vsname, "<Undefined>");
+   
+         if (FAIL == VSgetclass(vs, vsclass))
+               ERROR_CONT_2( "in %s: VSgetclass failed for vdata with ref#=%d", 
+                                 "vgdumpfull", (int) elem_ref );
+
+         /* vdata has no class */
+         if (HDstrlen(vsclass) == 0)
+            HDstrcpy( vsclass, "<Undefined>" );
+
+         fprintf(fp, "     #%d (Vdata)\n", (int) entry_num);
+         fprintf(fp, "\ttag = %d; ", (int) elem_tag);
+         fprintf(fp, "reference = %d; \n", (int) elem_ref);
+         fprintf(fp, "\tnumber of records = %d; ", (int) nv);
+         fprintf(fp, "interlace = %d;\n", (int) interlace);
+
+         /* The list of field names can be very long and would  
+               look very messy when being displayed if it were to 
+               be dumped out at once. print_fields displays a list 
+	       in a nice way even if the list is long. 
+	       The second parameter specifies how the field name list 
+	       begins; it's needed because dumpvd also uses this
+	       routine and has different indentation format than dumpvg */
+         print_fields( fields, "\tfields = ", fp );
+         fprintf(fp, "\trecord size (in bytes) = %d;\n", (int)vsize);
+         fprintf(fp, "\tname = %s; class = %s;\n", vsname, vsclass);
+         fprintf(fp, "\ttotal number of attributes = %d.\n", 
+				VSnattrs(vs));
+
+         if (FAIL == VSdetach(vs))
+               ERROR_CONT_2( "in %s: VSdetach failed for vdata with ref#=%d", 
+                                 "vgdumpfull", (int) elem_ref );
+
+         /* vdata has no name */
+         if (HDstrlen(vsname) == 0)
+            HDstrcat(vsname, "<Undefined>");
+
+         /* add the name and type of this element to the list node */
+         aNode->children[entry_num] = alloc_strg_of_chars( vsname );
+         aNode->type[entry_num] = alloc_strg_of_chars( "vd" );
+
+      }  /* if current element is a vdata */
+      else /* else something else */
+      {
+         name = HDgettagsname((uint16) elem_tag);
+         if (!name)
+            name = HDstrdup("Unknown Tag");
+
+            fprintf(fp, "     #%d (%s)\n", (int) entry_num, name);
+            fprintf(fp, "\ttag = %d; reference = %d;\n", (int) elem_tag, (int) elem_ref);
+
+         /* add the name and type of this element to the current graph */
+         aNode->children[entry_num] = alloc_strg_of_chars( "***" );
+
+         if (!strcmp(name, "Unknown Tag"))
+            aNode->type[entry_num] = alloc_strg_of_chars( "Unknown Object");
+         else
+            aNode->type[entry_num] = name;
+
+      }  /* something else */
+   }  /* for */
+}
+
+   if( !found )
+      printf("     None.\n");
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+	  aNode = free_node_vg_info_t(aNode);
+      }
+    /* Normal cleanup */
+    SAFE_FREE(vgname);	/* free vg name and set it to NULL */
+    SAFE_FREE(vgclass);	/* free vg class name and set it to NULL */
+
+    return ret_value;
+}	/* vgdumpfull */
+
+
+intn dvg(dump_info_t *dumpvg_opts, 
+    intn         curr_arg, 
+    intn         argc, 
+    char        *argv[])
+{
+    int32       file_id = FAIL;
+    int32       vg_id = FAIL;
+    int32      *vg_chosen = NULL;
+    int32       vg_count;
+    int32       num_vg_chosen;
+    int32       j;
+    int32       vg_ref = -1;
+    int32       vg_tag;
+    int32       n_entries;
+    int32       level;
+    int32	curr_vg=0;
+    int32       max_vgs=0;
+    int32       num_nodes = 0;
+    int         index_error = 0;
+    int         dumpall = 0;
+    char        file_name[MAXFNLEN];
+    char       *vgclass = NULL;
+    char       *vgname = NULL;
+    FILE       *fp = NULL;
+    vg_info_t **list = NULL;
+    vg_info_t *ptr = NULL;
+    intn        status, ret_value = SUCCEED;
+
+   /* check for missing input file name */
+   if( curr_arg >= argc )
+   {
+      fprintf( stderr, "Missing input file name.  Please try again.\n");
+      return( FAIL ); /* nothing to be cleaned up at this point */
+    }
+
+   /* going through each input file, look for the requested vgroups 
+      and display them */
+   while (curr_arg < argc)
+   {
+      intn isHDF = TRUE;  /* FALSE, if current file is not HDF file */
+      intn skipfile = FALSE;  /* skip the current file when some severe */
+           /* failure occurs; otherwise, the list of nodes is not */
+           /* completely prepared and will cause a crash in display */
+
+      HDstrcpy(file_name, argv[curr_arg]);  /* get current input file name */
+      HDstrcpy( dumpvg_opts->ifile_name, file_name ); /* record for later use */
+      curr_arg++;  /* forward the current argument pointer */
+
+      /* there are times a failure causes continuation without proper
+         cleanup, so closeVG ensures of that */
+      closeVG( &file_id, &vg_chosen, file_name );
+
+      /* Print an informative message and skip this file if it is not
+         an HDF file */
+      isHDF = Hishdf(file_name);
+      if (isHDF == FALSE)
+      {
+         /* if there are no more files to be processed, print error
+            message, then returns with FAIL */
+         if( curr_arg == argc )
+            {ERROR_GOTO_1( "in dvg: %s is not an HDF file", file_name);}
+         else /* print message, then continue processing the next file */
+            {ERROR_CONT_1( "in dvg: %s is not an HDF file", file_name);}
+      }
+
+      /* open current hdf file with error check, if fail, go to next file */
+      file_id = Hopen(file_name, DFACC_READ, 0);
+      if (file_id == FAIL)
+      {
+         /* if there are no more files to be processed, print error
+            message, then returns with FAIL */
+         if( curr_arg == argc )
+            {ERROR_GOTO_1( "in dvg: Failure in opening file %s", file_name);}
+         /* otherwise, print message, then continue processing the next file */
+         else
+            ERROR_CONT_1( "in dvg: Failure in opening file %s", file_name );
+      }
+
+      /* initiate VG interface; if fail, probably something fatal, returns 
+	 with FAIL */
+      if (FAIL == Vstart(file_id))
+         ERROR_GOTO_1( "in dvg: Vstart failed for file %s\n", file_name);
+
+      /* compose the list of indices of vgroups to be processed in the current
+      file and return the number of items in the list */
+      num_vg_chosen = get_VGindex_list( file_id, dumpvg_opts, &vg_chosen, &index_error);
+
+      /* if there are no valid indices, move on to the next file */
+      if (index_error && num_vg_chosen == 0) /* to the next file */
+      {
+         closeVG( &file_id, &vg_chosen, file_name );
+         ERROR_CONT_1( "in dvg: Invalid vgroups given for file %s", file_name );
+      }
+
+      /* open output file for ASCII or direct to standard output */
+      if (dumpvg_opts->dump_to_file)
+         fp = fopen(dumpvg_opts->file_name, "w");
+      else
+         fp = stdout;
+
+      /* print input file name and file annotations */
+      fprintf(fp, "File name: %s \n", file_name);
+      status = print_file_annotations( file_id, file_name );
+      if( status == FAIL )
+         ERROR_CONT_1( "in dvg: print_file_annotations failed for file %s",
+                        file_name );
+
+      /* when no vgroups specified, dump all vgroups */
+      if (num_vg_chosen == NO_SPECIFIC)
+         dumpall = TRUE;
+      /* otherwise, sort the list of reference numbers */
+      else
+         sort(vg_chosen, num_vg_chosen);
+
+      /* allocate space for the list of nodes to be printed in the 
+         Graphical Representation part */
+      max_vgs = NUM_VGS;
+      list = (vg_info_t **) HDmalloc(sizeof(vg_info_t *) * max_vgs);
+      CHECK_ALLOC( list, "list", "dvg" );
+
+      for (j = 0; j < max_vgs; j++)  /* init that list */
+         list[j] = NULL;
+
+      /* init number of nodes for the graphical representation of the
+         current file */
+      num_nodes = 0;
+
+      vg_count = 0; /* no vgroups processed yet */
+
+      vg_ref = Vgetid(file_id, -1);
+      curr_vg = 0;
+      while ((vg_ref != FAIL)
+                   && (dumpall || vg_count < num_vg_chosen))
+
+      {
+         int32       skipvg = FALSE;
+         intn isvdata; /* TRUE if a vdata being processed, FALSE if vg */
+
+         /* if not to dump all vgroups but the current vgroup is not
+            one of the selected ones */
+         if ((!dumpall) && (vg_ref != vg_chosen[vg_count]))
+            skipvg = TRUE;  /* skip printing this vg's info and data but
+                             include it in the graphical representation */
+
+
+         /* attaches the current vgroup and gets its tag, name, and class */ 
+         status = get_VGandInfo( &vg_id, file_id, vg_ref, file_name,
+			&n_entries, &vgname, &vgclass );
+         if( status == FAIL )
+            ERROR_CONT_2( "in dvg: %s failed in getting vgroup with ref#=%d",
+                        "get_VGandInfo", (int)vg_ref );
+
+         /* since the succeeding processing depends heavily on these
+            we decided to just skip the current file */
+         if( vg_id == FAIL || n_entries == -1 )
+         { 
+            skipfile = TRUE;  /* so Graphical Rep won't be printed */
+            break;  /* to get out of this current file */
+         }
+
+         if (!skipvg)
+            vg_count++;
+
+         num_nodes++;	/* one more node to the list */
+
+         /* if more vgs to be printed than originally allocated space for,
+            reallocate the list of nodes to the proper amount */
+         if (num_nodes > max_vgs)
+         {
+            max_vgs += NUM_VGS;
+            list = HDrealloc(list, (uint32) sizeof(vg_info_t*) * max_vgs);
+            CHECK_ALLOC( list, "list", "dvg" );
+         }
+
+         list[curr_vg] = (vg_info_t *) HDmalloc(sizeof(vg_info_t));
+         CHECK_ALLOC( list[curr_vg], "list[curr_vg]", "dvg" );
+	 list[curr_vg]->children = NULL;
+	 list[curr_vg]->type = NULL;
+
+         /* if this vgroup is to be skipped, do not print the info here; 
+            go to the data part to add the vgroup to the node list for 
+            the graphical rep. */
+         if( !skipvg )
+         {
+	    if (FAIL == (vg_tag = VQuerytag(vg_id)))
+               ERROR_NOTIFY_3("in dvg: %s failed on vgroup with ref=%d in file %s", 
+		         "VQuerytag", (int) vg_ref, file_name);
+            fprintf(fp, "\n");
+            fprintf(fp, "\nVgroup:%d\n", (int) curr_vg);
+            if( vg_tag == DFTAG_VG )
+               /* when have time, change to this one, not now because
+                  it takes time to fix the testfiles */
+               /* fprintf(fp, "     tag = DFTAG_VG(%d);", ); */
+               fprintf(fp, "     tag = %d;", (int) vg_tag );
+            else
+               fprintf(fp, "     tag = Invalid tag (%d);", (int) vg_tag );
+            fprintf(fp, " reference = %d;\n", (int) vg_ref);
+            fprintf(fp, "     name = %s; class = %s;\n", vgname, vgclass);
+            fprintf(fp, "     number of entries = %d;\n", (int) n_entries);
+
+            /* dump attributes of vgroup; the second argument is ignored 
+               in this call, it's there as an index when dumping attributes
+               of a vdata field */
+            isvdata = FALSE;
+            status = dumpattr(vg_id, 0, isvdata, dumpvg_opts->file_format, fp);
+            if (FAIL == status )
+               ERROR_NOTIFY_3("in dvg: %s failed on vgroup with ref=%d in file %s", 
+		         "dumpattr", (int) vg_ref, file_name);
+  
+            /* Read in all of the annotations. */
+            /* Re-vamped annotation handling to use new ANxxx interface 
+             *  -georgev 6/11/97 */
+            status = print_data_annots( file_id, file_name, vg_tag, vg_ref );
+            if (FAIL == status )
+               ERROR_NOTIFY_3("in dvg: %s failed on vgroup with ref=%d in file %s", 
+		         "dumpattr", (int) vg_ref, file_name);
+         } /* not skipped */
+
+         if( skipvg || dumpvg_opts->contents == DHEADER )
+         {
+            status = vgBuildGraph(vg_id, file_id, n_entries, file_name, list[curr_vg], &skipfile );
+            if( status == FAIL )
+               ERROR_NOTIFY_3( "in dvg: %s failed for vgroup with ref#=%d in file %s", 
+			     "vgBuildGraph", (int) vg_ref, file_name );
+         }
+         else
+         {
+            fprintf(fp, "Entries:-\n");
+            status = vgdumpfull(vg_id, dumpvg_opts, file_id, n_entries,
+                                  fp, list[curr_vg], &skipfile );
+            if( FAIL == status )
+            {
+               ERROR_NOTIFY_3( "in dvg: %s failed for vgroup with ref#=%d in file %s", 
+			      "vgdumpfull", (int) vg_ref, file_name);
+
+               /* do not continue so list[curr_vg] can be set */
+            }
+         } /* neither skipped nor header only */
+
+         /* if the current file is to be skipped due to some severe
+            error, break out of for loop and the partial list is freed */
+         if( skipfile )
+            ERROR_BREAK_1( "in dvg: Severe failure in file %s.  Go to next file", 
+				file_name, FAIL );
+
+         /* done using this vgroup id, reset it */
+         resetVG( &vg_id, file_name );
+  
+         /* fill the graph. rep. node for this vgroup */
+         list[curr_vg]->index = Vref_index(file_id, vg_ref);
+	 list[curr_vg]->vg_name = (char *) HDmalloc(sizeof(char) * (HDstrlen(vgname)+1));
+         HDstrcpy(list[curr_vg]->vg_name, vgname);
+         list[curr_vg]->displayed = FALSE;
+         list[curr_vg]->treedisplayed = FALSE;  /* BMR - 01/16/99 */
+
+      vg_ref = Vgetid(file_id, vg_ref);
+      if (vg_ref != FAIL) curr_vg++;
+      }	/* while more vgroups in the file */
+
+      /* print the graphical representation part */
+      if( !skipfile )
+      {
+         int32 node_num;
+
+         fprintf( fp, "\n\nGraphical representation of the file:-\n");
+         fprintf( fp, "(vg#: vgroup;   vd: vdata)\n\n");
+         for (node_num = 0; node_num < num_nodes; node_num++)
+         {
+            int32       firstchild = FALSE;
+
+            level = -1;
+            ptr = list[node_num];
+            fprintf( fp, "   ");
+
+            /* print tree */
+            display(ptr, level, list, num_nodes, ptr->index, firstchild, fp);
+            ptr->treedisplayed = TRUE; /* so this tree won't be shown again */
+            fprintf( fp, "\n");
+          }		/* for */
+       } /* if the file is not to be skipped */
+
+      /* free allocated resources */
+      list = free_vginfo_list( list, curr_vg );
+
+      /* free vg_chosen, and terminate access to and close the input file */
+       closeVG( &file_id, &vg_chosen, file_name );
+
+      /* close the output file if there is one */
+      if (dumpvg_opts->dump_to_file)
+          fclose(fp);
+   } /* while (more file to process) */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          resetVG( &vg_id, file_name );
+          closeVG( &file_id, &vg_chosen, file_name );
+          list = free_vginfo_list(list, curr_vg);
+	SAFE_FREE(vgname);	/* free vg name and set it to NULL */
+	SAFE_FREE(vgclass);	/* free vg class name and set it to NULL */
+      }
+    /* Normal cleanup */
+    return ret_value;
+}	/* dvg */
+
+/* main routine in hdp_vg.c; called by hdp.c/main to process the command
+hdp dumpvg... */
+intn do_dumpvg(intn  curr_arg, 
+          intn  argc, 
+          char *argv[], 
+          intn  help )
+{
+    dump_info_t dumpvg_opts;	/* dumpvg options */
+    intn status, ret_value = SUCCEED;
+
+   /* initialize the structure that holds user's options and inputs */
+   init_dump_opts(&dumpvg_opts);
+
+   if (help == TRUE)
+   {
+      dumpvg_usage(argc, argv);
+      goto done;
+   }
+
+   /* incomplete command */
+   if( curr_arg >= argc )
+   {
+      dumpvg_usage(argc, argv);
+      ERROR_GOTO_0( "in do_dumpvg: command is incomplete");
+   }            /* end if */
+
+   /* parse the user's command and store the inputs in dumpvg_opts */
+   status = parse_dumpvg_opts(&dumpvg_opts, &curr_arg, argc, argv );
+   if( status == FAIL )
+   {
+      dumpvg_usage(argc, argv);
+      ERROR_GOTO_0( "in do_dumpvg: parse_dumpvg_opts is unable to parse command");
+   }
+
+   /* display data and information as specified in dumpvg_opts */
+   status = dvg(&dumpvg_opts, curr_arg, argc, argv);
+   if( status == FAIL )
+      ERROR_GOTO_0( "in do_dumpvg: dvg failed");
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    /* free the list of structs containg info of selected Vgroups */
+    free_obj_chosen_t_list(&dumpvg_opts.all_types, dumpvg_opts.num_chosen);
+
+    return ret_value;
+}	/* end do_dumpvg() */
diff --git a/mfhdf/dumper/show.c b/mfhdf/dumper/show.c
new file mode 100644
index 0000000..84cc819
--- /dev/null
+++ b/mfhdf/dumper/show.c
@@ -0,0 +1,684 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Modified from vshow.c by Eric Tsui, 12/25/1994. */
+
+#ifdef RCSID
+static char *RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+#define VSET_INTERFACE
+#include "hdp.h"
+
+#define BUFFER 1000000
+
+/* ------------------------------------------------ */
+
+int32
+dumpvd(int32       vd, 
+       file_format_t ff, 
+       int         data_only, 
+       FILE       *fp, 
+       char        separater[2],
+       int32       flds_indices[VSFIELDMAX], 
+       int         dumpallfields)
+{
+    char        vdname[VSNAMELENMAX+1];
+    int32       j, i, t, interlace, nv, vsize;
+    uint8      *bb = NULL;
+    uint8      *b = NULL;
+    DYN_VWRITELIST *w = NULL;
+    intn       (*vfmtfn[VSFIELDMAX]) (VOIDP ,  file_format_t ff,  FILE *);
+    int32       off[VSFIELDMAX];
+    int32       order[VSFIELDMAX];
+    int32       nattrs[VSFIELDMAX];
+    int32       bufsize;		/* size of the buffer we are using */
+    int32       chunk;			/* number of rows that will fit in the buffer */
+    int32       done;			/* number of rows we have done */
+    int32       count;          /* number of rows to do this time through 
+                                           the loop */
+    int32       nf; 	       	/* number of fields in this Vdata */
+    int32       x, display;
+    int32       temp;
+    int32       addr_width = 0;
+    int32       num_digits;
+    int32       address = 0;
+    int32       nfields;
+    int32       cnt1, cnt2;
+    int32       cn = 0;
+    int32       ret_value = SUCCEED;
+    char        fields[VSFIELDMAX*FIELDNAMELENMAX];
+    char        flds[VSFIELDMAX*FIELDNAMELENMAX];
+
+    /* inquire about vdata */
+    if (FAIL == VSinquire(vd, &nv, &interlace, fields, &vsize, vdname))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if (nv * vsize > BUFFER)	/* If the number of records in the vdata is 
+                                   bigger than the buffer size, then divide
+                                   the records into chunks. */
+      {
+          bufsize = BUFFER;
+          chunk = BUFFER / vsize;
+      }
+    else
+        /* Otherwise, all the records will be read in at one time. */
+      {
+          bufsize = nv * vsize;
+          chunk = nv;
+      }
+
+    done = 0;
+    /* Allocate space for the buffer and terminate hdp if allocation fails. */
+    bb = (uint8 *) HDmalloc(bufsize);
+    CHECK_ALLOC( fields, "fields", "dumpvd" );
+    
+    if (FAIL == VSsetfields(vd, fields))
+      {
+          fprintf(stderr,"dumpvd: VSsetfields failed for vd = %d \n",(int)vd);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    w = vswritelist(vd);
+
+    nf = w->n;
+    x = 0;	/* Used for accessing the array storing the indices of the 
+                   selected fields. */
+    for (i = 0; i < nf; i++)	/* Read in data of all the fields. */
+      {
+          order[i] = w->order[i];
+
+          /* Set offset for the next element. */
+          off[i] = DFKNTsize(w->type[i] | DFNT_NATIVE);
+          nattrs[i] = VSfnattrs(vd, i);
+          if (FAIL == nattrs[i])
+            {
+                fprintf(stderr,"dumpvd: VSfnattrs failed for vd = %d \n",(int)vd);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* Display the header of a vdata if the user didn't specify the
+             data-only option. */
+          if (!data_only)
+          { 
+             if(ff==DASCII)
+             {
+                if ((dumpallfields) || (flds_indices[x] == i))
+                {
+                   fprintf(fp, "- field index %d: [%s], type=%d, order=%d\n",
+                          (int) i, w->name[i], w->type[i], w->order[i]);
+                   x++;
+                }
+             }
+             /* display attributes - BMR moved this block inside if(!data_only) 
+		to keep the attributes from being printed - bug #231*/
+             if (FAIL == dumpattr(vd, i, 1, ff, fp))
+             {
+                fprintf(stderr,"dumpvd: dumpattr() failed for vd = %d \n",(int)vd);
+                ret_value = FAIL;
+                goto done;
+             }
+
+          }	/* if !data_only */
+
+          /* Choose a function for displaying a piece of data of a 
+             particular type. */
+          switch (w->type[i] & 0xff)
+            {
+            case DFNT_CHAR:
+	    case DFNT_UCHAR:
+                vfmtfn[i] = fmtchar;
+                break;
+
+            case DFNT_UINT8:
+                vfmtfn[i] = fmtuint8;
+                break;
+
+            case DFNT_INT8:
+                vfmtfn[i] = fmtint8;
+                break;
+
+            case DFNT_UINT16:
+                vfmtfn[i] = fmtuint16;
+                break;
+
+            case DFNT_INT16:
+                vfmtfn[i] = fmtint16;
+                break;
+
+            case DFNT_UINT32:
+                vfmtfn[i] = fmtuint32;
+                break;
+
+            case DFNT_INT32:
+                vfmtfn[i] = fmtint32;
+                break;
+
+            case DFNT_FLOAT32:
+                vfmtfn[i] = fmtfloat32;
+                break;
+
+            case DFNT_FLOAT64:
+                vfmtfn[i] = fmtfloat64;
+                break;
+
+            default:
+                fprintf(stderr, "sorry, type [%d] not supported\n", (int) w->type[i]);
+                ret_value = FAIL;
+                goto done;
+
+            }	/* switch */
+      }		/* for */
+
+    cn = 0;
+    done = count = 0;
+    
+    if(ff==DASCII)
+      { 
+
+          /* If not just the data will be dumped out, then put an address-type
+             column on the left so that the user can recognize which record 
+             he/she is looking at. */
+          if (!data_only)
+            {
+                temp = nv / 10;
+                address = 0;
+                addr_width = num_digits = 1;
+                while (temp != 0)
+                  {
+                      if (temp != 1)
+                          addr_width++;
+                      temp = temp / 10;
+                  }
+                fprintf(fp, "Loc.");
+                for (j = 0; j < addr_width - 3; j++)
+                    fprintf(fp, " ");
+                fprintf(fp, "     Data\n");
+
+                /* The address of the first record is 0. Also, fill in the extra 
+                   space on the left with 0's. */
+                while (num_digits <= addr_width)
+                  {
+                      fprintf(fp, "0");
+                      num_digits++;
+                      cn++;
+                  }
+                fprintf(fp, "      ");
+                cn += 6;
+                if (addr_width == 2)
+                  {
+                      fprintf(fp, " ");
+                      cn++;
+                  }
+                else if (addr_width == 1)
+                  {
+                      fprintf(fp, "  ");
+                      cn += 2;
+                  }
+            }		/* while */
+
+          nfields = VSgetfields(vd, flds);
+          if (FAIL == nfields )
+            {
+                fprintf(stderr,"dumpvd: VSgetfields failed for vd = %d \n",(int)vd);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          cnt1 = 0;
+          cnt2 = 0;
+          while (done != nv)
+          {
+              /* Determine the amount of data to be read this time. */
+              if ((nv - done) > chunk)
+                    count = chunk;
+              else
+                    count = nv - done;
+
+              /* read and update bookkeeping */
+              if (FAIL == VSread(vd, bb, count, interlace))
+              {
+		 /* If the data set has external element, get the external file
+		 name to provide information */
+		 intn extfile_namelen = VSgetexternalfile(vd, 0, NULL, NULL);
+		 if (extfile_namelen > 0)
+		 {
+		    char *extfile_name = NULL;
+		    extfile_name = (char *)HDmalloc(sizeof(char *)*(extfile_namelen+1));
+		    CHECK_ALLOC(extfile_name, "extfile_name", "dumpvd" );
+
+		    /* Get the external file info, we don't need offset here */
+		    extfile_namelen = VSgetexternalfile(vd, extfile_namelen+1, extfile_name, NULL);
+		    ERROR_GOTO_3( "in %s: VSread failed for vd(%d) with external file %s.  Please verify the file exists in the same directory.",
+                        "dumpvd", (int)vd, extfile_name);
+		 }
+		 else
+		    ERROR_GOTO_2( "in %s: VSread failed for vd(%d)",
+                        "dumpvd", (int)vd );
+                }
+
+                done += count;
+                b = bb;
+
+                /* Display the data. */
+                for (j = 0; j < count; j++)	/* each iteration causes one record 
+                                               to be printed */
+                  {
+                      cnt1++;
+                      x = 0;
+                      for (i = 0; i < nf; i++)	/* display all fields in one record */
+                        {
+                            if ((!dumpallfields) && (flds_indices[x] != i))
+                                display = 0;
+                            else
+                              {
+                                  display = 1;
+                                  x++;
+                              }
+
+                            for (t = 0; t < order[i]; t++)
+                              {
+                                  if(display)
+                                      cn+=(vfmtfn[i]) (b, ff, fp);
+                                  b += off[i];
+                                  if (display)
+                                    {
+                                        fprintf(fp, " ");
+                                        cn++;
+                                        cnt2++;
+                                    }
+                              }
+                            if (display)
+                              {
+                                  fprintf(fp, " ");
+                                  cn++;
+                                  cnt2++;
+                              }
+                        }		/* for i to nf-1 */
+
+	   
+                      if (cnt2 > 0)
+                        {
+                            address++;
+                            /* "separator" is the symbol used for separating 
+                               different records. */
+                            fprintf(fp, "%s ", separater);
+                        }
+
+                      if (!data_only)
+                        {
+                            if ((cnt1 * cnt2) > 30)
+                              {
+                                  cnt1 = 0;
+                                  cnt2 = 0;
+                                  fprintf(fp, "\n");
+                                  cn = 0;
+
+                                  /* As long as there is data to be displayed,
+                                     fill in the extra space with 0's on the left
+                                     of each address. */
+                                  if (j < (count - 1))
+                                    {
+                                        temp = address;
+                                        num_digits = 1;
+                                        while ((temp = temp / 10) != 0)
+                                            num_digits++;
+                                        while (num_digits < addr_width)
+                                          {
+                                              fprintf(fp, "0");
+                                              num_digits++;
+                                              cn++;
+                                          }
+                                        fprintf(fp, "%d      ", (int)address);
+                                        cn += 6 + num_digits;
+                                        if (addr_width == 2)
+                                          {
+                                              fprintf(fp, " ");
+                                              cn++;
+                                          }
+                                        else if (addr_width == 1)
+                                          {
+                                              fprintf(fp, "  ");
+                                              cn += 2;
+                                          }
+                                    }		/* if (!data_only) */
+                              }
+                        }
+                      else
+                          fprintf(fp, "\n");
+                  }	/* for (j=0; j<count; j++) */
+            }		/* while (done != nv) */
+
+          /* ============================================ */
+
+          HDfree((VOIDP) bb);
+          bb = NULL;
+
+          fprintf(fp, "\n\n");
+      }  /*  for DASCII  */
+
+    else
+      {       /*  binary file  */
+          nfields = VSgetfields(vd, flds);
+          if (FAIL == nfields )
+            {
+                fprintf(stderr,"dumpvd: VSgetfields failed for vd = %d \n",(int)vd);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          cnt1 = 0;
+          cnt2 = 0; 
+          while (done != nv)
+            {
+                /* Determine the amount of data to be read this time. */
+                if ((nv - done) > chunk)
+                    count = chunk;
+                else
+                    count = nv - done;
+
+                /* read and update bookkeeping */
+                if (FAIL == VSread(vd, bb, count, interlace))
+                {
+		   /* If the data set has external element, get the external
+		      file name to provide information */
+		   intn extfile_namelen = VSgetexternalfile(vd, 0, NULL, NULL);
+		   if (extfile_namelen > 0)
+		   {
+		      char *extfile_name = NULL;
+		      extfile_name = (char *)HDmalloc(sizeof(char *)*(extfile_namelen+1));
+		      CHECK_ALLOC(extfile_name, "extfile_name", "dumpvd" );
+
+		      /* Get the external file info, we don't need offset here */
+		      extfile_namelen = VSgetexternalfile(vd, extfile_namelen+1, extfile_name, NULL);
+		      ERROR_GOTO_3( "in %s: VSread failed for vd(%d) with external file %s.  Please verify the file exists in the same directory",
+                        "dumpvd", (int)vd, extfile_name);
+		   }
+		   else
+		      ERROR_GOTO_2( "in %s: VSread failed for vd(%d)",
+                        "dumpvd", (int)vd );
+                }
+
+                done += count;
+                b = bb;
+
+                /* Display the data. */
+                for (j = 0; j < count; j++)	/* each iteration causes one record 
+                                               to be printed */
+                  {
+                      cnt1++;
+                      x = 0;
+                      for (i = 0; i < nf; i++)	/* display all fields in one record */
+                        {
+                            if ((!dumpallfields) && (flds_indices[x] != i))
+                                display = 0;
+                            else
+                              {
+                                  display = 1;
+                                  x++;
+                              }
+
+                            for (t = 0; t < order[i]; t++)
+                              {
+                                  if(display)
+                                      cn+=(vfmtfn[i]) (b, ff, fp);
+                                  b += off[i];
+                                  if (display)
+                                    {
+                           
+                                        cn++;
+                                        cnt2++;
+                                    }
+                              }
+                            if (display)
+                              {
+                           
+                                  cn++;
+                                  cnt2++;
+                              }
+                        }		/* for i to nf-1 */      
+                      if (cnt2 > 0)
+                        {
+                            address++;
+                            /* "separator" is the symbol used for separating
+                               different records. */
+                        }
+
+                  }	/* for (j=0; j<count; j++) */
+            }		/* while (done != nv) */
+
+          /* ============================================ */
+
+          HDfree((VOIDP) bb);     
+          bb = NULL;
+      }   /* binary file */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (bb != NULL)
+              HDfree((VOIDP)bb);
+      }
+    /* Normal cleanup */
+    
+    return ret_value;
+}	/* dumpvd */
+
+
+/* 
+ * dumps attributes of vdata for vgroup
+ */
+intn 
+dumpattr(int32 vid, 
+         int32 findex, 
+         intn isvs,
+         file_format_t ff, 
+         FILE *fp)
+{
+    intn          i, k;
+    intn          cn = 0;
+    intn          nattrs;
+    intn          alloc_flag = 0;
+    int32         i_type;
+    int32         i_count;
+    int32         i_size, e_size;
+    int32         off;
+    uint8         *buf = NULL;
+    uint8         *ptr = NULL;
+    intn (*vfmtfn)(VOIDP, file_format_t ff, FILE *);
+    intn          status;
+    intn          ret_value = SUCCEED;
+    char          name[FIELDNAMELENMAX+1];
+    uint8         attrbuf[BUFFER];
+
+    /* vdata or vgroup? */
+    if (isvs) 
+        nattrs = VSfnattrs(vid, findex);
+    else
+         /* nattrs = Vnattrs(vid); <- replaced with Vnattrs2 to catch all attributes;
+				      previously, SD attributes were missed by V API */
+        nattrs = Vnattrs2(vid);
+
+    if (FAIL == nattrs)
+      {
+          fprintf(stderr,">>>dumpattr: Failed to get number of attributes for vid %d \n",(int)vid);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    fprintf(fp, "   number of attributes = %d \n", nattrs);
+
+    /* loop for number of attributes to process */
+    for (i = 0; i < nattrs; i++) 
+      {
+          /* get attribute infor of vdata/vgroup */
+          if (isvs)
+              status = VSattrinfo(vid, findex, i, name, &i_type, &i_count, &e_size);
+          else
+	      /* Changed to use updated func of Vattrinfo - BMR, 1/7/2013 */
+              status = Vattrinfo2(vid, i, name, &i_type,&i_count, &e_size, NULL, NULL);
+
+          if (status == FAIL) 
+            {
+                fprintf(stderr,">>>dumpattr: failed in getting %d'th attr info.\n",i);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* get attribute hdfsize of vdata/vgroup */
+          if (isvs)
+              status = VSattrhdfsize(vid, findex, i, &i_size);
+          else
+              status = Vattrhdfsize(vid, i, &i_size);
+
+          if (status == FAIL) 
+            {
+                fprintf(stderr,">>>dumpattr: failed in getting %d'th attr hdfsize.\n",i);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          fprintf(fp,"    attr%d: name=%s type=%d count=%d size=%d\n",
+                  i, name, (int)i_type, (int)i_count, (int)i_size);
+
+          /* we have two buffer sizes? */
+          if (e_size > BUFFER) 
+            {
+                if (NULL == (buf = HDmalloc(e_size)))  
+                  {
+                      fprintf(stderr,">>>dumpattr:can't allocate buf for %d'th attribute.\n",i);
+                      ret_value = FAIL;
+                      goto done;  /* do we want exit here? */
+                  }
+
+                alloc_flag = 1;
+
+                /* get attribute itself */
+                if (isvs) 
+                    status = VSgetattr(vid, findex, i, (VOIDP)buf);
+                else
+		    /* Changed to use updated func of Vgetattr - BMR, 1/7/2013 */
+                    status = Vgetattr2(vid, i, (VOIDP)buf);
+
+                if (status == FAIL) 
+                  {
+                      fprintf(stderr,">>>dympattr: failed in getting %d'th attr .\n",i);
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+          else
+            {
+                /* get attribute itself */
+                if (isvs) 
+                    status = VSgetattr(vid, findex, i, (VOIDP)attrbuf);
+                else
+		    /* Changed to use updated func of Vgetattr - BMR, 1/7/2013 */
+                    status = Vgetattr2(vid, i, (VOIDP)attrbuf);
+
+                if (status == FAIL) 
+                  {
+                      fprintf(stderr,">>>dympattr: failed in getting %d'th attr.\n",i);
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+
+          /* format output */
+          switch (i_type & 0xff)  
+            {
+            case DFNT_CHAR:
+            case DFNT_UCHAR:
+                vfmtfn = fmtchar;
+                break;
+            case DFNT_UINT8:
+                vfmtfn = fmtuint8;
+                break;
+            case DFNT_INT8:
+                vfmtfn = fmtint8;
+                break;
+            case DFNT_UINT16:
+                vfmtfn = fmtuint16;
+                break;
+            case DFNT_INT16:
+                vfmtfn = fmtint16;
+                break;
+            case DFNT_UINT32:
+                vfmtfn = fmtuint32;
+                break;
+            case DFNT_INT32:
+                vfmtfn = fmtint32;
+                break;
+            case DFNT_FLOAT32:
+                vfmtfn = fmtfloat32;
+                break;
+            case DFNT_FLOAT64:
+                vfmtfn = fmtfloat64;
+                break;
+            default:
+                fprintf(stderr,">>>dumpattr: sorry, type [%d] not supported\n",
+                        (int) i_type);
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* find offset */
+          off = DFKNTsize(i_type | DFNT_NATIVE);
+
+          /* which buffer are we using? */
+          ptr = (alloc_flag) ? buf : attrbuf;
+
+          putchar('\t');
+          cn = 0;
+          for (k = 0; k < i_count; k++)  
+            {
+                cn += vfmtfn((uint8 *)ptr, ff, fp);
+                ptr += off;
+                putchar(' ');
+                cn++;
+                if (cn > 55)  
+                  {
+                      putchar('\n');
+                      putchar('\t');
+                      cn = 0;
+                  }
+            }
+
+          if (cn) 
+              putchar('\n');
+
+          /* free allocated space if any */
+          if (alloc_flag) 
+            {
+                if ( buf != NULL)
+                    HDfree(buf);
+                alloc_flag = 0;
+                buf = NULL;
+            }
+      }  /* for i */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (buf != NULL)
+              HDfree(buf);
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+}
diff --git a/mfhdf/dumper/testfiles/Example6.hdf b/mfhdf/dumper/testfiles/Example6.hdf
new file mode 100644
index 0000000..721d961
Binary files /dev/null and b/mfhdf/dumper/testfiles/Example6.hdf differ
diff --git a/mfhdf/dumper/testfiles/IMCOMP.hdf b/mfhdf/dumper/testfiles/IMCOMP.hdf
new file mode 100644
index 0000000..bda96f2
Binary files /dev/null and b/mfhdf/dumper/testfiles/IMCOMP.hdf differ
diff --git a/mfhdf/dumper/testfiles/Image_with_Palette.hdf b/mfhdf/dumper/testfiles/Image_with_Palette.hdf
new file mode 100644
index 0000000..1665cd7
Binary files /dev/null and b/mfhdf/dumper/testfiles/Image_with_Palette.hdf differ
diff --git a/mfhdf/dumper/testfiles/LongDataset.hdf b/mfhdf/dumper/testfiles/LongDataset.hdf
new file mode 100644
index 0000000..a0adbce
Binary files /dev/null and b/mfhdf/dumper/testfiles/LongDataset.hdf differ
diff --git a/mfhdf/dumper/testfiles/Roy.nc b/mfhdf/dumper/testfiles/Roy.nc
new file mode 100644
index 0000000..6849aef
Binary files /dev/null and b/mfhdf/dumper/testfiles/Roy.nc differ
diff --git a/mfhdf/dumper/testfiles/SDSlongname.hdf b/mfhdf/dumper/testfiles/SDSlongname.hdf
new file mode 100644
index 0000000..6d783f0
Binary files /dev/null and b/mfhdf/dumper/testfiles/SDSlongname.hdf differ
diff --git a/mfhdf/dumper/testfiles/Tables.hdf b/mfhdf/dumper/testfiles/Tables.hdf
new file mode 100644
index 0000000..3c2bd83
Binary files /dev/null and b/mfhdf/dumper/testfiles/Tables.hdf differ
diff --git a/mfhdf/dumper/testfiles/Tables_External_File b/mfhdf/dumper/testfiles/Tables_External_File
new file mode 100644
index 0000000..aacb44f
Binary files /dev/null and b/mfhdf/dumper/testfiles/Tables_External_File differ
diff --git a/mfhdf/dumper/testfiles/VGlongname.hdf b/mfhdf/dumper/testfiles/VGlongname.hdf
new file mode 100644
index 0000000..686c468
Binary files /dev/null and b/mfhdf/dumper/testfiles/VGlongname.hdf differ
diff --git a/mfhdf/dumper/testfiles/ctxtr2r.hdf b/mfhdf/dumper/testfiles/ctxtr2r.hdf
new file mode 100644
index 0000000..e219f18
Binary files /dev/null and b/mfhdf/dumper/testfiles/ctxtr2r.hdf differ
diff --git a/mfhdf/dumper/testfiles/dumpgr-1.out b/mfhdf/dumper/testfiles/dumpgr-1.out
new file mode 100644
index 0000000..cdd5915
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-1.out
@@ -0,0 +1,145 @@
+File name: grtdfui82.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 6
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 
+                12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 
+                20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 
+                29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 
+                37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 
+                46 46 47 47 48 48 49 49 
+
+	 Image  Name = Raster Image #1
+	 Index = 1
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 2
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 
+                8 8 9 9 9 10 10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 
+                3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 
+                11 11 12 12 12 13 13 13 2 2 2 3 3 3 4 4 4 5 5 5 6 
+                6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 
+                13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 
+                9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 
+                15 15 15 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 
+                10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+                16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 19 19 19 20 20 20 21 21 21 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 
+                11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 
+                16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+                22 22 23 23 23 12 12 12 13 13 13 14 14 14 15 15 15 
+                16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 
+                21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+                15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 
+                21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 14 14 
+                14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+                20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 
+                26 26 26 
+
+	 Image  Name = Raster Image #2
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 
+                11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 1 1 3 3 5 5 7 7 
+                9 9 11 11 13 1 1 3 3 5 5 7 7 9 9 11 11 13 1 1 3 3 
+                5 5 7 7 9 9 11 11 13 2 3 2 3 6 7 6 7 10 11 10 11 14 
+                2 3 2 3 6 7 6 7 10 11 10 11 14 2 3 2 3 6 7 6 7 10 
+                11 10 11 14 3 3 3 3 7 7 7 7 11 11 11 11 15 3 3 3 3 
+                7 7 7 7 11 11 11 11 15 3 3 3 3 7 7 7 7 11 11 11 11 
+                15 4 5 6 7 4 5 6 7 12 13 14 15 12 4 5 6 7 4 5 6 7 
+                12 13 14 15 12 4 5 6 7 4 5 6 7 12 13 14 15 12 5 5 
+                7 7 5 5 7 7 13 13 15 15 13 5 5 7 7 5 5 7 7 13 13 15 
+                15 13 5 5 7 7 5 5 7 7 13 13 15 15 13 6 7 6 7 6 7 6 
+                7 14 15 14 15 14 6 7 6 7 6 7 6 7 14 15 14 15 14 6 
+                7 6 7 6 7 6 7 14 15 14 15 14 7 7 7 7 7 7 7 7 15 15 
+                15 15 15 7 7 7 7 7 7 7 7 15 15 15 15 15 7 7 7 7 7 
+                7 7 7 15 15 15 15 15 8 9 10 11 12 13 14 15 8 9 10 
+                11 12 8 9 10 11 12 13 14 15 8 9 10 11 12 8 9 10 11 
+                12 13 14 15 8 9 10 11 12 9 9 11 11 13 13 15 15 9 9 
+                11 11 13 9 9 11 11 13 13 15 15 9 9 11 11 13 9 9 11 
+                11 13 13 15 15 9 9 11 11 13 10 11 10 11 14 15 14 15 
+                10 11 10 11 14 10 11 10 11 14 15 14 15 10 11 10 11 
+                14 10 11 10 11 14 15 14 15 10 11 10 11 14 11 11 11 
+                11 15 15 15 15 11 11 11 11 15 11 11 11 11 15 15 15 
+                15 11 11 11 11 15 11 11 11 11 15 15 15 15 11 11 11 
+                11 15 12 13 14 15 12 13 14 15 12 13 14 15 12 12 13 
+                14 15 12 13 14 15 12 13 14 15 12 12 13 14 15 12 13 
+                14 15 12 13 14 15 12 13 13 15 15 13 13 15 15 13 13 
+                15 15 13 13 13 15 15 13 13 15 15 13 13 15 15 13 13 
+                13 15 15 13 13 15 15 13 13 15 15 13 14 15 14 15 14 
+                15 14 15 14 15 14 15 14 14 15 14 15 14 15 14 15 14 
+                15 14 15 14 14 15 14 15 14 15 14 15 14 15 14 15 14 
+
+	 Image  Name = Raster Image #3
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 8 11 
+                10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 6 5 4 
+                11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 4 7 6 
+                1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 12 13 
+                10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 12 13 
+                14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 2 5 10 
+                11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 13 12 
+                3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 12 15 
+                14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 6 7 4 
+                5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 
+                8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 
+                6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 
+                4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 
+                12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 
+                12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 
+                2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 
+                13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 
+                12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 
+                6 7 4 5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 
+                7 6 9 8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 
+                1 0 7 6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 
+                15 8 5 4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 
+                14 15 12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 
+                10 11 12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 
+                1 0 3 2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 
+                8 15 14 13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 
+                6 7 0 13 12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 
+                10 11 8 9 6 7 4 5 2 
diff --git a/mfhdf/dumper/testfiles/dumpgr-10.out b/mfhdf/dumper/testfiles/dumpgr-10.out
new file mode 100644
index 0000000..e5382ae
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-10.out
@@ -0,0 +1,150 @@
+File name: grtdfui84.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 5
+	 ncomps = 4
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 
+                6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 
+                11 12 12 12 12 13 13 13 13 14 14 14 14 15 15 15 15 
+                16 16 16 16 17 17 17 17 18 18 18 18 19 19 19 19 20 
+                20 20 20 21 21 21 21 22 22 22 22 23 23 23 23 24 24 
+                24 24 25 25 25 25 26 26 26 26 27 27 27 27 28 28 28 
+                28 29 29 29 29 30 30 30 30 31 31 31 31 32 32 32 32 
+                33 33 33 33 34 34 34 34 35 35 35 35 36 36 36 36 37 
+                37 37 37 38 38 38 38 39 39 39 39 40 40 40 40 41 41 
+                41 41 42 42 42 42 43 43 43 43 44 44 44 44 45 45 45 
+                45 46 46 46 46 47 47 47 47 48 48 48 48 49 49 49 49 
+
+	 Image  Name = Raster Image #1
+	 Index = 1
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 2
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 
+                8 8 9 9 9 10 10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 
+                3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 
+                11 11 12 12 12 13 13 13 2 2 2 3 3 3 4 4 4 5 5 5 6 
+                6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 
+                13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 
+                9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 
+                15 15 15 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 
+                10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+                16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 19 19 19 20 20 20 21 21 21 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 
+                11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 
+                16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+                22 22 23 23 23 12 12 12 13 13 13 14 14 14 15 15 15 
+                16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 
+                21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+                15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 
+                21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 14 14 
+                14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+                20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 
+                26 26 26 
+
+	 Image  Name = Raster Image #2
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 
+                11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 1 1 3 3 5 5 7 7 
+                9 9 11 11 13 1 1 3 3 5 5 7 7 9 9 11 11 13 1 1 3 3 
+                5 5 7 7 9 9 11 11 13 2 3 2 3 6 7 6 7 10 11 10 11 14 
+                2 3 2 3 6 7 6 7 10 11 10 11 14 2 3 2 3 6 7 6 7 10 
+                11 10 11 14 3 3 3 3 7 7 7 7 11 11 11 11 15 3 3 3 3 
+                7 7 7 7 11 11 11 11 15 3 3 3 3 7 7 7 7 11 11 11 11 
+                15 4 5 6 7 4 5 6 7 12 13 14 15 12 4 5 6 7 4 5 6 7 
+                12 13 14 15 12 4 5 6 7 4 5 6 7 12 13 14 15 12 5 5 
+                7 7 5 5 7 7 13 13 15 15 13 5 5 7 7 5 5 7 7 13 13 15 
+                15 13 5 5 7 7 5 5 7 7 13 13 15 15 13 6 7 6 7 6 7 6 
+                7 14 15 14 15 14 6 7 6 7 6 7 6 7 14 15 14 15 14 6 
+                7 6 7 6 7 6 7 14 15 14 15 14 7 7 7 7 7 7 7 7 15 15 
+                15 15 15 7 7 7 7 7 7 7 7 15 15 15 15 15 7 7 7 7 7 
+                7 7 7 15 15 15 15 15 8 9 10 11 12 13 14 15 8 9 10 
+                11 12 8 9 10 11 12 13 14 15 8 9 10 11 12 8 9 10 11 
+                12 13 14 15 8 9 10 11 12 9 9 11 11 13 13 15 15 9 9 
+                11 11 13 9 9 11 11 13 13 15 15 9 9 11 11 13 9 9 11 
+                11 13 13 15 15 9 9 11 11 13 10 11 10 11 14 15 14 15 
+                10 11 10 11 14 10 11 10 11 14 15 14 15 10 11 10 11 
+                14 10 11 10 11 14 15 14 15 10 11 10 11 14 11 11 11 
+                11 15 15 15 15 11 11 11 11 15 11 11 11 11 15 15 15 
+                15 11 11 11 11 15 11 11 11 11 15 15 15 15 11 11 11 
+                11 15 12 13 14 15 12 13 14 15 12 13 14 15 12 12 13 
+                14 15 12 13 14 15 12 13 14 15 12 12 13 14 15 12 13 
+                14 15 12 13 14 15 12 13 13 15 15 13 13 15 15 13 13 
+                15 15 13 13 13 15 15 13 13 15 15 13 13 15 15 13 13 
+                13 15 15 13 13 15 15 13 13 15 15 13 14 15 14 15 14 
+                15 14 15 14 15 14 15 14 14 15 14 15 14 15 14 15 14 
+                15 14 15 14 14 15 14 15 14 15 14 15 14 15 14 15 14 
+
+	 Image  Name = Raster Image #3
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 8 11 
+                10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 6 5 4 
+                11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 4 7 6 
+                1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 12 13 
+                10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 12 13 
+                14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 2 5 10 
+                11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 13 12 
+                3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 12 15 
+                14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 6 7 4 
+                5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 
+                8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 
+                6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 
+                4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 
+                12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 
+                12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 
+                2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 
+                13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 
+                12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 
+                6 7 4 5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 
+                7 6 9 8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 
+                1 0 7 6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 
+                15 8 5 4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 
+                14 15 12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 
+                10 11 12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 
+                1 0 3 2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 
+                8 15 14 13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 
+                6 7 0 13 12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 
+                10 11 8 9 6 7 4 5 2 
diff --git a/mfhdf/dumper/testfiles/dumpgr-11.out b/mfhdf/dumper/testfiles/dumpgr-11.out
new file mode 100644
index 0000000..72588ac
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-11.out
@@ -0,0 +1,145 @@
+File name: grtdfui162.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 16-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 5
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 
+                12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 
+                20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 
+                29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 
+                37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 
+                46 46 47 47 48 48 49 49 
+
+	 Image  Name = Raster Image #1
+	 Index = 1
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 2
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 
+                8 8 9 9 9 10 10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 
+                3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 
+                11 11 12 12 12 13 13 13 2 2 2 3 3 3 4 4 4 5 5 5 6 
+                6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 
+                13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 
+                9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 
+                15 15 15 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 
+                10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+                16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 19 19 19 20 20 20 21 21 21 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 
+                11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 
+                16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+                22 22 23 23 23 12 12 12 13 13 13 14 14 14 15 15 15 
+                16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 
+                21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+                15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 
+                21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 14 14 
+                14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+                20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 
+                26 26 26 
+
+	 Image  Name = Raster Image #2
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 
+                11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 1 1 3 3 5 5 7 7 
+                9 9 11 11 13 1 1 3 3 5 5 7 7 9 9 11 11 13 1 1 3 3 
+                5 5 7 7 9 9 11 11 13 2 3 2 3 6 7 6 7 10 11 10 11 14 
+                2 3 2 3 6 7 6 7 10 11 10 11 14 2 3 2 3 6 7 6 7 10 
+                11 10 11 14 3 3 3 3 7 7 7 7 11 11 11 11 15 3 3 3 3 
+                7 7 7 7 11 11 11 11 15 3 3 3 3 7 7 7 7 11 11 11 11 
+                15 4 5 6 7 4 5 6 7 12 13 14 15 12 4 5 6 7 4 5 6 7 
+                12 13 14 15 12 4 5 6 7 4 5 6 7 12 13 14 15 12 5 5 
+                7 7 5 5 7 7 13 13 15 15 13 5 5 7 7 5 5 7 7 13 13 15 
+                15 13 5 5 7 7 5 5 7 7 13 13 15 15 13 6 7 6 7 6 7 6 
+                7 14 15 14 15 14 6 7 6 7 6 7 6 7 14 15 14 15 14 6 
+                7 6 7 6 7 6 7 14 15 14 15 14 7 7 7 7 7 7 7 7 15 15 
+                15 15 15 7 7 7 7 7 7 7 7 15 15 15 15 15 7 7 7 7 7 
+                7 7 7 15 15 15 15 15 8 9 10 11 12 13 14 15 8 9 10 
+                11 12 8 9 10 11 12 13 14 15 8 9 10 11 12 8 9 10 11 
+                12 13 14 15 8 9 10 11 12 9 9 11 11 13 13 15 15 9 9 
+                11 11 13 9 9 11 11 13 13 15 15 9 9 11 11 13 9 9 11 
+                11 13 13 15 15 9 9 11 11 13 10 11 10 11 14 15 14 15 
+                10 11 10 11 14 10 11 10 11 14 15 14 15 10 11 10 11 
+                14 10 11 10 11 14 15 14 15 10 11 10 11 14 11 11 11 
+                11 15 15 15 15 11 11 11 11 15 11 11 11 11 15 15 15 
+                15 11 11 11 11 15 11 11 11 11 15 15 15 15 11 11 11 
+                11 15 12 13 14 15 12 13 14 15 12 13 14 15 12 12 13 
+                14 15 12 13 14 15 12 13 14 15 12 12 13 14 15 12 13 
+                14 15 12 13 14 15 12 13 13 15 15 13 13 15 15 13 13 
+                15 15 13 13 13 15 15 13 13 15 15 13 13 15 15 13 13 
+                13 15 15 13 13 15 15 13 13 15 15 13 14 15 14 15 14 
+                15 14 15 14 15 14 15 14 14 15 14 15 14 15 14 15 14 
+                15 14 15 14 14 15 14 15 14 15 14 15 14 15 14 15 14 
+
+	 Image  Name = Raster Image #3
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 8 11 
+                10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 6 5 4 
+                11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 4 7 6 
+                1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 12 13 
+                10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 12 13 
+                14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 2 5 10 
+                11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 13 12 
+                3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 12 15 
+                14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 6 7 4 
+                5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 
+                8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 
+                6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 
+                4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 
+                12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 
+                12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 
+                2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 
+                13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 
+                12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 
+                6 7 4 5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 
+                7 6 9 8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 
+                1 0 7 6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 
+                15 8 5 4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 
+                14 15 12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 
+                10 11 12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 
+                1 0 3 2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 
+                8 15 14 13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 
+                6 7 0 13 12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 
+                10 11 8 9 6 7 4 5 2 
diff --git a/mfhdf/dumper/testfiles/dumpgr-12.out b/mfhdf/dumper/testfiles/dumpgr-12.out
new file mode 100644
index 0000000..ea45818
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-12.out
@@ -0,0 +1,97 @@
+File name: grtdfi322.hdf 
+
+    File attributes:
+	 Attr0: Name = File contents
+		 Type = 8-bit signed char 
+		 Count= 16
+		 Value =  image data \000\000\000\000
+
+	 Image  Name = Raster Image #0
+	 Index = 0
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 7
+	 ncomps = 1
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 1
+	 Attr0: Name = Value range
+		 Type = 32-bit signed integer 
+		 Count= 2
+		 Value = 0 60 
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 
+
+	 Image  Name = Image_array_5
+	 Index = 1
+	 Type= 32-bit signed integer
+	 width=10; height=5
+	 Ref. = 5
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 5 0 5 1 6 1 6 2 7 2 7 3 8 3 8 4 9 4 9 10 15 10 15 
+                11 16 11 16 12 17 12 17 13 18 13 18 14 19 14 19 20 
+                25 20 25 21 26 21 26 22 27 22 27 23 28 23 28 24 29 
+                24 29 30 35 30 35 31 36 31 36 32 37 32 37 33 38 33 
+                38 34 39 34 39 40 45 40 45 41 46 41 46 42 47 42 47 
+                43 48 43 48 44 49 44 49 
+
+	 Image  Name = Raster Image #3
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 1
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
+
+	 Image  Name = Raster Image #4
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
+
+	 Image  Name = Raster Image #5
+	 Index = 4
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
diff --git a/mfhdf/dumper/testfiles/dumpgr-13.out b/mfhdf/dumper/testfiles/dumpgr-13.out
new file mode 100644
index 0000000..e1c63e5
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-13.out
@@ -0,0 +1,82 @@
+File name: Image_with_Palette.hdf 
+
+	 Raster Image Ref. = 2
+	 Palette: 3 components; 256 entries
+	 Palette Data: 
+                0 0 8 1 0 8 2 0 8 3 0 8 4 0 8 5 0 8 6 0 8 7 0 8 8 
+                0 8 9 0 8 10 0 8 11 0 8 12 0 8 13 0 8 14 0 8 15 0 
+                8 16 0 8 17 0 8 18 0 8 19 0 8 20 0 8 21 0 8 22 0 8 
+                23 0 8 24 0 8 25 0 8 26 0 8 27 0 8 28 0 8 29 0 8 30 
+                0 8 31 0 8 32 0 8 33 0 8 34 0 8 35 0 8 36 0 8 37 0 
+                8 38 0 8 39 0 8 40 0 8 41 0 8 42 0 8 43 0 8 44 0 8 
+                45 0 8 46 0 8 47 0 8 48 0 8 49 0 8 50 0 8 51 0 8 52 
+                0 8 53 0 8 54 0 8 55 0 8 56 0 8 57 0 8 58 0 8 59 0 
+                8 60 0 8 61 0 8 62 0 8 63 0 8 64 0 8 65 0 8 66 0 8 
+                67 0 8 68 0 8 69 0 8 70 0 8 71 0 8 72 0 8 73 0 8 74 
+                0 8 75 0 8 76 0 8 77 0 8 78 0 8 79 0 8 80 0 8 81 0 
+                8 82 0 8 83 0 8 84 0 8 85 0 8 86 0 8 87 0 8 88 0 8 
+                89 0 8 90 0 8 91 0 8 92 0 8 93 0 8 94 0 8 95 0 8 96 
+                0 8 97 0 8 98 0 8 99 0 8 100 0 8 101 0 8 102 0 8 103 
+                0 8 104 0 8 105 0 8 106 0 8 107 0 8 108 0 8 109 0 
+                8 110 0 8 111 0 8 112 0 8 113 0 8 114 0 8 115 0 8 
+                116 0 8 117 0 8 118 0 8 119 0 8 120 0 8 121 0 8 122 
+                0 8 123 0 8 124 0 8 125 0 8 126 0 8 127 0 8 128 0 
+                8 129 0 8 130 0 8 131 0 8 132 0 8 133 0 8 134 0 8 
+                135 0 8 136 0 8 137 0 8 138 0 8 139 0 8 140 0 8 141 
+                0 8 142 0 8 143 0 8 144 0 8 145 0 8 146 0 8 147 0 
+                8 148 0 8 149 0 8 150 0 8 151 0 8 152 0 8 153 0 8 
+                154 0 8 155 0 8 156 0 8 157 0 8 158 0 8 159 0 8 160 
+                0 8 161 0 8 162 0 8 163 0 8 164 0 8 165 0 8 166 0 
+                8 167 0 8 168 0 8 169 0 8 170 0 8 171 0 8 172 0 8 
+                173 0 8 174 0 8 175 0 8 176 0 8 177 0 8 178 0 8 179 
+                0 8 180 0 8 181 0 8 182 0 8 183 0 8 184 0 8 185 0 
+                8 186 0 8 187 0 8 188 0 8 189 0 8 190 0 8 191 0 8 
+                192 0 8 193 0 8 194 0 8 195 0 8 196 0 8 197 0 8 198 
+                0 8 199 0 8 200 0 8 201 0 8 202 0 8 203 0 8 204 0 
+                8 205 0 8 206 0 8 207 0 8 208 0 8 209 0 8 210 0 8 
+                211 0 8 212 0 8 213 0 8 214 0 8 215 0 8 216 0 8 217 
+                0 8 218 0 8 219 0 8 220 0 8 221 0 8 222 0 8 223 0 
+                8 224 0 8 225 0 8 226 0 8 227 0 8 228 0 8 229 0 8 
+                230 0 8 231 0 8 232 0 8 233 0 8 234 0 8 235 0 8 236 
+                0 8 237 0 8 238 0 8 239 0 8 240 0 8 241 0 8 242 0 
+                8 243 0 8 244 0 8 245 0 8 246 0 8 247 0 8 248 0 8 
+                249 0 8 250 0 8 251 0 8 252 0 8 253 0 8 254 0 8 255 
+                0 8 
+
+	 Raster Image Ref. = 3
+	 Palette: 3 components; 256 entries
+	 Palette Data: 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 
+                4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 
+                8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+                2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 2 4 8 
+
+	 Raster Image Ref. = 4
+	 No palette data
diff --git a/mfhdf/dumper/testfiles/dumpgr-14.out b/mfhdf/dumper/testfiles/dumpgr-14.out
new file mode 100644
index 0000000..f2a904b
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-14.out
@@ -0,0 +1,34 @@
+File name: Image_with_Palette.hdf 
+
+	 Image  Name = Image with Palette
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=5; height=5
+	 Ref. = 2
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 Palette: 3 components; 256 entries
+	 Compression method = NONE
+	 Number of attributes = 0
+
+	 Image  Name = Second Image w/pal
+	 Index = 1
+	 Type= 8-bit unsigned integer
+	 width=5; height=5
+	 Ref. = 3
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 Palette: 3 components; 256 entries
+	 Compression method = NONE
+	 Number of attributes = 0
+
+	 Image  Name = Last Image: no pal
+	 Index = 2
+	 Type= 8-bit unsigned integer
+	 width=5; height=5
+	 Ref. = 4
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
diff --git a/mfhdf/dumper/testfiles/dumpgr-15.out b/mfhdf/dumper/testfiles/dumpgr-15.out
new file mode 100644
index 0000000..04ec039
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-15.out
@@ -0,0 +1,30 @@
+0 0 8 1 0 8 2 0 8 3 0 8 4 0 8 5 0 8 6 0 8 7 0 8 8 0 8 9 0 8 10 0 8 
+11 0 8 12 0 8 13 0 8 14 0 8 15 0 8 16 0 8 17 0 8 18 0 8 19 0 8 20 
+0 8 21 0 8 22 0 8 23 0 8 24 0 8 25 0 8 26 0 8 27 0 8 28 0 8 29 0 8 
+30 0 8 31 0 8 32 0 8 33 0 8 34 0 8 35 0 8 36 0 8 37 0 8 38 0 8 39 
+0 8 40 0 8 41 0 8 42 0 8 43 0 8 44 0 8 45 0 8 46 0 8 47 0 8 48 0 8 
+49 0 8 50 0 8 51 0 8 52 0 8 53 0 8 54 0 8 55 0 8 56 0 8 57 0 8 58 
+0 8 59 0 8 60 0 8 61 0 8 62 0 8 63 0 8 64 0 8 65 0 8 66 0 8 67 0 8 
+68 0 8 69 0 8 70 0 8 71 0 8 72 0 8 73 0 8 74 0 8 75 0 8 76 0 8 77 
+0 8 78 0 8 79 0 8 80 0 8 81 0 8 82 0 8 83 0 8 84 0 8 85 0 8 86 0 8 
+87 0 8 88 0 8 89 0 8 90 0 8 91 0 8 92 0 8 93 0 8 94 0 8 95 0 8 96 
+0 8 97 0 8 98 0 8 99 0 8 100 0 8 101 0 8 102 0 8 103 0 8 104 0 8 105 
+0 8 106 0 8 107 0 8 108 0 8 109 0 8 110 0 8 111 0 8 112 0 8 113 0 
+8 114 0 8 115 0 8 116 0 8 117 0 8 118 0 8 119 0 8 120 0 8 121 0 8 
+122 0 8 123 0 8 124 0 8 125 0 8 126 0 8 127 0 8 128 0 8 129 0 8 130 
+0 8 131 0 8 132 0 8 133 0 8 134 0 8 135 0 8 136 0 8 137 0 8 138 0 
+8 139 0 8 140 0 8 141 0 8 142 0 8 143 0 8 144 0 8 145 0 8 146 0 8 
+147 0 8 148 0 8 149 0 8 150 0 8 151 0 8 152 0 8 153 0 8 154 0 8 155 
+0 8 156 0 8 157 0 8 158 0 8 159 0 8 160 0 8 161 0 8 162 0 8 163 0 
+8 164 0 8 165 0 8 166 0 8 167 0 8 168 0 8 169 0 8 170 0 8 171 0 8 
+172 0 8 173 0 8 174 0 8 175 0 8 176 0 8 177 0 8 178 0 8 179 0 8 180 
+0 8 181 0 8 182 0 8 183 0 8 184 0 8 185 0 8 186 0 8 187 0 8 188 0 
+8 189 0 8 190 0 8 191 0 8 192 0 8 193 0 8 194 0 8 195 0 8 196 0 8 
+197 0 8 198 0 8 199 0 8 200 0 8 201 0 8 202 0 8 203 0 8 204 0 8 205 
+0 8 206 0 8 207 0 8 208 0 8 209 0 8 210 0 8 211 0 8 212 0 8 213 0 
+8 214 0 8 215 0 8 216 0 8 217 0 8 218 0 8 219 0 8 220 0 8 221 0 8 
+222 0 8 223 0 8 224 0 8 225 0 8 226 0 8 227 0 8 228 0 8 229 0 8 230 
+0 8 231 0 8 232 0 8 233 0 8 234 0 8 235 0 8 236 0 8 237 0 8 238 0 
+8 239 0 8 240 0 8 241 0 8 242 0 8 243 0 8 244 0 8 245 0 8 246 0 8 
+247 0 8 248 0 8 249 0 8 250 0 8 251 0 8 252 0 8 253 0 8 254 0 8 255 
+0 8 
diff --git a/mfhdf/dumper/testfiles/dumpgr-16.out b/mfhdf/dumper/testfiles/dumpgr-16.out
new file mode 100644
index 0000000..416c823
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-16.out
@@ -0,0 +1 @@
+0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 
diff --git a/mfhdf/dumper/testfiles/dumpgr-17.out b/mfhdf/dumper/testfiles/dumpgr-17.out
new file mode 100644
index 0000000..6fa08a0
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-17.out
@@ -0,0 +1,19 @@
+File name: grtdfui82.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 6
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 10 11 12 13 
+                14 15 16 17 18 19 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 20 21 22 23 24 25 26 27 
+                28 29 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 
+                35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 40 41 
+                42 43 44 45 46 47 48 49 
diff --git a/mfhdf/dumper/testfiles/dumpgr-18.out b/mfhdf/dumper/testfiles/dumpgr-18.out
new file mode 100644
index 0000000..a335792
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-18.out
@@ -0,0 +1,97 @@
+File name: grtdfi322.hdf 
+
+    File attributes:
+	 Attr0: Name = File contents
+		 Type = 8-bit signed char 
+		 Count= 16
+		 Value =  image data 
+
+	 Image  Name = Raster Image #0
+	 Index = 0
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 7
+	 ncomps = 1
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 1
+	 Attr0: Name = Value range
+		 Type = 32-bit signed integer 
+		 Count= 2
+		 Value = 0 60 
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 
+
+	 Image  Name = Image_array_5
+	 Index = 1
+	 Type= 32-bit signed integer
+	 width=10; height=5
+	 Ref. = 5
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 5 0 5 1 6 1 6 2 7 2 7 3 8 3 8 4 9 4 9 10 15 10 15 
+                11 16 11 16 12 17 12 17 13 18 13 18 14 19 14 19 20 
+                25 20 25 21 26 21 26 22 27 22 27 23 28 23 28 24 29 
+                24 29 30 35 30 35 31 36 31 36 32 37 32 37 33 38 33 
+                38 34 39 34 39 40 45 40 45 41 46 41 46 42 47 42 47 
+                43 48 43 48 44 49 44 49 
+
+	 Image  Name = Raster Image #3
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 1
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
+
+	 Image  Name = Raster Image #4
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
+
+	 Image  Name = Raster Image #5
+	 Index = 4
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
diff --git a/mfhdf/dumper/testfiles/dumpgr-19.out b/mfhdf/dumper/testfiles/dumpgr-19.out
new file mode 100644
index 0000000..595df50
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-19.out
@@ -0,0 +1,95 @@
+File name: grtdfi322.hdf 
+
+    File attributes:
+	 Attr0: Name = File contents
+		 Type = 8-bit signed char 
+		 Count= 16
+
+	 Image  Name = Raster Image #0
+	 Index = 0
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 7
+	 ncomps = 1
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 1
+	 Attr0: Name = Value range
+		 Type = 32-bit signed integer 
+		 Count= 2
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 
+
+	 Image  Name = Image_array_5
+	 Index = 1
+	 Type= 32-bit signed integer
+	 width=10; height=5
+	 Ref. = 5
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 5 0 5 1 6 1 6 2 7 2 7 3 8 3 8 4 9 4 9 10 15 10 15 
+                11 16 11 16 12 17 12 17 13 18 13 18 14 19 14 19 20 
+                25 20 25 21 26 21 26 22 27 22 27 23 28 23 28 24 29 
+                24 29 30 35 30 35 31 36 31 36 32 37 32 37 33 38 33 
+                38 34 39 34 39 40 45 40 45 41 46 41 46 42 47 42 47 
+                43 48 43 48 44 49 44 49 
+
+	 Image  Name = Raster Image #3
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 1
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
+
+	 Image  Name = Raster Image #4
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
+
+	 Image  Name = Raster Image #5
+	 Index = 4
+	 Type= 8-bit unsigned char
+	 width=5; height=6
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
+                21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 
+                38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 
+                55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 
+                72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 
+                89 90 
diff --git a/mfhdf/dumper/testfiles/dumpgr-2.out b/mfhdf/dumper/testfiles/dumpgr-2.out
new file mode 100644
index 0000000..d2f649b
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-2.out
@@ -0,0 +1,103 @@
+File name: grtdfui82.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 6
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 
+                12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 
+                20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 
+                29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 
+                37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 
+                46 46 47 47 48 48 49 49 
+
+	 Image  Name = Raster Image #1
+	 Index = 1
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 2
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 
+                8 8 9 9 9 10 10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 
+                3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 
+                11 11 12 12 12 13 13 13 2 2 2 3 3 3 4 4 4 5 5 5 6 
+                6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 
+                13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 
+                9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 
+                15 15 15 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 
+                10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+                16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 19 19 19 20 20 20 21 21 21 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 
+                11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 
+                16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+                22 22 23 23 23 12 12 12 13 13 13 14 14 14 15 15 15 
+                16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 
+                21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+                15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 
+                21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 14 14 
+                14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+                20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 
+                26 26 26 
+
+	 Image  Name = Raster Image #3
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 8 11 
+                10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 6 5 4 
+                11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 4 7 6 
+                1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 12 13 
+                10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 12 13 
+                14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 2 5 10 
+                11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 13 12 
+                3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 12 15 
+                14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 6 7 4 
+                5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 
+                8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 
+                6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 
+                4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 
+                12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 
+                12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 
+                2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 
+                13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 
+                12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 
+                6 7 4 5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 
+                7 6 9 8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 
+                1 0 7 6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 
+                15 8 5 4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 
+                14 15 12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 
+                10 11 12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 
+                1 0 3 2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 
+                8 15 14 13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 
+                6 7 0 13 12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 
+                10 11 8 9 6 7 4 5 2 
diff --git a/mfhdf/dumper/testfiles/dumpgr-20.out b/mfhdf/dumper/testfiles/dumpgr-20.out
new file mode 100644
index 0000000..db5357e
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-20.out
@@ -0,0 +1,27 @@
+File name: IMCOMP.hdf 
+
+	 Image  Name = Raster Image #0
+	 Index = 0
+	 Type= 8-bit unsigned char
+	 width=4; height=4
+	 Ref. = 2
+	 ncomps = 1
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 10 11 12 13 20 21 22 23 30 31 32 33 
+
+	 Image  Name = Raster Image #1
+	 Index = 1
+	 Type= 8-bit unsigned char
+	 width=4; height=4
+	 Ref. = 3
+	 ncomps = 1
+	 Interlace mode= PIXEL
+	 Palette: 3 components; 256 entries
+	 Compression method = IMCOMP
+	 Number of attributes = 0
+	 Data : 
+                1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
diff --git a/mfhdf/dumper/testfiles/dumpgr-3.out b/mfhdf/dumper/testfiles/dumpgr-3.out
new file mode 100644
index 0000000..ae51892
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-3.out
@@ -0,0 +1,19 @@
+File name: grtdfui82.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 6
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 
+                12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 
+                20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 
+                29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 
+                37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 
+                46 46 47 47 48 48 49 49 
diff --git a/mfhdf/dumper/testfiles/dumpgr-4.out b/mfhdf/dumper/testfiles/dumpgr-4.out
new file mode 100644
index 0000000..ae51892
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-4.out
@@ -0,0 +1,19 @@
+File name: grtdfui82.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 6
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 
+                12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 
+                20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 
+                29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 
+                37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 
+                46 46 47 47 48 48 49 49 
diff --git a/mfhdf/dumper/testfiles/dumpgr-5.out b/mfhdf/dumper/testfiles/dumpgr-5.out
new file mode 100644
index 0000000..2c85be4
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-5.out
@@ -0,0 +1,105 @@
+File name: grtdfui82.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 6
+	 ncomps = 2
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 
+                12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 
+                20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 
+                29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 
+                37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 
+                46 46 47 47 48 48 49 49 
+
+	 Image  Name = Raster Image #1
+	 Index = 1
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 2
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 
+                8 8 9 9 9 10 10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 
+                3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 
+                11 11 12 12 12 13 13 13 2 2 2 3 3 3 4 4 4 5 5 5 6 
+                6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 
+                13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 
+                9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 
+                15 15 15 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 
+                10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+                16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 19 19 19 20 20 20 21 21 21 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 
+                11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 
+                16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+                22 22 23 23 23 12 12 12 13 13 13 14 14 14 15 15 15 
+                16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 
+                21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+                15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 
+                21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 14 14 
+                14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+                20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 
+                26 26 26 
+
+	 Image  Name = Raster Image #2
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 
+                11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 1 1 3 3 5 5 7 7 
+                9 9 11 11 13 1 1 3 3 5 5 7 7 9 9 11 11 13 1 1 3 3 
+                5 5 7 7 9 9 11 11 13 2 3 2 3 6 7 6 7 10 11 10 11 14 
+                2 3 2 3 6 7 6 7 10 11 10 11 14 2 3 2 3 6 7 6 7 10 
+                11 10 11 14 3 3 3 3 7 7 7 7 11 11 11 11 15 3 3 3 3 
+                7 7 7 7 11 11 11 11 15 3 3 3 3 7 7 7 7 11 11 11 11 
+                15 4 5 6 7 4 5 6 7 12 13 14 15 12 4 5 6 7 4 5 6 7 
+                12 13 14 15 12 4 5 6 7 4 5 6 7 12 13 14 15 12 5 5 
+                7 7 5 5 7 7 13 13 15 15 13 5 5 7 7 5 5 7 7 13 13 15 
+                15 13 5 5 7 7 5 5 7 7 13 13 15 15 13 6 7 6 7 6 7 6 
+                7 14 15 14 15 14 6 7 6 7 6 7 6 7 14 15 14 15 14 6 
+                7 6 7 6 7 6 7 14 15 14 15 14 7 7 7 7 7 7 7 7 15 15 
+                15 15 15 7 7 7 7 7 7 7 7 15 15 15 15 15 7 7 7 7 7 
+                7 7 7 15 15 15 15 15 8 9 10 11 12 13 14 15 8 9 10 
+                11 12 8 9 10 11 12 13 14 15 8 9 10 11 12 8 9 10 11 
+                12 13 14 15 8 9 10 11 12 9 9 11 11 13 13 15 15 9 9 
+                11 11 13 9 9 11 11 13 13 15 15 9 9 11 11 13 9 9 11 
+                11 13 13 15 15 9 9 11 11 13 10 11 10 11 14 15 14 15 
+                10 11 10 11 14 10 11 10 11 14 15 14 15 10 11 10 11 
+                14 10 11 10 11 14 15 14 15 10 11 10 11 14 11 11 11 
+                11 15 15 15 15 11 11 11 11 15 11 11 11 11 15 15 15 
+                15 11 11 11 11 15 11 11 11 11 15 15 15 15 11 11 11 
+                11 15 12 13 14 15 12 13 14 15 12 13 14 15 12 12 13 
+                14 15 12 13 14 15 12 13 14 15 12 12 13 14 15 12 13 
+                14 15 12 13 14 15 12 13 13 15 15 13 13 15 15 13 13 
+                15 15 13 13 13 15 15 13 13 15 15 13 13 15 15 13 13 
+                13 15 15 13 13 15 15 13 13 15 15 13 14 15 14 15 14 
+                15 14 15 14 15 14 15 14 14 15 14 15 14 15 14 15 14 
+                15 14 15 14 14 15 14 15 14 15 14 15 14 15 14 15 14 
diff --git a/mfhdf/dumper/testfiles/dumpgr-6.out b/mfhdf/dumper/testfiles/dumpgr-6.out
new file mode 100644
index 0000000..8c9402d
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-6.out
@@ -0,0 +1,5 @@
+0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 
+14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 
+25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 
+36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 
+47 48 48 49 49 
diff --git a/mfhdf/dumper/testfiles/dumpgr-7.out b/mfhdf/dumper/testfiles/dumpgr-7.out
new file mode 100644
index 0000000..e69de29
diff --git a/mfhdf/dumper/testfiles/dumpgr-8.out b/mfhdf/dumper/testfiles/dumpgr-8.out
new file mode 100644
index 0000000..e69de29
diff --git a/mfhdf/dumper/testfiles/dumpgr-9.out b/mfhdf/dumper/testfiles/dumpgr-9.out
new file mode 100644
index 0000000..e4003b7
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpgr-9.out
@@ -0,0 +1,148 @@
+File name: grtdfui83.hdf 
+
+	 Image  Name = Image_array_5
+	 Index = 0
+	 Type= 8-bit unsigned integer
+	 width=10; height=5
+	 Ref. = 5
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 
+                8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 
+                14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+                20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 
+                26 26 26 27 27 27 28 28 28 29 29 29 30 30 30 31 31 
+                31 32 32 32 33 33 33 34 34 34 35 35 35 36 36 36 37 
+                37 37 38 38 38 39 39 39 40 40 40 41 41 41 42 42 42 
+                43 43 43 44 44 44 45 45 45 46 46 46 47 47 47 48 48 
+                48 49 49 49 
+
+	 Image  Name = Raster Image #1
+	 Index = 1
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 2
+	 ncomps = 3
+	 Interlace mode= PIXEL
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 
+                8 8 9 9 9 10 10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 
+                3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 
+                11 11 12 12 12 13 13 13 2 2 2 3 3 3 4 4 4 5 5 5 6 
+                6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 
+                13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 
+                9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 
+                15 15 15 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 
+                10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+                16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+                12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+                18 18 19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 
+                12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 
+                18 18 18 19 19 19 20 20 20 21 21 21 10 10 10 11 11 
+                11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+                17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 
+                11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 
+                16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+                22 22 23 23 23 12 12 12 13 13 13 14 14 14 15 15 15 
+                16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 
+                21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+                15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 
+                21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 14 14 
+                14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+                20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 
+                26 26 26 
+
+	 Image  Name = Raster Image #2
+	 Index = 2
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 3
+	 ncomps = 3
+	 Interlace mode= LINE
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 0 1 2 3 4 5 6 7 8 9 10 
+                11 12 0 1 2 3 4 5 6 7 8 9 10 11 12 1 1 3 3 5 5 7 7 
+                9 9 11 11 13 1 1 3 3 5 5 7 7 9 9 11 11 13 1 1 3 3 
+                5 5 7 7 9 9 11 11 13 2 3 2 3 6 7 6 7 10 11 10 11 14 
+                2 3 2 3 6 7 6 7 10 11 10 11 14 2 3 2 3 6 7 6 7 10 
+                11 10 11 14 3 3 3 3 7 7 7 7 11 11 11 11 15 3 3 3 3 
+                7 7 7 7 11 11 11 11 15 3 3 3 3 7 7 7 7 11 11 11 11 
+                15 4 5 6 7 4 5 6 7 12 13 14 15 12 4 5 6 7 4 5 6 7 
+                12 13 14 15 12 4 5 6 7 4 5 6 7 12 13 14 15 12 5 5 
+                7 7 5 5 7 7 13 13 15 15 13 5 5 7 7 5 5 7 7 13 13 15 
+                15 13 5 5 7 7 5 5 7 7 13 13 15 15 13 6 7 6 7 6 7 6 
+                7 14 15 14 15 14 6 7 6 7 6 7 6 7 14 15 14 15 14 6 
+                7 6 7 6 7 6 7 14 15 14 15 14 7 7 7 7 7 7 7 7 15 15 
+                15 15 15 7 7 7 7 7 7 7 7 15 15 15 15 15 7 7 7 7 7 
+                7 7 7 15 15 15 15 15 8 9 10 11 12 13 14 15 8 9 10 
+                11 12 8 9 10 11 12 13 14 15 8 9 10 11 12 8 9 10 11 
+                12 13 14 15 8 9 10 11 12 9 9 11 11 13 13 15 15 9 9 
+                11 11 13 9 9 11 11 13 13 15 15 9 9 11 11 13 9 9 11 
+                11 13 13 15 15 9 9 11 11 13 10 11 10 11 14 15 14 15 
+                10 11 10 11 14 10 11 10 11 14 15 14 15 10 11 10 11 
+                14 10 11 10 11 14 15 14 15 10 11 10 11 14 11 11 11 
+                11 15 15 15 15 11 11 11 11 15 11 11 11 11 15 15 15 
+                15 11 11 11 11 15 11 11 11 11 15 15 15 15 11 11 11 
+                11 15 12 13 14 15 12 13 14 15 12 13 14 15 12 12 13 
+                14 15 12 13 14 15 12 13 14 15 12 12 13 14 15 12 13 
+                14 15 12 13 14 15 12 13 13 15 15 13 13 15 15 13 13 
+                15 15 13 13 13 15 15 13 13 15 15 13 13 15 15 13 13 
+                13 15 15 13 13 15 15 13 13 15 15 13 14 15 14 15 14 
+                15 14 15 14 15 14 15 14 14 15 14 15 14 15 14 15 14 
+                15 14 15 14 14 15 14 15 14 15 14 15 14 15 14 15 14 
+
+	 Image  Name = Raster Image #3
+	 Index = 3
+	 Type= 8-bit unsigned char
+	 width=13; height=15
+	 Ref. = 4
+	 ncomps = 3
+	 Interlace mode= COMPONENT
+	 No palette
+	 Compression method = NONE
+	 Number of attributes = 0
+	 Data : 
+                0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 8 11 
+                10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 6 5 4 
+                11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 4 7 6 
+                1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 12 13 
+                10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 12 13 
+                14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 2 5 10 
+                11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 13 12 
+                3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 12 15 
+                14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 6 7 4 
+                5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 7 6 9 
+                8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 1 0 7 
+                6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 15 8 5 
+                4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 14 15 
+                12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 10 11 
+                12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 1 0 3 
+                2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 8 15 14 
+                13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 6 7 0 13 
+                12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 10 11 8 9 
+                6 7 4 5 2 0 1 2 3 4 5 6 7 8 9 10 11 12 1 0 3 2 5 4 
+                7 6 9 8 11 10 13 2 3 0 1 6 7 4 5 10 11 8 9 14 3 2 
+                1 0 7 6 5 4 11 10 9 8 15 4 5 6 7 0 1 2 3 12 13 14 
+                15 8 5 4 7 6 1 0 3 2 13 12 15 14 9 6 7 4 5 2 3 0 1 
+                14 15 12 13 10 7 6 5 4 3 2 1 0 15 14 13 12 11 8 9 
+                10 11 12 13 14 15 0 1 2 3 4 9 8 11 10 13 12 15 14 
+                1 0 3 2 5 10 11 8 9 14 15 12 13 2 3 0 1 6 11 10 9 
+                8 15 14 13 12 3 2 1 0 7 12 13 14 15 8 9 10 11 4 5 
+                6 7 0 13 12 15 14 9 8 11 10 5 4 7 6 1 14 15 12 13 
+                10 11 8 9 6 7 4 5 2 
diff --git a/mfhdf/dumper/testfiles/dumprig-1.out b/mfhdf/dumper/testfiles/dumprig-1.out
new file mode 100644
index 0000000..aeea4ed
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumprig-1.out
@@ -0,0 +1,91 @@
+File name: tdf24.hdf 
+
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=2
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 
+     7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 2 2 2 3 3 
+     3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+     12 13 13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 
+     9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 4 4 4 
+     5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 
+     13 14 14 14 15 15 15 16 16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+     17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 
+     13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 7 7 7 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+     16 16 17 17 17 18 18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 
+     12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 
+     19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 
+     14 14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 
+     21 21 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+     16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 11 
+     11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+     18 18 19 19 19 20 20 20 21 21 21 22 22 22 23 23 23 12 12 12 13 
+     13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+     20 20 21 21 21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+     15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+     22 22 23 23 23 24 24 24 25 25 25 14 14 14 15 15 15 16 16 16 17 
+     17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 23 23 23 24 
+     24 24 25 25 25 26 26 26 
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=3
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 1 1 1 3 3 3 3 3 3 5 5 5 5 5 5 7 
+     7 7 7 7 7 9 9 9 9 9 9 11 11 11 11 11 11 13 13 13 2 2 2 3 3 3 
+     2 2 2 3 3 3 6 6 6 7 7 7 6 6 6 7 7 7 10 10 10 11 11 11 10 10 10 
+     11 11 11 14 14 14 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 
+     7 7 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 4 4 4 5 5 5 
+     6 6 6 7 7 7 4 4 4 5 5 5 6 6 6 7 7 7 12 12 12 13 13 13 14 14 14 
+     15 15 15 12 12 12 5 5 5 5 5 5 7 7 7 7 7 7 5 5 5 5 5 5 7 7 7 7 
+     7 7 13 13 13 13 13 13 15 15 15 15 15 15 13 13 13 6 6 6 7 7 7 
+     6 6 6 7 7 7 6 6 6 7 7 7 6 6 6 7 7 7 14 14 14 15 15 15 14 14 14 
+     15 15 15 14 14 14 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 
+     7 7 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 8 8 8 9 9 9 
+     10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 9 9 9 9 9 9 11 11 11 11 11 11 
+     13 13 13 13 13 13 15 15 15 15 15 15 9 9 9 9 9 9 11 11 11 11 11 
+     11 13 13 13 10 10 10 11 11 11 10 10 10 11 11 11 14 14 14 15 15 
+     15 14 14 14 15 15 15 10 10 10 11 11 11 10 10 10 11 11 11 14 14 
+     14 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 15 15 15 15 15 
+     15 15 15 15 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 12 12 
+     12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 14 14 14 15 15 
+     15 12 12 12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 13 13 
+     13 15 15 15 15 15 15 13 13 13 13 13 13 15 15 15 15 15 15 13 13 
+     13 13 13 13 15 15 15 15 15 15 13 13 13 14 14 14 15 15 15 14 14 
+     14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 
+     15 14 14 14 15 15 15 14 14 14 
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=4
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 4 4 4 7 
+     7 7 6 6 6 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 2 2 2 3 3 3 
+     0 0 0 1 1 1 6 6 6 7 7 7 4 4 4 5 5 5 10 10 10 11 11 11 8 8 8 9 
+     9 9 14 14 14 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 6 6 6 5 5 5 4 4 4 
+     11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 4 4 4 5 5 5 6 6 6 7 7 
+     7 0 0 0 1 1 1 2 2 2 3 3 3 12 12 12 13 13 13 14 14 14 15 15 15 
+     8 8 8 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 0 0 0 3 3 3 2 2 2 13 13 13 
+     12 12 12 15 15 15 14 14 14 9 9 9 6 6 6 7 7 7 4 4 4 5 5 5 2 2 
+     2 3 3 3 0 0 0 1 1 1 14 14 14 15 15 15 12 12 12 13 13 13 10 10 
+     10 7 7 7 6 6 6 5 5 5 4 4 4 3 3 3 2 2 2 1 1 1 0 0 0 15 15 15 14 
+     14 14 13 13 13 12 12 12 11 11 11 8 8 8 9 9 9 10 10 10 11 11 11 
+     12 12 12 13 13 13 14 14 14 15 15 15 0 0 0 1 1 1 2 2 2 3 3 3 4 
+     4 4 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 12 12 12 15 15 15 
+     14 14 14 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 10 10 10 11 11 11 8 8 
+     8 9 9 9 14 14 14 15 15 15 12 12 12 13 13 13 2 2 2 3 3 3 0 0 0 
+     1 1 1 6 6 6 11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 14 14 14 13 
+     13 13 12 12 12 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 12 12 12 13 13 13 
+     14 14 14 15 15 15 8 8 8 9 9 9 10 10 10 11 11 11 4 4 4 5 5 5 6 
+     6 6 7 7 7 0 0 0 13 13 13 12 12 12 15 15 15 14 14 14 9 9 9 8 8 
+     8 11 11 11 10 10 10 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 14 14 14 15 
+     15 15 12 12 12 13 13 13 10 10 10 11 11 11 8 8 8 9 9 9 6 6 6 7 
+     7 7 4 4 4 5 5 5 2 2 2 
diff --git a/mfhdf/dumper/testfiles/dumprig-2.out b/mfhdf/dumper/testfiles/dumprig-2.out
new file mode 100644
index 0000000..b3e7cf6
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumprig-2.out
@@ -0,0 +1,60 @@
+File name: tdf24.hdf 
+
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=3
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 1 1 1 3 3 3 3 3 3 5 5 5 5 5 5 7 
+     7 7 7 7 7 9 9 9 9 9 9 11 11 11 11 11 11 13 13 13 2 2 2 3 3 3 
+     2 2 2 3 3 3 6 6 6 7 7 7 6 6 6 7 7 7 10 10 10 11 11 11 10 10 10 
+     11 11 11 14 14 14 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 
+     7 7 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 4 4 4 5 5 5 
+     6 6 6 7 7 7 4 4 4 5 5 5 6 6 6 7 7 7 12 12 12 13 13 13 14 14 14 
+     15 15 15 12 12 12 5 5 5 5 5 5 7 7 7 7 7 7 5 5 5 5 5 5 7 7 7 7 
+     7 7 13 13 13 13 13 13 15 15 15 15 15 15 13 13 13 6 6 6 7 7 7 
+     6 6 6 7 7 7 6 6 6 7 7 7 6 6 6 7 7 7 14 14 14 15 15 15 14 14 14 
+     15 15 15 14 14 14 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 
+     7 7 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 8 8 8 9 9 9 
+     10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 9 9 9 9 9 9 11 11 11 11 11 11 
+     13 13 13 13 13 13 15 15 15 15 15 15 9 9 9 9 9 9 11 11 11 11 11 
+     11 13 13 13 10 10 10 11 11 11 10 10 10 11 11 11 14 14 14 15 15 
+     15 14 14 14 15 15 15 10 10 10 11 11 11 10 10 10 11 11 11 14 14 
+     14 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 15 15 15 15 15 
+     15 15 15 15 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 12 12 
+     12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 14 14 14 15 15 
+     15 12 12 12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 13 13 
+     13 15 15 15 15 15 15 13 13 13 13 13 13 15 15 15 15 15 15 13 13 
+     13 13 13 13 15 15 15 15 15 15 13 13 13 14 14 14 15 15 15 14 14 
+     14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 
+     15 14 14 14 15 15 15 14 14 14 
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=4
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 4 4 4 7 
+     7 7 6 6 6 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 2 2 2 3 3 3 
+     0 0 0 1 1 1 6 6 6 7 7 7 4 4 4 5 5 5 10 10 10 11 11 11 8 8 8 9 
+     9 9 14 14 14 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 6 6 6 5 5 5 4 4 4 
+     11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 4 4 4 5 5 5 6 6 6 7 7 
+     7 0 0 0 1 1 1 2 2 2 3 3 3 12 12 12 13 13 13 14 14 14 15 15 15 
+     8 8 8 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 0 0 0 3 3 3 2 2 2 13 13 13 
+     12 12 12 15 15 15 14 14 14 9 9 9 6 6 6 7 7 7 4 4 4 5 5 5 2 2 
+     2 3 3 3 0 0 0 1 1 1 14 14 14 15 15 15 12 12 12 13 13 13 10 10 
+     10 7 7 7 6 6 6 5 5 5 4 4 4 3 3 3 2 2 2 1 1 1 0 0 0 15 15 15 14 
+     14 14 13 13 13 12 12 12 11 11 11 8 8 8 9 9 9 10 10 10 11 11 11 
+     12 12 12 13 13 13 14 14 14 15 15 15 0 0 0 1 1 1 2 2 2 3 3 3 4 
+     4 4 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 12 12 12 15 15 15 
+     14 14 14 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 10 10 10 11 11 11 8 8 
+     8 9 9 9 14 14 14 15 15 15 12 12 12 13 13 13 2 2 2 3 3 3 0 0 0 
+     1 1 1 6 6 6 11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 14 14 14 13 
+     13 13 12 12 12 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 12 12 12 13 13 13 
+     14 14 14 15 15 15 8 8 8 9 9 9 10 10 10 11 11 11 4 4 4 5 5 5 6 
+     6 6 7 7 7 0 0 0 13 13 13 12 12 12 15 15 15 14 14 14 9 9 9 8 8 
+     8 11 11 11 10 10 10 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 14 14 14 15 
+     15 15 12 12 12 13 13 13 10 10 10 11 11 11 8 8 8 9 9 9 6 6 6 7 
+     7 7 4 4 4 5 5 5 2 2 2 
diff --git a/mfhdf/dumper/testfiles/dumprig-3.out b/mfhdf/dumper/testfiles/dumprig-3.out
new file mode 100644
index 0000000..da76e36
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumprig-3.out
@@ -0,0 +1,32 @@
+File name: tdf24.hdf 
+
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=3
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 1 1 1 3 3 3 3 3 3 5 5 5 5 5 5 7 
+     7 7 7 7 7 9 9 9 9 9 9 11 11 11 11 11 11 13 13 13 2 2 2 3 3 3 
+     2 2 2 3 3 3 6 6 6 7 7 7 6 6 6 7 7 7 10 10 10 11 11 11 10 10 10 
+     11 11 11 14 14 14 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 
+     7 7 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 4 4 4 5 5 5 
+     6 6 6 7 7 7 4 4 4 5 5 5 6 6 6 7 7 7 12 12 12 13 13 13 14 14 14 
+     15 15 15 12 12 12 5 5 5 5 5 5 7 7 7 7 7 7 5 5 5 5 5 5 7 7 7 7 
+     7 7 13 13 13 13 13 13 15 15 15 15 15 15 13 13 13 6 6 6 7 7 7 
+     6 6 6 7 7 7 6 6 6 7 7 7 6 6 6 7 7 7 14 14 14 15 15 15 14 14 14 
+     15 15 15 14 14 14 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 
+     7 7 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 8 8 8 9 9 9 
+     10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 9 9 9 9 9 9 11 11 11 11 11 11 
+     13 13 13 13 13 13 15 15 15 15 15 15 9 9 9 9 9 9 11 11 11 11 11 
+     11 13 13 13 10 10 10 11 11 11 10 10 10 11 11 11 14 14 14 15 15 
+     15 14 14 14 15 15 15 10 10 10 11 11 11 10 10 10 11 11 11 14 14 
+     14 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 15 15 15 15 15 
+     15 15 15 15 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 12 12 
+     12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 14 14 14 15 15 
+     15 12 12 12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 13 13 
+     13 15 15 15 15 15 15 13 13 13 13 13 13 15 15 15 15 15 15 13 13 
+     13 13 13 13 15 15 15 15 15 15 13 13 13 14 14 14 15 15 15 14 14 
+     14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 
+     15 14 14 14 15 15 15 14 14 14 
diff --git a/mfhdf/dumper/testfiles/dumprig-4.out b/mfhdf/dumper/testfiles/dumprig-4.out
new file mode 100644
index 0000000..aeea4ed
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumprig-4.out
@@ -0,0 +1,91 @@
+File name: tdf24.hdf 
+
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=2
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 
+     7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 2 2 2 3 3 
+     3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 
+     12 13 13 13 14 14 14 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 
+     9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 4 4 4 
+     5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 
+     13 14 14 14 15 15 15 16 16 16 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 
+     17 17 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 
+     13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 7 7 7 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+     16 16 17 17 17 18 18 18 19 19 19 8 8 8 9 9 9 10 10 10 11 11 11 
+     12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 
+     19 19 19 20 20 20 9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 
+     14 14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 
+     21 21 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 
+     16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 11 
+     11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 
+     18 18 19 19 19 20 20 20 21 21 21 22 22 22 23 23 23 12 12 12 13 
+     13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 
+     20 20 21 21 21 22 22 22 23 23 23 24 24 24 13 13 13 14 14 14 15 
+     15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 
+     22 22 23 23 23 24 24 24 25 25 25 14 14 14 15 15 15 16 16 16 17 
+     17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 23 23 23 24 
+     24 24 25 25 25 26 26 26 
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=3
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 1 1 1 3 3 3 3 3 3 5 5 5 5 5 5 7 
+     7 7 7 7 7 9 9 9 9 9 9 11 11 11 11 11 11 13 13 13 2 2 2 3 3 3 
+     2 2 2 3 3 3 6 6 6 7 7 7 6 6 6 7 7 7 10 10 10 11 11 11 10 10 10 
+     11 11 11 14 14 14 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 
+     7 7 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 4 4 4 5 5 5 
+     6 6 6 7 7 7 4 4 4 5 5 5 6 6 6 7 7 7 12 12 12 13 13 13 14 14 14 
+     15 15 15 12 12 12 5 5 5 5 5 5 7 7 7 7 7 7 5 5 5 5 5 5 7 7 7 7 
+     7 7 13 13 13 13 13 13 15 15 15 15 15 15 13 13 13 6 6 6 7 7 7 
+     6 6 6 7 7 7 6 6 6 7 7 7 6 6 6 7 7 7 14 14 14 15 15 15 14 14 14 
+     15 15 15 14 14 14 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 
+     7 7 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 8 8 8 9 9 9 
+     10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 9 9 9 9 9 9 11 11 11 11 11 11 
+     13 13 13 13 13 13 15 15 15 15 15 15 9 9 9 9 9 9 11 11 11 11 11 
+     11 13 13 13 10 10 10 11 11 11 10 10 10 11 11 11 14 14 14 15 15 
+     15 14 14 14 15 15 15 10 10 10 11 11 11 10 10 10 11 11 11 14 14 
+     14 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 15 15 15 15 15 
+     15 15 15 15 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 12 12 
+     12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 14 14 14 15 15 
+     15 12 12 12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 13 13 
+     13 15 15 15 15 15 15 13 13 13 13 13 13 15 15 15 15 15 15 13 13 
+     13 13 13 13 15 15 15 15 15 15 13 13 13 14 14 14 15 15 15 14 14 
+     14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 
+     15 14 14 14 15 15 15 14 14 14 
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=4
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 4 4 4 7 
+     7 7 6 6 6 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 2 2 2 3 3 3 
+     0 0 0 1 1 1 6 6 6 7 7 7 4 4 4 5 5 5 10 10 10 11 11 11 8 8 8 9 
+     9 9 14 14 14 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 6 6 6 5 5 5 4 4 4 
+     11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 4 4 4 5 5 5 6 6 6 7 7 
+     7 0 0 0 1 1 1 2 2 2 3 3 3 12 12 12 13 13 13 14 14 14 15 15 15 
+     8 8 8 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 0 0 0 3 3 3 2 2 2 13 13 13 
+     12 12 12 15 15 15 14 14 14 9 9 9 6 6 6 7 7 7 4 4 4 5 5 5 2 2 
+     2 3 3 3 0 0 0 1 1 1 14 14 14 15 15 15 12 12 12 13 13 13 10 10 
+     10 7 7 7 6 6 6 5 5 5 4 4 4 3 3 3 2 2 2 1 1 1 0 0 0 15 15 15 14 
+     14 14 13 13 13 12 12 12 11 11 11 8 8 8 9 9 9 10 10 10 11 11 11 
+     12 12 12 13 13 13 14 14 14 15 15 15 0 0 0 1 1 1 2 2 2 3 3 3 4 
+     4 4 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 12 12 12 15 15 15 
+     14 14 14 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 10 10 10 11 11 11 8 8 
+     8 9 9 9 14 14 14 15 15 15 12 12 12 13 13 13 2 2 2 3 3 3 0 0 0 
+     1 1 1 6 6 6 11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 14 14 14 13 
+     13 13 12 12 12 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 12 12 12 13 13 13 
+     14 14 14 15 15 15 8 8 8 9 9 9 10 10 10 11 11 11 4 4 4 5 5 5 6 
+     6 6 7 7 7 0 0 0 13 13 13 12 12 12 15 15 15 14 14 14 9 9 9 8 8 
+     8 11 11 11 10 10 10 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 14 14 14 15 
+     15 15 12 12 12 13 13 13 10 10 10 11 11 11 8 8 8 9 9 9 6 6 6 7 
+     7 7 4 4 4 5 5 5 2 2 2 
diff --git a/mfhdf/dumper/testfiles/dumprig-5.out b/mfhdf/dumper/testfiles/dumprig-5.out
new file mode 100644
index 0000000..b3e7cf6
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumprig-5.out
@@ -0,0 +1,60 @@
+File name: tdf24.hdf 
+
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=3
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 1 1 1 3 3 3 3 3 3 5 5 5 5 5 5 7 
+     7 7 7 7 7 9 9 9 9 9 9 11 11 11 11 11 11 13 13 13 2 2 2 3 3 3 
+     2 2 2 3 3 3 6 6 6 7 7 7 6 6 6 7 7 7 10 10 10 11 11 11 10 10 10 
+     11 11 11 14 14 14 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 
+     7 7 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 4 4 4 5 5 5 
+     6 6 6 7 7 7 4 4 4 5 5 5 6 6 6 7 7 7 12 12 12 13 13 13 14 14 14 
+     15 15 15 12 12 12 5 5 5 5 5 5 7 7 7 7 7 7 5 5 5 5 5 5 7 7 7 7 
+     7 7 13 13 13 13 13 13 15 15 15 15 15 15 13 13 13 6 6 6 7 7 7 
+     6 6 6 7 7 7 6 6 6 7 7 7 6 6 6 7 7 7 14 14 14 15 15 15 14 14 14 
+     15 15 15 14 14 14 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 
+     7 7 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 8 8 8 9 9 9 
+     10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 9 9 9 9 9 9 11 11 11 11 11 11 
+     13 13 13 13 13 13 15 15 15 15 15 15 9 9 9 9 9 9 11 11 11 11 11 
+     11 13 13 13 10 10 10 11 11 11 10 10 10 11 11 11 14 14 14 15 15 
+     15 14 14 14 15 15 15 10 10 10 11 11 11 10 10 10 11 11 11 14 14 
+     14 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 15 15 15 15 15 
+     15 15 15 15 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 12 12 
+     12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 14 14 14 15 15 
+     15 12 12 12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 13 13 
+     13 15 15 15 15 15 15 13 13 13 13 13 13 15 15 15 15 15 15 13 13 
+     13 13 13 13 15 15 15 15 15 15 13 13 13 14 14 14 15 15 15 14 14 
+     14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 
+     15 14 14 14 15 15 15 14 14 14 
+Data model: 24-bit raster image without palette.
+	width=13;  height=15
+	reference=4
+	*data is not compressed.
+	Data : 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 4 4 4 7 
+     7 7 6 6 6 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 2 2 2 3 3 3 
+     0 0 0 1 1 1 6 6 6 7 7 7 4 4 4 5 5 5 10 10 10 11 11 11 8 8 8 9 
+     9 9 14 14 14 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 6 6 6 5 5 5 4 4 4 
+     11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 4 4 4 5 5 5 6 6 6 7 7 
+     7 0 0 0 1 1 1 2 2 2 3 3 3 12 12 12 13 13 13 14 14 14 15 15 15 
+     8 8 8 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 0 0 0 3 3 3 2 2 2 13 13 13 
+     12 12 12 15 15 15 14 14 14 9 9 9 6 6 6 7 7 7 4 4 4 5 5 5 2 2 
+     2 3 3 3 0 0 0 1 1 1 14 14 14 15 15 15 12 12 12 13 13 13 10 10 
+     10 7 7 7 6 6 6 5 5 5 4 4 4 3 3 3 2 2 2 1 1 1 0 0 0 15 15 15 14 
+     14 14 13 13 13 12 12 12 11 11 11 8 8 8 9 9 9 10 10 10 11 11 11 
+     12 12 12 13 13 13 14 14 14 15 15 15 0 0 0 1 1 1 2 2 2 3 3 3 4 
+     4 4 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 12 12 12 15 15 15 
+     14 14 14 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 10 10 10 11 11 11 8 8 
+     8 9 9 9 14 14 14 15 15 15 12 12 12 13 13 13 2 2 2 3 3 3 0 0 0 
+     1 1 1 6 6 6 11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 14 14 14 13 
+     13 13 12 12 12 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 12 12 12 13 13 13 
+     14 14 14 15 15 15 8 8 8 9 9 9 10 10 10 11 11 11 4 4 4 5 5 5 6 
+     6 6 7 7 7 0 0 0 13 13 13 12 12 12 15 15 15 14 14 14 9 9 9 8 8 
+     8 11 11 11 10 10 10 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 14 14 14 15 
+     15 15 12 12 12 13 13 13 10 10 10 11 11 11 8 8 8 9 9 9 6 6 6 7 
+     7 7 4 4 4 5 5 5 2 2 2 
diff --git a/mfhdf/dumper/testfiles/dumprig-6.out b/mfhdf/dumper/testfiles/dumprig-6.out
new file mode 100644
index 0000000..5bea7a8
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumprig-6.out
@@ -0,0 +1,48 @@
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 1 1 1 3 3 3 3 3 3 5 5 5 5 5 5 7 
+     7 7 7 7 7 9 9 9 9 9 9 11 11 11 11 11 11 13 13 13 2 2 2 3 3 3 
+     2 2 2 3 3 3 6 6 6 7 7 7 6 6 6 7 7 7 10 10 10 11 11 11 10 10 10 
+     11 11 11 14 14 14 3 3 3 3 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7 
+     7 7 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 4 4 4 5 5 5 
+     6 6 6 7 7 7 4 4 4 5 5 5 6 6 6 7 7 7 12 12 12 13 13 13 14 14 14 
+     15 15 15 12 12 12 5 5 5 5 5 5 7 7 7 7 7 7 5 5 5 5 5 5 7 7 7 7 
+     7 7 13 13 13 13 13 13 15 15 15 15 15 15 13 13 13 6 6 6 7 7 7 
+     6 6 6 7 7 7 6 6 6 7 7 7 6 6 6 7 7 7 14 14 14 15 15 15 14 14 14 
+     15 15 15 14 14 14 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 
+     7 7 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 8 8 8 9 9 9 
+     10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 8 8 8 9 
+     9 9 10 10 10 11 11 11 12 12 12 9 9 9 9 9 9 11 11 11 11 11 11 
+     13 13 13 13 13 13 15 15 15 15 15 15 9 9 9 9 9 9 11 11 11 11 11 
+     11 13 13 13 10 10 10 11 11 11 10 10 10 11 11 11 14 14 14 15 15 
+     15 14 14 14 15 15 15 10 10 10 11 11 11 10 10 10 11 11 11 14 14 
+     14 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 15 15 15 15 15 
+     15 15 15 15 11 11 11 11 11 11 11 11 11 11 11 11 15 15 15 12 12 
+     12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 14 14 14 15 15 
+     15 12 12 12 13 13 13 14 14 14 15 15 15 12 12 12 13 13 13 13 13 
+     13 15 15 15 15 15 15 13 13 13 13 13 13 15 15 15 15 15 15 13 13 
+     13 13 13 13 15 15 15 15 15 15 13 13 13 14 14 14 15 15 15 14 14 
+     14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 15 14 14 14 15 15 
+     15 14 14 14 15 15 15 14 14 14 
+     0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 
+     10 10 11 11 11 12 12 12 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 4 4 4 7 
+     7 7 6 6 6 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 2 2 2 3 3 3 
+     0 0 0 1 1 1 6 6 6 7 7 7 4 4 4 5 5 5 10 10 10 11 11 11 8 8 8 9 
+     9 9 14 14 14 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 6 6 6 5 5 5 4 4 4 
+     11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 4 4 4 5 5 5 6 6 6 7 7 
+     7 0 0 0 1 1 1 2 2 2 3 3 3 12 12 12 13 13 13 14 14 14 15 15 15 
+     8 8 8 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 0 0 0 3 3 3 2 2 2 13 13 13 
+     12 12 12 15 15 15 14 14 14 9 9 9 6 6 6 7 7 7 4 4 4 5 5 5 2 2 
+     2 3 3 3 0 0 0 1 1 1 14 14 14 15 15 15 12 12 12 13 13 13 10 10 
+     10 7 7 7 6 6 6 5 5 5 4 4 4 3 3 3 2 2 2 1 1 1 0 0 0 15 15 15 14 
+     14 14 13 13 13 12 12 12 11 11 11 8 8 8 9 9 9 10 10 10 11 11 11 
+     12 12 12 13 13 13 14 14 14 15 15 15 0 0 0 1 1 1 2 2 2 3 3 3 4 
+     4 4 9 9 9 8 8 8 11 11 11 10 10 10 13 13 13 12 12 12 15 15 15 
+     14 14 14 1 1 1 0 0 0 3 3 3 2 2 2 5 5 5 10 10 10 11 11 11 8 8 
+     8 9 9 9 14 14 14 15 15 15 12 12 12 13 13 13 2 2 2 3 3 3 0 0 0 
+     1 1 1 6 6 6 11 11 11 10 10 10 9 9 9 8 8 8 15 15 15 14 14 14 13 
+     13 13 12 12 12 3 3 3 2 2 2 1 1 1 0 0 0 7 7 7 12 12 12 13 13 13 
+     14 14 14 15 15 15 8 8 8 9 9 9 10 10 10 11 11 11 4 4 4 5 5 5 6 
+     6 6 7 7 7 0 0 0 13 13 13 12 12 12 15 15 15 14 14 14 9 9 9 8 8 
+     8 11 11 11 10 10 10 5 5 5 4 4 4 7 7 7 6 6 6 1 1 1 14 14 14 15 
+     15 15 12 12 12 13 13 13 10 10 10 11 11 11 8 8 8 9 9 9 6 6 6 7 
+     7 7 4 4 4 5 5 5 2 2 2 
diff --git a/mfhdf/dumper/testfiles/dumpsds-1.out b/mfhdf/dumper/testfiles/dumpsds-1.out
new file mode 100644
index 0000000..6746ee5
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-1.out
@@ -0,0 +1,114 @@
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim0
+		 Size = 2
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Time
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Second
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 100.000000 
+
+
+Dimension Variable Name = fakeDim1
+	 Index = 1
+	 Scale Type= 32-bit floating point
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim1
+		 Size = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Line
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Inch
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int16
+	 Data : 
+                0.000000 10.000000 20.000000 
+
+
+Dimension Variable Name = fakeDim2
+	 Index = 2
+	 Scale Type= 32-bit floating point
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim2
+		 Size = 4
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Column
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 2
+		 Value = Cm
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = 123.000000 
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = -1.000000 
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+                10.000000 11.000000 12.000000 13.000000 
+                20.000000 21.000000 22.000000 23.000000 
+
+                100.000000 101.000000 102.000000 103.000000 
+                110.000000 111.000000 112.000000 113.000000 
+                120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-10.out b/mfhdf/dumper/testfiles/dumpsds-10.out
new file mode 100644
index 0000000..6075d07
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-10.out
@@ -0,0 +1,125 @@
+File name: swf32_fileattr.hdf 
+
+File attributes:
+	 Attr0: Name = File purpose
+		 Type = 8-bit signed char 
+		 Count= 37
+	 Attr1: Name = File contents
+		 Type = 8-bit signed char 
+		 Count= 14
+	 Attr2: Name = Test clean format
+		 Type = 8-bit signed char 
+		 Count= 65
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim0
+		 Size = 2
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Time
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Second
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 100.000000 
+
+
+Dimension Variable Name = fakeDim1
+	 Index = 1
+	 Scale Type= 32-bit floating point
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim1
+		 Size = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Line
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Inch
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int16
+	 Data : 
+                0.000000 10.000000 20.000000 
+
+
+Dimension Variable Name = fakeDim2
+	 Index = 2
+	 Scale Type= 32-bit floating point
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim2
+		 Size = 4
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Column
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 2
+		 Value = Cm
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = 123.000000 
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = -1.000000 
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+                10.000000 11.000000 12.000000 13.000000 
+                20.000000 21.000000 22.000000 23.000000 
+
+                100.000000 101.000000 102.000000 103.000000 
+                110.000000 111.000000 112.000000 113.000000 
+                120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-11.out b/mfhdf/dumper/testfiles/dumpsds-11.out
new file mode 100644
index 0000000..85c5fd7
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-11.out
@@ -0,0 +1,119 @@
+File name: swf32_fileattr.hdf 
+
+File attributes:
+	 Attr0: Name = File purpose
+		 Type = 8-bit signed char 
+		 Count= 37
+		 Value = For testing dumpsds SD file attribute
+	 Attr1: Name = File contents
+		 Type = 8-bit signed char 
+		 Count= 14
+		 Value = Some data sets
+	 Attr2: Name = Test clean format
+		 Type = 8-bit signed char 
+		 Count= 65
+		 Value = A tab <\011>, a CR <\012>, several nulls 
+                         <\000\000\000\000\000\000>, and one more 
+                         tab <\011>
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim0
+		 Size = 2
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+	 Data : 
+                0.000000 100.000000 
+
+
+Dimension Variable Name = fakeDim1
+	 Index = 1
+	 Scale Type= 32-bit floating point
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim1
+		 Size = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 4
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+	 Data : 
+                0.000000 10.000000 20.000000 
+
+
+Dimension Variable Name = fakeDim2
+	 Index = 2
+	 Scale Type= 32-bit floating point
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim2
+		 Size = 4
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 6
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 2
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+                10.000000 11.000000 12.000000 13.000000 
+                20.000000 21.000000 22.000000 23.000000 
+
+                100.000000 101.000000 102.000000 103.000000 
+                110.000000 111.000000 112.000000 113.000000 
+                120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-12.out b/mfhdf/dumper/testfiles/dumpsds-12.out
new file mode 100644
index 0000000..fc71bbd
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-12.out
@@ -0,0 +1,17 @@
+File name: SDSlongname.hdf 
+
+Variable Name = The name of this dataset is long and it is used to test the new variable length name feature.
+	 Index = 0
+	 Type= 32-bit signed integer
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim0
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim1
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
diff --git a/mfhdf/dumper/testfiles/dumpsds-13.out b/mfhdf/dumper/testfiles/dumpsds-13.out
new file mode 100644
index 0000000..17bd40c
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-13.out
@@ -0,0 +1,34 @@
+File name: sds1_dim1_samename.hdf 
+
+Variable Name = Variable 1
+	 Index = 0
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 1
+	 Dim0: Name=Variable 1
+		 Size = 5
+		 Scale Type = number-type not set
+		 Number of attributes = 1
+	 Attr0: Name = Attribute SDS 1
+		 Type = 8-bit signed char 
+		 Count= 23
+		 Value = This is not a coord var
+	 Data : 
+                No data written.
+
+Dimension Variable Name = Variable 1
+	 Index = 1
+	 Scale Type= number-type not set
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 1
+	 Dim0: Name=Variable 1
+		 Size = 5
+	 Attr0: Name = Attribute Dimension 1
+		 Type = 8-bit signed char 
+		 Count= 19
+		 Value = This is a coord var
+	 Data : 
diff --git a/mfhdf/dumper/testfiles/dumpsds-14.out b/mfhdf/dumper/testfiles/dumpsds-14.out
new file mode 100644
index 0000000..64f0cb4
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-14.out
@@ -0,0 +1,49 @@
+File name: sds2_dim1_samename.hdf 
+
+Variable Name = Variable 1
+	 Index = 0
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 0
+	 Dim0: Name=Variable 2
+		 Size = 5
+		 Scale Type = 32-bit signed integer
+		 Number of attributes = 0
+	 Data : 
+                No data written.
+
+Variable Name = Variable 2
+	 Index = 1
+	 Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim1
+		 Size = 2
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim2
+		 Size = 3
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Data : 
+                0.100000 2.300000 4.500000 
+                4.500000 6.700000 8.900000 
+
+
+
+Dimension Variable Name = Variable 2
+	 Index = 2
+	 Scale Type= 32-bit signed integer
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 0
+	 Dim0: Name=Variable 2
+		 Size = 5
+	 Data : 
+                101 102 103 104 105 
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-15.out b/mfhdf/dumper/testfiles/dumpsds-15.out
new file mode 100644
index 0000000..45a9c04
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-15.out
@@ -0,0 +1,100 @@
+File name: sds_compressed.hdf 
+
+Variable Name = SDSgzip
+	 Index = 0
+	 Type= 32-bit signed integer
+	 Ref. = 2
+	 Compression method = DEFLATE
+		 Deflate level = 6
+	 Compression ratio (original:compressed) = 5.42:1
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim0
+		 Size = 16
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim1
+		 Size = 5
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 
+                2 3 4 5 6 
+                3 4 5 6 7 
+                4 5 6 7 8 
+                5 6 7 8 9 
+                6 7 8 9 10 
+                7 8 9 10 11 
+                8 9 10 11 12 
+                9 10 11 12 13 
+                10 11 12 13 14 
+                11 12 13 14 15 
+                12 13 14 15 16 
+                13 14 15 16 17 
+                14 15 16 17 18 
+                15 16 17 18 19 
+                16 17 18 19 20 
+
+
+
+Variable Name = SDSskiphuff
+	 Index = 1
+	 Type= 32-bit signed integer
+	 Ref. = 4
+	 Compression method = SKPHUFF
+		 Skipping unit size = 4
+	 Compression ratio (original:compressed) = 4.16:1
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim2
+		 Size = 16
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim3
+		 Size = 5
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 
+                2 3 4 5 6 
+                3 4 5 6 7 
+                4 5 6 7 8 
+                5 6 7 8 9 
+                6 7 8 9 10 
+                7 8 9 10 11 
+                8 9 10 11 12 
+                9 10 11 12 13 
+                10 11 12 13 14 
+                11 12 13 14 15 
+                12 13 14 15 16 
+                13 14 15 16 17 
+                14 15 16 17 18 
+                15 16 17 18 19 
+                16 17 18 19 20 
+
+
+
+Variable Name = SDSszip
+	 Index = 2
+	 Type= 32-bit signed integer
+	 Ref. = 6
+	 Compression method = SZIP
+		 Option mask = H4_SZ_EC_OPTION_MASK|H4_SZ_RAW_OPTION_MASK (65668)
+		 Pixels per block = 2
+		 Pixels per scanline = 5
+		 Bits per pixel = 32
+		 Pixels = 80
+	 Compression ratio (original:compressed) = 2.67:1
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim4
+		 Size = 16
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim5
+		 Size = 5
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Data : 
+		 <SZIP library is not available>
+		 <Unable to read SZIP compressed data>
diff --git a/mfhdf/dumper/testfiles/dumpsds-15szip.out b/mfhdf/dumper/testfiles/dumpsds-15szip.out
new file mode 100644
index 0000000..86aaf0c
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-15szip.out
@@ -0,0 +1,116 @@
+File name: sds_compressed.hdf 
+
+Variable Name = SDSgzip
+	 Index = 0
+	 Type= 32-bit signed integer
+	 Ref. = 2
+	 Compression method = DEFLATE
+		 Deflate level = 6
+	 Compression ratio (original:compressed) = 5.42:1
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim0
+		 Size = 16
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim1
+		 Size = 5
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 
+                2 3 4 5 6 
+                3 4 5 6 7 
+                4 5 6 7 8 
+                5 6 7 8 9 
+                6 7 8 9 10 
+                7 8 9 10 11 
+                8 9 10 11 12 
+                9 10 11 12 13 
+                10 11 12 13 14 
+                11 12 13 14 15 
+                12 13 14 15 16 
+                13 14 15 16 17 
+                14 15 16 17 18 
+                15 16 17 18 19 
+                16 17 18 19 20 
+
+
+
+Variable Name = SDSskiphuff
+	 Index = 1
+	 Type= 32-bit signed integer
+	 Ref. = 4
+	 Compression method = SKPHUFF
+		 Skipping unit size = 4
+	 Compression ratio (original:compressed) = 4.16:1
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim2
+		 Size = 16
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim3
+		 Size = 5
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 
+                2 3 4 5 6 
+                3 4 5 6 7 
+                4 5 6 7 8 
+                5 6 7 8 9 
+                6 7 8 9 10 
+                7 8 9 10 11 
+                8 9 10 11 12 
+                9 10 11 12 13 
+                10 11 12 13 14 
+                11 12 13 14 15 
+                12 13 14 15 16 
+                13 14 15 16 17 
+                14 15 16 17 18 
+                15 16 17 18 19 
+                16 17 18 19 20 
+
+
+
+Variable Name = SDSszip
+	 Index = 2
+	 Type= 32-bit signed integer
+	 Ref. = 6
+	 Compression method = SZIP
+		 Option mask = H4_SZ_EC_OPTION_MASK|H4_SZ_RAW_OPTION_MASK (65668)
+		 Pixels per block = 2
+		 Pixels per scanline = 5
+		 Bits per pixel = 32
+		 Pixels = 80
+	 Compression ratio (original:compressed) = 2.67:1
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim4
+		 Size = 16
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim5
+		 Size = 5
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Data : 
+                1 2 3 4 5 
+                2 3 4 5 6 
+                3 4 5 6 7 
+                4 5 6 7 8 
+                5 6 7 8 9 
+                6 7 8 9 10 
+                7 8 9 10 11 
+                8 9 10 11 12 
+                9 10 11 12 13 
+                10 11 12 13 14 
+                11 12 13 14 15 
+                12 13 14 15 16 
+                13 14 15 16 17 
+                14 15 16 17 18 
+                15 16 17 18 19 
+                16 17 18 19 20 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-16.out b/mfhdf/dumper/testfiles/dumpsds-16.out
new file mode 100644
index 0000000..c3d5574
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-16.out
@@ -0,0 +1,297 @@
+File name: sds_empty_many.hdf 
+
+File attributes:
+	 Attr0: Name = file_contents
+		 Type = 8-bit signed char 
+		 Count= 116
+		 Value = This file was generated by the program ma
+                         nySDSs.c in hdf4/mfhdf/dumper/testfiles t
+                         o test the flag -k in hdp dumpsds\000
+
+Variable Name = data1
+	 Index = 0
+	 Type= 16-bit signed integer
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim0
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim1
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data2
+	 Index = 1
+	 Type= 16-bit signed integer
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim2
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim3
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data3
+	 Index = 2
+	 Type= 16-bit signed integer
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim4
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim5
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data4
+	 Index = 3
+	 Type= 16-bit signed integer
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim6
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim7
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data6
+	 Index = 5
+	 Type= 16-bit signed integer
+	 Ref. = 7
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim10
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim11
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data9
+	 Index = 8
+	 Type= 16-bit signed integer
+	 Ref. = 10
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim16
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim17
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data14
+	 Index = 13
+	 Type= 16-bit signed integer
+	 Ref. = 15
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim26
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim27
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data15
+	 Index = 14
+	 Type= 16-bit signed integer
+	 Ref. = 16
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim28
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim29
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data16
+	 Index = 15
+	 Type= 16-bit signed integer
+	 Ref. = 17
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim30
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim31
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data22
+	 Index = 21
+	 Type= 16-bit signed integer
+	 Ref. = 23
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim42
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim43
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data23
+	 Index = 22
+	 Type= 16-bit signed integer
+	 Ref. = 24
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim44
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim45
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data24
+	 Index = 23
+	 Type= 16-bit signed integer
+	 Ref. = 25
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim46
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim47
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data27
+	 Index = 26
+	 Type= 16-bit signed integer
+	 Ref. = 28
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim52
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim53
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data34
+	 Index = 33
+	 Type= 16-bit signed integer
+	 Ref. = 35
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim66
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim67
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data35
+	 Index = 34
+	 Type= 16-bit signed integer
+	 Ref. = 36
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim68
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim69
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data36
+	 Index = 35
+	 Type= 16-bit signed integer
+	 Ref. = 37
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim70
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim71
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data37
+	 Index = 36
+	 Type= 16-bit signed integer
+	 Ref. = 38
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim72
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim73
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data40
+	 Index = 39
+	 Type= 16-bit signed integer
+	 Ref. = 41
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim78
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim79
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
diff --git a/mfhdf/dumper/testfiles/dumpsds-17.out b/mfhdf/dumper/testfiles/dumpsds-17.out
new file mode 100644
index 0000000..9a8e5b9
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-17.out
@@ -0,0 +1,297 @@
+File name: sds_empty_many.hdf 
+
+File attributes:
+	 Attr0: Name = file_contents
+		 Type = 8-bit signed char 
+		 Count= 116
+		 Value = This file was generated by the program ma
+                         nySDSs.c in hdf4/mfhdf/dumper/testfiles t
+                         o test the flag -k in hdp dumpsds\000
+
+Variable Name = data40
+	 Index = 39
+	 Type= 16-bit signed integer
+	 Ref. = 41
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim78
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim79
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data37
+	 Index = 36
+	 Type= 16-bit signed integer
+	 Ref. = 38
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim72
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim73
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data34
+	 Index = 33
+	 Type= 16-bit signed integer
+	 Ref. = 35
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim66
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim67
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data27
+	 Index = 26
+	 Type= 16-bit signed integer
+	 Ref. = 28
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim52
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim53
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data35
+	 Index = 34
+	 Type= 16-bit signed integer
+	 Ref. = 36
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim68
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim69
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data36
+	 Index = 35
+	 Type= 16-bit signed integer
+	 Ref. = 37
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim70
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim71
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data1
+	 Index = 0
+	 Type= 16-bit signed integer
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim0
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim1
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data2
+	 Index = 1
+	 Type= 16-bit signed integer
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim2
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim3
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data6
+	 Index = 5
+	 Type= 16-bit signed integer
+	 Ref. = 7
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim10
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim11
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data9
+	 Index = 8
+	 Type= 16-bit signed integer
+	 Ref. = 10
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim16
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim17
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data4
+	 Index = 3
+	 Type= 16-bit signed integer
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim6
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim7
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data3
+	 Index = 2
+	 Type= 16-bit signed integer
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim4
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim5
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data15
+	 Index = 14
+	 Type= 16-bit signed integer
+	 Ref. = 16
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim28
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim29
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data16
+	 Index = 15
+	 Type= 16-bit signed integer
+	 Ref. = 17
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim30
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim31
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data14
+	 Index = 13
+	 Type= 16-bit signed integer
+	 Ref. = 15
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim26
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim27
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data24
+	 Index = 23
+	 Type= 16-bit signed integer
+	 Ref. = 25
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim46
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim47
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data23
+	 Index = 22
+	 Type= 16-bit signed integer
+	 Ref. = 24
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim44
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim45
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+
+Variable Name = data22
+	 Index = 21
+	 Type= 16-bit signed integer
+	 Ref. = 23
+	 Compression method = NONE
+	 Rank = 2
+	 Number of attributes = 0
+	 Dim0: Name=fakeDim42
+		 Size = UNLIMITED (currently 0)
+		 Scale Type = number-type not set
+		 Number of attributes = 0
+	 Dim1: Name=fakeDim43
+		 Size = 10
+		 Scale Type = number-type not set
+		 Number of attributes = 0
diff --git a/mfhdf/dumper/testfiles/dumpsds-18.out b/mfhdf/dumper/testfiles/dumpsds-18.out
new file mode 100644
index 0000000..ed7539c
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-18.out
@@ -0,0 +1,108 @@
+File name: Roy.nc 
+
+File attributes:
+	 Attr0: Name = source
+		 Type = 8-bit signed char 
+		 Count= 18
+		 Value = COADS CMR5 DATASET
+	 Attr1: Name = DATA_TYPE
+		 Type = 8-bit signed char 
+		 Count= 13
+		 Value = MONTHLY MEANS
+	 Attr2: Name = COORD_SYSTEM
+		 Type = 8-bit signed char 
+		 Count= 12
+		 Value = GEOGRAPHICAL
+	 Attr3: Name = COMMENT
+		 Type = 8-bit signed char 
+		 Count= 81
+		 Value = month since 1980-1-1 00:00:00, Latitudes:
+                            32.0,  36.0 Longitudes: -140.0,-136.0
+	 Attr4: Name = Platform_Types
+		 Type = 8-bit signed char 
+		 Count= 13
+		 Value = All Platforms
+
+Variable Name = lon
+	 Index = 0
+	 Type= 32-bit floating point
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=lon
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 9
+		 Value = longitude
+	 Attr1: Name = FORTRAN_format
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = f6.1
+	 Attr2: Name = units
+		 Type = 8-bit signed char 
+		 Count= 12
+		 Value = degrees_east
+	 Data : 
+                -140.000000 -138.000000 
+
+
+Variable Name = lat
+	 Index = 1
+	 Type= 32-bit floating point
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=lat
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 8
+		 Value = latitude
+	 Attr1: Name = FORTRAN_format
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = f6.1
+	 Attr2: Name = units
+		 Type = 8-bit signed char 
+		 Count= 13
+		 Value = degrees_north
+	 Data : 
+                34.000000 32.000000 
+
+
+Variable Name = ref_time
+	 Index = 2
+	 Type= 32-bit floating point
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=ref_time
+		 Size = UNLIMITED (currently 48)
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 14
+		 Value = reference time
+	 Attr1: Name = FORTRAN_format
+		 Type = 8-bit signed char 
+		 Count= 3
+		 Value = i10
+	 Attr2: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = months
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 4.000000 5.000000 
+                6.000000 7.000000 8.000000 9.000000 10.000000 11.000000 
+                12.000000 13.000000 14.000000 15.000000 16.000000 
+                17.000000 18.000000 19.000000 20.000000 21.000000 
+                22.000000 23.000000 24.000000 25.000000 26.000000 
+                27.000000 28.000000 29.000000 30.000000 31.000000 
+                32.000000 33.000000 34.000000 35.000000 36.000000 
+                37.000000 38.000000 39.000000 40.000000 41.000000 
+                42.000000 43.000000 44.000000 45.000000 46.000000 
+                47.000000 
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-2.out b/mfhdf/dumper/testfiles/dumpsds-2.out
new file mode 100644
index 0000000..564ac0f
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-2.out
@@ -0,0 +1,26 @@
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim2
+	 Index = 2
+	 Scale Type= 32-bit floating point
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim2
+		 Size = 4
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Column
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 2
+		 Value = Cm
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-3.out b/mfhdf/dumper/testfiles/dumpsds-3.out
new file mode 100644
index 0000000..60fd218
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-3.out
@@ -0,0 +1,64 @@
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim1
+	 Index = 1
+	 Scale Type= 32-bit floating point
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim1
+		 Size = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Line
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Inch
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int16
+	 Data : 
+                0.000000 10.000000 20.000000 
+
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = 123.000000 
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = -1.000000 
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+                10.000000 11.000000 12.000000 13.000000 
+                20.000000 21.000000 22.000000 23.000000 
+
+                100.000000 101.000000 102.000000 103.000000 
+                110.000000 111.000000 112.000000 113.000000 
+                120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-4.out b/mfhdf/dumper/testfiles/dumpsds-4.out
new file mode 100644
index 0000000..a142cfc
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-4.out
@@ -0,0 +1 @@
+SDS with name 'Time': not found
diff --git a/mfhdf/dumper/testfiles/dumpsds-5.out b/mfhdf/dumper/testfiles/dumpsds-5.out
new file mode 100644
index 0000000..bd20536
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-5.out
@@ -0,0 +1,64 @@
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim0
+		 Size = 2
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Time
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Second
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 100.000000 
+
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = 123.000000 
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = -1.000000 
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+                10.000000 11.000000 12.000000 13.000000 
+                20.000000 21.000000 22.000000 23.000000 
+
+                100.000000 101.000000 102.000000 103.000000 
+                110.000000 111.000000 112.000000 113.000000 
+                120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-6.out b/mfhdf/dumper/testfiles/dumpsds-6.out
new file mode 100644
index 0000000..bd20536
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-6.out
@@ -0,0 +1,64 @@
+File name: swf32.hdf 
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim0
+		 Size = 2
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Time
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Second
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 100.000000 
+
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = 123.000000 
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = -1.000000 
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+                10.000000 11.000000 12.000000 13.000000 
+                20.000000 21.000000 22.000000 23.000000 
+
+                100.000000 101.000000 102.000000 103.000000 
+                110.000000 111.000000 112.000000 113.000000 
+                120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-7.out b/mfhdf/dumper/testfiles/dumpsds-7.out
new file mode 100644
index 0000000..853791c
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-7.out
@@ -0,0 +1,11 @@
+0.000000 100.000000 
+
+0.000000 1.000000 2.000000 3.000000 
+10.000000 11.000000 12.000000 13.000000 
+20.000000 21.000000 22.000000 23.000000 
+
+100.000000 101.000000 102.000000 103.000000 
+110.000000 111.000000 112.000000 113.000000 
+120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpsds-8.out b/mfhdf/dumper/testfiles/dumpsds-8.out
new file mode 100644
index 0000000..c1005e0
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-8.out
@@ -0,0 +1,111 @@
+File name: swf32_fileattr.hdf 
+
+File attributes:
+	 Attr0: Name = File purpose
+		 Type = 8-bit signed char 
+		 Count= 37
+		 Value = For testing dumpsds SD file attribute
+	 Attr1: Name = File contents
+		 Type = 8-bit signed char 
+		 Count= 14
+		 Value = Some data sets
+	 Attr2: Name = Test clean format
+		 Type = 8-bit signed char 
+		 Count= 65
+		 Value = A tab <\011>, a CR <\012>, several nulls 
+                         <\000\000\000\000\000\000>, and one more 
+                         tab <\011>
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim0
+		 Size = 2
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Time
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Second
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+
+Dimension Variable Name = fakeDim1
+	 Index = 1
+	 Scale Type= 32-bit floating point
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim1
+		 Size = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Line
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Inch
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int16
+
+Dimension Variable Name = fakeDim2
+	 Index = 2
+	 Scale Type= 32-bit floating point
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim2
+		 Size = 4
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Column
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 2
+		 Value = Cm
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = 123.000000 
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = -1.000000 
diff --git a/mfhdf/dumper/testfiles/dumpsds-9.out b/mfhdf/dumper/testfiles/dumpsds-9.out
new file mode 100644
index 0000000..c8c55fc
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpsds-9.out
@@ -0,0 +1,130 @@
+File name: swf32_fileattr.hdf 
+
+File attributes:
+	 Attr0: Name = File purpose
+		 Type = 8-bit signed char 
+		 Count= 37
+		 Value = For testing dumpsds SD file attribute
+	 Attr1: Name = File contents
+		 Type = 8-bit signed char 
+		 Count= 14
+		 Value = Some data sets
+	 Attr2: Name = Test clean format
+		 Type = 8-bit signed char 
+		 Count= 65
+		 Value = 
+A tab <	>, a CR <
+>, several nulls < ... >, and one more tab <	>
+
+Dimension Variable Name = fakeDim0
+	 Index = 0
+	 Scale Type= 32-bit floating point
+	 Ref. = 3
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim0
+		 Size = 2
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Time
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Second
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 100.000000 
+
+
+Dimension Variable Name = fakeDim1
+	 Index = 1
+	 Scale Type= 32-bit floating point
+	 Ref. = 4
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim1
+		 Size = 3
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Line
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 4
+		 Value = Inch
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int16
+	 Data : 
+                0.000000 10.000000 20.000000 
+
+
+Dimension Variable Name = fakeDim2
+	 Index = 2
+	 Scale Type= 32-bit floating point
+	 Ref. = 5
+	 Compression method = NONE
+	 Rank = 1
+	 Number of attributes = 3
+	 Dim0: Name=fakeDim2
+		 Size = 4
+	 Attr0: Name = long_name
+		 Type = 8-bit signed char 
+		 Count= 6
+		 Value = Column
+	 Attr1: Name = units
+		 Type = 8-bit signed char 
+		 Count= 2
+		 Value = Cm
+	 Attr2: Name = format
+		 Type = 8-bit signed char 
+		 Count= 5
+		 Value = Int32
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+
+
+Variable Name = Data-Set-2
+	 Index = 3
+	 Type= 32-bit floating point
+	 Ref. = 2
+	 Compression method = NONE
+	 Rank = 3
+	 Number of attributes = 2
+	 Dim0: Name=fakeDim0
+		 Size = 2
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim1: Name=fakeDim1
+		 Size = 3
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Dim2: Name=fakeDim2
+		 Size = 4
+		 Scale Type = 32-bit floating point
+		 Number of attributes = 3
+	 Attr0: Name = valid_max
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = 123.000000 
+	 Attr1: Name = valid_min
+		 Type = 32-bit floating point 
+		 Count= 1
+		 Value = -1.000000 
+	 Data : 
+                0.000000 1.000000 2.000000 3.000000 
+                10.000000 11.000000 12.000000 13.000000 
+                20.000000 21.000000 22.000000 23.000000 
+
+                100.000000 101.000000 102.000000 103.000000 
+                110.000000 111.000000 112.000000 113.000000 
+                120.000000 121.000000 122.000000 123.000000 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-1.out b/mfhdf/dumper/testfiles/dumpvd-1.out
new file mode 100644
index 0000000..2aa5035
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-1.out
@@ -0,0 +1,12144 @@
+File name: tvset.hdf 
+
+Vdata: 0
+   tag = 1962; reference = 1235;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [FIELD_name_HERE];
+   record size (in bytes) = 4;
+   name = Float Vdata; class = Test object;
+   number of attributes = 0 
+- field index 0: [FIELD_name_HERE], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+00       0.000000  ; 1.000000  ; 2.000000  ; 3.000000  ; 
+04       4.000000  ; 5.000000  ; 6.000000  ; 7.000000  ; 
+08       8.000000  ; 9.000000  ; 10.000000  ; 11.000000  ; 
+12       12.000000  ; 13.000000  ; 14.000000  ; 15.000000  ; 
+16       16.000000  ; 17.000000  ; 18.000000  ; 19.000000  ; 
+20       20.000000  ; 21.000000  ; 22.000000  ; 23.000000  ; 
+24       24.000000  ; 25.000000  ; 26.000000  ; 27.000000  ; 
+28       28.000000  ; 29.000000  ; 30.000000  ; 31.000000  ; 
+32       32.000000  ; 33.000000  ; 34.000000  ; 35.000000  ; 
+36       36.000000  ; 37.000000  ; 38.000000  ; 39.000000  ; 
+40       40.000000  ; 41.000000  ; 42.000000  ; 43.000000  ; 
+44       44.000000  ; 45.000000  ; 46.000000  ; 47.000000  ; 
+48       48.000000  ; 49.000000  ; 50.000000  ; 51.000000  ; 
+52       52.000000  ; 53.000000  ; 54.000000  ; 55.000000  ; 
+56       56.000000  ; 57.000000  ; 58.000000  ; 59.000000  ; 
+60       60.000000  ; 61.000000  ; 62.000000  ; 63.000000  ; 
+64       64.000000  ; 65.000000  ; 66.000000  ; 67.000000  ; 
+68       68.000000  ; 69.000000  ; 70.000000  ; 71.000000  ; 
+72       72.000000  ; 73.000000  ; 74.000000  ; 75.000000  ; 
+76       76.000000  ; 77.000000  ; 78.000000  ; 79.000000  ; 
+80       80.000000  ; 81.000000  ; 82.000000  ; 83.000000  ; 
+84       84.000000  ; 85.000000  ; 86.000000  ; 87.000000  ; 
+88       88.000000  ; 89.000000  ; 90.000000  ; 91.000000  ; 
+92       92.000000  ; 93.000000  ; 94.000000  ; 95.000000  ; 
+96       96.000000  ; 97.000000  ; 98.000000  ; 99.000000  ; 
+
+
+Vdata: 1
+   tag = 1962; reference = 1236;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [DIFFERENT_FIELD_NAME];
+   record size (in bytes) = 8;
+   name = Integer Vdata; class = Test object;
+   number of attributes = 0 
+- field index 0: [DIFFERENT_FIELD_NAME], type=24, order=2
+   number of attributes = 0 
+Loc.     Data
+00       0 1  ; 2 3  ; 4 5  ; 6 7  ; 
+04       8 9  ; 10 11  ; 12 13  ; 14 15  ; 
+08       16 17  ; 18 19  ; 20 21  ; 22 23  ; 
+12       24 25  ; 26 27  ; 28 29  ; 30 31  ; 
+16       32 33  ; 34 35  ; 36 37  ; 38 39  ; 
+20       40 41  ; 42 43  ; 44 45  ; 46 47  ; 
+24       48 49  ; 50 51  ; 52 53  ; 54 55  ; 
+28       56 57  ; 58 59  ; 60 61  ; 62 63  ; 
+32       64 65  ; 66 67  ; 68 69  ; 70 71  ; 
+36       72 73  ; 74 75  ; 76 77  ; 78 79  ; 
+40       80 81  ; 82 83  ; 84 85  ; 86 87  ; 
+44       88 89  ; 90 91  ; 92 93  ; 94 95  ; 
+48       96 97  ; 98 99  ; 100 101  ; 102 103  ; 
+52       104 105  ; 106 107  ; 108 109  ; 110 111  ; 
+56       112 113  ; 114 115  ; 116 117  ; 118 119  ; 
+60       120 121  ; 122 123  ; 124 125  ; 126 127  ; 
+64       128 129  ; 130 131  ; 132 133  ; 134 135  ; 
+68       136 137  ; 138 139  ; 140 141  ; 142 143  ; 
+72       144 145  ; 146 147  ; 148 149  ; 150 151  ; 
+76       152 153  ; 154 155  ; 156 157  ; 158 159  ; 
+80       160 161  ; 162 163  ; 164 165  ; 166 167  ; 
+84       168 169  ; 170 171  ; 172 173  ; 174 175  ; 
+88       176 177  ; 178 179  ; 180 181  ; 182 183  ; 
+92       184 185  ; 186 187  ; 188 189  ; 190 191  ; 
+96       192 193  ; 194 195  ; 196 197  ; 198 199  ; 
+
+
+Vdata: 2
+   tag = 1962; reference = 1237;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [A, B];
+   record size (in bytes) = 8;
+   name = Mixed Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [A], type=5, order=1
+   number of attributes = 0 
+- field index 1: [B], type=24, order=1
+   number of attributes = 0 
+Loc.     Data
+00       0.000000  0  ; 2.000000  1  ; 4.000000  2  ; 
+03       6.000000  3  ; 8.000000  4  ; 10.000000  5  ; 
+06       12.000000  6  ; 14.000000  7  ; 16.000000  8  ; 
+09       18.000000  9  ; 20.000000  10  ; 22.000000  11  ; 
+12       24.000000  12  ; 26.000000  13  ; 28.000000  14  ; 
+15       30.000000  15  ; 32.000000  16  ; 34.000000  17  ; 
+18       36.000000  18  ; 38.000000  19  ; 40.000000  20  ; 
+21       42.000000  21  ; 44.000000  22  ; 46.000000  23  ; 
+24       48.000000  24  ; 50.000000  25  ; 52.000000  26  ; 
+27       54.000000  27  ; 56.000000  28  ; 58.000000  29  ; 
+30       60.000000  30  ; 62.000000  31  ; 64.000000  32  ; 
+33       66.000000  33  ; 68.000000  34  ; 70.000000  35  ; 
+36       72.000000  36  ; 74.000000  37  ; 76.000000  38  ; 
+39       78.000000  39  ; 80.000000  40  ; 82.000000  41  ; 
+42       84.000000  42  ; 86.000000  43  ; 88.000000  44  ; 
+45       90.000000  45  ; 92.000000  46  ; 94.000000  47  ; 
+48       96.000000  48  ; 98.000000  49  ; 100.000000  50  ; 
+51       102.000000  51  ; 104.000000  52  ; 106.000000  53  ; 
+54       108.000000  54  ; 110.000000  55  ; 112.000000  56  ; 
+57       114.000000  57  ; 116.000000  58  ; 118.000000  59  ; 
+60       120.000000  60  ; 122.000000  61  ; 124.000000  62  ; 
+63       126.000000  63  ; 128.000000  64  ; 130.000000  65  ; 
+66       132.000000  66  ; 134.000000  67  ; 136.000000  68  ; 
+69       138.000000  69  ; 140.000000  70  ; 142.000000  71  ; 
+72       144.000000  72  ; 146.000000  73  ; 148.000000  74  ; 
+75       150.000000  75  ; 152.000000  76  ; 154.000000  77  ; 
+78       156.000000  78  ; 158.000000  79  ; 160.000000  80  ; 
+81       162.000000  81  ; 164.000000  82  ; 166.000000  83  ; 
+84       168.000000  84  ; 170.000000  85  ; 172.000000  86  ; 
+87       174.000000  87  ; 176.000000  88  ; 178.000000  89  ; 
+90       180.000000  90  ; 182.000000  91  ; 184.000000  92  ; 
+93       186.000000  93  ; 188.000000  94  ; 190.000000  95  ; 
+96       192.000000  96  ; 194.000000  97  ; 196.000000  98  ; 
+99       198.000000  99  ; 
+
+Vdata: 3
+   tag = 1962; reference = 1238;
+   number of records = 10; interlace = FULL_INTERLACE (0);
+   fields = [STATION_NAME, VALUES, FLOATS];
+   record size (in bytes) = 18;
+   name = Multi-Order Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [STATION_NAME], type=4, order=2
+   number of attributes = 0 
+- field index 1: [VALUES], type=24, order=3
+   number of attributes = 0 
+- field index 2: [FLOATS], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        a b  0 1 2  15.500000  ; c d  3 4 5  16.000000  ; 
+2        e f  6 7 8  16.500000  ; g h  9 10 11  17.000000  ; 
+4        i j  12 13 14  17.500000  ; k l  15 16 17  18.000000  ; 
+6        m n  18 19 20  18.500000  ; o p  21 22 23  19.000000  ; 
+8        q r  24 25 26  19.500000  ; s t  27 28 29  20.000000  ; 
+
+
+Vdata: 4
+   tag = 1962; reference = 1239;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-0; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 5
+   tag = 1962; reference = 1240;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-1; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 6
+   tag = 1962; reference = 1241;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-2; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 7
+   tag = 1962; reference = 1242;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-3; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 8
+   tag = 1962; reference = 1243;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-4; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 9
+   tag = 1962; reference = 1244;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-5; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 10
+   tag = 1962; reference = 1245;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-6; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 11
+   tag = 1962; reference = 1246;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-7; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 12
+   tag = 1962; reference = 1247;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-8; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 13
+   tag = 1962; reference = 1248;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-9; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 14
+   tag = 1962; reference = 1249;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-10; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 15
+   tag = 1962; reference = 1250;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-11; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 16
+   tag = 1962; reference = 1251;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-12; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 17
+   tag = 1962; reference = 1252;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-13; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 18
+   tag = 1962; reference = 1253;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-14; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 19
+   tag = 1962; reference = 1254;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-15; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 20
+   tag = 1962; reference = 1255;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-16; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 21
+   tag = 1962; reference = 1256;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-17; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 22
+   tag = 1962; reference = 1257;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-18; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 23
+   tag = 1962; reference = 1258;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-19; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 24
+   tag = 1962; reference = 1259;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-20; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 25
+   tag = 1962; reference = 1260;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-21; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 26
+   tag = 1962; reference = 1261;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-22; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 27
+   tag = 1962; reference = 1262;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-23; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 28
+   tag = 1962; reference = 1263;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-24; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 29
+   tag = 1962; reference = 1264;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-25; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 30
+   tag = 1962; reference = 1265;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-26; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 31
+   tag = 1962; reference = 1266;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-27; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 32
+   tag = 1962; reference = 1267;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-28; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 33
+   tag = 1962; reference = 1268;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-29; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 34
+   tag = 1962; reference = 1269;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-30; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 35
+   tag = 1962; reference = 1270;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-31; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 36
+   tag = 1962; reference = 1271;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-32; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 37
+   tag = 1962; reference = 1272;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-33; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 38
+   tag = 1962; reference = 1273;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-34; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 39
+   tag = 1962; reference = 1274;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-35; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 40
+   tag = 1962; reference = 1275;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-36; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 41
+   tag = 1962; reference = 1276;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-37; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 42
+   tag = 1962; reference = 1277;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-38; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 43
+   tag = 1962; reference = 1278;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-39; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 44
+   tag = 1962; reference = 1279;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-40; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 45
+   tag = 1962; reference = 1280;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-41; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 46
+   tag = 1962; reference = 1281;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-42; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 47
+   tag = 1962; reference = 1282;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-43; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 48
+   tag = 1962; reference = 1283;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-44; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 49
+   tag = 1962; reference = 1284;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-45; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 50
+   tag = 1962; reference = 1285;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-46; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 51
+   tag = 1962; reference = 1286;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-47; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 52
+   tag = 1962; reference = 1287;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-48; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 53
+   tag = 1962; reference = 1288;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-49; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 54
+   tag = 1962; reference = 1289;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-50; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 55
+   tag = 1962; reference = 1290;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-51; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 56
+   tag = 1962; reference = 1291;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-52; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 57
+   tag = 1962; reference = 1292;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-53; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 58
+   tag = 1962; reference = 1293;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-54; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 59
+   tag = 1962; reference = 1294;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-55; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 60
+   tag = 1962; reference = 1295;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-56; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 61
+   tag = 1962; reference = 1296;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-57; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 62
+   tag = 1962; reference = 1297;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-58; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 63
+   tag = 1962; reference = 1298;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-59; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 64
+   tag = 1962; reference = 1299;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-60; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 65
+   tag = 1962; reference = 1300;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-61; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 66
+   tag = 1962; reference = 1301;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-62; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 67
+   tag = 1962; reference = 1302;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-63; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 68
+   tag = 1962; reference = 1303;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-64; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 69
+   tag = 1962; reference = 1304;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-65; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 70
+   tag = 1962; reference = 1305;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-66; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 71
+   tag = 1962; reference = 1306;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-67; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 72
+   tag = 1962; reference = 1307;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-68; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 73
+   tag = 1962; reference = 1308;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-69; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 74
+   tag = 1962; reference = 1309;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-70; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 75
+   tag = 1962; reference = 1310;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-71; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 76
+   tag = 1962; reference = 1311;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-72; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 77
+   tag = 1962; reference = 1312;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-73; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 78
+   tag = 1962; reference = 1313;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-74; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 79
+   tag = 1962; reference = 1314;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-75; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 80
+   tag = 1962; reference = 1315;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-76; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 81
+   tag = 1962; reference = 1316;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-77; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 82
+   tag = 1962; reference = 1317;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-78; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 83
+   tag = 1962; reference = 1318;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-79; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 84
+   tag = 1962; reference = 1319;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-80; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 85
+   tag = 1962; reference = 1320;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-81; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 86
+   tag = 1962; reference = 1321;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-82; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 87
+   tag = 1962; reference = 1322;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-83; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 88
+   tag = 1962; reference = 1323;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-84; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 89
+   tag = 1962; reference = 1324;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-85; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 90
+   tag = 1962; reference = 1325;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-86; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 91
+   tag = 1962; reference = 1326;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-87; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 92
+   tag = 1962; reference = 1327;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-88; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 93
+   tag = 1962; reference = 1328;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-89; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 94
+   tag = 1962; reference = 1329;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-90; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 95
+   tag = 1962; reference = 1330;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-91; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 96
+   tag = 1962; reference = 1331;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-92; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 97
+   tag = 1962; reference = 1332;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-93; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 98
+   tag = 1962; reference = 1333;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-94; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 99
+   tag = 1962; reference = 1334;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-95; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 100
+   tag = 1962; reference = 1335;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-96; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 101
+   tag = 1962; reference = 1336;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-97; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 102
+   tag = 1962; reference = 1337;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-98; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 103
+   tag = 1962; reference = 1338;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-99; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 104
+   tag = 1962; reference = 1339;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-100; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 105
+   tag = 1962; reference = 1340;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-101; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 106
+   tag = 1962; reference = 1341;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-102; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 107
+   tag = 1962; reference = 1342;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-103; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 108
+   tag = 1962; reference = 1343;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-104; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 109
+   tag = 1962; reference = 1344;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-105; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 110
+   tag = 1962; reference = 1345;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-106; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 111
+   tag = 1962; reference = 1346;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-107; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 112
+   tag = 1962; reference = 1347;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-108; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 113
+   tag = 1962; reference = 1348;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-109; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 114
+   tag = 1962; reference = 1349;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-110; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 115
+   tag = 1962; reference = 1350;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-111; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 116
+   tag = 1962; reference = 1351;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-112; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 117
+   tag = 1962; reference = 1352;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-113; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 118
+   tag = 1962; reference = 1353;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-114; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 119
+   tag = 1962; reference = 1354;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-115; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 120
+   tag = 1962; reference = 1355;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-116; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 121
+   tag = 1962; reference = 1356;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-117; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 122
+   tag = 1962; reference = 1357;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-118; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 123
+   tag = 1962; reference = 1358;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-119; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 124
+   tag = 1962; reference = 1359;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-120; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 125
+   tag = 1962; reference = 1360;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-121; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 126
+   tag = 1962; reference = 1361;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-122; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 127
+   tag = 1962; reference = 1362;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-123; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 128
+   tag = 1962; reference = 1363;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-124; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 129
+   tag = 1962; reference = 1364;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-125; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 130
+   tag = 1962; reference = 1365;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-126; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 131
+   tag = 1962; reference = 1366;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-127; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 132
+   tag = 1962; reference = 1367;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-128; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 133
+   tag = 1962; reference = 1368;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-129; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 134
+   tag = 1962; reference = 1369;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-130; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 135
+   tag = 1962; reference = 1370;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-131; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 136
+   tag = 1962; reference = 1371;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-132; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 137
+   tag = 1962; reference = 1372;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-133; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 138
+   tag = 1962; reference = 1373;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-134; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 139
+   tag = 1962; reference = 1374;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-135; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 140
+   tag = 1962; reference = 1375;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-136; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 141
+   tag = 1962; reference = 1376;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-137; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 142
+   tag = 1962; reference = 1377;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-138; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 143
+   tag = 1962; reference = 1378;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-139; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 144
+   tag = 1962; reference = 1379;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-140; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 145
+   tag = 1962; reference = 1380;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-141; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 146
+   tag = 1962; reference = 1381;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-142; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 147
+   tag = 1962; reference = 1382;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-143; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 148
+   tag = 1962; reference = 1383;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-144; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 149
+   tag = 1962; reference = 1384;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-145; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 150
+   tag = 1962; reference = 1385;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-146; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 151
+   tag = 1962; reference = 1386;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-147; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 152
+   tag = 1962; reference = 1387;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-148; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 153
+   tag = 1962; reference = 1388;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-149; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 154
+   tag = 1962; reference = 1389;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-150; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 155
+   tag = 1962; reference = 1390;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-151; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 156
+   tag = 1962; reference = 1391;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-152; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 157
+   tag = 1962; reference = 1392;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-153; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 158
+   tag = 1962; reference = 1393;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-154; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 159
+   tag = 1962; reference = 1394;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-155; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 160
+   tag = 1962; reference = 1395;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-156; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 161
+   tag = 1962; reference = 1396;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-157; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 162
+   tag = 1962; reference = 1397;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-158; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 163
+   tag = 1962; reference = 1398;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-159; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 164
+   tag = 1962; reference = 1399;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-160; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 165
+   tag = 1962; reference = 1400;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-161; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 166
+   tag = 1962; reference = 1401;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-162; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 167
+   tag = 1962; reference = 1402;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-163; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 168
+   tag = 1962; reference = 1403;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-164; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 169
+   tag = 1962; reference = 1404;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-165; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 170
+   tag = 1962; reference = 1405;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-166; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 171
+   tag = 1962; reference = 1406;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-167; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 172
+   tag = 1962; reference = 1407;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-168; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 173
+   tag = 1962; reference = 1408;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-169; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 174
+   tag = 1962; reference = 1409;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-170; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 175
+   tag = 1962; reference = 1410;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-171; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 176
+   tag = 1962; reference = 1411;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-172; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 177
+   tag = 1962; reference = 1412;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-173; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 178
+   tag = 1962; reference = 1413;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-174; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 179
+   tag = 1962; reference = 1414;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-175; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 180
+   tag = 1962; reference = 1415;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-176; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 181
+   tag = 1962; reference = 1416;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-177; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 182
+   tag = 1962; reference = 1417;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-178; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 183
+   tag = 1962; reference = 1418;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-179; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 184
+   tag = 1962; reference = 1419;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-180; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 185
+   tag = 1962; reference = 1420;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-181; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 186
+   tag = 1962; reference = 1421;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-182; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 187
+   tag = 1962; reference = 1422;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-183; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 188
+   tag = 1962; reference = 1423;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-184; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 189
+   tag = 1962; reference = 1424;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-185; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 190
+   tag = 1962; reference = 1425;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-186; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 191
+   tag = 1962; reference = 1426;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-187; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 192
+   tag = 1962; reference = 1427;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-188; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 193
+   tag = 1962; reference = 1428;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-189; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 194
+   tag = 1962; reference = 1429;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-190; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 195
+   tag = 1962; reference = 1430;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-191; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 196
+   tag = 1962; reference = 1431;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-192; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 197
+   tag = 1962; reference = 1432;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-193; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 198
+   tag = 1962; reference = 1433;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-194; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 199
+   tag = 1962; reference = 1434;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-195; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 200
+   tag = 1962; reference = 1435;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-196; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 201
+   tag = 1962; reference = 1436;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-197; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 202
+   tag = 1962; reference = 1437;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-198; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 203
+   tag = 1962; reference = 1438;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-199; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 204
+   tag = 1962; reference = 1439;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-200; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 205
+   tag = 1962; reference = 1440;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-201; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 206
+   tag = 1962; reference = 1441;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-202; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 207
+   tag = 1962; reference = 1442;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-203; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 208
+   tag = 1962; reference = 1443;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-204; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 209
+   tag = 1962; reference = 1444;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-205; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 210
+   tag = 1962; reference = 1445;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-206; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 211
+   tag = 1962; reference = 1446;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-207; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 212
+   tag = 1962; reference = 1447;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-208; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 213
+   tag = 1962; reference = 1448;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-209; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 214
+   tag = 1962; reference = 1449;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-210; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 215
+   tag = 1962; reference = 1450;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-211; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 216
+   tag = 1962; reference = 1451;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-212; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 217
+   tag = 1962; reference = 1452;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-213; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 218
+   tag = 1962; reference = 1453;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-214; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 219
+   tag = 1962; reference = 1454;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-215; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 220
+   tag = 1962; reference = 1455;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-216; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 221
+   tag = 1962; reference = 1456;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-217; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 222
+   tag = 1962; reference = 1457;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-218; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 223
+   tag = 1962; reference = 1458;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-219; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 224
+   tag = 1962; reference = 1459;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-220; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 225
+   tag = 1962; reference = 1460;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-221; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 226
+   tag = 1962; reference = 1461;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-222; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 227
+   tag = 1962; reference = 1462;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-223; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 228
+   tag = 1962; reference = 1463;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-224; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 229
+   tag = 1962; reference = 1464;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-225; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 230
+   tag = 1962; reference = 1465;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-226; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 231
+   tag = 1962; reference = 1466;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-227; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 232
+   tag = 1962; reference = 1467;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-228; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 233
+   tag = 1962; reference = 1468;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-229; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 234
+   tag = 1962; reference = 1469;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-230; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 235
+   tag = 1962; reference = 1470;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-231; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 236
+   tag = 1962; reference = 1471;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-232; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 237
+   tag = 1962; reference = 1472;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-233; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 238
+   tag = 1962; reference = 1473;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-234; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 239
+   tag = 1962; reference = 1474;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-235; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 240
+   tag = 1962; reference = 1475;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-236; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 241
+   tag = 1962; reference = 1476;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-237; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 242
+   tag = 1962; reference = 1477;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-238; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 243
+   tag = 1962; reference = 1478;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-239; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 244
+   tag = 1962; reference = 1479;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-240; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 245
+   tag = 1962; reference = 1480;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-241; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 246
+   tag = 1962; reference = 1481;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-242; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 247
+   tag = 1962; reference = 1482;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-243; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 248
+   tag = 1962; reference = 1483;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-244; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 249
+   tag = 1962; reference = 1484;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-245; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 250
+   tag = 1962; reference = 1485;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-246; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 251
+   tag = 1962; reference = 1486;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-247; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 252
+   tag = 1962; reference = 1487;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-248; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 253
+   tag = 1962; reference = 1488;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-249; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 254
+   tag = 1962; reference = 1489;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-250; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 255
+   tag = 1962; reference = 1490;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-251; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 256
+   tag = 1962; reference = 1491;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-252; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 257
+   tag = 1962; reference = 1492;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-253; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 258
+   tag = 1962; reference = 1493;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-254; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 259
+   tag = 1962; reference = 1494;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-255; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 260
+   tag = 1962; reference = 1495;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-256; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 261
+   tag = 1962; reference = 1496;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-257; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 262
+   tag = 1962; reference = 1497;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-258; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 263
+   tag = 1962; reference = 1498;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-259; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 264
+   tag = 1962; reference = 1499;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-260; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 265
+   tag = 1962; reference = 1500;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-261; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 266
+   tag = 1962; reference = 1501;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-262; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 267
+   tag = 1962; reference = 1502;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-263; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 268
+   tag = 1962; reference = 1503;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-264; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 269
+   tag = 1962; reference = 1504;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-265; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 270
+   tag = 1962; reference = 1505;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-266; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 271
+   tag = 1962; reference = 1506;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-267; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 272
+   tag = 1962; reference = 1507;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-268; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 273
+   tag = 1962; reference = 1508;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-269; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 274
+   tag = 1962; reference = 1509;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-270; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 275
+   tag = 1962; reference = 1510;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-271; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 276
+   tag = 1962; reference = 1511;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-272; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 277
+   tag = 1962; reference = 1512;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-273; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 278
+   tag = 1962; reference = 1513;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-274; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 279
+   tag = 1962; reference = 1514;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-275; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 280
+   tag = 1962; reference = 1515;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-276; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 281
+   tag = 1962; reference = 1516;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-277; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 282
+   tag = 1962; reference = 1517;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-278; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 283
+   tag = 1962; reference = 1518;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-279; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 284
+   tag = 1962; reference = 1519;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-280; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 285
+   tag = 1962; reference = 1520;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-281; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 286
+   tag = 1962; reference = 1521;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-282; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 287
+   tag = 1962; reference = 1522;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-283; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 288
+   tag = 1962; reference = 1523;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-284; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 289
+   tag = 1962; reference = 1524;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-285; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 290
+   tag = 1962; reference = 1525;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-286; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 291
+   tag = 1962; reference = 1526;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-287; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 292
+   tag = 1962; reference = 1527;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-288; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 293
+   tag = 1962; reference = 1528;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-289; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 294
+   tag = 1962; reference = 1529;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-290; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 295
+   tag = 1962; reference = 1530;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-291; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 296
+   tag = 1962; reference = 1531;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-292; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 297
+   tag = 1962; reference = 1532;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-293; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 298
+   tag = 1962; reference = 1533;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-294; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 299
+   tag = 1962; reference = 1534;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-295; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 300
+   tag = 1962; reference = 1535;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-296; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 301
+   tag = 1962; reference = 1536;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-297; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 302
+   tag = 1962; reference = 1537;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-298; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 303
+   tag = 1962; reference = 1538;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-299; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 304
+   tag = 1962; reference = 1539;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-300; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 305
+   tag = 1962; reference = 1540;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-301; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 306
+   tag = 1962; reference = 1541;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-302; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 307
+   tag = 1962; reference = 1542;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-303; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 308
+   tag = 1962; reference = 1543;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-304; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 309
+   tag = 1962; reference = 1544;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-305; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 310
+   tag = 1962; reference = 1545;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-306; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 311
+   tag = 1962; reference = 1546;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-307; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 312
+   tag = 1962; reference = 1547;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-308; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 313
+   tag = 1962; reference = 1548;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-309; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 314
+   tag = 1962; reference = 1549;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-310; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 315
+   tag = 1962; reference = 1550;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-311; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 316
+   tag = 1962; reference = 1551;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-312; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 317
+   tag = 1962; reference = 1552;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-313; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 318
+   tag = 1962; reference = 1553;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-314; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 319
+   tag = 1962; reference = 1554;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-315; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 320
+   tag = 1962; reference = 1555;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-316; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 321
+   tag = 1962; reference = 1556;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-317; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 322
+   tag = 1962; reference = 1557;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-318; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 323
+   tag = 1962; reference = 1558;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-319; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 324
+   tag = 1962; reference = 1559;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-320; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 325
+   tag = 1962; reference = 1560;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-321; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 326
+   tag = 1962; reference = 1561;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-322; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 327
+   tag = 1962; reference = 1562;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-323; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 328
+   tag = 1962; reference = 1563;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-324; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 329
+   tag = 1962; reference = 1564;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-325; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 330
+   tag = 1962; reference = 1565;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-326; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 331
+   tag = 1962; reference = 1566;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-327; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 332
+   tag = 1962; reference = 1567;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-328; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 333
+   tag = 1962; reference = 1568;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-329; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 334
+   tag = 1962; reference = 1569;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-330; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 335
+   tag = 1962; reference = 1570;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-331; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 336
+   tag = 1962; reference = 1571;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-332; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 337
+   tag = 1962; reference = 1572;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-333; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 338
+   tag = 1962; reference = 1573;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-334; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 339
+   tag = 1962; reference = 1574;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-335; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 340
+   tag = 1962; reference = 1575;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-336; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 341
+   tag = 1962; reference = 1576;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-337; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 342
+   tag = 1962; reference = 1577;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-338; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 343
+   tag = 1962; reference = 1578;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-339; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 344
+   tag = 1962; reference = 1579;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-340; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 345
+   tag = 1962; reference = 1580;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-341; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 346
+   tag = 1962; reference = 1581;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-342; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 347
+   tag = 1962; reference = 1582;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-343; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 348
+   tag = 1962; reference = 1583;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-344; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 349
+   tag = 1962; reference = 1584;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-345; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 350
+   tag = 1962; reference = 1585;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-346; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 351
+   tag = 1962; reference = 1586;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-347; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 352
+   tag = 1962; reference = 1587;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-348; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 353
+   tag = 1962; reference = 1588;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-349; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 354
+   tag = 1962; reference = 1589;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-350; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 355
+   tag = 1962; reference = 1590;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-351; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 356
+   tag = 1962; reference = 1591;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-352; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 357
+   tag = 1962; reference = 1592;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-353; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 358
+   tag = 1962; reference = 1593;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-354; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 359
+   tag = 1962; reference = 1594;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-355; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 360
+   tag = 1962; reference = 1595;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-356; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 361
+   tag = 1962; reference = 1596;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-357; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 362
+   tag = 1962; reference = 1597;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-358; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 363
+   tag = 1962; reference = 1598;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-359; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 364
+   tag = 1962; reference = 1599;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-360; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 365
+   tag = 1962; reference = 1600;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-361; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 366
+   tag = 1962; reference = 1601;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-362; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 367
+   tag = 1962; reference = 1602;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-363; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 368
+   tag = 1962; reference = 1603;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-364; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 369
+   tag = 1962; reference = 1604;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-365; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 370
+   tag = 1962; reference = 1605;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-366; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 371
+   tag = 1962; reference = 1606;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-367; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 372
+   tag = 1962; reference = 1607;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-368; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 373
+   tag = 1962; reference = 1608;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-369; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 374
+   tag = 1962; reference = 1609;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-370; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 375
+   tag = 1962; reference = 1610;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-371; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 376
+   tag = 1962; reference = 1611;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-372; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 377
+   tag = 1962; reference = 1612;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-373; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 378
+   tag = 1962; reference = 1613;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-374; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 379
+   tag = 1962; reference = 1614;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-375; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 380
+   tag = 1962; reference = 1615;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-376; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 381
+   tag = 1962; reference = 1616;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-377; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 382
+   tag = 1962; reference = 1617;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-378; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 383
+   tag = 1962; reference = 1618;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-379; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 384
+   tag = 1962; reference = 1619;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-380; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 385
+   tag = 1962; reference = 1620;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-381; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 386
+   tag = 1962; reference = 1621;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-382; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 387
+   tag = 1962; reference = 1622;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-383; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 388
+   tag = 1962; reference = 1623;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-384; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 389
+   tag = 1962; reference = 1624;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-385; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 390
+   tag = 1962; reference = 1625;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-386; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 391
+   tag = 1962; reference = 1626;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-387; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 392
+   tag = 1962; reference = 1627;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-388; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 393
+   tag = 1962; reference = 1628;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-389; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 394
+   tag = 1962; reference = 1629;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-390; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 395
+   tag = 1962; reference = 1630;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-391; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 396
+   tag = 1962; reference = 1631;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-392; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 397
+   tag = 1962; reference = 1632;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-393; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 398
+   tag = 1962; reference = 1633;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-394; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 399
+   tag = 1962; reference = 1634;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-395; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 400
+   tag = 1962; reference = 1635;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-396; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 401
+   tag = 1962; reference = 1636;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-397; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 402
+   tag = 1962; reference = 1637;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-398; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 403
+   tag = 1962; reference = 1638;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-399; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 404
+   tag = 1962; reference = 1639;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-400; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 405
+   tag = 1962; reference = 1640;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-401; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 406
+   tag = 1962; reference = 1641;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-402; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 407
+   tag = 1962; reference = 1642;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-403; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 408
+   tag = 1962; reference = 1643;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-404; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 409
+   tag = 1962; reference = 1644;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-405; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 410
+   tag = 1962; reference = 1645;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-406; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 411
+   tag = 1962; reference = 1646;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-407; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 412
+   tag = 1962; reference = 1647;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-408; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 413
+   tag = 1962; reference = 1648;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-409; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 414
+   tag = 1962; reference = 1649;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-410; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 415
+   tag = 1962; reference = 1650;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-411; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 416
+   tag = 1962; reference = 1651;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-412; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 417
+   tag = 1962; reference = 1652;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-413; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 418
+   tag = 1962; reference = 1653;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-414; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 419
+   tag = 1962; reference = 1654;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-415; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 420
+   tag = 1962; reference = 1655;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-416; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 421
+   tag = 1962; reference = 1656;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-417; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 422
+   tag = 1962; reference = 1657;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-418; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 423
+   tag = 1962; reference = 1658;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-419; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 424
+   tag = 1962; reference = 1659;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-420; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 425
+   tag = 1962; reference = 1660;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-421; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 426
+   tag = 1962; reference = 1661;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-422; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 427
+   tag = 1962; reference = 1662;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-423; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 428
+   tag = 1962; reference = 1663;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-424; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 429
+   tag = 1962; reference = 1664;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-425; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 430
+   tag = 1962; reference = 1665;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-426; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 431
+   tag = 1962; reference = 1666;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-427; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 432
+   tag = 1962; reference = 1667;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-428; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 433
+   tag = 1962; reference = 1668;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-429; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 434
+   tag = 1962; reference = 1669;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-430; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 435
+   tag = 1962; reference = 1670;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-431; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 436
+   tag = 1962; reference = 1671;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-432; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 437
+   tag = 1962; reference = 1672;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-433; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 438
+   tag = 1962; reference = 1673;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-434; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 439
+   tag = 1962; reference = 1674;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-435; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 440
+   tag = 1962; reference = 1675;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-436; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 441
+   tag = 1962; reference = 1676;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-437; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 442
+   tag = 1962; reference = 1677;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-438; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 443
+   tag = 1962; reference = 1678;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-439; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 444
+   tag = 1962; reference = 1679;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-440; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 445
+   tag = 1962; reference = 1680;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-441; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 446
+   tag = 1962; reference = 1681;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-442; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 447
+   tag = 1962; reference = 1682;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-443; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 448
+   tag = 1962; reference = 1683;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-444; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 449
+   tag = 1962; reference = 1684;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-445; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 450
+   tag = 1962; reference = 1685;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-446; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 451
+   tag = 1962; reference = 1686;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-447; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 452
+   tag = 1962; reference = 1687;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-448; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 453
+   tag = 1962; reference = 1688;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-449; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 454
+   tag = 1962; reference = 1689;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-450; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 455
+   tag = 1962; reference = 1690;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-451; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 456
+   tag = 1962; reference = 1691;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-452; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 457
+   tag = 1962; reference = 1692;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-453; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 458
+   tag = 1962; reference = 1693;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-454; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 459
+   tag = 1962; reference = 1694;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-455; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 460
+   tag = 1962; reference = 1695;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-456; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 461
+   tag = 1962; reference = 1696;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-457; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 462
+   tag = 1962; reference = 1697;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-458; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 463
+   tag = 1962; reference = 1698;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-459; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 464
+   tag = 1962; reference = 1699;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-460; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 465
+   tag = 1962; reference = 1700;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-461; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 466
+   tag = 1962; reference = 1701;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-462; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 467
+   tag = 1962; reference = 1702;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-463; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 468
+   tag = 1962; reference = 1703;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-464; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 469
+   tag = 1962; reference = 1704;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-465; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 470
+   tag = 1962; reference = 1705;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-466; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 471
+   tag = 1962; reference = 1706;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-467; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 472
+   tag = 1962; reference = 1707;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-468; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 473
+   tag = 1962; reference = 1708;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-469; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 474
+   tag = 1962; reference = 1709;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-470; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 475
+   tag = 1962; reference = 1710;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-471; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 476
+   tag = 1962; reference = 1711;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-472; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 477
+   tag = 1962; reference = 1712;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-473; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 478
+   tag = 1962; reference = 1713;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-474; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 479
+   tag = 1962; reference = 1714;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-475; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 480
+   tag = 1962; reference = 1715;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-476; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 481
+   tag = 1962; reference = 1716;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-477; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 482
+   tag = 1962; reference = 1717;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-478; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 483
+   tag = 1962; reference = 1718;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-479; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 484
+   tag = 1962; reference = 1719;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-480; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 485
+   tag = 1962; reference = 1720;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-481; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 486
+   tag = 1962; reference = 1721;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-482; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 487
+   tag = 1962; reference = 1722;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-483; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 488
+   tag = 1962; reference = 1723;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-484; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 489
+   tag = 1962; reference = 1724;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-485; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 490
+   tag = 1962; reference = 1725;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-486; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 491
+   tag = 1962; reference = 1726;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-487; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 492
+   tag = 1962; reference = 1727;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-488; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 493
+   tag = 1962; reference = 1728;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-489; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 494
+   tag = 1962; reference = 1729;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-490; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 495
+   tag = 1962; reference = 1730;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-491; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 496
+   tag = 1962; reference = 1731;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-492; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 497
+   tag = 1962; reference = 1732;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-493; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 498
+   tag = 1962; reference = 1733;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-494; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 499
+   tag = 1962; reference = 1734;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-495; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 500
+   tag = 1962; reference = 1735;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-496; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 501
+   tag = 1962; reference = 1736;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-497; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 502
+   tag = 1962; reference = 1737;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-498; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 503
+   tag = 1962; reference = 1738;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-499; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 504
+   tag = 1962; reference = 1739;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-500; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 505
+   tag = 1962; reference = 1740;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-501; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 506
+   tag = 1962; reference = 1741;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-502; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 507
+   tag = 1962; reference = 1742;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-503; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 508
+   tag = 1962; reference = 1743;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-504; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 509
+   tag = 1962; reference = 1744;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-505; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 510
+   tag = 1962; reference = 1745;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-506; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 511
+   tag = 1962; reference = 1746;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-507; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 512
+   tag = 1962; reference = 1747;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-508; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 513
+   tag = 1962; reference = 1748;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-509; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 514
+   tag = 1962; reference = 1749;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-510; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 515
+   tag = 1962; reference = 1750;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-511; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 516
+   tag = 1962; reference = 1751;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-512; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 517
+   tag = 1962; reference = 1752;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-513; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 518
+   tag = 1962; reference = 1753;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-514; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 519
+   tag = 1962; reference = 1754;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-515; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 520
+   tag = 1962; reference = 1755;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-516; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 521
+   tag = 1962; reference = 1756;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-517; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 522
+   tag = 1962; reference = 1757;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-518; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 523
+   tag = 1962; reference = 1758;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-519; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 524
+   tag = 1962; reference = 1759;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-520; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 525
+   tag = 1962; reference = 1760;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-521; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 526
+   tag = 1962; reference = 1761;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-522; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 527
+   tag = 1962; reference = 1762;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-523; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 528
+   tag = 1962; reference = 1763;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-524; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 529
+   tag = 1962; reference = 1764;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-525; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 530
+   tag = 1962; reference = 1765;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-526; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 531
+   tag = 1962; reference = 1766;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-527; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 532
+   tag = 1962; reference = 1767;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-528; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 533
+   tag = 1962; reference = 1768;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-529; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 534
+   tag = 1962; reference = 1769;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-530; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 535
+   tag = 1962; reference = 1770;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-531; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 536
+   tag = 1962; reference = 1771;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-532; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 537
+   tag = 1962; reference = 1772;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-533; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 538
+   tag = 1962; reference = 1773;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-534; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 539
+   tag = 1962; reference = 1774;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-535; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 540
+   tag = 1962; reference = 1775;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-536; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 541
+   tag = 1962; reference = 1776;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-537; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 542
+   tag = 1962; reference = 1777;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-538; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 543
+   tag = 1962; reference = 1778;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-539; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 544
+   tag = 1962; reference = 1779;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-540; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 545
+   tag = 1962; reference = 1780;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-541; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 546
+   tag = 1962; reference = 1781;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-542; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 547
+   tag = 1962; reference = 1782;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-543; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 548
+   tag = 1962; reference = 1783;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-544; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 549
+   tag = 1962; reference = 1784;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-545; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 550
+   tag = 1962; reference = 1785;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-546; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 551
+   tag = 1962; reference = 1786;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-547; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 552
+   tag = 1962; reference = 1787;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-548; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 553
+   tag = 1962; reference = 1788;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-549; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 554
+   tag = 1962; reference = 1789;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-550; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 555
+   tag = 1962; reference = 1790;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-551; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 556
+   tag = 1962; reference = 1791;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-552; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 557
+   tag = 1962; reference = 1792;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-553; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 558
+   tag = 1962; reference = 1793;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-554; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 559
+   tag = 1962; reference = 1794;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-555; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 560
+   tag = 1962; reference = 1795;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-556; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 561
+   tag = 1962; reference = 1796;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-557; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 562
+   tag = 1962; reference = 1797;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-558; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 563
+   tag = 1962; reference = 1798;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-559; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 564
+   tag = 1962; reference = 1799;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-560; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 565
+   tag = 1962; reference = 1800;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-561; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 566
+   tag = 1962; reference = 1801;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-562; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 567
+   tag = 1962; reference = 1802;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-563; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 568
+   tag = 1962; reference = 1803;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-564; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 569
+   tag = 1962; reference = 1804;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-565; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 570
+   tag = 1962; reference = 1805;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-566; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 571
+   tag = 1962; reference = 1806;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-567; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 572
+   tag = 1962; reference = 1807;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-568; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 573
+   tag = 1962; reference = 1808;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-569; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 574
+   tag = 1962; reference = 1809;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-570; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 575
+   tag = 1962; reference = 1810;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-571; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 576
+   tag = 1962; reference = 1811;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-572; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 577
+   tag = 1962; reference = 1812;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-573; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 578
+   tag = 1962; reference = 1813;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-574; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 579
+   tag = 1962; reference = 1814;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-575; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 580
+   tag = 1962; reference = 1815;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-576; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 581
+   tag = 1962; reference = 1816;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-577; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 582
+   tag = 1962; reference = 1817;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-578; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 583
+   tag = 1962; reference = 1818;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-579; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 584
+   tag = 1962; reference = 1819;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-580; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 585
+   tag = 1962; reference = 1820;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-581; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 586
+   tag = 1962; reference = 1821;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-582; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 587
+   tag = 1962; reference = 1822;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-583; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 588
+   tag = 1962; reference = 1823;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-584; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 589
+   tag = 1962; reference = 1824;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-585; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 590
+   tag = 1962; reference = 1825;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-586; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 591
+   tag = 1962; reference = 1826;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-587; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 592
+   tag = 1962; reference = 1827;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-588; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 593
+   tag = 1962; reference = 1828;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-589; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 594
+   tag = 1962; reference = 1829;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-590; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 595
+   tag = 1962; reference = 1830;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-591; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 596
+   tag = 1962; reference = 1831;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-592; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 597
+   tag = 1962; reference = 1832;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-593; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 598
+   tag = 1962; reference = 1833;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-594; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 599
+   tag = 1962; reference = 1834;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-595; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 600
+   tag = 1962; reference = 1835;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-596; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 601
+   tag = 1962; reference = 1836;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-597; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 602
+   tag = 1962; reference = 1837;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-598; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 603
+   tag = 1962; reference = 1838;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-599; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 604
+   tag = 1962; reference = 1839;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-600; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 605
+   tag = 1962; reference = 1840;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-601; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 606
+   tag = 1962; reference = 1841;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-602; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 607
+   tag = 1962; reference = 1842;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-603; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 608
+   tag = 1962; reference = 1843;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-604; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 609
+   tag = 1962; reference = 1844;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-605; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 610
+   tag = 1962; reference = 1845;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-606; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 611
+   tag = 1962; reference = 1846;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-607; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 612
+   tag = 1962; reference = 1847;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-608; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 613
+   tag = 1962; reference = 1848;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-609; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 614
+   tag = 1962; reference = 1849;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-610; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 615
+   tag = 1962; reference = 1850;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-611; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 616
+   tag = 1962; reference = 1851;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-612; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 617
+   tag = 1962; reference = 1852;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-613; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 618
+   tag = 1962; reference = 1853;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-614; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 619
+   tag = 1962; reference = 1854;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-615; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 620
+   tag = 1962; reference = 1855;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-616; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 621
+   tag = 1962; reference = 1856;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-617; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 622
+   tag = 1962; reference = 1857;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-618; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 623
+   tag = 1962; reference = 1858;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-619; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 624
+   tag = 1962; reference = 1859;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-620; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 625
+   tag = 1962; reference = 1860;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-621; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 626
+   tag = 1962; reference = 1861;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-622; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 627
+   tag = 1962; reference = 1862;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-623; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 628
+   tag = 1962; reference = 1863;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-624; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 629
+   tag = 1962; reference = 1864;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-625; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 630
+   tag = 1962; reference = 1865;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-626; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 631
+   tag = 1962; reference = 1866;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-627; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 632
+   tag = 1962; reference = 1867;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-628; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 633
+   tag = 1962; reference = 1868;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-629; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 634
+   tag = 1962; reference = 1869;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-630; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 635
+   tag = 1962; reference = 1870;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-631; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 636
+   tag = 1962; reference = 1871;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-632; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 637
+   tag = 1962; reference = 1872;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-633; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 638
+   tag = 1962; reference = 1873;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-634; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 639
+   tag = 1962; reference = 1874;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-635; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 640
+   tag = 1962; reference = 1875;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-636; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 641
+   tag = 1962; reference = 1876;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-637; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 642
+   tag = 1962; reference = 1877;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-638; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 643
+   tag = 1962; reference = 1878;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-639; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 644
+   tag = 1962; reference = 1879;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-640; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 645
+   tag = 1962; reference = 1880;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-641; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 646
+   tag = 1962; reference = 1881;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-642; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 647
+   tag = 1962; reference = 1882;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-643; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 648
+   tag = 1962; reference = 1883;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-644; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 649
+   tag = 1962; reference = 1884;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-645; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 650
+   tag = 1962; reference = 1885;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-646; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 651
+   tag = 1962; reference = 1886;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-647; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 652
+   tag = 1962; reference = 1887;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-648; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 653
+   tag = 1962; reference = 1888;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-649; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 654
+   tag = 1962; reference = 1889;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-650; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 655
+   tag = 1962; reference = 1890;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-651; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 656
+   tag = 1962; reference = 1891;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-652; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 657
+   tag = 1962; reference = 1892;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-653; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 658
+   tag = 1962; reference = 1893;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-654; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 659
+   tag = 1962; reference = 1894;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-655; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 660
+   tag = 1962; reference = 1895;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-656; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 661
+   tag = 1962; reference = 1896;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-657; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 662
+   tag = 1962; reference = 1897;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-658; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 663
+   tag = 1962; reference = 1898;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-659; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 664
+   tag = 1962; reference = 1899;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-660; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 665
+   tag = 1962; reference = 1900;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-661; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 666
+   tag = 1962; reference = 1901;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-662; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 667
+   tag = 1962; reference = 1902;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-663; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 668
+   tag = 1962; reference = 1903;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-664; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 669
+   tag = 1962; reference = 1904;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-665; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 670
+   tag = 1962; reference = 1905;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-666; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 671
+   tag = 1962; reference = 1906;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-667; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 672
+   tag = 1962; reference = 1907;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-668; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 673
+   tag = 1962; reference = 1908;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-669; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 674
+   tag = 1962; reference = 1909;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-670; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 675
+   tag = 1962; reference = 1910;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-671; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 676
+   tag = 1962; reference = 1911;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-672; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 677
+   tag = 1962; reference = 1912;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-673; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 678
+   tag = 1962; reference = 1913;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-674; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 679
+   tag = 1962; reference = 1914;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-675; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 680
+   tag = 1962; reference = 1915;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-676; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 681
+   tag = 1962; reference = 1916;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-677; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 682
+   tag = 1962; reference = 1917;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-678; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 683
+   tag = 1962; reference = 1918;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-679; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 684
+   tag = 1962; reference = 1919;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-680; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 685
+   tag = 1962; reference = 1920;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-681; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 686
+   tag = 1962; reference = 1921;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-682; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 687
+   tag = 1962; reference = 1922;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-683; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 688
+   tag = 1962; reference = 1923;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-684; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 689
+   tag = 1962; reference = 1924;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-685; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 690
+   tag = 1962; reference = 1925;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-686; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 691
+   tag = 1962; reference = 1926;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-687; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 692
+   tag = 1962; reference = 1927;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-688; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 693
+   tag = 1962; reference = 1928;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-689; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 694
+   tag = 1962; reference = 1929;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-690; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 695
+   tag = 1962; reference = 1930;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-691; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 696
+   tag = 1962; reference = 1931;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-692; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 697
+   tag = 1962; reference = 1932;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-693; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 698
+   tag = 1962; reference = 1933;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-694; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 699
+   tag = 1962; reference = 1934;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-695; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 700
+   tag = 1962; reference = 1935;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-696; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 701
+   tag = 1962; reference = 1936;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-697; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 702
+   tag = 1962; reference = 1937;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-698; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 703
+   tag = 1962; reference = 1938;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-699; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 704
+   tag = 1962; reference = 1939;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-700; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 705
+   tag = 1962; reference = 1940;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-701; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 706
+   tag = 1962; reference = 1941;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-702; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 707
+   tag = 1962; reference = 1942;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-703; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 708
+   tag = 1962; reference = 1943;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-704; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 709
+   tag = 1962; reference = 1944;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-705; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 710
+   tag = 1962; reference = 1945;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-706; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 711
+   tag = 1962; reference = 1946;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-707; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 712
+   tag = 1962; reference = 1947;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-708; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 713
+   tag = 1962; reference = 1948;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-709; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 714
+   tag = 1962; reference = 1949;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-710; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 715
+   tag = 1962; reference = 1950;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-711; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 716
+   tag = 1962; reference = 1951;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-712; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 717
+   tag = 1962; reference = 1952;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-713; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 718
+   tag = 1962; reference = 1953;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-714; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 719
+   tag = 1962; reference = 1954;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-715; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 720
+   tag = 1962; reference = 1955;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-716; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 721
+   tag = 1962; reference = 1956;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-717; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 722
+   tag = 1962; reference = 1957;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-718; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 723
+   tag = 1962; reference = 1958;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-719; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 724
+   tag = 1962; reference = 1959;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-720; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 725
+   tag = 1962; reference = 1960;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-721; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 726
+   tag = 1962; reference = 1961;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-722; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 727
+   tag = 1962; reference = 1962;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-723; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 728
+   tag = 1962; reference = 1963;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-724; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 729
+   tag = 1962; reference = 1964;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-725; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 730
+   tag = 1962; reference = 1965;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-726; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 731
+   tag = 1962; reference = 1966;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-727; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 732
+   tag = 1962; reference = 1967;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-728; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 733
+   tag = 1962; reference = 1968;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-729; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 734
+   tag = 1962; reference = 1969;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-730; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 735
+   tag = 1962; reference = 1970;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-731; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 736
+   tag = 1962; reference = 1971;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-732; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 737
+   tag = 1962; reference = 1972;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-733; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 738
+   tag = 1962; reference = 1973;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-734; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 739
+   tag = 1962; reference = 1974;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-735; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 740
+   tag = 1962; reference = 1975;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-736; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 741
+   tag = 1962; reference = 1976;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-737; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 742
+   tag = 1962; reference = 1977;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-738; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 743
+   tag = 1962; reference = 1978;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-739; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 744
+   tag = 1962; reference = 1979;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-740; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 745
+   tag = 1962; reference = 1980;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-741; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 746
+   tag = 1962; reference = 1981;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-742; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 747
+   tag = 1962; reference = 1982;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-743; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 748
+   tag = 1962; reference = 1983;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-744; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 749
+   tag = 1962; reference = 1984;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-745; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 750
+   tag = 1962; reference = 1985;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-746; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 751
+   tag = 1962; reference = 1986;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-747; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 752
+   tag = 1962; reference = 1987;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-748; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 753
+   tag = 1962; reference = 1988;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-749; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 754
+   tag = 1962; reference = 1989;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-750; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 755
+   tag = 1962; reference = 1990;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-751; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 756
+   tag = 1962; reference = 1991;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-752; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 757
+   tag = 1962; reference = 1992;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-753; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 758
+   tag = 1962; reference = 1993;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-754; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 759
+   tag = 1962; reference = 1994;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-755; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 760
+   tag = 1962; reference = 1995;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-756; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 761
+   tag = 1962; reference = 1996;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-757; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 762
+   tag = 1962; reference = 1997;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-758; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 763
+   tag = 1962; reference = 1998;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-759; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 764
+   tag = 1962; reference = 1999;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-760; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 765
+   tag = 1962; reference = 2000;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-761; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 766
+   tag = 1962; reference = 2001;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-762; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 767
+   tag = 1962; reference = 2002;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-763; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 768
+   tag = 1962; reference = 2003;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-764; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 769
+   tag = 1962; reference = 2004;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-765; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 770
+   tag = 1962; reference = 2005;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-766; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 771
+   tag = 1962; reference = 2006;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-767; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 772
+   tag = 1962; reference = 2007;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-768; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 773
+   tag = 1962; reference = 2008;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-769; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 774
+   tag = 1962; reference = 2009;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-770; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 775
+   tag = 1962; reference = 2010;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-771; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 776
+   tag = 1962; reference = 2011;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-772; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 777
+   tag = 1962; reference = 2012;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-773; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 778
+   tag = 1962; reference = 2013;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-774; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 779
+   tag = 1962; reference = 2014;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-775; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 780
+   tag = 1962; reference = 2015;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-776; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 781
+   tag = 1962; reference = 2016;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-777; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 782
+   tag = 1962; reference = 2017;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-778; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 783
+   tag = 1962; reference = 2018;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-779; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 784
+   tag = 1962; reference = 2019;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-780; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 785
+   tag = 1962; reference = 2020;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-781; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 786
+   tag = 1962; reference = 2021;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-782; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 787
+   tag = 1962; reference = 2022;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-783; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 788
+   tag = 1962; reference = 2023;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-784; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 789
+   tag = 1962; reference = 2024;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-785; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 790
+   tag = 1962; reference = 2025;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-786; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 791
+   tag = 1962; reference = 2026;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-787; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 792
+   tag = 1962; reference = 2027;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-788; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 793
+   tag = 1962; reference = 2028;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-789; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 794
+   tag = 1962; reference = 2029;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-790; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 795
+   tag = 1962; reference = 2030;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-791; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 796
+   tag = 1962; reference = 2031;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-792; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 797
+   tag = 1962; reference = 2032;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-793; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 798
+   tag = 1962; reference = 2033;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-794; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 799
+   tag = 1962; reference = 2034;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-795; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 800
+   tag = 1962; reference = 2035;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-796; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 801
+   tag = 1962; reference = 2036;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-797; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 802
+   tag = 1962; reference = 2037;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-798; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 803
+   tag = 1962; reference = 2038;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-799; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 804
+   tag = 1962; reference = 2039;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-800; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 805
+   tag = 1962; reference = 2040;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-801; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 806
+   tag = 1962; reference = 2041;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-802; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 807
+   tag = 1962; reference = 2042;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-803; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 808
+   tag = 1962; reference = 2043;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-804; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 809
+   tag = 1962; reference = 2044;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-805; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 810
+   tag = 1962; reference = 2045;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-806; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 811
+   tag = 1962; reference = 2046;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-807; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 812
+   tag = 1962; reference = 2047;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-808; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 813
+   tag = 1962; reference = 2048;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-809; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 814
+   tag = 1962; reference = 2049;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-810; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 815
+   tag = 1962; reference = 2050;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-811; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 816
+   tag = 1962; reference = 2051;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-812; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 817
+   tag = 1962; reference = 2052;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-813; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 818
+   tag = 1962; reference = 2053;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-814; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 819
+   tag = 1962; reference = 2054;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-815; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 820
+   tag = 1962; reference = 2055;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-816; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 821
+   tag = 1962; reference = 2056;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-817; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 822
+   tag = 1962; reference = 2057;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-818; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 823
+   tag = 1962; reference = 2058;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-819; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 824
+   tag = 1962; reference = 2059;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-820; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 825
+   tag = 1962; reference = 2060;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-821; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 826
+   tag = 1962; reference = 2061;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-822; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 827
+   tag = 1962; reference = 2062;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-823; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 828
+   tag = 1962; reference = 2063;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-824; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 829
+   tag = 1962; reference = 2064;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-825; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 830
+   tag = 1962; reference = 2065;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-826; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 831
+   tag = 1962; reference = 2066;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-827; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 832
+   tag = 1962; reference = 2067;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-828; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 833
+   tag = 1962; reference = 2068;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-829; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 834
+   tag = 1962; reference = 2069;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-830; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 835
+   tag = 1962; reference = 2070;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-831; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 836
+   tag = 1962; reference = 2071;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-832; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 837
+   tag = 1962; reference = 2072;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-833; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 838
+   tag = 1962; reference = 2073;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-834; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 839
+   tag = 1962; reference = 2074;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-835; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 840
+   tag = 1962; reference = 2075;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-836; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 841
+   tag = 1962; reference = 2076;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-837; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 842
+   tag = 1962; reference = 2077;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-838; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 843
+   tag = 1962; reference = 2078;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-839; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 844
+   tag = 1962; reference = 2079;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-840; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 845
+   tag = 1962; reference = 2080;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-841; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 846
+   tag = 1962; reference = 2081;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-842; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 847
+   tag = 1962; reference = 2082;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-843; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 848
+   tag = 1962; reference = 2083;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-844; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 849
+   tag = 1962; reference = 2084;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-845; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 850
+   tag = 1962; reference = 2085;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-846; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 851
+   tag = 1962; reference = 2086;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-847; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 852
+   tag = 1962; reference = 2087;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-848; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 853
+   tag = 1962; reference = 2088;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-849; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 854
+   tag = 1962; reference = 2089;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-850; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 855
+   tag = 1962; reference = 2090;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-851; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 856
+   tag = 1962; reference = 2091;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-852; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 857
+   tag = 1962; reference = 2092;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-853; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 858
+   tag = 1962; reference = 2093;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-854; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 859
+   tag = 1962; reference = 2094;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-855; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 860
+   tag = 1962; reference = 2095;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-856; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 861
+   tag = 1962; reference = 2096;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-857; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 862
+   tag = 1962; reference = 2097;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-858; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 863
+   tag = 1962; reference = 2098;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-859; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 864
+   tag = 1962; reference = 2099;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-860; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 865
+   tag = 1962; reference = 2100;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-861; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 866
+   tag = 1962; reference = 2101;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-862; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 867
+   tag = 1962; reference = 2102;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-863; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 868
+   tag = 1962; reference = 2103;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-864; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 869
+   tag = 1962; reference = 2104;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-865; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 870
+   tag = 1962; reference = 2105;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-866; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 871
+   tag = 1962; reference = 2106;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-867; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 872
+   tag = 1962; reference = 2107;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-868; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 873
+   tag = 1962; reference = 2108;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-869; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 874
+   tag = 1962; reference = 2109;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-870; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 875
+   tag = 1962; reference = 2110;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-871; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 876
+   tag = 1962; reference = 2111;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-872; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 877
+   tag = 1962; reference = 2112;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-873; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 878
+   tag = 1962; reference = 2113;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-874; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 879
+   tag = 1962; reference = 2114;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-875; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 880
+   tag = 1962; reference = 2115;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-876; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 881
+   tag = 1962; reference = 2116;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-877; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 882
+   tag = 1962; reference = 2117;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-878; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 883
+   tag = 1962; reference = 2118;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-879; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 884
+   tag = 1962; reference = 2119;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-880; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 885
+   tag = 1962; reference = 2120;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-881; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 886
+   tag = 1962; reference = 2121;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-882; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 887
+   tag = 1962; reference = 2122;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-883; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 888
+   tag = 1962; reference = 2123;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-884; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 889
+   tag = 1962; reference = 2124;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-885; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 890
+   tag = 1962; reference = 2125;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-886; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 891
+   tag = 1962; reference = 2126;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-887; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 892
+   tag = 1962; reference = 2127;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-888; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 893
+   tag = 1962; reference = 2128;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-889; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 894
+   tag = 1962; reference = 2129;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-890; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 895
+   tag = 1962; reference = 2130;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-891; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 896
+   tag = 1962; reference = 2131;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-892; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 897
+   tag = 1962; reference = 2132;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-893; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 898
+   tag = 1962; reference = 2133;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-894; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 899
+   tag = 1962; reference = 2134;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-895; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 900
+   tag = 1962; reference = 2135;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-896; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 901
+   tag = 1962; reference = 2136;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-897; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 902
+   tag = 1962; reference = 2137;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-898; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 903
+   tag = 1962; reference = 2138;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-899; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 904
+   tag = 1962; reference = 2139;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-900; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 905
+   tag = 1962; reference = 2140;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-901; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 906
+   tag = 1962; reference = 2141;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-902; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 907
+   tag = 1962; reference = 2142;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-903; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 908
+   tag = 1962; reference = 2143;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-904; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 909
+   tag = 1962; reference = 2144;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-905; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 910
+   tag = 1962; reference = 2145;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-906; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 911
+   tag = 1962; reference = 2146;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-907; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 912
+   tag = 1962; reference = 2147;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-908; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 913
+   tag = 1962; reference = 2148;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-909; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 914
+   tag = 1962; reference = 2149;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-910; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 915
+   tag = 1962; reference = 2150;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-911; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 916
+   tag = 1962; reference = 2151;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-912; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 917
+   tag = 1962; reference = 2152;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-913; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 918
+   tag = 1962; reference = 2153;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-914; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 919
+   tag = 1962; reference = 2154;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-915; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 920
+   tag = 1962; reference = 2155;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-916; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 921
+   tag = 1962; reference = 2156;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-917; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 922
+   tag = 1962; reference = 2157;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-918; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 923
+   tag = 1962; reference = 2158;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-919; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 924
+   tag = 1962; reference = 2159;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-920; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 925
+   tag = 1962; reference = 2160;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-921; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 926
+   tag = 1962; reference = 2161;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-922; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 927
+   tag = 1962; reference = 2162;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-923; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 928
+   tag = 1962; reference = 2163;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-924; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 929
+   tag = 1962; reference = 2164;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-925; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 930
+   tag = 1962; reference = 2165;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-926; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 931
+   tag = 1962; reference = 2166;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-927; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 932
+   tag = 1962; reference = 2167;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-928; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 933
+   tag = 1962; reference = 2168;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-929; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 934
+   tag = 1962; reference = 2169;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-930; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 935
+   tag = 1962; reference = 2170;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-931; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 936
+   tag = 1962; reference = 2171;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-932; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 937
+   tag = 1962; reference = 2172;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-933; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 938
+   tag = 1962; reference = 2173;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-934; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 939
+   tag = 1962; reference = 2174;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-935; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 940
+   tag = 1962; reference = 2175;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-936; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 941
+   tag = 1962; reference = 2176;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-937; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 942
+   tag = 1962; reference = 2177;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-938; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 943
+   tag = 1962; reference = 2178;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-939; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 944
+   tag = 1962; reference = 2179;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-940; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 945
+   tag = 1962; reference = 2180;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-941; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 946
+   tag = 1962; reference = 2181;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-942; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 947
+   tag = 1962; reference = 2182;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-943; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 948
+   tag = 1962; reference = 2183;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-944; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 949
+   tag = 1962; reference = 2184;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-945; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 950
+   tag = 1962; reference = 2185;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-946; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 951
+   tag = 1962; reference = 2186;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-947; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 952
+   tag = 1962; reference = 2187;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-948; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 953
+   tag = 1962; reference = 2188;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-949; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 954
+   tag = 1962; reference = 2189;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-950; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 955
+   tag = 1962; reference = 2190;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-951; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 956
+   tag = 1962; reference = 2191;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-952; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 957
+   tag = 1962; reference = 2192;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-953; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 958
+   tag = 1962; reference = 2193;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-954; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 959
+   tag = 1962; reference = 2194;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-955; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 960
+   tag = 1962; reference = 2195;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-956; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 961
+   tag = 1962; reference = 2196;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-957; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 962
+   tag = 1962; reference = 2197;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-958; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 963
+   tag = 1962; reference = 2198;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-959; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 964
+   tag = 1962; reference = 2199;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-960; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 965
+   tag = 1962; reference = 2200;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-961; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 966
+   tag = 1962; reference = 2201;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-962; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 967
+   tag = 1962; reference = 2202;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-963; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 968
+   tag = 1962; reference = 2203;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-964; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 969
+   tag = 1962; reference = 2204;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-965; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 970
+   tag = 1962; reference = 2205;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-966; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 971
+   tag = 1962; reference = 2206;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-967; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 972
+   tag = 1962; reference = 2207;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-968; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 973
+   tag = 1962; reference = 2208;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-969; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 974
+   tag = 1962; reference = 2209;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-970; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 975
+   tag = 1962; reference = 2210;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-971; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 976
+   tag = 1962; reference = 2211;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-972; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 977
+   tag = 1962; reference = 2212;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-973; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 978
+   tag = 1962; reference = 2213;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-974; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 979
+   tag = 1962; reference = 2214;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-975; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 980
+   tag = 1962; reference = 2215;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-976; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 981
+   tag = 1962; reference = 2216;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-977; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 982
+   tag = 1962; reference = 2217;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-978; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 983
+   tag = 1962; reference = 2218;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-979; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 984
+   tag = 1962; reference = 2219;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-980; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 985
+   tag = 1962; reference = 2220;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-981; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 986
+   tag = 1962; reference = 2221;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-982; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 987
+   tag = 1962; reference = 2222;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-983; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 988
+   tag = 1962; reference = 2223;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-984; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 989
+   tag = 1962; reference = 2224;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-985; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 990
+   tag = 1962; reference = 2225;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-986; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 991
+   tag = 1962; reference = 2226;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-987; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 992
+   tag = 1962; reference = 2227;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-988; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 993
+   tag = 1962; reference = 2228;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-989; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 994
+   tag = 1962; reference = 2229;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-990; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 995
+   tag = 1962; reference = 2230;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-991; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 996
+   tag = 1962; reference = 2231;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-992; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 997
+   tag = 1962; reference = 2232;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-993; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 998
+   tag = 1962; reference = 2233;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-994; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 999
+   tag = 1962; reference = 2234;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-995; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 1000
+   tag = 1962; reference = 2235;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-996; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 1001
+   tag = 1962; reference = 2236;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-997; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 1002
+   tag = 1962; reference = 2237;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-998; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 1003
+   tag = 1962; reference = 2238;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-999; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-10.out b/mfhdf/dumper/testfiles/dumpvd-10.out
new file mode 100644
index 0000000..4fcd19d
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-10.out
@@ -0,0 +1,234 @@
+File name: tvattr.hdf 
+
+Vdata: 0
+   tag = 1962; reference = 4;
+   number of records = 3; interlace = FULL_INTERLACE (0);
+   fields = [fldname1, fldname2];
+   record size (in bytes) = 2;
+   name = vsname1; class = <Undefined>;
+   number of attributes = 2 
+    attr0: name=attname3 type=4 count=3 size=3
+	m N p 
+    attr1: name=attname4 type=5 count=1 size=4
+	32.000999 
+- field index 0: [fldname1], type=4, order=1
+   number of attributes = 3 
+    attr0: name=attname4 type=5 count=1 size=4
+	32.000999 
+    attr1: name=attname5 type=6 count=1 size=8
+	-64.123450 
+    attr2: name=vsname1 type=6 count=1 size=8
+	64.123450 
+- field index 1: [fldname2], type=4, order=1
+   number of attributes = 1 
+    attr0: name=attname5 type=5 count=1 size=4
+	32.000999 
+Loc.     Data
+0        A  B  ; C  D  ; E  F  ; 
+
+
+Vdata: 1
+   tag = 1962; reference = 5;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 8;
+   name = attname1; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=25, order=2
+   number of attributes = 0 
+Loc.     Data
+0        10032 10064  ; 
+
+Vdata: 2
+   tag = 1962; reference = 6;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname2; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=23, order=2
+   number of attributes = 0 
+Loc.     Data
+0        16 32  ; 
+
+Vdata: 3
+   tag = 1962; reference = 7;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 3;
+   name = attname3; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=4, order=3
+   number of attributes = 0 
+Loc.     Data
+0        m N p  ; 
+
+Vdata: 4
+   tag = 1962; reference = 8;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname4; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        32.000999  ; 
+
+Vdata: 5
+   tag = 1962; reference = 9;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname5; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        32.000999  ; 
+
+Vdata: 6
+   tag = 1962; reference = 10;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname4; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        32.000999  ; 
+
+Vdata: 7
+   tag = 1962; reference = 11;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 8;
+   name = attname5; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=6, order=1
+   number of attributes = 0 
+Loc.     Data
+0        -64.123450  ; 
+
+Vdata: 8
+   tag = 1962; reference = 12;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 8;
+   name = vsname1; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=6, order=1
+   number of attributes = 0 
+Loc.     Data
+0        64.123450  ; 
+
+Vdata: 9
+   tag = 1962; reference = 13;
+   number of records = 3; interlace = FULL_INTERLACE (0);
+   fields = [fldname0, fldname1];
+   record size (in bytes) = 8;
+   name = vsname0; class = vsclass0;
+   number of attributes = 1 
+    attr0: name=attname7 type=4 count=3 size=3
+	m N p 
+- field index 0: [fldname0], type=24, order=1
+   number of attributes = 3 
+    attr0: name=attname6 type=5 count=1 size=4
+	32.000999 
+    attr1: name=attname8 type=5 count=1 size=4
+	32.000999 
+    attr2: name=attname9 type=4 count=5 size=5
+	m N p S t 
+- field index 1: [fldname1], type=24, order=1
+   number of attributes = 1 
+    attr0: name=attname8 type=5 count=1 size=4
+	-34.001999 
+Loc.     Data
+0        0  -1  ; 10  11  ; 20  21  ; 
+
+
+Vdata: 10
+   tag = 1962; reference = 14;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname6; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        32.000999  ; 
+
+Vdata: 11
+   tag = 1962; reference = 15;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 3;
+   name = attname7; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=4, order=3
+   number of attributes = 0 
+Loc.     Data
+0        m N p  ; 
+
+Vdata: 12
+   tag = 1962; reference = 16;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname8; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        32.000999  ; 
+
+Vdata: 13
+   tag = 1962; reference = 17;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname8; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        -34.001999  ; 
+
+Vdata: 14
+   tag = 1962; reference = 18;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 5;
+   name = attname9; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=4, order=5
+   number of attributes = 0 
+Loc.     Data
+0        m N p S t  ; 
+
+Vdata: 15
+   tag = 1962; reference = 20;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname9; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=25, order=1
+   number of attributes = 0 
+Loc.     Data
+0        100  ; 
+
+Vdata: 16
+   tag = 1962; reference = 21;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 4;
+   name = attname10; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=23, order=2
+   number of attributes = 0 
+Loc.     Data
+0        16 32  ; 
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-11.out b/mfhdf/dumper/testfiles/dumpvd-11.out
new file mode 100644
index 0000000..0894773
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-11.out
@@ -0,0 +1,11 @@
+File name: sds1_dim1_samename.hdf 
+
+Vdata: 2
+   tag = 1962; reference = 7;
+   number of records = 0; interlace = FULL_INTERLACE (0);
+   fields = [SDS variable];
+   record size (in bytes) = 4;
+   name = <Undefined>;  class = SDSVar;
+   number of attributes = 0 
+   No data written
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-12.out b/mfhdf/dumper/testfiles/dumpvd-12.out
new file mode 100644
index 0000000..6acda29
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-12.out
@@ -0,0 +1,11 @@
+File name: sds1_dim1_samename.hdf 
+
+Vdata: 4
+   tag = 1962; reference = 11;
+   number of records = 0; interlace = FULL_INTERLACE (0);
+   fields = [Coordinate variable];
+   record size (in bytes) = 4;
+   name = <Undefined>;  class = CoordVar;
+   number of attributes = 0 
+   No data written
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-13.out b/mfhdf/dumper/testfiles/dumpvd-13.out
new file mode 100644
index 0000000..cf68013
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-13.out
@@ -0,0 +1,20 @@
+File name: vslongname.hdf 
+
+Vdata: 0
+   tag = 1962; reference = 2;
+   number of records = 0; interlace = FULL_INTERLACE (0);
+   fields = [field 1];
+   record size (in bytes) = 4;
+   name = Vdata 1 91123456789212345678931234567894123456789512345678961234; class = Long Name Vdatas789212345678931234567894123456789512345678961234;
+   number of attributes = 0 
+   No data written
+
+Vdata: 1
+   tag = 1962; reference = 3;
+   number of records = 0; interlace = FULL_INTERLACE (0);
+   fields = [field 1];
+   record size (in bytes) = 4;
+   name = Vdata 2 91123456789212345678931234567894123456789512345678961234; class = Long Name Vdatas789212345678931234567894123456789512345678961234;
+   number of attributes = 0 
+   No data written
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-14.out b/mfhdf/dumper/testfiles/dumpvd-14.out
new file mode 100644
index 0000000..ae98d69
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-14.out
@@ -0,0 +1,50 @@
+File name: Tables.hdf 
+
+Vdata: 0
+   tag = 1962; reference = 2;
+   number of records = 5; interlace = FULL_INTERLACE (0);
+   fields = [Column A, Column B, Column C, Column D];
+   record size (in bytes) = 13;
+   name = Table AR with Attributes in External File; class = Multi-Type, Multi-Entries per Cell, Store By Row in External Fil;
+   number of attributes = 1 
+    attr0: name=HDF4 Attribute Table Eight type=4 count=2 size=2
+	h i 
+- field index 0: [Column A], type=4, order=2
+   number of attributes = 0 
+- field index 1: [Column B], type=23, order=1
+   number of attributes = 0 
+- field index 2: [Column C], type=16389, order=2
+   number of attributes = 1 
+    attr0: name=HDF4 Attribute Column C type=4 count=3 size=3
+	b y e 
+- field index 3: [Column D], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        A B  1  0.010000 0.100000  a  ; B C  2  0.020000 0.200000  b  ; 
+2        C D  3  0.030000 0.300000  c  ; D E  4  0.040000 0.400000  d  ; 
+4        E F  5  0.050000 0.500000  e  ; 
+
+Vdata: 1
+   tag = 1962; reference = 3;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 2;
+   name = HDF4 Attribute Table Eight; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=4, order=2
+   number of attributes = 0 
+Loc.     Data
+0        h i  ; 
+
+Vdata: 2
+   tag = 1962; reference = 4;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [VALUES];
+   record size (in bytes) = 3;
+   name = HDF4 Attribute Column C; class = Attr0.0;
+   number of attributes = 0 
+- field index 0: [VALUES], type=4, order=3
+   number of attributes = 0 
+Loc.     Data
+0        b y e  ; 
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-2.out b/mfhdf/dumper/testfiles/dumpvd-2.out
new file mode 100644
index 0000000..9b97ef9
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-2.out
@@ -0,0 +1,72 @@
+File name: tvset.hdf 
+
+Vdata: 1
+   tag = 1962; reference = 1236;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [DIFFERENT_FIELD_NAME];
+   record size (in bytes) = 8;
+   name = Integer Vdata; class = Test object;
+   number of attributes = 0 
+- field index 0: [DIFFERENT_FIELD_NAME], type=24, order=2
+   number of attributes = 0 
+Loc.     Data
+00       0 1  ; 2 3  ; 4 5  ; 6 7  ; 
+04       8 9  ; 10 11  ; 12 13  ; 14 15  ; 
+08       16 17  ; 18 19  ; 20 21  ; 22 23  ; 
+12       24 25  ; 26 27  ; 28 29  ; 30 31  ; 
+16       32 33  ; 34 35  ; 36 37  ; 38 39  ; 
+20       40 41  ; 42 43  ; 44 45  ; 46 47  ; 
+24       48 49  ; 50 51  ; 52 53  ; 54 55  ; 
+28       56 57  ; 58 59  ; 60 61  ; 62 63  ; 
+32       64 65  ; 66 67  ; 68 69  ; 70 71  ; 
+36       72 73  ; 74 75  ; 76 77  ; 78 79  ; 
+40       80 81  ; 82 83  ; 84 85  ; 86 87  ; 
+44       88 89  ; 90 91  ; 92 93  ; 94 95  ; 
+48       96 97  ; 98 99  ; 100 101  ; 102 103  ; 
+52       104 105  ; 106 107  ; 108 109  ; 110 111  ; 
+56       112 113  ; 114 115  ; 116 117  ; 118 119  ; 
+60       120 121  ; 122 123  ; 124 125  ; 126 127  ; 
+64       128 129  ; 130 131  ; 132 133  ; 134 135  ; 
+68       136 137  ; 138 139  ; 140 141  ; 142 143  ; 
+72       144 145  ; 146 147  ; 148 149  ; 150 151  ; 
+76       152 153  ; 154 155  ; 156 157  ; 158 159  ; 
+80       160 161  ; 162 163  ; 164 165  ; 166 167  ; 
+84       168 169  ; 170 171  ; 172 173  ; 174 175  ; 
+88       176 177  ; 178 179  ; 180 181  ; 182 183  ; 
+92       184 185  ; 186 187  ; 188 189  ; 190 191  ; 
+96       192 193  ; 194 195  ; 196 197  ; 198 199  ; 
+
+
+Vdata: 3
+   tag = 1962; reference = 1238;
+   number of records = 10; interlace = FULL_INTERLACE (0);
+   fields = [STATION_NAME, VALUES, FLOATS];
+   record size (in bytes) = 18;
+   name = Multi-Order Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [STATION_NAME], type=4, order=2
+   number of attributes = 0 
+- field index 1: [VALUES], type=24, order=3
+   number of attributes = 0 
+- field index 2: [FLOATS], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        a b  0 1 2  15.500000  ; c d  3 4 5  16.000000  ; 
+2        e f  6 7 8  16.500000  ; g h  9 10 11  17.000000  ; 
+4        i j  12 13 14  17.500000  ; k l  15 16 17  18.000000  ; 
+6        m n  18 19 20  18.500000  ; o p  21 22 23  19.000000  ; 
+8        q r  24 25 26  19.500000  ; s t  27 28 29  20.000000  ; 
+
+
+Vdata: 5
+   tag = 1962; reference = 1240;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-1; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-3.out b/mfhdf/dumper/testfiles/dumpvd-3.out
new file mode 100644
index 0000000..915b13e
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-3.out
@@ -0,0 +1,59 @@
+File name: tvset.hdf 
+
+Vdata: 3
+   tag = 1962; reference = 1238;
+   number of records = 10; interlace = FULL_INTERLACE (0);
+   fields = [STATION_NAME, VALUES, FLOATS];
+   record size (in bytes) = 18;
+   name = Multi-Order Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [STATION_NAME], type=4, order=2
+   number of attributes = 0 
+- field index 1: [VALUES], type=24, order=3
+   number of attributes = 0 
+- field index 2: [FLOATS], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        a b  0 1 2  15.500000  ; c d  3 4 5  16.000000  ; 
+2        e f  6 7 8  16.500000  ; g h  9 10 11  17.000000  ; 
+4        i j  12 13 14  17.500000  ; k l  15 16 17  18.000000  ; 
+6        m n  18 19 20  18.500000  ; o p  21 22 23  19.000000  ; 
+8        q r  24 25 26  19.500000  ; s t  27 28 29  20.000000  ; 
+
+
+Vdata: 4
+   tag = 1962; reference = 1239;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-0; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 16
+   tag = 1962; reference = 1251;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-12; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
+Vdata: 17
+   tag = 1962; reference = 1252;
+   number of records = 1; interlace = FULL_INTERLACE (0);
+   fields = [A];
+   record size (in bytes) = 1;
+   name = VdataLoop-13; class = <Undefined>;
+   number of attributes = 0 
+- field index 0: [A], type=4, order=1
+   number of attributes = 0 
+Loc.     Data
+0        V  ; 
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-4.out b/mfhdf/dumper/testfiles/dumpvd-4.out
new file mode 100644
index 0000000..be0b0fd
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-4.out
@@ -0,0 +1,23 @@
+File name: tvset.hdf 
+
+Vdata: 3
+   tag = 1962; reference = 1238;
+   number of records = 10; interlace = FULL_INTERLACE (0);
+   fields = [STATION_NAME, VALUES, FLOATS];
+   record size (in bytes) = 18;
+   name = Multi-Order Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [STATION_NAME], type=4, order=2
+   number of attributes = 0 
+- field index 1: [VALUES], type=24, order=3
+   number of attributes = 0 
+- field index 2: [FLOATS], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        a b  0 1 2  15.500000  ; c d  3 4 5  16.000000  ; 
+2        e f  6 7 8  16.500000  ; g h  9 10 11  17.000000  ; 
+4        i j  12 13 14  17.500000  ; k l  15 16 17  18.000000  ; 
+6        m n  18 19 20  18.500000  ; o p  21 22 23  19.000000  ; 
+8        q r  24 25 26  19.500000  ; s t  27 28 29  20.000000  ; 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-5.out b/mfhdf/dumper/testfiles/dumpvd-5.out
new file mode 100644
index 0000000..3126b35
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-5.out
@@ -0,0 +1,86 @@
+File name: tvset.hdf 
+
+Vdata: 1
+   tag = 1962; reference = 1236;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [DIFFERENT_FIELD_NAME];
+   record size (in bytes) = 8;
+   name = Integer Vdata; class = Test object;
+   number of attributes = 0 
+- field index 0: [DIFFERENT_FIELD_NAME], type=24, order=2
+   number of attributes = 0 
+Loc.     Data
+00       0 1  ; 2 3  ; 4 5  ; 6 7  ; 
+04       8 9  ; 10 11  ; 12 13  ; 14 15  ; 
+08       16 17  ; 18 19  ; 20 21  ; 22 23  ; 
+12       24 25  ; 26 27  ; 28 29  ; 30 31  ; 
+16       32 33  ; 34 35  ; 36 37  ; 38 39  ; 
+20       40 41  ; 42 43  ; 44 45  ; 46 47  ; 
+24       48 49  ; 50 51  ; 52 53  ; 54 55  ; 
+28       56 57  ; 58 59  ; 60 61  ; 62 63  ; 
+32       64 65  ; 66 67  ; 68 69  ; 70 71  ; 
+36       72 73  ; 74 75  ; 76 77  ; 78 79  ; 
+40       80 81  ; 82 83  ; 84 85  ; 86 87  ; 
+44       88 89  ; 90 91  ; 92 93  ; 94 95  ; 
+48       96 97  ; 98 99  ; 100 101  ; 102 103  ; 
+52       104 105  ; 106 107  ; 108 109  ; 110 111  ; 
+56       112 113  ; 114 115  ; 116 117  ; 118 119  ; 
+60       120 121  ; 122 123  ; 124 125  ; 126 127  ; 
+64       128 129  ; 130 131  ; 132 133  ; 134 135  ; 
+68       136 137  ; 138 139  ; 140 141  ; 142 143  ; 
+72       144 145  ; 146 147  ; 148 149  ; 150 151  ; 
+76       152 153  ; 154 155  ; 156 157  ; 158 159  ; 
+80       160 161  ; 162 163  ; 164 165  ; 166 167  ; 
+84       168 169  ; 170 171  ; 172 173  ; 174 175  ; 
+88       176 177  ; 178 179  ; 180 181  ; 182 183  ; 
+92       184 185  ; 186 187  ; 188 189  ; 190 191  ; 
+96       192 193  ; 194 195  ; 196 197  ; 198 199  ; 
+
+
+Vdata: 2
+   tag = 1962; reference = 1237;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [A, B];
+   record size (in bytes) = 8;
+   name = Mixed Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [A], type=5, order=1
+   number of attributes = 0 
+- field index 1: [B], type=24, order=1
+   number of attributes = 0 
+Loc.     Data
+00       0.000000  0  ; 2.000000  1  ; 4.000000  2  ; 
+03       6.000000  3  ; 8.000000  4  ; 10.000000  5  ; 
+06       12.000000  6  ; 14.000000  7  ; 16.000000  8  ; 
+09       18.000000  9  ; 20.000000  10  ; 22.000000  11  ; 
+12       24.000000  12  ; 26.000000  13  ; 28.000000  14  ; 
+15       30.000000  15  ; 32.000000  16  ; 34.000000  17  ; 
+18       36.000000  18  ; 38.000000  19  ; 40.000000  20  ; 
+21       42.000000  21  ; 44.000000  22  ; 46.000000  23  ; 
+24       48.000000  24  ; 50.000000  25  ; 52.000000  26  ; 
+27       54.000000  27  ; 56.000000  28  ; 58.000000  29  ; 
+30       60.000000  30  ; 62.000000  31  ; 64.000000  32  ; 
+33       66.000000  33  ; 68.000000  34  ; 70.000000  35  ; 
+36       72.000000  36  ; 74.000000  37  ; 76.000000  38  ; 
+39       78.000000  39  ; 80.000000  40  ; 82.000000  41  ; 
+42       84.000000  42  ; 86.000000  43  ; 88.000000  44  ; 
+45       90.000000  45  ; 92.000000  46  ; 94.000000  47  ; 
+48       96.000000  48  ; 98.000000  49  ; 100.000000  50  ; 
+51       102.000000  51  ; 104.000000  52  ; 106.000000  53  ; 
+54       108.000000  54  ; 110.000000  55  ; 112.000000  56  ; 
+57       114.000000  57  ; 116.000000  58  ; 118.000000  59  ; 
+60       120.000000  60  ; 122.000000  61  ; 124.000000  62  ; 
+63       126.000000  63  ; 128.000000  64  ; 130.000000  65  ; 
+66       132.000000  66  ; 134.000000  67  ; 136.000000  68  ; 
+69       138.000000  69  ; 140.000000  70  ; 142.000000  71  ; 
+72       144.000000  72  ; 146.000000  73  ; 148.000000  74  ; 
+75       150.000000  75  ; 152.000000  76  ; 154.000000  77  ; 
+78       156.000000  78  ; 158.000000  79  ; 160.000000  80  ; 
+81       162.000000  81  ; 164.000000  82  ; 166.000000  83  ; 
+84       168.000000  84  ; 170.000000  85  ; 172.000000  86  ; 
+87       174.000000  87  ; 176.000000  88  ; 178.000000  89  ; 
+90       180.000000  90  ; 182.000000  91  ; 184.000000  92  ; 
+93       186.000000  93  ; 188.000000  94  ; 190.000000  95  ; 
+96       192.000000  96  ; 194.000000  97  ; 196.000000  98  ; 
+99       198.000000  99  ; 
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-6.out b/mfhdf/dumper/testfiles/dumpvd-6.out
new file mode 100644
index 0000000..37523dc
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-6.out
@@ -0,0 +1,144 @@
+File name: tvset.hdf 
+
+Vdata: 0
+   tag = 1962; reference = 1235;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [FIELD_name_HERE];
+   record size (in bytes) = 4;
+   name = Float Vdata; class = Test object;
+   number of attributes = 0 
+- field index 0: [FIELD_name_HERE], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+00       0.000000  ; 1.000000  ; 2.000000  ; 3.000000  ; 
+04       4.000000  ; 5.000000  ; 6.000000  ; 7.000000  ; 
+08       8.000000  ; 9.000000  ; 10.000000  ; 11.000000  ; 
+12       12.000000  ; 13.000000  ; 14.000000  ; 15.000000  ; 
+16       16.000000  ; 17.000000  ; 18.000000  ; 19.000000  ; 
+20       20.000000  ; 21.000000  ; 22.000000  ; 23.000000  ; 
+24       24.000000  ; 25.000000  ; 26.000000  ; 27.000000  ; 
+28       28.000000  ; 29.000000  ; 30.000000  ; 31.000000  ; 
+32       32.000000  ; 33.000000  ; 34.000000  ; 35.000000  ; 
+36       36.000000  ; 37.000000  ; 38.000000  ; 39.000000  ; 
+40       40.000000  ; 41.000000  ; 42.000000  ; 43.000000  ; 
+44       44.000000  ; 45.000000  ; 46.000000  ; 47.000000  ; 
+48       48.000000  ; 49.000000  ; 50.000000  ; 51.000000  ; 
+52       52.000000  ; 53.000000  ; 54.000000  ; 55.000000  ; 
+56       56.000000  ; 57.000000  ; 58.000000  ; 59.000000  ; 
+60       60.000000  ; 61.000000  ; 62.000000  ; 63.000000  ; 
+64       64.000000  ; 65.000000  ; 66.000000  ; 67.000000  ; 
+68       68.000000  ; 69.000000  ; 70.000000  ; 71.000000  ; 
+72       72.000000  ; 73.000000  ; 74.000000  ; 75.000000  ; 
+76       76.000000  ; 77.000000  ; 78.000000  ; 79.000000  ; 
+80       80.000000  ; 81.000000  ; 82.000000  ; 83.000000  ; 
+84       84.000000  ; 85.000000  ; 86.000000  ; 87.000000  ; 
+88       88.000000  ; 89.000000  ; 90.000000  ; 91.000000  ; 
+92       92.000000  ; 93.000000  ; 94.000000  ; 95.000000  ; 
+96       96.000000  ; 97.000000  ; 98.000000  ; 99.000000  ; 
+
+
+Vdata: 1
+   tag = 1962; reference = 1236;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [DIFFERENT_FIELD_NAME];
+   record size (in bytes) = 8;
+   name = Integer Vdata; class = Test object;
+   number of attributes = 0 
+- field index 0: [DIFFERENT_FIELD_NAME], type=24, order=2
+   number of attributes = 0 
+Loc.     Data
+00       0 1  ; 2 3  ; 4 5  ; 6 7  ; 
+04       8 9  ; 10 11  ; 12 13  ; 14 15  ; 
+08       16 17  ; 18 19  ; 20 21  ; 22 23  ; 
+12       24 25  ; 26 27  ; 28 29  ; 30 31  ; 
+16       32 33  ; 34 35  ; 36 37  ; 38 39  ; 
+20       40 41  ; 42 43  ; 44 45  ; 46 47  ; 
+24       48 49  ; 50 51  ; 52 53  ; 54 55  ; 
+28       56 57  ; 58 59  ; 60 61  ; 62 63  ; 
+32       64 65  ; 66 67  ; 68 69  ; 70 71  ; 
+36       72 73  ; 74 75  ; 76 77  ; 78 79  ; 
+40       80 81  ; 82 83  ; 84 85  ; 86 87  ; 
+44       88 89  ; 90 91  ; 92 93  ; 94 95  ; 
+48       96 97  ; 98 99  ; 100 101  ; 102 103  ; 
+52       104 105  ; 106 107  ; 108 109  ; 110 111  ; 
+56       112 113  ; 114 115  ; 116 117  ; 118 119  ; 
+60       120 121  ; 122 123  ; 124 125  ; 126 127  ; 
+64       128 129  ; 130 131  ; 132 133  ; 134 135  ; 
+68       136 137  ; 138 139  ; 140 141  ; 142 143  ; 
+72       144 145  ; 146 147  ; 148 149  ; 150 151  ; 
+76       152 153  ; 154 155  ; 156 157  ; 158 159  ; 
+80       160 161  ; 162 163  ; 164 165  ; 166 167  ; 
+84       168 169  ; 170 171  ; 172 173  ; 174 175  ; 
+88       176 177  ; 178 179  ; 180 181  ; 182 183  ; 
+92       184 185  ; 186 187  ; 188 189  ; 190 191  ; 
+96       192 193  ; 194 195  ; 196 197  ; 198 199  ; 
+
+
+Vdata: 2
+   tag = 1962; reference = 1237;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [A, B];
+   record size (in bytes) = 8;
+   name = Mixed Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [A], type=5, order=1
+   number of attributes = 0 
+- field index 1: [B], type=24, order=1
+   number of attributes = 0 
+Loc.     Data
+00       0.000000  0  ; 2.000000  1  ; 4.000000  2  ; 
+03       6.000000  3  ; 8.000000  4  ; 10.000000  5  ; 
+06       12.000000  6  ; 14.000000  7  ; 16.000000  8  ; 
+09       18.000000  9  ; 20.000000  10  ; 22.000000  11  ; 
+12       24.000000  12  ; 26.000000  13  ; 28.000000  14  ; 
+15       30.000000  15  ; 32.000000  16  ; 34.000000  17  ; 
+18       36.000000  18  ; 38.000000  19  ; 40.000000  20  ; 
+21       42.000000  21  ; 44.000000  22  ; 46.000000  23  ; 
+24       48.000000  24  ; 50.000000  25  ; 52.000000  26  ; 
+27       54.000000  27  ; 56.000000  28  ; 58.000000  29  ; 
+30       60.000000  30  ; 62.000000  31  ; 64.000000  32  ; 
+33       66.000000  33  ; 68.000000  34  ; 70.000000  35  ; 
+36       72.000000  36  ; 74.000000  37  ; 76.000000  38  ; 
+39       78.000000  39  ; 80.000000  40  ; 82.000000  41  ; 
+42       84.000000  42  ; 86.000000  43  ; 88.000000  44  ; 
+45       90.000000  45  ; 92.000000  46  ; 94.000000  47  ; 
+48       96.000000  48  ; 98.000000  49  ; 100.000000  50  ; 
+51       102.000000  51  ; 104.000000  52  ; 106.000000  53  ; 
+54       108.000000  54  ; 110.000000  55  ; 112.000000  56  ; 
+57       114.000000  57  ; 116.000000  58  ; 118.000000  59  ; 
+60       120.000000  60  ; 122.000000  61  ; 124.000000  62  ; 
+63       126.000000  63  ; 128.000000  64  ; 130.000000  65  ; 
+66       132.000000  66  ; 134.000000  67  ; 136.000000  68  ; 
+69       138.000000  69  ; 140.000000  70  ; 142.000000  71  ; 
+72       144.000000  72  ; 146.000000  73  ; 148.000000  74  ; 
+75       150.000000  75  ; 152.000000  76  ; 154.000000  77  ; 
+78       156.000000  78  ; 158.000000  79  ; 160.000000  80  ; 
+81       162.000000  81  ; 164.000000  82  ; 166.000000  83  ; 
+84       168.000000  84  ; 170.000000  85  ; 172.000000  86  ; 
+87       174.000000  87  ; 176.000000  88  ; 178.000000  89  ; 
+90       180.000000  90  ; 182.000000  91  ; 184.000000  92  ; 
+93       186.000000  93  ; 188.000000  94  ; 190.000000  95  ; 
+96       192.000000  96  ; 194.000000  97  ; 196.000000  98  ; 
+99       198.000000  99  ; 
+
+Vdata: 3
+   tag = 1962; reference = 1238;
+   number of records = 10; interlace = FULL_INTERLACE (0);
+   fields = [STATION_NAME, VALUES, FLOATS];
+   record size (in bytes) = 18;
+   name = Multi-Order Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [STATION_NAME], type=4, order=2
+   number of attributes = 0 
+- field index 1: [VALUES], type=24, order=3
+   number of attributes = 0 
+- field index 2: [FLOATS], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        a b  0 1 2  15.500000  ; c d  3 4 5  16.000000  ; 
+2        e f  6 7 8  16.500000  ; g h  9 10 11  17.000000  ; 
+4        i j  12 13 14  17.500000  ; k l  15 16 17  18.000000  ; 
+6        m n  18 19 20  18.500000  ; o p  21 22 23  19.000000  ; 
+8        q r  24 25 26  19.500000  ; s t  27 28 29  20.000000  ; 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-7.out b/mfhdf/dumper/testfiles/dumpvd-7.out
new file mode 100644
index 0000000..e54c930
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-7.out
@@ -0,0 +1,40 @@
+File name: tvset.hdf 
+
+Vdata: 2
+   tag = 1962; reference = 1237;
+   number of records = 100; interlace = FULL_INTERLACE (0);
+   fields = [A, B];
+   record size (in bytes) = 8;
+   name = Mixed Vdata; class = No class specified;
+   number of attributes = 0 
+   number of attributes = 0 
+- field index 1: [B], type=24, order=1
+   number of attributes = 0 
+Loc.     Data
+00       0  ; 1  ; 2  ; 3  ; 
+04       4  ; 5  ; 6  ; 7  ; 
+08       8  ; 9  ; 10  ; 11  ; 
+12       12  ; 13  ; 14  ; 15  ; 
+16       16  ; 17  ; 18  ; 19  ; 
+20       20  ; 21  ; 22  ; 23  ; 
+24       24  ; 25  ; 26  ; 27  ; 
+28       28  ; 29  ; 30  ; 31  ; 
+32       32  ; 33  ; 34  ; 35  ; 
+36       36  ; 37  ; 38  ; 39  ; 
+40       40  ; 41  ; 42  ; 43  ; 
+44       44  ; 45  ; 46  ; 47  ; 
+48       48  ; 49  ; 50  ; 51  ; 
+52       52  ; 53  ; 54  ; 55  ; 
+56       56  ; 57  ; 58  ; 59  ; 
+60       60  ; 61  ; 62  ; 63  ; 
+64       64  ; 65  ; 66  ; 67  ; 
+68       68  ; 69  ; 70  ; 71  ; 
+72       72  ; 73  ; 74  ; 75  ; 
+76       76  ; 77  ; 78  ; 79  ; 
+80       80  ; 81  ; 82  ; 83  ; 
+84       84  ; 85  ; 86  ; 87  ; 
+88       88  ; 89  ; 90  ; 91  ; 
+92       92  ; 93  ; 94  ; 95  ; 
+96       96  ; 97  ; 98  ; 99  ; 
+
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-8.out b/mfhdf/dumper/testfiles/dumpvd-8.out
new file mode 100644
index 0000000..f28bb7c
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-8.out
@@ -0,0 +1,20 @@
+File name: tvset.hdf 
+
+Vdata: 3
+   tag = 1962; reference = 1238;
+   number of records = 10; interlace = FULL_INTERLACE (0);
+   fields = [STATION_NAME, VALUES, FLOATS];
+   record size (in bytes) = 18;
+   name = Multi-Order Vdata; class = No class specified;
+   number of attributes = 0 
+- field index 0: [STATION_NAME], type=4, order=2
+   number of attributes = 0 
+   number of attributes = 0 
+- field index 2: [FLOATS], type=5, order=1
+   number of attributes = 0 
+Loc.     Data
+0        a b  15.500000  ; c d  16.000000  ; e f  16.500000  ; 
+3        g h  17.000000  ; i j  17.500000  ; k l  18.000000  ; 
+6        m n  18.500000  ; o p  19.000000  ; q r  19.500000  ; 
+9        s t  20.000000  ; 
+
diff --git a/mfhdf/dumper/testfiles/dumpvd-9.out b/mfhdf/dumper/testfiles/dumpvd-9.out
new file mode 100644
index 0000000..ed45631
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvd-9.out
@@ -0,0 +1,12 @@
+a b  15.500000   
+c d  16.000000   
+e f  16.500000   
+g h  17.000000   
+i j  17.500000   
+k l  18.000000   
+m n  18.500000   
+o p  19.000000   
+q r  19.500000   
+s t  20.000000   
+
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-1.out b/mfhdf/dumper/testfiles/dumpvg-1.out
new file mode 100644
index 0000000..945391a
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-1.out
@@ -0,0 +1,38 @@
+File name: tvset.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 2;
+     name = Simple Vgroup; class = Test object;
+     number of entries = 0;
+   number of attributes = 0 
+Entries:-
+     None.
+
+
+Vgroup:1
+     tag = 1965; reference = 3;
+     name = Second Vgroup; class = Test object;
+     number of entries = 3;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 2;
+	number of entries = 0;
+	name = Simple Vgroup; class = Test object
+   number of attributes = 0 
+     #1 (Unknown Tag)
+	tag = 1000; reference = 12345;
+     #2 (Unknown Tag)
+	tag = 123; reference = 1234;
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 
+
+   vg1 	-- vg0 
+	-- Unknown Object  
+	-- Unknown Object  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-10.out b/mfhdf/dumper/testfiles/dumpvg-10.out
new file mode 100644
index 0000000..8016f52
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-10.out
@@ -0,0 +1,68 @@
+File name: tdata.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 28;
+     name = nsamp; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+
+
+Vgroup:1
+     tag = 1965; reference = 30;
+     name = bands; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+
+
+Vgroup:3
+     tag = 1965; reference = 34;
+     name = a; class = Var0.0;
+     number of entries = 7;
+   number of attributes = 0 
+
+
+Vgroup:4
+     tag = 1965; reference = 36;
+     name = b; class = Var0.0;
+     number of entries = 6;
+   number of attributes = 0 
+
+
+Vgroup:5
+     tag = 1965; reference = 38;
+     name = c; class = Var0.0;
+     number of entries = 5;
+   number of attributes = 0 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- vd  
+
+   vg1 	-- vd  
+
+   vg2 	-- vd  
+
+   vg3 	-- vg2 	-- vd  
+	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg4 	-- vg2 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg5 	-- vg2 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-11.out b/mfhdf/dumper/testfiles/dumpvg-11.out
new file mode 100644
index 0000000..5152dd3
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-11.out
@@ -0,0 +1,59 @@
+File name: tvattr.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 2;
+     name = vgname0; class = <Undefined>;
+     number of entries = 0;
+   number of attributes = 2 
+    attr0: name=attname1 type=25 count=2 size=8
+	10032 10064 
+    attr1: name=attname2 type=23 count=2 size=4
+	16 32 
+Entries:-
+     None.
+
+
+Vgroup:1
+     tag = 1965; reference = 3;
+     name = vgname1; class = <Undefined>;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 4; 
+	number of records = 3; interlace = 0;
+	fields = [fldname1, fldname2];
+	record size (in bytes) = 2;
+	name = vsname1; class = <Undefined>;
+	total number of attributes = 6.
+
+
+Vgroup:2
+     tag = 1965; reference = 19;
+     name = vgname2; class = vgclass2;
+     number of entries = 1;
+   number of attributes = 2 
+    attr0: name=attname9 type=25 count=1 size=4
+	100 
+    attr1: name=attname10 type=23 count=2 size=4
+	16 32 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 13; 
+	number of records = 3; interlace = 0;
+	fields = [fldname0, fldname1];
+	record size (in bytes) = 8;
+	name = vsname0; class = vsclass0;
+	total number of attributes = 5.
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 
+
+   vg1 	-- vd  
+
+   vg2 	-- vd  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-12.out b/mfhdf/dumper/testfiles/dumpvg-12.out
new file mode 100644
index 0000000..8b78c49
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-12.out
@@ -0,0 +1,83 @@
+File name: VGlongname.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 3;
+     name = SD Vgroup - this vgroup has an sds as a member and it is actually meant to test long vgroup name; class = Common Vgroups;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Numeric Data Group)
+	tag = 720; reference = 2;
+
+
+Vgroup:1
+     tag = 1965; reference = 5;
+     name = fakeDim0; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 4; 
+	number of records = 1; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = fakeDim0; class = DimVal0.1;
+	total number of attributes = 0.
+
+
+Vgroup:2
+     tag = 1965; reference = 7;
+     name = SDS belongs to VG_LONGNAME, which has a very long name that is used to test the new feature of variable length vgroup name; class = Var0.0;
+     number of entries = 4;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 5;
+	number of entries = 1;
+	name = fakeDim0; class = Dim0.0
+   number of attributes = 0 
+     #1 (Number type)
+	tag = 106; reference = 6;
+     #2 (SciData dimension record)
+	tag = 701; reference = 6;
+     #3 (Numeric Data Group)
+	tag = 720; reference = 2;
+
+
+Vgroup:3
+     tag = 1965; reference = 8;
+     name = VGlongname.hdf; class = CDF0.0;
+     number of entries = 2;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 5;
+	number of entries = 1;
+	name = fakeDim0; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 7;
+	number of entries = 4;
+	name = SDS belongs to VG_LONGNAME, which has a very long name that is used to test the new feature of variable length vgroup name; class = Var0.0
+   number of attributes = 0 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- Numeric Data Group  
+
+   vg1 	-- vd  
+
+   vg2 	-- vg1 	-- vd  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg3 	-- vg1 	-- vd  
+	-- vg2 	-- vg1 	-- vd  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-13.out b/mfhdf/dumper/testfiles/dumpvg-13.out
new file mode 100644
index 0000000..7feedc0
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-13.out
@@ -0,0 +1,18 @@
+File name: VGlongname.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 3;
+     name = SD Vgroup - this vgroup has an sds as a member and it is actually meant to test long vgroup name; class = Common Vgroups;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Numeric Data Group)
+	tag = 720; reference = 2;
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- Numeric Data Group  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-14.out b/mfhdf/dumper/testfiles/dumpvg-14.out
new file mode 100644
index 0000000..aec280a
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-14.out
@@ -0,0 +1,138 @@
+File name: sds1_dim1_samename.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 5;
+     name = Variable 1; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 4; 
+	number of records = 1; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = Variable 1; class = DimVal0.1;
+	total number of attributes = 0.
+
+
+Vgroup:1
+     tag = 1965; reference = 9;
+     name = Variable 1; class = Var0.0;
+     number of entries = 6;
+   number of attributes = 1 
+    attr0: name=Attribute SDS 1 type=4 count=23 size=23
+	T h i s   i s   n o t   a   c o o r d   v a r 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 5;
+	number of entries = 1;
+	name = Variable 1; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vdata)
+	tag = 1962; reference = 6; 
+	number of records = 1; interlace = 0;
+	fields = [VALUES];
+	record size (in bytes) = 23;
+	name = Attribute SDS 1; class = Attr0.0;
+	total number of attributes = 0.
+     #2 (Vdata)
+	tag = 1962; reference = 7; 
+	number of records = 0; interlace = 0;
+	fields = [SDS variable];
+	record size (in bytes) = 4;
+	name = <Undefined>; class = SDSVar;
+	total number of attributes = 0.
+     #3 (Number type)
+	tag = 106; reference = 8;
+     #4 (SciData dimension record)
+	tag = 701; reference = 8;
+     #5 (Numeric Data Group)
+	tag = 720; reference = 2;
+
+
+Vgroup:2
+     tag = 1965; reference = 13;
+     name = Variable 1; class = Var0.0;
+     number of entries = 6;
+   number of attributes = 1 
+    attr0: name=Attribute Dimension 1 type=4 count=19 size=19
+	T h i s   i s   a   c o o r d   v a r 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 5;
+	number of entries = 1;
+	name = Variable 1; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vdata)
+	tag = 1962; reference = 10; 
+	number of records = 1; interlace = 0;
+	fields = [VALUES];
+	record size (in bytes) = 19;
+	name = Attribute Dimension 1; class = Attr0.0;
+	total number of attributes = 0.
+     #2 (Vdata)
+	tag = 1962; reference = 11; 
+	number of records = 0; interlace = 0;
+	fields = [Coordinate variable];
+	record size (in bytes) = 4;
+	name = <Undefined>; class = CoordVar;
+	total number of attributes = 0.
+     #3 (Number type)
+	tag = 106; reference = 12;
+     #4 (SciData dimension record)
+	tag = 701; reference = 12;
+     #5 (Numeric Data Group)
+	tag = 720; reference = 3;
+
+
+Vgroup:3
+     tag = 1965; reference = 14;
+     name = sds1_dim1_samename.hdf; class = CDF0.0;
+     number of entries = 3;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 5;
+	number of entries = 1;
+	name = Variable 1; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 9;
+	number of entries = 6;
+	name = Variable 1; class = Var0.0
+   number of attributes = 1 
+    attr0: name=Attribute SDS 1 type=4 count=23 size=23
+	T h i s   i s   n o t   a   c o o r d   v a r 
+     #2 (Vgroup)
+	tag = 1965; reference = 13;
+	number of entries = 6;
+	name = Variable 1; class = Var0.0
+   number of attributes = 1 
+    attr0: name=Attribute Dimension 1 type=4 count=19 size=19
+	T h i s   i s   a   c o o r d   v a r 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- vd  
+
+   vg1 	-- vg0 	-- vd  
+	-- vd  
+	-- vd  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg2 	-- vg0 	-- vd  
+	-- vd  
+	-- vd  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg3 	-- vg0 	-- vd  
+	-- vg0 	-- vd  
+	-- vg0 	-- vd  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-15.out b/mfhdf/dumper/testfiles/dumpvg-15.out
new file mode 100644
index 0000000..47060cc
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-15.out
@@ -0,0 +1,214 @@
+File name: sds2_dim1_samename.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 8;
+     name = Variable 2; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 7; 
+	number of records = 1; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = Variable 2; class = DimVal0.1;
+	total number of attributes = 0.
+
+
+Vgroup:1
+     tag = 1965; reference = 10;
+     name = fakeDim1; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 9; 
+	number of records = 1; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = fakeDim1; class = DimVal0.1;
+	total number of attributes = 0.
+
+
+Vgroup:2
+     tag = 1965; reference = 12;
+     name = fakeDim2; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 11; 
+	number of records = 1; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = fakeDim2; class = DimVal0.1;
+	total number of attributes = 0.
+
+
+Vgroup:3
+     tag = 1965; reference = 15;
+     name = Variable 1; class = Var0.0;
+     number of entries = 5;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 8;
+	number of entries = 1;
+	name = Variable 2; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vdata)
+	tag = 1962; reference = 13; 
+	number of records = 0; interlace = 0;
+	fields = [SDS variable];
+	record size (in bytes) = 4;
+	name = <Undefined>; class = SDSVar;
+	total number of attributes = 0.
+     #2 (Number type)
+	tag = 106; reference = 14;
+     #3 (SciData dimension record)
+	tag = 701; reference = 14;
+     #4 (Numeric Data Group)
+	tag = 720; reference = 2;
+
+
+Vgroup:4
+     tag = 1965; reference = 18;
+     name = Variable 2; class = Var0.0;
+     number of entries = 7;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 10;
+	number of entries = 1;
+	name = fakeDim1; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 12;
+	number of entries = 1;
+	name = fakeDim2; class = Dim0.0
+   number of attributes = 0 
+     #2 (Vdata)
+	tag = 1962; reference = 16; 
+	number of records = 0; interlace = 0;
+	fields = [SDS variable];
+	record size (in bytes) = 4;
+	name = <Undefined>; class = SDSVar;
+	total number of attributes = 0.
+     #3 (Scientific Data)
+	tag = 702; reference = 4;
+     #4 (Number type)
+	tag = 106; reference = 17;
+     #5 (SciData dimension record)
+	tag = 701; reference = 17;
+     #6 (Numeric Data Group)
+	tag = 720; reference = 3;
+
+
+Vgroup:5
+     tag = 1965; reference = 21;
+     name = Variable 2; class = Var0.0;
+     number of entries = 6;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 8;
+	number of entries = 1;
+	name = Variable 2; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vdata)
+	tag = 1962; reference = 19; 
+	number of records = 0; interlace = 0;
+	fields = [Coordinate variable];
+	record size (in bytes) = 4;
+	name = <Undefined>; class = CoordVar;
+	total number of attributes = 0.
+     #2 (Scientific Data)
+	tag = 702; reference = 6;
+     #3 (Number type)
+	tag = 106; reference = 20;
+     #4 (SciData dimension record)
+	tag = 701; reference = 20;
+     #5 (Numeric Data Group)
+	tag = 720; reference = 5;
+
+
+Vgroup:6
+     tag = 1965; reference = 22;
+     name = sds2_dim1_samename.hdf; class = CDF0.0;
+     number of entries = 6;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 8;
+	number of entries = 1;
+	name = Variable 2; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 10;
+	number of entries = 1;
+	name = fakeDim1; class = Dim0.0
+   number of attributes = 0 
+     #2 (Vgroup)
+	tag = 1965; reference = 12;
+	number of entries = 1;
+	name = fakeDim2; class = Dim0.0
+   number of attributes = 0 
+     #3 (Vgroup)
+	tag = 1965; reference = 15;
+	number of entries = 5;
+	name = Variable 1; class = Var0.0
+   number of attributes = 0 
+     #4 (Vgroup)
+	tag = 1965; reference = 18;
+	number of entries = 7;
+	name = Variable 2; class = Var0.0
+   number of attributes = 0 
+     #5 (Vgroup)
+	tag = 1965; reference = 21;
+	number of entries = 6;
+	name = Variable 2; class = Var0.0
+   number of attributes = 0 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- vd  
+
+   vg1 	-- vd  
+
+   vg2 	-- vd  
+
+   vg3 	-- vg0 	-- vd  
+	-- vd  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg4 	-- vg1 	-- vd  
+	-- vg2 	-- vd  
+	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg5 	-- vg0 	-- vd  
+	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg6 	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- vg2 	-- vd  
+	-- vg3 	-- vg0 	-- vd  
+		-- vd  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+	-- vg0 	-- vd  
+	-- vg0 	-- vd  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-16.out b/mfhdf/dumper/testfiles/dumpvg-16.out
new file mode 100644
index 0000000..93d3220
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-16.out
@@ -0,0 +1,42 @@
+File name: grtdfi322.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 5;
+     name = Image_array_5; class = RI0.0;
+     number of entries = 2;
+   number of attributes = 0 
+
+
+Vgroup:1
+     tag = 1965; reference = 6;
+     name = RIG0.0; class = <Undefined>;
+     number of entries = 4;
+   number of attributes = 0 
+
+
+Vgroup:2
+     tag = 1965; reference = 7;
+     name = Raster Image #0; class = RI0.0;
+     number of entries = 3;
+   number of attributes = 0 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- Image Dimensions  
+	-- Raster Image Data  
+
+   vg1 	-- vg2 	-- Image Dimensions  
+		-- Raster Image Data  
+		-- vd  
+	-- <vg/ref=0>  
+	-- vg0 	-- Image Dimensions  
+		-- Raster Image Data  
+	-- vd  
+
+   vg2 	-- Image Dimensions  
+	-- Raster Image Data  
+	-- vd  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-17.out b/mfhdf/dumper/testfiles/dumpvg-17.out
new file mode 100644
index 0000000..15652d6
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-17.out
@@ -0,0 +1,79 @@
+File name: grtdfi322.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 5;
+     name = Image_array_5; class = RI0.0;
+     number of entries = 2;
+   number of attributes = 0 
+Entries:-
+     #0 (Image Dimensions)
+	tag = 300; reference = 5;
+     #1 (Raster Image Data)
+	tag = 302; reference = 5;
+
+
+Vgroup:1
+     tag = 1965; reference = 6;
+     name = RIG0.0; class = <Undefined>;
+     number of entries = 4;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 7;
+	number of entries = 3;
+	name = Raster Image #0; class = RI0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965;reference = 0;
+     #2 (Vgroup)
+	tag = 1965; reference = 5;
+	number of entries = 2;
+	name = Image_array_5; class = RI0.0
+   number of attributes = 0 
+     #3 (Vdata)
+	tag = 1962; reference = 9; 
+	number of records = 16; interlace = 0;
+	fields = [File contents];
+	record size (in bytes) = 1;
+	name = RIATTR0.0N; class = RIATTR0.0C;
+	total number of attributes = 0.
+
+
+Vgroup:2
+     tag = 1965; reference = 7;
+     name = Raster Image #0; class = RI0.0;
+     number of entries = 3;
+   number of attributes = 0 
+Entries:-
+     #0 (Image Dimensions)
+	tag = 300; reference = 2;
+     #1 (Raster Image Data)
+	tag = 302; reference = 2;
+     #2 (Vdata)
+	tag = 1962; reference = 8; 
+	number of records = 2; interlace = 0;
+	fields = [Value range];
+	record size (in bytes) = 4;
+	name = RIATTR0.0N; class = RIATTR0.0C;
+	total number of attributes = 0.
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- Image Dimensions  
+	-- Raster Image Data  
+
+   vg1 	-- vg2 	-- Image Dimensions  
+		-- Raster Image Data  
+		-- vd  
+	-- <vg/ref=0>  
+	-- vg0 	-- Image Dimensions  
+		-- Raster Image Data  
+	-- vd  
+
+   vg2 	-- Image Dimensions  
+	-- Raster Image Data  
+	-- vd  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-2.out b/mfhdf/dumper/testfiles/dumpvg-2.out
new file mode 100644
index 0000000..945391a
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-2.out
@@ -0,0 +1,38 @@
+File name: tvset.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 2;
+     name = Simple Vgroup; class = Test object;
+     number of entries = 0;
+   number of attributes = 0 
+Entries:-
+     None.
+
+
+Vgroup:1
+     tag = 1965; reference = 3;
+     name = Second Vgroup; class = Test object;
+     number of entries = 3;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 2;
+	number of entries = 0;
+	name = Simple Vgroup; class = Test object
+   number of attributes = 0 
+     #1 (Unknown Tag)
+	tag = 1000; reference = 12345;
+     #2 (Unknown Tag)
+	tag = 123; reference = 1234;
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 
+
+   vg1 	-- vg0 
+	-- Unknown Object  
+	-- Unknown Object  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-3.out b/mfhdf/dumper/testfiles/dumpvg-3.out
new file mode 100644
index 0000000..f6ec79e
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-3.out
@@ -0,0 +1,29 @@
+File name: tvset.hdf 
+
+
+Vgroup:1
+     tag = 1965; reference = 3;
+     name = Second Vgroup; class = Test object;
+     number of entries = 3;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 2;
+	number of entries = 0;
+	name = Simple Vgroup; class = Test object
+   number of attributes = 0 
+     #1 (Unknown Tag)
+	tag = 1000; reference = 12345;
+     #2 (Unknown Tag)
+	tag = 123; reference = 1234;
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 
+
+   vg1 	-- vg0 
+	-- Unknown Object  
+	-- Unknown Object  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-4.out b/mfhdf/dumper/testfiles/dumpvg-4.out
new file mode 100644
index 0000000..2e075ec
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-4.out
@@ -0,0 +1,17 @@
+File name: tvset.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 2;
+     name = Simple Vgroup; class = Test object;
+     number of entries = 0;
+   number of attributes = 0 
+Entries:-
+     None.
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-5.out b/mfhdf/dumper/testfiles/dumpvg-5.out
new file mode 100644
index 0000000..945391a
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-5.out
@@ -0,0 +1,38 @@
+File name: tvset.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 2;
+     name = Simple Vgroup; class = Test object;
+     number of entries = 0;
+   number of attributes = 0 
+Entries:-
+     None.
+
+
+Vgroup:1
+     tag = 1965; reference = 3;
+     name = Second Vgroup; class = Test object;
+     number of entries = 3;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 2;
+	number of entries = 0;
+	name = Simple Vgroup; class = Test object
+   number of attributes = 0 
+     #1 (Unknown Tag)
+	tag = 1000; reference = 12345;
+     #2 (Unknown Tag)
+	tag = 123; reference = 1234;
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 
+
+   vg1 	-- vg0 
+	-- Unknown Object  
+	-- Unknown Object  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-6.out b/mfhdf/dumper/testfiles/dumpvg-6.out
new file mode 100644
index 0000000..2d35cae
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-6.out
@@ -0,0 +1,100 @@
+File name: tdata.hdf 
+
+
+Vgroup:1
+     tag = 1965; reference = 30;
+     name = bands; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 29; 
+	number of records = 3; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = bands; class = DimVal0.0;
+	total number of attributes = 0.
+
+
+Vgroup:3
+     tag = 1965; reference = 34;
+     name = a; class = Var0.0;
+     number of entries = 7;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 32;
+	number of entries = 1;
+	name = rec; class = UDim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 28;
+	number of entries = 1;
+	name = nsamp; class = Dim0.0
+   number of attributes = 0 
+     #2 (Vgroup)
+	tag = 1965; reference = 30;
+	number of entries = 1;
+	name = bands; class = Dim0.0
+   number of attributes = 0 
+     #3 (Scientific Data)
+	tag = 702; reference = 18;
+     #4 (Number type)
+	tag = 106; reference = 33;
+     #5 (SciData dimension record)
+	tag = 701; reference = 33;
+     #6 (Numeric Data Group)
+	tag = 720; reference = 2;
+
+
+Vgroup:5
+     tag = 1965; reference = 38;
+     name = c; class = Var0.0;
+     number of entries = 5;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 32;
+	number of entries = 1;
+	name = rec; class = UDim0.0
+   number of attributes = 0 
+     #1 (Scientific Data)
+	tag = 702; reference = 24;
+     #2 (Number type)
+	tag = 106; reference = 37;
+     #3 (SciData dimension record)
+	tag = 701; reference = 37;
+     #4 (Numeric Data Group)
+	tag = 720; reference = 4;
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- vd  
+
+   vg1 	-- vd  
+
+   vg2 	-- vd  
+
+   vg3 	-- vg2 	-- vd  
+	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg4 	-- vg2 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg5 	-- vg2 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-7.out b/mfhdf/dumper/testfiles/dumpvg-7.out
new file mode 100644
index 0000000..e1623f7
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-7.out
@@ -0,0 +1,108 @@
+File name: tdata.hdf 
+
+
+Vgroup:2
+     tag = 1965; reference = 32;
+     name = rec; class = UDim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 31; 
+	number of records = 1; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = rec; class = DimVal0.0;
+	total number of attributes = 0.
+
+
+Vgroup:6
+     tag = 1965; reference = 39;
+     name = tdata.hdf; class = CDF0.0;
+     number of entries = 6;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 28;
+	number of entries = 1;
+	name = nsamp; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 30;
+	number of entries = 1;
+	name = bands; class = Dim0.0
+   number of attributes = 0 
+     #2 (Vgroup)
+	tag = 1965; reference = 32;
+	number of entries = 1;
+	name = rec; class = UDim0.0
+   number of attributes = 0 
+     #3 (Vgroup)
+	tag = 1965; reference = 34;
+	number of entries = 7;
+	name = a; class = Var0.0
+   number of attributes = 0 
+     #4 (Vgroup)
+	tag = 1965; reference = 36;
+	number of entries = 6;
+	name = b; class = Var0.0
+   number of attributes = 0 
+     #5 (Vgroup)
+	tag = 1965; reference = 38;
+	number of entries = 5;
+	name = c; class = Var0.0
+   number of attributes = 0 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- vd  
+
+   vg1 	-- vd  
+
+   vg2 	-- vd  
+
+   vg3 	-- vg2 	-- vd  
+	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg4 	-- vg2 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg5 	-- vg2 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg6 	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- vg2 	-- vd  
+	-- vg3 	-- vg2 	-- vd  
+		-- vg0 	-- vd  
+		-- vg1 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+	-- vg4 	-- vg2 	-- vd  
+		-- vg1 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+	-- vg5 	-- vg2 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-8.out b/mfhdf/dumper/testfiles/dumpvg-8.out
new file mode 100644
index 0000000..16a8ed4
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-8.out
@@ -0,0 +1,108 @@
+File name: tdata.hdf 
+
+
+Vgroup:0
+     tag = 1965; reference = 28;
+     name = nsamp; class = Dim0.0;
+     number of entries = 1;
+   number of attributes = 0 
+Entries:-
+     #0 (Vdata)
+	tag = 1962; reference = 27; 
+	number of records = 2; interlace = 0;
+	fields = [Values];
+	record size (in bytes) = 4;
+	name = nsamp; class = DimVal0.0;
+	total number of attributes = 0.
+
+
+Vgroup:6
+     tag = 1965; reference = 39;
+     name = tdata.hdf; class = CDF0.0;
+     number of entries = 6;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 28;
+	number of entries = 1;
+	name = nsamp; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 30;
+	number of entries = 1;
+	name = bands; class = Dim0.0
+   number of attributes = 0 
+     #2 (Vgroup)
+	tag = 1965; reference = 32;
+	number of entries = 1;
+	name = rec; class = UDim0.0
+   number of attributes = 0 
+     #3 (Vgroup)
+	tag = 1965; reference = 34;
+	number of entries = 7;
+	name = a; class = Var0.0
+   number of attributes = 0 
+     #4 (Vgroup)
+	tag = 1965; reference = 36;
+	number of entries = 6;
+	name = b; class = Var0.0
+   number of attributes = 0 
+     #5 (Vgroup)
+	tag = 1965; reference = 38;
+	number of entries = 5;
+	name = c; class = Var0.0
+   number of attributes = 0 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- vd  
+
+   vg1 	-- vd  
+
+   vg2 	-- vd  
+
+   vg3 	-- vg2 	-- vd  
+	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg4 	-- vg2 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg5 	-- vg2 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg6 	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- vg2 	-- vd  
+	-- vg3 	-- vg2 	-- vd  
+		-- vg0 	-- vd  
+		-- vg1 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+	-- vg4 	-- vg2 	-- vd  
+		-- vg1 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+	-- vg5 	-- vg2 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+
diff --git a/mfhdf/dumper/testfiles/dumpvg-9.out b/mfhdf/dumper/testfiles/dumpvg-9.out
new file mode 100644
index 0000000..919d200
--- /dev/null
+++ b/mfhdf/dumper/testfiles/dumpvg-9.out
@@ -0,0 +1,93 @@
+File name: tdata.hdf 
+
+
+Vgroup:6
+     tag = 1965; reference = 39;
+     name = tdata.hdf; class = CDF0.0;
+     number of entries = 6;
+   number of attributes = 0 
+Entries:-
+     #0 (Vgroup)
+	tag = 1965; reference = 28;
+	number of entries = 1;
+	name = nsamp; class = Dim0.0
+   number of attributes = 0 
+     #1 (Vgroup)
+	tag = 1965; reference = 30;
+	number of entries = 1;
+	name = bands; class = Dim0.0
+   number of attributes = 0 
+     #2 (Vgroup)
+	tag = 1965; reference = 32;
+	number of entries = 1;
+	name = rec; class = UDim0.0
+   number of attributes = 0 
+     #3 (Vgroup)
+	tag = 1965; reference = 34;
+	number of entries = 7;
+	name = a; class = Var0.0
+   number of attributes = 0 
+     #4 (Vgroup)
+	tag = 1965; reference = 36;
+	number of entries = 6;
+	name = b; class = Var0.0
+   number of attributes = 0 
+     #5 (Vgroup)
+	tag = 1965; reference = 38;
+	number of entries = 5;
+	name = c; class = Var0.0
+   number of attributes = 0 
+
+
+Graphical representation of the file:-
+(vg#: vgroup;   vd: vdata)
+
+   vg0 	-- vd  
+
+   vg1 	-- vd  
+
+   vg2 	-- vd  
+
+   vg3 	-- vg2 	-- vd  
+	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg4 	-- vg2 	-- vd  
+	-- vg1 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg5 	-- vg2 	-- vd  
+	-- Scientific Data  
+	-- Number type  
+	-- SciData dimension record  
+	-- Numeric Data Group  
+
+   vg6 	-- vg0 	-- vd  
+	-- vg1 	-- vd  
+	-- vg2 	-- vd  
+	-- vg3 	-- vg2 	-- vd  
+		-- vg0 	-- vd  
+		-- vg1 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+	-- vg4 	-- vg2 	-- vd  
+		-- vg1 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+	-- vg5 	-- vg2 	-- vd  
+		-- Scientific Data  
+		-- Number type  
+		-- SciData dimension record  
+		-- Numeric Data Group  
+
diff --git a/mfhdf/dumper/testfiles/grtdfi322.hdf b/mfhdf/dumper/testfiles/grtdfi322.hdf
new file mode 100644
index 0000000..7d29a56
Binary files /dev/null and b/mfhdf/dumper/testfiles/grtdfi322.hdf differ
diff --git a/mfhdf/dumper/testfiles/grtdfui162.hdf b/mfhdf/dumper/testfiles/grtdfui162.hdf
new file mode 100644
index 0000000..8d80baf
Binary files /dev/null and b/mfhdf/dumper/testfiles/grtdfui162.hdf differ
diff --git a/mfhdf/dumper/testfiles/grtdfui82.hdf b/mfhdf/dumper/testfiles/grtdfui82.hdf
new file mode 100644
index 0000000..835259a
Binary files /dev/null and b/mfhdf/dumper/testfiles/grtdfui82.hdf differ
diff --git a/mfhdf/dumper/testfiles/grtdfui83.hdf b/mfhdf/dumper/testfiles/grtdfui83.hdf
new file mode 100644
index 0000000..883a904
Binary files /dev/null and b/mfhdf/dumper/testfiles/grtdfui83.hdf differ
diff --git a/mfhdf/dumper/testfiles/grtdfui84.hdf b/mfhdf/dumper/testfiles/grtdfui84.hdf
new file mode 100644
index 0000000..5f080e2
Binary files /dev/null and b/mfhdf/dumper/testfiles/grtdfui84.hdf differ
diff --git a/mfhdf/dumper/testfiles/list-1.out b/mfhdf/dumper/testfiles/list-1.out
new file mode 100644
index 0000000..28fbe3c
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-1.out
@@ -0,0 +1,21 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+Linked Blocks Indicator: (tag 20)
+	Ref nos: 18 19 20 21 22 23 24 25 26 
+Version Descriptor  : (tag 30)
+	Ref nos: 1 
+Number type         : (tag 106)
+	Ref nos: 33 35 37 
+SciData dimension record: (tag 701)
+	Ref nos: 33 35 37 
+Numeric Data Group  : (tag 720)
+	Ref nos: 2 3 4 
+Vdata               : (tag 1962)
+	Ref nos: 27 29 31 
+Vdata Storage       : (tag 1963)
+	Ref nos: 27 29 31 
+Vgroup              : (tag 1965)
+	Ref nos: 28 30 32 34 36 38 39 
+Special Scientific Data: (tag 17086)
+	Ref nos: 18 21 24 
diff --git a/mfhdf/dumper/testfiles/list-10.out b/mfhdf/dumper/testfiles/list-10.out
new file mode 100644
index 0000000..d30ad62
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-10.out
@@ -0,0 +1,54 @@
+File: Example6.hdf
+Last modified with NCSA HDF Version 4.0 Release 1, Jan. 19, 1996
+
+File Label #0: This is a file label for AN 
+File Label #1: This is a file label for AN 
+   no             tagname     tag     ref  index_by_tag
+    0  Version Descriptor      30       1           0
+    1     File Identifier     100       1           0
+    2     File Identifier     100       2           1
+    3    File Description     101       1           0
+    4    File Description     101       2           1
+    5       Data Id Label     104       1           0
+    6       Data Id Label     104       2           1
+    7       Data Id Label     104       3           2
+    8       Data Id Label     104       4           3
+    9       Data Id Label     104       5           4
+   10       Data Id Label     104       6           5
+   11  Data Id Annotation     105       1           0
+   12  Data Id Annotation     105       2           1
+   13  Data Id Annotation     105       3           2
+   14  Data Id Annotation     105       4           3
+   15         Number type     106      25           0
+   16         Number type     106      27           1
+   17SciData dimension record     701      25           0
+   18SciData dimension record     701      27           1
+   19  Numeric Data Group     720       2           0
+    Name/Label=Data label for AN 
+   20  Numeric Data Group     720      12           1
+    Name/Label=Data label for AN 
+   21               Vdata    1962      13           0
+    Name/Label=This is a data label for Vdata
+   22               Vdata    1962      14           1
+   23               Vdata    1962      16           2
+   24               Vdata    1962      17           3
+   25               Vdata    1962      19           4
+   26               Vdata    1962      20           5
+   27               Vdata    1962      22           6
+   28               Vdata    1962      23           7
+   29       Vdata Storage    1963      13           0
+   30       Vdata Storage    1963      14           1
+   31       Vdata Storage    1963      16           2
+   32       Vdata Storage    1963      17           3
+   33       Vdata Storage    1963      19           4
+   34       Vdata Storage    1963      20           5
+   35       Vdata Storage    1963      22           6
+   36       Vdata Storage    1963      23           7
+   37              Vgroup    1965      15           0
+    Name/Label=This is a data label for Vgroup
+   38              Vgroup    1965      18           1
+   39              Vgroup    1965      21           2
+   40              Vgroup    1965      24           3
+   41              Vgroup    1965      26           4
+   42              Vgroup    1965      28           5
+   43              Vgroup    1965      29           6
diff --git a/mfhdf/dumper/testfiles/list-2.out b/mfhdf/dumper/testfiles/list-2.out
new file mode 100644
index 0000000..208e105
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-2.out
@@ -0,0 +1,39 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+   no             tagname     tag     ref  index_by_tag
+    0Linked Blocks Indicator      20      18           0
+    1Linked Blocks Indicator      20      19           1
+    2Linked Blocks Indicator      20      20           2
+    3Linked Blocks Indicator      20      21           3
+    4Linked Blocks Indicator      20      22           4
+    5Linked Blocks Indicator      20      23           5
+    6Linked Blocks Indicator      20      24           6
+    7Linked Blocks Indicator      20      25           7
+    8Linked Blocks Indicator      20      26           8
+    9  Version Descriptor      30       1           0
+   10         Number type     106      33           0
+   11         Number type     106      35           1
+   12         Number type     106      37           2
+   13SciData dimension record     701      33           0
+   14SciData dimension record     701      35           1
+   15SciData dimension record     701      37           2
+   16  Numeric Data Group     720       2           0
+   17  Numeric Data Group     720       3           1
+   18  Numeric Data Group     720       4           2
+   19               Vdata    1962      27           0
+   20               Vdata    1962      29           1
+   21               Vdata    1962      31           2
+   22       Vdata Storage    1963      27           0
+   23       Vdata Storage    1963      29           1
+   24       Vdata Storage    1963      31           2
+   25              Vgroup    1965      28           0
+   26              Vgroup    1965      30           1
+   27              Vgroup    1965      32           2
+   28              Vgroup    1965      34           3
+   29              Vgroup    1965      36           4
+   30              Vgroup    1965      38           5
+   31              Vgroup    1965      39           6
+   32Special Scientific Data   17086      18           0
+   33Special Scientific Data   17086      21           1
+   34Special Scientific Data   17086      24           2
diff --git a/mfhdf/dumper/testfiles/list-3.out b/mfhdf/dumper/testfiles/list-3.out
new file mode 100644
index 0000000..739741b
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-3.out
@@ -0,0 +1,39 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+   no             tagname     tag     ref  index_by_tag      offset      length
+    0Linked Blocks Indicator      20      18           0        3054          24
+    1Linked Blocks Indicator      20      19           1        3094         258
+    2Linked Blocks Indicator      20      20           2        3402        1536
+    3Linked Blocks Indicator      20      21           3        4938          12
+    4Linked Blocks Indicator      20      22           4        4966         258
+    5Linked Blocks Indicator      20      23           5        5270         768
+    6Linked Blocks Indicator      20      24           6        6038           4
+    7Linked Blocks Indicator      20      25           7        6058         258
+    8Linked Blocks Indicator      20      26           8        6358         256
+    9  Version Descriptor      30       1           0        2410          92
+   10         Number type     106      33           0        6884           4
+   11         Number type     106      35           1        6980           4
+   12         Number type     106      37           2        7064           4
+   13SciData dimension record     701      33           0        6888          30
+   14SciData dimension record     701      35           1        6984          22
+   15SciData dimension record     701      37           2        7068          14
+   16  Numeric Data Group     720       2           0        6918          12
+   17  Numeric Data Group     720       3           1        7006          12
+   18  Numeric Data Group     720       4           2        7082          12
+   19               Vdata    1962      27           0        6622          53
+   20               Vdata    1962      29           1        6717          53
+   21               Vdata    1962      31           2        6804          51
+   22       Vdata Storage    1963      27           0        6614           8
+   23       Vdata Storage    1963      29           1        6705          12
+   24       Vdata Storage    1963      31           2        6800           4
+   25              Vgroup    1965      28           0        6675          30
+   26              Vgroup    1965      30           1        6770          30
+   27              Vgroup    1965      32           2        6855          29
+   28              Vgroup    1965      34           3        6930          50
+   29              Vgroup    1965      36           4        7018          46
+   30              Vgroup    1965      38           5        7094          42
+   31              Vgroup    1965      39           6        7136          54
+   32Special Scientific Data   17086      18           0           0         120
+   33Special Scientific Data   17086      21           1           0          60
+   34Special Scientific Data   17086      24           2           0          20
diff --git a/mfhdf/dumper/testfiles/list-4.out b/mfhdf/dumper/testfiles/list-4.out
new file mode 100644
index 0000000..2403887
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-4.out
@@ -0,0 +1,42 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+   no             tagname     tag     ref  index_by_tag
+    0Linked Blocks Indicator      20      18           0
+    1Linked Blocks Indicator      20      19           1
+    2Linked Blocks Indicator      20      20           2
+    3Linked Blocks Indicator      20      21           3
+    4Linked Blocks Indicator      20      22           4
+    5Linked Blocks Indicator      20      23           5
+    6Linked Blocks Indicator      20      24           6
+    7Linked Blocks Indicator      20      25           7
+    8Linked Blocks Indicator      20      26           8
+    9  Version Descriptor      30       1           0
+   10         Number type     106      33           0
+   11         Number type     106      35           1
+   12         Number type     106      37           2
+   13SciData dimension record     701      33           0
+   14SciData dimension record     701      35           1
+   15SciData dimension record     701      37           2
+   16  Numeric Data Group     720       2           0
+   17  Numeric Data Group     720       3           1
+   18  Numeric Data Group     720       4           2
+   19               Vdata    1962      27           0
+   20               Vdata    1962      29           1
+   21               Vdata    1962      31           2
+   22       Vdata Storage    1963      27           0
+   23       Vdata Storage    1963      29           1
+   24       Vdata Storage    1963      31           2
+   25              Vgroup    1965      28           0
+   26              Vgroup    1965      30           1
+   27              Vgroup    1965      32           2
+   28              Vgroup    1965      34           3
+   29              Vgroup    1965      36           4
+   30              Vgroup    1965      38           5
+   31              Vgroup    1965      39           6
+   32Special Scientific Data   17086      18           0
+	Linked Block: first 24 standard 1536 per unit 128
+   33Special Scientific Data   17086      21           1
+	Linked Block: first 12 standard 768 per unit 128
+   34Special Scientific Data   17086      24           2
+	Linked Block: first 4 standard 256 per unit 128
diff --git a/mfhdf/dumper/testfiles/list-5.out b/mfhdf/dumper/testfiles/list-5.out
new file mode 100644
index 0000000..19bdada
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-5.out
@@ -0,0 +1,5 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+Numeric Data Group  : (tag 720)
+	Ref nos: 2 3 4 
diff --git a/mfhdf/dumper/testfiles/list-6.out b/mfhdf/dumper/testfiles/list-6.out
new file mode 100644
index 0000000..f681ccc
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-6.out
@@ -0,0 +1,7 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+   no             tagname     tag     ref  index_by_tag      offset      length
+   16  Numeric Data Group     720       2           0        6918          12
+   17  Numeric Data Group     720       3           1        7006          12
+   18  Numeric Data Group     720       4           2        7082          12
diff --git a/mfhdf/dumper/testfiles/list-7.out b/mfhdf/dumper/testfiles/list-7.out
new file mode 100644
index 0000000..e2dc2e0
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-7.out
@@ -0,0 +1,85 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+   no             tagname     tag     ref  index_by_tag
+    0Linked Blocks Indicator      20      18           0
+    1Linked Blocks Indicator      20      19           1
+    2Linked Blocks Indicator      20      20           2
+    3Linked Blocks Indicator      20      21           3
+    4Linked Blocks Indicator      20      22           4
+    5Linked Blocks Indicator      20      23           5
+    6Linked Blocks Indicator      20      24           6
+    7Linked Blocks Indicator      20      25           7
+    8Linked Blocks Indicator      20      26           8
+    9  Version Descriptor      30       1           0
+   10         Number type     106      33           0
+   11         Number type     106      35           1
+   12         Number type     106      37           2
+   13SciData dimension record     701      33           0
+   14SciData dimension record     701      35           1
+   15SciData dimension record     701      37           2
+   16  Numeric Data Group     720       2           0
+	Contents: (3 objects)
+		Scientific Data               : (tag=   702) ref=18
+		Number type                   : (tag=   106) ref=33
+		SciData dimension record      : (tag=   701) ref=33
+   17  Numeric Data Group     720       3           1
+	Contents: (3 objects)
+		Scientific Data               : (tag=   702) ref=21
+		Number type                   : (tag=   106) ref=35
+		SciData dimension record      : (tag=   701) ref=35
+   18  Numeric Data Group     720       4           2
+	Contents: (3 objects)
+		Scientific Data               : (tag=   702) ref=24
+		Number type                   : (tag=   106) ref=37
+		SciData dimension record      : (tag=   701) ref=37
+   19               Vdata    1962      27           0
+   20               Vdata    1962      29           1
+   21               Vdata    1962      31           2
+   22       Vdata Storage    1963      27           0
+   23       Vdata Storage    1963      29           1
+   24       Vdata Storage    1963      31           2
+   25              Vgroup    1965      28           0
+	Contents: (1 objects)
+		Vdata                         : (tag=  1962) ref=27
+   26              Vgroup    1965      30           1
+	Contents: (1 objects)
+		Vdata                         : (tag=  1962) ref=29
+   27              Vgroup    1965      32           2
+	Contents: (1 objects)
+		Vdata                         : (tag=  1962) ref=31
+   28              Vgroup    1965      34           3
+	Contents: (7 objects)
+		Vgroup                        : (tag=  1965) ref=32
+		Vgroup                        : (tag=  1965) ref=28
+		Vgroup                        : (tag=  1965) ref=30
+		Scientific Data               : (tag=   702) ref=18
+		Number type                   : (tag=   106) ref=33
+		SciData dimension record      : (tag=   701) ref=33
+		Numeric Data Group            : (tag=   720) ref=2
+   29              Vgroup    1965      36           4
+	Contents: (6 objects)
+		Vgroup                        : (tag=  1965) ref=32
+		Vgroup                        : (tag=  1965) ref=30
+		Scientific Data               : (tag=   702) ref=21
+		Number type                   : (tag=   106) ref=35
+		SciData dimension record      : (tag=   701) ref=35
+		Numeric Data Group            : (tag=   720) ref=3
+   30              Vgroup    1965      38           5
+	Contents: (5 objects)
+		Vgroup                        : (tag=  1965) ref=32
+		Scientific Data               : (tag=   702) ref=24
+		Number type                   : (tag=   106) ref=37
+		SciData dimension record      : (tag=   701) ref=37
+		Numeric Data Group            : (tag=   720) ref=4
+   31              Vgroup    1965      39           6
+	Contents: (6 objects)
+		Vgroup                        : (tag=  1965) ref=28
+		Vgroup                        : (tag=  1965) ref=30
+		Vgroup                        : (tag=  1965) ref=32
+		Vgroup                        : (tag=  1965) ref=34
+		Vgroup                        : (tag=  1965) ref=36
+		Vgroup                        : (tag=  1965) ref=38
+   32Special Scientific Data   17086      18           0
+   33Special Scientific Data   17086      21           1
+   34Special Scientific Data   17086      24           2
diff --git a/mfhdf/dumper/testfiles/list-8.out b/mfhdf/dumper/testfiles/list-8.out
new file mode 100644
index 0000000..208e105
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-8.out
@@ -0,0 +1,39 @@
+File: tdata.hdf
+Last modified with NCSA HDF Version 3.3 Release 4, October 1994
+
+   no             tagname     tag     ref  index_by_tag
+    0Linked Blocks Indicator      20      18           0
+    1Linked Blocks Indicator      20      19           1
+    2Linked Blocks Indicator      20      20           2
+    3Linked Blocks Indicator      20      21           3
+    4Linked Blocks Indicator      20      22           4
+    5Linked Blocks Indicator      20      23           5
+    6Linked Blocks Indicator      20      24           6
+    7Linked Blocks Indicator      20      25           7
+    8Linked Blocks Indicator      20      26           8
+    9  Version Descriptor      30       1           0
+   10         Number type     106      33           0
+   11         Number type     106      35           1
+   12         Number type     106      37           2
+   13SciData dimension record     701      33           0
+   14SciData dimension record     701      35           1
+   15SciData dimension record     701      37           2
+   16  Numeric Data Group     720       2           0
+   17  Numeric Data Group     720       3           1
+   18  Numeric Data Group     720       4           2
+   19               Vdata    1962      27           0
+   20               Vdata    1962      29           1
+   21               Vdata    1962      31           2
+   22       Vdata Storage    1963      27           0
+   23       Vdata Storage    1963      29           1
+   24       Vdata Storage    1963      31           2
+   25              Vgroup    1965      28           0
+   26              Vgroup    1965      30           1
+   27              Vgroup    1965      32           2
+   28              Vgroup    1965      34           3
+   29              Vgroup    1965      36           4
+   30              Vgroup    1965      38           5
+   31              Vgroup    1965      39           6
+   32Special Scientific Data   17086      18           0
+   33Special Scientific Data   17086      21           1
+   34Special Scientific Data   17086      24           2
diff --git a/mfhdf/dumper/testfiles/list-9.out b/mfhdf/dumper/testfiles/list-9.out
new file mode 100644
index 0000000..8309838
--- /dev/null
+++ b/mfhdf/dumper/testfiles/list-9.out
@@ -0,0 +1,51 @@
+File: Example6.hdf
+Last modified with NCSA HDF Version 4.0 Release 1, Jan. 19, 1996
+
+File description #0: This is a file describation for AN 
+File description #1: This is a file describation for AN 
+   no             tagname     tag     ref  index_by_tag
+    0  Version Descriptor      30       1           0
+    1     File Identifier     100       1           0
+    2     File Identifier     100       2           1
+    3    File Description     101       1           0
+    4    File Description     101       2           1
+    5       Data Id Label     104       1           0
+    6       Data Id Label     104       2           1
+    7       Data Id Label     104       3           2
+    8       Data Id Label     104       4           3
+    9       Data Id Label     104       5           4
+   10       Data Id Label     104       6           5
+   11  Data Id Annotation     105       1           0
+   12  Data Id Annotation     105       2           1
+   13  Data Id Annotation     105       3           2
+   14  Data Id Annotation     105       4           3
+   15         Number type     106      25           0
+   16         Number type     106      27           1
+   17SciData dimension record     701      25           0
+   18SciData dimension record     701      27           1
+   19  Numeric Data Group     720       2           0
+   20  Numeric Data Group     720      12           1
+   21               Vdata    1962      13           0
+   Description=This is a data describation for Vdata
+   22               Vdata    1962      14           1
+   23               Vdata    1962      16           2
+   24               Vdata    1962      17           3
+   25               Vdata    1962      19           4
+   26               Vdata    1962      20           5
+   27               Vdata    1962      22           6
+   28               Vdata    1962      23           7
+   29       Vdata Storage    1963      13           0
+   30       Vdata Storage    1963      14           1
+   31       Vdata Storage    1963      16           2
+   32       Vdata Storage    1963      17           3
+   33       Vdata Storage    1963      19           4
+   34       Vdata Storage    1963      20           5
+   35       Vdata Storage    1963      22           6
+   36       Vdata Storage    1963      23           7
+   37              Vgroup    1965      15           0
+   38              Vgroup    1965      18           1
+   39              Vgroup    1965      21           2
+   40              Vgroup    1965      24           3
+   41              Vgroup    1965      26           4
+   42              Vgroup    1965      28           5
+   43              Vgroup    1965      29           6
diff --git a/mfhdf/dumper/testfiles/manySDSs.c b/mfhdf/dumper/testfiles/manySDSs.c
new file mode 100644
index 0000000..c7bfbd7
--- /dev/null
+++ b/mfhdf/dumper/testfiles/manySDSs.c
@@ -0,0 +1,72 @@
+#include "mfhdf.h"
+
+#define X_LENGTH 10
+#define Y_LENGTH 10
+#define NUM_DSETS 40
+
+main( ) 
+{
+    int32 sd_id, sds_id, istat, sds_idx;
+    int32 sds_list[NUM_DSETS];
+    int32 dims[2], start[2], edges[2], rank, num_datasets=0, num_attrs=0;
+    intn i, j, k, index;
+    intn num_errs = 0;
+    char file_attr[116] = "This file was generated by the program manySDSs.c in hdf4/mfhdf/dumper/testfiles to test the flag -k in hdp dumpsds";
+    char names[NUM_DSETS][8] = {{"data1"},{"data2"},{"data3"},{"data4"},
+	{"data5"},{"data6"},{"data7"},{"data8"},{"data9"},{"data10"},
+	{"data11"},{"data12"},{"data13"},{"data14"},{"data15"},{"data16"},
+	{"data17"},{"data18"},{"data19"},{"data20"},{"data21"},{"data22"},
+	{"data23"},{"data24"},{"data25"},{"data26"},{"data27"},{"data28"},
+	{"data29"},{"data30"},{"data31"},{"data32"},{"data33"},{"data34"},
+	{"data35"},{"data36"},{"data37"},{"data38"},{"data39"},{"data40"}};
+
+    /* Create and open the file and initiate the SD interface. */
+    sd_id = SDstart("sds_empty_many.hdf", DFACC_CREATE);
+    if (sd_id == FAIL)
+    {
+	fprintf(stderr, "manySDSs: SDstart returns sd_id: %d\n", sd_id);
+	exit(-1);
+    }
+
+    /* Add file attribute to note about the file's history */
+    istat = SDsetattr(sd_id, "file_contents", DFNT_CHAR8, 116, (VOIDP)file_attr);
+    if (istat == FAIL)
+    {
+	fprintf(stderr, "manySDSs: SDsetattr returns status: %d\n", istat);
+	exit(-1);
+    }
+ 
+    /* Define the rank and dimensions of the data set to be created. */
+    rank = 2;
+    dims[0] = SD_UNLIMITED;
+    dims[1] = X_LENGTH;
+
+    /* Define the location, pattern, and size of the data set */
+    for (i = 0; i < rank; i++)  start[i] = 0;
+
+    for (index = 0; index < NUM_DSETS; index++)
+    {
+	/* Create each data set. */
+	sds_list[index] = SDcreate(sd_id, names[index], DFNT_INT16, rank, dims);
+	if (sds_list[index] == FAIL)
+	{
+	    fprintf(stderr, "manySDSs: SDcreate returns sds_list[%d]: %d\n", index, sds_list[index]);
+	    exit(-1);
+	}
+	/* Terminate access to each data set. */
+	istat = SDendaccess(sds_list[index]);
+	if (istat == FAIL)
+	{
+	    fprintf(stderr, "manySDSs: SDendaccess returns status: %d\n", istat);
+	    exit(-1);
+	}
+    }
+
+    /* Terminate access to the SD interface and close the file. */
+    istat = SDend(sd_id);
+    if (istat == FAIL)
+    {
+	fprintf(stderr, "manySDSs: SDend returns: %d\n", istat);
+	exit(-1);
+    }
+}
diff --git a/mfhdf/dumper/testfiles/sds1_dim1_samename.hdf b/mfhdf/dumper/testfiles/sds1_dim1_samename.hdf
new file mode 100644
index 0000000..3215c37
Binary files /dev/null and b/mfhdf/dumper/testfiles/sds1_dim1_samename.hdf differ
diff --git a/mfhdf/dumper/testfiles/sds2_dim1_samename.hdf b/mfhdf/dumper/testfiles/sds2_dim1_samename.hdf
new file mode 100644
index 0000000..296a398
Binary files /dev/null and b/mfhdf/dumper/testfiles/sds2_dim1_samename.hdf differ
diff --git a/mfhdf/dumper/testfiles/sds_compressed.hdf b/mfhdf/dumper/testfiles/sds_compressed.hdf
new file mode 100644
index 0000000..6eeadb8
Binary files /dev/null and b/mfhdf/dumper/testfiles/sds_compressed.hdf differ
diff --git a/mfhdf/dumper/testfiles/sds_empty_many.hdf b/mfhdf/dumper/testfiles/sds_empty_many.hdf
new file mode 100644
index 0000000..ebd791b
Binary files /dev/null and b/mfhdf/dumper/testfiles/sds_empty_many.hdf differ
diff --git a/mfhdf/dumper/testfiles/star.hdf b/mfhdf/dumper/testfiles/star.hdf
new file mode 100644
index 0000000..1f1faf2
Binary files /dev/null and b/mfhdf/dumper/testfiles/star.hdf differ
diff --git a/mfhdf/dumper/testfiles/swf32.hdf b/mfhdf/dumper/testfiles/swf32.hdf
new file mode 100644
index 0000000..333e5e0
Binary files /dev/null and b/mfhdf/dumper/testfiles/swf32.hdf differ
diff --git a/mfhdf/dumper/testfiles/swf32_fileattr.hdf b/mfhdf/dumper/testfiles/swf32_fileattr.hdf
new file mode 100644
index 0000000..d54d47d
Binary files /dev/null and b/mfhdf/dumper/testfiles/swf32_fileattr.hdf differ
diff --git a/mfhdf/dumper/testfiles/swi16.hdf b/mfhdf/dumper/testfiles/swi16.hdf
new file mode 100644
index 0000000..7d64c83
Binary files /dev/null and b/mfhdf/dumper/testfiles/swi16.hdf differ
diff --git a/mfhdf/dumper/testfiles/swi8.hdf b/mfhdf/dumper/testfiles/swi8.hdf
new file mode 100644
index 0000000..a8c7992
Binary files /dev/null and b/mfhdf/dumper/testfiles/swi8.hdf differ
diff --git a/mfhdf/dumper/testfiles/tdata.hdf b/mfhdf/dumper/testfiles/tdata.hdf
new file mode 100644
index 0000000..8824cc5
Binary files /dev/null and b/mfhdf/dumper/testfiles/tdata.hdf differ
diff --git a/mfhdf/dumper/testfiles/tdf24.hdf b/mfhdf/dumper/testfiles/tdf24.hdf
new file mode 100644
index 0000000..a62c31c
Binary files /dev/null and b/mfhdf/dumper/testfiles/tdf24.hdf differ
diff --git a/mfhdf/dumper/testfiles/tdfr8f.hdf b/mfhdf/dumper/testfiles/tdfr8f.hdf
new file mode 100644
index 0000000..743f904
Binary files /dev/null and b/mfhdf/dumper/testfiles/tdfr8f.hdf differ
diff --git a/mfhdf/dumper/testfiles/test.hdf b/mfhdf/dumper/testfiles/test.hdf
new file mode 100644
index 0000000..adf1543
Binary files /dev/null and b/mfhdf/dumper/testfiles/test.hdf differ
diff --git a/mfhdf/dumper/testfiles/tvattr.hdf b/mfhdf/dumper/testfiles/tvattr.hdf
new file mode 100644
index 0000000..d47ea03
Binary files /dev/null and b/mfhdf/dumper/testfiles/tvattr.hdf differ
diff --git a/mfhdf/dumper/testfiles/tvset.hdf b/mfhdf/dumper/testfiles/tvset.hdf
new file mode 100644
index 0000000..0de32ef
Binary files /dev/null and b/mfhdf/dumper/testfiles/tvset.hdf differ
diff --git a/mfhdf/dumper/testfiles/vslongname.c b/mfhdf/dumper/testfiles/vslongname.c
new file mode 100644
index 0000000..0cb0858
--- /dev/null
+++ b/mfhdf/dumper/testfiles/vslongname.c
@@ -0,0 +1,86 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Creating vdatas with names and classes that are longer than 64 characters
+   to test bug HDFFR-1267. -BMR */
+
+#include "hdf.h"
+
+#define	FILENAME	"vslongname.hdf" 
+#define	VDATA1_NAME	"Vdata 1 9112345678921234567893123456789412345678951234567896123456789 72"
+#define	VDATA2_NAME	"Vdata 2 9112345678921234567893123456789412345678951234567896123456789 72"
+#define	VDATA_CLASS	"Long Name Vdatas78921234567893123456789412345678951234567896123456789 72"
+
+
+int main( )
+{
+   /************************* Variable declaration **************************/
+
+   intn  status_n;	/* returned status for functions returning an intn  */
+   int32 status_32;	/* returned status for functions returning an int32 */
+   int32 file_id, file2_id, vdata_id, vdata1_id, vdata2_id;
+   int32 vdata_ref = -1;     /* ref number of a vdata, set to -1 to create  */
+   char vsclass[100], fields[10];
+
+   /********************** End of variable declaration **********************/
+
+   /* 
+   * Create the first HDF file. 
+   */
+   file_id = Hopen (FILENAME, DFACC_CREATE, 0);
+
+   /* 
+   * Initialize the VS interface associated with the first HDF file. 
+   */
+   status_n = Vstart (file_id);
+
+   /* 
+   * Create a vdata in the first HDF file. 
+   */
+   vdata1_id = VSattach (file_id, -1, "w");
+   vdata2_id = VSattach (file_id, -1, "w");
+
+   /*
+   * Assign name and class to the vdata.
+   */
+   status_32 = VSsetname (vdata1_id, VDATA1_NAME);
+   status_32 = VSsetname (vdata2_id, VDATA2_NAME);
+
+   status_32 = VSsetclass (vdata1_id, VDATA_CLASS);
+   status_32 = VSsetclass (vdata2_id, VDATA_CLASS);
+
+   /*
+   * Add fields to the vdata.
+   */
+   status_n = VSfdefine (vdata1_id, "field 1", DFNT_FLOAT32, 1);
+   status_n = VSfdefine (vdata2_id, "field 1", DFNT_FLOAT32, 1);
+
+   status_n = VSsetfields (vdata1_id, "field 1");
+   status_n = VSsetfields (vdata2_id, "field 1");
+
+   /* 
+   * Terminate access to the vdata in the first HDF file. 
+   */
+   status_32 = VSdetach (vdata1_id);
+   status_32 = VSdetach (vdata2_id);
+
+   /* 
+   * Terminate access to the VS interface associated with the first HDF file. 
+   */
+   status_n = Vend (file_id);
+
+   /* 
+   * Close the first HDF file. 
+   */
+   status_n = Hclose (file_id);
+   return 0;
+}
diff --git a/mfhdf/dumper/testfiles/vslongname.hdf b/mfhdf/dumper/testfiles/vslongname.hdf
new file mode 100644
index 0000000..3899d31
Binary files /dev/null and b/mfhdf/dumper/testfiles/vslongname.hdf differ
diff --git a/mfhdf/dumper/testhdp.sh.in b/mfhdf/dumper/testhdp.sh.in
new file mode 100755
index 0000000..67f8b5c
--- /dev/null
+++ b/mfhdf/dumper/testhdp.sh.in
@@ -0,0 +1,410 @@
+#! /bin/sh
+# $Id: testhdp.sh.in 6027 2014-01-16 19:28:25Z byrn $
+# Test scripts for hdp (dumper).
+# See the USAGE function for command usage.
+
+srcdir=@srcdir@
+currentdir=`pwd`
+
+# Determine whether the szip library is available
+USE_COMP_SZIP="@USE_COMP_SZIP@"
+
+# Definitions of commands and variables
+HDP='./hdp'               # The tool name
+HDP_BIN="${TESTS_ENVIRONMENT} "`pwd`/$HDP        # The path of the tool binary
+
+RM='rm -f'
+DIFF=diff
+CMP='cmp -s'
+nerrors=0		# number of errors (0)
+quitonerr=0		# quit on error (not)
+noclean=0		# no cleaning temp. files (yes)
+only=""			# dumper sub-command to test only
+except=""		# dumper sub-command to test not
+
+
+# Definitions of functions/shorthands
+#
+
+# Print Usage of the command
+USAGE() {
+    echo "Usage: $0 [-help] [-noclean] [-quit] [-except <command>] [-only <command>]"
+    echo "    -help: display help information"
+    echo "    -noclean: do not clean away temporary files"
+    echo "    -quit: quit immediately if any test fails"
+    echo "    -except: skip one specific command"
+    echo "    -only: test one specific command"
+    echo "<command> can be one of {list, dumpsds, dumprig, dumpvd, dumpvg, dumpgr}"
+}
+
+# Print message with formats according to message level ($1)
+MESG() {
+  level=$1
+  shift
+  case $level in
+    0)
+      echo '============================='
+      echo $*
+      echo '============================='
+      ;;
+    3)
+      echo '-----------------------------'
+      echo $*
+      echo '-----------------------------'
+      ;;
+    6)
+      echo "*** $* ***"
+      ;;
+    *)
+      echo "MESG(): Unknown level ($level)"
+      exit 1
+      ;;
+  esac
+}
+
+
+# Run the test to produce an output file which is then
+# compared with the expected ($1) output.
+# Note that this can be used to produce the expected
+# output files by replace "$output" with "$expected"
+# in the run-the-test commands.
+TEST()
+{
+  # parse the arguments
+  output=tmp.out
+  expected="$srcdir/testfiles/$1"
+  shift
+
+  # run the test
+  ( 
+    cd $srcdir/testfiles
+    $HDP_BIN "$@"
+  ) > $output
+  $CMP $expected $output
+
+  if [ $? -ne 0 ]; then
+    echo $DIFF $expected $output
+    $DIFF $expected $output
+    echo "   <<< FAILED >>>"
+    nerrors=`expr $nerrors + 1`
+
+    if [ $quitonerr -gt 0 ]; then
+      FINISH
+    fi
+  fi
+
+  if [ $noclean -eq 0 ]; then
+    $RM -f $output
+  fi
+}
+
+
+# Report the result and exit
+FINISH()
+{
+    if [ $nerrors -eq 0 ]
+    then
+	MESG 0 "All hdp tests passed"
+    else
+	MESG 0 "hdp tests failed: $nerrors"
+    fi
+    exit $nerrors
+}
+
+
+#===============
+# Main Body
+#===============
+
+# parse arguments
+while [ $# -gt 0 ]
+do
+    case "$1" in
+	"-quit")
+	    quitonerr=1
+	    ;;
+	"-noclean")
+	    noclean=1
+	    ;;
+	"-help")
+	    USAGE
+	    exit 0
+	    ;;
+	"-only")
+	    shift
+	    case "$1" in
+    		"list"|"dumpsds"|"dumprig"|"dumpvd"|"dumpvg"|"dumpgr")
+		    only="$1"
+		    ;;
+		*)
+		    echo "Unknown command: $1"
+		    USAGE
+		    exit 1
+		    ;;
+	    esac
+	    ;;
+	"-except")
+	    shift
+	    case "$1" in
+    		"list"|"dumpsds"|"dumprig"|"dumpvd"|"dumpvg"|"dumpgr")
+		    except="$1"
+		    ;;
+		*)
+		    echo "Unknown command: $1"
+		    USAGE
+		    exit 1
+		    ;;
+	    esac
+	    ;;
+	* )
+	    echo "Unknow option: $1"
+	    USAGE
+	    exit 1
+	    ;;
+    esac
+    shift
+done
+
+# Print a beginning banner
+MESG 0 "Running hdp tests"
+
+# Test command list
+TestCmd=list
+TestName="Test command $TestCmd"
+if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
+then
+MESG 3 "$TestName"
+TEST list-1.out list tdata.hdf
+TEST list-2.out list -l tdata.hdf
+TEST list-3.out list -d tdata.hdf
+TEST list-4.out list -e tdata.hdf
+TEST list-5.out list -t 720 tdata.hdf
+TEST list-6.out list -d -t "Numeric Data Group" tdata.hdf
+TEST list-7.out list -g tdata.hdf
+TEST list-8.out list -a tdata.hdf
+TEST list-9.out list -a Example6.hdf
+TEST list-10.out list -n Example6.hdf
+else
+MESG 3 "$TestName <<<SKIPPED>>>"
+fi
+
+# Test command dumpsds
+TestCmd=dumpsds
+TestName="Test command $TestCmd"
+if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
+then
+MESG 3 "$TestName"
+# Test 1 prints all datasets
+TEST dumpsds-1.out dumpsds swf32.hdf
+
+# Tests 2 and 3 print datasets given their indices
+TEST dumpsds-2.out dumpsds -i 2 swf32.hdf
+TEST dumpsds-3.out dumpsds -i 1,3 swf32.hdf
+
+# Test 4 should fail with error message: "SD with name Time: not found"
+TEST dumpsds-4.out dumpsds -n Time swf32.hdf
+
+# Test 5 prints datasets given their names 
+TEST dumpsds-5.out dumpsds -n fakeDim0,Data-Set-2 swf32.hdf
+
+# Test 6 prints datasets given their ref numbers
+TEST dumpsds-6.out dumpsds -r 3,2 swf32.hdf
+
+# Test 7 prints only data of the datasets selected by their ref numbers
+TEST dumpsds-7.out dumpsds -r 3,2 -d swf32.hdf
+
+# Test 8 prints only header information
+TEST dumpsds-8.out dumpsds -h swf32_fileattr.hdf
+
+# Test 9 prints data in clean format, no \digit's
+TEST dumpsds-9.out dumpsds -c swf32_fileattr.hdf
+
+# Test 10 prints contents of file without file attribute's data
+TEST dumpsds-10.out dumpsds -g swf32_fileattr.hdf
+
+# Test 11 prints contents of file without local attribute's data
+TEST dumpsds-11.out dumpsds -l swf32_fileattr.hdf
+
+# Test 12 prints a dataset by name and the name is very long
+TEST dumpsds-12.out dumpsds -h -n "The name of this dataset is long and it is used to test the new variable length name feature." SDSlongname.hdf
+
+# Test 13 prints contents of file when a dimension has the same name as its SDS
+TEST dumpsds-13.out dumpsds sds1_dim1_samename.hdf
+
+# Test 14 prints contents of file when a dimension has the same name as 
+# that of another SDS
+TEST dumpsds-14.out dumpsds sds2_dim1_samename.hdf
+
+# Test 15 prints headers of all data sets with various compression method to
+# test displaying compression information
+
+if test $USE_COMP_SZIP != "yes"; then
+TEST dumpsds-15.out dumpsds sds_compressed.hdf
+else
+TEST dumpsds-15szip.out dumpsds sds_compressed.hdf
+fi
+
+# Test 16 prints SDSs in index order, by default
+TEST dumpsds-16.out dumpsds -h -i 39,36 -n data34,data27 -r 36,37 -i 0,1 -n data6,data9,data4,data3 -r 16,17,15 -i 23,22,21 sds_empty_many.hdf
+
+# Test 17 prints SDSs in the order they were specified, when flag -k is present
+# as a request to 'k'eep the specified order
+TEST dumpsds-17.out dumpsds -k -h -i 39,36 -n data34,data27 -r 36,37 -i 0,1 -n data6,data9,data4,data3 -r 16,17,15 -i 23,22,21 sds_empty_many.hdf
+
+# Test 18 reads a few small datasets in a netCDF file
+TEST dumpsds-18.out dumpsds -i 0,1,2 Roy.nc
+
+else
+MESG 3 "$TestName <<<SKIPPED>>>"
+fi
+
+# Test command dumprig
+TestCmd=dumprig
+TestName="Test command $TestCmd"
+if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
+then
+MESG 3 "$TestName"
+TEST dumprig-1.out dumprig tdf24.hdf
+TEST dumprig-2.out dumprig -i 1,2 tdf24.hdf
+TEST dumprig-3.out dumprig -i 1,3 tdf24.hdf		# '-i 3' is invalid
+TEST dumprig-4.out dumprig -m 24 tdf24.hdf
+TEST dumprig-5.out dumprig -r 3,4 tdf24.hdf
+TEST dumprig-6.out dumprig -r 3,4 -d tdf24.hdf
+else
+MESG 3 "$TestName <<<SKIPPED>>>"
+fi
+
+# Test command dumpvd
+TestCmd=dumpvd
+TestName="Test command $TestCmd"
+if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
+then
+MESG 3 "$TestName"
+TEST dumpvd-1.out dumpvd tvset.hdf
+TEST dumpvd-2.out dumpvd -i 1,3,5 tvset.hdf
+TEST dumpvd-3.out dumpvd -r 1238,1239,1251,1252 tvset.hdf
+TEST dumpvd-4.out dumpvd -n "Multi-Order Vdata" tvset.hdf
+TEST dumpvd-5.out dumpvd -n "Mixed Vdata","Integer Vdata" tvset.hdf
+TEST dumpvd-6.out dumpvd -c "Test object","No class specified" tvset.hdf
+TEST dumpvd-7.out dumpvd -f B tvset.hdf
+TEST dumpvd-8.out dumpvd -f "STATION_NAME","FLOATS" tvset.hdf
+TEST dumpvd-9.out dumpvd -f "STATION_NAME","FLOATS" -d tvset.hdf
+TEST dumpvd-10.out dumpvd tvattr.hdf
+
+# Tests 11 and 12 print out the vdatas of classes "SDSVar" and "CoordVar"
+# to test the fix of bugzilla 624 (these are new classes used to distinguish
+# between SDS and coordinate variables)
+TEST dumpvd-11.out dumpvd -c "SDSVar" sds1_dim1_samename.hdf
+TEST dumpvd-12.out dumpvd -c "CoordVar" sds1_dim1_samename.hdf
+
+# Added test #13 to test long vdata's name and class, HDFFR-1267 - BMR 5/15/11
+TEST dumpvd-13.out dumpvd vslongname.hdf
+
+# Added test #14 to test the detection of external file, HDFFR-1266.  The
+# external file is Tables_External_File and when the file is removed from the
+# current directory, the test will fail with the name of the file displayed in
+# the error message. - BMR 6/10/11
+TEST dumpvd-14.out dumpvd Tables.hdf
+
+else
+MESG 3 "$TestName <<<SKIPPED>>>"
+fi
+
+# Test command dumpvg
+TestCmd=dumpvg
+TestName="Test command $TestCmd"
+if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
+then
+MESG 3 "$TestName"
+TEST dumpvg-1.out dumpvg tvset.hdf
+TEST dumpvg-2.out dumpvg -i 0,1 tvset.hdf
+TEST dumpvg-3.out dumpvg -r 3 tvset.hdf
+TEST dumpvg-4.out dumpvg -n "Simple Vgroup" tvset.hdf
+TEST dumpvg-5.out dumpvg -c "Test object" tvset.hdf
+TEST dumpvg-6.out dumpvg -i 1,3,5 tdata.hdf
+TEST dumpvg-7.out dumpvg -r 32,39 tdata.hdf
+TEST dumpvg-8.out dumpvg -n nsamp,tdata.hdf tdata.hdf
+TEST dumpvg-9.out dumpvg -c CDF0.0 tdata.hdf
+
+# Added option -h to the following test; this option has always 
+# failed; just fixed it - BMR 8/1/00
+TEST dumpvg-10.out dumpvg -h -c Dim0.0,Var0.0 tdata.hdf
+
+# this following test is removed since option -d is removed
+#TEST dumpvg-11.out dumpvg -c Dim0.0,Var0.0 -d tdata.hdf
+
+# moved test #12 up to #11, consequently - BMR 7/25/00
+TEST dumpvg-11.out dumpvg tvattr.hdf
+
+# Added these two tests for the new feature: vgroup has variable length 
+# name - BMR 10/27/06
+# Note that the dumpvg-13 test searches for an SDS also
+TEST dumpvg-12.out dumpvg VGlongname.hdf
+TEST dumpvg-13.out dumpvg -n "SD Vgroup - this vgroup has an sds as a member and it is actually meant to test long vgroup name" VGlongname.hdf
+
+# Prints contents of file when a dimension has the same name as its SDS 
+TEST dumpvg-14.out dumpvg sds1_dim1_samename.hdf
+
+# Prints contents of file when a dimension has the same name as that 
+# of another SDS
+TEST dumpvg-15.out dumpvg sds2_dim1_samename.hdf
+
+# Verify the fix for bug HDFFR-197 and a vgroup with ref=0 (some old RI stuff)
+TEST dumpvg-16.out dumpvg -h grtdfi322.hdf
+TEST dumpvg-17.out dumpvg grtdfi322.hdf
+
+else
+MESG 3 "$TestName <<<SKIPPED>>>"
+fi
+
+# Test command dumpgr
+TestCmd=dumpgr
+TestName="Test command $TestCmd"
+if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
+then
+MESG 3 "$TestName"
+TEST dumpgr-1.out dumpgr grtdfui82.hdf
+TEST dumpgr-2.out dumpgr -i 0,1,3 grtdfui82.hdf
+TEST dumpgr-3.out dumpgr -i 0 grtdfui82.hdf
+TEST dumpgr-4.out dumpgr -n Image_array_5 grtdfui82.hdf
+TEST dumpgr-5.out dumpgr -r 6,2,3 grtdfui82.hdf
+TEST dumpgr-6.out dumpgr -r 6 -d  grtdfui82.hdf
+TEST dumpgr-7.out dumpgr -o $currentdir/my.dat grtdfui82.hdf
+$RM my.dat
+TEST dumpgr-8.out dumpgr -o $currentdir/mybin.dat  -b grtdfui82.hdf
+$RM mybin.dat
+TEST dumpgr-9.out dumpgr grtdfui83.hdf
+TEST dumpgr-10.out dumpgr grtdfui84.hdf
+TEST dumpgr-11.out dumpgr grtdfui162.hdf
+
+# Test 12 shows that file attribute is printed
+TEST dumpgr-12.out dumpgr grtdfi322.hdf
+
+# Tests 13, 14, and 15 test option -h, which was not included in any
+# of the previous tests, and the new options -p and -pd, printing palette
+# with or without palette information 
+TEST dumpgr-13.out dumpgr -p Image_with_Palette.hdf
+TEST dumpgr-14.out dumpgr -h Image_with_Palette.hdf
+TEST dumpgr-15.out dumpgr -r 2,4 -pd Image_with_Palette.hdf
+
+# Test 16: to test new option -s, printing data as stream
+TEST dumpgr-16.out dumpgr -r 6 -d -s grtdfui82.hdf
+
+# Test 17: to test new option -m (interlace mode = LINE)
+TEST dumpgr-17.out dumpgr -r 6 -m 1 grtdfui82.hdf
+
+# Test 18: to test new option -c (printing attribute data in clean format)
+TEST dumpgr-18.out dumpgr -c grtdfi322.hdf
+
+# Test 19: to test new options -g and -l (suppress all attribute data)
+TEST dumpgr-19.out dumpgr -g -l grtdfi322.hdf
+
+# Test 20: to test dumpgr successfully detect IMCOMP compression type
+TEST dumpgr-20.out dumpgr IMCOMP.hdf
+
+else
+MESG 3 "$TestName <<<SKIPPED>>>"
+fi
+
+# End of test
+FINISH
diff --git a/mfhdf/examples/CMakeLists.txt b/mfhdf/examples/CMakeLists.txt
new file mode 100644
index 0000000..df1c5f4
--- /dev/null
+++ b/mfhdf/examples/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_EXAMPLES)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (examples
+    SD_create_sds
+    SD_write_to_sds
+    SD_write_slab
+    SD_alter_sds_values
+    SD_unlimited_sds
+    SD_compress_sds
+    SD_mv_sds_to_external
+    SD_read_from_sds
+    SD_read_subsets
+    SD_get_info
+    SD_find_sds_by_name
+    SD_set_get_dim_info
+    SD_dimscale_vs_sds
+    SD_set_attr
+    SD_get_attr
+    SD_chunking_example
+)
+
+FOREACH (example ${examples})
+  ADD_EXECUTABLE (mf_${example} ${HDF4_MFHDF_EXAMPLES_SOURCE_DIR}/${example}.c)
+  TARGET_NAMING (mf_${example} ${LIB_TYPE})
+  TARGET_C_PROPERTIES (mf_${example} " " " ")
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (mf_${example} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (mf_${example} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+ENDFOREACH (example ${examples})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
diff --git a/mfhdf/examples/CMakeTests.cmake b/mfhdf/examples/CMakeTests.cmake
new file mode 100644
index 0000000..8a30920
--- /dev/null
+++ b/mfhdf/examples/CMakeTests.cmake
@@ -0,0 +1,31 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME MFHDF_EXAMPLES-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        SDS.hdf
+        SDSchunked.hdf
+        SDScompressed.hdf
+        SDSUNLIMITED.hdf
+        SLABS.hdf
+        ExternalSDS
+)
+SET_TESTS_PROPERTIES (MFHDF_EXAMPLES-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+SET (last_test "MFHDF_EXAMPLES-clearall-objects")
+
+FOREACH (example ${examples})
+  ADD_TEST (NAME mftest_${example} COMMAND $<TARGET_FILE:mf_${example}>)
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (mftest_${example} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (mftest_${example} PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "mftest_${example}")
+ENDFOREACH (example ${examples})
diff --git a/mfhdf/examples/Makefile.am b/mfhdf/examples/Makefile.am
new file mode 100644
index 0000000..7bfbacb
--- /dev/null
+++ b/mfhdf/examples/Makefile.am
@@ -0,0 +1,62 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+DEFINES=-DNDEBUG -DHDF
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+EXAMPLE_PROG = SD_create_sds SD_write_to_sds SD_write_slab             \
+	SD_alter_sds_values SD_unlimited_sds SD_compress_sds        \
+	SD_mv_sds_to_external SD_read_from_sds SD_read_subsets      \
+	SD_get_info SD_find_sds_by_name SD_set_get_dim_info         \
+	SD_dimscale_vs_sds SD_set_attr SD_get_attr SD_chunking_example
+TEST_PROG = $(EXAMPLE_PROG)
+
+INSTALL_FILES = SD_create_sds.c SD_write_to_sds.c SD_write_slab.c        \
+	SD_alter_sds_values.c SD_unlimited_sds.c SD_compress_sds.c       \
+	SD_mv_sds_to_external.c SD_read_from_sds.c SD_read_subsets.c     \
+	SD_get_info.c SD_find_sds_by_name.c SD_set_get_dim_info.c        \
+	SD_dimscale_vs_sds.c SD_set_attr.c SD_get_attr.c SD_chunking_example.c
+
+EXAMPLEDIR=$(prefix)/examples/c
+
+# How to build programs using h4cc
+$(EXTRA_PROG): $(H4CC)
+	$(H4CC) $(H4CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal C++ compiler, not h4cc.  This is
+# an inelegant way of solving the problem, unfortunately.
+create_sds: $(srcdir)/SD_create_sds.c
+write_to_sds: $(srcdir)/SD_write_to_sds.c
+write_slab: $(srcdir)/SD_write_slab.c
+alter_sds_values: $(srcdir)/SD_alter_sds_values.c
+unlimited_sds: $(srcdir)/SD_unlimited_sds.c
+compress_sds: $(srcdir)/SD_compress_sds.c
+mv_sds_to_external: $(srcdir)/SD_mv_sds_to_external.c
+read_from_sds: $(srcdir)/SD_read_from_sds.c
+read_subsets: $(srcdir)/SD_read_subsets.c
+get_info: $(srcdir)/SD_get_info.c
+find_sds_by_name: $(srcdir)/SD_find_sds_by_name.c
+set_get_dim_info: $(srcdir)/SD_set_get_dim_info.c
+dimscale_vs_sds: $(srcdir)/SD_dimscale_vs_sds.c
+set_attr: $(srcdir)/SD_set_attr.c
+get_attr: $(srcdir)/SD_get_attr.c
+chunking_example: $(srcdir)/SD_chunking_example.c
+
+CHECK_CLEANFILES += ExternalSDS
+
+DISTCLEANFILES = *.chklog *.chkexe .deps
+
+if BUILD_SHARED_SZIP_CONDITIONAL
+LD_LIBRARY_PATH=$(LL_PATH)
+endif
+
+include $(top_srcdir)/config/examples.am
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/examples/Makefile.in b/mfhdf/examples/Makefile.in
new file mode 100644
index 0000000..e331b60
--- /dev/null
+++ b/mfhdf/examples/Makefile.in
@@ -0,0 +1,727 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+# We can't tell automake about example programs, because they need to be
+# built using h4cc (or h4fc, etc.) instead of the standard compilers.
+# This creates some extra work for us.
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/testexamples.sh.in $(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am \
+	$(top_srcdir)/config/examples.am
+TESTS = $(TEST_PROG)
+subdir = mfhdf/examples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = testexamples.sh
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog ExternalSDS *.hdf
+DEFINES = -DNDEBUG -DHDF
+
+#############################################################################
+#############################################################################
+EXAMPLE_PROG = SD_create_sds SD_write_to_sds SD_write_slab             \
+	SD_alter_sds_values SD_unlimited_sds SD_compress_sds        \
+	SD_mv_sds_to_external SD_read_from_sds SD_read_subsets      \
+	SD_get_info SD_find_sds_by_name SD_set_get_dim_info         \
+	SD_dimscale_vs_sds SD_set_attr SD_get_attr SD_chunking_example
+
+TEST_PROG = $(EXAMPLE_PROG)
+INSTALL_FILES = SD_create_sds.c SD_write_to_sds.c SD_write_slab.c        \
+	SD_alter_sds_values.c SD_unlimited_sds.c SD_compress_sds.c       \
+	SD_mv_sds_to_external.c SD_read_from_sds.c SD_read_subsets.c     \
+	SD_get_info.c SD_find_sds_by_name.c SD_set_get_dim_info.c        \
+	SD_dimscale_vs_sds.c SD_set_attr.c SD_get_attr.c SD_chunking_example.c
+
+EXAMPLEDIR = $(prefix)/examples/c
+DISTCLEANFILES = *.chklog *.chkexe .deps
+ at BUILD_SHARED_SZIP_CONDITIONAL_TRUE@LD_LIBRARY_PATH = $(LL_PATH)
+
+# Assume that all tests in this directory are examples, and tell
+# conclude.am when to build them.
+EXTRA_PROG = $(EXAMPLE_PROG)
+
+# We need to tell automake what to clean
+MOSTLYCLEANFILES = *.o $(EXAMPLE_PROG)
+CLEANFILES = $(EXAMPLE_PROG)
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/examples/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+testexamples.sh: $(top_builddir)/config.status $(srcdir)/testexamples.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+	-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-local
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am all-local check check-TESTS check-am clean \
+	clean-generic clean-libtool distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am \
+	install-data-local install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installcheck-local installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am uninstall uninstall-am uninstall-local
+
+
+# How to build programs using h4cc
+$(EXTRA_PROG): $(H4CC)
+	$(H4CC) $(H4CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal C++ compiler, not h4cc.  This is
+# an inelegant way of solving the problem, unfortunately.
+create_sds: $(srcdir)/SD_create_sds.c
+write_to_sds: $(srcdir)/SD_write_to_sds.c
+write_slab: $(srcdir)/SD_write_slab.c
+alter_sds_values: $(srcdir)/SD_alter_sds_values.c
+unlimited_sds: $(srcdir)/SD_unlimited_sds.c
+compress_sds: $(srcdir)/SD_compress_sds.c
+mv_sds_to_external: $(srcdir)/SD_mv_sds_to_external.c
+read_from_sds: $(srcdir)/SD_read_from_sds.c
+read_subsets: $(srcdir)/SD_read_subsets.c
+get_info: $(srcdir)/SD_get_info.c
+find_sds_by_name: $(srcdir)/SD_find_sds_by_name.c
+set_get_dim_info: $(srcdir)/SD_set_get_dim_info.c
+dimscale_vs_sds: $(srcdir)/SD_dimscale_vs_sds.c
+set_attr: $(srcdir)/SD_set_attr.c
+get_attr: $(srcdir)/SD_get_attr.c
+chunking_example: $(srcdir)/SD_chunking_example.c
+
+# How to create EXAMPLEDIR if it doesn't already exist
+$(EXAMPLEDIR):
+	mkdir -p $@
+
+# Install and uninstall rules.  We install the source files, not the
+# example programs themselves.
+install-data-local:
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-local:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+install-examples: $(EXAMPLEDIR) 
+	@for f in X $(INSTALL_FILES); do                                     \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_FILES); do                                 \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	  fi;                                                                \
+	done
+
+uninstall-examples:
+	@if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then           \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES);              \
+	fi
+	@if test -n "$(INSTALL_SCRIPT_FILES)" -a -d $(EXAMPLEDIR); then    \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_SCRIPT_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_SCRIPT_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_SCRIPT_FILES);       \
+	fi
+
+installcheck-local:
+	@if test "$(STATIC_SHARED)" = "static, shared"; then               \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	  $(MAKE) $(AM_MAKEFLAGS) clean;                                   \
+	  H5CCFLAGS="" $(MAKE) $(AM_MAKEFLAGS) check;                      \
+	elif test "$(STATIC_SHARED)" = "shared"; then                      \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	else                                                               \
+	  $(MAKE) $(AM_MAKEFLAGS) check;                                   \
+	fi
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/examples/SD_alter_sds_values.c b/mfhdf/examples/SD_alter_sds_values.c
new file mode 100644
index 0000000..35d6188
--- /dev/null
+++ b/mfhdf/examples/SD_alter_sds_values.c
@@ -0,0 +1,56 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index;
+   intn  status;
+   int32 start[2], edges[2];
+   int32 new_data[2];
+
+   /********************* End of variable declaration ***********************/
+   /* 
+   * Open the file and initialize the SD interface with write access.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_WRITE);
+
+   /*
+   * Select the first data set.
+   */
+   sds_index = 0;
+   sds_id = SDselect (sd_id, sds_index);
+
+   /*
+   * Set up the start and edge parameters to write new element values
+   * into 10th row, 2nd column place, and 11th row, 2nd column place. 
+   */
+   start[0] = 9;     /* starting at 10th row   */
+   start[1] = 1;     /* starting at 2nd column */
+   edges[0] = 2;     /* rows 10th and 11th     */
+   edges[1] = 1;     /* column 2nd only        */
+       
+   /*
+   * Initialize buffer with the new values to be written.
+   */
+   new_data[0] = new_data[1] = 1000; 
+        
+   /*
+   * Write the new values. 
+   */
+   status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)new_data);
+
+   /*
+   * Terminate access to the data set.
+   */ 
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_chunking_example.c b/mfhdf/examples/SD_chunking_example.c
new file mode 100644
index 0000000..5d1b23c
--- /dev/null
+++ b/mfhdf/examples/SD_chunking_example.c
@@ -0,0 +1,295 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDSchunked.hdf"
+#define SDS_NAME      "ChunkedData"
+#define RANK          2
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32         sd_id, sds_id, sds_index;
+   intn          status;
+   int32         flag, maxcache, new_maxcache;
+   int32         dim_sizes[2], origin[2];
+   HDF_CHUNK_DEF c_def, c_def_out; /* Chunking definitions */ 
+   int32         comp_flag, c_flags;
+   int16         all_data[9][4];
+   int32         start[2], edges[2];
+   int16         chunk_out[3][2];
+   int16         row[2] = { 5, 5 };
+   int16         column[3] = { 4, 4, 4 };
+   int16         fill_value = 0;   /* Fill value */
+   int           i,j;
+   /*
+   * Declare chunks data type and initialize some of them. 
+   */
+          int16 chunk1[3][2] = { 1, 1,
+                                 1, 1,
+                                 1, 1 }; 
+
+          int16 chunk2[3][2] = { 2, 2,
+                                 2, 2,
+                                 2, 2 }; 
+
+          int16 chunk3[3][2] = { 3, 3,
+                                 3, 3,
+                                 3, 3 }; 
+
+          int16 chunk6[3][2] = { 6, 6,
+                                 6, 6,
+                                 6, 6 };
+
+    /********************* End of variable declaration ***********************/
+    /*
+    * Define chunk's dimensions.
+    *
+    *         In this example we do not use compression. 
+    *         To use chunking with RLE, Skipping Huffman, and GZIP
+    *         compression, initialize
+    *
+    *                c_def.comp.chunk_lengths[0] = 3;
+    *                c_def.comp.chunk_lengths[1] = 2; 
+    *
+    *         To use chunking with NBIT, initialize
+    *
+    *                c_def.nbit.chunk_lengths[0] = 3;
+    *                c_def.nbit.chunk_lengths[1] = 2; 
+    *
+    */
+    c_def.chunk_lengths[0] = 3;
+    c_def.chunk_lengths[1] = 2;
+
+    /*
+    * Create the file and initialize SD interface.
+    */
+    sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+
+    /*
+    * Create 9x4 SDS.
+    */
+    dim_sizes[0] = 9;
+    dim_sizes[1] = 4;
+    sds_id = SDcreate (sd_id, SDS_NAME,DFNT_INT16, RANK, dim_sizes);
+
+    /*
+    * Fill the SDS array with the fill value.
+    */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+
+    /*
+    * Create chunked SDS.
+    * In this example we do not use compression ( third
+    * parameter of SDsetchunk is set to HDF_CHUNK).
+    *
+    * To use RLE compresssion, set compression type and flag
+    *
+    *            c_def.comp.comp_type = COMP_CODE_RLE;
+    *            comp_flag = HDF_CHUNK | HDF_COMP;
+    *          
+    * To use Skipping Huffman compression, set compression type, flag
+    * and skipping size skp_size
+    *
+    *            c_def.comp.comp_type = COMP_CODE_SKPHUFF;
+    *            c_def.comp.cinfo.skphuff.skp_size = value;             
+    *            comp_flag = HDF_CHUNK | HDF_COMP;
+    *
+    * To use GZIP compression, set compression type, flag and
+    * deflate level
+    * 
+    *            c_def.comp.comp_type = COMP_CODE_DEFLATE;
+    *            c_def.comp.cinfo.deflate.level = value;             
+    *            comp_flag = HDF_CHUNK | HDF_COMP;
+    *
+    * To use NBIT compression, set compression flag and
+    * compression parameters
+    *          
+    *            comp_flag = HDF_CHUNK | HDF_NBIT;
+    *            c_def.nbit.start_bit = value1;             
+    *            c_def.nbit.bit_len   = value2;             
+    *            c_def.nbit.sign_ext  = value3;             
+    *            c_def.nbit.fill_one  = value4;             
+    */
+    comp_flag = HDF_CHUNK;
+    status = SDsetchunk (sds_id, c_def, comp_flag);
+
+    /*
+    * Set chunk cache to hold maximum of 3 chunks.
+    */
+    maxcache = 3;
+    flag = 0;
+    new_maxcache = SDsetchunkcache (sds_id, maxcache, flag);
+
+    /* 
+    * Write chunks using SDwritechunk function.
+    * Chunks can be written in any order.
+    */
+
+    /* 
+    * Write the chunk with the coordinates (0,0).
+    */
+    origin[0] = 0;
+    origin[1] = 0;
+    status = SDwritechunk (sds_id, origin, (VOIDP) chunk1);
+
+    /*   
+    * Write the chunk with the coordinates (1,0).
+    */
+    origin[0] = 1;
+    origin[1] = 0;
+    status = SDwritechunk (sds_id, origin, (VOIDP) chunk3);
+
+    /*   
+    * Write the chunk with the coordinates (0,1). 
+    */
+    origin[0] = 0;
+    origin[1] = 1;
+    status = SDwritechunk (sds_id, origin, (VOIDP) chunk2);
+
+    /* 
+    * Write chunk with the coordinates (1,2) using
+    * SDwritedata function.
+    */
+    start[0] = 6;
+    start[1] = 2;
+    edges[0] = 3;
+    edges[1] = 2;
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP) chunk6); 
+
+    /* 
+    * Fill second column in the chunk with the coordinates (1,1)
+    * using SDwritedata function.
+    */
+    start[0] = 3;
+    start[1] = 3;
+    edges[0] = 3;
+    edges[1] = 1;
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP) column); 
+
+    /* 
+    * Fill second row in the chunk with the coordinates (0,2)
+    * using SDwritedata function.
+    */
+    start[0] = 7;
+    start[1] = 0;
+    edges[0] = 1;
+    edges[1] = 2;
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP) row); 
+           
+    /* 
+    * Terminate access to the data set.
+    */
+    status = SDendaccess (sds_id);
+
+    /*
+    * Terminate access to the SD interface and close the file.
+    */
+    status = SDend (sd_id);
+
+    /*
+    * Reopen the file and access the first data set.
+    */
+    sd_id = SDstart (FILE_NAME, DFACC_READ);
+    sds_index = 0;
+    sds_id = SDselect (sd_id, sds_index);
+
+    /*
+    * Get information about the SDS. Only chunk lengths and compression
+    * flag can be returned. Compression information is not available if
+    * NBIT, Skipping Huffman, or GZIP compression is used.
+    */
+    status = SDgetchunkinfo (sds_id, &c_def_out, &c_flags);
+    if (c_flags == HDF_CHUNK )
+       printf(" SDS is chunked\nChunk's dimensions %dx%d\n",
+              c_def_out.chunk_lengths[0],
+              c_def_out.chunk_lengths[1]);
+    else if (c_flags == (HDF_CHUNK | HDF_COMP))
+         printf("SDS is chunked and compressed\nChunk's dimensions %dx%d\n",
+                  c_def_out.comp.chunk_lengths[0],
+                  c_def_out.comp.chunk_lengths[1]);
+    else if (c_flags == (HDF_CHUNK | HDF_NBIT))
+         printf ("SDS is chunked (NBIT)\nChunk's dimensions %dx%d\n",
+                  c_def_out.nbit.chunk_lengths[0],
+                  c_def_out.nbit.chunk_lengths[1]);
+
+    /*
+    * Read the entire data set using SDreaddata function.
+    */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = 9;
+    edges[1] = 4;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)all_data);
+
+    /* 
+    * Print out what we have read.
+    * The following information should be displayed:
+    *
+    * SDS is chunked 
+    * Chunk's dimensions 3x2
+    *          1 1 2 
+    *          1 1 2 2
+    *          1 1 2 2
+    *          3 3 0 4
+    *          3 3 0 4
+    *          3 3 0 4
+    *          0 0 6 6
+    *          5 5 6 6
+    *          0 0 6 6
+    */
+    for (j=0; j<9; j++) 
+    {
+         for (i=0; i<4; i++) printf (" %d", all_data[j][i]);
+         printf ("\n");
+    }
+
+    /* 
+    * Read chunk with the coordinates (2,0) and display it.
+    */
+    origin[0] = 2;
+    origin[1] = 0;    	
+    status = SDreadchunk (sds_id, origin, chunk_out);
+    printf (" Chunk (2,0) \n");
+    for (j=0; j<3; j++) 
+    {
+         for (i=0; i<2; i++) printf (" %d", chunk_out[j][i]);
+         printf ("\n");
+    }
+
+    /* 
+    * Read chunk with the coordinates (1,1) and display it.
+    */
+    origin[0] = 1;
+    origin[1] = 1;    	
+    status = SDreadchunk (sds_id, origin, chunk_out);
+    printf (" Chunk (1,1) \n");
+    for (j=0; j<3; j++) 
+    {
+         for (i=0; i<2; i++) printf (" %d", chunk_out[j][i]);
+         printf ("\n");
+    }
+
+    /*  The following information is displayed:
+    *
+    *   Chunk (2,0) 
+    *   0 0
+    *   5 5
+    *   0 0
+    *   Chunk (1,1) 
+    *   0 4
+    *   0 4
+    *   0 4
+    */
+
+    /* 
+    * Terminate access to the data set.
+    */
+    status = SDendaccess (sds_id);
+
+    /*
+    * Terminate access to the SD interface and close the file.
+    */
+    status = SDend (sd_id);
+
+    return 0;
+}            
diff --git a/mfhdf/examples/SD_compress_sds.c b/mfhdf/examples/SD_compress_sds.c
new file mode 100644
index 0000000..80a69a4
--- /dev/null
+++ b/mfhdf/examples/SD_compress_sds.c
@@ -0,0 +1,87 @@
+#include "mfhdf.h"
+
+#define FILE_NAME      "SDScompressed.hdf"
+#define SDS_NAME       "SDSgzip"
+#define X_LENGTH       5
+#define Y_LENGTH       16
+#define RANK           2
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32     sd_id, sds_id;
+   intn      status;
+   int32     comp_type;    /* Compression flag */
+   comp_info c_info;   /* Compression structure */
+   int32     start[2], edges[2], dim_sizes[2];
+   int32     data[Y_LENGTH][X_LENGTH];
+   int       i, j;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Buffer array data and define array dimensions.
+   */
+   for (j = 0; j < Y_LENGTH; j++) 
+   {
+	for (i = 0; i < X_LENGTH; i++)
+		data[j][i] = (i + j) + 1;
+   }
+   dim_sizes[0] = Y_LENGTH;
+   dim_sizes[1] = X_LENGTH;
+
+   /*
+   * Create the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+
+   /*
+   * Create the data set with the name defined in SDS_NAME. 
+   */ 
+   sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes);
+
+   /*
+   * Ininitialize compression structure element and compression
+   * flag for GZIP compression and call SDsetcompress.
+   *
+   *   To use the Skipping Huffman compression method, initialize
+   *          comp_type = COMP_CODE_SKPHUFF
+   *          c_info.skphuff.skp_size = value
+   *
+   *   To use the RLE compression method, initialize
+   *          comp_type = COMP_CODE_RLE
+   *   No structure element needs to be initialized.
+   */
+   comp_type = COMP_CODE_DEFLATE;
+   c_info.deflate.level = 6;
+   status = SDsetcompress (sds_id, comp_type, &c_info); 
+
+   /* 
+   * Define the location and size of the data set
+   * to be written to the file.
+   */
+   start[0] = 0;
+   start[1] = 0;
+   edges[0] = Y_LENGTH;
+   edges[1] = X_LENGTH;
+
+   /*
+   * Write the stored data to the data set. The last argument 
+   * must be explicitly cast to a generic pointer since SDwritedata
+   * is designed to write generic data. 
+   */
+   status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)data);
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_create_sds.c b/mfhdf/examples/SD_create_sds.c
new file mode 100644
index 0000000..1115857
--- /dev/null
+++ b/mfhdf/examples/SD_create_sds.c
@@ -0,0 +1,50 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf" 
+#define SDS_NAME      "SDStemplate" 
+#define X_LENGTH      5
+#define Y_LENGTH      16
+#define RANK          2  /* Number of dimensions of the SDS */
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id;     /* SD interface and data set identifiers */
+   int32 dim_sizes[2];      /* sizes of the SDS dimensions */
+   intn  status;            /* status returned by some routines; has value
+                               SUCCEED or FAIL */
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Create the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+
+   /*
+   * Define the dimensions of the array to be created.
+   */
+   dim_sizes[0] = Y_LENGTH;
+   dim_sizes[1] = X_LENGTH;
+
+   /*
+   * Create the data set with the name defined in SDS_NAME. Note that 
+   * DFNT_INT32 indicates that the SDS data is of type int32. Refer to
+   * Table 2F, "Standard HDF Data Types and Flags," for definitions of
+   * other types. 
+   */
+   sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes);
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_dimscale_vs_sds.c b/mfhdf/examples/SD_dimscale_vs_sds.c
new file mode 100644
index 0000000..08ea0ac
--- /dev/null
+++ b/mfhdf/examples/SD_dimscale_vs_sds.c
@@ -0,0 +1,59 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index;
+   intn  status;
+   int32 rank, data_type, dim_sizes[H4_MAX_VAR_DIMS];
+   int32 n_datasets, n_file_attr, n_attrs; 
+   char  sds_name[H4_MAX_NC_NAME];
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Open the file and initialize the SD interface.
+   */
+   sd_id = SDstart(FILE_NAME, DFACC_READ);
+
+   /*
+   * Obtain information about the file.
+   */ 
+   status = SDfileinfo(sd_id, &n_datasets, &n_file_attr);
+
+   /* Get information about each SDS in the file.
+   *  Check whether it is a coordinate variable, then display retrieved 
+   *  information.
+   *  Output displayed:
+   *
+   *            SDS array with the name SDStemplate
+   *            Coordinate variable with the name Y_Axis
+   *            Coordinate variable with the name X_Axis
+   *
+   */
+   for (sds_index=0; sds_index< n_datasets; sds_index++) 
+   {
+       sds_id = SDselect (sd_id, sds_index);
+       status = SDgetinfo(sds_id, sds_name, &rank, dim_sizes, &data_type, &n_attrs);
+       if (SDiscoordvar(sds_id)) 
+          printf(" Coordinate variable with the name %s\n", sds_name);
+       else
+          printf(" SDS array with the name %s\n", sds_name);
+
+   /*
+   * Terminate access to the selected data set.
+   */
+   status = SDendaccess(sds_id);
+
+   }
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend(sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_find_sds_by_name.c b/mfhdf/examples/SD_find_sds_by_name.c
new file mode 100644
index 0000000..68733f2
--- /dev/null
+++ b/mfhdf/examples/SD_find_sds_by_name.c
@@ -0,0 +1,76 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+#define SDS_NAME      "SDStemplate"
+#define WRONG_NAME    "WrongName"
+#define X_LENGTH      5
+#define Y_LENGTH      16
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index;
+   intn  status;
+   int32 start[2], edges[2];
+   int32 data[Y_LENGTH][X_LENGTH];
+   int   i, j;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Open the file for reading and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_READ);
+
+   /*
+   * Find index of the data set with the name specified in WRONG_NAME.
+   * Error condition occurs, since the data set with that name does not exist 
+   * in the file.
+   */ 
+   sds_index = SDnametoindex (sd_id, WRONG_NAME);
+   if (sds_index == FAIL)
+   printf ("Data set with the name \"WrongName\" does not exist\n"); 
+
+   /*
+   * Find index of the data set with the name specified in SDS_NAME and use 
+   * the index to select the data set.
+   */ 
+   sds_index = SDnametoindex (sd_id, SDS_NAME);
+   sds_id = SDselect (sd_id, sds_index);
+
+   /* 
+   * Set elements of the array start to 0, elements of the array edges to 
+   * SDS dimensions, and use NULL for stride argument in SDreaddata to read
+   * the entire data.
+   */
+   start[0] = 0;
+   start[1] = 0;
+   edges[0] = Y_LENGTH;
+   edges[1] = X_LENGTH;
+
+   /*
+   * Read the entire data into the buffer named data.
+   */
+   status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)data);
+
+   /* 
+   * Print 10th row; the following numbers should be displayed:
+   *
+   *             10 1000 12 13 14
+   */
+   for (j = 0; j < X_LENGTH; j++) printf ("%d ", data[9][j]);
+   printf ("\n");
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_get_attr.c b/mfhdf/examples/SD_get_attr.c
new file mode 100644
index 0000000..79cfd8b
--- /dev/null
+++ b/mfhdf/examples/SD_get_attr.c
@@ -0,0 +1,156 @@
+#include "mfhdf.h"
+
+#define FILE_NAME      "SDS.hdf"
+#define FILE_ATTR_NAME "File_contents"
+#define SDS_ATTR_NAME  "Valid_range"
+#define DIM_ATTR_NAME  "Dim_metric"
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32   sd_id, sds_id, dim_id;
+   intn    status;
+   int32   attr_index, data_type, n_values; 
+   char    attr_name[H4_MAX_NC_NAME];
+   int     i;
+   
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Open the file and initialize SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_READ);
+
+   /*
+   * Find the file attribute defined by FILE_ATTR_NAME.
+   */
+   attr_index = SDfindattr (sd_id, FILE_ATTR_NAME);
+
+   /*
+   * Get information about the file attribute. Note that the first
+   * parameter is an SD interface identifier.
+   */
+   status = SDattrinfo (sd_id, attr_index, attr_name, &data_type, &n_values);
+
+   /* The data type should be DFNT_CHAR, from SD_set_attr.c */
+   if (data_type = DFNT_CHAR)
+   {
+      char *fileattr_data;
+
+      /*
+      * Allocate a buffer to hold the attribute data.
+      */
+      fileattr_data = (char *)HDmalloc (n_values * sizeof(char));
+
+      /*
+      * Read the file attribute data.
+      */
+      status = SDreadattr (sd_id, attr_index, fileattr_data);
+
+      /*
+      * Print out file attribute value and free buffer. 
+      */
+      printf ("File attribute value is : %s\n", fileattr_data);
+      free (fileattr_data);
+   }
+
+   /*
+   * Select the first data set.
+   */
+   sds_id = SDselect (sd_id, 0);
+
+   /*
+   * Find the data set attribute defined by SDS_ATTR_NAME. Note that the
+   * first parameter is a data set identifier.
+   */
+   attr_index = SDfindattr (sds_id, SDS_ATTR_NAME);
+
+   /*
+   * Get information about the data set attribute.
+   */
+   status = SDattrinfo (sds_id, attr_index, attr_name, &data_type, &n_values);
+
+   /*
+   * The data type should be DFNT_FLOAT32, from SD_set_attr.c.
+   */
+   if (data_type == DFNT_FLOAT32)
+   {
+      float32 *sds_data;
+
+      /*
+      * Allocate a buffer to hold the data set attribute data.
+      */
+      sds_data = (float32 *)HDmalloc (n_values * sizeof (float32));
+
+      /*
+      * Read the SDS attribute data.
+      */
+      status = SDreadattr (sds_id, attr_index, sds_data);
+
+      /*
+      * Print out SDS attribute data type and values and free buffer. 
+      */
+      printf ("SDS attribute data type is : float32\n");
+      printf ("SDS attribute values are :  ");
+      for (i=0; i<n_values; i++) printf (" %f", sds_data[i]);
+      printf ("\n"); 
+      free (sds_data);
+   }
+
+   /*    
+   * Get the identifier for the second dimension of the SDS.
+   */
+   dim_id = SDgetdimid (sds_id, 1);
+
+   /*
+   * Find dimension attribute defined by DIM_ATTR_NAME.
+   */
+   attr_index = SDfindattr (dim_id, DIM_ATTR_NAME);
+
+   /*
+   * Get information about the dimension attribute.
+   */
+   status = SDattrinfo (dim_id, attr_index, attr_name, &data_type, &n_values);
+
+   /*
+   * The data type should be DFNT_CHAR, from SD_set_attr.c.
+   */
+   if (data_type == DFNT_CHAR)
+   {
+      char *dimattr_data;
+
+      /*
+      * Allocate a buffer to hold the dimension attribute data.
+      */
+      dimattr_data = (char *)HDmalloc (n_values * sizeof (char));
+
+      /*
+      * Read the dimension attribute data.
+      */
+      status = SDreadattr (dim_id, attr_index, dimattr_data);
+
+      /*
+      * Print out dimension attribute value and free buffer. 
+      */
+      printf ("Dimensional attribute values is : %s\n", dimattr_data);
+      free (dimattr_data);
+   }
+
+   /*
+   * Terminate access to the data set and to the SD interface and 
+   * close the file.
+   */
+   status = SDendaccess (sds_id);
+   status = SDend (sd_id);
+
+   /*   Output of this program is :
+   *
+   *    File attribute value is : Storm_track_data
+   *    SDS attribute data type is : float32
+   *    SDS attribute values are :   2.000000 10.000000
+   *    Dimensional attribute values is : Seconds
+   */
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_get_info.c b/mfhdf/examples/SD_get_info.c
new file mode 100644
index 0000000..c5541db
--- /dev/null
+++ b/mfhdf/examples/SD_get_info.c
@@ -0,0 +1,68 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id;
+   intn  status;
+   int32 n_datasets, n_file_attrs, index;
+   int32 dim_sizes[H4_MAX_VAR_DIMS];
+   int32 rank, data_type, n_attrs;
+   char  name[H4_MAX_NC_NAME];
+   int   i;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Open the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_READ);
+
+   /*
+   * Determine the number of data sets in the file and the number
+   * of file attributes. 
+   */
+   status = SDfileinfo (sd_id, &n_datasets, &n_file_attrs);
+
+   /*  
+   * Access every data set and print its name, rank, dimension sizes,
+   * data type, and number of attributes. 
+   * The following information should be displayed:
+   *
+   *               name = SDStemplate
+   *               rank = 2
+   *               dimension sizes are : 16  5  
+   *               data type is  24
+   *               number of attributes is  0
+   */
+   for (index = 0; index < n_datasets; index++)
+   {
+       sds_id = SDselect (sd_id, index);
+       status = SDgetinfo (sds_id, name, &rank, dim_sizes, 
+                           &data_type, &n_attrs);
+
+       printf ("name = %s\n", name);
+       printf ("rank = %d\n", rank);
+       printf ("dimension sizes are : ");
+       for (i=0; i< rank; i++) printf ("%d  ", dim_sizes[i]);
+       printf ("\n");
+       printf ("data type is  %d\n", data_type);
+       printf ("number of attributes is  %d\n", n_attrs);
+
+       /*
+       * Terminate access to the data set.
+       */
+       status = SDendaccess (sds_id);
+   }
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
+
diff --git a/mfhdf/examples/SD_mv_sds_to_external.c b/mfhdf/examples/SD_mv_sds_to_external.c
new file mode 100644
index 0000000..a496095
--- /dev/null
+++ b/mfhdf/examples/SD_mv_sds_to_external.c
@@ -0,0 +1,41 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+#define EXT_FILE_NAME "ExternalSDS"
+#define OFFSET        24
+
+int main()
+{
+
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index, offset;
+   intn  status;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Open the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_WRITE);
+
+   /*
+   * Select the first data set.
+   */
+   sds_index = 0;   
+   sds_id = SDselect (sd_id, sds_index);
+
+   /*
+   * Create a file with the name EXT_FILE_NAME and move the data set
+   * values into it, starting at byte location OFFSET.
+   */
+   status = SDsetexternalfile (sds_id, EXT_FILE_NAME, OFFSET);
+
+   /*
+   * Terminate access to the data set, SD interface, and file.
+   */
+   status = SDendaccess (sds_id);
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_read_from_sds.c b/mfhdf/examples/SD_read_from_sds.c
new file mode 100644
index 0000000..10988c6
--- /dev/null
+++ b/mfhdf/examples/SD_read_from_sds.c
@@ -0,0 +1,64 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+#define X_LENGTH      5
+#define Y_LENGTH      16
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index;
+   intn  status;
+   int32 start[2], edges[2];
+   int32 data[Y_LENGTH][X_LENGTH];
+   int   i, j;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Open the file for reading and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_READ);
+
+   /*
+   * Select the first data set.
+   */ 
+   sds_index = 0;
+   sds_id = SDselect (sd_id, sds_index);
+
+   /* 
+   * Set elements of array start to 0, elements of array edges 
+   * to SDS dimensions,and use NULL for the argument stride in SDreaddata
+   * to read the entire data.
+   */
+   start[0] = 0;
+   start[1] = 0;
+   edges[0] = Y_LENGTH;
+   edges[1] = X_LENGTH;
+
+   /*
+   * Read entire data into data array.
+   */
+   status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)data);
+
+   /* 
+   * Print 10th row; the following numbers should be displayed.
+   *
+   *         10 1000 12 13 14
+   */
+   for (j = 0; j < X_LENGTH; j++) printf ("%d ", data[9][j]);
+   printf ("\n");
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_read_subsets.c b/mfhdf/examples/SD_read_subsets.c
new file mode 100644
index 0000000..4524b76
--- /dev/null
+++ b/mfhdf/examples/SD_read_subsets.c
@@ -0,0 +1,127 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+#define SUB1_LENGTH   5
+#define SUB2_LENGTH   4
+#define SUB3_LENGTH1  2 
+#define SUB3_LENGTH2  3 
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index;
+   intn  status;
+   int32 start[2], edges[2], stride[2];
+   int32 sub1_data[SUB1_LENGTH];
+   int32 sub2_data[SUB2_LENGTH];
+   int32 sub3_data[SUB3_LENGTH2][SUB3_LENGTH1];
+   int   i, j;
+
+   /********************* End of variable declaration ***********************/
+        
+   /*
+   * Open the file for reading and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_READ);
+
+   /*
+   * Select the first data set.
+   */ 
+   sds_index = 0;
+   sds_id = SDselect (sd_id, sds_index);
+   /*
+   *         Reading the first subset.
+   *
+   * Set elements of start, edges, and stride arrays to read
+   * every 3rd element in the 2nd column starting at 4th row.   
+   */
+   start[0] = 3;   /* 4th row */
+   start[1] = 1;   /* 2nd column */
+   edges[0] = SUB1_LENGTH; /* SUB1_LENGTH elements are read along 2nd column*/
+   edges[1] = 1;
+   stride[0] = 3;  /* every 3rd element is read along 2nd column */
+   stride[1] = 1;
+
+   /*
+   * Read the data from the file into sub1_data array.
+   */
+   status = SDreaddata (sds_id, start, stride, edges, (VOIDP)sub1_data);
+
+   /* 
+   * Print what we have just read; the following numbers should be displayed:
+   *
+   *             5 8 1000 14 17   
+   */
+   for (j = 0; j < SUB1_LENGTH; j++) printf ("%d ", sub1_data[j]);
+   printf ("\n");
+
+   /* 
+   *         Reading the second subset.
+   *
+   * Set elements of start and edges arrays to read
+   * first 4 elements of the 10th row. 
+   */
+   start[0] = 9;  /* 10th row  */
+   start[1] = 0;  /* 1st column */
+   edges[0] = 1; 
+   edges[1] = SUB2_LENGTH; /* SUB2_LENGTH elements are read along 10th row */
+
+   /*
+   * Read data from the file into sub2_data array. Note that the third
+   * parameter is set to NULL for contiguous reading.
+   */
+   status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)sub2_data);
+
+   /* 
+   * Print what we have just read; the following numbers should be displayed:
+   *
+   *            10 1000 12 13 
+   */
+   for (j = 0; j < SUB2_LENGTH; j++) printf ("%d ", sub2_data[j]);
+   printf ("\n");
+
+   /* 
+   *         Reading the third subset.
+   *
+   * Set elements of the arrays start, edges, and stride to read
+   * every 6th element in the column and 4th element in the row
+   * starting at 1st column, 3d row.    
+   */
+   start[0] = 2;  /* 3d row */
+   start[1] = 0;  /* 1st column */
+   edges[0] = SUB3_LENGTH2; /* SUB3_LENGTH2 elements are read along
+                               each column */
+   edges[1] = SUB3_LENGTH1; /* SUB3_LENGTH1 elements are read along  
+                               each row */
+   stride[0] = 6; /* read every 6th element along each column */
+   stride[1] = 4; /* read every 4th element along each row */
+
+   /*
+   * Read the data from the file into sub3_data array.
+   */
+   status = SDreaddata (sds_id, start, stride, edges, (VOIDP)sub3_data);
+
+   /* 
+   * Print what we have just read; the following numbers should be displayed:
+   *
+   *            3 7 
+   *            9 13  
+   *            15 19 
+   */
+   for ( j = 0; j < SUB3_LENGTH2; j++ ) {
+       for (i = 0; i < SUB3_LENGTH1; i++) printf ("%d ", sub3_data[j][i]);
+       printf ("\n");
+   }
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_set_attr.c b/mfhdf/examples/SD_set_attr.c
new file mode 100644
index 0000000..0b82560
--- /dev/null
+++ b/mfhdf/examples/SD_set_attr.c
@@ -0,0 +1,76 @@
+#include "mfhdf.h"
+
+#define FILE_NAME      "SDS.hdf"
+#define FILE_ATTR_NAME "File_contents"
+#define SDS_ATTR_NAME  "Valid_range"
+#define DIM_ATTR_NAME  "Dim_metric"
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32   sd_id, sds_id, sds_index;
+   intn    status;
+   int32   dim_id, dim_index;
+   int32   n_values;                /* number of values of the file, SDS or
+                                       dimension attribute         */
+   char8   file_values[] = "Storm_track_data"; 
+                                   /* values of the file attribute */
+   float32 sds_values[2] = {2., 10.};
+                                   /* values of the SDS attribute  */
+   char8   dim_values[]  = "Seconds"; 
+                                  /* values of the dimension attribute */
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Open the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_WRITE);
+
+   /*
+   * Set an attribute that describes the file contents.
+   */
+   n_values = 16;
+   status = SDsetattr (sd_id, FILE_ATTR_NAME, DFNT_CHAR, n_values, 
+                       (VOIDP)file_values);
+
+   /*
+   * Select the first data set.
+   */
+   sds_index = 0;
+   sds_id = SDselect (sd_id, sds_index);
+
+   /* 
+   * Assign attribute to the first SDS. Note that attribute values
+   * may have different data type than SDS data.
+   */
+   n_values  = 2;
+   status = SDsetattr (sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, 
+                       (VOIDP)sds_values);
+
+   /*
+   * Get the the second dimension identifier of the SDS.
+   */
+   dim_index = 1;
+   dim_id = SDgetdimid (sds_id, dim_index);
+
+   /*
+   * Set an attribute of the dimension that specifies the dimension metric.
+   */
+   n_values = 7;
+   status = SDsetattr (dim_id, DIM_ATTR_NAME, DFNT_CHAR, n_values, 
+                       (VOIDP)dim_values);
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_set_get_dim_info.c b/mfhdf/examples/SD_set_get_dim_info.c
new file mode 100644
index 0000000..5e37e2e
--- /dev/null
+++ b/mfhdf/examples/SD_set_get_dim_info.c
@@ -0,0 +1,149 @@
+#include "mfhdf.h"
+
+
+#define FILE_NAME     "SDS.hdf"
+#define SDS_NAME      "SDStemplate"
+#define DIM_NAME_X     "X_Axis"
+#define DIM_NAME_Y     "Y_Axis"
+#define NAME_LENGTH   6
+#define X_LENGTH      5
+#define Y_LENGTH      16
+#define RANK          2
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32   sd_id, sds_id, sds_index;
+   intn    status;
+   int32   dim_index, dim_id;
+   int32   n_values, data_type, n_attrs;
+   int16   data_X[X_LENGTH];    /* X dimension dimension scale */
+   int16   data_X_out[X_LENGTH];
+   float64 data_Y[Y_LENGTH];  /* Y dimension dimension scale */
+   float64 data_Y_out[Y_LENGTH]; 
+   char    dim_name[NAME_LENGTH+1];
+   int     i, j, nrow;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Initialize dimension scales.
+   */
+   for (i=0; i < X_LENGTH; i++) data_X[i] = i;
+   for (i=0; i < Y_LENGTH; i++) data_Y[i] = 0.1 * i;
+      
+   /* 
+   * Open the file and initialize SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_WRITE);
+
+   /*
+   * Get the index of the data set specified in SDS_NAME.
+   */
+   sds_index = SDnametoindex (sd_id, SDS_NAME);
+
+   /*
+   * Select the data set corresponding to the returned index.
+   */
+   sds_id = SDselect (sd_id, sds_index);
+
+   /* For each dimension of the data set specified in SDS_NAME,
+   *  get its dimension identifier and set dimension name
+   *  and dimension scale. Note that data type of dimension scale 
+   *  can be different between dimensions and can be different from 
+   *  SDS data type.
+   */
+   for (dim_index = 0; dim_index < RANK; dim_index++) 
+   {
+       /* 
+       * Select the dimension at position dim_index.
+       */
+       dim_id = SDgetdimid (sds_id, dim_index);
+
+       /* 
+       * Assign name and dimension scale to selected dimension.
+       */
+       switch (dim_index)
+       {
+  case 0:  status = SDsetdimname (dim_id, DIM_NAME_Y);
+                n_values = Y_LENGTH;
+                status = SDsetdimscale (dim_id,n_values,DFNT_FLOAT64, \
+                                       (VOIDP)data_Y);  
+    break;
+  case 1:  status = SDsetdimname (dim_id, DIM_NAME_X);
+                n_values = X_LENGTH; 
+                status = SDsetdimscale (dim_id,n_values,DFNT_INT16, \
+                                       (VOIDP)data_X);  
+    break;
+  default: break;
+       }
+
+       /*
+       * Get and display info about the dimension and its scale values.
+       * The following information is displayed:
+       *                         
+       *         Information about 1 dimension:
+       *         dimension name is Y_Axis
+       *         number of scale values is 16
+       *         dimension scale data type is float64
+       *         number of dimension attributes is 0
+       *
+       *         Scale values are :
+       *               0.000    0.100    0.200    0.300  
+       *               0.400    0.500    0.600    0.700  
+       *               0.800    0.900    1.000    1.100  
+       *               1.200    1.300    1.400    1.500  
+       *
+       *         Information about 2 dimension:
+       *         dimension name is X_Axis
+       *         number of scale values is 5
+       *         dimension scale data type is int16
+       *         number of dimension attributes is 0
+       *
+       *         Scale values are :
+       *               0  1  2  3  4
+       */
+
+       status = SDdiminfo (dim_id, dim_name, &n_values, &data_type, &n_attrs);
+       printf ("Information about %d dimension:\n", dim_index+1);
+       printf ("dimension name is %s\n", dim_name);
+       printf ("number of scale values is %d\n", n_values);
+       if( data_type == DFNT_FLOAT64)
+       printf ("dimension scale data type is float64\n");
+       if( data_type == DFNT_INT16)
+       printf ("dimension scale data type is int16\n");
+       printf ("number of dimension attributes is %d\n", n_attrs);
+       printf ("\n");
+       printf ("Scale values are :\n");
+       switch (dim_index) 
+       {
+         case 0:  status = SDgetdimscale (dim_id, (VOIDP)data_Y_out);
+                  nrow = 4;
+                  for (i=0; i<n_values/nrow; i++ )
+                  {
+                      for (j=0; j<nrow; j++)
+                          printf ("  %-6.3f", data_Y_out[i*nrow + j]);
+                          printf ("\n");
+                  }
+                  break; 
+         case 1:  status = SDgetdimscale (dim_id, (VOIDP)data_X_out);
+                  for (i=0; i<n_values; i++) printf ("  %d", data_X_out[i]);
+                  break; 
+         default: break;
+        }
+        printf ("\n");
+   } /*for dim_index */
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_unlimited_sds.c b/mfhdf/examples/SD_unlimited_sds.c
new file mode 100644
index 0000000..5ed4fa1
--- /dev/null
+++ b/mfhdf/examples/SD_unlimited_sds.c
@@ -0,0 +1,119 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDSUNLIMITED.hdf"
+#define SDS_NAME      "AppendableData"
+#define X_LENGTH      10
+#define Y_LENGTH      10
+#define RANK          2
+
+int main() 
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index;
+   intn  status;
+   int32 dim_sizes[2];
+   int32 data[Y_LENGTH][X_LENGTH], append_data[X_LENGTH];
+   int32 start[2], edges[2];
+   int   i, j;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Data initialization.
+   */
+   for (j = 0; j < Y_LENGTH; j++) 
+   {
+       for (i = 0; i < X_LENGTH; i++)
+           data[j][i] = (i + 1) + (j + 1);
+   }
+
+   /*
+   * Create the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+
+   /*
+   * Define dimensions of the array. Make the first dimension 
+   * appendable by defining its length to be unlimited.
+   */
+   dim_sizes[0] = SD_UNLIMITED;
+   dim_sizes[1] = X_LENGTH;
+
+   /*
+   * Create the array data set.
+   */
+   sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes);
+
+   /*
+   * Define the location and the size of the data to be written 
+   * to the data set. 
+   */
+   start[0] = start[1] = 0;
+   edges[0] = Y_LENGTH;
+   edges[1] = X_LENGTH;
+
+   /*
+   * Write the data. 
+   */
+   status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)data);
+
+   /*
+   * Terminate access to the array data set, terminate access 
+   * to the SD interface, and close the file.
+   */
+   status = SDendaccess (sds_id);
+   status = SDend (sd_id);
+
+   /*
+   * Store the array values to be appended to the data set.
+   */
+   for (i = 0; i < X_LENGTH; i++)
+       append_data[i] = 1000 + i;
+
+   /*
+   * Reopen the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_WRITE);
+
+   /*
+   * Select the first data set. 
+   */ 
+   sds_index = 0; 
+   sds_id = SDselect (sd_id, sds_index);
+ 
+   /*  
+   * Check if selected SDS is unlimited. If it is not, then terminate access
+   * to the SD interface and close the file. 
+   */
+   if ( SDisrecord (sds_id) ) 
+   {
+
+   /*
+   * Define the location of the append to start at the first column 
+   * of the 11th row of the data set and to stop at the end of the
+   * eleventh row.
+   */
+   start[0] = Y_LENGTH;
+   start[1] = 0;
+   edges[0] = 1;
+   edges[1] = X_LENGTH;
+
+   /*
+   * Append data to the data set.
+   */
+   status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)append_data);
+   }
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_write_slab.c b/mfhdf/examples/SD_write_slab.c
new file mode 100644
index 0000000..9ac757b
--- /dev/null
+++ b/mfhdf/examples/SD_write_slab.c
@@ -0,0 +1,94 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SLABS.hdf"
+#define SDS_NAME      "FilledBySlabs"
+#define X_LENGTH      4
+#define Y_LENGTH      5
+#define Z_LENGTH      6
+#define RANK          3  
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id;
+   intn  status;
+   int32 dim_sizes[3], start[3], edges[3];
+   int32 data[Z_LENGTH][Y_LENGTH][X_LENGTH];
+   int32 zx_data[Z_LENGTH][X_LENGTH];
+   int   i, j, k;
+ 
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Data initialization. 
+   */
+   for (k = 0; k < Z_LENGTH; k++)
+       for (j = 0; j < Y_LENGTH; j++)
+           for (i = 0; i < X_LENGTH; i++)
+               data[k][j][i] = (i + 1) + (j + 1) + (k + 1);
+
+   /*
+   * Create the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+
+   /*
+   * Define dimensions of the array to be created.
+   */
+   dim_sizes[0] = Z_LENGTH;
+   dim_sizes[1] = Y_LENGTH;
+   dim_sizes[2] = X_LENGTH;
+
+   /*
+   * Create the array with the name defined in SDS_NAME.
+   */
+   sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes);
+
+   /*
+   * Set the parameters start and edges to write  
+   * a 6x4 element slab of data to the data set; note
+   * that edges[1] is set to 1 to define a 2-dimensional slab
+   * parallel to the ZX plane.  
+   * start[1] (slab position in the array) is initialized inside
+   * the for loop.
+   */
+   edges[0] = Z_LENGTH;
+   edges[1] = 1;
+   edges[2] = X_LENGTH;
+   start[0] = start[2] = 0;
+   for (j = 0; j < Y_LENGTH; j++)
+   {
+       start[1] = j;
+    
+       /*
+       * Initialize zx_data buffer (data slab).
+       */ 
+       for ( k = 0; k < Z_LENGTH; k++)
+       {
+           for ( i = 0; i < X_LENGTH; i++)
+           {
+                 zx_data[k][i] = data[k][j][i];
+           }
+   }
+
+   /*
+   * Write the data slab into the SDS array defined in SDS_NAME. 
+   * Note that the 3rd parameter is NULL which indicates that consecutive
+   * slabs in the Y direction are written.
+   */
+   status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)zx_data); 
+   }
+
+   /*
+   * Terminate access to the data set.
+   */ 
+   status = SDendaccess (sds_id);
+    
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/SD_write_to_sds.c b/mfhdf/examples/SD_write_to_sds.c
new file mode 100644
index 0000000..08d52bd
--- /dev/null
+++ b/mfhdf/examples/SD_write_to_sds.c
@@ -0,0 +1,65 @@
+#include "mfhdf.h"
+
+#define FILE_NAME     "SDS.hdf"
+#define X_LENGTH      5
+#define Y_LENGTH      16
+
+int main()
+{
+   /************************* Variable declaration **************************/
+
+   int32 sd_id, sds_id, sds_index;
+   intn  status;
+   int32 start[2], edges[2];
+   int32 data[Y_LENGTH][X_LENGTH];
+   int   i, j;
+
+   /********************* End of variable declaration ***********************/
+
+   /*
+   * Data set data initialization.
+   */
+   for (j = 0; j < Y_LENGTH; j++) {
+       for (i = 0; i < X_LENGTH; i++)
+            data[j][i] = (i + j) + 1;
+   }
+
+   /*
+   * Open the file and initialize the SD interface.
+   */
+   sd_id = SDstart (FILE_NAME, DFACC_WRITE);
+
+   /*
+   * Attach to the first data set.
+   */ 
+   sds_index = 0;
+   sds_id = SDselect (sd_id, sds_index);
+
+   /* 
+   * Define the location and size of the data to be written to the data set.
+   */
+   start[0] = 0;
+   start[1] = 0;
+   edges[0] = Y_LENGTH;
+   edges[1] = X_LENGTH;
+
+   /*
+   * Write the stored data to the data set. The third argument is set to NULL
+   * to specify contiguous data elements. The last argument must
+   * be explicitly cast to a generic pointer since SDwritedata is designed
+   * to write generic data. 
+   */
+   status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)data);
+
+   /*
+   * Terminate access to the data set.
+   */
+   status = SDendaccess (sds_id);
+
+   /*
+   * Terminate access to the SD interface and close the file.
+   */
+   status = SDend (sd_id);
+
+   return 0;
+}
diff --git a/mfhdf/examples/testexamples.sh.in b/mfhdf/examples/testexamples.sh.in
new file mode 100755
index 0000000..f3bd51e
--- /dev/null
+++ b/mfhdf/examples/testexamples.sh.in
@@ -0,0 +1,18 @@
+# This test script only runs all the examples right now.  It needs
+# a lot of work.  It should use h4cc to build the examples too.
+./create_sds
+./write_to_sds
+./write_slab
+./read_from_sds
+./alter_sds_values
+./chunking_example
+./compress_sds
+./dimscale_vs_sds
+./find_sds_by_name
+./set_attr
+./get_attr
+./get_info
+./mv_sds_to_external
+./read_subsets
+./set_get_dim_info
+./unlimited_sds
diff --git a/mfhdf/fortran/CMakeLists.txt b/mfhdf/fortran/CMakeLists.txt
new file mode 100644
index 0000000..bddfe01
--- /dev/null
+++ b/mfhdf/fortran/CMakeLists.txt
@@ -0,0 +1,114 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_FORTRAN C CXX Fortran)
+
+INCLUDE_DIRECTORIES (
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_HDF_BINARY_DIR}
+    ${HDF4_MFHDF_FORTRAN_BINARY_DIR}
+    ${HDF4_HDFSOURCE_DIR}
+    ${HDF4_MFHDFSOURCE_DIR}
+    ${HDF4_HDF_TESTSOURCE_DIR}
+)
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (HDF4_ENABLE_NETCDF)
+  CONFIGURE_FILE (${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/ftest.f.in ${HDF4_BINARY_DIR}/ftest.f)
+  CONFIGURE_FILE (${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/jackets.c.in ${HDF4_BINARY_DIR}/jackets.c)
+ENDIF (HDF4_ENABLE_NETCDF)
+CONFIGURE_FILE (${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/netcdf.inc.in ${HDF4_BINARY_DIR}/netcdf.inc)
+SET (HDF4_MFHDF_FORTRAN_XFHDRS ${HDF4_BINARY_DIR}/netcdf.inc ${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/mffunc.inc)
+
+IF (HDF4_ENABLE_NETCDF)
+  SET (HDF4_MFHDF_LIBSRC_CSTUB_FSRCS ${HDF4_BINARY_DIR}/jackets.c ${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/mfsdf.c)
+ELSE (HDF4_ENABLE_NETCDF)
+  SET (HDF4_MFHDF_LIBSRC_CSTUB_FSRCS ${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/mfsdf.c)
+ENDIF (HDF4_ENABLE_NETCDF)
+
+SET (HDF4_MFHDF_LIBSRC_CSTUB_FHDRS 
+    ${HDF4_MFHDFSOURCE_DIR}/hdf2netcdf.h 
+    ${HDF4_MFHDFSOURCE_DIR}/mfhdf.h 
+    ${HDF4_MFHDFSOURCE_DIR}/mfhdfi.h
+)
+IF (HDF4_ENABLE_NETCDF)
+#  SET (HDF4_MFHDF_LIBSRC_CSTUB_FSRCS ${HDF4_MFHDF_LIBSRC_CSTUB_FSRCS} ${HDF4_BINARY_DIR}/jackets.c)
+  SET (HDF4_MFHDF_LIBSRC_CSTUB_FHDRS ${HDF4_MFHDF_LIBSRC_CSTUB_FHDRS} ${HDF4_BINARY_DIR}/netcdf.h)
+ELSE (HDF4_ENABLE_NETCDF)
+  SET (HDF4_MFHDF_LIBSRC_CSTUB_FHDRS ${HDF4_MFHDF_LIBSRC_CSTUB_FHDRS} ${HDF4_BINARY_DIR}/hdf4_netcdf.h)
+ENDIF (HDF4_ENABLE_NETCDF)
+
+SET (FORTRAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+#-----------------------------------------------------------------------------
+# Add Main fortran library
+#-----------------------------------------------------------------------------
+ADD_LIBRARY (${HDF4_MF_FCSTUB_LIB_TARGET} ${LIB_TYPE} ${HDF4_MFHDF_LIBSRC_CSTUB_FSRCS} ${HDF4_MFHDF_LIBSRC_CSTUB_FHDRS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h)
+SET_TARGET_PROPERTIES (${HDF4_MF_FCSTUB_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C)
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+  TARGET_LINK_LIBRARIES (${HDF4_MF_FCSTUB_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_C_PROPERTIES (${HDF4_MF_FCSTUB_LIB_TARGET} " " " ")
+TARGET_LINK_LIBRARIES (${HDF4_MF_FCSTUB_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET})
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_MF_FCSTUB_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_MF_FCSTUB_LIB_TARGET} ${HDF4_MF_FCSTUB_LIB_NAME} ${LIB_TYPE})
+
+SET (HDF4_MF_FORTRAN_SRCS 
+    ${HDF4_MFHDF_FORTRAN_DIR}/mfsdff.f
+)
+#-----------------------------------------------------------------------------
+ADD_LIBRARY (${HDF4_MF_FORTRAN_LIB_TARGET} ${LIB_TYPE} ${HDF4_MF_FORTRAN_SRCS})
+SET (SHARED_LINK_FLAGS " ")
+IF (WIN32)
+  IF (${LIB_TYPE} MATCHES "SHARED")
+    IF (MSVC)
+      SET (SHARED_LINK_FLAGS "/DLL /DEF:${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/mfhdf_fortrandll.def")
+    ENDIF (MSVC)
+  ENDIF (${LIB_TYPE} MATCHES "SHARED")
+ENDIF (WIN32)
+TARGET_FORTRAN_PROPERTIES (${HDF4_MF_FORTRAN_LIB_TARGET} " " ${SHARED_LINK_FLAGS})
+SET_TARGET_PROPERTIES (${HDF4_MF_FORTRAN_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
+TARGET_LINK_LIBRARIES (${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_MF_FCSTUB_LIB_TARGET} ${LINK_LIBS})
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_MF_FORTRAN_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_MF_FORTRAN_LIB_NAME} ${LIB_TYPE})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+    FILES
+        ${HDF4_MFHDF_FORTRAN_XFHDRS}
+    DESTINATION
+        ${HDF4_INSTALL_INCLUDE_DIR}
+    COMPONENT
+        headers
+)
+
+#-----------------------------------------------------------------------------
+# Add library to CMake Install : Installs lib and cmake config info
+#-----------------------------------------------------------------------------
+IF (BUILD_SHARED_LIBS)
+  INSTALL_TARGET_PDB (${HDF4_MF_FCSTUB_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} fortlibraries)
+  INSTALL_TARGET_PDB (${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} fortlibraries)
+ENDIF (BUILD_SHARED_LIBS)
+  
+INSTALL (
+    TARGETS 
+        ${HDF4_MF_FCSTUB_LIB_TARGET}
+        ${HDF4_MF_FORTRAN_LIB_TARGET}
+    EXPORT 
+        ${HDF4_EXPORTED_TARGETS}
+    LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT fortlibraries 
+    ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT fortlibraries
+    RUNTIME DESTINATION ${HDF4_INSTALL_BIN_DIR} COMPONENT fortlibraries
+)
diff --git a/mfhdf/fortran/CMakeTests.cmake b/mfhdf/fortran/CMakeTests.cmake
new file mode 100644
index 0000000..c060833
--- /dev/null
+++ b/mfhdf/fortran/CMakeTests.cmake
@@ -0,0 +1,162 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+  FILE (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/testdir)
+
+  #-----------------------------------------------------------------------------
+  # test programs
+  #-----------------------------------------------------------------------------
+  IF (HDF4_ENABLE_NETCDF)
+    #-- Adding test for ftest
+    ADD_EXECUTABLE (ftest ${HDF4_BINARY_DIR}/ftest.f ${HDF4_HDF_TESTSOURCE_DIR}/forsupff.f ${HDF4_BINARY_DIR}/netcdf.inc)
+    TARGET_NAMING (ftest ${LIB_TYPE})
+    TARGET_FORTRAN_PROPERTIES (ftest " " " ")
+    SET_TARGET_PROPERTIES (ftest PROPERTIES LINKER_LANGUAGE Fortran)
+    IF (HDF4_BUILD_XDR_LIB)
+      TARGET_LINK_LIBRARIES (ftest ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET} ${LINK_LIBS})
+    ELSE (HDF4_BUILD_XDR_LIB)
+      TARGET_LINK_LIBRARIES (ftest ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+    ENDIF (HDF4_BUILD_XDR_LIB)
+
+    #-- Copy all the dat files from the test directory into the source directory
+    SET (HDF4_REFERENCE_TEST_FILES
+      test_nc.cdl
+      test_nc.nc
+    )
+    FOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+      SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+      #MESSAGE (STATUS " Copying ${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
+      ADD_CUSTOM_COMMAND (
+          TARGET     ftest 
+          POST_BUILD
+          COMMAND    ${CMAKE_COMMAND}
+          ARGS       -E copy_if_different ${HDF4_MFHDF_FORTRAN_SOURCE_DIR}/${h4_file} ${dest}
+      )
+    ENDFOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+
+    ADD_TEST (NAME ftest COMMAND $<TARGET_FILE:ftest>)
+  ENDIF (HDF4_ENABLE_NETCDF)
+
+  #-- Adding test for f_hdftest
+  ADD_EXECUTABLE (f_hdftest hdftest.f)
+  TARGET_NAMING (f_hdftest ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (f_hdftest " " " ")
+  SET_TARGET_PROPERTIES (f_hdftest PROPERTIES LINKER_LANGUAGE Fortran)
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_hdftest ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET} ${LINK_LIBS})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_hdftest ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+
+  #-- Adding test for f_hdftest1
+  ADD_EXECUTABLE (f_hdftest1 hdftest1.f)
+  TARGET_NAMING (f_hdftest1 ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (f_hdftest1 " " " ")
+  SET_TARGET_PROPERTIES (f_hdftest1 PROPERTIES LINKER_LANGUAGE Fortran)
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_hdftest1 ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET} ${LINK_LIBS})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_hdftest1 ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+
+  #-- Adding test for f_tszip
+  ADD_EXECUTABLE (f_tszip tszip.f)
+  TARGET_NAMING (f_tszip ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (f_tszip " " " ")
+  SET_TARGET_PROPERTIES (f_tszip PROPERTIES LINKER_LANGUAGE Fortran)
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_tszip ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET} ${LINK_LIBS})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_tszip ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME MFHDF_FORTRAN-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          cchunk_gz.hdf
+          cchunk_nb.hdf
+          cchunk_no.hdf
+          cchunk_rl.hdf
+          cchunk_sk.hdf
+          chunk_gz.hdf
+          chunk_nb.hdf
+          chunk_no.hdf
+          chunk_rl.hdf
+          chunk_sk.hdf
+          comp_gz.hdf
+          comp_no.hdf
+          comp_rl.hdf
+          comp_sk.hdf
+          comp_szip.hdf
+          copy.nc
+          test.nc
+          test1.hdf
+          test2.hdf
+          test_empty.hdf
+          test_var.hdf
+          test_file.hdf
+          test_file01.hdf
+          test_file02.hdf
+          test_file03.hdf
+          test_file04.hdf
+          test_file05.hdf
+          test_file06.hdf
+          test_file07.hdf
+          test_file08.hdf
+          test_file09.hdf
+          test_file10.hdf
+          test_file11.hdf
+          test_file12.hdf
+          test_file13.hdf
+          test_file14.hdf
+          test_file15.hdf
+          test_file16.hdf
+          test_file17.hdf
+          test_file18.hdf
+          test_file19.hdf
+          test_file20.hdf
+          test_file21.hdf
+          test_file22.hdf
+          test_file23.hdf
+          test_file24.hdf
+          test_file25.hdf
+          test_file26.hdf
+          test_file27.hdf
+          test_file28.hdf
+          test_file29.hdf
+          test_file30.hdf
+          test_file31.hdf
+          test_file32.hdf
+          test_file33.hdf
+          test_file34.hdf
+          test_file35.hdf
+  )
+  IF (HDF4_ENABLE_NETCDF)
+    SET_TESTS_PROPERTIES (MFHDF_FORTRAN-clearall-objects PROPERTIES DEPENDS ftest LABELS ${PROJECT_NAME})
+  ENDIF (HDF4_ENABLE_NETCDF)
+
+  ADD_TEST (NAME f_hdftest COMMAND $<TARGET_FILE:f_hdftest>)
+  SET (passRegex "Total errors : [ ]+0")
+  SET_PROPERTY (TEST f_hdftest PROPERTY PASS_REGULAR_EXPRESSION "${passRegex}")
+  SET_TESTS_PROPERTIES (f_hdftest PROPERTIES DEPENDS MFHDF_FORTRAN-clearall-objects LABELS ${PROJECT_NAME})
+
+  ADD_TEST (NAME f_hdftest1 COMMAND $<TARGET_FILE:f_hdftest1>)
+  SET (failRegex "failed" "errors")
+  SET_PROPERTY (TEST f_hdftest1 PROPERTY FAIL_REGULAR_EXPRESSION "${failRegex}")
+  SET_TESTS_PROPERTIES (f_hdftest1 PROPERTIES DEPENDS f_hdftest LABELS ${PROJECT_NAME})
+
+  ADD_TEST (NAME f_tszip COMMAND $<TARGET_FILE:f_tszip>)
+  SET (failRegex "failed" "errors")
+  SET_PROPERTY (TEST f_tszip PROPERTY FAIL_REGULAR_EXPRESSION "${failRegex}")
+  SET_TESTS_PROPERTIES (f_tszip PROPERTIES DEPENDS f_hdftest1 LABELS ${PROJECT_NAME})
diff --git a/mfhdf/fortran/Makefile.am b/mfhdf/fortran/Makefile.am
new file mode 100644
index 0000000..cfc869a
--- /dev/null
+++ b/mfhdf/fortran/Makefile.am
@@ -0,0 +1,89 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/hdf/test       \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+DIST_SUBDIRS = examples
+
+#############################################################################
+##                   Testing -- Here there be dragons.                     ##
+#############################################################################
+
+if HDF_BUILD_NETCDF
+include_HEADERS = netcdf.inc netcdf.f90 mffunc.inc mffunc.f90
+check_PROGRAMS = ftest hdftest tszip hdftest1
+else
+include_HEADERS = mffunc.inc mffunc.f90
+check_PROGRAMS =  hdftest tszip hdftest1
+endif
+
+TEST_SCRIPT = testfortran.sh
+check_SCRIPTS = testfortran.sh
+
+if HDF_BUILD_NETCDF
+ftest_SOURCES = ftest.f
+ftest_LDADD = $(top_builddir)/hdf/test/forsupff.o $(top_builddir)/hdf/test/forsupf.o \
+              $(LIBMFHDF) $(LIBHDF) @LIBS@
+ftest_DEPENDENCIES = $(top_builddir)/hdf/test/forsupff.o $(top_builddir)/hdf/test/forsupf.o \
+                     $(LIBMFHDF) $(LIBHDF)
+endif
+
+hdftest_SOURCES = hdftest.f
+hdftest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+hdftest_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
+
+hdftest1_SOURCES = hdftest1.f
+hdftest1_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+hdftest1_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
+
+tszip_SOURCES = tszip.f
+tszip_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+tszip_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
+
+testdir:
+	-mkdir testdir
+
+SUFFIXES = .inc .f90
+.inc.f90:
+	sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $< > $*.f90
+
+# Recurse into examples directory for examples tests.
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+	
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples; do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += test.nc copy.nc *.hdf testdir/testext.hdf
+
+# Automake's distclean won't remove directories, so we can add an additional
+# hook target which will do so during 'make distclean'.
+distclean-local:
+	-rm -rf testdir
+
+DISTCLEANFILES = ftest.f jackets.c netcdf.inc mffunc.f90 netcdf.f90
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/fortran/Makefile.in b/mfhdf/fortran/Makefile.in
new file mode 100644
index 0000000..ecc4b55
--- /dev/null
+++ b/mfhdf/fortran/Makefile.in
@@ -0,0 +1,989 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/ftest.f.in \
+	$(srcdir)/jackets.c.in $(srcdir)/netcdf.inc.in \
+	$(srcdir)/testfortran.sh.in $(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+ at HDF_BUILD_NETCDF_FALSE@check_PROGRAMS = hdftest$(EXEEXT) \
+ at HDF_BUILD_NETCDF_FALSE@	tszip$(EXEEXT) hdftest1$(EXEEXT)
+ at HDF_BUILD_NETCDF_TRUE@check_PROGRAMS = ftest$(EXEEXT) \
+ at HDF_BUILD_NETCDF_TRUE@	hdftest$(EXEEXT) tszip$(EXEEXT) \
+ at HDF_BUILD_NETCDF_TRUE@	hdftest1$(EXEEXT)
+TESTS = $(TEST_SCRIPT)
+subdir = mfhdf/fortran
+SUBDIRS =
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = ftest.f jackets.c netcdf.inc testfortran.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__ftest_SOURCES_DIST = ftest.f
+ at HDF_BUILD_NETCDF_TRUE@am_ftest_OBJECTS = ftest.$(OBJEXT)
+ftest_OBJECTS = $(am_ftest_OBJECTS)
+am_hdftest_OBJECTS = hdftest.$(OBJEXT)
+hdftest_OBJECTS = $(am_hdftest_OBJECTS)
+am_hdftest1_OBJECTS = hdftest1.$(OBJEXT)
+hdftest1_OBJECTS = $(am_hdftest1_OBJECTS)
+am_tszip_OBJECTS = tszip.$(OBJEXT)
+tszip_OBJECTS = $(am_tszip_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
+F77LD = $(F77)
+F77LINK = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(ftest_SOURCES) $(hdftest_SOURCES) $(hdftest1_SOURCES) \
+	$(tszip_SOURCES)
+DIST_SOURCES = $(am__ftest_SOURCES_DIST) $(hdftest_SOURCES) \
+	$(hdftest1_SOURCES) $(tszip_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__include_HEADERS_DIST = mffunc.inc mffunc.f90 netcdf.inc netcdf.f90
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(include_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog test.nc copy.nc *.hdf \
+	testdir/testext.hdf
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/hdf/test       \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+DIST_SUBDIRS = examples
+ at HDF_BUILD_NETCDF_FALSE@include_HEADERS = mffunc.inc mffunc.f90
+
+#############################################################################
+#############################################################################
+ at HDF_BUILD_NETCDF_TRUE@include_HEADERS = netcdf.inc netcdf.f90 mffunc.inc mffunc.f90
+TEST_SCRIPT = testfortran.sh
+check_SCRIPTS = testfortran.sh
+ at HDF_BUILD_NETCDF_TRUE@ftest_SOURCES = ftest.f
+ at HDF_BUILD_NETCDF_TRUE@ftest_LDADD = $(top_builddir)/hdf/test/forsupff.o $(top_builddir)/hdf/test/forsupf.o \
+ at HDF_BUILD_NETCDF_TRUE@              $(LIBMFHDF) $(LIBHDF) @LIBS@
+
+ at HDF_BUILD_NETCDF_TRUE@ftest_DEPENDENCIES = $(top_builddir)/hdf/test/forsupff.o $(top_builddir)/hdf/test/forsupf.o \
+ at HDF_BUILD_NETCDF_TRUE@                     $(LIBMFHDF) $(LIBHDF)
+
+hdftest_SOURCES = hdftest.f
+hdftest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+hdftest_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
+hdftest1_SOURCES = hdftest1.f
+hdftest1_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+hdftest1_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
+tszip_SOURCES = tszip.f
+tszip_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+tszip_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
+SUFFIXES = .inc .f90
+DISTCLEANFILES = ftest.f jackets.c netcdf.inc mffunc.f90 netcdf.f90
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .inc .f90 .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/fortran/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/fortran/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+ftest.f: $(top_builddir)/config.status $(srcdir)/ftest.f.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+jackets.c: $(top_builddir)/config.status $(srcdir)/jackets.c.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+netcdf.inc: $(top_builddir)/config.status $(srcdir)/netcdf.inc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+testfortran.sh: $(top_builddir)/config.status $(srcdir)/testfortran.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+ftest$(EXEEXT): $(ftest_OBJECTS) $(ftest_DEPENDENCIES) $(EXTRA_ftest_DEPENDENCIES) 
+	@rm -f ftest$(EXEEXT)
+	$(F77LINK) $(ftest_OBJECTS) $(ftest_LDADD) $(LIBS)
+hdftest$(EXEEXT): $(hdftest_OBJECTS) $(hdftest_DEPENDENCIES) $(EXTRA_hdftest_DEPENDENCIES) 
+	@rm -f hdftest$(EXEEXT)
+	$(F77LINK) $(hdftest_OBJECTS) $(hdftest_LDADD) $(LIBS)
+hdftest1$(EXEEXT): $(hdftest1_OBJECTS) $(hdftest1_DEPENDENCIES) $(EXTRA_hdftest1_DEPENDENCIES) 
+	@rm -f hdftest1$(EXEEXT)
+	$(F77LINK) $(hdftest1_OBJECTS) $(hdftest1_LDADD) $(LIBS)
+tszip$(EXEEXT): $(tszip_OBJECTS) $(tszip_DEPENDENCIES) $(EXTRA_tszip_DEPENDENCIES) 
+	@rm -f tszip$(EXEEXT)
+	$(F77LINK) $(tszip_OBJECTS) $(tszip_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+cscopelist-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+		am__skip_mode_fix=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-recursive
+all-am: Makefile $(HEADERS) all-local
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-local distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
+	cscopelist-recursive ctags-recursive install-am install-strip \
+	tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am all-local check check-TESTS check-am clean \
+	clean-checkPROGRAMS clean-generic clean-libtool cscopelist \
+	cscopelist-recursive ctags ctags-recursive distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-local distclean-tags distdir dvi dvi-am html html-am \
+	info info-am install install-am install-data install-data-am \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-includeHEADERS \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installcheck-local installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am tags \
+	tags-recursive uninstall uninstall-am uninstall-includeHEADERS
+
+
+testdir:
+	-mkdir testdir
+.inc.f90:
+	sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $< > $*.f90
+
+# Recurse into examples directory for examples tests.
+installcheck-local:
+	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+
+# 'make install-all' also installs examples
+install-all:
+	@$(MAKE) $(AM_MAKEFLAGS) install
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-all:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+# Install examples recursively
+install-examples uninstall-examples:
+	@@SETX@; for d in examples; do \
+	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
+	done
+
+# Automake's distclean won't remove directories, so we can add an additional
+# hook target which will do so during 'make distclean'.
+distclean-local:
+	-rm -rf testdir
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/fortran/common.inc b/mfhdf/fortran/common.inc
new file mode 100644
index 0000000..9f55f56
--- /dev/null
+++ b/mfhdf/fortran/common.inc
@@ -0,0 +1,147 @@
+c      
+c     Functions in the FORTRAN interface
+
+      integer nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
+      integer ncsfil
+      external nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
+      external ncsfil
+
+      integer NCRDWR,NCCREAT,NCEXCL,NCINDEF,NCNSYNC,NCHSYNC
+      integer NCNDIRTY,NCHDIRTY,NCLINK,NCNOWRIT,NCWRITE
+      integer NCCLOB,NCNOCLOB,NCGLOBAL,NCFILL,NCNOFILL
+      integer MAXNCOP,MAXNCDIM,MAXNCATT,MAXNCVAR
+      integer MAXNCNAM,MAXVDIMS,NCNOERR,NCEBADID
+      integer NCENFILE,NCEEXIST,NCEINVAL,NCEPERM,NCENOTIN
+      integer NCEINDEF,NCECOORD,NCEMAXDS,NCENAME
+      integer NCENOATT,NCEMAXAT,NCEBADTY,NCEBADD, NCESTS
+      integer NCEUNLIM,NCEMAXVS,NCENOTVR,NCEGLOB,NCENOTNC
+      integer NCFOOBAR,NCSYSERR,NCFATAL,NCVERBOS, NCENTOOL
+      
+      integer NCBYTE,NCCHAR,NCSHORT,NCLONG,NCFLOAT,NCDOUBLE
+      
+      parameter(NCBYTE = 1)
+      parameter(NCCHAR = 2)
+      parameter(NCSHORT = 3)
+      parameter(NCLONG = 4)
+      parameter(NCFLOAT = 5)
+      parameter(NCDOUBLE = 6)
+      
+c     
+c     masks for the struct NC flag field; passed in as 'mode' arg to
+c     nccreate and ncopen.
+c     
+      
+c     read/write, 0 => readonly 
+      parameter(NCRDWR = 1)
+c     in create phase, cleared by ncendef 
+      parameter(NCCREAT = 2)
+c     on create destroy existing file 
+      parameter(NCEXCL = 4)
+c     in define mode, cleared by ncendef 
+      parameter(NCINDEF = 8)
+c     synchronise numrecs on change (X'10')
+      parameter(NCNSYNC = 16)
+c     synchronise whole header on change (X'20')
+      parameter(NCHSYNC = 32)
+c     numrecs has changed (X'40')
+      parameter(NCNDIRTY = 64)	
+c     header info has changed (X'80')
+      parameter(NCHDIRTY = 128)
+c     prefill vars on endef and increase of record, the default behavior
+      parameter(NCFILL = 0)
+c     don't fill vars on endef and increase of record (X'100')
+      parameter(NCNOFILL = 256)
+c     isa link (X'8000')
+      parameter(NCLINK = 32768)
+      
+c     
+c     'mode' arguments for nccreate and ncopen
+c     
+      
+      parameter(NCNOWRIT = 0)
+      parameter(NCWRITE = NCRDWR)
+      parameter(NCCLOB = 11)
+      parameter(NCNOCLOB = 15)
+c     
+c     'size' argument to ncdimdef for an unlimited dimension
+c     
+      LONG_INT NCUNLIM
+      parameter(NCUNLIM = 0)
+      
+c     
+c     attribute id to put/get a global attribute
+c     
+      parameter(NCGLOBAL  = 0)
+c     
+c     Advisory Maximums
+c     
+      parameter(MAXNCOP = 32)
+      parameter(MAXNCDIM = 32)
+      parameter(MAXNCATT = 512)
+      parameter(MAXNCVAR = 512)
+c     Not enforced 
+      parameter(MAXNCNAM = 128)
+      parameter(MAXVDIMS = MAXNCDIM)
+      
+      
+c     
+c     The netcdf data types
+c     
+      
+c     
+c     Global netcdf error status variable
+c     Initialized in error.c
+c     
+      
+c     No Error 
+      parameter(NCNOERR = 0)
+c     Not a netcdf id 
+      parameter(NCEBADID = 1)
+c     Too many netcdfs open 
+      parameter(NCENFILE = 2)	
+c     netcdf file exists && NCNOCLOB
+      parameter(NCEEXIST = 3)
+c     Invalid Argument 
+      parameter(NCEINVAL = 4)
+c     Write to read only 
+      parameter(NCEPERM = 5)
+c     Operation not allowed in data mode 
+      parameter(NCENOTIN = 6)	
+c     Operation not allowed in define mode 
+      parameter(NCEINDEF = 7)	
+c     Coordinates out of Domain 
+      parameter(NCECOORD = 8)
+c     MAXNCDIMS exceeded 
+      parameter(NCEMAXDS = 9)
+c     String match to name in use 
+      parameter(NCENAME = 10)	
+c     Attribute not found 
+      parameter(NCENOATT = 11)
+c     MAXNCATTRS exceeded 
+      parameter(NCEMAXAT = 12)
+c     Not a netcdf data type 
+      parameter(NCEBADTY = 13)
+c     Invalid dimension id 
+      parameter(NCEBADD = 14)	
+c     NCUNLIMITED in the wrong index 
+      parameter(NCEUNLIM = 15)
+c     MAXNCVARS exceeded 
+      parameter(NCEMAXVS = 16)
+c     Variable not found 
+      parameter(NCENOTVR = 17)
+c     Action prohibited on NCGLOBAL varid 
+      parameter(NCEGLOB = 18)
+c     Not a netcdf file 
+      parameter(NCENOTNC = 19)
+      parameter(NCESTS = 20)
+      parameter (NCENTOOL = 21)	
+      parameter(NCFOOBAR = 32)
+      parameter(NCSYSERR = -1)
+      
+      
+c     
+c     Global options variable. Used to determine behavior of error handler.
+c     Initialized in lerror.c
+c     
+      parameter(NCFATAL = 1)
+      parameter(NCVERBOS = 2)
diff --git a/mfhdf/fortran/depend b/mfhdf/fortran/depend
new file mode 100644
index 0000000..e45e5da
--- /dev/null
+++ b/mfhdf/fortran/depend
@@ -0,0 +1,31 @@
+jackets.o: jackets.c
+jackets.o: ../../mfhdf/libsrc/local_nc.h
+jackets.o: ../../mfhdf/libsrc/netcdf.h
+jackets.o: ../../hdf/src//hlimits.h
+jackets.o: ../../hdf/src//hdf.h
+jackets.o: ../../hdf/src//hdfi.h
+jackets.o: ../../hdf/src//hntdefs.h
+jackets.o: ../../hdf/src//htags.h
+jackets.o: ../../hdf/src//hbitio.h
+jackets.o: ../../hdf/src//hcomp.h
+jackets.o: ../../hdf/src//herr.h
+jackets.o: ../../hdf/src//hproto.h
+jackets.o: ../../hdf/src//vg.h
+jackets.o: ../../hdf/src//hfile.h
+jackets.o: ../../hdf/src//tbbt.h
+mfsdf.o: mfsdf.c
+mfsdf.o: ../../mfhdf/libsrc/mfhdf.h
+mfsdf.o: ../../mfhdf/libsrc/local_nc.h
+mfsdf.o: ../../mfhdf/libsrc/netcdf.h
+mfsdf.o: ../../hdf/src//hlimits.h
+mfsdf.o: ../../hdf/src//hdf.h
+mfsdf.o: ../../hdf/src//hdfi.h
+mfsdf.o: ../../hdf/src//hntdefs.h
+mfsdf.o: ../../hdf/src//htags.h
+mfsdf.o: ../../hdf/src//hbitio.h
+mfsdf.o: ../../hdf/src//hcomp.h
+mfsdf.o: ../../hdf/src//herr.h
+mfsdf.o: ../../hdf/src//hproto.h
+mfsdf.o: ../../hdf/src//vg.h
+mfsdf.o: ../../hdf/src//hfile.h
+mfsdf.o: ../../hdf/src//tbbt.h
diff --git a/mfhdf/fortran/examples/CMakeLists.txt b/mfhdf/fortran/examples/CMakeLists.txt
new file mode 100644
index 0000000..c27a952
--- /dev/null
+++ b/mfhdf/fortran/examples/CMakeLists.txt
@@ -0,0 +1,76 @@
+cmake_minimum_required (VERSION 2.8.10)
+# --------------------------------------------------------------------
+# Notes: When creating examples they should be prefixed
+# with "f_ex_". This allows for easier filtering of the examples.
+# --------------------------------------------------------------------
+PROJECT (HDF4_MFHDF_FORTRAN_EXAMPLES C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_HDF_BINARY_DIR}
+    ${HDF4_HDFSOURCE_DIR}
+)
+LINK_DIRECTORIES (
+    ${CMAKE_Fortran_MODULE_DIRECTORY}
+    ${HDF4_MFHDF_BINARY_DIR}
+    ${HDF4_HDF_BINARY_DIR}
+    ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (examples
+    SD_create_sds 
+    SD_write_to_sds 
+    SD_write_slab 
+    SD_alter_sds_values 
+    SD_unlimited_sds
+    SD_mv_sds_to_external 
+    SD_read_from_sds 
+    SD_read_subsets 
+    #SD_get_info
+    SD_find_sds_by_name 
+    SD_set_get_dim_info 
+    #SD_dimscale_vs_sds 
+    SD_set_attr
+    #SD_get_attr 
+    SD_compress_sds 
+    SD_chunking_example
+)
+SET (skip_examples
+    SD_get_info
+    SD_dimscale_vs_sds 
+    SD_get_attr 
+)
+
+FOREACH (example ${examples})
+  ADD_EXECUTABLE (f_exmf_${example} ${HDF4_MFHDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
+  TARGET_NAMING (f_exmf_${example} ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (f_exmf_${example} " " " ")
+  SET_TARGET_PROPERTIES (f_exmf_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_exmf_${example} ${HDF4_MF_FORTRAN_LIB_TARGET}  ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_exmf_${example} ${HDF4_MF_FORTRAN_LIB_TARGET}  ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+ENDFOREACH (example ${examples})
+
+FOREACH (example ${skip_examples})
+  ADD_EXECUTABLE (f_exmf_${example} ${HDF4_MFHDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
+  TARGET_NAMING (f_exmf_${example} ${LIB_TYPE})
+  TARGET_FORTRAN_PROPERTIES (f_exmf_${example} " " " ")
+  SET_TARGET_PROPERTIES (f_exmf_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_exmf_${example} ${HDF4_MF_FORTRAN_LIB_TARGET}  ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (f_exmf_${example} ${HDF4_MF_FORTRAN_LIB_TARGET}  ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+ENDFOREACH (example ${skip_examples})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
diff --git a/mfhdf/fortran/examples/CMakeTests.cmake b/mfhdf/fortran/examples/CMakeTests.cmake
new file mode 100644
index 0000000..bf0b978
--- /dev/null
+++ b/mfhdf/fortran/examples/CMakeTests.cmake
@@ -0,0 +1,34 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME MFHDF_FORTRAN_EXAMPLES-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        SDS.hdf
+        SDSchunked.hdf
+        SDScompressed.hdf
+        SDSUNLIMITED.hdf
+        SLABS.hdf
+)
+SET_TESTS_PROPERTIES (MFHDF_FORTRAN_EXAMPLES-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+SET (last_test "MFHDF_FORTRAN_EXAMPLES-clearall-objects")
+
+FOREACH (example ${examples})
+  ADD_TEST (NAME f_exmftest_${example} COMMAND $<TARGET_FILE:f_exmf_${example}>)
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (f_exmftest_${example} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (f_exmftest_${example} PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "f_exmftest_${example}")
+ENDFOREACH (example ${examples})
+
+FOREACH (example ${skip_examples})
+  ADD_TEST (NAME f_exmftest_${example} COMMAND ${CMAKE_COMMAND} -E echo "SKIP f_exmftest_${example}")
+ENDFOREACH (example ${skip_examples})
diff --git a/mfhdf/fortran/examples/Makefile.am b/mfhdf/fortran/examples/Makefile.am
new file mode 100644
index 0000000..ad5f3c4
--- /dev/null
+++ b/mfhdf/fortran/examples/Makefile.am
@@ -0,0 +1,62 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+DEFINES=-DNDEBUG -DHDF
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+# These are the Fortran test programs to build.
+EXAMPLE_PROG=SD_create_sds SD_write_to_sds SD_write_slab SD_alter_sds_values SD_unlimited_sds \
+	SD_mv_sds_to_external SD_read_from_sds SD_read_subsets SD_get_info \
+	SD_find_sds_by_name SD_set_get_dim_info SD_dimscale_vs_sds SD_set_attr \
+	SD_get_attr SD_compress_sds SD_chunking_example
+TEST_PROG = $(EXAMPLE_PROG)
+
+# These are the Fortran example files to be installed
+INSTALL_FILES=SD_create_sds.f SD_write_to_sds.f SD_write_slab.f SD_alter_sds_values.f \
+	SD_unlimited_sds.f SD_mv_sds_to_external.f SD_read_from_sds.f SD_read_subsets.f \
+	SD_get_info.f SD_find_sds_by_name.f SD_set_get_dim_info.f SD_dimscale_vs_sds.f \
+	SD_set_attr.f SD_get_attr.f SD_compress_sds.f SD_chunking_example.f
+
+# Where to install example files
+EXAMPLEDIR=$(prefix)/examples/fortran
+
+# How to build Fortran programs using h4fc
+$(EXTRA_PROG): $(H4FC)
+	$(H4FC) $(H4FCFLAGS) $(FCFLAGS) -o $@ $(srcdir)/$@.f;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal Fortran compiler, not h4fc.
+SD_create_sds: $(srcdir)/SD_create_sds.f
+SD_write_to_sds: $(srcdir)/SD_write_to_sds.f
+SD_write_slab: $(srcdir)/SD_write_slab.f
+SD_alter_sds_values: $(srcdir)/SD_alter_sds_values.f
+SD_unlimited_sds: $(srcdir)/SD_unlimited_sds.f
+SD_mv_sds_to_external: $(srcdir)/SD_mv_sds_to_external.f
+SD_read_from_sds: $(srcdir)/SD_read_from_sds.f
+SD_read_subsets: $(srcdir)/SD_read_subsets.f
+SD_get_info: $(srcdir)/SD_get_info.f
+SD_find_sds_by_name: $(srcdir)/SD_find_sds_by_name.f
+SD_set_get_dim_info: $(srcdir)/SD_set_get_dim_info.f
+SD_dimscale_vs_sds: $(srcdir)/SD_dimscale_vs_sds.f
+SD_set_attr: $(srcdir)/SD_set_attr.f
+SD_get_attr: $(srcdir)/SD_get_attr.f
+SD_compress_sds: $(srcdir)/SD_compress_sds.f
+SD_chunking_example: $(srcdir)/SD_chunking_example.f
+
+CHECK_CLEANFILES += ExternalSDS
+
+DISTCLEANFILES = *.chkexe *.chklog
+
+if BUILD_SHARED_SZIP_CONDITIONAL
+LD_LIBRARY_PATH=$(LL_PATH)
+endif
+
+include $(top_srcdir)/config/examples.am
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/fortran/examples/Makefile.in b/mfhdf/fortran/examples/Makefile.in
new file mode 100644
index 0000000..672e772
--- /dev/null
+++ b/mfhdf/fortran/examples/Makefile.in
@@ -0,0 +1,728 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+# We can't tell automake about example programs, because they need to be
+# built using h4cc (or h4fc, etc.) instead of the standard compilers.
+# This creates some extra work for us.
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am \
+	$(top_srcdir)/config/examples.am
+TESTS = $(TEST_PROG)
+subdir = mfhdf/fortran/examples
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog ExternalSDS *.hdf
+DEFINES = -DNDEBUG -DHDF
+
+#############################################################################
+#############################################################################
+
+# These are the Fortran test programs to build.
+EXAMPLE_PROG = SD_create_sds SD_write_to_sds SD_write_slab SD_alter_sds_values SD_unlimited_sds \
+	SD_mv_sds_to_external SD_read_from_sds SD_read_subsets SD_get_info \
+	SD_find_sds_by_name SD_set_get_dim_info SD_dimscale_vs_sds SD_set_attr \
+	SD_get_attr SD_compress_sds SD_chunking_example
+
+TEST_PROG = $(EXAMPLE_PROG)
+
+# These are the Fortran example files to be installed
+INSTALL_FILES = SD_create_sds.f SD_write_to_sds.f SD_write_slab.f SD_alter_sds_values.f \
+	SD_unlimited_sds.f SD_mv_sds_to_external.f SD_read_from_sds.f SD_read_subsets.f \
+	SD_get_info.f SD_find_sds_by_name.f SD_set_get_dim_info.f SD_dimscale_vs_sds.f \
+	SD_set_attr.f SD_get_attr.f SD_compress_sds.f SD_chunking_example.f
+
+
+# Where to install example files
+EXAMPLEDIR = $(prefix)/examples/fortran
+DISTCLEANFILES = *.chkexe *.chklog
+ at BUILD_SHARED_SZIP_CONDITIONAL_TRUE@LD_LIBRARY_PATH = $(LL_PATH)
+
+# Assume that all tests in this directory are examples, and tell
+# conclude.am when to build them.
+EXTRA_PROG = $(EXAMPLE_PROG)
+
+# We need to tell automake what to clean
+MOSTLYCLEANFILES = *.o $(EXAMPLE_PROG)
+CLEANFILES = $(EXAMPLE_PROG)
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/fortran/examples/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/fortran/examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+	-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-local
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am all-local check check-TESTS check-am clean \
+	clean-generic clean-libtool distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am \
+	install-data-local install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installcheck-local installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am uninstall uninstall-am uninstall-local
+
+
+# How to build Fortran programs using h4fc
+$(EXTRA_PROG): $(H4FC)
+	$(H4FC) $(H4FCFLAGS) $(FCFLAGS) -o $@ $(srcdir)/$@.f;
+
+# List dependencies for each program.  Normally, automake would take
+# care of this for us, but if we tell automake about the programs it
+# will try to build them with the normal Fortran compiler, not h4fc.
+SD_create_sds: $(srcdir)/SD_create_sds.f
+SD_write_to_sds: $(srcdir)/SD_write_to_sds.f
+SD_write_slab: $(srcdir)/SD_write_slab.f
+SD_alter_sds_values: $(srcdir)/SD_alter_sds_values.f
+SD_unlimited_sds: $(srcdir)/SD_unlimited_sds.f
+SD_mv_sds_to_external: $(srcdir)/SD_mv_sds_to_external.f
+SD_read_from_sds: $(srcdir)/SD_read_from_sds.f
+SD_read_subsets: $(srcdir)/SD_read_subsets.f
+SD_get_info: $(srcdir)/SD_get_info.f
+SD_find_sds_by_name: $(srcdir)/SD_find_sds_by_name.f
+SD_set_get_dim_info: $(srcdir)/SD_set_get_dim_info.f
+SD_dimscale_vs_sds: $(srcdir)/SD_dimscale_vs_sds.f
+SD_set_attr: $(srcdir)/SD_set_attr.f
+SD_get_attr: $(srcdir)/SD_get_attr.f
+SD_compress_sds: $(srcdir)/SD_compress_sds.f
+SD_chunking_example: $(srcdir)/SD_chunking_example.f
+
+# How to create EXAMPLEDIR if it doesn't already exist
+$(EXAMPLEDIR):
+	mkdir -p $@
+
+# Install and uninstall rules.  We install the source files, not the
+# example programs themselves.
+install-data-local:
+	@$(MAKE) $(AM_MAKEFLAGS) install-examples
+uninstall-local:
+	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+
+install-examples: $(EXAMPLEDIR) 
+	@for f in X $(INSTALL_FILES); do                                     \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	    chmod a-x $(EXAMPLEDIR)/$$f;                                     \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_SCRIPT_FILES); do                              \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);    \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_FILES); do                                 \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	    chmod a-x $(EXAMPLETOPDIR)/$$f;                                  \
+	  fi;                                                                \
+	done
+	@for f in X $(INSTALL_TOP_SCRIPT_FILES); do                          \
+	  if test $$f != X; then                                             \
+	    (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
+	  fi;                                                                \
+	done
+
+uninstall-examples:
+	@if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then           \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES);              \
+	fi
+	@if test -n "$(INSTALL_SCRIPT_FILES)" -a -d $(EXAMPLEDIR); then    \
+	  set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_SCRIPT_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_FILES);       \
+	fi
+	@if test -n "$(INSTALL_TOP_SCRIPT_FILES)" -a -d $(EXAMPLETOPDIR); then    \
+	  set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_SCRIPT_FILES);       \
+	fi
+
+installcheck-local:
+	@if test "$(STATIC_SHARED)" = "static, shared"; then               \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	  $(MAKE) $(AM_MAKEFLAGS) clean;                                   \
+	  H5CCFLAGS="" $(MAKE) $(AM_MAKEFLAGS) check;                      \
+	elif test "$(STATIC_SHARED)" = "shared"; then                      \
+	  H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check;                \
+	else                                                               \
+	  $(MAKE) $(AM_MAKEFLAGS) check;                                   \
+	fi
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/fortran/examples/SD_alter_sds_values.f b/mfhdf/fortran/examples/SD_alter_sds_values.f
new file mode 100644
index 0000000..8233885
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_alter_sds_values.f
@@ -0,0 +1,71 @@
+      program  alter_data
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      integer      DFACC_WRITE
+      parameter   (FILE_NAME = 'SDS.hdf',
+     +             DFACC_WRITE = 2)
+C
+C     Function declaration.
+C
+      integer sfstart, sfselect, sfwdata, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index
+      integer start(2), edges(2), stride(2)
+      integer status
+      integer new_data(2) 
+C
+C**** End of variable declaration ************************************
+C
+
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_WRITE)
+C
+C     Select the first data set.
+C     
+      sds_index = 0
+      sds_id = sfselect(sd_id, sds_index)
+
+C
+C     Initialize the start, edge, and stride parameters to write 
+C     two elements into 2nd row, 10th column and 11th column places.
+C     
+C     Specify 2nd row.
+C
+      start(1) = 1 
+C
+C     Specify 10th column.
+C
+      start(2) = 9 
+      edges(1) = 1 
+C
+C     Two elements are written along 2nd row.
+C
+      edges(2) = 2 
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Initialize the new values to be written.
+C
+      new_data(1) = 1000
+      new_data(2) = 1000
+C
+C     Write the new values. 
+C
+      status = sfwdata(sds_id, start, stride, edges, new_data)
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_chunking_example.f b/mfhdf/fortran/examples/SD_chunking_example.f
new file mode 100644
index 0000000..8266dfc
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_chunking_example.f
@@ -0,0 +1,289 @@
+      program  chunk_examples
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*14 FILE_NAME
+      character*11 SDS_NAME
+      integer      RANK
+      parameter   (FILE_NAME = 'SDSchunked.hdf',
+     +             SDS_NAME  = 'ChunkedData',
+     +             RANK      = 2)
+      integer      DFACC_CREATE, DFACC_READ, DFNT_INT16
+      parameter   (DFACC_CREATE = 4,
+     +             DFACC_READ   = 1,
+     +             DFNT_INT16   = 22)
+      integer      COMP_CODE_NONE
+      parameter   (COMP_CODE_NONE = 0)
+C
+C     This example does not use compression.
+C
+C     To use RLE compression, declare:
+C
+C     integer      COMP_CODE_RLE
+C     parameter   (COMP_CODE_RLE = 1)
+C
+C     To use NBIT compression, declare:
+C
+C     integer      COMP_CODE_NBIT
+C     parameter   (COMP_CODE_NBIT = 2)
+C
+C     To use Skipping Huffman compression, declare:
+C
+C     integer      COMP_CODE_SKPHUFF
+C     parameter   (COMP_CODE_SKPHUFF = 3)
+C
+C     To use GZIP compression, declare:
+C
+C     integer      COMP_CODE_DEFLATE
+C     parameter   (COMP_CODE_DEFLATE = 4)
+C
+C
+C     Function declaration.
+C
+      integer sfstart, sfcreate, sfendacc, sfend,
+     +        sfselect, sfsfill, sfschnk, sfwchnk,
+     +        sfrchnk, sfgichnk, sfwdata, sfrdata,
+     +        sfscchnk
+C
+C**** Variable declaration *******************************************
+C
+      integer   sd_id, sds_id, sds_index, status          
+      integer   dim_sizes(2), origin(2)
+      integer   fill_value, maxcache, new_maxcache, flag
+      integer   start(2), edges(2), stride(2)
+      integer*2 all_data(4,9)
+      integer*2 row(3), column(2)
+      integer*2 chunk_out(2,3)
+      integer*2 chunk1(2,3),
+     +          chunk2(2,3),
+     +          chunk3(2,3),
+     +          chunk6(2,3)
+      integer   i, j
+C
+C     Compression flag and parameters.
+C
+      integer comp_type, comp_flag, comp_prm(4)
+C
+C     Chunk's dimensions.
+C
+      integer dim_length(2), dim_length_out(2)
+C
+C     Initialize four chunks
+C
+      data chunk1 /6*1/
+      data chunk2 /6*2/
+      data chunk3 /6*3/
+      data chunk6 /6*6/
+C
+C     Initialize row and column arrays.
+C
+      data row /3*4/
+      data column /2*5/
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Define chunk's dimensions.
+C
+      dim_length(1) = 2 
+      dim_length(2) = 3 
+C 
+C     Create the file and initialize SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_CREATE)
+
+C
+C     Create 4x9 SDS
+C
+      dim_sizes(1) = 4 
+      dim_sizes(2) = 9 
+      sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT16,
+     +                  RANK, dim_sizes)
+C
+C     Fill SDS array with the fill value.
+C
+      fill_value = 0
+      status = sfsfill( sds_id, fill_value)
+C
+C     Create chunked SDS.
+C
+C     In this example we do not use compression.
+C
+C     To use RLE compression, initialize comp_type parameter
+C     before the call to sfschnk function.
+C              comp_type = COMP_CODE_RLE
+C
+C     To use NBIT, Skipping Huffman, or GZIP compression,
+C     initialize comp_prm array and comp type parameter
+C     before call to sfschnk function
+C
+C     NBIT:
+C              comp_prm(1) = value_of(sign_ext)
+C              comp_prm(2) = value_of(fill_one)
+C              comp_prm(3) = value_of(start_bit)
+C              comp_prm(4) = value_of(bit_len)
+C              comp_type   = COMP_CODE_NBIT
+C
+C     Skipping Huffman:
+C              comp_prm(1) = value_of(skp_size)
+C              comp_type   = COMP_CODE_SKPHUFF
+C
+C     GZIP:
+C              comp_prm(1) = value_of(deflate_level) 
+C              comp_type   = COMP_CODE_DEFLATE
+C       
+C
+      comp_type = COMP_CODE_NONE
+      status = sfschnk(sds_id, dim_length, comp_type, comp_prm)
+C
+C     Set chunk cache to hold maximum 2 chunks.
+C
+      flag = 0
+      maxcache = 2
+      new_maxcache = sfscchnk(sds_id, maxcache, flag) 
+C
+C     Write chunks using SDwritechunk function.
+C     Chunks can be written in any order.
+C
+C     Write chunk with the coordinates (1,1).
+C
+      origin(1) = 1
+      origin(2) = 1
+      status = sfwchnk(sds_id, origin, chunk1) 
+C
+C     Write chunk with the coordinates (1,2).
+C
+      origin(1) = 1 
+      origin(2) = 2 
+      status = sfwchnk(sds_id, origin, chunk3) 
+C
+C     Write chunk with the coordinates (2,1).
+C
+      origin(1) = 2 
+      origin(2) = 1 
+      status = sfwchnk(sds_id, origin, chunk2) 
+C
+C     Write chunk with the coordinates (2,3).
+C
+      origin(1) = 2 
+      origin(2) = 3 
+      status = sfwchnk(sds_id, origin, chunk6) 
+C
+C     Fill second row in the chunk with the coordinates (2,2).
+C
+      start(1) = 3
+      start(2) = 3
+      edges(1) = 1 
+      edges(2) = 3 
+      stride(1) = 1
+      stride(2) = 1
+      status = sfwdata(sds_id, start, stride, edges, row)
+C
+C     Fill second column in the chunk with the coordinates (1,3).
+C
+      start(1) = 0 
+      start(2) = 7 
+      edges(1) = 2 
+      edges(2) = 1 
+      stride(1) = 1
+      stride(2) = 1
+      status = sfwdata(sds_id, start, stride, edges, column)
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.  
+C
+      status = sfend(sd_id)
+C
+C     Reopen the file and access the first data set.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_READ)
+      sds_index = 0
+      sds_id = sfselect(sd_id, sds_index)
+C
+C     Get information about the SDS.
+C
+      status = sfgichnk(sds_id, dim_length_out, comp_flag)
+      if (comp_flag .eq. 0) then
+         write(*,*) 'SDS is chunked'
+      endif
+      if (comp_flag .eq. 1) then
+         write(*,*) 'SDS is chunked and compressed'
+      endif
+      if (comp_flag .eq. 2) then
+         write(*,*) 'SDS is chunked and NBIT compressed'
+      endif
+      write(*,*) 'Chunks dimensions are ', dim_length_out(1),
+     + '  x' ,dim_length_out(2)
+C
+C     Read the whole SDS using sfrdata function and display
+C     what we have read. The following information will be displayed:
+C
+C
+C             SDS is chunked
+C             Chunks dimensions are   2  x  3
+C 
+C             1  1  1  3  3  3  0  5  0
+C             1  1  1  3  3  3  0  5  0
+C             2  2  2  0  0  0  6  6  6
+C             2  2  2  4  4  4  6  6  6
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = 4
+      edges(2) = 9
+      stride(1) = 1
+      stride(2) = 1
+      status = sfrdata(sds_id, start, stride, edges, all_data)
+C
+C     Display the SDS.
+C
+      write(*,*)
+      do 10 i = 1,4
+         write(*,*) (all_data(i,j), j=1,9)
+10    continue     
+C
+C     Read chunks with the coordinates (2,2) and (1,3) and display.
+C     The following information will be shown:
+C
+C             Chunk (2,2)
+C
+C               0  0  0
+C               4  4  4
+C 
+C             Chunk (1,3)
+C
+C               0  5  0
+C               0  5  0
+C
+      origin(1) = 2
+      origin(2) = 2
+      status = sfrchnk(sds_id, origin, chunk_out)
+      write(*,*) 
+      write(*,*) 'Chunk (2,2)'
+      write(*,*) 
+      do 20 i = 1,2
+         write(*,*) (chunk_out(i,j), j=1,3)
+20    continue
+C
+      origin(1) = 1 
+      origin(2) = 3 
+      status = sfrchnk(sds_id, origin, chunk_out)
+      write(*,*) 
+      write(*,*) 'Chunk (1,3)'
+      write(*,*) 
+      do 30 i = 1,2
+         write(*,*) (chunk_out(i,j), j=1,3)
+30    continue
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.   
+C
+      status = sfend(sd_id)
+      end 
diff --git a/mfhdf/fortran/examples/SD_compress_sds.f b/mfhdf/fortran/examples/SD_compress_sds.f
new file mode 100644
index 0000000..52612a1
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_compress_sds.f
@@ -0,0 +1,95 @@
+      program  write_compressed_data
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*17  FILE_NAME
+      character*7   SDS_NAME
+      integer       X_LENGTH, Y_LENGTH, RANK
+      parameter    (FILE_NAME = 'SDScompressed.hdf',
+     +              SDS_NAME = 'SDSgzip',
+     +              X_LENGTH = 5,
+     +              Y_LENGTH = 16,
+     +              RANK     = 2)
+      integer       DFACC_CREATE, DFNT_INT32
+      parameter    (DFACC_CREATE = 4,
+     +              DFNT_INT32 = 24)
+      integer       COMP_CODE_DEFLATE
+      parameter    (COMP_CODE_DEFLATE = 4)
+      integer       DEFLATE_LEVEL
+      parameter    (DEFLATE_LEVEL = 6)
+C     To use Skipping Huffman compression method, declare 
+C            integer   COMP_CODE_SKPHUFF
+C            parameter(COMP_CODE_SKPHUFF = 3) 
+C     To use RLE compression method, declare
+C            integer   COMP_CODE_RLE
+C            parameter(COMP_CODE_RLE = 1)
+C
+C
+C     Function declaration.
+C
+      integer sfstart, sfcreate, sfwdata, sfendacc, sfend,
+     +        sfscompress
+C
+C**** Variable declaration *******************************************
+C
+      integer  sd_id, sds_id, status
+      integer  start(2), edges(2), stride(2), dim_sizes(2)
+      integer  comp_type
+      integer  comp_prm(1)
+      integer  data(X_LENGTH, Y_LENGTH)
+      integer  i, j
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Buffer array data and define array dimensions. 
+C
+      do 20 j = 1, Y_LENGTH
+         do 10 i = 1, X_LENGTH
+            data(i, j) = i + j - 1
+10       continue
+20    continue
+      dim_sizes(1) = X_LENGTH
+      dim_sizes(2) = Y_LENGTH
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_CREATE)
+C
+C     Create the data set with the name SDS_NAME.  
+C
+      sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes) 
+C
+C     Initialize compression parameter (deflate level)
+C     and call sfscompress function
+C     For Skipping Huffman compression, comp_prm(1) should be set
+C     to skipping sizes value (skp_size).
+C 
+      comp_type   = COMP_CODE_DEFLATE
+      comp_prm(1) = deflate_level
+      status      = sfscompress(sds_id, comp_type, comp_prm(1))
+C
+C     Define the location and size of the data that will be written to
+C     the data set.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Write the stored data to the data set.
+C
+      status = sfwdata(sds_id, start, stride, edges, data)
+C
+C     Terminate access to the  data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_create_sds.f b/mfhdf/fortran/examples/SD_create_sds.f
new file mode 100644
index 0000000..0280fad
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_create_sds.f
@@ -0,0 +1,54 @@
+      program  create_SDS 
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      character*11 SDS_NAME
+      integer      X_LENGTH, Y_LENGTH, RANK
+      parameter   (FILE_NAME = 'SDS.hdf',
+     +             SDS_NAME = 'SDStemplate',
+     +             X_LENGTH = 5,
+     +             Y_LENGTH = 16,
+     +             RANK     = 2)
+      integer      DFACC_CREATE, DFNT_INT32
+      parameter   (DFACC_CREATE = 4,
+     +             DFNT_INT32 = 24)
+C
+C     Function declaration.
+C
+      integer sfstart, sfcreate, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, dim_sizes(2)
+      integer status
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Create the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_CREATE)
+C
+C     Define dimensions of the array to be created.
+C
+      dim_sizes(1) = X_LENGTH
+      dim_sizes(2) = Y_LENGTH
+C
+C     Create the array with the name defined in SDS_NAME.
+C     Note that DFNT_INT32 indicates that the SDS data is of type
+C     integer. Refer to Tables 2E and 2I for the definition of other types.  
+C
+      sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, 
+     .                  dim_sizes)
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_dimscale_vs_sds.f b/mfhdf/fortran/examples/SD_dimscale_vs_sds.f
new file mode 100644
index 0000000..e06040a
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_dimscale_vs_sds.f
@@ -0,0 +1,68 @@
+      program  sds_vrs_coordvar 
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      parameter   (FILE_NAME = 'SDS.hdf')
+      integer      DFACC_READ, DFNT_INT32
+      parameter   (DFACC_READ = 1,
+     +             DFNT_INT32 = 24)
+      integer      MAX_VAR_DIMS
+      parameter   (MAX_VAR_DIMS = 32)
+C
+C     Function declaration.
+C 
+      integer sfstart, sfselect, sfiscvar, sffinfo, sfginfo
+      integer sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer       sd_id, sds_id, sds_index, status
+      integer       rank, data_type
+      integer       n_datasets, n_file_attrs, n_attrs
+      integer       dim_sizes(MAX_VAR_DIMS)
+      character*256 sds_name
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_READ)
+C
+C     Obtain information about the file.
+C 
+      status = sffinfo(sd_id, n_datasets, n_file_attrs) 
+C
+C     Get information about each SDS in the file.
+C     Check whether it is a coordinate variable, then display retrieved 
+C     information. 
+C     Output displayed:
+C 
+C           SDS array with the name SDStemplate
+C           Coordinate variable with the name X_Axis
+C           Coordinate variable with the name Y_Axis
+C
+      do 10 sds_index = 0, n_datasets-1
+         sds_id = sfselect(sd_id, sds_index)
+         status = sfginfo(sds_id, sds_name, rank, dim_sizes,
+     +                    data_type, n_attrs)
+         status = sfiscvar(sds_id)
+         if (status .eq. 1) then
+             write(*,*) "Coordinate variable with the name ",
+     +       sds_name(1:6) 
+         else
+             write(*,*) "SDS array with the name ", 
+     +       sds_name(1:11) 
+         endif
+C
+C        Terminate access to the data set.
+C
+         status = sfendacc(sds_id)
+10    continue
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+      end
diff --git a/mfhdf/fortran/examples/SD_find_sds_by_name.f b/mfhdf/fortran/examples/SD_find_sds_by_name.f
new file mode 100644
index 0000000..c3ac62b
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_find_sds_by_name.f
@@ -0,0 +1,82 @@
+      program  locate_by_name
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      character*11 SDS_NAME
+      character*9  WRONG_NAME
+      integer      X_LENGTH, Y_LENGTH
+      parameter   (FILE_NAME  = 'SDS.hdf',
+     +             SDS_NAME   = 'SDStemplate',
+     +             WRONG_NAME = 'WrongName',
+     +             X_LENGTH = 5,
+     +             Y_LENGTH = 16)
+      integer      DFACC_READ, DFNT_INT32
+      parameter   (DFACC_READ = 1,
+     +             DFNT_INT32 = 24)
+
+C
+C     Function declaration.
+C
+      integer sfstart, sfn2index, sfselect, sfrdata, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C 
+      integer sd_id, sds_id, sds_index, status
+      integer start(2), edges(2), stride(2)
+      integer data(X_LENGTH, Y_LENGTH)
+      integer j
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_READ)
+C
+C     Find index of the data set with the name specified in WRONG_NAME. 
+C     Error condition occurs, since a data set with this name 
+C     does not exist in the file.
+C
+      sds_index = sfn2index(sd_id, WRONG_NAME)
+      if (sds_index .eq. -1) then
+        write(*,*) "Data set with the name ", WRONG_NAME,
+     +             " does not exist"        
+      endif
+C
+C     Find index of the data set with the name specified in SDS_NAME  
+C     and use the index to attach to the data set. 
+C
+      sds_index = sfn2index(sd_id, SDS_NAME)
+      sds_id    = sfselect(sd_id, sds_index)
+C
+C     Set elements of start array to 0, elements of edges array 
+C     to SDS dimensions, and elements of stride array to 1 to read entire data. 
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Read entire data into array named data. 
+C
+      status = sfrdata(sds_id, start, stride, edges, data)
+C
+C     Print 10th column; the following numbers should be displayed:
+C
+C           10 1000 12 13 14
+C
+      write(*,*) (data(j,10), j = 1, X_LENGTH)
+C
+C     Terminate access to the data set. 
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_get_attr.f b/mfhdf/fortran/examples/SD_get_attr.f
new file mode 100644
index 0000000..9e4a685
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_get_attr.f
@@ -0,0 +1,125 @@
+      program  attr_info
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      character*13 FILE_ATTR_NAME
+      character*11 SDS_ATTR_NAME
+      character*10 DIM_ATTR_NAME
+      parameter   (FILE_NAME = 'SDS.hdf',
+     +             FILE_ATTR_NAME = 'File_contents',
+     +             SDS_ATTR_NAME  = 'Valid_range',
+     +             DIM_ATTR_NAME  = 'Dim_metric')
+      integer      DFACC_READ, DFNT_FLOAT32
+      parameter   (DFACC_READ   = 1,
+     +             DFNT_FLOAT32 = 5)
+
+C
+C     Function declaration.
+C
+      integer sfstart, sffattr, sfgainfo, sfrattr, sfselect
+      integer sfdimid, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer      sd_id, sds_id, dim_id
+      integer      attr_index, data_type, n_values, status
+      real         sds_data(2)
+      character*20 attr_name 
+      character*16 file_data
+      character*7  dim_data
+      integer      i
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file and initialize SD interface. 
+C
+      sd_id = sfstart(FILE_NAME, DFACC_READ)
+C
+C     Find the file attribute defined by FILE_ATTR_NAME.
+C     Note that the first parameter is an SD interface identifier.
+C
+      attr_index = sffattr(sd_id, FILE_ATTR_NAME)
+C
+C     Get information about the file attribute. 
+C
+      status = sfgainfo(sd_id, attr_index, attr_name, data_type, 
+     +                  n_values)
+C
+C     Read the file attribute data. 
+C
+      status = sfrattr(sd_id, attr_index, file_data)
+C
+C     Print file attribute value.
+C
+      write(*,*) "File attribute value is : ", file_data 
+C
+C     Select the first data set. 
+C
+      sds_id = sfselect(sd_id, 0)
+C
+C     Find the data set attribute defined by SDS_ATTR_NAME.
+C     Note that the first parameter is a data set identifier. 
+C
+      attr_index = sffattr(sds_id, SDS_ATTR_NAME)
+C
+C     Get information about the data set attribute. 
+C
+      status = sfgainfo(sds_id, attr_index, attr_name, data_type, 
+     +                  n_values)
+C
+C     Read the SDS attribute data. 
+C
+      status = sfrattr(sds_id, attr_index, sds_data)
+
+C
+C     Print SDS attribute data type and values. 
+C
+      if (data_type .eq. DFNT_FLOAT32)  then
+         write(*,*) "SDS attribute data type is : float32 "  
+      endif
+      write(*,*) "SDS attribute values are  : " 
+      write(*,*)  (sds_data(i), i=1, n_values) 
+C
+C     Get the identifier for the first dimension of the SDS. 
+C
+      dim_id = sfdimid(sds_id, 0)
+C
+C     Find the dimensional attribute defined by DIM_ATTR_NAME.
+C     Note that the first parameter is a dimension identifier.
+C
+      attr_index = sffattr(dim_id, DIM_ATTR_NAME)
+C
+C     Get information about dimension attribute. 
+C
+      status = sfgainfo(dim_id, attr_index, attr_name, data_type, 
+     +                  n_values)
+C
+C     Read the dimension attribute data. 
+C
+      status = sfrattr(dim_id, attr_index, dim_data)
+C
+C     Print dimension attribute value.
+C
+      write(*,*) "Dimensional attribute value is : ", dim_data 
+C
+C     Terminate access to the data set. 
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file. 
+C
+      status = sfend(sd_id)
+C
+C     Output of this program is :
+C
+C
+C     File attribute value is : Storm_track_data
+C     SDS attribute data type is : float32 
+C     SDS attribute values are  : 
+C         2.00000   10.00000
+C      Dimensional attribute value is : Seconds
+C
+      end
diff --git a/mfhdf/fortran/examples/SD_get_info.f b/mfhdf/fortran/examples/SD_get_info.f
new file mode 100644
index 0000000..dfc70db
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_get_info.f
@@ -0,0 +1,71 @@
+      program get_data_set_info 
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      parameter   (FILE_NAME = 'SDS.hdf')
+      integer      DFACC_READ, DFNT_INT32
+      parameter   (DFACC_READ = 1,
+     +             DFNT_INT32 = 24)
+      integer      MAX_NC_NAME, MAX_VAR_DIMS
+      parameter   (MAX_NC_NAME  = 256,
+     +             MAX_VAR_DIMS = 32)
+C
+C     Function declaration.
+C
+      integer sfstart, sffinfo, sfselect, sfginfo
+      integer sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id
+      integer n_datasets, n_file_attrs, index
+      integer status, n_attrs
+      integer rank, data_type
+      integer dim_sizes(MAX_VAR_DIMS)
+      character name *(MAX_NC_NAME)
+      integer i
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_READ)
+C
+C     Determine the number of data sets in the file and the number of 
+C     file attributes. 
+C
+      status = sffinfo(sd_id, n_datasets, n_file_attrs)
+C
+C     Access every data set in the file and print its name, rank,
+C     dimension sizes, data type, and number of attributes.
+C     The following information should be displayed:
+C
+C                name = SDStemplate    
+C                rank =   2
+C                dimension sizes are :   5  16
+C                data type is   24
+C                number of attributes is   0
+C
+      do 10 index = 0, n_datasets - 1
+         sds_id = sfselect(sd_id, index)
+         status = sfginfo(sds_id, name, rank, dim_sizes, data_type, 
+     .                    n_attrs)
+         write(*,*)  "name = ", name(1:15)
+         write(*,*)  "rank = ", rank
+         write(*,*)  "dimension sizes are : ", (dim_sizes(i), i=1, rank)
+         write(*,*)  "data type is ", data_type
+         write(*,*)  "number of attributes is ", n_attrs   
+C
+C     Terminate access to the current data set.
+C
+         status = sfendacc(sds_id)
+10    continue
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_mv_sds_to_external.f b/mfhdf/fortran/examples/SD_mv_sds_to_external.f
new file mode 100644
index 0000000..5d25aa3
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_mv_sds_to_external.f
@@ -0,0 +1,50 @@
+      program  write_extfile
+      implicit none 
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      character*11 EXT_FILE_NAME
+      integer      OFFSET
+      integer      DFACC_WRITE
+      parameter   (FILE_NAME      = 'SDS.hdf',
+     +             EXT_FILE_NAME  = 'ExternalSDS',
+     +             OFFSET         = 24,
+     +             DFACC_WRITE    = 2)
+
+C
+C     Function declaration.
+C
+      integer sfstart, sfselect, sfsextf, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index
+      integer status
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the HDF file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_WRITE)
+C
+C     Select the first data set.
+C
+      sds_index = 0
+      sds_id = sfselect(sd_id, sds_index)
+C
+C     Create a file with the name EXT_FILE_NAME and move the data set
+C     into it, starting at byte location OFFSET.
+C
+      status = sfsextf(sds_id, EXT_FILE_NAME, OFFSET)
+C
+C     Terminate access to the data set. 
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file. 
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_read_from_sds.f b/mfhdf/fortran/examples/SD_read_from_sds.f
new file mode 100644
index 0000000..50e2d7b
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_read_from_sds.f
@@ -0,0 +1,72 @@
+      program  read_data
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      integer      X_LENGTH, Y_LENGTH
+      parameter   (FILE_NAME  = 'SDS.hdf',
+     +             X_LENGTH = 5, 
+     +             Y_LENGTH = 16)
+      integer      DFACC_READ, DFNT_INT32
+      parameter   (DFACC_READ = 1,
+     +             DFNT_INT32 = 24)
+
+C
+C     Function declaration.
+C
+      integer sfstart, sfselect, sfrdata, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index, status
+      integer start(2), edges(2), stride(2)
+      integer data(X_LENGTH, Y_LENGTH)
+      integer j
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_READ)
+
+C
+C     Select the first data set.
+C
+      sds_index = 0
+      sds_id = sfselect(sd_id, sds_index)
+
+C
+C     Set elements of the array start to 0, elements of the array edges to 
+C     SDS dimensions, and elements of the array stride to 1 to read the
+C     entire data. 
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Read entire data into data array. Note that sfrdata is used
+C     to read the numeric data. 
+C
+      status = sfrdata(sds_id, start, stride, edges, data)
+      
+C
+C     Print 10th column; the following numbers are displayed:
+C
+C           10 1000 12 13 14
+C
+      write(*,*) (data(j,10), j = 1, X_LENGTH)
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_read_subsets.f b/mfhdf/fortran/examples/SD_read_subsets.f
new file mode 100644
index 0000000..17d96e9
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_read_subsets.f
@@ -0,0 +1,125 @@
+      program  read_subsets
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      parameter   (FILE_NAME  = 'SDS.hdf')
+      integer      DFACC_READ, DFNT_INT32
+      parameter   (DFACC_READ = 1,
+     +             DFNT_INT32 = 24)
+      integer      SUB1_LENGTH, SUB2_LENGTH, SUB3_LENGTH1,
+     +             SUB3_LENGTH2 
+      parameter   (SUB1_LENGTH  = 5,
+     +             SUB2_LENGTH  = 4, 
+     +             SUB3_LENGTH1 = 2,
+     +             SUB3_LENGTH2 = 3)
+
+C
+C     Function declaration.
+C
+      integer sfstart, sfselect, sfrdata, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index, status
+      integer start(2), edges(2), stride(2)
+      integer sub1_data(SUB1_LENGTH)
+      integer sub2_data(SUB2_LENGTH)
+      integer sub3_data(SUB3_LENGTH1,SUB3_LENGTH2)
+      integer i, j
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_READ)
+C
+C     Select the first data set.
+C
+      sds_index = 0
+      sds_id =sfselect(sd_id, sds_index)
+C
+C            Reading the first subset.
+C
+C     Set elements of start, stride, and edges arrays to read 
+C     every 3d element in in the 2nd row starting in the 4th column. 
+C
+      start(1) = 1 
+      start(2) = 3 
+      edges(1) = 1 
+      edges(2) = SUB1_LENGTH
+      stride(1) = 1
+      stride(2) = 3 
+C
+C     Read the data from sub1_data array. 
+C
+      status = sfrdata(sds_id, start, stride, edges, sub1_data)
+      
+C
+C     Print what we have just read, the following numbers should be displayed:
+C
+C           5 8 1000 14 17 
+C
+      write(*,*) (sub1_data(j), j = 1, SUB1_LENGTH)
+C
+C            Reading the second subset.
+C
+C     Set elements of start, stride, and edges arrays to read 
+C     first 4 elements of 10th column. 
+C
+      start(1) = 0 
+      start(2) = 9 
+      edges(1) = SUB2_LENGTH 
+      edges(2) = 1 
+      stride(1) = 1
+      stride(2) = 1 
+C
+C     Read the data into sub2_data array. 
+C
+      status = sfrdata(sds_id, start, stride, edges, sub2_data)
+      
+C
+C     Print what we have just read; the following numbers should be displayed:
+C
+C          10 1000 12 13 
+C
+      write(*,*) (sub2_data(j), j = 1, SUB2_LENGTH)
+C
+C            Reading the third subset.
+C
+C     Set elements of start, stride and edges arrays to read 
+C     every 6th element in the row and every 4th element in the column
+C     starting at 1st row, 3rd column.  
+C
+      start(1) = 0 
+      start(2) = 2 
+      edges(1) = SUB3_LENGTH1 
+      edges(2) = SUB3_LENGTH2 
+      stride(1) = 4 
+      stride(2) = 6 
+C
+C     Read the data from the file into sub3_data array. 
+C
+      status = sfrdata(sds_id, start, stride, edges, sub3_data)
+      
+C
+C     Print what we have just read; the following numbers should be displayed:
+C
+C         3 9 15
+C         7 13 19 
+C
+      do 50 i = 1, SUB3_LENGTH1
+         write(*,*) (sub3_data(i,j), j = 1, SUB3_LENGTH2)
+50    continue    
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_set_attr.f b/mfhdf/fortran/examples/SD_set_attr.f
new file mode 100644
index 0000000..a813c64
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_set_attr.f
@@ -0,0 +1,82 @@
+      program  set_attribs
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      character*13 FILE_ATTR_NAME
+      character*11 SDS_ATTR_NAME
+      character*10 DIM_ATTR_NAME
+      parameter   (FILE_NAME = 'SDS.hdf',
+     +             FILE_ATTR_NAME = 'File_contents',
+     +             SDS_ATTR_NAME  = 'Valid_range',
+     +             DIM_ATTR_NAME  = 'Dim_metric')
+      integer      DFACC_WRITE, DFNT_CHAR8, DFNT_FLOAT32
+      parameter   (DFACC_WRITE = 2,
+     +             DFNT_CHAR8  = 4,
+     +             DFNT_FLOAT32 = 5)
+C
+C     Function declaration.
+C
+      integer sfstart, sfscatt, sfsnatt, sfselect, sfdimid
+      integer sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index, status
+      integer dim_id, dim_index 
+      integer n_values
+      character*16 file_values
+      real         sds_values(2)
+      character*7  dim_values
+      file_values   = 'Storm_track_data'
+      sds_values(1) = 2.
+      sds_values(2) = 10.
+      dim_values    = 'Seconds'
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Open the file and initialize the SD interface. 
+C
+      sd_id = sfstart(FILE_NAME, DFACC_WRITE)
+C
+C     Set an attribute that describes the file contents. 
+C
+      n_values = 16
+      status = sfscatt(sd_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values, 
+     +                 file_values)
+C
+C     Select the first data set. 
+C
+      sds_index = 0
+      sds_id = sfselect(sd_id, sds_index)
+C
+C     Assign attribute to the first SDS. Note that attribute values
+C     may have different data type than SDS data.
+C
+      n_values = 2
+      status = sfsnatt(sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, 
+     +                 sds_values)
+C
+C     Get the identifier for the first dimension. 
+C
+      dim_index = 0 
+      dim_id = sfdimid(sds_id, dim_index)
+C
+C     Set an attribute to the dimension that specifies the
+C     dimension metric. 
+C
+      n_values = 7
+      status = sfscatt(dim_id, DIM_ATTR_NAME, DFNT_CHAR8, n_values, 
+     +                 dim_values)
+C
+C     Terminate access to the data set. 
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_set_get_dim_info.f b/mfhdf/fortran/examples/SD_set_get_dim_info.f
new file mode 100644
index 0000000..7466be6
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_set_get_dim_info.f
@@ -0,0 +1,147 @@
+      program  dimension_info 
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      character*11 SDS_NAME
+      character*6  DIM_NAME_X
+      character*6  DIM_NAME_Y
+      integer      X_LENGTH, Y_LENGTH, RANK
+      parameter   (FILE_NAME  = 'SDS.hdf',
+     +             SDS_NAME   = 'SDStemplate',
+     +             DIM_NAME_X  = 'X_Axis',
+     +             DIM_NAME_Y  = 'Y_Axis',
+     +             X_LENGTH = 5,
+     +             Y_LENGTH = 16,
+     +             RANK     = 2)
+      integer      DFACC_WRITE, DFNT_INT16, DFNT_FLOAT64
+      parameter   (DFACC_WRITE   = 2,
+     +             DFNT_INT16   = 22,
+     +             DFNT_FLOAT64 = 6)
+
+C
+C     Function declaration.
+C
+      integer sfstart, sfn2index, sfdimid, sfgdinfo
+      integer sfsdscale, sfgdscale, sfsdmname, sfendacc
+      integer sfend, sfselect
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index, status
+      integer dim_index, dim_id
+      integer n_values, n_attrs, data_type
+      integer*2 data_X(X_LENGTH)
+      integer*2 data_X_out(X_LENGTH)
+      real*8    data_Y(Y_LENGTH)
+      real*8    data_Y_out(Y_LENGTH)
+      character*6 dim_name
+      integer   i
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Initialize dimension scales.
+C
+      do 10 i = 1, X_LENGTH  
+         data_X(i) = i - 1
+10     continue
+
+      do 20 i = 1, Y_LENGTH  
+         data_Y(i) = 0.1 * (i - 1)
+20     continue
+C
+C     Open the file and initialize SD interface.
+C 
+      sd_id = sfstart(FILE_NAME, DFACC_WRITE)
+C
+C     Get the index of the data set with the name specified in SDS_NAME. 
+C
+      sds_index = sfn2index(sd_id, SDS_NAME)
+C
+C     Select the data set corresponding to the returned index.
+C
+      sds_id = sfselect(sd_id, sds_index)
+C
+C     For each dimension of the data set,
+C     get its dimension identifier and set dimension name
+C     and dimension scales. Note that data type of dimension scale can
+C     be different between dimensions and can be different from SDS data type.
+C
+      do 30 dim_index = 0, RANK - 1 
+C
+C        Select the dimension at position dim_index.
+C
+         dim_id = sfdimid(sds_id, dim_index)
+C
+C        Assign name and dimension scale to the dimension. 
+C
+         if (dim_index .eq. 0) then
+            status = sfsdmname(dim_id, DIM_NAME_X) 
+            n_values = X_LENGTH
+            status = sfsdscale(dim_id, n_values, DFNT_INT16, data_X)
+         end if
+         if (dim_index .eq. 1) then
+            status = sfsdmname(dim_id, DIM_NAME_Y)
+            n_values = Y_LENGTH
+            status = sfsdscale(dim_id, n_values, DFNT_FLOAT64, data_Y)
+         end if
+C
+C      Get and display information about dimension and its scale values.
+C      The following information is displayed:
+C
+C                    Information about 1 dimension :
+C                    dimension name is X_Axis
+C                    number of scale values is  5
+C                    dimension scale data type is int16
+C
+C                    number of dimension attributes is   0
+C                    Scale values are:
+C                        0  1  2  3  4
+C
+C                    Information about 2 dimension :
+C                    dimension name is Y_Axis
+C                    number of scale values is  16
+C                    dimension scale data type is float64
+C                    number of dimension attributes is   0
+C
+C                    Scale values are:
+C                        0.000      0.100      0.200      0.300
+C                        0.400      0.500      0.600      0.700
+C                        0.800      0.900      1.000      1.100
+C                        1.200      1.300      1.400      1.500
+C
+       status = sfgdinfo(dim_id, dim_name, n_values, data_type, n_attrs)
+C
+       write(*,*) "Information about ", dim_index+1," dimension :"
+       write(*,*) "dimension name is ", dim_name
+       write(*,*) "number of scale values is", n_values
+       if (data_type. eq. 22) then
+           write(*,*) "dimension scale data type is int16"
+       endif 
+       if (data_type. eq. 6) then
+           write(*,*) "dimension scale data type is float64"
+       endif 
+       write(*,*) "number of dimension attributes is ", n_attrs
+C
+       write(*,*) "Scale values are:"
+       if (dim_index .eq. 0) then
+          status = sfgdscale(dim_id, data_X_out)
+          write(*,*) (data_X_out(i), i= 1, X_LENGTH)
+       endif 
+       if (dim_index .eq. 1)  then
+          status = sfgdscale(dim_id, data_Y_out) 
+          write(*,100) (data_Y_out(i), i= 1, Y_LENGTH)
+100       format(4(1x,f10.3)/)
+       endif 
+30      continue
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+      end
diff --git a/mfhdf/fortran/examples/SD_unlimited_sds.f b/mfhdf/fortran/examples/SD_unlimited_sds.f
new file mode 100644
index 0000000..de637fb
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_unlimited_sds.f
@@ -0,0 +1,115 @@
+      program append_sds
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*16  FILE_NAME
+      character*14  SDS_NAME
+      integer       X_LENGTH, Y_LENGTH, RANK
+      parameter    (FILE_NAME = 'SDSUNLIMITED.hdf',
+     +              SDS_NAME = 'AppendableData',
+     +              X_LENGTH = 10, 
+     +              Y_LENGTH = 10,
+     +              RANK     = 2)
+      integer       DFACC_CREATE, DFACC_WRITE, SD_UNLIMITED,
+     +              DFNT_INT32
+      parameter    (DFACC_CREATE = 4,
+     +              DFACC_WRITE  = 2,
+     +              SD_UNLIMITED = 0,
+     +              DFNT_INT32 =   24)
+C
+C     Function declaration.
+C
+      integer sfstart, sfcreate, sfwdata, sfselect 
+      integer sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index, status
+      integer dim_sizes(2)
+      integer start(2), edges(2), stride(2)
+      integer i, j
+      integer data (X_LENGTH, Y_LENGTH), append_data(X_LENGTH)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Data initialization.
+C 
+      do 20 j = 1, Y_LENGTH
+         do 10 i = 1, X_LENGTH
+            data(i, j) = i + j
+10      continue
+20    continue
+C
+C     Create the file and initialize the SD interface. 
+C
+      sd_id = sfstart(FILE_NAME, DFACC_CREATE)
+C
+C     Define dimensions of the array. Make the
+C     last dimension appendable by defining its length as unlimited.
+C
+      dim_sizes(1) = X_LENGTH
+      dim_sizes(2) = SD_UNLIMITED
+
+C     Create the array data set. 
+      sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, 
+     .                  dim_sizes)
+C
+C     Define the location and the size of the data to be written
+C     to the data set. Note that the elements of array stride are
+C     set to 1 for contiguous writing.    
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Write the data. 
+C
+      status = sfwdata(sds_id, start, stride, edges, data)
+C
+C     Terminate access to the data set, terminate access
+C     to the SD interface, and close the file. 
+C
+      status = sfendacc(sds_id)
+      status = sfend(sd_id)
+C
+C     Store the array values to be appended to the data set. 
+C
+      do 30 i = 1, X_LENGTH
+         append_data(i) = 1000 + i - 1 
+30    continue
+C
+C     Reopen the file and initialize the SD. 
+C
+      sd_id = sfstart(FILE_NAME, DFACC_WRITE)
+C
+C     Select the first data set. 
+C
+      sds_index = 0 
+      sds_id = sfselect(sd_id, sds_index)
+C
+C     Define the location of the append to start at the 11th 
+C     column of the 1st row and to stop at the end of the 10th row.
+C
+      start(1) = 0
+      start(2) = Y_LENGTH
+      edges(1) = X_LENGTH
+      edges(2) = 1
+C
+C     Append the data to the data set. 
+C
+      status = sfwdata(sds_id, start, stride, edges, append_data)
+C
+C     Terminate access to the data set. 
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file. 
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_write_slab.f b/mfhdf/fortran/examples/SD_write_slab.f
new file mode 100644
index 0000000..6160829
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_write_slab.f
@@ -0,0 +1,101 @@
+      program  write_slab
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*9  FILE_NAME
+      character*13 SDS_NAME
+      integer      X_LENGTH, Y_LENGTH, Z_LENGTH, RANK
+      parameter   (FILE_NAME = 'SLABS.hdf',
+     +             SDS_NAME = 'FilledBySlabs',
+     +             X_LENGTH = 4,
+     +             Y_LENGTH = 5,
+     +             Z_LENGTH = 6,
+     +             RANK     = 3)
+      integer      DFACC_CREATE, DFNT_INT32
+      parameter   (DFACC_CREATE = 4,
+     +             DFNT_INT32 = 24)
+C
+C     Function declaration.
+C
+      integer sfstart, sfcreate, sfwdata, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id
+      integer dim_sizes(3), start(3), edges(3), stride(3)
+      integer i, j, k, status
+      integer data(X_LENGTH, Y_LENGTH, Z_LENGTH)
+      integer xz_data(X_LENGTH, Z_LENGTH)
+C
+C**** End of variable declaration ************************************
+C
+C
+C     Data initialization.
+C
+      do 30 k = 1, Z_LENGTH
+         do 20 j = 1, Y_LENGTH
+            do 10 i = 1, X_LENGTH
+               data(i, j, k) = i + j + k 
+10            continue
+20         continue
+30    continue
+C
+C     Create the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_CREATE)
+C
+C     Define dimensions of the array to be created. 
+C
+      dim_sizes(1) = X_LENGTH   
+      dim_sizes(2) = Y_LENGTH   
+      dim_sizes(3) = Z_LENGTH   
+C
+C     Create the data set with the name defined in SDS_NAME. 
+C
+      sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, 
+     .                  dim_sizes)
+C
+C     Set the parameters start and edges to write 
+C     a 4x6 element slab of data to the data set;
+C     note that edges(2) is set to 1 to define a 2 dimensional slab
+C     parallel to the XZ plane;
+C     start(2) (slab position in the array) is initialized inside the
+C     for loop.
+C 
+      edges(1) = X_LENGTH
+      edges(2) = 1
+      edges(3) = Z_LENGTH
+      start(1) = 0 
+      start(3) = 0
+      stride(1) = 1
+      stride(2) = 1
+      stride(3) = 1
+
+      do 60 j = 1, Y_LENGTH
+       start(2) = j - 1 
+C
+C     Initialize the buffer xz_data (data slab).
+C
+       do 50 k = 1, Z_LENGTH
+        do 40 i = 1, X_LENGTH
+         xz_data(i, k) = data(i, j, k)
+40      continue
+50     continue
+C
+C     Write the data slab into SDS array defined in SDS_NAME. 
+C     Note that the elements of array stride are set to 1 to
+C     specify that the consecutive slabs in the Y direction are written.
+C
+         status = sfwdata(sds_id, start, stride, edges, xz_data)
+60    continue
+C
+C     Terminate access to the data set. 
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file. 
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/examples/SD_write_to_sds.f b/mfhdf/fortran/examples/SD_write_to_sds.f
new file mode 100644
index 0000000..7f548c7
--- /dev/null
+++ b/mfhdf/fortran/examples/SD_write_to_sds.f
@@ -0,0 +1,79 @@
+      program  write_data
+      implicit none
+C
+C     Parameter declaration.
+C
+      character*7  FILE_NAME
+      character*11 SDS_NAME
+      integer      X_LENGTH, Y_LENGTH, RANK
+      parameter   (FILE_NAME = 'SDS.hdf',
+     +             SDS_NAME = 'SDStemplate',
+     +             X_LENGTH = 5,
+     +             Y_LENGTH = 16,
+     +             RANK     = 2)
+      integer      DFACC_WRITE, DFNT_INT32
+      parameter   (DFACC_WRITE = 2,
+     +             DFNT_INT32 = 24)
+C
+C     Function declaration.
+C
+
+      integer sfstart, sfselect, sfwdata, sfendacc, sfend
+C
+C**** Variable declaration *******************************************
+C
+      integer sd_id, sds_id, sds_index, status
+      integer start(2), edges(2), stride(2)
+      integer i, j
+      integer data(X_LENGTH, Y_LENGTH)
+C
+C**** End of variable declaration ************************************
+C
+
+C
+C     Data set data initialization. 
+C
+      do 20 j = 1, Y_LENGTH
+         do 10 i = 1, X_LENGTH
+            data(i, j) = i + j - 1
+10         continue
+20    continue
+
+C
+C     Open the file and initialize the SD interface.
+C
+      sd_id = sfstart(FILE_NAME, DFACC_WRITE)
+
+C
+C     Attach to the first data set.
+C
+      sds_index = 0
+      sds_id = sfselect(sd_id, sds_index)
+
+C
+C     Define the location and size of the data to be written
+C     to the data set. Note that setting values of the array stride to 1
+C     specifies the contiguous writing of data.
+C
+      start(1) = 0
+      start(2) = 0
+      edges(1) = X_LENGTH
+      edges(2) = Y_LENGTH
+      stride(1) = 1
+      stride(2) = 1
+C
+C     Write the stored data to the data set named in SDS_NAME.
+C     Note that the routine sfwdata is used instead of sfwcdata 
+C     to write the numeric data.
+C
+      status = sfwdata(sds_id, start, stride, edges, data)
+C
+C     Terminate access to the data set.
+C
+      status = sfendacc(sds_id)
+C
+C     Terminate access to the SD interface and close the file.
+C
+      status = sfend(sd_id)
+
+      end
diff --git a/mfhdf/fortran/ftest.f.in b/mfhdf/fortran/ftest.f.in
new file mode 100644
index 0000000..4dbe0cd
--- /dev/null
+++ b/mfhdf/fortran/ftest.f.in
@@ -0,0 +1,1418 @@
+c********************************************************************
+c   Copyright 1993, UCAR/Unidata
+c   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+c   $Id: ftest-linux.f 5345 2010-01-29 20:55:24Z epourmal $
+c********************************************************************/
+
+
+
+c
+c     program to test the Sun Fortran jacket interface to the netCDF
+c
+      program ftest
+      
+      include 'netcdf.inc'
+
+c     name of first test cdf
+      character*31 name
+c     name of second test cdf
+      character*31 name2
+      
+c     Returned error code.
+      integer iret 
+c     netCDF ID
+      integer ncid
+c     ID of dimension lat
+      integer  latdim
+c     ID of dimension lon
+      integer londim
+c     ID of dimension level
+      integer leveldim
+c     ID of dimension time
+      integer timedim
+c     ID of dimension len
+      integer lendim
+
+c     variable used to control error-handling behavior
+      integer ncopts
+      integer dimsiz(MAXNCDIM)
+C      allowable roundoff 
+      real epsilon
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      data name/'test.nc'/
+      data name2/'copy.nc'/
+      data epsilon /.000001/
+      
+100   format('*** Testing ', a, ' ...')
+c     set error-handling to verbose and non-fatal
+      ncopts = NCVERBOS
+      call ncpopt(ncopts)
+
+c     create a netCDF named 'test.nc'
+      write(*,100) 'nccre'
+      ncid = nccre(name, NCCLOB, iret)
+
+c     test ncddef
+      write(*,100) 'ncddef'
+      call tncddef(ncid)
+
+c     test ncvdef
+      write(*,100) 'ncvdef'
+      call tncvdef(ncid)
+
+c     test ncapt
+      write(*, 100) 'ncapt, ncaptc'
+      call tncapt(ncid)
+
+c     close 'test.nc'
+      write(*, 100) 'ncclos'
+      call ncclos(ncid, iret)
+
+c     test ncvpt1
+      write(*, 100) 'ncvpt1'
+      call tncvpt1(name)
+
+c     test ncvgt1
+      write(*, 100) 'ncvgt1'
+      call tncvgt1(name)
+
+c     test ncvpt
+      write(*, 100) 'ncvpt'
+      call tncvpt(name)
+
+c     test ncinq
+      write(*, 100) 'ncopn, ncinq, ncdinq, ncvinq, ncanam, ncainq'
+      call tncinq(name)
+
+c     test ncvgt
+      write(*, 100) 'ncvgt, ncvgtc'
+      call tncvgt(name)
+
+c     test ncagt
+      write(*, 100) 'ncagt, ncagtc'
+      call tncagt(name)
+
+c     test ncredf
+      write(*, 100) 'ncredf, ncdren, ncvren, ncaren, ncendf'
+      call tncredf(name)
+
+      call tncinq(name)
+
+c     test ncacpy
+      write(*, 100) 'ncacpy'
+      call tncacpy(name, name2)
+
+c     test ncadel
+      write(*, 100) 'ncadel'
+      call tncadel(name2)
+
+c     test reading from NetCDF file
+      write(*, 100) 'NetCDF read'
+      call tread_netcdf()
+
+      end
+c
+c     subroutine to test ncacpy
+c
+      subroutine tncacpy(iname, oname)
+      character*31 iname, oname
+      include 'netcdf.inc'
+      integer ndims, nvars, natts, recdim, iret
+      character*31 vname, attnam
+      integer attype, attlen
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+      integer lenstr
+c     existing netCDF id
+      integer incdf
+c     netCDF id of the output netCDF file to which the attribute
+c     will be copied
+      integer outcdf
+
+      integer mattlen
+      parameter (mattlen = 80)
+      character*80 charval
+      double precision doubval(2)
+      real flval(2)
+      integer lngval(2)
+      integer*2 shval(2)
+      integer i, j, k
+      character*31 varnam, attname(2,7), gattnam(2)
+      byte bytval(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      byte bvalidrg(2)
+      character*31 gavalue(2), cavalue(2)
+      real epsilon
+
+      data bvalidrg/1,110/
+      data svalidrg/-100,100/
+      data lvalidrg/0,360/
+      data rvalidrg/0.0, 5000.0/
+      data dvalidrg/0D0,500D0/
+      data gavalue/'NWS', '88/10/25 12:00:00'/
+      data cavalue/'test string', 'a'/
+      data lenstr/80/
+      data epsilon /.000001/
+
+      incdf = ncopn(iname, NCNOWRIT, iret)
+      outcdf = nccre(oname, NCCLOB, iret)
+      call tncddef(outcdf)
+      call tncvdef(outcdf)
+      call ncinq (incdf, ndims, nvars, natts, recdim, iret)
+      do 5 j = 1, natts
+         call ncanam (incdf, NCGLOBAL, j, attnam, iret)
+         call ncacpy (incdf, NCGLOBAL, attnam, outcdf, NCGLOBAL, iret)
+ 5    continue
+      do 10 i = 1, nvars
+         call ncvinq (incdf, i, vname, vartyp, nvdims,
+     +        vdims, nvatts, iret)
+         do 20 k = 1, nvatts
+            call ncanam (incdf, i, k, attnam, iret)
+            call ncacpy (incdf, i, attnam, outcdf, i, iret)
+ 20      continue
+ 10   continue
+c     
+c     get global attributes first
+c     
+      do 100 i = 1, natts
+         call ncanam (outcdf, NCGLOBAL, i, attnam, iret)
+         call ncainq (outcdf, NCGLOBAL, attnam, attype, attlen,
+     +        iret)
+         if (attlen .gt. mattlen) then
+            write (*,*) 'global attribute too big!', attlen, mattlen
+            stop 'Stopped'
+         else if (attype .eq. NCBYTE) then
+            call ncagt (outcdf, NCBYTE, attnam, bytval, iret)
+         else if (attype .eq. NCCHAR) then
+            call ncagtc (outcdf, NCGLOBAL, attnam, charval, 
+     +           lenstr, iret)
+            if (attnam .ne. gattnam(i)) write(*,*) 'error in ncagt G'
+            if (charval .ne. gavalue(i))
+     + write(*,*) 'error in ncagt G2', lenstr, charval, gavalue(i)
+                  charval = ' '                                    
+         else if (attype .eq. NCSHORT) then
+            call ncagt (outcdf, NCGLOBAL, attnam, shval, iret) 
+         else if (attype .eq. NCLONG) then
+            call ncagt (outcdf, NCGLOBAL, attnam, lngval, iret)            
+         else if (attype .eq. NCFLOAT) then
+            call ncagt (outcdf, NCGLOBAL, attnam, flval, iret)
+         else 
+            call ncagt (outcdf, NCGLOBAL, attnam, doubval,iret)          
+         end if
+ 100   continue
+c
+c     get variable attributes
+c
+      do 200 i = 1, nvars
+         call ncvinq (outcdf, i, varnam, vartyp, nvdims, vdims,
+     +                nvatts, iret)
+         do 250 j = 1, nvatts
+            call ncanam (outcdf, i, j, attnam, iret)
+            call ncainq (outcdf, i, attnam, attype, attlen,
+     +                   iret)
+            if (attlen .gt. mattlen) then
+               write (*,*) 'variable ', i,  'attribute too big !'
+               stop 'Stopped'
+            else 
+               if (attype .eq. NCBYTE) then
+                  call ncagt (outcdf, i, attnam, bytval, 
+     +                 iret)
+                  if (attnam .ne. attname(j,i))
+     +       write(*,*) 'error in ncagt BYTE N'
+                  if (bytval(j) .ne. bvalidrg(j)) write(*,*)
+     + 'ncacpy: byte ', bytval(j), ' .ne. ', bvalidrg(j)
+               else if (attype .eq. NCCHAR) then
+                  call ncagtc (outcdf, i, attnam, charval, 
+     +                 lenstr, iret)
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     +  'error in ncagt CHAR N'
+                  if (charval .ne. cavalue(j)) write(*,*)
+     +  'error in ncagt'
+                  charval = ' '                                   
+               else if (attype .eq. NCSHORT) then
+                  call ncagt (outcdf, i, attnam, shval, 
+     +                 iret)  
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt SHORT N'
+                  if (shval(j) .ne. svalidrg(j)) then
+                     write(*,*) 'error in ncagt SHORT'
+                  end if
+               else if (attype .eq. NCLONG) then
+                  call ncagt (outcdf, i, attnam, lngval, 
+     +                 iret)
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt LONG N'
+                  if (lngval(j) .ne. lvalidrg(j)) write(*,*)
+     + 'error in ncagt LONG'
+               else if (attype .eq. NCFLOAT) then
+                  call ncagt (outcdf, i, attnam, flval, 
+     +                 iret)            
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt FLOAT N'
+                  if (flval(j) .ne. rvalidrg(j)) write(*,*)
+     + 'error in ncagt FLOAT'
+               else if (attype .eq. NCDOUBLE) then
+                  call ncagt (outcdf, i, attnam, doubval,
+     +                 iret)          
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt DOUBLE N'
+                  if ( abs(doubval(j) - dvalidrg(j)) .gt. epsilon)
+     + write(*,*) 'error in ncagt DOUBLE'
+               end if
+            end if
+ 250     continue
+ 200   continue
+      call ncclos(incdf, iret)
+      call ncclos(outcdf, iret)
+      return
+      end
+
+
+      
+c     
+c     subroutine to test ncadel
+c
+      subroutine tncadel (cdfname)
+      character*31 cdfname
+      include 'netcdf.inc'
+      
+      integer  bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+      integer ncid, iret, i, j
+      integer ndims, nvars, natts, recdim
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+      character*31 varnam, attnam
+
+      ncid = ncopn(cdfname, NCWRITE, iret)
+c     put cdf in define mode
+      call ncredf (ncid,iret)
+c     get number of global attributes
+      call ncinq (ncid, ndims, nvars, natts, recdim, iret)
+      do 10 i = natts, 1, -1
+c     get name of global attribute
+         call ncanam (ncid, NCGLOBAL, i, attnam, iret)
+c     delete global attribute
+         call ncadel (ncid, NCGLOBAL, attnam, iret)
+ 10   continue
+
+      do 100 i = 1, nvars
+c     get number of variable attributes
+         call ncvinq (ncid, i, varnam, vartyp, nvdims, vdims,
+     +        nvatts, iret)
+         do 200 j = nvatts, 1, -1
+            call ncanam (ncid, i, j, attnam, iret)
+            call ncadel (ncid, i, attnam, iret)
+ 200     continue
+ 100  continue
+      call ncinq (ncid, ndims, nvars, natts, recdim, iret)
+      if (natts .ne. 0) write(*,*) 'error in ncadel'
+c     put netCDF into data mode
+      call ncendf (ncid, iret)
+      call ncclos (ncid, iret)
+      return
+      end
+
+c
+c     subroutine to test ncagt and ncagtc
+
+      subroutine tncagt(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+            
+c     maximum length of an attribute
+      integer mattlen
+      parameter (mattlen = 80)
+      integer ncid, ndims, nvars, natts, recdim
+      integer bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+      integer i, j
+      integer attype, attlen, lenstr, iret
+      character*31 attnam
+      character*80 charval
+      double precision doubval(2)
+      real flval(2)
+      integer lngval(2)
+      integer*2 shval(2)
+      byte bytval(2)
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+
+      character*31 varnam, attname(2,7), gattnam(2)
+      common /atts/attname, gattnam
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      byte bvalidrg(2)
+      character*31 gavalue(2), cavalue(2)
+      real epsilon
+
+      data bvalidrg/1,110/
+      data svalidrg/-100,100/
+      data lvalidrg/0,360/
+      data rvalidrg/0.0, 5000.0/
+      data dvalidrg/0D0,500D0/
+      data gavalue/'NWS', '88/10/25 12:00:00'/
+      data cavalue/'test string', 'a'/
+      data lenstr/80/
+      data epsilon /.000001/
+      
+      ncid = ncopn (cdfname, NCNOWRIT, iret)
+      call ncinq (ncid, ndims, nvars, natts, recdim, iret)
+c     
+c     get global attributes first
+c     
+      do 10 i = 1, natts
+c     get name of attribute
+         call ncanam (ncid, NCGLOBAL, i, attnam, iret)
+c     get attribute type and length
+         call ncainq (ncid, NCGLOBAL, attnam, attype, attlen,
+     +        iret)
+         if (attlen .gt. mattlen) then
+            write (*,*) 'global attribute too big!'
+            stop 'Stopped'
+         else if (attype .eq. NCBYTE) then
+            call ncagt (ncid, NCBYTE, attnam, bytval, iret)
+         else if (attype .eq. NCCHAR) then
+            call ncagtc (ncid, NCGLOBAL, attnam, charval, 
+     +           lenstr, iret)
+            if (attnam .ne. gattnam(i)) write(*,*) 'error in ncagt'
+            if (charval .ne. gavalue(i)) write(*,*) 'error in ncagt'
+            charval = '                                        '
+         else if (attype .eq. NCSHORT) then
+            call ncagt (ncid, NCGLOBAL, attnam, shval, iret) 
+         else if (attype .eq. NCLONG) then
+            call ncagt (ncid, NCGLOBAL, attnam, lngval, iret)            
+         else if (attype .eq. NCFLOAT) then
+            call ncagt (ncid, NCGLOBAL, attnam, flval, iret)
+         else 
+            call ncagt (ncid, NCGLOBAL, attnam, doubval,iret)          
+         end if
+ 10   continue
+
+c
+c     get variable attributes
+c
+      do 20 i = 1, nvars
+         call ncvinq (ncid, i, varnam, vartyp, nvdims, vdims,
+     +                nvatts, iret)
+         do 25 j = 1, nvatts
+            call ncanam (ncid, i, j, attnam, iret)
+            call ncainq (ncid, i, attnam, attype, attlen,
+     +                   iret)
+            if (attlen .gt. mattlen) then
+               write (*,*) 'variable ', i,  'attribute too big !'
+               stop 'Stopped'
+            else 
+               if (attype .eq. NCBYTE) then
+                  call ncagt (ncid, i, attnam, bytval, 
+     +                 iret)
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt BYTE name'
+                  if (bytval(j) .ne. bvalidrg(j)) write(*,*)
+     + 'ncacpy: byte ', bytval(j), ' .ne. ', bvalidrg(j)
+               else if (attype .eq. NCCHAR) then
+                  call ncagtc (ncid, i, attnam, charval, 
+     +                 lenstr, iret)
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt CHAR name'
+                  if (charval .ne. cavalue(j)) write(*,*)
+     + 'error in ncagt CHAR name'
+	         charval = '                                        '
+               else if (attype .eq. NCSHORT) then
+                  call ncagt (ncid, i, attnam, shval, 
+     +                 iret)  
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt SHORT name'
+                  if (shval(j) .ne. svalidrg(j)) then
+                     write(*,*) 'error in ncagt SHORT'
+                  end if
+               else if (attype .eq. NCLONG) then
+                  call ncagt (ncid, i, attnam, lngval, 
+     +                 iret)
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt LONG name'
+                  if (lngval(j) .ne. lvalidrg(j)) write(*,*)
+     + 'error in ncagt LONG'
+               else if (attype .eq. NCFLOAT) then
+                  call ncagt (ncid, i, attnam, flval, 
+     +                 iret)            
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt FLOAT name'
+                  if (flval(j) .ne. rvalidrg(j)) write(*,*)
+     + 'error in ncagt FLOAT'
+               else if (attype .eq. NCDOUBLE) then
+                  call ncagt (ncid, i, attnam, doubval,
+     +                 iret)          
+                  if (attnam .ne. attname(j,i)) write(*,*)
+     + 'error in ncagt DOUBLE name'
+                  if ( abs(doubval(j) - dvalidrg(j)) .gt. epsilon)
+     + write(*,*) 'error in ncagt DOUBLE'
+               end if
+            end if
+ 25      continue
+ 20   continue
+      call ncclos(ncid, iret)
+      return
+      end
+c
+c     subroutine to test ncapt
+c
+      subroutine tncapt (ncid)
+      include 'netcdf.inc'
+      integer ncid, iret
+
+c attribute vectors
+      integer*2 svalidrg(2)
+      real rvalidrg(2)
+      integer lvalidrg(2)
+      double precision dvalidrg(2)
+      byte bvalidrg(2)
+
+c     variable ids
+      integer  bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+
+c assign attributes
+      
+c
+c     byte
+c
+      
+      bvalidrg(1) = 1
+      bvalidrg(2) = 127
+      call ncapt (ncid, bid, 'valid range', NCBYTE, 2,
+     +bvalidrg, iret)
+
+c
+c     short
+c
+
+      svalidrg(1) = -100
+      svalidrg(2) = 100
+      call ncapt (ncid, sid, 'valid range', NCSHORT, 2, 
+     +svalidrg, iret)
+
+c
+c     long
+c
+
+      lvalidrg(1) = 0
+      lvalidrg(2) = 360
+      call ncapt (ncid, lid, 'valid range', NCLONG, 2,
+     +lvalidrg, iret)
+      
+c
+c     float
+c
+
+      rvalidrg(1) = 0.0
+      rvalidrg(2) = 5000.0
+      call ncapt (ncid, fid, 'valid range', NCFLOAT, 2,
+     +rvalidrg, iret)
+
+c
+c     double
+c
+
+      dvalidrg(1) = 0D0
+      dvalidrg(2) = 500D0
+      call ncapt (ncid, did, 'valid range', NCDOUBLE, 2,
+     +dvalidrg, iret)
+
+c
+c     global
+c
+
+      call ncaptc (ncid, NCGLOBAL, 'source', NCCHAR, 3, 
+     +'NWS', iret)
+      call ncaptc (ncid, NCGLOBAL, 'basetime', NCCHAR, 17, 
+     +'88/10/25 12:00:00', iret)
+
+c
+c     char
+c
+
+      call ncaptc (ncid, chid, 'longname', NCCHAR, 11,
+     +'test string', iret)
+
+      call ncaptc (ncid, chid, 'id', NCCHAR, 1,
+     +'a', iret)
+
+      return
+      end
+
+c
+c     initialize variables in labelled common blocks
+c
+      block data
+      common /cdims/ dimnam
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      common /varn/varnam
+      common /atts/attname, gattnam
+      integer  latdim, londim, leveldim, timedim, lendim
+
+c     should include 'netcdf.inc' for MAXNCDIM, but it has EXTERNAL
+c     declaration, which is not permitted in a BLOCK DATA unit.
+
+c      integer dimsiz(MAXNCDIM)
+      integer dimsiz(32)
+c      character*31 dimnam(MAXNCDIM)
+      character*31 dimnam(32)
+      character*31 varnam(7)
+      character*31 attname(2,7)
+      character*31 gattnam(2)
+
+      data dimnam /'time', 'lat', 'lon', 'level',
+     + 'length', 27*'0'/
+      data dimsiz /4, 5, 5, 4, 80, 27*0/
+      data varnam/'bytev', 'short v', 'longv', 'floatv', 'doublev', 
+     + 'chv', 'cv'/
+      
+      data attname/'valid range', '0', 'valid range',
+     + '0', 'valid range',
+     + '0', 'valid range', '0', 'valid range', '0', 'longname', 'id',
+     + '0', '0'/
+      data gattnam/'source','basetime'/
+      end
+
+
+c
+c     subroutine to test ncddef
+c
+
+      subroutine tncddef(ncid)
+      include 'netcdf.inc'
+      integer ncid
+
+c     sizes of dimensions of 'test.nc' and 'copy.nc'
+      integer  ndims
+      parameter(ndims=5)
+c dimension ids
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer iret
+c     function to define a netCDF dimension
+      integer dimsiz(MAXNCDIM)
+      character*31 dimnam(MAXNCDIM)
+      
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      common /cdims/ dimnam
+
+c define dimensions
+      timedim = ncddef(ncid, dimnam(1), NCUNLIM, iret)
+      latdim = ncddef(ncid, dimnam(2), dimsiz(2), iret)
+      londim = ncddef(ncid, dimnam(3), dimsiz(3), iret)
+      leveldim = ncddef(ncid, dimnam(4), dimsiz(4), iret)
+      lendim = ncddef(ncid, dimnam(5), dimsiz(5), iret)
+      return
+      end
+c
+c     subroutine to test ncinq, ncdinq, ncdid, ncvinq, ncanam
+c     and ncainq
+c
+      subroutine tncinq(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+
+c     netCDF id
+      integer ncid
+c     returned number of dimensions
+      integer ndims
+c     returned number of variables
+      integer nvars
+c     returned number of global attributes
+      integer natts
+c     returned id of the unlimited dimension
+      integer recdim
+c     returned error code
+      integer iret
+c     returned name of record dimension
+      character*31 recnam
+c     returned size of record dimension
+      integer recsiz
+c     loop control variables
+      integer i, j, k
+c     returned size of dimension
+      integer dsize
+c     returned dimension ID
+      integer dimid
+c     returned dimension name
+      character*31 dname
+c     returned variable name
+      character*31 vname
+c     returned attribute name
+      character*31 attnam
+c     returned netCDF datatype of variable
+      integer vartyp
+c     returned number of variable dimensions
+      integer nvdims
+c     returned number of variable attributes
+      integer nvatts
+c     returned vector of nvdims dimension IDS corresponding to the
+c     variable dimensions
+      integer vdims(MAXNCDIM)
+c     returned attribute length
+      integer attlen
+c     returned attribute type
+      integer attype
+      character*31 dimnam(MAXNCDIM)
+      character*31 varnam(7)
+      character*31 attname(2,7)
+      character*31 gattnam(2)
+      integer vdlist(5,7), vtyp(7), vndims(7), vnatts(7)
+      integer attyp(2,7),atlen(2,7),gattyp(2),gatlen(2)
+      integer timedim,latdim,londim,leveldim,lendim
+      integer dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      common /varn/varnam
+      common /atts/attname, gattnam
+      common /cdims/ dimnam
+
+      data vdlist/1,0,0,0,0,1,0,0,0,0,2,0,0,0,0,4,3,2,1,0,4,3,2,1,0,
+     + 5,1,0,0,0,1,0,0,0,0/
+      data vtyp/NCBYTE, NCSHORT, NCLONG, NCFLOAT, NCDOUBLE, NCCHAR,
+     + NCCHAR/
+      data vndims/1,1,1,4,4,2,1/
+      data vnatts/1,1,1,1,1,2,0/
+      data attyp/NCBYTE, 0, NCSHORT, 0, NCLONG, 0, NCFLOAT, 0,
+     + NCDOUBLE, 0, NCCHAR, NCCHAR, 0, 0/
+      data atlen/2,0,2,0,2,0,2,0,2,0,11,1, 0, 0/
+      data gattyp/NCCHAR,NCCHAR/
+      data gatlen/3,17/
+
+      ncid = ncopn (cdfname, NCNOWRIT, iret)
+      call ncinq (ncid, ndims, nvars, natts, recdim, iret)
+      if (ndims .ne. 5) write(*,*) 'error in ncinq or ncddef'
+      if (nvars .ne. 7) write(*,*) 'error in ncinq or ncvdef'
+      if (natts .ne. 2) write(*,*) 'error in ncinq or ncapt'
+      call ncdinq (ncid, recdim, recnam, recsiz, iret)
+      if (recnam .ne. 'time') write(*,*) 'error: bad recdim from ncinq'
+c
+c     dimensions
+c
+      do 10 i = 1, ndims
+         call ncdinq (ncid, i, dname, dsize, iret)
+         if (dname .ne. dimnam(i)) write(*,*)
+     + 'error in ncdinq or ncddef, dname=', dname
+         if (dsize .ne. dimsiz(i)) write(*,*)
+     + 'error in ncdinq or ncddef, dsize=',dsize
+         dimid = ncdid (ncid, dname, iret)
+         if (dimid .ne. i) write(*,*)
+     +      'error in ncdinq or ncddef, dimid=', dimid
+ 10   continue
+c
+c     variables
+c
+      do 30 i = 1, nvars
+         call ncvinq (ncid, i, vname, vartyp, nvdims,
+     +        vdims, nvatts, iret)
+         if (vname .ne. varnam(i)) write(*,*)
+     +  'error: from ncvinq, wrong  name returned: ', vname,
+     +  ' .ne. ', varnam(i)
+         if (vartyp .ne. vtyp(i)) write(*,*)
+     + 'error: from ncvinq, wrong type returned: ', vartyp,
+     + ' .ne. ', vtyp(i)
+         if (nvdims .ne. vndims(i)) write(*,*)
+     + 'error: from ncvinq, wrong num dims returned: ', vdims,
+     + ' .ne. ', vndims(i)
+         do 35 j = 1, nvdims
+            if (vdims(j) .ne. vdlist(j,i)) write(*,*)
+     + 'error: from ncvinq wrong dimids: ', vdims(j),
+     + ' .ne. ', vdlist(j,i)
+ 35      continue
+         if (nvatts .ne. vnatts(i)) write(*,*)
+     + 'error in ncvinq or ncvdef'
+c
+c     attributes
+c
+         do 45 k = 1, nvatts
+            call ncanam (ncid, i, k, attnam, iret)
+            call ncainq (ncid, i, attnam, attype, attlen, iret)
+            if (attnam .ne. attname(k,i)) write(*,*)
+     + 'error in ncanam or ncapt'
+            if (attype .ne. attyp(k,i)) write(*,*)
+     + 'error in ncainq or ncapt'
+            if (attlen .ne. atlen(k,i)) write(*,*)
+     + 'error in ncainq or ncapt'
+ 45      continue
+ 30   continue
+      do 40 i = 1, natts
+         call ncanam (ncid, NCGLOBAL, i, attnam, iret)
+         call ncainq (ncid, NCGLOBAL, attnam, attype, attlen, iret)
+         if (attnam .ne. gattnam(i)) write(*,*)
+     + 'error in ncanam or ncapt'
+         if (attype .ne. gattyp(i)) write(*,*)
+     + 'error in ncainq or ncapt'
+         if (attlen .ne. gatlen(i)) write(*,*)
+     + 'error in ncainq or ncapt'
+ 40   continue
+      call ncclos(ncid, iret)
+      return
+      end
+      
+      
+      
+c     subroutine to test ncredf, ncdren, ncvren, ncaren, and 
+c     ncendf
+
+      subroutine tncredf(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+      character*31 attname(2,7)
+      character*31 gattnam(2)
+      common /atts/attname, gattnam
+      common /cdims/ dimnam
+      character*31 dimnam(MAXNCDIM)
+      character*31 varnam(7)
+      common /varn/varnam
+      integer ncid, iret, latid, varid
+
+      dimnam(2) = 'latitude'
+      varnam(4) = 'realv'
+      attname(1,6) = 'stringname'
+      gattnam(1) = 'agency'
+      ncid = ncopn(cdfname, NCWRITE, iret)
+      call ncredf(ncid, iret)
+      latid = ncdid(ncid, 'lat', iret)
+      call ncdren(ncid, latid, 'latitude', iret)
+      varid = ncvid(ncid, 'floatv', iret)
+      call ncvren(ncid, varid, 'realv', iret)
+      varid = ncvid(ncid, 'chv', iret)
+      call ncaren(ncid, varid, 'longname', 'stringname', iret)
+      call ncaren(ncid, NCGLOBAL, 'source', 'agency', iret)
+      call ncendf(ncid, iret)
+      call ncclos(ncid, iret)
+      return
+      end
+c     
+c     subroutine to test ncvdef
+c
+
+      subroutine tncvdef(ncid)
+      include 'netcdf.inc'
+      integer ncid
+
+c     function to define a netCDF variable
+      integer dimsiz(MAXNCDIM)
+      integer  latdim, londim, leveldim, timedim, lendim
+      common /dims/timedim, latdim, londim, leveldim, lendim, 
+     + dimsiz
+
+c variable ids
+      integer  bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+
+c variable shapes
+      integer  bdims(1), fdims(4), ddims(4), ldims(1), sdims(1) 
+      integer chdims(2), cdims(1)
+
+      integer iret
+c
+c define variables
+c
+c     byte
+c 
+      bdims(1) = timedim
+      bid = ncvdef(ncid, 'bytev', NCBYTE, 1, bdims, iret)
+c
+c     short
+c
+      sdims(1) = timedim
+      sid = ncvdef (ncid, 'short v', NCSHORT, 1, sdims, iret)
+c
+c     long
+c
+      ldims(1) = latdim
+      lid = ncvdef (ncid, 'longv', NCLONG, 1, ldims, iret)
+c
+c     float
+c
+      fdims(4) = timedim
+      fdims(1) = leveldim
+      fdims(2) = londim
+      fdims(3) = latdim
+      fid = ncvdef (ncid, 'floatv', NCFLOAT, 4, fdims, iret)
+c
+c     double
+c
+      ddims(4) = timedim
+      ddims(1) = leveldim
+      ddims(2) = londim
+      ddims(3) = latdim
+      did = ncvdef (ncid, 'doublev', NCDOUBLE, 4, ddims, iret)
+c
+c     char
+c
+      chdims(2) = timedim
+      chdims(1) = lendim
+      chid = ncvdef (ncid, 'chv', NCCHAR, 2, chdims, iret)
+
+      cdims(1) = timedim
+      cid = ncvdef (ncid, 'cv', NCCHAR, 1, cdims, iret)
+
+
+      return
+      end
+
+
+c    
+c     subroutine to test ncvgt and ncvgtc
+c
+      subroutine tncvgt(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+
+      integer ndims, times, lats, lons, levels, lenstr
+      parameter (times=4, lats=5, lons=5, levels=4)
+
+      integer start(MAXNCDIM), count(MAXNCDIM)
+      integer ncid, iret, i, m
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+
+      integer bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+      integer itime, ilev, ilat, ilon
+
+c     arrays of data values to be read
+      byte barray(times), byval(times)
+      integer*2 sarray(times), shval(times)
+      integer larray(lats)
+      real farray(levels, lats, lons, times)
+      double precision darray(levels, lats, lons, times)
+c     character array of data values to be read
+      character*31 string
+      character*31 varnam
+      integer nvars, natts, recdim
+      integer vartyp, nvdims, vdims(MAXVDIMS), nvatts
+
+      data start/1,1,1,1, 28*0/, count/levels, lats, lons, times, 28*0/
+      data byval /97, 98, 99, 100/
+      data shval /10, 11, 12, 13/
+
+      ncid = ncopn (cdfname, NCWRITE, iret)
+c     get number of variables in netCDF
+      call ncinq (ncid, ndims, nvars, natts, recdim, iret)
+      do 5 m = 1, nvars-1
+c     get variable name, datatype, number of dimensions
+c     vector of dimension ids, and number of variable attributes
+         call ncvinq (ncid, m, varnam, vartyp, nvdims, vdims,
+     +                nvatts, iret)
+         if (vartyp .eq. NCBYTE) then
+c
+c     byte
+c
+            count(1) = times
+            call ncvgt (ncid, m, start, count, barray, iret)
+            do 10 i = 1, times
+               if (barray(i) .ne. byval(i)) then 
+                  write(*,*) 'ncvgt of bytes, got ', barray(i), ' .ne. '
+     +                       , byval(i)
+               end if
+ 10         continue
+         else if (vartyp .eq. NCSHORT) then
+c
+c     short
+c
+            count(1) = times
+            call ncvgt (ncid, m, start, count, sarray, iret)
+            do 20 i = 1, times
+               if (sarray(i) .ne. shval(i)) then 
+                  write(*,*) 'ncvgt of short, got ', sarray(i), ' .ne. '
+     +                       , shval(i)
+               end if
+ 20         continue
+         else if (vartyp .eq. NCLONG) then
+c     
+c     long
+c
+            count(1) = lats
+            call ncvgt (ncid, m, start, count, larray, iret)
+            do 30 i = 1, lats
+               if (larray(i) .ne. 1000) then 
+                  write(*,*) 'long error in ncvgt'
+               end if
+ 30         continue
+         else if (vartyp .eq. NCFLOAT) then
+c     
+c     float
+c
+            count(1) = levels
+            call ncvgt (ncid, m, start, count, farray, iret)
+            i = 0
+            do 40 itime = 1,times
+               do 40 ilon = 1, lons
+                  do 40 ilat = 1, lats
+                     do 40 ilev = 1, levels
+                        i = i + 1
+                        if (farray(ilev, ilat, ilon, itime) .ne.
+     + real(i)) then
+                           write (*,*) 'float error in ncvgt'
+                        end if
+ 40         continue
+         else if (vartyp .eq. NCDOUBLE) then
+c
+c     double
+c
+            count(1) = levels
+            call ncvgt (ncid, m, start, count, darray, iret)
+            i = 0
+            do 50 itime = 1, times
+               do 50 ilon = 1, lons
+                  do 50 ilat = 1, lats
+                     do 50 ilev = 1, levels
+                        i = i + 1
+                        if (darray(ilev, ilat, ilon, itime) .ne.
+     +                       real(i)) then
+                           write(*,*) 'double error in ncvgt:', i,
+     +              darray(ilev, ilat, ilon, itime), '.ne.', real(i)
+                        end if
+ 50         continue
+         else 
+c     
+c     char
+c
+	    count(1) = 3
+	    count(2) = 4
+	    lenstr = 31
+            call ncvgtc (ncid, m, start, count, string, lenstr, iret)
+            if (string .ne. 'testhikin of') then 
+               write(*,*) 'error in ncvgt, returned string =', string
+            end if
+         end if
+ 5    continue
+      call ncclos(ncid, iret)
+      return
+      end
+
+      
+      subroutine tncvgt1(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+
+      integer ncid, iret
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+
+      integer bindx, sindx, lindx, findx(4), dindx(4), cindx
+
+      integer bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+
+      byte bvalue
+      integer*2 svalue
+      integer lvalue
+      real fvalue
+      double precision dvalue
+      character*1 c
+      real epsilon
+      double precision onethird
+
+      data epsilon /.000001/
+      data lindx/1/, bindx/1/, sindx/1/, findx/1,1,1,1/
+     +dindx/1,1,1,1/, cindx/1/
+      data onethird/0.3333333333D0/
+      
+      ncid = ncopn (cdfname, NCNOWRIT, iret)
+c
+c     test ncvgt1 for byte
+c
+      call ncvgt1 (ncid, bid, bindx, bvalue, iret)
+      if (bvalue .ne. ichar('z')) write(*,*) 'error in ncvgt1 byte:',
+     + bvalue, ' .ne.', ichar('z')
+c
+c     test ncvgt1 for short
+c
+      call ncvgt1 (ncid, sid, sindx, svalue, iret)
+      if (svalue .ne. 10) write(*,*) 'error in ncvgt1 short:',
+     + svalue, ' .ne.', 10
+c     
+c     test ncvgt1 for long
+c
+      call ncvgt1 (ncid, lid, lindx, lvalue, iret)
+      if (lvalue .ne. 1000) write(*,*) 'error in ncvgt1 long:',
+     + lvalue,  ' .ne.', 1000
+c
+c     test ncvgt1 for float
+c
+      call ncvgt1 (ncid, fid, findx, fvalue, iret)
+      if (abs(fvalue - 3.14159) .gt. epsilon) write(*,*)
+     + 'error in ncvgt1 float:', fvalue, ' not close to', 3.14159
+c
+c     test ncvgt1 for double
+c
+      call ncvgt1 (ncid, did, dindx, dvalue, iret)
+      if (abs(dvalue - onethird) .gt. epsilon) write(*,*)
+     + 'error in ncvgt1 double:', dvalue, ' not close to',
+     +     onethird
+c
+c     test ncvg1c for char
+c
+      call ncvg1c (ncid, cid, cindx, c, iret)
+      if (c .ne. 'a') write(*,*) 'error in ncvg1c'
+      call ncclos(ncid, iret)
+      return
+      end
+
+      
+      
+c
+c     subroutine to test ncvpt and ncvptc
+c
+      subroutine tncvpt(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+
+c     size of dimensions
+      integer times, lats, lons, levels
+      parameter (times=4, lats=5, lons=5, levels=4)
+
+      integer ncid, iret
+c     loop control variables
+      integer itime, ilev, ilon, ilat, i
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim,
+     + dimsiz
+      integer lenstr
+      integer bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+
+c     vector of integers specifying the corner of the  hypercube
+c     where the first of the data values will be written
+      integer start(MAXNCDIM)
+c     vector of integers specifying the edge lengths from the
+c     corner of the hypercube where the first of the data values
+c     will be written
+      integer count(MAXNCDIM)
+
+c     arrays of data values to be written
+      byte barray(times)
+      integer*2 sarray(times)
+      integer larray(lats)
+      real farray(levels, lats, lons, times)
+      double precision darray(levels, lats, lons, times)
+      character*31 string
+
+      data start/1,1,1,1, 28*0/, count/levels, lats, lons, times, 28*0/
+      data barray /97, 98, 99, 100/
+      data sarray /10, 11, 12, 13/
+
+      ncid = ncopn (cdfname, NCWRITE, iret)
+
+c
+c     byte
+c
+      count(1) = times
+      call ncvpt (ncid, bid, start, count, barray, iret)
+c
+c     short
+c
+      count(1) = times
+      call ncvpt (ncid, sid, start, count, sarray, iret)
+c
+c     long
+c
+      do 30 i = 1,lats
+         larray(i) = 1000
+ 30   continue
+      count(1) = lats
+      call ncvpt (ncid, lid, start, count, larray, iret)
+c
+c     float
+c
+      i = 0
+      do 40 itime = 1,times
+         do 40 ilon = 1, lons
+            do 40 ilat = 1, lats
+               do 40 ilev = 1, levels
+                  i = i + 1
+                  farray(ilev, ilat, ilon, itime) = real(i)
+ 40   continue
+      count(1) = levels
+      call ncvpt (ncid, fid, start, count, farray, iret)
+c
+c     double
+c
+      i = 0
+      do 50 itime = 1, times
+         do 50 ilon = 1, lons
+            do 50 ilat = 1, lats
+               do 50 ilev = 1, levels
+                  i = i + 1
+                  darray(ilev, ilat, ilon, itime) = real(i)
+ 50   continue
+      count(1) = levels
+      call ncvpt (ncid, did, start, count, darray, iret)
+c
+c     char
+c
+      start(1) = 1
+      start(2) = 1
+      count(1) = 4
+      count(2) = 4
+      lenstr = 31
+      string = 'testthiskind of '
+      call ncvptc (ncid, chid,start, count, string, lenstr, iret)
+      call ncclos(ncid, iret)
+      return
+      end
+
+      
+      subroutine tncvpt1(cdfname)
+      include 'netcdf.inc'
+      character*31 cdfname
+
+
+      integer iret, ncid
+      integer  latdim, londim, leveldim, timedim, lendim
+      integer dimsiz(MAXNCDIM)
+      common /dims/timedim, latdim, londim, leveldim, lendim, 
+     + dimsiz
+
+      integer bindx, sindx, lindx, findx(4), dindx(4), cindx
+
+      integer lvalue
+      integer*2 svalue
+      byte bvalue
+      double precision onethird
+      integer bid, sid, lid, fid, did, cid, chid
+      common /vars/bid, sid, lid, fid, did, cid, chid
+      data lindx/1/, bindx/1/, sindx/1/, findx/1,1,1,1/
+     +dindx/1,1,1,1/, cindx/1/
+      data lvalue /1000/
+      data svalue/10/
+      data onethird/0.3333333333D0/
+
+      bvalue = ichar('z')
+      
+      ncid = ncopn (cdfname, NCWRITE, iret)
+c
+c     test ncvpt1 for byte
+c
+      call ncvpt1 (ncid, bid, bindx, bvalue, iret)
+c
+c     test ncvpt1 for short
+c
+      call ncvpt1 (ncid, sid, sindx, svalue, iret)
+c     
+c     test ncvpt1 for long
+c
+      call ncvpt1 (ncid, lid, lindx, lvalue, iret)
+c
+c     test ncvpt1 for float
+c
+      call ncvpt1 (ncid, fid, findx, 3.14159, iret)
+c
+c     test ncvpt1 for double
+c
+      call ncvpt1 (ncid, did, dindx, onethird, iret)
+c
+c     test ncvp1c for char
+c
+      call ncvp1c (ncid, cid, cindx, 'a', iret)
+      call ncclos (ncid, iret)
+      return
+      end
+
+C        This routine reads varaibales and global attributes from
+C        the REAL NetCDF file test_nc.nc. The file was created by NetCDF v3.5 
+C        from the file test_nc.cdl that can be found in the mfhdf/fortran
+C        directory. Please do not generate test_nc.nc file from the test_nc.cdl
+C        using HDF4 ncgen. HDF4 ncgen generated HDF4 file!
+
+         subroutine tread_netcdf()
+         include 'netcdf.inc'
+
+C        Variables declarations
+
+         character*10 FILENAME
+         character*1024 new_filename
+         integer filename_len
+         integer status, ncid, var_id
+         integer time(12), date(12), start(3), count(3), int_attr(5)
+         real a(3,2), float_attr(3)
+         double precision c(3), double_attr(3)
+         integer*2 b(2,3,12), short_attr(2)
+         integer i, j, k, dlen
+         character*10 description
+
+C        Arrays to read data to.
+
+         integer time_val(12), date_val(12), int_attr_val(5)
+         integer*2 b_val(2,3,12), short_attr_val(2)
+         real a_val(3,2), float_attr_val(3)
+         double precision c_val(3), double_attr_val(3)
+         real epsilon
+         double precision depsilon
+
+C        Arrays initialization
+         DATA time_val /1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12/
+         DATA date_val /840116, 840214, 840316, 840415, 840516, 840615, 
+     +              840716, 840816, 840915, 841016, 841115, 841216/
+         DATA a_val /1.0, 2.0, 3.0, 4.0, 5.0, 6.0/
+         DATA b_val /1, 1, 2, 2, 3, 3,
+     +           4, 4, 5, 5, 6, 6,
+     +           7, 7, 8, 8, 9, 9,
+     +           10, 10, 11, 11, 12, 12,
+     +           13, 13, 14, 14, 15, 15,
+     +           16, 16, 17, 17, 18, 18,
+     +           19, 19, 20, 20, 21, 22,
+     +           23, 23, 24, 24, 25, 25, 
+     +           26, 26, 27, 27, 28, 28,
+     +           29, 29, 30, 30, 31, 31,
+     +           32, 32, 33, 33, 34, 34,
+     +           35, 35, 36, 36, 37, 37/
+         DATA c_val /2.0, 3.0, 100/
+         DATA int_attr_val /-100, 200, -300, 400, -500/
+         DATA float_attr_val /1.0, 2.0, 3.0/
+         DATA short_attr_val /0, 1/
+         DATA double_attr_val /-1.0, 2.0, -7.0/
+         DATA epsilon /1.E-6/
+         DATA depsilon /1.E-12/
+         
+C        Modify filename to accomodate SRCDIR configure option
+
+         FILENAME = 'test_nc.nc'
+         filename_len = len(new_filename)
+         call fixname(FILENAME, new_filename, filename_len)
+
+         dlen = 10
+         ncid = ncopn(new_filename(1:filename_len), NCNOWRIT, status)
+         if (status .ne.0) then
+             write(*,*) 'ncopn failed'
+             goto 1000
+         endif
+
+         var_id = ncvid(ncid, 'time', status)
+         start(1) = 1 
+         count(1) = 12
+         call ncvgt(ncid, var_id, start, count, time, status)
+         if (status .ne. 0) write(*,*) 
+     +      'ncvgt failed for 32-bit integer variable time'
+         do i = 1, 12
+            if( time(i) .ne. time_val(i) ) 
+     +      write(*,*) 'Wrong time value at index  ', i 
+         enddo
+
+         var_id = ncvid(ncid, 'c', status)
+         start(1) = 1 
+         count(1) = 3
+         call ncvgt(ncid, var_id, start, count, c, status)
+         if (status .ne. 0) write(*,*)
+     +      'ncvgt failed for 64-bit float variable c'
+         do i = 1, 3
+            if( abs(c(i) - c_val(i)) .gt. depsilon ) 
+     +      write(*,*) 'Wrong c value at index  ', i 
+         enddo
+
+         var_id = ncvid(ncid, 'date', status)
+         start(1) = 1 
+         count(1) = 12
+         call ncvgt(ncid, var_id, start, count, date, status)
+         if (status .ne. 0) write(*,*) 
+     +      'ncvgt failed for 32-bit integer variable date'
+         do i = 1, 12
+            if( date(i) .ne. date_val(i) ) 
+     +      write(*,*) 'Wrong date value at index  ', i 
+         enddo
+
+
+         var_id = ncvid(ncid, 'a', status)
+         start(1) = 1 
+         start(2) = 1
+         count(1) = 3
+         count(2) = 2
+         call ncvgt(ncid, var_id, start, count, a, status)
+         if (status .ne. 0) write(*,*) 
+     +      'ncvgt failed for 32-bit real variable a'
+         do i = 1, 2
+            do j = 1, 3 
+            if( abs(a(j,i) - a_val(j,i)) .gt. epsilon ) 
+     +      write(*,*) 'Wrong a value at indecies  ', j, ',', i 
+            enddo
+         enddo
+
+
+         var_id = ncvid(ncid, 'b', status)
+         start(1) = 1 
+         start(2) = 1
+         start(3) = 1
+         count(1) = 2 
+         count(2) = 3
+         count(3) = 12
+         call ncvgt(ncid, var_id, start, count, b, status)
+         if (status .ne. 0) write(*,*) 
+     +      'ncvgt failed for 16-bit integer variable b'
+         do i = 1, 12
+            do j = 1, 3 
+               do k = 1, 2
+               if( b(k,j,i) .ne.  b_val(k,j,i)) 
+     +         write(*,*) 
+     +        'Wrong b value at indecies  ', k, ',', j, ',', i 
+               enddo
+            enddo
+         enddo
+
+
+C read global attributes
+
+         call ncagt(ncid, NCGLOBAL, 'int_attr', int_attr, status)
+         if (status .ne. 0) 
+     +   write(*,*) 'ncagt failed for 32-bit integer attribute int_attr'
+         do i = 1, 5
+            if( int_attr(i) .ne. int_attr_val(i) ) 
+     +      write(*,*) 'Wrong int_attr value at index  ', i 
+         enddo
+
+
+         call ncagt(ncid, NCGLOBAL, 'float_attr', float_attr, status)
+         if (status .ne. 0) 
+     +   write(*,*) 'ncagt failed for 32-bit float attribute float_attr'
+         do i = 1, 3 
+            if( abs(float_attr(i) - float_attr_val(i)) .gt. epsilon ) 
+     +      write(*,*) 'Wrong float_attr value at index  ', i 
+         enddo
+
+         call ncagt(ncid, NCGLOBAL, 'double_attr', double_attr, status)
+         if (status .ne. 0) 
+     +   write(*,*) 
+     +   'ncagt failed for 64-bit float attribute double_attr'
+         do i = 1, 3 
+            if( abs(double_attr(i) - double_attr_val(i)) .gt. depsilon ) 
+     +      write(*,*) 'Wrong double_attr value at index  ', i 
+         enddo
+
+
+         call ncagt(ncid, NCGLOBAL, 'short_attr', short_attr, status)
+         if (status .ne. 0) 
+     +   write(*,*) 
+     +   'ncagt failed for 16-bit integer attribute double_attr'
+         do i = 1, 2 
+            if( short_attr(i) .ne. short_attr_val(i) ) 
+     +      write(*,*) 'Wrong short_attr value at index  ', i 
+         enddo
+
+
+         call ncagtc(ncid, NCGLOBAL, 'Description', description, 
+     +               dlen, status)
+         if (status .ne. 0) 
+     +   write(*,*) 
+     +   'ncagt failed for character attribute Description'
+         if (description .ne. 'Attributes') 
+     +   write(*,*) 'Wrong values of the character attribute' 
+
+
+1000     continue
+         return
+        end
diff --git a/mfhdf/fortran/hdftest.f b/mfhdf/fortran/hdftest.f
new file mode 100644
index 0000000..7fbc943
--- /dev/null
+++ b/mfhdf/fortran/hdftest.f
@@ -0,0 +1,2630 @@
+C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+C  Copyright by The HDF Group.                                               *
+C  Copyright by the Board of Trustees of the University of Illinois.         *
+C  All rights reserved.                                                      *
+C                                                                            *
+C  This file is part of HDF.  The full HDF copyright notice, including       *
+C  terms governing use, modification, and redistribution, is contained in    *
+C  the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C  of the source code distribution tree; Copyright.html can be found at      *
+C  http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C  access to either file, you may request a copy from help at hdfgroup.org.     *
+C * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+C     Testing the Fortran interface for the multiple SD routines
+C
+      program hdftest
+
+      implicit none
+
+      include 'mffunc.inc'
+      integer hxsdir, hxscdir
+      external hxsdir, hxscdir
+
+      integer fid1, fid2
+      integer fid_empty
+
+      integer sds1, sds2, sds3, sds4
+      integer sds_empty, index_empty, flag_empty
+
+      integer dim1, dim2
+
+      integer access, nt, rank, stat, i, err
+      integer err_chunk, err_char_chunk, err_compress
+      integer*4 ival, ivals(1000)
+      integer dims(10), start(10), end(10), stride(10), count, nattr
+      integer idims(10)
+      integer num, ref, j
+      real*4 fval
+
+      real*8  cal, cale, ioff, ioffe
+      real*8  eps
+      character*50  name, l, u, f, c
+      character cdata(6,4), icdata(6,4), cfill, icfill
+      character catt(2), icatt(2)
+      integer*4   i32(2), ii32(2), max32, min32
+      integer*4 natt(2), inatt(2)
+      integer SD_UNLIMITED, SD_DIMVAL_BW_INCOMP, DFNT_INT32
+      integer DFNT_FLOAT32, DFNT_CHAR8
+      integer SD_DIMVAL_BW_COMP, SD_FILL, SD_NOFILL
+      parameter (SD_UNLIMITED = 0,
+     +            SD_DIMVAL_BW_INCOMP = 0,
+     +            SD_DIMVAL_BW_COMP = 1,
+     +            DFNT_INT32 = 24,
+     +            DFNT_FLOAT32 = 5,
+     +            DFNT_CHAR8 = 4,
+     +            SD_FILL = 0,
+     +            SD_NOFILL = 256)
+      DATA cfill/'@'/, icfill/' '/
+      DATA catt/'U','S'/, icatt/' ',' '/
+      DATA natt/10,20/, inatt/0,0/
+      DATA i32/15,25/, ii32/0,0/
+
+      err=0
+
+C
+C--- Create a file with an empty SDS
+C
+      fid_empty = sfstart('test_empty.hdf', 4)
+      if(fid_empty.eq.-1) then
+         print *, 'sfstart returned bad ID'
+         err = err + 1
+      endif
+C
+C--- Create an empty SDS
+C
+      dims(1) = 4
+      dims(2) = 9
+      nt = DFNT_INT32
+      rank = 2
+      sds_empty = sfcreate(fid_empty, 'Empty_SDS', nt, rank, dims)
+      if(sds_empty.eq.-1) then
+         print *, 'SDcreate Empty  returned bad ID', sds_empty
+         err = err + 1
+      endif
+
+      stat = sfendacc(sds_empty)
+      if(stat.ne.0) then
+         print *, 'SDendaccess returned', stat
+         err = err + 1
+      endif
+      stat = sfend(fid_empty)
+      if(stat.ne.0) then
+         print *, 'SDend returned', stat
+         err = err + 1
+      endif
+
+C     create a new file
+      err = 0
+      eps = 0.0001
+      access = 4
+      fid1 = sfstart('test1.hdf', access)
+      if(fid1.eq.-1) then
+         print *, 'sfstart returned bad ID'
+         err = err + 1
+      endif
+
+      dims(1) = 4
+      dims(2) = 9
+      nt = DFNT_INT32
+      rank = 2
+      sds1 = sfcreate(fid1, 'Alpha', nt, rank, dims)
+      if(sds1.eq.-1) then
+         print *, 'SDcreate #1 returned bad ID', sds1
+         err = err + 1
+      endif
+
+      dims(1) = 2
+      dims(2) = 5
+      dims(3) = 15
+      nt = DFNT_FLOAT32
+      rank = 3
+      sds2 = sfcreate(fid1, 'Beta[float32]', nt, rank, dims)
+      if(sds2.eq.-1) then
+         print *, 'SDcreate #2 returned bad ID', sds2
+         err = err + 1
+      endif
+
+      ival = 14
+      stat = sfsfill(sds1, ival)
+      if(stat.ne.0) then
+         print *, 'Set fill returned', stat
+         err = err + 1
+      endif
+
+      max32 = 10
+      min32 = 1
+      stat = sfsrange(sds1, max32, min32)
+      if(stat.ne.0) then
+         print *, 'Set range returned', stat
+         err = err + 1
+      endif
+      max32 = 0
+      min32 = 0
+
+      do 100 i = 1, 10
+         ivals(i) = i
+ 100  continue
+
+      start(1)  = 0
+      start(2)  = 0
+      stride(1) = 1
+      stride(2) = 1
+      end(1)    = 3
+      end(2)    = 3
+      stat = sfwdata(sds1, start, stride, end, ivals)
+      if(stat.ne.0) then
+         print *, 'Write data returned', stat
+         err = err + 1
+      endif
+      
+      fval = -14.25
+      stat = sfsfill(sds2, fval)
+      if(stat.ne.0) then
+         print *, 'Set fill returned', stat
+         err = err + 1
+      endif
+
+      start(1)  = 1
+      start(2)  = 1
+      stride(1) = 1
+      stride(2) = 1
+      end(1)    = 3
+      end(2)    = 3
+      stat = sfrdata(sds1, start, stride, end, ivals)
+      if(stat.ne.0) then
+         print *, 'Read data returned', stat
+         err = err + 1
+      endif
+
+      if (ivals(1).ne.5)  then
+         err = err + 1
+         print *, 'was expecting 5 got', ivals(1)
+      endif
+      
+      if(err.ne.0) print *, 'Before ReadVerify err = ', err
+      if (ivals(2).ne.6)  then
+        err = err + 1
+        print *, 'was expecting 6 got', ivals(2)
+      endif
+      if (ivals(3).ne.14) then
+        err = err + 1
+        print *, 'was expecting 14 got', ivals(3)
+        endif
+      if (ivals(4).ne.8)  then
+        err = err + 1
+        print *, 'was expecting 8 got', ivals(4)
+        endif
+
+
+      if (ivals(5).ne.9)  then
+        err = err + 1
+        print *, 'was expecting 9 got', ivals(5)
+        endif
+
+      if (ivals(6).ne.14) then
+        err = err + 1
+        print *, 'was expecting 14 got', ivals(6)
+        endif
+
+      if (ivals(7).ne.14) then
+        err = err + 1
+        print *, 'was expecting 14 got', ivals(7)
+        endif
+
+      if (ivals(8).ne.14) then
+        err = err + 1
+        print *, 'was expecting 14 got', ivals(8)
+        endif
+
+      if (ivals(9).ne.14) then
+        err = err + 1
+        print *, 'was expecting 14 got', ivals(9)
+        endif
+
+      if(err.ne.0) print *, 'After ReadVerify err = ', err
+
+      nt = DFNT_INT32
+      stat = sfsnatt(sds2, 'TestAttr', nt, 3, ivals)
+      if(stat.ne.0) then
+         print *, 'Set numeric attr returned', stat
+         err = err + 1
+      endif
+
+      dim1 = sfdimid(sds2, 1)
+      if(dim1.ne.327683) then
+         print *, 'Dim id returned', dim1
+         err = err + 1
+      endif
+
+      stat = sfsdmname(dim1, 'TestDim')
+      if(stat.ne.0) then
+         print *, 'Set dim name returned', stat
+         err = err + 1
+      endif
+
+      stat = sfsdmstr(dim1, 'dA', 'dBB', 'dCCC')
+      if(stat.ne.0) then
+         print *, 'Set dim strs returned', stat
+         err = err + 1
+      endif
+
+      do 110 i = 1, 10
+         ivals(i) = 10 * i + i
+ 110  continue
+
+      nt = DFNT_INT32
+      count = 5
+      stat = sfsdscale(dim1, count, nt, ivals)
+      if(stat.ne.0) then
+         print *, 'Set dims scales returned', stat
+         err = err + 1
+      endif
+
+      stat = sfsdtstr(sds1, 'lxxx', 'uyyy', 'fzzz', 'caaa')
+      if(stat.ne.0) then
+         print *, 'Set data strings returned', stat
+         err = err + 1
+      endif
+
+      stat = sffinfo(fid1, num, nattr)
+      if(stat.ne.0.or.num.ne.3) then
+         print *, 'File info returned wrong values', stat, num
+         err = err + 1
+      endif
+
+      cal   = 10.1
+      cale  = 20.1
+      ioff  = 40.1
+      ioffe = 50.1
+C     why 16?  16 is not a legal HDF NType value.
+      nt    = 16
+      stat = sfscal(sds2, cal, cale, ioff, ioffe, nt)
+      if(stat.ne.0) then
+         print *, 'Set calibration returned', stat
+         err = err + 1
+      endif
+
+      stat = sfn2index(fid1, 'Alpha')
+      if(stat.ne.0) then
+         print *, 'Index of Alpha data set is wrong', stat
+         err = err + 1
+      endif
+
+      ref = sfid2ref(sds1)
+      if(ref.eq.0) then
+         print *, 'sfidtoref failed'
+         err = err + 1
+      endif
+
+      stat = sfref2index(fid1, ref)
+      if(stat.ne.0) then
+         print *, 'mapping from ref to index failed', stat
+         err = err + 1
+      endif
+
+      stat = sfn2index(fid1, 'Bogus')
+      if(stat.ne.(-1)) then
+         print *, 'Found a bogus data set with index', stat
+         err = err + 1
+      endif
+
+      nt = DFNT_CHAR8
+      stat = sfscatt(fid1, 'Globulator', nt, 12, 'Howdy Sailor')
+      if(stat.ne.0) then
+         print *, 'Set attr returned', stat
+         err = err + 1
+      endif
+      nt = DFNT_INT32
+      stat = sfsnatt(fid1, 'Numeric', nt, 2, i32)
+      if(stat.ne.0) then
+         print *, 'Set attr returned', stat
+         err = err + 1
+      endif
+
+      stat = sfendacc(sds1)
+      if(stat.ne.0) then
+         print *, 'SDendaccess returned', stat
+         err = err + 1
+      endif
+      stat = sfend(fid1)
+      if(stat.ne.0) then
+         print *, 'SDend returned', stat
+         err = err + 1
+      endif
+
+C
+C     OK, let's open it back up and take a look at what we've done
+C
+      fid_empty = sfstart('test_empty.hdf', 3)
+      if(fid_empty.eq.-1) then
+          print *, 'Reopen returned', fid_empty
+          err = err + 1
+      endif
+      index_empty = sfn2index(fid_empty,'Empty_SDS')
+ 
+      sds_empty= sfselect(fid_empty, index_empty)
+      if(sds_empty.eq. -1) then
+         print *, 'Select returned', sds_empty
+         err = err + 1
+      endif
+      stat = sfchempty(sds_empty, flag_empty)
+      if(stat.ne. 0 .or. flag_empty. ne. 1) then
+        print*, 'sfchempty returned wrong flag, should be 1)'
+        err = err +1
+      endif 
+
+      stat = sfendacc(sds_empty)
+      if(stat.ne.0) then
+         print *, 'SDendaccess returned', stat
+         err = err + 1
+      endif
+      stat = sfend(fid_empty)
+      if(stat.ne.0) then
+         print *, 'SDend returned', stat
+         err = err + 1
+      endif
+
+      fid2 = sfstart('test1.hdf', 3)
+      if(fid2.eq.-1) then
+          print *, 'Reopen returned', fid2
+          err = err + 1
+      endif
+ 
+      sds3 = sfselect(fid2, 0)
+      if(sds3.eq. -1) then
+         print *, 'Select returned', sds3
+         err = err + 1
+      endif
+      stat = sfchempty(sds3, flag_empty)
+      if(stat.ne. 0 .or. flag_empty. ne. 0) then
+        print*, 'sfchempty returned wrong flag, should be 0)'
+        err = err +1
+      endif
+
+      stat = sfginfo(sds3, name, rank, idims, nt, nattr)
+      if(stat.ne.0) then
+         print *, 'Get info returned ', stat
+         err = err + 1
+      endif
+
+      if(nt.ne.DFNT_INT32) then
+         print *, 'Incorrect number type ', nt
+         err = err + 1
+      endif
+
+      if(rank.ne.2) then
+         print *, 'Incorrect rank ', rank
+         err = err + 1
+      endif
+
+      if(idims(1).ne.4) then
+         print *, 'Incorrect Dim(1) = ', idims(1)
+         err = err + 1
+      endif
+
+      if(idims(2).ne.9) then
+         print *, 'Incorrect Dim(2) = ', idims(2)
+         err = err + 1
+      endif
+
+      if(nattr.ne.6) then
+         print *, 'Wrong number of attributes returned', nattr
+         err = err + 1
+      endif
+
+      print *, 'name = ',   name
+
+      stat = sfgrange(sds3, max32, min32)
+      if(stat.ne.0) then
+         print *, 'Get range returned', stat
+         err = err + 1
+      endif
+
+      if(max32.ne.10) then
+         print *, 'Max from GetRange ', max32
+         err = err + 1
+      endif
+
+      if(min32.ne.1) then
+         print *, 'Min from GetRange ', min32
+         err = err + 1
+      endif
+
+      if(err.ne.0) print *, 'Current error count ', err
+
+      stat = sfgfill(sds3, max32)
+      if(stat.ne.0) then
+         print *, 'Get fillvalue returned', stat
+         err = err + 1
+      endif
+
+      if(max32.ne.14) then
+         print *, 'Incorrect FillValue ', max32
+         err = err + 1
+      endif
+
+      sds4 = sfselect(fid2, 1)
+      if(sds4.eq. -1) then
+         print *, 'Select #4  returned', sds4
+         err = err + 1
+      endif
+
+      dim2 = sfdimid(sds4, 1)
+      if(dim2.eq. -1) then
+         print *, 'Get dim id #2 returned', dim2
+         err = err + 1
+      endif
+
+      stat = sfgdinfo(dim2, name, rank, nt, nattr)
+      if(stat.ne.0) then
+         print *, 'Get dim info returned', stat
+         err = err + 1
+      endif
+
+      if(nt.ne.DFNT_INT32) err = err + 1
+      if(rank.ne.5) err = err + 1
+      print *, 'name = ',   name
+
+      stat = sfgainfo(fid2, 0, name, nt, rank)
+      if(stat.ne.0) then
+         print *, 'Attr info returned', stat
+         err = err + 1
+      endif
+      
+      if(nt.ne.4) err = err + 1
+      if(rank.ne.12) err = err + 1
+      print *, 'name = ',   name
+
+      cal   = 0
+      cale  = 0
+      ioff  = 0 
+      ioffe = 0
+      nt    = 0
+      stat = sfgcal(sds4, cal, cale, ioff, ioffe, nt)
+      if(stat.ne.0) then
+         print *, 'Get cal returned', stat
+         err = err + 1
+      endif
+
+      if(abs(cal - 10.1) .gt. eps) err = err + 1
+      if(abs(cale - 20.1) .gt. eps) err = err + 1
+      if(abs(ioff - 40.1) .gt. eps) err = err + 1
+      if(abs(ioffe - 50.1) .gt. eps) err = err + 1
+      if(nt.ne.16) err = err + 1
+
+
+      do 120 i = 1, 10
+         ivals(i) = 0
+ 120  continue
+
+      stat = sfgdscale(dim2, ivals)
+      if(stat.ne.0) then
+         print *, 'Get scales returned', stat
+         err = err + 1
+      endif
+
+      if (ivals(1).ne.11) err = err + 1
+      if (ivals(2).ne.22) err = err + 1
+      if (ivals(3).ne.33) err = err + 1
+      if (ivals(4).ne.44) err = err + 1
+      if (ivals(5).ne.55) err = err + 1
+
+      stat = sfgdtstr(sds3, l, u, f, c, 50)
+      if(stat.ne.0) then
+         print *, 'Get data strs returned', stat
+         err = err + 1
+      endif
+      
+      print *, 'label    = ', l
+      print *, 'unit     = ', u
+      print *, 'format   = ', f
+      print *, 'coordsys = ', c
+
+      stat = sfgdmstr(dim2, l, u, f, 50)
+      if(stat.ne.0) then
+         print *, 'Get dim strs returned', stat
+         err = err + 1
+      endif
+      
+      print *, 'label    = ', l
+      print *, 'unit     = ', u
+      print *, 'format   = ', f
+
+      stat = sfrcatt(fid2, 0, name)
+      if(stat.ne.0) then
+         print *, 'Attr read returned', stat
+         err = err + 1
+      endif
+      print *, 'values = ', name
+      stat = sfrnatt(fid2, 1, ii32)
+      if(stat.ne.0) then
+         print *, 'Attr read returned', stat
+         err = err + 1
+      endif
+      if ((ii32(1) .ne. 15) .or. (ii32(2) .ne. 25)) then
+         print *, 'Numeirc attr read erro: '
+         print *, ' should be 15 25, get ',ii32(1), ii32(2)
+         err = err + 1
+      endif
+
+C
+C     Testing External Element functions: sfsextf, hxsdir, hxscdir.
+C     First set the external create directory to "testdir".
+C     Set dataset sds3 to store in external file.
+C     Try read it back (should fail the first time).
+C     Set locating directory to "nosuch:testdir".
+C     Read again.  Should succeed this time.
+C
+      stat = hxscdir('testdir')
+      if(stat.ne.0) then
+	 print *, 'HX set create dir (hxscdir) returned', stat
+	 err = err + 1
+      endif
+
+      stat = sfsextf(sds3, 'testext.hdf', 0)
+      if(stat.ne.0) then
+	 print *, 'set external file (sfsextf) returned', stat
+	 err = err + 1
+      endif
+
+C
+C     Close and reopen sds3 so that data is flushed to the ext. file
+C
+      stat = sfendacc(sds3)
+      if(stat.ne.0) then
+         print *, 'sfendacc returned', stat
+         err = err + 1
+      endif
+
+      sds3 = sfselect(fid2, 0)
+      if(sds3.eq.-1) then
+         print *, 'Select returned', sds3
+         err = err + 1
+      endif
+
+      start(1)  = 1
+      start(2)  = 1
+      stride(1) = 1
+      stride(2) = 1
+      end(1)    = 3
+      end(2)    = 3
+      stat = sfrdata(sds3, start, stride, end, ivals)
+C
+C     Should fail first time.
+C
+      if(stat.ne.-1) then
+         print *, 'Read data (sfrdata) returned', stat
+         err = err + 1
+      endif
+
+      stat = hxsdir('nosuch|testdir')
+      if(stat.ne.0) then
+	 print *, 'HX set dir (hxscdir) returned', stat
+	 err = err + 1
+      endif
+
+      stat = sfrdata(sds3, start, stride, end, ivals)
+C
+C     Should succeed this time.
+C
+      if(stat.ne.0) then
+         print *, 'Read data (sfrdata) returned', stat
+         err = err + 1
+      endif
+
+      if (ivals(1).ne.5)  then
+         err = err + 1
+         print *, 'was expecting 5 got', ivals(1)
+      endif
+
+      stat = sfendacc(sds3)
+      if(stat.ne.0) then
+         print *, 'sfendacc returned', stat
+         err = err + 1
+      endif
+
+      stat = sfendacc(sds4)
+      if(stat.ne.0) then
+         print *, 'sfendacc returned', stat
+         err = err + 1
+      endif
+
+      stat = sfend(fid2)
+      if(stat.ne.0) then
+         print *, 'SDend returned', stat
+         err = err + 1
+      endif
+
+C     test sfsdmvc and sfisdmvc -- dimval backward compatible 
+      fid1 = sfstart('test2.hdf', 4)
+      if(fid1 .lt. 1) then
+         print *, 'sfstart returned', fid1
+         err = err + 1
+      endif
+
+      dims(1) = 6
+      dims(2) = 0
+      nt = DFNT_INT32
+      rank = 2
+      sds1 = sfcreate(fid1, 'ncomp', nt, rank, dims)
+      if (sds1 .eq. -1) then
+         print *, 'sfcreate returned', sds1
+         err = err + 1
+      endif
+
+      dim1 = sfdimid(sds1, 0)
+      if (dim1 .eq. -1) then
+         print *, 'sfdimid returned', dim1
+         err = err + 1
+      endif
+
+      stat = sfsdmvc(dim1, 0)
+      if(stat .ne. 0) then
+         print *, 'sfsdmvc returned', stat
+         err = err + 1
+      endif
+      dim2 = sfdimid(sds1, 1)
+      stat = sfsdmvc(dim2, 0)
+      if(stat .ne. 0) then
+         print *, 'sfsdmvc returned', stat
+         err = err + 1
+      endif
+      do 140 i=1, 6
+         ivals(i) = i*5
+140   continue
+      stat = sfsdscale(dim1, 6, DFNT_INT32, ivals)
+      if(stat .ne. 0) then
+          print *, 'sfsdscale returned', stat
+          err = err + 1
+      endif
+      start(1)=0
+      start(2)=0
+      stride(1) = 1
+      stride(2) = 1
+      end(1)=6
+      end(2)=4
+      do 160 i=1, 24
+        ivals(i) = i
+160   continue
+      stat = sfwdata(sds1, start, stride, end, ivals)
+      if (stat .ne. 0) then
+          print *, 'sfwdata returned', stat
+          err = err + 1
+      endif
+      stat = sfendacc(sds1)
+      if(stat .ne. 0) then
+           print *, 'sfendacc returned', stat
+           err = err + 1
+      endif
+
+      stat = sfend(fid1)
+      if(stat .ne. 0) then
+         print *, 'SDend returned', stat
+         err = err + 1
+      endif
+
+C     let's open it back up and take a look at what we've done
+C
+
+      fid2 = sfstart('test2.hdf', 3)
+      if(fid2 .lt.  0) then
+         print *, 'Reopen returned', fid2
+         err = err + 1
+      endif
+
+      stat = sfn2index(fid2, 'ncomp')
+      if (stat .lt. 0) then
+         print *, 'sfn2index returned', stat
+         err = err + 1
+      endif
+
+      sds3 = sfselect(fid2, stat)
+      if (sds3 .eq. -1) then
+         print *, 'sfselect returned', sds3
+         err = err + 1
+      endif
+      stat = sfginfo(sds3, name, rank, idims, nt, nattr)
+      if (stat .ne. 0) then
+          print *, 'sfginfo returned', stat
+          err = err + 1
+      endif
+      if ((rank .ne. 2) .or. (idims(1) .ne. 6) .or.
+     +    (idims(2) .ne. 4) .or. (nt .ne. DFNT_INT32)) then
+          print *, 'error in sfginfo'
+          err = err + 1
+      endif
+      dim2=sfdimid(sds3,1)
+      stat = sfgdinfo(dim2, name, dims(2), nt, nattr)
+      if ((dims(2) .ne. SD_UNLIMITED) .or. (nt .ne.  0 ))  then
+          print *, '1st sfgdinfo error', stat, dims(2), nt
+          err = err + 1
+      endif
+      dim1=sfdimid(sds3,0)
+      stat = sfgdinfo(dim1, name, dims(1), nt, nattr)
+      if ((dims(1) .ne. 6) .or. (nt .ne. DFNT_INT32 ))  then
+         print *, '2nd sfgdinfo error', stat, dims(1), nt
+         err = err + 1
+      endif
+      stat = sfrdata(sds3, start, stride, end, ivals)
+      if (stat .ne. 0) then
+           print *, 'sfrdata returned', stat
+           err = err + 1
+      endif
+      do 180 i=1, 24
+          if (ivals(i) .ne. i)  then
+              print *,  'wrong value: should be ',i,'  got ',ivals(i)
+              err = err + 1
+          endif
+180    continue
+      stat = sfisdmvc(dim1)
+      if (stat .ne. 0)  then
+          print *, 'sfisdmvc returned', stat
+          err = err + 1
+      endif
+      stat = sfsdmvc(dim1, 1)
+      stat = sfendacc(sds3)
+      if (stat .ne. 0) then
+          print *, 'sfendacc returned', stat
+          err = err + 1
+      endif
+      stat = sfend(fid2)
+      if (stat .ne. 0) then
+           print *, 'sfend returned', stat
+           err = err + 1
+      endif
+
+C     open one last time to check that NDG ref has been constant
+C     check SDsetdimval_compat
+      fid1 = sfstart('test2.hdf', 3)
+      if (fid1 .eq. -1) then
+           print *, 'sfstart returned', stat
+           err = err + 1
+      endif
+C     read back dimval_non_compat
+      stat = sfn2index(fid1, 'ncomp')
+      if (stat .lt. 0) then
+         print *, 'sfn2index returned', stat
+         err = err + 1
+      endif
+
+      sds2 = sfselect(fid1, stat)
+      if (sds2 .eq. -1) then
+         print *, 'sfselect returned', sds2
+         err = err + 1
+      endif
+      stat = sfginfo(sds2, name, rank, idims, nt, nattr)
+
+      if (stat .ne. 0) then
+          print *, 'sfginfo returned', stat
+          err = err + 1
+      endif
+      if ((rank .ne. 2) .or. (idims(2) .ne. 4) .or.
+     +    (idims(1) .ne. 6) .or. (nt .ne. DFNT_INT32)) then
+          print *, 'error in sfginfo'
+          err = err + 1
+      endif
+      dim1=sfdimid(sds2,0)
+      stat = sfgdinfo(dim1, name, dims(1), nt, nattr)
+      if ((dims(1) .ne. 6) .or. (nt .ne. DFNT_INT32 ))  then
+         print *, '3rd sfgdinfo error', stat, dims(1), nt 
+         err = err + 1
+      endif
+      stat = sfisdmvc(dim1)
+      if (stat .ne. 1)  then
+          print *, 'sfisdmvc returned', stat
+          err = err + 1
+      endif
+      stat = sfendacc(sds2)
+      if (stat .lt. 0) then
+          print *, 'sfendacc returned', stat
+          err = err + 1
+      endif
+      stat = sfend(fid1)
+      if (stat .lt. 0) then
+           print *, 'sfend returned', stat
+           err = err + 1
+      endif
+
+C Test char attr, char fill value and char data routines
+C sfscatt,sfrnatt,sfsnatt, sfrnatt,sfwcdata,sfrcdata
+C sfscfill, sfgcfill
+      fid1 = sfstart('test2.hdf', 4)
+      if(fid1 .lt. 1) then
+         print *, 'sfstart returned', fid1
+         err = err + 1
+      endif
+
+      dims(1) = 6
+      dims(2) = 0
+      nt = DFNT_CHAR8
+      rank = 2
+      sds1 = sfcreate(fid1, 'char_type', nt, rank, dims)
+      if (sds1 .eq. -1) then
+         print *, 'sfcreate returned', sds1
+         err = err + 1
+      endif
+C Set char fill value
+      stat = sfscfill(sds1, cfill)
+      if (stat .ne. 0) then
+         print *, 'sfscfill returned', stat
+         err = err + 1
+      endif
+      start(1) = 0
+      start(2) = 1
+      stride(1) = 1
+      stride(2) = 1
+      end(1) = 6
+      end(2) = 2
+C create the char data
+      do 195 i=1,4
+         do 190 j=1,6
+             cdata(j,i) = 'C'
+             icdata(j,i) = ' '
+190      continue
+195   continue
+C Write a slab of char data
+      stat = sfwcdata(sds1, start, stride, end, cdata)
+      if (stat .ne. 0) then
+          print *, 'sfwdata returned', stat
+          err = err + 1
+      endif
+C Set char attr
+      stat = sfscatt(sds1, 'CharAttr',nt, 2, catt)
+      if(stat.ne.0) then
+         print *, 'sfscatt returned', stat
+         err = err + 1
+      endif
+C Set numeric attr
+      nt = DFNT_INT32
+      stat = sfsnatt(sds1, 'NumericAttr',nt, 2, natt)
+      if(stat.ne.0) then
+         print *, 'sfsnatt returned', stat
+         err = err + 1
+      endif
+      stat = sfendacc(sds1)
+      if(stat .ne. 0) then
+           print *, 'sfendacc returned', stat
+           err = err + 1
+      endif
+C Close file
+      stat = sfend(fid1)
+      if(stat .ne. 0) then
+         print *, 'SDend returned', stat
+         err = err + 1
+      endif
+
+C read back
+      fid1 = sfstart('test2.hdf', 3)
+      if(fid1 .lt. 1) then
+         print *, 'sfstart returned', fid1
+         err = err + 1
+      endif
+      stat = sfn2index(fid1, 'char_type')
+      if (stat .lt. 0) then
+         print *, 'sfn2index returned', stat
+         err = err + 1
+      endif
+      sds2 = sfselect(fid1, stat)
+      if (sds2 .eq. -1) then
+         print *, 'sfselect returned', sds2
+         err = err + 1
+      endif
+      stat = sfginfo(sds2, name, rank, idims, nt, nattr)
+      if (stat .ne. 0) then
+          print *, 'sfginfo returned', stat
+          err = err + 1
+      endif
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      end(1) = 6
+      end(2) = 3
+C read char data and char fill
+      stat = sfrcdata(sds2, start, stride, end, icdata)
+      do 200 i=1,6
+         if (icdata(i,1) .ne. cfill) then 
+          print *, 'error in read c_fill'
+          err = err + 1
+         endif
+200   continue
+      do 250 i=2,3
+          do 230 j=1,6
+             if (icdata(j,i) .ne. 'C') then
+                 print *, 'error in sfrcdata'
+                 err = err + 1
+             endif
+230       continue
+250   continue
+C read char fillvalue
+      stat = sfgcfill(sds2, icfill)
+      if ((stat .eq. -1) .or. (icfill .ne. cfill)) then
+         print *, 'sfgcfill returned', sds2
+         err = err + 1
+      endif
+ 
+C read char attr
+      stat = sffattr(sds2, 'CharAttr')
+      if (stat .eq. -1) then
+         print *, 'sffattr returned', sds2
+         err = err + 1
+      endif
+      stat = sfrcatt(sds2, stat, icatt)
+      if ((icatt(1) .ne. catt(1)) .or. (icatt(2) .ne. catt(2))) then
+         print *, 'sfrcatt returned', sds2
+         err = err + 1
+      endif
+C read numeric attr
+      stat = sffattr(sds2, 'NumericAttr')
+      if (stat .eq. -1) then
+         print *, 'sffattr returned', sds2
+         err = err + 1
+      endif
+      stat = sfrnatt(sds2, stat, inatt)
+      if ((inatt(1) .ne. natt(1)) .or. (inatt(2) .ne. natt(2))) then
+         print *, 'sfrnatt returned', inatt(1), inatt(2)
+         err = err + 1
+      endif
+
+      stat = sfendacc(sds2)
+      if(stat .ne. 0) then
+           print *, 'sfendacc returned', stat
+           err = err + 1
+      endif
+C Close file
+      stat = sfend(fid1)
+      if(stat .ne. 0) then
+         print *, 'SDend returned', stat
+         err = err + 1
+      endif
+C Test set fill mode
+      fid1 = sfstart('test1.hdf', 3)
+      nt = DFNT_INT32
+      rank = 2
+      dims(1) = 6
+      dims(2) = 5
+      sds1 = sfcreate(fid1, 'FIXED1', nt,rank,dims)
+      ival = -300
+      do  400 i = 1, 30
+          ivals(i) = i + 100
+400   continue
+      stat = sfsfill(sds1, ival)
+      if(stat .ne. 0) then
+           print *, 'sfsnatt returned', stat
+           err = err + 1
+      endif
+      stat = sfsflmd(fid1, SD_NOFILL)
+      if(stat .ne. SD_FILL) then
+           print *, 'sfsflmd returned', stat
+           err = err + 1
+      endif
+      stat = sfendacc(sds1)
+      if(stat .ne. 0) then
+           print *, 'sfendacc returned', stat
+           err = err + 1
+      endif
+      i = sfn2index(fid1,'FIXED1')
+      sds1 = sfselect(fid1, i)
+      if(sds1 .lt. 0) then
+           print *, 'sfselect returned', sds1
+           err = err + 1
+      endif
+      start(1) = 0
+      start(2) = 2
+      stride(1) = 1
+      stride(2) = 1
+      end(1) = 6
+      end(2) = 1
+      stat = sfsflmd(fid1, SD_FILL)
+      if (stat .ne. SD_NOFILL) then
+           print *, 'sfsflmd returned', stat
+           err = err + 1
+      endif
+      stat = sfwdata(sds1,start, stride, end, ivals)
+      if (stat .eq. -1) then
+           print *, 'sfwdata returned', stat
+           err = err + 1
+      endif
+      stat = sfendacc(sds1)
+C create a new fixed size SDS, srite the 3rd rec NOFILL.
+C then set to SD_FILL and write the 5th rec.
+      sds1 = sfcreate(fid1, 'FIXED_SDS', nt,rank,dims)
+      stat = sfsfill(sds1, ival)
+      stat = sfsflmd(fid1, SD_NOFILL)
+      if(stat .ne. SD_FILL) then
+           print *, 'sfsflmd returned', stat
+           err = err + 1
+      endif
+      stat = sfwdata(sds1,start, stride, end, ivals)
+      if (stat .eq. -1) then
+           print *, 'sfwdata returned', stat
+           err = err + 1
+      endif
+      stat = sfendacc(sds1)
+      stat = sfend(fid1)
+C open again, change fillmode and write the 5th rec 
+      fid1 = sfstart('test1.hdf', 3)
+      i = sfn2index(fid1, 'FIXED_SDS')
+      sds1 = sfselect(fid1, i)
+      stat = sfsflmd(fid1, SD_FILL)
+      start(2) = 4
+      stat = sfwdata(sds1,start,stride,end,ivals)
+      stat = sfendacc(sds1)
+      stat = sfend(fid1) 
+C read back FIXED_SDS
+      fid1 = sfstart('test1.hdf', 3)
+      i = sfn2index(fid1, 'FIXED_SDS')
+      sds1 = sfselect(fid1, i)
+      start(1) = 0
+      start(2) = 0
+      end(1) = 6
+      end(2) = 5
+      stat = sfrdata(sds1,start,stride,end,ivals)
+      stat = sfendacc(sds1)
+      do 450 i=13,18
+         if (ivals(i) .ne. (100+(i-12))) then
+             print *,'wrong value: should be ', 100+(i-12)
+             print *,' get ', ivals(i)
+             err = err+1
+         endif
+         if (ivals(i+12) .ne. (100+(i-12))) then
+             print *,'wrong value: should be ', 100+(i-12)
+             print *,' get ', ivals(i+12)
+             err = err+1
+         endif
+450   continue
+      do 500 i=19,24
+         if (ivals(i) .eq. ival) then
+             print *,'Should not be ',ival, ' got ', ivals(i)
+             err = err+1
+         endif
+500   continue
+C read FIXED1
+      i = sfn2index(fid1, 'FIXED1')
+      sds1 = sfselect(fid1, i)
+      stat = sfrdata(sds1,start,stride,end,ivals)
+      stat = sfendacc(sds1)
+      do 510 i=13,18
+         if (ivals(i) .ne. (100+(i-12))) then
+             print *,'wrong value: should be ', 100+(i-12)
+             print *,' get ', ivals(i)
+             err = err+1
+         endif
+510   continue
+      do 520 i=19,24
+         if (ivals(i) .ne. ival) then
+            print *,'Should be ',ival, ' got ', ivals(i)
+             err = err+1
+         endif
+520   continue
+      stat = sfend(fid1)
+C test unlimited sds 
+      fid1 = sfstart('test1.hdf', 3)
+      if (fid1 .eq. -1) then
+            print *,'Open test1.hdf failed.'
+             err = err+1
+      endif
+      dims(1) = 6
+      dims(2) = SD_UNLIMITED
+      sds1=sfcreate(fid1,'UNLIMITED_SDS',DFNT_INT32,rank,dims)
+      if (sds1 .eq. -1) then
+          print *,'create UNLIMITED_SDS failed. '
+          err = err+1
+      endif
+      ival = -300
+      do 550 i=1,24
+         ivals(i) = i
+550   continue
+      stat = sfsfill(sds1, ival)
+      stat = sfsflmd(fid1, SD_NOFILL)
+      if (stat .ne. SD_FILL) then
+          print *,'Should be ',SD_FILL, ' got ',  stat
+          err = err+1
+      endif
+      start(1) = 0
+      start(2) = 2
+      end(1) = 6
+      end(2) = 1
+      stat = sfwdata(sds1,start, stride, end, ivals)
+      if (stat .eq. -1) then
+          print *,'write UNLIMITED_SDS failed. '
+          err = err+1
+      endif
+      stat = sfendacc(sds1)
+      stat = sfend(fid1)
+C open again, write the 5th rec
+      fid1 = sfstart('test1.hdf', 3)
+      i = sfn2index(fid1, 'UNLIMITED_SDS')
+      sds1 = sfselect(fid1, i)
+      stat = sfsflmd(fid1, SD_FILL)
+      start(2) = 4
+      stat = sfwdata(sds1,start,stride,end, ivals)
+      stat = sfendacc(sds1)
+      stat = sfend(fid1)
+C read back 
+      fid1 = sfstart('test1.hdf', 3)
+      i = sfn2index(fid1, 'UNLIMITED_SDS')
+      sds1 = sfselect(fid1, i)
+      start(1) = 0
+      start(2) = 0
+      end(1) = 6
+      end(2) = 5
+      stat = sfrdata(sds1,start,stride,end,ivals)
+      stat = sfendacc(sds1)
+      do 600 i=13,18
+         if (ivals(i) .ne. (i-12)) then
+             print *,'wrong value: should be ', (i-12)
+             print *,' get ', ivals(i)
+             err = err+1
+         endif
+         if (ivals(i+12) .ne. (i-12)) then
+             print *,'wrong value: should be ', (i-12)
+             print *,' get ', ivals(i+12)
+             err = err+1
+         endif
+600   continue
+      do 650 i=19,24
+         if (ivals(i) .ne. ival) then
+             print *,'Should be ',ival, ' got ', ivals(i)
+             err = err+1
+         endif
+650   continue
+      stat = sfend(fid1) 
+C
+C
+C     Call three subroutines:
+C
+C     test_chunk (err_chunk)   - tests fortran chunking functions
+C     test_char_chunk (err_char_chunk) - tests fortran char chunking
+C                                        functions
+C     test_compress(err_compress) - tests compression function with
+C                                   different compression types
+C
+C     EIP 1/6/98
+C
+C
+      err_chunk = 0
+      call test_chunk ( err_chunk )
+      err = err + err_chunk
+C
+      err_char_chunk = 0
+      call test_char_chunk( err_char_chunk )
+      err = err + err_char_chunk
+C
+      err_compress = 0
+      call test_compress( err_compress )
+C
+      err = err + err_compress
+      print *, 'Total errors : ', err
+
+      end
+
+
+         subroutine test_chunk( err_chunk ) 
+         implicit none
+C
+C------- Begin Variables declarations -----------------------------------
+C
+         integer   N_COMP_TYPES, N_COMP_ARG
+         parameter (N_COMP_TYPES = 5, N_COMP_ARG = 4)
+         integer   sd_id(N_COMP_TYPES),
+     .             sds_id(N_COMP_TYPES),
+     .             sds_index(N_COMP_TYPES)
+         integer   RANK, comp_type, c_out
+         integer   comp_arg(N_COMP_ARG)
+         integer   comp_prm_out(N_COMP_ARG)
+         integer   comp_type_out(N_COMP_TYPES)
+         integer   comp_typesd
+         integer   d_dims(2)
+         integer   ch_dims(2),ch_dims_out(2), start_dims(2)
+         integer   start(2), stride(2), edges(2)
+         integer   status, fill_value
+         integer   maxcache, flags
+         integer   err_chunk
+         integer   n,m, n_part, m_part
+         integer   n_start, m_start, n_stride, m_stride
+         integer   nc, mc, n_nc, n_mc
+         integer   i, j, k, l, lb, kb, kl, kj
+         integer   i_comp
+         integer mod1, mod2
+
+         character*12 file(N_COMP_TYPES)
+         character*12 name(N_COMP_TYPES)
+C
+C  SDS functions declarations
+C
+C         integer   sfstart, sfcreate, sfendacc, sfend,
+C     .             sfn2index, sfselect, sfgcompress,
+C     .             sfsfill, sfschnk, sfscchnk, sfwchnk, 
+C     .             sfgichnk, sfrchnk, sfwdata, sfrdata
+         include 'mffunc.inc'
+C
+C  Initial data declarations( change if you which to test larger arrays )
+C
+C  Data array dimensions n and m and RANK
+C
+         parameter (n = 9, m = 4, RANK = 2)
+
+C
+C  Part data dimensions n_part, m_part
+C
+         parameter (n_part = 5, m_part = 2)
+C
+C  Start coordinates of part_data
+C
+         parameter (n_start = 2, m_start = 1)
+C
+C  Stride in each dimension
+C
+         parameter (n_stride = 1, m_stride = 1)
+C
+C  Chunk dimensions nc and mc
+C
+         parameter (nc = 3, mc = 2)
+C
+C  Dimensions of "chunk matrix" n_nc and n_mc.
+C  Note if n is multiple of nc or m is multiple
+C  of mc we need smaller dimensions ( by one)
+         parameter (n_nc = n/nc + 1, n_mc = m/mc + 1)
+C
+C  Actual size of chunk matrix ( will be calculated latera )
+C
+         integer n_nc_a, n_mc_a
+C
+C  Data declaration
+C
+         integer*4 data(n,m),
+     .             chunk(nc,mc),
+     .             chunk_out(nc,mc),
+     .             chunk_data(nc,mc,n_nc,n_mc)
+C
+C  Buffers to hold part of the data when we read data back
+C
+         integer*4 part_data(n_part,m_part)
+C
+C  HDF parameters initialization
+C
+C
+C  Read/Write parameters
+C
+         integer   DFACC_CREATE,
+     .             DFACC_WRITE,
+     .             DFACC_READ
+         parameter (DFACC_CREATE = 4,
+     .             DFACC_READ   =  1,
+     .             DFACC_WRITE   = 2)
+C
+C  Data type parameters
+C
+C         integer   DATA_TYPE
+         integer   DFNT_CHAR,
+     .             DFNT_INT16,
+     .             DFNT_INT32,
+     .             DFNT_FLOAT32,
+     .             DFNT_FLOAT64
+         parameter (DFNT_CHAR   = 4,
+     .             DFNT_INT16   = 22,
+     .             DFNT_INT32   = 24,
+     .             DFNT_FLOAT32 = 5,
+     .             DFNT_FLOAT64 = 6)
+C
+C  Compression parametes
+C
+         integer   COMP_CODE_NONE,
+     .             COMP_CODE_RLE,
+     .             COMP_CODE_NBIT,
+     .             COMP_CODE_SKPHUFF,
+     .             COMP_CODE_DEFLATE
+
+         parameter (COMP_CODE_NONE   = 0,
+     .             COMP_CODE_RLE     = 1,
+     .             COMP_CODE_NBIT    = 2,
+     .             COMP_CODE_SKPHUFF = 3,
+     .             COMP_CODE_DEFLATE = 4)
+C
+C  Compression arguments ( defined for clarity, actual values
+C  will be passed to SFSCHUNK function via comp_arg parameter)
+C
+         integer deflate_level,
+     .           skphuff_skp_size,
+     .           nbit_sign_ext,
+     .           nbit_fill_one,
+     .           nbit_start_bit,
+     .           nbit_bit_len
+          parameter ( deflate_level    = 6,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 6,
+     .                nbit_bit_len     = 7 )
+
+
+C
+C--------------------End of declarations------------------------------
+C
+C
+C  We will write to five different files corresponding to the 
+C  different compression types
+C
+C  NO compression
+C 
+         file(1) = 'chunk_no.hdf'
+         name(1) = 'Nocomp_data'
+         comp_type_out(1) = 0
+C
+C  RLE compression
+C
+         file(2) = 'chunk_rl.hdf'
+         name(2) = 'Rlcomp_data'
+         comp_type_out(2) = 1 
+C
+C  Nbit compression
+C
+         file(3) = 'chunk_nb.hdf'
+         name(3) = 'Nbcomp_data'
+         comp_type_out(3) = 2 
+C
+C  Addaptive Huffman compression
+C
+         file(4) = 'chunk_sk.hdf'
+         name(4) = 'Hucomp_data'
+         comp_type_out(4) = 1 
+C
+C  Gzip compression
+C
+         file(5) = 'chunk_gz.hdf'
+         name(5) = 'Gzcomp_data'
+         comp_type_out(5) = 1 
+C
+C   Dimension sizes array initialization
+C
+         d_dims(1) = n
+         d_dims(2) = m
+C
+C   Chunk dimension sizes array initialization
+C
+         ch_dims(1) = nc
+         ch_dims(2) = mc
+C
+C   Find actual size of chunk matrix
+C
+         mod1 = mod (n,nc)
+         mod2 = mod (m,mc)
+         if (mod1 .eq. 0) n_nc_a = n_nc - 1
+         if (mod2 .eq. 0) n_mc_a = n_mc - 1
+C        
+C   Initilize original array
+C
+         
+         do 20 j = 1, m 
+            do 10 i = 1, n
+               data(i,j) = 10*j + i
+10          continue
+20       continue
+C
+C        Initialize chunks
+C
+         lb = mc
+         kb = nc
+         do 60 j = 1, n_mc_a
+            do 50 i = 1, n_nc_a
+               do 40 l = 1, lb
+                  do 30 k = 1, kb
+                   chunk_data(k,l,i,j) = 0. 
+30                continue 
+40              continue
+50            continue
+60        continue          
+C
+C  Assign actual data to the chunks
+C
+         do 100 j = 1, n_mc_a
+            do 90 i = 1, n_nc_a
+               if (j .eq. n_mc_a .and. mod2 .ne. 0 ) lb = mod(m, mc)  
+               if (i .eq. n_nc_a .and. mod1 .ne. 0 ) kb = mod(n, nc)
+               do 80 l = 1, lb
+                  do 70 k = 1, kb
+                   chunk_data(k,l,i,j) = data ((i-1)*nc +k, (j-1)*mc +l)
+70                continue 
+80              continue
+90            continue
+100        continue 
+C
+C  Initialize SD interfaces
+C
+       do 101 i = 1, N_COMP_TYPES
+          sd_id(i) = sfstart (file(i), DFACC_CREATE)
+101    continue          
+C
+C  Main loop through different compression types
+C
+         do 1000 i_comp = 1, N_COMP_TYPES
+
+C
+C        Create the data set
+C
+         sds_id(i_comp) = sfcreate(sd_id(i_comp), name(i_comp), 
+     .                     DFNT_INT32, RANK, d_dims)
+            if( sds_id(i_comp) .eq. -1 ) then
+                print *, 'sfcreate failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+C
+C        Fill the data set with fill_value
+C
+         fill_value = 0
+         status = sfsfill (sds_id(i_comp), fill_value)
+            if( status .ne. 0 ) then
+                print *, 'sfsfill failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+C
+C  Set compression type and compression arguments
+C
+         comp_type  = i_comp - 1
+C
+C   Initialize compression arguments array
+C
+         do 1 i = 1, n_comp_arg
+            comp_arg(i) = 0
+1        continue
+
+         if( comp_type .eq. COMP_CODE_NBIT) then
+             comp_arg(1) = nbit_sign_ext
+             comp_arg(2) = nbit_fill_one
+             comp_arg(3) = nbit_start_bit
+             comp_arg(4) = nbit_bit_len
+         endif
+
+         if( comp_type .eq. COMP_CODE_SKPHUFF ) then
+             comp_arg(1) = skphuff_skp_size
+         endif
+
+         if (comp_type .eq. COMP_CODE_DEFLATE ) then
+             comp_arg(1) = deflate_level
+         endif
+C
+C        Create chunked SDS 
+C
+         status = sfschnk (sds_id(i_comp), ch_dims, comp_type,
+     .                     comp_arg)
+            if( status .ne. 0 ) then
+                print *, 'sfschnk failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+C
+C        Set chunk cache to hold maximum of nc chunks
+C
+         maxcache =  n_nc_a 
+         flags = 0 
+         status = sfscchnk (sds_id(i_comp), maxcache, flags)
+            if( status .ne. maxcache ) then
+                print *, 'sfscchnk failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+C
+C        Write the data chunks. First chunk is written by sfwdata function
+C
+         do 150 j = 1, n_mc_a
+            do 140 i = 1, n_nc_a
+
+               start_dims(1) = i 
+               start_dims(2) = j 
+            
+               do 130 l = 1, mc
+                  do 120 k = 1, nc
+                     chunk(k,l) = chunk_data(k,l,i,j)
+120               continue
+130            continue
+            if (i .eq. 1 .and. j .eq. 1) then
+                start(1) = 0
+                start(2) = 0
+                stride(1) = 1
+                stride(2) = 1
+                edges(1)  = nc
+                edges(2)  = mc
+                status = sfwdata(sds_id(i_comp), start, stride,
+     .                           edges, chunk)
+            if( status .ne. 0 ) then
+                print *, 'sfwdata failed for', i_comp, ' -th dataset'
+                print *, ' first chunk'
+                err_chunk = err_chunk + 1
+            endif
+            else 
+            status = sfwchnk(sds_id(i_comp), start_dims, chunk)
+            if( status .ne. 0 ) then
+                print *, 'sfwchnk failed for', i_comp, ' -th dataset'
+                print *, i,'-th',j,'-th', 'chunk'
+                err_chunk = err_chunk + 1
+            endif
+            endif
+140         continue
+150       continue
+         
+         status = sfendacc(sds_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+         status = sfend (sd_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfend failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+
+1000      continue 
+
+C
+C   Let's check what we have written 
+C   We will skip NBIT until things are clarified with QAK.
+          
+C
+C   Open files and restart SD interfaces
+C
+         do 200 i = 1, N_COMP_TYPES
+C
+            sd_id(i) = sfstart (file(i), DFACC_READ)
+            if( sd_id(i) .eq. -1 ) then
+                print *, 'sfstart failed for', i, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+200      continue 
+
+C
+C  Find written dataset in each file using its name and index
+C
+
+         do 201 i = 1, N_COMP_TYPES
+C
+            sds_index(i) = sfn2index (sd_id(i), name(i))
+            if( sds_index(i) .eq. -1 ) then
+                print *, 'sfn2index failed for', i, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+            sds_id(i)    = sfselect (sd_id(i), sds_index(i))
+            if( sds_id(i) .eq. -1 ) then
+                print *, 'sfselect failed for', i, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+C
+C  Find out type of compression used and compression parameters.
+C
+            status = sfgcompress(sds_id(i), comp_typesd, comp_prm_out)
+	    if (status .eq. -1) then
+            print *, 'sfgcompress failed for', i, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+            if (name(i) .eq. 'Nocomp_data') then
+                if (comp_typesd .ne. COMP_CODE_NONE) then
+            print *, 'wrong compression type for Nocomp_data dataset'
+                err_chunk = err_chunk + 1
+                endif
+            endif
+            if (name(i) .eq. 'Rlcomp_data') then
+                if (comp_typesd .ne. COMP_CODE_RLE) then
+            print *, 'wrong compression type for Rlcomp_data dataset'
+                err_chunk = err_chunk + 1
+                endif
+            endif
+            if (name(i) .eq. 'Hucomp_data') then
+                if (comp_typesd .ne. COMP_CODE_SKPHUFF) then
+            print *, 'wrong compression type for Hucomp_data dataset'
+                err_chunk = err_chunk + 1
+                endif
+                if (comp_prm_out(1). ne. skphuff_skp_size) then
+         print *, 'wrong compression parameter for Hucomp_data dataset'
+                err_chunk = err_chunk + 1
+                endif
+
+            endif
+            if (name(i) .eq. 'Gzcomp_data') then
+                if (comp_typesd .ne. COMP_CODE_DEFLATE) then
+          print *, 'wrong compression type for Gzcomp_data dataset'
+                endif
+                if (comp_prm_out(1). ne. deflate_level) then
+          print *, 'wrong compression parameter for Gzcomp_data dataset'
+                err_chunk = err_chunk + 1
+                endif
+            endif
+
+            if (name(i) .eq. 'Nbcomp_data') then
+                if (comp_typesd .ne. COMP_CODE_NBIT) then
+          print *, 'wrong compression type for Nbcomp_data dataset'
+                endif
+                if ((comp_prm_out(1) .ne. nbit_sign_ext) .or.
+     .          (comp_prm_out(2) .ne. nbit_fill_one) .or.
+     .          (comp_prm_out(3) .ne. nbit_start_bit) .or.
+     .          (comp_prm_out(4) .ne. nbit_bit_len)) then
+          print *, 'wrong compression parameter for Nbcomp_data dataset'
+                err_chunk = err_chunk + 1
+                endif
+            endif
+
+201      continue
+
+C
+C  Get and check chunking and compression information about each dataset
+C 
+         do 202 i = 1, N_COMP_TYPES
+C
+            status = sfgichnk(sds_id(i),ch_dims_out,c_out)
+            if( status .ne. 0 ) then
+                print *, 'sfgichnk failed for', i, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+            if(  c_out .ne. comp_type_out(i)) then
+                print *, 'sfgichnk returned incorrect comptype info'
+                err_chunk = err_chunk + 1
+            endif
+            if ( (ch_dims(1) .ne. ch_dims_out(1)) .or.
+     .            (ch_dims(2) .ne. ch_dims_out(2)) ) then
+                print *, 'sfgichnk returned incorrect chunk dimensions'
+                err_chunk = err_chunk + 1
+            endif
+202      continue  
+
+C
+C   Read part of the data back using sfrdata function
+C
+         start(1) = n_start
+         start(2) = m_start
+         edges(1) = n_part
+         edges(2) = m_part
+         stride(1) = n_stride 
+         stride(2) = m_stride 
+         do  205 i = 1, N_COMP_TYPES
+C
+C   Skip NBIT until we know how to read nbit data back
+C
+         if (i .eq. 3) goto 205
+             status = sfrdata (sds_id(i), start, stride, edges,
+     .                         part_data)
+             if (status .ne. 0) then
+                 print *, 'sfrdata failed for reading part data for ',
+     .           i, '-th dataset'
+             err_chunk = err_chunk + 1
+             endif
+C
+C   Compare output with aqtual data
+C
+         do 204 j = 1, m_part
+            do 203 l = 1, n_part
+               kl = n_start + 1 + (l-1)*n_stride
+               kj = m_start + 1 + (j-1)*m_stride
+               if (data(kl, kj) .ne. part_data(l,j)) then
+                  print *, 'sfrdata read wrong data for ', 
+     .            i ,'-th dataset'
+               err_chunk = err_chunk +1
+               endif 
+203         continue
+204      continue
+ 
+205      continue
+
+
+C
+C    Read chunks back and compare with the actual data for each compression
+C    type
+C
+
+      do 2000 i_comp = 1, N_COMP_TYPES
+C
+C    Skip NBIT
+C
+         if(i_comp. eq. 3) goto 2000
+         comp_type = i_comp - 1 
+         do 250 j = 1, n_mc_a
+            do 240 i = 1, n_nc_a
+
+               start_dims(1) = i 
+               start_dims(2) = j 
+            
+            status = sfrchnk(sds_id(i_comp), start_dims, chunk_out)
+            if (status .ne. 0) then
+                print *, 'sfrchnk failed for ', i, ',', j,
+     .         '-th chunk, compression type is ', comp_type  
+                err_chunk = err_chunk + 1
+            endif
+C
+C  Compare with actual data
+C
+               lb = mc
+               kb = nc 
+               if (j .eq. n_mc_a .and. mod2 .ne. 0 ) lb = mod(m, mc)  
+               if (i .eq. n_nc_a .and. mod1 .ne. 0 ) kb = mod(n, nc)
+               do 280 l = 1, lb
+                  do 270 k = 1, kb
+               if(chunk_out(k,l) .ne. data ((i-1)*nc +k, (j-1)*mc +l))
+     . then
+               print *, 'Data is incorrest'
+                  err_chunk = err_chunk + 1
+               endif
+270                continue 
+280              continue
+240            continue
+
+250       continue
+         
+C 
+C  Terminate access to SDS, shutdown interfaces and close the files
+C
+           status = sfendacc(sds_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+           status = sfend(sd_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfend failed for', i_comp, ' -th dataset'
+                err_chunk = err_chunk + 1
+            endif
+
+2000   continue
+         return
+         end
+
+         subroutine test_char_chunk( err_char_chunk ) 
+         implicit none
+C
+C------- Begin Variables declarations -----------------------------------
+C
+         integer   N_COMP_TYPES, N_COMP_ARG
+         parameter (N_COMP_TYPES = 5, N_COMP_ARG = 4)
+         integer   sd_id(N_COMP_TYPES),
+     .             sds_id(N_COMP_TYPES),
+     .             sds_index(N_COMP_TYPES)
+         integer   RANK, comp_type, c_out
+         integer   comp_arg(N_COMP_ARG)
+         integer   comp_type_out(N_COMP_TYPES)
+         integer   d_dims(2)
+         integer   ch_dims(2),ch_dims_out(2), start_dims(2)
+         integer   start(2), stride(2), edges(2)
+         integer   status, fill_value
+         integer   maxcache, flags
+         integer   err_char_chunk
+         integer   n,m, n_part, m_part
+         integer   n_start, m_start, n_stride, m_stride
+         integer   nc, mc, n_nc, n_mc
+         integer   i, j, k, l, lb, kb, kl, kj
+         integer   i_comp
+         integer mod1, mod2
+
+         character*13 file(N_COMP_TYPES)
+         character*12 name(N_COMP_TYPES)
+C
+C  SDS functions declarations
+C
+C         integer   sfstart, sfcreate, sfendacc, sfend,
+C     .             sfn2index, sfselect,
+C     .             sfsfill, sfschnk, sfscchnk, sfwcchnk, 
+C     .             sfgichnk, sfrcchnk, sfwcdata, sfrcdata
+         include 'mffunc.inc'
+C
+C  Initial data declarations( change if you which to test larger arrays )
+C
+C  Data array dimensions n and m and RANK
+C
+         parameter (n = 9, m = 4, RANK = 2)
+
+C
+C  Part data dimensions n_part, m_part
+C
+         parameter (n_part = 5, m_part = 2)
+C
+C  Start coordinates of part_data
+C
+         parameter (n_start = 2, m_start = 1)
+C
+C  Stride in each dimension
+C
+         parameter (n_stride = 1, m_stride = 1)
+C
+C  Chunk dimensions nc and mc
+C
+         parameter (nc = 3, mc = 2)
+C
+C  Dimensions of "chunk matrix" n_nc and n_mc.
+C  Note if n is multiple of nc or m is multiple
+C  of mc we need smaller dimensions ( by one)
+         parameter (n_nc = n/nc + 1, n_mc = m/mc + 1)
+C
+C  Actual size of chunk matrix ( will be calculated latera )
+C
+         integer n_nc_a, n_mc_a
+C
+C  Data declaration
+C
+         character data(n,m),
+     .             chunk(nc,mc),
+     .             chunk_out(nc,mc),
+     .             chunk_data(nc,mc,n_nc,n_mc)
+C
+C  Buffers to hold part of the data when we read data back
+C
+         character part_data(n_part,m_part)
+C
+C  HDF parameters initialization
+C
+C
+C  Read/Write parameters
+C
+         integer   DFACC_CREATE,
+     .             DFACC_WRITE,
+     .             DFACC_READ
+         parameter (DFACC_CREATE = 4,
+     .             DFACC_READ   =  1,
+     .             DFACC_WRITE   = 2)
+C
+C  Data type parameters
+C
+C         integer   DATA_TYPE
+         integer   DFNT_CHAR,
+     .             DFNT_INT16,
+     .             DFNT_INT32,
+     .             DFNT_FLOAT32,
+     .             DFNT_FLOAT64
+         parameter (DFNT_CHAR   = 4,
+     .             DFNT_INT16   = 22,
+     .             DFNT_INT32   = 24,
+     .             DFNT_FLOAT32 = 5,
+     .             DFNT_FLOAT64 = 6)
+C
+C  Compression parametes
+C
+         integer   COMP_CODE_NONE,
+     .             COMP_CODE_RLE,
+     .             COMP_CODE_NBIT,
+     .             COMP_CODE_SKPHUFF,
+     .             COMP_CODE_DEFLATE
+
+         parameter (COMP_CODE_NONE   = 0,
+     .             COMP_CODE_RLE     = 1,
+     .             COMP_CODE_NBIT    = 2,
+     .             COMP_CODE_SKPHUFF = 3,
+     .             COMP_CODE_DEFLATE = 4)
+C
+C  Compression arguments ( defined for clarity, actual values
+C  will be passed to SFSCHUNK function via comp_arg parameter)
+C
+         integer deflate_level,
+     .           skphuff_skp_size,
+     .           nbit_sign_ext,
+     .           nbit_fill_one,
+     .           nbit_start_bit,
+     .           nbit_bit_len
+          parameter ( deflate_level    = 6,
+     .                skphuff_skp_size = 2,
+     .                nbit_sign_ext    = 0,
+     .                nbit_fill_one    = 0,
+     .                nbit_start_bit   = 6,
+     .                nbit_bit_len     = 7 )
+
+
+C
+C--------------------End of declarations------------------------------
+C
+C
+C  We will write to five different files corresponding to the 
+C  different compression types
+C
+C  NO compression
+C 
+         file(1) = 'cchunk_no.hdf'
+         name(1) = 'Nocomp_data'
+         comp_type_out(1) = 0
+C
+C  RLE compression
+C
+         file(2) = 'cchunk_rl.hdf'
+         name(2) = 'Rlcomp_data'
+         comp_type_out(2) = 1 
+C
+C  Nbit compression
+C
+         file(3) = 'cchunk_nb.hdf'
+         name(3) = 'Nbcomp_data'
+         comp_type_out(3) = 2 
+C
+C  Addaptive Huffman compression
+C
+         file(4) = 'cchunk_sk.hdf'
+         name(4) = 'Hucomp_data'
+         comp_type_out(4) = 1 
+C
+C  Gzip compression
+C
+         file(5) = 'cchunk_gz.hdf'
+         name(5) = 'Gzcomp_data'
+         comp_type_out(5) = 1 
+C
+C   Dimension sizes array initialization
+C
+         d_dims(1) = n
+         d_dims(2) = m
+C
+C   Chunk dimension sizes array initialization
+C
+         ch_dims(1) = nc
+         ch_dims(2) = mc
+C
+C   Find actual size of chunk matrix
+C
+         mod1 = mod (n,nc)
+         mod2 = mod (m,mc)
+         if (mod1 .eq. 0) n_nc_a = n_nc - 1
+         if (mod2 .eq. 0) n_mc_a = n_mc - 1
+C        
+C   Initilize original array
+C
+         
+         do 20 j = 1, m 
+            do 10 i = 1, n
+               data(i,j) = char(10*j + i)
+10          continue
+20       continue
+C
+C        Initialize chunks
+C
+         lb = mc
+         kb = nc
+         do 60 j = 1, n_mc_a
+            do 50 i = 1, n_nc_a
+               do 40 l = 1, lb
+                  do 30 k = 1, kb
+                   chunk_data(k,l,i,j) = char(32) 
+30                continue 
+40              continue
+50            continue
+60        continue          
+C
+C  Assign actual data to the chunks
+C
+         do 100 j = 1, n_mc_a
+            do 90 i = 1, n_nc_a
+               if (j .eq. n_mc_a .and. mod2 .ne. 0 ) lb = mod(m, mc)  
+               if (i .eq. n_nc_a .and. mod1 .ne. 0 ) kb = mod(n, nc)
+               do 80 l = 1, lb
+                  do 70 k = 1, kb
+                   chunk_data(k,l,i,j) = data ((i-1)*nc +k, (j-1)*mc +l)
+70                continue 
+80              continue
+90            continue
+100        continue 
+C
+C  Initialize SD interfaces
+C
+       do 101 i = 1, N_COMP_TYPES
+          sd_id(i) = sfstart (file(i), DFACC_CREATE)
+101    continue          
+C
+C  Main loop through different compression types
+C
+         do 1000 i_comp = 1, N_COMP_TYPES
+
+C
+C        Create the data set
+C
+         sds_id(i_comp) = sfcreate(sd_id(i_comp), name(i_comp), 
+     .                     DFNT_CHAR, RANK, d_dims)
+            if( sds_id(i_comp) .eq. -1 ) then
+                print *, 'sfcreate failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+C
+C        Fill the data set with fill_value
+C
+         fill_value = 0
+         status = sfsfill (sds_id(i_comp), fill_value)
+            if( status .ne. 0 ) then
+                print *, 'sfsfill failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+C
+C  Set compression type and compression arguments
+C
+         comp_type  = i_comp - 1
+C
+C   Initialize compression arguments array
+C
+         do 1 i = 1, n_comp_arg
+            comp_arg(i) = 0
+1        continue
+
+         if( comp_type .eq. COMP_CODE_NBIT) then
+             comp_arg(1) = nbit_sign_ext
+             comp_arg(2) = nbit_fill_one
+             comp_arg(3) = nbit_start_bit
+             comp_arg(4) = nbit_bit_len
+         endif
+
+         if( comp_type .eq. COMP_CODE_SKPHUFF ) then
+             comp_arg(1) = skphuff_skp_size
+         endif
+
+         if (comp_type .eq. COMP_CODE_DEFLATE ) then
+             comp_arg(1) = deflate_level
+         endif
+C
+C        Create chunked SDS 
+C
+         status = sfschnk (sds_id(i_comp), ch_dims, comp_type,
+     .                     comp_arg)
+            if( status .ne. 0 ) then
+                print *, 'sfschnk failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+C
+C        Set chunk cache to hold maximum of nc chunks
+C
+         maxcache =  n_nc_a 
+         flags = 0 
+         status = sfscchnk (sds_id(i_comp), maxcache, flags)
+            if( status .ne. maxcache ) then
+                print *, 'sfscchnk failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+C
+C        Write the data chunks. First chunk is written by sfwdata function
+C
+         do 150 j = 1, n_mc_a
+            do 140 i = 1, n_nc_a
+
+               start_dims(1) = i 
+               start_dims(2) = j 
+            
+               do 130 l = 1, mc
+                  do 120 k = 1, nc
+                     chunk(k,l) = chunk_data(k,l,i,j)
+120               continue
+130            continue
+            if (i .eq. 1 .and. j .eq. 1) then
+                start(1) = 0
+                start(2) = 0
+                stride(1) = 1
+                stride(2) = 1
+                edges(1)  = nc
+                edges(2)  = mc
+                status = sfwcdata(sds_id(i_comp), start, stride,
+     .                           edges, chunk)
+            if( status .ne. 0 ) then
+                print *, 'sfwdata failed for', i_comp, ' -th dataset'
+                print *, ' first chunk'
+                err_char_chunk = err_char_chunk + 1
+            endif
+            else 
+            status = sfwcchnk(sds_id(i_comp), start_dims, chunk)
+            if( status .ne. 0 ) then
+                print *, 'sfwcchnk failed for', i_comp, ' -th dataset'
+                print *, i,'-th',j,'-th', 'chunk'
+                err_char_chunk = err_char_chunk + 1
+            endif
+            endif
+140         continue
+150       continue
+         
+         status = sfendacc(sds_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+         status = sfend (sd_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfend failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+
+1000      continue 
+
+C
+C   Let's check what we have written 
+C   We will skip NBIT until things are clarified with QAK.
+          
+C
+C   Open files and restart SD interfaces
+C
+         do 200 i = 1, N_COMP_TYPES
+C
+            sd_id(i) = sfstart (file(i), DFACC_READ)
+            if( sd_id(i) .eq. -1 ) then
+                print *, 'sfstart failed for', i, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+200      continue 
+
+C
+C  Find written dataset in each file using its name and index
+C
+
+         do 201 i = 1, N_COMP_TYPES
+C
+            sds_index(i) = sfn2index (sd_id(i), name(i))
+            if( sds_index(i) .eq. -1 ) then
+                print *, 'sfn2index failed for', i, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+            sds_id(i)    = sfselect (sd_id(i), sds_index(i))
+            if( sds_id(i) .eq. -1 ) then
+                print *, 'sfselect failed for', i, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+201      continue
+
+C
+C  Get and check chunking and compression information about each dataset
+C 
+         do 202 i = 1, N_COMP_TYPES
+C
+            status = sfgichnk(sds_id(i),ch_dims_out,c_out)
+            if( status .ne. 0 ) then
+                print *, 'sfgichnk failed for', i, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+            if(  c_out .ne. comp_type_out(i)) then
+                print *, 'sfgichnk returned incorrect comptype info'
+                err_char_chunk = err_char_chunk + 1
+            endif
+            if ( (ch_dims(1) .ne. ch_dims_out(1)) .or.
+     .            (ch_dims(2) .ne. ch_dims_out(2)) ) then
+                print *, 'sfgichnk returned incorrect chunk dimensions'
+                err_char_chunk = err_char_chunk + 1
+            endif
+202      continue  
+
+C
+C   Read part of the data back using sfrdata function
+C
+         start(1) = n_start
+         start(2) = m_start
+         edges(1) = n_part
+         edges(2) = m_part
+         stride(1) = n_stride 
+         stride(2) = m_stride 
+         do  205 i = 1, N_COMP_TYPES
+C
+C   Skip NBIT
+C
+         if (i .eq. 3) goto 205
+             status = sfrcdata (sds_id(i), start, stride, edges,
+     .                         part_data)
+             if (status .ne. 0) then
+                 print *, 'sfrdata failed for reading part data for ',
+     .           i, '-th dataset'
+             err_char_chunk = err_char_chunk + 1
+             endif
+C
+C   Compare output with aqtual data
+C
+         do 204 j = 1, m_part
+            do 203 l = 1, n_part
+               kl = n_start + 1 + (l-1)*n_stride
+               kj = m_start + 1 + (j-1)*m_stride
+               if (data(kl, kj) .ne. part_data(l,j)) then
+                  print *, 'sfrdata read wrong data for ', 
+     .            i ,'-th dataset'
+               err_char_chunk = err_char_chunk +1
+               endif 
+203         continue
+204      continue
+ 
+205      continue
+
+
+C
+C    Read chunks back and compare with the actual data for each compression
+C    type
+C
+
+      do 2000 i_comp = 1, N_COMP_TYPES
+C
+C   Skip NBIT
+C 
+         if(i_comp .eq. 3) goto 2000 
+
+         comp_type = i_comp - 1 
+         do 250 j = 1, n_mc_a
+            do 240 i = 1, n_nc_a
+
+               start_dims(1) = i 
+               start_dims(2) = j 
+            
+            status = sfrcchnk(sds_id(i_comp), start_dims, chunk_out)
+            if (status .ne. 0) then
+                print *, 'sfrcchnk failed for ', i, ',', j,
+     .         '-th chunk, compression type is ', comp_type  
+                err_char_chunk = err_char_chunk + 1
+            endif
+C
+C  Compare with actual data
+C
+               lb = mc
+               kb = nc 
+               if (j .eq. n_mc_a .and. mod2 .ne. 0 ) lb = mod(m, mc)  
+               if (i .eq. n_nc_a .and. mod1 .ne. 0 ) kb = mod(n, nc)
+               do 280 l = 1, lb
+                  do 270 k = 1, kb
+               if(chunk_out(k,l) .ne. data ((i-1)*nc +k, (j-1)*mc +l))
+     . then
+               print *, 'Data is incorrest'
+                  err_char_chunk = err_char_chunk + 1
+               endif
+270                continue 
+280              continue
+240            continue
+
+250       continue
+         
+C 
+C  Terminate access to SDS, shutdown interfaces and close the files
+C
+           status = sfendacc(sds_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+           status = sfend(sd_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfend failed for', i_comp, ' -th dataset'
+                err_char_chunk = err_char_chunk + 1
+            endif
+
+2000   continue
+         return
+         end
+
+
+         subroutine test_compress( err_compress ) 
+         implicit none
+C
+C------- Begin Variables declarations -----------------------------------
+C
+         integer   N_COMP_TYPES, N_COMP_ARG
+         parameter (N_COMP_TYPES = 4, N_COMP_ARG = 1)
+         integer   sd_id(N_COMP_TYPES),
+     .             sds_id(N_COMP_TYPES),
+     .             sds_index(N_COMP_TYPES)
+         integer   RANK, comp_type, comp_type_out
+         integer   comp_arg(N_COMP_ARG), comp_prm_out(N_COMP_ARG)
+         integer   d_dims(2)
+         integer   start(2), stride(2), edges(2)
+         integer   status, fill_value
+         integer   err_compress
+         character*12 file(N_COMP_TYPES)
+         character*12 name(N_COMP_TYPES)
+         integer   n, m, n_part, m_part
+         integer   n_part_stride, m_part_stride
+         integer   n_part_start, m_part_start
+         integer   n_stride, m_stride
+         integer   n_start, m_start
+         integer   n_edges, m_edges
+         integer   i, j, l, kl, kj, i_comp
+C
+C  SDS functions declarations
+C
+C         integer   sfstart, sfcreate, sfendacc, sfend,
+C     .             sfn2index, sfselect,
+C     .             sfsfill, sfrdata,
+C     .             sfwdata, sfscompress, sfgcompress
+         include 'mffunc.inc'
+C
+C  Initial data declarations( change if you which to test larger arrays )
+C
+C  Data array dimensions n and m and RANK
+C
+         parameter (n = 9, m = 4, RANK = 2)
+
+C
+C  Part data dimensions n_part, m_part
+C
+         parameter (n_part = 5, m_part = 2)
+C
+C  Stride and start coordinates of part_data
+C
+         parameter (n_part_stride = 1, m_part_stride = 1)
+         parameter (n_part_start = 2, m_part_start = 1)
+C
+C  Sart, stride  and edges parameters in each dimension
+C
+         parameter (n_start = 0, m_start = 0)
+         parameter (n_stride = 1, m_stride = 1)
+         parameter (n_edges = n, m_edges = m)
+C
+C  Data declaration
+C
+         integer*4 data(n,m)
+C
+C  Buffer to hold part of the data when we read data back
+C
+         integer*4 part_data(n_part,m_part)
+C
+C  HDF parameters initialization
+C
+C
+C  Read/Write parameters
+C
+         integer   DFACC_CREATE,
+     .             DFACC_WRITE,
+     .             DFACC_READ
+         parameter (DFACC_CREATE = 4,
+     .             DFACC_READ   =  1,
+     .             DFACC_WRITE   = 2)
+C
+C  Data type parameters
+C
+C         integer   DATA_TYPE
+         integer   DFNT_CHAR,
+     .             DFNT_INT16,
+     .             DFNT_INT32,
+     .             DFNT_FLOAT32,
+     .             DFNT_FLOAT64
+         parameter (DFNT_CHAR   = 4,
+     .             DFNT_INT16   = 22,
+     .             DFNT_INT32   = 24,
+     .             DFNT_FLOAT32 = 5,
+     .             DFNT_FLOAT64 = 6)
+C
+C  Compression parametes
+C
+         integer   COMP_CODE_NONE,
+     .             COMP_CODE_RLE,
+     .             COMP_CODE_SKPHUFF,
+     .             COMP_CODE_DEFLATE
+
+         parameter (COMP_CODE_NONE   = 0,
+     .             COMP_CODE_RLE     = 1,
+     .             COMP_CODE_SKPHUFF = 3,
+     .             COMP_CODE_DEFLATE = 4)
+C
+C  Compression arguments ( defined for clarity, actual values
+C  will be passed to SFSCHUNK function via comp_arg parameter)
+C
+         integer deflate_level,
+     .           skphuff_skp_size
+          parameter ( deflate_level    = 6,
+     .                skphuff_skp_size = 2 )
+
+
+C
+C--------------------End of declarations------------------------------
+C
+C
+C  We will write to five different files corresponding to the 
+C  different compression types
+C
+C  NO compression
+C 
+         file(1) = 'comp_no.hdf'
+         name(1) = 'Nocomp_data'
+C
+C  RLE compression
+C
+         file(2) = 'comp_rl.hdf'
+         name(2) = 'Rlcomp_data'
+C
+C  Addaptive Huffman compression
+C
+         file(3) = 'comp_sk.hdf'
+         name(3) = 'Hucomp_data'
+C
+C  Gzip compression
+C
+         file(4) = 'comp_gz.hdf'
+         name(4) = 'Gzcomp_data'
+C
+C   Dimension sizes array initialization
+C
+         d_dims(1) = n
+         d_dims(2) = m
+C        
+C   Initilize original array
+C
+         
+         do 20 j = 1, m 
+            do 10 i = 1, n
+               data(i,j) = 10*j + i
+10          continue
+20       continue
+C
+C  Initialize SD interfaces
+C
+       do 101 i = 1, N_COMP_TYPES
+          sd_id(i) = sfstart (file(i), DFACC_CREATE)
+101    continue          
+C
+C  Main loop through different compression types
+C
+         do 1000 i_comp = 1, N_COMP_TYPES
+
+C
+C        Create the data set
+C
+         sds_id(i_comp) = sfcreate(sd_id(i_comp), name(i_comp), 
+     .                     DFNT_INT32, RANK, d_dims)
+            if( sds_id(i_comp) .eq. -1 ) then
+                print *, 'sfcreate failed for', i_comp, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+C
+C        Fill the data set with fill_value
+C
+         fill_value = 0
+         status = sfsfill (sds_id(i_comp), fill_value)
+            if( status .ne. 0 ) then
+                print *, 'sfsfill failed for', i_comp, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+C
+C  Set compression type and compression arguments
+C
+C
+C   Initialize compression arguments array
+C
+         do 1 i = 1, n_comp_arg
+            comp_arg(i) = 0
+1        continue
+
+         if( i_comp .eq. 1 ) then 
+             comp_type = COMP_CODE_ NONE
+         endif
+         if( i_comp .eq. 2 ) then 
+             comp_type = COMP_CODE_ RLE
+         endif
+         if( i_comp .eq. 3 ) then 
+             comp_type = COMP_CODE_SKPHUFF 
+             comp_arg(1) = skphuff_skp_size
+         endif
+         if( i_comp .eq. 4 ) then 
+             comp_type =    COMP_CODE_DEFLATE 
+             comp_arg(1) = deflate_level
+         endif
+         status = sfscompress(sds_id(i_comp), comp_type, comp_arg)
+          if( status .ne. 0 ) then
+            print *, 'sfscompress failed for', i_comp, ' -th dataset'
+            err_compress = err_compress + 1
+          endif
+C
+C   Write data to the file
+C
+                start(1) = n_start
+                start(2) = m_start
+                stride(1) = n_stride
+                stride(2) = m_stride
+                edges(1)  = n_edges
+                edges(2)  = m_edges
+                status = sfwdata(sds_id(i_comp), start, stride,
+     .                           edges, data)
+            if( status .ne. 0 ) then
+                print *, 'sfwdata failed for', i_comp, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+         
+         status = sfendacc(sds_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i_comp, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+         status = sfend (sd_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfend failed for', i_comp, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+
+1000      continue 
+
+C
+C   Let's check what we have written 
+C
+C   Open files and restart SD interfaces
+C
+         do 2000 i = 1, N_COMP_TYPES
+C
+            sd_id(i) = sfstart (file(i), DFACC_READ)
+            if( sd_id(i) .eq. -1 ) then
+                print *, 'sfstart failed for', i, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+
+C
+C  Find written dataset in each file using its name and index
+C
+
+            sds_index(i) = sfn2index (sd_id(i), name(i))
+            if( sds_index(i) .eq. -1 ) then
+                print *, 'sfn2index failed for', i, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+            sds_id(i)    = sfselect (sd_id(i), sds_index(i))
+            if( sds_id(i) .eq. -1 ) then
+                print *, 'sfselect failed for', i, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+C
+C  Find out type of compression used and compression parameters.
+C
+            status = sfgcompress(sds_id(i), comp_type_out, comp_prm_out)
+	    if (status .eq. -1) then
+            print *, 'sfgcompress failed for', i, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+            if (name(i) .eq. 'Nocomp_data') then
+                if (comp_type_out .ne. COMP_CODE_NONE) then
+            print *, 'wrong compression type for Nocomp_data dataset'
+                err_compress = err_compress + 1
+                endif
+            endif
+            if (name(i) .eq. 'Rlcomp_data') then
+                if (comp_type_out .ne. COMP_CODE_RLE) then
+            print *, 'wrong compression type for Rlcomp_data dataset'
+                err_compress = err_compress + 1
+                endif
+            endif
+            if (name(i) .eq. 'Hucomp_data') then
+                if (comp_type_out .ne. COMP_CODE_SKPHUFF) then
+            print *, 'wrong compression type for Hucomp_data dataset'
+                err_compress = err_compress + 1
+                endif
+                if (comp_prm_out(1). ne. skphuff_skp_size) then
+         print *, 'wrong compression parameter for Hucomp_data dataset'
+                err_compress = err_compress + 1
+                endif
+
+            endif
+            if (name(i) .eq. 'Gzcomp_data') then
+                if (comp_type_out .ne. COMP_CODE_DEFLATE) then
+          print *, 'wrong compression type for Gzcomp_data dataset'
+                endif
+                if (comp_prm_out(1). ne. deflate_level) then
+          print *, 'wrong compression parameter for Gzcomp_data dataset'
+                err_compress = err_compress + 1
+                endif
+            endif
+
+
+C
+C   Read part of the data back using sfrdata function
+C
+         start(1) = n_part_start
+         start(2) = m_part_start
+         edges(1) = n_part
+         edges(2) = m_part
+         stride(1) = n_part_stride 
+         stride(2) = m_part_stride 
+         status = sfrdata (sds_id(i), start, stride, edges,
+     .                         part_data)
+             if (status .ne. 0) then
+                 print *, 'sfrdata failed for reading part data for ',
+     .           i, '-th dataset'
+             err_compress = err_compress + 1
+             endif
+C
+C   Compare output with aqtual data
+C
+         do 204 j = 1, m_part
+            do 203 l = 1, n_part
+               kl = n_part_start + 1 + (l-1)*n_part_stride
+               kj = m_part_start + 1 + (j-1)*m_part_stride
+               if (data(kl, kj) .ne. part_data(l,j)) then
+                  print *, 'sfrdata read wrong data for ', 
+     .            i ,'-th dataset'
+               err_compress = err_compress +1
+               endif 
+203         continue
+204      continue
+ 
+         
+C 
+C  Terminate access to SDS, shutdown interfaces and close the files
+C
+           status = sfendacc(sds_id(i))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+           status = sfend(sd_id(i))
+            if( status .ne. 0 ) then
+                print *, 'sfend failed for', i, ' -th dataset'
+                err_compress = err_compress + 1
+            endif
+
+2000   continue
+         return
+         end
diff --git a/mfhdf/fortran/hdftest1.f b/mfhdf/fortran/hdftest1.f
new file mode 100644
index 0000000..5574beb
--- /dev/null
+++ b/mfhdf/fortran/hdftest1.f
@@ -0,0 +1,457 @@
+C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+C  Copyright by The HDF Group.                                               *
+C  Copyright by the Board of Trustees of the University of Illinois.         *
+C  All rights reserved.                                                      *
+C                                                                            *
+C  This file is part of HDF.  The full HDF copyright notice, including       *
+C  terms governing use, modification, and redistribution, is contained in    *
+C  the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C  of the source code distribution tree; Copyright.html can be found at      *
+C  http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C  access to either file, you may request a copy from help at hdfgroup.org.     *
+C * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+C
+C This is a test driver for new SD Fortran functions
+C
+      program test_new_functions
+      implicit none
+
+      integer err1, err2
+
+      err1=0
+      err2=0
+      call test_file(err1)
+      if (err1 .ne. 0) then
+         print*, 'test_file failed with ', err1, ' errors'
+      endif
+      if (err1 .eq. 0) then
+         print*, 'test_file.................. PASSED'
+      endif
+      call test_vars(err2)
+      if (err2 .ne. 0) then
+         print*, 'test_vars failed with ', err2, ' errors'
+      endif
+      if (err2 .eq. 0) then
+         print*, 'test_vars.................. PASSED'
+         print*,' '
+      endif
+      end
+          
+C=============================================================
+C
+C This new subroutine tests the following SD Fortran functions
+C       sfgetname
+C       sfgetnamelen
+C       sfgmaxopenf
+C       sfgnumopenf
+C       sfrmaxopenf
+C
+C=============================================================
+      subroutine test_file(err)
+      
+      implicit none
+      
+      include 'mffunc.inc'
+      
+      integer      DFACC_CREATE
+      parameter   (DFACC_CREATE = 4)
+      integer      err,status
+      integer      sd_id
+      character*20 file
+      character*20 file_out
+      integer      flen
+      integer      curr_max, sys_limit
+      integer NUM_FILES_LOW
+      parameter (NUM_FILES_LOW=35)
+      integer fids(NUM_FILES_LOW)
+      integer H4_MAX_NC_OPEN 
+      parameter (H4_MAX_NC_OPEN=32)
+      integer flen_out
+      character*2 ichr2
+      integer i, curr_opened
+
+C--------------------End of declarations------------------------------
+
+      file = 'test_file.hdf'
+
+C Get the current max and system limit
+
+      status = sfgmaxopenf(curr_max, sys_limit)
+      if( status .ne. 0 ) then
+         print*,'sfgmaxopenf failed'
+         err = err + 1
+      endif
+      if(curr_max .ne. H4_MAX_NC_OPEN)THEN
+         print*,'sfgmaxopenf failed: Incorrect max number of open files'
+         err = err + 1
+      endif
+           
+C Reset current max to an arbitrary number and check
+      
+      curr_max = sfrmaxopenf(40)
+      if( status .ne. 0 ) then
+         print*,'sfrmaxopenf failed'
+         err = err + 1
+      endif
+      if( curr_max .ne. 40 ) then
+         print*,'sfrmaxopenf failed: Current max number of open files'
+         err = err + 1
+      endif
+
+C Try to create more files than the default max (currently, 32) and
+C all should succeed
+
+      do i = 1, NUM_FILES_LOW
+         write(ichr2,'(I2.2)') i
+         fids(i) = sfstart ('test_file'//ichr2//'.hdf', DFACC_CREATE)
+         if( fids(i) .le. 0 ) then
+            print*, 'sfstart failed'
+            err = err + 1
+         endif
+      enddo
+
+C verify that NUM_FILES_LOW files are opened
+      status = sfgnumopenf(curr_opened)
+      if( curr_opened .ne. NUM_FILES_LOW ) then
+         print*, 'sfgnumopenf failed: Incorrect number of open files'
+         err = err + 1
+      endif
+
+C Close all the files
+      
+      do i = 1, NUM_FILES_LOW
+         status = sfend(fids(i))
+         if( status .ne. 0 ) then
+            print*, 'sfend failed'
+            err = err + 1
+         endif
+      enddo
+C
+C  Initialize SD interfaces
+C
+      sd_id = sfstart (file, DFACC_CREATE)
+      if( sd_id .le. 0 ) then
+         print*, 'sfstart failed'
+         err = err + 1
+         goto 1000
+      endif
+      status = sfgetnamelen(sd_id, flen) 
+      if( status .ne. 0 .or. flen .ne. 13) then
+         print*, 'sfgetnamelen failed'
+         err = err + 1
+      endif
+      flen_out = sfgetfname(sd_id, file_out)
+      if( flen_out .ne. 13 ) then
+         print*, 'sfgetfname failed: wrong length'
+         err = err + 1
+      endif
+      if( file_out(1:13) .ne. file(1:13) ) then
+         print*, 'sfgetfname failed: wrong name'
+         err = err + 1
+      endif
+      status = sfend(sd_id)
+      if( status .ne. 0 ) then
+         print*, 'sfend failed'
+         err = err + 1
+      endif
+ 1000 return
+      end
+
+C=============================================================
+C This new subroutine tests the following SD Fortran functions
+C       sfidtype
+C       sfgnvars_byname
+C       sfn2indices
+C
+C=============================================================
+      subroutine test_vars(err)
+      
+      implicit none
+      
+      include 'mffunc.inc'
+      
+      integer      dset1, dset2, dim_id
+      integer      err,status
+      integer      sd_id, id_type
+      character*12 file
+      integer      DFACC_CREATE
+      parameter   (DFACC_CREATE = 4)
+      integer      DFACC_READ
+      parameter   (DFACC_READ = 1)
+      integer      RANK
+      parameter   (RANK=2)
+      integer      X_LENGTH,Y_LENGTH
+      parameter   (X_LENGTH=5)
+      parameter   (Y_LENGTH=5)
+      integer      dimsize(RANK)
+      character*9  VAR1_NAME
+      integer      var_list(3), type_list(3)
+      character*21   ATTR1_NAME
+      character*15   ATTR2_NAME
+      character*19   ATTR1_VAL
+      character*23   ATTR2_VAL
+      integer ATTR1_LEN
+      integer ATTR2_LEN
+      real sds1_data(X_LENGTH,Y_LENGTH)
+      integer start(2)
+      integer stride(2)
+C
+C  Data type parameters
+C
+C 
+      integer   DFNT_CHAR,
+     .             DFNT_INT16,
+     .             DFNT_INT32,
+     .             DFNT_FLOAT32,
+     .             DFNT_FLOAT64
+      parameter (DFNT_CHAR   = 4,
+     .             DFNT_INT16   = 22,
+     .             DFNT_INT32   = 24,
+     .             DFNT_FLOAT32 = 5,
+     .             DFNT_FLOAT64 = 6)
+      integer i,j
+      integer n_vars
+
+
+C--------------------End of declarations------------------------------
+      file = 'test_var.hdf'
+      VAR1_NAME = "DataSet_1"
+      ATTR1_NAME = "Attribute Dimension 1"
+      ATTR2_NAME = "Attribute SDS 1"
+      ATTR1_VAL = "This is a coord var"
+      ATTR2_VAL = "This is not a coord var"
+      ATTR1_LEN = 21
+      ATTR2_LEN = 15
+      
+      start(1) = 0
+      start(2) = 0
+      stride(1) = 1
+      stride(2) = 1
+      
+      do i = 1, X_LENGTH
+         do j = 1, Y_LENGTH
+            sds1_data(j,i) = j*i
+         enddo
+      enddo
+C     
+C  Initialize SD interfaces
+C
+      sd_id = sfstart (file, DFACC_CREATE)
+      if( sd_id .le. 0 ) then
+         print*, 'sfstart failed'
+         err = err + 1
+         goto 1000
+      endif
+
+C   Create an X_LENGTH by Y_LENGTH dataset, called DataSet_1
+
+      dimsize(1) = X_LENGTH
+      dimsize(2) = Y_LENGTH
+      
+      dset1 = sfcreate(sd_id,VAR1_NAME,DFNT_FLOAT64,RANK,dimsize)
+      if(dset1.eq.-1) then
+         print*, 'sfcreate returned bad ID', dset1
+         err = err + 1
+      endif
+
+C Set the dimension name to be the same as its dataset.
+      dim_id = sfdimid(dset1, 0)
+      if(dim_id.eq.-1)then
+         print*,'sfgetdimid returned error code', status
+         err = err + 1
+      endif
+
+      status = sfsdmname(dim_id, VAR1_NAME)
+      if(status.eq.-1)then
+         print*,'sfsdmname returned error code', status
+         err = err + 1
+      endif
+
+C Set an attribute to dimension VAR1_NAME.
+      status=sfsnatt(dim_id,ATTR1_NAME,DFNT_CHAR,ATTR1_LEN,ATTR1_VAL)
+      if(status.eq.-1)then
+         print*,'sfsnatt returned error code', status
+         err = err + 1
+      endif
+
+C Set an attribute to dataset VAR1_NAME.
+      status=sfsnatt(sd_id,ATTR2_NAME,DFNT_CHAR,ATTR2_LEN,ATTR2_VAL)
+      if(status.eq.-1)then
+         print*,'sfsnatt returned error code', status
+         err = err + 1
+      endif
+
+C Create another X_LENGTH by Y_LENGTH dataset, called DataSet_2
+
+      dset2 = sfcreate(sd_id,VAR1_NAME,DFNT_FLOAT64,RANK,dimsize)
+      if(dset2.eq.-1) then
+         print*, 'sfcreate returned bad ID', dset2
+         err = err + 1
+      endif
+
+C Test SDidtype on the second dataset */
+      status = sfidtype(dset2,id_type)
+      if(status.eq.-1)then
+         print*,  'sfidtype returned error code', status
+         err = err + 1
+      else if(id_type.ne.1) then
+         print*, 'sfidtype returned bad object type', id_type
+         err = err + 1
+      endif
+
+C Write data to the SDS
+
+      status = sfwdata(dset1, start, stride, dimsize, sds1_data)
+      if( status .ne. 0 ) then
+         print*, 'sfwdata failed for', 1, ' -th dataset'
+         err = err + 1
+      endif
+
+C Close the datasets          
+
+      status = sfendacc(dset1)
+      if(status.eq.-1)then
+         print*,  'sfendacc returned error code', status
+         err = err + 1
+      end if
+
+      status = sfendacc(dset2)
+      if(status.eq.-1)then
+         print*,  'sfendacc returned error code', status
+         err = err + 1
+      end if
+
+C Close the file
+
+      status = sfend(sd_id)
+      if( status .ne. 0 ) then
+         print*, 'sfend failed ', status
+         err = err + 1
+      endif
+      
+C Re-open the file to test SDidtype more */
+      sd_id = sfstart (file, DFACC_READ)
+      if( sd_id .le. 0 ) then
+         print*, 'sfstart failed'
+         err = err + 1
+         goto 1000
+      endif
+
+C Check variable type and attributes of each element in the file
+
+C Get the number of variables of name VAR1_NAME
+      status = sfgnvars_byname(sd_id, VAR1_NAME, n_vars)
+      if( status .eq. -1)then
+         print*, 'sfgnvars_byname failed'
+         err = err + 1
+      endif
+      
+      if(n_vars.eq. 1)then
+C        Get index of dataset VAR1_NAME
+         status = sfn2index(sd_id, VAR1_NAME)
+         if( status .lt. 0)then
+            print*, 'sfn2index failed'
+            err = err + 1
+         endif
+      else
+C        Get the list of all variables of named VAR1_NAME
+         status=sfn2indices(sd_id,VAR1_NAME,var_list,type_list,
+     +                      n_vars)
+         if( status .lt. 0)then
+            print*, 'sfn2indices failed'
+            err = err + 1
+         endif
+C        In this case, the first and third variable is a dataset
+         do i = 1, n_vars
+            if (type_list(i) .eq. 0)then
+               if( var_list(i) .ne. i-1)then
+                  print*, 'sfn2indices failed in indices'
+                  err = err + 1
+               endif
+            endif
+         enddo
+      endif
+
+C Test SDidtype on the SD id
+      status = sfidtype(sd_id,id_type)
+      if(status.eq.-1)then
+         print*,  'sfidtype returned error code', status
+         err = err + 1
+      else if(id_type.ne.0) then
+         print*, 'sfidtype returned bad object type', id_type
+         err = err + 1
+      endif
+C Get access to the first dataset and test SDidtype on the SDS id
+
+      dset1 = sfselect(sd_id, 0);
+      if( dset1 .eq. -1 ) then
+         print*, 'sfselect failed for', 0, ' -th dataset'
+         err = err + 1
+      endif
+      
+      status = sfidtype(dset1,id_type)
+      if(status.eq.-1)then
+         print*,  'sfidtype returned error code', status
+         err = err + 1
+      else if(id_type.ne.1) then
+         print*, 'sfidtype returned bad object type', id_type
+         err = err + 1
+      endif
+
+C Get access to the second dataset and test SDidtype on the SDS id
+        
+      dset2 = sfselect(sd_id, 1);
+      if( dset2 .eq. -1 ) then
+         print*, 'sfselect failed for', 1, ' -th dataset'
+         err = err + 1
+      endif
+      
+      status = sfidtype(dset2,id_type)
+      if(status.eq.-1)then
+         print*,'sfidtype returned error code', status
+         err = err + 1
+      else if(id_type.ne.1) then
+         print*,'sfidtype returned bad object type', id_type
+         err = err + 1
+      endif
+
+C Get dimension handle for first dimension of DataSet_1 and test
+C SDidtype on the dimension id
+
+      dim_id = sfdimid(dset1, 0)
+      if(dim_id.eq.-1)then
+         print*,'sfgetdimid returned error code', status
+         err = err + 1
+      endif
+      
+      status = sfidtype(dim_id,id_type)
+      if(status.eq.-1)then
+         print*,'sfidtype returned error code', status
+         err = err + 1
+      else if(id_type.ne.2) then
+         print*,'sfidtype returned bad object type', id_type
+         err = err + 1
+      endif
+
+C Close the datasets
+      status = sfendacc(dset1)
+      if(status.eq.-1)then
+         print*,  'sfendacc returned error code', status
+         err = err + 1
+      end if
+
+      status = sfendacc(dset2)
+      if(status.eq.-1)then
+         print*,  'sfendacc returned error code', status
+         err = err + 1
+      end if
+
+C Close the file
+      status = sfend(sd_id)
+      if( status .ne. 0 ) then
+         print*, 'sfend failed'
+         err = err + 1
+      endif
+ 1000 return
+      end
+
diff --git a/mfhdf/fortran/hdftst.sav b/mfhdf/fortran/hdftst.sav
new file mode 100644
index 0000000..2738cad
--- /dev/null
+++ b/mfhdf/fortran/hdftst.sav
@@ -0,0 +1,12 @@
+ name = Alpha                                             
+ name = TestDim                                           
+ name = Globulator                                        
+ label    = lxxx                                              
+ unit     = uyyy                                              
+ format   = fzzz                                              
+ coordsys = caaa                                              
+ label    = dA                                                
+ unit     = dBB                                               
+ format   = dCCC                                              
+ values = Howdy Sailor                                      
+ Total errors :            0
diff --git a/mfhdf/fortran/jackets.c.in b/mfhdf/fortran/jackets.c.in
new file mode 100644
index 0000000..821fde3
--- /dev/null
+++ b/mfhdf/fortran/jackets.c.in
@@ -0,0 +1,2215 @@
+/*
+ *	Copyright 1990, University Corporation for Atmospheric Research
+ *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ */
+/* $Id: jackets-linux.c 4772 2006-11-01 16:53:11Z epourmal $ */
+/*
+ * OVERVIEW
+ *
+ * This file contains jacket routines written in C for interfacing Fortran
+ * netCDF function calls to the actual C binding for the NetCDF.  This code
+ * is written explicitly for Sun.  In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include	<ctype.h>
+#include        <string.h>
+#include	<stdlib.h>
+#include	<stdio.h>
+#ifdef HDF
+#include        "local_nc.h"
+#else /* HDF */
+#include	"netcdf.h"
+#endif /* HDF */
+
+
+
+
+
+#if !NC_OLD_FILLVALUES
+
+struct ncfils {			/* This will be a common block from Fortran */
+    double dd;
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+    int ll;
+#else
+    long ll;
+#endif
+    float ff;
+    short ss;
+    char cc;
+    char bb;
+} ncfils_ = {
+    FILL_DOUBLE,
+    FILL_LONG,
+    FILL_FLOAT,
+    FILL_SHORT,
+    FILL_CHAR,
+    FILL_BYTE
+};
+
+#else	/* NC_OLD_FILLVALUES below */
+
+/*
+ * This section is provided for backward compatibility only.  Using
+ * XDR infinities for floating-point fill values has caused more problems
+ * than it has solved.  We encourage you to define your own data-specific
+ * fill values rather than use default ones.  
+ * If, however, you *must* use default fill values, then you should use
+ * the above fill values rather than the ones in this section.
+ */
+
+struct ncfils {			/* This will be a common block from Fortran */
+    double dd;
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+    int ll;
+#else
+    long ll;
+#endif
+    float ff;
+    short ss;
+    char cc;
+    char bb;
+} ncfils_ = {
+    XDR_D_INFINITY,		/* You may have to insert a constant here */
+    FILL_LONG,
+    XDR_F_INFINITY,		/* You may have to insert a constant here */
+    FILL_SHORT,
+    FILL_CHAR,
+    FILL_BYTE
+};
+
+#endif	/* NC_OLD_FILLVALUES above */
+
+/* blank fill C string to make FORTRAN string */
+static void
+fcdcpy (fstring, fslen, sstring)
+    char *fstring;		/* output string to be blank-filled */
+    int fslen;			/* length of output string */
+    char *sstring;		/* input string, null-terminated */
+{
+    int i, len = strlen(sstring);
+
+    for (i = 0; i < len; i++)
+	*(fstring + i) = *(sstring + i);
+    for (i = len; i < fslen; i++)
+	*(fstring + i) = ' ';
+}
+
+
+static void
+reverse (array, length)
+    int array[];		/* array to be reversed */
+    int length;			/* length of array */
+{
+    int temp, i, j;
+
+    for (i = 0, j = length - 1; i < j; i++, j--) {
+	temp = array[i];
+	array[i] = array[j];
+	array[j] = temp;
+    }
+}
+
+
+static void
+revlongs (array, length)
+    long array[];		/* array to be reversed */
+    int length;			/* length of array */
+{
+    int i, j;
+    long temp;
+
+    for (i = 0, j = length - 1; i < j; i++, j--) {
+	temp = array[i];
+	array[i] = array[j];
+	array[j] = temp;
+    }
+}
+
+
+/* error handling function */
+static void
+handle_err (pname, rcode)
+    char *pname;		/* procedure name */
+    int rcode;			/* error return */
+{
+    cdf_routine_name = pname;
+    NCadvise(rcode, "string won't fit in CHARACTER variable provided");
+}
+
+/* copy function used to copy strings with embedded blanks */
+static void
+fstrncpy (target, source, maxlen)
+    char *target;		/* space to be copied into */
+    char *source;		/* string to be copied */
+    int maxlen;			/* maximum length of *source */
+{
+    while (maxlen-- && *source != '\0')
+	*target++ = *source++;
+    *target = '\0';
+}
+#ifdef WE_COULDNT_READ_NAMES_WITH_SPACES
+/* copy function used to copy strings terminated with blanks */
+static void
+nstrncpy (target, source, maxlen)
+    char *target;		/* space to be copied into */
+    char *source;		/* string to be copied */
+    int maxlen;			/* maximum length of *source */
+{
+    while (maxlen-- && *source != ' ')
+	*target++ = *source++;
+    *target = '\0';
+}
+#endif
+
+/* copy function used to copy strings with embeded blanks and
+   terminated with blanks */
+static void
+nstrncpy (target, source, maxlen)
+    char *target;		/* space to be copied into */
+    char *source;		/* string to be copied */
+    int maxlen;			/* maximum length of *source */
+{
+/* Copy all string */
+    while (maxlen--) 
+        *target++ = *source++;
+    *target -- = '\0';
+/* Disregard all trailing spaces  */
+     while (*target == ' ')
+         *target-- = '\0';
+
+}
+
+/*
+ * Compute product of dimensions.
+ */
+static long
+dimprod (dims, ndims)
+     long *dims;			/* list of dimensions */
+     int ndims;			/* number of dimensions in list */
+{
+    long *ip;
+    long prod = 1;
+
+    for (ip = dims; ip < &dims[ndims]; ip++)
+      prod *= *ip;
+    return prod;
+}
+
+
+#ifdef FORTRAN_HAS_NO_BYTE
+/*
+ * Convert multi-dimensional array of bytes stored in ints to packed array of
+ * bytes, in malloc'ed space.  Returns pointer to bytes or NULL if malloc
+ * failed.
+ */
+static char *
+itob(ints, dims, ndims)
+     int *ints;			/* multi-dimensional array of integers */
+     long *dims;			/* list of dimensions */
+     int ndims;			/* number of dimensions in list */
+{
+    long iocount = dimprod (dims, ndims);	/* product of dimensions */
+    char *bytes = (char *) malloc (iocount * sizeof (char));
+    int *ip;
+    char *bp = bytes;
+
+    if (bytes != NULL)
+      for (ip = ints; iocount > 0; iocount--)
+	*bp++ = (char) *ip++;
+    return bytes;
+}
+
+/*
+ * Convert a generalized multi-dimensional array of bytes stored in ints to 
+ * packed array of bytes, in malloc'ed space.  Returns pointer to bytes or 
+ * NULL if malloc failed.
+ */
+static char *
+itobg(ints, dims, basis, ndims)
+     int *ints;			/* multi-dimensional array of integers */
+     long *dims;			/* list of dimensions */
+     long *basis;			/* memory access basis vector */
+     int ndims;			/* number of dimensions in list */
+{
+    long iocount = dimprod (dims, ndims);	/* product of dimensions */
+    char *bytes = (char *) malloc (iocount * sizeof (char));
+
+    if (bytes != NULL && iocount > 0) {
+	int	idim;
+	char	*bp	= bytes;
+	char	*ip	= (char*)ints;
+	long	length[MAX_NC_DIMS];
+	long	coords[MAX_NC_DIMS];
+
+	for (idim = 0; idim < ndims; ++idim) {
+	    length[idim]	= dims[idim]*basis[idim];
+	    coords[idim]	= 0;
+	}
+
+	for (;;) {
+	    *bp++	= (char)*(int*)ip;
+	    idim	= ndims - 1;
+	carry:
+	    ip	+= basis[idim];
+	    if (++coords[idim] >= dims[idim]) {
+		coords[idim]	= 0;
+		ip		-= length[idim];
+		if (--idim < 0)
+		    break;
+		goto carry;
+	    }
+        }
+    }
+
+    return bytes;
+}
+
+/*
+ * Convert a packed array of bytes into a generalized multi-dimensional array
+ * of ints.
+ */
+static void
+btoig(bytes, ints, dims, basis, ndims)
+     char *bytes;		/* packed array of bytes */
+     int *ints;			/* multi-dimensional array of integers */
+     long *dims;		/* list of dimensions */
+     long *basis;		/* memory access basis vector */
+     int ndims;			/* number of dimensions in list */
+{
+    if (dimprod (dims, ndims) > 0) {
+	int	idim;
+	char	*bp	= bytes;
+	char	*ip	= (char*)ints;
+	long	length[MAX_NC_DIMS];
+	long	coords[MAX_NC_DIMS];
+
+	for (idim = 0; idim < ndims; ++idim) {
+	    length[idim]	= dims[idim]*basis[idim];
+	    coords[idim]	= 0;
+	}
+
+	for (;;) {
+	    *(int*)ip	= *bp++;
+	    idim	= ndims - 1;
+	carry:
+	    ip	+= basis[idim];
+	    if (++coords[idim] >= dims[idim]) {
+		coords[idim]	= 0;
+		ip		-= length[idim];
+		if (--idim < 0)
+		    break;
+		goto carry;
+	    }
+        }
+    }
+}
+#endif /* FORTRAN_HAS_NO_BYTE */
+
+#ifdef FORTRAN_HAS_NO_SHORT
+/*
+ * Convert multi-dimensional array of shorts stored in ints to packed array of
+ * shorts, in malloc'ed space.  Returns pointer to shorts or NULL if malloc
+ * failed.
+ */
+static short *
+itos(ints, dims, ndims)
+     int *ints;		/* multi-dimensional array of ints */
+     long *dims;			/* list of dimensions */
+     int ndims;			/* number of dimensions in list */
+{
+    long iocount = dimprod (dims, ndims);	/* product of dimensions */
+    short *shorts = (short *) malloc (iocount * sizeof (short));
+    int *ip;
+    short *sp = shorts;
+
+    if (shorts != NULL)
+      for (ip = ints; iocount > 0; iocount--)
+	*sp++ = (short) *ip++;
+    return shorts;
+}
+
+/*
+ * Convert a generalized multi-dimensional array of shorts stored in ints to 
+ * packed array of shorts, in malloc'ed space.  Returns pointer to shorts or 
+ * NULL if malloc failed.
+ */
+static short *
+itosg(ints, dims, basis, ndims)
+     int *ints;			/* multi-dimensional array of integers */
+     long *dims;			/* list of dimensions */
+     long *basis;			/* memory access basis vector */
+     int ndims;			/* number of dimensions in list */
+{
+    long iocount = dimprod (dims, ndims);	/* product of dimensions */
+    short *shorts = (short *) malloc (iocount * sizeof (short));
+
+    if (shorts != NULL && iocount > 0) {
+	int	idim;
+	char	*ip	= (char*)ints;
+	short	*sp	= shorts;
+	long	length[MAX_NC_DIMS];
+	long	coords[MAX_NC_DIMS];
+
+	for (idim = 0; idim < ndims; ++idim) {
+	    length[idim]	= dims[idim]*basis[idim];
+	    coords[idim]	= 0;
+	}
+
+	for (;;) {
+	    *sp++	= (short)*(int*)ip;
+	    idim	= ndims - 1;
+	carry:
+	    ip	+= basis[idim];
+	    if (++coords[idim] >= dims[idim]) {
+		coords[idim]	= 0;
+		ip		-= length[idim];
+		if (--idim < 0)
+		    break;
+		goto carry;
+	    }
+        }
+    }
+
+    return shorts;
+}
+
+/*
+ * Convert a packed array of shorts into a generalized multi-dimensional array
+ * of ints.
+ */
+static void
+stoig(shorts, ints, dims, basis, ndims)
+     short *shorts;		/* packed array of shorts */
+     int *ints;			/* multi-dimensional array of integers */
+     long *dims;		/* list of dimensions */
+     long *basis;		/* memory access basis vector */
+     int ndims;			/* number of dimensions in list */
+{
+    if (dimprod (dims, ndims) > 0) {
+	int	idim;
+	short	*sp	= shorts;
+	char	*ip	= (char*)ints;
+	long	length[MAX_NC_DIMS];
+	long	coords[MAX_NC_DIMS];
+
+	for (idim = 0; idim < ndims; ++idim) {
+	    length[idim]	= dims[idim]*basis[idim];
+	    coords[idim]	= 0;
+	}
+
+	for (;;) {
+	    *(int*)ip	= *sp++;
+	    idim	= ndims - 1;
+	carry:
+	    ip	+= basis[idim];
+	    if (++coords[idim] >= dims[idim]) {
+		coords[idim]	= 0;
+		ip		-= length[idim];
+		if (--idim < 0)
+		    break;
+		goto carry;
+	    }
+        }
+    }
+}
+#endif /* FORTRAN_HAS_NO_SHORT */
+
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+/*
+ * Convert multi-dimensional array of NCLONGs stored in ints to packed
+ * array of longs, in malloc'ed space.  Returns pointer to longs or NULL
+ * if malloc failed.
+ */
+static long *
+itol(ints, dims, ndims)
+    int		*ints;		/* multi-dimensional array of ints */
+    long	*dims;		/* list of dimensions */
+    int		ndims;		/* number of dimensions in list */
+{
+    long	iocount = dimprod (dims, ndims);
+    long	*longs = (long *) malloc (iocount * sizeof (long));
+    int		*ip;
+    long	*lp = longs;
+
+    if (longs != NULL)
+	for (ip = ints; iocount > 0; iocount--)
+	    *lp++ = (long) *ip++;
+    return longs;
+}
+
+/*
+ * Convert a generalized multi-dimensional array of longs stored in ints to 
+ * packed array of longs, in malloc'ed space.  Returns pointer to longs or 
+ * NULL if malloc failed.
+ */
+static long *
+itolg(ints, dims, imap, ndims)
+    int		*ints;		/* multi-dimensional array of integers */
+    long	*dims;		/* list of dimensions */
+    long	*imap;		/* memory access index mapping vector */
+    int		ndims;		/* number of dimensions in list */
+{
+    long	iocount = dimprod (dims, ndims);
+    long	*longs = (long *) malloc (iocount * sizeof (long));
+
+    if (longs != NULL && iocount > 0) {
+	int	idim;
+	char	*ip	= (char*)ints;
+	long	*lp	= longs;
+	long	length[MAX_NC_DIMS];
+	long	coords[MAX_NC_DIMS];
+
+	for (idim = 0; idim < ndims; ++idim) {
+	    length[idim]	= dims[idim]*imap[idim];
+	    coords[idim]	= 0;
+	}
+
+	for (;;) {
+	    *lp++	= (long)*(int*)ip;
+	    idim	= ndims - 1;
+	carry:
+	    ip	+= imap[idim];
+	    if (++coords[idim] >= dims[idim]) {
+		coords[idim]	= 0;
+		ip		-= length[idim];
+		if (--idim < 0)
+		    break;
+		goto carry;
+	    }
+        }
+    }
+
+    return longs;
+}
+
+/*
+ * Convert a packed array of longs into a generalized multi-dimensional array
+ * of ints.
+ */
+static void
+ltoig(longs, ints, dims, imap, ndims)
+    long	*longs;		/* packed array of longs */
+    int		*ints;		/* multi-dimensional array of integers */
+    long	*dims;		/* list of dimensions */
+    long	*imap;		/* memory access index mapping vector */
+    int		ndims;		/* number of dimensions in list */
+{
+    if (dimprod (dims, ndims) > 0) {
+	int	idim;
+	long	*lp	= longs;
+	char	*ip	= (char*)ints;
+	long	length[MAX_NC_DIMS];
+	long	coords[MAX_NC_DIMS];
+
+	for (idim = 0; idim < ndims; ++idim) {
+	    length[idim]	= dims[idim]*imap[idim];
+	    coords[idim]	= 0;
+	}
+
+	for (;;) {
+	    *(int*)ip	= *lp++;
+	    idim	= ndims - 1;
+	carry:
+	    ip	+= imap[idim];
+	    if (++coords[idim] >= dims[idim]) {
+		coords[idim]	= 0;
+		ip		-= length[idim];
+		if (--idim < 0)
+		    break;
+		goto carry;
+	    }
+        }
+    }
+}
+#endif	/* Alpha platform above */
+
+/* ------------ Linux FORTRAN jackets for netCDF Functions ------------ */
+
+/* used to set the C global variable ncopts from Fortran */
+void
+nncpopt(val)
+    int		*val;	
+{
+    ncopts = *val;
+}
+
+
+/* used to get the C global variable ncopts from Fortran */
+void
+nncgopt(val)
+    int		*val;	
+{
+    *val = ncopts;
+}
+
+/*
+ * creates a new netCDF file, returning a netCDF ID.  New netCDF
+ * file is placed in define mode.
+ */
+int
+nnccre(pathname, clobmode, rcode, pathnamelen)
+    char	*pathname;	
+    int		pathnamelen;
+    int		*clobmode;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    int cdfid;
+
+    nstrncpy (name, pathname, pathnamelen);
+    if ((cdfid = nccreate (name, *clobmode)) != -1) {
+	*rcode = 0;
+	return (cdfid);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+
+/* opens an existing netCDF file for access */
+int
+nncopn(pathname, rwmode, rcode, pathnamelen)
+    char	*pathname;	
+    int		pathnamelen;
+    int		*rwmode;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    int cdfid;
+
+    nstrncpy (name, pathname, pathnamelen);
+    if ((cdfid = ncopen (name, *rwmode)) != -1) {
+	*rcode = 0;
+	return (cdfid);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+
+/* adds a new dimension to an open netCDF file in define mode */
+int
+nncddef(cdfid, dimname, dimlen, rcode, dimnamelen)
+    int		*cdfid;	
+    char	*dimname;	
+    int		dimnamelen;
+    int		*dimlen;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    int dimid;
+
+    nstrncpy (name, dimname, dimnamelen);
+    if ((dimid = ncdimdef (*cdfid, name, (long)*dimlen)) != -1) {
+	*rcode = 0;
+	return (dimid + 1);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+
+/*
+ * returns the ID of a netCDF dimension, given the name of the
+ * dimension
+ */
+int
+nncdid(cdfid, dimname, rcode, dimnamelen)
+    int		*cdfid;	
+    char	*dimname;	
+    int		dimnamelen;
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    int dimid;
+
+    nstrncpy (name, dimname, dimnamelen);
+    if ((dimid = ncdimid (*cdfid, name)) != -1) {
+	*rcode = 0;
+	return (dimid + 1);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+
+/* adds a new variable to an open netCDF file in define mode */
+int
+nncvdef(cdfid, varname, datatype, ndims, dimarray, rcode, varnamelen)
+    int		*cdfid;	
+    char	*varname;	
+    int		varnamelen;
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*rcode;	
+{
+    int varid, i, dimid[MAX_VAR_DIMS];
+    char name[MAX_NC_NAME + 1];
+
+    nstrncpy (name, varname, varnamelen);
+    for (i = 0; i < *ndims; i++)
+	dimid[i] = dimarray[i] - 1;
+    reverse (dimid, *ndims);
+    if ((varid = ncvardef (*cdfid, name, (nc_type) *datatype, *ndims,
+			   dimid)) != -1) {
+	*rcode = 0;
+	return (varid + 1);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+
+/* returns the ID of a netCDF variable given its name */
+int
+nncvid(cdfid, varname, rcode, varnamelen)
+    int		*cdfid;	
+    char	*varname;	
+    int		varnamelen;
+    int		*rcode;	
+{
+    int varid;
+    char name[MAX_NC_NAME + 1];
+
+    nstrncpy (name, varname, varnamelen);
+    if ((varid = ncvarid (*cdfid, name)) != -1) {
+	*rcode = 0;
+	return (varid + 1);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+
+/* returns number of bytes per netCDF data type */
+int
+nnctlen(datatype, rcode)
+    int		*datatype;	
+    int		*rcode;	
+{
+    int itype;
+
+    if ((itype = nctypelen ((nc_type) *datatype)) != -1) {
+	*rcode = 0;
+	return (itype);
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
+/* closes an open netCDF file */
+void
+nncclos(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncclose (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* puts an open netCDF into define mode */
+void
+nncredf(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncredef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* takes an open netCDF out of define mode */
+void
+nncendf(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncendef (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* returns information about an open netCDF file given its netCDF ID */
+void
+nncinq(cdfid, ndims, nvars, natts, recdim, rcode)
+    int		*cdfid;	
+    int		*ndims;	
+    int		*nvars;	
+    int		*natts;	
+    int		*recdim;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncinquire (*cdfid, ndims, nvars, natts, recdim) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    if (*recdim != -1)
+	(*recdim)++;
+}
+
+/*
+ * makes sure that the disk copy of a netCDF file open for writing
+ * is current
+ */
+void
+nncsnc(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncsync (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/*
+ * restores the netCDF to a known consistent state in case anything
+ * goes wrong during the definition of new dimensions, variables
+ * or attributes
+ */
+void
+nncabor(cdfid, rcode)
+    int		*cdfid;	
+    int		*rcode;	
+{
+    *rcode = 0;
+    if (ncabort (*cdfid) == -1)
+	*rcode = ncerr;
+}
+
+/* returns the name and size of a dimension, given its ID */
+void
+nncdinq(cdfid, dimid, dimname, size, rcode, dimnamelen)
+    int		*cdfid;	
+    int		*dimid;	
+    char	*dimname;	
+    int		dimnamelen;
+    int		*size;	
+    int		*rcode;	
+{
+    long siz;
+    char name[MAX_NC_NAME + 1];
+
+    *rcode = 0;
+    if (ncdiminq (*cdfid, *dimid - 1, name, &siz) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    *size = siz;
+    if (strlen (name) > dimnamelen) {
+	*rcode = NC_ESTS;
+	handle_err ("NCDINQ", *rcode);
+	return;
+    }
+    /* blank fill the input character string */
+    fcdcpy (dimname, dimnamelen, name);
+}
+
+/* renames an existing dimension in a netCDF open for writing */
+void
+nncdren(cdfid, dimid, dimname, rcode, dimnamelen)
+    int		*cdfid;	
+    int		*dimid;	
+    char	*dimname;	
+    int		dimnamelen;
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+
+    nstrncpy (name, dimname, dimnamelen);
+    *rcode = 0;
+    if (ncdimrename (*cdfid, *dimid - 1, name) == -1)
+	*rcode = ncerr;
+}
+
+/* returns information about a netCDF variable, given its ID */
+void
+nncvinq(cdfid, varid, varname, datatype, ndims, dimarray, natts, rcode, varnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*varname;	
+    int		varnamelen;
+    int		*datatype;	
+    int		*ndims;	
+    int		*dimarray;	
+    int		*natts;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    int dimid[MAX_VAR_DIMS], i;
+
+    *rcode = 0;
+    if (ncvarinq (*cdfid, *varid - 1, name, (nc_type *) datatype, ndims, dimid,
+		  natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < *ndims; i++)
+	dimarray[i] = dimid[i] + 1;
+    reverse (dimarray, *ndims);
+    if (strlen (name) > varnamelen) {
+	*rcode = NC_ESTS;
+	handle_err ("NCVINQ", *rcode);
+	return;
+    }
+    fcdcpy (varname, varnamelen, name);
+}
+
+/* puts a single numeric data value into a variable of an open netCDF */
+void
+nncvpt1(cdfid, varid, indices, value, rcode)
+
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    void	*value;	
+    int		*rcode;	
+{
+    int datatype, ndims, natts, i;
+    long nindices[MAX_VAR_DIMS];
+    int dimid[MAX_VAR_DIMS];
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0,
+		  (nc_type *) & datatype, &ndims, dimid, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < ndims; i++)
+	nindices[i] = indices[i] - 1;
+    revlongs (nindices, ndims);
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {	/* pack ints into bytes */
+	char           bytes = *(int *) value;
+	if (ncvarput1(*cdfid, *varid - 1, nindices,
+		      (ncvoid *) &bytes) == -1) {
+	    *rcode = ncerr;
+	}
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) datatype == NC_SHORT) {	/* pack ints into shorts */
+	short          shorts = *(int *)value;
+	if (ncvarput1(*cdfid, *varid - 1, nindices, (ncvoid *) &shorts) == -1) {
+	    *rcode = ncerr;
+	}
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	long          longs = *(int *)value;
+	if (ncvarput1(*cdfid, *varid - 1, nindices, (ncvoid *) &longs) == -1) {
+	    *rcode = ncerr;
+	}
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) datatype == NC_LONG) {
+	long          longs = *(int *)value;
+	if (ncvarput1(*cdfid, *varid - 1, nindices, (ncvoid *) &longs) == -1) {
+	    *rcode = ncerr;
+	}
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncvarput1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* puts a single character into an open netCDF file */
+void
+nncvp1c(cdfid, varid, indices, chval, rcode, chvallen)
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    char	*chval;	
+    int		chvallen;
+    int		*rcode;	
+{
+    int datatype, ndims, natts, i;
+    long nindices[MAX_VAR_DIMS];
+    int dimid[MAX_VAR_DIMS];
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0,
+		  (nc_type *) & datatype, &ndims, dimid, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < ndims; i++)
+	nindices[i] = indices[i] - 1;
+    revlongs (nindices, ndims);
+    *rcode = 0;
+    if (ncvarput1 (*cdfid, *varid - 1, nindices, (ncvoid *) chval) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * writes a hypercube of numeric values into a netCDF variable of an open
+ * netCDF file
+ */
+void
+nncvpt(cdfid, varid, start, count, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    void	*value;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS], i;
+    int ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0, (nc_type *) & datatype,
+		  &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {	/* pack ints into bytes */
+	char *bytes = itob (value, ncount, ndims);
+	if (bytes == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarput (*cdfid, *varid - 1, nstart, ncount,
+	              (ncvoid *) bytes) == -1) {
+	    *rcode = ncerr;
+	}
+	free (bytes);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) datatype == NC_SHORT) { /* pack ints into shorts */
+	short *shorts = itos (value, ncount, ndims);
+	if (shorts == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarput (*cdfid, *varid - 1, nstart, ncount,
+		      (ncvoid *) shorts) == -1) {
+	    *rcode = ncerr;
+	}
+	free (shorts);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	long *longs = itol (value, ncount, ndims);
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarput (*cdfid, *varid - 1, nstart, ncount,
+	              (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	}
+	free (longs);
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) datatype == NC_LONG) {
+	long *longs = itol (value, ncount, ndims);
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarput (*cdfid, *varid - 1, nstart, ncount,
+	              (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	}
+	free (longs);
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncvarput (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* writes a hypercube of character values into an open netCDF file */
+void
+nncvptc(cdfid, varid, start, count, string, lenstr, rcode, stringlen)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    char	*string;	
+    int		stringlen;
+    int		*lenstr;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS], i;
+    int ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0,
+		  (nc_type *) & datatype, &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    if (dimprod(ncount,ndims) > *lenstr) {
+	*rcode = NC_ESTS;
+	handle_err ("NCVPTC", *rcode);
+	return;
+    }
+    *rcode = 0;
+    if (ncvarput (*cdfid, *varid - 1, nstart, ncount, (ncvoid *) string) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * writes a generalized hypercube of numeric values into a netCDF variable of 
+ * an open netCDF file
+ */
+void
+nncvptg(cdfid, varid, start, count, stride, basis, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    void	*value;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS], i;
+    long nstride[MAX_VAR_DIMS], nbasis[MAX_VAR_DIMS];
+    long tmpbasis;
+    int ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0, (nc_type *) & datatype,
+		  &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+#ifdef FORTRAN_HAS_NO_BYTE
+    if (datatype == NC_CHAR || datatype == NC_BYTE)
+	tmpbasis	= nctypelen(NC_LONG);
+    else
+#endif
+#ifdef FORTRAN_HAS_NO_SHORT
+    if (datatype == NC_SHORT)
+	tmpbasis	= nctypelen(NC_LONG);
+    else
+#endif
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+    if (datatype == NC_LONG)
+	tmpbasis	= sizeof(int);
+    else
+#endif
+	tmpbasis	= nctypelen(datatype);
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+	nstride[i] = stride[0] == 0 ? 1 : stride[i];
+	nbasis[i] = basis[0] == 0 ? tmpbasis : basis[i];
+	tmpbasis *= count[i];
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    revlongs (nstride, ndims);
+    revlongs (nbasis, ndims);
+
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {	/* pack ints into bytes */
+	/*
+	 * Release 2.3.1 had a bug in the following line: it used count
+	 * rather than ncount.
+	 */
+	char *bytes = itobg (value, ncount, nbasis, ndims);
+	if (bytes == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarputg (*cdfid, *varid - 1, nstart, ncount, nstride, 
+		       (long*)NULL, (ncvoid *) bytes) == -1) {
+	    *rcode = ncerr;
+	}
+	free (bytes);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) datatype == NC_SHORT) { /* pack ints into shorts */
+	/*
+	 * Release 2.3.1 had a bug in the following line: it used count
+	 * rather than ncount.
+	 */
+	short *shorts = itosg (value, ncount, nbasis, ndims);
+	if (shorts == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarputg (*cdfid, *varid - 1, nstart, ncount, nstride,
+		      (long*)NULL, (ncvoid *) shorts) == -1) {
+	    *rcode = ncerr;
+	}
+	free (shorts);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	long *longs = itolg (value, ncount, nbasis, ndims);
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarputg (*cdfid, *varid - 1, nstart, ncount, nstride,
+		      (long*)NULL, (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	}
+	free (longs);
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) datatype == NC_LONG) {
+	long *longs = itolg (value, ncount, nbasis, ndims);
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	    }
+	if (ncvarputg (*cdfid, *varid - 1, nstart, ncount, nstride,
+		      (long*)NULL, (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	}
+	free (longs);
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncvarputg (*cdfid, *varid - 1, nstart, ncount, nstride, nbasis,
+		   value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * writes a generalized hypercube of character values into a netCDF variable of 
+ * an open netCDF file
+ */
+void
+nncvpgc(cdfid, varid, start, count, stride, basis, string, rcode, stringlen)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    char	*string;	
+    int		stringlen;
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS], i;
+    long nstride[MAX_VAR_DIMS], nbasis[MAX_VAR_DIMS];
+    long tmpbasis;
+    int ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0, (nc_type *) & datatype,
+		  &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    tmpbasis	= nctypelen(datatype);
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+	nstride[i] = stride[0] == 0 ? 1 : stride[i];
+	nbasis[i] = basis[0] == 0 ? tmpbasis : basis[i];
+	tmpbasis *= count[i];
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    revlongs (nstride, ndims);
+    revlongs (nbasis, ndims);
+
+    *rcode = 0;
+    if (ncvarputg (*cdfid, *varid - 1, nstart, ncount, nstride, nbasis,
+		   (ncvoid*)string) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* gets a single numeric value from a variable of an open netCDF file */
+void
+nncvgt1(cdfid, varid, indices, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    void	*value;	
+    int		*rcode;	
+{
+    long nindices[MAX_VAR_DIMS], i;
+    int datatype, ndims, dimarray[MAX_VAR_DIMS], natts;
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0, (nc_type *) & datatype,
+		  &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < ndims; i++) {
+	nindices[i] = indices[i] - 1;
+    }
+    revlongs (nindices, ndims);
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {
+	char           bytes;
+	int            *ip = (int *) value;
+	char           *bp = &bytes;
+
+	if (ncvarget1(*cdfid, *varid - 1, nindices, (ncvoid *) &bytes) == -1) {
+	    *rcode = ncerr;
+	    return;
+	}
+	*ip = *bp;
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) datatype == NC_SHORT) {
+	short          shorts;
+	int            *ip = (int *) value;
+	short          *sp = &shorts;
+
+	if (ncvarget1(*cdfid, *varid - 1, nindices, (ncvoid *) &shorts) == -1) {
+	    *rcode = ncerr;
+	    return;
+	}
+	*ip = *sp;
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	long          longs;
+	int           *ip = (int *) value;
+
+	if (ncvarget1(*cdfid, *varid - 1, nindices, (ncvoid *) &longs) == -1) {
+	    *rcode = ncerr;
+	    return;
+	}
+	*ip = longs;
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) datatype == NC_LONG) {
+	long          longs;
+	int           *ip = (int *) value;
+
+	if (ncvarget1(*cdfid, *varid - 1, nindices, (ncvoid *) &longs) == -1) {
+	    *rcode = ncerr;
+	    return;
+	}
+	*ip = longs;
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncvarget1 (*cdfid, *varid - 1, nindices, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets a single character data value from a variable of an open
+ * netCDF file
+ */
+void
+nncvg1c(cdfid, varid, indices, chval, rcode, chvallen)
+    int		*cdfid;	
+    int		*varid;	
+    int		*indices;	
+    char	*chval;	
+    int		chvallen;
+    int		*rcode;	
+{
+    long nindices[MAX_VAR_DIMS];
+    int i, datatype, ndims, dimarray[MAX_VAR_DIMS], natts;
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0,
+		  (nc_type *) & datatype, &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+
+    for (i = 0; i < ndims; i++) {
+	nindices[i] = indices[i] - 1;
+    }
+    revlongs (nindices, ndims);
+    *rcode = 0;
+    if (ncvarget1 (*cdfid, *varid - 1, nindices, (ncvoid *) chval) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * reads a hypercube of numeric values from a netCDF variable of an open
+ * netCDF file
+ */
+void
+nncvgt(cdfid, varid, start, count, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    void	*value;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS];
+    int i, ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0, (nc_type *) & datatype,
+		  &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+	char *bytes = (char *) malloc (iocount * sizeof (char));
+	int *ip;
+	char *bp = bytes;
+
+	if (bytes == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvarget (*cdfid, *varid - 1, nstart, ncount,
+		      (ncvoid *) bytes) == -1) {
+	    *rcode = ncerr;
+	    free (bytes);
+	    return;
+	}
+	for (ip = (int *) value; iocount > 0; iocount--)
+	  *ip++ = *bp++;
+	free (bytes);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) datatype == NC_SHORT) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+	short *shorts = (short *) malloc (iocount * sizeof (short));
+	int *ip;
+	short *sp = shorts;
+
+	if (shorts == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvarget (*cdfid, *varid - 1, nstart, ncount,
+		      (ncvoid *) shorts) == -1) {
+	    *rcode = ncerr;
+	    free (shorts);
+	    return;
+	}
+	for (ip = (int *) value; iocount > 0; iocount--)
+	    *ip++ = *sp++;
+	free (shorts);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+/* EIP   We need int buffer to read data in on the platforms where long is 8 bytes
+	long *longs = (long *) malloc (iocount * sizeof (long));
+	int *ip;
+	long *lp = longs;
+*/
+	int *longs = (int *) malloc (iocount * sizeof (int));
+	int *ip;
+	int *lp = longs;
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvarget (*cdfid, *varid - 1, nstart, ncount,
+		      (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	    free (longs);
+	    return;
+	}
+	for (ip = (int *) value; iocount > 0; iocount--)
+	    *ip++ = *lp++;
+	free (longs);
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) datatype == NC_LONG) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+	long *longs = (long *) malloc (iocount * sizeof (long));
+	int *ip;
+	long *lp = longs;
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvarget (*cdfid, *varid - 1, nstart, ncount,
+		      (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	    free (longs);
+	    return;
+	}
+	for (ip = (int *) value; iocount > 0; iocount--)
+	    *ip++ = *lp++;
+	free (longs);
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncvarget (*cdfid, *varid - 1, nstart, ncount, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* reads a hypercube of character values from a netCDF variable */
+void
+nncvgtc(cdfid, varid, start, count, string, lenstr, rcode, stringlen)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    char	*string;	
+    int		stringlen;
+    int		*lenstr;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS];
+    int i, ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+    int prod = 1;
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0,
+		  (nc_type *) & datatype, &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+	prod *= count[i];
+    }
+    if (prod > *lenstr) {
+	*rcode = NC_ESTS;
+	handle_err ("NCVGTC", *rcode);
+	return;
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    *rcode = 0;
+    if (ncvarget (*cdfid, *varid - 1, nstart, ncount, (ncvoid *) string) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+
+    for (i = prod; i < *lenstr; i++)
+	string[i] = ' ';
+}
+
+/*
+ * reads a generalized hypercube of numeric values from a netCDF variable of an 
+ * open netCDF file
+ */
+void
+nncvgtg(cdfid, varid, start, count, stride, basis, value, rcode)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    void	*value;	
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS];
+    long nstride[MAX_VAR_DIMS], nbasis[MAX_VAR_DIMS];
+    long tmpbasis;
+    int i, ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0, (nc_type *) & datatype,
+		  &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+#ifdef FORTRAN_HAS_NO_BYTE
+    if (datatype == NC_CHAR || datatype == NC_BYTE)
+	tmpbasis	= nctypelen(NC_LONG);
+    else
+#endif
+#ifdef FORTRAN_HAS_NO_SHORT
+    if (datatype == NC_SHORT)
+	tmpbasis	= nctypelen(NC_LONG);
+    else
+#endif
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+    if (datatype == NC_LONG)
+	tmpbasis	= sizeof(int);
+    else
+#endif
+	tmpbasis	= nctypelen(datatype);
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+	nstride[i] = stride[0] == 0 ? 1 : stride[i];
+	nbasis[i] = basis[0] == 0 ? tmpbasis : basis[i];
+	tmpbasis *= count[i];
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    revlongs (nstride, ndims);
+    revlongs (nbasis, ndims);
+
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+	char *bytes = (char *) malloc (iocount * sizeof (char));
+	int *ip;
+	char *bp = bytes;
+
+	if (bytes == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvargetg (*cdfid, *varid - 1, nstart, ncount, nstride,
+		      (long*)NULL, (ncvoid *) bytes) == -1) {
+	    *rcode = ncerr;
+	    free (bytes);
+	    return;
+	}
+	/*
+	 * Release 2.3.1 had a bug in the following line: it used basis
+	 * rather than nbasis.
+	 */
+	btoig(bytes, (int*)value, ncount, nbasis, ndims);
+	free (bytes);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) datatype == NC_SHORT) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+	short *shorts = (short *) malloc (iocount * sizeof (short));
+	int *ip;
+	short *sp = shorts;
+
+	if (shorts == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvargetg (*cdfid, *varid - 1, nstart, ncount, nstride, 
+		       (long*)NULL, (ncvoid *) shorts) == -1) {
+	    *rcode = ncerr;
+	    free (shorts);
+	    return;
+	}
+	/*
+	 * Release 2.3.1 had a bug in the following line: it used basis
+	 * rather than nbasis.
+	 */
+	stoig(shorts, (int*)value, ncount, nbasis, ndims);
+	free (shorts);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+	long *longs = (long *) malloc (iocount * sizeof (long));
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvargetg (*cdfid, *varid - 1, nstart, ncount, nstride, 
+		       (long*)NULL, (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	    free (longs);
+	    return;
+	}
+	ltoig(longs, (int*)value, ncount, nbasis, ndims);
+	free (longs);
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) datatype == NC_LONG) {
+	long iocount = dimprod (ncount, ndims);	/* product of dimensions */
+	long *longs = (long *) malloc (iocount * sizeof (long));
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncvargetg (*cdfid, *varid - 1, nstart, ncount, nstride, 
+		       (long*)NULL, (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	    free (longs);
+	    return;
+	}
+	ltoig(longs, (int*)value, ncount, nbasis, ndims);
+	free (longs);
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncvargetg (*cdfid, *varid - 1, nstart, ncount, nstride,
+		   nbasis, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * reads a generalized hypercube of character values from a netCDF variable 
+ * of an open netCDF file
+ */
+void
+nncvggc(cdfid, varid, start, count, stride, basis, string, rcode, stringlen)
+    int		*cdfid;	
+    int		*varid;	
+    int		*start;	
+    int		*count;	
+    int		*stride;	
+    int		*basis;	
+    char	*string;	
+    int		stringlen;
+    int		*rcode;	
+{
+    long ncount[MAX_VAR_DIMS], nstart[MAX_VAR_DIMS];
+    long nstride[MAX_VAR_DIMS], nbasis[MAX_VAR_DIMS];
+    long tmpbasis;
+    int i, ndims, datatype, dimarray[MAX_VAR_DIMS], natts;
+
+    if (ncvarinq (*cdfid, *varid - 1, (char *) 0, (nc_type *) & datatype,
+		  &ndims, dimarray, &natts) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    tmpbasis	= nctypelen(datatype);
+    for (i = 0; i < ndims; i++) {
+	ncount[i] = count[i];
+	nstart[i] = start[i] - 1;
+	nstride[i] = stride[0] == 0 ? 1 : stride[i];
+	nbasis[i] = basis[0] == 0 ? tmpbasis : basis[i];
+	tmpbasis *= count[i];
+    }
+    revlongs (ncount, ndims);
+    revlongs (nstart, ndims);
+    revlongs (nstride, ndims);
+    revlongs (nbasis, ndims);
+
+    *rcode = 0;
+    if (ncvargetg (*cdfid, *varid - 1, nstart, ncount, nstride,
+		   nbasis, (ncvoid*)string) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/* changes the name of a netCDF variable in an open netCDF file */
+void
+nncvren(cdfid, varid, varname, rcode, varnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*varname;	
+    int		varnamelen;
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+
+    nstrncpy (name, varname, varnamelen);
+    *rcode = 0;
+    if (ncvarrename (*cdfid, *varid - 1, name) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * adds or changes a numeric variable or global attribute of an open
+ * netCDF file
+ */
+void
+nncapt(cdfid, varid, attname, datatype, attlen, value, rcode, attnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*attname;	
+    int		attnamelen;
+    int		*datatype;	
+    int		*attlen;	
+    void	*value;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    nstrncpy (name, attname, attnamelen);
+
+    *rcode = 0;
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) *datatype == NC_BYTE) {	/* pack ints into bytes */
+	char *bytes = itob (value, attlen, 1);
+
+	if (bytes == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattput (*cdfid, *varid - 1, name, (nc_type) *datatype, *attlen,
+		      (ncvoid *) bytes) == -1) {
+	    *rcode = ncerr;
+	}
+	free (bytes);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) *datatype == NC_SHORT) {	/* pack ints into shorts */
+	short *shorts = itos (value, attlen, 1);
+
+	if (shorts == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattput (*cdfid, *varid - 1, name, (nc_type) *datatype, *attlen,
+		      (ncvoid *) shorts) == -1) {
+	    *rcode = ncerr;
+	}
+	free (shorts);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) *datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+	long *longs = itol (value, attlen, 1);
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattput (*cdfid, *varid - 1, name, (nc_type) *datatype, *attlen,
+		      (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	}
+	free (longs);
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) *datatype == NC_LONG) {
+	long *longs = itol (value, attlen, 1);
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattput (*cdfid, *varid - 1, name, (nc_type) *datatype, *attlen,
+		      (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	}
+	free (longs);
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncattput (*cdfid, *varid - 1, name, (nc_type) *datatype, *attlen,
+		  value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * adds or changes a character variable or global attribute
+ * of an open netCDF file
+ */
+void
+nncaptc(cdfid, varid, attname, datatype, lenstr, string, rcode, attnamelen, stringlen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*attname;	
+    int		attnamelen;
+    int		*datatype;	
+    int		*lenstr;	
+    char	*string;	
+    int		stringlen;
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    char *value;
+
+    nstrncpy (name, attname, attnamelen);
+    if (((value = malloc ((unsigned) *lenstr + 1)) == NULL) || (*lenstr == 0)) {
+	*rcode = NC_ESTS;
+	handle_err ("NCAPTC", *rcode);
+	return;
+    }
+    (void) fstrncpy (value, string, *lenstr);
+    *rcode = 0;
+    if (ncattput (*cdfid, *varid - 1, name, (nc_type) *datatype, *lenstr,
+		  (ncvoid *) value) == -1) {
+	*rcode = ncerr;
+    }
+    free (value);
+}
+
+/*
+ * returns information about a netCDF attribute given its variable
+ * ID and name
+ */
+void
+nncainq(cdfid, varid, attname, datatype, attlen, rcode, attnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*attname;	
+    int		attnamelen;
+    int		*datatype;	
+    int		*attlen;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+
+    nstrncpy (name, attname, attnamelen);
+    *rcode = 0;
+    if (ncattinq (*cdfid, *varid - 1, name, (nc_type *) datatype, attlen) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets the value of a netCDF attribute given its variable ID
+ * and name
+ */
+void
+nncagt(cdfid, varid, attname, value, rcode, attnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*attname;	
+    int		attnamelen;
+    void	*value;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    int datatype;
+    int attlen;
+#ifdef HDF
+    NC *handle=NC_check_id(*cdfid);
+#endif /* HDF */
+
+    nstrncpy (name, attname, attnamelen);
+    *rcode = 0;
+    if (ncattinq (*cdfid, *varid - 1, name, (nc_type *) &datatype, &attlen)
+	    == -1) {
+	*rcode = ncerr;
+	return;
+    }
+#ifdef FORTRAN_HAS_NO_BYTE
+    if ((nc_type) datatype == NC_BYTE) {
+	char *bytes = (char *) malloc (attlen);
+	int *ip;
+	char *bp = bytes;
+
+	if (bytes == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattget (*cdfid, *varid - 1, name, (ncvoid *) bytes) == -1) {
+	    *rcode = ncerr;
+	    free (bytes);
+	    return;
+	}
+	for (ip = (int *) value; attlen > 0; attlen--)
+	    *ip++ = *bp++;
+	free (bytes);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_BYTE */
+#ifdef FORTRAN_HAS_NO_SHORT
+    if ((nc_type) datatype == NC_SHORT) {
+	short *shorts = (short *) malloc (attlen * sizeof (short));
+	int *ip;
+	short *sp = shorts;
+
+	if (shorts == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattget (*cdfid, *varid - 1, name, (ncvoid *) shorts) == -1) {
+	    *rcode = ncerr;
+	    free (shorts);
+	    return;
+	}
+	for (ip = (int *) value; attlen > 0; attlen--)
+	    *ip++ = *sp++;
+	free (shorts);
+	return;
+    }				/* else */
+#endif				/* FORTRAN_HAS_NO_SHORT */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__
+#ifdef HDF
+    if ((nc_type) datatype == NC_LONG && handle->file_type!=HDF_FILE) {
+/* EIP  We need to use int buffer to read data in on the platforms where long is 8 bytes
+	long *longs = (long *) malloc (attlen * sizeof (long));
+	int *ip;
+	long *lp = longs;
+*/
+	int *longs = (int *) malloc (attlen * sizeof (int));
+	int *ip;
+	int *lp = longs;
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattget (*cdfid, *varid - 1, name, (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	    free (longs);
+	    return;
+	}
+	for (ip = (int *) value; attlen > 0; attlen--)
+	    *ip++ = *lp++;
+	free (longs);
+	return;
+    }				/* else */
+#else /* HDF */
+    if ((nc_type) datatype == NC_LONG) {
+	long *longs = (long *) malloc (attlen * sizeof (long));
+	int *ip;
+	long *lp = longs;
+
+	if (longs == NULL) {
+	    *rcode = NC_SYSERR;
+	    return;
+	}
+	if (ncattget (*cdfid, *varid - 1, name, (ncvoid *) longs) == -1) {
+	    *rcode = ncerr;
+	    free (longs);
+	    return;
+	}
+	for (ip = (int *) value; attlen > 0; attlen--)
+	    *ip++ = *lp++;
+	free (longs);
+	return;
+    }				/* else */
+#endif /* HDF */
+#endif
+    if (ncattget (*cdfid, *varid - 1, name, value) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets the value of a netCDF character attribute given its variable
+ * ID and name
+ */
+void
+nncagtc(cdfid, varid, attname, string, lenstr, rcode, attnamelen, stringlen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*attname;	
+    int		attnamelen;
+    char	*string;	
+    int		stringlen;
+    int		*lenstr;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+    int datatype;
+    int attlen;
+    int i;
+
+    nstrncpy (name, attname, attnamelen);
+    *rcode = 0;
+    if (ncattinq (*cdfid, *varid - 1, name, (nc_type *) &datatype, &attlen) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    if (attlen > *lenstr) {
+	*rcode = NC_ESTS;
+	handle_err ("NCAGTC", *rcode);
+	return;
+    }
+    if (ncattget (*cdfid, *varid - 1, name, (ncvoid *) string) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+
+    for (i = attlen; i < *lenstr; i++)
+	string[i] = ' ';
+}
+
+/* copies an attribute from one open netCDF file to another */
+void
+nncacpy(incdfid, invarid, attname, outcdfid, outvarid, rcode, attnamelen)
+    int		*incdfid;	
+    int		*invarid;	
+    char	*attname;	
+    int		attnamelen;
+    int		*outcdfid;	
+    int		*outvarid;	
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+
+    nstrncpy (name, attname, attnamelen);
+    *rcode = 0;
+    if (ncattcopy (*incdfid, *invarid - 1, name,
+		   *outcdfid, *outvarid - 1) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * gets the name of an attribute given its variable ID and number
+ * as an attribute of that variable
+ */
+void
+nncanam(cdfid, varid, attnum, attname, rcode, attnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    int		*attnum;	
+    char	*attname;	
+    int		attnamelen;
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+
+    *rcode = 0;
+    if (ncattname (*cdfid, *varid - 1, *attnum - 1, name) == -1) {
+	*rcode = ncerr;
+	return;
+    }
+    if (strlen (name) > attnamelen) {
+	*rcode = NC_ESTS;
+	handle_err ("NCANAM", *rcode);
+	return;
+    }
+    fcdcpy (attname, attnamelen, name);
+}
+
+
+/* renames an attribute in an open netCDF file */
+void
+nncaren(cdfid, varid, attname, newname, rcode, attnamelen, newnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*attname;	
+    int		attnamelen;
+    char	*newname;	
+    int		newnamelen;
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1], nname[MAX_NC_NAME + 1];
+
+    nstrncpy (name, attname, attnamelen);
+    nstrncpy (nname, newname, newnamelen);
+    *rcode = 0;
+    if (ncattrename (*cdfid, *varid - 1, name, nname) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+/*
+ * deletes an attribute from an open netCDF file given the attribute
+ * name
+ */
+void
+nncadel(cdfid, varid, attname, rcode, attnamelen)
+    int		*cdfid;	
+    int		*varid;	
+    char	*attname;	
+    int		attnamelen;
+    int		*rcode;	
+{
+    char name[MAX_NC_NAME + 1];
+
+    nstrncpy (name, attname, attnamelen);
+    *rcode = 0;
+    if (ncattdel (*cdfid, *varid - 1, name) == -1) {
+	*rcode = ncerr;
+    }
+}
+
+
+/*
+ * sets the fill mode of a netCDF file open for writing
+ */
+int
+nncsfil(cdfid, fillmode, rcode)
+    int		*cdfid;	
+    int		*fillmode;	
+    int		*rcode;	
+{
+    int retval;
+
+    if ((retval = ncsetfill (*cdfid, *fillmode)) != -1) {
+	*rcode = 0;
+	return retval;
+    }
+    *rcode = ncerr;
+    return (-1);
+}
+
diff --git a/mfhdf/fortran/mffunc.inc b/mfhdf/fortran/mffunc.inc
new file mode 100644
index 0000000..506f015
--- /dev/null
+++ b/mfhdf/fortran/mffunc.inc
@@ -0,0 +1,134 @@
+C
+C       Decls of SFxxx functions for Fortran multi-file interface
+C
+      integer  sfstart
+      external sfstart
+      integer  sfn2index
+      external sfn2index
+      integer  sfcreate
+      external sfcreate
+      integer  sfsdmstr
+      external sfsdmstr
+      integer  sfsdmname
+      external sfsdmname
+      integer  sfsdtstr
+      external sfsdtstr
+      integer  sfgdtstr
+      external sfgdtstr
+      integer  sfgdmstr
+      external sfgdmstr
+      integer  sfginfo
+      external sfginfo
+      integer  sfgainfo
+      external sfgainfo
+      integer  sfgdinfo
+      external sfgdinfo
+      integer  sfsattr
+      external sfsattr
+      integer  sfsnatt
+      external sfscatt
+      integer  sfscatt
+      integer  sffattr
+      external sffattr
+      integer  sfend
+      external sfend
+      integer  sfendacc
+      external sfendacc
+      integer  sffinfo
+      external sffinfo
+      integer  sfselect
+      external sfselect
+      integer  sfdimid
+      external sfdimid
+      integer  sfgcal
+      external sfgcal
+      integer  sfscal
+      external sfscal
+      integer  sfsdscale
+      external sfsdscale
+      integer  sfgdscale
+      external sfgdscale
+      integer  sfsfill
+      external sfsfill
+      integer  sfgfill
+      external sfgfill
+      integer  sfgrange
+      external sfgrange
+      integer  sfsrange
+      external sfsrange
+      integer  sfrattr
+      external sfrattr
+      integer  sfrnatt
+      external sfrcatt
+      integer  sfrcatt
+      integer  sfrdata
+      external sfrdata
+      integer  sfwdata
+      external sfwdata
+      integer  sfsextf
+      external sfsextf
+      integer  sfsnbit
+      external sfsnbit
+      integer  sfsacct
+      external sfsacct
+      integer  sfid2ref
+      external sfid2ref
+      integer  sfiscvar
+      external sfiscvar
+      integer  sfref2index
+      external sfref2index
+      integer  sfsdmvc
+      external sfsdmvc
+      integer  sfisdmvc
+      external sfisdmvc
+      integer  sfgichnk
+      external sfgichnk
+      integer  sfrcchnk
+      external sfrcchnk
+      integer  sfrchnk
+      external sfrchnk
+      integer  sfwcchnk
+      external sfwcchnk
+      integer  sfwchnk
+      external sfwchnk
+      integer  sfscchnk
+      external sfscchnk
+      integer  sfschnk
+      external sfschnk
+      integer  sfscompress
+      external sfscompress
+      integer  sfgcompress
+      external sfgcompress
+      integer  sfisrcrd
+      external sfisrcrd
+      integer  sfsblsz
+      external sfsblsz
+      integer  sfchempty
+      external sfchempty
+      integer  sfwcdata
+      external sfwcdata
+      integer  sfrcdata
+      external sfrcdata
+      integer  sfgcfill
+      external sfgcfill
+      integer  sfscfill
+      external sfscfill
+      integer  sfsflmd
+      external sfsflmd
+      integer  sfgetfname
+      external sfgetfname
+      integer  sfgetnamelen
+      external sfgetnamelen
+      integer  sfidtype
+      external sfidtype
+      integer  sfgnvars_byname
+      external sfgnvars_byname
+      integer  sfn2indices
+      external sfn2indices
+      integer  sfgmaxopenf
+      external sfgmaxopenf
+      integer  sfgnumopenf
+      external sfgnumopenf
+      integer  sfrmaxopenf
+      external sfrmaxopenf
+      
diff --git a/mfhdf/fortran/mfhdf_fortrandll.def b/mfhdf/fortran/mfhdf_fortrandll.def
new file mode 100644
index 0000000..ade0d25
--- /dev/null
+++ b/mfhdf/fortran/mfhdf_fortrandll.def
@@ -0,0 +1,71 @@
+EXPORTS
+
+; MFSDFF
+SFRMAXOPENF
+SFGNUMOPENF
+SFGMAXOPENF
+SFN2INDICES
+SFGNVARS_BYNAME
+SFIDTYPE
+SFGETNAMELEN
+SFGETFNAME
+SFCHEMPTY
+SFGCOMPRESS
+SFSCOMPRESS
+SFWCHNK
+SFWCCHNK
+SFSCHNK
+SFSCCHNK
+SFRCHNK
+SFRCCHNK
+SFGICHNK
+SFSEXTF
+SFFATTR
+SFSATTR
+SFSNATT
+SFSCATT
+SFGDINFO
+SFGAINFO
+SFGINFO
+SFGDMSTR
+SFGDTSTR
+SFSDTSTR
+SFSDMNAME
+SFSDMSTR
+SFCREATE
+SFN2INDEX
+SFSTART
+SCRMAXOPENF
+SCGNUMOPENF
+SCGMAXOPENF
+SCN2INDICES
+SCGNVARS_BYNAME
+SCIDTYPE
+SCGETNAMELEN
+SCGETFNAME
+SCCHEMPTY
+SCGCOMPRESS
+SCSCOMPRESS
+SCWCHNK
+SCWCCHNK
+SCSCHNK
+SCSCCHNK
+SCRCHNK
+SCRCCHNK
+SCGICHNK
+SCSEXTF
+SCFATTR
+SCSATTR
+SCSNATT
+SCSCATT
+SCGDINFO
+SCGAINFO
+SCGINFO
+SCGDIMSTRS
+SCGDATSTRS
+SCSDATSTR
+SCSDIMNAME
+SCSDIMSTR
+SCCREATE
+SCN2INDEX
+SCSTART
diff --git a/mfhdf/fortran/mfsdf.c b/mfhdf/fortran/mfsdf.c
new file mode 100644
index 0000000..8afe570
--- /dev/null
+++ b/mfhdf/fortran/mfsdf.c
@@ -0,0 +1,3074 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*  Copyright by The HDF Group.                                               *
+*  Copyright by the Board of Trustees of the University of Illinois.         *
+*  All rights reserved.                                                      *
+*                                                                            *
+*  This file is part of HDF.  The full HDF 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      *
+*  http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+*  access to either file, you may request a copy from help at hdfgroup.org.     *
+* * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6036 $";
+#endif
+
+/* $Id: mfsdf.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+/*
+
+  This file contains the HDF-style C stubs for the multi-file SDS
+  interface.
+
+  The basic routines called by fortran will be of the form sfxxxx
+
+  If only a C stub is needed it will be named nsfxxxx have the FNAME()
+  function applied to it.
+
+  If a Fortran stub is also required the fortran stub will be called
+  sfxxxx and the one in here will be nscxxx and again be FNAME()ed
+
+*/
+#include "mfsdf.h"
+
+#ifdef HDF
+
+#ifdef PROTOTYPE
+FRETVAL(intf) nsfscfill(intf *id, _fcd val);
+FRETVAL(intf) nsfsfill(intf *id, VOIDP val);
+FRETVAL(intf) nsfgfill(intf *id, VOIDP val);
+FRETVAL(intf) nsfrnatt(intf *id, intf *index, VOIDP buf);
+FRETVAL(intf) nscsnatt(intf *id, _fcd name, intf *nt, intf *count, VOIDP data, intf *len);
+FRETVAL(intf) nsfsflmd(intf *id, intf *fillmode);
+#else
+FRETVAL(intf) nsfscfill();
+FRETVAL(intf) nsfsfill();
+FRETVAL(intf) nsfgfill();
+FRETVAL(intf) nsfrnatt();
+FRETVAL(intf) nscsnatt();
+FRETVAL(intf) nsfsflmd();
+#endif /* PROTOTYPE */
+
+#if defined _WIN32 && !defined CMAKE_INTDIR
+
+/*-----------------------------------------------------------------------------
+ * Name:    scend
+ * Purpose: Call SDend close to close HDF file
+ * Inputs:  file_id: handle to HDF file to close
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscend(intf *file_id)
+#else
+nscend(file_id)
+    intf *file_id;
+#endif /* PROTOTYPE */
+{
+    return(SDend(*file_id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scendacc
+ * Purpose: Call SDendaccess close to end access on a dataset 
+ * Inputs:  id: id of the data set
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscendacc(intf *id)
+#else
+nscendacc(id)
+    intf *id;
+#endif /* PROTOTYPE */
+{
+    return(SDendaccess(*id));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scfinfo
+ * Purpose: Call SDfileinfo to get number of datasets and global attrs in the file
+ * Inputs:  file_id: handle to HDF file
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscfinfo(intf *file_id, intf *datasets, intf *gattr)
+#else
+nscfinfo(file_id, datasets, gattr)
+     intf *file_id;
+     intf *datasets;
+     intf *gattr;
+#endif /* PROTOTYPE */
+{
+  int32 dset, nattr, status;
+
+  status = SDfileinfo((int32) *file_id, &dset, &nattr);
+
+  *datasets = (intf) dset;
+  *gattr    = (intf) nattr;
+
+  return (status);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scselct
+ * Purpose: Call SDselect to return a handle to a data set in the given file
+ * Inputs:  file_id: handle to HDF file
+ *          index:   number of data set to chose
+ * Returns: sdsid on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscselct(intf *file_id, intf *index)
+#else
+nscselct(file_id, index)
+     intf *file_id;
+     intf *index;
+#endif /* PROTOTYPE */
+{
+    return(SDselect(*file_id, *index));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scdimid
+ * Purpose: Get an id for a dimension of a given data set
+ * Inputs:  id: handle to a data set
+ *          index: number of dimension to chose
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscdimid(intf *id, intf *index)
+#else
+nscdimid(id, index)
+     intf *id;
+     intf *index;
+#endif /* PROTOTYPE */
+{
+    int32 rank, nt, dims[100], status, cdim, nattrs;
+
+    status = SDgetinfo(*id, NULL, &rank, dims, &nt, &nattrs);
+    if(status == FAIL) return FAIL;
+    cdim = rank - (*index) -1;
+
+    return(SDgetdimid(*id, cdim));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scgcal
+ * Purpose: Call SDgetcal to get the calibration information
+ * Inputs:  id: handle to a data set
+ * Outputs: cal, cale, ioff, ioffe : calibration factors and error
+ *          nt: number type of data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt)
+#else
+nscgcal(id, cal, cale, ioff, ioffe, nt)
+     intf *id;
+     float64 *cal, *cale, *ioff, *ioffe;
+     intf *nt;
+#endif /* PROTOTYPE */
+{
+  int32 nt32, status;
+  
+  status = SDgetcal((int32) *id, cal, cale, ioff, ioffe, &nt32);
+  
+  *nt = (intf) nt32;
+
+  return (status);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scscal
+ * Purpose: Call SDsetcal to set the calibration information
+ * Inputs:  id: handle to a data set
+ *          cal, cale, ioff, ioffe : calibration factors and error
+ *          nt: number type of data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt)
+#else
+nscscal(id, cal, cale, ioff, ioffe, nt)
+     intf *id;
+     float64 *cal, *cale, *ioff, *ioffe;
+     intf *nt;
+#endif /* PROTOTYPE */
+{
+    return(SDsetcal(*id, *cal, *cale, *ioff, *ioffe, *nt));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsdscale
+ * Purpose: Call SDsetdimscale to set the values for a dimension
+ * Inputs:  id: handle to a dimension
+ *          count: size of the dimension
+ *          nt: number type of data
+ *          values: data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsdscale(intf *id, intf *count, intf *nt, VOIDP values)
+#else
+nscsdscale(id, count, nt, values)
+     intf *id;
+     intf *count, *nt;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    return(SDsetdimscale(*id, *count, *nt, values));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scgdscale
+ * Purpose: Call SDgetdimscale to get the values for a dimension
+ * Inputs:  id: handle to a dimension
+ * Output   values: data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgdscale(intf *id, VOIDP values)
+#else
+nscgdscale(id, values)
+     intf *id;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    return(SDgetdimscale(*id, values));
+}
+
+/*----------------------------------------------------------
+ * Name:    scscfill
+ * Purpose: Call nsfsnfill to set the char fill value
+ * Inputs:  id: handle to a dimension
+ *          val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *----------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscscfill(intf *id, _fcd val)
+#else
+nscscfill(id, val)
+     intf *id;
+     _fcd val;
+#endif /* PROTOTYPE */
+{
+    return(nscsfill(id, (VOIDP) _fcdtocp(val)));
+}
+
+/*------------------------------------------------------------
+ * Name:    scgcfill
+ * Purpose: Call sfgfill to get the char fill value
+ * Inputs:  id: handle to a dimension
+ * Output:  val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *-----------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgcfill(intf *id, _fcd val)
+#else
+nscgcfill(id, val)
+     intf *id;
+     _fcd val;
+#endif /* PROTOTYPE */
+{
+    return(nscgfill(id, (VOIDP) _fcdtocp(val)));
+}
+
+/*---------------------------------------------------------
+ * Name:    scsfill
+ * Purpose: Call SDsetfillvalue to set the numeric fill value
+ * Inputs:  id: handle to a dimension
+ *          val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsfill(intf *id, VOIDP val)
+#else
+nscsfill(id, val)
+     intf *id;
+     VOIDP val;
+#endif /* PROTOTYPE */
+{
+    return(SDsetfillvalue(*id, val));
+}
+
+/*----------------------------------------------------------
+ * Name:    scgfill
+ * Purpose: Call SDgetfillvalue to get the fill value. 
+ * Inputs:  id: handle to a dimension
+ * Output:  val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgfill(intf *id, VOIDP val)
+#else
+nscgfill(id, val)
+     intf *id;
+     VOIDP val;
+#endif /* PROTOTYPE */
+{
+    return(SDgetfillvalue(*id, val));
+}
+
+/*------------------------------------------------------------
+ * Name:    scgrange
+ * Purpose: Call SDgetrange to get the valid range info
+ * Inputs:  id: handle to a dataset
+ * Output:  min: the min
+ *          max: the max
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgrange(intf *id, VOIDP max, VOIDP min)
+#else
+nscgrange(id, max, min)
+     intf *id;
+     VOIDP max;
+     VOIDP min;
+#endif /* PROTOTYPE */
+{
+    return(SDgetrange(*id, max, min));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsrange
+ * Purpose: Call SDsetrange to set the valid range info
+ * Inputs:  id: handle to a dataset
+ *          min: the min
+ *          max: the max
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsrange(intf *id, VOIDP max, VOIDP min)
+#else
+nscsrange(id, max, min)
+     intf *id;
+     VOIDP max;
+     VOIDP min;
+#endif /* PROTOTYPE */
+{
+    return(SDsetrange(*id, max, min));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scrcatt
+ * Purpose: Call sfrnatt to get the contents of a char attribute
+ * Inputs:  id: handle to a dataset
+ *          index: index of the attribute to read
+ *          buf: space to hold info
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscrcatt(intf *id, intf *index, _fcd buf)
+#else
+nscrcatt(id, index, buf)
+     intf *id;
+     intf *index;
+     _fcd buf;
+#endif /* PROTOTYPE */
+{
+    return(nscrnatt(id, index, (VOIDP) _fcdtocp(buf)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scrnatt
+ * Purpose: Call SDreadattr to get the contents of a numeric attribute
+ * Inputs:  id: handle to a dataset
+ *          index: index of the attribute to read
+ *          buf: space to hold info
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscrnatt(intf *id, intf *index, VOIDP buf)
+#else
+nscrnatt(id, index, buf)
+     intf *id;
+     intf *index;
+     VOIDP buf;
+#endif /* PROTOTYPE */
+{
+    return(SDreadattr(*id, *index, buf));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scrattr
+ * Purpose: Call SDreadattr to get the contents of an attribute
+ * Inputs:  id: handle to a dataset
+ *          index: index of the attribute to read
+ *          buf: space to hold info
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscrattr(intf *id, intf *index, VOIDP buf)
+#else
+nscrattr(id, index, buf)
+     intf *id;
+     intf *index;
+     VOIDP buf;
+#endif /* PROTOTYPE */
+{
+    return(nscrnatt(id, index, buf));
+}
+
+/*------------------------------------------------------------
+ * Name:    scrdata
+ * Purpose: read a section of numeric data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to read
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *----------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscrdata(intf *id, intf *start, intf *stride, intf *end, VOIDP values)
+#else
+nscrdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    intf    ret;
+    int32   i, rank, dims[100], nt, nattrs, status;
+    int32   cstart[100], cstride[100], cend[100];
+    int     nostride;
+    
+    status = SDgetinfo(*id, NULL, &rank, dims, &nt, &nattrs);
+    if(status == FAIL) return FAIL;
+
+    nostride = TRUE;
+
+    for(i = 0; i < rank; i++) {
+        cstart[i] = start[rank - i - 1];
+        cend[i]   = end[rank - i - 1];
+        if((cstride[i] = stride[rank - i - 1]) != 1) nostride = FALSE;
+    }
+    
+    ret = (intf) SDreaddata(*id, cstart, (nostride? NULL : cstride), cend, values);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scwdata
+ * Purpose: write a section of data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to write
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscwdata(intf *id, intf *start, intf *stride, intf *end, VOIDP values)
+#else
+nscwdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    intf    ret;
+    int32   i, rank, dims[100], nt, nattrs, status;
+    int32   cstart[100], cstride[100], cend[100];
+    intn    nostride;
+    
+    status = SDgetinfo(*id, NULL, &rank, dims, &nt, &nattrs);
+    if(status == FAIL) return FAIL;
+
+    nostride = TRUE;
+
+    for(i = 0; i < rank; i++) {
+        cstart[i] = start[rank - i - 1];
+        cend[i]   = end[rank - i - 1];
+        if((cstride[i] = stride[rank - i - 1]) != 1) nostride = FALSE;
+    }
+
+    ret = (intf) SDwritedata(*id, cstart, (nostride? NULL : cstride), cend, values);
+    return(ret);
+}
+
+/*--------------------------------------------------------
+ * Name:    scrcdata
+ * Purpose: read a section of char data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to read
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values)
+#else
+nscrcdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     _fcd values;
+#endif /* PROTOTYPE */
+{
+     return(nscrdata(id, start, stride, end, (VOIDP) _fcdtocp(values)));
+}
+
+/*--------------------------------------------------------
+ * Name:    scwcdata
+ * Purpose: write a section of char data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to read
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values)
+#else
+nscwcdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     _fcd values;
+#endif /* PROTOTYPE */
+{
+     return(nscwdata(id, start, stride, end, (VOIDP) _fcdtocp(values)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scid2ref
+ * Purpose: call SDidtoref to map an id to ref
+ * Inputs:  id: variable id
+ * Returns: reference number of a NDG representing this dataset
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscid2ref(intf *id)
+#else
+nscid2ref(id)
+    intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDidtoref(*id));
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    scfr2idx
+ * Purpose: call SDreftoindex to map a reference number to an index of a 
+ *          dataset
+ * Inputs:  id: file id
+ *          ref: reference number to look up
+ * Returns: index of a NDG representing this dataset
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscr2idx(intf *id, intf *ref)
+#else
+nscr2idx(id, ref)
+     intf *id;
+     intf *ref;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDreftoindex(*id, (int32) *ref));
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    sciscvar
+ * Purpose: call SDiscoordvar to see if a dataset is a coordinate variable
+ *          dataset
+ * Inputs:  id: sds id
+ * Returns: TRUE/FALSE
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsciscvar(intf *id)
+#else
+nsciscvar(id)
+     intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDiscoordvar(*id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsnbit
+ * Purpose: store data in n-bit data element
+ * Inputs:  id: sds id
+ *          start_bit: starting bit offset
+ *          bit_len: # of bits to write
+ *          sign_ext: whether to use the top bit as a sign extender
+ *          fill_one: whether to fill the "background bits" with ones
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_one)
+#else
+nscsnbit(id, start_bit, bit_len, sign_ext, fill_one)
+     intf *id;
+     intf *start_bit;
+     intf *bit_len;
+     intf *sign_ext;
+     intf *fill_one;
+#endif /* PROTOTYPE */
+{
+    return((intf)SDsetnbitdataset((int32)*id,(intn)*start_bit,(intn)*bit_len,
+    (intn)*sign_ext,(intn)*fill_one));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsacct
+ * Purpose: Call SDsetaccesstype to set the access type
+ * Inputs:  id: sds id
+ *          type: the access type
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsacct(intf *id, intf *type)
+#else
+nscsacct(id, type)
+     intf *id;
+     intf *type;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDsetaccesstype(*id, *type));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scsdmvc
+ * Purpose: Call SDsetdimval_comp to set the dim value backward 
+ *            compatibility type
+ * Inputs:  id: dim id
+ *          compmode: backward compatibility:
+ *                    SD_DIMVAL_BW_COMP -- compatible (in mfhdf.h)
+ *                    SD_DIMVAL_BW_INCOMP -- incompatible.
+ *
+ * Returns: SUCCESS on success, FAIL on failure 
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsdmvc(intf *id, intf *compmode)
+#else
+nscsdmvc(id, compmode)
+     intf *id;
+     intf *compmode;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDsetdimval_comp(*id, *compmode));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scisdmvc
+ * Purpose: Call SDisdimval_bwcomp to get the dim value backward 
+ *            compatibility 
+ * Inputs:  id: dim id
+ *
+ * Returns: SD_DIMVAL_BW_COMP (1) if dimval is backward compatible;
+            SD_DIMVAL_BW_INCOMP (0) for not compatible; (in mfhdf.h)
+            FAIL (-1) for error.
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscisdmvc(intf *id)
+#else
+nscisdmvc(id)
+     intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDisdimval_bwcomp(*id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsflmd
+ * Purpose: Call SDsetfillmode to set for the file fill mode 
+ *            as fill or nofill
+ * Inputs:  id: file id
+ *          fillmode: Desired fill mode for the file,
+ *                                 either SD_FILL or SD_NOFILL.
+ *                                 SD_FILL is the default mode.
+ *
+ * Returns: The current (before the new mode is set) fill mode;
+ *          FAIL (-1) for error. 
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsflmd(intf *id, intf *fillmode)
+#else
+nscsflmd(id, fillmode)
+    intf *id, *fillmode;
+#endif  /* PROTOTYPE */
+{
+    return((intf) SDsetfillmode(*id, *fillmode));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scisrcrd
+ * Purpose: call SDisrecord to see if a dataset is a record variable
+ * Inputs:  id: sds id
+ * Returns: TRUE/FALSE (1/0))
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfisrcrd(intf *id)
+#else
+nscisrcrd(id)
+     intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDisrecord(*id));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scsblsz
+ * Purpose: call SDsetblocksize
+ * Inputs:  id:          sd id
+            block_size:  block size  in bytes
+ * Returns: SUCCEED/FAIL (0/-1)
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsblsz(intf *id, intf *block_size)
+#else
+nscsblsz(id, block_size)
+     intf *id;
+     intf *block_size;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDsetblocksize(*id, *block_size));
+}
+
+#endif /* _WIN32 && !CMAKE_INTDIR */
+/*-----------------------------------------------------------------------------
+ * Name:    scstart
+ * Purpose: call SDstart to open HDF file
+ * Inputs:  name: name of file to open
+ *          access: access mode - integer with value DFACC_READ etc. 
+ *          namelen: length of name
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscstart(_fcd name, intf *access, intf *namelen)
+#else
+nscstart(name, access, namelen)
+    _fcd name;
+    intf *access;
+    intf *namelen;
+#endif /* PROTOTYPE */
+{
+    char *fn;
+    intf ret;
+    
+    fn = HDf2cstring(name, *namelen);
+    
+    ret = (intf) SDstart(fn, *access);
+    HDfree((VOIDP)fn);
+
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfend
+ * Purpose: Call SDend close to close HDF file
+ * Inputs:  file_id: handle to HDF file to close
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfend(intf *file_id)
+#else
+nsfend(file_id)
+    intf *file_id;
+#endif /* PROTOTYPE */
+{
+    return(SDend(*file_id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfendacc
+ * Purpose: Call SDendaccess close to end access on a dataset 
+ * Inputs:  id: id of the data set
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfendacc(intf *id)
+#else
+nsfendacc(id)
+    intf *id;
+#endif /* PROTOTYPE */
+{
+    return(SDendaccess(*id));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    sdffinfo
+ * Purpose: Call SDfileinfo to get number of datasets and global attrs in the file
+ * Inputs:  file_id: handle to HDF file
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsffinfo(intf *file_id, intf *datasets, intf *gattr)
+#else
+nsffinfo(file_id, datasets, gattr)
+     intf *file_id;
+     intf *datasets;
+     intf *gattr;
+#endif /* PROTOTYPE */
+{
+  int32 dset, nattr, status;
+
+  status = SDfileinfo((int32) *file_id, &dset, &nattr);
+
+  *datasets = (intf) dset;
+  *gattr    = (intf) nattr;
+
+  return (status);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfselect
+ * Purpose: Call SDselect to return a handle to a data set in the given file
+ * Inputs:  file_id: handle to HDF file
+ *          index:   number of data set to chose
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfselect(intf *file_id, intf *index)
+#else
+nsfselect(file_id, index)
+     intf *file_id;
+     intf *index;
+#endif /* PROTOTYPE */
+{
+    return(SDselect(*file_id, *index));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfdimid
+ * Purpose: Get an id for a dimension of a given data set
+ * Inputs:  id: handle to a data set
+ *          index: number of dimension to chose
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfdimid(intf *id, intf *index)
+#else
+nsfdimid(id, index)
+     intf *id;
+     intf *index;
+#endif /* PROTOTYPE */
+{
+    int32 rank, nt, dims[100], status, cdim, nattrs;
+
+    status = SDgetinfo(*id, NULL, &rank, dims, &nt, &nattrs);
+    if(status == FAIL) return FAIL;
+    cdim = rank - (*index) -1;
+
+    return(SDgetdimid(*id, cdim));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdcginfo
+ * Purpose: Call SDgetinfo to get the basic information about a data set
+ * Inputs:  id: handle to a data set
+ * Outputs: name: the name of the data set
+ *          rank: the rank
+ *          dimsizes: sizes of the dimensions
+ *          nt: number type
+ *          nattr: number of attributes for this data set
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscginfo(intf *id, _fcd name, intf *rank, intf *dimsizes, intf *nt, intf *nattr, intf *len)
+#else
+nscginfo(id, name, rank, dimsizes, nt, nattr, len)
+     intf *id;
+     _fcd name;
+     intf *rank, *dimsizes, *nt, *nattr, *len;
+#endif /* PROTOTYPE */
+{
+    char *iname;
+    int32 status;
+    int32 cdims[100], i;
+    int32 rank32, nt32, nattr32;
+
+    iname = NULL;
+    if(*len)   iname  = (char *) HDmalloc((uint32)*len + 1);
+
+    status = SDgetinfo((int32) *id, iname, &rank32, cdims, &nt32, &nattr32);
+
+    for(i = 0; i < rank32; i++)
+        dimsizes[i] = cdims[rank32 - i - 1];
+
+    HDpackFstring(iname,  _fcdtocp(name),  *len);
+
+    if(iname)  HDfree((VOIDP)iname);
+  
+    *rank  = (intf) rank32;
+    *nt    = (intf) nt32;
+    *nattr = (intf) nattr32;
+
+    return(status);
+
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfgcal
+ * Purpose: Call SDgetcal to get the calibration information
+ * Inputs:  id: handle to a data set
+ * Outputs: cal, cale, ioff, ioffe : calibration factors and error
+ *          nt: number type of data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt)
+#else
+nsfgcal(id, cal, cale, ioff, ioffe, nt)
+     intf *id;
+     float64 *cal, *cale, *ioff, *ioffe;
+     intf *nt;
+#endif /* PROTOTYPE */
+{
+  int32 nt32, status;
+  
+  status = SDgetcal((int32) *id, cal, cale, ioff, ioffe, &nt32);
+  
+  *nt = (intf) nt32;
+
+  return (status);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfscal
+ * Purpose: Call SDsetcal to set the calibration information
+ * Inputs:  id: handle to a data set
+ *          cal, cale, ioff, ioffe : calibration factors and error
+ *          nt: number type of data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt)
+#else
+nsfscal(id, cal, cale, ioff, ioffe, nt)
+     intf *id;
+     float64 *cal, *cale, *ioff, *ioffe;
+     intf *nt;
+#endif /* PROTOTYPE */
+{
+    return(SDsetcal(*id, *cal, *cale, *ioff, *ioffe, *nt));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfsdscale
+ * Purpose: Call SDsetdimscale to set the values for a dimension
+ * Inputs:  id: handle to a dimension
+ *          count: size of the dimension
+ *          nt: number type of data
+ *          values: data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsdscale(intf *id, intf *count, intf *nt, VOIDP values)
+#else
+nsfsdscale(id, count, nt, values)
+     intf *id;
+     intf *count, *nt;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    return(SDsetdimscale(*id, *count, *nt, values));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfgdscale
+ * Purpose: Call SDgetdimscale to get the values for a dimension
+ * Inputs:  id: handle to a dimension
+ * Output   values: data
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfgdscale(intf *id, VOIDP values)
+#else
+nsfgdscale(id, values)
+     intf *id;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    return(SDgetdimscale(*id, values));
+}
+
+/*----------------------------------------------------------
+ * Name:    sdfscfill
+ * Purpose: Call nsfsnfill to set the char fill value
+ * Inputs:  id: handle to a dimension
+ *          val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *----------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfscfill(intf *id, _fcd val)
+#else
+nsfscfill(id, val)
+     intf *id;
+     _fcd val;
+#endif /* PROTOTYPE */
+{
+    return(nsfsfill(id, (VOIDP) _fcdtocp(val)));
+}
+
+/*------------------------------------------------------------
+ * Name:    sdfgcfill
+ * Purpose: Call sfgfill to get the char fill value
+ * Inputs:  id: handle to a dimension
+ * Output:  val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *-----------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfgcfill(intf *id, _fcd val)
+#else
+nsfgcfill(id, val)
+     intf *id;
+     _fcd val;
+#endif /* PROTOTYPE */
+{
+    return(nsfgfill(id, (VOIDP) _fcdtocp(val)));
+}
+
+/*---------------------------------------------------------
+ * Name:    sdfsfill
+ * Purpose: Call SDsetfillvalue to set the numeric fill value
+ * Inputs:  id: handle to a dimension
+ *          val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsfill(intf *id, VOIDP val)
+#else
+nsfsfill(id, val)
+     intf *id;
+     VOIDP val;
+#endif /* PROTOTYPE */
+{
+    return(SDsetfillvalue(*id, val));
+}
+
+/*----------------------------------------------------------
+ * Name:    sdfgfill
+ * Purpose: Call SDgetfillvalue to get the fill value. 
+ * Inputs:  id: handle to a dimension
+ * Output:  val: the fill value
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfgfill(intf *id, VOIDP val)
+#else
+nsfgfill(id, val)
+     intf *id;
+     VOIDP val;
+#endif /* PROTOTYPE */
+{
+    return(SDgetfillvalue(*id, val));
+}
+
+/*------------------------------------------------------------
+ * Name:    sdfgrange
+ * Purpose: Call SDgetrange to get the valid range info
+ * Inputs:  id: handle to a dimension
+ * Output:  min: the min
+ *          max: the max
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfgrange(intf *id, VOIDP max, VOIDP min)
+#else
+nsfgrange(id, max, min)
+     intf *id;
+     VOIDP max;
+     VOIDP min;
+#endif /* PROTOTYPE */
+{
+    return(SDgetrange(*id, max, min));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfsrange
+ * Purpose: Call SDsetrange to set the valid range info
+ * Inputs:  id: handle to a dimension
+ *          min: the min
+ *          max: the max
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsrange(intf *id, VOIDP max, VOIDP min)
+#else
+nsfsrange(id, max, min)
+     intf *id;
+     VOIDP max;
+     VOIDP min;
+#endif /* PROTOTYPE */
+{
+    return(SDsetrange(*id, max, min));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdcn2index
+ * Purpose: return the index of a data set with the given name
+ * Inputs:  id: file id
+ *          name: name to look for
+ *          namelen: length of name
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscn2index(intf *id, _fcd name, intf *namelen)
+#else
+nscn2index(id, name, namelen)
+     intf *id;
+     _fcd name;
+     intf *namelen;
+#endif /* PROTOTYPE */
+{
+    char *fn;
+    intf ret;
+    
+    fn = HDf2cstring(name, *namelen);
+    ret = (intf) SDnametoindex(*id, fn);
+    HDfree((VOIDP)fn);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdccreate
+ * Purpose: create a new data set and return its id
+ * Inputs:  id: file id
+ *          name: name of data set
+ *          nt: number type
+ *          rank: rank
+ *          dims: dimension sizes
+ *          namelen: length of name
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsccreate(intf *id, _fcd name, intf *nt, intf *rank, intf *dims, intf *namelen)
+#else
+nsccreate(id, name, nt, rank, dims, namelen)
+     intf *id;
+     _fcd name;
+     intf *nt, *rank;
+     intf *dims;
+     intf *namelen;
+#endif /* PROTOTYPE */
+{
+    char   *fn;
+    intf    ret;
+    int32 * cdims, i;
+    
+    fn = HDf2cstring(name, *namelen);
+    cdims = (int32 *) HDmalloc(sizeof(int32) * (*rank));
+    if(!cdims) return FAIL;
+
+    for(i = 0; i < *rank; i++)
+        cdims[i] = dims[*rank - i - 1];
+
+    ret = (intf) SDcreate(*id, fn, *nt, *rank, cdims);
+
+    HDfree((VOIDP)fn);
+    HDfree((VOIDP)cdims);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsdimstr
+ * Purpose: set the strings for this dimension
+ * Inputs:  id: dim id
+ *          label, unit and format strings and their lengths
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsdimstr(intf *id, _fcd l, _fcd u, _fcd f, intf *ll, intf *ul, intf *fl)
+#else
+nscsdimstr(id, l, u, f, ll, ul, fl)
+     intf *id;
+     _fcd l;
+     _fcd u;
+     _fcd f;
+     intf *ll, *ul, *fl;
+#endif /* PROTOTYPE */
+{
+    char *lstr;
+    char *ustr;
+    char *fstr;
+    intf ret;
+    
+    if(ll) 
+        lstr = HDf2cstring(l, *ll);
+    else
+        lstr = NULL;
+
+    if(ul) 
+        ustr = HDf2cstring(u, *ul);
+    else
+        ustr = NULL;
+
+    if(fl) 
+        fstr = HDf2cstring(f, *fl);
+    else
+        fstr = NULL;
+
+    ret = (intf) SDsetdimstrs(*id, lstr, ustr, fstr);
+    if(ll) HDfree((VOIDP)lstr);
+    if(ul) HDfree((VOIDP)ustr);
+    if(fl) HDfree((VOIDP)fstr);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsdimname
+ * Purpose: set the name of this dimension
+ * Inputs:  id: dim id
+ *          name and its length
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsdimname(intf *id, _fcd name, intf *len)
+#else
+nscsdimname(id, name, len)
+     intf *id;
+     _fcd name;
+     intf *len;
+#endif /* PROTOTYPE */
+{
+    char *nstr;
+    intf ret;
+    
+    if(len) 
+        nstr = HDf2cstring(name, *len);
+    else
+        nstr = NULL;
+
+    ret = (intf) SDsetdimname(*id, nstr);
+    if(len) HDfree((VOIDP)nstr);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsdatstr
+ * Purpose: set the strings for this dimension
+ * Inputs:  id: dim id
+ *          label, unit and format strings and their lengths
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsdatstr(intf *id, _fcd l, _fcd u, _fcd f, _fcd c, intf *ll, intf *ul, intf *fl, intf *cl)
+#else
+nscsdatstr(id, l, u, f, c, ll, ul, fl, cl)
+     intf *id;
+     _fcd l;
+     _fcd u;
+     _fcd f;
+     _fcd c;
+     intf *ll, *ul, *fl, *cl;
+#endif /* PROTOTYPE */
+{
+    char *lstr;
+    char *ustr;
+    char *fstr;
+    char *cstr;
+    intf ret;
+    
+    if(ll) 
+        lstr = HDf2cstring(l, *ll);
+    else
+        lstr = NULL;
+
+    if(ul) 
+        ustr = HDf2cstring(u, *ul);
+    else
+        ustr = NULL;
+
+    if(fl) 
+        fstr = HDf2cstring(f, *fl);
+    else
+        fstr = NULL;
+
+    if(cl) 
+        cstr = HDf2cstring(c, *cl);
+    else
+        cstr = NULL;
+
+    ret = (intf) SDsetdatastrs(*id, lstr, ustr, fstr, cstr);
+    if(ll) HDfree((VOIDP)lstr);
+    if(ul) HDfree((VOIDP)ustr);
+    if(fl) HDfree((VOIDP)fstr);
+    if(cl) HDfree((VOIDP)cstr);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfrcatt
+ * Purpose: Call sfrnatt to get the contents of a char attribute
+ * Inputs:  id: handle to a dataset
+ *          index: index of the attribute to read
+ *          buf: space to hold info
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfrcatt(intf *id, intf *index, _fcd buf)
+#else
+nsfrcatt(id, index, buf)
+     intf *id;
+     intf *index;
+     _fcd buf;
+#endif /* PROTOTYPE */
+{
+    return(nsfrnatt(id, index, (VOIDP) _fcdtocp(buf)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfrnatt
+ * Purpose: Call SDreadattr to get the contents of a numeric attribute
+ * Inputs:  id: handle to a dataset
+ *          index: index of the attribute to read
+ *          buf: space to hold info
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfrnatt(intf *id, intf *index, VOIDP buf)
+#else
+nsfrnatt(id, index, buf)
+     intf *id;
+     intf *index;
+     VOIDP buf;
+#endif /* PROTOTYPE */
+{
+    return(SDreadattr(*id, *index, buf));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfrattr
+ * Purpose: Call SDreadattr to get the contents of an attribute
+ * Inputs:  id: handle to a dataset
+ *          index: index of the attribute to read
+ *          buf: space to hold info
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfrattr(intf *id, intf *index, VOIDP buf)
+#else
+nsfrattr(id, index, buf)
+     intf *id;
+     intf *index;
+     VOIDP buf;
+#endif /* PROTOTYPE */
+{
+    return(nsfrnatt(id, index, buf));
+}
+
+/*------------------------------------------------------------
+ * Name:    sfrdata
+ * Purpose: read a section of numeric data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to read
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *----------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfrdata(intf *id, intf *start, intf *stride, intf *end, VOIDP values)
+#else
+nsfrdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    intf    ret;
+    int32   i, rank, dims[100], nt, nattrs, status;
+    int32   cstart[100], cstride[100], cend[100];
+    int     nostride;
+    
+    status = SDgetinfo(*id, NULL, &rank, dims, &nt, &nattrs);
+    if(status == FAIL) return FAIL;
+
+    nostride = TRUE;
+
+    for(i = 0; i < rank; i++) {
+        cstart[i] = start[rank - i - 1];
+        cend[i]   = end[rank - i - 1];
+        if((cstride[i] = stride[rank - i - 1]) != 1) nostride = FALSE;
+    }
+    
+    ret = (intf) SDreaddata(*id, cstart, (nostride? NULL : cstride), cend, values);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfwdata
+ * Purpose: write a section of data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to write
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfwdata(intf *id, intf *start, intf *stride, intf *end, VOIDP values)
+#else
+nsfwdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     VOIDP values;
+#endif /* PROTOTYPE */
+{
+    intf    ret;
+    int32   i, rank, dims[100], nt, nattrs, status;
+    int32   cstart[100], cstride[100], cend[100];
+    intn    nostride;
+    
+    status = SDgetinfo(*id, NULL, &rank, dims, &nt, &nattrs);
+    if(status == FAIL) return FAIL;
+
+    nostride = TRUE;
+
+    for(i = 0; i < rank; i++) {
+        cstart[i] = start[rank - i - 1];
+        cend[i]   = end[rank - i - 1];
+        if((cstride[i] = stride[rank - i - 1]) != 1) nostride = FALSE;
+    }
+
+    ret = (intf) SDwritedata(*id, cstart, (nostride? NULL : cstride), cend, values);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scgdmstrs
+ * Purpose: Return the "dimension strings"
+ * Inputs:  label, unit, format: strings to return attributes in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel,
+         intf *lunit, intf *lformat, intf *mlen)
+#else
+nscgdimstrs(dim, label, unit, format, llabel, lunit, lformat, mlen)
+     intf *dim;
+     _fcd label, unit, format;
+     intf *llabel, *lunit, *lformat;
+     intf *mlen;
+#endif /* PROTOTYPE */
+{
+    char *ilabel, *iunit, *iformat;
+    intf ret;
+    iunit = ilabel = iformat = NULL;
+
+    if(*llabel)  ilabel  = (char *) HDmalloc((uint32)*llabel + 1);
+    if(*lunit)   iunit   = (char *) HDmalloc((uint32)*lunit + 1);
+    if(*lformat) iformat = (char *) HDmalloc((uint32)*lformat + 1);
+
+    ret = (intf)SDgetdimstrs(*dim, ilabel, iunit, iformat, *mlen);
+
+    HDpackFstring(ilabel,  _fcdtocp(label),  *llabel);
+    HDpackFstring(iunit,   _fcdtocp(unit),   *lunit);
+    HDpackFstring(iformat, _fcdtocp(format), *lformat);
+
+    if(ilabel)  HDfree((VOIDP)ilabel);
+    if(iunit)   HDfree((VOIDP)iunit);
+    if(iformat) HDfree((VOIDP)iformat);
+
+    return ret;
+}
+
+/*--------------------------------------------------------
+ * Name:    sfrcdata
+ * Purpose: read a section of char data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to read
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values)
+#else
+nsfrcdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     _fcd values;
+#endif /* PROTOTYPE */
+{
+     return(nsfrdata(id, start, stride, end, (VOIDP) _fcdtocp(values)));
+}
+
+/*--------------------------------------------------------
+ * Name:    sfwcdata
+ * Purpose: write a section of char data
+ * Inputs:  id: dataset id
+ *          start: start location
+ *          stride: stride along each dimension
+ *          end: number of values along each dim to read
+ *          values: data 
+ * Remarks: need to flip the dimensions to account for array ordering
+ *          differences
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values)
+#else
+nsfwcdata(id, start, stride, end, values)
+     intf *id;
+     intf *start, *stride, *end;
+     _fcd values;
+#endif /* PROTOTYPE */
+{
+     return(nsfwdata(id, start, stride, end, (VOIDP) _fcdtocp(values)));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scgdtstrs
+ * Purpose: Return the "data strings"
+ * Inputs:  label, unit, format coord: strings to return attributes in
+ * Returns: 0 on success, -1 on failure with DFerror set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgdatstrs(intf *id, _fcd label, _fcd unit, _fcd format, _fcd coord, 
+           intf *llabel, intf *lunit, intf *lformat, intf *lcoord, intf *len)
+#else
+nscgdatstrs(id, label, unit, format, coord, llabel, lunit, lformat, lcoord, len)
+     intf *id;
+     _fcd label, unit, format, coord;
+     intf *llabel, *lunit, *lformat, *lcoord;
+     intf *len;
+#endif /* PROTOTYPE */
+{
+    char *ilabel, *iunit, *iformat, *icoord=NULL;
+    intf ret;
+
+    iunit = ilabel = iformat = NULL;
+
+    if(*llabel)  ilabel  = (char *) HDmalloc((uint32)*llabel + 1);
+    if(*lunit)   iunit   = (char *) HDmalloc((uint32)*lunit + 1);
+    if(*lformat) iformat = (char *) HDmalloc((uint32)*lformat + 1);
+    if(*lcoord)  icoord  = (char *) HDmalloc((uint32)*lcoord + 1);
+
+    ret = (intf)SDgetdatastrs(*id, ilabel, iunit, iformat, icoord, *len);
+
+    HDpackFstring(ilabel,  _fcdtocp(label),  *llabel);
+    HDpackFstring(iunit,   _fcdtocp(unit),   *lunit);
+    HDpackFstring(iformat, _fcdtocp(format), *lformat);
+    HDpackFstring(icoord,  _fcdtocp(coord),  *lcoord);
+
+    if(ilabel)  HDfree((VOIDP)ilabel);
+    if(iunit)   HDfree((VOIDP)iunit);
+    if(iformat) HDfree((VOIDP)iformat);
+    if(icoord)  HDfree((VOIDP)icoord);
+
+    return ret;
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfgainfo
+ * Purpose: Call SDattrinfo to get the basic information about an attribute
+ * Inputs:  id: handle to a data set
+ * Outputs: name: the name of the data set
+ *          count: the size
+ *          nt: number type
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgainfo(intf *id, intf *number, _fcd name, intf *nt, intf *count, intf *len)
+#else
+nscgainfo(id, number, name, nt, count, len)
+     intf *id, *number;
+     _fcd name;
+     intf *count, *len, *nt;
+#endif /* PROTOTYPE */
+{
+    char  * iname;
+    intn    status;
+    int32   nt32;
+    int32   cnt32;
+
+    iname = NULL;
+    if(*len)   iname  = (char *) HDmalloc((uint32)*len + 1);
+
+    status = SDattrinfo(*id, *number, iname, &nt32, &cnt32);
+
+    HDpackFstring(iname,  _fcdtocp(name),  *len);
+
+    if(iname)  HDfree((VOIDP)iname);
+
+    *nt    = (intf) nt32;
+    *count = (intf) cnt32;
+  
+    return((intf)status);
+
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scgdinfo
+ * Purpose: Call SDdiminfo to get the basic information about a dimension
+ * Inputs:  id: handle to a dimension
+ * Outputs: name: the name of the dimension
+ *          count: the size
+ *          nt: number type
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgdinfo(intf *id, _fcd name, intf *sz, intf *nt, intf *nattr, intf *len)
+#else
+nscgdinfo(id, name, sz, nt, nattr, len)
+     intf *id;
+     _fcd name;
+     intf *sz, *nattr, *len, *nt;
+#endif /* PROTOTYPE */
+{
+    char *iname;
+    int32 status;
+    int32 sz32, nt32, nattr32;
+
+    iname = NULL;
+    if(*len)   iname  = (char *) HDmalloc((uint32)*len + 1);
+
+    status = SDdiminfo(*id, iname, &sz32, &nt32, &nattr32);
+
+    HDpackFstring(iname,  _fcdtocp(name),  *len);
+
+    if(iname)  HDfree((VOIDP)iname);
+  
+    *nt    = (intf) nt32;
+    *sz    = (intf) sz32;
+    *nattr = (intf) nattr32;
+
+    return(status);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scscatt
+ * Purpose: calls scsnatt to create a new char attribute (or modify an existing one)
+ * Inputs:  id: id (file or data set)
+ *          name: name of attribute
+ *          nt: number type
+ *          count: number of values
+ *          data: where the values are
+ *          len: length of name
+ * Remarks: 
+ * Returns: 0 on success, -1 on failure with error set
+ *--------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscscatt(intf *id, _fcd name, intf *nt, intf *count, _fcd data, intf *len)
+#else
+nscscatt(id, name, nt, count, data, len)
+     intf *id;
+     _fcd name;
+     intf *nt, *count;
+     _fcd data;
+     intf *len;
+#endif /* PROTOTYPE */
+{
+    return(nscsnatt(id, name, nt, count, (VOIDP) _fcdtocp(data), len));
+}
+
+/*-------------------------------------------------------------
+ * Name:    scsnatt
+ * Purpose: create a new numeric attribute (or modify an existing one)
+ * Inputs:  id: id (file or data set)
+ *          name: name of attribute
+ *          nt: number type
+ *          count: number of values 
+ *          data:  where the values are
+ *          len: length of name
+ * Remarks: This routine and scscattr are used to replace scsattr
+ * Returns: 0 on success, -1 on failure with error set
+ *--------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsnatt(intf *id, _fcd name, intf *nt, intf *count, VOIDP data, intf *len)
+#else
+nscsnatt(id, name, nt, count, data, len)
+     intf *id;
+     _fcd name;
+     intf *nt, *count;
+     VOIDP data;
+     intf *len;
+#endif /* PROTOTYPE */
+{
+    char   *an;
+    intf    ret;
+    
+    an = HDf2cstring(name, *len);
+
+    ret = (intf) SDsetattr(*id, an, *nt, *count, data);
+
+    HDfree((VOIDP)an);
+    return(ret);
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsattr
+ * Purpose: for backward compatibility. Calls SDsetattr to create
+ *          or modify an existing attribute
+ * Inputs:  id: id (file or data set)
+ *          name: name of attribute
+ *          nt: number type
+ *          count: number of values
+ *          data: where the values are
+ *          namelen: length of name
+ * Returns: 0 on success, -1 on failure with error set
+ * Remarks: This routine and sfsattr should be phased out.
+ *          sfsattr declairs data as char *, scscatt assumes
+ *          data as VOIDP.
+ *--------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsattr(intf *id, _fcd name, intf *nt, intf *count, VOIDP data, intf *len)
+#else
+nscsattr(id, name, nt, count, data, len)
+     intf *id;
+     _fcd name;
+     intf *nt, *count;
+     VOIDP data;
+     intf *len;
+#endif /* PROTOTYPE */
+{
+    char   *an;
+    intf    ret;
+
+    an = HDf2cstring(name, *len);
+    ret = (intf) SDsetattr(*id, an, *nt, *count, data);
+    HDfree((VOIDP)an);
+    return(ret);
+}
+
+/*---------------------------------------------------------------------
+ * Name:    scfattr
+ * Purpose: call SDfindattr to find an attribute
+ * Inputs:  id: object to look at
+ *          name: name of attribute to find
+ * Returns: attribute id on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscfattr(intf *id, _fcd name, intf *namelen)
+#else
+nscfattr(id, name, namelen)
+    _fcd name;
+    intf *id;
+    intf *namelen;
+#endif /* PROTOTYPE */
+{
+    char *fn;
+    intf ret;
+    
+    fn = HDf2cstring(name, *namelen);
+    
+    ret = (intf) SDfindattr(*id, fn);
+    HDfree((VOIDP)fn);
+
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfid2ref
+ * Purpose: call SDidtoref to map an idfindattr to find an attribute
+ * Inputs:  id: variable id
+ * Returns: reference number of a NDG representing this dataset
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfid2ref(intf *id)
+#else
+nsfid2ref(id)
+    intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDidtoref(*id));
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfref2index
+ * Purpose: call SDreftoindex to map a reference number to an index of a 
+ *          dataset
+ * Inputs:  id: file id
+ *          ref: reference number to look up
+ * Returns: reference number of a NDG representing this dataset
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfref2index(intf *id, intf *ref)
+#else
+nsfref2index(id, ref)
+     intf *id;
+     intf *ref;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDreftoindex(*id, (int32) *ref));
+}
+
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfiscvar
+ * Purpose: call SDiscoordvar to see if a dataset is a coordinate variable
+ *          dataset
+ * Inputs:  id: sds id
+ * Returns: TRUE/FALSE
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfiscvar(intf *id)
+#else
+nsfiscvar(id)
+     intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDiscoordvar(*id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scsextf
+ * Purpose: store data in an external file
+ * Inputs:  id: sds id
+ *          name: name of external file
+ *          offset: Number of bytes from the beginning of the
+ *                    external file to where the data starts
+ *          namelen: length of name
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscsextf(intf *id, _fcd name, intf *offset, intf *namelen)
+#else
+nscsextf(id, name, offset, namelen)
+     intf *id;
+     _fcd name;
+     intf *offset;
+     intf *namelen;
+#endif /* PROTOTYPE */
+{
+    char   *fn;
+    intf    ret;
+    
+    fn = HDf2cstring(name, *namelen);
+    if (!fn) return(FAIL);
+    ret = (intf) SDsetexternalfile(*id, fn, *offset);
+    HDfree((VOIDP)fn);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfsnbit
+ * Purpose: store data in n-bit data element
+ * Inputs:  id: sds id
+ *          start_bit: starting bit offset
+ *          bit_len: # of bits to write
+ *          sign_ext: whether to use the top bit as a sign extender
+ *          fill_one: whether to fill the "background bits" with ones
+ * Returns: 0 on success, -1 on failure with error set
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_one)
+#else
+nsfsnbit(id, start_bit, bit_len, sign_ext, fill_one)
+     intf *id;
+     intf *start_bit;
+     intf *bit_len;
+     intf *sign_ext;
+     intf *fill_one;
+#endif /* PROTOTYPE */
+{
+    return((intf)SDsetnbitdataset((int32)*id,(intn)*start_bit,(intn)*bit_len,
+	(intn)*sign_ext,(intn)*fill_one));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sdfsacct
+ * Purpose: Call SDsetaccesstype to set the access type
+ * Inputs:  id: sds id
+ *          type: the access type
+ * Returns: 0 on success, FAIL on failure with error set
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsacct(intf *id, intf *type)
+#else
+nsfsacct(id, type)
+     intf *id;
+     intf *type;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDsetaccesstype(*id, *type));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    sfsdmvc
+ * Purpose: Call SDsetdimval_comp to set the dim value backward 
+ *            compatibility type
+ * Inputs:  id: dim id
+ *          compmode: backward compatibility:
+ *                    SD_DIMVAL_BW_COMP -- compatible (in mfhdf.h)
+ *                    SD_DIMVAL_BW_INCOMP -- incompatible.
+ *
+ * Returns: SUCCESS on success, FAIL on failure 
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsdmvc(intf *id, intf *compmode)
+#else
+nsfsdmvc(id, compmode)
+     intf *id;
+     intf *compmode;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDsetdimval_comp(*id, *compmode));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfisdmvc
+ * Purpose: Call SDisdimval_bwcomp to get the dim value backward 
+ *            compatibility 
+ * Inputs:  id: dim id
+ *
+ * Returns: SD_DIMVAL_BW_COMP (1) if dimval is backward compatible;
+            SD_DIMVAL_BW_INCOMP (0) for not compatible; (in mfhdf.h)
+            FAIL (-1) for error.
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfisdmvc(intf *id)
+#else
+nsfisdmvc(id)
+     intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDisdimval_bwcomp(*id));
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    sfsflmd
+ * Purpose: Call SDsetfillmode to set for the file fill mode 
+ *            as fill or nofill
+ * Inputs:  id: file id
+ *          fillmode: Desired fill mode for the file,
+ *                                 either SD_FILL or SD_NOFILL.
+ *                                 SD_FILL is the default mode.
+ *
+ * Returns: The current (before the new mode is set) fill mode;
+ *          FAIL (-1) for error. 
+ * Users:   HDF Fortran programmers
+ *---------------------------------------------------------------------------*/
+
+    FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsflmd(intf *id, intf *fillmode)
+#else
+nsfsflmd(id, fillmode)
+    intf *id, *fillmode;
+#endif  /* PROTOTYPE */
+{
+    return((intf) SDsetfillmode(*id, *fillmode));
+}
+#endif /* HDF */
+
+/*-------------------------------------------------------------------------
+ * Name:    scgichnk
+ * Puporse: Call SDgetchunkinfo
+ * Inputs:  id: SDS access id
+ * Outputs: dim_length: chunk dimensions
+ *          flags:            -1 - SDS is nonchunked
+ *                             0 - SDS is chunked, no compression
+ *                             1 - SDS is chunked and compressed 
+ *                                 with RLE, SKPHUFF and GZIP 
+ *                             2 - SDS is chunked and compressed with NBIT 
+ * Actual parameters are not returned. Will be fixed after HDF41r.2
+ *          comp_prm[0] = nbit_sign_ext, 
+ *          comp_prm[1] = nbit_fill_one, 
+ *          comp_prm[2] = nbit_start_bit, 
+ *          comp_prm[3] = nbit_bit_len:     NBIT compression parametes 
+ *
+ *          comp_prm[0] = skphuff_skp_size: size of individual elements for 
+ *                            Adaptive Huffman compression algorithm
+ *          comp_prm[0] = deflate_level:    GZIP  compression parameter
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+      nscgichnk(intf *id, intf *dim_length, intf *flags)
+#else
+       nscgichnk( id, dim_length, flags)
+       intf *id;       
+       intf *dim_length;
+       intf *flags;
+#endif /* PROTOTYPE */
+{
+
+HDF_CHUNK_DEF chunk_def;  /* Chunk definition set */
+int32 sdsid;              /* SDS id               */
+int   i;
+int32 rank, status, cflags;
+intf ret;
+
+int32 cdims[100], nt32, nattr32;
+sdsid = *id;
+
+/* Get  SDS rank */
+
+       status = SDgetinfo(sdsid, NULL, &rank, cdims, &nt32, &nattr32 );
+       if(status == FAIL) return FAIL;
+
+/* Get SDS info */
+  
+       status = SDgetchunkinfo(sdsid, &chunk_def, &cflags);
+       if(status == FAIL) return FAIL;
+
+
+switch (cflags)  
+
+  {
+
+  case HDF_NONE:       /* Non-chunked SDS */
+
+    *flags = -1;
+     ret = 0;
+     return(ret);
+
+  case HDF_CHUNK:    /* Chunked, noncompressed SDS */
+
+    *flags = 0;
+     for (i=0; i < rank; i++)
+          dim_length[rank-i-1] = chunk_def.chunk_lengths[i];
+     ret = 0;
+     return(ret);
+
+  case (HDF_CHUNK | HDF_COMP):     /* Chunked and compressed SDS
+                                      RLE, SKPHUFF or GZIP only */
+ 
+     *flags = 1;
+     for (i=0; i < rank; i++)
+          dim_length[rank-i-1] =  chunk_def.comp.chunk_lengths[i];
+     ret = 0;
+     return(ret);
+
+  case (HDF_CHUNK | HDF_NBIT):     /* Chunked and NBIT compressed SDS */
+ 
+     *flags = 2;
+     for (i=0; i < rank; i++)
+          dim_length[rank-i-1] =  chunk_def.nbit.chunk_lengths[i];
+     ret = 0;
+     return(ret);
+
+  default:
+
+    return FAIL;
+            
+  }
+
+
+}   
+/*-----------------------------------------------------------------------------
+ * Name:     scrchnk
+ * Purpose:  read the specified chunk of NUMERIC data to the buffer
+ * Inputs:   id        - data set ID
+ *           start     - origin of chunk to read 
+ * Outputs:  num_data  - buffer the data will be read into
+ * Calls:    SDreadchunk
+ * Remarks:  need to flip the dimensions to account for array ordering
+ *           differencies (start --> cstart)
+ *           If performance becomes an issue, use static cstart 
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nscrchnk(intf *id, intf *start, VOIDP num_data)
+#else
+       nscrchnk(id, start, num_data)
+                intf *id;
+                intf *start;
+                VOIDP num_data;
+#endif /* PROTOTYPE */
+
+{
+       intf    ret;
+       int32   rank, status, i;
+       int32   *cstart;
+
+       int32   cdims[100], nt32, nattr32;
+/* Get rank of SDS */
+
+       status = SDgetinfo(*id, NULL, &rank, cdims, &nt32, &nattr32);
+       if(status == FAIL) return FAIL;
+
+/* Allocate memory for cstart array; use static array, if performance
+       becomes an issue */
+
+       cstart = (int32 *) HDmalloc(sizeof(int32) * rank);
+       if(!cstart) return FAIL;
+
+/* Flip an array to account for array odering in Fortran and C */
+
+       for ( i=0; i < rank; i++)
+             cstart[i] = start[rank-i-1] - 1;
+
+/* Call SDreadChunk function to read the data */
+
+       ret = SDreadchunk(*id, cstart, num_data);
+
+/* Free memory */
+
+       HDfree((VOIDP)cstart);
+       return(ret);
+
+} 
+
+/*-----------------------------------------------------------------------------
+ * Name:     scrcchnk
+ * Purpose:  read the specified chunk of CHARACTER data to the buffer
+ * Inputs:   id        - data set ID
+ *           start     - origin of chunk to read 
+ * Outputs:  char_data  - buffer the data will be read into
+ * Calls:    scrchnk 
+ * Reamrks:  dimensions will be flipped in scrchnk function
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE 
+       nscrcchnk(intf *id, intf *start, _fcd char_data)
+#else
+       nscrcchnk(id, start, char_data)
+                intf *id;
+                intf *start;
+               _fcd  char_data;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret;
+
+       ret = nscrchnk(id, start, (VOIDP) _fcdtocp(char_data));
+
+       return(ret);
+
+} 
+
+/*-----------------------------------------------------------------------------
+ * Name:     scscchnk
+ * Purpose:  set the maximum number of chunks to cache 
+ * Inputs:   id        - data set ID
+ *           maxcache  - max number of chunks to cache
+ *           flags     - flags= 0, HDF_CACHEALL
+ *                       Currently only 0 can be passed
+ * Calls:    SDsetchunkcache
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nscscchnk(intf *id, intf *maxcache, intf *flags)
+#else
+       nscscchnk(id, maxcache, flags)
+                intf *id;
+                intf *maxcache;
+                intf *flags;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret;
+
+       ret = SDsetchunkcache(*id, *maxcache, *flags);
+
+       return(ret);
+
+} 
+
+/*-------------------------------------------------------------------------
+ * Name:    scschnk
+ * Puporse: Call SDsetchunk
+ * Inputs:  id: SDS access id
+ *          dim_length: chunk dimensions
+ *          comp_type:  type of compression
+ *                              COMP_CODE_NONE    (0)
+ *                              COMP_CODE_RLE     (1)
+ *                              COMP_CODE_NBIT    (2)
+ *                              COMP_CODE_SKPHUFF (3)
+ *                              COMP_CODE_DEFLATE (4)
+ *                              COMP_CODE_INVALID (5)
+ *          comp_prm[0] = nbit_sign_ext, 
+ *          comp_prm[1] = nbit_fill_one, 
+ *          comp_prm[2] = nbit_start_bit, 
+ *          comp_prm[3] = nbit_bit_len:     NBIT compression parametes 
+ *
+ *          comp_prm[0] = skphuff_skp_size: size of individual elements for 
+ *                            Adaptive Huffman compression algorithm
+ *          comp_prm[0] = deflate_level:    GZIP  compression parameter
+ *          comp_prm[0] = option_mask:      SZIP option mask parameter
+ *          comp_prm[1] = pixels_per_block  SZIP parameter
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+      nscschnk(intf *id, intf *dim_length, intf *comp_type,
+                intf *comp_prm)
+#else
+       nscschnk( id, dim_length, comp_type,
+                 comp_prm)
+       intf *id;
+       intf *dim_length;
+       intf *comp_type;
+       intf *comp_prm;
+#endif /* PROTOTYPE */
+{
+
+    HDF_CHUNK_DEF chunk_def;  /* Chunk definition set */
+    int32 sdsid;              /* SDS id               */
+    int32 cflags;             /* chunk flags          */
+    int   i, CASE;
+    int32 rank, status;
+    intf ret;
+
+    int32 cdims[100], nt32, nattr32;
+
+    /* Get rank of SDS */
+
+       status = SDgetinfo((int32) *id, NULL , &rank, cdims, &nt32, &nattr32);
+       if(status == FAIL) return FAIL;
+
+    CASE = *comp_type;
+    sdsid = *id;
+    cflags = HDF_CHUNK | HDF_COMP;
+
+    switch (CASE)  {
+
+       case 0:       /* No compression */
+         cflags = HDF_CHUNK;
+         for (i=0; i < rank; i++)
+               chunk_def.chunk_lengths[i] = dim_length[rank-i-1]; 
+         break;
+    
+       case 1:       /* RLE compression */
+         cflags = HDF_CHUNK | HDF_COMP;
+         for (i=0; i < rank; i++)
+                chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1];
+
+         chunk_def.comp.comp_type = COMP_CODE_RLE;
+
+         break;
+
+
+       case 2:      /* N-bit encoding */
+         cflags = HDF_CHUNK | HDF_NBIT;
+         for (i=0; i < rank; i++)
+                chunk_def.nbit.chunk_lengths[i] = dim_length[rank-i-1]; 
+
+         chunk_def.nbit.sign_ext = comp_prm[0]; 
+         chunk_def.nbit.fill_one = comp_prm[1]; 
+         chunk_def.nbit.start_bit = comp_prm[2];
+         chunk_def.nbit.bit_len = comp_prm[3]; 
+
+         break; 
+ 
+       case 3:      /* Skipping Huffman encoding */
+         cflags = HDF_CHUNK | HDF_COMP;
+          for (i=0; i < rank; i++)
+                chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1];
+
+          chunk_def.comp.comp_type = COMP_CODE_SKPHUFF;
+          chunk_def.comp.cinfo.skphuff.skp_size = comp_prm[0]; 
+
+          break;
+
+       case 4:      /* GZIP compression */  
+         cflags = HDF_CHUNK | HDF_COMP;
+          for (i=0; i < rank; i++)
+                 chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1];
+           
+          chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+          chunk_def.comp.cinfo.deflate.level = comp_prm[0];
+
+          break;
+
+       case 5:      /* SZIP compression */  
+         cflags = HDF_CHUNK | HDF_COMP;
+          for (i=0; i < rank; i++)
+                 chunk_def.comp.chunk_lengths[i] = dim_length[rank-i-1];
+           
+          chunk_def.comp.comp_type = COMP_CODE_SZIP;
+          chunk_def.comp.cinfo.szip.options_mask     = comp_prm[0];
+          chunk_def.comp.cinfo.szip.pixels_per_block = comp_prm[1];
+          break;
+
+       default:
+
+          return FAIL;
+                    
+     }
+
+    ret = SDsetchunk(sdsid, chunk_def, cflags);
+    return(ret);
+
+}   
+/*-----------------------------------------------------------------------------
+ * Name:     scwchnk
+ * Purpose:  write the specified chunk of NUMERIC data to the SDS
+ * Inputs:   id        - data set ID
+ *           start     - origin of chunk to write
+ *           num_data  - buffer for data
+ * Calls:    SDwritechunk
+ * Remarks:  need to flip the dimensions to account for array ordering
+ *           differencies (start --> cstart)
+ *           If performance becomes an issue, use static cstart 
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nscwchnk(intf *id, intf *start, VOIDP num_data)
+#else
+       nscwchnk(id, start, num_data)
+                intf *id;
+                intf *start;
+                VOIDP num_data;
+#endif /* PROTOTYPE */
+
+{
+       intf    ret;
+       int32   rank, status, i;
+       int32   *cstart;
+
+       int32   cdims[100], nt32, nattr32;
+/* Get rank of SDS */
+
+       status = SDgetinfo(*id, NULL, &rank, cdims, &nt32, &nattr32);
+       if(status == FAIL) return FAIL;
+
+/* Allocate memory for cstart array; use static array, if performance
+       becomes an issue */
+
+       cstart = (int32 *) HDmalloc(sizeof(int32) * rank);
+       if(!cstart) return FAIL;
+
+/* Flip an array */
+
+       for ( i=0; i < rank; i++)
+             cstart[i] = start[rank-i-1] - 1;
+
+/* Call SDwriteChunk function to write the data */
+
+       ret = SDwritechunk(*id, cstart, num_data);
+
+/* Free memory */ 
+
+       HDfree((VOIDP)cstart);
+
+       return(ret);
+
+} 
+/*-----------------------------------------------------------------------------
+ * Name:     scwcchnk
+ * Purpose:  write the specified chunk of CHARACTER data to the SDS 
+ * Inputs:   id        - data set ID
+ *           start     - origin of chunk to read 
+ * Outputs:  char_data  - buffer the data will be read into
+ * Calls:    scwchnk 
+ * Reamrks:  dimensions will be flipped in scrchnk function
+ * Returns:  0 on success, -1 on failure with error set
+ *----------------------------------------------------------------------------*/   
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nscwcchnk(intf *id, intf *start, _fcd char_data)
+#else
+       nscwcchnk(id, start, char_data)
+                intf *id;
+                intf *start;
+               _fcd  char_data;
+#endif /* PROTOTYPE */
+
+{
+       intf  ret;
+
+       ret = nscwchnk(id, start, (VOIDP) _fcdtocp(char_data));
+
+       return(ret);
+
+} 
+
+/*-------------------------------------------------------------------------
+ * Name:    scscompress
+ * Puporse: Call SDsetcompress 
+ * Inputs:  id: SDS access id
+ *          comp_type:  type of compression
+ *                      COMP_CODE_NONE = 0
+ *                      COMP_CODE_RLE  = 1
+ *                      COMP_CODE_SKPHUFF = 3
+ *                      COMP_CODE_DEFLATE = 4
+ *                      COMP_CODE_SZIP = 5
+ *          comp_prm[0] = skphuff_skp_size: size of individual elements for 
+ *                            Adaptive Huffman compression algorithm
+ *          comp_prm[0] = deflate_level:    GZIP  compression parameter
+ *          SZIP:
+ *          comp_prm[0] = options_mask    
+ *          comp_prm[1] = pixels_per_block 
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nscscompress(intf *id, intf *comp_type, intf *comp_prm)
+#else
+       nscscompress( id, comp_type, comp_prm)
+       intf *id;
+       intf *comp_type;
+       intf *comp_prm;
+#endif /* PROTOTYPE */
+{
+
+    int32 sdsid;              /* SDS id               */
+    comp_info c_info;         /* compression info     */
+    comp_coder_t c_type;              /* compression type definition */
+
+    int   CASE;
+    intf ret;
+
+
+
+    CASE = *comp_type;
+    sdsid = *id;
+    switch (CASE)  {
+
+       case COMP_CODE_NONE:       /* No compression */
+         c_type = COMP_CODE_NONE;
+         break;
+    
+       case COMP_CODE_RLE:             /* RLE compression */
+         c_type = COMP_CODE_RLE;
+         break;
+ 
+       case COMP_CODE_SKPHUFF:      /* Skipping Huffman encoding */
+          c_type = COMP_CODE_SKPHUFF;
+          c_info.skphuff.skp_size = comp_prm[0]; 
+          break;
+
+       case COMP_CODE_DEFLATE:      /* GZIP compression */  
+          c_type = COMP_CODE_DEFLATE;
+          c_info.deflate.level = comp_prm[0]; 
+          break;
+
+       case COMP_CODE_SZIP:      /* SZIP compression */  
+          c_type = COMP_CODE_SZIP;
+          c_info.szip.options_mask = comp_prm[0]; 
+          c_info.szip.pixels_per_block = comp_prm[1]; 
+          break;
+       default:
+
+          return FAIL;
+                    
+                     }
+
+    ret = SDsetcompress(sdsid, c_type, &c_info);
+    return(ret);
+
+}
+/*-------------------------------------------------------------------------
+ * Name:    scgcompress
+ * Puporse: Call SDgetcompress 
+ * Inputs:  id: SDS access id
+ * Outputs: comp_type:  type of compression
+ *                      COMP_CODE_NONE = 0
+ *                      COMP_CODE_RLE  = 1
+ *                      COMP_CODE_NBIT = 2
+ *                      COMP_CODE_SKPHUFF = 3
+ *                      COMP_CODE_DEFLATE = 4
+ *                      COMP_CODE_SZIP = 5
+ *          SKPHUFF:
+ *          comp_prm[0] = skphuff_skp_size: size of individual elements for 
+ *                            Adaptive Huffman compression algorithm
+ *          GZIP:
+ *          comp_prm[0] = deflate_level:    GZIP  compression parameter
+ *          NBIT:
+ *          comp_prm[0] = nbit_sign_ext
+ *          comp_prm[1] = nbit_fill_one
+ *          comp_prm[2] = nbit_start_bit
+ *          comp_prm[3] = nbit_bit_len
+ *          SZIP:
+ *          comp_prm[0] = options_mask             IN
+ *          comp_prm[1] = pixels_per_block         IN
+ *          comp_prm[2] = pixels_per_scanline      OUT
+ *          comp_prm[3] = bits_per_pixel           OUT
+ *          comp_prm[4] = pixels                   OUT
+ * Returns: 0 on success, -1 on failure with error set
+ * Users:   HDF Fortran programmers          
+ *-------------------------------------------------------------------------*/
+
+    FRETVAL (intf)
+#ifdef PROTOTYPE
+       nscgcompress(intf *id, intf *comp_type, intf *comp_prm)
+#else
+       nscgcompress( id, comp_type, comp_prm)
+       intf *id;
+       intf *comp_type;
+       intf *comp_prm;
+#endif /* PROTOTYPE */
+{
+
+    comp_info c_info;         /* compression info     */
+    comp_coder_t c_type;              /* compression type definition */
+
+    int   CASE;
+    intn c_ret;
+    intf ret = -1;
+
+
+    c_ret = SDgetcompinfo(*id, &c_type, &c_info);
+    if (c_ret == 0) {
+    CASE = (int)c_type;
+    switch (CASE)  {
+
+       case COMP_CODE_NONE:       /* No compression */
+         *comp_type = 0;
+	  ret = 0;
+         break;
+    
+       case COMP_CODE_RLE:             /* RLE compression */
+         *comp_type = 1;
+	  ret = 0;
+         break;
+
+       case COMP_CODE_NBIT:      /* NBIT encoding */
+          *comp_type = 2;
+          comp_prm[0] = (intf)c_info.nbit.sign_ext; 
+          comp_prm[1] = (intf)c_info.nbit.fill_one; 
+          comp_prm[2] = (intf)c_info.nbit.start_bit; 
+          comp_prm[3] = (intf)c_info.nbit.bit_len; 
+	  ret = 0;
+          break;
+
+ 
+       case COMP_CODE_SKPHUFF:      /* Skipping Huffman encoding */
+          *comp_type = 3;
+          comp_prm[0] = (intf)c_info.skphuff.skp_size; 
+	  ret = 0;
+          break;
+
+       case COMP_CODE_DEFLATE:      /* GZIP compression */  
+          *comp_type = 4;
+          comp_prm[0] = (intf)c_info.deflate.level; 
+	  ret = 0;
+          break;
+
+       case COMP_CODE_SZIP:      /* SZIP encoding */
+          *comp_type = 5;
+          comp_prm[0] = (intf)c_info.szip.options_mask;
+          comp_prm[1] = (intf)c_info.szip.pixels_per_block;
+          comp_prm[2] = (intf)c_info.szip.pixels_per_scanline; 
+          comp_prm[3] = (intf)c_info.szip.bits_per_pixel; 
+          comp_prm[4] = (intf)c_info.szip.pixels; 
+	  ret = 0;
+          break;
+
+       default:
+
+          return FAIL;
+                    
+                     } /*end CASE */
+    } /* end if */
+    return(ret);
+
+}
+/*-----------------------------------------------------------------------------
+ * Name:    sfisrcrd
+ * Purpose: call SDisrecord to see if a dataset is a record variable
+ * Inputs:  id: sds id
+ * Returns: TRUE/FALSE (1/0))
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfisrcrd(intf *id)
+#else
+nsfisrcrd(id)
+     intf *id;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDisrecord(*id));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    sfsblsz
+ * Purpose: call SDsetblocksize
+ * Inputs:  id:          sd id
+            block_size:  block size  in bytes
+ * Returns: SUCCEED/FAIL (0/-1)
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nsfsblsz(intf *id, intf *block_size)
+#else
+nsfsblsz(id, block_size)
+     intf *id;
+     intf *block_size;
+#endif /* PROTOTYPE */
+{
+    return((intf) SDsetblocksize(*id, *block_size));
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scchempty
+ * Purpose: call SDcheckempty
+ * Inputs:  id:          sd id
+            flag:        TRUE/FALSE flag 
+ * Returns: SUCCEED/FAIL (0/-1)
+ *---------------------------------------------------------------------------*/
+ 
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscchempty(intf *id, intf *flag)
+#else
+nscchempty(id, flag)
+     intf *id;
+     intf *flag;
+#endif /* PROTOTYPE */
+{
+    intn flag_c;
+    intf status;
+    status = SDcheckempty(*id, &flag_c);
+    *flag = flag_c;
+    return(status);
+}   
+/*-----------------------------------------------------------------------------
+ * Name:    scgetfname
+ * Purpose: Retrieves the name of the file given file identifier
+ * Inputs:  file_id: file identifier
+ * Outputs: file_name: file name 
+ *          namelen: length of file name
+ * Returns: real length on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgetfname(intf *file_id, _fcd name, intf *namelen)
+#else
+nscgetfname(file_id, name, namelen)
+     intf *file_id;
+     _fcd name;
+     intf *namelen;
+#endif /* PROTOTYPE */
+
+{
+    char *fn;
+    intn ret;
+    
+    fn = NULL;
+    if(*namelen) fn = (char *)HDmalloc((uint32)*namelen + 1);
+
+    ret = (intn) SDgetfilename(*file_id, fn);
+    HDpackFstring(fn,  _fcdtocp(name),  *namelen);    
+    
+    if(fn) HDfree((VOIDP)fn);
+    return(ret);
+}
+
+/*-----------------------------------------------------------------------------
+ * Name:    scgetnamelen
+ * Purpose: Retrieves the length of the object name
+ * Inputs:  obj_id: object identifier
+ * Outputs: namelen: name length
+ * Returns: 0 on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgetnamelen(intf *obj_id, intf *namelen)
+#else
+nscgetnamelen(obj_id, namelen)
+     intf *obj_id;
+     intf *namelen;
+#endif /* PROTOTYPE */
+
+{
+    intn    ret;
+    uint16  c_namelen;
+    
+    ret = (intn) SDgetnamelen(*obj_id, &c_namelen);
+
+    *namelen = (intf)c_namelen; 
+    return(ret);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scidtype
+ * Purpose: Retrieves type pf the object give an identifier
+ * Inputs:  obj_id: object identifier
+ * Outputs: obj_type: object type  -1 for invalide
+ *                                  0 for file
+ *                                  1 for data set
+ *                                  2 for dimension scale
+ * Returns: 0 on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscidtype(intf *obj_id, intf *obj_type)
+#else
+nscidtype(obj_id, obj_type)
+     intf *obj_id;
+     intf *obj_type;
+#endif /* PROTOTYPE */
+
+{
+    intn    ret = -1;
+    hdf_idtype_t  c_obj_type;;
+    
+    c_obj_type = SDidtype(*obj_id);
+
+    *obj_type = (intf)c_obj_type; 
+    if (c_obj_type >= 0) ret = 0;
+    return(ret);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scrmaxopenf
+ * Purpose: Resets the max numebr of files can be opened at the same time
+ * Inputs:  req_max: requested max number of files
+ * Returns: current max number of opened files on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscrmaxopenf(intf *req_max)
+#else
+nscrmaxopenf(req_max)
+     intf *req_max;
+#endif /* PROTOTYPE */
+
+{
+    intf    cur_max;
+    
+    cur_max = (intf) SDreset_maxopenfiles(*req_max);
+    return(cur_max);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scgmaxopenf
+ * Purpose: Retrieves current and maximum number of open files. 
+ * Outputs: cat_max: current max of opened files
+ *          sys_limit: system limit on open files
+ * Returns: 0 on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgmaxopenf(intf *cur_max, intf *sys_limit)
+#else
+nscgmaxopenf(cur_max, sys_limit)
+     intf *cur_max;
+     intf *sys_limit;
+#endif /* PROTOTYPE */
+
+{
+    intf ret = 0;
+    intn c_cur_max, c_sys_limit;
+    
+    ret = (intf) SDget_maxopenfiles(&c_cur_max, &c_sys_limit);
+    if (ret < 0) return(FAIL);
+    *cur_max = (intf)c_cur_max;
+    *sys_limit = (intf)c_sys_limit;
+    return(ret);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scgnumopenf
+ * Purpose: Returns the number of files currently being opened
+ * Outputs: cur_num: number of files currently being opened
+ * Returns: 0 on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgnumopenf(intf *cur_num)
+#else
+nscgnumopenf(cur_num)
+     intf *cur_num;
+#endif /* PROTOTYPE */
+
+{
+    intf    ret = 0;
+    intn    c_cur_num;
+    
+    c_cur_num = SDget_numopenfiles();
+    if (c_cur_num < 1) ret = -1;
+    *cur_num = (intf)c_cur_num;
+    return(ret);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scn2indices
+ * Purpose: Retrieves indices of all variables with the same name. 
+ * Inputs:  sd_id: SD interface identifier
+ *          sds_name: data set name
+ *          namelen:  length of the name
+ *          n_vars:   number of variables (sizes of var_list and type_list 
+ *                    arrays)
+ * Outputs: var_list: list of indices
+ *          type_list: list of types         
+ * Returns: 0 on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscn2indices(intf *sd_id, _fcd name, intf *namelen, intf *var_list, intf *type_list, intf *n_vars)
+#else
+nscn2indices(sd_id, name, namelen, var_list, type_list, n_vars)
+     intf *sd_id;
+     _fcd name;
+     intf *namelen;
+     intf *var_list;
+     intf *type_list;
+     intf *n_vars;
+#endif /* PROTOTYPE */
+
+{
+    char   *fn;
+    intn    ret;
+    hdf_varlist_t *c_var_list; 
+    int idx;
+    
+    fn = HDf2cstring(name, *namelen);
+    if (!fn) return(FAIL);
+    c_var_list = (hdf_varlist_t *)HDmalloc(*n_vars * sizeof(hdf_varlist_t));
+    if (!c_var_list) return(FAIL);
+
+    ret = (intn) SDnametoindices(*sd_id, fn, c_var_list);
+    
+    if (ret == 0) {
+	    for (idx = 0; idx < *n_vars; idx++) {
+         	var_list[idx] = (intf)c_var_list[idx].var_index;
+         	type_list[idx] = (intf)c_var_list[idx].var_type;
+    	    }
+    } /*endif*/
+    HDfree(c_var_list);
+    HDfree((VOIDP)fn);
+    return(ret);
+}
+/*-----------------------------------------------------------------------------
+ * Name:    scgnvars_byname
+ * Purpose: Gets the number of data sets having the same name
+ * Inputs:  sd_id: SD interface identifier
+ *          sds_name: data set name
+ *          namelen:  length of the name
+ * Outputs: n_vars: number of data sets
+ * Returns: 0 on success, -1 on failure 
+ *---------------------------------------------------------------------------*/
+
+   FRETVAL(intf)
+#ifdef PROTOTYPE
+nscgnvars_byname(intf *sd_id, _fcd name, intf *namelen, intf *n_vars)
+#else
+nscgnvars_byname(sd_id, name, namelen, n_vars)
+     intf *sd_id;
+     _fcd name;
+     intf *namelen;
+     intf *n_vars;
+#endif /* PROTOTYPE */
+
+{
+    char   *fn;
+    int32   c_n_vars;
+    intn    ret;
+    
+    fn = HDf2cstring(name, *namelen);
+    if (!fn) return(FAIL);
+
+    ret = (intn) SDgetnumvars_byname(*sd_id, fn, &c_n_vars);
+
+    HDfree((VOIDP)fn);
+    if(ret == FAIL) return FAIL;
+    *n_vars = (intf)c_n_vars;
+    return(ret);
+}
+
+
diff --git a/mfhdf/fortran/mfsdf.h b/mfhdf/fortran/mfsdf.h
new file mode 100644
index 0000000..e2eb922
--- /dev/null
+++ b/mfhdf/fortran/mfsdf.h
@@ -0,0 +1,188 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _MFSDF_H_
+#define _MFSDF_H_
+
+#include "H4api_adpt.h"
+
+#include "mfhdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Define the FORTRAN names */
+
+#   define nscstart      H4_F77_FUNC(scstart, SCSTART)
+#   define nsfend        H4_F77_FUNC(sfend, SFEND)
+#   define nsfendacc     H4_F77_FUNC(sfendacc, SFENDACC)
+#   define nsffinfo      H4_F77_FUNC(sffinfo, SFFINFO)
+#   define nsfselect     H4_F77_FUNC(sfselect, SFSELECT)
+#   define nscginfo      H4_F77_FUNC(scginfo, SCGINFO)
+#   define nscgainfo     H4_F77_FUNC(scgainfo, SCGAINFO)
+#   define nscgdinfo     H4_F77_FUNC(scgdinfo, SCGDINFO)
+#   define nsfgcal       H4_F77_FUNC(sfgcal, SFGCAL)
+#   define nsfscal       H4_F77_FUNC(sfscal, SFSCAL)
+#   define nsfgdscale    H4_F77_FUNC(sfgdscale, SFGDSCALE)
+#   define nsfsdscale    H4_F77_FUNC(sfsdscale, SFSDSCALE)
+#   define nsfgcfill     H4_F77_FUNC(sfgcfill, SFGCFILL)
+#   define nsfgfill      H4_F77_FUNC(sfgfill, SFGFILL)
+#   define nsfscfill     H4_F77_FUNC(sfscfill, SFSCFILL)
+#   define nsfsfill      H4_F77_FUNC(sfsfill, SFSFILL)
+#   define nsfsflmd      H4_F77_FUNC(sfsflmd, SFSFLMD)
+#   define nsfgrange     H4_F77_FUNC(sfgrange, SFGRANGE)
+#   define nsfsrange     H4_F77_FUNC(sfsrange, SFSRANGE)
+#   define nscn2index    H4_F77_FUNC(scn2index, SCN2INDEX)
+#   define nsccreate     H4_F77_FUNC(sccreate, SCCREATE)
+#   define nscsdimstr    H4_F77_FUNC(scsdimstr, SCSDIMSTR)
+#   define nscsdimname   H4_F77_FUNC(scsdimname, SCSDIMNAME)
+#   define nscsdatstr    H4_F77_FUNC(scsdatstr, SCSDATSTR)
+#   define nsfdimid      H4_F77_FUNC(sfdimid, SFDIMID)
+#   define nsfrcatt      H4_F77_FUNC(sfrcatt, SFRCATT)
+#   define nsfrnatt      H4_F77_FUNC(sfrnatt, SFRNATT)
+#   define nsfrattr      H4_F77_FUNC(sfrattr, SFRATTR)
+#   define nsfrcdata     H4_F77_FUNC(sfrcdata, SFRCDATA)
+#   define nsfrdata      H4_F77_FUNC(sfrdata, SFRDATA)
+#   define nsfwcdata     H4_F77_FUNC(sfwcdata, SFWCDATA)
+#   define nsfwdata      H4_F77_FUNC(sfwdata, SFWDATA)
+#   define nscgdatstrs   H4_F77_FUNC(scgdatstrs, SCGDATSTRS)
+#   define nscgdimstrs   H4_F77_FUNC(scgdimstrs, SCGDIMSTRS)
+#   define nscscatt      H4_F77_FUNC(scscatt, SCSCATT)
+#   define nscsnatt      H4_F77_FUNC(scsnatt, SCSNATT)
+#   define nscsattr      H4_F77_FUNC(scsattr, SCSATTR)
+#   define nscfattr      H4_F77_FUNC(scfattr, SCFATTR)
+#   define nsfid2ref     H4_F77_FUNC(sfid2ref, SFID2REF)
+#   define nsfref2index  H4_F77_FUNC(sfref2index, SFREF2INDEX)
+#   define nsfiscvar     H4_F77_FUNC(sfiscvar, SFISCVAR)
+#   define nscsextf      H4_F77_FUNC(scsextf, SCSEXTF)
+#   define nsfsacct      H4_F77_FUNC(sfsacct, SFSACCT)
+#   define nsfsdmvc      H4_F77_FUNC(sfsdmvc, SFSDMVC)
+#   define nsfisdmvc     H4_F77_FUNC(sfisdmvc, SFISDMVC)
+#   define nsfisrcrd     H4_F77_FUNC(sfisrcrd, SFISRCRD)
+#   define nscgichnk     H4_F77_FUNC(scgichnk, SCGICHNK)
+#   define nscrcchnk     H4_F77_FUNC(scrcchnk, SCRCCHNK)
+#   define nscrchnk      H4_F77_FUNC(scrchnk, SCRCHNK)
+#   define nscscchnk     H4_F77_FUNC(scscchnk, SCSCCHNK)
+#   define nscschnk      H4_F77_FUNC(scschnk, SCSCHNK)
+#   define nscwcchnk     H4_F77_FUNC(scwcchnk, SCWCCHNK) 
+#   define nscwchnk      H4_F77_FUNC(scwchnk, SCWCHNK)
+#   define nscscompress  H4_F77_FUNC(scscompress, SCSCOMPRESS)
+#   define nscgcompress  H4_F77_FUNC(scgcompress, SCGCOMPRESS)
+#   define nsfsnbit      H4_F77_FUNC(sfsnbit, SFSNBIT)
+#   define nsfsblsz      H4_F77_FUNC(sfsblsz, SFSBLSZ)
+#   define nscchempty    H4_F77_FUNC(scchempty, SCCHEMPTY)
+#   define nscgetfname   H4_F77_FUNC(scgetfname,SCGETFNAME)
+#   define nscgetnamelen H4_F77_FUNC(scgetnamelen,SCGETNAMELEN)
+#   define nscidtype     H4_F77_FUNC(scidtype,SCIDTYPE)
+#   define nscgnvars_byname H4_F77_FUNC(scgnvars_byname,SCGNVARS_BYNAME)
+#   define nscn2indices  H4_F77_FUNC(scn2indices,SCN2INDICES)
+#   define nscgmaxopenf  H4_F77_FUNC(scgmaxopenf,SCGMAXOPENF)
+#   define nscgnumopenf  H4_F77_FUNC(scgnumopenf,SCGNUMOPENF)
+#   define nscrmaxopenf  H4_F77_FUNC(scrmaxopenf,SCRMAXOPENF)
+
+HDFFCLIBAPI FRETVAL(intf) nscstart(_fcd name, intf *access, intf *namelen);
+HDFFCLIBAPI FRETVAL(intf) nscginfo(intf *id, _fcd name, intf *rank, 
+                intf *dimsizes, intf *nt, intf *nattr, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscn2index(intf *id, _fcd name, intf *namelen);
+HDFFCLIBAPI FRETVAL(intf) nsccreate(intf *id, _fcd name, intf *nt, intf *rank, 
+                        intf *dims, intf *namelen);
+HDFFCLIBAPI FRETVAL(intf) nscsdimstr(intf *id, _fcd l, _fcd u, _fcd f, intf *ll, 
+                        intf *ul, intf *fl);
+HDFFCLIBAPI FRETVAL(intf) nscsdimname(intf *id, _fcd name, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscsdatstr(intf *id, _fcd l, _fcd u, _fcd f, _fcd c, 
+                        intf *ll, intf *ul, intf *fl, intf *cl);
+HDFFCLIBAPI FRETVAL(intf) nscgdimstrs(intf *dim, _fcd label, _fcd unit, 
+                      _fcd format,intf *llabel,intf *lunit, 
+                      intf *lformat, intf *mlen);
+HDFFCLIBAPI FRETVAL(intf) nscgdatstrs(intf *id, _fcd label, _fcd unit,
+                 _fcd format, _fcd coord, intf *llabel, intf *lunit,
+                   intf *lformat, intf *lcoord, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscgainfo(intf *id, intf *number, _fcd name, intf *nt, 
+                   intf *count, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscgdinfo(intf *id, _fcd name, intf *sz, intf *nt, 
+                   intf *nattr, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscscatt(intf *id, _fcd name, intf *nt, intf *count,
+                    _fcd data, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscsnatt(intf *id, _fcd name, intf *nt, intf *count, VOIDP data, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscsattr(intf *id, _fcd name, intf *nt, intf *count, 
+                       VOIDP data, intf *len);
+HDFFCLIBAPI FRETVAL(intf) nscsextf(intf *id, _fcd name, intf *offset,
+                       intf *namelen);
+HDFFCLIBAPI FRETVAL (intf) nscgichnk(intf *id, intf *dim_length, intf *flags);
+HDFFCLIBAPI FRETVAL (intf) nscrcchnk(intf *id, intf *start, _fcd char_data);
+HDFFCLIBAPI FRETVAL (intf) nscrchnk(intf *id, intf *start, VOIDP num_data);
+HDFFCLIBAPI FRETVAL (intf) nscscchnk(intf *id, intf *maxcache, intf *flags);
+HDFFCLIBAPI FRETVAL (intf) nscschnk(intf *id, intf *dim_length, intf *comp_type,
+                intf *comp_prm);
+HDFFCLIBAPI FRETVAL (intf) nscwcchnk(intf *id, intf *start, _fcd char_data);
+HDFFCLIBAPI FRETVAL (intf) nscwchnk(intf *id, intf *start, VOIDP num_data);
+HDFFCLIBAPI FRETVAL (intf) nscscompress(intf *id, intf *comp_type, intf *comp_prm);
+HDFFCLIBAPI FRETVAL(intf) nscgcompress(intf *id, intf *comp_type, intf *comp_prm);
+HDFFCLIBAPI FRETVAL(intf) nscfattr(intf *id, _fcd name, intf *namelen); 
+HDFFCLIBAPI FRETVAL(intf) nscchempty(intf *id, intf *flag);
+
+HDFFCLIBAPI FRETVAL(intf) nscgnvars_byname(intf *sd_id, _fcd name, intf *namelen, intf *n_vars);
+HDFFCLIBAPI FRETVAL(intf) nscn2indices(intf *sd_id, _fcd name, intf *namelen, intf *var_list, intf *type_list, intf *n_vars);
+HDFFCLIBAPI FRETVAL(intf) nscgnumopenf(intf *cur_num);
+HDFFCLIBAPI FRETVAL(intf) nscgmaxopenf(intf *cur_max, intf *sys_limit);
+HDFFCLIBAPI FRETVAL(intf) nscrmaxopenf(intf *req_max);
+HDFFCLIBAPI FRETVAL(intf) nscidtype(intf *obj_id, intf *obj_type);
+HDFFCLIBAPI FRETVAL(intf) nscgetnamelen(intf *obj_id, intf *namelen);
+HDFFCLIBAPI FRETVAL(intf) nscgetfname(intf *file_id, _fcd name, intf *namelen);
+
+HDFFCLIBAPI FRETVAL(intf) nsfend(intf *file_id);
+HDFFCLIBAPI FRETVAL(intf) nsfendacc(intf *id);
+HDFFCLIBAPI FRETVAL(intf) nsffinfo(intf *file_id, intf *datasets, intf *gattr);
+HDFFCLIBAPI FRETVAL(intf) nsfselect(intf *file_id, intf *index);
+HDFFCLIBAPI FRETVAL(intf) nsfdimid(intf *id, intf *index);
+HDFFCLIBAPI FRETVAL(intf) nsfgcal(intf *id, float64 *cal, float64 *cale, 
+                float64 *ioff, float64 *ioffe, intf *nt);
+HDFFCLIBAPI FRETVAL(intf) nsfscal(intf *id, float64 *cal, float64 *cale,
+                float64 *ioff, float64 *ioffe, intf *nt);
+HDFFCLIBAPI FRETVAL(intf) nsfsdscale(intf *id, intf *count, intf *nt, VOIDP values);
+HDFFCLIBAPI FRETVAL(intf) nsfgdscale(intf *id, VOIDP values);
+HDFFCLIBAPI FRETVAL(intf) nsfscfill(intf *id, _fcd val);
+HDFFCLIBAPI FRETVAL(intf) nsfgcfill(intf *id, _fcd val);
+HDFFCLIBAPI FRETVAL(intf) nsfsfill(intf *id, VOIDP val);
+HDFFCLIBAPI FRETVAL(intf) nsfgfill(intf *id, VOIDP val);
+HDFFCLIBAPI FRETVAL(intf) nsfgrange(intf *id, VOIDP max, VOIDP min);
+HDFFCLIBAPI FRETVAL(intf) nsfsrange(intf *id, VOIDP max, VOIDP min);
+HDFFCLIBAPI FRETVAL(intf) nsfrcatt(intf *id, intf *index, _fcd buf);
+HDFFCLIBAPI FRETVAL(intf) nsfrnatt(intf *id, intf *index, VOIDP buf);
+HDFFCLIBAPI FRETVAL(intf) nsfrattr(intf *id, intf *index, VOIDP buf);
+HDFFCLIBAPI FRETVAL(intf) nsfrdata(intf *id, intf *start, intf *stride, 
+                       intf *end, VOIDP values);
+HDFFCLIBAPI FRETVAL(intf) nsfwdata(intf *id, intf *start, intf *stride, 
+                       intf *end, VOIDP values);
+HDFFCLIBAPI FRETVAL(intf) nsfrcdata(intf *id, intf *start, intf *stride, 
+                       intf *end, _fcd values);
+HDFFCLIBAPI FRETVAL(intf) nsfwcdata(intf *id, intf *start, intf *stride, 
+                       intf *end, _fcd values);
+HDFFCLIBAPI FRETVAL(intf) nsfid2ref(intf *id);
+HDFFCLIBAPI FRETVAL(intf) nsfref2index(intf *id, intf *ref);
+HDFFCLIBAPI FRETVAL(intf) nsfiscvar(intf *id);
+HDFFCLIBAPI FRETVAL(intf) nsfsnbit(intf *id, intf *start_bit, intf *bit_len,
+                       intf *sign_ext, intf *fill_one);
+HDFFCLIBAPI FRETVAL(intf) nsfsacct(intf *id, intf *type);
+HDFFCLIBAPI FRETVAL(intf) nsfsdmvc(intf *id, intf *compmode);
+HDFFCLIBAPI FRETVAL(intf) nsfisdmvc(intf *id);
+HDFFCLIBAPI FRETVAL(intf) nsfsflmd(intf *id, intf *fillmode);
+HDFFCLIBAPI FRETVAL(intf) nsfisrcrd(intf *id);
+HDFFCLIBAPI FRETVAL(intf) nsfsblsz(intf *id, intf *block_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MFSDF_H_ */
diff --git a/mfhdf/fortran/mfsdff.f b/mfhdf/fortran/mfsdff.f
new file mode 100644
index 0000000..cca064f
--- /dev/null
+++ b/mfhdf/fortran/mfsdff.f
@@ -0,0 +1,806 @@
+C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+C  Copyright by The HDF Group.                                               *
+C  Copyright by the Board of Trustees of the University of Illinois.         *
+C  All rights reserved.                                                      *
+C                                                                            *
+C  This file is part of HDF.  The full HDF copyright notice, including       *
+C  terms governing use, modification, and redistribution, is contained in    *
+C  the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C  of the source code distribution tree; Copyright.html can be found at      *
+C  http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C  access to either file, you may request a copy from help at hdfgroup.org.     *
+C * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+C
+C $Id: mfsdff.f 5167 2009-01-26 01:55:18Z epourmal $
+C
+
+C----------------------------------------------------------------------
+C     Name: sdfstart
+C     Purpose:  call scstart, open file
+C     Inputs:   path: Name of file to be opened
+C               access: DFACC_READ, DFACC_WRITE, DFACC_CREATE,
+C               or any bitwise-or of the above.
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfstart(filename, access)
+
+      character*(*) filename
+      integer       access, scstart
+
+      sfstart = scstart(filename, access, len(filename))
+      return
+      end
+
+
+C----------------------------------------------------------------------
+C     Name: sdfn2index
+C     Purpose:  call scn2index to return an index
+C     Inputs:   id: file
+C               name: name of data set
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfn2index(id, name)
+
+      character*(*) name
+      integer       id, scn2index
+
+      sfn2index = scn2index(id, name, len(name))
+      return
+      end
+
+
+C----------------------------------------------------------------------
+C     Name: sfcreate
+C     Purpose:  call sccreate to create a new dataset
+C     Inputs:   id: file
+C               name: name of data set
+C               nt: number type
+C               rank: rank
+C               dims: sizes of dimensions
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfcreate(id, name, nt, rank, dims)
+
+      character*(*) name
+      integer       id, nt, rank, sccreate
+      integer       dims(*)
+
+      sfcreate = sccreate(id, name, nt, rank, dims, len(name))
+      return
+      end
+
+
+C----------------------------------------------------------------------
+C Name:     sfsdmstr
+C Purpose:  set strings for this dimension
+C Inputs:   id: dimension id
+C           label,unit,format: strings to be set
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfsdmstr(id, label, unit, format)
+
+      character*(*) label, unit, format
+      integer len, id
+      integer scsdimstr
+
+      sfsdmstr = scsdimstr(id, label, unit, format,
+     +     len(label), len(unit), len(format))
+      
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfsdmname
+C Purpose:  set name of this dimension
+C Inputs:   id: dimension id
+C           name: the name 
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfsdmname(id, name)
+
+      character*(*) name
+      integer len, id
+      integer scsdimname
+
+      sfsdmname = scsdimname(id, name, len(name))
+      
+      return
+      end
+        
+
+C----------------------------------------------------------------------
+C Name:     sfsdtstr
+C Purpose:  set strings for this data set
+C Inputs:   id: dimension id
+C           label,unit,format,coordsys: strings to be set
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfsdtstr(id, l, u, f, c)
+
+      character*(*) l, u, f, c
+      integer len, id
+      integer scsdatstr
+
+      sfsdtstr = scsdatstr(id, l, u, f, c,
+     +     len(l), len(u), len(f), len(c))
+     
+      return
+      end
+   
+
+C----------------------------------------------------------------------
+C Name:     sfgdtstr
+C Purpose:  get strings for this data set
+C Inputs:   id: dimension id
+C Outputs:  label,unit,format,coordsys: strings to be gotten
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function sfgdtstr(id, label, unit, format, coord, mlen)
+
+      character*(*) label, unit, format, coord
+      integer len, id, mlen
+      integer scgdatstrs
+
+      sfgdtstr = scgdatstrs(id, label, unit, format, coord,
+     +     len(label), len(unit), len(format), len(coord), mlen)
+      
+      return
+      end
+   
+C----------------------------------------------------------------------
+C Name:     sfgdmstr
+C Purpose:  get strings for this dimension
+C Inputs:   id: dimension id
+C Outputs:  label,unit,format: strings to be gotten
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfgdmstr(id, label, unit, format, mlen)
+
+      character*(*) label, unit, format
+      integer len, id
+      integer scgdimstrs
+
+      sfgdmstr = scgdimstrs(id, label, unit, format,
+     +     len(label), len(unit), len(format), mlen)
+      
+      return
+      end
+   
+C----------------------------------------------------------------------
+C Name:     sfginfo
+C Purpose:  get basic info about this data set
+C Inputs:   id: dataset id
+C Outputs:  name, rank, nt, dims, nattrs
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfginfo(id, name, rank, dims, nt, nattr)
+
+      character*(*) name
+      integer rank, nt, nattr
+      integer dims(*)
+      integer scginfo, len
+
+      sfginfo = scginfo(id, name, rank, dims, nt, nattr, len(name))
+      
+      return
+      end
+   
+C----------------------------------------------------------------------
+C Name:     sfgainfo
+C Purpose:  get basic info about an attribute
+C Inputs:   id: dataset id
+C           number: attribute number
+C Outputs:  name, nt, count
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfgainfo(id, number, name, nt, count)
+
+      character*(*) name
+      integer nt, number
+      integer scgainfo, len
+
+      sfgainfo = scgainfo(id, number, name, nt, count, len(name))
+      
+      return
+      end
+   
+
+C----------------------------------------------------------------------
+C Name:     sfgdinfo
+C Purpose:  get basic info about a dimension
+C Inputs:   id: dim id
+C Outputs:  name, nt, sz, nattr
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfgdinfo(id, name, sz, nt, nattr)
+
+      character*(*) name
+      integer sz, nt, nattr
+      integer scgdinfo, len
+
+      sfgdinfo = scgdinfo(id, name, sz, nt, nattr, len(name))
+      
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfscatt
+C Purpose:  create (or modify an existing) char attribute
+C Inputs:   id: id of object to attribute-ize
+C Outputs:  name, nt, count, data
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfscatt(id,name,nt,count,data)
+
+      character*(*) name, data
+      integer nt
+      integer scscatt, len
+
+      sfscatt = scscatt(id,name,nt,count,data,len(name))
+      
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfsnatt
+C Purpose:  create (or modify an existing) numeric attribute
+C Inputs:   id: id of object to attribute-ize
+C Outputs:  name, nt, count, data
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C----------------------------------------------------------------------
+
+      integer function  sfsnatt(id, name, nt, count, data)
+
+      character*(*) name
+      integer nt, data
+      integer scsnatt, len
+
+      sfsnatt = scsnatt(id, name, nt, count, data, len(name))
+      
+      return
+      end
+
+C----------------------------------------------------------------------
+C Name:     sfsattr
+C Purpose:  for backward compatability. Calls scsattr to 
+C           create (or modify an existing) attribute
+C Inputs:   id: id of object to attribute-ize
+C Outputs:  name, nt, count, data
+C Returns:  0 on success, -1 on failure with DFerror set
+C Users:    HDF Fortran programmers
+C Remarks:  This function should be phased out in the future.
+C----------------------------------------------------------------------
+
+      integer function  sfsattr(id, name, nt, count, data)
+
+      character*(*) name, data
+      integer nt
+      integer scsattr, len
+
+      sfsattr = scsattr(id, name, nt, count, data, len(name))
+      
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name: sffattr
+C     Purpose:  call scfattr, find an attribute
+C     Inputs:   id: Object to look at
+C               name: name of attribute
+C     Returns: attribute number on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sffattr(id, name)
+
+      character*(*) name
+      integer       id, scfattr
+
+      sffattr = scfattr(id, name, len(name))
+      return
+      end
+
+
+C----------------------------------------------------------------------
+C     Name: sfsextf
+C     Purpose:  call scsextf to store data in an external file
+C     Inputs:   id: sds id
+C               fname: name of external file
+C               offset: Number of bytes from the beginning of the
+C                       external file to where the data starts
+C     Returns: 0 on success, FAIL on failure with error set
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfsextf(id, fname, offset)
+
+      character*(*) fname
+      integer       id, offset, scsextf
+
+      sfsextf = scsextf(id, fname, offset, len(fname))
+      return
+      end
+C-------------------------------------------------------------------------
+C        Name:      sfgichnk
+C        Purpose:   get Info on SDS
+C        Inputs:    id       - data set ID
+C        Outputs:   dim_length - chunk dimensions (if any)
+C                   comp_flag: 
+C                               -1 - SDS is non-chunked
+C                                0 - SDS is chunked without compression
+C                                1 - SDS is chunked and compressed with
+C                                    RLE, GZIP, SZIP or SKPHUFF 
+C                                2 - SDS is chunked and compressed with
+C                                    NBIT
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scgichnk (C stub for SDgetchunkinfo function)
+C-------------------------------------------------------------------------
+
+         integer function sfgichnk(id, dim_length, comp_flag)
+
+         integer id, dim_length(*), comp_flag
+         integer scgichnk 
+
+         sfgichnk = scgichnk(id, dim_length, comp_flag)
+         return
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      sfrcchnk
+C        Purpose:   read the specified chunk of CHARACTER data to the SDS 
+C        Inputs:    id       - data set ID
+C                   start    - chunk coordinates 
+C                   char_data - buffer the data will be read into  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scrcchnk (C stub for SDreadchunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         integer function sfrcchnk(id, start, char_data)
+C
+         integer id, start(*)
+         character*(*) char_data(*)
+         integer scrcchnk 
+C
+         sfrcchnk = scrcchnk(id, start, char_data) 
+C
+         return 
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      sfrchnk
+C        Purpose:   read the specified chunk of NUMERIC data to the SDS 
+C        Inputs:    id       - data set ID
+C                   start    - chunk coordinates 
+C                   num_data - buffer the  numeric data will be read into  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scrchnk (C stub for SDreadchunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         integer function sfrchnk(id, start, num_data)
+C
+         integer id, start(*), num_data(*)
+         integer scrchnk 
+C
+         sfrchnk = scrchnk(id, start, num_data) 
+C
+         return 
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      sfscchnk
+C        Purpose:   set the maximum number of chunks to cache
+C        Inputs:    id       - data set ID
+C                   maxcache - max number of chunks to cache 
+C                   flags    - flags =0, HDF_CACHEALL
+C                              Currently only 0 can be passed.
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scscchnk (C stub for SDsetchunkcache function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         integer function sfscchnk(id, maxcache, flags)
+C
+         integer id, maxcache, flags 
+         integer scscchnk 
+C
+         sfscchnk = scscchnk(id, maxcache, flags) 
+C
+         return 
+         end
+
+           
+
+C-------------------------------------------------------------------------
+C        Name:      sfschnk
+C        Purpose:   make the SDS a chunked SDS
+C        Inputs:    id       - data set ID
+C                   dim_length - chunk dimensions
+C                   comp_type - type of compression    
+C                   supports the following compression types:
+C                            ( see hcomp.h  file) 
+C                            COMP_CODE_NONE = 0
+C                            COMP_CODE_RLE = 1
+C                            COMP_CODE_NBIT = 2 
+C                            COMP_CODE_SKPHUFF = 3
+C                            COMP_CODE_DEFLATE = 4 
+C                            COMP_CODE_SZIP = 5
+C                   comp_prm  - compression parameters array
+C        For
+C        Adaptive Huffman 
+C                   comp_prm(1) = skphuff_skp_size
+C        GZIP       
+C                   comp_prm(1) = deflate_level
+C        NBIT
+C                   comp_prm(1) = nbit_sign_ext
+C                   comp_prm(2) = nbit_fill_one
+C                   comp_prm(3) = nbit_start_bit
+C                   comp_prm(4) = nbit_bit_len 
+C         
+C        SZIP
+C                   comp_prm(1) = options_mask
+C                   comp_prm(2) = pixels_per_block 
+C        NOTE: IT IS USER's responsibility to pass correct compression
+C              parameters for each type of compression
+C
+C                       
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scschnk (C stub for SDsetchunk function)
+C-------------------------------------------------------------------------
+
+         integer function sfschnk(id, dim_length, comp_type,comp_prm)
+
+         integer id, dim_length(*), comp_type, comp_prm(*)
+         integer scschnk 
+
+         sfschnk = scschnk(id, dim_length, comp_type, comp_prm)
+         return
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      sfwcchnk
+C        Purpose:   write the specified chunk of CHARACTER data to the SDS 
+C        Inputs:    id       - data set ID
+C                   start    - chunk coordinates 
+C                   char_data - buffer containing  data to be written  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scwcchnk (C stub for SDwritechunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         integer function sfwcchnk(id, start, char_data)
+C
+         integer id, start(*) 
+         character*(*) char_data(*)
+         integer scwcchnk 
+C
+         sfwcchnk = scwcchnk(id, start, char_data) 
+C
+         return 
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      sfwchnk
+C        Purpose:   write the specified chunk of NUMERIC data to the SDS 
+C        Inputs:    id       - data set ID
+C                   start    - chunk coordinates 
+C                   num_data - buffer containing data to be written  
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scwchnk (C stub for SDwritechunk function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         integer function sfwchnk(id, start, num_data)
+C
+         integer id, start(*), num_data(*)
+         integer scwchnk 
+C
+         sfwchnk = scwchnk(id, start, num_data) 
+C
+         return 
+         end
+
+           
+C-------------------------------------------------------------------------
+C        Name:      sfscompress
+C        Purpose:   compress SDS 
+C        Inputs:    id       - data set ID
+C                   comp_type - type of compression
+C                   supports the following compression types:
+C                            ( see hcomp.h  file) 
+C                            COMP_CODE_NONE = 0
+C                            COMP_CODE_RLE =1
+C                            COMP_CODE_SKPHUFF = 3
+C                            COMP_CODE_DEFLATE = 4 
+C                            COMP_CODE_SZIP =  5
+C                   comp_prm - compression parameter array:
+C                   comp_prm(1) = deflate_level for GZIP
+C                   comp_prm(1) = skphuff_skp_size for ADAPTIVE HUFFMAN
+C                   comp_prm(1) = options_mask for SZIP
+C                   comp_prm(2) = bits_per_block for SZIP
+C        NOTE: IT IS USER's responsibility to pass correct compression
+C              parameters for each type of compression
+C
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scscompress (C stub for SDsetcompress function)
+C-------------------------------------------------------------------------
+
+         integer function sfscompress(id, comp_type,comp_prm)
+
+         integer id, comp_type, comp_prm(*)
+         integer scscompress 
+         sfscompress = scscompress(id, comp_type, comp_prm)
+         return
+         end
+
+C-------------------------------------------------------------------------
+C        Name:      sfgcompress
+C        Purpose:   get compression information about  SDS 
+C        Inputs:    id       - data set ID
+C        Output:    comp_type - type of compression
+C                   supports the following compression types:
+C                            ( see hcomp.h  file) 
+C                            COMP_CODE_NONE = 0
+C                            COMP_CODE_RLE =1
+C                            COMP_CODE_SKPHUFF = 3
+C                            COMP_CODE_DEFLATE = 4 
+C                            COMP_CODE_SZIP =  5
+C                   comp_prm - compression parameter array:
+C                   comp_prm(1) = deflate_level for GZIP
+C                   comp_prm(1) = skphuff_skp_size for ADAPTIVE HUFFMAN
+C                   comp_prm(1) = options_mask for SZIP
+C                   comp_prm(2) = bits_per_block for SZIP
+C                   comp_prm(3) = pixels_per_scanline for SZIP
+C                   comp_prm(4) = bits_per_pixel for SZIP
+C                   comp_prm(5) = pixels for SZIP
+C        NOTE: IT IS USER's responsibility to pass correct compression
+C              parameters for each type of compression
+C
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scgcompress (C stub for SDsetcompress function)
+C-------------------------------------------------------------------------
+
+         integer function sfgcompress(id, comp_type,comp_prm)
+
+         integer id, comp_type, comp_prm(*)
+         integer scgcompress 
+         sfgcompress = scgcompress(id, comp_type, comp_prm)
+         return
+         end
+
+
+C-------------------------------------------------------------------------
+C        Name:      sfchempty
+C        Purpose:   checks whether an SDS is empty ( data has not been written) 
+C        Inputs:    id       - data set ID
+C        Outputs:   flag     - 1 if SDS is empty, 0 otherwise
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scchempty (C stub for SDcheckempty function)
+C        Users:     HDF Fortran programmers
+C-------------------------------------------------------------------------
+
+         integer function sfchempty(id, flag)
+C
+         integer id, flag 
+         integer scchempty 
+C
+         sfchempty = scchempty(id, flag) 
+C
+         return 
+         end
+           
+C----------------------------------------------------------------------
+C     Name:     sfgetfname
+C     Purpose:  Retrieves the name of the file given file identifier
+C     Inputs:   file_id: file identifier
+C     Input/Outputs: filename: character variable to hold 
+C                    the name of the file
+C     Returns:  the length of the name if successfull, -1 if fails
+C     Calls:    scgetfname
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfgetfname(file_id, filename)
+
+      character*(*) filename
+      integer       file_id
+      integer       scgetfname
+
+      sfgetfname = scgetfname(file_id, filename, len(filename))
+      return
+      end
+
+C-------------------------------------------------------------------------
+C        Name:      sfgetnamelen
+C        Purpose:   Retrieves the length of the name of 
+C                   a file, a dataset, or a dimension.
+C        Inputs:    obj_id   - object identifier
+C        Outputs:   length   - length of the object's name
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scgetnamelen
+C        Users:     Fortran stub routine
+C-------------------------------------------------------------------------
+
+      integer function sfgetnamelen(obj_id, length)
+C
+      integer obj_id, length
+      integer scgetnamelen
+C
+      sfgetnamelen = scgetnamelen(obj_id, length) 
+C
+      return 
+      end
+
+C-------------------------------------------------------------------------
+C        Name:      sfidtype
+C        Purpose:   Returns the type of object
+C        Inputs:    obj_id   - object identifier
+C        Outputs:   obj_type - type of the object
+C                       Can be one of the following
+C                      -1 - if obj_id is not valid SD type
+C                       0 - SD (file)
+C                       1 - SDS (data set)
+C                       2 - DIM_ID (dimension scale)
+C                       see mfhdf.h file for definition of hdf_idtype_t
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scidtype
+C        Users:     Fortran stub routine
+C-------------------------------------------------------------------------
+
+      integer function sfidtype(obj_id, obj_type)
+C
+      integer obj_id, obj_type
+      integer scidtype
+C
+      sfidtype = scidtype(obj_id, obj_type) 
+C
+      return 
+      end
+           
+C----------------------------------------------------------------------
+C     Name:     sfgnvars_byname
+C     Purpose:  Gets the number of data sets having the same name
+C     Inputs:   sd_id: SD interface identifier 
+C               sds_name:  name of a data set
+C     Output:   n_vars: number of data sets with name "name"
+C     Returns:  0 on success, -1 on failure
+C     Calls:    scgnvars_byname
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfgnvars_byname(sd_id, sds_name, n_vars)
+
+      character*(*) sds_name
+      integer       sd_id, n_vars
+      integer       scgnvars_byname
+
+      sfgnvars_byname = scgnvars_byname(sd_id, sds_name, 
+     +                  len(sds_name),
+     +                  n_vars)
+      return
+      end
+
+C----------------------------------------------------------------------
+C     Name:     sfn2indices
+C     Purpose:  Retrieves indices and types of all variables with 
+C               the same name
+C     Inputs:   sd_id: SD interface identifier 
+C               sds_name:  name of a data set
+C     Input/Output:   var_list: array to store indices 
+C                     type_list: array to store variable type
+C                                elements may have values 
+C                                0 - for data set,
+C                                1 - for dimension scale
+C                                2 - unknown type
+C     Returns:  0 on success, -1 on failure
+C     Calls:    scn2indices
+C     Users:    Fortran stub routine
+C----------------------------------------------------------------------
+
+      integer function sfn2indices(sd_id, sds_name, var_list, 
+     +                            type_list, n_vars)
+
+      character*(*) sds_name
+      integer       sd_id
+      integer       var_list(*), type_list(*)
+      integer       n_vars
+      integer       scn2indices
+
+      sfn2indices = scn2indices(sd_id, sds_name, len(sds_name), 
+     +                    var_list, type_list, n_vars)
+      return
+      end
+
+C-------------------------------------------------------------------------
+C        Name:      sfgmaxopenf
+C        Purpose:   Retrieves current and maximum number of open files 
+C        Outputs:   cur_max: current number of open files 
+C                   sys_limit: maximum number of open files 
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scgmaxopenf
+C        Users:     Fortran stub routine
+C-------------------------------------------------------------------------
+
+      integer function sfgmaxopenf(cur_max, sys_limit)
+C
+      integer cur_max, sys_limit
+      integer scgmaxopenf
+C
+      sfgmaxopenf = scgmaxopenf(cur_max, sys_limit) 
+C
+      return 
+      end
+           
+C-------------------------------------------------------------------------
+C        Name:      sfgnumopenf
+C        Purpose:   Returns the number of files currently being opened
+C        Outputs:   cur_num: current number of open files 
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scgnumopenf
+C        Users:     Fortran stub routine
+C-------------------------------------------------------------------------
+
+      integer function sfgnumopenf(cur_num)
+C
+      integer cur_num
+      integer scgnumopenf
+C
+      sfgnumopenf = scgnumopenf(cur_num) 
+C
+      return 
+      end
+           
+C-------------------------------------------------------------------------
+C        Name:      sfrmaxopenf
+C        Purpose:   Resets the maximum number of files can be opened 
+C                   at the same time
+C        Outputs:   req_max: requested maximum number of opened files allowed 
+C        Returns:   0 on success, -1 on failure
+C        Calls:     scrmaxopenf
+C        Users:     Fortran stub routine
+C-------------------------------------------------------------------------
+
+      integer function sfrmaxopenf(req_max)
+C
+      integer req_max
+      integer scrmaxopenf
+C
+      sfrmaxopenf = scrmaxopenf(req_max) 
+C
+      return 
+      end
+           
+           
+           
+           
diff --git a/mfhdf/fortran/netcdf.inc.in b/mfhdf/fortran/netcdf.inc.in
new file mode 100644
index 0000000..6920c86
--- /dev/null
+++ b/mfhdf/fortran/netcdf.inc.in
@@ -0,0 +1,147 @@
+c      
+c     Functions in the FORTRAN interface
+
+      integer nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
+      integer ncsfil
+      external nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
+      external ncsfil
+
+      integer NCRDWR,NCCREAT,NCEXCL,NCINDEF,NCNSYNC,NCHSYNC
+      integer NCNDIRTY,NCHDIRTY,NCLINK,NCNOWRIT,NCWRITE
+      integer NCCLOB,NCNOCLOB,NCGLOBAL,NCFILL,NCNOFILL
+      integer MAXNCOP,MAXNCDIM,MAXNCATT,MAXNCVAR
+      integer MAXNCNAM,MAXVDIMS,NCNOERR,NCEBADID
+      integer NCENFILE,NCEEXIST,NCEINVAL,NCEPERM,NCENOTIN
+      integer NCEINDEF,NCECOORD,NCEMAXDS,NCENAME
+      integer NCENOATT,NCEMAXAT,NCEBADTY,NCEBADD, NCESTS
+      integer NCEUNLIM,NCEMAXVS,NCENOTVR,NCEGLOB,NCENOTNC
+      integer NCFOOBAR,NCSYSERR,NCFATAL,NCVERBOS, NCENTOOL
+      
+      integer NCBYTE,NCCHAR,NCSHORT,NCLONG,NCFLOAT,NCDOUBLE
+      
+      parameter(NCBYTE = 1)
+      parameter(NCCHAR = 2)
+      parameter(NCSHORT = 3)
+      parameter(NCLONG = 4)
+      parameter(NCFLOAT = 5)
+      parameter(NCDOUBLE = 6)
+      
+c     
+c     masks for the struct NC flag field; passed in as 'mode' arg to
+c     nccreate and ncopen.
+c     
+      
+c     read/write, 0 => readonly 
+      parameter(NCRDWR = 1)
+c     in create phase, cleared by ncendef 
+      parameter(NCCREAT = 2)
+c     on create destroy existing file 
+      parameter(NCEXCL = 4)
+c     in define mode, cleared by ncendef 
+      parameter(NCINDEF = 8)
+c     synchronise numrecs on change (X'10')
+      parameter(NCNSYNC = 16)
+c     synchronise whole header on change (X'20')
+      parameter(NCHSYNC = 32)
+c     numrecs has changed (X'40')
+      parameter(NCNDIRTY = 64)
+c     header info has changed (X'80')
+      parameter(NCHDIRTY = 128)
+c     prefill vars on endef and increase of record, the default behavior
+      parameter(NCFILL = 0)
+c     don't fill vars on endef and increase of record (X'100')
+      parameter(NCNOFILL = 256)
+c     isa link (X'8000')
+      parameter(NCLINK = 32768)
+      
+c     
+c     'mode' arguments for nccreate and ncopen
+c     
+      
+      parameter(NCNOWRIT = 0)
+      parameter(NCWRITE = NCRDWR)
+      parameter(NCCLOB = 11)
+      parameter(NCNOCLOB = 15)
+c     
+c     'size' argument to ncdimdef for an unlimited dimension
+c     
+      integer NCUNLIM
+      parameter(NCUNLIM = 0)
+      
+c     
+c     attribute id to put/get a global attribute
+c     
+      parameter(NCGLOBAL  = 0)
+c     
+c     Advisory Maximums
+c     
+      parameter(MAXNCOP = 32)
+      parameter(MAXNCDIM = 32)
+      parameter(MAXNCATT = 512)
+      parameter(MAXNCVAR = 512)
+c     Not enforced 
+      parameter(MAXNCNAM = 128)
+      parameter(MAXVDIMS = MAXNCDIM)
+      
+      
+c     
+c     The netcdf data types
+c     
+      
+c     
+c     Global netcdf error status variable
+c     Initialized in error.c
+c     
+      
+c     No Error 
+      parameter(NCNOERR = 0)
+c     Not a netcdf id 
+      parameter(NCEBADID = 1)
+c     Too many netcdfs open 
+      parameter(NCENFILE = 2)
+c     netcdf file exists && NCNOCLOB
+      parameter(NCEEXIST = 3)
+c     Invalid Argument 
+      parameter(NCEINVAL = 4)
+c     Write to read only 
+      parameter(NCEPERM = 5)
+c     Operation not allowed in data mode 
+      parameter(NCENOTIN = 6)
+c     Operation not allowed in define mode 
+      parameter(NCEINDEF = 7)
+c     Coordinates out of Domain 
+      parameter(NCECOORD = 8)
+c     MAXNCDIMS exceeded 
+      parameter(NCEMAXDS = 9)
+c     String match to name in use 
+      parameter(NCENAME = 10)
+c     Attribute not found 
+      parameter(NCENOATT = 11)
+c     MAXNCATTRS exceeded 
+      parameter(NCEMAXAT = 12)
+c     Not a netcdf data type 
+      parameter(NCEBADTY = 13)
+c     Invalid dimension id 
+      parameter(NCEBADD = 14)
+c     NCUNLIMITED in the wrong index 
+      parameter(NCEUNLIM = 15)
+c     MAXNCVARS exceeded 
+      parameter(NCEMAXVS = 16)
+c     Variable not found 
+      parameter(NCENOTVR = 17)
+c     Action prohibited on NCGLOBAL varid 
+      parameter(NCEGLOB = 18)
+c     Not a netcdf file 
+      parameter(NCENOTNC = 19)
+      parameter(NCESTS = 20)
+      parameter (NCENTOOL = 21)
+      parameter(NCFOOBAR = 32)
+      parameter(NCSYSERR = -1)
+      
+      
+c     
+c     Global options variable. Used to determine behavior of error handler.
+c     Initialized in lerror.c
+c     
+      parameter(NCFATAL = 1)
+      parameter(NCVERBOS = 2)
diff --git a/mfhdf/fortran/test_nc.cdl b/mfhdf/fortran/test_nc.cdl
new file mode 100644
index 0000000..fb432e9
--- /dev/null
+++ b/mfhdf/fortran/test_nc.cdl
@@ -0,0 +1,42 @@
+netcdf new {
+dimensions:
+	x    = 2;
+	y    = 3;
+	time = UNLIMITED ; // (12 currently)
+variables:
+        float a(x,y);
+	int date(time) ;
+	int time(time) ;
+        short b(time, y, x);
+        double c(y);
+// global attributes:
+    :Description = "Attributes";
+    :int_attr = -100, 200, -300, 400, -500;
+    :float_attr = 1.f, 2.f, 3.f;
+    :short_attr = 0s, 1s;
+    :double_attr = -1.d, 2.d, -7.d;
+
+data:
+ a = 1.0, 2.0, 3.0, 4.0, 5.0, 6.0;
+
+ date = 840116, 840214, 840316, 840415, 840516, 840615, 840716, 840816, 
+    840915, 841016, 841115, 841216 ;
+
+ time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ;
+  
+ b = 1, 1, 2, 2, 3, 3,
+     4, 4, 5, 5, 6, 6,
+     7, 7, 8, 8, 9, 9,
+    10, 10, 11, 11, 12, 12,
+    13, 13, 14, 14, 15, 15,
+    16, 16, 17, 17, 18, 18,
+    19, 19, 20, 20, 21, 22,
+    23, 23, 24, 24, 25, 25,
+    26, 26, 27, 27, 28, 28,
+    29, 29, 30, 30, 31, 31,
+    32, 32, 33, 33, 34, 34,
+    35, 35, 36, 36, 37, 37 ;
+ 
+ c = 2.d, 3.d, 100.d;
+
+}
diff --git a/mfhdf/fortran/test_nc.nc b/mfhdf/fortran/test_nc.nc
new file mode 100644
index 0000000..b2d2b1b
Binary files /dev/null and b/mfhdf/fortran/test_nc.nc differ
diff --git a/mfhdf/fortran/testfortran.sh.in b/mfhdf/fortran/testfortran.sh.in
new file mode 100755
index 0000000..172fb3b
--- /dev/null
+++ b/mfhdf/fortran/testfortran.sh.in
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Tests for the Fortran interfaces
+
+srcdir=@srcdir@
+TEST_FORTRAN_NETCDF="@TEST_FORTRAN_NETCDF@"
+CMP='cmp -s'
+DIFF='diff -c'
+
+nerrors=0
+verbose=yes
+
+# Print message with formats according to message level ($1)
+MESG() {
+  level=$1
+  shift
+  case $level in
+    0)
+      echo '============================='
+      echo $*
+      echo '============================='
+      ;;
+    3)
+      echo '-----------------------------'
+      echo $*
+      echo '-----------------------------'
+      ;;
+    6)
+      echo "*** $* ***"
+      ;;
+    *)
+      echo "MESG(): Unknown level ($level)"
+      exit 1
+      ;;
+  esac
+}
+
+
+# Report the result and exit
+FINISH()
+{
+    if [ $nerrors -eq 0 ]
+    then
+        MESG 0 "All Fortran interfaces tests passed"
+    else
+        MESG 0 "Fortran interfaces tests failed: $nerrors"
+    fi
+    exit $nerrors
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+   SPACES="                                                               "
+   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Run a test and print PASS or *FAIL*.  If a test fails then increment
+# the `nerrors' global variable
+#
+RUN() {
+   # Run test.
+
+   MESG 0 "HDF-SD Fortran interfaces tests"
+   ${TESTS_ENVIRONMENT} ./hdftest
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+
+   ${TESTS_ENVIRONMENT} ./hdftest1
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+
+   if test $TEST_FORTRAN_NETCDF = "yes"; then
+      MESG 0 "HDF-NetCDF Fortran interfaces tests"
+      ${TESTS_ENVIRONMENT} ./ftest
+      RET=$?
+      if [ $RET -eq 1 ]; then
+         echo "*FAILED*"
+         nerrors="`expr $nerrors + 1`"
+      fi
+   else
+      MESG 0 "HDF-NetCDF Fortran interfaces are disabled when library is built with --disable-netcdf"
+   fi
+
+   MESG 0 "SZIP Fortran interfaces tests"
+   ${TESTS_ENVIRONMENT} ./tszip
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+}
+
+##############################################################################
+###                       T H E   T E S T S                                ###
+##############################################################################
+
+# Print a beginning banner
+MESG 0 "Running Fortran interfaces tests"
+
+# compare output
+RUN
+
+# End of test, return exit code
+FINISH
+    
diff --git a/mfhdf/fortran/tszip.f b/mfhdf/fortran/tszip.f
new file mode 100644
index 0000000..d9d1e17
--- /dev/null
+++ b/mfhdf/fortran/tszip.f
@@ -0,0 +1,403 @@
+C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+C  Copyright by The HDF Group.                                               *
+C  Copyright by the Board of Trustees of the University of Illinois.         *
+C  All rights reserved.                                                      *
+C                                                                            *
+C  This file is part of HDF.  The full HDF copyright notice, including       *
+C  terms governing use, modification, and redistribution, is contained in    *
+C  the files COPYING and Copyright.html.  COPYING can be found at the root   *
+C  of the source code distribution tree; Copyright.html can be found at      *
+C  http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+C  access to either file, you may request a copy from help at hdfgroup.org.     *
+C * * * * * * * * *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+         program test_szip
+         implicit none
+C
+C------- Begin Variables declarations -----------------------------------
+C
+         integer   N_COMP_ARG, N_TYPES
+         parameter (N_COMP_ARG = 5, N_TYPES = 4)
+         integer   sd_id, sds_id(N_TYPES), sds_index(N_TYPES)
+         integer   type(N_TYPES)
+         integer   RANK, comp_type, comp_type_out
+         integer   comp_arg(N_COMP_ARG), comp_prm_out(5)
+         integer   d_dims(2)
+         integer   start(2), stride(2), edges(2)
+         integer   status
+         integer   err_szip
+         character*14 file
+         character*17 name(4)
+         integer   n, m, n_part, m_part
+         integer   n_part_stride, m_part_stride
+         integer   n_part_start, m_part_start
+         integer   n_stride, m_stride
+         integer   n_start, m_start
+         integer   n_edges, m_edges
+         integer   i, j, l, kl, kj, i_comp
+C
+C  SDS functions declarations
+         include 'mffunc.inc'
+         external hconfinf
+         integer  hconfinf
+C
+C  Initial data declarations( change if you which to test larger arrays )
+C
+C  Data array dimensions n and m and RANK
+C
+         parameter (n = 12, m = 4, RANK = 2)
+
+C
+C  Part data dimensions n_part, m_part
+C
+         parameter (n_part = 5, m_part = 2)
+C
+C  Stride and start coordinates of part_data
+C
+         parameter (n_part_stride = 1, m_part_stride = 1)
+         parameter (n_part_start = 2, m_part_start = 1)
+C
+C  Sart, stride  and edges parameters in each dimension
+C
+         parameter (n_start = 0, m_start = 0)
+         parameter (n_stride = 1, m_stride = 1)
+         parameter (n_edges = n, m_edges = m)
+C
+C  Data declaration
+C
+         integer*2 data2(n,m), data2_out(n_part,m_part)
+         integer*4 data4(n,m), data4_out(n_part,m_part)
+         real*4    rdata4(n,m), rdata4_out(n_part,m_part)
+         real*8    rdata8(n,m), rdata8_out(n_part,m_part)
+C
+C  HDF parameters initialization
+C
+C
+C  Read/Write parameters
+C
+         integer   DFACC_CREATE,
+     .             DFACC_WRITE,
+     .             DFACC_READ
+         parameter (DFACC_CREATE = 4,
+     .             DFACC_READ   =  1,
+     .             DFACC_WRITE   = 2)
+C
+C  Data type parameters
+C
+         integer    DFNT_INT16,
+     .              DFNT_INT32,
+     .              DFNT_FLOAT32,
+     .              DFNT_FLOAT64
+         parameter (DFNT_INT16  = 22,
+     .              DFNT_INT32   = 24,
+     .              DFNT_FLOAT32 = 5,
+     .              DFNT_FLOAT64 = 6)
+C
+C  Compression parametes
+C
+         integer   COMP_CODE_SZIP,
+     .             SZ_EC_OPTION_MASK,
+     .             SZ_NN_OPTION_MASK
+
+         parameter (COMP_CODE_SZIP   = 5,
+     .              SZ_EC_OPTION_MASK = 4,
+     .              SZ_NN_OPTION_MASK = 32)
+C
+C  Compression arguments ( defined for clarity, actual values
+C  will be passed to SFSCHUNK function via comp_arg parameter)
+C
+         integer pixels_per_block 
+         parameter (pixels_per_block = 12)
+
+C--------------------End of declarations------------------------------
+C
+C-------------------IS SZIP compression present with encoder?--------
+         integer info
+         err_szip = 0
+
+         comp_type = COMP_CODE_SZIP
+         status = hconfinf(comp_type, info)    
+         if(status .LT. 0) then
+            err_szip = err_szip + 1         
+            goto 1111
+         endif 
+         if(info .EQ. 0 ) then
+          print *,'Skipping test_szip: compression is not available'
+          print *,' '
+          goto 3333
+         endif
+
+       if(info .EQ. 1) then
+         print *,'Skipping test_szip: szip encoding is not available'
+          print *,' '
+         goto 3333
+       endif
+            
+C
+C
+C  We will write to five different files corresponding to the 
+C  different compression types
+C
+C  NO compression
+C 
+         file = 'comp_szip.hdf'
+         name(1) = 'szip_data_int16'
+         name(2) = 'szip_data_int32'
+         name(3) = 'szip_data_float32'
+         name(4) = 'szip_data_float64'
+         type(1) = DFNT_INT16
+         type(2) = DFNT_INT32
+         type(3) = DFNT_FLOAT32
+         type(4) = DFNT_FLOAT64
+C
+C   Dimension sizes array initialization
+C
+         d_dims(1) = n
+         d_dims(2) = m
+C        
+C   Initilize original array
+C
+         
+         do 20 j = 1, m 
+            do 10 i = 1, n
+               data2(i,j) = 10*j + i
+               data4(i,j) = 10*j + i
+               rdata4(i,j) = 10*j + i
+               rdata8(i,j) = 10*j + i
+10          continue
+20       continue
+C
+C  Initialize SD interfaces
+C
+        sd_id = sfstart (file, DFACC_CREATE)
+C
+C  Set compression type and compression arguments
+C
+C
+C   Initialize compression arguments array
+C
+         comp_type   = COMP_CODE_SZIP
+         comp_arg(1) = SZ_NN_OPTION_MASK
+         comp_arg(2) = pixels_per_block
+C
+C  Main loop through different compression types
+C
+         do 1000 i_comp = 1, N_TYPES
+
+C
+C        Create the data set
+C
+         sds_id(i_comp) = sfcreate(sd_id, name(i_comp), 
+     .                     type(i_comp), RANK, d_dims)
+            if( sds_id(i_comp) .eq. -1 ) then
+                print *, 'sfcreate failed for', i_comp, ' -th dataset'
+                err_szip = err_szip + 1
+            endif
+         status = sfscompress(sds_id(i_comp), comp_type, comp_arg)
+          if( status .ne. 0 ) then
+            print *, 'sfscompress failed for', i_comp, ' -th dataset'
+            err_szip = err_szip + 1
+          endif
+C
+C   Write data to the file
+C
+                start(1) = n_start
+                start(2) = m_start
+                stride(1) = n_stride
+                stride(2) = m_stride
+                edges(1)  = n_edges
+                edges(2)  = m_edges
+                if (i_comp .eq. 1) then
+                status = sfwdata(sds_id(i_comp), start, stride,
+     .                           edges, data2)
+                endif
+                if (i_comp .eq. 2) then
+                status = sfwdata(sds_id(i_comp), start, stride,
+     .                           edges, data4)
+                endif
+                if (i_comp .eq. 3) then
+                status = sfwdata(sds_id(i_comp), start, stride,
+     .                           edges, rdata4)
+                endif
+                if (i_comp .eq. 4) then
+                status = sfwdata(sds_id(i_comp), start, stride,
+     .                           edges, rdata8)
+                endif
+            if( status .ne. 0 ) then
+                print *, 'sfwdata failed for', i_comp, ' -th dataset'
+                err_szip = err_szip + 1
+            endif
+         
+         status = sfendacc(sds_id(i_comp))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i_comp, ' -th dataset'
+                err_szip = err_szip + 1
+            endif
+1000      continue 
+         status = sfend (sd_id)
+            if( status .ne. 0 ) then
+                print *, 'sfend failed'
+                err_szip = err_szip + 1
+            endif
+
+C
+C   Let's check what we have written 
+C
+C   Open files and restart SD interfaces
+C
+         sd_id = sfstart (file, DFACC_READ)
+            if( sd_id .eq. -1 ) then
+                print *, 'sfstart failed'
+                err_szip = err_szip + 1
+            endif
+         do 2000 i = 1, N_TYPES
+        
+C
+C  Find written dataset in each file using its name and index
+C
+            sds_index(i) = sfn2index (sd_id, name(i))
+            if( sds_index(i) .eq. -1 ) then
+                print *, 'sfn2index failed for', i, ' -th dataset'
+                err_szip = err_szip + 1
+            endif
+            sds_id(i)    = sfselect (sd_id, sds_index(i))
+            if( sds_id(i) .eq. -1 ) then
+                print *, 'sfselect failed for', i, ' -th dataset'
+                err_szip = err_szip + 1
+            endif
+C
+C  Find out type of compression used and compression parameters.
+C
+            status = sfgcompress(sds_id(i), comp_type_out, comp_prm_out)
+	    if (status .eq. -1) then
+            print *, 'sfgcompress failed for', i, ' -th dataset'
+                err_szip = err_szip + 1
+            endif
+                if (comp_type_out .ne. COMP_CODE_SZIP) then
+            print *, 'wrong compression type for szip 
+     .                compressed dataset'
+                err_szip = err_szip + 1
+                endif
+C            write(*,*) comp_arg(1), comp_prm_out(1)
+C            write(*,*) comp_arg(2), comp_prm_out(2)
+C            write(*,*) comp_prm_out(3)
+C            write(*,*) comp_prm_out(4)
+C            write(*,*) comp_prm_out(5)
+            
+C                if ((comp_arg(1) .ne. comp_prm_out(1)) .or. 
+C     .              (comp_arg(2) .ne. comp_prm_out(2))) then
+C            print *, 'wrong compression parameter'
+C                err_szip = err_szip + 1
+C                endif
+
+C
+C   Read part of the data back using sfrdata function
+C
+         start(1) = n_part_start
+         start(2) = m_part_start
+         edges(1) = n_part
+         edges(2) = m_part
+         stride(1) = n_part_stride 
+         stride(2) = m_part_stride 
+                if (i .eq. 1) then
+                status = sfrdata(sds_id(i), start, stride,
+     .                           edges, data2_out)
+                endif
+                if (i .eq. 2) then
+                status = sfrdata(sds_id(i), start, stride,
+     .                           edges, data4_out)
+                endif
+                if (i .eq. 3) then
+                status = sfrdata(sds_id(i), start, stride,
+     .                           edges, rdata4_out)
+                endif
+                if (i .eq. 4) then
+                status = sfrdata(sds_id(i), start, stride,
+     .                           edges, rdata8_out)
+                endif
+             if (status .ne. 0) then
+                 print *, 'sfrdata failed for reading part data for ',
+     .           i, '-th dataset'
+             err_szip = err_szip + 1
+             endif
+C
+C   Compare output with actual data
+C
+         if (i .eq. 1) then
+         do 204 j = 1, m_part
+            do 203 l = 1, n_part
+               kl = n_part_start + 1 + (l-1)*n_part_stride
+               kj = m_part_start + 1 + (j-1)*m_part_stride
+               if (data2(kl, kj) .ne. data2_out(l,j)) then
+                  print *, 'sfrdata read wrong data for ', 
+     .            i ,'-th dataset'
+               err_szip = err_szip +1
+               endif 
+203         continue
+204      continue
+         endif
+         if (i .eq. 2) then
+         do 206 j = 1, m_part
+            do 205 l = 1, n_part
+               kl = n_part_start + 1 + (l-1)*n_part_stride
+               kj = m_part_start + 1 + (j-1)*m_part_stride
+               if (data4(kl, kj) .ne. data4_out(l,j)) then
+                  print *, 'sfrdata read wrong data for ', 
+     .            i ,'-th dataset'
+               err_szip = err_szip +1
+               endif 
+205         continue
+206      continue
+         endif
+         if (i .eq. 3) then
+         do 208 j = 1, m_part
+            do 207 l = 1, n_part
+               kl = n_part_start + 1 + (l-1)*n_part_stride
+               kj = m_part_start + 1 + (j-1)*m_part_stride
+               if (rdata4(kl, kj) .ne. rdata4_out(l,j)) then
+                  print *, 'sfrdata read wrong data for ', 
+     .            i ,'-th dataset'
+               err_szip = err_szip +1
+               endif 
+207         continue
+208      continue
+         endif
+         if (i .eq. 4) then
+         do 210 j = 1, m_part
+            do 209 l = 1, n_part
+               kl = n_part_start + 1 + (l-1)*n_part_stride
+               kj = m_part_start + 1 + (j-1)*m_part_stride
+               if (rdata8(kl, kj) .ne. rdata8_out(l,j)) then
+                  print *, 'sfrdata read wrong data for ', 
+     .            i ,'-th dataset'
+               err_szip = err_szip +1
+               endif 
+209         continue
+210      continue
+         endif
+         
+C 
+C  Terminate access to SDS, shutdown interfaces and close the files
+C
+           status = sfendacc(sds_id(i))
+            if( status .ne. 0 ) then
+                print *, 'sfendacc failed for', i, '-th dataset'
+                err_szip = err_szip + 1
+            endif
+2000   continue
+           status = sfend(sd_id)
+            if( status .ne. 0 ) then
+                print *, 'sfend failed'
+                err_szip = err_szip + 1
+            endif
+1111     continue
+         if (err_szip .ne. 0) then
+            print *, 'test_szip failed with ', err_szip, ' errors'
+            print *,' '
+         endif
+         if (err_szip .eq. 0) then
+            print *, 'test_szip.................. PASSED'
+            print *,' '
+         endif
+3333     continue
+         end
+
diff --git a/mfhdf/hdfimport/CMakeLists.txt b/mfhdf/hdfimport/CMakeLists.txt
new file mode 100644
index 0000000..42c1238
--- /dev/null
+++ b/mfhdf/hdfimport/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_HDFIMPORT)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+
+IF (WIN32 AND NOT CYGWIN)
+  SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:LIBCMT")
+ENDIF (WIN32 AND NOT CYGWIN)
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+SET (hdfimport_SRCS
+    ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/hdfimport.c
+)
+  
+ADD_EXECUTABLE (hdfimport ${hdfimport_SRCS})
+TARGET_C_PROPERTIES (hdfimport " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hdfimport ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hdfimport ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_NAMING (hdfimport ${LIB_TYPE})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+INSTALL_PROGRAM_PDB (hdfimport ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+
+INSTALL (
+    TARGETS
+        hdfimport
+    RUNTIME DESTINATION
+        ${HDF4_INSTALL_TOOLS_BIN_DIR}
+    COMPONENT
+        toolsapplications
+)
diff --git a/mfhdf/hdfimport/CMakeTests.cmake b/mfhdf/hdfimport/CMakeTests.cmake
new file mode 100644
index 0000000..3a7127e
--- /dev/null
+++ b/mfhdf/hdfimport/CMakeTests.cmake
@@ -0,0 +1,320 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+ 
+  #-- Copy all the dat files from the test directory into the source directory
+  SET (HDF4_REFERENCE_TEST_FILES
+      hdfimport.input1
+      hdfimport.out1
+#      hdfimport.out2
+      hdfimport.out3
+      SDSfloat2.hdf
+      SDSfloat3.hdf
+  )
+   
+  FOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+      SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+      #MESSAGE (STATUS " Copying ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
+      ADD_CUSTOM_COMMAND (
+          TARGET     hdfimport 
+          POST_BUILD
+          COMMAND    ${CMAKE_COMMAND}
+          ARGS       -E copy_if_different ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/${h4_file} ${dest}
+     )      
+  ENDFOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+  
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfimport
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/hdfimport-w.out2 ${PROJECT_BINARY_DIR}/hdfimport.out2
+    )
+  ELSE (WIN32 AND NOT CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdfimport
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/hdfimport.out2 ${PROJECT_BINARY_DIR}/hdfimport.out2
+    )
+  ENDIF (WIN32 AND NOT CYGWIN)
+ 
+  #-- Copy all the hdfls tst files from the test directory into the source directory
+  SET (HDF4_LS_TEST_FILES
+      ctxtr2.tst 
+      ctxtr3.tst 
+      cb32i2.tst 
+      cb32i3.tst 
+      cb16i2.tst 
+      cb16i3.tst 
+      cb32r2.tst 
+      cb32r3.tst 
+      cb64r2.tst 
+      cb64r3.tst 
+      cb64r2-n.tst 
+      cb64r3-n.tst 
+      ctxtr2_ris.tst
+      cb64r2_ris.tst
+      SDSfloat2.tst
+      SDSfloat3.tst
+  )
+   
+  FOREACH (ls_file ${HDF4_LS_TEST_FILES})
+      SET (dest "${PROJECT_BINARY_DIR}/${ls_file}")
+      #MESSAGE (STATUS " Copying ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/${ls_file} to ${PROJECT_BINARY_DIR}/")
+      ADD_CUSTOM_COMMAND (
+          TARGET     hdfimport 
+          POST_BUILD
+          COMMAND    ${CMAKE_COMMAND}
+          ARGS       -E copy_if_different ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/testfiles/${ls_file} ${dest}
+     )      
+  ENDFOREACH (ls_file ${HDF4_LS_TEST_FILES})
+
+  #-- hdfimporttest
+  SET (hdfimporttest_SRCS
+      ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/hdfimporttest.c
+  )
+  
+  ADD_EXECUTABLE (hdfimporttest ${hdfimporttest_SRCS})
+  TARGET_C_PROPERTIES (hdfimporttest " " " ")
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (hdfimporttest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (hdfimporttest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+  TARGET_NAMING (hdfimporttest ${LIB_TYPE})
+
+  #-- gen_sds_floats
+  SET (gen_sds_floats_SRCS
+      ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/gen_sds_floats.c
+  )
+  
+  ADD_EXECUTABLE (gen_sds_floats ${gen_sds_floats_SRCS})
+  TARGET_C_PROPERTIES (gen_sds_floats " " " ")
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (gen_sds_floats ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (gen_sds_floats ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+  TARGET_NAMING (gen_sds_floats ${LIB_TYPE})
+  
+##############################################################################
+##############################################################################
+###           T H E   T E S T S  M A C R O S                               ###
+##############################################################################
+##############################################################################
+
+  MACRO (ADD_H4_TEST resultfile resultcode testtfile testtype)
+    IF ( NOT ${testtype} STREQUAL "")
+      IF (${testtype} STREQUAL "N")
+        ADD_TEST (NAME HIMPORT-${testtfile} COMMAND $<TARGET_FILE:hdfimport> ${resultfile} -n -o ${testtfile}.hdf)
+      ENDIF (${testtype} STREQUAL "N")
+      IF (${testtype} STREQUAL "R")
+        ADD_TEST (NAME HIMPORT-${testtfile} COMMAND $<TARGET_FILE:hdfimport> ${resultfile} -o ${testtfile}.hdf -raster ${ARGN})
+      ENDIF (${testtype} STREQUAL "R")
+    ELSE ( NOT ${testtype} STREQUAL "")
+      ADD_TEST (NAME HIMPORT-${testtfile} COMMAND $<TARGET_FILE:hdfimport> ${resultfile} -o ${testtfile}.hdf)
+    ENDIF ( NOT ${testtype} STREQUAL "")
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HIMPORT-${testtfile} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HIMPORT-${testtfile} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HIMPORTLS-${testtfile} COMMAND $<TARGET_FILE:hdfls> -l ${testtfile}.hdf)
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HIMPORTLS-${testtfile}
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdfls>"
+              -D "TEST_ARGS:STRING=-l;${testtfile}.hdf"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+              -D "TEST_OUTPUT=${testtfile}.tmp"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_FILTER:STRING=(File library|String)[^\n]+\n"
+              -D "TEST_REFERENCE=${testtfile}.tst"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    SET_TESTS_PROPERTIES (HIMPORTLS-${testtfile} PROPERTIES DEPENDS HIMPORT-${testtfile} LABELS ${PROJECT_NAME})
+    SET (last_test "HIMPORTLS-${testtfile}")
+  ENDMACRO (ADD_H4_TEST)
+
+  MACRO (ADD_H4_TEST_OUT resultfile resultcode)
+    ADD_TEST (NAME HIMPORT-OUT-${resultfile} COMMAND $<TARGET_FILE:hdfimport> ${resultfile}.hdf -o ${resultfile}.out)
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HIMPORT-OUT-${resultfile} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HIMPORT-OUT-${resultfile} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HIMPORTLS-OUT-${resultfile} COMMAND $<TARGET_FILE:hdfls> ${resultfile}.out)
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HIMPORTLS-OUT-${resultfile}
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdfls>"
+              -D "TEST_ARGS:STRING=${resultfile}.out"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+              -D "TEST_OUTPUT=${resultfile}.tmp"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_FILTER:STRING=(File library|String)[^\n]+\n"
+              -D "TEST_REFERENCE=${resultfile}.tst"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    SET_TESTS_PROPERTIES (HIMPORTLS-OUT-${resultfile} PROPERTIES DEPENDS HIMPORT-OUT-${resultfile} LABELS ${PROJECT_NAME})
+    SET (last_test "HIMPORTLS-OUT-${resultfile}")
+  ENDMACRO (ADD_H4_TEST_OUT)
+
+  MACRO (ADD_H4_TEST_ED testfile resultfile resultcode)
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HIMPORT-EDIT COMMAND $<TARGET_FILE:hdfed> -batch)
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HIMPORT-EDIT
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdfed>"
+              -D "TEST_ARGS:STRING=-batch"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+              -D "TEST_INPUT=${testfile}"
+              -D "TEST_OUTPUT=${testfile}.tmp"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_REFERENCE=${resultfile}"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HIMPORT-EDIT PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HIMPORT-EDIT PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "HIMPORT-EDIT")
+  ENDMACRO (ADD_H4_TEST_ED)
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME hdfimport-clear-refs
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          ctxtr2 
+          ctxtr3 
+          cb32i2 
+          cb32i3 
+          cb16i2 
+          cb16i3 
+          cb32r2 
+          cb32r3 
+          cb64r2 
+          cb64r3 
+          cb64r2-n
+          cb64r3-n 
+          ctxtr2_ris
+          cb64r2_ris
+          ctxtr2.hdf 
+          ctxtr3.hdf 
+          cb32i2.hdf 
+          cb32i3.hdf 
+          cb16i2.hdf 
+          cb16i3.hdf 
+          cb32r2.hdf 
+          cb32r3.hdf 
+          cb64r2.hdf 
+          cb64r3.hdf 
+          cb64r2-n.hdf 
+          cb64r3-n.hdf 
+          ctxtr2_ris.hdf
+          cb64r2_ris.hdf
+          ctxtr2.tmp 
+          ctxtr3.tmp 
+          cb32i2.tmp 
+          cb32i3.tmp 
+          cb16i2.tmp 
+          cb16i3.tmp 
+          cb32r2.tmp 
+          cb32r3.tmp 
+          cb64r2.tmp 
+          cb64r3.tmp 
+          cb64r2-n.tmp 
+          cb64r3-n.tmp 
+          ctxtr2_ris.tmp
+          cb64r2_ris.tmp
+          SDSfloat2.tmp
+          SDSfloat3.tmp
+          ctxtr2.tmp.err 
+          ctxtr3.tmp.err 
+          cb32i2.tmp.err 
+          cb32i3.tmp.err 
+          cb16i2.tmp.err 
+          cb16i3.tmp.err 
+          cb32r2.tmp.err 
+          cb32r3.tmp.err 
+          cb64r2.tmp.err 
+          cb64r3.tmp.err 
+          cb64r2-n.tmp.err 
+          cb64r3-n.tmp.err 
+          ctxtr2_ris.tmp.err
+          cb64r2_ris.tmp.err
+          SDSfloat2.tmp.err
+          SDSfloat3.tmp.err
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfimport-clear-refs PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (hdfimport-clear-refs PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "hdfimport-clear-refs")
+
+  ADD_TEST (NAME HIMPORTtest COMMAND $<TARGET_FILE:hdfimporttest>)
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HIMPORTtest PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HIMPORTtest PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "HIMPORTtest")
+
+  # "Testing for 32-bit floating point ASCII (2D data)" 
+  ADD_H4_TEST (ctxtr2 0 ctxtr2 "")
+  # "Testing for 32-bit floating point ASCII (3D data)" 
+  ADD_H4_TEST (ctxtr3 0 ctxtr3 "")
+  # "Testing for 32-bit integer binary (2D data)" 
+  ADD_H4_TEST (cb32i2 0 cb32i2 "")
+  # "Testing for 32-bit integer  binary (3D data)" 
+  ADD_H4_TEST (cb32i3 0 cb32i3 "")
+  # "Testing for 16-bit integer binary (2D data)" 
+  ADD_H4_TEST (cb16i2 0 cb16i2 "")
+  # "Testing for 16-bit integer (3D data)" 
+  ADD_H4_TEST (cb16i3 0 cb16i3 "")
+  # "Testing for 32-bit floating point binary (2D data)" 
+  ADD_H4_TEST (cb32r2 0 cb32r2 "")
+  # "Testing for 32-bit floating point binary (3D data)" 
+  ADD_H4_TEST (cb32r3 0 cb32r3 "")
+  # "Testing for 64-bit floating point binary (2D data) - Default Behaviour (Conversion to 32 bit FP SDS)" 
+  ADD_H4_TEST (cb64r2 0 cb64r2 "")
+  # "Testing for 64-bit floating point binary (3D data) - Default Behaviour (Conversion to 32-bit FP SDS)" 
+  ADD_H4_TEST (cb64r3 0 cb64r3 "")
+  # "Testing for 64-bit floating point binary (2D data) - Conversion to 64-bit FP SDS" 
+  ADD_H4_TEST (cb64r2 0 cb64r2-n "N")
+  # "Testing for 64-bit floating point binary (3D data) - Conversion to 64-bit FP SDS" 
+  ADD_H4_TEST (cb64r3 0 cb64r3-n "N")
+  # "Testing for raster options" 
+  ADD_H4_TEST (ctxtr2 0 ctxtr2_ris "R" -e 50 50)
+  ADD_H4_TEST (cb64r2 0 cb64r2_ris "R" -i 50 50 -f)
+  #
+  # test with hdf files
+  # "Testing for reading from hdf files" 
+  ADD_H4_TEST_OUT (SDSfloat2 0)
+  ADD_H4_TEST_OUT (SDSfloat3 0)
+
+  ADD_H4_TEST_ED (hdfimport.input1 hdfimport.out2 0)
diff --git a/mfhdf/hdfimport/Makefile.am b/mfhdf/hdfimport/Makefile.am
new file mode 100644
index 0000000..83be126
--- /dev/null
+++ b/mfhdf/hdfimport/Makefile.am
@@ -0,0 +1,38 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+## Add hdfimport specific linker flags here
+hdfimport_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+##                      Libraries to link against                          ##
+#############################################################################
+
+LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+bin_PROGRAMS = hdfimport
+
+#############################################################################
+##                   Testing -- Here there be dragons.                     ##
+#############################################################################
+
+TEST_PROG = hdfimporttest
+TEST_SCRIPT = testutil.sh
+check_PROGRAMS = hdfimporttest gen_sds_floats
+check_SCRIPTS = testutil.sh
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/hdfimport/Makefile.in b/mfhdf/hdfimport/Makefile.in
new file mode 100644
index 0000000..f5db6aa
--- /dev/null
+++ b/mfhdf/hdfimport/Makefile.in
@@ -0,0 +1,824 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/testutil.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+bin_PROGRAMS = hdfimport$(EXEEXT)
+check_PROGRAMS = hdfimporttest$(EXEEXT) gen_sds_floats$(EXEEXT)
+TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT)
+subdir = mfhdf/hdfimport
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = testutil.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+gen_sds_floats_SOURCES = gen_sds_floats.c
+gen_sds_floats_OBJECTS = gen_sds_floats.$(OBJEXT)
+gen_sds_floats_LDADD = $(LDADD)
+gen_sds_floats_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+hdfimport_SOURCES = hdfimport.c
+hdfimport_OBJECTS = hdfimport.$(OBJEXT)
+hdfimport_LDADD = $(LDADD)
+hdfimport_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+hdfimport_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(hdfimport_LDFLAGS) $(LDFLAGS) -o $@
+hdfimporttest_SOURCES = hdfimporttest.c
+hdfimporttest_OBJECTS = hdfimporttest.$(OBJEXT)
+hdfimporttest_LDADD = $(LDADD)
+hdfimporttest_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = gen_sds_floats.c hdfimport.c hdfimporttest.c
+DIST_SOURCES = gen_sds_floats.c hdfimport.c hdfimporttest.c
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+am__EXEEXT_1 = hdfimporttest$(EXEEXT)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+hdfimport_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+#############################################################################
+LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+
+#############################################################################
+#############################################################################
+TEST_PROG = hdfimporttest
+TEST_SCRIPT = testutil.sh
+check_SCRIPTS = testutil.sh
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/hdfimport/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/hdfimport/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+testutil.sh: $(top_builddir)/config.status $(srcdir)/testutil.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+gen_sds_floats$(EXEEXT): $(gen_sds_floats_OBJECTS) $(gen_sds_floats_DEPENDENCIES) $(EXTRA_gen_sds_floats_DEPENDENCIES) 
+	@rm -f gen_sds_floats$(EXEEXT)
+	$(LINK) $(gen_sds_floats_OBJECTS) $(gen_sds_floats_LDADD) $(LIBS)
+hdfimport$(EXEEXT): $(hdfimport_OBJECTS) $(hdfimport_DEPENDENCIES) $(EXTRA_hdfimport_DEPENDENCIES) 
+	@rm -f hdfimport$(EXEEXT)
+	$(hdfimport_LINK) $(hdfimport_OBJECTS) $(hdfimport_LDADD) $(LIBS)
+hdfimporttest$(EXEEXT): $(hdfimporttest_OBJECTS) $(hdfimporttest_DEPENDENCIES) $(EXTRA_hdfimporttest_DEPENDENCIES) 
+	@rm -f hdfimporttest$(EXEEXT)
+	$(LINK) $(hdfimporttest_OBJECTS) $(hdfimporttest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gen_sds_floats.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfimport.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfimporttest.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool cscopelist ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-binPROGRAMS
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/hdfimport/SDSfloat2.hdf b/mfhdf/hdfimport/SDSfloat2.hdf
new file mode 100644
index 0000000..fc662be
Binary files /dev/null and b/mfhdf/hdfimport/SDSfloat2.hdf differ
diff --git a/mfhdf/hdfimport/SDSfloat3.hdf b/mfhdf/hdfimport/SDSfloat3.hdf
new file mode 100644
index 0000000..056dfc4
Binary files /dev/null and b/mfhdf/hdfimport/SDSfloat3.hdf differ
diff --git a/mfhdf/hdfimport/crtSDSfloats.c b/mfhdf/hdfimport/crtSDSfloats.c
new file mode 100644
index 0000000..64fae07
--- /dev/null
+++ b/mfhdf/hdfimport/crtSDSfloats.c
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group (THG).                                         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF copyright notice, including       *
+ * terms governing use, modification, and redistribution, is contained in    *
+ * the COPYING file and in the print documentation copyright notice.         *
+ * COPYING can be found at the root of the source code distribution tree;    *
+ * the copyright notice in printed HDF documentation can be found on the     *
+ * back of the title page.  If you do not have access to either version,     *
+ * you may request a copy from help at hdfgroup.org.                            *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "mfhdf.h"
+
+#define FILE2_NAME     "SDSfloat2.hdf" 
+#define FILE3_NAME     "SDSfloat3.hdf" 
+#define SDS1_NAME      "SDStemplate" 
+#define SDS2_NAME      "SDStemplate again" 
+#define X_LENGTH      6
+#define Y_LENGTH      9
+#define Z_LENGTH      2
+#define RANK2          2  /* Number of dimensions of the SDS */
+#define RANK3          3  /* Number of dimensions of the SDS */
+
+main() 
+{
+    /************************* Variable declaration ************************/
+
+    int32   sd2_id, sd3_id, sds1_id, sds2_id;
+    int32   dim2_sizes[2];	/* sizes of the 2-dim SDS dimensions */
+    int32   dim3_sizes[3];	/* sizes of the 3-dim SDS dimensions */
+    int32   start2[2], start3[3];	/* start arrays for both SDSs */
+    intn    status;
+    int32   dim_id, dim_index,	/* dimension id and index */
+	    size, data_type, 	/* dimension's size and data type */
+	    nattrs;		/* number of attributes */
+    char    dim_name[20];
+    float32 in2_data[X_LENGTH][Y_LENGTH]={ /* input for 2-dim SDS */
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0,
+                                 500.0,500.0,600.0,600.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0};
+    float32 in3_data[X_LENGTH][Y_LENGTH][Z_LENGTH]={ /* input for 3-dim SDS */
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0,
+                                 500.0,500.0,600.0,600.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0,
+                                 1.0,1.0,2.0,2.0,3.0,4.0,
+                                 1.0,1.0,2.0,2.0,3.0,4.0,
+                                 1.0,1.0,2.0,2.0,3.0,4.0,
+                                 3.0,3.0,  0.0,4.0,3.0,4.0,
+                                 3.0,3.0,  0.0,4.0,3.0,4.0,
+                                 3.0,3.0,  0.0,4.0,3.0,4.0,
+                                   0.0,  0.0,6.0,6.0,3.0,4.0,
+                                 5.0,5.0,6.0,6.0,3.0,4.0,
+                                   0.0,  0.0,6.0,6.0,3.0,4.0,
+				};
+
+    /********************* End of variable declaration ***********************/
+
+    /*
+    * Create the files and initialize the SD interface.
+    */
+    sd2_id = SDstart (FILE2_NAME, DFACC_CREATE);
+    sd3_id = SDstart (FILE3_NAME, DFACC_CREATE);
+ 
+    /*
+    * Define the dimensions/origins of the two SDSs to be created.
+    */
+    dim2_sizes[0] = Y_LENGTH;
+    dim2_sizes[1] = X_LENGTH;
+    dim3_sizes[0] = Z_LENGTH;
+    dim3_sizes[1] = Y_LENGTH;
+    dim3_sizes[2] = X_LENGTH;
+
+    start2[0] = start2[1] = 0;
+    start3[0] = start3[1] = start3[2] = 0;
+
+    /*
+    * Create two data sets, SDS1_NAME and SDS2_NAME, with type DFNT_FLOAT32
+    * in the two files, FILE2_NAME and FILE3_NAME.
+    */
+    sds1_id = SDcreate (sd2_id, SDS1_NAME, DFNT_FLOAT32, RANK2, dim2_sizes);
+    sds2_id = SDcreate (sd3_id, SDS2_NAME, DFNT_FLOAT32, RANK3, dim3_sizes);
+
+    /* Write data to the SDSs */
+    status = SDwritedata(sds1_id, start2, NULL, dim2_sizes, (VOIDP)in2_data);
+    status = SDwritedata(sds2_id, start3, NULL, dim3_sizes, (VOIDP)in3_data);
+
+    /*
+    * Terminate access to the data sets.
+    */
+    status = SDendaccess (sds1_id);
+    status = SDendaccess (sds2_id);
+
+    /*
+    * Terminate access to the SD interface and close the files.
+    */
+    status = SDend (sd2_id);
+    status = SDend (sd3_id);
+}
diff --git a/mfhdf/hdfimport/gen_sds_floats.c b/mfhdf/hdfimport/gen_sds_floats.c
new file mode 100644
index 0000000..64fae07
--- /dev/null
+++ b/mfhdf/hdfimport/gen_sds_floats.c
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group (THG).                                         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF copyright notice, including       *
+ * terms governing use, modification, and redistribution, is contained in    *
+ * the COPYING file and in the print documentation copyright notice.         *
+ * COPYING can be found at the root of the source code distribution tree;    *
+ * the copyright notice in printed HDF documentation can be found on the     *
+ * back of the title page.  If you do not have access to either version,     *
+ * you may request a copy from help at hdfgroup.org.                            *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "mfhdf.h"
+
+#define FILE2_NAME     "SDSfloat2.hdf" 
+#define FILE3_NAME     "SDSfloat3.hdf" 
+#define SDS1_NAME      "SDStemplate" 
+#define SDS2_NAME      "SDStemplate again" 
+#define X_LENGTH      6
+#define Y_LENGTH      9
+#define Z_LENGTH      2
+#define RANK2          2  /* Number of dimensions of the SDS */
+#define RANK3          3  /* Number of dimensions of the SDS */
+
+main() 
+{
+    /************************* Variable declaration ************************/
+
+    int32   sd2_id, sd3_id, sds1_id, sds2_id;
+    int32   dim2_sizes[2];	/* sizes of the 2-dim SDS dimensions */
+    int32   dim3_sizes[3];	/* sizes of the 3-dim SDS dimensions */
+    int32   start2[2], start3[3];	/* start arrays for both SDSs */
+    intn    status;
+    int32   dim_id, dim_index,	/* dimension id and index */
+	    size, data_type, 	/* dimension's size and data type */
+	    nattrs;		/* number of attributes */
+    char    dim_name[20];
+    float32 in2_data[X_LENGTH][Y_LENGTH]={ /* input for 2-dim SDS */
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0,
+                                 500.0,500.0,600.0,600.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0};
+    float32 in3_data[X_LENGTH][Y_LENGTH][Z_LENGTH]={ /* input for 3-dim SDS */
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 100.0,100.0,200.0,200.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                 300.0,300.0,  0.0,400.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0,
+                                 500.0,500.0,600.0,600.0,300.0,400.0,
+                                   0.0,  0.0,600.0,600.0,300.0,400.0,
+                                 1.0,1.0,2.0,2.0,3.0,4.0,
+                                 1.0,1.0,2.0,2.0,3.0,4.0,
+                                 1.0,1.0,2.0,2.0,3.0,4.0,
+                                 3.0,3.0,  0.0,4.0,3.0,4.0,
+                                 3.0,3.0,  0.0,4.0,3.0,4.0,
+                                 3.0,3.0,  0.0,4.0,3.0,4.0,
+                                   0.0,  0.0,6.0,6.0,3.0,4.0,
+                                 5.0,5.0,6.0,6.0,3.0,4.0,
+                                   0.0,  0.0,6.0,6.0,3.0,4.0,
+				};
+
+    /********************* End of variable declaration ***********************/
+
+    /*
+    * Create the files and initialize the SD interface.
+    */
+    sd2_id = SDstart (FILE2_NAME, DFACC_CREATE);
+    sd3_id = SDstart (FILE3_NAME, DFACC_CREATE);
+ 
+    /*
+    * Define the dimensions/origins of the two SDSs to be created.
+    */
+    dim2_sizes[0] = Y_LENGTH;
+    dim2_sizes[1] = X_LENGTH;
+    dim3_sizes[0] = Z_LENGTH;
+    dim3_sizes[1] = Y_LENGTH;
+    dim3_sizes[2] = X_LENGTH;
+
+    start2[0] = start2[1] = 0;
+    start3[0] = start3[1] = start3[2] = 0;
+
+    /*
+    * Create two data sets, SDS1_NAME and SDS2_NAME, with type DFNT_FLOAT32
+    * in the two files, FILE2_NAME and FILE3_NAME.
+    */
+    sds1_id = SDcreate (sd2_id, SDS1_NAME, DFNT_FLOAT32, RANK2, dim2_sizes);
+    sds2_id = SDcreate (sd3_id, SDS2_NAME, DFNT_FLOAT32, RANK3, dim3_sizes);
+
+    /* Write data to the SDSs */
+    status = SDwritedata(sds1_id, start2, NULL, dim2_sizes, (VOIDP)in2_data);
+    status = SDwritedata(sds2_id, start3, NULL, dim3_sizes, (VOIDP)in3_data);
+
+    /*
+    * Terminate access to the data sets.
+    */
+    status = SDendaccess (sds1_id);
+    status = SDendaccess (sds2_id);
+
+    /*
+    * Terminate access to the SD interface and close the files.
+    */
+    status = SDend (sd2_id);
+    status = SDend (sd3_id);
+}
diff --git a/mfhdf/hdfimport/hdfimport-w.out2 b/mfhdf/hdfimport/hdfimport-w.out2
new file mode 100644
index 0000000..24e3318
--- /dev/null
+++ b/mfhdf/hdfimport/hdfimport-w.out2
@@ -0,0 +1,69 @@
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:   1.100000e+001  1.200000e+001  1.300000e+001
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:   5.100000e+001  5.600000e+001  6.100000e+001  6.600000e+001
+      16:   7.100000e+001
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:   1.100000e+001  1.200000e+001  1.300000e+001
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:   5.100000e+001  5.600000e+001  6.100000e+001  6.600000e+001
+      16:   7.100000e+001
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:   1.100000e+001  1.200000e+001  1.300000e+001
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:   5.100000e+001  5.600000e+001  6.100000e+001  6.600000e+001
+      16:   7.100000e+001
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:   1.100000e+001  1.200000e+001  1.300000e+001
+ (2) 	Compressed Image              : (Tag 303) Ref 2
+       0:    137      1    144     60    144    120    137    179 
+       8:    137      1    144     60    144    120    137    179 
+      16:    137      1    144     60    144    120    137    179 
+      24:    137      1    144     60    144    120    137    179 
+      32:    137      1    144     60    144    120    137    179 
+      40:    137      1    144     60    144    120    137    179 
+      48:    137      1    144     60    144    120    137    179 
+      56:    137      1    144     60    144    120    137    179 
+      64:    137      1    144     60    144    120    137    179 
+      72:    137      1    144     60    144    120    137    179 
+      80:    137      1    144     60    144    120    137    179 
+      88:    137      1    144     60    144    120    137    179 
+      96:    137      1    144     60    144    120    137    179 
+     104:    137     31    144     90    144    150    137    209 
+     112:    137     31    144     90    144    150    137    209 
+     120:    137     31    144     90    144    150    137    209 
+     128:    137     31    144     90    144    150    137    209 
+     136:    137     31    144     90    144    150    137    209 
+     144:    137     31    144     90    144    150    137    209 
+     152:    137     31    144     90    144    150    137    209 
+     160:    137     31    144     90    144    150    137    209 
+     168:    137     31    144     90    144    150    137    209 
+     176:    137     31    144     90    144    150    137    209 
+     184:    137     31    144     90    144    150    137    209 
+     192:    137     31    144     90    144    150    137    209 
+     200:    137     31    144     90    144    150    137    209 
+     208:    137     31    144     90    144    150    137    209 
+     216:    137     31    144     90    144    150    137    209 
+     224:    137     31    144     90    144    150    137    209 
+     232:    137     31    144     90    144    150    137    209 
+     240:    137     31    144     90    144    150    137    209 
+     248:    137     31    144     90    144    150    137    209 
+     256:    137     31    144     90    144    150    137    209 
+     264:    137     31    144     90    144    150    137    209 
+     272:    137     31    144     90    144    150    137    209 
+     280:    137     31    144     90    144    150    137    209 
+     288:    137     31    144     90    144    150    137    209 
+     296:    137     60    144    120    144    179    137    239 
+     304:    137     60    144    120    144    179    137    239 
+     312:    137     60    144    120    144    179    137    239 
+     320:    137     60    144    120    144    179    137    239 
+     328:    137     60    144    120    144    179    137    239 
+     336:    137     60    144    120    144    179    137    239 
+     344:    137     60    144    120    144    179    137    239 
+     352:    137     60    144    120    144    179    137    239 
+     360:    137     60    144    120    144    179    137    239 
+     368:    137     60    144    120    144    179    137    239 
+     376:    137     60    144    120    144    179    137    239 
+     384:    137     60    144    120    144    179    137    239 
+     392:    137     60    144    120    144    179    137    239 
+     400: 
diff --git a/mfhdf/hdfimport/hdfimport.c b/mfhdf/hdfimport/hdfimport.c
new file mode 100644
index 0000000..5834de8
--- /dev/null
+++ b/mfhdf/hdfimport/hdfimport.c
@@ -0,0 +1,3710 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* 
+ * Name:
+ *      hdfimport (previously fp2hdf) 
+ *
+ * Purpose:
+ *      To convert floating point and/or integer data to HDF Scientific Data Set (SDS)
+ *      and/or 8-bit Raster Image Set (RIS8) format, storing the results
+ *      in an HDF file.  The image data can be scaled about the mean value.
+ *
+ *                                  -------------
+ *      floating point data        |             | ----------> RIS8
+ *      (SDS, ASCII text, or  ---> | hdfimport   |   and/or
+ *      native floating point)     |             | ----------> SDS
+ *                                  -------------
+ *					   AND / OR
+ *	                           ---------------
+ *      integer data               |              | 
+ *      (ASCII text, or       ---> |  hdfimport   |  ----------> SDS 
+ *      binary integer)            |              | 
+ *                                  --------------
+ * Synopsis:
+ *      hdfimport -h[elp], OR
+ *      hdfimport <infile> [ [-t[ype] <output-type> | -n] [<infile> [-t[ype] <output-type> | -n ]]...] 
+ *                            -o[utfile] <outfile> [-r[aster] [ras_opts ...]] [-f[loat]]
+ *      
+ *      -h[elp]:
+ *              Print this summary of usage, and exit.
+ *
+ *      <infile(s)>:
+ *              Name of the input file(s), containing a single 
+ *		two-dimensional or three-dimensional floating point array 
+ *		in either ASCII text, native floating point, native integer 
+ *		or HDF SDS format.  If an HDF file is used for input, it 
+ *		must contain an SDS. The SDS need only contain a dimension 
+ *		record and the data, but if it also contains maximum and 
+ *		minimum values and/or scales for each axis, these will 
+ *		be used.  If the input format is ASCII text or native 
+ *		floating point or native integer, see "Notes" below on 
+ *		how it must be organized.
+ *      
+ *      -t[ype] <output_type>: 
+ *              Optionally used for every input ASCII file to specify the 
+ *	        data type of the data-set to be written. If not specified               
+ *              default data type is 32-bit floating point. <output-type>
+ *              can be any of the following: FP32 (default), FP64, INT32
+ * 	        INT16, INT8. It can be used only with ASCII files.
+ *     
+ *      -n:  
+ *		This option is to be used only if the binary input file 
+ *		contains 64-bit floating point data and the default
+ *		behaviour (default behaviour is to write it to a 32-bit
+ *		floating point data-set) should be overridden to write 
+ *		it to a 64-bit floating point data-set.
+ *
+ *      -o[utfile] <outfile>:
+ *              Data from one or more input files are stored as one or
+ *              more data sets and/or images in one HDF output file,
+ *              "outfile".
+ *
+ *      -r[aster]:
+ *              Store output as a raster image set in the output file.
+ *
+ *      -f[loat]:
+ *              Store output as a scientific data set in the output file.
+ *              This is the default if the "-r" option is not specified.
+ *
+ *      ras_opts ...
+ *
+ *      -e[xpand] <horiz> <vert> [<depth>]:
+ *              Expand float data via pixel replication to produce the
+ *              image(s).  "horiz" and "vert" give the horizontal and
+ *              vertical resolution of the image(s) to be produced; and
+ *              optionally, "depth" gives the number of images or depth
+ *              planes (for 3D input data).
+ * 
+ *      -i[nterp] <horiz> <vert> [<depth>]:
+ *              Apply bilinear, or trilinear, interpolation to the float
+ *              data to produce the image(s).  "horiz", "vert", and "depth"
+ *              must be greater than or equal to the dimensions of the
+ *              original dataset.
+ *      If max and min are supplied in input file, this option clips
+ *      values that are greater than max or less then min, setting
+ *      them to the max and min, respectively.
+ *
+ *      -p[alfile] <palfile>:
+ *              Store the palette with the image.  Get the palette from
+ *              "palfile"; which may be an HDF file containing a palette,
+ *              or a file containing a raw palette.
+ *
+ *      -m[ean] <mean>:
+ *              If a floating point mean value is given, the image will be
+ *              scaled about the mean.  The new extremes (newmax and newmin),
+ *              as given by:
+ *
+ *                 newmax = mean + max(abs(max-mean), abs(mean-min))
+ *                 newmin = mean - max(abs(max-mean), abs(mean-min))
+ *
+ *              will be equidistant from the mean value.  If no mean value
+ *              is given, then the mean will be:  0.5 * (max + min)
+ *
+ * Notes:
+ *      If the input file format is ASCII text or native floating point or native integer(32-bit,
+ *      16-bit, 8-bit), it
+ *      must have the following input fields:
+ *
+ *              format
+ *              nplanes
+ *              nrows
+ *              ncols
+ *              max_value
+ *              min_value
+ *              [plane1 plane2 plane3 ...]
+ *              row1 row2 row3 ...
+ *              col1 col2 col3 ...
+ *              data1 data2 data3 ...
+ *              ...
+ *
+ *      Where:
+ *              format:
+ *                      Format designator ("TEXT", "FP32", "FP64", "IN32", "IN16", "IN08").
+ *                      nplanes, nrows, ncols:
+ *                      Dimensions are specified in the order slowest changing dimension first.
+ *			ncols is dimension of the fastest changing dimension. (horizontal axis
+ *			or X-axis in a 3D scale)
+ *			nrows corresponds to dimension of the vertical axis or Y-axis in a 3D 
+ *			scale.
+ *			nplanes corresponds to the slowest changing dimension i.e. dimension of 
+ *			the depth axis or the Z-axis in a 3D scale ("1" for 2D input).
+ *              max_value:
+ *                      Maximum data value.
+ *              min_value:
+ *                      Minimum data value.
+ *              plane1, plane2, plane3, ...:
+ *                      Scales for depth axis.
+ *              row1, row2, row3, ...:
+ *                      Scales for the vertical axis.
+ *              col1, col2, col3, ...:
+ *                      Scales for the horizontal axis.
+ *              data1, data2, data3, ...:
+ *                      The data ordered by rows, left to right and top
+ *                      to bottom; then optionally, ordered by planes,
+ *                      front to back.
+ *
+ *      For FP32 and FP64 input format, "format", "nplanes", "nrows", "ncols",
+ *      and "nplanes" are native integers; where "format" is the integer
+ *      representation of the appropriate 4-character string (0x46503332 for
+ *      "FP32" and 0x46503634 for "FP64").  The remaining input fields are
+ *      composed of native 32-bit floating point values for FP32 input format,
+ *      or native 64-bit floating point values for FP64 input format.
+ *
+ *      For IN32, IN16 and IN08 input format, "format", "nplanes", "nrows", "ncols",
+ *      and "nplanes" are native integers; where "format" is the integer
+ *      representation of the appropriate 4-character string. The remaining input 
+ *      fields are composed of native 32-bit integer values for IN32 input format,
+ *      or native 16-bit integer values for IN16 input format or native 8-bit 
+ *      integer values for IN08 input format.
+ *
+ * Source Availability:
+ *      This program is in the public domain, and was developed and made
+ *      available by the National Center for Supercomputing Applications,
+ *      University of Illinois, Urbana-Champaign (ftp.ncsa.uiuc.edu).
+ *
+ * History:
+ *      Beta version:                                           17-May-89
+ *              (by Mike Folk mfolk at ncsa.uiuc.edu)
+ *      Revision to put in the mean option:                     15-Sep-89
+ *              (by Glen Mortensen gam at inel.gov)
+ *      Officially released:                                    01-Dec-89
+ *              (by NCSA ftp.ncsa.uiuc.edu)
+ *      Revision to fix some bugs:                              16-Mar-90
+ *              (by Mike Folk mfolk at ncsa.uiuc.edu)
+ *      Revision to support 3D and native fp input:             15-May-90
+ *              (by Bob Weaver baw at inel.gov)
+ *      Revision to fix bug in interp() :                       17-Oct-90
+ *              (by Fred Walsteijn nwalstyn at fys.ruu.n)
+ *      Revision to fix bug in interp() :                       23-Nov-90
+ *              Now it clips values outside of max and min.
+ *              (by Fred Walsteijn nwalstyn at fys.ruu.n)
+ *      Revision to start to use HDF 3.2 (and 3.3) library:     22-Jun-93
+ *              Still lots to do to support other number types.
+ *              (by Chris Houck chouck at ncsa.uiuc.edu)
+ *      Revision to incorporate 32-bit integer, 16-bit integer, 08-Jan-02
+ *              8-bit integer data types and converting 64-bit 
+ *              input data to 64-bit output data.
+ *              (by Pankaj Kamat pkamat at uiuc.edu)	 
+ */
+
+#include "hdf.h"
+#include "hfile.h"
+#include <stdio.h>
+#ifndef MIPSEL
+#include <math.h>
+#endif /* MIPSEL */
+#include <string.h>
+#include <ctype.h>
+#include <mfhdf.h>
+
+#ifdef _WIN32
+#include <sys/stat.h>
+#include <fcntl.h>
+#endif
+
+/*
+ * global macros
+ */
+#define EXPAND      1   /* -e: expand image with pixel replication */
+#define INTERP      2   /* -i: expand image with interpolation */
+#define NAME_LEN    255
+
+/*
+ * structure definition to associate input files with the output data types
+ */
+struct infilesformat
+{
+	char filename[NAME_LEN];
+	int outtype;   /* if the value is "" output type will be FP32. Applicable only to TEXT Files*/
+	int32 handle;	/* added to facilitate the use of SD interface -BMR 2006/08/18 */
+};
+/*
+ * structure definition for command line options
+ */
+struct Options
+  {
+      struct infilesformat  infiles[30];  /* structure to hold the list of input file names. Limited to 30*/
+      char        outfile[32];  /* output file name */
+      char        palfile[32];  /* palette file name, if any */
+      int         fcount;       /* number of input files */
+      int         to_float;     /* float output is desired */
+      int         to_image;     /* image output is desired */
+      int         to_int;  
+      int         pal;          /* output palette with image */
+      int         ctm;          /* color transform method: EXPAND or INTERP */
+      int         exh;          /* horizontal expansion factor */
+      int         exv;          /* vertical expansion factor */
+      int         exd;          /* depth expansion factor */
+      int         hres;         /* horizontal resolution of output image */
+      int         vres;         /* vertical resolution of output image */
+      int         dres;         /* depth resolution of output image */
+      int         mean;         /* scale image around a mean */
+      float32     meanval;      /* mean value to scale the image around */
+	
+  };
+
+/* Additional Structures to handle different data types */
+struct int16set /* variables for an INT 16 data set */
+{
+	int16 max;
+	int16 min;
+	int16 *hscale;
+	int16 *vscale;
+	int16 *dscale;
+};
+
+struct int32set /* variables for an INT 32 data set */
+{
+  int32 max;
+  int32 min;
+  int32 *hscale;
+  int32 *vscale;
+  int32 *dscale;
+};
+
+struct fp64set /* variables for a FLOAT 64 data set */
+{
+	float64 max;
+	float64 min;
+	float64 *hscale;
+	float64 *vscale;
+	float64 *dscale;
+};
+
+struct int8set /* variables for an INT 8 data set */
+{
+	int8 max;
+	int8 min;
+	int8 *hscale;
+	int8 *vscale;
+	int8 *dscale;
+};
+
+/*
+ * structure definition for the input data
+ */
+struct Input
+  {
+      int         is_hdf;       /* HDF file format flag */
+      int         is_text;      /* ASCII text format flag */
+      int         is_fp32;      /* 32-bit native floating point format flag */
+      int         is_fp64;      /* 64-bit native floating point format flag */
+      int         is_int32;     /* 32-bit int */
+      int         is_int16;     /* 16-bit int */
+      int32       rank;         /* number of input data dimensions */
+      int32       dims[3];      /* input dimensions - ncols, nrows, nplanes */
+      int         is_vscale;    /* vertical axis scales in the input */
+      int         is_hscale;    /* horizontal axis scales in the input */
+      int         is_dscale;    /* depth axis scales in the input */
+      float32     max;          /* maximum value of the data */
+      float32     min;          /* minimum value of the data */
+      float32    *hscale;       /* horizontal scales for fp32*/
+      float32    *vscale;       /* vertical scales for fp32*/
+      float32    *dscale;       /* depth scales for fp32*/
+      struct int32set	in32s;
+      struct int16set	in16s;
+      struct int8set	in8s;
+      struct fp64set	fp64s;
+      VOIDP       data;         /* input data */
+      int 	  outtype;
+  };
+
+
+/*
+ * structure definition for the output raster images
+ */
+struct Raster
+  {
+      int         hres;         /* horizontal resolution of the image */
+      int         vres;         /* vertical resolution of the image */
+      int         dres;         /* depth resolution of the image */
+      unsigned char *image;
+  };
+
+/*
+ *  constants to represent data types
+ */
+
+#define FP_32 0
+#define FP_64 1
+#define INT_32 2
+#define INT_16 3
+#define INT_8 4
+#define NO_NE 5
+
+
+/*
+ * state table tokens
+ */
+#define FILNAME 0   /* filename */
+#define OPT_o   1   /* output filename */
+#define OPT_r   2   /* convert to image */
+#define OPT_e   3   /* expand image via pixel replication */
+#define OPT_i   4   /* make interpolated image */
+#define NUMBR   5   /* resolution of enlarged image */
+#define OPT_p   6   /* palette filename */
+#define OPT_f   7   /* convert to float (default) */
+#define OPT_h   8   /* request for explanation */
+#define OPT_m   9   /* mean to scale around */
+#define OPT_t   10  /* datatype of the SDS to be written */ 
+#define OPT_n   11  /* for  a FLOAT 64 binary input file to be accepted as FLOAT 64 SDS (default behaviour is writing it as FLOAT 32 SDS */
+#define ERR 20  /* invalid token */
+
+/*
+ * state table for parsing the command line.
+ */
+static int  state_table[19][12] =
+{
+
+    /* token ordering:
+       FILNAME      OPT_o   OPT_r   OPT_e   OPT_i   NUMBR   OPT_p   OPT_f
+       OPT_h        OPT_m   OPT_z */
+
+    /* state 0: start */
+    {1, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    14, ERR, ERR, ERR},
+
+    /* state 1: input files */
+    {1, 2, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR, 17, 18},
+
+    /* state 2: -o[utfile] */
+    {3, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 3: outfile */
+    {ERR, ERR, 4, ERR, ERR, ERR, ERR, 13,
+    ERR, ERR, ERR, ERR},
+
+    /* state 4: -r[aster] */
+    {ERR, ERR, ERR, 5, 9, ERR, 10, 12,
+    ERR, 15, ERR, ERR},
+
+    /* state 5: -e[xpand] */
+    {ERR, ERR, ERR, ERR, ERR, 6, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 6: -e[xpand] or -i[nterp] option argument */
+    {ERR, ERR, ERR, ERR, ERR, 7, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 7: -e[xpand] or -i[nterp] option argument */
+    {ERR, ERR, ERR, ERR, ERR, 8, 10, 12,
+    ERR, 15, ERR, ERR},
+
+    /* state 8: -e[xpand] or -i[nterp] option argument */
+    {ERR, ERR, ERR, ERR, ERR, ERR, 10, 12,
+    ERR, 15, ERR, ERR},
+
+    /* state 9: -i[nterp] */
+    {ERR, ERR, ERR, ERR, ERR, 6, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 10: -p[alfile] */
+    {11, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 11: palfile */
+    {ERR, ERR, ERR, 5, 9, ERR, ERR, 12,
+    ERR, 15, ERR, ERR},
+
+    /* state 12: -f[loat] (after -r[aster]) */
+    {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 13: -f[loat] */
+    {ERR, ERR, 4, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 14: -h[elp] */
+    {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 15: -m[ean] */
+    {ERR, ERR, ERR, ERR, ERR, 16, ERR, ERR,
+    ERR, ERR, ERR, ERR},
+
+    /* state 16: mean */
+    {ERR, ERR, ERR, 5, 9, ERR, 10, 12,
+     ERR, ERR, ERR, ERR},
+
+    /* state 17: output type for data set */
+    {1, 2, ERR, ERR, ERR, ERR, ERR, ERR,                     
+    ERR, ERR, ERR, ERR},
+    
+     /* state 18: override default behaviour for FP 64 */
+    {1, 2, ERR, ERR, ERR, ERR, ERR, ERR,                     
+    ERR, ERR, ERR, ERR}
+    
+    
+};
+
+/* static local functions */
+static int  gtoken(char *s);
+static int  process(struct Options *opt);
+static int  gfloat(char *infile, FILE * strm, float32 *fp32, struct Input *in);
+static int  gint(char *infile, FILE * strm, int32 *ival, struct Input *in);
+static int  isnum(char *s);
+static int  gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_maxmin);
+static int  gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm);
+static int  gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_maxmin);
+static int  gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_scale);
+static int  gtype(char *infile, struct Input *in, FILE **strm);
+static int  indexes(float32 *scale, int dim, int *idx, int res);
+static int  interp(struct Input *in, struct Raster *im);
+static int  palette(char *palfile);
+static int  pixrep(struct Input *in, struct Raster *im);
+
+/*
+ * functions with non-integer return types
+ */
+void        help(char *);
+void        mean(struct Input *, struct Options *);
+void        usage(char *);
+
+/*
+ * Additional functions defined to incorporate the revisions (pkamat)
+ */
+static int  gfloat64(char *infile, FILE * strm, float64 *fp64, struct Input *in);
+static int  gint32(char *infile, FILE * strm, int32 *ival, struct Input *in);
+static int  gint16(char *infile, FILE * strm, int16 *ival, struct Input *in);
+static int  gint8(char *infile, FILE * strm, int8 *ival, struct Input *in);
+static int  init_scales(struct Input * in);
+void        fpdeallocate(struct Input *in, struct Raster *im, struct Options *opt);
+
+/*
+ * Name:
+ *      main
+ *
+ * Purpose:
+ *      The driver for "hdfimport".
+ *
+ *  Revision (pkamat):
+ *		Changes to the state table to handle -t option and the -n option.
+ *      Also, a different structure used for holding input files.
+ */
+int
+main(int argc, char *argv[])
+{
+    struct Options opt;
+    int         i,k;
+    int         outfile_named = FALSE;
+    int         token;
+    int         state = 0;
+    int flag = 0;
+    char types [5][6] = { "FP32", "FP64", "INT32", "INT16", "INT8" };	
+
+    const char *err1 = "Invalid number of arguments:  %d.\n";
+    const char *err2 = "Error in state table.\n";
+    const char *err3 = "No output file given.\n";
+    const char *err4 = "Program aborted.\n";
+    /* const char *err5 = "Cannot allooacte memory.\n"; */
+    /*
+     * set 'stdout' and 'stderr' to line-buffering mode
+     */
+    (void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
+    (void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
+
+    /*
+     * validate the number of command line arguments
+     */
+    if (argc < 2)
+      {
+          (void) fprintf(stderr, err1, argc);
+          usage(argv[0]);
+          goto err;
+      }
+
+    opt.to_image = FALSE;   /* default: no image */
+    opt.to_float = FALSE;   /* default: make float if no image */
+			    /* Set FALSE here.  Will be set TRUE */
+			    /* after confirming image option is not set.  */
+    opt.ctm = EXPAND;   /* default: pixel replication */
+    opt.hres = 0;   /* default: no expansion values */
+    opt.vres = 0;
+    opt.dres = 0;
+    opt.pal = FALSE;    /* default: no palette */
+    opt.mean = FALSE;   /* default: no mean given */
+    opt.fcount = 0;     /* to count number of input files */
+
+    /*
+     * parse the command line
+     */
+    for (i = 1; i < argc; i++)
+      {
+          if (strcmp(argv[i], "-V") == 0) {
+            printf("%s, %s\n\n", argv[0], LIBVER_STRING );
+            exit(0);
+          }
+
+          if ((token = gtoken(argv[i])) == ERR)
+            {
+                usage(argv[0]);
+                goto err;
+            }
+			
+          state = state_table[state][token];
+	    
+          switch (state)
+            {
+	    case 1: /* counting input files */                  
+	      (void) HDstrcpy(opt.infiles[opt.fcount].filename, argv[i]);
+	      opt.infiles[opt.fcount].outtype = NO_NE;
+	      opt.fcount++;
+	      break;
+	    case 2: /* -o found; look for outfile */
+	      break;
+	    case 3: /* get outfile name */
+	      (void) HDstrcpy(opt.outfile, argv[i]);
+	      outfile_named = TRUE;
+	      break;
+	    case 4: /* -r found */
+	      opt.to_image = TRUE;
+	      break;
+	    case 5: /* -e found */
+	      opt.ctm = EXPAND;
+	      break;
+	    case 6: /* horizontal resolution */
+	      opt.hres = atoi(argv[i]);
+	      break;
+	    case 7: /* vertical resolution */
+	      opt.vres = atoi(argv[i]);
+	      break;
+	    case 8: /* depth resolution */
+	      opt.dres = atoi(argv[i]);
+	      break;
+	    case 9: /* -i found */
+	      opt.ctm = INTERP;
+	      break;
+	    case 10:    /* -p found */
+	      opt.pal = TRUE;
+	      break;
+	    case 11:    /* get pal filename */
+	      (void) HDstrcpy(opt.palfile, argv[i]);
+	      break;
+	    case 12:    /* -f found (after a -r) */
+	    case 13:    /* -f found (no -r yet) */
+	      opt.to_float = TRUE;
+	      break;
+	    case 14:    /* -h found; help, then exit */
+	      help(argv[0]);
+	      exit(0);
+	    case 15:    /* -m found */
+	      opt.mean = TRUE;
+	      break;
+	    case 16:    /* mean value */
+	      opt.meanval = (float32)atof(argv[i]);
+	      break;
+	    case 17:  /* -t found */
+	      i++;
+	      flag = 0;
+	      for (k=0; ((k<=4) && (!flag)); k++)
+		if (!strcmp(argv[i], types[k])) flag = 1;
+	      if (flag)
+		opt.infiles[opt.fcount-1].outtype = k-1;		
+	      else
+		{
+		  usage(argv[0]);
+		  goto err;
+		}
+	      break;
+	    case 18: /* -n found */
+	      opt.infiles[opt.fcount-1].outtype = FP_64;
+	      break;
+	    case ERR:   /* command syntax error */
+	    default:
+	      (void) fprintf(stderr, err2);
+	      usage(argv[0]);
+	      goto err;
+            }
+      }
+
+     /*
+     * make sure an output file was specified
+     */
+    if (!outfile_named)
+      {
+          (void) fprintf(stderr, err3);
+          usage(argv[0]);
+          goto err;
+      }
+
+    if (!opt.to_image)
+        opt.to_float = TRUE;	      
+
+    /*
+     * process the input files
+     */
+    if (process(&opt))
+        goto err;
+
+    return(0);
+
+  err:
+    (void) fprintf(stderr, err4);
+    return(1);
+}
+
+/*
+ * Name:
+ *      gdata
+ *
+ * Purpose:
+ *      Get the input data.
+ *
+ * Revision(pkamat):
+ *      Modified to read in data of type INT 32, INT 16, INT 8 
+ *      in addition to FP 32 and FP 64.
+ * Revision: (bmribler - 2006/8/18)
+ *	Replaced first parameter with 'struct infilesformat' to use both
+ *	the file name and the SD identifier (handle.)
+ */
+static int
+gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_maxmin)
+{
+    int32	i, j, k;
+    float32	*fp32;
+    int32	*in32;
+    int16	*in16;
+    float64	*fp64;
+    int8	*in8;
+    int32	hdfdims[3], start[3];     /* order: ZYX or YX */
+    int32	sd_id, sds_id, sd_index, dim_id;
+    int32	len = in->dims[0] * in->dims[1] * in->dims[2];
+    char	infile[NAME_LEN];
+    intn	status;
+    const char *err1 = "Unable to get input data from file: %s.\n";
+    
+    /*
+     * extract the input data from the input file
+     */
+    if (in->is_hdf == TRUE)
+      {
+	sd_id = infile_info.handle;
+	strcpy(infile, infile_info.filename);
+	sd_index = 0;
+	sds_id = SDselect (sd_id, sd_index);
+
+        /*
+         * hdfdims is ordered: ZYX or YX
+         * in->dims is ordered: XYZ
+         */
+	if (in->rank == 2)
+	  {
+            hdfdims[0] = in->dims[1];
+            hdfdims[1] = in->dims[0];
+	    start[0] = start[1] = 0;
+	  }
+        else
+          {
+            hdfdims[0] = in->dims[2];
+            hdfdims[1] = in->dims[1];
+            hdfdims[2] = in->dims[0];
+	    start[0] = start[1] = start[2] = 0;
+          }
+
+	status = SDreaddata (sds_id, start, NULL, hdfdims, in->data);
+	if (status == FAIL)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+    else
+      {
+	    if (in->outtype == FP_32)
+	      {
+		for (k = 0, fp32 = (float32 *) in->data; k < in->dims[2]; k++)
+		  {
+		    for (j = 0; j < in->dims[1]; j++)
+		      {
+			for (i = 0; i < in->dims[0]; i++, fp32++)
+			  {
+                            if (gfloat(infile, strm, fp32, in))
+                              {
+                                  (void) fprintf(stderr, err1, infile);
+                                  goto err;
+                              }
+			  }
+		      }
+		  }
+		if (*is_maxmin == FALSE)
+		  {
+		    in->min = in->max = *(float32*) in->data;
+		    for (i = 1; i< len; i++)
+		      {
+			if (((float32 *) in->data)[i] > in->max)
+			  in->max = ((float32 *) in->data)[i];
+			if (((float32*) in->data)[i] < in->min)
+			  in->min = ((float32*) in->data)[i];
+		      }
+		    *is_maxmin = TRUE;
+		  }
+	      }
+	    if (in->outtype == INT_32)
+	      {
+		for (k = 0, in32 = (int32 *) in->data; k < in->dims[2] ; k++)
+		  {
+		    for (j= 0; j < in->dims[1]; j++)
+		      {
+			for (i =0; i < in->dims[0]; i++, in32++)
+			  {
+			    if (gint32(infile, strm, in32, in))
+			      {
+				(void) fprintf(stderr, err1, infile);
+				goto err;
+			      }
+			  }
+		      }
+		  }
+		if (*is_maxmin == FALSE)
+		  {
+		    in->in32s.min = in->in32s.max = *(int32 *) in->data;
+		    for (i = 1; i<len; i++)
+		      {
+			if (((int32 *) in->data)[i] > in->in32s.max)
+			  in->in32s.max = ((int32 *) in->data)[i];
+			if (((int32 *) in->data)[i] < in->in32s.min)
+			  in->in32s.min = ((int32 *) in->data)[i];
+		      }
+		    *is_maxmin = TRUE;
+		  }
+	      }
+	    if (in->outtype == INT_16)
+	      {
+		for (k = 0, in16 = (int16 *) in->data; k < in->dims[2] ; k++)
+		  {
+		    for (j= 0; j < in->dims[1]; j++)
+		      {
+			for (i =0; i < in->dims[0]; i++, in16++)
+			  {
+			    if (gint16(infile, strm, in16, in))
+			      {
+				(void) fprintf(stderr, err1, infile);
+				goto err;
+			      }
+			  }
+		      }
+		  }
+		if (*is_maxmin == FALSE)
+		  {
+		    in->in16s.min = in->in16s.max = *(int16 *) in->data;
+		    for (i = 1; i<len; i++)
+		      {
+			if (((int16 *) in->data)[i] > in->in16s.max)
+			  in->in16s.max = ((int16 *) in->data)[i];
+			if (((int16 *) in->data)[i] < in->in16s.min)
+			  in->in16s.min = ((int16 *) in->data)[i];
+		      }
+		    *is_maxmin = TRUE;
+		  }
+	      }
+	    
+	    if (in->outtype == INT_8)
+	      {
+		for (k = 0, in8 = (int8 *) in->data; k < in->dims[2] ; k++)
+		  {
+		    for (j= 0; j < in->dims[1]; j++)
+		      {
+			for (i =0; i < in->dims[0]; i++, in8++)
+			  {
+			    if (gint8(infile, strm, in8, in))
+			      {
+				(void) fprintf(stderr, err1, infile);
+				goto err;
+			      }
+			  }
+		      }
+		  }
+		if (*is_maxmin == FALSE)
+		  {
+		    in->in8s.min = in->in8s.max = *(int8 *) in->data;
+		    for (i = 1; i<len; i++)
+		      {
+			if (((int8 *) in->data)[i] > in->in8s.max)
+			  in->in8s.max = ((int8 *) in->data)[i];
+			if (((int8 *) in->data)[i] < in->in8s.min)
+			  in->in8s.min = ((int8 *) in->data)[i];
+		      }
+		    *is_maxmin = TRUE;
+		  }
+	      }
+
+	    if (in->outtype == FP_64)
+	      {
+		for (k = 0, fp64 = (float64 *) in->data; k < in->dims[2]; k++)
+		  {
+		    for (j = 0; j < in->dims[1]; j++)
+		      {
+			for (i = 0; i < in->dims[0]; i++, fp64++)
+			  {
+                            if (gfloat64(infile, strm, fp64, in))
+                              {
+                                  (void) fprintf(stderr, err1, infile);
+                                  goto err;
+                              }
+			  }
+		      }
+		  }
+		if (*is_maxmin == FALSE)
+		  {
+		    in->fp64s.min = in->fp64s.max = *(float64*) in->data;
+		    for (i = 1; i< len; i++)
+		      {
+			if (((float64 *) in->data)[i] > in->fp64s.max)
+			  in->fp64s.max = ((float64*) in->data)[i];
+			if (((float64*) in->data)[i] < in->fp64s.min)
+			  in->fp64s.min = ((float64*) in->data)[i];
+		      }
+		    *is_maxmin = TRUE;
+		  }
+	      }
+	    
+	    /* } */
+          (void) fclose(strm);
+      }
+
+#ifdef  DEBUG
+    (void) printf("\tdata:");
+    for (k = 0, fp32 = in->data; k < in->dims[2]; k++)
+      {
+          (void) printf("\n");
+          for (j = 0; j < in->dims[1]; j++)
+            {
+                (void) printf("\n\t");
+                for (i = 0; i < in->dims[0]; i++, fp32++)
+                    (void) printf("%E ", *fp32);
+            }
+      }
+    (void) printf("\n\n\n");
+#endif /* DEBUG */
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gdimen
+ *
+ * Purpose:
+ *      Determine the input data dimensions.
+ * Revision: (bmribler - 2006/8/18)
+ *	Used the SD interface instead of DFSD.
+ *	Replaced first parameter with 'struct infilesformat' to use both
+ *	the file name and the SD identifier (handle.)
+ */
+ 
+static int
+gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm)
+{
+    int32       hdfdims[3];     /* order: ZYX or YX */
+    intn	status;		/* returned value from APIs */
+    char	infile[NAME_LEN];
+    char       *sds_name=NULL;
+    int32	rank, nattrs, dtype; /* rank, num of attrs, data type */
+
+    const char *err1 = "Unable to get data dimensions from file: %s.\n";
+    const char *err2 = "Invalid data rank of %d in file: %s.\n";
+    const char *err3 = "Dimension(s) is less than '2' in file: %s.\n";
+    const char *err4 = "Unexpected number type from file: %s.\n";
+    const char *err5 = "Unable to get the length of the SDS' name: index %d.\n";
+    const char *err6 = "Unable to allocate dynamic memory.\n";
+    const char *err7 = "Failed to open the SDS.\n";
+
+    /*
+     * extract the rank and dimensions of the HDF input file
+     */
+    if (in->is_hdf == TRUE)
+      {
+	int32 sds_id, sd_index;
+	int32 sd_id = infile_info.handle; /* shortcut for handle from SDstart */
+	char *infile = infile_info.filename; /* shortcut for input filename */
+	uint16 name_len = 0;
+	intn status = FAIL;
+
+	/* get the dimension information of the only SDS in the file */
+	sd_index = 0;
+	sds_id = SDselect (sd_id, sd_index);
+	if (sds_id == FAIL)
+          {
+            (void) fprintf(stderr, err7, infile);
+            goto err;
+          }
+
+	/* get the SDS name's length and allocate sufficient space for 
+	   the name's buffer */
+	status = SDgetnamelen(sds_id, &name_len);
+	if (status == FAIL)
+          {
+            (void) fprintf(stderr, err5, sd_index);
+            goto err;
+          }
+	sds_name = (char *)HDmalloc(name_len+1);
+	if (sds_name == NULL)
+          {
+            (void) fprintf(stderr, err6);
+            goto err;
+          }
+
+	/* obtain the SDS' information */
+	status = SDgetinfo(sds_id, sds_name, &rank, hdfdims, &dtype, &nattrs);
+	if (status == FAIL)
+          {
+            (void) fprintf(stderr, err1, infile);
+            goto err;
+          }
+	in->rank = (int)rank;
+
+        /* don't know how to deal with other numbers yet */
+        if (dtype != DFNT_FLOAT32)
+          {
+            (void) fprintf(stderr, err4, infile);
+            goto err;
+          }
+
+        /*
+         * hdfdims is ordered: ZYX or YX
+         * in->dims is ordered: XYZ
+         */
+        if (in->rank == 2)
+          {
+            in->dims[0] = hdfdims[1];
+            in->dims[1] = hdfdims[0];
+            in->dims[2] = 1;
+          }
+        else if (in->rank == 3)
+          {
+            in->dims[0] = hdfdims[2];
+            in->dims[1] = hdfdims[1];
+            in->dims[2] = hdfdims[0];
+          }
+        else
+          {
+            (void) fprintf(stderr, err2, in->rank, infile);
+            goto err;
+          }
+
+          /*
+           * get the rank and dimensions from files of other input formats
+           * 
+           */
+      }
+    else
+      {	       			
+          if (gint(infile, strm, &in->dims[2], in))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          if (in->dims[2] > 1)
+              in->rank = 3;
+          else
+              in->rank = 2;
+          if (gint(infile, strm, &in->dims[1], in))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+          if (gint(infile, strm, &in->dims[0], in))
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+
+    /*
+     * validate dimension sizes
+     */
+    if ((in->dims[0] < 2) || (in->dims[1] < 2))
+      {
+          (void) fprintf(stderr, err3, infile);
+          goto err;
+      }
+
+#ifdef  DEBUG
+    (void) printf("\nInput Information ...\n\n");
+    (void) printf("\trank:\n\n\t%d\n\n", in->rank);
+    (void) printf("\tdimensions (nplanes,nrows,ncols):\n\n");
+    (void) printf("\t%d %d %d\n\n", in->dims[2], in->dims[1], in->dims[0]);
+#endif /* DEBUG */
+
+    if (sds_name != NULL) HDfree(sds_name);
+    return (0);
+
+  err:
+    if (sds_name != NULL) HDfree(sds_name);
+    return (1);
+}
+
+/*
+ * Name:
+ *      gfloat
+ *
+ * Purpose:
+ *      Read in a single floating point value from the input stream.  The
+ *      input format may either be ASCII text , 32-bit native floating point,
+ *      or 64-bit native floating point.
+ */
+static int
+gfloat(char *infile, FILE * strm, float32 *fp32, struct Input *in)
+{
+    float64     fp64=0.0;
+
+    const char *err1 = "Unable to get 'float' value from file: %s.\n";
+    
+    if (in->is_text == TRUE)
+      {
+          if (fscanf(strm, "%e", fp32) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+    else if (in->is_fp32 == TRUE)
+      {
+	if (fread((char *) fp32, sizeof(float32), 1, strm) != 1)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+	    goto err;
+	  }
+      }
+    else
+      {
+	if (fread((char *) &fp64, sizeof(float64), 1, strm) != 1)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+	    goto err;
+	  }
+	*fp32 = (float32) fp64;
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name: (pkamat - New function)
+ *      gfloat64
+ *
+ * Purpose:
+ *      Read in a double floating point value from the input stream.  The
+ *      input format may either be ASCII text ,
+ *      or 64-bit native floating point.
+ */
+
+static int
+gfloat64(char *infile, FILE * strm, float64 *fp64, struct Input *in)
+{
+    const char *err1 = "Unable to get 'float' value from file: %s.\n";
+    
+    if (in->is_text == TRUE)
+      {
+	if (fscanf(strm, "%le", fp64) != 1)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+	    goto err;
+	  }
+      }
+    else
+      {
+	if (fread((char *) fp64, sizeof(float64), 1, strm) != 1)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+	    goto err;
+	  }
+      }
+	
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gint
+ *
+ * Purpose:
+ *      Read in a single integer value from the input stream.  The input
+ *      format may either be ASCII text or a native BCD of type integer.
+ */
+static int
+gint(char *infile, FILE * strm, int32 *ival, struct Input *in)
+{
+    const char *err1 = "Unable to get 'int' value from file: %s.\n";
+    /*
+     * process TEXT-formatted input
+     */
+    if (in->is_text == TRUE)
+      {
+          if (fscanf(strm, "%d", ival) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+
+          /*
+           * process BCD-formatted input
+           */
+      }
+    else
+      {
+          if (fread((char *) ival, sizeof(int), 1, strm) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name: (pkamat - New function)
+ *      gint32
+ *
+ * Purpose:
+ *      Read in a single 32-bit integer value from the input stream.  The input
+ *      format may either be ASCII text or a native BCD of type integer.
+ */
+
+static int
+gint32(char *infile, FILE * strm, int32 *ival, struct Input *in)
+{
+    const char *err1 = "Unable to get 'int' value from file: %s.\n";
+    /*
+     * process TEXT-formatted input
+     */
+    if (in->is_text == TRUE)
+      {
+          if (fscanf(strm, "%d", ival) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+
+          /*
+           * process BCD-formatted input
+           */
+      }
+    else
+      {
+          if (fread((char *) ival, sizeof(int32), 1, strm) != 1)
+            {
+                (void) fprintf(stderr, err1, infile);
+                goto err;
+            }
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name: (pkamat - New function)
+ *      gint16
+ *
+ * Purpose:
+ *      Read in a single 16-bit integer value from the input stream.  The input
+ *      format may either be ASCII text or a native BCD of type 16-bit integer.
+ */
+
+static int
+gint16(char *infile, FILE * strm, int16 *ival, struct Input *in)
+{
+    const char *err1 = "Unable to get 'int' value from file: %s.\n";
+     
+    if (in->is_text == TRUE)
+      {
+	if (fscanf(strm, "%hd", ival) != 1)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+	    goto err;
+	  }
+      }             
+    
+ else
+ { 
+     if (fread((char *) ival, sizeof(int16), 1, strm) != 1)
+       {
+	 (void) fprintf(stderr, err1, infile);
+	 goto err;
+       }
+ }
+ 
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name: (pkamat - New function)
+ *      gint8
+ *
+ * Purpose:
+ *      Read in a single 8-bit integer value from the input stream.  The input
+ *      format may either be ASCII text or a native BCD of type 8-bit integer.
+ */
+
+static int
+gint8(char *infile, FILE * strm, int8 *ival, struct Input *in)
+{
+    const char *err1 = "Unable to get 'int' 8  value from file: %s.\n";
+    int16 temp;
+    
+    if (in->is_text == TRUE)
+      {
+	if (fscanf(strm, "%hd", &temp) != 1)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+	    goto err;
+	  }
+	*ival = (int8) temp;
+      }
+    else
+      { 
+	if (fread((char *) ival, sizeof(int8), 1, strm) != 1)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+		  goto err;
+	  }
+      }
+    return (0);
+    
+ err:
+    return (1);
+}
+/*
+ * Name:
+ *      gmaxmin
+ *
+ * Purpose:
+ *      Extract the maximum and minimum data values from the input file.
+ *      Supports 32-bit integer, 16-bit integer, 8-bit integer, 32-bit float, 64-bit float
+ * Revision: (pvn) March 14, 2006
+ *      Used the SD interface instead of DFSD 
+ * Revision: (bmribler - 2006/8/18)
+ *	Removed SDstart call here, used passed-in SD id from process() instead.
+ *	Replaced first parameter with 'struct infilesformat' to use both
+ *	the file name and the SD identifier (handle.)
+ */
+static int
+gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_maxmin)
+{
+    const char *err1 = "Unable to get max/min values from file: %s.\n";
+ 
+    /*
+     * extract the max/min values from the input file
+     */
+    if (in->is_hdf == TRUE)
+      {
+	int32 sds_id, sd_index = 0;
+	intn status;
+
+	sds_id = SDselect(infile_info.handle, sd_index); 
+	status = SDgetrange(sds_id, &in->max, &in->min);
+	if (status != FAIL)
+	  {
+	    if (in->max > in->min)
+	    *is_maxmin = TRUE;
+	  }
+
+	/* terminate access to the array. */
+	if (SDendaccess(sds_id)==FAIL)
+	    goto err;
+      }
+    else /* input file is not an HDF file */
+      {
+	char *infile = infile_info.filename;
+	if (in->outtype == FP_32)
+	  {
+	    if (gfloat(infile, strm, &in->max, in))
+	      {
+		(void) fprintf(stderr, err1, infile);
+		goto err;
+	      }
+	    if (gfloat(infile, strm, &in->min, in))
+	      {
+		(void) fprintf(stderr, err1, infile);
+		goto err;
+	      }
+	    if (in->max > in->min)
+	      *is_maxmin = TRUE;
+	  }
+	if (in->outtype == FP_64)
+	  {
+	      if (gfloat64(infile, strm, &in->fp64s.max, in))
+		{
+		  (void) fprintf(stderr, err1, infile);
+		  goto err;
+		}
+	      if (gfloat64(infile, strm, &in->fp64s.min, in))
+		{
+		  (void) fprintf(stderr, err1, infile);
+		  goto err;
+		}
+	      if (in->fp64s.max > in->fp64s.min)
+		*is_maxmin = TRUE;
+	  }
+	if (in->outtype == INT_32)
+	  {
+	    if (gint32(infile, strm, &in->in32s.max, in))
+		{
+		  (void) fprintf(stderr, err1, infile);
+		  goto 	err;
+		}
+	      if (gint32(infile, strm, &in->in32s.min, in))
+		{
+		  (void) fprintf(stderr, err1, infile);
+		  goto err;
+		}
+	      if (in->in32s.max > in->in32s.min)
+		*is_maxmin = TRUE;
+	  }
+	
+	if (in->outtype == INT_16)
+	  {
+	    if (gint16(infile, strm, &in->in16s.max, in))
+	      {
+		(void) fprintf(stderr, err1, infile);
+		goto 	err;
+	      }
+	    if (gint16(infile, strm, &in->in16s.min, in))
+	      {
+		(void) fprintf(stderr, err1, infile);
+		goto err;
+	      }
+	    if (in->in16s.max > in->in16s.min)
+	      *is_maxmin = TRUE;
+	  }
+	  
+	if (in->outtype == INT_8)
+	  {
+	    if (gint8(infile, strm, &in->in8s.max, in))
+	      {
+		(void) fprintf(stderr, err1, infile);
+		goto 	err;
+	      }
+	    if (gint8(infile, strm, &in->in8s.min, in))
+		{
+		  (void) fprintf(stderr, err1, infile);
+		  goto err;
+		}
+	    if (in->in8s.max > in->in8s.min)
+	      *is_maxmin = TRUE;
+	  }
+      }
+    
+#ifdef  DEBUG
+    (void) printf("\tinput maximum/minimum values:\n\n");
+    (void) printf("\t%E %E\n\n", in->max, in->min);
+#endif /* DEBUG */
+    
+    return (0);
+    
+ err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gscale
+ *
+ * Purpose:
+ *      Determine the scale for each axis.
+ *
+ * Revision: (pkamat)
+ *      Modified to support 32-bit integer, 16-bit integer, 8-bit integer in
+ *		addition to 32-bit float and 64-bit float
+ * Revision: (pvn) March 14, 2006
+ *      Used the SD interface instead of DFSD
+ * Revision: (bmribler - 2006/8/18)
+ *	Removed SDstart call here, used passed-in SD id from process() instead.
+ *	Replaced first parameter with 'struct infilesformat' to use both
+ *	the file name and the SD identifier (handle.)
+ */
+static int
+gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_scale)
+{
+    int         i;
+    int32       hdfdims[3];     /* order: ZYX or YX */
+
+    const char *err1 = "Unable to get axis scale from file: %s.\n";
+
+    *is_scale = TRUE;
+
+    /*
+     * hdfdims is ordered: ZYX or YX
+     * in->dims is ordered: XYZ
+     */
+    if (in->rank == 2)
+      {
+          hdfdims[0] = in->dims[1];
+          hdfdims[1] = in->dims[0];
+      }
+    else
+      {
+          hdfdims[0] = in->dims[2];
+          hdfdims[1] = in->dims[1];
+          hdfdims[2] = in->dims[0];
+      }
+
+    /*
+     * extract the scale values from the input file
+     */
+    if (in->is_hdf == TRUE)
+      {
+	int32 sds_id, dim_id, sd_index = 0;
+	int32 sd_id = infile_info.handle; /* shortcut for handle from SDstart */
+
+	/* select the SDS */
+	sds_id = SDselect (sd_id, sd_index); 
+     
+	/* if the SDS is two-dimensional... */
+	if (in->rank == 2)
+	  {
+	    /* select the dimension */
+	    dim_id = SDgetdimid (sds_id, 0);
+	    if (SDgetdimscale (dim_id, in->vscale)==FAIL)
+	        goto err;
+      
+	    dim_id = SDgetdimid (sds_id, 1);
+	    if (SDgetdimscale (dim_id, in->hscale)==FAIL)
+	        goto err;
+      
+	  }
+	else /* ...three-dimensional... */
+	  {
+	    dim_id = SDgetdimid (sds_id, 0);
+	    if (SDgetdimscale (dim_id, in->dscale)==FAIL)
+	        goto err;
+      
+	    dim_id = SDgetdimid (sds_id, 1);
+	    if (SDgetdimscale (dim_id, in->vscale)==FAIL)
+	        goto err;
+      
+	    dim_id = SDgetdimid (sds_id, 2);
+	    if (SDgetdimscale (dim_id, in->hscale)==FAIL)
+	        goto err;
+	  }
+     
+	/* terminate access to the array. */
+	if (SDendaccess(sds_id)==FAIL)
+	    goto err;
+      }
+    else /* input file is not an HDF file */
+      {
+	char infile[NAME_LEN];
+	strcpy(infile, infile_info.filename);
+	switch(in->outtype)
+	  {
+	  case 0: /* 32-bit float */
+	    if (in->rank == 2)
+	      {
+		for (i = 0; i < hdfdims[0]; i++)
+		  {
+		    if (gfloat(infile, strm, &in->vscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			goto err;
+		      }
+		  }
+		in->vscale[i] = in->vscale[i - 1];
+		for (i = 0; i < hdfdims[1]; i++)
+		  {
+		    if (gfloat(infile, strm, &in->hscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			goto err;
+		      }
+		  }
+		
+		in->hscale[i] = in->hscale[i - 1];
+	      }
+	    else
+	      {
+		for (i = 0; i < hdfdims[0]; i++)
+		  {
+		    if (gfloat(infile, strm, &in->dscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			goto err;
+		      }
+		  }
+		in->dscale[i] = in->dscale[i - 1];
+		for (i = 0; i < hdfdims[1]; i++)
+		  {
+		    if (gfloat(infile, strm, &in->vscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			goto err;
+		      }
+		  }
+		in->vscale[i] = in->vscale[i - 1];
+		for (i = 0; i < hdfdims[2]; i++)
+		  {
+		    if (gfloat(infile, strm, &in->hscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			goto err;                 	
+		      }
+		  }
+		in->hscale[i] = in->hscale[i - 1];
+	      }
+	    break;
+	    
+	  case 1: /* 64-bit float */
+	    if (in->rank == 2)
+		  {
+		    for (i = 0; i < hdfdims[0]; i++)
+		      {
+			if (gfloat64(infile, strm, &in->fp64s.vscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->fp64s.vscale[i] = in->fp64s.vscale[i - 1];     
+		    for (i = 0; i < hdfdims[1]; i++)
+		      {
+			if (gfloat64(infile, strm, &in->fp64s.hscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->fp64s.hscale[i] = in->fp64s.hscale[i - 1];
+		  }
+	    else
+	      {
+		for (i = 0; i < hdfdims[0]; i++)
+		  {
+		    if (gfloat64(infile, strm, &in->fp64s.dscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			goto err;
+		      }
+		  }
+		in->fp64s.dscale[i] = in->fp64s.dscale[i - 1];
+
+		for (i = 0; i < hdfdims[1]; i++)
+		  {
+			if (gfloat64(infile, strm, &in->fp64s.vscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		  }
+		in->fp64s.vscale[i] = in->fp64s.vscale[i - 1];
+
+		for (i = 0; i < hdfdims[2]; i++)
+		  {
+		    if (gfloat64(infile, strm, &in->fp64s.hscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			goto err;                 	
+		      }
+		  }
+		in->fp64s.hscale[i] = in->fp64s.hscale[i - 1];
+	      }
+	    break;
+		
+	  case 2: /* 32-bit integer */
+	    if (in->rank == 2)
+	      {
+		for (i = 0; i < hdfdims[0]; i++)
+		  {
+		    if (gint32(infile, strm, &in->in32s.vscale[i], in))
+		      {
+			(void) fprintf(stderr, err1, infile);
+			    goto err;
+		      }
+		    
+		  }
+		in->in32s.vscale[i] = in->in32s.vscale[i - 1];
+		for (i = 0; i < hdfdims[1]; i++)
+		      {
+			if (gint32(infile, strm, &in->in32s.hscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		in->in32s.hscale[i] = in->in32s.hscale[i - 1];
+	      }
+	    
+	    else
+	      {
+		    for (i = 0; i < hdfdims[0]; i++)
+		      {
+			if (gint32(infile, strm, &in->in32s.dscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in32s.dscale[i] = in->in32s.dscale[i - 1];
+		    for (i = 0; i < hdfdims[1]; i++)
+		      {
+			if (gint32(infile, strm, &in->in32s.vscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in32s.vscale[i] = in->in32s.vscale[i - 1];
+		    for (i = 0; i < hdfdims[2]; i++)
+		      {
+			if (gint32(infile, strm, &in->in32s.hscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;                 	
+			  }
+		      }
+		    in->in32s.hscale[i] = in->in32s.hscale[i - 1];
+	      }
+		break;
+
+	  case 3: /* 16-bit integer */
+		if (in->rank == 2)
+		  {
+		    for (i = 0; i < hdfdims[0]; i++)
+		      {
+			if (gint16(infile, strm, &in->in16s.vscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in16s.vscale[i] = in->in16s.vscale[i - 1];
+		    for (i = 0; i < hdfdims[1]; i++)
+		      {
+			if (gint16(infile, strm, &in->in16s.hscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in16s.hscale[i] = in->in16s.hscale[i - 1];
+		  }
+		
+		else
+		  {
+		    for (i = 0; i < hdfdims[0]; i++)
+		      {
+			if (gint16(infile, strm, &in->in16s.dscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in16s.dscale[i] = in->in16s.dscale[i - 1];
+		    for (i = 0; i < hdfdims[1]; i++)
+		      {
+			if (gint16(infile, strm, &in->in16s.vscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in16s.vscale[i] = in->in16s.vscale[i - 1];
+		    for (i = 0; i < hdfdims[2]; i++)
+		      {
+			if (gint16(infile, strm, &in->in16s.hscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;                 	
+			  }
+		      }
+		    in->in16s.hscale[i] = in->in16s.hscale[i - 1];
+		  }
+		break;
+
+	      case 4: /* 8-bit integer */
+		if (in->rank == 2)
+		  {
+		    for (i = 0; i < hdfdims[0]; i++)
+		      {
+			if (gint8(infile, strm, &in->in8s.vscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in8s.vscale[i] = in->in8s.vscale[i - 1];
+		    for (i = 0; i < hdfdims[1]; i++)
+		      {
+			if (gint8(infile, strm, &in->in8s.hscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in8s.hscale[i] = in->in8s.hscale[i - 1];
+		  }
+		
+		else
+		  {
+		    for (i = 0; i < hdfdims[0]; i++)
+		      {
+			if (gint8(infile, strm, &in->in8s.dscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in8s.dscale[i] = in->in8s.dscale[i - 1];
+		    for (i = 0; i < hdfdims[1]; i++)
+		      {
+			if (gint8(infile, strm, &in->in8s.vscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;
+			  }
+		      }
+		    in->in8s.vscale[i] = in->in8s.vscale[i - 1];
+		    for (i = 0; i < hdfdims[2]; i++)
+		      {
+			if (gint8(infile, strm, &in->in8s.hscale[i], in))
+			  {
+			    (void) fprintf(stderr, err1, infile);
+			    goto err;                 	
+			  }
+		      }
+		    in->in8s.hscale[i] = in->in8s.hscale[i - 1];
+		  }
+		break;
+	      }
+      }
+
+#ifdef  DEBUG
+    if (in->rank == 2)
+      {
+          (void) printf("\tscales of the axes (vert,horiz):\n\n\t");
+          for (i = 0; i < hdfdims[0]; i++)
+              (void) printf("%E ", in->vscale[i]);
+          (void) printf("\n\t");
+          for (i = 0; i < hdfdims[1]; i++)
+              (void) printf("%E ", in->hscale[i]);
+      }
+    else
+      {
+          (void) printf("\tscales of the axes (depth,vert,horiz):\n\n\t");
+          for (i = 0; i < hdfdims[0]; i++)
+              (void) printf("%E ", in->dscale[i]);
+          (void) printf("\n\t");
+          for (i = 0; i < hdfdims[1]; i++)
+              (void) printf("%E ", in->vscale[i]);
+          (void) printf("\n\t");
+          for (i = 0; i < hdfdims[2]; i++)
+              (void) printf("%E ", in->hscale[i]);
+      }
+    (void) printf("\n\n\n");
+#endif /* DEBUG */
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      gtoken
+ *
+ * Purpose:
+ *      Return the token identifier associated with the command line
+ *      argument.
+ */
+static int
+gtoken(char *s)
+{
+    size_t      len;
+    int         token;
+
+    const char *err1 = "Illegal argument: %s.\n";
+
+    /*
+     * identify the token type
+     */
+    if (s[0] == '-')
+      {     /* option name (or negative number) */
+          token = ERR;
+          len = HDstrlen(&s[1]);
+          switch (s[1])
+            {
+                case 'o':
+                    if (!HDstrncmp("outfile", &s[1], len))
+                        token = OPT_o;
+                    break;
+                case 'r':
+                    if (!HDstrncmp("raster", &s[1], len))
+                        token = OPT_r;
+                    break;
+                case 'e':
+                    if (!HDstrncmp("expand", &s[1], len))
+                        token = OPT_e;
+                    break;
+                case 'i':
+                    if (!HDstrncmp("interp", &s[1], len))
+                        token = OPT_i;
+                    break;
+                case 'p':
+                    if (!HDstrncmp("palfile", &s[1], len))
+                        token = OPT_p;
+                    break;
+                case 'f':
+                    if (!HDstrncmp("float", &s[1], len))
+                        token = OPT_f;
+                    break;
+                case 'h':
+                    if (!HDstrncmp("help", &s[1], len))
+                        token = OPT_h;
+                    break;
+                case 'm':
+                    if (!HDstrncmp("mean", &s[1], len))
+                        token = OPT_m;
+                    break;
+			    case 'n':                 
+                        token = OPT_n;
+	                break;
+				case 't':
+ 					    token = OPT_t;	
+					break;
+                default:
+                    if (isnum(s))   /* negative number? */
+                        token = NUMBR;
+            }
+          if (token == ERR)
+              (void) fprintf(stderr, err1, s);
+
+      }
+    else if (isnum(s))  /* positive number */
+        token = NUMBR;
+    else    /* filename */
+        token = FILNAME;
+
+    return (token);
+}
+
+/*
+ * Name:
+ *      gtype
+ *
+ * Purpose:
+ *      Determine the type of the input file (HDF, TEXT, FP32, FP64)
+ *
+ * Revision: (pkamat)
+ *		Modified to support INT32, INT16, INT8 formats.
+ *      Also determines and validates the outtype type of the data-set
+ */
+static int
+gtype(char *infile, struct Input *in, FILE **strm)
+{
+    char        buf[8];
+
+    const char *err1 = "Unable to open file: %s.\n";
+    const char *err2 = "Unable to get format tag from file: %s.\n";
+    const char *err3 = "Invalid file format in file: %s.\n";
+    const char *err4 = "Invalid use of -t or -n options. Can be used only for TEXT files or for FP64 binary files\n";
+
+    /*
+     * determine the input file format
+     */
+    if (Hishdf(infile))
+        in->is_hdf = TRUE;
+    else
+      {
+	if ((*strm = fopen(infile, "r")) == NULL)
+	  {
+	    (void) fprintf(stderr, err1, infile);
+	    goto err;
+	  }
+	if (fread(buf, 4, 1, *strm) != 1)
+	  {
+	    (void) fprintf(stderr, err2, infile);
+	    goto err;
+	  }
+	if (!HDmemcmp("TEXT", buf, 4) || !HDmemcmp("text", buf, 4))
+	  {
+	    in->is_text = TRUE;
+	    if (in->outtype == NO_NE)
+	      in->outtype = FP_32;
+	    
+	  }
+	else
+	  {
+	    if (!HDmemcmp("FP64", buf, 4) ||
+		     !HDmemcmp("fp64", buf, 4))
+	      {
+			in->is_fp64 = TRUE;
+			if (in->outtype != FP_64)
+				if (in->outtype != NO_NE)
+				{
+					(void) fprintf(stderr, err4, infile);
+					goto err;		
+				}
+				else in->outtype = FP_32;
+	      }
+	    else
+	      {
+		if (in->outtype != NO_NE)
+		  {   
+		    (void) fprintf(stderr, err4, infile);
+		    goto err;		
+		  }
+		if (!HDmemcmp("FP32", buf, 4) || !HDmemcmp("fp32", buf, 4))
+		  {
+		    in->is_fp32 = TRUE;
+		    in->outtype = FP_32;
+		
+		  }
+		
+		else if (!HDmemcmp("IN32", buf, 4) ||
+                         !HDmemcmp("in32", buf, 4))
+		  in->outtype = INT_32;
+		else if (!HDmemcmp("IN16", buf, 4) ||
+			 !HDmemcmp("in16", buf, 4))
+		  in->outtype = INT_16;
+		else if (!HDmemcmp("IN08", buf, 4) ||
+		       !HDmemcmp("in08", buf, 4))
+		  in->outtype = INT_8;
+		else
+		  {
+		    (void) fprintf(stderr, err3, infile);
+		    goto err;
+		  }
+		if (in->outtype == NO_NE)
+		  {   
+		    (void) fprintf(stderr, err4, infile);
+		    goto err;
+		  }
+	      }
+	  }
+      }
+    
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      help
+ *
+ * Purpose:
+ *      Print a helpful summary of command usage and features.
+ */
+void
+help(char *name)
+{
+    (void) printf("Name:\n");
+    (void) printf("\t%s (previously fp2hdf)\n\n", name);
+    (void) printf("Purpose:\n");
+    (void) printf("\tTo convert floating point data to HDF Scientific ");
+    (void) printf("Data Set (SDS)\n");
+    (void) printf("\tand/or 8-bit Raster Image Set (RIS8) format, ");
+    (void) printf("storing the results\n");
+    (void) printf("\tin an HDF file.  The image data can be scaled ");
+    (void) printf("about a mean value.\n\n");
+
+    (void) fprintf (stderr, "Synopsis:");
+    (void) fprintf (stderr, "\n\t%s -h[elp]", name);
+    (void) fprintf (stderr, "\n\t\tPrint this summary of usage and exit.");
+    (void) fprintf (stderr, "\n\t\t");
+    (void) fprintf (stderr, "\n\t%s -V", name);
+    (void) fprintf (stderr, "\n\t\tPrint version of the HDF4 library and exit.");
+    (void) fprintf (stderr, "\n\t\t");
+    (void) fprintf (stderr, "\n\t%s <infile> [ [-t[ype] <output-type> | -n] [<infile> [-t[ype] <output-type> | -n]...]", name);
+    (void) fprintf (stderr, "\n\t\t\t\t\t-o[utfile] <outfile> [-r[aster] [ras_opts ...]] [-f[loat]]");
+
+    (void) fprintf (stderr, "\n\n\t<infile(s)>:");
+    (void) fprintf (stderr, "\n\t\tName of the input file(s), containing a single ");
+    (void) fprintf (stderr, "\n\t\ttwo-dimensional or three-dimensional floating point array ");
+    (void) fprintf (stderr, "\n\t\tin either ASCII text, native floating point, native integer ");
+    (void) fprintf (stderr, "\n\t\tor HDF SDS format.  If an HDF file is used for input, it ");
+    (void) fprintf (stderr, "\n\t\tmust contain an SDS. The SDS need only contain a dimension ");
+    (void) fprintf (stderr, "\n\t\trecord and the data, but if it also contains maximum and ");
+    (void) fprintf (stderr, "\n\t\tminimum values and/or scales for each axis, these will ");
+    (void) fprintf (stderr, "\n\t\tbe used.  If the input format is ASCII text or native ");
+    (void) fprintf (stderr, "\n\t\tfloating point or native integer, see \"Notes\" below on ");
+    (void) fprintf (stderr, "\n\t\thow it must be organized.");
+
+    (void) fprintf (stderr, "\n\n\t-t[ype] <output_type>: ");
+    (void) fprintf (stderr, "\n\t\tOptionally used for every input ASCII file to specify the ");
+    (void) fprintf (stderr, "\n\t\tdata type of the data-set to be written. If not specified               ");
+    (void) fprintf (stderr, "\n\t\tdefault data type is 32-bit floating point. <output-type>");
+    (void) fprintf (stderr, "\n\t\tcan be any of the following: FP32 (default), FP64, INT32");
+    (void) fprintf (stderr, "\n\t\tINT16, INT8. It can be used only with ASCII files.");
+
+    (void) fprintf (stderr, "\n\n\t-n:  ");
+    (void) fprintf (stderr, "\n\t\tThis option is to be used only if the binary input file ");
+    (void) fprintf (stderr, "\n\t\tcontains 64-bit floating point data and the default");
+    (void) fprintf (stderr, "\n\t\tbehaviour (default behaviour is to write it to a 32-bit");
+    (void) fprintf (stderr, "\n\t\tfloating point data-set) should be overridden to write ");
+    (void) fprintf (stderr, "\n\t\tit to a 64-bit floating point data-set.");
+
+    (void) fprintf (stderr, "\n\n\t-o[utfile] <outfile>:");
+    (void) fprintf (stderr, "\n\t\tData from one or more input files are stored as one or");
+    (void) fprintf (stderr, "\n\t\tmore data sets and/or images in one HDF output file,");
+    (void) fprintf (stderr, "\n\t\t\"outfile\".");
+
+    (void) fprintf (stderr, "\n\n\t-r[aster]:");
+    (void) fprintf (stderr, "\n\t\tStore output as a raster image set in the output file.");
+
+    (void) fprintf (stderr, "\n\n\t-f[loat]:");
+    (void) fprintf (stderr, "\n\tStore output as a scientific data set in the output file.");
+    (void) fprintf (stderr, "\n\tThis is the default if the \"-r\" option is not specified.");
+
+    (void) fprintf (stderr, "\n\n\tras_opts ...");
+    (void) fprintf (stderr, "\n\n\t-e[xpand] <horiz> <vert> [<depth>]:");
+    (void) fprintf (stderr, "\n\tExpand float data via pixel replication to produce the");
+    (void) fprintf (stderr, "\n\timage(s).  \"horiz\" and \"vert\" give the horizontal and");
+    (void) fprintf (stderr, "\n\tvertical resolution of the image(s) to be produced; and");
+    (void) fprintf (stderr, "\n\toptionally, \"depth\" gives the number of images or depth");
+    (void) fprintf (stderr, "\n\tplanes (for 3D input data).");
+
+    (void) fprintf (stderr, "\n\n\t-i[nterp] <horiz> <vert> [<depth>]:");
+    (void) fprintf (stderr, "\n\t\tApply bilinear, or trilinear, interpolation to the float");
+    (void) fprintf (stderr, "\n\t\tdata to produce the image(s).  \"horiz\", \"vert\", and \"depth\"");
+    (void) fprintf (stderr, "\n\t\tmust be greater than or equal to the dimensions of the");
+    (void) fprintf (stderr, "\n\t\toriginal dataset.");
+    (void) fprintf (stderr, "\n\t\tIf max and min are supplied in input file, this option clips");
+    (void) fprintf (stderr, "\n\t\tvalues that are greater than max or less then min, setting");
+    (void) fprintf (stderr, "\n\t\tthem to the max and min, respectively.");
+
+    (void) fprintf (stderr, "\n\n\t-p[alfile] <palfile>:");
+    (void) fprintf (stderr, "\n\t\tStore the palette with the image.  Get the palette from");
+    (void) fprintf (stderr, "\n\t\t\"palfile\"; which may be an HDF file containing a palette,");
+    (void) fprintf (stderr, "\n\t\tor a file containing a raw palette.");
+
+    (void) fprintf (stderr, "\n\n\t-m[ean] <mean>:");
+    (void) fprintf (stderr, "\n\t\tIf a floating point mean value is given, the image will be");
+    (void) fprintf (stderr, "\n\t\tscaled about the mean.  The new extremes (newmax and newmin),");
+    (void) fprintf (stderr, "\n\t\tas given by:");
+
+    (void) fprintf (stderr, "\n\n\t\t\tnewmax = mean + max(abs(max-mean), abs(mean-min))");
+    (void) fprintf (stderr, "\n\t\t\tnewmin = mean - max(abs(max-mean), abs(mean-min))");
+
+    (void) fprintf (stderr, "\n\n\t\twill be equidistant from the mean value.  If no mean value");
+    (void) fprintf (stderr, "\n\t\tis given, then the mean will be:  0.5   (max + min)");
+
+    (void) fprintf (stderr, "\n\n\tNotes:");
+    (void) fprintf (stderr, "\n\t\tIf the input file format is ASCII text or native floating point or native integer(32-bit,");
+    (void) fprintf (stderr, "\n\t\t16-bit, 8-bit), it");
+    (void) fprintf (stderr, "\n\t\tmust have the following input fields:");
+
+    (void) fprintf (stderr, "\n\t\tformat");
+    (void) fprintf (stderr, "\n\t\tnplanes");
+    (void) fprintf (stderr, "\n\t\tnrows");
+    (void) fprintf (stderr, "\n\t\tcols");
+    (void) fprintf (stderr, "\n\t\tmax_value");
+    (void) fprintf (stderr, "\n\t\tmin_value");
+    (void) fprintf (stderr, "\n\t\t[plane1 plane2 plane3 ...]");
+    (void) fprintf (stderr, "\n\t\trow1 row2 row3 ...");
+    (void) fprintf (stderr, "\n\t\tcol1 col2 col3 ...");
+    (void) fprintf (stderr, "\n\t\tdata1 data2 data3 ...");
+
+    (void) fprintf (stderr, "\n\n\t\tWhere:");
+    (void) fprintf (stderr, "\n\n\t\tformat:");
+    (void) fprintf (stderr, "\n\t\t\tFormat designator (\"TEXT\", \"FP32\", \"FP64\", \"IN32\", \"IN16\", \"IN08\").");
+    (void) fprintf (stderr, "\n\t\t\tnplanes, nrows, ncols:");
+    (void) fprintf (stderr, "\n\t\t\tDimensions are specified in the order slowest changing dimension first.");
+    (void) fprintf (stderr, "\n\t\t\tncols is dimension of the fastest changing dimension. (horizontal axis");
+    (void) fprintf (stderr, "\n\t\t\tor X-axis in a 3D scale)");
+    (void) fprintf (stderr, "\n\t\t\tnrows corresponds to dimension of the vertical axis or Y-axis in a 3D ");
+    (void) fprintf (stderr, "\n\t\t\tscale.");
+    (void) fprintf (stderr, "\n\t\t\tnplanes corresponds to the slowest changing dimension i.e. dimension of ");
+    (void) fprintf (stderr, "\n\t\t\tthe depth axis or the Z-axis in a 3D scale (\"1\" for 2D input).");
+    (void) fprintf (stderr, "\n\t\tmax_value:");
+    (void) fprintf (stderr, "\n\t\t\tMaximum data value.");
+    (void) fprintf (stderr, "\n\t\tmin_value:");
+    (void) fprintf (stderr, "\n\t\t\tMinimum data value.");
+    (void) fprintf (stderr, "\n\t\tplane1, plane2, plane3, ...:");
+    (void) fprintf (stderr, "\n\t\t\tScales for depth axis.");
+    (void) fprintf (stderr, "\n\t\trow1, row2, row3, ...:");
+    (void) fprintf (stderr, "\n\t\t\tScales for the vertical axis.");
+    (void) fprintf (stderr, "\n\t\tcol1, col2, col3, ...:");
+    (void) fprintf (stderr, "\n\t\t\tScales for the horizontal axis.");
+    (void) fprintf (stderr, "\n\t\tdata1, data2, data3, ...:");
+    (void) fprintf (stderr, "\n\t\t\tThe data ordered by rows, left to right and top");
+    (void) fprintf (stderr, "\n\t\t\tto bottom; then optionally, ordered by planes,");
+    (void) fprintf (stderr, "\n\t\t\tfront to back.");
+
+    (void) fprintf (stderr, "\n\n\t\tFor FP32 and FP64 input format, \"format\", \"nplanes\", \"nrows\", \"ncols\",");
+    (void) fprintf (stderr, "\n\t\tand \"nplanes\" are native integers; where \"format\" is the integer");
+    (void) fprintf (stderr, "\n\t\trepresentation of the appropriate 4-character string (0x46503332 for");
+    (void) fprintf (stderr, "\n\t\t\"FP32\" and 0x46503634 for \"FP64\").  The remaining input fields are");
+    (void) fprintf (stderr, "\n\t\tcomposed of native 32-bit floating point values for FP32 input format,");
+    (void) fprintf (stderr, "\n\t\tor native 64-bit floating point values for FP64 input format.");
+
+    (void) fprintf (stderr, "\n\n\tFor IN32, IN16 and IN08 input format, \"format\", \"nplanes\", \"nrows\", \"ncols\",");
+    (void) fprintf (stderr, "\n\t\tand \"nplanes\" are native integers; where \"format\" is the integer");
+    (void) fprintf (stderr, "\n\t\trepresentation of the appropriate 4-character string. The remaining input ");
+    (void) fprintf (stderr, "\n\t\tfields are composed of native 32-bit integer values for IN32 input format,");
+    (void) fprintf (stderr, "\n\t\tor native 16-bit integer values for IN16 input format or native 8-bit ");
+    (void) fprintf (stderr, "\n\t\tinteger values for IN08 input format.");
+
+    (void) printf("\nExamples:\n");
+    (void) printf("\tConvert floating point data in \"f1.txt\" to SDS ");
+    (void) printf("format, and store it\n");
+    (void) printf("\tas an SDS in HDF file \"o1\":\n\n");
+    (void) printf("\t\t%s f1.txt -o o1\n\n", name);
+    (void) printf("\tConvert floating point data in \"f2.hdf\" to ");
+    (void) printf("8-bit raster format, and\n");
+    (void) printf("\tstore it as an RIS8 in HDF file \"o2\":\n\n");
+    (void) printf("\t\t%s f2.hdf -o o2 -r\n\n", name);
+    (void) printf("\tConvert floating point data in \"f3.bin\" to ");
+    (void) printf("8-bit raster format and\n");
+    (void) printf("\tSDS format, and store both the RIS8 and the SDS ");
+    (void) printf("in HDF file \"o3\":\n\n");
+    (void) printf("\t\t%s f3.bin -o o3 -r -f\n\n", name);
+    (void) printf("\tConvert floating point data in \"f4\" to a ");
+    (void) printf("500x600 raster image, and\n");
+    (void) printf("\tstore the RIS8 in HDF file \"o4\".  Also store a ");
+    (void) printf("palette from \"palfile\"\n");
+    (void) printf("\twith the image:\n\n");
+    (void) printf("\t\t%s f4 -o o4 -r -e 500 600 -p palfile\n\n", name);
+    (void) printf("\tConvert floating point data in \"f5\" to 200 ");
+    (void) printf("planes of 500x600 raster\n");
+    (void) printf("\timages, and store the RIS8 in HDF file \"o5\".  ");
+    (void) printf("Also scale the image\n");
+    (void) printf("\tdata so that it is centered about a mean value ");
+    (void) printf("of 10.0:\n\n");
+    (void) printf("\t\t%s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name);
+
+    return;
+}
+
+/*
+ * Name:
+ *      indexes
+ *
+ * Purpose:
+ *      For each pixel location along an axis, determine the nearest
+ *      scale value neighbor.  Return a list of indexes into the scale
+ *      array.
+ */
+static int
+indexes(float32 *scale, int dim, int *idx, int res)
+{
+    int         i, j;
+    float32    *midpt;
+    float32     loc;
+    float32     delta;
+
+    const char *err1 = "Unable to allocate dynamic memory.\n";
+    /*
+     * determine the midpoints between scale values
+     */
+    if ((midpt = (float32 *) HDmalloc((size_t) dim * sizeof(float32))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    for (i = 0; i < dim - 1; i++)
+        midpt[i] = (scale[i] + scale[i + 1]) * (float32)0.5;
+    midpt[dim - 1] = scale[dim - 1] + (scale[dim - 1] - midpt[dim - 2]);
+
+    /*
+     * determine the distance between pixel locations
+     */
+    delta = (scale[dim - 1] - scale[0]) / (float32)(res - 1);
+
+    /*
+     * compute indexes, keeping the index the same until the location
+     * extends beyond the midpoint
+     */
+    for (i = 1, j = 0, idx[0] = 0, loc = scale[0]; i < res; i++)
+      {
+          loc += delta;
+          idx[i] = idx[i - 1];
+          while (loc >= midpt[j])
+            {
+                idx[i] += 1;
+                j += 1;
+            }
+      }
+
+    /*
+     * free dynamically allocated memory
+     */
+    HDfree((char *) midpt);
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      interp
+ *
+ * Purpose:
+ *      Use a bilinear, or trilinear, interpolation scheme to construct
+ *      the raster image(s).
+ *
+ *  Bug revision:  the line that previously read:
+ *
+ *      hratio[i] = ((hrange > 0) ? 1.0 : -1.0) * (in->hscale[j+1] -
+ *                    loc) / (in->hscale[j+1] - in->hscale[j]);
+ *    has been changed to read:
+ *      hratio[i] = (in->hscale[j+1] - loc) / (in->hscale[j+1] - in->hscale[j]);
+ *
+ *    Similar changes were made to the corresponding lines for
+ *    computing vratio and dratio.
+ *
+ *  Bug revision: If values occur that are outside the ranges of the
+ *    max and min values provided, these values are now "clipped" to
+ *    be the same as the max and min, respectively.
+ */
+
+static int
+interp(struct Input *in, struct Raster *im)
+{
+    int         i, j, k, m;
+    int        *hinc, *voff, *doff = NULL;
+    float32     pix;
+    float32     loc;
+    float32     range;
+    float32     ratio;
+    float32     hrange, vrange, drange = (float32)0.0;
+    float32     hdelta, vdelta, ddelta = (float32)0.0;
+    float32     t1, t2, t3, t4, t5, t6;
+    float32    *hratio, *vratio, *dratio = NULL;
+    float32    *pt[8];
+    unsigned char *ip = im->image;
+
+    const char *err1 = "Unable to allocate dynamic memory.\n";
+
+    /*
+     * determine the range of pixel locations
+     */
+    range = in->max - in->min;
+    ratio = (float32)237.9 / range;
+    hrange = in->hscale[in->dims[0] - 1] - in->hscale[0];
+    vrange = in->vscale[in->dims[1] - 1] - in->vscale[0];
+    if (in->rank == 3)
+        drange = in->dscale[in->dims[2] - 1] - in->dscale[0];
+
+    /*
+     * determine the distance between pixel locations
+     */
+    hdelta = hrange / (float32)(im->hres - 1);
+    vdelta = vrange / (float32)(im->vres - 1);
+    if (in->rank == 3)
+        ddelta = drange / (float32)(im->dres - 1);
+
+    /*
+     * allocate dynamic memory for the interpolation ratio buffers
+     */
+    if ((hratio = (float32 *) HDmalloc((size_t) im->hres * sizeof(float32))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if ((vratio = (float32 *) HDmalloc((unsigned int) im->vres *
+                                         sizeof(float32))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if (in->rank == 3)
+      {
+          if ((dratio = (float32 *) HDmalloc((unsigned int) im->dres *
+                                               sizeof(float32))) == NULL)
+            {
+                (void) fprintf(stderr, err1);
+                goto err;
+            }
+      }
+
+    /*
+     * allocate dynamic memory for the pixel location offset/increment
+     * buffers
+     */
+    if ((hinc = (int *) HDmalloc((unsigned int) im->hres *
+                                   sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if ((voff = (int *) HDmalloc((unsigned int) (im->vres + 1) *
+                                   sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    if (in->rank == 3)
+      {
+          if ((doff = (int *) HDmalloc((unsigned int) (im->dres + 1) *
+                                         sizeof(int))) == NULL)
+            {
+                (void) fprintf(stderr, err1);
+                goto err;
+            }
+      }
+
+    /*
+     * compute the interpolation ratios and pixel location
+     * offsets/increments for each axis
+     */
+    for (i = 0, j = 0; i < im->hres; i++)
+      {
+          loc = hdelta * (float) i + in->hscale[0];
+          hinc[i] = 0;
+          while ((j < (in->dims[0] - 2)) && ((hrange > (float32)0.0) ?
+                     (in->hscale[j + 1] < loc) : (in->hscale[j + 1] > loc)))
+            {
+                hinc[i] += 1;
+                j += 1;
+            }
+          hratio[i] = (in->hscale[j + 1] - loc) / (in->hscale[j + 1] - in->hscale[j]);
+      }
+    for (i = 0, j = 0, voff[0] = 0; i < im->vres; i++)
+      {
+          loc = vdelta * (float) i + in->vscale[0];
+          while ((j < (in->dims[1] - 2)) && ((vrange > (float32)0.0) ?
+                     (in->vscale[j + 1] < loc) : (in->vscale[j + 1] > loc)))
+            {
+                voff[i] += 1;
+                j += 1;
+            }
+          vratio[i] = (in->vscale[j + 1] - loc) / (in->vscale[j + 1] - in->vscale[j]);
+          voff[i + 1] = voff[i];
+      }
+    if (in->rank == 3)
+      {
+          for (i = 0, j = 0, doff[0] = 0; i < im->dres; i++)
+            {
+                loc = ddelta * (float) i + in->dscale[0];
+                while ((j < (in->dims[2] - 2)) && ((drange > (float32)0.0) ?
+                     (in->dscale[j + 1] < loc) : (in->dscale[j + 1] > loc)))
+                  {
+                      doff[i] += 1;
+                      j += 1;
+                  }
+                dratio[i] = (in->dscale[j + 1] - loc) /
+                    (in->dscale[j + 1] - in->dscale[j]);
+                doff[i + 1] = doff[i];
+            }
+      }
+
+    /*
+     * do the interpolation for each point in the target image, taking
+     * advantage of the fact that the target is evenly spaced along each
+     * axis
+     */
+    if (in->rank == 2)
+      {
+          for (i = 0; i < im->vres; i++)
+            {
+                pt[0] = (float32 *) in->data + (in->dims[0] * voff[i]);
+                pt[1] = pt[0] + 1;
+                pt[2] = pt[0] + in->dims[0];
+                pt[3] = pt[2] + 1;
+                for (j = 0; j < im->hres; j++)
+                  {
+                      for (m = 0; m < 4; m++)
+                          pt[m] += hinc[j];
+                      t1 = *pt[2] - ((*pt[2] - *pt[0]) * vratio[i]);
+                      t2 = *pt[3] - ((*pt[3] - *pt[1]) * vratio[i]);
+                      pix = t2 - ((t2 - t1) * hratio[j]);
+                      if (pix > in->max)
+                          pix = in->max;    /* clip (bug fix) */
+                      if (pix < in->min)
+                          pix = in->min;    /* ditto */
+                      *ip++ = (unsigned char)((ratio * (pix - in->min)) + (float32)1.5);
+                  }
+            }
+      }
+    else
+      {     /* rank == 3 */
+          for (i = 0; i < im->dres; i++)
+            {
+                for (j = 0; j < im->vres; j++)
+                  {
+                      pt[0] = (float32 *) in->data + (in->dims[0] * voff[j]) +
+                          (in->dims[0] * in->dims[1] * doff[i]);
+                      pt[1] = pt[0] + 1;
+                      pt[2] = pt[0] + in->dims[0];
+                      pt[3] = pt[2] + 1;
+                      pt[4] = pt[0] + (in->dims[0] * in->dims[1]);
+                      pt[5] = pt[4] + 1;
+                      pt[6] = pt[4] + in->dims[0];
+                      pt[7] = pt[6] + 1;
+                      for (k = 0; k < im->hres; k++)
+                        {
+                            for (m = 0; m < 8; m++)
+                                pt[m] += hinc[k];
+                            t1 = *pt[4] - ((*pt[4] - *pt[0]) *
+                                           dratio[i]);
+                            t2 = *pt[6] - ((*pt[6] - *pt[2]) *
+                                           dratio[i]);
+                            t3 = *pt[5] - ((*pt[5] - *pt[1]) *
+                                           dratio[i]);
+                            t4 = *pt[7] - ((*pt[7] - *pt[3]) *
+                                           dratio[i]);
+                            t5 = t2 - ((t2 - t1) * vratio[j]);
+                            t6 = t4 - ((t4 - t3) * vratio[j]);
+                            pix = t6 - ((t6 - t5) * hratio[k]);
+                            if (pix > in->max)
+                                pix = in->max;  /* clip (bug fix) */
+                            if (pix < in->min)
+                                pix = in->min;  /* ditto */
+                            *ip++ = (unsigned char)((ratio * (pix - in->min)) + (float32)1.5);
+                        }
+                  }
+            }
+      }
+
+    /*
+     * free dynamically allocated memory
+     */
+    HDfree((char *) hratio);
+    HDfree((char *) vratio);
+    if (in->rank == 3)
+        HDfree((char *) dratio);
+    HDfree((char *) hinc);
+    HDfree((char *) voff);
+    if (in->rank == 3)
+        HDfree((char *) doff);
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      isnum
+ *
+ * Purpose:
+ *      Determine whether or not the string is representative of an
+ *      integer or floating point number.  If it is, a non-zero value
+ *      is returned.  A leading (-) to denote sign is acceptable.
+ */
+static int
+isnum(char *s)
+{
+    char       *cp;
+    int         rval = FALSE;
+
+    /*
+     * check to see if its a floating point number
+     */
+    cp = s;
+    (void) strtod(s, &cp);
+    if ((*cp == '\0') && (cp != s))
+        rval = TRUE;
+
+    /*
+     * check to see if its an integer number (radix 8, 10, or 16)
+     */
+    else
+      {
+          cp = s;
+          (void) strtol(s, &cp, 0);
+          if ((*cp == '\0') && (cp != s))
+              rval = TRUE;
+      }
+
+    return (rval);
+}
+
+/*
+ * Name:
+ *      mean
+ *
+ * Purpose:
+ *      Reset the maximum and minimum data values to be symmetric about
+ *      the user-specified mean value.
+ */
+void
+mean(struct Input *in,struct Options * opt)
+{
+    float32     delta, delta_max, delta_min;
+
+    delta_max = (float32)fabs((double)(in->max - opt->meanval));
+    delta_min = (float32)fabs((double)(opt->meanval - in->min));
+    delta = (delta_max > delta_min) ? delta_max : delta_min;
+
+    in->max = opt->meanval + delta;
+    in->min = opt->meanval - delta;
+
+    return;
+}
+
+/*
+ * Name:
+ *      palette
+ *
+ * Purpose:
+ *      Process the (user specified) palette input file.
+ */
+static int
+palette(char *palfile)
+{
+    unsigned char *color;
+    unsigned char pal[1024], red[256], green[256], blue[256];
+    FILE       *strm;
+    int         i;
+
+    const char *err1 = "Unable to get palette from file: %s.\n";
+    const char *err2 = "Unable to open palette file: %s.\n";
+    const char *err3 = "Unable to set default palette.\n";
+
+    /*
+     * extract a palette from an HDF file
+     */
+    if (Hishdf(palfile))
+      {
+          if (DFPgetpal(palfile, pal))
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+
+          /*
+           * read in a raw palette file
+           */
+      }
+    else
+      {
+          if ((strm = fopen(palfile, "r")) == NULL)
+            {
+                (void) fprintf(stderr, err2, palfile);
+                goto err;
+            }
+          if (fread((char *) red, 1, 256, strm) != 256)
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+          else if (fread((char *) green, 1, 256, strm) != 256)
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+          else if (fread((char *) blue, 1, 256, strm) != 256)
+            {
+                (void) fprintf(stderr, err1, palfile);
+                goto err;
+            }
+          (void) fclose(strm);
+
+          /*
+           * interleave the R,G,B values
+           */
+          color = pal;
+          for (i = 0; i < 256; i++)
+            {
+                *color++ = red[i];
+                *color++ = green[i];
+                *color++ = blue[i];
+            }
+      }
+
+    /*
+     * set up the palette as the default for subsequent images
+     */
+    if (DFR8setpalette(pal))
+      {
+          (void) fprintf(stderr, err3);
+          goto err;
+      }
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      pixrep
+ *
+ * Purpose:
+ *      Expand the image(s) to the desired resolution using pixel
+ *      replication.
+ */
+static int
+pixrep(struct Input *in, struct Raster *im)
+{
+    int        *hidx, *vidx, *didx;
+    int         ovidx, odidx;
+    int         dummy;
+    int32       i, j, k;
+    float32    *dp;
+    float32     range;
+    float32     ratio;
+    unsigned char *ip, *plane, *row, *pix;
+
+    const char *err1 = "Unable to dynamically allocate memory.\n";
+    dp = (float32 *) in->data;
+    ip = im->image;
+    range = in->max - in->min;
+    ratio = (float32)237.9 / range;
+
+    /*
+     * determine the scale indexes of the horizontal pixel locations
+     */
+    if ((hidx = (int *) HDmalloc((unsigned int) (im->hres + 1) * sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+
+    if (indexes(in->hscale, in->dims[0], hidx, im->hres))
+        goto err;
+
+    /*
+     * determine the scale indexes of the vertical pixel locations
+     */
+    if ((vidx = (int *) HDmalloc((unsigned int) (im->vres + 1) *
+                                   sizeof(int))) == NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+
+    if (indexes(in->vscale, in->dims[1], vidx, im->vres))
+        goto err;
+
+    /*
+     * determine the scale indexes of the depth plane locations
+     */
+    dummy = 0;
+    didx = &dummy;
+    if (in->rank == 3)
+      {
+          if ((didx = (int *) HDmalloc((unsigned int) (im->dres + 1) *
+                                         sizeof(int))) == NULL)
+            {
+                (void) fprintf(stderr, err1);
+                goto err;
+            }
+
+          if (indexes(in->dscale, in->dims[2], didx, im->dres))
+              goto err;
+      }
+
+    /*
+     * compute the expanded image
+     */
+    if ((pix = (unsigned char *) HDmalloc((unsigned int) (in->dims[0] + 1))) ==
+        NULL)
+      {
+          (void) fprintf(stderr, err1);
+          goto err;
+      }
+    for (k = 0, odidx = didx[0] - 1; k < im->dres; k++)
+      {
+          /*
+           * construct a new depth plane
+           */
+          if (didx[k] > odidx)
+            {
+                for (j = 0, ovidx = vidx[0] - 1; j < im->vres; j++)
+                  {
+                      /*
+                       * construct a new row
+                       */
+                      if (vidx[j] > ovidx)
+                        {
+                            for (i = 0; i < in->dims[0]; i++)
+                                pix[i] = (unsigned char )((ratio * (*dp++ - in->min)) + (float32)1.5);
+                            for (i = 0; i < im->hres; i++)
+                                *ip++ = pix[hidx[i]];
+                            /*
+                             * repeat the previous row
+                             */
+                        }
+                      else
+                        {
+                            row = ip - im->hres;
+                            for (i = 0; i < im->hres; i++)
+                                *ip++ = *row++;
+                        }
+                      ovidx = vidx[j];
+                  }
+                /*
+                 * repeat the previous depth plane
+                 */
+            }
+          else
+            {
+                plane = ip - (im->hres * im->vres);
+                for (j = 0; j < im->vres; j++)
+                    for (i = 0; i < im->hres; i++)
+                        *ip++ = plane[(j * im->hres) + i];
+            }
+          odidx = didx[k];
+      }
+
+    /*
+     * free dynamically allocated space
+     */
+    HDfree((char *) hidx);
+    HDfree((char *) vidx);
+    if (in->rank == 3)
+        HDfree((char *) didx);
+    HDfree((char *) pix);
+
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name:
+ *      create_SDS
+ *
+ * Purpose:
+ *      This function contains common code that creates a two- or 
+ *	three-dimensional dataset, used in function 'process.'  It
+ *	was factored out to reduce the length of 'process.'
+ *	Returns the new SDS identifier, if success, and FAIL, 
+ *	otherwise. (bmribler - 2006/8/18)
+ */
+static int32
+create_SDS(int32 sd_id, int32 nt, struct Input *in)
+{
+    int32	sds_id;
+
+    if (in->rank == 2)
+      {
+	int32 edges[2];
+	edges[0] = in->dims[1];
+	edges[1] = in->dims[0];
+	sds_id = SDcreate (sd_id, NULL, nt, in->rank, edges);
+      }
+    else
+      {
+	int32 edges[3];
+	edges[0] = in->dims[2];
+	edges[1] = in->dims[1];
+	edges[2] = in->dims[0];
+	sds_id = SDcreate (sd_id, NULL, nt, in->rank, edges);
+      }
+    return(sds_id);
+}
+
+/*
+ * Name:
+ *      alloc_data
+ *
+ * Purpose:
+ *      This function contains common code that allocates memory for 
+ *	the data buffer to hold different types of data.  It
+ *	was factored out to reduce the length of 'process.'
+ *	Returns SUCCEED or FAIL. (bmribler - 2006/8/18)
+ */
+static intn
+alloc_data(VOIDP *data, int32 len, int outtype)
+{
+    const char *alloc_err = "Unable to dynamically allocate memory.\n";
+
+    switch(outtype)
+      {
+	case 0: /* 32-bit float */
+	case 5: /* NO_NE */
+	    if ((*data = (VOIDP) HDmalloc((size_t) len * sizeof(float32))) == NULL)
+	      {
+		(void) fprintf(stderr, alloc_err);
+		return FAIL;
+	      }
+	    break;
+	case 1: /* 64-bit float */
+	    if ((*data = (VOIDP) HDmalloc((size_t) len * sizeof(float64))) == NULL)
+	      {
+		(void) fprintf(stderr, alloc_err);
+		return FAIL;
+	      }
+	    break;
+	case 2: /* 32-bit integer */
+	    if ((*data = (VOIDP) HDmalloc((size_t) len * sizeof(int32))) == NULL)
+	      {
+		(void) fprintf(stderr, alloc_err);
+		return FAIL;
+	      }
+	    break;
+	case 3: /* 16-bit integer */
+	    if ((*data = (VOIDP) HDmalloc((size_t) len * sizeof(int16))) == NULL)
+	      {
+		(void) fprintf(stderr, alloc_err);
+		return FAIL;
+	      }
+	    break;
+	case 4: /* 8-bit integer */
+	    if ((*data = (VOIDP) HDmalloc((size_t) len * sizeof(int8))) == NULL)
+	      {
+		(void) fprintf(stderr, alloc_err);
+		return FAIL;
+	      }
+	    break;
+    } /* end switch */
+    return SUCCEED;
+} /* alloc_data */
+
+/*
+ * Name:
+ *      write_SDS
+ *
+ * Purpose:
+ *      This function contains common code, that writes a two- or 
+ *	three-dimensional dataset, used in function 'process.'  It
+ *	was factored out to reduce the length of 'process.'
+ *	Returns SUCCEED or FAIL. (bmribler - 2006/8/18)
+ */
+static intn
+write_SDS(int32 sds_id, struct Input *in)
+{
+    const char *write_err = "Unable to write an SDS to the HDF output file\n";
+    if (in->rank == 2)
+      {
+	int32 edges[2], start[2];
+	edges[0] = in->dims[1];
+	edges[1] = in->dims[0];
+	start[0] = 0;
+	start[1] = 0;
+	if (SDwritedata(sds_id, start, NULL, edges, (VOIDP)in->data) != 0)
+	  {
+	    (void) fprintf(stderr, write_err);
+	    return FAIL;
+	  }
+      }
+    else
+      {
+	int32 edges[3], start[3];
+	edges[0] = in->dims[2];
+	edges[1] = in->dims[1];
+	edges[2] = in->dims[0];
+	start[0] = 0;
+	start[1] = 0;
+	start[2] = 0;
+	if (SDwritedata(sds_id, start, NULL, edges, (VOIDP)in->data) != 0)
+	  {
+	    (void) fprintf(stderr, write_err);
+	    return FAIL;
+	  }
+      }
+    return SUCCEED;
+} /* write_SDS */
+
+/*
+ * Name:
+ *      set_dimensions
+ *
+ * Purpose:
+ *      This function contains the common code, that sets dimension scale 
+ *	for a two- or three-dimensional dataset, used in function 'process.'  
+ *	It was factored out to reduce the length of 'process.'
+ *	Returns SUCCEED or FAIL. (bmribler - 2006/8/18)
+ */
+static intn
+set_dimensions(int32 sds_id, struct Input *in, int32 nt, VOIDP dscale, VOIDP vscale, VOIDP hscale)
+{
+    int32 dim_id, dim_index;
+    const char *dim_err = "Unable to set dimension scales\n";
+
+    if (in->rank == 2)
+      {
+	int32 edges[2];
+	intn status;
+
+	edges[0] = in->dims[1];
+	edges[1] = in->dims[0];
+
+	dim_index = 0;
+	dim_id = SDgetdimid (sds_id, dim_index);
+
+	if (SDsetdimscale(dim_id, edges[0], nt, (VOIDP)vscale) == FAIL)
+	  {
+	    (void) fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index);
+	    return FAIL;
+	  }
+			    
+	dim_index = 1;  
+	dim_id = SDgetdimid (sds_id, dim_index); 
+			
+	if (SDsetdimscale(dim_id, edges[1], nt, hscale)!=0)
+	  {
+	    (void) fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index);
+	    return FAIL;
+	  }
+      }
+    else
+      {
+	int32 edges[3];
+	edges[0] = in->dims[2];
+	edges[1] = in->dims[1];
+	edges[2] = in->dims[0];
+
+	dim_index = 0; 
+	dim_id = SDgetdimid (sds_id, dim_index);
+
+	if (SDsetdimscale(dim_id, edges[0], nt, dscale)!=0)
+	  {
+	    (void) fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index);
+	    return FAIL;
+	  }
+	dim_index = 1; 
+	dim_id = SDgetdimid (sds_id, dim_index); 
+
+	if (SDsetdimscale(dim_id, edges[1], nt, vscale)!=0)
+	  {
+	    (void) fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index);
+	    return FAIL;
+	  }
+	dim_index = 2; 
+	dim_id = SDgetdimid (sds_id, dim_index);	
+			  
+	if (SDsetdimscale(dim_id, edges[2], nt, hscale)!=0)
+	  {
+	    (void) fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index);
+	    return FAIL;
+	  }
+      }
+    return SUCCEED;
+} /* set_dimensions */
+
+/*
+ * Name:
+ *      process
+ *
+ * Purpose:
+ *      Process each input file.
+ *
+ * Revision: (pkamat)
+ *	Modified to support the writing of the data set in any of the
+ *	following types: INT32, INT16, INT8 and FP64
+ * Modification: pvn: March, 3, 2006
+ *	handled the case of in->outtype == 5 (NO_NE), for hdf input type
+ *	current version assumes that datum is DFNT_FLOAT32 for this case
+ * Revision: (bmribler - 2006/8/18)
+ *	- Modified to store the input SD identifier in 'struct infilesformat'
+ *	  so the id can be passed into various functions, instead of
+ *	  repeatedly calling SDstart in these functions.
+ *	- Factored out common codes to make this ~900-line function become
+ *	  more readable and maintainable.
+ */
+static int
+process(struct Options *opt)
+{
+    struct Input in;	
+    struct Raster im;
+    unsigned char *ip;
+    int         i, j;
+    int         is_maxmin;
+    int         is_scale;
+    int32       len;
+    FILE       *strm;
+    int32       hdf;
+    int32 	sd_id, sds_id;
+    int32 	start3[3], edges3[3], start2[2], edges2[2];
+    int32       dim_index = 0, dim_id;
+    
+#ifdef  DEBUG
+    int         h, v, d;
+#endif /* DEBUG */
+
+    const char *err1 = "Error creating HDF output file: %s.\n";
+    const char *err1a = "Error opening the created HDF output file for writing.\n";
+    const char *err2 = "Unable to dynamically allocate memory.\n";
+    const char *err3a = "Warning: cannot make image smaller using -e ";
+    const char *err3b = "option.\n\t %s resolution will be made the ";
+    const char *err3c = "same as %s dimension of the\n\t dataset, ";
+    const char *err3d = "which is: %d.\n\n";
+    const char *err4 = "Unable to write an RIS8 to the HDF output file\n";
+    const char *err5 = "err5 - Unable to write an SDS to the HDF output file\n";
+    const char *err5a = "err5aaaa - Unable to write an SDS to the HDF output file\n";
+    const char *err6a = "Unable to close the SDS\n";
+    const char *err6 = "Unable to close the HDF output file\n";
+    /*
+     * process the palette file (if one was specified)
+     */
+    if (opt->pal == TRUE)
+        if (palette(opt->palfile))
+            goto err;
+
+    /*
+     * create the HDF output file 
+     */
+    if ((hdf = Hopen(opt->outfile, DFACC_CREATE, 0)) == FAIL)
+      {
+          (void) fprintf(stderr, err1, opt->outfile);
+          goto err;
+      }
+    (void) Hclose(hdf);
+
+	/* new interface */
+    if ((sd_id = SDstart(opt->outfile, DFACC_WRITE)) == FAIL)
+      {
+	 (void) fprintf(stderr, err1a, opt->outfile);
+          goto err;
+      }
+
+    /*
+     * main loop: process input files, one per pass
+     */
+
+    for (i = 0; i < opt->fcount; i++)
+      {
+	/*
+	 * initialize key parameters
+	 */
+	in.is_hdf = FALSE;
+	in.is_text = FALSE;
+	in.is_fp32 = FALSE;
+	in.is_fp64 = FALSE;
+	is_maxmin = FALSE;
+	is_scale = FALSE;
+	in.outtype = opt->infiles[i].outtype;
+
+	if (Hishdf(opt->infiles[i].filename))
+	  {
+	    in.is_hdf = TRUE;
+	    opt->infiles[i].handle = SDstart(opt->infiles[i].filename, DFACC_RDONLY);
+	    if (opt->infiles[i].handle == FAIL)
+	      {
+		(void) fprintf(stderr, err1a, opt->infiles[i].filename);
+		goto err;
+	      }
+	  }
+	/*
+         * get the file type, input data dimensions, and input data
+         * max/min values
+         */
+	     
+	if (gtype(opt->infiles[i].filename, &in, &strm))
+	    goto err;
+
+	if (gdimen(opt->infiles[i], &in, strm))
+	    goto err;
+	  
+	if (gmaxmin(opt->infiles[i], &in, strm, &is_maxmin))
+	    goto err;
+
+        /*
+         * initialise the scale variables according to the output type 
+	 * of data set
+         */
+	if (init_scales(&in))
+	    goto err;
+
+	/*
+         * get the scale for each axis
+         */
+	if (gscale(opt->infiles[i], &in, strm, &is_scale))
+	    goto err;
+
+        /*
+         * get the input data
+         */
+	len = in.dims[0] * in.dims[1] * in.dims[2];
+
+	/* allocate memory for in.data depending on in.outtype value */
+	if (alloc_data(&(in.data), len, in.outtype) == FAIL)
+	    goto err;
+	  
+	if (gdata(opt->infiles[i], &in, strm, &is_maxmin))
+	    goto err;
+		
+	/*
+         * put the input data in the HDF output file, in SDS format
+         */
+	if (opt->to_float == TRUE)
+	  {
+	    intn status;
+	    switch(in.outtype)
+	      {
+
+		case 0: /* 32-bit float */
+		case 5: /* NO_NE */
+		    /* create data-set */ 
+		    sds_id = create_SDS(sd_id, DFNT_FLOAT32, &in);
+		    if (sds_id == FAIL)
+			goto err;
+
+		    if (is_scale == TRUE)
+		      {
+			/* set range */
+			if (SDsetrange(sds_id, &in.max, &in.min)!=0)
+			  {
+			    (void) fprintf(stderr, err5a);
+			    goto err;
+			  }	
+		    
+			/* set dimension scale */
+			status = set_dimensions(sds_id, &in, DFNT_FLOAT32, 
+			(VOIDP)in.dscale, (VOIDP)in.vscale, (VOIDP)in.hscale);
+			if (status == FAIL)
+			    goto err;
+		      }
+
+		    /* write data to the data set */
+		    if (write_SDS(sds_id, &in) == FAIL)
+			goto err;
+		    break; 
+		
+		case 1:/* 64-bit float */
+            
+		    /* create data-set */ 
+		    sds_id = create_SDS(sd_id, DFNT_FLOAT64, &in);
+		    if (sds_id == FAIL)
+			goto err;
+	      
+		    if (is_scale == TRUE)
+		      {
+			/* set range */
+			if (SDsetrange(sds_id, &in.fp64s.max, &in.fp64s.min)!=0)
+			  {
+			    (void) fprintf(stderr, err5a);
+			    goto err;
+			  }	
+		    
+			/* set dimension scale */
+			status = set_dimensions(sds_id, &in, DFNT_FLOAT64, 
+			(VOIDP)in.fp64s.dscale, (VOIDP)in.fp64s.vscale, 
+			(VOIDP)in.fp64s.hscale);
+			if (status == FAIL)
+			    goto err;
+		      }
+
+		    /* write data to the data set */
+		    if (write_SDS(sds_id, &in) == FAIL)
+			goto err;
+		    break; 
+
+		case 2: /* 32-bit integer */
+            
+		    /* create data-set */ 
+		    sds_id = create_SDS(sd_id, DFNT_INT32, &in);
+		    if (sds_id == FAIL)
+			goto err;
+
+		    if (is_scale == TRUE)
+		      {
+			/* set range */
+			if (SDsetrange(sds_id, &in.in32s.max, &in.in32s.min)!=0)
+			  {
+			    (void) fprintf(stderr, err5a);
+			    goto err;
+			  }	
+		    
+			/* set dimension scale */
+			status = set_dimensions(sds_id, &in, DFNT_INT32, 
+			(VOIDP)in.in32s.dscale, (VOIDP)in.in32s.vscale, 
+			(VOIDP)in.in32s.hscale);
+			if (status == FAIL)
+			    goto err;
+		      }
+	    
+		    /* write data to the data set */
+		    if (write_SDS(sds_id, &in) == FAIL)
+			goto err;
+		    break;
+
+		case 3: /* 16-bit integer */
+		    /* create data-set */ 
+		    sds_id = create_SDS(sd_id, DFNT_INT16, &in);
+		    if (sds_id == FAIL)
+			goto err;
+		
+		    if (is_scale == TRUE)
+		      {
+			/* set range */
+			if (SDsetrange(sds_id, &in.in16s.max, &in.in16s.min)!=0)
+			  {
+			    (void) fprintf(stderr, err5a);
+			    goto err;
+			  }	
+		    
+			/* set dimension scale */
+			status = set_dimensions(sds_id, &in, DFNT_INT16, 
+			(VOIDP)in.in16s.dscale, (VOIDP)in.in16s.vscale, 
+			(VOIDP)in.in16s.hscale);
+			if (status == FAIL)
+			    goto err;
+		      }
+
+		    /* write data to the data set */
+		    if (write_SDS(sds_id, &in) == FAIL)
+			goto err;
+		    break;
+
+		case 4: /* 8-bit integer */
+		    /* create data-set */ 
+		    sds_id = create_SDS(sd_id, DFNT_INT8, &in);
+		    if (sds_id == FAIL)
+			goto err;
+		
+		    if (is_scale == TRUE)
+		      {
+			/* set range */
+			if (SDsetrange(sds_id, &in.in8s.max, &in.in8s.min)!=0)
+			  {
+			    (void) fprintf(stderr, err5a);
+			    goto err;
+			  }	
+		    
+			/* set dimension scale */
+			status = set_dimensions(sds_id, &in, DFNT_INT8, 
+			(VOIDP)in.in8s.dscale, (VOIDP)in.in8s.vscale, 
+			(VOIDP)in.in8s.hscale);
+			if (status == FAIL)
+			    goto err;
+		      }
+		  
+		    /* write data to the data set */
+		    if (write_SDS(sds_id, &in) == FAIL)
+			goto err;
+		    break;
+	      }
+	    /* close data set */
+	    if (SDendaccess(sds_id) == FAIL )
+	      {
+		(void) fprintf(stderr, err6a);
+		goto err;
+	      }
+
+	    /* close the input file */
+	    if (in.is_hdf == TRUE)
+	      {
+		if (SDend(opt->infiles[i].handle) == FAIL)
+		{
+		    (void) fprintf(stderr, "SDend handle");
+		    goto err;
+	        }
+	      }
+	    } /* if opt->to_float == TRUE */
+
+          /*
+           * put the input data in the HDF output file, in RIS8 format
+           */
+          if (opt->to_image == TRUE)
+            {
+                /*
+                 * allocate a buffer for the output image
+                 */
+                im.hres = (opt->hres == 0) ? in.dims[0] : opt->hres;
+                if ((im.hres < in.dims[0]) && (opt->ctm == EXPAND))
+                  {
+                      (void) fprintf(stderr, err3a);
+                      (void) fprintf(stderr, err3b, "Horiz.");
+                      (void) fprintf(stderr, err3c, "horiz.");
+                      (void) fprintf(stderr, err3d, in.dims[0]);
+                      im.hres = in.dims[0];
+                      opt->hres = in.dims[0];
+                  }
+                im.vres = (opt->vres == 0) ? in.dims[1] : opt->vres;
+                if ((im.vres < in.dims[1]) && (opt->ctm == EXPAND))
+                  {
+                      (void) fprintf(stderr, err3a);
+                      (void) fprintf(stderr, err3b, "Vert.");
+                      (void) fprintf(stderr, err3c, "vert.");
+                      (void) fprintf(stderr, err3d, in.dims[1]);
+                      im.vres = in.dims[1];
+                      opt->vres = in.dims[1];
+                  }
+                im.dres = 1;
+                if (in.rank == 3)
+                  {
+                      im.dres = (opt->dres == 0) ? in.dims[2] :
+                          opt->dres;
+                      if ((im.dres < in.dims[2]) &&
+                          (opt->ctm == EXPAND))
+                        {
+                            (void) fprintf(stderr, err3a);
+                            (void) fprintf(stderr, err3b, "Depth");
+                            (void) fprintf(stderr, err3c, "depth");
+                            (void) fprintf(stderr, err3d,
+                                           in.dims[2]);
+                            im.dres = in.dims[2];
+                            opt->dres = in.dims[2];
+                        }
+                  }
+                len = im.hres * im.vres * im.dres;
+                if ((im.image = (unsigned char *) HDmalloc((unsigned int) len)) == NULL)
+                  {
+                      (void) fprintf(stderr, err2);
+                      goto err;
+                  }
+
+                /*
+                 * reset max/min symmetrically about the mean value
+                 */
+                if (opt->mean == TRUE)
+                    mean(&in, opt);
+
+                /*
+                 * perform pixel replication or interpolation
+                 */
+                if (opt->ctm == EXPAND)
+                  {
+                      if (pixrep(&in, &im))
+                          goto err;
+                  }
+                else
+                  {     /* INTERP */
+                      if (interp(&in, &im))
+                          goto err;
+                  }
+
+                len = im.hres * im.vres;
+                for (j = 0, ip = im.image; j < im.dres; j++, ip += len)
+                  {
+                      if (DFR8addimage(opt->outfile, ip, im.hres,
+                                       im.vres, DFTAG_RLE))
+                        {
+                            (void) fprintf(stderr, err4);
+                            goto err;
+                        }
+                  }
+
+#ifdef  DEBUG
+                (void) printf("Output Raster Information ...\n\n");
+                (void) printf("\tresolution (horiz,vert,[depth]):\n\n");
+                if (in.rank == 2)
+                    (void) printf("\t%d %d\n\n", im.hres, im.vres);
+                else
+                    (void) printf("\t%d %d %d\n\n", im.hres,
+                                  im.vres, im.dres);
+                if (opt->mean == TRUE)
+                  {
+                      (void) printf("\tadjusted max/min values:\n\n");
+                      (void) printf("\t%f %f\n\n", in.max, in.min);
+                  }
+                (void) printf("\tcolor index values:");
+                for (d = 0, ip = im.image; d < im.dres; d++)
+                  {
+                      (void) printf("\n");
+                      for (v = 0; v < im.vres; v++)
+                        {
+                            (void) printf("\n");
+                            for (h = 0; h < im.hres; h++, ip++)
+                                (void) printf("\t%d", *ip);
+                        }
+                  }
+                (void) printf("\n");
+#endif /* DEBUG */
+            }
+		  /*
+           * free dynamically allocated space
+           */
+	  fpdeallocate(&in,&im,opt);
+      } /* end of for loop */
+
+    /* close the output file */
+    if (SDend (sd_id) != 0)
+      {
+	(void) fprintf(stderr, err6);
+	goto err;
+      }
+	
+    return (0);
+
+  err:
+    return (1);
+}
+
+/*
+ * Name: (pkamat - New function)
+ *      fpdeallocate
+ *
+ * Purpose:
+ *      Deallocate memory of all data structures
+ */
+
+void fpdeallocate(struct Input *in, struct Raster *im, struct Options *opt)
+{
+ switch(in->outtype)
+    {
+    case 0 :
+      HDfree((char *) in->hscale);
+      HDfree((char *) in->vscale);
+      if (in->rank == 3)
+	HDfree((char *) in->dscale);
+      
+      if (opt->to_image == TRUE)
+	HDfree((char *) im->image);
+      break;
+      
+    case 1 :
+      HDfree((char *) in->fp64s.hscale);
+      HDfree((char *) in->fp64s.vscale);
+      if (in->rank == 3)
+	HDfree((char *) in->fp64s.dscale);
+      
+      if (opt->to_image == TRUE)
+	HDfree((char *) im->image);
+      break;
+      
+    case 2 :
+      HDfree((char *) in->in32s.hscale);
+      HDfree((char *) in->in32s.vscale);
+      if (in->rank == 3)
+	HDfree((char *) in->in32s.dscale);
+      break;
+		
+    case 3 :
+      HDfree((char *) in->in16s.hscale);
+      HDfree((char *) in->in16s.vscale);
+      if (in->rank == 3)
+	HDfree((char *) in->in16s.dscale);
+      break;
+      
+    case 4 :
+      HDfree((char *) in->in8s.hscale);
+      HDfree((char *) in->in8s.vscale);
+      if (in->rank == 3)
+	HDfree((char *) in->in8s.dscale);
+      break;
+      
+    }
+   HDfree((char *) in->data);
+
+}
+
+
+/*
+ * Name: (pkamat - New function)
+ *      init_scales
+ *
+ * Purpose:
+ *      Initialise the data-structures to hold scale information
+ * Modification: pvn: March, 3, 2006
+ *  handled the case of in->outtype == 5 (NO_NE), for hdf input type
+ *  current version assumes that datum is DFNT_FLOAT32 for this case
+ */
+static int init_scales(struct Input * in)
+{
+  const char *err1 = "Unable to dynamically allocate memory.\n";
+  switch(in->outtype)
+    {
+    case 0: /* 32-bit float */
+    case 5: /* NO_NE */
+      if ((in->hscale = (float32 *) HDmalloc((size_t)
+					     (in->dims[0] + 1) * sizeof(float32))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if ((in->vscale = (float32 *) HDmalloc((size_t)
+					     (in->dims[1] + 1) * sizeof(float32))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if (in->rank == 3)
+	{
+	  if ((in->dscale = (float32 *) HDmalloc((size_t)
+						 (in->dims[2] + 1) * sizeof(float32))) == NULL)
+	    {
+	      (void) fprintf(stderr, err1);
+	      goto err;
+	    }
+	}
+      break;
+      
+    case 1: /* 64-bit float */
+      
+      if ((in->fp64s.hscale = (float64 *) HDmalloc((size_t)
+						   (in->dims[0] + 1) * sizeof(float64))) == NULL)
+	{
+	    (void) fprintf(stderr, err1);
+	    goto err;
+	}
+      if ((in->fp64s.vscale = (float64 *) HDmalloc((size_t)
+						   (in->dims[1] + 1) * sizeof(float64))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if (in->rank == 3)
+	{
+	  if ((in->fp64s.dscale = (float64 *) HDmalloc((size_t)
+						  (in->dims[2] + 1) * sizeof(float64))) == NULL)
+	    {
+	      (void) fprintf(stderr, err1);
+	      goto err;
+	    }
+	}
+      break;
+    case 2: /* 32-bit integer */
+      if ((in->in32s.hscale = (int32 *) HDmalloc((size_t)
+						 (in->dims[0] + 1) * sizeof(int32))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if ((in->in32s.vscale = (int32 *) HDmalloc((size_t)
+						 (in->dims[1] + 1) * sizeof(int32))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if (in->rank == 3)
+	{
+	  if ((in->in32s.dscale = (int32 *) HDmalloc((size_t)
+                             (in->dims[2] + 1) * sizeof(int32))) == NULL)
+	    {
+	      (void) fprintf(stderr, err1);
+	      goto err;
+	    }
+	}
+      break;
+      
+    case 3: /* 16-bit integer */
+      if ((in->in16s.hscale = (int16 *) HDmalloc((size_t)
+						 (in->dims[0] + 1) * sizeof(int16))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if ((in->in16s.vscale = (int16 *) HDmalloc((size_t)
+						 (in->dims[1] + 1) * sizeof(int16))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if (in->rank == 3)
+	{
+	  if ((in->in16s.dscale = (int16 *) HDmalloc((size_t)
+						     (in->dims[2] + 1) * sizeof(int16))) == NULL)
+	    {
+	      (void) fprintf(stderr, err1);
+	      goto err;
+	    }
+	}
+      break;
+	
+    case 4: /* 8-bit integer */
+      if ((in->in8s.hscale = (int8 *) HDmalloc((size_t)
+					       (in->dims[0] + 1) * sizeof(int8))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if ((in->in8s.vscale = (int8 *) HDmalloc((size_t)
+                             (in->dims[1] + 1) * sizeof(int8))) == NULL)
+	{
+	  (void) fprintf(stderr, err1);
+	  goto err;
+	}
+      if (in->rank == 3)
+	{
+	  if ((in->in8s.dscale = (int8 *) HDmalloc((size_t)
+						   (in->dims[2] + 1) * sizeof(int8))) == NULL)
+	    {
+	      (void) fprintf(stderr, err1);
+	      goto err;
+	    }
+	}
+      break;	
+      
+    }
+	return (0);
+    err:
+	return (1);
+}
+
+/*
+ * Name:
+ *      usage
+ *
+ * Purpose:
+ *      Print a summary of command usage.
+ */
+void
+usage(char *name)
+{
+    (void) fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name);
+    (void) fprintf(stderr, "\t%s -V, OR\n", name);
+    (void) fprintf(stderr, "\t%s <infile> [ [-t[ype] <output-type> | -n] ", name);
+    (void) fprintf(stderr, "[<infile> [-t[ype] <output-type> | -n ]]...]\n");
+    (void) fprintf(stderr, "\t\t\t\t\t-o[utfile] <outfile> [options..]\n");
+    (void) fprintf(stderr, "\n\t-t[ype] <output_type>");
+     
+    (void) fprintf(stderr, "\n\t\tOptionally used for every input ASCII file to specify the");
+    (void) fprintf(stderr, "\n\t\tdata type of the data-set to be written. If not specified");
+    (void) fprintf(stderr, "\n\t\tdefault data type is 32-bit floating point. <output-type>");
+    (void) fprintf(stderr, "\n\t\tcan be any of the following: FP32 (default), FP64, INT32");
+    (void) fprintf(stderr, "\n\t\tINT16, INT8. It can be used only with ASCII files.");
+
+    (void) fprintf(stderr, "\n\t-n");
+    (void) fprintf(stderr, "\n\t\tThis option is to be used only if the binary input file ");
+    (void) fprintf(stderr, "\n\t\tcontains 64-bit floating point data and the default");
+    (void) fprintf(stderr, "\n\t\tbehaviour (default behaviour is to write it to a 32-bit");
+    (void) fprintf(stderr, "\n\t\tfloating point data-set) should be overridden to write ");
+    (void) fprintf(stderr, "\n\t\tit to a 64-bit floating point data-set.");
+    (void) fprintf(stderr, "\n\n\toptions...\n");
+    (void) fprintf(stderr, "\n\t-r[aster]:\n");
+    (void) fprintf(stderr, "\t\tproduce an image.  Could be ");
+    (void) fprintf(stderr, "followed by:\n");
+    (void) fprintf(stderr, "\t\t-e[xpand] <horiz> <vert> ");
+    (void) fprintf(stderr, "[<depth>]:\n");
+    (void) fprintf(stderr, "\t\t\t resolution with pixel ");
+    (void) fprintf(stderr, "replication\n");
+    (void) fprintf(stderr, "\t\t-i[nterp] <horiz> <vert> ");
+    (void) fprintf(stderr, "[<depth>]:\n");
+    (void) fprintf(stderr, "\t\t\tresolution with interpolation\n");
+    (void) fprintf(stderr, "\t\t-p[alfile] <palfile>:\n");
+    (void) fprintf(stderr, "\t\t\tinclude palette from palfile\n");
+    (void) fprintf(stderr, "\t\t-m[ean] <meanval>:\n");
+    (void) fprintf(stderr, "\t\t\tmean value to scale image ");
+    (void) fprintf(stderr, "around\n");
+    (void) fprintf(stderr, "\t-f[loat]:\n");
+    (void) fprintf(stderr, "\t\tproduce floating point data\n\n");
+
+    return;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mfhdf/hdfimport/hdfimport.input1 b/mfhdf/hdfimport/hdfimport.input1
new file mode 100644
index 0000000..68dd25a
--- /dev/null
+++ b/mfhdf/hdfimport/hdfimport.input1
@@ -0,0 +1,49 @@
+open cb32r2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb32r3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr2.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr3.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open cb64r2_ris.hdf
+prev tag = 30
+next tag = 702
+info
+dump -float
+close
+open ctxtr2_ris.hdf
+prev tag = 30
+next tag = 303
+info
+dump -byte
+close
+quit
diff --git a/mfhdf/hdfimport/hdfimport.out1 b/mfhdf/hdfimport/hdfimport.out1
new file mode 100644
index 0000000..207b967
--- /dev/null
+++ b/mfhdf/hdfimport/hdfimport.out1
@@ -0,0 +1,736 @@
+ctxtr2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
+ctxtr3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
+cb32i2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
+cb32i3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
+cb16i2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	       6 bytes
+	Ref no      6	       8 bytes
+	Ref no      7	      24 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
+cb16i3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      10 bytes
+	Ref no      6	       6 bytes
+	Ref no      8	       8 bytes
+	Ref no      9	     120 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       4 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
+cb32r2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
+cb32r3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
+cb64r2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
+cb64r3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
+cb64r2-n.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      24 bytes
+	Ref no      6	      32 bytes
+	Ref no      7	      96 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	      16 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      53 bytes
+
+cb64r3-n.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      40 bytes
+	Ref no      6	      24 bytes
+	Ref no      8	      32 bytes
+	Ref no      9	     480 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	      16 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      61 bytes
+
+ctxtr2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      2	     400 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      2	     400 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+
+cb64r2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      8	       4 bytes
+	Ref no     15	       4 bytes
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      8	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      8	    2550 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      8	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      8	    2550 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      8	       8 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     15	      22 bytes
+	Ref no     18	      14 bytes
+	Ref no     21	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      9	      60 bytes
+	Ref no     11	      60 bytes
+	Ref no     13	      61 bytes
+	Ref no     14	      55 bytes
+	Ref no     17	      64 bytes
+	Ref no     20	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      9	       4 bytes
+	Ref no     11	       4 bytes
+	Ref no     13	       8 bytes
+	Ref no     14	      -1 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     10	      33 bytes
+	Ref no     12	      33 bytes
+	Ref no     16	      60 bytes
+	Ref no     19	      53 bytes
+	Ref no     22	      53 bytes
+	Ref no     23	      55 bytes
+
diff --git a/mfhdf/hdfimport/hdfimport.out2 b/mfhdf/hdfimport/hdfimport.out2
new file mode 100644
index 0000000..50f8f57
--- /dev/null
+++ b/mfhdf/hdfimport/hdfimport.out2
@@ -0,0 +1,69 @@
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:    1.100000e+01   1.200000e+01   1.300000e+01
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:    5.100000e+01   5.600000e+01   6.100000e+01   6.600000e+01
+      16:    7.100000e+01
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:    1.100000e+01   1.200000e+01   1.300000e+01
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:    5.100000e+01   5.600000e+01   6.100000e+01   6.600000e+01
+      16:    7.100000e+01
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:    1.100000e+01   1.200000e+01   1.300000e+01
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:    5.100000e+01   5.600000e+01   6.100000e+01   6.600000e+01
+      16:    7.100000e+01
+ (2) 	Scientific Data               : (Tag 702) Ref 4
+       0:    1.100000e+01   1.200000e+01   1.300000e+01
+ (2) 	Compressed Image              : (Tag 303) Ref 2
+       0:    137      1    144     60    144    120    137    179 
+       8:    137      1    144     60    144    120    137    179 
+      16:    137      1    144     60    144    120    137    179 
+      24:    137      1    144     60    144    120    137    179 
+      32:    137      1    144     60    144    120    137    179 
+      40:    137      1    144     60    144    120    137    179 
+      48:    137      1    144     60    144    120    137    179 
+      56:    137      1    144     60    144    120    137    179 
+      64:    137      1    144     60    144    120    137    179 
+      72:    137      1    144     60    144    120    137    179 
+      80:    137      1    144     60    144    120    137    179 
+      88:    137      1    144     60    144    120    137    179 
+      96:    137      1    144     60    144    120    137    179 
+     104:    137     31    144     90    144    150    137    209 
+     112:    137     31    144     90    144    150    137    209 
+     120:    137     31    144     90    144    150    137    209 
+     128:    137     31    144     90    144    150    137    209 
+     136:    137     31    144     90    144    150    137    209 
+     144:    137     31    144     90    144    150    137    209 
+     152:    137     31    144     90    144    150    137    209 
+     160:    137     31    144     90    144    150    137    209 
+     168:    137     31    144     90    144    150    137    209 
+     176:    137     31    144     90    144    150    137    209 
+     184:    137     31    144     90    144    150    137    209 
+     192:    137     31    144     90    144    150    137    209 
+     200:    137     31    144     90    144    150    137    209 
+     208:    137     31    144     90    144    150    137    209 
+     216:    137     31    144     90    144    150    137    209 
+     224:    137     31    144     90    144    150    137    209 
+     232:    137     31    144     90    144    150    137    209 
+     240:    137     31    144     90    144    150    137    209 
+     248:    137     31    144     90    144    150    137    209 
+     256:    137     31    144     90    144    150    137    209 
+     264:    137     31    144     90    144    150    137    209 
+     272:    137     31    144     90    144    150    137    209 
+     280:    137     31    144     90    144    150    137    209 
+     288:    137     31    144     90    144    150    137    209 
+     296:    137     60    144    120    144    179    137    239 
+     304:    137     60    144    120    144    179    137    239 
+     312:    137     60    144    120    144    179    137    239 
+     320:    137     60    144    120    144    179    137    239 
+     328:    137     60    144    120    144    179    137    239 
+     336:    137     60    144    120    144    179    137    239 
+     344:    137     60    144    120    144    179    137    239 
+     352:    137     60    144    120    144    179    137    239 
+     360:    137     60    144    120    144    179    137    239 
+     368:    137     60    144    120    144    179    137    239 
+     376:    137     60    144    120    144    179    137    239 
+     384:    137     60    144    120    144    179    137    239 
+     392:    137     60    144    120    144    179    137    239 
+     400: 
diff --git a/mfhdf/hdfimport/hdfimport.out3 b/mfhdf/hdfimport/hdfimport.out3
new file mode 100644
index 0000000..fcdb7b5
--- /dev/null
+++ b/mfhdf/hdfimport/hdfimport.out3
@@ -0,0 +1,36 @@
+SDSfloat2.out:
+
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 14 17 20
+SciData dimension record      : (tag 701)
+	Ref nos: 14 17 20
+Scientific Data               : (tag 702)
+	Ref nos: 4 6 7
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 5
+Vdata                         : (tag 1962)
+	Ref nos: 8 10 12 13 16 19
+Vdata Storage                 : (tag 1963)
+	Ref nos: 8 10 12 13 16 19
+Vgroup                        : (tag 1965)
+	Ref nos: 9 11 15 18 21 22
+SDSfloat3.out:
+
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 18 21 24 27
+SciData dimension record      : (tag 701)
+	Ref nos: 18 21 24 27
+Scientific Data               : (tag 702)
+	Ref nos: 4 6 8 9
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 5 7
+Vdata                         : (tag 1962)
+	Ref nos: 10 12 14 16 17 20 23 26
+Vdata Storage                 : (tag 1963)
+	Ref nos: 10 12 14 16 17 20 23 26
+Vgroup                        : (tag 1965)
+	Ref nos: 11 13 15 19 22 25 28 29
diff --git a/mfhdf/hdfimport/hdfimporttest.c b/mfhdf/hdfimport/hdfimporttest.c
new file mode 100644
index 0000000..8e76d64
--- /dev/null
+++ b/mfhdf/hdfimport/hdfimporttest.c
@@ -0,0 +1,472 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include "hdf.h"
+
+/*
+ * Name:
+ *      hdfimporttest
+ *
+ * Description:
+ *      This program creates binary and text input files that can be
+ *      used to test the hdfimport program.  
+ *
+ *      June 1, 1990
+ *      Bob Weaver, baw at inel.gov
+ *
+ *      Last Revision: December 10, 2001
+ *      Pankaj Kamat, pkamat at uiuc.edu
+ *
+ *      row     values start at 11 and increment by 1 => 11, 12, 13
+ *      column  values start at 21 and increment by 2 => 21, 23, 25, 27
+ *      plane   values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+ *
+ *      data element value = row value + column value [+ plane value, if rank=3]
+ */
+int
+main(int argc, char * argv[] )
+{
+    int         nrow = 3, ncol = 4, npln = 5, ione = 1;
+    int         i, j, k;
+    FILE       *sp;
+
+    float32     b32r2[3][4], b32r3[5][3][4];
+    float32     row4[3], col4[4], pln4[5];
+    float32     rowo4 = (float32)11.0e0, colo4 = (float32)21.0e0, plno4 = (float32)51.0e0;
+    float32     rowi4 = (float32)1.0e0, coli4 = (float32)2.0e0, plni4 = (float32)5.0e0;
+    float32     ezero = (float32)0.0e0;
+    
+    int32     b32i2[3][4], b32i3[5][3][4];          
+    int32     row4i[3], col4i[4], pln4i[5];
+    int32     rowo4i = (int32)11 , colo4i = (int32)21 , plno4i = (int32)51 ;
+    int32     rowi4i = (int32)1 , coli4i = (int32)2 , plni4i = (int32)5 ;
+    int32 	  ezeroi = (int32)0;
+    	
+    int16     b16i2[3][4], b16i3[5][3][4];          
+    int16     row4i16[3], col4i16[4], pln4i16[5];
+    int16     rowo4i16 = (int16)11 , colo4i16 = (int16)21 , plno4i16 = (int16)51 ;
+    int16     rowi4i16 = (int16)1 , coli4i16 = (int16)2 , plni4i16 = (int16)5 ;
+    int16 	  ezeroi16 = (int16)0;
+    
+    int8     b8i2[3][4], b8i3[5][3][4];          
+    int8     row4i8[3], col4i8[4], pln4i8[5];
+    int8     rowo4i8 = (int8)11 , colo4i8 = (int8)21 , plno4i8 = (int8)51 ;
+    int8     rowi4i8 = (int8)1 , coli4i8 = (int8)2 , plni4i8 = (int8)5 ;
+    int8 	  ezeroi8 = (int8)0;
+    
+    float64     b64r2[3][4], b64r3[5][3][4];
+    float64     row8[3], col8[4], pln8[5];
+    float64     rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0;
+    float64     rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0;
+    float64     dzero = 0.0e0;
+
+    const char *text = "TEXT";
+    const char *fp32 = "FP32";
+    const char *fp64 = "FP64";
+    const char *in32 = "IN32";
+    const char *in16 = "IN16";
+    const char *in8  = "IN08";	
+
+    /* shut compiler up */
+    argv=argv; argc=argc;
+
+    /*
+     * initialize the row, column, and plane vectors
+     *
+     * row values start at 11 and increment by 1 => 11, 12, 13
+     * column values start at 21 and increment by 2 => 21, 23, 25, 27
+     * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71
+     */
+
+    row4[0] = rowo4;
+    col4[0] = colo4;
+    pln4[0] = plno4;
+    
+    row8[0] = rowo8;
+    col8[0] = colo8;
+    pln8[0] = plno8;
+    
+    row4i[0] = rowo4i;
+    col4i[0] = colo4i;
+    pln4i[0] = plno4i;
+    
+    row4i16[0] = rowo4i16;
+    col4i16[0] = colo4i16;
+    pln4i16[0] = plno4i16;
+    
+    row4i8[0] = rowo4i8;
+    col4i8[0] = colo4i8;
+    pln4i8[0] = plno4i8;
+    
+    
+    
+
+    for (i = 1; i < nrow; i++)
+      {
+          row4[i] = row4[i - 1] + rowi4;
+          row8[i] = row8[i - 1] + rowi8;
+	    row4i[i] = row4i[i - 1] + rowi4i;
+	    row4i16[i] = row4i16[i - 1] + rowi4i16;
+	    row4i8[i] = row4i8[i - 1] + rowi4i8;      
+	}
+	    
+    for (j = 1; j < ncol; j++)
+      {
+          col4[j] = col4[j - 1] + coli4;
+          col8[j] = col8[j - 1] + coli8;
+	    col4i[j] = col4i[j - 1] + coli4i;
+	    col4i16[j] = col4i16[j - 1] + coli4i16;	    
+	    col4i8[j] = col4i8[j - 1] + coli4i8;
+      }
+    for (k = 1; k < npln; k++)
+      {
+          pln4[k] = pln4[k - 1] + plni4;
+          pln8[k] = pln8[k - 1] + plni8;
+	    pln4i[k] = pln4i[k - 1] + plni4i;
+	    pln4i16[k] = pln4i16[k - 1] + plni4i16;	    
+	    pln4i8[k] = pln4i8[k - 1] + plni4i8;
+	    	    
+      }
+
+    /*
+     * build array elements - rank 2
+     *
+     * element value = sum of row value and col values
+     */
+
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+            {
+                b32r2[i][j] = row4[i] + col4[j];
+                b64r2[i][j] = row8[i] + col8[j];
+		    b32i2[i][j] = row4i[i] + col4i[j];  
+		    b16i2[i][j] = row4i16[i] + col4i16[j]; 
+		    b8i2[i][j] = row4i8[i] + col4i8[j]; 
+            }
+      }
+
+    /*
+     * build array elements - rank 3
+     *
+     * element value = sum of row value, col, and plane values
+     */
+
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+            {
+                for (k = 0; k < npln; k++)
+                  {
+                      b32r3[k][i][j] = row4[i] + col4[j] + pln4[k];
+                      b64r3[k][i][j] = row8[i] + col8[j] + pln8[k];
+			    b32i3[k][i][j] = row4i[i] + col4i[j] + pln4i[k];
+			    b16i3[k][i][j] = row4i16[i] + col4i16[j] + pln4i16[k];
+			    b8i3[k][i][j] = row4i8[i] + col4i8[j] + pln4i8[k];
+                  }
+            }
+      }
+
+    /*
+     * text file - rank 2 & 3
+     */
+
+    sp = fopen("ctxtr2", "w");
+    (void) fprintf(sp, "%s\n", text);
+    (void) fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol);
+    (void) fprintf(sp, "%14.6E%14.6E\n", ezero, ezero);
+    for (i = 0; i < nrow; i++)
+        (void) fprintf(sp, "%14.6E", row4[i]);
+    (void) fprintf(sp, "\n");
+    for (j = 0; j < ncol; j++)
+        (void) fprintf(sp, "%14.6E", col4[j]);
+    (void) fprintf(sp, "\n");
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+              (void) fprintf(sp, "%14.6E", b32r2[i][j]);
+          (void) fprintf(sp, "\n");
+      }
+    (void) fclose(sp);
+    
+     sp = fopen("ctxti2", "w");
+    (void) fprintf(sp, "%s\n", text);
+    (void) fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol);
+    (void) fprintf(sp, "%10d%10d\n", ezeroi, ezeroi);
+    for (i = 0; i < nrow; i++)
+        (void) fprintf(sp, "%10d", row4i[i]);
+    (void) fprintf(sp, "\n");
+    for (j = 0; j < ncol; j++)
+        (void) fprintf(sp, "%10d", col4i[j]);
+    (void) fprintf(sp, "\n");
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+              (void) fprintf(sp, "%10d", b32i2[i][j]);
+          (void) fprintf(sp, "\n");
+      }
+    (void) fclose(sp);
+
+ 	sp = fopen("ctxti162", "w");
+    (void) fprintf(sp, "%s\n", text);
+    (void) fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol);
+    (void) fprintf(sp, "%10u%10u\n", ezeroi16, ezeroi16);
+    for (i = 0; i < nrow; i++)
+        (void) fprintf(sp, "%10u", row4i16[i]);
+    (void) fprintf(sp, "\n");
+    for (j = 0; j < ncol; j++)
+        (void) fprintf(sp, "%10u", col4i16[j]);
+    (void) fprintf(sp, "\n");
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+              (void) fprintf(sp, "%10u", b16i2[i][j]);
+          (void) fprintf(sp, "\n");
+      }
+    (void) fclose(sp);
+    
+    sp = fopen("ctxti82", "w");
+    (void) fprintf(sp, "%s\n", text);
+    (void) fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol);
+    (void) fprintf(sp, "%10c%10c\n", ezeroi8, ezeroi8);
+    for (i = 0; i < nrow; i++)
+        (void) fprintf(sp, "%10c", row4i8[i]);
+    (void) fprintf(sp, "\n");
+    for (j = 0; j < ncol; j++)
+        (void) fprintf(sp, "%10c", col4i8[j]);
+    (void) fprintf(sp, "\n");
+    for (i = 0; i < nrow; i++)
+      {
+          for (j = 0; j < ncol; j++)
+              (void) fprintf(sp, "%10c", b8i2[i][j]);
+          (void) fprintf(sp, "\n");
+      }
+    (void) fclose(sp);
+    
+    sp = fopen("ctxtr3", "w");
+    (void) fprintf(sp, "%s\n", text);
+    (void) fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol);
+    (void) fprintf(sp, "%14.6E%14.6E\n", ezero, ezero);
+    for (k = 0; k < npln; k++)
+        (void) fprintf(sp, "%14.6E", pln4[k]);
+    (void) fprintf(sp, "\n");
+    for (i = 0; i < nrow; i++)
+        (void) fprintf(sp, "%14.6E", row4[i]);
+    (void) fprintf(sp, "\n");
+    for (j = 0; j < ncol; j++)
+        (void) fprintf(sp, "%14.6E", col4[j]);
+    (void) fprintf(sp, "\n");
+    for (k = 0; k < npln; k++)
+        for (i = 0; i < nrow; i++)
+          {
+              for (j = 0; j < ncol; j++)
+                  (void) fprintf(sp, "%14.6E", b32r3[k][i][j]);
+              (void) fprintf(sp, "\n");
+          }
+    (void) fclose(sp);
+
+    /*
+     * binary 32-bit file - rank 2 & 3
+     */
+
+    sp = fopen("cb32r2", "w");
+    (void) fwrite(fp32, strlen(fp32), 1, sp);
+    (void) fwrite((char *) &ione, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4[i], sizeof(float32), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4[j], sizeof(float32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b32r2[i][j], sizeof(float32), 1,
+                          sp);
+    (void) fclose(sp);
+
+    sp = fopen("cb32i2", "w");
+    (void) fwrite(in32, strlen(in32), 1, sp);
+    (void) fwrite((char *) &ione, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezeroi, sizeof(int32), 1, sp);
+    (void) fwrite((char *) &ezeroi, sizeof(int32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4i[i], sizeof(int32), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4i[j], sizeof(int32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b32i2[i][j], sizeof(int32), 1,
+                          sp);
+    (void) fclose(sp);
+
+    sp = fopen("cb16i2", "w");
+    (void) fwrite(in16, strlen(in16), 1, sp);
+    (void) fwrite((char *) &ione, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezeroi16, sizeof(int16), 1, sp);
+    (void) fwrite((char *) &ezeroi, sizeof(int16), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4i16[i], sizeof(int16), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4i16[j], sizeof(int16), 1, sp);
+    for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b16i2[i][j], sizeof(int16), 1,
+                          sp);
+    (void) fclose(sp);
+    
+     sp = fopen("cb8i2", "w");
+    (void) fwrite(in8, strlen(in8), 1, sp);
+    (void) fwrite((char *) &ione, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezeroi8, sizeof(int8), 1, sp);
+    (void) fwrite((char *) &ezeroi8, sizeof(int8), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4i8[i], sizeof(int8), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4i8[j], sizeof(int8), 1, sp);
+    for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b8i2[i][j], sizeof(int8), 1,
+                          sp);
+    (void) fclose(sp);
+
+    sp = fopen("cb32r3", "w");
+    (void) fwrite(fp32, strlen(fp32), 1, sp);
+    (void) fwrite((char *) &npln, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    (void) fwrite((char *) &ezero, sizeof(float32), 1, sp);
+    for (k = 0; k < npln; k++)
+        (void) fwrite((char *) &pln4[k], sizeof(float32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4[i], sizeof(float32), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4[j], sizeof(float32), 1, sp);
+    for (k = 0; k < npln; k++)
+        for (i = 0; i < nrow; i++)
+            for (j = 0; j < ncol; j++)
+                (void) fwrite((char *) &b32r3[k][i][j],
+                              sizeof(float32), 1, sp);
+    (void) fclose(sp);
+    
+     sp = fopen("cb32i3", "w");
+    (void) fwrite(in32, strlen(in32), 1, sp);
+    (void) fwrite((char *) &npln, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezeroi, sizeof(int32), 1, sp);
+    (void) fwrite((char *) &ezeroi, sizeof(int32), 1, sp);
+    for (k = 0; k < npln; k++)
+        (void) fwrite((char *) &pln4i[k], sizeof(int32), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4i[i], sizeof(int32), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4i[j], sizeof(int32), 1, sp);
+    for (k = 0; k < npln; k++)
+    	for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b32i3[k][i][j], sizeof(int32), 1,
+                          sp);
+    (void) fclose(sp);
+    
+     sp = fopen("cb16i3", "w");
+    (void) fwrite(in16, strlen(in16), 1, sp);
+    (void) fwrite((char *) &npln, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezeroi16, sizeof(int16), 1, sp);
+    (void) fwrite((char *) &ezeroi16, sizeof(int16), 1, sp);
+    for (k = 0; k < npln; k++)
+        (void) fwrite((char *) &pln4i16[k], sizeof(int16), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4i16[i], sizeof(int16), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4i16[j], sizeof(int16), 1, sp);
+    for (k = 0; k < npln; k++)
+    	for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b16i3[k][i][j], sizeof(int16), 1,
+                          sp);
+    (void) fclose(sp);
+    
+     sp = fopen("cb8i3", "w");
+    (void) fwrite(in8, strlen(in8), 1, sp);
+    (void) fwrite((char *) &npln, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ezeroi8, sizeof(int8), 1, sp);
+    (void) fwrite((char *) &ezeroi8, sizeof(int8), 1, sp);
+    for (k = 0; k < npln; k++)
+        (void) fwrite((char *) &pln4i8[k], sizeof(int8), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row4i8[i], sizeof(int8), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col4i8[j], sizeof(int8), 1, sp);
+    for (k = 0; k < npln; k++)
+    	for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b8i3[k][i][j], sizeof(int8), 1,
+                          sp);
+    (void) fclose(sp);
+  
+    /*
+     * binary 64-bit file - rank 2 & 3
+     */
+
+    sp = fopen("cb64r2", "w");
+    (void) fwrite(fp64, strlen(fp64), 1, sp);
+    (void) fwrite((char *) &ione, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row8[i], sizeof(float64), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col8[j], sizeof(float64), 1, sp);
+    for (i = 0; i < nrow; i++)
+        for (j = 0; j < ncol; j++)
+            (void) fwrite((char *) &b64r2[i][j], sizeof(float64), 1,
+                          sp);
+    (void) fclose(sp);
+
+    sp = fopen("cb64r3", "w");
+    (void) fwrite(fp64, strlen(fp64), 1, sp);
+    (void) fwrite((char *) &npln, sizeof(int), 1, sp);
+    (void) fwrite((char *) &nrow, sizeof(int), 1, sp);
+    (void) fwrite((char *) &ncol, sizeof(int), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    (void) fwrite((char *) &dzero, sizeof(float64), 1, sp);
+    for (k = 0; k < npln; k++)
+        (void) fwrite((char *) &pln8[k], sizeof(float64), 1, sp);
+    for (i = 0; i < nrow; i++)
+        (void) fwrite((char *) &row8[i], sizeof(float64), 1, sp);
+    for (j = 0; j < ncol; j++)
+        (void) fwrite((char *) &col8[j], sizeof(float64), 1, sp);
+    for (k = 0; k < npln; k++)
+        for (i = 0; i < nrow; i++)
+            for (j = 0; j < ncol; j++)
+                (void) fwrite((char *) &b64r3[k][i][j],
+                              sizeof(float64), 1, sp);
+    (void) fclose(sp);
+    return (0);
+}
diff --git a/mfhdf/hdfimport/testfiles/SDSfloat2.tst b/mfhdf/hdfimport/testfiles/SDSfloat2.tst
new file mode 100644
index 0000000..6ae0171
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/SDSfloat2.tst
@@ -0,0 +1,18 @@
+SDSfloat2.out:
+
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 14 17 20
+SciData dimension record      : (tag 701)
+	Ref nos: 14 17 20
+Scientific Data               : (tag 702)
+	Ref nos: 4 6 7
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 5
+Vdata                         : (tag 1962)
+	Ref nos: 8 10 12 13 16 19
+Vdata Storage                 : (tag 1963)
+	Ref nos: 8 10 12 13 16 19
+Vgroup                        : (tag 1965)
+	Ref nos: 9 11 15 18 21 22
diff --git a/mfhdf/hdfimport/testfiles/SDSfloat3.tst b/mfhdf/hdfimport/testfiles/SDSfloat3.tst
new file mode 100644
index 0000000..3836f9b
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/SDSfloat3.tst
@@ -0,0 +1,18 @@
+SDSfloat3.out:
+
+Version Descriptor            : (tag 30)
+	Ref nos: 1
+Number type                   : (tag 106)
+	Ref nos: 18 21 24 27
+SciData dimension record      : (tag 701)
+	Ref nos: 18 21 24 27
+Scientific Data               : (tag 702)
+	Ref nos: 4 6 8 9
+Numeric Data Group            : (tag 720)
+	Ref nos: 2 3 5 7
+Vdata                         : (tag 1962)
+	Ref nos: 10 12 14 16 17 20 23 26
+Vdata Storage                 : (tag 1963)
+	Ref nos: 10 12 14 16 17 20 23 26
+Vgroup                        : (tag 1965)
+	Ref nos: 11 13 15 19 22 25 28 29
diff --git a/mfhdf/hdfimport/testfiles/cb16i2.tst b/mfhdf/hdfimport/testfiles/cb16i2.tst
new file mode 100644
index 0000000..735aca6
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb16i2.tst
@@ -0,0 +1,49 @@
+cb16i2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	       6 bytes
+	Ref no      6	       8 bytes
+	Ref no      7	      24 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb16i3.tst b/mfhdf/hdfimport/testfiles/cb16i3.tst
new file mode 100644
index 0000000..b7bad44
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb16i3.tst
@@ -0,0 +1,59 @@
+cb16i3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      10 bytes
+	Ref no      6	       6 bytes
+	Ref no      8	       8 bytes
+	Ref no      9	     120 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       4 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb32i2.tst b/mfhdf/hdfimport/testfiles/cb32i2.tst
new file mode 100644
index 0000000..1659c0a
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb32i2.tst
@@ -0,0 +1,49 @@
+cb32i2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb32i3.tst b/mfhdf/hdfimport/testfiles/cb32i3.tst
new file mode 100644
index 0000000..53552a8
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb32i3.tst
@@ -0,0 +1,59 @@
+cb32i3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb32r2.tst b/mfhdf/hdfimport/testfiles/cb32r2.tst
new file mode 100644
index 0000000..cbf1992
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb32r2.tst
@@ -0,0 +1,49 @@
+cb32r2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb32r3.tst b/mfhdf/hdfimport/testfiles/cb32r3.tst
new file mode 100644
index 0000000..b2a0fdc
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb32r3.tst
@@ -0,0 +1,59 @@
+cb32r3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb64r2-n.tst b/mfhdf/hdfimport/testfiles/cb64r2-n.tst
new file mode 100644
index 0000000..115a1b5
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb64r2-n.tst
@@ -0,0 +1,49 @@
+cb64r2-n.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      24 bytes
+	Ref no      6	      32 bytes
+	Ref no      7	      96 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	      16 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      53 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb64r2.tst b/mfhdf/hdfimport/testfiles/cb64r2.tst
new file mode 100644
index 0000000..3a82cc9
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb64r2.tst
@@ -0,0 +1,49 @@
+cb64r2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb64r2_ris.tst b/mfhdf/hdfimport/testfiles/cb64r2_ris.tst
new file mode 100644
index 0000000..88e1a53
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb64r2_ris.tst
@@ -0,0 +1,65 @@
+cb64r2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      8	       4 bytes
+	Ref no     15	       4 bytes
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      8	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      8	    2550 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      8	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      8	    2550 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      8	       8 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     15	      22 bytes
+	Ref no     18	      14 bytes
+	Ref no     21	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      9	      60 bytes
+	Ref no     11	      60 bytes
+	Ref no     13	      61 bytes
+	Ref no     14	      55 bytes
+	Ref no     17	      64 bytes
+	Ref no     20	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      9	       4 bytes
+	Ref no     11	       4 bytes
+	Ref no     13	       8 bytes
+	Ref no     14	      -1 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     10	      33 bytes
+	Ref no     12	      33 bytes
+	Ref no     16	      60 bytes
+	Ref no     19	      53 bytes
+	Ref no     22	      53 bytes
+	Ref no     23	      55 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb64r3-n.tst b/mfhdf/hdfimport/testfiles/cb64r3-n.tst
new file mode 100644
index 0000000..2567099
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb64r3-n.tst
@@ -0,0 +1,59 @@
+cb64r3-n.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      40 bytes
+	Ref no      6	      24 bytes
+	Ref no      8	      32 bytes
+	Ref no      9	     480 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	      16 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      61 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/cb64r3.tst b/mfhdf/hdfimport/testfiles/cb64r3.tst
new file mode 100644
index 0000000..e5cbfb3
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/cb64r3.tst
@@ -0,0 +1,59 @@
+cb64r3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/ctxtr2.tst b/mfhdf/hdfimport/testfiles/ctxtr2.tst
new file mode 100644
index 0000000..93af58a
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/ctxtr2.tst
@@ -0,0 +1,49 @@
+ctxtr2.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     14	       4 bytes
+	Ref no     17	       4 bytes
+	Ref no     20	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     14	      22 bytes
+	Ref no     17	      14 bytes
+	Ref no     20	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      12 bytes
+	Ref no      6	      16 bytes
+	Ref no      7	      48 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no      8	      60 bytes
+	Ref no     10	      60 bytes
+	Ref no     12	      61 bytes
+	Ref no     13	      55 bytes
+	Ref no     16	      64 bytes
+	Ref no     19	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no      8	       4 bytes
+	Ref no     10	       4 bytes
+	Ref no     12	       8 bytes
+	Ref no     13	      -1 bytes
+	Ref no     16	      -1 bytes
+	Ref no     19	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no      9	      33 bytes
+	Ref no     11	      33 bytes
+	Ref no     15	      60 bytes
+	Ref no     18	      53 bytes
+	Ref no     21	      53 bytes
+	Ref no     22	      51 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/ctxtr2_ris.tst b/mfhdf/hdfimport/testfiles/ctxtr2_ris.tst
new file mode 100644
index 0000000..154d757
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/ctxtr2_ris.tst
@@ -0,0 +1,23 @@
+ctxtr2_ris.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no      2	       4 bytes
+
+Image Dimensions-8            : (tag 200)
+	Ref no      2	       4 bytes
+
+RLE Compressed Image-8        : (tag 203)
+	Ref no      2	     400 bytes
+
+Image Dimensions              : (tag 300)
+	Ref no      2	      20 bytes
+
+Compressed Image              : (tag 303)
+	Ref no      2	     400 bytes
+
+Raster Image Group            : (tag 306)
+	Ref no      2	       8 bytes
+
diff --git a/mfhdf/hdfimport/testfiles/ctxtr3.tst b/mfhdf/hdfimport/testfiles/ctxtr3.tst
new file mode 100644
index 0000000..664da3f
--- /dev/null
+++ b/mfhdf/hdfimport/testfiles/ctxtr3.tst
@@ -0,0 +1,59 @@
+ctxtr3.hdf:
+
+Version Descriptor            : (tag 30)
+	Ref no      1	      92 bytes
+
+Number type                   : (tag 106)
+	Ref no     18	       4 bytes
+	Ref no     21	       4 bytes
+	Ref no     24	       4 bytes
+	Ref no     27	       4 bytes
+
+SciData dimension record      : (tag 701)
+	Ref no     18	      30 bytes
+	Ref no     21	      14 bytes
+	Ref no     24	      14 bytes
+	Ref no     27	      14 bytes
+
+Scientific Data               : (tag 702)
+	Ref no      4	      20 bytes
+	Ref no      6	      12 bytes
+	Ref no      8	      16 bytes
+	Ref no      9	     240 bytes
+
+Numeric Data Group            : (tag 720)
+	Ref no      2	      16 bytes
+	Ref no      3	      16 bytes
+	Ref no      5	      16 bytes
+	Ref no      7	      16 bytes
+
+Vdata                         : (tag 1962)
+	Ref no     10	      60 bytes
+	Ref no     12	      60 bytes
+	Ref no     14	      60 bytes
+	Ref no     16	      61 bytes
+	Ref no     17	      55 bytes
+	Ref no     20	      64 bytes
+	Ref no     23	      64 bytes
+	Ref no     26	      64 bytes
+
+Vdata Storage                 : (tag 1963)
+	Ref no     10	       4 bytes
+	Ref no     12	       4 bytes
+	Ref no     14	       4 bytes
+	Ref no     16	       8 bytes
+	Ref no     17	      -1 bytes
+	Ref no     20	      -1 bytes
+	Ref no     23	      -1 bytes
+	Ref no     26	      -1 bytes
+
+Vgroup                        : (tag 1965)
+	Ref no     11	      33 bytes
+	Ref no     13	      33 bytes
+	Ref no     15	      33 bytes
+	Ref no     19	      64 bytes
+	Ref no     22	      53 bytes
+	Ref no     25	      53 bytes
+	Ref no     28	      53 bytes
+	Ref no     29	      59 bytes
+
diff --git a/mfhdf/hdfimport/testutil.sh.in b/mfhdf/hdfimport/testutil.sh.in
new file mode 100755
index 0000000..1d5e2d6
--- /dev/null
+++ b/mfhdf/hdfimport/testutil.sh.in
@@ -0,0 +1,172 @@
+#!/bin/sh 
+# HDF Utilities Test script
+# Usage: testutil.sh [machine-type]
+
+srcdir=@srcdir@
+
+machinetype="$1"
+
+# Check if target machine supports 32 bits datatype.
+# "true" is TRUE; "" means FALSE.
+case $machinetype in
+    *unicos*) has32="";;
+    *) has32="true";;
+esac
+
+# initialize errors variable
+errors=0
+haserr=0
+
+# setup hdfed command which is used often
+HDFED='../../hdf/util/hdfed'
+HDFLS="${TESTS_ENVIRONMENT} ../../hdf/util/hdfls"
+HDFEDCMD="${TESTS_ENVIRONMENT} $HDFED -batch"		# use -batch mode for no prompt
+SED="sed -e /library/,/String/d"  # filter out the library version
+TESTCMD="${TESTS_ENVIRONMENT} ./hdfimport"    # The test command
+
+echo ""
+echo "=============================="
+echo "HDFIMPORT tests started"
+echo "=============================="
+
+if [ -f hdfimport -a -f hdfimporttest ]; then
+echo "** Testing hdfimport  ***"
+
+# use [!S] to prevent SDSfloat2.hdf and SDSfloat3.hdf from being deleted;
+# please replace with better solution, one is if available. - BMR (2006/9/23)
+/bin/rm -f ctxt* cb* [!S]*.hdf *.out hdfls.tmp5 hdfed.tmp6 hdffiles.tmp
+${TESTS_ENVIRONMENT} ./hdfimporttest
+echo "Testing for 32-bit floating point ASCII (2D data)" 
+$TESTCMD ctxtr2 -o ctxtr2.hdf
+echo "Testing for 32-bit floating point ASCII (3D data)" 
+$TESTCMD ctxtr3 -o ctxtr3.hdf
+echo "Testing for 32-bit integer binary (2D data)" 
+$TESTCMD cb32i2 -o cb32i2.hdf
+echo "Testing for 32-bit integer  binary (3D data)" 
+$TESTCMD cb32i3 -o cb32i3.hdf
+echo "Testing for 16-bit integer binary (2D data)" 
+$TESTCMD cb16i2 -o cb16i2.hdf
+echo "Testing for 16-bit integer (3D data)" 
+$TESTCMD cb16i3 -o cb16i3.hdf
+echo "Testing for 32-bit floating point binary (2D data)" 
+$TESTCMD cb32r2 -o cb32r2.hdf
+echo "Testing for 32-bit floating point binary (3D data)" 
+$TESTCMD cb32r3 -o cb32r3.hdf
+echo "Testing for 64-bit floating point binary (2D data) - Default Behaviour (Conversion to 32 bit FP SDS)" 
+$TESTCMD cb64r2 -o cb64r2.hdf
+echo "Testing for 64-bit floating point binary (3D data) - Default Behaviour (Conversion to 32-bit FP SDS)" 
+$TESTCMD cb64r3 -o cb64r3.hdf
+echo "Testing for 64-bit floating point binary (2D data) - Conversion to 64-bit FP SDS" 
+$TESTCMD cb64r2 -n -o cb64r2-n.hdf
+echo "Testing for 64-bit floating point binary (3D data) - Conversion to 64-bit FP SDS" 
+$TESTCMD cb64r3 -n -o cb64r3-n.hdf
+echo "Testing for raster options" 
+$TESTCMD ctxtr2 -o ctxtr2_ris.hdf -raster -e 50 50
+$TESTCMD cb64r2 -o cb64r2_ris.hdf -raster -i 50 50 -f
+
+# test with hdf files
+echo "Testing for reading from hdf files" 
+$TESTCMD $srcdir/SDSfloat2.hdf -o SDSfloat2.out
+$TESTCMD $srcdir/SDSfloat3.hdf -o SDSfloat3.out
+
+($HDFLS -l ctxtr2.hdf | $SED) > hdfls.tmp5 2>&1
+($HDFLS -l ctxtr3.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb32i2.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb32i3.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb16i2.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb16i3.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb32r2.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb32r3.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb64r2.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb64r3.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb64r2-n.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb64r3-n.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l ctxtr2_ris.hdf | $SED) >> hdfls.tmp5 2>&1
+($HDFLS -l cb64r2_ris.hdf | $SED) >> hdfls.tmp5 2>&1
+
+# run hdfls on SDSfloat*.out, and remove the library version from the
+# output for later checking agains original output - BMR (2006/9/7)
+($HDFLS SDSfloat2.out | $SED) >> hdffiles.tmp 2>&1
+($HDFLS SDSfloat3.out | $SED) >> hdffiles.tmp 2>&1
+
+    diff  hdfls.tmp5 $srcdir/hdfimport.out1 || errors=1
+    $HDFEDCMD < $srcdir/hdfimport.input1 > hdfed.tmp6 2>&1
+    diff  hdfed.tmp6 $srcdir/hdfimport.out2 || errors=1
+
+    # hdfimport.out3 contains output that hdfls previously generated
+    # from SDSfloat*.out with the library version removed - BMR (2006/9/7)
+    diff  hdffiles.tmp $srcdir/hdfimport.out3 || errors=1
+
+# use [!S] to prevent SDSfloat2.hdf and SDSfloat3.hdf from being deleted;
+# please replace with a better solution, if one is available. - BMR (2006/9/23)
+/bin/rm -f ctxt* cb* [!S]*.hdf *.out hdfls.tmp5 hdfed.tmp6 hdffiles.tmp
+#/bin/rm -f ctxt* cb* *.hdf 
+else
+haserr=1
+echo "** hdfimport or hdfimporttest not available ***"
+fi
+
+if [ $errors -eq 1 ]; then
+  haserr=1
+  echo " ********* NOTE ***************"
+  echo " hdfimport might have failed ***"
+  echo " The above errors could be formatting "
+  echo " problems which can be ignored "
+  echo " please run the following by hand to verify "
+  echo " "
+  echo "  /bin/rm -f ctxtr* cb* *.hdf hdfls.tmp5 hdfed.tmp6"
+  echo " ${TESTS_ENVIRONMENT} ./hdfimporttest "
+  echo " $TESTCMD ctxtr2 -o ctxtr2.hdf "
+  echo " $TESTCMD ctxtr3 -o ctxtr3.hdf "
+  echo " $TESTCMD cb32i2 -o cb32i2.hdf "
+  echo " $TESTCMD cb32i3 -o cb32i3.hdf "
+  echo " $TESTCMD cb16i2 -o cb16i2.hdf "
+  echo " $TESTCMD cb16i3 -o cb16i3.hdf "
+  echo " $TESTCMD cb32r2 -o cb32r2.hdf "
+  echo " $TESTCMD cb32r3 -o cb32r3.hdf "
+  echo " $TESTCMD cb64r2 -o cb64r2.hdf "
+  echo " $TESTCMD cb64r3 -o cb64r3.hdf "
+  echo " $TESTCMD cb64r2 -n -o cb64r2-n.hdf "
+  echo " $TESTCMD cb64r3 -n -o cb64r3-n.hdf "
+  echo " $TESTCMD ctxtr2 -o ctxtr2_ris.hdf -raster -e 50 50 "
+  echo " $TESTCMD cb64r2 -o cb64r2_ris.hdf -raster -i 50 50 -f "
+  echo " $TESTCMD SDSfloat2.hdf -o SDSfloat2.out "
+  echo " $TESTCMD SDSfloat3.hdf -o SDSfloat3.out "
+  echo "($HDFLS -l ctxtr2.hdf | $SED) >&  hdfls.tmp5 "
+  echo "($HDFLS -l ctxtr3.hdf | $SED) >>& hdfls.tmp5 "
+  echo "($HDFLS -l cb32i2.hdf | $SED) >> hdfls.tmp5 2>&1 "
+  echo "($HDFLS -l cb32i3.hdf | $SED) >> hdfls.tmp5 2>&1 "
+  echo "($HDFLS -l cb16i2.hdf | $SED) >> hdfls.tmp5 2>&1 "
+  echo "($HDFLS -l cb16i3.hdf | $SED) >> hdfls.tmp5 2>&1 "
+  echo "($HDFLS -l cb32r2.hdf | $SED) >>& hdfls.tmp5 "
+  echo "($HDFLS -l cb32r3.hdf | $SED) >>& hdfls.tmp5 "
+  echo "($HDFLS -l cb64r2.hdf | $SED) >>& hdfls.tmp5 "
+  echo "($HDFLS -l cb64r3.hdf | $SED) >>& hdfls.tmp5 "
+  echo "($HDFLS -l cb64r2-n.hdf | $SED) >> hdfls.tmp5 2>&1 "
+  echo "($HDFLS -l cb64r3-n.hdf | $SED) >> hdfls.tmp5 2>&1 "
+  echo "($HDFLS -l ctxtr2_ris.hdf | $SED) >>& hdfls.tmp5 "
+  echo "($HDFLS -l cb64r2_ris.hdf | $SED) >>& hdfls.tmp5 "
+  echo "($HDFLS SDSfloat2.out | $SED) >> hdffiles.tmp 2>&1 "
+  echo "($HDFLS SDSfloat3.out | $SED) >> hdffiles.tmp 2>&1 "
+  echo " diff hdfls.tmp5 hdfimport.out1 "
+  echo " $HDFEDCMD < hdfimport.input1 >& hdfed.tmp6 "
+  echo " diff hdfed.tmp6 hdfimport.out2 "
+  echo " diff  hdffiles.tmp hdfimport.out3 || errors=1 "
+  echo " ******* END NOTE *************"
+  echo ""
+  errors=0
+fi
+
+#
+# Check errors result
+if [ $haserr -eq 0 ]; then
+    echo "================================="
+    echo "HDFIMPORT Utilities tests passed."
+    echo "================================="
+else
+    echo "*********************************************"
+    echo "HDFIMPORT Utilities tests encountered errors"
+    echo "*********************************************"
+fi
+echo ""
+exit $haserr
diff --git a/mfhdf/hdiff/CMakeLists.txt b/mfhdf/hdiff/CMakeLists.txt
new file mode 100644
index 0000000..04a64e4
--- /dev/null
+++ b/mfhdf/hdiff/CMakeLists.txt
@@ -0,0 +1,66 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_HDIFF)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+
+IF (WIN32 AND NOT CYGWIN)
+  SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:LIBCMT")
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+SET (hdiff_SRCS
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_array.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_gr.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_list.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_main.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_mattbl.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_gattr.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_misc.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_sds.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_table.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_vs.c
+    ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdiff_dim.c
+    ${HDF4_SOURCE_DIR}/mfhdf/util/getopt.c
+)
+  
+ADD_EXECUTABLE(hdiff ${hdiff_SRCS})
+TARGET_C_PROPERTIES (hdiff " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES(hdiff ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES(hdiff ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_NAMING (hdiff ${LIB_TYPE})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+INSTALL_PROGRAM_PDB (hdiff ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+
+INSTALL (
+    TARGETS
+        hdiff
+    RUNTIME DESTINATION
+        ${HDF4_INSTALL_TOOLS_BIN_DIR}
+    COMPONENT
+        toolsapplications
+)
diff --git a/mfhdf/hdiff/CMakeTests.cmake b/mfhdf/hdiff/CMakeTests.cmake
new file mode 100644
index 0000000..64d1271
--- /dev/null
+++ b/mfhdf/hdiff/CMakeTests.cmake
@@ -0,0 +1,232 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+  # --------------------------------------------------------------------
+  # This executable is used to generate test files for the hdiff tests.
+  # It should only be run during development when new test files are needed
+  # --------------------------------------------------------------------
+  IF (HDF4_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+    SET (hdifftst_SRCS
+        ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/hdifftst.c
+    )
+  
+    ADD_EXECUTABLE (hdifftst ${hdifftst_SRCS})
+    TARGET_C_PROPERTIES (hdifftst " " " ")
+    IF (HDF4_BUILD_XDR_LIB)
+      TARGET_LINK_LIBRARIES (hdifftst ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+    ELSE (HDF4_BUILD_XDR_LIB)
+      TARGET_LINK_LIBRARIES (hdifftst ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+    ENDIF (HDF4_BUILD_XDR_LIB)
+    TARGET_NAMING (hdifftst ${LIB_TYPE})
+
+    # Remove any output file left over from previous test run
+    ADD_TEST (
+        NAME HDIFF-GEN-clearall-objects
+        COMMAND    ${CMAKE_COMMAND}
+            -E remove 
+            hdifftst1.hdf
+            hdifftst2.hdf
+            hdifftst3.hdf
+            hdifftst4.hdf
+            hdifftst5.hdf
+            hdifftst6.hdf
+            hdifftst7.hdf
+    )
+    SET (last_test "HDIFF-GEN-clearall-objects")
+    
+    ADD_TEST (NAME hdifftst COMMAND $<TARGET_FILE:hdifftst>)
+    SET_TESTS_PROPERTIES (hdifftst PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    SET (last_test "hdifftst")
+  ENDIF (HDF4_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
+  MACRO (ADD_H4_TEST resultfile resultcode)
+    IF (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (NAME HDIFF-${resultfile} COMMAND $<TARGET_FILE:hdiff> ${ARGN})
+      IF (NOT ${resultcode} STREQUAL "0")
+        SET_TESTS_PROPERTIES (HDIFF-${resultfile} PROPERTIES LABELS ${PROJECT_NAME} WILL_FAIL "true")
+      ELSE (NOT ${resultcode} STREQUAL "0")
+        SET_TESTS_PROPERTIES (HDIFF-${resultfile} PROPERTIES LABELS ${PROJECT_NAME})
+      ENDIF (NOT ${resultcode} STREQUAL "0")
+    ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+      ADD_TEST (
+          NAME HDIFF-${resultfile}
+          COMMAND "${CMAKE_COMMAND}"
+              -D "TEST_PROGRAM=$<TARGET_FILE:hdiff>"
+              -D "TEST_ARGS:STRING=${ARGN}"
+              -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+              -D "TEST_OUTPUT=${resultfile}.out"
+              -D "TEST_EXPECT=${resultcode}"
+              -D "TEST_REFERENCE=${resultfile}.txt"
+              -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+      )
+    ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+    IF (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDIFF-${resultfile} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+    ELSE (NOT "${last_test}" STREQUAL "")
+      SET_TESTS_PROPERTIES (HDIFF-${resultfile} PROPERTIES LABELS ${PROJECT_NAME})
+    ENDIF (NOT "${last_test}" STREQUAL "")
+    SET (last_test "HDIFF-${resultfile}")
+  ENDMACRO (ADD_H4_TEST file)
+ 
+  #-- Copy all the data files from the test directory into the source directory
+  SET (HDF4_REFERENCE_TEST_FILES
+      hdifftst1.hdf
+      hdifftst2.hdf
+      hdifftst3.hdf
+      hdifftst4.hdf
+      hdifftst5.hdf
+      hdifftst6.hdf
+      hdifftst7.hdf
+  )
+  SET (HDF4_REFERENCE_FILES
+      hdiff_01.txt
+      hdiff_02.txt
+      hdiff_03.txt
+      hdiff_04.txt
+      hdiff_05.txt
+#      hdiff_06.txt
+      hdiff_07.txt
+      hdiff_08.txt
+      hdiff_09.txt
+      hdiff_10.txt
+      hdiff_11.txt
+      hdiff_12.txt
+      hdiff_13.txt
+      hdiff_14.txt
+      hdiff_15.txt
+  )
+ 
+  FOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h4_file}")
+    #MESSAGE(STATUS " Copying ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/testfiles/${h4_file} to ${PROJECT_BINARY_DIR}/testfiles/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdiff 
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/testfiles/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+
+  FOREACH (out_file ${HDF4_REFERENCE_FILES})
+    SET (outdest "${PROJECT_BINARY_DIR}/testfiles/${out_file}")
+    #MESSAGE (STATUS " Translating ${out_file}")
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdiff
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/testfiles/${out_file} ${outdest}
+    )
+  ENDFOREACH (out_file ${HDF4_REFERENCE_FILES})
+
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdiff
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/testfiles/hdiff_06w.txt ${PROJECT_BINARY_DIR}/testfiles/hdiff_06.txt
+    )
+  ELSE (WIN32 AND NOT CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     hdiff
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_HDIFF_SOURCE_DIR}/testfiles/hdiff_06.txt ${PROJECT_BINARY_DIR}/testfiles/hdiff_06.txt
+    )
+  ENDIF (WIN32 AND NOT CYGWIN)
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME HDIFF-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          hdiff_01.out
+          hdiff_02.out
+          hdiff_03.out
+          hdiff_04.out
+          hdiff_05.out
+          hdiff_06.out
+          hdiff_07.out
+          hdiff_08.out
+          hdiff_09.out
+          hdiff_10.out
+          hdiff_11.out
+          hdiff_12.out
+          hdiff_13.out
+          hdiff_14.out
+          hdiff_15.out
+          hdiff_01.out.err
+          hdiff_02.out.err
+          hdiff_03.out.err
+          hdiff_04.out.err
+          hdiff_05.out.err
+          hdiff_06.out.err
+          hdiff_07.out.err
+          hdiff_08.out.err
+          hdiff_09.out.err
+          hdiff_10.out.err
+          hdiff_11.out.err
+          hdiff_12.out.err
+          hdiff_13.out.err
+          hdiff_14.out.err
+          hdiff_15.out.err
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HDIFF-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (HDIFF-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "HDIFF-clearall-objects")
+
+  # help message
+  ADD_H4_TEST (hdiff_01 1) 
+
+  # Compare global attributes only
+  ADD_H4_TEST (hdiff_02 1 -g hdifftst1.hdf hdifftst2.hdf)
+
+  # Compare SD local attributes only
+  ADD_H4_TEST (hdiff_03 1 -s hdifftst1.hdf hdifftst2.hdf)
+
+  # Compare SD data only
+  ADD_H4_TEST (hdiff_04 1 -d hdifftst1.hdf hdifftst2.hdf)
+
+  # Compare Vdata data only
+  ADD_H4_TEST (hdiff_05 1 -D hdifftst1.hdf hdifftst2.hdf)
+
+  # Print statistics
+  ADD_H4_TEST (hdiff_06 1 -d -S hdifftst1.hdf hdifftst2.hdf)
+
+  # Compare SD data on variable(s)
+  ADD_H4_TEST (hdiff_07 1 -d -v dset1 hdifftst1.hdf hdifftst2.hdf)
+
+  # Compare vdata on variable(s) 
+  ADD_H4_TEST (hdiff_08 1 -D -u vdata1 hdifftst1.hdf hdifftst2.hdf)
+
+  # Print difference up to count number
+  ADD_H4_TEST (hdiff_09 1 -d -e 2 hdifftst1.hdf hdifftst2.hdf)
+
+  # Print difference when it is greater than limit
+  ADD_H4_TEST (hdiff_10 1 -d -t 2 hdifftst1.hdf hdifftst2.hdf)
+
+  # no options
+  ADD_H4_TEST (hdiff_11 1 hdifftst1.hdf hdifftst2.hdf)
+
+  # percent (relative)
+  ADD_H4_TEST (hdiff_12 1 -d -p 0.05 -v dset3 hdifftst1.hdf hdifftst2.hdf)
+
+  # hyperslab reading 
+  ADD_H4_TEST (hdiff_13 0 hdifftst3.hdf hdifftst4.hdf)
+
+  # lone dim
+  ADD_H4_TEST (hdiff_14 1 hdifftst5.hdf hdifftst6.hdf)
+
+  # group loop
+  ADD_H4_TEST (hdiff_15 0 -b hdifftst7.hdf hdifftst7.hdf)
diff --git a/mfhdf/hdiff/Makefile.am b/mfhdf/hdiff/Makefile.am
new file mode 100644
index 0000000..82e4e30
--- /dev/null
+++ b/mfhdf/hdiff/Makefile.am
@@ -0,0 +1,52 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+## Add hdiff specific linker flags here
+hdiff_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+bin_PROGRAMS = hdiff
+
+## Information for building the "hdiff" program
+hdiff_SOURCES = hdiff.c hdiff_array.c hdiff_gr.c hdiff_list.c hdiff_main.c  \
+                hdiff_mattbl.c hdiff_gattr.c hdiff_misc.c hdiff_sds.c       \
+                hdiff_table.c hdiff_vs.c hdiff_dim.c
+hdiff_LDADD = $(LIBMFHDF) $(LIBHDF) -lm
+hdiff_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+##                              Testing                                    ##
+#############################################################################
+
+TEST_PROG = hdifftst
+TEST_SCRIPT = testhdiff.sh
+check_SCRIPTS = testhdiff.sh
+
+noinst_PROGRAMS = hdifftst
+
+hdifftst_SOURCES = hdifftst.c
+hdifftst_LDADD = $(LIBMFHDF) $(LIBHDF)
+hdifftst_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += hdifftst1.hdf hdifftst2.hdf hdifftst3.hdf hdifftst4.hdf hdifftst5.hdf hdifftst6.hdf hdifftst7.hdf
+
+DISTCLEANFILES =
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/hdiff/Makefile.in b/mfhdf/hdiff/Makefile.in
new file mode 100644
index 0000000..35c3b63
--- /dev/null
+++ b/mfhdf/hdiff/Makefile.in
@@ -0,0 +1,840 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/testhdiff.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+bin_PROGRAMS = hdiff$(EXEEXT)
+noinst_PROGRAMS = hdifftst$(EXEEXT)
+TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT)
+subdir = mfhdf/hdiff
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = testhdiff.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_hdiff_OBJECTS = hdiff.$(OBJEXT) hdiff_array.$(OBJEXT) \
+	hdiff_gr.$(OBJEXT) hdiff_list.$(OBJEXT) hdiff_main.$(OBJEXT) \
+	hdiff_mattbl.$(OBJEXT) hdiff_gattr.$(OBJEXT) \
+	hdiff_misc.$(OBJEXT) hdiff_sds.$(OBJEXT) hdiff_table.$(OBJEXT) \
+	hdiff_vs.$(OBJEXT) hdiff_dim.$(OBJEXT)
+hdiff_OBJECTS = $(am_hdiff_OBJECTS)
+hdiff_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hdiff_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hdifftst_OBJECTS = hdifftst.$(OBJEXT)
+hdifftst_OBJECTS = $(am_hdifftst_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(hdiff_SOURCES) $(hdifftst_SOURCES)
+DIST_SOURCES = $(hdiff_SOURCES) $(hdifftst_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+am__EXEEXT_1 = hdifftst$(EXEEXT)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog hdifftst1.hdf hdifftst2.hdf \
+	hdifftst3.hdf hdifftst4.hdf hdifftst5.hdf hdifftst6.hdf \
+	hdifftst7.hdf
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+hdiff_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hdiff_SOURCES = hdiff.c hdiff_array.c hdiff_gr.c hdiff_list.c hdiff_main.c  \
+                hdiff_mattbl.c hdiff_gattr.c hdiff_misc.c hdiff_sds.c       \
+                hdiff_table.c hdiff_vs.c hdiff_dim.c
+
+hdiff_LDADD = $(LIBMFHDF) $(LIBHDF) -lm
+hdiff_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+#############################################################################
+TEST_PROG = hdifftst
+TEST_SCRIPT = testhdiff.sh
+check_SCRIPTS = testhdiff.sh
+hdifftst_SOURCES = hdifftst.c
+hdifftst_LDADD = $(LIBMFHDF) $(LIBHDF)
+hdifftst_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+DISTCLEANFILES = 
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/hdiff/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/hdiff/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+testhdiff.sh: $(top_builddir)/config.status $(srcdir)/testhdiff.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+hdiff$(EXEEXT): $(hdiff_OBJECTS) $(hdiff_DEPENDENCIES) $(EXTRA_hdiff_DEPENDENCIES) 
+	@rm -f hdiff$(EXEEXT)
+	$(hdiff_LINK) $(hdiff_OBJECTS) $(hdiff_LDADD) $(LIBS)
+hdifftst$(EXEEXT): $(hdifftst_OBJECTS) $(hdifftst_DEPENDENCIES) $(EXTRA_hdifftst_DEPENDENCIES) 
+	@rm -f hdifftst$(EXEEXT)
+	$(LINK) $(hdifftst_OBJECTS) $(hdifftst_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_array.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_dim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_gattr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_gr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_list.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_mattbl.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_misc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_sds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_table.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_vs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdifftst.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+	clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-binPROGRAMS clean-generic clean-libtool \
+	clean-noinstPROGRAMS cscopelist ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/hdiff/hdiff.c b/mfhdf/hdiff/hdiff.c
new file mode 100644
index 0000000..36c8d40
--- /dev/null
+++ b/mfhdf/hdiff/hdiff.c
@@ -0,0 +1,492 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include "hdiff.h"
+#include "hdiff_list.h"
+#include "hdiff_mattbl.h"
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff
+ *
+ * Purpose: find differences between two HDF files
+ *
+ * Return: number of differences found
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 22, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+uint32 hdiff(const char *fname1, 
+             const char *fname2, 
+             diff_opt_t *opt)
+{
+    int32     sd1_id=-1,                 
+              sd2_id=-1,
+              gr1_id=-1,                 
+              gr2_id=-1,
+              file1_id=-1,                 
+              file2_id=-1;
+    uint32    nobjects1;
+    uint32    nobjects2;
+    uint32    nfound=0;  
+    int       err;
+    dtable_t  *list1=NULL;
+    dtable_t  *list2=NULL;
+    /* file 1 */
+    diff_dim_table_t *td1_1=NULL;
+    diff_dim_table_t *td1_2=NULL;
+    /* file 2 */
+    diff_dim_table_t *td2_1=NULL;
+    diff_dim_table_t *td2_2=NULL;
+    
+    /* initialize tables */
+    dtable_init(&list1);
+    dtable_init(&list2);
+    diff_dim_table_init(&td1_1);
+    diff_dim_table_init(&td1_2);
+    diff_dim_table_init(&td2_1);
+    diff_dim_table_init(&td2_2);
+    
+   /*-------------------------------------------------------------------------
+    * get a list of objects for both files
+    *-------------------------------------------------------------------------
+    */
+    
+    nobjects1=hdiff_list(fname1, 
+        list1,
+        td1_1,
+        td1_2,
+        &err);
+    
+    if (err)
+        goto out;
+    
+    nobjects2=hdiff_list(fname2, 
+        list2,
+        td2_1,
+        td2_2,
+        &err);
+    
+    if (err)
+        goto out;
+    
+    if (opt->verbose) 
+    {
+        dtable_print(list1, "file 1");
+        dtable_print(list2, "file 2");
+    }
+    
+   /*-------------------------------------------------------------------------
+    * open file IDs
+    *-------------------------------------------------------------------------
+    */
+    
+    if ((file1_id = Hopen(fname1, DFACC_READ, (int16)0))==FAIL)
+    {
+        printf("Exiting: Hopen failed on <%s>", fname1);
+        goto out;
+    }
+    
+    if ((file2_id = Hopen(fname2, DFACC_READ, (int16)0))==FAIL)
+    {
+        printf("Exiting: Hopen failed on <%s>", fname2);
+        goto out;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * SD interface
+    *-------------------------------------------------------------------------
+    */
+    
+    if ((sd1_id = SDstart(fname1, DFACC_RDONLY))==FAIL) 
+    {
+        printf("SDstart failed on <%s>", fname1);
+        goto out;
+    }
+   
+    if ((sd2_id = SDstart(fname2, DFACC_RDONLY))==FAIL) 
+    {
+        printf("SDstart failed on <%s>", fname2);
+        goto out;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * GR interface
+    *-------------------------------------------------------------------------
+    */
+    
+    if ((gr1_id = GRstart(file1_id))==FAIL) 
+    {
+        printf("GRstart failed on <%s>", fname1);
+        goto out;
+    }
+   
+    if ((gr2_id = GRstart(file2_id))==FAIL) 
+    {
+        printf("GRstart failed on <%s>", fname2);
+        goto out;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * find common objects
+    *-------------------------------------------------------------------------
+    */
+       
+    nfound=match(nobjects1,
+        list1,
+        nobjects2,
+        list2,
+        sd1_id,
+        gr1_id,
+        file1_id,
+        sd2_id,
+        gr2_id,
+        file2_id,
+        opt);
+    
+    nfound+=diff_match_dim(sd1_id,
+        sd2_id,
+        td1_1,
+        td1_2,
+        td2_1,
+        td2_2,
+        opt
+        );
+      
+   /*-------------------------------------------------------------------------
+    * global attributes
+    *-------------------------------------------------------------------------
+    */
+    if (opt->ga == 1) 
+        nfound+=gattr_diff(sd1_id, sd2_id, opt);
+      
+   /*-------------------------------------------------------------------------
+    * close
+    *-------------------------------------------------------------------------
+    */
+    
+    if ( SDend(sd1_id)==FAIL) 
+    {
+        printf("Error: SDend failed on <%s>", fname1);
+        goto out;
+    }
+    if (SDend(sd2_id)==FAIL) 
+    {
+        printf("Error: SDend failed on <%s>", fname2);
+        goto out;
+    }
+    if (GRend(gr1_id)==FAIL) 
+    {
+        printf("Error: GRend failed on <%s>", fname1);
+        goto out;
+    }
+    if (GRend(gr2_id)==FAIL) 
+    {
+        printf("Error: GRend failed on <%s>", fname2);
+        goto out;
+    }
+    if (Hclose(file1_id)==FAIL) 
+    {
+        printf("Error: Hclose failed on <%s>", fname1);
+        goto out;
+    }
+    if (Hclose(file2_id)==FAIL) 
+    {
+        printf("Error: Hclose failed on <%s>", fname2);
+        goto out;
+    }
+    
+    
+    /* free tables */
+    dtable_free(list1);
+    dtable_free(list2);
+    diff_dim_table_free(td1_1);
+    diff_dim_table_free(td1_2);
+    diff_dim_table_free(td2_1);
+    diff_dim_table_free(td2_2);
+    
+    return nfound;
+    
+    
+out:
+    
+    opt->err_stat = 1;
+    
+    /* free tables */
+    dtable_free(list1);
+    dtable_free(list2);
+    diff_dim_table_free(td1_1);
+    diff_dim_table_free(td1_2);
+    diff_dim_table_free(td2_1);
+    diff_dim_table_free(td2_2);
+    
+    if (sd1_id!=-1)
+        SDend(sd1_id);
+    if (sd2_id!=-1)
+        SDend(sd2_id);
+    if (gr1_id!=-1)
+        GRend(gr1_id);
+    if (gr2_id!=-1)
+        GRend(gr2_id);
+    if (file1_id!=-1)
+        Hclose(file1_id);
+    if (file2_id!=-1)
+        Hclose(file2_id);
+    
+    return 0;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: match
+ *
+ * Purpose: Find common objects; the algorithm used for this search is the 
+ *  cosequential match algorithm and is described in 
+ *  Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
+ *
+ * Return: Number of differences found
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 22, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+uint32 match( uint32 nobjects1, 
+              dtable_t *list1,
+              uint32 nobjects2, 
+              dtable_t *list2,
+              int32 sd1_id, 
+              int32 gr1_id, 
+              int32 file1_id,                
+              int32 sd2_id, 
+              int32 gr2_id, 
+              int32 file2_id,
+              diff_opt_t *opt )
+{
+    int           cmp;
+    int           more_names_exist = (nobjects1>0 && nobjects2>0) ? 1 : 0;
+    uint32        curr1=0;
+    uint32        curr2=0;
+    uint32        nfound=0;
+    match_table_t *mattbl=NULL;
+    unsigned      infile[2]; 
+    char          c1, c2;
+    uint32        i;
+    
+   /*-------------------------------------------------------------------------
+    * build the list
+    *-------------------------------------------------------------------------
+    */
+    match_table_init( &mattbl );
+    
+    while ( more_names_exist )
+    {
+        cmp = strcmp( list1->objs[curr1].obj_name, list2->objs[curr2].obj_name );
+        if ( cmp == 0 )
+        {
+            infile[0]=1; infile[1]=1;
+            match_table_add(mattbl,infile,
+                list1->objs[curr1].obj_name,
+                list1->objs[curr1].tag,
+                list1->objs[curr1].ref,
+                list2->objs[curr2].tag,
+                list2->objs[curr2].ref);
+            
+            curr1++;
+            curr2++;
+        }
+        else if ( cmp < 0 )
+        {
+            infile[0]=1; infile[1]=0;
+            match_table_add(mattbl,infile,
+                list1->objs[curr1].obj_name,
+                list1->objs[curr1].tag,
+                list1->objs[curr1].ref,
+                -1,
+                -1);
+            curr1++;
+        }
+        else 
+        {
+            infile[0]=0; infile[1]=1;
+            match_table_add(mattbl,infile,
+                list2->objs[curr2].obj_name,
+                -1,
+                -1,
+                list2->objs[curr2].tag,
+                list2->objs[curr2].ref);
+            curr2++;
+        }
+        
+        more_names_exist = (curr1<nobjects1 && curr2<nobjects2) ? 1 : 0;
+        
+        
+    } /* end while */
+    
+    /* list1 did not end */
+    if (curr1<nobjects1)
+    {
+        while ( curr1<nobjects1 )
+        {
+            infile[0]=1; infile[1]=0;
+            match_table_add(mattbl,infile,
+                list1->objs[curr1].obj_name,
+                list1->objs[curr1].tag,
+                list1->objs[curr1].ref,
+                -1,
+                -1);
+            curr1++;
+        }
+    }
+    
+    /* list2 did not end */
+    if (curr2<nobjects2)
+    {
+        while ( curr2<nobjects2 )
+        {
+            infile[0]=0; infile[1]=1;
+            match_table_add(mattbl,infile,
+                list2->objs[curr2].obj_name,
+                -1,
+                -1,
+                list2->objs[curr2].tag,
+                list2->objs[curr2].ref);
+            curr2++;
+        }
+    }
+    
+   /*-------------------------------------------------------------------------
+    * print the list
+    *-------------------------------------------------------------------------
+    */
+    
+    if (opt->verbose) 
+    {
+        printf("---------------------------------------\n");
+        printf("file1     file2\n");
+        printf("---------------------------------------\n");
+        for (i = 0; i < mattbl->nobjs; i++)
+        {
+            c1 = (char)((mattbl->objs[i].flags[0]) ? 'x' : ' ');
+            c2 = (char)((mattbl->objs[i].flags[1]) ? 'x' : ' ');
+            printf("%5c %6c    %-15s\n", c1, c2, mattbl->objs[i].obj_name);
+        }
+        printf("\n");
+    }
+    
+    
+   /*-------------------------------------------------------------------------
+    * do the diff for objects
+    *-------------------------------------------------------------------------
+    */
+    
+    for (i = 0; i < mattbl->nobjs; i++)
+    {
+        if ( mattbl->objs[i].flags[0] && mattbl->objs[i].flags[1] )
+        {
+            nfound += diff(file1_id,
+                file2_id,
+                sd1_id,
+                sd2_id,
+                gr1_id,
+                gr2_id,
+                mattbl->objs[i].obj_name, 
+                mattbl->objs[i].obj_name, 
+                mattbl->objs[i].tag1,
+                mattbl->objs[i].ref1,
+                mattbl->objs[i].tag2,
+                mattbl->objs[i].ref2,
+                opt );
+        }
+    }
+    
+    
+    /* free table */
+    match_table_free(mattbl);
+    return nfound;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: diff
+ *
+ * Purpose: switch between types and choose the diff function
+ *
+ * Return: Number of differences found
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 25, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+uint32 diff( int32 file1_id,
+             int32 file2_id,
+             int32 sd1_id,
+             int32 sd2_id,
+             int32 gr1_id,
+             int32 gr2_id,
+             char *obj1_name,
+             char *obj2_name,
+             int32 tag1,
+             int32 ref1,
+             int32 tag2,
+             int32 ref2,
+             diff_opt_t *opt )
+{
+    uint32 nfound=0;
+    
+    switch ( tag1 )
+    {
+    case DFTAG_SD:  /* Scientific Data */
+    case DFTAG_SDG: /* Scientific Data Group */
+    case DFTAG_NDG: /* Numeric Data Group */
+        
+        nfound=diff_sds(sd1_id,sd2_id,ref1,ref2,opt);
+        break;
+        
+    case DFTAG_VG: 
+        break;
+        
+    case DFTAG_RI:  /* Raster Image */
+    case DFTAG_CI:  /* Compressed Image */
+    case DFTAG_RIG: /* Raster Image Group */
+    case DFTAG_RI8: /* Raster-8 image */
+    case DFTAG_CI8: /* RLE compressed 8-bit image */
+    case DFTAG_II8: /* IMCOMP compressed 8-bit image */
+        
+        if (opt->gr == 1) 
+            nfound=diff_gr(gr1_id,gr2_id,ref1,ref2,opt);
+        break;
+        
+    case DFTAG_VH: 
+        
+        if (opt->vd == 1) 
+            nfound=diff_vs(file1_id,file2_id,ref1,ref2,opt);
+        break;
+        
+    default:
+        printf("Tag <%ld> and Tag <%ld>: Comparison not supported for <%s> and <%s> \n", 
+            tag1, tag2, obj1_name, obj2_name);
+        break;
+    } 
+    
+    return nfound;
+}
+
diff --git a/mfhdf/hdiff/hdiff.h b/mfhdf/hdiff/hdiff.h
new file mode 100644
index 0000000..a9ac427
--- /dev/null
+++ b/mfhdf/hdiff/hdiff.h
@@ -0,0 +1,199 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   /hdf/src/master/mfhdf/ncdump/ncdump.h,v 1.1 1993/04/21 21:51:19 chouck Exp
+ *********************************************************************/
+
+
+
+
+#ifndef HDIFF_H__
+#define HDIFF_H__
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hdiff_table.h"
+
+#define  Printf  (void) printf
+
+/* Maximum value for max_err_cnt */
+#define	MAX_DIFF	0x7FFFFFFF
+
+struct ncdim {   /* dimension */
+    char name[H4_MAX_NC_NAME];
+    int32 size;
+};
+
+struct ncvar {   /* variable */
+    char name[H4_MAX_NC_NAME];
+    int32 type;
+    int32 ndims;
+    int32 dims[H4_MAX_VAR_DIMS];
+    int32 natts;
+};
+
+struct ncatt {   /* attribute */
+    int32 var;
+    char name[H4_MAX_NC_NAME];
+    int32 type;
+    int32 len;
+    void *val;
+};
+
+typedef
+enum {LANG_NONE, LANG_C, LANG_F} Nclang; 
+
+typedef struct {   /* selection for comparison  */
+    int verbose;   /*
+     * if true, print cuurent interface comparison
+     */
+    int ga;   /*
+     * if true, compare global attributes only 
+     */
+    int sa;   /*
+     * if true, compare SD local attributes only 
+     */
+    int sd;   /*
+     * if true, compare SD data only 
+     */
+    int gr;   /*
+     * if true, compare GR data only 
+     */
+    int vd;   /*
+     * if true, compare Vdata only 
+     */
+    uint32 max_err_cnt;         /*
+                                 * max. no of difference to be printed
+                                 */
+    float32 err_limit;  /*
+     * limit of difference for the comparison
+     */
+    int nlvars;   /*
+     * Number of variables specified with -v option
+     * on command line
+     */
+    char** lvars;  /*
+     * list of variable names specified with -v
+     * option on command line
+     */
+    int nuvars;   /*
+     * Number of variables specified with -u option
+     * on command line
+     */
+    char** uvars;  /*
+     * list of variable names specified with -u
+     * option on command line
+     */
+    int statistics;
+    float32 err_rel;  /*
+     * relative diff for the comparison
+     */
+
+    int    err_stat;  
+    /* an error ocurred (1, error, 0, no error) */
+
+} diff_opt_t;
+
+
+
+
+/*-------------------------------------------------------------------------
+ * public functions
+ *-------------------------------------------------------------------------
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint32  hdiff(const char *fname1, const char *fname2, diff_opt_t *opt);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+/*-------------------------------------------------------------------------
+ * private functions
+ *-------------------------------------------------------------------------
+ */
+
+uint32  gattr_diff(int32 sdid1, int32 sdid2, diff_opt_t *opt);
+void    pr_att_vals(nc_type type, int len, void *vals);
+void    make_vars(char *optarg, diff_opt_t *opt, int option);
+
+
+uint32 array_diff(void *buf1, 
+                  void *buf2, 
+                  uint32 tot_cnt, 
+                  const char *name1,
+                  const char *name2,
+                  int rank,
+                  int32 *dims,
+                  int32 type, 
+                  float32 err_limit, 
+                  float32 err_rel,
+                  uint32 max_err_cnt, 
+                  int32 statistics,
+                  void *fill1, 
+                  void *fill2);
+
+
+uint32 match( uint32 nobjects1, 
+              dtable_t *list1,
+              uint32 nobjects2, 
+              dtable_t *list2,
+              int32 sd1_id, 
+              int32 gr1_id, 
+              int32 file1_id,                
+              int32 sd2_id, 
+              int32 gr2_id, 
+              int32 file2_id,
+              diff_opt_t *opt );
+
+
+uint32 diff( int32 file1_id,
+             int32 file2_id,
+             int32 sd1_id,
+             int32 sd2_id,
+             int32 gr1_id,
+             int32 gr2_id,
+             char *obj1_name,
+             char *obj2_name,
+             int32 tag1,
+             int32 ref1,
+             int32 tag2,
+             int32 ref2,
+             diff_opt_t *opt );
+
+void print_dims( int r, int32 *d );
+
+
+uint32 diff_vs( int32 file1_id,
+                int32 file2_id,
+                int32 ref1,              
+                int32 ref2,
+                diff_opt_t * opt);
+
+
+uint32 diff_gr( int32 gr1_id,              
+                int32 gr2_id,
+                int32 ref1,              
+                int32 ref2,
+                diff_opt_t * opt);
+
+
+uint32 diff_sds(int32 sd1_id,              
+                int32 sd2_id,
+                int32 ref1,
+                int32 ref2,
+                diff_opt_t *opt);
+
+
+
+#endif
+
diff --git a/mfhdf/hdiff/hdiff_array.c b/mfhdf/hdiff/hdiff_array.c
new file mode 100644
index 0000000..78c630d
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_array.c
@@ -0,0 +1,747 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <math.h>
+#include <limits.h>
+#include <float.h>
+#include <assert.h>
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hdiff.h"
+#include "vgint.h"
+
+#ifndef ABS
+#   define ABS(a)		(((a)>=0) ? (a) : -(a))
+#endif
+
+
+#define MYMAX(A,B) (((A) > (B)) ? (A) : (B))
+#define MYMIN(A,B) (((A) < (B)) ? (A) : (B))
+#define PRINT_FSTATS(T) {\
+ printf("Type: %s  Npts: %lu  Ndiff: %lu (%f%%)\n", \
+ T, tot_cnt, n_diff, 100.*(float64)n_diff/(float64)tot_cnt); \
+ printf("Avg Diff: %.3e  Max Diff: %.3e\n",  \
+ d_avg_diff/n_stats, d_max_diff); \
+ printf("Range File1: %f/%f  File2: %f/%f\n", \
+d_min_val1, d_max_val1, d_min_val2, d_max_val2); }
+#define PRINT_ISTATS(T) {\
+ printf("Type: %s  Npts: %lu  Ndiff: %lu (%f%%)\n", \
+ T, tot_cnt,n_diff, 100.*(float64)n_diff/(float64)tot_cnt); \
+ printf("Avg Diff: %e   Max. Diff: %ld\n",  \
+ (d_avg_diff / n_stats), i4_max_diff); \
+ printf("Range File1: %ld/%ld  File2: %ld/%ld\n", \
+i4_min_val1, i4_max_val1, i4_min_val2, i4_max_val2); }
+
+
+/*-------------------------------------------------------------------------
+ * printf formatting
+ *-------------------------------------------------------------------------
+ */
+#define SPACES     "          "
+#define FFORMAT    "%-15f %-15f %-15f\n"
+#define FFORMATP   "%-15f %-15f %.0f%%\n"
+#define I8FORMAT   "%-15d %-15d %-15d\n"
+#define I8FORMATP  "%-15d %-15d %.0f%%\n"
+#define I16FORMAT  "%-15d %-15d %-15d\n"
+#define I16FORMATP "%-15d %-15d %.0f%%\n"
+#define IFORMAT    "%-15ld %-15ld %-15ld\n"
+#define IFORMATP   "%-15ld %-15ld %.0f%%\n"
+#define CFORMAT    "%-16c %-17c\n"
+#define SFORMAT    "%-16s %-17s\n"
+#define UIFORMAT   "%-15lu %-15lu %-15lu\n"
+#define LIFORMAT   "%-15ld %-15ld %-15ld\n"
+#define ULIFORMAT  "%-15lu %-15lu %-15lu\n"
+
+
+#define I16FORMATP_NOTCOMP "%-15d %-15d not comparable\n"
+#define I8FORMATP_NOTCOMP  "%-15d %-15d not comparable\n"
+#define IFORMATP_NOTCOMP   "%-15ld %-15ld not comparable\n"
+#define FFORMATP_NOTCOMP   "%-15f %-15f not comparable\n"
+
+
+/*-------------------------------------------------------------------------
+ * relative error
+ *-------------------------------------------------------------------------
+ */
+
+#define PER(A,B) { per=-1;                           \
+    not_comparable=0;                                \
+    both_zero=0;                                     \
+    if (A==0 && B==0)                                \
+    both_zero=1;                                     \
+    if (A!=0)                                        \
+    per = (double)ABS( ( double)(B-A) / (double)A ); \
+    else                                             \
+    not_comparable=1;                                \
+}
+
+/*-------------------------------------------------------------------------
+ * local prototypes
+ *-------------------------------------------------------------------------
+ */
+static void print_pos( int        *ph, 
+                       uint32     curr_pos, 
+                       int32      *acc, 
+                       int32      *pos, 
+                       int        rank, 
+                       const char *obj1, 
+                       const char *obj2 );
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: array_diff
+ *
+ * Purpose: compare the 2 buffers BUF1 and BUF2
+ *
+ *-------------------------------------------------------------------------
+ */
+
+uint32 array_diff(void *buf1, 
+                  void *buf2, 
+                  uint32 tot_cnt, 
+                  const char *name1,
+                  const char *name2,
+                  int rank,
+                  int32 *dims,
+                  int32 type, 
+                  float32 err_limit, 
+                  float32 err_rel,
+                  uint32 max_err_cnt, 
+                  int32 statistics,
+                  void *fill1, 
+                  void *fill2)
+
+
+{
+ uint32   i;
+ int8    *i1ptr1, *i1ptr2;
+ int16   *i2ptr1, *i2ptr2;
+ int32   *i4ptr1, *i4ptr2;
+ float32 *fptr1, *fptr2;
+ float64 *dptr1, *dptr2;
+ float64 d_diff, d_avg_diff = 0., d_max_diff = 0.;
+ float64 d_max_val1=0, d_min_val1=0, d_max_val2=0, d_min_val2=0;
+ float64 d_val1, d_val2;
+ float64 d_sumx = 0., d_sumy = 0., d_sumx2 = 0., d_sumy2 = 0., d_sumxy=0.;
+ float64 slope, intercept, correlation;
+ float32 f_diff;
+ int32   i4_diff, i4_max_diff = 0;
+ int32   i4_max_val1=0, i4_min_val1=0, i4_max_val2=0, i4_min_val2=0;
+ int16   i2_diff;
+ int8    c_diff;
+ int     is_fill1, is_fill2;
+ int     n_stats = 0;
+ char    *debug;
+ FILE    *fp=NULL;
+ int32   acc[H4_MAX_VAR_DIMS];   /* accumulator position */
+ int32   pos[H4_MAX_VAR_DIMS];   /* matrix position */
+ int     ph=1;                /* print header  */
+ int     j;
+ double  per;
+ int     both_zero;
+ int     not_comparable;
+ uint32  n_diff = 0;
+
+
+ acc[rank-1]=1;
+ for(j=(rank-2); j>=0; j--)
+ {
+  acc[j]=acc[j+1]*(int)dims[j+1];
+ }
+ for ( j = 0; j < rank; j++)
+  pos[j]=0;
+
+
+ debug = getenv("DEBUG");
+ if (debug) {
+  fp = fopen("hdiff.debug", "w");
+ }
+ 
+ switch(type) {
+ case DFNT_INT8:
+ case DFNT_CHAR8:
+  i4_max_val1 = SCHAR_MIN;
+  i4_min_val1 = SCHAR_MAX;
+  i4_max_val2 = SCHAR_MIN;
+  i4_min_val2 = SCHAR_MAX;
+  break;
+ case DFNT_UINT8:
+ case DFNT_UCHAR8:
+  i4_max_val1 = -UCHAR_MAX -1;
+  i4_min_val1 = UCHAR_MAX;
+  i4_max_val2 = -UCHAR_MAX -1;
+  i4_min_val2 = UCHAR_MAX;
+  break;
+ case DFNT_INT16:
+  i4_max_val1 = SHRT_MIN;
+  i4_min_val1 = SHRT_MAX;
+  i4_max_val2 = SHRT_MIN;
+  i4_min_val2 = SHRT_MAX;
+  break;
+ case DFNT_UINT16:
+  i4_max_val1 = -USHRT_MAX -1;
+  i4_min_val1 = USHRT_MAX;
+  i4_max_val2 = -USHRT_MAX -1;
+  i4_min_val2 = USHRT_MAX;
+  break;
+ case DFNT_INT32:
+  i4_max_val1 = INT_MIN;
+  i4_min_val1 = INT_MAX;
+  i4_max_val2 = INT_MIN;
+  i4_min_val2 = INT_MAX;
+  break;
+ case DFNT_UINT32:
+  i4_max_val1 = INT_MIN;
+  i4_min_val1 = INT_MAX;
+  i4_max_val2 = INT_MIN;
+  i4_min_val2 = INT_MAX;
+  break;
+ case DFNT_FLOAT:
+  d_max_val1 = -FLT_MAX;
+  d_min_val1 = FLT_MAX;
+  d_max_val2 = -FLT_MAX;
+  d_min_val2 = FLT_MAX;
+  break;
+ case DFNT_DOUBLE:
+  d_max_val1 = -DBL_MAX;
+  d_min_val1 = DBL_MAX;
+  d_max_val2 = -DBL_MAX;
+  d_min_val2 = DBL_MAX;
+  break;
+ default:
+  printf(" bad type - %ld\n", type);
+ }
+ switch(type)
+ {
+
+/*-------------------------------------------------------------------------
+ * DFNT_INT8, DFNT_UINT8, DFNT_UCHAR8, DFNT_CHAR8
+ *-------------------------------------------------------------------------
+ */
+ case DFNT_INT8:
+ case DFNT_UINT8:
+ case DFNT_UCHAR8:
+ case DFNT_CHAR8:
+  i1ptr1 = (int8 *) buf1;
+  i1ptr2 = (int8 *) buf2;
+  for (i=0; i<tot_cnt; i++)
+  {
+   c_diff = (int8)abs(*i1ptr1 - *i1ptr2);
+   is_fill1 = fill1 && (*i1ptr1 == *((int8 *)fill1));
+   is_fill2 = fill2 && (*i1ptr2 == *((int8 *)fill2));
+   if (!is_fill1 && !is_fill2) {
+    d_avg_diff += (float64)c_diff;
+    i4_max_diff = MYMAX(i4_max_diff, c_diff);
+    d_val2 = (float64)(*i1ptr2);
+    d_val1 = (float64)(*i1ptr1);
+    d_sumx += d_val1;
+    d_sumy += d_val2;
+    d_sumx2 += d_val1 * d_val1;
+    d_sumy2 += d_val2 * d_val2;
+    d_sumxy += d_val1 * d_val2;
+    n_stats++;
+   }
+   if (!is_fill1) {
+    i4_max_val1 = MYMAX(i4_max_val1, (int32)(*i1ptr1));
+    i4_min_val1 = MYMIN(i4_min_val1, (int32)(*i1ptr1));
+   }
+   if (!is_fill2) {
+    i4_max_val2 = MYMAX(i4_max_val2, (int32)(*i1ptr2));
+    i4_min_val2 = MYMIN(i4_min_val2, (int32)(*i1ptr2));
+   }
+
+
+/*-------------------------------------------------------------------------
+ * relative
+ *-------------------------------------------------------------------------
+ */
+
+   if (err_rel)
+   {
+       
+       PER(*i1ptr1,*i1ptr2);
+       
+       if (not_comparable && !both_zero) /* not comparable */
+       {
+           print_pos(&ph,i,acc,pos,rank,name1,name2);
+           printf(SPACES);
+           printf(I8FORMATP_NOTCOMP,*i1ptr1,*i1ptr2);
+           n_diff++;
+       }
+       
+       else
+           
+           if (per > err_rel)
+           {
+               n_diff++;
+               if (n_diff <= max_err_cnt) 
+               {
+                   print_pos(&ph,i,acc,pos,rank,name1,name2);
+                   printf(SPACES);
+                   printf(I8FORMATP,*i1ptr1,*i1ptr2,per*100);
+               }
+           }  
+           
+   }
+
+   else if (c_diff > (int32) err_limit)
+   {
+    n_diff++;
+    if (n_diff <= max_err_cnt) {
+     print_pos(&ph,i,acc,pos,rank,name1,name2);
+     printf(SPACES);
+     printf(I8FORMAT,*i1ptr1,*i1ptr2,abs(*i1ptr1-*i1ptr2));
+    }
+   }                                               
+   i1ptr1++;  i1ptr2++;
+  }
+  if (statistics) {
+   PRINT_ISTATS("Byte");
+  }
+  
+  break;
+
+/*-------------------------------------------------------------------------
+ * DFNT_INT16, DFNT_UINT16
+ *-------------------------------------------------------------------------
+ */
+  
+ case DFNT_INT16:
+ case DFNT_UINT16:
+  i2ptr1 = (int16 *) buf1;
+  i2ptr2 = (int16 *) buf2;
+  for (i=0; i<tot_cnt; i++)
+  {
+   i2_diff = (int16)abs(*i2ptr1 - *i2ptr2);
+   is_fill1 = fill1 && (*i2ptr1 == *((int16 *)fill1));
+   is_fill2 = fill2 && (*i2ptr2 == *((int16 *)fill2));
+   if (debug) {
+    fprintf(fp, "%d %d %ld %ld\n", is_fill1, is_fill2, (int32)(*i2ptr1), (int32)(*i2ptr2));
+   }
+   if (!is_fill1 && !is_fill2) {
+    d_val1 = (float64)(*i2ptr1);
+    d_val2 = (float64)(*i2ptr2);
+    d_sumx += d_val1;
+    d_sumy += d_val2;
+    d_sumx2 += d_val1 * d_val1;
+    d_sumy2 += d_val2 * d_val2;
+    d_sumxy += d_val1 * d_val2;
+    d_avg_diff += (float64)i2_diff;
+    i4_max_diff = MYMAX(i4_max_diff, i2_diff);
+    n_stats++;
+   }
+   if (!is_fill1) {
+    i4_max_val1 = MYMAX(i4_max_val1, (int32)(*i2ptr1));
+    i4_min_val1 = MYMIN(i4_min_val1, (int32)(*i2ptr1));
+   }
+   if (!is_fill2) {
+    i4_max_val2 = MYMAX(i4_max_val2, (int32)(*i2ptr2));
+    i4_min_val2 = MYMIN(i4_min_val2, (int32)(*i2ptr2));
+   }
+
+
+/*-------------------------------------------------------------------------
+ * relative
+ *-------------------------------------------------------------------------
+ */
+
+   if (err_rel)
+   {
+       
+       PER(*i2ptr1,*i2ptr2);
+       
+       if (not_comparable && !both_zero) /* not comparable */
+       {
+           print_pos(&ph,i,acc,pos,rank,name1,name2);
+           printf(SPACES);
+           printf(I16FORMATP_NOTCOMP,*i2ptr1,*i2ptr2);
+           n_diff++;
+       }
+       
+       else
+           
+           if (per > err_rel)
+           {
+               n_diff++;
+               if (n_diff <= max_err_cnt) 
+               {
+                   print_pos(&ph,i,acc,pos,rank,name1,name2);
+                   printf(SPACES);
+                   printf(I16FORMATP,*i2ptr1,*i2ptr2,per*100);
+               }
+           }  
+           
+   }
+
+
+   else if (i2_diff > (int) err_limit)
+   {
+    n_diff++;
+    if (n_diff <= max_err_cnt) {
+     print_pos(&ph,i,acc,pos,rank,name1,name2);
+     printf(SPACES);
+     printf(I16FORMAT,*i2ptr1,*i2ptr2,abs(*i2ptr1-*i2ptr2));
+    }
+   }                                               
+   i2ptr1++;  i2ptr2++;
+  }
+  if (statistics) {
+   PRINT_ISTATS("Integer2");
+  }
+  break;
+
+/*-------------------------------------------------------------------------
+ * DFNT_INT32, DFNT_UINT32
+ *-------------------------------------------------------------------------
+ */
+  
+  
+ case DFNT_INT32:
+ case DFNT_UINT32:
+  i4ptr1 = (int32 *) buf1;
+  i4ptr2 = (int32 *) buf2;
+  for (i=0; i<tot_cnt; i++)
+  {
+   i4_diff = labs(*i4ptr1 - *i4ptr2);
+   is_fill1 = fill1 && (*i4ptr1 == *((int32 *)fill1));
+   is_fill2 = fill2 && (*i4ptr2 == *((int32 *)fill2));
+   if (!is_fill1 && !is_fill2) {
+    d_avg_diff += (float64)i4_diff;
+    d_val1 = (float64)(*i4ptr1);
+    d_val2 = (float64)(*i4ptr2);
+    d_sumx += d_val1;
+    d_sumy += d_val2;
+    d_sumx2 += d_val1 * d_val1;
+    d_sumy2 += d_val2 * d_val2;
+    d_sumxy += d_val1 * d_val2;
+    i4_max_diff = (int32)MYMAX(i4_max_diff, (float64)(i4_diff));
+    n_stats++;
+   }
+   if (! is_fill1) {
+    i4_max_val1 = MYMAX(i4_max_val1,*i4ptr1);
+    i4_min_val1 = MYMIN(i4_min_val1,*i4ptr1);
+   }
+    if (! is_fill2) {
+    i4_max_val2 = MYMAX(i4_max_val2,*i4ptr2);
+    i4_min_val2 = MYMIN(i4_min_val2,*i4ptr2);
+   }
+
+
+/*-------------------------------------------------------------------------
+ * relative
+ *-------------------------------------------------------------------------
+ */
+
+    if (err_rel)
+    {
+        
+        PER(*i4ptr1,*i4ptr2);
+        
+        if (not_comparable && !both_zero) /* not comparable */
+        {
+            print_pos(&ph,i,acc,pos,rank,name1,name2);
+            printf(SPACES);
+            printf(IFORMATP_NOTCOMP,*i4ptr1,*i4ptr2);
+            n_diff++;
+        }
+        
+        else
+            
+            if (per > err_rel)
+            {
+                n_diff++;
+                if (n_diff <= max_err_cnt) 
+                {
+                    print_pos(&ph,i,acc,pos,rank,name1,name2);
+                    printf(SPACES);
+                    printf(IFORMATP,*i4ptr1,*i4ptr2,per*100);
+                }
+            }  
+            
+    }
+
+   else if (i4_diff > (int32) err_limit)
+   {
+    n_diff++;
+    if (n_diff <= max_err_cnt) {
+     print_pos(&ph,i,acc,pos,rank,name1,name2);
+     printf(SPACES);
+     printf(IFORMAT,*i4ptr1,*i4ptr2,i4_diff);
+    }
+   }                                               
+   i4ptr1++;  i4ptr2++;
+  }
+  if (statistics) {
+   PRINT_ISTATS("Integer4");
+  }
+  
+  break;
+
+/*-------------------------------------------------------------------------
+ * DFNT_FLOAT
+ *-------------------------------------------------------------------------
+ */
+  
+  
+ case DFNT_FLOAT:
+  fptr1 = (float32 *) buf1;
+  fptr2 = (float32 *) buf2;
+  for (i=0; i<tot_cnt; i++)
+  {
+   f_diff = (float32)fabs(*fptr1 - *fptr2);
+   is_fill1 = fill1 && (*fptr1 == *((float32 *)fill1));
+   is_fill2 = fill2 && (*fptr2 == *((float32 *)fill2));
+   if (debug) {
+    fprintf(fp, "%d %d %f %f\n", is_fill1, is_fill2, *fptr1, *fptr2);
+   }
+   if (!is_fill1 && !is_fill2) {
+    d_avg_diff += (float64)f_diff;
+    d_val1 = (float64)(*fptr1);
+    d_val2 = (float64)(*fptr2);
+    d_sumx += d_val1;
+    d_sumy += d_val2;
+    d_sumx2 += d_val1 * d_val1;
+    d_sumy2 += d_val2 * d_val2;
+    d_sumxy += d_val1 * d_val2;
+    d_max_diff = MYMAX(d_max_diff, (float64)(f_diff));
+    n_stats++;
+   }
+   if (!is_fill1) {
+    d_max_val1 = MYMAX(d_max_val1, (float64)(*fptr1));
+    d_min_val1 = MYMIN(d_min_val1, (float64)(*fptr1));
+   }
+   if (!is_fill2) {
+    d_max_val2 = MYMAX(d_max_val2, (float64)(*fptr2));
+    d_min_val2 = MYMIN(d_min_val2, (float64)(*fptr2));
+   }
+
+
+/*-------------------------------------------------------------------------
+ * relative
+ *-------------------------------------------------------------------------
+ */
+
+   if (err_rel)
+   {
+       
+       PER(*fptr1,*fptr2);
+       
+       if (not_comparable && !both_zero) /* not comparable */
+       {
+           print_pos(&ph,i,acc,pos,rank,name1,name2);
+           printf(SPACES);
+           printf(FFORMATP_NOTCOMP,*fptr1,*fptr2);
+           n_diff++;
+       }
+       
+       else
+           
+           if (per > err_rel)
+           {
+               n_diff++;
+               if (n_diff <= max_err_cnt) 
+               {
+                   print_pos(&ph,i,acc,pos,rank,name1,name2);
+                   printf(SPACES);
+                   printf(FFORMATP,*fptr1,*fptr2,per*100);
+               }
+           }  
+           
+   }
+
+   else if (f_diff > err_limit)
+   {
+    n_diff++;
+    if (n_diff <= max_err_cnt) {
+     print_pos(&ph,i,acc,pos,rank,name1,name2);
+     printf(SPACES);
+     printf(FFORMAT,*fptr1,*fptr2,fabs(*fptr1-*fptr2));
+    }
+   }                                               
+   fptr1++;  fptr2++;
+  }
+  if (statistics) {
+   PRINT_FSTATS("Float");
+  }
+  break;
+
+
+/*-------------------------------------------------------------------------
+ * DFNT_DOUBLE
+ *-------------------------------------------------------------------------
+ */
+  
+ case DFNT_DOUBLE:
+  dptr1 = (float64 *) buf1;
+  dptr2 = (float64 *) buf2;
+  for (i=0; i<tot_cnt; i++)
+  {
+   d_diff = fabs(*dptr1 - *dptr2);
+   is_fill1 = fill1 && (*dptr1 == *((float64 *)fill1));
+   is_fill2 = fill2 && (*dptr2 == *((float64 *)fill2));
+   if (!is_fill1 && !is_fill2) {
+    d_avg_diff += d_diff;
+    d_val1 = (float64)(*dptr1);
+    d_val2 = (float64)(*dptr2);
+    d_sumx += d_val1;
+    d_sumy += d_val2;
+    d_sumx2 += d_val1 * d_val1;
+    d_sumy2 += d_val2 * d_val2;
+    d_sumxy += d_val1 * d_val2;
+    d_max_diff = MYMAX(d_max_diff, (d_diff));
+    n_stats++;
+   }
+   if (! is_fill1) {
+    d_max_val1 = MYMAX(d_max_val1, (*dptr1));
+    d_min_val1 = MYMIN(d_min_val1, (*dptr1));
+   }
+   if (! is_fill2) {
+    d_max_val2 = MYMAX(d_max_val2, (*dptr2));
+    d_min_val2 = MYMIN(d_min_val2, (*dptr2));
+   }
+
+
+/*-------------------------------------------------------------------------
+ * relative
+ *-------------------------------------------------------------------------
+ */
+
+   if (err_rel)
+   {
+       
+       PER(*dptr1,*dptr2);
+       
+       if (not_comparable && !both_zero) /* not comparable */
+       {
+           print_pos(&ph,i,acc,pos,rank,name1,name2);
+           printf(SPACES);
+           printf(FFORMATP_NOTCOMP,*dptr1,*dptr2);
+           n_diff++;
+       }
+       
+       else
+           
+           if (per > err_rel)
+           {
+               n_diff++;
+               if (n_diff <= max_err_cnt) 
+               {
+                   print_pos(&ph,i,acc,pos,rank,name1,name2);
+                   printf(SPACES);
+                   printf(FFORMATP,*dptr1,*dptr2,per*100);
+               }
+           }  
+           
+   }
+
+
+   else if (d_diff > (float64) err_limit)
+   {
+    n_diff++;
+    if (n_diff <= max_err_cnt) {
+     print_pos(&ph,i,acc,pos,rank,name1,name2);
+     printf(SPACES);
+     printf(FFORMAT,*dptr1,*dptr2,fabs(*dptr1-*dptr2));
+    }
+   }
+   dptr1++;  dptr2++;
+  }
+  if (statistics) {
+   PRINT_FSTATS("Double");
+  }
+  break;
+  
+ default:
+  printf(" bad type - %ld\n", type);
+  }
+  if (statistics) {
+   float64 sqrt_arg;
+   if ((float64)n_stats * d_sumx2 - d_sumx * d_sumx != 0.0) {
+    slope = ((float64)n_stats * d_sumxy - d_sumx * d_sumy) / 
+     ((float64)n_stats * d_sumx2 - d_sumx * d_sumx);
+    intercept = (d_sumy - slope * d_sumx) / (float64)n_stats;
+    sqrt_arg = ((float64)n_stats*d_sumx2 - d_sumx*d_sumx) /
+     ((float64)n_stats * d_sumy2 - d_sumy * d_sumy);
+    correlation = slope * sqrt(sqrt_arg);
+    printf("Regression  N: %d  Slope: %e  Intercept: %e  R: %e\n",
+     n_stats, slope, intercept, correlation);
+   }
+   else {
+    printf("Regression  Slope: NaN  Intercept: NaN  R: NaN\n");
+   }
+  }
+  if (debug) {
+   fclose(fp);
+  }
+ 
+  return n_diff;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_pos
+ *
+ * Purpose: convert an array index position to matrix notation
+ *
+ * Return: pos matrix array
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static void print_pos( int        *ph, 
+                       uint32     curr_pos, 
+                       int32      *acc, 
+                       int32      *pos, 
+                       int        rank, 
+                       const char *obj1, 
+                       const char *obj2 )
+{
+ int i;
+
+ /* print header */
+ if ( *ph==1 )
+ {
+  *ph=0;
+  printf("%-15s %-15s %-15s %-20s\n", 
+   "position", 
+   (obj1!=NULL) ? obj1 : " ", 
+   (obj2!=NULL) ? obj2 : " ",
+   "difference");
+  printf("------------------------------------------------------------\n");
+ }
+
+ for ( i = 0; i < rank; i++)
+ {
+  pos[i] = curr_pos/acc[i];
+  curr_pos -= acc[i]*pos[i];
+ }
+ assert( curr_pos == 0 );
+
+ printf("[ " );  
+ for ( i = 0; i < rank; i++)
+ {
+  fprintf(stdout,"%ld ", pos[i]  );
+ }
+ printf("]" );
+}
+
diff --git a/mfhdf/hdiff/hdiff_dim.c b/mfhdf/hdiff/hdiff_dim.c
new file mode 100644
index 0000000..5f8d565
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_dim.c
@@ -0,0 +1,537 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+
+#include <assert.h>
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hdiff_dim.h"
+
+
+/* match name between 2 diff_dim_table_t type lists */
+typedef struct diff_match_dim_name_t {
+    int32 ref;                    /* reference */
+    char  dim_name[H4_MAX_NC_NAME];  /* name */
+    int   flags[2];               /* name exists 1, no 0 */  
+} diff_match_dim_name_t;
+
+/* table for diff_match_dim_name_t */
+typedef struct diff_match_dim_table_t {
+    int        size;
+    int        nobjs;
+    diff_match_dim_name_t *objs;
+} diff_match_dim_table_t;
+
+/*-------------------------------------------------------------------------
+ * local prototypes
+ *-------------------------------------------------------------------------
+ */
+
+/* methods for diff_match_dim_table_t */
+static void diff_match_dim_table_free( diff_match_dim_table_t *table );
+static void diff_match_dim_table_init( diff_match_dim_table_t **tbl );
+static void diff_match_dim_table_add ( diff_match_dim_table_t *table, unsigned *flags, char* dim_name, int32 ref);
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_match_dim
+ *
+ * Purpose: diff "lone" dimensions. 
+ *  Find common dimension names; the algorithm used for this search is the 
+ *  cosequential match algorithm and is described in 
+ *  Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente Nunes, pvn at hdfgroup.org
+ *
+ * Date: July 16, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+uint32 diff_match_dim(int32 sd1_id,
+                      int32 sd2_id,
+                      diff_dim_table_t *td1_1,
+                      diff_dim_table_t *td1_2,
+                      diff_dim_table_t *td2_1,
+                      diff_dim_table_t *td2_2,
+                      diff_opt_t * opt)
+{
+    int                    cmp;
+    int                    more_names_exist;
+    int                    curr1;
+    int                    curr2;
+    diff_match_dim_table_t *mattbl_file1=NULL;
+    diff_match_dim_table_t *mattbl_file2=NULL;
+    unsigned               inlist[2]; 
+    int                    i;
+    uint32                 nfound = 0;
+    
+#if defined (HDIFF_DEBUG)
+    for (i = 0; i < td1_1->nobjs; i++) 
+    {
+        printf("%s\n", td1_1->objs[i].dim_name);
+    }
+    for (i = 0; i < td1_2->nobjs; i++) 
+    {
+        printf("%s\n", td1_2->objs[i].dim_name);
+    }
+#endif
+    
+    
+   /*-------------------------------------------------------------------------
+    * build the list for file 1
+    *-------------------------------------------------------------------------
+    */
+    
+    
+    more_names_exist = (td1_1->nobjs>0 && td1_2->nobjs>0) ? 1 : 0;
+    curr1=0;
+    curr2=0;
+    
+    diff_match_dim_table_init( &mattbl_file1 );
+    
+    while ( more_names_exist )
+    {
+        cmp = strcmp( td1_1->objs[curr1].dim_name, td1_2->objs[curr2].dim_name );
+        if ( cmp == 0 )
+        {
+            inlist[0]=1; inlist[1]=1;
+            diff_match_dim_table_add(mattbl_file1,inlist,
+                td1_1->objs[curr1].dim_name,
+                td1_1->objs[curr1].ref);
+            
+            curr1++;
+            curr2++;
+        }
+        else if ( cmp < 0 )
+        {
+            inlist[0]=1; inlist[1]=0;
+            diff_match_dim_table_add(mattbl_file1,inlist,
+                td1_1->objs[curr1].dim_name,
+                td1_1->objs[curr1].ref);
+            curr1++;
+        }
+        else 
+        {
+            inlist[0]=0; inlist[1]=1;
+            diff_match_dim_table_add(mattbl_file1,inlist,
+                td1_2->objs[curr2].dim_name,
+                td1_2->objs[curr2].ref);
+            curr2++;
+        }
+        
+        more_names_exist = (curr1<td1_1->nobjs && curr2<td1_1->nobjs) ? 1 : 0;
+        
+        
+    } /* end while */
+    
+    /* td1_1 did not end */
+    if (curr1<td1_1->nobjs)
+    {
+        while ( curr1<td1_1->nobjs )
+        {
+            inlist[0]=1; inlist[1]=0;
+            diff_match_dim_table_add(mattbl_file1,inlist,
+                td1_1->objs[curr1].dim_name,
+                td1_1->objs[curr1].ref);
+            curr1++;
+        }
+    }
+    
+    /* td1_2 did not end */
+    if (curr2<td1_2->nobjs)
+    {
+        while ( curr2<td1_2->nobjs )
+        {
+            inlist[0]=0; inlist[1]=1;
+            diff_match_dim_table_add(mattbl_file1,inlist,
+                td1_2->objs[curr2].dim_name,
+                td1_2->objs[curr2].ref);
+            curr2++;
+        }
+    }
+    
+   /*-------------------------------------------------------------------------
+    * print the list
+    *-------------------------------------------------------------------------
+    */
+#if defined (HDIFF_DEBUG)
+    {
+        char     c1, c2;
+        printf("---------------------------------------\n");
+        printf("list1     list2\n");
+        printf("---------------------------------------\n");
+        for (i = 0; i < mattbl_file1->nobjs; i++)
+        {
+            c1 = (char)((mattbl_file1->objs[i].flags[0]) ? 'x' : ' ');
+            c2 = (char)((mattbl_file1->objs[i].flags[1]) ? 'x' : ' ');
+            printf("%5c %6c    %-15s\n", c1, c2, mattbl_file1->objs[i].dim_name);
+        }
+        printf("\n");
+    }
+#endif
+    
+    
+   /*-------------------------------------------------------------------------
+    * build the list for file 2
+    *-------------------------------------------------------------------------
+    */
+      
+    more_names_exist = (td2_1->nobjs>0 && td2_2->nobjs>0) ? 1 : 0;
+    curr1=0;
+    curr2=0;
+    
+    diff_match_dim_table_init( &mattbl_file2 );
+    
+    while ( more_names_exist )
+    {
+        cmp = strcmp( td2_1->objs[curr1].dim_name, td2_2->objs[curr2].dim_name );
+        if ( cmp == 0 )
+        {
+            inlist[0]=1; inlist[1]=1;
+            diff_match_dim_table_add(mattbl_file2,inlist,
+                td2_1->objs[curr1].dim_name,
+                td2_1->objs[curr1].ref);
+            
+            curr1++;
+            curr2++;
+        }
+        else if ( cmp < 0 )
+        {
+            inlist[0]=1; inlist[1]=0;
+            diff_match_dim_table_add(mattbl_file2,inlist,
+                td2_1->objs[curr1].dim_name,
+                td2_1->objs[curr1].ref);
+            curr1++;
+        }
+        else 
+        {
+            inlist[0]=0; inlist[1]=1;
+            diff_match_dim_table_add(mattbl_file2,inlist,
+                td2_2->objs[curr2].dim_name,
+                td2_2->objs[curr2].ref);
+            curr2++;
+        }
+        
+        more_names_exist = (curr1<td2_1->nobjs && curr2<td2_1->nobjs) ? 1 : 0;
+        
+        
+    } /* end while */
+    
+    /* td2_1 did not end */
+    if (curr1<td2_1->nobjs)
+    {
+        while ( curr1<td2_1->nobjs )
+        {
+            inlist[0]=1; inlist[1]=0;
+            diff_match_dim_table_add(mattbl_file2,inlist,
+                td2_1->objs[curr1].dim_name,
+                td2_1->objs[curr1].ref);
+            curr1++;
+        }
+    }
+    
+    /* td2_2 did not end */
+    if (curr2<td2_2->nobjs)
+    {
+        while ( curr2<td2_2->nobjs )
+        {
+            inlist[0]=0; inlist[1]=1;
+            diff_match_dim_table_add(mattbl_file2,inlist,
+                td2_2->objs[curr2].dim_name,
+                td2_2->objs[curr2].ref);
+            curr2++;
+        }
+    }
+    
+   /*-------------------------------------------------------------------------
+    * print the list
+    *-------------------------------------------------------------------------
+    */
+#if defined (HDIFF_DEBUG)
+    {
+        char     c1, c2;
+        printf("---------------------------------------\n");
+        printf("list1     list2\n");
+        printf("---------------------------------------\n");
+        for (i = 0; i < mattbl_file2->nobjs; i++)
+        {
+            c1 = (char)((mattbl_file2->objs[i].flags[0]) ? 'x' : ' ');
+            c2 = (char)((mattbl_file2->objs[i].flags[1]) ? 'x' : ' ');
+            printf("%5c %6c    %-15s\n", c1, c2, mattbl_file2->objs[i].dim_name);
+        }
+        printf("\n");
+    }
+#endif
+       
+   /*-------------------------------------------------------------------------
+    * get objects from list1 not in list2
+    *-------------------------------------------------------------------------
+    */
+    
+    for (i = 0; i < mattbl_file1->nobjs; i++)
+    {
+        if ( mattbl_file1->objs[i].flags[0] && ( ! mattbl_file1->objs[i].flags[1] ) )
+        {
+            int j;
+            
+            /* search in file 2 for this dimension */
+            for (j = 0; j < mattbl_file2->nobjs; j++)
+            {
+                
+                /* same name */
+                if ( strcmp( mattbl_file1->objs[i].dim_name, mattbl_file2->objs[j].dim_name ) == 0 )
+                {
+                    
+                    /* and also a lone dim in file 2 */
+                    if ( mattbl_file2->objs[j].flags[0] && ( ! mattbl_file2->objs[j].flags[1] ) )
+                    {
+                        
+                        int32 ref1 = mattbl_file1->objs[i].ref;
+                        int32 ref2 = mattbl_file2->objs[j].ref;
+                        
+                        nfound+=diff_sds(sd1_id,
+                            sd2_id,
+                            ref1,
+                            ref2,
+                            opt);
+                        
+                        
+                    }
+                    
+                    
+                    
+                }
+                
+                
+            }
+            
+        
+        }
+    
+    }
+    
+    
+    /* free tables */
+    diff_match_dim_table_free(mattbl_file1);
+    diff_match_dim_table_free(mattbl_file2);
+    
+    return nfound;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_match_dim_table_add
+ *
+ * Purpose: add an entry from a list of dimension names into the match table 
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: July 16, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+void diff_match_dim_table_add (diff_match_dim_table_t *table, 
+                               unsigned *flags, 
+                               char* dim_name, 
+                               int32 ref)
+{
+    int i;
+    
+    /* check if name already on match table */
+    for (i = 0; i < table->nobjs; i++) 
+    {
+        /* insert information at position i */
+        if ( strcmp(dim_name, table->objs[i].dim_name)==0 )
+        {
+            if (table->objs[i].flags[0] == 0)
+                table->objs[i].flags[0] = flags[0];
+            if (table->objs[i].flags[1] == 0)
+                table->objs[i].flags[1] = flags[1];
+            return;
+        }
+    }
+    
+    
+    if (table->nobjs == table->size) 
+    {
+        table->size *= 2;
+        table->objs = (diff_match_dim_name_t*)realloc(table->objs, table->size * sizeof(diff_match_dim_name_t));
+        
+        for (i = table->nobjs; i < table->size; i++) {
+            table->objs[i].ref = -1;
+            table->objs[i].flags[0] = table->objs[i].flags[1] = -1;
+        }
+    }
+    
+    i = table->nobjs++;
+    table->objs[i].ref = ref;
+    strcpy(table->objs[i].dim_name,dim_name);
+    table->objs[i].flags[0] = flags[0];
+    table->objs[i].flags[1] = flags[1];
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_match_dim_table_init
+ *
+ * Purpose: initialize match table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: July 16, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+void diff_match_dim_table_init( diff_match_dim_table_t **tbl )
+{
+    int i;
+    diff_match_dim_table_t *table = (diff_match_dim_table_t*) malloc(sizeof(diff_match_dim_table_t));
+    
+    table->size = 20;
+    table->nobjs = 0;
+    table->objs = (diff_match_dim_name_t*) malloc(table->size * sizeof(diff_match_dim_name_t));
+    
+    for (i = 0; i < table->size; i++) {
+        table->objs[i].ref = -1;
+        table->objs[i].flags[0] = table->objs[i].flags[1] = -1;
+    }
+    
+    *tbl = table;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_match_dim_table_free
+ *
+ * Purpose: free match table 
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: July 16, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+void diff_match_dim_table_free( diff_match_dim_table_t *table )
+{
+    free(table->objs);
+    free(table);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_dim_table_add
+ *
+ * Purpose: add an entry of pair REF/NAME into a dimension table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: July 16, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void diff_dim_table_add(diff_dim_table_t *table, 
+                        int ref, 
+                        char* name)
+{
+    int i;
+    
+    assert(table);
+    
+    if (table->nobjs == table->size) 
+    {
+        table->size *= 2;
+        table->objs = (diff_dim_name_t*)realloc(table->objs, table->size * sizeof(diff_dim_name_t));
+        
+        for (i = table->nobjs; i < table->size; i++) {
+            table->objs[i].ref = -1;
+        }
+    }
+    
+    i = table->nobjs++;
+    table->objs[i].ref = ref;
+    strcpy(table->objs[i].dim_name,name);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_dim_table_init
+ *
+ * Purpose: initialize dimension table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: July 16, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void diff_dim_table_init( diff_dim_table_t **tbl )
+{
+    int i;
+    diff_dim_table_t* table = (diff_dim_table_t*) malloc(sizeof(diff_dim_table_t));
+    
+    table->size = 20;
+    table->nobjs = 0;
+    table->objs = (diff_dim_name_t*) malloc(table->size * sizeof(diff_dim_name_t));
+    
+    for (i = 0; i < table->size; i++) {
+        table->objs[i].ref = -1;
+    }
+    
+    *tbl = table;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: diff_dim_table_free
+ *
+ * Purpose: free dimension table 
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: July 16, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void diff_dim_table_free( diff_dim_table_t *table )
+{
+    free(table->objs);
+    free(table);
+}
+
diff --git a/mfhdf/hdiff/hdiff_dim.h b/mfhdf/hdiff/hdiff_dim.h
new file mode 100644
index 0000000..dd4c664
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_dim.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+
+#ifndef HDIFF_DIM_H_
+#define HDIFF_DIM_H_
+
+
+#include "hdiff.h"
+
+
+/* dimension SDS  */
+typedef struct diff_dim_name_t {
+    int32 ref;                    /* reference */
+    char  dim_name[H4_MAX_NC_NAME];  /* name */
+} diff_dim_name_t;
+
+/* table for diff_dim_name_t */
+typedef struct diff_dim_table_t {
+    int        size;
+    int        nobjs;
+    diff_dim_name_t *objs;
+} diff_dim_table_t;
+
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void diff_dim_table_add(diff_dim_table_t *table, int ref, char* name);
+void diff_dim_table_init( diff_dim_table_t **tbl );
+void diff_dim_table_free( diff_dim_table_t *table );
+
+
+uint32 diff_match_dim(int32 sd1_id,
+               int32 sd2_id,
+               diff_dim_table_t *td1_1,
+               diff_dim_table_t *td1_2,
+               diff_dim_table_t *td2_1,
+               diff_dim_table_t *td2_2,
+               diff_opt_t * opt);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* HDIFF_DIM_H_ */
diff --git a/mfhdf/hdiff/hdiff_gattr.c b/mfhdf/hdiff/hdiff_gattr.c
new file mode 100644
index 0000000..9c2f5c1
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_gattr.c
@@ -0,0 +1,127 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "hdf.h"
+#include "mfhdf.h"
+#include "vg.h"
+#include "hdiff.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: gattr_diff
+ *
+ * Purpose: compare global SDS attributes
+ *
+ *-------------------------------------------------------------------------
+ */
+
+uint32 gattr_diff(int32 sdid1, 
+                  int32 sdid2,
+                  diff_opt_t *opt)
+{
+ int32   nvars1, nvars2;      /* number of variables */
+ int32   ngatts1, ngatts2;    /* number of global attributes */
+ struct  ncatt att1, att2;    /* attribute */
+ int     ia, ib;              /* attribute number */
+ int     iret2;
+ uint32  nfound=0;
+
+ SDfileinfo(sdid1, &nvars1, &ngatts1);
+ 
+ /* get global attributes */
+ 
+ for (ia = 0; ia < ngatts1; ia++) 
+ {
+  SDattrinfo(sdid1, ia, att1.name, &att1.type, &att1.len);
+  ib = SDfindattr(sdid2, att1.name);
+  if (ib == -1)     /* attribute doesn't exist in file2 */
+  {
+   printf("\n---------------------------\n");
+   printf("< %s\n", att1.name);
+   printf("> '%s' does not exist in file2\n", att1.name);
+   nfound ++;
+   continue;
+  }
+  iret2 = SDattrinfo(sdid2, ib, att2.name, &att2.type, &att2.len);
+  att1.val = (void *) malloc((unsigned) (att1.len*DFKNTsize(att1.type | DFNT_NATIVE)));
+  if (!att1.val) 
+  {
+   fprintf(stderr,"Out of memory!\n");
+   goto out;
+  }
+  att2.val = (void *) malloc((unsigned) (att2.len*DFKNTsize(att2.type | DFNT_NATIVE)));
+  if (!att2.val) 
+  {
+   fprintf(stderr,"Out of memory!\n");
+   goto out;
+  }
+  SDreadattr(sdid1, ia, att1.val);
+  iret2 = SDreadattr(sdid2, ib, att2.val);
+  
+  iret2 = 0;
+  if (att1.type != att2.type || att1.len != att2.len) 
+   iret2 = 1;
+  if (iret2 == 0)       /* compare the data */
+   iret2 = memcmp((void *) att1.val, att2.val, 
+   att1.len*DFKNTsize(att1.type | DFNT_NATIVE));
+  
+  if (iret2 != 0)
+  {
+   printf("\n---------------------------\n");
+   printf("Attr Name: %s\n", att1.name);
+   printf("< ");
+   pr_att_vals((nc_type)att1.type, att1.len, att1.val);
+   printf("\n> ");
+   pr_att_vals((nc_type)att2.type, att2.len, att2.val);
+   printf("\n");
+   
+   nfound ++;
+  }
+  
+  free ((char *) att1.val);
+  free ((char *) att2.val);
+ }
+ 
+ /* check any global attributes in file2 but not in file1 */
+ 
+ iret2 =  SDfileinfo(sdid2, &nvars2, &ngatts2);
+ 
+ for (ib = 0; ib < ngatts2; ib++) 
+ {
+  iret2 = SDattrinfo(sdid2, ib, att2.name, &att2.type, &att2.len);
+  ia = SDfindattr(sdid1, att2.name);
+  if (ia == -1)     /* attribute doesn't exist in file2 */
+  {
+   printf("\n---------------------------\n");
+   printf("< '%s' does not exist in file1\n", att2.name);
+   printf("> %s\n", att2.name);
+   
+   nfound ++;
+  }
+ }
+ 
+ return nfound;
+
+
+out:
+
+ opt->err_stat = 1;
+ return 0;
+}
+
diff --git a/mfhdf/hdiff/hdiff_gr.c b/mfhdf/hdiff/hdiff_gr.c
new file mode 100644
index 0000000..1ee5269
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_gr.c
@@ -0,0 +1,305 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include "hdiff.h"
+#include "hdiff_list.h"
+#include "hdiff_mattbl.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_gr
+ *
+ * Purpose: diff for GR
+ *
+ * Return: Number of differences found
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 27, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+uint32 diff_gr( int32 gr1_id,              
+                int32 gr2_id,
+                int32 ref1,              
+                int32 ref2,
+                diff_opt_t *opt)  
+{
+ int32 ri1_id=-1,              /* data set identifier */
+       ri1_index,              /* index number of the data set */
+       dtype1,                 /* GR data type */
+       dimsizes1[H4_MAX_VAR_DIMS],/* dimensional size */
+       nattrs1,                /* number of attributes */
+       ncomps1,                /* number of components */
+       interlace_mode1,        /* interlace mode of an image */ 
+       ri2_id=-1,              /* data set identifier */
+       ri2_index,              /* index number of the data set */
+       dtype2,                 /* GR data type */
+       dimsizes2[H4_MAX_VAR_DIMS],/* dimensional size */
+       nattrs2,                /* number of attributes */
+       ncomps2,                /* number of components */
+       interlace_mode2,        /* interlace mode of an image */ 
+       start[H4_MAX_VAR_DIMS],    /* read start */
+       edges[H4_MAX_VAR_DIMS],    /* read edges */
+       numtype,                /* number type */
+       eltsz,                  /* element size */
+       data_size;
+ uint32 nelms;                 /* number of elements */ 
+ char  gr1_name[H4_MAX_NC_NAME]; 
+ char  gr2_name[H4_MAX_NC_NAME]; 
+ int   dim_diff=0;             /* dimensions are different */
+ VOIDP buf1=NULL;
+ VOIDP buf2=NULL;
+ uint32 max_err_cnt;
+ int    i, cmp;
+ uint32 nfound=0;
+ int    compare = 1;
+
+
+
+/*-------------------------------------------------------------------------
+ * object 1
+ *-------------------------------------------------------------------------
+ */
+ 
+ ri1_index = GRreftoindex(gr1_id,(uint16)ref1);
+ ri1_id    = GRselect(gr1_id,ri1_index);
+   
+ /*obtain name,rank,dimsizes,datatype and num of attributes of gr */
+ if (GRgetiminfo(ri1_id,gr1_name,&ncomps1,&dtype1,&interlace_mode1,dimsizes1,&nattrs1)==FAIL) {
+   printf( "Failed to get info for SDS ref <%ld>\n",ref1);
+   goto out;
+  }
+
+
+/*-------------------------------------------------------------------------
+ * object 2
+ *-------------------------------------------------------------------------
+ */
+ 
+ ri2_index = GRreftoindex(gr2_id,(uint16)ref2);
+ ri2_id    = GRselect(gr2_id,ri2_index);
+   
+ /*obtain name,rank,dimsizes,datatype and num of attributes of gr */
+ if (GRgetiminfo(ri2_id,gr2_name,&ncomps2,&dtype2,&interlace_mode2,dimsizes2,&nattrs2)==FAIL) {
+   printf( "Failed to get info for SDS ref <%ld>\n",ref2);
+   goto out;
+  }
+
+ 
+ if (opt->verbose)
+     printf("Comparing <%s>\n",gr1_name); 
+
+
+/*-------------------------------------------------------------------------
+ * check for different type
+ *-------------------------------------------------------------------------
+ */
+ 
+ if (dtype1 != dtype2) 
+ {
+  printf("Comparison not supported\n");
+  printf("<%s> has datatype %ld, <%s> has datatype %ld ",gr1_name,dtype1,gr2_name,dtype2);
+  compare = 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for the same rank
+ *-------------------------------------------------------------------------
+ */
+ 
+ if ( ncomps1 != ncomps2 )
+ {
+  printf("Comparison not supported\n");
+  printf("<%s> has %ld components\n", gr1_name, ncomps1);
+  printf("\n" );
+  printf("<%s> has %ld components\n", gr2_name, ncomps2);
+  compare = 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for different dimensions
+ *-------------------------------------------------------------------------
+ */
+ 
+ for ( i=0; i<2; i++) 
+ {
+  if ( dimsizes1[i] != dimsizes2[i] )
+   dim_diff=1;
+ }
+
+/*-------------------------------------------------------------------------
+ * dimensions
+ *-------------------------------------------------------------------------
+ */
+
+ if (dim_diff==1)
+ {
+  printf("Comparison not supported\n");
+  printf("<%s> has dimensions ", gr1_name);
+  print_dims(2,dimsizes1);
+  printf("\n" );
+  printf("<%s> has dimensions ", gr2_name);
+  print_dims(2,dimsizes2);
+  compare = 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * match interlace 
+ * NOTE: GR images are always stored as pixel_interlace (0) on disk
+ *       that does not happen with images saved with the 
+ *       DF24 - Single-file 24-Bit Raster Image Interface,
+ *       where the interlace mode on disk can be 0, 1 or 2
+ *-------------------------------------------------------------------------
+ */
+ if ( interlace_mode1 != interlace_mode2 )
+ {
+  if (opt->verbose)
+  printf("Warning: different interlace mode: <%ld> and <%ld>\n", 
+   interlace_mode1,interlace_mode2);
+  interlace_mode1=interlace_mode2;
+ }
+
+
+/*-------------------------------------------------------------------------
+ * get size 
+ *-------------------------------------------------------------------------
+ */
+
+ /* compute the number of the bytes for each value. */
+ numtype = dtype1 & DFNT_MASK;
+ eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+
+ /* set edges of SDS */
+ nelms=1;
+ for (i = 0; i < 2; i++) {
+  nelms   *= dimsizes1[i];
+  edges[i] = dimsizes1[i];
+  start[i] = 0;
+ }
+
+ data_size = dimsizes1[0]*dimsizes1[1]*ncomps1*eltsz;
+
+ if (compare)
+ {
+     
+    /*-------------------------------------------------------------------------
+     * read image 1
+     *-------------------------------------------------------------------------
+     */
+     
+     /* alloc */
+     if ((buf1 = (VOIDP) HDmalloc(data_size)) == NULL) {
+         printf( "Failed to allocate %lu elements of size %ld\n", nelms, eltsz);
+         goto out;
+     }
+     
+     /* set the interlace for reading  */
+     if ( GRreqimageil(ri1_id, interlace_mode1) == FAIL ){
+         printf( "Could not set interlace for GR <%s>\n", gr1_name);
+         goto out;
+     }
+     
+     /* read data */
+     if (GRreadimage (ri1_id, start, NULL, edges, buf1) == FAIL) {
+         printf( "Could not read GR <%s>\n", gr1_name);
+         goto out;
+     }
+     
+    /*-------------------------------------------------------------------------
+     * read image 2
+     *-------------------------------------------------------------------------
+     */
+     
+     /* alloc */
+     if ((buf2 = (VOIDP) HDmalloc(data_size)) == NULL) {
+         printf( "Failed to allocate %lu elements of size %ld\n", nelms, eltsz);
+         goto out;
+     }
+     
+     /* set the interlace for reading  */
+     if ( GRreqimageil(ri2_id, interlace_mode2) == FAIL ){
+         printf( "Could not set interlace for GR <%s>\n", gr2_name);
+         goto out;
+     }
+     
+     /* read data */
+     if (GRreadimage (ri2_id, start, NULL, edges, buf2) == FAIL) {
+         printf( "Could not read GR <%s>\n", gr2_name);
+         goto out;
+     }
+     
+     
+    /*-------------------------------------------------------------------------
+     * comparing
+     *-------------------------------------------------------------------------
+     */
+     
+         
+     cmp = HDmemcmp(buf1,buf2,data_size);
+     if (cmp!=0)
+     {
+     /* if the given max_err_cnt is set (i.e. not its default MAX_DIFF),
+	use it, otherwise, use the total number of elements in the dataset */
+         max_err_cnt = (opt->max_err_cnt != MAX_DIFF) ? opt->max_err_cnt : nelms;
+         nfound=array_diff(
+             buf1, 
+             buf2, 
+             nelms, 
+             gr1_name,
+             gr2_name,
+             2,
+             dimsizes1,
+             dtype1, 
+             opt->err_limit, 
+             opt->err_rel,
+             max_err_cnt, 
+             opt->statistics, 
+             0, 
+             0);
+     }
+     
+ } /* compare */
+  
+/*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+
+ GRendaccess(ri1_id);
+ GRendaccess(ri2_id);
+ if (buf1) free(buf1);
+ if (buf2) free(buf2);
+
+
+ return nfound;
+
+
+
+out:
+
+ opt->err_stat = 1;
+
+ if (ri1_id!=-1)
+    GRendaccess(ri1_id);
+ if (ri2_id!=-1)
+    GRendaccess(ri2_id);
+ if (buf1) free(buf1);
+ if (buf2) free(buf2);
+
+ return 0;
+}
+
diff --git a/mfhdf/hdiff/hdiff_list.c b/mfhdf/hdiff/hdiff_list.c
new file mode 100644
index 0000000..5f806a7
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_list.c
@@ -0,0 +1,1534 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <assert.h>
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hdiff_list.h"
+
+static int is_reserved(char*vg_class);
+static char *get_path(char*path_name, char*obj_name);
+static int insert_an_data(int32 file_id,
+                          int32 ref_in, 
+                          int32 tag_in,
+                          ann_type type, 
+                          char *path);
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff_list
+ *
+ * Purpose: locate all HDF objects in the file and return a list of them
+ *
+ * Return: number of objects in the file
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 21, 2003
+ *
+ * Description:
+ *
+ * A main loop is used to locate all the objects in the file. This loop preserves the 
+ * hierarchy of the file. The algorithm used is 
+ * 1) Obtain the number of lone VGroups in the HDF file. 
+ * 2) Do a loop for each one of these groups. In each iteration a table is updated 
+ *    with the tag/reference pair of an object. 
+ *    2.1) Obtain the pairs of tag/references for the group 
+ *    2.2) Switch between the tag of the current object. Four cases are possible: 
+ *         1) Object is a group: recursively repeat the process (obtain the pairs of
+ *            tag/references for this group and do another tag switch). 
+ *            Add the object to the table. 
+ *         2) Object is a dataset: Add the object to the table.
+ *         3) Object is an image: Add the object to the table.  
+ *         4) Object is a vdata: Add the object to the table. 
+ * 3) Read all the HDF interfaces (SDS, GR and VS), checking for objects that are 
+ *    already in the table (meaning they belong to a previous inspected group, 
+ *    and should not be added).  These objects belong to a root group. 
+ * 4) Read all global attributes and annotations. 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+
+uint32 hdiff_list (const char* fname, 
+                   dtable_t *table, 
+                   diff_dim_table_t *td1,
+                   diff_dim_table_t *td2,
+                   int *err)
+{
+    int32    file_id=-1, 
+             sd_id=-1, 
+             gr_id=-1;
+    
+    
+    /* open the file for read */
+    if ((file_id  = Hopen (fname,DFACC_READ,(int16)0))==FAIL)
+    {
+        printf("Cannot open file <%s>\n",fname);
+        goto out;
+    }
+    
+    /* initialize the SD interface */
+    if ((sd_id  = SDstart (fname, DFACC_READ))==FAIL)
+    {
+        printf( "Could not start SD for <%s>\n",fname);
+        goto out;
+    }
+    
+    /* initialize the GR interface */
+    if ((gr_id  = GRstart (file_id))==FAIL)
+    {
+        printf( "Could not start GR for <%s>\n",fname);
+        goto out;
+    }
+    
+    /* iterate tru HDF interfaces */
+    if ( hdiff_list_vg (fname,file_id,sd_id,gr_id,table,td1,td2) < 0)
+        goto out;
+    if ( hdiff_list_gr (file_id,gr_id,table) < 0)
+        goto out;
+    if ( hdiff_list_sds(file_id,sd_id,table,td1,td2) < 0)
+        goto out;
+    if ( hdiff_list_vs (file_id,table) < 0)
+        goto out;
+    if ( hdiff_list_glb(sd_id,gr_id) < 0)
+        goto out;
+    if ( hdiff_list_an (file_id) < 0)
+        goto out;
+    
+    /* close */
+    if (GRend (gr_id)==FAIL) 
+    {
+        printf( "Failed to close GR interface <%s>\n", fname);
+        goto out;
+    }
+    if (SDend (sd_id)==FAIL) 
+    {
+        printf( "Failed to close SD interface <%s>\n", fname);
+        goto out;
+    }
+    if (Hclose (file_id) == FAIL ) 
+    {
+        printf( "Failed to close file <%s>\n", fname);
+        goto out;
+    }
+    
+    *err=0;
+    return table->nobjs;
+    
+out:
+    
+    if (sd_id!=-1)
+        SDend(sd_id);
+    if (gr_id!=-1)
+        GRend(gr_id);
+    if (file_id!=-1)
+        Hclose(file_id);
+    
+    *err=1;
+    return 0;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff_list_vg
+ *
+ * Purpose: locate all lone Vgroups in the file
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int hdiff_list_vg(const char* fname,
+                  int32 file_id,
+                  int32 sd_id,             /* SD interface identifier */
+                  int32 gr_id,             /* GR interface identifier */
+                  dtable_t *table,         /* all objects table */
+                  diff_dim_table_t *td1,   /* dimension table 1 */
+                  diff_dim_table_t *td2)   /* dimension table 2 */
+{
+    int32  vg_id;          /* vgroup identifier */
+    int32  nlones = 0;     /* number of lone vgroups */
+    int32  ntagrefs;       /* number of tag/ref pairs in a vgroup */
+    int32  *ref_array=NULL;/* buffer to hold the ref numbers of lone vgroups   */
+    int32  *tags=NULL;     /* buffer to hold the tag numbers of vgroups   */
+    int32  *refs=NULL;     /* buffer to hold the ref numbers of vgroups   */
+    int32  tag_vg;
+    int32  ref_vg;
+    char   *vg_name;
+    char   *vg_class;
+    uint16 name_len;
+    int32  i;
+    
+    /* initialize the V interface */
+    if (Vstart (file_id)==FAIL) 
+    {
+        printf("Error: Could not start group interface in <%s>\n", fname);
+        return FAIL;
+    }
+    
+   /*
+    * get the names and class names of all the lone vgroups.
+    * first, call Vlone with nlones set to 0 to get the number of
+    * lone vgroups in the file, but not to get their reference numbers.
+    */
+    nlones = Vlone (file_id, NULL, nlones );
+    
+    if (nlones > 0)
+    {
+   /*
+    * use the nlones returned to allocate sufficient space for the
+    * buffer ref_array to hold the reference numbers of all lone vgroups,
+    */
+        ref_array = (int32 *) malloc(sizeof(int32) * nlones);
+        
+       /*
+        * and call Vlone again to retrieve the reference numbers into 
+        * the buffer ref_array.
+        */
+        nlones = Vlone (file_id, ref_array, nlones);
+        
+       /*
+        * iterate tru each lone vgroup.
+        */
+        for (i = 0; i < nlones; i++)
+        {
+            
+            int32 ref = ref_array[i];
+       /*
+        * attach to the current vgroup then get its
+        * name and class. note: the current vgroup must be detached before
+        * moving to the next.
+        */
+            if ((vg_id = Vattach (file_id, ref, "r"))==FAIL)
+            {
+                printf("Error: Could not attach group with ref <%ld>\n", ref);
+                goto out;
+            }
+
+            if (Vgetnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get name length for group with ref <%ld>\n", ref);
+                goto out;
+            }
+
+            vg_name = (char *) HDmalloc(sizeof(char) * (name_len+1));
+            
+            if (Vgetname (vg_id, vg_name)==FAIL)
+            {
+                printf("Error: Could not get name for group with ref <%ld>\n", ref);
+                goto out;
+            }
+            
+            if (Vgetclassnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get classname length for group with ref <%ld>\n", ref);
+                goto out;
+            }
+
+            vg_class = (char *) HDmalloc(sizeof(char) * (name_len+1));
+            
+            if (Vgetclass (vg_id, vg_class)==FAIL)
+            {
+                printf("Error: Could not get class for group with ref <%ld>\n", ref);
+                goto out;
+            }
+            
+            /* ignore reserved HDF groups/vdatas */
+            if( is_reserved(vg_class))
+            {
+                if (Vdetach (vg_id)==FAIL)
+                {
+                    printf("Error: Could not detach group <%s>\n", vg_class);
+                    goto out;
+                }
+                continue;
+            }
+            
+            if(strcmp(vg_name,GR_NAME)==0) 
+            {
+                if (Vdetach (vg_id)==FAIL)
+                {
+                    printf("Error: Could not detach group <%s>\n", vg_class);
+                    goto out;
+                }
+                continue;
+            }
+            
+            /* get ref and tag */
+            if ((ref_vg = VQueryref(vg_id))==FAIL)
+            {
+                printf( "Failed to get ref for <%s>\n", vg_name);
+                goto out;
+            }
+
+            if ((tag_vg = VQuerytag(vg_id))==FAIL)
+            {
+                printf( "Failed to get tag for <%s>\n", vg_name);
+                goto out;
+            }
+
+            assert(tag_vg==DFTAG_VG);
+      
+                  
+            /* add object to table */
+            dtable_add(table,tag_vg,ref_vg,vg_name);
+            
+            insert_vg_attrs(vg_id,vg_name);
+            insert_vg_an(file_id,vg_id,vg_name);
+
+            
+            /* insert objects for this group */
+            ntagrefs = Vntagrefs(vg_id);
+            if ( ntagrefs > 0 )
+            {
+                tags = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                refs = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                Vgettagrefs(vg_id, tags, refs, ntagrefs);
+                
+                insert_vg(fname,
+                    file_id,
+                    sd_id,
+                    gr_id,
+                    vg_name,
+                    tags,
+                    refs,
+                    ntagrefs,
+                    table,
+                    td1,
+                    td2);
+                
+                if (tags ) 
+                    free (tags);
+                if (refs) 
+                    free (refs);
+            }
+            
+            if(Vdetach (vg_id)==FAIL)
+            {
+                printf("Error: Could not detach group <%s>\n", vg_name);
+                goto out;
+            }
+
+            free (vg_name);
+            
+        } /* for */
+        
+        
+        /* free the space allocated */
+        if (ref_array) 
+            free (ref_array);
+    } /* if */
+ 
+ 
+   /* terminate access to the V interface */
+   if (Vend (file_id)==FAIL) 
+   {
+       printf("Error: Could not end group interface\n");
+   }
+ 
+ return 0;
+ 
+ 
+out:
+ 
+ Vend (file_id);
+ if (ref_array) 
+     free (ref_array);
+ return FAIL;
+ 
+ 
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_vg
+ *
+ * Purpose: recursive function to locate objects in Vgroups
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int insert_vg(const char* fname,
+              int32 file_id,
+              int32 sd_id,             /* SD interface identifier */
+              int32 gr_id,             /* GR interface identifier */
+              char*path_name,          /* absolute path for input group name */          
+              int32* in_tags,          /* tag list for parent group */
+              int32* in_refs,          /* ref list for parent group */
+              int npairs,              /* number tag/ref pairs for parent group */
+              dtable_t *table,         /* all objects table */
+              diff_dim_table_t *td1,        /* dimension table 1 */
+              diff_dim_table_t *td2)        /* dimension table 2 */
+             
+{
+    int32 vg_id,             /* vgroup identifier */
+          ntagrefs,              /* number of tag/ref pairs in a vgroup */
+          tag,                   /* temporary tag */
+          ref,                   /* temporary ref */
+          *tags,                 /* buffer to hold the tag numbers of vgroups   */
+          *refs;                 /* buffer to hold the ref numbers of vgroups   */
+    char  *vg_name, *vg_class;
+    char  *path=NULL;
+    int   i;
+    uint16 name_len;
+    
+    for ( i = 0; i < npairs; i++ ) 
+    {
+        tag = in_tags[i];
+        ref = in_refs[i];
+        
+        switch(tag) 
+        {
+       /*-------------------------------------------------------------------------
+        * VG
+        *-------------------------------------------------------------------------
+        */
+        case DFTAG_VG: 
+
+            /* check if already inserted */
+            if ( dtable_search(table,DFTAG_VG,ref)>=0 ) 
+            {
+                break;
+            }
+           
+            vg_id = Vattach (file_id, ref, "r");
+            if (Vgetnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get name length for group with ref <%ld>\n", ref);
+                break;
+            }
+
+            vg_name = (char *) HDmalloc(sizeof(char) * (name_len+1));
+            
+            Vgetname (vg_id, vg_name);
+
+            if (Vgetclassnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get classname length for group with ref <%ld>\n", ref);
+                break;
+            }
+
+            vg_class = (char *) HDmalloc(sizeof(char) * (name_len+1));
+            
+            Vgetclass (vg_id, vg_class);
+            
+            /* ignore reserved HDF groups/vdatas */
+            if( is_reserved(vg_class))
+            {
+                Vdetach (vg_id);
+                break;
+            }
+            
+            if(strcmp(vg_name,GR_NAME)==0) 
+            {
+                Vdetach (vg_id);
+                break;
+            }
+
+         
+            /* initialize path */
+            path=get_path(path_name,vg_name);
+            
+            /* add object to table */
+            dtable_add(table,tag,ref,path);
+    
+            insert_vg_attrs(vg_id,path);
+            insert_vg_an(file_id,vg_id,path);
+            
+            /* get objects for this group */
+            ntagrefs  = Vntagrefs(vg_id);
+            if ( ntagrefs > 0 )
+            {
+                tags = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                refs = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                Vgettagrefs(vg_id, tags, refs, ntagrefs);
+                
+                /* recurse */
+                insert_vg(fname,
+                    file_id,
+                    sd_id,
+                    gr_id,
+                    path,
+                    tags,
+                    refs,
+                    ntagrefs,
+                    table,
+                    td1,
+                    td2);
+                
+                free (tags);
+                free (refs);
+            }
+            if(Vdetach (vg_id)==FAIL)
+            {
+                printf("Error: Could not detach group <%s>\n", vg_name);
+            }
+            if (path)
+                free(path);
+            
+            break;
+            
+            
+       /*-------------------------------------------------------------------------
+        * SDS
+        *-------------------------------------------------------------------------
+        */   
+            
+        case DFTAG_SD:  /* Scientific Data */
+        case DFTAG_SDG: /* Scientific Data Group */
+        case DFTAG_NDG: /* Numeric Data Group */
+            
+            insert_sds(file_id,
+                sd_id,
+                tag,
+                ref,
+                path_name,
+                table,
+                td1,
+                td2);
+            
+            break;
+            
+       /*-------------------------------------------------------------------------
+        * Image
+        *-------------------------------------------------------------------------
+        */   
+        case DFTAG_RI:  /* Raster Image */
+        case DFTAG_CI:  /* Compressed Image */
+        case DFTAG_RIG: /* Raster Image Group */
+        case DFTAG_RI8: /* Raster-8 image */
+        case DFTAG_CI8: /* RLE compressed 8-bit image */
+        case DFTAG_II8: /* IMCOMP compressed 8-bit image */
+            
+            insert_gr(file_id,gr_id,tag,ref,path_name,table);
+            
+            break;
+            
+       /*-------------------------------------------------------------------------
+        * Vdata
+        *-------------------------------------------------------------------------
+        */   
+        case DFTAG_VH:  /* Vdata Header */
+
+            insert_vs(file_id,ref,path_name,table,0);
+
+            break;
+            
+  }
+ }
+ 
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff_list_gr
+ *
+ * Purpose: get top level GR images
+ *
+ * Return:  SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int hdiff_list_gr(int32 file_id,
+                  int32 gr_id,             /* GR interface identifier */
+                  dtable_t *table)
+{
+    int32 ri_id,             /* raster image identifier */
+          n_rimages,         /* number of raster images in the file */
+          n_file_attrs,      /* number of file attributes */
+          ri_index,          /* index of a image */
+          gr_ref,            /* reference number of the GR image */
+          dim_sizes[2],      /* dimensions of an image */
+          n_comps,           /* number of components an image contains */
+          interlace_mode,    /* interlace mode of an image */ 
+          data_type,         /* number type of an image */
+          n_attrs;           /* number of attributes belong to an image */
+    char  name[H4_MAX_GR_NAME]; /* name of an image */
+    
+    /* determine the contents of the file */
+    if (GRfileinfo (gr_id, &n_rimages, &n_file_attrs)<0)
+    {
+        return FAIL;
+    }
+    
+    for (ri_index = 0; ri_index < n_rimages; ri_index++)
+    {
+        ri_id = GRselect (gr_id, ri_index);
+        GRgetiminfo (ri_id, name, &n_comps, &data_type, &interlace_mode, 
+         dim_sizes, &n_attrs);
+        
+        gr_ref = GRidtoref(ri_id);
+        
+        /* check if already inserted in Vgroup; search all image tags */
+        if ( dtable_search(table,DFTAG_RI,gr_ref)>=0 ||
+            dtable_search(table,DFTAG_CI,gr_ref)>=0 ||
+            dtable_search(table,DFTAG_RIG,gr_ref)>=0 ||
+            dtable_search(table,DFTAG_RI8,gr_ref)>=0 ||
+            dtable_search(table,DFTAG_CI8,gr_ref)>=0 ||
+            dtable_search(table,DFTAG_II8,gr_ref)>=0 )
+        {
+            GRendaccess (ri_id);
+            continue;
+        }
+        
+        /* insert GR  */
+        insert_gr(file_id,gr_id,DFTAG_RI,gr_ref,0,table);
+        
+        /* terminate access to the current raster image */
+        GRendaccess (ri_id);
+    }
+
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff_list_sds
+ *
+ * Purpose: get top level SDS
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int hdiff_list_sds(int32 file_id,
+                   int32 sd_id,                  /* SD interface identifier */
+                   dtable_t *table,              /* all objects table */
+                   diff_dim_table_t *td1,             /* dimension table 1 */
+                   diff_dim_table_t *td2)             /* dimension table 2 */
+
+
+
+{
+    int32 sds_id,                 /* dataset identifier */
+          n_datasets,             /* number of datasets in the file */
+          n_file_attrs,           /* number of file attributes */
+          index,                  /* index of a dataset */
+          sds_ref,                /* reference number */
+          dim_sizes[H4_MAX_VAR_DIMS],/* dimensions of an image */
+          data_type,              /* number type  */
+          rank,                   /* rank */
+          n_attrs;                /* number of attributes */
+    char  name[H4_MAX_GR_NAME];      /* name of dataset */
+    
+    /* determine the number of data sets in the file and the number of file attributes */
+    if (SDfileinfo (sd_id, &n_datasets, &n_file_attrs)<0)
+    {
+        return FAIL;
+    }
+    
+    for (index = 0; index < n_datasets; index++)
+    {
+        sds_id  = SDselect (sd_id, index);
+        SDgetinfo(sds_id, name, &rank, dim_sizes, &data_type, &n_attrs);
+        sds_ref = SDidtoref(sds_id);
+        
+        /* check if already inserted in Vgroup; search all SDS tags */
+        if ( dtable_search(table,DFTAG_SD,sds_ref)>=0 ||
+             dtable_search(table,DFTAG_SDG,sds_ref)>=0 ||
+             dtable_search(table,DFTAG_NDG,sds_ref)>=0 )
+        {
+            SDendaccess (sds_id);
+            continue;
+        }
+        
+        /* insert SDS  */
+        insert_sds(file_id,
+            sd_id,
+            DFTAG_NDG,
+            sds_ref,
+            0,
+            table,
+            td1,
+            td2);
+        
+        /* terminate access to the current dataset */
+        SDendaccess (sds_id);
+    }
+    
+    return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff_list_vs
+ *
+ * Purpose: get top level VS
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int hdiff_list_vs(int32 file_id,
+                  dtable_t *table)
+{
+    int32 nlones = 0,   /* number of lone vdatas */
+          *ref_array,   /* buffer to hold the ref numbers of lone vdatas   */
+          ref;          /* temporary ref number  */
+    int   i;
+    
+    /* initialize the VS interface */
+    Vstart (file_id);
+
+   /*
+    * get and print the names and class names of all the lone vdatas.
+    * first, call Vlone with nlones set to 0 to get the number of
+    * lone vdatas in the file, but not to get their reference numbers.
+    */
+    nlones = VSlone (file_id, NULL, nlones );
+    
+    if (nlones > 0)
+    {
+   /*
+    * use the nlones returned to allocate sufficient space for the
+    * buffer ref_array to hold the reference numbers of all lone vgroups,
+    */
+        ref_array = (int32 *) malloc(sizeof(int32) * nlones);
+        
+       /*
+        * and call VSlone again to retrieve the reference numbers into 
+        * the buffer ref_array.
+        */
+        nlones = VSlone (file_id, ref_array, nlones);
+        
+       /*
+        * iterate tru each lone vdata.
+        */
+        for (i = 0; i < nlones; i++)
+        {
+       /*
+        * attach to the current vdata then get its
+        * name and class. note: the current vdata must be detached before
+        * moving to the next.
+        */
+            ref = ref_array[i];
+            
+            /* check if already inserted in Vgroup*/
+            if ( dtable_search(table,DFTAG_VH,ref)>=0 ) 
+            {
+                continue;
+            }
+            
+            /* insert VS */
+            insert_vs(file_id,ref,0,table,1);
+            
+        } /* for */
+        
+        
+        /* free the space allocated */
+        if (ref_array) free (ref_array);
+    } /* if */
+    
+    /* terminate access to the VS interface */
+    Vend (file_id);
+    return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_vg_attrs
+ *
+ * Purpose: insert VG attributes
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int insert_vg_attrs(int32 vg_in,
+                    char *path) 
+{
+    int    n_attrs;
+    int32  data_type, size,  n_values;
+    char   attr_name[H4_MAX_NC_NAME];
+    int    i;
+    
+    /* Get the number of attributes attached to this vgroup.  */
+    if((n_attrs = Vnattrs2 (vg_in))==FAIL) 
+    {
+        printf( "Failed to get attributes for <%s>\n", path);
+        return -1;
+    }
+    
+    for (i = 0; i < n_attrs; i++) 
+    {
+        if((Vattrinfo2 (vg_in, i, attr_name, &data_type, &n_values, &size, NULL, NULL))==FAIL) 
+        {
+            printf( "Failed to get attribute %d of <%s>\n", i, path);
+            continue;
+        }
+        
+    }
+    return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff_list_glb
+ *
+ * Purpose: list/insert global SDS attributes, global GR atrributes
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int hdiff_list_glb(int32 sd_id,                  /* SD interface identifier */
+                   int32 gr_id)                  /* GR interface identifier */
+{
+    int32 n_datasets,             /* number of datasets in the file */
+          n_file_attrs;           /* number of file attributes */
+    
+   /*-------------------------------------------------------------------------
+    * insert SDS global attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* determine the number of data sets in the file and the number of file attributes */
+    SDfileinfo (sd_id, &n_datasets, &n_file_attrs);
+    
+    insert_sds_attrs(sd_id,n_file_attrs);
+    
+   /*-------------------------------------------------------------------------
+    * insert GR global attributes
+    *-------------------------------------------------------------------------
+    */ 
+
+    /* determine the number of data sets in the file and the number of file attributes */
+    GRfileinfo (gr_id, &n_datasets, &n_file_attrs);
+    
+    insert_gr_attrs(gr_id,n_file_attrs);
+    
+    return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: hdiff_list_an
+ *
+ * Purpose: list/insert AN FILE objects
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int hdiff_list_an(int32 file_id)
+{
+    int32 an_id,         /* AN interface identifier */
+          ann_id,        /* an annotation identifier */
+          i,             /* position of an annotation in all of the same type*/
+          n_file_labels, n_file_descs, n_data_labels, n_data_descs;
+    
+    /* Initialize the AN interface  */
+    an_id  = ANstart (file_id);
+    
+   /*
+    * Get the annotation information, e.g., the numbers of file labels, file
+    * descriptions, data labels, and data descriptions.
+    */
+    ANfileinfo (an_id, &n_file_labels, &n_file_descs, &n_data_labels, &n_data_descs);
+    
+   /*-------------------------------------------------------------------------
+    * AN_FILE_LABEL
+    *-------------------------------------------------------------------------
+    */ 
+    
+    for (i = 0; i < n_file_labels; i++)
+    {
+        /* Get the identifier of the current data label */
+        ann_id = ANselect (an_id, i, AN_FILE_LABEL);
+        
+        /* Terminate access to the current data label */
+        ANendaccess (ann_id);
+        
+    }
+    
+   /*-------------------------------------------------------------------------
+    * AN_FILE_DESC
+    *-------------------------------------------------------------------------
+    */ 
+    
+    for (i = 0; i < n_file_descs; i++)
+    {
+        /* Get the identifier of the current data label */
+        ann_id = ANselect (an_id, i, AN_FILE_DESC);
+        
+        /* Terminate access to the current data label */
+        ANendaccess (ann_id);
+    }
+    
+    /* Terminate access to the AN interface */
+    ANend (an_id);
+    
+    return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_vg_an
+ *
+ * Purpose: insert Vgroup ANs
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int insert_vg_an(int32 file_id,
+                 int32 vg_id,
+                 char *path) 
+{
+    int32 ref_in,
+          tag_in;
+    
+    if ((ref_in = VQueryref(vg_id))==FAIL)
+    {
+        printf( "Failed to get ref for <%s>\n", path);
+        return -1;
+    }
+
+    if ((tag_in = VQuerytag(vg_id))==FAIL){
+        printf( "Failed to get tag for <%s>\n", path);
+        return -1;
+    }
+
+    insert_an(file_id,ref_in,tag_in,path);
+    
+    return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_vs_an
+ *
+ * Purpose: insert Vdata ANs
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int insert_vs_an(int32 file_id,
+                 int32 vdata_id,
+                 char *path)
+{
+    int32 ref_in,
+           tag_in;
+    
+    if ((ref_in = VSQueryref(vdata_id))==FAIL)
+    {
+        printf( "Failed to get ref for <%s>\n", path);
+        return-1;
+    }
+    if ((tag_in = VSQuerytag(vdata_id))==FAIL)
+    {
+        printf( "Failed to get tag for <%s>\n", path);
+        return-1;
+    }
+    
+    insert_an(file_id,ref_in,tag_in,path);
+    
+    return 1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_an_data
+ *
+ * Purpose: insert DATA ANs
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int insert_an_data(int32 file_id,
+                   int32 ref_in, 
+                   int32 tag_in,
+                   ann_type type, 
+                   char *path) 
+{
+    int32 an_id,         /* AN interface identifier */
+          ann_id,        /* an annotation identifier */
+          i,             /* position of an annotation */
+          n_anno;
+    
+    /* Initialize the AN interface  */
+    an_id  = ANstart (file_id);
+    
+    /* Get the number of ANs in this object  */
+    if((n_anno = ANnumann(an_id,type,(uint16)tag_in,(uint16)ref_in))==FAIL) 
+    {
+        printf( "Failed to get annotations for <%s>\n", path);
+        return -1;
+    }
+    
+    for (i = 0; i < n_anno; i++) 
+    {
+        if((ann_id = ANselect(an_id,i,type))==FAIL) 
+        {
+            printf( "Failed to select AN %ld of <%s>\n", i, path);
+            continue;
+        }
+        
+        if(ANendaccess(ann_id)==FAIL)
+        {
+            printf( "Failed to end AN %ld of <%s>\n", i, path);
+            continue;
+        }
+        
+    }
+    
+    /* Terminate access to the AN interface */
+    ANend (an_id);
+    
+    return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_an
+ *
+ * Purpose: insert DATA ANs (AN_DATA_LABEL and AN_DATA_DESC)
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int insert_an(int32 file_id,
+              int32 ref_in, 
+              int32 tag_in,
+              char *path) 
+{
+    
+    insert_an_data(file_id,ref_in,tag_in,AN_DATA_LABEL,path);
+    insert_an_data(file_id,ref_in,tag_in,AN_DATA_DESC,path);
+    
+    return 0;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_sds
+ *
+ * Purpose: insert an SDS into file object list
+ *
+ * Return: 0, -1 for error 
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 22, 2003
+ *
+ * Modifications: pvn. July the 13 (Friday), 2007
+ *  Add support for lone dimensions 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int  insert_sds(int32 file_id,
+                int32 sd_id,
+                int32 tag,            /* tag of input SDS */
+                int32 ref,            /* ref of input SDS */
+                char *path_name,      /* absolute path for input group name */
+                dtable_t *table,      /* all objects table */
+                diff_dim_table_t *td1,     /* dimension table 1 */
+                diff_dim_table_t *td2)     /* dimension table 2 */
+{
+    int32 sds_id,                /* data set identifier */
+          sds_index,             /* index number of the data set */
+          dtype,                 /* SDS data type */
+          dimsizes[H4_MAX_VAR_DIMS],/* dimensional size of SDS */
+          nattrs,                /* number of SDS attributes */
+          rank,                  /* rank of SDS */
+          dim_size,              /* dimension size */
+          dim_id;                /* dimension ID */
+    char  sds_name[H4_MAX_NC_NAME]; 
+    char  dim_name[H4_MAX_NC_NAME];
+    char  *path=NULL;
+    int   i;
+    
+    sds_index = SDreftoindex(sd_id,ref);
+    sds_id    = SDselect(sd_id,sds_index);
+    
+    /*obtain name,rank,dimsizes,datatype and num of attributes of sds */
+    SDgetinfo(sds_id,sds_name,&rank,dimsizes,&dtype,&nattrs);
+    
+    /* check if the given SDS is a dimension scale, return 0 for no table add */
+    if ( SDiscoordvar(sds_id) ) 
+    {
+           
+        /* add SDS coordinate variable to dimension table 1 */
+        diff_dim_table_add(td1,ref,sds_name);
+        SDendaccess(sds_id);
+           
+        return 0;
+    }
+    
+    /* initialize path */
+    path=get_path(path_name,sds_name);
+    
+    /* add object to table */
+    dtable_add(table,tag,ref,path);
+     
+   /*-------------------------------------------------------------------------
+    * insert attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    insert_sds_attrs(sds_id,nattrs);
+    
+   /*-------------------------------------------------------------------------
+    * dimension scales
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* loop through each dimension up to rank of SDS */
+    for (i = 0; i < rank; i++) 
+    {
+        /* get dimension handle for input dimension */
+        if ((dim_id = SDgetdimid(sds_id, i)) == FAIL) 
+        {
+            printf( "Failed to get dimension %d of SDS <%s>\n", i, path);
+            continue;
+        }
+        /* get dimension information for input dimension */
+        if (SDdiminfo(dim_id, dim_name, &dim_size, &dtype, &nattrs) == FAIL) 
+        {
+            printf( "Failed to get info for dimension %d of SDS <%s>\n", i, path);
+            continue;
+        }
+        /* attributes */
+        if (nattrs && insert_sds_attrs(dim_id, nattrs) == FAIL) 
+        {
+            printf( "Failed to copy attributes for dimension %d of of SDS <%s>\n", i, path);
+            continue;
+        }
+        
+        /* add dimension name to dimension scales table 2 */
+        diff_dim_table_add(td2,-1,dim_name);
+        
+    }
+    
+   /*-------------------------------------------------------------------------
+    * insert ANs
+    *-------------------------------------------------------------------------
+    */ 
+    
+    insert_an(file_id,ref,tag,path);
+    
+   /*-------------------------------------------------------------------------
+    * terminate access to the SDSs
+    *-------------------------------------------------------------------------
+    */ 
+    
+    SDendaccess(sds_id);
+    
+    if (path)
+        free(path);
+    
+    return 0;
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_sds_attrs
+ *
+ * Purpose: insert SDS attributes 
+ *   used for global, dataset and dimension attributes
+ *
+ *-------------------------------------------------------------------------
+ */
+
+ int insert_sds_attrs(int32 id_in,
+                      int32 nattrs)
+ {
+     int32 dtype,                 /* SDS data type */
+           nelms;                 /* number of elements */
+     char  attr_name[H4_MAX_NC_NAME];
+     int   i;
+     
+     /* loop through attributes in input SDS */
+     for (i = 0; i < nattrs; i++) 
+     {
+         if (SDattrinfo (id_in, i, attr_name, &dtype, &nelms) == FAIL) {
+             printf( "Cannot get info for attribute number %d\n", i);
+             continue;
+         }
+         
+     }
+     
+     return 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * Function: insert_gr_attrs
+ *
+ * Purpose: insert GR attributes 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int insert_gr_attrs(int32 ri_id,
+                    int32 nattrs)
+{
+    int32 dtype,                 /* SDS data type */
+          nelms;                 /* number of elements */
+    char  attr_name[H4_MAX_NC_NAME];
+    int   i;
+    
+    /* loop through attributes in input GR */
+    for (i = 0; i < nattrs; i++) 
+    {
+        if (GRattrinfo (ri_id, i, attr_name, &dtype, &nelms) == FAIL) {
+            printf( "Cannot get info for attribute number %d\n", i);
+            continue;
+        }
+        
+    }
+    
+    return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: insert_vs_attrs
+ *
+ * Purpose: insert VS attributes 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int insert_vs_attrs(int32 in, int32 findex, intn attrindex)
+{
+    char	attr_name[H4_MAX_NC_NAME];
+    int32	n_values, attr_size, attr_type;
+    
+    /* Get attribute information */
+    VSattrinfo(in, findex, attrindex, attr_name, &attr_type, &n_values, &attr_size);
+    
+    return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_gr
+ *
+ * Purpose: insert a GR 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int  insert_gr(int32 file_id,
+               int32 gr_in,
+               int32 tag,               /* tag of input GR */
+               int32 ref,               /* ref of input GR */
+               char*path_name,          /* absolute path for input group name */
+               dtable_t *table)
+{
+    int32         ri_id,         /* raster image identifier */
+                  ri_index,      /* index of a image */
+                  dimsizes[2],   /* dimensions of an image */
+                  n_comps,       /* number of components an image contains */
+                  interlace_mode,/* interlace mode of an image */ 
+                  dtype,         /* number type of an image */
+                  n_attrs;       /* number of attributes belong to an image */
+    
+    int32         pal_id,        /* palette identifier */
+                  r_num_entries, 
+                  r_data_type, 
+                  r_ncomp, 
+                  r_interlace_mode; 
+    char          gr_name[H4_MAX_GR_NAME]; 
+    char          *path=NULL;
+    int           has_pal = 0;
+    
+    ri_index = GRreftoindex(gr_in,(uint16)ref);
+    ri_id    = GRselect(gr_in,ri_index);
+    
+    GRgetiminfo(ri_id,gr_name,&n_comps,&dtype,&interlace_mode,dimsizes,&n_attrs);
+    
+    /* initialize path */
+    path=get_path(path_name,gr_name);
+    
+    /* add object to table */
+    dtable_add(table,tag,ref,path);
+
+   /*-------------------------------------------------------------------------
+    * insert attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    insert_gr_attrs(ri_id,n_attrs);
+    
+   /*-------------------------------------------------------------------------
+    * check for palette
+    *-------------------------------------------------------------------------
+    */ 
+    
+    pal_id = GRgetlutid(ri_id, 0);
+    GRgetlutinfo(pal_id,&r_ncomp,&r_data_type,&r_interlace_mode,&r_num_entries);
+    
+    /*check if there is palette data */
+    has_pal=((r_ncomp == 0) || (r_interlace_mode < 0) || (r_num_entries == 0))?0:1;
+    
+    if ( has_pal==1 )
+    {
+        
+    } /* has_pal==1 */
+    
+    
+   /*-------------------------------------------------------------------------
+    * insert ANs
+    *-------------------------------------------------------------------------
+    */ 
+    
+    insert_an(file_id,ref,DFTAG_RIG,path);
+    insert_an(file_id,ref,DFTAG_RI,path);
+    
+   /*-------------------------------------------------------------------------
+    * terminate access to the GR
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* terminate access to the GRs */
+    GRendaccess(ri_id);
+    
+    if (path)
+        free(path);
+    
+    return 0;
+    
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: insert_vs
+ *
+ * Purpose: insert a VS 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int  insert_vs( int32 file_id,
+                int32 ref,               /* ref of input VS */
+                char*path_name,          /* absolute path for input group name */
+                dtable_t *table,
+                int is_lone)
+{
+    int32 vdata_id,              /* vdata identifier */
+          tag_vs,
+          ref_vs;
+    int   n_fields, n_attrs;
+    char  vdata_name [VSNAMELENMAX], vdata_class[VSNAMELENMAX];
+    char  *path=NULL;
+    int   i, j, ret=1;
+    
+   /*-------------------------------------------------------------------------
+    * attach the vdata, gets its name and class
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if ((vdata_id  = VSattach (file_id, ref, "r")) == FAIL )
+    {
+        printf( "Failed to attach vdata ref %ld\n", ref);
+        return-1;
+    }
+
+    if (VSgetname  (vdata_id, vdata_name) == FAIL )
+    {
+        printf( "Failed to name for vdata ref %ld\n", ref);
+        return-1;
+    }
+
+    if (VSgetclass (vdata_id, vdata_class) == FAIL )
+    {
+        printf( "Failed to name for vdata ref %ld\n", ref);
+        return-1;
+    }
+    
+    /* ignore reserved HDF groups/vdatas; they are lone ones */
+    if( is_lone==1 && vdata_class != NULL) 
+    {
+        if( is_reserved(vdata_class))
+        {
+            if (VSdetach (vdata_id) == FAIL )
+                printf( "Failed to detach vdata <%s>\n", path_name);
+            return 0;
+        }
+    }
+    
+    
+    if ((ref_vs = VSQueryref(vdata_id))==FAIL)
+    {
+        printf( "Failed to get ref for <%s>\n", vdata_name);
+    }
+    if ((tag_vs = VSQuerytag(vdata_id))==FAIL)
+    {
+        printf( "Failed to get tag for <%s>\n", vdata_name);
+    }
+    
+    
+    /* initialize path */
+    path=get_path(path_name,vdata_name);
+    
+    /* add object to table */
+    dtable_add(table,tag_vs,ref_vs,path);
+    
+   /*-------------------------------------------------------------------------
+    * fields 
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if ((n_fields = VFnfields(vdata_id)) == FAIL )
+    {
+        printf( "Failed getting fields for VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * insert attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if ((n_attrs = VSfnattrs( vdata_id, -1 )) == FAIL )
+    {
+        printf( "Failed getting attributes for VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+  
+    for (i = 0; i < n_attrs; i++) 
+    {
+        insert_vs_attrs(vdata_id, -1, i);
+    }
+    
+   /*-------------------------------------------------------------------------
+    * insert field attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    for (i = 0; i < n_fields; i++) 
+    {
+        if ((n_attrs = VSfnattrs(vdata_id, i)) == FAIL )
+        {
+            printf( "Failed getting fields for VS <%s>\n", path);
+            ret=-1;
+            goto out;
+        }
+        for (j = 0; j < n_attrs; j++) 
+        {
+            insert_vs_attrs(vdata_id, i, j);
+        }
+    }
+    
+    
+   /*-------------------------------------------------------------------------
+    * insert ANs
+    *-------------------------------------------------------------------------
+    */ 
+    
+    insert_vs_an(file_id,vdata_id,path);
+    
+    /*-------------------------------------------------------------------------
+    * terminate access to the VSs
+    *-------------------------------------------------------------------------
+    */ 
+    
+out:
+    VSdetach (vdata_id);
+    
+    if (path)
+        free(path);
+    
+    return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: is_reserved
+ *
+ * Purpose: check for reserved Vgroup/Vdata class/names
+ *
+ * Return: 1 if reserved, 0 if not
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int is_reserved(char*vg_class)
+{
+    int ret=0;
+    
+    /* ignore reserved HDF groups/vdatas */
+    if(vg_class != NULL) 
+    {
+        if( (strcmp(vg_class,_HDF_ATTRIBUTE)==0) ||
+            (strcmp(vg_class,_HDF_VARIABLE) ==0) || 
+            (strcmp(vg_class,_HDF_DIMENSION)==0) ||
+            (strcmp(vg_class,_HDF_UDIMENSION)==0) ||
+            (strcmp(vg_class,DIM_VALS)==0) ||
+            (strcmp(vg_class,DIM_VALS01)==0) ||
+            (strcmp(vg_class,_HDF_CDF)==0) ||
+            (strcmp(vg_class,GR_NAME)==0) ||
+            (strcmp(vg_class,RI_NAME)==0) || 
+            (strcmp(vg_class,RIGATTRNAME)==0) ||
+            (strcmp(vg_class,RIGATTRCLASS)==0) ){
+            ret=1;
+        }
+        
+        /* class and name(partial) for chunk table i.e. Vdata */
+        if( (strncmp(vg_class,"_HDF_CHK_TBL_",13)==0))
+        {
+            ret=1;
+        }
+        
+    }
+    
+    return ret;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_path
+ *
+ * Purpose: return absolute path for an object
+ *
+ * Return: path
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+char *get_path(char*path_name, 
+               char*obj_name) 
+{
+    char *path=NULL;
+    /* initialize path */
+    if (path_name!=NULL) 
+    {
+        path = (char*) malloc(strlen(path_name) + strlen(obj_name) + 2);
+        strcpy( path, path_name );
+        strcat( path, "/" );
+        strcat( path, obj_name ); 
+    }
+    else
+    {
+        path = (char*) malloc(strlen(obj_name) + 1);
+        strcpy( path, obj_name ); 
+    }
+    return path;
+}
+
+
diff --git a/mfhdf/hdiff/hdiff_list.h b/mfhdf/hdiff/hdiff_list.h
new file mode 100644
index 0000000..ef462ed
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_list.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+
+#ifndef HDF_HDIFF_LIST__
+#define HDF_HDIFF_LIST__
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hdiff_table.h"
+#include "hdiff_dim.h"
+
+
+/* get the list of HDF objects in the file */
+
+
+uint32 hdiff_list (const char* fname, 
+                   dtable_t *table, 
+                   diff_dim_table_t *td1,
+                   diff_dim_table_t *td2,
+                   int *err);
+
+
+int hdiff_list_vg(const char* fname,
+                  int32 file_id,
+                  int32 sd_id,             /* SD interface identifier */
+                  int32 gr_id,             /* GR interface identifier */
+                  dtable_t *table,         /* all objects table */
+                  diff_dim_table_t *td1,        /* dimension table 1 */
+                  diff_dim_table_t *td2)        /* dimension table 2 */;
+
+
+
+int hdiff_list_gr (int32 file_id,int32 gr_id,dtable_t *table);
+
+int hdiff_list_sds(int32 file_id,
+                   int32 sd_id,                  /* SD interface identifier */
+                   dtable_t *table,              /* all objects table */
+                   diff_dim_table_t *td1,             /* dimension table 1 */
+                   diff_dim_table_t *td2)             /* dimension table 2 */;
+
+
+
+int hdiff_list_vs (int32 file_id,dtable_t *table);
+int hdiff_list_glb(int32 sd_id,int32 gr_id);
+int hdiff_list_an (int32 file_id);
+
+
+int insert_vg_attrs(int32 vgroup_id,char *path);
+int insert_vg_an(int32 file_id,int32 vgroup_id,char *path);
+
+
+int insert_vg(const char* fname,
+              int32 file_id,
+              int32 sd_id,             /* SD interface identifier */
+              int32 gr_id,             /* GR interface identifier */
+              char*path_name,          /* absolute path for input group name */          
+              int32* in_tags,          /* tag list for parent group */
+              int32* in_refs,          /* ref list for parent group */
+              int npairs,              /* number tag/ref pairs for parent group */
+              dtable_t *table,         /* all objects table */
+              diff_dim_table_t *td1,        /* dimension table 1 */
+              diff_dim_table_t *td2)        /* dimension table 2 */;
+
+int  insert_sds(int32 file_id,
+                int32 sd_id,
+                int32 tag,            /* tag of input SDS */
+                int32 ref,            /* ref of input SDS */
+                char *path_name,      /* absolute path for input group name */
+                dtable_t *table,      /* all objects table */
+                diff_dim_table_t *td1,     /* dimension table 1 */
+                diff_dim_table_t *td2)     /* dimension table 2 */;
+
+int  insert_gr(int32 file_id,
+               int32 gr_in,
+               int32 tag,               /* tag of input GR */
+               int32 ref,               /* ref of input GR */
+               char*path_name,          /* absolute path for input group name */
+               dtable_t *table);
+
+int  insert_vs( int32 file_id,
+                int32 ref,               /* ref of input VS */
+                char*path_name,          /* absolute path for input group name */
+                dtable_t *table,
+                int is_lone);
+
+
+int insert_sds_attrs(int32 sds_id,
+                     int32 nattrs);
+
+int insert_gr_attrs(int32 ri_id,
+                    int32 nattrs);
+
+
+int insert_an(int32 file_id,
+              int32 ref_in, 
+              int32 tag_in,
+              char *path);
+
+int insert_vs_an(int32 file_id,
+                 int32 vdata_id,
+                 char *path);
+
+int  insert_vs_attrs(int32 in, int32 findex, intn attrindex);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* HDF_HDIFF_LIST__ */
diff --git a/mfhdf/hdiff/hdiff_main.c b/mfhdf/hdiff/hdiff_main.c
new file mode 100644
index 0000000..871eed0
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_main.c
@@ -0,0 +1,181 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "hdf.h"
+#include "hfile.h"
+#include "mfhdf.h"
+#include "hdiff.h"
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: hdiff main program
+ *
+ * Programmer: Pedro Vicente Nunes, pvn at ncsa.uiuc.edu
+ *
+ * Date:  August 27, 2003
+ *  Modifications: 
+ *  March 8, 2006. Added percent (relative) option
+ *
+ * Comments:
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+char *progname;
+
+ 
+static void usage()
+{
+
+ (void) fprintf(stdout,
+  "hdiff [-V] [-b] [-g] [-s] [-d] [-D] [-S] [-v var1[,...]] [-u var1[,...]] [-e count] [-t limit] [-p relative] file1 file2\n");
+ fprintf(stdout,"  [-V]              Display version of the HDF4 library and exit\n");
+ fprintf(stdout,"  [-b]              Verbose mode\n");
+ fprintf(stdout,"  [-g]              Compare global attributes only\n");
+ fprintf(stdout,"  [-s]              Compare SD local attributes only\n");
+ fprintf(stdout,"  [-d]              Compare SD data only\n");
+ fprintf(stdout,"  [-D]              Compare Vdata data only\n");
+ fprintf(stdout,"  [-S]              Print statistics\n");
+ fprintf(stdout,"  [-v var1[,...]]   Compare SD data on variable(s) <var1>,... only\n");
+ fprintf(stdout,"  [-u var1[,...]]   Compare vdata on variable(s) <var1>,... only\n");
+ fprintf(stdout,"  [-e count]        Print difference up to count number for each variable\n");
+ fprintf(stdout,"  [-t limit]        Print difference when it is greater than limit\n");
+ fprintf(stdout,"  [-p relative]     Print difference when it is greater than a relative limit\n");
+ fprintf(stdout,"  file1             File name of the first HDF file\n");
+ fprintf(stdout,"  file2             File name of the second HDF file\n");
+ fprintf(stdout,"\n");
+ fprintf(stdout,"The 'count' value must be a positive integer\n");
+ fprintf(stdout,"The 'limit' and 'relative' values must be positive numbers\n");
+ fprintf(stdout,"The -t compare criteria is |a - b| > limit\n");
+ fprintf(stdout,"The -p compare criteria is |(b-a)/a| > relative\n");
+ fprintf(stdout,"Return codes: 0 (no differences found), 1 (differences found)\n");
+ exit(EXIT_FAILURE);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+    extern int optind;
+    extern int opterr;
+    extern char *optarg;
+ 
+    static diff_opt_t opt = /* defaults, overridden on command line */
+    {
+            0,    /* verbose mode */
+            1,    /* compare global attributes */
+            1,    /* compare SD local attributes */
+            1,    /* compare SD data */
+            1,    /* compare GR data */
+            1,    /* compare Vdata */
+            MAX_DIFF,   /* no limit on the difference to be printed */
+            0.0,  /* exact equal */
+            0,    /* if -v specified, number of variables */
+            0,    /* if -v specified, list of variable names */
+            0,    /* if -u specified, number of variables */
+            0,    /* if -u specified, list of variable names */
+            0,    /* if -S specified print statistics */
+            0,    /* -p err_rel */
+            0,    /* error status */
+    };
+    int    c;
+    uint32 nfound;
+    int    ret;
+    
+    opterr = 1;
+    progname = argv[0];
+    
+    if (argc < 2)
+        usage();
+    
+    while ((c = getopt(argc, argv, "VbgsdSDe:t:v:u:p:")) != EOF)
+    {
+        switch(c) 
+        {
+        case 'V':  /* display version of the library */
+            printf("%s, %s\n\n", argv[0], LIBVER_STRING ); 
+            exit(0);
+        case 'b':  /* verbose mode */
+            opt.verbose =1;
+            break;
+        case 'g':  /* global attributes only */
+            opt.ga = 1;
+            opt.sa = 0;
+            opt.sd = 0;
+            opt.vd = 0;
+            break;
+        case 's':  /* SD local attributes only */
+            opt.ga = 0;
+            opt.sa = 1;
+            opt.sd = 0;
+            opt.vd = 0;
+            break;
+        case 'd':  /* SD data only */
+            opt.ga = 0;
+            opt.sa = 0;
+            opt.sd = 1;
+            opt.vd = 0;
+            break;
+        case 'D':  /* SD data only */
+            opt.ga = 0;
+            opt.sa = 0;
+            opt.sd = 0;
+            opt.vd = 1;
+            break;
+        case 'e':  /* max no. of difference to be printed */
+            opt.max_err_cnt = atoi(optarg);
+            break;
+        case 't':  /* range of difference to be printed */
+            opt.err_limit = (float32)atof(optarg);
+            break;
+        case 'v':  /* variable names */
+            /* make list of names of variables specified */
+            make_vars (optarg, &opt, 1);
+            break;
+        case 'u':  /* variable names */
+            /* make list of names of variables specified */
+            make_vars (optarg, &opt, 2);
+            break;
+        case 'S':
+            opt.statistics = 1;
+            break;
+        case 'p':
+            opt.err_rel = (float32)atof(optarg);
+            break;
+       }
+    }
+    
+    argv = argv + optind;
+    
+    nfound = hdiff(argv[0],argv[1],&opt);
+    
+   /*-------------------------------------------------------------------------
+    * exit code
+    *   >0 if differences, 0 if no differences, <0 if error
+    *-------------------------------------------------------------------------
+    */
+    
+    ret= (nfound==0 ? 0 : 1 );
+    if (opt.err_stat)
+        ret=-1;
+    return ret;
+    
+}
diff --git a/mfhdf/hdiff/hdiff_mattbl.c b/mfhdf/hdiff/hdiff_mattbl.c
new file mode 100644
index 0000000..c12abe3
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_mattbl.c
@@ -0,0 +1,127 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "hdiff_mattbl.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: match_table_add
+ *
+ * Purpose: mark object is in file;
+ *  flag[0] = file1
+ *  flag[1] = file2
+ *  object exists in file = flag = 1
+ *  does not exist        = flag = 0
+ * the key is <path, tag, ref >
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 25, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void match_table_add (match_table_t *table, 
+                      unsigned *flags, 
+                      char* path, 
+                      int32 tag1, 
+                      int32 ref1,
+                      int32 tag2, 
+                      int32 ref2 )
+{
+    uint32 i;
+    
+    if (table->nobjs == table->size) {
+        table->size *= 2;
+        table->objs = (match_info_t*)realloc(table->objs, table->size * sizeof(match_info_t));
+        
+        for (i = table->nobjs; i < table->size; i++) {
+            table->objs[i].tag1 = table->objs[i].ref1 = -1;
+            table->objs[i].tag2 = table->objs[i].ref2 = -1;
+            table->objs[i].flags[0] = table->objs[i].flags[1] = -1;
+        }
+    }
+    
+    i = table->nobjs++;
+    table->objs[i].tag1 = tag1;
+    table->objs[i].ref1 = ref1;
+    table->objs[i].tag2 = tag2;
+    table->objs[i].ref2 = ref2;
+    strcpy(table->objs[i].obj_name,path);
+    table->objs[i].flags[0] = flags[0];
+    table->objs[i].flags[1] = flags[1];
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: match_table_init
+ *
+ * Purpose: initialize table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void match_table_init( match_table_t **tbl )
+{
+    uint32 i;
+    match_table_t* table = (match_table_t*) malloc(sizeof(match_table_t));
+    
+    table->size = 20;
+    table->nobjs = 0;
+    table->objs = (match_info_t*) malloc(table->size * sizeof(match_info_t));
+    
+    for (i = 0; i < table->size; i++) {
+        table->objs[i].tag1 = table->objs[i].ref1 = -1;
+        table->objs[i].tag2 = table->objs[i].ref2 = -1;
+        table->objs[i].flags[0] = table->objs[i].flags[1] = -1;
+    }
+    
+    *tbl = table;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: match_table_free
+ *
+ * Purpose: free table memory
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void match_table_free( match_table_t *table )
+{
+    free(table->objs);
+    free(table);
+}
+
+
+
diff --git a/mfhdf/hdiff/hdiff_mattbl.h b/mfhdf/hdiff/hdiff_mattbl.h
new file mode 100644
index 0000000..4431acb
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_mattbl.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+
+#ifndef HDF_HDIFF_MATCH_TABLE__
+#define HDF_HDIFF_MATCH_TABLE__
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* match objects in 2 HDF files */ 
+typedef struct match_info_t {
+ int32   tag1;
+ int32   ref1;
+ int32   tag2;
+ int32   ref2;
+ char    obj_name[H4_MAX_NC_NAME];      /* same name for file1 and 2 */
+ int     flags[2];                   /* object exists in file=1, no=0 */  
+} match_info_t;
+
+/* table to store the match info */
+typedef struct match_table_t {
+ uint32       size;
+ uint32       nobjs;
+ match_info_t *objs;
+} match_table_t;
+
+
+/* table methods */
+void match_table_init(match_table_t **table);
+void match_table_free(match_table_t *table);
+void match_table_add (match_table_t *table, 
+                      unsigned *flags, 
+                      char* path, 
+                      int32 tag1, 
+                      int32 ref1,
+                      int32 tag2, 
+                      int32 ref2 );
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* HDF_HDIFF_MATCH_TABLE__ */
diff --git a/mfhdf/hdiff/hdiff_misc.c b/mfhdf/hdiff/hdiff_misc.c
new file mode 100644
index 0000000..dbb5967
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_misc.c
@@ -0,0 +1,277 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+
+#include "hdiff.h"
+
+/* 
+* convert pathname of netcdf file into name for cdl unit, by taking 
+* last component of path and stripping off any extension.
+*/
+char *
+name_path(char *path)
+{
+ char *cp, *newc;
+ 
+#ifdef MSDOS
+#define FILE_DELIMITER '\\'
+#endif    
+#ifndef FILE_DELIMITER /* default to unix */
+#define FILE_DELIMITER '/'
+#endif
+ cp = strrchr(path, FILE_DELIMITER);
+ if (cp == 0)  /* no delimiter */
+  cp = path;
+ else   /* skip delimeter */
+  cp++;
+ newc = (char *) malloc((unsigned) (strlen(cp)+1));
+ if (newc == 0) {
+  fprintf(stderr,"Out of memory!\n");
+  exit(EXIT_FAILURE);
+ }
+ (void) strcpy(newc, cp); /* copy last component of path */
+ if ((cp = strrchr(newc, '.')) != NULL)
+  *cp = '\0';  /* strip off any extension */
+ return newc;
+}
+
+
+const char *
+type_name(nc_type type)
+{
+ switch (type) {
+ case DFNT_INT8:
+  return "byte";
+ case DFNT_CHAR:
+  return "char";
+ case DFNT_INT16:
+  return "short";
+ case DFNT_INT32:
+  return "long";
+ case DFNT_FLOAT:
+  return "float";
+ case DFNT_DOUBLE:
+  return "double";
+ default:
+  fprintf(stderr,"type_name: bad type %d", type);
+  return "bogus";
+ }
+}
+
+/*
+* Remove trailing zeros (after decimal point) but not trailing decimal
+* point from ss, a string representation of a floating-point number that
+* might include an exponent part.
+*/
+void
+tztrim(char *ss)
+  /* returned string representing dd */
+{
+ char *cp, *ep;
+ 
+ cp = ss;
+ if (*cp == '-')
+  cp++;
+ while(isdigit((int)*cp) || *cp == '.')
+  cp++;
+ if (*--cp == '.')
+  return;
+ ep = cp+1;
+ while (*cp == '0')
+  cp--;
+ cp++;
+ if (cp == ep)
+  return;
+ while (*ep)
+  *cp++ = *ep++;
+ *cp = '\0';
+ return;
+}
+
+
+/*
+* Print list of attribute values.  Attribute values must be printed with
+* explicit type tags, because their types are not declared.
+*/
+void
+pr_att_vals(nc_type type, int len, void *vals)
+{
+ int iel;
+ union {
+  char *cp;
+  int16 *sp;
+  int32 *lp;
+  float32 *fp;
+  float64 *dp;
+ } gp;
+ char *sp;
+ unsigned char uc;
+ char gps[30];  /* for ascii of a float or double precision */
+ char *f_fmt = "%#.8g";
+ char *d_fmt = "%#.16g";
+ 
+ switch (type) {
+ case DFNT_INT8:
+  gp.cp = (char *) vals;
+  for (iel = 0; iel < len; iel++)
+   if (isprint(uc = *gp.cp++ & 0377))
+    Printf ("'%c'%s", uc, iel<len-1 ? ", " : "");
+   else
+    Printf ("'\\%o'%s", uc, iel<len-1 ? ", " : "");
+   break;
+ case DFNT_CHAR:
+  gp.cp = (char *) vals;
+  Printf ("\"");
+  /* adjust len so trailing nulls don't get printed */
+  sp = gp.cp + len - 1;
+  while (*sp-- == '\0' && len > 0)
+   len--;
+  for (iel = 0; iel < len; iel++)
+   switch (uc = *gp.cp++ & 0377) {
+ case '\b':
+  Printf ("\\b");
+  break;
+ case '\f':
+  Printf ("\\f");
+  break;
+ case '\n':  /* generate linebreaks after new-lines */
+  Printf ("\\n\",\n    \"");
+  break;
+ case '\r':
+  Printf ("\\r");
+  break;
+ case '\t':
+  Printf ("\\t");
+  break;
+ case '\v':
+  Printf ("\\v");
+  break;
+ case '\\':
+  Printf ("\\\\");
+  break;
+ case '\'':
+  Printf ("\\'");
+  break;
+ case '\"':
+  Printf ("\\\"");
+  break;
+ default:
+  Printf ("%c",uc);
+  break;
+  }
+  Printf ("\"");
+  break;
+ case DFNT_INT16:
+  gp.sp = (int16 *) vals;
+  for (iel = 0; iel < len; iel++)
+   Printf ("%ds%s",*gp.sp++,iel<len-1 ? ", " : "");
+  break;
+ case DFNT_INT32:
+  gp.lp = (int32 *) vals;
+  for (iel = 0; iel < len; iel++)
+   Printf ("%ld%s",*gp.lp++,iel<len-1 ? ", " : "");
+  break;
+ case DFNT_FLOAT:
+  gp.fp = (float32 *) vals;
+  for (iel = 0; iel < len; iel++) {
+   int ll;
+   (void) sprintf(gps, f_fmt, * gp.fp++);
+   /* append a trailing "f" for floating-point attributes */
+   ll = strlen(gps);
+   gps[ll + 1] = '\0';
+   gps[ll] = 'f';
+   tztrim(gps); /* trim trailing 0's after '.' */
+   Printf ("%s%s", gps, iel<len-1 ? ", " : "");
+  }
+  break;
+ case DFNT_DOUBLE:
+  gp.dp = (float64 *) vals;
+  for (iel = 0; iel < len; iel++) {
+   (void) sprintf(gps, d_fmt, *gp.dp++);
+   tztrim(gps); /* trim trailing 0's after '.' */
+   Printf ("%s%s", gps, iel<len-1 ? ", " : "");
+  }
+  break;
+ default:
+  fprintf(stderr,"pr_att_vals: bad type - %d", type);
+ }
+}
+
+
+
+void
+make_vars(char *optarg, diff_opt_t *opt, int option)
+{
+ char *cp = optarg;
+ int nvars = 1;
+ char ** cpp;
+ 
+ /* compute number of variable names in comma-delimited list */
+ if (option == 1)
+  opt->nlvars = 1;
+ else
+  opt->nuvars = 1;
+ 
+ while (*cp++)
+  if (*cp == ',')
+   nvars++;
+  
+  if (option == 1)
+  {
+   opt->lvars = (char **) malloc(nvars * sizeof(char*));
+   if (!opt->lvars) {
+    fprintf(stderr,"Out of memory!\n");
+    exit(EXIT_FAILURE);
+   }
+   cpp = opt->lvars;
+  }
+  else
+  {
+   opt->uvars = (char **) malloc(nvars * sizeof(char*));
+   if (!opt->uvars) {
+    fprintf(stderr,"Out of memory!\n");
+    exit(EXIT_FAILURE);
+   }
+   cpp = opt->uvars;
+  }
+  
+  /* copy variable names into list */
+  for (cp = strtok(optarg, ",");
+  cp != NULL;
+  cp = strtok((char *) NULL, ",")) {
+   
+   *cpp = (char *) malloc(strlen(cp) + 1);
+   if (!*cpp) {
+    fprintf(stderr,"Out of memory!\n");
+    exit(EXIT_FAILURE);
+   }
+   strcpy(*cpp, cp);
+   cpp++;
+  }
+  if (option == 1)
+   opt->nlvars = nvars;
+  else
+   opt->nuvars = nvars;
+}
+
diff --git a/mfhdf/hdiff/hdiff_sds.c b/mfhdf/hdiff/hdiff_sds.c
new file mode 100644
index 0000000..fb6acda
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_sds.c
@@ -0,0 +1,629 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <assert.h>
+#include "hdiff.h"
+#include "hdiff_list.h"
+#include "hdiff_mattbl.h"
+
+#define H4TOOLS_BUFSIZE    (1024 * 1024)
+#define H4TOOLS_MALLOCSIZE (1024 * 1024)
+
+
+
+static
+uint32 diff_sds_attrs(int32 sds1_id,
+                      int32 nattrs1,
+                      int32 sds2_id,
+                      int32 nattrs2,
+                      char* sds1_name,
+                      diff_opt_t * opt);
+
+/*-------------------------------------------------------------------------
+ * Function: diff_sds
+ *
+ * Purpose: diff for SDS
+ *
+ * Return: Number of differences found
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 25, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+uint32 diff_sds(int32 sd1_id,              
+                int32 sd2_id,
+                int32 ref1,
+                int32 ref2,
+                diff_opt_t * opt)
+{
+ int32 sds1_id=-1,             /* data set identifier */
+       sds1_index,             /* index number of the data set */
+       dtype1,                 /* SDS data type */
+       dimsizes1[H4_MAX_VAR_DIMS],/* dimensional size of SDS */
+       nattrs1,                /* number of SDS attributes */
+       rank1,                  /* rank of SDS */
+       sds2_id=-1,             /* data set identifier */
+       sds2_index,             /* index number of the data set */
+       dtype2,                 /* SDS data type */
+       dimsizes2[H4_MAX_VAR_DIMS],/* dimensional size of SDS */
+       nattrs2,                /* number of SDS attributes */
+       rank2,                  /* rank of SDS */
+       start[H4_MAX_VAR_DIMS],    /* read start */
+       edges[H4_MAX_VAR_DIMS],    /* read edges */
+       numtype,                /* number type */
+       eltsz;                  /* element size */
+ uint32 nelms;                 /* number of elements */
+ size_t need;	               /* read size needed */
+ char  sds1_name[H4_MAX_NC_NAME]; 
+ char  sds2_name[H4_MAX_NC_NAME]; 
+ int   dim_diff=0;             /* dimensions are different */
+ intn  empty1_sds;
+ intn  empty2_sds;
+ VOIDP buf1=NULL;
+ VOIDP buf2=NULL;
+ uint32 max_err_cnt;
+ int   i;
+ VOIDP fill1=NULL;
+ VOIDP fill2=NULL;
+ uint32 nfound=0;
+ void   *sm_buf1=NULL;                
+ void   *sm_buf2=NULL;
+
+
+/*-------------------------------------------------------------------------
+ * object 1
+ *-------------------------------------------------------------------------
+ */
+  
+ sds1_index = SDreftoindex(sd1_id,ref1);
+ sds1_id    = SDselect(sd1_id,sds1_index);
+ 
+ /*obtain name,rank,dimsizes,datatype and num of attributes of sds */
+ if (SDgetinfo(sds1_id,sds1_name,&rank1,dimsizes1,&dtype1,&nattrs1)==FAIL) {
+   printf( "Failed to get info for SDS ref <%ld>\n",ref1);
+   goto out;
+  }
+
+
+/*-------------------------------------------------------------------------
+ * object 2
+ *-------------------------------------------------------------------------
+ */
+
+ sds2_index = SDreftoindex(sd2_id,ref2);
+ sds2_id    = SDselect(sd2_id,sds2_index);
+ 
+ /*obtain name,rank,dimsizes,datatype and num of attributes of sds */
+ if (SDgetinfo(sds2_id,sds2_name,&rank2,dimsizes2,&dtype2,&nattrs2)==FAIL) {
+   printf( "Failed to get info for SDS ref <%ld>\n",ref2);
+   goto out;
+  }
+
+
+ /* flag to compare SDSs */
+ if (opt->sd == 1)
+ {
+
+/*-------------------------------------------------------------------------
+ * check for input SDs
+ *-------------------------------------------------------------------------
+ */
+ 
+ if (opt->nlvars > 0)   /* if specified vdata is selected */
+ {
+  int imatch = 0, j;
+  for (j = 0; j < opt->nlvars; j++)
+  {
+   if (strcmp(sds1_name, opt->lvars[j]) == 0)
+   {
+    imatch = 1;
+    break;
+   }
+  }
+  if (imatch == 0)
+  {
+   goto do_nothing;
+  }
+ }  
+
+/*-------------------------------------------------------------------------
+ * check for different type
+ *-------------------------------------------------------------------------
+ */
+ 
+ if (dtype1 != dtype2) 
+ {
+  printf("Comparison not supported\n");
+  printf("<%s> has datatype %ld, <%s> has datatype %ld ",sds1_name,dtype1,sds2_name,dtype2);
+  goto do_nothing;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for the same rank
+ *-------------------------------------------------------------------------
+ */
+ 
+ if ( rank1 != rank2 )
+ {
+  printf("Comparison not supported\n");
+  printf("<%s> has rank %ld, dimensions ", sds1_name, rank1);
+  print_dims(rank1,dimsizes1);
+  printf("\n" );
+  printf("<%s> has rank %ld, dimensions ", sds2_name, rank2);
+  print_dims(rank2,dimsizes2);
+  goto do_nothing;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for different dimensions
+ *-------------------------------------------------------------------------
+ */
+ 
+ for ( i=0; i<rank1; i++) 
+ {
+  if ( dimsizes1[i] != dimsizes2[i] )
+   dim_diff=1;
+ }
+
+/*-------------------------------------------------------------------------
+ * dimensions
+ *-------------------------------------------------------------------------
+ */
+
+ if (dim_diff==1)
+ {
+  printf("Comparison not supported\n");
+  printf("<%s> has rank %ld, dimensions ", sds1_name, rank1);
+  print_dims(rank1,dimsizes1);
+  printf("\n" );
+  printf("<%s> has rank %ld, dimensions ", sds2_name, rank2);
+  print_dims(rank2,dimsizes2);
+  goto do_nothing;
+ }
+
+/*-------------------------------------------------------------------------
+ * check if the input SDSs are empty. if so , return 
+ *-------------------------------------------------------------------------
+ */ 
+ if (SDcheckempty( sds1_id, &empty1_sds ) == FAIL) {
+  printf( "Failed to check empty SDS <%s>\n", sds1_name);
+  goto out;
+ }
+ if (empty1_sds==1) 
+ {
+     if (opt->verbose)
+         printf( "Empty SDS <%s>\n", sds1_name);
+     goto do_nothing;
+ }
+
+ if (SDcheckempty( sds2_id, &empty2_sds ) == FAIL) {
+  printf( "Failed to check empty SDS <%s>\n", sds2_name);
+  goto out;
+ }
+ if (empty2_sds==1 ) 
+ {
+     if (opt->verbose)
+         printf( "Empty SDS <%s>\n", sds2_name);
+     goto do_nothing;
+ }
+
+
+/*-------------------------------------------------------------------------
+ * get size 
+ *-------------------------------------------------------------------------
+ */
+
+ /* compute the number of the bytes for each value. */
+ numtype = dtype1 & DFNT_MASK;
+ eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+
+/*-------------------------------------------------------------------------
+ * get fill values
+ *-------------------------------------------------------------------------
+ */
+
+ fill1 = (VOIDP) HDmalloc(eltsz);
+ fill2 = (VOIDP) HDmalloc(eltsz);
+ if (fill1!=NULL && SDgetfillvalue(sds1_id,fill1)<0)
+ {
+  HDfree(fill1);
+  fill1 = NULL;
+ }
+ if (fill2!=NULL && SDgetfillvalue(sds2_id,fill2)<0)
+ {
+  HDfree(fill2);
+  fill2 = NULL;
+ }
+
+
+/*-------------------------------------------------------------------------
+ * read
+ *-------------------------------------------------------------------------
+ */ 
+
+ nelms = 1;
+ for (i = 0; i < rank1; i++) 
+ {
+     nelms   *= dimsizes1[i];
+ }
+
+
+ need = (size_t)(nelms * eltsz); /* bytes needed */
+ 
+ if ( need < H4TOOLS_MALLOCSIZE)
+ {
+     buf1 = (VOIDP)HDmalloc(need);
+     buf2 = (VOIDP)HDmalloc(need);
+ }
+
+/*-------------------------------------------------------------------------
+ * read all
+ *-------------------------------------------------------------------------
+ */ 
+
+ if ( buf1!=NULL && buf2!=NULL)
+ {
+     
+     /* select all */
+     for (i = 0; i < rank1; i++) 
+     {
+         edges[i] = dimsizes1[i];
+         start[i] = 0;
+     }
+
+  
+     /* read */
+     if (SDreaddata (sds1_id, start, NULL, edges, buf1) == FAIL) 
+     {
+         printf( "Could not read SDS <%s>\n", sds1_name);
+         goto out;
+     }
+     /* read */
+     if (SDreaddata (sds2_id, start, NULL, edges, buf2) == FAIL) 
+     {
+         printf( "Could not read SDS <%s>\n", sds2_name);
+         goto out;
+     }
+
+    /*-------------------------------------------------------------------------
+     * comparing
+     *-------------------------------------------------------------------------
+     */
+     
+     if (opt->verbose)
+         printf("Comparing <%s>\n",sds1_name); 
+     
+     /* if the given max_err_cnt is set (i.e. not its default MAX_DIFF),
+	use it, otherwise, use the total number of elements in the dataset */
+     max_err_cnt = (opt->max_err_cnt != MAX_DIFF) ? opt->max_err_cnt : nelms;
+     nfound=array_diff(buf1, 
+         buf2, 
+         nelms, 
+         sds1_name,
+         sds2_name,
+         rank1,
+         dimsizes1,
+         dtype1, 
+         opt->err_limit,
+         opt->err_rel,
+         max_err_cnt, 
+         opt->statistics, 
+         fill1, 
+         fill2);
+ }
+ 
+ else /* possibly not enough memory, read/compare by hyperslabs */
+  
+ {
+     size_t        p_type_nbytes = eltsz;   /*size of type */
+     uint32        p_nelmts = nelms;        /*total selected elmts */
+     uint32        elmtno;                  /*counter  */
+     int           carry;                   /*counter carry value */
+
+     
+     /* stripmine info */
+     int32         sm_size[H4_MAX_VAR_DIMS];   /*stripmine size */
+     int32         sm_nbytes;               /*bytes per stripmine */
+     int32         sm_nelmts;               /*elements per stripmine*/
+     
+     /* hyperslab info */
+     int32         hs_offset[H4_MAX_VAR_DIMS]; /*starting offset */
+     int32         hs_size[H4_MAX_VAR_DIMS];   /*size this pass */
+     int32         hs_nelmts;               /*elements in request */
+     
+     /*
+      * determine the strip mine size and allocate a buffer. The strip mine is
+      * a hyperslab whose size is manageable.
+      */
+     sm_nbytes = p_type_nbytes;
+     
+     for (i = rank1; i > 0; --i) 
+     {
+         sm_size[i - 1] = MIN(dimsizes1[i - 1], H4TOOLS_BUFSIZE / sm_nbytes);
+         sm_nbytes *= sm_size[i - 1];
+         assert(sm_nbytes > 0);
+     }
+     
+     sm_buf1 = HDmalloc((size_t)sm_nbytes);
+     sm_buf2 = HDmalloc((size_t)sm_nbytes);
+     
+     sm_nelmts = sm_nbytes / p_type_nbytes;
+     
+     /* the stripmine loop */
+     memset(hs_offset, 0, sizeof hs_offset);
+     
+     for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) 
+     {
+         /* calculate the hyperslab size */
+         if (rank1 > 0) 
+         {
+             for (i = 0, hs_nelmts = 1; i < rank1; i++) 
+             {
+                 hs_size[i] = MIN(dimsizes1[i] - hs_offset[i], sm_size[i]);
+                 hs_nelmts *= hs_size[i];
+             }
+             
+         } 
+         else 
+         {
+             hs_nelmts = 1;
+         } /* rank */
+
+         
+         /* read */
+         if (SDreaddata (sds1_id, hs_offset, NULL, hs_size, sm_buf1) == FAIL) 
+         {
+             printf( "Could not read SDS <%s>\n", sds1_name);
+             goto out;
+         }
+         /* read */
+         if (SDreaddata (sds2_id, hs_offset, NULL, hs_size, sm_buf2) == FAIL) 
+         {
+             printf( "Could not read SDS <%s>\n", sds2_name);
+             goto out;
+         }
+         
+        /*-------------------------------------------------------------------------
+         * comparing
+         *-------------------------------------------------------------------------
+         */
+         
+         if (opt->verbose)
+             printf("Comparing <%s>\n",sds1_name); 
+         
+	/* if the given max_err_cnt is set (i.e. not its default MAX_DIFF),
+	   use it, otherwise, use the total number of elements in the dataset */
+	max_err_cnt = (opt->max_err_cnt != MAX_DIFF) ? opt->max_err_cnt : nelms;
+
+        /* get array differences. in the case of hyperslab read, increment the number of differences 
+           found in each hyperslab and pass the position at the beggining for printing 
+         */
+         nfound=array_diff(sm_buf1, 
+             sm_buf2, 
+             hs_nelmts, 
+             sds1_name,
+             sds2_name,
+             rank1,
+             dimsizes1,
+             dtype1, 
+             opt->err_limit,
+             opt->err_rel,
+             max_err_cnt, 
+             opt->statistics, 
+             fill1, 
+             fill2);
+
+         /* calculate the next hyperslab offset */
+         for (i = rank1, carry = 1; i > 0 && carry; --i) 
+         {
+             hs_offset[i - 1] += hs_size[i - 1];
+             if (hs_offset[i - 1] == dimsizes1[i - 1])
+                 hs_offset[i - 1] = 0;
+             else
+                 carry = 0;
+         } /* i */
+     } /* elmtno */
+     
+     /* free */
+     if (sm_buf1!=NULL)
+     {
+         free(sm_buf1);
+         sm_buf1=NULL;
+     }
+     if (sm_buf2!=NULL)
+     {
+         free(sm_buf2);
+         sm_buf2=NULL;
+     }
+     
+ } /* hyperslab read */
+
+  
+ } /* flag to compare SDSs */
+ 
+ /* flag to compare SDSs local attributes */
+ if (opt->sa == 1)
+ {
+  nfound += diff_sds_attrs(sds1_id,nattrs1,sds2_id,nattrs2,sds1_name,opt);
+ }
+ 
+/*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+do_nothing:
+
+ SDendaccess(sds1_id);
+ SDendaccess(sds2_id);
+ if (buf1)  HDfree(buf1);
+ if (buf2)  HDfree(buf2);
+ if (fill1) HDfree(fill1);
+ if (fill2) HDfree(fill2);
+
+ return nfound;
+
+
+out:
+
+ opt->err_stat = 1;
+
+ if (sds1_id!=-1)
+  SDendaccess(sds1_id);
+ if (sds2_id!=-1)
+  SDendaccess(sds2_id);
+
+ if (buf1)  HDfree(buf1);
+ if (buf2)  HDfree(buf2);
+ if (fill1) HDfree(fill1);
+ if (fill2) HDfree(fill2);
+
+ return 0;
+
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_sds_attrs
+ *
+ * Purpose: compare SDS attributes
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: September 2, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+uint32 diff_sds_attrs(int32 sds1_id,
+                      int32 nattrs1,
+                      int32 sds2_id,
+                      int32 nattrs2,
+                      char* sds1_name,
+                      diff_opt_t * opt)
+{
+ int32 dtype1,                 /* SDS data type */
+       nelms1,                 /* number of elements */
+       dtype2,                 /* SDS data type */
+       nelms2;                 /* number of elements */
+ char  attr1_name[H4_MAX_NC_NAME];
+ char  attr2_name[H4_MAX_NC_NAME];
+ VOIDP attr1_buf=NULL;
+ VOIDP attr2_buf=NULL;
+ int   i, cmp;
+ uint32 nfound=0;
+
+ if ( nattrs1!=nattrs2) {
+  printf( "Different number of atrributes\n");
+  return 0;
+ }
+
+ /* loop through attributes */
+ for (i = 0; i < nattrs1; i++) 
+ {
+  if (SDattrinfo (sds1_id, i, attr1_name, &dtype1, &nelms1) == FAIL) {
+   printf( "Cannot get info for attribute number %d\n", i);
+   goto out;
+  }
+  
+  if (SDattrinfo (sds2_id, i, attr2_name, &dtype2, &nelms2) == FAIL) {
+   printf( "Cannot get info for attribute number %d\n", i);
+   goto out;
+  }
+
+  if (dtype1 != dtype2 || nelms1 != nelms2 || (strcmp(attr1_name,attr2_name)!=0)) {
+   printf( "Different information for attribute <%d>\n", i);
+   continue;
+  }
+  
+  attr1_buf = (void *) malloc((unsigned)nelms1*DFKNTsize(dtype1 | DFNT_NATIVE));
+  if (!attr1_buf) {
+   printf("Out of memory!");
+   goto out;;
+  }
+  attr2_buf = (void *) malloc((unsigned)nelms2*DFKNTsize(dtype2 | DFNT_NATIVE));
+  if (!attr2_buf) {
+   printf("Out of memory!");
+   goto out;
+  }
+ 
+  if (SDreadattr(sds1_id, i, attr1_buf)==FAIL ) {
+   printf( "Could not read attribute number %d\n", i);
+   goto out;
+  }
+  if (SDreadattr(sds2_id, i, attr2_buf)==FAIL ) {
+   printf( "Could not read attribute number %d\n", i);
+   goto out;
+  }
+
+
+  cmp = HDmemcmp(attr1_buf,attr2_buf,nelms1*DFKNTsize(dtype1 | DFNT_NATIVE));
+  if (cmp!=0)
+  {
+   printf("\n---------------------------\n");
+   printf ("%s:%s = \n",sds1_name,attr1_name);
+   printf("<<<<\n");
+   pr_att_vals((nc_type)dtype1, nelms1, attr1_buf);
+   printf (" ;\n");
+   printf(">>>>\n");
+   pr_att_vals((nc_type)dtype2, nelms2, attr2_buf);
+   printf (" ;\n");
+
+   nfound++;
+  }
+
+  if (attr1_buf) free(attr1_buf);
+  if (attr2_buf) free(attr2_buf);
+ 
+ }
+
+ return nfound;
+
+
+out:
+
+ if (attr1_buf) free(attr1_buf);
+ if (attr2_buf) free(attr2_buf);
+ opt->err_stat = 1;
+ return 0;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: print_dims
+ *
+ * Purpose: print dimensions
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: May 9, 2003
+ *
+ * Comments: 
+ *
+ *-------------------------------------------------------------------------
+ */
+void print_dims( int r, int32 *d )
+{
+ int i;
+ printf("[ " );  
+ for ( i=0; i<r; i++ ) 
+  printf("%d ",(int)d[i]  );
+ printf("] " );
+}
diff --git a/mfhdf/hdiff/hdiff_table.c b/mfhdf/hdiff/hdiff_table.c
new file mode 100644
index 0000000..6423311
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_table.c
@@ -0,0 +1,166 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "hdiff_table.h"
+
+/*-------------------------------------------------------------------------
+ * Function: dtable_search
+ *
+ * Purpose: search the table for tag and ref
+ *
+ * Return: index on success, -1 on failure
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int dtable_search(dtable_t *table, int32 tag, int32 ref )
+{
+ uint32 i;
+ 
+ for (i = 0; i < table->nobjs; i++)
+  if (table->objs[i].tag == tag && table->objs[i].ref == ref)
+   return i;
+  
+  return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: dtable_add
+ *
+ * Purpose: add pair tag/ref and object path to table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void dtable_add(dtable_t *table, int32 tag, int32 ref, char* path)
+{
+ uint32 i;
+ 
+ if (table->nobjs == table->size) {
+  table->size *= 2;
+  table->objs = (dobj_info_t*)realloc(table->objs, table->size * sizeof(dobj_info_t));
+  
+  for (i = table->nobjs; i < table->size; i++) {
+   table->objs[i].tag = table->objs[i].ref = -1;
+   table->objs[i].flags[0] = table->objs[i].flags[1] = -1;
+  }
+ }
+ 
+ i = table->nobjs++;
+ table->objs[i].tag = tag;
+ table->objs[i].ref = ref;
+ strcpy(table->objs[i].obj_name,path);
+ table->objs[i].flags[0] = table->objs[i].flags[1] = -1;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: dtable_init
+ *
+ * Purpose: initialize table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void dtable_init( dtable_t **tbl )
+{
+ uint32 i;
+ dtable_t* table = (dtable_t*) malloc(sizeof(dtable_t));
+ 
+ table->size = 20;
+ table->nobjs = 0;
+ table->objs = (dobj_info_t*) malloc(table->size * sizeof(dobj_info_t));
+ 
+ for (i = 0; i < table->size; i++) {
+  table->objs[i].tag = table->objs[i].ref = -1;
+  table->objs[i].flags[0] = table->objs[i].flags[1] = -1;
+ }
+ 
+ *tbl = table;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dtable_free
+ *
+ * Purpose: free table memory
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void dtable_free( dtable_t *table )
+{
+ free(table->objs);
+ free(table);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dtable_print
+ *
+ * Purpose: print object list
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 25, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void dtable_print(dtable_t *table, char* header)
+{
+ uint32 i;
+
+ if ( ! table->nobjs ) /* nothing to do */
+     return;
+
+ printf("---------------------------------------\n");
+ printf("%s %5s %6s    %-15s\n", header, "Tag", "Ref", "Name");
+ printf("---------------------------------------\n");
+
+ for (i = 0; i < table->nobjs; i++)
+ {
+  printf("       %5ld %6ld    %-15s\n", 
+   table->objs[i].tag, 
+   table->objs[i].ref, 
+   table->objs[i].obj_name);
+ }
+
+}
diff --git a/mfhdf/hdiff/hdiff_table.h b/mfhdf/hdiff/hdiff_table.h
new file mode 100644
index 0000000..4e12f3c
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_table.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+
+#ifndef HDIFF_TABLE_H__
+#define HDIFF_TABLE_H__
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*struct to store the tag/ref and path of an object 
+ the pair tag/ref uniquely identifies an HDF object */
+typedef struct dobj_info_t {
+ int32   tag;
+ int32   ref;
+ char    obj_name[H4_MAX_NC_NAME];
+ int     flags[2];     
+ /*flags that store matching object information
+   between the 2 files 
+   object exists in file = 1
+   does not exist        = 0
+ */
+} dobj_info_t;
+
+/*struct that stores all objects */
+typedef struct dtable_t {
+ uint32     size;
+ uint32     nobjs;
+ dobj_info_t *objs;
+} dtable_t;
+
+
+/* table methods */
+void  dtable_init(dtable_t **table);
+void  dtable_free(dtable_t *table);
+int   dtable_search(dtable_t *table, int32 tag, int32 ref );
+void  dtable_add(dtable_t *table, int32 tag, int32 ref, char* obj_name);
+void  dtable_print(dtable_t *table, char* header);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* HDIFF_TABLE_H__ */
diff --git a/mfhdf/hdiff/hdiff_vs.c b/mfhdf/hdiff/hdiff_vs.c
new file mode 100644
index 0000000..1bbf1bb
--- /dev/null
+++ b/mfhdf/hdiff/hdiff_vs.c
@@ -0,0 +1,444 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdiff.h"
+#include "hdiff_list.h"
+#include "hdiff_mattbl.h"
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hdiff.h"
+#include "vgint.h"
+
+static void fmt_print(uint8 *x, int32 type);
+static uint32 vdata_cmp(int32  vs1, int32  vs2, char   *gname, char   *cname, diff_opt_t * opt);
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_vs
+ *
+ * Purpose: diff for VS 
+ *
+ * Return: Number of differences found
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 26, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+uint32 diff_vs( int32 file1_id,
+                int32 file2_id,
+                int32 ref1,              
+                int32 ref2,
+                diff_opt_t * opt)          
+{
+ int32 vdata1_id,             /* vdata identifier */
+       n_records1,            /* number of records */
+       vdata1_size, 
+       interlace1_mode,
+       vdata2_id=-1,          /* vdata identifier */
+       n_records2,            /* number of records */
+       vdata2_size, 
+       interlace2_mode;
+ char  vdata1_name [VSNAMELENMAX];
+ char  vdata1_class[VSNAMELENMAX];
+ char  fieldname1_list[VSFIELDMAX*FIELDNAMELENMAX];
+ char  vdata2_name [VSNAMELENMAX];
+ char  vdata2_class[VSNAMELENMAX];
+ char  fieldname2_list[VSFIELDMAX*FIELDNAMELENMAX];
+ uint32 nfound=0;
+
+
+ 
+/*-------------------------------------------------------------------------
+ * object 1
+ *-------------------------------------------------------------------------
+ */
+
+ if (Vstart (file1_id)==FAIL) {
+  printf("Error: Could not start VS interface in VS ref %ld\n", ref1);
+  goto out;
+ }
+
+ if ((vdata1_id  = VSattach (file1_id, ref1, "r")) == FAIL ){
+  printf( "Failed to attach VS ref %ld\n", ref1);
+  goto out;
+ }
+ if (VSgetname  (vdata1_id, vdata1_name) == FAIL ){
+  printf( "Failed to name for VS ref %ld\n", ref1);
+  goto out;
+ }
+ if (VSgetclass (vdata1_id, vdata1_class) == FAIL ){
+  printf( "Failed to name for VS ref %ld\n", ref1);
+  goto out;
+ }
+ 
+ if (VSinquire(vdata1_id, &n_records1, &interlace1_mode, fieldname1_list, 
+  &vdata1_size, vdata1_name) == FAIL) {
+  printf( "Failed to get info for VS ref %ld\n", ref1);
+  goto out;
+ }
+ 
+ if (VFnfields(vdata1_id)== FAIL ){
+  printf( "Failed getting fields forVS ref %ld\n", ref1);
+  goto out;
+ }
+ 
+
+/*-------------------------------------------------------------------------
+ * object 2
+ *-------------------------------------------------------------------------
+ */
+
+ if (Vstart (file2_id)==FAIL) {
+  printf("Error: Could not start VS interface in VS ref %ld\n", ref1);
+  goto out;
+ }
+
+ if ((vdata2_id  = VSattach (file2_id, ref2, "r")) == FAIL ){
+  printf( "Failed to attach VS ref %ld\n", ref2);
+  goto out;
+ }
+ if (VSgetname  (vdata2_id, vdata2_name) == FAIL ){
+  printf( "Failed to name for VS ref %ld\n", ref2);
+  goto out;
+ }
+ if (VSgetclass (vdata2_id, vdata2_class) == FAIL ){
+  printf( "Failed to name for VS ref %ld\n", ref2);
+  goto out;
+ }
+ 
+ if (VSinquire(vdata2_id, &n_records2, &interlace2_mode, fieldname2_list, 
+  &vdata2_size, vdata2_name) == FAIL) {
+  printf( "Failed to get info for VS ref %ld\n", ref2);
+  goto out;
+ }
+ 
+ if (VFnfields(vdata2_id)== FAIL ){
+  printf( "Failed getting fields forVS ref %ld\n", ref2);
+  goto out;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for input VSs
+ *-------------------------------------------------------------------------
+ */
+ 
+ if (opt->nuvars > 0)   /* if specified vdata is selected */
+ {
+  int imatch = 0, j;
+  for (j = 0; j < opt->nuvars; j++)
+  {
+   if (strcmp(vdata1_name, opt->uvars[j]) == 0)
+   {
+    imatch = 1;
+    break;
+   }
+  }
+  if (imatch == 0)
+  {
+   goto do_nothing;
+  }
+ }   
+
+
+/*-------------------------------------------------------------------------
+ * Comparing
+ *-------------------------------------------------------------------------
+ */
+
+ if (opt->verbose)
+  printf("Comparing <%s>\n",vdata1_name);  
+
+ nfound=vdata_cmp(vdata1_id,vdata2_id,vdata1_name,vdata1_class,opt);
+
+do_nothing:
+
+ /* terminate access to the VSs */
+ if (VSdetach (vdata1_id)==FAIL) {
+     printf( "Failed to dettach VS ref %ld\n", ref1);
+     goto out;
+ }
+ if (vdata2_id!=-1)
+ {
+     if (VSdetach (vdata2_id)==FAIL) {
+         printf( "Failed to dettach VS ref %ld\n", ref2);
+         goto out;
+     }
+ }
+
+ 
+ return nfound;
+
+out:
+
+ opt->err_stat = 1;
+ return 0;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: vdata_cmp
+ *
+ * Purpose: compare vdata
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static uint32 vdata_cmp(int32  vs1, 
+                        int32  vs2, 
+                        char   *gname, 
+                        char   *cname, 
+                        diff_opt_t * opt)
+{
+ int32   i, j, k, iflag;
+ uint32  err_cnt;
+ int32   nv1, interlace1, vsize1;
+ int32   vsotag1;
+ char    fields1[VSFIELDMAX*FIELDNAMELENMAX];
+ char    vsclass1[VSNAMELENMAX], vsname1[VSNAMELENMAX];
+ int32   nv2, interlace2, vsize2;
+ int32   vsotag2;
+ char    fields2[VSFIELDMAX*FIELDNAMELENMAX];
+ char    vsclass2[VSNAMELENMAX], vsname2[VSNAMELENMAX];
+ uint8   *buf1, *buf2, *b1, *b2;
+ int32   off1[60], off2[60];
+ DYN_VWRITELIST *w1, *w2;
+ uint32  nfound=0;
+ uint32  max_err_cnt = opt->max_err_cnt; 
+ 
+ VSinquire(vs1, &nv1, &interlace1, fields1, &vsize1, vsname1);
+ VSinquire(vs2, &nv2, &interlace2, fields2, &vsize2, vsname2);
+ 
+ vsotag1 = VSQuerytag(vs1);
+ VSgetclass(vs1,vsclass1);
+ 
+ vsotag2 = VSQuerytag(vs2);
+ VSgetclass(vs2,vsclass2);
+ 
+ if (vsotag1 != vsotag2 || nv1 != nv2 || interlace1 != interlace2 ||
+  strcmp(fields1, fields2) != 0 || strcmp(vsclass1, vsclass2) != 0 ||
+  (strcmp(vsclass1, "Attr0.0") != 0 && vsize1 != vsize2))
+ {
+  printf("\n---------------------------\n");
+  printf("Vdata Name: %s <%s/%s> (Different attributes)\n",
+   vsname1, gname, cname);
+  printf("> <%ld> nrec=%ld interlace=%ld fld=[%s] vsize=%ld class={%s})\n",
+   vsotag1, nv1, interlace1, fields1, vsize1, vsclass1);
+  printf("< <%ld> nrec=%ld interlace=%ld fld=[%s] vsize=%ld class={%s})\n",
+   vsotag2, nv2, interlace2, fields2, vsize2, vsclass2);
+  return 0;
+ }
+ 
+ 
+ /* compare the data */
+ 
+ buf1 = (uint8 *) malloc((unsigned) (nv1 * vsize1));
+ buf2 = (uint8 *) malloc((unsigned) (nv2 * vsize2));
+ if (!buf1 || !buf2) 
+ {
+  printf("Out of memory!");
+  opt->err_stat = 1;
+  return 0;
+ }
+ 
+ VSsetfields(vs1, fields1);
+ VSread(vs1, buf1, nv1, interlace1);
+ w1 = (DYN_VWRITELIST*) vswritelist(vs1);
+ 
+ VSsetfields(vs2, fields2);
+ VSread(vs2, buf2, nv2, interlace2);
+ w2 = (DYN_VWRITELIST*) vswritelist(vs2);
+ 
+ b1 = buf1;
+ b2 = buf2;
+ 
+ for (j=0; j < w1->n; j++)
+  off1[j] = DFKNTsize(w1->type[j] | DFNT_NATIVE);
+ 
+ for (j=0; j < w2->n; j++)
+  off2[j] = DFKNTsize(w2->type[j] | DFNT_NATIVE);
+ 
+ iflag = 0;
+ 
+ err_cnt = 0;
+ 
+ if (vsize1 == vsize2)
+ {
+  for (i=0; i<nv1; i++)
+  {
+   if (memcmp(b1, b2, (size_t)vsize1) == 0)
+   {
+    b1 += vsize1;   
+    b2 += vsize2;
+    continue;
+   }
+   if (iflag == 0)
+   {
+    iflag = 1;         /* there is a difference */
+    printf("\n---------------------------\n");
+    printf("Vdata Name: %s (Data record comparison)\n", 
+     vsname1);
+    nfound ++;
+   }
+   
+   printf("> %ld: ", i);
+   for (j=0; j<w1->n; j++)
+   {
+    for (k=0; k<w1->order[j]; k++)
+    {
+     fmt_print(b1, w1->type[j]);
+     b1 += off1[j];
+     if (w1->type[j] != DFNT_CHAR)
+      putchar(' ');
+    }
+   }        
+   putchar('\n');
+   printf("< %ld: ", i);
+   for (j=0; j<w2->n; j++)
+   {
+    for (k=0; k<w2->order[j]; k++)
+    {
+     fmt_print(b2, w2->type[j]);
+     b2 += off2[j];
+     if (w2->type[j] != DFNT_CHAR)
+      putchar(' ');
+    }
+   }        
+   putchar('\n');
+   
+   if (max_err_cnt > 0)
+   {
+    err_cnt++;
+    if (err_cnt >= max_err_cnt)
+     break;
+   }
+  }
+ }
+ else
+ {
+  printf("****....\n");
+  for (i=0; i<nv1; i++)
+  {
+   if (iflag == 0)
+   {
+    iflag = 1;         /* there is a difference */
+    printf("\n---------------------------\n");
+    printf("Vdata Name: %s (Data record comparison)\n", 
+     vsname1);
+    nfound ++;
+   }
+   printf("> %ld: ", i);
+   for (j=0; j<w1->n; j++)
+   {
+    for (k=0; k<w1->order[j]; k++)
+    {
+     fmt_print(b1, w1->type[j]);
+     b1 += off1[j];
+     if (w1->type[j] != DFNT_CHAR)
+      putchar(' ');
+    }
+   }  
+   putchar('\n');
+   printf("< %ld: ", i);
+   for (j=0; j<w2->n; j++)
+   {
+    for (k=0; k<w2->order[j]; k++)
+    {
+     fmt_print(b2, w2->type[j]);
+     b1 += off2[j];
+     if (w2->type[j] != DFNT_CHAR)
+      putchar(' ');
+    }
+   }  
+   putchar('\n');
+   
+   if (max_err_cnt > 0)
+   {
+    err_cnt++;
+    if (err_cnt >= max_err_cnt)
+     break;
+   }
+  }
+  
+ }
+ 
+ if (buf1)free((char *) buf1);
+ if (buf2)free((char *) buf2);
+
+ return nfound;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: fmt_print
+ *
+ * Purpose: print HDF types
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+fmt_print(uint8 *x, int32 type)
+{
+ int16    s = 0;
+ int32    l = 0;
+ float32  f = 0;
+ float64  d = 0;
+ 
+ switch(type) 
+ {
+ case DFNT_CHAR:
+  putchar(*x);
+  break;
+  
+ case DFNT_UINT8:
+ case DFNT_INT8:
+  printf("%02x ", *x);
+  break;
+  
+ case DFNT_UINT16:
+ case DFNT_INT16:
+  HDmemcpy(&s, x, sizeof(int16));
+  printf("%d", s);
+  break;
+  
+ case DFNT_UINT32:
+  HDmemcpy(&l, x, sizeof(int32));
+  printf("%lu", l);
+  break;
+
+ case DFNT_INT32:
+  HDmemcpy(&l, x, sizeof(int32));
+  printf("%ld", l);
+  break;
+  
+ case DFNT_FLOAT32:
+  HDmemcpy(&f, x, sizeof(float32));
+  printf("%f", f);
+  break;
+  
+ case DFNT_FLOAT64:
+  HDmemcpy(&d, x, sizeof(float64));
+  printf("%f", d);
+  break;
+  
+ default: 
+  fprintf(stderr,"sorry, type [%ld] not supported\n", type); 
+  break;
+  
+ }
+}
diff --git a/mfhdf/hdiff/hdifftst.c b/mfhdf/hdiff/hdifftst.c
new file mode 100644
index 0000000..a86a93e
--- /dev/null
+++ b/mfhdf/hdiff/hdifftst.c
@@ -0,0 +1,723 @@
+#include "mfhdf.h"
+ 
+
+#define FILE1_NAME         "hdifftst1.hdf" 
+#define FILE2_NAME         "hdifftst2.hdf" 
+
+/* big file for hyperslab I/O */
+#define FILE3_NAME         "hdifftst3.hdf" 
+#define FILE4_NAME         "hdifftst4.hdf"  
+
+/* lones */
+#define FILE5_NAME         "hdifftst5.hdf" 
+#define FILE6_NAME         "hdifftst6.hdf"  
+
+/* groups */
+#define FILE7_NAME         "hdifftst7.hdf" 
+       
+
+#define X_LENGTH           2
+#define Y_LENGTH           3
+#define RANK               2  
+#define FILE_ATTR_NAME     "File_contents"
+#define SDS_ATTR_NAME      "Valid_range"
+
+
+#define  CLASS1_NAME       "5x1 Array"
+#define  CLASS2_NAME       "6x4 Array"
+#define  VDATA1_NAME       "vdata1"
+#define  VDATA2_NAME       "vdata2"
+#define  FIELD1_NAME       "Single-component Field"
+#define  FIELD2_NAME       "Multi-component Field"
+#define  N_RECORDS_1       5    /* number of records the first vdata contains  */
+#define  N_RECORDS_2       2    /* number of records the second vdata contains */
+#define  ORDER_2           4    /* order of the field in the second vdata      */
+
+#define  CLASS3_NAME       "Particle Data"
+#define  VDATA3_NAME       "vdata3"
+#define  FIELD3_NAME1      "Position"                       
+#define  FIELD3_NAME2      "Mass"                          
+#define  FIELD3_NAME3      "Temperature"                    
+#define  FIELDNAME3_LIST   "Position,Mass,Temperature"      /* No spaces b/w names */
+#define  ORDER3_1          3                                /* order of first field */
+#define  ORDER3_2          1                                /* order of second field */
+#define  ORDER3_3          2                                /* order of third field */
+#define  N_VALS_PER_REC   (ORDER3_1 + ORDER3_2 + ORDER3_3)  /* number of values per record */
+
+
+
+/*-------------------------------------------------------------------------
+ * local prototypes
+ *-------------------------------------------------------------------------
+ */
+static int do_big_file(void);
+static int do_groups(void);  
+
+/*-------------------------------------------------------------------------
+ * main
+ *-------------------------------------------------------------------------
+ */
+
+int main(void) 
+{
+ int32 sd1_id;        /* SD interface identifier */
+ int32 sd2_id;        /* SD interface identifier */
+ int32 sds1_id;       /* SDS identifier */
+ int32 sds2_id;       /* SDS identifier */
+ int32 dim_sizes[2];  /* sizes of the SDS dimensions */
+ int32 start[2];      /* start location to write */
+ int32 edges[2];      /* number of elements to write */
+ int32 n_values;
+ int32 buf1a[Y_LENGTH][X_LENGTH] = {{1,1},{1,1},{5,6}};
+ int32 buf1b[Y_LENGTH][X_LENGTH] = {{1,2},{3,4},{5,6}};
+
+ /* percent test: compare divide by zero, both zero */
+ int32 buf2a[Y_LENGTH][X_LENGTH] = {{100,100},{100,0},{0,100}}; 
+ int32 buf2b[Y_LENGTH][X_LENGTH] = {{120,80},{0,100},{0,50}};
+
+ /* global attributes */
+ char8 bufga1[] = "Storm_track_data1"; 
+ char8 bufga2[] = "Storm_track_data2"; 
+ float32 bufa1[2] = {1., 1.};
+ float32 bufa2[2] = {1., 2.};
+
+ /*vdata*/
+ int32 file1_id; 
+ int32 file2_id; 
+ int32 vdata1_id;
+ int32 vdata2_id;
+ char8 vdata1_buf1 [N_RECORDS_1] = {'V', 'D', 'A', 'T', 'A'};
+ char8 vdata1_buf2 [N_RECORDS_1] = {'X', 'D', 'A', 'T', 'A'};
+ int32 vdata2_buf1  [N_RECORDS_2][ORDER_2] = {{1, 2, 3, 4}, {5, 6, 7, 8}};
+ int32 vdata2_buf2  [N_RECORDS_2][ORDER_2] = {{1, 1, 1, 1}, {5, 6, 7, 8}};
+ float32 vdata3_buf1[N_RECORDS_2][N_VALS_PER_REC]={{1,2,3,4,5,6},{7,8,9,10,11,12}}; 
+ float32 vdata3_buf2[N_RECORDS_2][N_VALS_PER_REC]={{1,1,1,1,1,1},{7,8,9,10,11,12}}; 
+ 
+/* Define the location and size of the data to be written to the data set*/
+ start[0] = 0;
+ start[1] = 0;
+ edges[0] = Y_LENGTH;
+ edges[1] = X_LENGTH;
+
+/* Define the dimensions of the array to be created */
+ dim_sizes[0] = Y_LENGTH;
+ dim_sizes[1] = X_LENGTH;
+
+/*-------------------------------------------------------------------------
+ * SD data
+ *-------------------------------------------------------------------------
+ */
+
+ 
+/* Create the files and initialize the SD interface */
+ if ((sd1_id = SDstart (FILE1_NAME, DFACC_CREATE))==FAIL) 
+     goto error;
+ if ((sd2_id = SDstart (FILE2_NAME, DFACC_CREATE))==FAIL) 
+     goto error;
+
+/* Set a global attribute */
+ n_values  = sizeof(bufga1);
+ if ( SDsetattr (sd1_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values, (VOIDP)bufga1)==FAIL) 
+     goto error;
+ if ( SDsetattr (sd2_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values, (VOIDP)bufga2)==FAIL) 
+     goto error;
+  
+/* Create the data sets */ 
+ if ((sds1_id = SDcreate (sd1_id, "dset1", DFNT_INT32, RANK, dim_sizes))==FAIL) 
+     goto error;
+ if ((sds2_id = SDcreate (sd2_id, "dset1", DFNT_INT32, RANK, dim_sizes))==FAIL) 
+     goto error;
+
+/* Assign attribute */
+ n_values  = 2;
+ if ( SDsetattr (sds1_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, (VOIDP)bufa1)==FAIL) 
+     goto error;
+ if ( SDsetattr (sds2_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, (VOIDP)bufa2)==FAIL) 
+     goto error;
+ 
+/* Write the stored data to the data set */
+ if ( SDwritedata (sds1_id, start, NULL, edges, (VOIDP)buf1a)==FAIL) 
+     goto error;
+ if ( SDwritedata (sds2_id, start, NULL, edges, (VOIDP)buf1b)==FAIL) 
+     goto error;
+ 
+/* Terminate access to the data set */
+ if ( SDendaccess (sds1_id)==FAIL) 
+     goto error;
+ if ( SDendaccess (sds2_id)==FAIL) 
+     goto error;
+
+ /* Create another data set */ 
+ if (( sds1_id = SDcreate (sd1_id, "dset2", DFNT_INT32, RANK, dim_sizes))==FAIL) 
+     goto error;
+ if (( sds2_id = SDcreate (sd2_id, "dset2", DFNT_INT32, RANK, dim_sizes))==FAIL) 
+     goto error;
+ if ( SDwritedata (sds1_id, start, NULL, edges, (VOIDP)buf1a)==FAIL) 
+     goto error;
+ if ( SDwritedata (sds2_id, start, NULL, edges, (VOIDP)buf1b)==FAIL) 
+     goto error;
+ if ( SDendaccess (sds1_id)==FAIL) 
+     goto error;
+ if ( SDendaccess (sds2_id)==FAIL) 
+     goto error;
+
+ /* data sets for -p test */ 
+ if (( sds1_id = SDcreate (sd1_id, "dset3", DFNT_INT32, RANK, dim_sizes))==FAIL) 
+     goto error;
+ if (( sds2_id = SDcreate (sd2_id, "dset3", DFNT_INT32, RANK, dim_sizes))==FAIL) 
+     goto error;
+ if ( SDwritedata (sds1_id, start, NULL, edges, (VOIDP)buf2a)==FAIL) 
+     goto error;
+ if ( SDwritedata (sds2_id, start, NULL, edges, (VOIDP)buf2b)==FAIL) 
+     goto error;
+ if ( SDendaccess (sds1_id)==FAIL) 
+     goto error;
+ if ( SDendaccess (sds2_id)==FAIL) 
+     goto error;
+
+
+/*-------------------------------------------------------------------------
+ * end SD 
+ *-------------------------------------------------------------------------
+ */
+ 
+ /* Terminate access to the SD interface and close the file */
+ if ( SDend (sd1_id)==FAIL) 
+     goto error;
+ if ( SDend (sd2_id)==FAIL) 
+     goto error;
+
+
+
+/*-------------------------------------------------------------------------
+ * VD data 
+ *-------------------------------------------------------------------------
+ */
+
+/* Open the HDF file for writing */
+ if ((file1_id = Hopen (FILE1_NAME, DFACC_WRITE, 0))==FAIL) 
+     goto error;
+ if ((file2_id = Hopen (FILE2_NAME, DFACC_WRITE, 0))==FAIL) 
+     goto error;
+ 
+/* Initialize the VS interface */
+ if ( Vstart (file1_id)==FAIL) 
+     goto error;
+ if ( Vstart (file2_id)==FAIL) 
+     goto error;
+
+/*-------------------------------------------------------------------------
+ * VD data one field
+ *-------------------------------------------------------------------------
+ */
+ 
+/* Create the first vdata and populate it with data from vdata1_buf */
+ if (VHstoredata (file1_id, FIELD1_NAME, (uint8 *)vdata1_buf1, 
+  N_RECORDS_1, DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME)==FAIL) 
+     goto error; 
+ if (VHstoredata (file2_id, FIELD1_NAME, (uint8 *)vdata1_buf2, 
+  N_RECORDS_1, DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME)==FAIL) 
+     goto error; 
+
+/*-------------------------------------------------------------------------
+ * VD data one field, order 4
+ *-------------------------------------------------------------------------
+ */
+ 
+/* Create the second vdata and populate it with data from vdata2_buf */
+ if ( VHstoredatam (file1_id, FIELD2_NAME, (uint8 *)vdata2_buf1, 
+  N_RECORDS_2, DFNT_INT32, VDATA2_NAME, CLASS2_NAME, ORDER_2)==FAIL) 
+     goto error;  
+ if ( VHstoredatam (file2_id, FIELD2_NAME, (uint8 *)vdata2_buf2, 
+  N_RECORDS_2, DFNT_INT32, VDATA2_NAME, CLASS2_NAME, ORDER_2)==FAIL) 
+     goto error;   
+
+/*-------------------------------------------------------------------------
+ * VD data several fields
+ *-------------------------------------------------------------------------
+ */
+
+/* Create a new vdata */
+ if ((vdata1_id = VSattach (file1_id, -1, "w"))==FAIL) 
+     goto error;
+ if ((vdata2_id = VSattach (file2_id, -1, "w"))==FAIL) 
+     goto error;
+
+/* Set name and class name of the vdata */
+ if ( VSsetname (vdata1_id, VDATA3_NAME)==FAIL) 
+     goto error;
+ if ( VSsetclass (vdata1_id, CLASS3_NAME)==FAIL) 
+     goto error;
+ if ( VSsetname (vdata2_id, VDATA3_NAME)==FAIL) 
+     goto error;
+ if ( VSsetclass (vdata2_id, CLASS3_NAME)==FAIL) 
+     goto error;
+
+/* Define fields */
+ if ( VSfdefine (vdata1_id, FIELD3_NAME1, DFNT_FLOAT32, ORDER3_1 )==FAIL) 
+     goto error;
+ if ( VSfdefine (vdata1_id, FIELD3_NAME2, DFNT_FLOAT32, ORDER3_2 )==FAIL) 
+     goto error;
+ if ( VSfdefine (vdata1_id, FIELD3_NAME3, DFNT_FLOAT32, ORDER3_3 )==FAIL) 
+     goto error;
+ if ( VSsetfields (vdata1_id, FIELDNAME3_LIST )==FAIL) 
+     goto error;
+ if ( VSfdefine (vdata2_id, FIELD3_NAME1, DFNT_FLOAT32, ORDER3_1 )==FAIL) 
+     goto error;
+ if ( VSfdefine (vdata2_id, FIELD3_NAME2, DFNT_FLOAT32, ORDER3_2 )==FAIL) 
+     goto error;
+ if ( VSfdefine (vdata2_id, FIELD3_NAME3, DFNT_FLOAT32, ORDER3_3 )==FAIL) 
+     goto error;
+ if ( VSsetfields (vdata2_id, FIELDNAME3_LIST)==FAIL) 
+     goto error;
+
+/* Write the data with full interlacing mode */
+ if ( VSwrite (vdata1_id, (uint8 *)vdata3_buf1, N_RECORDS_2, FULL_INTERLACE)==FAIL) 
+     goto error;
+ if ( VSwrite (vdata2_id, (uint8 *)vdata3_buf2, N_RECORDS_2, FULL_INTERLACE)==FAIL) 
+     goto error;
+
+ if ( VSdetach (vdata1_id)==FAIL) 
+     goto error;
+ if ( VSdetach (vdata2_id)==FAIL) 
+     goto error;
+
+/*-------------------------------------------------------------------------
+ * end VD data 
+ *-------------------------------------------------------------------------
+ */
+ 
+/* Terminate access to the VS interface and close the HDF file */
+ if ( Vend (file1_id)==FAIL) 
+     goto error;
+ if ( Vend (file2_id)==FAIL) 
+     goto error;
+ if ( Hclose (file1_id)==FAIL) 
+     goto error;
+ if ( Hclose (file2_id)==FAIL) 
+     goto error;
+
+/*-------------------------------------------------------------------------
+ * write 2 big files for hyperslab reading
+ *-------------------------------------------------------------------------
+ */
+ if (do_big_file()==FAIL) 
+     goto error;
+
+/*-------------------------------------------------------------------------
+ * groups
+ *-------------------------------------------------------------------------
+ */
+ if (do_groups()==FAIL) 
+     goto error;
+
+ 
+ return 0;
+
+error:
+
+ printf("Error...Exiting...\n");
+
+ return 1;
+
+}
+
+
+
+#define DIM0     10
+#define DIM1     10
+#define ADD_ROWS ( 1024 * 1024 - 10 ) / 10 
+
+/*-------------------------------------------------------------------------
+ * write 2 big files for hyperslab reading
+ *-------------------------------------------------------------------------
+ */
+static int do_big_file(void) 
+{
+
+    int32 sd1_id;        /* SD interface identifier */
+    int32 sd2_id;        /* SD interface identifier */
+    int32 sds1_id;       /* SDS identifier */
+    int32 sds2_id;       /* SDS identifier */
+    int32 dims[2];       /* sizes of the SDS dimensions */
+    int32 start[2];      /* start location to write */
+    int32 edges[2];      /* number of elements to write */
+
+    int32 sds1_idx;
+    int32 sds2_idx;
+    int32 rank;
+	uint8 array_data[DIM0][DIM1];
+    uint8 append_data1[DIM1];
+    uint8 append_data2[DIM1];
+	intn  i, j, n;
+
+	/* Create 2 files and initiate the SD interface. */
+    if ((sd1_id = SDstart(FILE3_NAME, DFACC_CREATE))==FAIL) 
+        goto error;
+    if ((sd2_id = SDstart(FILE4_NAME, DFACC_CREATE))==FAIL) 
+        goto error;
+
+	/* Define the rank and dimensions of the data set to be created. */
+	rank = 2;
+	dims[0] = SD_UNLIMITED;
+	dims[1] = DIM1;
+
+	/* Create 2 data sets */
+	if ((sds1_id = SDcreate(sd1_id, "data1", DFNT_UINT8, rank, dims))==FAIL) 
+        goto error;
+    if ((sds2_id = SDcreate(sd2_id, "data1", DFNT_UINT8, rank, dims))==FAIL) 
+        goto error;
+
+	/* initial values */
+    for (j = 0; j < DIM0; j++) 
+    {
+        for (i = 0; i < DIM1; i++)
+            array_data[j][i] = (i + j) + 1;
+    }
+
+	/* define the location, pattern, and size of the data set */
+    for (i = 0; i < rank; i++) 
+    {
+        start[i] = 0;
+    }
+	edges[0] = DIM0; /* 10 */
+	edges[1] = DIM1; /* 5 */
+
+    if ( SDwritedata(sds1_id, start, NULL, edges, (VOIDP)array_data)==FAIL) 
+        goto error;
+    if ( SDwritedata(sds2_id, start, NULL, edges, (VOIDP)array_data)==FAIL) 
+        goto error;
+
+	/* terminate access to the datasets and SD interface */
+    if ( SDendaccess(sds1_id)==FAIL) 
+        goto error;
+    if ( SDendaccess(sds2_id)==FAIL) 
+        goto error;
+    if ( SDend(sd1_id)==FAIL) 
+        goto error;
+    if ( SDend(sd2_id)==FAIL) 
+        goto error;
+
+    /* append data */
+	if (( sd1_id = SDstart(FILE3_NAME, DFACC_WRITE))==FAIL) 
+        goto error;
+    if (( sd2_id = SDstart(FILE4_NAME, DFACC_WRITE))==FAIL) 
+        goto error;
+	
+    if ((sds1_idx = SDnametoindex (sd1_id, "data1"))==FAIL) 
+        goto error;
+    if ((sds2_idx = SDnametoindex (sd2_id, "data1"))==FAIL) 
+        goto error;
+    
+    if ((sds1_id = SDselect (sd1_id, sds1_idx))==FAIL) 
+        goto error;
+    if ((sds2_id = SDselect (sd2_id, sds2_idx))==FAIL) 
+        goto error;
+    
+   	/* define the location of the append */
+    for (n = 0; n < ADD_ROWS; n++)
+    {
+        start[0] = DIM0 + n;   /* 10 */
+        start[1] = 0;
+        edges[0] = 1;          /* 1 row at a time */
+        edges[1] = DIM1;       /* 5 elements */
+
+        /* store array values to be appended */
+        for (i = 0; i < DIM1; i++)
+            append_data1[i] = i + 1;
+        for (i = 0; i < DIM1; i++)
+            append_data2[i] = i + 1;
+
+        if (n == 20 || n == ADD_ROWS / 2 || n == ADD_ROWS - 10 )
+        {
+            /* change a few values at 3 places evenly divided */
+            for (i = 0; i < DIM1; i++)
+                append_data2[i] = 100;
+            
+            /* append data to file */
+            if ( SDwritedata (sds1_id, start, NULL, edges, (VOIDP) append_data1)==FAIL) 
+                goto error;
+            if ( SDwritedata (sds2_id, start, NULL, edges, (VOIDP) append_data2)==FAIL) 
+                goto error;
+
+
+        }    
+               
+    }
+
+    /* terminate access */
+    if ( SDendaccess (sds1_id)==FAIL) 
+        goto error;
+    if ( SDendaccess (sds2_id)==FAIL) 
+        goto error;
+    if ( SDend (sd1_id)==FAIL) 
+        goto error;
+    if ( SDend (sd2_id)==FAIL) 
+        goto error;
+
+    return SUCCEED;
+    
+error:
+    
+    printf("Error...Exiting...\n");
+    
+    return FAIL;
+
+
+}
+
+
+#define  FILE_LABEL_TXT  "created with HDF 4.2 Release 1"
+
+/*-------------------------------------------------------------------------
+ * do_lone
+ *-------------------------------------------------------------------------
+ */
+
+int do_lone(char* file_name, int do_diffs)
+{
+    char    sds_name[]  = "lone";
+    int32   rank        = 1;
+    int32   dim_sds[1]  = {5};             /* dimension of the data set */
+    int32   data[5]     = {1, 2, 3, 4, 5};
+    int32   start[1];                      /* start position to write for each dimension */
+    int32   edges[1];                      /* number of elements to be written along each dimension */
+    int32   sds_id;
+    int32   dim_id;
+    int32   sd_id;
+
+    if ( do_diffs )
+    {
+ 
+        data[1] = data[2] = 0;
+    }
+    
+    sd_id  = SDstart(file_name, DFACC_CREATE);
+    
+    /* create the SDS */
+    if ((sds_id = SDcreate (sd_id, sds_name, DFNT_INT32, rank, dim_sds))<0)
+    {
+        printf( "Could not create SDS <%s>\n",sds_name);
+        goto fail;
+    }
+    
+    dim_id = SDgetdimid(sds_id, 0);
+    SDsetdimname(dim_id, sds_name);
+
+    /* define the location and size of the data to be written to the data set */
+    start[0] = 0;
+    edges[0] = 5;
+    
+    /* write the stored data to the data set */
+    if (SDwritedata (sds_id, start, NULL, edges, (VOIDP)data)==FAIL)
+    {
+        printf( "Failed to set write for SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    
+    SDendaccess(sds_id);
+
+
+    /* create the SDS */
+    if ((sds_id = SDcreate (sd_id, "sds", DFNT_INT32, rank, dim_sds))<0)
+    {
+        printf( "Could not create SDS <%s>\n");
+        goto fail;
+    }
+
+    if (SDwritedata (sds_id, start, NULL, edges, (VOIDP)data)==FAIL)
+    {
+        printf( "Failed to set write for SDS <%s>\n");
+        goto fail;
+    } 
+
+    SDendaccess(sds_id);
+
+    SDend(sd_id);
+
+
+    {
+        int32 file1_id;      /*  HDF file identifier */ 
+        int32 an_id;        /* AN interface identifier */
+        int32 file_label_id;  /* file label identifier */
+           
+        /* open file */
+        if ((file1_id = Hopen (file_name, DFACC_WRITE, (int16)0))<0)
+        {
+            printf("Error: Could not open file <%s>\n",file_name);
+            return FAIL;
+        }
+        
+        /* Initialize the AN interface */
+        an_id = ANstart (file1_id);
+              
+        /* Create the file label */
+        file_label_id = ANcreatef (an_id, AN_FILE_LABEL);
+        
+        /* Write the annotations to the file label */
+        if (ANwriteann (file_label_id,FILE_LABEL_TXT,strlen (FILE_LABEL_TXT))==FAIL)
+        {
+            printf( "Could not write AN\n");
+            return FAIL;
+        }
+
+        /* Terminate access to annotation */
+        if (ANendaccess (file_label_id)==FAIL)
+        {
+            printf( "Could not end AN\n");
+            return FAIL;
+        }
+        
+        /* Terminate access to the AN interface */
+        if (ANend (an_id)==FAIL)
+        {
+            printf( "Could not end AN\n");
+            return FAIL;
+        }
+        
+
+        /* close the HDF file */
+        if (Hclose (file1_id)==FAIL)
+        {
+            printf( "Could not close file\n");
+            return FAIL;
+        }
+  
+    }
+    
+    return SUCCEED;
+
+fail:
+    SDend(sd_id);
+    return FAIL;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * write groups
+ * a circular reference
+ *
+ *                g0 ----->   g1
+ *                 |       |    ^
+ *                 |       |    |
+ *                 |       \/   |
+ *                 |----->   g1.1
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int do_groups(void) 
+{
+     
+     int32 vg0_id,    /* vgroup identifier */
+           vg1_id,    /* vgroup identifier */
+           vg2_id,    /* vgroup identifier */
+           file1_id;  /* HDF file identifier */
+     
+     /* create a HDF file */
+     if ((file1_id = Hopen (FILE7_NAME, DFACC_CREATE, (int16)0))<0)
+     {
+         printf("Error: Could not create file <%s>\n",FILE7_NAME);
+         return FAIL;
+     }
+     
+     /* initialize the V interface */
+     if (Vstart (file1_id)==FAIL)
+     {
+         printf( "Could not start VG\n");
+         return FAIL;
+     }
+     
+     /* create a vgroup */
+     vg0_id = Vattach (file1_id, -1, "w");
+     if (Vsetname (vg0_id, "g0")==FAIL)
+     {
+         printf( "Could not name group\n");
+         goto out;
+     }
+     
+     /* create the second vgroup */
+     vg1_id = Vattach (file1_id, -1, "w");
+     if (Vsetname (vg1_id, "g1")==FAIL)
+     {
+         printf( "Could not name group\n");
+         goto out;
+     }
+     
+     /* create the third vgroup */
+     vg2_id = Vattach (file1_id, -1, "w");
+     if (Vsetname (vg2_id, "g1.1")==FAIL)
+     {
+         printf( "Could not name group\n");
+         goto out;
+     }
+  
+     if (Vinsert (vg0_id, vg1_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     if (Vinsert (vg0_id, vg2_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     if (Vinsert (vg1_id, vg2_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     if (Vinsert (vg2_id, vg1_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     /* terminate access to the vgroup */
+     if (Vdetach (vg0_id)==FAIL)
+     {
+         printf( "Could not close group\n");
+         goto out;
+     }
+     
+     /* terminate access to the vgroup */
+     if (Vdetach (vg1_id)==FAIL)
+     {
+         printf( "Could not close group\n");
+         goto out;
+     }
+     
+     /* terminate access to the vgroup */
+     if (Vdetach (vg2_id)==FAIL)
+     {
+         printf( "Could not close group\n");
+         goto out;
+     }
+     
+     /* terminate access to the V interface */
+     if (Vend (file1_id)==FAIL)
+     {
+         printf( "Could not end VG\n");
+         goto out;
+     }
+     
+     /* close the HDF file */
+     if (Hclose (file1_id)==FAIL)
+     {
+         printf( "Could not close file\n");
+         return FAIL;
+     }
+     
+     return SUCCEED;
+     
+out:
+     printf("Error...Exiting...\n");
+     return FAIL;
+     
+}
+
diff --git a/mfhdf/hdiff/testfiles/hdiff_01.txt b/mfhdf/hdiff/testfiles/hdiff_01.txt
new file mode 100644
index 0000000..bdf736d
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_01.txt
@@ -0,0 +1,21 @@
+hdiff [-V] [-b] [-g] [-s] [-d] [-D] [-S] [-v var1[,...]] [-u var1[,...]] [-e count] [-t limit] [-p relative] file1 file2
+  [-V]              Display version of the HDF4 library and exit
+  [-b]              Verbose mode
+  [-g]              Compare global attributes only
+  [-s]              Compare SD local attributes only
+  [-d]              Compare SD data only
+  [-D]              Compare Vdata data only
+  [-S]              Print statistics
+  [-v var1[,...]]   Compare SD data on variable(s) <var1>,... only
+  [-u var1[,...]]   Compare vdata on variable(s) <var1>,... only
+  [-e count]        Print difference up to count number for each variable
+  [-t limit]        Print difference when it is greater than limit
+  [-p relative]     Print difference when it is greater than a relative limit
+  file1             File name of the first HDF file
+  file2             File name of the second HDF file
+
+The 'count' value must be a positive integer
+The 'limit' and 'relative' values must be positive numbers
+The -t compare criteria is |a - b| > limit
+The -p compare criteria is |(b-a)/a| > relative
+Return codes: 0 (no differences found), 1 (differences found)
diff --git a/mfhdf/hdiff/testfiles/hdiff_02.txt b/mfhdf/hdiff/testfiles/hdiff_02.txt
new file mode 100644
index 0000000..caca0e2
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_02.txt
@@ -0,0 +1,5 @@
+
+---------------------------
+Attr Name: File_contents
+< "Storm_track_data1"
+> "Storm_track_data2"
diff --git a/mfhdf/hdiff/testfiles/hdiff_03.txt b/mfhdf/hdiff/testfiles/hdiff_03.txt
new file mode 100644
index 0000000..eb4f320
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_03.txt
@@ -0,0 +1,7 @@
+
+---------------------------
+dset1:Valid_range = 
+<<<<
+1.f, 1.f ;
+>>>>
+1.f, 2.f ;
diff --git a/mfhdf/hdiff/testfiles/hdiff_04.txt b/mfhdf/hdiff/testfiles/hdiff_04.txt
new file mode 100644
index 0000000..63c3d8b
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_04.txt
@@ -0,0 +1,17 @@
+position        dset1           dset1           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+position        dset2           dset2           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+position        dset3           dset3           difference          
+------------------------------------------------------------
+[ 0 0 ]          100             120             20             
+[ 0 1 ]          100             80              20             
+[ 1 0 ]          100             0               100            
+[ 1 1 ]          0               100             100            
+[ 2 1 ]          100             50              50             
diff --git a/mfhdf/hdiff/testfiles/hdiff_05.txt b/mfhdf/hdiff/testfiles/hdiff_05.txt
new file mode 100644
index 0000000..972445a
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_05.txt
@@ -0,0 +1,15 @@
+
+---------------------------
+Vdata Name: vdata1 (Data record comparison)
+> 0: V
+< 0: X
+
+---------------------------
+Vdata Name: vdata2 (Data record comparison)
+> 0: 1 2 3 4 
+< 0: 1 1 1 1 
+
+---------------------------
+Vdata Name: vdata3 (Data record comparison)
+> 0: 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 
+< 0: 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 
diff --git a/mfhdf/hdiff/testfiles/hdiff_06.txt b/mfhdf/hdiff/testfiles/hdiff_06.txt
new file mode 100644
index 0000000..e02b1a8
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_06.txt
@@ -0,0 +1,29 @@
+position        dset1           dset1           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+Type: Integer4  Npts: 6  Ndiff: 3 (50.000000%)
+Avg Diff: 1.000000e+00   Max. Diff: 3
+Range File1: 1/6  File2: 1/6
+Regression  N: 6  Slope: 6.727273e-01  Intercept: 1.818182e+00  R: 8.433083e-01
+position        dset2           dset2           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+Type: Integer4  Npts: 6  Ndiff: 3 (50.000000%)
+Avg Diff: 1.000000e+00   Max. Diff: 3
+Range File1: 1/6  File2: 1/6
+Regression  N: 6  Slope: 6.727273e-01  Intercept: 1.818182e+00  R: 8.433083e-01
+position        dset3           dset3           difference          
+------------------------------------------------------------
+[ 0 0 ]          100             120             20             
+[ 0 1 ]          100             80              20             
+[ 1 0 ]          100             0               100            
+[ 1 1 ]          0               100             100            
+[ 2 1 ]          100             50              50             
+Type: Integer4  Npts: 6  Ndiff: 5 (83.333333%)
+Avg Diff: 4.833333e+01   Max. Diff: 100
+Range File1: 0/100  File2: 0/120
+Regression  N: 6  Slope: 1.250000e-01  Intercept: 5.000000e+01  R: 1.271643e-01
diff --git a/mfhdf/hdiff/testfiles/hdiff_06w.txt b/mfhdf/hdiff/testfiles/hdiff_06w.txt
new file mode 100644
index 0000000..0a43708
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_06w.txt
@@ -0,0 +1,29 @@
+position        dset1           dset1           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+Type: Integer4  Npts: 6  Ndiff: 3 (50.000000%)
+Avg Diff: 1.000000e+000   Max. Diff: 3
+Range File1: 1/6  File2: 1/6
+Regression  N: 6  Slope: 6.727273e-001  Intercept: 1.818182e+000  R: 8.433083e-001
+position        dset2           dset2           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+Type: Integer4  Npts: 6  Ndiff: 3 (50.000000%)
+Avg Diff: 1.000000e+000   Max. Diff: 3
+Range File1: 1/6  File2: 1/6
+Regression  N: 6  Slope: 6.727273e-001  Intercept: 1.818182e+000  R: 8.433083e-001
+position        dset3           dset3           difference          
+------------------------------------------------------------
+[ 0 0 ]          100             120             20             
+[ 0 1 ]          100             80              20             
+[ 1 0 ]          100             0               100            
+[ 1 1 ]          0               100             100            
+[ 2 1 ]          100             50              50             
+Type: Integer4  Npts: 6  Ndiff: 5 (83.333333%)
+Avg Diff: 4.833333e+001   Max. Diff: 100
+Range File1: 0/100  File2: 0/120
+Regression  N: 6  Slope: 1.250000e-001  Intercept: 5.000000e+001  R: 1.271643e-001
diff --git a/mfhdf/hdiff/testfiles/hdiff_07.txt b/mfhdf/hdiff/testfiles/hdiff_07.txt
new file mode 100644
index 0000000..1d4b028
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_07.txt
@@ -0,0 +1,5 @@
+position        dset1           dset1           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
diff --git a/mfhdf/hdiff/testfiles/hdiff_08.txt b/mfhdf/hdiff/testfiles/hdiff_08.txt
new file mode 100644
index 0000000..99c2cb4
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_08.txt
@@ -0,0 +1,5 @@
+
+---------------------------
+Vdata Name: vdata1 (Data record comparison)
+> 0: V
+< 0: X
diff --git a/mfhdf/hdiff/testfiles/hdiff_09.txt b/mfhdf/hdiff/testfiles/hdiff_09.txt
new file mode 100644
index 0000000..aee289d
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_09.txt
@@ -0,0 +1,12 @@
+position        dset1           dset1           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+position        dset2           dset2           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+position        dset3           dset3           difference          
+------------------------------------------------------------
+[ 0 0 ]          100             120             20             
+[ 0 1 ]          100             80              20             
diff --git a/mfhdf/hdiff/testfiles/hdiff_10.txt b/mfhdf/hdiff/testfiles/hdiff_10.txt
new file mode 100644
index 0000000..4349961
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_10.txt
@@ -0,0 +1,13 @@
+position        dset1           dset1           difference          
+------------------------------------------------------------
+[ 1 1 ]          1               4               3              
+position        dset2           dset2           difference          
+------------------------------------------------------------
+[ 1 1 ]          1               4               3              
+position        dset3           dset3           difference          
+------------------------------------------------------------
+[ 0 0 ]          100             120             20             
+[ 0 1 ]          100             80              20             
+[ 1 0 ]          100             0               100            
+[ 1 1 ]          0               100             100            
+[ 2 1 ]          100             50              50             
diff --git a/mfhdf/hdiff/testfiles/hdiff_11.txt b/mfhdf/hdiff/testfiles/hdiff_11.txt
new file mode 100644
index 0000000..85f48fb
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_11.txt
@@ -0,0 +1,44 @@
+position        dset1           dset1           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+
+---------------------------
+dset1:Valid_range = 
+<<<<
+1.f, 1.f ;
+>>>>
+1.f, 2.f ;
+position        dset2           dset2           difference          
+------------------------------------------------------------
+[ 0 1 ]          1               2               1              
+[ 1 0 ]          1               3               2              
+[ 1 1 ]          1               4               3              
+position        dset3           dset3           difference          
+------------------------------------------------------------
+[ 0 0 ]          100             120             20             
+[ 0 1 ]          100             80              20             
+[ 1 0 ]          100             0               100            
+[ 1 1 ]          0               100             100            
+[ 2 1 ]          100             50              50             
+
+---------------------------
+Vdata Name: vdata1 (Data record comparison)
+> 0: V
+< 0: X
+
+---------------------------
+Vdata Name: vdata2 (Data record comparison)
+> 0: 1 2 3 4 
+< 0: 1 1 1 1 
+
+---------------------------
+Vdata Name: vdata3 (Data record comparison)
+> 0: 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 
+< 0: 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 
+
+---------------------------
+Attr Name: File_contents
+< "Storm_track_data1"
+> "Storm_track_data2"
diff --git a/mfhdf/hdiff/testfiles/hdiff_12.txt b/mfhdf/hdiff/testfiles/hdiff_12.txt
new file mode 100644
index 0000000..ed15358
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_12.txt
@@ -0,0 +1,7 @@
+position        dset3           dset3           difference          
+------------------------------------------------------------
+[ 0 0 ]          100             120             20%
+[ 0 1 ]          100             80              20%
+[ 1 0 ]          100             0               100%
+[ 1 1 ]          0               100             not comparable
+[ 2 1 ]          100             50              50%
diff --git a/mfhdf/hdiff/testfiles/hdiff_13.txt b/mfhdf/hdiff/testfiles/hdiff_13.txt
new file mode 100644
index 0000000..3a834ae
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_13.txt
@@ -0,0 +1,32 @@
+position        data1           data1           difference          
+------------------------------------------------------------
+[ 30 0 ]          1               0               1              
+[ 30 1 ]          2               0               2              
+[ 30 2 ]          3               0               3              
+[ 30 3 ]          4               0               4              
+[ 30 4 ]          5               0               5              
+[ 30 5 ]          6               0               6              
+[ 30 6 ]          7               0               7              
+[ 30 7 ]          8               0               8              
+[ 30 8 ]          9               0               9              
+[ 30 9 ]          10              0               10             
+[ 52438 0 ]          1               0               1              
+[ 52438 1 ]          2               0               2              
+[ 52438 2 ]          3               0               3              
+[ 52438 3 ]          4               0               4              
+[ 52438 4 ]          5               0               5              
+[ 52438 5 ]          6               0               6              
+[ 52438 6 ]          7               0               7              
+[ 52438 7 ]          8               0               8              
+[ 52438 8 ]          9               0               9              
+[ 52438 9 ]          10              0               10             
+[ 104856 0 ]          1               0               1              
+[ 104856 1 ]          2               0               2              
+[ 104856 2 ]          3               0               3              
+[ 104856 3 ]          4               0               4              
+[ 104856 4 ]          5               0               5              
+[ 104856 5 ]          6               0               6              
+[ 104856 6 ]          7               0               7              
+[ 104856 7 ]          8               0               8              
+[ 104856 8 ]          9               0               9              
+[ 104856 9 ]          10              0               10             
diff --git a/mfhdf/hdiff/testfiles/hdiff_14.txt b/mfhdf/hdiff/testfiles/hdiff_14.txt
new file mode 100644
index 0000000..5d9ad84
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_14.txt
@@ -0,0 +1,8 @@
+position        sds             sds             difference          
+------------------------------------------------------------
+[ 1 ]          2               0               2              
+[ 2 ]          3               0               3              
+position        lone            lone            difference          
+------------------------------------------------------------
+[ 1 ]          2               0               2              
+[ 2 ]          3               0               3              
diff --git a/mfhdf/hdiff/testfiles/hdiff_15.txt b/mfhdf/hdiff/testfiles/hdiff_15.txt
new file mode 100644
index 0000000..f1ff46e
--- /dev/null
+++ b/mfhdf/hdiff/testfiles/hdiff_15.txt
@@ -0,0 +1,19 @@
+---------------------------------------
+file 1   Tag    Ref    Name           
+---------------------------------------
+        1965      2    g0             
+        1965      3    g0/g1          
+        1965      4    g0/g1/g1.1     
+---------------------------------------
+file 2   Tag    Ref    Name           
+---------------------------------------
+        1965      2    g0             
+        1965      3    g0/g1          
+        1965      4    g0/g1/g1.1     
+---------------------------------------
+file1     file2
+---------------------------------------
+    x      x    g0             
+    x      x    g0/g1          
+    x      x    g0/g1/g1.1     
+
diff --git a/mfhdf/hdiff/testfiles/hdifftst1.hdf b/mfhdf/hdiff/testfiles/hdifftst1.hdf
new file mode 100644
index 0000000..5227d96
Binary files /dev/null and b/mfhdf/hdiff/testfiles/hdifftst1.hdf differ
diff --git a/mfhdf/hdiff/testfiles/hdifftst2.hdf b/mfhdf/hdiff/testfiles/hdifftst2.hdf
new file mode 100644
index 0000000..dffa65a
Binary files /dev/null and b/mfhdf/hdiff/testfiles/hdifftst2.hdf differ
diff --git a/mfhdf/hdiff/testfiles/hdifftst3.hdf b/mfhdf/hdiff/testfiles/hdifftst3.hdf
new file mode 100644
index 0000000..b5a633d
Binary files /dev/null and b/mfhdf/hdiff/testfiles/hdifftst3.hdf differ
diff --git a/mfhdf/hdiff/testfiles/hdifftst4.hdf b/mfhdf/hdiff/testfiles/hdifftst4.hdf
new file mode 100644
index 0000000..99e4704
Binary files /dev/null and b/mfhdf/hdiff/testfiles/hdifftst4.hdf differ
diff --git a/mfhdf/hdiff/testfiles/hdifftst5.hdf b/mfhdf/hdiff/testfiles/hdifftst5.hdf
new file mode 100644
index 0000000..8263d8d
Binary files /dev/null and b/mfhdf/hdiff/testfiles/hdifftst5.hdf differ
diff --git a/mfhdf/hdiff/testfiles/hdifftst6.hdf b/mfhdf/hdiff/testfiles/hdifftst6.hdf
new file mode 100644
index 0000000..865415d
Binary files /dev/null and b/mfhdf/hdiff/testfiles/hdifftst6.hdf differ
diff --git a/mfhdf/hdiff/testfiles/hdifftst7.hdf b/mfhdf/hdiff/testfiles/hdifftst7.hdf
new file mode 100644
index 0000000..0b59ad6
Binary files /dev/null and b/mfhdf/hdiff/testfiles/hdifftst7.hdf differ
diff --git a/mfhdf/hdiff/testhdiff.sh.in b/mfhdf/hdiff/testhdiff.sh.in
new file mode 100755
index 0000000..de3523b
--- /dev/null
+++ b/mfhdf/hdiff/testhdiff.sh.in
@@ -0,0 +1,177 @@
+#! /bin/sh
+# Tests for the hdiff tool
+
+srcdir=@srcdir@
+
+HDIFF=hdiff               # The tool name
+HDIFF_BIN=`pwd`/$HDIFF    # The path of the tool binary
+
+CMP='cmp -s'
+DIFF='diff -c'
+
+nerrors=0
+verbose=yes
+
+test -d testfiles || mkdir testfiles
+
+# Print message with formats according to message level ($1)
+MESG() {
+  level=$1
+  shift
+  case $level in
+    0)
+      echo '============================='
+      echo $*
+      echo '============================='
+      ;;
+    3)
+      echo '-----------------------------'
+      echo $*
+      echo '-----------------------------'
+      ;;
+    6)
+      echo "*** $* ***"
+      ;;
+    *)
+      echo "MESG(): Unknown level ($level)"
+      exit 1
+      ;;
+  esac
+}
+
+
+# Report the result and exit
+FINISH()
+{
+    if [ $nerrors -eq 0 ]
+    then
+	MESG 0 "All hdiff tests passed"
+    else
+	MESG 0 "hdiff tests failed: $nerrors"
+    fi
+    exit $nerrors
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+   SPACES="                                                               "
+   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Run a test and print PASS or *FAIL*.  If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display the
+# difference between the actual output and the expected output. The
+# expected output is given as the first argument to this function and
+# the actual output file is calculated by replacing the `.ddl' with
+# `.out'.  The actual output is not removed if $HDF5_NOCLEANUP has a
+# non-zero value.
+#
+TOOLTEST() {
+   expect="$srcdir/testfiles/$1"
+   actual="testfiles/`basename $1 .txt`.out"
+   actual_err="testfiles/`basename $1 .txt`.err"
+   shift
+
+   # Run test.
+   # Tflops interprets "$@" as "" when no parameter is given (e.g., the
+   # case of missing file name).  Changed it to use $@ till Tflops fixes it.
+   TESTING $HDIFF $@
+   (
+      cd $srcdir/testfiles
+      if [ "`uname -s`" = "TFLOPS O/S" ]; then
+        ${TESTS_ENVIRONMENT} $HDIFF_BIN $@
+      else
+        ${TESTS_ENVIRONMENT} $HDIFF_BIN "$@"
+      fi
+   ) >$actual 2>$actual_err
+   cat $actual_err >> $actual
+
+ 
+   # Used only to create the output file; uncomment to create
+      if [ ! -f $expect ]; then
+   # Create the expected file if it doesn't yet exist.
+      echo " CREATED"
+      cp $actual $expect
+   #   elif
+   elif $CMP $expect $actual; then
+      echo " PASSED"
+   else
+      echo "*FAILED*"
+      echo "    Expected result (*.txt) differs from actual result (*.out)"
+      nerrors="`expr $nerrors + 1`"
+      test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/    /'
+   fi
+
+   # Clean up output file
+     if test -z "$HDF4_NOCLEANUP"; then
+     rm -f $actual $actual_err
+     fi
+}
+
+
+
+
+RUN() {
+
+# help message
+TOOLTEST hdiff_01.txt 
+
+# Compare global attributes only
+TOOLTEST hdiff_02.txt -g hdifftst1.hdf hdifftst2.hdf
+
+# Compare SD local attributes only
+TOOLTEST hdiff_03.txt -s hdifftst1.hdf hdifftst2.hdf
+
+# Compare SD data only
+TOOLTEST hdiff_04.txt -d hdifftst1.hdf hdifftst2.hdf
+
+# Compare Vdata data only
+TOOLTEST hdiff_05.txt -D hdifftst1.hdf hdifftst2.hdf
+
+# Print statistics
+TOOLTEST hdiff_06.txt -d -S hdifftst1.hdf hdifftst2.hdf
+
+# Compare SD data on variable(s)
+TOOLTEST hdiff_07.txt -d -v dset1 hdifftst1.hdf hdifftst2.hdf
+
+# Compare vdata on variable(s) 
+TOOLTEST hdiff_08.txt -D -u vdata1 hdifftst1.hdf hdifftst2.hdf
+
+# Print difference up to count number
+TOOLTEST hdiff_09.txt -d -e 2 hdifftst1.hdf hdifftst2.hdf
+
+# Print difference when it is greater than limit
+TOOLTEST hdiff_10.txt -d -t 2 hdifftst1.hdf hdifftst2.hdf
+
+# no options
+TOOLTEST hdiff_11.txt hdifftst1.hdf hdifftst2.hdf
+
+# percent (relative)
+TOOLTEST hdiff_12.txt -d -p 0.05 -v dset3 hdifftst1.hdf hdifftst2.hdf
+
+# hyperslab reading 
+TOOLTEST hdiff_13.txt hdifftst3.hdf hdifftst4.hdf
+
+# lone dim
+TOOLTEST hdiff_14.txt hdifftst5.hdf hdifftst6.hdf
+
+# group loop
+TOOLTEST hdiff_15.txt -b hdifftst7.hdf hdifftst7.hdf
+
+}
+
+
+##############################################################################
+###			  T H E   T E S T S                                            ###
+##############################################################################
+
+# Print a beginning banner
+MESG 0 "Running hdiff tests"
+
+# compare output
+RUN
+
+# End of test, return exit code
+FINISH
diff --git a/mfhdf/hrepack/CMakeLists.txt b/mfhdf/hrepack/CMakeLists.txt
new file mode 100644
index 0000000..fb24c34
--- /dev/null
+++ b/mfhdf/hrepack/CMakeLists.txt
@@ -0,0 +1,69 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_HREPACK)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_SOURCE_DIR}/mfhdf/hdiff)
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+SET (hrepack_SRCS
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_an.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_gr.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_list.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_lsttable.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_main.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_opttable.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_parse.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_sds.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_utils.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_vg.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_vs.c
+    ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_dim.c
+)
+  
+ADD_EXECUTABLE (hrepack ${hrepack_SRCS})
+TARGET_C_PROPERTIES (hrepack " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hrepack ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hrepack ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_NAMING (hrepack ${LIB_TYPE})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+
+INSTALL_PROGRAM_PDB (hrepack ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+
+INSTALL (
+    TARGETS
+        hrepack
+    RUNTIME DESTINATION
+        ${HDF4_INSTALL_TOOLS_BIN_DIR}
+    COMPONENT
+        toolsapplications
+)
diff --git a/mfhdf/hrepack/CMakeTests.cmake b/mfhdf/hrepack/CMakeTests.cmake
new file mode 100644
index 0000000..65d89e1
--- /dev/null
+++ b/mfhdf/hrepack/CMakeTests.cmake
@@ -0,0 +1,101 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+#-- Adding test for hrepack_check
+
+  SET (hrepack_check_SRCS
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_check.c
+  )
+  
+  ADD_EXECUTABLE (hrepack_check ${hrepack_check_SRCS})
+  TARGET_C_PROPERTIES (hrepack_check " " " ")
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (hrepack_check ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (hrepack_check ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+  TARGET_NAMING (hrepack_check ${LIB_TYPE})
+
+#-- Adding test for test_hrepack
+
+  SET (test_hrepack_SRCS
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_an.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_gr.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_list.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_lsttable.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_opttable.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_parse.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_sds.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_utils.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_vg.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_dim.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_vs.c
+      ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepacktst.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_array.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_gattr.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_gr.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_list.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_mattbl.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_misc.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_sds.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_table.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_vs.c
+      ${HDF4_SOURCE_DIR}/mfhdf/hdiff/hdiff_dim.c
+  )
+  
+  ADD_EXECUTABLE (test_hrepack ${test_hrepack_SRCS})
+  TARGET_C_PROPERTIES (test_hrepack " " " ")
+  IF (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (test_hrepack ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+  ELSE (HDF4_BUILD_XDR_LIB)
+    TARGET_LINK_LIBRARIES (test_hrepack ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  ENDIF (HDF4_BUILD_XDR_LIB)
+  TARGET_NAMING (test_hrepack ${LIB_TYPE})
+ 
+#-- Copy all the dat files from the test directory into the source directory
+  SET (HDF4_REPACK_TEST_FILES
+      image24pixel.txt
+      image24plane.txt
+      image8.txt
+      info.txt
+  )
+ 
+  FOREACH (h4_file ${HDF4_REPACK_TEST_FILES})
+    SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+    #MESSAGE (STATUS " Copying ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
+    ADD_CUSTOM_COMMAND (
+        TARGET     test_hrepack 
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/${h4_file} ${dest}
+    )
+  ENDFOREACH (h4_file ${HDF4_REPACK_TEST_FILES})
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME hrepack-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          hrepacktst1.hdf
+          hrepacktst1_out.hdf
+          hrepacktst2.hdf
+          hrepacktst2_out.hdf
+          hrepacktst3.hdf
+          hrepacktst3_out.hdf
+  )
+
+#  ADD_TEST (NAME hrepack_check COMMAND $<TARGET_FILE:hrepack_check>)
+  
+  ADD_TEST (NAME test_hrepack COMMAND $<TARGET_FILE:test_hrepack>)
+  SET_TESTS_PROPERTIES (test_hrepack PROPERTIES DEPENDS hrepack-clearall-objects LABELS ${PROJECT_NAME})
diff --git a/mfhdf/hrepack/Makefile.am b/mfhdf/hrepack/Makefile.am
new file mode 100644
index 0000000..a43494f
--- /dev/null
+++ b/mfhdf/hrepack/Makefile.am
@@ -0,0 +1,66 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/hdiff    \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+## Add hrepack specific linker flags here
+hrepack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+bin_PROGRAMS = hrepack
+
+hrepack_SOURCES = hrepack.c hrepack_an.c hrepack_gr.c                       \
+                  hrepack_list.c hrepack_lsttable.c hrepack_main.c          \
+                  hrepack_opttable.c hrepack_parse.c                        \
+                  hrepack_sds.c hrepack_utils.c                             \
+                  hrepack_vg.c hrepack_vs.c hrepack_dim.c
+hrepack_LDADD = $(LIBMFHDF) $(LIBHDF)
+hrepack_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+##                   Testing -- Here there be dragons.                     ##
+#############################################################################
+
+check_PROGRAMS = hrepack_check test_hrepack
+TEST_PROG = test_hrepack
+
+test_hrepack_SOURCES = hrepack.c hrepack_an.c hrepack_gr.c                  \
+                       hrepack_list.c hrepack_lsttable.c hrepack_opttable.c \
+                       hrepack_parse.c hrepack_sds.c                        \
+                       hrepack_utils.c hrepack_vg.c                         \
+                       hrepack_dim.c                                        \
+                       hrepack_vs.c  hrepacktst.c                           \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff.c                                     \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_array.c $(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c        \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_gr.c $(top_srcdir)/mfhdf/hdiff/hdiff_list.c            \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c $(top_srcdir)/mfhdf/hdiff/hdiff_misc.c        \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_sds.c $(top_srcdir)/mfhdf/hdiff/hdiff_table.c          \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_vs.c $(top_srcdir)/mfhdf/hdiff/hdiff_dim.c
+test_hrepack_LDADD = $(LIBMFHDF) $(LIBHDF) -lm
+test_hrepack_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+hrepack_check_SOURCES = hrepack_check.c
+hrepack_check_LDADD = $(LIBMFHDF) $(LIBHDF)
+hrepack_check_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += *.hdf
+
+DISTCLEANFILES =
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/hrepack/Makefile.in b/mfhdf/hrepack/Makefile.in
new file mode 100644
index 0000000..d5d7685
--- /dev/null
+++ b/mfhdf/hrepack/Makefile.in
@@ -0,0 +1,1036 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/hrepack_all.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+bin_PROGRAMS = hrepack$(EXEEXT)
+check_PROGRAMS = hrepack_check$(EXEEXT) test_hrepack$(EXEEXT)
+TESTS = $(am__EXEEXT_1)
+subdir = mfhdf/hrepack
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = hrepack_all.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_hrepack_OBJECTS = hrepack.$(OBJEXT) hrepack_an.$(OBJEXT) \
+	hrepack_gr.$(OBJEXT) hrepack_list.$(OBJEXT) \
+	hrepack_lsttable.$(OBJEXT) hrepack_main.$(OBJEXT) \
+	hrepack_opttable.$(OBJEXT) hrepack_parse.$(OBJEXT) \
+	hrepack_sds.$(OBJEXT) hrepack_utils.$(OBJEXT) \
+	hrepack_vg.$(OBJEXT) hrepack_vs.$(OBJEXT) \
+	hrepack_dim.$(OBJEXT)
+hrepack_OBJECTS = $(am_hrepack_OBJECTS)
+hrepack_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(hrepack_LDFLAGS) \
+	$(LDFLAGS) -o $@
+am_hrepack_check_OBJECTS = hrepack_check.$(OBJEXT)
+hrepack_check_OBJECTS = $(am_hrepack_check_OBJECTS)
+am_test_hrepack_OBJECTS = hrepack.$(OBJEXT) hrepack_an.$(OBJEXT) \
+	hrepack_gr.$(OBJEXT) hrepack_list.$(OBJEXT) \
+	hrepack_lsttable.$(OBJEXT) hrepack_opttable.$(OBJEXT) \
+	hrepack_parse.$(OBJEXT) hrepack_sds.$(OBJEXT) \
+	hrepack_utils.$(OBJEXT) hrepack_vg.$(OBJEXT) \
+	hrepack_dim.$(OBJEXT) hrepack_vs.$(OBJEXT) \
+	hrepacktst.$(OBJEXT) hdiff.$(OBJEXT) hdiff_array.$(OBJEXT) \
+	hdiff_gattr.$(OBJEXT) hdiff_gr.$(OBJEXT) hdiff_list.$(OBJEXT) \
+	hdiff_mattbl.$(OBJEXT) hdiff_misc.$(OBJEXT) \
+	hdiff_sds.$(OBJEXT) hdiff_table.$(OBJEXT) hdiff_vs.$(OBJEXT) \
+	hdiff_dim.$(OBJEXT)
+test_hrepack_OBJECTS = $(am_test_hrepack_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(hrepack_SOURCES) $(hrepack_check_SOURCES) \
+	$(test_hrepack_SOURCES)
+DIST_SOURCES = $(hrepack_SOURCES) $(hrepack_check_SOURCES) \
+	$(test_hrepack_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+am__EXEEXT_1 = test_hrepack$(EXEEXT)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog *.hdf
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/hdiff    \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+hrepack_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+hrepack_SOURCES = hrepack.c hrepack_an.c hrepack_gr.c                       \
+                  hrepack_list.c hrepack_lsttable.c hrepack_main.c          \
+                  hrepack_opttable.c hrepack_parse.c                        \
+                  hrepack_sds.c hrepack_utils.c                             \
+                  hrepack_vg.c hrepack_vs.c hrepack_dim.c
+
+hrepack_LDADD = $(LIBMFHDF) $(LIBHDF)
+hrepack_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+TEST_PROG = test_hrepack
+test_hrepack_SOURCES = hrepack.c hrepack_an.c hrepack_gr.c                  \
+                       hrepack_list.c hrepack_lsttable.c hrepack_opttable.c \
+                       hrepack_parse.c hrepack_sds.c                        \
+                       hrepack_utils.c hrepack_vg.c                         \
+                       hrepack_dim.c                                        \
+                       hrepack_vs.c  hrepacktst.c                           \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff.c                                     \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_array.c $(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c        \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_gr.c $(top_srcdir)/mfhdf/hdiff/hdiff_list.c            \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c $(top_srcdir)/mfhdf/hdiff/hdiff_misc.c        \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_sds.c $(top_srcdir)/mfhdf/hdiff/hdiff_table.c          \
+                       $(top_srcdir)/mfhdf/hdiff/hdiff_vs.c $(top_srcdir)/mfhdf/hdiff/hdiff_dim.c
+
+test_hrepack_LDADD = $(LIBMFHDF) $(LIBHDF) -lm
+test_hrepack_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+hrepack_check_SOURCES = hrepack_check.c
+hrepack_check_LDADD = $(LIBMFHDF) $(LIBHDF)
+hrepack_check_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+DISTCLEANFILES = 
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/hrepack/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/hrepack/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+hrepack_all.sh: $(top_builddir)/config.status $(srcdir)/hrepack_all.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+hrepack$(EXEEXT): $(hrepack_OBJECTS) $(hrepack_DEPENDENCIES) $(EXTRA_hrepack_DEPENDENCIES) 
+	@rm -f hrepack$(EXEEXT)
+	$(hrepack_LINK) $(hrepack_OBJECTS) $(hrepack_LDADD) $(LIBS)
+hrepack_check$(EXEEXT): $(hrepack_check_OBJECTS) $(hrepack_check_DEPENDENCIES) $(EXTRA_hrepack_check_DEPENDENCIES) 
+	@rm -f hrepack_check$(EXEEXT)
+	$(LINK) $(hrepack_check_OBJECTS) $(hrepack_check_LDADD) $(LIBS)
+test_hrepack$(EXEEXT): $(test_hrepack_OBJECTS) $(test_hrepack_DEPENDENCIES) $(EXTRA_test_hrepack_DEPENDENCIES) 
+	@rm -f test_hrepack$(EXEEXT)
+	$(LINK) $(test_hrepack_OBJECTS) $(test_hrepack_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_array.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_dim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_gattr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_gr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_list.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_mattbl.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_misc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_sds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_table.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdiff_vs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_an.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_check.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_dim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_gr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_list.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_lsttable.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_opttable.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_parse.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_sds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_utils.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_vg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepack_vs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hrepacktst.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+hdiff.o: $(top_srcdir)/mfhdf/hdiff/hdiff.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff.o -MD -MP -MF $(DEPDIR)/hdiff.Tpo -c -o hdiff.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff.Tpo $(DEPDIR)/hdiff.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff.c' object='hdiff.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff.c
+
+hdiff.obj: $(top_srcdir)/mfhdf/hdiff/hdiff.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff.obj -MD -MP -MF $(DEPDIR)/hdiff.Tpo -c -o hdiff.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff.Tpo $(DEPDIR)/hdiff.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff.c' object='hdiff.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff.c'; fi`
+
+hdiff_array.o: $(top_srcdir)/mfhdf/hdiff/hdiff_array.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_array.o -MD -MP -MF $(DEPDIR)/hdiff_array.Tpo -c -o hdiff_array.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_array.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_array.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_array.Tpo $(DEPDIR)/hdiff_array.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_array.c' object='hdiff_array.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_array.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_array.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_array.c
+
+hdiff_array.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_array.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_array.obj -MD -MP -MF $(DEPDIR)/hdiff_array.Tpo -c -o hdiff_array.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_array.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_array.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_array.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_array.Tpo $(DEPDIR)/hdiff_array.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_array.c' object='hdiff_array.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_array.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_array.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_array.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_array.c'; fi`
+
+hdiff_gattr.o: $(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_gattr.o -MD -MP -MF $(DEPDIR)/hdiff_gattr.Tpo -c -o hdiff_gattr.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_gattr.Tpo $(DEPDIR)/hdiff_gattr.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c' object='hdiff_gattr.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_gattr.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c
+
+hdiff_gattr.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_gattr.obj -MD -MP -MF $(DEPDIR)/hdiff_gattr.Tpo -c -o hdiff_gattr.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_gattr.Tpo $(DEPDIR)/hdiff_gattr.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c' object='hdiff_gattr.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_gattr.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_gattr.c'; fi`
+
+hdiff_gr.o: $(top_srcdir)/mfhdf/hdiff/hdiff_gr.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_gr.o -MD -MP -MF $(DEPDIR)/hdiff_gr.Tpo -c -o hdiff_gr.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_gr.Tpo $(DEPDIR)/hdiff_gr.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c' object='hdiff_gr.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_gr.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c
+
+hdiff_gr.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_gr.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_gr.obj -MD -MP -MF $(DEPDIR)/hdiff_gr.Tpo -c -o hdiff_gr.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_gr.Tpo $(DEPDIR)/hdiff_gr.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c' object='hdiff_gr.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_gr.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_gr.c'; fi`
+
+hdiff_list.o: $(top_srcdir)/mfhdf/hdiff/hdiff_list.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_list.o -MD -MP -MF $(DEPDIR)/hdiff_list.Tpo -c -o hdiff_list.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_list.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_list.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_list.Tpo $(DEPDIR)/hdiff_list.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_list.c' object='hdiff_list.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_list.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_list.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_list.c
+
+hdiff_list.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_list.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_list.obj -MD -MP -MF $(DEPDIR)/hdiff_list.Tpo -c -o hdiff_list.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_list.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_list.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_list.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_list.Tpo $(DEPDIR)/hdiff_list.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_list.c' object='hdiff_list.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_list.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_list.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_list.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_list.c'; fi`
+
+hdiff_mattbl.o: $(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_mattbl.o -MD -MP -MF $(DEPDIR)/hdiff_mattbl.Tpo -c -o hdiff_mattbl.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_mattbl.Tpo $(DEPDIR)/hdiff_mattbl.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c' object='hdiff_mattbl.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_mattbl.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c
+
+hdiff_mattbl.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_mattbl.obj -MD -MP -MF $(DEPDIR)/hdiff_mattbl.Tpo -c -o hdiff_mattbl.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_mattbl.Tpo $(DEPDIR)/hdiff_mattbl.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c' object='hdiff_mattbl.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_mattbl.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_mattbl.c'; fi`
+
+hdiff_misc.o: $(top_srcdir)/mfhdf/hdiff/hdiff_misc.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_misc.o -MD -MP -MF $(DEPDIR)/hdiff_misc.Tpo -c -o hdiff_misc.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_misc.Tpo $(DEPDIR)/hdiff_misc.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c' object='hdiff_misc.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_misc.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c
+
+hdiff_misc.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_misc.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_misc.obj -MD -MP -MF $(DEPDIR)/hdiff_misc.Tpo -c -o hdiff_misc.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_misc.Tpo $(DEPDIR)/hdiff_misc.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c' object='hdiff_misc.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_misc.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_misc.c'; fi`
+
+hdiff_sds.o: $(top_srcdir)/mfhdf/hdiff/hdiff_sds.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_sds.o -MD -MP -MF $(DEPDIR)/hdiff_sds.Tpo -c -o hdiff_sds.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_sds.Tpo $(DEPDIR)/hdiff_sds.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c' object='hdiff_sds.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_sds.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c
+
+hdiff_sds.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_sds.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_sds.obj -MD -MP -MF $(DEPDIR)/hdiff_sds.Tpo -c -o hdiff_sds.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_sds.Tpo $(DEPDIR)/hdiff_sds.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c' object='hdiff_sds.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_sds.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_sds.c'; fi`
+
+hdiff_table.o: $(top_srcdir)/mfhdf/hdiff/hdiff_table.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_table.o -MD -MP -MF $(DEPDIR)/hdiff_table.Tpo -c -o hdiff_table.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_table.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_table.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_table.Tpo $(DEPDIR)/hdiff_table.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_table.c' object='hdiff_table.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_table.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_table.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_table.c
+
+hdiff_table.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_table.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_table.obj -MD -MP -MF $(DEPDIR)/hdiff_table.Tpo -c -o hdiff_table.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_table.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_table.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_table.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_table.Tpo $(DEPDIR)/hdiff_table.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_table.c' object='hdiff_table.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_table.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_table.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_table.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_table.c'; fi`
+
+hdiff_vs.o: $(top_srcdir)/mfhdf/hdiff/hdiff_vs.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_vs.o -MD -MP -MF $(DEPDIR)/hdiff_vs.Tpo -c -o hdiff_vs.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_vs.Tpo $(DEPDIR)/hdiff_vs.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c' object='hdiff_vs.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_vs.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c
+
+hdiff_vs.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_vs.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_vs.obj -MD -MP -MF $(DEPDIR)/hdiff_vs.Tpo -c -o hdiff_vs.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_vs.Tpo $(DEPDIR)/hdiff_vs.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c' object='hdiff_vs.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_vs.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_vs.c'; fi`
+
+hdiff_dim.o: $(top_srcdir)/mfhdf/hdiff/hdiff_dim.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_dim.o -MD -MP -MF $(DEPDIR)/hdiff_dim.Tpo -c -o hdiff_dim.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_dim.Tpo $(DEPDIR)/hdiff_dim.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c' object='hdiff_dim.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_dim.o `test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c
+
+hdiff_dim.obj: $(top_srcdir)/mfhdf/hdiff/hdiff_dim.c
+ at am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hdiff_dim.obj -MD -MP -MF $(DEPDIR)/hdiff_dim.Tpo -c -o hdiff_dim.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c'; fi`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/hdiff_dim.Tpo $(DEPDIR)/hdiff_dim.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c' object='hdiff_dim.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hdiff_dim.obj `if test -f '$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c'; then $(CYGPATH_W) '$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/mfhdf/hdiff/hdiff_dim.c'; fi`
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool cscopelist ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-binPROGRAMS
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/hrepack/hrepack.c b/mfhdf/hrepack/hrepack.c
new file mode 100644
index 0000000..87a0802
--- /dev/null
+++ b/mfhdf/hrepack/hrepack.c
@@ -0,0 +1,464 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hrepack.h"
+#include "hrepack_parse.h"
+#include "hrepack_opttable.h"
+
+
+int print_options(options_t *options);
+
+/*-------------------------------------------------------------------------
+ * Function: hrepack
+ *
+ * Purpose: locate all high-level HDF objects in the file 
+ *  and compress/chunk them using options
+ *
+ * Algorythm: 2 traversals are made to the file; the 1st builds a list of
+ *  the high-level objects, the 2nd makes a copy of them, using the options;
+ *  the reason for the 1st traversal is to check for invalid object name requests
+ *
+ * Return: FAIL, SUCCEED
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 10, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+int hrepack_main(const char* infile, 
+            const char* outfile, 
+            options_t *options)
+{
+    options->trip=0;
+    
+    /* also checks input */
+    if (print_options(options)<0)
+        return FAIL;
+    
+    /* first check for objects in input that are in the file */
+    if (list_main(infile,outfile,options)<0)
+        return FAIL;
+    
+    /* the real deal now */
+    options->trip=1;
+    
+    if (options->verbose)
+        printf("Making new file %s...\n",outfile);
+    
+    /* this can fail for different reasons */
+    if (list_main(infile,outfile,options)<0)
+        return FAIL;
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: hrepack_addcomp
+ *
+ * Purpose: add a compression -t option to table 
+ *   Example: -t "*:GZIP 6" 
+ *
+ * Return: FAIL, SUCCEED
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 23, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int hrepack_addcomp(const char* str, 
+                    options_t *options)
+{
+    
+    obj_list_t      *obj_list=NULL; /*one object list for the -t and -c option entry */
+    comp_info_t     comp;           /*compression info for the current -t option entry */
+    int             n_objs;         /*number of objects in the current -t or -c option entry */
+    int             i;
+    
+    if (options->all_comp==1){
+        printf("Error: Invalid compression input: '*' is present with other objects <%s>\n",str);
+        return FAIL;
+    }
+    
+    /* initialize parse struct to FAIL */
+    memset(&comp,FAIL,sizeof(comp_info_t));
+    
+    /* parse the -t option */
+    if ((obj_list = parse_comp(str,&n_objs,&comp)) == NULL)
+        return FAIL;
+    
+    /* searh for the "*" all objects character */
+    for (i = 0; i < n_objs; i++) 
+    {
+        if (strcmp("*",obj_list[i].obj)==0)
+        {
+            /* if we are compressing all set the global comp type */
+            options->all_comp=1;
+            options->comp_g=comp;
+        }
+    }
+    
+    if (i>1 && options->all_comp==1)
+    {
+        printf("\nError: '*' cannot be with other objects, <%s>. Exiting...\n",str);
+        goto out;
+        
+    }
+    
+    if (options->all_comp==0)
+    {
+        if (options_add_comp(obj_list,n_objs,comp,options->op_tbl)<0)
+            goto out;
+    }
+    
+    
+    HDfree(obj_list);
+    return SUCCEED;
+    
+    
+out:
+    
+    HDfree(obj_list);
+    return FAIL;
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: hrepack_addchunk
+ *
+ * Purpose: add a chunk -c option to table 
+ *   Example: -c "*:2x2" , STR = "*:2x2"
+ *
+ * Return: FAIL, SUCCEED
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 23, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int hrepack_addchunk(const char* str, 
+                     options_t *options)
+{
+    
+    obj_list_t  *obj_list=NULL;     /*one object list for the -t and -c option entry */
+    int         n_objs;             /*number of objects in the current -t or -c option entry */
+    int32       chunk_lengths[H4_MAX_VAR_DIMS]; /* chunk lengths along each dimension */
+    int         chunk_rank;         /*global rank for chunks */
+    int         i, j;
+    
+    if (options->all_chunk==1){
+        printf("Error: Invalid chunking input: '*' is present with other objects <%s>\n",str);
+        return FAIL;
+    }
+    
+    /* parse the -c option */
+    if ((obj_list = parse_chunk(str,&n_objs,chunk_lengths,&chunk_rank)) == NULL)
+        return FAIL;
+    
+    /* searh for the "*" all objects character */
+    for (i = 0; i < n_objs; i++) 
+    {
+        if (strcmp("*",obj_list[i].obj)==0)
+        {
+            /* if we are chunking all set the global chunking type */
+            options->all_chunk=1;
+            options->chunk_g.rank=chunk_rank;
+            for (j = 0; j < chunk_rank; j++) 
+                options->chunk_g.chunk_lengths[j] = chunk_lengths[j];
+        }
+    }
+    
+    if (i>1)
+    {
+        printf("\nError: '*' cannot be with other objects, <%s>. Exiting...\n",str);
+        goto out;
+    }
+    
+    if (options->all_chunk==0)
+    {
+        if (options_add_chunk(obj_list,n_objs,chunk_lengths,chunk_rank,options->op_tbl)<0)
+            goto out;
+    }
+    
+    
+    HDfree(obj_list);
+    return SUCCEED;
+    
+    
+out:
+    
+    HDfree(obj_list);
+    return FAIL;
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: hrepack_init
+ *
+ * Purpose: initialize options
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void hrepack_init (options_t *options, 
+                  int verbose)
+{
+    memset(options,0,sizeof(options_t));
+    options->threshold = 1024;
+    options->verbose   = verbose;
+    options_table_init(&(options->op_tbl));
+}
+
+/*-------------------------------------------------------------------------
+ * Function: hrepack_end
+ *
+ * Purpose: free options table
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void hrepack_end  (options_t *options)
+{
+    options_table_free(options->op_tbl);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: print_options
+ *
+ * Purpose: print and check options
+ *
+ * Return: FAIL, SUCCEED
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 25, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+int print_options(options_t *options)
+{
+    int   i, k, j, has_cp=0, has_ck=0;
+    
+    /*-------------------------------------------------------------------------
+    * objects to chunk
+    *-------------------------------------------------------------------------
+    */
+    if (options->verbose) 
+    {
+        printf("Objects to chunk are...\n");
+        if (options->all_chunk==1)  {
+            printf("\tChunk all with dimension [");
+            for ( j = 0; j < options->chunk_g.rank; j++)  
+                printf("%ld ", options->chunk_g.chunk_lengths[j]);
+            printf("]\n");
+        }
+    }/* verbose */
+    
+    for ( i = 0; i < options->op_tbl->nelems; i++) 
+    {
+        char* obj_name=options->op_tbl->objs[i].objpath;
+        
+        if (options->op_tbl->objs[i].chunk.rank>0)
+        {
+            if (options->verbose){
+                printf("\t%s [",obj_name); 
+                for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) 
+                    printf("%ld ",options->op_tbl->objs[i].chunk.chunk_lengths[k]);
+                printf("]\n");
+            }
+            has_ck=1;
+        }
+        else if (options->op_tbl->objs[i].chunk.rank==-2)
+        {
+            if (options->verbose)
+                printf("\t%s %s\n",obj_name,"NONE"); 
+            has_ck=1;
+        }
+    }
+    
+    if (options->all_chunk==1 && has_ck){
+        printf("Error: Invalid chunking input: '*' is present with other objects\n");
+        return FAIL;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * objects to compress/uncompress
+    *-------------------------------------------------------------------------
+    */
+    
+    if (options->verbose) 
+    {
+        printf("Objects to compress are...\n");
+        if (options->all_comp==1) 
+        {
+            switch (options->comp_g.type)
+            {
+            default:
+                break;
+            case COMP_CODE_RLE:
+            case COMP_CODE_SZIP:
+                printf("\tCompress all with %s compression\n",
+                    get_scomp(options->comp_g.type));
+                break;
+            case COMP_CODE_SKPHUFF:
+            case COMP_CODE_DEFLATE:
+            case COMP_CODE_JPEG:
+                printf("\tCompress all with %s compression, parameter %d\n",
+                    get_scomp(options->comp_g.type),
+                    options->comp_g.info);
+                break;
+            };
+        }
+    } /* verbose */
+    
+    for ( i = 0; i < options->op_tbl->nelems; i++) 
+    {
+        pack_info_t obj=options->op_tbl->objs[i];
+        if (obj.comp.type>0)
+        {
+            char* obj_name=obj.objpath;
+            if (options->verbose) {
+                printf("\t%s %s compression, parameter %d\n",
+                    obj_name,
+                    get_scomp(obj.comp.type),
+                    obj.comp.info);
+            }
+            has_cp=1;
+        }
+    }
+    
+    if (options->all_comp==1 && has_cp){
+        printf("Error: Invalid compression input: * is present with other objects\n");
+        return FAIL;
+    }
+    
+    return SUCCEED;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: read_info
+ *
+ * Purpose: read comp and chunk options from file
+ *
+ * Return: FAIL, SUCCEED
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 30, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int read_info(const char *filename,
+              options_t *options) 
+{
+    char stype[10];
+    char comp_info[1024];
+    FILE *fp=NULL;
+    char c;
+    int  i, rc=1;
+    
+    
+    if ((fp = fopen(filename, "r")) == (FILE *)NULL) {
+        printf( "Cannot open options file %s", filename);
+        return FAIL;
+    }
+    
+    /* cycle until end of file reached */
+    while( 1 )
+    {
+        rc=fscanf(fp, "%s", stype);
+        if (rc==-1)
+            break;
+        
+       /*-------------------------------------------------------------------------
+        * comp
+        *-------------------------------------------------------------------------
+        */
+        if (strcmp(stype,"-t") == 0) { 
+            
+            /* find begining of info */
+            i=0; c='0';
+            while( c!='"' )
+            {
+                fscanf(fp, "%c", &c);
+            }
+            c='0';
+            /* go until end */
+            while( c!='"' )
+            {
+                fscanf(fp, "%c", &c);
+                comp_info[i]=c;
+                i++;
+            }
+            comp_info[i-1]='\0'; /*cut the last " */    
+            
+            if (hrepack_addcomp(comp_info,options)<0)
+                goto out;
+        }
+       /*-------------------------------------------------------------------------
+        * chunk
+        *-------------------------------------------------------------------------
+        */
+        else if (strcmp(stype,"-c") == 0) { 
+            
+            /* find begining of info */
+            i=0; c='0';
+            while( c!='"' )
+            {
+                fscanf(fp, "%c", &c);
+            }
+            c='0';
+            /* go until end */
+            while( c!='"' )
+            {
+                fscanf(fp, "%c", &c);
+                comp_info[i]=c;
+                i++;
+            }
+            comp_info[i-1]='\0'; /*cut the last " */    
+            
+            if (hrepack_addchunk(comp_info,options)<0)
+                goto out;
+        }
+       /*-------------------------------------------------------------------------
+        * not valid
+        *-------------------------------------------------------------------------
+        */
+        else {
+            printf( "Bad file format for %s", filename);
+            goto out;
+        }
+    }
+    
+    fclose(fp);
+    return SUCCEED;
+
+
+out:
+    if (fp!=NULL)
+        fclose(fp);
+    return FAIL;
+}
+
diff --git a/mfhdf/hrepack/hrepack.h b/mfhdf/hrepack/hrepack.h
new file mode 100644
index 0000000..ce72da3
--- /dev/null
+++ b/mfhdf/hrepack/hrepack.h
@@ -0,0 +1,93 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_H_
+#define REPACK_H_
+
+#include "hrepack_lsttable.h"
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+#define NN_MODE 0
+#define EC_MODE 1
+#define TAG_GRP_IMAGE DFTAG_RIG
+#define TAG_GRP_DSET  DFTAG_NDG
+
+/* a list of names */
+typedef struct {
+ char obj[H4_MAX_NC_NAME];
+} obj_list_t;
+
+/* the type of compression and additional parameter */
+typedef struct {
+ comp_coder_t type; /* compression enum type */
+ int info;          /* numerical parameter for several types of compression */
+ int szip_mode;     /* NN_MODE or EC_MODE */
+} comp_info_t;
+
+/* chunk lengths along each dimension and rank */
+typedef struct {
+ int32   chunk_lengths[H4_MAX_VAR_DIMS]; 
+ int     rank;
+} chunk_info_t;
+
+/* information for one object, contains PATH, CHUNK info and COMP info */
+typedef struct {
+ char         objpath[H4_MAX_NC_NAME];      /* name of object */
+ comp_info_t  comp;                         /* compression information */
+ chunk_info_t chunk;                        /* chunk information */
+} pack_info_t;
+
+/* store a list of all objects */
+typedef struct {
+ int        size;
+ int        nelems;
+ pack_info_t *objs;
+} options_table_t;
+
+
+/* all the above, ready to go to the hrepack call */
+typedef struct {
+ options_table_t *op_tbl;     /*table with all -c and -t options */
+ int             all_chunk;   /*chunk all objects, input of "*" */
+ int             all_comp;    /*comp all objects, input of "*" */
+ comp_info_t     comp_g;      /*global compress INFO for the ALL case */
+ chunk_info_t    chunk_g;     /*global chunk INFO for the ALL case */
+ int verbose;                 /*verbose mode */
+ int trip;                    /*which cycle are we in */
+ int threshold;               /*minimum size to compress, in bytes */
+} options_t;
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int  hrepack         (const char* infname, const char* outfname, options_t *options);
+int  hrepack_addcomp (const char* str, options_t *options);
+int  hrepack_addchunk(const char* str, options_t *options);
+void hrepack_init    (options_t *options, int verbose);
+void hrepack_end     (options_t *options);
+
+int  list(const char* infname,const char* outfname,options_t *options);
+int  read_info(const char *filename,options_t *options); 
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_H_ */
diff --git a/mfhdf/hrepack/hrepack_all.sh.in b/mfhdf/hrepack/hrepack_all.sh.in
new file mode 100755
index 0000000..82f2da7
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_all.sh.in
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+srcdir=@srcdir@
+
+for i in ./*.hdf
+do
+	echo "--------------------------------------------------"
+	echo $i
+	echo "--------------------------------------------------"
+	${TESTS_ENVIRONMENT} ../hrepack -v -i $i -o ${i}.output.hdf -t "*:GZIP 1"
+done
+ls -l
diff --git a/mfhdf/hrepack/hrepack_an.c b/mfhdf/hrepack/hrepack_an.c
new file mode 100644
index 0000000..9a8fb95
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_an.c
@@ -0,0 +1,287 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+
+#include "hrepack_an.h"
+
+/*-------------------------------------------------------------------------
+ * Function: copy_vg_an
+ *
+ * Purpose: copy Vgroup ANs
+ *
+ * Return: ok, 1, -1 not ok 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_vg_an(int32 infile_id,
+               int32 outfile_id,
+               int32 vgroup_id,
+               int32 vgroup_id_out, 
+               char *path,
+               options_t *options) 
+{
+    int32 ref_in,
+        tag_in,
+        ref_out,
+        tag_out;
+    
+    if ( options->trip==0 ) 
+    {
+        return 1;
+    }
+    
+    if ((ref_in = VQueryref(vgroup_id))==FAIL){
+        printf( "Failed to get ref for <%s>\n", path);
+        return-1;
+    }
+    if ((tag_in = VQuerytag(vgroup_id))==FAIL){
+        printf( "Failed to get tag for <%s>\n", path);
+        return-1;
+    }
+    if ((ref_out = VQueryref(vgroup_id_out))==FAIL){
+        printf( "Failed to get ref for <%s>\n", path);
+        return-1;
+    }
+    if ((tag_out = VQuerytag(vgroup_id_out))==FAIL){
+        printf( "Failed to get tag for <%s>\n", path);
+        return-1;
+    }
+    
+    if (copy_an(infile_id,
+        outfile_id,
+        ref_in,
+        tag_in,
+        ref_out,
+        tag_out, 
+        path,
+        options)<0)
+        return FAIL;
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_vs_an
+ *
+ * Purpose: copy Vdata ANs
+ *
+ * Return: ok, 1, -1 not ok 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_vs_an(int32 infile_id,
+               int32 outfile_id,
+               int32 vdata_id,
+               int32 vdata_id_out, 
+               char *path,
+               options_t *options) 
+{
+    int32 ref_in,
+        tag_in,
+        ref_out,
+        tag_out;
+    
+    if ( options->trip==0 ) 
+    {
+        return 1;
+    }
+    
+    if ((ref_in = VSQueryref(vdata_id))==FAIL){
+        printf( "Failed to get ref for <%s>\n", path);
+        return-1;
+    }
+    if ((tag_in = VSQuerytag(vdata_id))==FAIL){
+        printf( "Failed to get tag for <%s>\n", path);
+        return-1;
+    }
+    if ((ref_out = VSQueryref(vdata_id_out))==FAIL){
+        printf( "Failed to get ref for <%s>\n", path);
+        return-1;
+    }
+    if ((tag_out = VSQuerytag(vdata_id_out))==FAIL){
+        printf( "Failed to get tag for <%s>\n", path);
+        return-1;
+    }
+    
+    if (copy_an(infile_id,
+        outfile_id,
+        ref_in,
+        tag_in,
+        ref_out,
+        tag_out, 
+        path,
+        options)<0)
+        return FAIL;
+    
+    return 1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_an_data
+ *
+ * Purpose: copy DATA ANs
+ *
+ * Return: ok, 1, -1 not ok 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_an_data(int32 infile_id,
+                 int32 outfile_id,
+                 int32 ref_in, 
+                 int32 tag_in,
+                 int32 ref_out, 
+                 int32 tag_out,
+                 ann_type type, 
+                 char *path, 
+                 options_t *options) 
+{
+    int32 an_id,         /* AN interface identifier */
+        an_out,        /* AN interface identifier */
+        ann_id,        /* an annotation identifier */
+        ann_out,       /* an annotation identifier */
+        ann_length,    /* length of the text in an annotation */
+        n_anno;
+    int   i;             /* position of an annotation */
+    char *buf;           /* buffer to hold the read annotation */
+    int  is_label= (type==AN_DATA_LABEL)?1:0;
+    int  ret=0;
+    
+    if ( options->trip==0 ) 
+    {
+        return 1;
+    }
+    
+    /* Initialize the AN interface  */
+    an_id  = ANstart (infile_id);
+    an_out = ANstart (outfile_id);
+    
+    /* Get the number of ANs in this object  */
+    if((n_anno = ANnumann(an_id,type,(uint16)tag_in,(uint16)ref_in))==FAIL) {
+        printf( "Failed to get annotations for <%s>\n", path);
+        return-1;
+    }
+    
+    for (i = 0; i < n_anno; i++) 
+    {
+    /*-------------------------------------------------------------------------
+    * read
+    *-------------------------------------------------------------------------
+        */ 
+        if((ann_id = ANselect(an_id,i,type))==FAIL) {
+            printf( "Failed to select AN %d of <%s>\n", i, path);
+            continue;
+        }
+        if((ann_length = ANannlen(ann_id))==FAIL) {
+            printf( "Failed to get AN %d lenght of <%s>\n", i, path);
+            continue;
+        }
+        
+        /*
+        * Read the data label.  Note that the size of the buffer,
+        * i.e., the third parameter, is 1 character more than the length of
+        * the data label; that is for the null character.  It is not the case
+        * when a description is retrieved because the description does not 
+        * necessarily end with a null character.
+        * 
+        */
+        if (is_label)
+            ann_length++;
+        
+        if ((buf = (char *)malloc((ann_length)*sizeof(int8)))==NULL ) {
+            printf( "Failed to get memory for AN %d of <%s>\n", i, path);
+            continue;
+        }
+        if(ANreadann(ann_id,buf,ann_length)==FAIL){
+            printf( "Failed to read AN %d of <%s>\n", i, path);
+            if (buf) free(buf);
+            continue;
+        }
+        if(ANendaccess(ann_id)==FAIL){
+            printf( "Failed to end AN %d of <%s>\n", i, path);
+            if (buf) free(buf);
+            continue;
+        }
+        /*-------------------------------------------------------------------------
+        * write
+        *-------------------------------------------------------------------------
+        */  
+        /* Create the data label for the vgroup identified by its tag and ref number */
+        if((ann_out = ANcreate(an_out,(uint16)tag_out,(uint16)ref_out,type))==FAIL) {
+            printf( "Failed to create AN %d of <%s>\n", i, path);
+            continue;
+        }
+        /* Write the annotation  */
+        if (ANwriteann (ann_out,buf,ann_length)==FAIL){
+            printf( "Failed to write AN %d of <%s>\n", i, path);
+        }
+        if(ANendaccess(ann_out)==FAIL){
+            printf( "Failed to end AN %d of <%s>\n", i, path);
+            if (buf) free(buf);
+            continue;
+        }
+        if (buf) free(buf);
+    }
+    
+    /* Terminate access to the AN interface */
+    if (ANend (an_id)==FAIL){
+        printf( "Failed close AN for <%s>\n", path);
+        ret=-1;
+    }
+    if (ANend (an_out)==FAIL){
+        printf( "Failed close AN for <%s>\n", path);
+        ret=-1;
+    }
+    return ret;
+                 }
+                 
+
+/*-------------------------------------------------------------------------
+ * Function: copy_an
+ *
+ * Purpose: copy DATA ANs (AN_DATA_LABEL and AN_DATA_DESC)
+ *
+ * Return: ok, 1, -1 not ok 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_an(int32 infile_id,
+            int32 outfile_id,
+            int32 ref_in, 
+            int32 tag_in,
+            int32 ref_out, 
+            int32 tag_out,
+            char *path, 
+            options_t *options) 
+{
+    
+    if (copy_an_data(infile_id,outfile_id,
+        ref_in,tag_in,ref_out,tag_out, 
+        AN_DATA_LABEL,path,options)<0)
+        return FAIL;
+    if (copy_an_data(infile_id,outfile_id,
+        ref_in,tag_in,ref_out,tag_out,
+        AN_DATA_DESC,path,options)<0)
+        return FAIL;
+    
+    return SUCCEED;
+}
+
diff --git a/mfhdf/hrepack/hrepack_an.h b/mfhdf/hrepack/hrepack_an.h
new file mode 100644
index 0000000..0c09ed8
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_an.h
@@ -0,0 +1,63 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_AN_H_
+#define REPACK_AN_H_
+
+#include "hrepack.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int copy_an(int32 infile_id,int32 outfile_id,
+            int32 ref_in, int32 tag_in,
+            int32 ref_out, int32 tag_out,
+            char *path, options_t *options);
+
+
+int copy_vg_an(int32 infile_id,
+               int32 outfile_id,
+               int32 vgroup_id,
+               int32 vgroup_id_out, 
+               char *path,
+               options_t *options);
+
+int copy_vs_an(int32 infile_id,
+               int32 outfile_id,
+               int32 vdata_id,
+               int32 vdata_id_out, 
+               char *path,
+               options_t *options);
+
+int copy_an_data(int32 infile_id,
+                 int32 outfile_id,
+                 int32 ref_in, 
+                 int32 tag_in,
+                 int32 ref_out, 
+                 int32 tag_out,
+                 ann_type type, 
+                 char *path, 
+                 options_t *options);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_AN_H_ */
diff --git a/mfhdf/hrepack/hrepack_check.c b/mfhdf/hrepack/hrepack_check.c
new file mode 100644
index 0000000..9570d78
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_check.c
@@ -0,0 +1,297 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+
+static void usage(void);
+static int sds_get_compck(char *fname, char *sds_name);
+static int sds_get_all(char *fname);
+static const char* get_schunk(int32 flags);
+static const char* get_scomp(comp_coder_t code);
+
+
+int main(int argc, char **argv)
+{
+ if (argc==3)
+  sds_get_compck(argv[1], argv[2]);
+ else if (argc==2)
+  sds_get_all(argv[1]);
+ else {
+  usage();
+  return 1;
+ }
+ 
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: sds_get_compck
+ *
+ * Purpose: utility function to verify chunking and compressing for  SDS_NAME
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int sds_get_compck(char *fname, char *sds_name)
+{
+ HDF_CHUNK_DEF chunk_def;    /* chunk defintion read */ 
+ comp_coder_t  comp_type;    /* to retrieve compression type into */
+ comp_info     comp_info;    /* compression structure */ 
+ int32         chunk_flags;  /* chunking flag */ 
+ int32         sd_id,
+               sds_id, 
+               sds_index,
+               dimsizes[H4_MAX_VAR_DIMS],/* dimensional size of SDS */
+               nattrs,                /* number of SDS attributes */
+               dtype,                 /* SDS data type */
+               rank;                  /* rank of SDS */
+ int           i;
+
+ if ((sd_id = SDstart (fname, DFACC_RDONLY))==FAIL) {
+  printf("Error: cannot open file <%s>\n", fname);
+  return -1;
+ }
+ sds_index = SDnametoindex(sd_id, sds_name);
+ if ((sds_id = SDselect(sd_id, sds_index))==FAIL) {
+  printf("Error: cannot open sds <%s>\n", sds_name);
+  SDend (sd_id);
+  return -1;
+ }
+ SDgetchunkinfo (sds_id, &chunk_def, &chunk_flags);
+
+ /*obtain name,rank,dimsizes,datatype and num of attributes of sds */
+ SDgetinfo(sds_id,sds_name,&rank,dimsizes,&dtype,&nattrs);
+
+/*-------------------------------------------------------------------------
+ * print the dimensions
+ *-------------------------------------------------------------------------
+ */
+ 
+ printf("dimensions:  [");
+ for (i = 0; i < rank; i++)
+ {
+  printf("%ld ", dimsizes[i]);
+ }
+ printf("]\n");
+
+/*-------------------------------------------------------------------------
+ * print the chunk info
+ *-------------------------------------------------------------------------
+ */
+
+ printf("chunk flags:  %s \n", get_schunk(chunk_flags));
+ if (HDF_NONE != chunk_flags )
+ {
+  printf("chunk dimension:  [");
+  for (i = 0; i < rank; i++)
+  {
+   printf("%ld ", chunk_def.chunk_lengths[i]);
+  }
+  printf("]\n");
+ }
+
+
+/*-------------------------------------------------------------------------
+ * retrieve the compression info
+ *-------------------------------------------------------------------------
+ */
+ 
+ comp_type = COMP_CODE_NONE;  /* reset variables before retrieving info */
+ HDmemset(&comp_info, 0, sizeof(comp_info)) ;
+ SDgetcompinfo(sds_id, &comp_type, &comp_info);
+ 
+ printf("compression type:  %s \n", get_scomp(comp_type));
+ if (COMP_CODE_NONE != comp_type )
+ {
+  switch (comp_type)
+  {
+  default:
+   break;
+  case COMP_CODE_RLE:
+   break;
+  case COMP_CODE_SKPHUFF:
+   printf("skipping factor:  %d \n", comp_info.skphuff.skp_size);
+   break;
+  case COMP_CODE_DEFLATE:
+   printf("level:  %d \n", comp_info.deflate.level);
+   break;
+  case COMP_CODE_JPEG:
+   printf("quality factor:  %d \n", comp_info.jpeg.quality);
+   break;
+  case COMP_CODE_SZIP:
+   printf("pixels per block:  %ld \n", comp_info.szip.pixels_per_block);
+   break;
+  };
+ }
+
+ /* terminate access to the sds */
+ SDendaccess (sds_id);
+ 
+ /* terminate access to the sd interface */
+ SDend (sd_id);
+ 
+ return 0;
+ 
+}
+
+/*-------------------------------------------------------------------------
+ * Function: sds_get_all
+ *
+ * Purpose: utility function to ptint all SDSs names
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int sds_get_all(char *fname)
+{
+ int32         sd_id,
+               sds_id, 
+               sds_index,
+               n_datasets,   /* number of datasets in the file */
+               n_file_attrs, /* number of file attributes */
+               data_type,              /* number type  */
+               rrank,                  /* read rank */
+               n_attrs,                /* number of attributes */
+               dim_sizes[H4_MAX_VAR_DIMS];/* dimensions of an image */
+ char          name[H4_MAX_GR_NAME];      /* name of dataset */
+
+ /* initialize the sd interface */
+  if ((sd_id = SDstart (fname, DFACC_RDONLY))==FAIL) {
+  printf("Error: cannot open file <%s>\n", fname);
+  return -1;
+ }
+ 
+ /* determine the number of data sets in the file */
+ if (SDfileinfo (sd_id, &n_datasets, &n_file_attrs)==FAIL) {
+  printf("Error: Cannot get file information\n");
+  SDend (sd_id);
+  return -1;
+ }
+ 
+ printf("List of sds:\n");
+ for (sds_index = 0; sds_index < n_datasets; sds_index++)
+ {
+  sds_id   = SDselect (sd_id, sds_index);
+  
+  /* skip dimension scales */
+  if ( SDiscoordvar(sds_id) ) {
+   SDendaccess(sds_id);
+   continue;
+  }
+
+  SDgetinfo(sds_id, name, &rrank, dim_sizes, &data_type, &n_attrs);
+ 
+  printf("    %s\n", name);
+ 
+  /* terminate access to the current dataset */
+  SDendaccess (sds_id);
+ }
+ 
+ /* terminate access to the sd interface */
+ SDend (sd_id);
+ 
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_scomp
+ *
+ * Purpose: return the compression type as a string
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+const char* get_scomp(comp_coder_t code)
+{
+ if (code==COMP_CODE_RLE)
+  return "RLE";
+ else if (code==COMP_CODE_SKPHUFF)
+  return "HUFF";
+ else if (code==COMP_CODE_DEFLATE)
+  return "GZIP";
+ else if (code==COMP_CODE_JPEG)
+  return "JPEG";
+ if (code==COMP_CODE_SZIP)
+  return "SZIP";
+ else if (code==COMP_CODE_NONE)
+  return "NONE";
+ else {
+  printf("Input Error in compression type\n");
+  exit(1);
+ }
+ /* not reached */
+ return NULL;
+} 
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_schunk
+ *
+ * Purpose: return the chunking flags as a string
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+const char* get_schunk(int32 flags)
+{
+ if (flags==(HDF_CHUNK | HDF_COMP))
+  return "HDF_CHUNK | HDF_COMP";
+ else if (flags==(HDF_CHUNK))
+  return "HDF_CHUNK";
+ else if (flags==(HDF_COMP))
+  return "HDF_COMP";
+ else if (flags==(HDF_NONE))
+  return "HDF_NONE";
+ else
+  return "Invalid chunk flags";
+} 
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: print usage
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+void usage(void)
+{
+ printf("hrepack_check file_name <sds_name>\n");
+ printf("    file_name   HDF File\n");
+ printf("    sds_name    SDS name (if no name, a list of all names is printed)\n");
+}
diff --git a/mfhdf/hrepack/hrepack_dim.c b/mfhdf/hrepack/hrepack_dim.c
new file mode 100644
index 0000000..048139f
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_dim.c
@@ -0,0 +1,926 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hrepack.h"
+#include "hrepack_utils.h"
+#include "hrepack_sds.h"
+#include "hrepack_dim.h"
+
+
+/* match name between 2 dim_table_t type lists */
+typedef struct match_dim_name_t {
+    int32 ref;                       /* reference */
+    char  dim_name[H4_MAX_NC_NAME];  /* name */
+    int   flags[2];                  /* name exists 1, no 0 */  
+} match_dim_name_t;
+
+/* table for match_dim_name_t */
+typedef struct match_dim_table_t {
+    int        size;
+    int        nobjs;
+    match_dim_name_t *objs;
+} match_dim_table_t;
+
+/*-------------------------------------------------------------------------
+ * local prototypes
+ *-------------------------------------------------------------------------
+ */
+
+/* methods for match_dim_table_t */
+static void match_dim_table_free( match_dim_table_t *mdim_tbl );
+static void match_dim_table_init( match_dim_table_t **tbl );
+static void match_dim_table_add ( match_dim_table_t *mdim_tbl, unsigned *flags, char* dim_name, int32 ref);
+
+/* generate the SDS */
+static int gen_dim(char* name, int32 ref, int32 sd_in, int32 sd_out, options_t *options);
+
+
+/*-------------------------------------------------------------------------
+ * Function: match_dim
+ *
+ * Purpose: generate "lone" dimensions. 
+ *  Find common dimension names; the algorithm used for this search is the 
+ *  cosequential match algorithm and is described in 
+ *  Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley.
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente Nunes, pvn at hdfgroup.org
+ *
+ * Date: May 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+void match_dim(int32 sd_in,
+               int32 sd_out,
+               dim_table_t *dt1,
+               dim_table_t *dt2,
+               options_t *options)
+{
+    int   cmp;
+    int   more_names_exist = (dt1->nobjs>0 && dt2->nobjs>0) ? 1 : 0;
+    int   curr1=0;
+    int   curr2=0;
+    /*build a common list */
+    match_dim_table_t *mattbl=NULL;
+    unsigned inlist[2]; 
+    int      i;
+    
+#if defined (HREPACK_DEBUG)
+    for (i = 0; i < dt1->nobjs; i++) {
+        printf("%s\n", dt1->objs[i].dim_name);
+    }
+    for (i = 0; i < dt2->nobjs; i++) {
+        printf("%s\n", dt2->objs[i].dim_name);
+    }
+#endif
+    
+    
+   /*-------------------------------------------------------------------------
+    * build the list
+    *-------------------------------------------------------------------------
+    */
+    match_dim_table_init( &mattbl );
+    
+    while ( more_names_exist )
+    {
+        cmp = strcmp( dt1->objs[curr1].dim_name, dt2->objs[curr2].dim_name );
+        if ( cmp == 0 )
+        {
+            inlist[0]=1; inlist[1]=1;
+            match_dim_table_add(mattbl,inlist,
+                dt1->objs[curr1].dim_name,
+                dt1->objs[curr1].ref);
+            
+            curr1++;
+            curr2++;
+        }
+        else if ( cmp < 0 )
+        {
+            inlist[0]=1; inlist[1]=0;
+            match_dim_table_add(mattbl,inlist,
+                dt1->objs[curr1].dim_name,
+                dt1->objs[curr1].ref);
+            curr1++;
+        }
+        else 
+        {
+            inlist[0]=0; inlist[1]=1;
+            match_dim_table_add(mattbl,inlist,
+                dt2->objs[curr2].dim_name,
+                dt2->objs[curr2].ref);
+            curr2++;
+        }
+        
+        more_names_exist = (curr1<dt1->nobjs && curr2<dt1->nobjs) ? 1 : 0;
+        
+        
+    } /* end while */
+    
+    /* dt1 did not end */
+    if (curr1<dt1->nobjs)
+    {
+        while ( curr1<dt1->nobjs )
+        {
+            inlist[0]=1; inlist[1]=0;
+            match_dim_table_add(mattbl,inlist,
+                dt1->objs[curr1].dim_name,
+                dt1->objs[curr1].ref);
+            curr1++;
+        }
+    }
+    
+    /* dt2 did not end */
+    if (curr2<dt2->nobjs)
+    {
+        while ( curr2<dt2->nobjs )
+        {
+            inlist[0]=0; inlist[1]=1;
+            match_dim_table_add(mattbl,inlist,
+                dt2->objs[curr2].dim_name,
+                dt2->objs[curr2].ref);
+            curr2++;
+        }
+    }
+    
+   /*-------------------------------------------------------------------------
+    * print the list
+    *-------------------------------------------------------------------------
+    */
+#if defined (HREPACK_DEBUG)
+    {
+        char     c1, c2;
+        if (options->verbose) {
+            printf("---------------------------------------\n");
+            printf("list1     list2\n");
+            printf("---------------------------------------\n");
+            for (i = 0; i < mattbl->nobjs; i++)
+            {
+                c1 = (char)((mattbl->objs[i].flags[0]) ? 'x' : ' ');
+                c2 = (char)((mattbl->objs[i].flags[1]) ? 'x' : ' ');
+                printf("%5c %6c    %-15s\n", c1, c2, mattbl->objs[i].dim_name);
+            }
+            printf("\n");
+        }
+    }
+#endif
+    
+    
+   /*-------------------------------------------------------------------------
+    * get objects from list1 not in list2
+    *-------------------------------------------------------------------------
+    */
+    
+    for (i = 0; i < mattbl->nobjs; i++)
+    {
+        if ( mattbl->objs[i].flags[0] && ( ! mattbl->objs[i].flags[1] ) )
+        {
+            gen_dim(mattbl->objs[i].dim_name,
+                mattbl->objs[i].ref,
+                sd_in,
+                sd_out,
+                options);
+            
+        }
+    }
+    
+    
+    /* free table */
+    match_dim_table_free(mattbl);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_dim
+ *
+ * Purpose: generate "lone" dimensions. 
+ *
+ * Return: -1 error, 1 ok
+ *
+ * Programmer: Pedro Vicente Nunes, pvn at ncsa.uiuc.edu
+ *
+ * Date: May 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int gen_dim(char* name,              /* name of SDS */
+                   int32 ref,               /* ref of SDS */
+                   int32 sd_in,
+                   int32 sd_out,
+                   options_t *options)
+{
+    int32 sds_id,                    /* data set identifier */
+        sds_out=FAIL,                /* data set identifier */
+        dim_id,                      /* dimension identifier */
+        sds_index,                   /* index number of the data set */
+        dtype,                       /* SDS data type */
+        dimsizes[H4_MAX_VAR_DIMS],   /* dimensions of SDS */
+        start[H4_MAX_VAR_DIMS],      /* read start */
+        edges[H4_MAX_VAR_DIMS],      /* read edges */
+        nattrs,                      /* number of SDS attributes */
+        rank,                        /* rank of SDS */
+        numtype,                     /* number type */
+        eltsz,                       /* element size */
+        nelms;                       /* number of elements */
+    char             sds_name[H4_MAX_NC_NAME]; 
+    VOIDP            buf=NULL;
+    int              i, j, ret=1;
+    int              info;           /* temporary int compression information */
+    comp_coder_t     comp_type;      /* compression type requested  */
+    comp_coder_t     comp_type_in;   /* compression type original  */
+    comp_info        c_info;         /* compression information requested  */
+    comp_info        c_info_in;      /* compression information original  */
+    HDF_CHUNK_DEF    chunk_def;      /* chunk definition */
+    HDF_CHUNK_DEF    chunk_def_in;   /* chunk definition original */
+    int32            chunk_flags;    /* chunk flags */ 
+    int32            chunk_flags_in; /* chunk flags original*/ 
+    int              szip_mode;      /* szip mode, EC, NN */
+    intn             empty_sds;
+    int              have_info=0;
+    
+    sds_index = SDreftoindex(sd_in,ref);
+    sds_id    = SDselect(sd_in,sds_index);
+    
+    /*obtain name,rank,dimsizes,datatype and num of attributes of sds */
+    if (SDgetinfo(sds_id,sds_name,&rank,dimsizes,&dtype,&nattrs)==FAIL){
+        printf( "Could not get information for SDS\n");
+        SDendaccess(sds_id);
+        return -1;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * check if the input SDS is empty. if so , avoid some operations (mainly read, write)
+    *-------------------------------------------------------------------------
+    */ 
+    if (SDcheckempty( sds_id, &empty_sds ) == FAIL) {
+        printf( "Failed to check empty SDS <%s>\n", sds_name);
+        ret=-1;
+        goto out;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * element size and number of elements
+    *-------------------------------------------------------------------------
+    */
+    
+    /* compute the number of the bytes for each value */
+    numtype = dtype & DFNT_MASK;
+    eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+    
+    /* set edges of SDS */
+    nelms=1;
+    for (j = 0; j < rank; j++) {
+        nelms   *= dimsizes[j];
+        edges[j] = dimsizes[j];
+        start[j] = 0;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * get the original compression/chunk information from the object 
+    *-------------------------------------------------------------------------
+    */
+    
+    if (empty_sds==0 )
+    {
+        comp_type_in = COMP_CODE_NONE;  /* reset variables before retrieving information */
+        HDmemset(&c_info_in, 0, sizeof(comp_info)) ;
+        if ( SDgetcompinfo(sds_id, &comp_type_in, &c_info_in) == FAIL ) 
+        {
+            printf( "Could not get compression information for SDS <%s>\n",sds_name);
+            SDendaccess(sds_id);
+            return -1;
+        }
+        
+        /* get chunk lengths */
+        if ( SDgetchunkinfo(sds_id, &chunk_def_in, &chunk_flags_in) == FAIL )
+        {
+            printf( "Could not get chunking information for SDS <%s>\n",sds_name);
+            SDendaccess(sds_id);
+            return -1;
+        }
+        
+        /* retrieve the compress information if so */
+        if ( (HDF_CHUNK | HDF_COMP) == chunk_flags_in )
+        {
+            chunk_def_in.comp.comp_type=comp_type_in;
+            switch (comp_type_in)
+            {
+            case COMP_CODE_RLE:
+                chunk_def_in.comp.comp_type              = COMP_CODE_RLE;
+                break;
+            case COMP_CODE_SKPHUFF:
+                chunk_def_in.comp.comp_type              = COMP_CODE_SKPHUFF;
+                chunk_def_in.comp.cinfo.skphuff          = c_info_in.skphuff;
+                break;
+            case COMP_CODE_DEFLATE:
+                chunk_def_in.comp.comp_type              = COMP_CODE_DEFLATE;
+                chunk_def_in.comp.cinfo.deflate          = c_info_in.deflate;
+                break;
+            case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+                chunk_def_in.comp.comp_type              = COMP_CODE_SZIP;
+                chunk_def_in.comp.cinfo.szip             = c_info_in.szip;
+#else
+                printf("Error: SZIP compression is not available <%s>\n",sds_name);
+                SDendaccess(sds_id);
+                return -1;
+#endif
+                break;
+            default:
+                printf("Error: Unrecognized compression code in %d <%s>\n",comp_type_in,sds_name);
+            };
+        }
+        
+       /*-------------------------------------------------------------------------
+        * set the default values to the ones read from the object
+        *-------------------------------------------------------------------------
+        */
+        
+       /*-------------------------------------------------------------------------
+        * compression
+        *-------------------------------------------------------------------------
+        */
+        
+        comp_type   = comp_type_in;
+        
+        switch (comp_type_in)
+        {
+        case COMP_CODE_NBIT:
+            printf("Nbit compression not supported in this version <%s>\n",sds_name);
+            break;
+        case COMP_CODE_NONE:
+            break;
+        case COMP_CODE_RLE:
+            break;
+        case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+            info      = c_info_in.szip.pixels_per_block;
+            if (c_info_in.szip.options_mask & SZ_EC_OPTION_MASK) {
+                szip_mode = EC_MODE;
+            } else if (c_info_in.szip.options_mask & SZ_NN_OPTION_MASK) {
+                szip_mode = NN_MODE;
+            }
+#else
+            printf("SZIP compression not supported in this version <%s>\n",sds_name);
+#endif
+            break;
+        case COMP_CODE_SKPHUFF:
+            info  = c_info_in.skphuff.skp_size;
+            break;
+        case COMP_CODE_DEFLATE:
+            info  = c_info_in.deflate.level;
+            break;
+        default:
+            printf("Error: Unrecognized compression code in %d <%s>\n",comp_type,sds_name);
+            break;
+        };
+        
+       /*-------------------------------------------------------------------------
+        * chunking
+        *-------------------------------------------------------------------------
+        */
+        
+        chunk_flags = chunk_flags_in;
+        
+        if ( (HDF_CHUNK) == chunk_flags )
+        {
+            for (i = 0; i < rank; i++) 
+                chunk_def.chunk_lengths[i]      = chunk_def_in.chunk_lengths[i];
+        }
+        else if ( (HDF_CHUNK | HDF_COMP) == chunk_flags )
+        {
+            for (i = 0; i < rank; i++) {
+                chunk_def.chunk_lengths[i]      = chunk_def_in.chunk_lengths[i];
+                chunk_def.comp.chunk_lengths[i] = chunk_def_in.chunk_lengths[i];
+            }
+            chunk_def.comp.comp_type=comp_type_in;
+            switch (comp_type_in)
+            {
+            case COMP_CODE_RLE:
+                chunk_def.comp.comp_type              = COMP_CODE_RLE;
+                break;
+            case COMP_CODE_SKPHUFF:
+                chunk_def.comp.comp_type              = COMP_CODE_SKPHUFF;
+                chunk_def.comp.cinfo.skphuff          = c_info_in.skphuff;
+                break;
+            case COMP_CODE_DEFLATE:
+                chunk_def.comp.comp_type              = COMP_CODE_DEFLATE;
+                chunk_def.comp.cinfo.deflate          = c_info_in.deflate;
+                break;
+            case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+                chunk_def.comp.comp_type              = COMP_CODE_SZIP;
+                chunk_def.comp.cinfo.szip             = c_info_in.szip;
+#else
+                printf("Error: SZIP compression not available in %d <%s>\n",comp_type_in,sds_name);
+#endif
+                break;
+            default:
+                printf("Error: Unrecognized compression code in %d <%s>\n",comp_type_in,sds_name);
+            };
+        }
+        
+       /*-------------------------------------------------------------------------
+        * get the compression/chunk information of this object from the table
+        * translate to usable information
+        * this is done ONLY for the second trip inspection 
+        *-------------------------------------------------------------------------
+        */
+        
+        /* check inspection mode */
+        if ( options->trip>0 ) 
+        {
+            have_info = 
+                options_get_info(options,      /* global options */
+                &chunk_flags, /* chunk flags OUT */
+                &chunk_def,   /* chunk definition OUT */
+                &info,        /* compression information OUT */
+                &szip_mode,   /* compression information OUT */
+                &comp_type,   /* compression type OUT  */
+                rank,         /* rank of object IN */
+                sds_name,         /* path of object IN */
+                1,            /* number of GR image planes (for SZIP), IN */
+                dimsizes,     /* dimensions (for SZIP), IN */
+                dtype         /* numeric type ( for SZIP), IN */
+                );
+            if (have_info==FAIL)
+                goto out;
+        } /* check inspection mode */
+        
+        
+       /*-------------------------------------------------------------------------
+        * check for maximum number of chunks treshold
+        *-------------------------------------------------------------------------
+        */
+        if ( options->trip>0 ) 
+        {
+            int count=1, nchunks;
+            int maxchunk=INT_MAX;
+            if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+            {
+                for (j = 0; j < rank; j++) {
+                    count   *= chunk_def.chunk_lengths[j];
+                }
+                nchunks=nelms/count;
+                if (nchunks>maxchunk){
+                    printf("Warning: number of chunks is %d (greater than %d). Not chunking <%s>\n",
+                        nchunks,maxchunk,sds_name);
+                    chunk_flags=HDF_NONE;
+                }
+            }
+        }
+        
+        
+        /*-------------------------------------------------------------------------
+        * check for objects too small
+        *-------------------------------------------------------------------------
+        */
+        if ( have_info==1 && options->trip>0  && nelms*eltsz<options->threshold )
+        {
+            /* reset to the original values . we don't want to uncompress if it was */
+            chunk_flags=chunk_flags_in;
+            comp_type=comp_type_in;
+            if (options->verbose) {
+                printf("Warning: object size smaller than %d bytes. Not compressing <%s>\n",
+                    options->threshold,sds_name);
+            }
+        }
+        
+        
+ } /* empty_sds */
+ 
+  /*-------------------------------------------------------------------------
+   * print the PATH, COMP and CHUNK information
+   *-------------------------------------------------------------------------
+   */ 
+   
+   if (options->verbose)
+   {
+       int pr_comp_type=0;
+       int pr_chunk_flags;
+       
+       if ( options->trip==0 )
+           pr_chunk_flags=chunk_flags_in;
+       else
+           pr_chunk_flags=chunk_flags;
+       
+       if (comp_type>0)
+       {
+           pr_comp_type=comp_type;
+       }
+       else
+       {
+           if (pr_chunk_flags == (HDF_CHUNK | HDF_COMP) )
+           {
+               pr_comp_type=chunk_def.comp.comp_type;
+           }
+       }
+       printf(PFORMAT,
+           (pr_chunk_flags>0)?"chunk":"",                 /*chunk information */
+           (pr_comp_type>0)?get_scomp(pr_comp_type):"",   /*compression information */
+           "",                                            /*compression ratio */                     
+           name);                                         /*name*/
+   }
+   
+  /*-------------------------------------------------------------------------
+   * check if the requested compression is valid
+   * SDSs do not support JPEG
+   *-------------------------------------------------------------------------
+   */
+   
+   /* check inspection mode */
+   if ( options->trip>0 && empty_sds==0) 
+   {
+       switch(comp_type)
+       {
+       case COMP_CODE_NONE:
+       case COMP_CODE_RLE:
+       case COMP_CODE_SKPHUFF:
+       case COMP_CODE_DEFLATE:
+       case COMP_CODE_SZIP:
+       case COMP_CODE_NBIT:
+           break;
+       case COMP_CODE_JPEG:
+           printf("Error: JPEG compression is not available for <%s>\n",sds_name);
+           ret=FAIL;
+           goto out;
+           break;
+       default:
+           printf("Error: Unrecognized compression code %d in <%s>\n",comp_type_in,sds_name);
+           ret=FAIL;
+           goto out;
+       }
+   } /* check inspection mode */
+   
+   
+  /*-------------------------------------------------------------------------
+   * create new SDS
+   *-------------------------------------------------------------------------
+   */
+   
+   if ((sds_out = SDcreate(sd_out,sds_name,dtype,rank,dimsizes)) == FAIL) {
+       printf( "Failed to create new SDS <%s>\n", sds_name);
+       ret=-1;
+       goto out;
+   }
+   
+   /*-------------------------------------------------------------------------
+   * make it a "dimension"
+   *-------------------------------------------------------------------------
+   */
+   
+   if ((dim_id = SDgetdimid(sds_out, 0)) == FAIL) {
+       printf( "Failed to get dimension ID for SDS <%s>\n", sds_name);
+       ret=-1;
+       goto out;
+   }
+   
+   if (SDsetdimname(dim_id, sds_name) == FAIL) {
+       printf( "Failed to set dimension name for SDS <%s>\n", sds_name);
+       ret=-1;
+       goto out;
+   }
+   
+  /*-------------------------------------------------------------------------
+   * set chunk 
+   *
+   * Chunked                  -> flags = HDF_CHUNK
+   * Chunked and compressed   -> flags = HDF_CHUNK | HDF_COMP 
+   * Non-chunked              -> flags = HDF_NONE
+   *-------------------------------------------------------------------------
+   */
+   
+   if (empty_sds==0 )
+   {
+       
+       /* set chunk */
+       if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+       {
+           if (SDsetchunk (sds_out, chunk_def, chunk_flags)==FAIL)
+           {
+               printf( "Error: Failed to set chunk dimensions for <%s>\n", sds_name);
+               ret=-1;
+               goto out;
+           }
+           
+       }
+       
+      /*-------------------------------------------------------------------------
+       * set compression
+       *
+       * COMP_CODE_RLE       -> simple RLE encoding
+       * COMP_CODE_SKPHUFF   -> Skipping huffman encoding
+       * COMP_CODE_DEFLATE   -> gzip 'deflate' encoding
+       *-------------------------------------------------------------------------
+       */
+       
+       /* use compress without chunk-in */
+       else if ( chunk_flags==HDF_NONE && comp_type>COMP_CODE_NONE)  
+       {
+           if ( nelms*eltsz<options->threshold )
+           {
+               /* reset to the original values . we don't want to uncompress if it was */
+               comp_type=COMP_CODE_NONE;
+               if (options->verbose) {
+                   printf("Warning: object size smaller than %d bytes. Not compressing <%s>\n",
+                       options->threshold,sds_name);
+               } 
+           } else  {
+               
+               /* setup compression factors */
+               switch(comp_type) 
+               {
+               case COMP_CODE_SZIP:
+                   if (set_szip (info,szip_mode,&c_info)==FAIL)
+                   {
+                       comp_type=COMP_CODE_NONE;
+                   }
+                   break;
+               case COMP_CODE_RLE:         
+                   break;
+               case COMP_CODE_SKPHUFF:     
+                   c_info.skphuff.skp_size = info;
+                   break;
+               case COMP_CODE_DEFLATE:
+                   c_info.deflate.level = info;
+                   break;
+               case COMP_CODE_NBIT:
+                   comp_type = COMP_CODE_NONE;  /* not supported in this version */
+                   break;
+               default:
+                   printf( "Error: Unrecognized compression code %d\n", comp_type);
+               }
+               
+               if (SDsetcompress (sds_out, comp_type, &c_info)==FAIL)
+               {
+                   printf( "Error: Failed to set compression for <%s>\n", sds_name);
+                   ret=-1;
+                   goto out;
+               }
+           }
+       }
+            
+      /*-------------------------------------------------------------------------
+       * read sds and write new one
+       *-------------------------------------------------------------------------
+       */
+       
+       /* alloc */
+       if ((buf = (VOIDP) HDmalloc(nelms * eltsz)) == NULL) {
+           printf( "Failed to allocate %ld elements of size %ld\n", nelms, eltsz);
+           ret=-1;
+           goto out;
+       }
+       
+       /* read data */
+       if (SDreaddata (sds_id, start, NULL, edges, buf) == FAIL) {
+           printf( "Could not read SDS <%s>\n", sds_name);
+           ret=-1;
+           goto out;
+       }
+       
+       /* write the data */
+       if (SDwritedata(sds_out, start, NULL, edges, buf) == FAIL) {
+           printf( "Failed to write to new SDS <%s>\n", sds_name);
+           ret=-1;
+           goto out;
+       }
+       
+       
+   } /* empty_sds */
+   
+    /*-------------------------------------------------------------------------
+     * copy attributes
+     *-------------------------------------------------------------------------
+     */ 
+     
+     if( copy_sds_attrs(sds_id,sds_out,nattrs,options)==FAIL) {
+         ret=-1;
+         goto out;
+     }
+     
+     
+     
+out:
+     /* terminate access to the SDSs */
+     if (SDendaccess(sds_id)== FAIL )
+         printf( "Failed to close SDS <%s>\n", sds_name);
+     if (sds_out!=FAIL) {
+         if (SDendaccess (sds_out)== FAIL )
+             printf( "Failed to close SDS <%s>\n", sds_name);
+     }
+     
+     if (buf)
+         free(buf);
+     
+     return ret;
+     
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: match_dim_table_add
+ *
+ * Purpose: add an entry from a list of dimension names into the match table 
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: January 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void match_dim_table_add (match_dim_table_t *mdim_tbl, 
+                                 unsigned *flags, 
+                                 char* dim_name, 
+                                 int32 ref)
+{
+    int i;
+    
+    /* check if name already on match table */
+    for (i = 0; i < mdim_tbl->nobjs; i++) 
+    {
+        /* insert information at position i */
+        if ( strcmp(dim_name, mdim_tbl->objs[i].dim_name)==0 )
+        {
+            if (mdim_tbl->objs[i].flags[0] == 0)
+                mdim_tbl->objs[i].flags[0] = flags[0];
+            if (mdim_tbl->objs[i].flags[1] == 0)
+                mdim_tbl->objs[i].flags[1] = flags[1];
+            return;
+        }
+    }
+    
+    
+    if (mdim_tbl->nobjs == mdim_tbl->size) {
+        mdim_tbl->size *= 2;
+        mdim_tbl->objs = (match_dim_name_t*)realloc(mdim_tbl->objs, mdim_tbl->size * sizeof(match_dim_name_t));
+        
+        for (i = mdim_tbl->nobjs; i < mdim_tbl->size; i++) {
+            mdim_tbl->objs[i].ref = -1;
+            mdim_tbl->objs[i].flags[0] = mdim_tbl->objs[i].flags[1] = -1;
+        }
+    }
+    
+    i = mdim_tbl->nobjs++;
+    mdim_tbl->objs[i].ref = ref;
+    strcpy(mdim_tbl->objs[i].dim_name,dim_name);
+    mdim_tbl->objs[i].flags[0] = flags[0];
+    mdim_tbl->objs[i].flags[1] = flags[1];
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: match_dim_table_init
+ *
+ * Purpose: initialize match table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: January 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void match_dim_table_init( match_dim_table_t **tbl )
+{
+    int i;
+    match_dim_table_t *mdim_tbl = (match_dim_table_t*) malloc(sizeof(match_dim_table_t));
+    
+    mdim_tbl->size = 20;
+    mdim_tbl->nobjs = 0;
+    mdim_tbl->objs = (match_dim_name_t*) malloc(mdim_tbl->size * sizeof(match_dim_name_t));
+    
+    for (i = 0; i < mdim_tbl->size; i++) {
+        mdim_tbl->objs[i].ref = -1;
+        mdim_tbl->objs[i].flags[0] = mdim_tbl->objs[i].flags[1] = -1;
+    }
+    
+    *tbl = mdim_tbl;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: match_dim_table_free
+ *
+ * Purpose: free match table 
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: January 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void match_dim_table_free( match_dim_table_t *mdim_tbl )
+{
+    free(mdim_tbl->objs);
+    free(mdim_tbl);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: dim_table_add
+ *
+ * Purpose: add an entry of pair REF/NAME into a dimension table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: January 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void dim_table_add(dim_table_t *dim_tbl, int ref, char* name)
+{
+    int i;
+    
+    if (dim_tbl->nobjs == dim_tbl->size) {
+        dim_tbl->size *= 2;
+        dim_tbl->objs = (dim_name_t*)realloc(dim_tbl->objs, dim_tbl->size * sizeof(dim_name_t));
+        
+        for (i = dim_tbl->nobjs; i < dim_tbl->size; i++) {
+            dim_tbl->objs[i].ref = -1;
+        }
+    }
+    
+    i = dim_tbl->nobjs++;
+    dim_tbl->objs[i].ref = ref;
+    strcpy(dim_tbl->objs[i].dim_name,name);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: dim_table_init
+ *
+ * Purpose: initialize dimension table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: January 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void dim_table_init( dim_table_t **tbl )
+{
+    int i;
+    dim_table_t* dim_tbl = (dim_table_t*) malloc(sizeof(dim_table_t));
+    
+    dim_tbl->size = 20;
+    dim_tbl->nobjs = 0;
+    dim_tbl->objs = (dim_name_t*) malloc(dim_tbl->size * sizeof(dim_name_t));
+    
+    for (i = 0; i < dim_tbl->size; i++) {
+        dim_tbl->objs[i].ref = -1;
+    }
+    
+    *tbl = dim_tbl;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: dim_table_free
+ *
+ * Purpose: free dimension table 
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: January 17, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void dim_table_free( dim_table_t *dim_tbl )
+{
+    free(dim_tbl->objs);
+    free(dim_tbl);
+}
+
diff --git a/mfhdf/hrepack/hrepack_dim.h b/mfhdf/hrepack/hrepack_dim.h
new file mode 100644
index 0000000..4791cc6
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_dim.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+
+#ifndef REPACK_DIM_H_
+#define REPACK_DIM_H_
+
+#include "hrepack.h"
+
+
+/* dimension SDS  */
+typedef struct dim_name_t {
+    int32 ref;                    /* reference */
+    char  dim_name[H4_MAX_NC_NAME];  /* name */
+} dim_name_t;
+
+/* table for dim_name_t */
+typedef struct dim_table_t {
+    int        size;
+    int        nobjs;
+    dim_name_t *objs;
+} dim_table_t;
+
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dim_table_add(dim_table_t *dim_tbl, int ref, char* name);
+void dim_table_init( dim_table_t **tbl );
+void dim_table_free( dim_table_t *dim_tbl );
+
+
+void match_dim(int32 sd_in,
+               int32 sd_out,
+               dim_table_t *dt1,
+               dim_table_t *dt2,
+               options_t *options);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_DIM_H_ */
diff --git a/mfhdf/hrepack/hrepack_gr.c b/mfhdf/hrepack/hrepack_gr.c
new file mode 100644
index 0000000..bf46ae4
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_gr.c
@@ -0,0 +1,665 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <assert.h>
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hrepack.h"
+#include "hrepack_gr.h"
+#include "hrepack_utils.h"
+#include "hrepack_an.h"
+#include "hrepack_parse.h"
+#include "hrepack_opttable.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_gr
+ *
+ * Purpose: copy a GR from input file to output file and compress it 
+ *  using options
+ *
+ * Return: 0 ok, -1 not ok
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 11, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int  copy_gr(int32 infile_id,
+             int32 outfile_id,
+             int32 gr_in,
+             int32 gr_out,
+             int32 tag,               /* tag of input GR */
+             int32 ref,               /* ref of input GR */
+             int32 vgroup_id_out_par, /* output parent group ID */
+             char*path_name,          /* absolute path for input group name */
+             options_t *options,
+             list_table_t *list_tbl)
+{
+    int32         ri_id,         /* raster image identifier */
+        ri_out,        /* raster image identifier */
+        ri_index,      /* index of a image */
+        dimsizes[2],   /* dimensions of an image */
+        n_comps,       /* number of components an image contains */
+        interlace_mode,/* interlace mode of an image */ 
+        dtype,         /* number type of an image */
+        n_attrs,       /* number of attributes belong to an image */
+        gr_ref,        /* reference number of the output data set */
+        pal_id,        /* palette identifier */
+        pal_out,       /* palette identifier */
+        pal_ref,
+        r_num_entries, 
+        r_data_type, 
+        r_ncomp, 
+        r_interlace_mode; 
+    char          gr_name[H4_MAX_GR_NAME]; 
+    char          *path=NULL;
+    int           info;           /* temporary int compression information */
+    int           szip_mode;      /* szip mode, EC, NN */
+    comp_coder_t  comp_type;      /* compression type requested  */
+    comp_coder_t  comp_type_in;   /* compression type original  */
+    comp_info     c_info;         /* compression information requested  */
+    comp_info     c_info_in;      /* compression information original  */
+    HDF_CHUNK_DEF chunk_def;      /* chunk definition */
+    HDF_CHUNK_DEF chunk_def_in;   /* chunk definition original */
+    int32         chunk_flags;    /* chunk flags */ 
+    int32         chunk_flags_in; /* chunk flags original*/ 
+    int           i, j, ret=0, rank=2, have_info,stat;
+    int           has_pal = 0;
+    int32         start[2],       /* read start */
+        edges[2],       /* read edges */
+        numtype,        /* number type */
+        eltsz,          /* element size */
+        nelms,          /* number of elements */
+        data_size;
+    VOIDP         buf=NULL;
+    uint8         pal_data[256*3];
+    int           can_compress=1; /* flag to tell if a compression is supported */
+    char          *pal_path="palette";
+    
+    ri_index = GRreftoindex(gr_in,(uint16)ref);
+    ri_id    = GRselect(gr_in,ri_index);
+    
+    if (GRgetiminfo(ri_id,gr_name,&n_comps,&dtype,&interlace_mode,dimsizes,&n_attrs)==FAIL){
+        printf( "Could not information for GR\n");
+        GRendaccess(ri_id);
+        return-1;
+    }
+    
+    /* initialize path */
+    path=get_path(path_name,gr_name);
+    
+    /* add object to table */
+    list_table_add(list_tbl,tag,ref,path);
+    
+    /*-------------------------------------------------------------------------
+    * get the original compression/chunk information from the object 
+    *-------------------------------------------------------------------------
+    */
+    
+    comp_type_in = COMP_CODE_NONE;  /* reset variables before retrieving information */
+    HDmemset(&c_info_in, 0, sizeof(comp_info)) ;
+    stat=GRgetcompinfo(ri_id, &comp_type_in, &c_info_in);
+    if (stat==FAIL && comp_type_in>0){
+        printf( "Could not get compress information for GR <%s>\n",path);
+        GRendaccess(ri_id);
+        return-1;
+    }
+    
+    /* get chunk lengths */
+    if (GRgetchunkinfo(ri_id, &chunk_def_in, &chunk_flags_in)==FAIL){
+        printf( "Could not get chunk information for GR <%s>\n",path);
+        GRendaccess(ri_id);
+        return-1;
+    }
+    
+    /* retrieve the compress information if so */
+    if ( (HDF_CHUNK | HDF_COMP) == chunk_flags_in )
+    {
+        chunk_def_in.comp.comp_type=comp_type_in;
+        switch (comp_type_in)
+        {
+        case COMP_CODE_NONE:
+            break;
+        case COMP_CODE_SZIP:
+#ifdef H4_GR_SZIP
+            chunk_def_in.comp.comp_type              = COMP_CODE_SZIP;
+            chunk_def_in.comp.cinfo.szip             = c_info_in.szip;
+#endif
+            chunk_def_in.comp.comp_type              = COMP_CODE_NONE;
+            printf("Warning: SZIP compression not supported for GR\n");
+            break;
+        case COMP_CODE_RLE:
+            chunk_def_in.comp.comp_type              = COMP_CODE_RLE;
+            break;
+        case COMP_CODE_SKPHUFF:
+            chunk_def_in.comp.comp_type              = COMP_CODE_SKPHUFF;
+            chunk_def_in.comp.cinfo.skphuff          = c_info_in.skphuff;
+            break;
+        case COMP_CODE_DEFLATE:
+            chunk_def_in.comp.comp_type              = COMP_CODE_DEFLATE;
+            chunk_def_in.comp.cinfo.deflate          = c_info_in.deflate;
+            break;
+        case COMP_CODE_JPEG:
+            chunk_def_in.comp.comp_type              = COMP_CODE_JPEG;
+            chunk_def_in.comp.cinfo.jpeg             = c_info_in.jpeg;
+            break;
+        default:
+            printf("Error: Unrecognized compression code <%d> in <%s>\n",comp_type_in,path);
+            break;
+        };
+    }
+    
+    /*-------------------------------------------------------------------------
+    * set the default values to the ones read from the object
+    *-------------------------------------------------------------------------
+    */
+    
+    /*-------------------------------------------------------------------------
+    * compression
+    *-------------------------------------------------------------------------
+    */
+    
+    comp_type   = comp_type_in;
+    
+    switch (comp_type_in)
+    {
+    default:
+        break;
+    case COMP_CODE_SZIP:
+#ifdef H4_GR_SZIP
+        info  = c_info_in.szip.pixels_per_block;
+#ifdef H4_HAVE_LIBSZ
+        if (c_info_in.szip.options_mask & SZ_EC_OPTION_MASK) {
+            szip_mode = EC_MODE;
+        } else if (c_info_in.szip.options_mask & SZ_NN_OPTION_MASK) {
+            szip_mode = NN_MODE;
+        }
+#else
+        szip_mode = 0; /* irrelevant */
+#endif
+#endif
+        szip_mode = 0; /* irrelevant */
+        break;
+    case COMP_CODE_RLE:
+        break;
+    case COMP_CODE_SKPHUFF:
+        info  = c_info_in.skphuff.skp_size;
+        break;
+    case COMP_CODE_DEFLATE:
+        info  = c_info_in.deflate.level;
+        break;
+    case COMP_CODE_JPEG:
+	/* JPEG's quality factor was not saved to the file and 75 is
+	   recommended by http://www.faqs.org/faqs/jpeg-faq/part1 - BMR 1/2009*/
+        info = 75;  /* a constant should be defined somewhere in the library */
+	c_info_in.jpeg.quality = 75;
+        break;
+    };
+    
+    /*-------------------------------------------------------------------------
+    * chunking
+    *-------------------------------------------------------------------------
+    */
+    
+    chunk_flags = chunk_flags_in;
+    
+    if ( (HDF_CHUNK) == chunk_flags )
+    {
+        for (i = 0; i < rank; i++) 
+            chunk_def.chunk_lengths[i]      = chunk_def_in.chunk_lengths[i];
+    }
+    else if ( (HDF_CHUNK | HDF_COMP) == chunk_flags )
+    {
+        for (i = 0; i < rank; i++) {
+            chunk_def.chunk_lengths[i]      = chunk_def_in.chunk_lengths[i];
+            chunk_def.comp.chunk_lengths[i] = chunk_def_in.chunk_lengths[i];
+        }
+        chunk_def.comp.comp_type=comp_type_in;
+        switch (comp_type_in)
+        {
+        case COMP_CODE_NONE:
+            break;
+        case COMP_CODE_SZIP:
+#ifdef H4_GR_SZIP
+            chunk_def.comp.comp_type              = COMP_CODE_SZIP;
+            chunk_def.comp.cinfo.szip             = c_info_in.szip;
+#endif
+            chunk_def.comp.comp_type              = COMP_CODE_NONE;
+            printf("Warning: SZIP not supported for GR\n");
+            break;
+        case COMP_CODE_RLE:
+            chunk_def.comp.comp_type              = COMP_CODE_RLE;
+            break;
+        case COMP_CODE_SKPHUFF:
+            chunk_def.comp.comp_type              = COMP_CODE_SKPHUFF;
+            chunk_def.comp.cinfo.skphuff          = c_info_in.skphuff;
+            break;
+        case COMP_CODE_DEFLATE:
+            chunk_def.comp.comp_type              = COMP_CODE_DEFLATE;
+            chunk_def.comp.cinfo.deflate          = c_info_in.deflate;
+            break;
+        case COMP_CODE_JPEG:
+            chunk_def.comp.comp_type              = COMP_CODE_JPEG;
+            chunk_def.comp.cinfo.jpeg             = c_info_in.jpeg;
+            break;
+        default:
+            printf("Error: Unrecognized compression code <%d> in <%s>\n",comp_type_in,path);
+            break;
+        };
+    }
+    
+    
+    /*-------------------------------------------------------------------------
+    * get the compression/chunk information of this object from the table
+    * translate to usable information
+    * this is done ONLY for the second trip inspection 
+    *-------------------------------------------------------------------------
+    */
+    
+    /* check inspection mode */
+    have_info = 0;
+    if ( options->trip>0 ) 
+    {
+        have_info = 
+            options_get_info(options,      /* global options */
+            &chunk_flags, /* chunk flags OUT */
+            &chunk_def,   /* chunk definition OUT */
+            &info,        /* compression information OUT */
+            &szip_mode,   /* compression information OUT */
+            &comp_type,   /* compression type OUT  */
+            rank,         /* rank of object IN */
+            path,         /* path of object IN */
+            n_comps,      /* number of GR image planes (for SZIP), IN */
+            dimsizes,     /* dimensions (for SZIP), IN */
+            dtype         /* numeric type ( for SZIP), IN */
+            );
+        if (have_info==FAIL)
+            goto out;
+    } /* check inspection mode */
+    
+    
+      /*-------------------------------------------------------------------------
+      * check for data size before printing
+      *-------------------------------------------------------------------------
+    */
+    
+    /* compute the number of the bytes for each value. */
+    numtype = dtype & DFNT_MASK;
+    eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+    
+    /* set edges of GR */
+    nelms=1;
+    for (j = 0; j < rank; j++) {
+        nelms   *= dimsizes[j];
+        edges[j] = dimsizes[j];
+        start[j] = 0;
+    }
+    
+    data_size = dimsizes[0]*dimsizes[1]*n_comps*eltsz;
+    
+    /*-------------------------------------------------------------------------
+    * check for objects too small
+    *-------------------------------------------------------------------------
+    */
+    if ( have_info && options->trip>0  && nelms*eltsz<options->threshold )
+    {
+        /* reset to the original values . we don't want to uncompress if it was */
+        chunk_flags=chunk_flags_in;
+        comp_type=comp_type_in;
+        if (options->verbose) {
+            printf("Warning: object size smaller than %d bytes. Not compressing <%s>\n",
+                options->threshold,path);
+        }
+    }
+    
+    /*-------------------------------------------------------------------------
+    * print the PATH, COMP and CHUNK information
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if (options->verbose)
+    {
+        int pr_comp_type=0;
+        int pr_chunk_flags;
+        
+        if ( options->trip==0 )
+            pr_chunk_flags=chunk_flags_in;
+        else
+            pr_chunk_flags=chunk_flags;
+        
+        if (comp_type>0)
+        {
+            pr_comp_type=comp_type;
+        }
+        else
+        {
+            if (pr_chunk_flags == (HDF_CHUNK | HDF_COMP) )
+            {
+                pr_comp_type=chunk_def.comp.comp_type;
+            }
+        }
+        printf(PFORMAT,
+            (pr_chunk_flags>0)?"chunk":"",                 /*chunk information*/
+            (pr_comp_type>0)?get_scomp(pr_comp_type):"",   /*compression information*/
+            "",                                            /*compression ratio */                     
+            path);                                         /*name*/
+    }
+    
+    /*-------------------------------------------------------------------------
+    * if we are in first trip inspection mode, exit, after printing the information
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* check inspection mode */
+    if ( options->trip==0 ) {
+        if (path) free(path);
+        if (GRendaccess(ri_id)==FAIL){
+            printf( "Could not close GR <%s>\n",path);
+            return-1;
+        }
+        return 0;
+    }
+    /*-------------------------------------------------------------------------
+    * read gr and create new one
+    *-------------------------------------------------------------------------
+    */
+    
+    /* alloc */
+    if ((buf = (VOIDP) HDmalloc(data_size)) == NULL) {
+        printf( "Failed to allocate %ld elements of size %ld\n", nelms, eltsz);
+        GRendaccess(ri_id);
+        if (path) free(path);
+        return-1;
+    }
+    
+    
+    /* set the interlace for reading  */
+    if ( GRreqimageil(ri_id, interlace_mode) == FAIL ){
+        printf( "Could not set interlace for GR <%s>\n", path);
+        GRendaccess(ri_id);
+        if (path) free(path);
+        return-1;
+    }
+    
+    /* read data */
+    if (GRreadimage (ri_id, start, NULL, edges, buf) == FAIL) {
+        printf( "Could not read GR <%s>\n", path);
+        GRendaccess(ri_id);
+        if (path) free(path);
+        return-1;
+    }
+    
+    /* create output GR */
+    if ((ri_out = GRcreate(gr_out,gr_name,n_comps,dtype,interlace_mode,dimsizes)) == FAIL) {
+        printf( "Failed to create new GR <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    
+    /*-------------------------------------------------------------------------
+    * set chunk 
+    *
+    * Chunked                  -> flags = HDF_CHUNK
+    * Chunked and compressed   -> flags = HDF_CHUNK | HDF_COMP 
+    * Non-chunked              -> flags = HDF_NONE
+    *-------------------------------------------------------------------------
+    */
+    
+    /* set chunk */
+    if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+    {
+        if (GRsetchunk (ri_out, chunk_def, chunk_flags)==FAIL)
+        {
+            printf( "Error: Failed to set chunk dimensions for <%s>\n", path);
+            ret=-1;
+            goto out;
+        }
+    }
+    
+    /*-------------------------------------------------------------------------
+    * set compression
+    *
+    * COMP_CODE_RLE       -> simple RLE encoding
+    * COMP_CODE_SKPHUFF   -> Skipping huffman encoding
+    * COMP_CODE_DEFLATE   -> gzip 'deflate' encoding
+    *-------------------------------------------------------------------------
+    */
+    
+    /* use compress without chunk-in */
+    else if ( chunk_flags==HDF_NONE && comp_type>COMP_CODE_NONE)  
+    {
+        if ( have_info && options->trip>0  && nelms*eltsz<options->threshold )
+        {
+            /* reset to the original values . we don't want to uncompress if it was */
+            comp_type=COMP_CODE_NONE;
+            if (options->verbose) {
+                printf("Warning: object size smaller than %d bytes. Not compressing <%s>\n",
+                    options->threshold,path);
+            }
+        } else {
+            /* setup compression factors */
+            switch(comp_type) 
+            {
+            case COMP_CODE_SZIP:
+#ifdef H4_GR_SZIP
+                /* not supported */
+                if (set_szip (info,szip_mode,&c_info)==FAIL)
+                {
+                    comp_type=COMP_CODE_NONE;
+                }
+#endif
+                printf("Warning: SZIP not supported for GR\n");
+                can_compress=0;
+                break;
+            case COMP_CODE_RLE:         
+                break;
+            case COMP_CODE_SKPHUFF:     
+                c_info.skphuff.skp_size    = info;
+                break;
+            case COMP_CODE_DEFLATE:
+                c_info.deflate.level       = info;
+                break;
+            case COMP_CODE_JPEG:
+                c_info.jpeg.quality        = info;
+                c_info.jpeg.force_baseline = 1;
+                break;
+            default:
+                printf( "Error: Unrecognized compression code %d\n", comp_type);
+                can_compress=0;
+            }
+            
+            if (can_compress) 
+            {
+                if (GRsetcompress (ri_out, comp_type, &c_info)==FAIL)
+                {
+                    printf( "Error: Failed to set compression for <%s>\n", path);
+                    ret=-1;
+                    goto out;
+                }
+            } /* can_compress */
+        }
+    }
+    
+    /* write the data */
+    if (GRwriteimage(ri_out, start, NULL, edges, buf) == FAIL) {
+        printf( "Failed to write to new GR <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    
+    /*-------------------------------------------------------------------------
+    * copy attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if( copy_gr_attrs(ri_id,ri_out,n_attrs,options)==FAIL) {
+        ret=-1;
+        goto out;
+    }
+    
+    /*-------------------------------------------------------------------------
+    * check for palette
+    *-------------------------------------------------------------------------
+    */ 
+    
+    pal_id = GRgetlutid(ri_id, 0);
+    GRgetlutinfo(pal_id,&r_ncomp,&r_data_type,&r_interlace_mode,&r_num_entries);
+    
+    /*check if there is palette data */
+    has_pal=((r_ncomp == 0) || (r_interlace_mode < 0) || (r_num_entries == 0))?0:1;
+    
+    if ( has_pal==1 )
+    {
+        GRreqlutil(ri_id, r_interlace_mode);    
+        if (GRreadlut(pal_id, pal_data)==FAIL) {
+            printf( "Failed to get palette data for <%s>\n", path);
+        }
+        
+        if ((pal_ref=GRluttoref(pal_id))== FAIL) {
+            printf( "Failed to get palette ref for <%s>\n", path);
+        }
+        /* add palette to table; we want to later check for lone palettes */
+        list_table_add(list_tbl,DFTAG_IP8,pal_ref,pal_path);
+        
+        /* Get the id for the new palette */
+        if ((pal_out = GRgetlutid(ri_out, 0)) == FAIL) {
+            printf( "Failed to get palette ID for <%s>\n", path);
+        }
+        
+        /* Write the palette to file. */
+        if (GRwritelut(pal_out,r_ncomp,r_data_type,r_interlace_mode,r_num_entries, 
+            (VOIDP)pal_data)== FAIL) {
+            printf( "Failed to write palette for <%s>\n", path);
+        }
+    } /* has_pal==1 */
+    
+    
+    /* obtain the reference number of the new SDS using its identifier */
+    if ((gr_ref = GRidtoref (ri_out)) == FAIL) {
+        printf( "Failed to get new GR reference in <%s>\n", path);
+    }
+    
+    /*-------------------------------------------------------------------------
+    * add GR to group, if needed
+    *-------------------------------------------------------------------------
+    */ 
+    if (vgroup_id_out_par) 
+    {
+        /* add the GR to the vgroup. the tag DFTAG_RIG is used */
+        if (Vaddtagref (vgroup_id_out_par, TAG_GRP_IMAGE, gr_ref)==FAIL) {
+            printf( "Failed to add new GR to group <%s>\n", path);
+        }
+    }
+    
+    /*-------------------------------------------------------------------------
+    * copy ANs
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if (copy_an(infile_id,outfile_id,
+        ref,DFTAG_RIG,gr_ref,DFTAG_RIG, 
+        path,options)<0) {
+        ret=-1;
+        goto out;
+    }
+    if (copy_an(infile_id,outfile_id,
+        ref,DFTAG_RI,gr_ref,DFTAG_RI,
+        path,options)<0) {
+        ret=-1;
+        goto out;
+    }
+    
+out:
+    
+    /* terminate access to the GRs */
+    if (GRendaccess(ri_id)== FAIL )
+        printf( "Failed to close SDS <%s>\n", path);
+    if (GRendaccess(ri_out)== FAIL )
+        printf( "Failed to close SDS <%s>\n", path);
+    
+    if (path)
+        free(path);
+    if (buf)
+        free(buf);
+    
+    return ret;
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_gr_attrs
+ *
+ * Purpose: copy GR attributes from input file to output file 
+ *
+ * Return: 1, for success, -1 for error 
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 28, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_gr_attrs(int32 ri_id,
+                  int32 ri_out,
+                  int32 nattrs,          
+                  options_t *options)
+{
+    int32 dtype,                 /* SDS data type */
+        numtype,               /* number type */
+        eltsz,                 /* element size */
+        nelms;                 /* number of elements */
+    char  attr_name[H4_MAX_NC_NAME];
+    VOIDP attr_buf=NULL;
+    int   i;
+    
+    /* loop through attributes in input GR */
+    for (i = 0; i < nattrs; i++) 
+    {
+        if (GRattrinfo (ri_id, i, attr_name, &dtype, &nelms) == FAIL) {
+            printf( "Cannot get information for attribute number %d\n", i);
+            return-1;
+        }
+        /* compute the number of the bytes for each value. */
+        numtype = dtype & DFNT_MASK;
+        eltsz   = DFKNTsize(numtype | DFNT_NATIVE);
+        if ((attr_buf = (VOIDP) HDmalloc(nelms * eltsz)) == NULL) {
+            printf( "Error allocating %ld values of size %ld for attribute %s",
+                nelms, numtype, attr_name);
+            return-1;
+        }
+        /* read attributes from input GR */
+        if (GRgetattr(ri_id, i, attr_buf) == FAIL) {
+            printf( "Cannot read attribute %s\n", attr_name);
+            return-1;
+        }
+        /* put attributes into output GR */
+        if (GRsetattr(ri_out, attr_name, dtype, nelms, attr_buf) == FAIL) {
+            printf( "Cannot write attribute %s\n", attr_name);
+            return-1;
+        }
+        
+        if (attr_buf)
+            free(attr_buf);
+    }
+    
+    return 1;
+}
+
+
+
diff --git a/mfhdf/hrepack/hrepack_gr.h b/mfhdf/hrepack/hrepack_gr.h
new file mode 100644
index 0000000..8a937b4
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_gr.h
@@ -0,0 +1,49 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_GR_H_
+#define REPACK_GR_H_
+
+#include "hrepack.h"
+#include "hrepack_lsttable.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int  copy_gr(int32 infile_id,
+             int32 outfile_id,
+             int32 gr_in,
+             int32 gr_out,
+             int32 tag,               /* tag of input GR */
+             int32 ref,               /* ref of input GR */
+             int32 vgroup_id_out_par, /* output parent group ID */
+             char*path_name,          /* absolute path for input group name */
+             options_t *options,
+             list_table_t *list_tbl);
+
+
+int copy_gr_attrs(int32 ri_id,
+                  int32 ri_out,
+                  int32 nattrs,          
+                  options_t *options);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_GR_H_ */
diff --git a/mfhdf/hrepack/hrepack_list.c b/mfhdf/hrepack/hrepack_list.c
new file mode 100644
index 0000000..964cdb9
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_list.c
@@ -0,0 +1,1497 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hrepack.h"
+#include "hrepack_utils.h"
+#include "hrepack_parse.h"
+#include "hrepack_opttable.h"
+#include "hrepack_sds.h"
+#include "hrepack_gr.h"
+#include "hrepack_vs.h"
+#include "hrepack_an.h"
+#include "hrepack_vg.h"
+#include "hrepack_dim.h"
+
+
+int list_vg (int32 infile_id,int32 outfile_id,int32 sd_id,int32 sd_out,int32 gr_id,int32 gr_out,list_table_t *list_tbl,dim_table_t *td1,dim_table_t *td2,options_t *options);
+int list_gr (int32 infile_id,int32 outfile_id,int32 gr_id,int32 gr_out,list_table_t *list_tbl,options_t *options);
+int list_sds(int32 infile_id,int32 outfile_id,int32 sd_id, int32 sd_out,list_table_t *list_tbl,dim_table_t *td1,dim_table_t *td2,options_t *options);
+int list_vs (int32 infile_id,int32 outfile_id,list_table_t *list_tbl,options_t *options);
+int list_glb(int32 infile_id,int32 outfile_id,int32 sd_id,int32 sd_out,int32 gr_id,int32 gr_out,list_table_t *list_tbl,options_t *options);
+int list_pal(const char* infname,const char* outfname,list_table_t *list_tbl,options_t *options);
+int list_an (int32 infile_id,int32 outfile_id,options_t *options);
+
+
+/*-------------------------------------------------------------------------
+ * Function: list
+ *
+ * Purpose: locate all HDF objects in the file and compress them using options
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 10, 2003
+ *
+ * Modifications: September 9, 2007
+ *  Check for duplicate Vgroup insertions
+ *
+ * Description:
+ *
+ * A main loop is used to locate all the objects in the file. The algorithm used is: 
+ * 1) Obtain the number of lone vgroups in the HDF file, i.e., vgroups that are at
+ *     the top of the grouping hierarchy, in a file.
+ * 2) Do a loop for each one of these groups. In each iteration a table is updated 
+ *    with the tag/reference pair of an object. 
+ *    2.1) Obtain the pairs of tag/references for the group 
+ *    2.2) Switch between the tag of the current object. Four cases are possible: 
+ *         1) Object is a group: recursively repeat the process (obtain the pairs of
+ *            tag/references for this group and do another tag switch).
+ *            If the Vgroup has not been visited
+ *             Add the object to the table and continue recursion
+ *            else
+ *             Open it, create the insertion into its parent and exit the recursion.
+ *         2) Object is a dataset: Add the object to the table.
+ *         3) Object is an image: Add the object to the table.  
+ *         4) Object is a vdata: Add the object to the table. 
+ * 3) Read all the HDF interfaces (SDS, GR and VS), checking for objects that are 
+ *    already in the table (meaning they belong to a previous inspected group, 
+ *    and should not be added).  These objects belong to a root group. 
+ * 4) Read all global attributes and annotations. 
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int list_main(const char* infname,
+         const char* outfname, 
+         options_t *options)
+{
+    list_table_t *list_tbl=NULL;     /* list of objects */
+    dim_table_t  *td1=NULL;       /* dimensions */
+    dim_table_t  *td2=NULL;       /* dimensions */
+    int32        sd_id=FAIL,      /* SD interface identifier */
+                 sd_out=FAIL,     /* SD interface identifier */
+                 gr_id=FAIL,      /* GR interface identifier */
+                 gr_out=FAIL,     /* GR interface identifier */
+                 infile_id=FAIL,
+                 outfile_id=FAIL;
+    int          i;
+    const char*  err;
+
+   /*-------------------------------------------------------------------------
+    * initialize tables
+    *-------------------------------------------------------------------------
+    */
+    
+    list_table_init(&list_tbl);
+    dim_table_init(&td1);
+    dim_table_init(&td2);
+    
+   /*-------------------------------------------------------------------------
+    * open the input file for read and initialize interfaces
+    *-------------------------------------------------------------------------
+    */
+   
+    if ((infile_id  = Hopen (infname,DFACC_READ,(int16)0))==FAIL)
+    {
+        printf("Cannot open file <%s>\n",infname);
+        goto out;
+    }
+    if ((sd_id  = SDstart (infname, DFACC_READ))==FAIL)
+    {
+        printf( "Could not start SD for <%s>\n",infname);
+        goto out;
+    }
+    if ((gr_id  = GRstart (infile_id))==FAIL)
+    {
+        printf( "Could not start GR for <%s>\n",infname);
+        goto out;
+    }
+   
+   /*-------------------------------------------------------------------------
+    * create the output file and initialize interfaces
+    *-------------------------------------------------------------------------
+    */
+
+    if ( options->trip==1 ) 
+    {
+        if ((outfile_id = Hopen (outfname,DFACC_CREATE,(int16)0))==FAIL)
+        {
+            printf("Cannot create file <%s>\n",outfname);
+            goto out;
+        }
+        if ((sd_out = SDstart (outfname, DFACC_WRITE))==FAIL)
+        {
+            printf( "Could not start GR for <%s>\n",outfname);
+            goto out;
+        }
+        
+        if ((gr_out = GRstart (outfile_id))==FAIL)
+        {
+            printf( "Could not start GR for <%s>\n",outfname);
+            goto out;
+        }
+    } /* options->trip==1 */
+
+    
+    if (options->verbose && options->trip==0)
+        printf("Building list of objects in %s...\n",infname);
+
+
+   /*-------------------------------------------------------------------------
+    * iterate tru HDF interfaces 
+    *-------------------------------------------------------------------------
+    */
+
+    if (options->verbose) 
+    {
+        printf("-----------------------------------------------\n");
+        printf(" Chunk   Filter(compression) Name\n");
+        printf("-----------------------------------------------\n");
+    }
+    
+    if (list_vg (infile_id,outfile_id,sd_id,sd_out,gr_id,gr_out,list_tbl,td1,td2,options)<0) 
+        goto out;
+    if (list_gr (infile_id,outfile_id,gr_id,gr_out,list_tbl,options)<0) 
+        goto out;
+    if (list_sds(infile_id,outfile_id,sd_id,sd_out,list_tbl,td1,td2,options)<0) 
+        goto out;
+    if (list_vs (infile_id,outfile_id,list_tbl,options)<0) 
+        goto out;
+    if (list_glb(infile_id,outfile_id,sd_id,sd_out,gr_id,gr_out,list_tbl,options)<0) 
+        goto out;
+    if (list_pal(infname,outfname,list_tbl,options)<0) 
+        goto out;
+    if (list_an (infile_id,outfile_id,options)<0) 
+        goto out;
+    
+    
+    if ( options->trip==1 ) 
+    {
+        match_dim(sd_id,sd_out,td1,td2,options);
+    }
+    
+
+   /*-------------------------------------------------------------------------
+    * check for objects in the file table:
+    *   1) the input object names are present in the file
+    *   2) they are valid objects (SDS or GR)
+    * check only if selected objects are given (all==0)
+    *-------------------------------------------------------------------------
+    */
+    
+    if ( options->trip==0 ) 
+    {
+        if (options->verbose)
+            printf("Searching for objects to modify...\n");
+        
+        for ( i = 0; i < options->op_tbl->nelems; i++) 
+        {
+            char* obj_name=options->op_tbl->objs[i].objpath;
+            if (options->verbose)
+                printf(PFORMAT1,"","",obj_name);
+            
+            /* the input object names are present in the file and are valid */
+            err=list_table_check(list_tbl,obj_name);
+            if (err!=NULL)
+            {
+                printf("\nError: <%s> %s in file <%s>. Exiting...\n",obj_name,err,infname);
+                goto out;
+            }
+            if (options->verbose)
+                printf("...Found\n");
+        }
+    }
+    
+    
+   /*-------------------------------------------------------------------------
+    * close interfaces
+    *-------------------------------------------------------------------------
+    */
+    if (GRend (gr_id)==FAIL)
+        printf( "Failed to close GR interface <%s>\n", infname);
+    if (SDend (sd_id)==FAIL)
+        printf( "Failed to close file <%s>\n", infname);
+    if (Hclose (infile_id)==FAIL)
+        printf( "Failed to close file <%s>\n", infname);
+
+    if ( options->trip==1 ) 
+    {
+        if (GRend (gr_out)==FAIL)
+            printf( "Failed to close GR interface <%s>\n", outfname);
+        if (SDend (sd_out)==FAIL)
+            printf( "Failed to close file <%s>\n", outfname);
+        if (Hclose (outfile_id)==FAIL)
+            printf( "Failed to close file <%s>\n", outfname);
+    }
+
+
+   /*-------------------------------------------------------------------------
+    * free tables
+    *-------------------------------------------------------------------------
+    */
+  
+    list_table_free(list_tbl);
+    dim_table_free(td1);
+    dim_table_free(td2);
+    
+    return SUCCEED;
+    
+out:
+    
+    if (list_tbl!=NULL)
+        list_table_free(list_tbl);
+    if (td1!=NULL)
+        dim_table_free(td1);
+    if (td2!=NULL)
+        dim_table_free(td2);
+    if (gr_id!=FAIL)
+    {
+        if (GRend (gr_id)==FAIL)
+            printf( "Failed to close GR interface <%s>\n", infname);
+    }
+    if (gr_out!=FAIL)
+    {
+        if (GRend (gr_out)==FAIL)
+            printf( "Failed to close GR interface <%s>\n", outfname);
+    }
+    if (sd_id!=FAIL)
+    {
+        if (SDend (sd_id)==FAIL)
+            printf( "Failed to close SD interface for <%s>\n", infname);
+        
+    }
+    if (sd_out!=FAIL)
+    {
+        if (SDend (sd_out)==FAIL)
+            printf( "Failed to close SD interface for <%s>\n", outfname);
+    }
+    if (infile_id!=FAIL)
+    {
+        if (Hclose (infile_id)==FAIL)
+            printf( "Failed to close file <%s>\n", infname);
+    }
+    if (outfile_id!=FAIL)
+    {
+        if (Hclose (outfile_id)==FAIL)
+            printf( "Failed to close file <%s>\n", outfname);
+        
+    }
+    
+    return FAIL;
+    
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_vg
+ *
+ * Purpose: locate all objects in the file under a group hierarchy
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int list_vg(int32 infile_id,
+            int32 outfile_id,
+            int32 sd_id,
+            int32 sd_out,
+            int32 gr_id,
+            int32 gr_out,
+            list_table_t *list_tbl,
+            dim_table_t *td1,
+            dim_table_t *td2,
+            options_t *options)
+{
+   
+
+    int32  vg_id;          /* vgroup identifier */
+    int32  nlones = 0;     /* number of lone vgroups */
+    int32  ntagrefs;       /* number of tag/ref pairs in a vgroup */
+    int32  *ref_array=NULL;/* buffer to hold the ref numbers of lone vgroups   */
+    int32  *tags=NULL;     /* buffer to hold the tag numbers of vgroups   */
+    int32  *refs=NULL;     /* buffer to hold the ref numbers of vgroups   */
+    int32  vgroup_id_out=0;/* vgroup identifier */
+    int32  tag_vg;
+    int32  ref_vg;
+    char   *vg_name;
+    char   *vg_class;
+    uint16 name_len;
+    int32  i;
+    
+   /*-------------------------------------------------------------------------
+    * initialize the V interface
+    *-------------------------------------------------------------------------
+    */
+    
+    if (Vstart(infile_id) == FAIL)  
+    {
+        return FAIL;
+    } 
+    
+    if (options->trip==1)
+    {
+        if (Vstart(outfile_id) == FAIL)  
+        {
+            return FAIL;
+        }
+    }
+    
+   /*-------------------------------------------------------------------------
+    * get and print the names and class names of all the lone vgroups.
+    * first, call Vlone with nlones set to 0 to get the number of
+    * lone vgroups in the file, but not to get their reference numbers.
+    *-------------------------------------------------------------------------
+    */
+    nlones = Vlone (infile_id, NULL, nlones );
+    
+    if (nlones > 0)
+    {
+       /*
+        * use the nlones returned to allocate sufficient space for the
+        * buffer ref_array to hold the reference numbers of all lone vgroups,
+        */
+        ref_array = (int32 *) malloc(sizeof(int32) * nlones);
+        
+       /*
+        * and call Vlone again to retrieve the reference numbers into 
+        * the buffer ref_array.
+        */
+        nlones = Vlone (infile_id, ref_array, nlones);
+        
+       /*
+        * iterate tru each lone vgroup.
+        */
+        for (i = 0; i < nlones; i++)
+        {
+
+            int32 ref = ref_array[i];
+	    uint16 name_len;
+
+           /*
+            * attach to the current vgroup then get its
+            * name and class. note: the current vgroup must be detached before
+            * moving to the next.
+            */
+            if ((vg_id = Vattach (infile_id, ref, "r"))==FAIL)
+            {
+                printf("Error: Could not attach group with ref <%ld>\n", ref);
+                goto out;
+            }
+
+	    /* Get vgroup's name */
+            if (Vgetnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get name lenght for group with ref <%ld>\n", ref);
+                goto out;
+            }
+            vg_name = (char *) HDmalloc(sizeof(char) * (name_len+1));
+
+            if (Vgetname (vg_id, vg_name)==FAIL)
+            {
+                printf( "Could not get name for group\n");
+                goto out;
+                
+            }
+
+	    /* Get vgroup's class name */
+            if (Vgetclassnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get name lenght for group with ref <%ld>\n", ref);
+                goto out;
+            }
+
+
+            vg_class = (char *) HDmalloc(sizeof(char) * (name_len+1));
+
+            if (Vgetclass (vg_id, vg_class)==FAIL)
+            {
+                printf( "Could not get class for group\n");
+                goto out;
+            }
+            
+            /* ignore reserved HDF groups/vdatas */
+            if( is_reserved(vg_class))
+            {
+                if (Vdetach (vg_id)==FAIL)
+                {
+                    printf( "Could not detach group\n");
+                    goto out;
+                }
+                continue;
+            }
+            if(strcmp(vg_name,GR_NAME)==0) 
+            {
+                if (Vdetach (vg_id)==FAIL)
+                {
+                    printf( "Could not detach group\n");
+                    goto out;
+                }
+                continue;
+            }
+            
+            /* get ref, tag */
+            if ((ref_vg = VQueryref(vg_id))==FAIL)
+            {
+                printf( "Failed to get ref for <%s>\n", vg_name);
+                goto out;
+            }
+            if ((tag_vg = VQuerytag(vg_id))==FAIL)
+            {
+                printf( "Failed to get tag for <%s>\n", vg_name);
+                goto out;
+            }
+            
+           /*-------------------------------------------------------------------------
+            * add object to table
+            *-------------------------------------------------------------------------
+            */
+            list_table_add(list_tbl,tag_vg,ref_vg,vg_name);
+            
+            if (options->verbose)
+                printf(PFORMAT,"","","",vg_name);  
+            
+            if (options->trip==1)
+            {
+                
+               /* 
+                * create the group in the output file.  the vgroup reference number is set
+                * to -1 for creating and the access mode is "w" for writing 
+                */
+                vgroup_id_out = Vattach (outfile_id, -1, "w");
+                if (Vsetname (vgroup_id_out, vg_name)==FAIL)
+                {
+                    printf("Error: Could not create group <%s>\n", vg_name);
+                    goto out;
+                }
+                if (Vsetclass (vgroup_id_out, vg_class)==FAIL)
+                {
+                    printf("Error: Could not create group <%s>\n", vg_name);
+                    goto out;
+                }
+                
+                if (copy_vgroup_attrs(vg_id,vgroup_id_out,vg_name,options)<0)
+                    goto out;
+                if (copy_vg_an(infile_id,outfile_id,vg_id,vgroup_id_out,vg_name,options)<0)
+                    goto out;
+            }
+            
+            
+            
+            /* insert objects for this group */
+            ntagrefs = Vntagrefs(vg_id);
+            if ( ntagrefs > 0 )
+            {
+                tags = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                refs = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                if (Vgettagrefs(vg_id, tags, refs, ntagrefs)<0)
+                    goto out;
+                
+                if (vgroup_insert(infile_id,
+                    outfile_id,
+                    sd_id,
+                    sd_out,
+                    gr_id,
+                    gr_out,
+                    vgroup_id_out,
+                    vg_name,
+                    tags,
+                    refs,
+                    ntagrefs,
+                    list_tbl,
+                    td1,
+                    td2,
+                    options)<0) {
+                    goto out;
+                }
+                
+                free (tags);
+                tags=NULL;
+                free (refs);
+                refs=NULL;
+            }
+            
+            if(Vdetach (vg_id)==FAIL)
+            {
+                printf("Error: Could not detach group <%s>\n", vg_name);
+                goto out;
+            }
+            if (options->trip==1)
+            {
+                if (Vdetach (vgroup_id_out)==FAIL)
+                {
+                    printf("Error: Could not detach group <%s>\n", vg_name);
+                    goto out;
+                }
+            }
+
+            free (vg_name);
+            
+  } /* for nlones */
+  
+  
+  /* free the space allocated */
+  if (ref_array!=NULL) 
+      free (ref_array);
+
+ } /* if  nlones */
+ 
+
+/*-------------------------------------------------------------------------
+ * terminate access to the V interface
+ *-------------------------------------------------------------------------
+ */
+ 
+ if (Vend (infile_id)==FAIL)
+ {
+     printf("Error: Could not end group interface in <%s>\n", vg_name);
+     return FAIL;
+ }
+ if (options->trip==1)
+ {
+     if (Vend (outfile_id)==FAIL){
+         printf("Error: Could not end group interface in <%s>\n", vg_name);
+         return FAIL;
+     }
+ }
+ 
+ return SUCCEED;
+ 
+ 
+out:
+ 
+ Vend (infile_id);
+ if (options->trip==1)
+     Vend (outfile_id);
+ 
+ /* free the space allocated */
+ if (ref_array!=NULL) 
+     free (ref_array);
+ if (tags!=NULL) 
+     free (tags);
+ if (refs!=NULL) 
+     free (refs);
+ 
+ return FAIL;
+ 
+}
+
+/*-------------------------------------------------------------------------
+ * Function: vgroup_insert
+ *
+ * Purpose: recursive function to locate objects in vgroups
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int vgroup_insert(int32 infile_id,
+                  int32 outfile_id,
+                  int32 sd_id,             /* SD interface identifier */
+                  int32 sd_out,            /* SD interface identifier */
+                  int32 gr_id,             /* GR interface identifier */
+                  int32 gr_out,            /* GR interface identifier */
+                  int32 vgroup_id_out_par, /* output parent group ID */
+                  char*path_name,          /* absolute path for input group name */          
+                  int32* in_tags,          /* tag list for parent group */
+                  int32* in_refs,          /* ref list for parent group */
+                  int npairs,              /* number tag/ref pairs for parent group */
+                  list_table_t *list_tbl,
+                  dim_table_t *td1,
+                  dim_table_t *td2,
+                  options_t *options)
+{
+    int32 vg_id;             /* vgroup identifier for opened group in input */
+    int32 ntagrefs;              /* number of tag/ref pairs in a vgroup */
+    int32 *tags=NULL;            /* buffer to hold the tag numbers of vgroups   */
+    int32 *refs=NULL;            /* buffer to hold the ref numbers of vgroups   */
+    int32 vgroup_id_out =-1;         /* vgroup identifier for the created group in output */
+    char  *vg_name;
+    char  *vg_class;
+    char  *path=NULL;
+    uint16 name_len;
+    int   visited;
+    int32 tag;                   
+    int32 ref; 
+    int   i;
+
+    
+    for ( i = 0; i < npairs; i++ ) 
+    {       
+        tag = in_tags[i];
+        ref = in_refs[i];
+        
+        switch(tag) 
+        {
+        /*-------------------------------------------------------------------------
+         * DFTAG_VG
+         *-------------------------------------------------------------------------
+         */
+        case DFTAG_VG: 
+
+            visited = list_table_search(list_tbl,DFTAG_VG,ref);
+            
+           /*-------------------------------------------------------------------------
+            * open input
+            *-------------------------------------------------------------------------
+            */
+                    
+            vg_id = Vattach (infile_id, ref, "r");
+
+	    /* Get vgroup's name */
+            if (Vgetnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get name lenght for group with ref <%ld>\n", ref);
+                goto out;
+            }
+            vg_name = (char *) HDmalloc(sizeof(char) * (name_len+1));
+            if (Vgetname (vg_id, vg_name)==FAIL)
+            {
+                printf( "Could not get name for group\n");
+                goto out;
+                
+            }
+
+	    /* Get vgroup's class name */
+            if (Vgetclassnamelen(vg_id, &name_len)==FAIL)
+            {
+                printf("Error: Could not get name lenght for group with ref <%ld>\n", ref);
+                goto out;
+            }
+
+            vg_class = (char *) HDmalloc(sizeof(char) * (name_len+1));
+            if (Vgetclass (vg_id, vg_class)==FAIL)
+            {
+                printf( "Could not get class for group\n");
+                goto out;
+            }
+            
+            /* ignore reserved HDF groups/vdatas */
+            if( is_reserved(vg_class))
+            {
+                if (Vdetach (vg_id)==FAIL)
+                {
+                    printf( "Could not detach group\n");
+                    goto out;
+                }
+                continue;
+            }
+            if(strcmp(vg_name,GR_NAME)==0) 
+            {
+                if (Vdetach (vg_id)==FAIL)
+                {
+                    printf( "Could not detach group\n");
+                    goto out;
+                }
+                continue;
+            }
+            
+            
+           /*-------------------------------------------------------------------------
+            * create the group in output or create the link
+            *-------------------------------------------------------------------------
+            */
+         
+            if (options->trip==1)
+            {
+            
+                if ( visited < 0 )
+                    
+                {
+                    
+                   /* 
+                    * create the group in the output file.  the vgroup reference number 
+                    * is set to -1 for creating and the access mode is "w" for writing 
+                    */
+                    vgroup_id_out = Vattach (outfile_id, -1, "w");
+                    if (Vsetname (vgroup_id_out, vg_name)==FAIL)
+                    {
+                        printf("Error: Could not create group <%s>\n", vg_name);
+                        goto out;
+                    }
+                    if (Vsetclass (vgroup_id_out, vg_class)==FAIL)
+                    {
+                        printf("Error: Could not create group <%s>\n", vg_name);
+                        goto out;
+                    }
+                    
+                    if (copy_vgroup_attrs(vg_id,vgroup_id_out,path,options)<0)
+                        goto out;
+                    if (copy_vg_an(infile_id,outfile_id,vg_id,vgroup_id_out,path,options)<0)
+                        goto out;
+                    
+                }
+                
+                else
+                    
+                {
+                    /* open previously visited group */
+                    vgroup_id_out = Vattach (outfile_id, ref, "r");
+
+
+                }
+                    
+                
+                /* insert the created (or opened) vgroup into its parent */
+                if (Vinsert (vgroup_id_out_par, vgroup_id_out)==FAIL)
+                {
+                    printf("Could not insert group <%s>\n", vg_name);
+                    goto out;
+                }
+                    
+            } /* create the group in output or create the link */
+            
+            
+            
+             
+           /*-------------------------------------------------------------------------
+            * if group not visited, add to table and check for more tag/ref pairs
+            *-------------------------------------------------------------------------
+            */
+            
+                     
+            /* check if already visited */
+            if ( visited < 0  ) 
+            {
+                
+                /* initialize path */
+                path=get_path(path_name,vg_name);
+                
+                /* add object to table */
+                list_table_add(list_tbl,tag,ref,path);
+                
+                if (options->verbose)
+                    printf(PFORMAT,"","","",path);    
+                
+                if ( options->trip==0 ) 
+                {
+                    /*we must go to other groups always */
+                }
+                
+                
+                /* insert objects for this group */
+                ntagrefs  = Vntagrefs(vg_id);
+                if ( ntagrefs > 0 )
+                {
+                    tags = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                    refs = (int32 *) malloc(sizeof(int32) * ntagrefs);
+                    if (Vgettagrefs(vg_id, tags, refs, ntagrefs)<0)
+                        goto out;
+                    /* recurse */
+                    if (vgroup_insert(
+                        infile_id,
+                        outfile_id,
+                        sd_id,
+                        sd_out,
+                        gr_id,
+                        gr_out,
+                        vgroup_id_out,
+                        path,
+                        tags,
+                        refs,
+                        ntagrefs,
+                        list_tbl,
+                        td1,
+                        td2,
+                        options)<0) {
+                        goto out;
+                    }
+                    free (tags);
+                    tags=NULL;
+                    free (refs);
+                    refs=NULL;
+                } /* ntagrefs > 0 */
+                
+                
+                if (path)
+                    free(path);
+                
+            } /* check if already visited */
+            
+            
+            if(Vdetach (vg_id)==FAIL)
+            {
+                printf("Error: Could not detach group <%s>\n", vg_name);
+                goto out;
+            }
+            if (options->trip==1)
+            {
+                if (Vdetach (vgroup_id_out)==FAIL)
+                {
+                    printf("Error: Could not detach group <%s>\n", vg_name);
+                    goto out;
+                }
+            }
+            
+            break;
+            
+            
+  /*-------------------------------------------------------------------------
+   * SDS
+   *-------------------------------------------------------------------------
+   */   
+            
+  case DFTAG_SD:  /* Scientific Data */
+  case DFTAG_SDG: /* Scientific Data Group */
+  case DFTAG_NDG: /* Numeric Data Group */
+      /* copy dataset */
+      if (copy_sds(sd_id,
+          sd_out,
+          tag,ref,
+          vgroup_id_out_par,
+          path_name,
+          options,
+          list_tbl,
+          td1,
+          td2,
+          infile_id,
+          outfile_id)<0)
+          return FAIL;
+      
+      break;
+      
+  /*-------------------------------------------------------------------------
+   * Image
+   *-------------------------------------------------------------------------
+   */   
+      
+  case DFTAG_RI:   /* Raster Image */
+  case DFTAG_CI:   /* Compressed Image */
+  case DFTAG_RIG:  /* Raster Image Group */
+  case DFTAG_RI8:  /* Raster-8 image */
+  case DFTAG_CI8:  /* RLE compressed 8-bit image */
+  case DFTAG_II8:  /* IMCOMP compressed 8-bit image */
+      /* copy GR  */
+      if (copy_gr(infile_id,
+          outfile_id,
+          gr_id,
+          gr_out,
+          tag,
+          ref,
+          vgroup_id_out_par,
+          path_name,
+          options,
+          list_tbl)<0)
+          return FAIL;
+      break;
+      
+ /*-------------------------------------------------------------------------
+  * Vdata
+  *-------------------------------------------------------------------------
+  */   
+      
+  case DFTAG_VH:  /* Vdata Header */
+      if (copy_vs(infile_id,
+          outfile_id,
+          tag,
+          ref,
+          vgroup_id_out_par,
+          path_name,
+          options,
+          list_tbl,
+          0)<0)
+          return FAIL;
+      break;
+  } /* switch */
+  
+ } /* i */
+ 
+ return SUCCEED;
+ 
+out:
+ 
+ if (tags!=NULL)
+     free (tags);
+ if (refs!=NULL)
+     free (refs);
+ 
+ return FAIL;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_gr
+ *
+ * Purpose: get top level GR image list
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int list_gr(int32 infile_id,
+            int32 outfile_id,
+            int32 gr_id,             /* GR interface identifier */
+            int32 gr_out,            /* GR interface identifier */
+            list_table_t *list_tbl,
+            options_t *options)
+{
+    int32 ri_id,             /* raster image identifier */
+          n_rimages,         /* number of raster images in the file */
+          n_file_attrs,      /* number of file attributes */
+          ri_index,          /* index of a image */
+          gr_ref,            /* reference number of the GR image */
+          dim_sizes[2],      /* dimensions of an image */
+          n_comps,           /* number of components an image contains */
+          interlace_mode,    /* interlace mode of an image */ 
+          data_type,         /* number type of an image */
+          n_attrs;           /* number of attributes belong to an image */
+    char  name[H4_MAX_GR_NAME]; /* name of an image */
+    
+    /* determine the contents of the file */
+    if (GRfileinfo (gr_id, &n_rimages, &n_file_attrs)==FAIL){
+        printf( "Could not get info for GR\n");
+        return FAIL;
+    }
+    
+    for (ri_index = 0; ri_index < n_rimages; ri_index++)
+    {
+        ri_id = GRselect (gr_id, ri_index);
+        if (GRgetiminfo (ri_id, name, &n_comps, &data_type, &interlace_mode, 
+            dim_sizes, &n_attrs)==FAIL){
+            printf("Could not get GR info\n");
+            goto out;
+        }
+        
+        gr_ref = GRidtoref(ri_id);
+        
+        /* check if already inserted in Vgroup; search all image tags */
+        if ( list_table_search(list_tbl,DFTAG_RI,gr_ref)>=0 ||
+            list_table_search(list_tbl,DFTAG_CI,gr_ref)>=0 ||
+            list_table_search(list_tbl,DFTAG_RIG,gr_ref)>=0 ||
+            list_table_search(list_tbl,DFTAG_RI8,gr_ref)>=0 ||
+            list_table_search(list_tbl,DFTAG_CI8,gr_ref)>=0 ||
+            list_table_search(list_tbl,DFTAG_II8,gr_ref)>=0 )
+        {
+            if (GRendaccess (ri_id)==FAIL){
+                printf("Could not close GR\n");
+                return FAIL;
+            }
+            continue;
+        }
+        
+        /* copy GR  */
+        if (copy_gr(infile_id,outfile_id,gr_id,gr_out,DFTAG_RI,gr_ref,0,NULL,options,list_tbl)<0)
+            goto out;
+        
+        /* terminate access to the current raster image */
+        if (GRendaccess (ri_id)==FAIL){
+            printf( "Could not end GR\n");
+            return FAIL;
+        }
+    }
+    
+     return SUCCEED;
+    
+out:
+    GRendaccess (ri_id);
+    return FAIL;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_sds
+ *
+ * Purpose: get top level SDS
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int list_sds(int32 infile_id,
+             int32 outfile_id,
+             int32 sd_id,
+             int32 sd_out,
+             list_table_t *list_tbl,
+             dim_table_t *td1,
+             dim_table_t *td2,
+             options_t *options)
+{
+    int32 sds_id,                 /* dataset identifier */
+          n_datasets,             /* number of datasets in the file */
+          n_file_attrs,           /* number of file attributes */
+          index,                  /* index of a dataset */
+          sds_ref,                /* reference number */
+          dim_sizes[H4_MAX_VAR_DIMS],/* dimensions of an image */
+          data_type,              /* number type  */
+          rank,                   /* rank */
+          n_attrs;                /* number of attributes */
+    char  name[H4_MAX_GR_NAME];      /* name of dataset */
+    
+    /* determine the number of data sets in the file and the number of file attributes */
+    if (SDfileinfo (sd_id, &n_datasets, &n_file_attrs)==FAIL){
+        printf("Could not get SDS info\n");
+        return FAIL;
+    }
+    
+    for (index = 0; index < n_datasets; index++)
+    {
+        sds_id  = SDselect (sd_id, index);
+        SDgetinfo(sds_id, name, &rank, dim_sizes, &data_type, &n_attrs);
+        sds_ref = SDidtoref(sds_id);
+        
+        /* check if already inserted in Vgroup; search all SDS tags */
+        if ( list_table_search(list_tbl,DFTAG_SD,sds_ref)>=0 ||
+            list_table_search(list_tbl,DFTAG_SDG,sds_ref)>=0 ||
+            list_table_search(list_tbl,DFTAG_NDG,sds_ref)>=0 )
+        {
+            SDendaccess (sds_id);
+            continue;
+        }
+        
+        /* copy SDS  */
+        if (copy_sds(sd_id,sd_out,TAG_GRP_DSET,sds_ref,0,NULL,options,list_tbl,td1,td2,
+            infile_id,outfile_id)<0) goto out;
+        
+        /* terminate access to the current dataset */
+        SDendaccess (sds_id);
+    }
+    
+    return SUCCEED;
+    
+out:
+    SDendaccess (sds_id);
+    return FAIL;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: list_vs
+ *
+ * Purpose: get top level VS
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int list_vs(int32 infile_id,
+            int32 outfile_id,
+            list_table_t *list_tbl,
+            options_t *options)
+{
+    int32 nlones = 0,        /* number of lone vdatas */
+          *ref_array=NULL,   /* buffer to hold the ref numbers of lone vdatas   */
+          ref;               /* temporary ref number  */
+    int   i;
+
+   /*-------------------------------------------------------------------------
+    * initialize the V interface
+    *-------------------------------------------------------------------------
+    */
+    
+    if (Vstart(infile_id) == FAIL)  
+    {
+        return FAIL;
+    } 
+    
+    if (options->trip==1)
+    {
+        if (Vstart(outfile_id) == FAIL)  
+        {
+            return FAIL;
+        }
+    }
+
+   /*-------------------------------------------------------------------------
+    * get the names and class names of all the lone vdatas
+    * first, call Vlone with nlones set to 0 to get the number of lone vdatas 
+    * in the file
+    *
+    *-------------------------------------------------------------------------
+    */
+    nlones = VSlone (infile_id, NULL, nlones );
+    
+    if (nlones > 0)
+    {
+       /*
+        * use the nlones returned to allocate sufficient space for the
+        * buffer ref_array to hold the reference numbers of all lone vgroups,
+        */
+        ref_array = (int32 *) malloc(sizeof(int32) * nlones);
+        
+       /*
+        * and call VSlone again to retrieve the reference numbers into 
+        * the buffer ref_array.
+        */
+        nlones = VSlone (infile_id, ref_array, nlones);
+        
+       /*
+        * iterate tru each lone vdata.
+        */
+        for (i = 0; i < nlones; i++)
+        {
+           /*
+            * attach to the current vdata then get its
+            * name and class. note: the current vdata must be detached before
+            * moving to the next.
+            */
+            ref = ref_array[i];
+            
+            /* check if already inserted in Vgroup, search with VS tag */
+            if ( list_table_search(list_tbl,DFTAG_VH,ref)>=0 ) 
+            {
+                continue;
+            }
+            
+            /* copy VS */
+            if (copy_vs(infile_id,outfile_id,DFTAG_VH,ref,0,NULL,options,list_tbl,1)<0)
+            {
+                goto out;
+            }
+            
+        } /* for */
+        
+        
+        /* free the space allocated */
+        if (ref_array) 
+        {
+            free (ref_array);
+            ref_array = NULL;
+        }
+    } /* if */
+    
+   /*-------------------------------------------------------------------------
+    * terminate access to the V interface
+    *-------------------------------------------------------------------------
+    */
+    if (Vend (infile_id)==FAIL)
+    {
+        printf("Error: Could not end Vdata interface\n");
+        return FAIL;
+    }
+    if (options->trip==1)
+    {
+        if (Vend (outfile_id)==FAIL){
+            printf("Error: Could not end Vdata interface\n");
+            return FAIL;
+        }
+    }
+    
+    
+    return SUCCEED;
+
+
+out:
+ 
+ Vend (infile_id);
+ if (options->trip==1)
+     Vend (outfile_id);
+ 
+ /* free the space allocated */
+ if (ref_array!=NULL) 
+     free (ref_array);
+  
+ return FAIL;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_glb
+ *
+ * Purpose: list/copy global SDS attributes, global GR atrributes
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int list_glb(int32 infile_id,
+             int32 outfile_id,
+             int32 sd_id,
+             int32 sd_out,
+             int32 gr_id,
+             int32 gr_out,
+             list_table_t *list_tbl,
+             options_t *options)
+{
+    int32 n_datasets,             /* number of datasets in the file */
+          n_file_attrs;           /* number of file attributes */
+    
+    if ( options->trip==0 ) 
+    {
+        return SUCCEED;
+    }
+    
+    /*-------------------------------------------------------------------------
+     * copy SDS global attributes
+     *-------------------------------------------------------------------------
+     */ 
+
+    /* determine the number of data sets in the file and the number of file attributes */
+    if (SDfileinfo (sd_id, &n_datasets, &n_file_attrs)==FAIL)
+    {
+        printf("Could not get SDS info\n");
+        return FAIL;
+    }
+    
+    if (copy_sds_attrs(sd_id,sd_out,n_file_attrs,options)<0)
+        return FAIL;
+    
+    /*-------------------------------------------------------------------------
+     * copy GR global attributes
+     *-------------------------------------------------------------------------
+     */ 
+   
+    /* determine the number of data sets in the file and the number of file attributes */
+    if (GRfileinfo (gr_id, &n_datasets, &n_file_attrs)==FAIL)
+    {
+        printf("Could not get GR info\n");
+        return FAIL;
+    }
+    if (copy_gr_attrs(gr_id,gr_out,n_file_attrs,options)<0)
+        return FAIL;
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_an
+ *
+ * Purpose: list/copy AN FILE objects
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int list_an(int32 infile_id,
+            int32 outfile_id,
+            options_t *options)
+{
+    int32 an_id,         /* AN interface identifier */
+          ann_id,        /* an annotation identifier */
+          ann_length,    /* length of the text in an annotation */
+          an_out,        /* AN interface identifier */
+          file_label_id, /* file label identifier */
+          file_desc_id,  /* file description identifier */
+          n_file_labels, n_file_descs, n_data_labels, n_data_descs;
+    char  *ann_buf=NULL; /* buffer to hold the read annotation */
+    int   i;             /* position of an annotation in all of the same type*/
+    
+    if ( options->trip==0 ) 
+    {
+        return SUCCEED;
+    }
+    
+    /* Initialize the AN interface  */
+    an_id  = ANstart (infile_id);
+    an_out = ANstart (outfile_id);
+    
+    /*
+     * Get the annotation information, e.g., the numbers of file labels, file
+     * descriptions, data labels, and data descriptions.
+     */
+    if (ANfileinfo (an_id,&n_file_labels,&n_file_descs,&n_data_labels,&n_data_descs)==FAIL)
+    {
+        printf( "Could not get AN info\n");
+        goto out;
+    }
+    
+    
+   /*-------------------------------------------------------------------------
+    * AN_FILE_LABEL
+    *-------------------------------------------------------------------------
+    */ 
+    
+    
+    for (i = 0; i < n_file_labels; i++)
+    {
+        /* Get the identifier of the current data label */
+        ann_id = ANselect (an_id, i, AN_FILE_LABEL);
+        
+        /* Get the length of the data label */
+        ann_length = ANannlen (ann_id);
+        
+        /* Allocate space for the buffer to hold the data label text */
+        ann_buf = malloc ((ann_length+1) * sizeof (char));
+        
+       /*
+        * Read and display the file label.  Note that the size of the buffer,
+        * i.e., the third parameter, is 1 character more than the length of
+        * the data label; that is for the null character.  It is not the case
+        * when a description is retrieved because the description does not 
+        * necessarily end with a null character.
+        * 
+        */
+        if (ANreadann (ann_id, ann_buf, ann_length+1)==FAIL)
+        {
+            printf( "Could not read AN\n");
+            goto out;
+        }
+        
+        /* Create the file label */
+        file_label_id = ANcreatef (an_out, AN_FILE_LABEL);
+        
+        /* Write the annotations  */
+        if (ANwriteann (file_label_id, ann_buf, ann_length)==FAIL) 
+        {
+            printf("Failed to write file label %d\n", i);
+            goto out;
+        }
+        
+        /* Terminate access to the current data label */
+        if (ANendaccess (ann_id)==FAIL || ANendaccess (file_label_id)==FAIL)
+        {
+            printf( "Could not end AN\n");
+            goto out;
+        }
+        
+        
+        /* Free the space allocated for the annotation buffer */
+        if (ann_buf)
+            free (ann_buf);
+    }
+    
+    /*-------------------------------------------------------------------------
+     * AN_FILE_DESC
+     *-------------------------------------------------------------------------
+     */ 
+    
+    for (i = 0; i < n_file_descs; i++)
+    {
+        /* Get the identifier of the current data label */
+        ann_id = ANselect (an_id, i, AN_FILE_DESC);
+        
+        /* Get the length of the data label */
+        ann_length = ANannlen (ann_id);
+        
+        /* Allocate space for the buffer to hold the data label text */
+        ann_buf = malloc ((ann_length+1) * sizeof (char));
+        
+        if (ANreadann (ann_id, ann_buf, ann_length+1)==FAIL)
+        {
+            printf( "Could not read AN\n");
+            goto out;
+        }
+        
+        /* Create the label */
+        file_desc_id = ANcreatef (an_out, AN_FILE_DESC);
+        
+        /* Write the annotations  */
+        if (ANwriteann (file_desc_id, ann_buf, ann_length)==FAIL)
+        {
+            printf("Failed to write file description %d\n", i);
+            goto out;
+        }
+        
+        /* Terminate access to the current data label */
+        if (ANendaccess (ann_id)==FAIL || ANendaccess (file_desc_id)==FAIL)
+        {
+            printf( "Could not read AN\n");
+            goto out;
+        }
+        
+        /* Free the space allocated for the annotation buffer */
+        if (ann_buf)
+        {
+            free (ann_buf);
+            ann_buf = NULL;
+        }
+    }
+    
+
+   /* Terminate access to the AN interface */
+    if (ANend (an_id)==FAIL || ANend (an_out)==FAIL)
+    {
+        printf( "Could not end AN\n");
+        goto out;
+    }
+
+    return SUCCEED;
+    
+out:
+    if (ANend (an_id)==FAIL || ANend (an_out)==FAIL)
+    {
+        printf( "Could not end AN\n");
+    }
+    if (ann_buf!=NULL)
+        free (ann_buf);
+    
+    return FAIL;
+    
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_pal
+ *
+ * Purpose: list/copy lone palettes
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int list_pal(const char* infname,
+             const char* outfname,
+             list_table_t *list_tbl,
+             options_t *options)
+{
+    uint8  palette_data[256*3];
+    intn   nPals, j;
+    uint16 ref;
+    
+    if ( options->trip==0 ) 
+    {
+        return SUCCEED;
+    }
+    
+    DFPrestart();
+    
+    if((nPals = DFPnpals (infname))==FAIL ) 
+    {
+        printf( "Failed to get palettes in <%s>\n", infname);
+        return FAIL;
+    }
+    
+    for ( j = 0; j < nPals; j++) 
+    {
+        if (DFPgetpal(infname, (VOIDP)palette_data)==FAIL ) 
+        {
+            printf( "Failed to read palette <%d> in <%s>\n", j, infname);
+            return FAIL;
+        }
+        
+        ref=DFPlastref();
+        
+        /* check if already inserted in image */
+        if ( list_table_search(list_tbl,DFTAG_IP8,ref)>=0 )
+        {
+            continue;
+        }
+        
+        if (DFPaddpal(outfname,palette_data)==FAIL)
+        {
+            printf( "Failed to write palette in <%s>\n", outfname);
+            return FAIL;
+        }
+        
+    }
+    
+    return SUCCEED;
+}
+
diff --git a/mfhdf/hrepack/hrepack_lsttable.c b/mfhdf/hrepack/hrepack_lsttable.c
new file mode 100644
index 0000000..5dcde48
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_lsttable.c
@@ -0,0 +1,228 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+
+#include "hrepack_lsttable.h"
+
+/*-------------------------------------------------------------------------
+ * Function: list_table_search
+ *
+ * Purpose: linear search the table for tag and ref
+ *
+ * Return: index on success, -1 on failure
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int list_table_search(list_table_t *list_tbl, int tag, int ref )
+{
+    int i;
+    
+    for (i = 0; i < list_tbl->nobjs; i++) 
+    {
+        if (list_tbl->objs[i].tag == tag && list_tbl->objs[i].ref == ref)
+            return i;
+    }
+    
+    return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_table_add
+ *
+ * Purpose: add pair tag/ref and object path to table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void list_table_add(list_table_t *list_tbl, int tag, int ref, char* path)
+{
+    int path_len;
+    int i;
+    
+    if (list_tbl->nobjs == list_tbl->size) 
+    {
+        list_tbl->size *= 2;
+        list_tbl->objs = (obj_info_t*)realloc(list_tbl->objs, list_tbl->size * sizeof(obj_info_t));
+        
+        for (i = list_tbl->nobjs; i < list_tbl->size; i++) 
+        {
+            list_tbl->objs[i].tag = -1;
+            list_tbl->objs[i].ref = -1;
+            list_tbl->objs[i].path = NULL;
+        }
+    }
+    
+    i = list_tbl->nobjs++;
+    list_tbl->objs[i].tag = tag;
+    list_tbl->objs[i].ref = ref;
+
+    /* copy the path over */
+    path_len = HDstrlen(path);
+    list_tbl->objs[i].path = (char *)HDmalloc(path_len+1);
+    HIstrncpy(list_tbl->objs[i].path, path, path_len+1);
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_table_init
+ *
+ * Purpose: initialize table
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void list_table_init( list_table_t **tbl )
+{
+    int i;
+    list_table_t* list_tbl = (list_table_t*) malloc(sizeof(list_table_t));
+    
+    list_tbl->size = 20;
+    list_tbl->nobjs = 0;
+    list_tbl->objs = (obj_info_t*) malloc(list_tbl->size * sizeof(obj_info_t));
+    
+    for (i = 0; i < list_tbl->size; i++) 
+    {
+        list_tbl->objs[i].tag = -1;
+        list_tbl->objs[i].ref = -1;
+        
+    }
+    
+    *tbl = list_tbl;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: list_table_free
+ *
+ * Purpose: free table memory
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void list_table_free( list_table_t *list_tbl )
+{
+    int i;
+
+    for (i = 0; i < list_tbl->nobjs; i++) 
+    {
+        assert(list_tbl->objs[i].path);
+        free(list_tbl->objs[i].path);
+    }
+    free(list_tbl->objs);
+    free(list_tbl);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_table_check
+ *
+ * Purpose: search the table for valid objects
+ *
+ * Return: error string or NULL for success
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+const char* list_table_check(list_table_t *list_tbl, char*obj_name)
+{
+    int   i;
+    int32 tag;
+    
+    for (i = 0; i < list_tbl->nobjs; i++)
+    {
+        if (strcmp(list_tbl->objs[i].path,obj_name)==0)
+        {
+            /* found the name; check if it is an SDS or Image */
+            tag=list_tbl->objs[i].tag;
+            if (tag==DFTAG_SD  ||
+                tag==DFTAG_SDG ||
+                tag==DFTAG_NDG ||
+                tag==DFTAG_RI  ||
+                tag==DFTAG_CI  ||
+                tag==DFTAG_RIG ||
+                tag==DFTAG_RI8 ||
+                tag==DFTAG_CI8 ||
+                tag==DFTAG_II8 ) return NULL; 
+            else return "not compressible/chunk object";
+        }
+    }
+    
+    return "not found";
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: list_table_print
+ *
+ * Purpose: print object list
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 25, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void list_table_print(list_table_t *list_tbl)
+{
+    int i;
+    
+    printf("---------------------------------------\n");
+    printf("%5s %6s    %-15s\n", "Tag", "Ref", "Name");
+    printf("---------------------------------------\n");
+    
+    for (i = 0; i < list_tbl->nobjs; i++)
+    {
+        printf("%5d %6d    %-15s\n", 
+            list_tbl->objs[i].tag, 
+            list_tbl->objs[i].ref, 
+            list_tbl->objs[i].path);
+    }
+    
+}
+
+
diff --git a/mfhdf/hrepack/hrepack_lsttable.h b/mfhdf/hrepack/hrepack_lsttable.h
new file mode 100644
index 0000000..c831d6d
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_lsttable.h
@@ -0,0 +1,76 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_LSTTABLE_H_
+#define REPACK_LSTTABLE_H_
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+
+#define PFORMAT  "  %-7s %-4s %-10s %-7s\n" /*chunk info, compression info, ratio, name*/
+#define PFORMAT1 "  %-7s %-7s %-7s"   /*chunk info, compression info, name*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ structure to store the tag/ref and path of an object 
+ the pair tag/ref uniquely identifies an HDF object 
+ the path field is used for information purposes
+*/
+typedef struct obj_info_t {
+ int   tag;
+ int   ref;
+ char  *path;  /*  build a path for each object using the vgroup separation symbol "/" 
+                *  along the vgroup hierarchy traversal, e.g., the vgroup hierarchy
+                *
+                *    vg0 -----> vg1 -----> vg2 -----> sds1
+                *                   -----> vg3 -----> sds2
+                *
+                *  would built 6 objects with the paths
+                *    
+                *    vg0
+                *    vg0/vg1
+                *    vg0/vg1/vg2
+                *    vg0/vg1/vg2/sds1
+                *    vg0/vg1/vg3
+                *    vg0/vg1/vg3/sds2
+                */
+} obj_info_t;
+
+/*struct that stores all objects */
+typedef struct list_table_t {
+ int        size;
+ int        nobjs;
+ obj_info_t *objs;
+} list_table_t;
+
+
+/* table methods */
+void  list_table_init(list_table_t **list_tbl);
+void  list_table_free(list_table_t *list_tbl);
+int   list_table_search(list_table_t *list_tbl, int tag, int ref );
+void  list_table_add(list_table_t *list_tbl, int tag, int ref, char* obj_name);
+const char* list_table_check(list_table_t *list_tbl, char*obj_name);
+void  list_table_print(list_table_t *list_tbl);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_LSTTABLE_H_ */
diff --git a/mfhdf/hrepack/hrepack_main.c b/mfhdf/hrepack/hrepack_main.c
new file mode 100644
index 0000000..6828449
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_main.c
@@ -0,0 +1,202 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf.h"
+#include "hfile.h"
+#include "mfhdf.h"
+#include "hrepack.h"
+#include "hrepack_parse.h"
+#include "hrepack_opttable.h"
+
+static void usage(void);
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: hrepack main program
+ *
+ * Programmer: Pedro Vicente Nunes, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 10, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int main(int argc, char **argv)
+{
+    char        *infile  = NULL;
+    char        *outfile = NULL;
+    options_t   options;            /*the global options */
+    int         i;
+    int         ret;
+    
+    
+    /* initialize options  */
+    hrepack_init (&options,0);
+    
+    for ( i = 1; i < argc; i++) 
+    {
+        if (strcmp(argv[i], "-i") == 0) {
+            infile = argv[++i];
+        }
+        else if (strcmp(argv[i], "-o") == 0) {       
+            outfile = argv[++i]; 
+        }
+        else if (strcmp(argv[i], "-h") == 0) {       
+	    goto out;
+        }
+        else if (strcmp(argv[i], "-v") == 0) {       
+            options.verbose = 1;
+        }
+        else if (strcmp(argv[i], "-V") == 0) {       
+            printf("%s, %s\n\n", argv[0], LIBVER_STRING );
+            exit(0);
+        }
+        else if (strcmp(argv[i], "-t") == 0) {  
+            
+            /* add the -t option */
+            if (hrepack_addcomp(argv[i+1],&options)<0)
+                goto out;
+            
+            /* jump to next */
+            ++i;
+        }
+        else if (strcmp(argv[i], "-c") == 0) {       
+            
+            /* parse the -c option */
+            if (hrepack_addchunk(argv[i+1],&options)<0)
+                goto out;
+            
+            /* jump to next */
+            ++i;
+        }
+        
+        else if (strcmp(argv[i], "-m") == 0) {       
+            
+            options.threshold = parse_number(argv[i+1]);
+            if (options.threshold==-1) {
+                printf("Error: Invalid treshold size <%s>\n",argv[i+1]);
+                goto out;
+            }
+            ++i;
+        }
+        
+        else if (strcmp(argv[i], "-f") == 0) {       
+            if (read_info(argv[++i],&options)<0)
+                goto out;
+        }
+        
+        else if (argv[i][0] == '-') {
+            goto out;
+        }
+    }
+    
+    if (infile == NULL || outfile == NULL) 
+        goto out;
+    
+    /* zip it */
+    ret=hrepack_main(infile,outfile,&options);
+    
+    /* free tables */
+    hrepack_end(&options);
+    
+    /* unix error return code */
+    if (ret==-1)
+        return 1;
+    else
+        return 0;
+    
+out:
+
+    usage();
+    
+    /* free tables */
+    hrepack_end(&options);
+    return 0;
+    
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: print usage
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+void usage(void)
+{
+
+ printf("usage: hrepack -i input -o output [-V] [-h] [-v] [-t 'comp_info'] [-c 'chunk_info'] [-f cfile] [-m size]\n");
+ printf("  -i input          input HDF File\n");
+ printf("  -o output         output HDF File\n");
+ printf("  [-V]              prints version of the HDF4 library and exits\n");
+ printf("  [-h]              prints this usage\n");
+ printf("  [-v]              verbose mode\n");
+ printf("  [-t 'comp_info']  compression type: 'comp_info' is a string with the format\n");
+ printf("\t\t     <object list>:<type of compression><parameters>\n");
+ printf("\t\t     <object list> is a comma separated list of object names\n");
+ printf("\t\t        meaning apply compression only to those objects\n");
+ printf("\t\t        '*' means all objects\n");
+ printf("\t\t     <type of compression> can be:\n");
+ printf("\t\t       RLE, for RLE compression\n");
+ printf("\t\t       HUFF, for Huffman\n");
+ printf("\t\t       GZIP, for gzip\n");
+ printf("\t\t       JPEG, for JPEG (for images only)\n");
+ printf("\t\t       SZIP, for szip\n");
+ printf("\t\t       NONE, to uncompress\n");
+ printf("\t\t     <parameters> is optional compression info\n");
+ printf("\t\t       RLE, no parameter\n");
+ printf("\t\t       HUFF, the skip-size\n");
+ printf("\t\t       GZIP, the deflation level\n");
+ printf("\t\t       JPEG, the quality factor\n");
+ printf("\t\t       SZIP, pixels per block, compression mode (NN or EC)\n");
+ printf("  [-c 'chunk_info'] apply chunking. 'chunk_info' is a string with the format\n");
+ printf("\t\t     <object list>:<chunk information>\n");
+ printf("\t\t       <object list> is a comma separated list of object names\n");
+ printf("\t\t         meaning apply chunking only to those objects\n");
+ printf("\t\t         '*' means all objects\n");
+ printf("\t\t       <chunk information> is the chunk size of each dimension:\n");
+ printf("\t\t        <dim_1 x dim_2 x ... dim_n> or\n");
+ printf("\t\t        NONE, to unchunk a previous chunked object\n");
+ printf("  [-f cfile]      file with compression information -t and -c\n");
+ printf("  [-m size]       do not compress objects smaller than size (bytes)\n");
+ printf("\n");
+ printf("Examples:\n");
+ printf("\n");
+ printf("1) hrepack -v -i file1.hdf -o file2.hdf -t '*:RLE'\n");
+ printf("   compresses all objects in the file file1.hdf, using RLE compression\n");
+ printf("\n");
+ printf("2) hrepack -v -i file1.hdf -o file2.hdf -t '/group1/A,/group2/B,C:HUFF 1'\n");
+ printf("   applies Skipping Huffman compression with skip factor of 1,\n");
+ printf("   for objects /group1/A, /group2/B and C\n");
+ printf("\n");
+ printf("2) hrepack -v -i file1.hdf -o file2.hdf -t '/group1/D:RLE' -c 'D,E:10x10'\n");
+ printf("   applies RLE compression for object /group1/D\n");
+ printf("   applies chunking to objects D and E using a chunk size of 10 for the 2 dimensions\n");
+ printf("\n");
+ printf("3) hrepack -v -i file1.hdf -o file2.hdf -t 'A:NONE'\n");
+ printf("   uncompresses object A\n");
+ printf("\n");
+ printf("4) hrepack -v -i file1.hdf -o file2.hdf -t 'A:SZIP 8,NN'\n");
+ printf("   applies SZIP compression to object A, with parameters 8 and NN\n");
+ printf("\n");
+ printf("Note: the use of the verbose option -v is recommended\n");
+}
+
diff --git a/mfhdf/hrepack/hrepack_opttable.c b/mfhdf/hrepack/hrepack_opttable.c
new file mode 100644
index 0000000..6b2c226
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_opttable.c
@@ -0,0 +1,277 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <string.h>
+#include <stdio.h>
+
+#include "hrepack_opttable.h"
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: options_table_init
+ *
+ * Purpose: init options table
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void options_table_init( options_table_t **tbl )
+{
+    int i;
+    options_table_t* op_tbl = (options_table_t*) malloc(sizeof(options_table_t));
+    
+    op_tbl->size   = 3;
+    op_tbl->nelems = 0;
+    op_tbl->objs   = (pack_info_t*) malloc(op_tbl->size * sizeof(pack_info_t));
+    
+    for (i = 0; i < op_tbl->size; i++) {
+        strcpy(op_tbl->objs[i].objpath,"\0");
+        op_tbl->objs[i].comp.info  = -1;
+        op_tbl->objs[i].comp.type  = COMP_CODE_NONE;
+        op_tbl->objs[i].chunk.rank = -1;
+    }
+    
+    *tbl = op_tbl;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: options_table_free
+ *
+ * Purpose: free table memory
+ *
+ * Return: void
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void options_table_free( options_table_t *op_tbl )
+{
+    if (op_tbl->objs!=NULL)
+        free(op_tbl->objs);
+    if (op_tbl!=NULL)
+        free(op_tbl);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: options_add_chunk
+ *
+ * Purpose: add a chunking -c option to the option list
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int options_add_chunk(obj_list_t *obj_list,
+                      int n_objs,
+                      int32 *chunk_lengths,
+                      int chunk_rank,
+                      options_table_t *op_tbl )
+{
+    int i, j, k, I, added=0, found=0;
+    
+    if (op_tbl->nelems+n_objs >= op_tbl->size) {
+        op_tbl->size += n_objs;
+        op_tbl->objs = (pack_info_t*)realloc(op_tbl->objs, op_tbl->size * sizeof(pack_info_t));
+        for (i = op_tbl->nelems; i < op_tbl->size; i++) {
+            strcpy(op_tbl->objs[i].objpath,"\0");
+            op_tbl->objs[i].comp.info  = -1;
+            op_tbl->objs[i].comp.type  = COMP_CODE_NONE;
+            op_tbl->objs[i].chunk.rank = -1;
+        }
+    }
+    
+    /* search if this object is already in the table; "path" is the key */
+    if (op_tbl->nelems>0)
+    {
+        /* go tru the supplied list of names */
+        for (j = 0; j < n_objs; j++) 
+        {
+            /* linear table search */
+            for (i = 0; i < op_tbl->nelems; i++) 
+            {
+                /*already on the table */
+                if (strcmp(obj_list[j].obj,op_tbl->objs[i].objpath)==0)
+                {
+                    /* already chunk info inserted for this one; exit */
+                    if (op_tbl->objs[i].chunk.rank>0)
+                    {
+                        printf("Input Error: chunk information already inserted for <%s>\n",obj_list[j].obj);
+                        return FAIL;
+                    }
+                    /* insert the chunk info */
+                    else
+                    {
+                        op_tbl->objs[i].chunk.rank = chunk_rank;
+                        for (k = 0; k < chunk_rank; k++) 
+                            op_tbl->objs[i].chunk.chunk_lengths[k] = chunk_lengths[k];
+                        found=1;
+                        break;
+                    }
+                } /* if */
+            } /* i */
+            
+            if (found==0)
+            {
+                /* keep the grow in a temp var */
+                I = op_tbl->nelems + added;  
+                added++;
+                strcpy(op_tbl->objs[I].objpath,obj_list[j].obj);
+                op_tbl->objs[I].chunk.rank = chunk_rank;
+                for (k = 0; k < chunk_rank; k++) 
+                    op_tbl->objs[I].chunk.chunk_lengths[k] = chunk_lengths[k];
+            }
+        } /* j */ 
+    }
+    
+    /* first time insertion */
+    else
+    {
+        /* go tru the supplied list of names */
+        for (j = 0; j < n_objs; j++) 
+        {
+            I = op_tbl->nelems + added;  
+            added++;
+            strcpy(op_tbl->objs[I].objpath,obj_list[j].obj);
+            op_tbl->objs[I].chunk.rank = chunk_rank;
+            for (k = 0; k < chunk_rank; k++) 
+                op_tbl->objs[I].chunk.chunk_lengths[k] = chunk_lengths[k];
+        }
+    }
+    
+    op_tbl->nelems+= added;
+    
+    return SUCCEED;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: options_add_comp
+ *
+ * Purpose: add a compression -t option to the option list
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int options_add_comp(obj_list_t *obj_list,
+                     int n_objs,
+                     comp_info_t comp,
+                     options_table_t *op_tbl )
+{
+    int i, j, I, added=0, found=0;
+    
+    if (op_tbl->nelems+n_objs >= op_tbl->size) {
+        op_tbl->size += n_objs;
+        op_tbl->objs = (pack_info_t*)realloc(op_tbl->objs, op_tbl->size * sizeof(pack_info_t));
+        for (i = op_tbl->nelems; i < op_tbl->size; i++) {
+            strcpy(op_tbl->objs[i].objpath,"\0");
+            op_tbl->objs[i].comp.info  = -1;
+            op_tbl->objs[i].comp.type  = COMP_CODE_NONE;
+            op_tbl->objs[i].chunk.rank = -1;
+        }
+    }
+    
+    /* search if this object is already in the table; "path" is the key */
+    if (op_tbl->nelems>0)
+    {
+        /* go tru the supplied list of names */
+        for (j = 0; j < n_objs; j++) 
+        {
+            /* linear table search */
+            for (i = 0; i < op_tbl->nelems; i++) 
+            {
+                /*already on the table */
+                if (strcmp(obj_list[j].obj,op_tbl->objs[i].objpath)==0)
+                {
+                    /* already COMP info inserted for this one; exit */
+                    if (op_tbl->objs[i].comp.type>0)
+                    {
+                        printf("Input Error: compression information already inserted for <%s>\n",obj_list[j].obj);
+                        return FAIL;
+                    }
+                    /* insert the comp info */
+                    else
+                    {
+                        op_tbl->objs[i].comp = comp;
+                        found=1;
+                        break;
+                    }
+                } /* if */
+            } /* i */
+            
+            if (found==0)
+            {
+                /* keep the grow in a temp var */
+                I = op_tbl->nelems + added;  
+                added++;
+                strcpy(op_tbl->objs[I].objpath,obj_list[j].obj);
+                op_tbl->objs[I].comp = comp;
+            }
+        } /* j */ 
+    }
+    
+    /* first time insertion */
+    else
+    {
+        /* go tru the supplied list of names */
+        for (j = 0; j < n_objs; j++) 
+        {
+            I = op_tbl->nelems + added;  
+            added++;
+            strcpy(op_tbl->objs[I].objpath,obj_list[j].obj);
+            op_tbl->objs[I].comp = comp;
+        }
+    }
+    
+    op_tbl->nelems+= added;
+    
+    return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: options_get_object
+ *
+ * Purpose: get object from table; "path" is the key
+ *
+ * Return: information for one object, contains PATH, CHUNK info and COMP info
+ *
+ *-------------------------------------------------------------------------
+ */
+
+pack_info_t* options_get_object(char *path,
+                                options_table_t *op_tbl)
+{
+    int i;
+    
+    for ( i = 0; i < op_tbl->nelems; i++) 
+    {
+        /* found it */
+        if (strcmp(op_tbl->objs[i].objpath,path)==0)
+        {
+            return (&op_tbl->objs[i]);
+        }
+    }
+    
+    return NULL;
+}
+
+
+
+
diff --git a/mfhdf/hrepack/hrepack_opttable.h b/mfhdf/hrepack/hrepack_opttable.h
new file mode 100644
index 0000000..166f1e4
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_opttable.h
@@ -0,0 +1,43 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_OPTTABLE_H_
+#define REPACK_OPTTABLE_H_
+
+#include "hdf.h"
+#include "mfhdf.h"
+
+#include "hrepack.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void options_table_init( options_table_t **tbl );
+void options_table_free( options_table_t *table );
+int options_add_chunk(obj_list_t *obj_list,int n_objs,int32 *chunk_lengths,
+                      int chunk_rank,options_table_t *table );
+int options_add_comp(obj_list_t *obj_list,int n_objs,comp_info_t comp,
+                     options_table_t *table );
+pack_info_t* options_get_object(char *path,options_table_t *table);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_OPTTABLE_H_ */
diff --git a/mfhdf/hrepack/hrepack_parse.c b/mfhdf/hrepack/hrepack_parse.c
new file mode 100644
index 0000000..95d87e6
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_parse.c
@@ -0,0 +1,526 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h> /*isdigit*/
+
+#include "hrepack.h"
+#include "hrepack_parse.h"
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+
+/*-------------------------------------------------------------------------
+ * Function: parse_comp
+ *
+ * Purpose: read compression info
+ *
+ * Return: a list of names, the number of names and its compression type
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 15, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+obj_list_t* parse_comp(const char *str, 
+                       int *n_objs, 
+                       comp_info_t *comp)
+{
+    unsigned    i, u;
+    char        c;
+    size_t      len=strlen(str);
+    int         j, m, n, k, end_obj=-1, no_param=0, l;
+    char        obj[H4_MAX_NC_NAME]; 
+    char        scomp[10];
+    char        stype[5];
+    char        smask[3]; 
+    obj_list_t* obj_list=NULL;
+    
+    /* check for the end of object list and number of objects */
+    for ( i=0, n=0; i<len; i++)
+    {
+        c = str[i];
+        if ( c==':' )
+        {
+            end_obj=i;
+        }
+        if ( c==',' )
+        {
+            n++;
+        }
+    }
+    
+    if (end_obj==-1) { /* missing : */
+        printf("Input Error: Invalid compression input in <%s>\n",str);
+        return NULL;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * allocate the object list of names
+    *-------------------------------------------------------------------------
+    */
+    
+    n++;
+    obj_list=HDmalloc(n*sizeof(obj_list_t));
+    *n_objs=n;
+    
+    /* get object list */
+    for ( j=0, k=0, n=0; j<end_obj; j++,k++)
+    {
+        c = str[j];
+        obj[k]=c;
+        if ( c==',' || j==end_obj-1) 
+        {
+            if ( c==',') obj[k]='\0'; else obj[k+1]='\0';
+            strcpy(obj_list[n].obj,obj);
+            memset(obj,0,sizeof(obj));
+            n++;
+            k=-1;
+        }
+    }
+    /* nothing after : */
+    if (end_obj+1==(int)len)
+    {
+        printf("Input Error: Invalid compression type in <%s>\n",str);
+        goto out;
+    }
+    
+    
+   /*-------------------------------------------------------------------------
+    * get compression type 
+    *-------------------------------------------------------------------------
+    */
+    
+    m=0;
+    for ( i=end_obj+1, k=0; i<len; i++,k++)
+    {
+        c = str[i];
+        scomp[k]=c;
+        if ( c==' ' || i==len-1) 
+        {
+            if ( c==' ')  /*one more parameter */
+            {     
+                scomp[k]='\0';     /*cut space */
+                
+               /*
+                SZIP is a special case , it can be
+                SZIP=8,EC
+                SZIP=8,NN 
+                */
+                
+                if (strcmp(scomp,"SZIP")==0)
+                {
+                    l=-1; /* mask index check */
+                    for ( m=0,u=i+1; u<len; u++,m++) 
+                    {
+                        if (str[u]==',')
+                        {
+                            stype[m]='\0'; /* end digit of szip */
+                            l=0;  /* start EC or NN search */
+                            u++;  /* skip ',' */
+                        }
+                        c = str[u];
+                        if (!isdigit(c) && l==-1){
+                            printf("Input Error: Compression parameter not digit in <%s>\n",str);
+                            goto out;
+                        }
+                        if (l==-1)
+                            stype[m]=c;
+                        else 
+                        {
+                            smask[l]=c;
+                            l++;
+                            if (l==2)
+                            {
+                                smask[l]='\0';
+                                i=len-1; /* end */
+                                (*n_objs)--; /* we counted an extra ',' */
+                                if (strcmp(smask,"NN")==0) 
+                                    comp->szip_mode=NN_MODE;
+                                else if (strcmp(smask,"EC")==0)
+                                    comp->szip_mode=EC_MODE;
+                                else
+                                {
+                                    printf("Input Error: szip mask must be 'NN' or 'EC' \n");
+                                    goto out;
+                                }
+                            }
+                        }
+                    }  /* u */
+                } /* SZIP */
+                
+                else
+                    
+                {
+                    /* here we could have 1, 2 or 3 digits (2 and 3 in the JPEG case) */
+                    for ( m=0,u=i+1; u<len; u++,m++) 
+                    {
+                        c = str[u];
+                        if (!isdigit(c)){
+                            printf("Input Error: Compression parameter not digit in <%s>\n",str);
+                            goto out;
+                        }
+                        stype[m]=c;
+                    } /* m */
+                    
+                } /* else , no SZIP */
+                
+                
+                /* set return value of the compression parameter */
+                stype[m]='\0';
+                comp->info=atoi(stype);
+                i+=m; /* jump */
+                
+                
+            } /* if c==' ' */
+            
+            
+            else if (i==len-1) { /*no more parameters */
+                scomp[k+1]='\0';
+                no_param=1;
+            }
+            
+            if (HDstrcmp(scomp,"NONE")==0)
+                comp->type=COMP_CODE_NONE;
+            else if (HDstrcmp(scomp,"RLE")==0)
+            {
+                comp->type=COMP_CODE_RLE;
+                if (m>0){ /*RLE does not have parameter */
+                    printf("Input Error: Extra compression parameter in RLE <%s>\n",str);
+                    goto out;
+                }
+            }
+            else if (HDstrcmp(scomp,"HUFF")==0)
+            {
+                comp->type=COMP_CODE_SKPHUFF;
+                if (no_param) { /*no more parameters, HUFF must have parameter */
+                    printf("Input Error: Missing compression parameter in <%s>\n",str);
+                    goto out;
+                }
+            }
+            else if (HDstrcmp(scomp,"GZIP")==0)
+            {
+                comp->type=COMP_CODE_DEFLATE;
+                if (no_param) { /*no more parameters, GZIP must have parameter */
+                    printf("Input Error: Missing compression parameter in <%s>\n",str);
+                    goto out;
+                }
+            }
+            else if (HDstrcmp(scomp,"JPEG")==0)
+            {
+                comp->type=COMP_CODE_JPEG;
+                if (no_param) { /*no more parameters, JPEG must have parameter */
+                    printf("Input Error: Missing compression parameter in <%s>\n",str);
+                    goto out;
+                }
+            }
+            else if (HDstrcmp(scomp,"SZIP")==0)
+            {
+#ifdef H4_HAVE_LIBSZ
+                if (SZ_encoder_enabled()) {
+                    comp->type=COMP_CODE_SZIP;
+                    if (no_param) { /*no more parameters, SZIP must have parameter */
+                        printf("Input Error: Missing compression parameter in <%s>\n",str);
+                        goto out;
+                    }
+                    if (comp->szip_mode==FAIL) {
+                        printf("Input Error: SZIP compression mode must be NN_MODE or EC_MODE");
+                        goto out;
+                    }
+                } else {
+                    printf("Input Error: SZIP encoder is not available\n");
+                    goto out;
+                }
+#else
+                printf("Input Error: SZIP compression is not available\n");
+                goto out;
+#endif
+            }
+            else {
+                printf("Input Error: Invalid compression type in <%s>\n",str);
+                goto out;
+            }
+  }
+ } /*i*/
+ 
+ 
+  /*-------------------------------------------------------------------------
+   * check valid parameters
+   *-------------------------------------------------------------------------
+   */
+   
+   switch (comp->type)
+   {
+   default:
+       break;
+   case COMP_CODE_RLE:
+       break;
+   case COMP_CODE_SKPHUFF:
+       if (comp->info<=0 ){
+           printf("Input Error: Invalid compression parameter in <%s>\n",str);
+           goto out;
+       }
+       break;
+   case COMP_CODE_DEFLATE:
+       if (comp->info<0 || comp->info>9 ){
+           printf("Input Error: Invalid compression parameter in <%s>\n",str);
+           goto out;
+       }
+       break;
+   case COMP_CODE_JPEG:
+       if (comp->info<0 || comp->info>100 ){
+           printf("Input Error: Invalid compression parameter in <%s>\n",str);
+           goto out;
+       }
+       break;
+   case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+       if ( (comp->info<=1 || comp->info > SZ_MAX_PIXELS_PER_BLOCK) || 
+           (comp->info%2!=0)  ){
+           printf("Input Error: Invalid compression parameter in <%s>. \
+               Pixels per block must be an even number < %d\n",str,SZ_MAX_PIXELS_PER_BLOCK);
+           goto out;
+       }
+#else 
+       printf("Input Error: Invalid compression method in <%s>. SZIP is not available\n",
+           str);
+       goto out;
+#endif
+       break;
+   };
+   
+   return obj_list;
+   
+out:
+   
+   if (obj_list) 
+       HDfree(obj_list);
+   
+   return NULL;
+   
+   
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_chunk
+ *
+ * Purpose: read chunk info
+ *
+ * Return: a list of names, the number of names and its chunking info
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 17, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+obj_list_t* parse_chunk(const char *str, 
+                        int *n_objs, 
+                        int32 *chunk_lengths, 
+                        int *chunk_rank)
+{
+    obj_list_t* obj_list=NULL;
+    unsigned    i;
+    char        c;
+    size_t      len=strlen(str);
+    int         j, n, k, end_obj=-1, c_index;
+    char        obj[H4_MAX_NC_NAME]; 
+    char        sdim[10];
+    
+    /* check for the end of object list and number of objects */
+    for ( i=0, n=0; i<len; i++)
+    {
+        c = str[i];
+        if ( c==':' )
+        {
+            end_obj=i;
+        }
+        if ( c==',' )
+        {
+            n++;
+        }
+    }
+    
+    if (end_obj==-1) { /* missing : */
+        printf("Input Error: Invalid chunking input in <%s>\n",str);
+        return NULL;
+    }
+    
+    
+   /*-------------------------------------------------------------------------
+    * allocate the object list of names
+    *-------------------------------------------------------------------------
+    */
+    
+    n++;
+    obj_list=HDmalloc(n*sizeof(obj_list_t));
+    *n_objs=n;
+    
+    /* get object list */
+    for ( j=0, k=0, n=0; j<end_obj; j++,k++)
+    {
+        c = str[j];
+        obj[k]=c;
+        if ( c==',' || j==end_obj-1) 
+        {
+            if ( c==',') obj[k]='\0'; else obj[k+1]='\0';
+            strcpy(obj_list[n].obj,obj);
+            memset(obj,0,sizeof(obj));
+            n++;
+            k=-1;
+        }
+    }
+    
+    /* nothing after : */
+    if (end_obj+1==(int)len)
+    {
+        printf("Input Error: Invalid chunking in <%s>\n",str);
+        goto out;
+    }
+    
+    /* get chunk info */
+    k=0; 
+    for ( i=end_obj+1, c_index=0; i<len; i++)
+    {
+        c = str[i];
+        sdim[k]=c;
+        k++; /*increment sdim index */
+        
+        if (!isdigit(c) && c!='x' && c!='N' && c!='O' && c!='N' && c!='E'){
+            printf("Input Error: Invalid chunking in <%s>\n",str);
+            goto out;
+        }
+        
+        if ( c=='x' || i==len-1) 
+        {
+            if ( c=='x') {  
+                sdim[k-1]='\0';  
+                k=0;
+                chunk_lengths[c_index]=atoi(sdim);
+                if (chunk_lengths[c_index]==0) {
+                    printf("Input Error: Invalid chunking in <%s>\n",str);
+                    goto out;
+                }
+                c_index++;
+            }
+            else if (i==len-1) { /*no more parameters */
+                sdim[k]='\0';  
+                k=0;
+                if (strcmp(sdim,"NONE")==0)
+                {
+                    *chunk_rank=-2;
+                }
+                else
+                {
+                    chunk_lengths[c_index]=atoi(sdim);
+                    if (chunk_lengths[c_index]==0){
+                        printf("Input Error: Invalid chunking in <%s>\n",str);
+                        goto out;
+                    }
+                    *chunk_rank=c_index+1;
+                }
+            } /*if */
+        } /*if c=='x' || i==len-1 */
+    } /*i*/
+    
+    return obj_list;
+    
+out:
+    
+    if (obj_list) 
+        HDfree(obj_list);
+    
+    return NULL;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: parse_number
+ *
+ * Purpose: read a number from command line argument
+ *
+ * Return: number, -1 for FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 31, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int parse_number(char *str)
+{
+    unsigned    i;
+    int         n;
+    char        c;
+    size_t      len=strlen(str);
+    
+    for ( i=0; i<len; i++)
+    {
+        c = str[i];
+        if (!isdigit(c)){
+            return -1;
+        }
+    }
+    str[i]='\0';     
+    n=atoi(str);
+    return n;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_scomp
+ *
+ * Purpose: return the compression type as a string
+ *
+ *-------------------------------------------------------------------------
+ */
+
+const char* get_scomp(comp_coder_t code)
+{
+    if (code==COMP_CODE_RLE)
+        return "RLE";
+    else if (code==COMP_CODE_NBIT)
+        return "COMP_CODE_NBIT";
+    else if (code==COMP_CODE_SKPHUFF)
+        return "HUFF";
+    else if (code==COMP_CODE_DEFLATE)
+        return "GZIP";
+    else if (code==COMP_CODE_JPEG)
+        return "JPEG";
+    else if (code==COMP_CODE_SZIP)
+        return "SZIP";
+    else if (code==COMP_CODE_NONE)
+        return "NONE";
+    else if (code==COMP_CODE_INVALID)
+        return "COMP_CODE_INVALID";
+    else {
+        printf("Input Error in compression type\n");
+        return NULL;
+    }
+    return NULL;
+} 
diff --git a/mfhdf/hrepack/hrepack_parse.h b/mfhdf/hrepack/hrepack_parse.h
new file mode 100644
index 0000000..a17f149
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_parse.h
@@ -0,0 +1,45 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_PARSE_H_
+#define REPACK_PARSE_H_
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hrepack.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int parse_number(char *str);
+
+
+/* compression */
+
+obj_list_t* parse_comp(const char *str, int *n_objs, comp_info_t *comp);
+const char* get_scomp(comp_coder_t code);
+
+/* chunking */
+
+obj_list_t* parse_chunk(const char *str, int *n_objs, int32 *chunk_lengths, int *chunk_rank);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_PARSE_H_ */
diff --git a/mfhdf/hrepack/hrepack_sds.c b/mfhdf/hrepack/hrepack_sds.c
new file mode 100644
index 0000000..4d95204
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_sds.c
@@ -0,0 +1,1063 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+
+#include <assert.h>
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hrepack.h"
+#include "hrepack_sds.h"
+#include "hrepack_an.h"
+#include "hrepack_utils.h"
+#include "hrepack_parse.h"
+#include "hrepack_opttable.h"
+#include "hrepack_dim.h"
+
+
+#define H4TOOLS_BUFSIZE        (1024 * 1024)
+#define H4TOOLS_MALLOCSIZE     (1024 * 1024)
+
+
+void print_info( int chunk_flags,
+                 HDF_CHUNK_DEF *chunk_def,      
+                 int comp_type,
+                 char *path,
+                 char *ratio);
+
+int get_print_info(  int chunk_flags,
+                     HDF_CHUNK_DEF *chunk_def,      
+                     int comp_type,
+                     char *path,
+                     char *sds_name,
+                     int32 sd_id);
+
+/*-------------------------------------------------------------------------
+ * Function: copy_sds
+ *
+ * Purpose: copy an SDS from input file to output file and compress it 
+ *  using options
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 10, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_sds(int32 sd_in,
+             int32 sd_out,
+             int32 tag,               /* tag of input SDS */
+             int32 ref,               /* ref of input SDS */
+             int32 vgroup_id_out_par, /* output parent group ID */
+             char*path_name,          /* absolute path for input group name */
+             options_t *options,
+             list_table_t *list_tbl,
+             dim_table_t *td1,
+             dim_table_t *td2,
+             int32 infile_id,
+             int32 outfile_id)
+{
+    int32 sds_id,              /* data set identifier */
+        sds_out=FAIL,          /* data set identifier */
+        sds_index,             /* index number of the data set */
+        dtype,                 /* SDS data type */
+        dimsizes[H4_MAX_VAR_DIMS],/* dimensions of SDS */
+        start[H4_MAX_VAR_DIMS],   /* read start */
+        edges[H4_MAX_VAR_DIMS],   /* read edges */
+        nattrs,                /* number of SDS attributes */
+        rank,                  /* rank of SDS */
+        sds_ref,               /* reference number of the output data set */
+        numtype,               /* number type */
+        eltsz,                 /* element size */
+        nelms,                 /* number of elements */
+        dim_id,                /* dimension ID */
+        dim_out;               /* dimension ID */
+    char             sds_name[H4_MAX_NC_NAME]; 
+    char             dim_name[H4_MAX_NC_NAME];
+    char             *path=NULL;
+    VOIDP            buf=NULL;
+    VOIDP            dim_buf=NULL;
+    int              i, j;
+    int              info;           /* temporary int compression information */
+    comp_coder_t     comp_type;      /* compression type requested  */
+    comp_coder_t     comp_type_in;   /* compression type original  */
+    comp_info        c_info;         /* compression information requested  */
+    comp_info        c_info_in;      /* compression information original  */
+    HDF_CHUNK_DEF    chunk_def;      /* chunk definition */
+    HDF_CHUNK_DEF    chunk_def_in;   /* chunk definition original */
+    int32            chunk_flags;    /* chunk flags */ 
+    int32            chunk_flags_in; /* chunk flags original*/ 
+    int              szip_mode;      /* szip mode, EC, NN */
+    intn             empty_sds;
+    int              have_info=0;
+    size_t           need;	         /* read size needed */
+    void             *sm_buf=NULL;
+    int              is_record = 0;
+    
+    sds_index = SDreftoindex(sd_in,ref);
+    sds_id    = SDselect(sd_in,sds_index);
+    
+    /*obtain name,rank,dimsizes,datatype and num of attributes of sds */
+    if (SDgetinfo(sds_id,sds_name,&rank,dimsizes,&dtype,&nattrs)==FAIL){
+        printf( "Could not get information for SDS\n");
+        SDendaccess(sds_id);
+        return FAIL;
+    }
+    
+    /* check if the given SDS is a dimension scale, return 0 for no table add */
+    if ( SDiscoordvar(sds_id) ) {
+        /* add SDS coordinate variable to dimension table 1 */
+        dim_table_add(td1,ref,sds_name);
+        SDendaccess(sds_id);
+        return SUCCEED;
+    }
+    
+    /* initialize path */
+    path=get_path(path_name,sds_name);
+    
+    /* add object to table */
+    list_table_add(list_tbl,tag,ref,path);
+    
+   /*-------------------------------------------------------------------------
+    * check if the input SDS is empty. if so , avoid some operations (mainly read, write)
+    *-------------------------------------------------------------------------
+    */ 
+    if (SDcheckempty( sds_id, &empty_sds ) == FAIL) {
+        printf( "Failed to check empty SDS <%s>\n", path);
+        goto out;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * element size and number of elements
+    *-------------------------------------------------------------------------
+    */
+    
+    /* compute the number of the bytes for each value */
+    numtype = dtype & DFNT_MASK;
+    eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+    
+    /* get number of elements */
+    nelms=1;
+    for (j = 0; j < rank; j++) {
+        nelms   *= dimsizes[j];
+    }
+    
+   /*-------------------------------------------------------------------------
+    * get the original compression/chunk information from the object 
+    *-------------------------------------------------------------------------
+    */
+    
+    /* reset variables before retrieving information */
+    comp_type = comp_type_in = COMP_CODE_NONE; 
+    chunk_flags = chunk_flags_in = HDF_NONE;
+    
+    if (empty_sds==0 )
+    {
+        HDmemset(&c_info_in, 0, sizeof(comp_info)) ;
+        if ( SDgetcompinfo(sds_id, &comp_type_in, &c_info_in) == FAIL )
+        {
+            printf( "Could not get compression information for SDS <%s>\n",path);
+            goto out;
+        }
+        
+        /* get chunk lengths */
+        if ( SDgetchunkinfo(sds_id, &chunk_def_in, &chunk_flags_in)== FAIL )
+        {
+            printf( "Could not get chunking information for SDS <%s>\n",path);
+            goto out;
+        }
+      
+        
+        /* retrieve the compress information if so */
+        if ( (HDF_CHUNK | HDF_COMP) == chunk_flags_in )
+        {
+            chunk_def_in.comp.comp_type=comp_type_in;
+            switch (comp_type_in)
+            {
+            case COMP_CODE_RLE:
+                chunk_def_in.comp.comp_type              = COMP_CODE_RLE;
+                break;
+            case COMP_CODE_SKPHUFF:
+                chunk_def_in.comp.comp_type              = COMP_CODE_SKPHUFF;
+                chunk_def_in.comp.cinfo.skphuff          = c_info_in.skphuff;
+                break;
+            case COMP_CODE_DEFLATE:
+                chunk_def_in.comp.comp_type              = COMP_CODE_DEFLATE;
+                chunk_def_in.comp.cinfo.deflate          = c_info_in.deflate;
+                break;
+            case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+                chunk_def_in.comp.comp_type              = COMP_CODE_SZIP;
+                chunk_def_in.comp.cinfo.szip             = c_info_in.szip;
+#else
+                printf("Error: SZIP compression is not available <%s>\n",path);
+                goto out;
+#endif
+                break;
+            default:
+                printf("Error: Unrecognized compression code in %d <%s>\n",comp_type_in,path);
+                goto out;
+            };
+        }
+        
+       /*-------------------------------------------------------------------------
+        * set the default values to the ones read from the object
+        *-------------------------------------------------------------------------
+        */
+        
+       /*-------------------------------------------------------------------------
+        * compression
+        *-------------------------------------------------------------------------
+        */
+        
+        comp_type   = comp_type_in;
+        
+        switch (comp_type_in)
+        {
+        case COMP_CODE_NBIT:
+            printf("Nbit compression not supported in this version <%s>\n",path);
+            break;
+        case COMP_CODE_NONE:
+            break;
+        case COMP_CODE_RLE:
+            break;
+        case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+            info      = c_info_in.szip.pixels_per_block;
+            if (c_info_in.szip.options_mask & SZ_EC_OPTION_MASK) {
+                szip_mode = EC_MODE;
+            } else if (c_info_in.szip.options_mask & SZ_NN_OPTION_MASK) {
+                szip_mode = NN_MODE;
+            }
+#else
+            printf("SZIP compression not supported in this version <%s>\n",path);
+#endif
+            break;
+        case COMP_CODE_SKPHUFF:
+            info  = c_info_in.skphuff.skp_size;
+            break;
+        case COMP_CODE_DEFLATE:
+            info  = c_info_in.deflate.level;
+            break;
+        default:
+            printf("Error: Unrecognized compression code in %d <%s>\n",comp_type,path);
+            goto out;
+            break;
+        };
+        
+       /*-------------------------------------------------------------------------
+        * chunking
+        *-------------------------------------------------------------------------
+        */
+        
+        chunk_flags = chunk_flags_in;
+        
+        if ( (HDF_CHUNK) == chunk_flags )
+        {
+            for (i = 0; i < rank; i++) 
+                chunk_def.chunk_lengths[i]      = chunk_def_in.chunk_lengths[i];
+        }
+        else if ( (HDF_CHUNK | HDF_COMP) == chunk_flags )
+        {
+            for (i = 0; i < rank; i++) {
+                chunk_def.chunk_lengths[i]      = chunk_def_in.chunk_lengths[i];
+                chunk_def.comp.chunk_lengths[i] = chunk_def_in.chunk_lengths[i];
+            }
+            chunk_def.comp.comp_type=comp_type_in;
+            switch (comp_type_in)
+            {
+            case COMP_CODE_RLE:
+                chunk_def.comp.comp_type              = COMP_CODE_RLE;
+                break;
+            case COMP_CODE_SKPHUFF:
+                chunk_def.comp.comp_type              = COMP_CODE_SKPHUFF;
+                chunk_def.comp.cinfo.skphuff          = c_info_in.skphuff;
+                break;
+            case COMP_CODE_DEFLATE:
+                chunk_def.comp.comp_type              = COMP_CODE_DEFLATE;
+                chunk_def.comp.cinfo.deflate          = c_info_in.deflate;
+                break;
+            case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+                chunk_def.comp.comp_type              = COMP_CODE_SZIP;
+                chunk_def.comp.cinfo.szip             = c_info_in.szip;
+#else
+                printf("Error: SZIP compression not available in %d <%s>\n",comp_type_in,path);
+#endif
+                break;
+            default:
+                printf("Error: Unrecognized compression code in %d <%s>\n",comp_type_in,path);
+                goto out;
+            };
+        }
+        
+        
+       /*-------------------------------------------------------------------------
+        * get the compression/chunk information of this object from the table
+        * translate to usable information
+        * this is done ONLY for the second trip inspection 
+        *-------------------------------------------------------------------------
+        */
+        
+        /* check inspection mode */
+        if ( options->trip>0 ) 
+        {
+            have_info = 
+                options_get_info(options,      /* global options */
+                &chunk_flags, /* chunk flags OUT */
+                &chunk_def,   /* chunk definition OUT */
+                &info,        /* compression information OUT */
+                &szip_mode,   /* compression information OUT */
+                &comp_type,   /* compression type OUT  */
+                rank,         /* rank of object IN */
+                path,         /* path of object IN */
+                1,            /* number of GR image planes (for SZIP), IN */
+                dimsizes,     /* dimensions (for SZIP), IN */
+                dtype         /* numeric type ( for SZIP), IN */
+                );
+            if (have_info==FAIL)
+                goto out;
+        } /* check inspection mode */
+        
+        
+       /*-------------------------------------------------------------------------
+        * check for maximum number of chunks treshold
+        *-------------------------------------------------------------------------
+        */
+        if ( options->trip>0 ) 
+        {
+            int count=1, nchunks;
+            int maxchunk=INT_MAX;
+            if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+            {
+                for (j = 0; j < rank; j++) {
+                    count   *= chunk_def.chunk_lengths[j];
+                }
+                nchunks=nelms/count;
+                if (nchunks>maxchunk){
+                    printf("Warning: number of chunks is %d (greater than %d). Not chunking <%s>\n",
+                        nchunks,maxchunk,path);
+                    chunk_flags=HDF_NONE;
+                }
+            }
+        }
+        
+        
+       /*-------------------------------------------------------------------------
+        * check for objects too small
+        *-------------------------------------------------------------------------
+        */
+        if ( have_info==1 && options->trip>0  && nelms*eltsz<options->threshold )
+        {
+            /* reset to the original values . we don't want to uncompress if it was */
+            chunk_flags=chunk_flags_in;
+            comp_type=comp_type_in;
+            if (options->verbose) {
+                printf("Warning: object size smaller than %d bytes. Not compressing <%s>\n",
+                    options->threshold,path);
+            }
+        }
+        
+        
+ } /* empty_sds */
+ 
+    
+  /*-------------------------------------------------------------------------
+   * check if the requested compression is valid
+   * SDSs do not support JPEG
+   *-------------------------------------------------------------------------
+   */
+   
+   /* check inspection mode */
+   if ( options->trip>0 && empty_sds==0) 
+   {
+       switch(comp_type)
+       {
+       case COMP_CODE_NONE:
+       case COMP_CODE_RLE:
+       case COMP_CODE_SKPHUFF:
+       case COMP_CODE_DEFLATE:
+       case COMP_CODE_SZIP:
+       case COMP_CODE_NBIT:
+           break;
+       case COMP_CODE_JPEG:
+           printf("Error: JPEG compression is not available for <%s>\n",path);
+           goto out;
+           break;
+       default:
+           printf("Error: Unrecognized compression code %d in <%s>\n",comp_type_in,path);
+           goto out;
+       }
+   } /* check inspection mode */
+   
+  /*-------------------------------------------------------------------------
+   * if we are in first trip inspection mode, exit, after printing the information
+   *-------------------------------------------------------------------------
+   */ 
+   
+   /* check inspection mode */
+   if ( options->trip==0 ) 
+   {
+       /* close sds before get info */
+       SDendaccess(sds_id);
+       
+       if ( options->verbose)
+       {
+           
+           if (get_print_info(chunk_flags_in,
+               &chunk_def,      
+               comp_type,
+               path,
+               sds_name,
+               sd_in)==FAIL)
+               goto out;
+       }          
+
+
+
+
+       if (path) free(path);
+       return SUCCEED;
+   }
+   
+  /*-------------------------------------------------------------------------
+   * create new SDS
+   * check for unlimited dimension
+   * SDisrecord determines whether the data set identified by the parameter sds_id 
+   * is appendable, which means that the slowest-changing dimension of the SDS array 
+   * is declared unlimited when the data set is created.
+   *-------------------------------------------------------------------------
+   */
+   /* do not use unlimited if compression is needed since combination of unlimited 
+      and compression is not allowed. */
+   if (SDisrecord(sds_id) && comp_type<=COMP_CODE_NONE) 
+   {
+       int32 dimsizes_cre[H4_MAX_VAR_DIMS];
+
+       is_record = 1;
+
+       for (j = 0; j < rank; j++) 
+       {
+           dimsizes_cre[j] = dimsizes[j];
+       }
+       dimsizes_cre[0] = SD_UNLIMITED;
+
+       if ((sds_out = SDcreate(sd_out,sds_name,dtype,rank,dimsizes_cre)) == FAIL) 
+       {
+           printf( "Failed to create new SDS <%s>\n", path);
+           goto out;
+       }
+       
+   }
+   else
+   {
+       
+       if ((sds_out = SDcreate(sd_out,sds_name,dtype,rank,dimsizes)) == FAIL) 
+       {
+           printf( "Failed to create new SDS <%s>\n", path);
+           goto out;
+       }
+   }
+   
+   
+  /*-------------------------------------------------------------------------
+   * set chunk 
+   *
+   * Chunked                  -> flags = HDF_CHUNK
+   * Chunked and compressed   -> flags = HDF_CHUNK | HDF_COMP 
+   * Non-chunked              -> flags = HDF_NONE
+   *-------------------------------------------------------------------------
+   */
+   
+   if (empty_sds==0 )
+   {
+       
+       /* set chunk */
+       if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+       {
+
+           /* unlimited dimensions don't work with chunking */
+           if ( ! is_record )
+           {
+               
+               
+               if (SDsetchunk (sds_out, chunk_def, chunk_flags)==FAIL)
+               {
+                   printf( "Error: Failed to set chunk dimensions for <%s>\n", path);
+                   goto out;
+               }
+               
+           }
+          
+           
+       }
+       
+       /*-------------------------------------------------------------------------
+       * set compression
+       *
+       * COMP_CODE_RLE       -> simple RLE encoding
+       * COMP_CODE_SKPHUFF   -> Skipping huffman encoding
+       * COMP_CODE_DEFLATE   -> gzip 'deflate' encoding
+       *-------------------------------------------------------------------------
+       */
+       
+       /* use compress without chunk-in */
+       else if ( chunk_flags==HDF_NONE && comp_type>COMP_CODE_NONE)  
+       {
+           if ( nelms*eltsz<options->threshold )
+           {
+               /* reset to the original values . we don't want to uncompress if it was */
+               comp_type=COMP_CODE_NONE;
+               if (options->verbose) 
+               {
+                   printf("Warning: object size smaller than %d bytes. Not compressing <%s>\n",
+                       options->threshold,path);
+               } 
+           } 
+           else  
+           {
+               /* setup compression factors */
+               switch(comp_type) 
+               {
+               case COMP_CODE_SZIP:
+                   if (set_szip (info,szip_mode,&c_info)==FAIL)
+                   {
+                       comp_type=COMP_CODE_NONE;
+                   }
+                   break;
+               case COMP_CODE_RLE:         
+                   break;
+               case COMP_CODE_SKPHUFF:     
+                   c_info.skphuff.skp_size = info;
+                   break;
+               case COMP_CODE_DEFLATE:
+                   c_info.deflate.level = info;
+                   break;
+               case COMP_CODE_NBIT:
+                   comp_type = COMP_CODE_NONE;  /* not supported in this version */
+                   break;
+               default:
+                   printf( "Error: Unrecognized compression code %d\n", comp_type);
+                   goto out;
+               }
+
+                /*
+                  HDF4 2.6 does not allow the combination of unlimited dimensions
+                  and compression. See bug HDFFR-1280
+                  The fix: for the case of the combination of unlimited dimensions
+                  and compression, compressed will be applied but dimension is changed
+                  to limited size in hrepack.
+                */
+               if (SDsetcompress (sds_out, comp_type, &c_info)==FAIL)
+               {
+                   printf( "Error: Failed to set compression for <%s>\n", path);
+                   goto out;
+               }
+           }
+       }
+       
+       
+       need = (size_t)(nelms * eltsz); /* bytes needed */
+       
+       if ( need < H4TOOLS_MALLOCSIZE 
+            ||
+            /* for compressed datasets do one operation I/O, but allow hyperslab for chunked */
+            (chunk_flags==HDF_NONE && comp_type>COMP_CODE_NONE))
+       {
+           buf = (VOIDP)HDmalloc(need);
+       }
+       
+      /*-------------------------------------------------------------------------
+       * read all
+       *-------------------------------------------------------------------------
+       */ 
+       
+       if ( buf!=NULL )
+       {
+           
+           /* set edges of SDS, select all */
+           for (i = 0; i < rank; i++) 
+           {
+               edges[i] = dimsizes[i];
+               start[i] = 0;
+           }
+               
+           
+           /* read  */
+           if (SDreaddata (sds_id, start, NULL, edges, buf) == FAIL) 
+           {
+               printf( "Could not read SDS <%s>\n", path);
+               goto out;
+           }
+           
+           /* write */
+           if (SDwritedata(sds_out, start, NULL, edges, buf) == FAIL) 
+           {
+               printf( "Failed to write to new SDS <%s>\n", path);
+               goto out;
+           }
+
+
+ 
+       }
+       
+       else /* possibly not enough memory, read/write by hyperslabs */
+           
+       {
+           size_t        p_type_nbytes = eltsz;   /*size of type */
+           uint32        p_nelmts = nelms;        /*total selected elmts */
+           uint32        elmtno;                  /*counter  */
+           int           carry;                   /*counter carry value */
+           
+           /* stripmine info */
+           int32         sm_size[H4_MAX_VAR_DIMS];   /*stripmine size */
+           int32         sm_nbytes;               /*bytes per stripmine */
+           int32         sm_nelmts;               /*elements per stripmine*/
+           
+           /* hyperslab info */
+           int32         hs_offset[H4_MAX_VAR_DIMS]; /*starting offset */
+           int32         hs_size[H4_MAX_VAR_DIMS];   /*size this pass */
+           int32         hs_nelmts;               /*elements in request */
+           
+           /*
+            * determine the strip mine size and allocate a buffer. The strip mine is
+            * a hyperslab whose size is manageable.
+            */
+           sm_nbytes = p_type_nbytes;
+           
+           for (i = rank; i > 0; --i) 
+           {
+               sm_size[i - 1] = MIN(dimsizes[i - 1], H4TOOLS_BUFSIZE / sm_nbytes);
+               sm_nbytes *= sm_size[i - 1];
+               assert(sm_nbytes > 0);
+           }
+           
+           sm_buf = HDmalloc((size_t)sm_nbytes);
+                      
+           sm_nelmts = sm_nbytes / p_type_nbytes;
+           
+           /* the stripmine loop */
+           memset(hs_offset, 0, sizeof hs_offset);
+           
+           for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) 
+           {
+               /* calculate the hyperslab size */
+               if (rank > 0) 
+               {
+                   for (i = 0, hs_nelmts = 1; i < rank; i++) 
+                   {
+                       hs_size[i] = MIN(dimsizes[i] - hs_offset[i], sm_size[i]);
+                       hs_nelmts *= hs_size[i];
+                   }
+                   
+               } 
+               else 
+               {
+                   hs_nelmts = 1;
+               } /* rank */
+
+              
+               
+               /* read */
+               if (SDreaddata (sds_id, hs_offset, NULL, hs_size, sm_buf) == FAIL) 
+               {
+                   printf( "Could not read SDS <%s>\n", sds_name);
+                   goto out;
+               }
+              
+               
+               /* write */
+               if (SDwritedata(sds_out, hs_offset, NULL, hs_size, sm_buf) == FAIL) 
+               {
+                   printf( "Failed to write to new SDS <%s>\n", path);
+                   goto out;
+               }
+
+
+               
+               /* calculate the next hyperslab offset */
+               for (i = rank, carry = 1; i > 0 && carry; --i) 
+               {
+                   hs_offset[i - 1] += hs_size[i - 1];
+                   if (hs_offset[i - 1] == dimsizes[i - 1])
+                       hs_offset[i - 1] = 0;
+                   else
+                       carry = 0;
+               } /* i */
+           } /* elmtno */
+           
+           /* free */
+           if (sm_buf!=NULL)
+           {
+               free(sm_buf);
+               sm_buf=NULL;
+           }
+           
+           
+       } /* hyperslab read */
+ 
+  
+   } /* empty_sds */
+
+
+   
+  /*-------------------------------------------------------------------------
+   * copy attributes
+   *-------------------------------------------------------------------------
+   */ 
+   
+   if( copy_sds_attrs(sds_id,sds_out,nattrs,options)==FAIL) {
+       goto out;
+   }
+   
+  /*-------------------------------------------------------------------------
+   * copy dimension scales
+   *-------------------------------------------------------------------------
+   */ 
+   
+   /* loop through each dimension up to rank of SDS */
+   for (i = 0; i < rank; i++) 
+   {
+       int32 dim_size;
+       
+       /* get dimension handle for input dimension */
+       if ((dim_id = SDgetdimid(sds_id, i)) == FAIL) {
+           printf( "Failed to get dimension %d of SDS <%s>\n", i, path);
+           goto out;
+       }
+       /* get dimension handle for output dimension */
+       if ((dim_out = SDgetdimid(sds_out, i)) == FAIL) {
+           printf( "Failed to get dim_id for dimension %d of SDS <%s>\n", i, path);
+           goto out;
+       }
+       /* get dimension information for input dimension */
+       if (SDdiminfo(dim_id, dim_name, &dim_size, &dtype, &nattrs) == FAIL) {
+           printf( "Failed to get information for dimension %d of SDS <%s>\n", i, path);
+           goto out;
+       }
+       
+       /* add dimension name to dimension scales table */
+       dim_table_add(td2,-1,dim_name);
+       
+       /* set output dimension name */
+       if (SDsetdimname(dim_out, dim_name) == FAIL) {
+           printf( "Failed to set dimension name %d of SDS <%s>\n", i, path);
+           goto out;
+       }
+       /* copy attributes */
+       if (nattrs && copy_sds_attrs(dim_id, dim_out, nattrs, options) == FAIL) {
+           printf( "Failed to copy attributes for dimension %d of of SDS <%s>\n", i, path);
+           goto out;
+       }
+       /* copy scale information over */
+       if (dtype != 0) 
+       {
+           intn okdim;
+           
+           /* compute the number of the bytes for each value. */
+           numtype = dtype & DFNT_MASK;
+           eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+           
+           if ((dim_buf = (VOIDP) HDmalloc(dimsizes[i] * eltsz)) == NULL) {
+               printf( "Failed to alloc %ld for dimension scale\n", dimsizes[i]);
+               goto out;
+           }
+           if ((okdim=SDgetdimscale(dim_id, dim_buf)) == FAIL) {
+               printf( "Warning: Failed to get scale information for %s\n", dim_name);
+           }
+           if (okdim!=FAIL)
+           {
+               /* use dimsizes returned by SDgetinfo */
+               if (SDsetdimscale(dim_out,dimsizes[i], dtype, dim_buf) == FAIL) {
+                   printf( "Failed to set scale information for %s\n", dim_name);
+                   goto out;
+               }
+           }
+           free(dim_buf);
+       }
+   }
+   
+   /* obtain the reference number of the new SDS using its identifier */
+   if ((sds_ref = SDidtoref (sds_out)) == FAIL) {
+       printf( "Failed to get new SDS reference in <%s>\n", path);
+       goto out;
+   }
+   
+  /*-------------------------------------------------------------------------
+   * add SDS to group
+   *-------------------------------------------------------------------------
+   */ 
+   
+   /* add it to group, if present */
+   if (vgroup_id_out_par) 
+   {
+       /* add the SDS to the vgroup. the tag DFTAG_NDG is used */
+       if (Vaddtagref (vgroup_id_out_par, TAG_GRP_DSET, sds_ref)==FAIL) {
+           printf( "Failed to add new SDS to group <%s>\n", path);
+           goto out;
+       }
+   }
+   
+  /*-------------------------------------------------------------------------
+   * copy ANs
+   *-------------------------------------------------------------------------
+   */ 
+   
+   if (copy_an(infile_id,outfile_id,
+       ref,tag,sds_ref,tag, 
+       path,options)<0) {
+       goto out;
+   }
+   
+
+  /*-------------------------------------------------------------------------
+   * close
+   *-------------------------------------------------------------------------
+   */ 
+   
+   
+   if (SDendaccess(sds_id)== FAIL )
+       printf( "Failed to close SDS <%s>\n", path);
+   if (sds_out!=FAIL) {
+       if (SDendaccess (sds_out)== FAIL )
+           printf( "Failed to close SDS <%s>\n", path);
+   }
+  
+   /*-------------------------------------------------------------------------
+   * print compression
+   *-------------------------------------------------------------------------
+   */ 
+
+   assert( options->trip==1 );
+   if ( options->verbose )              
+   {
+       
+       if (get_print_info(chunk_flags_in,
+           &chunk_def,      
+           comp_type,
+           path,
+           sds_name,
+           sd_out)==FAIL)
+           goto out;
+   }          
+   
+
+
+   if (path)
+       free(path);
+   if (buf)
+       free(buf);
+
+   
+   return SUCCEED;
+   
+   
+out:
+   if (SDendaccess(sds_id)== FAIL )
+       printf( "Failed to close SDS <%s>\n", path);
+   if (sds_out!=FAIL) {
+       if (SDendaccess (sds_out)== FAIL )
+           printf( "Failed to close SDS <%s>\n", path);
+   }
+   if (path)
+       free(path);
+   if (buf)
+       free(buf);
+   
+   return FAIL;
+   
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_sds_attrs
+ *
+ * Purpose: copy SD attributes from input file to output file 
+ *   used for global, dataset and dimension attributes
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 30, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_sds_attrs(int32 id_in,
+                   int32 id_out,
+                   int32 nattrs,          
+                   options_t *options)
+{
+    int32 dtype,               /* SDS data type */
+        numtype,               /* number type */
+        eltsz,                 /* element size */
+        nelms;                 /* number of elements */
+    char  attr_name[H4_MAX_NC_NAME];
+    VOIDP attr_buf=NULL;
+    int   i;
+    
+    /* loop through attributes in input SDS */
+    for (i = 0; i < nattrs; i++) 
+    {
+        if (SDattrinfo (id_in, i, attr_name, &dtype, &nelms) == FAIL) {
+            printf( "Cannot get information for attribute number %d\n", i);
+            goto out;
+        }
+        /* compute the number of the bytes for each value. */
+        numtype = dtype & DFNT_MASK;
+        eltsz   = DFKNTsize(numtype | DFNT_NATIVE);
+        if ((attr_buf = (VOIDP) HDmalloc(nelms * eltsz)) == NULL) {
+            printf( "Error allocating %ld values of size %ld for attribute %s",
+                nelms, numtype, attr_name);
+            goto out;
+        }
+        /* read attributes from input SDS */
+        if (SDreadattr(id_in, i, attr_buf) == FAIL) {
+            printf( "Cannot read attribute %s\n", attr_name);
+            goto out;
+        }
+        /* put attributes into output SDS */
+        if (SDsetattr(id_out, attr_name, dtype, nelms, attr_buf) == FAIL) {
+            printf( "Cannot write attribute %s\n", attr_name);
+            goto out;
+        }
+        
+        if (attr_buf)
+            free(attr_buf);
+    }
+    
+    return SUCCEED;
+
+
+out:
+
+    if (attr_buf)
+            free(attr_buf);
+
+    return FAIL;
+
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * get_print_info
+ *-------------------------------------------------------------------------
+ */
+
+int get_print_info(  int chunk_flags,
+                     HDF_CHUNK_DEF *chunk_def,      /* chunk definition */
+                     int comp_type,
+                     char *path,
+                     char *sds_name,
+                     int32 sd_id)
+                    
+{
+    
+    int32  comp_size;
+    int32  uncomp_size;
+    int32  sds_idx;
+    int32  sds_id;
+    double a, b, r=0;
+    char   comp_str[255];
+    int    is_record = 0;
+    
+    if ((sds_idx = SDnametoindex (sd_id, sds_name))==FAIL) 
+        goto out;
+    if ((sds_id = SDselect (sd_id, sds_idx))==FAIL) 
+        goto out;
+    if (SDisrecord(sds_id))
+        is_record = 1;
+    if (SDgetdatasize(sds_id, &comp_size, &uncomp_size) == FAIL) 
+    {
+        printf( "Could not get data sizes for <%s>\n", sds_name);
+        goto out;
+    }   
+    if (SDendaccess (sds_id)== FAIL )
+        goto out;
+    
+    sprintf(comp_str,"\0");
+
+    /* unlimited dimensions don't work with compression */
+    if ( is_record )
+    {
+        comp_type = COMP_CODE_NONE;
+        chunk_flags = HDF_NONE;
+    }
+    
+    if ( comp_type > COMP_CODE_NONE )
+        
+    {
+        
+        /* compression ratio = uncompressed size /  compressed size */
+        a = uncomp_size; 
+        b = comp_size;
+        if ( b != 0 )
+            r = a / b;
+       
+        sprintf(comp_str,"(%.2f:1)", r);
+        
+    }
+    
+    
+    print_info(chunk_flags,
+        chunk_def,      
+        comp_type,           
+        path,
+        comp_str);  
+
+    return SUCCEED;
+    
+out:
+    return FAIL;
+    
+} 
+
+/*-------------------------------------------------------------------------
+ * print_info
+ *-------------------------------------------------------------------------
+ */
+
+void print_info( int chunk_flags,
+                 HDF_CHUNK_DEF *chunk_def,      /* chunk definition */
+                 int comp_type,
+                 char *path,
+                 char *ratio)
+{
+    int pr_comp_type=0;
+    int pr_chunk_flags;
+    
+    pr_chunk_flags=chunk_flags;
+    
+    if (comp_type>0)
+    {
+        pr_comp_type=comp_type;
+    }
+    else
+    {
+        if (pr_chunk_flags == (HDF_CHUNK | HDF_COMP) )
+        {
+            pr_comp_type=chunk_def->comp.comp_type;
+        }
+    }
+    printf(PFORMAT,
+        (pr_chunk_flags>0)?"chunk":"",                 /*chunk information*/
+        (pr_comp_type>0)?get_scomp(pr_comp_type):"",   /*compression information*/
+        ratio,                                         /*ratio */
+        path);                                         /*name*/
+}
+
diff --git a/mfhdf/hrepack/hrepack_sds.h b/mfhdf/hrepack/hrepack_sds.h
new file mode 100644
index 0000000..179af78
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_sds.h
@@ -0,0 +1,56 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_SDS_H_
+#define REPACK_SDS_H_
+
+#include "hrepack.h"
+#include "hrepack_lsttable.h"
+#include "hrepack_dim.h"
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int  copy_sds(int32 sd_in,
+              int32 sd_out,
+              int32 tag,
+              int32 ref,
+              int32 vgroup_id_out_par,
+              char*group_name,
+              options_t *options,
+              list_table_t *list_tbl,
+              dim_table_t *td1,
+              dim_table_t *td2,
+              int32 infile_id,
+              int32 outfile_id);
+
+
+
+int copy_sds_attrs(int32 sds_id,
+                   int32 sds_out,
+                   int32 nattrs,          
+                   options_t *options);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_SDS_H_ */
diff --git a/mfhdf/hrepack/hrepack_utils.c b/mfhdf/hrepack/hrepack_utils.c
new file mode 100644
index 0000000..5312942
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_utils.c
@@ -0,0 +1,550 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hrepack_utils.h"
+#include "hrepack_opttable.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: is_reserved
+ *
+ * Purpose: check for reserved Vgroup/Vdata class/names
+ *
+ * Return: 1 if reserved, 0 if not
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 22, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int is_reserved(char*vgroup_class)
+{
+    int ret=0;
+    
+    /* ignore reserved HDF groups/vdatas */
+    if(vgroup_class != NULL) {
+        if( (strcmp(vgroup_class,_HDF_ATTRIBUTE)==0) ||
+            (strcmp(vgroup_class,_HDF_VARIABLE) ==0) || 
+            (strcmp(vgroup_class,_HDF_DIMENSION)==0) ||
+            (strcmp(vgroup_class,_HDF_UDIMENSION)==0) ||
+            (strcmp(vgroup_class,DIM_VALS)==0) ||
+            (strcmp(vgroup_class,DIM_VALS01)==0) ||
+            (strcmp(vgroup_class,_HDF_CDF)==0) ||
+            (strcmp(vgroup_class,GR_NAME)==0) ||
+            (strcmp(vgroup_class,RI_NAME)==0) || 
+            (strcmp(vgroup_class,RIGATTRNAME)==0) ||
+            (strcmp(vgroup_class,RIGATTRCLASS)==0) ){
+            ret=1;
+        }
+        
+        /* class and name(partial) for chunk table i.e. Vdata */
+        if( (strncmp(vgroup_class,"_HDF_CHK_TBL_",13)==0)){
+            ret=1;
+        }
+        
+    }
+    
+    return ret;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: get_path
+ *
+ * Purpose: return absolute path for an object
+ *
+ * Return: path
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 11, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+char *get_path(char*path_name, char*obj_name) 
+{
+    char *path=NULL;
+    /* initialize path */
+    if (path_name!=NULL) 
+    {
+        path = (char*) malloc(strlen(path_name) + strlen(obj_name) + 2);
+        strcpy( path, path_name );
+        strcat( path, "/" );
+        strcat( path, obj_name ); 
+    }
+    else
+    {
+        path = (char*) malloc(strlen(obj_name) + 1);
+        strcpy( path, obj_name ); 
+    }
+    return path;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: options_get_info
+ *
+ * Purpose: get COMP and CHUNK information from options
+ *
+ * Return: 0 if no information for this PATH, 1 otherwise
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 28, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int  options_get_info(options_t      *options,     /* global options */
+                      int32          *chunk_flags, /* chunk flags OUT */
+                      HDF_CHUNK_DEF  *chunk_def,   /* chunk definition OUT */
+                      int            *info,        /* compression information OUT */
+                      int            *szip_mode,   /* compression information OUT */
+                      comp_coder_t   *comp_type,   /* compression type OUT  */
+                      int            rank,         /* rank of object IN */
+                      char           *path,        /* path of object IN */
+                      int            ncomps,       /* number of GR image planes (for SZIP), IN */
+                      int32          *dimsizes,    /* dimensions (for SZIP), IN */
+                      int32          dtype         /* numeric type (for SZIP), IN */
+                      )
+{
+    
+    pack_info_t *obj=NULL; /* check if we have information for this object */
+    int         i;
+    comp_info   c_info; /* for SZIP default values */
+    
+                        /*-------------------------------------------------------------------------
+                        * CASE 1: chunk==ALL comp==SELECTED 
+                        *-------------------------------------------------------------------------
+    */
+    
+    if (options->all_chunk==1 && options->all_comp==0)
+    {
+        /* NONE option */
+        if (options->chunk_g.rank==-2)
+        {
+            chunk_flags = HDF_NONE;
+        }
+        
+        /*check if the input rank is correct (warn this one cannot be chunked) */
+        else if (options->chunk_g.rank!=rank)
+        {
+            if ( options->verbose ) 
+                printf("Warning: chunk rank does not apply to <%s>\n",path);
+        }
+        else
+        {
+            *chunk_flags = HDF_CHUNK;
+            for (i = 0; i < rank; i++) 
+                chunk_def->chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
+        }
+        
+        obj = options_get_object(path,options->op_tbl);
+        
+        if (obj!=NULL )
+        {
+            
+            /* 0 is the NONE option */
+            *comp_type   = obj->comp.type;
+            *info        = obj->comp.info;
+            *szip_mode   = obj->comp.szip_mode;
+            
+            /* chunk and compress */
+            if (*chunk_flags == HDF_CHUNK && *comp_type>0 )
+            {
+                /* assign the object CHUNK information   */
+                *chunk_flags              = HDF_CHUNK | HDF_COMP;
+                chunk_def->comp.comp_type = obj->comp.type;
+                switch (obj->comp.type)
+                {
+                case COMP_CODE_NONE:
+                    break;
+                    
+                case COMP_CODE_SZIP:
+                    if (set_szip (obj->comp.info,obj->comp.szip_mode,&c_info)==FAIL)
+                    {
+                        return FAIL;
+                    }
+                    chunk_def->comp.cinfo = c_info;
+                    
+                    break;
+                case COMP_CODE_RLE:
+                    break;
+                case COMP_CODE_SKPHUFF:
+                    chunk_def->comp.cinfo.skphuff.skp_size = obj->comp.info;
+                    break;
+                case COMP_CODE_DEFLATE:
+                    chunk_def->comp.cinfo.deflate.level    = obj->comp.info;
+                    break;
+                case COMP_CODE_JPEG:
+                    chunk_def->comp.cinfo.jpeg.quality        = obj->comp.info;
+                    chunk_def->comp.cinfo.jpeg.force_baseline = 1;
+                    break;
+                default:
+                    printf("Error: Unrecognized compression code in %d <%s>\n",obj->comp.type,path);
+                    break;
+                }; /*switch */
+                for (i = 0; i < rank; i++) 
+                {
+                    /* To use chunking with RLE, Skipping Huffman, and GZIP compression */
+                    chunk_def->comp.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
+                }
+            } /* chunk_flags */
+        } /* obj */
+    }
+    
+    /*-------------------------------------------------------------------------
+    * CASE 2: chunk==SELECTED comp==SELECTED 
+    *-------------------------------------------------------------------------
+    */
+    else if (options->all_chunk==0 && options->all_comp==0)
+    {
+        obj = options_get_object(path,options->op_tbl);
+        
+        if (obj!=NULL)
+        {
+            /* NONE option */
+            if (obj->chunk.rank==-2)
+            {
+                *chunk_flags = HDF_NONE;
+            }
+            /* check if we have CHUNK information inserted for this one  */
+            else if (obj->chunk.rank>0)
+            {
+                /*check if the input rank is correct (just here, better later than never) */
+                if (obj->chunk.rank!=rank)
+                {
+                    printf("Error: chunk rank does not match for <%s>\n",path);
+                    return FAIL;
+                }
+                *chunk_flags = HDF_CHUNK;
+                for (i = 0; i < rank; i++) 
+                    chunk_def->chunk_lengths[i] = obj->chunk.chunk_lengths[i];
+                
+            }
+            /* check if we have COMP information; 0 is the NONE option */
+            if (obj->comp.type>=0)
+            {
+                *comp_type   = obj->comp.type;
+                *info        = obj->comp.info;
+                *szip_mode   = obj->comp.szip_mode;
+                /* check if we have also CHUNK info  */
+                if (obj->chunk.rank>0)
+                {
+                    *chunk_flags              = HDF_CHUNK | HDF_COMP;
+                    chunk_def->comp.comp_type = *comp_type;
+                    switch (*comp_type)
+                    {
+                    case COMP_CODE_NONE:
+                        break;
+                        
+                    case COMP_CODE_SZIP:
+                        if (set_szip (obj->comp.info,obj->comp.szip_mode,&c_info)==FAIL)
+                        {
+                            return FAIL;
+                        }
+                        chunk_def->comp.cinfo = c_info;
+                        
+                        break;
+                    case COMP_CODE_RLE:
+                        break;
+                    case COMP_CODE_SKPHUFF:
+                        chunk_def->comp.cinfo.skphuff.skp_size = obj->comp.info;
+                        break;
+                    case COMP_CODE_DEFLATE:
+                        chunk_def->comp.cinfo.deflate.level    = obj->comp.info;
+                        break; 
+                    case COMP_CODE_JPEG:
+                        chunk_def->comp.cinfo.jpeg.quality        = obj->comp.info;
+                        chunk_def->comp.cinfo.jpeg.force_baseline = 1;
+                        break;
+                    default:
+                        printf("Error: Unrecognized compression code in %d <%s>\n",*comp_type,path);
+                        return FAIL;
+                        break;
+                    };
+                }
+            } /* comp.type */
+        } /* obj */
+    } /* else if */
+    
+      /*-------------------------------------------------------------------------
+      * CASE 3: chunk==SELECTED comp==ALL 
+      *-------------------------------------------------------------------------
+    */
+    else if (options->all_chunk==0 && options->all_comp==1)
+    {
+        obj = options_get_object(path,options->op_tbl);
+        
+        if (obj!=NULL)
+        {
+            
+            /* NONE option */
+            if (obj->chunk.rank==-2)
+            {
+                *chunk_flags = HDF_NONE;
+            }
+            
+            /* check if we have CHUNK information inserted for this one  */
+            else if (obj->chunk.rank>0)
+            {
+                /*check if the input rank is correct (just here, better later than never) */
+                if (obj->chunk.rank!=rank)
+                {
+                    printf("Error: chunk rank does not match for <%s>\n",path);
+                    return FAIL;
+                }
+                *chunk_flags = HDF_CHUNK;
+                for (i = 0; i < rank; i++) 
+                    chunk_def->chunk_lengths[i] = obj->chunk.chunk_lengths[i];
+            }
+        } /* obj */
+        
+        /* we must have COMP information */
+        
+        *comp_type   = options->comp_g.type;
+        *info        = options->comp_g.info;
+        *szip_mode   = options->comp_g.szip_mode;
+        /* check if we have also CHUNK information  */
+        if ( (*chunk_flags==HDF_CHUNK) || (*chunk_flags==(HDF_CHUNK|HDF_COMP)))
+        {
+            *chunk_flags              = HDF_CHUNK | HDF_COMP;
+            chunk_def->comp.comp_type = *comp_type;
+            switch (*comp_type)
+            {
+            case COMP_CODE_NONE:
+                break;
+                
+            case COMP_CODE_SZIP:
+                if (set_szip (options->comp_g.info,options->comp_g.szip_mode,&c_info)==FAIL)
+                {
+                    return FAIL;
+                }
+                chunk_def->comp.cinfo = c_info;
+                
+            case COMP_CODE_RLE:
+                break;
+            case COMP_CODE_SKPHUFF:
+                chunk_def->comp.cinfo.skphuff.skp_size = *info;
+                break;
+            case COMP_CODE_DEFLATE:
+                chunk_def->comp.cinfo.deflate.level    = *info;
+                break;
+            case COMP_CODE_JPEG:
+                chunk_def->comp.cinfo.jpeg.quality        = *info;;
+                chunk_def->comp.cinfo.jpeg.force_baseline = 1;
+                break;
+            default:
+                printf("Error: Unrecognized compression code in %d <%s>\n",*comp_type,path);
+                return FAIL;
+                break;
+            };
+        }
+    } /* else if */
+    
+      /*-------------------------------------------------------------------------
+      * CASE 4: chunk==ALL comp==ALL 
+      *-------------------------------------------------------------------------
+    */
+    else if (options->all_chunk==1 && options->all_comp==1)
+    {
+        /* NONE option */
+        if (options->chunk_g.rank==-2)
+        {
+            *chunk_flags = HDF_NONE;
+        }
+        
+        /*check if this object rank is the same as input (warn this one cannot be chunked) */
+        else if (options->chunk_g.rank!=rank)
+        {
+            if ( options->verbose ) 
+                printf("Warning: chunk rank does not apply to <%s>\n",path);
+        }
+        else
+        {
+            *chunk_flags = HDF_CHUNK;
+            for (i = 0; i < rank; i++) 
+                chunk_def->chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
+        }
+        
+        /* we must have COMP information */
+        *comp_type   = options->comp_g.type;
+        *info        = options->comp_g.info;
+        *szip_mode   = options->comp_g.szip_mode;
+        /* check if we can aplly CHUNK */
+        if (options->chunk_g.rank==rank)
+        {
+            *chunk_flags              = HDF_CHUNK | HDF_COMP;
+            chunk_def->comp.comp_type = *comp_type;
+            switch (*comp_type)
+            {
+            case COMP_CODE_NONE:
+                break;
+                
+            case COMP_CODE_SZIP:
+                if (set_szip (options->comp_g.info,options->comp_g.szip_mode,&c_info)==FAIL)
+                {
+                    return FAIL;
+                }
+                chunk_def->comp.cinfo = c_info;
+                
+            case COMP_CODE_RLE:
+                break;
+            case COMP_CODE_SKPHUFF:
+                chunk_def->comp.cinfo.skphuff.skp_size = *info;
+                break;
+            case COMP_CODE_DEFLATE:
+                chunk_def->comp.cinfo.deflate.level    = *info;
+                break;
+            case COMP_CODE_JPEG:
+                chunk_def->comp.cinfo.jpeg.quality        = *info;;
+                chunk_def->comp.cinfo.jpeg.force_baseline = 1;
+                break;
+            default:
+                printf("Error: Unrecognized compression code in %d <%s>\n",*comp_type,path);
+                return FAIL;
+                break;
+            };
+        }
+    } /* else if */
+    
+    return (obj==NULL) ? 0 : 1;
+    
+    
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: set_szip
+ *
+ * Purpose: utility to set SZIP parameters
+ *
+ * SZIP compresses data block by block, with a user-tunable block size. 
+ * This block size is passed in the parameter pixels_per_block and must be even, 
+ * with typical values being 8, 10, 16, and 32. The more pixel values vary, 
+ * the smaller this number should be. For optimal performance, the number of 
+ * pixels per scan line (i.e., the size of the fastest-changing dimension in the chunk) 
+ * should be an even multiple of the number of pixels per block. 
+ *
+ * Return: 0 for OK, -1 otherwise
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 11, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int set_szip( int   pixels_per_block, /*in */
+              int   compression_mode, /* in */
+              comp_info *c_info/*out*/)
+{
+#ifdef H4_HAVE_LIBSZ
+    
+    int   ppb=pixels_per_block;
+    
+    if (SZ_encoder_enabled() == 0) {
+        printf("Warning: SZIP encoder is not enabled\n");
+        return -1;
+    }
+    
+    if ( (compression_mode!=NN_MODE) && (compression_mode!=EC_MODE))
+    {
+        printf("SZIP compression mode must be NN_MODE or EC_MODE");
+        return -1;
+    }
+    
+    /* 
+    pixels_per_block must be an even number, and <= pixels_per_scanline 
+    and <= SZ_MAX_PIXELS_PER_BLOCK
+    */
+    
+    if (pixels_per_block & 1)
+    {
+        printf("Pixels per block must be even.\n");
+        return -1;
+    }
+    if (ppb < 2 || ppb > 32) {
+        printf("Pixels per block must be 2-32.\n");
+        return -1;
+    }
+    c_info->szip.pixels_per_block = ppb;
+    
+    /* set according to input value */
+    c_info->szip.options_mask = SZ_EC_OPTION_MASK;
+    if (compression_mode == EC_MODE) {
+        c_info->szip.options_mask = SZ_EC_OPTION_MASK;
+    } else if (compression_mode == NN_MODE) {
+        c_info->szip.options_mask = SZ_NN_OPTION_MASK;
+    }
+    c_info->szip.options_mask |= SZ_RAW_OPTION_MASK;
+    
+    return 0;
+#else
+    printf("Warning: SZIP compression is not available\n");
+    return -1;
+#endif
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: cache
+ *
+ * Purpose: Checks chunk size
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int cache(
+HDF_CHUNK_DEF    chunk_def,
+int32 eltsz,
+int32 rank,
+int32 *dimsize)
+{
+    int32 targetbytes;
+    int32 chunkrow;
+    int32 chunkcnt;
+    int32 chunksizes[32];
+    int i;
+    int32 cntr;
+    
+    for (i = 0; i < rank; i++) {
+        chunkcnt = 1;
+        targetbytes = dimsize[i] * eltsz;
+        chunkrow = eltsz * chunk_def.chunk_lengths[i];
+        cntr = chunkrow;
+        while( cntr < targetbytes) {
+            cntr += chunkrow;
+            chunkcnt++;
+        }
+        chunksizes[i] = chunkcnt;
+    }
+    chunkcnt = 1;
+    for (i = 0; i < rank; i++) {
+        chunkcnt *= chunksizes[i];
+    }
+    printf("total chunks is %ld\n",chunkcnt);
+    return 0;
+}
+
+
+
diff --git a/mfhdf/hrepack/hrepack_utils.h b/mfhdf/hrepack/hrepack_utils.h
new file mode 100644
index 0000000..2473cdd
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_utils.h
@@ -0,0 +1,54 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_UTILS_H_
+#define REPACK_UTILS_H_
+
+#include "hrepack.h"
+#include "hrepack_parse.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int is_reserved(char*vgroup_class);
+char *get_path(char*path_name, char*obj_name);
+
+int  options_get_info(options_t      *options,     /* global options */
+                      int32          *chunk_flags, /* chunk flags OUT */
+                      HDF_CHUNK_DEF  *chunk_def,   /* chunk definition OUT */
+                      int            *info,        /* compression info OUT */
+                      int            *szip_mode,   /* compression information OUT */
+                      comp_coder_t   *comp_type,   /* compression type OUT  */
+                      int            rank,         /* rank of object IN */
+                      char           *path,        /* path of object IN */
+                      int            ncomps,       /* number of GR image planes (for SZIP), IN */
+                      int32          *dimsizes,    /* dimensions (for SZIP), IN */
+                      int32          dtype         /* numeric type (for SZIP), IN */
+                      );
+
+int set_szip( int   pixels_per_block, /*in */
+             int   compression_mode, /* in */
+             comp_info *c_info/*out*/);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_UTILS_H_ */
diff --git a/mfhdf/hrepack/hrepack_vg.c b/mfhdf/hrepack/hrepack_vg.c
new file mode 100644
index 0000000..df9e9d8
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_vg.c
@@ -0,0 +1,76 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <assert.h>
+#include "hdf.h"
+#include "mfhdf.h"
+
+#include "hrepack_vg.h"
+#include "hrepack_utils.h"
+#include "hrepack_an.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_vgroup_attrs
+ *
+ * Purpose: copy VG attributes
+ *
+ * Return: FAIL, SUCCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_vgroup_attrs(int32 vg_in, int32 vg_out, char *path,options_t *options) 
+{
+    int    n_attrs;
+    int32  data_type, size,  n_values;
+    char   attr_name[H4_MAX_NC_NAME];
+    int    i;
+    char   *buf=NULL;
+    
+    if ( options->trip==0 ) 
+    {
+        return 1;
+    }
+    
+    /* Get the number of attributes attached to this vgroup.  */
+    if((n_attrs = Vnattrs2 (vg_in))==FAIL) {
+        printf( "Failed to get attributes for <%s>\n", path);
+        return-1;
+    }
+    
+    for (i = 0; i < n_attrs; i++) 
+    {
+        if((Vattrinfo2(vg_in, i, attr_name, &data_type, &n_values, &size, NULL, NULL))==FAIL) {
+            printf( "Failed to get attribute %d of <%s>\n", i, path);
+            continue;
+        }
+        if ((buf = (char *)malloc( (size_t) (size * n_values) ))==NULL ) {
+            printf( "Failed to get memory for attribute %d of <%s>\n", i, path);
+            continue;
+        }
+        if((Vgetattr2 (vg_in, i, buf))==FAIL){
+            printf( "Failed to get attribute %d of <%s>\n", i, path);
+            if (buf) free(buf);
+            continue;
+        }
+        if((Vsetattr(vg_out, attr_name, data_type, n_values, buf))==FAIL){
+            printf( "Failed to set attribute %d of <%s>\n", i, path);
+        }
+        if (buf) free(buf);
+    }
+    return 1;
+}
+
+
diff --git a/mfhdf/hrepack/hrepack_vg.h b/mfhdf/hrepack/hrepack_vg.h
new file mode 100644
index 0000000..8c95443
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_vg.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * NCSA HDF                                                                 *
+ * Software Development Group                                               *
+ * National Center for Supercomputing Applications                          *
+ * University of Illinois at Urbana-Champaign                               *
+ * 605 E. Springfield, Champaign IL 61820                                   *
+ *                                                                          *
+ * For conditions of distribution and use, see the accompanying             *
+ * hdf/COPYING file.                                                        *
+ *                                                                          *
+ ****************************************************************************/
+
+
+#ifndef REPACK_VG_H_
+#define REPACK_VG_H_
+
+#include "hrepack.h"
+#include "hrepack_lsttable.h"
+#include "hrepack_dim.h"
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int copy_vgroup_attrs(int32 vg_in, 
+                      int32 vg_out, 
+                      char *path,
+                      options_t *options);
+
+int vgroup_insert(int32 infile_id,
+                  int32 outfile_id,
+                  int32 sd_id,             /* SD interface identifier */
+                  int32 sd_out,            /* SD interface identifier */
+                  int32 gr_id,             /* GR interface identifier */
+                  int32 gr_out,            /* GR interface identifier */
+                  int32 vgroup_id_out_par, /* output parent group ID */
+                  char*path_name,          /* absolute path for input group name */          
+                  int32* in_tags,          /* tag list for parent group */
+                  int32* in_refs,          /* ref list for parent group */
+                  int npairs,              /* number tag/ref pairs for parent group */
+                  list_table_t *list_tbl,
+                  dim_table_t *td1,
+                  dim_table_t *td2,
+                  options_t *options);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_VG_H_ */
diff --git a/mfhdf/hrepack/hrepack_vs.c b/mfhdf/hrepack/hrepack_vs.c
new file mode 100644
index 0000000..ce037ea
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_vs.c
@@ -0,0 +1,337 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#include <assert.h>
+#include "hdf.h"
+#include "mfhdf.h"
+
+#include "hrepack_vs.h"
+#include "hrepack_utils.h"
+#include "hrepack_an.h"
+
+
+/*-------------------------------------------------------------------------
+ * Function: copy_vs
+ *
+ * Purpose: copy a VS from input file to output file
+ *
+ * Return: 0, -1 for error 
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 11, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int copy_vs( int32 infile_id,
+             int32 outfile_id,
+             int32 tag,               /* tag of input VS */
+             int32 ref,               /* ref of input VS */
+             int32 vgroup_id_out_par, /* output parent group ID */
+             char*path_name,          /* absolute path for input group name */
+             options_t *options,
+             list_table_t *list_tbl,
+             int   is_lone)
+{
+    int32 vdata_id,              /* vdata identifier */
+        vdata_out,             /* vdata identifier */
+        vdata_ref,             /* reference number of the vdata */
+        n_records,             /* number of records */
+        vdata_size, 
+        interlace_mode,
+        field_type, 
+        field_order;
+    int   n_fields, n_attrs;
+    char  vdata_name [VSNAMELENMAX], vdata_class[VSNAMELENMAX];
+    char  fieldname_list[VSFIELDMAX*FIELDNAMELENMAX];
+    char  *path=NULL;
+    char  *field_name;
+    uint8 *buf=NULL;
+    int   i, j, ret=1;
+    
+    /*-------------------------------------------------------------------------
+    * attach the vdata, gets its name and class
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if ((vdata_id  = VSattach (infile_id, ref, "r")) == FAIL ){
+        printf( "Failed to attach vdata ref %ld\n", ref);
+        return-1;
+    }
+    if (VSgetname  (vdata_id, vdata_name)==FAIL){
+        printf( "Failed to name for vdata ref %ld\n", ref);
+        return-1;
+    }
+    if (VSgetclass (vdata_id, vdata_class)==FAIL){
+        printf( "Failed to name for vdata ref %ld\n", ref);
+        return-1;
+    }
+    
+    /* ignore reserved HDF groups/vdatas; they are lone ones */
+    if( is_lone==1 && vdata_class != NULL) {
+        if( is_reserved(vdata_class)){
+            if (VSdetach (vdata_id)== FAIL )
+                printf( "Failed to detach vdata <%s>\n", path_name);
+            return 0;
+        }
+    }
+    
+    /* initialize path */
+    path=get_path(path_name,vdata_name);
+    
+    /* add object to table */
+    list_table_add(list_tbl,tag,ref,path);
+    
+    if (options->verbose)
+    {
+        printf(PFORMAT,"","","",path);    
+    }
+    
+    /* check inspection mode */
+    if ( options->trip==0 ) {
+        if (VSdetach (vdata_id)==FAIL)
+            printf( "Failed to detach vdata <%s>\n", path_name);
+        if (path) free(path);
+        return 0;
+    }
+    
+    
+    /*-------------------------------------------------------------------------
+    * get vdata info
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if (VSinquire(vdata_id, &n_records, &interlace_mode, fieldname_list, 
+        &vdata_size, vdata_name) == FAIL) {
+        printf( "Failed to get info for vdata ref %ld\n", ref);
+        if (path) free(path);
+        return-1;
+    }
+    
+    
+    /*-------------------------------------------------------------------------
+    * create the VS in the output file.  the vdata reference number is set
+    * to -1 for creating and the access mode is "w" for writing 
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if ((vdata_out  = VSattach (outfile_id, -1, "w")) == FAIL) {
+        printf( "Failed to create new VS <%s>\n", path);
+        VSdetach (vdata_id);
+        if (path) free(path);
+        return -1;
+    }
+    if (VSsetname (vdata_out, vdata_name)== FAIL) {
+        printf( "Failed to set name for new VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    if (VSsetclass(vdata_out, vdata_class)== FAIL) {
+        printf( "Failed to set class for new VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    if (VSsetinterlace(vdata_out, interlace_mode) == FAIL) {
+        printf( "Failed to set interlace mode for output vdata\n");
+        ret=-1;
+        goto out;
+    }
+    
+    
+    /*-------------------------------------------------------------------------
+    * define the fields for vdata_out
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if ((n_fields = VFnfields(vdata_id)) == FAIL ){
+        printf( "Failed getting fields for VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    
+    for (i = 0; i < n_fields; i++) {
+        field_name = VFfieldname(vdata_id, i);
+        field_type = VFfieldtype(vdata_id, i);
+        field_order = VFfieldorder(vdata_id, i);
+        if (VSfdefine(vdata_out, field_name, field_type, field_order) == FAIL) {
+            printf( "Error: cannot define fields for VS <%s>\n", path);
+            ret=-1;
+            goto out;
+        }
+    }
+    
+    /* Set fields */
+    if (VSsetfields(vdata_out, fieldname_list)==FAIL) {
+        printf( "Error: cannot define fields for VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    
+    
+    /*-------------------------------------------------------------------------
+    * read, write vdata
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* Set fields for reading */
+    if (VSsetfields(vdata_id, fieldname_list)== FAIL) {
+        printf( "Error: cannot define fields for VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    if (n_records>0)
+    {
+        if ((buf = (uint8 *)malloc( (size_t)(n_records * vdata_size))) == NULL ){
+            printf( "Failed to get memory for new VS <%s>\n", path);
+            ret=-1;
+            goto out;
+        }
+        if (VSread(vdata_id, buf, n_records, interlace_mode) == FAIL) {
+            printf( "Error reading vdata <%s>\n", path);
+            ret=-1;
+            goto out;
+        }
+        if (VSwrite(vdata_out, buf, n_records, interlace_mode) == FAIL) {
+            printf( "Error writing vdata <%s>\n", path);
+            ret=-1;
+            goto out;
+        }
+    }
+    
+    
+    /*-------------------------------------------------------------------------
+    * read, write attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if ((n_attrs = VSfnattrs( vdata_id, -1 )) == FAIL ){
+        printf( "Failed getting attributes for VS <%s>\n", path);
+        ret=-1;
+        goto out;
+    }
+    for (i = 0; i < n_attrs; i++) {
+        copy_vdata_attribute(vdata_id, vdata_out, -1, i);
+    }
+    
+    /*-------------------------------------------------------------------------
+    * read, write field attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    for (i = 0; i < n_fields; i++) {
+        if ((n_attrs = VSfnattrs(vdata_id, i)) == FAIL ){
+            printf( "Failed getting fields for VS <%s>\n", path);
+            ret=-1;
+            goto out;
+        }
+        for (j = 0; j < n_attrs; j++) {
+            copy_vdata_attribute(vdata_id, vdata_out, i, j);
+        }
+    }
+    
+    /*-------------------------------------------------------------------------
+    * add VS to group, if needed
+    *-------------------------------------------------------------------------
+    */ 
+    if (vgroup_id_out_par) 
+    {
+        /* obtain the reference number of the new VS  */
+        if ((vdata_ref=VSQueryref(vdata_out)) == 0) {
+            printf( "Failed to get new VS reference in <%s>\n", path);
+        }
+        
+        /* add the VS to the vgroup. the INPUT TAG is used */
+        if (Vaddtagref (vgroup_id_out_par, tag, vdata_ref)== FAIL) {
+            printf( "Failed to add new VS to group <%s>\n", path);
+        }
+    }
+    
+    /*-------------------------------------------------------------------------
+    * copy ANs
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if (copy_vs_an(infile_id,outfile_id,vdata_id,vdata_out,path,options)<0) {
+        ret=-1;
+        goto out;
+    }
+    
+out:
+    /* terminate access to the VSs */
+    if (VSdetach (vdata_id)==FAIL||
+        VSdetach (vdata_out)==FAIL){
+        printf( "Could not detach VG in <%s>\n", path);
+    }
+    
+    if (path)
+        free(path);
+    if (buf)
+        free(buf);
+    
+    return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+* Function: copy_vdata_attribute
+*
+* Purpose: copy VS attributes from input file to output file 
+*
+* Return: 1, for success, -1 for error 
+*
+* Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+*
+* Date: July 28, 2003
+*
+*-------------------------------------------------------------------------
+*/
+
+int copy_vdata_attribute(int32 in, int32 out, int32 findex, intn attrindex)
+{
+    char   attr_name[H4_MAX_NC_NAME];
+    int32  n_values, attr_size, attr_type;
+    VOIDP  *values=NULL;
+    
+    /* Get attribute information */
+    VSattrinfo(in, findex, attrindex, attr_name, &attr_type, &n_values, &attr_size);
+    
+    /* Allocate space for attribute values */
+    if ((values = (VOIDP)malloc((size_t)(attr_size * n_values))) == NULL) {
+        printf( "Cannot allocate %ld values of size %ld for attribute %s",
+            n_values, attr_size, attr_name);
+        return-1;
+    }
+    
+    /* Read attribute from input object */
+    if (VSgetattr(in, findex, attrindex, values) == FAIL) {
+        printf( "Cannot read attribute %s\n", attr_name);
+        if (values) free(values);
+        return-1;
+    }
+    
+    /* Write attribute to output object */
+    if (VSsetattr(out, findex, attr_name, attr_type, n_values, values) == FAIL) {
+        printf( "Cannot write attribute %s\n", attr_name);
+        if (values) free(values);
+        return-1;
+    }
+    
+    if (values) free(values);
+    
+    return 1;
+}
+
+
+
diff --git a/mfhdf/hrepack/hrepack_vs.h b/mfhdf/hrepack/hrepack_vs.h
new file mode 100644
index 0000000..6945ee5
--- /dev/null
+++ b/mfhdf/hrepack/hrepack_vs.h
@@ -0,0 +1,52 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#ifndef REPACK_VS_H_
+#define REPACK_VS_H_
+
+#include "hrepack.h"
+#include "hrepack_lsttable.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int  copy_vdata_attribute(int32 in, int32 out, int32 findex, intn attrindex);
+
+
+int  copy_vs( int32 infile_id,
+              int32 outfile_id,
+              int32 tag,
+              int32 ref,               /* ref of input VS */
+              int32 vgroup_id_out_par, /* output parent group ID */
+              char*path_name,          /* absolute path for input group name */
+              options_t *options,
+              list_table_t *list_tbl,
+              int   is_lone);
+
+int copy_vgroup_attrs(int32 vg_in, 
+                      int32 vg_out, 
+                      char *path,
+                      options_t *options);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif  /* REPACK_VS_H_ */
diff --git a/mfhdf/hrepack/hrepacktst.c b/mfhdf/hrepack/hrepacktst.c
new file mode 100644
index 0000000..3409e94
--- /dev/null
+++ b/mfhdf/hrepack/hrepacktst.c
@@ -0,0 +1,3473 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf.h"
+#include "mfhdf.h"
+#include "hcomp.h"
+#include "hrepack.h"
+#include "hdiff.h"
+#include "pal_rgb.h"
+
+#if defined (H4_HAVE_LIBSZ)
+#include "szlib.h"
+#endif
+
+#define HREPACK_FILE1         "hrepacktst1.hdf"
+#define HREPACK_FILE1_OUT     "hrepacktst1_out.hdf"
+#define HREPACK_FILE2         "hrepacktst2.hdf"
+#define HREPACK_FILE2_OUT     "hrepacktst2_out.hdf"
+#define HREPACK_FILE3         "hrepacktst3.hdf"
+#define HREPACK_FILE3_OUT     "hrepacktst3_out.hdf"
+#define DATA_FILE1            "image8.txt"
+#define DATA_FILE2            "image24pixel.txt"
+#define DATA_FILE3            "image24plane.txt"
+#define HDIFF_TSTSTR          "hdiff hrepacktst1.hdf hrepacktst1_out.hdf"
+#define HDIFF_TSTSTR2         "hdiff hrepacktst2.hdf hrepacktst2_out.hdf"
+#define HDIFF_TSTSTR3         "hdiff hrepacktst3.hdf hrepacktst3_out.hdf"
+
+#define TESTING(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout); }
+#define PASSED() {puts(" PASSED");fflush(stdout);}
+#define SKIPPED() {puts(" SKIPPED");fflush(stdout);}
+#define H4_FAILED() {puts("*FAILED*");fflush(stdout);}
+
+/* AN labels */
+#define  FILE_LABEL_TXT "This is a file label"
+#define  FILE_DESC_TXT  "This is a file description"
+#define  DATA_LABEL_TXT "This is a data label"
+#define  DATA_DESC_TXT  "This is a data annotation"
+/* dimensions of image */
+#define X_DIM_GR   60
+#define Y_DIM_GR   400
+/* dimensions of dataset */
+#define X_DIM      20
+#define Y_DIM      800
+#define Z_DIM      2
+/* dimensions */
+#define XD1        60
+#define YD1        40
+/* dimensions for hyperslab sds */
+#define DIM0       10
+#define DIM1       10
+#define ADD_ROWS ( 1024 * 1024 - 10 ) / 10 
+/* Vdata */
+#define  N_RECORDS        3         /* number of records the vdata contains */
+#define  ORDER_1          3         /* order of first field */
+#define  ORDER_2          1         /* order of second field */
+#define  ORDER_3          2         /* order of third field */
+#define  CLASS_NAME       "Particle"
+#define  FIELD1_NAME      "Position"      /* contains x, y, z values */
+#define  FIELD2_NAME      "Mass"          /* contains weight values */
+#define  FIELD3_NAME      "Temperature"   /* contains min and max values */
+#define  FIELDNAME_LIST   "Position,Mass,Temperature" /* No spaces b/w names */
+#define  N_VALS_PER_REC   (ORDER_1 + ORDER_2 + ORDER_3)  /* number of values per record */
+
+/*-------------------------------------------------------------------------
+ * global variables for read image data, used in gr, r8 and r24 add
+ *-------------------------------------------------------------------------
+ */ 
+
+static int            g_lenght_x;
+static int            g_lenght_y;
+static int            g_ncomps;
+static unsigned char *g_image_data = NULL;   
+
+
+/*-------------------------------------------------------------------------
+ * read_data
+ * utility function to read ASCII image data
+ * the files have a header of the type
+ *
+ *   components
+ *   n
+ *   height
+ *   n
+ *   width
+ *   n
+ * 
+ * followed by the image data
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int read_data(const char* fname)
+{
+    int    i, n;
+    int    color_planes;
+    char   str[20];
+    FILE   *f;
+    int    w, h;
+    
+    f = fopen( fname, "r");
+    
+    if ( f == NULL )
+    {
+        printf( "Could not open file <%s>\n", fname );
+        return -1;
+    }
+    
+    fscanf( f, "%s", str );
+    fscanf( f, "%d", &color_planes );
+    fscanf( f, "%s", str );
+    fscanf( f, "%d", &h); 
+    fscanf( f, "%s", str );
+    fscanf( f, "%d", &w); 
+    
+    /* globals */
+    g_ncomps=color_planes;
+    g_lenght_y=h;
+    g_lenght_x=w;
+    
+    if ( g_image_data != NULL )
+    {
+        free( g_image_data );
+        g_image_data=NULL;
+    }
+    
+    g_image_data = (unsigned char*)malloc(w*h*color_planes*sizeof(unsigned char));
+    
+    for (i = 0; i < h*w*color_planes ; i++)
+    {
+        fscanf( f, "%d",&n );
+        g_image_data[i] = (unsigned char)n;
+    }
+    fclose(f);
+    
+    return 1;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: vg_getngrpdep
+ *
+ * Purpose: utility function to get number of vgroups dependencies in 
+ *  file HFILEID f
+ *
+ * Return: number of vgroups dependencies in file
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: September 10, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int vg_getngrpdep( HFILEID f)
+{
+    int32       vg, vgt;
+    int32       vgotag, vgoref;
+    int32       vgid = -1;
+    int32       vsid = -1;
+    int32       vsno = 0;
+    int32       vstag;
+    int32       i, nvg, n, ne, nlnk;
+    uint16      name_len;
+    char        *vgname;
+
+    Vstart(f);
+    
+    nvg = 0;
+    nlnk = 0;
+    while ((vgid = Vgetid(f, vgid)) != -1)
+    {
+        vg = Vattach(f, vgid, "r");
+        if (vg == FAIL)
+        {
+            printf("cannot open vg id=%d\n", (int) vgid);
+        }
+        /* Get vgroup's name */
+        if (Vgetnamelen(vg, &name_len)==FAIL)
+        {
+            printf("Error: Could not get name length for group with ref <%ld>\n", vgid);
+            continue;
+        }
+        vgname = (char *) HDmalloc(sizeof(char) * (name_len+1));
+
+        Vinquire(vg, &n, vgname);
+        vgotag = VQuerytag(vg);
+        vgoref = VQueryref(vg);
+       
+        for (i = 0; i < Vntagrefs(vg); i++)
+        {
+            Vgettagref(vg, i, &vstag, &vsid);
+            
+            if (vstag == DFTAG_VG)
+            {
+                vgt = Vattach(f, vsid, "r");
+                
+                if (vgt == FAIL)
+                {
+                    printf("cannot open vg id=%d\n", (int) vsid);
+                    continue;
+                }
+                
+                Vinquire(vgt, &ne, vgname);
+                
+                vgotag = VQuerytag(vgt);
+                vgoref = VQueryref(vgt);
+                
+                Vdetach(vgt);
+
+                nlnk++;
+                
+            } /* if */
+            
+        }   /* for */
+        
+        Vdetach(vg);
+        nvg++;
+        
+    }  /* while */
+    
+
+    Vend(f);
+
+    return nlnk;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: vg_verifygrpdep
+ *
+ * Purpose: utility function to verify number of vgroups dependencies in 
+ *  2 files NAME1 and NAME2
+ *
+ * Return: 0, group dependencies are the same in both files
+ *         1, they are not the same
+ *        -1, error
+ *
+ * Programmer: Pedro Vicente, pvn at hdfgroup.org
+ *
+ * Date: September 10, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int vg_verifygrpdep( char* name1, char* name2 )
+{
+    HFILEID f1;
+    HFILEID f2;
+    int32   nlnk1;
+    int32   nlnk2;
+    
+    
+    if ((f1 = Hopen(name1, DFACC_READ, 0)) == FAIL)
+    {
+        printf("\nFile (%s) failed to open.\n", name1);
+        return -1;
+    }
+    if ((f2 = Hopen(name2, DFACC_READ, 0)) == FAIL)
+    {
+        printf("\nFile (%s) failed to open.\n", name2);
+        return -1;
+    }
+
+    nlnk1 = vg_getngrpdep( f1 );
+    nlnk2 = vg_getngrpdep( f2 );
+    
+    Hclose(f1);
+    Hclose(f2);
+
+    return (nlnk1 == nlnk2) ? 0: 1;
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: set_chunk_def
+ *
+ * Purpose: set chunk parameters. used by GR and SDS
+ *
+ * Return: void
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: September 15, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+void set_chunk_def( comp_coder_t comp_type, 
+                    int32 *dim,
+                    int32 ncomps,
+                    int32 bits_per_pixel, /* for szip */
+                    HDF_CHUNK_DEF *chunk_def )
+{
+    
+    /* Define chunk's dimensions */
+    chunk_def->chunk_lengths[0] = dim[0]/2;
+    chunk_def->chunk_lengths[1] = dim[1]/2;
+    /* To use chunking with RLE, Skipping Huffman, GZIP, SZIP compression */
+    chunk_def->comp.chunk_lengths[0] = dim[0]/2;
+    chunk_def->comp.chunk_lengths[1] = dim[1]/2;
+    
+    /*define some compression specific parameters */
+    switch(comp_type)
+    {
+    default:
+        break;
+    case COMP_CODE_RLE:
+        chunk_def->comp.comp_type = COMP_CODE_RLE;
+        break;
+        
+    case COMP_CODE_SKPHUFF:
+        chunk_def->comp.comp_type = COMP_CODE_SKPHUFF;
+        chunk_def->comp.cinfo.skphuff.skp_size = 1;
+        break;
+        
+    case COMP_CODE_DEFLATE:
+        /* GZIP compression, set compression type, flag and deflate level*/
+        chunk_def->comp.comp_type = COMP_CODE_DEFLATE;
+        chunk_def->comp.cinfo.deflate.level = 6;
+        break;
+        
+    case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+        if (SZ_encoder_enabled()) {
+            chunk_def->comp.cinfo.szip.pixels_per_block = 2;
+            chunk_def->comp.cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+            chunk_def->comp.cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+            chunk_def->comp.cinfo.szip.pixels = 0;
+            chunk_def->comp.cinfo.szip.pixels_per_scanline = 0;
+            chunk_def->comp.cinfo.szip.bits_per_pixel = 0;
+        } else {
+            printf("Warning: SZIP encoding not available\n");
+        }
+#else
+        printf("Warning: SZIP compression not available\n");
+#endif
+        break;
+    }
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * verify functions
+ *-------------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ * Function: cmp_gr
+ *
+ * Purpose: compare 2 GR images 
+ *
+ * Return: same as memcmp
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: September 03, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+int cmp_gr(int32 ri1_id, int32 ri2_id)
+{
+    int32         dimsizes[2],   /* dimensions of an image */
+        n_comps,       /* number of components an image contains */
+        interlace_mode1,/* interlace mode of an image */ 
+        dtype,         /* number type of an image */
+        n_attrs;       /* number of attributes belong to an image */
+    int32         interlace_mode2;        
+    char          gr_name[H4_MAX_GR_NAME]; 
+    int           j, rank=2;
+    int32         start[2],       /* read start */
+        edges[2],       /* read edges */
+        numtype,        /* number type */
+        eltsz,          /* element size */
+        nelms,          /* number of elements */
+        data_size;
+    VOIDP         buf1=NULL, buf2=NULL;
+    int           cmp=-1;
+    
+    GRgetiminfo(ri1_id,gr_name,&n_comps,&dtype,&interlace_mode1,dimsizes,&n_attrs);
+    GRgetiminfo(ri2_id,gr_name,&n_comps,&dtype,&interlace_mode2,dimsizes,&n_attrs);
+    
+    printf( "Comparing GR <%s>: ", gr_name);
+    
+    
+    /*-------------------------------------------------------------------------
+    * match interlace 
+    * NOTE: GR images are always stored as pixel_interlace (0) on disk
+    *       that does not happen with images saved with the 
+    *       DF24 - Single-file 24-Bit Raster Image Interface,
+    *       where the interlace mode on disk can be 0, 1 or 2
+    *-------------------------------------------------------------------------
+    */
+    if ( interlace_mode1 != interlace_mode2 )
+    {
+        printf("Warning: different interlace mode: <%ld> and <%ld>", 
+            interlace_mode1,interlace_mode2);
+        interlace_mode1=interlace_mode2;
+    }
+    
+    /*-------------------------------------------------------------------------
+    * check for data size before printing
+    *-------------------------------------------------------------------------
+    */
+    
+    /* compute the number of the bytes for each value. */
+    numtype = dtype & DFNT_MASK;
+    eltsz = DFKNTsize(numtype | DFNT_NATIVE);
+    
+    /* set edges of GR */
+    nelms=1;
+    for (j = 0; j < rank; j++) {
+        nelms   *= dimsizes[j];
+        edges[j] = dimsizes[j];
+        start[j] = 0;
+    }
+    
+    data_size = dimsizes[0]*dimsizes[1]*n_comps*eltsz;
+    
+    /*-------------------------------------------------------------------------
+    * read gr 1
+    *-------------------------------------------------------------------------
+    */
+    
+    /* alloc */
+    if ((buf1 = (VOIDP) HDmalloc(data_size)) == NULL) {
+        printf( "Failed to allocate %ld elements of size %ld\n", nelms, eltsz);
+        goto out;
+    }
+    
+    
+    /* read data */
+    if (GRreadimage (ri1_id, start, NULL, edges, buf1) == FAIL) {
+        printf( "Could not read GR\n");
+        goto out;
+    }
+    
+    /*-------------------------------------------------------------------------
+    * read gr 2
+    *-------------------------------------------------------------------------
+    */
+    
+    /* alloc */
+    if ((buf2 = (VOIDP) HDmalloc(data_size)) == NULL) {
+        printf( "Failed to allocate %ld elements of size %ld\n", nelms, eltsz);
+        goto out;
+    }
+    
+    /* read data */
+    if (GRreadimage (ri2_id, start, NULL, edges, buf2) == FAIL) {
+        printf( "Could not read GR\n");
+        goto out;
+    }
+    
+    cmp = HDmemcmp(buf1,buf2,data_size);
+    if (cmp!=0)
+        printf("Differences found\n");
+    else
+        printf("\n");
+    
+out:
+    /* terminate access to the GRs */
+    GRendaccess(ri1_id);
+    GRendaccess(ri2_id);
+    if (buf1)
+        free(buf1);
+    if (buf2)
+        free(buf2);
+    return cmp;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: sds_verifiy_comp
+ *
+ * Purpose: utility function to verify compression for SDS_NAME
+ *
+ * Return: 0, -1 on error
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int sds_verifiy_comp(const char *sds_name, 
+                     int32 in_comp_type, 
+                     int32 in_comp_info)
+{
+    comp_coder_t  comp_type;    /* to retrieve compression type into */
+    comp_info     comp_info;    /* compression structure */ 
+    int32         sd_id,
+                  sds_id, 
+                  sds_index;   
+    
+    /* get chunk and comp */
+    sd_id     = SDstart (HREPACK_FILE1_OUT, DFACC_RDONLY);
+    sds_index = SDnametoindex(sd_id, sds_name);
+    if ((sds_id = SDselect(sd_id, sds_index))==FAIL) {
+        printf("Error: Cannot open sds <%s>", sds_name);
+        SDend (sd_id);
+        return -1;
+    }
+    
+    /*-------------------------------------------------------------------------
+    * retrieve and verify the compression info
+    *-------------------------------------------------------------------------
+    */
+    
+    comp_type = COMP_CODE_NONE;  /* reset variables before retrieving info */
+    HDmemset(&comp_info, 0, sizeof(comp_info)) ;
+    SDgetcompinfo(sds_id, &comp_type, &comp_info);
+    if ( comp_type != in_comp_type )
+    {
+        printf("Error: Compression type does not match ");
+        SDendaccess (sds_id);
+        SDend (sd_id);
+        return -1;
+    }
+    if (in_comp_info) {
+        if ( comp_info.skphuff.skp_size != in_comp_info )
+        {
+            printf("Error: compresion information does not match ");
+            SDendaccess (sds_id);
+            SDend (sd_id);
+            return -1;
+        }
+    }
+    
+    /* terminate access to the sds */
+    SDendaccess (sds_id);
+    
+    /* terminate access to the sd interface */
+    SDend (sd_id);
+    
+    return 0;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: sds_verifiy_comp_all
+ *
+ * Purpose: utility function to verify compression for all SDSs
+ *
+ * Return: 0, -1 on error
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int sds_verifiy_comp_all(comp_coder_t in_comp_type, 
+                         int in_comp_info)
+{
+    comp_coder_t  comp_type;    /* to retrieve compression type into */
+    comp_info     comp_info;    /* compression structure */ 
+    int32         sd_id,
+        sds_id, 
+        sds_index,
+        n_datasets,   /* number of datasets in the file */
+        n_file_attrs, /* number of file attributes */
+        data_type,              /* number type  */
+        rrank,                  /* read rank */
+        n_attrs,                /* number of attributes */
+        dim_sizes[H4_MAX_VAR_DIMS];/* dimensions of an image */
+    char          name[H4_MAX_GR_NAME];      /* name of dataset */
+    int           info;
+    intn          empty_sds;
+    int           is_record = 0;
+    
+    /* initialize the sd interface */
+    sd_id  = SDstart (HREPACK_FILE1_OUT, DFACC_READ);
+    
+    /* determine the number of data sets in the file */
+    if (SDfileinfo (sd_id, &n_datasets, &n_file_attrs)==FAIL) 
+    {
+        printf("Error: Cannot get file information");
+        SDend (sd_id);
+        return -1;
+    }
+    
+    for (sds_index = 0; sds_index < n_datasets; sds_index++)
+    {
+        sds_id   = SDselect (sd_id, sds_index);
+        
+        /* skip dimension scales */
+        if ( SDiscoordvar(sds_id) ) 
+        {
+            SDendaccess(sds_id);
+            continue;
+        }
+        
+        name[0] = '\0';
+        if ( SDgetinfo(sds_id, name, &rrank, dim_sizes, &data_type, &n_attrs) == FAIL )
+        {
+            printf("Error: can't read info for SDS <%s>",name);
+            SDendaccess (sds_id);
+            SDend (sd_id);
+            return -1;
+        }
+        
+        /*-------------------------------------------------------------------------
+        * check if the input SDS is empty
+        *-------------------------------------------------------------------------
+        */ 
+        if (SDcheckempty( sds_id, &empty_sds ) == FAIL) 
+        {
+            printf( "Failed to check empty SDS <%s>\n", name);
+            SDendaccess (sds_id);
+            SDend (sd_id);
+            return -1;
+        }
+        
+        /*-------------------------------------------------------------------------
+        * retrieve and verify the compression info
+        *-------------------------------------------------------------------------
+        */
+        
+        if (empty_sds==0 )
+        {
+            
+            comp_type = COMP_CODE_NONE;  /* reset variables before retrieving info */
+            HDmemset(&comp_info, 0, sizeof(comp_info)) ;
+
+            if (SDisrecord(sds_id))
+                is_record = 1;
+
+            /* unlimited dimensions don't work with compression */
+            if ( ! is_record )
+            {
+                
+                
+                if ( SDgetcompinfo(sds_id, &comp_type, &comp_info) == FAIL )
+                {
+                    printf("Warning: can't read compression for SDS <%s>",name);
+                } 
+                else 
+                {
+                    if ( comp_type != in_comp_type )
+                    {
+                        printf("Error: compression type does not match <%s>",name);
+                        SDendaccess (sds_id);
+                        SDend (sd_id);
+                        return -1;
+                    }
+                    if (in_comp_type) 
+                    {
+                        switch (in_comp_type)
+                        {
+                        case COMP_CODE_NONE:
+                            break;
+                        case COMP_CODE_RLE:
+                            break;
+                        case COMP_CODE_SZIP:
+                            break;
+                        case COMP_CODE_SKPHUFF:
+                            info  = comp_info.skphuff.skp_size;
+                            break;
+                        case COMP_CODE_DEFLATE:
+                            info  = comp_info.deflate.level;
+                            break;
+                        default:
+                            printf("Error: Unrecognized compression code %d\n",in_comp_type);
+                            info = -1;
+                            break;
+                        };
+                        
+                        if ( info != in_comp_info )
+                        {
+                            printf("Error: compresion information does not match for <%s>",name);
+                            SDendaccess (sds_id);
+                            SDend (sd_id);
+                            return -1;
+                        }
+                    }
+                }
+                
+            } /* is_record */
+            
+        } /* empty_sds */
+        
+        /* terminate access to the current dataset */
+        SDendaccess (sds_id);
+    }
+    
+    /* terminate access to the sd interface */
+    SDend (sd_id);
+    
+    return 0;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: sds_verifiy_chunk
+ *
+ * Purpose: utility function to verify chunking for  SDS_NAME
+ *
+ * Return: 0, -1 on error
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int sds_verifiy_chunk(const char *sds_name, 
+                      int32 in_chunk_flags, 
+                      int rank, 
+                      int32 *in_chunk_lengths)
+{
+    HDF_CHUNK_DEF chunk_def;    /* chunk defintion read */ 
+    int32         chunk_flags;  /* chunking flag */ 
+    int32         sd_id,
+        sds_id, 
+        sds_index;   
+    int           i;
+    
+    /* get chunk and comp */
+    sd_id     = SDstart (HREPACK_FILE1_OUT, DFACC_RDONLY);
+    sds_index = SDnametoindex(sd_id, sds_name);
+    if ((sds_id = SDselect(sd_id, sds_index))==FAIL) {
+        printf("Error: cannot open sds <%s>", sds_name);
+        SDend (sd_id);
+        return -1;
+    }
+    SDgetchunkinfo (sds_id, &chunk_def, &chunk_flags);
+    
+    /*-------------------------------------------------------------------------
+    * retrieve and verify the chunk info
+    *-------------------------------------------------------------------------
+    */
+    if ( chunk_flags != (in_chunk_flags) )
+    {
+        printf("Error: chunk flags do not match");
+        SDendaccess (sds_id);
+        SDend (sd_id);
+        return -1;
+    }
+    for (i = 0; i < rank; i++)
+    {
+        if (chunk_def.chunk_lengths[i] != in_chunk_lengths[i] )
+        {
+            printf("Error: chunk lengths do not match ");
+            SDendaccess (sds_id);
+            SDend (sd_id);
+            return -1;
+        }
+    }
+    
+    /* terminate access to the sds */
+    SDendaccess (sds_id);
+    
+    /* terminate access to the sd interface */
+    SDend (sd_id);
+    
+    return 0;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: sds_verifiy_chunk_all
+ *
+ * Purpose: utility function to verify chunking for all SDSs
+ *
+ * Return: 0, -1 on error
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int sds_verifiy_chunk_all(int32 in_chunk_flags, 
+                          int rank, 
+                          int32 *in_chunk_lengths,
+                          const char *sds_exclude)
+{
+    HDF_CHUNK_DEF chunk_def;    /* chunk defintion read */ 
+    int32         chunk_flags;  /* chunking flag */ 
+    int32         sd_id,
+        sds_id, 
+        sds_index,
+        n_datasets,   /* number of datasets in the file */
+        n_file_attrs, /* number of file attributes */
+        data_type,              /* number type  */
+        rrank,                  /* read rank */
+        n_attrs,                /* number of attributes */
+        dim_sizes[H4_MAX_VAR_DIMS];/* dimensions of an image */
+    char          name[H4_MAX_GR_NAME];      /* name of dataset */
+    int           i;
+    
+    /* initialize the sd interface */
+    sd_id  = SDstart (HREPACK_FILE1_OUT, DFACC_READ);
+    
+    /* determine the number of data sets in the file */
+    if (SDfileinfo (sd_id, &n_datasets, &n_file_attrs)==FAIL) {
+        printf("Error: cannot get file information");
+        SDend (sd_id);
+        return -1;
+    }
+    
+    for (sds_index = 0; sds_index < n_datasets; sds_index++)
+    {
+        sds_id   = SDselect (sd_id, sds_index);
+        
+        /* skip dimension scales */
+        if ( SDiscoordvar(sds_id) ) {
+            SDendaccess(sds_id);
+            continue;
+        }
+        
+        SDgetinfo(sds_id, name, &rrank, dim_sizes, &data_type, &n_attrs);
+        SDgetchunkinfo (sds_id, &chunk_def, &chunk_flags);
+        
+        /* do not compare this one */
+        if (strcmp(name,sds_exclude)==0)
+        {
+            SDendaccess(sds_id);
+            SDend (sd_id);
+            return 0;
+        }
+        
+        /*-------------------------------------------------------------------------
+        * retrieve and verify the chunk info
+        *-------------------------------------------------------------------------
+        */
+        if ( chunk_flags != (in_chunk_flags) )
+        {
+            printf("Error: chunk flags do not match");
+            SDendaccess (sds_id);
+            SDend (sd_id);
+            return -1;
+        }
+        for (i = 0; i < rank; i++)
+        {
+            if (chunk_def.chunk_lengths[i] != in_chunk_lengths[i] )
+            {
+                printf("Error: chunk lengths do not match ");
+                SDendaccess (sds_id);
+                SDend (sd_id);
+                return -1;
+            }
+        }
+        
+        /* terminate access to the current dataset */
+        SDendaccess (sds_id);
+    }
+    
+    /* terminate access to the sd interface */
+    SDend (sd_id);
+    
+    return 0;
+    
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * add functions
+ *-------------------------------------------------------------------------
+ */
+
+/*-------------------------------------------------------------------------
+ * Function: add_an
+ *
+ * Purpose: utility function to write a AN
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 19, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int add_an(int32 file_id, int32 tag, int32 ref)
+{
+    int32 an_id,        /* AN interface identifier */
+          data_label_id,  /* data label identifier */
+          data_desc_id;   /* data description identifier */
+    
+    /* Initialize the AN interface */
+    an_id = ANstart (file_id);
+    
+   /*-------------------------------------------------------------------------
+    * data labels and annotations
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* Create the data label for the object identified by its tag and ref number */
+    data_label_id = ANcreate (an_id, (uint16)tag, (uint16)ref, AN_DATA_LABEL);
+    
+    /* Write the annotation text to the data label */
+    if (ANwriteann (data_label_id, DATA_LABEL_TXT, strlen (DATA_LABEL_TXT))==FAIL){
+        printf("Error: writing data label in tag %ld ref %ld\n", tag, ref);
+        return FAIL;
+    }
+    
+    /* Create the data description for the object identified by its tag and ref number */
+    data_desc_id = ANcreate (an_id, (uint16)tag, (uint16)ref, AN_DATA_DESC);
+    
+    /* Write the annotation text to the data description */
+    if (ANwriteann (data_desc_id, DATA_DESC_TXT, strlen (DATA_DESC_TXT))==FAIL){
+        printf("Error: writing data label in tag %ld ref %ld\n", tag, ref);
+        return FAIL;
+    }
+    
+    /* Terminate access to each annotation explicitly */
+    if (ANendaccess (data_label_id)==FAIL||
+        ANendaccess (data_desc_id)==FAIL){
+        printf( "Failed to close AN\n");
+        return FAIL;
+    }
+    
+    /* Terminate access to the AN interface */
+    if (ANend (an_id)==FAIL){
+        printf( "Failed to close AN\n");
+        return FAIL;
+    }
+    
+    return SUCCEED;
+}
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_gr_ffile
+ *
+ * Purpose: utility function to read an image data file and save the image with the
+ *  GR - Multifile General Raster Image Interface,
+ *  optionally inserting the image into the group VGROUP_ID
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int add_gr_ffile(const char* name_file,
+                  int32 gr_id,
+                  const char* gr_name,
+                  int32 interlace_mode,
+                  int32 file_id,
+                  int32 vgroup_id)
+{
+    int32  ri_id,          /* raster image identifier */
+           gr_ref,         /* reference number of the GR image */
+           start[2],       /* start position to write for each dimension */
+           edges[2],       /* number of elements to be written along each dimension */
+           dim_gr[2],      /* dimension sizes of the image array */
+           data_type;      /* data type of the image data */
+    char   *srcdir = getenv("srcdir"); /* the source directory */
+    char   data_file[512]="";          /* buffer to hold name of existing data file */
+    uint8  attr_values[2]={1,2};
+    int    n_values;
+    
+    /* compose the name of the file to open, using the srcdir, if appropriate */
+    if ( srcdir )
+    {
+        strcpy(data_file, srcdir);
+        strcat(data_file, "/");
+    }
+    strcat( data_file, name_file);
+
+    if ( read_data(data_file) > 0 )
+    {
+        /* set the data type, interlace mode, and dimensions of the image */
+        data_type = DFNT_UINT8;
+        dim_gr[0] = g_lenght_x;
+        dim_gr[1] = g_lenght_y;
+        
+        /* create the raster image array */
+        if ((ri_id = GRcreate (gr_id, gr_name, g_ncomps, data_type, interlace_mode, dim_gr))== FAIL)
+        {
+            printf("Error: Could not create GR <%s>\n", gr_name);
+            return FAIL;
+        }
+        
+        /* define the size of the data to be written */
+        start[0] = start[1] = 0;
+        edges[0] = g_lenght_x;
+        edges[1] = g_lenght_y;
+        
+        
+        /* write the data in the buffer into the image array */
+        if (GRwriteimage(ri_id, start, NULL, edges, (VOIDP)g_image_data)==FAIL)
+        {
+            printf("Error: Could not write GR <%s>\n", gr_name);
+        }
+        
+        /* assign an attribute to the SDS */
+        n_values = 2;
+        if(GRsetattr(ri_id, "Myattr", DFNT_UINT8, n_values, (VOIDP)attr_values)==FAIL)
+        {
+            printf("Error: Could not write attributes for GR <%s>\n", gr_name);
+            return FAIL;
+        }
+        
+        /* obtain the reference number of the GR using its identifier */
+        gr_ref = GRidtoref (ri_id);
+        
+        /* add the GR to the vgroup. the tag DFTAG_RIG is used */
+        if (vgroup_id) 
+        {
+            if (Vaddtagref (vgroup_id, TAG_GRP_IMAGE, gr_ref)==FAIL)
+            {
+                printf("Error: Could not add GR <%s> to group\n", gr_name);
+                return FAIL;
+            }
+        }
+        
+        /* terminate access to the raster image */
+        if (GRendaccess (ri_id)==FAIL)
+        {
+            printf("Error: Could not close GR <%s>\n", gr_name);
+            return FAIL;
+        }
+        
+        /* add an annotation and label to the object */
+        if (add_an(file_id, DFTAG_RI, gr_ref)<0)
+            return FAIL;
+        
+    }  /* read data */
+    
+    if ( g_image_data != NULL )
+    {
+        free( g_image_data );
+        g_image_data=NULL;
+    }
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_gr
+ *
+ * Purpose: utility function to write images with the
+ *  GR - Multifile General Raster Image Interface,
+ *  optionally inserting the image into the group VGROUP_ID
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 18, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int add_gr(const char* gr_name,     /* gr name */
+            int32 file_id,           /* file ID */
+            int32 gr_id,             /* GR ID */
+            int32 vgroup_id,         /* group ID */
+            int32 chunk_flags,       /* chunk flags */
+            comp_coder_t comp_type,  /* compression flag */
+            comp_info *comp_info     /* compression structure */ )
+{
+    int32  ri_id,          /* raster image identifier */
+           gr_ref,         /* reference number of the GR image */
+           start[2],       /* start position to write for each dimension */
+           edges[2],       /* number of elements to be written along each dimension */
+           dim_gr[2],      /* dimension sizes of the image array */
+           interlace_mode, /* interlace mode of the image */
+           data_type,      /* data type of the image data */
+           data[Y_DIM_GR][X_DIM_GR];
+    int    i, j, n=0, ncomps=1;
+    HDF_CHUNK_DEF chunk_def;           /* Chunking definitions */ 
+    
+    /* set the data type, interlace mode, and dimensions of the image */
+    data_type = DFNT_UINT32;
+    interlace_mode = MFGR_INTERLACE_PIXEL;
+    dim_gr[0] = Y_DIM_GR;
+    dim_gr[1] = X_DIM_GR;
+    
+    /* data set data initialization */
+    for (j = 0; j < Y_DIM_GR; j++) {
+        for (i = 0; i < X_DIM_GR; i++)
+            data[j][i] = n++;
+    }
+    
+    /*define some compression specific parameters */
+    switch(comp_type)
+    {
+    default:
+        break;
+    case COMP_CODE_RLE:
+        break;
+        
+    case COMP_CODE_SKPHUFF:
+        comp_info->skphuff.skp_size = 1;
+        break;
+        
+    case COMP_CODE_DEFLATE:
+        comp_info->deflate.level = 6;
+        break;
+        
+    case COMP_CODE_SZIP:
+#ifdef H4_GR_SZIP
+        /* not supported for GR */
+#ifdef H4_HAVE_LIBSZ
+        if (SZ_encoder_enabled()) {
+            comp_info->szip.pixels_per_block = 2;
+            comp_info->szip.options_mask = SZ_EC_OPTION_MASK;
+            comp_info->szip.options_mask |= SZ_RAW_OPTION_MASK;
+            comp_info->szip.pixels = 0;
+            comp_info->szip.pixels_per_scanline = 0;
+            comp_info->szip.bits_per_pixel = 0;
+        } else {
+            printf("Warning: SZIP encoding not available\n");
+        }
+#else
+        printf("Warning: SZIP compression not available\n");
+#endif
+#endif
+        printf("Warning: SZIP compression not available for GR\n");
+        break;
+    }
+    
+    /* create the raster image array */
+    if ((ri_id = GRcreate (gr_id, gr_name, ncomps, data_type, interlace_mode, dim_gr))== FAIL)
+    {
+        printf("Error: Could not create GR <%s>\n", gr_name);
+        return FAIL;
+    }
+    
+    /* set chunk */
+    if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+    {
+        /* Define chunk's dimensions */
+        chunk_def.chunk_lengths[0] = Y_DIM_GR/2;
+        chunk_def.chunk_lengths[1] = X_DIM_GR/2;
+        /* To use chunking with RLE, Skipping Huffman, and GZIP compression */
+        chunk_def.comp.chunk_lengths[0] = Y_DIM_GR/2;
+        chunk_def.comp.chunk_lengths[1] = X_DIM_GR/2;
+        
+        /*define some compression specific parameters */
+        switch(comp_type)
+        {
+        default:
+            break;
+        case COMP_CODE_RLE:
+            chunk_def.comp.comp_type = COMP_CODE_RLE;
+            break;
+            
+        case COMP_CODE_SKPHUFF:
+            chunk_def.comp.comp_type = COMP_CODE_SKPHUFF;
+            chunk_def.comp.cinfo.skphuff.skp_size = 1;
+            break;
+            
+        case COMP_CODE_DEFLATE:
+            /* GZIP compression, set compression type, flag and deflate level*/
+            chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+            chunk_def.comp.cinfo.deflate.level = 6;
+            break;
+            
+        case COMP_CODE_SZIP:
+#ifdef H4_GR_SZIP
+#ifdef H4_HAVE_LIBSZ
+            if (SZ_encoder_enabled()) {
+                chunk_def.comp.cinfo.szip.pixels_per_block = 2;
+                chunk_def.comp.cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+                chunk_def.comp.cinfo.szip.options_mask |= SZ_RAW_OPTION_MASK;
+                chunk_def.comp.cinfo.szip.pixels = 0;
+                chunk_def.comp.cinfo.szip.pixels_per_scanline = 0;
+                chunk_def.comp.cinfo.szip.bits_per_pixel = 0;
+            } else {
+                printf("Warning: SZIP encoding not available\n");
+            }
+#else
+            printf("Warning: SZIP compression not available\n");
+#endif
+#endif
+            printf("Warning: SZIP compression not available for GR\n");
+            break;
+        }
+        if(GRsetchunk (ri_id, chunk_def, chunk_flags)==FAIL)
+        {
+            printf("Error: Could not set chunk for GR <%s>\n", gr_name);
+            return FAIL;
+        }
+    }
+    
+    /* use compress without chunk-in */
+    else if ( (chunk_flags==HDF_NONE || chunk_flags==HDF_CHUNK) && 
+        comp_type>COMP_CODE_NONE && comp_type<COMP_CODE_INVALID)
+    {
+        if(GRsetcompress (ri_id, comp_type, comp_info)==FAIL)
+        {
+            printf("Error: Could not set compress for GR <%s>\n", gr_name);
+            return FAIL;
+        }
+    }
+    
+    
+    /* define the size of the data to be written */
+    start[0] = start[1] = 0;
+    edges[0] = Y_DIM_GR;
+    edges[1] = X_DIM_GR;
+    
+    /* write the data in the buffer into the image array */
+    if (GRwriteimage(ri_id, start, NULL, edges, (VOIDP)data)==FAIL)
+    {
+        printf("Error: Could not set write GR <%s>\n", gr_name);
+        return FAIL;
+    }
+    
+    /* obtain the reference number of the GR using its identifier */
+    gr_ref = GRidtoref (ri_id);
+    
+    /* add the GR to the vgroup. the tag DFTAG_RIG is used */
+    if (vgroup_id)
+    {
+        if (Vaddtagref (vgroup_id, TAG_GRP_IMAGE, gr_ref)==FAIL)
+        {
+            printf("Error: Could not add GR <%s> to group\n", gr_name);
+            return FAIL;
+        }
+    }
+        
+    /* terminate access to the raster image */
+    if (GRendaccess (ri_id)==FAIL)
+    {
+        printf("Error: Could not close GR <%s>\n", gr_name);
+        return FAIL;
+    }
+    
+    /* add an annotation and label to the object */
+    if (add_an(file_id, DFTAG_RI, gr_ref)<0)
+        return FAIL;
+    
+    return SUCCEED;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: add_glb_attrs
+ *
+ * Purpose: utility function to write global attributes
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 30, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int add_glb_attrs(const char *fname,
+                   int32 file_id,
+                   int32 sd_id,
+                   int32 gr_id)
+                   
+{
+    uint8 attr_values[2]={1,2};
+    int   n_values=2;
+    
+   /*-------------------------------------------------------------------------
+    * make SDS global attributes
+    *-------------------------------------------------------------------------
+    */ 
+    /* assign an attribute to the SD */
+    if (SDsetattr(sd_id, "MySDgattr", DFNT_UINT8, n_values, (VOIDP)attr_values)==FAIL){
+        printf("Could not set SDS attr\n");
+        return FAIL;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * make GR global attributes
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* assign an attribute to the GR */
+    if (GRsetattr(gr_id, "MyGRgattr", DFNT_UINT8, n_values, (VOIDP)attr_values)==FAIL){
+        printf("Could not set GR attr\n");
+        return FAIL;
+    }
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_r8
+ *
+ * Purpose: utility function to read an image data file and save the image with the
+ *  DFR8 - Single-file 8-Bit Raster Image Interface,
+ *  optionally inserting the image into the group VGROUP_ID
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int add_r8(const char* image_file,
+            const char *fname,
+            int32 file_id,
+            int32 vgroup_id)
+{
+    int32  ri_ref;                     /* reference number of the GR image */
+    char   *srcdir = getenv("srcdir"); /* the source directory */
+    char   data_file[512]="";          /* buffer to hold name of existing data file */
+    
+    /* compose the name of the file to open, using the srcdir, if appropriate */
+    if ( srcdir )
+    {
+        strcpy(data_file, srcdir);
+        strcat(data_file, "/");
+    }
+    strcat( data_file, image_file);
+
+    if ( read_data(data_file) > 0 )
+    {
+        /* add a palette */
+        if (DFR8setpalette(pal_rgb)==FAIL){
+            printf( "Could not set palette for image\n");
+            return FAIL;
+        }
+        
+        /* write the image */
+        if (DFR8addimage(fname, g_image_data, g_lenght_x, g_lenght_y, (uint16)0)==FAIL){
+            printf( "Could not write palette for image\n");
+            return FAIL;
+        }
+        
+        /* obtain the reference number of the RIS8 */
+        ri_ref = DFR8lastref();
+        
+        /* add the image to the vgroup. the tag DFTAG_RIG is used */
+        if (vgroup_id)
+        {
+            if (Vaddtagref (vgroup_id, TAG_GRP_IMAGE, ri_ref)==FAIL){
+                printf( "Could not add image to group\n");
+                return FAIL;
+            }
+        }
+        
+        /* add an annotation and label to the object */
+        if (add_an(file_id, TAG_GRP_IMAGE, ri_ref)<0)
+            return FAIL;
+    }
+    
+    if ( g_image_data != NULL )
+    {
+        free( g_image_data );
+        g_image_data=NULL;
+    }
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_r24
+ *
+ * Purpose: utility function to read an image data file and save the image with the
+ *  DF24 - Single-file 24-Bit Raster Image Interface,
+ *  optionally inserting the image into the group VGROUP_ID
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int add_r24(const char* image_file,
+            const char *fname,
+            int32 file_id,
+            intn il,
+            int32 vgroup_id)
+{
+    int32  ri_ref;                      /* reference number of the GR image */
+    char   *srcdir = getenv("srcdir");  /* the source directory */
+    char   data_file[512]="";           /* buffer to hold name of existing data file */
+    
+    /* compose the name of the file to open, using the srcdir, if appropriate */
+    if ( srcdir )
+    {
+        strcpy(data_file, srcdir);
+        strcat(data_file, "/");
+    }
+    strcat( data_file, image_file);
+
+    if ( read_data(data_file) > 0 )
+    {
+        /* set interlace */
+        if (DF24setil(il)==FAIL){
+            printf( "Could not set interlace for image\n");
+            return FAIL;
+        }
+        
+        /* write the image */
+        if (DF24addimage(fname, g_image_data, g_lenght_x, g_lenght_y)==FAIL){
+            printf( "Could not write image\n");
+            return FAIL;
+        }
+        
+        /* obtain the reference number of the RIS24 */
+        ri_ref = DF24lastref();
+        
+        /* add the image to the vgroup. the tag DFTAG_RIG is used */
+        if (vgroup_id)
+        {
+            if (Vaddtagref (vgroup_id, TAG_GRP_IMAGE, ri_ref)==FAIL)
+            {
+                printf( "Could not set group for image\n");
+                return FAIL;
+            }
+        }
+        
+        /* add an annotation and label to the object */
+        if (add_an(file_id, TAG_GRP_IMAGE, ri_ref)<0)
+            return FAIL;
+    
+    } /* read_data */
+    
+    if ( g_image_data != NULL )
+    {
+        free( g_image_data );
+        g_image_data=NULL;
+    }
+    
+    return SUCCEED;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_sd
+ *
+ * Purpose: utility function to write with
+ *  SD - Multifile Scientific Data Interface,
+ *  optionally :
+ *   1)inserting the SD into the group VGROUP_ID
+ *   2)making the dataset chunked and/or compressed
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int add_sd(const char *fname,       /* file name */
+            int32 file_id,           /* file ID */
+            int32 sd_id,             /* SD id */
+            const char* sds_name,    /* sds name */
+            int32 vgroup_id,         /* group ID */
+            int32 chunk_flags,       /* chunk flags */
+            comp_coder_t comp_type,  /* compression flag */
+            comp_info *comp_info     /* compression structure */ )
+
+{
+    int32  sds_id,       /* data set identifier */
+           sds_ref,      /* reference number of the data set */
+           dim_sds[2],   /* dimension of the data set */
+           rank = 2,     /* rank of the data set array */
+           n_values,     /* number of values of attribute */
+           dim_index,    /* dimension index */
+           dim_id,       /* dimension ID */
+           start[2],     /* write start */
+           edges[2],     /* write edges */
+           fill_value=2, /* fill value */
+           data[Y_DIM][X_DIM],
+           bits_per_pixel=32;
+    float32 sds_values[2] = {2., 10.}; /* values of the SDS attribute  */
+    int16   data_X[X_DIM];             /* X dimension dimension scale */
+    float64 data_Y[Y_DIM];             /* Y dimension dimension scale */
+    int     i, j;
+    HDF_CHUNK_DEF chunk_def;           /* Chunking definitions */ 
+    
+    /* set the size of the SDS's dimension */
+    dim_sds[0] = Y_DIM;
+    dim_sds[1] = X_DIM;
+    
+    /*define some compression specific parameters */
+    switch(comp_type)
+    {
+    default:
+        break;
+    case COMP_CODE_RLE:
+        break;
+        
+    case COMP_CODE_SKPHUFF:
+        comp_info->skphuff.skp_size = 1;
+        break;
+        
+    case COMP_CODE_DEFLATE:
+        comp_info->deflate.level = 6;
+        break;
+        
+    case COMP_CODE_SZIP:
+#ifdef H4_HAVE_LIBSZ
+        if (SZ_encoder_enabled()) {
+            comp_info->szip.pixels_per_block = 2;
+            comp_info->szip.options_mask = SZ_EC_OPTION_MASK;
+            comp_info->szip.options_mask |= SZ_RAW_OPTION_MASK;
+            comp_info->szip.pixels = 0;
+            comp_info->szip.pixels_per_scanline = 0;
+            comp_info->szip.bits_per_pixel = 0;
+        } else {
+            printf("Warning: SZIP encoding not available\n");
+        }
+#else
+        printf("Warning: SZIP compression not available\n");
+#endif
+        break;
+    }
+    
+    /* data set data initialization */
+    for (j = 0; j < Y_DIM; j++) {
+        for (i = 0; i < X_DIM; i++)
+            data[j][i] = (i + j) + 1;
+    }
+    /* initialize dimension scales */
+    for (i=0; i < X_DIM; i++) data_X[i] = i;
+    for (i=0; i < Y_DIM; i++) data_Y[i] = 0.1 * i;
+    
+    /* create the SDS */
+    if ((sds_id = SDcreate (sd_id, sds_name, DFNT_INT32, rank, dim_sds))<0)
+    {
+        printf( "Could not create SDS <%s>\n",sds_name);
+        return FAIL;
+    }
+    
+    /* set chunk */
+    if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+    {
+        set_chunk_def(comp_type, 
+            dim_sds,
+            1,
+            bits_per_pixel,
+            &chunk_def);
+        if (SDsetchunk (sds_id, chunk_def, chunk_flags)==FAIL)  {
+            printf( "Failed to set chunk for SDS <%s>\n", sds_name);
+            goto fail;
+        }
+    }
+    
+    /* use compress without chunk-in */
+    else if ( chunk_flags==HDF_NONE && 
+        comp_type>COMP_CODE_NONE && comp_type<COMP_CODE_INVALID)
+    {
+        if(SDsetcompress (sds_id, comp_type, comp_info)==FAIL){
+            printf( "Failed to set compress for SDS <%s>\n", sds_name);
+            goto fail;
+        } 
+    }
+    
+    /* set a fill value */
+    if (SDsetfillvalue (sds_id, (VOIDP)&fill_value)==FAIL){
+        printf( "Failed to set fillvaclue for SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    /* define the location and size of the data to be written to the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_DIM;
+    edges[1] = X_DIM;
+    
+    /* write the stored data to the data set */
+    if (SDwritedata (sds_id, start, NULL, edges, (VOIDP)data)==FAIL){
+        printf( "Failed to set write for SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    /* assign an attribute to the SDS */
+    n_values = 2;
+    if (SDsetattr(sds_id,"Valid_range",DFNT_FLOAT32,n_values,(VOIDP)sds_values)==FAIL){
+        printf( "Failed to set attr for SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    /*  For each dimension of the data set specified in SDS_NAME,
+    *  get its dimension identifier and set dimension name
+    *  and dimension scale. Note that data type of dimension scale 
+    *  can be different between dimensions and can be different from 
+    *  SDS data type.
+    */
+    for (dim_index = 0; dim_index < rank; dim_index++) 
+    {
+        /* select the dimension at position dim_index */
+        dim_id = SDgetdimid (sds_id, dim_index);
+        
+        /* assign name and dimension scale to selected dimension */
+        switch (dim_index)
+        {
+        case 0: 
+            n_values = Y_DIM;
+            
+            if (SDsetdimname (dim_id, "Y_Axis")==FAIL){
+                printf( "Failed to set dims for SDS <%s>\n", sds_name);
+                goto fail;
+            } 
+            if (SDsetdimscale (dim_id,n_values,DFNT_FLOAT64,(VOIDP)data_Y)==FAIL){
+                printf( "Failed to set dims for SDS <%s>\n", sds_name);
+                goto fail;
+            }   
+            if (SDsetattr (dim_id, "info", DFNT_CHAR8, 7,"meters")==FAIL){
+                printf( "Failed to set dims for SDS <%s>\n", sds_name);
+                goto fail;
+            } 
+            break;
+        case 1: 
+            n_values = X_DIM; 
+            
+            if (SDsetdimname (dim_id, "X_Axis")==FAIL){
+                printf( "Failed to set dims for SDS <%s>\n", sds_name);
+                goto fail;
+            } 
+            if (SDsetdimscale (dim_id,n_values,DFNT_INT16,(VOIDP)data_X)==FAIL){
+                printf( "Failed to set dims for SDS <%s>\n", sds_name);
+                goto fail;
+            } 
+            if (SDsetattr (dim_id, "info", DFNT_CHAR8, 5,"feet")==FAIL){
+                printf( "Failed to set dims for SDS <%s>\n", sds_name);
+                goto fail;
+            } 
+            break;
+        default: 
+            break;
+        }
+    }
+    
+    /* obtain the reference number of the SDS using its identifier */
+    sds_ref = SDidtoref (sds_id);
+    
+    /* add the SDS to the vgroup. the tag DFTAG_NDG is used */
+    if (vgroup_id)
+    {
+        if (Vaddtagref (vgroup_id, TAG_GRP_DSET, sds_ref)==FAIL)
+        {
+            printf( "Failed to add ref for SDS <%s>\n", sds_name);
+            goto fail;
+        } 
+    }
+    
+    /* add an annotation and label to the object */
+    add_an(file_id, TAG_GRP_DSET, sds_ref);
+    
+    /* terminate access to the SDS */
+    if (SDendaccess (sds_id)==FAIL){
+        printf( "Failed to end SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    return SUCCEED;
+        
+fail:
+    SDendaccess (sds_id);
+    return FAIL;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_sd3d
+ *
+ * Purpose: utility function to write with
+ *  SD - Multifile Scientific Data Interface,
+ *  optionally :
+ *   1)inserting the SD into the group VGROUP_ID
+ *   2)making the dataset chunked and/or compressed
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int add_sd3d(const char *fname,       /* file name */
+              int32 file_id,           /* file ID */
+              int32  sd_id,            /* SD interface identifier */
+              const char* sds_name,    /* sds name */
+              int32 vgroup_id,         /* group ID */
+              int32 chunk_flags,       /* chunk flags */
+              comp_coder_t comp_type,  /* compression flag */
+              comp_info *comp_info     /* compression structure */ )
+
+{
+    int32  sds_id,       /* data set identifier */
+           sds_ref,      /* reference number of the data set */
+           dim_sds[3],   /* dimension of the data set */
+           rank = 3,     /* rank of the data set array */
+           start[3],     /* write start */
+           fill_value=2, /* fill value */
+           data[Z_DIM][Y_DIM][X_DIM];
+    int    i, j, k;
+    HDF_CHUNK_DEF chunk_def;           /* Chunking definitions */ 
+    
+    
+    /* Define chunk's dimensions */
+    chunk_def.chunk_lengths[0] = Z_DIM/2;
+    chunk_def.chunk_lengths[1] = Y_DIM/2;
+    chunk_def.chunk_lengths[2] = X_DIM/2;
+    /* To use chunking with RLE, Skipping Huffman, and GZIP compression */
+    chunk_def.comp.chunk_lengths[0] = Y_DIM/2;
+    chunk_def.comp.chunk_lengths[1] = Y_DIM/2;
+    chunk_def.comp.chunk_lengths[2] = X_DIM/2;
+    
+    /* GZIP compression, set compression type, flag and deflate level*/
+    chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+    chunk_def.comp.cinfo.deflate.level = 6;             
+    
+    /* data set data initialization */
+    for (k = 0; k < Z_DIM; k++){
+        for (j = 0; j < Y_DIM; j++) 
+            for (i = 0; i < X_DIM; i++)
+                data[k][j][i] = (i + j) + 1;
+    }
+    
+    /* set the size of the SDS's dimension */
+    dim_sds[0] = Z_DIM;
+    dim_sds[1] = Y_DIM;
+    dim_sds[2] = X_DIM;
+    
+    /* create the SDS */
+    if ((sds_id = SDcreate (sd_id, sds_name, DFNT_INT32, rank, dim_sds))<0)
+    {
+        printf( "Could not create SDS <%s>\n",sds_name);
+        return FAIL;
+    }
+    
+    /* set chunk */
+    if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+    {
+        if (SDsetchunk (sds_id, chunk_def, chunk_flags)==FAIL){
+            printf( "Failed to set chunk for SDS <%s>\n", sds_name);
+            goto fail;
+        } 
+    }
+    
+    /* use compress without chunk-in */
+    else if ( (chunk_flags==HDF_NONE) && comp_type>COMP_CODE_NONE && comp_type<COMP_CODE_INVALID)
+    {
+        if (SDsetcompress (sds_id, comp_type, comp_info)==FAIL){
+            printf( "Failed to set compress for SDS <%s>\n", sds_name);
+            goto fail;
+        }  
+    }
+    
+    /* set a fill value */
+    if (SDsetfillvalue (sds_id, (VOIDP)&fill_value)==FAIL)
+    {
+        printf( "Failed to set fill for SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    /* define the location and size of the data to be written to the data set */
+    start[0] = 0;
+    start[1] = 0;
+    start[2] = 0;
+    
+    /* write the stored data to the data set */
+    if (SDwritedata (sds_id, start, NULL, dim_sds, (VOIDP)data)==FAIL)
+    {
+        printf( "Failed to write SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    /* obtain the reference number of the SDS using its identifier */
+    sds_ref = SDidtoref (sds_id);
+    
+    /* add the SDS to the vgroup. the tag DFTAG_NDG is used */
+    if (vgroup_id)
+    {
+        if (Vaddtagref (vgroup_id, TAG_GRP_DSET, sds_ref)==FAIL)
+        {
+            printf( "Failed to set ref for SDS <%s>\n", sds_name);
+            goto fail;
+        } 
+    }
+    
+    /* add an annotation and label to the object */
+    add_an(file_id, TAG_GRP_DSET, sds_ref);
+    
+    /* terminate access to the SDS */
+    if (SDendaccess (sds_id)==FAIL)
+    {
+        printf( "Failed to end SDS <%s>\n", sds_name);
+        goto fail;
+    } 
+    
+    return SUCCEED;
+    
+fail:
+    SDendaccess (sds_id);
+    return FAIL;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_empty_sd
+ *
+ * Purpose: utility function to write an empty sds
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int add_empty_sd(int32 sd_id,             /* SD id */
+                 const char* sds_name     /* sds name */
+                )
+
+{
+    int32  sds_id,       /* data set identifier */
+           dim_sds[2],   /* dimension of the data set */
+           rank = 2;     /* rank of the data set array */
+    
+    /* set the size of the SDS's dimension */
+    dim_sds[0] = Y_DIM;
+    dim_sds[1] = X_DIM;
+    
+    /* create the SDS */
+    if ((sds_id = SDcreate (sd_id, sds_name, DFNT_INT32, rank, dim_sds))<0)
+    {
+        printf( "Could not create SDS <%s>\n",sds_name);
+        return FAIL;
+    }
+    
+    /* terminate access to the SDS */
+    if (SDendaccess (sds_id)==FAIL)
+    {
+        printf( "Failed to end SDS <%s>\n", sds_name);
+        return FAIL;
+    } 
+    
+    return SUCCEED;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: add_unl_sd
+ *
+ * Purpose: utility function to create a sds with unlimited dimension
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int add_unl_sd(int32 sd_id,             /* SD id */
+               const char* sds_name,    /* sds name */
+               int do_write
+                )
+
+{
+    int32  sds_id,       /* data set identifier */
+           dim_sds[2],   /* dimension of the data set */
+           rank = 2;     /* rank of the data set array */
+    
+    /* set the size of the SDS's dimension */
+    dim_sds[0] = SD_UNLIMITED;
+    dim_sds[1] = X_DIM;
+    
+    /* create the SDS */
+    if ((sds_id = SDcreate (sd_id, sds_name, DFNT_INT32, rank, dim_sds))<0)
+    {
+        printf( "Could not create SDS <%s>\n",sds_name);
+        return FAIL;
+    }
+
+    if ( do_write )
+    {
+        
+        int32 start[2],     /* write start */
+            edges[2],       /* write edges */
+            buf[Y_DIM][X_DIM];
+        int i, j;
+        
+        /* data set data initialization */
+        for (j = 0; j < Y_DIM; j++) 
+        {
+            for (i = 0; i < X_DIM; i++)
+            {
+                buf[j][i] = (i + j) + 1;
+            }
+        }
+        /* define the location and size of the data to be written to the data set */
+        start[0] = 0;
+        start[1] = 0;
+        edges[0] = Y_DIM;
+        edges[1] = X_DIM;
+        
+        /* write the stored data to the data set */
+        if (SDwritedata (sds_id, start, NULL, edges, (VOIDP)buf)==FAIL)
+        {
+            printf( "Failed to set write for SDS <%s>\n", sds_name);
+            goto fail;
+        } 
+        
+    }
+    
+    /* terminate access to the SDS */
+    if (SDendaccess (sds_id)==FAIL)
+    {
+        printf( "Failed to end SDS <%s>\n", sds_name);
+        return FAIL;
+    } 
+    
+    return SUCCEED;
+
+fail:
+
+    SDendaccess (sds_id);
+    return FAIL;
+    
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_vs
+ *
+ * Purpose: utility function to write with
+ *  VS - Vdata Interface,
+ *  optionally inserting the VS into the group VGROUP_ID
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int add_vs(const char* vs_name,
+            int32 file_id,
+            int32 vgroup_id)
+{
+    int32   vdata_ref,      /* reference number of the vdata */
+            vdata_tag,      /* tag number of the vdata */
+            vdata_id;       /* vdata id */
+    int32   attr_n_values   = 3; /* number of values in the vdata attribute */
+    int32   field_n_values  = 4; /* number of values in the field attribute */
+    char    vd_attr[3]      = {'A', 'B', 'C'};/* vdata attribute values*/
+    int32   fld_attr[4]     = {2, 4, 6, 8};   /* field attribute values*/
+    float32 data_buf[N_RECORDS][N_VALS_PER_REC]; /* buffer for vdata values */
+    int     i;
+    
+    /* Initialize the VS interface */
+    Vstart (file_id);
+    
+    /* Create a new vdata, set to -1 to create  */
+    vdata_ref = -1,    
+    vdata_id = VSattach (file_id, vdata_ref, "w");
+    
+    /* Set name and class name of the vdata */
+    if (VSsetname (vdata_id, vs_name)==FAIL){
+        printf( "Could not set name for VS\n");
+        return FAIL;
+    }
+    if (VSsetclass (vdata_id, CLASS_NAME)==FAIL){
+        printf( "Could not set class for VS\n");
+        return FAIL;
+    }
+    
+    /* Introduce each field's name, data type, and order */
+    VSfdefine (vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER_1 );
+    VSfdefine (vdata_id, FIELD2_NAME, DFNT_FLOAT32, ORDER_2 );
+    VSfdefine (vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER_3 );
+    
+    /* Finalize the definition of the fields */
+    if (VSsetfields (vdata_id, FIELDNAME_LIST)==FAIL){
+        printf( "Could not set fields for VS\n");
+        return FAIL;
+    }
+    
+    /* 
+    * Buffer the data by the record for fully interlaced mode.  Note that the
+    * first three elements contain the three values of the first field, the
+    * fourth element contains the value of the second field, and the last two
+    * elements contain the two values of the third field.
+    */
+    for (i = 0; i < N_RECORDS; i++)
+    {
+        data_buf[i][0] = (float32)1.0 * i;
+        data_buf[i][1] = (float32)2.0 * i;
+        data_buf[i][2] = (float32)3.0 * i;
+        data_buf[i][3] = (float32)0.1 + i;
+        data_buf[i][4] = 0.0;
+        data_buf[i][5] = 65.0;
+    }
+    
+    /* Write the data from data_buf to the vdata with full interlacing mode */
+    if (VSwrite (vdata_id, (uint8 *)data_buf, N_RECORDS,FULL_INTERLACE)==FAIL){
+        printf( "Could not write VS\n");
+        return FAIL;
+    }
+    
+    /* Attach an attribute to the vdata, i.e., indicated by the second parameter */
+    if (VSsetattr (vdata_id,_HDF_VDATA,"Myattr",DFNT_CHAR,
+        attr_n_values, vd_attr)==FAIL){
+        printf( "Could not set attr for VS\n");
+        return FAIL;
+    }
+    
+    /* Attach an attribute to the field 0 */
+    if (VSsetattr (vdata_id, 0, "Myfattr", DFNT_INT32, 
+        field_n_values, fld_attr)==FAIL){
+        printf( "Could not set attr for VS\n");
+        return FAIL;
+    }
+    
+    /* Obtain the tag and ref number of the vdata */
+    vdata_tag = VSQuerytag (vdata_id);
+    vdata_ref = VSQueryref (vdata_id);
+    
+    /* add the VS to the vgroup*/
+    if (vgroup_id)
+    {
+        if (Vaddtagref (vgroup_id, vdata_tag, vdata_ref)==FAIL){
+            printf( "Could not set group for VS\n");
+            return FAIL;
+        }
+    }
+    
+    /* terminate access to the VSs */
+    if (VSdetach (vdata_id)==FAIL){
+        printf( "Could not detach VS\n");
+        return FAIL;
+    }
+    
+    /* Terminate access to the VS interface */
+    if (Vend (file_id)==FAIL){
+        printf( "Could not end VS\n");
+        return FAIL;
+    }
+    
+    /* add an annotation and label to the vdata */
+    if (add_an(file_id, vdata_tag, vdata_ref)<0)
+        return FAIL;
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_file_an
+ *
+ * Purpose: utility function to write a file AN
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: July 30, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int add_file_an(int32 file_id)
+{
+    int32 an_id,        /* AN interface identifier */
+          file_label_id,/* file label identifier */
+          file_desc_id, /* file description identifier */
+          data_label_id,  /* data label identifier */
+          data_desc_id,   /* data description identifier */
+          vgroup_id;
+    uint16 vgroup_tag, vgroup_ref;
+    
+    /* Initialize the AN interface */
+    an_id = ANstart (file_id);
+    
+   /*-------------------------------------------------------------------------
+    * file labels and annotations
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* Create the file label */
+    file_label_id = ANcreatef (an_id, AN_FILE_LABEL);
+    
+    /* Write the annotations to the file label */
+    if (ANwriteann (file_label_id,FILE_LABEL_TXT,strlen (FILE_LABEL_TXT))==FAIL)
+    {
+        printf( "Could not write AN\n");
+        return FAIL;
+    }
+    
+    /* Create file description */
+    file_desc_id = ANcreatef (an_id, AN_FILE_DESC);
+    
+    /* Write the annotation to the file description */
+    if (ANwriteann (file_desc_id, FILE_DESC_TXT, strlen (FILE_DESC_TXT))==FAIL)
+    {
+        printf( "Could not write AN\n");
+        return FAIL;
+    }
+    
+   /*-------------------------------------------------------------------------
+    * data labels and annotations
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* Create a vgroup in the V interface*/
+    Vstart (file_id);
+    vgroup_id = Vattach (file_id, -1, "w");
+    if (Vsetname (vgroup_id, "an_group")==FAIL)
+    {
+        printf( "Could not set name for VG\n");
+        return FAIL;
+    }
+    
+    /* Obtain the tag and ref number of the vgroup */
+    vgroup_tag = (uint16) VQuerytag (vgroup_id);
+    vgroup_ref = (uint16) VQueryref (vgroup_id);
+    
+    /* Create the data label for the vgroup identified by its tag and ref number */
+    data_label_id = ANcreate (an_id, vgroup_tag, vgroup_ref, AN_DATA_LABEL);
+    
+    /* Write the annotation text to the data label */
+    if (ANwriteann (data_label_id, DATA_LABEL_TXT, strlen (DATA_LABEL_TXT))==FAIL)
+    {
+        printf( "Could not write AN\n");
+        return FAIL;
+    }
+    
+    /* Create the data description for the vgroup identified by its tag and ref number */
+    data_desc_id = ANcreate (an_id, (uint16)vgroup_tag, (uint16)vgroup_ref, AN_DATA_DESC);
+    
+    /* Write the annotation text to the data description */
+    if (ANwriteann (data_desc_id, DATA_DESC_TXT, strlen (DATA_DESC_TXT))==FAIL)
+    {
+        printf( "Could not write AN\n");
+        return FAIL;
+    }
+    
+    /* Teminate access to the vgroup and to the V interface */
+    if (Vdetach (vgroup_id)==FAIL)
+    {
+        printf( "Could not detach VG\n");
+        return FAIL;
+    }
+    if (Vend (file_id)==FAIL){
+        printf( "Could not end VG\n");
+        return FAIL;
+    }
+    
+    /* Terminate access to each annotation explicitly */
+    if (ANendaccess (file_label_id)==FAIL||
+        ANendaccess (file_desc_id)==FAIL||
+        ANendaccess (data_label_id)==FAIL||
+        ANendaccess (data_desc_id)==FAIL){
+        printf( "Could not end AN\n");
+        return FAIL;
+    }
+    
+    /* Terminate access to the AN interface */
+    if (ANend (an_id)==FAIL==FAIL){
+        printf( "Could not end AN\n");
+        return FAIL;
+    }
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_pal
+ *
+ * Purpose: utility function to write a palette
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 19, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int add_pal(const char* fname)
+{
+    uint8  pal[256*3];
+    int i, n;
+
+   /*-------------------------------------------------------------------------
+    * define a palette, blue to red tones 
+    *-------------------------------------------------------------------------
+    */
+    for ( i=0, n=0; i< 256*3; i+=3, n++)
+    {
+        pal[i]  =n;      /* red */
+        pal[i+1]=0;      /* green */
+        pal[i+2]=255-n;  /* blue */
+    }
+    
+    if (DFPaddpal(fname,pal)==FAIL){
+        printf( "Failed to write palette in <%s>\n", fname);
+        return FAIL;
+    }
+    
+    return SUCCEED;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: add_sd_szip
+ *
+ * Purpose: utility function to write with SZIPed SDSs
+ *  SD - Multifile Scientific Data Interface,
+ *
+ * Return: SUCCEED, FAIL
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: September 15, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static
+int add_sd_szip(const char *fname,       /* file name */
+                 int32 file_id,           /* file ID */
+                 int32 sd_id,             /* SD interface identifier */
+                 const char* sds_name,    /* sds name */
+                 int32 vgroup_id,         /* group ID */
+                 int32 chunk_flags,       /* chunk flags */
+                 int32 nt,                /* number type */
+                 int32 bits_per_pixel,    /* szip parameter */
+                 int32 *dim,              /* dimension of the data set */
+                 void *data
+                 )
+
+{
+    int32          sds_id,            /* data set identifier */
+                   sds_ref,           /* reference number of the data set */
+                   rank = 2;          /* rank of the data set array */
+    comp_coder_t   comp_type  = COMP_CODE_NONE;    /* compression flag */
+    comp_info      comp_info;         /* compression structure */
+    HDF_CHUNK_DEF  chunk_def;         /* chunking definitions */ 
+    int32          edges[2],          /* write edges */
+                   start[2]={0,0};    /* write start */
+
+    edges[0]=dim[0]; 
+    edges[1]=dim[1];
+    
+#ifdef H4_HAVE_LIBSZ
+    if (SZ_encoder_enabled()) {
+        comp_type = COMP_CODE_SZIP;
+        comp_info.szip.pixels_per_block = 2;
+        comp_info.szip.options_mask = SZ_EC_OPTION_MASK;
+        comp_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+        comp_info.szip.pixels = 0;
+        comp_info.szip.pixels_per_scanline = 0;
+        comp_info.szip.bits_per_pixel = 0;
+    } else {
+        printf("Warning: SZIP encoding not available\n");
+    }
+#else
+    printf("Warning: SZIP compression not available\n");
+#endif
+    
+    /* create the SDS */
+    sds_id = SDcreate (sd_id, sds_name, nt, rank, dim);
+    if (sds_id < 0) {
+        printf( "SDcreate failed for file <%s>\n",sds_name);
+        return FAIL;
+    }
+    
+    /* set chunk */
+    if ( (chunk_flags == HDF_CHUNK) || (chunk_flags == (HDF_CHUNK | HDF_COMP)) )
+    {
+        set_chunk_def(comp_type, 
+            dim,
+            1,
+            bits_per_pixel,
+            &chunk_def);
+        if (SDsetchunk (sds_id, chunk_def, chunk_flags)==FAIL) {
+            printf( "Failed to set chunk for SDS <%s>\n",sds_name);
+            goto fail;
+        }
+    }
+    
+    /* use compress without chunk-in */
+    else if ( chunk_flags==HDF_NONE && 
+        comp_type>COMP_CODE_NONE && comp_type<COMP_CODE_INVALID)
+    {
+        if (SDsetcompress (sds_id, comp_type, &comp_info)==FAIL) {
+            printf( "Failed to set compress for SDS <%s>\n",sds_name);
+            goto fail;
+        } 
+    }
+    
+    /* write the stored data to the data set */
+    if (SDwritedata (sds_id, start, NULL, edges, (VOIDP)data)==FAIL) {
+        printf( "Failed to writer SDS <%s>\n",sds_name);
+        goto fail;
+    }
+    
+    /* obtain the reference number of the SDS using its identifier */
+    sds_ref = SDidtoref (sds_id);
+    
+    /* add the SDS to the vgroup. the tag DFTAG_NDG is used */
+    if (vgroup_id) 
+    {
+        if (Vaddtagref (vgroup_id, TAG_GRP_DSET, sds_ref)==FAIL) {
+            printf( "Failed to set ref for SDS <%s>\n",sds_name);
+            goto fail;
+        }
+    }
+    
+    /* terminate access to the SDS */
+    if (SDendaccess (sds_id)==FAIL) {
+        printf( "Failed to end SDS <%s>\n",sds_name);
+        goto fail;
+    }
+    
+    return SUCCEED;
+    
+fail:
+    SDendaccess (sds_id);
+    return FAIL;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: do_file_all
+ *
+ * Purpose: writes all types of HDF objects 
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+int do_file_all(char* fname)
+{
+    int32         vgroup1_id,   /* vgroup identifier */
+                  vgroup2_id,   /* vgroup identifier */
+                  vgroup3_id,   /* vgroup identifier */
+                  vgroup_img_id,/* vgroup identifier */
+                  file_id,      /* HDF file identifier, same for V interface */
+                  gr_id,        /* GR interface identifier */
+                  sd_id;        /* SD interface identifier */
+    int32         attr_n_values = 3;  /* number of values in the vg attribute */
+    char          vg_attr[3]    = {'A', 'B', 'C'};/* vg attribute values*/
+    comp_coder_t  comp_type;    /* to retrieve compression type into */
+    int32         chunk_flags;  /* Chunking flag */ 
+    comp_info     comp_info;    /* compression structure */ 
+
+   /*-------------------------------------------------------------------------
+    * create a file with SDSs, images , groups and vdatas
+    *-------------------------------------------------------------------------
+    */
+
+    /* create a HDF file */
+    if ((file_id = Hopen (fname, DFACC_CREATE, (int16)0))<0)
+    {
+        printf("Error: Could not create file <%s>\n",fname);
+        return FAIL;
+    }
+    
+    /* initialize the SD interface */
+    if ((sd_id = SDstart (fname, DFACC_RDWR))== FAIL)
+    {
+        printf("Error: Could not start SD interface\n");
+        return FAIL;
+    }
+    
+    /* initialize the GR interface */
+    if ((gr_id = GRstart (file_id))== FAIL)
+    {
+        printf("Error: Could not start GR interface\n");
+        return FAIL;
+    }
+    
+    /* initialize the V interface */
+    if (Vstart (file_id)==FAIL)
+    {
+        printf( "Could not start VG\n");
+        return FAIL;
+    }
+    
+    
+   /*-------------------------------------------------------------------------
+    * create groups
+    *-------------------------------------------------------------------------
+    */ 
+
+    
+    vgroup1_id = Vattach (file_id, -1, "w");
+    if (Vsetname (vgroup1_id, "g1")==FAIL)
+    {
+        printf( "Could not name group\n");
+        goto out;
+    }
+    
+    /* attach an attribute to the vgroup */
+    if (Vsetattr (vgroup1_id,"Myattr",DFNT_CHAR,attr_n_values,vg_attr)==FAIL)
+    {
+        printf( "Could set group attributes\n");
+        goto out;
+    }
+    
+    /* create the second vgroup */
+    vgroup2_id = Vattach (file_id, -1, "w");
+    if (Vsetname (vgroup2_id, "g2")==FAIL)
+    {
+        printf( "Could not name group\n");
+        goto out;
+    }
+    
+    /* create the 3rd vgroup */
+    vgroup3_id = Vattach (file_id, -1, "w");
+    if (Vsetname (vgroup3_id, "g3")==FAIL)
+    {
+        printf( "Could not name group\n");
+        goto out;
+    }
+    
+    /* insert the second vgroup into the first vgroup using its identifier */
+    if (Vinsert (vgroup1_id, vgroup2_id)==FAIL)
+    {
+        printf( "Could not insert VG\n");
+        goto out;
+    }
+    
+    /* insert the 3rd vgroup into the 2nd vgroup using its identifier */
+    if (Vinsert (vgroup2_id, vgroup3_id)==FAIL)
+    {
+        printf( "Could not insert VG\n");
+        goto out;
+    }
+    
+    /* create the 4th vgroup, for images */
+    vgroup_img_id = Vattach (file_id, -1, "w");
+    if (Vsetname (vgroup_img_id, "images")==FAIL)
+    {
+        printf( "Could not name group\n");
+        goto out;
+    }
+
+    
+    
+   /*-------------------------------------------------------------------------
+    * add some SDSs to the file
+    * duplicates are inserted in the groups "g1", "g2", "g3" and root
+    *-------------------------------------------------------------------------
+    */ 
+
+   
+    /* add non chunked, non compressed sds */
+    chunk_flags = HDF_NONE;
+    comp_type   = COMP_CODE_NONE;
+    if (add_sd(fname,file_id,sd_id,"dset1",vgroup1_id,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    if (add_sd(fname,file_id,sd_id,"dset2",vgroup2_id,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    if (add_sd(fname,file_id,sd_id,"dset3",vgroup3_id,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    if (add_sd(fname,file_id,sd_id,"dset4",0,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    if (add_sd(fname,file_id,sd_id,"dset5",0,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    if (add_sd(fname,file_id,sd_id,"dset6",0,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    if (add_sd3d(fname,file_id,sd_id,"dset7",0,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    
+    
+   /*-------------------------------------------------------------------------
+    * add some chunked/compressd SDS to the file
+    * Chunked                  -> flags = HDF_CHUNK
+    * Chunked and compressed   -> flags = HDF_CHUNK | HDF_COMP 
+    * Non-chunked              -> flags = HDF_NONE
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* add a chunked, non compressed sds */
+    chunk_flags = HDF_CHUNK;
+    comp_type   = COMP_CODE_NONE;
+    if (add_sd(fname,file_id,sd_id,"dset_chunk",0,chunk_flags,comp_type,NULL)<0)
+        goto out;
+    
+    /* add a chunked-compressed sds with SDsetchunk */
+    chunk_flags = HDF_CHUNK | HDF_COMP;
+    comp_type   = COMP_CODE_DEFLATE;
+    if (add_sd(fname,file_id,sd_id,"dset_chunk_comp",0,chunk_flags,comp_type,&comp_info)<0)
+        goto out;
+    
+   /*-------------------------------------------------------------------------
+    * GZIP
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* add some non chunked, compressed sds */
+    chunk_flags = HDF_NONE;
+    comp_type   = COMP_CODE_DEFLATE;
+    if (add_sd(fname,file_id,sd_id,"dset_gzip",0,chunk_flags,comp_type,&comp_info)<0)
+        goto out;
+    
+   /*-------------------------------------------------------------------------
+    * add an empty sds
+    *-------------------------------------------------------------------------
+    */ 
+    if (add_empty_sd(sd_id,"dset_empty")<0)
+        goto out;
+
+    /*-------------------------------------------------------------------------
+    * add 2 SDSs with unlimited dimensions, one written
+    *-------------------------------------------------------------------------
+    */ 
+    if (add_unl_sd(sd_id,"dset_unl", 0)<0)
+        goto out;
+    if (add_unl_sd(sd_id,"dset_unlw", 1)<0)
+        goto out;
+    
+   /*-------------------------------------------------------------------------
+    * RLE
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* add some non chunked, compressed sds */
+    chunk_flags = HDF_NONE;
+    comp_type   = COMP_CODE_RLE;
+    if (add_sd(fname,file_id,sd_id,"dset_rle",0,chunk_flags,comp_type,&comp_info)<0)
+        goto out;
+    
+   /*-------------------------------------------------------------------------
+    * HUFF
+    *-------------------------------------------------------------------------
+    */ 
+    
+    /* add some non chunked, compressed sds */
+    chunk_flags = HDF_NONE;
+    comp_type   = COMP_CODE_SKPHUFF;
+    if (add_sd(fname,file_id,sd_id,"dset_huff",0,chunk_flags,comp_type,&comp_info)<0)
+        goto out;
+    
+#if defined (H4_HAVE_LIBSZ)
+   /*-------------------------------------------------------------------------
+    * SZIP
+    *-------------------------------------------------------------------------
+    */ 
+    if (SZ_encoder_enabled()) 
+    {
+        chunk_flags = HDF_NONE;
+        comp_type   = COMP_CODE_SZIP;
+        if (add_sd(fname,file_id,sd_id,"dset_szip",0,chunk_flags,comp_type,&comp_info)<0)
+            goto out;
+        
+        {
+            
+            int i, j;
+            {
+                int32 buf[YD1][XD1];
+                int32 dim[2]={YD1,XD1};
+                int32 bpp=32;
+                for (j = 0; j < YD1; j++) {
+                    for (i = 0; i < XD1; i++)
+                        buf[j][i] = (int32) (i + j) + 1;
+                }
+                if (add_sd_szip(fname,file_id,sd_id,"dset32szip",0,HDF_NONE,DFNT_INT32,bpp,dim,buf)<0)
+                    return FAIL;
+            }
+            
+        }
+    }
+    
+#endif
+    
+   /*-------------------------------------------------------------------------
+    * add some RIS24 images to the file
+    *-------------------------------------------------------------------------
+    */
+    /* Pixel Interlacing */
+    if (add_r24(DATA_FILE2,fname,file_id,DFIL_PIXEL,vgroup_img_id)<0)
+        goto out;
+    /* Scan Plane Interlacing */
+    if (add_r24(DATA_FILE3,fname,file_id,DFIL_PLANE,vgroup_img_id)<0)
+        goto out;  
+    
+    
+   /*-------------------------------------------------------------------------
+    * add some RIS8 images to the file
+    *-------------------------------------------------------------------------
+    */ 
+    if (add_r8(DATA_FILE1,fname,file_id,vgroup_img_id)<0)
+        goto out;
+    
+   /*-------------------------------------------------------------------------
+    * add some GR images to the file with compression/chunking
+    *-------------------------------------------------------------------------
+    */ 
+    
+   /*-------------------------------------------------------------------------
+    * no compression
+    *-------------------------------------------------------------------------
+    */ 
+    
+    chunk_flags = HDF_NONE;
+    comp_type   = COMP_CODE_NONE;
+    if (add_gr("gr_none",file_id,gr_id,0,chunk_flags,comp_type,&comp_info)<0)
+        goto out;
+    
+    
+   /*-------------------------------------------------------------------------
+    * GZIP
+    *-------------------------------------------------------------------------
+    */ 
+    
+    chunk_flags = HDF_NONE;
+    comp_type   = COMP_CODE_DEFLATE;
+    if (add_gr("gr_gzip",file_id,gr_id,0,chunk_flags,comp_type,&comp_info)<0)
+        goto out; 
+    
+#if defined (H4_GR_SZIP)
+   /* not supported for GR */
+   /*-------------------------------------------------------------------------
+    * SZIP
+    *-------------------------------------------------------------------------
+    */ 
+    
+#if defined (H4_HAVE_LIBSZ)
+    
+    if (SZ_encoder_enabled()) 
+    {
+        chunk_flags = HDF_NONE;
+        comp_type   = COMP_CODE_SZIP;
+        if (add_gr("gr_szip",file_id,gr_id,0,chunk_flags,comp_type,&comp_info)<0)
+            goto out; 
+    }
+    
+#endif
+#endif
+    
+   /*-------------------------------------------------------------------------
+    * add some GR realistic images to the file
+    * realistic data is read from ASCII files
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if (add_gr_ffile(DATA_FILE1,gr_id,"gr_8bit",0,file_id,0)<0)
+        goto out;  
+    if (add_gr_ffile(DATA_FILE2,gr_id,"gr_24bit",0,file_id,0)<0)
+        goto out;  
+    
+   /*-------------------------------------------------------------------------
+    * add some VS to the file
+    * duplicates are inserted in the groups "g1", "g2", "g3" and root
+    *-------------------------------------------------------------------------
+    */ 
+    
+    if (add_vs("vdata1",file_id,vgroup1_id)<0)
+        goto out; 
+    if (add_vs("vdata2",file_id,vgroup2_id)<0)
+        goto out; 
+    if (add_vs("vdata3",file_id,vgroup3_id)<0)
+        goto out;
+    if (add_vs("vdata4",file_id,0)<0)
+        goto out; 
+    
+   /*-------------------------------------------------------------------------
+    * add some global attributes to the file
+    *-------------------------------------------------------------------------
+    */ 
+    if (add_glb_attrs(fname,file_id,sd_id,gr_id)<0)
+        goto out;
+
+    
+   /*-------------------------------------------------------------------------
+    * add annotations to the file
+    *-------------------------------------------------------------------------
+    */ 
+    if (add_file_an(file_id)<0)
+        goto out; 
+    
+   /*-------------------------------------------------------------------------
+    * add a palette to the file
+    *-------------------------------------------------------------------------
+    */ 
+
+
+    if (add_pal(fname)<0)
+        goto out;
+   
+     
+   /*-------------------------------------------------------------------------
+    * close
+    *-------------------------------------------------------------------------
+    */
+    
+    /* terminate access to the vgroups */
+    if (Vdetach (vgroup1_id)==FAIL ||
+        Vdetach (vgroup2_id)==FAIL ||
+        Vdetach (vgroup3_id)==FAIL ||
+        Vdetach (vgroup_img_id)==FAIL)
+    {
+        printf( "Could not close group\n");
+        goto out;
+    }
+    
+    /* terminate access to the V interface */
+    if (Vend (file_id)==FAIL)
+    {
+        printf( "Could not end VG\n");
+        goto out;
+    }
+    
+    /* terminate access to the GR interface */
+    if (GRend (gr_id)==FAIL)
+    {
+        printf("Error: Could not close GR interface\n");
+        goto out;
+    }
+    /* terminate access to the SD interface */
+    if (SDend (sd_id)==FAIL)
+    {
+        printf("Error: Could not close SD interface\n");
+        goto out;
+    }
+    /* close the HDF file */
+    if (Hclose (file_id)==FAIL)
+    {
+        printf( "Could not close file\n");
+        return FAIL;
+    }
+
+
+    return SUCCEED;
+
+out:
+
+    /* close interfaces */
+    Vend (file_id);
+    GRend (gr_id);
+    SDend (sd_id);
+    Hclose (file_id);
+    return FAIL;
+ }
+
+/*-------------------------------------------------------------------------
+ * write a big file for hyperslab reading
+ *-------------------------------------------------------------------------
+ */
+
+static 
+int do_file_hyperslab(char* fname) 
+{
+
+    int32 sd_id;         /* SD interface identifier */
+    int32 sds_id;        /* SDS identifier */
+    int32 dims[2];       /* sizes of the SDS dimensions */
+    int32 start[2];      /* start location to write */
+    int32 edges[2];      /* number of elements to write */
+
+    int32 sds_idx;
+    int32 rank;
+	uint8 array_data[DIM0][DIM1];
+    uint8 append_data[DIM1];
+	intn  i, j, n;
+
+	/* Create a file and initiate the SD interface. */
+    if ((sd_id = SDstart(fname, DFACC_CREATE))==FAIL) 
+        goto error;
+  
+	/* Define the rank and dimensions of the data set to be created. */
+	rank = 2;
+	dims[0] = SD_UNLIMITED;
+	dims[1] = DIM1;
+
+	/* Create 2 data sets */
+	if ((sds_id = SDcreate(sd_id, "data1", DFNT_UINT8, rank, dims))==FAIL) 
+        goto error;
+  
+	/* initial values */
+    for (j = 0; j < DIM0; j++) 
+    {
+        for (i = 0; i < DIM1; i++)
+            array_data[j][i] = (i + j) + 1;
+    }
+
+	/* define the location, pattern, and size of the data set */
+    for (i = 0; i < rank; i++) 
+    {
+        start[i] = 0;
+    }
+	edges[0] = DIM0; /* 10 */
+	edges[1] = DIM1; /* 5 */
+
+    if ( SDwritedata(sds_id, start, NULL, edges, (VOIDP)array_data)==FAIL) 
+        goto error;
+
+	/* terminate access to the datasets and SD interface */
+    if ( SDendaccess(sds_id)==FAIL) 
+        goto error;
+    if ( SDend(sd_id)==FAIL) 
+        goto error;
+   
+    /* append data */
+	if (( sd_id = SDstart(fname, DFACC_WRITE))==FAIL) 
+        goto error;
+   	
+    if ((sds_idx = SDnametoindex (sd_id, "data1"))==FAIL) 
+        goto error;
+    if ((sds_id = SDselect (sd_id, sds_idx))==FAIL) 
+        goto error;
+  
+    /* store array values to be appended */
+    for (i = 0; i < DIM1; i++)
+        append_data[i] = i + 1;
+    
+   	/* define the location of the append */
+    for (n = 0; n < ADD_ROWS; n++)
+    {
+        start[0] = DIM0 + n;   /* 10 */
+        start[1] = 0;
+        edges[0] = 1;          /* 1 row at a time */
+        edges[1] = DIM1;       /* 5 elements */
+        
+        /* append data to file */
+        if ( SDwritedata (sds_id, start, NULL, edges, (VOIDP) append_data)==FAIL) 
+            goto error;
+
+    }
+
+    
+    /* terminate access */
+    if ( SDendaccess (sds_id)==FAIL) 
+        goto error;
+    if ( SDend (sd_id)==FAIL) 
+        goto error;
+  
+    return SUCCEED;
+    
+error:
+    
+    printf("Error...Exiting...\n");
+    
+    return FAIL;
+
+
+}
+
+/*-------------------------------------------------------------------------
+ * write groups
+ * a circular reference
+ *
+ *                g0 ----->   g1
+ *                 |       |    ^
+ *                 |       |    |
+ *                 |       \/   |
+ *                 |----->   g1.1
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static 
+int do_file_groups(char* name) 
+{
+     
+     int32 vg0_id,    /* vgroup identifier */
+           vg1_id,    /* vgroup identifier */
+           vg2_id,    /* vgroup identifier */
+           file1_id;  /* HDF file identifier */
+     
+     /* create a HDF file */
+     if ((file1_id = Hopen (name, DFACC_CREATE, (int16)0))<0)
+     {
+         printf("Error: Could not create file <%s>\n",name);
+         return FAIL;
+     }
+     
+     /* initialize the V interface */
+     if (Vstart (file1_id)==FAIL)
+     {
+         printf( "Could not start VG\n");
+         return FAIL;
+     }
+     
+     /* create a vgroup */
+     vg0_id = Vattach (file1_id, -1, "w");
+     if (Vsetname (vg0_id, "g0")==FAIL)
+     {
+         printf( "Could not name group\n");
+         goto out;
+     }
+     
+     /* create the second vgroup */
+     vg1_id = Vattach (file1_id, -1, "w");
+     if (Vsetname (vg1_id, "g1")==FAIL)
+     {
+         printf( "Could not name group\n");
+         goto out;
+     }
+     
+     /* create the third vgroup */
+     vg2_id = Vattach (file1_id, -1, "w");
+     if (Vsetname (vg2_id, "g1.1")==FAIL)
+     {
+         printf( "Could not name group\n");
+         goto out;
+     }
+  
+     if (Vinsert (vg0_id, vg1_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     if (Vinsert (vg0_id, vg2_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     if (Vinsert (vg1_id, vg2_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     if (Vinsert (vg2_id, vg1_id)==FAIL)
+     {
+         printf( "Could not insert VG\n");
+         goto out;
+     }
+     
+     /* terminate access to the vgroup */
+     if (Vdetach (vg0_id)==FAIL)
+     {
+         printf( "Could not close group\n");
+         goto out;
+     }
+     
+     /* terminate access to the vgroup */
+     if (Vdetach (vg1_id)==FAIL)
+     {
+         printf( "Could not close group\n");
+         goto out;
+     }
+     
+     /* terminate access to the vgroup */
+     if (Vdetach (vg2_id)==FAIL)
+     {
+         printf( "Could not close group\n");
+         goto out;
+     }
+     
+     /* terminate access to the V interface */
+     if (Vend (file1_id)==FAIL)
+     {
+         printf( "Could not end VG\n");
+         goto out;
+     }
+     
+     /* close the HDF file */
+     if (Hclose (file1_id)==FAIL)
+     {
+         printf( "Could not close file\n");
+         return FAIL;
+     }
+     
+     return SUCCEED;
+     
+out:
+     printf("Error...Exiting...\n");
+     return FAIL;
+     
+}
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_files
+ *
+ * Purpose: call hrepack and hdiff on the generated files
+ * 1) zip HREPACK_FILE1 with some compression/chunking options
+ * 2) use the hdiff utility to compare the input and output file; it returns RET==0
+ *    if the high-level objects have the same data
+ * 3) use the API functions SD(GR)getcompress, SD(GR)getchunk to verify
+ *    the compression/chunking input on the output file
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int test_files(void)
+{
+    options_t     options;      /* for hrepack  */ 
+    diff_opt_t    fspec;        /* for hdiff  */ 
+    int           verbose=0;
+    int32         in_chunk_lengths[H4_MAX_VAR_DIMS];
+    
+    /* initialize options for hdiff */
+    memset(&fspec,0,sizeof(diff_opt_t));
+    fspec.ga = 1;    /* compare global attributes */
+    fspec.sa = 1;    /* compare SD local attributes */
+    fspec.sd = 1;    /* compare SD data */
+    fspec.vd = 1;    /* compare Vdata */
+    fspec.gr = 1;    /* compare GR data */
+    
+    in_chunk_lengths[0]=10;
+    in_chunk_lengths[1]=8;
+    in_chunk_lengths[2]=6;
+    
+    
+   /*-------------------------------------------------------------------------
+    * test1:  
+    * HUFF
+    *-------------------------------------------------------------------------
+    */
+    
+    
+    TESTING("hrepack -t dset7:HUFF 1 -c dset7:10x8x6");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("dset7:HUFF 1",&options);
+    hrepack_addchunk("dset7:10x8x6",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp("dset7",COMP_CODE_SKPHUFF, 1) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset7",HDF_CHUNK|HDF_COMP,3,in_chunk_lengths) == -1) 
+        goto out;
+    PASSED();
+    
+    
+   /*-------------------------------------------------------------------------
+    * test2: 
+    * RLE
+    *-------------------------------------------------------------------------
+    */
+    TESTING("hrepack -t dset4:RLE -c dset4:10x8");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("dset4:RLE",&options);
+    hrepack_addchunk("dset4:10x8",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp("dset4",COMP_CODE_RLE, 0) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset4",HDF_CHUNK|HDF_COMP,2,in_chunk_lengths) == -1) 
+        goto out;
+    PASSED();
+    
+   /*-------------------------------------------------------------------------
+    * test3:  
+    * SDS SELECTED with GZIP, chunking SELECTED
+    *-------------------------------------------------------------------------
+    */
+    TESTING("hrepack -t dset4:GZIP 6 -c dset4:10x8");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("dset4:GZIP 6",&options);
+    hrepack_addchunk("dset4:10x8",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp("dset4",COMP_CODE_DEFLATE, 6) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset4",HDF_CHUNK|HDF_COMP,2,in_chunk_lengths) == -1) 
+        goto out;
+    PASSED();
+    
+    
+   /*-------------------------------------------------------------------------
+    * test4:  
+    * SDS SELECTED with SZIP, chunking SELECTED
+    *-------------------------------------------------------------------------
+    */
+    TESTING("hrepack -t dset4:SZIP 8,EC -c dset4:10x8");
+#if defined (H4_HAVE_LIBSZ)
+    if (SZ_encoder_enabled()) 
+    {
+        hrepack_init (&options,verbose);
+        hrepack_addcomp("dset4:SZIP 8,EC",&options);
+        hrepack_addchunk("dset4:10x8",&options);
+        if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+            goto out;
+        hrepack_end (&options);
+        PASSED();
+        
+        TESTING(HDIFF_TSTSTR);
+        if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+            goto out;
+        if ( sds_verifiy_comp("dset4",COMP_CODE_SZIP, 0) == -1) 
+            goto out;
+        if ( sds_verifiy_chunk("dset4",HDF_CHUNK|HDF_COMP,2,in_chunk_lengths) == -1) 
+            goto out;
+        PASSED();
+    } else 
+    {
+        /* no szip encoder */
+        SKIPPED();
+    }
+    
+#else
+    /* no szip at all */
+    SKIPPED();
+#endif
+    
+   /*-------------------------------------------------------------------------
+    * test4:  
+    * SDS SELECTED with NONE, chunking SELECTED NONE
+    *-------------------------------------------------------------------------
+    */
+    TESTING("hrepack -t dset_chunk:NONE -c dset_chunk:NONE");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("dset_chunk_comp:NONE",&options);
+    hrepack_addcomp("dset_chunk:NONE",&options);
+    hrepack_addchunk("dset_chunk_comp:NONE",&options);
+    hrepack_addchunk("dset_chunk:NONE",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp("dset_chunk_comp",COMP_CODE_NONE, 0) == -1) 
+        goto out;
+    if ( sds_verifiy_comp("dset_chunk",COMP_CODE_NONE, 0) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset_chunk_comp",HDF_NONE,0,0) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset_chunk",HDF_NONE,0,0) == -1) 
+        goto out;
+    PASSED();
+    
+    
+   /*-------------------------------------------------------------------------
+    * test5:
+    * SDS SELECTED with all types, chunking SELECTED
+    *-------------------------------------------------------------------------
+    */
+    TESTING("hrepack -t dset4:GZIP 9 -t dset5:RLE -c dset4:10x8");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("dset4:GZIP 9",&options);
+    hrepack_addcomp("dset5:RLE",&options);
+    hrepack_addcomp("dset6:HUFF 2",&options);
+#if defined (H4_HAVE_LIBSZ)
+    if (SZ_encoder_enabled()) {
+        hrepack_addcomp("dset7:SZIP 8,EC",&options);
+    }
+#endif
+    hrepack_addchunk("dset4:10x8",&options);
+    hrepack_addchunk("dset5:10x8",&options);
+    hrepack_addchunk("dset6:10x8",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp("dset4",COMP_CODE_DEFLATE, 9) == -1) 
+        goto out;
+    if ( sds_verifiy_comp("dset5",COMP_CODE_RLE, 0) == -1) 
+        goto out;
+    if ( sds_verifiy_comp("dset6",COMP_CODE_SKPHUFF, 2) == -1) 
+        goto out;
+#if defined (H4_HAVE_LIBSZ)
+    if (SZ_encoder_enabled()) {
+        if ( sds_verifiy_comp("dset7",COMP_CODE_SZIP, 0) == -1) 
+            goto out;
+    }
+#endif
+    if ( sds_verifiy_chunk("dset4",HDF_CHUNK|HDF_COMP,2,in_chunk_lengths) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset5",HDF_CHUNK|HDF_COMP,2,in_chunk_lengths) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset6",HDF_CHUNK|HDF_COMP,2,in_chunk_lengths) == -1) 
+        goto out;
+    PASSED();
+    
+    
+   /*-------------------------------------------------------------------------
+    * test6: 
+    * SDS SELECTED with all types, no chunking
+    *-------------------------------------------------------------------------
+    */
+    TESTING("hrepack -t dset4:GZIP 9 -t dset5:RLE -t dset6:HUFF 2");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("dset4:GZIP 9",&options);
+    hrepack_addcomp("dset5:RLE",&options);
+    hrepack_addcomp("dset6:HUFF 2",&options);
+#if defined (H4_HAVE_LIBSZ)
+    if (SZ_encoder_enabled()) {
+        hrepack_addcomp("dset7:SZIP 4,EC",&options);
+    }
+#endif
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp("dset4",COMP_CODE_DEFLATE, 9) == -1) 
+        goto out;
+    if ( sds_verifiy_comp("dset5",COMP_CODE_RLE, 0) == -1) 
+        goto out;
+    if ( sds_verifiy_comp("dset6",COMP_CODE_SKPHUFF, 2) == -1) 
+        goto out;
+#if defined (H4_HAVE_LIBSZ)
+    if (SZ_encoder_enabled()) {
+        if ( sds_verifiy_comp("dset7",COMP_CODE_SZIP, 0) == -1) 
+            goto out;
+    }
+#endif
+    PASSED();
+    
+    
+   /*-------------------------------------------------------------------------
+    * test7:  
+    * compressing SDS ALL, chunking SELECTED NONE
+    *-------------------------------------------------------------------------
+    */
+    
+    TESTING("hrepack -t *:GZIP 1 -c dset_chunk:NONE");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("*:GZIP 1",&options);
+    hrepack_addchunk("dset_chunk_comp:NONE",&options);
+    hrepack_addchunk("dset_chunk:NONE",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp_all(COMP_CODE_DEFLATE, 1) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset_chunk_comp",HDF_NONE,0,0) == -1) 
+        goto out;
+    if ( sds_verifiy_chunk("dset_chunk",HDF_NONE,0,0) == -1) 
+        goto out;
+    PASSED();
+    
+   /*-------------------------------------------------------------------------
+    * test8:
+    * no compressing, chunking ALL
+    *-------------------------------------------------------------------------
+    */
+    
+    TESTING("hrepack -c *:10x8");
+    hrepack_init (&options,verbose);
+    hrepack_addchunk("*:10x8",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_chunk_all(HDF_CHUNK,2,in_chunk_lengths,"dset7") == -1) 
+        goto out;
+    PASSED();
+    
+    
+   /*-------------------------------------------------------------------------
+    * test9: 
+    * compressing SDS ALL with GZIP
+    *-------------------------------------------------------------------------
+    */
+    
+    TESTING("hrepack -t *:GZIP 1");
+    hrepack_init (&options,verbose);
+    hrepack_addcomp("*:GZIP 1",&options);
+    if (hrepack_main(HREPACK_FILE1,HREPACK_FILE1_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR);
+    if (hdiff(HREPACK_FILE1,HREPACK_FILE1_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if ( sds_verifiy_comp_all(COMP_CODE_DEFLATE, 1) == -1) 
+        goto out;
+    PASSED();
+    
+    
+   /*-------------------------------------------------------------------------
+    * test10: 
+    * repack a big file using hyperslab reading/writing
+    *-------------------------------------------------------------------------
+    */
+    
+    TESTING("hyperslab repacking");
+    hrepack_init (&options,verbose);
+    if (hrepack_main(HREPACK_FILE2,HREPACK_FILE2_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR2);
+    if (hdiff(HREPACK_FILE2,HREPACK_FILE2_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    PASSED();
+
+   /*-------------------------------------------------------------------------
+    * test11: 
+    * repack a file with vgroups
+    *-------------------------------------------------------------------------
+    */
+    
+    TESTING("vgroups dependencies");
+    hrepack_init (&options,verbose);
+    if (hrepack_main(HREPACK_FILE3,HREPACK_FILE3_OUT,&options)<0)
+        goto out;
+    hrepack_end (&options);
+    PASSED();
+    
+    TESTING(HDIFF_TSTSTR3);
+    if (hdiff(HREPACK_FILE3,HREPACK_FILE3_OUT,&fspec) > 0 || fspec.err_stat)
+        goto out;
+    if (vg_verifygrpdep(HREPACK_FILE3,HREPACK_FILE3_OUT) != 0 )
+        goto out;
+    PASSED();
+
+   
+       
+    return SUCCEED;
+out:
+    H4_FAILED();
+    return FAIL;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: generate_files
+ *
+ * Purpose: writes several HDF objects to the files 
+ *  HREPACK_FILE1
+ *  HREPACK_FILE2
+ *  HREPACK_FILE3
+ *
+ * Return: SUCCEED, FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static
+int generate_files(void)
+{
+    TESTING("generating files");
+    
+    if (do_file_all(HREPACK_FILE1)<0)
+        return FAIL;
+    
+    if (do_file_hyperslab(HREPACK_FILE2)<0)
+        return FAIL;
+    
+    if (do_file_groups(HREPACK_FILE3)<0)
+        return FAIL;
+
+    PASSED();
+    
+    return SUCCEED;
+    
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: test program for hrepack
+ *
+ * A)This program writes several HDF objects to the file HREPACK_FILE1
+ *   The image data consists of realistic data read from the files DATA_FILE1
+ *   (8bit image) , DATA_FILE2 (24bit image, pixel interlace) and
+ *    DATA_FILE3 (24bit image, plane interlace)
+ *  The objects written are
+ *  1) groups
+ *  2) images 
+ *  3) datasets
+ *  4) vdatas with attributes and field attributes
+ *  5) global and local attributes
+ *  6) labels and annotations
+ *
+ * B) Then several calls are made to hrepack, in each call the HREPACK_FILE1_OUT is 
+ *  generated
+ *
+ * C) In each test the hdiff utility is called to compare the files 
+ *  HREPACK_FILE1 and HREPACK_FILE1_OUT
+ *
+ * D) In each test the verifiy_comp_chunk function is called to compare 
+ *  the input and output compression and chunking parameters
+ *
+ * Programmer: Pedro Vicente, pvn at ncsa.uiuc.edu
+ *
+ * Date: August 3, 2003
+ *
+ * Modifications: 
+ *  July 7, 2007. Add test for hyperslab repacking in HREPACK_FILE2
+ *  September 12, 2007. Add test for duplicate vgroup insertions in HREPACK_FILE3
+ *
+ *-------------------------------------------------------------------------
+ */
+
+
+int main(void)
+{
+
+    if ( generate_files() < 0 )
+        return 1;
+
+    if ( test_files() < 0 )
+        return 1;
+
+
+    return 0;
+
+}
diff --git a/mfhdf/hrepack/image24pixel.txt b/mfhdf/hrepack/image24pixel.txt
new file mode 100644
index 0000000..8af73f2
--- /dev/null
+++ b/mfhdf/hrepack/image24pixel.txt
@@ -0,0 +1,101475 @@
+components
+3
+height
+149
+width
+227
+48
+47
+45
+48
+47
+45
+49
+48
+46
+50
+49
+47
+53
+49
+46
+53
+49
+46
+54
+50
+47
+54
+50
+47
+56
+51
+47
+56
+51
+47
+58
+51
+45
+58
+51
+45
+58
+51
+45
+58
+51
+45
+58
+51
+45
+58
+51
+45
+58
+50
+47
+57
+49
+46
+57
+49
+46
+56
+48
+45
+56
+48
+45
+57
+49
+46
+57
+49
+46
+58
+50
+47
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+54
+46
+43
+54
+46
+43
+54
+46
+43
+53
+45
+42
+53
+45
+42
+52
+44
+41
+52
+44
+41
+52
+44
+41
+52
+44
+41
+52
+44
+41
+52
+44
+41
+52
+44
+41
+52
+44
+41
+52
+44
+41
+52
+44
+41
+50
+45
+41
+47
+42
+36
+47
+44
+37
+47
+44
+37
+48
+45
+38
+49
+46
+39
+50
+47
+40
+51
+48
+41
+51
+48
+41
+54
+51
+44
+54
+51
+44
+55
+52
+45
+56
+53
+46
+56
+53
+46
+57
+54
+47
+58
+55
+48
+58
+55
+46
+65
+58
+48
+66
+60
+48
+68
+62
+50
+70
+64
+52
+73
+65
+52
+74
+66
+53
+75
+67
+54
+75
+67
+54
+77
+68
+53
+77
+68
+53
+79
+67
+51
+78
+66
+50
+79
+67
+51
+79
+67
+51
+80
+68
+52
+82
+69
+53
+82
+63
+49
+89
+63
+50
+98
+64
+52
+110
+66
+53
+125
+69
+54
+139
+72
+56
+153
+71
+57
+163
+70
+55
+175
+71
+58
+184
+71
+57
+190
+69
+58
+197
+71
+59
+199
+71
+62
+202
+71
+63
+203
+72
+64
+208
+69
+64
+231
+70
+76
+237
+67
+76
+235
+68
+75
+235
+69
+73
+238
+67
+73
+239
+66
+68
+241
+62
+66
+244
+61
+65
+248
+59
+65
+247
+58
+64
+244
+58
+63
+240
+60
+63
+233
+63
+64
+226
+64
+62
+215
+63
+60
+203
+65
+55
+187
+61
+47
+181
+64
+46
+181
+64
+46
+180
+63
+45
+180
+63
+45
+179
+64
+45
+178
+63
+45
+175
+64
+45
+173
+64
+44
+170
+65
+44
+166
+65
+45
+162
+66
+44
+159
+64
+42
+155
+65
+41
+152
+64
+42
+150
+65
+44
+148
+62
+45
+146
+63
+47
+146
+63
+47
+145
+62
+46
+145
+62
+44
+144
+61
+43
+146
+60
+43
+146
+60
+43
+148
+63
+43
+148
+63
+43
+148
+61
+42
+148
+61
+42
+148
+61
+42
+149
+62
+43
+150
+63
+44
+150
+64
+47
+150
+63
+54
+149
+62
+53
+151
+61
+50
+159
+63
+49
+169
+66
+51
+179
+68
+51
+188
+68
+52
+191
+68
+52
+185
+63
+48
+181
+65
+50
+172
+70
+56
+158
+72
+59
+135
+72
+57
+111
+65
+50
+84
+56
+42
+67
+51
+38
+61
+53
+50
+57
+53
+52
+57
+53
+52
+55
+51
+50
+55
+49
+49
+54
+48
+48
+53
+48
+45
+53
+48
+45
+55
+50
+47
+55
+50
+47
+55
+50
+47
+54
+49
+46
+54
+49
+45
+53
+48
+44
+53
+48
+44
+52
+49
+44
+47
+47
+45
+46
+48
+45
+47
+47
+45
+47
+47
+45
+48
+47
+45
+48
+47
+45
+50
+46
+45
+50
+46
+45
+53
+44
+45
+52
+43
+44
+52
+42
+43
+51
+41
+42
+55
+40
+43
+61
+46
+49
+69
+54
+57
+80
+58
+60
+106
+66
+67
+124
+73
+72
+141
+77
+77
+149
+79
+79
+159
+87
+91
+170
+100
+110
+170
+111
+131
+159
+116
+144
+148
+123
+163
+135
+127
+174
+128
+134
+186
+126
+136
+189
+115
+121
+173
+96
+97
+145
+84
+75
+118
+80
+68
+104
+83
+74
+103
+79
+71
+94
+77
+72
+94
+84
+81
+98
+102
+100
+111
+124
+125
+130
+141
+145
+144
+153
+158
+152
+163
+169
+159
+162
+168
+154
+158
+160
+147
+143
+146
+129
+123
+124
+108
+102
+103
+85
+88
+87
+69
+81
+78
+69
+85
+82
+91
+85
+81
+98
+85
+81
+98
+48
+47
+45
+48
+47
+45
+49
+48
+46
+49
+48
+46
+52
+48
+45
+53
+49
+46
+54
+50
+47
+54
+50
+47
+56
+51
+47
+56
+51
+47
+58
+51
+45
+58
+51
+45
+58
+51
+45
+58
+51
+45
+58
+51
+45
+58
+51
+45
+57
+49
+46
+57
+49
+46
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+57
+49
+46
+57
+49
+46
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+56
+48
+45
+54
+46
+43
+54
+46
+43
+53
+45
+42
+53
+45
+42
+53
+45
+42
+52
+44
+41
+52
+44
+41
+52
+44
+41
+53
+45
+42
+53
+45
+42
+53
+45
+42
+53
+45
+42
+53
+45
+42
+53
+45
+42
+53
+45
+42
+51
+46
+42
+48
+43
+37
+48
+45
+38
+48
+45
+38
+49
+46
+39
+50
+47
+40
+51
+48
+41
+52
+49
+42
+52
+49
+42
+54
+51
+44
+54
+51
+44
+55
+52
+45
+55
+52
+45
+56
+53
+46
+57
+54
+47
+58
+55
+48
+58
+55
+46
+64
+57
+47
+65
+59
+47
+67
+61
+49
+69
+63
+51
+72
+64
+51
+73
+65
+52
+74
+66
+53
+74
+66
+53
+76
+67
+52
+76
+67
+52
+77
+65
+49
+77
+65
+49
+77
+65
+49
+78
+66
+50
+79
+67
+51
+81
+68
+52
+80
+62
+48
+85
+63
+49
+94
+65
+51
+106
+67
+52
+120
+68
+54
+132
+69
+52
+146
+69
+53
+156
+67
+51
+167
+67
+52
+175
+65
+52
+181
+65
+52
+188
+66
+55
+192
+68
+58
+196
+69
+60
+197
+70
+61
+205
+67
+64
+225
+69
+73
+231
+66
+73
+232
+67
+73
+234
+68
+72
+237
+68
+71
+239
+66
+68
+243
+64
+67
+246
+63
+67
+248
+59
+65
+247
+58
+64
+244
+58
+63
+240
+60
+63
+233
+63
+64
+224
+65
+62
+213
+64
+60
+202
+64
+54
+185
+62
+47
+181
+64
+46
+180
+63
+45
+180
+63
+45
+180
+63
+45
+178
+63
+44
+176
+63
+45
+175
+64
+45
+173
+64
+44
+169
+64
+43
+166
+65
+45
+161
+65
+43
+159
+64
+42
+155
+65
+41
+152
+64
+42
+150
+65
+44
+148
+62
+45
+146
+63
+47
+145
+62
+46
+145
+62
+46
+145
+62
+44
+144
+61
+43
+146
+60
+43
+146
+60
+43
+148
+63
+43
+147
+62
+42
+148
+61
+42
+148
+61
+42
+148
+61
+42
+149
+62
+43
+150
+63
+44
+150
+64
+47
+148
+64
+53
+149
+62
+53
+152
+62
+51
+160
+62
+49
+171
+65
+51
+181
+68
+52
+189
+67
+52
+191
+68
+53
+187
+65
+50
+183
+67
+54
+172
+70
+56
+156
+73
+59
+133
+71
+58
+108
+64
+51
+83
+57
+42
+66
+52
+41
+62
+54
+51
+58
+54
+53
+57
+53
+52
+56
+52
+51
+56
+50
+50
+55
+49
+49
+54
+49
+46
+54
+49
+46
+55
+50
+47
+55
+50
+47
+55
+50
+47
+54
+49
+46
+54
+49
+45
+53
+48
+44
+53
+48
+44
+52
+49
+44
+47
+47
+45
+46
+48
+45
+47
+47
+45
+47
+47
+45
+48
+47
+45
+48
+47
+45
+50
+46
+45
+50
+46
+45
+51
+45
+45
+53
+44
+45
+52
+42
+43
+51
+41
+42
+53
+41
+43
+60
+45
+48
+67
+52
+55
+78
+56
+58
+100
+62
+61
+118
+69
+65
+134
+74
+73
+143
+78
+76
+154
+84
+86
+164
+97
+106
+165
+108
+125
+157
+114
+142
+145
+123
+162
+134
+128
+174
+127
+133
+185
+123
+132
+187
+111
+117
+169
+91
+91
+141
+81
+72
+117
+79
+67
+105
+79
+70
+101
+79
+71
+95
+80
+72
+95
+82
+78
+95
+91
+89
+102
+110
+111
+116
+131
+135
+136
+148
+153
+149
+153
+158
+151
+154
+160
+148
+153
+157
+143
+143
+145
+131
+126
+127
+111
+106
+107
+89
+93
+91
+76
+86
+83
+74
+88
+83
+90
+86
+82
+97
+88
+81
+97
+47
+46
+44
+47
+46
+44
+48
+47
+45
+49
+48
+46
+52
+48
+45
+52
+48
+45
+53
+49
+46
+53
+49
+46
+55
+50
+46
+55
+50
+46
+55
+50
+46
+55
+50
+46
+57
+50
+44
+57
+50
+44
+57
+50
+44
+57
+50
+44
+57
+49
+46
+56
+48
+46
+55
+47
+45
+55
+47
+45
+55
+47
+45
+55
+47
+45
+56
+48
+46
+57
+49
+47
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+54
+46
+44
+53
+45
+43
+53
+45
+43
+53
+45
+43
+52
+44
+42
+52
+44
+42
+52
+44
+42
+52
+44
+42
+53
+45
+43
+53
+45
+43
+53
+45
+43
+53
+45
+43
+53
+45
+43
+53
+45
+43
+53
+45
+43
+51
+46
+42
+50
+45
+39
+49
+46
+39
+50
+47
+40
+51
+48
+41
+51
+48
+41
+52
+49
+42
+52
+49
+42
+53
+50
+43
+54
+51
+44
+54
+51
+44
+54
+51
+44
+55
+52
+45
+56
+53
+46
+57
+54
+47
+57
+54
+47
+58
+55
+46
+63
+56
+46
+64
+58
+46
+66
+60
+48
+68
+62
+50
+71
+63
+52
+72
+64
+53
+72
+64
+51
+72
+64
+51
+73
+64
+49
+73
+64
+49
+75
+63
+49
+75
+63
+49
+75
+63
+47
+76
+64
+48
+77
+65
+49
+78
+66
+50
+77
+65
+49
+81
+65
+49
+89
+66
+50
+100
+67
+50
+113
+67
+51
+124
+67
+50
+135
+66
+50
+146
+65
+48
+152
+60
+45
+160
+58
+43
+167
+59
+46
+175
+61
+50
+181
+64
+54
+186
+68
+58
+191
+70
+61
+197
+68
+62
+217
+67
+69
+225
+64
+70
+227
+66
+71
+231
+66
+70
+234
+68
+70
+240
+67
+69
+244
+65
+68
+248
+63
+68
+250
+59
+64
+249
+58
+63
+245
+59
+64
+240
+61
+64
+232
+64
+64
+220
+65
+61
+209
+64
+59
+198
+64
+53
+183
+61
+46
+179
+64
+45
+179
+64
+45
+178
+63
+44
+178
+63
+45
+176
+63
+45
+175
+62
+44
+173
+64
+44
+170
+63
+45
+167
+64
+45
+165
+64
+44
+161
+65
+43
+157
+65
+44
+154
+63
+42
+152
+64
+42
+149
+64
+43
+148
+62
+45
+145
+62
+46
+145
+62
+46
+145
+62
+46
+144
+61
+43
+144
+61
+43
+144
+61
+43
+144
+61
+43
+145
+62
+44
+145
+62
+44
+146
+60
+43
+146
+60
+43
+147
+61
+44
+147
+61
+44
+148
+63
+43
+149
+63
+46
+149
+65
+54
+150
+63
+53
+154
+62
+51
+163
+62
+50
+175
+65
+52
+185
+67
+53
+191
+68
+53
+193
+67
+53
+192
+68
+56
+184
+70
+59
+174
+73
+61
+153
+74
+61
+129
+71
+59
+104
+64
+52
+81
+58
+44
+66
+53
+44
+63
+55
+52
+61
+55
+55
+60
+54
+54
+58
+52
+52
+57
+52
+49
+56
+51
+48
+55
+50
+47
+55
+50
+47
+54
+50
+47
+54
+50
+47
+54
+50
+47
+53
+49
+46
+53
+50
+45
+52
+49
+44
+52
+49
+44
+50
+49
+44
+46
+48
+45
+44
+49
+45
+46
+48
+45
+46
+48
+45
+47
+47
+45
+47
+47
+45
+48
+47
+45
+50
+46
+45
+53
+47
+47
+52
+46
+46
+53
+44
+45
+52
+42
+43
+52
+42
+43
+57
+45
+47
+62
+50
+52
+73
+53
+54
+91
+57
+55
+108
+63
+57
+124
+69
+64
+134
+73
+68
+144
+79
+77
+152
+91
+96
+155
+102
+118
+148
+109
+136
+140
+119
+158
+131
+125
+173
+125
+130
+185
+117
+126
+183
+102
+109
+164
+84
+86
+137
+77
+69
+118
+76
+65
+107
+77
+65
+101
+79
+70
+99
+81
+72
+99
+77
+72
+94
+78
+75
+92
+91
+91
+101
+113
+116
+121
+133
+137
+136
+135
+140
+134
+138
+143
+136
+141
+144
+133
+134
+138
+124
+120
+122
+108
+102
+105
+88
+90
+91
+77
+86
+83
+76
+90
+85
+91
+90
+84
+96
+91
+83
+96
+46
+45
+43
+47
+46
+44
+47
+46
+44
+48
+47
+45
+51
+47
+44
+52
+48
+45
+52
+48
+45
+52
+48
+45
+54
+49
+45
+54
+49
+45
+54
+49
+45
+54
+49
+45
+56
+49
+43
+56
+49
+43
+56
+49
+43
+56
+49
+43
+55
+47
+45
+55
+47
+45
+54
+46
+44
+54
+46
+44
+54
+46
+44
+54
+46
+44
+55
+47
+45
+55
+47
+45
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+56
+48
+46
+53
+45
+43
+53
+45
+43
+53
+45
+43
+52
+44
+42
+52
+44
+42
+52
+44
+42
+51
+43
+41
+51
+43
+41
+54
+46
+44
+54
+46
+44
+54
+46
+44
+54
+46
+44
+54
+46
+44
+54
+46
+44
+54
+46
+44
+52
+47
+44
+51
+48
+43
+51
+48
+41
+51
+48
+41
+52
+49
+42
+52
+49
+42
+53
+50
+43
+53
+50
+43
+53
+50
+43
+53
+50
+43
+53
+50
+43
+54
+51
+44
+55
+52
+45
+56
+53
+46
+56
+53
+46
+57
+54
+47
+57
+54
+45
+62
+55
+45
+63
+57
+45
+64
+58
+46
+66
+60
+48
+69
+61
+50
+69
+61
+50
+70
+62
+49
+70
+62
+49
+71
+61
+49
+71
+62
+47
+72
+60
+46
+73
+61
+47
+73
+61
+47
+74
+62
+46
+76
+64
+48
+74
+65
+48
+75
+68
+50
+78
+69
+52
+85
+68
+52
+94
+68
+51
+105
+68
+50
+115
+66
+49
+126
+65
+47
+134
+63
+45
+140
+57
+41
+148
+57
+39
+157
+57
+42
+163
+60
+45
+172
+64
+51
+179
+69
+56
+184
+72
+60
+193
+70
+62
+210
+68
+67
+218
+65
+67
+222
+66
+67
+226
+68
+67
+231
+67
+68
+236
+66
+67
+243
+64
+67
+247
+63
+65
+250
+59
+64
+249
+58
+63
+245
+59
+64
+238
+62
+64
+229
+65
+64
+218
+66
+61
+205
+64
+57
+194
+64
+51
+181
+61
+45
+176
+64
+44
+176
+64
+44
+176
+64
+44
+175
+62
+44
+174
+63
+44
+174
+63
+44
+172
+63
+43
+169
+64
+45
+166
+63
+44
+163
+64
+43
+160
+64
+42
+156
+64
+43
+152
+64
+42
+150
+64
+41
+148
+63
+42
+145
+62
+44
+145
+62
+46
+145
+62
+46
+144
+61
+45
+144
+61
+43
+144
+61
+43
+143
+60
+42
+143
+60
+42
+144
+61
+43
+144
+61
+43
+143
+60
+42
+143
+60
+42
+146
+60
+43
+145
+62
+44
+148
+62
+45
+146
+63
+45
+149
+65
+54
+150
+63
+53
+156
+62
+50
+166
+64
+52
+178
+66
+54
+188
+67
+56
+193
+67
+55
+194
+66
+55
+194
+70
+60
+186
+74
+63
+172
+76
+64
+151
+75
+62
+124
+70
+58
+98
+64
+52
+76
+58
+46
+65
+55
+45
+64
+56
+53
+62
+57
+54
+61
+55
+55
+60
+55
+52
+58
+53
+50
+57
+52
+49
+56
+51
+48
+56
+51
+48
+54
+50
+47
+54
+50
+47
+54
+50
+47
+51
+50
+46
+53
+50
+45
+50
+49
+44
+50
+49
+44
+49
+50
+45
+45
+50
+46
+45
+50
+46
+47
+49
+46
+47
+49
+46
+48
+48
+46
+48
+48
+46
+49
+48
+46
+49
+48
+46
+53
+49
+48
+54
+48
+48
+53
+47
+47
+53
+44
+45
+52
+43
+44
+54
+44
+45
+58
+48
+49
+68
+50
+50
+84
+55
+49
+99
+59
+51
+113
+65
+55
+123
+69
+59
+130
+72
+68
+137
+82
+85
+141
+95
+108
+139
+105
+130
+131
+115
+152
+125
+121
+171
+120
+125
+181
+111
+119
+181
+96
+102
+162
+81
+82
+139
+76
+69
+121
+76
+64
+112
+76
+64
+104
+80
+69
+103
+81
+70
+102
+76
+67
+94
+71
+66
+86
+77
+76
+90
+94
+94
+102
+106
+110
+113
+117
+121
+120
+120
+125
+119
+122
+128
+118
+119
+122
+111
+107
+111
+97
+96
+98
+84
+87
+89
+76
+84
+84
+76
+93
+87
+89
+93
+86
+93
+93
+86
+94
+45
+45
+45
+45
+45
+45
+46
+45
+43
+47
+46
+44
+48
+47
+45
+49
+48
+46
+51
+47
+44
+52
+48
+45
+51
+47
+44
+51
+47
+44
+52
+47
+43
+52
+47
+43
+52
+47
+43
+52
+47
+43
+54
+47
+41
+54
+47
+41
+52
+47
+44
+52
+47
+44
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+52
+47
+44
+52
+47
+44
+53
+48
+45
+53
+48
+45
+53
+48
+45
+53
+48
+45
+53
+48
+45
+53
+48
+45
+53
+48
+45
+53
+48
+45
+51
+46
+43
+51
+46
+43
+50
+45
+42
+50
+45
+42
+50
+45
+42
+49
+44
+41
+49
+44
+41
+49
+44
+41
+52
+47
+44
+52
+47
+44
+52
+47
+44
+52
+47
+44
+52
+47
+44
+52
+47
+44
+52
+47
+44
+52
+47
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+53
+50
+45
+53
+50
+45
+53
+50
+45
+53
+50
+45
+53
+50
+45
+54
+51
+46
+54
+51
+46
+55
+52
+47
+56
+53
+48
+57
+54
+49
+57
+54
+47
+60
+53
+45
+61
+54
+44
+63
+56
+46
+64
+57
+47
+66
+58
+47
+67
+59
+48
+67
+59
+48
+67
+59
+46
+68
+58
+46
+68
+58
+46
+70
+58
+46
+71
+59
+45
+72
+60
+46
+73
+61
+47
+74
+62
+48
+73
+64
+49
+74
+71
+54
+77
+72
+53
+82
+71
+53
+89
+70
+53
+98
+69
+51
+106
+68
+49
+117
+66
+47
+125
+62
+44
+130
+59
+41
+139
+58
+41
+147
+58
+42
+154
+61
+44
+163
+66
+50
+172
+70
+56
+178
+74
+61
+187
+73
+63
+204
+71
+66
+212
+68
+67
+216
+68
+66
+221
+69
+66
+226
+66
+66
+233
+65
+65
+240
+61
+64
+244
+60
+62
+249
+58
+63
+248
+58
+60
+244
+60
+62
+237
+63
+62
+225
+66
+62
+211
+67
+58
+197
+65
+53
+185
+63
+48
+178
+63
+45
+174
+63
+44
+174
+63
+44
+174
+63
+44
+173
+62
+45
+172
+62
+45
+172
+62
+45
+170
+63
+45
+168
+62
+46
+164
+63
+45
+160
+63
+44
+158
+63
+43
+154
+63
+44
+151
+63
+43
+149
+62
+42
+147
+62
+42
+145
+62
+44
+144
+63
+46
+143
+62
+45
+143
+62
+45
+143
+62
+45
+142
+61
+44
+142
+61
+44
+142
+61
+44
+142
+61
+44
+142
+61
+44
+142
+61
+44
+142
+61
+44
+143
+60
+44
+143
+62
+45
+145
+62
+46
+144
+63
+46
+148
+66
+52
+151
+65
+52
+157
+64
+49
+168
+64
+51
+182
+65
+55
+191
+67
+57
+197
+66
+56
+196
+65
+55
+190
+67
+59
+183
+72
+63
+166
+76
+67
+144
+74
+64
+116
+69
+59
+90
+62
+50
+69
+57
+45
+60
+53
+43
+64
+57
+51
+64
+56
+53
+63
+55
+53
+62
+54
+51
+61
+53
+50
+60
+52
+49
+57
+52
+48
+56
+51
+47
+54
+50
+47
+52
+51
+47
+52
+51
+47
+50
+51
+46
+51
+50
+46
+49
+50
+45
+49
+50
+45
+48
+50
+45
+45
+50
+46
+44
+50
+46
+45
+50
+46
+45
+50
+46
+47
+49
+46
+47
+49
+46
+48
+48
+46
+49
+48
+46
+51
+50
+48
+53
+49
+48
+53
+49
+48
+52
+46
+46
+50
+44
+44
+52
+43
+44
+55
+46
+47
+61
+47
+46
+78
+53
+46
+89
+57
+46
+101
+61
+49
+110
+64
+51
+115
+66
+59
+121
+75
+75
+128
+90
+101
+131
+103
+128
+127
+112
+151
+122
+120
+170
+117
+123
+183
+107
+115
+180
+95
+100
+166
+84
+84
+148
+79
+71
+131
+76
+66
+119
+78
+65
+109
+78
+66
+104
+77
+65
+101
+74
+65
+96
+71
+66
+89
+71
+70
+88
+75
+75
+87
+77
+80
+85
+93
+99
+99
+96
+102
+98
+98
+105
+97
+96
+102
+92
+90
+96
+84
+87
+91
+77
+85
+88
+77
+88
+88
+80
+94
+89
+86
+96
+87
+88
+96
+87
+90
+44
+44
+44
+44
+44
+44
+46
+45
+43
+46
+45
+43
+47
+46
+44
+48
+47
+45
+51
+47
+44
+51
+47
+44
+50
+46
+43
+50
+46
+43
+51
+46
+42
+51
+46
+42
+51
+46
+42
+51
+46
+42
+53
+46
+40
+53
+45
+42
+51
+46
+43
+51
+46
+43
+50
+45
+42
+49
+44
+41
+49
+44
+41
+50
+45
+42
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+50
+45
+42
+50
+45
+42
+50
+45
+42
+50
+45
+42
+49
+44
+41
+49
+44
+41
+49
+44
+41
+48
+43
+40
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+51
+46
+43
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+52
+49
+44
+53
+50
+45
+53
+50
+45
+54
+51
+46
+55
+52
+47
+56
+53
+48
+56
+53
+48
+56
+53
+46
+59
+52
+44
+60
+53
+43
+61
+54
+44
+62
+55
+45
+64
+55
+46
+65
+57
+46
+65
+57
+46
+65
+57
+46
+67
+57
+47
+67
+57
+45
+69
+57
+45
+70
+58
+46
+71
+59
+47
+72
+60
+46
+74
+62
+48
+72
+65
+49
+74
+71
+54
+73
+72
+54
+78
+71
+53
+86
+70
+54
+92
+69
+51
+100
+67
+50
+110
+64
+48
+118
+62
+45
+123
+60
+43
+130
+59
+41
+140
+59
+42
+148
+61
+44
+156
+64
+49
+163
+70
+53
+170
+74
+58
+180
+74
+61
+196
+72
+64
+204
+69
+65
+209
+70
+65
+214
+69
+64
+222
+67
+65
+228
+64
+62
+236
+62
+63
+241
+58
+60
+247
+59
+60
+244
+58
+59
+240
+60
+61
+233
+64
+61
+220
+67
+61
+205
+67
+56
+190
+64
+50
+177
+62
+44
+174
+63
+44
+171
+64
+44
+170
+63
+43
+170
+63
+43
+170
+63
+45
+169
+62
+44
+169
+62
+44
+168
+63
+44
+165
+62
+45
+162
+63
+44
+160
+63
+44
+155
+62
+44
+151
+63
+43
+149
+62
+42
+147
+62
+41
+145
+63
+42
+143
+62
+43
+143
+62
+45
+143
+62
+45
+143
+62
+45
+142
+61
+44
+142
+61
+44
+142
+61
+44
+141
+60
+43
+142
+61
+44
+139
+60
+43
+141
+60
+43
+139
+60
+43
+139
+60
+45
+140
+61
+44
+141
+62
+47
+142
+63
+46
+148
+66
+52
+151
+65
+50
+160
+64
+50
+172
+66
+53
+185
+67
+57
+194
+67
+58
+197
+66
+58
+194
+65
+59
+186
+65
+57
+177
+73
+64
+163
+78
+71
+141
+78
+69
+111
+71
+61
+83
+63
+52
+65
+59
+47
+57
+54
+45
+64
+57
+51
+65
+55
+53
+63
+55
+52
+62
+54
+51
+60
+52
+49
+57
+52
+48
+56
+51
+47
+55
+52
+47
+52
+51
+47
+52
+51
+47
+51
+52
+47
+50
+51
+46
+50
+51
+46
+48
+50
+45
+48
+50
+45
+46
+51
+45
+45
+51
+47
+45
+51
+47
+46
+51
+47
+46
+51
+47
+48
+50
+47
+48
+50
+47
+49
+49
+47
+49
+49
+47
+50
+49
+47
+51
+50
+48
+51
+50
+48
+52
+48
+47
+50
+46
+45
+49
+45
+44
+52
+46
+46
+56
+46
+44
+71
+52
+45
+79
+52
+41
+88
+56
+43
+96
+60
+48
+101
+63
+54
+109
+71
+70
+121
+89
+100
+130
+107
+133
+128
+117
+159
+124
+124
+178
+119
+124
+188
+110
+117
+187
+100
+104
+175
+91
+91
+161
+82
+77
+143
+76
+66
+126
+79
+65
+114
+76
+64
+104
+73
+61
+99
+72
+62
+96
+72
+66
+94
+69
+67
+88
+64
+66
+79
+59
+64
+70
+66
+71
+74
+68
+77
+74
+74
+81
+74
+74
+81
+73
+73
+81
+70
+75
+81
+69
+79
+85
+73
+86
+87
+79
+94
+89
+83
+96
+89
+83
+96
+88
+85
+43
+43
+43
+43
+43
+43
+44
+44
+44
+45
+45
+45
+47
+46
+44
+47
+46
+44
+48
+47
+45
+48
+47
+45
+49
+45
+42
+49
+45
+42
+49
+45
+42
+49
+45
+42
+50
+45
+41
+50
+45
+41
+50
+45
+41
+50
+45
+41
+50
+45
+42
+50
+44
+44
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+50
+44
+44
+50
+44
+44
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+50
+44
+44
+50
+44
+44
+50
+44
+44
+49
+43
+43
+49
+43
+43
+49
+43
+43
+48
+42
+42
+48
+42
+42
+51
+45
+45
+51
+45
+45
+51
+45
+45
+51
+45
+45
+51
+45
+45
+51
+45
+45
+51
+45
+45
+51
+46
+43
+52
+49
+44
+52
+49
+44
+52
+49
+44
+51
+48
+43
+51
+48
+43
+51
+48
+43
+51
+48
+43
+51
+48
+43
+52
+49
+44
+52
+49
+44
+53
+50
+45
+54
+51
+46
+55
+52
+47
+55
+52
+47
+56
+53
+48
+56
+53
+46
+58
+51
+43
+59
+52
+44
+60
+53
+45
+61
+54
+46
+63
+54
+47
+63
+54
+45
+63
+54
+45
+63
+55
+44
+66
+56
+46
+66
+56
+46
+69
+56
+47
+69
+57
+45
+71
+59
+47
+72
+60
+48
+74
+62
+50
+72
+64
+51
+72
+69
+54
+71
+70
+52
+75
+69
+53
+81
+68
+52
+88
+67
+50
+95
+66
+50
+102
+63
+46
+110
+61
+44
+118
+61
+44
+124
+58
+42
+133
+57
+41
+140
+59
+42
+147
+61
+46
+155
+66
+50
+162
+70
+55
+172
+70
+56
+187
+70
+60
+194
+70
+62
+201
+70
+62
+208
+69
+62
+217
+68
+64
+226
+67
+63
+234
+64
+64
+240
+62
+62
+242
+58
+58
+241
+59
+58
+236
+60
+60
+228
+65
+60
+214
+67
+59
+198
+68
+54
+181
+64
+47
+170
+61
+41
+170
+63
+45
+169
+64
+45
+169
+64
+45
+168
+63
+44
+168
+62
+46
+168
+62
+46
+167
+61
+45
+165
+62
+45
+163
+61
+46
+160
+63
+46
+158
+63
+45
+154
+63
+45
+150
+63
+44
+147
+62
+42
+145
+63
+42
+143
+62
+41
+143
+62
+43
+141
+62
+45
+141
+62
+45
+140
+61
+44
+140
+61
+46
+140
+61
+46
+139
+60
+45
+139
+60
+45
+139
+60
+45
+138
+61
+45
+138
+59
+44
+137
+60
+44
+138
+60
+47
+139
+62
+46
+139
+61
+48
+140
+63
+47
+146
+67
+50
+152
+66
+49
+161
+65
+49
+174
+66
+54
+188
+67
+58
+194
+67
+60
+196
+67
+61
+192
+67
+61
+185
+70
+65
+178
+81
+74
+165
+88
+82
+143
+88
+81
+115
+82
+73
+87
+73
+62
+67
+67
+55
+60
+63
+54
+62
+57
+51
+64
+55
+50
+62
+55
+49
+61
+54
+48
+58
+53
+47
+57
+52
+46
+56
+51
+47
+54
+51
+46
+52
+51
+46
+52
+51
+46
+51
+52
+47
+49
+51
+46
+49
+51
+46
+46
+51
+45
+46
+51
+45
+46
+51
+45
+45
+51
+47
+45
+51
+47
+45
+51
+47
+45
+51
+47
+46
+51
+47
+46
+51
+47
+48
+50
+47
+48
+50
+47
+48
+48
+46
+49
+49
+47
+50
+50
+48
+50
+49
+47
+48
+47
+45
+47
+46
+44
+50
+46
+45
+52
+47
+44
+63
+48
+43
+68
+48
+41
+75
+51
+41
+84
+56
+45
+90
+60
+52
+100
+70
+70
+117
+93
+106
+131
+115
+141
+137
+128
+171
+133
+132
+190
+126
+131
+199
+116
+122
+198
+109
+112
+189
+99
+101
+175
+86
+83
+154
+76
+67
+130
+75
+63
+113
+73
+60
+103
+71
+59
+99
+69
+62
+95
+70
+66
+93
+68
+66
+87
+63
+65
+78
+59
+63
+72
+58
+66
+69
+62
+72
+71
+68
+77
+72
+71
+81
+73
+71
+81
+72
+74
+82
+71
+78
+86
+75
+85
+88
+77
+94
+90
+79
+97
+89
+78
+97
+88
+79
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+44
+44
+46
+44
+45
+47
+46
+44
+48
+47
+45
+48
+47
+45
+49
+45
+42
+49
+45
+42
+49
+45
+42
+49
+45
+42
+50
+45
+41
+50
+45
+41
+50
+45
+41
+50
+45
+42
+50
+44
+44
+49
+43
+43
+49
+43
+43
+48
+42
+42
+48
+42
+42
+49
+43
+43
+49
+43
+43
+50
+44
+44
+48
+42
+42
+48
+42
+42
+48
+42
+42
+48
+42
+42
+48
+42
+42
+48
+42
+42
+48
+42
+42
+48
+42
+42
+50
+44
+44
+50
+44
+44
+50
+44
+44
+49
+43
+43
+49
+43
+43
+48
+42
+42
+48
+42
+42
+48
+42
+42
+50
+44
+44
+50
+44
+44
+50
+44
+44
+50
+44
+44
+50
+44
+44
+50
+44
+44
+50
+44
+44
+50
+44
+44
+51
+47
+44
+51
+48
+43
+51
+48
+43
+51
+48
+43
+51
+48
+43
+51
+48
+43
+51
+48
+43
+51
+48
+43
+52
+49
+44
+52
+49
+44
+53
+50
+45
+54
+51
+46
+54
+51
+46
+55
+52
+47
+56
+53
+48
+56
+53
+48
+57
+50
+44
+58
+51
+43
+59
+52
+44
+60
+53
+45
+62
+53
+46
+62
+53
+46
+62
+53
+46
+62
+53
+44
+66
+56
+47
+66
+56
+46
+69
+56
+47
+69
+56
+47
+71
+58
+49
+73
+61
+49
+74
+62
+50
+73
+63
+51
+70
+67
+52
+70
+67
+52
+74
+66
+53
+79
+65
+52
+84
+65
+50
+92
+64
+50
+98
+62
+48
+106
+60
+45
+113
+60
+46
+119
+57
+42
+125
+56
+41
+133
+56
+40
+140
+58
+44
+149
+61
+47
+155
+66
+52
+164
+66
+53
+178
+70
+58
+186
+69
+59
+193
+70
+62
+202
+71
+63
+212
+71
+64
+222
+70
+65
+231
+67
+65
+238
+66
+64
+237
+59
+59
+235
+59
+59
+231
+62
+59
+223
+66
+59
+209
+68
+58
+191
+68
+52
+175
+64
+45
+164
+62
+40
+166
+65
+45
+166
+65
+45
+165
+64
+44
+165
+64
+46
+165
+64
+46
+164
+63
+45
+164
+63
+45
+164
+62
+47
+162
+62
+46
+159
+64
+46
+156
+63
+46
+152
+63
+45
+149
+62
+43
+145
+63
+42
+143
+62
+41
+143
+62
+43
+141
+62
+45
+141
+62
+45
+141
+62
+45
+140
+61
+44
+140
+61
+46
+139
+60
+45
+139
+60
+45
+138
+61
+45
+138
+61
+45
+136
+60
+46
+136
+60
+46
+136
+60
+46
+136
+60
+47
+135
+62
+47
+136
+62
+49
+139
+63
+49
+145
+68
+50
+150
+67
+49
+162
+66
+52
+173
+67
+54
+186
+67
+59
+193
+68
+62
+193
+68
+62
+187
+69
+65
+185
+80
+76
+178
+91
+84
+165
+101
+92
+145
+102
+93
+117
+95
+84
+91
+85
+73
+71
+77
+65
+67
+73
+63
+60
+57
+50
+63
+56
+50
+62
+55
+49
+59
+54
+48
+57
+52
+46
+55
+52
+45
+54
+51
+46
+52
+51
+46
+52
+51
+46
+51
+52
+46
+50
+52
+47
+49
+51
+46
+47
+52
+46
+46
+51
+45
+46
+51
+45
+46
+51
+45
+45
+51
+47
+45
+51
+47
+45
+51
+47
+45
+51
+47
+46
+51
+47
+46
+51
+47
+48
+50
+47
+48
+50
+47
+47
+47
+45
+48
+48
+46
+50
+50
+48
+50
+50
+48
+49
+48
+46
+48
+47
+45
+48
+47
+45
+51
+47
+44
+56
+44
+44
+59
+44
+41
+67
+48
+42
+75
+55
+48
+83
+60
+54
+94
+73
+72
+116
+98
+110
+135
+122
+148
+144
+138
+182
+140
+141
+198
+132
+136
+207
+122
+128
+204
+114
+120
+198
+105
+107
+182
+87
+87
+159
+73
+68
+132
+69
+61
+110
+71
+60
+100
+68
+60
+97
+67
+62
+94
+67
+65
+89
+64
+67
+86
+64
+68
+80
+62
+69
+75
+71
+81
+82
+75
+87
+85
+81
+94
+87
+85
+96
+88
+83
+95
+85
+82
+94
+84
+84
+94
+83
+89
+95
+83
+94
+91
+76
+97
+90
+74
+97
+90
+74
+44
+45
+47
+44
+45
+47
+44
+45
+47
+44
+46
+45
+45
+45
+45
+45
+45
+45
+46
+45
+43
+46
+45
+43
+47
+46
+44
+47
+46
+44
+49
+45
+42
+48
+44
+41
+48
+44
+41
+48
+44
+41
+47
+43
+40
+47
+43
+40
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+48
+44
+43
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+48
+44
+43
+48
+44
+43
+49
+45
+44
+49
+45
+44
+50
+46
+45
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+48
+44
+41
+49
+45
+42
+50
+46
+43
+51
+47
+44
+51
+47
+44
+51
+47
+44
+51
+47
+44
+51
+47
+44
+51
+47
+44
+51
+47
+44
+51
+47
+44
+51
+47
+44
+52
+48
+45
+53
+49
+46
+54
+50
+47
+55
+52
+47
+56
+48
+45
+57
+50
+44
+58
+51
+45
+59
+52
+46
+61
+52
+47
+62
+53
+46
+62
+53
+46
+62
+53
+46
+63
+52
+46
+63
+53
+44
+66
+53
+45
+67
+54
+46
+68
+55
+47
+70
+57
+48
+71
+58
+49
+70
+60
+50
+71
+63
+52
+72
+64
+53
+74
+64
+54
+80
+63
+53
+84
+62
+51
+88
+60
+49
+94
+57
+48
+98
+54
+43
+109
+57
+46
+116
+56
+45
+124
+56
+43
+131
+57
+44
+141
+59
+47
+147
+61
+48
+152
+63
+49
+158
+62
+48
+167
+65
+51
+173
+65
+52
+181
+67
+56
+190
+69
+58
+202
+71
+61
+212
+71
+62
+222
+69
+63
+229
+67
+64
+232
+64
+63
+234
+66
+65
+230
+68
+65
+218
+69
+62
+200
+68
+56
+183
+66
+49
+170
+65
+46
+162
+66
+44
+162
+65
+46
+161
+64
+45
+162
+63
+44
+162
+62
+46
+161
+61
+45
+161
+61
+45
+162
+62
+46
+160
+63
+47
+156
+60
+44
+154
+61
+44
+152
+60
+45
+149
+62
+45
+147
+61
+44
+144
+61
+43
+142
+61
+42
+140
+62
+42
+139
+60
+43
+139
+60
+43
+138
+61
+45
+137
+60
+44
+137
+60
+44
+137
+60
+44
+136
+58
+45
+135
+59
+45
+137
+61
+47
+134
+60
+47
+134
+60
+47
+135
+61
+48
+136
+62
+51
+136
+64
+50
+137
+65
+53
+139
+65
+52
+145
+69
+53
+151
+68
+52
+163
+69
+57
+177
+73
+62
+186
+71
+64
+187
+68
+62
+187
+69
+65
+184
+77
+71
+180
+90
+82
+175
+102
+95
+163
+113
+102
+145
+115
+104
+126
+114
+100
+106
+106
+94
+86
+94
+83
+73
+81
+70
+76
+76
+66
+74
+70
+61
+66
+62
+53
+60
+56
+47
+57
+53
+44
+55
+52
+43
+54
+51
+44
+51
+51
+43
+52
+51
+46
+51
+52
+46
+49
+52
+45
+49
+52
+45
+48
+50
+45
+47
+49
+44
+44
+49
+43
+44
+49
+43
+45
+50
+46
+45
+50
+46
+45
+50
+46
+45
+50
+46
+47
+49
+46
+47
+49
+46
+47
+49
+46
+47
+49
+46
+48
+50
+47
+48
+50
+47
+49
+49
+47
+49
+49
+47
+49
+49
+47
+49
+49
+47
+49
+49
+47
+52
+48
+47
+52
+43
+48
+59
+47
+51
+65
+51
+50
+67
+52
+47
+74
+59
+54
+93
+79
+79
+121
+109
+121
+139
+133
+159
+147
+144
+187
+148
+150
+207
+144
+149
+217
+131
+137
+211
+116
+122
+198
+106
+110
+183
+95
+98
+167
+90
+91
+148
+76
+73
+116
+72
+66
+100
+65
+62
+93
+62
+62
+88
+63
+66
+85
+65
+73
+86
+76
+85
+92
+85
+96
+98
+98
+113
+110
+110
+125
+120
+118
+134
+124
+114
+127
+117
+108
+121
+111
+103
+117
+104
+95
+107
+95
+87
+95
+80
+91
+90
+70
+96
+90
+68
+99
+93
+71
+44
+45
+47
+44
+45
+47
+44
+45
+47
+44
+45
+47
+45
+45
+45
+45
+45
+45
+46
+44
+45
+46
+45
+43
+47
+46
+44
+46
+45
+43
+48
+44
+41
+48
+44
+41
+47
+43
+40
+47
+43
+40
+47
+43
+40
+47
+43
+40
+46
+42
+41
+46
+42
+41
+46
+42
+41
+46
+42
+41
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+48
+44
+43
+48
+44
+43
+48
+44
+43
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+48
+44
+43
+48
+44
+41
+49
+45
+42
+50
+46
+43
+51
+47
+44
+51
+47
+44
+50
+46
+43
+50
+46
+43
+50
+46
+43
+50
+46
+43
+50
+46
+43
+50
+46
+43
+51
+47
+44
+52
+48
+45
+53
+49
+46
+54
+50
+47
+56
+48
+46
+57
+49
+46
+58
+50
+47
+59
+52
+46
+61
+52
+47
+62
+53
+48
+62
+53
+48
+61
+52
+45
+63
+52
+46
+63
+52
+46
+65
+52
+46
+66
+53
+45
+67
+54
+46
+69
+56
+48
+71
+58
+50
+72
+59
+51
+72
+62
+53
+72
+62
+53
+76
+61
+54
+79
+62
+54
+81
+61
+52
+86
+59
+50
+90
+57
+48
+95
+55
+47
+104
+55
+48
+112
+55
+46
+119
+55
+45
+129
+57
+45
+137
+57
+46
+144
+60
+49
+150
+60
+49
+155
+61
+49
+162
+64
+51
+167
+65
+51
+172
+66
+53
+180
+68
+56
+190
+69
+58
+201
+70
+60
+212
+69
+61
+219
+68
+61
+223
+68
+64
+224
+69
+64
+222
+70
+65
+212
+71
+62
+196
+70
+56
+178
+67
+50
+165
+66
+45
+158
+66
+45
+159
+67
+46
+158
+66
+45
+159
+64
+46
+158
+63
+45
+158
+63
+45
+158
+63
+45
+158
+62
+46
+158
+62
+46
+154
+61
+44
+153
+62
+44
+150
+61
+45
+148
+61
+44
+144
+61
+43
+143
+62
+43
+140
+62
+42
+140
+61
+44
+139
+60
+43
+138
+61
+43
+137
+60
+44
+137
+60
+44
+137
+60
+44
+135
+59
+43
+135
+59
+45
+133
+60
+45
+134
+60
+47
+133
+61
+47
+133
+61
+49
+131
+61
+49
+132
+62
+50
+134
+64
+54
+135
+65
+55
+136
+66
+54
+147
+71
+57
+151
+69
+55
+163
+71
+60
+175
+74
+64
+184
+73
+66
+184
+71
+65
+183
+76
+70
+179
+84
+78
+177
+100
+92
+170
+113
+102
+159
+126
+111
+144
+127
+111
+127
+124
+109
+109
+115
+101
+90
+102
+90
+78
+88
+77
+76
+78
+65
+75
+73
+61
+69
+67
+55
+64
+61
+52
+61
+58
+49
+56
+56
+46
+52
+52
+44
+49
+49
+41
+50
+51
+45
+50
+51
+45
+48
+51
+44
+47
+50
+43
+47
+49
+44
+46
+48
+43
+46
+48
+43
+46
+48
+43
+47
+49
+46
+45
+50
+46
+47
+49
+46
+47
+49
+46
+47
+49
+46
+47
+49
+46
+47
+49
+46
+47
+49
+46
+48
+50
+47
+48
+50
+47
+49
+49
+47
+49
+49
+47
+49
+49
+47
+49
+49
+47
+49
+49
+47
+50
+48
+49
+53
+43
+52
+57
+45
+55
+60
+50
+51
+63
+53
+51
+72
+63
+58
+94
+86
+84
+120
+114
+124
+138
+136
+158
+147
+147
+185
+148
+151
+202
+144
+150
+212
+132
+139
+207
+121
+129
+194
+113
+121
+184
+107
+116
+173
+104
+110
+158
+92
+95
+128
+88
+90
+113
+83
+85
+106
+82
+87
+106
+84
+94
+104
+90
+103
+109
+102
+118
+118
+114
+130
+127
+116
+136
+127
+126
+146
+135
+131
+149
+137
+126
+142
+129
+118
+134
+121
+114
+128
+113
+102
+116
+101
+90
+101
+84
+89
+88
+67
+94
+88
+62
+97
+91
+67
+44
+45
+47
+44
+45
+47
+44
+45
+47
+44
+45
+47
+44
+45
+47
+44
+46
+45
+45
+45
+45
+45
+45
+45
+46
+45
+43
+46
+45
+43
+46
+45
+43
+45
+44
+42
+47
+43
+40
+46
+42
+39
+46
+42
+39
+46
+42
+39
+44
+43
+41
+44
+42
+43
+44
+42
+43
+44
+42
+43
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+45
+43
+44
+45
+43
+44
+45
+43
+44
+45
+43
+44
+45
+43
+44
+45
+43
+44
+45
+43
+44
+45
+43
+44
+44
+42
+43
+44
+42
+43
+45
+43
+44
+45
+43
+44
+45
+43
+44
+46
+44
+45
+46
+44
+45
+46
+44
+45
+46
+44
+45
+46
+44
+45
+46
+44
+45
+47
+45
+46
+47
+45
+46
+47
+45
+46
+47
+45
+46
+47
+46
+44
+48
+44
+43
+48
+44
+43
+49
+45
+44
+50
+46
+45
+50
+46
+45
+50
+46
+45
+50
+46
+45
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+50
+46
+45
+51
+47
+46
+52
+48
+47
+53
+49
+46
+56
+48
+46
+57
+49
+46
+58
+50
+47
+59
+51
+48
+61
+51
+49
+61
+52
+47
+61
+52
+47
+61
+52
+47
+63
+52
+48
+63
+52
+46
+65
+52
+46
+65
+52
+46
+67
+54
+48
+68
+55
+49
+70
+57
+51
+71
+58
+52
+72
+59
+53
+74
+59
+54
+75
+60
+55
+78
+61
+54
+80
+59
+54
+83
+58
+53
+86
+55
+50
+91
+54
+46
+99
+54
+48
+107
+54
+46
+116
+53
+44
+125
+55
+47
+135
+57
+47
+141
+59
+48
+148
+60
+48
+150
+60
+49
+157
+63
+51
+160
+64
+52
+162
+64
+51
+168
+64
+51
+177
+67
+54
+186
+68
+56
+197
+69
+58
+205
+68
+58
+213
+70
+64
+215
+72
+64
+212
+73
+66
+204
+73
+63
+190
+69
+58
+174
+67
+51
+161
+66
+46
+156
+65
+46
+157
+66
+47
+156
+65
+46
+156
+63
+46
+155
+62
+45
+155
+62
+45
+155
+62
+45
+155
+62
+47
+155
+63
+48
+152
+60
+45
+150
+61
+45
+148
+60
+46
+147
+61
+46
+143
+62
+45
+140
+61
+44
+139
+60
+43
+138
+61
+43
+137
+60
+42
+137
+60
+42
+137
+60
+44
+135
+59
+43
+135
+59
+45
+133
+60
+45
+132
+58
+45
+131
+59
+45
+132
+60
+48
+130
+60
+48
+130
+60
+50
+130
+62
+51
+131
+63
+52
+133
+65
+56
+135
+67
+58
+136
+68
+57
+148
+74
+61
+151
+72
+59
+160
+72
+62
+172
+75
+68
+178
+75
+70
+179
+76
+71
+178
+83
+77
+174
+96
+86
+173
+115
+103
+166
+129
+113
+157
+140
+122
+145
+142
+123
+130
+137
+119
+115
+128
+111
+99
+113
+98
+88
+99
+85
+78
+82
+68
+77
+78
+64
+72
+73
+59
+68
+68
+56
+64
+64
+52
+57
+59
+46
+52
+54
+43
+47
+49
+38
+48
+49
+41
+48
+49
+41
+47
+48
+42
+47
+48
+42
+46
+47
+42
+46
+47
+42
+47
+47
+45
+47
+47
+45
+47
+47
+45
+46
+48
+45
+47
+47
+45
+47
+47
+45
+47
+47
+45
+47
+47
+45
+47
+47
+45
+47
+47
+45
+48
+48
+46
+48
+48
+46
+48
+48
+46
+48
+48
+46
+48
+48
+46
+48
+48
+46
+48
+48
+46
+49
+47
+50
+54
+43
+57
+55
+43
+57
+56
+47
+52
+59
+54
+51
+72
+69
+62
+95
+94
+89
+122
+122
+124
+139
+141
+154
+144
+148
+177
+146
+151
+191
+143
+149
+199
+132
+142
+195
+125
+137
+187
+123
+137
+182
+124
+139
+178
+125
+140
+171
+125
+136
+154
+119
+131
+143
+113
+126
+135
+110
+125
+130
+110
+126
+126
+111
+130
+126
+121
+142
+133
+131
+153
+141
+139
+161
+148
+145
+168
+152
+144
+165
+148
+136
+157
+138
+131
+150
+131
+124
+141
+123
+106
+123
+105
+92
+104
+84
+86
+86
+62
+91
+87
+58
+93
+89
+62
+45
+46
+48
+45
+46
+48
+45
+46
+48
+45
+46
+48
+45
+46
+48
+45
+46
+48
+46
+46
+46
+46
+46
+46
+46
+45
+43
+46
+45
+43
+45
+44
+42
+45
+44
+42
+46
+42
+39
+46
+42
+39
+46
+42
+39
+46
+42
+41
+44
+42
+43
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+42
+40
+41
+42
+40
+41
+42
+40
+41
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+45
+43
+44
+45
+43
+44
+45
+43
+44
+45
+43
+44
+46
+44
+45
+46
+44
+45
+46
+44
+45
+46
+44
+45
+47
+45
+46
+47
+45
+46
+47
+45
+46
+47
+43
+42
+48
+44
+43
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+49
+45
+44
+50
+46
+45
+51
+47
+46
+52
+48
+47
+57
+49
+47
+58
+50
+48
+59
+51
+49
+60
+52
+49
+61
+51
+49
+61
+51
+49
+61
+51
+49
+61
+52
+47
+62
+51
+47
+62
+51
+47
+64
+50
+47
+64
+51
+45
+65
+52
+46
+67
+54
+48
+68
+55
+49
+69
+56
+50
+70
+57
+51
+72
+57
+52
+73
+58
+53
+74
+59
+54
+76
+58
+54
+78
+57
+52
+81
+56
+51
+84
+53
+48
+94
+55
+50
+101
+54
+48
+111
+54
+47
+120
+56
+47
+130
+57
+48
+138
+58
+47
+144
+60
+49
+148
+62
+49
+153
+63
+52
+155
+63
+52
+155
+63
+50
+159
+63
+49
+165
+65
+50
+174
+66
+53
+184
+68
+55
+191
+69
+58
+199
+71
+62
+203
+72
+64
+202
+74
+65
+195
+73
+62
+182
+70
+58
+170
+66
+53
+158
+65
+48
+153
+64
+46
+153
+65
+45
+153
+65
+45
+152
+63
+45
+151
+62
+44
+151
+62
+44
+153
+62
+44
+153
+61
+46
+151
+62
+46
+149
+60
+44
+148
+61
+44
+147
+61
+46
+144
+61
+45
+142
+61
+44
+138
+61
+43
+138
+61
+45
+137
+60
+44
+136
+59
+41
+136
+59
+41
+135
+59
+43
+135
+59
+43
+132
+59
+44
+132
+59
+44
+131
+59
+45
+128
+59
+44
+129
+59
+47
+128
+60
+49
+128
+60
+49
+129
+62
+53
+131
+64
+55
+131
+67
+58
+135
+68
+60
+136
+69
+60
+148
+76
+64
+150
+72
+60
+158
+71
+62
+167
+74
+67
+174
+76
+73
+174
+81
+76
+173
+93
+86
+170
+106
+94
+167
+128
+111
+161
+143
+121
+154
+154
+130
+143
+155
+131
+134
+149
+128
+122
+139
+120
+109
+123
+106
+98
+109
+93
+83
+90
+74
+81
+85
+70
+75
+79
+64
+69
+73
+58
+64
+68
+54
+59
+61
+48
+53
+55
+44
+49
+51
+40
+48
+49
+41
+47
+48
+40
+46
+47
+41
+46
+45
+40
+46
+45
+41
+46
+45
+41
+47
+46
+44
+48
+47
+45
+47
+46
+44
+47
+46
+44
+47
+46
+44
+47
+46
+44
+47
+46
+44
+46
+46
+44
+47
+46
+44
+46
+46
+44
+48
+47
+45
+47
+47
+45
+48
+47
+45
+47
+47
+45
+47
+47
+45
+47
+47
+45
+47
+47
+45
+50
+45
+49
+55
+44
+58
+54
+42
+56
+51
+45
+49
+57
+54
+49
+72
+74
+63
+98
+102
+88
+123
+128
+122
+139
+144
+147
+141
+147
+163
+143
+150
+176
+140
+149
+182
+131
+144
+178
+129
+144
+175
+133
+153
+178
+141
+164
+182
+146
+168
+179
+147
+168
+171
+144
+164
+163
+140
+160
+158
+135
+158
+152
+130
+153
+143
+125
+152
+137
+129
+156
+139
+136
+163
+144
+148
+176
+154
+152
+177
+155
+148
+173
+151
+139
+163
+141
+133
+155
+132
+127
+146
+124
+107
+124
+105
+88
+102
+79
+83
+86
+59
+89
+85
+56
+90
+86
+57
+43
+47
+50
+43
+47
+50
+43
+47
+50
+43
+47
+50
+45
+46
+48
+45
+46
+48
+46
+46
+46
+46
+46
+46
+45
+45
+45
+45
+45
+45
+46
+45
+43
+45
+44
+42
+45
+44
+42
+44
+43
+41
+44
+43
+41
+44
+43
+41
+44
+42
+43
+44
+42
+43
+44
+42
+43
+43
+41
+42
+43
+41
+42
+42
+40
+41
+42
+40
+41
+42
+40
+41
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+44
+42
+43
+43
+41
+42
+43
+41
+42
+43
+41
+42
+44
+42
+43
+45
+43
+44
+45
+43
+44
+46
+44
+45
+46
+44
+45
+47
+45
+46
+47
+45
+46
+47
+45
+46
+47
+43
+42
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+47
+43
+42
+46
+42
+41
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+48
+44
+43
+49
+45
+44
+51
+47
+46
+52
+48
+47
+57
+48
+49
+58
+50
+48
+59
+51
+49
+60
+52
+50
+61
+51
+50
+61
+51
+49
+60
+50
+48
+60
+50
+48
+61
+50
+48
+61
+50
+46
+63
+49
+46
+63
+49
+46
+64
+50
+47
+65
+51
+48
+66
+53
+47
+67
+54
+48
+68
+54
+51
+67
+56
+52
+68
+57
+53
+69
+58
+54
+71
+57
+54
+72
+57
+52
+75
+56
+52
+78
+53
+48
+88
+55
+50
+95
+54
+48
+105
+55
+48
+114
+55
+47
+125
+58
+49
+134
+60
+49
+140
+62
+50
+144
+62
+50
+151
+64
+54
+151
+63
+53
+151
+63
+53
+151
+63
+51
+156
+64
+51
+163
+67
+53
+171
+67
+54
+179
+69
+56
+186
+69
+59
+189
+71
+61
+190
+72
+62
+185
+71
+61
+176
+68
+56
+166
+65
+53
+155
+63
+48
+151
+64
+47
+151
+64
+45
+151
+64
+45
+150
+63
+46
+149
+62
+45
+148
+61
+44
+149
+60
+44
+150
+61
+47
+150
+61
+47
+149
+60
+46
+147
+59
+45
+146
+60
+47
+142
+60
+46
+139
+60
+45
+137
+60
+44
+137
+60
+44
+136
+60
+44
+135
+59
+43
+134
+58
+42
+134
+58
+42
+134
+58
+42
+131
+58
+43
+131
+58
+43
+130
+58
+44
+128
+58
+46
+128
+58
+48
+128
+60
+49
+128
+61
+52
+127
+63
+54
+130
+66
+57
+131
+68
+61
+135
+70
+64
+136
+72
+63
+145
+75
+65
+146
+72
+61
+154
+71
+63
+163
+76
+69
+168
+80
+76
+168
+88
+81
+169
+102
+93
+166
+118
+104
+162
+140
+119
+155
+153
+128
+149
+164
+135
+140
+163
+135
+134
+157
+131
+126
+145
+125
+116
+130
+113
+106
+117
+101
+92
+101
+82
+86
+95
+76
+78
+85
+67
+69
+76
+58
+63
+70
+54
+60
+64
+50
+55
+58
+47
+54
+56
+45
+48
+49
+41
+48
+48
+40
+46
+45
+40
+47
+44
+39
+47
+43
+40
+47
+43
+42
+49
+45
+44
+50
+46
+45
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+47
+46
+44
+49
+45
+44
+47
+46
+44
+50
+46
+45
+48
+47
+45
+50
+46
+45
+48
+47
+45
+48
+47
+45
+48
+47
+45
+48
+47
+45
+50
+45
+49
+56
+44
+58
+53
+41
+53
+49
+43
+43
+54
+54
+44
+71
+76
+56
+96
+104
+81
+122
+131
+112
+136
+146
+135
+141
+151
+150
+143
+154
+160
+141
+153
+165
+134
+150
+163
+135
+155
+162
+144
+170
+169
+155
+185
+177
+160
+192
+179
+152
+183
+168
+154
+182
+167
+155
+183
+168
+152
+183
+165
+145
+177
+156
+137
+171
+146
+137
+171
+144
+144
+177
+148
+146
+179
+150
+149
+180
+149
+144
+173
+143
+136
+162
+133
+132
+155
+129
+123
+146
+120
+103
+122
+100
+84
+98
+73
+81
+84
+57
+85
+84
+56
+86
+85
+57
+44
+48
+51
+44
+48
+51
+44
+48
+51
+44
+48
+51
+46
+47
+49
+46
+47
+49
+47
+47
+47
+47
+47
+47
+46
+46
+46
+46
+46
+46
+47
+46
+44
+46
+45
+43
+46
+45
+43
+46
+45
+43
+45
+44
+42
+45
+44
+42
+45
+43
+44
+45
+43
+44
+45
+43
+44
+44
+42
+43
+43
+41
+42
+42
+40
+41
+42
+40
+41
+42
+40
+41
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+44
+42
+43
+44
+42
+43
+43
+41
+42
+43
+41
+42
+43
+41
+42
+42
+40
+41
+42
+40
+41
+42
+40
+41
+44
+42
+43
+44
+42
+43
+44
+42
+43
+45
+43
+44
+46
+44
+45
+46
+44
+45
+47
+45
+46
+47
+45
+46
+47
+43
+42
+47
+43
+42
+48
+44
+43
+48
+44
+43
+47
+43
+42
+47
+43
+42
+46
+42
+41
+45
+41
+40
+48
+44
+43
+48
+44
+43
+47
+43
+42
+48
+44
+43
+49
+45
+44
+50
+46
+45
+51
+47
+46
+52
+48
+47
+58
+49
+50
+58
+49
+50
+59
+51
+49
+60
+52
+50
+61
+51
+50
+60
+50
+49
+60
+50
+48
+59
+49
+47
+61
+50
+48
+60
+49
+47
+62
+48
+45
+62
+48
+45
+63
+49
+46
+64
+50
+47
+65
+52
+46
+63
+52
+46
+64
+53
+49
+64
+55
+50
+64
+57
+51
+65
+58
+52
+66
+57
+52
+67
+56
+52
+70
+55
+52
+72
+53
+47
+81
+53
+49
+88
+53
+47
+97
+54
+47
+108
+56
+45
+117
+57
+46
+128
+60
+47
+134
+62
+48
+139
+61
+49
+147
+63
+53
+149
+62
+53
+147
+63
+53
+147
+63
+52
+149
+66
+52
+154
+66
+52
+160
+67
+52
+165
+68
+52
+172
+66
+53
+176
+68
+56
+180
+69
+58
+177
+69
+59
+170
+66
+55
+161
+63
+52
+154
+62
+49
+150
+62
+48
+149
+63
+46
+148
+63
+43
+147
+61
+44
+147
+61
+44
+147
+60
+43
+147
+60
+43
+148
+60
+46
+148
+60
+46
+147
+59
+45
+146
+60
+45
+143
+60
+46
+141
+59
+45
+138
+59
+44
+137
+60
+44
+135
+59
+43
+135
+59
+43
+134
+58
+42
+134
+58
+42
+133
+57
+41
+131
+58
+41
+131
+58
+43
+129
+57
+42
+127
+57
+45
+127
+57
+45
+128
+60
+49
+127
+60
+51
+127
+63
+54
+128
+65
+56
+130
+67
+60
+133
+70
+63
+136
+73
+66
+138
+73
+67
+142
+74
+65
+144
+71
+62
+151
+72
+67
+159
+78
+74
+167
+86
+82
+167
+96
+90
+169
+112
+101
+164
+131
+114
+156
+148
+125
+150
+161
+131
+143
+168
+138
+136
+167
+136
+131
+160
+132
+126
+150
+126
+121
+136
+117
+112
+123
+106
+100
+112
+92
+93
+105
+83
+82
+94
+74
+74
+83
+64
+66
+75
+58
+62
+69
+53
+58
+64
+50
+57
+60
+49
+51
+52
+44
+50
+50
+42
+49
+46
+41
+47
+44
+39
+47
+41
+41
+48
+42
+42
+49
+43
+43
+50
+44
+44
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+49
+43
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+47
+46
+44
+47
+46
+44
+47
+46
+44
+50
+44
+46
+56
+42
+55
+53
+40
+49
+51
+43
+40
+53
+54
+38
+69
+75
+49
+92
+103
+71
+117
+130
+100
+134
+147
+121
+142
+155
+138
+145
+158
+148
+144
+159
+154
+139
+158
+152
+141
+165
+151
+151
+180
+158
+162
+197
+165
+169
+206
+173
+165
+201
+173
+166
+202
+176
+167
+203
+177
+164
+200
+172
+151
+190
+159
+139
+179
+145
+136
+176
+141
+141
+178
+144
+142
+178
+142
+144
+178
+143
+141
+172
+138
+132
+161
+130
+128
+153
+123
+119
+142
+114
+100
+120
+93
+81
+95
+69
+77
+81
+54
+81
+81
+53
+82
+81
+53
+44
+48
+51
+44
+48
+51
+44
+48
+51
+44
+48
+51
+46
+47
+49
+46
+47
+49
+46
+47
+49
+46
+47
+49
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+46
+44
+47
+46
+44
+46
+45
+43
+46
+45
+43
+47
+45
+46
+46
+44
+45
+46
+44
+45
+45
+43
+44
+44
+42
+43
+43
+41
+42
+43
+41
+42
+42
+40
+41
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+42
+40
+41
+42
+40
+41
+42
+40
+41
+41
+39
+40
+41
+39
+40
+43
+41
+42
+43
+41
+42
+44
+42
+43
+45
+43
+44
+46
+44
+45
+46
+44
+45
+47
+45
+46
+47
+45
+46
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+47
+43
+42
+46
+42
+41
+45
+41
+40
+44
+40
+39
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+49
+45
+44
+50
+46
+45
+52
+48
+47
+52
+48
+47
+58
+49
+50
+59
+50
+51
+59
+50
+51
+60
+51
+52
+61
+51
+50
+60
+50
+49
+60
+50
+49
+59
+49
+48
+60
+49
+47
+60
+49
+47
+62
+48
+47
+61
+47
+46
+62
+48
+45
+62
+48
+45
+63
+49
+46
+62
+51
+47
+61
+54
+48
+59
+54
+48
+59
+56
+51
+60
+57
+52
+61
+58
+53
+62
+57
+51
+64
+55
+50
+67
+54
+48
+71
+52
+46
+79
+52
+43
+89
+52
+43
+100
+53
+43
+110
+56
+44
+120
+58
+45
+127
+59
+46
+133
+59
+46
+143
+60
+52
+145
+60
+53
+144
+62
+51
+143
+64
+51
+144
+65
+50
+147
+66
+49
+151
+65
+50
+153
+64
+48
+160
+62
+49
+166
+64
+52
+170
+66
+55
+170
+66
+57
+165
+64
+54
+159
+62
+53
+151
+61
+50
+149
+63
+50
+146
+63
+45
+146
+63
+45
+145
+62
+44
+144
+61
+43
+145
+59
+42
+145
+59
+42
+146
+60
+45
+146
+60
+45
+145
+59
+46
+145
+59
+46
+142
+59
+45
+141
+59
+45
+138
+59
+46
+136
+58
+45
+134
+58
+44
+132
+59
+44
+133
+57
+41
+133
+57
+41
+131
+58
+41
+130
+57
+40
+130
+57
+42
+129
+57
+42
+126
+56
+44
+126
+56
+44
+128
+60
+49
+128
+61
+52
+128
+64
+55
+129
+66
+57
+132
+69
+62
+133
+73
+65
+136
+75
+70
+140
+77
+70
+140
+73
+65
+142
+72
+64
+152
+74
+70
+161
+83
+79
+168
+93
+88
+169
+104
+98
+169
+123
+110
+164
+142
+121
+153
+156
+129
+146
+167
+134
+137
+172
+139
+130
+170
+136
+128
+161
+132
+127
+153
+128
+126
+139
+119
+120
+129
+110
+106
+120
+97
+100
+114
+91
+90
+104
+81
+81
+93
+73
+73
+84
+67
+67
+76
+59
+62
+68
+54
+60
+63
+52
+54
+55
+47
+52
+52
+44
+51
+48
+43
+48
+43
+39
+49
+40
+41
+49
+40
+41
+50
+41
+42
+52
+43
+44
+50
+41
+42
+50
+41
+42
+50
+41
+42
+50
+41
+42
+50
+41
+42
+48
+42
+42
+48
+42
+42
+48
+42
+42
+49
+43
+43
+49
+43
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+49
+43
+45
+54
+41
+50
+53
+41
+45
+52
+45
+37
+52
+54
+33
+65
+72
+38
+87
+99
+59
+113
+128
+87
+130
+146
+109
+141
+156
+125
+144
+160
+134
+144
+162
+140
+139
+161
+138
+141
+168
+137
+149
+184
+142
+160
+200
+148
+164
+208
+157
+169
+211
+171
+168
+210
+174
+167
+209
+173
+161
+203
+165
+147
+189
+151
+133
+175
+135
+130
+172
+132
+135
+176
+134
+136
+174
+133
+140
+177
+136
+139
+171
+134
+129
+159
+123
+123
+148
+116
+113
+136
+107
+95
+115
+87
+77
+93
+66
+73
+79
+51
+74
+77
+48
+76
+76
+48
+46
+47
+49
+44
+48
+49
+46
+47
+49
+46
+47
+49
+46
+48
+47
+46
+48
+47
+46
+48
+47
+47
+47
+47
+48
+48
+46
+48
+48
+46
+48
+48
+46
+48
+47
+45
+48
+47
+45
+48
+47
+43
+47
+46
+44
+49
+45
+44
+50
+46
+45
+49
+45
+44
+49
+45
+44
+48
+44
+43
+47
+43
+44
+44
+42
+43
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+42
+43
+41
+44
+43
+41
+42
+43
+41
+44
+43
+41
+42
+45
+40
+44
+42
+40
+41
+44
+40
+41
+41
+39
+40
+41
+39
+40
+40
+38
+39
+42
+40
+41
+43
+41
+42
+44
+42
+43
+44
+43
+41
+45
+43
+44
+46
+45
+43
+47
+46
+44
+47
+46
+44
+45
+44
+42
+45
+44
+42
+47
+43
+42
+47
+43
+42
+46
+42
+41
+45
+41
+40
+44
+40
+39
+44
+40
+39
+49
+45
+44
+50
+45
+42
+50
+45
+42
+50
+45
+42
+51
+46
+43
+52
+47
+44
+53
+48
+45
+54
+49
+46
+59
+51
+49
+59
+51
+49
+60
+52
+50
+60
+52
+50
+61
+51
+49
+60
+50
+48
+59
+49
+47
+59
+49
+47
+60
+49
+47
+60
+49
+47
+61
+47
+46
+61
+47
+46
+61
+47
+44
+62
+48
+45
+63
+49
+46
+61
+50
+46
+62
+51
+45
+61
+54
+46
+60
+55
+49
+57
+57
+49
+57
+58
+50
+58
+58
+50
+59
+56
+49
+63
+54
+47
+67
+50
+43
+74
+49
+44
+84
+50
+41
+94
+51
+42
+104
+54
+43
+111
+57
+45
+118
+60
+46
+123
+59
+47
+135
+61
+50
+139
+61
+51
+139
+63
+50
+140
+64
+50
+142
+64
+51
+143
+64
+49
+146
+63
+49
+149
+61
+47
+152
+60
+47
+156
+62
+50
+162
+66
+54
+161
+67
+55
+158
+66
+55
+153
+63
+52
+150
+62
+50
+148
+62
+49
+148
+62
+47
+147
+61
+46
+144
+61
+45
+142
+61
+44
+142
+61
+44
+140
+61
+44
+140
+61
+46
+141
+62
+47
+142
+60
+46
+142
+60
+46
+139
+60
+47
+138
+59
+46
+136
+58
+45
+135
+59
+45
+132
+59
+44
+132
+59
+44
+130
+58
+43
+128
+59
+43
+127
+58
+42
+126
+59
+42
+126
+59
+43
+124
+58
+42
+124
+58
+44
+124
+58
+46
+128
+62
+50
+129
+62
+53
+128
+64
+54
+130
+67
+58
+133
+70
+61
+133
+74
+66
+136
+77
+69
+139
+79
+71
+140
+73
+67
+142
+73
+68
+147
+80
+74
+152
+92
+84
+157
+104
+96
+157
+117
+105
+158
+135
+117
+157
+153
+128
+147
+162
+133
+143
+170
+137
+137
+172
+139
+129
+169
+135
+127
+162
+132
+125
+155
+127
+122
+144
+121
+116
+136
+111
+103
+126
+98
+98
+121
+93
+92
+112
+85
+85
+103
+79
+78
+93
+72
+71
+82
+65
+64
+73
+56
+61
+65
+51
+56
+56
+46
+56
+53
+46
+53
+48
+44
+51
+43
+41
+50
+40
+41
+50
+40
+41
+51
+41
+42
+52
+42
+43
+50
+41
+44
+48
+42
+42
+48
+42
+44
+50
+41
+42
+50
+41
+44
+50
+41
+44
+50
+41
+44
+50
+41
+44
+51
+42
+45
+51
+42
+45
+49
+43
+45
+49
+43
+45
+48
+44
+45
+48
+44
+45
+48
+44
+45
+49
+43
+47
+52
+41
+47
+52
+42
+43
+52
+45
+37
+52
+54
+33
+63
+70
+37
+84
+96
+56
+109
+124
+81
+129
+144
+103
+137
+153
+116
+141
+158
+122
+141
+161
+126
+136
+161
+122
+138
+167
+123
+145
+182
+130
+155
+196
+136
+159
+203
+144
+159
+201
+153
+158
+199
+157
+157
+198
+154
+152
+193
+149
+140
+183
+138
+130
+173
+128
+133
+174
+130
+140
+181
+137
+132
+171
+127
+137
+174
+133
+137
+169
+130
+126
+156
+120
+118
+143
+111
+108
+131
+102
+90
+110
+83
+74
+90
+63
+70
+76
+50
+70
+74
+47
+70
+72
+48
+47
+48
+43
+46
+48
+43
+47
+48
+43
+48
+49
+44
+48
+49
+44
+48
+49
+44
+49
+50
+45
+50
+49
+45
+51
+50
+46
+52
+51
+47
+52
+51
+47
+54
+50
+47
+53
+49
+46
+52
+49
+44
+51
+47
+44
+52
+47
+44
+53
+48
+45
+53
+48
+45
+52
+47
+44
+51
+46
+43
+50
+44
+44
+49
+45
+44
+48
+44
+43
+48
+44
+43
+46
+44
+45
+46
+44
+45
+45
+45
+47
+45
+45
+47
+44
+44
+46
+43
+43
+45
+42
+41
+46
+41
+41
+43
+46
+41
+47
+46
+41
+45
+47
+40
+47
+46
+41
+45
+47
+41
+45
+46
+41
+45
+46
+42
+43
+46
+42
+43
+47
+43
+42
+47
+43
+42
+45
+44
+42
+46
+45
+41
+45
+45
+43
+45
+46
+41
+46
+47
+42
+46
+47
+42
+45
+45
+45
+45
+45
+45
+46
+44
+45
+47
+45
+46
+47
+46
+44
+48
+47
+45
+50
+46
+43
+50
+46
+43
+50
+45
+42
+52
+44
+41
+53
+45
+42
+54
+46
+43
+56
+47
+42
+58
+49
+44
+58
+49
+42
+59
+50
+43
+61
+52
+45
+61
+52
+45
+62
+53
+48
+62
+53
+48
+62
+53
+48
+61
+52
+47
+60
+51
+46
+59
+50
+45
+61
+50
+46
+60
+49
+45
+60
+49
+47
+59
+48
+46
+61
+47
+46
+62
+48
+47
+62
+48
+47
+64
+49
+46
+66
+47
+41
+66
+49
+41
+60
+51
+42
+57
+54
+45
+53
+56
+45
+52
+55
+46
+54
+54
+46
+59
+50
+45
+64
+45
+41
+71
+41
+39
+79
+39
+39
+86
+41
+38
+91
+46
+40
+97
+53
+44
+102
+60
+48
+109
+63
+48
+121
+65
+48
+127
+64
+47
+134
+65
+49
+139
+66
+51
+143
+64
+51
+147
+61
+48
+147
+59
+47
+146
+56
+45
+147
+59
+47
+147
+61
+46
+148
+65
+49
+149
+66
+50
+148
+67
+50
+146
+65
+48
+145
+62
+46
+145
+59
+44
+151
+59
+48
+151
+58
+50
+146
+59
+49
+140
+61
+48
+136
+63
+48
+132
+63
+47
+130
+63
+46
+130
+63
+46
+136
+64
+49
+136
+63
+48
+138
+62
+49
+137
+61
+48
+136
+60
+47
+135
+59
+46
+132
+58
+45
+131
+59
+45
+123
+57
+43
+126
+64
+51
+118
+60
+46
+112
+56
+41
+118
+62
+45
+118
+62
+45
+118
+59
+45
+125
+63
+50
+125
+59
+47
+131
+63
+52
+136
+68
+57
+139
+72
+63
+138
+76
+65
+135
+77
+66
+133
+79
+67
+135
+78
+69
+144
+76
+73
+149
+84
+80
+147
+99
+89
+142
+113
+97
+138
+125
+106
+134
+138
+113
+135
+151
+124
+136
+159
+130
+139
+166
+135
+138
+167
+137
+139
+168
+138
+138
+168
+140
+132
+165
+136
+124
+161
+130
+114
+155
+123
+110
+151
+117
+104
+142
+105
+97
+133
+95
+91
+122
+88
+89
+116
+85
+90
+110
+83
+86
+101
+78
+79
+88
+69
+73
+75
+61
+66
+63
+54
+64
+57
+51
+58
+48
+46
+53
+43
+42
+51
+39
+41
+51
+39
+43
+51
+39
+43
+49
+38
+42
+47
+41
+45
+45
+41
+42
+45
+40
+44
+45
+39
+41
+47
+38
+43
+49
+38
+44
+51
+38
+45
+51
+38
+45
+52
+39
+46
+52
+39
+46
+51
+40
+48
+50
+40
+48
+48
+41
+49
+47
+42
+49
+47
+42
+49
+47
+42
+48
+47
+41
+45
+49
+43
+43
+48
+45
+40
+47
+47
+35
+60
+63
+42
+86
+92
+64
+112
+122
+88
+127
+139
+103
+141
+156
+117
+139
+157
+115
+140
+161
+118
+140
+166
+119
+138
+168
+118
+137
+170
+117
+142
+180
+123
+153
+191
+134
+159
+193
+143
+157
+190
+143
+150
+186
+138
+143
+179
+131
+136
+174
+125
+133
+171
+124
+131
+170
+123
+133
+170
+126
+131
+168
+125
+131
+166
+126
+128
+158
+124
+121
+148
+117
+114
+137
+109
+104
+124
+99
+89
+107
+85
+77
+90
+70
+74
+82
+61
+68
+73
+51
+62
+65
+46
+47
+48
+42
+48
+49
+43
+48
+49
+43
+48
+49
+43
+49
+50
+44
+49
+50
+44
+50
+49
+44
+51
+50
+45
+52
+51
+46
+52
+51
+46
+55
+52
+47
+55
+52
+47
+54
+51
+46
+53
+50
+45
+53
+48
+44
+53
+48
+44
+55
+47
+44
+55
+47
+44
+54
+46
+44
+54
+46
+44
+51
+46
+43
+50
+45
+42
+48
+44
+43
+48
+44
+43
+48
+44
+45
+47
+45
+46
+47
+45
+48
+45
+45
+47
+45
+44
+49
+43
+42
+47
+41
+42
+46
+41
+40
+45
+46
+41
+47
+47
+40
+47
+47
+40
+47
+47
+40
+47
+47
+41
+45
+47
+41
+45
+46
+42
+43
+46
+42
+43
+47
+43
+42
+47
+43
+42
+46
+45
+41
+46
+45
+41
+46
+47
+42
+46
+47
+42
+46
+47
+41
+46
+47
+42
+46
+46
+46
+46
+46
+48
+46
+46
+46
+46
+46
+46
+47
+46
+44
+47
+46
+44
+49
+45
+42
+51
+46
+43
+53
+45
+42
+53
+46
+40
+55
+46
+41
+56
+47
+40
+58
+47
+41
+59
+48
+42
+60
+50
+41
+61
+51
+42
+62
+53
+44
+62
+53
+44
+62
+53
+46
+62
+53
+46
+62
+53
+46
+61
+52
+45
+60
+51
+46
+60
+51
+46
+61
+50
+46
+60
+49
+45
+59
+48
+46
+59
+48
+46
+61
+47
+46
+61
+47
+46
+62
+48
+47
+64
+49
+46
+68
+47
+42
+70
+47
+41
+67
+50
+43
+64
+51
+43
+61
+52
+45
+60
+51
+44
+59
+50
+45
+62
+48
+45
+65
+44
+43
+70
+42
+41
+75
+41
+40
+80
+42
+39
+86
+45
+41
+92
+51
+45
+97
+57
+49
+103
+61
+47
+112
+65
+47
+120
+65
+45
+128
+65
+48
+136
+64
+50
+143
+63
+52
+145
+61
+51
+147
+58
+50
+147
+59
+49
+141
+57
+46
+139
+60
+47
+139
+62
+46
+140
+64
+48
+141
+65
+49
+141
+65
+49
+142
+65
+47
+145
+63
+49
+149
+59
+50
+149
+59
+50
+144
+60
+50
+139
+61
+48
+134
+62
+48
+131
+64
+47
+129
+63
+47
+129
+64
+46
+133
+64
+49
+134
+62
+47
+135
+61
+48
+136
+60
+46
+133
+59
+46
+132
+59
+44
+130
+58
+44
+127
+60
+44
+119
+57
+44
+119
+61
+49
+112
+59
+45
+109
+57
+43
+114
+63
+46
+114
+63
+46
+113
+57
+42
+117
+58
+44
+127
+61
+49
+132
+64
+53
+138
+68
+58
+140
+72
+61
+138
+74
+64
+135
+77
+65
+133
+79
+67
+136
+77
+69
+144
+74
+72
+149
+84
+82
+145
+102
+93
+138
+119
+102
+131
+135
+112
+127
+147
+119
+128
+159
+127
+131
+166
+134
+134
+167
+136
+139
+168
+138
+143
+167
+141
+143
+167
+141
+136
+165
+137
+127
+160
+131
+117
+156
+125
+109
+153
+118
+100
+147
+105
+94
+139
+96
+89
+130
+90
+89
+123
+88
+90
+119
+88
+88
+111
+83
+82
+97
+74
+77
+86
+67
+69
+73
+59
+65
+65
+55
+59
+56
+51
+53
+48
+45
+51
+42
+43
+50
+41
+42
+49
+40
+43
+46
+40
+42
+49
+40
+43
+48
+39
+44
+48
+39
+44
+48
+39
+44
+49
+38
+44
+51
+38
+45
+52
+39
+48
+52
+39
+48
+52
+39
+48
+51
+40
+48
+50
+40
+49
+48
+41
+49
+47
+42
+49
+45
+42
+51
+44
+43
+51
+44
+43
+49
+50
+45
+49
+50
+46
+45
+48
+44
+41
+45
+45
+37
+56
+58
+44
+83
+88
+66
+111
+120
+93
+128
+139
+105
+135
+150
+111
+134
+153
+108
+134
+158
+110
+136
+163
+112
+134
+164
+112
+132
+165
+112
+138
+173
+119
+147
+182
+128
+153
+185
+135
+150
+182
+132
+147
+179
+129
+140
+174
+123
+134
+171
+120
+130
+168
+119
+130
+168
+121
+131
+168
+124
+131
+166
+124
+130
+164
+127
+127
+157
+123
+120
+146
+117
+113
+136
+110
+104
+123
+101
+89
+106
+87
+77
+90
+72
+70
+77
+59
+64
+68
+51
+59
+62
+45
+49
+50
+44
+49
+50
+44
+49
+50
+44
+49
+50
+44
+50
+51
+45
+50
+51
+45
+52
+51
+46
+52
+51
+46
+53
+52
+47
+53
+52
+47
+56
+53
+48
+56
+53
+48
+56
+53
+48
+55
+52
+47
+55
+50
+46
+54
+49
+45
+56
+48
+45
+56
+48
+45
+55
+47
+44
+54
+46
+43
+52
+47
+44
+51
+46
+43
+50
+44
+44
+49
+45
+44
+49
+45
+46
+47
+45
+46
+48
+46
+49
+47
+45
+48
+45
+45
+47
+44
+44
+46
+43
+42
+47
+43
+41
+46
+47
+40
+47
+49
+39
+47
+47
+41
+45
+47
+41
+45
+47
+41
+45
+47
+41
+45
+46
+42
+43
+46
+42
+43
+48
+44
+43
+48
+44
+43
+47
+46
+42
+47
+46
+42
+47
+46
+41
+48
+47
+42
+48
+47
+42
+48
+47
+43
+47
+47
+45
+47
+47
+47
+48
+46
+47
+48
+46
+47
+48
+47
+45
+47
+46
+44
+49
+45
+42
+50
+45
+42
+54
+46
+43
+55
+48
+42
+57
+48
+43
+58
+49
+42
+60
+49
+43
+61
+51
+42
+62
+52
+43
+63
+53
+44
+63
+54
+45
+63
+54
+45
+64
+55
+46
+64
+55
+46
+63
+54
+47
+62
+53
+46
+61
+52
+45
+61
+52
+45
+61
+50
+46
+60
+49
+45
+59
+48
+46
+59
+48
+46
+59
+48
+46
+59
+48
+46
+60
+49
+47
+63
+49
+46
+68
+49
+43
+71
+47
+43
+74
+46
+43
+76
+44
+45
+79
+43
+47
+78
+42
+46
+74
+42
+47
+71
+42
+46
+68
+44
+44
+65
+46
+42
+66
+45
+40
+70
+45
+40
+79
+46
+41
+89
+48
+42
+99
+50
+45
+105
+52
+44
+107
+58
+44
+111
+59
+45
+119
+59
+48
+129
+61
+52
+135
+60
+54
+140
+60
+53
+141
+58
+52
+141
+58
+52
+138
+60
+50
+135
+61
+50
+134
+62
+50
+133
+63
+51
+134
+65
+50
+137
+65
+51
+140
+66
+53
+143
+67
+53
+142
+63
+50
+143
+61
+47
+140
+62
+49
+138
+62
+46
+135
+62
+47
+133
+62
+44
+134
+61
+46
+134
+61
+44
+137
+59
+46
+137
+60
+44
+136
+58
+45
+134
+58
+42
+132
+59
+44
+128
+60
+41
+126
+61
+43
+122
+61
+43
+124
+62
+49
+120
+60
+49
+117
+59
+47
+116
+60
+47
+118
+65
+49
+118
+65
+49
+117
+61
+46
+118
+59
+45
+127
+63
+53
+132
+65
+56
+138
+70
+61
+140
+72
+63
+138
+74
+65
+137
+74
+65
+136
+78
+67
+140
+77
+70
+147
+73
+72
+153
+83
+81
+151
+101
+92
+146
+117
+101
+138
+132
+110
+131
+144
+116
+129
+156
+123
+130
+164
+131
+134
+168
+135
+138
+169
+137
+143
+169
+140
+145
+168
+140
+144
+164
+137
+138
+158
+131
+130
+153
+125
+122
+151
+120
+107
+149
+109
+97
+146
+101
+92
+139
+97
+92
+134
+96
+93
+130
+96
+91
+124
+93
+85
+114
+86
+80
+104
+80
+70
+89
+69
+66
+80
+63
+58
+68
+57
+51
+58
+50
+46
+51
+44
+42
+47
+41
+40
+45
+41
+43
+42
+40
+50
+38
+40
+53
+36
+42
+53
+36
+42
+53
+36
+42
+52
+37
+42
+53
+38
+43
+51
+40
+46
+51
+42
+47
+48
+42
+46
+47
+42
+46
+44
+43
+48
+43
+44
+48
+41
+45
+48
+40
+45
+49
+38
+46
+49
+40
+45
+48
+49
+47
+50
+51
+47
+46
+46
+42
+39
+42
+42
+34
+53
+55
+42
+80
+85
+65
+109
+118
+91
+124
+138
+105
+128
+144
+107
+126
+147
+106
+127
+153
+106
+131
+159
+110
+128
+160
+110
+126
+160
+109
+128
+165
+113
+135
+172
+120
+141
+175
+124
+139
+173
+122
+136
+170
+120
+132
+169
+118
+129
+167
+118
+127
+167
+117
+127
+166
+119
+127
+166
+121
+127
+164
+121
+128
+162
+125
+125
+155
+121
+119
+145
+116
+112
+135
+109
+104
+124
+99
+89
+107
+85
+77
+90
+70
+69
+73
+58
+62
+64
+50
+57
+58
+44
+50
+51
+45
+50
+51
+45
+51
+52
+46
+51
+52
+46
+51
+52
+46
+52
+53
+47
+53
+52
+47
+53
+52
+47
+54
+53
+48
+55
+54
+49
+57
+54
+49
+58
+55
+50
+58
+55
+50
+57
+54
+49
+57
+52
+48
+57
+52
+48
+58
+50
+47
+57
+49
+46
+57
+49
+46
+56
+48
+45
+53
+48
+45
+52
+47
+44
+52
+46
+46
+52
+46
+46
+51
+47
+48
+51
+47
+48
+49
+47
+48
+49
+47
+50
+48
+46
+49
+46
+46
+48
+45
+45
+47
+45
+43
+46
+48
+41
+48
+50
+41
+46
+48
+42
+46
+48
+42
+46
+48
+42
+46
+48
+42
+44
+47
+43
+44
+47
+43
+42
+49
+45
+44
+49
+45
+44
+48
+47
+43
+48
+47
+43
+49
+48
+43
+49
+48
+43
+49
+48
+43
+49
+48
+44
+49
+49
+47
+49
+49
+49
+49
+47
+48
+49
+48
+46
+49
+48
+46
+50
+46
+43
+51
+46
+43
+51
+46
+42
+57
+50
+44
+57
+50
+44
+59
+50
+43
+60
+51
+44
+62
+52
+43
+64
+54
+45
+64
+54
+45
+65
+55
+46
+66
+56
+47
+65
+56
+47
+66
+57
+48
+65
+56
+47
+65
+56
+49
+64
+55
+48
+62
+53
+46
+62
+53
+46
+61
+50
+46
+61
+50
+46
+60
+49
+47
+59
+48
+46
+59
+48
+46
+60
+49
+47
+61
+50
+48
+63
+49
+46
+66
+51
+46
+70
+49
+46
+77
+45
+46
+84
+41
+48
+88
+38
+47
+87
+37
+46
+81
+38
+47
+75
+40
+46
+68
+47
+46
+62
+49
+43
+60
+50
+41
+64
+50
+41
+72
+47
+40
+84
+47
+41
+96
+45
+42
+101
+46
+41
+105
+57
+47
+107
+59
+47
+117
+60
+51
+125
+60
+54
+133
+59
+56
+137
+59
+57
+138
+59
+55
+136
+58
+54
+137
+62
+56
+134
+64
+56
+134
+66
+57
+133
+66
+57
+133
+67
+55
+134
+66
+55
+135
+65
+55
+137
+65
+53
+137
+64
+49
+137
+64
+47
+136
+63
+46
+136
+63
+46
+135
+62
+45
+136
+60
+44
+136
+59
+43
+137
+58
+43
+138
+56
+42
+138
+56
+42
+136
+57
+42
+133
+57
+41
+130
+59
+41
+125
+60
+40
+122
+61
+40
+120
+62
+42
+127
+64
+49
+122
+55
+46
+120
+56
+46
+120
+60
+49
+117
+59
+45
+118
+62
+47
+123
+65
+51
+123
+64
+50
+128
+66
+55
+132
+68
+58
+135
+71
+61
+137
+73
+63
+136
+73
+64
+138
+75
+66
+138
+78
+68
+140
+80
+72
+144
+81
+74
+147
+90
+81
+148
+101
+91
+143
+114
+98
+137
+125
+103
+132
+136
+109
+131
+147
+118
+131
+156
+124
+135
+165
+131
+136
+167
+135
+139
+168
+137
+143
+168
+138
+143
+163
+135
+139
+158
+130
+136
+152
+126
+127
+150
+121
+114
+148
+111
+108
+146
+105
+104
+142
+103
+102
+140
+101
+103
+139
+103
+100
+134
+101
+96
+125
+95
+92
+118
+91
+81
+103
+80
+76
+93
+74
+66
+80
+63
+57
+68
+54
+50
+58
+47
+46
+52
+42
+44
+47
+40
+45
+42
+37
+53
+37
+38
+56
+35
+40
+56
+35
+40
+55
+36
+40
+52
+37
+40
+51
+39
+43
+50
+41
+44
+48
+44
+45
+44
+42
+43
+43
+43
+45
+42
+43
+45
+40
+44
+45
+39
+44
+47
+39
+44
+47
+37
+45
+47
+40
+44
+45
+46
+42
+43
+49
+43
+43
+48
+43
+39
+46
+43
+34
+56
+56
+44
+80
+85
+65
+105
+113
+89
+118
+132
+99
+123
+140
+104
+121
+143
+104
+124
+150
+105
+127
+156
+108
+125
+159
+109
+121
+158
+107
+122
+160
+109
+127
+165
+114
+130
+167
+116
+128
+165
+113
+125
+163
+112
+125
+163
+112
+125
+165
+115
+126
+165
+118
+126
+165
+120
+125
+164
+120
+124
+161
+120
+125
+159
+122
+122
+153
+119
+117
+144
+113
+110
+135
+106
+101
+124
+98
+87
+107
+82
+78
+91
+71
+69
+71
+57
+63
+61
+48
+57
+55
+42
+52
+53
+47
+52
+53
+47
+52
+53
+47
+53
+54
+48
+53
+54
+48
+53
+54
+48
+55
+54
+49
+55
+54
+49
+56
+55
+50
+56
+55
+50
+59
+56
+51
+60
+57
+52
+60
+57
+52
+60
+57
+52
+60
+55
+51
+60
+55
+51
+60
+52
+49
+60
+52
+49
+59
+51
+48
+59
+51
+48
+56
+51
+48
+55
+50
+47
+54
+49
+46
+54
+49
+46
+53
+49
+48
+54
+50
+49
+54
+50
+49
+51
+49
+50
+50
+48
+49
+49
+47
+48
+48
+46
+47
+49
+45
+46
+50
+44
+48
+52
+43
+46
+52
+43
+46
+52
+43
+46
+50
+44
+46
+50
+44
+44
+50
+44
+44
+50
+44
+44
+51
+47
+46
+51
+47
+44
+51
+47
+44
+51
+47
+44
+50
+49
+44
+50
+49
+44
+51
+50
+45
+51
+50
+46
+51
+50
+48
+51
+50
+48
+51
+50
+48
+51
+50
+48
+53
+49
+48
+53
+49
+46
+54
+49
+46
+54
+49
+45
+59
+52
+46
+60
+53
+47
+61
+52
+45
+63
+54
+45
+65
+55
+46
+66
+56
+47
+69
+56
+47
+67
+57
+47
+68
+58
+49
+68
+58
+49
+69
+59
+50
+68
+58
+49
+67
+57
+48
+66
+56
+47
+64
+53
+47
+64
+53
+47
+62
+51
+47
+62
+51
+47
+61
+50
+46
+61
+50
+46
+61
+50
+48
+61
+50
+48
+62
+51
+49
+62
+51
+49
+66
+52
+49
+70
+50
+49
+78
+48
+50
+85
+44
+52
+90
+40
+51
+89
+39
+50
+83
+40
+49
+76
+44
+49
+68
+50
+48
+60
+53
+45
+57
+55
+43
+60
+54
+42
+68
+51
+41
+78
+49
+41
+90
+47
+41
+94
+47
+41
+102
+58
+49
+106
+59
+51
+115
+60
+55
+122
+61
+58
+130
+60
+58
+134
+60
+59
+135
+59
+59
+134
+58
+58
+130
+59
+55
+129
+62
+56
+129
+65
+56
+129
+66
+57
+131
+67
+58
+131
+67
+58
+133
+64
+57
+132
+64
+55
+132
+66
+50
+132
+67
+49
+133
+64
+48
+134
+62
+47
+136
+60
+46
+137
+59
+46
+139
+57
+45
+140
+56
+45
+138
+54
+43
+137
+55
+43
+135
+56
+43
+131
+58
+43
+127
+60
+43
+122
+61
+42
+119
+62
+42
+120
+62
+42
+127
+57
+45
+122
+48
+39
+129
+56
+47
+131
+63
+52
+117
+53
+43
+113
+53
+42
+124
+66
+54
+125
+67
+55
+127
+69
+58
+129
+71
+60
+131
+73
+62
+132
+74
+63
+133
+74
+66
+135
+76
+68
+138
+79
+71
+137
+85
+74
+130
+94
+78
+129
+102
+81
+134
+109
+89
+135
+114
+93
+136
+121
+98
+137
+131
+105
+141
+144
+117
+141
+154
+124
+138
+159
+126
+136
+163
+130
+136
+167
+133
+137
+168
+134
+135
+166
+132
+132
+162
+128
+129
+156
+125
+127
+151
+119
+125
+144
+112
+125
+142
+108
+123
+140
+108
+120
+139
+107
+120
+139
+109
+117
+136
+108
+112
+131
+103
+108
+126
+100
+99
+113
+88
+92
+104
+82
+83
+90
+72
+73
+75
+61
+66
+64
+52
+61
+54
+44
+57
+47
+38
+55
+42
+36
+57
+39
+39
+57
+37
+39
+54
+38
+39
+52
+38
+38
+49
+39
+38
+46
+40
+40
+44
+43
+41
+44
+44
+42
+41
+43
+40
+41
+43
+42
+41
+43
+42
+41
+43
+42
+42
+42
+44
+42
+42
+44
+43
+41
+44
+45
+41
+42
+44
+35
+36
+50
+42
+39
+53
+48
+42
+56
+54
+42
+66
+67
+53
+85
+90
+70
+102
+112
+87
+110
+125
+94
+116
+136
+101
+113
+138
+98
+117
+144
+101
+120
+152
+105
+119
+155
+107
+115
+153
+104
+116
+154
+105
+119
+159
+107
+122
+162
+110
+120
+160
+108
+119
+159
+109
+120
+160
+110
+121
+163
+115
+123
+165
+117
+123
+165
+119
+124
+163
+119
+121
+158
+117
+122
+156
+119
+119
+150
+116
+115
+142
+111
+109
+134
+104
+100
+123
+95
+87
+107
+80
+78
+92
+69
+68
+69
+55
+62
+58
+47
+56
+52
+41
+53
+54
+48
+53
+54
+48
+54
+55
+49
+54
+55
+49
+55
+56
+50
+55
+56
+50
+56
+55
+50
+56
+55
+50
+57
+56
+51
+58
+57
+52
+61
+58
+53
+62
+59
+54
+62
+59
+54
+62
+59
+54
+62
+57
+53
+62
+57
+53
+63
+55
+52
+63
+55
+52
+62
+54
+51
+61
+53
+50
+59
+54
+51
+58
+53
+50
+57
+52
+49
+57
+52
+49
+56
+52
+49
+56
+52
+51
+57
+53
+52
+56
+52
+51
+55
+51
+50
+52
+51
+49
+53
+49
+50
+52
+48
+47
+54
+45
+48
+54
+45
+46
+54
+45
+48
+54
+45
+46
+52
+46
+46
+52
+46
+46
+52
+46
+46
+52
+47
+44
+52
+48
+45
+52
+48
+45
+52
+48
+45
+53
+49
+46
+51
+50
+45
+51
+50
+45
+52
+51
+46
+52
+51
+46
+52
+51
+47
+52
+51
+49
+53
+52
+50
+53
+52
+48
+56
+52
+49
+56
+53
+48
+57
+52
+48
+58
+53
+47
+61
+54
+48
+62
+55
+47
+64
+55
+46
+65
+56
+47
+67
+57
+48
+68
+58
+48
+71
+58
+49
+72
+59
+50
+70
+60
+51
+70
+60
+51
+70
+60
+51
+70
+60
+51
+69
+59
+50
+67
+57
+48
+66
+55
+49
+65
+54
+48
+64
+53
+49
+64
+53
+49
+63
+52
+48
+62
+51
+47
+62
+51
+49
+63
+52
+50
+64
+53
+51
+64
+53
+51
+65
+54
+50
+68
+53
+50
+75
+50
+53
+81
+49
+54
+86
+46
+54
+85
+45
+53
+82
+47
+53
+75
+49
+50
+68
+53
+50
+63
+56
+48
+61
+57
+45
+63
+57
+43
+67
+55
+41
+73
+54
+40
+83
+50
+41
+88
+50
+41
+93
+50
+43
+100
+51
+44
+108
+53
+48
+118
+54
+52
+125
+55
+55
+130
+56
+55
+131
+55
+55
+130
+54
+54
+126
+55
+53
+125
+58
+52
+125
+60
+54
+125
+62
+53
+128
+63
+57
+131
+64
+56
+134
+63
+57
+133
+65
+56
+131
+65
+51
+131
+65
+49
+132
+65
+49
+132
+63
+48
+136
+60
+47
+136
+58
+46
+137
+57
+46
+138
+56
+45
+135
+55
+44
+134
+56
+44
+131
+57
+44
+128
+59
+44
+126
+60
+44
+124
+61
+44
+121
+62
+44
+126
+60
+44
+133
+53
+42
+138
+51
+44
+160
+77
+69
+166
+89
+81
+138
+65
+56
+124
+57
+48
+130
+70
+59
+128
+75
+61
+123
+71
+58
+122
+74
+60
+124
+76
+62
+125
+77
+63
+127
+77
+66
+130
+80
+69
+137
+85
+74
+134
+92
+76
+119
+105
+79
+117
+112
+82
+130
+114
+88
+141
+117
+93
+150
+117
+98
+159
+124
+105
+166
+135
+115
+167
+145
+122
+157
+147
+122
+150
+153
+124
+146
+160
+127
+143
+165
+129
+139
+165
+130
+134
+161
+126
+130
+156
+121
+131
+150
+118
+134
+143
+112
+136
+141
+111
+134
+140
+112
+131
+142
+112
+129
+142
+112
+126
+141
+112
+122
+138
+109
+118
+134
+107
+109
+125
+98
+104
+116
+92
+96
+104
+83
+87
+90
+71
+80
+77
+62
+72
+64
+51
+66
+54
+42
+64
+47
+39
+61
+43
+39
+60
+42
+40
+56
+42
+39
+53
+42
+40
+50
+42
+39
+47
+44
+39
+44
+45
+39
+43
+45
+40
+43
+45
+40
+44
+45
+40
+45
+44
+42
+47
+43
+42
+51
+41
+42
+52
+40
+42
+54
+39
+42
+54
+40
+40
+51
+40
+36
+60
+51
+44
+69
+62
+52
+73
+71
+56
+81
+82
+64
+93
+98
+75
+103
+113
+86
+106
+121
+90
+110
+130
+93
+107
+132
+92
+108
+137
+93
+112
+145
+98
+113
+149
+101
+111
+149
+100
+111
+151
+101
+114
+154
+102
+117
+159
+109
+114
+156
+106
+113
+155
+105
+116
+158
+110
+120
+162
+114
+122
+164
+118
+121
+162
+118
+121
+159
+118
+118
+154
+116
+119
+153
+118
+117
+148
+114
+111
+141
+107
+106
+133
+102
+99
+124
+94
+85
+108
+79
+78
+92
+69
+67
+68
+54
+64
+57
+47
+58
+51
+41
+54
+55
+49
+55
+56
+50
+55
+56
+50
+55
+56
+50
+56
+57
+51
+56
+57
+51
+57
+56
+51
+58
+57
+52
+58
+57
+52
+59
+58
+53
+62
+59
+54
+63
+60
+55
+63
+60
+55
+63
+60
+55
+64
+59
+55
+64
+59
+55
+66
+58
+55
+66
+58
+55
+65
+57
+54
+64
+56
+53
+61
+56
+52
+61
+56
+52
+60
+55
+51
+60
+55
+51
+60
+55
+51
+60
+55
+52
+60
+55
+52
+60
+55
+52
+59
+54
+51
+57
+53
+50
+57
+51
+51
+56
+51
+48
+56
+47
+48
+57
+47
+46
+56
+47
+48
+56
+48
+46
+56
+48
+46
+56
+48
+46
+54
+49
+46
+54
+49
+45
+54
+49
+45
+54
+49
+45
+53
+50
+45
+53
+50
+45
+54
+51
+46
+54
+51
+46
+55
+52
+47
+55
+52
+47
+53
+52
+48
+53
+52
+48
+56
+52
+49
+57
+53
+50
+58
+54
+51
+60
+57
+52
+61
+56
+52
+64
+57
+51
+64
+55
+48
+65
+56
+47
+67
+57
+48
+68
+58
+48
+71
+58
+49
+72
+60
+48
+73
+61
+49
+73
+61
+49
+74
+61
+52
+74
+61
+52
+74
+61
+52
+73
+60
+51
+70
+60
+51
+68
+58
+49
+66
+56
+47
+65
+55
+46
+65
+56
+49
+64
+55
+48
+64
+55
+50
+63
+54
+49
+63
+54
+49
+64
+55
+50
+64
+55
+50
+65
+56
+51
+64
+54
+52
+65
+55
+53
+67
+56
+54
+70
+56
+55
+72
+57
+54
+74
+56
+54
+74
+56
+54
+72
+57
+52
+69
+56
+48
+69
+56
+47
+69
+57
+45
+70
+56
+43
+73
+57
+44
+73
+57
+42
+76
+57
+43
+82
+54
+42
+90
+47
+38
+100
+47
+39
+110
+51
+45
+122
+54
+51
+131
+57
+56
+137
+59
+57
+139
+59
+58
+139
+61
+59
+139
+65
+62
+135
+64
+58
+130
+61
+54
+127
+60
+51
+127
+58
+51
+130
+60
+52
+136
+61
+55
+138
+64
+55
+133
+63
+53
+132
+64
+51
+132
+62
+50
+134
+62
+50
+134
+60
+49
+133
+59
+48
+132
+58
+47
+131
+59
+47
+128
+58
+46
+127
+59
+46
+126
+60
+46
+127
+61
+47
+127
+61
+47
+128
+60
+47
+129
+59
+47
+135
+57
+47
+144
+49
+43
+160
+61
+56
+203
+108
+102
+216
+127
+121
+171
+91
+84
+138
+68
+60
+136
+76
+65
+127
+78
+64
+117
+73
+60
+114
+77
+61
+113
+80
+63
+114
+81
+64
+118
+83
+64
+124
+85
+68
+132
+90
+74
+128
+100
+79
+113
+113
+79
+116
+120
+85
+138
+118
+91
+156
+115
+95
+173
+109
+99
+186
+107
+102
+194
+111
+107
+195
+116
+111
+191
+128
+119
+183
+137
+122
+173
+148
+126
+163
+156
+128
+154
+159
+129
+145
+159
+126
+139
+154
+121
+137
+151
+118
+140
+143
+114
+142
+142
+114
+139
+144
+114
+135
+146
+114
+132
+147
+114
+128
+147
+115
+122
+146
+112
+119
+144
+112
+112
+137
+105
+107
+130
+101
+103
+119
+92
+94
+107
+81
+88
+93
+71
+80
+79
+59
+72
+67
+48
+67
+58
+43
+65
+50
+43
+64
+49
+44
+59
+48
+42
+56
+47
+42
+52
+47
+41
+50
+47
+40
+46
+47
+39
+46
+47
+41
+48
+47
+42
+51
+46
+42
+54
+44
+43
+58
+42
+43
+62
+40
+43
+65
+38
+43
+69
+36
+43
+67
+38
+40
+70
+53
+45
+76
+67
+52
+86
+81
+62
+91
+89
+68
+96
+98
+74
+103
+109
+81
+105
+119
+86
+106
+123
+87
+108
+130
+91
+103
+130
+87
+102
+134
+87
+108
+142
+92
+111
+148
+97
+110
+148
+97
+110
+150
+98
+114
+154
+102
+115
+157
+107
+111
+155
+106
+111
+153
+105
+114
+156
+110
+119
+160
+116
+121
+162
+120
+120
+158
+119
+117
+155
+118
+115
+151
+115
+117
+151
+118
+115
+146
+114
+110
+139
+108
+105
+132
+99
+98
+123
+91
+84
+109
+77
+77
+93
+67
+72
+73
+59
+69
+60
+51
+63
+54
+45
+55
+56
+50
+55
+56
+50
+56
+57
+51
+56
+57
+51
+56
+57
+51
+57
+58
+52
+58
+57
+52
+58
+57
+52
+59
+58
+53
+60
+59
+54
+63
+60
+55
+64
+61
+56
+64
+61
+56
+64
+61
+56
+65
+60
+56
+65
+60
+56
+67
+59
+56
+67
+59
+56
+67
+59
+56
+66
+58
+55
+63
+58
+54
+62
+57
+53
+62
+57
+53
+61
+56
+52
+62
+57
+53
+62
+57
+53
+62
+57
+53
+62
+57
+53
+61
+56
+53
+60
+55
+51
+58
+53
+49
+59
+51
+48
+58
+48
+46
+58
+48
+46
+57
+49
+46
+57
+49
+46
+57
+49
+47
+57
+49
+46
+57
+49
+46
+55
+50
+46
+54
+49
+45
+54
+49
+45
+54
+51
+46
+54
+51
+46
+54
+51
+46
+55
+52
+47
+55
+52
+47
+55
+52
+47
+53
+52
+48
+54
+53
+49
+57
+53
+50
+59
+56
+51
+60
+57
+52
+63
+58
+52
+66
+59
+53
+66
+59
+51
+65
+56
+47
+66
+58
+47
+67
+57
+47
+69
+59
+47
+72
+60
+48
+73
+61
+49
+74
+62
+50
+74
+62
+50
+75
+62
+53
+75
+62
+53
+74
+61
+52
+74
+61
+52
+70
+60
+51
+69
+59
+50
+67
+57
+48
+66
+56
+47
+66
+57
+50
+66
+57
+50
+65
+56
+51
+64
+55
+50
+64
+55
+50
+65
+56
+51
+66
+57
+52
+66
+57
+52
+63
+56
+50
+64
+57
+51
+66
+59
+53
+69
+60
+55
+71
+60
+54
+73
+60
+54
+77
+60
+53
+78
+59
+52
+77
+54
+46
+78
+54
+44
+81
+54
+43
+81
+54
+43
+81
+55
+42
+82
+56
+43
+80
+57
+41
+86
+54
+39
+103
+53
+42
+114
+54
+44
+126
+59
+51
+137
+64
+57
+149
+68
+64
+155
+72
+68
+159
+74
+71
+159
+76
+70
+160
+81
+74
+153
+76
+68
+142
+68
+59
+133
+59
+48
+132
+55
+45
+133
+55
+45
+140
+57
+49
+143
+60
+52
+139
+60
+53
+138
+61
+55
+137
+60
+54
+136
+59
+53
+136
+59
+53
+132
+59
+52
+128
+60
+51
+125
+61
+51
+122
+62
+51
+122
+62
+51
+122
+62
+51
+125
+61
+51
+129
+59
+51
+134
+57
+51
+139
+54
+51
+146
+51
+49
+150
+41
+38
+176
+63
+59
+234
+125
+122
+252
+150
+146
+195
+104
+99
+149
+72
+64
+137
+75
+64
+120
+72
+58
+112
+76
+60
+106
+81
+61
+104
+83
+62
+106
+86
+62
+111
+86
+64
+118
+90
+69
+128
+95
+76
+130
+102
+80
+124
+113
+81
+134
+118
+85
+160
+115
+92
+183
+107
+94
+203
+95
+95
+214
+84
+92
+218
+81
+91
+218
+82
+92
+230
+111
+117
+219
+121
+120
+207
+133
+124
+195
+142
+126
+184
+147
+128
+174
+148
+125
+165
+145
+120
+162
+142
+118
+159
+137
+114
+159
+137
+116
+156
+140
+117
+152
+142
+117
+148
+144
+117
+141
+144
+115
+137
+143
+115
+133
+144
+114
+127
+137
+110
+124
+133
+106
+119
+121
+97
+112
+110
+87
+105
+97
+78
+98
+82
+66
+87
+68
+53
+83
+59
+47
+79
+52
+45
+77
+49
+45
+73
+48
+44
+68
+47
+42
+64
+47
+40
+59
+46
+38
+55
+46
+39
+54
+47
+39
+57
+48
+41
+58
+47
+41
+61
+46
+43
+65
+44
+43
+70
+41
+43
+72
+40
+43
+75
+39
+43
+72
+41
+39
+84
+66
+52
+89
+81
+60
+100
+94
+70
+103
+101
+76
+105
+108
+79
+110
+117
+86
+109
+123
+88
+108
+126
+88
+107
+132
+90
+103
+132
+86
+103
+135
+86
+109
+143
+93
+112
+149
+98
+113
+150
+98
+114
+153
+100
+117
+157
+105
+116
+155
+108
+111
+153
+107
+111
+150
+106
+114
+153
+109
+119
+157
+118
+121
+159
+120
+119
+154
+121
+116
+150
+117
+115
+148
+117
+117
+148
+117
+115
+144
+113
+111
+138
+107
+105
+132
+101
+97
+124
+91
+84
+109
+77
+77
+93
+66
+78
+79
+63
+76
+67
+58
+69
+60
+51
+57
+58
+52
+57
+58
+52
+57
+58
+52
+57
+58
+52
+57
+58
+52
+58
+59
+53
+61
+60
+55
+61
+60
+55
+61
+60
+55
+61
+60
+55
+64
+61
+56
+64
+61
+56
+65
+62
+57
+66
+63
+58
+68
+63
+59
+68
+63
+59
+69
+64
+60
+69
+64
+60
+69
+64
+58
+68
+63
+57
+68
+63
+57
+67
+62
+56
+69
+62
+56
+68
+61
+55
+66
+59
+53
+66
+59
+53
+66
+59
+53
+66
+59
+53
+66
+58
+55
+66
+59
+53
+65
+58
+52
+65
+58
+52
+65
+56
+51
+65
+56
+51
+65
+56
+51
+64
+55
+50
+64
+54
+52
+62
+55
+49
+62
+55
+49
+62
+55
+49
+60
+55
+49
+60
+55
+49
+59
+54
+48
+58
+53
+47
+56
+53
+46
+56
+53
+46
+55
+52
+47
+55
+52
+47
+57
+54
+49
+57
+54
+49
+57
+54
+49
+58
+55
+48
+60
+55
+49
+61
+56
+50
+65
+58
+50
+66
+59
+49
+67
+58
+49
+68
+60
+49
+70
+60
+50
+74
+62
+50
+75
+63
+51
+76
+64
+50
+78
+64
+51
+78
+64
+53
+78
+64
+55
+78
+64
+55
+76
+63
+54
+75
+62
+53
+73
+60
+51
+72
+59
+50
+69
+59
+50
+69
+59
+50
+66
+57
+48
+65
+56
+47
+64
+57
+49
+63
+56
+48
+63
+56
+48
+63
+56
+48
+64
+57
+51
+64
+57
+51
+60
+53
+47
+77
+68
+61
+77
+64
+58
+75
+58
+51
+84
+64
+57
+82
+54
+50
+81
+48
+43
+95
+60
+54
+91
+52
+45
+94
+54
+46
+95
+52
+43
+92
+48
+39
+94
+47
+37
+101
+54
+44
+109
+61
+49
+114
+60
+48
+137
+73
+61
+143
+71
+59
+151
+73
+63
+159
+75
+65
+159
+70
+62
+155
+62
+55
+154
+61
+54
+158
+68
+59
+166
+78
+68
+164
+80
+69
+168
+86
+74
+171
+89
+75
+165
+79
+66
+153
+65
+53
+151
+59
+48
+156
+62
+54
+148
+57
+56
+146
+56
+56
+143
+53
+53
+137
+51
+50
+136
+55
+52
+135
+62
+56
+127
+63
+54
+117
+60
+49
+117
+65
+52
+115
+63
+50
+116
+59
+48
+121
+57
+48
+133
+54
+50
+142
+50
+51
+149
+44
+49
+155
+38
+44
+198
+72
+73
+229
+99
+97
+194
+70
+68
+202
+89
+85
+224
+122
+118
+171
+86
+79
+134
+70
+60
+132
+86
+70
+109
+82
+61
+105
+91
+65
+105
+98
+70
+107
+100
+72
+107
+95
+69
+111
+94
+68
+125
+99
+76
+141
+106
+84
+145
+99
+76
+177
+110
+93
+208
+111
+104
+218
+89
+93
+222
+59
+76
+229
+45
+69
+241
+44
+72
+243
+49
+76
+243
+65
+89
+233
+74
+92
+227
+91
+101
+226
+111
+114
+224
+124
+124
+218
+129
+125
+216
+133
+127
+215
+138
+130
+196
+126
+118
+192
+128
+119
+189
+131
+120
+185
+133
+120
+181
+135
+120
+175
+136
+119
+171
+138
+121
+167
+138
+120
+157
+128
+112
+157
+125
+110
+154
+121
+106
+150
+110
+98
+145
+98
+90
+135
+85
+78
+127
+72
+67
+123
+65
+63
+117
+58
+60
+103
+47
+50
+100
+48
+50
+97
+49
+49
+79
+39
+39
+71
+37
+35
+76
+48
+45
+77
+53
+49
+72
+51
+46
+69
+50
+44
+68
+49
+45
+70
+49
+46
+70
+46
+44
+71
+43
+42
+75
+45
+45
+81
+54
+47
+89
+72
+52
+96
+87
+58
+102
+95
+66
+103
+100
+69
+107
+111
+78
+117
+124
+90
+117
+132
+93
+111
+129
+89
+108
+131
+87
+108
+135
+90
+112
+141
+93
+114
+146
+97
+115
+149
+98
+117
+151
+100
+119
+153
+102
+118
+155
+104
+114
+150
+106
+115
+152
+111
+115
+151
+113
+113
+149
+111
+115
+149
+116
+119
+153
+120
+122
+152
+124
+121
+150
+122
+120
+149
+121
+115
+141
+114
+109
+135
+106
+107
+132
+102
+105
+130
+100
+97
+122
+90
+84
+109
+77
+79
+95
+68
+79
+80
+64
+84
+75
+66
+82
+73
+64
+57
+58
+52
+57
+58
+52
+57
+58
+52
+57
+58
+52
+58
+59
+53
+59
+60
+54
+62
+61
+56
+63
+62
+57
+62
+61
+56
+62
+61
+56
+65
+62
+57
+65
+62
+57
+66
+63
+58
+67
+64
+59
+68
+63
+59
+68
+63
+59
+70
+65
+61
+69
+64
+60
+69
+64
+58
+69
+64
+58
+68
+63
+57
+68
+63
+57
+69
+62
+56
+69
+62
+56
+69
+62
+56
+69
+62
+56
+69
+62
+56
+68
+61
+53
+67
+60
+54
+67
+60
+52
+68
+59
+52
+67
+58
+49
+66
+57
+50
+66
+57
+50
+66
+57
+50
+66
+57
+50
+65
+56
+51
+65
+56
+51
+64
+57
+51
+64
+57
+51
+62
+55
+49
+60
+55
+49
+59
+54
+48
+59
+54
+48
+57
+54
+47
+56
+53
+46
+55
+52
+47
+55
+52
+47
+57
+54
+49
+57
+54
+47
+57
+54
+47
+58
+55
+48
+60
+55
+49
+62
+58
+49
+65
+58
+48
+66
+60
+48
+67
+59
+48
+69
+59
+47
+73
+61
+49
+74
+62
+48
+76
+64
+50
+76
+64
+50
+78
+64
+51
+78
+64
+51
+78
+64
+53
+78
+64
+55
+77
+63
+54
+74
+61
+52
+73
+60
+51
+72
+59
+50
+69
+59
+50
+69
+59
+50
+67
+58
+49
+66
+57
+48
+64
+57
+49
+64
+57
+49
+64
+57
+49
+64
+57
+49
+65
+58
+52
+65
+58
+50
+67
+58
+51
+73
+56
+49
+75
+47
+43
+86
+46
+44
+106
+55
+54
+116
+58
+57
+123
+59
+59
+133
+69
+67
+129
+68
+63
+131
+72
+64
+132
+73
+65
+132
+72
+62
+141
+74
+66
+152
+79
+72
+161
+80
+76
+162
+79
+71
+147
+68
+55
+148
+66
+52
+154
+66
+54
+159
+67
+56
+160
+62
+51
+156
+55
+45
+156
+55
+45
+159
+61
+48
+163
+67
+53
+155
+63
+48
+153
+64
+48
+160
+69
+51
+164
+71
+54
+167
+70
+54
+174
+72
+58
+182
+78
+69
+181
+75
+77
+176
+71
+76
+167
+64
+68
+155
+56
+59
+147
+55
+56
+142
+61
+58
+133
+62
+56
+121
+61
+51
+114
+60
+48
+124
+72
+59
+135
+75
+65
+133
+62
+56
+133
+43
+43
+149
+40
+46
+181
+57
+68
+211
+75
+87
+219
+76
+78
+221
+79
+77
+199
+64
+61
+190
+65
+63
+208
+96
+92
+179
+89
+81
+132
+64
+53
+130
+84
+68
+121
+97
+73
+101
+91
+64
+96
+92
+63
+107
+104
+73
+117
+108
+79
+119
+102
+74
+127
+99
+75
+150
+99
+78
+185
+102
+88
+210
+97
+91
+224
+88
+90
+231
+67
+78
+238
+46
+69
+249
+39
+68
+255
+40
+72
+255
+42
+73
+255
+48
+78
+243
+53
+78
+236
+63
+82
+234
+76
+90
+230
+82
+94
+224
+84
+93
+222
+85
+93
+221
+90
+98
+219
+98
+105
+216
+101
+108
+214
+105
+110
+213
+108
+113
+208
+112
+114
+206
+116
+116
+204
+118
+119
+201
+120
+119
+204
+124
+125
+203
+121
+123
+203
+118
+121
+202
+113
+117
+202
+107
+115
+201
+101
+111
+199
+97
+108
+197
+95
+108
+195
+97
+110
+177
+84
+95
+163
+76
+85
+153
+72
+81
+141
+68
+75
+132
+70
+73
+107
+55
+57
+72
+28
+27
+84
+49
+45
+77
+48
+42
+72
+49
+43
+74
+54
+47
+75
+56
+49
+75
+58
+50
+79
+62
+54
+85
+69
+56
+91
+79
+53
+99
+90
+57
+103
+97
+65
+105
+102
+69
+110
+114
+79
+122
+130
+93
+122
+137
+98
+116
+134
+94
+114
+137
+95
+112
+137
+95
+112
+139
+96
+113
+142
+96
+117
+146
+100
+119
+148
+100
+119
+148
+100
+119
+148
+102
+115
+146
+105
+120
+150
+114
+122
+151
+120
+121
+150
+120
+126
+152
+125
+131
+157
+132
+133
+157
+135
+131
+155
+133
+129
+153
+131
+122
+146
+122
+114
+137
+111
+109
+132
+104
+104
+129
+100
+96
+121
+91
+84
+109
+77
+78
+97
+69
+82
+83
+67
+86
+80
+68
+86
+79
+69
+56
+57
+51
+56
+57
+51
+56
+57
+51
+57
+58
+52
+59
+60
+54
+60
+61
+55
+63
+62
+57
+64
+63
+58
+64
+63
+58
+64
+63
+58
+67
+64
+59
+67
+64
+59
+67
+64
+59
+67
+64
+59
+68
+63
+59
+68
+63
+59
+70
+65
+59
+70
+65
+59
+70
+65
+59
+69
+64
+58
+69
+64
+58
+69
+64
+58
+71
+64
+56
+70
+63
+55
+74
+65
+58
+73
+64
+57
+72
+63
+56
+71
+62
+53
+70
+61
+54
+69
+60
+51
+70
+60
+51
+69
+59
+49
+68
+58
+49
+68
+58
+49
+68
+58
+49
+68
+58
+49
+68
+59
+52
+68
+59
+52
+68
+59
+52
+67
+60
+52
+63
+56
+48
+63
+56
+48
+60
+55
+49
+59
+54
+48
+58
+53
+47
+58
+53
+47
+57
+52
+46
+57
+52
+46
+57
+54
+47
+57
+54
+47
+58
+53
+47
+59
+55
+46
+62
+55
+47
+64
+57
+47
+66
+57
+48
+67
+59
+48
+69
+59
+49
+70
+60
+48
+73
+61
+49
+75
+63
+49
+77
+63
+50
+77
+64
+48
+78
+65
+49
+77
+64
+48
+80
+63
+53
+77
+63
+52
+76
+62
+51
+75
+61
+50
+73
+60
+51
+72
+59
+50
+69
+59
+49
+68
+58
+48
+67
+58
+49
+67
+58
+49
+65
+58
+48
+65
+58
+48
+63
+59
+50
+64
+60
+51
+64
+60
+51
+68
+59
+52
+83
+69
+60
+82
+51
+46
+105
+51
+51
+142
+65
+71
+173
+76
+87
+193
+86
+96
+203
+93
+102
+196
+96
+98
+154
+66
+62
+150
+73
+63
+149
+77
+65
+155
+79
+66
+171
+82
+74
+190
+85
+82
+203
+80
+83
+196
+76
+75
+163
+65
+52
+157
+66
+48
+160
+64
+48
+165
+63
+49
+165
+59
+46
+163
+55
+43
+164
+56
+43
+167
+61
+47
+171
+69
+54
+161
+62
+43
+152
+55
+36
+157
+58
+39
+165
+62
+45
+172
+65
+47
+178
+67
+50
+184
+67
+58
+167
+48
+50
+177
+57
+66
+185
+68
+76
+190
+75
+82
+186
+77
+82
+173
+75
+76
+150
+65
+62
+130
+55
+49
+123
+56
+47
+118
+54
+44
+122
+49
+42
+133
+48
+45
+156
+51
+55
+186
+60
+71
+215
+70
+87
+232
+77
+91
+225
+71
+73
+206
+54
+51
+205
+60
+57
+187
+52
+49
+198
+79
+75
+198
+99
+93
+148
+74
+63
+140
+91
+74
+125
+99
+76
+106
+95
+67
+104
+99
+69
+117
+111
+79
+128
+111
+81
+130
+103
+74
+143
+103
+78
+177
+104
+89
+224
+100
+98
+239
+84
+90
+238
+71
+81
+239
+58
+73
+248
+52
+74
+255
+52
+78
+255
+50
+77
+254
+46
+72
+255
+53
+79
+245
+51
+75
+240
+53
+74
+239
+56
+76
+237
+55
+77
+233
+54
+75
+236
+54
+76
+239
+57
+80
+241
+65
+88
+239
+67
+91
+239
+70
+93
+237
+73
+97
+236
+77
+99
+234
+81
+101
+233
+84
+104
+232
+86
+107
+228
+84
+107
+229
+83
+106
+228
+80
+106
+228
+78
+105
+233
+78
+109
+238
+81
+112
+242
+83
+115
+244
+87
+118
+252
+105
+133
+237
+99
+124
+225
+93
+116
+210
+87
+108
+203
+90
+108
+199
+101
+114
+166
+83
+93
+114
+45
+50
+93
+39
+39
+88
+49
+44
+87
+58
+52
+81
+63
+53
+66
+58
+45
+58
+56
+41
+63
+66
+49
+76
+78
+57
+86
+79
+51
+97
+86
+54
+101
+95
+63
+104
+101
+68
+113
+117
+84
+127
+134
+101
+126
+140
+105
+119
+136
+100
+120
+140
+105
+117
+139
+101
+114
+139
+100
+114
+139
+99
+118
+140
+101
+121
+143
+104
+122
+144
+105
+122
+144
+106
+128
+149
+118
+132
+155
+126
+138
+158
+133
+141
+160
+138
+146
+163
+144
+151
+168
+150
+152
+169
+153
+150
+166
+153
+145
+162
+146
+135
+152
+134
+122
+141
+121
+112
+131
+109
+103
+126
+98
+94
+119
+89
+84
+109
+77
+80
+99
+71
+82
+87
+67
+88
+85
+70
+89
+85
+73
+55
+56
+50
+55
+56
+50
+56
+57
+51
+57
+58
+52
+59
+60
+54
+61
+62
+56
+64
+63
+58
+65
+64
+59
+66
+65
+60
+66
+65
+60
+68
+65
+60
+68
+65
+60
+68
+65
+60
+68
+65
+60
+69
+64
+60
+69
+64
+60
+71
+66
+60
+71
+66
+60
+71
+66
+60
+70
+65
+59
+70
+65
+59
+70
+66
+57
+72
+65
+57
+72
+65
+57
+76
+67
+60
+75
+66
+57
+74
+65
+56
+73
+64
+55
+72
+62
+53
+71
+61
+51
+70
+60
+50
+69
+59
+49
+68
+58
+48
+68
+58
+48
+69
+59
+49
+69
+59
+50
+68
+59
+50
+69
+60
+51
+69
+60
+53
+69
+60
+53
+64
+57
+49
+63
+56
+48
+61
+56
+50
+60
+55
+49
+59
+54
+48
+58
+53
+47
+58
+53
+47
+58
+53
+47
+57
+54
+47
+57
+54
+45
+59
+55
+46
+59
+55
+44
+63
+56
+46
+64
+58
+46
+67
+59
+48
+68
+60
+47
+70
+60
+48
+70
+61
+46
+74
+62
+48
+75
+63
+47
+77
+64
+48
+77
+64
+48
+77
+64
+47
+77
+64
+48
+79
+63
+50
+79
+62
+52
+76
+62
+51
+75
+61
+50
+74
+60
+51
+71
+58
+49
+69
+59
+49
+68
+58
+48
+68
+59
+50
+68
+59
+50
+66
+59
+49
+64
+60
+49
+64
+60
+51
+65
+61
+52
+66
+62
+53
+70
+60
+51
+81
+56
+49
+88
+43
+38
+135
+59
+63
+189
+85
+96
+216
+85
+101
+228
+86
+102
+226
+86
+99
+201
+75
+79
+157
+52
+48
+148
+58
+47
+144
+62
+48
+152
+66
+51
+173
+70
+61
+196
+74
+71
+212
+67
+72
+203
+63
+64
+177
+66
+55
+167
+70
+53
+169
+66
+51
+172
+64
+51
+175
+63
+51
+176
+62
+51
+179
+66
+52
+180
+68
+54
+178
+71
+53
+169
+66
+47
+163
+60
+41
+164
+59
+40
+169
+60
+40
+171
+58
+40
+174
+54
+38
+173
+51
+40
+182
+57
+55
+186
+57
+61
+187
+56
+62
+186
+55
+60
+190
+61
+66
+197
+74
+76
+196
+84
+83
+190
+88
+83
+153
+63
+55
+139
+52
+42
+135
+45
+37
+157
+54
+49
+195
+72
+75
+219
+80
+87
+224
+66
+81
+218
+52
+64
+221
+59
+57
+204
+47
+42
+209
+57
+52
+198
+56
+52
+197
+70
+64
+200
+93
+85
+167
+88
+75
+144
+87
+70
+119
+87
+64
+120
+100
+73
+126
+112
+83
+130
+111
+81
+133
+102
+74
+145
+99
+75
+172
+109
+91
+213
+117
+105
+234
+85
+87
+246
+70
+80
+242
+62
+74
+242
+60
+73
+249
+64
+78
+253
+67
+81
+249
+61
+76
+243
+55
+72
+253
+66
+83
+248
+60
+77
+244
+55
+75
+246
+54
+75
+248
+52
+74
+249
+50
+73
+255
+51
+78
+255
+56
+83
+255
+51
+84
+252
+53
+86
+252
+54
+87
+249
+56
+87
+247
+58
+90
+248
+61
+92
+246
+63
+94
+245
+64
+97
+247
+67
+102
+245
+67
+103
+244
+64
+101
+245
+63
+103
+247
+65
+105
+252
+67
+109
+255
+71
+115
+255
+74
+115
+255
+81
+117
+253
+84
+117
+250
+87
+118
+239
+85
+113
+228
+86
+110
+226
+99
+120
+213
+102
+118
+180
+89
+98
+124
+49
+53
+104
+48
+47
+88
+49
+42
+80
+56
+44
+71
+62
+47
+63
+64
+46
+59
+68
+47
+65
+70
+47
+81
+74
+46
+95
+84
+56
+103
+96
+67
+111
+107
+78
+124
+124
+96
+136
+142
+114
+135
+145
+118
+125
+139
+113
+122
+141
+113
+124
+143
+115
+124
+143
+115
+122
+141
+111
+122
+138
+109
+125
+140
+111
+131
+146
+117
+136
+151
+122
+149
+163
+138
+156
+169
+149
+163
+174
+157
+166
+177
+161
+172
+180
+167
+177
+185
+174
+176
+183
+176
+171
+181
+173
+161
+171
+162
+148
+160
+148
+131
+145
+130
+115
+132
+113
+104
+124
+99
+93
+116
+88
+83
+108
+78
+80
+100
+72
+80
+88
+67
+86
+87
+69
+87
+88
+72
+54
+55
+49
+54
+55
+49
+55
+56
+50
+56
+57
+51
+58
+59
+53
+60
+61
+55
+63
+62
+57
+64
+63
+58
+66
+65
+60
+66
+65
+60
+68
+65
+60
+68
+65
+60
+68
+65
+60
+69
+66
+61
+70
+65
+61
+70
+65
+61
+70
+67
+60
+70
+67
+60
+71
+66
+60
+72
+67
+61
+72
+68
+59
+72
+68
+59
+74
+67
+59
+74
+67
+57
+76
+67
+58
+75
+66
+57
+75
+65
+56
+74
+64
+54
+74
+61
+52
+73
+61
+49
+72
+60
+48
+71
+59
+47
+69
+59
+47
+69
+59
+47
+69
+59
+47
+69
+59
+49
+69
+59
+49
+69
+59
+49
+68
+59
+50
+68
+59
+50
+64
+57
+47
+64
+57
+47
+64
+57
+49
+63
+56
+48
+60
+55
+49
+59
+54
+48
+59
+54
+48
+58
+53
+47
+59
+55
+46
+59
+55
+46
+59
+55
+46
+60
+56
+45
+63
+56
+46
+65
+59
+47
+67
+59
+48
+68
+60
+47
+71
+61
+49
+71
+62
+47
+75
+63
+49
+77
+64
+48
+77
+64
+48
+78
+65
+48
+79
+63
+47
+79
+63
+48
+79
+63
+50
+78
+61
+51
+78
+61
+51
+74
+60
+49
+73
+59
+48
+71
+59
+47
+68
+58
+48
+68
+58
+48
+68
+60
+49
+68
+60
+49
+66
+59
+49
+64
+60
+49
+65
+61
+50
+65
+63
+51
+66
+63
+54
+75
+61
+52
+91
+54
+46
+116
+52
+50
+172
+77
+83
+218
+94
+105
+229
+78
+95
+226
+65
+81
+213
+55
+69
+182
+39
+43
+167
+50
+41
+156
+56
+40
+145
+58
+38
+149
+61
+41
+171
+65
+51
+193
+69
+61
+211
+63
+63
+204
+60
+59
+177
+63
+53
+168
+66
+52
+170
+64
+50
+173
+63
+50
+178
+64
+53
+184
+67
+57
+188
+72
+59
+187
+74
+60
+172
+62
+47
+170
+63
+47
+168
+61
+43
+166
+59
+41
+170
+57
+41
+176
+58
+44
+183
+59
+47
+187
+61
+49
+200
+71
+65
+204
+69
+65
+206
+64
+63
+205
+57
+57
+211
+56
+60
+220
+67
+69
+223
+77
+78
+218
+83
+79
+193
+68
+62
+195
+77
+67
+203
+84
+76
+209
+85
+77
+215
+75
+74
+218
+64
+66
+223
+53
+62
+224
+51
+55
+217
+52
+46
+215
+57
+46
+205
+51
+43
+206
+59
+52
+190
+57
+52
+178
+65
+57
+181
+91
+80
+150
+85
+67
+123
+78
+57
+130
+98
+73
+136
+106
+80
+133
+96
+70
+147
+90
+70
+176
+100
+84
+206
+112
+100
+232
+109
+104
+231
+70
+75
+237
+60
+68
+230
+59
+67
+227
+62
+68
+227
+68
+72
+227
+73
+75
+228
+74
+76
+229
+73
+77
+240
+76
+83
+239
+68
+77
+239
+58
+73
+242
+55
+72
+245
+52
+71
+248
+49
+70
+254
+52
+76
+255
+58
+82
+255
+57
+86
+253
+58
+88
+252
+59
+88
+250
+59
+90
+251
+60
+93
+252
+63
+95
+253
+65
+98
+252
+67
+101
+253
+69
+105
+251
+69
+107
+250
+68
+108
+250
+68
+109
+250
+67
+111
+249
+68
+111
+249
+68
+113
+250
+67
+111
+255
+72
+112
+255
+66
+104
+255
+74
+109
+253
+79
+112
+238
+75
+104
+230
+80
+107
+226
+93
+114
+216
+99
+115
+186
+91
+99
+140
+64
+68
+96
+38
+36
+81
+43
+34
+86
+64
+51
+86
+79
+61
+74
+76
+55
+65
+67
+45
+82
+74
+51
+101
+89
+67
+117
+106
+86
+128
+123
+103
+142
+141
+121
+153
+156
+139
+149
+156
+140
+136
+147
+131
+130
+142
+128
+137
+151
+136
+143
+155
+141
+140
+153
+136
+135
+146
+130
+138
+147
+130
+151
+158
+142
+164
+168
+153
+178
+182
+167
+184
+188
+174
+191
+193
+182
+192
+193
+185
+194
+195
+189
+197
+198
+193
+195
+195
+195
+190
+190
+190
+176
+181
+177
+162
+169
+162
+141
+151
+140
+121
+135
+118
+105
+123
+101
+92
+115
+89
+84
+109
+79
+82
+102
+74
+80
+90
+66
+84
+89
+67
+86
+91
+71
+53
+54
+48
+53
+54
+48
+54
+55
+49
+55
+56
+50
+56
+57
+51
+58
+59
+53
+61
+60
+55
+62
+61
+56
+64
+63
+58
+64
+63
+58
+67
+64
+59
+68
+65
+60
+69
+66
+61
+69
+66
+61
+71
+66
+62
+71
+66
+62
+71
+68
+61
+71
+68
+61
+72
+67
+61
+73
+68
+62
+73
+69
+60
+73
+69
+60
+75
+68
+58
+76
+69
+59
+76
+67
+58
+75
+67
+56
+76
+66
+56
+75
+65
+53
+76
+64
+52
+75
+63
+51
+74
+62
+50
+73
+61
+49
+71
+61
+49
+71
+61
+49
+70
+60
+48
+70
+60
+48
+69
+59
+49
+69
+59
+49
+68
+59
+50
+67
+58
+49
+65
+58
+48
+65
+58
+48
+64
+57
+49
+64
+57
+49
+61
+56
+50
+60
+55
+49
+59
+54
+48
+59
+54
+48
+59
+55
+46
+59
+55
+46
+59
+55
+44
+60
+56
+45
+63
+57
+45
+65
+59
+47
+68
+60
+47
+69
+61
+48
+72
+63
+48
+74
+62
+48
+76
+63
+47
+77
+64
+48
+78
+65
+48
+78
+65
+48
+79
+63
+47
+79
+63
+47
+79
+63
+50
+78
+61
+51
+77
+60
+50
+76
+59
+49
+73
+59
+48
+71
+59
+47
+70
+57
+48
+67
+57
+47
+67
+59
+48
+66
+60
+48
+66
+59
+49
+64
+60
+49
+64
+62
+50
+65
+63
+51
+66
+63
+54
+78
+59
+52
+106
+57
+52
+149
+71
+69
+195
+90
+95
+218
+88
+98
+220
+68
+81
+219
+57
+70
+209
+52
+59
+188
+44
+43
+172
+50
+39
+159
+56
+37
+150
+58
+33
+148
+58
+32
+161
+61
+38
+179
+64
+46
+193
+59
+50
+189
+56
+49
+167
+55
+44
+162
+58
+45
+165
+57
+45
+167
+55
+44
+175
+58
+49
+184
+66
+56
+186
+69
+59
+183
+69
+58
+174
+62
+50
+173
+63
+48
+167
+60
+44
+164
+54
+39
+170
+54
+41
+182
+62
+48
+195
+68
+59
+202
+71
+61
+188
+58
+45
+203
+65
+54
+221
+70
+63
+232
+68
+66
+239
+63
+65
+239
+59
+62
+231
+52
+55
+218
+48
+48
+216
+57
+53
+222
+73
+66
+229
+85
+76
+224
+80
+71
+216
+63
+57
+214
+50
+48
+224
+48
+50
+231
+55
+55
+216
+49
+40
+221
+61
+47
+202
+46
+34
+205
+56
+49
+189
+52
+44
+174
+55
+47
+200
+104
+92
+184
+108
+92
+142
+87
+67
+135
+90
+67
+132
+86
+63
+139
+81
+61
+170
+91
+76
+209
+106
+97
+226
+103
+98
+229
+83
+84
+240
+69
+75
+239
+62
+70
+226
+60
+64
+216
+62
+62
+209
+66
+62
+209
+72
+66
+219
+80
+77
+233
+87
+87
+235
+79
+82
+238
+68
+77
+239
+59
+71
+245
+54
+70
+246
+50
+70
+246
+47
+68
+249
+50
+71
+253
+55
+78
+251
+57
+83
+248
+58
+84
+248
+58
+86
+249
+59
+87
+254
+61
+92
+255
+63
+97
+255
+67
+101
+255
+68
+107
+251
+60
+101
+251
+62
+104
+250
+63
+106
+247
+64
+108
+247
+64
+110
+244
+62
+110
+241
+61
+108
+241
+60
+105
+255
+74
+114
+251
+61
+97
+251
+66
+100
+255
+78
+110
+251
+77
+110
+243
+80
+109
+236
+86
+111
+224
+91
+110
+231
+114
+130
+194
+97
+106
+150
+74
+76
+116
+58
+56
+93
+53
+45
+82
+56
+43
+82
+66
+50
+87
+76
+58
+94
+81
+65
+114
+101
+85
+136
+124
+110
+149
+141
+130
+159
+157
+145
+166
+167
+159
+161
+166
+159
+150
+156
+152
+149
+158
+155
+158
+167
+164
+166
+175
+172
+166
+172
+168
+162
+167
+163
+166
+168
+163
+181
+180
+176
+194
+193
+188
+204
+201
+192
+209
+206
+197
+213
+208
+204
+213
+208
+205
+212
+206
+206
+213
+207
+209
+209
+203
+207
+203
+198
+202
+191
+189
+192
+176
+178
+175
+152
+159
+152
+128
+140
+126
+109
+126
+107
+96
+116
+91
+87
+110
+82
+86
+106
+78
+83
+95
+71
+86
+96
+72
+87
+95
+72
+53
+54
+48
+53
+54
+48
+53
+54
+48
+53
+54
+48
+54
+55
+49
+56
+57
+51
+58
+57
+52
+59
+58
+53
+61
+60
+55
+62
+61
+56
+65
+62
+57
+67
+64
+59
+68
+65
+60
+70
+67
+62
+72
+67
+63
+72
+67
+63
+71
+68
+61
+72
+69
+62
+73
+68
+62
+73
+68
+62
+74
+70
+61
+74
+70
+61
+77
+70
+60
+77
+70
+60
+77
+69
+58
+76
+68
+57
+77
+67
+57
+77
+67
+55
+78
+66
+54
+77
+65
+51
+78
+64
+51
+77
+65
+51
+74
+65
+50
+74
+65
+50
+73
+64
+49
+72
+63
+48
+71
+61
+49
+70
+60
+48
+68
+60
+49
+68
+60
+49
+67
+58
+49
+67
+58
+49
+65
+58
+50
+64
+57
+49
+63
+56
+50
+63
+56
+50
+60
+55
+49
+60
+55
+49
+60
+56
+47
+60
+56
+45
+60
+56
+45
+60
+56
+45
+64
+58
+46
+65
+59
+47
+68
+60
+47
+69
+61
+48
+72
+63
+48
+75
+63
+49
+77
+64
+48
+78
+65
+48
+80
+64
+48
+80
+64
+48
+79
+64
+45
+79
+63
+47
+79
+61
+49
+79
+61
+49
+77
+61
+48
+76
+60
+47
+73
+59
+48
+70
+58
+46
+69
+56
+47
+67
+57
+47
+66
+58
+47
+65
+59
+47
+65
+58
+48
+63
+59
+48
+63
+61
+49
+64
+62
+50
+64
+64
+52
+78
+58
+49
+111
+50
+47
+165
+75
+75
+190
+84
+86
+186
+63
+68
+188
+49
+54
+193
+48
+51
+191
+49
+47
+183
+50
+41
+167
+50
+33
+162
+57
+35
+155
+61
+33
+150
+61
+31
+152
+61
+32
+158
+63
+35
+164
+59
+37
+162
+55
+37
+158
+54
+41
+160
+56
+45
+162
+54
+44
+165
+52
+44
+173
+56
+49
+183
+64
+58
+184
+67
+60
+178
+64
+54
+177
+66
+55
+173
+65
+52
+168
+60
+47
+166
+56
+43
+175
+58
+48
+188
+67
+56
+195
+68
+61
+196
+65
+55
+193
+64
+45
+203
+64
+45
+213
+55
+43
+221
+44
+38
+232
+36
+37
+245
+39
+43
+253
+44
+49
+252
+49
+52
+233
+44
+42
+227
+48
+43
+220
+53
+44
+217
+55
+44
+220
+53
+44
+223
+52
+44
+229
+50
+45
+228
+51
+43
+215
+52
+37
+212
+55
+38
+207
+51
+38
+206
+55
+44
+196
+55
+46
+187
+63
+55
+199
+97
+85
+210
+127
+113
+166
+101
+83
+143
+86
+66
+139
+76
+58
+164
+86
+73
+203
+100
+91
+224
+99
+95
+232
+82
+84
+233
+66
+73
+246
+69
+77
+238
+63
+68
+225
+62
+63
+213
+64
+60
+202
+63
+56
+200
+63
+55
+211
+69
+65
+229
+77
+76
+240
+74
+78
+245
+63
+75
+251
+56
+72
+255
+54
+72
+254
+53
+72
+249
+50
+69
+249
+54
+71
+250
+59
+77
+247
+58
+80
+246
+58
+82
+246
+56
+82
+249
+56
+85
+251
+56
+88
+254
+59
+93
+255
+61
+97
+255
+63
+103
+255
+64
+106
+255
+64
+108
+255
+65
+112
+255
+67
+115
+251
+68
+116
+249
+67
+116
+247
+67
+115
+244
+67
+111
+251
+73
+109
+245
+68
+97
+249
+72
+101
+252
+77
+106
+250
+77
+107
+255
+88
+116
+255
+97
+122
+242
+94
+116
+240
+107
+126
+229
+113
+126
+211
+111
+119
+175
+93
+97
+132
+67
+65
+104
+54
+47
+105
+65
+55
+115
+85
+74
+121
+101
+92
+140
+125
+118
+163
+150
+144
+173
+163
+161
+178
+174
+171
+182
+182
+182
+178
+182
+185
+170
+175
+179
+176
+183
+189
+182
+189
+197
+189
+193
+202
+192
+195
+202
+195
+194
+202
+201
+198
+205
+213
+206
+214
+221
+215
+219
+226
+218
+216
+231
+221
+219
+233
+221
+221
+230
+218
+220
+229
+216
+223
+228
+215
+224
+224
+212
+222
+217
+207
+216
+202
+197
+203
+186
+186
+186
+162
+167
+163
+136
+146
+135
+116
+130
+113
+101
+120
+98
+92
+115
+87
+91
+111
+83
+92
+106
+80
+92
+105
+79
+94
+104
+79
+53
+54
+49
+53
+54
+49
+53
+54
+49
+53
+54
+48
+53
+54
+49
+54
+55
+49
+56
+55
+50
+57
+56
+51
+60
+59
+54
+61
+60
+55
+64
+61
+56
+66
+63
+58
+68
+65
+60
+70
+67
+60
+71
+68
+61
+72
+69
+62
+72
+69
+62
+72
+69
+62
+72
+69
+60
+74
+70
+61
+74
+70
+59
+75
+71
+59
+75
+71
+59
+78
+72
+58
+77
+71
+59
+77
+71
+59
+77
+69
+58
+77
+68
+59
+77
+68
+59
+77
+68
+61
+78
+67
+63
+78
+67
+61
+77
+67
+55
+77
+68
+53
+75
+66
+51
+74
+65
+50
+72
+62
+50
+71
+61
+49
+69
+61
+50
+68
+59
+50
+67
+58
+49
+67
+58
+51
+65
+58
+50
+65
+58
+52
+64
+57
+51
+63
+55
+52
+60
+55
+51
+60
+55
+49
+62
+55
+47
+62
+55
+47
+60
+56
+47
+61
+57
+48
+62
+58
+49
+65
+58
+50
+67
+60
+50
+68
+61
+51
+72
+64
+53
+73
+63
+51
+76
+64
+50
+77
+65
+49
+78
+65
+48
+80
+64
+48
+79
+64
+45
+79
+63
+47
+76
+62
+49
+76
+62
+51
+75
+61
+50
+76
+59
+51
+74
+57
+49
+73
+56
+49
+70
+55
+48
+67
+56
+50
+65
+56
+47
+62
+58
+47
+61
+59
+47
+60
+61
+47
+63
+61
+48
+64
+62
+47
+66
+63
+48
+83
+57
+44
+134
+61
+55
+193
+93
+91
+200
+90
+89
+174
+56
+54
+170
+47
+42
+177
+50
+43
+171
+47
+37
+171
+51
+35
+170
+58
+38
+171
+67
+42
+169
+71
+44
+163
+70
+39
+160
+66
+38
+161
+66
+38
+161
+61
+35
+158
+58
+35
+160
+57
+42
+163
+59
+48
+166
+58
+48
+166
+55
+46
+173
+60
+52
+182
+67
+60
+183
+69
+59
+176
+64
+53
+171
+61
+48
+168
+60
+47
+169
+59
+46
+172
+60
+48
+187
+69
+57
+198
+76
+65
+197
+69
+60
+188
+56
+44
+188
+55
+36
+201
+60
+40
+218
+61
+46
+227
+53
+44
+238
+44
+42
+246
+42
+43
+249
+40
+43
+247
+39
+39
+246
+44
+42
+241
+48
+43
+236
+52
+44
+232
+54
+44
+227
+53
+42
+226
+52
+41
+225
+51
+40
+222
+52
+37
+222
+59
+42
+207
+50
+31
+219
+63
+48
+205
+55
+41
+199
+57
+45
+194
+63
+53
+179
+65
+54
+209
+108
+96
+191
+103
+89
+165
+82
+66
+170
+78
+65
+205
+98
+90
+232
+103
+98
+231
+81
+82
+235
+64
+70
+246
+65
+74
+237
+60
+68
+227
+58
+61
+215
+59
+60
+207
+62
+57
+195
+61
+52
+185
+54
+44
+187
+52
+46
+199
+56
+52
+229
+71
+72
+234
+63
+69
+242
+58
+68
+249
+57
+72
+252
+57
+73
+250
+55
+71
+250
+58
+73
+251
+63
+78
+252
+67
+85
+251
+65
+86
+250
+63
+84
+249
+59
+84
+251
+58
+85
+253
+58
+90
+255
+59
+94
+255
+60
+99
+255
+64
+104
+255
+63
+107
+255
+63
+110
+251
+63
+111
+247
+64
+112
+245
+65
+113
+245
+64
+115
+243
+66
+112
+244
+68
+106
+252
+79
+109
+255
+86
+115
+243
+76
+104
+231
+66
+96
+249
+86
+115
+255
+105
+133
+255
+102
+130
+246
+94
+119
+238
+96
+120
+231
+104
+123
+220
+112
+125
+199
+112
+120
+170
+102
+103
+143
+92
+88
+126
+89
+81
+153
+126
+119
+171
+152
+146
+190
+176
+173
+197
+187
+186
+198
+194
+195
+200
+199
+204
+199
+199
+207
+195
+195
+207
+203
+202
+216
+204
+202
+216
+209
+202
+218
+215
+206
+223
+221
+213
+228
+230
+219
+233
+232
+224
+235
+237
+227
+235
+239
+229
+230
+242
+232
+230
+244
+232
+232
+240
+228
+230
+238
+225
+232
+237
+224
+233
+234
+221
+231
+228
+216
+226
+209
+202
+209
+193
+191
+194
+171
+171
+169
+145
+150
+143
+122
+134
+120
+108
+123
+104
+98
+117
+95
+96
+114
+90
+100
+114
+89
+100
+112
+88
+100
+110
+86
+50
+49
+47
+51
+50
+48
+52
+51
+49
+54
+53
+49
+56
+55
+53
+57
+56
+52
+57
+56
+52
+57
+56
+52
+59
+58
+53
+60
+59
+54
+61
+61
+53
+63
+63
+55
+65
+65
+57
+67
+67
+57
+69
+69
+59
+69
+69
+59
+72
+72
+64
+72
+72
+62
+72
+72
+60
+74
+72
+59
+75
+74
+56
+76
+75
+55
+77
+76
+56
+78
+75
+56
+77
+74
+57
+74
+70
+58
+71
+68
+59
+74
+70
+67
+78
+73
+77
+78
+73
+80
+71
+68
+79
+68
+63
+69
+78
+69
+62
+76
+67
+52
+74
+64
+52
+75
+65
+53
+77
+67
+57
+76
+66
+56
+70
+61
+52
+66
+57
+48
+69
+60
+53
+67
+58
+53
+64
+57
+51
+63
+55
+52
+64
+56
+53
+63
+55
+53
+60
+55
+52
+60
+52
+50
+67
+58
+53
+66
+57
+52
+65
+57
+54
+62
+57
+53
+63
+58
+55
+62
+58
+55
+63
+59
+56
+64
+60
+57
+66
+63
+58
+68
+64
+55
+71
+64
+54
+74
+64
+52
+76
+64
+48
+79
+64
+45
+79
+64
+43
+76
+63
+44
+70
+64
+50
+69
+62
+52
+72
+59
+51
+74
+56
+52
+75
+54
+53
+77
+52
+55
+75
+55
+57
+72
+58
+58
+67
+62
+58
+55
+56
+48
+55
+59
+45
+62
+66
+49
+62
+64
+43
+58
+56
+35
+67
+59
+36
+101
+66
+46
+189
+106
+92
+183
+75
+65
+166
+55
+44
+164
+54
+41
+167
+55
+43
+164
+54
+39
+163
+56
+38
+168
+61
+43
+162
+57
+36
+165
+60
+38
+169
+64
+42
+171
+65
+41
+172
+61
+41
+172
+57
+38
+174
+54
+37
+170
+55
+37
+164
+54
+39
+161
+55
+41
+162
+56
+42
+166
+60
+46
+170
+64
+50
+172
+66
+52
+172
+66
+50
+172
+65
+49
+169
+62
+44
+171
+61
+44
+173
+60
+44
+179
+61
+47
+189
+67
+52
+196
+70
+56
+192
+62
+49
+184
+50
+38
+199
+57
+43
+203
+57
+42
+207
+57
+43
+213
+57
+45
+219
+55
+45
+225
+54
+46
+231
+52
+47
+237
+50
+45
+240
+46
+44
+242
+47
+45
+242
+49
+44
+239
+50
+44
+234
+53
+42
+227
+55
+41
+221
+58
+41
+218
+59
+40
+219
+58
+38
+212
+51
+31
+207
+52
+32
+206
+56
+39
+197
+56
+39
+190
+54
+40
+194
+66
+53
+207
+83
+73
+200
+78
+67
+207
+83
+75
+225
+92
+87
+238
+93
+90
+240
+80
+82
+237
+62
+67
+243
+56
+63
+248
+63
+71
+235
+64
+70
+225
+67
+68
+214
+64
+65
+201
+62
+57
+187
+60
+51
+179
+58
+47
+177
+59
+47
+180
+59
+48
+202
+76
+64
+212
+75
+67
+222
+70
+67
+226
+62
+63
+235
+60
+65
+248
+63
+71
+254
+62
+73
+249
+59
+71
+253
+69
+81
+250
+68
+81
+253
+68
+82
+255
+68
+85
+253
+64
+86
+250
+60
+85
+254
+61
+90
+255
+66
+100
+255
+70
+107
+255
+65
+106
+249
+59
+103
+245
+58
+103
+244
+61
+109
+248
+68
+115
+253
+73
+121
+255
+75
+122
+255
+78
+121
+255
+78
+117
+249
+81
+116
+239
+82
+113
+229
+79
+106
+229
+79
+106
+247
+90
+119
+255
+103
+135
+255
+93
+128
+240
+69
+105
+245
+86
+118
+232
+94
+120
+198
+91
+109
+194
+117
+125
+140
+92
+92
+145
+114
+109
+171
+143
+132
+189
+167
+156
+212
+195
+187
+222
+213
+208
+221
+220
+218
+220
+219
+224
+222
+220
+231
+226
+219
+235
+231
+216
+237
+235
+216
+238
+241
+217
+241
+244
+220
+242
+245
+227
+243
+245
+231
+244
+243
+236
+244
+244
+239
+243
+248
+243
+240
+248
+243
+239
+248
+240
+238
+245
+236
+237
+242
+231
+235
+237
+226
+232
+232
+221
+227
+229
+220
+225
+214
+208
+212
+205
+201
+202
+187
+186
+184
+163
+165
+160
+139
+144
+137
+121
+131
+120
+114
+125
+111
+112
+123
+107
+123
+132
+115
+119
+128
+109
+118
+125
+107
+48
+46
+47
+49
+47
+48
+51
+50
+48
+53
+52
+50
+54
+53
+51
+55
+54
+50
+56
+55
+51
+56
+55
+50
+58
+57
+52
+59
+58
+53
+61
+61
+53
+63
+63
+55
+65
+65
+55
+67
+67
+57
+68
+68
+56
+69
+69
+59
+72
+72
+62
+72
+72
+62
+72
+72
+60
+74
+72
+57
+75
+74
+54
+76
+75
+54
+77
+77
+53
+78
+77
+56
+75
+74
+56
+75
+73
+61
+75
+74
+69
+80
+80
+82
+87
+85
+96
+89
+88
+106
+86
+84
+106
+82
+79
+96
+79
+73
+75
+77
+68
+63
+72
+63
+58
+70
+61
+56
+71
+62
+57
+72
+63
+58
+70
+61
+56
+66
+59
+53
+68
+58
+56
+65
+57
+54
+63
+55
+52
+63
+55
+52
+64
+56
+53
+64
+56
+53
+61
+56
+53
+59
+54
+50
+61
+52
+47
+61
+52
+47
+61
+53
+50
+60
+55
+52
+61
+57
+54
+62
+58
+57
+61
+60
+58
+62
+61
+57
+66
+63
+58
+68
+63
+57
+71
+64
+54
+74
+64
+52
+77
+64
+48
+79
+64
+45
+80
+63
+43
+76
+63
+44
+65
+64
+46
+63
+64
+50
+69
+60
+53
+72
+57
+54
+74
+54
+55
+74
+52
+55
+70
+51
+55
+67
+52
+55
+65
+60
+57
+60
+59
+54
+61
+61
+49
+69
+63
+49
+74
+58
+42
+80
+54
+37
+100
+65
+46
+133
+74
+58
+176
+80
+66
+171
+59
+45
+160
+50
+35
+161
+54
+38
+163
+58
+39
+158
+55
+36
+158
+57
+37
+163
+62
+42
+161
+59
+37
+167
+60
+40
+174
+63
+43
+179
+64
+45
+182
+61
+44
+183
+57
+42
+184
+54
+40
+181
+55
+41
+170
+57
+41
+165
+58
+42
+164
+57
+41
+165
+59
+43
+168
+62
+46
+171
+65
+49
+171
+66
+47
+171
+64
+46
+174
+63
+44
+171
+58
+40
+177
+60
+43
+191
+69
+54
+198
+72
+57
+193
+63
+49
+188
+56
+43
+192
+54
+41
+203
+55
+43
+207
+55
+44
+208
+57
+46
+209
+59
+45
+212
+60
+47
+216
+58
+46
+224
+56
+47
+231
+52
+45
+238
+49
+45
+244
+46
+43
+244
+46
+43
+241
+48
+43
+234
+52
+41
+225
+55
+40
+215
+58
+39
+213
+58
+36
+222
+60
+39
+217
+54
+35
+213
+56
+37
+212
+61
+42
+204
+59
+42
+193
+53
+38
+196
+58
+47
+207
+70
+60
+209
+70
+63
+218
+73
+68
+233
+79
+77
+243
+80
+81
+244
+71
+73
+240
+59
+64
+245
+58
+65
+248
+67
+72
+229
+66
+69
+218
+68
+67
+210
+66
+65
+197
+62
+56
+183
+59
+49
+174
+58
+45
+170
+60
+45
+171
+61
+46
+182
+69
+53
+198
+76
+63
+212
+78
+69
+220
+71
+67
+227
+63
+62
+239
+63
+66
+250
+63
+70
+254
+64
+74
+248
+67
+74
+247
+67
+76
+250
+68
+80
+255
+70
+84
+253
+66
+83
+249
+62
+83
+252
+62
+88
+255
+66
+97
+255
+70
+104
+255
+67
+105
+252
+63
+105
+249
+64
+106
+249
+66
+112
+252
+70
+118
+254
+74
+122
+255
+75
+123
+255
+72
+120
+255
+71
+115
+244
+74
+111
+242
+82
+116
+243
+93
+122
+246
+96
+123
+247
+88
+118
+247
+79
+112
+250
+70
+107
+248
+68
+107
+238
+68
+104
+220
+73
+102
+203
+92
+111
+182
+106
+116
+115
+71
+72
+150
+121
+115
+180
+148
+137
+206
+176
+165
+229
+209
+200
+239
+226
+220
+235
+231
+230
+233
+232
+237
+236
+230
+242
+237
+226
+243
+246
+227
+249
+251
+225
+250
+255
+227
+253
+255
+230
+253
+255
+236
+254
+255
+242
+253
+254
+247
+254
+252
+250
+251
+253
+249
+246
+252
+249
+244
+251
+246
+243
+249
+244
+241
+247
+238
+239
+243
+234
+237
+240
+231
+236
+238
+229
+234
+230
+221
+224
+220
+214
+216
+202
+198
+197
+179
+178
+174
+158
+161
+154
+142
+147
+140
+137
+143
+133
+136
+144
+131
+142
+148
+134
+137
+144
+128
+134
+140
+126
+47
+46
+44
+48
+47
+45
+49
+48
+46
+50
+49
+47
+52
+51
+47
+53
+52
+48
+55
+54
+50
+55
+54
+49
+58
+57
+52
+58
+58
+50
+60
+60
+52
+62
+62
+54
+64
+64
+54
+66
+66
+56
+67
+67
+57
+68
+68
+58
+73
+70
+61
+73
+71
+59
+74
+72
+59
+76
+73
+56
+77
+74
+55
+78
+76
+55
+78
+76
+55
+79
+76
+57
+75
+73
+58
+78
+75
+66
+84
+82
+83
+95
+94
+102
+105
+104
+120
+109
+109
+133
+108
+107
+138
+107
+104
+131
+96
+89
+105
+89
+81
+92
+79
+71
+82
+72
+64
+75
+72
+62
+71
+71
+61
+69
+69
+60
+65
+64
+58
+60
+67
+58
+59
+63
+58
+55
+60
+55
+52
+60
+55
+51
+61
+56
+50
+62
+57
+51
+62
+58
+49
+61
+57
+48
+56
+51
+45
+57
+52
+46
+59
+54
+48
+60
+57
+50
+61
+58
+51
+62
+59
+52
+63
+60
+53
+64
+60
+51
+69
+62
+52
+71
+63
+52
+73
+63
+51
+76
+64
+48
+79
+63
+48
+80
+63
+47
+80
+63
+45
+76
+63
+44
+60
+59
+39
+58
+61
+42
+62
+60
+47
+65
+58
+48
+66
+55
+51
+67
+53
+52
+63
+52
+50
+60
+50
+49
+63
+55
+52
+68
+57
+53
+75
+56
+50
+82
+49
+44
+92
+43
+39
+111
+46
+44
+139
+58
+57
+164
+69
+67
+165
+58
+48
+162
+50
+36
+159
+49
+32
+164
+57
+39
+165
+60
+41
+158
+55
+36
+158
+56
+34
+162
+60
+38
+164
+59
+38
+170
+61
+41
+177
+65
+45
+182
+65
+47
+185
+62
+46
+187
+60
+45
+190
+58
+45
+190
+60
+47
+178
+60
+46
+172
+60
+46
+169
+57
+43
+169
+57
+43
+171
+60
+43
+173
+62
+45
+173
+62
+45
+173
+60
+44
+178
+63
+45
+176
+56
+40
+185
+62
+46
+203
+76
+61
+203
+71
+58
+188
+54
+42
+186
+50
+38
+201
+57
+46
+208
+54
+44
+212
+54
+43
+212
+56
+44
+214
+58
+46
+216
+58
+47
+220
+56
+46
+227
+54
+47
+232
+51
+44
+240
+48
+45
+244
+46
+43
+244
+46
+43
+240
+49
+41
+231
+50
+39
+221
+54
+38
+212
+56
+34
+210
+55
+33
+221
+56
+36
+220
+53
+35
+218
+57
+39
+218
+62
+47
+211
+61
+46
+200
+54
+41
+197
+57
+44
+203
+65
+55
+201
+60
+53
+205
+62
+56
+217
+69
+65
+229
+75
+73
+234
+74
+74
+233
+67
+67
+236
+63
+65
+235
+67
+67
+222
+67
+65
+213
+68
+63
+205
+66
+61
+194
+61
+52
+182
+58
+46
+174
+56
+42
+171
+58
+42
+172
+59
+43
+172
+56
+41
+192
+68
+56
+212
+78
+69
+221
+73
+69
+224
+64
+64
+232
+62
+65
+247
+66
+73
+255
+72
+80
+244
+65
+71
+244
+64
+73
+249
+67
+79
+253
+71
+84
+254
+69
+85
+250
+64
+85
+251
+63
+88
+254
+65
+95
+255
+68
+102
+255
+67
+105
+255
+67
+107
+255
+70
+112
+255
+73
+119
+255
+75
+123
+255
+76
+124
+255
+74
+122
+255
+66
+116
+255
+68
+116
+254
+72
+113
+250
+78
+116
+252
+91
+124
+255
+98
+128
+250
+87
+118
+236
+69
+99
+248
+77
+109
+254
+86
+119
+218
+64
+92
+203
+71
+94
+218
+121
+132
+187
+121
+123
+103
+64
+59
+151
+123
+112
+178
+140
+129
+215
+177
+166
+245
+216
+208
+253
+234
+228
+250
+240
+239
+250
+245
+249
+249
+243
+253
+244
+236
+251
+251
+233
+255
+255
+233
+255
+255
+234
+255
+255
+237
+255
+255
+242
+255
+255
+246
+255
+255
+251
+255
+255
+254
+252
+255
+253
+250
+255
+252
+248
+255
+249
+247
+255
+247
+245
+254
+244
+245
+252
+242
+243
+250
+239
+243
+248
+239
+242
+240
+231
+234
+229
+223
+225
+211
+207
+206
+190
+189
+185
+173
+174
+168
+162
+165
+158
+157
+163
+153
+157
+163
+151
+163
+171
+158
+157
+165
+150
+153
+161
+148
+47
+46
+44
+47
+46
+44
+48
+47
+45
+49
+48
+44
+50
+49
+45
+51
+50
+46
+53
+52
+47
+54
+53
+48
+56
+56
+48
+57
+57
+49
+59
+59
+51
+61
+61
+53
+63
+63
+53
+65
+65
+55
+66
+66
+56
+67
+67
+57
+72
+69
+60
+74
+70
+59
+75
+72
+57
+77
+74
+57
+80
+75
+56
+79
+77
+56
+81
+76
+56
+79
+76
+59
+76
+74
+62
+81
+80
+76
+94
+93
+98
+109
+108
+122
+122
+122
+146
+129
+130
+161
+128
+130
+168
+128
+128
+166
+123
+117
+151
+114
+107
+138
+101
+95
+123
+89
+83
+109
+84
+76
+100
+77
+69
+90
+71
+64
+80
+66
+60
+72
+68
+63
+70
+64
+59
+63
+60
+56
+55
+59
+54
+51
+59
+54
+48
+60
+56
+47
+61
+57
+46
+59
+56
+47
+58
+55
+48
+57
+57
+49
+59
+59
+51
+62
+59
+50
+63
+61
+49
+64
+60
+49
+63
+59
+47
+65
+59
+45
+70
+63
+47
+72
+63
+46
+75
+63
+47
+77
+64
+47
+79
+63
+48
+79
+63
+47
+80
+62
+48
+76
+63
+47
+66
+61
+42
+63
+62
+44
+64
+61
+46
+65
+58
+48
+65
+58
+50
+64
+57
+51
+62
+57
+53
+60
+57
+52
+61
+56
+52
+70
+56
+53
+80
+52
+49
+88
+44
+43
+107
+41
+43
+135
+48
+54
+161
+55
+65
+174
+61
+65
+167
+54
+46
+165
+55
+40
+165
+58
+40
+170
+63
+45
+168
+63
+44
+160
+57
+38
+161
+56
+35
+164
+59
+38
+165
+58
+38
+171
+60
+41
+179
+62
+44
+185
+64
+47
+189
+62
+47
+193
+61
+48
+197
+61
+49
+196
+62
+50
+189
+63
+51
+182
+61
+50
+178
+57
+46
+174
+56
+42
+175
+57
+43
+176
+58
+44
+178
+58
+44
+179
+57
+42
+182
+59
+44
+185
+59
+45
+196
+66
+52
+203
+69
+57
+200
+62
+51
+190
+49
+39
+192
+50
+40
+205
+57
+47
+214
+53
+43
+216
+52
+42
+218
+54
+45
+219
+55
+45
+222
+55
+46
+225
+54
+44
+230
+51
+44
+236
+49
+42
+243
+48
+44
+244
+46
+43
+244
+47
+41
+239
+48
+40
+228
+50
+38
+219
+52
+36
+210
+54
+32
+208
+53
+31
+215
+50
+30
+218
+48
+31
+218
+52
+36
+220
+60
+46
+214
+61
+47
+208
+57
+46
+205
+61
+50
+210
+68
+58
+196
+53
+45
+197
+54
+48
+202
+59
+53
+216
+68
+64
+226
+77
+73
+229
+75
+73
+222
+67
+63
+214
+61
+56
+211
+64
+57
+206
+65
+56
+199
+62
+52
+190
+60
+47
+181
+58
+43
+176
+56
+42
+175
+57
+43
+177
+59
+45
+172
+52
+38
+189
+63
+51
+209
+72
+64
+217
+72
+67
+221
+66
+64
+229
+64
+68
+243
+70
+76
+253
+78
+85
+240
+63
+69
+240
+63
+69
+246
+66
+77
+254
+72
+85
+254
+72
+87
+252
+66
+87
+250
+64
+88
+252
+65
+94
+255
+65
+99
+255
+67
+102
+255
+70
+109
+255
+73
+114
+255
+77
+121
+255
+79
+124
+255
+76
+123
+255
+72
+121
+255
+63
+113
+255
+74
+122
+255
+79
+122
+252
+73
+112
+246
+77
+110
+252
+87
+117
+252
+87
+117
+243
+79
+106
+239
+75
+102
+236
+78
+103
+206
+62
+85
+220
+98
+113
+251
+156
+164
+211
+141
+141
+104
+57
+51
+113
+75
+64
+166
+119
+109
+210
+163
+155
+247
+210
+202
+255
+231
+226
+255
+242
+241
+255
+251
+254
+255
+250
+255
+249
+241
+254
+250
+237
+255
+252
+237
+255
+255
+237
+255
+255
+240
+255
+255
+242
+253
+255
+246
+254
+254
+250
+251
+255
+251
+250
+255
+252
+249
+255
+251
+247
+255
+249
+247
+255
+248
+246
+255
+245
+246
+254
+244
+245
+254
+243
+247
+253
+242
+246
+246
+235
+239
+236
+227
+228
+218
+213
+210
+201
+198
+193
+186
+185
+180
+179
+180
+172
+177
+180
+169
+176
+182
+170
+183
+191
+180
+175
+183
+172
+169
+177
+166
+49
+48
+44
+49
+48
+44
+48
+47
+43
+48
+47
+43
+49
+48
+44
+50
+49
+44
+52
+51
+46
+53
+52
+47
+55
+55
+47
+56
+56
+48
+57
+57
+49
+59
+59
+51
+61
+61
+51
+63
+63
+53
+65
+65
+55
+68
+65
+56
+73
+69
+58
+76
+70
+58
+78
+72
+58
+80
+74
+58
+82
+75
+57
+82
+77
+58
+83
+76
+58
+81
+75
+61
+79
+74
+68
+86
+84
+85
+102
+100
+113
+119
+120
+141
+134
+134
+168
+141
+144
+185
+143
+147
+195
+143
+144
+198
+142
+139
+192
+135
+131
+182
+123
+119
+169
+112
+109
+154
+105
+100
+141
+95
+91
+126
+85
+80
+110
+78
+74
+97
+75
+71
+88
+69
+66
+77
+63
+61
+66
+59
+55
+56
+57
+53
+50
+57
+54
+47
+56
+53
+44
+56
+53
+44
+54
+55
+49
+55
+56
+51
+56
+57
+49
+59
+59
+49
+62
+60
+47
+63
+60
+43
+66
+61
+42
+67
+60
+41
+71
+63
+44
+74
+63
+43
+75
+64
+44
+76
+65
+47
+77
+64
+48
+77
+63
+50
+76
+64
+52
+76
+62
+51
+77
+63
+52
+76
+62
+53
+73
+58
+51
+67
+56
+50
+63
+56
+50
+60
+57
+52
+56
+59
+52
+55
+60
+53
+57
+60
+51
+64
+57
+49
+72
+51
+46
+90
+49
+47
+119
+55
+56
+149
+62
+68
+167
+61
+71
+169
+56
+60
+170
+59
+48
+170
+60
+43
+171
+64
+46
+172
+65
+47
+169
+64
+45
+165
+60
+41
+166
+59
+39
+171
+62
+42
+167
+56
+36
+173
+58
+39
+181
+60
+43
+188
+61
+46
+193
+60
+45
+197
+59
+46
+202
+60
+48
+202
+61
+51
+197
+63
+54
+190
+62
+51
+186
+58
+47
+183
+55
+44
+183
+55
+44
+184
+56
+43
+186
+56
+43
+186
+56
+43
+187
+55
+43
+199
+65
+53
+205
+67
+56
+197
+56
+46
+193
+49
+38
+198
+51
+41
+203
+55
+45
+207
+53
+43
+219
+52
+43
+223
+51
+41
+225
+52
+45
+226
+54
+44
+227
+53
+44
+231
+53
+43
+236
+49
+42
+240
+47
+42
+245
+47
+44
+246
+47
+42
+242
+47
+41
+236
+48
+39
+226
+50
+35
+217
+52
+33
+208
+53
+31
+207
+52
+30
+214
+49
+30
+217
+47
+30
+216
+50
+34
+216
+54
+41
+215
+57
+45
+212
+58
+48
+214
+63
+54
+216
+69
+61
+214
+70
+62
+205
+64
+55
+201
+60
+53
+203
+64
+57
+214
+75
+68
+217
+78
+71
+210
+69
+62
+197
+59
+49
+197
+61
+49
+194
+60
+48
+192
+60
+47
+186
+59
+44
+183
+57
+42
+180
+58
+43
+182
+60
+45
+185
+63
+48
+181
+57
+45
+191
+60
+50
+201
+64
+58
+210
+67
+63
+219
+67
+66
+227
+68
+72
+237
+74
+79
+246
+79
+86
+236
+63
+69
+237
+62
+67
+242
+66
+76
+251
+73
+85
+255
+74
+89
+253
+70
+88
+250
+67
+89
+251
+67
+93
+251
+64
+95
+251
+66
+100
+255
+69
+108
+255
+74
+115
+255
+78
+122
+255
+79
+124
+255
+76
+121
+255
+72
+118
+255
+68
+114
+255
+78
+124
+255
+80
+122
+251
+72
+111
+245
+74
+108
+253
+86
+116
+254
+87
+115
+243
+81
+105
+231
+71
+95
+224
+72
+93
+226
+88
+104
+255
+147
+158
+255
+178
+184
+239
+155
+155
+140
+72
+69
+108
+47
+42
+166
+106
+98
+206
+149
+142
+243
+198
+192
+255
+225
+220
+255
+240
+239
+255
+251
+253
+255
+253
+255
+251
+246
+253
+252
+246
+255
+253
+245
+255
+255
+245
+255
+255
+246
+255
+255
+248
+255
+255
+250
+254
+255
+252
+251
+255
+252
+249
+255
+251
+247
+255
+250
+247
+255
+248
+247
+255
+247
+246
+255
+245
+247
+255
+244
+246
+255
+243
+247
+255
+243
+247
+253
+241
+243
+243
+233
+234
+228
+220
+218
+214
+209
+205
+205
+202
+195
+201
+201
+191
+202
+202
+192
+202
+205
+194
+201
+208
+200
+190
+200
+191
+182
+192
+183
+54
+53
+49
+52
+51
+46
+51
+50
+46
+49
+48
+43
+49
+48
+43
+50
+49
+44
+51
+50
+45
+52
+51
+46
+54
+54
+46
+55
+55
+47
+56
+56
+48
+58
+58
+50
+60
+60
+50
+62
+62
+52
+64
+64
+54
+66
+64
+52
+74
+68
+56
+77
+69
+56
+79
+72
+56
+82
+75
+59
+84
+75
+58
+84
+77
+59
+83
+76
+60
+82
+75
+65
+81
+76
+73
+90
+87
+94
+108
+105
+124
+127
+126
+157
+140
+143
+184
+150
+153
+204
+153
+158
+216
+154
+158
+222
+153
+152
+218
+148
+145
+212
+140
+138
+201
+134
+133
+191
+129
+126
+181
+120
+118
+167
+110
+107
+150
+102
+101
+135
+93
+90
+119
+86
+84
+105
+77
+75
+89
+68
+65
+74
+62
+60
+63
+59
+58
+56
+59
+55
+52
+55
+54
+50
+53
+53
+53
+52
+53
+55
+54
+54
+52
+56
+55
+50
+60
+58
+46
+63
+60
+43
+67
+62
+42
+70
+64
+42
+71
+63
+42
+72
+64
+43
+73
+65
+44
+73
+66
+48
+73
+65
+52
+72
+66
+54
+72
+65
+57
+72
+63
+58
+76
+61
+58
+76
+58
+58
+71
+55
+55
+64
+54
+53
+58
+54
+53
+53
+55
+52
+49
+56
+49
+47
+57
+48
+55
+60
+53
+55
+52
+43
+67
+48
+41
+93
+56
+50
+126
+66
+65
+149
+71
+71
+157
+63
+64
+158
+52
+52
+167
+59
+47
+170
+60
+43
+170
+63
+45
+170
+63
+45
+169
+62
+44
+169
+62
+42
+172
+63
+43
+176
+63
+45
+171
+56
+37
+178
+57
+40
+185
+58
+43
+191
+57
+45
+195
+57
+44
+200
+58
+46
+205
+58
+48
+207
+60
+52
+203
+62
+53
+198
+59
+52
+194
+57
+49
+193
+56
+46
+193
+56
+46
+194
+57
+47
+194
+56
+46
+195
+54
+44
+197
+55
+45
+209
+67
+57
+208
+64
+55
+195
+48
+38
+195
+44
+35
+208
+55
+47
+214
+60
+52
+211
+50
+42
+224
+51
+44
+228
+50
+40
+231
+50
+43
+232
+51
+42
+234
+51
+43
+237
+50
+43
+240
+47
+42
+243
+45
+42
+246
+47
+42
+245
+46
+41
+241
+48
+41
+236
+49
+40
+225
+52
+36
+218
+53
+34
+209
+54
+32
+208
+53
+31
+216
+55
+35
+217
+51
+35
+214
+51
+36
+213
+51
+38
+213
+53
+41
+212
+56
+44
+212
+60
+49
+214
+63
+54
+236
+89
+81
+225
+82
+74
+211
+72
+65
+204
+67
+59
+202
+69
+60
+204
+73
+63
+200
+69
+59
+192
+62
+49
+188
+58
+42
+188
+59
+40
+188
+58
+42
+185
+58
+41
+183
+58
+40
+184
+58
+43
+188
+62
+48
+191
+65
+51
+193
+65
+54
+193
+60
+51
+197
+60
+54
+207
+65
+61
+215
+69
+69
+221
+71
+72
+228
+73
+77
+235
+76
+80
+232
+66
+70
+234
+64
+67
+240
+67
+73
+249
+75
+84
+254
+78
+89
+252
+74
+90
+252
+70
+92
+252
+70
+95
+248
+65
+95
+249
+66
+97
+253
+69
+105
+255
+74
+112
+255
+78
+119
+255
+79
+122
+255
+78
+120
+255
+76
+118
+254
+77
+119
+255
+79
+118
+252
+77
+116
+250
+79
+115
+255
+87
+121
+255
+95
+123
+252
+85
+111
+233
+71
+94
+243
+86
+107
+231
+83
+99
+240
+100
+113
+255
+144
+154
+254
+137
+145
+236
+130
+134
+194
+95
+98
+165
+77
+76
+179
+104
+101
+206
+141
+137
+240
+187
+183
+255
+219
+215
+255
+238
+237
+255
+247
+247
+255
+250
+253
+251
+249
+254
+253
+250
+255
+252
+251
+255
+253
+250
+255
+255
+250
+255
+255
+250
+254
+255
+251
+252
+253
+252
+250
+255
+251
+248
+255
+251
+247
+255
+251
+248
+255
+250
+249
+255
+250
+249
+255
+247
+249
+255
+245
+247
+254
+242
+246
+252
+240
+242
+249
+237
+239
+242
+230
+230
+231
+221
+219
+223
+216
+210
+219
+215
+206
+221
+219
+207
+224
+222
+210
+223
+225
+214
+221
+228
+220
+207
+216
+211
+197
+206
+201
+60
+57
+52
+59
+56
+49
+56
+53
+48
+53
+50
+43
+52
+49
+42
+52
+49
+42
+53
+50
+43
+54
+51
+44
+55
+52
+45
+56
+53
+46
+57
+54
+47
+59
+56
+49
+61
+58
+49
+63
+60
+51
+65
+62
+53
+67
+63
+52
+74
+66
+55
+77
+67
+55
+80
+71
+56
+83
+74
+59
+87
+75
+59
+85
+76
+61
+85
+75
+63
+83
+74
+67
+83
+74
+75
+93
+87
+99
+110
+108
+130
+130
+130
+166
+145
+149
+197
+154
+160
+218
+159
+166
+234
+162
+169
+241
+161
+165
+239
+158
+160
+235
+153
+155
+229
+149
+152
+221
+148
+149
+214
+144
+145
+202
+137
+137
+189
+130
+131
+177
+122
+121
+161
+114
+113
+145
+102
+99
+126
+88
+86
+107
+80
+78
+92
+73
+71
+82
+70
+67
+76
+67
+66
+74
+63
+63
+75
+61
+61
+71
+59
+58
+64
+59
+57
+58
+60
+57
+52
+63
+59
+47
+67
+61
+45
+69
+64
+44
+70
+64
+42
+70
+65
+43
+69
+66
+47
+69
+67
+52
+67
+67
+55
+66
+67
+59
+65
+67
+62
+65
+65
+65
+69
+59
+67
+71
+61
+70
+71
+64
+72
+71
+68
+75
+70
+71
+76
+67
+72
+75
+63
+72
+71
+62
+71
+66
+67
+72
+65
+65
+61
+52
+75
+58
+48
+102
+70
+59
+128
+80
+70
+138
+74
+64
+140
+63
+53
+146
+56
+45
+164
+62
+47
+169
+62
+44
+171
+62
+42
+172
+63
+43
+173
+64
+44
+175
+64
+45
+176
+63
+45
+177
+60
+42
+177
+56
+39
+182
+56
+41
+189
+57
+42
+195
+57
+44
+200
+56
+45
+204
+56
+46
+210
+57
+49
+212
+59
+53
+207
+58
+52
+205
+58
+51
+203
+56
+49
+203
+56
+49
+204
+57
+50
+205
+58
+50
+204
+55
+48
+203
+54
+47
+211
+60
+53
+213
+62
+53
+210
+57
+49
+204
+50
+40
+206
+52
+42
+216
+59
+50
+218
+60
+51
+215
+51
+42
+228
+49
+42
+233
+49
+39
+236
+49
+42
+238
+50
+41
+240
+49
+41
+242
+47
+41
+244
+45
+40
+246
+44
+40
+247
+45
+41
+244
+47
+41
+240
+49
+41
+233
+51
+40
+226
+53
+39
+217
+54
+37
+210
+55
+33
+207
+55
+32
+212
+57
+37
+213
+56
+37
+211
+54
+37
+209
+52
+37
+210
+52
+40
+211
+55
+43
+210
+56
+46
+208
+55
+47
+227
+78
+71
+232
+88
+80
+231
+90
+83
+218
+81
+73
+204
+71
+62
+196
+68
+57
+191
+64
+55
+185
+62
+47
+185
+60
+42
+185
+60
+38
+185
+60
+40
+185
+58
+39
+184
+57
+40
+186
+59
+42
+192
+62
+48
+195
+65
+52
+201
+68
+59
+198
+64
+55
+201
+64
+58
+209
+70
+67
+213
+73
+72
+214
+72
+71
+216
+71
+74
+223
+73
+75
+230
+70
+72
+232
+66
+68
+237
+68
+73
+245
+76
+83
+252
+81
+90
+251
+79
+93
+251
+76
+93
+251
+75
+96
+246
+68
+94
+247
+68
+97
+249
+70
+102
+253
+73
+108
+255
+78
+117
+255
+79
+120
+255
+79
+120
+255
+80
+119
+246
+85
+119
+242
+84
+117
+244
+84
+118
+250
+89
+120
+255
+93
+123
+255
+92
+119
+247
+83
+107
+236
+74
+95
+246
+89
+106
+239
+87
+102
+227
+79
+93
+239
+94
+107
+218
+78
+89
+223
+86
+96
+222
+86
+96
+210
+89
+96
+191
+99
+100
+199
+128
+124
+230
+169
+166
+255
+208
+207
+255
+233
+231
+255
+241
+240
+255
+246
+247
+254
+252
+253
+251
+252
+255
+249
+253
+255
+248
+252
+255
+250
+251
+253
+250
+250
+252
+249
+249
+249
+250
+249
+247
+252
+248
+245
+255
+250
+246
+255
+250
+247
+255
+251
+250
+255
+250
+249
+255
+247
+247
+254
+242
+242
+252
+237
+240
+249
+234
+237
+240
+225
+228
+233
+221
+221
+228
+217
+213
+226
+217
+210
+230
+223
+213
+235
+231
+219
+241
+237
+225
+241
+241
+229
+236
+243
+236
+220
+231
+227
+208
+219
+215
+64
+61
+54
+61
+58
+51
+58
+55
+48
+55
+52
+45
+53
+50
+43
+53
+50
+43
+53
+50
+43
+54
+51
+44
+55
+52
+45
+55
+52
+45
+57
+54
+47
+59
+56
+49
+61
+58
+49
+63
+60
+51
+64
+61
+52
+66
+62
+51
+74
+66
+55
+77
+67
+55
+82
+70
+56
+86
+74
+58
+87
+75
+59
+88
+76
+60
+87
+75
+63
+84
+73
+67
+83
+74
+77
+94
+88
+102
+112
+109
+136
+130
+132
+171
+145
+151
+203
+156
+164
+227
+163
+173
+245
+167
+176
+253
+170
+177
+255
+166
+172
+250
+161
+167
+243
+160
+164
+238
+159
+163
+234
+157
+161
+225
+153
+155
+214
+149
+150
+204
+146
+146
+196
+137
+136
+180
+121
+121
+159
+106
+105
+139
+96
+93
+124
+88
+85
+112
+82
+80
+104
+79
+77
+101
+78
+74
+99
+75
+71
+94
+70
+66
+83
+64
+61
+72
+63
+58
+62
+63
+58
+54
+64
+60
+49
+65
+62
+47
+67
+64
+47
+67
+66
+48
+66
+67
+51
+66
+68
+55
+63
+68
+61
+62
+68
+64
+60
+69
+68
+59
+66
+72
+65
+67
+82
+71
+72
+92
+80
+81
+99
+89
+91
+106
+95
+97
+110
+99
+99
+109
+99
+98
+104
+101
+95
+97
+102
+88
+87
+95
+74
+69
+106
+72
+63
+130
+83
+73
+146
+88
+76
+143
+76
+60
+142
+65
+49
+150
+63
+46
+167
+66
+48
+174
+64
+47
+174
+65
+45
+175
+64
+45
+176
+65
+46
+180
+65
+47
+178
+61
+43
+176
+55
+38
+181
+55
+40
+188
+56
+43
+194
+56
+43
+200
+56
+45
+205
+54
+45
+209
+55
+47
+213
+56
+49
+216
+59
+52
+210
+55
+50
+208
+55
+50
+208
+55
+50
+209
+56
+50
+212
+57
+52
+212
+57
+52
+211
+56
+51
+211
+54
+47
+222
+65
+58
+213
+56
+47
+209
+51
+42
+214
+56
+47
+222
+61
+53
+222
+61
+53
+218
+57
+49
+220
+53
+44
+231
+50
+41
+235
+48
+39
+239
+48
+40
+241
+48
+41
+244
+47
+41
+247
+45
+41
+247
+44
+40
+247
+44
+40
+247
+45
+41
+244
+47
+41
+238
+50
+41
+233
+52
+41
+225
+53
+39
+218
+55
+38
+212
+55
+36
+207
+56
+35
+206
+55
+34
+207
+56
+37
+206
+55
+36
+207
+54
+38
+208
+55
+41
+210
+57
+43
+209
+55
+43
+206
+52
+42
+203
+52
+43
+227
+78
+71
+243
+100
+92
+235
+96
+89
+213
+79
+70
+196
+65
+55
+186
+59
+50
+181
+57
+45
+184
+62
+41
+184
+62
+39
+185
+60
+38
+185
+59
+37
+186
+57
+38
+189
+57
+42
+192
+60
+47
+196
+62
+50
+202
+68
+57
+202
+65
+57
+206
+69
+63
+213
+75
+72
+211
+76
+73
+206
+71
+68
+205
+69
+69
+214
+72
+71
+227
+73
+73
+230
+67
+68
+232
+69
+72
+242
+77
+83
+248
+83
+90
+249
+82
+92
+247
+79
+94
+250
+79
+97
+244
+72
+94
+245
+71
+96
+248
+71
+100
+251
+73
+105
+255
+78
+114
+255
+81
+120
+255
+82
+121
+255
+84
+122
+239
+84
+116
+239
+90
+119
+249
+96
+126
+253
+96
+125
+249
+86
+113
+242
+78
+103
+245
+81
+105
+253
+90
+109
+251
+93
+108
+255
+102
+116
+235
+80
+94
+243
+88
+102
+238
+83
+97
+246
+90
+104
+237
+79
+94
+223
+83
+94
+190
+92
+93
+188
+114
+111
+216
+152
+150
+249
+198
+195
+255
+226
+225
+255
+235
+233
+254
+242
+242
+255
+255
+253
+252
+255
+255
+251
+255
+255
+248
+255
+255
+249
+255
+253
+249
+253
+252
+250
+252
+249
+252
+251
+247
+253
+249
+246
+253
+248
+244
+255
+248
+245
+255
+249
+248
+255
+249
+248
+255
+245
+245
+251
+239
+239
+247
+232
+235
+243
+229
+229
+235
+221
+221
+232
+218
+217
+228
+217
+211
+232
+222
+213
+240
+232
+221
+249
+243
+229
+255
+250
+236
+254
+254
+242
+244
+250
+246
+227
+237
+236
+214
+224
+223
+66
+62
+53
+65
+61
+52
+64
+60
+51
+62
+58
+49
+60
+56
+47
+58
+54
+45
+56
+52
+43
+55
+51
+42
+54
+50
+41
+54
+50
+41
+55
+51
+42
+56
+52
+43
+59
+54
+48
+62
+57
+51
+65
+60
+54
+69
+62
+54
+73
+64
+55
+77
+67
+55
+82
+70
+56
+85
+73
+57
+87
+74
+58
+88
+75
+59
+90
+76
+65
+91
+78
+72
+84
+73
+77
+88
+82
+96
+103
+100
+129
+124
+126
+167
+141
+146
+202
+151
+160
+227
+158
+170
+246
+165
+176
+255
+170
+179
+255
+171
+178
+255
+172
+180
+255
+172
+178
+252
+170
+177
+249
+170
+175
+243
+168
+172
+236
+169
+171
+232
+159
+161
+218
+153
+154
+210
+141
+141
+193
+129
+127
+177
+116
+114
+161
+104
+101
+146
+93
+90
+135
+88
+82
+126
+88
+81
+122
+89
+81
+118
+86
+79
+110
+77
+72
+95
+67
+63
+77
+63
+58
+64
+63
+59
+58
+66
+63
+56
+62
+62
+52
+64
+66
+53
+66
+69
+58
+63
+68
+61
+60
+66
+62
+58
+67
+66
+62
+70
+72
+65
+75
+84
+70
+85
+106
+85
+101
+126
+101
+113
+137
+108
+114
+136
+119
+117
+139
+131
+119
+139
+132
+111
+126
+128
+95
+106
+137
+91
+101
+144
+88
+91
+157
+87
+87
+164
+87
+81
+162
+78
+68
+154
+65
+51
+151
+58
+40
+158
+59
+40
+167
+60
+42
+172
+61
+42
+174
+63
+44
+177
+64
+46
+179
+64
+45
+180
+63
+45
+182
+61
+44
+185
+59
+44
+186
+54
+39
+190
+54
+40
+196
+54
+42
+203
+55
+45
+209
+55
+45
+214
+56
+47
+218
+57
+49
+218
+56
+51
+215
+56
+52
+216
+57
+53
+217
+58
+54
+216
+57
+51
+216
+54
+49
+216
+54
+49
+218
+56
+51
+221
+58
+51
+230
+67
+60
+224
+61
+54
+218
+55
+48
+227
+64
+55
+254
+91
+82
+255
+108
+99
+255
+93
+84
+231
+63
+54
+229
+51
+41
+237
+50
+41
+241
+50
+42
+244
+47
+41
+244
+42
+38
+245
+40
+37
+248
+40
+38
+248
+43
+40
+247
+45
+43
+243
+48
+44
+237
+50
+43
+227
+49
+39
+218
+48
+35
+212
+49
+34
+212
+52
+36
+211
+58
+40
+204
+59
+38
+202
+60
+40
+205
+60
+41
+207
+60
+42
+210
+58
+44
+210
+57
+43
+210
+56
+44
+209
+55
+45
+218
+64
+56
+207
+56
+49
+220
+71
+65
+244
+99
+94
+229
+88
+81
+203
+66
+60
+197
+64
+59
+183
+52
+42
+183
+58
+38
+182
+60
+36
+185
+60
+38
+186
+60
+38
+189
+58
+40
+191
+58
+43
+196
+60
+48
+198
+62
+50
+199
+62
+52
+204
+67
+59
+217
+80
+74
+223
+88
+82
+212
+79
+74
+195
+63
+58
+192
+63
+58
+207
+72
+68
+222
+72
+71
+226
+71
+69
+230
+74
+75
+239
+80
+84
+241
+82
+87
+239
+78
+86
+237
+75
+88
+241
+76
+92
+249
+82
+102
+248
+79
+102
+247
+75
+101
+247
+74
+102
+252
+77
+108
+255
+81
+115
+255
+82
+118
+253
+82
+118
+245
+88
+119
+239
+89
+118
+243
+89
+117
+251
+92
+120
+255
+93
+120
+255
+91
+115
+254
+88
+110
+252
+86
+106
+255
+101
+117
+247
+89
+103
+253
+95
+109
+252
+94
+108
+234
+73
+88
+235
+73
+88
+251
+84
+101
+233
+88
+101
+198
+102
+103
+173
+103
+101
+203
+142
+139
+232
+181
+178
+249
+209
+207
+255
+234
+231
+254
+238
+238
+252
+248
+247
+246
+250
+249
+247
+255
+253
+247
+255
+254
+246
+255
+252
+248
+254
+252
+253
+255
+252
+253
+252
+248
+251
+247
+244
+255
+250
+246
+255
+250
+246
+255
+247
+244
+253
+243
+241
+255
+244
+244
+255
+243
+243
+246
+232
+232
+231
+217
+217
+228
+214
+213
+223
+209
+206
+225
+214
+208
+241
+231
+222
+252
+244
+231
+253
+247
+231
+255
+251
+232
+255
+255
+243
+249
+254
+248
+231
+240
+239
+218
+227
+226
+67
+63
+54
+66
+62
+51
+65
+61
+52
+63
+59
+50
+61
+57
+48
+59
+55
+46
+58
+54
+45
+57
+53
+44
+55
+51
+42
+55
+51
+42
+55
+51
+42
+56
+52
+43
+58
+53
+47
+61
+56
+50
+64
+59
+53
+68
+61
+53
+72
+63
+54
+76
+66
+54
+81
+69
+55
+84
+72
+56
+86
+73
+56
+87
+74
+57
+89
+75
+62
+90
+77
+69
+85
+74
+78
+87
+81
+95
+101
+98
+127
+121
+123
+164
+138
+143
+201
+148
+157
+226
+155
+166
+245
+163
+174
+254
+171
+180
+255
+172
+181
+255
+174
+182
+255
+175
+183
+255
+176
+183
+255
+175
+182
+252
+175
+180
+248
+175
+178
+245
+169
+170
+235
+162
+163
+227
+152
+152
+216
+140
+138
+201
+128
+127
+187
+117
+113
+174
+105
+101
+160
+99
+94
+152
+96
+87
+142
+96
+86
+136
+93
+84
+127
+86
+80
+116
+77
+73
+98
+70
+67
+84
+66
+65
+73
+65
+65
+67
+60
+60
+58
+65
+66
+61
+70
+69
+65
+67
+68
+63
+65
+63
+64
+68
+66
+69
+79
+77
+82
+88
+86
+99
+102
+103
+131
+116
+116
+150
+130
+125
+157
+138
+125
+155
+149
+124
+154
+160
+124
+150
+165
+113
+136
+164
+96
+117
+172
+89
+107
+180
+87
+98
+185
+81
+88
+181
+73
+71
+173
+64
+57
+168
+60
+47
+168
+61
+41
+169
+63
+41
+167
+56
+37
+168
+55
+37
+171
+56
+38
+174
+57
+40
+176
+56
+39
+178
+57
+40
+181
+55
+40
+184
+54
+40
+187
+51
+37
+194
+52
+40
+202
+55
+45
+211
+58
+50
+217
+60
+51
+222
+61
+53
+223
+60
+53
+223
+60
+53
+225
+62
+57
+223
+60
+55
+223
+60
+55
+225
+62
+57
+229
+66
+61
+232
+67
+61
+231
+66
+60
+230
+65
+59
+229
+64
+58
+230
+66
+57
+228
+64
+55
+220
+56
+47
+213
+49
+40
+216
+54
+43
+235
+73
+62
+255
+91
+79
+241
+64
+54
+238
+54
+44
+234
+43
+35
+238
+41
+35
+248
+45
+41
+255
+47
+45
+254
+44
+43
+246
+40
+40
+250
+48
+46
+245
+52
+47
+239
+54
+49
+231
+54
+46
+222
+51
+41
+214
+50
+38
+212
+50
+37
+207
+54
+38
+203
+58
+39
+200
+59
+39
+202
+60
+40
+205
+58
+40
+207
+57
+42
+208
+55
+41
+209
+53
+41
+208
+52
+40
+211
+57
+47
+207
+53
+45
+212
+61
+54
+229
+80
+74
+229
+84
+81
+219
+76
+72
+205
+66
+63
+183
+49
+40
+188
+59
+40
+187
+61
+38
+189
+60
+39
+190
+59
+39
+190
+57
+40
+192
+56
+40
+194
+58
+44
+196
+58
+47
+200
+62
+52
+203
+66
+56
+213
+79
+70
+220
+87
+80
+210
+82
+73
+195
+68
+61
+191
+67
+59
+204
+72
+67
+219
+76
+72
+223
+74
+70
+229
+77
+76
+235
+83
+82
+237
+84
+87
+235
+80
+86
+233
+78
+86
+236
+79
+90
+247
+86
+102
+248
+85
+104
+249
+83
+105
+250
+82
+107
+252
+82
+109
+255
+83
+113
+255
+83
+116
+254
+83
+117
+241
+76
+108
+245
+84
+115
+255
+92
+121
+255
+96
+123
+255
+91
+117
+253
+85
+110
+250
+82
+105
+249
+84
+101
+249
+87
+102
+242
+84
+98
+249
+93
+104
+249
+93
+104
+236
+82
+94
+241
+87
+99
+247
+93
+105
+217
+86
+94
+182
+96
+95
+153
+92
+87
+185
+127
+125
+218
+169
+165
+239
+199
+197
+254
+224
+222
+251
+233
+233
+253
+248
+245
+248
+250
+247
+247
+255
+253
+247
+255
+254
+245
+255
+252
+248
+254
+252
+253
+255
+252
+254
+253
+251
+252
+248
+245
+253
+250
+245
+254
+249
+245
+252
+247
+243
+252
+244
+241
+255
+245
+244
+255
+244
+244
+245
+233
+233
+234
+220
+219
+229
+215
+212
+222
+209
+203
+223
+213
+204
+239
+229
+219
+252
+245
+229
+255
+249
+231
+255
+252
+232
+255
+255
+239
+248
+253
+246
+232
+241
+238
+221
+227
+225
+69
+65
+54
+69
+65
+53
+67
+63
+52
+65
+61
+50
+63
+59
+48
+61
+57
+46
+60
+56
+45
+59
+55
+44
+56
+52
+43
+56
+52
+43
+55
+51
+42
+56
+52
+43
+58
+53
+47
+61
+56
+50
+63
+58
+52
+67
+60
+52
+71
+62
+53
+74
+66
+55
+78
+68
+56
+82
+70
+54
+84
+71
+54
+87
+71
+55
+89
+73
+60
+89
+74
+67
+87
+75
+75
+88
+80
+93
+98
+94
+121
+115
+117
+156
+133
+138
+194
+144
+153
+220
+152
+164
+240
+160
+171
+250
+170
+179
+254
+173
+181
+254
+175
+183
+255
+177
+185
+255
+179
+186
+255
+180
+187
+255
+181
+185
+255
+181
+185
+255
+175
+178
+249
+172
+172
+244
+163
+163
+235
+153
+151
+224
+142
+141
+211
+131
+128
+199
+120
+117
+188
+115
+109
+179
+107
+96
+162
+105
+93
+155
+99
+90
+145
+93
+87
+133
+86
+82
+119
+78
+75
+104
+69
+68
+86
+64
+64
+76
+56
+53
+60
+65
+60
+64
+75
+65
+66
+76
+64
+66
+81
+62
+66
+90
+69
+74
+112
+87
+93
+130
+99
+115
+152
+115
+149
+165
+122
+165
+175
+127
+167
+178
+123
+162
+184
+118
+154
+192
+112
+147
+194
+99
+131
+192
+84
+110
+193
+71
+94
+207
+76
+92
+207
+73
+82
+195
+61
+62
+183
+54
+48
+180
+58
+43
+178
+61
+41
+173
+61
+39
+175
+60
+41
+176
+59
+41
+178
+58
+41
+180
+59
+42
+183
+60
+44
+187
+60
+45
+192
+60
+45
+196
+60
+46
+196
+54
+42
+203
+56
+46
+211
+60
+49
+217
+63
+53
+223
+65
+56
+225
+62
+55
+224
+60
+51
+223
+58
+52
+220
+55
+49
+217
+52
+46
+216
+51
+45
+222
+57
+51
+230
+65
+59
+236
+69
+63
+233
+66
+60
+228
+61
+53
+227
+60
+52
+219
+52
+44
+216
+52
+43
+219
+55
+45
+212
+50
+39
+204
+44
+32
+214
+54
+42
+233
+71
+58
+245
+75
+62
+242
+64
+54
+239
+52
+45
+240
+45
+41
+246
+44
+42
+250
+44
+44
+252
+44
+44
+248
+42
+44
+240
+42
+41
+236
+47
+43
+232
+50
+46
+227
+53
+46
+220
+52
+43
+216
+49
+40
+213
+49
+39
+209
+51
+39
+205
+55
+40
+203
+58
+41
+205
+58
+40
+208
+58
+41
+210
+59
+42
+211
+58
+42
+212
+56
+43
+212
+56
+44
+209
+52
+43
+214
+60
+52
+213
+58
+53
+213
+60
+55
+229
+79
+78
+237
+89
+87
+217
+69
+69
+194
+51
+47
+192
+59
+44
+191
+60
+40
+192
+59
+42
+191
+58
+41
+193
+57
+41
+192
+56
+40
+192
+56
+42
+192
+56
+44
+198
+61
+51
+199
+65
+54
+207
+74
+65
+216
+85
+75
+210
+82
+71
+198
+71
+62
+192
+68
+58
+199
+71
+62
+214
+75
+68
+216
+73
+67
+221
+76
+73
+228
+83
+80
+229
+83
+84
+226
+80
+83
+226
+77
+83
+229
+78
+87
+242
+88
+100
+246
+90
+104
+253
+91
+112
+254
+90
+114
+252
+86
+110
+250
+82
+108
+251
+81
+108
+255
+81
+112
+248
+70
+106
+255
+79
+116
+255
+89
+123
+255
+90
+121
+255
+86
+113
+252
+84
+107
+254
+87
+107
+255
+92
+109
+250
+89
+104
+247
+91
+104
+248
+98
+109
+242
+98
+107
+231
+96
+103
+234
+105
+110
+229
+106
+109
+197
+94
+95
+160
+93
+87
+126
+77
+70
+155
+108
+102
+195
+151
+148
+223
+185
+182
+241
+211
+209
+244
+224
+223
+255
+245
+244
+249
+249
+247
+249
+255
+253
+247
+255
+255
+245
+255
+252
+248
+254
+252
+253
+255
+254
+255
+252
+253
+252
+248
+247
+252
+249
+244
+252
+249
+242
+250
+247
+242
+251
+246
+242
+255
+247
+244
+255
+246
+244
+249
+238
+236
+239
+228
+226
+230
+219
+215
+220
+209
+203
+221
+211
+201
+238
+228
+216
+253
+246
+228
+255
+251
+232
+255
+253
+231
+255
+255
+236
+248
+251
+242
+233
+239
+235
+224
+229
+225
+73
+69
+57
+72
+68
+56
+70
+66
+54
+68
+64
+52
+66
+62
+51
+64
+60
+49
+63
+59
+48
+62
+58
+47
+58
+54
+45
+57
+53
+44
+57
+53
+44
+57
+53
+44
+58
+53
+47
+60
+55
+49
+62
+57
+51
+64
+59
+53
+69
+62
+54
+73
+64
+55
+76
+68
+55
+79
+70
+53
+82
+69
+52
+85
+69
+53
+87
+71
+56
+87
+73
+62
+88
+77
+75
+88
+78
+87
+94
+90
+113
+112
+112
+150
+128
+134
+186
+140
+150
+212
+149
+161
+233
+157
+169
+245
+168
+176
+249
+169
+177
+249
+173
+179
+253
+176
+183
+255
+177
+183
+255
+178
+185
+255
+180
+184
+255
+180
+184
+255
+175
+177
+252
+171
+173
+248
+165
+167
+242
+159
+158
+234
+151
+150
+226
+140
+139
+215
+130
+129
+205
+125
+121
+197
+117
+109
+182
+112
+103
+170
+102
+96
+158
+95
+90
+144
+89
+88
+132
+81
+81
+117
+71
+71
+99
+65
+62
+81
+61
+53
+68
+72
+56
+66
+84
+61
+67
+96
+64
+69
+110
+67
+74
+128
+79
+85
+150
+93
+100
+170
+103
+120
+189
+108
+141
+201
+110
+153
+203
+111
+152
+201
+105
+143
+198
+97
+131
+199
+88
+120
+198
+73
+103
+196
+59
+85
+197
+51
+72
+216
+65
+80
+223
+69
+79
+208
+60
+60
+195
+56
+49
+194
+64
+50
+186
+65
+44
+175
+59
+36
+173
+54
+34
+173
+53
+36
+174
+53
+36
+179
+53
+38
+182
+55
+40
+188
+56
+43
+195
+59
+45
+200
+60
+47
+211
+64
+54
+215
+64
+55
+218
+64
+54
+220
+63
+54
+222
+61
+53
+222
+57
+51
+221
+54
+46
+219
+52
+44
+211
+46
+40
+210
+45
+39
+211
+46
+40
+216
+51
+45
+225
+58
+52
+227
+60
+52
+225
+56
+49
+220
+53
+45
+220
+53
+45
+208
+44
+34
+205
+41
+31
+217
+55
+44
+226
+66
+54
+220
+63
+48
+208
+52
+37
+203
+46
+31
+233
+70
+55
+243
+73
+60
+253
+72
+63
+252
+60
+55
+244
+45
+42
+241
+35
+37
+245
+39
+41
+251
+47
+50
+241
+45
+46
+235
+47
+46
+228
+50
+46
+222
+51
+44
+218
+49
+42
+215
+48
+42
+214
+47
+41
+211
+48
+39
+211
+55
+42
+210
+57
+43
+214
+58
+43
+216
+60
+45
+218
+62
+47
+219
+63
+48
+220
+64
+51
+220
+64
+51
+210
+54
+42
+230
+76
+66
+229
+74
+69
+206
+53
+48
+223
+71
+70
+243
+90
+92
+223
+73
+75
+213
+65
+63
+200
+60
+47
+196
+59
+43
+195
+58
+42
+195
+58
+42
+194
+58
+42
+194
+58
+42
+193
+57
+43
+190
+57
+42
+194
+60
+48
+194
+62
+50
+200
+70
+57
+207
+79
+66
+206
+80
+68
+198
+72
+60
+191
+67
+55
+193
+67
+55
+206
+72
+63
+209
+70
+63
+213
+74
+69
+219
+80
+75
+221
+82
+79
+217
+77
+76
+218
+75
+77
+220
+75
+80
+235
+88
+96
+243
+91
+103
+252
+97
+113
+255
+97
+117
+250
+88
+109
+245
+79
+103
+245
+77
+103
+253
+78
+107
+255
+76
+112
+255
+79
+116
+255
+83
+115
+255
+82
+110
+250
+84
+108
+252
+90
+111
+255
+99
+117
+255
+105
+120
+255
+102
+117
+250
+98
+111
+244
+98
+109
+236
+101
+108
+224
+103
+108
+212
+106
+106
+200
+106
+104
+177
+104
+97
+141
+94
+84
+104
+70
+60
+130
+93
+85
+172
+135
+129
+206
+171
+169
+229
+199
+197
+239
+218
+217
+255
+243
+243
+251
+247
+246
+249
+253
+252
+248
+255
+255
+245
+255
+254
+248
+254
+254
+255
+255
+255
+255
+251
+255
+254
+248
+248
+251
+250
+245
+250
+250
+242
+249
+248
+243
+253
+250
+245
+255
+251
+247
+255
+250
+247
+253
+243
+241
+247
+236
+232
+235
+224
+218
+223
+213
+204
+222
+212
+202
+237
+230
+214
+254
+247
+228
+255
+254
+232
+255
+254
+229
+255
+254
+233
+247
+249
+238
+234
+239
+232
+228
+231
+224
+78
+72
+58
+77
+71
+57
+76
+70
+56
+74
+68
+54
+72
+66
+54
+70
+64
+52
+68
+61
+51
+67
+60
+50
+63
+56
+48
+62
+55
+47
+61
+54
+46
+61
+54
+46
+61
+54
+48
+62
+55
+49
+64
+57
+51
+63
+58
+52
+67
+62
+56
+69
+65
+56
+75
+67
+56
+78
+69
+54
+81
+68
+51
+82
+69
+50
+86
+70
+54
+86
+72
+59
+90
+77
+71
+86
+77
+82
+91
+87
+104
+108
+107
+139
+126
+130
+177
+138
+147
+206
+146
+159
+227
+154
+166
+238
+166
+174
+247
+169
+175
+249
+173
+176
+253
+175
+179
+253
+176
+179
+255
+176
+180
+254
+176
+179
+255
+175
+179
+253
+171
+174
+251
+168
+171
+248
+164
+167
+244
+160
+162
+239
+154
+156
+233
+147
+149
+226
+138
+140
+217
+134
+133
+209
+131
+127
+201
+123
+117
+187
+109
+107
+172
+100
+101
+158
+95
+97
+146
+89
+91
+132
+82
+81
+115
+78
+72
+98
+87
+70
+89
+95
+67
+81
+109
+66
+76
+129
+69
+77
+152
+77
+84
+172
+85
+93
+188
+91
+98
+202
+90
+104
+214
+84
+112
+223
+83
+118
+222
+84
+117
+215
+80
+110
+208
+74
+99
+203
+67
+89
+198
+57
+74
+194
+47
+63
+211
+57
+69
+225
+68
+77
+228
+72
+75
+215
+63
+60
+205
+62
+54
+203
+71
+58
+194
+73
+52
+182
+63
+41
+183
+62
+43
+184
+61
+45
+186
+60
+45
+189
+62
+47
+195
+63
+48
+202
+66
+52
+208
+68
+55
+213
+69
+58
+217
+69
+57
+218
+66
+55
+219
+62
+53
+217
+59
+50
+217
+54
+45
+217
+53
+44
+218
+51
+43
+215
+51
+42
+212
+49
+42
+215
+52
+45
+218
+55
+46
+221
+57
+48
+223
+56
+48
+222
+55
+47
+221
+54
+46
+220
+53
+44
+214
+47
+38
+217
+53
+43
+215
+55
+43
+207
+50
+35
+205
+49
+34
+210
+57
+41
+213
+62
+45
+212
+59
+41
+216
+60
+45
+230
+68
+55
+248
+74
+65
+253
+68
+63
+249
+54
+52
+245
+42
+45
+246
+42
+45
+247
+47
+50
+247
+54
+55
+237
+53
+53
+226
+51
+48
+218
+49
+44
+215
+48
+42
+215
+47
+44
+217
+48
+45
+217
+48
+43
+227
+56
+49
+228
+57
+49
+226
+58
+49
+226
+59
+50
+224
+60
+48
+223
+61
+48
+220
+63
+48
+218
+62
+49
+209
+55
+43
+239
+87
+76
+248
+97
+90
+211
+59
+54
+209
+59
+58
+230
+80
+81
+220
+70
+72
+230
+80
+81
+207
+60
+52
+202
+58
+47
+198
+56
+44
+197
+57
+44
+196
+58
+45
+196
+60
+46
+195
+59
+45
+192
+59
+44
+190
+58
+45
+190
+60
+46
+195
+65
+51
+199
+72
+57
+199
+73
+59
+194
+68
+54
+190
+64
+50
+188
+62
+48
+201
+70
+60
+202
+69
+60
+206
+73
+66
+213
+80
+73
+215
+82
+77
+213
+78
+75
+211
+75
+75
+215
+76
+79
+233
+90
+96
+240
+94
+104
+252
+102
+114
+255
+104
+120
+252
+93
+113
+242
+80
+101
+243
+77
+101
+252
+79
+107
+255
+83
+117
+255
+82
+116
+254
+81
+111
+244
+82
+106
+243
+92
+111
+250
+103
+119
+253
+105
+119
+249
+101
+115
+253
+101
+116
+245
+94
+109
+239
+94
+107
+236
+106
+114
+221
+115
+117
+192
+107
+102
+168
+101
+92
+156
+110
+97
+127
+101
+86
+89
+71
+57
+110
+86
+74
+150
+123
+114
+190
+159
+156
+223
+193
+193
+238
+214
+214
+254
+238
+239
+254
+245
+246
+252
+252
+252
+249
+255
+255
+246
+255
+254
+249
+253
+254
+255
+255
+255
+255
+251
+255
+254
+248
+250
+253
+254
+248
+250
+253
+244
+250
+251
+245
+254
+253
+248
+255
+255
+250
+255
+253
+249
+255
+250
+244
+255
+246
+241
+242
+233
+226
+229
+221
+210
+225
+217
+204
+240
+233
+215
+255
+250
+228
+255
+255
+230
+255
+254
+229
+255
+254
+233
+246
+248
+234
+237
+240
+231
+232
+233
+225
+81
+75
+61
+80
+74
+60
+79
+73
+59
+77
+71
+57
+75
+69
+57
+73
+67
+55
+71
+64
+54
+71
+64
+54
+66
+59
+51
+65
+58
+50
+64
+57
+49
+63
+56
+48
+63
+56
+50
+63
+56
+50
+65
+58
+52
+64
+59
+53
+66
+63
+56
+69
+66
+57
+75
+69
+57
+77
+70
+54
+80
+69
+51
+82
+69
+50
+85
+70
+51
+85
+72
+55
+89
+76
+67
+85
+75
+76
+90
+83
+99
+105
+105
+133
+124
+129
+171
+137
+147
+200
+147
+158
+222
+154
+164
+235
+166
+172
+248
+169
+172
+251
+172
+173
+253
+173
+176
+255
+174
+177
+255
+174
+177
+254
+173
+176
+253
+173
+176
+253
+169
+172
+249
+167
+170
+247
+164
+168
+242
+162
+166
+240
+159
+163
+237
+154
+158
+232
+149
+153
+227
+146
+148
+222
+146
+146
+218
+137
+138
+205
+124
+128
+192
+115
+120
+178
+111
+117
+169
+109
+112
+157
+105
+103
+142
+106
+95
+125
+121
+95
+120
+130
+87
+106
+142
+80
+95
+163
+79
+92
+187
+83
+92
+205
+84
+93
+214
+80
+87
+218
+72
+83
+224
+65
+83
+228
+65
+84
+224
+69
+85
+217
+69
+81
+210
+69
+77
+204
+65
+70
+199
+59
+60
+198
+54
+54
+227
+74
+76
+229
+73
+74
+224
+66
+65
+211
+56
+52
+206
+57
+50
+206
+65
+55
+200
+68
+53
+190
+63
+46
+195
+69
+54
+195
+69
+54
+197
+70
+55
+201
+69
+56
+206
+70
+56
+209
+71
+58
+215
+71
+60
+218
+71
+61
+214
+62
+51
+213
+59
+49
+214
+56
+47
+213
+52
+44
+214
+51
+42
+216
+52
+43
+219
+52
+44
+218
+54
+45
+219
+56
+49
+221
+60
+52
+224
+61
+52
+223
+60
+51
+221
+57
+48
+220
+53
+45
+220
+53
+44
+219
+55
+45
+210
+46
+36
+221
+59
+48
+218
+61
+46
+205
+49
+34
+198
+45
+29
+206
+55
+38
+210
+61
+41
+205
+58
+38
+204
+57
+39
+212
+56
+41
+226
+58
+47
+243
+61
+57
+255
+64
+64
+255
+60
+62
+254
+51
+55
+243
+44
+47
+234
+44
+46
+225
+43
+42
+216
+42
+41
+212
+43
+40
+215
+47
+44
+222
+52
+52
+228
+56
+56
+233
+57
+57
+239
+55
+53
+240
+55
+52
+238
+55
+51
+232
+55
+49
+227
+55
+45
+220
+54
+42
+215
+53
+40
+209
+53
+38
+205
+53
+40
+231
+80
+69
+255
+109
+99
+219
+72
+65
+200
+52
+50
+215
+67
+67
+211
+62
+66
+234
+86
+86
+217
+65
+60
+210
+62
+52
+203
+56
+46
+198
+54
+43
+198
+58
+45
+198
+60
+47
+195
+62
+47
+193
+61
+46
+187
+57
+43
+187
+60
+45
+190
+63
+48
+192
+65
+50
+191
+65
+50
+189
+64
+46
+188
+61
+46
+187
+60
+45
+195
+67
+54
+196
+68
+57
+200
+72
+63
+208
+80
+71
+211
+82
+76
+208
+79
+73
+210
+78
+76
+213
+79
+78
+233
+94
+99
+238
+97
+103
+251
+105
+116
+255
+110
+122
+255
+100
+117
+245
+86
+106
+245
+81
+105
+254
+86
+111
+255
+86
+115
+255
+86
+113
+245
+87
+110
+238
+93
+110
+241
+109
+120
+247
+117
+127
+240
+106
+115
+227
+87
+98
+243
+95
+109
+245
+94
+109
+241
+96
+111
+241
+114
+125
+238
+135
+138
+206
+128
+124
+169
+117
+104
+151
+122
+106
+117
+106
+88
+82
+77
+58
+97
+85
+71
+132
+112
+103
+177
+149
+146
+221
+191
+191
+239
+213
+216
+253
+233
+235
+254
+244
+245
+252
+250
+251
+250
+254
+255
+248
+254
+254
+252
+253
+255
+255
+254
+255
+255
+250
+255
+255
+249
+253
+255
+255
+251
+248
+254
+244
+250
+253
+246
+255
+255
+250
+255
+255
+250
+255
+255
+248
+255
+252
+246
+255
+253
+245
+250
+241
+232
+238
+230
+219
+234
+226
+213
+245
+240
+221
+255
+251
+229
+255
+254
+229
+255
+254
+226
+255
+255
+231
+249
+250
+234
+242
+244
+231
+238
+240
+229
+83
+77
+61
+82
+76
+60
+81
+75
+61
+79
+73
+59
+77
+71
+57
+75
+69
+55
+74
+68
+56
+73
+67
+55
+69
+62
+52
+68
+61
+51
+66
+59
+51
+65
+58
+50
+64
+57
+51
+65
+58
+52
+65
+57
+54
+64
+59
+55
+65
+64
+59
+67
+67
+59
+73
+69
+57
+77
+71
+55
+79
+71
+50
+82
+70
+48
+85
+70
+49
+85
+72
+53
+87
+75
+63
+82
+72
+70
+88
+82
+94
+106
+103
+130
+125
+129
+167
+137
+147
+196
+146
+158
+218
+152
+162
+231
+164
+167
+246
+166
+167
+250
+171
+169
+252
+171
+172
+254
+172
+173
+255
+173
+174
+254
+172
+174
+251
+172
+174
+251
+168
+172
+246
+166
+170
+244
+164
+168
+241
+163
+167
+240
+161
+168
+238
+160
+167
+237
+157
+164
+232
+155
+162
+230
+153
+158
+226
+146
+154
+219
+139
+147
+210
+134
+143
+202
+131
+141
+194
+132
+136
+183
+131
+129
+168
+136
+121
+154
+143
+109
+136
+154
+99
+122
+169
+88
+105
+187
+81
+95
+207
+77
+89
+224
+73
+82
+232
+65
+73
+232
+62
+65
+228
+62
+62
+222
+65
+60
+216
+69
+61
+210
+74
+60
+202
+75
+60
+194
+71
+53
+191
+68
+50
+195
+65
+49
+226
+86
+73
+223
+72
+63
+217
+60
+55
+216
+54
+51
+218
+56
+53
+216
+59
+54
+210
+57
+52
+200
+56
+48
+192
+58
+46
+190
+60
+46
+191
+59
+46
+192
+58
+46
+194
+56
+43
+195
+55
+42
+198
+52
+39
+198
+50
+38
+206
+52
+42
+208
+51
+42
+209
+51
+40
+212
+51
+41
+214
+51
+42
+217
+53
+44
+221
+54
+46
+220
+56
+47
+222
+61
+51
+219
+61
+50
+220
+59
+49
+219
+56
+47
+219
+55
+45
+218
+54
+44
+216
+52
+42
+215
+51
+41
+213
+51
+38
+211
+51
+37
+208
+52
+37
+207
+54
+38
+210
+61
+41
+209
+62
+42
+202
+57
+36
+192
+50
+28
+200
+58
+38
+202
+52
+37
+213
+49
+39
+231
+53
+49
+250
+60
+60
+255
+61
+64
+255
+55
+61
+247
+51
+55
+234
+45
+49
+225
+45
+46
+217
+45
+45
+215
+47
+46
+220
+52
+51
+227
+57
+58
+233
+59
+61
+240
+57
+61
+246
+50
+54
+248
+48
+51
+244
+48
+49
+237
+49
+47
+228
+49
+42
+222
+50
+40
+213
+49
+37
+207
+51
+36
+201
+49
+36
+209
+61
+49
+250
+106
+95
+228
+84
+76
+200
+57
+53
+208
+64
+63
+203
+58
+61
+228
+82
+83
+228
+74
+72
+220
+67
+61
+209
+58
+51
+201
+54
+46
+198
+56
+46
+197
+59
+48
+194
+60
+48
+191
+61
+47
+186
+59
+42
+188
+63
+45
+189
+64
+46
+188
+63
+45
+186
+59
+42
+186
+59
+40
+189
+59
+43
+190
+60
+44
+188
+62
+48
+188
+62
+50
+192
+68
+56
+200
+76
+66
+204
+80
+72
+202
+78
+70
+204
+76
+73
+208
+78
+76
+232
+97
+101
+236
+97
+102
+248
+104
+114
+255
+111
+123
+255
+104
+120
+247
+90
+107
+247
+85
+106
+253
+91
+114
+249
+91
+114
+244
+95
+115
+233
+98
+113
+227
+107
+116
+234
+125
+128
+242
+133
+136
+234
+118
+121
+222
+92
+100
+246
+101
+116
+255
+107
+124
+247
+98
+117
+238
+106
+119
+249
+144
+149
+239
+161
+159
+196
+148
+138
+163
+140
+124
+106
+105
+85
+73
+81
+60
+88
+85
+70
+117
+103
+92
+165
+140
+136
+220
+190
+190
+242
+213
+217
+249
+227
+230
+255
+242
+245
+255
+249
+251
+252
+253
+255
+249
+253
+255
+252
+253
+255
+255
+253
+255
+255
+251
+255
+255
+248
+253
+254
+255
+251
+247
+253
+243
+247
+253
+243
+253
+255
+247
+255
+255
+248
+255
+253
+246
+255
+251
+245
+255
+255
+246
+255
+250
+240
+246
+240
+226
+242
+236
+220
+251
+246
+226
+255
+252
+230
+254
+252
+227
+254
+253
+225
+255
+255
+230
+253
+254
+236
+248
+249
+235
+246
+246
+234
+86
+79
+63
+84
+78
+62
+83
+75
+62
+80
+74
+60
+79
+71
+58
+76
+70
+56
+76
+68
+55
+74
+68
+56
+72
+64
+53
+70
+64
+52
+69
+60
+51
+66
+59
+49
+66
+57
+50
+65
+58
+50
+67
+58
+51
+65
+60
+54
+67
+64
+57
+68
+68
+58
+74
+70
+58
+77
+71
+55
+79
+71
+50
+81
+70
+48
+84
+72
+50
+85
+72
+53
+85
+73
+61
+81
+71
+69
+87
+81
+93
+106
+104
+128
+126
+130
+168
+140
+148
+197
+147
+157
+216
+153
+162
+231
+159
+160
+242
+164
+160
+247
+166
+163
+250
+169
+166
+253
+169
+169
+255
+169
+171
+254
+169
+172
+253
+169
+172
+251
+165
+171
+245
+163
+170
+242
+163
+167
+238
+162
+167
+235
+164
+169
+237
+165
+170
+238
+165
+168
+237
+163
+167
+238
+152
+161
+230
+150
+161
+227
+148
+159
+221
+148
+159
+213
+149
+155
+203
+152
+150
+190
+158
+141
+175
+168
+132
+160
+164
+102
+127
+178
+93
+114
+193
+82
+99
+206
+74
+88
+218
+66
+78
+228
+62
+72
+235
+60
+67
+235
+61
+62
+231
+64
+58
+223
+67
+55
+216
+70
+55
+209
+74
+55
+199
+74
+52
+191
+71
+47
+189
+67
+44
+193
+64
+45
+225
+83
+69
+221
+68
+60
+221
+57
+55
+230
+62
+61
+236
+68
+67
+230
+64
+64
+219
+56
+57
+207
+53
+51
+205
+67
+57
+200
+68
+56
+201
+67
+56
+199
+65
+53
+198
+62
+50
+195
+57
+44
+194
+54
+41
+194
+50
+39
+198
+50
+40
+203
+51
+40
+206
+52
+42
+211
+53
+44
+216
+53
+46
+217
+52
+46
+219
+52
+46
+219
+52
+44
+228
+66
+55
+222
+60
+49
+218
+54
+44
+218
+54
+44
+223
+57
+45
+223
+57
+45
+219
+53
+41
+213
+49
+37
+216
+56
+40
+206
+49
+32
+202
+49
+33
+208
+57
+40
+206
+56
+39
+199
+52
+34
+202
+55
+37
+212
+67
+48
+200
+55
+38
+206
+56
+42
+215
+54
+44
+222
+53
+46
+230
+51
+47
+238
+53
+51
+246
+58
+57
+251
+63
+62
+255
+76
+75
+250
+72
+70
+242
+66
+66
+236
+62
+61
+234
+60
+61
+231
+55
+58
+229
+50
+54
+230
+44
+49
+244
+43
+49
+248
+41
+47
+244
+44
+46
+239
+47
+46
+232
+49
+43
+224
+52
+42
+217
+53
+41
+211
+55
+40
+198
+48
+33
+192
+46
+31
+244
+100
+89
+235
+93
+83
+207
+64
+58
+212
+68
+67
+203
+59
+59
+223
+77
+77
+234
+82
+81
+224
+72
+69
+211
+59
+54
+201
+54
+47
+198
+56
+46
+198
+57
+47
+195
+59
+45
+190
+58
+43
+190
+60
+44
+193
+64
+45
+192
+65
+46
+187
+60
+41
+183
+56
+37
+184
+57
+38
+189
+60
+41
+190
+63
+46
+181
+55
+41
+179
+55
+43
+184
+62
+49
+193
+71
+58
+197
+75
+64
+197
+73
+65
+200
+73
+66
+203
+74
+69
+229
+97
+95
+230
+94
+96
+241
+100
+106
+254
+110
+119
+254
+107
+117
+243
+93
+105
+240
+88
+101
+246
+94
+109
+248
+97
+116
+241
+100
+116
+229
+104
+112
+223
+110
+114
+233
+127
+127
+249
+141
+139
+247
+131
+132
+239
+110
+115
+253
+112
+121
+255
+120
+134
+245
+97
+113
+223
+88
+102
+246
+136
+145
+255
+180
+180
+211
+173
+162
+164
+153
+135
+96
+104
+80
+69
+81
+57
+82
+84
+63
+107
+97
+85
+156
+136
+129
+220
+192
+191
+244
+215
+217
+246
+224
+227
+255
+241
+244
+255
+248
+251
+253
+253
+255
+251
+252
+255
+252
+253
+255
+255
+253
+255
+255
+252
+255
+254
+249
+253
+250
+255
+249
+242
+254
+240
+242
+252
+241
+249
+255
+244
+253
+255
+247
+250
+252
+241
+254
+251
+242
+255
+255
+244
+255
+255
+243
+252
+246
+232
+248
+242
+226
+254
+249
+229
+255
+253
+231
+253
+251
+226
+253
+252
+224
+255
+255
+233
+255
+255
+241
+252
+252
+240
+251
+251
+239
+88
+79
+64
+87
+80
+64
+87
+78
+63
+85
+78
+62
+84
+75
+60
+82
+75
+59
+82
+73
+58
+80
+72
+59
+77
+67
+55
+75
+67
+54
+75
+65
+53
+72
+64
+51
+72
+62
+50
+71
+63
+50
+72
+62
+50
+70
+64
+52
+71
+67
+58
+71
+69
+57
+74
+71
+56
+78
+73
+54
+82
+74
+53
+85
+74
+52
+85
+74
+52
+86
+75
+57
+88
+78
+68
+85
+76
+77
+90
+84
+98
+107
+104
+131
+123
+126
+167
+137
+143
+195
+145
+153
+215
+152
+159
+231
+166
+162
+246
+167
+161
+249
+165
+160
+252
+164
+161
+252
+162
+163
+255
+163
+167
+255
+164
+170
+255
+164
+173
+252
+161
+170
+245
+161
+169
+241
+161
+168
+236
+164
+169
+237
+167
+170
+239
+172
+170
+243
+174
+170
+246
+171
+170
+246
+161
+168
+246
+156
+166
+238
+149
+160
+222
+152
+159
+211
+166
+164
+203
+180
+160
+188
+180
+135
+155
+179
+105
+120
+186
+78
+93
+205
+70
+84
+219
+65
+77
+227
+61
+73
+228
+61
+71
+227
+62
+69
+223
+64
+69
+223
+64
+68
+226
+61
+65
+221
+61
+61
+219
+70
+66
+200
+59
+52
+202
+68
+59
+202
+69
+60
+186
+49
+41
+219
+74
+69
+230
+75
+73
+233
+67
+69
+235
+62
+66
+232
+59
+63
+230
+60
+63
+225
+61
+62
+219
+59
+59
+212
+60
+57
+207
+66
+59
+200
+63
+55
+202
+68
+59
+209
+77
+65
+205
+75
+62
+191
+61
+48
+184
+54
+41
+189
+57
+44
+191
+55
+43
+195
+54
+44
+200
+53
+45
+203
+50
+42
+209
+47
+42
+212
+47
+43
+219
+50
+47
+224
+53
+46
+231
+65
+53
+224
+56
+43
+219
+49
+36
+222
+50
+38
+230
+57
+43
+231
+59
+45
+225
+55
+38
+215
+50
+31
+209
+50
+31
+206
+51
+31
+203
+52
+33
+201
+51
+34
+201
+51
+34
+203
+51
+37
+206
+53
+39
+207
+53
+41
+202
+48
+38
+207
+50
+41
+209
+53
+41
+210
+54
+42
+210
+52
+40
+213
+51
+38
+215
+51
+39
+220
+52
+41
+224
+50
+41
+230
+51
+46
+235
+53
+50
+235
+51
+51
+233
+47
+50
+231
+45
+50
+232
+45
+52
+237
+46
+53
+246
+45
+51
+246
+43
+47
+239
+43
+44
+236
+47
+45
+234
+53
+46
+227
+57
+44
+217
+55
+40
+208
+52
+37
+195
+45
+28
+196
+51
+34
+231
+88
+72
+233
+89
+78
+203
+59
+51
+223
+78
+73
+197
+52
+49
+218
+72
+72
+225
+79
+80
+220
+74
+74
+212
+67
+64
+204
+59
+54
+200
+56
+48
+198
+56
+44
+199
+57
+43
+200
+60
+43
+197
+60
+42
+194
+59
+40
+190
+57
+38
+188
+59
+40
+187
+60
+41
+186
+61
+41
+186
+61
+43
+183
+60
+44
+180
+56
+44
+181
+59
+48
+185
+61
+49
+187
+63
+51
+187
+63
+51
+190
+64
+52
+192
+64
+53
+196
+65
+55
+239
+106
+97
+245
+112
+105
+234
+99
+95
+244
+109
+106
+251
+113
+113
+236
+97
+100
+244
+103
+109
+255
+112
+121
+255
+107
+122
+251
+104
+120
+234
+103
+111
+226
+101
+105
+229
+103
+106
+237
+109
+110
+243
+110
+111
+245
+109
+111
+255
+119
+123
+255
+126
+133
+241
+95
+108
+241
+105
+119
+214
+103
+112
+248
+174
+175
+189
+167
+154
+133
+141
+117
+97
+112
+81
+74
+89
+58
+77
+81
+56
+115
+110
+90
+165
+149
+136
+205
+182
+176
+237
+213
+211
+255
+238
+240
+255
+244
+245
+255
+245
+249
+252
+247
+251
+251
+251
+253
+253
+254
+255
+254
+255
+255
+255
+254
+255
+251
+255
+254
+239
+255
+243
+229
+252
+232
+231
+249
+233
+240
+254
+237
+248
+255
+245
+252
+255
+244
+253
+255
+242
+255
+253
+240
+255
+253
+241
+255
+251
+238
+255
+250
+234
+255
+250
+230
+254
+249
+227
+252
+250
+225
+252
+250
+225
+251
+250
+229
+253
+253
+241
+255
+255
+250
+255
+255
+250
+89
+80
+65
+88
+79
+64
+88
+79
+64
+86
+77
+62
+85
+76
+61
+84
+75
+60
+83
+74
+59
+82
+73
+58
+78
+69
+54
+77
+68
+53
+76
+67
+52
+75
+66
+51
+74
+65
+50
+74
+65
+50
+74
+65
+50
+73
+65
+52
+71
+67
+56
+72
+68
+57
+76
+70
+56
+79
+72
+54
+82
+74
+53
+83
+75
+52
+86
+75
+55
+84
+75
+58
+88
+78
+69
+85
+76
+77
+89
+85
+99
+107
+104
+131
+123
+125
+166
+134
+140
+192
+141
+149
+211
+150
+154
+225
+161
+156
+236
+163
+155
+241
+161
+157
+244
+161
+158
+249
+160
+161
+253
+160
+165
+255
+162
+170
+255
+161
+172
+251
+160
+172
+244
+160
+171
+237
+158
+167
+232
+161
+166
+232
+164
+164
+234
+166
+164
+237
+166
+162
+238
+163
+160
+237
+163
+166
+243
+160
+164
+235
+160
+160
+220
+165
+155
+205
+177
+153
+189
+188
+143
+166
+189
+115
+130
+191
+87
+98
+204
+70
+77
+220
+63
+70
+230
+59
+67
+233
+58
+65
+230
+59
+67
+225
+62
+67
+219
+64
+68
+218
+65
+70
+224
+60
+67
+218
+57
+63
+218
+65
+68
+203
+59
+59
+204
+66
+63
+202
+64
+61
+193
+51
+49
+229
+79
+80
+230
+67
+70
+232
+63
+68
+234
+59
+66
+231
+56
+63
+226
+56
+59
+219
+56
+57
+213
+58
+56
+207
+59
+55
+212
+69
+63
+198
+61
+53
+197
+60
+52
+204
+71
+62
+204
+76
+65
+193
+67
+53
+184
+58
+44
+183
+57
+43
+185
+55
+42
+191
+55
+43
+198
+54
+45
+203
+52
+45
+209
+50
+46
+216
+51
+47
+225
+53
+51
+228
+56
+52
+229
+61
+50
+226
+58
+45
+225
+53
+41
+225
+52
+38
+228
+52
+39
+226
+53
+39
+221
+51
+34
+213
+50
+31
+211
+56
+36
+205
+56
+34
+201
+56
+37
+200
+58
+38
+204
+58
+43
+206
+58
+44
+207
+55
+44
+208
+51
+42
+213
+51
+46
+214
+53
+45
+211
+55
+43
+207
+55
+41
+201
+54
+38
+199
+52
+34
+203
+52
+33
+207
+52
+34
+216
+50
+36
+222
+50
+38
+227
+48
+43
+230
+46
+44
+230
+44
+45
+230
+44
+47
+230
+45
+50
+232
+46
+51
+236
+43
+46
+237
+44
+45
+236
+48
+46
+232
+50
+46
+224
+52
+42
+219
+53
+39
+213
+56
+39
+210
+57
+39
+213
+63
+46
+187
+42
+25
+214
+68
+53
+208
+62
+49
+217
+70
+62
+235
+86
+80
+218
+66
+63
+216
+66
+65
+231
+85
+86
+226
+82
+82
+220
+75
+72
+212
+67
+62
+205
+61
+53
+201
+57
+46
+200
+57
+43
+199
+56
+40
+200
+59
+42
+196
+59
+40
+191
+58
+39
+189
+60
+41
+189
+62
+43
+186
+63
+45
+185
+64
+47
+182
+62
+46
+178
+58
+44
+180
+59
+48
+183
+61
+48
+184
+62
+49
+186
+63
+48
+189
+63
+49
+193
+66
+51
+197
+67
+53
+235
+105
+92
+242
+109
+100
+231
+98
+91
+240
+107
+102
+245
+111
+108
+232
+98
+97
+241
+107
+108
+254
+115
+120
+255
+111
+126
+255
+110
+124
+242
+107
+114
+228
+97
+102
+228
+92
+96
+239
+99
+102
+253
+110
+112
+255
+119
+120
+253
+117
+119
+255
+121
+126
+235
+89
+100
+237
+99
+112
+215
+99
+110
+242
+168
+169
+178
+162
+147
+118
+134
+107
+94
+114
+79
+78
+95
+59
+83
+90
+59
+117
+115
+92
+169
+157
+141
+214
+196
+184
+246
+225
+220
+255
+245
+241
+255
+248
+248
+255
+248
+249
+253
+249
+250
+251
+251
+251
+250
+254
+253
+251
+255
+254
+250
+254
+255
+246
+255
+250
+237
+255
+242
+227
+255
+232
+227
+251
+229
+235
+254
+234
+244
+255
+240
+249
+255
+241
+252
+255
+241
+255
+255
+240
+255
+253
+239
+255
+253
+237
+255
+251
+233
+254
+247
+229
+249
+244
+224
+248
+243
+221
+250
+245
+223
+250
+247
+228
+249
+249
+239
+251
+252
+246
+254
+253
+249
+92
+80
+66
+91
+79
+65
+91
+79
+65
+89
+77
+63
+88
+76
+62
+87
+75
+61
+86
+74
+60
+86
+74
+60
+83
+71
+57
+82
+70
+56
+81
+69
+55
+79
+67
+53
+79
+67
+53
+79
+67
+53
+79
+67
+53
+77
+67
+55
+74
+67
+57
+74
+70
+59
+77
+71
+57
+80
+73
+55
+83
+75
+54
+86
+75
+53
+86
+75
+55
+84
+75
+58
+87
+77
+67
+86
+77
+78
+90
+87
+98
+107
+105
+129
+121
+123
+161
+133
+137
+185
+139
+145
+203
+146
+150
+214
+153
+152
+222
+155
+151
+227
+155
+152
+233
+155
+156
+238
+157
+159
+244
+158
+163
+247
+160
+167
+248
+160
+169
+244
+160
+170
+239
+157
+168
+232
+155
+165
+227
+156
+162
+224
+156
+160
+224
+157
+158
+225
+156
+154
+227
+155
+153
+226
+153
+154
+221
+158
+152
+214
+168
+147
+204
+178
+140
+189
+191
+131
+169
+198
+115
+145
+197
+91
+111
+194
+70
+81
+209
+68
+76
+218
+65
+68
+223
+63
+65
+225
+62
+63
+225
+62
+65
+225
+62
+67
+223
+62
+68
+223
+62
+70
+224
+60
+67
+215
+56
+61
+213
+63
+65
+207
+65
+64
+202
+67
+63
+195
+60
+56
+196
+57
+54
+233
+87
+87
+224
+66
+67
+228
+62
+66
+232
+59
+63
+227
+57
+60
+220
+54
+56
+214
+54
+54
+209
+57
+54
+204
+59
+54
+213
+72
+65
+196
+59
+49
+190
+53
+43
+197
+65
+53
+205
+75
+62
+198
+72
+58
+187
+61
+47
+183
+56
+41
+186
+54
+41
+191
+55
+41
+199
+55
+44
+207
+54
+46
+215
+53
+48
+222
+55
+49
+230
+57
+53
+233
+61
+57
+217
+50
+42
+218
+51
+42
+221
+53
+42
+223
+52
+42
+223
+52
+42
+222
+54
+41
+220
+57
+42
+217
+62
+44
+198
+51
+33
+192
+51
+31
+187
+52
+33
+186
+53
+34
+191
+55
+41
+191
+55
+41
+191
+50
+40
+193
+44
+37
+227
+64
+59
+229
+62
+56
+222
+61
+51
+213
+60
+46
+204
+57
+41
+200
+55
+36
+200
+55
+34
+204
+55
+35
+210
+55
+37
+213
+51
+36
+215
+47
+38
+217
+46
+39
+219
+46
+42
+220
+46
+45
+219
+47
+47
+220
+46
+47
+219
+44
+41
+223
+48
+43
+224
+53
+45
+220
+53
+44
+213
+51
+38
+208
+52
+37
+208
+57
+38
+209
+62
+42
+212
+65
+47
+194
+49
+32
+231
+83
+69
+210
+59
+48
+218
+65
+59
+222
+67
+63
+232
+74
+73
+240
+84
+85
+237
+85
+84
+231
+83
+81
+227
+79
+77
+221
+74
+67
+214
+67
+59
+207
+60
+50
+202
+56
+43
+197
+54
+38
+196
+55
+38
+192
+55
+37
+188
+55
+38
+185
+58
+39
+185
+60
+42
+183
+62
+45
+181
+61
+44
+178
+61
+44
+176
+58
+44
+177
+59
+47
+180
+60
+46
+181
+61
+47
+183
+61
+46
+185
+63
+48
+190
+67
+52
+195
+69
+55
+220
+92
+81
+234
+103
+93
+228
+97
+89
+240
+108
+103
+246
+112
+109
+231
+97
+96
+236
+102
+103
+245
+106
+113
+228
+80
+94
+240
+94
+107
+240
+106
+113
+235
+104
+109
+235
+99
+103
+242
+102
+105
+254
+111
+113
+255
+117
+119
+253
+114
+117
+252
+111
+117
+231
+81
+93
+232
+90
+104
+217
+97
+109
+237
+158
+161
+170
+152
+138
+108
+122
+96
+89
+109
+72
+79
+100
+61
+87
+96
+65
+119
+119
+93
+173
+165
+146
+225
+209
+194
+255
+238
+230
+255
+248
+241
+255
+251
+247
+255
+252
+248
+252
+253
+248
+250
+255
+251
+251
+255
+253
+251
+255
+253
+249
+255
+251
+244
+255
+246
+233
+255
+237
+222
+252
+226
+220
+246
+221
+225
+247
+224
+233
+251
+229
+239
+251
+231
+245
+252
+234
+252
+255
+236
+253
+250
+233
+255
+250
+234
+255
+248
+230
+249
+242
+224
+241
+234
+216
+239
+232
+213
+243
+236
+217
+247
+242
+223
+251
+248
+239
+252
+252
+244
+255
+254
+249
+92
+80
+66
+92
+80
+66
+91
+79
+65
+90
+78
+64
+89
+77
+63
+89
+77
+63
+88
+76
+62
+88
+76
+62
+85
+73
+59
+84
+72
+58
+83
+71
+57
+82
+70
+56
+82
+70
+56
+82
+70
+56
+82
+70
+56
+80
+70
+58
+76
+69
+59
+75
+71
+60
+79
+73
+59
+82
+75
+57
+84
+76
+55
+87
+76
+54
+87
+76
+56
+87
+75
+59
+86
+76
+66
+85
+77
+75
+92
+86
+96
+106
+104
+126
+121
+121
+155
+130
+133
+178
+138
+141
+194
+143
+148
+206
+148
+148
+210
+149
+148
+214
+149
+149
+219
+150
+152
+227
+152
+155
+232
+152
+158
+236
+155
+161
+237
+155
+163
+235
+156
+165
+232
+152
+162
+223
+150
+159
+218
+149
+155
+213
+147
+153
+213
+147
+151
+214
+146
+147
+214
+145
+144
+210
+136
+131
+189
+148
+130
+182
+168
+124
+175
+184
+115
+162
+199
+102
+143
+207
+88
+120
+210
+72
+97
+208
+62
+75
+217
+68
+74
+218
+68
+67
+218
+69
+65
+220
+68
+65
+222
+66
+67
+225
+64
+69
+229
+62
+70
+229
+62
+70
+227
+63
+70
+214
+58
+62
+209
+63
+64
+209
+69
+68
+198
+65
+60
+186
+54
+49
+197
+62
+58
+234
+90
+89
+221
+65
+66
+227
+64
+67
+230
+61
+64
+227
+58
+61
+219
+56
+57
+211
+57
+55
+208
+60
+56
+206
+65
+56
+207
+69
+59
+194
+58
+46
+187
+50
+40
+192
+60
+47
+199
+69
+55
+196
+69
+54
+189
+62
+47
+184
+57
+40
+189
+56
+41
+194
+57
+41
+203
+56
+46
+210
+58
+47
+217
+56
+48
+224
+57
+49
+232
+59
+55
+235
+62
+56
+217
+48
+43
+218
+49
+42
+222
+51
+44
+224
+51
+44
+225
+52
+45
+225
+54
+46
+220
+56
+46
+217
+59
+47
+202
+54
+40
+199
+58
+41
+195
+59
+43
+192
+59
+44
+192
+58
+46
+195
+58
+48
+198
+59
+54
+208
+56
+53
+236
+67
+64
+237
+64
+60
+228
+64
+55
+217
+61
+49
+207
+57
+42
+199
+57
+37
+200
+58
+38
+201
+59
+37
+207
+60
+40
+208
+55
+39
+207
+49
+37
+209
+49
+37
+212
+49
+40
+214
+51
+44
+212
+49
+44
+209
+47
+42
+211
+50
+42
+211
+53
+44
+211
+55
+43
+208
+55
+41
+205
+53
+39
+202
+55
+37
+204
+59
+40
+204
+62
+42
+204
+59
+40
+207
+60
+44
+244
+94
+80
+224
+70
+60
+210
+51
+47
+210
+46
+44
+230
+64
+64
+251
+87
+88
+255
+117
+115
+255
+114
+111
+255
+106
+103
+246
+94
+89
+231
+80
+71
+213
+65
+55
+199
+53
+40
+189
+46
+32
+196
+56
+39
+192
+56
+40
+187
+56
+38
+184
+59
+41
+183
+60
+44
+181
+61
+45
+178
+61
+44
+176
+60
+45
+175
+59
+46
+173
+60
+46
+176
+60
+47
+176
+60
+45
+177
+59
+45
+182
+62
+46
+188
+66
+51
+192
+70
+55
+203
+77
+65
+223
+96
+87
+226
+97
+91
+244
+112
+108
+248
+116
+114
+230
+96
+97
+228
+93
+97
+232
+93
+100
+218
+70
+84
+234
+88
+101
+239
+105
+114
+236
+107
+111
+240
+104
+108
+249
+109
+112
+255
+113
+118
+255
+115
+118
+254
+111
+115
+248
+103
+110
+229
+74
+88
+229
+82
+98
+218
+93
+107
+230
+148
+150
+168
+145
+131
+106
+116
+89
+85
+106
+67
+83
+104
+63
+92
+103
+69
+121
+124
+95
+176
+170
+148
+231
+220
+202
+255
+245
+232
+255
+249
+240
+255
+249
+239
+252
+252
+242
+251
+254
+245
+250
+255
+249
+249
+255
+250
+246
+255
+248
+242
+252
+243
+234
+251
+235
+219
+247
+222
+208
+241
+210
+205
+234
+204
+209
+235
+206
+217
+237
+210
+223
+239
+213
+233
+243
+219
+242
+247
+225
+244
+246
+225
+249
+246
+227
+251
+246
+227
+244
+237
+219
+234
+227
+209
+231
+222
+205
+235
+226
+209
+240
+233
+217
+251
+244
+234
+251
+246
+240
+254
+249
+243
+92
+80
+66
+92
+80
+66
+91
+79
+65
+91
+79
+65
+90
+78
+64
+89
+77
+63
+89
+77
+63
+89
+77
+63
+87
+75
+61
+86
+74
+60
+85
+73
+59
+85
+73
+59
+84
+72
+58
+85
+73
+59
+85
+73
+59
+83
+73
+61
+79
+71
+60
+79
+73
+61
+81
+73
+60
+83
+76
+58
+85
+77
+56
+88
+77
+55
+89
+76
+57
+88
+76
+60
+85
+75
+65
+85
+75
+73
+92
+85
+93
+104
+101
+120
+117
+116
+147
+124
+126
+165
+133
+135
+183
+140
+143
+194
+141
+144
+195
+142
+145
+200
+142
+146
+207
+144
+148
+212
+146
+149
+220
+147
+151
+224
+148
+152
+223
+147
+154
+222
+149
+157
+220
+146
+155
+214
+142
+148
+206
+137
+144
+199
+133
+139
+197
+129
+135
+195
+126
+130
+193
+129
+125
+184
+128
+115
+159
+145
+110
+150
+170
+102
+143
+193
+92
+134
+214
+78
+118
+225
+65
+101
+229
+59
+85
+230
+59
+75
+226
+67
+71
+220
+71
+67
+216
+73
+65
+216
+73
+65
+220
+71
+67
+227
+66
+71
+236
+62
+72
+237
+61
+72
+230
+66
+73
+215
+62
+64
+208
+64
+63
+208
+73
+69
+191
+62
+56
+179
+50
+44
+200
+67
+60
+224
+85
+80
+220
+68
+67
+225
+65
+67
+227
+63
+64
+225
+62
+63
+218
+63
+61
+212
+64
+60
+209
+68
+59
+207
+70
+60
+199
+61
+50
+192
+56
+42
+189
+53
+41
+189
+57
+42
+191
+61
+45
+191
+61
+45
+189
+59
+43
+189
+60
+41
+194
+58
+42
+199
+59
+42
+207
+59
+47
+213
+59
+47
+219
+56
+47
+224
+56
+47
+231
+56
+51
+235
+57
+53
+231
+56
+53
+230
+52
+50
+229
+49
+48
+232
+50
+49
+233
+51
+50
+231
+52
+48
+222
+49
+43
+214
+47
+39
+205
+48
+39
+205
+54
+45
+201
+57
+48
+197
+54
+46
+194
+51
+45
+196
+51
+48
+206
+57
+59
+222
+62
+64
+235
+56
+59
+237
+55
+54
+228
+55
+49
+216
+53
+44
+204
+52
+38
+198
+53
+34
+196
+55
+35
+197
+58
+37
+203
+61
+41
+203
+56
+38
+204
+52
+38
+206
+53
+39
+212
+56
+44
+212
+58
+48
+211
+57
+47
+208
+56
+45
+208
+62
+49
+202
+59
+45
+197
+56
+39
+196
+55
+37
+198
+57
+39
+199
+60
+41
+199
+60
+41
+199
+58
+40
+205
+62
+45
+205
+58
+42
+216
+62
+50
+225
+67
+58
+212
+47
+45
+228
+58
+58
+224
+50
+52
+223
+53
+54
+215
+53
+51
+214
+59
+54
+222
+67
+62
+229
+75
+67
+234
+81
+73
+234
+83
+72
+232
+84
+72
+228
+85
+71
+203
+63
+48
+196
+63
+46
+190
+60
+44
+184
+61
+45
+183
+62
+45
+180
+63
+46
+176
+63
+47
+174
+62
+48
+172
+60
+46
+172
+60
+46
+172
+60
+46
+172
+61
+44
+173
+60
+44
+177
+61
+46
+183
+65
+51
+186
+68
+54
+198
+76
+65
+222
+98
+88
+226
+99
+93
+240
+110
+108
+244
+114
+114
+229
+96
+99
+229
+96
+101
+232
+95
+103
+251
+105
+118
+254
+109
+122
+241
+110
+118
+229
+100
+104
+234
+98
+102
+252
+109
+113
+255
+117
+123
+255
+118
+124
+254
+107
+115
+245
+95
+106
+232
+71
+87
+228
+75
+93
+221
+90
+104
+226
+137
+141
+172
+142
+131
+115
+121
+93
+93
+114
+73
+94
+117
+73
+104
+119
+80
+129
+136
+102
+179
+178
+150
+232
+226
+204
+255
+250
+233
+255
+253
+237
+254
+252
+237
+251
+255
+240
+249
+255
+242
+247
+255
+243
+244
+255
+241
+237
+251
+234
+227
+241
+224
+218
+237
+215
+201
+232
+200
+191
+227
+189
+187
+221
+186
+192
+222
+188
+200
+224
+192
+207
+226
+196
+217
+230
+204
+227
+235
+211
+235
+239
+216
+243
+242
+222
+247
+242
+223
+242
+235
+217
+234
+225
+210
+231
+219
+205
+233
+221
+207
+238
+226
+214
+241
+231
+222
+240
+231
+224
+242
+233
+226
+91
+79
+65
+91
+79
+65
+91
+79
+65
+90
+78
+64
+90
+78
+64
+89
+77
+63
+89
+77
+63
+89
+77
+63
+88
+76
+62
+88
+76
+62
+87
+75
+61
+86
+74
+60
+86
+74
+60
+87
+75
+61
+87
+75
+61
+88
+76
+62
+81
+73
+62
+81
+73
+62
+83
+75
+62
+85
+76
+59
+88
+77
+57
+88
+77
+55
+89
+76
+57
+88
+77
+59
+87
+75
+63
+85
+76
+71
+89
+83
+87
+101
+94
+110
+110
+106
+131
+117
+116
+150
+126
+125
+165
+131
+134
+177
+133
+138
+180
+132
+139
+185
+135
+141
+193
+137
+142
+200
+139
+143
+207
+140
+143
+212
+141
+144
+213
+141
+144
+211
+144
+148
+211
+139
+144
+202
+131
+136
+192
+126
+129
+184
+120
+123
+178
+114
+116
+173
+108
+110
+171
+111
+104
+156
+131
+105
+140
+148
+98
+123
+175
+88
+120
+203
+79
+113
+227
+65
+102
+239
+56
+87
+243
+53
+78
+244
+58
+72
+235
+66
+69
+225
+72
+66
+217
+76
+66
+215
+77
+66
+222
+73
+69
+229
+69
+71
+240
+63
+73
+240
+62
+74
+228
+67
+72
+215
+67
+67
+204
+65
+62
+206
+73
+68
+186
+59
+52
+176
+52
+44
+201
+73
+64
+213
+76
+70
+216
+66
+65
+218
+63
+61
+219
+59
+59
+218
+60
+59
+216
+64
+61
+212
+69
+63
+205
+71
+60
+203
+71
+58
+192
+56
+42
+193
+56
+40
+192
+56
+42
+190
+57
+40
+188
+57
+39
+187
+56
+38
+189
+58
+40
+192
+59
+40
+196
+59
+41
+202
+61
+44
+210
+60
+46
+215
+59
+46
+220
+56
+46
+225
+54
+46
+228
+54
+47
+232
+53
+48
+234
+50
+50
+234
+46
+47
+234
+43
+48
+240
+47
+50
+246
+51
+55
+247
+54
+55
+240
+52
+53
+230
+50
+49
+219
+46
+42
+216
+51
+47
+215
+53
+50
+210
+50
+50
+209
+46
+49
+211
+46
+52
+220
+53
+61
+235
+58
+68
+237
+48
+54
+238
+48
+50
+230
+51
+47
+220
+51
+44
+209
+53
+41
+202
+55
+39
+200
+57
+40
+201
+60
+40
+198
+56
+36
+201
+54
+36
+206
+54
+40
+211
+58
+44
+218
+62
+50
+221
+65
+53
+221
+65
+53
+216
+65
+54
+211
+71
+56
+201
+65
+49
+194
+59
+40
+192
+57
+38
+195
+60
+41
+198
+61
+42
+197
+60
+42
+197
+56
+38
+204
+58
+43
+205
+55
+41
+205
+48
+39
+230
+67
+60
+219
+50
+47
+239
+63
+65
+227
+47
+50
+218
+42
+44
+213
+49
+47
+210
+53
+46
+213
+56
+49
+214
+57
+48
+210
+56
+46
+204
+53
+42
+198
+50
+38
+192
+49
+35
+206
+69
+53
+198
+65
+50
+188
+61
+46
+181
+58
+42
+177
+57
+41
+175
+57
+43
+171
+58
+44
+170
+58
+44
+171
+59
+47
+171
+61
+48
+172
+62
+47
+172
+60
+46
+171
+60
+43
+173
+60
+44
+178
+62
+47
+181
+65
+50
+201
+83
+71
+224
+103
+94
+224
+99
+95
+234
+106
+105
+238
+110
+111
+230
+99
+104
+240
+106
+113
+246
+110
+120
+255
+110
+123
+255
+114
+126
+241
+112
+117
+231
+102
+107
+240
+103
+110
+255
+116
+122
+255
+117
+126
+255
+110
+117
+253
+103
+112
+244
+90
+102
+237
+72
+89
+229
+72
+91
+222
+87
+102
+220
+128
+131
+180
+146
+134
+133
+136
+107
+113
+134
+93
+111
+137
+90
+121
+138
+96
+141
+151
+114
+182
+183
+152
+223
+222
+194
+249
+244
+222
+252
+250
+229
+255
+255
+239
+250
+255
+238
+244
+255
+238
+238
+255
+234
+230
+249
+227
+220
+239
+217
+208
+227
+205
+197
+222
+193
+178
+213
+173
+172
+211
+167
+172
+209
+168
+178
+210
+171
+185
+213
+175
+190
+214
+178
+201
+218
+186
+210
+223
+193
+224
+230
+204
+232
+234
+212
+240
+237
+218
+241
+234
+216
+236
+227
+212
+233
+221
+209
+232
+218
+207
+234
+220
+211
+232
+219
+211
+230
+217
+211
+229
+216
+210
+91
+78
+62
+91
+78
+62
+91
+78
+62
+91
+78
+62
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+89
+76
+60
+89
+76
+60
+88
+75
+59
+88
+75
+59
+88
+75
+59
+89
+76
+60
+89
+76
+60
+89
+77
+63
+83
+73
+63
+84
+74
+62
+85
+76
+61
+88
+76
+60
+89
+78
+58
+90
+77
+58
+90
+77
+58
+89
+78
+60
+89
+77
+63
+85
+76
+69
+88
+79
+82
+95
+87
+98
+100
+95
+115
+106
+102
+129
+115
+111
+144
+121
+121
+157
+122
+128
+164
+122
+130
+169
+127
+131
+178
+130
+133
+188
+133
+134
+198
+135
+136
+203
+136
+137
+204
+136
+137
+202
+136
+136
+200
+131
+131
+191
+125
+124
+181
+121
+118
+173
+115
+112
+167
+110
+107
+164
+105
+101
+160
+111
+95
+142
+132
+94
+117
+151
+85
+97
+179
+78
+96
+210
+74
+98
+236
+64
+90
+246
+54
+79
+251
+52
+71
+252
+58
+69
+240
+64
+64
+231
+70
+62
+222
+74
+64
+219
+75
+66
+224
+72
+69
+231
+68
+71
+240
+63
+73
+239
+63
+74
+221
+65
+68
+212
+70
+68
+200
+65
+61
+201
+72
+66
+180
+58
+47
+177
+55
+44
+206
+79
+70
+201
+66
+60
+206
+61
+56
+208
+54
+52
+207
+49
+48
+208
+53
+49
+211
+62
+56
+207
+69
+59
+200
+70
+57
+195
+68
+53
+190
+57
+40
+195
+58
+40
+194
+58
+42
+191
+58
+39
+189
+56
+37
+190
+57
+38
+191
+58
+39
+193
+58
+38
+196
+57
+38
+203
+58
+41
+211
+58
+44
+217
+57
+43
+221
+55
+43
+225
+53
+43
+228
+51
+43
+234
+51
+45
+235
+42
+43
+241
+42
+45
+248
+45
+51
+253
+46
+52
+255
+49
+55
+255
+50
+55
+255
+51
+56
+253
+53
+56
+250
+55
+59
+246
+55
+60
+243
+57
+62
+243
+56
+65
+246
+56
+68
+247
+55
+70
+252
+53
+72
+254
+53
+69
+246
+42
+53
+244
+45
+50
+237
+49
+50
+227
+52
+47
+217
+54
+45
+208
+56
+42
+206
+59
+43
+206
+61
+44
+203
+53
+38
+209
+56
+42
+217
+59
+47
+223
+61
+50
+226
+62
+52
+228
+61
+52
+229
+62
+53
+223
+65
+54
+217
+74
+60
+207
+71
+55
+201
+65
+49
+196
+60
+44
+194
+57
+41
+194
+57
+39
+198
+56
+42
+200
+57
+41
+201
+50
+39
+211
+57
+47
+225
+64
+56
+235
+68
+62
+222
+48
+47
+224
+46
+46
+235
+52
+54
+232
+54
+54
+216
+51
+45
+213
+55
+46
+215
+57
+48
+215
+58
+49
+213
+59
+49
+210
+59
+48
+205
+58
+48
+201
+59
+47
+214
+76
+63
+204
+70
+58
+191
+64
+49
+180
+57
+42
+176
+54
+41
+172
+54
+40
+171
+55
+42
+169
+56
+42
+172
+59
+45
+173
+61
+47
+174
+62
+48
+173
+61
+47
+171
+60
+43
+171
+60
+43
+173
+60
+46
+177
+61
+48
+192
+75
+65
+218
+100
+90
+222
+99
+94
+232
+107
+105
+240
+111
+115
+234
+105
+110
+245
+114
+122
+253
+117
+127
+241
+101
+112
+248
+111
+121
+245
+116
+121
+237
+111
+115
+248
+111
+118
+255
+120
+127
+255
+116
+125
+255
+101
+111
+252
+98
+110
+242
+84
+98
+241
+72
+91
+231
+68
+89
+222
+81
+97
+217
+118
+123
+189
+149
+137
+152
+153
+122
+129
+150
+107
+123
+151
+102
+130
+149
+104
+145
+157
+117
+172
+178
+142
+203
+204
+173
+224
+224
+196
+233
+236
+209
+236
+244
+220
+227
+241
+215
+215
+235
+207
+205
+228
+199
+196
+221
+191
+187
+212
+182
+180
+203
+174
+172
+199
+164
+156
+193
+149
+152
+194
+144
+156
+195
+148
+163
+201
+154
+170
+203
+158
+175
+203
+162
+184
+206
+168
+194
+211
+177
+206
+217
+187
+216
+222
+196
+228
+227
+206
+235
+229
+213
+236
+226
+214
+233
+219
+210
+229
+212
+205
+226
+209
+202
+223
+205
+201
+218
+203
+198
+213
+198
+193
+91
+78
+62
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+89
+76
+60
+89
+76
+60
+90
+77
+61
+89
+76
+60
+89
+76
+60
+88
+75
+59
+88
+75
+59
+89
+76
+60
+90
+77
+61
+90
+76
+63
+86
+74
+62
+86
+74
+62
+88
+76
+62
+89
+78
+60
+90
+77
+60
+90
+77
+58
+90
+77
+58
+90
+77
+60
+91
+79
+65
+87
+77
+68
+87
+77
+76
+92
+82
+90
+94
+88
+102
+98
+93
+113
+106
+102
+127
+113
+113
+141
+116
+119
+150
+116
+122
+156
+120
+125
+167
+125
+128
+181
+129
+129
+191
+132
+131
+197
+133
+132
+200
+135
+132
+199
+130
+125
+191
+127
+121
+183
+125
+116
+173
+122
+111
+167
+122
+109
+165
+120
+105
+162
+116
+101
+160
+124
+95
+141
+133
+79
+93
+152
+72
+75
+178
+69
+75
+211
+71
+82
+237
+66
+82
+246
+58
+73
+252
+54
+67
+253
+58
+64
+244
+62
+61
+235
+66
+59
+228
+69
+63
+225
+70
+65
+227
+69
+66
+230
+67
+70
+237
+63
+72
+234
+64
+73
+214
+64
+65
+209
+71
+68
+197
+65
+60
+195
+71
+63
+178
+57
+46
+179
+58
+47
+209
+85
+75
+195
+62
+53
+201
+56
+51
+199
+47
+44
+197
+42
+38
+200
+47
+42
+205
+58
+51
+204
+67
+57
+195
+67
+54
+188
+62
+47
+192
+59
+42
+196
+59
+41
+195
+60
+41
+193
+58
+39
+194
+59
+40
+195
+60
+41
+194
+59
+39
+195
+56
+37
+196
+53
+36
+202
+55
+37
+212
+56
+41
+217
+55
+42
+221
+53
+42
+225
+51
+42
+229
+51
+41
+234
+50
+42
+245
+51
+51
+254
+54
+56
+255
+56
+60
+255
+52
+58
+255
+45
+50
+255
+40
+45
+255
+40
+45
+254
+43
+49
+254
+45
+51
+246
+41
+48
+242
+38
+49
+247
+41
+54
+255
+44
+63
+255
+42
+65
+252
+32
+57
+244
+25
+47
+246
+34
+48
+243
+40
+46
+237
+44
+49
+230
+48
+47
+218
+49
+44
+212
+51
+43
+209
+53
+41
+208
+54
+42
+212
+54
+43
+221
+57
+48
+230
+61
+54
+235
+62
+55
+235
+58
+52
+232
+55
+49
+232
+53
+48
+226
+57
+50
+223
+72
+61
+215
+75
+60
+211
+69
+55
+203
+61
+47
+196
+54
+40
+194
+51
+37
+200
+54
+41
+207
+56
+45
+206
+52
+42
+212
+54
+45
+230
+67
+60
+223
+56
+50
+224
+50
+49
+210
+32
+32
+236
+56
+57
+229
+54
+51
+213
+49
+40
+210
+52
+41
+210
+52
+41
+207
+53
+41
+206
+54
+43
+202
+54
+42
+200
+53
+43
+197
+55
+43
+227
+89
+78
+216
+82
+70
+202
+72
+59
+190
+64
+50
+183
+59
+47
+181
+59
+46
+181
+60
+49
+181
+60
+49
+175
+57
+45
+177
+59
+47
+177
+61
+48
+177
+61
+46
+175
+59
+44
+173
+57
+42
+173
+57
+44
+174
+58
+45
+177
+60
+50
+208
+89
+81
+220
+98
+93
+236
+112
+112
+244
+118
+121
+238
+109
+114
+245
+113
+124
+248
+114
+125
+255
+121
+131
+255
+127
+137
+250
+124
+128
+235
+109
+113
+241
+104
+112
+255
+114
+124
+255
+115
+127
+255
+105
+116
+250
+92
+106
+243
+80
+97
+245
+71
+94
+232
+64
+87
+220
+78
+94
+215
+112
+116
+196
+152
+139
+164
+163
+132
+134
+156
+110
+126
+154
+103
+129
+151
+104
+141
+156
+113
+161
+169
+130
+180
+186
+150
+200
+205
+173
+213
+220
+189
+202
+215
+185
+191
+210
+178
+176
+202
+167
+166
+193
+158
+157
+187
+151
+154
+182
+144
+150
+178
+140
+145
+176
+134
+140
+180
+130
+138
+181
+127
+143
+186
+133
+152
+192
+140
+158
+195
+144
+162
+196
+146
+170
+197
+154
+179
+201
+162
+190
+206
+170
+201
+210
+181
+216
+218
+196
+227
+224
+205
+232
+222
+210
+230
+216
+207
+223
+205
+201
+218
+199
+195
+211
+193
+189
+206
+188
+184
+200
+182
+180
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+88
+75
+59
+88
+75
+59
+88
+75
+59
+89
+76
+60
+89
+76
+60
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+76
+63
+90
+76
+63
+90
+77
+61
+91
+78
+61
+93
+77
+61
+94
+79
+60
+92
+79
+60
+92
+79
+62
+89
+77
+61
+87
+77
+67
+87
+76
+72
+88
+78
+79
+90
+80
+88
+93
+85
+98
+96
+89
+105
+96
+93
+114
+103
+103
+129
+106
+109
+142
+112
+114
+155
+114
+116
+167
+120
+119
+179
+129
+126
+193
+137
+131
+201
+138
+131
+199
+137
+126
+192
+140
+126
+188
+138
+120
+178
+135
+112
+168
+139
+112
+167
+145
+114
+171
+139
+106
+163
+137
+90
+132
+143
+71
+82
+161
+66
+60
+179
+65
+64
+202
+68
+67
+220
+64
+67
+231
+58
+62
+243
+60
+62
+254
+68
+69
+246
+62
+60
+241
+62
+58
+236
+62
+61
+233
+65
+64
+233
+67
+67
+233
+68
+72
+233
+66
+73
+226
+67
+72
+207
+63
+62
+197
+64
+57
+190
+63
+54
+183
+62
+51
+176
+60
+47
+178
+60
+48
+192
+68
+56
+210
+77
+68
+199
+54
+49
+212
+59
+54
+205
+50
+46
+204
+51
+46
+214
+67
+59
+199
+63
+51
+181
+54
+39
+187
+62
+44
+186
+55
+37
+193
+58
+39
+195
+60
+41
+194
+59
+40
+192
+57
+37
+194
+57
+38
+197
+58
+39
+199
+58
+40
+203
+58
+39
+208
+57
+40
+214
+54
+40
+216
+50
+36
+218
+46
+34
+224
+47
+37
+236
+55
+46
+245
+61
+53
+246
+57
+51
+247
+54
+49
+248
+49
+46
+249
+43
+43
+250
+40
+41
+252
+38
+40
+252
+38
+40
+252
+38
+40
+251
+38
+42
+247
+33
+41
+248
+34
+46
+255
+39
+55
+255
+41
+62
+255
+33
+59
+255
+24
+54
+255
+23
+49
+254
+37
+54
+238
+34
+43
+229
+34
+42
+227
+43
+45
+221
+45
+45
+211
+42
+39
+209
+44
+40
+218
+50
+47
+226
+54
+50
+232
+54
+52
+238
+54
+54
+242
+54
+53
+242
+49
+50
+239
+46
+47
+238
+44
+44
+229
+47
+44
+220
+57
+50
+209
+58
+49
+210
+57
+49
+236
+83
+75
+187
+34
+26
+196
+43
+35
+223
+70
+62
+200
+46
+38
+205
+46
+40
+222
+60
+55
+232
+69
+64
+226
+58
+55
+216
+47
+42
+218
+46
+42
+226
+53
+49
+229
+60
+55
+223
+62
+52
+213
+60
+46
+207
+53
+41
+203
+51
+38
+204
+53
+42
+205
+59
+46
+203
+59
+48
+197
+56
+46
+236
+98
+88
+224
+90
+79
+200
+67
+58
+185
+54
+44
+186
+58
+47
+184
+56
+45
+177
+51
+39
+180
+54
+42
+176
+48
+37
+176
+50
+38
+174
+50
+38
+175
+52
+37
+176
+54
+39
+178
+58
+42
+180
+60
+46
+179
+61
+49
+176
+58
+48
+186
+67
+59
+214
+92
+87
+236
+112
+112
+241
+115
+118
+246
+120
+124
+251
+121
+131
+245
+113
+124
+255
+122
+132
+253
+119
+128
+242
+117
+123
+244
+118
+122
+253
+116
+124
+255
+114
+124
+255
+107
+120
+255
+100
+115
+255
+94
+110
+241
+74
+92
+245
+69
+92
+239
+70
+91
+217
+70
+86
+208
+103
+107
+190
+144
+128
+158
+155
+122
+134
+156
+109
+125
+153
+102
+126
+148
+99
+135
+151
+106
+148
+159
+119
+158
+166
+129
+160
+168
+131
+156
+168
+132
+146
+163
+127
+138
+163
+124
+128
+159
+118
+122
+154
+113
+121
+154
+111
+124
+157
+114
+129
+160
+118
+131
+164
+117
+132
+172
+119
+134
+177
+121
+140
+183
+127
+147
+188
+132
+149
+190
+134
+152
+189
+135
+157
+189
+140
+162
+189
+144
+167
+188
+147
+175
+189
+154
+189
+195
+167
+206
+205
+185
+220
+212
+199
+224
+211
+202
+218
+200
+196
+211
+192
+188
+203
+185
+183
+192
+177
+174
+184
+168
+168
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+77
+61
+88
+75
+59
+88
+75
+59
+88
+75
+59
+89
+76
+60
+89
+76
+60
+90
+77
+61
+90
+77
+61
+90
+77
+61
+90
+76
+63
+90
+77
+61
+92
+76
+61
+93
+77
+61
+93
+78
+59
+94
+79
+60
+92
+79
+60
+92
+79
+62
+93
+80
+64
+91
+79
+67
+91
+78
+70
+89
+78
+74
+90
+80
+81
+92
+83
+88
+95
+85
+94
+94
+88
+102
+97
+93
+116
+101
+100
+131
+107
+105
+145
+110
+108
+157
+117
+113
+172
+127
+122
+188
+135
+128
+196
+139
+128
+196
+143
+128
+193
+145
+125
+186
+143
+116
+171
+143
+108
+162
+154
+111
+164
+165
+115
+168
+158
+103
+158
+154
+86
+125
+156
+61
+69
+166
+55
+46
+175
+54
+46
+192
+61
+53
+208
+65
+59
+218
+63
+58
+231
+64
+58
+243
+65
+61
+245
+61
+61
+245
+59
+60
+244
+60
+62
+241
+62
+65
+236
+66
+69
+231
+66
+70
+225
+66
+70
+216
+66
+67
+199
+60
+55
+189
+61
+52
+182
+60
+49
+177
+59
+47
+171
+58
+44
+174
+58
+43
+189
+65
+53
+208
+74
+65
+218
+71
+64
+220
+65
+61
+212
+54
+51
+208
+53
+49
+213
+64
+57
+205
+67
+56
+187
+57
+43
+178
+53
+35
+189
+56
+39
+194
+59
+40
+196
+61
+42
+196
+61
+42
+196
+59
+40
+198
+59
+40
+199
+58
+40
+202
+57
+40
+207
+57
+40
+207
+54
+38
+212
+50
+37
+218
+50
+37
+227
+53
+42
+234
+56
+46
+239
+56
+48
+240
+57
+49
+231
+50
+39
+231
+49
+38
+235
+47
+38
+240
+45
+39
+246
+44
+40
+250
+45
+42
+254
+46
+44
+255
+46
+47
+251
+42
+45
+248
+37
+43
+250
+36
+46
+255
+39
+55
+255
+37
+59
+255
+29
+55
+255
+20
+51
+252
+19
+48
+244
+29
+47
+245
+45
+56
+244
+50
+59
+228
+41
+48
+218
+39
+43
+219
+45
+47
+221
+47
+49
+218
+42
+45
+241
+58
+62
+244
+55
+61
+247
+52
+58
+246
+50
+54
+246
+47
+52
+248
+48
+51
+249
+50
+53
+244
+56
+55
+219
+50
+45
+218
+59
+53
+215
+56
+50
+228
+69
+63
+228
+69
+63
+206
+47
+43
+209
+50
+46
+193
+34
+30
+212
+53
+49
+225
+63
+58
+232
+69
+64
+224
+61
+56
+216
+51
+45
+217
+50
+44
+221
+54
+48
+221
+58
+49
+212
+58
+46
+207
+57
+42
+201
+53
+39
+199
+53
+40
+200
+57
+43
+202
+60
+48
+202
+60
+50
+198
+57
+47
+237
+99
+89
+225
+88
+78
+201
+64
+56
+186
+52
+43
+194
+57
+49
+195
+58
+48
+191
+54
+44
+194
+57
+47
+191
+53
+43
+190
+52
+42
+189
+52
+42
+187
+53
+41
+184
+54
+41
+181
+53
+40
+180
+54
+40
+176
+54
+41
+180
+59
+48
+187
+66
+57
+211
+89
+84
+232
+108
+106
+239
+113
+116
+246
+120
+124
+254
+124
+132
+249
+117
+128
+255
+122
+132
+253
+119
+128
+244
+119
+125
+245
+118
+125
+254
+117
+125
+255
+111
+123
+255
+104
+118
+255
+97
+113
+255
+93
+110
+242
+75
+93
+246
+68
+92
+242
+70
+92
+221
+73
+89
+208
+102
+104
+183
+138
+119
+149
+146
+111
+127
+147
+98
+117
+146
+92
+120
+142
+93
+127
+144
+99
+138
+149
+107
+141
+152
+112
+139
+149
+112
+133
+148
+109
+112
+135
+93
+108
+137
+93
+104
+137
+92
+103
+141
+94
+107
+143
+95
+113
+149
+101
+121
+155
+105
+124
+158
+107
+132
+171
+116
+133
+177
+118
+139
+183
+124
+142
+186
+125
+146
+187
+127
+148
+187
+130
+151
+188
+134
+155
+187
+137
+155
+181
+134
+161
+179
+139
+172
+183
+151
+188
+190
+168
+205
+199
+183
+213
+200
+191
+212
+195
+188
+206
+188
+186
+197
+181
+181
+186
+172
+172
+177
+163
+163
+92
+76
+60
+92
+76
+60
+92
+76
+60
+92
+76
+60
+92
+76
+60
+92
+76
+60
+92
+76
+60
+92
+76
+60
+90
+74
+58
+90
+74
+58
+90
+74
+58
+91
+75
+59
+91
+75
+59
+92
+76
+60
+92
+76
+60
+92
+76
+60
+92
+76
+61
+92
+76
+61
+93
+75
+61
+93
+77
+61
+93
+78
+59
+94
+79
+60
+94
+79
+60
+92
+79
+60
+95
+82
+65
+93
+81
+65
+92
+80
+68
+91
+78
+70
+90
+79
+75
+91
+80
+78
+93
+81
+83
+92
+82
+90
+93
+84
+103
+98
+89
+118
+101
+95
+133
+105
+99
+145
+113
+108
+164
+125
+119
+181
+132
+126
+190
+137
+125
+189
+152
+132
+193
+155
+128
+183
+156
+118
+169
+160
+111
+158
+177
+115
+162
+189
+117
+165
+183
+104
+152
+177
+81
+118
+181
+61
+70
+186
+54
+49
+182
+54
+45
+189
+61
+50
+200
+68
+56
+210
+69
+59
+219
+66
+58
+228
+63
+57
+241
+61
+62
+247
+58
+62
+249
+58
+63
+247
+61
+66
+239
+64
+69
+229
+66
+69
+215
+65
+66
+205
+66
+63
+192
+59
+52
+184
+57
+48
+177
+57
+43
+173
+57
+42
+169
+56
+40
+173
+57
+42
+187
+63
+51
+207
+70
+60
+217
+68
+62
+215
+57
+54
+217
+55
+52
+218
+59
+55
+220
+67
+61
+221
+79
+69
+206
+72
+60
+181
+51
+35
+190
+57
+40
+193
+58
+39
+196
+59
+41
+198
+61
+43
+201
+61
+44
+200
+60
+43
+201
+58
+41
+204
+57
+41
+207
+55
+41
+207
+50
+35
+211
+47
+35
+223
+52
+42
+238
+61
+51
+244
+63
+54
+241
+57
+49
+233
+52
+43
+224
+54
+39
+221
+54
+38
+226
+50
+37
+230
+48
+37
+234
+46
+37
+238
+45
+38
+239
+44
+40
+242
+44
+41
+242
+44
+45
+239
+40
+43
+240
+39
+47
+247
+41
+54
+253
+37
+58
+252
+30
+55
+251
+22
+51
+248
+24
+51
+244
+37
+55
+241
+47
+58
+242
+52
+64
+239
+53
+64
+238
+57
+66
+238
+58
+67
+233
+53
+62
+229
+45
+55
+240
+50
+60
+243
+47
+59
+246
+46
+57
+246
+45
+55
+245
+46
+51
+245
+46
+49
+243
+47
+49
+237
+52
+50
+220
+48
+44
+226
+61
+57
+218
+54
+52
+223
+59
+57
+255
+109
+106
+229
+67
+65
+209
+47
+45
+206
+47
+44
+217
+58
+55
+223
+64
+60
+224
+65
+59
+219
+60
+54
+213
+55
+46
+214
+53
+45
+214
+53
+43
+210
+54
+42
+200
+54
+39
+195
+54
+37
+194
+54
+39
+196
+56
+41
+197
+59
+46
+198
+60
+49
+198
+60
+49
+197
+59
+49
+235
+96
+89
+225
+84
+77
+201
+60
+51
+191
+48
+40
+203
+59
+51
+209
+62
+54
+206
+59
+51
+210
+61
+54
+216
+61
+56
+215
+60
+55
+212
+61
+54
+207
+60
+50
+201
+59
+49
+195
+57
+46
+188
+54
+42
+182
+54
+41
+185
+59
+47
+188
+64
+54
+207
+84
+77
+227
+103
+101
+237
+111
+114
+248
+122
+126
+255
+129
+136
+253
+123
+131
+255
+122
+131
+252
+121
+129
+245
+122
+127
+246
+121
+127
+254
+117
+127
+255
+110
+124
+255
+99
+117
+255
+92
+111
+255
+89
+109
+242
+73
+94
+245
+65
+90
+242
+70
+92
+224
+76
+90
+203
+97
+97
+167
+122
+101
+130
+128
+90
+110
+130
+81
+104
+133
+79
+109
+131
+82
+116
+133
+88
+123
+136
+93
+125
+136
+94
+120
+132
+92
+113
+130
+88
+96
+122
+77
+95
+127
+80
+97
+133
+85
+101
+141
+89
+110
+149
+96
+117
+156
+103
+125
+160
+106
+128
+163
+109
+132
+171
+114
+135
+176
+116
+139
+180
+120
+142
+184
+121
+140
+184
+121
+143
+185
+122
+146
+186
+126
+148
+186
+129
+147
+177
+127
+149
+172
+128
+154
+170
+134
+168
+174
+146
+184
+181
+162
+196
+186
+174
+200
+185
+178
+198
+183
+180
+183
+171
+173
+169
+160
+165
+159
+150
+155
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+90
+74
+58
+90
+74
+58
+90
+74
+58
+91
+75
+59
+91
+75
+59
+92
+76
+60
+92
+76
+60
+92
+76
+60
+93
+75
+61
+93
+75
+61
+93
+76
+60
+94
+77
+61
+94
+77
+59
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+81
+64
+94
+81
+64
+93
+79
+66
+91
+79
+67
+92
+78
+69
+91
+78
+70
+92
+79
+73
+91
+79
+79
+94
+80
+95
+98
+84
+109
+100
+89
+123
+103
+94
+137
+111
+104
+156
+122
+117
+173
+132
+124
+183
+136
+123
+179
+155
+132
+186
+166
+133
+180
+175
+128
+170
+184
+122
+161
+200
+120
+159
+211
+116
+156
+204
+99
+140
+198
+77
+108
+216
+72
+82
+217
+67
+66
+209
+67
+63
+203
+70
+61
+201
+73
+60
+204
+72
+59
+211
+69
+59
+222
+65
+60
+238
+64
+65
+245
+60
+65
+251
+60
+68
+249
+62
+69
+240
+65
+72
+226
+66
+68
+209
+65
+64
+197
+64
+59
+191
+63
+54
+182
+60
+49
+175
+57
+43
+171
+58
+42
+170
+57
+41
+174
+56
+42
+188
+62
+48
+206
+68
+58
+213
+60
+55
+213
+51
+49
+224
+59
+57
+229
+65
+63
+225
+68
+63
+232
+83
+76
+223
+85
+74
+191
+58
+43
+193
+57
+41
+190
+55
+36
+192
+55
+37
+196
+59
+41
+201
+61
+44
+202
+61
+44
+203
+57
+42
+206
+56
+41
+205
+52
+38
+210
+50
+38
+217
+50
+41
+229
+57
+47
+241
+62
+55
+245
+62
+54
+240
+53
+46
+228
+47
+38
+222
+54
+41
+221
+55
+41
+224
+52
+42
+228
+50
+40
+231
+46
+41
+233
+46
+41
+236
+44
+41
+236
+44
+43
+232
+42
+44
+230
+39
+44
+234
+40
+49
+240
+42
+57
+245
+39
+60
+246
+34
+59
+250
+31
+61
+251
+37
+65
+253
+56
+74
+228
+40
+54
+229
+44
+58
+255
+77
+89
+255
+93
+105
+255
+78
+90
+242
+60
+73
+244
+58
+72
+232
+41
+56
+237
+42
+56
+241
+45
+57
+244
+48
+58
+241
+50
+55
+234
+48
+49
+225
+43
+42
+215
+40
+37
+216
+48
+45
+218
+55
+50
+212
+50
+47
+229
+67
+64
+255
+115
+112
+245
+86
+83
+221
+62
+59
+229
+71
+68
+219
+61
+58
+218
+60
+57
+213
+58
+53
+210
+56
+48
+209
+55
+45
+208
+54
+42
+205
+52
+38
+198
+51
+35
+190
+53
+35
+185
+54
+36
+187
+56
+38
+191
+59
+44
+192
+60
+47
+191
+57
+45
+192
+58
+47
+197
+60
+50
+229
+88
+81
+220
+77
+71
+202
+55
+48
+199
+48
+41
+215
+60
+55
+222
+65
+58
+218
+59
+53
+223
+60
+53
+231
+62
+57
+233
+61
+57
+230
+63
+57
+225
+64
+56
+217
+63
+53
+208
+60
+50
+200
+58
+46
+193
+57
+45
+187
+57
+44
+187
+61
+49
+203
+78
+72
+224
+99
+95
+236
+110
+111
+250
+124
+127
+255
+132
+136
+255
+125
+133
+252
+118
+127
+250
+119
+127
+245
+122
+127
+247
+122
+128
+255
+118
+128
+255
+109
+123
+255
+98
+116
+254
+91
+110
+250
+84
+104
+240
+71
+92
+241
+61
+86
+240
+68
+90
+225
+79
+92
+195
+91
+90
+146
+104
+82
+111
+109
+71
+95
+115
+66
+92
+121
+67
+100
+122
+73
+108
+125
+80
+116
+129
+86
+118
+131
+88
+114
+129
+88
+111
+129
+87
+109
+135
+90
+108
+142
+92
+111
+149
+98
+117
+157
+104
+123
+164
+108
+129
+168
+111
+132
+170
+113
+135
+170
+112
+134
+172
+113
+136
+176
+116
+139
+179
+117
+140
+182
+118
+138
+183
+118
+138
+183
+118
+139
+184
+119
+144
+184
+122
+145
+180
+124
+143
+171
+123
+144
+165
+124
+154
+165
+133
+170
+172
+150
+187
+180
+164
+197
+184
+175
+198
+184
+181
+177
+171
+175
+161
+158
+165
+151
+146
+153
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+91
+75
+59
+90
+74
+58
+90
+74
+58
+90
+74
+58
+91
+75
+59
+91
+75
+59
+92
+76
+60
+92
+76
+60
+92
+76
+60
+93
+76
+60
+94
+75
+60
+94
+75
+60
+94
+77
+61
+94
+77
+59
+95
+78
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+78
+62
+94
+78
+62
+92
+79
+63
+94
+78
+65
+93
+79
+66
+94
+80
+69
+94
+79
+74
+98
+78
+89
+99
+80
+100
+99
+84
+113
+101
+89
+125
+108
+101
+145
+120
+114
+162
+127
+119
+168
+131
+118
+164
+148
+125
+167
+172
+134
+171
+194
+137
+169
+206
+130
+158
+218
+119
+148
+223
+108
+137
+218
+89
+119
+216
+69
+95
+236
+70
+84
+242
+73
+78
+233
+77
+78
+219
+76
+72
+205
+71
+62
+202
+69
+60
+210
+69
+62
+219
+67
+62
+234
+66
+66
+242
+63
+67
+248
+63
+71
+246
+65
+74
+237
+68
+73
+222
+68
+70
+205
+66
+63
+192
+63
+57
+189
+65
+55
+181
+61
+47
+174
+58
+43
+171
+58
+42
+170
+57
+41
+174
+56
+42
+187
+59
+46
+204
+63
+54
+225
+70
+65
+226
+61
+59
+238
+66
+66
+235
+65
+65
+222
+59
+54
+227
+74
+66
+230
+88
+76
+213
+75
+62
+200
+64
+50
+192
+56
+40
+188
+51
+35
+193
+56
+40
+200
+60
+45
+201
+58
+42
+203
+55
+41
+208
+56
+43
+206
+48
+37
+215
+51
+41
+224
+56
+47
+233
+59
+52
+237
+58
+53
+237
+54
+48
+235
+48
+43
+229
+44
+39
+223
+48
+43
+223
+50
+44
+229
+49
+48
+235
+50
+48
+241
+51
+53
+244
+51
+54
+246
+53
+56
+244
+53
+58
+235
+46
+53
+232
+45
+54
+235
+47
+61
+240
+49
+67
+242
+46
+70
+245
+42
+71
+252
+44
+78
+255
+52
+82
+245
+58
+77
+229
+51
+63
+238
+62
+75
+255
+92
+105
+255
+104
+118
+255
+85
+100
+245
+67
+83
+247
+64
+82
+238
+51
+68
+237
+51
+65
+237
+51
+62
+233
+54
+60
+227
+57
+57
+219
+56
+51
+206
+52
+42
+199
+47
+36
+203
+50
+42
+199
+46
+40
+208
+55
+50
+242
+89
+84
+246
+92
+90
+242
+88
+86
+219
+65
+63
+226
+72
+70
+220
+66
+64
+212
+60
+55
+206
+55
+48
+205
+54
+45
+207
+56
+45
+207
+57
+43
+202
+55
+39
+194
+53
+35
+185
+56
+35
+179
+57
+36
+181
+58
+40
+184
+61
+45
+185
+59
+44
+182
+54
+41
+188
+55
+46
+198
+61
+53
+219
+78
+71
+217
+69
+65
+206
+53
+48
+208
+49
+45
+225
+62
+57
+231
+64
+58
+227
+56
+49
+231
+53
+49
+235
+50
+48
+238
+50
+49
+235
+53
+50
+231
+56
+51
+225
+58
+50
+216
+58
+47
+208
+57
+46
+200
+58
+46
+190
+54
+42
+186
+56
+43
+200
+73
+66
+220
+95
+89
+235
+110
+108
+251
+125
+128
+255
+133
+137
+255
+126
+131
+247
+116
+124
+248
+118
+126
+245
+122
+127
+248
+123
+129
+254
+116
+129
+255
+108
+124
+255
+97
+117
+255
+90
+112
+247
+81
+101
+241
+72
+93
+240
+62
+86
+238
+69
+90
+227
+83
+93
+188
+86
+82
+131
+91
+66
+98
+98
+60
+92
+112
+63
+91
+118
+67
+102
+121
+75
+110
+126
+81
+116
+129
+86
+120
+133
+90
+121
+136
+95
+119
+140
+97
+121
+149
+101
+120
+154
+104
+122
+160
+109
+124
+167
+113
+129
+170
+114
+132
+171
+114
+133
+171
+112
+134
+169
+111
+137
+172
+114
+139
+174
+116
+138
+178
+116
+138
+180
+116
+136
+181
+116
+135
+182
+114
+137
+184
+116
+139
+184
+119
+143
+183
+123
+140
+173
+120
+141
+164
+120
+151
+165
+130
+170
+174
+149
+191
+186
+167
+203
+193
+181
+207
+198
+193
+188
+186
+191
+168
+170
+182
+156
+156
+168
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+90
+74
+58
+91
+75
+59
+91
+75
+59
+92
+76
+60
+92
+76
+60
+93
+76
+60
+94
+75
+60
+94
+75
+60
+94
+75
+60
+95
+76
+61
+94
+77
+59
+95
+78
+60
+94
+79
+60
+94
+79
+60
+93
+78
+59
+93
+78
+59
+94
+79
+60
+95
+79
+63
+95
+79
+63
+96
+80
+64
+97
+81
+65
+98
+80
+70
+101
+76
+80
+101
+77
+93
+97
+79
+101
+98
+85
+115
+104
+96
+133
+116
+111
+151
+123
+116
+157
+125
+113
+151
+143
+118
+150
+174
+131
+159
+203
+140
+161
+218
+131
+150
+227
+116
+133
+232
+101
+117
+230
+81
+100
+228
+63
+80
+242
+55
+72
+252
+64
+78
+244
+73
+81
+227
+71
+74
+209
+65
+64
+203
+66
+60
+209
+67
+63
+217
+67
+66
+230
+67
+70
+235
+64
+70
+239
+64
+71
+239
+66
+72
+231
+68
+73
+218
+68
+69
+201
+66
+62
+190
+63
+54
+186
+64
+53
+177
+59
+45
+169
+56
+40
+168
+57
+40
+170
+57
+41
+176
+56
+42
+188
+58
+45
+202
+59
+51
+232
+73
+69
+233
+63
+63
+235
+61
+62
+229
+55
+56
+218
+50
+47
+222
+65
+58
+238
+90
+80
+244
+104
+91
+218
+80
+67
+201
+65
+51
+190
+53
+37
+194
+54
+39
+199
+57
+43
+200
+57
+43
+203
+55
+43
+210
+56
+44
+209
+48
+38
+218
+54
+45
+230
+59
+52
+233
+59
+52
+234
+52
+48
+232
+47
+44
+234
+45
+43
+235
+45
+45
+241
+52
+56
+243
+52
+59
+247
+51
+61
+250
+50
+60
+251
+49
+61
+253
+49
+61
+250
+48
+60
+247
+49
+62
+244
+49
+65
+241
+50
+66
+242
+53
+75
+243
+53
+78
+242
+49
+78
+244
+46
+79
+254
+49
+88
+255
+62
+95
+230
+51
+72
+248
+78
+91
+255
+95
+108
+255
+92
+107
+252
+84
+99
+250
+79
+95
+244
+68
+88
+233
+56
+74
+243
+65
+81
+234
+58
+71
+221
+50
+58
+210
+47
+50
+202
+50
+45
+194
+56
+45
+189
+59
+43
+188
+58
+42
+196
+58
+47
+192
+50
+40
+217
+74
+66
+250
+107
+99
+221
+76
+71
+225
+80
+75
+207
+59
+57
+207
+59
+57
+224
+76
+74
+212
+64
+60
+202
+55
+48
+202
+55
+45
+206
+60
+47
+205
+60
+43
+203
+58
+41
+196
+59
+40
+180
+59
+38
+173
+58
+37
+175
+60
+41
+179
+62
+45
+177
+57
+41
+175
+51
+39
+186
+58
+47
+202
+68
+59
+214
+71
+65
+216
+67
+61
+212
+55
+50
+215
+50
+46
+231
+59
+55
+236
+58
+54
+232
+50
+46
+237
+50
+45
+242
+44
+45
+244
+44
+44
+242
+46
+47
+239
+51
+49
+232
+55
+49
+226
+58
+49
+218
+60
+49
+210
+62
+50
+194
+54
+41
+186
+52
+41
+197
+66
+58
+215
+88
+82
+231
+106
+104
+250
+124
+125
+255
+134
+137
+255
+127
+132
+248
+117
+125
+249
+119
+127
+246
+123
+128
+247
+122
+128
+252
+114
+127
+253
+105
+121
+255
+94
+115
+255
+89
+111
+245
+79
+99
+244
+75
+96
+242
+64
+88
+239
+70
+91
+229
+85
+95
+182
+83
+78
+121
+84
+58
+94
+96
+56
+96
+115
+69
+97
+124
+73
+110
+129
+83
+118
+134
+89
+123
+136
+93
+126
+139
+96
+129
+144
+103
+130
+151
+108
+128
+156
+108
+125
+159
+109
+124
+164
+111
+125
+168
+112
+128
+169
+111
+130
+170
+110
+131
+169
+108
+133
+169
+108
+137
+170
+113
+139
+173
+113
+137
+175
+114
+136
+178
+114
+133
+178
+111
+133
+180
+112
+135
+182
+114
+137
+184
+116
+139
+181
+118
+135
+173
+116
+140
+166
+119
+153
+169
+132
+175
+181
+153
+198
+196
+175
+213
+206
+190
+217
+210
+204
+194
+194
+202
+172
+178
+192
+155
+161
+175
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+90
+75
+56
+91
+76
+57
+91
+76
+57
+92
+77
+58
+92
+77
+58
+93
+76
+58
+94
+75
+60
+96
+74
+60
+94
+75
+60
+95
+76
+61
+94
+77
+59
+95
+78
+60
+94
+79
+60
+94
+79
+60
+94
+79
+58
+95
+80
+59
+96
+79
+59
+97
+80
+62
+97
+80
+62
+97
+80
+62
+97
+80
+60
+100
+78
+65
+104
+75
+77
+103
+75
+87
+99
+78
+95
+98
+84
+109
+106
+97
+128
+118
+112
+146
+124
+118
+152
+128
+115
+145
+143
+117
+142
+173
+128
+148
+205
+134
+148
+222
+127
+135
+237
+113
+121
+246
+101
+108
+246
+82
+91
+244
+62
+75
+248
+47
+66
+255
+55
+75
+251
+65
+79
+235
+64
+73
+219
+63
+67
+214
+66
+66
+213
+67
+67
+215
+65
+66
+224
+65
+69
+227
+64
+69
+230
+63
+70
+228
+65
+70
+223
+67
+70
+212
+66
+66
+199
+64
+60
+189
+62
+53
+184
+62
+51
+175
+57
+43
+168
+55
+39
+169
+58
+41
+173
+60
+42
+180
+60
+44
+193
+61
+49
+207
+63
+55
+223
+61
+58
+229
+57
+57
+227
+48
+51
+226
+47
+50
+224
+52
+50
+219
+57
+52
+230
+77
+69
+252
+108
+97
+242
+104
+91
+217
+81
+67
+198
+60
+47
+198
+58
+45
+200
+58
+46
+201
+55
+42
+205
+54
+43
+213
+56
+47
+213
+52
+44
+222
+55
+47
+230
+57
+51
+232
+54
+50
+233
+49
+47
+232
+47
+44
+238
+49
+47
+245
+49
+53
+255
+50
+66
+255
+48
+68
+255
+45
+69
+255
+43
+65
+255
+38
+63
+255
+35
+60
+250
+32
+56
+244
+32
+55
+246
+39
+65
+243
+43
+69
+242
+47
+77
+242
+49
+80
+240
+44
+80
+243
+42
+84
+254
+51
+96
+255
+66
+104
+240
+67
+87
+255
+95
+108
+255
+103
+116
+247
+85
+100
+236
+74
+89
+239
+74
+90
+234
+65
+84
+217
+49
+66
+235
+64
+82
+221
+55
+67
+201
+45
+49
+186
+40
+40
+177
+46
+36
+171
+56
+38
+165
+63
+38
+168
+64
+39
+184
+63
+46
+188
+58
+44
+221
+89
+77
+225
+93
+81
+205
+71
+62
+205
+68
+62
+193
+54
+51
+201
+59
+55
+228
+85
+81
+213
+70
+64
+201
+57
+49
+200
+56
+45
+201
+58
+44
+200
+57
+40
+200
+57
+40
+196
+61
+41
+177
+63
+39
+166
+60
+38
+168
+59
+38
+172
+61
+42
+171
+55
+40
+172
+51
+40
+188
+61
+52
+211
+76
+70
+214
+71
+65
+221
+69
+64
+219
+57
+54
+220
+51
+48
+233
+55
+51
+236
+53
+49
+235
+48
+43
+244
+49
+45
+253
+44
+47
+255
+43
+45
+250
+46
+47
+244
+49
+47
+237
+52
+47
+230
+56
+49
+223
+59
+49
+216
+62
+50
+201
+57
+46
+189
+51
+40
+192
+59
+50
+207
+78
+72
+225
+97
+94
+247
+121
+122
+255
+136
+138
+255
+131
+135
+252
+121
+129
+252
+122
+130
+248
+124
+132
+247
+122
+130
+249
+111
+124
+249
+101
+117
+252
+90
+111
+252
+86
+108
+238
+75
+96
+242
+74
+97
+240
+64
+87
+236
+69
+89
+225
+84
+93
+174
+77
+71
+112
+77
+49
+92
+94
+54
+95
+114
+68
+102
+126
+78
+117
+136
+91
+127
+142
+99
+132
+144
+104
+134
+146
+106
+136
+151
+110
+137
+158
+115
+136
+164
+116
+132
+166
+116
+127
+167
+114
+125
+168
+112
+127
+168
+110
+129
+169
+109
+131
+169
+108
+134
+168
+108
+136
+167
+110
+138
+169
+110
+136
+172
+111
+134
+174
+111
+130
+175
+108
+130
+177
+107
+131
+181
+110
+133
+183
+114
+135
+179
+116
+134
+173
+116
+140
+168
+119
+155
+173
+133
+176
+185
+154
+199
+199
+175
+214
+207
+189
+215
+210
+204
+188
+192
+201
+165
+174
+189
+147
+156
+171
+91
+74
+56
+90
+75
+56
+91
+74
+56
+90
+75
+56
+91
+74
+56
+90
+75
+56
+91
+74
+56
+90
+75
+56
+91
+74
+56
+90
+75
+56
+91
+74
+56
+91
+76
+57
+92
+75
+57
+92
+77
+58
+93
+76
+58
+93
+76
+58
+94
+75
+60
+94
+75
+60
+94
+75
+60
+94
+77
+61
+94
+77
+61
+94
+79
+60
+94
+79
+60
+92
+79
+60
+96
+81
+62
+97
+82
+61
+97
+82
+63
+98
+81
+63
+98
+81
+63
+97
+80
+62
+97
+79
+59
+98
+76
+63
+107
+77
+75
+106
+76
+84
+101
+79
+92
+100
+87
+107
+107
+101
+127
+120
+117
+148
+125
+124
+156
+127
+120
+151
+145
+122
+148
+171
+129
+149
+198
+132
+144
+217
+126
+133
+238
+117
+122
+252
+109
+111
+253
+90
+91
+249
+70
+76
+247
+52
+69
+255
+58
+78
+251
+64
+81
+238
+63
+76
+229
+65
+74
+225
+69
+73
+221
+66
+70
+215
+60
+64
+222
+63
+68
+223
+62
+67
+225
+62
+67
+222
+64
+65
+218
+66
+65
+208
+65
+61
+197
+62
+56
+188
+61
+52
+181
+63
+49
+172
+59
+43
+169
+56
+40
+173
+60
+44
+180
+63
+46
+187
+64
+49
+202
+65
+55
+216
+67
+61
+217
+55
+52
+225
+56
+53
+222
+46
+46
+226
+51
+48
+230
+58
+54
+211
+48
+39
+207
+53
+41
+235
+85
+71
+255
+119
+106
+235
+91
+80
+209
+67
+55
+202
+60
+48
+203
+59
+48
+201
+55
+42
+205
+54
+43
+212
+58
+48
+218
+55
+48
+223
+56
+50
+229
+54
+51
+231
+51
+50
+234
+48
+49
+237
+49
+50
+244
+51
+54
+252
+53
+60
+252
+37
+53
+255
+35
+56
+255
+34
+56
+255
+33
+56
+255
+32
+55
+255
+31
+53
+251
+29
+52
+246
+30
+53
+237
+28
+50
+236
+32
+57
+237
+39
+66
+238
+41
+71
+237
+39
+74
+239
+41
+77
+253
+53
+92
+255
+70
+104
+255
+96
+115
+254
+94
+106
+247
+85
+98
+242
+80
+93
+242
+80
+93
+240
+75
+89
+227
+62
+76
+210
+48
+59
+218
+61
+70
+205
+54
+59
+187
+47
+46
+175
+46
+40
+168
+52
+39
+162
+59
+40
+155
+63
+38
+157
+61
+37
+170
+57
+39
+178
+56
+43
+210
+86
+74
+187
+59
+50
+196
+63
+56
+190
+52
+49
+189
+50
+47
+206
+67
+64
+229
+87
+83
+213
+72
+65
+200
+57
+49
+196
+54
+42
+197
+54
+40
+196
+53
+37
+198
+53
+36
+195
+58
+40
+177
+60
+40
+167
+58
+38
+168
+55
+37
+173
+57
+42
+172
+52
+38
+175
+49
+37
+194
+63
+53
+219
+82
+74
+217
+73
+65
+225
+72
+66
+222
+59
+54
+222
+50
+46
+234
+52
+49
+237
+49
+47
+239
+45
+43
+252
+50
+50
+254
+44
+47
+253
+43
+46
+249
+43
+45
+243
+43
+43
+237
+45
+42
+230
+49
+42
+223
+52
+44
+214
+56
+44
+209
+61
+49
+191
+50
+40
+188
+55
+46
+200
+73
+66
+217
+92
+88
+243
+119
+119
+255
+137
+139
+255
+134
+138
+253
+126
+133
+255
+125
+133
+252
+125
+134
+253
+119
+130
+252
+107
+122
+249
+96
+114
+249
+87
+108
+249
+83
+105
+234
+68
+92
+240
+71
+94
+236
+59
+85
+228
+65
+86
+215
+81
+90
+162
+73
+67
+102
+70
+45
+88
+93
+53
+90
+109
+63
+98
+125
+74
+116
+140
+92
+128
+150
+103
+135
+152
+108
+136
+155
+110
+138
+160
+114
+139
+165
+118
+140
+172
+122
+134
+171
+119
+129
+170
+114
+126
+167
+109
+124
+165
+105
+125
+165
+103
+129
+165
+103
+131
+165
+105
+131
+164
+107
+133
+166
+109
+132
+170
+109
+130
+172
+108
+128
+173
+104
+128
+175
+105
+129
+179
+106
+132
+182
+111
+137
+182
+115
+136
+176
+114
+140
+173
+120
+153
+176
+132
+172
+188
+152
+189
+198
+169
+201
+203
+181
+203
+205
+194
+182
+191
+196
+159
+171
+183
+140
+152
+164
+93
+75
+55
+92
+75
+55
+93
+75
+55
+92
+75
+55
+93
+75
+55
+92
+75
+55
+93
+75
+55
+92
+75
+55
+94
+76
+56
+93
+76
+56
+94
+76
+56
+93
+76
+56
+94
+76
+56
+93
+76
+56
+94
+76
+56
+93
+76
+58
+93
+74
+60
+93
+75
+61
+94
+76
+62
+92
+76
+60
+92
+76
+60
+91
+78
+61
+93
+80
+63
+94
+83
+65
+96
+83
+66
+95
+82
+63
+96
+80
+64
+98
+81
+65
+99
+82
+66
+100
+81
+66
+100
+78
+65
+100
+76
+66
+107
+75
+76
+104
+75
+80
+101
+79
+91
+102
+91
+108
+110
+107
+134
+120
+123
+156
+129
+133
+170
+137
+137
+173
+143
+132
+166
+165
+136
+166
+190
+136
+159
+208
+130
+144
+225
+121
+128
+240
+114
+115
+249
+106
+102
+255
+97
+96
+244
+77
+87
+237
+65
+79
+231
+61
+74
+233
+66
+76
+235
+69
+79
+231
+65
+75
+228
+61
+69
+229
+62
+70
+226
+59
+66
+224
+59
+63
+221
+58
+61
+217
+59
+58
+212
+60
+57
+204
+59
+54
+196
+58
+48
+185
+57
+44
+167
+54
+38
+175
+65
+48
+173
+60
+44
+172
+54
+40
+191
+65
+53
+204
+70
+61
+204
+61
+53
+208
+55
+50
+218
+56
+53
+220
+55
+49
+222
+53
+46
+222
+54
+45
+222
+56
+42
+221
+60
+42
+215
+58
+39
+211
+54
+37
+217
+59
+48
+240
+83
+76
+242
+90
+79
+217
+69
+57
+199
+56
+42
+205
+62
+46
+212
+66
+51
+210
+58
+45
+211
+50
+42
+240
+71
+66
+225
+47
+47
+239
+54
+59
+244
+55
+62
+239
+45
+56
+255
+66
+77
+240
+40
+51
+250
+38
+50
+255
+41
+50
+255
+41
+50
+249
+29
+39
+253
+34
+42
+255
+39
+47
+254
+39
+47
+240
+29
+38
+238
+31
+41
+248
+44
+55
+233
+33
+46
+235
+38
+55
+240
+44
+64
+227
+33
+57
+255
+86
+112
+229
+43
+66
+255
+92
+108
+255
+94
+105
+255
+89
+99
+251
+84
+92
+246
+79
+87
+236
+71
+77
+222
+62
+64
+208
+54
+52
+204
+61
+55
+197
+64
+55
+184
+62
+49
+167
+54
+38
+156
+49
+33
+154
+53
+35
+157
+58
+39
+160
+59
+41
+167
+56
+45
+174
+55
+47
+194
+69
+63
+191
+59
+55
+189
+51
+49
+196
+54
+52
+197
+53
+52
+212
+68
+67
+219
+76
+72
+218
+75
+69
+209
+68
+59
+200
+58
+48
+196
+52
+41
+199
+53
+40
+203
+52
+41
+197
+53
+42
+188
+60
+47
+179
+57
+44
+173
+47
+35
+171
+40
+30
+179
+45
+36
+195
+57
+47
+210
+67
+59
+216
+72
+63
+228
+80
+70
+223
+69
+61
+218
+55
+48
+221
+48
+42
+231
+48
+44
+242
+50
+49
+249
+49
+51
+253
+49
+52
+247
+47
+49
+246
+48
+49
+246
+48
+49
+243
+48
+46
+242
+48
+46
+237
+50
+45
+230
+53
+45
+221
+57
+47
+213
+61
+48
+190
+50
+37
+192
+62
+49
+185
+61
+51
+214
+95
+89
+233
+115
+113
+255
+143
+143
+251
+132
+134
+255
+135
+140
+255
+132
+141
+255
+120
+135
+253
+104
+123
+252
+95
+116
+254
+92
+115
+250
+86
+110
+243
+77
+101
+242
+72
+99
+235
+60
+89
+237
+62
+91
+224
+66
+89
+216
+94
+105
+141
+63
+59
+92
+67
+45
+83
+91
+54
+92
+116
+66
+103
+134
+77
+119
+150
+93
+125
+156
+99
+127
+157
+103
+128
+161
+106
+131
+166
+110
+130
+168
+111
+128
+167
+110
+127
+166
+109
+126
+165
+108
+125
+165
+105
+124
+164
+104
+125
+163
+102
+127
+163
+101
+127
+163
+102
+127
+165
+108
+127
+166
+109
+129
+171
+108
+127
+172
+107
+126
+173
+103
+127
+174
+102
+129
+177
+103
+131
+179
+105
+135
+181
+109
+139
+180
+114
+139
+177
+118
+142
+174
+124
+153
+180
+137
+167
+189
+153
+175
+194
+164
+178
+193
+174
+163
+175
+173
+141
+152
+158
+124
+135
+141
+93
+75
+55
+93
+75
+55
+93
+75
+55
+93
+75
+55
+93
+75
+55
+93
+75
+55
+93
+75
+55
+93
+75
+55
+94
+76
+56
+94
+76
+56
+94
+76
+56
+94
+76
+56
+94
+76
+56
+94
+76
+56
+94
+76
+56
+94
+75
+58
+92
+75
+59
+94
+76
+62
+95
+77
+63
+94
+78
+62
+91
+78
+61
+91
+78
+61
+92
+81
+63
+94
+82
+66
+95
+83
+67
+93
+81
+65
+93
+79
+66
+95
+79
+66
+96
+78
+68
+98
+80
+70
+99
+79
+72
+101
+77
+73
+105
+76
+78
+103
+78
+84
+101
+83
+97
+103
+95
+116
+110
+111
+142
+121
+126
+166
+128
+136
+183
+135
+139
+187
+158
+150
+199
+163
+140
+182
+171
+127
+160
+185
+120
+142
+211
+121
+133
+234
+124
+125
+244
+117
+111
+244
+105
+100
+245
+94
+99
+238
+81
+90
+233
+71
+82
+238
+74
+83
+243
+76
+86
+242
+71
+80
+238
+64
+74
+234
+60
+69
+228
+57
+63
+224
+58
+60
+220
+57
+58
+215
+60
+56
+210
+61
+55
+203
+60
+52
+196
+58
+47
+186
+59
+44
+171
+60
+43
+170
+63
+45
+169
+56
+40
+178
+58
+44
+193
+65
+54
+197
+60
+52
+199
+54
+49
+212
+60
+55
+210
+53
+48
+214
+53
+45
+215
+53
+42
+216
+52
+40
+217
+56
+38
+219
+58
+38
+219
+59
+37
+218
+57
+39
+221
+54
+46
+230
+65
+59
+235
+77
+68
+225
+73
+60
+208
+62
+47
+199
+56
+40
+202
+56
+41
+211
+59
+46
+221
+58
+51
+245
+73
+69
+228
+48
+49
+241
+55
+60
+246
+54
+65
+241
+46
+60
+255
+63
+77
+237
+37
+50
+243
+36
+44
+247
+37
+40
+251
+41
+44
+253
+43
+44
+252
+42
+43
+248
+40
+40
+246
+40
+40
+247
+43
+44
+239
+36
+39
+237
+37
+40
+234
+37
+44
+253
+59
+68
+216
+26
+38
+238
+50
+65
+250
+63
+80
+213
+35
+51
+255
+104
+117
+255
+97
+106
+255
+90
+97
+253
+86
+93
+247
+78
+83
+231
+65
+67
+218
+59
+56
+210
+61
+54
+193
+55
+44
+194
+66
+53
+188
+71
+54
+172
+61
+44
+154
+47
+31
+147
+39
+26
+146
+38
+25
+147
+39
+27
+158
+45
+37
+176
+58
+54
+209
+84
+80
+206
+72
+71
+195
+53
+52
+198
+52
+53
+209
+61
+61
+235
+87
+85
+216
+71
+66
+214
+71
+63
+208
+65
+57
+199
+57
+47
+198
+51
+41
+202
+54
+44
+208
+55
+47
+206
+55
+48
+199
+61
+51
+194
+57
+49
+194
+53
+46
+195
+50
+45
+201
+52
+46
+209
+56
+51
+216
+63
+57
+222
+69
+61
+228
+74
+64
+222
+65
+56
+218
+54
+45
+221
+48
+42
+231
+48
+44
+242
+50
+49
+251
+48
+51
+251
+48
+51
+244
+48
+50
+243
+49
+50
+244
+48
+49
+243
+47
+48
+243
+48
+46
+238
+49
+45
+231
+52
+45
+223
+57
+45
+215
+61
+49
+191
+51
+36
+190
+60
+47
+183
+61
+50
+211
+94
+87
+233
+118
+115
+255
+144
+144
+249
+133
+136
+253
+134
+140
+255
+128
+138
+255
+115
+132
+255
+100
+121
+255
+92
+116
+255
+89
+114
+252
+84
+110
+246
+76
+103
+243
+68
+97
+236
+61
+90
+236
+66
+95
+223
+74
+96
+194
+83
+92
+128
+61
+55
+88
+67
+46
+82
+92
+57
+91
+118
+67
+101
+135
+75
+115
+149
+89
+120
+156
+95
+119
+157
+98
+123
+161
+102
+125
+165
+105
+125
+166
+106
+124
+165
+105
+124
+165
+105
+124
+164
+104
+123
+163
+101
+123
+161
+100
+123
+161
+100
+125
+161
+99
+126
+162
+101
+124
+163
+106
+125
+166
+108
+125
+169
+108
+125
+170
+105
+124
+171
+101
+125
+173
+99
+127
+175
+99
+130
+177
+99
+133
+176
+104
+135
+178
+107
+136
+175
+112
+136
+171
+115
+139
+171
+124
+144
+172
+132
+144
+170
+135
+140
+162
+139
+118
+133
+126
+99
+111
+111
+83
+95
+95
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+93
+76
+56
+94
+75
+58
+95
+78
+62
+97
+80
+64
+96
+80
+64
+93
+80
+63
+92
+79
+62
+91
+79
+63
+91
+82
+67
+91
+81
+69
+91
+81
+71
+92
+79
+71
+92
+79
+73
+95
+80
+77
+99
+81
+79
+102
+84
+84
+103
+84
+86
+103
+84
+88
+103
+86
+96
+104
+92
+112
+108
+105
+134
+115
+118
+161
+124
+131
+185
+130
+138
+201
+138
+142
+206
+152
+146
+210
+160
+139
+196
+170
+131
+178
+185
+125
+159
+207
+128
+147
+228
+131
+138
+238
+126
+122
+242
+115
+109
+248
+102
+105
+242
+85
+92
+234
+73
+81
+237
+72
+79
+243
+73
+82
+245
+71
+81
+242
+65
+75
+238
+61
+69
+228
+55
+61
+224
+55
+58
+219
+56
+57
+213
+60
+55
+207
+63
+55
+201
+63
+52
+193
+61
+48
+184
+61
+45
+174
+61
+45
+170
+60
+43
+171
+58
+44
+184
+66
+54
+199
+72
+63
+192
+59
+50
+187
+48
+41
+202
+58
+50
+205
+54
+47
+208
+54
+46
+213
+55
+44
+216
+56
+44
+217
+55
+40
+217
+56
+38
+220
+57
+38
+224
+58
+42
+221
+52
+45
+219
+52
+46
+226
+65
+57
+233
+79
+67
+222
+72
+58
+200
+53
+37
+200
+50
+35
+217
+64
+50
+226
+62
+53
+245
+72
+68
+231
+48
+50
+242
+53
+59
+248
+54
+63
+245
+49
+61
+255
+66
+80
+244
+46
+59
+240
+41
+48
+235
+35
+38
+236
+36
+39
+249
+49
+51
+245
+45
+47
+239
+39
+39
+236
+38
+37
+245
+49
+50
+234
+40
+41
+245
+55
+57
+231
+42
+48
+225
+40
+48
+234
+50
+60
+255
+81
+93
+237
+59
+73
+255
+89
+101
+255
+94
+102
+242
+85
+92
+239
+78
+84
+241
+76
+82
+235
+69
+73
+222
+58
+59
+214
+55
+52
+214
+62
+57
+194
+53
+44
+194
+62
+50
+189
+65
+53
+181
+60
+49
+173
+55
+45
+168
+49
+41
+162
+43
+35
+157
+38
+32
+155
+36
+30
+169
+47
+42
+199
+69
+67
+194
+58
+58
+188
+44
+44
+200
+51
+53
+215
+65
+66
+244
+94
+93
+208
+63
+58
+210
+67
+59
+208
+65
+57
+203
+61
+51
+204
+57
+47
+212
+61
+52
+218
+64
+56
+219
+64
+59
+219
+64
+60
+216
+61
+59
+221
+62
+59
+227
+65
+63
+228
+62
+62
+224
+58
+58
+227
+63
+61
+235
+73
+68
+224
+66
+57
+221
+60
+52
+217
+53
+44
+221
+50
+43
+231
+49
+45
+240
+51
+49
+245
+49
+50
+248
+48
+50
+244
+48
+50
+244
+48
+50
+244
+48
+49
+243
+47
+48
+243
+48
+46
+238
+49
+45
+231
+52
+45
+223
+57
+45
+216
+62
+50
+192
+52
+37
+186
+56
+43
+181
+59
+48
+208
+91
+84
+237
+122
+119
+255
+147
+146
+251
+135
+138
+253
+129
+137
+255
+124
+137
+255
+113
+129
+253
+100
+120
+254
+90
+114
+255
+85
+111
+252
+79
+107
+250
+73
+102
+244
+65
+95
+238
+63
+92
+234
+71
+98
+223
+84
+103
+165
+64
+72
+117
+56
+51
+88
+70
+50
+85
+95
+60
+95
+119
+69
+102
+135
+78
+114
+147
+90
+117
+152
+94
+116
+154
+95
+120
+158
+99
+123
+163
+103
+123
+163
+103
+121
+162
+102
+121
+162
+102
+121
+161
+99
+120
+160
+98
+121
+159
+98
+121
+160
+97
+124
+160
+98
+122
+160
+99
+122
+162
+102
+123
+164
+104
+123
+167
+104
+123
+168
+101
+123
+169
+97
+123
+169
+96
+125
+171
+96
+127
+174
+96
+135
+178
+106
+138
+181
+110
+139
+178
+115
+137
+172
+116
+134
+166
+119
+130
+158
+117
+121
+147
+110
+111
+134
+108
+81
+99
+87
+64
+79
+76
+50
+65
+62
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+77
+57
+94
+76
+56
+96
+78
+58
+97
+80
+60
+96
+81
+62
+93
+80
+63
+90
+78
+62
+89
+79
+67
+88
+80
+69
+88
+79
+72
+91
+81
+79
+95
+85
+84
+98
+88
+89
+101
+88
+95
+105
+89
+99
+108
+92
+102
+107
+94
+104
+108
+96
+108
+108
+99
+116
+111
+107
+134
+114
+116
+155
+121
+126
+181
+127
+135
+200
+133
+141
+214
+140
+143
+220
+142
+135
+212
+159
+139
+208
+173
+138
+194
+179
+129
+167
+189
+121
+144
+204
+123
+130
+222
+129
+124
+241
+130
+123
+254
+116
+116
+253
+100
+103
+244
+88
+92
+242
+79
+84
+242
+73
+80
+242
+68
+77
+240
+63
+71
+239
+60
+66
+229
+54
+59
+225
+55
+56
+219
+57
+55
+213
+60
+55
+206
+64
+54
+198
+64
+52
+191
+64
+49
+184
+63
+46
+173
+57
+42
+173
+62
+45
+177
+61
+48
+188
+70
+58
+204
+82
+71
+199
+72
+63
+186
+53
+46
+186
+49
+41
+200
+57
+49
+205
+56
+49
+211
+59
+48
+217
+61
+49
+219
+59
+45
+217
+54
+39
+220
+54
+38
+224
+56
+43
+224
+53
+45
+219
+50
+43
+224
+61
+52
+236
+78
+66
+227
+75
+61
+210
+58
+44
+209
+56
+42
+224
+66
+54
+222
+54
+45
+240
+62
+58
+233
+47
+48
+239
+48
+53
+245
+50
+58
+248
+52
+62
+255
+74
+86
+255
+70
+79
+253
+62
+69
+242
+51
+56
+226
+36
+38
+237
+47
+49
+234
+44
+44
+240
+50
+50
+232
+42
+42
+235
+47
+46
+241
+57
+57
+209
+26
+28
+229
+50
+54
+220
+43
+49
+231
+56
+63
+239
+68
+76
+255
+87
+98
+241
+75
+85
+217
+60
+67
+219
+64
+68
+225
+66
+70
+225
+62
+65
+222
+57
+61
+220
+56
+57
+218
+55
+56
+212
+57
+55
+201
+56
+51
+195
+56
+49
+190
+57
+50
+193
+64
+58
+206
+77
+72
+215
+85
+83
+210
+77
+78
+196
+66
+64
+178
+55
+50
+182
+57
+53
+207
+75
+73
+217
+77
+76
+227
+81
+82
+239
+89
+90
+234
+82
+81
+241
+89
+86
+201
+53
+49
+206
+62
+54
+210
+66
+57
+208
+64
+55
+211
+63
+53
+217
+66
+57
+224
+67
+60
+226
+64
+59
+233
+63
+64
+231
+56
+61
+236
+57
+61
+242
+63
+67
+239
+58
+63
+232
+53
+56
+236
+62
+61
+246
+77
+74
+222
+57
+51
+219
+54
+48
+218
+51
+43
+222
+51
+44
+229
+52
+46
+236
+51
+48
+242
+50
+49
+244
+48
+49
+244
+48
+50
+246
+47
+50
+246
+48
+49
+245
+47
+48
+245
+47
+46
+240
+48
+45
+233
+52
+45
+224
+56
+45
+217
+63
+51
+194
+54
+39
+183
+53
+40
+179
+57
+46
+203
+86
+79
+239
+124
+121
+255
+147
+146
+254
+135
+139
+255
+128
+137
+255
+121
+135
+252
+110
+126
+250
+99
+118
+250
+88
+111
+252
+80
+106
+251
+72
+102
+250
+67
+98
+242
+61
+92
+239
+66
+94
+229
+77
+100
+215
+90
+104
+136
+50
+53
+107
+57
+48
+92
+77
+56
+91
+101
+67
+99
+123
+75
+106
+137
+80
+115
+146
+89
+116
+149
+92
+117
+152
+94
+119
+157
+98
+121
+161
+101
+122
+162
+102
+119
+160
+100
+118
+160
+97
+119
+159
+97
+118
+158
+96
+120
+159
+96
+120
+159
+96
+123
+159
+97
+122
+160
+99
+122
+162
+102
+122
+163
+103
+122
+167
+102
+122
+167
+98
+122
+168
+96
+122
+168
+93
+124
+171
+93
+126
+173
+95
+134
+178
+103
+139
+180
+110
+140
+179
+116
+138
+173
+115
+134
+166
+117
+128
+157
+113
+116
+142
+105
+105
+128
+100
+80
+98
+84
+67
+82
+75
+56
+71
+64
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+59
+94
+77
+57
+93
+75
+53
+95
+77
+53
+96
+80
+57
+95
+80
+59
+92
+79
+62
+90
+78
+64
+88
+79
+70
+88
+81
+75
+89
+80
+81
+96
+87
+92
+103
+96
+104
+110
+102
+115
+115
+104
+121
+115
+103
+123
+115
+103
+125
+113
+103
+127
+111
+108
+129
+112
+112
+138
+114
+118
+153
+118
+124
+172
+122
+130
+193
+127
+135
+208
+132
+139
+220
+138
+140
+225
+147
+142
+224
+157
+141
+214
+160
+132
+190
+158
+117
+159
+160
+108
+130
+172
+110
+115
+188
+117
+111
+210
+118
+107
+240
+115
+109
+253
+109
+108
+254
+104
+105
+251
+95
+96
+249
+83
+87
+244
+71
+77
+237
+60
+66
+234
+55
+61
+232
+53
+59
+227
+54
+56
+221
+57
+56
+215
+60
+55
+208
+64
+55
+199
+65
+53
+192
+65
+48
+185
+64
+47
+173
+55
+41
+180
+64
+51
+175
+58
+48
+176
+59
+49
+200
+82
+72
+213
+92
+81
+201
+77
+67
+187
+59
+48
+190
+57
+48
+193
+55
+45
+204
+57
+47
+214
+62
+51
+219
+61
+49
+218
+54
+42
+220
+52
+39
+226
+54
+42
+224
+51
+44
+226
+55
+48
+228
+61
+53
+229
+69
+57
+226
+70
+57
+222
+66
+51
+222
+65
+50
+226
+62
+50
+219
+48
+38
+234
+55
+50
+236
+48
+47
+238
+45
+48
+239
+44
+50
+246
+51
+59
+255
+76
+84
+255
+87
+94
+255
+90
+95
+255
+79
+83
+225
+46
+49
+227
+48
+51
+224
+44
+45
+247
+69
+69
+232
+54
+54
+220
+44
+44
+218
+44
+45
+234
+61
+63
+219
+49
+52
+216
+50
+54
+255
+98
+104
+224
+61
+66
+202
+41
+49
+202
+45
+52
+193
+38
+42
+213
+59
+61
+224
+65
+69
+218
+55
+58
+217
+51
+55
+223
+57
+61
+220
+55
+59
+205
+47
+48
+204
+52
+51
+205
+59
+59
+211
+71
+70
+221
+83
+83
+235
+96
+99
+245
+105
+108
+244
+101
+107
+234
+94
+97
+196
+64
+62
+198
+69
+64
+229
+94
+91
+248
+104
+103
+255
+111
+112
+255
+106
+106
+229
+75
+75
+215
+61
+59
+201
+52
+48
+209
+62
+55
+215
+68
+60
+214
+67
+59
+213
+62
+53
+213
+60
+52
+216
+58
+49
+220
+52
+49
+238
+53
+59
+241
+45
+55
+240
+44
+54
+242
+46
+56
+239
+44
+52
+235
+44
+51
+243
+57
+60
+254
+74
+75
+223
+51
+47
+220
+51
+46
+218
+51
+43
+220
+51
+44
+227
+53
+46
+234
+52
+48
+239
+52
+47
+242
+50
+49
+244
+48
+50
+246
+47
+50
+247
+47
+49
+246
+46
+48
+245
+47
+46
+240
+48
+45
+234
+51
+45
+226
+55
+45
+217
+63
+51
+198
+56
+42
+180
+50
+37
+178
+56
+45
+195
+78
+71
+239
+124
+121
+255
+146
+145
+255
+135
+140
+255
+126
+137
+255
+117
+132
+249
+108
+124
+246
+97
+116
+245
+85
+109
+247
+74
+102
+249
+64
+96
+249
+59
+93
+243
+58
+92
+237
+68
+97
+219
+80
+101
+193
+87
+97
+114
+46
+43
+98
+62
+48
+96
+84
+62
+99
+106
+73
+102
+124
+77
+107
+137
+83
+116
+146
+92
+117
+150
+95
+118
+153
+95
+120
+158
+99
+121
+161
+99
+120
+160
+98
+117
+159
+96
+117
+159
+96
+117
+157
+95
+118
+158
+95
+119
+158
+95
+120
+159
+96
+123
+159
+97
+122
+161
+98
+122
+162
+100
+123
+165
+101
+124
+166
+100
+124
+167
+96
+121
+167
+94
+121
+168
+90
+123
+170
+92
+125
+172
+94
+128
+172
+97
+133
+175
+103
+135
+174
+109
+135
+170
+112
+133
+165
+115
+131
+160
+114
+123
+149
+110
+114
+138
+106
+100
+119
+100
+91
+107
+94
+81
+97
+84
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+60
+95
+78
+58
+94
+76
+52
+95
+78
+52
+96
+78
+56
+94
+79
+58
+91
+78
+62
+89
+79
+69
+90
+83
+77
+90
+84
+84
+95
+90
+97
+104
+98
+112
+114
+109
+129
+122
+117
+140
+123
+117
+145
+123
+113
+147
+122
+112
+147
+118
+112
+148
+113
+116
+149
+114
+119
+157
+116
+124
+170
+119
+128
+183
+122
+131
+196
+126
+134
+207
+132
+138
+216
+139
+141
+218
+150
+144
+218
+153
+139
+201
+155
+133
+180
+162
+131
+162
+170
+132
+145
+171
+126
+123
+159
+107
+93
+153
+82
+64
+186
+78
+66
+210
+82
+73
+225
+88
+82
+233
+88
+85
+239
+84
+82
+241
+75
+77
+236
+63
+67
+229
+52
+58
+235
+56
+60
+231
+57
+59
+226
+58
+57
+218
+61
+56
+211
+64
+56
+203
+65
+54
+195
+63
+48
+188
+62
+47
+179
+57
+44
+186
+65
+54
+171
+53
+43
+163
+46
+36
+190
+73
+63
+217
+103
+92
+217
+100
+90
+203
+85
+73
+184
+60
+50
+184
+54
+41
+192
+51
+41
+206
+58
+48
+217
+59
+48
+218
+54
+44
+222
+51
+41
+228
+54
+45
+223
+49
+42
+228
+55
+49
+227
+59
+50
+221
+57
+47
+222
+62
+48
+227
+70
+53
+228
+66
+51
+223
+57
+43
+222
+48
+39
+233
+52
+45
+240
+51
+49
+239
+45
+46
+236
+41
+45
+242
+47
+53
+255
+66
+71
+255
+82
+87
+255
+93
+98
+255
+92
+97
+226
+57
+60
+227
+57
+60
+213
+43
+44
+244
+74
+75
+226
+56
+57
+215
+47
+47
+217
+51
+53
+203
+39
+40
+202
+37
+41
+247
+87
+89
+220
+61
+65
+213
+57
+61
+209
+54
+58
+186
+31
+35
+196
+40
+43
+219
+61
+62
+229
+66
+69
+219
+53
+57
+215
+44
+50
+220
+49
+55
+217
+48
+53
+204
+41
+46
+208
+52
+55
+226
+76
+78
+244
+98
+101
+250
+105
+110
+247
+100
+108
+246
+96
+105
+248
+96
+108
+248
+98
+107
+214
+76
+76
+213
+78
+74
+234
+92
+90
+234
+86
+84
+231
+77
+77
+227
+72
+70
+207
+52
+50
+206
+51
+47
+217
+65
+60
+224
+75
+68
+228
+79
+72
+223
+74
+67
+217
+64
+56
+215
+58
+51
+215
+54
+46
+220
+46
+45
+245
+50
+58
+251
+45
+58
+248
+42
+55
+245
+39
+52
+245
+41
+52
+248
+48
+58
+255
+62
+67
+255
+74
+74
+224
+49
+46
+222
+51
+44
+220
+51
+44
+221
+53
+44
+225
+52
+45
+231
+52
+47
+237
+52
+47
+240
+51
+47
+244
+48
+50
+247
+47
+50
+249
+46
+49
+248
+45
+48
+246
+46
+46
+241
+47
+45
+235
+50
+45
+226
+55
+45
+217
+61
+49
+201
+59
+45
+179
+49
+36
+177
+55
+44
+186
+67
+61
+236
+121
+118
+255
+141
+141
+255
+136
+141
+255
+123
+135
+255
+113
+129
+246
+104
+120
+243
+96
+114
+243
+83
+107
+244
+69
+98
+249
+58
+92
+249
+55
+90
+243
+58
+92
+235
+72
+99
+205
+80
+96
+160
+74
+77
+102
+52
+43
+89
+66
+48
+95
+87
+64
+99
+106
+73
+102
+124
+78
+107
+136
+82
+116
+145
+91
+119
+149
+95
+120
+153
+96
+123
+158
+100
+122
+160
+99
+118
+158
+96
+115
+155
+93
+114
+156
+92
+115
+155
+92
+116
+156
+93
+118
+157
+94
+119
+158
+95
+123
+159
+97
+122
+161
+98
+121
+161
+98
+122
+164
+98
+124
+167
+98
+123
+166
+95
+120
+166
+91
+120
+167
+89
+122
+169
+89
+123
+170
+90
+126
+170
+95
+131
+173
+101
+133
+172
+107
+135
+169
+109
+137
+167
+115
+137
+165
+117
+132
+157
+115
+124
+148
+114
+117
+137
+112
+111
+128
+109
+103
+120
+102
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+95
+78
+58
+97
+80
+54
+97
+80
+54
+97
+79
+57
+94
+79
+60
+91
+79
+65
+91
+82
+75
+92
+86
+86
+95
+90
+97
+107
+103
+118
+115
+111
+134
+125
+122
+151
+130
+126
+161
+129
+124
+165
+125
+119
+163
+123
+117
+165
+120
+118
+167
+115
+121
+171
+115
+125
+178
+120
+129
+184
+123
+132
+191
+126
+134
+196
+132
+138
+200
+141
+142
+206
+148
+147
+205
+154
+147
+198
+160
+150
+187
+171
+156
+179
+188
+167
+176
+201
+173
+169
+197
+166
+148
+170
+136
+109
+154
+103
+76
+155
+70
+50
+173
+65
+52
+181
+65
+52
+194
+66
+57
+214
+72
+68
+232
+78
+78
+238
+74
+75
+236
+63
+67
+235
+61
+63
+233
+59
+61
+229
+59
+59
+224
+60
+58
+217
+64
+56
+210
+63
+53
+202
+62
+49
+194
+60
+48
+189
+58
+48
+190
+63
+54
+175
+52
+44
+167
+49
+39
+187
+73
+63
+209
+99
+86
+214
+104
+91
+213
+101
+87
+195
+79
+66
+186
+62
+50
+186
+52
+41
+199
+55
+44
+214
+57
+48
+217
+53
+44
+223
+50
+43
+231
+54
+48
+226
+48
+44
+227
+52
+47
+226
+55
+47
+222
+55
+46
+224
+62
+49
+229
+67
+52
+228
+62
+48
+222
+52
+37
+229
+51
+41
+232
+47
+42
+240
+51
+47
+240
+46
+46
+239
+45
+46
+241
+48
+51
+242
+54
+55
+244
+64
+67
+246
+77
+82
+252
+89
+94
+233
+70
+75
+246
+81
+87
+216
+51
+55
+235
+70
+74
+221
+56
+60
+230
+65
+69
+216
+53
+56
+204
+44
+46
+207
+46
+51
+226
+70
+73
+210
+55
+59
+208
+55
+58
+185
+35
+37
+213
+59
+61
+217
+57
+59
+226
+60
+62
+232
+62
+65
+230
+55
+60
+223
+46
+54
+219
+42
+50
+224
+50
+59
+228
+61
+68
+238
+77
+83
+250
+95
+101
+255
+109
+115
+255
+106
+115
+248
+97
+106
+245
+91
+103
+246
+90
+104
+246
+92
+102
+244
+100
+100
+232
+90
+86
+232
+87
+84
+216
+64
+61
+207
+49
+48
+212
+52
+52
+211
+51
+51
+225
+67
+64
+227
+74
+69
+233
+82
+75
+234
+83
+76
+225
+74
+65
+217
+63
+55
+216
+57
+51
+219
+56
+49
+227
+51
+51
+243
+46
+55
+255
+48
+62
+255
+48
+61
+250
+42
+55
+252
+46
+58
+255
+59
+69
+255
+67
+72
+251
+65
+66
+227
+49
+47
+223
+52
+45
+221
+52
+45
+221
+53
+44
+226
+52
+45
+230
+51
+44
+237
+52
+47
+241
+52
+48
+244
+48
+50
+247
+47
+50
+249
+46
+49
+248
+45
+48
+246
+46
+46
+241
+47
+45
+235
+50
+45
+227
+55
+45
+216
+58
+47
+205
+62
+48
+181
+49
+37
+177
+55
+44
+178
+59
+53
+233
+115
+113
+255
+138
+138
+255
+135
+141
+255
+116
+132
+253
+104
+124
+243
+97
+116
+241
+92
+112
+244
+82
+106
+245
+68
+97
+251
+55
+93
+252
+56
+94
+245
+61
+95
+232
+78
+102
+188
+81
+91
+125
+57
+54
+94
+60
+48
+81
+68
+49
+91
+86
+64
+93
+100
+69
+101
+119
+77
+106
+133
+82
+114
+142
+91
+118
+148
+94
+121
+154
+97
+123
+158
+100
+120
+158
+97
+115
+155
+93
+112
+152
+89
+112
+153
+87
+113
+154
+88
+113
+154
+88
+116
+155
+92
+117
+156
+93
+121
+157
+95
+120
+159
+96
+120
+161
+95
+121
+162
+94
+122
+165
+94
+121
+164
+92
+120
+164
+89
+120
+164
+87
+121
+165
+86
+123
+167
+88
+127
+169
+95
+130
+172
+100
+132
+171
+104
+134
+168
+108
+135
+165
+111
+134
+162
+113
+128
+154
+109
+120
+145
+106
+112
+132
+104
+108
+128
+101
+101
+121
+96
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+95
+80
+61
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+94
+79
+60
+95
+78
+58
+99
+81
+57
+99
+81
+57
+97
+80
+60
+93
+80
+64
+90
+80
+71
+92
+84
+82
+95
+90
+97
+97
+95
+109
+116
+114
+138
+121
+120
+152
+129
+128
+168
+131
+129
+176
+126
+126
+176
+121
+121
+175
+121
+117
+176
+119
+119
+181
+119
+124
+190
+120
+127
+195
+125
+133
+196
+130
+136
+196
+133
+138
+193
+141
+143
+191
+151
+150
+190
+160
+157
+188
+172
+167
+187
+182
+172
+180
+190
+179
+175
+200
+184
+169
+208
+190
+166
+214
+193
+162
+209
+187
+150
+208
+172
+136
+175
+111
+84
+174
+92
+71
+164
+71
+53
+168
+62
+48
+194
+71
+63
+224
+87
+81
+239
+87
+86
+241
+78
+79
+233
+64
+67
+234
+61
+63
+230
+60
+61
+226
+61
+59
+223
+61
+58
+215
+61
+53
+207
+59
+49
+201
+57
+48
+193
+56
+48
+193
+60
+53
+185
+58
+51
+184
+61
+53
+193
+79
+69
+199
+88
+77
+199
+93
+79
+209
+101
+88
+211
+99
+85
+194
+76
+62
+188
+58
+45
+197
+56
+46
+210
+57
+49
+215
+52
+45
+223
+50
+44
+231
+54
+48
+230
+52
+48
+225
+50
+45
+224
+53
+46
+227
+60
+51
+231
+67
+55
+230
+67
+52
+226
+58
+45
+223
+51
+37
+233
+52
+43
+229
+45
+37
+240
+48
+45
+240
+48
+45
+241
+52
+50
+242
+54
+53
+232
+46
+47
+226
+50
+52
+231
+66
+70
+247
+88
+93
+246
+87
+92
+255
+111
+117
+229
+68
+74
+235
+72
+77
+224
+60
+67
+254
+91
+96
+255
+109
+115
+220
+59
+64
+255
+123
+128
+255
+108
+112
+234
+81
+84
+211
+61
+63
+198
+48
+50
+215
+59
+62
+241
+72
+75
+235
+59
+62
+237
+56
+63
+246
+62
+70
+240
+56
+66
+230
+46
+56
+241
+64
+74
+255
+95
+103
+255
+110
+119
+255
+107
+114
+254
+100
+110
+245
+94
+103
+247
+95
+107
+253
+99
+111
+253
+95
+110
+246
+90
+101
+241
+93
+93
+227
+80
+73
+226
+74
+71
+213
+55
+52
+210
+47
+48
+217
+53
+52
+210
+48
+46
+216
+57
+53
+223
+68
+63
+227
+74
+68
+226
+73
+65
+217
+64
+56
+211
+54
+47
+214
+52
+47
+220
+55
+49
+232
+54
+54
+234
+39
+47
+252
+48
+60
+254
+50
+61
+247
+43
+54
+249
+48
+58
+255
+62
+69
+253
+63
+65
+236
+52
+52
+226
+51
+46
+224
+53
+46
+222
+54
+45
+223
+52
+44
+225
+51
+42
+232
+51
+44
+239
+52
+47
+244
+52
+49
+246
+48
+49
+247
+47
+50
+249
+46
+49
+248
+45
+48
+248
+46
+46
+242
+47
+45
+235
+50
+45
+227
+55
+45
+215
+57
+46
+209
+63
+50
+182
+48
+37
+178
+54
+44
+176
+54
+49
+232
+112
+111
+255
+135
+136
+255
+134
+142
+255
+110
+128
+252
+99
+120
+241
+94
+113
+242
+90
+111
+245
+81
+106
+246
+67
+97
+253
+57
+95
+253
+59
+96
+242
+67
+98
+225
+84
+103
+174
+82
+87
+98
+48
+39
+89
+68
+51
+74
+69
+47
+85
+83
+60
+88
+93
+63
+99
+115
+76
+105
+129
+81
+113
+139
+91
+118
+146
+95
+122
+152
+98
+124
+157
+100
+120
+156
+95
+114
+153
+90
+110
+151
+85
+110
+151
+85
+110
+151
+85
+111
+152
+86
+114
+153
+90
+116
+155
+92
+119
+155
+93
+119
+158
+93
+119
+158
+91
+120
+161
+91
+121
+163
+91
+119
+163
+88
+118
+162
+87
+118
+162
+85
+119
+163
+84
+121
+165
+88
+122
+164
+90
+126
+166
+95
+129
+166
+99
+127
+161
+100
+126
+156
+102
+123
+151
+102
+114
+140
+93
+105
+130
+88
+95
+117
+81
+92
+113
+82
+86
+107
+76
+92
+76
+60
+94
+78
+62
+96
+80
+64
+96
+80
+64
+95
+79
+63
+95
+79
+63
+95
+79
+63
+97
+81
+65
+98
+82
+66
+95
+79
+63
+93
+77
+61
+93
+77
+61
+97
+81
+65
+99
+83
+67
+98
+82
+66
+96
+81
+62
+100
+83
+63
+97
+80
+62
+93
+80
+64
+94
+81
+73
+91
+81
+80
+90
+83
+90
+101
+97
+112
+115
+113
+137
+121
+120
+154
+122
+124
+165
+126
+128
+177
+128
+129
+185
+125
+127
+186
+120
+122
+183
+114
+115
+180
+108
+111
+182
+116
+119
+198
+118
+124
+202
+128
+131
+202
+139
+141
+198
+150
+151
+195
+164
+164
+190
+178
+176
+187
+188
+185
+180
+203
+197
+181
+211
+204
+176
+217
+207
+172
+219
+207
+165
+220
+207
+163
+221
+209
+161
+217
+203
+156
+217
+194
+152
+209
+168
+136
+184
+128
+103
+161
+93
+70
+203
+122
+103
+216
+116
+101
+189
+72
+63
+216
+81
+78
+247
+99
+99
+233
+75
+76
+229
+63
+65
+225
+57
+57
+227
+59
+58
+226
+58
+57
+219
+55
+53
+216
+54
+49
+214
+59
+54
+203
+56
+49
+192
+53
+46
+199
+66
+59
+187
+60
+51
+191
+73
+63
+198
+88
+75
+185
+79
+65
+206
+100
+86
+209
+99
+84
+204
+88
+73
+197
+71
+57
+196
+58
+47
+205
+54
+45
+216
+55
+47
+225
+54
+47
+227
+52
+47
+223
+48
+45
+223
+50
+44
+224
+55
+48
+228
+61
+52
+224
+60
+48
+221
+55
+41
+223
+53
+40
+229
+55
+44
+228
+47
+36
+234
+47
+38
+236
+47
+41
+238
+49
+45
+238
+50
+48
+235
+52
+48
+232
+53
+49
+226
+54
+52
+215
+55
+57
+230
+74
+78
+245
+89
+93
+237
+78
+83
+215
+56
+61
+215
+54
+60
+249
+88
+96
+255
+126
+132
+255
+120
+128
+255
+107
+113
+255
+99
+107
+255
+102
+109
+255
+101
+107
+245
+92
+97
+242
+89
+92
+252
+91
+96
+255
+87
+90
+255
+70
+75
+249
+58
+66
+248
+57
+65
+243
+51
+62
+235
+45
+57
+234
+50
+62
+238
+62
+72
+252
+85
+95
+255
+97
+105
+255
+104
+114
+254
+103
+112
+251
+100
+109
+254
+100
+110
+255
+97
+111
+251
+94
+103
+237
+83
+83
+223
+70
+64
+214
+56
+53
+214
+52
+49
+215
+49
+49
+215
+47
+46
+216
+51
+49
+219
+57
+52
+225
+68
+61
+220
+66
+58
+217
+63
+55
+214
+60
+52
+215
+57
+48
+219
+56
+49
+224
+57
+51
+230
+54
+54
+240
+55
+60
+243
+52
+59
+243
+52
+59
+246
+52
+60
+245
+54
+59
+242
+53
+57
+235
+51
+51
+227
+49
+47
+222
+51
+44
+222
+53
+46
+223
+55
+46
+224
+53
+43
+228
+51
+43
+233
+50
+44
+239
+50
+44
+245
+50
+48
+247
+49
+50
+248
+48
+51
+250
+47
+50
+249
+46
+49
+249
+47
+47
+243
+48
+46
+236
+51
+46
+229
+55
+46
+224
+63
+53
+204
+56
+44
+191
+54
+44
+175
+47
+38
+184
+59
+55
+210
+88
+87
+255
+152
+154
+254
+123
+131
+255
+109
+128
+255
+102
+124
+246
+93
+114
+239
+81
+104
+241
+72
+101
+249
+68
+101
+253
+61
+100
+245
+59
+96
+242
+79
+108
+209
+84
+100
+137
+61
+63
+80
+44
+32
+69
+58
+38
+68
+70
+46
+77
+77
+53
+90
+94
+67
+91
+105
+69
+99
+120
+77
+113
+136
+90
+120
+146
+98
+120
+150
+96
+116
+149
+92
+114
+150
+89
+113
+152
+89
+108
+149
+83
+109
+150
+82
+110
+151
+83
+111
+152
+84
+114
+153
+88
+116
+155
+90
+117
+156
+93
+117
+156
+91
+116
+155
+88
+116
+157
+87
+118
+160
+88
+119
+161
+87
+118
+162
+87
+118
+162
+85
+117
+161
+84
+116
+160
+83
+123
+165
+91
+123
+163
+93
+122
+158
+94
+117
+151
+91
+109
+139
+85
+98
+126
+77
+88
+114
+67
+83
+106
+62
+63
+85
+46
+63
+85
+47
+62
+84
+46
+91
+75
+59
+94
+78
+62
+96
+80
+64
+96
+80
+64
+96
+80
+64
+95
+79
+63
+96
+80
+64
+97
+81
+65
+98
+82
+66
+96
+80
+64
+95
+79
+63
+96
+80
+64
+98
+82
+66
+99
+83
+67
+98
+82
+66
+96
+80
+64
+102
+86
+71
+95
+81
+70
+92
+79
+71
+94
+84
+83
+97
+90
+97
+100
+96
+111
+109
+107
+131
+118
+119
+150
+119
+121
+162
+123
+125
+174
+125
+127
+184
+120
+124
+185
+113
+117
+181
+107
+112
+180
+108
+111
+182
+110
+113
+190
+117
+119
+206
+124
+126
+211
+137
+137
+209
+152
+152
+206
+168
+167
+199
+184
+182
+193
+201
+197
+186
+211
+206
+177
+219
+214
+172
+226
+219
+167
+231
+222
+167
+230
+221
+164
+228
+219
+164
+226
+216
+163
+219
+209
+158
+212
+199
+154
+212
+188
+154
+189
+155
+128
+170
+124
+100
+199
+138
+119
+202
+125
+109
+182
+86
+74
+211
+96
+91
+246
+114
+112
+236
+90
+91
+231
+75
+76
+226
+63
+64
+228
+62
+62
+233
+63
+64
+229
+59
+59
+224
+54
+54
+219
+54
+52
+214
+61
+56
+201
+56
+51
+202
+63
+56
+185
+54
+46
+184
+62
+51
+189
+75
+64
+182
+72
+59
+200
+93
+77
+221
+111
+96
+212
+96
+81
+198
+72
+58
+189
+53
+41
+196
+48
+38
+212
+54
+45
+220
+53
+45
+219
+48
+41
+226
+53
+49
+229
+57
+53
+228
+61
+55
+224
+60
+51
+220
+56
+46
+219
+53
+41
+223
+52
+42
+227
+53
+42
+236
+55
+46
+237
+53
+43
+237
+50
+43
+235
+48
+43
+231
+48
+44
+227
+50
+44
+225
+52
+46
+221
+53
+50
+214
+56
+55
+216
+62
+64
+228
+74
+76
+243
+87
+91
+250
+94
+98
+252
+92
+100
+254
+93
+101
+255
+97
+105
+240
+79
+87
+235
+74
+82
+238
+78
+86
+252
+92
+100
+255
+104
+111
+255
+101
+107
+244
+89
+95
+242
+79
+84
+236
+53
+58
+239
+45
+53
+241
+44
+54
+244
+47
+57
+238
+40
+53
+228
+34
+45
+227
+41
+54
+234
+57
+67
+251
+81
+90
+253
+92
+100
+255
+100
+108
+255
+101
+109
+255
+102
+110
+255
+101
+109
+252
+92
+104
+242
+82
+90
+229
+69
+69
+222
+60
+55
+219
+54
+52
+222
+54
+51
+223
+53
+53
+220
+51
+48
+218
+50
+47
+219
+54
+50
+224
+62
+57
+219
+62
+55
+216
+59
+52
+215
+58
+51
+219
+56
+49
+223
+56
+50
+229
+57
+53
+231
+58
+54
+233
+57
+59
+234
+55
+58
+235
+55
+58
+238
+55
+57
+238
+55
+57
+236
+54
+53
+229
+51
+49
+223
+50
+44
+220
+51
+44
+221
+54
+45
+223
+55
+44
+226
+54
+44
+229
+50
+43
+234
+49
+44
+242
+49
+44
+245
+50
+48
+247
+49
+50
+247
+48
+51
+250
+47
+50
+249
+46
+49
+247
+47
+47
+243
+48
+46
+236
+51
+46
+229
+55
+46
+223
+60
+51
+212
+61
+50
+194
+56
+46
+182
+49
+42
+183
+55
+52
+216
+90
+91
+255
+144
+147
+251
+115
+125
+254
+103
+122
+254
+94
+118
+247
+87
+111
+244
+80
+105
+246
+71
+102
+246
+65
+98
+250
+61
+99
+241
+66
+99
+227
+81
+104
+183
+76
+86
+119
+60
+56
+76
+50
+35
+62
+57
+35
+61
+65
+40
+71
+71
+47
+80
+83
+56
+88
+99
+65
+96
+114
+74
+110
+131
+88
+117
+143
+95
+118
+147
+93
+116
+147
+88
+113
+147
+86
+112
+148
+84
+107
+146
+79
+107
+148
+80
+108
+149
+81
+109
+150
+82
+112
+151
+86
+114
+153
+88
+115
+154
+91
+115
+154
+89
+116
+155
+88
+117
+157
+87
+117
+159
+87
+117
+159
+87
+116
+158
+84
+114
+158
+81
+113
+157
+82
+112
+156
+81
+110
+152
+80
+108
+148
+78
+104
+140
+76
+98
+129
+70
+88
+117
+63
+78
+105
+54
+70
+93
+47
+64
+87
+43
+64
+87
+45
+64
+87
+45
+64
+87
+45
+89
+76
+60
+91
+78
+62
+94
+81
+65
+94
+81
+65
+94
+81
+65
+94
+81
+65
+95
+82
+66
+96
+83
+67
+97
+84
+68
+96
+83
+67
+95
+82
+66
+96
+83
+67
+97
+84
+68
+97
+84
+68
+96
+83
+67
+94
+80
+67
+98
+85
+77
+92
+81
+77
+91
+81
+82
+99
+89
+98
+107
+100
+116
+113
+109
+132
+118
+117
+149
+121
+123
+164
+121
+123
+172
+121
+126
+182
+120
+124
+187
+110
+115
+181
+101
+105
+176
+96
+103
+175
+106
+110
+184
+114
+117
+196
+125
+125
+213
+135
+133
+217
+151
+148
+217
+169
+167
+216
+187
+185
+209
+203
+201
+202
+220
+215
+193
+229
+224
+184
+233
+228
+173
+237
+231
+169
+240
+232
+167
+237
+229
+166
+231
+225
+167
+226
+219
+165
+215
+207
+160
+203
+196
+154
+185
+174
+144
+170
+154
+129
+156
+130
+107
+171
+130
+112
+168
+110
+96
+158
+81
+71
+187
+93
+85
+222
+109
+105
+247
+117
+117
+238
+96
+95
+227
+74
+76
+226
+66
+68
+234
+65
+68
+235
+62
+64
+231
+57
+58
+224
+54
+54
+223
+61
+58
+212
+59
+54
+212
+65
+58
+194
+55
+48
+183
+55
+44
+183
+62
+51
+174
+61
+47
+182
+70
+56
+219
+106
+92
+223
+105
+91
+217
+91
+77
+202
+66
+54
+197
+50
+40
+209
+52
+43
+217
+54
+45
+217
+50
+44
+222
+53
+50
+233
+65
+62
+236
+71
+67
+224
+61
+54
+213
+50
+41
+213
+49
+39
+218
+50
+39
+222
+48
+37
+230
+52
+42
+232
+49
+41
+231
+46
+41
+230
+47
+41
+227
+50
+44
+226
+55
+47
+225
+61
+52
+224
+66
+57
+198
+45
+40
+202
+52
+51
+220
+68
+67
+240
+86
+88
+250
+94
+98
+247
+90
+97
+243
+83
+91
+241
+81
+91
+231
+69
+80
+232
+70
+81
+237
+77
+87
+251
+91
+101
+255
+107
+116
+255
+109
+115
+242
+87
+93
+225
+60
+66
+232
+47
+53
+242
+45
+52
+250
+50
+60
+251
+51
+62
+244
+44
+57
+236
+40
+52
+243
+55
+69
+255
+76
+87
+245
+74
+83
+244
+80
+87
+247
+87
+95
+252
+95
+102
+255
+100
+107
+255
+97
+105
+246
+82
+89
+232
+67
+73
+222
+57
+55
+222
+55
+49
+227
+55
+53
+233
+60
+56
+235
+59
+59
+230
+57
+53
+225
+53
+49
+221
+54
+48
+221
+58
+51
+217
+59
+50
+215
+57
+48
+215
+57
+48
+220
+55
+49
+225
+56
+51
+231
+58
+54
+233
+60
+56
+227
+57
+57
+227
+57
+57
+229
+57
+55
+231
+57
+56
+232
+56
+56
+230
+55
+52
+225
+52
+48
+219
+50
+43
+218
+54
+45
+219
+55
+45
+222
+56
+44
+226
+54
+44
+231
+50
+41
+235
+48
+41
+243
+48
+44
+247
+49
+48
+245
+49
+50
+245
+49
+51
+248
+48
+50
+247
+47
+49
+247
+47
+47
+242
+48
+46
+238
+51
+46
+231
+54
+46
+221
+57
+48
+220
+68
+57
+199
+56
+48
+187
+52
+46
+181
+47
+46
+228
+95
+98
+255
+131
+136
+248
+108
+119
+252
+99
+120
+251
+88
+115
+248
+81
+109
+251
+78
+108
+250
+69
+102
+243
+59
+93
+239
+61
+95
+233
+74
+102
+210
+85
+103
+155
+68
+74
+107
+60
+52
+79
+62
+44
+62
+60
+39
+59
+63
+40
+70
+68
+47
+72
+72
+48
+81
+92
+60
+89
+107
+69
+103
+124
+81
+114
+137
+91
+116
+143
+90
+113
+144
+85
+109
+143
+82
+107
+143
+79
+105
+144
+77
+105
+145
+75
+105
+146
+76
+107
+148
+80
+109
+150
+84
+110
+151
+85
+112
+151
+88
+113
+152
+87
+117
+156
+89
+117
+157
+87
+116
+156
+85
+114
+156
+84
+112
+154
+82
+109
+151
+77
+107
+149
+77
+106
+148
+76
+101
+141
+71
+97
+136
+69
+91
+127
+65
+85
+116
+59
+76
+105
+51
+69
+96
+45
+65
+88
+42
+62
+85
+39
+67
+93
+48
+68
+94
+49
+69
+95
+50
+87
+74
+58
+90
+77
+61
+92
+79
+63
+94
+81
+65
+93
+80
+64
+94
+81
+65
+95
+82
+66
+97
+84
+68
+96
+83
+67
+96
+83
+67
+96
+83
+67
+97
+84
+68
+97
+84
+68
+96
+83
+67
+95
+82
+66
+92
+80
+68
+90
+79
+77
+90
+81
+86
+98
+88
+99
+106
+99
+115
+113
+109
+134
+118
+117
+149
+120
+122
+163
+122
+124
+173
+119
+124
+180
+115
+121
+183
+109
+114
+180
+98
+105
+175
+93
+100
+172
+97
+103
+177
+108
+114
+190
+120
+123
+202
+137
+138
+221
+149
+146
+225
+164
+162
+225
+182
+181
+225
+199
+196
+217
+213
+209
+208
+225
+220
+198
+231
+227
+189
+235
+229
+179
+238
+233
+175
+238
+232
+174
+233
+226
+171
+227
+219
+170
+218
+211
+167
+203
+195
+158
+188
+182
+150
+166
+164
+139
+157
+152
+132
+150
+134
+118
+155
+127
+113
+155
+113
+99
+156
+98
+87
+181
+104
+96
+208
+113
+109
+251
+139
+137
+243
+118
+116
+232
+92
+93
+229
+76
+78
+229
+69
+71
+234
+65
+68
+234
+61
+63
+232
+60
+60
+223
+58
+56
+219
+60
+56
+222
+69
+63
+211
+67
+59
+195
+58
+48
+186
+58
+47
+176
+54
+41
+167
+49
+35
+191
+73
+59
+219
+97
+82
+234
+107
+92
+219
+83
+69
+201
+58
+44
+204
+52
+39
+212
+54
+43
+215
+52
+45
+217
+52
+50
+241
+77
+75
+254
+90
+88
+237
+75
+70
+217
+56
+48
+214
+51
+42
+219
+52
+43
+222
+50
+40
+223
+46
+38
+225
+44
+37
+225
+44
+37
+222
+45
+37
+220
+49
+41
+218
+54
+44
+217
+59
+48
+215
+63
+52
+194
+47
+39
+196
+52
+44
+206
+58
+54
+217
+67
+66
+223
+70
+72
+224
+69
+73
+228
+71
+78
+234
+77
+86
+241
+81
+93
+246
+86
+98
+247
+87
+97
+248
+91
+100
+255
+102
+111
+255
+107
+115
+241
+86
+94
+219
+56
+61
+233
+50
+55
+240
+47
+52
+241
+46
+54
+240
+43
+52
+235
+37
+50
+235
+41
+52
+249
+62
+73
+255
+83
+95
+237
+63
+73
+232
+65
+73
+234
+71
+76
+242
+81
+86
+255
+90
+96
+255
+88
+93
+244
+71
+77
+227
+54
+56
+225
+53
+51
+228
+55
+51
+234
+59
+56
+242
+64
+62
+244
+64
+63
+239
+61
+59
+230
+57
+53
+224
+55
+50
+221
+56
+50
+218
+57
+49
+217
+56
+48
+217
+56
+48
+220
+55
+49
+227
+55
+51
+232
+57
+54
+233
+58
+55
+226
+58
+55
+224
+59
+57
+227
+58
+55
+230
+58
+56
+231
+58
+54
+229
+56
+52
+224
+53
+46
+218
+51
+43
+218
+54
+44
+219
+55
+45
+222
+56
+44
+226
+54
+44
+231
+50
+41
+235
+48
+41
+242
+47
+43
+246
+48
+47
+244
+50
+50
+244
+50
+51
+247
+49
+50
+246
+48
+49
+246
+48
+47
+242
+48
+46
+238
+51
+46
+231
+54
+46
+220
+56
+47
+224
+70
+60
+201
+57
+49
+190
+51
+46
+182
+44
+44
+238
+102
+106
+255
+121
+128
+248
+103
+116
+253
+100
+121
+250
+86
+113
+251
+76
+107
+255
+72
+106
+252
+64
+99
+239
+55
+89
+232
+63
+94
+224
+82
+104
+195
+89
+101
+135
+67
+66
+101
+67
+55
+90
+79
+59
+72
+70
+49
+65
+67
+45
+76
+71
+51
+70
+68
+45
+76
+85
+54
+83
+99
+62
+98
+116
+76
+108
+131
+85
+112
+139
+88
+110
+141
+82
+107
+141
+80
+105
+142
+75
+103
+143
+73
+104
+144
+74
+104
+145
+75
+106
+147
+77
+107
+148
+80
+109
+150
+84
+111
+150
+87
+112
+151
+86
+116
+155
+88
+115
+155
+85
+113
+153
+83
+111
+151
+80
+106
+147
+77
+103
+144
+74
+101
+142
+72
+100
+141
+71
+96
+135
+68
+93
+129
+65
+87
+121
+61
+82
+113
+56
+77
+105
+54
+76
+102
+54
+78
+101
+55
+79
+102
+56
+77
+103
+56
+78
+104
+56
+79
+105
+58
+85
+72
+56
+87
+74
+58
+91
+78
+62
+92
+79
+63
+93
+80
+64
+93
+80
+64
+95
+82
+66
+97
+84
+68
+95
+82
+66
+96
+83
+67
+97
+84
+68
+97
+84
+68
+96
+83
+67
+95
+82
+66
+95
+82
+66
+94
+81
+73
+86
+77
+82
+95
+88
+104
+110
+102
+123
+116
+112
+137
+120
+116
+151
+120
+119
+161
+120
+122
+171
+121
+123
+180
+115
+121
+183
+106
+114
+179
+96
+103
+173
+91
+99
+171
+95
+103
+176
+106
+114
+187
+118
+124
+198
+128
+132
+206
+147
+149
+223
+158
+159
+224
+173
+174
+228
+187
+189
+228
+203
+201
+225
+212
+211
+217
+221
+218
+209
+225
+223
+202
+229
+224
+194
+230
+226
+191
+228
+222
+188
+224
+215
+182
+218
+208
+181
+206
+198
+175
+190
+182
+163
+174
+167
+151
+155
+153
+140
+143
+141
+128
+140
+132
+121
+141
+123
+113
+147
+117
+107
+157
+114
+105
+169
+109
+101
+188
+111
+105
+230
+137
+132
+237
+129
+126
+240
+116
+114
+240
+102
+100
+238
+88
+89
+237
+79
+78
+235
+69
+69
+233
+65
+64
+227
+58
+55
+224
+59
+55
+228
+66
+61
+222
+69
+63
+204
+60
+51
+198
+61
+51
+196
+66
+53
+175
+49
+35
+174
+48
+34
+199
+73
+59
+220
+88
+75
+214
+78
+64
+204
+61
+47
+206
+56
+42
+208
+54
+42
+209
+51
+42
+214
+52
+50
+245
+85
+85
+255
+107
+104
+250
+93
+88
+227
+68
+62
+220
+59
+51
+223
+59
+50
+227
+56
+48
+226
+52
+45
+227
+50
+44
+226
+49
+43
+221
+48
+41
+212
+48
+39
+205
+47
+36
+198
+47
+36
+194
+48
+35
+197
+57
+44
+192
+52
+39
+193
+51
+41
+203
+58
+53
+215
+67
+65
+219
+69
+71
+219
+66
+71
+218
+64
+72
+225
+69
+80
+236
+80
+91
+242
+86
+97
+242
+86
+97
+249
+93
+104
+255
+101
+109
+241
+87
+95
+222
+63
+68
+233
+59
+60
+237
+53
+55
+237
+51
+56
+239
+50
+56
+242
+50
+61
+247
+57
+67
+255
+72
+83
+255
+86
+95
+229
+53
+63
+222
+51
+59
+223
+54
+59
+234
+65
+68
+249
+74
+79
+253
+72
+77
+244
+59
+65
+233
+49
+51
+232
+53
+49
+235
+57
+53
+239
+60
+56
+242
+60
+57
+243
+59
+57
+240
+58
+55
+233
+55
+51
+226
+55
+48
+223
+59
+50
+220
+59
+49
+219
+58
+48
+220
+57
+48
+223
+56
+50
+228
+55
+51
+232
+54
+52
+233
+55
+53
+230
+58
+56
+228
+59
+56
+230
+58
+56
+232
+58
+57
+232
+59
+55
+230
+57
+53
+225
+54
+47
+220
+51
+44
+219
+55
+45
+220
+56
+46
+223
+57
+45
+225
+55
+42
+229
+51
+41
+233
+49
+41
+241
+48
+41
+244
+49
+45
+243
+51
+50
+241
+51
+51
+244
+50
+50
+244
+48
+49
+244
+49
+47
+242
+48
+46
+238
+51
+46
+231
+54
+46
+222
+55
+47
+224
+67
+58
+202
+55
+48
+192
+49
+45
+192
+49
+51
+247
+106
+112
+255
+113
+122
+249
+103
+116
+248
+95
+116
+246
+82
+109
+252
+68
+102
+255
+63
+100
+255
+59
+99
+242
+58
+94
+228
+71
+100
+216
+91
+109
+171
+86
+91
+119
+69
+62
+100
+74
+61
+97
+89
+70
+84
+79
+59
+75
+73
+52
+80
+73
+54
+71
+69
+46
+71
+80
+51
+76
+92
+56
+90
+108
+70
+102
+124
+78
+109
+133
+83
+109
+138
+82
+108
+140
+77
+104
+141
+74
+102
+142
+72
+103
+143
+72
+103
+145
+73
+105
+146
+76
+106
+147
+79
+108
+149
+83
+110
+149
+86
+111
+150
+85
+116
+153
+86
+115
+152
+85
+110
+149
+82
+106
+146
+76
+102
+143
+75
+99
+140
+72
+97
+138
+70
+95
+136
+70
+90
+129
+66
+88
+124
+63
+83
+116
+59
+80
+110
+56
+79
+107
+58
+82
+108
+61
+87
+110
+64
+90
+113
+67
+85
+111
+63
+85
+112
+61
+85
+111
+63
+82
+69
+53
+85
+72
+56
+88
+75
+59
+90
+77
+61
+91
+78
+62
+92
+79
+63
+94
+81
+65
+96
+83
+67
+96
+83
+67
+97
+84
+68
+97
+84
+68
+97
+84
+68
+96
+83
+67
+96
+83
+67
+98
+85
+69
+97
+86
+80
+94
+86
+99
+106
+101
+124
+121
+117
+144
+125
+121
+154
+122
+121
+161
+120
+121
+169
+118
+121
+176
+115
+119
+180
+106
+114
+179
+99
+106
+176
+91
+99
+171
+93
+101
+174
+104
+112
+185
+118
+126
+199
+129
+135
+209
+136
+141
+209
+153
+157
+220
+163
+166
+221
+175
+179
+226
+187
+191
+228
+198
+199
+227
+207
+206
+224
+212
+211
+219
+215
+213
+214
+217
+214
+209
+217
+213
+204
+215
+208
+198
+210
+201
+192
+204
+195
+190
+197
+186
+184
+180
+168
+168
+163
+155
+153
+141
+137
+134
+124
+121
+116
+124
+116
+113
+120
+107
+101
+130
+107
+101
+143
+110
+103
+144
+97
+91
+157
+96
+91
+192
+115
+109
+215
+122
+117
+237
+128
+123
+249
+126
+121
+253
+115
+112
+250
+100
+99
+243
+85
+84
+237
+73
+71
+237
+68
+63
+234
+62
+58
+225
+60
+54
+224
+65
+59
+209
+58
+49
+211
+67
+58
+221
+84
+74
+194
+62
+50
+184
+54
+41
+189
+57
+44
+194
+61
+46
+200
+63
+47
+207
+66
+49
+215
+67
+53
+214
+64
+49
+209
+55
+45
+208
+50
+47
+234
+76
+77
+250
+95
+93
+242
+87
+83
+223
+68
+63
+217
+58
+52
+219
+56
+49
+224
+55
+48
+230
+57
+51
+231
+57
+50
+231
+57
+50
+226
+58
+49
+218
+57
+47
+209
+57
+44
+202
+56
+43
+196
+56
+41
+176
+40
+24
+184
+51
+34
+200
+64
+50
+211
+73
+62
+210
+68
+64
+203
+59
+58
+204
+55
+59
+207
+58
+64
+211
+57
+67
+227
+73
+83
+237
+86
+95
+240
+89
+98
+244
+93
+102
+246
+95
+104
+232
+83
+89
+218
+63
+67
+229
+64
+62
+236
+63
+59
+243
+64
+67
+253
+70
+74
+255
+76
+84
+255
+81
+89
+255
+84
+93
+255
+85
+94
+226
+51
+58
+221
+46
+53
+221
+46
+51
+231
+55
+58
+245
+60
+65
+249
+58
+63
+248
+52
+56
+244
+48
+50
+237
+52
+50
+239
+57
+53
+240
+56
+54
+237
+52
+50
+235
+50
+48
+234
+50
+48
+231
+52
+48
+225
+52
+46
+227
+60
+52
+224
+61
+52
+223
+60
+51
+222
+59
+50
+225
+56
+51
+228
+55
+51
+232
+52
+51
+232
+52
+51
+232
+56
+56
+231
+57
+56
+232
+56
+56
+235
+57
+57
+235
+57
+55
+233
+55
+53
+226
+53
+47
+222
+51
+44
+219
+55
+45
+220
+56
+44
+221
+58
+43
+223
+55
+42
+227
+50
+40
+231
+48
+40
+239
+48
+40
+242
+49
+44
+241
+52
+50
+240
+52
+51
+243
+51
+50
+243
+49
+49
+243
+49
+47
+241
+49
+46
+236
+51
+46
+231
+54
+46
+224
+57
+49
+217
+60
+51
+204
+55
+49
+193
+48
+45
+209
+64
+67
+255
+110
+117
+253
+107
+117
+247
+99
+113
+237
+84
+105
+241
+74
+102
+250
+62
+97
+255
+55
+94
+255
+55
+98
+248
+64
+100
+227
+79
+105
+200
+92
+105
+139
+71
+70
+106
+70
+58
+93
+76
+60
+93
+86
+67
+88
+81
+62
+81
+74
+55
+79
+71
+52
+73
+68
+46
+68
+74
+46
+71
+85
+50
+83
+99
+62
+94
+115
+72
+103
+127
+77
+106
+135
+79
+106
+138
+75
+103
+140
+71
+103
+140
+70
+102
+142
+71
+102
+144
+72
+103
+144
+74
+105
+146
+78
+107
+148
+82
+109
+148
+85
+109
+148
+85
+113
+149
+85
+111
+148
+81
+106
+145
+78
+103
+142
+75
+99
+140
+72
+96
+137
+69
+95
+136
+70
+94
+134
+71
+92
+130
+69
+91
+126
+68
+87
+120
+65
+86
+114
+63
+85
+111
+64
+89
+112
+66
+93
+114
+71
+94
+117
+71
+90
+114
+66
+88
+115
+64
+88
+115
+64
+78
+66
+50
+81
+69
+53
+85
+73
+57
+87
+75
+59
+88
+76
+60
+90
+78
+62
+92
+80
+64
+94
+82
+66
+97
+85
+69
+98
+86
+70
+98
+86
+70
+97
+85
+69
+95
+83
+67
+97
+85
+69
+102
+90
+74
+104
+93
+89
+110
+103
+119
+117
+112
+142
+124
+120
+153
+123
+121
+160
+119
+120
+166
+118
+119
+173
+112
+117
+175
+106
+111
+175
+97
+104
+172
+94
+102
+174
+95
+103
+176
+101
+109
+182
+112
+120
+192
+125
+133
+205
+137
+144
+216
+143
+151
+214
+153
+161
+210
+161
+168
+210
+170
+178
+217
+180
+186
+222
+186
+191
+223
+192
+193
+224
+195
+195
+223
+199
+197
+221
+198
+194
+217
+197
+192
+212
+193
+186
+204
+188
+179
+196
+187
+176
+193
+181
+168
+186
+166
+153
+170
+150
+139
+153
+139
+132
+139
+117
+111
+113
+119
+110
+111
+115
+101
+101
+122
+102
+101
+137
+109
+106
+133
+94
+89
+150
+99
+95
+155
+90
+84
+183
+103
+96
+214
+117
+110
+237
+124
+118
+252
+125
+119
+255
+120
+115
+254
+106
+102
+249
+92
+87
+252
+83
+78
+245
+72
+66
+230
+61
+54
+231
+68
+61
+216
+59
+52
+219
+71
+61
+234
+92
+82
+197
+59
+48
+196
+60
+48
+189
+55
+43
+190
+54
+40
+199
+62
+46
+209
+68
+51
+212
+66
+51
+212
+65
+49
+215
+65
+51
+210
+56
+54
+216
+62
+62
+221
+67
+67
+220
+66
+64
+214
+61
+55
+213
+56
+49
+216
+55
+47
+222
+55
+47
+229
+58
+51
+230
+57
+51
+229
+58
+51
+226
+59
+51
+219
+62
+53
+213
+65
+53
+209
+69
+56
+204
+71
+54
+174
+45
+24
+188
+59
+37
+205
+74
+56
+209
+76
+61
+198
+61
+53
+187
+48
+43
+192
+48
+48
+202
+57
+62
+215
+65
+74
+226
+76
+85
+236
+86
+97
+240
+90
+101
+239
+92
+100
+236
+89
+97
+223
+76
+82
+212
+62
+64
+209
+52
+47
+218
+53
+47
+227
+57
+57
+237
+63
+64
+245
+66
+72
+247
+68
+74
+244
+64
+73
+239
+62
+70
+228
+51
+59
+225
+48
+54
+230
+49
+54
+240
+55
+60
+247
+54
+57
+249
+49
+52
+254
+45
+50
+253
+49
+52
+239
+50
+48
+240
+57
+53
+240
+55
+52
+236
+48
+46
+232
+44
+42
+231
+48
+44
+230
+51
+46
+224
+51
+44
+228
+61
+53
+224
+61
+52
+224
+61
+52
+224
+60
+51
+227
+58
+53
+230
+57
+53
+234
+54
+53
+236
+54
+53
+236
+53
+55
+236
+53
+55
+237
+53
+55
+238
+54
+56
+238
+54
+54
+235
+53
+52
+228
+50
+46
+222
+49
+43
+222
+55
+46
+221
+57
+45
+221
+58
+43
+223
+55
+42
+225
+52
+38
+230
+49
+38
+237
+49
+40
+241
+49
+44
+240
+52
+50
+238
+53
+51
+241
+52
+50
+242
+50
+49
+243
+49
+47
+241
+49
+46
+236
+51
+46
+231
+54
+46
+226
+59
+51
+210
+52
+43
+210
+58
+53
+198
+50
+48
+231
+85
+88
+255
+112
+120
+249
+99
+110
+241
+90
+105
+227
+75
+96
+239
+72
+102
+253
+58
+98
+255
+49
+93
+255
+54
+98
+253
+67
+104
+219
+77
+101
+177
+80
+89
+106
+53
+47
+94
+71
+55
+88
+75
+58
+85
+78
+59
+89
+81
+62
+85
+74
+56
+76
+64
+48
+73
+68
+48
+64
+70
+44
+65
+79
+46
+75
+91
+54
+88
+106
+64
+98
+120
+71
+102
+129
+74
+104
+136
+73
+102
+139
+70
+101
+138
+68
+99
+139
+66
+99
+141
+69
+101
+142
+72
+103
+144
+76
+104
+145
+79
+105
+145
+82
+107
+146
+83
+110
+146
+82
+108
+144
+80
+104
+143
+78
+100
+139
+74
+97
+138
+72
+95
+136
+70
+95
+135
+72
+95
+135
+72
+95
+133
+72
+95
+130
+72
+93
+126
+71
+93
+121
+70
+93
+119
+72
+96
+119
+75
+99
+120
+79
+99
+122
+78
+92
+116
+66
+90
+117
+64
+90
+117
+64
+74
+67
+51
+77
+70
+54
+81
+72
+57
+84
+75
+60
+87
+75
+61
+89
+77
+63
+92
+79
+63
+94
+81
+65
+100
+87
+70
+101
+88
+71
+100
+88
+72
+98
+86
+70
+95
+85
+73
+97
+87
+77
+103
+94
+85
+108
+99
+102
+119
+114
+137
+121
+117
+154
+120
+118
+158
+116
+115
+159
+114
+114
+164
+116
+117
+173
+108
+112
+175
+98
+103
+169
+90
+97
+169
+95
+101
+175
+102
+108
+184
+109
+115
+191
+118
+124
+200
+129
+135
+211
+143
+147
+221
+151
+156
+222
+155
+161
+211
+160
+167
+209
+169
+174
+216
+174
+179
+221
+177
+180
+223
+178
+179
+223
+180
+179
+223
+182
+179
+222
+181
+176
+217
+179
+172
+213
+174
+166
+203
+171
+161
+196
+170
+159
+193
+164
+153
+185
+153
+140
+170
+136
+126
+150
+126
+120
+132
+102
+97
+103
+108
+99
+102
+100
+88
+90
+108
+90
+88
+124
+99
+95
+123
+86
+80
+147
+98
+93
+140
+77
+70
+162
+85
+77
+187
+97
+88
+212
+108
+99
+238
+121
+114
+255
+129
+122
+255
+124
+119
+255
+112
+106
+254
+97
+92
+247
+84
+79
+233
+71
+66
+238
+79
+73
+221
+66
+61
+222
+71
+64
+234
+87
+79
+186
+44
+34
+190
+49
+39
+190
+52
+39
+199
+62
+46
+209
+69
+54
+203
+62
+45
+193
+50
+34
+202
+55
+39
+219
+69
+55
+222
+69
+63
+211
+57
+55
+204
+51
+46
+205
+53
+48
+212
+59
+53
+215
+61
+53
+221
+60
+52
+225
+61
+52
+228
+59
+52
+228
+57
+50
+222
+53
+46
+215
+52
+43
+207
+53
+41
+202
+56
+43
+197
+60
+44
+194
+63
+45
+212
+83
+62
+200
+71
+50
+189
+60
+41
+190
+58
+45
+195
+61
+50
+196
+59
+53
+194
+55
+52
+194
+52
+51
+220
+75
+78
+221
+76
+81
+225
+80
+85
+229
+84
+89
+232
+89
+93
+229
+86
+88
+220
+77
+79
+212
+67
+64
+203
+52
+43
+212
+54
+43
+218
+53
+47
+224
+52
+50
+228
+49
+52
+232
+49
+54
+233
+48
+56
+231
+46
+54
+238
+51
+62
+237
+50
+59
+244
+52
+63
+253
+56
+66
+255
+51
+62
+253
+41
+53
+255
+40
+51
+255
+46
+57
+248
+45
+51
+249
+53
+55
+249
+53
+57
+240
+46
+47
+235
+42
+43
+233
+48
+46
+232
+53
+49
+226
+53
+47
+227
+60
+52
+224
+61
+52
+224
+61
+52
+225
+61
+52
+228
+59
+54
+231
+58
+54
+235
+55
+54
+238
+54
+54
+236
+52
+54
+235
+51
+53
+236
+50
+53
+237
+51
+52
+237
+53
+53
+234
+52
+49
+227
+49
+45
+219
+48
+40
+222
+56
+44
+221
+58
+43
+221
+58
+43
+222
+56
+40
+224
+52
+38
+227
+51
+36
+233
+51
+38
+236
+52
+42
+238
+53
+48
+238
+53
+50
+240
+52
+50
+240
+51
+47
+242
+50
+47
+239
+50
+44
+235
+52
+44
+231
+54
+46
+228
+61
+52
+205
+47
+38
+215
+62
+57
+202
+52
+53
+249
+98
+103
+255
+112
+121
+246
+91
+105
+237
+80
+99
+228
+70
+93
+243
+72
+104
+255
+61
+101
+255
+50
+93
+255
+55
+97
+245
+71
+104
+201
+74
+93
+148
+66
+70
+83
+43
+35
+88
+72
+56
+84
+75
+58
+79
+72
+54
+89
+80
+63
+83
+74
+57
+69
+64
+45
+71
+70
+49
+61
+67
+39
+64
+74
+40
+73
+85
+49
+83
+100
+58
+95
+114
+69
+101
+125
+73
+103
+132
+74
+101
+136
+72
+99
+136
+67
+97
+137
+66
+98
+138
+67
+99
+141
+69
+101
+142
+72
+102
+143
+77
+104
+143
+80
+105
+144
+81
+108
+144
+80
+107
+144
+77
+102
+141
+74
+99
+138
+73
+97
+136
+71
+96
+135
+70
+96
+135
+72
+96
+134
+73
+94
+129
+71
+94
+127
+70
+95
+125
+71
+96
+124
+73
+97
+123
+75
+100
+123
+77
+102
+124
+78
+102
+126
+78
+93
+120
+67
+92
+121
+63
+93
+122
+66
+68
+66
+54
+70
+68
+56
+74
+70
+59
+80
+71
+62
+82
+72
+62
+87
+73
+62
+93
+77
+62
+95
+79
+63
+96
+81
+62
+97
+82
+63
+96
+83
+66
+95
+86
+71
+98
+89
+82
+103
+98
+95
+111
+106
+110
+115
+111
+126
+119
+113
+147
+122
+116
+160
+124
+121
+168
+121
+119
+169
+112
+112
+166
+103
+103
+163
+96
+97
+162
+92
+95
+164
+96
+98
+173
+102
+104
+181
+111
+112
+192
+121
+122
+204
+132
+130
+214
+141
+139
+223
+150
+146
+231
+156
+153
+232
+160
+158
+223
+161
+160
+218
+163
+162
+219
+164
+163
+220
+166
+163
+220
+165
+162
+219
+165
+160
+216
+164
+159
+213
+165
+158
+210
+163
+156
+207
+162
+154
+201
+162
+153
+198
+159
+150
+193
+153
+142
+184
+142
+131
+171
+131
+124
+155
+113
+111
+124
+104
+103
+108
+99
+95
+96
+102
+90
+90
+108
+89
+85
+115
+86
+80
+128
+85
+78
+143
+86
+79
+150
+82
+73
+169
+89
+80
+181
+88
+80
+192
+91
+83
+216
+107
+100
+235
+122
+114
+246
+131
+124
+255
+139
+134
+249
+117
+113
+255
+117
+115
+237
+95
+93
+223
+80
+76
+217
+69
+65
+239
+90
+84
+204
+55
+49
+197
+50
+42
+196
+54
+42
+195
+55
+40
+192
+55
+39
+195
+55
+38
+198
+57
+40
+202
+59
+43
+208
+60
+46
+213
+63
+49
+210
+56
+46
+214
+60
+50
+215
+63
+52
+211
+59
+48
+205
+53
+40
+205
+51
+39
+216
+58
+47
+226
+64
+53
+224
+57
+48
+225
+57
+48
+222
+55
+46
+215
+55
+43
+207
+55
+41
+201
+58
+42
+198
+63
+44
+196
+65
+47
+194
+61
+46
+198
+64
+52
+203
+69
+58
+205
+71
+60
+204
+67
+59
+197
+60
+52
+187
+50
+44
+182
+43
+38
+199
+60
+55
+208
+69
+66
+217
+79
+76
+224
+86
+83
+227
+89
+86
+225
+88
+82
+216
+79
+73
+208
+67
+58
+205
+58
+42
+213
+58
+40
+220
+56
+44
+227
+53
+46
+232
+46
+47
+237
+42
+50
+240
+40
+51
+244
+39
+54
+251
+44
+62
+250
+43
+63
+251
+42
+63
+253
+41
+63
+255
+39
+63
+255
+38
+63
+255
+36
+60
+255
+35
+60
+255
+35
+55
+255
+38
+56
+255
+42
+59
+254
+44
+57
+244
+44
+54
+237
+46
+53
+233
+53
+54
+232
+60
+58
+221
+56
+52
+221
+58
+51
+222
+59
+52
+224
+59
+53
+227
+58
+53
+230
+57
+53
+233
+55
+51
+235
+53
+52
+235
+51
+53
+236
+52
+54
+235
+53
+52
+233
+53
+52
+231
+53
+51
+226
+53
+47
+221
+53
+44
+219
+53
+41
+220
+56
+44
+219
+57
+42
+220
+57
+40
+222
+57
+38
+223
+56
+38
+226
+55
+37
+227
+54
+37
+230
+52
+38
+236
+53
+45
+237
+52
+47
+240
+53
+48
+241
+52
+46
+241
+53
+44
+237
+53
+43
+232
+54
+42
+228
+56
+44
+222
+58
+48
+212
+55
+46
+211
+58
+53
+215
+62
+64
+255
+109
+117
+255
+98
+113
+248
+85
+106
+241
+75
+99
+247
+79
+105
+236
+58
+90
+249
+57
+94
+255
+63
+103
+245
+64
+99
+230
+80
+107
+178
+73
+87
+97
+36
+35
+71
+43
+32
+65
+56
+39
+75
+68
+52
+82
+76
+60
+79
+73
+57
+66
+67
+49
+59
+68
+47
+60
+73
+47
+65
+72
+38
+69
+75
+37
+75
+83
+46
+83
+93
+56
+91
+107
+68
+97
+118
+75
+100
+126
+78
+100
+131
+74
+98
+134
+70
+96
+136
+66
+97
+137
+64
+99
+139
+66
+101
+141
+70
+104
+144
+74
+108
+144
+80
+109
+145
+81
+108
+145
+76
+105
+142
+72
+103
+140
+71
+102
+139
+72
+102
+138
+74
+101
+137
+73
+99
+133
+72
+97
+131
+71
+100
+131
+74
+100
+129
+73
+98
+127
+71
+99
+126
+71
+100
+127
+74
+100
+127
+72
+101
+126
+71
+97
+125
+67
+91
+123
+60
+92
+127
+61
+95
+130
+66
+61
+63
+52
+63
+65
+54
+70
+67
+60
+74
+69
+63
+80
+69
+63
+84
+71
+62
+91
+75
+62
+93
+77
+61
+96
+79
+59
+96
+81
+60
+94
+83
+65
+94
+86
+73
+99
+91
+88
+104
+99
+105
+110
+108
+121
+115
+111
+134
+116
+112
+149
+118
+112
+158
+116
+112
+162
+112
+109
+162
+103
+102
+159
+97
+97
+159
+93
+94
+161
+92
+92
+164
+101
+100
+176
+107
+106
+186
+116
+114
+197
+125
+123
+207
+134
+130
+217
+141
+137
+224
+148
+142
+230
+152
+147
+229
+155
+149
+221
+156
+151
+217
+157
+152
+218
+158
+153
+219
+158
+151
+218
+157
+150
+217
+156
+150
+214
+155
+149
+211
+158
+150
+210
+156
+148
+205
+156
+147
+200
+155
+147
+198
+154
+145
+192
+147
+138
+183
+136
+127
+170
+128
+121
+154
+115
+109
+123
+107
+101
+105
+100
+94
+94
+101
+91
+89
+107
+90
+83
+113
+86
+77
+124
+84
+74
+141
+84
+75
+157
+84
+75
+178
+91
+82
+187
+88
+82
+195
+88
+82
+211
+102
+97
+221
+114
+106
+224
+120
+111
+235
+126
+119
+251
+136
+133
+255
+135
+133
+247
+117
+115
+238
+103
+100
+227
+85
+83
+235
+90
+85
+199
+50
+44
+194
+47
+37
+197
+55
+41
+195
+55
+38
+192
+55
+37
+193
+56
+38
+196
+56
+39
+200
+59
+42
+207
+59
+45
+211
+61
+47
+213
+57
+44
+213
+57
+44
+211
+58
+44
+210
+58
+44
+209
+57
+43
+209
+57
+43
+212
+56
+43
+216
+56
+44
+223
+59
+49
+224
+57
+48
+220
+56
+46
+214
+56
+44
+207
+57
+42
+200
+57
+40
+193
+58
+38
+190
+57
+38
+190
+54
+42
+193
+56
+48
+198
+61
+53
+201
+64
+56
+202
+65
+57
+200
+63
+55
+197
+60
+52
+194
+57
+49
+191
+52
+45
+199
+62
+54
+209
+72
+64
+216
+79
+71
+218
+81
+73
+215
+78
+70
+204
+67
+59
+195
+55
+42
+202
+55
+37
+211
+56
+36
+221
+55
+41
+229
+52
+44
+237
+47
+47
+244
+43
+51
+249
+41
+55
+253
+40
+58
+255
+43
+64
+255
+42
+65
+255
+41
+65
+255
+38
+65
+255
+35
+64
+255
+33
+60
+255
+30
+61
+255
+29
+58
+255
+30
+57
+255
+31
+56
+255
+36
+58
+255
+41
+59
+247
+45
+57
+241
+50
+58
+234
+55
+58
+230
+60
+60
+220
+57
+52
+220
+58
+53
+222
+59
+52
+224
+59
+53
+227
+58
+53
+230
+57
+53
+233
+55
+51
+235
+53
+50
+235
+51
+53
+236
+52
+54
+235
+53
+52
+232
+54
+52
+228
+55
+49
+223
+54
+47
+220
+53
+44
+217
+53
+41
+219
+57
+42
+219
+57
+42
+220
+57
+40
+220
+57
+38
+222
+57
+38
+223
+56
+37
+225
+56
+37
+227
+54
+37
+231
+53
+43
+234
+51
+43
+235
+52
+44
+235
+53
+42
+235
+53
+42
+232
+54
+40
+228
+55
+41
+223
+55
+42
+221
+61
+49
+209
+52
+43
+207
+53
+51
+239
+84
+88
+255
+102
+114
+255
+91
+111
+241
+73
+98
+249
+76
+104
+248
+69
+99
+247
+64
+95
+244
+56
+91
+243
+62
+97
+239
+78
+109
+205
+76
+98
+139
+56
+64
+89
+41
+37
+69
+51
+39
+60
+54
+40
+62
+59
+44
+67
+64
+49
+67
+66
+48
+61
+64
+45
+56
+68
+46
+58
+73
+44
+60
+68
+29
+75
+80
+39
+92
+98
+60
+101
+111
+74
+104
+118
+82
+101
+122
+81
+100
+126
+79
+100
+130
+76
+97
+131
+70
+97
+134
+65
+97
+137
+64
+99
+140
+64
+103
+141
+68
+105
+142
+72
+107
+144
+77
+108
+145
+78
+108
+145
+75
+106
+144
+71
+104
+141
+72
+102
+139
+70
+103
+138
+74
+102
+137
+73
+102
+133
+74
+100
+131
+72
+102
+131
+75
+100
+129
+73
+100
+127
+72
+100
+128
+70
+101
+129
+71
+101
+129
+71
+102
+127
+69
+98
+126
+65
+93
+128
+62
+95
+132
+63
+98
+135
+66
+54
+57
+46
+58
+60
+49
+63
+63
+55
+68
+65
+58
+75
+66
+59
+79
+69
+60
+86
+72
+61
+89
+76
+60
+94
+79
+60
+92
+79
+60
+92
+83
+66
+94
+87
+77
+99
+93
+93
+104
+101
+108
+111
+109
+123
+115
+113
+137
+115
+111
+148
+113
+107
+153
+106
+102
+152
+99
+96
+149
+92
+91
+148
+90
+90
+152
+92
+93
+160
+92
+95
+166
+104
+106
+181
+110
+111
+191
+119
+120
+202
+127
+128
+210
+134
+132
+216
+138
+136
+220
+143
+139
+224
+145
+142
+221
+147
+144
+215
+147
+144
+211
+147
+144
+211
+147
+144
+211
+148
+142
+212
+147
+141
+211
+147
+140
+208
+146
+139
+206
+149
+140
+205
+147
+139
+199
+148
+139
+194
+148
+140
+191
+147
+139
+186
+140
+133
+175
+131
+123
+162
+126
+115
+145
+121
+103
+119
+115
+96
+102
+103
+91
+91
+100
+91
+86
+100
+91
+82
+104
+88
+75
+117
+85
+72
+135
+83
+72
+166
+89
+81
+190
+95
+89
+203
+91
+89
+208
+88
+87
+218
+100
+98
+222
+109
+105
+220
+113
+107
+226
+119
+113
+251
+138
+132
+255
+138
+134
+255
+133
+129
+255
+125
+121
+247
+110
+104
+238
+97
+88
+196
+52
+43
+192
+50
+38
+196
+56
+41
+193
+58
+39
+192
+57
+38
+192
+57
+37
+194
+57
+38
+198
+59
+40
+204
+58
+43
+208
+58
+44
+214
+58
+45
+211
+53
+41
+206
+53
+39
+208
+56
+42
+212
+62
+47
+212
+62
+47
+206
+54
+40
+203
+47
+34
+218
+58
+46
+218
+56
+45
+217
+55
+44
+214
+56
+44
+208
+58
+43
+201
+58
+41
+194
+57
+38
+190
+55
+36
+189
+53
+41
+192
+54
+44
+194
+56
+46
+196
+58
+48
+199
+61
+51
+202
+64
+54
+203
+65
+55
+204
+66
+56
+199
+58
+49
+202
+64
+54
+207
+69
+59
+208
+70
+60
+210
+72
+62
+209
+71
+61
+202
+64
+54
+197
+55
+43
+204
+54
+37
+214
+54
+38
+223
+55
+44
+231
+52
+47
+241
+48
+51
+246
+45
+53
+251
+43
+57
+255
+42
+60
+252
+39
+59
+252
+39
+61
+251
+37
+61
+249
+35
+59
+251
+33
+58
+250
+30
+55
+252
+28
+55
+254
+27
+54
+255
+29
+55
+255
+30
+53
+254
+35
+55
+253
+42
+59
+247
+50
+60
+242
+55
+62
+236
+57
+60
+229
+59
+59
+220
+57
+52
+220
+58
+53
+222
+59
+52
+224
+59
+53
+229
+57
+53
+231
+56
+53
+233
+55
+51
+235
+53
+50
+237
+51
+54
+238
+52
+55
+237
+53
+53
+234
+54
+53
+229
+54
+49
+225
+54
+47
+220
+53
+44
+216
+52
+40
+218
+56
+41
+217
+57
+41
+218
+57
+39
+219
+56
+37
+221
+56
+37
+222
+55
+36
+224
+55
+36
+225
+54
+37
+225
+53
+39
+226
+52
+41
+227
+53
+42
+227
+54
+40
+227
+54
+40
+225
+55
+40
+221
+55
+41
+218
+56
+43
+219
+61
+50
+204
+50
+42
+211
+56
+54
+255
+108
+112
+255
+93
+108
+249
+81
+104
+237
+62
+91
+255
+75
+108
+247
+59
+92
+255
+66
+100
+240
+56
+90
+233
+65
+98
+227
+87
+113
+171
+64
+82
+101
+34
+41
+81
+46
+42
+65
+52
+43
+52
+53
+39
+53
+54
+38
+58
+59
+41
+63
+62
+42
+62
+61
+40
+60
+64
+41
+62
+69
+38
+62
+70
+29
+88
+97
+52
+115
+126
+84
+128
+140
+100
+119
+135
+96
+104
+127
+83
+97
+125
+76
+97
+128
+71
+96
+131
+67
+96
+133
+63
+97
+137
+64
+99
+140
+64
+104
+142
+69
+106
+143
+74
+107
+144
+77
+108
+145
+78
+110
+147
+77
+107
+145
+72
+104
+141
+72
+103
+140
+71
+104
+139
+75
+104
+139
+75
+102
+136
+76
+100
+134
+74
+101
+132
+75
+100
+131
+74
+99
+128
+70
+100
+129
+71
+102
+130
+72
+102
+130
+71
+101
+129
+70
+98
+128
+66
+99
+134
+68
+101
+138
+69
+104
+141
+72
+50
+53
+42
+53
+56
+45
+59
+60
+52
+65
+62
+55
+71
+64
+58
+75
+66
+59
+82
+69
+60
+86
+74
+60
+88
+76
+60
+89
+77
+61
+89
+81
+68
+94
+87
+79
+99
+94
+98
+105
+103
+114
+111
+110
+128
+114
+111
+140
+114
+109
+149
+106
+103
+148
+96
+94
+143
+87
+87
+139
+84
+85
+142
+87
+88
+152
+92
+95
+162
+97
+99
+173
+108
+110
+187
+114
+115
+195
+123
+124
+206
+130
+131
+213
+136
+134
+217
+138
+136
+219
+140
+136
+220
+141
+138
+217
+143
+142
+212
+143
+140
+209
+143
+140
+209
+142
+139
+210
+143
+137
+211
+142
+136
+210
+142
+134
+209
+141
+133
+206
+143
+133
+202
+142
+133
+196
+143
+134
+191
+144
+136
+187
+143
+136
+180
+137
+131
+169
+128
+121
+154
+126
+112
+137
+127
+96
+112
+121
+90
+96
+107
+89
+89
+99
+92
+84
+96
+94
+81
+98
+91
+73
+109
+86
+70
+128
+82
+69
+161
+84
+76
+193
+91
+89
+209
+89
+91
+217
+88
+92
+228
+99
+103
+228
+108
+107
+224
+112
+108
+228
+121
+115
+236
+125
+118
+237
+122
+115
+254
+131
+126
+255
+134
+129
+255
+129
+123
+245
+107
+97
+201
+60
+50
+196
+56
+41
+194
+59
+40
+191
+58
+39
+191
+59
+38
+190
+58
+37
+193
+58
+38
+197
+58
+39
+200
+57
+41
+206
+56
+42
+216
+58
+46
+212
+54
+42
+206
+53
+39
+206
+56
+41
+209
+62
+46
+209
+62
+46
+203
+56
+40
+199
+47
+33
+210
+54
+41
+211
+53
+41
+210
+52
+40
+210
+54
+41
+209
+57
+43
+205
+60
+43
+200
+61
+42
+196
+59
+41
+196
+58
+45
+196
+58
+47
+198
+57
+48
+198
+57
+47
+199
+58
+49
+200
+59
+49
+201
+60
+51
+203
+61
+51
+211
+68
+60
+211
+69
+59
+208
+65
+57
+203
+61
+51
+203
+60
+52
+207
+65
+55
+207
+64
+56
+206
+59
+49
+206
+53
+39
+217
+53
+41
+226
+53
+46
+235
+51
+49
+242
+47
+53
+247
+43
+54
+249
+41
+55
+252
+41
+58
+249
+38
+57
+247
+38
+59
+247
+38
+59
+248
+39
+60
+251
+38
+60
+253
+37
+58
+255
+36
+58
+255
+35
+58
+255
+33
+54
+253
+34
+54
+250
+37
+55
+249
+44
+59
+247
+53
+62
+242
+57
+63
+233
+57
+59
+225
+57
+56
+220
+57
+52
+220
+58
+53
+222
+59
+52
+224
+59
+53
+229
+57
+53
+231
+56
+53
+233
+55
+51
+235
+53
+52
+238
+52
+55
+238
+52
+55
+238
+54
+54
+234
+54
+53
+230
+55
+50
+225
+54
+47
+220
+53
+44
+215
+53
+42
+216
+56
+42
+216
+56
+40
+216
+56
+40
+217
+56
+38
+218
+55
+38
+220
+55
+36
+221
+54
+36
+221
+54
+36
+219
+53
+37
+220
+54
+40
+221
+55
+39
+220
+57
+40
+220
+57
+40
+218
+59
+40
+215
+58
+41
+214
+58
+43
+213
+59
+49
+206
+51
+46
+231
+73
+74
+255
+111
+119
+254
+85
+104
+243
+69
+94
+243
+62
+95
+255
+67
+102
+251
+55
+91
+252
+60
+97
+240
+66
+99
+228
+79
+108
+196
+80
+101
+129
+47
+61
+78
+29
+33
+72
+48
+46
+54
+47
+39
+50
+52
+39
+56
+58
+44
+62
+65
+46
+65
+64
+43
+63
+61
+36
+65
+64
+36
+69
+70
+36
+84
+93
+48
+112
+126
+77
+143
+159
+114
+151
+168
+124
+131
+152
+109
+106
+132
+87
+95
+123
+74
+93
+126
+69
+95
+131
+67
+97
+134
+64
+98
+138
+65
+102
+143
+67
+107
+144
+74
+108
+145
+76
+109
+146
+79
+109
+146
+79
+111
+148
+78
+108
+146
+73
+105
+142
+73
+104
+141
+72
+105
+140
+76
+105
+140
+76
+104
+138
+78
+103
+137
+77
+102
+133
+76
+100
+131
+74
+100
+129
+71
+101
+130
+72
+103
+131
+72
+104
+132
+73
+102
+130
+71
+100
+130
+68
+103
+138
+72
+105
+142
+73
+108
+145
+76
+45
+51
+39
+51
+54
+43
+56
+57
+49
+60
+59
+54
+66
+61
+57
+71
+64
+58
+77
+68
+61
+81
+71
+61
+83
+73
+61
+83
+75
+62
+85
+78
+68
+90
+85
+81
+97
+94
+101
+105
+103
+117
+109
+107
+129
+108
+107
+138
+106
+104
+144
+98
+96
+143
+88
+86
+136
+80
+80
+134
+81
+81
+141
+88
+89
+154
+96
+99
+170
+102
+106
+180
+111
+114
+193
+117
+120
+201
+124
+127
+208
+130
+133
+214
+134
+135
+217
+135
+136
+216
+138
+137
+217
+139
+138
+214
+139
+139
+209
+139
+138
+206
+138
+136
+209
+137
+135
+210
+137
+133
+210
+136
+131
+211
+138
+131
+211
+137
+130
+207
+140
+132
+205
+139
+132
+199
+141
+133
+192
+141
+134
+185
+141
+134
+175
+135
+130
+162
+126
+120
+146
+127
+110
+129
+131
+90
+104
+125
+84
+90
+108
+87
+84
+99
+92
+82
+92
+96
+79
+91
+95
+72
+102
+90
+68
+122
+83
+66
+149
+74
+68
+187
+83
+82
+209
+83
+87
+219
+82
+89
+230
+93
+100
+231
+102
+106
+224
+108
+108
+227
+118
+113
+228
+117
+110
+226
+111
+104
+247
+126
+118
+255
+130
+123
+255
+135
+126
+244
+108
+96
+201
+63
+50
+193
+56
+40
+192
+59
+40
+191
+61
+39
+191
+61
+39
+192
+60
+39
+194
+59
+39
+197
+58
+39
+199
+56
+40
+205
+55
+41
+216
+58
+47
+217
+56
+46
+210
+56
+44
+207
+57
+43
+204
+58
+43
+201
+58
+42
+200
+57
+41
+201
+55
+40
+207
+57
+43
+209
+55
+43
+210
+56
+44
+209
+55
+43
+207
+55
+42
+204
+56
+42
+203
+60
+44
+203
+62
+45
+202
+60
+48
+201
+61
+48
+202
+60
+50
+201
+59
+47
+200
+58
+48
+198
+56
+44
+197
+55
+45
+197
+53
+42
+208
+64
+55
+208
+64
+53
+205
+61
+52
+201
+57
+46
+203
+56
+48
+206
+59
+49
+205
+58
+50
+204
+53
+44
+208
+47
+37
+217
+48
+41
+228
+50
+48
+236
+50
+53
+244
+47
+56
+249
+45
+57
+251
+43
+59
+252
+44
+60
+252
+45
+63
+251
+46
+63
+252
+47
+64
+252
+47
+64
+254
+47
+65
+255
+47
+63
+255
+45
+63
+255
+46
+64
+255
+40
+56
+251
+40
+55
+247
+43
+55
+245
+48
+58
+241
+54
+61
+237
+56
+61
+228
+56
+56
+221
+53
+52
+220
+57
+52
+220
+58
+53
+222
+59
+54
+226
+58
+55
+229
+57
+53
+231
+56
+53
+234
+54
+53
+236
+52
+52
+241
+52
+56
+241
+52
+56
+239
+53
+54
+237
+55
+54
+230
+55
+50
+225
+54
+47
+218
+54
+44
+215
+53
+42
+216
+56
+42
+214
+57
+40
+214
+57
+40
+216
+57
+38
+216
+57
+38
+217
+56
+38
+218
+55
+38
+217
+56
+38
+213
+56
+37
+213
+58
+38
+214
+59
+39
+213
+61
+40
+212
+61
+40
+211
+62
+42
+211
+61
+44
+211
+61
+46
+208
+55
+47
+215
+60
+56
+255
+93
+100
+255
+96
+111
+255
+80
+103
+240
+60
+89
+255
+66
+104
+250
+55
+95
+255
+55
+95
+242
+52
+88
+237
+78
+108
+215
+92
+113
+148
+64
+79
+91
+38
+46
+71
+40
+45
+63
+49
+48
+49
+46
+41
+52
+54
+43
+58
+62
+47
+60
+65
+43
+58
+61
+34
+62
+61
+30
+80
+74
+40
+94
+92
+53
+121
+133
+83
+144
+163
+108
+170
+190
+139
+168
+190
+141
+142
+165
+119
+111
+139
+91
+97
+127
+75
+94
+127
+70
+96
+132
+68
+99
+136
+66
+101
+141
+68
+106
+147
+71
+111
+148
+78
+112
+149
+80
+111
+147
+83
+111
+147
+83
+111
+148
+78
+108
+146
+73
+105
+142
+73
+103
+140
+71
+105
+140
+76
+105
+140
+76
+105
+139
+79
+104
+138
+78
+102
+133
+74
+101
+132
+73
+100
+131
+72
+101
+132
+73
+103
+133
+73
+104
+134
+72
+103
+133
+71
+101
+133
+68
+105
+142
+73
+105
+145
+75
+108
+148
+78
+43
+49
+37
+46
+52
+42
+52
+55
+48
+56
+57
+51
+62
+58
+55
+66
+61
+58
+72
+65
+59
+75
+68
+60
+78
+72
+60
+78
+71
+61
+79
+74
+68
+87
+83
+82
+95
+94
+102
+102
+101
+117
+103
+103
+127
+103
+102
+134
+98
+97
+137
+91
+89
+138
+81
+81
+133
+78
+79
+135
+82
+83
+147
+91
+94
+163
+101
+105
+179
+108
+111
+190
+117
+119
+202
+122
+124
+209
+127
+129
+214
+131
+133
+216
+134
+135
+217
+134
+135
+215
+136
+135
+213
+137
+136
+212
+135
+135
+205
+134
+134
+204
+134
+132
+205
+133
+130
+207
+133
+128
+210
+133
+128
+210
+135
+127
+212
+135
+128
+208
+141
+133
+210
+140
+133
+201
+141
+133
+192
+140
+134
+182
+139
+133
+169
+132
+128
+155
+123
+118
+138
+124
+106
+120
+129
+87
+97
+126
+81
+86
+109
+85
+81
+100
+94
+80
+92
+100
+77
+89
+97
+73
+99
+93
+69
+118
+87
+67
+146
+78
+69
+183
+85
+82
+209
+84
+90
+219
+82
+90
+231
+92
+99
+231
+98
+103
+228
+104
+106
+231
+113
+111
+236
+121
+114
+230
+113
+104
+247
+124
+116
+243
+115
+106
+254
+120
+109
+230
+92
+81
+196
+59
+43
+190
+53
+35
+194
+59
+39
+193
+61
+40
+193
+61
+40
+195
+60
+40
+196
+59
+40
+200
+59
+41
+203
+57
+42
+207
+55
+42
+214
+53
+43
+216
+55
+45
+212
+58
+46
+206
+58
+44
+199
+58
+41
+196
+56
+39
+198
+58
+41
+202
+61
+44
+207
+61
+46
+214
+64
+50
+217
+65
+52
+214
+62
+49
+206
+56
+42
+200
+52
+38
+202
+56
+41
+203
+60
+44
+201
+58
+44
+200
+58
+44
+201
+59
+47
+201
+59
+45
+202
+58
+47
+200
+57
+43
+200
+53
+43
+199
+53
+40
+202
+54
+44
+207
+59
+47
+210
+62
+52
+211
+63
+51
+214
+63
+54
+213
+62
+51
+206
+55
+46
+201
+44
+35
+210
+43
+37
+220
+45
+42
+231
+48
+50
+240
+51
+57
+246
+49
+59
+250
+48
+60
+253
+48
+63
+253
+48
+63
+249
+48
+64
+247
+49
+64
+247
+49
+64
+246
+48
+61
+247
+47
+60
+247
+45
+57
+250
+44
+57
+250
+42
+55
+252
+46
+59
+248
+46
+58
+245
+48
+58
+240
+51
+58
+237
+54
+59
+231
+55
+58
+224
+54
+54
+218
+53
+51
+220
+57
+52
+221
+58
+53
+223
+58
+54
+226
+58
+55
+229
+57
+53
+231
+56
+53
+234
+54
+53
+236
+52
+52
+242
+53
+57
+242
+53
+57
+240
+54
+55
+237
+55
+54
+230
+55
+52
+223
+54
+47
+218
+54
+45
+214
+54
+42
+213
+55
+43
+212
+56
+41
+212
+56
+41
+212
+57
+39
+213
+56
+39
+213
+56
+37
+215
+55
+39
+212
+57
+37
+208
+57
+36
+206
+60
+37
+207
+61
+38
+207
+63
+39
+206
+64
+40
+206
+64
+42
+206
+63
+46
+208
+60
+48
+208
+55
+49
+232
+72
+72
+255
+103
+113
+254
+78
+98
+255
+72
+100
+246
+56
+90
+255
+66
+108
+246
+49
+92
+255
+57
+96
+234
+55
+87
+221
+83
+106
+185
+87
+102
+107
+50
+57
+71
+41
+43
+71
+55
+58
+59
+50
+51
+56
+51
+48
+58
+55
+48
+57
+59
+45
+53
+58
+35
+51
+56
+24
+66
+68
+29
+102
+99
+58
+129
+131
+84
+159
+174
+119
+169
+193
+135
+181
+206
+151
+175
+199
+147
+146
+174
+125
+118
+148
+98
+101
+134
+81
+96
+130
+70
+96
+133
+66
+99
+136
+66
+103
+143
+70
+109
+150
+74
+114
+152
+79
+114
+151
+82
+113
+149
+85
+112
+148
+84
+111
+148
+78
+108
+145
+75
+104
+141
+72
+102
+139
+70
+104
+139
+75
+105
+140
+76
+105
+139
+78
+105
+139
+79
+103
+134
+75
+102
+133
+74
+101
+132
+73
+102
+133
+73
+104
+136
+73
+105
+137
+72
+105
+135
+71
+102
+134
+67
+106
+143
+74
+107
+147
+77
+110
+150
+80
+40
+48
+35
+43
+49
+39
+47
+52
+45
+51
+53
+48
+55
+54
+52
+60
+56
+53
+64
+61
+56
+67
+62
+56
+73
+69
+60
+72
+69
+60
+75
+72
+67
+82
+80
+81
+91
+91
+101
+97
+98
+116
+98
+98
+124
+96
+96
+130
+95
+94
+136
+90
+88
+138
+84
+84
+138
+84
+84
+144
+92
+93
+160
+103
+105
+179
+112
+115
+196
+118
+120
+205
+123
+127
+216
+126
+130
+219
+131
+132
+222
+132
+134
+221
+132
+133
+216
+131
+132
+214
+133
+132
+212
+134
+133
+209
+131
+134
+203
+130
+133
+202
+131
+131
+205
+130
+129
+207
+131
+127
+211
+133
+128
+212
+136
+128
+214
+136
+128
+211
+141
+133
+210
+139
+132
+200
+139
+131
+188
+139
+132
+176
+137
+130
+163
+129
+124
+146
+119
+113
+127
+117
+102
+109
+125
+86
+91
+121
+81
+81
+107
+87
+78
+101
+95
+79
+93
+101
+77
+91
+100
+73
+100
+96
+71
+116
+91
+69
+140
+82
+70
+176
+91
+84
+202
+89
+91
+214
+85
+90
+226
+91
+97
+230
+93
+100
+231
+98
+101
+237
+109
+108
+245
+122
+115
+237
+114
+106
+247
+120
+111
+222
+89
+80
+229
+91
+80
+210
+68
+56
+195
+53
+39
+199
+58
+41
+197
+58
+39
+196
+60
+38
+197
+61
+39
+200
+61
+40
+202
+59
+42
+205
+58
+42
+208
+56
+42
+212
+54
+42
+211
+48
+39
+212
+51
+41
+210
+56
+44
+205
+59
+44
+199
+59
+42
+194
+59
+40
+192
+59
+40
+195
+60
+41
+200
+59
+42
+213
+67
+52
+225
+75
+61
+222
+72
+58
+211
+61
+47
+202
+52
+38
+201
+53
+39
+205
+59
+44
+200
+57
+41
+200
+57
+41
+200
+57
+43
+200
+57
+41
+202
+56
+43
+202
+56
+41
+203
+55
+43
+203
+55
+41
+205
+54
+43
+210
+60
+46
+215
+63
+52
+216
+64
+51
+218
+64
+54
+219
+65
+53
+215
+58
+49
+210
+49
+41
+220
+48
+46
+229
+49
+52
+238
+52
+57
+245
+54
+62
+249
+52
+62
+249
+49
+62
+250
+48
+64
+248
+47
+63
+242
+46
+60
+239
+47
+60
+237
+47
+57
+237
+48
+55
+239
+45
+53
+239
+44
+50
+242
+43
+50
+241
+42
+49
+244
+49
+57
+244
+50
+58
+242
+53
+59
+236
+53
+57
+229
+53
+55
+225
+53
+53
+223
+55
+54
+221
+56
+54
+220
+56
+54
+221
+57
+55
+223
+58
+54
+227
+58
+55
+230
+56
+55
+233
+55
+55
+234
+54
+55
+236
+52
+54
+244
+53
+58
+244
+53
+58
+241
+55
+58
+238
+56
+55
+230
+55
+52
+224
+55
+48
+218
+54
+45
+212
+54
+42
+211
+55
+42
+209
+56
+42
+208
+56
+42
+208
+57
+40
+208
+57
+40
+208
+57
+38
+209
+56
+40
+208
+57
+38
+203
+57
+34
+200
+58
+34
+200
+62
+36
+199
+63
+37
+200
+64
+40
+200
+64
+42
+203
+62
+45
+206
+59
+49
+213
+58
+54
+250
+85
+91
+255
+94
+111
+255
+71
+97
+253
+62
+95
+254
+58
+96
+255
+56
+102
+250
+53
+98
+244
+58
+95
+230
+71
+99
+192
+80
+96
+135
+64
+72
+84
+50
+51
+67
+53
+52
+68
+57
+61
+62
+51
+55
+66
+51
+54
+64
+53
+49
+58
+56
+43
+54
+60
+34
+57
+67
+30
+80
+92
+46
+125
+132
+80
+159
+168
+113
+176
+197
+138
+175
+203
+142
+176
+204
+146
+166
+195
+141
+146
+174
+125
+123
+153
+101
+103
+136
+81
+95
+129
+69
+94
+131
+64
+99
+137
+64
+105
+143
+68
+111
+149
+74
+115
+153
+80
+115
+152
+83
+113
+149
+85
+111
+147
+83
+110
+147
+78
+107
+144
+74
+103
+140
+71
+101
+138
+69
+103
+138
+74
+104
+139
+75
+105
+139
+78
+105
+139
+78
+102
+136
+75
+100
+134
+73
+100
+134
+73
+101
+136
+72
+103
+138
+74
+104
+139
+73
+105
+137
+72
+102
+137
+69
+106
+146
+76
+108
+150
+78
+111
+153
+81
+38
+46
+33
+40
+48
+37
+45
+50
+43
+49
+51
+46
+51
+51
+49
+55
+54
+52
+58
+57
+53
+60
+59
+54
+71
+68
+61
+68
+68
+60
+71
+70
+66
+79
+79
+81
+90
+90
+100
+95
+97
+112
+94
+96
+121
+92
+92
+126
+96
+95
+137
+92
+90
+140
+89
+88
+145
+92
+92
+154
+103
+103
+173
+113
+115
+192
+122
+124
+209
+127
+128
+220
+129
+132
+225
+130
+133
+228
+133
+134
+227
+132
+133
+225
+131
+131
+219
+129
+130
+213
+131
+130
+210
+131
+130
+206
+132
+135
+204
+131
+134
+201
+132
+132
+204
+131
+130
+206
+133
+130
+211
+135
+130
+214
+138
+130
+215
+140
+131
+212
+141
+133
+208
+140
+131
+196
+139
+130
+183
+138
+130
+171
+133
+127
+155
+127
+120
+136
+115
+110
+117
+111
+99
+99
+117
+87
+85
+114
+84
+76
+105
+87
+75
+102
+95
+77
+99
+101
+77
+97
+100
+73
+102
+96
+70
+115
+93
+70
+125
+79
+63
+159
+89
+77
+184
+89
+83
+197
+83
+82
+215
+86
+90
+226
+87
+92
+233
+90
+96
+240
+100
+101
+247
+114
+109
+241
+110
+102
+247
+113
+104
+209
+68
+59
+212
+65
+55
+197
+49
+37
+200
+52
+38
+212
+67
+50
+199
+57
+37
+199
+58
+38
+201
+59
+39
+205
+60
+41
+208
+58
+43
+211
+58
+44
+216
+56
+44
+217
+55
+44
+207
+44
+35
+206
+48
+37
+206
+54
+41
+203
+60
+44
+199
+64
+45
+193
+62
+42
+190
+59
+39
+188
+55
+36
+192
+52
+35
+209
+66
+50
+227
+79
+65
+228
+78
+64
+216
+66
+52
+203
+55
+41
+203
+55
+41
+208
+62
+47
+202
+59
+43
+201
+58
+42
+199
+56
+40
+198
+55
+39
+200
+54
+39
+202
+54
+40
+206
+56
+42
+208
+56
+43
+211
+59
+46
+213
+59
+47
+213
+57
+45
+210
+54
+42
+213
+55
+44
+218
+60
+49
+221
+60
+50
+220
+55
+49
+232
+56
+56
+241
+56
+61
+247
+58
+65
+251
+57
+66
+250
+52
+65
+245
+47
+60
+242
+44
+59
+239
+44
+58
+237
+47
+59
+234
+49
+57
+234
+51
+56
+235
+52
+56
+237
+53
+55
+241
+53
+54
+244
+51
+54
+243
+53
+55
+239
+50
+54
+238
+53
+58
+236
+56
+59
+233
+54
+57
+226
+52
+53
+222
+52
+52
+223
+55
+54
+225
+60
+58
+221
+56
+54
+222
+57
+55
+225
+57
+54
+227
+58
+55
+230
+56
+55
+233
+55
+55
+234
+54
+55
+236
+52
+54
+244
+53
+58
+244
+53
+58
+241
+55
+58
+236
+56
+57
+230
+57
+53
+223
+56
+50
+216
+55
+47
+211
+55
+43
+208
+56
+43
+205
+58
+42
+205
+57
+43
+204
+59
+42
+205
+58
+42
+205
+58
+40
+205
+58
+42
+204
+59
+40
+197
+57
+34
+194
+58
+34
+195
+61
+36
+194
+62
+37
+195
+63
+40
+198
+63
+43
+201
+61
+46
+205
+56
+49
+220
+60
+62
+255
+93
+102
+255
+81
+103
+255
+72
+100
+250
+56
+91
+255
+63
+103
+246
+46
+92
+251
+62
+104
+228
+61
+91
+224
+93
+111
+162
+76
+85
+91
+45
+45
+71
+56
+51
+70
+66
+63
+64
+55
+58
+67
+52
+57
+71
+48
+54
+70
+50
+49
+64
+57
+41
+63
+68
+38
+69
+86
+42
+96
+116
+63
+139
+157
+97
+170
+190
+127
+177
+203
+140
+171
+201
+139
+166
+195
+139
+157
+186
+132
+142
+172
+122
+123
+153
+101
+102
+135
+80
+90
+124
+64
+94
+129
+63
+97
+135
+62
+104
+142
+67
+111
+149
+74
+114
+152
+79
+114
+151
+82
+112
+148
+84
+110
+146
+82
+110
+147
+78
+106
+143
+73
+102
+139
+70
+100
+137
+68
+102
+137
+73
+104
+139
+75
+105
+139
+78
+105
+139
+78
+102
+136
+75
+101
+135
+74
+100
+135
+71
+101
+136
+70
+103
+138
+72
+104
+139
+71
+104
+139
+71
+101
+138
+68
+107
+147
+76
+109
+151
+79
+112
+154
+82
+40
+48
+33
+39
+47
+34
+40
+45
+38
+41
+46
+40
+46
+48
+45
+51
+51
+49
+55
+56
+51
+57
+58
+52
+61
+61
+53
+63
+64
+56
+68
+69
+64
+74
+76
+75
+79
+82
+89
+86
+88
+101
+90
+92
+115
+93
+94
+125
+89
+88
+130
+91
+89
+139
+94
+93
+150
+101
+101
+163
+110
+110
+182
+119
+120
+200
+127
+129
+216
+132
+133
+226
+140
+140
+238
+140
+140
+240
+138
+138
+236
+134
+135
+228
+130
+130
+220
+128
+128
+214
+130
+128
+211
+131
+130
+206
+128
+131
+198
+129
+133
+197
+131
+131
+201
+132
+132
+206
+134
+131
+208
+136
+131
+211
+139
+132
+210
+140
+132
+207
+138
+128
+197
+138
+128
+188
+137
+128
+175
+135
+125
+160
+128
+120
+143
+119
+111
+122
+107
+101
+103
+102
+93
+88
+106
+92
+81
+108
+92
+77
+104
+92
+76
+102
+94
+75
+101
+95
+73
+102
+96
+72
+106
+96
+71
+114
+94
+70
+114
+79
+59
+135
+84
+65
+166
+92
+79
+193
+96
+89
+209
+89
+88
+220
+81
+84
+237
+83
+91
+247
+92
+96
+249
+104
+101
+230
+89
+80
+212
+68
+60
+206
+55
+48
+209
+55
+47
+215
+58
+49
+214
+61
+47
+212
+59
+43
+207
+57
+40
+205
+58
+38
+207
+57
+40
+209
+58
+41
+212
+56
+41
+216
+56
+42
+220
+53
+44
+220
+53
+44
+208
+47
+37
+205
+51
+41
+204
+56
+44
+202
+62
+47
+197
+64
+47
+193
+64
+45
+190
+61
+42
+188
+57
+39
+194
+57
+41
+190
+48
+34
+233
+87
+74
+223
+75
+63
+195
+47
+35
+209
+61
+49
+206
+60
+47
+199
+56
+40
+202
+59
+43
+201
+58
+41
+200
+57
+40
+199
+56
+39
+200
+55
+38
+201
+54
+38
+203
+53
+38
+204
+52
+38
+208
+55
+41
+215
+59
+46
+220
+62
+50
+220
+60
+48
+217
+55
+44
+218
+56
+45
+226
+62
+52
+236
+67
+60
+245
+66
+69
+242
+57
+63
+240
+50
+60
+246
+52
+63
+246
+50
+64
+241
+45
+59
+237
+45
+58
+237
+50
+61
+236
+55
+62
+230
+53
+59
+228
+54
+56
+229
+55
+56
+235
+57
+57
+240
+58
+57
+241
+55
+56
+239
+55
+55
+242
+59
+61
+238
+60
+60
+234
+58
+58
+230
+56
+55
+225
+56
+53
+223
+55
+52
+220
+55
+53
+220
+55
+53
+222
+57
+55
+225
+57
+56
+227
+57
+57
+230
+58
+58
+233
+57
+59
+236
+57
+60
+237
+57
+60
+239
+56
+60
+244
+55
+59
+243
+54
+58
+240
+56
+58
+237
+57
+58
+231
+59
+57
+224
+59
+53
+215
+57
+48
+207
+55
+44
+202
+56
+43
+200
+57
+41
+199
+57
+43
+198
+58
+41
+199
+58
+41
+199
+58
+40
+200
+59
+42
+199
+60
+41
+193
+57
+35
+196
+61
+39
+190
+58
+35
+182
+52
+30
+188
+57
+37
+201
+68
+51
+206
+64
+54
+201
+49
+44
+255
+95
+101
+255
+87
+103
+255
+75
+98
+252
+61
+92
+245
+51
+88
+242
+50
+89
+247
+56
+99
+240
+69
+105
+228
+91
+111
+171
+71
+81
+110
+52
+51
+78
+51
+44
+67
+63
+54
+65
+66
+60
+66
+54
+56
+66
+43
+49
+77
+46
+51
+77
+49
+46
+67
+56
+38
+68
+74
+40
+88
+110
+61
+125
+155
+95
+155
+186
+119
+167
+198
+130
+171
+203
+140
+159
+190
+130
+152
+182
+128
+148
+178
+126
+130
+160
+110
+102
+132
+82
+88
+118
+66
+89
+123
+63
+93
+128
+62
+99
+135
+65
+105
+143
+68
+110
+148
+73
+109
+149
+76
+108
+148
+78
+107
+146
+79
+108
+145
+78
+105
+142
+73
+102
+138
+68
+99
+134
+66
+99
+134
+66
+102
+137
+73
+104
+139
+75
+102
+138
+76
+100
+136
+74
+103
+139
+77
+104
+140
+78
+103
+139
+75
+102
+139
+72
+101
+138
+69
+102
+139
+69
+106
+143
+73
+107
+147
+74
+113
+155
+81
+113
+157
+82
+114
+158
+83
+42
+48
+34
+41
+47
+35
+41
+46
+39
+41
+46
+40
+45
+47
+44
+49
+51
+48
+53
+54
+49
+55
+56
+50
+59
+60
+52
+62
+63
+55
+65
+68
+61
+72
+74
+71
+79
+80
+84
+83
+85
+97
+88
+89
+107
+90
+92
+117
+92
+90
+127
+94
+93
+137
+100
+98
+148
+107
+106
+164
+117
+116
+186
+127
+126
+206
+135
+135
+223
+139
+140
+233
+141
+141
+239
+140
+140
+240
+137
+137
+235
+133
+132
+226
+128
+128
+216
+128
+126
+210
+128
+127
+207
+130
+130
+204
+133
+134
+199
+134
+135
+199
+135
+136
+201
+137
+136
+204
+139
+136
+207
+140
+134
+206
+141
+134
+204
+142
+133
+200
+138
+128
+188
+137
+127
+177
+134
+124
+161
+130
+120
+147
+123
+115
+130
+116
+107
+112
+108
+98
+96
+100
+93
+83
+99
+96
+79
+98
+96
+75
+101
+94
+75
+102
+94
+75
+105
+92
+73
+108
+93
+72
+110
+94
+71
+113
+93
+69
+121
+93
+71
+130
+89
+67
+149
+88
+70
+173
+90
+76
+199
+86
+80
+221
+83
+83
+243
+82
+88
+254
+89
+95
+240
+85
+83
+227
+76
+69
+217
+62
+57
+213
+54
+48
+217
+54
+47
+220
+57
+48
+219
+57
+44
+214
+57
+40
+211
+56
+38
+209
+56
+38
+209
+56
+40
+212
+56
+41
+215
+55
+41
+220
+54
+42
+223
+52
+44
+221
+53
+44
+206
+48
+39
+201
+53
+41
+200
+57
+43
+198
+61
+45
+196
+65
+47
+193
+64
+45
+191
+60
+42
+190
+57
+40
+196
+56
+41
+203
+60
+46
+228
+82
+69
+220
+72
+60
+200
+52
+40
+204
+58
+45
+200
+58
+44
+194
+52
+38
+202
+61
+44
+203
+60
+43
+202
+59
+42
+202
+59
+42
+203
+58
+41
+204
+57
+41
+206
+56
+41
+207
+54
+40
+211
+55
+42
+214
+56
+44
+217
+55
+44
+215
+51
+41
+213
+49
+39
+216
+49
+40
+222
+55
+46
+231
+60
+53
+248
+68
+71
+241
+56
+62
+237
+47
+57
+239
+47
+58
+240
+48
+61
+238
+46
+59
+235
+49
+60
+235
+54
+63
+228
+53
+58
+220
+51
+54
+216
+50
+50
+223
+58
+56
+238
+69
+66
+248
+73
+70
+248
+68
+67
+243
+63
+62
+233
+58
+55
+231
+57
+56
+229
+57
+55
+226
+57
+54
+225
+56
+53
+224
+56
+53
+225
+57
+56
+225
+57
+56
+224
+56
+55
+226
+56
+56
+229
+57
+57
+231
+57
+58
+233
+57
+59
+236
+57
+60
+237
+57
+60
+238
+55
+59
+243
+54
+58
+242
+53
+57
+238
+54
+56
+234
+56
+56
+228
+59
+56
+220
+58
+53
+211
+57
+47
+203
+55
+43
+198
+56
+42
+195
+58
+42
+194
+58
+42
+192
+59
+42
+192
+59
+42
+193
+60
+41
+193
+60
+43
+193
+60
+41
+189
+57
+36
+193
+63
+41
+187
+58
+37
+179
+53
+31
+185
+58
+39
+192
+60
+47
+201
+58
+50
+215
+61
+61
+255
+95
+103
+255
+81
+100
+253
+67
+91
+246
+57
+87
+242
+57
+91
+242
+61
+96
+240
+64
+100
+224
+74
+101
+170
+64
+76
+131
+63
+62
+95
+58
+50
+72
+58
+47
+59
+61
+48
+59
+61
+50
+73
+59
+58
+85
+61
+61
+81
+47
+46
+84
+55
+47
+87
+75
+53
+100
+104
+69
+119
+143
+91
+140
+176
+112
+154
+195
+125
+159
+199
+129
+152
+186
+125
+154
+185
+128
+154
+182
+131
+141
+169
+120
+114
+142
+94
+89
+117
+69
+84
+112
+61
+92
+123
+66
+95
+127
+64
+98
+134
+64
+105
+141
+67
+109
+147
+72
+108
+148
+75
+107
+147
+76
+105
+144
+77
+105
+144
+77
+103
+140
+71
+101
+137
+67
+99
+134
+66
+99
+134
+68
+103
+138
+74
+105
+140
+76
+104
+140
+78
+103
+139
+77
+105
+141
+79
+105
+141
+77
+105
+142
+75
+103
+140
+71
+103
+140
+70
+102
+142
+69
+108
+146
+73
+109
+149
+76
+112
+156
+81
+111
+157
+82
+114
+158
+83
+45
+49
+34
+45
+49
+35
+44
+47
+38
+44
+46
+41
+47
+47
+45
+49
+49
+47
+51
+52
+47
+52
+53
+45
+57
+59
+48
+60
+62
+49
+64
+66
+55
+69
+72
+65
+75
+77
+76
+81
+82
+87
+85
+85
+97
+86
+87
+105
+92
+89
+116
+94
+93
+127
+102
+100
+140
+112
+110
+160
+122
+120
+183
+133
+131
+206
+141
+139
+223
+144
+144
+234
+144
+142
+239
+142
+140
+237
+138
+137
+231
+135
+132
+223
+129
+127
+211
+127
+124
+203
+127
+125
+200
+128
+127
+195
+134
+134
+196
+136
+136
+196
+138
+138
+198
+140
+139
+199
+140
+138
+201
+140
+136
+197
+140
+132
+191
+139
+130
+183
+137
+128
+175
+134
+124
+161
+128
+118
+145
+123
+112
+129
+117
+106
+114
+110
+100
+99
+105
+94
+88
+99
+93
+81
+93
+98
+76
+93
+98
+75
+97
+95
+74
+103
+92
+74
+109
+90
+73
+112
+91
+72
+114
+92
+71
+114
+92
+69
+122
+96
+73
+123
+87
+63
+137
+82
+61
+164
+85
+68
+199
+88
+79
+224
+86
+83
+245
+80
+84
+252
+79
+83
+226
+62
+60
+222
+60
+55
+221
+56
+52
+222
+55
+49
+225
+54
+47
+225
+54
+46
+221
+55
+43
+218
+55
+40
+212
+55
+38
+211
+56
+36
+211
+56
+38
+213
+56
+39
+216
+54
+41
+221
+53
+42
+224
+51
+44
+221
+53
+44
+203
+51
+40
+196
+54
+40
+194
+57
+41
+193
+60
+43
+194
+63
+45
+194
+63
+45
+193
+60
+43
+192
+56
+40
+195
+53
+39
+220
+74
+61
+218
+70
+58
+213
+65
+53
+206
+60
+47
+196
+54
+40
+196
+59
+43
+190
+54
+38
+198
+58
+41
+199
+58
+41
+199
+58
+41
+201
+58
+42
+202
+56
+41
+203
+55
+41
+204
+54
+40
+205
+51
+39
+213
+57
+45
+213
+55
+44
+214
+51
+42
+215
+51
+42
+218
+51
+43
+223
+54
+47
+229
+58
+51
+233
+60
+56
+240
+60
+61
+237
+52
+57
+235
+48
+55
+236
+49
+56
+238
+51
+60
+237
+52
+60
+235
+55
+64
+234
+61
+67
+221
+55
+59
+225
+65
+65
+236
+78
+75
+248
+89
+85
+253
+90
+85
+250
+81
+76
+239
+66
+62
+229
+56
+52
+226
+54
+50
+224
+55
+50
+224
+55
+50
+224
+55
+50
+225
+56
+53
+226
+57
+54
+228
+59
+56
+228
+59
+56
+225
+55
+55
+228
+56
+56
+230
+56
+58
+232
+56
+59
+235
+56
+60
+235
+56
+60
+235
+56
+60
+236
+56
+59
+239
+53
+56
+238
+52
+55
+236
+53
+55
+231
+55
+55
+226
+58
+55
+217
+58
+52
+207
+56
+47
+199
+55
+44
+194
+56
+43
+191
+58
+43
+189
+59
+43
+187
+60
+43
+187
+60
+43
+187
+60
+41
+187
+60
+43
+187
+60
+41
+184
+57
+38
+189
+64
+42
+179
+57
+36
+177
+54
+36
+182
+59
+43
+180
+49
+39
+194
+52
+48
+235
+80
+84
+255
+92
+105
+254
+75
+96
+243
+59
+85
+237
+57
+86
+238
+65
+93
+236
+73
+102
+227
+75
+100
+202
+79
+97
+130
+56
+57
+102
+62
+54
+85
+63
+50
+71
+64
+48
+59
+60
+44
+56
+54
+41
+65
+52
+43
+78
+55
+47
+72
+43
+35
+83
+60
+44
+103
+93
+66
+129
+136
+95
+146
+171
+116
+149
+188
+123
+148
+194
+122
+149
+192
+123
+146
+180
+120
+156
+184
+133
+154
+180
+133
+128
+154
+109
+92
+117
+75
+72
+98
+53
+78
+104
+56
+91
+120
+66
+95
+125
+63
+99
+131
+64
+104
+140
+68
+108
+146
+71
+106
+146
+73
+104
+146
+74
+103
+144
+76
+102
+143
+75
+100
+137
+68
+100
+135
+67
+99
+134
+68
+101
+136
+70
+104
+139
+75
+107
+142
+78
+107
+143
+79
+106
+142
+78
+105
+144
+79
+105
+144
+79
+105
+144
+77
+104
+144
+74
+103
+143
+72
+104
+146
+72
+108
+148
+75
+111
+153
+77
+115
+161
+86
+115
+163
+87
+117
+163
+88
+50
+52
+38
+48
+52
+38
+48
+49
+41
+48
+49
+43
+49
+50
+45
+50
+51
+46
+51
+52
+46
+52
+54
+43
+57
+59
+45
+59
+62
+45
+63
+65
+51
+68
+70
+57
+73
+74
+68
+77
+79
+78
+82
+81
+87
+83
+83
+93
+88
+86
+100
+92
+90
+111
+100
+97
+126
+110
+108
+148
+122
+119
+172
+132
+130
+195
+140
+137
+214
+145
+143
+227
+148
+145
+234
+147
+144
+235
+142
+139
+226
+137
+133
+217
+130
+127
+204
+127
+124
+195
+127
+124
+191
+128
+126
+189
+132
+131
+189
+134
+133
+190
+137
+136
+193
+141
+138
+193
+139
+136
+189
+137
+133
+183
+135
+127
+174
+133
+125
+166
+133
+123
+157
+128
+118
+143
+121
+110
+127
+114
+102
+112
+109
+97
+99
+107
+93
+90
+105
+90
+83
+99
+91
+78
+92
+97
+75
+90
+98
+74
+97
+95
+74
+103
+92
+74
+111
+89
+75
+115
+89
+74
+117
+90
+73
+119
+91
+70
+118
+86
+65
+123
+81
+59
+139
+81
+61
+171
+88
+70
+205
+91
+80
+226
+84
+80
+237
+71
+73
+239
+63
+65
+219
+50
+47
+220
+53
+47
+225
+53
+49
+227
+54
+48
+227
+53
+46
+225
+53
+43
+224
+54
+41
+219
+56
+41
+214
+55
+36
+211
+56
+36
+209
+56
+38
+212
+57
+39
+216
+54
+41
+220
+54
+42
+224
+51
+44
+218
+54
+45
+200
+54
+41
+189
+56
+39
+188
+55
+38
+189
+58
+40
+191
+62
+43
+194
+63
+45
+195
+59
+43
+196
+56
+41
+198
+52
+39
+233
+85
+73
+211
+60
+49
+204
+56
+44
+209
+66
+52
+190
+53
+37
+192
+61
+43
+192
+61
+43
+192
+56
+40
+196
+56
+39
+197
+57
+40
+199
+58
+41
+200
+57
+41
+203
+55
+41
+204
+54
+40
+205
+51
+39
+210
+54
+42
+212
+51
+41
+213
+50
+41
+219
+52
+44
+227
+58
+51
+233
+62
+55
+236
+63
+57
+236
+61
+58
+232
+52
+53
+236
+53
+57
+239
+54
+59
+238
+53
+59
+234
+50
+58
+230
+51
+57
+228
+55
+61
+226
+60
+64
+243
+85
+86
+252
+98
+98
+255
+109
+106
+255
+105
+100
+243
+86
+81
+228
+65
+60
+223
+54
+51
+221
+52
+47
+223
+54
+49
+222
+55
+49
+222
+55
+49
+223
+56
+50
+225
+56
+53
+226
+57
+54
+229
+57
+55
+230
+58
+56
+229
+55
+56
+230
+56
+57
+232
+56
+59
+233
+57
+60
+235
+56
+60
+235
+56
+60
+235
+56
+60
+236
+55
+60
+238
+53
+58
+238
+54
+56
+234
+54
+55
+229
+57
+55
+223
+60
+55
+214
+60
+52
+204
+57
+47
+197
+57
+44
+190
+57
+42
+186
+59
+42
+182
+59
+41
+181
+60
+41
+181
+60
+43
+180
+61
+41
+179
+59
+42
+179
+60
+40
+179
+58
+39
+183
+64
+44
+173
+56
+38
+173
+56
+39
+179
+59
+45
+171
+43
+34
+193
+53
+52
+252
+97
+103
+253
+85
+100
+249
+72
+92
+238
+62
+85
+232
+62
+88
+229
+73
+95
+220
+81
+100
+206
+81
+95
+177
+85
+90
+119
+70
+65
+92
+70
+57
+79
+66
+50
+74
+67
+49
+70
+67
+48
+64
+61
+42
+61
+54
+35
+61
+50
+30
+65
+50
+29
+81
+70
+42
+110
+107
+72
+138
+147
+102
+149
+172
+116
+145
+180
+116
+141
+184
+115
+144
+186
+120
+157
+187
+133
+161
+184
+138
+144
+167
+125
+108
+130
+91
+75
+95
+58
+65
+87
+48
+76
+99
+55
+87
+114
+63
+95
+123
+64
+100
+131
+64
+105
+138
+67
+107
+145
+70
+105
+145
+72
+103
+145
+71
+100
+143
+72
+101
+142
+74
+98
+135
+66
+99
+134
+66
+100
+135
+69
+103
+138
+72
+106
+141
+77
+108
+143
+79
+109
+145
+81
+110
+146
+82
+106
+145
+80
+106
+145
+78
+106
+146
+76
+104
+146
+74
+103
+145
+71
+105
+147
+71
+109
+151
+75
+112
+156
+79
+119
+166
+88
+118
+166
+90
+118
+166
+90
+55
+56
+40
+54
+56
+42
+54
+54
+44
+53
+54
+46
+53
+54
+48
+53
+54
+48
+54
+55
+47
+54
+56
+43
+59
+62
+45
+61
+64
+45
+64
+67
+46
+68
+71
+52
+73
+75
+62
+77
+78
+70
+81
+80
+78
+82
+82
+82
+86
+85
+83
+89
+88
+93
+97
+95
+108
+107
+105
+129
+117
+115
+155
+128
+125
+178
+136
+134
+199
+140
+138
+211
+149
+146
+225
+148
+145
+226
+144
+141
+220
+139
+135
+211
+132
+129
+196
+129
+125
+186
+127
+124
+181
+127
+124
+179
+129
+126
+181
+132
+129
+182
+135
+133
+183
+137
+134
+181
+138
+132
+176
+134
+128
+166
+129
+122
+155
+128
+119
+146
+127
+115
+135
+122
+110
+124
+114
+101
+108
+109
+95
+95
+106
+91
+88
+105
+90
+83
+106
+89
+79
+102
+90
+76
+97
+96
+76
+95
+97
+76
+100
+95
+76
+105
+92
+75
+110
+91
+76
+116
+90
+75
+122
+90
+75
+125
+90
+71
+127
+84
+65
+136
+81
+61
+157
+81
+65
+182
+86
+70
+205
+83
+72
+216
+72
+64
+223
+58
+56
+226
+52
+51
+221
+49
+45
+223
+51
+47
+226
+53
+47
+227
+53
+46
+225
+51
+44
+223
+51
+41
+221
+53
+40
+220
+57
+40
+211
+56
+36
+208
+57
+36
+207
+58
+38
+209
+58
+39
+212
+56
+41
+217
+55
+42
+221
+53
+44
+216
+55
+45
+196
+59
+43
+185
+58
+41
+181
+54
+37
+183
+56
+39
+189
+59
+43
+194
+61
+46
+199
+59
+46
+199
+55
+44
+208
+57
+48
+245
+92
+84
+214
+61
+53
+201
+53
+43
+207
+65
+53
+184
+51
+36
+183
+58
+40
+188
+63
+43
+191
+58
+41
+195
+58
+42
+198
+58
+43
+200
+58
+44
+202
+59
+45
+204
+58
+45
+207
+56
+45
+209
+55
+45
+208
+51
+42
+210
+49
+41
+214
+49
+43
+222
+55
+49
+229
+60
+55
+234
+62
+58
+232
+59
+55
+230
+55
+52
+233
+55
+53
+239
+59
+60
+240
+60
+63
+234
+54
+57
+228
+49
+53
+228
+53
+58
+232
+66
+70
+237
+77
+79
+255
+120
+119
+255
+113
+110
+241
+96
+91
+221
+74
+67
+209
+56
+51
+209
+50
+46
+220
+55
+51
+231
+64
+58
+224
+57
+51
+224
+57
+49
+224
+55
+50
+224
+55
+50
+226
+54
+50
+227
+55
+51
+229
+55
+54
+229
+55
+54
+230
+54
+56
+231
+55
+57
+234
+55
+59
+235
+56
+60
+235
+56
+62
+235
+56
+62
+232
+55
+61
+234
+55
+59
+238
+55
+59
+238
+55
+57
+234
+55
+58
+228
+58
+58
+223
+61
+58
+214
+61
+55
+203
+59
+50
+195
+59
+47
+186
+56
+42
+181
+58
+42
+179
+59
+42
+175
+60
+41
+175
+60
+42
+172
+60
+40
+172
+59
+41
+172
+59
+41
+170
+59
+40
+172
+61
+42
+166
+56
+39
+167
+57
+42
+170
+56
+45
+171
+48
+41
+203
+64
+67
+255
+105
+114
+243
+78
+94
+241
+72
+91
+235
+69
+89
+226
+73
+91
+215
+80
+94
+199
+85
+93
+178
+86
+87
+153
+90
+85
+103
+75
+63
+83
+74
+57
+80
+68
+52
+78
+67
+49
+73
+67
+45
+66
+64
+39
+63
+66
+35
+65
+71
+35
+77
+85
+46
+94
+103
+60
+120
+129
+84
+139
+153
+102
+145
+164
+109
+141
+169
+110
+143
+178
+114
+151
+185
+125
+157
+183
+136
+146
+167
+128
+117
+134
+100
+82
+99
+67
+63
+80
+48
+66
+83
+49
+79
+97
+57
+86
+108
+61
+98
+123
+66
+101
+130
+66
+105
+138
+67
+106
+144
+69
+105
+146
+70
+101
+145
+70
+98
+144
+72
+99
+142
+71
+98
+135
+66
+102
+134
+67
+103
+138
+72
+105
+140
+74
+107
+142
+78
+109
+144
+80
+110
+146
+82
+111
+147
+83
+106
+145
+78
+107
+146
+79
+106
+147
+77
+105
+147
+75
+105
+147
+73
+106
+150
+73
+110
+154
+75
+114
+158
+79
+120
+167
+89
+118
+167
+88
+118
+167
+88
+63
+61
+46
+61
+62
+46
+61
+61
+49
+61
+61
+51
+61
+61
+53
+59
+60
+52
+59
+61
+50
+59
+61
+47
+63
+66
+47
+64
+68
+45
+67
+71
+46
+70
+74
+51
+75
+76
+58
+78
+79
+65
+81
+81
+73
+82
+82
+72
+89
+87
+74
+90
+90
+78
+95
+94
+92
+103
+101
+114
+113
+110
+137
+123
+121
+161
+131
+128
+183
+135
+133
+196
+143
+140
+209
+143
+140
+211
+141
+138
+207
+138
+133
+199
+131
+127
+186
+126
+121
+175
+122
+119
+166
+121
+118
+165
+123
+119
+169
+124
+122
+171
+128
+125
+170
+131
+126
+166
+131
+125
+161
+127
+121
+149
+124
+116
+137
+122
+114
+129
+118
+107
+115
+114
+102
+104
+109
+95
+94
+106
+91
+86
+107
+90
+82
+108
+90
+80
+108
+90
+78
+107
+91
+78
+103
+94
+77
+102
+95
+77
+103
+94
+77
+106
+93
+77
+110
+93
+77
+118
+92
+77
+124
+92
+77
+131
+89
+73
+150
+94
+79
+157
+85
+71
+169
+77
+64
+185
+73
+61
+197
+64
+55
+204
+56
+46
+213
+50
+43
+221
+50
+43
+225
+53
+49
+225
+54
+47
+226
+53
+46
+226
+52
+45
+224
+50
+41
+222
+52
+39
+220
+54
+38
+218
+59
+40
+209
+57
+36
+205
+59
+36
+204
+59
+38
+206
+59
+39
+209
+58
+41
+213
+57
+42
+217
+55
+44
+211
+57
+45
+193
+62
+44
+180
+59
+40
+176
+53
+35
+178
+53
+35
+187
+57
+41
+196
+60
+46
+201
+59
+47
+203
+55
+45
+217
+63
+55
+248
+91
+84
+227
+73
+65
+206
+58
+48
+204
+64
+51
+184
+54
+38
+172
+51
+32
+181
+60
+41
+188
+57
+39
+191
+55
+39
+192
+55
+39
+195
+55
+40
+197
+55
+41
+201
+55
+42
+206
+55
+44
+209
+55
+45
+217
+60
+51
+219
+58
+50
+222
+57
+51
+229
+60
+55
+234
+62
+58
+234
+61
+57
+231
+56
+53
+227
+52
+49
+232
+57
+54
+235
+60
+57
+236
+58
+58
+232
+56
+58
+236
+62
+64
+248
+80
+80
+255
+98
+99
+255
+112
+112
+249
+104
+101
+226
+84
+80
+202
+61
+54
+192
+49
+43
+201
+52
+48
+214
+59
+55
+223
+61
+58
+224
+59
+55
+226
+59
+53
+225
+58
+50
+226
+57
+52
+225
+56
+51
+227
+55
+51
+228
+55
+51
+229
+53
+53
+230
+54
+54
+233
+54
+57
+233
+54
+57
+234
+55
+59
+235
+56
+60
+235
+56
+62
+234
+55
+61
+232
+55
+61
+233
+54
+58
+239
+56
+60
+236
+56
+57
+232
+56
+58
+227
+59
+58
+221
+62
+58
+211
+62
+55
+201
+60
+50
+192
+60
+47
+182
+56
+41
+178
+58
+41
+174
+59
+41
+170
+59
+40
+169
+60
+40
+168
+59
+39
+165
+58
+38
+165
+58
+40
+165
+60
+41
+160
+57
+40
+160
+59
+41
+160
+57
+42
+162
+54
+42
+181
+62
+56
+219
+84
+88
+249
+102
+112
+237
+76
+92
+237
+74
+93
+231
+76
+92
+216
+78
+91
+198
+83
+90
+177
+87
+86
+156
+92
+82
+136
+97
+82
+84
+71
+55
+77
+74
+57
+83
+70
+53
+77
+62
+43
+63
+51
+27
+57
+54
+23
+65
+77
+37
+78
+102
+54
+108
+138
+84
+119
+148
+92
+132
+155
+101
+137
+154
+100
+141
+155
+102
+144
+163
+107
+148
+173
+116
+152
+176
+124
+131
+149
+109
+110
+125
+92
+81
+96
+67
+60
+74
+48
+57
+70
+44
+65
+80
+49
+79
+95
+59
+87
+106
+61
+99
+122
+68
+101
+130
+66
+106
+139
+68
+107
+145
+70
+105
+146
+70
+101
+145
+70
+97
+143
+70
+99
+142
+71
+99
+136
+67
+105
+137
+70
+106
+141
+75
+108
+143
+77
+108
+143
+79
+108
+143
+79
+109
+145
+81
+110
+146
+82
+109
+148
+81
+109
+149
+79
+109
+150
+80
+108
+150
+76
+107
+151
+74
+109
+153
+74
+114
+159
+78
+115
+162
+81
+124
+173
+94
+123
+172
+93
+122
+171
+92
+68
+65
+48
+68
+66
+51
+68
+66
+54
+67
+67
+57
+67
+67
+59
+67
+67
+59
+66
+66
+54
+66
+67
+51
+68
+70
+48
+69
+72
+45
+71
+74
+45
+74
+77
+50
+79
+78
+57
+82
+81
+63
+84
+82
+69
+85
+83
+68
+92
+90
+67
+92
+92
+68
+92
+93
+79
+97
+97
+97
+105
+104
+120
+114
+113
+144
+123
+122
+166
+129
+126
+181
+134
+130
+191
+136
+131
+195
+136
+132
+193
+132
+129
+186
+127
+123
+174
+121
+115
+161
+116
+111
+151
+111
+109
+148
+112
+109
+154
+114
+111
+158
+118
+113
+154
+119
+115
+150
+119
+115
+142
+116
+111
+131
+115
+107
+120
+114
+105
+110
+109
+97
+97
+108
+95
+89
+106
+92
+83
+107
+90
+80
+109
+91
+79
+111
+91
+80
+111
+92
+78
+111
+92
+78
+110
+92
+78
+109
+93
+78
+107
+94
+78
+108
+95
+79
+111
+95
+79
+117
+96
+79
+125
+93
+78
+137
+89
+77
+161
+95
+83
+167
+79
+69
+174
+66
+56
+186
+59
+50
+197
+55
+45
+204
+50
+40
+212
+51
+41
+220
+53
+44
+224
+55
+48
+225
+54
+47
+225
+52
+45
+224
+51
+44
+224
+52
+42
+221
+53
+40
+216
+55
+37
+212
+57
+37
+207
+58
+34
+202
+61
+34
+201
+61
+36
+202
+62
+39
+205
+60
+41
+210
+59
+42
+213
+57
+44
+207
+59
+45
+191
+64
+45
+177
+60
+40
+172
+53
+33
+174
+51
+33
+186
+56
+40
+196
+60
+46
+202
+58
+47
+206
+53
+45
+216
+57
+51
+240
+78
+73
+241
+84
+77
+217
+66
+57
+204
+66
+53
+190
+63
+46
+166
+49
+29
+179
+60
+40
+190
+60
+44
+193
+57
+43
+193
+55
+42
+194
+54
+41
+197
+55
+43
+201
+57
+46
+207
+59
+49
+212
+59
+51
+225
+68
+61
+227
+65
+60
+228
+63
+59
+231
+62
+59
+233
+61
+59
+233
+59
+58
+232
+56
+56
+231
+56
+53
+231
+56
+53
+230
+57
+53
+230
+55
+52
+233
+59
+58
+244
+74
+74
+255
+92
+91
+255
+100
+99
+248
+99
+95
+204
+61
+57
+193
+56
+50
+189
+52
+46
+195
+56
+49
+213
+65
+61
+222
+69
+64
+223
+61
+59
+217
+52
+50
+226
+59
+53
+226
+59
+51
+226
+57
+52
+226
+57
+52
+228
+56
+52
+229
+56
+52
+231
+55
+55
+233
+55
+55
+234
+54
+57
+235
+55
+58
+235
+54
+59
+235
+56
+60
+235
+56
+62
+232
+55
+61
+232
+55
+61
+233
+54
+58
+235
+55
+58
+233
+54
+57
+230
+56
+57
+224
+59
+57
+219
+62
+57
+209
+62
+54
+198
+60
+49
+190
+60
+46
+179
+56
+41
+174
+59
+41
+170
+59
+40
+166
+59
+39
+164
+59
+40
+163
+58
+39
+163
+58
+39
+160
+57
+38
+161
+62
+43
+150
+55
+37
+156
+61
+43
+154
+57
+41
+154
+50
+39
+195
+80
+75
+237
+107
+109
+237
+93
+102
+235
+80
+94
+232
+75
+92
+220
+74
+87
+202
+77
+83
+182
+84
+83
+161
+93
+82
+142
+101
+81
+127
+106
+85
+78
+75
+56
+75
+72
+55
+80
+63
+47
+76
+55
+36
+69
+53
+27
+71
+71
+35
+87
+111
+61
+105
+146
+86
+127
+178
+111
+130
+179
+113
+131
+165
+104
+125
+146
+89
+131
+141
+89
+142
+150
+99
+137
+151
+100
+124
+140
+95
+88
+102
+67
+71
+84
+56
+57
+69
+45
+54
+66
+42
+58
+68
+44
+61
+74
+48
+74
+88
+55
+87
+104
+62
+101
+124
+70
+104
+130
+67
+108
+139
+69
+108
+144
+70
+105
+147
+71
+99
+145
+70
+97
+145
+71
+97
+143
+71
+102
+139
+70
+108
+140
+73
+109
+144
+78
+110
+145
+79
+108
+143
+79
+107
+142
+78
+107
+143
+79
+109
+145
+81
+112
+151
+84
+113
+153
+83
+112
+153
+83
+112
+154
+80
+111
+155
+78
+113
+157
+78
+116
+163
+82
+119
+166
+85
+126
+175
+96
+123
+174
+95
+121
+172
+93
+73
+67
+51
+74
+68
+54
+73
+69
+57
+73
+69
+58
+73
+71
+59
+73
+71
+59
+72
+70
+57
+72
+71
+53
+73
+72
+51
+74
+74
+50
+76
+76
+50
+78
+78
+52
+82
+80
+59
+84
+81
+62
+88
+82
+68
+89
+84
+65
+93
+89
+62
+91
+90
+62
+92
+89
+72
+94
+91
+84
+100
+97
+104
+110
+107
+126
+120
+115
+147
+125
+120
+160
+129
+123
+167
+131
+125
+171
+133
+127
+173
+131
+124
+166
+125
+119
+157
+117
+110
+143
+111
+105
+133
+107
+103
+130
+105
+102
+133
+106
+103
+134
+109
+104
+134
+109
+105
+128
+109
+105
+120
+108
+103
+110
+107
+98
+101
+106
+96
+94
+103
+93
+84
+104
+92
+80
+104
+90
+77
+107
+91
+76
+110
+93
+77
+113
+94
+79
+113
+94
+79
+112
+93
+78
+112
+93
+79
+111
+93
+79
+112
+93
+78
+115
+93
+79
+119
+93
+78
+126
+93
+78
+137
+91
+76
+147
+87
+76
+162
+84
+72
+166
+69
+60
+171
+57
+47
+186
+55
+45
+200
+56
+47
+211
+54
+45
+217
+54
+45
+221
+54
+45
+223
+54
+47
+223
+52
+45
+223
+52
+44
+223
+52
+44
+223
+55
+44
+221
+55
+41
+216
+54
+39
+209
+54
+36
+207
+58
+36
+204
+60
+36
+202
+60
+38
+203
+61
+39
+206
+59
+41
+209
+59
+42
+211
+58
+44
+206
+60
+45
+190
+65
+47
+175
+60
+39
+168
+51
+33
+172
+51
+32
+182
+57
+39
+193
+61
+46
+201
+59
+47
+204
+56
+46
+204
+50
+42
+224
+65
+59
+248
+91
+84
+224
+73
+64
+208
+68
+55
+202
+70
+55
+171
+50
+31
+184
+63
+44
+202
+70
+55
+204
+66
+53
+202
+64
+51
+203
+63
+50
+205
+63
+51
+210
+66
+55
+220
+69
+60
+225
+71
+63
+226
+64
+59
+226
+61
+57
+227
+58
+55
+226
+54
+52
+226
+54
+52
+227
+55
+53
+229
+57
+55
+229
+60
+57
+228
+63
+57
+224
+61
+54
+221
+58
+53
+225
+63
+58
+234
+77
+72
+234
+81
+76
+211
+64
+57
+184
+41
+35
+184
+45
+38
+190
+53
+45
+201
+62
+55
+208
+65
+59
+214
+62
+57
+217
+59
+56
+225
+59
+59
+231
+61
+61
+226
+57
+54
+226
+57
+54
+226
+57
+54
+228
+56
+54
+229
+57
+53
+231
+58
+54
+233
+57
+57
+234
+58
+58
+234
+56
+56
+234
+56
+56
+235
+56
+59
+235
+56
+59
+233
+57
+60
+232
+56
+59
+231
+55
+58
+231
+55
+58
+233
+54
+58
+230
+54
+56
+226
+56
+56
+222
+58
+56
+214
+61
+56
+204
+61
+53
+194
+60
+49
+185
+59
+45
+174
+57
+40
+170
+59
+42
+166
+59
+41
+162
+59
+40
+160
+59
+39
+158
+59
+38
+159
+58
+40
+155
+58
+39
+152
+63
+45
+140
+53
+34
+153
+61
+46
+152
+56
+42
+151
+47
+38
+205
+92
+88
+246
+122
+124
+222
+88
+95
+229
+89
+100
+217
+81
+91
+200
+77
+82
+183
+77
+79
+167
+87
+80
+155
+97
+85
+141
+104
+85
+128
+110
+86
+84
+84
+56
+67
+72
+42
+66
+57
+28
+72
+59
+27
+88
+80
+43
+110
+116
+68
+132
+162
+102
+148
+193
+126
+135
+188
+118
+134
+184
+115
+124
+158
+97
+110
+130
+77
+117
+126
+81
+130
+135
+94
+117
+125
+86
+91
+98
+64
+59
+68
+41
+52
+60
+37
+53
+61
+40
+61
+68
+50
+60
+69
+50
+57
+67
+43
+67
+80
+50
+85
+101
+62
+103
+123
+72
+105
+131
+70
+108
+139
+71
+109
+145
+71
+106
+147
+71
+102
+146
+71
+98
+144
+71
+99
+142
+71
+104
+141
+74
+108
+143
+77
+111
+146
+80
+110
+147
+80
+108
+143
+77
+105
+142
+75
+106
+143
+74
+106
+146
+76
+115
+155
+84
+115
+157
+85
+115
+157
+83
+114
+158
+81
+114
+158
+79
+115
+162
+82
+119
+166
+85
+122
+171
+90
+119
+167
+91
+117
+165
+91
+116
+164
+90
+82
+75
+59
+82
+75
+59
+82
+74
+61
+82
+74
+61
+82
+74
+61
+82
+74
+61
+82
+74
+61
+82
+75
+59
+85
+78
+60
+86
+79
+61
+87
+80
+62
+88
+81
+63
+89
+82
+64
+91
+84
+68
+92
+85
+69
+92
+85
+69
+98
+91
+72
+97
+90
+72
+97
+89
+76
+98
+89
+82
+101
+93
+91
+107
+97
+105
+113
+102
+116
+117
+106
+123
+122
+110
+132
+124
+112
+136
+127
+115
+139
+127
+115
+137
+124
+112
+132
+117
+106
+123
+109
+98
+114
+101
+93
+106
+99
+96
+105
+96
+95
+101
+95
+93
+98
+95
+90
+94
+94
+90
+89
+94
+89
+85
+97
+90
+82
+98
+90
+79
+101
+91
+79
+103
+91
+75
+105
+92
+75
+107
+92
+73
+107
+92
+71
+109
+92
+72
+109
+93
+70
+106
+94
+72
+106
+98
+79
+114
+101
+84
+113
+90
+74
+117
+79
+66
+139
+87
+74
+156
+92
+80
+162
+90
+76
+170
+91
+76
+164
+78
+61
+165
+70
+52
+166
+60
+44
+176
+56
+40
+194
+56
+45
+210
+56
+48
+221
+52
+49
+222
+49
+45
+223
+54
+47
+222
+55
+46
+222
+55
+46
+222
+55
+46
+222
+55
+46
+219
+55
+43
+216
+54
+41
+215
+55
+41
+213
+56
+41
+212
+56
+41
+210
+57
+41
+210
+57
+41
+210
+57
+43
+210
+57
+43
+212
+56
+43
+205
+59
+44
+189
+59
+43
+182
+62
+45
+174
+57
+40
+169
+49
+32
+171
+50
+33
+183
+57
+42
+192
+60
+47
+195
+57
+46
+200
+53
+43
+206
+53
+45
+212
+58
+48
+219
+67
+56
+221
+75
+62
+212
+72
+57
+194
+61
+44
+183
+50
+35
+221
+80
+70
+216
+74
+64
+212
+70
+60
+211
+69
+59
+215
+73
+63
+219
+72
+64
+221
+68
+62
+223
+61
+58
+223
+55
+52
+230
+56
+55
+234
+58
+58
+234
+58
+58
+229
+57
+55
+224
+55
+52
+222
+57
+51
+220
+61
+55
+220
+69
+62
+209
+65
+57
+199
+57
+47
+191
+50
+40
+185
+48
+38
+186
+52
+41
+191
+59
+47
+195
+63
+51
+195
+58
+48
+199
+61
+51
+208
+64
+55
+217
+64
+58
+224
+62
+59
+229
+60
+57
+233
+57
+57
+236
+58
+58
+230
+56
+58
+229
+56
+58
+229
+56
+58
+229
+57
+57
+229
+57
+55
+229
+57
+55
+229
+57
+53
+229
+57
+53
+224
+52
+48
+225
+53
+49
+228
+54
+53
+229
+55
+54
+230
+56
+57
+231
+57
+58
+231
+57
+58
+231
+57
+59
+235
+59
+62
+230
+57
+59
+223
+57
+57
+220
+61
+58
+214
+65
+61
+205
+66
+59
+193
+65
+54
+183
+63
+49
+169
+58
+41
+163
+60
+43
+160
+61
+42
+155
+60
+40
+153
+58
+38
+150
+58
+37
+151
+56
+38
+145
+56
+38
+144
+65
+48
+139
+60
+45
+135
+47
+35
+145
+47
+38
+188
+76
+74
+228
+109
+111
+229
+109
+111
+205
+86
+90
+189
+76
+78
+181
+78
+79
+170
+81
+77
+162
+85
+79
+155
+88
+79
+150
+93
+82
+149
+97
+84
+138
+106
+83
+88
+89
+47
+61
+75
+22
+56
+69
+15
+86
+97
+41
+127
+141
+80
+155
+176
+111
+161
+188
+121
+156
+189
+120
+146
+181
+115
+126
+157
+97
+104
+128
+76
+92
+109
+67
+89
+100
+66
+84
+93
+66
+72
+80
+57
+63
+68
+48
+58
+61
+44
+64
+67
+50
+60
+64
+49
+58
+62
+48
+60
+67
+51
+58
+67
+48
+65
+78
+50
+82
+100
+62
+93
+115
+66
+103
+131
+72
+112
+143
+75
+111
+147
+75
+108
+146
+71
+106
+146
+73
+105
+147
+75
+103
+144
+74
+108
+144
+80
+109
+145
+83
+111
+147
+83
+108
+147
+80
+109
+146
+77
+107
+147
+74
+109
+150
+74
+109
+152
+73
+113
+156
+76
+113
+158
+77
+114
+159
+78
+114
+161
+80
+116
+163
+82
+118
+167
+85
+121
+170
+89
+122
+170
+94
+123
+168
+101
+111
+155
+92
+101
+145
+82
+87
+78
+63
+87
+78
+63
+87
+78
+63
+87
+78
+63
+87
+78
+63
+87
+78
+63
+87
+78
+63
+87
+78
+63
+88
+79
+64
+89
+80
+65
+89
+80
+65
+91
+82
+67
+92
+83
+68
+93
+84
+69
+94
+85
+70
+95
+86
+71
+100
+91
+74
+99
+90
+73
+99
+89
+77
+99
+89
+79
+102
+91
+85
+106
+95
+93
+110
+98
+100
+112
+100
+104
+114
+101
+108
+116
+103
+112
+118
+105
+114
+118
+105
+114
+115
+102
+109
+109
+96
+103
+103
+91
+95
+98
+88
+89
+94
+91
+86
+90
+90
+82
+89
+86
+79
+87
+84
+75
+88
+84
+73
+88
+84
+72
+92
+86
+72
+94
+87
+71
+99
+90
+75
+99
+90
+73
+102
+91
+73
+103
+92
+72
+105
+93
+71
+106
+94
+70
+107
+95
+71
+106
+95
+73
+102
+97
+77
+111
+103
+84
+119
+91
+77
+129
+83
+70
+153
+86
+77
+168
+88
+79
+175
+82
+74
+180
+82
+69
+173
+73
+57
+170
+67
+48
+171
+61
+44
+177
+57
+41
+190
+56
+44
+204
+55
+48
+216
+52
+50
+220
+51
+48
+221
+54
+46
+220
+56
+46
+220
+56
+46
+220
+56
+46
+219
+55
+45
+218
+56
+45
+217
+55
+44
+215
+55
+43
+215
+55
+43
+213
+55
+43
+213
+55
+43
+213
+55
+43
+212
+56
+43
+212
+56
+43
+212
+56
+43
+206
+58
+44
+190
+60
+46
+182
+62
+46
+174
+57
+40
+166
+49
+32
+167
+50
+32
+178
+58
+41
+185
+62
+46
+190
+60
+46
+198
+58
+45
+199
+52
+42
+203
+52
+41
+210
+59
+48
+220
+69
+58
+225
+79
+66
+223
+81
+67
+221
+79
+67
+219
+70
+63
+214
+65
+59
+209
+60
+53
+208
+59
+52
+211
+62
+55
+215
+62
+56
+217
+58
+54
+218
+53
+51
+230
+56
+55
+234
+56
+56
+236
+56
+57
+234
+56
+56
+230
+56
+55
+226
+58
+55
+225
+62
+57
+219
+66
+58
+205
+64
+55
+194
+61
+52
+187
+57
+44
+180
+52
+39
+178
+52
+38
+181
+55
+41
+186
+60
+45
+191
+64
+49
+198
+64
+52
+205
+64
+54
+213
+65
+55
+220
+63
+56
+226
+58
+55
+230
+56
+55
+235
+55
+54
+239
+56
+58
+233
+54
+58
+231
+54
+60
+231
+55
+58
+230
+56
+57
+230
+56
+55
+229
+57
+53
+229
+57
+53
+227
+58
+53
+226
+57
+50
+227
+58
+51
+227
+58
+53
+228
+59
+54
+228
+59
+56
+228
+59
+56
+229
+57
+57
+229
+57
+57
+228
+58
+59
+227
+59
+59
+223
+60
+61
+217
+63
+61
+208
+65
+59
+196
+63
+54
+183
+61
+50
+172
+59
+45
+165
+59
+43
+160
+61
+42
+156
+61
+43
+151
+60
+41
+150
+59
+40
+146
+58
+38
+147
+56
+37
+140
+58
+37
+128
+57
+39
+128
+56
+41
+137
+53
+42
+157
+60
+53
+191
+81
+80
+215
+101
+101
+209
+94
+97
+183
+77
+77
+172
+78
+76
+164
+84
+77
+157
+89
+80
+152
+92
+81
+151
+94
+83
+151
+94
+83
+152
+95
+86
+140
+102
+81
+96
+95
+47
+83
+103
+42
+94
+114
+51
+122
+144
+79
+153
+175
+110
+165
+190
+124
+153
+178
+112
+136
+160
+98
+106
+130
+72
+97
+117
+66
+84
+101
+59
+74
+88
+55
+70
+80
+55
+63
+72
+53
+57
+63
+49
+53
+56
+45
+58
+60
+47
+65
+66
+52
+61
+63
+52
+58
+61
+50
+61
+65
+51
+58
+67
+48
+64
+77
+51
+82
+100
+62
+94
+116
+69
+103
+131
+72
+113
+144
+77
+112
+148
+76
+110
+146
+72
+107
+148
+72
+107
+147
+76
+104
+145
+75
+109
+145
+81
+110
+146
+84
+109
+148
+83
+109
+148
+81
+107
+147
+76
+107
+148
+72
+108
+151
+72
+109
+152
+72
+112
+157
+74
+112
+157
+74
+112
+160
+76
+115
+162
+81
+117
+166
+84
+120
+169
+88
+120
+169
+88
+120
+168
+94
+110
+152
+89
+100
+141
+83
+90
+131
+73
+93
+84
+69
+93
+84
+69
+93
+84
+69
+93
+84
+69
+93
+84
+69
+93
+84
+69
+93
+84
+69
+93
+84
+69
+91
+82
+67
+92
+83
+68
+93
+84
+69
+94
+85
+70
+95
+86
+71
+96
+87
+72
+97
+88
+73
+97
+88
+71
+101
+93
+74
+101
+93
+72
+100
+91
+74
+100
+91
+76
+101
+91
+81
+102
+91
+85
+104
+93
+89
+104
+93
+91
+105
+93
+93
+106
+94
+94
+107
+95
+95
+107
+95
+95
+105
+94
+92
+102
+91
+89
+98
+87
+83
+95
+86
+81
+90
+86
+77
+87
+84
+75
+85
+81
+72
+82
+78
+67
+81
+77
+66
+83
+79
+67
+87
+81
+67
+88
+82
+66
+94
+87
+71
+94
+87
+69
+97
+89
+70
+99
+91
+70
+103
+92
+72
+105
+94
+72
+107
+96
+74
+105
+97
+76
+101
+96
+77
+113
+101
+85
+123
+94
+80
+136
+88
+78
+162
+91
+85
+175
+88
+81
+177
+74
+69
+182
+71
+64
+182
+65
+55
+183
+63
+49
+182
+60
+47
+184
+56
+43
+189
+55
+43
+197
+57
+44
+204
+57
+47
+211
+57
+47
+217
+56
+46
+219
+55
+45
+219
+55
+45
+219
+57
+46
+218
+56
+45
+217
+55
+44
+217
+55
+44
+215
+55
+43
+215
+55
+43
+213
+55
+43
+213
+55
+43
+212
+56
+43
+212
+56
+43
+212
+56
+43
+210
+57
+43
+205
+59
+44
+192
+62
+48
+182
+62
+46
+173
+58
+40
+163
+50
+32
+163
+51
+31
+170
+58
+38
+179
+62
+44
+185
+62
+46
+196
+63
+48
+196
+56
+43
+197
+50
+40
+200
+52
+42
+208
+60
+48
+216
+70
+57
+220
+77
+63
+225
+78
+68
+216
+59
+54
+215
+53
+51
+210
+51
+48
+211
+53
+50
+216
+58
+55
+222
+63
+60
+227
+62
+60
+232
+60
+60
+236
+57
+60
+237
+54
+58
+234
+51
+55
+231
+51
+54
+230
+54
+56
+227
+57
+57
+224
+60
+58
+217
+64
+58
+193
+55
+45
+184
+56
+43
+179
+53
+39
+175
+52
+37
+175
+52
+37
+178
+55
+40
+182
+59
+43
+187
+61
+46
+200
+68
+53
+205
+67
+54
+213
+66
+56
+217
+63
+55
+223
+58
+52
+229
+56
+52
+234
+54
+53
+238
+55
+57
+234
+54
+57
+233
+54
+57
+233
+54
+57
+231
+55
+55
+231
+55
+55
+230
+57
+53
+229
+57
+53
+229
+58
+51
+227
+58
+51
+228
+59
+52
+228
+59
+54
+227
+60
+54
+227
+59
+56
+226
+58
+57
+225
+57
+57
+222
+56
+56
+221
+57
+58
+220
+60
+60
+218
+64
+62
+211
+66
+61
+200
+63
+57
+185
+58
+49
+173
+55
+43
+165
+55
+40
+161
+59
+44
+157
+60
+43
+153
+60
+43
+148
+59
+41
+147
+58
+40
+144
+57
+38
+144
+55
+37
+138
+57
+38
+122
+54
+35
+121
+54
+37
+136
+57
+44
+160
+70
+61
+185
+83
+79
+192
+87
+84
+184
+80
+79
+171
+73
+70
+162
+77
+72
+156
+83
+76
+153
+89
+80
+151
+94
+83
+151
+97
+87
+151
+97
+87
+152
+95
+86
+139
+101
+80
+115
+114
+70
+122
+141
+86
+147
+166
+110
+164
+185
+128
+171
+192
+135
+158
+179
+123
+124
+144
+91
+91
+111
+60
+63
+82
+36
+65
+83
+43
+65
+80
+47
+63
+76
+50
+58
+67
+48
+54
+60
+46
+54
+57
+48
+53
+56
+47
+57
+59
+46
+64
+65
+51
+61
+63
+52
+57
+60
+49
+61
+65
+51
+57
+66
+47
+64
+77
+51
+81
+99
+61
+96
+118
+71
+105
+133
+74
+115
+146
+79
+114
+150
+78
+112
+148
+74
+109
+150
+74
+109
+149
+78
+107
+148
+78
+112
+148
+84
+113
+149
+85
+111
+150
+83
+110
+150
+80
+108
+148
+75
+108
+149
+73
+108
+151
+72
+110
+153
+73
+112
+157
+76
+112
+157
+76
+112
+159
+78
+117
+164
+83
+120
+169
+88
+121
+170
+91
+117
+166
+87
+113
+160
+88
+95
+137
+74
+86
+127
+69
+79
+120
+62
+97
+88
+73
+97
+88
+73
+97
+88
+73
+97
+88
+73
+97
+88
+73
+97
+88
+73
+97
+88
+73
+97
+88
+73
+95
+86
+71
+96
+87
+72
+96
+87
+72
+97
+88
+73
+98
+89
+74
+99
+90
+75
+100
+91
+76
+100
+91
+74
+101
+93
+72
+102
+94
+71
+102
+94
+73
+103
+95
+76
+103
+94
+79
+102
+92
+80
+102
+92
+82
+102
+92
+83
+104
+93
+87
+104
+93
+87
+104
+93
+87
+104
+94
+85
+103
+93
+84
+101
+91
+81
+100
+90
+80
+99
+91
+78
+93
+89
+77
+90
+86
+74
+86
+82
+70
+82
+78
+66
+80
+76
+64
+80
+77
+62
+84
+78
+64
+85
+79
+63
+87
+81
+65
+89
+84
+65
+91
+86
+67
+93
+88
+68
+97
+90
+71
+100
+93
+74
+102
+95
+76
+102
+97
+77
+103
+97
+81
+111
+99
+85
+119
+91
+79
+138
+91
+81
+169
+98
+92
+182
+91
+88
+180
+71
+68
+183
+61
+58
+193
+61
+56
+195
+60
+54
+195
+58
+48
+193
+57
+45
+189
+56
+41
+189
+57
+42
+193
+61
+46
+202
+62
+47
+213
+57
+45
+217
+55
+44
+218
+56
+45
+217
+57
+45
+218
+56
+45
+216
+56
+44
+216
+56
+44
+213
+55
+43
+213
+55
+43
+212
+56
+43
+212
+56
+43
+212
+56
+43
+212
+56
+43
+212
+56
+43
+210
+57
+43
+205
+59
+44
+193
+63
+49
+182
+62
+46
+172
+57
+39
+162
+51
+32
+157
+51
+29
+162
+56
+34
+172
+61
+41
+181
+64
+46
+188
+63
+45
+191
+58
+43
+195
+55
+42
+197
+53
+42
+203
+55
+43
+206
+58
+46
+206
+60
+47
+211
+58
+50
+220
+55
+53
+223
+50
+52
+218
+50
+50
+218
+52
+52
+222
+56
+56
+226
+60
+60
+232
+62
+63
+235
+61
+62
+235
+56
+60
+235
+52
+56
+232
+49
+54
+229
+50
+53
+228
+54
+56
+224
+56
+55
+217
+55
+53
+204
+55
+49
+185
+51
+40
+177
+54
+39
+175
+53
+38
+174
+54
+38
+174
+54
+38
+176
+56
+40
+179
+58
+41
+181
+58
+42
+195
+65
+49
+202
+66
+52
+210
+66
+55
+217
+64
+56
+223
+60
+53
+227
+58
+53
+234
+56
+54
+236
+56
+55
+237
+54
+56
+235
+55
+56
+235
+55
+56
+234
+56
+54
+234
+56
+54
+232
+57
+52
+231
+58
+52
+230
+59
+52
+226
+57
+50
+225
+58
+50
+223
+58
+52
+224
+59
+55
+222
+58
+56
+220
+58
+56
+219
+57
+55
+217
+57
+57
+214
+60
+58
+213
+64
+60
+210
+67
+61
+202
+65
+59
+187
+59
+50
+175
+54
+43
+164
+54
+39
+158
+55
+40
+156
+59
+42
+152
+59
+41
+148
+59
+41
+146
+59
+40
+143
+58
+38
+141
+56
+36
+140
+55
+35
+135
+57
+37
+128
+61
+42
+118
+53
+35
+129
+53
+39
+153
+69
+58
+170
+80
+72
+172
+77
+71
+169
+76
+71
+166
+81
+76
+157
+80
+74
+152
+85
+76
+148
+90
+79
+148
+94
+82
+149
+97
+86
+149
+97
+86
+151
+97
+87
+141
+103
+84
+137
+133
+95
+153
+169
+120
+173
+189
+142
+166
+184
+136
+144
+161
+116
+115
+134
+89
+78
+96
+56
+47
+65
+27
+45
+62
+28
+51
+66
+37
+58
+70
+46
+61
+70
+51
+59
+65
+51
+58
+61
+50
+58
+61
+52
+60
+61
+53
+57
+57
+45
+63
+64
+50
+60
+62
+51
+57
+60
+49
+60
+64
+50
+57
+66
+47
+63
+76
+50
+80
+98
+60
+97
+119
+72
+106
+134
+75
+116
+147
+80
+115
+151
+79
+114
+150
+76
+111
+152
+76
+111
+151
+80
+109
+151
+79
+112
+151
+84
+115
+152
+85
+112
+152
+82
+111
+151
+80
+109
+150
+74
+109
+150
+72
+110
+153
+74
+112
+155
+75
+113
+158
+77
+114
+159
+78
+116
+163
+83
+121
+168
+88
+123
+172
+93
+119
+167
+91
+109
+157
+83
+101
+146
+77
+90
+132
+69
+82
+123
+65
+77
+118
+60
+99
+90
+75
+99
+90
+75
+99
+90
+75
+99
+90
+75
+99
+90
+75
+99
+90
+75
+99
+90
+75
+99
+90
+75
+99
+90
+75
+99
+90
+75
+100
+91
+76
+100
+91
+76
+101
+92
+77
+102
+93
+78
+102
+93
+78
+102
+93
+76
+102
+94
+71
+103
+95
+72
+104
+96
+73
+105
+97
+76
+105
+97
+78
+105
+96
+79
+104
+95
+80
+103
+94
+79
+106
+96
+84
+105
+96
+81
+105
+96
+81
+104
+95
+78
+104
+95
+78
+104
+96
+77
+104
+96
+77
+104
+97
+78
+100
+94
+78
+96
+90
+76
+91
+85
+71
+86
+80
+66
+80
+77
+62
+78
+75
+58
+78
+75
+58
+78
+75
+58
+80
+77
+60
+82
+79
+62
+84
+81
+64
+86
+83
+64
+88
+87
+67
+91
+90
+70
+93
+92
+72
+95
+92
+75
+99
+96
+81
+105
+93
+81
+112
+85
+74
+134
+91
+82
+172
+105
+99
+189
+100
+96
+191
+79
+77
+197
+67
+67
+205
+61
+61
+210
+58
+57
+209
+57
+52
+203
+56
+48
+194
+56
+43
+187
+60
+41
+184
+65
+43
+190
+65
+43
+208
+58
+43
+215
+55
+41
+216
+56
+42
+215
+58
+43
+217
+57
+43
+214
+57
+42
+214
+57
+42
+212
+56
+41
+212
+56
+41
+212
+56
+41
+212
+56
+41
+210
+57
+41
+210
+57
+41
+210
+57
+41
+210
+57
+41
+205
+59
+44
+193
+63
+49
+182
+62
+48
+171
+58
+40
+161
+54
+34
+154
+52
+30
+155
+55
+32
+163
+61
+38
+175
+66
+45
+179
+59
+42
+186
+59
+44
+194
+58
+44
+199
+57
+45
+203
+56
+46
+206
+58
+48
+208
+60
+48
+216
+59
+52
+232
+58
+60
+234
+53
+60
+228
+51
+57
+226
+51
+56
+223
+53
+56
+223
+53
+56
+225
+52
+56
+225
+51
+53
+233
+54
+60
+232
+53
+57
+231
+52
+58
+230
+56
+58
+226
+57
+60
+218
+56
+54
+206
+51
+49
+191
+48
+40
+181
+53
+40
+174
+57
+40
+174
+57
+40
+173
+58
+40
+173
+58
+40
+173
+58
+40
+173
+56
+38
+175
+55
+38
+184
+58
+43
+193
+59
+47
+205
+63
+51
+215
+64
+55
+221
+62
+56
+225
+60
+56
+231
+58
+54
+235
+57
+55
+237
+55
+54
+238
+54
+54
+238
+54
+54
+237
+55
+52
+234
+56
+52
+232
+58
+51
+231
+58
+51
+228
+60
+51
+225
+58
+50
+223
+59
+50
+223
+60
+53
+220
+61
+55
+219
+61
+58
+217
+62
+60
+215
+61
+59
+212
+62
+61
+207
+64
+60
+203
+66
+60
+197
+66
+58
+185
+61
+53
+173
+55
+45
+163
+53
+40
+158
+55
+40
+154
+58
+42
+150
+59
+41
+147
+60
+41
+145
+59
+42
+141
+58
+40
+138
+57
+38
+137
+56
+37
+136
+55
+36
+131
+56
+37
+131
+64
+45
+117
+52
+34
+123
+51
+37
+147
+71
+58
+164
+81
+73
+161
+78
+70
+158
+78
+71
+161
+87
+78
+152
+85
+76
+146
+88
+76
+144
+90
+78
+141
+92
+78
+143
+93
+82
+148
+96
+85
+151
+97
+87
+143
+104
+87
+141
+137
+102
+152
+165
+122
+157
+169
+129
+128
+142
+106
+93
+107
+72
+68
+83
+52
+50
+64
+38
+36
+50
+25
+45
+58
+38
+48
+59
+42
+53
+61
+46
+57
+63
+51
+60
+63
+52
+61
+63
+52
+58
+59
+51
+58
+58
+48
+57
+57
+45
+62
+63
+49
+59
+61
+50
+56
+59
+48
+59
+63
+49
+56
+65
+46
+62
+75
+49
+80
+98
+60
+98
+120
+73
+107
+135
+76
+117
+148
+81
+116
+152
+80
+115
+151
+77
+113
+154
+78
+113
+153
+82
+111
+153
+81
+114
+154
+83
+114
+154
+83
+114
+154
+81
+112
+153
+77
+109
+151
+75
+109
+152
+73
+112
+155
+76
+115
+158
+79
+116
+160
+81
+118
+162
+83
+120
+167
+89
+123
+169
+94
+122
+168
+95
+113
+159
+86
+100
+146
+74
+89
+134
+67
+92
+133
+73
+85
+124
+69
+81
+120
+65
+101
+92
+77
+101
+92
+77
+101
+92
+77
+101
+92
+77
+101
+92
+77
+101
+92
+77
+101
+92
+77
+101
+92
+77
+101
+92
+77
+102
+93
+78
+102
+93
+78
+102
+93
+78
+103
+94
+79
+103
+94
+79
+104
+95
+80
+104
+95
+78
+103
+95
+74
+104
+96
+73
+105
+97
+76
+106
+98
+77
+106
+98
+79
+106
+98
+79
+106
+97
+80
+106
+97
+80
+106
+97
+80
+105
+97
+78
+104
+96
+77
+104
+96
+75
+104
+96
+75
+104
+96
+73
+105
+97
+74
+106
+98
+75
+102
+95
+77
+98
+93
+74
+94
+88
+72
+88
+82
+66
+83
+77
+61
+77
+74
+57
+75
+72
+55
+73
+72
+54
+75
+74
+56
+76
+75
+57
+76
+77
+59
+78
+79
+61
+80
+81
+63
+81
+84
+65
+83
+86
+69
+84
+85
+69
+92
+88
+76
+95
+85
+73
+100
+80
+69
+124
+87
+78
+161
+104
+97
+181
+102
+97
+193
+88
+85
+211
+83
+82
+214
+65
+67
+220
+60
+62
+219
+57
+55
+210
+56
+48
+200
+58
+46
+189
+62
+43
+178
+66
+42
+183
+64
+40
+204
+59
+42
+212
+55
+40
+213
+56
+41
+213
+57
+42
+214
+57
+42
+213
+57
+42
+213
+57
+42
+212
+56
+41
+212
+56
+41
+210
+57
+41
+210
+57
+41
+210
+57
+41
+210
+57
+41
+210
+57
+41
+210
+57
+41
+205
+59
+44
+193
+63
+49
+181
+61
+47
+171
+60
+41
+162
+57
+36
+153
+54
+31
+149
+53
+29
+155
+59
+34
+167
+65
+42
+178
+66
+46
+185
+64
+47
+191
+59
+44
+195
+55
+42
+197
+50
+40
+203
+52
+43
+210
+59
+48
+223
+61
+56
+233
+54
+58
+237
+52
+60
+234
+55
+61
+232
+57
+62
+229
+59
+62
+228
+59
+62
+225
+59
+61
+224
+58
+60
+223
+53
+56
+224
+55
+58
+226
+57
+62
+224
+61
+62
+217
+61
+62
+207
+58
+54
+194
+51
+47
+181
+48
+39
+177
+57
+43
+172
+61
+42
+172
+61
+42
+171
+62
+42
+170
+61
+41
+169
+60
+40
+169
+58
+39
+171
+56
+37
+175
+54
+37
+183
+56
+41
+197
+59
+48
+206
+62
+51
+214
+61
+53
+222
+60
+55
+227
+59
+56
+232
+59
+55
+236
+56
+55
+239
+55
+53
+239
+55
+53
+238
+56
+53
+235
+58
+52
+233
+59
+52
+231
+60
+52
+228
+61
+52
+226
+62
+53
+224
+63
+55
+222
+65
+58
+218
+65
+59
+217
+65
+62
+213
+65
+63
+209
+64
+61
+205
+66
+63
+195
+63
+58
+187
+64
+56
+179
+61
+51
+170
+56
+45
+161
+53
+40
+155
+53
+39
+152
+56
+40
+149
+60
+42
+145
+60
+40
+141
+60
+41
+138
+60
+40
+136
+58
+38
+134
+57
+39
+132
+55
+37
+131
+54
+36
+127
+54
+37
+125
+58
+41
+116
+51
+33
+126
+57
+42
+151
+79
+65
+163
+89
+78
+156
+82
+71
+149
+79
+69
+152
+86
+74
+149
+89
+78
+144
+91
+77
+142
+90
+77
+140
+91
+77
+142
+92
+81
+147
+95
+84
+153
+96
+87
+145
+103
+87
+126
+120
+88
+121
+131
+94
+114
+124
+90
+85
+96
+66
+59
+69
+44
+47
+59
+37
+48
+59
+42
+48
+60
+46
+51
+61
+50
+52
+60
+49
+54
+60
+50
+60
+63
+54
+64
+65
+57
+63
+65
+54
+60
+60
+48
+55
+55
+43
+56
+57
+43
+62
+63
+49
+58
+60
+49
+55
+58
+47
+58
+62
+48
+55
+64
+45
+61
+74
+48
+79
+97
+59
+98
+120
+73
+107
+135
+76
+117
+148
+81
+117
+153
+81
+116
+152
+78
+113
+154
+78
+114
+154
+83
+112
+154
+82
+114
+154
+81
+115
+156
+80
+114
+155
+79
+112
+153
+75
+110
+153
+74
+112
+155
+76
+115
+158
+79
+118
+161
+82
+121
+165
+88
+123
+167
+90
+122
+168
+93
+120
+166
+93
+113
+159
+87
+103
+148
+79
+93
+138
+69
+88
+130
+66
+95
+134
+77
+87
+126
+71
+82
+121
+66
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+103
+94
+79
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+105
+96
+79
+106
+97
+80
+106
+98
+79
+106
+98
+79
+106
+98
+79
+105
+96
+79
+105
+96
+79
+105
+97
+78
+105
+97
+78
+105
+97
+78
+104
+96
+75
+104
+96
+75
+104
+96
+73
+104
+96
+73
+104
+97
+71
+104
+97
+71
+104
+97
+71
+102
+95
+76
+101
+94
+75
+98
+91
+73
+92
+87
+68
+87
+82
+63
+80
+77
+58
+76
+73
+56
+73
+72
+54
+73
+72
+54
+71
+72
+54
+71
+74
+57
+71
+75
+58
+72
+76
+59
+73
+77
+60
+72
+79
+63
+74
+78
+63
+82
+80
+67
+89
+81
+70
+92
+78
+67
+105
+82
+68
+129
+89
+77
+149
+87
+76
+174
+84
+76
+209
+91
+89
+217
+75
+74
+223
+65
+66
+223
+57
+57
+217
+55
+50
+207
+59
+49
+195
+62
+45
+183
+64
+42
+180
+60
+36
+201
+58
+41
+211
+55
+40
+212
+56
+41
+211
+58
+42
+213
+57
+42
+211
+58
+42
+211
+58
+42
+211
+58
+42
+210
+57
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+205
+59
+44
+193
+61
+48
+181
+61
+47
+172
+61
+44
+163
+60
+41
+152
+56
+32
+144
+52
+27
+149
+57
+32
+161
+65
+41
+173
+67
+45
+182
+65
+47
+191
+61
+47
+192
+54
+43
+194
+47
+37
+199
+48
+39
+208
+54
+46
+222
+58
+56
+232
+53
+57
+238
+54
+62
+236
+59
+65
+233
+64
+67
+229
+66
+69
+224
+66
+67
+220
+64
+65
+217
+63
+63
+204
+50
+50
+207
+55
+54
+211
+58
+60
+207
+62
+59
+199
+60
+57
+189
+56
+49
+180
+53
+46
+171
+53
+41
+170
+60
+45
+167
+62
+43
+167
+62
+43
+166
+63
+44
+165
+62
+43
+166
+61
+40
+166
+59
+39
+169
+58
+39
+170
+55
+37
+177
+56
+39
+188
+56
+43
+195
+57
+46
+203
+56
+48
+211
+58
+52
+220
+61
+57
+228
+63
+59
+233
+58
+55
+236
+57
+53
+236
+57
+53
+235
+58
+52
+233
+59
+52
+232
+59
+52
+229
+61
+52
+226
+62
+52
+224
+66
+55
+221
+67
+57
+218
+67
+60
+213
+66
+59
+207
+65
+61
+202
+63
+60
+199
+61
+59
+191
+62
+57
+177
+60
+51
+169
+58
+47
+162
+56
+43
+156
+54
+40
+152
+55
+39
+148
+56
+41
+145
+58
+41
+141
+58
+40
+139
+61
+41
+137
+60
+42
+135
+60
+41
+131
+58
+39
+130
+57
+40
+128
+55
+38
+127
+54
+37
+125
+54
+36
+120
+51
+35
+120
+53
+37
+133
+66
+50
+152
+85
+69
+157
+87
+75
+148
+80
+67
+144
+80
+68
+149
+90
+76
+147
+89
+77
+144
+90
+78
+144
+92
+81
+144
+92
+81
+146
+91
+84
+149
+92
+85
+152
+91
+86
+142
+98
+85
+107
+98
+69
+86
+96
+61
+74
+83
+52
+61
+71
+44
+54
+63
+42
+50
+61
+44
+52
+62
+51
+53
+63
+54
+54
+61
+54
+56
+63
+56
+61
+66
+59
+67
+70
+61
+69
+71
+60
+67
+68
+54
+64
+62
+47
+59
+57
+42
+55
+56
+42
+61
+62
+48
+58
+60
+49
+55
+58
+47
+58
+62
+48
+54
+63
+44
+61
+74
+48
+78
+96
+58
+97
+119
+72
+107
+135
+76
+117
+148
+81
+117
+153
+81
+116
+152
+78
+114
+155
+79
+114
+154
+83
+112
+154
+80
+113
+155
+79
+114
+157
+78
+113
+156
+77
+112
+155
+76
+111
+154
+75
+114
+157
+78
+117
+161
+84
+121
+165
+88
+127
+171
+96
+126
+169
+97
+122
+165
+93
+113
+156
+85
+102
+145
+76
+95
+137
+71
+93
+135
+69
+94
+136
+73
+97
+136
+79
+89
+128
+73
+82
+121
+66
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+103
+94
+79
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+104
+95
+80
+105
+96
+81
+105
+96
+81
+109
+100
+85
+108
+99
+84
+106
+97
+82
+105
+96
+81
+104
+95
+80
+103
+94
+79
+103
+94
+77
+104
+96
+77
+105
+97
+78
+105
+97
+76
+105
+97
+76
+105
+97
+76
+104
+96
+73
+104
+96
+73
+104
+97
+71
+104
+96
+73
+103
+97
+75
+102
+95
+76
+101
+94
+75
+98
+91
+72
+92
+87
+68
+85
+82
+63
+80
+77
+60
+77
+76
+58
+69
+70
+52
+68
+71
+52
+68
+72
+55
+68
+72
+55
+66
+73
+57
+66
+75
+58
+66
+75
+58
+67
+74
+58
+74
+74
+62
+84
+80
+68
+85
+79
+65
+89
+76
+60
+101
+75
+58
+115
+69
+53
+146
+74
+62
+192
+91
+83
+215
+83
+79
+222
+70
+69
+223
+59
+58
+220
+55
+53
+213
+59
+51
+204
+61
+47
+189
+60
+41
+184
+55
+34
+203
+58
+41
+207
+56
+39
+208
+57
+40
+210
+59
+42
+210
+59
+42
+210
+59
+42
+210
+59
+42
+210
+59
+42
+209
+58
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+209
+58
+41
+205
+59
+44
+193
+59
+48
+182
+58
+46
+173
+60
+44
+167
+62
+43
+153
+57
+35
+143
+51
+26
+147
+55
+30
+159
+63
+39
+163
+57
+35
+176
+59
+41
+192
+62
+48
+198
+60
+49
+204
+56
+46
+208
+55
+47
+217
+60
+53
+227
+63
+61
+236
+61
+66
+238
+63
+68
+233
+67
+69
+226
+68
+67
+214
+64
+63
+202
+59
+55
+192
+53
+48
+187
+49
+46
+183
+48
+44
+187
+54
+49
+190
+58
+54
+187
+60
+54
+179
+58
+50
+169
+57
+46
+164
+56
+44
+160
+58
+43
+161
+61
+45
+159
+62
+43
+160
+63
+44
+161
+64
+45
+161
+64
+45
+163
+64
+43
+163
+62
+42
+164
+61
+42
+169
+59
+42
+173
+58
+40
+178
+55
+40
+184
+54
+41
+191
+53
+43
+201
+57
+48
+212
+63
+57
+224
+67
+62
+229
+60
+55
+232
+59
+53
+232
+59
+53
+231
+60
+52
+229
+60
+53
+228
+61
+52
+225
+62
+53
+222
+64
+53
+220
+68
+57
+216
+68
+58
+210
+67
+59
+202
+65
+57
+196
+63
+58
+188
+59
+54
+184
+56
+53
+176
+57
+51
+162
+55
+45
+153
+56
+40
+149
+53
+39
+147
+54
+39
+145
+58
+41
+143
+60
+42
+139
+58
+41
+133
+56
+38
+136
+61
+42
+133
+60
+43
+131
+60
+42
+128
+60
+41
+126
+58
+39
+124
+56
+37
+123
+54
+38
+123
+54
+38
+121
+49
+35
+128
+56
+42
+140
+71
+56
+150
+83
+67
+146
+80
+66
+139
+76
+61
+144
+82
+69
+153
+95
+83
+145
+87
+76
+146
+89
+78
+148
+91
+82
+150
+93
+84
+150
+93
+86
+151
+92
+86
+150
+89
+84
+140
+94
+81
+97
+88
+59
+69
+77
+40
+54
+64
+30
+56
+65
+38
+62
+71
+50
+60
+69
+52
+51
+61
+50
+45
+55
+46
+49
+56
+49
+55
+62
+54
+66
+69
+60
+71
+74
+63
+72
+73
+59
+66
+67
+49
+63
+62
+42
+59
+58
+38
+55
+56
+40
+61
+62
+48
+57
+59
+48
+54
+57
+46
+58
+62
+48
+54
+63
+44
+60
+73
+47
+78
+96
+58
+97
+119
+72
+106
+134
+75
+117
+148
+81
+116
+152
+80
+116
+152
+78
+114
+155
+79
+114
+154
+83
+112
+154
+80
+113
+156
+77
+113
+156
+76
+113
+156
+76
+112
+155
+75
+112
+155
+76
+115
+158
+79
+119
+163
+86
+123
+167
+92
+130
+173
+101
+128
+171
+100
+120
+163
+92
+106
+149
+80
+93
+135
+69
+89
+131
+65
+94
+136
+72
+101
+143
+80
+99
+138
+81
+90
+129
+74
+83
+122
+67
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+95
+83
+106
+96
+87
+106
+96
+87
+106
+96
+87
+106
+96
+87
+106
+96
+86
+106
+96
+86
+106
+96
+84
+106
+97
+82
+106
+97
+82
+106
+97
+80
+106
+97
+80
+106
+98
+79
+106
+98
+79
+106
+98
+79
+106
+98
+77
+106
+98
+77
+103
+95
+74
+103
+95
+74
+102
+94
+73
+101
+95
+73
+98
+93
+73
+90
+88
+67
+83
+80
+61
+77
+76
+58
+72
+73
+55
+69
+72
+55
+65
+69
+54
+64
+68
+53
+63
+69
+55
+63
+71
+56
+63
+71
+56
+63
+69
+55
+72
+74
+61
+74
+75
+61
+67
+68
+52
+75
+74
+54
+92
+81
+59
+96
+70
+47
+128
+75
+57
+189
+107
+93
+217
+104
+96
+224
+86
+83
+226
+71
+69
+229
+65
+64
+226
+64
+61
+215
+61
+53
+203
+59
+48
+201
+59
+45
+199
+51
+37
+203
+53
+38
+204
+54
+39
+205
+55
+40
+205
+55
+40
+206
+56
+41
+209
+59
+44
+211
+61
+46
+210
+60
+45
+210
+60
+45
+210
+60
+45
+210
+60
+45
+209
+59
+44
+209
+59
+44
+209
+59
+44
+206
+60
+45
+187
+50
+40
+182
+55
+46
+177
+59
+47
+168
+58
+41
+154
+55
+34
+148
+53
+31
+149
+55
+30
+156
+57
+34
+174
+65
+45
+179
+59
+43
+186
+54
+41
+193
+52
+42
+205
+54
+47
+215
+60
+55
+226
+67
+63
+234
+72
+69
+232
+68
+69
+232
+69
+72
+221
+67
+67
+201
+58
+54
+187
+54
+49
+180
+56
+48
+176
+55
+46
+169
+52
+43
+171
+57
+47
+169
+57
+46
+164
+56
+46
+160
+56
+45
+155
+57
+44
+150
+58
+43
+147
+60
+43
+146
+60
+43
+150
+61
+43
+152
+61
+42
+153
+62
+43
+154
+63
+44
+155
+64
+45
+156
+65
+44
+158
+66
+45
+161
+64
+45
+162
+59
+42
+165
+58
+40
+171
+55
+40
+176
+54
+41
+182
+54
+43
+190
+56
+45
+197
+58
+51
+204
+60
+52
+218
+61
+54
+224
+61
+54
+226
+63
+56
+226
+65
+55
+226
+65
+57
+222
+66
+54
+218
+64
+54
+215
+64
+53
+216
+72
+61
+210
+69
+59
+199
+65
+56
+187
+59
+50
+178
+53
+47
+170
+51
+45
+166
+49
+42
+159
+50
+43
+153
+57
+45
+146
+59
+42
+145
+57
+43
+141
+58
+42
+139
+58
+41
+136
+59
+41
+135
+59
+43
+133
+60
+43
+128
+57
+39
+125
+56
+40
+124
+57
+40
+124
+57
+40
+124
+57
+40
+123
+56
+39
+121
+54
+38
+120
+51
+36
+119
+45
+32
+139
+65
+52
+151
+79
+67
+147
+77
+65
+142
+76
+64
+145
+81
+69
+147
+85
+74
+142
+82
+71
+152
+92
+82
+152
+92
+82
+145
+85
+77
+144
+84
+76
+151
+90
+85
+149
+88
+83
+148
+87
+84
+147
+103
+90
+93
+84
+53
+73
+81
+42
+65
+75
+40
+66
+75
+44
+62
+72
+47
+55
+64
+43
+50
+61
+45
+52
+63
+49
+52
+60
+49
+72
+80
+67
+90
+94
+80
+87
+91
+74
+77
+79
+58
+68
+70
+46
+65
+65
+39
+61
+61
+37
+58
+59
+41
+62
+63
+49
+59
+61
+50
+58
+61
+50
+59
+63
+49
+52
+61
+42
+59
+72
+46
+80
+98
+60
+99
+121
+74
+108
+136
+77
+117
+148
+81
+115
+151
+79
+114
+150
+76
+112
+153
+77
+114
+154
+83
+113
+155
+81
+112
+157
+76
+113
+158
+75
+114
+159
+78
+114
+159
+78
+115
+159
+80
+118
+162
+85
+123
+167
+92
+127
+170
+98
+130
+173
+102
+120
+163
+94
+106
+147
+79
+96
+137
+71
+94
+135
+69
+97
+137
+74
+102
+142
+80
+104
+144
+84
+100
+137
+83
+91
+128
+76
+84
+121
+69
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+95
+83
+106
+95
+89
+106
+95
+91
+106
+95
+91
+106
+95
+89
+106
+95
+89
+106
+96
+87
+106
+96
+86
+106
+96
+84
+106
+96
+84
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+80
+106
+97
+80
+104
+96
+77
+104
+96
+75
+103
+95
+74
+103
+95
+74
+100
+93
+74
+94
+89
+69
+85
+82
+63
+79
+78
+58
+73
+74
+58
+69
+72
+55
+66
+68
+54
+64
+68
+53
+63
+69
+55
+62
+70
+55
+62
+70
+55
+61
+69
+54
+66
+70
+56
+65
+67
+53
+64
+69
+49
+72
+76
+53
+77
+73
+48
+82
+65
+39
+124
+82
+58
+185
+117
+98
+201
+100
+88
+221
+96
+90
+234
+86
+84
+230
+72
+71
+226
+64
+62
+226
+64
+61
+219
+62
+57
+209
+56
+48
+205
+57
+43
+206
+61
+44
+207
+61
+46
+207
+62
+45
+207
+59
+45
+206
+59
+43
+205
+57
+43
+205
+58
+42
+206
+58
+44
+208
+58
+43
+208
+58
+44
+208
+58
+43
+208
+58
+44
+208
+58
+43
+208
+58
+44
+205
+59
+46
+201
+63
+53
+197
+66
+58
+188
+66
+55
+174
+61
+47
+159
+54
+35
+150
+49
+29
+150
+49
+29
+155
+50
+29
+168
+53
+35
+180
+54
+40
+195
+59
+47
+209
+65
+56
+222
+69
+63
+230
+73
+68
+233
+74
+70
+234
+75
+72
+224
+66
+65
+219
+69
+68
+208
+66
+62
+190
+59
+51
+175
+57
+47
+171
+61
+48
+165
+63
+49
+159
+61
+48
+159
+63
+49
+156
+62
+50
+151
+62
+48
+149
+61
+47
+143
+61
+47
+139
+62
+46
+135
+64
+46
+136
+63
+44
+142
+61
+42
+143
+60
+42
+146
+60
+43
+145
+62
+44
+148
+63
+43
+148
+63
+43
+150
+63
+44
+153
+62
+44
+159
+64
+46
+161
+61
+45
+164
+58
+44
+168
+56
+44
+173
+55
+43
+178
+56
+45
+184
+57
+48
+189
+56
+47
+202
+60
+50
+208
+60
+50
+211
+63
+53
+213
+65
+55
+215
+67
+57
+214
+67
+57
+212
+68
+57
+209
+69
+56
+202
+66
+54
+195
+65
+52
+185
+61
+51
+176
+58
+48
+169
+54
+47
+164
+53
+46
+159
+52
+44
+153
+55
+44
+146
+58
+46
+140
+61
+44
+138
+59
+44
+136
+59
+43
+134
+58
+42
+132
+59
+42
+131
+60
+42
+129
+60
+44
+126
+59
+42
+124
+59
+41
+123
+57
+41
+121
+58
+41
+120
+57
+40
+119
+56
+39
+117
+54
+39
+119
+52
+36
+128
+52
+39
+144
+68
+55
+152
+78
+67
+145
+75
+63
+140
+74
+62
+143
+81
+68
+146
+84
+73
+144
+82
+71
+147
+83
+74
+152
+88
+79
+152
+85
+79
+151
+86
+80
+156
+93
+88
+148
+87
+82
+142
+83
+79
+138
+99
+84
+93
+87
+53
+88
+99
+57
+95
+106
+66
+90
+102
+66
+73
+84
+54
+54
+67
+41
+52
+64
+42
+60
+72
+52
+79
+88
+71
+89
+98
+81
+95
+102
+84
+87
+92
+70
+74
+78
+55
+66
+69
+42
+63
+63
+35
+60
+60
+34
+57
+58
+40
+61
+62
+48
+58
+60
+49
+57
+60
+49
+60
+64
+50
+53
+62
+43
+59
+72
+46
+80
+98
+60
+100
+122
+75
+108
+136
+77
+117
+148
+81
+116
+152
+80
+114
+150
+76
+113
+154
+78
+114
+154
+83
+113
+155
+81
+115
+160
+79
+114
+159
+76
+112
+157
+76
+113
+158
+77
+116
+160
+81
+120
+164
+87
+124
+167
+95
+127
+170
+99
+123
+166
+97
+111
+154
+85
+99
+140
+74
+93
+134
+68
+97
+137
+74
+101
+141
+78
+101
+141
+78
+99
+139
+79
+100
+137
+83
+91
+128
+76
+84
+121
+69
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+95
+85
+106
+95
+91
+106
+94
+94
+106
+94
+94
+106
+95
+93
+106
+95
+89
+106
+96
+87
+106
+96
+86
+106
+96
+84
+106
+96
+84
+106
+96
+84
+106
+96
+84
+106
+96
+84
+106
+96
+84
+106
+96
+84
+106
+96
+86
+106
+96
+84
+108
+97
+79
+107
+96
+76
+105
+97
+78
+105
+97
+78
+102
+95
+76
+97
+92
+72
+89
+86
+67
+83
+82
+62
+77
+75
+60
+72
+73
+57
+68
+70
+56
+65
+69
+54
+65
+69
+54
+63
+70
+54
+62
+68
+54
+61
+67
+53
+62
+69
+53
+58
+62
+45
+66
+71
+49
+73
+75
+51
+69
+63
+37
+84
+64
+39
+132
+92
+67
+181
+116
+96
+179
+87
+74
+214
+100
+90
+239
+101
+98
+236
+84
+83
+230
+70
+72
+235
+71
+72
+232
+66
+68
+219
+57
+54
+203
+55
+43
+201
+58
+42
+201
+58
+44
+201
+58
+42
+203
+57
+44
+202
+56
+41
+200
+54
+41
+200
+54
+39
+202
+56
+43
+203
+55
+41
+203
+55
+43
+203
+55
+41
+203
+55
+43
+204
+56
+42
+204
+56
+44
+203
+56
+46
+194
+51
+45
+190
+53
+47
+182
+54
+45
+173
+51
+40
+161
+48
+34
+158
+47
+30
+160
+49
+32
+167
+51
+36
+188
+65
+50
+199
+67
+55
+214
+71
+63
+225
+76
+70
+231
+76
+71
+233
+74
+70
+229
+70
+66
+223
+68
+64
+216
+66
+65
+209
+67
+65
+195
+63
+58
+177
+59
+49
+166
+60
+47
+161
+65
+49
+156
+69
+52
+152
+69
+51
+149
+68
+51
+146
+67
+52
+143
+66
+50
+138
+65
+48
+133
+64
+48
+130
+65
+47
+126
+65
+46
+129
+64
+46
+132
+59
+42
+136
+59
+43
+137
+58
+41
+137
+60
+42
+139
+60
+43
+139
+60
+43
+142
+61
+42
+143
+60
+42
+150
+63
+46
+152
+60
+45
+155
+59
+43
+158
+56
+42
+162
+56
+43
+167
+56
+45
+170
+58
+46
+175
+57
+47
+185
+57
+46
+190
+57
+48
+193
+59
+48
+196
+62
+51
+197
+63
+51
+197
+65
+52
+195
+65
+51
+193
+65
+52
+182
+59
+44
+178
+58
+44
+170
+56
+45
+163
+55
+43
+158
+54
+43
+155
+54
+44
+152
+55
+46
+148
+58
+47
+141
+59
+47
+136
+60
+44
+135
+59
+45
+132
+59
+44
+130
+58
+43
+128
+59
+43
+128
+59
+43
+127
+60
+44
+125
+59
+43
+122
+59
+42
+122
+59
+44
+119
+57
+42
+118
+56
+41
+117
+55
+40
+116
+54
+41
+118
+52
+38
+136
+59
+49
+148
+70
+60
+150
+78
+66
+142
+74
+61
+136
+72
+60
+141
+79
+66
+145
+83
+72
+146
+82
+73
+146
+79
+73
+153
+84
+79
+153
+83
+81
+154
+86
+83
+154
+93
+90
+147
+89
+85
+141
+91
+84
+141
+108
+91
+129
+125
+88
+126
+137
+94
+128
+139
+97
+108
+120
+82
+76
+88
+52
+54
+68
+35
+61
+74
+46
+76
+90
+64
+101
+113
+89
+101
+111
+87
+93
+101
+77
+80
+85
+62
+69
+73
+48
+63
+67
+40
+61
+64
+35
+58
+60
+36
+56
+57
+39
+59
+60
+46
+56
+58
+47
+57
+60
+49
+61
+65
+51
+54
+63
+44
+60
+73
+47
+80
+98
+60
+100
+122
+75
+109
+137
+78
+118
+149
+82
+116
+152
+80
+115
+151
+77
+113
+154
+78
+114
+154
+83
+112
+154
+80
+117
+162
+81
+112
+160
+76
+110
+157
+76
+112
+159
+79
+117
+164
+86
+121
+167
+92
+125
+168
+96
+124
+167
+96
+112
+153
+85
+102
+143
+77
+92
+132
+69
+92
+132
+69
+101
+140
+77
+105
+144
+81
+102
+141
+78
+95
+133
+72
+99
+136
+82
+90
+127
+76
+83
+120
+69
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+96
+86
+107
+96
+92
+107
+95
+95
+107
+96
+94
+107
+96
+92
+107
+96
+90
+107
+97
+88
+107
+97
+87
+107
+97
+85
+107
+97
+85
+107
+97
+85
+107
+97
+85
+107
+97
+85
+107
+97
+87
+107
+97
+87
+107
+97
+88
+107
+97
+87
+110
+98
+82
+109
+98
+80
+106
+98
+79
+106
+98
+79
+104
+97
+78
+101
+94
+75
+95
+90
+71
+89
+86
+69
+82
+79
+62
+77
+75
+60
+71
+72
+58
+68
+70
+56
+67
+69
+55
+66
+68
+54
+64
+68
+53
+62
+66
+51
+63
+70
+52
+60
+65
+45
+71
+73
+51
+76
+70
+48
+77
+59
+37
+110
+78
+57
+152
+100
+79
+167
+96
+78
+158
+66
+53
+197
+84
+76
+229
+100
+95
+239
+95
+94
+237
+83
+85
+237
+74
+79
+234
+68
+72
+227
+64
+65
+205
+56
+49
+199
+57
+45
+197
+55
+43
+197
+55
+43
+200
+56
+45
+202
+58
+47
+203
+59
+48
+205
+58
+48
+209
+62
+52
+209
+62
+52
+210
+62
+52
+210
+62
+52
+211
+63
+53
+211
+63
+53
+211
+63
+53
+211
+62
+55
+211
+63
+59
+209
+66
+62
+203
+68
+62
+198
+70
+61
+194
+70
+60
+195
+73
+62
+199
+77
+64
+206
+80
+68
+217
+83
+72
+221
+80
+71
+226
+77
+71
+228
+73
+69
+228
+71
+66
+226
+67
+63
+224
+65
+61
+220
+65
+61
+214
+69
+66
+202
+67
+63
+189
+62
+55
+173
+59
+48
+161
+61
+46
+155
+66
+48
+151
+70
+51
+148
+73
+54
+142
+69
+52
+140
+69
+51
+138
+66
+51
+133
+66
+49
+130
+64
+48
+125
+64
+46
+123
+64
+46
+124
+63
+45
+128
+59
+44
+131
+57
+44
+131
+58
+43
+132
+59
+44
+132
+59
+44
+133
+60
+45
+135
+59
+43
+136
+59
+43
+137
+58
+43
+140
+57
+41
+143
+55
+41
+147
+55
+42
+150
+56
+44
+156
+58
+47
+160
+59
+47
+163
+59
+48
+170
+58
+47
+173
+56
+46
+175
+57
+47
+176
+58
+46
+176
+58
+46
+176
+58
+44
+175
+57
+43
+174
+56
+42
+168
+55
+41
+165
+55
+40
+158
+54
+41
+155
+54
+42
+149
+55
+43
+146
+56
+45
+145
+57
+47
+142
+60
+48
+136
+60
+46
+133
+60
+45
+131
+59
+44
+129
+57
+42
+127
+58
+42
+126
+57
+42
+125
+58
+42
+125
+59
+43
+124
+58
+44
+122
+59
+44
+121
+59
+44
+119
+57
+42
+115
+56
+42
+113
+54
+40
+114
+55
+41
+117
+53
+41
+140
+68
+56
+146
+72
+61
+145
+75
+63
+138
+72
+58
+135
+73
+60
+139
+79
+68
+147
+84
+75
+151
+84
+76
+150
+81
+76
+155
+84
+80
+152
+81
+79
+148
+83
+79
+150
+92
+88
+144
+95
+88
+144
+104
+94
+151
+126
+106
+148
+148
+112
+133
+146
+102
+117
+130
+87
+89
+104
+63
+67
+82
+43
+63
+79
+42
+80
+96
+60
+99
+114
+81
+101
+116
+85
+92
+105
+75
+78
+88
+61
+67
+76
+49
+63
+69
+43
+62
+66
+41
+61
+65
+40
+59
+61
+39
+55
+56
+40
+58
+59
+45
+55
+57
+46
+57
+60
+49
+61
+65
+51
+55
+64
+45
+60
+73
+47
+79
+97
+59
+98
+120
+73
+108
+136
+77
+118
+149
+82
+117
+153
+81
+116
+152
+78
+114
+155
+79
+114
+154
+83
+111
+155
+80
+113
+160
+79
+111
+158
+77
+111
+158
+77
+115
+162
+82
+122
+168
+93
+124
+170
+97
+122
+165
+94
+117
+160
+91
+99
+140
+74
+94
+135
+69
+91
+131
+68
+95
+135
+72
+103
+142
+79
+106
+145
+80
+102
+141
+76
+96
+135
+72
+98
+135
+81
+89
+126
+75
+82
+119
+68
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+96
+84
+107
+96
+90
+107
+96
+92
+107
+96
+90
+107
+97
+88
+107
+97
+87
+107
+97
+85
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+97
+85
+107
+97
+87
+107
+97
+87
+107
+97
+88
+107
+97
+87
+111
+99
+85
+110
+98
+82
+107
+98
+81
+107
+98
+81
+107
+98
+81
+104
+97
+79
+100
+93
+77
+96
+90
+74
+88
+82
+66
+82
+79
+62
+78
+75
+60
+73
+71
+56
+71
+69
+54
+68
+69
+53
+66
+67
+51
+63
+66
+49
+64
+72
+49
+65
+70
+47
+77
+71
+49
+83
+62
+43
+101
+62
+45
+148
+90
+76
+170
+96
+83
+153
+63
+52
+155
+52
+43
+179
+64
+57
+214
+89
+85
+241
+106
+103
+245
+101
+101
+235
+82
+85
+232
+73
+78
+233
+77
+80
+217
+73
+65
+211
+70
+60
+205
+64
+54
+203
+62
+52
+206
+64
+54
+210
+68
+58
+213
+71
+61
+215
+71
+62
+218
+74
+65
+218
+74
+65
+221
+74
+66
+221
+74
+66
+222
+75
+67
+222
+75
+67
+224
+75
+68
+224
+75
+69
+235
+83
+82
+232
+84
+84
+227
+83
+82
+220
+82
+79
+216
+83
+76
+216
+83
+76
+219
+85
+76
+224
+85
+78
+224
+76
+72
+225
+73
+70
+227
+69
+66
+226
+67
+64
+228
+66
+64
+226
+67
+64
+228
+69
+66
+224
+70
+68
+218
+73
+70
+203
+68
+64
+188
+61
+55
+174
+60
+50
+163
+62
+50
+153
+66
+49
+147
+68
+51
+146
+71
+52
+141
+68
+51
+138
+66
+51
+137
+65
+51
+132
+63
+48
+130
+62
+49
+128
+62
+48
+125
+62
+47
+125
+62
+47
+127
+59
+46
+128
+58
+46
+128
+58
+46
+128
+58
+46
+128
+61
+45
+129
+60
+45
+129
+60
+45
+131
+59
+45
+130
+57
+42
+132
+56
+42
+134
+56
+43
+138
+56
+42
+140
+57
+43
+144
+58
+45
+146
+58
+46
+148
+58
+47
+155
+59
+47
+158
+57
+45
+159
+57
+45
+160
+58
+44
+161
+57
+44
+162
+56
+43
+162
+56
+42
+162
+56
+42
+159
+56
+41
+156
+56
+41
+152
+56
+40
+148
+56
+41
+143
+57
+42
+140
+58
+44
+137
+58
+45
+135
+59
+45
+132
+58
+45
+130
+58
+44
+129
+57
+43
+128
+56
+42
+125
+56
+41
+125
+55
+43
+124
+56
+43
+123
+57
+43
+122
+56
+44
+121
+57
+45
+120
+58
+45
+118
+56
+43
+113
+53
+42
+111
+53
+41
+113
+55
+43
+116
+57
+43
+140
+72
+59
+141
+73
+60
+137
+73
+61
+132
+73
+59
+133
+75
+63
+140
+82
+70
+147
+87
+77
+152
+88
+79
+152
+81
+77
+156
+85
+81
+152
+82
+80
+147
+86
+81
+146
+96
+89
+136
+98
+87
+131
+103
+91
+134
+122
+100
+110
+114
+81
+90
+105
+64
+74
+89
+48
+65
+82
+40
+73
+90
+48
+87
+105
+63
+100
+118
+78
+106
+124
+86
+88
+105
+69
+76
+91
+58
+63
+76
+46
+58
+68
+41
+60
+68
+44
+62
+67
+45
+60
+65
+45
+58
+61
+44
+56
+57
+43
+58
+59
+45
+54
+56
+45
+56
+59
+48
+62
+66
+52
+55
+64
+45
+59
+72
+46
+76
+94
+56
+95
+117
+70
+105
+133
+74
+116
+147
+80
+116
+152
+80
+116
+152
+78
+114
+155
+79
+115
+155
+84
+112
+156
+81
+110
+157
+77
+109
+158
+76
+112
+161
+80
+119
+168
+89
+124
+170
+97
+122
+168
+96
+114
+157
+88
+105
+147
+81
+90
+131
+65
+92
+132
+69
+97
+136
+73
+101
+140
+77
+103
+142
+77
+103
+142
+75
+104
+141
+74
+102
+138
+76
+99
+134
+80
+89
+123
+73
+82
+116
+66
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+97
+85
+108
+98
+89
+108
+98
+89
+108
+98
+89
+108
+98
+86
+108
+98
+86
+108
+99
+82
+108
+99
+82
+108
+100
+81
+108
+100
+81
+108
+100
+81
+108
+99
+82
+108
+99
+84
+108
+98
+86
+108
+98
+88
+108
+98
+88
+108
+98
+88
+111
+99
+85
+110
+98
+82
+107
+98
+81
+108
+99
+82
+108
+99
+82
+107
+98
+81
+103
+96
+80
+100
+93
+77
+94
+87
+71
+89
+83
+67
+83
+77
+63
+77
+74
+59
+75
+72
+57
+71
+69
+54
+69
+66
+51
+64
+65
+47
+61
+71
+46
+66
+70
+45
+81
+66
+45
+98
+61
+45
+129
+69
+58
+169
+89
+82
+178
+79
+74
+155
+46
+43
+175
+60
+57
+184
+62
+59
+208
+84
+82
+242
+112
+110
+254
+118
+118
+243
+100
+104
+237
+88
+94
+242
+93
+95
+227
+85
+81
+218
+80
+70
+212
+71
+64
+208
+67
+58
+209
+68
+61
+212
+71
+62
+214
+71
+65
+214
+71
+63
+217
+72
+67
+218
+74
+66
+220
+72
+68
+221
+74
+67
+222
+74
+70
+222
+75
+68
+224
+75
+71
+224
+75
+71
+226
+72
+72
+225
+71
+73
+220
+72
+72
+217
+71
+71
+214
+72
+68
+215
+72
+68
+216
+71
+66
+219
+70
+66
+224
+66
+65
+228
+65
+66
+230
+66
+65
+232
+66
+66
+231
+67
+66
+228
+66
+64
+223
+65
+62
+219
+65
+63
+221
+73
+71
+205
+66
+63
+188
+59
+54
+175
+61
+51
+165
+63
+51
+153
+64
+48
+146
+65
+48
+144
+67
+51
+140
+64
+50
+137
+64
+49
+136
+62
+49
+134
+60
+49
+132
+60
+48
+129
+59
+49
+129
+59
+49
+128
+60
+49
+128
+60
+49
+127
+61
+49
+127
+60
+51
+127
+61
+49
+127
+61
+49
+127
+61
+47
+127
+61
+49
+127
+61
+47
+128
+60
+47
+129
+60
+45
+131
+59
+45
+131
+57
+44
+133
+57
+44
+132
+56
+42
+133
+55
+43
+133
+54
+41
+141
+57
+46
+143
+56
+46
+145
+57
+45
+148
+58
+47
+151
+59
+46
+154
+61
+46
+158
+60
+47
+159
+62
+46
+153
+57
+41
+150
+57
+40
+147
+58
+42
+144
+58
+43
+138
+59
+44
+135
+59
+43
+132
+59
+44
+130
+58
+43
+130
+58
+44
+129
+57
+43
+127
+55
+41
+126
+54
+40
+123
+53
+41
+123
+53
+41
+123
+53
+41
+122
+54
+41
+120
+54
+42
+120
+56
+44
+119
+57
+44
+115
+56
+42
+112
+52
+41
+111
+53
+41
+114
+58
+45
+118
+60
+48
+139
+77
+64
+137
+75
+60
+132
+74
+60
+130
+77
+61
+133
+81
+67
+139
+86
+72
+146
+88
+77
+151
+87
+78
+147
+78
+73
+153
+84
+79
+151
+86
+82
+149
+92
+85
+144
+101
+92
+123
+94
+80
+102
+86
+70
+96
+94
+71
+69
+79
+45
+62
+78
+41
+63
+79
+40
+74
+92
+50
+95
+114
+69
+107
+126
+81
+101
+120
+75
+88
+106
+64
+77
+95
+55
+64
+81
+45
+54
+69
+38
+55
+68
+42
+61
+70
+49
+61
+68
+52
+58
+62
+48
+55
+59
+45
+56
+58
+44
+58
+59
+45
+54
+56
+45
+56
+59
+48
+62
+66
+52
+55
+64
+45
+57
+70
+44
+73
+91
+53
+91
+113
+66
+101
+129
+70
+114
+145
+78
+115
+151
+79
+115
+151
+77
+114
+155
+79
+115
+155
+84
+112
+156
+81
+109
+156
+76
+111
+160
+79
+115
+164
+85
+120
+168
+92
+122
+168
+96
+115
+160
+91
+105
+147
+81
+96
+138
+72
+89
+129
+66
+94
+134
+71
+101
+140
+77
+103
+142
+77
+102
+141
+74
+101
+141
+71
+103
+140
+71
+104
+140
+76
+97
+132
+78
+88
+122
+72
+81
+115
+65
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+98
+88
+108
+98
+86
+108
+98
+86
+108
+99
+82
+108
+99
+82
+108
+100
+79
+108
+100
+79
+108
+100
+77
+108
+100
+77
+108
+100
+77
+108
+100
+79
+108
+100
+81
+108
+99
+82
+108
+99
+84
+108
+98
+86
+108
+98
+86
+111
+99
+85
+109
+97
+83
+107
+98
+83
+108
+99
+84
+109
+100
+85
+108
+99
+84
+105
+96
+81
+102
+95
+79
+98
+91
+75
+94
+87
+71
+88
+81
+65
+82
+76
+60
+79
+73
+57
+74
+71
+54
+73
+67
+51
+65
+67
+46
+60
+70
+43
+66
+69
+42
+86
+64
+43
+122
+70
+57
+163
+80
+76
+178
+72
+72
+180
+57
+60
+183
+52
+57
+197
+67
+69
+193
+65
+64
+200
+75
+73
+222
+98
+96
+241
+113
+112
+242
+109
+112
+233
+97
+101
+228
+89
+92
+219
+81
+78
+213
+76
+68
+207
+68
+63
+205
+66
+59
+207
+68
+63
+208
+69
+62
+208
+66
+62
+205
+64
+57
+210
+67
+63
+210
+67
+61
+212
+67
+64
+213
+68
+63
+215
+67
+65
+216
+68
+64
+217
+69
+67
+218
+68
+67
+221
+65
+68
+221
+65
+68
+222
+68
+70
+221
+71
+72
+223
+73
+72
+224
+74
+73
+227
+73
+73
+229
+71
+72
+231
+65
+67
+234
+65
+68
+236
+66
+69
+236
+66
+69
+231
+65
+65
+226
+64
+62
+219
+61
+58
+214
+60
+58
+219
+69
+70
+204
+60
+60
+188
+54
+51
+177
+58
+50
+169
+62
+52
+155
+61
+49
+147
+61
+48
+145
+63
+49
+139
+60
+47
+139
+59
+48
+138
+58
+49
+137
+57
+48
+136
+56
+49
+135
+56
+51
+136
+57
+52
+133
+58
+52
+128
+60
+51
+125
+61
+51
+125
+61
+52
+125
+61
+51
+125
+61
+51
+125
+61
+49
+125
+61
+51
+124
+60
+48
+124
+60
+48
+124
+61
+46
+126
+60
+46
+126
+58
+45
+125
+57
+44
+125
+56
+41
+126
+54
+42
+126
+54
+42
+131
+57
+46
+131
+57
+46
+135
+57
+45
+137
+57
+46
+141
+57
+46
+145
+59
+46
+149
+60
+46
+150
+61
+45
+146
+57
+41
+145
+58
+41
+141
+58
+42
+138
+59
+42
+135
+59
+43
+131
+60
+42
+128
+59
+43
+126
+59
+42
+128
+56
+42
+128
+56
+44
+126
+54
+42
+125
+53
+41
+124
+52
+40
+122
+52
+40
+122
+52
+42
+121
+53
+42
+117
+50
+41
+118
+54
+44
+118
+56
+45
+114
+54
+43
+111
+51
+41
+111
+53
+42
+115
+58
+47
+120
+64
+51
+138
+80
+66
+134
+78
+63
+129
+78
+61
+130
+81
+64
+133
+86
+70
+137
+88
+73
+142
+85
+74
+145
+82
+73
+146
+79
+73
+151
+84
+78
+147
+84
+79
+145
+92
+86
+138
+102
+90
+110
+91
+74
+80
+75
+55
+69
+75
+49
+65
+78
+48
+75
+90
+57
+87
+103
+67
+96
+114
+74
+103
+121
+79
+100
+122
+76
+86
+108
+62
+71
+93
+47
+65
+86
+45
+55
+72
+36
+49
+64
+33
+54
+66
+42
+61
+70
+53
+60
+68
+57
+56
+61
+54
+55
+58
+51
+57
+59
+46
+59
+60
+46
+54
+56
+45
+57
+60
+49
+63
+67
+53
+55
+64
+45
+55
+68
+42
+70
+88
+50
+86
+108
+61
+97
+125
+66
+111
+142
+75
+113
+149
+77
+115
+151
+77
+114
+155
+79
+116
+156
+85
+113
+157
+82
+111
+158
+80
+113
+162
+81
+117
+166
+87
+118
+166
+90
+115
+161
+89
+106
+151
+82
+98
+140
+74
+91
+133
+69
+94
+134
+72
+96
+136
+73
+99
+138
+75
+101
+140
+75
+102
+141
+74
+102
+142
+72
+102
+139
+70
+101
+137
+73
+96
+131
+77
+87
+121
+71
+80
+114
+64
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+105
+96
+81
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+98
+86
+108
+99
+84
+108
+99
+84
+108
+99
+82
+108
+100
+81
+108
+100
+79
+108
+100
+79
+108
+100
+77
+108
+100
+77
+108
+100
+79
+108
+100
+79
+108
+100
+81
+108
+99
+82
+108
+99
+84
+108
+99
+84
+108
+99
+84
+110
+98
+84
+109
+97
+83
+109
+97
+83
+109
+97
+83
+109
+100
+85
+108
+99
+84
+106
+97
+82
+103
+96
+80
+100
+93
+77
+96
+89
+73
+90
+83
+67
+85
+78
+62
+80
+75
+56
+77
+72
+53
+73
+68
+49
+69
+67
+46
+65
+69
+42
+71
+67
+40
+92
+65
+44
+137
+83
+71
+175
+92
+88
+169
+63
+65
+169
+49
+51
+203
+74
+78
+195
+64
+69
+189
+61
+62
+185
+59
+60
+195
+71
+71
+216
+90
+91
+229
+101
+102
+221
+88
+91
+205
+71
+72
+209
+74
+71
+207
+69
+66
+205
+66
+63
+206
+67
+62
+210
+71
+66
+210
+71
+66
+206
+67
+62
+201
+62
+55
+207
+68
+61
+209
+68
+61
+210
+68
+64
+212
+69
+65
+214
+69
+66
+217
+69
+67
+220
+67
+69
+222
+68
+70
+222
+63
+67
+223
+64
+68
+222
+66
+69
+223
+69
+69
+225
+71
+71
+224
+70
+70
+224
+66
+67
+225
+62
+63
+232
+66
+68
+234
+64
+67
+232
+62
+65
+231
+61
+62
+228
+62
+62
+228
+64
+63
+226
+67
+64
+223
+69
+67
+215
+65
+66
+200
+56
+56
+184
+52
+48
+177
+58
+52
+169
+62
+54
+155
+61
+51
+146
+60
+47
+142
+63
+50
+137
+59
+47
+136
+58
+48
+136
+58
+48
+136
+56
+49
+136
+55
+51
+138
+55
+51
+137
+56
+52
+136
+59
+53
+128
+58
+50
+126
+59
+50
+126
+59
+50
+124
+60
+50
+124
+60
+48
+124
+60
+48
+124
+60
+48
+124
+60
+48
+120
+56
+44
+121
+57
+45
+124
+58
+46
+124
+58
+46
+125
+59
+45
+125
+59
+45
+125
+57
+44
+125
+57
+44
+126
+58
+47
+127
+57
+47
+128
+55
+46
+129
+55
+44
+132
+54
+42
+133
+53
+42
+134
+55
+42
+134
+55
+40
+138
+56
+42
+136
+57
+42
+136
+59
+43
+133
+60
+45
+132
+60
+45
+128
+61
+44
+126
+60
+44
+125
+59
+43
+125
+57
+44
+125
+55
+45
+124
+54
+44
+121
+53
+42
+122
+52
+42
+120
+52
+41
+120
+52
+41
+120
+53
+44
+114
+50
+40
+117
+53
+43
+118
+56
+45
+114
+54
+43
+110
+52
+41
+110
+53
+42
+116
+59
+48
+120
+66
+54
+138
+85
+71
+132
+80
+66
+128
+79
+64
+132
+83
+68
+136
+87
+73
+140
+86
+74
+140
+82
+71
+141
+78
+71
+149
+84
+78
+148
+85
+78
+139
+82
+75
+132
+88
+77
+127
+100
+83
+101
+90
+68
+71
+75
+50
+61
+74
+44
+73
+88
+57
+90
+107
+73
+103
+120
+84
+99
+120
+81
+89
+110
+69
+83
+104
+61
+78
+99
+56
+74
+95
+52
+58
+76
+38
+48
+63
+30
+44
+57
+29
+53
+62
+41
+61
+67
+53
+60
+66
+56
+58
+60
+55
+57
+60
+53
+59
+61
+50
+59
+61
+48
+55
+57
+46
+57
+60
+49
+63
+67
+53
+56
+63
+45
+56
+66
+41
+69
+85
+49
+85
+104
+59
+97
+122
+67
+110
+138
+77
+114
+147
+78
+114
+150
+78
+114
+154
+81
+115
+157
+83
+113
+157
+82
+114
+160
+85
+117
+163
+88
+118
+164
+91
+116
+162
+90
+111
+154
+85
+102
+144
+78
+94
+136
+72
+91
+131
+68
+100
+140
+78
+97
+137
+75
+96
+135
+72
+99
+138
+73
+102
+141
+74
+103
+142
+75
+101
+138
+69
+97
+133
+69
+96
+131
+77
+87
+121
+71
+80
+114
+64
+105
+96
+81
+105
+96
+81
+105
+96
+81
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+81
+107
+98
+81
+107
+98
+81
+107
+98
+81
+108
+99
+82
+108
+99
+82
+108
+99
+82
+108
+99
+82
+108
+99
+84
+108
+99
+84
+108
+99
+84
+110
+98
+84
+107
+93
+80
+112
+96
+81
+116
+100
+87
+114
+100
+87
+110
+98
+86
+106
+96
+84
+104
+96
+83
+104
+98
+84
+103
+97
+83
+103
+97
+81
+99
+93
+77
+91
+86
+67
+86
+81
+61
+83
+78
+56
+78
+72
+50
+71
+65
+41
+76
+70
+44
+74
+62
+36
+98
+73
+51
+145
+103
+87
+182
+120
+109
+187
+108
+101
+183
+89
+87
+185
+79
+79
+182
+66
+69
+189
+66
+69
+194
+68
+71
+200
+70
+72
+205
+72
+75
+208
+74
+75
+211
+75
+77
+211
+75
+77
+205
+69
+69
+205
+69
+69
+208
+70
+68
+211
+72
+69
+212
+70
+66
+207
+68
+61
+206
+67
+60
+207
+70
+60
+200
+68
+56
+201
+69
+57
+203
+69
+60
+207
+68
+63
+212
+67
+64
+216
+66
+67
+222
+63
+68
+222
+61
+67
+225
+66
+70
+223
+67
+68
+223
+67
+68
+224
+68
+69
+224
+68
+69
+225
+70
+68
+225
+70
+68
+227
+69
+68
+227
+67
+67
+228
+66
+64
+228
+64
+63
+227
+63
+62
+227
+63
+62
+227
+63
+61
+227
+63
+61
+224
+66
+63
+211
+66
+63
+197
+62
+58
+184
+57
+51
+170
+55
+48
+160
+57
+48
+151
+61
+50
+142
+62
+51
+134
+62
+50
+131
+63
+50
+129
+63
+51
+129
+61
+50
+129
+59
+51
+132
+57
+51
+135
+56
+51
+136
+56
+49
+136
+57
+50
+133
+59
+48
+132
+60
+46
+132
+60
+46
+129
+60
+45
+129
+59
+47
+128
+58
+46
+128
+58
+46
+128
+58
+46
+126
+58
+45
+126
+58
+45
+126
+58
+45
+126
+58
+45
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+57
+48
+125
+57
+48
+126
+56
+48
+126
+56
+46
+128
+55
+46
+128
+55
+46
+128
+55
+46
+126
+56
+44
+128
+56
+44
+126
+56
+44
+125
+57
+44
+124
+56
+45
+123
+57
+45
+122
+56
+44
+120
+56
+44
+120
+56
+44
+120
+56
+46
+120
+56
+46
+119
+55
+45
+118
+56
+45
+118
+54
+44
+116
+54
+43
+115
+53
+42
+113
+53
+43
+109
+49
+39
+114
+54
+44
+110
+52
+41
+109
+51
+40
+111
+54
+43
+109
+52
+41
+113
+56
+45
+127
+73
+61
+133
+83
+72
+133
+83
+74
+134
+82
+71
+136
+82
+72
+139
+80
+72
+144
+81
+74
+148
+81
+75
+149
+82
+76
+147
+84
+77
+141
+84
+75
+137
+91
+78
+130
+99
+81
+111
+95
+72
+89
+85
+58
+77
+86
+55
+79
+95
+59
+106
+126
+89
+98
+120
+81
+89
+111
+72
+85
+106
+67
+82
+103
+64
+77
+98
+59
+73
+89
+53
+67
+82
+49
+55
+68
+38
+52
+62
+35
+50
+58
+35
+54
+59
+39
+60
+62
+48
+64
+66
+53
+64
+64
+54
+60
+62
+51
+53
+56
+45
+51
+57
+45
+52
+58
+46
+55
+58
+47
+57
+61
+47
+59
+63
+46
+61
+66
+44
+60
+69
+40
+83
+95
+59
+97
+114
+70
+110
+134
+82
+115
+145
+85
+114
+149
+81
+114
+154
+83
+115
+157
+83
+114
+157
+85
+117
+158
+90
+126
+167
+101
+126
+167
+101
+112
+152
+89
+98
+138
+75
+94
+134
+71
+94
+134
+72
+94
+132
+71
+96
+134
+73
+98
+136
+75
+100
+138
+77
+102
+141
+78
+101
+140
+77
+99
+138
+75
+96
+135
+72
+94
+132
+71
+95
+130
+76
+84
+118
+68
+75
+109
+59
+105
+96
+81
+105
+96
+81
+105
+96
+81
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+110
+98
+84
+114
+98
+83
+113
+97
+82
+114
+98
+85
+113
+99
+86
+114
+102
+90
+111
+103
+90
+109
+101
+88
+106
+100
+86
+103
+99
+87
+107
+104
+89
+111
+105
+89
+108
+103
+84
+104
+99
+79
+99
+94
+72
+91
+85
+61
+82
+76
+52
+80
+74
+48
+72
+62
+37
+81
+63
+41
+107
+80
+61
+127
+88
+71
+132
+78
+66
+136
+69
+61
+147
+68
+63
+177
+87
+86
+184
+84
+84
+187
+81
+81
+192
+80
+79
+192
+78
+77
+193
+77
+77
+194
+76
+74
+194
+76
+74
+205
+85
+84
+197
+73
+71
+192
+62
+62
+195
+61
+58
+205
+67
+64
+209
+70
+65
+205
+66
+59
+199
+62
+52
+202
+68
+57
+202
+68
+57
+204
+70
+61
+208
+69
+62
+214
+69
+66
+219
+66
+68
+223
+64
+69
+224
+63
+69
+223
+67
+70
+223
+67
+68
+223
+67
+68
+223
+69
+69
+224
+69
+67
+224
+70
+68
+225
+70
+68
+225
+70
+68
+224
+69
+65
+225
+67
+64
+224
+66
+63
+224
+65
+62
+226
+64
+61
+226
+64
+61
+226
+64
+61
+224
+66
+63
+213
+68
+63
+200
+67
+60
+186
+62
+54
+172
+58
+48
+160
+57
+48
+148
+58
+47
+138
+60
+48
+130
+60
+48
+128
+65
+50
+126
+64
+51
+126
+62
+52
+127
+60
+51
+131
+58
+51
+134
+57
+49
+136
+56
+49
+137
+57
+48
+135
+59
+46
+133
+60
+45
+132
+59
+44
+132
+59
+44
+131
+59
+45
+130
+58
+44
+130
+58
+44
+130
+58
+44
+127
+57
+45
+127
+57
+45
+127
+57
+45
+127
+57
+45
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+57
+48
+125
+57
+48
+125
+57
+48
+125
+57
+48
+125
+57
+48
+125
+57
+48
+124
+57
+48
+124
+57
+48
+124
+57
+48
+122
+58
+48
+122
+58
+48
+121
+57
+47
+121
+57
+47
+121
+57
+47
+119
+57
+46
+119
+57
+46
+119
+56
+47
+119
+56
+47
+116
+56
+46
+115
+55
+45
+114
+54
+44
+114
+54
+44
+112
+54
+43
+112
+54
+43
+107
+49
+38
+113
+55
+44
+109
+52
+41
+108
+51
+40
+111
+54
+43
+108
+51
+40
+112
+55
+44
+126
+72
+62
+132
+82
+73
+133
+83
+76
+136
+81
+74
+139
+80
+74
+144
+81
+76
+148
+80
+77
+149
+81
+78
+148
+83
+79
+138
+79
+71
+133
+83
+72
+128
+91
+75
+123
+101
+80
+115
+105
+80
+104
+107
+76
+102
+113
+81
+103
+120
+84
+94
+116
+77
+88
+110
+71
+80
+102
+63
+76
+97
+58
+75
+95
+58
+75
+92
+58
+71
+86
+55
+67
+80
+52
+60
+70
+45
+56
+64
+41
+54
+59
+39
+55
+58
+41
+60
+61
+47
+63
+64
+50
+62
+62
+50
+59
+61
+48
+52
+58
+48
+51
+59
+48
+53
+59
+49
+54
+60
+48
+58
+60
+47
+60
+63
+46
+62
+65
+44
+62
+68
+42
+81
+91
+57
+94
+109
+68
+107
+129
+82
+112
+140
+82
+112
+147
+83
+113
+153
+82
+115
+157
+83
+115
+158
+86
+120
+159
+94
+124
+162
+101
+120
+158
+97
+107
+145
+84
+96
+134
+73
+93
+131
+70
+93
+131
+70
+92
+130
+69
+96
+134
+73
+97
+135
+74
+99
+137
+76
+101
+139
+78
+100
+138
+77
+98
+136
+75
+96
+134
+73
+94
+132
+73
+93
+127
+76
+82
+116
+66
+73
+107
+57
+105
+96
+81
+105
+96
+81
+105
+96
+81
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+110
+98
+84
+113
+100
+84
+111
+95
+80
+109
+93
+80
+109
+95
+82
+113
+101
+89
+111
+103
+92
+108
+100
+89
+104
+98
+86
+102
+98
+87
+112
+108
+96
+123
+120
+105
+126
+123
+106
+127
+121
+105
+122
+117
+98
+112
+105
+86
+101
+96
+74
+84
+84
+60
+70
+70
+46
+67
+62
+40
+77
+66
+46
+83
+64
+47
+85
+56
+40
+93
+55
+42
+108
+61
+51
+110
+55
+48
+117
+57
+49
+126
+59
+53
+135
+64
+58
+146
+73
+66
+155
+80
+74
+165
+88
+80
+171
+91
+82
+185
+94
+89
+183
+84
+78
+181
+72
+69
+186
+67
+63
+198
+68
+66
+206
+71
+67
+210
+68
+64
+207
+64
+58
+208
+65
+59
+209
+66
+60
+211
+68
+62
+213
+70
+64
+215
+70
+67
+219
+69
+70
+222
+68
+70
+222
+68
+70
+222
+68
+68
+222
+68
+68
+222
+68
+68
+221
+69
+68
+223
+69
+69
+222
+70
+69
+223
+69
+67
+223
+69
+67
+222
+68
+66
+222
+68
+66
+221
+68
+63
+220
+67
+62
+221
+66
+61
+221
+66
+61
+221
+66
+61
+220
+67
+62
+214
+69
+64
+206
+69
+63
+195
+66
+60
+179
+62
+53
+162
+58
+49
+148
+56
+45
+136
+57
+44
+131
+59
+45
+130
+64
+50
+127
+64
+49
+126
+62
+50
+127
+61
+49
+131
+58
+49
+134
+57
+49
+135
+56
+49
+136
+58
+48
+135
+59
+46
+132
+59
+44
+132
+59
+44
+132
+59
+44
+130
+58
+44
+130
+58
+44
+128
+58
+46
+128
+58
+46
+127
+57
+45
+127
+57
+45
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+57
+48
+125
+57
+48
+125
+57
+48
+125
+57
+48
+124
+57
+48
+123
+56
+47
+123
+56
+47
+123
+56
+47
+123
+59
+49
+123
+59
+49
+122
+58
+48
+121
+59
+48
+120
+58
+47
+120
+58
+47
+120
+58
+47
+120
+58
+47
+116
+56
+46
+116
+56
+46
+115
+55
+45
+115
+55
+45
+114
+54
+44
+113
+53
+43
+111
+53
+42
+111
+53
+42
+106
+49
+38
+111
+54
+43
+109
+52
+41
+107
+50
+39
+108
+54
+42
+105
+51
+39
+109
+55
+43
+125
+71
+61
+135
+80
+73
+135
+80
+73
+139
+80
+74
+142
+81
+76
+145
+82
+77
+146
+83
+78
+148
+85
+80
+145
+86
+80
+140
+87
+79
+135
+91
+80
+126
+94
+79
+116
+98
+78
+111
+105
+81
+111
+114
+85
+108
+119
+89
+102
+119
+85
+81
+101
+66
+75
+95
+58
+69
+89
+54
+68
+85
+51
+69
+86
+54
+71
+86
+57
+71
+84
+56
+69
+82
+56
+63
+73
+48
+60
+68
+45
+57
+62
+42
+55
+59
+42
+58
+60
+46
+60
+62
+48
+59
+61
+47
+57
+59
+46
+54
+60
+50
+53
+61
+50
+54
+60
+50
+54
+60
+48
+58
+60
+47
+60
+62
+48
+61
+64
+45
+61
+67
+41
+77
+87
+53
+90
+105
+64
+102
+124
+77
+108
+136
+78
+110
+145
+81
+113
+153
+82
+117
+159
+85
+116
+159
+87
+122
+161
+96
+119
+157
+96
+110
+148
+87
+99
+137
+76
+92
+130
+69
+92
+130
+69
+92
+130
+69
+90
+128
+67
+95
+133
+72
+97
+135
+74
+98
+136
+75
+100
+138
+77
+99
+137
+76
+97
+135
+74
+95
+133
+72
+93
+131
+72
+91
+125
+74
+80
+113
+66
+70
+103
+56
+105
+96
+81
+105
+96
+81
+105
+96
+81
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+106
+97
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+110
+98
+84
+114
+100
+87
+111
+97
+84
+109
+95
+82
+107
+95
+83
+107
+97
+87
+108
+99
+90
+108
+101
+91
+106
+102
+93
+106
+102
+93
+120
+116
+105
+136
+132
+120
+145
+141
+129
+149
+143
+129
+146
+140
+126
+137
+130
+114
+125
+122
+103
+96
+99
+78
+79
+84
+62
+68
+71
+50
+70
+69
+49
+72
+67
+48
+70
+61
+44
+76
+60
+44
+86
+67
+52
+80
+57
+43
+82
+54
+42
+86
+52
+42
+89
+53
+41
+92
+54
+43
+97
+57
+47
+101
+61
+49
+109
+61
+49
+136
+76
+66
+157
+83
+74
+173
+86
+79
+181
+79
+75
+188
+70
+68
+196
+66
+66
+208
+68
+67
+216
+70
+70
+212
+64
+62
+213
+65
+63
+214
+66
+62
+216
+68
+64
+217
+69
+67
+219
+69
+68
+219
+69
+68
+221
+69
+68
+222
+68
+68
+221
+69
+68
+221
+69
+68
+221
+69
+68
+221
+69
+68
+221
+69
+68
+221
+69
+66
+220
+71
+67
+219
+70
+66
+218
+69
+65
+217
+68
+62
+217
+68
+62
+218
+67
+60
+218
+67
+60
+219
+68
+61
+217
+68
+62
+214
+67
+60
+211
+70
+63
+201
+70
+62
+186
+65
+56
+167
+59
+49
+152
+56
+44
+140
+57
+43
+133
+60
+45
+131
+64
+48
+127
+64
+49
+126
+63
+48
+127
+61
+47
+131
+58
+49
+132
+58
+47
+135
+57
+47
+136
+58
+46
+132
+58
+45
+132
+59
+44
+132
+59
+44
+131
+58
+43
+130
+58
+44
+130
+58
+44
+127
+57
+45
+127
+57
+45
+127
+57
+45
+127
+57
+45
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+57
+48
+124
+57
+48
+125
+57
+48
+123
+56
+47
+123
+56
+47
+123
+56
+47
+123
+56
+47
+120
+56
+46
+123
+59
+49
+121
+59
+48
+121
+59
+48
+121
+59
+48
+120
+58
+47
+120
+58
+47
+120
+58
+47
+118
+58
+47
+115
+55
+45
+115
+55
+45
+115
+55
+45
+114
+54
+44
+113
+53
+43
+111
+53
+42
+111
+53
+42
+109
+52
+41
+106
+49
+38
+111
+54
+43
+108
+51
+40
+104
+50
+38
+107
+53
+41
+104
+50
+38
+108
+54
+42
+124
+70
+60
+138
+79
+71
+140
+79
+74
+141
+80
+75
+143
+82
+77
+144
+83
+78
+145
+86
+80
+144
+87
+80
+140
+90
+81
+137
+93
+82
+133
+97
+85
+121
+95
+80
+105
+90
+71
+100
+95
+73
+100
+104
+79
+92
+102
+75
+78
+93
+64
+69
+85
+56
+65
+81
+52
+61
+77
+48
+60
+75
+46
+63
+77
+51
+67
+81
+55
+70
+82
+58
+71
+83
+59
+66
+76
+52
+62
+71
+50
+58
+65
+47
+57
+61
+44
+57
+61
+46
+57
+61
+46
+56
+60
+45
+55
+59
+45
+55
+61
+51
+54
+61
+53
+54
+59
+52
+54
+60
+50
+58
+60
+49
+59
+61
+47
+60
+63
+44
+60
+65
+42
+74
+83
+52
+86
+101
+62
+98
+120
+73
+106
+134
+76
+110
+145
+81
+115
+155
+84
+119
+161
+87
+120
+162
+90
+123
+162
+97
+114
+152
+91
+101
+139
+78
+92
+130
+69
+90
+128
+67
+92
+130
+69
+92
+130
+69
+90
+128
+67
+95
+133
+72
+96
+134
+73
+97
+135
+74
+98
+136
+75
+97
+135
+74
+96
+134
+73
+94
+132
+71
+93
+131
+74
+90
+124
+74
+78
+111
+64
+69
+102
+55
+104
+97
+81
+104
+97
+81
+104
+97
+81
+105
+98
+82
+105
+98
+82
+106
+99
+83
+106
+99
+83
+106
+99
+83
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+114
+102
+88
+116
+104
+92
+115
+103
+91
+109
+99
+89
+106
+97
+88
+108
+101
+93
+115
+110
+104
+122
+119
+112
+129
+126
+119
+144
+141
+134
+160
+157
+148
+168
+165
+156
+171
+167
+156
+168
+164
+153
+163
+157
+145
+153
+150
+135
+122
+123
+107
+99
+102
+83
+79
+82
+63
+71
+74
+55
+69
+72
+53
+66
+69
+50
+66
+69
+50
+69
+72
+53
+75
+76
+60
+74
+72
+57
+71
+68
+53
+68
+62
+48
+65
+57
+44
+65
+55
+43
+64
+54
+42
+70
+52
+40
+85
+53
+42
+113
+66
+56
+142
+79
+72
+160
+79
+75
+175
+73
+71
+191
+71
+73
+204
+69
+73
+211
+66
+69
+213
+64
+66
+215
+65
+66
+216
+66
+65
+217
+67
+66
+218
+69
+65
+218
+69
+65
+218
+69
+65
+218
+69
+65
+221
+69
+68
+221
+68
+70
+221
+68
+70
+219
+69
+70
+219
+69
+68
+219
+69
+68
+219
+69
+68
+217
+69
+67
+218
+70
+66
+217
+69
+65
+214
+70
+62
+213
+69
+61
+213
+69
+61
+213
+69
+61
+213
+69
+61
+214
+70
+62
+212
+65
+58
+211
+67
+59
+206
+69
+61
+193
+66
+57
+174
+62
+51
+158
+57
+45
+145
+59
+46
+138
+60
+47
+132
+63
+48
+129
+63
+47
+128
+62
+46
+128
+61
+45
+129
+59
+47
+132
+58
+45
+134
+58
+45
+135
+59
+46
+132
+58
+45
+131
+59
+45
+130
+58
+44
+130
+58
+44
+130
+58
+44
+129
+57
+43
+127
+57
+45
+127
+57
+45
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+58
+49
+125
+58
+49
+125
+58
+49
+125
+58
+49
+124
+57
+49
+122
+58
+49
+124
+57
+49
+121
+57
+48
+121
+57
+48
+120
+56
+47
+120
+56
+47
+118
+55
+46
+121
+58
+49
+121
+58
+49
+120
+57
+48
+118
+58
+48
+118
+58
+48
+117
+57
+47
+117
+57
+47
+116
+58
+47
+114
+55
+47
+113
+54
+46
+113
+54
+46
+112
+53
+45
+111
+52
+44
+110
+51
+43
+110
+51
+43
+109
+52
+43
+106
+49
+40
+109
+55
+45
+106
+52
+42
+104
+50
+40
+106
+52
+42
+102
+50
+39
+106
+54
+43
+125
+68
+59
+141
+78
+71
+143
+78
+72
+144
+81
+74
+144
+84
+76
+144
+85
+79
+142
+87
+80
+138
+89
+82
+131
+91
+81
+123
+89
+77
+118
+92
+79
+107
+90
+74
+93
+85
+66
+89
+88
+68
+89
+94
+72
+79
+89
+65
+63
+75
+51
+58
+72
+47
+55
+69
+46
+52
+66
+43
+53
+65
+43
+56
+68
+46
+61
+73
+51
+67
+76
+55
+69
+78
+57
+66
+75
+54
+63
+72
+53
+60
+69
+50
+58
+65
+47
+56
+63
+47
+55
+62
+46
+53
+60
+44
+52
+58
+44
+53
+60
+52
+53
+60
+53
+54
+59
+53
+54
+59
+52
+57
+59
+48
+58
+60
+47
+59
+62
+45
+59
+64
+41
+71
+80
+49
+82
+97
+58
+96
+118
+71
+105
+133
+75
+111
+146
+82
+117
+157
+86
+121
+163
+89
+121
+163
+91
+120
+159
+96
+110
+145
+87
+96
+131
+73
+90
+125
+67
+91
+126
+68
+94
+129
+71
+94
+129
+71
+93
+128
+70
+96
+131
+73
+97
+132
+74
+98
+133
+75
+98
+133
+75
+97
+132
+74
+96
+131
+73
+95
+130
+72
+94
+129
+73
+87
+124
+73
+76
+112
+66
+66
+102
+56
+104
+97
+81
+104
+97
+81
+104
+97
+81
+105
+98
+82
+105
+98
+82
+106
+99
+83
+106
+99
+83
+106
+99
+83
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+107
+97
+85
+110
+100
+90
+112
+102
+92
+108
+99
+90
+107
+100
+92
+114
+109
+103
+132
+129
+124
+145
+144
+140
+167
+163
+160
+181
+177
+174
+196
+193
+188
+201
+198
+193
+201
+196
+190
+197
+192
+186
+192
+185
+177
+185
+178
+168
+164
+156
+143
+136
+130
+114
+102
+99
+84
+80
+81
+63
+70
+73
+56
+62
+69
+51
+59
+68
+49
+58
+70
+50
+56
+69
+51
+56
+69
+51
+56
+67
+50
+58
+66
+51
+60
+66
+52
+64
+67
+56
+67
+69
+58
+71
+69
+57
+64
+52
+40
+83
+56
+47
+104
+61
+54
+129
+68
+65
+163
+79
+79
+192
+87
+91
+204
+81
+86
+202
+67
+73
+211
+71
+74
+214
+70
+70
+216
+70
+70
+218
+70
+68
+219
+70
+66
+219
+70
+66
+220
+68
+63
+220
+68
+65
+221
+69
+68
+221
+68
+70
+219
+69
+70
+219
+69
+70
+218
+68
+67
+218
+68
+67
+218
+68
+67
+217
+69
+67
+217
+69
+65
+215
+70
+65
+214
+69
+64
+212
+69
+61
+211
+68
+60
+210
+69
+60
+211
+70
+61
+212
+69
+61
+212
+63
+56
+213
+64
+57
+208
+67
+58
+198
+67
+57
+182
+65
+55
+165
+61
+48
+150
+61
+47
+140
+61
+46
+134
+62
+47
+130
+63
+47
+129
+62
+46
+128
+61
+45
+129
+60
+45
+131
+59
+45
+132
+58
+45
+133
+59
+46
+130
+58
+44
+130
+58
+44
+130
+58
+44
+130
+58
+44
+129
+57
+43
+127
+58
+43
+127
+57
+45
+126
+56
+44
+126
+58
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+58
+49
+125
+58
+49
+125
+58
+49
+125
+58
+49
+122
+58
+49
+122
+58
+49
+121
+57
+48
+121
+57
+48
+120
+56
+47
+118
+55
+46
+118
+55
+46
+116
+56
+46
+119
+56
+47
+117
+57
+47
+117
+57
+47
+115
+57
+46
+116
+56
+46
+115
+57
+46
+114
+56
+45
+114
+56
+45
+113
+54
+46
+113
+54
+46
+112
+53
+45
+111
+52
+44
+110
+51
+43
+109
+52
+43
+108
+51
+42
+106
+52
+42
+104
+50
+40
+108
+54
+44
+105
+51
+41
+102
+50
+39
+104
+52
+41
+101
+49
+38
+105
+53
+42
+123
+66
+57
+142
+77
+71
+146
+77
+72
+145
+80
+74
+143
+84
+76
+141
+86
+79
+135
+88
+78
+129
+89
+79
+124
+92
+81
+115
+92
+78
+107
+91
+76
+96
+87
+70
+86
+83
+66
+80
+83
+66
+74
+81
+63
+64
+73
+54
+52
+64
+44
+51
+60
+43
+50
+59
+42
+48
+57
+40
+48
+57
+40
+50
+59
+42
+53
+62
+45
+57
+66
+49
+60
+69
+52
+63
+72
+55
+63
+72
+53
+62
+71
+52
+58
+70
+50
+58
+67
+50
+53
+64
+47
+51
+62
+45
+49
+60
+44
+51
+58
+51
+51
+57
+53
+52
+57
+53
+52
+57
+50
+56
+57
+49
+57
+59
+46
+59
+62
+45
+59
+64
+42
+67
+76
+47
+79
+94
+55
+93
+115
+68
+105
+132
+77
+112
+147
+83
+119
+159
+89
+121
+163
+89
+119
+161
+89
+113
+152
+89
+102
+137
+79
+90
+125
+67
+88
+123
+65
+92
+127
+69
+93
+128
+70
+93
+128
+70
+94
+129
+71
+96
+131
+73
+96
+131
+73
+96
+131
+73
+96
+131
+73
+96
+131
+73
+95
+130
+72
+94
+129
+71
+93
+128
+74
+85
+121
+73
+74
+110
+64
+65
+101
+57
+104
+97
+81
+104
+97
+81
+104
+97
+81
+105
+98
+82
+105
+98
+82
+106
+99
+83
+106
+99
+83
+106
+99
+83
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+98
+86
+106
+96
+86
+106
+97
+88
+107
+100
+90
+107
+103
+94
+117
+112
+106
+136
+133
+128
+159
+158
+154
+176
+176
+174
+195
+194
+192
+211
+210
+208
+226
+225
+223
+231
+230
+228
+231
+227
+224
+227
+222
+218
+222
+214
+211
+217
+206
+200
+206
+188
+178
+184
+165
+151
+151
+135
+122
+121
+109
+93
+95
+89
+73
+75
+76
+58
+64
+69
+49
+59
+68
+47
+62
+74
+54
+61
+72
+55
+61
+70
+53
+59
+67
+52
+59
+62
+53
+58
+59
+51
+57
+56
+51
+58
+55
+48
+63
+60
+51
+69
+59
+50
+81
+53
+49
+99
+55
+52
+137
+71
+72
+177
+92
+95
+199
+96
+100
+202
+87
+90
+205
+81
+83
+209
+79
+79
+213
+78
+75
+216
+77
+74
+219
+74
+71
+221
+72
+68
+224
+69
+65
+223
+68
+66
+222
+68
+68
+221
+68
+70
+221
+68
+70
+220
+67
+69
+220
+67
+69
+219
+66
+68
+219
+67
+66
+217
+67
+66
+218
+68
+67
+216
+68
+64
+213
+68
+63
+212
+69
+63
+211
+68
+60
+210
+69
+60
+211
+70
+61
+212
+69
+61
+217
+64
+58
+217
+64
+58
+209
+66
+58
+200
+67
+58
+188
+67
+58
+172
+64
+52
+153
+59
+47
+140
+57
+43
+137
+61
+47
+131
+62
+46
+129
+62
+45
+128
+61
+44
+129
+60
+44
+131
+59
+44
+131
+59
+44
+132
+60
+45
+130
+58
+44
+130
+58
+44
+130
+58
+44
+129
+57
+43
+127
+57
+45
+127
+57
+45
+126
+56
+46
+125
+57
+46
+126
+58
+47
+126
+58
+47
+125
+58
+49
+125
+58
+49
+125
+58
+49
+125
+58
+49
+125
+58
+49
+125
+58
+49
+122
+58
+49
+121
+58
+49
+120
+57
+48
+120
+57
+48
+119
+56
+47
+116
+56
+46
+115
+55
+45
+114
+56
+45
+116
+56
+46
+115
+57
+46
+114
+56
+45
+113
+56
+45
+114
+56
+45
+112
+55
+44
+112
+55
+44
+112
+55
+44
+111
+54
+45
+111
+54
+45
+110
+53
+44
+110
+53
+44
+109
+52
+43
+108
+51
+42
+107
+50
+41
+105
+51
+41
+103
+49
+39
+107
+55
+44
+104
+52
+41
+101
+49
+38
+104
+52
+41
+98
+48
+37
+102
+52
+41
+122
+65
+56
+144
+77
+71
+146
+77
+72
+145
+80
+74
+142
+85
+76
+136
+88
+78
+129
+89
+79
+120
+90
+79
+114
+92
+78
+107
+94
+78
+94
+87
+71
+82
+80
+65
+75
+78
+61
+67
+74
+58
+57
+66
+49
+50
+58
+43
+48
+56
+41
+49
+55
+43
+49
+55
+45
+48
+54
+44
+47
+53
+43
+47
+53
+41
+48
+56
+43
+50
+58
+43
+52
+60
+45
+57
+68
+52
+59
+70
+53
+61
+72
+55
+60
+73
+55
+59
+70
+53
+54
+67
+49
+51
+64
+44
+49
+62
+45
+46
+56
+48
+48
+54
+50
+49
+54
+50
+50
+55
+49
+55
+56
+50
+57
+59
+48
+58
+60
+46
+58
+63
+41
+63
+72
+43
+75
+89
+53
+91
+113
+67
+104
+131
+76
+113
+147
+86
+119
+158
+91
+119
+161
+89
+115
+156
+86
+103
+141
+80
+94
+129
+73
+85
+120
+64
+87
+122
+66
+91
+126
+70
+91
+126
+70
+91
+126
+70
+93
+128
+72
+95
+130
+74
+95
+130
+74
+95
+130
+74
+95
+130
+74
+94
+129
+73
+94
+129
+73
+93
+128
+72
+93
+128
+74
+85
+118
+73
+74
+107
+64
+64
+96
+55
+104
+97
+81
+104
+97
+81
+104
+97
+81
+105
+98
+82
+105
+98
+82
+106
+99
+83
+106
+99
+83
+106
+99
+83
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+105
+98
+82
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+99
+84
+108
+98
+86
+112
+103
+94
+110
+103
+95
+108
+103
+97
+116
+113
+106
+135
+132
+127
+161
+160
+156
+188
+188
+186
+206
+208
+207
+207
+207
+207
+224
+224
+224
+242
+242
+242
+250
+248
+249
+251
+247
+246
+247
+243
+240
+241
+236
+233
+240
+226
+223
+232
+208
+198
+221
+193
+181
+193
+171
+157
+162
+145
+129
+125
+117
+98
+94
+92
+71
+75
+77
+55
+67
+72
+50
+65
+73
+50
+65
+73
+52
+64
+71
+53
+66
+68
+55
+65
+65
+55
+66
+61
+57
+67
+57
+55
+65
+57
+54
+59
+58
+53
+66
+61
+55
+71
+53
+49
+76
+45
+43
+102
+54
+54
+145
+81
+82
+181
+102
+105
+199
+109
+109
+192
+92
+92
+199
+90
+87
+206
+87
+83
+211
+84
+78
+216
+78
+75
+222
+74
+72
+225
+70
+68
+226
+68
+67
+221
+68
+70
+219
+69
+70
+219
+69
+70
+220
+67
+69
+220
+67
+69
+219
+66
+68
+219
+67
+66
+219
+67
+66
+220
+68
+67
+217
+67
+66
+215
+67
+63
+212
+67
+62
+212
+67
+62
+211
+68
+60
+210
+69
+60
+213
+69
+61
+221
+66
+61
+219
+65
+57
+210
+66
+58
+202
+68
+59
+191
+69
+58
+176
+65
+54
+156
+58
+45
+139
+53
+38
+138
+60
+47
+133
+61
+46
+130
+61
+45
+128
+61
+44
+129
+60
+44
+129
+60
+44
+131
+60
+42
+132
+60
+45
+130
+58
+44
+130
+58
+44
+130
+58
+44
+127
+58
+43
+127
+57
+45
+126
+56
+44
+125
+57
+46
+125
+57
+46
+126
+58
+47
+126
+58
+47
+125
+58
+49
+125
+58
+49
+125
+58
+49
+125
+58
+49
+125
+58
+49
+123
+59
+49
+121
+58
+49
+119
+59
+49
+120
+57
+48
+117
+57
+47
+116
+56
+46
+115
+57
+46
+114
+56
+45
+113
+55
+44
+114
+56
+45
+113
+56
+45
+112
+55
+44
+110
+56
+44
+112
+55
+44
+109
+55
+43
+111
+54
+43
+111
+54
+43
+111
+54
+45
+111
+54
+45
+110
+53
+44
+109
+52
+43
+108
+51
+42
+106
+52
+42
+105
+51
+41
+104
+52
+41
+102
+50
+39
+107
+55
+44
+104
+52
+41
+99
+49
+38
+101
+51
+40
+98
+48
+37
+101
+51
+40
+120
+66
+56
+142
+77
+71
+146
+79
+73
+142
+82
+74
+138
+85
+77
+131
+88
+79
+122
+90
+79
+113
+91
+77
+104
+92
+76
+90
+84
+68
+73
+74
+58
+63
+67
+52
+62
+68
+54
+57
+65
+50
+48
+56
+43
+47
+55
+42
+54
+60
+50
+52
+55
+48
+53
+56
+49
+53
+55
+50
+52
+55
+48
+50
+53
+46
+48
+54
+44
+48
+56
+45
+49
+57
+44
+54
+65
+51
+58
+69
+53
+61
+74
+57
+62
+75
+57
+60
+73
+55
+55
+70
+51
+50
+65
+44
+49
+62
+45
+44
+54
+46
+46
+52
+48
+48
+53
+49
+49
+54
+48
+54
+55
+49
+56
+58
+47
+58
+60
+46
+58
+63
+43
+60
+69
+42
+73
+87
+52
+89
+111
+65
+103
+130
+77
+112
+146
+86
+118
+157
+92
+117
+158
+88
+112
+153
+85
+96
+134
+73
+88
+123
+67
+83
+118
+62
+87
+122
+66
+91
+126
+70
+89
+124
+68
+89
+124
+68
+92
+127
+71
+95
+130
+74
+95
+130
+74
+94
+129
+73
+94
+129
+73
+94
+129
+73
+93
+128
+72
+93
+128
+72
+93
+127
+76
+83
+116
+73
+72
+104
+65
+63
+93
+55
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+106
+99
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+108
+100
+87
+105
+98
+90
+103
+100
+93
+118
+115
+110
+147
+146
+142
+175
+175
+173
+196
+198
+197
+218
+220
+219
+234
+238
+239
+243
+244
+246
+246
+247
+249
+252
+252
+254
+255
+255
+255
+255
+255
+253
+255
+251
+250
+252
+247
+244
+253
+242
+236
+247
+225
+212
+242
+216
+199
+224
+202
+181
+198
+182
+159
+170
+160
+135
+136
+132
+105
+98
+98
+70
+69
+72
+45
+68
+72
+47
+67
+71
+48
+70
+69
+49
+71
+68
+53
+70
+60
+51
+67
+54
+48
+70
+52
+50
+73
+57
+57
+65
+60
+57
+66
+61
+58
+70
+56
+55
+75
+54
+53
+101
+69
+70
+147
+105
+106
+198
+147
+146
+233
+172
+169
+211
+140
+136
+199
+119
+112
+191
+96
+90
+195
+86
+81
+210
+82
+79
+219
+77
+76
+225
+71
+73
+225
+69
+72
+220
+70
+71
+220
+74
+75
+217
+68
+70
+210
+60
+62
+215
+62
+64
+225
+72
+74
+225
+71
+73
+216
+62
+64
+218
+64
+64
+218
+64
+64
+217
+65
+64
+215
+66
+62
+215
+66
+62
+212
+64
+60
+209
+64
+59
+211
+64
+57
+222
+67
+62
+219
+65
+57
+211
+64
+57
+202
+65
+57
+190
+66
+56
+176
+64
+53
+159
+58
+46
+144
+56
+42
+140
+61
+48
+135
+62
+47
+131
+62
+46
+129
+62
+45
+128
+61
+44
+127
+60
+43
+129
+61
+42
+129
+60
+44
+127
+58
+43
+127
+57
+45
+127
+57
+45
+126
+56
+44
+126
+56
+46
+124
+56
+45
+124
+56
+45
+124
+56
+45
+124
+57
+48
+124
+57
+48
+124
+57
+48
+124
+57
+48
+122
+58
+49
+122
+58
+49
+122
+58
+49
+122
+58
+49
+121
+61
+53
+119
+60
+52
+119
+59
+51
+117
+58
+50
+116
+57
+49
+113
+56
+47
+112
+55
+46
+112
+55
+46
+111
+54
+45
+109
+55
+45
+109
+55
+45
+108
+56
+45
+109
+55
+45
+108
+56
+45
+109
+55
+45
+109
+55
+45
+105
+50
+43
+109
+54
+47
+112
+57
+50
+111
+56
+49
+107
+52
+45
+103
+50
+42
+103
+50
+42
+104
+51
+43
+101
+48
+40
+105
+55
+46
+100
+50
+41
+93
+45
+35
+96
+48
+38
+95
+47
+37
+98
+50
+40
+115
+62
+54
+140
+79
+74
+143
+80
+75
+136
+81
+74
+129
+82
+74
+125
+89
+77
+118
+95
+81
+102
+89
+73
+84
+78
+62
+68
+69
+53
+62
+69
+53
+58
+67
+50
+53
+64
+48
+52
+60
+47
+51
+59
+48
+52
+58
+48
+52
+58
+48
+54
+56
+51
+55
+56
+51
+54
+54
+52
+52
+54
+49
+51
+53
+48
+49
+54
+47
+47
+54
+46
+46
+54
+43
+46
+57
+43
+50
+61
+45
+54
+67
+50
+58
+71
+54
+58
+73
+54
+56
+71
+52
+52
+67
+46
+49
+63
+46
+42
+52
+43
+44
+50
+46
+45
+50
+46
+46
+51
+45
+52
+53
+47
+55
+57
+46
+58
+60
+47
+58
+63
+43
+54
+62
+38
+68
+82
+49
+87
+108
+67
+104
+130
+82
+115
+148
+93
+119
+158
+95
+114
+155
+87
+107
+148
+82
+91
+126
+68
+88
+121
+68
+84
+117
+64
+84
+117
+64
+87
+120
+67
+90
+123
+70
+91
+124
+71
+90
+123
+70
+94
+127
+74
+98
+131
+78
+98
+131
+78
+94
+127
+74
+92
+125
+72
+95
+128
+75
+96
+129
+76
+94
+126
+77
+83
+113
+75
+70
+100
+66
+61
+88
+55
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+108
+100
+89
+103
+100
+93
+111
+110
+106
+134
+133
+131
+164
+164
+162
+193
+195
+194
+214
+218
+219
+234
+238
+239
+247
+251
+252
+247
+251
+254
+248
+252
+255
+252
+253
+255
+254
+254
+254
+255
+255
+253
+255
+254
+250
+255
+252
+249
+255
+250
+243
+255
+240
+224
+251
+235
+212
+237
+223
+197
+215
+205
+178
+192
+187
+157
+164
+163
+132
+130
+131
+99
+103
+106
+75
+76
+81
+51
+71
+74
+47
+69
+67
+46
+71
+66
+47
+72
+62
+50
+73
+58
+51
+76
+57
+53
+75
+60
+57
+66
+56
+55
+71
+62
+63
+81
+69
+69
+96
+80
+80
+124
+104
+103
+166
+140
+139
+207
+178
+174
+232
+197
+191
+255
+213
+207
+234
+177
+168
+201
+131
+123
+188
+99
+93
+199
+87
+85
+213
+83
+83
+219
+74
+77
+216
+67
+69
+213
+71
+70
+210
+70
+69
+215
+73
+72
+219
+75
+75
+218
+70
+70
+212
+62
+63
+214
+61
+63
+221
+67
+69
+217
+63
+63
+217
+63
+63
+218
+64
+64
+218
+64
+64
+217
+65
+62
+214
+65
+61
+212
+64
+60
+212
+63
+57
+220
+65
+60
+219
+64
+59
+211
+64
+57
+203
+66
+58
+191
+67
+59
+177
+65
+54
+160
+59
+49
+146
+56
+45
+140
+61
+48
+135
+62
+47
+131
+62
+46
+129
+62
+45
+128
+61
+44
+127
+60
+43
+129
+60
+44
+129
+60
+44
+127
+58
+43
+127
+57
+45
+127
+57
+45
+126
+56
+44
+125
+57
+46
+124
+56
+45
+124
+56
+45
+124
+56
+45
+124
+57
+48
+124
+57
+48
+124
+57
+48
+124
+57
+48
+122
+58
+49
+123
+59
+50
+123
+59
+50
+122
+59
+50
+119
+60
+52
+117
+60
+51
+117
+58
+50
+115
+58
+49
+114
+57
+48
+110
+56
+46
+111
+54
+45
+109
+55
+45
+109
+55
+45
+108
+56
+45
+108
+56
+45
+108
+56
+45
+108
+56
+45
+106
+56
+45
+108
+56
+45
+108
+56
+45
+107
+54
+46
+110
+55
+48
+111
+56
+49
+110
+57
+49
+108
+55
+47
+105
+52
+44
+103
+50
+42
+101
+51
+42
+99
+49
+40
+100
+52
+42
+95
+47
+37
+94
+46
+36
+98
+50
+40
+94
+46
+36
+96
+48
+38
+112
+62
+53
+129
+74
+69
+135
+82
+76
+135
+88
+82
+126
+88
+79
+114
+86
+75
+100
+82
+68
+81
+74
+58
+62
+63
+47
+58
+65
+49
+54
+65
+48
+53
+64
+48
+51
+62
+48
+52
+60
+49
+52
+60
+49
+53
+59
+49
+55
+58
+51
+55
+57
+52
+55
+55
+53
+55
+55
+53
+53
+55
+50
+52
+54
+49
+49
+54
+47
+47
+54
+46
+47
+55
+44
+46
+57
+43
+49
+60
+46
+52
+65
+48
+56
+69
+52
+57
+72
+53
+56
+71
+52
+52
+69
+50
+52
+66
+49
+46
+56
+47
+46
+53
+46
+46
+51
+45
+45
+50
+43
+50
+51
+43
+52
+54
+43
+56
+58
+45
+57
+61
+44
+55
+63
+40
+68
+81
+51
+87
+108
+69
+104
+130
+85
+116
+149
+96
+119
+157
+98
+112
+152
+89
+103
+143
+80
+89
+124
+68
+87
+120
+67
+84
+117
+64
+84
+117
+64
+86
+119
+66
+89
+122
+69
+89
+122
+69
+89
+122
+69
+91
+124
+71
+95
+128
+75
+95
+128
+75
+92
+125
+72
+91
+124
+71
+94
+127
+74
+94
+127
+74
+94
+123
+77
+82
+109
+74
+70
+95
+66
+59
+84
+55
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+107
+98
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+110
+101
+86
+110
+101
+86
+108
+102
+90
+101
+100
+95
+121
+123
+120
+151
+153
+152
+178
+182
+183
+205
+209
+210
+228
+233
+236
+244
+249
+252
+250
+255
+255
+251
+255
+255
+252
+255
+255
+253
+254
+255
+254
+254
+254
+255
+254
+252
+255
+255
+251
+255
+255
+250
+255
+255
+244
+254
+252
+231
+250
+249
+221
+239
+240
+209
+225
+229
+196
+210
+216
+180
+188
+196
+159
+160
+168
+131
+135
+145
+108
+96
+103
+69
+81
+88
+55
+68
+71
+44
+68
+67
+46
+74
+68
+52
+76
+68
+55
+75
+65
+56
+73
+62
+58
+68
+58
+57
+84
+74
+75
+107
+95
+95
+130
+118
+118
+157
+146
+144
+192
+178
+175
+219
+206
+200
+234
+220
+211
+248
+228
+217
+255
+240
+229
+255
+224
+214
+234
+167
+159
+190
+101
+97
+177
+67
+68
+198
+72
+75
+219
+86
+89
+216
+88
+85
+207
+79
+76
+202
+70
+66
+204
+69
+66
+210
+70
+69
+214
+70
+70
+216
+68
+68
+217
+67
+68
+214
+61
+63
+216
+62
+64
+217
+63
+63
+217
+63
+63
+217
+65
+64
+214
+64
+63
+213
+65
+61
+213
+64
+58
+217
+64
+58
+217
+64
+58
+210
+66
+58
+203
+69
+60
+192
+68
+60
+178
+66
+55
+161
+60
+50
+147
+57
+46
+142
+60
+48
+137
+61
+48
+131
+62
+47
+129
+62
+46
+127
+61
+45
+126
+60
+44
+128
+61
+45
+128
+61
+45
+127
+57
+45
+127
+57
+45
+126
+58
+47
+125
+57
+46
+125
+57
+46
+124
+56
+45
+123
+56
+47
+123
+56
+47
+125
+58
+49
+125
+58
+49
+123
+59
+50
+123
+59
+50
+123
+59
+50
+123
+59
+50
+122
+59
+52
+120
+60
+52
+116
+59
+50
+113
+59
+49
+114
+57
+48
+111
+57
+47
+110
+56
+46
+108
+56
+45
+108
+54
+44
+107
+55
+44
+108
+56
+45
+106
+56
+45
+106
+56
+45
+106
+56
+45
+106
+56
+45
+105
+57
+45
+106
+56
+45
+106
+56
+45
+110
+57
+49
+109
+56
+48
+109
+56
+48
+109
+56
+48
+109
+56
+48
+105
+55
+46
+102
+52
+43
+99
+49
+40
+100
+50
+41
+97
+49
+39
+93
+45
+35
+95
+48
+38
+99
+52
+42
+92
+45
+35
+95
+48
+38
+115
+68
+60
+125
+80
+74
+129
+86
+80
+126
+89
+81
+112
+84
+73
+94
+74
+63
+79
+67
+55
+63
+60
+45
+52
+54
+40
+50
+59
+42
+48
+59
+43
+49
+60
+46
+50
+61
+47
+52
+60
+49
+52
+60
+49
+53
+59
+49
+55
+58
+51
+55
+57
+52
+55
+57
+54
+54
+56
+51
+53
+55
+50
+53
+55
+50
+50
+55
+48
+48
+55
+47
+48
+56
+45
+46
+57
+43
+48
+59
+45
+50
+63
+46
+54
+67
+50
+55
+69
+52
+56
+71
+52
+56
+71
+52
+57
+70
+53
+52
+62
+51
+51
+58
+50
+47
+52
+45
+44
+50
+40
+47
+48
+40
+49
+51
+40
+53
+55
+42
+54
+58
+41
+54
+62
+39
+68
+81
+53
+89
+109
+74
+107
+132
+90
+119
+151
+102
+119
+156
+102
+108
+147
+90
+95
+135
+75
+87
+120
+67
+87
+117
+67
+84
+114
+64
+84
+114
+64
+86
+116
+66
+88
+118
+68
+89
+119
+69
+89
+119
+69
+90
+120
+70
+93
+123
+73
+95
+125
+75
+93
+123
+73
+93
+123
+73
+95
+125
+75
+94
+124
+74
+90
+119
+75
+78
+101
+72
+65
+87
+64
+54
+76
+53
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+105
+99
+83
+106
+99
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+110
+101
+86
+110
+101
+86
+110
+101
+86
+110
+101
+86
+109
+103
+91
+106
+107
+102
+131
+135
+136
+163
+167
+168
+185
+190
+193
+208
+213
+216
+229
+237
+239
+243
+251
+253
+245
+253
+255
+251
+255
+255
+251
+255
+255
+252
+255
+255
+252
+254
+251
+253
+254
+249
+254
+253
+248
+255
+254
+247
+255
+255
+243
+248
+253
+230
+244
+253
+222
+238
+247
+216
+230
+242
+206
+221
+233
+195
+206
+218
+180
+182
+193
+153
+161
+171
+134
+128
+135
+101
+102
+109
+76
+77
+81
+54
+70
+72
+48
+72
+74
+53
+75
+73
+58
+72
+68
+57
+68
+64
+55
+80
+70
+68
+106
+96
+95
+139
+129
+128
+164
+154
+153
+183
+175
+172
+203
+198
+194
+223
+218
+212
+234
+230
+221
+247
+238
+229
+255
+249
+239
+255
+246
+235
+255
+215
+207
+245
+178
+172
+227
+141
+140
+200
+100
+100
+176
+68
+66
+194
+83
+76
+200
+85
+78
+199
+82
+73
+195
+72
+65
+199
+72
+66
+211
+77
+74
+213
+74
+71
+207
+63
+62
+210
+62
+62
+212
+62
+63
+213
+63
+62
+216
+64
+63
+214
+64
+63
+214
+64
+63
+213
+65
+61
+213
+65
+61
+214
+62
+57
+213
+64
+58
+210
+67
+61
+204
+69
+63
+192
+69
+62
+178
+65
+57
+162
+61
+53
+149
+59
+50
+142
+60
+49
+137
+61
+48
+131
+62
+47
+129
+62
+46
+127
+61
+47
+126
+60
+44
+128
+61
+45
+128
+61
+45
+127
+57
+45
+127
+57
+45
+126
+58
+47
+125
+57
+46
+125
+57
+46
+124
+56
+45
+123
+56
+47
+123
+56
+47
+126
+59
+50
+126
+59
+50
+124
+60
+51
+123
+59
+50
+123
+59
+50
+123
+59
+50
+122
+59
+52
+120
+60
+52
+114
+57
+48
+111
+57
+47
+111
+57
+47
+109
+57
+46
+108
+56
+45
+107
+55
+44
+106
+54
+43
+104
+54
+43
+105
+55
+44
+105
+55
+44
+105
+55
+44
+104
+56
+44
+104
+56
+44
+104
+56
+44
+104
+56
+44
+104
+56
+44
+109
+59
+50
+108
+55
+47
+106
+53
+45
+105
+55
+46
+106
+56
+47
+106
+56
+47
+102
+52
+43
+97
+49
+39
+101
+53
+43
+97
+50
+40
+93
+46
+36
+97
+50
+40
+98
+51
+41
+89
+42
+32
+97
+50
+40
+121
+78
+69
+129
+92
+86
+118
+87
+82
+105
+78
+71
+87
+67
+58
+73
+60
+51
+64
+58
+46
+58
+59
+45
+56
+60
+46
+48
+56
+41
+47
+58
+42
+51
+59
+46
+52
+60
+47
+53
+61
+50
+53
+59
+49
+54
+57
+48
+54
+57
+48
+55
+57
+52
+54
+56
+51
+54
+56
+51
+52
+57
+50
+51
+56
+49
+51
+57
+47
+49
+57
+46
+49
+57
+46
+46
+57
+43
+47
+58
+44
+48
+61
+44
+50
+63
+46
+53
+66
+49
+55
+69
+52
+59
+72
+54
+60
+73
+56
+57
+67
+56
+55
+63
+52
+50
+56
+46
+45
+51
+39
+46
+48
+37
+47
+49
+36
+50
+52
+38
+52
+56
+39
+52
+60
+39
+69
+82
+56
+93
+112
+80
+114
+139
+100
+123
+154
+110
+119
+156
+105
+102
+141
+88
+85
+124
+69
+83
+115
+65
+84
+114
+64
+83
+113
+63
+83
+113
+63
+84
+114
+64
+85
+115
+65
+86
+116
+66
+86
+116
+66
+87
+117
+67
+91
+121
+71
+93
+123
+73
+92
+122
+72
+94
+124
+74
+95
+125
+75
+92
+122
+72
+87
+114
+73
+73
+93
+68
+61
+78
+60
+49
+66
+48
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+105
+99
+83
+106
+99
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+110
+101
+86
+110
+101
+86
+111
+102
+87
+111
+102
+87
+110
+103
+93
+113
+113
+111
+135
+140
+143
+164
+169
+172
+183
+191
+194
+205
+213
+216
+227
+237
+239
+242
+252
+254
+244
+254
+255
+248
+255
+255
+250
+255
+255
+251
+255
+252
+253
+255
+250
+252
+253
+245
+250
+252
+241
+249
+249
+237
+246
+248
+234
+246
+255
+232
+243
+255
+228
+240
+253
+225
+238
+249
+217
+233
+244
+210
+222
+232
+197
+202
+210
+173
+182
+190
+153
+157
+163
+129
+125
+130
+98
+89
+93
+66
+71
+76
+53
+70
+75
+55
+70
+74
+57
+67
+71
+57
+65
+67
+56
+98
+95
+88
+133
+125
+122
+170
+162
+159
+192
+184
+181
+203
+195
+193
+213
+208
+205
+230
+225
+221
+241
+238
+233
+249
+246
+239
+250
+243
+233
+251
+237
+226
+255
+236
+227
+255
+242
+234
+255
+224
+219
+233
+165
+162
+182
+105
+99
+164
+76
+64
+178
+82
+68
+192
+90
+78
+199
+92
+82
+197
+83
+73
+190
+69
+61
+193
+64
+59
+202
+67
+64
+203
+64
+61
+206
+64
+62
+209
+63
+63
+210
+64
+64
+211
+66
+63
+211
+66
+63
+211
+66
+63
+211
+66
+61
+211
+63
+59
+210
+65
+60
+208
+69
+64
+201
+69
+64
+189
+67
+62
+175
+64
+57
+160
+62
+53
+149
+61
+51
+142
+60
+49
+137
+60
+50
+131
+61
+49
+129
+61
+48
+127
+61
+49
+126
+60
+46
+127
+61
+47
+127
+61
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+57
+46
+124
+57
+48
+123
+56
+47
+123
+56
+47
+123
+56
+47
+124
+60
+51
+124
+60
+51
+124
+60
+51
+123
+59
+50
+122
+59
+52
+121
+58
+51
+121
+58
+51
+119
+59
+51
+110
+55
+48
+109
+56
+48
+108
+55
+47
+108
+55
+47
+107
+54
+46
+104
+54
+45
+104
+54
+45
+104
+54
+45
+105
+55
+46
+104
+56
+46
+104
+56
+46
+103
+56
+46
+103
+56
+46
+103
+56
+46
+103
+56
+46
+104
+56
+46
+107
+57
+50
+104
+54
+47
+102
+52
+45
+103
+53
+46
+105
+55
+48
+104
+55
+48
+101
+52
+45
+98
+49
+42
+99
+50
+43
+98
+51
+43
+95
+48
+40
+93
+49
+40
+93
+49
+40
+86
+42
+33
+98
+54
+45
+123
+85
+76
+116
+89
+82
+97
+78
+72
+78
+63
+56
+65
+55
+46
+61
+54
+44
+59
+57
+45
+57
+59
+46
+57
+60
+49
+51
+57
+45
+51
+59
+46
+53
+59
+47
+54
+60
+48
+54
+60
+48
+55
+58
+47
+53
+56
+45
+52
+55
+46
+54
+57
+48
+52
+57
+50
+51
+56
+49
+51
+57
+47
+51
+57
+47
+50
+58
+47
+49
+57
+46
+49
+57
+44
+46
+57
+43
+46
+57
+43
+47
+58
+44
+48
+59
+45
+51
+62
+46
+54
+67
+50
+58
+69
+53
+60
+71
+55
+61
+69
+56
+58
+66
+53
+53
+59
+47
+48
+54
+40
+48
+50
+37
+47
+49
+36
+49
+51
+37
+49
+53
+36
+50
+58
+37
+71
+83
+59
+98
+117
+87
+119
+143
+107
+124
+155
+114
+113
+149
+103
+92
+130
+81
+74
+112
+61
+79
+111
+62
+81
+110
+62
+81
+110
+62
+81
+110
+62
+81
+110
+62
+81
+110
+62
+83
+112
+64
+83
+112
+64
+87
+116
+68
+91
+120
+72
+93
+122
+74
+93
+122
+74
+95
+124
+76
+95
+124
+76
+90
+119
+71
+82
+108
+69
+65
+82
+63
+54
+67
+57
+43
+56
+46
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+105
+99
+83
+106
+99
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+110
+101
+86
+110
+101
+86
+111
+102
+87
+112
+103
+88
+112
+103
+88
+110
+103
+93
+108
+110
+109
+122
+130
+133
+147
+154
+160
+171
+181
+183
+196
+206
+208
+220
+230
+232
+237
+247
+249
+244
+254
+255
+245
+254
+253
+246
+255
+252
+250
+255
+250
+251
+255
+249
+251
+254
+243
+248
+250
+237
+245
+246
+232
+241
+244
+227
+244
+253
+234
+244
+253
+232
+244
+252
+229
+243
+249
+223
+242
+246
+219
+233
+236
+205
+216
+215
+185
+197
+196
+165
+177
+176
+146
+143
+142
+114
+101
+103
+79
+77
+80
+59
+71
+75
+58
+70
+77
+61
+71
+79
+66
+74
+82
+71
+122
+123
+115
+158
+155
+148
+195
+190
+184
+215
+207
+204
+222
+212
+211
+230
+220
+219
+243
+235
+233
+252
+247
+244
+243
+240
+235
+254
+251
+244
+255
+255
+246
+255
+251
+241
+255
+243
+234
+255
+237
+229
+255
+226
+218
+255
+210
+199
+212
+143
+127
+181
+100
+81
+162
+75
+58
+178
+85
+70
+190
+88
+74
+182
+71
+60
+182
+63
+55
+199
+74
+68
+199
+67
+62
+202
+67
+63
+205
+66
+63
+208
+66
+64
+208
+66
+62
+208
+66
+62
+208
+66
+62
+208
+65
+61
+210
+65
+60
+210
+67
+63
+206
+68
+65
+197
+68
+63
+184
+65
+61
+170
+61
+56
+158
+59
+53
+149
+60
+52
+142
+59
+51
+137
+60
+50
+131
+61
+51
+129
+61
+50
+127
+61
+49
+126
+60
+48
+127
+61
+49
+127
+61
+47
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+57
+46
+124
+57
+48
+123
+56
+47
+123
+56
+47
+123
+56
+47
+124
+60
+51
+123
+59
+50
+123
+59
+50
+122
+58
+49
+121
+58
+51
+120
+57
+50
+119
+56
+49
+117
+57
+49
+110
+55
+48
+108
+55
+47
+108
+55
+47
+106
+56
+47
+105
+55
+46
+105
+55
+46
+104
+54
+45
+103
+55
+45
+103
+55
+45
+103
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+104
+55
+48
+104
+54
+47
+103
+53
+46
+103
+53
+46
+103
+54
+47
+104
+55
+48
+103
+54
+47
+102
+53
+46
+97
+50
+42
+101
+54
+46
+94
+50
+41
+92
+48
+39
+96
+52
+43
+97
+53
+44
+105
+61
+52
+117
+83
+74
+88
+71
+64
+69
+62
+54
+60
+53
+47
+57
+53
+44
+59
+56
+47
+56
+58
+47
+53
+55
+44
+51
+54
+43
+54
+57
+46
+53
+59
+47
+55
+58
+47
+54
+57
+46
+54
+57
+46
+53
+56
+45
+53
+55
+44
+51
+54
+43
+50
+56
+44
+49
+57
+44
+50
+56
+46
+49
+57
+44
+49
+57
+46
+49
+57
+44
+49
+57
+44
+49
+57
+44
+46
+57
+43
+46
+57
+43
+46
+57
+43
+47
+58
+44
+48
+59
+43
+51
+62
+46
+54
+65
+49
+55
+66
+50
+60
+68
+53
+58
+67
+50
+56
+63
+47
+53
+59
+45
+52
+54
+41
+50
+52
+39
+49
+51
+37
+48
+52
+37
+48
+55
+37
+72
+84
+62
+101
+120
+92
+117
+141
+109
+116
+146
+108
+102
+137
+95
+82
+119
+75
+66
+104
+57
+75
+107
+60
+78
+107
+59
+80
+109
+61
+80
+109
+61
+78
+107
+59
+78
+107
+59
+79
+108
+60
+81
+110
+62
+86
+115
+67
+90
+119
+71
+93
+122
+74
+94
+123
+75
+95
+124
+76
+95
+124
+76
+86
+115
+67
+78
+102
+66
+59
+73
+56
+48
+59
+51
+38
+47
+42
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+105
+99
+83
+106
+99
+83
+107
+98
+83
+107
+98
+83
+108
+99
+84
+108
+99
+84
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+109
+100
+85
+110
+101
+86
+110
+101
+86
+111
+102
+87
+112
+103
+88
+113
+104
+89
+111
+104
+94
+104
+105
+107
+109
+116
+122
+133
+140
+148
+163
+172
+177
+191
+200
+205
+211
+222
+226
+229
+240
+242
+240
+252
+252
+242
+252
+251
+245
+254
+249
+248
+255
+247
+250
+255
+246
+252
+255
+242
+250
+253
+236
+248
+249
+231
+246
+247
+231
+246
+246
+234
+247
+247
+235
+250
+247
+232
+252
+246
+230
+253
+245
+226
+247
+236
+214
+231
+216
+195
+213
+198
+175
+192
+177
+154
+158
+147
+125
+117
+110
+91
+90
+87
+70
+80
+81
+67
+83
+86
+75
+91
+98
+90
+99
+109
+100
+146
+154
+141
+176
+179
+168
+210
+207
+198
+230
+223
+217
+242
+228
+227
+249
+235
+235
+255
+241
+244
+255
+248
+249
+255
+253
+251
+255
+251
+248
+249
+248
+243
+247
+247
+237
+251
+249
+237
+255
+252
+240
+255
+253
+241
+255
+249
+234
+255
+224
+203
+234
+168
+144
+183
+111
+89
+168
+87
+68
+174
+85
+69
+183
+82
+70
+185
+77
+65
+191
+74
+65
+195
+71
+63
+198
+69
+63
+202
+69
+64
+203
+68
+64
+205
+68
+62
+204
+67
+61
+203
+66
+60
+204
+65
+60
+209
+67
+63
+208
+69
+64
+204
+69
+65
+194
+67
+61
+179
+61
+57
+166
+59
+53
+156
+59
+53
+149
+60
+54
+140
+60
+51
+135
+61
+52
+133
+60
+53
+129
+61
+52
+127
+60
+51
+126
+60
+48
+127
+61
+49
+127
+61
+49
+126
+58
+47
+126
+58
+47
+126
+58
+47
+125
+57
+46
+124
+57
+48
+123
+56
+47
+123
+56
+47
+123
+56
+47
+123
+59
+50
+123
+59
+50
+121
+58
+51
+120
+57
+50
+119
+56
+49
+118
+55
+48
+118
+55
+48
+115
+55
+47
+110
+55
+48
+106
+56
+47
+106
+56
+47
+106
+56
+47
+106
+56
+47
+104
+56
+46
+104
+56
+46
+104
+56
+46
+103
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+100
+56
+45
+100
+56
+45
+100
+56
+45
+102
+55
+45
+103
+54
+47
+104
+55
+48
+105
+56
+49
+105
+56
+49
+104
+55
+48
+105
+56
+49
+106
+59
+51
+108
+61
+53
+103
+56
+48
+107
+60
+52
+98
+54
+45
+97
+53
+44
+111
+67
+58
+120
+76
+67
+116
+73
+64
+110
+77
+68
+67
+57
+48
+53
+54
+46
+52
+53
+47
+56
+57
+49
+56
+59
+50
+52
+55
+46
+49
+52
+43
+50
+53
+44
+53
+56
+45
+53
+56
+45
+53
+55
+44
+52
+54
+43
+52
+54
+43
+52
+54
+43
+52
+54
+41
+51
+55
+41
+47
+55
+40
+46
+57
+41
+48
+56
+43
+46
+57
+41
+46
+57
+43
+46
+57
+41
+48
+56
+41
+48
+56
+41
+49
+57
+42
+48
+56
+41
+48
+56
+43
+47
+55
+42
+48
+56
+43
+49
+57
+44
+51
+59
+46
+52
+60
+45
+57
+66
+49
+58
+67
+48
+59
+66
+48
+58
+65
+49
+58
+60
+46
+54
+56
+42
+50
+52
+38
+47
+51
+36
+50
+57
+39
+73
+85
+63
+99
+117
+91
+109
+132
+103
+102
+132
+98
+87
+121
+84
+73
+110
+69
+63
+100
+56
+72
+103
+59
+76
+105
+59
+78
+107
+61
+78
+107
+61
+76
+105
+59
+76
+105
+59
+77
+106
+60
+79
+108
+62
+85
+114
+68
+89
+118
+72
+91
+120
+74
+93
+122
+76
+94
+123
+77
+92
+121
+75
+81
+110
+64
+71
+95
+59
+54
+66
+52
+43
+52
+47
+34
+40
+38
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+103
+100
+83
+105
+99
+83
+106
+99
+83
+106
+99
+83
+106
+98
+85
+108
+98
+86
+108
+98
+86
+109
+99
+87
+109
+100
+85
+109
+100
+85
+109
+100
+85
+108
+101
+85
+109
+102
+86
+110
+103
+87
+111
+103
+90
+110
+104
+92
+111
+104
+94
+109
+106
+101
+107
+111
+114
+109
+116
+122
+131
+138
+144
+165
+174
+179
+195
+204
+209
+213
+223
+225
+230
+238
+241
+244
+252
+254
+244
+253
+250
+247
+253
+249
+249
+254
+247
+250
+255
+244
+252
+255
+242
+252
+255
+241
+252
+255
+238
+253
+254
+240
+251
+248
+239
+254
+250
+241
+255
+249
+239
+255
+250
+237
+255
+249
+233
+255
+242
+223
+239
+224
+203
+221
+206
+183
+193
+178
+155
+162
+151
+129
+124
+117
+98
+98
+95
+78
+88
+90
+76
+93
+99
+87
+109
+119
+110
+124
+134
+125
+165
+173
+162
+187
+193
+181
+215
+215
+207
+235
+230
+226
+250
+238
+238
+255
+244
+244
+255
+245
+247
+254
+244
+245
+253
+247
+247
+250
+249
+247
+250
+252
+247
+251
+255
+249
+250
+253
+244
+244
+247
+238
+247
+249
+238
+255
+252
+239
+255
+242
+225
+255
+242
+224
+250
+201
+184
+188
+129
+113
+157
+85
+71
+171
+85
+72
+183
+85
+74
+177
+69
+59
+192
+74
+64
+198
+71
+64
+201
+70
+62
+202
+69
+62
+202
+67
+61
+201
+66
+60
+199
+66
+59
+200
+65
+59
+207
+70
+62
+205
+71
+62
+199
+71
+62
+188
+67
+59
+173
+62
+53
+159
+58
+50
+149
+59
+51
+145
+62
+54
+138
+61
+53
+132
+62
+52
+130
+62
+53
+129
+61
+52
+127
+60
+51
+126
+60
+48
+128
+60
+49
+128
+60
+49
+126
+58
+47
+126
+58
+47
+126
+58
+49
+125
+57
+48
+124
+57
+48
+123
+56
+47
+123
+56
+47
+123
+56
+47
+122
+58
+49
+122
+58
+49
+120
+57
+50
+119
+56
+49
+118
+55
+48
+117
+54
+47
+117
+54
+47
+113
+54
+46
+109
+56
+48
+107
+57
+48
+106
+56
+47
+106
+56
+47
+105
+57
+47
+105
+57
+47
+105
+57
+47
+104
+56
+46
+103
+55
+45
+102
+55
+45
+103
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+102
+55
+45
+102
+53
+46
+106
+56
+49
+109
+59
+52
+107
+58
+51
+106
+57
+50
+106
+58
+48
+109
+62
+52
+111
+67
+56
+108
+64
+53
+111
+68
+59
+100
+60
+50
+99
+61
+50
+122
+86
+74
+134
+100
+90
+121
+87
+77
+98
+76
+65
+62
+58
+49
+51
+56
+49
+52
+57
+50
+55
+60
+53
+52
+58
+48
+47
+53
+43
+50
+53
+44
+57
+60
+51
+51
+54
+43
+50
+53
+42
+50
+52
+41
+48
+51
+40
+49
+51
+40
+50
+53
+42
+52
+54
+43
+52
+55
+44
+46
+54
+41
+44
+55
+41
+47
+55
+42
+45
+56
+42
+47
+55
+42
+47
+55
+42
+47
+55
+42
+47
+55
+42
+49
+57
+44
+48
+56
+43
+48
+56
+45
+47
+55
+44
+47
+55
+44
+47
+55
+44
+48
+56
+45
+48
+56
+43
+55
+63
+48
+57
+66
+49
+60
+69
+52
+61
+68
+52
+59
+65
+51
+56
+60
+46
+50
+54
+39
+45
+52
+36
+50
+59
+42
+74
+86
+66
+99
+114
+91
+104
+124
+97
+93
+118
+88
+79
+109
+75
+70
+102
+65
+65
+97
+58
+72
+100
+59
+75
+104
+60
+78
+107
+63
+78
+107
+63
+75
+104
+60
+74
+103
+57
+76
+105
+61
+78
+107
+61
+84
+113
+69
+87
+116
+72
+90
+119
+75
+91
+120
+76
+93
+122
+78
+90
+118
+77
+78
+106
+65
+67
+91
+59
+50
+62
+52
+41
+47
+47
+31
+37
+37
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+100
+86
+106
+100
+86
+106
+100
+88
+108
+100
+89
+108
+99
+90
+109
+101
+90
+109
+101
+88
+109
+102
+86
+103
+96
+78
+106
+101
+82
+110
+107
+88
+111
+108
+93
+104
+101
+92
+102
+101
+97
+115
+113
+114
+129
+130
+134
+137
+142
+146
+149
+157
+160
+170
+178
+181
+194
+199
+202
+215
+220
+223
+233
+237
+238
+245
+246
+248
+248
+250
+249
+252
+254
+253
+254
+254
+252
+255
+255
+250
+253
+254
+246
+250
+253
+242
+249
+252
+241
+250
+253
+242
+251
+254
+243
+249
+250
+242
+250
+250
+242
+249
+249
+237
+252
+250
+235
+254
+252
+231
+249
+247
+222
+233
+229
+202
+213
+212
+182
+186
+185
+155
+152
+152
+124
+113
+116
+89
+95
+100
+77
+98
+107
+88
+114
+125
+108
+132
+144
+130
+145
+155
+144
+180
+185
+178
+202
+204
+199
+226
+227
+222
+240
+239
+235
+247
+243
+242
+251
+247
+246
+253
+249
+248
+252
+248
+247
+255
+254
+252
+254
+254
+252
+254
+254
+252
+253
+255
+250
+254
+255
+250
+254
+255
+250
+254
+255
+250
+254
+255
+250
+251
+253
+248
+255
+253
+248
+255
+251
+246
+255
+229
+223
+215
+166
+159
+163
+96
+88
+155
+68
+61
+178
+75
+66
+193
+79
+69
+195
+71
+61
+198
+67
+57
+201
+68
+59
+205
+72
+63
+206
+73
+64
+203
+72
+64
+202
+71
+61
+198
+71
+56
+195
+72
+56
+190
+73
+56
+181
+71
+56
+166
+69
+53
+154
+66
+52
+144
+66
+53
+139
+67
+53
+133
+67
+53
+129
+67
+54
+127
+65
+52
+127
+63
+51
+128
+62
+50
+128
+60
+49
+129
+59
+49
+129
+59
+49
+127
+57
+49
+126
+58
+49
+124
+57
+49
+123
+56
+48
+122
+55
+47
+122
+55
+47
+119
+55
+46
+118
+54
+45
+119
+55
+46
+119
+55
+46
+119
+56
+47
+119
+56
+47
+118
+55
+46
+117
+54
+45
+113
+53
+43
+110
+51
+43
+108
+55
+47
+105
+56
+49
+105
+56
+49
+104
+55
+48
+104
+55
+48
+103
+54
+47
+103
+54
+47
+103
+54
+47
+102
+53
+46
+103
+54
+47
+105
+55
+48
+105
+56
+49
+104
+55
+48
+103
+54
+47
+101
+52
+45
+101
+51
+44
+104
+51
+45
+106
+53
+47
+109
+56
+48
+107
+57
+48
+106
+58
+48
+105
+59
+46
+105
+61
+48
+107
+65
+51
+103
+66
+50
+106
+73
+58
+100
+72
+58
+118
+95
+79
+126
+107
+92
+138
+120
+106
+140
+127
+111
+82
+74
+61
+55
+57
+46
+52
+58
+48
+52
+58
+48
+51
+57
+47
+51
+57
+47
+51
+57
+47
+50
+56
+46
+50
+56
+46
+49
+55
+45
+49
+55
+45
+51
+54
+45
+48
+54
+44
+50
+53
+44
+47
+53
+43
+49
+52
+43
+47
+53
+43
+47
+52
+45
+46
+53
+45
+47
+52
+45
+46
+53
+45
+47
+52
+45
+47
+52
+45
+47
+52
+45
+47
+52
+45
+48
+53
+46
+47
+52
+45
+47
+52
+45
+46
+51
+44
+46
+51
+44
+47
+52
+45
+47
+52
+45
+47
+54
+46
+49
+59
+50
+51
+61
+50
+54
+64
+53
+56
+66
+55
+57
+68
+54
+55
+66
+52
+53
+64
+48
+51
+62
+45
+52
+63
+46
+68
+81
+61
+87
+101
+78
+91
+107
+81
+80
+98
+72
+69
+88
+60
+64
+84
+56
+66
+87
+54
+73
+99
+62
+75
+101
+62
+75
+102
+61
+75
+102
+61
+74
+101
+60
+74
+101
+58
+76
+103
+62
+79
+106
+63
+85
+112
+71
+89
+116
+75
+92
+118
+79
+93
+119
+80
+93
+119
+82
+87
+113
+78
+72
+98
+63
+59
+79
+54
+37
+48
+42
+38
+43
+46
+36
+41
+44
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+99
+89
+107
+100
+90
+108
+99
+92
+109
+100
+91
+109
+101
+90
+109
+102
+86
+105
+100
+81
+106
+104
+83
+109
+106
+87
+106
+107
+91
+103
+103
+95
+108
+108
+108
+126
+127
+132
+144
+147
+154
+167
+174
+180
+183
+193
+195
+208
+213
+216
+225
+230
+233
+241
+242
+244
+250
+251
+253
+255
+254
+255
+255
+254
+255
+254
+253
+251
+255
+254
+250
+255
+255
+250
+254
+255
+249
+251
+252
+244
+248
+251
+242
+246
+252
+242
+247
+253
+243
+247
+250
+241
+248
+250
+239
+248
+250
+237
+247
+250
+233
+249
+251
+229
+242
+245
+218
+223
+226
+195
+204
+208
+175
+180
+184
+151
+145
+150
+118
+107
+113
+85
+89
+97
+73
+95
+107
+85
+116
+129
+111
+140
+152
+138
+157
+167
+156
+191
+193
+188
+211
+211
+209
+231
+231
+229
+243
+243
+241
+247
+247
+245
+251
+251
+249
+252
+252
+250
+251
+251
+249
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+251
+255
+254
+241
+255
+255
+237
+251
+252
+247
+249
+248
+255
+248
+247
+255
+233
+230
+239
+190
+185
+196
+128
+119
+164
+80
+70
+176
+78
+65
+186
+76
+63
+193
+75
+63
+196
+74
+61
+194
+68
+56
+188
+61
+52
+190
+63
+54
+196
+70
+58
+196
+70
+55
+195
+74
+55
+191
+76
+58
+180
+73
+55
+166
+70
+54
+153
+67
+50
+144
+68
+54
+138
+71
+55
+130
+68
+55
+127
+67
+56
+126
+66
+55
+124
+64
+53
+126
+62
+52
+127
+60
+51
+128
+60
+49
+128
+60
+51
+125
+58
+50
+125
+58
+50
+122
+58
+49
+122
+58
+49
+121
+57
+48
+120
+56
+47
+118
+55
+46
+118
+55
+46
+117
+54
+45
+118
+55
+46
+116
+56
+46
+116
+56
+46
+116
+56
+46
+114
+54
+44
+111
+53
+42
+109
+52
+43
+108
+55
+47
+105
+56
+49
+106
+56
+49
+104
+55
+48
+105
+55
+48
+104
+55
+48
+103
+54
+47
+103
+54
+47
+101
+51
+44
+101
+51
+44
+103
+53
+46
+104
+54
+47
+106
+56
+49
+106
+56
+49
+106
+56
+49
+107
+57
+50
+107
+54
+48
+108
+55
+49
+107
+57
+48
+107
+59
+49
+107
+59
+47
+106
+62
+49
+106
+64
+48
+105
+68
+50
+103
+72
+54
+107
+80
+61
+103
+82
+65
+117
+102
+83
+129
+117
+101
+140
+133
+115
+134
+131
+114
+75
+76
+60
+54
+57
+46
+51
+57
+47
+51
+57
+47
+51
+57
+47
+50
+56
+46
+50
+56
+46
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+47
+53
+43
+47
+53
+43
+47
+53
+43
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+48
+53
+47
+47
+52
+46
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+47
+52
+46
+47
+54
+47
+46
+56
+48
+47
+58
+50
+49
+61
+51
+52
+64
+54
+54
+66
+54
+54
+66
+54
+54
+66
+52
+53
+66
+49
+54
+67
+49
+67
+80
+62
+80
+93
+73
+82
+96
+73
+73
+87
+64
+65
+79
+54
+66
+80
+55
+69
+85
+58
+74
+98
+64
+74
+100
+63
+75
+101
+64
+75
+101
+62
+73
+99
+60
+72
+99
+58
+73
+100
+59
+74
+101
+60
+83
+110
+69
+88
+114
+75
+92
+118
+81
+93
+119
+84
+91
+116
+84
+84
+109
+79
+67
+92
+62
+54
+73
+53
+38
+49
+45
+39
+44
+48
+37
+42
+46
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+99
+89
+107
+100
+90
+108
+99
+92
+109
+100
+91
+109
+101
+90
+109
+102
+86
+109
+104
+85
+107
+105
+84
+109
+106
+87
+106
+107
+91
+107
+107
+99
+119
+119
+119
+145
+146
+151
+167
+172
+178
+190
+197
+203
+209
+219
+221
+235
+240
+243
+246
+251
+254
+253
+254
+255
+254
+255
+255
+255
+254
+255
+255
+253
+254
+254
+253
+251
+255
+254
+250
+255
+255
+250
+253
+254
+248
+250
+251
+243
+245
+248
+239
+241
+247
+235
+241
+247
+235
+244
+247
+236
+245
+249
+235
+246
+248
+234
+245
+248
+229
+245
+247
+225
+238
+238
+212
+219
+219
+191
+201
+202
+171
+176
+177
+146
+147
+150
+121
+117
+121
+96
+107
+112
+90
+116
+123
+105
+136
+144
+129
+159
+167
+156
+174
+181
+173
+205
+207
+202
+222
+222
+220
+239
+239
+237
+248
+248
+246
+251
+251
+249
+254
+254
+252
+254
+254
+252
+253
+253
+251
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+253
+255
+254
+245
+250
+253
+251
+255
+255
+254
+254
+254
+255
+248
+246
+255
+250
+244
+255
+245
+235
+248
+204
+193
+215
+157
+143
+147
+75
+60
+164
+81
+65
+168
+75
+58
+167
+64
+49
+183
+71
+59
+207
+89
+77
+206
+84
+73
+189
+63
+51
+196
+68
+55
+198
+72
+58
+195
+75
+61
+185
+73
+59
+170
+66
+55
+157
+63
+51
+149
+65
+55
+144
+70
+59
+134
+66
+57
+129
+66
+57
+126
+66
+56
+123
+65
+54
+122
+64
+53
+122
+62
+52
+122
+62
+52
+122
+62
+52
+120
+60
+52
+120
+60
+52
+119
+59
+51
+119
+59
+51
+117
+58
+50
+116
+57
+49
+116
+57
+49
+116
+57
+49
+114
+57
+48
+114
+57
+48
+114
+57
+48
+114
+57
+48
+111
+57
+47
+110
+56
+46
+108
+54
+44
+107
+53
+43
+108
+55
+47
+106
+56
+49
+108
+55
+49
+106
+56
+49
+107
+54
+48
+105
+55
+48
+105
+55
+48
+104
+54
+47
+103
+53
+46
+103
+53
+46
+102
+53
+46
+103
+54
+47
+104
+55
+48
+105
+56
+49
+107
+58
+51
+107
+58
+51
+108
+59
+52
+106
+59
+51
+105
+58
+48
+104
+60
+49
+107
+63
+50
+106
+67
+52
+105
+68
+50
+102
+69
+50
+102
+73
+55
+108
+86
+65
+106
+89
+71
+117
+106
+86
+134
+127
+109
+145
+142
+123
+128
+127
+109
+69
+70
+54
+53
+56
+45
+50
+56
+46
+50
+56
+46
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+47
+53
+43
+47
+53
+43
+47
+53
+43
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+46
+51
+45
+45
+50
+44
+45
+50
+44
+46
+51
+45
+47
+52
+46
+46
+53
+46
+43
+53
+45
+43
+54
+46
+45
+57
+47
+47
+59
+49
+50
+62
+50
+52
+64
+52
+54
+66
+52
+55
+68
+51
+56
+69
+51
+63
+76
+58
+69
+82
+62
+67
+81
+58
+59
+73
+50
+56
+70
+45
+62
+76
+51
+68
+84
+57
+74
+95
+64
+74
+98
+64
+76
+100
+66
+75
+99
+63
+73
+97
+61
+71
+96
+57
+70
+95
+56
+71
+96
+57
+82
+107
+68
+88
+112
+76
+93
+117
+83
+94
+118
+86
+90
+113
+84
+80
+103
+75
+61
+84
+56
+46
+65
+46
+38
+49
+45
+39
+44
+48
+37
+42
+46
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+99
+89
+107
+100
+90
+108
+99
+92
+109
+100
+91
+109
+101
+90
+109
+102
+86
+110
+105
+86
+108
+106
+85
+108
+107
+87
+108
+109
+93
+112
+113
+105
+128
+130
+129
+158
+161
+166
+185
+190
+196
+195
+202
+208
+218
+228
+230
+244
+249
+252
+250
+255
+255
+251
+252
+254
+251
+252
+254
+253
+251
+252
+251
+250
+248
+255
+254
+252
+255
+255
+251
+255
+254
+249
+251
+252
+244
+245
+246
+238
+238
+241
+230
+233
+239
+227
+231
+237
+223
+237
+241
+226
+240
+244
+229
+241
+244
+227
+241
+244
+223
+242
+241
+220
+234
+234
+208
+216
+216
+188
+199
+199
+171
+178
+177
+149
+161
+161
+137
+145
+147
+125
+144
+147
+128
+156
+158
+145
+170
+173
+162
+182
+187
+180
+192
+197
+191
+220
+220
+218
+233
+233
+231
+246
+246
+244
+251
+251
+249
+253
+253
+251
+255
+255
+253
+255
+255
+253
+253
+253
+251
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+254
+251
+251
+253
+255
+254
+255
+255
+254
+255
+245
+240
+237
+246
+237
+230
+255
+249
+240
+255
+250
+236
+255
+238
+222
+232
+191
+173
+183
+127
+110
+148
+79
+63
+163
+80
+64
+185
+89
+75
+184
+78
+64
+180
+68
+56
+190
+69
+58
+193
+65
+54
+198
+70
+59
+197
+73
+63
+188
+71
+61
+173
+64
+57
+161
+60
+52
+152
+62
+54
+149
+66
+60
+139
+64
+59
+133
+66
+60
+128
+65
+58
+124
+65
+59
+121
+64
+57
+119
+64
+57
+117
+64
+56
+118
+63
+56
+118
+61
+52
+118
+61
+52
+118
+61
+52
+117
+60
+51
+115
+61
+51
+114
+60
+50
+114
+60
+50
+113
+59
+49
+111
+59
+48
+111
+59
+48
+111
+59
+48
+110
+58
+47
+107
+57
+46
+106
+56
+45
+106
+56
+45
+105
+55
+46
+109
+56
+50
+110
+55
+50
+109
+54
+49
+108
+55
+49
+108
+55
+49
+107
+54
+48
+105
+55
+48
+105
+55
+48
+108
+58
+51
+106
+57
+50
+104
+55
+48
+102
+55
+47
+102
+55
+47
+102
+55
+47
+104
+57
+49
+102
+58
+49
+106
+63
+54
+102
+62
+52
+101
+61
+49
+102
+62
+50
+104
+67
+51
+105
+69
+53
+102
+71
+51
+99
+71
+50
+99
+74
+54
+104
+86
+64
+105
+92
+73
+115
+107
+86
+133
+130
+111
+143
+142
+122
+112
+113
+95
+57
+61
+44
+52
+55
+44
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+48
+54
+44
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+47
+53
+43
+47
+53
+43
+47
+53
+43
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+46
+51
+45
+45
+52
+45
+42
+52
+44
+41
+52
+44
+42
+54
+44
+43
+55
+45
+46
+58
+46
+49
+61
+49
+52
+64
+50
+53
+65
+51
+54
+67
+50
+58
+71
+53
+60
+73
+55
+56
+69
+49
+50
+63
+43
+50
+64
+41
+56
+70
+47
+62
+78
+52
+68
+88
+60
+69
+93
+61
+75
+96
+65
+74
+98
+64
+75
+96
+63
+71
+95
+59
+72
+94
+58
+70
+94
+58
+83
+105
+69
+88
+112
+78
+96
+117
+86
+94
+117
+88
+90
+110
+83
+76
+99
+73
+57
+77
+52
+41
+58
+40
+38
+47
+44
+37
+42
+46
+35
+40
+44
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+99
+89
+107
+100
+90
+108
+99
+92
+109
+100
+91
+109
+101
+90
+109
+102
+86
+108
+103
+84
+107
+105
+84
+110
+109
+89
+111
+112
+96
+116
+117
+109
+133
+135
+134
+164
+167
+172
+191
+196
+202
+205
+212
+218
+229
+239
+241
+251
+255
+255
+251
+255
+255
+250
+251
+253
+252
+253
+255
+255
+253
+254
+253
+252
+250
+255
+255
+253
+255
+255
+251
+254
+253
+248
+247
+248
+240
+239
+240
+232
+231
+234
+223
+224
+230
+218
+222
+229
+213
+231
+235
+218
+234
+239
+219
+237
+240
+219
+236
+240
+217
+238
+238
+214
+232
+232
+208
+218
+216
+191
+204
+202
+177
+194
+189
+167
+183
+181
+160
+177
+174
+157
+182
+180
+167
+193
+190
+181
+201
+200
+195
+210
+211
+206
+217
+217
+215
+232
+232
+230
+242
+242
+240
+250
+250
+248
+252
+252
+250
+253
+253
+251
+255
+255
+253
+255
+255
+253
+252
+252
+250
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+255
+254
+252
+255
+251
+254
+255
+247
+250
+250
+246
+245
+248
+247
+243
+252
+255
+248
+254
+255
+248
+254
+255
+244
+253
+252
+234
+255
+254
+236
+245
+220
+200
+196
+155
+137
+157
+98
+80
+151
+75
+59
+165
+76
+60
+180
+80
+64
+186
+74
+60
+189
+65
+55
+196
+68
+59
+195
+71
+63
+188
+69
+61
+176
+63
+59
+166
+58
+55
+157
+59
+56
+152
+63
+59
+143
+62
+59
+137
+63
+60
+130
+65
+61
+124
+65
+61
+119
+66
+60
+115
+66
+59
+114
+67
+59
+115
+66
+59
+113
+63
+54
+115
+62
+54
+115
+62
+54
+114
+61
+53
+114
+61
+53
+114
+61
+53
+112
+62
+53
+111
+61
+52
+110
+62
+52
+109
+61
+51
+108
+60
+50
+107
+59
+49
+106
+59
+49
+105
+58
+48
+105
+58
+48
+106
+58
+48
+110
+55
+50
+112
+54
+50
+112
+54
+50
+109
+54
+49
+109
+54
+49
+108
+55
+49
+105
+55
+48
+105
+55
+48
+108
+59
+52
+107
+58
+51
+104
+57
+49
+101
+57
+48
+101
+57
+48
+101
+57
+48
+101
+58
+49
+100
+60
+50
+102
+66
+54
+99
+65
+53
+99
+67
+52
+100
+68
+53
+100
+71
+53
+100
+73
+54
+98
+73
+51
+95
+73
+50
+94
+76
+54
+101
+86
+63
+106
+98
+77
+114
+109
+87
+132
+131
+111
+132
+135
+114
+91
+96
+76
+51
+58
+40
+50
+56
+44
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+48
+54
+44
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+47
+53
+43
+47
+53
+43
+47
+53
+43
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+46
+51
+45
+45
+50
+44
+45
+50
+44
+44
+49
+43
+44
+49
+43
+44
+49
+43
+44
+49
+43
+45
+50
+44
+44
+51
+44
+44
+54
+46
+43
+53
+45
+42
+52
+43
+42
+52
+43
+43
+53
+44
+46
+56
+45
+48
+59
+45
+50
+61
+47
+50
+61
+45
+53
+64
+47
+54
+65
+48
+53
+65
+45
+49
+61
+41
+49
+61
+41
+53
+65
+45
+56
+70
+47
+61
+79
+53
+64
+84
+56
+70
+89
+61
+72
+92
+64
+74
+93
+63
+73
+94
+61
+75
+94
+62
+75
+96
+63
+84
+103
+71
+91
+112
+81
+99
+118
+90
+97
+117
+90
+89
+107
+83
+74
+93
+71
+54
+71
+52
+38
+52
+37
+36
+45
+42
+36
+41
+44
+34
+39
+42
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+99
+89
+107
+100
+90
+108
+99
+92
+109
+100
+91
+109
+101
+90
+108
+102
+86
+106
+103
+84
+107
+106
+85
+108
+110
+89
+111
+114
+97
+115
+118
+109
+129
+133
+132
+159
+164
+168
+184
+191
+199
+213
+222
+227
+236
+246
+248
+251
+255
+255
+251
+255
+255
+250
+251
+255
+253
+254
+255
+255
+254
+255
+253
+252
+250
+255
+255
+251
+255
+255
+250
+252
+252
+244
+243
+245
+234
+235
+237
+226
+227
+231
+217
+221
+227
+213
+220
+227
+209
+228
+233
+211
+231
+236
+213
+233
+237
+214
+234
+236
+212
+235
+235
+211
+232
+230
+207
+223
+218
+196
+211
+206
+184
+211
+206
+186
+204
+198
+182
+203
+195
+184
+208
+201
+193
+215
+210
+206
+224
+219
+216
+234
+230
+229
+240
+239
+237
+243
+242
+240
+249
+249
+247
+253
+253
+251
+253
+253
+251
+253
+253
+251
+255
+255
+253
+254
+254
+252
+252
+252
+250
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+255
+253
+252
+255
+252
+253
+255
+246
+247
+253
+249
+248
+254
+255
+253
+249
+255
+253
+246
+255
+250
+237
+255
+243
+240
+254
+239
+235
+242
+226
+255
+255
+237
+255
+236
+217
+204
+166
+147
+163
+106
+87
+161
+90
+70
+170
+87
+69
+173
+76
+59
+182
+70
+58
+188
+70
+60
+189
+70
+62
+185
+70
+63
+178
+66
+62
+169
+61
+58
+161
+59
+57
+153
+59
+57
+149
+61
+60
+142
+62
+61
+133
+63
+61
+125
+64
+59
+120
+65
+60
+115
+66
+59
+112
+68
+59
+112
+68
+59
+112
+63
+56
+113
+63
+54
+113
+63
+54
+113
+63
+54
+113
+63
+54
+112
+62
+53
+111
+63
+53
+111
+63
+53
+111
+64
+54
+110
+63
+53
+109
+62
+52
+107
+60
+50
+104
+60
+49
+104
+60
+49
+104
+60
+49
+108
+60
+50
+111
+56
+51
+113
+54
+50
+112
+54
+50
+112
+54
+50
+109
+54
+49
+108
+55
+49
+106
+56
+49
+105
+56
+49
+104
+55
+48
+103
+56
+48
+101
+57
+48
+101
+58
+49
+100
+60
+50
+101
+63
+52
+102
+64
+53
+100
+66
+54
+94
+66
+52
+97
+71
+56
+99
+76
+58
+100
+77
+59
+99
+77
+56
+96
+75
+54
+93
+75
+51
+93
+77
+52
+93
+81
+57
+98
+88
+63
+109
+104
+82
+115
+115
+91
+128
+131
+110
+118
+123
+101
+70
+79
+58
+52
+61
+42
+51
+57
+45
+50
+56
+46
+50
+56
+46
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+47
+53
+43
+47
+53
+43
+47
+53
+43
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+44
+49
+43
+43
+48
+42
+43
+48
+42
+43
+48
+42
+43
+48
+42
+44
+49
+43
+44
+51
+44
+46
+53
+46
+44
+54
+46
+42
+52
+43
+42
+52
+43
+42
+52
+43
+43
+53
+44
+45
+55
+44
+46
+57
+43
+45
+56
+42
+48
+59
+43
+52
+63
+47
+53
+64
+47
+52
+63
+46
+51
+63
+43
+51
+62
+45
+51
+64
+44
+55
+70
+47
+57
+75
+51
+64
+79
+56
+66
+84
+58
+71
+87
+60
+72
+91
+63
+77
+93
+66
+77
+96
+68
+85
+101
+74
+92
+111
+83
+100
+116
+90
+96
+114
+90
+88
+103
+82
+71
+88
+69
+52
+66
+49
+36
+50
+37
+36
+45
+42
+36
+41
+44
+34
+39
+42
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+100
+86
+106
+100
+86
+106
+99
+89
+107
+100
+90
+108
+99
+92
+109
+100
+91
+108
+102
+90
+108
+102
+86
+108
+105
+86
+108
+107
+86
+107
+109
+88
+107
+110
+93
+108
+114
+104
+121
+127
+125
+149
+157
+160
+174
+183
+190
+209
+218
+223
+233
+242
+247
+251
+255
+255
+248
+253
+255
+248
+249
+253
+254
+255
+255
+255
+254
+255
+249
+248
+246
+255
+255
+251
+254
+253
+248
+249
+249
+241
+241
+243
+232
+233
+235
+222
+227
+231
+216
+223
+230
+214
+224
+232
+211
+228
+233
+210
+231
+237
+211
+232
+236
+211
+231
+233
+209
+232
+232
+208
+231
+229
+206
+224
+219
+199
+215
+208
+190
+218
+211
+195
+217
+209
+198
+222
+212
+203
+230
+221
+216
+238
+228
+227
+243
+233
+234
+250
+241
+244
+255
+249
+251
+250
+249
+247
+254
+254
+252
+255
+255
+253
+253
+253
+251
+253
+253
+251
+255
+255
+253
+255
+255
+253
+252
+252
+250
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+255
+253
+252
+255
+250
+249
+255
+251
+250
+255
+254
+253
+252
+255
+253
+245
+255
+252
+234
+251
+245
+234
+255
+248
+242
+255
+253
+245
+255
+250
+239
+245
+231
+255
+250
+234
+255
+250
+232
+242
+204
+185
+171
+119
+98
+143
+81
+58
+170
+93
+73
+175
+80
+62
+179
+76
+61
+179
+75
+62
+179
+75
+64
+177
+73
+64
+172
+69
+62
+162
+63
+58
+154
+59
+55
+150
+61
+57
+143
+62
+58
+136
+63
+57
+129
+64
+58
+122
+65
+58
+117
+67
+58
+113
+69
+58
+113
+69
+60
+112
+63
+56
+113
+63
+56
+113
+63
+56
+113
+63
+56
+113
+63
+56
+113
+63
+56
+112
+63
+56
+112
+63
+56
+113
+66
+58
+112
+65
+57
+110
+63
+55
+108
+61
+53
+105
+61
+52
+106
+62
+53
+106
+62
+53
+110
+61
+54
+111
+56
+51
+114
+55
+51
+112
+54
+50
+112
+54
+50
+110
+55
+50
+108
+55
+49
+106
+56
+49
+105
+56
+49
+100
+56
+47
+100
+57
+48
+99
+59
+49
+100
+62
+51
+100
+64
+52
+99
+65
+53
+99
+65
+53
+95
+67
+53
+90
+69
+52
+95
+78
+60
+103
+86
+66
+104
+87
+67
+99
+83
+60
+94
+79
+56
+91
+79
+53
+92
+82
+55
+93
+86
+60
+93
+89
+62
+110
+108
+85
+116
+118
+94
+124
+129
+107
+99
+109
+85
+50
+62
+40
+54
+66
+46
+51
+59
+46
+51
+57
+47
+51
+57
+47
+51
+57
+47
+50
+56
+46
+50
+56
+46
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+47
+53
+43
+47
+53
+43
+47
+53
+43
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+44
+49
+43
+44
+49
+43
+43
+48
+42
+42
+47
+41
+42
+47
+41
+43
+48
+42
+44
+49
+43
+43
+50
+43
+45
+52
+45
+43
+53
+45
+42
+52
+44
+42
+52
+44
+43
+53
+44
+43
+53
+44
+44
+54
+43
+45
+55
+44
+44
+54
+43
+47
+58
+44
+50
+61
+47
+54
+65
+49
+55
+66
+50
+55
+66
+49
+53
+64
+48
+52
+63
+46
+50
+63
+45
+52
+67
+46
+58
+71
+51
+61
+76
+53
+65
+79
+56
+68
+84
+58
+74
+88
+63
+76
+92
+66
+84
+98
+73
+92
+107
+84
+99
+113
+90
+94
+109
+88
+85
+98
+80
+68
+82
+65
+50
+62
+48
+35
+47
+37
+38
+47
+44
+38
+44
+44
+36
+42
+42
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+106
+100
+86
+106
+100
+86
+106
+99
+89
+107
+100
+90
+108
+99
+92
+109
+100
+91
+108
+102
+90
+108
+102
+86
+111
+108
+89
+109
+108
+87
+106
+108
+87
+103
+107
+90
+102
+108
+98
+114
+123
+120
+142
+152
+154
+168
+177
+184
+201
+210
+215
+226
+235
+240
+247
+252
+255
+246
+251
+254
+249
+250
+254
+254
+255
+255
+255
+254
+255
+249
+248
+244
+255
+255
+250
+253
+253
+245
+248
+248
+238
+240
+242
+229
+233
+235
+221
+229
+233
+216
+227
+234
+216
+229
+237
+214
+230
+236
+210
+233
+237
+210
+234
+237
+210
+232
+232
+206
+232
+230
+207
+232
+227
+207
+225
+218
+200
+216
+208
+195
+216
+206
+196
+221
+210
+204
+234
+223
+219
+248
+237
+235
+255
+244
+246
+255
+245
+249
+255
+245
+251
+255
+249
+252
+254
+252
+253
+255
+255
+253
+255
+255
+253
+254
+254
+252
+254
+254
+252
+255
+255
+253
+255
+255
+253
+253
+253
+251
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+255
+254
+250
+255
+249
+247
+255
+249
+247
+251
+250
+248
+247
+251
+250
+245
+255
+254
+243
+255
+255
+240
+255
+255
+237
+253
+250
+240
+252
+248
+251
+255
+250
+255
+253
+241
+255
+242
+226
+255
+239
+219
+255
+225
+203
+216
+174
+150
+170
+114
+91
+164
+89
+68
+169
+84
+64
+168
+81
+62
+169
+82
+65
+173
+81
+66
+169
+77
+64
+161
+68
+60
+151
+61
+53
+149
+62
+55
+143
+63
+54
+137
+62
+56
+131
+64
+55
+125
+65
+55
+119
+67
+54
+116
+68
+56
+115
+69
+56
+113
+63
+56
+113
+63
+56
+115
+62
+56
+113
+63
+56
+113
+63
+56
+113
+63
+56
+113
+63
+56
+112
+63
+56
+115
+66
+59
+113
+66
+58
+111
+64
+56
+109
+62
+54
+108
+61
+53
+106
+62
+53
+109
+62
+54
+111
+62
+55
+111
+56
+51
+113
+55
+51
+111
+56
+51
+109
+56
+50
+109
+56
+50
+105
+56
+49
+104
+57
+49
+102
+58
+49
+102
+59
+50
+100
+62
+51
+100
+64
+52
+98
+66
+53
+96
+67
+53
+93
+65
+51
+92
+64
+50
+87
+66
+49
+84
+71
+52
+91
+83
+62
+102
+94
+71
+105
+94
+72
+98
+88
+63
+90
+83
+57
+90
+83
+55
+92
+87
+58
+90
+86
+59
+88
+87
+59
+107
+109
+85
+115
+119
+94
+117
+125
+102
+85
+97
+73
+38
+50
+28
+56
+68
+48
+51
+59
+46
+52
+58
+48
+52
+58
+48
+51
+57
+47
+51
+57
+47
+51
+57
+47
+50
+56
+46
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+48
+54
+44
+47
+53
+43
+47
+53
+43
+47
+53
+43
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+45
+50
+44
+44
+49
+43
+43
+48
+42
+43
+48
+42
+42
+47
+41
+42
+47
+41
+43
+48
+42
+43
+48
+42
+44
+49
+43
+43
+50
+43
+41
+51
+43
+42
+52
+44
+43
+53
+45
+43
+53
+44
+44
+54
+45
+45
+55
+46
+45
+55
+44
+44
+54
+43
+46
+56
+45
+50
+60
+49
+54
+65
+51
+57
+68
+54
+57
+68
+52
+55
+66
+52
+54
+65
+49
+48
+59
+43
+50
+63
+45
+53
+66
+48
+57
+70
+50
+60
+73
+53
+64
+78
+55
+70
+84
+61
+74
+88
+63
+82
+96
+73
+91
+104
+84
+97
+110
+90
+92
+105
+87
+81
+94
+77
+66
+78
+64
+47
+59
+47
+34
+44
+35
+42
+48
+44
+40
+46
+44
+38
+44
+44
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+107
+101
+87
+107
+101
+87
+107
+100
+90
+108
+101
+91
+109
+100
+93
+110
+101
+92
+109
+103
+91
+109
+103
+87
+113
+110
+91
+107
+109
+87
+107
+110
+89
+107
+114
+96
+106
+114
+103
+112
+121
+118
+135
+145
+147
+159
+170
+176
+187
+196
+201
+208
+217
+222
+234
+239
+243
+246
+251
+254
+252
+253
+255
+254
+255
+255
+255
+254
+255
+254
+253
+249
+255
+255
+250
+254
+254
+246
+250
+250
+240
+246
+248
+235
+244
+246
+232
+240
+244
+227
+234
+241
+223
+231
+239
+216
+240
+246
+218
+237
+242
+212
+235
+238
+209
+236
+236
+210
+232
+230
+209
+225
+220
+201
+221
+213
+200
+222
+212
+202
+224
+211
+205
+231
+217
+216
+241
+227
+227
+249
+234
+237
+253
+241
+243
+255
+246
+250
+255
+248
+255
+255
+252
+255
+255
+253
+254
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+255
+250
+255
+254
+250
+255
+255
+251
+255
+255
+253
+254
+255
+255
+252
+255
+255
+250
+255
+255
+249
+254
+255
+249
+253
+255
+254
+255
+255
+254
+253
+251
+254
+249
+243
+255
+248
+238
+255
+249
+233
+255
+248
+226
+255
+241
+217
+255
+232
+207
+182
+132
+105
+162
+100
+75
+147
+83
+58
+155
+87
+64
+165
+93
+71
+160
+83
+65
+154
+75
+58
+155
+76
+61
+142
+63
+50
+141
+63
+50
+135
+63
+51
+128
+60
+47
+121
+59
+46
+116
+60
+45
+115
+63
+49
+115
+66
+52
+114
+61
+53
+114
+61
+55
+116
+61
+56
+115
+62
+56
+117
+64
+58
+117
+64
+58
+116
+63
+57
+113
+63
+56
+115
+65
+58
+113
+64
+57
+113
+64
+57
+113
+64
+57
+112
+63
+56
+110
+63
+55
+111
+62
+55
+111
+62
+55
+107
+57
+50
+109
+56
+50
+108
+58
+51
+108
+59
+52
+108
+59
+52
+104
+60
+51
+103
+60
+51
+99
+61
+50
+99
+63
+51
+94
+62
+49
+100
+71
+57
+99
+71
+57
+84
+61
+45
+78
+57
+40
+77
+56
+39
+64
+49
+30
+87
+81
+59
+80
+78
+55
+75
+73
+48
+79
+75
+50
+93
+89
+62
+105
+101
+74
+101
+97
+68
+86
+85
+55
+88
+88
+60
+93
+96
+67
+111
+115
+90
+122
+128
+102
+100
+108
+85
+61
+73
+49
+45
+57
+35
+50
+62
+42
+52
+60
+47
+53
+59
+49
+52
+58
+48
+52
+58
+48
+52
+58
+48
+51
+57
+47
+51
+57
+47
+51
+57
+47
+51
+57
+47
+51
+57
+47
+51
+57
+47
+50
+56
+46
+49
+55
+45
+49
+55
+45
+49
+55
+45
+48
+54
+44
+49
+54
+48
+49
+54
+48
+48
+53
+47
+48
+53
+47
+47
+52
+46
+47
+52
+46
+47
+52
+46
+47
+52
+46
+44
+49
+43
+44
+49
+43
+44
+49
+43
+44
+49
+43
+44
+49
+43
+44
+49
+43
+43
+48
+42
+43
+48
+42
+46
+53
+46
+45
+52
+45
+45
+52
+45
+44
+51
+44
+45
+52
+45
+45
+52
+44
+46
+53
+45
+46
+53
+45
+43
+50
+42
+45
+52
+44
+48
+55
+47
+53
+61
+50
+57
+65
+54
+61
+69
+56
+63
+71
+60
+63
+74
+60
+55
+66
+50
+53
+64
+47
+51
+62
+45
+49
+61
+41
+50
+62
+42
+57
+69
+47
+66
+78
+56
+73
+85
+63
+79
+91
+71
+86
+98
+78
+93
+104
+87
+89
+100
+84
+76
+87
+73
+60
+70
+59
+47
+57
+46
+41
+51
+42
+42
+48
+44
+41
+47
+43
+40
+46
+44
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+107
+101
+87
+107
+101
+87
+107
+100
+90
+108
+101
+91
+109
+100
+93
+110
+101
+92
+109
+103
+91
+107
+104
+87
+111
+110
+90
+106
+108
+86
+107
+110
+89
+107
+114
+96
+106
+116
+105
+113
+124
+120
+137
+148
+150
+163
+174
+180
+190
+199
+204
+210
+219
+224
+235
+240
+244
+247
+252
+255
+253
+254
+255
+254
+255
+255
+255
+254
+252
+254
+253
+249
+255
+255
+250
+254
+254
+244
+251
+251
+239
+247
+249
+235
+244
+247
+230
+240
+245
+225
+234
+242
+221
+232
+237
+214
+234
+239
+209
+230
+235
+203
+228
+231
+202
+230
+230
+204
+227
+225
+204
+223
+217
+201
+222
+212
+202
+223
+212
+206
+230
+216
+215
+236
+222
+222
+245
+230
+233
+250
+238
+242
+255
+243
+247
+255
+246
+250
+255
+249
+253
+255
+251
+254
+255
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+253
+255
+252
+250
+255
+249
+250
+255
+249
+253
+255
+252
+253
+254
+255
+253
+252
+255
+253
+250
+255
+255
+250
+255
+255
+248
+255
+255
+252
+255
+255
+250
+253
+255
+248
+246
+255
+249
+242
+255
+252
+239
+255
+252
+234
+254
+248
+226
+255
+241
+215
+255
+234
+206
+217
+178
+149
+163
+117
+91
+142
+92
+67
+146
+92
+66
+152
+92
+68
+152
+87
+67
+150
+83
+64
+138
+70
+51
+137
+68
+52
+135
+68
+51
+131
+68
+51
+126
+67
+51
+122
+66
+49
+118
+65
+49
+115
+63
+49
+117
+64
+56
+115
+62
+56
+117
+62
+57
+117
+64
+58
+116
+63
+57
+111
+61
+54
+112
+62
+55
+115
+65
+58
+113
+63
+56
+112
+63
+56
+112
+63
+56
+110
+63
+55
+111
+62
+55
+109
+62
+54
+110
+61
+54
+109
+62
+54
+107
+60
+52
+108
+61
+53
+109
+62
+54
+107
+63
+54
+106
+63
+54
+103
+65
+54
+101
+65
+53
+98
+66
+53
+100
+71
+57
+91
+65
+50
+94
+71
+55
+94
+73
+56
+78
+61
+43
+70
+55
+36
+71
+56
+37
+62
+54
+33
+76
+76
+52
+71
+75
+50
+68
+71
+44
+68
+68
+42
+77
+77
+49
+92
+91
+63
+98
+97
+67
+96
+97
+66
+89
+89
+61
+100
+103
+74
+115
+119
+94
+115
+121
+95
+88
+96
+73
+58
+68
+44
+47
+59
+37
+55
+67
+47
+54
+62
+49
+54
+60
+50
+54
+60
+50
+54
+60
+50
+53
+59
+49
+53
+59
+49
+53
+59
+49
+53
+59
+49
+53
+59
+49
+53
+59
+49
+53
+59
+49
+52
+58
+48
+52
+58
+48
+51
+57
+47
+51
+57
+47
+51
+57
+47
+50
+55
+49
+50
+55
+49
+50
+55
+49
+49
+54
+48
+49
+54
+48
+49
+54
+48
+48
+53
+47
+48
+53
+47
+46
+51
+45
+46
+51
+45
+45
+50
+44
+45
+50
+44
+44
+49
+43
+44
+49
+43
+43
+48
+42
+43
+48
+42
+42
+49
+42
+42
+49
+42
+41
+48
+41
+41
+48
+41
+41
+48
+41
+42
+49
+42
+43
+50
+42
+44
+51
+43
+46
+53
+45
+45
+52
+44
+46
+53
+45
+48
+55
+47
+52
+59
+51
+57
+65
+54
+63
+70
+62
+66
+74
+63
+59
+70
+56
+58
+69
+53
+55
+66
+49
+52
+63
+46
+51
+63
+43
+54
+66
+46
+60
+72
+50
+64
+76
+54
+76
+88
+68
+83
+95
+75
+89
+100
+84
+87
+98
+82
+76
+86
+75
+61
+71
+60
+49
+59
+50
+43
+53
+44
+44
+51
+44
+43
+49
+45
+42
+48
+44
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+107
+101
+87
+107
+101
+87
+108
+99
+90
+109
+100
+91
+109
+100
+93
+110
+101
+92
+109
+103
+91
+107
+104
+87
+109
+108
+88
+105
+109
+86
+106
+111
+89
+107
+116
+97
+105
+117
+105
+113
+125
+121
+138
+152
+153
+165
+178
+184
+191
+202
+208
+212
+221
+226
+237
+242
+246
+247
+252
+255
+252
+253
+255
+253
+255
+254
+255
+254
+252
+254
+253
+248
+255
+255
+247
+253
+253
+243
+250
+251
+237
+247
+250
+233
+244
+247
+228
+239
+244
+222
+231
+239
+216
+229
+235
+209
+226
+231
+201
+222
+225
+194
+221
+221
+193
+222
+222
+198
+222
+219
+200
+221
+215
+203
+224
+213
+207
+228
+217
+215
+237
+225
+225
+242
+230
+234
+249
+237
+241
+254
+243
+247
+255
+246
+250
+255
+248
+251
+255
+249
+252
+255
+252
+252
+255
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+253
+255
+252
+246
+255
+250
+246
+255
+250
+250
+254
+253
+253
+253
+253
+255
+250
+254
+255
+248
+255
+255
+246
+255
+255
+244
+254
+255
+249
+255
+255
+247
+252
+255
+247
+247
+255
+250
+245
+255
+255
+246
+255
+255
+242
+250
+253
+236
+250
+248
+227
+254
+240
+214
+255
+246
+219
+255
+235
+208
+223
+191
+166
+168
+131
+105
+132
+90
+66
+131
+83
+60
+145
+93
+71
+148
+93
+72
+139
+82
+62
+127
+70
+50
+118
+63
+42
+117
+62
+42
+118
+66
+45
+121
+70
+51
+120
+71
+54
+113
+63
+52
+110
+60
+51
+113
+60
+52
+116
+66
+57
+115
+65
+56
+111
+63
+53
+113
+65
+55
+120
+72
+62
+110
+62
+52
+109
+62
+52
+109
+62
+52
+107
+63
+52
+108
+61
+51
+106
+62
+51
+108
+61
+51
+106
+62
+51
+103
+63
+53
+103
+65
+54
+103
+65
+54
+103
+67
+55
+101
+67
+55
+99
+67
+54
+96
+67
+53
+94
+68
+53
+98
+75
+59
+85
+66
+49
+90
+73
+55
+96
+83
+64
+82
+71
+51
+67
+59
+38
+69
+61
+40
+70
+65
+43
+65
+69
+44
+66
+72
+46
+65
+69
+42
+60
+64
+37
+63
+66
+37
+78
+78
+50
+95
+96
+65
+105
+106
+75
+97
+97
+69
+110
+113
+84
+118
+122
+97
+103
+109
+83
+74
+79
+57
+52
+60
+37
+52
+61
+40
+61
+70
+51
+56
+62
+50
+56
+62
+52
+56
+62
+52
+56
+62
+52
+55
+61
+51
+55
+61
+51
+55
+61
+51
+54
+60
+50
+56
+62
+52
+56
+62
+52
+55
+61
+51
+55
+61
+51
+55
+61
+51
+54
+60
+50
+54
+60
+50
+54
+60
+50
+53
+58
+52
+52
+57
+51
+52
+57
+51
+52
+57
+51
+51
+56
+50
+51
+56
+50
+51
+56
+50
+50
+55
+49
+48
+53
+47
+48
+53
+47
+47
+52
+46
+46
+51
+45
+45
+50
+44
+44
+49
+43
+43
+48
+42
+43
+48
+42
+41
+46
+40
+41
+46
+40
+41
+46
+40
+41
+46
+40
+41
+46
+40
+42
+47
+41
+43
+48
+42
+44
+49
+43
+49
+54
+48
+47
+52
+46
+44
+49
+43
+44
+49
+43
+47
+52
+46
+54
+59
+52
+61
+66
+60
+65
+72
+64
+64
+75
+61
+62
+75
+58
+60
+73
+55
+56
+69
+51
+52
+65
+45
+50
+63
+43
+51
+65
+42
+53
+67
+44
+68
+81
+61
+75
+88
+68
+81
+94
+77
+81
+94
+77
+72
+84
+72
+60
+72
+60
+50
+62
+52
+46
+56
+47
+46
+53
+46
+46
+53
+46
+45
+52
+45
+103
+100
+85
+103
+100
+85
+104
+101
+86
+104
+101
+86
+104
+101
+86
+104
+101
+86
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+107
+101
+87
+107
+101
+87
+108
+99
+90
+109
+100
+91
+109
+100
+93
+109
+102
+92
+109
+103
+91
+106
+105
+87
+107
+109
+88
+105
+109
+86
+106
+111
+89
+106
+115
+96
+104
+116
+104
+109
+124
+119
+136
+152
+152
+166
+179
+185
+191
+202
+208
+211
+220
+227
+235
+240
+246
+246
+251
+255
+252
+253
+255
+253
+255
+254
+255
+255
+253
+255
+254
+249
+254
+254
+246
+253
+253
+241
+250
+251
+237
+247
+250
+231
+244
+247
+226
+238
+243
+220
+229
+237
+213
+226
+232
+206
+219
+224
+192
+215
+218
+187
+214
+214
+188
+217
+215
+194
+221
+215
+199
+222
+215
+205
+229
+219
+217
+236
+224
+224
+247
+235
+239
+250
+239
+245
+255
+244
+250
+255
+248
+253
+255
+249
+252
+255
+250
+250
+255
+250
+250
+255
+252
+251
+255
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+253
+255
+252
+247
+255
+253
+247
+255
+253
+250
+254
+253
+253
+253
+253
+255
+251
+253
+255
+248
+254
+255
+246
+253
+255
+244
+250
+255
+248
+251
+255
+247
+250
+255
+248
+248
+255
+252
+249
+255
+255
+248
+255
+255
+248
+250
+255
+244
+250
+252
+238
+255
+255
+237
+255
+248
+228
+253
+238
+219
+255
+239
+219
+255
+239
+217
+238
+210
+188
+176
+144
+121
+118
+82
+60
+117
+76
+54
+117
+75
+53
+119
+74
+53
+123
+78
+57
+125
+80
+59
+120
+75
+54
+107
+64
+45
+98
+55
+38
+123
+77
+64
+115
+68
+58
+113
+66
+56
+115
+68
+58
+111
+67
+56
+103
+59
+48
+100
+56
+45
+103
+61
+49
+105
+63
+51
+105
+63
+51
+105
+63
+51
+103
+63
+51
+102
+62
+50
+102
+62
+50
+102
+62
+50
+101
+63
+50
+98
+64
+52
+98
+66
+53
+96
+67
+53
+95
+67
+53
+95
+67
+53
+91
+68
+52
+90
+69
+52
+87
+68
+51
+88
+73
+54
+79
+66
+47
+92
+84
+63
+111
+105
+83
+99
+94
+72
+77
+75
+52
+73
+71
+48
+73
+75
+51
+62
+68
+42
+63
+72
+45
+64
+70
+42
+60
+66
+38
+60
+65
+35
+70
+73
+44
+88
+89
+58
+100
+101
+70
+109
+109
+81
+120
+120
+92
+116
+118
+94
+91
+95
+70
+64
+67
+46
+54
+59
+37
+56
+64
+43
+60
+67
+49
+57
+63
+51
+57
+63
+53
+57
+63
+53
+56
+62
+52
+56
+62
+52
+55
+61
+51
+55
+61
+51
+55
+61
+51
+57
+63
+53
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+55
+60
+54
+55
+60
+54
+55
+60
+54
+54
+59
+53
+54
+59
+53
+54
+59
+53
+53
+58
+52
+53
+58
+52
+51
+56
+50
+51
+56
+50
+49
+54
+48
+48
+53
+47
+47
+52
+46
+45
+50
+44
+44
+49
+43
+44
+49
+43
+43
+48
+42
+43
+48
+42
+42
+47
+41
+42
+47
+41
+43
+48
+42
+44
+49
+43
+45
+50
+44
+45
+50
+44
+48
+53
+47
+46
+51
+45
+43
+48
+42
+43
+48
+42
+45
+50
+46
+50
+55
+49
+56
+61
+57
+59
+66
+58
+64
+75
+61
+64
+77
+59
+64
+77
+59
+61
+74
+54
+56
+69
+49
+51
+64
+44
+49
+63
+40
+48
+62
+39
+60
+73
+53
+66
+79
+59
+72
+85
+67
+73
+86
+69
+68
+80
+66
+59
+71
+59
+50
+62
+52
+46
+58
+48
+45
+55
+47
+47
+54
+47
+46
+53
+46
+103
+100
+85
+103
+100
+85
+103
+100
+85
+104
+101
+86
+104
+101
+86
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+107
+101
+87
+108
+100
+87
+108
+99
+90
+109
+100
+91
+109
+100
+93
+109
+102
+92
+109
+103
+91
+106
+105
+87
+107
+109
+88
+105
+110
+87
+105
+113
+90
+103
+115
+95
+100
+114
+101
+106
+121
+116
+133
+149
+149
+163
+178
+183
+189
+200
+206
+210
+219
+226
+234
+239
+245
+244
+249
+253
+251
+252
+255
+253
+255
+254
+255
+255
+253
+255
+255
+250
+255
+255
+248
+255
+255
+243
+254
+255
+241
+251
+254
+235
+247
+250
+229
+240
+245
+222
+230
+238
+214
+226
+232
+204
+217
+220
+191
+213
+213
+185
+210
+208
+185
+212
+209
+190
+218
+212
+200
+224
+217
+209
+234
+224
+223
+244
+233
+237
+253
+242
+248
+255
+246
+251
+255
+250
+255
+255
+252
+255
+255
+253
+254
+254
+253
+251
+254
+253
+249
+254
+253
+249
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+253
+255
+254
+250
+255
+255
+250
+255
+255
+252
+255
+255
+255
+255
+255
+255
+253
+254
+255
+251
+251
+255
+249
+250
+255
+249
+248
+255
+248
+246
+255
+249
+247
+255
+250
+247
+255
+254
+249
+255
+255
+251
+255
+255
+251
+253
+255
+250
+252
+253
+248
+244
+241
+234
+255
+251
+243
+255
+253
+244
+255
+251
+241
+255
+248
+235
+255
+244
+228
+246
+227
+210
+228
+207
+188
+208
+183
+163
+183
+156
+135
+146
+118
+97
+118
+87
+67
+104
+73
+53
+104
+73
+53
+109
+76
+57
+112
+79
+60
+108
+71
+55
+105
+66
+51
+103
+66
+50
+106
+69
+53
+110
+73
+57
+110
+74
+58
+111
+75
+59
+111
+75
+59
+101
+65
+49
+99
+66
+49
+99
+66
+49
+99
+66
+49
+99
+66
+49
+99
+66
+49
+98
+67
+49
+96
+67
+51
+93
+70
+54
+92
+71
+54
+92
+71
+54
+90
+71
+54
+90
+71
+54
+87
+72
+53
+84
+71
+52
+82
+71
+51
+80
+72
+51
+78
+72
+50
+102
+100
+77
+126
+126
+102
+114
+114
+90
+86
+88
+64
+74
+76
+52
+71
+77
+51
+60
+69
+42
+60
+70
+43
+63
+72
+43
+65
+71
+43
+65
+70
+40
+68
+71
+42
+77
+78
+47
+84
+85
+54
+120
+119
+91
+123
+122
+94
+110
+110
+86
+85
+85
+61
+67
+66
+46
+63
+65
+44
+62
+65
+46
+58
+62
+45
+59
+62
+51
+57
+63
+53
+57
+63
+53
+56
+62
+52
+56
+62
+52
+55
+61
+51
+55
+61
+51
+55
+61
+51
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+57
+62
+56
+57
+62
+56
+57
+62
+56
+56
+61
+55
+56
+61
+55
+56
+61
+55
+55
+60
+54
+55
+60
+54
+54
+59
+53
+53
+58
+52
+52
+57
+51
+51
+56
+50
+50
+55
+49
+48
+53
+47
+47
+52
+46
+47
+52
+46
+45
+50
+46
+45
+50
+46
+44
+49
+45
+43
+48
+44
+43
+48
+44
+44
+49
+45
+45
+50
+46
+45
+50
+46
+44
+49
+45
+44
+49
+45
+44
+49
+45
+44
+49
+45
+46
+50
+49
+48
+53
+49
+51
+55
+54
+52
+59
+52
+59
+71
+57
+61
+76
+57
+64
+79
+60
+64
+79
+58
+60
+75
+54
+55
+70
+47
+52
+67
+44
+50
+65
+42
+54
+69
+46
+58
+73
+52
+64
+79
+60
+66
+80
+63
+63
+77
+62
+56
+70
+55
+49
+63
+50
+45
+57
+45
+45
+55
+46
+46
+53
+45
+45
+52
+44
+102
+99
+84
+102
+99
+84
+103
+100
+85
+104
+101
+86
+104
+101
+86
+105
+102
+87
+106
+103
+88
+106
+103
+88
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+108
+100
+87
+108
+100
+87
+108
+99
+90
+109
+100
+91
+109
+100
+93
+109
+102
+92
+109
+103
+91
+106
+105
+87
+107
+109
+88
+105
+110
+87
+105
+113
+90
+103
+115
+95
+98
+112
+99
+103
+120
+114
+130
+148
+148
+163
+178
+183
+192
+203
+209
+212
+221
+228
+235
+240
+246
+245
+250
+254
+251
+252
+255
+253
+255
+254
+255
+255
+253
+255
+255
+250
+255
+255
+248
+255
+255
+244
+255
+255
+243
+255
+255
+239
+250
+253
+232
+242
+247
+224
+231
+240
+213
+226
+232
+204
+215
+218
+189
+209
+209
+181
+205
+203
+180
+206
+203
+186
+214
+207
+197
+222
+215
+209
+236
+226
+227
+247
+238
+243
+255
+245
+253
+255
+249
+255
+255
+252
+255
+255
+254
+255
+255
+254
+252
+253
+254
+249
+253
+254
+248
+253
+255
+249
+254
+255
+250
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+254
+253
+254
+255
+254
+255
+255
+254
+255
+255
+254
+255
+255
+254
+255
+253
+254
+255
+250
+253
+254
+248
+253
+253
+245
+251
+251
+241
+252
+252
+244
+254
+253
+248
+255
+254
+250
+255
+255
+253
+254
+254
+254
+254
+252
+255
+254
+252
+255
+251
+246
+252
+255
+250
+254
+254
+248
+250
+249
+244
+241
+253
+246
+240
+255
+254
+244
+255
+254
+241
+255
+254
+237
+255
+248
+230
+252
+239
+220
+242
+227
+208
+226
+209
+189
+205
+187
+167
+179
+161
+141
+155
+134
+115
+140
+117
+99
+122
+93
+75
+125
+94
+76
+116
+85
+67
+97
+68
+50
+87
+58
+40
+89
+60
+42
+91
+62
+44
+88
+61
+42
+96
+69
+50
+96
+69
+50
+96
+69
+50
+95
+70
+50
+96
+71
+51
+96
+71
+51
+96
+71
+51
+93
+72
+51
+92
+75
+55
+92
+77
+58
+92
+77
+58
+89
+76
+57
+88
+77
+57
+85
+77
+56
+82
+76
+54
+81
+76
+54
+78
+76
+53
+81
+81
+57
+105
+107
+83
+124
+128
+103
+109
+113
+88
+83
+89
+63
+70
+76
+50
+62
+71
+44
+60
+70
+43
+60
+70
+43
+63
+72
+43
+68
+74
+46
+69
+74
+44
+68
+71
+42
+72
+73
+42
+76
+77
+46
+121
+120
+92
+116
+115
+87
+102
+100
+77
+84
+82
+59
+76
+73
+54
+75
+74
+54
+70
+69
+51
+60
+61
+45
+60
+63
+52
+57
+63
+53
+57
+63
+53
+57
+63
+53
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+55
+61
+51
+55
+61
+51
+56
+62
+52
+56
+62
+52
+56
+62
+52
+56
+62
+52
+57
+63
+53
+57
+63
+53
+58
+63
+57
+58
+63
+57
+58
+63
+57
+58
+63
+57
+57
+62
+56
+57
+62
+56
+57
+62
+56
+56
+61
+55
+56
+61
+55
+56
+61
+55
+55
+60
+54
+54
+59
+53
+53
+58
+52
+52
+57
+51
+51
+56
+50
+51
+56
+50
+47
+52
+48
+46
+51
+47
+45
+50
+46
+44
+49
+45
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+43
+48
+44
+44
+49
+45
+45
+49
+48
+46
+50
+49
+47
+51
+50
+47
+51
+50
+47
+51
+50
+45
+52
+45
+51
+63
+49
+55
+70
+51
+61
+76
+55
+64
+79
+58
+63
+78
+55
+60
+75
+52
+57
+72
+49
+56
+71
+48
+53
+68
+45
+56
+71
+48
+60
+75
+54
+62
+77
+58
+60
+74
+57
+55
+69
+54
+49
+63
+50
+45
+57
+45
+44
+54
+45
+46
+53
+45
+45
+52
+44
+102
+99
+84
+102
+99
+84
+103
+100
+85
+104
+101
+86
+104
+101
+86
+105
+102
+87
+106
+103
+88
+106
+103
+88
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+108
+100
+87
+108
+100
+87
+108
+99
+90
+109
+100
+91
+109
+100
+93
+109
+102
+92
+109
+103
+91
+106
+105
+87
+106
+108
+87
+104
+109
+86
+104
+114
+90
+102
+115
+95
+99
+113
+100
+104
+121
+115
+133
+151
+151
+165
+183
+187
+199
+210
+216
+218
+227
+234
+240
+245
+251
+248
+253
+255
+252
+253
+255
+253
+255
+254
+255
+255
+253
+255
+254
+249
+255
+255
+245
+255
+255
+242
+255
+255
+240
+252
+255
+236
+248
+251
+230
+239
+244
+221
+226
+235
+208
+221
+227
+199
+213
+213
+185
+206
+204
+179
+201
+196
+176
+202
+196
+180
+208
+201
+191
+218
+210
+207
+233
+224
+227
+246
+237
+242
+255
+246
+254
+255
+249
+255
+255
+252
+255
+255
+254
+255
+254
+254
+252
+252
+254
+249
+251
+255
+247
+252
+255
+248
+253
+255
+250
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+254
+254
+251
+255
+255
+252
+255
+254
+253
+255
+253
+255
+254
+250
+255
+250
+247
+255
+248
+246
+255
+243
+245
+255
+240
+243
+254
+238
+245
+255
+242
+250
+255
+246
+253
+255
+250
+255
+253
+254
+255
+251
+255
+255
+249
+255
+255
+248
+255
+252
+241
+255
+254
+245
+255
+255
+250
+255
+255
+253
+255
+255
+252
+255
+252
+251
+249
+248
+248
+240
+245
+245
+233
+255
+255
+241
+255
+255
+239
+255
+255
+237
+255
+255
+237
+255
+252
+234
+255
+246
+229
+251
+239
+223
+248
+235
+218
+249
+228
+209
+255
+230
+208
+227
+202
+180
+165
+143
+120
+116
+94
+71
+101
+79
+56
+98
+76
+53
+92
+72
+48
+94
+74
+50
+92
+74
+50
+92
+74
+50
+93
+75
+51
+93
+75
+51
+94
+76
+52
+94
+76
+52
+92
+77
+54
+89
+78
+56
+87
+79
+58
+87
+79
+58
+86
+80
+58
+85
+79
+57
+83
+78
+56
+80
+78
+55
+78
+78
+54
+77
+79
+55
+80
+84
+59
+96
+102
+76
+102
+111
+84
+85
+94
+67
+69
+79
+52
+65
+75
+48
+60
+70
+43
+63
+73
+46
+63
+73
+46
+67
+76
+47
+72
+78
+50
+72
+77
+47
+70
+73
+44
+79
+80
+49
+89
+88
+58
+113
+109
+82
+106
+102
+75
+97
+92
+70
+91
+86
+64
+89
+84
+65
+84
+81
+62
+77
+74
+57
+66
+67
+51
+61
+64
+53
+59
+65
+55
+59
+65
+55
+59
+65
+55
+58
+64
+54
+58
+64
+54
+58
+64
+54
+57
+63
+53
+56
+62
+52
+56
+62
+52
+56
+62
+52
+57
+63
+53
+57
+63
+53
+58
+64
+54
+58
+64
+54
+58
+64
+54
+59
+64
+58
+59
+64
+58
+59
+64
+58
+58
+63
+57
+58
+63
+57
+57
+62
+56
+57
+62
+56
+57
+62
+56
+58
+63
+57
+58
+63
+57
+57
+62
+56
+57
+62
+56
+56
+61
+55
+56
+61
+55
+55
+60
+54
+55
+60
+54
+52
+57
+53
+50
+55
+51
+49
+54
+50
+47
+52
+48
+45
+50
+46
+44
+49
+45
+43
+47
+46
+43
+47
+46
+44
+48
+47
+44
+48
+47
+45
+49
+48
+46
+50
+49
+46
+50
+51
+46
+50
+51
+45
+49
+50
+43
+49
+45
+43
+57
+42
+47
+64
+45
+54
+72
+50
+59
+77
+55
+61
+79
+55
+60
+78
+52
+58
+76
+50
+58
+76
+50
+53
+71
+47
+55
+73
+49
+58
+76
+54
+60
+77
+58
+58
+75
+57
+54
+71
+55
+48
+64
+51
+45
+59
+46
+45
+55
+46
+46
+53
+45
+45
+52
+44
+99
+100
+82
+99
+100
+82
+100
+101
+83
+101
+102
+84
+101
+102
+86
+104
+102
+87
+105
+103
+88
+105
+103
+88
+104
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+105
+102
+87
+107
+101
+87
+107
+101
+87
+107
+101
+87
+108
+100
+89
+108
+101
+91
+109
+100
+93
+109
+102
+92
+107
+103
+91
+106
+105
+87
+105
+107
+86
+104
+109
+87
+104
+114
+90
+103
+116
+96
+100
+113
+103
+106
+123
+117
+137
+155
+157
+170
+187
+194
+205
+216
+222
+223
+232
+239
+242
+249
+255
+250
+255
+255
+251
+255
+255
+253
+255
+254
+254
+255
+250
+254
+254
+246
+250
+250
+238
+250
+251
+237
+250
+251
+233
+248
+250
+229
+244
+246
+225
+234
+238
+215
+223
+227
+202
+217
+219
+195
+211
+209
+184
+204
+199
+177
+197
+190
+172
+198
+190
+177
+204
+195
+188
+214
+206
+204
+230
+221
+224
+244
+234
+242
+253
+246
+254
+254
+249
+255
+255
+253
+255
+254
+254
+255
+253
+253
+251
+252
+254
+249
+251
+255
+249
+252
+255
+250
+253
+255
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+254
+254
+252
+255
+254
+252
+255
+254
+252
+255
+254
+252
+255
+253
+254
+255
+250
+255
+255
+251
+255
+254
+252
+255
+252
+254
+253
+249
+255
+251
+246
+255
+247
+244
+255
+244
+243
+255
+241
+242
+254
+240
+245
+255
+242
+250
+255
+246
+254
+255
+250
+255
+252
+251
+255
+249
+252
+255
+247
+255
+255
+246
+255
+255
+248
+255
+255
+247
+255
+255
+249
+255
+255
+252
+255
+253
+252
+255
+251
+253
+252
+250
+255
+251
+252
+255
+250
+244
+250
+240
+244
+250
+238
+247
+249
+236
+247
+248
+234
+248
+246
+231
+251
+248
+231
+255
+250
+234
+255
+253
+234
+253
+241
+219
+255
+251
+228
+236
+220
+197
+158
+142
+119
+96
+80
+55
+82
+66
+41
+88
+72
+47
+88
+72
+47
+91
+77
+51
+91
+77
+51
+90
+78
+52
+90
+78
+52
+91
+79
+53
+91
+79
+53
+92
+80
+54
+91
+81
+56
+85
+79
+55
+84
+79
+57
+84
+79
+57
+81
+79
+56
+80
+78
+55
+78
+78
+54
+75
+77
+53
+73
+77
+52
+74
+78
+53
+76
+82
+56
+83
+92
+65
+80
+89
+60
+64
+73
+44
+59
+70
+40
+65
+76
+46
+63
+74
+42
+67
+78
+46
+68
+79
+47
+72
+81
+50
+76
+83
+50
+73
+78
+48
+74
+77
+46
+89
+90
+59
+107
+106
+78
+102
+101
+73
+98
+94
+69
+94
+89
+67
+95
+90
+70
+96
+91
+71
+90
+85
+66
+83
+78
+59
+76
+73
+56
+65
+66
+52
+64
+66
+53
+64
+66
+53
+62
+65
+54
+62
+65
+54
+62
+65
+54
+61
+64
+55
+61
+64
+55
+57
+63
+53
+57
+63
+53
+57
+63
+53
+58
+64
+54
+58
+64
+54
+58
+66
+55
+58
+66
+55
+58
+66
+55
+59
+64
+57
+59
+64
+57
+59
+64
+58
+58
+63
+56
+58
+63
+57
+57
+62
+55
+57
+62
+56
+57
+62
+55
+59
+64
+58
+59
+64
+57
+59
+64
+58
+59
+64
+57
+58
+63
+57
+58
+63
+56
+58
+63
+57
+58
+63
+57
+56
+63
+56
+55
+61
+57
+52
+59
+52
+51
+56
+50
+49
+54
+48
+47
+52
+46
+46
+51
+47
+46
+51
+47
+46
+50
+49
+46
+50
+49
+44
+50
+46
+44
+50
+46
+43
+50
+43
+43
+50
+42
+44
+52
+41
+41
+54
+37
+36
+54
+30
+41
+61
+33
+50
+70
+43
+56
+76
+49
+59
+79
+54
+59
+77
+53
+59
+77
+53
+59
+77
+53
+56
+74
+50
+57
+75
+51
+59
+77
+53
+60
+78
+54
+60
+78
+56
+55
+72
+53
+49
+66
+48
+46
+60
+45
+46
+56
+45
+47
+54
+46
+46
+53
+45
+92
+102
+78
+93
+103
+79
+95
+103
+80
+96
+104
+81
+98
+106
+85
+101
+106
+86
+103
+106
+87
+104
+107
+88
+102
+103
+85
+104
+103
+85
+104
+101
+86
+104
+101
+86
+106
+100
+86
+107
+101
+87
+107
+101
+89
+108
+102
+88
+107
+101
+87
+106
+103
+88
+109
+103
+91
+108
+104
+93
+109
+102
+94
+106
+102
+91
+104
+100
+88
+102
+100
+85
+102
+103
+85
+103
+108
+86
+102
+111
+90
+98
+111
+93
+99
+112
+103
+114
+130
+127
+150
+168
+172
+185
+199
+208
+209
+219
+228
+224
+233
+240
+240
+247
+253
+247
+252
+255
+247
+253
+251
+250
+255
+251
+252
+255
+248
+252
+254
+243
+248
+249
+235
+250
+251
+235
+249
+248
+230
+243
+240
+221
+239
+236
+217
+236
+233
+214
+224
+222
+201
+214
+209
+189
+216
+208
+189
+203
+191
+175
+188
+179
+164
+188
+178
+169
+195
+184
+180
+205
+195
+196
+219
+210
+215
+233
+223
+231
+250
+243
+251
+253
+248
+255
+254
+251
+255
+255
+254
+255
+254
+254
+255
+252
+254
+253
+251
+253
+250
+252
+254
+251
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+252
+255
+254
+252
+255
+255
+253
+255
+255
+253
+255
+255
+251
+255
+254
+250
+255
+253
+250
+255
+252
+249
+255
+252
+249
+255
+252
+249
+255
+254
+255
+255
+253
+254
+253
+253
+253
+253
+253
+253
+254
+255
+255
+254
+255
+253
+251
+255
+252
+249
+254
+248
+253
+255
+250
+251
+252
+246
+253
+252
+247
+255
+255
+250
+255
+254
+248
+255
+249
+244
+255
+247
+243
+255
+250
+249
+255
+251
+255
+255
+252
+255
+254
+253
+255
+254
+255
+255
+254
+255
+255
+251
+255
+252
+251
+255
+252
+250
+254
+253
+252
+255
+255
+252
+255
+255
+255
+255
+253
+255
+254
+249
+255
+254
+242
+255
+254
+237
+255
+254
+234
+255
+254
+232
+251
+245
+223
+255
+252
+230
+233
+225
+202
+145
+137
+114
+86
+79
+53
+88
+78
+51
+85
+76
+47
+83
+74
+45
+87
+78
+49
+87
+78
+49
+85
+78
+49
+85
+78
+49
+84
+79
+50
+84
+79
+50
+84
+78
+52
+83
+79
+52
+81
+77
+50
+82
+78
+53
+80
+78
+53
+80
+80
+54
+77
+79
+55
+75
+79
+54
+72
+77
+54
+71
+76
+53
+74
+80
+54
+70
+79
+52
+65
+74
+45
+61
+70
+39
+62
+72
+38
+68
+75
+42
+70
+77
+43
+68
+78
+41
+77
+88
+48
+75
+87
+47
+70
+81
+41
+67
+77
+40
+79
+86
+52
+94
+99
+67
+96
+99
+68
+90
+90
+62
+89
+89
+63
+91
+89
+66
+95
+90
+68
+95
+90
+70
+95
+88
+69
+92
+85
+66
+88
+81
+62
+85
+78
+59
+75
+70
+51
+71
+68
+49
+68
+65
+48
+65
+63
+48
+64
+62
+49
+62
+62
+50
+63
+63
+53
+63
+65
+54
+60
+63
+54
+58
+64
+54
+58
+64
+54
+57
+65
+54
+57
+65
+52
+55
+66
+52
+55
+66
+52
+55
+66
+52
+58
+66
+55
+57
+65
+54
+57
+64
+56
+56
+64
+53
+56
+63
+55
+57
+65
+54
+57
+64
+56
+58
+66
+55
+58
+65
+57
+58
+66
+55
+57
+64
+56
+58
+66
+55
+59
+66
+58
+60
+68
+57
+61
+68
+60
+62
+69
+61
+56
+66
+58
+55
+65
+57
+55
+65
+56
+55
+63
+52
+53
+61
+48
+51
+59
+46
+50
+56
+46
+49
+54
+48
+46
+52
+48
+47
+53
+49
+45
+55
+47
+45
+57
+45
+46
+59
+41
+48
+64
+38
+54
+71
+39
+55
+77
+39
+59
+86
+43
+59
+88
+44
+60
+86
+49
+59
+84
+52
+59
+82
+56
+60
+79
+57
+61
+78
+59
+61
+79
+57
+58
+76
+54
+63
+81
+55
+68
+86
+60
+68
+87
+59
+67
+87
+60
+64
+84
+59
+55
+74
+52
+46
+63
+44
+45
+55
+44
+44
+51
+43
+41
+48
+40
+89
+103
+77
+90
+104
+78
+92
+104
+80
+93
+105
+81
+97
+107
+83
+98
+108
+84
+103
+108
+88
+103
+108
+88
+103
+104
+86
+103
+104
+86
+105
+102
+87
+105
+102
+87
+107
+101
+87
+108
+102
+88
+109
+101
+90
+109
+103
+89
+108
+102
+88
+106
+103
+88
+107
+103
+91
+108
+104
+93
+107
+103
+94
+106
+102
+91
+104
+102
+90
+101
+102
+86
+104
+105
+87
+103
+108
+86
+103
+112
+93
+102
+115
+98
+106
+119
+110
+121
+137
+136
+156
+171
+178
+186
+200
+209
+208
+218
+227
+224
+233
+238
+240
+247
+253
+246
+254
+255
+249
+255
+253
+249
+255
+249
+251
+254
+245
+249
+253
+239
+249
+250
+236
+248
+249
+231
+246
+243
+226
+238
+235
+216
+235
+230
+211
+230
+225
+206
+221
+214
+196
+210
+201
+184
+203
+191
+175
+193
+179
+166
+184
+172
+160
+187
+174
+166
+194
+183
+181
+205
+195
+196
+219
+208
+214
+228
+221
+228
+251
+243
+254
+253
+247
+255
+254
+251
+255
+255
+254
+255
+254
+253
+255
+252
+253
+255
+252
+254
+253
+252
+254
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+252
+255
+254
+252
+255
+255
+253
+255
+255
+253
+255
+253
+250
+255
+253
+250
+255
+253
+250
+255
+252
+249
+255
+252
+248
+255
+253
+248
+255
+254
+253
+255
+254
+252
+253
+253
+253
+253
+253
+253
+255
+255
+255
+255
+255
+255
+254
+254
+254
+253
+253
+253
+255
+255
+253
+255
+255
+251
+255
+252
+249
+254
+247
+241
+245
+236
+229
+238
+228
+219
+244
+231
+222
+250
+241
+234
+255
+252
+253
+254
+254
+255
+253
+255
+254
+254
+255
+253
+252
+255
+251
+251
+255
+250
+251
+255
+254
+250
+254
+255
+252
+255
+255
+252
+255
+255
+255
+254
+255
+254
+254
+252
+255
+253
+244
+255
+254
+236
+255
+253
+231
+255
+254
+229
+248
+246
+223
+254
+252
+231
+229
+224
+202
+141
+137
+112
+83
+77
+51
+84
+79
+50
+82
+75
+46
+81
+74
+45
+85
+79
+47
+85
+79
+47
+84
+79
+49
+84
+79
+49
+83
+79
+50
+83
+79
+50
+81
+80
+52
+81
+80
+52
+81
+77
+50
+79
+78
+50
+80
+78
+53
+78
+81
+54
+77
+79
+55
+74
+80
+54
+72
+77
+54
+69
+77
+53
+71
+80
+53
+69
+78
+49
+65
+74
+45
+63
+73
+39
+66
+73
+40
+70
+77
+43
+74
+80
+44
+74
+82
+43
+75
+86
+43
+75
+88
+42
+82
+93
+51
+89
+100
+60
+93
+101
+64
+87
+94
+60
+83
+88
+58
+83
+86
+57
+85
+85
+61
+86
+86
+62
+90
+85
+65
+91
+86
+66
+92
+85
+66
+92
+84
+65
+90
+82
+61
+89
+81
+60
+82
+76
+54
+80
+74
+52
+75
+70
+51
+72
+67
+48
+67
+64
+49
+65
+63
+50
+66
+64
+52
+63
+65
+54
+61
+62
+54
+58
+64
+54
+58
+64
+54
+57
+65
+54
+55
+66
+52
+55
+66
+52
+54
+67
+50
+54
+67
+50
+58
+66
+55
+57
+65
+54
+57
+65
+54
+56
+64
+53
+56
+64
+53
+57
+65
+54
+57
+65
+54
+58
+66
+55
+58
+66
+55
+58
+66
+55
+58
+66
+55
+58
+66
+55
+59
+67
+56
+60
+68
+57
+61
+69
+58
+60
+70
+59
+61
+71
+63
+60
+72
+62
+60
+70
+59
+60
+71
+55
+60
+68
+53
+58
+66
+51
+57
+63
+51
+56
+61
+54
+55
+62
+55
+52
+62
+54
+51
+61
+52
+48
+62
+45
+51
+67
+41
+57
+77
+42
+66
+89
+47
+71
+97
+49
+79
+112
+59
+76
+110
+59
+76
+105
+61
+70
+97
+62
+66
+89
+63
+60
+82
+61
+59
+76
+58
+58
+75
+56
+61
+79
+57
+68
+86
+60
+74
+93
+65
+76
+95
+65
+75
+95
+67
+72
+92
+64
+60
+83
+57
+51
+70
+48
+43
+53
+42
+43
+50
+42
+40
+47
+39
+89
+103
+77
+90
+104
+78
+92
+104
+80
+94
+106
+82
+97
+107
+83
+99
+109
+85
+103
+108
+88
+104
+109
+89
+105
+106
+88
+105
+106
+88
+107
+104
+89
+107
+104
+89
+108
+102
+88
+109
+103
+89
+110
+102
+91
+110
+104
+90
+108
+102
+88
+107
+104
+89
+107
+103
+91
+107
+103
+92
+107
+103
+94
+106
+102
+91
+104
+102
+90
+101
+102
+86
+104
+105
+87
+101
+106
+84
+100
+109
+90
+103
+116
+99
+111
+124
+115
+127
+143
+142
+157
+172
+179
+182
+196
+205
+204
+214
+223
+221
+230
+235
+239
+246
+252
+246
+254
+255
+249
+255
+253
+248
+255
+248
+248
+251
+242
+245
+249
+235
+244
+245
+231
+241
+242
+224
+236
+233
+216
+226
+223
+204
+222
+217
+198
+216
+211
+192
+208
+201
+183
+199
+190
+173
+192
+180
+164
+188
+174
+161
+187
+175
+163
+194
+181
+173
+204
+193
+191
+215
+205
+206
+227
+216
+222
+234
+227
+234
+251
+243
+254
+253
+247
+255
+254
+251
+255
+254
+253
+255
+253
+252
+255
+252
+253
+255
+252
+254
+253
+253
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+252
+255
+254
+252
+255
+255
+253
+255
+254
+252
+255
+253
+250
+255
+253
+250
+255
+252
+249
+255
+252
+249
+255
+252
+248
+255
+253
+248
+255
+254
+253
+254
+253
+251
+252
+252
+252
+253
+253
+253
+254
+254
+254
+255
+255
+255
+254
+254
+254
+253
+253
+253
+255
+255
+253
+255
+255
+251
+255
+253
+250
+249
+242
+236
+232
+223
+216
+223
+213
+204
+234
+221
+212
+246
+237
+230
+255
+252
+253
+254
+254
+255
+253
+255
+254
+254
+255
+253
+252
+255
+251
+251
+255
+250
+251
+255
+254
+250
+254
+255
+252
+255
+255
+252
+255
+255
+255
+254
+255
+254
+254
+252
+255
+253
+244
+255
+254
+236
+255
+253
+231
+255
+254
+229
+249
+247
+224
+254
+252
+231
+228
+223
+201
+138
+134
+109
+80
+74
+48
+82
+77
+48
+82
+75
+46
+82
+75
+46
+84
+78
+46
+85
+79
+47
+84
+79
+49
+85
+80
+50
+84
+80
+51
+83
+79
+50
+81
+80
+52
+80
+79
+51
+81
+77
+50
+79
+78
+50
+80
+78
+53
+77
+80
+53
+77
+79
+55
+74
+80
+54
+73
+78
+55
+70
+78
+54
+72
+81
+54
+69
+78
+49
+67
+76
+47
+66
+76
+42
+70
+77
+44
+73
+80
+46
+79
+85
+49
+81
+89
+50
+80
+91
+48
+85
+98
+52
+103
+116
+73
+119
+130
+90
+112
+120
+83
+88
+95
+61
+76
+81
+51
+78
+81
+52
+80
+80
+56
+81
+81
+57
+84
+79
+59
+85
+80
+60
+87
+80
+61
+88
+81
+62
+91
+83
+62
+92
+84
+63
+89
+83
+61
+86
+80
+58
+81
+76
+57
+77
+72
+53
+71
+68
+53
+68
+66
+53
+67
+65
+53
+63
+65
+54
+61
+62
+54
+58
+64
+54
+58
+64
+54
+57
+65
+54
+55
+66
+52
+55
+66
+52
+54
+67
+50
+54
+67
+50
+58
+66
+55
+58
+66
+55
+57
+65
+54
+57
+65
+54
+57
+65
+54
+57
+65
+54
+58
+66
+55
+58
+66
+55
+58
+66
+55
+58
+66
+55
+58
+66
+55
+58
+66
+55
+59
+67
+56
+60
+68
+57
+62
+70
+59
+60
+70
+59
+64
+74
+66
+63
+75
+65
+64
+74
+63
+64
+75
+59
+65
+73
+58
+63
+71
+56
+63
+69
+57
+62
+67
+60
+62
+69
+62
+57
+67
+59
+54
+64
+55
+52
+66
+49
+57
+73
+47
+66
+86
+51
+80
+103
+61
+88
+114
+66
+94
+127
+74
+91
+125
+74
+87
+116
+72
+77
+104
+69
+67
+90
+64
+57
+79
+58
+54
+71
+53
+52
+69
+50
+60
+78
+56
+69
+87
+61
+77
+96
+68
+82
+101
+71
+82
+102
+74
+78
+98
+70
+65
+88
+62
+56
+75
+53
+47
+57
+46
+47
+54
+46
+44
+51
+43
+89
+103
+77
+90
+104
+78
+92
+104
+80
+94
+106
+82
+98
+108
+84
+100
+110
+86
+104
+109
+89
+105
+110
+90
+107
+108
+90
+107
+108
+90
+109
+106
+91
+108
+105
+90
+110
+104
+90
+110
+104
+90
+111
+103
+92
+111
+105
+91
+109
+103
+89
+107
+104
+89
+107
+103
+91
+107
+103
+92
+106
+102
+93
+106
+102
+91
+104
+102
+90
+102
+103
+87
+102
+103
+85
+97
+102
+80
+95
+104
+85
+100
+113
+96
+112
+125
+116
+127
+143
+142
+151
+166
+173
+171
+185
+194
+199
+209
+218
+217
+226
+231
+237
+244
+250
+245
+253
+255
+248
+254
+252
+245
+252
+245
+243
+246
+237
+238
+242
+228
+234
+235
+221
+228
+229
+211
+221
+218
+201
+212
+209
+190
+208
+203
+184
+202
+197
+178
+195
+188
+170
+189
+180
+163
+196
+184
+168
+198
+184
+171
+203
+191
+179
+213
+200
+192
+224
+213
+211
+234
+224
+225
+244
+233
+239
+248
+241
+248
+252
+244
+255
+253
+247
+255
+254
+251
+255
+254
+253
+255
+253
+252
+255
+251
+252
+254
+252
+254
+253
+253
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+252
+255
+254
+252
+255
+254
+252
+255
+254
+252
+255
+253
+250
+255
+252
+249
+255
+252
+249
+255
+252
+249
+255
+251
+247
+255
+252
+247
+255
+253
+252
+253
+252
+250
+251
+251
+251
+252
+252
+252
+254
+254
+254
+255
+255
+255
+254
+254
+254
+253
+253
+253
+254
+253
+251
+255
+255
+251
+255
+253
+250
+250
+243
+237
+234
+225
+218
+227
+217
+208
+239
+226
+217
+251
+242
+235
+255
+252
+253
+254
+254
+255
+253
+255
+254
+254
+255
+253
+252
+255
+251
+251
+255
+250
+251
+255
+254
+250
+254
+255
+252
+255
+255
+252
+255
+255
+255
+254
+255
+254
+254
+252
+255
+253
+244
+255
+254
+236
+255
+252
+230
+255
+253
+228
+252
+250
+227
+255
+254
+233
+228
+223
+201
+137
+133
+108
+80
+74
+48
+82
+77
+48
+84
+77
+48
+84
+77
+48
+84
+78
+46
+85
+79
+47
+85
+80
+50
+85
+80
+50
+84
+80
+51
+83
+79
+50
+80
+79
+51
+79
+78
+50
+81
+77
+50
+79
+78
+50
+79
+77
+52
+76
+79
+52
+76
+78
+54
+74
+80
+54
+74
+79
+56
+71
+79
+55
+74
+83
+56
+71
+80
+51
+70
+79
+50
+72
+82
+48
+76
+83
+50
+78
+85
+51
+85
+91
+55
+91
+99
+60
+103
+114
+71
+115
+128
+82
+135
+148
+105
+144
+156
+116
+133
+143
+106
+110
+117
+83
+90
+95
+65
+82
+87
+57
+79
+79
+55
+78
+78
+54
+80
+75
+55
+79
+74
+54
+82
+75
+56
+85
+78
+59
+89
+81
+60
+91
+83
+62
+90
+84
+62
+88
+82
+60
+84
+79
+60
+80
+75
+56
+74
+71
+56
+71
+69
+56
+69
+67
+55
+65
+67
+56
+61
+62
+54
+58
+64
+54
+58
+64
+54
+57
+65
+54
+55
+66
+52
+55
+66
+52
+54
+67
+50
+54
+67
+50
+59
+67
+56
+58
+66
+55
+57
+65
+54
+57
+65
+54
+57
+65
+54
+57
+65
+54
+58
+66
+55
+59
+67
+56
+59
+67
+56
+58
+66
+55
+58
+66
+55
+59
+67
+56
+59
+67
+56
+61
+69
+58
+62
+70
+59
+61
+71
+60
+61
+71
+63
+60
+72
+62
+62
+72
+61
+62
+73
+57
+64
+72
+57
+63
+71
+56
+63
+69
+57
+63
+68
+61
+61
+68
+61
+57
+67
+59
+54
+64
+55
+52
+66
+49
+57
+73
+47
+68
+88
+53
+82
+105
+63
+91
+117
+69
+89
+122
+69
+87
+121
+70
+84
+113
+69
+73
+100
+65
+62
+85
+59
+51
+73
+52
+48
+65
+47
+46
+63
+44
+54
+72
+50
+64
+82
+56
+75
+94
+66
+82
+101
+71
+83
+103
+75
+79
+99
+71
+65
+88
+62
+54
+73
+51
+49
+59
+48
+48
+55
+47
+45
+52
+44
+89
+103
+77
+90
+104
+78
+92
+104
+80
+94
+106
+82
+98
+108
+84
+100
+110
+86
+105
+110
+90
+106
+111
+91
+109
+110
+92
+108
+109
+91
+110
+107
+92
+109
+106
+91
+110
+104
+90
+110
+104
+90
+112
+104
+93
+111
+105
+91
+109
+103
+89
+107
+104
+89
+106
+102
+90
+106
+102
+91
+105
+101
+92
+105
+101
+90
+104
+102
+90
+102
+103
+87
+103
+104
+86
+97
+102
+80
+94
+103
+84
+100
+113
+96
+112
+125
+116
+125
+141
+140
+145
+160
+167
+161
+175
+184
+194
+204
+213
+214
+223
+228
+234
+241
+247
+243
+251
+253
+245
+251
+249
+242
+249
+242
+239
+242
+233
+233
+237
+223
+227
+228
+214
+218
+219
+201
+211
+208
+191
+204
+201
+182
+201
+196
+177
+195
+190
+171
+190
+183
+165
+187
+178
+161
+202
+190
+174
+209
+195
+182
+218
+206
+194
+229
+216
+208
+238
+227
+225
+248
+238
+239
+255
+245
+251
+255
+249
+255
+252
+244
+255
+253
+247
+255
+253
+250
+255
+253
+252
+255
+252
+251
+255
+251
+252
+254
+252
+254
+253
+254
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+252
+255
+254
+252
+255
+254
+252
+255
+254
+252
+255
+252
+249
+255
+252
+249
+255
+252
+249
+255
+251
+248
+255
+251
+247
+255
+252
+247
+255
+252
+251
+252
+251
+249
+251
+251
+251
+252
+252
+252
+254
+254
+254
+255
+255
+255
+254
+254
+254
+253
+253
+253
+254
+253
+251
+254
+253
+249
+255
+252
+249
+254
+247
+241
+245
+236
+229
+239
+229
+220
+247
+234
+225
+254
+245
+238
+255
+252
+253
+254
+254
+255
+253
+255
+254
+254
+255
+253
+252
+255
+251
+251
+255
+250
+251
+255
+254
+250
+254
+255
+251
+255
+255
+251
+255
+255
+254
+253
+255
+254
+254
+252
+255
+254
+245
+255
+254
+236
+255
+252
+230
+255
+252
+227
+254
+252
+229
+255
+255
+235
+229
+224
+202
+138
+134
+109
+81
+75
+49
+84
+79
+50
+86
+79
+50
+87
+80
+51
+84
+78
+46
+85
+79
+47
+86
+81
+51
+86
+81
+51
+85
+81
+52
+83
+79
+50
+79
+78
+50
+78
+77
+49
+81
+77
+50
+79
+78
+50
+79
+77
+52
+76
+79
+52
+76
+78
+54
+74
+80
+54
+74
+79
+56
+73
+81
+57
+76
+85
+58
+73
+82
+53
+74
+83
+54
+78
+88
+54
+81
+88
+55
+82
+89
+55
+91
+97
+61
+99
+107
+68
+129
+142
+98
+146
+162
+115
+161
+174
+131
+157
+169
+129
+148
+158
+121
+138
+145
+111
+115
+120
+90
+90
+95
+65
+80
+80
+56
+78
+78
+54
+78
+73
+53
+76
+71
+51
+78
+71
+52
+81
+74
+55
+86
+78
+57
+88
+80
+59
+88
+82
+60
+86
+80
+58
+83
+78
+59
+80
+75
+56
+76
+73
+58
+73
+71
+58
+71
+69
+57
+67
+69
+58
+61
+62
+54
+58
+64
+54
+58
+64
+54
+57
+65
+54
+55
+66
+52
+55
+66
+52
+54
+67
+50
+54
+67
+50
+59
+67
+56
+59
+67
+56
+58
+66
+55
+57
+65
+54
+57
+65
+54
+58
+66
+55
+59
+67
+56
+59
+67
+56
+59
+67
+56
+59
+67
+56
+59
+67
+56
+59
+67
+56
+60
+68
+57
+61
+69
+58
+62
+70
+59
+61
+71
+60
+59
+69
+61
+58
+70
+60
+60
+70
+59
+60
+71
+55
+62
+70
+55
+61
+69
+54
+62
+68
+56
+61
+66
+59
+58
+65
+58
+55
+65
+57
+53
+63
+54
+52
+66
+49
+57
+73
+47
+66
+86
+51
+78
+101
+59
+85
+111
+63
+83
+116
+63
+81
+115
+64
+79
+108
+64
+69
+96
+61
+57
+80
+54
+46
+68
+47
+44
+61
+43
+44
+61
+42
+49
+67
+45
+60
+78
+52
+73
+92
+64
+80
+99
+69
+82
+102
+74
+78
+98
+70
+63
+86
+60
+52
+71
+49
+43
+53
+42
+43
+50
+42
+40
+47
+39
diff --git a/mfhdf/hrepack/image24plane.txt b/mfhdf/hrepack/image24plane.txt
new file mode 100644
index 0000000..d6bf9be
--- /dev/null
+++ b/mfhdf/hrepack/image24plane.txt
@@ -0,0 +1,101475 @@
+components
+3
+height
+149
+width
+227
+48
+48
+49
+50
+53
+53
+54
+54
+56
+56
+58
+58
+58
+58
+58
+58
+58
+57
+57
+56
+56
+57
+57
+58
+56
+56
+56
+56
+56
+56
+56
+56
+54
+54
+54
+53
+53
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+50
+47
+47
+47
+48
+49
+50
+51
+51
+54
+54
+55
+56
+56
+57
+58
+58
+65
+66
+68
+70
+73
+74
+75
+75
+77
+77
+79
+78
+79
+79
+80
+82
+82
+89
+98
+110
+125
+139
+153
+163
+175
+184
+190
+197
+199
+202
+203
+208
+231
+237
+235
+235
+238
+239
+241
+244
+248
+247
+244
+240
+233
+226
+215
+203
+187
+181
+181
+180
+180
+179
+178
+175
+173
+170
+166
+162
+159
+155
+152
+150
+148
+146
+146
+145
+145
+144
+146
+146
+148
+148
+148
+148
+148
+149
+150
+150
+150
+149
+151
+159
+169
+179
+188
+191
+185
+181
+172
+158
+135
+111
+84
+67
+61
+57
+57
+55
+55
+54
+53
+53
+55
+55
+55
+54
+54
+53
+53
+52
+47
+46
+47
+47
+48
+48
+50
+50
+53
+52
+52
+51
+55
+61
+69
+80
+106
+124
+141
+149
+159
+170
+170
+159
+148
+135
+128
+126
+115
+96
+84
+80
+83
+79
+77
+84
+102
+124
+141
+153
+163
+162
+158
+143
+123
+102
+88
+81
+85
+85
+85
+48
+48
+49
+49
+52
+53
+54
+54
+56
+56
+58
+58
+58
+58
+58
+58
+57
+57
+56
+56
+56
+56
+57
+57
+56
+56
+56
+56
+56
+56
+56
+56
+54
+54
+53
+53
+53
+52
+52
+52
+53
+53
+53
+53
+53
+53
+53
+51
+48
+48
+48
+49
+50
+51
+52
+52
+54
+54
+55
+55
+56
+57
+58
+58
+64
+65
+67
+69
+72
+73
+74
+74
+76
+76
+77
+77
+77
+78
+79
+81
+80
+85
+94
+106
+120
+132
+146
+156
+167
+175
+181
+188
+192
+196
+197
+205
+225
+231
+232
+234
+237
+239
+243
+246
+248
+247
+244
+240
+233
+224
+213
+202
+185
+181
+180
+180
+180
+178
+176
+175
+173
+169
+166
+161
+159
+155
+152
+150
+148
+146
+145
+145
+145
+144
+146
+146
+148
+147
+148
+148
+148
+149
+150
+150
+148
+149
+152
+160
+171
+181
+189
+191
+187
+183
+172
+156
+133
+108
+83
+66
+62
+58
+57
+56
+56
+55
+54
+54
+55
+55
+55
+54
+54
+53
+53
+52
+47
+46
+47
+47
+48
+48
+50
+50
+51
+53
+52
+51
+53
+60
+67
+78
+100
+118
+134
+143
+154
+164
+165
+157
+145
+134
+127
+123
+111
+91
+81
+79
+79
+79
+80
+82
+91
+110
+131
+148
+153
+154
+153
+143
+126
+106
+93
+86
+88
+86
+88
+47
+47
+48
+49
+52
+52
+53
+53
+55
+55
+55
+55
+57
+57
+57
+57
+57
+56
+55
+55
+55
+55
+56
+57
+56
+56
+56
+56
+56
+56
+56
+56
+54
+53
+53
+53
+52
+52
+52
+52
+53
+53
+53
+53
+53
+53
+53
+51
+50
+49
+50
+51
+51
+52
+52
+53
+54
+54
+54
+55
+56
+57
+57
+58
+63
+64
+66
+68
+71
+72
+72
+72
+73
+73
+75
+75
+75
+76
+77
+78
+77
+81
+89
+100
+113
+124
+135
+146
+152
+160
+167
+175
+181
+186
+191
+197
+217
+225
+227
+231
+234
+240
+244
+248
+250
+249
+245
+240
+232
+220
+209
+198
+183
+179
+179
+178
+178
+176
+175
+173
+170
+167
+165
+161
+157
+154
+152
+149
+148
+145
+145
+145
+144
+144
+144
+144
+145
+145
+146
+146
+147
+147
+148
+149
+149
+150
+154
+163
+175
+185
+191
+193
+192
+184
+174
+153
+129
+104
+81
+66
+63
+61
+60
+58
+57
+56
+55
+55
+54
+54
+54
+53
+53
+52
+52
+50
+46
+44
+46
+46
+47
+47
+48
+50
+53
+52
+53
+52
+52
+57
+62
+73
+91
+108
+124
+134
+144
+152
+155
+148
+140
+131
+125
+117
+102
+84
+77
+76
+77
+79
+81
+77
+78
+91
+113
+133
+135
+138
+141
+134
+120
+102
+90
+86
+90
+90
+91
+46
+47
+47
+48
+51
+52
+52
+52
+54
+54
+54
+54
+56
+56
+56
+56
+55
+55
+54
+54
+54
+54
+55
+55
+56
+56
+56
+56
+56
+56
+56
+56
+53
+53
+53
+52
+52
+52
+51
+51
+54
+54
+54
+54
+54
+54
+54
+52
+51
+51
+51
+52
+52
+53
+53
+53
+53
+53
+54
+55
+56
+56
+57
+57
+62
+63
+64
+66
+69
+69
+70
+70
+71
+71
+72
+73
+73
+74
+76
+74
+75
+78
+85
+94
+105
+115
+126
+134
+140
+148
+157
+163
+172
+179
+184
+193
+210
+218
+222
+226
+231
+236
+243
+247
+250
+249
+245
+238
+229
+218
+205
+194
+181
+176
+176
+176
+175
+174
+174
+172
+169
+166
+163
+160
+156
+152
+150
+148
+145
+145
+145
+144
+144
+144
+143
+143
+144
+144
+143
+143
+146
+145
+148
+146
+149
+150
+156
+166
+178
+188
+193
+194
+194
+186
+172
+151
+124
+98
+76
+65
+64
+62
+61
+60
+58
+57
+56
+56
+54
+54
+54
+51
+53
+50
+50
+49
+45
+45
+47
+47
+48
+48
+49
+49
+53
+54
+53
+53
+52
+54
+58
+68
+84
+99
+113
+123
+130
+137
+141
+139
+131
+125
+120
+111
+96
+81
+76
+76
+76
+80
+81
+76
+71
+77
+94
+106
+117
+120
+122
+119
+107
+96
+87
+84
+93
+93
+93
+45
+45
+46
+47
+48
+49
+51
+52
+51
+51
+52
+52
+52
+52
+54
+54
+52
+52
+51
+51
+51
+51
+52
+52
+53
+53
+53
+53
+53
+53
+53
+53
+51
+51
+50
+50
+50
+49
+49
+49
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+53
+53
+53
+53
+53
+54
+54
+55
+56
+57
+57
+60
+61
+63
+64
+66
+67
+67
+67
+68
+68
+70
+71
+72
+73
+74
+73
+74
+77
+82
+89
+98
+106
+117
+125
+130
+139
+147
+154
+163
+172
+178
+187
+204
+212
+216
+221
+226
+233
+240
+244
+249
+248
+244
+237
+225
+211
+197
+185
+178
+174
+174
+174
+173
+172
+172
+170
+168
+164
+160
+158
+154
+151
+149
+147
+145
+144
+143
+143
+143
+142
+142
+142
+142
+142
+142
+142
+143
+143
+145
+144
+148
+151
+157
+168
+182
+191
+197
+196
+190
+183
+166
+144
+116
+90
+69
+60
+64
+64
+63
+62
+61
+60
+57
+56
+54
+52
+52
+50
+51
+49
+49
+48
+45
+44
+45
+45
+47
+47
+48
+49
+51
+53
+53
+52
+50
+52
+55
+61
+78
+89
+101
+110
+115
+121
+128
+131
+127
+122
+117
+107
+95
+84
+79
+76
+78
+78
+77
+74
+71
+71
+75
+77
+93
+96
+98
+96
+90
+87
+85
+88
+94
+96
+96
+44
+44
+46
+46
+47
+48
+51
+51
+50
+50
+51
+51
+51
+51
+53
+53
+51
+51
+50
+49
+49
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+49
+49
+49
+48
+51
+51
+51
+51
+51
+51
+51
+51
+52
+52
+52
+52
+52
+52
+52
+52
+52
+53
+53
+54
+55
+56
+56
+56
+59
+60
+61
+62
+64
+65
+65
+65
+67
+67
+69
+70
+71
+72
+74
+72
+74
+73
+78
+86
+92
+100
+110
+118
+123
+130
+140
+148
+156
+163
+170
+180
+196
+204
+209
+214
+222
+228
+236
+241
+247
+244
+240
+233
+220
+205
+190
+177
+174
+171
+170
+170
+170
+169
+169
+168
+165
+162
+160
+155
+151
+149
+147
+145
+143
+143
+143
+143
+142
+142
+142
+141
+142
+139
+141
+139
+139
+140
+141
+142
+148
+151
+160
+172
+185
+194
+197
+194
+186
+177
+163
+141
+111
+83
+65
+57
+64
+65
+63
+62
+60
+57
+56
+55
+52
+52
+51
+50
+50
+48
+48
+46
+45
+45
+46
+46
+48
+48
+49
+49
+50
+51
+51
+52
+50
+49
+52
+56
+71
+79
+88
+96
+101
+109
+121
+130
+128
+124
+119
+110
+100
+91
+82
+76
+79
+76
+73
+72
+72
+69
+64
+59
+66
+68
+74
+74
+73
+75
+79
+86
+94
+96
+96
+43
+43
+44
+45
+47
+47
+48
+48
+49
+49
+49
+49
+50
+50
+50
+50
+50
+50
+49
+49
+49
+49
+50
+50
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+49
+49
+49
+48
+48
+51
+51
+51
+51
+51
+51
+51
+51
+52
+52
+52
+51
+51
+51
+51
+51
+52
+52
+53
+54
+55
+55
+56
+56
+58
+59
+60
+61
+63
+63
+63
+63
+66
+66
+69
+69
+71
+72
+74
+72
+72
+71
+75
+81
+88
+95
+102
+110
+118
+124
+133
+140
+147
+155
+162
+172
+187
+194
+201
+208
+217
+226
+234
+240
+242
+241
+236
+228
+214
+198
+181
+170
+170
+169
+169
+168
+168
+168
+167
+165
+163
+160
+158
+154
+150
+147
+145
+143
+143
+141
+141
+140
+140
+140
+139
+139
+139
+138
+138
+137
+138
+139
+139
+140
+146
+152
+161
+174
+188
+194
+196
+192
+185
+178
+165
+143
+115
+87
+67
+60
+62
+64
+62
+61
+58
+57
+56
+54
+52
+52
+51
+49
+49
+46
+46
+46
+45
+45
+45
+45
+46
+46
+48
+48
+48
+49
+50
+50
+48
+47
+50
+52
+63
+68
+75
+84
+90
+100
+117
+131
+137
+133
+126
+116
+109
+99
+86
+76
+75
+73
+71
+69
+70
+68
+63
+59
+58
+62
+68
+71
+71
+74
+78
+85
+94
+97
+97
+43
+43
+44
+44
+46
+47
+48
+48
+49
+49
+49
+49
+50
+50
+50
+50
+50
+49
+49
+48
+48
+49
+49
+50
+48
+48
+48
+48
+48
+48
+48
+48
+50
+50
+50
+49
+49
+48
+48
+48
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+52
+52
+53
+54
+54
+55
+56
+56
+57
+58
+59
+60
+62
+62
+62
+62
+66
+66
+69
+69
+71
+73
+74
+73
+70
+70
+74
+79
+84
+92
+98
+106
+113
+119
+125
+133
+140
+149
+155
+164
+178
+186
+193
+202
+212
+222
+231
+238
+237
+235
+231
+223
+209
+191
+175
+164
+166
+166
+165
+165
+165
+164
+164
+164
+162
+159
+156
+152
+149
+145
+143
+143
+141
+141
+141
+140
+140
+139
+139
+138
+138
+136
+136
+136
+136
+135
+136
+139
+145
+150
+162
+173
+186
+193
+193
+187
+185
+178
+165
+145
+117
+91
+71
+67
+60
+63
+62
+59
+57
+55
+54
+52
+52
+51
+50
+49
+47
+46
+46
+46
+45
+45
+45
+45
+46
+46
+48
+48
+47
+48
+50
+50
+49
+48
+48
+51
+56
+59
+67
+75
+83
+94
+116
+135
+144
+140
+132
+122
+114
+105
+87
+73
+69
+71
+68
+67
+67
+64
+64
+62
+71
+75
+81
+85
+83
+82
+84
+89
+94
+97
+97
+44
+44
+44
+44
+45
+45
+46
+46
+47
+47
+49
+48
+48
+48
+47
+47
+47
+47
+47
+47
+47
+47
+47
+48
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+48
+48
+49
+49
+50
+49
+49
+49
+49
+49
+49
+49
+49
+48
+49
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+52
+53
+54
+55
+56
+57
+58
+59
+61
+62
+62
+62
+63
+63
+66
+67
+68
+70
+71
+70
+71
+72
+74
+80
+84
+88
+94
+98
+109
+116
+124
+131
+141
+147
+152
+158
+167
+173
+181
+190
+202
+212
+222
+229
+232
+234
+230
+218
+200
+183
+170
+162
+162
+161
+162
+162
+161
+161
+162
+160
+156
+154
+152
+149
+147
+144
+142
+140
+139
+139
+138
+137
+137
+137
+136
+135
+137
+134
+134
+135
+136
+136
+137
+139
+145
+151
+163
+177
+186
+187
+187
+184
+180
+175
+163
+145
+126
+106
+86
+73
+76
+74
+66
+60
+57
+55
+54
+51
+52
+51
+49
+49
+48
+47
+44
+44
+45
+45
+45
+45
+47
+47
+47
+47
+48
+48
+49
+49
+49
+49
+49
+52
+52
+59
+65
+67
+74
+93
+121
+139
+147
+148
+144
+131
+116
+106
+95
+90
+76
+72
+65
+62
+63
+65
+76
+85
+98
+110
+118
+114
+108
+103
+95
+87
+91
+96
+99
+44
+44
+44
+44
+45
+45
+46
+46
+47
+46
+48
+48
+47
+47
+47
+47
+46
+46
+46
+46
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+48
+48
+48
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+49
+50
+51
+51
+50
+50
+50
+50
+50
+50
+51
+52
+53
+54
+56
+57
+58
+59
+61
+62
+62
+61
+63
+63
+65
+66
+67
+69
+71
+72
+72
+72
+76
+79
+81
+86
+90
+95
+104
+112
+119
+129
+137
+144
+150
+155
+162
+167
+172
+180
+190
+201
+212
+219
+223
+224
+222
+212
+196
+178
+165
+158
+159
+158
+159
+158
+158
+158
+158
+158
+154
+153
+150
+148
+144
+143
+140
+140
+139
+138
+137
+137
+137
+135
+135
+133
+134
+133
+133
+131
+132
+134
+135
+136
+147
+151
+163
+175
+184
+184
+183
+179
+177
+170
+159
+144
+127
+109
+90
+78
+76
+75
+69
+64
+61
+56
+52
+49
+50
+50
+48
+47
+47
+46
+46
+46
+47
+45
+47
+47
+47
+47
+47
+47
+48
+48
+49
+49
+49
+49
+49
+50
+53
+57
+60
+63
+72
+94
+120
+138
+147
+148
+144
+132
+121
+113
+107
+104
+92
+88
+83
+82
+84
+90
+102
+114
+116
+126
+131
+126
+118
+114
+102
+90
+89
+94
+97
+44
+44
+44
+44
+44
+44
+45
+45
+46
+46
+46
+45
+47
+46
+46
+46
+44
+44
+44
+44
+43
+43
+43
+43
+45
+45
+45
+45
+45
+45
+45
+45
+44
+44
+45
+45
+45
+46
+46
+46
+46
+46
+46
+47
+47
+47
+47
+47
+48
+48
+49
+50
+50
+50
+50
+49
+49
+49
+49
+49
+50
+51
+52
+53
+56
+57
+58
+59
+61
+61
+61
+61
+63
+63
+65
+65
+67
+68
+70
+71
+72
+74
+75
+78
+80
+83
+86
+91
+99
+107
+116
+125
+135
+141
+148
+150
+157
+160
+162
+168
+177
+186
+197
+205
+213
+215
+212
+204
+190
+174
+161
+156
+157
+156
+156
+155
+155
+155
+155
+155
+152
+150
+148
+147
+143
+140
+139
+138
+137
+137
+137
+135
+135
+133
+132
+131
+132
+130
+130
+130
+131
+133
+135
+136
+148
+151
+160
+172
+178
+179
+178
+174
+173
+166
+157
+145
+130
+115
+99
+88
+78
+77
+72
+68
+64
+57
+52
+47
+48
+48
+47
+47
+46
+46
+47
+47
+47
+46
+47
+47
+47
+47
+47
+47
+48
+48
+48
+48
+48
+48
+48
+49
+54
+55
+56
+59
+72
+95
+122
+139
+144
+146
+143
+132
+125
+123
+124
+125
+125
+119
+113
+110
+110
+111
+121
+131
+139
+145
+144
+136
+131
+124
+106
+92
+86
+91
+93
+45
+45
+45
+45
+45
+45
+46
+46
+46
+46
+45
+45
+46
+46
+46
+46
+44
+43
+43
+43
+43
+42
+42
+42
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+45
+45
+45
+45
+46
+46
+46
+46
+47
+47
+47
+47
+48
+49
+49
+49
+49
+48
+48
+48
+48
+48
+48
+49
+50
+51
+52
+57
+58
+59
+60
+61
+61
+61
+61
+62
+62
+64
+64
+65
+67
+68
+69
+70
+72
+73
+74
+76
+78
+81
+84
+94
+101
+111
+120
+130
+138
+144
+148
+153
+155
+155
+159
+165
+174
+184
+191
+199
+203
+202
+195
+182
+170
+158
+153
+153
+153
+152
+151
+151
+153
+153
+151
+149
+148
+147
+144
+142
+138
+138
+137
+136
+136
+135
+135
+132
+132
+131
+128
+129
+128
+128
+129
+131
+131
+135
+136
+148
+150
+158
+167
+174
+174
+173
+170
+167
+161
+154
+143
+134
+122
+109
+98
+83
+81
+75
+69
+64
+59
+53
+49
+48
+47
+46
+46
+46
+46
+47
+48
+47
+47
+47
+47
+47
+46
+47
+46
+48
+47
+48
+47
+47
+47
+47
+50
+55
+54
+51
+57
+72
+98
+123
+139
+141
+143
+140
+131
+129
+133
+141
+146
+147
+144
+140
+135
+130
+125
+129
+136
+148
+152
+148
+139
+133
+127
+107
+88
+83
+89
+90
+43
+43
+43
+43
+45
+45
+46
+46
+45
+45
+46
+45
+45
+44
+44
+44
+44
+44
+44
+43
+43
+42
+42
+42
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+43
+43
+43
+44
+45
+45
+46
+46
+47
+47
+47
+47
+48
+48
+48
+48
+48
+47
+46
+47
+47
+47
+47
+48
+49
+51
+52
+57
+58
+59
+60
+61
+61
+60
+60
+61
+61
+63
+63
+64
+65
+66
+67
+68
+67
+68
+69
+71
+72
+75
+78
+88
+95
+105
+114
+125
+134
+140
+144
+151
+151
+151
+151
+156
+163
+171
+179
+186
+189
+190
+185
+176
+166
+155
+151
+151
+151
+150
+149
+148
+149
+150
+150
+149
+147
+146
+142
+139
+137
+137
+136
+135
+134
+134
+134
+131
+131
+130
+128
+128
+128
+128
+127
+130
+131
+135
+136
+145
+146
+154
+163
+168
+168
+169
+166
+162
+155
+149
+140
+134
+126
+116
+106
+92
+86
+78
+69
+63
+60
+55
+54
+48
+48
+46
+47
+47
+47
+49
+50
+49
+49
+49
+49
+49
+47
+49
+47
+50
+48
+50
+48
+48
+48
+48
+50
+56
+53
+49
+54
+71
+96
+122
+136
+141
+143
+141
+134
+135
+144
+155
+160
+152
+154
+155
+152
+145
+137
+137
+144
+146
+149
+144
+136
+132
+123
+103
+84
+81
+85
+86
+44
+44
+44
+44
+46
+46
+47
+47
+46
+46
+47
+46
+46
+46
+45
+45
+45
+45
+45
+44
+43
+42
+42
+42
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+43
+43
+43
+42
+42
+42
+44
+44
+44
+45
+46
+46
+47
+47
+47
+47
+48
+48
+47
+47
+46
+45
+48
+48
+47
+48
+49
+50
+51
+52
+58
+58
+59
+60
+61
+60
+60
+59
+61
+60
+62
+62
+63
+64
+65
+63
+64
+64
+64
+65
+66
+67
+70
+72
+81
+88
+97
+108
+117
+128
+134
+139
+147
+149
+147
+147
+149
+154
+160
+165
+172
+176
+180
+177
+170
+161
+154
+150
+149
+148
+147
+147
+147
+147
+148
+148
+147
+146
+143
+141
+138
+137
+135
+135
+134
+134
+133
+131
+131
+129
+127
+127
+128
+127
+127
+128
+130
+133
+136
+138
+142
+144
+151
+159
+167
+167
+169
+164
+156
+150
+143
+136
+131
+126
+121
+112
+100
+93
+82
+74
+66
+62
+58
+57
+51
+50
+49
+47
+47
+48
+49
+50
+49
+49
+49
+49
+49
+48
+48
+48
+49
+49
+49
+49
+47
+47
+47
+50
+56
+53
+51
+53
+69
+92
+117
+134
+142
+145
+144
+139
+141
+151
+162
+169
+165
+166
+167
+164
+151
+139
+136
+141
+142
+144
+141
+132
+128
+119
+100
+81
+77
+81
+82
+44
+44
+44
+44
+46
+46
+46
+46
+47
+47
+47
+47
+47
+47
+46
+46
+47
+46
+46
+45
+44
+43
+43
+42
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+42
+42
+42
+41
+41
+43
+43
+44
+45
+46
+46
+47
+47
+47
+47
+47
+47
+47
+46
+45
+44
+48
+48
+48
+48
+49
+50
+52
+52
+58
+59
+59
+60
+61
+60
+60
+59
+60
+60
+62
+61
+62
+62
+63
+62
+61
+59
+59
+60
+61
+62
+64
+67
+71
+79
+89
+100
+110
+120
+127
+133
+143
+145
+144
+143
+144
+147
+151
+153
+160
+166
+170
+170
+165
+159
+151
+149
+146
+146
+145
+144
+145
+145
+146
+146
+145
+145
+142
+141
+138
+136
+134
+132
+133
+133
+131
+130
+130
+129
+126
+126
+128
+128
+128
+129
+132
+133
+136
+140
+140
+142
+152
+161
+168
+169
+169
+164
+153
+146
+137
+130
+128
+127
+126
+120
+106
+100
+90
+81
+73
+67
+62
+60
+54
+52
+51
+48
+49
+49
+50
+52
+50
+50
+50
+50
+50
+48
+48
+48
+49
+49
+48
+48
+48
+48
+48
+49
+54
+53
+52
+52
+65
+87
+113
+130
+141
+144
+144
+139
+141
+149
+160
+164
+169
+168
+167
+161
+147
+133
+130
+135
+136
+140
+139
+129
+123
+113
+95
+77
+73
+74
+76
+46
+44
+46
+46
+46
+46
+46
+47
+48
+48
+48
+48
+48
+48
+47
+49
+50
+49
+49
+48
+47
+44
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+45
+42
+44
+41
+41
+40
+42
+43
+44
+44
+45
+46
+47
+47
+45
+45
+47
+47
+46
+45
+44
+44
+49
+50
+50
+50
+51
+52
+53
+54
+59
+59
+60
+60
+61
+60
+59
+59
+60
+60
+61
+61
+61
+62
+63
+61
+62
+61
+60
+57
+57
+58
+59
+63
+67
+74
+84
+94
+104
+111
+118
+123
+135
+139
+139
+140
+142
+143
+146
+149
+152
+156
+162
+161
+158
+153
+150
+148
+148
+147
+144
+142
+142
+140
+140
+141
+142
+142
+139
+138
+136
+135
+132
+132
+130
+128
+127
+126
+126
+124
+124
+124
+128
+129
+128
+130
+133
+133
+136
+139
+140
+142
+147
+152
+157
+157
+158
+157
+147
+143
+137
+129
+127
+125
+122
+116
+103
+98
+92
+85
+78
+71
+64
+61
+56
+56
+53
+51
+50
+50
+51
+52
+50
+48
+48
+50
+50
+50
+50
+50
+51
+51
+49
+49
+48
+48
+48
+49
+52
+52
+52
+52
+63
+84
+109
+129
+137
+141
+141
+136
+138
+145
+155
+159
+159
+158
+157
+152
+140
+130
+133
+140
+132
+137
+137
+126
+118
+108
+90
+74
+70
+70
+70
+47
+46
+47
+48
+48
+48
+49
+50
+51
+52
+52
+54
+53
+52
+51
+52
+53
+53
+52
+51
+50
+49
+48
+48
+46
+46
+45
+45
+44
+43
+42
+41
+46
+46
+47
+46
+47
+46
+46
+46
+47
+47
+45
+46
+45
+45
+46
+46
+45
+45
+46
+47
+47
+48
+50
+50
+50
+52
+53
+54
+56
+58
+58
+59
+61
+61
+62
+62
+62
+61
+60
+59
+61
+60
+60
+59
+61
+62
+62
+64
+66
+66
+60
+57
+53
+52
+54
+59
+64
+71
+79
+86
+91
+97
+102
+109
+121
+127
+134
+139
+143
+147
+147
+146
+147
+147
+148
+149
+148
+146
+145
+145
+151
+151
+146
+140
+136
+132
+130
+130
+136
+136
+138
+137
+136
+135
+132
+131
+123
+126
+118
+112
+118
+118
+118
+125
+125
+131
+136
+139
+138
+135
+133
+135
+144
+149
+147
+142
+138
+134
+135
+136
+139
+138
+139
+138
+132
+124
+114
+110
+104
+97
+91
+89
+90
+86
+79
+73
+66
+64
+58
+53
+51
+51
+51
+49
+47
+45
+45
+45
+47
+49
+51
+51
+52
+52
+51
+50
+48
+47
+47
+47
+47
+49
+48
+47
+60
+86
+112
+127
+141
+139
+140
+140
+138
+137
+142
+153
+159
+157
+150
+143
+136
+133
+131
+133
+131
+131
+128
+121
+114
+104
+89
+77
+74
+68
+62
+47
+48
+48
+48
+49
+49
+50
+51
+52
+52
+55
+55
+54
+53
+53
+53
+55
+55
+54
+54
+51
+50
+48
+48
+48
+47
+47
+45
+45
+43
+41
+41
+46
+47
+47
+47
+47
+47
+46
+46
+47
+47
+46
+46
+46
+46
+46
+46
+46
+46
+46
+46
+47
+47
+49
+51
+53
+53
+55
+56
+58
+59
+60
+61
+62
+62
+62
+62
+62
+61
+60
+60
+61
+60
+59
+59
+61
+61
+62
+64
+68
+70
+67
+64
+61
+60
+59
+62
+65
+70
+75
+80
+86
+92
+97
+103
+112
+120
+128
+136
+143
+145
+147
+147
+141
+139
+139
+140
+141
+141
+142
+145
+149
+149
+144
+139
+134
+131
+129
+129
+133
+134
+135
+136
+133
+132
+130
+127
+119
+119
+112
+109
+114
+114
+113
+117
+127
+132
+138
+140
+138
+135
+133
+136
+144
+149
+145
+138
+131
+127
+128
+131
+134
+139
+143
+143
+136
+127
+117
+109
+100
+94
+89
+89
+90
+88
+82
+77
+69
+65
+59
+53
+51
+50
+49
+46
+49
+48
+48
+48
+49
+51
+52
+52
+52
+51
+50
+48
+47
+45
+44
+44
+50
+50
+48
+45
+56
+83
+111
+128
+135
+134
+134
+136
+134
+132
+138
+147
+153
+150
+147
+140
+134
+130
+130
+131
+131
+130
+127
+120
+113
+104
+89
+77
+70
+64
+59
+49
+49
+49
+49
+50
+50
+52
+52
+53
+53
+56
+56
+56
+55
+55
+54
+56
+56
+55
+54
+52
+51
+50
+49
+49
+47
+48
+47
+45
+44
+43
+43
+47
+49
+47
+47
+47
+47
+46
+46
+48
+48
+47
+47
+47
+48
+48
+48
+47
+47
+48
+48
+48
+47
+49
+50
+54
+55
+57
+58
+60
+61
+62
+63
+63
+63
+64
+64
+63
+62
+61
+61
+61
+60
+59
+59
+59
+59
+60
+63
+68
+71
+74
+76
+79
+78
+74
+71
+68
+65
+66
+70
+79
+89
+99
+105
+107
+111
+119
+129
+135
+140
+141
+141
+138
+135
+134
+133
+134
+137
+140
+143
+142
+143
+140
+138
+135
+133
+134
+134
+137
+137
+136
+134
+132
+128
+126
+122
+124
+120
+117
+116
+118
+118
+117
+118
+127
+132
+138
+140
+138
+137
+136
+140
+147
+153
+151
+146
+138
+131
+129
+130
+134
+138
+143
+145
+144
+138
+130
+122
+107
+97
+92
+92
+93
+91
+85
+80
+70
+66
+58
+51
+46
+42
+40
+43
+50
+53
+53
+53
+52
+53
+51
+51
+48
+47
+44
+43
+41
+40
+38
+40
+49
+51
+46
+42
+53
+80
+109
+124
+128
+126
+127
+131
+128
+126
+128
+135
+141
+139
+136
+132
+129
+127
+127
+127
+127
+128
+125
+119
+112
+104
+89
+77
+69
+62
+57
+50
+50
+51
+51
+51
+52
+53
+53
+54
+55
+57
+58
+58
+57
+57
+57
+58
+57
+57
+56
+53
+52
+52
+52
+51
+51
+49
+49
+48
+46
+45
+45
+48
+50
+48
+48
+48
+48
+47
+47
+49
+49
+48
+48
+49
+49
+49
+49
+49
+49
+49
+49
+49
+50
+51
+51
+57
+57
+59
+60
+62
+64
+64
+65
+66
+65
+66
+65
+65
+64
+62
+62
+61
+61
+60
+59
+59
+60
+61
+63
+66
+70
+77
+84
+88
+87
+81
+75
+68
+62
+60
+64
+72
+84
+96
+101
+105
+107
+117
+125
+133
+137
+138
+136
+137
+134
+134
+133
+133
+134
+135
+137
+137
+137
+136
+136
+135
+136
+136
+137
+138
+138
+136
+133
+130
+125
+122
+120
+127
+122
+120
+120
+117
+118
+123
+123
+128
+132
+135
+137
+136
+138
+138
+140
+144
+147
+148
+143
+137
+132
+131
+131
+135
+136
+139
+143
+143
+139
+136
+127
+114
+108
+104
+102
+103
+100
+96
+92
+81
+76
+66
+57
+50
+46
+44
+45
+53
+56
+56
+55
+52
+51
+50
+48
+44
+43
+42
+40
+39
+39
+37
+40
+46
+49
+48
+46
+56
+80
+105
+118
+123
+121
+124
+127
+125
+121
+122
+127
+130
+128
+125
+125
+125
+126
+126
+125
+124
+125
+122
+117
+110
+101
+87
+78
+69
+63
+57
+52
+52
+52
+53
+53
+53
+55
+55
+56
+56
+59
+60
+60
+60
+60
+60
+60
+60
+59
+59
+56
+55
+54
+54
+53
+54
+54
+51
+50
+49
+48
+49
+50
+52
+52
+52
+50
+50
+50
+50
+51
+51
+51
+51
+50
+50
+51
+51
+51
+51
+51
+51
+53
+53
+54
+54
+59
+60
+61
+63
+65
+66
+69
+67
+68
+68
+69
+68
+67
+66
+64
+64
+62
+62
+61
+61
+61
+61
+62
+62
+66
+70
+78
+85
+90
+89
+83
+76
+68
+60
+57
+60
+68
+78
+90
+94
+102
+106
+115
+122
+130
+134
+135
+134
+130
+129
+129
+129
+131
+131
+133
+132
+132
+132
+133
+134
+136
+137
+139
+140
+138
+137
+135
+131
+127
+122
+119
+120
+127
+122
+129
+131
+117
+113
+124
+125
+127
+129
+131
+132
+133
+135
+138
+137
+130
+129
+134
+135
+136
+137
+141
+141
+138
+136
+136
+137
+135
+132
+129
+127
+125
+125
+123
+120
+120
+117
+112
+108
+99
+92
+83
+73
+66
+61
+57
+55
+57
+57
+54
+52
+49
+46
+44
+44
+41
+41
+41
+41
+42
+42
+43
+45
+44
+50
+53
+56
+66
+85
+102
+110
+116
+113
+117
+120
+119
+115
+116
+119
+122
+120
+119
+120
+121
+123
+123
+124
+121
+122
+119
+115
+109
+100
+87
+78
+68
+62
+56
+53
+53
+54
+54
+55
+55
+56
+56
+57
+58
+61
+62
+62
+62
+62
+62
+63
+63
+62
+61
+59
+58
+57
+57
+56
+56
+57
+56
+55
+52
+53
+52
+54
+54
+54
+54
+52
+52
+52
+52
+52
+52
+52
+53
+51
+51
+52
+52
+52
+52
+53
+53
+56
+56
+57
+58
+61
+62
+64
+65
+67
+68
+71
+72
+70
+70
+70
+70
+69
+67
+66
+65
+64
+64
+63
+62
+62
+63
+64
+64
+65
+68
+75
+81
+86
+85
+82
+75
+68
+63
+61
+63
+67
+73
+83
+88
+93
+100
+108
+118
+125
+130
+131
+130
+126
+125
+125
+125
+128
+131
+134
+133
+131
+131
+132
+132
+136
+136
+137
+138
+135
+134
+131
+128
+126
+124
+121
+126
+133
+138
+160
+166
+138
+124
+130
+128
+123
+122
+124
+125
+127
+130
+137
+134
+119
+117
+130
+141
+150
+159
+166
+167
+157
+150
+146
+143
+139
+134
+130
+131
+134
+136
+134
+131
+129
+126
+122
+118
+109
+104
+96
+87
+80
+72
+66
+64
+61
+60
+56
+53
+50
+47
+44
+43
+43
+44
+45
+47
+51
+52
+54
+54
+51
+60
+69
+73
+81
+93
+103
+106
+110
+107
+108
+112
+113
+111
+111
+114
+117
+114
+113
+116
+120
+122
+121
+121
+118
+119
+117
+111
+106
+99
+85
+78
+67
+64
+58
+54
+55
+55
+55
+56
+56
+57
+58
+58
+59
+62
+63
+63
+63
+64
+64
+66
+66
+65
+64
+61
+61
+60
+60
+60
+60
+60
+60
+59
+57
+57
+56
+56
+57
+56
+56
+56
+56
+54
+54
+54
+54
+53
+53
+54
+54
+55
+55
+53
+53
+56
+57
+58
+60
+61
+64
+64
+65
+67
+68
+71
+72
+73
+73
+74
+74
+74
+73
+70
+68
+66
+65
+65
+64
+64
+63
+63
+64
+64
+65
+64
+65
+67
+70
+72
+74
+74
+72
+69
+69
+69
+70
+73
+73
+76
+82
+90
+100
+110
+122
+131
+137
+139
+139
+139
+135
+130
+127
+127
+130
+136
+138
+133
+132
+132
+134
+134
+133
+132
+131
+128
+127
+126
+127
+127
+128
+129
+135
+144
+160
+203
+216
+171
+138
+136
+127
+117
+114
+113
+114
+118
+124
+132
+128
+113
+116
+138
+156
+173
+186
+194
+195
+191
+183
+173
+163
+154
+145
+139
+137
+140
+142
+139
+135
+132
+128
+122
+119
+112
+107
+103
+94
+88
+80
+72
+67
+65
+64
+59
+56
+52
+50
+46
+46
+48
+51
+54
+58
+62
+65
+69
+67
+70
+76
+86
+91
+96
+103
+105
+106
+108
+103
+102
+108
+111
+110
+110
+114
+115
+111
+111
+114
+119
+121
+120
+117
+115
+117
+115
+110
+105
+98
+84
+77
+72
+69
+63
+55
+55
+56
+56
+56
+57
+58
+58
+59
+60
+63
+64
+64
+64
+65
+65
+67
+67
+67
+66
+63
+62
+62
+61
+62
+62
+62
+62
+61
+60
+58
+59
+58
+58
+57
+57
+57
+57
+57
+55
+54
+54
+54
+54
+54
+55
+55
+55
+53
+54
+57
+59
+60
+63
+66
+66
+65
+66
+67
+69
+72
+73
+74
+74
+75
+75
+74
+74
+70
+69
+67
+66
+66
+66
+65
+64
+64
+65
+66
+66
+63
+64
+66
+69
+71
+73
+77
+78
+77
+78
+81
+81
+81
+82
+80
+86
+103
+114
+126
+137
+149
+155
+159
+159
+160
+153
+142
+133
+132
+133
+140
+143
+139
+138
+137
+136
+136
+132
+128
+125
+122
+122
+122
+125
+129
+134
+139
+146
+150
+176
+234
+252
+195
+149
+137
+120
+112
+106
+104
+106
+111
+118
+128
+130
+124
+134
+160
+183
+203
+214
+218
+218
+230
+219
+207
+195
+184
+174
+165
+162
+159
+159
+156
+152
+148
+141
+137
+133
+127
+124
+119
+112
+105
+98
+87
+83
+79
+77
+73
+68
+64
+59
+55
+54
+57
+58
+61
+65
+70
+72
+75
+72
+84
+89
+100
+103
+105
+110
+109
+108
+107
+103
+103
+109
+112
+113
+114
+117
+116
+111
+111
+114
+119
+121
+119
+116
+115
+117
+115
+111
+105
+97
+84
+77
+78
+76
+69
+57
+57
+57
+57
+57
+58
+61
+61
+61
+61
+64
+64
+65
+66
+68
+68
+69
+69
+69
+68
+68
+67
+69
+68
+66
+66
+66
+66
+66
+66
+65
+65
+65
+65
+65
+64
+64
+62
+62
+62
+60
+60
+59
+58
+56
+56
+55
+55
+57
+57
+57
+58
+60
+61
+65
+66
+67
+68
+70
+74
+75
+76
+78
+78
+78
+78
+76
+75
+73
+72
+69
+69
+66
+65
+64
+63
+63
+63
+64
+64
+60
+77
+77
+75
+84
+82
+81
+95
+91
+94
+95
+92
+94
+101
+109
+114
+137
+143
+151
+159
+159
+155
+154
+158
+166
+164
+168
+171
+165
+153
+151
+156
+148
+146
+143
+137
+136
+135
+127
+117
+117
+115
+116
+121
+133
+142
+149
+155
+198
+229
+194
+202
+224
+171
+134
+132
+109
+105
+105
+107
+107
+111
+125
+141
+145
+177
+208
+218
+222
+229
+241
+243
+243
+233
+227
+226
+224
+218
+216
+215
+196
+192
+189
+185
+181
+175
+171
+167
+157
+157
+154
+150
+145
+135
+127
+123
+117
+103
+100
+97
+79
+71
+76
+77
+72
+69
+68
+70
+70
+71
+75
+81
+89
+96
+102
+103
+107
+117
+117
+111
+108
+108
+112
+114
+115
+117
+119
+118
+114
+115
+115
+113
+115
+119
+122
+121
+120
+115
+109
+107
+105
+97
+84
+79
+79
+84
+82
+57
+57
+57
+57
+58
+59
+62
+63
+62
+62
+65
+65
+66
+67
+68
+68
+70
+69
+69
+69
+68
+68
+69
+69
+69
+69
+69
+68
+67
+67
+68
+67
+66
+66
+66
+66
+65
+65
+64
+64
+62
+60
+59
+59
+57
+56
+55
+55
+57
+57
+57
+58
+60
+62
+65
+66
+67
+69
+73
+74
+76
+76
+78
+78
+78
+78
+77
+74
+73
+72
+69
+69
+67
+66
+64
+64
+64
+64
+65
+65
+67
+73
+75
+86
+106
+116
+123
+133
+129
+131
+132
+132
+141
+152
+161
+162
+147
+148
+154
+159
+160
+156
+156
+159
+163
+155
+153
+160
+164
+167
+174
+182
+181
+176
+167
+155
+147
+142
+133
+121
+114
+124
+135
+133
+133
+149
+181
+211
+219
+221
+199
+190
+208
+179
+132
+130
+121
+101
+96
+107
+117
+119
+127
+150
+185
+210
+224
+231
+238
+249
+255
+255
+255
+243
+236
+234
+230
+224
+222
+221
+219
+216
+214
+213
+208
+206
+204
+201
+204
+203
+203
+202
+202
+201
+199
+197
+195
+177
+163
+153
+141
+132
+107
+72
+84
+77
+72
+74
+75
+75
+79
+85
+91
+99
+103
+105
+110
+122
+122
+116
+114
+112
+112
+113
+117
+119
+119
+119
+115
+120
+122
+121
+126
+131
+133
+131
+129
+122
+114
+109
+104
+96
+84
+78
+82
+86
+86
+56
+56
+56
+57
+59
+60
+63
+64
+64
+64
+67
+67
+67
+67
+68
+68
+70
+70
+70
+69
+69
+69
+71
+70
+74
+73
+72
+71
+70
+69
+70
+69
+68
+68
+68
+68
+68
+68
+68
+67
+63
+63
+60
+59
+58
+58
+57
+57
+57
+57
+58
+59
+62
+64
+66
+67
+69
+70
+73
+75
+77
+77
+78
+77
+80
+77
+76
+75
+73
+72
+69
+68
+67
+67
+65
+65
+63
+64
+64
+68
+83
+82
+105
+142
+173
+193
+203
+196
+154
+150
+149
+155
+171
+190
+203
+196
+163
+157
+160
+165
+165
+163
+164
+167
+171
+161
+152
+157
+165
+172
+178
+184
+167
+177
+185
+190
+186
+173
+150
+130
+123
+118
+122
+133
+156
+186
+215
+232
+225
+206
+205
+187
+198
+198
+148
+140
+125
+106
+104
+117
+128
+130
+143
+177
+224
+239
+238
+239
+248
+255
+255
+254
+255
+245
+240
+239
+237
+233
+236
+239
+241
+239
+239
+237
+236
+234
+233
+232
+228
+229
+228
+228
+233
+238
+242
+244
+252
+237
+225
+210
+203
+199
+166
+114
+93
+88
+87
+81
+66
+58
+63
+76
+86
+97
+101
+104
+113
+127
+126
+119
+120
+117
+114
+114
+118
+121
+122
+122
+128
+132
+138
+141
+146
+151
+152
+150
+145
+135
+122
+112
+103
+94
+84
+80
+82
+88
+89
+55
+55
+56
+57
+59
+61
+64
+65
+66
+66
+68
+68
+68
+68
+69
+69
+71
+71
+71
+70
+70
+70
+72
+72
+76
+75
+74
+73
+72
+71
+70
+69
+68
+68
+69
+69
+68
+69
+69
+69
+64
+63
+61
+60
+59
+58
+58
+58
+57
+57
+59
+59
+63
+64
+67
+68
+70
+70
+74
+75
+77
+77
+77
+77
+79
+79
+76
+75
+74
+71
+69
+68
+68
+68
+66
+64
+64
+65
+66
+70
+81
+88
+135
+189
+216
+228
+226
+201
+157
+148
+144
+152
+173
+196
+212
+203
+177
+167
+169
+172
+175
+176
+179
+180
+178
+169
+163
+164
+169
+171
+174
+173
+182
+186
+187
+186
+190
+197
+196
+190
+153
+139
+135
+157
+195
+219
+224
+218
+221
+204
+209
+198
+197
+200
+167
+144
+119
+120
+126
+130
+133
+145
+172
+213
+234
+246
+242
+242
+249
+253
+249
+243
+253
+248
+244
+246
+248
+249
+255
+255
+255
+252
+252
+249
+247
+248
+246
+245
+247
+245
+244
+245
+247
+252
+255
+255
+255
+253
+250
+239
+228
+226
+213
+180
+124
+104
+88
+80
+71
+63
+59
+65
+81
+95
+103
+111
+124
+136
+135
+125
+122
+124
+124
+122
+122
+125
+131
+136
+149
+156
+163
+166
+172
+177
+176
+171
+161
+148
+131
+115
+104
+93
+83
+80
+80
+86
+87
+54
+54
+55
+56
+58
+60
+63
+64
+66
+66
+68
+68
+68
+69
+70
+70
+70
+70
+71
+72
+72
+72
+74
+74
+76
+75
+75
+74
+74
+73
+72
+71
+69
+69
+69
+69
+69
+69
+68
+68
+64
+64
+64
+63
+60
+59
+59
+58
+59
+59
+59
+60
+63
+65
+67
+68
+71
+71
+75
+77
+77
+78
+79
+79
+79
+78
+78
+74
+73
+71
+68
+68
+68
+68
+66
+64
+65
+65
+66
+75
+91
+116
+172
+218
+229
+226
+213
+182
+167
+156
+145
+149
+171
+193
+211
+204
+177
+168
+170
+173
+178
+184
+188
+187
+172
+170
+168
+166
+170
+176
+183
+187
+200
+204
+206
+205
+211
+220
+223
+218
+193
+195
+203
+209
+215
+218
+223
+224
+217
+215
+205
+206
+190
+178
+181
+150
+123
+130
+136
+133
+147
+176
+206
+232
+231
+237
+230
+227
+227
+227
+228
+229
+240
+239
+239
+242
+245
+248
+254
+255
+255
+253
+252
+250
+251
+252
+253
+252
+253
+251
+250
+250
+250
+249
+249
+250
+255
+255
+255
+253
+238
+230
+226
+216
+186
+140
+96
+81
+86
+86
+74
+65
+82
+101
+117
+128
+142
+153
+149
+136
+130
+137
+143
+140
+135
+138
+151
+164
+178
+184
+191
+192
+194
+197
+195
+190
+176
+162
+141
+121
+105
+92
+84
+82
+80
+84
+86
+53
+53
+54
+55
+56
+58
+61
+62
+64
+64
+67
+68
+69
+69
+71
+71
+71
+71
+72
+73
+73
+73
+75
+76
+76
+75
+76
+75
+76
+75
+74
+73
+71
+71
+70
+70
+69
+69
+68
+67
+65
+65
+64
+64
+61
+60
+59
+59
+59
+59
+59
+60
+63
+65
+68
+69
+72
+74
+76
+77
+78
+78
+79
+79
+79
+78
+77
+76
+73
+71
+70
+67
+67
+66
+66
+64
+64
+65
+66
+78
+106
+149
+195
+218
+220
+219
+209
+188
+172
+159
+150
+148
+161
+179
+193
+189
+167
+162
+165
+167
+175
+184
+186
+183
+174
+173
+167
+164
+170
+182
+195
+202
+188
+203
+221
+232
+239
+239
+231
+218
+216
+222
+229
+224
+216
+214
+224
+231
+216
+221
+202
+205
+189
+174
+200
+184
+142
+135
+132
+139
+170
+209
+226
+229
+240
+239
+226
+216
+209
+209
+219
+233
+235
+238
+239
+245
+246
+246
+249
+253
+251
+248
+248
+249
+254
+255
+255
+255
+251
+251
+250
+247
+247
+244
+241
+241
+255
+251
+251
+255
+251
+243
+236
+224
+231
+194
+150
+116
+93
+82
+82
+87
+94
+114
+136
+149
+159
+166
+161
+150
+149
+158
+166
+166
+162
+166
+181
+194
+204
+209
+213
+213
+212
+213
+209
+203
+191
+176
+152
+128
+109
+96
+87
+86
+83
+86
+87
+53
+53
+53
+53
+54
+56
+58
+59
+61
+62
+65
+67
+68
+70
+72
+72
+71
+72
+73
+73
+74
+74
+77
+77
+77
+76
+77
+77
+78
+77
+78
+77
+74
+74
+73
+72
+71
+70
+68
+68
+67
+67
+65
+64
+63
+63
+60
+60
+60
+60
+60
+60
+64
+65
+68
+69
+72
+75
+77
+78
+80
+80
+79
+79
+79
+79
+77
+76
+73
+70
+69
+67
+66
+65
+65
+63
+63
+64
+64
+78
+111
+165
+190
+186
+188
+193
+191
+183
+167
+162
+155
+150
+152
+158
+164
+162
+158
+160
+162
+165
+173
+183
+184
+178
+177
+173
+168
+166
+175
+188
+195
+196
+193
+203
+213
+221
+232
+245
+253
+252
+233
+227
+220
+217
+220
+223
+229
+228
+215
+212
+207
+206
+196
+187
+199
+210
+166
+143
+139
+164
+203
+224
+232
+233
+246
+238
+225
+213
+202
+200
+211
+229
+240
+245
+251
+255
+254
+249
+249
+250
+247
+246
+246
+249
+251
+254
+255
+255
+255
+255
+255
+255
+251
+249
+247
+244
+251
+245
+249
+252
+250
+255
+255
+242
+240
+229
+211
+175
+132
+104
+105
+115
+121
+140
+163
+173
+178
+182
+178
+170
+176
+182
+189
+192
+195
+201
+213
+221
+226
+231
+233
+230
+229
+228
+224
+217
+202
+186
+162
+136
+116
+101
+92
+91
+92
+92
+94
+53
+53
+53
+53
+53
+54
+56
+57
+60
+61
+64
+66
+68
+70
+71
+72
+72
+72
+72
+74
+74
+75
+75
+78
+77
+77
+77
+77
+77
+77
+78
+78
+77
+77
+75
+74
+72
+71
+69
+68
+67
+67
+65
+65
+64
+63
+60
+60
+62
+62
+60
+61
+62
+65
+67
+68
+72
+73
+76
+77
+78
+80
+79
+79
+76
+76
+75
+76
+74
+73
+70
+67
+65
+62
+61
+60
+63
+64
+66
+83
+134
+193
+200
+174
+170
+177
+171
+171
+170
+171
+169
+163
+160
+161
+161
+158
+160
+163
+166
+166
+173
+182
+183
+176
+171
+168
+169
+172
+187
+198
+197
+188
+188
+201
+218
+227
+238
+246
+249
+247
+246
+241
+236
+232
+227
+226
+225
+222
+222
+207
+219
+205
+199
+194
+179
+209
+191
+165
+170
+205
+232
+231
+235
+246
+237
+227
+215
+207
+195
+185
+187
+199
+229
+234
+242
+249
+252
+250
+250
+251
+252
+251
+250
+249
+251
+253
+255
+255
+255
+255
+255
+251
+247
+245
+245
+243
+244
+252
+255
+243
+231
+249
+255
+255
+246
+238
+231
+220
+199
+170
+143
+126
+153
+171
+190
+197
+198
+200
+199
+195
+203
+204
+209
+215
+221
+230
+232
+237
+239
+242
+244
+240
+238
+237
+234
+228
+209
+193
+171
+145
+122
+108
+98
+96
+100
+100
+100
+50
+51
+52
+54
+56
+57
+57
+57
+59
+60
+61
+63
+65
+67
+69
+69
+72
+72
+72
+74
+75
+76
+77
+78
+77
+74
+71
+74
+78
+78
+71
+68
+78
+76
+74
+75
+77
+76
+70
+66
+69
+67
+64
+63
+64
+63
+60
+60
+67
+66
+65
+62
+63
+62
+63
+64
+66
+68
+71
+74
+76
+79
+79
+76
+70
+69
+72
+74
+75
+77
+75
+72
+67
+55
+55
+62
+62
+58
+67
+101
+189
+183
+166
+164
+167
+164
+163
+168
+162
+165
+169
+171
+172
+172
+174
+170
+164
+161
+162
+166
+170
+172
+172
+172
+169
+171
+173
+179
+189
+196
+192
+184
+199
+203
+207
+213
+219
+225
+231
+237
+240
+242
+242
+239
+234
+227
+221
+218
+219
+212
+207
+206
+197
+190
+194
+207
+200
+207
+225
+238
+240
+237
+243
+248
+235
+225
+214
+201
+187
+179
+177
+180
+202
+212
+222
+226
+235
+248
+254
+249
+253
+250
+253
+255
+253
+250
+254
+255
+255
+255
+249
+245
+244
+248
+253
+255
+255
+255
+249
+239
+229
+229
+247
+255
+255
+240
+245
+232
+198
+194
+140
+145
+171
+189
+212
+222
+221
+220
+222
+226
+231
+235
+241
+244
+245
+245
+243
+244
+248
+248
+248
+245
+242
+237
+232
+229
+214
+205
+187
+163
+139
+121
+114
+112
+123
+119
+118
+48
+49
+51
+53
+54
+55
+56
+56
+58
+59
+61
+63
+65
+67
+68
+69
+72
+72
+72
+74
+75
+76
+77
+78
+75
+75
+75
+80
+87
+89
+86
+82
+79
+77
+72
+70
+71
+72
+70
+66
+68
+65
+63
+63
+64
+64
+61
+59
+61
+61
+61
+60
+61
+62
+61
+62
+66
+68
+71
+74
+77
+79
+80
+76
+65
+63
+69
+72
+74
+74
+70
+67
+65
+60
+61
+69
+74
+80
+100
+133
+176
+171
+160
+161
+163
+158
+158
+163
+161
+167
+174
+179
+182
+183
+184
+181
+170
+165
+164
+165
+168
+171
+171
+171
+174
+171
+177
+191
+198
+193
+188
+192
+203
+207
+208
+209
+212
+216
+224
+231
+238
+244
+244
+241
+234
+225
+215
+213
+222
+217
+213
+212
+204
+193
+196
+207
+209
+218
+233
+243
+244
+240
+245
+248
+229
+218
+210
+197
+183
+174
+170
+171
+182
+198
+212
+220
+227
+239
+250
+254
+248
+247
+250
+255
+253
+249
+252
+255
+255
+255
+252
+249
+249
+252
+254
+255
+255
+255
+244
+242
+243
+246
+247
+247
+250
+248
+238
+220
+203
+182
+115
+150
+180
+206
+229
+239
+235
+233
+236
+237
+246
+251
+255
+255
+255
+255
+254
+252
+253
+252
+251
+249
+247
+243
+240
+238
+230
+220
+202
+179
+158
+142
+137
+136
+142
+137
+134
+47
+48
+49
+50
+52
+53
+55
+55
+58
+58
+60
+62
+64
+66
+67
+68
+73
+73
+74
+76
+77
+78
+78
+79
+75
+78
+84
+95
+105
+109
+108
+107
+96
+89
+79
+72
+72
+71
+69
+64
+67
+63
+60
+60
+61
+62
+62
+61
+56
+57
+59
+60
+61
+62
+63
+64
+69
+71
+73
+76
+79
+80
+80
+76
+60
+58
+62
+65
+66
+67
+63
+60
+63
+68
+75
+82
+92
+111
+139
+164
+165
+162
+159
+164
+165
+158
+158
+162
+164
+170
+177
+182
+185
+187
+190
+190
+178
+172
+169
+169
+171
+173
+173
+173
+178
+176
+185
+203
+203
+188
+186
+201
+208
+212
+212
+214
+216
+220
+227
+232
+240
+244
+244
+240
+231
+221
+212
+210
+221
+220
+218
+218
+211
+200
+197
+203
+201
+205
+217
+229
+234
+233
+236
+235
+222
+213
+205
+194
+182
+174
+171
+172
+172
+192
+212
+221
+224
+232
+247
+255
+244
+244
+249
+253
+254
+250
+251
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+254
+250
+252
+255
+250
+236
+248
+254
+218
+203
+218
+187
+103
+151
+178
+215
+245
+253
+250
+250
+249
+244
+251
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+254
+252
+250
+248
+240
+229
+211
+190
+173
+162
+157
+157
+163
+157
+153
+47
+47
+48
+49
+50
+51
+53
+54
+56
+57
+59
+61
+63
+65
+66
+67
+72
+74
+75
+77
+80
+79
+81
+79
+76
+81
+94
+109
+122
+129
+128
+128
+123
+114
+101
+89
+84
+77
+71
+66
+68
+64
+60
+59
+59
+60
+61
+59
+58
+57
+59
+62
+63
+64
+63
+65
+70
+72
+75
+77
+79
+79
+80
+76
+66
+63
+64
+65
+65
+64
+62
+60
+61
+70
+80
+88
+107
+135
+161
+174
+167
+165
+165
+170
+168
+160
+161
+164
+165
+171
+179
+185
+189
+193
+197
+196
+189
+182
+178
+174
+175
+176
+178
+179
+182
+185
+196
+203
+200
+190
+192
+205
+214
+216
+218
+219
+222
+225
+230
+236
+243
+244
+244
+239
+228
+219
+210
+208
+215
+218
+218
+220
+214
+208
+205
+210
+196
+197
+202
+216
+226
+229
+222
+214
+211
+206
+199
+190
+181
+176
+175
+177
+172
+189
+209
+217
+221
+229
+243
+253
+240
+240
+246
+254
+254
+252
+250
+252
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+246
+252
+252
+243
+239
+236
+206
+220
+251
+211
+104
+113
+166
+210
+247
+255
+255
+255
+255
+249
+250
+252
+255
+255
+255
+255
+254
+255
+255
+255
+255
+255
+255
+254
+254
+253
+246
+236
+218
+201
+186
+179
+177
+176
+183
+175
+169
+49
+49
+48
+48
+49
+50
+52
+53
+55
+56
+57
+59
+61
+63
+65
+68
+73
+76
+78
+80
+82
+82
+83
+81
+79
+86
+102
+119
+134
+141
+143
+143
+142
+135
+123
+112
+105
+95
+85
+78
+75
+69
+63
+59
+57
+57
+56
+56
+54
+55
+56
+59
+62
+63
+66
+67
+71
+74
+75
+76
+77
+77
+76
+76
+77
+76
+73
+67
+63
+60
+56
+55
+57
+64
+72
+90
+119
+149
+167
+169
+170
+170
+171
+172
+169
+165
+166
+171
+167
+173
+181
+188
+193
+197
+202
+202
+197
+190
+186
+183
+183
+184
+186
+186
+187
+199
+205
+197
+193
+198
+203
+207
+219
+223
+225
+226
+227
+231
+236
+240
+245
+246
+242
+236
+226
+217
+208
+207
+214
+217
+216
+216
+215
+212
+214
+216
+214
+205
+201
+203
+214
+217
+210
+197
+197
+194
+192
+186
+183
+180
+182
+185
+181
+191
+201
+210
+219
+227
+237
+246
+236
+237
+242
+251
+255
+253
+250
+251
+251
+251
+255
+255
+255
+255
+255
+255
+255
+255
+255
+251
+245
+253
+254
+243
+231
+224
+226
+255
+255
+239
+140
+108
+166
+206
+243
+255
+255
+255
+255
+251
+252
+253
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+253
+243
+228
+214
+205
+201
+202
+202
+201
+190
+182
+54
+52
+51
+49
+49
+50
+51
+52
+54
+55
+56
+58
+60
+62
+64
+66
+74
+77
+79
+82
+84
+84
+83
+82
+81
+90
+108
+127
+140
+150
+153
+154
+153
+148
+140
+134
+129
+120
+110
+102
+93
+86
+77
+68
+62
+59
+59
+55
+53
+52
+54
+56
+60
+63
+67
+70
+71
+72
+73
+73
+73
+72
+72
+72
+76
+76
+71
+64
+58
+53
+49
+47
+55
+55
+67
+93
+126
+149
+157
+158
+167
+170
+170
+170
+169
+169
+172
+176
+171
+178
+185
+191
+195
+200
+205
+207
+203
+198
+194
+193
+193
+194
+194
+195
+197
+209
+208
+195
+195
+208
+214
+211
+224
+228
+231
+232
+234
+237
+240
+243
+246
+245
+241
+236
+225
+218
+209
+208
+216
+217
+214
+213
+213
+212
+212
+214
+236
+225
+211
+204
+202
+204
+200
+192
+188
+188
+188
+185
+183
+184
+188
+191
+193
+193
+197
+207
+215
+221
+228
+235
+232
+234
+240
+249
+254
+252
+252
+252
+248
+249
+253
+255
+255
+255
+255
+255
+254
+255
+252
+250
+255
+255
+252
+233
+243
+231
+240
+255
+254
+236
+194
+165
+179
+206
+240
+255
+255
+255
+255
+251
+253
+252
+253
+255
+255
+255
+253
+255
+255
+255
+255
+255
+255
+255
+254
+252
+249
+242
+231
+223
+219
+221
+224
+223
+221
+207
+197
+60
+59
+56
+53
+52
+52
+53
+54
+55
+56
+57
+59
+61
+63
+65
+67
+74
+77
+80
+83
+87
+85
+85
+83
+83
+93
+110
+130
+145
+154
+159
+162
+161
+158
+153
+149
+148
+144
+137
+130
+122
+114
+102
+88
+80
+73
+70
+67
+63
+61
+59
+59
+60
+63
+67
+69
+70
+70
+69
+69
+67
+66
+65
+65
+69
+71
+71
+71
+70
+67
+63
+62
+67
+65
+75
+102
+128
+138
+140
+146
+164
+169
+171
+172
+173
+175
+176
+177
+177
+182
+189
+195
+200
+204
+210
+212
+207
+205
+203
+203
+204
+205
+204
+203
+211
+213
+210
+204
+206
+216
+218
+215
+228
+233
+236
+238
+240
+242
+244
+246
+247
+244
+240
+233
+226
+217
+210
+207
+212
+213
+211
+209
+210
+211
+210
+208
+227
+232
+231
+218
+204
+196
+191
+185
+185
+185
+185
+185
+184
+186
+192
+195
+201
+198
+201
+209
+213
+214
+216
+223
+230
+232
+237
+245
+252
+251
+251
+251
+246
+247
+249
+253
+255
+255
+255
+255
+246
+242
+244
+250
+255
+255
+247
+236
+246
+239
+227
+239
+218
+223
+222
+210
+191
+199
+230
+255
+255
+255
+255
+254
+251
+249
+248
+250
+250
+249
+250
+252
+255
+255
+255
+255
+255
+254
+252
+249
+240
+233
+228
+226
+230
+235
+241
+241
+236
+220
+208
+64
+61
+58
+55
+53
+53
+53
+54
+55
+55
+57
+59
+61
+63
+64
+66
+74
+77
+82
+86
+87
+88
+87
+84
+83
+94
+112
+130
+145
+156
+163
+167
+170
+166
+161
+160
+159
+157
+153
+149
+146
+137
+121
+106
+96
+88
+82
+79
+78
+75
+70
+64
+63
+63
+64
+65
+67
+67
+66
+66
+63
+62
+60
+59
+65
+71
+80
+89
+95
+99
+99
+101
+102
+95
+106
+130
+146
+143
+142
+150
+167
+174
+174
+175
+176
+180
+178
+176
+181
+188
+194
+200
+205
+209
+213
+216
+210
+208
+208
+209
+212
+212
+211
+211
+222
+213
+209
+214
+222
+222
+218
+220
+231
+235
+239
+241
+244
+247
+247
+247
+247
+244
+238
+233
+225
+218
+212
+207
+206
+207
+206
+207
+208
+210
+209
+206
+203
+227
+243
+235
+213
+196
+186
+181
+184
+184
+185
+185
+186
+189
+192
+196
+202
+202
+206
+213
+211
+206
+205
+214
+227
+230
+232
+242
+248
+249
+247
+250
+244
+245
+248
+251
+255
+255
+255
+255
+239
+239
+249
+253
+249
+242
+245
+253
+251
+255
+235
+243
+238
+246
+237
+223
+190
+188
+216
+249
+255
+255
+254
+255
+252
+251
+248
+249
+249
+250
+252
+253
+253
+255
+255
+255
+255
+251
+247
+243
+235
+232
+228
+232
+240
+249
+255
+254
+244
+227
+214
+66
+65
+64
+62
+60
+58
+56
+55
+54
+54
+55
+56
+59
+62
+65
+69
+73
+77
+82
+85
+87
+88
+90
+91
+84
+88
+103
+124
+141
+151
+158
+165
+170
+171
+172
+172
+170
+170
+168
+169
+159
+153
+141
+129
+116
+104
+93
+88
+88
+89
+86
+77
+67
+63
+63
+66
+62
+64
+66
+63
+60
+58
+62
+65
+70
+85
+101
+108
+119
+131
+132
+128
+137
+144
+157
+164
+162
+154
+151
+158
+167
+172
+174
+177
+179
+180
+182
+185
+186
+190
+196
+203
+209
+214
+218
+218
+215
+216
+217
+216
+216
+216
+218
+221
+230
+224
+218
+227
+254
+255
+255
+231
+229
+237
+241
+244
+244
+245
+248
+248
+247
+243
+237
+227
+218
+212
+212
+211
+204
+202
+205
+207
+210
+210
+210
+209
+218
+207
+220
+244
+229
+203
+197
+183
+183
+182
+185
+186
+189
+191
+196
+198
+199
+204
+217
+223
+212
+195
+192
+207
+222
+226
+230
+239
+241
+239
+237
+241
+249
+248
+247
+247
+252
+255
+255
+253
+245
+239
+243
+251
+255
+255
+254
+252
+255
+247
+253
+252
+234
+235
+251
+233
+198
+173
+203
+232
+249
+255
+254
+252
+246
+247
+247
+246
+248
+253
+253
+251
+255
+255
+255
+253
+255
+255
+246
+231
+228
+223
+225
+241
+252
+253
+255
+255
+249
+231
+218
+67
+66
+65
+63
+61
+59
+58
+57
+55
+55
+55
+56
+58
+61
+64
+68
+72
+76
+81
+84
+86
+87
+89
+90
+85
+87
+101
+121
+138
+148
+155
+163
+171
+172
+174
+175
+176
+175
+175
+175
+169
+162
+152
+140
+128
+117
+105
+99
+96
+96
+93
+86
+77
+70
+66
+65
+60
+65
+70
+67
+65
+68
+79
+88
+102
+116
+130
+138
+149
+160
+165
+164
+172
+180
+185
+181
+173
+168
+168
+169
+167
+168
+171
+174
+176
+178
+181
+184
+187
+194
+202
+211
+217
+222
+223
+223
+225
+223
+223
+225
+229
+232
+231
+230
+229
+230
+228
+220
+213
+216
+235
+255
+241
+238
+234
+238
+248
+255
+254
+246
+250
+245
+239
+231
+222
+214
+212
+207
+203
+200
+202
+205
+207
+208
+209
+208
+211
+207
+212
+229
+229
+219
+205
+183
+188
+187
+189
+190
+190
+192
+194
+196
+200
+203
+213
+220
+210
+195
+191
+204
+219
+223
+229
+235
+237
+235
+233
+236
+247
+248
+249
+250
+252
+255
+255
+254
+241
+245
+255
+255
+255
+253
+250
+249
+249
+242
+249
+249
+236
+241
+247
+217
+182
+153
+185
+218
+239
+254
+251
+253
+248
+247
+247
+245
+248
+253
+254
+252
+253
+254
+252
+252
+255
+255
+245
+234
+229
+222
+223
+239
+252
+255
+255
+255
+248
+232
+221
+69
+69
+67
+65
+63
+61
+60
+59
+56
+56
+55
+56
+58
+61
+63
+67
+71
+74
+78
+82
+84
+87
+89
+89
+87
+88
+98
+115
+133
+144
+152
+160
+170
+173
+175
+177
+179
+180
+181
+181
+175
+172
+163
+153
+142
+131
+120
+115
+107
+105
+99
+93
+86
+78
+69
+64
+56
+65
+75
+76
+81
+90
+112
+130
+152
+165
+175
+178
+184
+192
+194
+192
+193
+207
+207
+195
+183
+180
+178
+173
+175
+176
+178
+180
+183
+187
+192
+196
+196
+203
+211
+217
+223
+225
+224
+223
+220
+217
+216
+222
+230
+236
+233
+228
+227
+219
+216
+219
+212
+204
+214
+233
+245
+242
+239
+240
+246
+250
+252
+248
+240
+236
+232
+227
+220
+216
+213
+209
+205
+203
+205
+208
+210
+211
+212
+212
+209
+214
+213
+213
+229
+237
+217
+194
+192
+191
+192
+191
+193
+192
+192
+192
+198
+199
+207
+216
+210
+198
+192
+199
+214
+216
+221
+228
+229
+226
+226
+229
+242
+246
+253
+254
+252
+250
+251
+255
+248
+255
+255
+255
+255
+252
+254
+255
+250
+247
+248
+242
+231
+234
+229
+197
+160
+126
+155
+195
+223
+241
+244
+255
+249
+249
+247
+245
+248
+253
+255
+252
+252
+252
+250
+251
+255
+255
+249
+239
+230
+220
+221
+238
+253
+255
+255
+255
+248
+233
+224
+73
+72
+70
+68
+66
+64
+63
+62
+58
+57
+57
+57
+58
+60
+62
+64
+69
+73
+76
+79
+82
+85
+87
+87
+88
+88
+94
+112
+128
+140
+149
+157
+168
+169
+173
+176
+177
+178
+180
+180
+175
+171
+165
+159
+151
+140
+130
+125
+117
+112
+102
+95
+89
+81
+71
+65
+61
+72
+84
+96
+110
+128
+150
+170
+189
+201
+203
+201
+198
+199
+198
+196
+197
+216
+223
+208
+195
+194
+186
+175
+173
+173
+174
+179
+182
+188
+195
+200
+211
+215
+218
+220
+222
+222
+221
+219
+211
+210
+211
+216
+225
+227
+225
+220
+220
+208
+205
+217
+226
+220
+208
+203
+233
+243
+253
+252
+244
+241
+245
+251
+241
+235
+228
+222
+218
+215
+214
+211
+211
+210
+214
+216
+218
+219
+220
+220
+210
+230
+229
+206
+223
+243
+223
+213
+200
+196
+195
+195
+194
+194
+193
+190
+194
+194
+200
+207
+206
+198
+191
+193
+206
+209
+213
+219
+221
+217
+218
+220
+235
+243
+252
+255
+250
+245
+245
+253
+255
+255
+255
+255
+250
+252
+255
+255
+255
+250
+244
+236
+224
+212
+200
+177
+141
+104
+130
+172
+206
+229
+239
+255
+251
+249
+248
+245
+248
+255
+255
+254
+251
+250
+249
+253
+255
+255
+253
+247
+235
+223
+222
+237
+254
+255
+255
+255
+247
+234
+228
+78
+77
+76
+74
+72
+70
+68
+67
+63
+62
+61
+61
+61
+62
+64
+63
+67
+69
+75
+78
+81
+82
+86
+86
+90
+86
+91
+108
+126
+138
+146
+154
+166
+169
+173
+175
+176
+176
+176
+175
+171
+168
+164
+160
+154
+147
+138
+134
+131
+123
+109
+100
+95
+89
+82
+78
+87
+95
+109
+129
+152
+172
+188
+202
+214
+223
+222
+215
+208
+203
+198
+194
+211
+225
+228
+215
+205
+203
+194
+182
+183
+184
+186
+189
+195
+202
+208
+213
+217
+218
+219
+217
+217
+217
+218
+215
+212
+215
+218
+221
+223
+222
+221
+220
+214
+217
+215
+207
+205
+210
+213
+212
+216
+230
+248
+253
+249
+245
+246
+247
+247
+237
+226
+218
+215
+215
+217
+217
+227
+228
+226
+226
+224
+223
+220
+218
+209
+239
+248
+211
+209
+230
+220
+230
+207
+202
+198
+197
+196
+196
+195
+192
+190
+190
+195
+199
+199
+194
+190
+188
+201
+202
+206
+213
+215
+213
+211
+215
+233
+240
+252
+255
+252
+242
+243
+252
+255
+255
+254
+244
+243
+250
+253
+249
+253
+245
+239
+236
+221
+192
+168
+156
+127
+89
+110
+150
+190
+223
+238
+254
+254
+252
+249
+246
+249
+255
+255
+254
+253
+250
+250
+254
+255
+255
+255
+255
+242
+229
+225
+240
+255
+255
+255
+255
+246
+237
+232
+81
+80
+79
+77
+75
+73
+71
+71
+66
+65
+64
+63
+63
+63
+65
+64
+66
+69
+75
+77
+80
+82
+85
+85
+89
+85
+90
+105
+124
+137
+147
+154
+166
+169
+172
+173
+174
+174
+173
+173
+169
+167
+164
+162
+159
+154
+149
+146
+146
+137
+124
+115
+111
+109
+105
+106
+121
+130
+142
+163
+187
+205
+214
+218
+224
+228
+224
+217
+210
+204
+199
+198
+227
+229
+224
+211
+206
+206
+200
+190
+195
+195
+197
+201
+206
+209
+215
+218
+214
+213
+214
+213
+214
+216
+219
+218
+219
+221
+224
+223
+221
+220
+220
+219
+210
+221
+218
+205
+198
+206
+210
+205
+204
+212
+226
+243
+255
+255
+254
+243
+234
+225
+216
+212
+215
+222
+228
+233
+239
+240
+238
+232
+227
+220
+215
+209
+205
+231
+255
+219
+200
+215
+211
+234
+217
+210
+203
+198
+198
+198
+195
+193
+187
+187
+190
+192
+191
+189
+188
+187
+195
+196
+200
+208
+211
+208
+210
+213
+233
+238
+251
+255
+255
+245
+245
+254
+255
+255
+245
+238
+241
+247
+240
+227
+243
+245
+241
+241
+238
+206
+169
+151
+117
+82
+97
+132
+177
+221
+239
+253
+254
+252
+250
+248
+252
+255
+255
+255
+255
+248
+250
+255
+255
+255
+255
+255
+250
+238
+234
+245
+255
+255
+255
+255
+249
+242
+238
+83
+82
+81
+79
+77
+75
+74
+73
+69
+68
+66
+65
+64
+65
+65
+64
+65
+67
+73
+77
+79
+82
+85
+85
+87
+82
+88
+106
+125
+137
+146
+152
+164
+166
+171
+171
+172
+173
+172
+172
+168
+166
+164
+163
+161
+160
+157
+155
+153
+146
+139
+134
+131
+132
+131
+136
+143
+154
+169
+187
+207
+224
+232
+232
+228
+222
+216
+210
+202
+194
+191
+195
+226
+223
+217
+216
+218
+216
+210
+200
+192
+190
+191
+192
+194
+195
+198
+198
+206
+208
+209
+212
+214
+217
+221
+220
+222
+219
+220
+219
+219
+218
+216
+215
+213
+211
+208
+207
+210
+209
+202
+192
+200
+202
+213
+231
+250
+255
+255
+247
+234
+225
+217
+215
+220
+227
+233
+240
+246
+248
+244
+237
+228
+222
+213
+207
+201
+209
+250
+228
+200
+208
+203
+228
+228
+220
+209
+201
+198
+197
+194
+191
+186
+188
+189
+188
+186
+186
+189
+190
+188
+188
+192
+200
+204
+202
+204
+208
+232
+236
+248
+255
+255
+247
+247
+253
+249
+244
+233
+227
+234
+242
+234
+222
+246
+255
+247
+238
+249
+239
+196
+163
+106
+73
+88
+117
+165
+220
+242
+249
+255
+255
+252
+249
+252
+255
+255
+255
+254
+247
+247
+253
+255
+255
+255
+255
+255
+246
+242
+251
+255
+254
+254
+255
+253
+248
+246
+86
+84
+83
+80
+79
+76
+76
+74
+72
+70
+69
+66
+66
+65
+67
+65
+67
+68
+74
+77
+79
+81
+84
+85
+85
+81
+87
+106
+126
+140
+147
+153
+159
+164
+166
+169
+169
+169
+169
+169
+165
+163
+163
+162
+164
+165
+165
+163
+152
+150
+148
+148
+149
+152
+158
+168
+164
+178
+193
+206
+218
+228
+235
+235
+231
+223
+216
+209
+199
+191
+189
+193
+225
+221
+221
+230
+236
+230
+219
+207
+205
+200
+201
+199
+198
+195
+194
+194
+198
+203
+206
+211
+216
+217
+219
+219
+228
+222
+218
+218
+223
+223
+219
+213
+216
+206
+202
+208
+206
+199
+202
+212
+200
+206
+215
+222
+230
+238
+246
+251
+255
+250
+242
+236
+234
+231
+229
+230
+244
+248
+244
+239
+232
+224
+217
+211
+198
+192
+244
+235
+207
+212
+203
+223
+234
+224
+211
+201
+198
+198
+195
+190
+190
+193
+192
+187
+183
+184
+189
+190
+181
+179
+184
+193
+197
+197
+200
+203
+229
+230
+241
+254
+254
+243
+240
+246
+248
+241
+229
+223
+233
+249
+247
+239
+253
+255
+245
+223
+246
+255
+211
+164
+96
+69
+82
+107
+156
+220
+244
+246
+255
+255
+253
+251
+252
+255
+255
+254
+250
+242
+242
+249
+253
+250
+254
+255
+255
+252
+248
+254
+255
+253
+253
+255
+255
+252
+251
+88
+87
+87
+85
+84
+82
+82
+80
+77
+75
+75
+72
+72
+71
+72
+70
+71
+71
+74
+78
+82
+85
+85
+86
+88
+85
+90
+107
+123
+137
+145
+152
+166
+167
+165
+164
+162
+163
+164
+164
+161
+161
+161
+164
+167
+172
+174
+171
+161
+156
+149
+152
+166
+180
+180
+179
+186
+205
+219
+227
+228
+227
+223
+223
+226
+221
+219
+200
+202
+202
+186
+219
+230
+233
+235
+232
+230
+225
+219
+212
+207
+200
+202
+209
+205
+191
+184
+189
+191
+195
+200
+203
+209
+212
+219
+224
+231
+224
+219
+222
+230
+231
+225
+215
+209
+206
+203
+201
+201
+203
+206
+207
+202
+207
+209
+210
+210
+213
+215
+220
+224
+230
+235
+235
+233
+231
+232
+237
+246
+246
+239
+236
+234
+227
+217
+208
+195
+196
+231
+233
+203
+223
+197
+218
+225
+220
+212
+204
+200
+198
+199
+200
+197
+194
+190
+188
+187
+186
+186
+183
+180
+181
+185
+187
+187
+190
+192
+196
+239
+245
+234
+244
+251
+236
+244
+255
+255
+251
+234
+226
+229
+237
+243
+245
+255
+255
+241
+241
+214
+248
+189
+133
+97
+74
+77
+115
+165
+205
+237
+255
+255
+255
+252
+251
+253
+254
+255
+251
+239
+229
+231
+240
+248
+252
+253
+255
+255
+255
+255
+255
+254
+252
+252
+251
+253
+255
+255
+89
+88
+88
+86
+85
+84
+83
+82
+78
+77
+76
+75
+74
+74
+74
+73
+71
+72
+76
+79
+82
+83
+86
+84
+88
+85
+89
+107
+123
+134
+141
+150
+161
+163
+161
+161
+160
+160
+162
+161
+160
+160
+158
+161
+164
+166
+166
+163
+163
+160
+160
+165
+177
+188
+189
+191
+204
+220
+230
+233
+230
+225
+219
+218
+224
+218
+218
+203
+204
+202
+193
+229
+230
+232
+234
+231
+226
+219
+213
+207
+212
+198
+197
+204
+204
+193
+184
+183
+185
+191
+198
+203
+209
+216
+225
+228
+229
+226
+225
+225
+228
+226
+221
+213
+211
+205
+201
+200
+204
+206
+207
+208
+213
+214
+211
+207
+201
+199
+203
+207
+216
+222
+227
+230
+230
+230
+230
+232
+236
+237
+236
+232
+224
+219
+213
+210
+213
+187
+214
+208
+217
+235
+218
+216
+231
+226
+220
+212
+205
+201
+200
+199
+200
+196
+191
+189
+189
+186
+185
+182
+178
+180
+183
+184
+186
+189
+193
+197
+235
+242
+231
+240
+245
+232
+241
+254
+255
+255
+242
+228
+228
+239
+253
+255
+253
+255
+235
+237
+215
+242
+178
+118
+94
+78
+83
+117
+169
+214
+246
+255
+255
+255
+253
+251
+250
+251
+250
+246
+237
+227
+227
+235
+244
+249
+252
+255
+255
+255
+255
+254
+249
+248
+250
+250
+249
+251
+254
+92
+91
+91
+89
+88
+87
+86
+86
+83
+82
+81
+79
+79
+79
+79
+77
+74
+74
+77
+80
+83
+86
+86
+84
+87
+86
+90
+107
+121
+133
+139
+146
+153
+155
+155
+155
+157
+158
+160
+160
+160
+157
+155
+156
+156
+157
+156
+155
+153
+158
+168
+178
+191
+198
+197
+194
+209
+218
+223
+225
+225
+225
+223
+223
+224
+215
+213
+207
+202
+195
+196
+233
+224
+228
+232
+227
+220
+214
+209
+204
+213
+196
+190
+197
+205
+198
+187
+183
+186
+191
+199
+207
+215
+222
+230
+233
+217
+218
+221
+223
+223
+222
+220
+217
+198
+192
+187
+186
+191
+191
+191
+193
+227
+229
+222
+213
+204
+200
+200
+204
+210
+213
+215
+217
+219
+220
+219
+220
+219
+223
+224
+220
+213
+208
+208
+209
+212
+194
+231
+210
+218
+222
+232
+240
+237
+231
+227
+221
+214
+207
+202
+197
+196
+192
+188
+185
+185
+183
+181
+178
+176
+177
+180
+181
+183
+185
+190
+195
+220
+234
+228
+240
+246
+231
+236
+245
+228
+240
+240
+235
+235
+242
+254
+255
+253
+252
+231
+232
+217
+237
+170
+108
+89
+79
+87
+119
+173
+225
+255
+255
+255
+255
+252
+250
+251
+251
+249
+244
+233
+222
+220
+225
+233
+239
+245
+252
+253
+255
+255
+249
+241
+239
+243
+247
+251
+252
+255
+92
+92
+91
+90
+89
+89
+88
+88
+85
+84
+83
+82
+82
+82
+82
+80
+76
+75
+79
+82
+84
+87
+87
+87
+86
+85
+92
+106
+121
+130
+138
+143
+148
+149
+149
+150
+152
+152
+155
+155
+156
+152
+150
+149
+147
+147
+146
+145
+136
+148
+168
+184
+199
+207
+210
+208
+217
+218
+218
+220
+222
+225
+229
+229
+227
+214
+209
+209
+198
+186
+197
+234
+221
+227
+230
+227
+219
+211
+208
+206
+207
+194
+187
+192
+199
+196
+189
+184
+189
+194
+203
+210
+217
+224
+232
+235
+217
+218
+222
+224
+225
+225
+220
+217
+202
+199
+195
+192
+192
+195
+198
+208
+236
+237
+228
+217
+207
+199
+200
+201
+207
+208
+207
+209
+212
+214
+212
+209
+211
+211
+211
+208
+205
+202
+204
+204
+204
+207
+244
+224
+210
+210
+230
+251
+255
+255
+255
+246
+231
+213
+199
+189
+196
+192
+187
+184
+183
+181
+178
+176
+175
+173
+176
+176
+177
+182
+188
+192
+203
+223
+226
+244
+248
+230
+228
+232
+218
+234
+239
+236
+240
+249
+255
+255
+254
+248
+229
+229
+218
+230
+168
+106
+85
+83
+92
+121
+176
+231
+255
+255
+255
+252
+251
+250
+249
+246
+242
+234
+219
+208
+205
+209
+217
+223
+233
+242
+244
+249
+251
+244
+234
+231
+235
+240
+251
+251
+254
+92
+92
+91
+91
+90
+89
+89
+89
+87
+86
+85
+85
+84
+85
+85
+83
+79
+79
+81
+83
+85
+88
+89
+88
+85
+85
+92
+104
+117
+124
+133
+140
+141
+142
+142
+144
+146
+147
+148
+147
+149
+146
+142
+137
+133
+129
+126
+129
+128
+145
+170
+193
+214
+225
+229
+230
+226
+220
+216
+216
+220
+227
+236
+237
+230
+215
+208
+208
+191
+179
+200
+224
+220
+225
+227
+225
+218
+212
+209
+207
+199
+192
+189
+189
+191
+191
+189
+189
+194
+199
+207
+213
+219
+224
+231
+235
+231
+230
+229
+232
+233
+231
+222
+214
+205
+205
+201
+197
+194
+196
+206
+222
+235
+237
+228
+216
+204
+198
+196
+197
+203
+203
+204
+206
+212
+212
+211
+208
+208
+202
+197
+196
+198
+199
+199
+199
+205
+205
+216
+225
+212
+228
+224
+223
+215
+214
+222
+229
+234
+234
+232
+228
+203
+196
+190
+184
+183
+180
+176
+174
+172
+172
+172
+172
+173
+177
+183
+186
+198
+222
+226
+240
+244
+229
+229
+232
+251
+254
+241
+229
+234
+252
+255
+255
+254
+245
+232
+228
+221
+226
+172
+115
+93
+94
+104
+129
+179
+232
+255
+255
+254
+251
+249
+247
+244
+237
+227
+218
+201
+191
+187
+192
+200
+207
+217
+227
+235
+243
+247
+242
+234
+231
+233
+238
+241
+240
+242
+91
+91
+91
+90
+90
+89
+89
+89
+88
+88
+87
+86
+86
+87
+87
+88
+81
+81
+83
+85
+88
+88
+89
+88
+87
+85
+89
+101
+110
+117
+126
+131
+133
+132
+135
+137
+139
+140
+141
+141
+144
+139
+131
+126
+120
+114
+108
+111
+131
+148
+175
+203
+227
+239
+243
+244
+235
+225
+217
+215
+222
+229
+240
+240
+228
+215
+204
+206
+186
+176
+201
+213
+216
+218
+219
+218
+216
+212
+205
+203
+192
+193
+192
+190
+188
+187
+189
+192
+196
+202
+210
+215
+220
+225
+228
+232
+234
+234
+234
+240
+246
+247
+240
+230
+219
+216
+215
+210
+209
+211
+220
+235
+237
+238
+230
+220
+209
+202
+200
+201
+198
+201
+206
+211
+218
+221
+221
+216
+211
+201
+194
+192
+195
+198
+197
+197
+204
+205
+205
+230
+219
+239
+227
+218
+213
+210
+213
+214
+210
+204
+198
+192
+206
+198
+188
+181
+177
+175
+171
+170
+171
+171
+172
+172
+171
+173
+178
+181
+201
+224
+224
+234
+238
+230
+240
+246
+255
+255
+241
+231
+240
+255
+255
+255
+253
+244
+237
+229
+222
+220
+180
+133
+113
+111
+121
+141
+182
+223
+249
+252
+255
+250
+244
+238
+230
+220
+208
+197
+178
+172
+172
+178
+185
+190
+201
+210
+224
+232
+240
+241
+236
+233
+232
+234
+232
+230
+229
+91
+91
+91
+91
+90
+90
+90
+90
+89
+89
+88
+88
+88
+89
+89
+89
+83
+84
+85
+88
+89
+90
+90
+89
+89
+85
+88
+95
+100
+106
+115
+121
+122
+122
+127
+130
+133
+135
+136
+136
+136
+131
+125
+121
+115
+110
+105
+111
+132
+151
+179
+210
+236
+246
+251
+252
+240
+231
+222
+219
+224
+231
+240
+239
+221
+212
+200
+201
+180
+177
+206
+201
+206
+208
+207
+208
+211
+207
+200
+195
+190
+195
+194
+191
+189
+190
+191
+193
+196
+203
+211
+217
+221
+225
+228
+234
+235
+241
+248
+253
+255
+255
+255
+253
+250
+246
+243
+243
+246
+247
+252
+254
+246
+244
+237
+227
+217
+208
+206
+206
+203
+209
+217
+223
+226
+228
+229
+223
+217
+207
+201
+196
+194
+194
+198
+200
+201
+211
+225
+235
+222
+224
+235
+232
+216
+213
+215
+215
+213
+210
+205
+201
+214
+204
+191
+180
+176
+172
+171
+169
+172
+173
+174
+173
+171
+171
+173
+177
+192
+218
+222
+232
+240
+234
+245
+253
+241
+248
+245
+237
+248
+255
+255
+255
+252
+242
+241
+231
+222
+217
+189
+152
+129
+123
+130
+145
+172
+203
+224
+233
+236
+227
+215
+205
+196
+187
+180
+172
+156
+152
+156
+163
+170
+175
+184
+194
+206
+216
+228
+235
+236
+233
+229
+226
+223
+218
+213
+91
+90
+90
+90
+90
+90
+89
+89
+90
+89
+89
+88
+88
+89
+90
+90
+86
+86
+88
+89
+90
+90
+90
+90
+91
+87
+87
+92
+94
+98
+106
+113
+116
+116
+120
+125
+129
+132
+133
+135
+130
+127
+125
+122
+122
+120
+116
+124
+133
+152
+178
+211
+237
+246
+252
+253
+244
+235
+228
+225
+227
+230
+237
+234
+214
+209
+197
+195
+178
+179
+209
+195
+201
+199
+197
+200
+205
+204
+195
+188
+192
+196
+195
+193
+194
+195
+194
+195
+196
+202
+212
+217
+221
+225
+229
+234
+245
+254
+255
+255
+255
+255
+255
+254
+254
+246
+242
+247
+255
+255
+252
+244
+246
+243
+237
+230
+218
+212
+209
+208
+212
+221
+230
+235
+235
+232
+232
+226
+223
+215
+211
+203
+196
+194
+200
+207
+206
+212
+230
+223
+224
+210
+236
+229
+213
+210
+210
+207
+206
+202
+200
+197
+227
+216
+202
+190
+183
+181
+181
+181
+175
+177
+177
+177
+175
+173
+173
+174
+177
+208
+220
+236
+244
+238
+245
+248
+255
+255
+250
+235
+241
+255
+255
+255
+250
+243
+245
+232
+220
+215
+196
+164
+134
+126
+129
+141
+161
+180
+200
+213
+202
+191
+176
+166
+157
+154
+150
+145
+140
+138
+143
+152
+158
+162
+170
+179
+190
+201
+216
+227
+232
+230
+223
+218
+211
+206
+200
+90
+90
+90
+90
+90
+90
+90
+90
+88
+88
+88
+89
+89
+90
+90
+90
+90
+90
+90
+91
+93
+94
+92
+92
+89
+87
+87
+88
+90
+93
+96
+96
+103
+106
+112
+114
+120
+129
+137
+138
+137
+140
+138
+135
+139
+145
+139
+137
+143
+161
+179
+202
+220
+231
+243
+254
+246
+241
+236
+233
+233
+233
+233
+226
+207
+197
+190
+183
+176
+178
+192
+210
+199
+212
+205
+204
+214
+199
+181
+187
+186
+193
+195
+194
+192
+194
+197
+199
+203
+208
+214
+216
+218
+224
+236
+245
+246
+247
+248
+249
+250
+252
+252
+252
+251
+247
+248
+255
+255
+255
+255
+255
+254
+238
+229
+227
+221
+211
+209
+218
+226
+232
+238
+242
+242
+239
+238
+229
+220
+209
+210
+236
+187
+196
+223
+200
+205
+222
+232
+226
+216
+218
+226
+229
+223
+213
+207
+203
+204
+205
+203
+197
+236
+224
+200
+185
+186
+184
+177
+180
+176
+176
+174
+175
+176
+178
+180
+179
+176
+186
+214
+236
+241
+246
+251
+245
+255
+253
+242
+244
+253
+255
+255
+255
+255
+241
+245
+239
+217
+208
+190
+158
+134
+125
+126
+135
+148
+158
+160
+156
+146
+138
+128
+122
+121
+124
+129
+131
+132
+134
+140
+147
+149
+152
+157
+162
+167
+175
+189
+206
+220
+224
+218
+211
+203
+192
+184
+90
+90
+90
+90
+90
+90
+90
+90
+88
+88
+88
+89
+89
+90
+90
+90
+90
+90
+92
+93
+93
+94
+92
+92
+93
+91
+91
+89
+90
+92
+95
+94
+97
+101
+107
+110
+117
+127
+135
+139
+143
+145
+143
+143
+154
+165
+158
+154
+156
+166
+175
+192
+208
+218
+231
+243
+245
+245
+244
+241
+236
+231
+225
+216
+199
+189
+182
+177
+171
+174
+189
+208
+218
+220
+212
+208
+213
+205
+187
+178
+189
+194
+196
+196
+196
+198
+199
+202
+207
+207
+212
+218
+227
+234
+239
+240
+231
+231
+235
+240
+246
+250
+254
+255
+251
+248
+250
+255
+255
+255
+255
+252
+244
+245
+244
+228
+218
+219
+221
+218
+241
+244
+247
+246
+246
+248
+249
+244
+219
+218
+215
+228
+228
+206
+209
+193
+212
+225
+232
+224
+216
+217
+221
+221
+212
+207
+201
+199
+200
+202
+202
+198
+237
+225
+201
+186
+194
+195
+191
+194
+191
+190
+189
+187
+184
+181
+180
+176
+180
+187
+211
+232
+239
+246
+254
+249
+255
+253
+244
+245
+254
+255
+255
+255
+255
+242
+246
+242
+221
+208
+183
+149
+127
+117
+120
+127
+138
+141
+139
+133
+112
+108
+104
+103
+107
+113
+121
+124
+132
+133
+139
+142
+146
+148
+151
+155
+155
+161
+172
+188
+205
+213
+212
+206
+197
+186
+177
+92
+92
+92
+92
+92
+92
+92
+92
+90
+90
+90
+91
+91
+92
+92
+92
+92
+92
+93
+93
+93
+94
+94
+92
+95
+93
+92
+91
+90
+91
+93
+92
+93
+98
+101
+105
+113
+125
+132
+137
+152
+155
+156
+160
+177
+189
+183
+177
+181
+186
+182
+189
+200
+210
+219
+228
+241
+247
+249
+247
+239
+229
+215
+205
+192
+184
+177
+173
+169
+173
+187
+207
+217
+215
+217
+218
+220
+221
+206
+181
+190
+193
+196
+198
+201
+200
+201
+204
+207
+207
+211
+223
+238
+244
+241
+233
+224
+221
+226
+230
+234
+238
+239
+242
+242
+239
+240
+247
+253
+252
+251
+248
+244
+241
+242
+239
+238
+238
+233
+229
+240
+243
+246
+246
+245
+245
+243
+237
+220
+226
+218
+223
+255
+229
+209
+206
+217
+223
+224
+219
+213
+214
+214
+210
+200
+195
+194
+196
+197
+198
+198
+197
+235
+225
+201
+191
+203
+209
+206
+210
+216
+215
+212
+207
+201
+195
+188
+182
+185
+188
+207
+227
+237
+248
+255
+253
+255
+252
+245
+246
+254
+255
+255
+255
+255
+242
+245
+242
+224
+203
+167
+130
+110
+104
+109
+116
+123
+125
+120
+113
+96
+95
+97
+101
+110
+117
+125
+128
+132
+135
+139
+142
+140
+143
+146
+148
+147
+149
+154
+168
+184
+196
+200
+198
+183
+169
+159
+91
+91
+91
+91
+91
+91
+91
+91
+90
+90
+90
+91
+91
+92
+92
+92
+93
+93
+93
+94
+94
+94
+94
+94
+94
+94
+93
+91
+92
+91
+92
+91
+94
+98
+100
+103
+111
+122
+132
+136
+155
+166
+175
+184
+200
+211
+204
+198
+216
+217
+209
+203
+201
+204
+211
+222
+238
+245
+251
+249
+240
+226
+209
+197
+191
+182
+175
+171
+170
+174
+188
+206
+213
+213
+224
+229
+225
+232
+223
+191
+193
+190
+192
+196
+201
+202
+203
+206
+205
+210
+217
+229
+241
+245
+240
+228
+222
+221
+224
+228
+231
+233
+236
+236
+232
+230
+234
+240
+245
+246
+250
+251
+253
+228
+229
+255
+255
+255
+242
+244
+232
+237
+241
+244
+241
+234
+225
+215
+216
+218
+212
+229
+255
+245
+221
+229
+219
+218
+213
+210
+209
+208
+205
+198
+190
+185
+187
+191
+192
+191
+192
+197
+229
+220
+202
+199
+215
+222
+218
+223
+231
+233
+230
+225
+217
+208
+200
+193
+187
+187
+203
+224
+236
+250
+255
+255
+252
+250
+245
+247
+255
+255
+255
+254
+250
+240
+241
+240
+225
+195
+146
+111
+95
+92
+100
+108
+116
+118
+114
+111
+109
+108
+111
+117
+123
+129
+132
+135
+134
+136
+139
+140
+138
+138
+139
+144
+145
+143
+144
+154
+170
+187
+197
+198
+177
+161
+151
+91
+91
+91
+91
+91
+91
+91
+91
+90
+90
+90
+91
+91
+92
+92
+92
+93
+94
+94
+94
+94
+95
+94
+94
+94
+94
+94
+92
+94
+93
+94
+94
+98
+99
+99
+101
+108
+120
+127
+131
+148
+172
+194
+206
+218
+223
+218
+216
+236
+242
+233
+219
+205
+202
+210
+219
+234
+242
+248
+246
+237
+222
+205
+192
+189
+181
+174
+171
+170
+174
+187
+204
+225
+226
+238
+235
+222
+227
+230
+213
+200
+192
+188
+193
+200
+201
+203
+208
+206
+215
+224
+233
+237
+237
+235
+229
+223
+223
+229
+235
+241
+244
+246
+244
+235
+232
+235
+240
+242
+245
+252
+255
+245
+229
+238
+255
+255
+255
+245
+247
+238
+237
+237
+233
+227
+219
+206
+199
+203
+199
+208
+242
+246
+242
+219
+226
+220
+212
+206
+205
+207
+207
+202
+194
+185
+179
+181
+184
+185
+182
+188
+198
+219
+217
+206
+208
+225
+231
+227
+231
+235
+238
+235
+231
+225
+216
+208
+200
+190
+186
+200
+220
+235
+251
+255
+255
+247
+248
+245
+248
+254
+255
+255
+255
+247
+241
+240
+238
+227
+188
+131
+98
+92
+91
+102
+110
+116
+120
+121
+119
+121
+120
+122
+124
+129
+132
+133
+134
+137
+139
+138
+138
+136
+135
+137
+139
+143
+140
+141
+151
+170
+191
+203
+207
+188
+168
+156
+90
+90
+90
+90
+90
+90
+90
+90
+90
+90
+90
+91
+91
+92
+92
+93
+94
+94
+94
+95
+94
+95
+94
+94
+93
+93
+94
+95
+95
+96
+97
+98
+101
+101
+97
+98
+104
+116
+123
+125
+143
+174
+203
+218
+227
+232
+230
+228
+242
+252
+244
+227
+209
+203
+209
+217
+230
+235
+239
+239
+231
+218
+201
+190
+186
+177
+169
+168
+170
+176
+188
+202
+232
+233
+235
+229
+218
+222
+238
+244
+218
+201
+190
+194
+199
+200
+203
+210
+209
+218
+230
+233
+234
+232
+234
+235
+241
+243
+247
+250
+251
+253
+250
+247
+244
+241
+242
+243
+242
+244
+254
+255
+230
+248
+255
+255
+252
+250
+244
+233
+243
+234
+221
+210
+202
+194
+189
+188
+196
+192
+217
+250
+221
+225
+207
+207
+224
+212
+202
+202
+206
+205
+203
+196
+180
+173
+175
+179
+177
+175
+186
+202
+214
+216
+212
+215
+231
+236
+232
+237
+242
+244
+242
+239
+232
+226
+218
+210
+194
+186
+197
+215
+231
+250
+255
+255
+248
+249
+246
+247
+252
+253
+255
+255
+245
+244
+242
+239
+229
+182
+121
+94
+96
+97
+110
+118
+123
+126
+129
+130
+128
+125
+124
+125
+128
+130
+131
+133
+137
+139
+137
+136
+133
+133
+135
+137
+139
+135
+140
+153
+175
+198
+213
+217
+194
+172
+155
+90
+90
+90
+90
+90
+90
+90
+90
+90
+90
+90
+91
+91
+92
+92
+93
+94
+96
+94
+95
+94
+95
+94
+94
+94
+95
+96
+97
+97
+97
+97
+100
+104
+103
+99
+98
+106
+118
+124
+128
+143
+173
+205
+222
+237
+246
+246
+244
+248
+255
+251
+235
+219
+214
+213
+215
+224
+227
+230
+228
+223
+212
+199
+189
+184
+175
+168
+169
+173
+180
+193
+207
+223
+229
+227
+226
+224
+219
+230
+252
+242
+217
+198
+198
+200
+201
+205
+213
+213
+222
+230
+232
+233
+232
+238
+245
+255
+255
+255
+255
+255
+255
+250
+244
+246
+243
+242
+242
+240
+243
+254
+255
+240
+255
+255
+247
+236
+239
+234
+217
+235
+221
+201
+186
+177
+171
+165
+168
+184
+188
+221
+225
+205
+205
+193
+201
+228
+213
+201
+200
+201
+200
+200
+196
+177
+166
+168
+172
+171
+172
+188
+211
+214
+221
+219
+220
+233
+236
+235
+244
+253
+255
+250
+244
+237
+230
+223
+216
+201
+189
+192
+207
+225
+247
+255
+255
+252
+252
+248
+247
+249
+249
+252
+252
+238
+242
+240
+236
+225
+174
+112
+92
+95
+102
+117
+127
+132
+134
+136
+137
+136
+132
+127
+125
+127
+129
+131
+134
+136
+138
+136
+134
+130
+130
+131
+133
+135
+134
+140
+155
+176
+199
+214
+215
+188
+165
+147
+91
+90
+91
+90
+91
+90
+91
+90
+91
+90
+91
+91
+92
+92
+93
+93
+94
+94
+94
+94
+94
+94
+94
+92
+96
+97
+97
+98
+98
+97
+97
+98
+107
+106
+101
+100
+107
+120
+125
+127
+145
+171
+198
+217
+238
+252
+253
+249
+247
+255
+251
+238
+229
+225
+221
+215
+222
+223
+225
+222
+218
+208
+197
+188
+181
+172
+169
+173
+180
+187
+202
+216
+217
+225
+222
+226
+230
+211
+207
+235
+255
+235
+209
+202
+203
+201
+205
+212
+218
+223
+229
+231
+234
+237
+244
+252
+252
+255
+255
+255
+255
+255
+251
+246
+237
+236
+237
+238
+237
+239
+253
+255
+255
+254
+247
+242
+242
+240
+227
+210
+218
+205
+187
+175
+168
+162
+155
+157
+170
+178
+210
+187
+196
+190
+189
+206
+229
+213
+200
+196
+197
+196
+198
+195
+177
+167
+168
+173
+172
+175
+194
+219
+217
+225
+222
+222
+234
+237
+239
+252
+254
+253
+249
+243
+237
+230
+223
+214
+209
+191
+188
+200
+217
+243
+255
+255
+253
+255
+252
+253
+252
+249
+249
+249
+234
+240
+236
+228
+215
+162
+102
+88
+90
+98
+116
+128
+135
+136
+138
+139
+140
+134
+129
+126
+124
+125
+129
+131
+131
+133
+132
+130
+128
+128
+129
+132
+137
+136
+140
+153
+172
+189
+201
+203
+182
+159
+140
+93
+92
+93
+92
+93
+92
+93
+92
+94
+93
+94
+93
+94
+93
+94
+93
+93
+93
+94
+92
+92
+91
+93
+94
+96
+95
+96
+98
+99
+100
+100
+100
+107
+104
+101
+102
+110
+120
+129
+137
+143
+165
+190
+208
+225
+240
+249
+255
+244
+237
+231
+233
+235
+231
+228
+229
+226
+224
+221
+217
+212
+204
+196
+185
+167
+175
+173
+172
+191
+204
+204
+208
+218
+220
+222
+222
+222
+221
+215
+211
+217
+240
+242
+217
+199
+205
+212
+210
+211
+240
+225
+239
+244
+239
+255
+240
+250
+255
+255
+249
+253
+255
+254
+240
+238
+248
+233
+235
+240
+227
+255
+229
+255
+255
+255
+251
+246
+236
+222
+208
+204
+197
+184
+167
+156
+154
+157
+160
+167
+174
+194
+191
+189
+196
+197
+212
+219
+218
+209
+200
+196
+199
+203
+197
+188
+179
+173
+171
+179
+195
+210
+216
+228
+223
+218
+221
+231
+242
+249
+253
+247
+246
+246
+243
+242
+237
+230
+221
+213
+190
+192
+185
+214
+233
+255
+251
+255
+255
+255
+253
+252
+254
+250
+243
+242
+235
+237
+224
+216
+141
+92
+83
+92
+103
+119
+125
+127
+128
+131
+130
+128
+127
+126
+125
+124
+125
+127
+127
+127
+127
+129
+127
+126
+127
+129
+131
+135
+139
+139
+142
+153
+167
+175
+178
+163
+141
+124
+93
+93
+93
+93
+93
+93
+93
+93
+94
+94
+94
+94
+94
+94
+94
+94
+92
+94
+95
+94
+91
+91
+92
+94
+95
+93
+93
+95
+96
+98
+99
+101
+105
+103
+101
+103
+110
+121
+128
+135
+158
+163
+171
+185
+211
+234
+244
+244
+245
+238
+233
+238
+243
+242
+238
+234
+228
+224
+220
+215
+210
+203
+196
+186
+171
+170
+169
+178
+193
+197
+199
+212
+210
+214
+215
+216
+217
+219
+219
+218
+221
+230
+235
+225
+208
+199
+202
+211
+221
+245
+228
+241
+246
+241
+255
+237
+243
+247
+251
+253
+252
+248
+246
+247
+239
+237
+234
+253
+216
+238
+250
+213
+255
+255
+255
+253
+247
+231
+218
+210
+193
+194
+188
+172
+154
+147
+146
+147
+158
+176
+209
+206
+195
+198
+209
+235
+216
+214
+208
+199
+198
+202
+208
+206
+199
+194
+194
+195
+201
+209
+216
+222
+228
+222
+218
+221
+231
+242
+251
+251
+244
+243
+244
+243
+243
+238
+231
+223
+215
+191
+190
+183
+211
+233
+255
+249
+253
+255
+255
+255
+255
+255
+252
+246
+243
+236
+236
+223
+194
+128
+88
+82
+91
+101
+115
+120
+119
+123
+125
+125
+124
+124
+124
+123
+123
+123
+125
+126
+124
+125
+125
+125
+124
+125
+127
+130
+133
+135
+136
+136
+139
+144
+144
+140
+118
+99
+83
+93
+93
+93
+93
+93
+93
+93
+93
+93
+93
+93
+93
+93
+93
+93
+93
+94
+95
+97
+96
+93
+92
+91
+91
+91
+91
+92
+92
+95
+99
+102
+103
+103
+103
+104
+108
+115
+124
+130
+138
+152
+160
+170
+185
+207
+228
+238
+242
+248
+242
+234
+237
+243
+245
+242
+238
+228
+224
+219
+213
+207
+201
+193
+184
+174
+170
+171
+184
+199
+192
+187
+202
+205
+208
+213
+216
+217
+217
+220
+224
+221
+219
+226
+233
+222
+200
+200
+217
+226
+245
+231
+242
+248
+245
+255
+244
+240
+235
+236
+249
+245
+239
+236
+245
+234
+245
+231
+225
+234
+255
+237
+255
+255
+242
+239
+241
+235
+222
+214
+214
+194
+194
+189
+181
+173
+168
+162
+157
+155
+169
+199
+194
+188
+200
+215
+244
+208
+210
+208
+203
+204
+212
+218
+219
+219
+216
+221
+227
+228
+224
+227
+235
+224
+221
+217
+221
+231
+240
+245
+248
+244
+244
+244
+243
+243
+238
+231
+223
+216
+192
+186
+181
+208
+237
+255
+251
+253
+255
+255
+253
+254
+255
+252
+250
+244
+238
+234
+223
+165
+117
+88
+85
+95
+102
+114
+117
+116
+120
+123
+123
+121
+121
+121
+120
+121
+121
+124
+122
+122
+123
+123
+123
+123
+123
+125
+127
+135
+138
+139
+137
+134
+130
+121
+111
+81
+64
+50
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+96
+97
+96
+93
+90
+89
+88
+88
+91
+95
+98
+101
+105
+108
+107
+108
+108
+111
+114
+121
+127
+133
+140
+142
+159
+173
+179
+189
+204
+222
+241
+254
+253
+244
+242
+242
+242
+240
+239
+229
+225
+219
+213
+206
+198
+191
+184
+173
+173
+177
+188
+204
+199
+186
+186
+200
+205
+211
+217
+219
+217
+220
+224
+224
+219
+224
+236
+227
+210
+209
+224
+222
+240
+233
+239
+245
+248
+255
+255
+253
+242
+226
+237
+234
+240
+232
+235
+241
+209
+229
+220
+231
+239
+255
+241
+217
+219
+225
+225
+222
+220
+218
+212
+201
+195
+190
+193
+206
+215
+210
+196
+178
+182
+207
+217
+227
+239
+234
+241
+201
+206
+210
+208
+211
+217
+224
+226
+233
+231
+236
+242
+239
+232
+236
+246
+222
+219
+218
+222
+229
+236
+242
+244
+244
+246
+246
+245
+245
+240
+233
+224
+217
+194
+183
+179
+203
+239
+255
+254
+255
+255
+252
+250
+250
+252
+251
+250
+242
+239
+229
+215
+136
+107
+92
+91
+99
+106
+115
+116
+117
+119
+121
+122
+119
+118
+119
+118
+120
+120
+123
+122
+122
+122
+122
+122
+122
+122
+124
+126
+134
+139
+140
+138
+134
+128
+116
+105
+80
+67
+56
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+93
+95
+96
+95
+92
+90
+88
+88
+89
+96
+103
+110
+115
+115
+115
+113
+111
+112
+114
+118
+122
+127
+132
+138
+147
+157
+160
+158
+160
+172
+188
+210
+240
+253
+254
+251
+249
+244
+237
+234
+232
+227
+221
+215
+208
+199
+192
+185
+173
+180
+175
+176
+200
+213
+201
+187
+190
+193
+204
+214
+219
+218
+220
+226
+224
+226
+228
+229
+226
+222
+222
+226
+219
+234
+236
+238
+239
+246
+255
+255
+255
+255
+225
+227
+224
+247
+232
+220
+218
+234
+219
+216
+255
+224
+202
+202
+193
+213
+224
+218
+217
+223
+220
+205
+204
+205
+211
+221
+235
+245
+244
+234
+196
+198
+229
+248
+255
+255
+229
+215
+201
+209
+215
+214
+213
+213
+216
+220
+238
+241
+240
+242
+239
+235
+243
+254
+223
+220
+218
+220
+227
+234
+239
+242
+244
+246
+247
+246
+245
+240
+234
+226
+217
+198
+180
+178
+195
+239
+255
+255
+255
+255
+249
+246
+245
+247
+249
+249
+243
+237
+219
+193
+114
+98
+96
+99
+102
+107
+116
+117
+118
+120
+121
+120
+117
+117
+117
+118
+119
+120
+123
+122
+122
+123
+124
+124
+121
+121
+123
+125
+128
+133
+135
+135
+133
+131
+123
+114
+100
+91
+81
+95
+95
+95
+95
+95
+95
+95
+95
+95
+95
+95
+95
+95
+95
+95
+95
+94
+95
+96
+94
+91
+89
+90
+90
+95
+104
+114
+122
+123
+123
+122
+118
+113
+114
+116
+119
+122
+126
+132
+139
+150
+153
+155
+162
+170
+171
+159
+153
+186
+210
+225
+233
+239
+241
+236
+229
+235
+231
+226
+218
+211
+203
+195
+188
+179
+186
+171
+163
+190
+217
+217
+203
+184
+184
+192
+206
+217
+218
+222
+228
+223
+228
+227
+221
+222
+227
+228
+223
+222
+233
+240
+239
+236
+242
+255
+255
+255
+255
+226
+227
+213
+244
+226
+215
+217
+203
+202
+247
+220
+213
+209
+186
+196
+219
+229
+219
+215
+220
+217
+204
+208
+226
+244
+250
+247
+246
+248
+248
+214
+213
+234
+234
+231
+227
+207
+206
+217
+224
+228
+223
+217
+215
+215
+220
+245
+251
+248
+245
+245
+248
+255
+255
+224
+222
+220
+221
+225
+231
+237
+240
+244
+247
+249
+248
+246
+241
+235
+226
+217
+201
+179
+177
+186
+236
+255
+255
+255
+255
+246
+243
+243
+244
+249
+249
+243
+235
+205
+160
+102
+89
+95
+99
+102
+107
+116
+119
+120
+123
+122
+118
+115
+114
+115
+116
+118
+119
+123
+122
+121
+122
+124
+123
+120
+120
+122
+123
+126
+131
+133
+135
+137
+137
+132
+124
+117
+111
+103
+95
+95
+95
+95
+95
+95
+95
+95
+94
+94
+94
+94
+94
+94
+94
+95
+97
+97
+97
+94
+91
+91
+92
+95
+107
+115
+125
+130
+129
+125
+123
+120
+115
+115
+120
+123
+126
+132
+141
+148
+154
+160
+171
+188
+201
+197
+170
+154
+155
+173
+181
+194
+214
+232
+238
+236
+235
+233
+229
+224
+217
+210
+202
+194
+189
+190
+175
+167
+187
+209
+214
+213
+195
+186
+186
+199
+214
+217
+223
+231
+226
+227
+226
+222
+224
+229
+228
+222
+229
+232
+240
+240
+239
+241
+242
+244
+246
+252
+233
+246
+216
+235
+221
+230
+216
+204
+207
+226
+210
+208
+185
+213
+217
+226
+232
+230
+223
+219
+224
+228
+238
+250
+255
+255
+248
+245
+246
+246
+244
+232
+232
+216
+207
+212
+211
+225
+227
+233
+234
+225
+217
+216
+219
+227
+243
+255
+255
+250
+252
+255
+255
+251
+227
+223
+221
+221
+226
+230
+237
+241
+244
+247
+249
+248
+246
+241
+235
+227
+216
+205
+181
+177
+178
+233
+255
+255
+255
+253
+243
+241
+244
+245
+251
+252
+245
+232
+188
+125
+94
+81
+91
+93
+101
+106
+114
+118
+121
+123
+120
+115
+112
+112
+113
+113
+116
+117
+121
+120
+120
+121
+122
+121
+120
+120
+121
+123
+127
+130
+132
+134
+135
+134
+128
+120
+112
+108
+101
+95
+95
+95
+95
+95
+95
+95
+95
+94
+94
+94
+94
+94
+94
+94
+95
+99
+99
+97
+93
+90
+92
+95
+97
+116
+121
+129
+131
+126
+121
+121
+119
+119
+120
+125
+130
+133
+141
+151
+160
+172
+182
+190
+200
+208
+214
+209
+208
+175
+174
+164
+168
+194
+224
+239
+241
+233
+234
+230
+226
+223
+215
+207
+201
+193
+193
+185
+184
+193
+199
+199
+209
+211
+194
+188
+197
+210
+215
+223
+231
+230
+225
+224
+227
+231
+230
+226
+223
+233
+229
+240
+240
+241
+242
+232
+226
+231
+247
+246
+255
+229
+235
+224
+254
+255
+220
+255
+255
+234
+211
+198
+215
+241
+235
+237
+246
+240
+230
+241
+255
+255
+255
+254
+245
+247
+253
+253
+246
+241
+227
+226
+213
+210
+217
+210
+216
+223
+227
+226
+217
+211
+214
+220
+232
+234
+252
+254
+247
+249
+255
+253
+236
+226
+224
+222
+223
+225
+232
+239
+244
+246
+247
+249
+248
+248
+242
+235
+227
+215
+209
+182
+178
+176
+232
+255
+255
+255
+252
+241
+242
+245
+246
+253
+253
+242
+225
+174
+98
+89
+74
+85
+88
+99
+105
+113
+118
+122
+124
+120
+114
+110
+110
+110
+111
+114
+116
+119
+119
+119
+120
+121
+119
+118
+118
+119
+121
+122
+126
+129
+127
+126
+123
+114
+105
+95
+92
+86
+92
+94
+96
+96
+95
+95
+95
+97
+98
+95
+93
+93
+97
+99
+98
+96
+100
+97
+93
+94
+91
+90
+101
+115
+121
+122
+126
+128
+125
+120
+114
+108
+116
+118
+128
+139
+150
+164
+178
+188
+203
+211
+217
+219
+220
+221
+217
+217
+209
+184
+161
+203
+216
+189
+216
+247
+233
+229
+225
+227
+226
+219
+216
+214
+203
+192
+199
+187
+191
+198
+185
+206
+209
+204
+197
+196
+205
+216
+225
+227
+223
+223
+224
+228
+224
+221
+223
+229
+228
+234
+236
+238
+238
+235
+232
+226
+215
+230
+245
+237
+215
+215
+249
+255
+255
+255
+255
+255
+255
+245
+242
+252
+255
+255
+249
+248
+243
+235
+234
+238
+252
+255
+255
+254
+251
+254
+255
+251
+237
+223
+214
+214
+215
+215
+216
+219
+225
+220
+217
+214
+215
+219
+224
+230
+240
+243
+243
+246
+245
+242
+235
+227
+222
+222
+223
+224
+228
+233
+239
+245
+247
+248
+250
+249
+249
+243
+236
+229
+224
+204
+191
+175
+184
+210
+255
+254
+255
+255
+246
+239
+241
+249
+253
+245
+242
+209
+137
+80
+69
+68
+77
+90
+91
+99
+113
+120
+120
+116
+114
+113
+108
+109
+110
+111
+114
+116
+117
+117
+116
+116
+118
+119
+118
+118
+117
+116
+123
+123
+122
+117
+109
+98
+88
+83
+63
+63
+62
+91
+94
+96
+96
+96
+95
+96
+97
+98
+96
+95
+96
+98
+99
+98
+96
+102
+95
+92
+94
+97
+100
+109
+118
+119
+123
+125
+120
+113
+107
+108
+110
+117
+124
+137
+152
+168
+184
+201
+211
+219
+226
+231
+230
+228
+226
+219
+212
+212
+189
+170
+199
+202
+182
+211
+246
+236
+231
+226
+228
+233
+229
+224
+219
+214
+201
+202
+185
+184
+189
+182
+200
+221
+212
+198
+189
+196
+212
+220
+219
+226
+229
+228
+224
+220
+219
+223
+227
+236
+237
+237
+235
+231
+227
+225
+221
+214
+216
+228
+243
+250
+252
+254
+255
+240
+235
+238
+252
+255
+255
+244
+242
+236
+239
+241
+244
+238
+228
+227
+234
+251
+253
+255
+255
+255
+255
+252
+242
+229
+222
+219
+222
+223
+220
+218
+219
+224
+219
+216
+215
+219
+223
+229
+231
+233
+234
+235
+238
+238
+236
+229
+223
+220
+221
+223
+226
+229
+234
+242
+245
+247
+247
+250
+249
+247
+243
+236
+229
+223
+212
+194
+182
+183
+216
+255
+251
+254
+254
+247
+244
+246
+246
+250
+241
+227
+183
+119
+76
+62
+61
+71
+80
+88
+96
+110
+117
+118
+116
+113
+112
+107
+107
+108
+109
+112
+114
+115
+115
+116
+117
+117
+117
+116
+114
+113
+112
+110
+108
+104
+98
+88
+78
+70
+64
+64
+64
+64
+89
+91
+94
+94
+94
+94
+95
+96
+97
+96
+95
+96
+97
+97
+96
+94
+98
+92
+91
+99
+107
+113
+118
+121
+121
+121
+120
+110
+101
+96
+106
+114
+125
+135
+151
+169
+187
+203
+220
+229
+233
+237
+240
+237
+231
+226
+215
+203
+185
+170
+156
+171
+168
+158
+187
+222
+247
+238
+227
+226
+234
+235
+231
+224
+223
+212
+212
+194
+183
+183
+174
+182
+219
+223
+217
+202
+197
+209
+217
+217
+222
+233
+236
+224
+213
+213
+218
+222
+230
+232
+231
+230
+227
+226
+225
+224
+198
+202
+220
+240
+250
+247
+243
+241
+231
+232
+237
+251
+255
+255
+242
+225
+232
+242
+250
+251
+244
+236
+243
+255
+245
+244
+247
+252
+255
+255
+246
+232
+222
+222
+227
+233
+235
+230
+225
+221
+221
+217
+215
+215
+220
+225
+231
+233
+227
+227
+229
+231
+232
+230
+225
+219
+218
+219
+222
+226
+231
+235
+243
+247
+245
+245
+248
+247
+247
+242
+238
+231
+221
+220
+199
+187
+181
+228
+255
+248
+252
+251
+248
+251
+250
+243
+239
+233
+210
+155
+107
+79
+62
+59
+70
+72
+81
+89
+103
+114
+116
+113
+109
+107
+105
+105
+105
+107
+109
+110
+112
+113
+117
+117
+116
+114
+112
+109
+107
+106
+101
+97
+91
+85
+76
+69
+65
+62
+67
+68
+69
+87
+90
+92
+94
+93
+94
+95
+97
+96
+96
+96
+97
+97
+96
+95
+92
+90
+90
+98
+106
+113
+118
+120
+122
+119
+115
+109
+98
+93
+97
+108
+120
+137
+149
+164
+182
+199
+213
+225
+231
+235
+238
+238
+233
+227
+218
+203
+188
+166
+157
+150
+155
+155
+156
+181
+208
+251
+243
+232
+229
+229
+234
+234
+232
+223
+219
+222
+211
+195
+186
+176
+167
+191
+219
+234
+219
+201
+204
+212
+215
+217
+241
+254
+237
+217
+214
+219
+222
+223
+225
+225
+222
+220
+218
+217
+215
+194
+196
+206
+217
+223
+224
+228
+234
+241
+246
+247
+248
+255
+255
+241
+219
+233
+240
+241
+240
+235
+235
+249
+255
+237
+232
+234
+242
+255
+255
+244
+227
+225
+228
+234
+242
+244
+239
+230
+224
+221
+218
+217
+217
+220
+227
+232
+233
+226
+224
+227
+230
+231
+229
+224
+218
+218
+219
+222
+226
+231
+235
+242
+246
+244
+244
+247
+246
+246
+242
+238
+231
+220
+224
+201
+190
+182
+238
+255
+248
+253
+250
+251
+255
+252
+239
+232
+224
+195
+135
+101
+90
+72
+65
+76
+70
+76
+83
+98
+108
+112
+110
+107
+105
+103
+104
+104
+106
+107
+109
+111
+112
+116
+115
+113
+111
+106
+103
+101
+100
+96
+93
+87
+82
+77
+76
+78
+79
+77
+78
+79
+85
+87
+91
+92
+93
+93
+95
+97
+95
+96
+97
+97
+96
+95
+95
+94
+86
+95
+110
+116
+120
+120
+120
+121
+115
+106
+96
+91
+95
+106
+118
+128
+147
+158
+173
+187
+203
+212
+221
+225
+229
+230
+228
+224
+218
+206
+190
+174
+155
+143
+140
+141
+147
+157
+169
+188
+230
+237
+240
+240
+238
+237
+235
+233
+227
+224
+228
+222
+204
+198
+196
+175
+174
+199
+220
+214
+204
+206
+208
+209
+214
+245
+255
+250
+227
+220
+223
+227
+226
+227
+226
+221
+212
+205
+198
+194
+197
+192
+193
+203
+215
+219
+219
+218
+225
+236
+242
+242
+249
+255
+241
+222
+233
+237
+237
+239
+242
+247
+255
+255
+229
+222
+223
+234
+249
+253
+244
+233
+232
+235
+239
+242
+243
+240
+233
+226
+223
+220
+219
+220
+223
+228
+232
+233
+230
+228
+230
+232
+232
+230
+225
+220
+219
+220
+223
+225
+229
+233
+241
+244
+243
+241
+244
+244
+244
+242
+238
+231
+222
+224
+202
+192
+192
+247
+255
+249
+248
+246
+252
+255
+255
+242
+228
+216
+171
+119
+100
+97
+84
+75
+80
+71
+71
+76
+90
+102
+109
+109
+108
+104
+102
+103
+103
+105
+106
+108
+110
+111
+116
+115
+110
+106
+102
+99
+97
+95
+90
+88
+83
+80
+79
+82
+87
+90
+85
+85
+85
+82
+85
+88
+90
+91
+92
+94
+96
+96
+97
+97
+97
+96
+96
+98
+97
+94
+106
+121
+125
+122
+120
+118
+115
+106
+99
+91
+93
+104
+118
+129
+136
+153
+163
+175
+187
+198
+207
+212
+215
+217
+217
+215
+210
+204
+197
+180
+163
+141
+124
+124
+120
+130
+143
+144
+157
+192
+215
+237
+249
+253
+250
+243
+237
+237
+234
+225
+224
+209
+211
+221
+194
+184
+189
+194
+200
+207
+215
+214
+209
+208
+234
+250
+242
+223
+217
+219
+224
+230
+231
+231
+226
+218
+209
+202
+196
+176
+184
+200
+211
+210
+203
+204
+207
+211
+227
+237
+240
+244
+246
+232
+218
+229
+236
+243
+253
+255
+255
+255
+255
+226
+221
+221
+231
+245
+249
+248
+244
+237
+239
+240
+237
+235
+234
+231
+225
+227
+224
+223
+222
+225
+228
+232
+232
+232
+231
+232
+235
+235
+233
+226
+222
+219
+220
+221
+223
+227
+231
+239
+242
+241
+240
+243
+243
+243
+241
+236
+231
+224
+217
+204
+193
+209
+255
+253
+247
+237
+241
+250
+255
+255
+248
+227
+200
+139
+106
+93
+93
+88
+81
+79
+73
+68
+71
+83
+94
+103
+106
+106
+103
+103
+102
+102
+103
+105
+107
+109
+109
+113
+111
+106
+103
+99
+96
+95
+94
+92
+91
+87
+86
+85
+89
+93
+94
+90
+88
+88
+78
+81
+85
+87
+88
+90
+92
+94
+97
+98
+98
+97
+95
+97
+102
+104
+110
+117
+124
+123
+119
+118
+112
+106
+97
+94
+95
+101
+112
+125
+137
+143
+153
+161
+170
+180
+186
+192
+195
+199
+198
+197
+193
+188
+187
+181
+166
+150
+139
+117
+119
+115
+122
+137
+133
+150
+155
+183
+214
+237
+252
+255
+254
+249
+252
+245
+230
+231
+216
+219
+234
+197
+196
+189
+190
+199
+209
+212
+212
+215
+210
+216
+221
+220
+214
+213
+216
+222
+229
+230
+229
+226
+219
+213
+209
+204
+174
+188
+205
+209
+198
+187
+192
+202
+215
+226
+236
+240
+239
+236
+223
+212
+209
+218
+227
+237
+245
+247
+244
+239
+228
+225
+230
+240
+247
+249
+254
+253
+239
+240
+240
+236
+232
+231
+230
+224
+228
+224
+224
+224
+227
+230
+234
+236
+236
+236
+237
+238
+238
+235
+228
+222
+222
+221
+221
+223
+225
+230
+237
+241
+240
+238
+241
+242
+243
+241
+236
+231
+226
+210
+210
+198
+231
+255
+249
+241
+227
+239
+253
+255
+255
+253
+219
+177
+106
+94
+88
+85
+89
+85
+76
+73
+64
+65
+75
+88
+98
+102
+104
+102
+101
+99
+99
+101
+103
+104
+105
+107
+110
+108
+104
+100
+97
+95
+95
+95
+95
+95
+93
+93
+93
+96
+99
+99
+92
+90
+90
+74
+77
+81
+84
+87
+89
+92
+94
+100
+101
+100
+98
+95
+97
+103
+108
+119
+121
+120
+116
+114
+116
+108
+98
+90
+95
+102
+109
+118
+129
+143
+151
+155
+160
+169
+174
+177
+178
+180
+182
+181
+179
+174
+171
+170
+164
+153
+136
+126
+102
+108
+100
+108
+124
+123
+147
+140
+162
+187
+212
+238
+255
+255
+255
+254
+247
+233
+238
+221
+222
+234
+186
+190
+190
+199
+209
+203
+193
+202
+219
+222
+211
+204
+205
+212
+215
+221
+225
+228
+228
+222
+215
+207
+202
+197
+194
+212
+200
+189
+190
+195
+196
+194
+194
+220
+221
+225
+229
+232
+229
+220
+212
+203
+212
+218
+224
+228
+232
+233
+231
+238
+237
+244
+253
+255
+253
+255
+255
+248
+249
+249
+240
+235
+233
+232
+226
+227
+224
+224
+225
+228
+231
+235
+238
+236
+235
+236
+237
+237
+234
+227
+219
+222
+221
+221
+222
+224
+227
+233
+236
+238
+238
+240
+240
+242
+239
+235
+231
+228
+205
+215
+202
+249
+255
+246
+237
+228
+243
+255
+255
+255
+245
+201
+148
+83
+88
+84
+79
+89
+83
+69
+71
+61
+64
+73
+83
+95
+101
+103
+101
+99
+97
+98
+99
+101
+102
+104
+105
+108
+107
+102
+99
+97
+96
+96
+96
+94
+94
+95
+96
+97
+100
+102
+102
+93
+92
+93
+68
+70
+74
+80
+82
+87
+93
+95
+96
+97
+96
+95
+98
+103
+111
+115
+119
+122
+124
+121
+112
+103
+96
+92
+96
+102
+111
+121
+132
+141
+150
+156
+160
+161
+163
+164
+166
+165
+165
+164
+165
+163
+162
+162
+159
+153
+142
+131
+113
+104
+99
+102
+108
+115
+128
+143
+150
+169
+181
+192
+216
+235
+246
+255
+249
+255
+237
+223
+217
+239
+204
+197
+196
+195
+192
+195
+198
+202
+208
+213
+210
+214
+215
+211
+205
+205
+216
+226
+224
+225
+222
+215
+207
+201
+198
+196
+194
+198
+203
+205
+204
+197
+187
+182
+199
+208
+217
+224
+227
+225
+216
+208
+205
+213
+220
+227
+232
+237
+240
+244
+251
+250
+251
+253
+255
+255
+255
+255
+255
+255
+255
+254
+244
+237
+233
+232
+221
+221
+222
+224
+227
+230
+233
+235
+235
+236
+235
+233
+231
+226
+221
+219
+220
+219
+220
+222
+223
+226
+227
+230
+236
+237
+240
+241
+241
+237
+232
+228
+222
+212
+211
+215
+255
+255
+248
+241
+247
+236
+249
+255
+245
+230
+178
+97
+71
+65
+75
+82
+79
+66
+59
+60
+65
+69
+75
+83
+91
+97
+100
+100
+98
+96
+97
+99
+101
+104
+108
+109
+108
+105
+103
+102
+102
+101
+99
+97
+100
+100
+98
+99
+100
+100
+101
+97
+91
+92
+95
+61
+63
+70
+74
+80
+84
+91
+93
+96
+96
+94
+94
+99
+104
+110
+115
+116
+118
+116
+112
+103
+97
+93
+92
+101
+107
+116
+125
+134
+141
+148
+152
+155
+156
+157
+158
+158
+157
+156
+155
+158
+156
+156
+155
+154
+147
+136
+128
+115
+107
+100
+101
+107
+113
+124
+141
+157
+178
+187
+195
+211
+221
+224
+235
+251
+255
+247
+238
+227
+235
+199
+194
+197
+195
+192
+193
+196
+200
+207
+211
+213
+213
+211
+210
+209
+209
+212
+216
+223
+224
+220
+214
+207
+200
+193
+190
+190
+193
+198
+201
+202
+200
+197
+194
+191
+199
+209
+216
+218
+215
+204
+195
+202
+211
+221
+229
+237
+244
+249
+253
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+247
+241
+234
+230
+220
+220
+222
+224
+227
+230
+233
+235
+235
+236
+235
+232
+228
+223
+220
+217
+219
+219
+220
+220
+222
+223
+225
+227
+231
+234
+235
+235
+235
+232
+228
+223
+221
+209
+207
+239
+255
+255
+241
+249
+248
+247
+244
+243
+239
+205
+139
+89
+69
+60
+62
+67
+67
+61
+56
+58
+60
+75
+92
+101
+104
+101
+100
+100
+97
+97
+97
+99
+103
+105
+107
+108
+108
+106
+104
+102
+103
+102
+102
+100
+102
+100
+100
+100
+101
+101
+102
+98
+93
+95
+98
+54
+58
+63
+68
+75
+79
+86
+89
+94
+92
+92
+94
+99
+104
+111
+115
+115
+113
+106
+99
+92
+90
+92
+92
+104
+110
+119
+127
+134
+138
+143
+145
+147
+147
+147
+147
+148
+147
+147
+146
+149
+147
+148
+148
+147
+140
+131
+126
+121
+115
+103
+100
+100
+104
+117
+135
+166
+190
+203
+208
+218
+222
+220
+226
+251
+255
+255
+255
+247
+238
+196
+192
+196
+193
+192
+192
+194
+198
+204
+208
+214
+211
+206
+208
+212
+212
+206
+203
+218
+218
+217
+214
+208
+201
+194
+190
+189
+192
+194
+196
+199
+202
+203
+204
+199
+202
+207
+208
+210
+209
+202
+197
+204
+214
+223
+231
+241
+246
+251
+255
+252
+252
+251
+249
+251
+250
+252
+254
+255
+255
+254
+253
+247
+242
+236
+229
+220
+220
+222
+224
+229
+231
+233
+235
+237
+238
+237
+234
+229
+225
+220
+216
+218
+217
+218
+219
+221
+222
+224
+225
+225
+226
+227
+227
+227
+225
+221
+218
+219
+204
+211
+255
+255
+249
+237
+255
+247
+255
+240
+233
+227
+171
+101
+81
+65
+52
+53
+58
+63
+62
+60
+62
+62
+88
+115
+128
+119
+104
+97
+97
+96
+96
+97
+99
+104
+106
+107
+108
+110
+107
+104
+103
+104
+104
+102
+100
+101
+100
+99
+100
+102
+102
+101
+98
+99
+101
+104
+50
+53
+59
+65
+71
+75
+82
+86
+88
+89
+89
+94
+99
+105
+111
+114
+114
+106
+96
+87
+84
+87
+92
+97
+108
+114
+123
+130
+136
+138
+140
+141
+143
+143
+143
+142
+143
+142
+142
+141
+143
+142
+143
+144
+143
+137
+128
+126
+127
+121
+107
+99
+96
+98
+109
+128
+161
+193
+209
+217
+228
+228
+224
+228
+236
+237
+254
+255
+255
+245
+201
+196
+194
+191
+191
+190
+193
+197
+200
+206
+216
+212
+206
+206
+209
+209
+203
+199
+210
+211
+210
+210
+209
+205
+200
+196
+196
+196
+198
+198
+199
+200
+201
+203
+211
+211
+208
+203
+203
+207
+207
+206
+206
+217
+226
+235
+242
+247
+249
+252
+249
+247
+247
+248
+251
+253
+255
+255
+255
+253
+250
+249
+247
+242
+233
+225
+220
+220
+222
+224
+229
+231
+233
+235
+238
+238
+238
+234
+230
+225
+220
+215
+216
+216
+216
+217
+218
+220
+221
+221
+219
+220
+221
+220
+220
+218
+215
+214
+213
+206
+231
+255
+254
+243
+243
+255
+251
+252
+240
+228
+196
+129
+78
+72
+54
+50
+56
+62
+65
+63
+65
+69
+84
+112
+143
+151
+131
+106
+95
+93
+95
+97
+98
+102
+107
+108
+109
+109
+111
+108
+105
+104
+105
+105
+104
+103
+102
+100
+100
+101
+103
+104
+102
+100
+103
+105
+108
+45
+51
+56
+60
+66
+71
+77
+81
+83
+83
+85
+90
+97
+105
+109
+108
+106
+98
+88
+80
+81
+88
+96
+102
+111
+117
+124
+130
+134
+135
+138
+139
+139
+139
+138
+137
+137
+136
+138
+137
+140
+139
+141
+141
+141
+135
+126
+127
+131
+125
+108
+99
+92
+91
+102
+122
+149
+187
+209
+219
+230
+231
+224
+227
+228
+226
+247
+255
+255
+244
+201
+193
+192
+191
+191
+192
+194
+197
+199
+205
+216
+217
+210
+207
+204
+201
+200
+201
+207
+209
+210
+209
+207
+204
+203
+203
+202
+201
+202
+201
+200
+198
+197
+197
+208
+208
+205
+201
+203
+206
+205
+204
+208
+217
+228
+236
+244
+249
+251
+252
+252
+251
+252
+252
+254
+255
+255
+255
+255
+251
+247
+245
+241
+237
+228
+221
+220
+220
+222
+226
+229
+231
+234
+236
+241
+241
+239
+237
+230
+225
+218
+215
+216
+214
+214
+216
+216
+217
+218
+217
+213
+213
+214
+213
+212
+211
+211
+211
+208
+215
+255
+255
+255
+240
+255
+250
+255
+242
+237
+215
+148
+91
+71
+63
+49
+52
+58
+60
+58
+62
+80
+94
+121
+144
+170
+168
+142
+111
+97
+94
+96
+99
+101
+106
+111
+112
+111
+111
+111
+108
+105
+103
+105
+105
+105
+104
+102
+101
+100
+101
+103
+104
+103
+101
+105
+105
+108
+43
+46
+52
+56
+62
+66
+72
+75
+78
+78
+79
+87
+95
+102
+103
+103
+98
+91
+81
+78
+82
+91
+101
+108
+117
+122
+127
+131
+134
+134
+136
+137
+135
+134
+134
+133
+133
+133
+135
+135
+141
+140
+141
+140
+139
+132
+123
+124
+129
+126
+109
+100
+92
+89
+99
+118
+146
+183
+209
+219
+231
+231
+228
+231
+236
+230
+247
+243
+254
+230
+196
+190
+194
+193
+193
+195
+196
+200
+203
+207
+214
+216
+212
+206
+199
+196
+198
+202
+207
+214
+217
+214
+206
+200
+202
+203
+201
+200
+201
+201
+202
+200
+200
+199
+202
+207
+210
+211
+214
+213
+206
+201
+210
+220
+231
+240
+246
+250
+253
+253
+249
+247
+247
+246
+247
+247
+250
+250
+252
+248
+245
+240
+237
+231
+224
+218
+220
+221
+223
+226
+229
+231
+234
+236
+242
+242
+240
+237
+230
+223
+218
+214
+213
+212
+212
+212
+213
+213
+215
+212
+208
+206
+207
+207
+206
+206
+206
+208
+208
+232
+255
+254
+255
+246
+255
+246
+255
+234
+221
+185
+107
+71
+71
+59
+56
+58
+57
+53
+51
+66
+102
+129
+159
+169
+181
+175
+146
+118
+101
+96
+96
+99
+103
+109
+114
+114
+113
+112
+111
+108
+104
+102
+104
+105
+105
+105
+103
+102
+101
+102
+104
+105
+105
+102
+106
+107
+110
+40
+43
+47
+51
+55
+60
+64
+67
+73
+72
+75
+82
+91
+97
+98
+96
+95
+90
+84
+84
+92
+103
+112
+118
+123
+126
+131
+132
+132
+131
+133
+134
+131
+130
+131
+130
+131
+133
+136
+136
+141
+139
+139
+139
+137
+129
+119
+117
+125
+121
+107
+101
+93
+91
+100
+116
+140
+176
+202
+214
+226
+230
+231
+237
+245
+237
+247
+222
+229
+210
+195
+199
+197
+196
+197
+200
+202
+205
+208
+212
+211
+212
+210
+205
+199
+194
+192
+195
+200
+213
+225
+222
+211
+202
+201
+205
+200
+200
+200
+200
+202
+202
+203
+203
+205
+210
+215
+216
+218
+219
+215
+210
+220
+229
+238
+245
+249
+249
+250
+248
+242
+239
+237
+237
+239
+239
+242
+241
+244
+244
+242
+236
+229
+225
+223
+221
+220
+221
+223
+227
+230
+233
+234
+236
+244
+244
+241
+238
+230
+224
+218
+212
+211
+209
+208
+208
+208
+208
+209
+208
+203
+200
+200
+199
+200
+200
+203
+206
+213
+250
+255
+255
+253
+254
+255
+250
+244
+230
+192
+135
+84
+67
+68
+62
+66
+64
+58
+54
+57
+80
+125
+159
+176
+175
+176
+166
+146
+123
+103
+95
+94
+99
+105
+111
+115
+115
+113
+111
+110
+107
+103
+101
+103
+104
+105
+105
+102
+100
+100
+101
+103
+104
+105
+102
+106
+108
+111
+38
+40
+45
+49
+51
+55
+58
+60
+71
+68
+71
+79
+90
+95
+94
+92
+96
+92
+89
+92
+103
+113
+122
+127
+129
+130
+133
+132
+131
+129
+131
+131
+132
+131
+132
+131
+133
+135
+138
+140
+141
+140
+139
+138
+133
+127
+115
+111
+117
+114
+105
+102
+99
+97
+102
+115
+125
+159
+184
+197
+215
+226
+233
+240
+247
+241
+247
+209
+212
+197
+200
+212
+199
+199
+201
+205
+208
+211
+216
+217
+207
+206
+206
+203
+199
+193
+190
+188
+192
+209
+227
+228
+216
+203
+203
+208
+202
+201
+199
+198
+200
+202
+206
+208
+211
+213
+213
+210
+213
+218
+221
+220
+232
+241
+247
+251
+250
+245
+242
+239
+237
+234
+234
+235
+237
+241
+244
+243
+239
+238
+236
+233
+226
+222
+223
+225
+221
+222
+225
+227
+230
+233
+234
+236
+244
+244
+241
+236
+230
+223
+216
+211
+208
+205
+205
+204
+205
+205
+205
+204
+197
+194
+195
+194
+195
+198
+201
+205
+220
+255
+255
+255
+250
+255
+246
+251
+228
+224
+162
+91
+71
+70
+64
+67
+71
+70
+64
+63
+69
+96
+139
+170
+177
+171
+166
+157
+142
+123
+102
+90
+94
+97
+104
+111
+114
+114
+112
+110
+110
+106
+102
+100
+102
+104
+105
+105
+102
+101
+100
+101
+103
+104
+104
+101
+107
+109
+112
+40
+39
+40
+41
+46
+51
+55
+57
+61
+63
+68
+74
+79
+86
+90
+93
+89
+91
+94
+101
+110
+119
+127
+132
+140
+140
+138
+134
+130
+128
+130
+131
+128
+129
+131
+132
+134
+136
+139
+140
+138
+138
+137
+135
+128
+119
+107
+102
+106
+108
+104
+102
+101
+102
+106
+114
+114
+135
+166
+193
+209
+220
+237
+247
+249
+230
+212
+206
+209
+215
+214
+212
+207
+205
+207
+209
+212
+216
+220
+220
+208
+205
+204
+202
+197
+193
+190
+188
+194
+190
+233
+223
+195
+209
+206
+199
+202
+201
+200
+199
+200
+201
+203
+204
+208
+215
+220
+220
+217
+218
+226
+236
+245
+242
+240
+246
+246
+241
+237
+237
+236
+230
+228
+229
+235
+240
+241
+239
+242
+238
+234
+230
+225
+223
+220
+220
+222
+225
+227
+230
+233
+236
+237
+239
+244
+243
+240
+237
+231
+224
+215
+207
+202
+200
+199
+198
+199
+199
+200
+199
+193
+196
+190
+182
+188
+201
+206
+201
+255
+255
+255
+252
+245
+242
+247
+240
+228
+171
+110
+78
+67
+65
+66
+66
+77
+77
+67
+68
+88
+125
+155
+167
+171
+159
+152
+148
+130
+102
+88
+89
+93
+99
+105
+110
+109
+108
+107
+108
+105
+102
+99
+99
+102
+104
+102
+100
+103
+104
+103
+102
+101
+102
+106
+107
+113
+113
+114
+42
+41
+41
+41
+45
+49
+53
+55
+59
+62
+65
+72
+79
+83
+88
+90
+92
+94
+100
+107
+117
+127
+135
+139
+141
+140
+137
+133
+128
+128
+128
+130
+133
+134
+135
+137
+139
+140
+141
+142
+138
+137
+134
+130
+123
+116
+108
+100
+99
+98
+101
+102
+105
+108
+110
+113
+121
+130
+149
+173
+199
+221
+243
+254
+240
+227
+217
+213
+217
+220
+219
+214
+211
+209
+209
+212
+215
+220
+223
+221
+206
+201
+200
+198
+196
+193
+191
+190
+196
+203
+228
+220
+200
+204
+200
+194
+202
+203
+202
+202
+203
+204
+206
+207
+211
+214
+217
+215
+213
+216
+222
+231
+248
+241
+237
+239
+240
+238
+235
+235
+228
+220
+216
+223
+238
+248
+248
+243
+233
+231
+229
+226
+225
+224
+225
+225
+224
+226
+229
+231
+233
+236
+237
+238
+243
+242
+238
+234
+228
+220
+211
+203
+198
+195
+194
+192
+192
+193
+193
+193
+189
+193
+187
+179
+185
+192
+201
+215
+255
+255
+253
+246
+242
+242
+240
+224
+170
+131
+95
+72
+59
+59
+73
+85
+81
+84
+87
+100
+119
+140
+154
+159
+152
+154
+154
+141
+114
+89
+84
+92
+95
+98
+105
+109
+108
+107
+105
+105
+103
+101
+99
+99
+103
+105
+104
+103
+105
+105
+105
+103
+103
+102
+108
+109
+112
+111
+114
+45
+45
+44
+44
+47
+49
+51
+52
+57
+60
+64
+69
+75
+81
+85
+86
+92
+94
+102
+112
+122
+133
+141
+144
+144
+142
+138
+135
+129
+127
+127
+128
+134
+136
+138
+140
+140
+140
+140
+139
+137
+134
+128
+123
+117
+110
+105
+99
+93
+93
+97
+103
+109
+112
+114
+114
+122
+123
+137
+164
+199
+224
+245
+252
+226
+222
+221
+222
+225
+225
+221
+218
+212
+211
+211
+213
+216
+221
+224
+221
+203
+196
+194
+193
+194
+194
+193
+192
+195
+220
+218
+213
+206
+196
+196
+190
+198
+199
+199
+201
+202
+203
+204
+205
+213
+213
+214
+215
+218
+223
+229
+233
+240
+237
+235
+236
+238
+237
+235
+234
+221
+225
+236
+248
+253
+250
+239
+229
+226
+224
+224
+224
+225
+226
+228
+228
+225
+228
+230
+232
+235
+235
+235
+236
+239
+238
+236
+231
+226
+217
+207
+199
+194
+191
+189
+187
+187
+187
+187
+187
+184
+189
+179
+177
+182
+180
+194
+235
+255
+254
+243
+237
+238
+236
+227
+202
+130
+102
+85
+71
+59
+56
+65
+78
+72
+83
+103
+129
+146
+149
+148
+149
+146
+156
+154
+128
+92
+72
+78
+91
+95
+99
+104
+108
+106
+104
+103
+102
+100
+100
+99
+101
+104
+107
+107
+106
+105
+105
+105
+104
+103
+104
+108
+111
+115
+115
+117
+50
+48
+48
+48
+49
+50
+51
+52
+57
+59
+63
+68
+73
+77
+82
+83
+88
+92
+100
+110
+122
+132
+140
+145
+148
+147
+142
+137
+130
+127
+127
+128
+132
+134
+137
+141
+139
+137
+135
+133
+133
+128
+121
+114
+109
+107
+105
+99
+92
+90
+97
+103
+111
+115
+117
+119
+118
+123
+139
+171
+205
+226
+237
+239
+219
+220
+225
+227
+227
+225
+224
+219
+214
+211
+209
+212
+216
+220
+224
+218
+200
+189
+188
+189
+191
+194
+195
+196
+198
+233
+211
+204
+209
+190
+192
+192
+192
+196
+197
+199
+200
+203
+204
+205
+210
+212
+213
+219
+227
+233
+236
+236
+232
+236
+239
+238
+234
+230
+228
+226
+243
+252
+255
+255
+243
+228
+223
+221
+223
+222
+222
+223
+225
+226
+229
+230
+229
+230
+232
+233
+235
+235
+235
+236
+238
+238
+234
+229
+223
+214
+204
+197
+190
+186
+182
+181
+181
+180
+179
+179
+179
+183
+173
+173
+179
+171
+193
+252
+253
+249
+238
+232
+229
+220
+206
+177
+119
+92
+79
+74
+70
+64
+61
+61
+65
+81
+110
+138
+149
+145
+141
+144
+157
+161
+144
+108
+75
+65
+76
+87
+95
+100
+105
+107
+105
+103
+100
+101
+98
+99
+100
+103
+106
+108
+109
+110
+106
+106
+106
+104
+103
+105
+109
+112
+119
+118
+118
+55
+54
+54
+53
+53
+53
+54
+54
+59
+61
+64
+68
+73
+77
+81
+82
+86
+89
+97
+107
+117
+128
+136
+140
+149
+148
+144
+139
+132
+129
+127
+127
+129
+132
+135
+137
+138
+134
+129
+128
+127
+122
+114
+109
+106
+105
+106
+102
+97
+95
+100
+105
+110
+116
+122
+125
+127
+136
+157
+182
+205
+216
+223
+226
+221
+223
+226
+227
+225
+223
+221
+220
+211
+208
+207
+209
+212
+217
+221
+216
+196
+185
+181
+183
+189
+194
+199
+199
+208
+245
+214
+201
+207
+184
+183
+188
+191
+195
+198
+200
+202
+204
+207
+209
+208
+210
+214
+222
+229
+234
+232
+230
+233
+239
+240
+234
+228
+228
+232
+237
+255
+255
+241
+221
+209
+209
+220
+231
+224
+224
+224
+224
+226
+227
+229
+229
+230
+231
+234
+235
+235
+235
+232
+234
+238
+238
+234
+228
+223
+214
+203
+195
+186
+181
+179
+175
+175
+172
+172
+172
+170
+172
+166
+167
+170
+171
+203
+255
+243
+241
+235
+226
+215
+199
+178
+153
+103
+83
+80
+78
+73
+66
+63
+65
+77
+94
+120
+139
+145
+141
+143
+151
+157
+146
+117
+82
+63
+66
+79
+86
+98
+101
+105
+106
+105
+101
+98
+99
+98
+102
+103
+105
+107
+109
+110
+111
+106
+107
+106
+105
+105
+106
+110
+114
+120
+118
+118
+63
+61
+61
+61
+61
+59
+59
+59
+63
+64
+67
+70
+75
+78
+81
+82
+89
+90
+95
+103
+113
+123
+131
+135
+143
+143
+141
+138
+131
+126
+122
+121
+123
+124
+128
+131
+131
+127
+124
+122
+118
+114
+109
+106
+107
+108
+108
+107
+103
+102
+103
+106
+110
+118
+124
+131
+150
+157
+169
+185
+197
+204
+213
+221
+225
+225
+226
+226
+224
+222
+220
+218
+209
+205
+204
+206
+209
+213
+217
+211
+193
+180
+176
+178
+187
+196
+201
+203
+217
+248
+227
+206
+204
+184
+172
+181
+188
+191
+192
+195
+197
+201
+206
+209
+217
+219
+222
+229
+234
+234
+231
+227
+232
+235
+236
+232
+236
+248
+255
+255
+249
+226
+202
+192
+201
+214
+223
+224
+226
+225
+226
+225
+227
+228
+229
+230
+233
+233
+234
+235
+235
+234
+232
+233
+239
+236
+232
+227
+221
+211
+201
+192
+182
+178
+174
+170
+169
+168
+165
+165
+165
+160
+160
+160
+162
+181
+219
+249
+237
+237
+231
+216
+198
+177
+156
+136
+84
+77
+83
+77
+63
+57
+65
+78
+108
+119
+132
+137
+141
+144
+148
+152
+131
+110
+81
+60
+57
+65
+79
+87
+99
+101
+106
+107
+105
+101
+97
+99
+99
+105
+106
+108
+108
+108
+109
+110
+109
+109
+109
+108
+107
+109
+114
+115
+124
+123
+122
+68
+68
+68
+67
+67
+67
+66
+66
+68
+69
+71
+74
+79
+82
+84
+85
+92
+92
+92
+97
+105
+114
+123
+129
+134
+136
+136
+132
+127
+121
+116
+111
+112
+114
+118
+119
+119
+116
+115
+114
+109
+108
+106
+107
+109
+111
+111
+111
+110
+109
+107
+108
+111
+117
+125
+137
+161
+167
+174
+186
+197
+204
+212
+220
+224
+225
+225
+224
+224
+221
+216
+212
+207
+202
+201
+202
+205
+210
+213
+207
+191
+177
+172
+174
+186
+196
+202
+206
+216
+240
+241
+217
+204
+190
+166
+179
+190
+193
+193
+194
+197
+201
+207
+212
+225
+227
+228
+231
+233
+233
+232
+231
+231
+230
+230
+233
+244
+255
+255
+248
+204
+193
+189
+195
+213
+222
+223
+217
+226
+226
+226
+226
+228
+229
+231
+233
+234
+235
+235
+235
+235
+232
+232
+233
+235
+233
+230
+224
+219
+209
+198
+190
+179
+174
+170
+166
+164
+163
+163
+160
+161
+150
+156
+154
+154
+195
+237
+237
+235
+232
+220
+202
+182
+161
+142
+127
+78
+75
+80
+76
+69
+71
+87
+105
+127
+130
+131
+125
+131
+142
+137
+124
+88
+71
+57
+54
+58
+61
+74
+87
+101
+104
+108
+108
+105
+99
+97
+97
+102
+108
+109
+110
+108
+107
+107
+109
+112
+113
+112
+112
+111
+113
+116
+119
+126
+123
+121
+73
+74
+73
+73
+73
+73
+72
+72
+73
+74
+76
+78
+82
+84
+88
+89
+93
+91
+92
+94
+100
+110
+120
+125
+129
+131
+133
+131
+125
+117
+111
+107
+105
+106
+109
+109
+109
+108
+107
+106
+103
+104
+104
+107
+110
+113
+113
+112
+112
+111
+112
+115
+119
+126
+137
+147
+162
+166
+171
+186
+200
+211
+217
+221
+223
+223
+223
+223
+223
+221
+216
+209
+207
+204
+202
+203
+206
+209
+211
+206
+190
+175
+168
+172
+182
+193
+201
+204
+204
+224
+248
+224
+208
+202
+171
+184
+202
+204
+202
+203
+205
+210
+220
+225
+226
+226
+227
+226
+226
+227
+229
+229
+228
+224
+221
+225
+234
+234
+211
+184
+184
+190
+201
+208
+214
+217
+225
+231
+226
+226
+226
+228
+229
+231
+233
+234
+234
+234
+235
+235
+233
+232
+231
+231
+233
+230
+226
+222
+214
+204
+194
+185
+174
+170
+166
+162
+160
+158
+159
+155
+152
+140
+153
+152
+151
+205
+246
+222
+229
+217
+200
+183
+167
+155
+141
+128
+84
+67
+66
+72
+88
+110
+132
+148
+135
+134
+124
+110
+117
+130
+117
+91
+59
+52
+53
+61
+60
+57
+67
+85
+103
+105
+108
+109
+106
+102
+98
+99
+104
+108
+111
+110
+108
+105
+106
+106
+115
+115
+115
+114
+114
+115
+119
+122
+119
+117
+116
+82
+82
+82
+82
+82
+82
+82
+82
+85
+86
+87
+88
+89
+91
+92
+92
+98
+97
+97
+98
+101
+107
+113
+117
+122
+124
+127
+127
+124
+117
+109
+101
+99
+96
+95
+95
+94
+94
+97
+98
+101
+103
+105
+107
+107
+109
+109
+106
+106
+114
+113
+117
+139
+156
+162
+170
+164
+165
+166
+176
+194
+210
+221
+222
+223
+222
+222
+222
+222
+219
+216
+215
+213
+212
+210
+210
+210
+210
+212
+205
+189
+182
+174
+169
+171
+183
+192
+195
+200
+206
+212
+219
+221
+212
+194
+183
+221
+216
+212
+211
+215
+219
+221
+223
+223
+230
+234
+234
+229
+224
+222
+220
+220
+209
+199
+191
+185
+186
+191
+195
+195
+199
+208
+217
+224
+229
+233
+236
+230
+229
+229
+229
+229
+229
+229
+229
+224
+225
+228
+229
+230
+231
+231
+231
+235
+230
+223
+220
+214
+205
+193
+183
+169
+163
+160
+155
+153
+150
+151
+145
+144
+139
+135
+145
+188
+228
+229
+205
+189
+181
+170
+162
+155
+150
+149
+138
+88
+61
+56
+86
+127
+155
+161
+156
+146
+126
+104
+92
+89
+84
+72
+63
+58
+64
+60
+58
+60
+58
+65
+82
+93
+103
+112
+111
+108
+106
+105
+103
+108
+109
+111
+108
+109
+107
+109
+109
+113
+113
+114
+114
+116
+118
+121
+122
+123
+111
+101
+87
+87
+87
+87
+87
+87
+87
+87
+88
+89
+89
+91
+92
+93
+94
+95
+100
+99
+99
+99
+102
+106
+110
+112
+114
+116
+118
+118
+115
+109
+103
+98
+94
+90
+89
+87
+88
+88
+92
+94
+99
+99
+102
+103
+105
+106
+107
+106
+102
+111
+119
+129
+153
+168
+175
+180
+173
+170
+171
+177
+190
+204
+216
+220
+221
+220
+220
+220
+219
+218
+217
+215
+215
+213
+213
+213
+212
+212
+212
+206
+190
+182
+174
+166
+167
+178
+185
+190
+198
+199
+203
+210
+220
+225
+223
+221
+219
+214
+209
+208
+211
+215
+217
+218
+230
+234
+236
+234
+230
+226
+225
+219
+205
+194
+187
+180
+178
+181
+186
+191
+198
+205
+213
+220
+226
+230
+235
+239
+233
+231
+231
+230
+230
+229
+229
+227
+226
+227
+227
+228
+228
+228
+229
+229
+228
+227
+223
+217
+208
+196
+183
+172
+165
+160
+156
+151
+150
+146
+147
+140
+128
+128
+137
+157
+191
+215
+209
+183
+172
+164
+157
+152
+151
+151
+152
+140
+96
+83
+94
+122
+153
+165
+153
+136
+106
+97
+84
+74
+70
+63
+57
+53
+58
+65
+61
+58
+61
+58
+64
+82
+94
+103
+113
+112
+110
+107
+107
+104
+109
+110
+109
+109
+107
+107
+108
+109
+112
+112
+112
+115
+117
+120
+120
+120
+110
+100
+90
+93
+93
+93
+93
+93
+93
+93
+93
+91
+92
+93
+94
+95
+96
+97
+97
+101
+101
+100
+100
+101
+102
+104
+104
+105
+106
+107
+107
+105
+102
+98
+95
+90
+87
+85
+82
+81
+83
+87
+88
+94
+94
+97
+99
+103
+105
+107
+105
+101
+113
+123
+136
+162
+175
+177
+182
+182
+183
+182
+184
+189
+197
+204
+211
+217
+219
+219
+219
+218
+217
+217
+215
+215
+213
+213
+212
+212
+212
+210
+205
+192
+182
+173
+163
+163
+170
+179
+185
+196
+196
+197
+200
+208
+216
+220
+225
+216
+215
+210
+211
+216
+222
+227
+232
+236
+237
+234
+231
+230
+227
+224
+217
+193
+184
+179
+175
+175
+178
+182
+187
+200
+205
+213
+217
+223
+229
+234
+238
+234
+233
+233
+231
+231
+230
+229
+229
+227
+228
+228
+227
+227
+226
+225
+222
+221
+220
+218
+211
+200
+185
+173
+165
+161
+157
+153
+148
+147
+144
+144
+138
+122
+121
+136
+160
+185
+192
+184
+171
+162
+156
+153
+151
+151
+151
+152
+139
+115
+122
+147
+164
+171
+158
+124
+91
+63
+65
+65
+63
+58
+54
+54
+53
+57
+64
+61
+57
+61
+57
+64
+81
+96
+105
+115
+114
+112
+109
+109
+107
+112
+113
+111
+110
+108
+108
+108
+110
+112
+112
+112
+117
+120
+121
+117
+113
+95
+86
+79
+97
+97
+97
+97
+97
+97
+97
+97
+95
+96
+96
+97
+98
+99
+100
+100
+101
+102
+102
+103
+103
+102
+102
+102
+104
+104
+104
+104
+103
+101
+100
+99
+93
+90
+86
+82
+80
+80
+84
+85
+87
+89
+91
+93
+97
+100
+102
+102
+103
+111
+119
+138
+169
+182
+180
+183
+193
+195
+195
+193
+189
+189
+193
+202
+213
+217
+218
+217
+218
+216
+216
+213
+213
+212
+212
+212
+212
+212
+210
+205
+193
+182
+172
+162
+157
+162
+172
+181
+188
+191
+195
+197
+203
+206
+206
+211
+220
+223
+218
+218
+222
+226
+232
+235
+235
+235
+232
+229
+228
+224
+217
+204
+185
+177
+175
+174
+174
+176
+179
+181
+195
+202
+210
+217
+223
+227
+234
+236
+237
+235
+235
+234
+234
+232
+231
+230
+226
+225
+223
+224
+222
+220
+219
+217
+214
+213
+210
+202
+187
+175
+164
+158
+156
+152
+148
+146
+143
+141
+140
+135
+128
+118
+129
+153
+170
+172
+169
+166
+157
+152
+148
+148
+149
+149
+151
+141
+137
+153
+173
+166
+144
+115
+78
+47
+45
+51
+58
+61
+59
+58
+58
+60
+57
+63
+60
+57
+60
+57
+63
+80
+97
+106
+116
+115
+114
+111
+111
+109
+112
+115
+112
+111
+109
+109
+110
+112
+113
+114
+116
+121
+123
+119
+109
+101
+90
+82
+77
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+100
+100
+101
+102
+102
+102
+102
+103
+104
+105
+105
+105
+104
+103
+106
+105
+105
+104
+104
+104
+104
+104
+100
+96
+91
+86
+80
+78
+78
+78
+80
+82
+84
+86
+88
+91
+93
+95
+99
+105
+112
+134
+172
+189
+191
+197
+205
+210
+209
+203
+194
+187
+184
+190
+208
+215
+216
+215
+217
+214
+214
+212
+212
+212
+212
+210
+210
+210
+210
+205
+193
+182
+171
+161
+154
+155
+163
+175
+179
+186
+194
+199
+203
+206
+208
+216
+232
+234
+228
+226
+223
+223
+225
+225
+233
+232
+231
+230
+226
+218
+206
+191
+181
+174
+174
+173
+173
+173
+173
+175
+184
+193
+205
+215
+221
+225
+231
+235
+237
+238
+238
+237
+234
+232
+231
+228
+225
+223
+223
+220
+219
+217
+215
+212
+207
+203
+197
+185
+173
+163
+158
+154
+150
+147
+145
+141
+138
+137
+136
+131
+131
+117
+123
+147
+164
+161
+158
+161
+152
+146
+144
+141
+143
+148
+151
+143
+141
+152
+157
+128
+93
+68
+50
+36
+45
+48
+53
+57
+60
+61
+58
+58
+57
+62
+59
+56
+59
+56
+62
+80
+98
+107
+117
+116
+115
+113
+113
+111
+114
+114
+114
+112
+109
+109
+112
+115
+116
+118
+120
+123
+122
+113
+100
+89
+92
+85
+81
+101
+101
+101
+101
+101
+101
+101
+101
+101
+102
+102
+102
+103
+103
+104
+104
+103
+104
+105
+106
+106
+106
+106
+106
+106
+105
+104
+104
+104
+104
+105
+106
+102
+98
+94
+88
+83
+77
+75
+73
+75
+76
+76
+78
+80
+81
+83
+84
+92
+95
+100
+124
+161
+181
+193
+211
+214
+220
+219
+210
+200
+189
+178
+183
+204
+212
+213
+213
+214
+213
+213
+212
+212
+210
+210
+210
+210
+210
+210
+205
+193
+181
+171
+162
+153
+149
+155
+167
+178
+185
+191
+195
+197
+203
+210
+223
+233
+237
+234
+232
+229
+228
+225
+224
+223
+224
+226
+224
+217
+207
+194
+181
+177
+172
+172
+171
+170
+169
+169
+171
+175
+183
+197
+206
+214
+222
+227
+232
+236
+239
+239
+238
+235
+233
+231
+228
+226
+224
+222
+218
+217
+213
+209
+205
+195
+187
+179
+170
+161
+155
+152
+149
+145
+141
+138
+136
+134
+132
+131
+127
+125
+116
+126
+151
+163
+156
+149
+152
+149
+144
+142
+140
+142
+147
+153
+145
+126
+121
+114
+85
+59
+47
+48
+48
+51
+52
+54
+60
+64
+63
+60
+55
+56
+62
+58
+55
+58
+55
+61
+79
+98
+107
+117
+117
+116
+113
+114
+112
+114
+115
+114
+112
+110
+112
+115
+118
+121
+123
+122
+120
+113
+103
+93
+88
+95
+87
+82
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+104
+104
+104
+104
+105
+106
+106
+106
+106
+105
+105
+105
+105
+105
+104
+104
+104
+104
+104
+104
+104
+102
+101
+98
+92
+87
+80
+76
+73
+73
+71
+71
+71
+72
+73
+72
+74
+82
+89
+92
+105
+129
+149
+174
+209
+217
+223
+223
+217
+207
+195
+183
+180
+201
+211
+212
+211
+213
+211
+211
+211
+210
+209
+209
+209
+209
+209
+209
+205
+193
+181
+172
+163
+152
+144
+149
+161
+173
+182
+191
+192
+194
+199
+208
+222
+232
+238
+236
+233
+229
+224
+220
+217
+204
+207
+211
+207
+199
+189
+180
+171
+170
+167
+167
+166
+165
+166
+166
+169
+170
+177
+188
+195
+203
+211
+220
+228
+233
+236
+236
+235
+233
+232
+229
+226
+224
+221
+218
+213
+207
+202
+199
+191
+177
+169
+162
+156
+152
+148
+145
+141
+139
+137
+135
+131
+130
+128
+127
+125
+120
+120
+133
+152
+157
+148
+144
+149
+147
+144
+144
+144
+146
+149
+152
+142
+107
+86
+74
+61
+54
+50
+52
+53
+54
+56
+61
+67
+69
+67
+64
+59
+55
+61
+58
+55
+58
+54
+61
+78
+97
+107
+117
+117
+116
+114
+114
+112
+113
+114
+113
+112
+111
+114
+117
+121
+127
+126
+122
+113
+102
+95
+93
+94
+97
+89
+82
+104
+104
+104
+104
+104
+104
+104
+104
+103
+104
+104
+104
+104
+104
+105
+105
+109
+108
+106
+105
+104
+103
+103
+104
+105
+105
+105
+105
+104
+104
+104
+104
+103
+102
+101
+98
+92
+85
+80
+77
+69
+68
+68
+68
+66
+66
+66
+67
+74
+84
+85
+89
+101
+115
+146
+192
+215
+222
+223
+220
+213
+204
+189
+184
+203
+207
+208
+210
+210
+210
+210
+210
+209
+209
+209
+209
+209
+209
+209
+205
+193
+182
+173
+167
+153
+143
+147
+159
+163
+176
+192
+198
+204
+208
+217
+227
+236
+238
+233
+226
+214
+202
+192
+187
+183
+187
+190
+187
+179
+169
+164
+160
+161
+159
+160
+161
+161
+163
+163
+164
+169
+173
+178
+184
+191
+201
+212
+224
+229
+232
+232
+231
+229
+228
+225
+222
+220
+216
+210
+202
+196
+188
+184
+176
+162
+153
+149
+147
+145
+143
+139
+133
+136
+133
+131
+128
+126
+124
+123
+123
+121
+128
+140
+150
+146
+139
+144
+153
+145
+146
+148
+150
+150
+151
+150
+140
+97
+69
+54
+56
+62
+60
+51
+45
+49
+55
+66
+71
+72
+66
+63
+59
+55
+61
+57
+54
+58
+54
+60
+78
+97
+106
+117
+116
+116
+114
+114
+112
+113
+113
+113
+112
+112
+115
+119
+123
+130
+128
+120
+106
+93
+89
+94
+101
+99
+90
+83
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+103
+103
+102
+101
+98
+90
+83
+77
+72
+69
+65
+64
+63
+63
+63
+63
+72
+74
+67
+75
+92
+96
+128
+189
+217
+224
+226
+229
+226
+215
+203
+201
+199
+203
+204
+205
+205
+206
+209
+211
+210
+210
+210
+210
+209
+209
+209
+206
+187
+182
+177
+168
+154
+148
+149
+156
+174
+179
+186
+193
+205
+215
+226
+234
+232
+232
+221
+201
+187
+180
+176
+169
+171
+169
+164
+160
+155
+150
+147
+146
+150
+152
+153
+154
+155
+156
+158
+161
+162
+165
+171
+176
+182
+190
+197
+204
+218
+224
+226
+226
+226
+222
+218
+215
+216
+210
+199
+187
+178
+170
+166
+159
+153
+146
+145
+141
+139
+136
+135
+133
+128
+125
+124
+124
+124
+123
+121
+120
+119
+139
+151
+147
+142
+145
+147
+142
+152
+152
+145
+144
+151
+149
+148
+147
+93
+73
+65
+66
+62
+55
+50
+52
+52
+72
+90
+87
+77
+68
+65
+61
+58
+62
+59
+58
+59
+52
+59
+80
+99
+108
+117
+115
+114
+112
+114
+113
+112
+113
+114
+114
+115
+118
+123
+127
+130
+120
+106
+96
+94
+97
+102
+104
+100
+91
+84
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+104
+104
+103
+103
+100
+94
+85
+79
+73
+69
+66
+64
+63
+62
+62
+61
+66
+65
+64
+72
+77
+82
+124
+185
+201
+221
+234
+230
+226
+226
+219
+209
+205
+206
+207
+207
+207
+206
+205
+205
+206
+208
+208
+208
+208
+208
+208
+205
+201
+197
+188
+174
+159
+150
+150
+155
+168
+180
+195
+209
+222
+230
+233
+234
+224
+219
+208
+190
+175
+171
+165
+159
+159
+156
+151
+149
+143
+139
+135
+136
+142
+143
+146
+145
+148
+148
+150
+153
+159
+161
+164
+168
+173
+178
+184
+189
+202
+208
+211
+213
+215
+214
+212
+209
+202
+195
+185
+176
+169
+164
+159
+153
+146
+140
+138
+136
+134
+132
+131
+129
+126
+124
+123
+121
+120
+119
+117
+119
+128
+144
+152
+145
+140
+143
+146
+144
+147
+152
+152
+151
+156
+148
+142
+138
+93
+88
+95
+90
+73
+54
+52
+60
+79
+89
+95
+87
+74
+66
+63
+60
+57
+61
+58
+57
+60
+53
+59
+80
+100
+108
+117
+116
+114
+113
+114
+113
+115
+114
+112
+113
+116
+120
+124
+127
+123
+111
+99
+93
+97
+101
+101
+99
+100
+91
+84
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+106
+108
+107
+105
+105
+102
+97
+89
+83
+77
+72
+68
+65
+65
+63
+62
+61
+62
+58
+66
+73
+69
+84
+132
+181
+179
+214
+239
+236
+230
+235
+232
+219
+203
+201
+201
+201
+203
+202
+200
+200
+202
+203
+203
+203
+203
+204
+204
+203
+194
+190
+182
+173
+161
+158
+160
+167
+188
+199
+214
+225
+231
+233
+229
+223
+216
+209
+195
+177
+166
+161
+156
+152
+149
+146
+143
+138
+133
+130
+126
+129
+132
+136
+137
+137
+139
+139
+142
+143
+150
+152
+155
+158
+162
+167
+170
+175
+185
+190
+193
+196
+197
+197
+195
+193
+182
+178
+170
+163
+158
+155
+152
+148
+141
+136
+135
+132
+130
+128
+128
+127
+125
+122
+122
+119
+118
+117
+116
+118
+136
+148
+150
+142
+136
+141
+145
+146
+146
+153
+153
+154
+154
+147
+141
+141
+129
+126
+128
+108
+76
+54
+61
+76
+101
+101
+93
+80
+69
+63
+61
+58
+56
+59
+56
+57
+61
+54
+60
+80
+100
+109
+118
+116
+115
+113
+114
+112
+117
+112
+110
+112
+117
+121
+125
+124
+112
+102
+92
+92
+101
+105
+102
+95
+99
+90
+83
+105
+105
+105
+105
+105
+105
+105
+105
+106
+106
+106
+106
+106
+106
+106
+106
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+110
+109
+106
+106
+104
+101
+95
+89
+82
+77
+71
+68
+67
+66
+64
+62
+63
+60
+71
+76
+77
+110
+152
+167
+158
+197
+229
+239
+237
+237
+234
+227
+205
+199
+197
+197
+200
+202
+203
+205
+209
+209
+210
+210
+211
+211
+211
+211
+211
+209
+203
+198
+194
+195
+199
+206
+217
+221
+226
+228
+228
+226
+224
+220
+214
+202
+189
+173
+161
+155
+151
+148
+142
+140
+138
+133
+130
+125
+123
+124
+128
+131
+131
+132
+132
+133
+135
+136
+137
+140
+143
+147
+150
+156
+160
+163
+170
+173
+175
+176
+176
+176
+175
+174
+168
+165
+158
+155
+149
+146
+145
+142
+136
+133
+131
+129
+127
+126
+125
+125
+124
+122
+121
+119
+115
+113
+114
+117
+140
+146
+145
+138
+135
+139
+147
+151
+150
+155
+152
+148
+150
+144
+144
+151
+148
+133
+117
+89
+67
+63
+80
+99
+101
+92
+78
+67
+63
+62
+61
+59
+55
+58
+55
+57
+61
+55
+60
+79
+98
+108
+118
+117
+116
+114
+114
+111
+113
+111
+111
+115
+122
+124
+122
+117
+99
+94
+91
+95
+103
+106
+102
+96
+98
+89
+82
+105
+105
+105
+105
+105
+105
+105
+105
+106
+106
+106
+106
+106
+106
+106
+106
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+107
+111
+110
+107
+107
+107
+104
+100
+96
+88
+82
+78
+73
+71
+68
+66
+63
+64
+65
+77
+83
+101
+148
+170
+153
+155
+179
+214
+241
+245
+235
+232
+233
+217
+211
+205
+203
+206
+210
+213
+215
+218
+218
+221
+221
+222
+222
+224
+224
+235
+232
+227
+220
+216
+216
+219
+224
+224
+225
+227
+226
+228
+226
+228
+224
+218
+203
+188
+174
+163
+153
+147
+146
+141
+138
+137
+132
+130
+128
+125
+125
+127
+128
+128
+128
+128
+129
+129
+131
+130
+132
+134
+138
+140
+144
+146
+148
+155
+158
+159
+160
+161
+162
+162
+162
+159
+156
+152
+148
+143
+140
+137
+135
+132
+130
+129
+128
+125
+125
+124
+123
+122
+121
+120
+118
+113
+111
+113
+116
+140
+141
+137
+132
+133
+140
+147
+152
+152
+156
+152
+147
+146
+136
+131
+134
+110
+90
+74
+65
+73
+87
+100
+106
+88
+76
+63
+58
+60
+62
+60
+58
+56
+58
+54
+56
+62
+55
+59
+76
+95
+105
+116
+116
+116
+114
+115
+112
+110
+109
+112
+119
+124
+122
+114
+105
+90
+92
+97
+101
+103
+103
+104
+102
+99
+89
+82
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+111
+110
+107
+108
+108
+107
+103
+100
+94
+89
+83
+77
+75
+71
+69
+64
+61
+66
+81
+98
+129
+169
+178
+155
+175
+184
+208
+242
+254
+243
+237
+242
+227
+218
+212
+208
+209
+212
+214
+214
+217
+218
+220
+221
+222
+222
+224
+224
+226
+225
+220
+217
+214
+215
+216
+219
+224
+228
+230
+232
+231
+228
+223
+219
+221
+205
+188
+175
+165
+153
+146
+144
+140
+137
+136
+134
+132
+129
+129
+128
+128
+127
+127
+127
+127
+127
+127
+127
+128
+129
+131
+131
+133
+132
+133
+133
+141
+143
+145
+148
+151
+154
+158
+159
+153
+150
+147
+144
+138
+135
+132
+130
+130
+129
+127
+126
+123
+123
+123
+122
+120
+120
+119
+115
+112
+111
+114
+118
+139
+137
+132
+130
+133
+139
+146
+151
+147
+153
+151
+149
+144
+123
+102
+96
+69
+62
+63
+74
+95
+107
+101
+88
+77
+64
+54
+55
+61
+61
+58
+55
+56
+58
+54
+56
+62
+55
+57
+73
+91
+101
+114
+115
+115
+114
+115
+112
+109
+111
+115
+120
+122
+115
+105
+96
+89
+94
+101
+103
+102
+101
+103
+104
+97
+88
+81
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+111
+109
+107
+108
+109
+108
+105
+102
+98
+94
+88
+82
+79
+74
+73
+65
+60
+66
+86
+122
+163
+178
+180
+183
+197
+193
+200
+222
+241
+242
+233
+228
+219
+213
+207
+205
+207
+208
+208
+205
+210
+210
+212
+213
+215
+216
+217
+218
+221
+221
+222
+221
+223
+224
+227
+229
+231
+234
+236
+236
+231
+226
+219
+214
+219
+204
+188
+177
+169
+155
+147
+145
+139
+139
+138
+137
+136
+135
+136
+133
+128
+125
+125
+125
+125
+125
+125
+124
+124
+124
+126
+126
+125
+125
+126
+126
+131
+131
+135
+137
+141
+145
+149
+150
+146
+145
+141
+138
+135
+131
+128
+126
+128
+128
+126
+125
+124
+122
+122
+121
+117
+118
+118
+114
+111
+111
+115
+120
+138
+134
+129
+130
+133
+137
+142
+145
+146
+151
+147
+145
+138
+110
+80
+69
+65
+75
+87
+96
+103
+100
+86
+71
+65
+55
+49
+54
+61
+60
+56
+55
+57
+59
+54
+57
+63
+55
+55
+70
+86
+97
+111
+113
+115
+114
+116
+113
+111
+113
+117
+118
+115
+106
+98
+91
+94
+96
+99
+101
+102
+102
+102
+101
+96
+87
+80
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+108
+110
+109
+109
+109
+109
+108
+106
+103
+100
+96
+90
+85
+80
+77
+73
+69
+65
+71
+92
+137
+175
+169
+169
+203
+195
+189
+185
+195
+216
+229
+221
+205
+209
+207
+205
+206
+210
+210
+206
+201
+207
+209
+210
+212
+214
+217
+220
+222
+222
+223
+222
+223
+225
+224
+224
+225
+232
+234
+232
+231
+228
+228
+226
+223
+215
+200
+184
+177
+169
+155
+146
+142
+137
+136
+136
+136
+136
+138
+137
+136
+128
+126
+126
+124
+124
+124
+124
+124
+120
+121
+124
+124
+125
+125
+125
+125
+126
+127
+128
+129
+132
+133
+134
+134
+138
+136
+136
+133
+132
+128
+126
+125
+125
+125
+124
+121
+122
+120
+120
+120
+114
+117
+118
+114
+110
+110
+116
+120
+138
+132
+128
+132
+136
+140
+140
+141
+149
+148
+139
+132
+127
+101
+71
+61
+73
+90
+103
+99
+89
+83
+78
+74
+58
+48
+44
+53
+61
+60
+58
+57
+59
+59
+55
+57
+63
+56
+56
+69
+85
+97
+110
+114
+114
+114
+115
+113
+114
+117
+118
+116
+111
+102
+94
+91
+100
+97
+96
+99
+102
+103
+101
+97
+96
+87
+80
+105
+105
+105
+106
+106
+107
+107
+107
+106
+106
+106
+106
+106
+106
+106
+106
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+110
+107
+112
+116
+114
+110
+106
+104
+104
+103
+103
+99
+91
+86
+83
+78
+71
+76
+74
+98
+145
+182
+187
+183
+185
+182
+189
+194
+200
+205
+208
+211
+211
+205
+205
+208
+211
+212
+207
+206
+207
+200
+201
+203
+207
+212
+216
+222
+222
+225
+223
+223
+224
+224
+225
+225
+227
+227
+228
+228
+227
+227
+227
+227
+224
+211
+197
+184
+170
+160
+151
+142
+134
+131
+129
+129
+129
+132
+135
+136
+136
+133
+132
+132
+129
+129
+128
+128
+128
+126
+126
+126
+126
+126
+126
+126
+126
+125
+125
+126
+126
+128
+128
+128
+126
+128
+126
+125
+124
+123
+122
+120
+120
+120
+120
+119
+118
+118
+116
+115
+113
+109
+114
+110
+109
+111
+109
+113
+127
+133
+133
+134
+136
+139
+144
+148
+149
+147
+141
+137
+130
+111
+89
+77
+79
+106
+98
+89
+85
+82
+77
+73
+67
+55
+52
+50
+54
+60
+64
+64
+60
+53
+51
+52
+55
+57
+59
+61
+60
+83
+97
+110
+115
+114
+114
+115
+114
+117
+126
+126
+112
+98
+94
+94
+94
+96
+98
+100
+102
+101
+99
+96
+94
+95
+84
+75
+105
+105
+105
+106
+106
+107
+107
+107
+106
+106
+106
+106
+106
+106
+106
+106
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+110
+114
+113
+114
+113
+114
+111
+109
+106
+103
+107
+111
+108
+104
+99
+91
+82
+80
+72
+81
+107
+127
+132
+136
+147
+177
+184
+187
+192
+192
+193
+194
+194
+205
+197
+192
+195
+205
+209
+205
+199
+202
+202
+204
+208
+214
+219
+223
+224
+223
+223
+223
+223
+224
+224
+225
+225
+224
+225
+224
+224
+226
+226
+226
+224
+213
+200
+186
+172
+160
+148
+138
+130
+128
+126
+126
+127
+131
+134
+136
+137
+135
+133
+132
+132
+131
+130
+130
+130
+127
+127
+127
+127
+126
+126
+126
+126
+125
+125
+125
+125
+125
+125
+124
+124
+124
+122
+122
+121
+121
+121
+119
+119
+119
+119
+116
+115
+114
+114
+112
+112
+107
+113
+109
+108
+111
+108
+112
+126
+132
+133
+136
+139
+144
+148
+149
+148
+138
+133
+128
+123
+115
+104
+102
+103
+94
+88
+80
+76
+75
+75
+71
+67
+60
+56
+54
+55
+60
+63
+62
+59
+52
+51
+53
+54
+58
+60
+62
+62
+81
+94
+107
+112
+112
+113
+115
+115
+120
+124
+120
+107
+96
+93
+93
+92
+96
+97
+99
+101
+100
+98
+96
+94
+93
+82
+73
+105
+105
+105
+106
+106
+107
+107
+107
+106
+106
+106
+106
+106
+106
+106
+106
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+110
+113
+111
+109
+109
+113
+111
+108
+104
+102
+112
+123
+126
+127
+122
+112
+101
+84
+70
+67
+77
+83
+85
+93
+108
+110
+117
+126
+135
+146
+155
+165
+171
+185
+183
+181
+186
+198
+206
+210
+207
+208
+209
+211
+213
+215
+219
+222
+222
+222
+222
+222
+221
+223
+222
+223
+223
+222
+222
+221
+220
+221
+221
+221
+220
+214
+206
+195
+179
+162
+148
+136
+131
+130
+127
+126
+127
+131
+134
+135
+136
+135
+132
+132
+132
+130
+130
+128
+128
+127
+127
+126
+126
+126
+126
+126
+126
+125
+125
+125
+125
+124
+123
+123
+123
+123
+123
+122
+121
+120
+120
+120
+120
+116
+116
+115
+115
+114
+113
+111
+111
+106
+111
+109
+107
+108
+105
+109
+125
+135
+135
+139
+142
+145
+146
+148
+145
+140
+135
+126
+116
+111
+111
+108
+102
+81
+75
+69
+68
+69
+71
+71
+69
+63
+60
+57
+55
+58
+60
+59
+57
+54
+53
+54
+54
+58
+60
+61
+61
+77
+90
+102
+108
+110
+113
+117
+116
+122
+119
+110
+99
+92
+92
+92
+90
+95
+97
+98
+100
+99
+97
+95
+93
+91
+80
+70
+105
+105
+105
+106
+106
+107
+107
+107
+106
+106
+106
+106
+106
+106
+106
+106
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+110
+114
+111
+109
+107
+107
+108
+108
+106
+106
+120
+136
+145
+149
+146
+137
+125
+96
+79
+68
+70
+72
+70
+76
+86
+80
+82
+86
+89
+92
+97
+101
+109
+136
+157
+173
+181
+188
+196
+208
+216
+212
+213
+214
+216
+217
+219
+219
+221
+222
+221
+221
+221
+221
+221
+221
+220
+219
+218
+217
+217
+218
+218
+219
+217
+214
+211
+201
+186
+167
+152
+140
+133
+131
+127
+126
+127
+131
+132
+135
+136
+132
+132
+132
+131
+130
+130
+127
+127
+127
+127
+126
+126
+126
+126
+126
+126
+125
+124
+125
+123
+123
+123
+123
+120
+123
+121
+121
+121
+120
+120
+120
+118
+115
+115
+115
+114
+113
+111
+111
+109
+106
+111
+108
+104
+107
+104
+108
+124
+138
+140
+141
+143
+144
+145
+144
+140
+137
+133
+121
+105
+100
+100
+92
+78
+69
+65
+61
+60
+63
+67
+70
+71
+66
+62
+58
+57
+57
+57
+56
+55
+55
+54
+54
+54
+58
+59
+60
+60
+74
+86
+98
+106
+110
+115
+119
+120
+123
+114
+101
+92
+90
+92
+92
+90
+95
+96
+97
+98
+97
+96
+94
+93
+90
+78
+69
+104
+104
+104
+105
+105
+106
+106
+106
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+108
+114
+116
+115
+109
+106
+108
+115
+122
+129
+144
+160
+168
+171
+168
+163
+153
+122
+99
+79
+71
+69
+66
+66
+69
+75
+74
+71
+68
+65
+65
+64
+70
+85
+113
+142
+160
+175
+191
+204
+211
+213
+215
+216
+217
+218
+218
+218
+218
+221
+221
+221
+219
+219
+219
+219
+217
+218
+217
+214
+213
+213
+213
+213
+214
+212
+211
+206
+193
+174
+158
+145
+138
+132
+129
+128
+128
+129
+132
+134
+135
+132
+131
+130
+130
+130
+129
+127
+127
+126
+126
+126
+126
+125
+125
+125
+125
+124
+122
+124
+121
+121
+120
+120
+118
+121
+121
+120
+118
+118
+117
+117
+116
+114
+113
+113
+112
+111
+110
+110
+109
+106
+109
+106
+104
+106
+102
+106
+125
+141
+143
+144
+144
+144
+142
+138
+131
+123
+118
+107
+93
+89
+89
+79
+63
+58
+55
+52
+53
+56
+61
+67
+69
+66
+63
+60
+58
+56
+55
+53
+52
+53
+53
+54
+54
+57
+58
+59
+59
+71
+82
+96
+105
+111
+117
+121
+121
+120
+110
+96
+90
+91
+94
+94
+93
+96
+97
+98
+98
+97
+96
+95
+94
+87
+76
+66
+104
+104
+104
+105
+105
+106
+106
+106
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+108
+107
+110
+112
+108
+107
+114
+132
+145
+167
+181
+196
+201
+201
+197
+192
+185
+164
+136
+102
+80
+70
+62
+59
+58
+56
+56
+56
+58
+60
+64
+67
+71
+64
+83
+104
+129
+163
+192
+204
+202
+211
+214
+216
+218
+219
+219
+220
+220
+221
+221
+219
+219
+218
+218
+218
+217
+217
+215
+214
+212
+211
+210
+211
+212
+212
+213
+208
+198
+182
+165
+150
+140
+134
+130
+129
+128
+129
+131
+132
+133
+130
+130
+130
+130
+129
+127
+127
+126
+126
+126
+126
+126
+125
+125
+125
+125
+122
+122
+121
+121
+120
+118
+118
+116
+119
+117
+117
+115
+116
+115
+114
+114
+113
+113
+112
+111
+110
+109
+108
+106
+104
+108
+105
+102
+104
+101
+105
+123
+142
+146
+145
+143
+141
+135
+129
+124
+115
+107
+96
+86
+80
+74
+64
+52
+51
+50
+48
+48
+50
+53
+57
+60
+63
+63
+62
+58
+58
+53
+51
+49
+51
+51
+52
+52
+56
+57
+59
+59
+67
+79
+93
+105
+112
+119
+121
+119
+113
+102
+90
+88
+92
+93
+93
+94
+96
+96
+96
+96
+96
+95
+94
+93
+85
+74
+65
+104
+104
+104
+105
+105
+106
+106
+106
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+108
+106
+106
+107
+107
+117
+136
+159
+176
+195
+211
+226
+231
+231
+227
+222
+217
+206
+184
+151
+121
+95
+75
+64
+59
+62
+61
+61
+59
+59
+58
+57
+58
+63
+69
+81
+99
+137
+177
+199
+202
+205
+209
+213
+216
+219
+221
+224
+223
+222
+221
+221
+220
+220
+219
+219
+217
+218
+216
+213
+212
+211
+210
+211
+212
+217
+217
+209
+200
+188
+172
+153
+140
+137
+131
+129
+128
+129
+131
+131
+132
+130
+130
+130
+129
+127
+127
+126
+125
+126
+126
+125
+125
+125
+125
+125
+125
+122
+121
+120
+120
+119
+116
+115
+114
+116
+115
+114
+113
+114
+112
+112
+112
+111
+111
+110
+110
+109
+108
+107
+105
+103
+107
+104
+101
+104
+98
+102
+122
+144
+146
+145
+142
+136
+129
+120
+114
+107
+94
+82
+75
+67
+57
+50
+48
+49
+49
+48
+47
+47
+48
+50
+52
+57
+59
+61
+60
+59
+54
+51
+49
+46
+48
+49
+50
+55
+57
+58
+58
+63
+75
+91
+104
+113
+119
+119
+115
+103
+94
+85
+87
+91
+91
+91
+93
+95
+95
+95
+95
+94
+94
+93
+93
+85
+74
+64
+104
+104
+104
+105
+105
+106
+106
+106
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+107
+107
+107
+107
+107
+108
+108
+108
+108
+108
+108
+108
+108
+112
+110
+108
+116
+135
+161
+188
+206
+207
+224
+242
+250
+251
+247
+241
+240
+232
+221
+193
+162
+125
+94
+75
+67
+65
+65
+64
+66
+65
+66
+67
+65
+59
+66
+71
+76
+102
+145
+181
+199
+192
+199
+206
+211
+216
+222
+225
+226
+221
+219
+219
+220
+220
+219
+219
+219
+220
+217
+215
+212
+212
+211
+210
+213
+221
+219
+210
+202
+191
+176
+156
+139
+138
+133
+130
+128
+129
+129
+131
+132
+130
+130
+130
+127
+127
+126
+125
+125
+126
+126
+125
+125
+125
+125
+125
+123
+121
+119
+120
+117
+116
+115
+114
+113
+114
+113
+112
+110
+112
+109
+111
+111
+111
+111
+110
+109
+108
+106
+105
+104
+102
+107
+104
+99
+101
+98
+101
+120
+142
+146
+142
+138
+131
+122
+113
+104
+90
+73
+63
+62
+57
+48
+47
+54
+52
+53
+53
+52
+50
+48
+48
+49
+54
+58
+61
+62
+60
+55
+50
+49
+44
+46
+48
+49
+54
+56
+58
+58
+60
+73
+89
+103
+112
+118
+117
+112
+96
+88
+83
+87
+91
+89
+89
+92
+95
+95
+94
+94
+94
+93
+93
+93
+83
+72
+63
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+106
+107
+107
+107
+108
+108
+109
+109
+109
+109
+109
+109
+109
+109
+109
+109
+108
+105
+103
+118
+147
+175
+196
+218
+234
+243
+246
+252
+255
+255
+255
+252
+253
+247
+242
+224
+198
+170
+136
+98
+69
+68
+67
+70
+71
+70
+67
+70
+73
+65
+66
+70
+75
+101
+147
+198
+233
+211
+199
+191
+195
+210
+219
+225
+225
+220
+220
+217
+210
+215
+225
+225
+216
+218
+218
+217
+215
+215
+212
+209
+211
+222
+219
+211
+202
+190
+176
+159
+144
+140
+135
+131
+129
+128
+127
+129
+129
+127
+127
+127
+126
+126
+124
+124
+124
+124
+124
+124
+124
+122
+122
+122
+122
+121
+119
+119
+117
+116
+113
+112
+112
+111
+109
+109
+108
+109
+108
+109
+109
+105
+109
+112
+111
+107
+103
+103
+104
+101
+105
+100
+93
+96
+95
+98
+115
+140
+143
+136
+129
+125
+118
+102
+84
+68
+62
+58
+53
+52
+51
+52
+52
+54
+55
+54
+52
+51
+49
+47
+46
+46
+50
+54
+58
+58
+56
+52
+49
+42
+44
+45
+46
+52
+55
+58
+58
+54
+68
+87
+104
+115
+119
+114
+107
+91
+88
+84
+84
+87
+90
+91
+90
+94
+98
+98
+94
+92
+95
+96
+94
+83
+70
+61
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+108
+108
+109
+109
+109
+109
+109
+109
+109
+109
+109
+109
+108
+103
+111
+134
+164
+193
+214
+234
+247
+247
+248
+252
+254
+255
+255
+255
+255
+255
+251
+237
+215
+192
+164
+130
+103
+76
+71
+69
+71
+72
+73
+76
+75
+66
+71
+81
+96
+124
+166
+207
+232
+255
+234
+201
+188
+199
+213
+219
+216
+213
+210
+215
+219
+218
+212
+214
+221
+217
+217
+218
+218
+217
+214
+212
+212
+220
+219
+211
+203
+191
+177
+160
+146
+140
+135
+131
+129
+128
+127
+129
+129
+127
+127
+127
+126
+125
+124
+124
+124
+124
+124
+124
+124
+122
+123
+123
+122
+119
+117
+117
+115
+114
+110
+111
+109
+109
+108
+108
+108
+108
+106
+108
+108
+107
+110
+111
+110
+108
+105
+103
+101
+99
+100
+95
+94
+98
+94
+96
+112
+129
+135
+135
+126
+114
+100
+81
+62
+58
+54
+53
+51
+52
+52
+53
+55
+55
+55
+55
+53
+52
+49
+47
+47
+46
+49
+52
+56
+57
+56
+52
+52
+46
+46
+46
+45
+50
+52
+56
+57
+55
+68
+87
+104
+116
+119
+112
+103
+89
+87
+84
+84
+86
+89
+89
+89
+91
+95
+95
+92
+91
+94
+94
+94
+82
+70
+59
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+108
+108
+109
+109
+109
+109
+109
+109
+109
+109
+110
+110
+108
+101
+121
+151
+178
+205
+228
+244
+250
+251
+252
+253
+254
+255
+255
+255
+255
+254
+250
+239
+225
+210
+188
+160
+135
+96
+81
+68
+68
+74
+76
+75
+73
+68
+84
+107
+130
+157
+192
+219
+234
+248
+255
+255
+234
+190
+177
+198
+219
+216
+207
+202
+204
+210
+214
+216
+217
+214
+216
+217
+217
+217
+214
+213
+213
+217
+217
+210
+203
+192
+178
+161
+147
+142
+137
+131
+129
+127
+126
+128
+128
+127
+127
+126
+125
+125
+124
+123
+123
+125
+125
+123
+123
+123
+123
+122
+120
+116
+113
+114
+111
+110
+108
+108
+107
+108
+106
+106
+106
+106
+105
+106
+106
+110
+109
+109
+109
+109
+105
+102
+99
+100
+97
+93
+95
+99
+92
+95
+115
+125
+129
+126
+112
+94
+79
+63
+52
+50
+48
+49
+50
+52
+52
+53
+55
+55
+55
+54
+53
+53
+50
+48
+48
+46
+48
+50
+54
+55
+56
+56
+57
+52
+51
+47
+44
+47
+49
+53
+54
+54
+68
+89
+107
+119
+119
+108
+95
+87
+87
+84
+84
+86
+88
+89
+89
+90
+93
+95
+93
+93
+95
+94
+90
+78
+65
+54
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+106
+107
+107
+108
+108
+109
+109
+109
+109
+109
+109
+110
+110
+110
+110
+109
+106
+131
+163
+185
+208
+229
+243
+245
+251
+251
+252
+252
+253
+254
+255
+255
+248
+244
+238
+230
+221
+206
+182
+161
+128
+102
+77
+70
+72
+75
+72
+68
+80
+106
+139
+164
+183
+203
+223
+234
+247
+255
+255
+255
+245
+227
+200
+176
+194
+200
+199
+195
+199
+211
+213
+207
+210
+212
+213
+216
+214
+214
+213
+213
+214
+213
+210
+204
+192
+178
+162
+149
+142
+137
+131
+129
+127
+126
+128
+128
+127
+127
+126
+125
+125
+124
+123
+123
+126
+126
+124
+123
+123
+123
+122
+120
+114
+111
+111
+109
+108
+107
+106
+104
+105
+105
+105
+104
+104
+104
+104
+104
+109
+108
+106
+105
+106
+106
+102
+97
+101
+97
+93
+97
+98
+89
+97
+121
+129
+118
+105
+87
+73
+64
+58
+56
+48
+47
+51
+52
+53
+53
+54
+54
+55
+54
+54
+52
+51
+51
+49
+49
+46
+47
+48
+50
+53
+55
+59
+60
+57
+55
+50
+45
+46
+47
+50
+52
+52
+69
+93
+114
+123
+119
+102
+85
+83
+84
+83
+83
+84
+85
+86
+86
+87
+91
+93
+92
+94
+95
+92
+87
+73
+61
+49
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+105
+106
+107
+107
+108
+108
+109
+109
+109
+109
+109
+109
+110
+110
+111
+111
+110
+113
+135
+164
+183
+205
+227
+242
+244
+248
+250
+251
+253
+252
+250
+249
+246
+246
+243
+240
+238
+233
+222
+202
+182
+157
+125
+89
+71
+70
+70
+67
+65
+98
+133
+170
+192
+203
+213
+230
+241
+249
+250
+251
+255
+255
+255
+233
+182
+164
+178
+192
+199
+197
+190
+193
+202
+203
+206
+209
+210
+211
+211
+211
+211
+211
+210
+208
+201
+189
+175
+160
+149
+142
+137
+131
+129
+127
+126
+127
+127
+126
+126
+126
+125
+124
+123
+123
+123
+124
+124
+124
+123
+122
+121
+121
+119
+110
+109
+108
+108
+107
+104
+104
+104
+105
+104
+104
+103
+103
+103
+103
+104
+107
+104
+102
+103
+105
+104
+101
+98
+99
+98
+95
+93
+93
+86
+98
+123
+116
+97
+78
+65
+61
+59
+57
+57
+51
+51
+53
+54
+54
+55
+53
+52
+54
+52
+51
+51
+51
+50
+49
+49
+46
+46
+47
+48
+51
+54
+58
+60
+61
+58
+53
+48
+48
+47
+49
+49
+50
+71
+98
+119
+124
+113
+92
+74
+79
+81
+81
+81
+81
+81
+83
+83
+87
+91
+93
+93
+95
+95
+90
+82
+65
+54
+43
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+105
+106
+107
+107
+108
+108
+109
+109
+109
+109
+109
+110
+110
+111
+112
+112
+110
+108
+122
+147
+171
+196
+220
+237
+244
+245
+246
+250
+251
+251
+248
+245
+241
+244
+244
+244
+243
+242
+233
+216
+197
+177
+143
+101
+77
+71
+70
+71
+74
+122
+158
+195
+215
+222
+230
+243
+252
+243
+254
+255
+255
+255
+255
+255
+255
+212
+181
+162
+178
+190
+182
+182
+199
+199
+202
+205
+208
+208
+208
+208
+208
+210
+210
+206
+197
+184
+170
+158
+149
+142
+137
+131
+129
+127
+126
+127
+127
+126
+126
+126
+125
+124
+123
+123
+123
+124
+123
+123
+122
+121
+120
+119
+117
+110
+108
+108
+106
+105
+105
+104
+103
+103
+103
+102
+102
+102
+102
+102
+102
+104
+104
+103
+103
+103
+104
+103
+102
+97
+101
+94
+92
+96
+97
+105
+117
+88
+69
+60
+57
+59
+56
+53
+51
+54
+53
+55
+54
+54
+53
+53
+51
+50
+49
+50
+49
+49
+49
+49
+49
+46
+46
+46
+47
+48
+51
+54
+55
+60
+58
+56
+53
+52
+50
+49
+48
+48
+72
+101
+117
+116
+102
+82
+66
+75
+78
+80
+80
+78
+78
+79
+81
+86
+90
+93
+94
+95
+95
+86
+78
+59
+48
+38
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+105
+106
+107
+107
+108
+108
+109
+109
+109
+109
+109
+110
+110
+111
+112
+113
+111
+104
+109
+133
+163
+191
+211
+229
+240
+242
+245
+248
+250
+252
+250
+248
+246
+246
+247
+250
+252
+253
+247
+231
+213
+192
+158
+117
+90
+80
+83
+91
+99
+146
+176
+210
+230
+242
+249
+255
+255
+255
+255
+249
+247
+251
+255
+255
+255
+255
+234
+183
+168
+174
+183
+185
+191
+195
+198
+202
+203
+205
+204
+203
+204
+209
+208
+204
+194
+179
+166
+156
+149
+140
+135
+133
+129
+127
+126
+127
+127
+126
+126
+126
+125
+124
+123
+123
+123
+123
+123
+121
+120
+119
+118
+118
+115
+110
+106
+106
+106
+106
+104
+104
+104
+103
+102
+102
+102
+100
+100
+100
+102
+103
+104
+105
+105
+104
+105
+106
+108
+103
+107
+98
+97
+111
+120
+116
+110
+67
+53
+52
+56
+56
+52
+49
+50
+53
+53
+53
+52
+52
+52
+52
+51
+47
+46
+48
+46
+46
+46
+48
+48
+49
+48
+48
+47
+48
+49
+51
+52
+57
+58
+59
+58
+58
+54
+50
+47
+50
+73
+99
+109
+102
+87
+73
+63
+72
+76
+78
+78
+76
+76
+77
+79
+85
+89
+91
+93
+94
+92
+81
+71
+54
+43
+34
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+103
+105
+106
+106
+106
+108
+108
+109
+109
+109
+109
+108
+109
+110
+111
+110
+111
+109
+107
+109
+131
+165
+195
+213
+230
+244
+244
+247
+249
+250
+252
+252
+252
+253
+251
+254
+255
+255
+255
+255
+239
+221
+193
+162
+124
+98
+88
+93
+109
+124
+165
+187
+215
+235
+250
+255
+255
+254
+253
+250
+250
+251
+250
+244
+247
+255
+255
+255
+250
+188
+157
+171
+183
+177
+192
+198
+201
+202
+202
+201
+199
+200
+207
+205
+199
+188
+173
+159
+149
+145
+138
+132
+130
+129
+127
+126
+128
+128
+126
+126
+126
+125
+124
+123
+123
+123
+122
+122
+120
+119
+118
+117
+117
+113
+109
+107
+106
+106
+105
+105
+105
+104
+103
+102
+103
+102
+102
+102
+102
+102
+102
+106
+109
+107
+106
+106
+109
+111
+108
+111
+100
+99
+122
+134
+121
+98
+62
+51
+52
+55
+52
+47
+50
+57
+51
+50
+50
+48
+49
+50
+52
+52
+46
+44
+47
+45
+47
+47
+47
+47
+49
+48
+48
+47
+47
+47
+48
+48
+55
+57
+60
+61
+59
+56
+50
+45
+50
+74
+99
+104
+93
+79
+70
+65
+72
+75
+78
+78
+75
+74
+76
+78
+84
+87
+90
+91
+93
+90
+78
+67
+50
+41
+31
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+106
+106
+108
+108
+109
+109
+109
+103
+106
+110
+111
+104
+102
+115
+129
+137
+149
+170
+194
+215
+233
+245
+248
+252
+254
+255
+253
+250
+249
+250
+251
+249
+250
+249
+252
+254
+249
+233
+213
+186
+152
+113
+95
+98
+114
+132
+145
+180
+202
+226
+240
+247
+251
+253
+252
+255
+254
+254
+253
+254
+254
+254
+254
+251
+255
+255
+255
+215
+163
+155
+178
+193
+195
+198
+201
+205
+206
+203
+202
+198
+195
+190
+181
+166
+154
+144
+139
+133
+129
+127
+127
+128
+128
+129
+129
+127
+126
+124
+123
+122
+122
+119
+118
+119
+119
+119
+119
+118
+117
+113
+110
+108
+105
+105
+104
+104
+103
+103
+103
+102
+103
+105
+105
+104
+103
+101
+101
+104
+106
+109
+107
+106
+105
+105
+107
+103
+106
+100
+118
+126
+138
+140
+82
+55
+52
+52
+51
+51
+51
+50
+50
+49
+49
+51
+48
+50
+47
+49
+47
+47
+46
+47
+46
+47
+47
+47
+47
+48
+47
+47
+46
+46
+47
+47
+47
+49
+51
+54
+56
+57
+55
+53
+51
+52
+68
+87
+91
+80
+69
+64
+66
+73
+75
+75
+75
+74
+74
+76
+79
+85
+89
+92
+93
+93
+87
+72
+59
+37
+38
+36
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+107
+108
+109
+109
+109
+105
+106
+109
+106
+103
+108
+126
+144
+167
+183
+208
+225
+241
+250
+255
+255
+254
+255
+255
+254
+251
+248
+246
+247
+247
+248
+248
+247
+249
+242
+223
+204
+180
+145
+107
+89
+95
+116
+140
+157
+191
+211
+231
+243
+247
+251
+252
+251
+254
+254
+254
+254
+254
+254
+254
+251
+241
+237
+247
+255
+255
+239
+196
+164
+176
+186
+193
+196
+194
+188
+190
+196
+196
+195
+191
+180
+166
+153
+144
+138
+130
+127
+126
+124
+126
+127
+128
+128
+125
+125
+122
+122
+121
+120
+118
+118
+117
+118
+116
+116
+116
+114
+111
+109
+108
+105
+106
+104
+105
+104
+103
+103
+101
+101
+103
+104
+106
+106
+106
+107
+107
+108
+107
+107
+107
+106
+106
+105
+103
+107
+103
+117
+129
+140
+134
+75
+54
+51
+51
+51
+50
+50
+50
+49
+49
+49
+49
+48
+48
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+48
+47
+46
+46
+46
+46
+47
+47
+46
+47
+49
+52
+54
+54
+54
+53
+54
+67
+80
+82
+73
+65
+66
+69
+74
+74
+75
+75
+73
+72
+73
+74
+83
+88
+92
+93
+91
+84
+67
+54
+38
+39
+37
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+107
+108
+109
+109
+109
+109
+107
+109
+106
+107
+119
+145
+167
+190
+209
+235
+246
+253
+254
+255
+255
+254
+255
+255
+253
+250
+245
+241
+241
+244
+245
+246
+245
+245
+238
+219
+201
+176
+147
+117
+107
+116
+136
+159
+174
+205
+222
+239
+248
+251
+254
+254
+253
+254
+254
+254
+254
+254
+254
+254
+253
+245
+251
+254
+255
+255
+255
+248
+215
+147
+164
+168
+167
+183
+207
+206
+189
+196
+198
+195
+185
+170
+157
+149
+144
+134
+129
+126
+123
+122
+122
+122
+122
+120
+120
+119
+119
+117
+116
+116
+116
+114
+114
+114
+114
+111
+110
+108
+107
+108
+106
+108
+106
+107
+105
+105
+104
+103
+103
+102
+103
+104
+105
+107
+107
+108
+106
+105
+104
+107
+106
+105
+102
+102
+108
+106
+117
+134
+145
+128
+69
+53
+50
+50
+50
+49
+49
+49
+48
+49
+49
+49
+48
+48
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+46
+45
+45
+46
+47
+46
+43
+43
+45
+47
+50
+52
+54
+55
+56
+63
+69
+67
+59
+56
+62
+68
+74
+74
+76
+75
+73
+71
+70
+71
+82
+88
+93
+94
+90
+80
+61
+46
+38
+39
+37
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+107
+108
+109
+109
+109
+110
+108
+108
+108
+112
+128
+158
+185
+195
+218
+244
+250
+251
+251
+253
+251
+255
+255
+255
+251
+245
+238
+233
+231
+237
+240
+241
+241
+242
+234
+216
+199
+178
+161
+145
+144
+156
+170
+182
+192
+220
+233
+246
+251
+253
+255
+255
+253
+254
+254
+254
+254
+254
+254
+254
+254
+251
+255
+255
+245
+246
+255
+255
+255
+232
+183
+148
+163
+185
+184
+180
+190
+193
+198
+197
+188
+173
+161
+152
+149
+139
+133
+128
+124
+121
+119
+117
+118
+118
+118
+118
+117
+115
+114
+114
+113
+111
+111
+111
+110
+107
+106
+106
+105
+109
+110
+109
+108
+108
+107
+105
+105
+108
+106
+104
+102
+102
+102
+104
+102
+106
+102
+101
+102
+104
+105
+102
+99
+99
+104
+105
+115
+133
+143
+112
+57
+52
+50
+49
+49
+49
+48
+48
+48
+49
+49
+49
+48
+48
+47
+47
+47
+46
+46
+46
+46
+46
+46
+46
+46
+46
+46
+45
+45
+45
+45
+46
+45
+42
+41
+42
+43
+46
+49
+52
+53
+54
+58
+60
+56
+50
+50
+56
+62
+68
+69
+75
+74
+75
+71
+72
+70
+83
+88
+96
+94
+90
+76
+57
+41
+38
+37
+35
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+107
+108
+109
+109
+109
+108
+107
+110
+111
+116
+133
+164
+191
+205
+229
+251
+251
+250
+252
+255
+253
+255
+255
+254
+247
+239
+231
+224
+222
+231
+234
+237
+236
+238
+232
+218
+204
+194
+183
+177
+182
+193
+201
+210
+217
+232
+242
+250
+252
+253
+255
+255
+252
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+250
+248
+252
+254
+254
+253
+255
+245
+196
+157
+151
+165
+180
+186
+189
+196
+195
+188
+176
+166
+157
+152
+143
+137
+130
+124
+119
+115
+114
+115
+113
+115
+115
+114
+114
+114
+112
+111
+110
+109
+108
+107
+106
+105
+105
+106
+110
+112
+112
+109
+109
+108
+105
+105
+108
+107
+104
+101
+101
+101
+101
+100
+102
+99
+99
+100
+100
+100
+98
+95
+94
+101
+106
+114
+132
+132
+91
+51
+50
+50
+49
+49
+49
+48
+48
+48
+49
+49
+49
+48
+48
+47
+47
+47
+46
+46
+46
+46
+46
+46
+46
+46
+45
+45
+44
+44
+44
+44
+45
+44
+44
+43
+42
+42
+43
+46
+48
+50
+50
+53
+54
+53
+49
+49
+53
+56
+61
+64
+70
+72
+74
+73
+75
+75
+84
+91
+99
+97
+89
+74
+54
+38
+36
+36
+34
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+107
+108
+109
+109
+108
+106
+107
+108
+111
+115
+129
+159
+184
+213
+236
+251
+251
+250
+253
+255
+253
+255
+255
+252
+243
+235
+227
+221
+220
+228
+231
+233
+234
+235
+232
+223
+211
+211
+204
+203
+208
+215
+224
+234
+240
+243
+249
+253
+253
+253
+255
+254
+252
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+253
+254
+249
+246
+237
+240
+235
+255
+255
+204
+163
+161
+170
+173
+182
+188
+189
+185
+178
+169
+161
+153
+149
+142
+133
+125
+120
+115
+112
+112
+112
+113
+113
+113
+113
+112
+111
+111
+111
+110
+109
+107
+104
+104
+104
+108
+111
+113
+112
+112
+109
+108
+106
+105
+104
+103
+101
+101
+100
+101
+102
+100
+94
+97
+99
+100
+99
+96
+93
+93
+93
+98
+109
+115
+128
+118
+70
+52
+51
+50
+50
+50
+49
+49
+49
+48
+49
+49
+49
+48
+48
+47
+47
+47
+45
+45
+45
+45
+45
+45
+45
+45
+45
+44
+43
+43
+43
+43
+44
+44
+46
+44
+42
+42
+42
+43
+45
+46
+45
+48
+52
+53
+52
+51
+51
+51
+55
+57
+64
+66
+71
+72
+77
+77
+85
+92
+100
+96
+88
+71
+52
+36
+36
+36
+34
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+106
+106
+107
+108
+109
+108
+108
+108
+108
+107
+107
+108
+121
+149
+174
+209
+233
+251
+248
+248
+254
+255
+249
+255
+254
+249
+241
+233
+227
+223
+224
+228
+231
+232
+231
+232
+231
+224
+215
+218
+217
+222
+230
+238
+243
+250
+255
+250
+254
+255
+253
+253
+255
+255
+252
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+252
+245
+234
+234
+242
+245
+239
+255
+255
+242
+171
+143
+170
+175
+179
+179
+179
+177
+172
+162
+154
+150
+143
+136
+129
+122
+117
+113
+113
+112
+113
+113
+113
+113
+113
+112
+112
+113
+112
+110
+108
+105
+106
+106
+110
+111
+114
+112
+112
+110
+108
+106
+105
+100
+100
+99
+100
+100
+99
+99
+95
+90
+95
+103
+104
+99
+94
+91
+92
+93
+93
+110
+116
+124
+99
+50
+54
+51
+51
+51
+51
+50
+50
+50
+49
+49
+49
+49
+48
+48
+47
+47
+47
+45
+45
+45
+45
+45
+45
+45
+45
+44
+44
+43
+42
+42
+43
+44
+43
+45
+43
+42
+42
+43
+43
+44
+45
+44
+47
+50
+54
+55
+55
+53
+52
+50
+52
+58
+61
+65
+68
+74
+76
+84
+92
+99
+94
+85
+68
+50
+35
+38
+38
+36
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+104
+106
+106
+106
+107
+108
+109
+108
+108
+111
+109
+106
+103
+102
+114
+142
+168
+201
+226
+247
+246
+249
+254
+255
+249
+255
+253
+248
+240
+233
+229
+227
+229
+230
+233
+234
+232
+232
+232
+225
+216
+216
+221
+234
+248
+255
+255
+255
+255
+254
+255
+255
+254
+254
+255
+255
+253
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+251
+247
+245
+243
+240
+237
+240
+251
+255
+255
+255
+255
+216
+170
+164
+169
+168
+169
+173
+169
+161
+151
+149
+143
+137
+131
+125
+119
+116
+115
+113
+113
+115
+113
+113
+113
+113
+112
+115
+113
+111
+109
+108
+106
+109
+111
+111
+113
+111
+109
+109
+105
+104
+102
+102
+100
+100
+98
+96
+93
+92
+87
+84
+91
+102
+105
+98
+90
+90
+92
+90
+88
+107
+115
+117
+85
+38
+56
+51
+52
+52
+51
+51
+51
+50
+50
+49
+49
+49
+48
+48
+47
+47
+47
+45
+45
+45
+45
+45
+45
+45
+45
+44
+43
+43
+42
+42
+43
+43
+44
+43
+41
+42
+43
+43
+44
+45
+45
+44
+46
+50
+54
+57
+57
+55
+54
+48
+50
+53
+57
+60
+64
+70
+74
+82
+91
+97
+92
+81
+66
+47
+34
+42
+40
+38
+104
+104
+104
+104
+104
+104
+104
+104
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+108
+109
+110
+109
+109
+113
+107
+107
+107
+106
+112
+135
+159
+187
+208
+234
+246
+252
+254
+255
+254
+255
+254
+250
+246
+244
+240
+234
+231
+240
+237
+235
+236
+232
+225
+221
+222
+224
+231
+241
+249
+253
+255
+255
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+254
+252
+250
+249
+249
+254
+254
+254
+255
+255
+255
+255
+255
+182
+162
+147
+155
+165
+160
+154
+155
+142
+141
+135
+128
+121
+116
+115
+115
+114
+114
+116
+115
+117
+117
+116
+113
+115
+113
+113
+113
+112
+110
+111
+111
+107
+109
+108
+108
+108
+104
+103
+99
+99
+94
+100
+99
+84
+78
+77
+64
+87
+80
+75
+79
+93
+105
+101
+86
+88
+93
+111
+122
+100
+61
+45
+50
+52
+53
+52
+52
+52
+51
+51
+51
+51
+51
+51
+50
+49
+49
+49
+48
+49
+49
+48
+48
+47
+47
+47
+47
+44
+44
+44
+44
+44
+44
+43
+43
+46
+45
+45
+44
+45
+45
+46
+46
+43
+45
+48
+53
+57
+61
+63
+63
+55
+53
+51
+49
+50
+57
+66
+73
+79
+86
+93
+89
+76
+60
+47
+41
+42
+41
+40
+104
+104
+104
+104
+104
+104
+104
+104
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+107
+108
+109
+110
+109
+107
+111
+106
+107
+107
+106
+113
+137
+163
+190
+210
+235
+247
+253
+254
+255
+254
+255
+254
+251
+247
+244
+240
+234
+232
+234
+230
+228
+230
+227
+223
+222
+223
+230
+236
+245
+250
+255
+255
+255
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+253
+250
+250
+253
+253
+253
+253
+255
+255
+255
+255
+255
+255
+255
+255
+254
+255
+255
+217
+163
+142
+146
+152
+152
+150
+138
+137
+135
+131
+126
+122
+118
+115
+117
+115
+117
+117
+116
+111
+112
+115
+113
+112
+112
+110
+111
+109
+110
+109
+107
+108
+109
+107
+106
+103
+101
+98
+100
+91
+94
+94
+78
+70
+71
+62
+76
+71
+68
+68
+77
+92
+98
+96
+89
+100
+115
+115
+88
+58
+47
+55
+54
+54
+54
+54
+53
+53
+53
+53
+53
+53
+53
+52
+52
+51
+51
+51
+50
+50
+50
+49
+49
+49
+48
+48
+46
+46
+45
+45
+44
+44
+43
+43
+42
+42
+41
+41
+41
+42
+43
+44
+46
+45
+46
+48
+52
+57
+63
+66
+59
+58
+55
+52
+51
+54
+60
+64
+76
+83
+89
+87
+76
+61
+49
+43
+44
+43
+42
+104
+104
+104
+104
+104
+104
+104
+104
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+108
+109
+109
+110
+109
+107
+109
+105
+106
+107
+105
+113
+138
+165
+191
+212
+237
+247
+252
+253
+255
+254
+255
+253
+250
+247
+244
+239
+231
+229
+226
+222
+221
+222
+222
+221
+224
+228
+237
+242
+249
+254
+255
+255
+255
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+253
+246
+246
+250
+253
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+250
+250
+254
+255
+255
+223
+168
+132
+131
+145
+148
+139
+127
+118
+117
+118
+121
+120
+113
+110
+113
+116
+115
+111
+113
+120
+110
+109
+109
+107
+108
+106
+108
+106
+103
+103
+103
+103
+101
+99
+96
+94
+98
+85
+90
+96
+82
+67
+69
+70
+65
+66
+65
+60
+63
+78
+95
+105
+97
+110
+118
+103
+74
+52
+52
+61
+56
+56
+56
+56
+55
+55
+55
+54
+56
+56
+55
+55
+55
+54
+54
+54
+53
+52
+52
+52
+51
+51
+51
+50
+48
+48
+47
+46
+45
+44
+43
+43
+41
+41
+41
+41
+41
+42
+43
+44
+49
+47
+44
+44
+47
+54
+61
+65
+64
+62
+60
+56
+52
+50
+51
+53
+68
+75
+81
+81
+72
+60
+50
+46
+46
+46
+45
+103
+103
+104
+104
+104
+104
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+107
+107
+108
+109
+109
+109
+109
+106
+107
+105
+106
+106
+104
+109
+136
+166
+191
+211
+235
+246
+252
+253
+255
+255
+254
+253
+250
+247
+244
+238
+229
+226
+219
+215
+214
+217
+221
+222
+229
+236
+247
+250
+255
+255
+255
+255
+255
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+253
+247
+247
+250
+253
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+250
+250
+255
+255
+253
+255
+255
+238
+176
+118
+117
+117
+119
+123
+125
+120
+107
+98
+123
+115
+113
+115
+111
+103
+100
+103
+105
+105
+105
+103
+102
+102
+102
+101
+98
+98
+96
+95
+95
+91
+90
+87
+88
+79
+92
+111
+99
+77
+73
+73
+62
+63
+64
+60
+60
+70
+88
+100
+109
+120
+116
+91
+64
+54
+56
+60
+57
+57
+57
+56
+56
+55
+55
+55
+57
+56
+56
+56
+56
+56
+56
+56
+55
+55
+55
+54
+54
+54
+53
+53
+51
+51
+49
+48
+47
+45
+44
+44
+43
+43
+42
+42
+43
+44
+45
+45
+48
+46
+43
+43
+45
+50
+56
+59
+64
+64
+64
+61
+56
+51
+49
+48
+60
+66
+72
+73
+68
+59
+50
+46
+45
+47
+46
+103
+103
+103
+104
+104
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+105
+107
+108
+108
+109
+109
+109
+109
+106
+107
+105
+105
+103
+100
+106
+133
+163
+189
+210
+234
+244
+251
+253
+255
+255
+255
+255
+254
+251
+247
+240
+230
+226
+217
+213
+210
+212
+218
+224
+234
+244
+253
+255
+255
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+253
+250
+250
+252
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+253
+252
+244
+255
+255
+255
+255
+255
+246
+228
+208
+183
+146
+118
+104
+104
+109
+112
+108
+105
+103
+106
+110
+110
+111
+111
+101
+99
+99
+99
+99
+99
+98
+96
+93
+92
+92
+90
+90
+87
+84
+82
+80
+78
+102
+126
+114
+86
+74
+71
+60
+60
+63
+65
+65
+68
+77
+84
+120
+123
+110
+85
+67
+63
+62
+58
+59
+57
+57
+56
+56
+55
+55
+55
+56
+56
+56
+56
+56
+56
+56
+56
+57
+57
+57
+56
+56
+56
+55
+55
+54
+53
+52
+51
+50
+48
+47
+47
+45
+45
+44
+43
+43
+44
+45
+45
+44
+44
+44
+44
+46
+48
+51
+52
+59
+61
+64
+64
+60
+55
+52
+50
+54
+58
+64
+66
+63
+56
+49
+45
+45
+46
+45
+102
+102
+103
+104
+104
+105
+106
+106
+105
+105
+105
+105
+105
+105
+105
+105
+108
+108
+108
+109
+109
+109
+109
+106
+107
+105
+105
+103
+98
+103
+130
+163
+192
+212
+235
+245
+251
+253
+255
+255
+255
+255
+255
+255
+250
+242
+231
+226
+215
+209
+205
+206
+214
+222
+236
+247
+255
+255
+255
+255
+255
+253
+253
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+253
+254
+254
+254
+254
+254
+253
+253
+251
+252
+254
+255
+255
+254
+254
+254
+251
+255
+254
+249
+253
+255
+255
+255
+255
+252
+242
+226
+205
+179
+155
+140
+122
+125
+116
+97
+87
+89
+91
+88
+96
+96
+96
+95
+96
+96
+96
+93
+92
+92
+92
+89
+88
+85
+82
+81
+78
+81
+105
+124
+109
+83
+70
+62
+60
+60
+63
+68
+69
+68
+72
+76
+121
+116
+102
+84
+76
+75
+70
+60
+60
+57
+57
+57
+56
+56
+56
+56
+55
+55
+56
+56
+56
+56
+57
+57
+58
+58
+58
+58
+57
+57
+57
+56
+56
+56
+55
+54
+53
+52
+51
+51
+47
+46
+45
+44
+43
+43
+43
+43
+43
+44
+45
+46
+47
+47
+47
+45
+51
+55
+61
+64
+63
+60
+57
+56
+53
+56
+60
+62
+60
+55
+49
+45
+44
+46
+45
+102
+102
+103
+104
+104
+105
+106
+106
+105
+105
+105
+105
+105
+105
+105
+105
+108
+108
+108
+109
+109
+109
+109
+106
+106
+104
+104
+102
+99
+104
+133
+165
+199
+218
+240
+248
+252
+253
+255
+255
+255
+255
+255
+252
+248
+239
+226
+221
+213
+206
+201
+202
+208
+218
+233
+246
+255
+255
+255
+255
+254
+252
+251
+252
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+253
+250
+247
+246
+245
+243
+245
+250
+253
+255
+255
+255
+255
+252
+254
+255
+255
+255
+252
+248
+245
+255
+255
+255
+255
+255
+255
+251
+248
+249
+255
+227
+165
+116
+101
+98
+92
+94
+92
+92
+93
+93
+94
+94
+92
+89
+87
+87
+86
+85
+83
+80
+78
+77
+80
+96
+102
+85
+69
+65
+60
+63
+63
+67
+72
+72
+70
+79
+89
+113
+106
+97
+91
+89
+84
+77
+66
+61
+59
+59
+59
+58
+58
+58
+57
+56
+56
+56
+57
+57
+58
+58
+58
+59
+59
+59
+58
+58
+57
+57
+57
+58
+58
+57
+57
+56
+56
+55
+55
+52
+50
+49
+47
+45
+44
+43
+43
+44
+44
+45
+46
+46
+46
+45
+43
+43
+47
+54
+59
+61
+60
+58
+58
+53
+55
+58
+60
+58
+54
+48
+45
+45
+46
+45
+99
+99
+100
+101
+101
+104
+105
+105
+104
+105
+105
+105
+105
+105
+105
+107
+107
+107
+108
+108
+109
+109
+107
+106
+105
+104
+104
+103
+100
+106
+137
+170
+205
+223
+242
+250
+251
+253
+254
+254
+250
+250
+250
+248
+244
+234
+223
+217
+211
+204
+197
+198
+204
+214
+230
+244
+253
+254
+255
+254
+253
+252
+251
+252
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+255
+254
+252
+249
+246
+244
+243
+242
+245
+250
+254
+255
+255
+255
+255
+255
+255
+255
+255
+253
+251
+250
+252
+244
+244
+247
+247
+248
+251
+255
+255
+253
+255
+236
+158
+96
+82
+88
+88
+91
+91
+90
+90
+91
+91
+92
+91
+85
+84
+84
+81
+80
+78
+75
+73
+74
+76
+83
+80
+64
+59
+65
+63
+67
+68
+72
+76
+73
+74
+89
+107
+102
+98
+94
+95
+96
+90
+83
+76
+65
+64
+64
+62
+62
+62
+61
+61
+57
+57
+57
+58
+58
+58
+58
+58
+59
+59
+59
+58
+58
+57
+57
+57
+59
+59
+59
+59
+58
+58
+58
+58
+56
+55
+52
+51
+49
+47
+46
+46
+46
+46
+44
+44
+43
+43
+44
+41
+36
+41
+50
+56
+59
+59
+59
+59
+56
+57
+59
+60
+60
+55
+49
+46
+46
+47
+46
+92
+93
+95
+96
+98
+101
+103
+104
+102
+104
+104
+104
+106
+107
+107
+108
+107
+106
+109
+108
+109
+106
+104
+102
+102
+103
+102
+98
+99
+114
+150
+185
+209
+224
+240
+247
+247
+250
+252
+252
+248
+250
+249
+243
+239
+236
+224
+214
+216
+203
+188
+188
+195
+205
+219
+233
+250
+253
+254
+255
+254
+252
+251
+252
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+253
+253
+254
+254
+251
+249
+253
+251
+253
+255
+255
+255
+255
+255
+255
+255
+254
+254
+254
+251
+251
+250
+252
+252
+255
+255
+255
+255
+255
+255
+251
+255
+233
+145
+86
+88
+85
+83
+87
+87
+85
+85
+84
+84
+84
+83
+81
+82
+80
+80
+77
+75
+72
+71
+74
+70
+65
+61
+62
+68
+70
+68
+77
+75
+70
+67
+79
+94
+96
+90
+89
+91
+95
+95
+95
+92
+88
+85
+75
+71
+68
+65
+64
+62
+63
+63
+60
+58
+58
+57
+57
+55
+55
+55
+58
+57
+57
+56
+56
+57
+57
+58
+58
+58
+57
+58
+59
+60
+61
+62
+56
+55
+55
+55
+53
+51
+50
+49
+46
+47
+45
+45
+46
+48
+54
+55
+59
+59
+60
+59
+59
+60
+61
+61
+58
+63
+68
+68
+67
+64
+55
+46
+45
+44
+41
+89
+90
+92
+93
+97
+98
+103
+103
+103
+103
+105
+105
+107
+108
+109
+109
+108
+106
+107
+108
+107
+106
+104
+101
+104
+103
+103
+102
+106
+121
+156
+186
+208
+224
+240
+246
+249
+249
+251
+249
+249
+248
+246
+238
+235
+230
+221
+210
+203
+193
+184
+187
+194
+205
+219
+228
+251
+253
+254
+255
+254
+252
+252
+252
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+253
+253
+255
+255
+254
+253
+255
+255
+255
+254
+245
+238
+244
+250
+255
+254
+253
+254
+252
+251
+251
+250
+252
+252
+255
+254
+255
+255
+255
+255
+248
+254
+229
+141
+83
+84
+82
+81
+85
+85
+84
+84
+83
+83
+81
+81
+81
+79
+80
+78
+77
+74
+72
+69
+71
+69
+65
+63
+66
+70
+74
+74
+75
+75
+82
+89
+93
+87
+83
+83
+85
+86
+90
+91
+92
+92
+90
+89
+82
+80
+75
+72
+67
+65
+66
+63
+61
+58
+58
+57
+55
+55
+54
+54
+58
+57
+57
+56
+56
+57
+57
+58
+58
+58
+58
+58
+59
+60
+61
+60
+61
+60
+60
+60
+60
+58
+57
+56
+55
+52
+51
+48
+51
+57
+66
+71
+79
+76
+76
+70
+66
+60
+59
+58
+61
+68
+74
+76
+75
+72
+60
+51
+43
+43
+40
+89
+90
+92
+94
+97
+99
+103
+104
+105
+105
+107
+107
+108
+109
+110
+110
+108
+107
+107
+107
+107
+106
+104
+101
+104
+101
+100
+103
+111
+127
+157
+182
+204
+221
+239
+246
+249
+248
+248
+245
+244
+241
+236
+226
+222
+216
+208
+199
+192
+188
+187
+194
+204
+215
+227
+234
+251
+253
+254
+254
+253
+252
+252
+253
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+254
+252
+253
+254
+255
+254
+253
+255
+255
+255
+249
+232
+223
+234
+246
+255
+254
+253
+254
+252
+251
+251
+250
+252
+252
+255
+254
+255
+255
+255
+255
+249
+254
+228
+138
+80
+82
+82
+82
+84
+85
+84
+85
+84
+83
+81
+80
+81
+79
+80
+77
+77
+74
+73
+70
+72
+69
+67
+66
+70
+73
+79
+81
+80
+85
+103
+119
+112
+88
+76
+78
+80
+81
+84
+85
+87
+88
+91
+92
+89
+86
+81
+77
+71
+68
+67
+63
+61
+58
+58
+57
+55
+55
+54
+54
+58
+58
+57
+57
+57
+57
+58
+58
+58
+58
+58
+58
+59
+60
+62
+60
+64
+63
+64
+64
+65
+63
+63
+62
+62
+57
+54
+52
+57
+66
+80
+88
+94
+91
+87
+77
+67
+57
+54
+52
+60
+69
+77
+82
+82
+78
+65
+56
+47
+47
+44
+89
+90
+92
+94
+98
+100
+104
+105
+107
+107
+109
+108
+110
+110
+111
+111
+109
+107
+107
+107
+106
+106
+104
+102
+102
+97
+95
+100
+112
+127
+151
+171
+199
+217
+237
+245
+248
+245
+243
+238
+234
+228
+221
+212
+208
+202
+195
+189
+196
+198
+203
+213
+224
+234
+244
+248
+252
+253
+254
+254
+253
+251
+252
+253
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+253
+251
+252
+254
+255
+254
+253
+254
+255
+255
+250
+234
+227
+239
+251
+255
+254
+253
+254
+252
+251
+251
+250
+252
+252
+255
+254
+255
+255
+255
+255
+252
+255
+228
+137
+80
+82
+84
+84
+84
+85
+85
+85
+84
+83
+80
+79
+81
+79
+79
+76
+76
+74
+74
+71
+74
+71
+70
+72
+76
+78
+85
+91
+103
+115
+135
+144
+133
+110
+90
+82
+79
+78
+80
+79
+82
+85
+89
+91
+90
+88
+84
+80
+74
+71
+69
+65
+61
+58
+58
+57
+55
+55
+54
+54
+59
+58
+57
+57
+57
+57
+58
+59
+59
+58
+58
+59
+59
+61
+62
+61
+61
+60
+62
+62
+64
+63
+63
+63
+61
+57
+54
+52
+57
+68
+82
+91
+89
+87
+84
+73
+62
+51
+48
+46
+54
+64
+75
+82
+83
+79
+65
+54
+49
+48
+45
+89
+90
+92
+94
+98
+100
+105
+106
+109
+108
+110
+109
+110
+110
+112
+111
+109
+107
+106
+106
+105
+105
+104
+102
+103
+97
+94
+100
+112
+125
+145
+161
+194
+214
+234
+243
+245
+242
+239
+233
+227
+218
+211
+204
+201
+195
+190
+187
+202
+209
+218
+229
+238
+248
+255
+255
+252
+253
+253
+253
+252
+251
+252
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+255
+252
+251
+252
+254
+255
+254
+253
+254
+254
+255
+254
+245
+239
+247
+254
+255
+254
+253
+254
+252
+251
+251
+250
+251
+251
+254
+254
+255
+255
+255
+255
+254
+255
+229
+138
+81
+84
+86
+87
+84
+85
+86
+86
+85
+83
+79
+78
+81
+79
+79
+76
+76
+74
+74
+73
+76
+73
+74
+78
+81
+82
+91
+99
+129
+146
+161
+157
+148
+138
+115
+90
+80
+78
+78
+76
+78
+81
+86
+88
+88
+86
+83
+80
+76
+73
+71
+67
+61
+58
+58
+57
+55
+55
+54
+54
+59
+59
+58
+57
+57
+58
+59
+59
+59
+59
+59
+59
+60
+61
+62
+61
+59
+58
+60
+60
+62
+61
+62
+61
+58
+55
+53
+52
+57
+66
+78
+85
+83
+81
+79
+69
+57
+46
+44
+44
+49
+60
+73
+80
+82
+78
+63
+52
+43
+43
+40
+47
+47
+48
+49
+49
+49
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+50
+49
+49
+48
+48
+49
+49
+50
+48
+48
+48
+48
+48
+48
+48
+48
+46
+46
+46
+45
+45
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+45
+42
+44
+44
+45
+46
+47
+48
+48
+51
+51
+52
+53
+53
+54
+55
+55
+58
+60
+62
+64
+65
+66
+67
+67
+68
+68
+67
+66
+67
+67
+68
+69
+63
+63
+64
+66
+69
+72
+71
+70
+71
+71
+69
+71
+71
+71
+72
+69
+70
+67
+68
+69
+67
+66
+62
+61
+59
+58
+58
+60
+63
+64
+63
+65
+61
+64
+64
+63
+63
+64
+63
+64
+64
+65
+65
+66
+64
+65
+64
+65
+62
+63
+63
+62
+62
+61
+60
+60
+63
+63
+61
+61
+61
+62
+63
+64
+63
+62
+61
+63
+66
+68
+68
+68
+63
+65
+70
+72
+72
+65
+56
+51
+53
+53
+53
+51
+49
+48
+48
+48
+50
+50
+50
+49
+49
+48
+48
+49
+47
+48
+47
+47
+47
+47
+46
+46
+44
+43
+42
+41
+40
+46
+54
+58
+66
+73
+77
+79
+87
+100
+111
+116
+123
+127
+134
+136
+121
+97
+75
+68
+74
+71
+72
+81
+100
+125
+145
+158
+169
+168
+160
+146
+124
+103
+87
+78
+82
+81
+81
+47
+47
+48
+48
+48
+49
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+49
+49
+48
+48
+48
+48
+49
+49
+48
+48
+48
+48
+48
+48
+48
+48
+46
+46
+45
+45
+45
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+46
+43
+45
+45
+46
+47
+48
+49
+49
+51
+51
+52
+52
+53
+54
+55
+55
+57
+59
+61
+63
+64
+65
+66
+66
+67
+67
+65
+65
+65
+66
+67
+68
+62
+63
+65
+67
+68
+69
+69
+67
+67
+65
+65
+66
+68
+69
+70
+67
+69
+66
+67
+68
+68
+66
+64
+63
+59
+58
+58
+60
+63
+65
+64
+64
+62
+64
+63
+63
+63
+63
+63
+64
+64
+64
+65
+65
+64
+65
+64
+65
+62
+63
+62
+62
+62
+61
+60
+60
+63
+62
+61
+61
+61
+62
+63
+64
+64
+62
+62
+62
+65
+68
+67
+68
+65
+67
+70
+73
+71
+64
+57
+52
+54
+54
+53
+52
+50
+49
+49
+49
+50
+50
+50
+49
+49
+48
+48
+49
+47
+48
+47
+47
+47
+47
+46
+46
+45
+44
+42
+41
+41
+45
+52
+56
+62
+69
+74
+78
+84
+97
+108
+114
+123
+128
+133
+132
+117
+91
+72
+67
+70
+71
+72
+78
+89
+111
+135
+153
+158
+160
+157
+145
+127
+107
+91
+83
+83
+82
+81
+46
+46
+47
+48
+48
+48
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+49
+48
+47
+47
+47
+47
+48
+49
+48
+48
+48
+48
+48
+48
+48
+48
+46
+45
+45
+45
+44
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+46
+45
+46
+47
+48
+48
+49
+49
+50
+51
+51
+51
+52
+53
+54
+54
+55
+56
+58
+60
+62
+63
+64
+64
+64
+64
+64
+63
+63
+63
+64
+65
+66
+65
+65
+66
+67
+67
+67
+66
+65
+60
+58
+59
+61
+64
+68
+70
+68
+67
+64
+66
+66
+68
+67
+65
+63
+59
+58
+59
+61
+64
+65
+64
+64
+61
+64
+64
+63
+63
+63
+62
+64
+63
+64
+64
+65
+65
+63
+64
+64
+62
+62
+62
+62
+61
+61
+61
+61
+62
+62
+60
+60
+61
+61
+63
+63
+65
+63
+62
+62
+65
+67
+68
+67
+68
+70
+73
+74
+71
+64
+58
+53
+55
+55
+54
+52
+52
+51
+50
+50
+50
+50
+50
+49
+50
+49
+49
+49
+48
+49
+48
+48
+47
+47
+47
+46
+47
+46
+44
+42
+42
+45
+50
+53
+57
+63
+69
+73
+79
+91
+102
+109
+119
+125
+130
+126
+109
+86
+69
+65
+65
+70
+72
+72
+75
+91
+116
+137
+140
+143
+144
+138
+122
+105
+91
+83
+85
+84
+83
+45
+46
+46
+47
+47
+48
+48
+48
+49
+49
+49
+49
+49
+49
+49
+49
+47
+47
+46
+46
+46
+46
+47
+47
+48
+48
+48
+48
+48
+48
+48
+48
+45
+45
+45
+44
+44
+44
+43
+43
+46
+46
+46
+46
+46
+46
+46
+47
+48
+48
+48
+49
+49
+50
+50
+50
+50
+50
+51
+52
+53
+53
+54
+54
+55
+57
+58
+60
+61
+61
+62
+62
+61
+62
+60
+61
+61
+62
+64
+65
+68
+69
+68
+68
+68
+66
+65
+63
+57
+57
+57
+60
+64
+69
+72
+70
+68
+65
+66
+68
+67
+66
+64
+63
+59
+58
+59
+62
+65
+66
+64
+64
+61
+64
+64
+64
+62
+63
+63
+63
+64
+63
+64
+64
+64
+64
+64
+63
+62
+62
+62
+61
+61
+61
+60
+60
+61
+61
+60
+60
+60
+62
+62
+63
+65
+63
+62
+64
+66
+67
+67
+66
+70
+74
+76
+75
+70
+64
+58
+55
+56
+57
+55
+55
+53
+52
+51
+51
+50
+50
+50
+50
+50
+49
+49
+50
+50
+50
+49
+49
+48
+48
+48
+48
+49
+48
+47
+44
+43
+44
+48
+50
+55
+59
+65
+69
+72
+82
+95
+105
+115
+121
+125
+119
+102
+82
+69
+64
+64
+69
+70
+67
+66
+76
+94
+110
+121
+125
+128
+122
+111
+98
+89
+84
+87
+86
+86
+45
+45
+45
+46
+47
+48
+47
+48
+47
+47
+47
+47
+47
+47
+47
+47
+47
+47
+46
+46
+46
+46
+47
+47
+48
+48
+48
+48
+48
+48
+48
+48
+46
+46
+45
+45
+45
+44
+44
+44
+47
+47
+47
+47
+47
+47
+47
+47
+49
+49
+49
+49
+49
+50
+50
+50
+50
+50
+51
+51
+52
+53
+54
+54
+53
+54
+56
+57
+58
+59
+59
+59
+58
+58
+58
+59
+60
+61
+62
+64
+71
+72
+71
+70
+69
+68
+66
+62
+59
+58
+58
+61
+66
+70
+74
+73
+71
+68
+68
+69
+66
+65
+61
+60
+58
+58
+60
+63
+66
+67
+65
+63
+63
+63
+63
+63
+62
+62
+62
+63
+62
+63
+63
+63
+63
+63
+62
+62
+62
+63
+62
+62
+62
+61
+61
+61
+61
+61
+61
+61
+60
+62
+62
+63
+66
+65
+64
+64
+65
+67
+66
+65
+67
+72
+76
+74
+69
+62
+57
+53
+57
+56
+55
+54
+53
+52
+52
+51
+50
+51
+51
+51
+50
+50
+50
+50
+50
+50
+50
+50
+49
+49
+48
+48
+50
+49
+49
+46
+44
+43
+46
+47
+53
+57
+61
+64
+66
+75
+90
+103
+112
+120
+123
+115
+100
+84
+71
+66
+65
+66
+65
+65
+66
+70
+75
+80
+99
+102
+105
+102
+96
+91
+88
+88
+89
+87
+87
+44
+44
+45
+45
+46
+47
+47
+47
+46
+46
+46
+46
+46
+46
+46
+45
+46
+46
+45
+44
+44
+45
+46
+46
+46
+46
+46
+46
+46
+46
+46
+46
+45
+45
+45
+45
+44
+44
+44
+43
+46
+46
+46
+46
+46
+46
+46
+46
+49
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+51
+52
+53
+53
+53
+52
+53
+54
+55
+55
+57
+57
+57
+57
+57
+57
+58
+59
+60
+62
+65
+71
+72
+71
+70
+69
+67
+64
+62
+60
+59
+59
+61
+64
+70
+74
+74
+72
+69
+70
+69
+67
+64
+62
+58
+59
+58
+60
+64
+67
+67
+64
+62
+63
+64
+63
+63
+63
+62
+62
+63
+62
+63
+63
+62
+63
+62
+62
+63
+62
+62
+62
+62
+61
+61
+61
+60
+61
+60
+60
+60
+60
+61
+62
+63
+66
+65
+64
+66
+67
+67
+66
+65
+65
+73
+78
+78
+71
+63
+59
+54
+57
+55
+55
+54
+52
+52
+51
+52
+51
+51
+52
+51
+51
+50
+50
+51
+51
+51
+51
+51
+50
+50
+49
+49
+49
+50
+50
+48
+46
+45
+46
+46
+52
+52
+56
+60
+63
+71
+89
+107
+117
+124
+124
+117
+104
+91
+77
+66
+65
+64
+61
+62
+66
+67
+66
+64
+71
+77
+81
+81
+81
+81
+85
+87
+89
+89
+88
+43
+43
+44
+45
+46
+46
+47
+47
+45
+45
+45
+45
+45
+45
+45
+45
+45
+44
+43
+43
+43
+43
+44
+44
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+43
+43
+43
+42
+42
+45
+45
+45
+45
+45
+45
+45
+46
+49
+49
+49
+48
+48
+48
+48
+48
+49
+49
+50
+51
+52
+52
+53
+53
+51
+52
+53
+54
+54
+54
+54
+55
+56
+56
+56
+57
+59
+60
+62
+64
+69
+70
+69
+68
+67
+66
+63
+61
+61
+58
+57
+59
+61
+66
+70
+70
+70
+70
+70
+69
+68
+67
+64
+62
+58
+59
+60
+65
+67
+68
+64
+61
+63
+64
+64
+63
+62
+62
+61
+62
+61
+63
+63
+63
+63
+62
+63
+62
+62
+62
+62
+61
+61
+61
+60
+60
+60
+61
+59
+60
+60
+62
+61
+63
+67
+66
+65
+66
+67
+67
+67
+67
+70
+81
+88
+88
+82
+73
+67
+63
+57
+55
+55
+54
+53
+52
+51
+51
+51
+51
+52
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+50
+50
+48
+49
+50
+49
+47
+46
+46
+47
+48
+48
+51
+56
+60
+70
+93
+115
+128
+132
+131
+122
+112
+101
+83
+67
+63
+60
+59
+62
+66
+66
+65
+63
+66
+72
+77
+81
+81
+82
+86
+88
+90
+89
+88
+43
+43
+44
+44
+44
+46
+47
+47
+45
+45
+45
+45
+45
+45
+45
+45
+44
+43
+43
+42
+42
+43
+43
+44
+42
+42
+42
+42
+42
+42
+42
+42
+44
+44
+44
+43
+43
+42
+42
+42
+44
+44
+44
+44
+44
+44
+44
+44
+47
+48
+48
+48
+48
+48
+48
+48
+49
+49
+50
+51
+51
+52
+53
+53
+50
+51
+52
+53
+53
+53
+53
+53
+56
+56
+56
+56
+58
+61
+62
+63
+67
+67
+66
+65
+65
+64
+62
+60
+60
+57
+56
+56
+58
+61
+66
+66
+70
+69
+70
+71
+71
+70
+67
+66
+59
+59
+62
+66
+68
+68
+64
+62
+65
+65
+64
+64
+64
+63
+63
+62
+62
+64
+63
+63
+62
+63
+62
+62
+62
+62
+62
+61
+61
+60
+60
+61
+61
+60
+60
+60
+60
+62
+62
+63
+68
+67
+66
+67
+67
+68
+68
+69
+80
+91
+101
+102
+95
+85
+77
+73
+57
+56
+55
+54
+52
+52
+51
+51
+51
+52
+52
+51
+52
+51
+51
+51
+51
+51
+51
+51
+51
+51
+50
+50
+47
+48
+50
+50
+48
+47
+47
+47
+44
+44
+48
+55
+60
+73
+98
+122
+138
+141
+136
+128
+120
+107
+87
+68
+61
+60
+60
+62
+65
+67
+68
+69
+81
+87
+94
+96
+95
+94
+94
+95
+91
+90
+90
+45
+45
+45
+46
+45
+45
+45
+45
+46
+46
+45
+44
+44
+44
+43
+43
+43
+43
+43
+43
+43
+43
+43
+44
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+45
+45
+46
+45
+45
+45
+45
+45
+45
+45
+45
+44
+45
+46
+47
+47
+47
+47
+47
+47
+47
+47
+47
+48
+49
+50
+52
+48
+50
+51
+52
+52
+53
+53
+53
+52
+53
+53
+54
+55
+57
+58
+60
+63
+64
+64
+63
+62
+60
+57
+54
+57
+56
+56
+57
+59
+61
+63
+62
+65
+65
+67
+69
+71
+71
+69
+67
+64
+66
+68
+69
+68
+66
+65
+66
+65
+64
+63
+62
+61
+61
+62
+63
+60
+61
+60
+62
+61
+61
+61
+62
+60
+60
+61
+60
+60
+60
+58
+59
+61
+60
+60
+61
+62
+64
+65
+65
+69
+68
+69
+73
+71
+68
+69
+77
+90
+102
+113
+115
+114
+106
+94
+81
+76
+70
+62
+56
+53
+52
+51
+51
+51
+52
+52
+52
+50
+49
+49
+49
+50
+50
+50
+50
+49
+49
+49
+49
+50
+50
+49
+49
+49
+49
+49
+48
+43
+47
+51
+52
+59
+79
+109
+133
+144
+150
+149
+137
+122
+110
+98
+91
+73
+66
+62
+62
+66
+73
+85
+96
+113
+125
+134
+127
+121
+117
+107
+95
+90
+90
+93
+45
+45
+45
+45
+45
+45
+44
+45
+46
+45
+44
+44
+43
+43
+43
+43
+42
+42
+42
+42
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+44
+44
+45
+46
+47
+47
+46
+46
+46
+46
+46
+46
+47
+48
+49
+50
+48
+49
+50
+52
+52
+53
+53
+52
+52
+52
+52
+53
+54
+56
+58
+59
+62
+62
+61
+62
+61
+59
+57
+55
+55
+55
+55
+57
+57
+60
+60
+61
+64
+65
+66
+68
+69
+70
+69
+68
+68
+69
+70
+71
+70
+67
+66
+66
+67
+66
+64
+63
+63
+63
+62
+62
+61
+62
+61
+61
+61
+62
+62
+61
+60
+61
+60
+60
+60
+59
+59
+60
+60
+61
+61
+61
+62
+64
+65
+66
+71
+69
+71
+74
+73
+71
+76
+84
+100
+113
+126
+127
+124
+115
+102
+88
+78
+73
+67
+61
+58
+56
+52
+49
+51
+51
+51
+50
+49
+48
+48
+48
+49
+50
+49
+49
+49
+49
+49
+49
+50
+50
+49
+49
+49
+49
+49
+48
+43
+45
+50
+53
+63
+86
+114
+136
+147
+151
+150
+139
+129
+121
+116
+110
+95
+90
+85
+87
+94
+103
+118
+130
+136
+146
+149
+142
+134
+128
+116
+101
+88
+88
+91
+45
+45
+45
+45
+45
+46
+45
+45
+45
+45
+45
+44
+43
+42
+42
+42
+43
+42
+42
+42
+41
+41
+41
+41
+43
+43
+43
+43
+43
+43
+43
+43
+42
+42
+43
+43
+43
+44
+44
+44
+44
+44
+44
+45
+45
+45
+45
+46
+44
+44
+45
+46
+46
+46
+46
+45
+45
+45
+45
+45
+46
+47
+48
+49
+48
+49
+50
+51
+51
+52
+52
+52
+52
+52
+52
+52
+54
+55
+57
+58
+59
+59
+60
+61
+59
+58
+55
+54
+54
+54
+53
+55
+57
+59
+60
+60
+63
+64
+64
+64
+67
+68
+69
+68
+70
+72
+73
+73
+69
+67
+66
+65
+66
+65
+63
+62
+62
+62
+62
+63
+60
+61
+60
+61
+62
+61
+60
+61
+60
+60
+60
+59
+59
+60
+58
+59
+60
+60
+60
+62
+63
+65
+67
+68
+74
+72
+72
+75
+75
+76
+83
+96
+115
+129
+140
+142
+137
+128
+113
+99
+82
+78
+73
+68
+64
+59
+54
+49
+49
+49
+48
+48
+47
+47
+47
+47
+47
+48
+47
+47
+47
+47
+47
+47
+48
+48
+48
+48
+48
+48
+48
+47
+43
+43
+47
+54
+69
+94
+122
+141
+148
+151
+149
+142
+137
+137
+139
+140
+136
+131
+126
+125
+126
+130
+142
+153
+161
+168
+165
+157
+150
+141
+123
+104
+86
+87
+89
+46
+46
+46
+46
+46
+46
+46
+46
+45
+45
+44
+44
+42
+42
+42
+42
+42
+41
+41
+41
+41
+40
+40
+40
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+43
+43
+43
+43
+44
+44
+44
+44
+45
+45
+45
+43
+44
+45
+45
+45
+45
+44
+44
+44
+44
+44
+44
+45
+46
+47
+48
+49
+50
+51
+52
+51
+51
+51
+52
+51
+51
+50
+51
+52
+54
+55
+56
+57
+57
+58
+59
+58
+57
+56
+53
+55
+54
+54
+56
+57
+58
+60
+62
+63
+63
+63
+63
+65
+66
+68
+69
+71
+72
+74
+73
+70
+66
+65
+64
+65
+65
+63
+62
+62
+62
+61
+62
+60
+61
+61
+61
+61
+61
+61
+60
+59
+59
+59
+59
+59
+59
+59
+59
+59
+60
+60
+62
+64
+67
+68
+69
+76
+72
+71
+74
+76
+81
+93
+106
+128
+143
+154
+155
+149
+139
+123
+109
+90
+85
+79
+73
+68
+61
+55
+51
+49
+48
+47
+45
+45
+45
+46
+47
+46
+46
+46
+46
+46
+46
+46
+46
+47
+47
+47
+47
+47
+47
+47
+45
+44
+42
+45
+54
+74
+102
+128
+144
+147
+150
+149
+144
+144
+153
+164
+168
+168
+164
+160
+158
+153
+152
+156
+163
+176
+177
+173
+163
+155
+146
+124
+102
+86
+85
+86
+47
+47
+47
+47
+46
+46
+46
+46
+45
+45
+45
+44
+44
+43
+43
+43
+42
+42
+42
+41
+41
+40
+40
+40
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+41
+41
+41
+42
+43
+43
+44
+44
+45
+45
+45
+43
+44
+44
+44
+44
+44
+43
+42
+43
+43
+43
+43
+44
+45
+47
+48
+48
+50
+51
+52
+51
+51
+50
+50
+50
+50
+49
+49
+50
+51
+53
+54
+54
+56
+57
+58
+57
+57
+56
+53
+55
+54
+55
+55
+58
+60
+62
+62
+64
+63
+63
+63
+64
+67
+67
+69
+69
+71
+72
+71
+68
+65
+63
+64
+64
+64
+63
+62
+61
+60
+61
+61
+60
+59
+60
+60
+60
+60
+60
+60
+59
+58
+58
+58
+58
+58
+58
+58
+58
+60
+61
+63
+66
+68
+70
+72
+75
+72
+71
+76
+80
+88
+102
+118
+140
+153
+164
+163
+157
+145
+130
+117
+101
+95
+85
+76
+70
+64
+58
+56
+49
+48
+45
+44
+43
+43
+45
+46
+45
+45
+45
+45
+45
+46
+45
+46
+46
+47
+46
+47
+47
+47
+47
+45
+44
+41
+43
+54
+76
+104
+131
+146
+151
+154
+153
+150
+155
+170
+185
+192
+183
+182
+183
+183
+177
+171
+171
+177
+179
+180
+173
+162
+155
+146
+122
+98
+84
+84
+85
+48
+48
+48
+48
+47
+47
+47
+47
+46
+46
+46
+45
+45
+45
+44
+44
+43
+43
+43
+42
+41
+40
+40
+40
+41
+41
+41
+41
+41
+41
+41
+41
+42
+42
+41
+41
+41
+40
+40
+40
+42
+42
+42
+43
+44
+44
+45
+45
+43
+43
+44
+44
+43
+43
+42
+41
+44
+44
+43
+44
+45
+46
+47
+48
+49
+49
+51
+52
+51
+50
+50
+49
+50
+49
+48
+48
+49
+50
+52
+52
+53
+55
+57
+58
+57
+56
+55
+53
+53
+53
+54
+56
+57
+60
+62
+61
+63
+62
+63
+63
+66
+66
+67
+68
+66
+68
+69
+69
+66
+63
+62
+62
+63
+63
+61
+61
+60
+60
+60
+60
+59
+60
+60
+59
+59
+60
+59
+59
+58
+58
+57
+58
+58
+57
+57
+57
+60
+60
+63
+65
+67
+70
+73
+73
+74
+71
+72
+78
+86
+96
+112
+131
+148
+161
+168
+167
+160
+150
+136
+123
+112
+105
+94
+83
+75
+69
+64
+60
+52
+50
+46
+44
+41
+42
+43
+44
+43
+43
+43
+43
+43
+44
+44
+44
+45
+45
+45
+45
+46
+46
+46
+44
+42
+40
+43
+54
+75
+103
+130
+147
+155
+158
+159
+158
+165
+180
+197
+206
+201
+202
+203
+200
+190
+179
+176
+178
+178
+178
+172
+161
+153
+142
+120
+95
+81
+81
+81
+48
+48
+48
+48
+47
+47
+47
+47
+47
+47
+47
+47
+46
+46
+45
+45
+45
+44
+44
+43
+42
+41
+41
+40
+41
+41
+41
+41
+41
+41
+41
+41
+41
+41
+41
+40
+40
+40
+39
+39
+41
+41
+42
+43
+44
+44
+45
+45
+43
+43
+43
+43
+43
+42
+41
+40
+44
+44
+44
+44
+45
+46
+48
+48
+49
+50
+50
+51
+51
+50
+50
+49
+49
+49
+48
+47
+48
+48
+49
+51
+54
+54
+56
+57
+58
+57
+55
+54
+52
+52
+52
+53
+56
+58
+59
+59
+60
+60
+62
+64
+65
+66
+65
+64
+62
+64
+66
+66
+64
+62
+61
+63
+63
+63
+62
+61
+59
+59
+60
+60
+59
+59
+59
+59
+59
+58
+58
+59
+57
+57
+58
+57
+57
+57
+56
+56
+60
+61
+64
+66
+69
+73
+75
+77
+73
+72
+74
+83
+93
+104
+123
+142
+156
+167
+172
+170
+161
+153
+139
+129
+120
+114
+104
+93
+84
+76
+68
+63
+55
+52
+48
+43
+40
+40
+41
+43
+41
+41
+41
+41
+41
+42
+42
+42
+43
+43
+44
+44
+44
+44
+44
+43
+41
+41
+45
+54
+72
+99
+128
+146
+156
+160
+162
+161
+168
+184
+200
+208
+211
+210
+209
+203
+189
+175
+172
+176
+174
+177
+171
+159
+148
+136
+115
+93
+79
+77
+76
+47
+48
+47
+47
+48
+48
+48
+47
+48
+48
+48
+47
+47
+47
+46
+45
+46
+45
+45
+44
+43
+42
+41
+41
+41
+41
+41
+41
+41
+41
+41
+41
+41
+41
+40
+40
+40
+39
+39
+38
+40
+41
+42
+43
+43
+45
+46
+46
+44
+44
+43
+43
+42
+41
+40
+40
+45
+45
+45
+45
+46
+47
+48
+49
+51
+51
+52
+52
+51
+50
+49
+49
+49
+49
+47
+47
+47
+48
+49
+50
+51
+54
+55
+57
+58
+58
+56
+54
+50
+49
+50
+51
+54
+57
+60
+59
+61
+61
+63
+64
+64
+64
+63
+61
+60
+62
+66
+67
+66
+63
+62
+62
+62
+61
+61
+61
+61
+61
+61
+62
+60
+60
+60
+59
+58
+59
+59
+59
+58
+59
+58
+59
+59
+58
+58
+58
+62
+62
+64
+67
+70
+74
+77
+79
+73
+73
+80
+92
+104
+117
+135
+153
+162
+170
+172
+169
+162
+155
+144
+136
+126
+121
+112
+103
+93
+82
+73
+65
+56
+53
+48
+43
+40
+40
+41
+42
+41
+42
+42
+41
+41
+41
+41
+41
+42
+42
+43
+43
+44
+44
+44
+43
+41
+42
+45
+54
+70
+96
+124
+144
+153
+158
+161
+161
+167
+182
+196
+203
+201
+199
+198
+193
+183
+173
+174
+181
+171
+174
+169
+156
+143
+131
+110
+90
+76
+74
+72
+48
+48
+48
+49
+49
+49
+50
+49
+50
+51
+51
+50
+49
+49
+47
+47
+48
+48
+47
+46
+44
+45
+44
+44
+44
+44
+45
+45
+44
+43
+41
+41
+41
+41
+40
+41
+41
+41
+42
+42
+43
+43
+44
+45
+45
+46
+47
+47
+45
+45
+44
+45
+46
+47
+46
+46
+45
+44
+45
+46
+47
+49
+49
+50
+52
+52
+53
+53
+53
+52
+51
+50
+50
+49
+49
+48
+47
+48
+48
+49
+47
+49
+51
+54
+56
+55
+54
+50
+45
+41
+39
+41
+46
+53
+60
+63
+65
+64
+65
+66
+64
+61
+59
+56
+59
+61
+65
+66
+67
+65
+62
+59
+59
+58
+59
+61
+63
+63
+63
+63
+64
+63
+62
+61
+60
+59
+58
+59
+57
+64
+60
+56
+62
+62
+59
+63
+59
+63
+68
+72
+76
+77
+79
+78
+76
+84
+99
+113
+125
+138
+151
+159
+166
+167
+168
+168
+165
+161
+155
+151
+142
+133
+122
+116
+110
+101
+88
+75
+63
+57
+48
+43
+39
+39
+39
+38
+41
+41
+40
+39
+38
+38
+38
+38
+39
+39
+40
+40
+41
+42
+42
+42
+41
+43
+45
+47
+63
+92
+122
+139
+156
+157
+161
+166
+168
+170
+180
+191
+193
+190
+186
+179
+174
+171
+170
+170
+168
+166
+158
+148
+137
+124
+107
+90
+82
+73
+65
+48
+49
+49
+49
+50
+50
+49
+50
+51
+51
+52
+52
+51
+50
+48
+48
+47
+47
+46
+46
+46
+45
+44
+44
+44
+45
+45
+45
+44
+42
+42
+40
+41
+40
+40
+40
+41
+41
+42
+42
+43
+43
+45
+45
+47
+47
+47
+47
+46
+46
+46
+46
+46
+46
+45
+46
+45
+46
+46
+47
+47
+48
+50
+51
+53
+53
+53
+53
+53
+52
+51
+51
+50
+49
+48
+48
+47
+47
+48
+49
+47
+47
+50
+51
+52
+51
+50
+48
+44
+42
+41
+42
+45
+51
+57
+61
+65
+65
+65
+64
+63
+61
+58
+59
+57
+60
+62
+64
+65
+65
+65
+63
+59
+59
+60
+61
+62
+64
+63
+64
+64
+62
+61
+60
+59
+59
+58
+60
+57
+61
+59
+57
+63
+63
+57
+58
+61
+64
+68
+72
+74
+77
+79
+77
+74
+84
+102
+119
+135
+147
+159
+166
+167
+168
+167
+167
+165
+160
+156
+153
+147
+139
+130
+123
+119
+111
+97
+86
+73
+65
+56
+48
+42
+41
+40
+40
+40
+39
+39
+39
+38
+38
+39
+39
+39
+40
+40
+41
+42
+42
+43
+43
+45
+46
+44
+45
+58
+88
+120
+139
+150
+153
+158
+163
+164
+165
+173
+182
+185
+182
+179
+174
+171
+168
+168
+168
+166
+164
+157
+146
+136
+123
+106
+90
+77
+68
+62
+50
+50
+50
+50
+51
+51
+51
+51
+52
+52
+53
+53
+53
+52
+50
+49
+48
+48
+47
+46
+47
+46
+44
+45
+45
+45
+46
+45
+45
+44
+42
+41
+40
+39
+41
+41
+41
+41
+42
+42
+44
+44
+46
+46
+46
+47
+47
+47
+47
+47
+46
+46
+47
+46
+45
+45
+46
+48
+48
+49
+49
+51
+52
+53
+54
+54
+55
+55
+54
+53
+52
+52
+50
+49
+48
+48
+48
+48
+49
+49
+49
+47
+46
+44
+43
+42
+42
+42
+44
+46
+45
+45
+46
+48
+50
+52
+58
+59
+59
+61
+60
+60
+58
+58
+60
+61
+62
+63
+65
+65
+66
+67
+63
+61
+62
+62
+62
+62
+61
+61
+59
+60
+58
+58
+59
+60
+61
+61
+62
+60
+59
+60
+65
+65
+61
+59
+63
+65
+70
+72
+74
+74
+78
+77
+73
+83
+101
+117
+132
+144
+156
+164
+168
+169
+169
+168
+164
+158
+153
+151
+149
+146
+139
+134
+130
+124
+114
+104
+89
+80
+68
+58
+51
+47
+45
+42
+38
+36
+36
+36
+37
+38
+40
+42
+42
+42
+43
+44
+45
+45
+46
+45
+47
+47
+42
+42
+55
+85
+118
+138
+144
+147
+153
+159
+160
+160
+165
+172
+175
+173
+170
+169
+167
+167
+166
+166
+164
+162
+155
+145
+135
+124
+107
+90
+73
+64
+58
+51
+51
+52
+52
+52
+53
+52
+52
+53
+54
+54
+55
+55
+54
+52
+52
+50
+49
+49
+48
+48
+47
+46
+46
+47
+47
+47
+47
+46
+46
+45
+43
+41
+41
+42
+42
+42
+42
+43
+43
+45
+45
+47
+47
+48
+48
+48
+48
+49
+49
+47
+48
+48
+46
+46
+46
+50
+50
+50
+51
+52
+54
+54
+55
+56
+56
+57
+56
+56
+55
+53
+53
+50
+50
+49
+48
+48
+49
+50
+49
+51
+49
+45
+41
+38
+37
+38
+40
+47
+49
+50
+50
+47
+47
+45
+46
+57
+59
+60
+60
+59
+59
+59
+58
+62
+64
+66
+66
+67
+66
+65
+65
+64
+64
+63
+63
+62
+60
+59
+58
+56
+56
+57
+57
+59
+60
+61
+62
+64
+55
+56
+60
+59
+62
+65
+64
+66
+68
+71
+73
+73
+75
+78
+80
+81
+90
+101
+114
+125
+136
+147
+156
+165
+167
+168
+168
+163
+158
+152
+150
+148
+146
+142
+140
+139
+134
+125
+118
+103
+93
+80
+68
+58
+52
+47
+42
+37
+35
+35
+36
+37
+39
+41
+44
+42
+43
+43
+44
+44
+44
+45
+44
+42
+43
+43
+43
+56
+85
+113
+132
+140
+143
+150
+156
+159
+158
+160
+165
+167
+165
+163
+163
+165
+165
+165
+164
+161
+159
+153
+144
+135
+124
+107
+91
+71
+61
+55
+53
+53
+53
+54
+54
+54
+54
+54
+55
+55
+56
+57
+57
+57
+55
+55
+52
+52
+51
+51
+51
+50
+49
+49
+49
+50
+50
+49
+48
+47
+46
+45
+44
+43
+43
+43
+44
+44
+44
+44
+47
+47
+47
+47
+49
+49
+50
+50
+50
+50
+50
+50
+49
+49
+49
+49
+52
+53
+52
+54
+55
+56
+56
+57
+58
+58
+59
+58
+57
+56
+53
+53
+51
+51
+50
+50
+50
+50
+51
+51
+52
+50
+48
+44
+40
+39
+40
+44
+50
+53
+55
+54
+51
+49
+47
+47
+58
+59
+60
+61
+60
+60
+59
+58
+59
+62
+65
+66
+67
+67
+64
+64
+66
+67
+64
+62
+60
+59
+57
+56
+54
+55
+56
+58
+60
+61
+62
+62
+57
+48
+56
+63
+53
+53
+66
+67
+69
+71
+73
+74
+74
+76
+79
+85
+94
+102
+109
+114
+121
+131
+144
+154
+159
+163
+167
+168
+166
+162
+156
+151
+144
+142
+140
+139
+139
+136
+131
+126
+113
+104
+90
+75
+64
+54
+47
+42
+39
+37
+38
+38
+39
+40
+43
+44
+43
+43
+43
+43
+42
+42
+41
+41
+35
+42
+48
+54
+67
+90
+112
+125
+136
+138
+144
+152
+155
+153
+154
+159
+162
+160
+159
+160
+163
+165
+165
+163
+158
+156
+150
+142
+134
+123
+107
+92
+69
+58
+52
+54
+54
+55
+55
+56
+56
+55
+55
+56
+57
+58
+59
+59
+59
+57
+57
+55
+55
+54
+53
+54
+53
+52
+52
+52
+52
+53
+52
+51
+51
+49
+48
+45
+45
+45
+45
+46
+46
+46
+47
+48
+48
+48
+49
+50
+50
+51
+51
+51
+51
+52
+52
+52
+53
+52
+53
+54
+55
+55
+56
+57
+58
+58
+59
+60
+60
+60
+60
+59
+57
+55
+54
+53
+53
+52
+51
+51
+52
+53
+53
+54
+53
+50
+49
+46
+45
+47
+49
+53
+56
+57
+57
+55
+54
+50
+50
+50
+51
+53
+54
+55
+56
+55
+54
+55
+58
+60
+62
+63
+64
+63
+65
+65
+65
+65
+63
+60
+58
+57
+56
+55
+56
+57
+59
+60
+61
+62
+60
+53
+51
+77
+89
+65
+57
+70
+75
+71
+74
+76
+77
+77
+80
+85
+92
+105
+112
+114
+117
+117
+124
+135
+145
+147
+153
+160
+165
+165
+161
+156
+150
+143
+141
+140
+142
+142
+141
+138
+134
+125
+116
+104
+90
+77
+64
+54
+47
+43
+42
+42
+42
+42
+44
+45
+45
+45
+45
+44
+43
+41
+40
+39
+40
+40
+51
+62
+71
+82
+98
+113
+121
+130
+132
+137
+145
+149
+149
+151
+154
+159
+156
+155
+158
+162
+164
+162
+159
+154
+153
+148
+141
+133
+124
+108
+92
+68
+57
+51
+55
+56
+56
+56
+57
+57
+56
+57
+57
+58
+59
+60
+60
+60
+59
+59
+58
+58
+57
+56
+56
+56
+55
+55
+55
+55
+55
+55
+54
+53
+51
+51
+47
+47
+47
+48
+48
+48
+49
+49
+49
+49
+50
+50
+51
+51
+52
+52
+52
+52
+52
+53
+54
+57
+56
+57
+55
+56
+57
+58
+58
+60
+61
+61
+61
+61
+61
+60
+60
+58
+56
+55
+56
+55
+55
+54
+54
+55
+55
+56
+54
+55
+56
+56
+57
+56
+56
+57
+56
+56
+57
+56
+57
+57
+57
+54
+47
+47
+51
+54
+57
+59
+59
+61
+65
+64
+61
+60
+58
+60
+61
+64
+63
+64
+62
+62
+60
+59
+58
+59
+58
+59
+60
+61
+61
+60
+59
+57
+49
+61
+108
+127
+91
+68
+76
+78
+73
+77
+80
+81
+83
+85
+90
+100
+113
+120
+118
+115
+109
+107
+111
+116
+128
+137
+148
+156
+159
+159
+154
+151
+143
+142
+144
+146
+147
+147
+146
+144
+137
+130
+119
+107
+93
+79
+67
+58
+50
+49
+48
+47
+47
+47
+47
+47
+47
+46
+44
+42
+40
+38
+36
+38
+53
+67
+81
+89
+98
+109
+119
+123
+130
+130
+134
+142
+148
+148
+150
+154
+157
+155
+153
+156
+160
+162
+158
+155
+151
+151
+146
+139
+132
+123
+109
+93
+73
+60
+54
+56
+56
+57
+57
+57
+58
+57
+57
+58
+59
+60
+61
+61
+61
+60
+60
+59
+59
+59
+58
+58
+57
+57
+56
+57
+57
+57
+57
+56
+55
+53
+51
+48
+48
+49
+49
+49
+49
+49
+50
+49
+49
+51
+51
+51
+52
+52
+52
+52
+53
+53
+56
+57
+58
+59
+59
+56
+58
+57
+59
+60
+61
+62
+62
+62
+62
+61
+61
+60
+59
+57
+56
+57
+57
+56
+55
+55
+56
+57
+57
+56
+57
+59
+60
+60
+60
+60
+59
+54
+54
+54
+54
+55
+56
+57
+54
+53
+54
+59
+64
+68
+72
+74
+76
+81
+76
+68
+59
+55
+55
+57
+60
+60
+61
+60
+59
+59
+59
+60
+61
+62
+62
+62
+61
+59
+57
+54
+51
+41
+63
+125
+150
+104
+72
+75
+72
+76
+81
+83
+86
+86
+90
+95
+102
+113
+118
+115
+107
+95
+84
+81
+82
+111
+121
+133
+142
+147
+148
+145
+142
+137
+137
+140
+142
+144
+144
+143
+144
+137
+133
+121
+110
+97
+82
+68
+59
+52
+49
+48
+47
+47
+46
+46
+47
+48
+47
+46
+44
+41
+40
+39
+41
+66
+81
+94
+101
+108
+117
+123
+126
+132
+132
+135
+143
+149
+150
+153
+157
+155
+153
+150
+153
+157
+159
+154
+150
+148
+148
+144
+138
+132
+124
+109
+93
+79
+67
+60
+58
+58
+58
+58
+58
+59
+60
+60
+60
+60
+61
+61
+62
+63
+63
+63
+64
+64
+64
+63
+63
+62
+62
+61
+59
+59
+59
+59
+58
+59
+58
+58
+56
+56
+56
+55
+54
+55
+55
+55
+55
+55
+54
+53
+53
+53
+52
+52
+54
+54
+54
+55
+55
+56
+58
+59
+58
+60
+60
+62
+63
+64
+64
+64
+64
+64
+63
+62
+60
+59
+59
+59
+57
+56
+57
+56
+56
+56
+57
+57
+53
+68
+64
+58
+64
+54
+48
+60
+52
+54
+52
+48
+47
+54
+61
+60
+73
+71
+73
+75
+70
+62
+61
+68
+78
+80
+86
+89
+79
+65
+59
+62
+57
+56
+53
+51
+55
+62
+63
+60
+65
+63
+59
+57
+54
+50
+44
+38
+72
+99
+70
+89
+122
+86
+70
+86
+82
+91
+98
+100
+95
+94
+99
+106
+99
+110
+111
+89
+59
+45
+44
+49
+65
+74
+91
+111
+124
+129
+133
+138
+126
+128
+131
+133
+135
+136
+138
+138
+128
+125
+121
+110
+98
+85
+72
+65
+58
+47
+48
+49
+39
+37
+48
+53
+51
+50
+49
+49
+46
+43
+45
+54
+72
+87
+95
+100
+111
+124
+132
+129
+131
+135
+141
+146
+149
+151
+153
+155
+150
+152
+151
+149
+149
+153
+152
+150
+149
+141
+135
+132
+130
+122
+109
+95
+80
+75
+73
+58
+58
+58
+58
+59
+60
+61
+62
+61
+61
+62
+62
+63
+64
+63
+63
+65
+64
+64
+64
+63
+63
+62
+62
+62
+62
+62
+61
+60
+60
+59
+58
+57
+57
+57
+57
+56
+56
+57
+57
+55
+55
+54
+54
+54
+53
+52
+52
+54
+54
+54
+55
+55
+58
+58
+60
+59
+59
+61
+62
+64
+64
+64
+64
+64
+64
+63
+61
+60
+59
+59
+59
+58
+57
+57
+57
+57
+57
+58
+58
+58
+56
+47
+46
+55
+58
+59
+69
+68
+72
+73
+72
+74
+79
+80
+79
+68
+66
+66
+67
+62
+55
+55
+61
+67
+63
+64
+69
+71
+70
+72
+78
+75
+71
+64
+56
+55
+61
+62
+61
+60
+72
+75
+62
+43
+40
+57
+75
+76
+79
+64
+65
+96
+89
+64
+84
+97
+91
+92
+104
+108
+102
+99
+99
+102
+97
+88
+67
+46
+39
+40
+42
+48
+53
+63
+76
+82
+84
+85
+90
+98
+101
+105
+108
+112
+116
+118
+120
+124
+121
+118
+113
+107
+101
+97
+95
+97
+84
+76
+72
+68
+70
+55
+28
+49
+48
+49
+54
+56
+58
+62
+69
+79
+90
+97
+102
+114
+130
+137
+134
+137
+137
+139
+142
+146
+148
+148
+148
+146
+150
+151
+150
+152
+157
+157
+155
+153
+146
+137
+132
+129
+121
+109
+97
+83
+80
+79
+57
+57
+57
+58
+60
+61
+62
+63
+63
+63
+64
+64
+64
+64
+63
+63
+65
+65
+65
+64
+64
+64
+64
+63
+65
+64
+63
+62
+61
+60
+60
+59
+58
+58
+58
+58
+59
+59
+59
+60
+56
+56
+55
+54
+53
+53
+52
+52
+54
+54
+53
+55
+55
+57
+57
+59
+59
+60
+61
+63
+63
+64
+65
+64
+63
+63
+62
+61
+60
+59
+59
+58
+58
+58
+58
+58
+59
+60
+60
+59
+69
+51
+51
+65
+76
+86
+93
+96
+66
+73
+77
+79
+82
+85
+80
+76
+65
+66
+64
+63
+59
+55
+56
+61
+69
+62
+55
+58
+62
+65
+67
+67
+48
+57
+68
+75
+77
+75
+65
+55
+56
+54
+49
+48
+51
+60
+70
+77
+71
+54
+60
+52
+79
+99
+74
+91
+99
+95
+99
+111
+111
+103
+103
+104
+100
+84
+71
+58
+52
+52
+50
+46
+53
+51
+53
+56
+55
+54
+54
+57
+65
+67
+70
+73
+77
+81
+84
+86
+84
+83
+80
+78
+78
+81
+83
+87
+105
+99
+93
+87
+90
+101
+83
+45
+39
+49
+58
+63
+58
+56
+66
+78
+79
+86
+95
+101
+117
+134
+140
+136
+140
+139
+139
+139
+140
+143
+144
+144
+149
+155
+158
+160
+163
+168
+169
+166
+162
+152
+141
+131
+126
+119
+109
+99
+87
+85
+85
+56
+56
+57
+58
+60
+62
+63
+64
+65
+65
+65
+65
+65
+65
+64
+64
+66
+66
+66
+65
+65
+66
+65
+65
+67
+66
+65
+64
+62
+61
+60
+59
+58
+58
+59
+59
+59
+60
+60
+60
+57
+56
+56
+55
+54
+53
+53
+53
+54
+54
+55
+55
+56
+58
+59
+60
+60
+61
+62
+63
+64
+64
+64
+64
+63
+62
+62
+61
+60
+58
+59
+58
+59
+59
+59
+60
+60
+61
+62
+60
+56
+43
+59
+85
+85
+86
+86
+75
+52
+58
+62
+66
+70
+74
+67
+63
+66
+70
+66
+64
+63
+62
+66
+68
+71
+66
+60
+59
+60
+58
+54
+51
+57
+57
+56
+55
+61
+74
+84
+88
+63
+52
+45
+54
+72
+80
+66
+52
+59
+47
+57
+56
+70
+93
+88
+87
+87
+100
+112
+111
+102
+99
+109
+117
+85
+70
+62
+60
+64
+67
+61
+55
+66
+60
+55
+54
+52
+50
+51
+56
+51
+53
+54
+56
+58
+61
+63
+64
+67
+67
+64
+63
+65
+67
+71
+74
+81
+84
+87
+85
+86
+99
+102
+89
+49
+48
+49
+56
+62
+64
+68
+70
+74
+84
+96
+107
+124
+142
+145
+139
+141
+143
+143
+141
+138
+140
+146
+151
+163
+169
+174
+177
+180
+185
+183
+181
+171
+160
+145
+132
+124
+116
+108
+100
+88
+87
+88
+55
+55
+56
+57
+59
+61
+62
+63
+65
+65
+65
+65
+65
+66
+65
+65
+67
+67
+66
+67
+68
+68
+67
+67
+67
+66
+65
+64
+61
+61
+60
+59
+59
+59
+59
+59
+59
+59
+59
+59
+57
+57
+57
+56
+55
+54
+54
+53
+55
+55
+55
+56
+56
+59
+59
+60
+61
+62
+63
+64
+64
+65
+63
+63
+63
+61
+61
+60
+59
+59
+58
+58
+60
+60
+59
+60
+61
+63
+63
+61
+54
+52
+77
+94
+78
+65
+55
+39
+50
+56
+58
+61
+65
+69
+63
+60
+63
+66
+64
+63
+64
+67
+72
+74
+62
+63
+61
+59
+57
+58
+59
+61
+71
+69
+64
+57
+56
+67
+77
+83
+68
+77
+84
+85
+75
+64
+53
+51
+52
+57
+51
+59
+57
+65
+91
+85
+78
+98
+106
+96
+90
+100
+112
+109
+70
+60
+59
+62
+68
+73
+74
+73
+76
+68
+58
+55
+52
+49
+52
+58
+57
+58
+59
+59
+60
+63
+65
+67
+69
+69
+68
+68
+67
+68
+68
+67
+72
+66
+74
+79
+75
+80
+93
+99
+91
+64
+38
+43
+64
+79
+76
+67
+74
+89
+106
+123
+141
+156
+156
+147
+142
+151
+155
+153
+146
+147
+158
+168
+182
+188
+193
+193
+195
+198
+195
+190
+181
+169
+151
+135
+123
+115
+109
+102
+90
+89
+91
+54
+54
+55
+56
+57
+59
+60
+61
+63
+63
+64
+65
+66
+66
+66
+66
+68
+68
+67
+68
+69
+69
+68
+69
+67
+67
+66
+65
+64
+63
+62
+61
+61
+61
+60
+60
+59
+59
+59
+58
+58
+58
+57
+57
+56
+55
+54
+54
+55
+55
+55
+56
+57
+59
+60
+61
+63
+62
+63
+64
+65
+65
+63
+63
+63
+61
+60
+59
+59
+59
+57
+57
+59
+60
+59
+60
+62
+63
+63
+59
+57
+71
+90
+88
+68
+57
+52
+44
+50
+56
+58
+58
+61
+64
+59
+56
+55
+58
+57
+55
+58
+66
+69
+69
+62
+63
+60
+54
+54
+62
+68
+71
+58
+65
+70
+68
+63
+59
+52
+48
+57
+73
+85
+80
+63
+50
+48
+55
+49
+61
+46
+56
+52
+55
+104
+108
+87
+90
+86
+81
+91
+106
+103
+83
+69
+62
+60
+62
+66
+72
+80
+87
+79
+68
+59
+54
+50
+47
+50
+55
+57
+58
+58
+59
+61
+63
+67
+68
+60
+62
+63
+64
+64
+62
+61
+60
+74
+61
+66
+78
+77
+80
+86
+91
+114
+97
+74
+58
+53
+56
+66
+76
+81
+101
+124
+141
+157
+167
+166
+156
+158
+167
+175
+172
+167
+168
+180
+193
+201
+206
+208
+208
+206
+207
+203
+198
+189
+178
+159
+140
+126
+116
+110
+106
+95
+96
+95
+54
+54
+54
+54
+55
+57
+57
+58
+60
+61
+62
+64
+65
+67
+67
+67
+68
+69
+68
+68
+70
+70
+70
+70
+69
+68
+67
+67
+66
+65
+64
+65
+65
+65
+64
+63
+61
+60
+60
+60
+58
+58
+58
+57
+56
+56
+55
+55
+56
+56
+56
+56
+58
+59
+60
+61
+63
+63
+64
+65
+64
+64
+64
+63
+61
+61
+61
+60
+59
+58
+56
+57
+58
+59
+58
+59
+61
+62
+64
+58
+50
+75
+84
+63
+49
+48
+49
+50
+50
+57
+61
+61
+61
+63
+59
+55
+54
+56
+54
+52
+56
+64
+67
+64
+66
+65
+60
+56
+58
+67
+68
+65
+64
+64
+55
+44
+36
+39
+44
+49
+44
+48
+53
+55
+53
+52
+50
+51
+52
+55
+51
+55
+55
+63
+97
+127
+101
+86
+76
+86
+100
+99
+82
+66
+69
+63
+62
+64
+63
+63
+69
+77
+74
+63
+56
+54
+53
+50
+54
+59
+58
+58
+56
+56
+56
+59
+61
+63
+64
+64
+65
+67
+68
+67
+67
+67
+73
+68
+72
+77
+77
+88
+97
+94
+107
+113
+111
+93
+67
+54
+65
+85
+101
+125
+150
+163
+174
+182
+182
+175
+183
+189
+193
+195
+194
+198
+206
+215
+218
+221
+221
+218
+216
+215
+212
+207
+197
+186
+167
+146
+130
+120
+115
+111
+106
+105
+104
+54
+54
+54
+54
+54
+55
+55
+56
+59
+60
+61
+63
+65
+67
+68
+69
+69
+69
+69
+70
+70
+71
+71
+72
+71
+71
+69
+68
+68
+68
+67
+67
+67
+68
+66
+65
+62
+61
+61
+59
+58
+58
+58
+58
+57
+55
+55
+55
+55
+55
+56
+57
+58
+58
+60
+61
+64
+63
+64
+65
+65
+64
+64
+63
+62
+62
+61
+59
+57
+56
+55
+56
+56
+58
+59
+61
+61
+62
+63
+57
+61
+93
+90
+56
+47
+50
+47
+51
+58
+67
+71
+70
+66
+66
+61
+58
+57
+59
+58
+55
+60
+67
+69
+64
+61
+60
+59
+60
+69
+76
+69
+56
+55
+60
+61
+53
+44
+42
+40
+39
+44
+48
+52
+54
+53
+52
+51
+52
+59
+50
+63
+55
+57
+63
+65
+108
+103
+82
+78
+98
+103
+81
+64
+65
+60
+58
+59
+62
+61
+54
+52
+56
+71
+63
+58
+57
+57
+55
+58
+63
+67
+65
+63
+59
+58
+58
+59
+60
+64
+63
+63
+63
+64
+65
+64
+66
+68
+79
+86
+76
+66
+86
+105
+102
+94
+96
+104
+112
+112
+102
+92
+89
+126
+152
+176
+187
+194
+199
+199
+195
+202
+202
+202
+206
+213
+219
+224
+227
+229
+232
+232
+228
+225
+224
+221
+216
+202
+191
+171
+150
+134
+123
+117
+114
+114
+112
+110
+49
+50
+51
+53
+55
+56
+56
+56
+58
+59
+61
+63
+65
+67
+69
+69
+72
+72
+72
+72
+74
+75
+76
+75
+74
+70
+68
+70
+73
+73
+68
+63
+69
+67
+64
+65
+67
+66
+61
+57
+60
+58
+57
+55
+56
+55
+55
+52
+58
+57
+57
+57
+58
+58
+59
+60
+63
+64
+64
+64
+64
+64
+64
+63
+64
+62
+59
+56
+54
+52
+55
+58
+62
+56
+59
+66
+64
+56
+59
+66
+106
+75
+55
+54
+55
+54
+56
+61
+57
+60
+64
+65
+61
+57
+54
+55
+54
+55
+56
+60
+64
+66
+66
+65
+62
+61
+60
+61
+67
+70
+62
+50
+57
+57
+57
+57
+55
+54
+52
+50
+46
+47
+49
+50
+53
+55
+58
+59
+58
+51
+52
+56
+56
+54
+66
+83
+78
+83
+92
+93
+80
+62
+56
+63
+64
+67
+64
+62
+60
+58
+59
+59
+76
+75
+70
+62
+60
+63
+62
+59
+69
+68
+68
+68
+64
+60
+61
+66
+70
+65
+59
+58
+61
+68
+73
+75
+78
+78
+81
+82
+79
+79
+90
+103
+93
+69
+86
+94
+91
+117
+92
+114
+143
+167
+195
+213
+220
+219
+220
+219
+216
+216
+217
+220
+227
+231
+236
+239
+243
+243
+240
+236
+231
+226
+221
+220
+208
+201
+186
+165
+144
+131
+125
+123
+132
+128
+125
+46
+47
+50
+52
+53
+54
+55
+55
+57
+58
+61
+63
+65
+67
+68
+69
+72
+72
+72
+72
+74
+75
+77
+77
+74
+73
+74
+80
+85
+88
+84
+79
+73
+68
+63
+61
+62
+63
+61
+59
+58
+57
+55
+55
+56
+56
+56
+54
+52
+52
+53
+55
+57
+58
+60
+61
+63
+63
+64
+64
+64
+64
+63
+63
+64
+64
+60
+57
+54
+52
+51
+52
+60
+59
+61
+63
+58
+54
+65
+74
+80
+59
+50
+54
+58
+55
+57
+62
+59
+60
+63
+64
+61
+57
+54
+55
+57
+58
+57
+59
+62
+65
+66
+64
+63
+58
+60
+69
+72
+63
+56
+54
+55
+55
+57
+59
+60
+58
+56
+52
+49
+46
+46
+48
+52
+55
+58
+58
+60
+54
+56
+61
+59
+53
+58
+70
+70
+73
+79
+80
+71
+59
+58
+67
+66
+68
+66
+62
+59
+58
+60
+61
+69
+76
+78
+71
+63
+63
+63
+64
+67
+67
+68
+70
+66
+62
+62
+66
+70
+67
+63
+64
+66
+70
+74
+75
+72
+71
+74
+82
+93
+96
+88
+79
+70
+68
+68
+73
+92
+106
+71
+121
+148
+176
+209
+226
+231
+232
+230
+226
+227
+225
+227
+230
+236
+242
+247
+250
+249
+249
+246
+244
+238
+234
+231
+229
+221
+214
+198
+178
+161
+147
+143
+144
+148
+144
+140
+46
+47
+48
+49
+51
+52
+54
+54
+57
+58
+60
+62
+64
+66
+67
+68
+70
+71
+72
+73
+74
+76
+76
+76
+73
+75
+82
+94
+104
+109
+107
+104
+89
+81
+71
+64
+62
+61
+60
+58
+58
+58
+55
+55
+56
+57
+58
+57
+51
+52
+54
+57
+58
+59
+60
+60
+62
+63
+63
+64
+63
+63
+63
+63
+59
+61
+60
+58
+55
+53
+52
+50
+55
+57
+56
+49
+43
+46
+58
+69
+58
+50
+49
+57
+60
+55
+56
+60
+59
+61
+65
+65
+62
+60
+58
+60
+60
+60
+57
+57
+60
+62
+62
+60
+63
+56
+62
+76
+71
+54
+50
+57
+54
+54
+56
+58
+58
+56
+54
+51
+48
+46
+46
+49
+50
+54
+56
+55
+56
+53
+57
+62
+61
+54
+57
+65
+60
+62
+69
+75
+74
+67
+63
+67
+67
+68
+66
+61
+58
+56
+58
+59
+56
+68
+78
+73
+64
+62
+66
+72
+65
+64
+67
+71
+69
+64
+63
+65
+68
+67
+67
+70
+73
+75
+76
+74
+66
+68
+72
+78
+91
+98
+87
+69
+77
+86
+64
+71
+121
+121
+64
+123
+140
+177
+216
+234
+240
+245
+243
+236
+233
+233
+234
+237
+242
+246
+251
+254
+253
+252
+249
+247
+244
+242
+239
+239
+231
+223
+207
+189
+174
+165
+163
+163
+171
+165
+161
+46
+46
+47
+48
+49
+50
+52
+53
+56
+57
+59
+61
+63
+65
+66
+67
+69
+70
+72
+74
+75
+77
+76
+76
+74
+80
+93
+108
+122
+130
+130
+128
+117
+107
+95
+83
+76
+69
+64
+60
+63
+59
+56
+54
+54
+56
+57
+56
+55
+57
+59
+59
+61
+60
+59
+59
+63
+63
+63
+64
+63
+63
+62
+63
+61
+62
+61
+58
+58
+57
+57
+57
+56
+56
+52
+44
+41
+48
+55
+61
+54
+55
+58
+63
+63
+57
+56
+59
+58
+60
+62
+64
+62
+61
+61
+62
+63
+61
+57
+56
+57
+58
+58
+57
+59
+59
+66
+69
+62
+49
+50
+57
+53
+52
+54
+55
+55
+54
+51
+49
+48
+46
+47
+48
+50
+52
+54
+53
+50
+48
+52
+60
+61
+57
+61
+68
+53
+54
+59
+68
+77
+75
+67
+61
+64
+65
+62
+60
+58
+56
+57
+59
+52
+63
+72
+72
+66
+64
+70
+78
+63
+63
+66
+72
+72
+66
+64
+65
+65
+67
+70
+73
+77
+79
+76
+72
+63
+74
+79
+73
+77
+87
+87
+79
+75
+78
+62
+98
+156
+141
+57
+75
+119
+163
+210
+231
+242
+251
+250
+241
+237
+237
+237
+240
+242
+246
+250
+251
+252
+251
+249
+248
+245
+244
+243
+242
+235
+227
+213
+198
+185
+180
+180
+182
+191
+183
+177
+48
+48
+47
+47
+48
+49
+51
+52
+55
+56
+57
+59
+61
+63
+65
+65
+69
+70
+72
+74
+75
+77
+76
+75
+74
+84
+100
+120
+134
+144
+147
+144
+139
+131
+119
+109
+100
+91
+80
+74
+71
+66
+61
+55
+53
+54
+53
+53
+55
+56
+57
+59
+60
+60
+61
+60
+63
+63
+64
+65
+64
+63
+64
+62
+63
+62
+58
+56
+56
+57
+59
+60
+60
+57
+51
+49
+55
+62
+61
+56
+59
+60
+64
+65
+64
+60
+59
+62
+56
+58
+60
+61
+60
+59
+60
+61
+63
+62
+58
+55
+55
+56
+56
+56
+55
+65
+67
+56
+49
+51
+55
+53
+52
+51
+52
+54
+53
+53
+49
+47
+47
+47
+47
+48
+50
+52
+53
+52
+49
+47
+50
+54
+57
+58
+63
+69
+70
+64
+60
+64
+75
+78
+69
+59
+61
+60
+60
+59
+57
+58
+60
+63
+57
+60
+64
+67
+67
+68
+74
+79
+63
+62
+66
+73
+74
+70
+67
+67
+64
+66
+69
+74
+78
+79
+76
+72
+68
+78
+80
+72
+74
+86
+87
+81
+71
+72
+88
+147
+178
+155
+72
+47
+106
+149
+198
+225
+240
+251
+253
+246
+246
+245
+245
+246
+248
+250
+252
+252
+251
+250
+248
+247
+245
+244
+243
+243
+241
+233
+220
+209
+202
+201
+202
+205
+208
+200
+192
+53
+51
+50
+48
+48
+49
+50
+51
+54
+55
+56
+58
+60
+62
+64
+64
+68
+69
+72
+75
+75
+77
+76
+75
+76
+87
+105
+126
+143
+153
+158
+158
+152
+145
+138
+133
+126
+118
+107
+101
+90
+84
+75
+65
+60
+58
+55
+54
+53
+53
+54
+55
+58
+60
+62
+64
+63
+64
+65
+66
+65
+66
+65
+63
+61
+58
+55
+54
+54
+55
+56
+57
+60
+52
+48
+56
+66
+71
+63
+52
+59
+60
+63
+63
+62
+62
+63
+63
+56
+57
+58
+57
+57
+58
+58
+60
+62
+59
+57
+56
+56
+57
+56
+54
+55
+67
+64
+48
+44
+55
+60
+50
+51
+50
+50
+51
+51
+50
+47
+45
+47
+46
+48
+49
+52
+53
+54
+53
+55
+51
+51
+51
+53
+56
+60
+63
+89
+82
+72
+67
+69
+73
+69
+62
+58
+59
+58
+58
+58
+58
+62
+65
+65
+60
+60
+65
+69
+71
+73
+76
+66
+64
+67
+75
+78
+74
+70
+70
+65
+66
+69
+74
+78
+79
+78
+76
+77
+79
+77
+79
+87
+95
+85
+71
+86
+83
+100
+144
+137
+130
+95
+77
+104
+141
+187
+219
+238
+247
+250
+249
+250
+251
+250
+250
+250
+251
+252
+251
+251
+251
+250
+250
+247
+245
+242
+240
+237
+230
+221
+216
+215
+219
+222
+225
+228
+216
+206
+57
+56
+53
+50
+49
+49
+50
+51
+52
+53
+54
+56
+58
+60
+62
+63
+66
+67
+71
+74
+75
+76
+75
+74
+74
+87
+108
+130
+149
+160
+166
+169
+165
+160
+155
+152
+149
+145
+137
+131
+121
+113
+99
+86
+78
+71
+67
+66
+63
+61
+58
+57
+57
+59
+61
+64
+64
+65
+66
+67
+67
+67
+67
+65
+59
+61
+64
+68
+71
+72
+72
+71
+72
+61
+58
+70
+80
+74
+63
+56
+62
+62
+62
+63
+64
+64
+63
+60
+56
+56
+57
+57
+56
+56
+57
+59
+58
+58
+56
+56
+57
+58
+55
+54
+60
+62
+57
+50
+52
+59
+60
+51
+49
+49
+49
+50
+49
+47
+45
+44
+45
+47
+49
+51
+53
+54
+55
+55
+57
+56
+54
+52
+52
+55
+56
+55
+78
+88
+90
+81
+71
+68
+64
+62
+60
+60
+60
+58
+57
+59
+62
+65
+68
+64
+64
+70
+73
+72
+71
+73
+70
+66
+68
+76
+81
+79
+76
+75
+68
+68
+70
+73
+78
+79
+79
+80
+85
+84
+84
+89
+93
+92
+83
+74
+89
+87
+79
+94
+78
+86
+86
+89
+99
+128
+169
+208
+233
+241
+246
+252
+252
+253
+252
+251
+250
+249
+249
+248
+250
+250
+251
+250
+247
+242
+237
+234
+225
+221
+217
+217
+223
+231
+237
+241
+243
+231
+219
+61
+58
+55
+52
+50
+50
+50
+51
+52
+52
+54
+56
+58
+60
+61
+62
+66
+67
+70
+74
+75
+76
+75
+73
+74
+88
+109
+132
+151
+164
+173
+176
+177
+172
+167
+164
+163
+161
+155
+150
+146
+136
+121
+105
+93
+85
+80
+77
+74
+71
+66
+61
+58
+58
+60
+62
+64
+66
+67
+68
+68
+68
+69
+66
+67
+72
+81
+91
+97
+99
+98
+95
+88
+74
+72
+83
+88
+76
+65
+63
+66
+64
+65
+64
+65
+65
+61
+55
+55
+56
+56
+56
+54
+55
+56
+59
+55
+55
+55
+56
+57
+57
+56
+54
+65
+56
+51
+56
+61
+61
+57
+53
+50
+48
+48
+48
+47
+45
+44
+44
+45
+47
+50
+52
+53
+55
+55
+56
+55
+56
+55
+54
+55
+57
+55
+52
+52
+78
+100
+96
+79
+65
+59
+57
+62
+62
+60
+59
+57
+57
+60
+62
+68
+65
+69
+75
+76
+71
+69
+72
+73
+67
+69
+77
+83
+82
+79
+79
+72
+71
+71
+73
+78
+81
+82
+84
+84
+90
+96
+96
+86
+78
+81
+90
+93
+102
+80
+88
+83
+90
+79
+83
+92
+114
+152
+198
+226
+235
+242
+255
+255
+255
+255
+255
+253
+252
+251
+249
+248
+248
+249
+249
+245
+239
+232
+229
+221
+218
+217
+222
+232
+243
+250
+254
+250
+237
+224
+62
+61
+60
+58
+56
+54
+52
+51
+50
+50
+51
+52
+54
+57
+60
+62
+64
+67
+70
+73
+74
+75
+76
+78
+73
+82
+100
+126
+146
+160
+170
+176
+179
+178
+180
+178
+177
+175
+172
+171
+161
+154
+141
+127
+114
+101
+90
+82
+81
+81
+79
+72
+63
+58
+59
+63
+62
+66
+69
+68
+66
+67
+70
+75
+85
+101
+113
+114
+117
+119
+111
+95
+91
+88
+87
+87
+78
+65
+58
+59
+60
+61
+63
+64
+64
+63
+61
+59
+54
+54
+54
+55
+55
+56
+57
+56
+56
+57
+58
+57
+54
+54
+56
+58
+67
+61
+55
+64
+91
+108
+93
+63
+51
+50
+50
+47
+42
+40
+40
+43
+45
+48
+50
+49
+48
+49
+52
+58
+59
+60
+60
+60
+58
+57
+56
+55
+64
+56
+71
+99
+88
+66
+64
+52
+58
+60
+60
+60
+58
+58
+60
+62
+62
+67
+80
+88
+79
+63
+63
+72
+72
+71
+74
+80
+82
+78
+75
+76
+82
+79
+75
+74
+77
+81
+82
+82
+88
+89
+89
+92
+93
+91
+88
+86
+101
+89
+95
+94
+73
+73
+84
+88
+102
+103
+142
+181
+209
+234
+238
+248
+250
+255
+255
+255
+254
+255
+252
+247
+250
+250
+247
+243
+244
+243
+232
+217
+214
+209
+214
+231
+244
+247
+251
+255
+254
+240
+227
+63
+62
+61
+59
+57
+55
+54
+53
+51
+51
+51
+52
+53
+56
+59
+61
+63
+66
+69
+72
+73
+74
+75
+77
+74
+81
+98
+123
+143
+157
+166
+174
+180
+181
+182
+183
+183
+182
+180
+178
+170
+163
+152
+138
+127
+113
+101
+94
+87
+86
+84
+80
+73
+67
+65
+65
+60
+66
+69
+68
+63
+66
+77
+86
+103
+116
+125
+125
+124
+124
+113
+96
+89
+87
+81
+73
+64
+60
+61
+63
+56
+55
+56
+57
+56
+57
+55
+54
+51
+52
+55
+58
+60
+61
+60
+60
+62
+60
+60
+62
+66
+67
+66
+65
+64
+66
+64
+56
+49
+54
+73
+91
+64
+54
+43
+41
+45
+47
+44
+40
+48
+52
+54
+54
+51
+50
+50
+54
+58
+59
+60
+58
+57
+55
+53
+52
+57
+53
+61
+80
+84
+76
+66
+49
+59
+61
+60
+59
+57
+56
+58
+58
+62
+66
+79
+87
+82
+68
+67
+72
+76
+74
+77
+83
+84
+80
+78
+79
+86
+85
+83
+82
+82
+83
+83
+83
+76
+84
+92
+96
+91
+85
+82
+84
+87
+84
+93
+93
+82
+87
+93
+86
+96
+92
+127
+169
+199
+224
+233
+248
+250
+255
+255
+255
+254
+255
+253
+248
+250
+249
+247
+244
+245
+244
+233
+220
+215
+209
+213
+229
+245
+249
+252
+255
+253
+241
+227
+65
+65
+63
+61
+59
+57
+56
+55
+52
+52
+51
+52
+53
+56
+58
+60
+62
+66
+68
+70
+71
+71
+73
+74
+75
+80
+94
+117
+138
+153
+164
+171
+179
+181
+183
+185
+186
+187
+185
+185
+178
+172
+163
+151
+141
+128
+117
+109
+96
+93
+90
+87
+82
+75
+68
+64
+53
+60
+65
+64
+62
+69
+87
+99
+115
+122
+127
+123
+118
+112
+99
+84
+71
+76
+73
+61
+54
+58
+61
+61
+60
+59
+58
+59
+60
+60
+60
+60
+54
+56
+60
+63
+65
+62
+60
+58
+55
+52
+51
+57
+65
+69
+66
+61
+60
+52
+52
+55
+50
+44
+54
+71
+75
+64
+52
+45
+44
+44
+44
+42
+42
+47
+50
+53
+52
+49
+49
+51
+55
+58
+58
+58
+59
+58
+56
+56
+52
+60
+58
+60
+79
+89
+69
+51
+59
+60
+59
+58
+57
+56
+56
+56
+61
+65
+74
+85
+82
+71
+68
+71
+75
+73
+76
+83
+83
+80
+77
+78
+88
+90
+91
+90
+86
+82
+81
+81
+70
+79
+89
+90
+86
+84
+87
+92
+89
+91
+98
+98
+96
+105
+106
+94
+93
+77
+108
+151
+185
+211
+224
+245
+249
+255
+255
+255
+254
+255
+252
+248
+249
+249
+247
+246
+247
+246
+238
+228
+219
+209
+211
+228
+246
+251
+253
+255
+251
+239
+229
+69
+68
+66
+64
+62
+60
+59
+58
+54
+53
+53
+53
+53
+55
+57
+59
+62
+64
+68
+70
+69
+69
+71
+73
+77
+78
+90
+112
+134
+150
+161
+169
+176
+177
+179
+183
+183
+185
+184
+184
+177
+173
+167
+158
+150
+139
+129
+121
+109
+103
+96
+90
+88
+81
+71
+62
+53
+56
+61
+64
+67
+79
+93
+103
+108
+110
+111
+105
+97
+88
+73
+59
+51
+65
+69
+60
+56
+64
+65
+59
+54
+53
+53
+53
+55
+56
+59
+60
+64
+64
+64
+63
+61
+57
+54
+52
+46
+45
+46
+51
+58
+60
+56
+53
+53
+44
+41
+55
+66
+63
+52
+46
+70
+73
+72
+60
+45
+35
+39
+47
+45
+47
+50
+51
+49
+48
+47
+48
+55
+57
+58
+60
+62
+63
+64
+64
+54
+76
+74
+53
+71
+90
+73
+65
+60
+59
+58
+58
+58
+58
+57
+57
+60
+62
+70
+79
+80
+72
+67
+67
+72
+70
+74
+80
+82
+77
+75
+75
+88
+91
+97
+97
+88
+79
+77
+78
+76
+79
+83
+82
+84
+90
+99
+105
+102
+98
+98
+101
+103
+106
+106
+104
+94
+70
+93
+135
+171
+199
+218
+243
+247
+253
+255
+255
+254
+255
+251
+248
+250
+250
+248
+250
+251
+250
+243
+236
+224
+213
+212
+230
+247
+254
+254
+254
+249
+239
+231
+72
+71
+70
+68
+66
+64
+61
+60
+56
+55
+54
+54
+54
+55
+57
+58
+62
+65
+67
+69
+68
+69
+70
+72
+77
+77
+87
+107
+130
+147
+159
+166
+174
+175
+176
+179
+179
+180
+179
+179
+174
+171
+167
+162
+156
+149
+140
+133
+127
+117
+107
+101
+97
+91
+81
+72
+70
+67
+66
+69
+77
+85
+91
+90
+84
+83
+84
+80
+74
+67
+57
+47
+57
+68
+72
+63
+62
+71
+73
+63
+62
+61
+60
+62
+63
+66
+68
+69
+69
+66
+62
+59
+54
+53
+51
+51
+49
+52
+55
+57
+56
+55
+54
+53
+47
+53
+55
+50
+49
+57
+62
+59
+60
+68
+74
+68
+54
+42
+42
+47
+54
+53
+51
+49
+48
+47
+48
+48
+56
+57
+58
+59
+60
+61
+63
+62
+55
+87
+97
+59
+59
+80
+70
+80
+60
+58
+56
+57
+58
+60
+59
+59
+58
+60
+65
+72
+73
+68
+64
+62
+70
+69
+73
+80
+82
+78
+75
+76
+90
+94
+102
+104
+93
+80
+77
+79
+83
+82
+81
+82
+92
+103
+105
+101
+101
+94
+94
+106
+115
+107
+101
+110
+101
+71
+86
+123
+159
+193
+214
+238
+245
+252
+255
+255
+253
+255
+251
+248
+254
+253
+251
+253
+255
+253
+250
+246
+233
+221
+217
+233
+250
+255
+254
+254
+248
+240
+233
+75
+74
+73
+71
+69
+67
+64
+64
+59
+58
+57
+56
+56
+56
+58
+59
+63
+66
+69
+70
+69
+69
+70
+72
+76
+75
+83
+105
+129
+147
+158
+164
+172
+172
+173
+176
+177
+177
+176
+176
+172
+170
+168
+166
+163
+158
+153
+148
+146
+138
+128
+120
+117
+112
+103
+95
+95
+87
+80
+79
+83
+84
+80
+72
+65
+65
+69
+69
+69
+65
+59
+54
+74
+73
+66
+56
+57
+65
+68
+63
+69
+69
+70
+69
+70
+71
+71
+71
+62
+59
+56
+52
+51
+52
+52
+54
+56
+60
+61
+60
+57
+53
+53
+55
+46
+59
+61
+49
+45
+55
+61
+58
+57
+56
+58
+61
+64
+60
+51
+44
+44
+43
+42
+43
+47
+52
+56
+57
+55
+55
+55
+55
+55
+54
+53
+53
+53
+80
+109
+72
+52
+67
+62
+86
+65
+62
+56
+54
+58
+60
+62
+61
+57
+60
+63
+65
+65
+64
+61
+60
+67
+68
+72
+80
+82
+79
+78
+79
+94
+97
+105
+110
+100
+86
+81
+86
+86
+86
+87
+93
+109
+117
+106
+87
+95
+94
+96
+114
+135
+128
+117
+122
+106
+77
+85
+112
+149
+191
+213
+233
+244
+250
+254
+254
+253
+254
+250
+249
+255
+254
+253
+255
+255
+255
+252
+253
+241
+230
+226
+240
+251
+254
+254
+255
+250
+244
+240
+77
+76
+75
+73
+71
+69
+68
+67
+62
+61
+59
+58
+57
+58
+57
+59
+64
+67
+69
+71
+71
+70
+70
+72
+75
+72
+82
+103
+129
+147
+158
+162
+167
+167
+169
+172
+173
+174
+174
+174
+172
+170
+168
+167
+168
+167
+164
+162
+158
+154
+147
+143
+141
+136
+129
+121
+109
+99
+88
+81
+77
+73
+65
+62
+62
+65
+69
+74
+75
+71
+68
+65
+86
+72
+60
+54
+56
+59
+57
+56
+58
+60
+59
+58
+56
+55
+52
+50
+52
+51
+51
+51
+51
+53
+54
+56
+61
+61
+59
+56
+55
+54
+52
+51
+51
+51
+52
+54
+61
+62
+57
+50
+58
+52
+49
+53
+60
+61
+55
+51
+45
+45
+45
+47
+52
+57
+59
+57
+50
+48
+48
+49
+49
+50
+49
+51
+49
+61
+106
+84
+57
+64
+58
+82
+74
+67
+58
+54
+56
+59
+60
+61
+59
+63
+64
+63
+59
+59
+59
+60
+62
+62
+68
+76
+80
+78
+76
+78
+97
+97
+104
+111
+104
+90
+85
+91
+91
+95
+98
+107
+125
+133
+118
+92
+101
+107
+98
+106
+144
+161
+148
+140
+105
+81
+85
+103
+140
+190
+213
+227
+242
+249
+253
+253
+253
+253
+251
+248
+255
+253
+253
+255
+255
+253
+251
+255
+250
+240
+236
+246
+252
+252
+253
+255
+254
+249
+246
+79
+78
+75
+74
+71
+70
+68
+68
+64
+64
+60
+59
+57
+58
+58
+60
+64
+68
+70
+71
+71
+70
+72
+72
+73
+71
+81
+104
+130
+148
+157
+162
+160
+160
+163
+166
+169
+171
+172
+172
+171
+170
+167
+167
+169
+170
+168
+167
+161
+161
+159
+159
+155
+150
+141
+132
+102
+93
+82
+74
+66
+62
+60
+61
+64
+67
+70
+74
+74
+71
+67
+64
+83
+68
+57
+62
+68
+64
+56
+53
+67
+68
+67
+65
+62
+57
+54
+50
+50
+51
+52
+53
+53
+52
+52
+52
+66
+60
+54
+54
+57
+57
+53
+49
+56
+49
+49
+57
+56
+52
+55
+67
+55
+56
+54
+53
+51
+53
+58
+63
+76
+72
+66
+62
+60
+55
+50
+44
+43
+41
+44
+47
+49
+52
+53
+55
+48
+46
+100
+93
+64
+68
+59
+77
+82
+72
+59
+54
+56
+57
+59
+58
+60
+64
+65
+60
+56
+57
+60
+63
+55
+55
+62
+71
+75
+73
+73
+74
+97
+94
+100
+110
+107
+93
+88
+94
+97
+100
+104
+110
+127
+141
+131
+110
+112
+120
+97
+88
+136
+180
+173
+153
+104
+81
+84
+97
+136
+192
+215
+224
+241
+248
+253
+252
+253
+253
+252
+249
+255
+254
+252
+255
+255
+252
+251
+255
+255
+246
+242
+249
+253
+251
+252
+255
+255
+252
+251
+79
+80
+78
+78
+75
+75
+73
+72
+67
+67
+65
+64
+62
+63
+62
+64
+67
+69
+71
+73
+74
+74
+74
+75
+78
+76
+84
+104
+126
+143
+153
+159
+162
+161
+160
+161
+163
+167
+170
+173
+170
+169
+168
+169
+170
+170
+170
+170
+168
+166
+160
+159
+164
+160
+135
+105
+78
+70
+65
+61
+61
+62
+64
+64
+61
+61
+70
+59
+68
+69
+49
+74
+75
+67
+62
+59
+60
+61
+59
+60
+66
+63
+68
+77
+75
+61
+54
+57
+55
+54
+53
+50
+47
+47
+50
+53
+65
+56
+49
+50
+57
+59
+55
+50
+50
+51
+52
+51
+51
+51
+53
+53
+48
+50
+53
+54
+52
+51
+51
+52
+50
+51
+53
+51
+47
+45
+45
+46
+45
+43
+43
+47
+53
+57
+55
+52
+45
+51
+88
+89
+59
+78
+52
+72
+79
+74
+67
+59
+56
+56
+57
+60
+60
+59
+57
+59
+60
+61
+61
+60
+56
+59
+61
+63
+63
+64
+64
+65
+106
+112
+99
+109
+113
+97
+103
+112
+107
+104
+103
+101
+103
+109
+110
+109
+119
+126
+95
+105
+103
+174
+167
+141
+112
+89
+81
+110
+149
+182
+213
+238
+244
+245
+247
+251
+254
+255
+254
+255
+255
+252
+249
+254
+255
+255
+255
+253
+253
+251
+250
+250
+249
+250
+250
+250
+253
+255
+255
+80
+79
+79
+77
+76
+75
+74
+73
+69
+68
+67
+66
+65
+65
+65
+65
+67
+68
+70
+72
+74
+75
+75
+75
+78
+76
+85
+104
+125
+140
+149
+154
+156
+155
+157
+158
+161
+165
+170
+172
+172
+171
+167
+166
+164
+164
+162
+160
+166
+164
+160
+155
+153
+143
+115
+87
+70
+63
+59
+58
+59
+62
+64
+65
+60
+57
+65
+59
+66
+64
+51
+79
+67
+63
+59
+56
+56
+56
+58
+59
+69
+61
+60
+71
+76
+67
+58
+57
+55
+55
+54
+52
+50
+51
+53
+56
+61
+58
+53
+52
+52
+53
+51
+50
+56
+56
+56
+58
+58
+58
+55
+51
+51
+53
+55
+55
+54
+52
+52
+52
+50
+50
+48
+46
+44
+44
+45
+46
+43
+44
+48
+50
+52
+53
+56
+57
+63
+42
+68
+62
+70
+86
+66
+66
+85
+82
+75
+67
+61
+57
+57
+56
+59
+59
+58
+60
+62
+63
+64
+62
+58
+59
+61
+62
+63
+63
+66
+67
+105
+109
+98
+107
+111
+98
+107
+115
+111
+110
+107
+97
+92
+99
+110
+119
+117
+121
+89
+99
+99
+168
+162
+134
+114
+95
+90
+115
+157
+196
+225
+245
+248
+248
+249
+251
+254
+255
+254
+255
+255
+255
+251
+254
+255
+255
+255
+255
+253
+253
+251
+247
+244
+243
+245
+247
+249
+252
+253
+80
+79
+79
+77
+76
+75
+74
+74
+71
+70
+69
+67
+67
+67
+67
+67
+67
+70
+71
+73
+75
+75
+75
+75
+77
+77
+87
+105
+123
+137
+145
+150
+152
+151
+152
+156
+159
+163
+167
+169
+170
+168
+165
+162
+160
+158
+154
+153
+154
+152
+147
+140
+131
+115
+91
+70
+68
+65
+63
+62
+62
+62
+62
+62
+60
+56
+63
+65
+67
+60
+57
+87
+66
+62
+59
+57
+54
+54
+57
+59
+72
+59
+53
+65
+75
+72
+61
+56
+54
+55
+55
+54
+53
+55
+57
+61
+50
+51
+53
+52
+52
+54
+57
+62
+51
+51
+52
+53
+55
+55
+50
+44
+64
+62
+61
+60
+57
+55
+55
+55
+55
+51
+47
+46
+46
+46
+47
+46
+44
+48
+53
+53
+51
+52
+57
+62
+65
+49
+83
+59
+65
+67
+74
+84
+85
+83
+79
+74
+67
+60
+56
+54
+55
+55
+55
+58
+60
+62
+61
+61
+58
+59
+60
+61
+61
+63
+67
+69
+92
+103
+97
+108
+112
+97
+102
+106
+80
+94
+106
+104
+99
+102
+111
+117
+114
+111
+81
+90
+97
+158
+152
+122
+109
+100
+96
+119
+165
+209
+238
+248
+251
+252
+253
+255
+255
+255
+255
+255
+255
+252
+246
+247
+251
+251
+252
+255
+250
+250
+248
+242
+234
+232
+236
+242
+248
+252
+254
+80
+80
+79
+78
+77
+77
+76
+76
+73
+72
+71
+70
+70
+70
+70
+70
+69
+71
+73
+75
+76
+76
+76
+75
+76
+77
+86
+104
+121
+133
+141
+148
+148
+148
+149
+152
+155
+158
+161
+163
+165
+162
+159
+155
+153
+151
+147
+144
+131
+130
+124
+115
+102
+88
+72
+62
+68
+68
+69
+68
+66
+64
+62
+62
+63
+58
+63
+69
+65
+54
+62
+90
+65
+64
+61
+58
+56
+57
+60
+65
+69
+58
+50
+60
+69
+69
+62
+57
+56
+57
+56
+58
+56
+57
+59
+62
+48
+49
+51
+51
+52
+54
+56
+59
+54
+58
+59
+59
+58
+58
+59
+56
+67
+64
+64
+61
+57
+57
+58
+59
+60
+55
+49
+49
+49
+51
+49
+47
+50
+53
+55
+55
+53
+55
+59
+62
+59
+60
+94
+70
+51
+46
+64
+87
+117
+114
+106
+94
+80
+65
+53
+46
+56
+56
+56
+59
+60
+61
+61
+60
+59
+60
+60
+60
+59
+62
+66
+70
+77
+96
+97
+112
+116
+96
+93
+93
+70
+88
+105
+107
+104
+109
+113
+115
+111
+103
+74
+82
+93
+148
+145
+116
+106
+104
+103
+124
+170
+220
+245
+249
+249
+252
+254
+255
+255
+255
+252
+251
+247
+241
+234
+235
+237
+239
+243
+247
+246
+246
+246
+237
+227
+222
+226
+233
+244
+246
+249
+80
+80
+79
+79
+78
+77
+77
+77
+75
+74
+73
+73
+72
+73
+73
+73
+71
+73
+73
+76
+77
+77
+76
+76
+75
+75
+85
+101
+116
+126
+135
+143
+144
+145
+146
+148
+149
+151
+152
+154
+157
+155
+148
+144
+139
+135
+130
+125
+115
+110
+102
+92
+78
+65
+59
+59
+67
+71
+73
+73
+71
+66
+62
+61
+66
+62
+64
+73
+62
+50
+67
+85
+68
+65
+63
+62
+63
+64
+68
+70
+61
+56
+53
+57
+61
+61
+59
+60
+58
+59
+59
+59
+56
+56
+56
+57
+56
+52
+49
+50
+51
+52
+49
+47
+48
+54
+57
+54
+51
+51
+57
+62
+56
+55
+55
+53
+52
+53
+55
+58
+61
+56
+52
+53
+56
+58
+57
+56
+62
+59
+56
+55
+57
+60
+60
+58
+62
+58
+62
+67
+47
+58
+50
+53
+53
+59
+67
+75
+81
+83
+84
+85
+63
+63
+60
+61
+62
+63
+63
+62
+60
+60
+60
+61
+60
+61
+65
+68
+76
+98
+99
+110
+114
+96
+96
+95
+105
+109
+110
+100
+98
+109
+117
+118
+107
+95
+71
+75
+90
+137
+142
+121
+114
+117
+119
+136
+178
+226
+250
+253
+252
+255
+255
+255
+255
+251
+241
+237
+232
+227
+221
+222
+224
+226
+230
+235
+239
+242
+242
+235
+225
+219
+221
+226
+231
+231
+233
+79
+79
+79
+78
+78
+77
+77
+77
+76
+76
+75
+74
+74
+75
+75
+76
+73
+73
+75
+76
+77
+77
+76
+77
+75
+76
+83
+94
+106
+116
+125
+134
+138
+139
+141
+142
+143
+143
+144
+144
+148
+144
+136
+129
+123
+116
+110
+104
+105
+98
+88
+79
+65
+56
+53
+58
+66
+72
+76
+77
+73
+69
+63
+62
+67
+67
+65
+73
+59
+52
+73
+76
+66
+63
+59
+60
+64
+69
+71
+71
+56
+56
+56
+57
+57
+56
+58
+59
+59
+61
+60
+59
+56
+54
+54
+53
+50
+46
+43
+47
+51
+54
+52
+50
+46
+51
+53
+50
+46
+46
+53
+58
+48
+48
+51
+51
+53
+55
+57
+60
+56
+54
+54
+58
+62
+65
+65
+65
+71
+65
+59
+57
+60
+61
+60
+56
+58
+55
+48
+67
+50
+63
+47
+42
+49
+53
+56
+57
+56
+53
+50
+49
+69
+65
+61
+58
+57
+57
+58
+58
+59
+61
+62
+60
+60
+60
+62
+65
+83
+103
+99
+106
+110
+99
+106
+110
+110
+114
+112
+102
+103
+116
+117
+110
+103
+90
+72
+72
+87
+128
+146
+136
+134
+137
+138
+151
+183
+222
+244
+250
+255
+255
+255
+255
+249
+239
+227
+222
+213
+211
+209
+210
+213
+214
+218
+223
+230
+234
+237
+234
+227
+221
+218
+220
+219
+217
+216
+78
+78
+78
+78
+77
+77
+77
+77
+76
+76
+75
+75
+75
+76
+76
+77
+73
+74
+76
+76
+78
+77
+77
+78
+77
+76
+79
+87
+95
+102
+111
+121
+128
+130
+131
+133
+134
+136
+137
+137
+136
+131
+124
+118
+112
+107
+101
+95
+94
+85
+78
+74
+64
+54
+52
+58
+64
+70
+74
+75
+72
+68
+63
+63
+65
+70
+65
+72
+58
+55
+79
+66
+61
+54
+49
+53
+62
+69
+70
+68
+57
+58
+58
+58
+56
+57
+58
+58
+57
+58
+58
+57
+55
+53
+51
+51
+42
+42
+45
+46
+49
+50
+51
+53
+55
+55
+57
+56
+56
+55
+53
+53
+42
+45
+49
+52
+54
+56
+59
+61
+53
+56
+59
+61
+62
+61
+62
+65
+74
+71
+65
+60
+57
+57
+56
+57
+50
+57
+64
+68
+48
+46
+52
+54
+51
+55
+57
+58
+59
+59
+58
+59
+76
+70
+64
+57
+54
+54
+55
+56
+59
+61
+62
+61
+60
+60
+60
+61
+75
+100
+99
+107
+111
+105
+114
+117
+101
+111
+116
+111
+111
+120
+116
+101
+98
+84
+72
+68
+81
+118
+149
+153
+150
+151
+149
+157
+178
+204
+224
+236
+244
+241
+235
+228
+221
+212
+203
+199
+193
+194
+195
+201
+203
+203
+206
+211
+217
+222
+227
+229
+226
+219
+212
+209
+205
+203
+198
+78
+77
+77
+77
+77
+77
+76
+76
+77
+76
+76
+75
+75
+76
+77
+76
+74
+74
+76
+78
+77
+77
+77
+77
+79
+77
+77
+82
+88
+93
+102
+113
+119
+122
+125
+128
+129
+131
+132
+132
+125
+121
+116
+111
+109
+105
+101
+95
+79
+72
+69
+71
+66
+58
+54
+58
+62
+66
+69
+70
+69
+67
+63
+64
+64
+71
+65
+71
+57
+58
+85
+62
+56
+47
+42
+47
+58
+67
+67
+62
+59
+59
+60
+58
+59
+60
+59
+56
+53
+55
+56
+55
+53
+51
+51
+50
+51
+54
+56
+52
+45
+40
+40
+43
+45
+41
+38
+41
+44
+42
+32
+25
+34
+40
+44
+48
+49
+51
+53
+54
+54
+57
+61
+62
+58
+55
+53
+57
+72
+75
+69
+61
+54
+51
+54
+56
+52
+54
+67
+56
+50
+32
+56
+54
+49
+52
+52
+53
+54
+54
+53
+55
+89
+82
+72
+64
+59
+59
+60
+60
+57
+59
+61
+61
+59
+57
+57
+58
+60
+89
+98
+112
+118
+109
+113
+114
+121
+127
+124
+109
+104
+114
+115
+105
+92
+80
+71
+64
+78
+112
+152
+163
+156
+154
+151
+156
+169
+186
+205
+220
+215
+210
+202
+193
+187
+182
+178
+176
+180
+181
+186
+192
+195
+196
+197
+201
+206
+210
+218
+224
+222
+216
+205
+199
+193
+188
+182
+77
+77
+77
+77
+77
+77
+77
+77
+75
+75
+75
+76
+76
+77
+77
+77
+76
+76
+77
+78
+77
+79
+79
+79
+77
+77
+76
+78
+80
+85
+89
+93
+103
+109
+114
+116
+119
+126
+131
+131
+126
+126
+120
+112
+112
+114
+106
+90
+71
+66
+65
+68
+64
+58
+60
+68
+62
+62
+62
+65
+67
+68
+66
+67
+63
+64
+63
+62
+60
+60
+68
+77
+54
+59
+50
+51
+67
+63
+54
+62
+55
+58
+60
+59
+57
+57
+58
+58
+58
+57
+54
+50
+46
+47
+55
+61
+57
+54
+49
+43
+40
+38
+38
+38
+38
+33
+34
+39
+41
+33
+24
+23
+37
+34
+34
+43
+45
+42
+44
+50
+54
+54
+54
+54
+49
+46
+44
+47
+57
+58
+57
+83
+34
+43
+70
+46
+46
+60
+69
+58
+47
+46
+53
+60
+62
+60
+53
+51
+53
+59
+59
+56
+98
+90
+67
+54
+58
+56
+51
+54
+48
+50
+50
+52
+54
+58
+60
+61
+58
+67
+92
+112
+115
+120
+121
+113
+122
+119
+117
+118
+116
+114
+107
+100
+94
+74
+69
+70
+70
+103
+144
+155
+156
+153
+148
+151
+159
+166
+168
+168
+163
+163
+159
+154
+154
+157
+160
+164
+172
+177
+183
+188
+190
+189
+189
+189
+188
+189
+195
+205
+212
+211
+200
+192
+185
+177
+168
+77
+77
+77
+77
+77
+77
+77
+77
+75
+75
+75
+76
+76
+77
+77
+77
+76
+77
+76
+77
+78
+79
+79
+79
+80
+79
+78
+78
+80
+83
+85
+88
+93
+100
+105
+108
+113
+122
+128
+128
+128
+125
+116
+108
+111
+115
+103
+86
+61
+55
+54
+61
+65
+63
+64
+65
+61
+59
+60
+62
+66
+66
+66
+66
+60
+61
+60
+59
+58
+58
+65
+74
+71
+65
+54
+53
+64
+67
+57
+53
+56
+59
+61
+61
+59
+59
+58
+57
+57
+54
+50
+50
+53
+56
+56
+57
+50
+49
+47
+45
+44
+45
+46
+46
+42
+37
+36
+39
+37
+29
+20
+19
+29
+45
+50
+41
+39
+45
+47
+42
+58
+55
+52
+50
+47
+48
+50
+56
+50
+59
+56
+69
+69
+47
+50
+34
+53
+63
+69
+61
+51
+50
+54
+58
+58
+57
+53
+53
+57
+60
+60
+57
+99
+88
+64
+52
+57
+58
+54
+57
+53
+52
+52
+53
+54
+53
+54
+54
+59
+66
+89
+108
+113
+120
+124
+117
+122
+119
+119
+118
+117
+111
+104
+97
+93
+75
+68
+70
+73
+102
+138
+146
+147
+146
+142
+144
+149
+152
+149
+148
+135
+137
+137
+141
+143
+149
+155
+158
+171
+177
+183
+186
+187
+187
+188
+187
+181
+179
+183
+190
+199
+200
+195
+188
+181
+172
+163
+76
+76
+76
+76
+76
+76
+76
+76
+74
+74
+74
+75
+75
+76
+76
+76
+76
+76
+75
+77
+78
+79
+79
+79
+82
+81
+80
+78
+79
+80
+81
+82
+84
+89
+95
+99
+108
+119
+126
+125
+132
+128
+118
+111
+115
+117
+104
+81
+61
+54
+54
+61
+68
+69
+66
+63
+61
+58
+58
+61
+64
+66
+65
+66
+59
+57
+57
+57
+56
+57
+63
+70
+68
+57
+55
+59
+67
+79
+72
+51
+57
+58
+59
+61
+61
+60
+58
+57
+55
+50
+47
+52
+61
+63
+57
+52
+54
+54
+50
+48
+46
+45
+44
+44
+44
+40
+39
+41
+37
+30
+22
+24
+37
+47
+52
+53
+57
+58
+53
+45
+50
+47
+46
+45
+46
+46
+47
+52
+48
+61
+54
+59
+109
+67
+47
+47
+58
+64
+65
+60
+55
+53
+53
+54
+54
+54
+54
+56
+59
+60
+60
+59
+96
+84
+60
+48
+59
+62
+59
+61
+61
+60
+61
+60
+59
+57
+54
+54
+59
+64
+84
+103
+111
+122
+129
+123
+122
+121
+122
+121
+117
+110
+99
+92
+89
+73
+65
+70
+76
+97
+122
+128
+130
+133
+131
+133
+136
+136
+132
+130
+122
+127
+133
+141
+149
+156
+160
+163
+171
+176
+180
+184
+184
+185
+186
+186
+177
+172
+170
+174
+181
+186
+185
+183
+171
+160
+150
+75
+75
+75
+75
+75
+75
+75
+75
+74
+74
+74
+75
+75
+76
+76
+76
+75
+75
+76
+77
+77
+79
+79
+79
+81
+81
+79
+79
+78
+78
+79
+79
+80
+84
+89
+94
+104
+117
+124
+123
+132
+133
+128
+122
+120
+116
+99
+77
+72
+67
+67
+70
+73
+72
+69
+65
+64
+60
+60
+62
+65
+66
+65
+64
+63
+60
+57
+58
+57
+56
+62
+68
+60
+51
+59
+65
+68
+83
+85
+58
+57
+55
+55
+59
+61
+61
+57
+56
+52
+50
+50
+57
+62
+62
+53
+47
+54
+55
+52
+50
+46
+46
+44
+44
+42
+39
+40
+42
+39
+34
+31
+37
+56
+40
+44
+77
+93
+78
+60
+58
+41
+42
+45
+48
+50
+48
+43
+40
+48
+55
+50
+67
+115
+86
+62
+71
+61
+60
+58
+56
+55
+54
+52
+51
+53
+54
+56
+59
+60
+57
+58
+60
+88
+77
+55
+48
+60
+65
+59
+60
+62
+61
+63
+64
+63
+60
+58
+57
+57
+61
+78
+99
+110
+124
+132
+125
+118
+119
+122
+122
+118
+109
+98
+91
+84
+71
+61
+68
+79
+91
+104
+109
+115
+121
+122
+125
+129
+131
+129
+129
+135
+142
+149
+157
+164
+168
+170
+170
+172
+176
+179
+182
+183
+183
+184
+184
+180
+171
+165
+165
+172
+180
+184
+184
+171
+158
+146
+75
+75
+75
+75
+75
+75
+75
+75
+74
+74
+74
+75
+75
+76
+76
+76
+76
+75
+75
+77
+77
+78
+79
+79
+79
+78
+78
+79
+78
+79
+80
+79
+78
+80
+84
+89
+101
+114
+119
+118
+125
+134
+137
+130
+119
+108
+89
+69
+70
+73
+77
+76
+71
+69
+69
+67
+66
+63
+63
+65
+68
+68
+66
+63
+65
+61
+58
+58
+57
+56
+59
+63
+70
+61
+66
+65
+59
+74
+88
+75
+64
+56
+51
+56
+60
+58
+55
+56
+48
+51
+56
+59
+58
+54
+48
+44
+48
+50
+49
+50
+51
+51
+53
+53
+46
+45
+47
+49
+46
+42
+44
+52
+58
+51
+62
+92
+104
+85
+67
+64
+51
+51
+51
+54
+57
+56
+52
+47
+50
+46
+55
+89
+92
+88
+65
+72
+66
+60
+55
+54
+56
+57
+55
+53
+56
+57
+58
+61
+59
+54
+55
+61
+78
+69
+53
+49
+62
+64
+56
+53
+50
+50
+53
+56
+58
+58
+57
+58
+54
+56
+73
+95
+110
+125
+133
+126
+116
+118
+122
+123
+116
+108
+97
+90
+81
+72
+62
+69
+83
+86
+91
+98
+112
+118
+121
+126
+129
+133
+136
+140
+149
+154
+160
+167
+170
+171
+171
+169
+172
+174
+178
+180
+181
+182
+184
+184
+183
+173
+164
+165
+174
+186
+193
+198
+186
+170
+156
+74
+74
+74
+74
+74
+74
+74
+74
+74
+74
+74
+75
+75
+76
+76
+76
+75
+75
+75
+76
+77
+78
+79
+79
+78
+78
+79
+79
+79
+80
+81
+80
+76
+77
+79
+85
+96
+111
+116
+113
+118
+131
+140
+131
+116
+101
+81
+63
+55
+64
+73
+71
+65
+66
+67
+67
+67
+64
+64
+66
+68
+68
+66
+63
+64
+59
+56
+57
+57
+56
+58
+59
+73
+63
+61
+55
+50
+65
+90
+104
+80
+65
+53
+54
+57
+57
+55
+56
+48
+54
+59
+59
+52
+47
+45
+45
+52
+52
+51
+50
+49
+49
+48
+49
+49
+50
+53
+53
+49
+46
+49
+62
+51
+78
+95
+92
+84
+79
+68
+56
+65
+58
+50
+47
+50
+56
+59
+58
+58
+50
+74
+107
+76
+80
+59
+59
+76
+64
+55
+55
+60
+60
+58
+59
+59
+58
+60
+62
+57
+51
+58
+68
+71
+67
+55
+50
+59
+58
+50
+50
+44
+44
+46
+51
+55
+58
+60
+62
+54
+52
+66
+88
+106
+124
+134
+127
+117
+119
+123
+122
+114
+105
+94
+89
+79
+75
+64
+70
+85
+83
+84
+96
+115
+124
+129
+134
+136
+139
+144
+151
+156
+159
+164
+168
+169
+170
+169
+169
+170
+173
+175
+178
+178
+180
+182
+184
+181
+173
+166
+169
+181
+196
+206
+210
+194
+178
+161
+75
+75
+75
+75
+75
+75
+75
+75
+75
+75
+75
+76
+76
+77
+77
+76
+75
+74
+75
+76
+77
+78
+79
+79
+79
+80
+79
+80
+80
+80
+80
+78
+75
+75
+78
+84
+97
+112
+118
+115
+117
+128
+134
+127
+113
+101
+82
+62
+47
+55
+65
+64
+63
+66
+67
+65
+65
+64
+63
+65
+67
+66
+64
+62
+62
+57
+55
+58
+60
+60
+61
+63
+61
+57
+48
+47
+52
+57
+77
+108
+104
+81
+60
+58
+58
+55
+54
+56
+52
+55
+57
+54
+49
+47
+49
+49
+50
+48
+45
+43
+38
+35
+32
+32
+39
+43
+47
+49
+44
+42
+51
+66
+67
+95
+103
+85
+74
+74
+65
+49
+64
+55
+45
+40
+46
+56
+63
+64
+63
+58
+89
+93
+71
+68
+54
+59
+85
+70
+57
+56
+58
+57
+57
+61
+63
+60
+59
+61
+55
+51
+61
+76
+71
+69
+57
+51
+55
+53
+48
+49
+44
+43
+46
+49
+52
+56
+59
+62
+57
+51
+59
+78
+97
+121
+136
+131
+121
+122
+124
+122
+111
+101
+90
+86
+75
+74
+64
+69
+84
+77
+77
+94
+114
+126
+136
+142
+144
+146
+151
+158
+164
+166
+167
+168
+168
+169
+169
+168
+167
+169
+172
+174
+175
+177
+181
+183
+179
+173
+168
+173
+185
+199
+207
+210
+192
+174
+156
+74
+75
+74
+75
+74
+75
+74
+75
+74
+75
+74
+76
+75
+77
+76
+76
+75
+75
+75
+77
+77
+79
+79
+79
+81
+82
+82
+81
+81
+80
+79
+76
+77
+76
+79
+87
+101
+117
+124
+120
+122
+129
+132
+126
+117
+109
+90
+70
+52
+58
+64
+63
+65
+69
+66
+60
+63
+62
+62
+64
+66
+65
+62
+61
+63
+59
+56
+60
+63
+64
+65
+67
+55
+56
+46
+51
+58
+48
+53
+85
+119
+91
+67
+60
+59
+55
+54
+58
+55
+56
+54
+51
+48
+49
+51
+53
+37
+35
+34
+33
+32
+31
+29
+30
+28
+32
+39
+41
+39
+41
+53
+70
+96
+94
+85
+80
+80
+75
+62
+48
+61
+54
+47
+46
+52
+59
+63
+61
+57
+56
+86
+59
+63
+52
+50
+67
+87
+72
+57
+54
+54
+53
+53
+58
+60
+58
+55
+57
+52
+49
+63
+82
+73
+72
+59
+50
+52
+49
+45
+50
+44
+43
+43
+43
+45
+49
+52
+56
+61
+50
+55
+73
+92
+119
+137
+134
+126
+125
+125
+119
+107
+96
+87
+83
+68
+71
+59
+65
+81
+73
+70
+93
+109
+125
+140
+150
+152
+155
+160
+165
+172
+171
+170
+167
+165
+165
+165
+165
+164
+166
+170
+172
+173
+175
+179
+182
+182
+176
+173
+176
+188
+198
+203
+205
+191
+171
+152
+75
+75
+75
+75
+75
+75
+75
+75
+76
+76
+76
+76
+76
+76
+76
+76
+74
+75
+76
+76
+76
+78
+80
+83
+83
+82
+80
+81
+82
+81
+78
+76
+75
+75
+79
+91
+107
+123
+133
+137
+132
+136
+136
+130
+121
+114
+106
+97
+77
+65
+61
+66
+69
+65
+61
+62
+59
+59
+58
+59
+60
+59
+58
+57
+54
+65
+60
+54
+65
+70
+61
+55
+56
+55
+53
+54
+56
+60
+58
+54
+59
+83
+90
+69
+56
+62
+66
+58
+50
+71
+47
+54
+55
+45
+66
+40
+38
+41
+41
+29
+34
+39
+39
+29
+31
+44
+33
+38
+44
+33
+86
+43
+92
+94
+89
+84
+79
+71
+62
+54
+61
+64
+62
+54
+49
+53
+58
+59
+56
+55
+69
+59
+51
+54
+53
+68
+76
+75
+68
+58
+52
+53
+52
+53
+60
+57
+47
+40
+45
+57
+67
+72
+80
+69
+55
+48
+48
+50
+49
+49
+47
+48
+48
+48
+48
+50
+53
+57
+61
+50
+62
+61
+95
+115
+143
+132
+135
+132
+120
+104
+95
+92
+86
+77
+72
+60
+62
+66
+94
+63
+67
+91
+116
+134
+150
+156
+157
+161
+166
+168
+167
+166
+165
+165
+164
+163
+163
+163
+165
+166
+171
+172
+173
+174
+177
+179
+181
+180
+177
+174
+180
+189
+194
+193
+175
+152
+135
+75
+75
+75
+75
+75
+75
+75
+75
+76
+76
+76
+76
+76
+76
+76
+75
+75
+76
+77
+78
+78
+78
+81
+82
+83
+81
+79
+79
+78
+80
+79
+77
+76
+78
+83
+95
+111
+126
+136
+139
+150
+140
+127
+120
+121
+124
+117
+105
+94
+81
+71
+74
+76
+71
+64
+60
+57
+58
+57
+60
+61
+60
+58
+59
+60
+63
+56
+58
+65
+60
+54
+60
+53
+53
+53
+52
+56
+58
+59
+57
+54
+65
+77
+73
+62
+56
+56
+59
+58
+73
+48
+55
+54
+46
+63
+37
+36
+37
+41
+43
+42
+40
+40
+43
+36
+37
+37
+59
+26
+50
+63
+35
+104
+97
+90
+86
+78
+65
+59
+61
+55
+66
+71
+61
+47
+39
+38
+39
+45
+58
+84
+72
+53
+52
+61
+87
+71
+71
+65
+57
+51
+54
+55
+55
+61
+57
+53
+50
+52
+56
+63
+69
+74
+65
+54
+48
+48
+50
+48
+48
+48
+49
+48
+47
+48
+49
+52
+57
+61
+51
+60
+61
+94
+118
+144
+133
+134
+128
+115
+100
+92
+89
+84
+76
+68
+61
+66
+74
+83
+61
+67
+92
+118
+135
+149
+156
+157
+161
+165
+166
+165
+165
+164
+163
+161
+161
+161
+162
+163
+166
+169
+170
+171
+173
+175
+177
+176
+178
+175
+171
+171
+172
+170
+162
+133
+111
+95
+76
+76
+76
+76
+76
+76
+76
+76
+76
+76
+76
+76
+76
+76
+76
+76
+75
+78
+80
+80
+80
+79
+79
+82
+81
+81
+79
+79
+80
+81
+84
+84
+84
+86
+92
+105
+118
+131
+138
+142
+146
+139
+131
+125
+128
+131
+126
+115
+102
+85
+73
+72
+73
+71
+65
+61
+55
+55
+56
+60
+63
+63
+61
+61
+61
+60
+58
+66
+72
+59
+48
+58
+54
+54
+55
+56
+55
+56
+57
+58
+52
+52
+65
+79
+72
+53
+50
+64
+62
+72
+48
+53
+54
+49
+66
+46
+41
+35
+36
+49
+45
+39
+38
+49
+40
+55
+42
+40
+50
+81
+59
+89
+94
+85
+78
+76
+69
+58
+55
+62
+53
+62
+65
+60
+55
+49
+43
+38
+36
+47
+69
+58
+44
+51
+65
+94
+63
+67
+65
+61
+57
+61
+64
+64
+64
+61
+62
+65
+62
+58
+63
+73
+66
+60
+53
+50
+49
+51
+49
+48
+48
+48
+48
+47
+48
+49
+52
+57
+62
+52
+56
+59
+91
+122
+147
+135
+129
+124
+113
+100
+90
+85
+79
+73
+65
+63
+71
+84
+64
+56
+70
+95
+119
+135
+147
+152
+154
+158
+163
+163
+162
+162
+161
+160
+159
+160
+160
+160
+162
+164
+167
+168
+169
+169
+171
+174
+178
+181
+178
+172
+166
+158
+147
+134
+99
+79
+65
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+76
+78
+80
+81
+80
+78
+79
+80
+79
+81
+85
+88
+88
+89
+92
+94
+96
+99
+107
+116
+126
+135
+141
+143
+135
+139
+138
+129
+121
+123
+129
+130
+116
+100
+88
+79
+73
+68
+63
+60
+54
+55
+57
+60
+64
+64
+64
+63
+57
+62
+61
+70
+82
+72
+53
+49
+57
+56
+59
+61
+59
+54
+54
+56
+53
+50
+61
+78
+75
+58
+56
+66
+54
+62
+47
+48
+50
+52
+74
+70
+62
+51
+36
+47
+44
+50
+42
+47
+57
+26
+50
+43
+56
+68
+87
+75
+60
+64
+66
+62
+57
+56
+55
+57
+56
+56
+57
+64
+77
+85
+77
+66
+55
+57
+75
+77
+81
+89
+82
+89
+53
+62
+66
+64
+63
+66
+67
+64
+63
+56
+57
+63
+58
+53
+62
+77
+57
+54
+51
+51
+52
+51
+50
+48
+48
+47
+48
+47
+47
+48
+52
+56
+63
+54
+53
+57
+86
+124
+147
+135
+128
+121
+110
+99
+88
+80
+72
+67
+61
+66
+77
+90
+50
+57
+77
+101
+123
+137
+146
+149
+152
+157
+161
+162
+160
+160
+159
+158
+159
+159
+159
+160
+162
+163
+167
+167
+168
+168
+171
+173
+178
+180
+179
+173
+166
+157
+142
+128
+98
+82
+71
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+77
+75
+77
+80
+80
+79
+78
+79
+81
+80
+87
+96
+102
+104
+103
+103
+103
+108
+112
+118
+124
+130
+135
+139
+140
+142
+141
+132
+117
+108
+110
+117
+118
+115
+109
+104
+95
+83
+71
+60
+55
+53
+54
+57
+60
+64
+65
+65
+64
+55
+64
+58
+59
+82
+92
+77
+59
+57
+55
+57
+62
+61
+54
+52
+54
+51
+55
+61
+69
+70
+66
+65
+62
+48
+55
+48
+45
+44
+51
+76
+87
+90
+79
+46
+48
+44
+69
+54
+44
+44
+61
+49
+50
+98
+61
+41
+45
+38
+59
+65
+55
+51
+57
+55
+47
+52
+59
+71
+83
+96
+105
+101
+94
+64
+69
+94
+104
+111
+106
+75
+61
+52
+62
+68
+67
+62
+60
+58
+52
+53
+45
+44
+46
+44
+44
+57
+74
+51
+51
+51
+51
+53
+52
+52
+50
+48
+47
+47
+46
+47
+48
+51
+55
+63
+56
+50
+56
+78
+124
+146
+135
+126
+117
+108
+97
+85
+74
+64
+59
+58
+68
+80
+87
+46
+62
+84
+106
+124
+137
+146
+150
+153
+158
+161
+160
+159
+159
+157
+158
+158
+159
+159
+161
+162
+165
+166
+167
+167
+168
+170
+172
+172
+175
+174
+170
+165
+160
+149
+138
+119
+107
+97
+78
+78
+78
+78
+78
+78
+78
+78
+78
+78
+78
+78
+78
+78
+78
+78
+76
+78
+78
+79
+78
+79
+83
+84
+90
+98
+109
+117
+117
+113
+112
+112
+116
+119
+124
+128
+131
+134
+138
+141
+144
+139
+133
+131
+132
+126
+107
+82
+78
+82
+88
+88
+84
+75
+63
+52
+56
+57
+58
+61
+64
+65
+63
+62
+57
+65
+53
+46
+73
+103
+100
+85
+60
+54
+51
+58
+59
+54
+51
+54
+49
+55
+59
+57
+62
+70
+66
+57
+48
+52
+51
+45
+41
+47
+66
+82
+93
+92
+57
+57
+43
+74
+56
+47
+51
+39
+37
+87
+61
+57
+54
+31
+40
+61
+66
+53
+44
+49
+48
+41
+52
+76
+98
+105
+100
+96
+96
+98
+76
+78
+92
+86
+77
+72
+52
+51
+65
+75
+79
+74
+64
+58
+54
+46
+50
+45
+42
+39
+41
+48
+62
+74
+49
+51
+51
+53
+52
+52
+52
+51
+48
+47
+46
+45
+46
+47
+50
+55
+61
+59
+49
+55
+67
+121
+141
+136
+123
+113
+104
+96
+83
+69
+58
+55
+58
+72
+80
+74
+52
+66
+87
+106
+124
+136
+145
+149
+153
+158
+160
+158
+155
+156
+155
+156
+157
+158
+159
+161
+161
+164
+167
+166
+166
+167
+169
+170
+170
+173
+172
+169
+167
+165
+157
+148
+137
+128
+120
+80
+80
+80
+80
+80
+80
+80
+80
+79
+79
+79
+79
+79
+79
+79
+78
+80
+80
+79
+79
+79
+82
+86
+90
+103
+111
+122
+126
+124
+119
+117
+118
+121
+125
+129
+132
+134
+138
+142
+147
+147
+150
+156
+167
+173
+166
+136
+103
+70
+65
+65
+66
+72
+78
+74
+63
+61
+59
+59
+60
+64
+63
+62
+60
+58
+63
+52
+49
+73
+99
+104
+101
+79
+62
+52
+55
+57
+53
+50
+54
+48
+52
+55
+55
+62
+67
+62
+52
+51
+47
+51
+46
+45
+48
+54
+64
+77
+89
+70
+81
+51
+70
+56
+65
+53
+44
+46
+70
+55
+55
+35
+59
+57
+60
+62
+55
+46
+42
+50
+61
+77
+95
+109
+106
+97
+91
+90
+92
+100
+90
+87
+64
+49
+52
+51
+67
+74
+82
+83
+74
+63
+57
+56
+51
+46
+48
+48
+42
+46
+59
+67
+65
+49
+52
+52
+53
+52
+51
+52
+52
+48
+47
+46
+45
+46
+47
+50
+55
+58
+62
+49
+55
+59
+115
+138
+135
+116
+104
+97
+92
+82
+68
+55
+56
+61
+78
+81
+57
+60
+68
+86
+100
+119
+133
+142
+148
+154
+158
+158
+155
+152
+153
+154
+154
+155
+156
+157
+159
+161
+162
+165
+164
+164
+164
+165
+167
+169
+172
+171
+168
+165
+162
+154
+145
+132
+128
+121
+80
+80
+80
+80
+80
+80
+80
+80
+79
+79
+79
+79
+79
+79
+79
+78
+81
+81
+80
+80
+80
+84
+90
+95
+114
+120
+128
+129
+126
+121
+117
+119
+124
+127
+133
+136
+138
+143
+150
+157
+167
+172
+179
+184
+190
+193
+187
+172
+111
+92
+71
+62
+71
+87
+87
+78
+64
+61
+60
+61
+61
+61
+59
+57
+56
+60
+58
+61
+79
+88
+93
+101
+99
+76
+58
+56
+57
+52
+50
+54
+52
+50
+53
+60
+67
+67
+58
+51
+52
+45
+48
+48
+52
+54
+46
+50
+66
+88
+87
+111
+68
+72
+60
+91
+109
+59
+123
+108
+81
+61
+48
+59
+72
+59
+56
+62
+56
+46
+64
+95
+110
+107
+100
+94
+95
+99
+95
+90
+93
+80
+74
+55
+47
+53
+48
+57
+68
+74
+73
+64
+54
+52
+55
+54
+39
+48
+50
+43
+48
+62
+63
+52
+51
+53
+54
+52
+51
+51
+52
+52
+48
+47
+46
+45
+46
+47
+50
+55
+57
+63
+48
+54
+54
+112
+135
+134
+110
+99
+94
+90
+81
+67
+57
+59
+67
+84
+82
+48
+68
+69
+83
+93
+115
+129
+139
+146
+152
+157
+156
+153
+151
+151
+151
+152
+153
+155
+155
+158
+158
+161
+163
+163
+162
+162
+163
+165
+164
+166
+166
+161
+156
+151
+140
+130
+117
+113
+107
+76
+78
+80
+80
+79
+79
+79
+81
+82
+79
+77
+77
+81
+83
+82
+81
+83
+80
+80
+81
+81
+83
+97
+113
+120
+124
+128
+129
+127
+122
+115
+111
+119
+124
+131
+141
+151
+164
+176
+185
+197
+204
+207
+207
+207
+209
+203
+194
+168
+128
+93
+122
+116
+72
+81
+99
+75
+63
+57
+59
+58
+55
+54
+59
+56
+53
+66
+60
+73
+88
+79
+100
+99
+88
+71
+58
+54
+55
+54
+52
+48
+50
+55
+61
+60
+55
+53
+55
+47
+47
+47
+49
+50
+52
+53
+54
+55
+74
+89
+78
+56
+54
+88
+126
+120
+107
+99
+102
+101
+92
+89
+91
+87
+70
+58
+57
+51
+45
+50
+62
+85
+97
+104
+103
+100
+100
+97
+94
+83
+70
+56
+52
+49
+47
+51
+57
+68
+66
+63
+60
+57
+56
+57
+54
+55
+52
+52
+52
+54
+53
+51
+49
+51
+53
+55
+53
+51
+50
+50
+50
+49
+48
+47
+46
+47
+48
+51
+55
+63
+56
+54
+47
+59
+88
+152
+123
+109
+102
+93
+81
+72
+68
+61
+59
+79
+84
+61
+44
+58
+70
+77
+94
+105
+120
+136
+146
+150
+149
+150
+152
+149
+150
+151
+152
+153
+155
+156
+156
+155
+157
+160
+161
+162
+162
+161
+160
+165
+163
+158
+151
+139
+126
+114
+106
+85
+85
+84
+75
+78
+80
+80
+80
+79
+80
+81
+82
+80
+79
+80
+82
+83
+82
+80
+86
+81
+79
+84
+90
+96
+107
+119
+121
+125
+127
+124
+117
+112
+111
+113
+119
+126
+137
+152
+167
+182
+197
+206
+214
+219
+222
+221
+219
+216
+209
+199
+188
+155
+124
+138
+125
+86
+96
+114
+90
+75
+63
+62
+63
+59
+54
+54
+61
+56
+63
+54
+62
+75
+72
+93
+111
+96
+72
+53
+48
+54
+53
+48
+53
+57
+61
+60
+56
+53
+52
+53
+55
+53
+50
+48
+48
+50
+52
+53
+56
+62
+74
+87
+94
+92
+93
+97
+79
+74
+78
+92
+104
+101
+89
+79
+53
+45
+44
+47
+40
+34
+41
+57
+81
+92
+100
+101
+102
+101
+92
+82
+69
+60
+54
+54
+53
+51
+50
+54
+62
+62
+59
+58
+56
+56
+57
+58
+57
+55
+55
+55
+55
+54
+51
+50
+51
+54
+55
+54
+50
+49
+49
+50
+49
+48
+47
+46
+47
+48
+51
+55
+60
+61
+56
+49
+55
+90
+144
+115
+103
+94
+87
+80
+71
+65
+61
+66
+81
+76
+60
+50
+57
+65
+71
+83
+99
+114
+131
+143
+147
+147
+147
+148
+146
+148
+149
+150
+151
+153
+154
+154
+155
+157
+159
+159
+158
+158
+157
+156
+152
+148
+140
+129
+117
+105
+93
+87
+87
+87
+87
+76
+78
+81
+81
+81
+81
+82
+83
+84
+83
+82
+83
+84
+84
+83
+80
+85
+81
+81
+89
+100
+109
+117
+123
+123
+126
+124
+115
+105
+103
+110
+117
+125
+133
+148
+167
+185
+201
+215
+224
+228
+231
+232
+229
+225
+219
+207
+196
+174
+154
+130
+130
+110
+81
+93
+109
+117
+96
+74
+66
+65
+62
+57
+54
+61
+59
+65
+55
+55
+62
+61
+70
+106
+105
+91
+66
+50
+52
+54
+50
+53
+65
+71
+61
+50
+49
+50
+48
+52
+49
+46
+47
+50
+55
+61
+66
+45
+52
+68
+86
+94
+90
+83
+81
+69
+70
+77
+91
+107
+109
+87
+60
+47
+45
+50
+51
+44
+40
+55
+76
+74
+80
+87
+95
+100
+97
+82
+67
+57
+55
+55
+60
+59
+57
+53
+54
+58
+59
+57
+57
+55
+56
+58
+60
+57
+57
+57
+57
+56
+55
+52
+50
+54
+55
+56
+54
+50
+48
+48
+49
+49
+49
+48
+47
+47
+48
+51
+54
+57
+68
+56
+52
+47
+95
+131
+108
+99
+88
+81
+78
+69
+59
+61
+74
+85
+68
+60
+62
+60
+63
+68
+72
+92
+107
+124
+137
+143
+144
+143
+143
+144
+145
+146
+148
+150
+151
+151
+152
+156
+157
+156
+156
+154
+151
+149
+148
+141
+136
+127
+116
+105
+96
+88
+85
+93
+94
+95
+74
+77
+79
+81
+80
+81
+82
+84
+83
+83
+83
+84
+84
+83
+82
+80
+79
+81
+88
+99
+109
+117
+122
+124
+124
+121
+114
+105
+100
+103
+114
+123
+138
+146
+162
+181
+196
+209
+220
+227
+229
+233
+232
+226
+219
+211
+195
+182
+164
+152
+134
+127
+113
+98
+104
+113
+139
+118
+92
+76
+69
+65
+61
+60
+58
+60
+69
+67
+58
+58
+54
+49
+73
+97
+107
+83
+58
+52
+54
+52
+52
+77
+90
+75
+56
+51
+52
+50
+46
+44
+44
+45
+49
+54
+59
+63
+47
+52
+58
+67
+70
+69
+71
+77
+81
+86
+87
+91
+102
+107
+86
+56
+50
+47
+46
+43
+37
+41
+62
+83
+63
+65
+71
+81
+90
+88
+71
+54
+53
+55
+59
+64
+64
+61
+57
+55
+56
+57
+56
+56
+55
+55
+57
+58
+58
+59
+58
+58
+58
+56
+53
+51
+54
+55
+56
+54
+50
+48
+47
+48
+50
+50
+49
+48
+48
+48
+51
+54
+56
+70
+57
+51
+44
+102
+121
+103
+100
+86
+76
+72
+64
+55
+63
+82
+89
+67
+67
+79
+70
+67
+71
+68
+85
+99
+116
+131
+139
+141
+141
+142
+143
+144
+145
+147
+148
+150
+150
+151
+155
+155
+153
+151
+147
+144
+142
+141
+135
+129
+121
+113
+105
+102
+101
+102
+103
+104
+105
+72
+74
+78
+79
+80
+80
+82
+84
+82
+83
+84
+84
+83
+82
+82
+81
+77
+88
+102
+112
+116
+119
+122
+123
+121
+114
+103
+99
+103
+114
+124
+132
+149
+159
+174
+189
+201
+211
+218
+223
+224
+226
+222
+215
+208
+198
+182
+167
+153
+141
+132
+123
+117
+114
+109
+111
+137
+129
+116
+102
+88
+79
+69
+65
+58
+59
+66
+69
+60
+61
+66
+49
+48
+73
+88
+78
+61
+56
+54
+51
+52
+85
+107
+93
+68
+59
+59
+56
+52
+50
+49
+48
+48
+47
+47
+48
+57
+52
+51
+58
+67
+69
+66
+64
+69
+80
+86
+86
+93
+101
+87
+63
+59
+53
+51
+50
+50
+57
+72
+86
+53
+51
+54
+65
+74
+72
+59
+49
+53
+57
+60
+60
+59
+58
+55
+55
+59
+59
+58
+57
+56
+55
+54
+55
+58
+59
+58
+58
+59
+57
+54
+51
+55
+56
+57
+55
+51
+49
+48
+49
+51
+51
+50
+48
+49
+48
+51
+54
+55
+67
+55
+49
+49
+106
+113
+103
+95
+82
+68
+63
+59
+58
+71
+91
+86
+69
+74
+89
+79
+73
+73
+69
+80
+92
+108
+124
+133
+138
+140
+141
+142
+143
+145
+146
+147
+149
+149
+150
+153
+152
+149
+146
+143
+140
+138
+136
+129
+124
+116
+110
+107
+108
+110
+113
+111
+112
+111
+69
+72
+75
+77
+78
+79
+81
+83
+83
+84
+84
+84
+83
+83
+85
+86
+86
+101
+117
+121
+121
+121
+121
+119
+114
+106
+99
+101
+112
+126
+135
+141
+157
+166
+179
+191
+199
+206
+211
+213
+214
+213
+208
+201
+195
+186
+168
+155
+137
+121
+116
+107
+107
+110
+97
+96
+115
+122
+128
+126
+115
+100
+85
+73
+68
+62
+60
+65
+58
+67
+84
+62
+54
+57
+61
+63
+66
+67
+64
+55
+50
+76
+95
+87
+68
+58
+56
+55
+57
+57
+57
+58
+57
+57
+56
+56
+40
+51
+64
+73
+68
+59
+55
+58
+57
+73
+86
+89
+93
+95
+83
+63
+64
+63
+64
+70
+76
+81
+84
+85
+51
+46
+46
+55
+60
+58
+52
+48
+52
+57
+56
+52
+50
+50
+52
+52
+60
+61
+60
+59
+56
+55
+52
+52
+56
+57
+56
+57
+57
+55
+53
+51
+55
+56
+58
+55
+50
+48
+48
+49
+52
+52
+51
+49
+49
+49
+51
+54
+57
+60
+55
+48
+64
+110
+107
+99
+84
+74
+62
+55
+55
+64
+79
+92
+71
+70
+76
+86
+81
+74
+71
+68
+74
+85
+99
+115
+127
+135
+138
+140
+140
+142
+144
+144
+146
+148
+148
+148
+149
+148
+145
+142
+140
+137
+136
+134
+130
+126
+120
+114
+111
+112
+114
+117
+114
+115
+115
+66
+69
+73
+75
+76
+78
+80
+82
+85
+86
+86
+85
+83
+85
+90
+93
+103
+112
+120
+121
+120
+119
+117
+111
+104
+102
+103
+109
+120
+133
+144
+151
+161
+168
+178
+186
+191
+193
+195
+197
+194
+192
+186
+179
+176
+168
+153
+139
+132
+111
+110
+101
+102
+109
+94
+99
+90
+103
+117
+124
+125
+120
+106
+92
+83
+72
+61
+68
+59
+71
+92
+59
+60
+55
+54
+62
+68
+66
+65
+65
+56
+62
+67
+66
+61
+56
+55
+55
+58
+57
+58
+59
+62
+65
+69
+71
+45
+59
+74
+76
+61
+48
+48
+57
+65
+76
+86
+90
+92
+89
+76
+62
+52
+53
+57
+63
+66
+68
+64
+62
+51
+48
+49
+55
+54
+49
+45
+49
+50
+57
+55
+48
+44
+48
+51
+51
+61
+61
+61
+60
+58
+57
+54
+54
+53
+53
+53
+54
+54
+53
+50
+49
+55
+57
+58
+55
+52
+49
+49
+49
+52
+53
+52
+50
+49
+49
+51
+54
+59
+52
+58
+50
+85
+112
+99
+90
+75
+72
+58
+49
+54
+67
+77
+80
+53
+71
+75
+78
+81
+74
+64
+68
+70
+79
+91
+106
+120
+129
+136
+139
+138
+139
+141
+142
+144
+145
+145
+146
+146
+144
+143
+139
+138
+136
+135
+135
+133
+130
+126
+121
+119
+119
+120
+122
+116
+117
+117
+67
+70
+72
+75
+75
+77
+79
+81
+87
+88
+88
+86
+85
+87
+94
+99
+114
+117
+118
+115
+114
+117
+112
+103
+97
+101
+108
+115
+124
+135
+147
+156
+161
+167
+174
+179
+180
+179
+179
+179
+176
+172
+166
+161
+159
+153
+140
+126
+120
+97
+99
+88
+90
+99
+86
+98
+77
+85
+97
+108
+121
+129
+124
+112
+97
+84
+71
+79
+66
+71
+87
+44
+49
+52
+62
+69
+62
+50
+55
+69
+69
+57
+51
+53
+59
+61
+60
+61
+59
+57
+53
+52
+53
+56
+60
+63
+83
+71
+60
+58
+61
+59
+55
+52
+75
+76
+80
+84
+89
+86
+77
+67
+52
+54
+53
+52
+49
+49
+48
+46
+51
+50
+52
+56
+51
+41
+40
+46
+45
+53
+53
+46
+42
+48
+53
+53
+60
+61
+61
+61
+59
+58
+55
+54
+52
+51
+50
+51
+53
+52
+49
+48
+56
+58
+58
+56
+52
+51
+51
+52
+53
+53
+52
+51
+50
+50
+52
+54
+61
+47
+62
+52
+98
+112
+91
+80
+70
+72
+61
+50
+55
+71
+74
+66
+43
+72
+75
+72
+80
+74
+64
+70
+67
+74
+85
+100
+114
+125
+132
+136
+136
+137
+138
+141
+142
+143
+143
+144
+144
+144
+141
+138
+136
+135
+135
+134
+129
+127
+125
+124
+123
+123
+124
+126
+120
+121
+122
+66
+68
+70
+71
+72
+73
+77
+79
+81
+82
+83
+86
+89
+98
+106
+111
+113
+116
+121
+119
+112
+103
+97
+95
+98
+104
+112
+122
+130
+139
+146
+153
+158
+160
+162
+163
+163
+162
+160
+159
+158
+156
+154
+153
+150
+142
+131
+124
+111
+103
+95
+90
+89
+86
+85
+86
+82
+89
+88
+91
+107
+122
+131
+139
+117
+117
+95
+80
+69
+90
+55
+50
+54
+55
+55
+55
+57
+59
+60
+63
+56
+60
+63
+59
+53
+51
+58
+64
+57
+57
+55
+55
+55
+58
+63
+65
+61
+64
+69
+71
+67
+60
+50
+43
+60
+69
+79
+86
+89
+88
+79
+67
+58
+58
+56
+53
+46
+42
+40
+39
+44
+43
+42
+41
+39
+38
+36
+35
+35
+38
+42
+44
+44
+46
+53
+60
+56
+58
+59
+59
+58
+57
+55
+53
+51
+52
+53
+53
+53
+53
+53
+53
+56
+57
+57
+57
+56
+55
+54
+52
+53
+52
+53
+52
+53
+53
+54
+56
+58
+55
+58
+62
+109
+98
+85
+75
+79
+58
+57
+63
+64
+80
+73
+36
+43
+56
+68
+76
+73
+67
+68
+73
+72
+75
+83
+93
+107
+118
+126
+131
+134
+136
+137
+139
+141
+144
+144
+145
+145
+142
+140
+139
+138
+137
+133
+131
+131
+129
+127
+126
+127
+127
+126
+125
+123
+127
+130
+63
+65
+67
+69
+69
+71
+75
+77
+79
+81
+83
+86
+91
+99
+108
+111
+112
+112
+112
+109
+102
+97
+94
+92
+100
+106
+114
+123
+130
+137
+142
+147
+149
+151
+152
+153
+151
+150
+150
+149
+150
+148
+147
+147
+145
+138
+127
+121
+109
+101
+94
+91
+90
+86
+84
+84
+84
+91
+88
+88
+102
+114
+120
+126
+136
+135
+117
+103
+85
+90
+50
+47
+55
+55
+55
+56
+56
+59
+59
+61
+57
+57
+58
+58
+57
+57
+56
+56
+59
+57
+56
+56
+57
+57
+58
+57
+54
+56
+61
+64
+65
+63
+60
+57
+52
+62
+72
+79
+81
+78
+67
+55
+55
+56
+55
+52
+47
+43
+41
+40
+43
+42
+41
+38
+35
+33
+30
+29
+30
+31
+36
+41
+45
+50
+55
+60
+57
+58
+59
+59
+58
+57
+55
+53
+51
+52
+53
+54
+55
+54
+53
+53
+57
+57
+57
+57
+57
+56
+56
+54
+53
+51
+52
+53
+53
+54
+55
+55
+61
+52
+53
+84
+102
+91
+73
+76
+69
+64
+56
+62
+78
+76
+56
+41
+51
+54
+59
+64
+66
+64
+68
+73
+68
+80
+98
+111
+118
+122
+126
+130
+131
+134
+137
+140
+141
+142
+144
+145
+145
+144
+141
+139
+138
+137
+133
+131
+131
+129
+127
+128
+129
+129
+127
+126
+128
+132
+135
+57
+60
+63
+65
+66
+69
+72
+76
+79
+79
+83
+87
+93
+101
+109
+113
+111
+107
+102
+96
+91
+90
+93
+95
+106
+111
+120
+128
+132
+136
+139
+142
+144
+144
+144
+144
+142
+141
+140
+139
+140
+139
+139
+140
+139
+133
+123
+115
+103
+96
+91
+91
+91
+88
+85
+83
+89
+95
+91
+88
+100
+109
+113
+119
+138
+138
+133
+125
+110
+97
+52
+50
+56
+58
+57
+57
+57
+59
+58
+58
+58
+53
+53
+56
+62
+62
+54
+47
+58
+56
+55
+56
+58
+58
+57
+55
+53
+54
+56
+58
+61
+64
+65
+66
+58
+64
+69
+70
+72
+71
+64
+55
+54
+54
+55
+52
+48
+45
+43
+42
+39
+39
+37
+35
+33
+30
+28
+27
+29
+30
+35
+42
+50
+55
+57
+59
+57
+58
+59
+59
+57
+56
+55
+53
+51
+52
+53
+54
+54
+54
+53
+52
+56
+57
+57
+56
+56
+55
+55
+54
+53
+52
+53
+54
+54
+55
+55
+56
+61
+50
+56
+108
+93
+81
+62
+75
+59
+66
+56
+65
+87
+64
+34
+46
+52
+53
+54
+59
+62
+61
+64
+69
+70
+97
+126
+140
+135
+127
+125
+128
+131
+133
+137
+140
+142
+143
+144
+145
+147
+145
+141
+140
+139
+139
+136
+134
+132
+131
+128
+129
+130
+130
+129
+128
+134
+138
+141
+53
+56
+60
+62
+64
+66
+69
+74
+76
+77
+81
+87
+94
+103
+110
+111
+109
+103
+94
+87
+85
+88
+95
+99
+110
+115
+124
+131
+134
+136
+136
+138
+142
+140
+140
+139
+137
+136
+134
+133
+133
+133
+134
+136
+136
+131
+121
+112
+96
+90
+89
+92
+94
+91
+86
+82
+84
+91
+89
+88
+99
+108
+112
+121
+125
+122
+131
+134
+129
+107
+60
+56
+59
+58
+59
+58
+58
+58
+57
+56
+58
+54
+53
+56
+62
+62
+56
+47
+54
+53
+52
+54
+57
+60
+61
+59
+58
+58
+57
+57
+58
+59
+60
+61
+68
+69
+65
+61
+60
+65
+64
+59
+53
+53
+53
+51
+47
+43
+41
+41
+38
+38
+38
+39
+38
+37
+36
+35
+33
+34
+37
+44
+53
+57
+57
+57
+57
+58
+59
+59
+57
+56
+55
+53
+52
+52
+54
+54
+55
+54
+53
+53
+56
+56
+56
+56
+55
+55
+54
+54
+53
+54
+55
+57
+57
+59
+58
+58
+59
+51
+73
+111
+85
+69
+62
+67
+55
+60
+66
+79
+80
+47
+29
+48
+47
+52
+58
+65
+64
+61
+64
+70
+93
+126
+159
+168
+152
+132
+123
+126
+131
+134
+138
+143
+144
+145
+146
+146
+148
+146
+142
+141
+140
+140
+138
+137
+133
+131
+129
+130
+131
+132
+130
+130
+138
+142
+145
+51
+54
+57
+59
+61
+64
+68
+71
+73
+75
+78
+85
+94
+103
+107
+107
+104
+96
+86
+80
+81
+89
+99
+106
+114
+120
+127
+133
+135
+136
+137
+138
+139
+138
+136
+135
+133
+131
+131
+130
+132
+132
+133
+134
+134
+130
+120
+110
+90
+84
+87
+92
+96
+95
+90
+83
+74
+83
+83
+82
+93
+102
+108
+118
+117
+111
+126
+130
+135
+108
+63
+56
+59
+61
+61
+60
+59
+58
+56
+55
+58
+56
+56
+57
+58
+58
+57
+55
+57
+55
+56
+55
+55
+56
+60
+62
+60
+61
+60
+59
+58
+56
+55
+53
+64
+64
+61
+57
+56
+59
+58
+53
+47
+48
+50
+50
+47
+45
+43
+44
+45
+46
+47
+47
+47
+47
+45
+46
+40
+40
+43
+48
+54
+56
+56
+53
+57
+58
+59
+58
+57
+56
+54
+52
+52
+52
+53
+55
+55
+54
+54
+53
+56
+57
+57
+57
+57
+56
+55
+56
+56
+58
+59
+61
+61
+62
+61
+61
+55
+60
+93
+96
+80
+60
+66
+55
+55
+52
+78
+92
+64
+38
+40
+49
+46
+54
+62
+65
+61
+61
+74
+92
+133
+163
+190
+190
+165
+139
+127
+127
+132
+136
+141
+147
+148
+149
+147
+147
+148
+146
+142
+140
+140
+140
+139
+138
+133
+132
+131
+132
+133
+134
+133
+133
+142
+145
+148
+49
+52
+55
+57
+58
+61
+65
+68
+72
+71
+74
+83
+94
+101
+103
+102
+97
+89
+81
+79
+83
+94
+105
+111
+119
+124
+129
+133
+135
+135
+135
+136
+135
+134
+132
+130
+128
+128
+127
+128
+133
+133
+133
+134
+133
+128
+118
+106
+87
+81
+85
+94
+100
+97
+93
+87
+78
+85
+84
+82
+92
+98
+104
+113
+121
+113
+124
+115
+120
+92
+59
+53
+59
+61
+61
+60
+59
+59
+57
+55
+53
+55
+58
+58
+58
+56
+58
+61
+61
+64
+65
+62
+56
+52
+56
+60
+58
+58
+59
+59
+58
+57
+53
+53
+54
+59
+62
+63
+63
+62
+55
+44
+43
+45
+48
+51
+49
+48
+48
+48
+48
+49
+49
+48
+47
+45
+44
+42
+46
+46
+48
+51
+54
+55
+54
+53
+57
+58
+58
+58
+57
+56
+54
+52
+53
+53
+54
+55
+55
+54
+54
+54
+55
+56
+56
+57
+56
+56
+55
+57
+57
+60
+61
+63
+64
+64
+63
+60
+55
+72
+103
+78
+72
+56
+66
+49
+57
+55
+83
+87
+50
+41
+55
+50
+51
+55
+59
+58
+56
+68
+99
+131
+174
+193
+206
+199
+174
+148
+134
+130
+133
+136
+143
+150
+152
+151
+149
+148
+148
+145
+141
+139
+139
+140
+139
+139
+134
+133
+132
+133
+136
+137
+135
+134
+143
+147
+150
+48
+49
+52
+53
+54
+56
+61
+62
+69
+69
+72
+80
+91
+98
+98
+96
+94
+88
+84
+84
+93
+105
+115
+120
+127
+130
+132
+134
+133
+132
+132
+133
+134
+133
+131
+129
+127
+128
+128
+128
+133
+132
+131
+132
+130
+124
+113
+102
+86
+81
+87
+95
+101
+100
+96
+91
+82
+91
+89
+85
+91
+93
+98
+109
+122
+114
+120
+89
+91
+68
+53
+58
+58
+60
+61
+61
+59
+58
+56
+54
+48
+51
+56
+59
+59
+59
+59
+60
+59
+67
+75
+72
+61
+52
+53
+59
+57
+57
+57
+57
+56
+56
+55
+55
+54
+60
+63
+64
+64
+65
+58
+49
+48
+49
+52
+54
+52
+49
+48
+47
+46
+47
+47
+48
+45
+44
+43
+42
+49
+50
+53
+53
+53
+53
+55
+56
+56
+57
+58
+58
+56
+55
+54
+52
+53
+53
+55
+56
+55
+55
+54
+54
+55
+56
+56
+57
+57
+57
+56
+57
+57
+58
+62
+63
+64
+64
+62
+59
+58
+85
+94
+71
+62
+58
+56
+53
+58
+71
+80
+64
+50
+53
+57
+51
+51
+53
+56
+60
+67
+92
+132
+168
+197
+203
+204
+195
+174
+153
+136
+129
+131
+137
+143
+149
+153
+152
+149
+147
+147
+144
+140
+138
+138
+139
+139
+139
+136
+134
+134
+136
+138
+139
+137
+137
+146
+150
+153
+46
+48
+50
+51
+51
+54
+57
+59
+68
+68
+70
+79
+90
+97
+96
+92
+95
+90
+88
+92
+103
+115
+124
+128
+132
+133
+134
+133
+131
+130
+130
+130
+135
+134
+132
+130
+130
+130
+130
+131
+133
+131
+130
+130
+127
+120
+110
+99
+87
+84
+87
+95
+101
+100
+96
+93
+79
+89
+89
+83
+86
+87
+90
+100
+114
+110
+113
+68
+65
+49
+52
+67
+57
+58
+59
+60
+58
+58
+56
+55
+44
+48
+54
+60
+64
+62
+59
+55
+52
+66
+79
+78
+66
+55
+55
+62
+59
+58
+56
+55
+54
+54
+56
+56
+59
+59
+57
+54
+55
+60
+60
+55
+56
+56
+58
+57
+52
+47
+44
+44
+47
+49
+51
+52
+53
+53
+51
+53
+50
+53
+56
+54
+52
+52
+55
+60
+56
+57
+57
+58
+56
+55
+54
+52
+53
+53
+55
+56
+57
+56
+55
+55
+56
+58
+57
+59
+58
+58
+58
+59
+57
+58
+61
+62
+63
+63
+61
+56
+60
+93
+81
+72
+56
+63
+46
+62
+61
+93
+76
+45
+56
+66
+55
+52
+48
+50
+57
+68
+86
+116
+157
+190
+203
+201
+195
+186
+172
+153
+135
+124
+129
+135
+142
+149
+152
+151
+148
+146
+147
+143
+139
+137
+137
+139
+139
+139
+136
+135
+135
+136
+138
+139
+139
+138
+147
+151
+154
+48
+47
+45
+46
+48
+51
+56
+58
+61
+64
+69
+76
+82
+88
+92
+94
+88
+89
+93
+101
+110
+120
+129
+133
+140
+140
+138
+135
+130
+128
+128
+130
+131
+133
+131
+132
+131
+131
+132
+132
+128
+128
+128
+125
+120
+111
+101
+93
+92
+92
+92
+94
+95
+96
+96
+94
+79
+84
+92
+96
+89
+81
+83
+92
+104
+89
+68
+55
+55
+58
+61
+59
+57
+58
+57
+58
+56
+56
+53
+53
+47
+51
+56
+62
+64
+64
+61
+57
+57
+48
+87
+75
+47
+61
+60
+56
+59
+58
+57
+56
+55
+54
+53
+52
+55
+59
+62
+60
+55
+56
+62
+67
+66
+57
+50
+52
+50
+45
+45
+50
+55
+53
+54
+55
+57
+58
+55
+55
+59
+60
+58
+56
+56
+55
+55
+55
+57
+57
+57
+58
+57
+57
+57
+56
+55
+54
+56
+57
+59
+59
+57
+55
+56
+57
+57
+58
+58
+58
+59
+60
+57
+61
+58
+52
+57
+68
+64
+49
+95
+87
+75
+61
+51
+50
+56
+69
+91
+71
+52
+51
+63
+66
+54
+43
+46
+49
+56
+74
+110
+155
+186
+198
+203
+190
+182
+178
+160
+132
+118
+123
+128
+135
+143
+148
+149
+148
+146
+145
+142
+138
+134
+134
+137
+139
+138
+136
+139
+140
+139
+139
+138
+139
+143
+147
+155
+157
+158
+48
+47
+46
+46
+47
+51
+54
+56
+60
+63
+68
+74
+80
+85
+89
+92
+90
+93
+98
+106
+116
+126
+135
+140
+141
+140
+137
+132
+128
+126
+127
+130
+134
+135
+136
+136
+136
+134
+134
+133
+128
+127
+124
+120
+115
+107
+98
+93
+96
+96
+94
+94
+92
+93
+94
+93
+93
+89
+88
+90
+86
+83
+82
+89
+85
+76
+62
+54
+54
+57
+57
+57
+56
+56
+56
+56
+55
+54
+52
+53
+48
+53
+57
+61
+65
+64
+60
+57
+56
+60
+82
+72
+52
+58
+58
+52
+61
+60
+59
+59
+58
+57
+56
+54
+55
+56
+55
+51
+49
+49
+55
+60
+68
+56
+47
+47
+48
+46
+49
+54
+53
+51
+50
+58
+69
+73
+68
+63
+58
+57
+57
+57
+56
+56
+57
+57
+56
+56
+57
+57
+57
+57
+57
+55
+54
+53
+54
+56
+59
+58
+57
+55
+56
+58
+58
+59
+59
+60
+60
+60
+57
+63
+58
+53
+58
+60
+58
+61
+95
+81
+67
+57
+57
+61
+64
+74
+64
+63
+58
+58
+61
+61
+59
+61
+47
+55
+75
+104
+143
+176
+195
+199
+186
+185
+182
+169
+142
+117
+112
+123
+127
+134
+141
+147
+148
+147
+144
+144
+140
+137
+134
+134
+138
+140
+140
+139
+141
+141
+142
+140
+140
+142
+146
+149
+156
+157
+158
+49
+49
+47
+46
+47
+49
+52
+53
+59
+62
+66
+72
+77
+82
+85
+87
+89
+93
+100
+110
+120
+131
+139
+144
+142
+140
+137
+132
+127
+124
+125
+127
+134
+136
+138
+139
+138
+136
+132
+130
+128
+124
+118
+112
+106
+100
+94
+93
+98
+98
+95
+92
+90
+91
+92
+92
+96
+87
+82
+85
+88
+86
+80
+79
+62
+60
+56
+55
+54
+54
+55
+55
+55
+56
+56
+56
+54
+53
+51
+53
+51
+54
+57
+60
+63
+63
+60
+56
+53
+74
+70
+65
+60
+54
+59
+54
+58
+58
+58
+58
+56
+55
+54
+51
+57
+55
+51
+51
+51
+54
+58
+60
+60
+52
+48
+49
+51
+52
+55
+61
+55
+65
+78
+89
+90
+81
+66
+56
+54
+55
+55
+55
+56
+57
+59
+59
+55
+56
+56
+56
+56
+56
+56
+56
+53
+52
+53
+55
+58
+58
+56
+55
+56
+58
+59
+60
+60
+60
+60
+60
+57
+64
+57
+54
+59
+49
+52
+80
+92
+75
+59
+57
+65
+73
+75
+79
+56
+62
+63
+64
+60
+54
+52
+55
+43
+60
+93
+136
+171
+188
+194
+192
+180
+184
+180
+154
+117
+98
+104
+120
+125
+131
+140
+146
+146
+146
+144
+143
+137
+135
+134
+136
+139
+142
+143
+142
+144
+144
+144
+144
+143
+146
+148
+153
+161
+163
+163
+52
+52
+49
+49
+50
+51
+52
+54
+59
+62
+65
+70
+74
+79
+81
+83
+86
+90
+97
+108
+119
+130
+137
+143
+145
+144
+139
+133
+127
+124
+124
+126
+131
+133
+136
+138
+136
+133
+127
+125
+123
+118
+110
+102
+97
+93
+90
+91
+97
+98
+95
+92
+89
+89
+90
+91
+86
+81
+81
+88
+91
+84
+71
+63
+50
+53
+53
+54
+53
+53
+54
+56
+55
+56
+56
+57
+54
+54
+51
+54
+54
+56
+55
+58
+62
+63
+59
+56
+52
+85
+60
+56
+66
+53
+61
+61
+56
+56
+57
+58
+57
+55
+54
+51
+54
+51
+50
+52
+58
+62
+63
+61
+52
+53
+54
+53
+50
+51
+55
+60
+85
+98
+109
+105
+86
+65
+54
+52
+54
+55
+55
+56
+56
+57
+57
+58
+55
+56
+56
+57
+56
+56
+56
+55
+53
+54
+54
+57
+60
+60
+57
+57
+57
+59
+59
+60
+60
+61
+59
+60
+58
+64
+56
+56
+59
+43
+53
+97
+85
+72
+62
+62
+73
+81
+81
+85
+70
+70
+66
+67
+67
+61
+54
+50
+50
+70
+107
+147
+172
+180
+184
+186
+187
+184
+167
+130
+95
+87
+99
+114
+123
+131
+138
+145
+145
+145
+143
+142
+135
+134
+135
+138
+141
+143
+145
+146
+145
+145
+146
+146
+145
+147
+151
+156
+166
+166
+166
+56
+56
+54
+54
+54
+54
+55
+56
+62
+64
+67
+71
+75
+78
+80
+82
+85
+88
+95
+105
+115
+125
+134
+138
+146
+145
+141
+135
+129
+125
+124
+124
+126
+129
+133
+134
+132
+128
+122
+119
+115
+110
+101
+95
+91
+90
+89
+90
+96
+97
+95
+92
+91
+90
+90
+90
+84
+81
+81
+86
+83
+72
+58
+52
+49
+51
+53
+53
+51
+51
+53
+57
+56
+57
+58
+58
+56
+55
+53
+55
+59
+58
+54
+56
+59
+61
+59
+55
+57
+92
+61
+53
+65
+51
+58
+63
+58
+58
+58
+58
+59
+58
+56
+55
+51
+49
+49
+55
+60
+62
+59
+55
+55
+59
+60
+54
+49
+53
+66
+77
+120
+113
+96
+74
+56
+50
+55
+64
+57
+57
+55
+55
+54
+55
+55
+55
+54
+55
+55
+56
+56
+56
+55
+55
+55
+55
+55
+58
+61
+61
+59
+59
+56
+58
+59
+60
+60
+60
+59
+59
+59
+61
+56
+57
+56
+48
+64
+105
+78
+72
+69
+73
+80
+85
+86
+90
+75
+74
+68
+67
+67
+64
+66
+71
+85
+103
+129
+153
+164
+169
+178
+185
+183
+167
+134
+99
+80
+83
+97
+108
+123
+130
+138
+144
+146
+145
+144
+142
+135
+134
+138
+140
+142
+144
+146
+147
+145
+146
+147
+147
+147
+150
+154
+158
+167
+167
+167
+61
+62
+61
+61
+61
+60
+61
+61
+66
+68
+71
+74
+76
+79
+81
+82
+87
+90
+94
+101
+110
+121
+128
+133
+140
+140
+138
+133
+127
+121
+119
+118
+119
+122
+125
+126
+125
+121
+116
+114
+107
+102
+95
+91
+90
+90
+90
+91
+94
+95
+94
+93
+93
+92
+92
+89
+94
+85
+77
+73
+64
+56
+50
+50
+53
+54
+53
+52
+50
+52
+54
+59
+57
+59
+59
+59
+58
+57
+55
+57
+62
+59
+53
+53
+57
+60
+59
+55
+63
+91
+73
+58
+64
+54
+51
+60
+57
+55
+55
+55
+55
+55
+55
+55
+60
+58
+57
+60
+62
+61
+56
+52
+57
+60
+58
+56
+62
+80
+98
+112
+104
+84
+61
+49
+52
+59
+61
+59
+59
+58
+57
+56
+55
+55
+53
+54
+54
+54
+55
+56
+56
+55
+55
+54
+56
+56
+56
+59
+62
+62
+60
+60
+56
+58
+59
+59
+60
+59
+58
+58
+60
+57
+59
+57
+54
+62
+84
+102
+76
+74
+76
+78
+83
+87
+92
+97
+71
+74
+70
+62
+51
+54
+77
+102
+138
+148
+155
+154
+155
+163
+173
+176
+149
+125
+96
+74
+70
+80
+95
+106
+122
+130
+139
+145
+146
+145
+143
+142
+136
+137
+141
+143
+143
+143
+145
+146
+148
+149
+150
+150
+151
+153
+159
+162
+173
+172
+171
+65
+66
+66
+67
+67
+67
+66
+67
+70
+72
+74
+77
+78
+81
+82
+83
+90
+92
+93
+97
+104
+113
+122
+126
+130
+131
+132
+129
+123
+115
+111
+109
+109
+111
+113
+115
+115
+111
+107
+105
+97
+95
+92
+90
+91
+91
+92
+92
+92
+93
+94
+95
+95
+96
+93
+89
+95
+79
+66
+59
+55
+50
+51
+53
+55
+54
+52
+51
+52
+53
+55
+57
+58
+61
+61
+62
+60
+59
+57
+59
+64
+60
+53
+51
+56
+60
+58
+53
+57
+78
+84
+66
+66
+63
+49
+60
+60
+57
+55
+54
+55
+57
+59
+59
+68
+65
+63
+62
+61
+59
+56
+56
+56
+57
+55
+59
+74
+92
+100
+99
+61
+56
+52
+56
+65
+69
+61
+52
+59
+59
+57
+57
+56
+56
+55
+55
+54
+55
+54
+56
+56
+55
+55
+54
+55
+54
+56
+59
+62
+62
+60
+60
+56
+59
+59
+59
+59
+58
+58
+57
+62
+55
+61
+57
+50
+80
+107
+93
+80
+75
+74
+77
+84
+93
+101
+106
+75
+72
+63
+55
+53
+71
+111
+146
+178
+179
+165
+146
+141
+150
+151
+140
+102
+84
+69
+66
+68
+74
+88
+104
+124
+130
+139
+144
+147
+145
+145
+143
+139
+140
+144
+145
+143
+142
+143
+145
+151
+153
+153
+154
+155
+157
+163
+166
+175
+174
+172
+67
+68
+69
+69
+71
+71
+70
+71
+72
+74
+76
+78
+80
+81
+82
+84
+89
+90
+89
+91
+97
+107
+115
+120
+123
+125
+127
+124
+119
+110
+105
+103
+102
+103
+104
+105
+105
+103
+98
+96
+93
+92
+90
+91
+93
+94
+94
+93
+93
+93
+93
+93
+93
+93
+91
+87
+84
+69
+57
+55
+56
+54
+54
+54
+54
+52
+52
+52
+55
+55
+54
+54
+58
+60
+60
+61
+59
+59
+58
+60
+65
+60
+51
+51
+57
+61
+59
+56
+50
+65
+91
+73
+68
+70
+50
+63
+70
+66
+64
+63
+63
+66
+69
+71
+64
+61
+58
+54
+54
+55
+57
+60
+63
+61
+58
+63
+77
+81
+64
+41
+45
+53
+62
+65
+62
+59
+59
+61
+57
+57
+57
+56
+57
+58
+57
+58
+56
+56
+56
+56
+57
+56
+55
+55
+54
+54
+56
+58
+61
+61
+60
+59
+57
+59
+59
+59
+59
+59
+58
+58
+63
+53
+61
+56
+47
+92
+122
+88
+89
+81
+77
+77
+87
+97
+104
+110
+84
+72
+57
+59
+80
+116
+162
+193
+188
+184
+158
+130
+126
+135
+125
+98
+68
+60
+61
+68
+69
+67
+80
+101
+123
+131
+139
+145
+147
+146
+144
+142
+141
+143
+146
+147
+143
+142
+143
+146
+155
+157
+157
+158
+158
+162
+166
+171
+167
+165
+164
+75
+75
+74
+74
+74
+74
+74
+75
+78
+79
+80
+81
+82
+84
+85
+85
+91
+90
+89
+89
+93
+97
+102
+106
+110
+112
+115
+115
+112
+106
+98
+93
+96
+95
+93
+90
+90
+89
+90
+90
+91
+91
+92
+92
+92
+92
+93
+94
+98
+101
+90
+79
+87
+92
+90
+91
+78
+70
+60
+56
+56
+56
+52
+49
+54
+55
+55
+55
+55
+55
+54
+55
+56
+56
+57
+57
+57
+57
+56
+59
+59
+62
+57
+49
+50
+57
+60
+57
+53
+53
+58
+67
+75
+72
+61
+50
+80
+74
+70
+69
+73
+72
+68
+61
+55
+56
+58
+58
+57
+55
+57
+61
+69
+65
+57
+50
+48
+52
+59
+63
+58
+61
+64
+64
+62
+60
+57
+58
+56
+56
+56
+57
+57
+57
+57
+57
+52
+53
+54
+55
+56
+57
+57
+57
+59
+57
+57
+61
+65
+66
+65
+63
+58
+60
+61
+60
+58
+58
+56
+56
+65
+60
+47
+47
+76
+109
+109
+86
+76
+78
+81
+85
+88
+93
+97
+106
+89
+75
+69
+97
+141
+176
+188
+189
+181
+157
+128
+109
+100
+93
+80
+68
+61
+67
+64
+62
+67
+67
+78
+100
+115
+131
+143
+147
+146
+146
+147
+144
+144
+145
+147
+147
+146
+147
+150
+152
+156
+158
+159
+161
+163
+167
+170
+170
+168
+155
+145
+78
+78
+78
+78
+78
+78
+78
+78
+79
+80
+80
+82
+83
+84
+85
+86
+91
+90
+89
+89
+91
+95
+98
+100
+101
+103
+105
+105
+102
+96
+91
+88
+91
+90
+86
+84
+84
+84
+86
+87
+90
+90
+91
+92
+93
+94
+95
+95
+97
+103
+91
+83
+86
+88
+82
+82
+73
+67
+61
+57
+56
+55
+52
+51
+54
+56
+56
+56
+55
+56
+55
+55
+55
+55
+55
+55
+56
+56
+56
+58
+60
+62
+57
+49
+50
+58
+62
+60
+58
+52
+52
+59
+69
+79
+81
+79
+70
+65
+60
+59
+62
+62
+58
+53
+56
+56
+56
+56
+56
+58
+62
+66
+64
+61
+57
+52
+52
+55
+60
+64
+64
+64
+65
+63
+58
+56
+55
+56
+54
+54
+55
+56
+56
+57
+57
+58
+57
+58
+58
+59
+59
+59
+57
+57
+58
+59
+60
+63
+65
+63
+61
+59
+59
+61
+61
+60
+59
+58
+56
+58
+57
+56
+53
+60
+81
+101
+94
+77
+78
+84
+89
+92
+94
+94
+95
+102
+95
+103
+114
+144
+175
+190
+178
+160
+130
+117
+101
+88
+80
+72
+63
+56
+60
+66
+63
+61
+65
+67
+77
+100
+116
+131
+144
+148
+146
+148
+147
+145
+145
+146
+148
+148
+147
+148
+151
+152
+157
+157
+160
+162
+166
+169
+169
+168
+152
+141
+131
+84
+84
+84
+84
+84
+84
+84
+84
+82
+83
+84
+85
+86
+87
+88
+88
+93
+93
+91
+91
+91
+91
+93
+93
+93
+94
+95
+95
+94
+91
+87
+86
+86
+84
+81
+78
+77
+79
+81
+82
+87
+87
+89
+91
+92
+94
+96
+97
+96
+101
+94
+88
+91
+88
+74
+71
+65
+63
+60
+56
+55
+57
+57
+57
+56
+55
+55
+57
+56
+55
+55
+55
+55
+55
+55
+56
+56
+56
+57
+59
+62
+62
+58
+50
+51
+58
+62
+62
+63
+56
+50
+52
+60
+70
+77
+78
+59
+53
+51
+53
+58
+63
+62
+60
+57
+54
+51
+51
+54
+57
+60
+64
+55
+56
+53
+52
+52
+55
+59
+61
+68
+67
+66
+63
+58
+56
+54
+55
+54
+54
+54
+55
+55
+57
+57
+58
+58
+59
+59
+60
+59
+58
+57
+56
+57
+60
+64
+66
+63
+58
+55
+55
+59
+60
+60
+59
+58
+57
+55
+57
+54
+54
+57
+70
+83
+87
+80
+73
+77
+83
+89
+94
+97
+97
+95
+101
+114
+141
+166
+185
+192
+179
+144
+111
+82
+83
+80
+76
+67
+60
+57
+56
+59
+65
+63
+60
+65
+66
+77
+99
+118
+133
+146
+150
+148
+150
+149
+148
+148
+149
+150
+150
+148
+149
+151
+153
+157
+157
+159
+164
+169
+170
+166
+160
+137
+127
+120
+88
+88
+88
+88
+88
+88
+88
+88
+86
+87
+87
+88
+89
+90
+91
+91
+93
+94
+94
+95
+94
+92
+92
+92
+93
+93
+93
+94
+93
+91
+90
+91
+89
+86
+82
+78
+76
+77
+78
+79
+81
+84
+86
+88
+90
+93
+95
+97
+97
+99
+91
+91
+98
+91
+71
+61
+61
+60
+58
+57
+56
+57
+61
+62
+57
+55
+56
+57
+56
+56
+56
+55
+55
+56
+56
+56
+56
+56
+57
+59
+63
+62
+57
+51
+51
+56
+61
+64
+63
+58
+55
+53
+55
+58
+60
+58
+55
+50
+50
+52
+56
+60
+62
+61
+56
+52
+49
+50
+54
+56
+55
+55
+51
+54
+53
+54
+54
+56
+58
+58
+65
+66
+66
+64
+60
+58
+56
+56
+54
+55
+55
+56
+56
+57
+58
+59
+57
+58
+58
+59
+58
+58
+57
+57
+60
+64
+67
+65
+59
+54
+54
+55
+59
+59
+59
+59
+58
+56
+55
+57
+61
+53
+53
+69
+80
+77
+76
+81
+80
+85
+90
+94
+97
+97
+97
+103
+133
+169
+189
+184
+161
+134
+96
+65
+62
+66
+70
+70
+65
+61
+61
+61
+57
+64
+62
+60
+64
+66
+76
+98
+119
+134
+147
+151
+150
+152
+151
+151
+151
+152
+152
+151
+150
+150
+153
+155
+158
+159
+163
+168
+172
+167
+157
+146
+132
+123
+118
+90
+90
+90
+90
+90
+90
+90
+90
+90
+90
+91
+91
+92
+93
+93
+93
+94
+95
+96
+97
+97
+96
+95
+94
+96
+96
+96
+95
+95
+96
+96
+97
+94
+90
+85
+80
+77
+75
+75
+75
+77
+79
+81
+83
+87
+90
+92
+92
+96
+93
+85
+91
+105
+100
+79
+67
+61
+58
+57
+56
+56
+60
+65
+65
+58
+55
+56
+58
+57
+57
+57
+56
+56
+56
+56
+57
+57
+57
+57
+59
+63
+62
+58
+54
+52
+55
+61
+66
+59
+59
+58
+57
+56
+58
+60
+59
+58
+53
+51
+51
+53
+53
+52
+51
+54
+53
+52
+56
+57
+56
+51
+48
+53
+57
+57
+58
+58
+58
+56
+55
+58
+59
+63
+64
+62
+60
+58
+57
+55
+54
+54
+55
+56
+58
+58
+60
+58
+59
+60
+61
+61
+62
+61
+62
+64
+66
+66
+61
+55
+53
+55
+58
+59
+60
+59
+58
+57
+56
+55
+56
+64
+52
+51
+71
+81
+78
+78
+87
+85
+88
+90
+92
+93
+96
+97
+104
+137
+165
+169
+142
+107
+83
+64
+50
+58
+59
+61
+63
+63
+63
+59
+58
+57
+63
+61
+59
+63
+65
+75
+98
+120
+135
+148
+152
+151
+154
+153
+153
+154
+154
+154
+153
+151
+152
+155
+158
+160
+162
+167
+169
+168
+159
+146
+134
+133
+124
+120
+92
+92
+92
+92
+92
+92
+92
+92
+92
+93
+93
+93
+94
+94
+95
+95
+95
+96
+97
+98
+98
+98
+97
+97
+97
+97
+96
+96
+96
+96
+97
+98
+95
+93
+88
+82
+77
+74
+72
+72
+74
+75
+77
+79
+81
+84
+86
+85
+88
+85
+80
+87
+104
+102
+88
+83
+65
+60
+57
+56
+58
+62
+66
+64
+59
+55
+56
+57
+57
+57
+57
+56
+56
+57
+57
+57
+57
+57
+57
+59
+63
+61
+60
+57
+54
+53
+59
+65
+66
+64
+59
+55
+50
+52
+59
+61
+54
+52
+55
+57
+59
+59
+59
+58
+53
+55
+57
+61
+61
+58
+51
+48
+57
+61
+61
+62
+61
+60
+58
+56
+54
+56
+59
+62
+61
+60
+59
+59
+56
+55
+55
+56
+58
+59
+60
+61
+62
+63
+65
+65
+65
+65
+64
+66
+63
+64
+61
+56
+53
+53
+56
+60
+60
+60
+60
+58
+57
+55
+54
+54
+58
+51
+57
+79
+89
+82
+79
+86
+89
+91
+90
+91
+92
+95
+96
+103
+120
+131
+124
+96
+69
+59
+59
+60
+61
+60
+60
+63
+65
+65
+60
+55
+57
+63
+60
+58
+62
+64
+74
+97
+120
+135
+148
+153
+152
+154
+154
+154
+154
+156
+155
+153
+153
+155
+158
+161
+165
+167
+168
+166
+159
+148
+138
+130
+134
+126
+121
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+94
+95
+95
+95
+95
+96
+97
+98
+98
+98
+96
+96
+97
+97
+97
+96
+96
+96
+96
+97
+97
+97
+95
+94
+91
+87
+82
+77
+73
+72
+72
+72
+74
+75
+76
+77
+79
+78
+80
+81
+78
+82
+89
+87
+84
+91
+75
+65
+57
+55
+59
+62
+64
+60
+58
+55
+56
+58
+57
+58
+58
+58
+57
+58
+58
+58
+58
+58
+58
+59
+61
+61
+61
+60
+56
+52
+57
+65
+67
+65
+61
+54
+47
+48
+54
+58
+53
+54
+59
+64
+66
+66
+64
+63
+50
+55
+58
+62
+60
+56
+53
+53
+60
+62
+62
+63
+62
+61
+59
+58
+55
+56
+56
+57
+56
+58
+61
+63
+58
+57
+57
+58
+59
+59
+61
+62
+66
+67
+67
+66
+65
+63
+61
+62
+60
+58
+56
+54
+55
+56
+58
+58
+61
+60
+60
+58
+57
+55
+54
+54
+51
+53
+66
+85
+87
+80
+80
+90
+89
+90
+92
+92
+91
+92
+91
+98
+98
+96
+83
+71
+63
+61
+62
+63
+61
+63
+66
+70
+71
+68
+62
+57
+56
+62
+60
+58
+62
+63
+74
+96
+119
+135
+148
+153
+152
+155
+154
+154
+155
+157
+156
+155
+154
+157
+161
+165
+171
+169
+165
+156
+145
+137
+135
+136
+136
+128
+121
+95
+95
+95
+95
+95
+95
+95
+95
+94
+95
+95
+95
+95
+95
+96
+96
+100
+99
+97
+96
+95
+94
+94
+96
+97
+97
+97
+97
+96
+96
+97
+96
+97
+95
+94
+91
+87
+82
+77
+76
+70
+71
+72
+72
+73
+75
+75
+74
+74
+80
+79
+76
+75
+69
+74
+91
+83
+70
+59
+55
+59
+61
+60
+55
+58
+56
+57
+59
+59
+59
+59
+59
+58
+58
+58
+58
+58
+58
+58
+59
+59
+58
+60
+62
+57
+51
+55
+63
+57
+59
+62
+60
+56
+55
+60
+63
+61
+63
+67
+68
+64
+59
+53
+49
+48
+54
+58
+60
+58
+57
+56
+58
+61
+62
+63
+64
+64
+64
+62
+61
+59
+58
+55
+54
+53
+57
+63
+67
+60
+59
+59
+60
+60
+61
+62
+64
+68
+68
+67
+65
+63
+59
+56
+57
+55
+56
+53
+54
+58
+60
+58
+56
+61
+60
+60
+60
+58
+56
+54
+54
+49
+56
+71
+83
+80
+76
+82
+95
+87
+89
+91
+93
+93
+92
+89
+94
+88
+77
+64
+65
+71
+69
+61
+55
+56
+62
+69
+74
+73
+67
+62
+58
+56
+62
+59
+57
+62
+63
+73
+96
+119
+134
+148
+152
+152
+155
+154
+154
+156
+156
+156
+155
+155
+158
+163
+167
+173
+171
+163
+149
+135
+131
+136
+143
+138
+129
+122
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+95
+96
+96
+96
+96
+96
+96
+96
+97
+97
+97
+97
+98
+98
+98
+98
+98
+95
+95
+94
+95
+93
+88
+80
+76
+73
+72
+69
+68
+69
+71
+71
+69
+74
+75
+68
+74
+81
+70
+75
+107
+104
+86
+71
+65
+64
+61
+59
+59
+51
+53
+54
+55
+55
+56
+59
+61
+60
+60
+60
+60
+59
+59
+59
+60
+50
+55
+59
+58
+55
+53
+55
+57
+65
+59
+54
+52
+54
+60
+67
+72
+68
+69
+67
+58
+54
+56
+55
+52
+57
+57
+56
+56
+57
+58
+60
+60
+61
+61
+62
+63
+64
+65
+66
+64
+59
+58
+55
+54
+54
+56
+58
+60
+61
+61
+63
+65
+65
+66
+64
+64
+72
+69
+65
+59
+53
+51
+49
+50
+57
+59
+57
+58
+58
+59
+59
+60
+57
+56
+57
+57
+57
+56
+54
+51
+45
+65
+79
+77
+76
+81
+85
+82
+92
+92
+85
+84
+90
+88
+87
+103
+84
+81
+75
+75
+72
+64
+61
+63
+60
+80
+94
+91
+79
+70
+65
+61
+59
+63
+61
+61
+63
+61
+72
+98
+121
+136
+148
+151
+150
+153
+154
+155
+157
+158
+159
+159
+159
+162
+167
+170
+173
+163
+147
+137
+135
+137
+142
+144
+137
+128
+121
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+95
+95
+95
+95
+95
+95
+96
+96
+96
+96
+97
+97
+97
+97
+97
+97
+97
+96
+96
+95
+95
+93
+89
+82
+78
+74
+72
+68
+68
+69
+70
+70
+69
+70
+67
+69
+76
+73
+65
+82
+117
+100
+96
+86
+72
+64
+64
+62
+56
+57
+61
+61
+62
+59
+59
+57
+58
+58
+58
+58
+58
+58
+58
+58
+59
+63
+66
+66
+61
+54
+49
+49
+50
+53
+54
+59
+65
+69
+73
+74
+75
+66
+69
+66
+59
+57
+61
+63
+61
+63
+62
+62
+61
+61
+62
+64
+63
+61
+60
+60
+62
+63
+63
+63
+62
+64
+61
+58
+56
+55
+56
+57
+56
+60
+60
+63
+65
+67
+67
+68
+69
+66
+65
+61
+58
+54
+53
+52
+55
+58
+61
+59
+59
+58
+59
+60
+60
+59
+59
+57
+58
+57
+56
+54
+52
+52
+68
+78
+75
+74
+81
+84
+82
+83
+88
+85
+86
+93
+87
+83
+99
+87
+99
+106
+102
+84
+67
+64
+72
+88
+98
+102
+92
+78
+69
+63
+60
+58
+62
+60
+60
+64
+62
+72
+98
+122
+136
+148
+152
+150
+154
+154
+155
+160
+159
+157
+158
+160
+164
+167
+170
+166
+154
+140
+134
+137
+141
+141
+139
+137
+128
+121
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+95
+95
+94
+94
+95
+95
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+96
+97
+96
+97
+97
+95
+92
+86
+82
+75
+73
+70
+69
+69
+70
+68
+67
+69
+62
+71
+75
+63
+64
+92
+116
+87
+100
+101
+84
+70
+71
+66
+57
+55
+58
+58
+58
+57
+56
+54
+54
+56
+55
+55
+55
+55
+56
+56
+56
+51
+53
+54
+51
+48
+47
+49
+51
+65
+67
+71
+76
+76
+74
+70
+68
+66
+67
+63
+59
+60
+65
+69
+69
+68
+67
+66
+65
+64
+65
+65
+64
+59
+59
+58
+60
+60
+60
+61
+60
+63
+60
+59
+56
+56
+56
+58
+57
+57
+57
+59
+62
+63
+65
+65
+65
+59
+58
+56
+55
+54
+54
+55
+58
+59
+60
+59
+59
+58
+59
+59
+60
+59
+59
+59
+57
+56
+55
+54
+52
+59
+70
+78
+74
+72
+79
+83
+82
+79
+84
+83
+86
+93
+89
+91
+108
+125
+137
+139
+120
+88
+68
+74
+90
+113
+111
+101
+85
+73
+67
+64
+60
+57
+60
+58
+60
+65
+63
+73
+98
+122
+137
+149
+152
+151
+154
+154
+154
+162
+160
+157
+159
+164
+167
+168
+167
+153
+143
+132
+132
+140
+144
+141
+133
+136
+127
+120
+96
+96
+96
+96
+96
+96
+96
+96
+97
+97
+97
+97
+97
+97
+97
+96
+96
+95
+96
+96
+96
+97
+97
+97
+97
+97
+97
+97
+97
+97
+97
+97
+98
+98
+98
+98
+97
+94
+90
+86
+79
+75
+72
+70
+69
+68
+68
+66
+70
+65
+73
+70
+59
+78
+100
+96
+66
+84
+100
+95
+83
+74
+68
+64
+56
+57
+55
+55
+56
+58
+59
+58
+62
+62
+62
+62
+63
+63
+63
+62
+63
+66
+68
+70
+70
+73
+77
+80
+83
+80
+77
+73
+71
+67
+65
+65
+69
+67
+62
+59
+61
+66
+70
+73
+69
+69
+66
+66
+64
+64
+64
+63
+59
+57
+58
+59
+59
+60
+59
+59
+58
+57
+55
+55
+56
+58
+59
+59
+58
+56
+57
+58
+58
+58
+57
+56
+55
+55
+54
+54
+55
+56
+57
+60
+60
+60
+59
+57
+58
+57
+58
+59
+58
+59
+59
+57
+56
+54
+55
+53
+68
+72
+75
+72
+73
+79
+84
+84
+81
+84
+81
+83
+92
+95
+104
+126
+148
+146
+130
+104
+82
+79
+96
+114
+116
+105
+88
+76
+69
+66
+65
+61
+56
+59
+57
+60
+65
+64
+73
+97
+120
+136
+149
+153
+152
+155
+154
+155
+160
+158
+158
+162
+168
+170
+165
+160
+140
+135
+131
+135
+142
+145
+141
+135
+135
+126
+119
+96
+96
+96
+96
+96
+96
+96
+96
+97
+97
+97
+97
+97
+97
+97
+96
+96
+96
+96
+97
+97
+97
+98
+98
+98
+98
+98
+97
+97
+97
+97
+97
+99
+98
+98
+98
+98
+97
+93
+90
+82
+79
+75
+71
+69
+69
+67
+66
+72
+70
+71
+62
+62
+90
+96
+63
+52
+64
+89
+106
+101
+82
+73
+77
+73
+70
+64
+62
+64
+68
+71
+71
+74
+74
+74
+74
+75
+75
+75
+75
+83
+84
+83
+82
+83
+83
+85
+85
+76
+73
+69
+67
+66
+67
+69
+70
+73
+68
+61
+60
+62
+66
+68
+71
+68
+66
+65
+63
+62
+62
+62
+62
+59
+58
+58
+58
+61
+60
+60
+59
+57
+56
+56
+56
+57
+58
+58
+58
+59
+57
+57
+58
+57
+56
+56
+56
+56
+56
+56
+56
+57
+58
+58
+59
+58
+58
+57
+56
+56
+55
+56
+57
+56
+57
+58
+56
+53
+53
+55
+57
+72
+73
+73
+73
+75
+82
+87
+88
+81
+85
+82
+86
+96
+98
+103
+122
+114
+105
+89
+82
+90
+105
+118
+124
+105
+91
+76
+68
+68
+67
+65
+61
+57
+59
+56
+59
+66
+64
+72
+94
+117
+133
+147
+152
+152
+155
+155
+156
+157
+158
+161
+168
+170
+168
+157
+147
+131
+132
+136
+140
+142
+142
+141
+138
+134
+123
+116
+96
+96
+96
+96
+96
+96
+96
+96
+98
+98
+98
+98
+98
+98
+98
+97
+98
+98
+98
+98
+98
+99
+99
+100
+100
+100
+99
+99
+98
+98
+98
+98
+99
+98
+98
+99
+99
+98
+96
+93
+87
+83
+77
+74
+72
+69
+66
+65
+71
+70
+66
+61
+69
+89
+79
+46
+60
+62
+84
+112
+118
+100
+88
+93
+85
+80
+71
+67
+68
+71
+71
+71
+72
+74
+72
+74
+74
+75
+75
+75
+72
+71
+72
+71
+72
+72
+71
+70
+66
+65
+66
+66
+67
+66
+65
+65
+73
+66
+59
+61
+63
+64
+65
+67
+64
+64
+62
+60
+60
+59
+59
+60
+60
+61
+60
+61
+61
+61
+61
+61
+60
+60
+59
+57
+57
+56
+55
+54
+57
+56
+57
+58
+59
+61
+60
+62
+57
+57
+58
+58
+59
+59
+59
+58
+58
+57
+55
+54
+53
+53
+53
+54
+54
+56
+57
+56
+52
+53
+58
+60
+77
+75
+74
+77
+81
+86
+88
+87
+78
+84
+86
+92
+101
+94
+86
+94
+79
+78
+79
+92
+114
+126
+120
+106
+95
+81
+69
+68
+70
+68
+62
+59
+58
+59
+56
+59
+66
+64
+70
+91
+113
+129
+145
+151
+151
+155
+155
+156
+156
+160
+164
+168
+168
+160
+147
+138
+129
+134
+140
+142
+141
+141
+140
+140
+132
+122
+115
+96
+96
+96
+96
+96
+96
+96
+96
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+100
+100
+100
+100
+100
+100
+100
+99
+99
+98
+98
+99
+97
+98
+99
+100
+99
+96
+95
+91
+87
+81
+76
+73
+71
+67
+67
+70
+69
+64
+70
+80
+72
+57
+52
+67
+65
+75
+98
+113
+109
+97
+89
+81
+76
+68
+66
+68
+69
+66
+64
+67
+67
+67
+68
+67
+68
+69
+68
+65
+65
+68
+71
+73
+74
+73
+71
+65
+65
+66
+66
+65
+64
+61
+60
+69
+60
+54
+58
+62
+61
+61
+63
+60
+59
+58
+57
+56
+56
+57
+58
+60
+61
+61
+61
+61
+61
+61
+60
+60
+61
+60
+58
+57
+56
+54
+54
+57
+57
+57
+57
+57
+59
+60
+61
+57
+58
+58
+59
+59
+60
+59
+59
+56
+56
+54
+53
+52
+52
+52
+53
+50
+54
+56
+54
+51
+53
+58
+64
+80
+78
+78
+81
+86
+88
+85
+82
+79
+84
+84
+92
+102
+91
+75
+75
+78
+90
+103
+114
+121
+122
+108
+93
+86
+72
+64
+66
+70
+68
+61
+58
+59
+60
+56
+60
+67
+64
+68
+88
+108
+125
+142
+149
+151
+155
+156
+157
+158
+162
+166
+166
+161
+151
+140
+133
+134
+136
+138
+140
+141
+142
+139
+137
+131
+121
+114
+96
+96
+96
+96
+96
+96
+96
+96
+98
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+100
+100
+100
+100
+100
+100
+100
+100
+99
+99
+99
+99
+98
+97
+97
+97
+100
+99
+97
+96
+93
+89
+83
+78
+75
+72
+68
+67
+69
+67
+65
+83
+92
+63
+49
+74
+64
+61
+59
+71
+90
+101
+88
+71
+74
+69
+66
+67
+71
+71
+67
+62
+68
+68
+68
+69
+69
+69
+67
+68
+63
+64
+66
+69
+71
+70
+66
+62
+66
+64
+62
+61
+62
+64
+67
+69
+65
+56
+52
+58
+62
+61
+60
+63
+59
+58
+58
+56
+55
+55
+56
+59
+58
+59
+59
+60
+60
+60
+60
+60
+56
+57
+58
+58
+59
+59
+57
+57
+58
+57
+55
+55
+54
+53
+55
+55
+56
+57
+59
+60
+60
+61
+60
+59
+57
+55
+54
+53
+52
+52
+52
+53
+50
+53
+56
+54
+52
+53
+59
+66
+85
+80
+79
+83
+87
+86
+82
+78
+84
+85
+82
+88
+100
+90
+75
+74
+88
+107
+120
+120
+110
+104
+99
+95
+76
+63
+57
+62
+67
+66
+60
+60
+61
+61
+57
+60
+67
+63
+66
+85
+104
+122
+138
+147
+150
+154
+157
+157
+160
+163
+164
+162
+154
+144
+136
+131
+140
+137
+135
+138
+141
+142
+138
+133
+131
+121
+114
+96
+96
+96
+97
+97
+98
+98
+98
+97
+97
+97
+97
+97
+97
+97
+97
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+98
+93
+96
+100
+100
+98
+96
+96
+98
+97
+97
+93
+86
+81
+78
+72
+65
+70
+62
+73
+103
+120
+108
+89
+79
+66
+66
+68
+70
+72
+74
+75
+75
+69
+69
+70
+72
+70
+68
+67
+70
+68
+69
+69
+68
+67
+66
+63
+61
+66
+67
+67
+68
+68
+70
+70
+69
+67
+66
+64
+63
+63
+63
+63
+66
+66
+62
+57
+55
+57
+61
+62
+62
+63
+63
+61
+59
+57
+56
+56
+57
+59
+60
+60
+60
+59
+58
+58
+58
+58
+58
+58
+58
+58
+58
+58
+58
+57
+57
+56
+56
+55
+55
+55
+56
+56
+56
+57
+56
+57
+56
+56
+56
+56
+56
+55
+56
+54
+54
+53
+53
+49
+54
+52
+51
+54
+52
+56
+73
+83
+83
+82
+82
+80
+81
+81
+82
+84
+84
+91
+99
+95
+85
+86
+95
+126
+120
+111
+106
+103
+98
+89
+82
+68
+62
+58
+59
+62
+66
+64
+62
+56
+57
+58
+58
+61
+63
+66
+69
+95
+114
+134
+145
+149
+154
+157
+157
+158
+167
+167
+152
+138
+134
+134
+132
+134
+136
+138
+141
+140
+138
+135
+132
+130
+118
+109
+96
+96
+96
+97
+97
+98
+98
+98
+97
+97
+97
+97
+97
+97
+97
+97
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+98
+98
+97
+98
+99
+102
+103
+101
+100
+99
+104
+105
+103
+99
+94
+85
+76
+74
+62
+63
+80
+88
+78
+69
+68
+87
+84
+81
+80
+78
+77
+76
+76
+85
+73
+62
+61
+67
+70
+66
+62
+68
+68
+70
+69
+69
+66
+64
+63
+67
+67
+67
+69
+69
+70
+70
+70
+69
+67
+66
+65
+64
+64
+64
+66
+68
+67
+62
+58
+57
+58
+60
+60
+65
+64
+62
+60
+58
+57
+56
+57
+59
+60
+59
+59
+59
+58
+58
+58
+57
+57
+57
+57
+58
+58
+58
+58
+57
+57
+57
+57
+57
+57
+57
+57
+57
+58
+58
+57
+57
+57
+57
+57
+56
+56
+56
+55
+54
+54
+54
+54
+49
+55
+52
+51
+54
+51
+55
+72
+82
+83
+81
+80
+81
+80
+81
+83
+79
+83
+91
+101
+105
+107
+113
+120
+116
+110
+102
+97
+95
+92
+86
+80
+70
+64
+59
+58
+61
+64
+62
+61
+58
+59
+59
+60
+60
+63
+65
+68
+91
+109
+129
+140
+147
+153
+157
+158
+159
+162
+158
+145
+134
+131
+131
+130
+134
+135
+137
+139
+138
+136
+134
+132
+127
+116
+107
+96
+96
+96
+97
+97
+98
+98
+98
+97
+97
+97
+97
+97
+97
+97
+97
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+98
+100
+95
+93
+95
+101
+103
+100
+98
+98
+108
+120
+123
+121
+117
+105
+96
+84
+70
+62
+66
+64
+56
+55
+61
+55
+57
+59
+64
+73
+80
+88
+91
+94
+84
+72
+67
+68
+71
+68
+64
+65
+66
+68
+70
+70
+69
+68
+68
+68
+68
+68
+69
+69
+70
+69
+69
+68
+68
+68
+67
+66
+66
+66
+67
+69
+69
+66
+62
+58
+56
+57
+59
+64
+64
+62
+61
+58
+57
+56
+58
+59
+59
+59
+59
+58
+58
+58
+58
+57
+57
+58
+58
+58
+58
+58
+58
+57
+57
+57
+57
+57
+56
+56
+56
+59
+59
+58
+59
+58
+58
+58
+58
+56
+56
+55
+55
+54
+53
+53
+53
+49
+54
+52
+50
+54
+51
+55
+71
+80
+80
+80
+81
+82
+83
+85
+86
+87
+91
+94
+98
+105
+114
+119
+119
+101
+95
+89
+85
+86
+86
+84
+82
+73
+68
+62
+59
+60
+62
+61
+59
+60
+61
+60
+60
+60
+62
+64
+67
+87
+105
+124
+136
+145
+153
+159
+159
+161
+157
+148
+137
+130
+130
+130
+128
+133
+135
+136
+138
+137
+135
+133
+131
+125
+113
+103
+96
+96
+96
+97
+97
+98
+98
+98
+97
+97
+97
+97
+97
+97
+97
+97
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+98
+100
+97
+95
+95
+97
+99
+101
+102
+102
+116
+132
+141
+143
+140
+130
+122
+99
+84
+71
+69
+67
+61
+60
+67
+57
+54
+52
+53
+54
+57
+61
+61
+76
+83
+86
+79
+70
+66
+68
+70
+64
+65
+66
+68
+69
+69
+69
+69
+68
+69
+69
+69
+69
+69
+69
+71
+70
+69
+68
+68
+67
+67
+68
+68
+67
+70
+70
+65
+59
+56
+57
+60
+64
+64
+63
+61
+58
+58
+57
+58
+58
+59
+59
+58
+58
+58
+57
+57
+57
+57
+58
+58
+58
+58
+58
+58
+57
+57
+57
+56
+56
+56
+56
+56
+59
+59
+59
+59
+58
+58
+58
+58
+55
+55
+55
+54
+53
+53
+53
+52
+49
+54
+51
+50
+53
+50
+54
+70
+79
+79
+80
+82
+83
+86
+87
+90
+93
+97
+95
+90
+95
+104
+102
+93
+85
+81
+77
+75
+77
+81
+82
+83
+76
+71
+65
+61
+61
+61
+60
+59
+61
+61
+59
+60
+60
+61
+63
+65
+83
+101
+120
+134
+145
+155
+161
+162
+162
+152
+139
+130
+128
+130
+130
+128
+133
+134
+135
+136
+135
+134
+132
+131
+124
+111
+102
+97
+97
+97
+98
+98
+99
+99
+99
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+99
+102
+104
+103
+99
+97
+101
+110
+119
+126
+141
+157
+165
+167
+164
+157
+150
+123
+102
+82
+74
+72
+69
+69
+72
+76
+72
+68
+62
+57
+55
+54
+52
+53
+66
+79
+79
+73
+71
+69
+66
+64
+65
+66
+67
+69
+69
+69
+69
+69
+68
+68
+69
+69
+69
+69
+69
+70
+69
+70
+69
+69
+69
+69
+70
+65
+67
+69
+66
+62
+57
+59
+60
+63
+63
+62
+61
+59
+58
+58
+59
+58
+59
+58
+58
+58
+57
+57
+57
+58
+58
+58
+58
+58
+58
+58
+58
+57
+58
+57
+57
+57
+56
+56
+55
+58
+58
+57
+58
+58
+57
+57
+58
+55
+54
+54
+53
+52
+51
+51
+52
+49
+55
+52
+50
+52
+50
+54
+68
+78
+78
+81
+84
+85
+87
+89
+91
+89
+92
+90
+85
+88
+94
+89
+75
+72
+69
+66
+65
+68
+73
+76
+78
+75
+72
+69
+65
+63
+62
+60
+58
+60
+60
+59
+59
+59
+60
+62
+64
+80
+97
+118
+133
+146
+157
+163
+163
+159
+145
+131
+125
+126
+129
+129
+128
+131
+132
+133
+133
+132
+131
+130
+129
+124
+112
+102
+97
+97
+97
+98
+98
+99
+99
+99
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+99
+97
+100
+102
+99
+100
+109
+129
+144
+163
+177
+193
+198
+196
+192
+185
+178
+156
+130
+99
+81
+73
+69
+68
+70
+69
+69
+67
+66
+66
+67
+69
+69
+52
+56
+61
+68
+79
+87
+81
+67
+71
+70
+70
+70
+70
+70
+68
+68
+69
+68
+69
+69
+68
+68
+68
+69
+69
+70
+69
+69
+68
+69
+70
+69
+63
+64
+67
+67
+65
+61
+61
+61
+62
+63
+62
+61
+60
+59
+58
+59
+58
+58
+58
+58
+57
+58
+57
+56
+58
+58
+58
+58
+58
+58
+58
+58
+58
+58
+57
+57
+56
+55
+55
+56
+56
+57
+57
+57
+56
+57
+56
+56
+54
+54
+53
+52
+51
+52
+51
+52
+50
+54
+51
+50
+52
+49
+53
+66
+77
+77
+80
+84
+86
+88
+89
+92
+92
+91
+87
+83
+83
+81
+73
+64
+60
+59
+57
+57
+59
+62
+66
+69
+72
+72
+71
+70
+67
+64
+62
+60
+58
+57
+57
+57
+57
+59
+62
+64
+76
+94
+115
+132
+147
+159
+163
+161
+152
+137
+125
+123
+127
+128
+128
+129
+131
+131
+131
+131
+131
+130
+129
+128
+121
+110
+101
+97
+97
+97
+98
+98
+99
+99
+99
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+98
+96
+97
+100
+103
+112
+133
+158
+176
+194
+210
+225
+230
+227
+222
+214
+206
+188
+165
+135
+109
+89
+76
+69
+68
+74
+72
+70
+67
+62
+59
+56
+55
+60
+59
+53
+55
+71
+92
+96
+87
+81
+79
+78
+77
+74
+72
+69
+68
+68
+68
+68
+67
+67
+66
+67
+67
+68
+68
+68
+69
+68
+69
+70
+69
+64
+64
+66
+67
+67
+64
+59
+57
+61
+62
+62
+61
+60
+59
+59
+60
+58
+58
+58
+57
+57
+57
+56
+57
+58
+58
+58
+58
+58
+58
+58
+58
+58
+58
+57
+57
+56
+56
+55
+56
+56
+57
+56
+56
+56
+55
+55
+55
+54
+54
+53
+53
+52
+51
+50
+51
+49
+55
+52
+49
+52
+48
+52
+65
+77
+77
+80
+85
+88
+89
+90
+92
+94
+87
+80
+78
+74
+66
+58
+56
+55
+55
+54
+53
+53
+56
+58
+60
+68
+70
+72
+73
+70
+67
+64
+62
+56
+54
+54
+55
+56
+59
+60
+63
+72
+89
+113
+131
+147
+158
+161
+156
+141
+129
+120
+122
+126
+126
+126
+128
+130
+130
+130
+130
+129
+129
+128
+128
+118
+107
+96
+97
+97
+97
+98
+98
+99
+99
+99
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+98
+99
+99
+99
+99
+99
+99
+99
+98
+103
+103
+103
+113
+132
+160
+188
+208
+207
+224
+242
+248
+247
+243
+236
+226
+208
+193
+171
+145
+117
+92
+77
+72
+73
+73
+71
+68
+65
+61
+57
+57
+58
+61
+53
+45
+54
+81
+102
+109
+92
+90
+87
+84
+78
+74
+70
+68
+68
+69
+69
+67
+67
+66
+67
+67
+68
+67
+67
+67
+67
+68
+69
+69
+66
+65
+66
+68
+69
+65
+58
+53
+60
+61
+61
+61
+60
+60
+60
+60
+58
+58
+58
+58
+57
+56
+57
+57
+58
+58
+58
+58
+58
+58
+58
+59
+58
+59
+57
+57
+56
+57
+56
+55
+56
+56
+55
+56
+55
+55
+54
+54
+54
+54
+53
+52
+51
+52
+51
+52
+50
+55
+52
+49
+51
+48
+51
+66
+77
+79
+82
+85
+88
+90
+91
+92
+84
+74
+67
+68
+65
+56
+55
+60
+55
+56
+55
+55
+53
+54
+56
+57
+65
+69
+74
+75
+73
+70
+65
+62
+54
+52
+53
+54
+55
+58
+60
+63
+69
+87
+111
+130
+146
+157
+158
+153
+134
+123
+118
+122
+126
+124
+124
+127
+130
+130
+129
+129
+129
+128
+128
+127
+116
+104
+93
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+98
+98
+98
+99
+99
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+98
+100
+115
+146
+175
+198
+220
+238
+244
+247
+252
+255
+255
+251
+247
+242
+225
+216
+202
+182
+160
+132
+98
+72
+72
+71
+69
+68
+60
+54
+52
+57
+60
+61
+56
+54
+69
+105
+147
+172
+140
+119
+96
+86
+82
+77
+71
+69
+70
+74
+68
+60
+62
+72
+71
+62
+64
+64
+65
+66
+66
+64
+64
+64
+67
+65
+64
+65
+66
+64
+58
+56
+61
+62
+62
+62
+61
+60
+61
+60
+58
+57
+57
+56
+56
+56
+56
+56
+57
+57
+57
+57
+58
+58
+58
+58
+61
+60
+59
+58
+57
+56
+55
+55
+54
+55
+55
+56
+55
+56
+55
+55
+50
+54
+57
+56
+52
+50
+50
+51
+48
+55
+50
+45
+48
+47
+50
+62
+79
+80
+81
+82
+89
+95
+89
+78
+69
+69
+67
+64
+60
+59
+58
+58
+56
+56
+54
+54
+53
+54
+54
+54
+57
+61
+67
+71
+73
+71
+67
+63
+52
+50
+50
+51
+53
+57
+60
+63
+62
+82
+108
+130
+148
+158
+155
+148
+126
+121
+117
+117
+120
+123
+124
+123
+127
+131
+131
+127
+125
+128
+129
+126
+113
+100
+88
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+98
+98
+98
+99
+99
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+110
+133
+164
+195
+218
+238
+251
+251
+252
+253
+254
+255
+254
+252
+250
+240
+235
+223
+205
+187
+163
+131
+106
+81
+74
+67
+66
+62
+58
+57
+60
+56
+62
+69
+80
+104
+140
+178
+197
+213
+177
+131
+99
+87
+83
+74
+67
+71
+70
+73
+75
+70
+62
+61
+67
+63
+63
+64
+64
+65
+65
+64
+63
+65
+64
+64
+66
+67
+65
+59
+56
+61
+62
+62
+62
+61
+60
+60
+60
+58
+57
+57
+56
+57
+56
+56
+56
+57
+57
+57
+57
+58
+59
+59
+59
+60
+60
+58
+58
+57
+56
+54
+55
+55
+56
+56
+56
+56
+56
+56
+56
+54
+55
+56
+57
+55
+52
+50
+51
+49
+52
+47
+46
+50
+46
+48
+62
+74
+82
+88
+88
+86
+82
+74
+63
+65
+65
+64
+62
+60
+60
+59
+58
+57
+55
+55
+55
+54
+54
+54
+55
+57
+60
+65
+69
+72
+71
+69
+66
+56
+53
+51
+50
+51
+54
+58
+61
+63
+81
+108
+130
+149
+157
+152
+143
+124
+120
+117
+117
+119
+122
+122
+122
+124
+128
+128
+125
+124
+127
+127
+123
+109
+95
+84
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+98
+98
+98
+99
+99
+100
+100
+100
+100
+100
+100
+100
+100
+101
+101
+102
+100
+123
+153
+182
+209
+233
+249
+255
+255
+255
+254
+254
+254
+255
+255
+255
+252
+249
+240
+229
+216
+196
+168
+145
+103
+88
+71
+67
+68
+68
+65
+62
+58
+74
+95
+118
+146
+178
+206
+220
+228
+240
+224
+167
+101
+67
+72
+86
+88
+79
+70
+69
+70
+70
+68
+67
+61
+62
+63
+63
+65
+64
+65
+64
+64
+64
+66
+69
+68
+66
+60
+57
+60
+61
+62
+62
+61
+60
+61
+61
+57
+57
+58
+57
+57
+56
+56
+56
+58
+58
+59
+59
+59
+59
+59
+60
+59
+59
+57
+57
+56
+56
+54
+55
+56
+56
+56
+56
+56
+57
+56
+56
+57
+56
+56
+56
+56
+55
+52
+49
+50
+49
+45
+48
+52
+45
+48
+68
+80
+86
+89
+84
+74
+67
+60
+54
+59
+59
+60
+61
+60
+60
+59
+58
+57
+57
+56
+55
+55
+55
+55
+56
+57
+59
+63
+67
+69
+71
+71
+70
+62
+58
+52
+50
+48
+51
+55
+58
+62
+81
+109
+132
+151
+156
+147
+135
+120
+117
+114
+114
+116
+118
+119
+119
+120
+123
+125
+123
+123
+125
+124
+119
+101
+87
+76
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+99
+98
+98
+99
+99
+100
+100
+100
+100
+100
+100
+101
+101
+101
+101
+103
+107
+135
+167
+190
+213
+237
+251
+253
+255
+255
+255
+254
+254
+253
+254
+255
+253
+253
+247
+242
+233
+218
+193
+171
+135
+109
+81
+72
+74
+73
+68
+64
+70
+96
+129
+154
+175
+198
+218
+230
+238
+249
+246
+215
+178
+141
+100
+68
+83
+85
+82
+72
+72
+77
+74
+63
+62
+62
+63
+64
+64
+64
+65
+65
+62
+64
+67
+69
+69
+65
+61
+59
+60
+61
+62
+62
+61
+60
+61
+61
+57
+57
+58
+57
+57
+56
+56
+56
+59
+59
+60
+59
+59
+59
+59
+60
+57
+57
+57
+57
+56
+55
+54
+54
+55
+55
+55
+56
+56
+56
+56
+56
+59
+55
+53
+55
+56
+56
+52
+49
+53
+50
+46
+50
+51
+42
+50
+78
+92
+87
+78
+67
+60
+58
+59
+60
+56
+58
+59
+60
+61
+59
+57
+57
+57
+56
+56
+57
+56
+57
+57
+57
+57
+58
+61
+63
+66
+69
+72
+73
+67
+63
+56
+51
+48
+49
+52
+56
+60
+82
+112
+139
+154
+156
+141
+124
+115
+114
+113
+113
+114
+115
+116
+116
+117
+121
+123
+122
+124
+125
+122
+114
+93
+78
+66
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+99
+99
+98
+98
+99
+99
+100
+100
+100
+100
+100
+100
+101
+101
+102
+102
+103
+113
+140
+169
+191
+213
+237
+252
+254
+255
+255
+255
+255
+253
+252
+249
+248
+255
+255
+253
+249
+244
+232
+210
+190
+163
+130
+93
+76
+75
+74
+71
+67
+95
+125
+162
+184
+195
+208
+225
+238
+246
+243
+237
+236
+242
+224
+165
+105
+76
+82
+90
+92
+83
+69
+64
+67
+64
+64
+63
+64
+66
+66
+66
+66
+63
+65
+69
+69
+67
+64
+62
+61
+60
+60
+61
+61
+61
+60
+61
+61
+58
+58
+58
+57
+57
+56
+56
+56
+60
+60
+60
+59
+59
+58
+58
+59
+55
+56
+55
+55
+54
+54
+54
+54
+55
+56
+56
+56
+56
+56
+56
+56
+57
+54
+52
+53
+55
+55
+52
+49
+50
+51
+48
+49
+49
+42
+54
+85
+89
+78
+63
+55
+54
+57
+59
+60
+57
+59
+59
+60
+60
+58
+56
+55
+57
+57
+56
+57
+57
+58
+57
+57
+57
+57
+58
+59
+62
+67
+69
+71
+69
+66
+59
+54
+50
+49
+51
+53
+58
+83
+117
+143
+155
+149
+130
+112
+111
+110
+110
+110
+110
+110
+112
+112
+116
+120
+122
+122
+124
+124
+119
+108
+82
+67
+56
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+99
+99
+98
+98
+99
+99
+100
+100
+100
+100
+100
+101
+101
+102
+103
+103
+103
+110
+130
+154
+181
+206
+230
+247
+254
+254
+255
+255
+255
+254
+250
+246
+244
+253
+253
+252
+249
+246
+236
+215
+196
+176
+142
+103
+80
+75
+77
+79
+82
+123
+155
+190
+207
+212
+220
+235
+247
+240
+251
+255
+251
+243
+237
+226
+210
+143
+100
+75
+85
+88
+71
+63
+74
+67
+67
+66
+66
+66
+66
+66
+65
+65
+67
+68
+68
+65
+61
+59
+60
+59
+60
+61
+61
+61
+60
+61
+61
+58
+58
+58
+57
+57
+56
+56
+56
+60
+59
+59
+58
+58
+57
+56
+57
+55
+55
+55
+56
+55
+55
+54
+55
+55
+55
+55
+55
+55
+55
+55
+55
+55
+54
+53
+53
+54
+55
+54
+53
+50
+54
+50
+48
+52
+53
+61
+83
+71
+62
+53
+53
+56
+58
+55
+54
+57
+59
+58
+57
+57
+56
+55
+54
+56
+57
+56
+57
+57
+57
+57
+57
+57
+57
+57
+58
+59
+62
+65
+66
+68
+67
+63
+59
+54
+52
+51
+52
+55
+84
+120
+141
+146
+137
+119
+104
+107
+107
+109
+109
+107
+107
+108
+110
+115
+119
+122
+123
+124
+124
+115
+102
+73
+59
+47
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+99
+99
+98
+98
+99
+99
+100
+100
+100
+100
+100
+101
+101
+102
+103
+104
+104
+105
+116
+140
+172
+200
+222
+240
+252
+252
+254
+255
+255
+255
+253
+249
+247
+246
+247
+247
+246
+245
+236
+216
+198
+177
+147
+110
+87
+81
+86
+98
+109
+154
+179
+207
+223
+228
+235
+241
+248
+253
+251
+248
+247
+249
+252
+253
+249
+224
+168
+111
+87
+85
+82
+77
+74
+71
+69
+69
+68
+68
+67
+66
+65
+67
+69
+69
+67
+61
+59
+59
+60
+60
+61
+60
+61
+60
+60
+61
+61
+58
+58
+58
+57
+57
+56
+56
+56
+59
+59
+58
+57
+56
+55
+55
+55
+55
+56
+56
+56
+56
+56
+56
+56
+55
+55
+55
+55
+56
+56
+56
+55
+54
+55
+56
+56
+55
+56
+59
+61
+56
+60
+54
+53
+67
+76
+73
+77
+57
+54
+53
+57
+59
+55
+52
+53
+56
+56
+55
+54
+54
+54
+54
+55
+55
+57
+56
+57
+57
+57
+56
+56
+57
+56
+56
+55
+56
+57
+59
+60
+66
+67
+66
+65
+60
+56
+52
+51
+57
+85
+117
+132
+132
+121
+110
+100
+103
+105
+107
+107
+105
+105
+106
+108
+114
+118
+120
+122
+123
+121
+110
+95
+66
+52
+40
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+100
+99
+99
+99
+98
+98
+98
+99
+100
+100
+100
+101
+102
+103
+103
+104
+104
+106
+111
+116
+138
+174
+204
+223
+238
+252
+253
+253
+254
+255
+255
+255
+255
+254
+248
+250
+249
+250
+249
+242
+224
+206
+178
+151
+117
+95
+90
+99
+119
+134
+173
+193
+215
+230
+238
+244
+245
+244
+247
+249
+252
+255
+253
+247
+249
+252
+242
+242
+201
+129
+85
+85
+85
+69
+74
+71
+70
+69
+67
+66
+66
+65
+70
+71
+71
+67
+62
+58
+59
+62
+61
+62
+62
+61
+60
+60
+60
+60
+58
+58
+58
+57
+57
+56
+56
+56
+58
+58
+57
+56
+55
+54
+54
+54
+56
+57
+56
+56
+57
+57
+57
+56
+55
+55
+55
+55
+55
+55
+55
+55
+53
+56
+59
+58
+57
+58
+62
+67
+64
+68
+60
+61
+86
+100
+87
+76
+58
+56
+57
+60
+58
+53
+53
+60
+54
+53
+52
+51
+51
+53
+54
+55
+54
+55
+55
+56
+55
+55
+55
+55
+57
+56
+56
+55
+55
+55
+56
+56
+63
+66
+69
+68
+65
+60
+54
+52
+59
+86
+114
+124
+118
+109
+102
+97
+100
+104
+107
+107
+104
+103
+105
+107
+113
+116
+119
+120
+122
+118
+106
+91
+62
+47
+37
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+100
+100
+100
+100
+99
+101
+101
+102
+96
+101
+107
+108
+101
+101
+113
+130
+142
+157
+178
+199
+220
+237
+246
+250
+254
+254
+255
+254
+253
+252
+253
+254
+250
+250
+249
+250
+252
+247
+229
+212
+185
+152
+116
+100
+107
+125
+144
+155
+185
+204
+227
+239
+243
+247
+249
+248
+254
+254
+254
+255
+255
+255
+255
+255
+253
+253
+251
+229
+166
+96
+68
+75
+79
+71
+67
+68
+72
+73
+72
+71
+71
+72
+73
+71
+69
+66
+66
+67
+67
+67
+65
+63
+62
+60
+59
+59
+57
+58
+57
+56
+55
+55
+55
+54
+55
+55
+56
+56
+55
+54
+53
+51
+55
+56
+56
+55
+55
+54
+54
+54
+53
+54
+55
+56
+55
+54
+52
+51
+51
+53
+56
+57
+58
+59
+61
+65
+66
+73
+72
+95
+107
+120
+127
+74
+57
+58
+58
+57
+57
+57
+56
+56
+55
+55
+54
+54
+53
+53
+52
+53
+52
+53
+52
+53
+52
+52
+52
+52
+53
+52
+52
+51
+51
+52
+52
+54
+59
+61
+64
+66
+68
+66
+64
+62
+63
+81
+101
+107
+98
+88
+84
+87
+99
+101
+102
+102
+101
+101
+103
+106
+112
+116
+118
+119
+119
+113
+98
+79
+48
+43
+41
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+99
+100
+99
+100
+101
+102
+100
+104
+106
+107
+103
+108
+127
+147
+174
+193
+213
+230
+242
+251
+254
+254
+253
+254
+255
+255
+252
+251
+252
+253
+250
+250
+250
+250
+251
+245
+226
+208
+184
+150
+113
+97
+107
+129
+152
+167
+193
+211
+231
+243
+247
+251
+252
+251
+254
+254
+254
+254
+254
+254
+254
+255
+255
+251
+249
+248
+233
+190
+128
+80
+78
+76
+75
+74
+68
+61
+63
+70
+70
+74
+76
+73
+70
+67
+68
+71
+68
+67
+66
+64
+62
+60
+60
+60
+58
+58
+58
+58
+57
+56
+55
+55
+54
+55
+56
+56
+56
+54
+53
+52
+55
+56
+56
+55
+55
+55
+54
+54
+51
+51
+53
+54
+56
+56
+56
+57
+54
+55
+57
+59
+59
+62
+64
+68
+72
+80
+82
+102
+117
+133
+131
+76
+57
+57
+57
+57
+56
+56
+56
+55
+55
+55
+55
+54
+54
+53
+53
+53
+52
+52
+52
+52
+52
+52
+52
+52
+53
+52
+51
+51
+51
+51
+52
+54
+56
+58
+61
+64
+66
+66
+66
+66
+67
+80
+93
+96
+87
+79
+80
+85
+98
+100
+101
+101
+99
+99
+100
+101
+110
+114
+118
+119
+116
+109
+92
+73
+49
+44
+42
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+99
+100
+99
+100
+101
+102
+104
+105
+106
+107
+107
+119
+146
+172
+197
+219
+240
+251
+254
+255
+254
+253
+253
+254
+255
+254
+251
+248
+247
+247
+247
+249
+248
+248
+247
+238
+219
+202
+177
+150
+121
+112
+123
+144
+167
+181
+207
+222
+239
+248
+251
+254
+254
+253
+254
+254
+254
+254
+254
+254
+254
+255
+250
+255
+254
+248
+250
+245
+204
+157
+75
+81
+75
+64
+71
+89
+84
+63
+68
+72
+75
+73
+66
+63
+65
+70
+66
+66
+66
+65
+64
+62
+62
+62
+60
+60
+59
+59
+58
+57
+57
+57
+57
+57
+57
+57
+57
+56
+54
+53
+55
+56
+55
+56
+54
+55
+55
+54
+53
+53
+53
+54
+55
+56
+58
+58
+59
+59
+58
+60
+63
+67
+68
+69
+73
+86
+89
+106
+127
+142
+127
+70
+56
+56
+56
+56
+55
+55
+55
+54
+55
+55
+55
+54
+54
+53
+53
+53
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+51
+50
+50
+51
+52
+53
+53
+54
+57
+59
+62
+64
+66
+68
+69
+76
+82
+81
+73
+70
+76
+84
+95
+98
+100
+99
+97
+96
+95
+96
+107
+112
+117
+118
+113
+103
+84
+65
+49
+44
+42
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+99
+100
+99
+100
+101
+102
+105
+106
+107
+109
+113
+130
+161
+190
+202
+228
+249
+255
+252
+252
+251
+250
+254
+255
+254
+252
+246
+241
+239
+237
+241
+244
+244
+244
+241
+234
+216
+199
+177
+161
+147
+147
+158
+173
+187
+197
+220
+233
+246
+251
+253
+255
+255
+253
+254
+254
+254
+254
+254
+254
+254
+254
+251
+254
+254
+240
+237
+249
+250
+238
+191
+127
+79
+80
+89
+78
+68
+69
+65
+70
+73
+71
+64
+60
+62
+66
+64
+66
+65
+65
+64
+64
+64
+63
+61
+61
+61
+60
+61
+60
+60
+59
+59
+59
+59
+58
+57
+56
+56
+55
+56
+55
+54
+55
+55
+54
+55
+55
+58
+57
+55
+55
+55
+55
+57
+58
+63
+62
+61
+62
+67
+69
+71
+71
+74
+86
+92
+107
+130
+142
+113
+61
+55
+56
+55
+55
+55
+54
+54
+54
+55
+55
+55
+54
+54
+53
+53
+53
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+51
+52
+52
+52
+54
+55
+58
+61
+64
+65
+67
+71
+73
+69
+63
+64
+70
+78
+88
+93
+96
+98
+96
+95
+94
+94
+105
+112
+117
+117
+110
+99
+77
+58
+47
+42
+40
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+99
+100
+99
+100
+101
+102
+103
+105
+109
+112
+117
+135
+167
+196
+212
+239
+255
+255
+251
+253
+253
+252
+255
+255
+253
+248
+240
+234
+230
+229
+235
+239
+240
+240
+238
+232
+216
+202
+189
+181
+174
+180
+190
+200
+211
+217
+232
+242
+250
+252
+253
+255
+255
+252
+254
+254
+254
+254
+254
+254
+254
+254
+251
+247
+246
+247
+255
+255
+255
+252
+254
+220
+155
+98
+75
+76
+80
+74
+65
+68
+71
+69
+63
+58
+59
+63
+62
+63
+65
+65
+66
+66
+67
+66
+63
+62
+62
+61
+61
+61
+62
+61
+62
+61
+60
+59
+59
+58
+58
+58
+55
+54
+54
+54
+54
+55
+55
+55
+59
+58
+57
+57
+57
+57
+58
+60
+66
+65
+67
+68
+71
+73
+73
+73
+76
+86
+98
+109
+131
+135
+96
+58
+56
+56
+55
+55
+55
+54
+54
+54
+55
+55
+55
+54
+54
+53
+53
+53
+51
+51
+51
+51
+51
+51
+51
+51
+50
+50
+49
+49
+49
+49
+50
+51
+54
+53
+52
+52
+53
+56
+59
+61
+61
+64
+65
+65
+61
+61
+65
+70
+79
+84
+89
+92
+93
+94
+94
+96
+103
+112
+118
+117
+107
+93
+71
+52
+45
+41
+39
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+99
+100
+99
+100
+101
+102
+103
+106
+110
+114
+118
+133
+164
+191
+222
+246
+255
+255
+251
+254
+254
+252
+255
+255
+252
+245
+237
+231
+227
+227
+233
+236
+237
+236
+235
+230
+218
+206
+206
+198
+195
+201
+210
+219
+230
+239
+242
+249
+253
+253
+253
+255
+254
+252
+254
+254
+254
+254
+254
+254
+254
+253
+252
+246
+249
+255
+255
+255
+255
+254
+242
+255
+236
+166
+106
+90
+87
+76
+70
+70
+70
+70
+66
+61
+59
+59
+61
+62
+63
+64
+65
+66
+68
+68
+63
+63
+63
+63
+63
+62
+63
+63
+64
+63
+62
+60
+60
+60
+60
+60
+56
+54
+54
+54
+54
+55
+56
+56
+55
+56
+57
+58
+60
+63
+64
+66
+66
+71
+76
+77
+77
+75
+75
+77
+81
+88
+104
+115
+131
+123
+79
+61
+57
+56
+56
+56
+55
+55
+55
+54
+55
+55
+55
+54
+54
+53
+53
+53
+50
+50
+50
+50
+50
+50
+50
+50
+50
+49
+48
+48
+48
+48
+49
+51
+53
+54
+52
+52
+52
+53
+55
+57
+56
+59
+63
+64
+63
+63
+62
+64
+70
+75
+79
+84
+87
+91
+93
+96
+101
+111
+116
+114
+103
+88
+66
+50
+45
+41
+39
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+100
+100
+99
+100
+99
+100
+102
+102
+105
+107
+109
+110
+114
+127
+157
+183
+218
+242
+255
+253
+249
+255
+254
+248
+255
+253
+249
+243
+235
+231
+230
+232
+233
+237
+236
+233
+232
+229
+219
+208
+211
+209
+212
+221
+228
+233
+241
+249
+249
+254
+255
+253
+253
+255
+255
+252
+254
+254
+254
+254
+254
+254
+254
+253
+250
+251
+254
+255
+255
+251
+255
+255
+255
+245
+250
+250
+204
+119
+81
+93
+80
+76
+75
+75
+73
+69
+63
+59
+61
+62
+63
+64
+65
+67
+69
+69
+63
+63
+63
+63
+63
+63
+63
+63
+66
+65
+63
+61
+61
+62
+62
+61
+56
+55
+54
+54
+55
+55
+56
+56
+56
+57
+59
+62
+64
+65
+65
+67
+69
+78
+86
+87
+83
+79
+79
+82
+86
+89
+108
+118
+129
+109
+62
+66
+59
+57
+57
+57
+56
+56
+56
+55
+55
+55
+55
+54
+54
+53
+53
+53
+50
+50
+50
+50
+50
+50
+50
+50
+49
+49
+48
+47
+47
+48
+49
+50
+52
+53
+52
+52
+53
+53
+54
+55
+54
+58
+61
+65
+66
+66
+64
+63
+63
+67
+71
+76
+79
+84
+88
+92
+98
+107
+113
+109
+98
+82
+62
+47
+47
+44
+42
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+101
+100
+100
+99
+100
+99
+100
+102
+102
+108
+108
+108
+107
+108
+123
+152
+177
+210
+235
+252
+251
+250
+255
+254
+248
+255
+253
+248
+242
+235
+233
+234
+237
+236
+237
+237
+232
+230
+227
+218
+208
+206
+210
+223
+237
+244
+245
+245
+249
+252
+255
+255
+254
+254
+255
+255
+253
+254
+254
+254
+254
+254
+254
+254
+254
+249
+249
+250
+251
+255
+255
+255
+253
+252
+255
+253
+242
+239
+225
+174
+114
+89
+84
+81
+82
+81
+77
+68
+61
+62
+63
+62
+64
+65
+67
+68
+69
+63
+63
+62
+63
+63
+63
+63
+63
+66
+66
+64
+62
+61
+62
+62
+62
+56
+55
+56
+56
+56
+56
+57
+58
+59
+62
+64
+66
+67
+65
+64
+66
+71
+83
+94
+94
+88
+83
+83
+87
+86
+87
+109
+119
+125
+97
+50
+68
+59
+58
+58
+57
+57
+57
+56
+56
+55
+55
+55
+54
+54
+53
+53
+53
+50
+50
+50
+50
+50
+50
+50
+50
+49
+48
+48
+47
+47
+48
+48
+49
+50
+51
+52
+53
+53
+54
+55
+55
+54
+56
+60
+65
+68
+68
+66
+65
+59
+63
+66
+70
+73
+78
+84
+88
+96
+104
+110
+105
+94
+78
+59
+44
+48
+46
+44
+101
+101
+101
+101
+101
+101
+101
+101
+102
+102
+102
+102
+102
+102
+102
+102
+101
+101
+100
+101
+100
+101
+103
+103
+110
+109
+110
+114
+114
+121
+145
+170
+196
+217
+239
+251
+253
+255
+254
+253
+255
+254
+250
+248
+246
+244
+241
+239
+246
+242
+238
+236
+230
+220
+213
+212
+211
+217
+227
+234
+241
+246
+248
+252
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+255
+255
+255
+255
+255
+254
+253
+255
+253
+249
+248
+249
+248
+241
+232
+132
+100
+83
+87
+93
+83
+75
+76
+63
+63
+63
+60
+59
+60
+63
+66
+61
+61
+61
+62
+64
+64
+63
+63
+65
+64
+64
+64
+63
+63
+62
+62
+57
+56
+58
+59
+59
+60
+60
+61
+63
+62
+71
+71
+61
+57
+56
+49
+81
+78
+73
+75
+89
+101
+97
+85
+88
+96
+115
+128
+108
+73
+57
+62
+60
+59
+58
+58
+58
+57
+57
+57
+57
+57
+57
+56
+55
+55
+55
+54
+54
+54
+53
+53
+52
+52
+52
+52
+49
+49
+49
+49
+49
+49
+48
+48
+53
+52
+52
+51
+52
+52
+53
+53
+50
+52
+55
+61
+65
+69
+71
+74
+66
+64
+62
+61
+62
+69
+78
+85
+91
+98
+104
+100
+87
+70
+57
+51
+48
+47
+46
+101
+101
+101
+101
+101
+101
+101
+101
+102
+102
+102
+102
+102
+102
+102
+102
+101
+101
+100
+101
+100
+101
+103
+104
+110
+108
+110
+114
+116
+124
+148
+174
+199
+219
+240
+252
+254
+255
+254
+253
+255
+254
+251
+249
+247
+245
+242
+237
+239
+235
+231
+230
+225
+217
+212
+212
+216
+222
+230
+238
+243
+246
+249
+251
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+254
+252
+250
+250
+248
+252
+250
+248
+249
+252
+252
+248
+241
+234
+178
+117
+92
+92
+92
+87
+83
+70
+68
+68
+68
+67
+66
+65
+63
+64
+62
+62
+64
+63
+61
+62
+65
+63
+63
+63
+63
+62
+62
+61
+62
+60
+61
+62
+63
+63
+65
+65
+66
+71
+65
+71
+73
+61
+55
+56
+54
+76
+75
+71
+68
+77
+91
+97
+97
+89
+103
+119
+121
+96
+68
+59
+67
+62
+60
+60
+60
+59
+59
+59
+59
+59
+59
+59
+58
+58
+57
+57
+57
+55
+55
+55
+54
+54
+54
+53
+53
+51
+51
+50
+50
+49
+49
+48
+48
+49
+49
+48
+48
+48
+49
+50
+51
+53
+52
+53
+55
+59
+65
+70
+74
+70
+69
+66
+63
+63
+66
+72
+76
+88
+95
+100
+98
+86
+71
+59
+53
+51
+49
+48
+101
+101
+101
+101
+101
+101
+101
+101
+102
+102
+102
+102
+102
+102
+102
+102
+101
+101
+99
+100
+100
+101
+103
+104
+108
+109
+111
+116
+117
+125
+152
+178
+202
+221
+242
+252
+253
+255
+254
+253
+255
+253
+251
+250
+247
+244
+239
+235
+231
+225
+221
+222
+219
+215
+213
+217
+225
+230
+237
+243
+246
+248
+249
+252
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+254
+253
+250
+248
+246
+244
+249
+247
+247
+250
+255
+255
+253
+248
+240
+246
+235
+191
+131
+90
+83
+93
+93
+82
+70
+63
+62
+66
+70
+71
+63
+60
+60
+66
+65
+63
+65
+72
+62
+62
+62
+63
+61
+62
+61
+62
+63
+65
+65
+67
+67
+67
+67
+68
+75
+66
+73
+83
+71
+59
+61
+65
+69
+72
+69
+64
+66
+78
+96
+106
+97
+113
+122
+109
+79
+60
+61
+70
+62
+62
+62
+62
+61
+61
+61
+60
+62
+62
+61
+61
+61
+60
+60
+60
+58
+57
+57
+57
+56
+56
+56
+55
+53
+53
+52
+51
+50
+49
+48
+48
+46
+46
+46
+46
+46
+47
+48
+49
+54
+52
+49
+49
+52
+59
+66
+72
+75
+75
+73
+69
+65
+63
+65
+67
+81
+88
+94
+94
+84
+72
+62
+56
+53
+53
+52
+100
+100
+101
+101
+101
+101
+102
+102
+102
+102
+102
+102
+102
+102
+102
+102
+101
+101
+99
+100
+100
+102
+103
+105
+109
+109
+111
+115
+116
+124
+152
+179
+202
+220
+240
+251
+253
+255
+255
+254
+254
+253
+251
+250
+247
+243
+237
+232
+224
+218
+214
+215
+215
+215
+219
+224
+235
+239
+244
+248
+249
+250
+250
+252
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+254
+253
+251
+248
+246
+244
+248
+247
+248
+252
+255
+255
+255
+252
+255
+248
+238
+239
+239
+210
+144
+82
+76
+75
+74
+78
+80
+75
+64
+55
+77
+68
+66
+68
+67
+59
+56
+61
+63
+63
+63
+63
+62
+62
+62
+63
+64
+66
+67
+67
+67
+68
+69
+68
+73
+66
+84
+105
+94
+75
+71
+75
+68
+72
+70
+66
+65
+73
+89
+101
+109
+120
+118
+95
+67
+59
+64
+67
+63
+63
+63
+62
+62
+61
+61
+61
+63
+62
+62
+62
+62
+62
+62
+62
+60
+60
+60
+59
+59
+59
+58
+58
+56
+56
+54
+53
+52
+50
+49
+49
+48
+48
+47
+47
+48
+49
+50
+50
+53
+51
+48
+48
+50
+55
+61
+66
+75
+77
+77
+74
+69
+64
+63
+62
+73
+79
+85
+86
+80
+71
+62
+58
+55
+54
+53
+100
+100
+100
+101
+101
+102
+102
+102
+102
+102
+102
+102
+102
+102
+102
+102
+101
+100
+99
+100
+100
+102
+103
+105
+109
+110
+113
+115
+114
+121
+149
+178
+200
+219
+239
+249
+252
+255
+255
+255
+255
+255
+255
+254
+250
+245
+238
+232
+220
+213
+208
+209
+212
+217
+224
+233
+242
+246
+250
+252
+253
+253
+253
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+253
+251
+249
+249
+248
+249
+250
+254
+255
+255
+255
+253
+241
+251
+253
+251
+248
+244
+227
+207
+183
+156
+118
+87
+73
+73
+76
+79
+71
+66
+66
+69
+73
+74
+75
+75
+65
+66
+66
+66
+66
+66
+67
+67
+70
+71
+71
+71
+71
+72
+71
+71
+72
+72
+100
+126
+114
+88
+76
+77
+69
+70
+72
+71
+70
+71
+78
+85
+119
+122
+110
+85
+66
+65
+65
+62
+62
+63
+63
+62
+62
+61
+61
+61
+62
+62
+62
+62
+62
+62
+62
+62
+62
+62
+62
+61
+61
+61
+60
+60
+59
+58
+57
+56
+55
+53
+52
+52
+50
+50
+49
+48
+48
+49
+50
+50
+49
+49
+49
+49
+50
+53
+55
+59
+71
+76
+79
+79
+75
+70
+67
+65
+69
+73
+79
+80
+77
+70
+63
+57
+55
+53
+52
+99
+99
+100
+101
+101
+102
+103
+103
+102
+102
+102
+102
+102
+102
+102
+102
+100
+100
+99
+100
+100
+102
+103
+105
+109
+110
+113
+115
+112
+120
+148
+178
+203
+221
+240
+250
+252
+255
+255
+255
+255
+255
+255
+255
+253
+247
+240
+232
+218
+209
+203
+203
+207
+215
+226
+238
+245
+249
+252
+254
+254
+254
+254
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+255
+255
+254
+253
+251
+252
+253
+254
+255
+254
+252
+252
+246
+250
+248
+244
+246
+254
+254
+254
+248
+239
+227
+209
+187
+161
+134
+117
+93
+94
+85
+68
+58
+60
+62
+61
+69
+69
+69
+70
+71
+71
+71
+72
+75
+77
+77
+76
+77
+77
+76
+76
+76
+81
+107
+128
+113
+89
+76
+71
+70
+70
+72
+74
+74
+71
+73
+77
+120
+115
+100
+82
+73
+74
+69
+61
+63
+63
+63
+63
+62
+62
+62
+62
+61
+61
+62
+62
+62
+62
+63
+63
+63
+63
+63
+63
+62
+62
+62
+61
+61
+61
+60
+59
+58
+57
+56
+56
+52
+51
+50
+49
+48
+48
+48
+48
+48
+49
+49
+50
+51
+51
+51
+52
+63
+70
+76
+79
+78
+75
+72
+71
+68
+71
+75
+77
+74
+69
+63
+57
+54
+53
+52
+99
+99
+100
+101
+101
+102
+103
+103
+102
+102
+102
+102
+102
+102
+102
+102
+100
+100
+99
+100
+100
+102
+103
+105
+108
+109
+114
+115
+113
+121
+151
+183
+210
+227
+245
+253
+253
+255
+255
+254
+255
+255
+255
+255
+251
+244
+235
+227
+213
+204
+196
+196
+201
+210
+224
+237
+246
+249
+252
+254
+254
+254
+255
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+251
+252
+253
+255
+255
+255
+255
+255
+254
+255
+255
+255
+253
+251
+249
+248
+241
+245
+250
+253
+252
+251
+248
+245
+255
+255
+255
+255
+252
+246
+239
+235
+228
+230
+202
+143
+94
+79
+76
+72
+74
+74
+74
+75
+75
+76
+76
+77
+78
+79
+79
+80
+79
+78
+78
+78
+79
+84
+102
+111
+94
+79
+75
+70
+73
+73
+76
+78
+77
+73
+80
+88
+109
+102
+92
+86
+84
+81
+74
+67
+64
+65
+65
+65
+64
+64
+64
+63
+62
+62
+62
+63
+63
+64
+64
+64
+64
+64
+64
+63
+63
+62
+62
+62
+63
+63
+62
+62
+61
+61
+60
+60
+57
+55
+54
+52
+50
+49
+47
+47
+48
+48
+49
+50
+50
+50
+49
+49
+57
+64
+72
+77
+79
+78
+76
+76
+71
+73
+76
+77
+75
+71
+64
+59
+55
+53
+52
+100
+100
+101
+102
+102
+102
+103
+103
+102
+102
+102
+102
+102
+102
+102
+101
+101
+101
+100
+101
+100
+102
+103
+105
+107
+109
+114
+116
+113
+123
+155
+187
+216
+232
+249
+255
+255
+255
+255
+254
+250
+251
+251
+250
+246
+238
+227
+219
+209
+199
+190
+190
+195
+206
+221
+234
+246
+249
+253
+254
+253
+254
+255
+255
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+253
+250
+251
+252
+254
+255
+255
+255
+255
+254
+255
+255
+255
+252
+249
+247
+246
+248
+247
+249
+252
+252
+253
+255
+255
+250
+250
+249
+248
+246
+248
+250
+253
+241
+251
+220
+142
+80
+66
+72
+72
+77
+77
+78
+78
+79
+79
+80
+81
+79
+79
+79
+79
+78
+78
+77
+77
+78
+82
+92
+89
+73
+70
+76
+74
+78
+79
+81
+83
+78
+77
+90
+106
+101
+94
+89
+90
+91
+85
+78
+73
+66
+66
+66
+65
+65
+65
+64
+64
+63
+63
+63
+64
+64
+66
+66
+66
+64
+64
+64
+63
+63
+62
+62
+62
+64
+64
+64
+64
+63
+63
+63
+63
+63
+61
+59
+56
+54
+52
+51
+51
+50
+50
+50
+50
+50
+50
+52
+54
+54
+61
+70
+76
+79
+77
+77
+77
+74
+75
+77
+78
+78
+72
+66
+60
+56
+54
+53
+102
+103
+103
+104
+106
+106
+106
+107
+103
+103
+101
+101
+100
+101
+101
+102
+101
+103
+103
+104
+102
+102
+100
+100
+103
+108
+111
+111
+112
+130
+168
+199
+219
+233
+247
+252
+253
+255
+255
+254
+249
+251
+248
+240
+236
+233
+222
+209
+208
+191
+179
+178
+184
+195
+210
+223
+243
+248
+251
+254
+254
+254
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+255
+254
+253
+252
+252
+252
+254
+253
+253
+253
+255
+255
+255
+254
+255
+252
+252
+255
+254
+249
+247
+250
+251
+252
+253
+255
+255
+255
+255
+254
+255
+255
+255
+254
+254
+254
+254
+254
+245
+252
+225
+137
+79
+78
+76
+74
+78
+78
+78
+78
+79
+79
+78
+79
+77
+78
+78
+80
+79
+79
+77
+76
+80
+79
+74
+70
+72
+75
+77
+78
+88
+87
+81
+77
+86
+99
+99
+90
+89
+89
+90
+90
+88
+85
+81
+78
+70
+68
+65
+63
+62
+62
+63
+65
+63
+64
+64
+65
+65
+66
+66
+66
+66
+65
+64
+64
+63
+65
+64
+66
+65
+66
+64
+66
+66
+68
+68
+69
+66
+65
+65
+63
+61
+59
+56
+54
+52
+53
+55
+57
+59
+64
+71
+77
+86
+88
+86
+84
+82
+79
+78
+79
+76
+81
+86
+87
+87
+84
+74
+63
+55
+51
+48
+103
+104
+104
+105
+107
+108
+108
+108
+104
+104
+102
+102
+101
+102
+101
+103
+102
+103
+103
+104
+103
+102
+102
+102
+105
+108
+112
+115
+119
+137
+171
+200
+218
+233
+247
+254
+255
+255
+254
+253
+250
+249
+243
+235
+230
+225
+214
+201
+191
+179
+172
+174
+183
+195
+208
+221
+243
+247
+251
+254
+253
+253
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+255
+255
+253
+253
+253
+252
+252
+253
+254
+254
+253
+253
+255
+255
+254
+253
+255
+255
+252
+247
+236
+228
+231
+241
+252
+254
+255
+255
+255
+255
+255
+254
+255
+255
+254
+254
+253
+254
+253
+254
+246
+252
+224
+137
+77
+79
+75
+74
+79
+79
+79
+79
+79
+79
+80
+80
+77
+78
+78
+81
+79
+80
+77
+77
+80
+78
+74
+73
+73
+77
+80
+82
+86
+88
+93
+100
+101
+94
+88
+86
+85
+86
+85
+86
+85
+84
+82
+81
+76
+74
+70
+67
+64
+63
+64
+65
+62
+64
+64
+65
+66
+66
+67
+67
+66
+65
+65
+64
+64
+65
+65
+66
+66
+66
+66
+66
+67
+68
+69
+70
+71
+72
+70
+71
+68
+66
+63
+61
+62
+62
+61
+62
+67
+77
+89
+97
+112
+110
+105
+97
+89
+82
+76
+75
+79
+86
+93
+95
+95
+92
+83
+70
+53
+50
+47
+103
+104
+104
+106
+107
+109
+108
+109
+106
+106
+104
+104
+102
+103
+102
+104
+102
+104
+103
+103
+103
+102
+102
+102
+105
+106
+109
+116
+124
+143
+172
+196
+214
+230
+246
+254
+255
+255
+251
+249
+245
+242
+233
+223
+217
+211
+201
+190
+180
+174
+175
+181
+193
+205
+216
+227
+243
+247
+251
+253
+252
+253
+254
+255
+254
+254
+254
+254
+254
+254
+254
+254
+255
+254
+253
+253
+252
+252
+252
+253
+254
+253
+252
+253
+254
+255
+254
+253
+255
+255
+253
+242
+223
+213
+221
+237
+252
+254
+255
+255
+255
+255
+255
+254
+255
+255
+254
+254
+253
+254
+253
+254
+247
+252
+223
+134
+74
+77
+75
+75
+78
+79
+79
+80
+80
+79
+80
+79
+77
+78
+78
+80
+79
+80
+78
+78
+81
+78
+76
+76
+77
+80
+85
+89
+91
+98
+116
+130
+120
+95
+81
+81
+80
+81
+79
+80
+80
+81
+83
+84
+83
+80
+76
+72
+68
+66
+65
+65
+62
+64
+64
+65
+66
+66
+67
+67
+66
+66
+65
+65
+65
+65
+66
+66
+66
+66
+66
+66
+67
+68
+70
+70
+74
+75
+74
+75
+73
+71
+69
+67
+69
+67
+64
+66
+73
+86
+103
+114
+127
+125
+116
+104
+90
+79
+71
+69
+78
+87
+96
+101
+102
+98
+88
+75
+57
+54
+51
+103
+104
+104
+106
+108
+110
+109
+110
+108
+108
+106
+105
+104
+104
+103
+105
+103
+104
+103
+103
+102
+102
+102
+103
+103
+102
+104
+113
+125
+143
+166
+185
+209
+226
+244
+253
+254
+252
+246
+242
+235
+229
+218
+209
+203
+197
+188
+180
+184
+184
+191
+200
+213
+224
+233
+241
+244
+247
+251
+253
+252
+252
+254
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+253
+252
+252
+252
+251
+252
+253
+252
+251
+252
+254
+255
+254
+253
+253
+255
+253
+243
+225
+217
+226
+242
+252
+254
+255
+255
+255
+255
+255
+254
+255
+255
+254
+254
+253
+254
+252
+253
+250
+254
+223
+133
+74
+77
+77
+77
+78
+79
+80
+80
+80
+79
+79
+78
+77
+78
+77
+79
+78
+80
+79
+79
+83
+80
+79
+82
+83
+85
+91
+99
+114
+128
+148
+156
+143
+117
+95
+87
+79
+78
+75
+74
+75
+78
+81
+83
+84
+82
+79
+75
+71
+69
+67
+67
+62
+64
+64
+65
+66
+66
+67
+67
+67
+66
+65
+65
+65
+65
+66
+67
+67
+66
+66
+67
+67
+69
+70
+71
+71
+72
+72
+73
+72
+71
+69
+68
+68
+67
+64
+66
+73
+88
+105
+117
+122
+121
+113
+100
+85
+73
+65
+63
+72
+82
+94
+101
+103
+99
+88
+73
+59
+55
+52
+103
+104
+104
+106
+108
+110
+110
+111
+110
+109
+107
+106
+104
+104
+104
+105
+103
+104
+102
+102
+101
+101
+102
+103
+104
+102
+103
+113
+125
+141
+160
+175
+204
+223
+241
+251
+251
+249
+242
+237
+228
+219
+208
+201
+196
+190
+183
+178
+190
+195
+206
+216
+227
+238
+245
+249
+244
+247
+250
+252
+251
+252
+254
+255
+254
+254
+254
+254
+254
+254
+254
+254
+254
+254
+252
+252
+252
+251
+251
+252
+252
+251
+251
+252
+254
+255
+254
+253
+253
+253
+252
+247
+236
+229
+234
+245
+252
+254
+255
+255
+255
+255
+255
+254
+255
+255
+253
+254
+254
+254
+252
+252
+252
+255
+224
+134
+75
+79
+79
+80
+78
+79
+81
+81
+81
+79
+78
+77
+77
+78
+77
+79
+78
+80
+79
+81
+85
+82
+83
+88
+88
+89
+97
+107
+142
+162
+174
+169
+158
+145
+120
+95
+80
+78
+73
+71
+71
+74
+78
+80
+82
+80
+78
+75
+73
+71
+69
+69
+62
+64
+64
+65
+66
+66
+67
+67
+67
+67
+66
+65
+65
+66
+67
+67
+67
+67
+67
+67
+68
+69
+70
+71
+69
+70
+70
+71
+70
+69
+68
+66
+65
+65
+63
+66
+73
+86
+101
+111
+116
+115
+108
+96
+80
+68
+61
+61
+67
+78
+92
+99
+102
+98
+86
+71
+53
+50
+47
+45
+45
+46
+47
+46
+46
+47
+47
+47
+47
+45
+45
+45
+45
+45
+45
+47
+46
+46
+45
+45
+46
+46
+47
+45
+45
+45
+45
+45
+45
+45
+45
+43
+43
+43
+42
+42
+41
+41
+41
+41
+41
+41
+41
+41
+41
+41
+41
+36
+37
+37
+38
+39
+40
+41
+41
+44
+44
+45
+46
+46
+47
+48
+46
+48
+48
+50
+52
+52
+53
+54
+54
+53
+53
+51
+50
+51
+51
+52
+53
+49
+50
+52
+53
+54
+56
+57
+55
+58
+57
+58
+59
+62
+63
+64
+64
+76
+76
+75
+73
+73
+68
+66
+65
+65
+64
+63
+63
+64
+62
+60
+55
+47
+46
+46
+45
+45
+45
+45
+45
+44
+44
+45
+44
+42
+41
+42
+44
+45
+47
+47
+46
+44
+43
+43
+43
+43
+43
+42
+42
+42
+43
+44
+47
+54
+53
+50
+49
+51
+51
+52
+52
+48
+50
+56
+59
+57
+50
+42
+38
+50
+52
+52
+50
+49
+48
+45
+45
+47
+47
+47
+46
+45
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+45
+45
+44
+43
+42
+43
+49
+57
+60
+67
+72
+77
+79
+91
+110
+131
+144
+163
+174
+186
+189
+173
+145
+118
+104
+103
+94
+94
+98
+111
+130
+144
+152
+159
+154
+147
+129
+108
+85
+69
+69
+91
+98
+98
+45
+45
+46
+46
+45
+46
+47
+47
+47
+47
+45
+45
+45
+45
+45
+45
+46
+46
+45
+45
+45
+45
+46
+46
+45
+45
+45
+45
+45
+45
+45
+45
+43
+43
+42
+42
+42
+41
+41
+41
+42
+42
+42
+42
+42
+42
+42
+42
+37
+38
+38
+39
+40
+41
+42
+42
+44
+44
+45
+45
+46
+47
+48
+46
+47
+47
+49
+51
+51
+52
+53
+53
+52
+52
+49
+49
+49
+50
+51
+52
+48
+49
+51
+52
+54
+52
+53
+51
+52
+52
+52
+55
+58
+60
+61
+64
+73
+73
+73
+72
+71
+68
+67
+67
+65
+64
+63
+63
+64
+62
+60
+54
+47
+46
+45
+45
+45
+44
+45
+45
+44
+43
+45
+43
+42
+41
+42
+44
+45
+47
+46
+46
+44
+43
+43
+43
+43
+42
+42
+42
+42
+43
+44
+47
+53
+53
+51
+49
+51
+52
+52
+53
+50
+54
+56
+59
+58
+51
+42
+41
+51
+53
+52
+51
+50
+49
+46
+46
+47
+47
+47
+46
+45
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+43
+42
+43
+48
+55
+58
+61
+65
+73
+76
+86
+106
+125
+142
+162
+174
+185
+187
+169
+141
+117
+105
+101
+95
+95
+95
+102
+116
+136
+149
+151
+148
+143
+131
+111
+89
+76
+74
+90
+97
+97
+44
+44
+45
+46
+45
+45
+46
+46
+46
+46
+46
+46
+44
+44
+44
+44
+46
+46
+45
+45
+45
+45
+46
+47
+46
+46
+46
+46
+46
+46
+46
+46
+44
+43
+43
+43
+42
+42
+42
+42
+43
+43
+43
+43
+43
+43
+43
+42
+39
+39
+40
+41
+41
+42
+42
+43
+44
+44
+44
+45
+46
+47
+47
+46
+46
+46
+48
+50
+52
+53
+51
+51
+49
+49
+49
+49
+47
+48
+49
+50
+49
+49
+50
+50
+51
+50
+50
+48
+45
+43
+46
+50
+54
+58
+61
+62
+69
+70
+71
+70
+70
+69
+68
+68
+64
+63
+64
+64
+64
+61
+59
+53
+46
+45
+45
+44
+45
+45
+44
+44
+45
+45
+44
+43
+44
+42
+42
+43
+45
+46
+46
+46
+43
+43
+43
+43
+44
+44
+43
+43
+44
+44
+43
+46
+54
+53
+51
+50
+52
+53
+53
+53
+56
+59
+61
+61
+59
+52
+44
+44
+52
+55
+54
+52
+49
+48
+47
+47
+47
+47
+47
+46
+45
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+45
+47
+46
+45
+43
+43
+47
+52
+54
+55
+57
+64
+68
+77
+96
+118
+136
+158
+173
+185
+183
+164
+137
+118
+107
+101
+99
+99
+94
+92
+101
+121
+136
+134
+136
+133
+124
+108
+88
+77
+76
+91
+96
+96
+43
+44
+44
+45
+44
+45
+45
+45
+45
+45
+45
+45
+43
+43
+43
+43
+45
+45
+44
+44
+44
+44
+45
+45
+46
+46
+46
+46
+46
+46
+46
+46
+43
+43
+43
+42
+42
+42
+41
+41
+44
+44
+44
+44
+44
+44
+44
+44
+43
+41
+41
+42
+42
+43
+43
+43
+43
+43
+44
+45
+46
+46
+47
+45
+45
+45
+46
+48
+50
+50
+49
+49
+49
+47
+46
+47
+47
+46
+48
+48
+50
+52
+52
+51
+50
+49
+47
+45
+41
+39
+42
+45
+51
+56
+60
+62
+67
+67
+67
+67
+68
+67
+67
+65
+64
+63
+64
+64
+64
+61
+57
+51
+45
+44
+44
+44
+44
+44
+44
+43
+45
+44
+43
+42
+43
+42
+41
+42
+44
+46
+46
+45
+43
+43
+42
+42
+43
+43
+42
+42
+43
+44
+45
+45
+54
+53
+50
+52
+54
+56
+55
+55
+60
+63
+64
+62
+58
+52
+46
+45
+53
+54
+55
+52
+50
+49
+48
+48
+47
+47
+47
+46
+45
+44
+44
+45
+46
+46
+46
+46
+46
+46
+46
+46
+48
+48
+47
+45
+44
+45
+49
+50
+49
+51
+55
+59
+68
+85
+108
+130
+152
+171
+181
+181
+162
+139
+121
+112
+104
+103
+102
+94
+86
+90
+102
+113
+120
+119
+118
+111
+97
+84
+76
+76
+89
+93
+94
+45
+45
+43
+44
+45
+46
+44
+45
+44
+44
+43
+43
+43
+43
+41
+41
+44
+44
+43
+43
+43
+43
+44
+44
+45
+45
+45
+45
+45
+45
+45
+45
+43
+43
+42
+42
+42
+41
+41
+41
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+45
+45
+45
+45
+45
+46
+46
+47
+48
+49
+47
+45
+44
+46
+47
+47
+48
+48
+46
+46
+46
+46
+45
+46
+47
+48
+49
+54
+53
+53
+53
+51
+49
+47
+44
+41
+41
+42
+44
+50
+56
+61
+63
+66
+67
+66
+66
+66
+65
+64
+62
+63
+60
+62
+62
+62
+58
+53
+48
+45
+44
+44
+44
+45
+45
+45
+45
+46
+45
+44
+43
+44
+43
+42
+42
+44
+46
+45
+45
+45
+44
+44
+44
+44
+44
+44
+44
+44
+45
+46
+46
+52
+52
+49
+51
+55
+57
+56
+55
+59
+63
+67
+64
+59
+50
+45
+43
+51
+53
+53
+51
+50
+49
+48
+47
+47
+47
+47
+46
+46
+45
+45
+45
+46
+46
+46
+46
+46
+46
+46
+46
+48
+48
+48
+46
+44
+44
+47
+46
+46
+46
+49
+51
+59
+75
+101
+128
+151
+170
+183
+180
+166
+148
+131
+119
+109
+104
+101
+96
+89
+88
+87
+85
+99
+98
+97
+92
+84
+77
+77
+80
+86
+88
+90
+44
+44
+43
+43
+44
+45
+44
+44
+43
+43
+42
+42
+42
+42
+40
+42
+43
+43
+42
+41
+41
+42
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+42
+42
+42
+42
+41
+41
+41
+40
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+44
+44
+44
+44
+44
+45
+45
+46
+47
+48
+48
+46
+44
+43
+44
+45
+46
+46
+46
+46
+47
+45
+45
+46
+47
+46
+48
+49
+54
+54
+53
+54
+51
+50
+48
+45
+43
+41
+42
+44
+49
+53
+58
+61
+64
+65
+65
+64
+65
+62
+63
+60
+60
+59
+61
+61
+61
+56
+50
+44
+44
+44
+43
+43
+45
+44
+44
+44
+45
+44
+44
+44
+43
+42
+41
+42
+43
+45
+45
+45
+44
+44
+44
+43
+44
+43
+43
+43
+45
+44
+47
+46
+52
+50
+50
+53
+57
+58
+58
+59
+57
+64
+71
+69
+61
+52
+47
+45
+51
+53
+52
+51
+49
+48
+47
+47
+47
+47
+47
+46
+46
+45
+45
+45
+47
+47
+47
+47
+47
+47
+47
+47
+47
+48
+48
+47
+45
+44
+46
+44
+45
+41
+43
+48
+54
+70
+100
+133
+159
+178
+188
+187
+175
+161
+143
+126
+114
+104
+99
+96
+94
+88
+79
+70
+74
+74
+74
+73
+70
+69
+73
+79
+83
+83
+85
+43
+43
+44
+45
+44
+44
+45
+45
+42
+42
+42
+42
+41
+41
+41
+41
+42
+44
+43
+43
+43
+43
+44
+44
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+43
+43
+43
+42
+42
+45
+45
+45
+45
+45
+45
+45
+43
+44
+44
+44
+43
+43
+43
+43
+43
+44
+44
+45
+46
+47
+47
+48
+46
+43
+44
+45
+46
+47
+45
+45
+44
+46
+46
+47
+45
+47
+48
+50
+51
+54
+52
+53
+52
+50
+50
+46
+44
+44
+42
+41
+42
+46
+50
+55
+56
+60
+62
+62
+62
+64
+63
+64
+62
+58
+58
+60
+60
+59
+54
+47
+41
+45
+45
+45
+44
+46
+46
+45
+45
+46
+46
+45
+45
+44
+42
+42
+41
+43
+45
+45
+44
+46
+46
+45
+45
+45
+45
+44
+44
+47
+46
+48
+47
+50
+49
+49
+54
+58
+60
+61
+61
+65
+74
+82
+81
+73
+62
+55
+54
+51
+50
+49
+48
+47
+46
+47
+46
+46
+46
+47
+46
+46
+45
+45
+45
+47
+47
+47
+47
+47
+47
+47
+47
+46
+47
+48
+47
+45
+44
+45
+44
+43
+41
+41
+45
+52
+70
+106
+141
+171
+190
+199
+198
+189
+175
+154
+130
+113
+103
+99
+95
+93
+87
+78
+72
+69
+71
+72
+73
+72
+71
+75
+77
+79
+78
+79
+43
+43
+44
+44
+45
+44
+45
+45
+42
+42
+42
+42
+41
+41
+41
+42
+44
+43
+43
+42
+42
+43
+43
+44
+42
+42
+42
+42
+42
+42
+42
+42
+44
+44
+44
+43
+43
+42
+42
+42
+44
+44
+44
+44
+44
+44
+44
+44
+44
+43
+43
+43
+43
+43
+43
+43
+44
+44
+45
+46
+46
+47
+48
+48
+44
+43
+44
+45
+46
+46
+46
+44
+47
+46
+47
+47
+49
+49
+50
+51
+52
+52
+53
+52
+50
+50
+48
+45
+46
+42
+41
+40
+44
+47
+52
+53
+58
+59
+62
+63
+64
+65
+65
+64
+59
+59
+59
+59
+58
+52
+45
+40
+45
+45
+44
+46
+46
+45
+45
+47
+46
+46
+46
+45
+43
+42
+41
+43
+45
+45
+45
+44
+46
+45
+45
+45
+45
+46
+46
+46
+47
+47
+49
+49
+50
+49
+52
+54
+59
+62
+62
+65
+76
+84
+92
+93
+84
+73
+65
+63
+50
+50
+49
+48
+46
+45
+46
+46
+46
+46
+47
+46
+46
+45
+45
+45
+47
+47
+47
+47
+47
+47
+47
+47
+45
+46
+48
+48
+46
+45
+45
+44
+44
+41
+42
+48
+54
+72
+110
+148
+182
+198
+207
+204
+198
+182
+159
+132
+110
+100
+97
+94
+89
+86
+80
+75
+82
+85
+87
+88
+85
+84
+83
+83
+76
+74
+74
+47
+47
+47
+45
+45
+45
+43
+43
+44
+44
+42
+41
+41
+41
+40
+40
+42
+42
+42
+42
+42
+42
+42
+43
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+43
+43
+44
+44
+45
+44
+44
+44
+44
+44
+44
+44
+44
+41
+42
+43
+44
+44
+44
+44
+44
+44
+44
+44
+44
+45
+46
+47
+47
+45
+44
+45
+46
+47
+46
+46
+46
+46
+44
+45
+46
+47
+48
+49
+50
+52
+53
+54
+53
+51
+49
+48
+43
+46
+45
+43
+44
+47
+48
+49
+48
+51
+52
+56
+58
+61
+62
+63
+64
+63
+65
+65
+62
+56
+49
+46
+44
+46
+45
+44
+46
+45
+45
+46
+47
+44
+44
+45
+45
+44
+43
+42
+42
+43
+43
+45
+44
+44
+44
+45
+45
+47
+47
+47
+48
+51
+50
+53
+52
+53
+52
+57
+62
+64
+62
+65
+71
+82
+95
+102
+104
+100
+94
+83
+70
+66
+61
+53
+47
+44
+43
+44
+43
+46
+46
+45
+45
+45
+44
+43
+43
+46
+46
+46
+46
+46
+46
+46
+46
+47
+47
+47
+47
+47
+47
+47
+47
+48
+51
+50
+47
+54
+79
+121
+159
+187
+207
+217
+211
+198
+183
+167
+148
+116
+100
+93
+88
+85
+86
+92
+98
+110
+120
+124
+117
+111
+104
+95
+80
+70
+68
+71
+47
+47
+47
+47
+45
+45
+45
+43
+44
+43
+41
+41
+40
+40
+40
+40
+41
+41
+41
+41
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+43
+43
+43
+44
+44
+44
+44
+44
+44
+44
+44
+44
+44
+43
+41
+42
+43
+44
+44
+43
+43
+43
+43
+43
+43
+44
+45
+46
+47
+46
+46
+47
+46
+47
+48
+48
+45
+46
+46
+46
+45
+46
+48
+50
+51
+53
+53
+54
+54
+52
+50
+48
+47
+48
+46
+45
+45
+46
+49
+49
+49
+51
+51
+53
+56
+58
+60
+61
+61
+64
+64
+65
+62
+56
+50
+45
+45
+46
+45
+46
+45
+45
+45
+46
+46
+44
+44
+45
+44
+43
+43
+42
+44
+43
+43
+44
+44
+44
+43
+45
+45
+47
+47
+49
+49
+50
+54
+55
+54
+57
+55
+60
+64
+66
+65
+70
+78
+92
+102
+111
+111
+109
+101
+90
+77
+65
+61
+55
+52
+49
+46
+44
+41
+45
+45
+44
+43
+44
+43
+43
+43
+46
+46
+46
+46
+46
+46
+46
+46
+47
+47
+47
+47
+47
+47
+47
+49
+52
+55
+51
+51
+58
+84
+124
+158
+185
+202
+212
+207
+194
+184
+173
+158
+128
+113
+106
+106
+104
+109
+118
+127
+127
+135
+137
+129
+121
+113
+101
+84
+67
+62
+67
+47
+47
+47
+47
+47
+45
+45
+45
+43
+43
+43
+42
+40
+39
+39
+39
+41
+43
+43
+43
+42
+42
+42
+42
+44
+44
+44
+44
+44
+44
+44
+44
+43
+43
+44
+44
+44
+45
+45
+45
+45
+45
+45
+46
+46
+46
+46
+44
+43
+43
+44
+45
+45
+45
+45
+44
+44
+44
+44
+44
+45
+46
+47
+46
+46
+46
+47
+48
+49
+47
+47
+47
+48
+46
+46
+46
+48
+49
+51
+52
+53
+54
+55
+54
+54
+53
+50
+46
+48
+46
+44
+47
+47
+48
+48
+49
+51
+52
+51
+51
+54
+56
+58
+58
+64
+64
+66
+63
+58
+51
+46
+46
+47
+46
+46
+45
+45
+45
+47
+48
+45
+45
+46
+46
+45
+44
+43
+43
+42
+42
+44
+43
+45
+45
+45
+45
+48
+48
+50
+51
+52
+56
+58
+57
+61
+59
+62
+68
+70
+71
+77
+86
+103
+113
+122
+123
+119
+111
+98
+85
+68
+64
+59
+56
+52
+46
+43
+38
+41
+41
+42
+42
+42
+42
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+46
+46
+46
+46
+46
+46
+46
+50
+57
+57
+52
+51
+62
+89
+124
+154
+177
+191
+199
+195
+187
+182
+178
+171
+154
+143
+135
+130
+126
+126
+133
+141
+148
+152
+148
+138
+131
+123
+105
+84
+62
+58
+62
+48
+48
+48
+48
+48
+48
+46
+46
+43
+43
+42
+42
+39
+39
+39
+41
+43
+42
+42
+42
+42
+41
+41
+41
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+45
+45
+45
+45
+46
+46
+46
+42
+43
+44
+44
+44
+44
+43
+43
+43
+43
+43
+43
+44
+45
+46
+47
+47
+48
+49
+49
+49
+49
+49
+47
+47
+47
+47
+45
+46
+48
+49
+50
+51
+52
+53
+54
+54
+52
+51
+48
+50
+48
+47
+47
+48
+47
+49
+49
+52
+52
+50
+49
+50
+53
+55
+58
+62
+64
+65
+62
+58
+53
+48
+46
+45
+45
+45
+44
+44
+44
+46
+46
+44
+44
+46
+45
+44
+43
+45
+44
+41
+41
+43
+43
+44
+44
+45
+44
+47
+49
+49
+53
+55
+58
+60
+60
+64
+60
+62
+67
+73
+76
+86
+94
+111
+121
+130
+131
+128
+120
+106
+93
+74
+70
+64
+58
+54
+48
+44
+40
+41
+40
+41
+40
+41
+41
+44
+45
+44
+44
+44
+44
+44
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+49
+58
+56
+49
+49
+63
+88
+122
+147
+163
+176
+182
+178
+175
+178
+182
+179
+171
+163
+158
+152
+143
+137
+139
+144
+154
+155
+151
+141
+132
+124
+105
+79
+59
+56
+57
+50
+50
+50
+50
+48
+48
+46
+46
+45
+45
+43
+42
+42
+41
+41
+41
+43
+43
+43
+42
+42
+41
+41
+41
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+42
+42
+42
+43
+44
+44
+45
+45
+46
+46
+46
+42
+43
+43
+43
+43
+43
+42
+41
+42
+42
+42
+42
+43
+44
+46
+47
+49
+48
+49
+50
+50
+49
+48
+48
+48
+46
+46
+46
+47
+48
+47
+48
+51
+52
+53
+54
+54
+52
+52
+48
+50
+48
+48
+47
+49
+49
+50
+50
+54
+53
+53
+51
+51
+53
+54
+56
+59
+61
+62
+61
+56
+53
+48
+47
+45
+45
+46
+45
+44
+44
+47
+47
+46
+45
+47
+46
+45
+44
+44
+44
+43
+42
+42
+42
+43
+43
+44
+46
+48
+49
+52
+54
+57
+61
+64
+63
+65
+61
+63
+69
+76
+81
+93
+104
+119
+128
+135
+135
+131
+125
+113
+101
+82
+76
+67
+58
+54
+50
+47
+45
+41
+40
+40
+39
+40
+42
+44
+45
+44
+44
+44
+44
+44
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+49
+58
+53
+43
+44
+56
+81
+112
+135
+150
+160
+165
+163
+162
+169
+177
+179
+168
+167
+168
+165
+156
+146
+144
+148
+150
+149
+143
+133
+129
+120
+100
+73
+57
+56
+57
+51
+51
+51
+51
+49
+49
+47
+47
+46
+46
+44
+43
+43
+43
+42
+42
+44
+44
+44
+43
+42
+41
+41
+41
+42
+42
+42
+42
+42
+42
+42
+42
+43
+43
+42
+42
+42
+41
+41
+41
+43
+43
+43
+44
+45
+45
+46
+46
+42
+42
+43
+43
+42
+42
+41
+40
+43
+43
+42
+43
+44
+45
+46
+47
+50
+50
+49
+50
+50
+49
+48
+47
+48
+47
+45
+45
+46
+47
+46
+46
+49
+50
+51
+52
+52
+52
+52
+47
+49
+47
+47
+45
+46
+47
+48
+49
+53
+53
+53
+52
+52
+52
+52
+52
+53
+56
+58
+59
+55
+52
+49
+48
+46
+43
+44
+44
+43
+43
+46
+46
+45
+45
+46
+45
+44
+44
+43
+43
+42
+42
+41
+41
+43
+42
+45
+45
+49
+51
+54
+56
+60
+63
+66
+67
+65
+62
+67
+74
+82
+90
+101
+114
+125
+131
+138
+136
+132
+126
+117
+106
+92
+83
+74
+64
+58
+53
+50
+49
+44
+42
+41
+39
+41
+42
+43
+44
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+44
+44
+44
+46
+55
+49
+40
+38
+49
+71
+100
+121
+138
+148
+154
+152
+151
+158
+165
+173
+173
+176
+177
+172
+159
+145
+141
+144
+142
+143
+138
+130
+123
+114
+93
+69
+54
+53
+53
+51
+51
+51
+51
+49
+49
+49
+49
+47
+47
+47
+47
+44
+44
+43
+43
+46
+45
+45
+44
+43
+42
+42
+41
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+42
+41
+41
+41
+40
+40
+42
+42
+43
+44
+45
+45
+46
+46
+42
+42
+42
+42
+42
+41
+40
+39
+43
+43
+43
+43
+44
+45
+47
+47
+50
+51
+51
+52
+50
+49
+49
+48
+47
+47
+47
+46
+45
+45
+46
+47
+48
+48
+51
+52
+53
+51
+50
+48
+46
+43
+43
+43
+44
+45
+46
+46
+52
+53
+51
+51
+50
+49
+50
+48
+49
+52
+55
+57
+54
+53
+50
+50
+45
+45
+44
+43
+42
+42
+45
+45
+46
+46
+45
+45
+46
+45
+44
+44
+41
+41
+41
+40
+42
+42
+44
+44
+49
+52
+55
+57
+62
+65
+70
+70
+65
+64
+70
+79
+88
+98
+110
+121
+129
+134
+139
+136
+132
+128
+119
+110
+97
+91
+81
+73
+67
+59
+54
+52
+47
+44
+43
+39
+41
+41
+42
+44
+42
+42
+42
+42
+42
+42
+42
+42
+43
+43
+43
+43
+43
+43
+43
+45
+50
+45
+37
+33
+38
+59
+87
+109
+125
+134
+140
+138
+137
+142
+148
+157
+171
+174
+173
+165
+151
+135
+132
+134
+133
+136
+134
+123
+116
+107
+87
+66
+51
+48
+48
+49
+49
+49
+49
+47
+47
+47
+47
+46
+46
+46
+45
+45
+43
+44
+44
+45
+44
+44
+43
+44
+43
+42
+42
+42
+42
+42
+42
+42
+42
+44
+42
+44
+42
+44
+41
+41
+40
+40
+39
+41
+42
+43
+41
+44
+43
+44
+44
+42
+42
+42
+42
+41
+40
+39
+39
+44
+42
+42
+42
+43
+44
+45
+46
+49
+49
+50
+50
+49
+48
+47
+47
+47
+47
+46
+46
+44
+45
+46
+46
+45
+46
+49
+49
+50
+50
+49
+47
+43
+44
+41
+42
+43
+45
+46
+47
+50
+51
+50
+50
+51
+49
+49
+47
+47
+50
+54
+55
+55
+52
+50
+49
+47
+46
+45
+44
+44
+44
+46
+47
+46
+46
+47
+46
+45
+45
+44
+44
+43
+43
+42
+42
+43
+42
+44
+46
+50
+53
+54
+58
+61
+66
+69
+71
+67
+68
+74
+84
+96
+105
+117
+128
+133
+137
+139
+135
+132
+127
+121
+111
+98
+93
+85
+79
+72
+65
+56
+51
+46
+46
+44
+41
+41
+41
+42
+43
+44
+42
+44
+42
+44
+44
+44
+44
+45
+45
+45
+45
+45
+45
+45
+47
+47
+43
+37
+33
+37
+56
+81
+103
+116
+122
+126
+122
+123
+130
+136
+144
+153
+157
+154
+149
+138
+128
+130
+137
+127
+133
+130
+120
+111
+102
+83
+63
+50
+47
+48
+43
+43
+43
+44
+44
+44
+45
+45
+46
+47
+47
+47
+46
+44
+44
+44
+45
+45
+44
+43
+44
+44
+43
+43
+45
+45
+47
+47
+46
+45
+46
+43
+47
+45
+47
+45
+45
+45
+43
+43
+42
+42
+42
+41
+43
+41
+42
+42
+45
+45
+45
+46
+44
+45
+43
+43
+42
+41
+42
+43
+42
+44
+42
+43
+45
+45
+48
+48
+48
+47
+46
+45
+46
+45
+47
+46
+46
+47
+47
+46
+41
+41
+42
+45
+45
+46
+46
+45
+41
+39
+39
+38
+40
+44
+48
+48
+48
+47
+49
+51
+51
+48
+47
+45
+47
+46
+49
+50
+50
+48
+46
+44
+48
+50
+49
+48
+48
+47
+46
+46
+49
+48
+49
+48
+47
+46
+45
+45
+43
+51
+46
+41
+45
+45
+45
+50
+47
+52
+57
+63
+65
+66
+67
+69
+73
+80
+89
+97
+106
+113
+124
+130
+135
+137
+138
+140
+136
+130
+123
+117
+105
+95
+88
+85
+83
+78
+69
+61
+54
+51
+46
+42
+41
+43
+43
+42
+45
+42
+44
+41
+43
+44
+45
+45
+46
+46
+48
+48
+49
+49
+49
+48
+45
+43
+40
+35
+42
+64
+88
+103
+117
+115
+118
+119
+118
+117
+123
+134
+143
+143
+138
+131
+125
+124
+123
+126
+125
+126
+124
+117
+109
+99
+85
+70
+61
+51
+46
+42
+43
+43
+43
+44
+44
+44
+45
+46
+46
+47
+47
+46
+45
+44
+44
+44
+44
+44
+44
+43
+42
+43
+43
+45
+46
+48
+47
+49
+47
+46
+45
+47
+47
+47
+47
+45
+45
+43
+43
+42
+42
+41
+41
+42
+42
+41
+42
+46
+48
+46
+46
+44
+44
+42
+43
+42
+40
+41
+40
+41
+42
+41
+42
+44
+44
+46
+46
+46
+45
+46
+46
+46
+45
+46
+46
+46
+46
+47
+46
+42
+41
+43
+43
+45
+44
+45
+45
+43
+41
+40
+39
+41
+45
+49
+47
+47
+45
+48
+50
+52
+51
+50
+49
+46
+47
+46
+48
+49
+49
+47
+49
+50
+50
+50
+48
+48
+47
+47
+46
+49
+47
+48
+46
+46
+44
+44
+44
+44
+49
+45
+43
+46
+46
+42
+44
+49
+53
+58
+61
+64
+65
+67
+69
+72
+82
+93
+102
+112
+119
+127
+134
+136
+138
+141
+141
+137
+131
+125
+118
+105
+96
+90
+88
+88
+83
+74
+67
+59
+55
+51
+45
+43
+42
+43
+42
+43
+44
+44
+44
+44
+45
+48
+48
+48
+48
+49
+49
+49
+51
+51
+49
+49
+45
+41
+37
+44
+66
+93
+105
+111
+108
+110
+112
+112
+112
+119
+128
+135
+132
+129
+123
+120
+119
+121
+124
+124
+127
+123
+117
+110
+101
+87
+72
+59
+51
+45
+44
+44
+44
+44
+45
+45
+46
+46
+47
+47
+48
+48
+48
+47
+46
+45
+45
+45
+44
+43
+44
+43
+44
+44
+46
+46
+49
+48
+47
+46
+47
+46
+47
+47
+45
+45
+45
+45
+43
+43
+43
+43
+42
+42
+41
+42
+42
+43
+45
+47
+47
+47
+45
+44
+42
+42
+43
+42
+43
+42
+43
+42
+43
+44
+45
+45
+46
+46
+47
+46
+45
+45
+46
+45
+46
+46
+46
+46
+47
+46
+43
+43
+43
+45
+47
+46
+47
+46
+44
+42
+40
+40
+41
+42
+45
+44
+44
+45
+48
+52
+54
+53
+52
+52
+50
+50
+50
+51
+50
+51
+53
+53
+50
+47
+49
+46
+47
+44
+46
+44
+46
+44
+45
+42
+44
+41
+43
+43
+49
+49
+47
+47
+49
+49
+46
+45
+53
+56
+61
+63
+65
+65
+67
+70
+72
+81
+92
+101
+110
+116
+123
+131
+135
+137
+140
+140
+137
+131
+125
+120
+109
+101
+97
+96
+96
+93
+86
+80
+69
+63
+57
+50
+44
+41
+41
+40
+40
+42
+42
+42
+42
+43
+46
+47
+46
+46
+48
+48
+48
+49
+49
+48
+50
+46
+39
+34
+42
+65
+91
+105
+107
+106
+106
+110
+110
+109
+113
+120
+124
+122
+120
+118
+118
+117
+119
+121
+121
+125
+121
+116
+109
+99
+85
+70
+58
+50
+44
+45
+45
+46
+46
+46
+47
+47
+47
+48
+49
+49
+50
+50
+49
+48
+48
+47
+46
+46
+45
+45
+44
+46
+46
+48
+48
+48
+50
+49
+48
+47
+46
+48
+46
+46
+46
+46
+44
+44
+42
+44
+44
+43
+43
+43
+43
+43
+44
+47
+49
+48
+46
+46
+43
+43
+42
+44
+44
+43
+44
+43
+45
+45
+46
+47
+47
+48
+47
+49
+48
+46
+46
+46
+46
+47
+46
+46
+47
+48
+46
+46
+46
+46
+48
+47
+46
+47
+46
+46
+43
+41
+41
+40
+41
+42
+41
+47
+47
+51
+54
+56
+57
+55
+54
+56
+56
+57
+57
+55
+55
+55
+53
+49
+47
+46
+46
+45
+44
+43
+43
+42
+42
+42
+41
+41
+40
+40
+42
+49
+46
+46
+49
+45
+47
+51
+50
+55
+58
+61
+63
+64
+66
+68
+72
+74
+81
+91
+98
+103
+109
+118
+124
+131
+135
+137
+138
+135
+130
+126
+121
+111
+105
+103
+101
+103
+101
+95
+91
+80
+74
+63
+54
+47
+42
+40
+37
+38
+40
+40
+40
+40
+43
+44
+45
+43
+45
+45
+45
+47
+47
+47
+45
+43
+43
+39
+34
+44
+65
+89
+99
+104
+104
+105
+108
+109
+107
+109
+114
+116
+113
+112
+112
+115
+118
+120
+120
+120
+122
+119
+113
+106
+98
+82
+71
+57
+48
+42
+47
+47
+47
+48
+48
+48
+49
+49
+50
+50
+51
+52
+52
+52
+51
+51
+49
+49
+48
+48
+48
+47
+46
+46
+48
+49
+49
+50
+49
+48
+47
+46
+48
+46
+46
+46
+46
+44
+44
+44
+46
+44
+44
+44
+44
+44
+45
+46
+48
+48
+48
+48
+48
+46
+46
+45
+46
+47
+45
+45
+46
+47
+47
+47
+49
+49
+50
+49
+48
+47
+47
+47
+47
+47
+46
+46
+48
+48
+49
+49
+49
+49
+50
+52
+51
+50
+49
+49
+48
+45
+43
+42
+41
+41
+41
+41
+49
+51
+55
+58
+58
+59
+59
+58
+55
+56
+56
+57
+58
+58
+57
+55
+50
+49
+48
+47
+46
+46
+45
+45
+43
+43
+43
+43
+43
+42
+42
+42
+45
+39
+47
+52
+43
+42
+54
+55
+58
+60
+62
+63
+66
+68
+71
+74
+78
+81
+89
+93
+98
+105
+117
+124
+126
+130
+133
+134
+132
+128
+125
+119
+112
+108
+108
+107
+109
+108
+103
+100
+88
+82
+72
+61
+52
+44
+38
+36
+39
+39
+39
+38
+38
+40
+41
+42
+40
+42
+42
+42
+44
+44
+44
+42
+36
+39
+42
+42
+53
+70
+87
+94
+101
+98
+101
+105
+107
+104
+105
+107
+110
+108
+109
+110
+115
+117
+119
+119
+117
+119
+116
+111
+104
+95
+80
+69
+55
+47
+41
+48
+48
+49
+49
+50
+50
+50
+50
+51
+52
+53
+54
+54
+54
+53
+53
+52
+52
+51
+50
+51
+50
+49
+49
+49
+51
+52
+51
+50
+49
+50
+47
+48
+46
+48
+46
+46
+46
+46
+44
+45
+45
+45
+46
+45
+45
+46
+46
+47
+49
+50
+48
+49
+48
+48
+47
+48
+47
+46
+47
+48
+48
+49
+50
+51
+51
+51
+51
+50
+48
+49
+48
+49
+49
+48
+47
+49
+50
+51
+51
+50
+50
+53
+54
+54
+53
+53
+50
+50
+48
+45
+43
+41
+40
+41
+41
+43
+44
+48
+52
+55
+55
+55
+54
+53
+52
+54
+53
+57
+56
+57
+56
+51
+49
+49
+48
+47
+46
+46
+45
+44
+44
+44
+44
+44
+44
+44
+44
+42
+44
+69
+81
+56
+48
+59
+61
+58
+60
+62
+63
+66
+69
+74
+76
+79
+82
+88
+93
+98
+105
+115
+122
+122
+124
+127
+129
+130
+126
+121
+118
+112
+111
+112
+112
+112
+112
+109
+107
+98
+92
+83
+71
+62
+51
+42
+39
+39
+40
+39
+40
+39
+39
+39
+40
+40
+40
+42
+42
+42
+42
+42
+40
+36
+44
+52
+56
+64
+75
+86
+90
+93
+92
+93
+98
+101
+100
+101
+102
+109
+106
+105
+110
+114
+118
+118
+118
+116
+118
+114
+107
+102
+94
+79
+69
+54
+47
+41
+49
+50
+50
+50
+51
+51
+51
+52
+52
+53
+54
+55
+55
+55
+55
+55
+55
+55
+54
+53
+52
+52
+51
+51
+51
+52
+52
+52
+51
+50
+51
+48
+48
+46
+48
+46
+46
+46
+46
+45
+45
+45
+45
+45
+46
+46
+47
+47
+48
+48
+49
+50
+51
+52
+52
+51
+48
+47
+48
+48
+49
+48
+49
+49
+52
+52
+52
+51
+51
+49
+47
+46
+49
+48
+50
+49
+49
+50
+50
+51
+52
+53
+54
+55
+54
+54
+54
+52
+48
+47
+45
+43
+44
+42
+43
+42
+38
+39
+45
+51
+56
+57
+58
+59
+62
+58
+54
+51
+51
+52
+55
+55
+53
+51
+50
+50
+49
+48
+47
+47
+46
+46
+46
+47
+47
+47
+47
+47
+43
+56
+102
+121
+84
+60
+65
+64
+60
+61
+63
+64
+64
+68
+74
+79
+79
+85
+91
+95
+99
+102
+107
+111
+119
+122
+126
+128
+129
+126
+121
+118
+114
+114
+114
+114
+114
+115
+112
+112
+105
+101
+92
+81
+71
+59
+48
+43
+43
+44
+42
+42
+41
+40
+39
+41
+42
+42
+43
+43
+43
+43
+43
+40
+45
+52
+62
+68
+74
+81
+86
+87
+91
+87
+87
+92
+97
+97
+98
+102
+107
+106
+105
+110
+116
+120
+119
+118
+115
+118
+114
+108
+99
+91
+77
+67
+59
+51
+45
+50
+50
+51
+51
+51
+52
+52
+52
+53
+54
+55
+56
+56
+56
+56
+56
+56
+56
+56
+55
+54
+53
+53
+52
+53
+53
+53
+53
+53
+51
+49
+48
+46
+46
+46
+46
+47
+46
+46
+46
+45
+45
+46
+46
+46
+47
+47
+47
+48
+49
+50
+51
+52
+52
+53
+51
+47
+47
+47
+47
+48
+49
+50
+50
+53
+53
+52
+52
+51
+50
+48
+47
+50
+50
+51
+50
+50
+51
+52
+52
+50
+51
+53
+55
+54
+54
+53
+52
+46
+44
+43
+43
+42
+43
+41
+39
+42
+44
+51
+57
+64
+68
+71
+70
+74
+68
+59
+48
+45
+45
+49
+52
+53
+55
+54
+53
+53
+52
+51
+51
+51
+51
+51
+51
+51
+51
+51
+49
+38
+59
+122
+146
+99
+64
+64
+58
+60
+61
+62
+62
+64
+69
+76
+80
+81
+85
+92
+94
+95
+92
+91
+92
+117
+120
+124
+126
+128
+125
+120
+118
+114
+116
+117
+117
+117
+115
+115
+114
+110
+106
+97
+87
+78
+66
+53
+47
+45
+45
+44
+42
+40
+38
+39
+39
+41
+41
+43
+43
+43
+43
+43
+39
+52
+60
+70
+76
+79
+86
+88
+88
+90
+86
+86
+93
+98
+98
+100
+105
+108
+107
+106
+109
+118
+120
+121
+117
+117
+117
+113
+107
+101
+91
+77
+66
+63
+58
+51
+52
+52
+52
+52
+52
+53
+55
+55
+55
+55
+56
+56
+57
+58
+59
+59
+60
+60
+58
+57
+57
+56
+56
+55
+53
+53
+53
+53
+55
+53
+52
+52
+51
+51
+51
+50
+52
+49
+49
+49
+49
+49
+48
+47
+46
+46
+47
+47
+49
+49
+49
+48
+49
+50
+50
+49
+49
+49
+50
+50
+51
+50
+51
+53
+55
+55
+54
+53
+51
+50
+50
+50
+48
+47
+49
+48
+48
+48
+51
+51
+47
+61
+58
+51
+57
+50
+43
+54
+45
+46
+43
+39
+37
+44
+49
+48
+61
+59
+63
+65
+62
+55
+54
+59
+68
+69
+74
+75
+66
+53
+48
+54
+56
+56
+53
+50
+52
+56
+54
+49
+52
+50
+48
+48
+50
+51
+49
+44
+73
+97
+68
+85
+118
+79
+60
+70
+61
+65
+70
+72
+69
+68
+76
+84
+76
+93
+104
+93
+76
+69
+72
+76
+89
+92
+101
+114
+124
+125
+127
+130
+118
+119
+120
+120
+120
+119
+121
+120
+112
+110
+106
+98
+90
+78
+67
+63
+60
+50
+50
+49
+39
+35
+45
+49
+46
+44
+45
+46
+44
+42
+45
+47
+52
+58
+66
+69
+78
+90
+93
+89
+87
+90
+93
+97
+98
+100
+102
+104
+106
+111
+113
+111
+116
+120
+124
+122
+121
+114
+106
+102
+100
+90
+77
+68
+64
+66
+64
+52
+52
+52
+52
+53
+54
+56
+57
+56
+56
+57
+57
+58
+59
+59
+59
+61
+60
+58
+58
+57
+57
+56
+56
+56
+56
+56
+53
+54
+52
+52
+49
+50
+50
+50
+50
+51
+51
+51
+51
+49
+49
+48
+48
+47
+46
+47
+47
+49
+47
+47
+48
+49
+49
+48
+48
+48
+47
+49
+48
+50
+50
+51
+51
+53
+55
+54
+52
+51
+50
+50
+50
+49
+48
+49
+49
+49
+49
+52
+50
+51
+49
+43
+44
+54
+57
+59
+67
+63
+64
+65
+62
+66
+72
+76
+71
+55
+52
+54
+56
+51
+45
+45
+48
+53
+48
+48
+51
+54
+54
+58
+69
+77
+76
+68
+59
+56
+58
+56
+51
+48
+59
+65
+56
+43
+46
+68
+87
+78
+77
+61
+63
+92
+81
+53
+68
+73
+64
+63
+73
+79
+74
+75
+78
+88
+91
+90
+78
+69
+68
+72
+73
+78
+78
+82
+90
+94
+93
+93
+98
+105
+108
+110
+113
+114
+116
+119
+119
+125
+123
+121
+117
+115
+111
+108
+108
+110
+95
+85
+81
+75
+73
+57
+27
+45
+42
+43
+47
+49
+50
+54
+56
+53
+57
+65
+69
+79
+93
+98
+94
+95
+95
+96
+96
+100
+100
+100
+102
+105
+114
+120
+120
+125
+132
+135
+133
+131
+122
+111
+104
+100
+91
+77
+69
+67
+68
+69
+51
+51
+51
+52
+54
+55
+57
+58
+58
+58
+59
+59
+59
+59
+59
+59
+59
+59
+59
+58
+58
+58
+56
+55
+58
+57
+56
+53
+54
+51
+51
+49
+49
+49
+49
+49
+52
+52
+52
+52
+48
+48
+49
+48
+47
+47
+46
+46
+47
+47
+47
+46
+47
+47
+48
+48
+49
+48
+49
+49
+50
+48
+49
+48
+53
+52
+51
+50
+51
+50
+49
+48
+49
+49
+48
+48
+50
+51
+51
+52
+60
+46
+51
+71
+87
+96
+102
+98
+62
+63
+65
+66
+74
+82
+83
+75
+52
+48
+48
+49
+46
+43
+43
+47
+54
+43
+36
+39
+45
+47
+50
+58
+50
+66
+76
+82
+82
+76
+62
+49
+47
+44
+42
+45
+55
+71
+87
+91
+73
+51
+57
+49
+75
+93
+63
+74
+76
+67
+69
+79
+81
+74
+78
+89
+98
+90
+81
+73
+74
+78
+77
+72
+79
+75
+74
+76
+77
+75
+76
+80
+88
+91
+93
+97
+99
+101
+104
+107
+107
+106
+106
+105
+109
+112
+115
+118
+133
+124
+116
+108
+108
+114
+93
+50
+39
+44
+52
+53
+45
+41
+49
+57
+51
+54
+63
+68
+84
+101
+105
+100
+105
+101
+100
+99
+101
+104
+105
+106
+118
+126
+133
+138
+144
+150
+153
+153
+146
+134
+121
+109
+98
+89
+77
+71
+67
+70
+73
+50
+50
+51
+52
+54
+56
+58
+59
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+59
+59
+57
+57
+57
+60
+57
+56
+55
+53
+51
+50
+49
+48
+48
+49
+50
+50
+51
+53
+53
+49
+48
+50
+49
+48
+47
+47
+47
+47
+45
+46
+44
+46
+46
+48
+47
+48
+46
+48
+47
+48
+48
+47
+48
+50
+52
+51
+50
+51
+49
+49
+48
+50
+50
+49
+49
+51
+52
+53
+51
+49
+38
+63
+96
+101
+102
+99
+79
+48
+47
+48
+51
+61
+71
+72
+64
+55
+53
+51
+51
+51
+51
+52
+54
+53
+47
+41
+40
+40
+40
+38
+40
+55
+61
+62
+60
+66
+76
+83
+83
+55
+42
+37
+49
+75
+87
+81
+64
+57
+42
+52
+52
+64
+85
+75
+70
+64
+73
+83
+81
+74
+75
+91
+105
+87
+80
+74
+73
+78
+81
+76
+72
+83
+77
+75
+75
+74
+73
+78
+83
+84
+86
+87
+87
+90
+92
+94
+97
+102
+103
+101
+103
+105
+109
+115
+115
+117
+117
+118
+113
+110
+120
+118
+98
+53
+47
+42
+44
+47
+46
+47
+47
+46
+56
+67
+78
+96
+114
+118
+113
+113
+115
+115
+111
+109
+111
+117
+122
+138
+149
+157
+161
+167
+174
+176
+173
+162
+148
+130
+113
+99
+88
+78
+72
+67
+69
+72
+49
+49
+50
+51
+53
+55
+57
+58
+60
+60
+60
+60
+60
+61
+61
+61
+60
+60
+60
+61
+59
+59
+59
+57
+58
+57
+56
+54
+52
+49
+48
+47
+47
+47
+47
+49
+49
+49
+50
+50
+47
+47
+49
+48
+49
+48
+48
+47
+46
+46
+46
+45
+46
+47
+48
+47
+49
+47
+49
+48
+48
+48
+47
+48
+50
+51
+51
+49
+48
+47
+48
+48
+49
+49
+49
+49
+50
+51
+54
+52
+46
+50
+83
+105
+95
+81
+69
+43
+41
+40
+38
+41
+51
+61
+63
+59
+53
+52
+50
+50
+53
+57
+59
+60
+47
+47
+43
+41
+41
+44
+47
+49
+65
+65
+63
+57
+60
+69
+78
+79
+62
+67
+76
+77
+74
+66
+62
+55
+46
+46
+43
+52
+52
+57
+80
+67
+57
+73
+80
+70
+70
+84
+100
+104
+75
+68
+67
+68
+72
+75
+76
+77
+83
+77
+73
+72
+71
+70
+76
+82
+86
+88
+88
+90
+93
+95
+98
+101
+105
+107
+108
+109
+111
+111
+113
+111
+112
+104
+109
+112
+104
+107
+114
+115
+99
+68
+36
+34
+51
+61
+55
+45
+51
+67
+86
+103
+121
+139
+140
+131
+128
+136
+141
+136
+130
+130
+142
+153
+167
+174
+182
+185
+189
+193
+195
+190
+177
+162
+140
+118
+101
+89
+79
+74
+66
+67
+71
+48
+48
+49
+50
+51
+53
+55
+56
+58
+58
+59
+60
+61
+61
+62
+62
+61
+61
+61
+62
+60
+60
+58
+59
+58
+56
+56
+53
+52
+51
+50
+49
+49
+49
+48
+48
+49
+49
+50
+49
+48
+48
+49
+49
+50
+49
+48
+48
+46
+46
+44
+45
+45
+47
+47
+48
+48
+48
+47
+48
+48
+48
+47
+47
+50
+51
+50
+49
+48
+47
+48
+47
+48
+48
+49
+49
+50
+51
+54
+52
+52
+69
+95
+98
+81
+70
+59
+43
+39
+37
+33
+32
+38
+46
+50
+49
+44
+45
+45
+44
+49
+56
+59
+58
+50
+48
+44
+39
+41
+48
+59
+61
+45
+54
+63
+66
+65
+62
+55
+48
+53
+66
+76
+71
+57
+48
+50
+55
+40
+47
+34
+49
+44
+47
+92
+92
+67
+67
+63
+61
+76
+97
+98
+84
+75
+70
+64
+62
+62
+66
+77
+87
+82
+77
+71
+70
+70
+68
+71
+78
+83
+84
+86
+87
+92
+97
+101
+107
+101
+104
+106
+108
+110
+110
+108
+105
+114
+97
+100
+110
+110
+109
+111
+110
+130
+106
+76
+56
+45
+43
+50
+58
+65
+85
+110
+130
+145
+159
+159
+152
+155
+164
+172
+168
+163
+163
+176
+188
+192
+197
+204
+205
+206
+209
+207
+202
+192
+175
+152
+126
+107
+91
+82
+78
+71
+72
+72
+48
+48
+48
+48
+49
+51
+52
+53
+55
+56
+57
+59
+60
+62
+63
+63
+61
+62
+62
+62
+61
+61
+60
+60
+58
+57
+57
+55
+54
+51
+51
+51
+50
+50
+49
+48
+49
+48
+49
+49
+49
+49
+50
+49
+50
+50
+49
+49
+47
+45
+45
+45
+46
+47
+47
+48
+48
+49
+48
+48
+48
+48
+45
+47
+49
+49
+48
+47
+48
+46
+47
+47
+47
+47
+48
+48
+49
+50
+52
+49
+47
+75
+86
+68
+54
+51
+47
+41
+33
+35
+33
+31
+32
+35
+37
+37
+41
+45
+44
+44
+49
+58
+60
+54
+55
+52
+47
+43
+48
+56
+61
+55
+45
+45
+43
+38
+37
+43
+49
+52
+42
+43
+44
+44
+44
+44
+45
+43
+37
+38
+38
+44
+46
+55
+85
+113
+83
+66
+58
+73
+91
+95
+84
+73
+77
+68
+63
+60
+56
+55
+65
+76
+78
+75
+72
+72
+72
+69
+71
+77
+80
+82
+82
+85
+88
+93
+97
+103
+106
+108
+112
+115
+116
+116
+115
+111
+109
+97
+101
+106
+107
+116
+122
+116
+126
+126
+119
+97
+65
+47
+55
+74
+92
+118
+144
+161
+171
+182
+185
+179
+189
+197
+202
+202
+202
+205
+214
+219
+216
+219
+221
+220
+223
+224
+222
+216
+203
+186
+163
+135
+113
+98
+87
+83
+80
+79
+79
+49
+49
+49
+48
+49
+49
+50
+51
+54
+55
+56
+58
+60
+60
+61
+62
+62
+62
+60
+61
+59
+59
+59
+58
+59
+59
+58
+59
+59
+61
+63
+61
+55
+53
+51
+50
+50
+49
+50
+50
+49
+51
+50
+52
+51
+52
+51
+49
+47
+47
+47
+48
+49
+50
+50
+51
+53
+51
+50
+49
+48
+48
+45
+47
+49
+51
+50
+51
+49
+49
+48
+50
+47
+47
+47
+47
+48
+47
+48
+44
+55
+91
+89
+54
+42
+43
+37
+35
+38
+42
+44
+39
+38
+38
+35
+35
+42
+48
+48
+46
+52
+60
+59
+53
+48
+47
+46
+48
+57
+65
+60
+44
+36
+40
+46
+44
+42
+43
+43
+39
+42
+43
+44
+44
+42
+41
+40
+37
+42
+31
+48
+41
+45
+53
+54
+96
+89
+66
+65
+90
+98
+82
+70
+74
+68
+61
+60
+57
+52
+44
+46
+52
+72
+69
+68
+72
+73
+71
+73
+78
+85
+86
+84
+84
+85
+90
+94
+99
+104
+107
+110
+111
+112
+113
+115
+112
+106
+109
+115
+104
+96
+115
+133
+130
+119
+120
+123
+125
+120
+103
+88
+81
+119
+146
+173
+186
+195
+204
+207
+207
+216
+216
+218
+223
+228
+233
+235
+235
+230
+230
+232
+230
+232
+233
+231
+226
+209
+194
+169
+143
+120
+104
+95
+90
+89
+88
+86
+47
+48
+49
+49
+53
+52
+52
+52
+53
+54
+53
+55
+57
+57
+59
+59
+64
+62
+60
+59
+56
+55
+56
+56
+57
+58
+59
+67
+77
+80
+79
+69
+62
+52
+52
+53
+57
+56
+52
+48
+53
+53
+51
+52
+53
+53
+52
+50
+53
+52
+54
+53
+55
+55
+56
+57
+58
+55
+54
+52
+48
+45
+43
+44
+50
+52
+51
+52
+53
+55
+57
+58
+58
+48
+45
+49
+43
+35
+36
+46
+92
+65
+44
+41
+43
+39
+38
+43
+36
+38
+42
+41
+41
+38
+37
+37
+39
+41
+42
+46
+50
+52
+50
+49
+44
+44
+44
+47
+52
+56
+49
+38
+43
+42
+43
+45
+45
+46
+47
+45
+44
+45
+44
+44
+42
+41
+41
+40
+38
+31
+32
+39
+39
+40
+53
+73
+67
+75
+87
+90
+82
+67
+63
+71
+70
+68
+65
+57
+51
+47
+47
+48
+64
+67
+67
+63
+65
+71
+73
+71
+81
+81
+82
+85
+86
+85
+90
+100
+107
+106
+103
+103
+109
+115
+121
+122
+121
+117
+116
+113
+106
+106
+119
+135
+128
+105
+118
+120
+109
+125
+92
+109
+132
+156
+187
+208
+218
+224
+231
+235
+237
+238
+241
+242
+243
+244
+244
+243
+240
+239
+238
+237
+235
+232
+227
+225
+212
+202
+184
+160
+137
+120
+111
+107
+115
+109
+107
+47
+48
+48
+50
+51
+50
+51
+50
+52
+53
+53
+55
+55
+57
+56
+59
+62
+62
+60
+57
+54
+54
+53
+56
+56
+61
+69
+82
+96
+106
+106
+96
+75
+63
+58
+56
+57
+58
+56
+53
+56
+54
+52
+52
+53
+53
+53
+50
+47
+47
+50
+52
+54
+57
+58
+57
+58
+57
+54
+52
+48
+45
+43
+44
+46
+50
+53
+54
+55
+55
+55
+55
+57
+54
+49
+49
+42
+37
+46
+58
+66
+45
+35
+38
+39
+36
+37
+42
+37
+40
+43
+45
+44
+42
+40
+41
+41
+42
+41
+43
+46
+49
+47
+46
+44
+40
+43
+54
+57
+49
+43
+41
+43
+44
+46
+45
+47
+46
+47
+45
+45
+43
+43
+43
+41
+40
+39
+36
+39
+35
+37
+42
+42
+38
+47
+60
+63
+68
+77
+81
+73
+64
+65
+72
+69
+67
+65
+56
+49
+45
+45
+46
+53
+63
+69
+67
+62
+66
+70
+74
+74
+76
+80
+84
+83
+83
+88
+97
+104
+105
+105
+106
+112
+118
+122
+123
+120
+115
+111
+116
+122
+123
+118
+112
+107
+107
+104
+102
+111
+116
+72
+115
+137
+165
+200
+220
+230
+237
+242
+243
+249
+250
+253
+253
+254
+253
+254
+251
+246
+244
+243
+241
+239
+237
+236
+234
+224
+216
+197
+174
+154
+140
+133
+131
+134
+128
+126
+44
+45
+46
+47
+47
+48
+50
+49
+52
+50
+52
+54
+54
+56
+57
+58
+61
+59
+59
+56
+55
+55
+55
+57
+58
+66
+83
+102
+120
+133
+138
+131
+105
+92
+82
+75
+71
+69
+65
+60
+59
+55
+52
+51
+50
+51
+49
+48
+45
+46
+48
+50
+51
+52
+53
+51
+52
+52
+51
+48
+48
+47
+45
+44
+39
+42
+47
+48
+51
+52
+50
+49
+52
+53
+50
+44
+39
+44
+57
+67
+48
+36
+32
+39
+41
+36
+34
+38
+38
+41
+45
+47
+46
+45
+45
+47
+46
+46
+43
+43
+43
+45
+45
+44
+45
+40
+46
+61
+58
+42
+38
+46
+44
+43
+44
+46
+47
+46
+47
+44
+45
+43
+43
+41
+39
+38
+34
+33
+36
+35
+39
+47
+46
+41
+44
+55
+53
+56
+65
+73
+74
+67
+65
+67
+65
+63
+61
+52
+46
+42
+42
+43
+41
+56
+69
+69
+64
+65
+73
+80
+71
+73
+79
+84
+85
+85
+88
+95
+102
+105
+107
+112
+119
+123
+124
+122
+116
+116
+113
+116
+124
+128
+118
+99
+109
+119
+92
+94
+132
+123
+59
+112
+129
+166
+208
+228
+239
+249
+253
+251
+255
+255
+255
+255
+255
+255
+255
+252
+250
+248
+247
+245
+245
+243
+243
+242
+234
+225
+206
+185
+168
+158
+153
+151
+158
+150
+148
+44
+44
+45
+44
+45
+46
+47
+48
+48
+49
+51
+53
+53
+55
+56
+57
+60
+59
+57
+57
+56
+56
+56
+59
+62
+76
+98
+122
+146
+161
+168
+166
+151
+138
+123
+109
+100
+90
+80
+72
+70
+63
+55
+51
+48
+47
+46
+47
+48
+49
+51
+50
+49
+49
+47
+45
+47
+46
+47
+47
+48
+47
+48
+47
+42
+44
+46
+48
+50
+51
+53
+52
+52
+53
+49
+43
+43
+54
+65
+65
+46
+40
+40
+45
+44
+38
+35
+38
+38
+41
+44
+47
+47
+48
+49
+50
+51
+50
+46
+42
+43
+44
+44
+42
+44
+45
+52
+57
+51
+39
+40
+47
+43
+42
+45
+45
+46
+44
+44
+42
+44
+43
+41
+40
+38
+36
+32
+31
+30
+31
+36
+46
+47
+46
+50
+58
+45
+48
+53
+64
+73
+73
+63
+56
+57
+56
+52
+47
+43
+42
+43
+45
+38
+51
+64
+67
+64
+68
+76
+85
+69
+69
+77
+85
+87
+87
+88
+94
+99
+102
+109
+114
+121
+124
+123
+121
+113
+122
+122
+112
+110
+117
+117
+106
+102
+103
+85
+113
+164
+141
+51
+64
+109
+155
+202
+226
+241
+254
+255
+254
+255
+255
+255
+255
+253
+254
+251
+250
+249
+247
+247
+246
+246
+245
+247
+246
+239
+228
+210
+193
+180
+172
+169
+170
+180
+172
+166
+44
+44
+43
+43
+44
+44
+46
+47
+47
+48
+49
+51
+51
+53
+55
+56
+58
+58
+58
+58
+57
+58
+58
+61
+68
+85
+113
+141
+168
+185
+195
+198
+192
+182
+169
+154
+141
+126
+110
+97
+88
+77
+66
+56
+50
+47
+44
+44
+49
+51
+49
+49
+47
+43
+42
+41
+44
+43
+44
+47
+48
+50
+52
+51
+52
+53
+51
+50
+50
+52
+52
+53
+51
+49
+46
+47
+56
+68
+71
+60
+48
+43
+46
+47
+45
+41
+39
+42
+36
+39
+43
+46
+45
+46
+48
+51
+54
+51
+47
+44
+44
+43
+43
+43
+43
+53
+56
+46
+38
+41
+45
+43
+43
+41
+45
+44
+44
+43
+42
+42
+44
+42
+41
+39
+35
+33
+31
+30
+30
+30
+34
+41
+45
+48
+54
+61
+62
+55
+53
+57
+68
+71
+62
+49
+49
+48
+47
+44
+42
+43
+45
+48
+45
+50
+58
+63
+66
+72
+79
+86
+69
+67
+76
+85
+89
+88
+89
+93
+95
+100
+108
+115
+122
+124
+121
+118
+114
+124
+122
+111
+108
+116
+115
+105
+95
+93
+104
+158
+184
+155
+69
+42
+98
+142
+192
+220
+239
+253
+255
+253
+255
+255
+255
+255
+255
+254
+251
+249
+247
+247
+247
+246
+247
+246
+247
+247
+243
+234
+218
+205
+195
+191
+192
+194
+200
+191
+183
+49
+46
+46
+43
+43
+44
+45
+46
+46
+47
+48
+50
+50
+52
+54
+52
+56
+56
+56
+59
+58
+59
+60
+65
+73
+94
+124
+157
+184
+204
+216
+222
+218
+212
+201
+191
+181
+167
+150
+135
+119
+105
+89
+74
+63
+56
+52
+50
+53
+55
+52
+50
+46
+43
+42
+42
+42
+43
+44
+48
+52
+54
+57
+58
+58
+58
+55
+53
+53
+52
+49
+48
+53
+43
+41
+50
+65
+71
+64
+52
+47
+43
+45
+45
+44
+42
+43
+45
+37
+40
+43
+45
+44
+46
+48
+52
+53
+52
+49
+46
+46
+47
+46
+44
+45
+57
+55
+38
+35
+47
+52
+42
+44
+40
+43
+42
+43
+43
+42
+42
+42
+41
+41
+40
+36
+34
+32
+31
+35
+35
+36
+38
+41
+44
+49
+54
+81
+74
+65
+59
+60
+63
+59
+49
+42
+40
+42
+41
+40
+43
+48
+51
+54
+51
+54
+61
+69
+72
+77
+80
+70
+67
+73
+84
+89
+90
+92
+95
+95
+97
+105
+112
+119
+122
+120
+118
+119
+118
+116
+115
+121
+123
+111
+94
+107
+99
+113
+154
+145
+134
+98
+76
+101
+137
+183
+215
+237
+247
+253
+254
+255
+255
+255
+255
+254
+252
+250
+248
+247
+248
+249
+249
+249
+247
+246
+242
+239
+230
+219
+210
+206
+207
+210
+214
+220
+211
+201
+52
+49
+48
+43
+42
+42
+43
+44
+45
+46
+47
+49
+49
+51
+53
+52
+55
+55
+56
+59
+59
+61
+63
+67
+75
+99
+130
+166
+197
+218
+234
+241
+239
+235
+229
+221
+214
+202
+189
+177
+161
+145
+126
+107
+92
+82
+76
+74
+75
+71
+64
+58
+52
+47
+45
+44
+42
+43
+47
+52
+55
+59
+62
+65
+67
+70
+72
+75
+76
+75
+71
+66
+65
+52
+48
+59
+70
+64
+53
+45
+47
+44
+42
+43
+44
+45
+45
+42
+39
+41
+42
+44
+45
+46
+49
+53
+52
+51
+49
+49
+50
+50
+48
+47
+53
+53
+49
+40
+42
+50
+51
+42
+42
+39
+42
+41
+41
+41
+40
+40
+41
+41
+41
+40
+39
+37
+33
+32
+37
+37
+37
+37
+40
+43
+46
+47
+71
+80
+83
+73
+62
+57
+55
+47
+42
+38
+40
+39
+40
+42
+48
+52
+59
+55
+58
+67
+72
+71
+74
+75
+72
+68
+73
+83
+90
+93
+93
+96
+94
+97
+102
+108
+117
+120
+120
+119
+119
+117
+118
+120
+123
+119
+107
+95
+106
+102
+93
+107
+89
+96
+96
+96
+100
+124
+166
+207
+231
+240
+247
+253
+255
+255
+255
+253
+252
+249
+247
+245
+246
+247
+250
+249
+247
+242
+240
+237
+228
+221
+213
+210
+213
+219
+225
+229
+236
+227
+215
+54
+51
+48
+45
+43
+43
+43
+44
+45
+45
+47
+49
+49
+51
+52
+51
+55
+55
+56
+58
+59
+60
+63
+67
+77
+102
+136
+171
+203
+227
+245
+253
+255
+250
+243
+238
+234
+225
+214
+204
+196
+180
+159
+139
+124
+112
+104
+101
+99
+94
+83
+72
+62
+54
+49
+47
+47
+48
+51
+55
+61
+64
+68
+72
+82
+92
+99
+106
+110
+109
+104
+97
+87
+69
+63
+73
+76
+60
+49
+46
+48
+47
+45
+45
+46
+47
+43
+38
+40
+43
+43
+45
+45
+47
+49
+52
+50
+50
+50
+50
+52
+52
+51
+47
+58
+47
+42
+47
+53
+53
+49
+44
+41
+39
+40
+41
+41
+41
+40
+40
+41
+41
+41
+41
+39
+38
+36
+35
+34
+37
+36
+38
+41
+43
+43
+42
+43
+71
+92
+89
+70
+55
+50
+45
+41
+39
+38
+37
+38
+42
+47
+50
+57
+57
+63
+72
+73
+68
+69
+71
+73
+68
+72
+83
+90
+92
+94
+97
+94
+96
+100
+105
+114
+120
+121
+122
+116
+119
+126
+125
+113
+103
+105
+109
+108
+116
+94
+102
+97
+104
+94
+94
+93
+111
+150
+195
+225
+233
+242
+253
+255
+255
+255
+253
+252
+249
+247
+246
+244
+245
+248
+248
+245
+239
+235
+229
+221
+217
+211
+213
+221
+229
+236
+242
+246
+236
+223
+53
+52
+51
+49
+47
+45
+43
+42
+41
+41
+42
+43
+48
+51
+54
+54
+55
+55
+56
+57
+58
+59
+65
+72
+77
+96
+129
+167
+202
+227
+246
+255
+255
+255
+255
+252
+249
+243
+236
+232
+218
+210
+193
+177
+161
+146
+135
+126
+122
+118
+110
+95
+77
+64
+58
+56
+52
+53
+58
+61
+62
+66
+72
+84
+106
+126
+137
+136
+139
+139
+126
+106
+101
+91
+87
+81
+68
+51
+40
+40
+42
+42
+44
+46
+45
+45
+44
+44
+39
+40
+42
+45
+45
+47
+49
+51
+52
+53
+54
+51
+49
+49
+51
+51
+60
+54
+48
+55
+82
+99
+84
+54
+41
+41
+42
+41
+38
+37
+38
+40
+43
+44
+43
+39
+35
+34
+36
+40
+38
+40
+41
+42
+44
+43
+44
+45
+56
+49
+65
+94
+81
+60
+59
+42
+38
+36
+38
+38
+40
+43
+48
+50
+52
+59
+74
+82
+74
+58
+58
+68
+71
+69
+75
+84
+87
+86
+88
+92
+102
+102
+101
+102
+108
+115
+118
+118
+119
+118
+117
+120
+120
+115
+110
+106
+117
+103
+109
+108
+88
+88
+101
+101
+103
+101
+139
+178
+207
+231
+238
+247
+249
+253
+254
+252
+252
+252
+248
+244
+246
+246
+244
+241
+244
+243
+232
+217
+213
+206
+208
+222
+231
+231
+232
+243
+248
+239
+226
+54
+51
+52
+50
+48
+46
+45
+44
+42
+42
+42
+43
+47
+50
+53
+53
+54
+54
+55
+56
+56
+57
+62
+69
+78
+95
+127
+164
+201
+226
+245
+254
+255
+255
+255
+255
+255
+252
+248
+245
+235
+227
+216
+201
+187
+174
+160
+152
+142
+136
+127
+116
+98
+84
+73
+67
+58
+61
+65
+63
+64
+69
+82
+99
+131
+150
+157
+155
+154
+150
+136
+117
+107
+98
+88
+71
+57
+47
+41
+41
+37
+37
+38
+40
+39
+40
+40
+40
+37
+40
+45
+50
+51
+53
+53
+53
+57
+55
+55
+57
+61
+61
+60
+59
+58
+57
+55
+47
+40
+43
+62
+79
+54
+44
+35
+35
+41
+45
+43
+40
+46
+47
+49
+46
+41
+38
+37
+38
+39
+39
+40
+40
+42
+41
+41
+40
+47
+45
+54
+74
+81
+72
+63
+40
+40
+38
+39
+39
+40
+40
+44
+47
+52
+56
+70
+80
+73
+61
+59
+67
+72
+70
+76
+82
+87
+86
+86
+90
+102
+104
+105
+107
+109
+113
+116
+117
+108
+115
+121
+123
+117
+110
+105
+101
+102
+98
+104
+104
+94
+99
+105
+94
+95
+87
+125
+165
+197
+222
+233
+245
+247
+253
+254
+252
+252
+252
+251
+245
+245
+245
+243
+241
+244
+244
+233
+219
+212
+203
+204
+219
+229
+231
+232
+239
+246
+238
+225
+54
+53
+52
+50
+48
+46
+45
+44
+43
+43
+42
+43
+47
+50
+52
+52
+53
+55
+56
+54
+54
+55
+60
+67
+75
+93
+121
+156
+194
+220
+240
+250
+254
+254
+255
+255
+255
+255
+255
+255
+249
+244
+235
+224
+211
+199
+188
+179
+162
+155
+145
+133
+119
+104
+86
+76
+60
+64
+66
+66
+66
+74
+93
+115
+149
+165
+167
+162
+154
+147
+131
+110
+94
+92
+82
+62
+48
+43
+41
+39
+41
+41
+41
+42
+44
+45
+45
+46
+42
+46
+49
+53
+56
+55
+51
+52
+49
+46
+45
+51
+59
+63
+60
+53
+52
+44
+43
+45
+39
+32
+42
+58
+62
+54
+45
+41
+42
+44
+44
+44
+41
+43
+46
+46
+43
+40
+39
+39
+40
+41
+40
+41
+42
+42
+43
+44
+43
+52
+53
+55
+78
+87
+69
+47
+44
+40
+42
+41
+41
+40
+42
+44
+51
+54
+65
+75
+71
+62
+58
+62
+68
+67
+73
+80
+84
+83
+83
+87
+100
+104
+112
+114
+110
+108
+108
+112
+106
+116
+123
+121
+113
+107
+107
+109
+104
+104
+109
+107
+103
+110
+109
+95
+87
+70
+102
+148
+182
+209
+223
+244
+247
+253
+255
+252
+252
+254
+253
+247
+244
+242
+242
+242
+244
+244
+236
+226
+215
+203
+201
+216
+228
+232
+231
+236
+242
+235
+225
+57
+56
+54
+52
+51
+49
+48
+47
+45
+44
+44
+44
+47
+49
+51
+53
+54
+55
+55
+53
+52
+53
+56
+62
+75
+87
+113
+150
+186
+212
+233
+245
+249
+249
+253
+255
+255
+255
+255
+255
+252
+248
+242
+234
+226
+215
+205
+197
+182
+170
+158
+144
+132
+117
+99
+81
+68
+66
+67
+69
+74
+85
+100
+120
+141
+153
+152
+143
+131
+120
+103
+85
+72
+80
+79
+60
+49
+50
+44
+36
+34
+36
+36
+38
+40
+43
+45
+47
+54
+55
+54
+54
+53
+51
+46
+44
+40
+39
+40
+45
+52
+52
+49
+45
+45
+34
+31
+44
+54
+48
+37
+31
+55
+60
+63
+55
+42
+37
+41
+50
+46
+46
+46
+44
+42
+42
+41
+39
+42
+43
+43
+45
+47
+48
+51
+51
+42
+66
+69
+48
+70
+92
+75
+63
+47
+43
+42
+42
+42
+42
+43
+42
+48
+50
+57
+66
+68
+60
+55
+55
+63
+63
+69
+75
+79
+76
+77
+80
+96
+103
+113
+117
+109
+103
+103
+107
+112
+116
+115
+110
+108
+111
+117
+120
+117
+111
+109
+108
+108
+106
+104
+97
+84
+60
+85
+129
+169
+197
+217
+243
+246
+252
+255
+254
+254
+255
+255
+248
+245
+242
+243
+245
+247
+247
+241
+232
+218
+204
+202
+214
+228
+232
+229
+233
+238
+232
+224
+58
+57
+56
+54
+54
+52
+51
+50
+48
+47
+46
+46
+48
+49
+51
+52
+56
+56
+56
+54
+51
+50
+54
+59
+71
+82
+104
+139
+177
+206
+227
+238
+247
+249
+253
+253
+255
+254
+255
+253
+251
+248
+244
+239
+233
+226
+217
+209
+201
+187
+172
+158
+146
+132
+115
+98
+89
+81
+76
+77
+84
+93
+98
+104
+112
+118
+117
+110
+99
+89
+74
+63
+69
+77
+75
+60
+54
+58
+52
+41
+43
+45
+45
+47
+48
+52
+55
+58
+57
+55
+53
+50
+45
+44
+43
+42
+42
+45
+46
+48
+48
+47
+46
+44
+38
+43
+43
+35
+34
+41
+45
+41
+45
+55
+65
+63
+52
+45
+45
+50
+55
+53
+48
+44
+42
+44
+45
+43
+49
+49
+49
+50
+48
+48
+48
+49
+43
+76
+90
+54
+58
+81
+72
+81
+52
+47
+44
+44
+45
+46
+45
+44
+45
+46
+51
+57
+59
+54
+50
+48
+60
+60
+66
+73
+77
+75
+75
+79
+96
+104
+114
+120
+113
+101
+101
+107
+117
+116
+111
+106
+111
+119
+119
+115
+116
+109
+107
+114
+117
+102
+92
+97
+86
+57
+74
+114
+156
+193
+214
+239
+246
+252
+255
+254
+254
+255
+255
+250
+248
+244
+245
+248
+250
+249
+244
+241
+226
+210
+204
+215
+228
+230
+229
+233
+234
+231
+225
+61
+60
+59
+57
+57
+55
+54
+54
+51
+50
+49
+48
+50
+50
+52
+53
+56
+57
+57
+54
+51
+50
+51
+55
+67
+76
+99
+133
+171
+200
+222
+235
+248
+251
+253
+255
+255
+254
+253
+253
+249
+247
+242
+240
+237
+232
+227
+222
+218
+205
+192
+178
+169
+157
+142
+125
+120
+106
+95
+92
+92
+93
+87
+83
+83
+84
+85
+81
+77
+70
+60
+54
+76
+74
+65
+52
+50
+55
+53
+46
+54
+54
+55
+56
+56
+58
+60
+61
+51
+49
+47
+44
+42
+43
+44
+45
+49
+52
+52
+51
+48
+45
+44
+45
+36
+48
+46
+34
+29
+38
+41
+38
+39
+41
+47
+57
+64
+62
+55
+47
+46
+42
+41
+40
+44
+52
+56
+57
+53
+52
+51
+49
+45
+42
+40
+38
+40
+69
+99
+65
+50
+67
+66
+86
+60
+52
+46
+43
+45
+47
+47
+46
+43
+45
+48
+50
+50
+46
+46
+45
+54
+57
+63
+71
+76
+73
+76
+78
+99
+103
+116
+122
+117
+106
+105
+111
+115
+113
+110
+110
+120
+127
+115
+98
+109
+109
+111
+125
+138
+124
+104
+106
+88
+58
+71
+103
+146
+191
+216
+235
+245
+251
+255
+254
+255
+255
+255
+253
+251
+244
+246
+250
+250
+248
+246
+245
+232
+219
+213
+221
+229
+229
+226
+231
+234
+231
+229
+61
+60
+61
+59
+57
+55
+56
+55
+52
+51
+51
+50
+51
+52
+54
+55
+59
+59
+57
+55
+50
+48
+49
+53
+63
+70
+94
+130
+167
+196
+218
+231
+246
+250
+252
+254
+255
+254
+251
+251
+246
+244
+241
+240
+238
+237
+232
+230
+226
+219
+210
+202
+194
+183
+168
+154
+136
+122
+105
+95
+89
+82
+73
+65
+62
+60
+61
+60
+60
+53
+50
+49
+73
+63
+55
+51
+53
+54
+52
+48
+46
+46
+46
+46
+43
+42
+39
+38
+42
+42
+40
+41
+42
+44
+46
+47
+51
+50
+49
+47
+45
+44
+42
+41
+38
+37
+37
+38
+41
+42
+36
+28
+38
+37
+39
+49
+60
+64
+61
+55
+49
+46
+45
+46
+51
+58
+61
+61
+54
+51
+49
+47
+42
+40
+37
+36
+36
+49
+95
+76
+53
+63
+61
+83
+72
+61
+51
+46
+46
+48
+48
+47
+42
+45
+46
+45
+42
+40
+43
+44
+48
+50
+56
+66
+72
+70
+73
+76
+101
+102
+114
+123
+120
+107
+106
+114
+114
+115
+113
+116
+128
+136
+121
+100
+116
+124
+117
+119
+149
+159
+138
+124
+85
+60
+70
+92
+136
+190
+217
+230
+245
+251
+255
+255
+255
+255
+255
+253
+251
+243
+243
+247
+248
+246
+245
+246
+240
+226
+220
+226
+230
+227
+225
+230
+236
+235
+234
+63
+62
+62
+60
+58
+56
+55
+56
+53
+52
+51
+49
+50
+50
+51
+54
+57
+58
+58
+55
+50
+48
+50
+53
+61
+69
+93
+128
+168
+197
+216
+231
+242
+247
+250
+253
+255
+254
+253
+251
+245
+242
+238
+235
+237
+238
+237
+238
+230
+227
+221
+213
+203
+190
+175
+160
+127
+114
+99
+88
+78
+72
+67
+62
+58
+55
+55
+55
+52
+47
+44
+45
+69
+60
+55
+61
+67
+64
+57
+51
+57
+56
+56
+53
+50
+44
+41
+39
+40
+40
+42
+44
+46
+46
+46
+44
+55
+49
+44
+44
+45
+45
+41
+37
+40
+32
+33
+40
+39
+34
+37
+48
+38
+42
+44
+46
+47
+51
+57
+62
+75
+70
+66
+61
+61
+58
+54
+49
+49
+47
+46
+46
+43
+42
+41
+40
+33
+31
+89
+83
+58
+67
+59
+77
+81
+69
+54
+47
+46
+47
+45
+43
+44
+45
+46
+41
+37
+38
+41
+46
+41
+43
+49
+58
+64
+65
+66
+69
+95
+96
+106
+119
+117
+105
+101
+109
+116
+116
+112
+114
+127
+139
+132
+115
+121
+134
+113
+102
+145
+180
+162
+135
+80
+57
+63
+85
+129
+191
+217
+227
+244
+251
+255
+255
+255
+255
+255
+253
+249
+240
+241
+244
+247
+241
+242
+244
+243
+232
+226
+229
+231
+226
+224
+233
+241
+240
+239
+64
+64
+63
+62
+60
+59
+58
+59
+55
+54
+53
+51
+50
+50
+50
+52
+58
+57
+56
+54
+53
+52
+52
+57
+68
+77
+98
+131
+167
+195
+215
+231
+246
+249
+252
+252
+255
+255
+255
+252
+245
+241
+236
+237
+239
+243
+246
+246
+246
+238
+222
+211
+203
+188
+155
+120
+93
+84
+77
+73
+71
+69
+69
+68
+65
+61
+66
+52
+59
+60
+41
+69
+73
+69
+66
+63
+63
+62
+59
+57
+59
+55
+59
+65
+62
+48
+41
+44
+43
+44
+45
+42
+42
+43
+47
+46
+53
+43
+36
+38
+43
+45
+38
+31
+31
+31
+33
+34
+34
+37
+39
+41
+38
+41
+41
+42
+40
+38
+39
+41
+41
+46
+50
+51
+50
+50
+52
+53
+51
+47
+44
+45
+46
+44
+40
+37
+28
+34
+72
+78
+51
+73
+49
+72
+80
+74
+64
+54
+48
+44
+43
+43
+42
+40
+38
+40
+41
+41
+43
+44
+44
+48
+49
+51
+51
+52
+53
+55
+97
+105
+95
+106
+113
+100
+109
+121
+122
+120
+111
+105
+106
+110
+111
+111
+123
+133
+108
+119
+112
+175
+154
+117
+81
+58
+56
+90
+136
+176
+211
+240
+245
+249
+251
+253
+255
+255
+255
+254
+243
+232
+233
+237
+245
+244
+242
+240
+241
+238
+234
+230
+227
+225
+225
+229
+241
+250
+250
+65
+64
+64
+62
+61
+60
+59
+58
+54
+53
+52
+51
+50
+50
+50
+52
+56
+57
+56
+54
+53
+52
+55
+58
+69
+77
+99
+131
+166
+192
+211
+225
+236
+241
+244
+249
+253
+255
+255
+251
+244
+237
+232
+232
+234
+237
+238
+237
+243
+235
+220
+205
+189
+166
+130
+98
+77
+70
+67
+65
+67
+67
+68
+70
+67
+63
+68
+59
+63
+61
+49
+80
+70
+68
+66
+63
+59
+57
+56
+55
+63
+53
+52
+62
+65
+53
+44
+43
+42
+43
+45
+45
+46
+47
+51
+52
+50
+45
+41
+38
+39
+39
+34
+31
+36
+34
+37
+38
+43
+44
+44
+42
+46
+45
+43
+41
+38
+34
+33
+34
+36
+38
+43
+44
+45
+47
+50
+51
+46
+45
+46
+46
+42
+39
+39
+39
+46
+25
+53
+49
+62
+80
+63
+65
+86
+82
+72
+62
+53
+46
+43
+40
+42
+40
+39
+41
+43
+45
+47
+46
+44
+48
+48
+49
+48
+49
+51
+53
+92
+100
+91
+102
+108
+97
+108
+120
+126
+124
+114
+102
+96
+102
+112
+120
+119
+126
+100
+112
+110
+169
+147
+107
+79
+59
+59
+92
+141
+184
+220
+241
+248
+249
+250
+251
+253
+254
+255
+250
+242
+232
+229
+234
+240
+241
+241
+240
+239
+237
+233
+229
+224
+221
+223
+228
+239
+246
+249
+66
+65
+65
+63
+62
+61
+60
+60
+57
+56
+55
+53
+53
+53
+53
+55
+57
+59
+57
+55
+54
+53
+55
+58
+67
+78
+98
+129
+161
+185
+203
+214
+222
+227
+233
+238
+244
+247
+248
+244
+239
+232
+227
+224
+224
+225
+227
+226
+221
+214
+204
+189
+169
+145
+111
+81
+76
+68
+65
+63
+65
+67
+68
+70
+67
+61
+65
+64
+63
+56
+54
+87
+67
+66
+63
+60
+56
+54
+54
+54
+65
+49
+43
+53
+62
+58
+47
+41
+41
+41
+44
+46
+48
+49
+53
+57
+42
+42
+42
+42
+42
+41
+42
+44
+33
+31
+33
+34
+41
+41
+40
+37
+59
+56
+51
+46
+41
+36
+34
+35
+37
+36
+38
+39
+42
+45
+47
+47
+41
+43
+45
+44
+38
+37
+38
+42
+47
+32
+69
+48
+59
+63
+73
+85
+84
+81
+77
+67
+59
+50
+43
+38
+38
+37
+38
+39
+42
+45
+44
+44
+44
+47
+46
+47
+46
+48
+52
+55
+81
+93
+89
+103
+109
+96
+103
+113
+94
+107
+113
+109
+103
+105
+113
+119
+117
+117
+93
+104
+109
+161
+138
+96
+72
+61
+65
+93
+146
+194
+230
+241
+247
+248
+248
+251
+253
+253
+251
+246
+237
+226
+221
+224
+229
+231
+234
+236
+233
+234
+230
+224
+216
+213
+217
+223
+239
+244
+249
+66
+66
+65
+64
+63
+63
+62
+62
+59
+58
+57
+56
+56
+56
+56
+58
+59
+60
+59
+57
+55
+54
+56
+59
+66
+75
+96
+126
+155
+178
+194
+206
+210
+214
+219
+227
+232
+236
+237
+235
+232
+223
+218
+213
+213
+214
+214
+210
+189
+182
+175
+162
+143
+120
+97
+75
+74
+67
+65
+65
+67
+69
+70
+70
+70
+62
+64
+68
+60
+49
+58
+89
+66
+67
+64
+61
+57
+55
+56
+56
+59
+46
+40
+47
+55
+54
+47
+40
+41
+41
+46
+47
+48
+49
+55
+56
+43
+42
+44
+44
+45
+46
+46
+47
+40
+41
+43
+44
+46
+48
+54
+53
+64
+60
+55
+49
+42
+37
+38
+37
+40
+39
+37
+37
+40
+44
+44
+42
+42
+44
+43
+41
+39
+37
+40
+42
+40
+44
+80
+60
+47
+44
+64
+88
+115
+111
+103
+89
+71
+55
+40
+32
+39
+40
+38
+41
+44
+45
+44
+45
+46
+46
+47
+45
+45
+46
+51
+55
+65
+87
+91
+108
+114
+97
+97
+100
+84
+101
+114
+111
+108
+112
+118
+118
+115
+110
+88
+98
+107
+150
+131
+89
+67
+63
+69
+95
+148
+202
+232
+240
+239
+242
+245
+249
+250
+248
+243
+235
+222
+210
+204
+206
+210
+213
+219
+225
+225
+227
+227
+219
+209
+205
+209
+217
+234
+240
+243
+66
+66
+65
+65
+64
+63
+63
+63
+61
+60
+59
+59
+58
+59
+59
+61
+60
+61
+60
+58
+56
+55
+57
+60
+65
+73
+93
+120
+147
+165
+183
+194
+195
+200
+207
+212
+220
+224
+223
+222
+220
+214
+206
+199
+197
+195
+193
+184
+159
+150
+143
+134
+118
+101
+85
+75
+71
+67
+65
+65
+67
+71
+72
+72
+73
+64
+63
+69
+56
+44
+60
+80
+67
+67
+64
+63
+61
+60
+59
+60
+50
+42
+41
+42
+45
+45
+43
+41
+42
+42
+47
+47
+47
+47
+51
+53
+53
+50
+48
+49
+50
+48
+43
+39
+39
+45
+48
+46
+45
+48
+59
+64
+59
+54
+49
+44
+38
+34
+35
+37
+41
+38
+38
+39
+44
+48
+47
+45
+49
+45
+39
+37
+39
+41
+41
+40
+45
+42
+50
+58
+45
+58
+52
+54
+51
+54
+62
+67
+73
+72
+72
+71
+48
+46
+44
+45
+45
+46
+47
+48
+46
+46
+46
+44
+44
+46
+51
+54
+65
+88
+93
+108
+114
+99
+101
+103
+118
+122
+118
+104
+102
+113
+123
+124
+115
+106
+87
+93
+104
+141
+131
+93
+73
+73
+80
+102
+150
+204
+233
+237
+237
+240
+242
+243
+241
+234
+224
+215
+200
+189
+186
+188
+192
+196
+204
+211
+216
+222
+223
+217
+210
+205
+207
+214
+222
+224
+226
+65
+65
+65
+64
+64
+63
+63
+63
+62
+62
+61
+60
+60
+61
+61
+62
+62
+62
+62
+59
+57
+55
+57
+59
+63
+71
+87
+110
+131
+150
+165
+177
+180
+185
+193
+200
+207
+212
+213
+211
+211
+202
+192
+184
+178
+173
+171
+156
+140
+123
+120
+113
+102
+87
+78
+72
+69
+66
+66
+66
+69
+71
+73
+74
+72
+67
+62
+68
+52
+44
+64
+70
+65
+61
+59
+59
+61
+63
+60
+58
+42
+40
+42
+40
+39
+38
+40
+40
+41
+44
+46
+46
+46
+46
+47
+48
+50
+47
+48
+50
+55
+55
+53
+49
+42
+47
+50
+50
+49
+52
+61
+68
+54
+50
+47
+44
+41
+39
+40
+40
+36
+36
+40
+44
+50
+53
+53
+54
+56
+49
+40
+38
+41
+42
+42
+38
+43
+41
+39
+60
+47
+65
+50
+44
+47
+46
+49
+48
+46
+42
+38
+35
+53
+50
+46
+42
+41
+43
+44
+44
+47
+48
+47
+46
+43
+44
+47
+50
+71
+94
+95
+105
+111
+104
+113
+120
+123
+126
+117
+107
+110
+122
+126
+117
+112
+102
+89
+91
+102
+131
+134
+107
+93
+90
+96
+114
+152
+194
+222
+229
+239
+238
+238
+234
+227
+217
+205
+193
+173
+167
+168
+171
+175
+178
+186
+193
+204
+212
+218
+216
+212
+209
+207
+211
+211
+211
+210
+62
+62
+62
+62
+61
+61
+61
+61
+60
+60
+59
+59
+59
+60
+60
+63
+63
+62
+61
+60
+58
+58
+58
+60
+63
+69
+82
+98
+115
+129
+144
+157
+164
+169
+178
+188
+198
+203
+204
+202
+200
+191
+181
+173
+167
+164
+160
+142
+117
+97
+96
+98
+90
+79
+71
+69
+64
+62
+64
+66
+69
+71
+73
+74
+68
+68
+61
+66
+47
+44
+70
+60
+56
+52
+48
+49
+56
+59
+57
+53
+40
+40
+42
+39
+37
+38
+39
+38
+38
+41
+44
+43
+43
+43
+43
+45
+43
+45
+51
+52
+55
+55
+56
+56
+59
+60
+62
+65
+68
+70
+72
+69
+53
+50
+50
+47
+45
+42
+43
+44
+38
+42
+47
+50
+52
+52
+53
+54
+60
+55
+49
+44
+41
+39
+42
+41
+39
+47
+56
+62
+47
+46
+54
+54
+45
+46
+48
+49
+49
+48
+48
+47
+63
+58
+49
+42
+41
+40
+42
+42
+45
+47
+48
+47
+43
+43
+46
+48
+65
+90
+94
+105
+115
+110
+122
+127
+112
+121
+121
+115
+118
+127
+125
+111
+110
+98
+91
+89
+97
+123
+137
+122
+107
+102
+104
+117
+142
+173
+196
+209
+220
+215
+207
+199
+191
+182
+174
+164
+149
+144
+148
+154
+158
+162
+168
+177
+187
+196
+206
+213
+214
+210
+205
+202
+201
+198
+193
+62
+61
+61
+61
+61
+61
+60
+60
+61
+60
+60
+59
+59
+60
+61
+63
+62
+62
+62
+60
+60
+58
+58
+60
+65
+68
+76
+90
+102
+113
+127
+141
+150
+156
+167
+181
+191
+197
+200
+199
+191
+183
+173
+167
+165
+162
+160
+141
+93
+75
+75
+82
+82
+73
+67
+64
+61
+59
+63
+65
+66
+70
+72
+73
+65
+68
+60
+63
+46
+47
+75
+53
+51
+44
+38
+42
+51
+57
+54
+47
+42
+41
+41
+39
+40
+41
+39
+37
+36
+37
+41
+42
+42
+42
+41
+42
+51
+56
+60
+58
+50
+45
+45
+49
+51
+48
+49
+54
+63
+65
+57
+47
+48
+46
+49
+47
+44
+43
+41
+42
+43
+48
+54
+55
+52
+49
+48
+50
+61
+60
+55
+47
+40
+37
+41
+45
+42
+45
+60
+50
+49
+32
+57
+51
+40
+41
+41
+41
+43
+42
+43
+43
+78
+70
+59
+50
+47
+46
+49
+49
+45
+47
+48
+46
+44
+42
+44
+45
+50
+81
+93
+112
+121
+114
+124
+125
+131
+137
+128
+113
+112
+124
+127
+116
+106
+97
+94
+87
+94
+116
+139
+132
+110
+103
+104
+113
+130
+150
+173
+189
+185
+178
+167
+158
+151
+144
+140
+134
+130
+127
+133
+140
+144
+146
+154
+162
+170
+181
+196
+205
+210
+207
+201
+195
+189
+184
+180
+61
+61
+61
+61
+61
+61
+61
+61
+59
+59
+59
+60
+60
+61
+61
+61
+63
+63
+61
+61
+61
+60
+60
+62
+61
+67
+72
+79
+88
+98
+105
+114
+129
+142
+155
+167
+179
+193
+201
+199
+192
+188
+178
+168
+167
+171
+163
+132
+82
+60
+64
+67
+67
+62
+62
+69
+60
+58
+61
+64
+67
+72
+73
+72
+62
+57
+54
+51
+47
+48
+56
+68
+49
+54
+46
+46
+59
+51
+39
+44
+37
+39
+41
+40
+37
+38
+39
+40
+39
+40
+40
+36
+34
+37
+46
+53
+51
+49
+46
+43
+41
+40
+40
+40
+42
+41
+46
+55
+62
+59
+54
+49
+54
+43
+42
+45
+45
+39
+40
+47
+50
+52
+54
+53
+50
+47
+44
+44
+50
+49
+49
+75
+26
+35
+62
+38
+40
+55
+64
+55
+42
+42
+49
+55
+52
+46
+41
+38
+42
+46
+48
+46
+88
+79
+58
+44
+47
+45
+39
+42
+37
+38
+38
+37
+39
+42
+46
+49
+48
+59
+87
+112
+118
+124
+131
+124
+132
+128
+123
+122
+124
+124
+120
+115
+110
+92
+92
+91
+86
+107
+128
+122
+109
+102
+99
+106
+119
+129
+131
+132
+127
+124
+118
+113
+111
+114
+118
+117
+119
+121
+127
+132
+134
+135
+140
+144
+147
+154
+167
+185
+199
+202
+196
+188
+183
+174
+168
+61
+61
+61
+61
+61
+61
+61
+61
+59
+59
+59
+60
+60
+61
+61
+61
+63
+61
+61
+61
+59
+60
+60
+62
+64
+67
+70
+74
+81
+88
+94
+102
+116
+131
+145
+157
+172
+188
+196
+196
+193
+186
+171
+162
+164
+168
+158
+125
+69
+46
+46
+53
+59
+58
+58
+61
+61
+60
+62
+65
+69
+70
+70
+67
+55
+52
+49
+47
+44
+43
+53
+65
+64
+61
+51
+49
+57
+56
+43
+35
+39
+40
+42
+42
+40
+40
+40
+40
+40
+38
+37
+37
+42
+46
+48
+49
+39
+38
+38
+39
+40
+42
+44
+47
+45
+43
+46
+55
+59
+55
+51
+48
+47
+56
+59
+48
+43
+47
+49
+45
+62
+61
+58
+54
+52
+51
+53
+55
+45
+53
+50
+63
+63
+43
+46
+30
+49
+58
+64
+56
+45
+44
+48
+49
+46
+42
+39
+40
+43
+48
+50
+47
+89
+78
+56
+43
+49
+48
+44
+47
+43
+42
+42
+41
+41
+40
+40
+41
+48
+57
+84
+106
+116
+124
+132
+128
+132
+128
+125
+125
+125
+123
+118
+113
+110
+93
+92
+92
+89
+104
+119
+111
+98
+92
+93
+99
+107
+112
+112
+109
+93
+93
+92
+94
+95
+101
+105
+107
+116
+118
+124
+125
+127
+130
+134
+137
+134
+139
+151
+168
+183
+191
+188
+186
+181
+172
+163
+60
+60
+60
+60
+60
+60
+60
+60
+58
+58
+58
+59
+59
+60
+60
+60
+61
+61
+61
+61
+59
+60
+60
+60
+65
+65
+68
+70
+75
+78
+83
+90
+103
+118
+133
+145
+164
+181
+190
+189
+193
+183
+169
+158
+162
+165
+152
+118
+70
+49
+45
+50
+56
+59
+58
+57
+62
+62
+63
+66
+69
+69
+66
+63
+52
+48
+43
+42
+40
+42
+51
+60
+62
+54
+52
+55
+61
+69
+60
+35
+40
+39
+41
+43
+44
+43
+41
+41
+41
+35
+35
+42
+51
+54
+49
+43
+39
+38
+37
+37
+37
+38
+40
+41
+45
+43
+47
+54
+58
+55
+51
+51
+55
+58
+64
+64
+66
+67
+62
+55
+60
+59
+57
+55
+51
+49
+49
+50
+44
+57
+52
+57
+106
+65
+45
+44
+55
+60
+59
+54
+46
+45
+43
+42
+39
+37
+39
+41
+46
+49
+49
+49
+89
+77
+51
+40
+51
+54
+51
+54
+56
+55
+54
+50
+49
+46
+42
+41
+47
+54
+77
+101
+114
+126
+136
+131
+131
+129
+127
+127
+127
+124
+117
+111
+109
+94
+90
+92
+90
+97
+101
+90
+81
+79
+82
+88
+93
+94
+92
+88
+77
+80
+85
+89
+96
+103
+106
+109
+114
+116
+120
+121
+121
+122
+126
+129
+127
+128
+134
+146
+162
+174
+178
+180
+173
+165
+155
+59
+59
+59
+59
+59
+59
+59
+59
+58
+58
+58
+59
+59
+60
+60
+60
+61
+61
+60
+61
+59
+60
+60
+60
+64
+64
+66
+67
+69
+70
+73
+79
+95
+109
+123
+137
+156
+173
+183
+179
+186
+180
+170
+161
+159
+156
+140
+108
+82
+66
+63
+61
+60
+59
+59
+60
+65
+65
+68
+69
+72
+68
+64
+59
+54
+49
+43
+42
+41
+42
+48
+58
+55
+49
+57
+63
+63
+76
+74
+43
+41
+36
+37
+41
+44
+44
+42
+41
+38
+38
+41
+47
+55
+54
+46
+38
+41
+41
+42
+40
+41
+41
+41
+43
+44
+44
+49
+57
+60
+59
+61
+65
+74
+54
+58
+89
+105
+90
+73
+72
+56
+56
+57
+58
+55
+49
+42
+37
+45
+50
+47
+64
+112
+83
+59
+68
+58
+57
+53
+48
+45
+42
+38
+35
+35
+36
+38
+44
+47
+45
+47
+50
+81
+71
+48
+41
+55
+58
+53
+53
+57
+57
+57
+56
+53
+50
+46
+45
+44
+49
+72
+95
+111
+127
+136
+133
+127
+127
+127
+128
+128
+123
+116
+110
+104
+92
+86
+90
+92
+90
+82
+71
+66
+67
+73
+80
+86
+88
+88
+87
+90
+92
+98
+104
+108
+111
+113
+112
+113
+116
+117
+118
+118
+118
+119
+122
+124
+123
+124
+133
+150
+164
+175
+181
+175
+165
+153
+59
+59
+59
+59
+59
+59
+59
+59
+58
+58
+58
+59
+59
+60
+60
+60
+60
+60
+60
+61
+59
+60
+60
+60
+60
+62
+62
+63
+65
+66
+69
+74
+89
+100
+113
+125
+145
+162
+168
+164
+167
+171
+169
+158
+148
+137
+119
+95
+84
+78
+78
+72
+62
+60
+62
+62
+66
+67
+71
+74
+73
+70
+63
+57
+55
+47
+43
+42
+41
+42
+46
+54
+65
+59
+66
+65
+54
+66
+76
+62
+50
+40
+35
+40
+45
+42
+41
+43
+37
+41
+47
+52
+53
+48
+43
+39
+43
+44
+48
+48
+53
+54
+56
+58
+53
+54
+61
+67
+70
+71
+78
+82
+77
+63
+75
+105
+118
+100
+83
+82
+68
+65
+62
+60
+57
+51
+42
+36
+42
+40
+50
+84
+90
+86
+63
+70
+64
+55
+48
+45
+45
+43
+39
+35
+35
+36
+40
+45
+44
+41
+46
+53
+71
+65
+48
+45
+57
+58
+49
+49
+48
+49
+50
+51
+50
+47
+46
+46
+42
+43
+66
+89
+108
+128
+137
+131
+124
+126
+127
+129
+129
+124
+117
+112
+101
+93
+86
+90
+93
+82
+66
+60
+63
+67
+75
+81
+86
+90
+95
+97
+101
+104
+109
+113
+114
+114
+112
+111
+114
+116
+116
+116
+116
+114
+116
+119
+123
+120
+120
+130
+149
+167
+181
+193
+191
+182
+168
+58
+58
+58
+58
+58
+58
+58
+58
+58
+58
+58
+59
+59
+60
+60
+60
+60
+60
+60
+61
+59
+60
+60
+60
+59
+59
+60
+63
+63
+64
+65
+70
+80
+93
+101
+115
+133
+151
+157
+151
+150
+159
+161
+150
+133
+117
+100
+80
+72
+78
+81
+74
+64
+60
+63
+66
+70
+70
+71
+72
+73
+69
+62
+54
+53
+45
+40
+40
+41
+42
+45
+51
+69
+63
+62
+56
+47
+58
+80
+91
+67
+51
+37
+39
+43
+43
+43
+44
+38
+45
+52
+52
+48
+44
+43
+45
+56
+59
+61
+60
+61
+61
+60
+62
+65
+66
+75
+78
+78
+79
+88
+95
+72
+91
+108
+107
+99
+95
+88
+74
+81
+71
+58
+50
+45
+45
+43
+42
+47
+40
+66
+99
+71
+75
+57
+57
+74
+60
+48
+45
+47
+43
+41
+40
+38
+37
+41
+45
+41
+39
+47
+59
+65
+61
+50
+46
+55
+54
+46
+45
+45
+44
+47
+49
+49
+49
+49
+50
+41
+41
+58
+82
+104
+125
+137
+132
+125
+127
+128
+128
+127
+121
+115
+111
+99
+96
+88
+91
+95
+78
+58
+56
+69
+73
+83
+89
+93
+96
+103
+108
+108
+109
+111
+112
+111
+110
+108
+108
+113
+113
+114
+114
+111
+112
+114
+116
+118
+116
+119
+132
+153
+175
+190
+204
+202
+192
+175
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+57
+57
+58
+58
+58
+60
+60
+60
+61
+59
+60
+60
+60
+58
+59
+59
+62
+62
+62
+60
+65
+77
+87
+95
+109
+128
+146
+152
+145
+142
+148
+148
+135
+121
+108
+91
+75
+66
+75
+79
+73
+67
+66
+67
+66
+69
+69
+70
+70
+70
+66
+60
+53
+51
+43
+39
+41
+42
+44
+49
+55
+58
+57
+51
+50
+50
+52
+69
+97
+91
+67
+47
+45
+46
+42
+43
+47
+44
+47
+51
+50
+47
+44
+47
+53
+66
+68
+69
+65
+63
+60
+56
+55
+65
+69
+77
+80
+80
+84
+96
+104
+87
+108
+116
+100
+89
+90
+84
+66
+82
+67
+49
+40
+36
+38
+38
+39
+46
+44
+77
+81
+62
+62
+51
+55
+81
+64
+49
+45
+44
+40
+40
+41
+39
+38
+38
+42
+40
+40
+52
+70
+65
+64
+54
+48
+51
+49
+43
+45
+47
+45
+47
+47
+47
+49
+49
+50
+46
+40
+50
+72
+94
+122
+138
+135
+129
+130
+132
+130
+124
+117
+111
+108
+96
+97
+87
+89
+93
+71
+49
+54
+68
+78
+91
+99
+104
+106
+110
+115
+116
+116
+114
+112
+110
+109
+108
+108
+110
+110
+111
+111
+108
+107
+110
+114
+116
+116
+119
+133
+154
+175
+189
+204
+201
+189
+171
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+57
+57
+58
+58
+58
+60
+60
+60
+61
+61
+60
+60
+60
+62
+61
+63
+63
+63
+62
+59
+63
+75
+84
+92
+107
+127
+148
+156
+151
+148
+149
+144
+133
+122
+111
+91
+76
+69
+78
+81
+76
+74
+73
+70
+64
+68
+67
+67
+65
+65
+61
+56
+52
+49
+43
+40
+44
+46
+49
+55
+61
+52
+53
+46
+48
+54
+39
+41
+71
+106
+80
+55
+48
+48
+42
+43
+48
+48
+50
+51
+50
+49
+50
+54
+60
+53
+56
+56
+56
+55
+53
+52
+53
+50
+57
+66
+71
+74
+77
+92
+104
+115
+106
+98
+93
+93
+89
+76
+59
+70
+59
+46
+40
+39
+40
+38
+37
+39
+43
+74
+50
+56
+49
+47
+64
+83
+65
+49
+42
+40
+37
+36
+40
+40
+38
+37
+42
+38
+37
+53
+74
+65
+66
+54
+46
+49
+47
+43
+50
+47
+46
+45
+43
+42
+42
+44
+44
+49
+40
+46
+66
+88
+119
+139
+138
+133
+133
+134
+130
+122
+114
+108
+105
+92
+94
+85
+86
+90
+67
+45
+53
+63
+74
+92
+103
+108
+110
+114
+118
+122
+119
+114
+109
+105
+103
+103
+105
+107
+109
+109
+108
+104
+105
+106
+111
+115
+114
+120
+132
+152
+169
+181
+194
+196
+183
+164
+55
+55
+55
+55
+55
+55
+55
+55
+56
+56
+56
+56
+56
+56
+56
+58
+60
+61
+62
+60
+60
+61
+63
+65
+66
+63
+64
+65
+66
+66
+65
+66
+76
+80
+91
+108
+134
+156
+170
+173
+166
+166
+159
+144
+128
+115
+102
+96
+87
+79
+74
+76
+79
+75
+69
+70
+66
+63
+61
+58
+57
+54
+48
+44
+38
+48
+44
+40
+53
+61
+53
+50
+53
+49
+46
+45
+42
+42
+39
+37
+48
+76
+79
+57
+42
+46
+51
+45
+42
+66
+47
+59
+62
+56
+77
+51
+50
+50
+50
+39
+42
+47
+47
+38
+41
+55
+46
+55
+64
+57
+112
+66
+108
+105
+99
+92
+87
+77
+64
+52
+55
+55
+49
+38
+33
+35
+39
+41
+45
+47
+63
+55
+49
+52
+52
+67
+72
+69
+59
+48
+41
+40
+41
+42
+47
+44
+35
+30
+36
+47
+59
+63
+70
+61
+48
+42
+44
+49
+51
+52
+49
+49
+49
+46
+46
+45
+45
+47
+48
+37
+49
+51
+89
+113
+143
+134
+140
+141
+135
+123
+116
+115
+110
+101
+99
+89
+91
+89
+105
+59
+45
+54
+66
+77
+93
+99
+103
+106
+110
+111
+110
+109
+108
+105
+104
+102
+101
+102
+108
+109
+108
+107
+103
+102
+103
+105
+109
+114
+118
+124
+137
+153
+164
+174
+173
+158
+141
+55
+55
+55
+55
+55
+55
+55
+55
+56
+56
+56
+56
+56
+56
+56
+58
+59
+62
+63
+62
+61
+61
+63
+66
+67
+65
+66
+66
+68
+70
+72
+73
+78
+84
+97
+116
+142
+166
+183
+187
+199
+182
+160
+142
+133
+125
+111
+100
+99
+90
+82
+83
+86
+80
+74
+69
+63
+60
+58
+56
+55
+52
+47
+44
+43
+45
+40
+44
+54
+52
+49
+55
+48
+45
+42
+40
+38
+38
+37
+39
+46
+59
+68
+60
+47
+40
+41
+46
+51
+69
+49
+60
+65
+60
+77
+50
+44
+40
+44
+44
+43
+40
+40
+44
+39
+40
+44
+68
+38
+65
+80
+51
+117
+106
+97
+93
+83
+67
+56
+54
+44
+53
+54
+44
+31
+26
+25
+27
+37
+54
+80
+71
+52
+53
+61
+85
+66
+63
+57
+47
+41
+44
+47
+48
+51
+49
+46
+45
+46
+51
+57
+61
+64
+56
+45
+42
+44
+49
+51
+51
+50
+50
+49
+48
+46
+45
+45
+45
+49
+36
+47
+50
+87
+115
+144
+136
+140
+138
+132
+121
+116
+114
+110
+103
+97
+90
+95
+96
+92
+55
+46
+57
+67
+75
+89
+95
+98
+102
+105
+106
+105
+105
+104
+101
+100
+100
+99
+101
+106
+108
+108
+105
+101
+99
+99
+99
+104
+107
+112
+115
+124
+132
+135
+139
+126
+111
+95
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+58
+62
+64
+64
+63
+62
+63
+67
+69
+71
+71
+73
+77
+79
+84
+86
+88
+96
+112
+134
+161
+185
+201
+206
+210
+196
+178
+159
+147
+138
+122
+109
+105
+92
+81
+79
+82
+81
+75
+69
+61
+58
+57
+55
+55
+52
+48
+45
+45
+43
+44
+54
+63
+50
+41
+50
+47
+46
+44
+44
+40
+38
+38
+42
+45
+46
+57
+67
+58
+37
+35
+50
+53
+68
+50
+59
+63
+61
+80
+59
+48
+38
+39
+51
+47
+39
+37
+50
+41
+57
+48
+48
+60
+93
+73
+101
+102
+92
+84
+82
+73
+59
+52
+57
+44
+50
+53
+49
+45
+41
+35
+32
+30
+42
+67
+58
+44
+53
+66
+93
+58
+59
+57
+51
+47
+52
+56
+59
+60
+59
+59
+63
+62
+58
+61
+68
+57
+52
+44
+43
+45
+49
+50
+50
+50
+50
+49
+48
+46
+45
+45
+45
+50
+37
+43
+48
+84
+119
+146
+138
+137
+137
+129
+120
+114
+111
+107
+102
+95
+92
+98
+103
+72
+51
+50
+60
+69
+78
+90
+94
+95
+99
+103
+103
+102
+102
+99
+98
+98
+97
+98
+99
+102
+104
+104
+101
+97
+96
+96
+96
+106
+110
+115
+116
+119
+117
+110
+108
+87
+76
+62
+57
+57
+57
+57
+57
+57
+57
+57
+57
+57
+57
+57
+57
+57
+57
+57
+56
+58
+60
+62
+63
+62
+67
+69
+72
+79
+84
+89
+95
+99
+102
+104
+108
+116
+134
+155
+181
+200
+214
+220
+212
+208
+194
+167
+144
+130
+124
+123
+116
+103
+92
+84
+80
+77
+71
+66
+59
+56
+55
+55
+54
+52
+49
+46
+42
+45
+48
+58
+71
+63
+46
+41
+49
+49
+48
+49
+45
+39
+38
+43
+45
+43
+52
+66
+61
+44
+42
+54
+45
+58
+48
+53
+58
+62
+86
+79
+69
+56
+38
+49
+44
+50
+42
+46
+57
+28
+54
+49
+63
+76
+98
+85
+67
+68
+70
+65
+61
+57
+56
+55
+51
+49
+50
+58
+72
+83
+78
+64
+50
+53
+73
+76
+82
+90
+81
+86
+49
+54
+57
+55
+53
+57
+60
+59
+64
+61
+61
+67
+63
+56
+61
+74
+51
+48
+43
+44
+46
+48
+49
+49
+50
+50
+49
+48
+46
+45
+45
+45
+51
+39
+40
+46
+79
+121
+146
+139
+137
+135
+126
+118
+111
+106
+102
+98
+92
+94
+100
+104
+53
+48
+56
+67
+75
+80
+89
+92
+94
+98
+101
+102
+100
+97
+97
+96
+96
+96
+97
+99
+102
+103
+102
+98
+96
+93
+93
+95
+103
+110
+116
+115
+117
+113
+105
+100
+84
+75
+64
+59
+59
+59
+59
+59
+59
+59
+59
+59
+59
+59
+59
+59
+59
+59
+57
+53
+53
+57
+59
+62
+64
+70
+75
+81
+92
+104
+115
+121
+123
+125
+127
+129
+138
+153
+172
+193
+208
+220
+225
+224
+214
+190
+159
+130
+115
+111
+107
+109
+108
+105
+96
+87
+77
+66
+61
+59
+56
+56
+55
+55
+53
+48
+47
+41
+51
+48
+49
+72
+81
+67
+48
+48
+45
+47
+51
+49
+42
+39
+42
+44
+48
+53
+57
+57
+51
+50
+50
+38
+50
+47
+48
+50
+59
+84
+94
+95
+83
+49
+51
+45
+69
+54
+44
+45
+63
+52
+54
+104
+66
+49
+52
+42
+61
+69
+58
+55
+61
+59
+48
+51
+59
+70
+83
+99
+108
+107
+97
+62
+64
+91
+103
+112
+106
+75
+59
+48
+55
+60
+59
+53
+52
+49
+49
+59
+55
+54
+56
+52
+51
+60
+75
+47
+46
+43
+44
+46
+48
+47
+49
+50
+50
+49
+48
+46
+45
+45
+45
+51
+42
+37
+45
+71
+121
+145
+140
+137
+132
+124
+116
+109
+102
+96
+93
+92
+97
+101
+97
+43
+48
+62
+73
+77
+83
+92
+95
+95
+99
+99
+98
+96
+96
+95
+95
+95
+96
+97
+98
+100
+101
+100
+96
+94
+90
+92
+94
+97
+103
+109
+112
+115
+114
+110
+106
+100
+94
+84
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+58
+52
+52
+56
+58
+62
+69
+77
+84
+97
+112
+129
+140
+145
+147
+147
+148
+149
+157
+170
+183
+196
+207
+216
+218
+218
+201
+180
+162
+145
+123
+93
+64
+66
+73
+82
+85
+82
+77
+67
+58
+60
+59
+57
+56
+56
+54
+48
+47
+44
+54
+43
+36
+63
+92
+90
+73
+50
+41
+41
+48
+48
+44
+41
+45
+42
+49
+50
+47
+48
+53
+51
+43
+39
+45
+49
+46
+45
+53
+71
+87
+98
+97
+60
+60
+44
+75
+57
+47
+53
+40
+41
+89
+65
+61
+58
+35
+43
+62
+69
+57
+50
+55
+53
+46
+55
+78
+101
+110
+108
+105
+108
+107
+76
+74
+90
+84
+77
+70
+50
+47
+60
+68
+72
+67
+56
+51
+46
+45
+58
+58
+55
+52
+52
+58
+67
+74
+46
+44
+44
+44
+45
+47
+47
+47
+50
+50
+49
+48
+46
+45
+45
+45
+49
+45
+36
+44
+61
+118
+141
+141
+135
+129
+120
+114
+107
+98
+92
+90
+92
+99
+96
+77
+43
+48
+64
+73
+78
+82
+91
+95
+96
+100
+99
+96
+93
+92
+92
+93
+94
+95
+97
+98
+98
+98
+98
+95
+91
+89
+89
+90
+95
+101
+107
+109
+115
+117
+115
+114
+112
+109
+102
+61
+61
+61
+61
+61
+61
+61
+61
+60
+60
+60
+60
+60
+60
+60
+58
+54
+54
+57
+60
+65
+75
+86
+97
+118
+134
+151
+161
+165
+163
+165
+167
+171
+178
+184
+191
+196
+200
+206
+205
+198
+187
+179
+176
+169
+148
+109
+76
+50
+52
+52
+57
+68
+78
+75
+67
+63
+61
+59
+58
+56
+53
+49
+48
+48
+54
+44
+39
+63
+86
+91
+87
+66
+50
+41
+44
+48
+44
+43
+48
+44
+47
+47
+46
+49
+52
+48
+37
+41
+42
+47
+46
+46
+51
+55
+67
+82
+94
+75
+87
+55
+74
+60
+69
+56
+46
+51
+73
+59
+58
+37
+61
+59
+62
+65
+60
+54
+50
+59
+68
+83
+101
+115
+115
+106
+103
+104
+102
+100
+86
+84
+61
+48
+52
+51
+64
+69
+75
+76
+65
+55
+51
+49
+51
+55
+62
+61
+55
+58
+69
+72
+66
+47
+45
+45
+44
+45
+44
+47
+48
+50
+50
+49
+48
+46
+45
+45
+45
+47
+48
+37
+44
+53
+113
+138
+141
+132
+124
+116
+112
+106
+97
+93
+94
+95
+102
+91
+54
+48
+49
+64
+69
+77
+82
+91
+94
+97
+100
+97
+93
+89
+87
+88
+88
+92
+93
+95
+96
+95
+94
+94
+92
+89
+87
+86
+88
+95
+100
+104
+108
+111
+113
+109
+106
+104
+101
+96
+61
+61
+61
+61
+61
+61
+61
+61
+60
+60
+60
+60
+60
+60
+60
+58
+57
+57
+60
+64
+71
+82
+97
+109
+138
+152
+168
+176
+176
+175
+176
+181
+190
+195
+196
+196
+193
+191
+190
+188
+187
+180
+175
+169
+166
+162
+150
+136
+84
+71
+53
+48
+63
+81
+86
+79
+67
+63
+61
+59
+58
+53
+49
+48
+48
+53
+51
+53
+69
+77
+79
+88
+85
+62
+45
+46
+49
+45
+44
+48
+48
+45
+46
+51
+55
+52
+45
+37
+43
+37
+45
+45
+50
+53
+47
+52
+70
+93
+92
+117
+74
+77
+67
+96
+115
+64
+128
+112
+84
+63
+50
+62
+75
+62
+63
+70
+66
+56
+74
+103
+119
+114
+110
+103
+107
+111
+110
+101
+93
+73
+71
+52
+48
+52
+46
+53
+63
+68
+65
+56
+47
+47
+49
+54
+47
+60
+61
+54
+58
+69
+65
+52
+46
+46
+45
+44
+42
+44
+47
+49
+49
+50
+49
+48
+46
+45
+45
+45
+46
+50
+37
+44
+49
+111
+136
+142
+128
+120
+113
+111
+106
+97
+95
+96
+98
+103
+87
+39
+51
+47
+60
+63
+76
+81
+91
+95
+98
+100
+95
+90
+85
+85
+85
+86
+90
+92
+93
+93
+91
+91
+91
+88
+87
+85
+84
+88
+90
+95
+99
+100
+102
+102
+93
+88
+81
+82
+76
+60
+62
+64
+64
+63
+63
+63
+65
+66
+63
+61
+61
+65
+67
+66
+62
+63
+62
+64
+73
+80
+90
+112
+137
+154
+165
+177
+185
+186
+183
+180
+182
+198
+202
+202
+198
+195
+190
+187
+180
+181
+176
+172
+165
+163
+161
+156
+152
+136
+103
+70
+103
+101
+63
+78
+99
+76
+65
+57
+58
+57
+53
+49
+54
+49
+46
+59
+51
+63
+75
+65
+86
+84
+73
+57
+47
+45
+47
+47
+47
+45
+44
+48
+52
+48
+41
+40
+44
+36
+38
+41
+45
+48
+48
+49
+52
+57
+78
+93
+83
+61
+60
+96
+132
+128
+113
+107
+109
+107
+97
+92
+96
+90
+75
+66
+65
+62
+57
+62
+72
+95
+105
+114
+112
+109
+110
+111
+103
+83
+64
+53
+49
+49
+46
+49
+52
+61
+58
+55
+52
+48
+49
+51
+54
+60
+59
+59
+60
+59
+57
+51
+47
+44
+46
+46
+43
+43
+44
+44
+48
+50
+51
+50
+49
+47
+46
+46
+46
+53
+44
+44
+38
+55
+87
+154
+131
+128
+124
+114
+104
+101
+101
+100
+96
+108
+100
+63
+32
+38
+46
+53
+67
+69
+77
+90
+98
+96
+92
+89
+89
+83
+82
+83
+84
+88
+90
+93
+91
+88
+87
+88
+87
+87
+85
+84
+83
+91
+93
+94
+91
+85
+77
+67
+62
+46
+47
+46
+59
+62
+64
+64
+64
+63
+64
+65
+66
+64
+63
+64
+66
+67
+66
+64
+71
+70
+71
+83
+97
+111
+131
+150
+162
+174
+184
+185
+181
+180
+182
+190
+206
+211
+209
+206
+199
+193
+186
+177
+172
+167
+167
+164
+164
+163
+158
+154
+154
+128
+100
+119
+109
+74
+91
+112
+91
+76
+64
+62
+64
+59
+54
+52
+56
+51
+56
+46
+51
+64
+59
+77
+96
+81
+58
+41
+38
+45
+45
+41
+49
+53
+55
+51
+46
+41
+42
+42
+46
+43
+43
+43
+44
+44
+46
+50
+55
+64
+76
+91
+98
+100
+101
+105
+87
+82
+86
+100
+111
+107
+95
+84
+58
+53
+54
+57
+53
+45
+54
+67
+90
+100
+108
+109
+110
+109
+104
+90
+69
+55
+52
+51
+53
+48
+47
+50
+57
+55
+52
+51
+49
+50
+53
+54
+59
+58
+58
+57
+57
+53
+49
+44
+44
+45
+44
+44
+43
+44
+44
+48
+50
+51
+50
+49
+47
+46
+46
+46
+51
+50
+46
+42
+52
+91
+147
+125
+122
+118
+111
+105
+102
+98
+99
+99
+104
+86
+56
+35
+35
+40
+47
+56
+65
+74
+88
+95
+93
+88
+86
+84
+79
+80
+81
+82
+86
+88
+91
+89
+88
+87
+87
+87
+84
+81
+82
+81
+80
+78
+76
+70
+63
+54
+47
+43
+45
+45
+45
+60
+62
+65
+65
+65
+65
+66
+67
+68
+67
+66
+67
+68
+68
+67
+67
+77
+77
+82
+98
+116
+132
+149
+164
+172
+182
+187
+181
+176
+175
+184
+196
+213
+217
+217
+216
+209
+202
+193
+184
+173
+169
+167
+166
+167
+165
+160
+154
+144
+129
+107
+112
+96
+71
+85
+105
+117
+95
+76
+68
+68
+64
+58
+54
+58
+54
+58
+48
+44
+51
+47
+56
+92
+91
+77
+54
+40
+43
+45
+44
+50
+62
+67
+54
+41
+39
+39
+37
+42
+41
+41
+41
+44
+47
+52
+57
+40
+51
+67
+88
+98
+97
+91
+91
+80
+81
+87
+101
+116
+115
+93
+66
+53
+52
+60
+62
+57
+52
+69
+87
+83
+87
+95
+102
+107
+105
+89
+73
+55
+49
+53
+56
+59
+53
+49
+48
+51
+50
+48
+48
+49
+51
+54
+56
+57
+57
+55
+56
+56
+52
+48
+43
+45
+45
+44
+44
+41
+41
+44
+48
+50
+51
+50
+49
+47
+46
+46
+46
+48
+57
+48
+46
+46
+98
+136
+119
+120
+115
+109
+108
+102
+93
+95
+102
+103
+74
+52
+44
+39
+40
+47
+48
+60
+69
+81
+91
+90
+85
+82
+79
+77
+75
+76
+80
+84
+85
+88
+87
+89
+87
+85
+84
+82
+77
+77
+76
+71
+69
+65
+59
+51
+45
+42
+39
+48
+49
+50
+58
+61
+63
+65
+64
+65
+66
+68
+67
+67
+67
+68
+68
+67
+66
+68
+77
+86
+99
+115
+134
+149
+163
+173
+180
+183
+180
+175
+172
+177
+190
+202
+221
+225
+225
+225
+217
+208
+198
+189
+179
+175
+174
+171
+170
+167
+158
+150
+139
+132
+118
+113
+99
+87
+96
+109
+137
+116
+93
+78
+71
+68
+63
+60
+56
+56
+63
+59
+48
+47
+41
+35
+59
+82
+92
+69
+44
+39
+43
+45
+50
+75
+88
+70
+48
+42
+43
+40
+38
+37
+37
+37
+41
+44
+48
+52
+39
+44
+54
+66
+72
+73
+78
+86
+93
+98
+97
+100
+111
+115
+94
+61
+55
+52
+54
+52
+50
+52
+73
+95
+73
+73
+76
+86
+96
+93
+77
+56
+51
+51
+56
+62
+63
+59
+53
+50
+50
+49
+48
+48
+49
+51
+54
+55
+55
+57
+55
+56
+54
+52
+46
+43
+44
+45
+44
+44
+41
+41
+43
+47
+50
+51
+50
+49
+47
+46
+46
+46
+47
+60
+49
+46
+44
+106
+128
+116
+121
+113
+107
+106
+99
+89
+94
+104
+101
+66
+55
+59
+49
+45
+51
+45
+54
+62
+76
+85
+88
+82
+80
+75
+73
+74
+75
+77
+80
+84
+87
+86
+88
+85
+83
+80
+77
+74
+72
+71
+68
+65
+61
+56
+54
+54
+55
+56
+56
+56
+58
+56
+58
+62
+63
+64
+64
+66
+68
+66
+67
+68
+68
+67
+66
+66
+73
+82
+104
+123
+137
+151
+161
+171
+180
+183
+179
+173
+171
+176
+187
+198
+206
+223
+224
+228
+228
+225
+217
+209
+202
+194
+191
+188
+182
+181
+175
+163
+151
+140
+128
+121
+113
+107
+105
+101
+105
+132
+126
+114
+100
+89
+78
+69
+64
+55
+55
+61
+63
+51
+51
+53
+35
+34
+59
+75
+64
+47
+42
+42
+42
+50
+85
+104
+88
+62
+51
+50
+48
+45
+44
+43
+41
+39
+36
+36
+35
+44
+39
+41
+53
+65
+71
+71
+72
+80
+91
+97
+97
+104
+109
+95
+68
+60
+55
+56
+56
+61
+67
+83
+95
+63
+59
+59
+68
+79
+77
+65
+51
+49
+53
+56
+57
+57
+55
+51
+48
+50
+49
+48
+48
+50
+51
+52
+53
+56
+56
+56
+57
+55
+53
+47
+44
+45
+46
+45
+42
+41
+41
+41
+45
+50
+51
+50
+49
+47
+46
+46
+46
+47
+58
+48
+45
+51
+112
+122
+116
+116
+109
+102
+100
+99
+94
+100
+109
+91
+62
+61
+70
+59
+52
+54
+46
+51
+56
+70
+78
+83
+82
+77
+74
+72
+72
+73
+76
+79
+83
+86
+85
+86
+85
+82
+76
+75
+72
+70
+70
+66
+63
+59
+56
+58
+61
+64
+67
+63
+61
+63
+53
+56
+59
+61
+62
+63
+65
+67
+67
+68
+68
+68
+67
+67
+69
+80
+99
+124
+144
+154
+161
+169
+176
+180
+179
+176
+171
+174
+185
+199
+209
+209
+220
+221
+226
+228
+227
+224
+219
+214
+209
+204
+198
+192
+190
+184
+168
+153
+134
+116
+113
+101
+101
+103
+91
+91
+109
+117
+123
+121
+112
+99
+84
+71
+63
+58
+54
+59
+49
+58
+74
+50
+41
+44
+46
+47
+49
+53
+49
+45
+47
+77
+93
+83
+63
+52
+49
+48
+51
+50
+50
+49
+47
+44
+43
+41
+24
+34
+50
+62
+64
+58
+59
+64
+67
+83
+95
+98
+102
+104
+89
+67
+62
+59
+67
+74
+84
+89
+93
+94
+58
+53
+51
+58
+65
+63
+56
+50
+50
+53
+54
+50
+48
+48
+48
+46
+52
+52
+51
+50
+51
+51
+51
+51
+56
+56
+56
+57
+55
+53
+47
+44
+45
+44
+43
+42
+40
+40
+40
+44
+50
+51
+50
+49
+47
+46
+46
+46
+49
+51
+49
+45
+67
+117
+117
+113
+105
+102
+97
+94
+98
+100
+105
+105
+70
+58
+60
+67
+62
+55
+52
+46
+46
+50
+62
+72
+77
+79
+75
+71
+70
+71
+72
+74
+78
+82
+85
+85
+85
+81
+78
+75
+72
+69
+70
+71
+69
+68
+65
+63
+64
+66
+71
+71
+66
+64
+64
+50
+53
+57
+59
+60
+62
+64
+66
+69
+70
+70
+69
+67
+69
+74
+89
+119
+142
+153
+160
+166
+173
+175
+175
+172
+174
+176
+182
+192
+205
+216
+214
+210
+210
+217
+222
+223
+224
+223
+221
+217
+212
+204
+196
+193
+186
+170
+153
+139
+113
+111
+101
+101
+106
+89
+95
+84
+96
+110
+118
+119
+115
+102
+87
+78
+66
+54
+61
+52
+61
+82
+48
+48
+43
+40
+46
+51
+51
+49
+51
+54
+62
+67
+64
+55
+49
+47
+47
+51
+51
+51
+51
+53
+53
+56
+54
+24
+37
+56
+61
+53
+43
+48
+62
+74
+85
+97
+101
+100
+97
+82
+64
+47
+47
+57
+64
+72
+74
+73
+70
+59
+54
+54
+60
+57
+52
+50
+52
+48
+53
+52
+46
+42
+44
+46
+44
+53
+52
+52
+51
+53
+53
+53
+53
+55
+55
+55
+56
+54
+52
+46
+43
+46
+45
+43
+42
+38
+38
+40
+44
+50
+51
+50
+49
+47
+46
+46
+46
+51
+43
+53
+48
+88
+120
+110
+105
+96
+102
+98
+93
+98
+104
+101
+89
+47
+55
+58
+59
+62
+56
+48
+48
+44
+46
+54
+64
+71
+74
+73
+70
+68
+66
+69
+72
+76
+79
+82
+83
+82
+80
+78
+74
+72
+70
+72
+72
+72
+72
+71
+70
+72
+75
+79
+78
+66
+64
+64
+51
+54
+57
+60
+61
+63
+63
+65
+70
+71
+72
+70
+73
+77
+85
+102
+137
+154
+158
+159
+164
+173
+175
+169
+169
+175
+184
+191
+200
+211
+221
+222
+211
+209
+216
+221
+223
+223
+223
+222
+217
+213
+203
+196
+193
+185
+170
+150
+132
+103
+102
+90
+88
+95
+80
+93
+70
+77
+88
+99
+114
+122
+119
+106
+92
+79
+66
+73
+61
+64
+79
+34
+39
+39
+46
+54
+45
+34
+39
+55
+63
+55
+46
+48
+53
+53
+52
+52
+52
+50
+46
+43
+41
+43
+44
+45
+62
+50
+41
+45
+50
+53
+52
+51
+78
+81
+85
+89
+93
+88
+79
+64
+43
+43
+47
+50
+52
+54
+56
+54
+62
+59
+63
+66
+62
+53
+51
+57
+51
+55
+57
+47
+43
+46
+49
+47
+52
+52
+52
+52
+54
+54
+54
+54
+54
+53
+53
+52
+53
+49
+45
+40
+44
+43
+43
+40
+38
+36
+38
+42
+48
+50
+50
+47
+47
+44
+44
+46
+52
+38
+57
+53
+103
+121
+105
+99
+93
+104
+101
+93
+97
+104
+93
+70
+35
+56
+58
+54
+63
+57
+45
+49
+39
+40
+49
+58
+69
+73
+74
+72
+67
+66
+67
+69
+72
+77
+80
+81
+80
+77
+74
+73
+71
+70
+72
+73
+71
+70
+71
+73
+75
+77
+78
+78
+67
+63
+66
+54
+56
+59
+62
+62
+62
+62
+63
+62
+63
+66
+71
+82
+95
+110
+126
+147
+160
+168
+169
+166
+163
+162
+164
+173
+181
+192
+204
+214
+223
+231
+232
+223
+218
+219
+220
+220
+219
+216
+213
+210
+207
+201
+198
+193
+184
+171
+155
+124
+108
+96
+90
+85
+80
+78
+79
+73
+80
+80
+83
+100
+114
+124
+134
+113
+115
+93
+76
+65
+84
+49
+42
+42
+40
+39
+38
+40
+43
+46
+49
+46
+50
+52
+48
+40
+39
+47
+53
+48
+48
+46
+43
+41
+42
+44
+47
+46
+52
+58
+60
+59
+52
+44
+38
+55
+66
+76
+83
+86
+82
+73
+58
+42
+40
+44
+46
+47
+50
+51
+54
+62
+63
+63
+63
+63
+63
+60
+60
+55
+56
+59
+57
+54
+53
+54
+58
+52
+51
+52
+53
+53
+53
+51
+52
+53
+54
+52
+52
+51
+47
+44
+41
+44
+42
+40
+38
+38
+37
+37
+38
+45
+47
+48
+46
+44
+43
+42
+44
+48
+46
+53
+64
+117
+113
+106
+99
+105
+90
+94
+103
+99
+107
+87
+35
+32
+39
+52
+60
+57
+49
+47
+47
+38
+37
+46
+56
+68
+75
+78
+74
+70
+66
+64
+66
+70
+74
+80
+81
+76
+72
+71
+72
+74
+73
+72
+71
+74
+73
+71
+71
+74
+72
+71
+67
+60
+61
+66
+52
+54
+60
+63
+63
+62
+62
+61
+59
+60
+65
+73
+88
+105
+121
+134
+149
+158
+162
+162
+159
+159
+161
+164
+176
+186
+197
+207
+217
+224
+230
+229
+221
+217
+218
+219
+218
+217
+214
+211
+210
+205
+200
+198
+192
+183
+170
+154
+123
+105
+94
+89
+83
+77
+74
+75
+75
+82
+82
+82
+97
+106
+111
+119
+133
+133
+115
+100
+83
+85
+44
+37
+41
+38
+37
+38
+39
+42
+45
+47
+44
+44
+44
+44
+43
+43
+43
+44
+49
+48
+46
+44
+42
+40
+38
+38
+42
+48
+53
+56
+57
+55
+52
+49
+45
+54
+64
+71
+73
+70
+59
+42
+37
+36
+41
+44
+47
+51
+55
+58
+64
+65
+65
+65
+64
+60
+61
+58
+57
+56
+58
+59
+57
+58
+58
+60
+52
+53
+52
+53
+53
+53
+51
+50
+53
+54
+52
+52
+49
+47
+44
+41
+42
+42
+40
+38
+38
+37
+37
+37
+43
+43
+44
+42
+42
+40
+41
+42
+49
+43
+51
+88
+114
+111
+98
+104
+99
+95
+91
+97
+109
+98
+64
+37
+39
+40
+44
+49
+48
+45
+46
+44
+29
+39
+60
+74
+82
+81
+79
+76
+70
+65
+64
+64
+68
+72
+77
+78
+75
+71
+72
+70
+74
+73
+74
+72
+75
+73
+72
+70
+71
+71
+69
+65
+62
+63
+66
+46
+49
+55
+58
+59
+60
+61
+60
+60
+60
+66
+77
+93
+108
+123
+137
+148
+153
+152
+149
+148
+152
+160
+166
+181
+191
+202
+210
+216
+220
+224
+221
+215
+211
+211
+211
+212
+211
+208
+206
+205
+199
+194
+191
+186
+175
+162
+145
+119
+102
+91
+86
+82
+75
+72
+72
+81
+89
+89
+87
+98
+105
+107
+113
+132
+134
+129
+121
+104
+88
+43
+38
+41
+39
+38
+37
+38
+40
+43
+44
+45
+41
+39
+42
+47
+47
+40
+34
+46
+45
+44
+44
+43
+41
+38
+36
+41
+44
+46
+48
+51
+54
+55
+56
+49
+54
+59
+60
+62
+61
+54
+43
+37
+38
+44
+47
+51
+53
+57
+60
+59
+61
+61
+59
+58
+55
+55
+54
+55
+53
+55
+59
+60
+62
+60
+59
+52
+53
+52
+53
+53
+53
+51
+50
+54
+55
+53
+53
+49
+47
+44
+40
+41
+41
+39
+37
+37
+36
+36
+37
+39
+41
+42
+40
+40
+40
+41
+43
+50
+42
+54
+112
+108
+104
+91
+108
+92
+100
+90
+98
+113
+82
+41
+42
+43
+39
+38
+41
+42
+40
+41
+38
+29
+52
+84
+100
+96
+83
+76
+71
+67
+63
+64
+64
+69
+74
+77
+78
+77
+72
+72
+71
+75
+75
+76
+74
+75
+74
+70
+71
+72
+71
+70
+66
+68
+69
+72
+42
+45
+52
+55
+58
+59
+60
+60
+60
+61
+68
+79
+98
+114
+128
+140
+149
+148
+143
+139
+142
+152
+162
+173
+187
+195
+206
+213
+217
+219
+220
+217
+212
+209
+209
+210
+211
+210
+209
+206
+202
+196
+191
+187
+180
+169
+154
+137
+112
+96
+89
+84
+81
+73
+70
+69
+76
+89
+91
+92
+103
+107
+108
+115
+118
+115
+126
+129
+123
+97
+50
+41
+40
+39
+38
+37
+38
+39
+41
+42
+46
+42
+39
+41
+46
+46
+40
+33
+41
+41
+40
+41
+43
+43
+42
+41
+45
+47
+48
+47
+49
+49
+51
+51
+60
+59
+57
+51
+52
+55
+56
+49
+39
+41
+46
+49
+53
+54
+55
+58
+57
+59
+59
+60
+60
+58
+58
+58
+54
+54
+55
+59
+62
+63
+59
+56
+52
+53
+52
+53
+53
+53
+51
+52
+55
+55
+54
+53
+50
+47
+44
+42
+42
+40
+40
+38
+38
+36
+36
+36
+37
+40
+39
+40
+40
+40
+41
+43
+49
+46
+74
+119
+104
+94
+95
+102
+91
+97
+99
+108
+101
+61
+33
+46
+39
+39
+44
+46
+43
+36
+36
+36
+48
+77
+114
+124
+109
+87
+74
+69
+67
+64
+65
+67
+74
+76
+79
+79
+78
+73
+73
+72
+76
+76
+78
+77
+76
+74
+71
+72
+72
+73
+71
+68
+72
+73
+76
+39
+43
+49
+54
+57
+58
+61
+61
+61
+62
+68
+81
+101
+117
+129
+138
+144
+143
+136
+134
+141
+154
+170
+180
+193
+201
+208
+214
+217
+216
+217
+214
+209
+206
+209
+210
+210
+211
+211
+207
+205
+199
+192
+185
+175
+162
+146
+129
+104
+90
+84
+82
+79
+72
+68
+66
+68
+82
+87
+89
+100
+106
+108
+113
+110
+104
+118
+123
+126
+96
+50
+40
+40
+39
+39
+39
+39
+39
+40
+41
+47
+46
+44
+43
+43
+42
+41
+40
+43
+43
+44
+43
+42
+42
+44
+45
+48
+48
+50
+47
+48
+44
+45
+42
+55
+53
+52
+46
+48
+49
+50
+44
+37
+41
+48
+53
+56
+57
+59
+60
+63
+63
+64
+64
+65
+63
+63
+64
+56
+55
+55
+58
+61
+61
+56
+52
+52
+53
+54
+55
+53
+53
+53
+52
+56
+56
+54
+54
+50
+47
+44
+42
+42
+40
+40
+38
+38
+38
+38
+38
+37
+38
+39
+40
+40
+42
+44
+46
+47
+56
+100
+111
+103
+89
+104
+95
+95
+88
+108
+113
+79
+46
+45
+48
+41
+43
+47
+43
+34
+30
+40
+53
+83
+108
+139
+141
+119
+91
+75
+70
+68
+66
+68
+71
+78
+80
+83
+83
+78
+73
+73
+71
+76
+76
+79
+78
+74
+73
+72
+73
+73
+72
+71
+68
+73
+75
+78
+37
+42
+48
+51
+55
+58
+59
+60
+60
+61
+68
+82
+102
+117
+127
+134
+137
+138
+133
+135
+147
+163
+179
+190
+202
+209
+214
+216
+217
+215
+213
+212
+205
+204
+205
+207
+210
+210
+212
+208
+210
+201
+192
+182
+169
+155
+138
+120
+97
+86
+81
+80
+77
+73
+69
+67
+69
+82
+90
+90
+99
+103
+106
+111
+114
+104
+116
+106
+109
+81
+43
+35
+39
+40
+40
+40
+40
+41
+42
+42
+43
+45
+46
+44
+41
+39
+41
+44
+46
+50
+52
+49
+42
+38
+41
+44
+44
+44
+47
+45
+47
+43
+43
+40
+44
+47
+52
+51
+54
+51
+46
+35
+37
+42
+50
+57
+59
+60
+63
+63
+64
+64
+64
+61
+60
+57
+57
+55
+59
+58
+58
+58
+59
+58
+54
+51
+52
+53
+54
+55
+53
+53
+53
+52
+57
+57
+55
+54
+52
+47
+45
+42
+43
+41
+41
+39
+39
+37
+39
+37
+36
+37
+38
+39
+40
+42
+46
+48
+49
+72
+113
+98
+100
+90
+108
+92
+96
+87
+106
+102
+57
+43
+58
+51
+48
+48
+45
+35
+24
+29
+58
+84
+119
+135
+151
+147
+125
+98
+81
+70
+66
+66
+70
+74
+79
+82
+85
+84
+78
+75
+72
+70
+75
+76
+78
+79
+75
+74
+73
+73
+73
+72
+71
+67
+74
+77
+80
+35
+39
+45
+48
+52
+53
+56
+56
+60
+60
+67
+81
+101
+116
+124
+130
+136
+138
+138
+144
+160
+179
+196
+205
+216
+219
+222
+221
+216
+214
+212
+209
+203
+202
+205
+207
+211
+212
+214
+211
+210
+200
+188
+176
+163
+146
+127
+109
+91
+81
+78
+79
+77
+73
+71
+69
+70
+84
+91
+90
+97
+100
+101
+108
+115
+106
+111
+80
+80
+56
+39
+41
+39
+38
+39
+40
+42
+42
+42
+42
+39
+41
+44
+44
+42
+40
+40
+41
+42
+52
+61
+58
+47
+38
+39
+44
+41
+41
+43
+41
+43
+41
+43
+41
+43
+46
+52
+51
+54
+53
+49
+41
+46
+52
+57
+62
+62
+62
+64
+63
+60
+60
+57
+55
+53
+50
+50
+49
+57
+58
+59
+57
+55
+53
+54
+54
+54
+55
+54
+55
+55
+55
+55
+54
+58
+58
+58
+55
+52
+48
+45
+42
+42
+42
+42
+40
+40
+38
+40
+38
+34
+34
+36
+37
+40
+42
+45
+49
+54
+91
+111
+97
+95
+96
+102
+98
+95
+99
+96
+72
+51
+52
+61
+55
+54
+49
+43
+34
+30
+46
+80
+113
+138
+142
+146
+141
+125
+101
+81
+69
+64
+64
+68
+74
+80
+83
+85
+83
+78
+74
+71
+69
+74
+75
+78
+78
+75
+73
+73
+72
+74
+73
+72
+69
+76
+78
+81
+33
+37
+43
+46
+49
+52
+53
+54
+61
+60
+66
+81
+100
+112
+121
+126
+137
+140
+145
+154
+173
+192
+209
+220
+225
+228
+227
+225
+219
+213
+210
+206
+204
+201
+204
+206
+211
+214
+215
+212
+208
+196
+183
+171
+155
+136
+117
+99
+85
+76
+75
+77
+77
+73
+70
+70
+63
+77
+83
+82
+90
+92
+96
+101
+109
+102
+104
+59
+55
+37
+38
+50
+37
+38
+39
+41
+43
+44
+44
+44
+35
+37
+41
+44
+45
+42
+39
+36
+35
+50
+65
+64
+52
+41
+41
+47
+43
+42
+40
+39
+39
+40
+42
+43
+46
+47
+45
+42
+44
+49
+50
+49
+56
+61
+65
+66
+65
+60
+59
+58
+59
+57
+56
+56
+55
+54
+54
+55
+54
+58
+59
+57
+53
+52
+54
+58
+54
+55
+54
+55
+55
+55
+55
+54
+58
+58
+58
+57
+53
+50
+47
+43
+43
+42
+43
+42
+42
+40
+42
+40
+34
+34
+36
+37
+40
+43
+46
+49
+62
+102
+103
+100
+91
+103
+92
+104
+91
+111
+85
+45
+51
+63
+58
+57
+54
+49
+41
+38
+42
+63
+97
+127
+140
+139
+139
+132
+122
+101
+80
+64
+63
+62
+67
+74
+79
+82
+84
+82
+78
+73
+70
+68
+73
+75
+78
+78
+75
+74
+71
+70
+72
+71
+71
+68
+76
+79
+82
+33
+34
+38
+40
+45
+49
+51
+52
+53
+56
+64
+75
+89
+101
+115
+125
+130
+139
+150
+163
+182
+200
+216
+226
+238
+240
+236
+228
+220
+214
+211
+206
+198
+197
+201
+206
+208
+211
+210
+207
+197
+188
+175
+160
+143
+122
+103
+88
+81
+77
+76
+75
+73
+72
+71
+70
+59
+65
+79
+89
+88
+84
+91
+96
+101
+80
+60
+48
+47
+49
+47
+43
+40
+38
+40
+41
+41
+42
+44
+44
+37
+41
+44
+47
+47
+45
+42
+39
+41
+34
+74
+63
+35
+49
+47
+40
+43
+41
+40
+39
+38
+38
+38
+38
+41
+46
+50
+48
+44
+45
+52
+60
+69
+63
+60
+63
+64
+59
+58
+61
+62
+59
+56
+56
+57
+57
+56
+55
+61
+60
+58
+55
+53
+52
+53
+53
+55
+56
+57
+58
+59
+60
+60
+60
+59
+58
+58
+58
+57
+53
+48
+44
+43
+41
+43
+41
+41
+40
+42
+41
+35
+39
+35
+30
+37
+51
+54
+44
+101
+103
+98
+92
+88
+89
+99
+105
+111
+81
+51
+44
+54
+60
+56
+49
+51
+46
+38
+40
+61
+95
+119
+130
+140
+130
+128
+126
+110
+82
+66
+63
+62
+65
+68
+73
+76
+78
+79
+78
+73
+68
+66
+66
+73
+75
+76
+74
+77
+78
+75
+72
+69
+69
+73
+74
+81
+82
+83
+34
+35
+39
+40
+44
+48
+49
+50
+52
+55
+61
+71
+84
+97
+107
+117
+127
+137
+148
+164
+186
+206
+223
+233
+239
+240
+235
+226
+216
+210
+207
+204
+199
+199
+201
+204
+207
+206
+204
+200
+188
+177
+161
+147
+130
+112
+96
+83
+79
+75
+75
+75
+73
+72
+71
+69
+71
+67
+70
+76
+80
+83
+88
+95
+83
+69
+57
+48
+47
+48
+44
+40
+38
+38
+40
+41
+41
+42
+44
+44
+39
+41
+43
+45
+47
+45
+42
+40
+41
+46
+69
+60
+40
+45
+44
+38
+44
+43
+42
+42
+41
+41
+41
+40
+42
+44
+44
+41
+39
+40
+46
+53
+71
+62
+57
+58
+61
+59
+60
+63
+58
+54
+50
+56
+66
+70
+67
+62
+55
+56
+55
+54
+53
+53
+56
+56
+55
+56
+57
+58
+59
+60
+60
+59
+58
+57
+56
+56
+56
+53
+47
+43
+42
+42
+42
+42
+42
+41
+43
+41
+36
+41
+37
+31
+39
+47
+50
+61
+103
+100
+91
+87
+91
+96
+100
+101
+76
+62
+50
+47
+48
+50
+58
+61
+46
+47
+53
+69
+91
+112
+125
+129
+125
+128
+131
+120
+94
+69
+61
+66
+64
+64
+67
+72
+75
+76
+77
+77
+71
+67
+66
+68
+74
+76
+78
+77
+79
+77
+75
+71
+70
+69
+73
+76
+81
+82
+83
+34
+35
+38
+41
+45
+47
+47
+45
+48
+49
+55
+65
+76
+87
+97
+105
+116
+127
+140
+160
+183
+206
+223
+234
+239
+237
+231
+223
+211
+203
+200
+195
+196
+196
+198
+199
+201
+197
+191
+183
+175
+161
+145
+129
+114
+99
+88
+81
+76
+75
+74
+74
+73
+72
+71
+69
+73
+63
+61
+68
+79
+83
+84
+83
+60
+55
+52
+49
+47
+46
+43
+40
+38
+36
+38
+39
+41
+42
+44
+44
+40
+40
+41
+43
+45
+45
+43
+40
+39
+61
+58
+53
+47
+40
+43
+38
+41
+41
+41
+42
+41
+41
+40
+39
+45
+44
+42
+42
+43
+47
+51
+56
+61
+57
+55
+56
+60
+60
+64
+67
+59
+65
+75
+85
+85
+76
+62
+52
+50
+50
+50
+50
+53
+54
+56
+56
+55
+56
+58
+59
+60
+60
+60
+59
+56
+55
+55
+55
+55
+52
+47
+44
+43
+43
+43
+43
+43
+41
+43
+41
+38
+42
+36
+36
+43
+39
+48
+84
+105
+96
+85
+86
+93
+102
+100
+97
+57
+54
+50
+48
+44
+41
+43
+47
+35
+44
+66
+95
+116
+123
+122
+123
+120
+133
+133
+109
+75
+53
+56
+66
+63
+64
+68
+71
+73
+74
+76
+75
+68
+67
+68
+70
+75
+78
+79
+78
+79
+79
+77
+74
+72
+72
+75
+77
+86
+87
+88
+38
+38
+41
+43
+45
+46
+46
+43
+45
+45
+51
+57
+68
+78
+87
+93
+100
+111
+126
+148
+172
+195
+214
+227
+234
+235
+226
+217
+204
+195
+191
+189
+189
+190
+193
+193
+189
+183
+174
+166
+157
+143
+127
+112
+99
+90
+83
+78
+75
+74
+74
+74
+75
+74
+73
+70
+65
+59
+61
+70
+80
+80
+73
+65
+47
+47
+49
+48
+46
+43
+41
+41
+36
+36
+38
+39
+41
+42
+44
+45
+41
+39
+38
+40
+43
+45
+43
+41
+39
+73
+49
+44
+52
+37
+43
+43
+40
+39
+40
+41
+41
+41
+40
+39
+42
+41
+41
+44
+51
+55
+57
+58
+53
+57
+59
+59
+58
+57
+61
+64
+86
+98
+106
+100
+81
+60
+51
+47
+49
+49
+49
+50
+53
+54
+55
+56
+56
+57
+59
+60
+60
+60
+60
+60
+58
+56
+55
+55
+55
+52
+47
+44
+42
+42
+41
+41
+43
+41
+42
+40
+39
+44
+38
+39
+45
+34
+52
+103
+100
+92
+85
+88
+95
+100
+95
+90
+65
+57
+50
+49
+48
+42
+35
+30
+29
+42
+72
+102
+116
+116
+115
+120
+133
+138
+125
+91
+58
+48
+55
+63
+64
+64
+67
+70
+72
+71
+72
+74
+66
+66
+69
+72
+77
+79
+81
+82
+80
+78
+76
+74
+71
+71
+75
+79
+88
+90
+90
+40
+42
+44
+46
+48
+48
+47
+43
+45
+45
+46
+52
+62
+70
+78
+82
+83
+93
+108
+129
+155
+178
+199
+211
+225
+226
+220
+211
+196
+186
+181
+179
+181
+182
+183
+181
+176
+166
+155
+146
+135
+124
+108
+95
+88
+83
+79
+76
+76
+76
+76
+75
+76
+75
+75
+71
+65
+61
+65
+70
+72
+64
+56
+51
+45
+47
+47
+46
+44
+41
+40
+40
+36
+36
+38
+39
+41
+42
+44
+45
+43
+41
+37
+39
+43
+46
+46
+44
+48
+84
+53
+43
+53
+36
+40
+43
+41
+42
+43
+44
+45
+45
+45
+45
+42
+41
+43
+49
+55
+58
+55
+52
+53
+60
+63
+57
+53
+58
+70
+79
+119
+110
+91
+67
+51
+46
+51
+58
+51
+49
+50
+50
+50
+51
+54
+54
+56
+57
+59
+60
+62
+62
+61
+59
+59
+57
+58
+58
+58
+55
+50
+47
+42
+42
+42
+41
+42
+40
+41
+41
+40
+42
+39
+42
+45
+41
+67
+114
+94
+91
+89
+91
+94
+93
+87
+85
+63
+57
+52
+49
+45
+39
+35
+35
+46
+60
+84
+102
+109
+110
+114
+125
+136
+128
+100
+67
+48
+49
+57
+61
+66
+66
+67
+69
+70
+70
+72
+71
+66
+67
+72
+74
+78
+80
+82
+83
+78
+79
+77
+75
+73
+73
+75
+79
+89
+88
+88
+46
+46
+49
+51
+53
+52
+50
+47
+47
+45
+46
+51
+58
+65
+73
+72
+74
+78
+92
+114
+137
+161
+183
+196
+209
+211
+207
+199
+186
+175
+166
+165
+169
+171
+170
+166
+161
+149
+137
+129
+115
+104
+94
+86
+82
+80
+78
+78
+77
+77
+77
+77
+77
+77
+77
+73
+79
+71
+64
+61
+55
+46
+43
+43
+49
+47
+46
+45
+41
+39
+38
+40
+36
+36
+38
+39
+41
+42
+44
+45
+44
+40
+35
+35
+41
+46
+47
+45
+55
+84
+65
+48
+51
+38
+32
+41
+39
+39
+39
+40
+41
+42
+44
+45
+51
+50
+51
+55
+58
+57
+53
+49
+54
+57
+58
+58
+64
+80
+99
+112
+101
+80
+54
+43
+48
+55
+58
+55
+53
+50
+52
+51
+51
+51
+53
+54
+57
+57
+59
+60
+62
+61
+61
+58
+60
+57
+58
+58
+58
+55
+50
+47
+41
+41
+41
+40
+40
+39
+38
+40
+41
+40
+41
+42
+42
+56
+88
+112
+92
+93
+92
+91
+90
+86
+82
+82
+55
+57
+53
+43
+27
+23
+37
+54
+84
+92
+101
+100
+102
+107
+116
+124
+109
+92
+67
+48
+44
+49
+59
+61
+68
+66
+68
+70
+70
+70
+70
+71
+67
+70
+75
+77
+79
+79
+81
+82
+81
+79
+80
+76
+74
+74
+78
+81
+94
+93
+92
+48
+51
+54
+57
+59
+59
+54
+51
+48
+45
+45
+50
+57
+63
+69
+68
+67
+68
+79
+97
+120
+144
+166
+181
+191
+195
+193
+186
+174
+161
+151
+148
+154
+158
+154
+150
+142
+131
+120
+110
+97
+89
+83
+80
+79
+80
+78
+78
+78
+78
+78
+79
+79
+79
+78
+77
+83
+69
+56
+50
+45
+40
+41
+44
+48
+47
+45
+44
+42
+40
+37
+37
+34
+34
+36
+39
+41
+42
+44
+45
+45
+40
+33
+33
+40
+46
+47
+45
+51
+73
+77
+57
+53
+46
+29
+40
+44
+43
+42
+41
+43
+46
+49
+51
+61
+60
+59
+59
+59
+58
+56
+53
+53
+53
+52
+58
+74
+91
+99
+95
+57
+50
+46
+49
+61
+64
+59
+50
+53
+51
+52
+52
+52
+52
+55
+55
+57
+58
+59
+60
+62
+61
+61
+58
+58
+57
+57
+57
+57
+54
+49
+46
+41
+41
+40
+39
+40
+39
+39
+38
+43
+37
+43
+41
+39
+75
+109
+102
+94
+92
+87
+83
+83
+82
+81
+85
+56
+55
+47
+36
+27
+35
+61
+86
+111
+113
+104
+89
+89
+99
+100
+95
+67
+56
+45
+42
+44
+48
+55
+62
+70
+67
+69
+70
+71
+70
+71
+71
+70
+73
+78
+79
+79
+78
+79
+81
+84
+83
+83
+80
+78
+78
+82
+85
+96
+95
+93
+51
+54
+57
+58
+59
+59
+57
+53
+51
+50
+50
+52
+59
+62
+68
+65
+62
+62
+72
+84
+104
+126
+147
+160
+167
+171
+173
+166
+157
+143
+133
+130
+133
+134
+134
+128
+120
+110
+101
+94
+84
+80
+77
+76
+77
+79
+79
+78
+79
+79
+78
+79
+78
+78
+76
+76
+72
+60
+47
+45
+47
+45
+45
+45
+47
+45
+44
+44
+44
+41
+39
+36
+36
+36
+38
+39
+41
+42
+44
+45
+47
+39
+33
+32
+39
+46
+47
+46
+42
+59
+84
+64
+55
+55
+31
+44
+55
+53
+51
+50
+51
+55
+60
+63
+59
+57
+55
+52
+52
+53
+55
+57
+57
+54
+53
+58
+72
+76
+57
+35
+38
+45
+55
+59
+57
+56
+59
+61
+54
+54
+54
+54
+53
+54
+57
+58
+56
+56
+59
+59
+60
+59
+58
+58
+58
+56
+56
+56
+56
+53
+49
+45
+40
+42
+41
+40
+39
+38
+40
+39
+45
+34
+46
+42
+38
+88
+124
+95
+100
+91
+82
+79
+80
+85
+85
+86
+56
+42
+28
+27
+43
+68
+102
+126
+118
+115
+97
+77
+81
+94
+86
+64
+41
+37
+40
+50
+50
+43
+50
+62
+72
+70
+71
+71
+71
+71
+71
+71
+74
+77
+80
+80
+77
+75
+74
+76
+84
+85
+83
+81
+79
+82
+85
+90
+91
+91
+90
+59
+59
+61
+61
+61
+61
+61
+59
+60
+61
+62
+63
+64
+68
+69
+69
+72
+72
+76
+82
+91
+105
+116
+123
+132
+136
+139
+137
+132
+123
+114
+106
+105
+101
+98
+94
+89
+85
+82
+79
+79
+75
+75
+73
+71
+72
+70
+72
+79
+84
+74
+66
+74
+80
+76
+76
+61
+52
+44
+40
+45
+48
+49
+45
+47
+46
+46
+46
+46
+43
+41
+41
+41
+41
+41
+41
+43
+43
+43
+44
+43
+45
+40
+32
+33
+42
+47
+46
+43
+45
+48
+56
+62
+57
+44
+35
+70
+64
+60
+59
+63
+64
+62
+58
+52
+55
+58
+58
+55
+52
+51
+55
+62
+57
+47
+40
+38
+41
+47
+51
+48
+51
+55
+58
+59
+57
+57
+58
+58
+58
+58
+57
+55
+55
+53
+53
+48
+49
+53
+54
+57
+58
+58
+59
+62
+59
+57
+58
+61
+59
+54
+49
+41
+43
+42
+40
+38
+37
+38
+38
+48
+45
+35
+38
+74
+111
+111
+90
+78
+79
+77
+79
+79
+82
+84
+83
+47
+22
+15
+41
+80
+111
+121
+120
+115
+97
+76
+67
+66
+66
+57
+48
+44
+50
+49
+48
+51
+48
+50
+62
+66
+72
+75
+75
+71
+73
+75
+74
+80
+83
+83
+80
+77
+74
+74
+73
+76
+77
+78
+80
+82
+85
+89
+94
+101
+92
+82
+63
+63
+63
+63
+63
+63
+63
+63
+64
+65
+65
+67
+68
+69
+70
+71
+74
+73
+77
+79
+85
+93
+100
+104
+108
+112
+114
+114
+109
+103
+95
+89
+86
+82
+79
+75
+73
+72
+72
+71
+75
+73
+73
+72
+71
+70
+71
+73
+77
+84
+77
+70
+77
+79
+74
+69
+57
+48
+44
+41
+44
+48
+50
+48
+46
+46
+46
+46
+45
+45
+44
+43
+43
+43
+43
+43
+43
+43
+43
+44
+46
+46
+40
+32
+32
+41
+46
+46
+45
+42
+41
+48
+58
+66
+67
+67
+63
+59
+53
+52
+55
+56
+54
+51
+55
+56
+57
+56
+55
+55
+57
+58
+55
+52
+44
+39
+38
+41
+45
+49
+52
+54
+55
+56
+55
+55
+54
+58
+58
+60
+58
+57
+55
+53
+53
+53
+50
+51
+53
+54
+56
+56
+57
+57
+59
+59
+61
+61
+59
+54
+50
+45
+43
+42
+43
+41
+40
+38
+37
+37
+39
+41
+42
+53
+80
+101
+97
+77
+76
+77
+80
+81
+83
+83
+86
+81
+47
+42
+51
+79
+110
+124
+112
+98
+72
+66
+59
+55
+55
+53
+49
+45
+47
+52
+52
+50
+51
+48
+51
+62
+69
+72
+77
+76
+72
+72
+76
+75
+81
+84
+83
+81
+76
+72
+72
+72
+74
+74
+76
+81
+84
+88
+88
+94
+89
+83
+73
+69
+69
+69
+69
+69
+69
+69
+69
+67
+68
+69
+70
+71
+72
+73
+71
+74
+72
+74
+76
+81
+85
+89
+91
+93
+94
+95
+95
+92
+89
+83
+81
+77
+75
+72
+67
+66
+67
+67
+66
+71
+69
+70
+70
+72
+72
+74
+76
+77
+85
+80
+78
+85
+81
+69
+64
+55
+49
+47
+43
+43
+44
+47
+47
+46
+45
+45
+46
+45
+44
+44
+43
+43
+43
+43
+43
+43
+43
+43
+44
+48
+46
+40
+32
+31
+38
+44
+46
+48
+43
+40
+42
+48
+57
+63
+68
+54
+51
+48
+50
+55
+60
+60
+60
+60
+58
+55
+54
+56
+57
+58
+58
+45
+43
+39
+37
+37
+40
+43
+46
+53
+54
+56
+55
+52
+52
+53
+57
+57
+57
+57
+55
+55
+53
+53
+51
+51
+52
+54
+54
+56
+57
+57
+56
+58
+60
+62
+61
+57
+49
+43
+40
+44
+43
+43
+41
+40
+38
+37
+38
+35
+37
+44
+61
+79
+84
+79
+70
+72
+76
+80
+83
+87
+87
+86
+80
+70
+86
+110
+128
+135
+123
+91
+60
+36
+43
+47
+50
+48
+46
+48
+47
+46
+51
+52
+49
+51
+47
+51
+61
+71
+74
+79
+78
+74
+74
+78
+78
+84
+85
+83
+80
+75
+73
+72
+73
+76
+76
+78
+83
+88
+91
+87
+88
+74
+69
+62
+73
+73
+73
+73
+73
+73
+73
+73
+71
+72
+72
+73
+74
+75
+76
+74
+72
+71
+73
+76
+79
+80
+82
+83
+87
+87
+87
+85
+84
+81
+80
+78
+77
+74
+70
+66
+64
+62
+64
+63
+65
+65
+67
+68
+71
+74
+76
+77
+81
+85
+79
+81
+92
+88
+68
+58
+56
+54
+48
+45
+41
+42
+46
+47
+45
+44
+45
+45
+45
+44
+44
+43
+43
+43
+43
+43
+43
+43
+43
+44
+49
+46
+39
+32
+29
+34
+41
+46
+45
+43
+42
+42
+43
+46
+47
+50
+53
+52
+50
+52
+56
+60
+63
+62
+60
+56
+54
+53
+56
+55
+53
+49
+40
+39
+38
+38
+38
+40
+41
+42
+49
+52
+55
+56
+53
+53
+54
+55
+56
+56
+56
+54
+54
+52
+52
+52
+50
+50
+52
+55
+56
+56
+55
+57
+58
+60
+61
+59
+50
+43
+39
+40
+42
+41
+41
+40
+38
+36
+35
+37
+42
+35
+39
+58
+72
+71
+71
+76
+74
+76
+79
+82
+86
+86
+87
+84
+95
+120
+142
+136
+116
+89
+56
+27
+28
+37
+46
+51
+51
+50
+52
+53
+45
+50
+51
+49
+50
+47
+50
+60
+72
+75
+80
+79
+76
+76
+80
+79
+84
+85
+82
+80
+74
+72
+74
+75
+77
+78
+83
+88
+93
+91
+83
+77
+69
+65
+60
+75
+75
+75
+75
+75
+75
+75
+75
+75
+75
+76
+76
+77
+78
+78
+76
+71
+72
+73
+76
+78
+79
+80
+79
+84
+81
+81
+78
+78
+77
+77
+78
+78
+76
+71
+66
+62
+58
+58
+58
+60
+62
+64
+64
+67
+70
+72
+75
+81
+81
+74
+82
+99
+96
+77
+67
+61
+57
+52
+48
+43
+41
+43
+43
+43
+41
+42
+43
+43
+42
+42
+41
+41
+41
+41
+41
+41
+41
+41
+44
+49
+48
+40
+34
+30
+32
+38
+45
+42
+44
+44
+45
+46
+48
+48
+52
+60
+60
+57
+56
+56
+56
+56
+53
+60
+57
+58
+58
+60
+54
+49
+40
+40
+40
+40
+40
+40
+40
+38
+38
+43
+47
+51
+55
+56
+56
+54
+55
+54
+54
+54
+52
+52
+51
+51
+51
+50
+50
+53
+55
+58
+60
+59
+61
+60
+60
+58
+53
+45
+40
+40
+42
+41
+41
+42
+40
+38
+37
+36
+37
+45
+34
+37
+58
+73
+70
+71
+78
+76
+76
+78
+78
+82
+85
+87
+87
+102
+122
+129
+106
+72
+52
+38
+25
+38
+42
+46
+51
+52
+52
+51
+48
+45
+49
+50
+48
+49
+46
+49
+60
+73
+76
+81
+80
+77
+78
+82
+81
+83
+83
+81
+77
+75
+73
+76
+79
+81
+83
+89
+94
+95
+86
+74
+67
+73
+69
+65
+77
+77
+77
+77
+77
+77
+77
+77
+77
+78
+78
+78
+79
+79
+80
+78
+74
+73
+76
+77
+79
+79
+80
+80
+80
+78
+77
+75
+75
+73
+74
+75
+77
+74
+72
+66
+61
+57
+55
+54
+56
+57
+59
+61
+63
+65
+69
+69
+76
+73
+69
+78
+97
+97
+85
+82
+67
+62
+55
+48
+46
+43
+42
+40
+42
+40
+41
+42
+42
+42
+42
+41
+41
+41
+41
+41
+41
+41
+41
+44
+49
+47
+41
+36
+31
+29
+34
+42
+46
+47
+44
+42
+40
+43
+48
+56
+58
+60
+61
+62
+62
+62
+61
+60
+56
+58
+62
+62
+62
+54
+47
+39
+43
+42
+42
+42
+41
+40
+39
+37
+37
+41
+48
+51
+53
+55
+56
+55
+55
+53
+53
+53
+52
+52
+52
+52
+53
+55
+58
+59
+62
+63
+61
+63
+58
+56
+51
+45
+40
+39
+40
+42
+40
+41
+40
+38
+39
+37
+36
+37
+41
+33
+42
+65
+78
+71
+69
+74
+78
+77
+77
+77
+81
+84
+87
+87
+88
+94
+90
+66
+44
+37
+42
+46
+50
+49
+50
+54
+57
+54
+48
+43
+43
+49
+49
+47
+48
+45
+48
+59
+73
+76
+81
+81
+78
+78
+83
+82
+81
+80
+79
+75
+74
+76
+79
+82
+88
+90
+93
+93
+87
+79
+69
+66
+77
+71
+66
+79
+79
+79
+79
+79
+79
+79
+79
+79
+79
+79
+80
+80
+80
+80
+79
+80
+79
+79
+79
+79
+79
+78
+78
+78
+75
+75
+73
+73
+71
+71
+71
+76
+75
+73
+68
+63
+58
+56
+54
+54
+54
+57
+58
+59
+60
+63
+63
+67
+70
+67
+68
+77
+76
+76
+89
+74
+66
+57
+50
+49
+45
+42
+36
+41
+40
+41
+42
+42
+42
+42
+42
+41
+41
+41
+41
+41
+41
+41
+44
+48
+47
+44
+41
+32
+27
+32
+41
+45
+47
+47
+43
+37
+39
+46
+56
+57
+62
+65
+67
+69
+67
+65
+63
+50
+54
+60
+59
+57
+49
+46
+41
+45
+43
+43
+44
+43
+40
+39
+39
+37
+39
+43
+46
+48
+52
+57
+59
+55
+53
+53
+52
+52
+52
+52
+52
+55
+57
+60
+59
+61
+60
+59
+57
+51
+47
+43
+40
+39
+41
+41
+40
+41
+42
+41
+39
+40
+38
+37
+36
+35
+37
+50
+69
+75
+67
+68
+76
+77
+78
+81
+81
+84
+85
+86
+85
+69
+61
+52
+44
+42
+44
+51
+54
+54
+56
+59
+61
+60
+54
+47
+42
+42
+48
+49
+47
+48
+44
+48
+58
+72
+76
+81
+81
+78
+79
+83
+80
+79
+78
+77
+76
+75
+78
+84
+88
+96
+97
+93
+85
+76
+71
+69
+73
+79
+73
+66
+80
+80
+80
+80
+80
+80
+80
+80
+79
+80
+80
+80
+80
+80
+81
+81
+85
+84
+82
+81
+80
+79
+77
+77
+78
+76
+76
+76
+73
+73
+71
+73
+75
+76
+75
+72
+68
+63
+60
+58
+52
+52
+55
+55
+57
+58
+58
+58
+62
+68
+65
+60
+58
+53
+62
+83
+79
+69
+58
+53
+51
+47
+41
+34
+41
+39
+40
+42
+42
+42
+42
+42
+41
+41
+41
+41
+41
+41
+41
+44
+48
+46
+44
+43
+35
+26
+30
+39
+35
+41
+48
+49
+46
+47
+53
+61
+66
+68
+69
+67
+63
+55
+48
+46
+44
+49
+54
+54
+50
+46
+44
+43
+45
+43
+44
+45
+45
+43
+42
+42
+42
+40
+40
+41
+43
+48
+57
+62
+55
+53
+53
+52
+53
+52
+53
+53
+57
+58
+59
+57
+58
+54
+53
+51
+45
+40
+39
+39
+41
+42
+41
+38
+42
+43
+42
+41
+39
+37
+38
+38
+35
+42
+56
+67
+66
+61
+69
+83
+76
+78
+82
+84
+86
+86
+84
+81
+59
+40
+30
+38
+50
+52
+50
+46
+49
+54
+60
+63
+59
+49
+42
+38
+40
+48
+48
+46
+48
+44
+47
+58
+72
+75
+81
+80
+78
+79
+83
+80
+77
+76
+76
+75
+76
+79
+86
+92
+101
+100
+92
+80
+69
+65
+72
+80
+81
+74
+67
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+83
+87
+87
+87
+87
+86
+86
+84
+82
+82
+80
+80
+79
+79
+79
+77
+77
+74
+74
+73
+73
+73
+67
+61
+58
+55
+55
+54
+53
+55
+56
+56
+55
+61
+61
+52
+54
+59
+47
+57
+93
+96
+83
+69
+64
+61
+53
+48
+45
+37
+38
+39
+40
+40
+41
+44
+46
+45
+45
+45
+45
+44
+44
+44
+45
+40
+46
+47
+41
+34
+31
+30
+34
+45
+43
+41
+42
+47
+55
+63
+69
+69
+72
+67
+54
+49
+48
+46
+43
+47
+46
+46
+45
+44
+43
+43
+43
+43
+42
+43
+44
+45
+44
+45
+45
+42
+40
+40
+41
+43
+45
+51
+52
+54
+54
+56
+55
+57
+54
+54
+53
+61
+59
+56
+50
+47
+45
+42
+43
+45
+42
+43
+42
+41
+41
+43
+43
+39
+40
+40
+40
+40
+39
+38
+36
+32
+52
+67
+65
+64
+69
+74
+71
+82
+82
+77
+76
+85
+83
+84
+90
+53
+42
+40
+44
+47
+43
+45
+49
+49
+67
+80
+74
+58
+46
+39
+37
+41
+49
+50
+50
+49
+42
+46
+60
+74
+77
+81
+79
+76
+77
+83
+81
+76
+75
+78
+78
+80
+85
+92
+98
+102
+94
+79
+71
+69
+74
+80
+84
+83
+76
+69
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+83
+89
+91
+91
+89
+89
+87
+86
+84
+84
+82
+82
+82
+82
+82
+80
+80
+77
+75
+74
+74
+74
+69
+63
+58
+58
+55
+54
+53
+55
+55
+55
+54
+56
+53
+49
+53
+48
+39
+58
+98
+88
+90
+84
+71
+62
+61
+57
+48
+43
+44
+46
+45
+45
+43
+43
+42
+44
+43
+44
+43
+44
+43
+44
+46
+53
+58
+55
+47
+35
+29
+29
+29
+35
+40
+47
+56
+63
+68
+70
+72
+65
+68
+62
+51
+47
+48
+49
+48
+49
+50
+48
+47
+47
+46
+46
+44
+42
+42
+43
+44
+43
+43
+44
+44
+46
+45
+44
+44
+43
+45
+48
+47
+50
+50
+53
+55
+57
+57
+57
+56
+54
+52
+51
+48
+47
+46
+44
+44
+46
+44
+44
+43
+42
+42
+42
+44
+42
+41
+41
+41
+40
+39
+39
+36
+39
+55
+67
+63
+62
+68
+73
+71
+74
+79
+79
+80
+88
+82
+79
+84
+53
+57
+66
+66
+54
+41
+42
+52
+71
+81
+84
+70
+55
+42
+35
+34
+40
+48
+49
+49
+50
+43
+46
+60
+75
+77
+81
+80
+76
+78
+83
+81
+79
+76
+76
+77
+81
+87
+95
+99
+97
+85
+74
+68
+74
+78
+78
+79
+83
+76
+69
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+81
+85
+91
+94
+94
+93
+89
+87
+86
+84
+84
+84
+84
+84
+84
+84
+86
+84
+79
+76
+78
+78
+76
+72
+67
+62
+60
+57
+56
+54
+54
+54
+54
+53
+53
+45
+49
+51
+37
+39
+67
+96
+74
+90
+98
+83
+72
+72
+68
+54
+43
+42
+44
+42
+44
+41
+41
+39
+43
+41
+43
+41
+43
+42
+44
+46
+45
+47
+45
+40
+34
+30
+32
+36
+50
+55
+63
+70
+71
+70
+66
+64
+65
+65
+58
+49
+47
+49
+52
+51
+51
+52
+50
+48
+48
+47
+46
+46
+42
+43
+41
+42
+43
+43
+42
+42
+46
+45
+43
+42
+43
+45
+46
+47
+46
+48
+48
+51
+51
+52
+51
+52
+44
+44
+45
+43
+43
+44
+46
+47
+47
+44
+45
+44
+43
+43
+43
+44
+43
+42
+44
+42
+41
+40
+41
+38
+49
+60
+66
+61
+60
+66
+72
+73
+73
+79
+81
+83
+90
+85
+84
+91
+88
+94
+97
+82
+52
+35
+46
+64
+89
+87
+77
+62
+48
+40
+35
+36
+39
+46
+47
+49
+51
+44
+47
+60
+75
+78
+82
+80
+77
+78
+83
+80
+81
+76
+76
+79
+86
+92
+96
+96
+85
+77
+69
+69
+77
+81
+78
+72
+82
+76
+69
+81
+81
+81
+81
+81
+81
+81
+81
+82
+82
+82
+82
+82
+82
+82
+86
+92
+95
+94
+92
+90
+88
+87
+85
+85
+85
+85
+85
+87
+87
+88
+87
+82
+80
+79
+79
+78
+75
+71
+69
+62
+60
+58
+56
+55
+54
+53
+51
+52
+45
+51
+48
+37
+57
+79
+78
+53
+76
+95
+94
+85
+79
+72
+65
+49
+45
+43
+43
+45
+47
+48
+48
+52
+52
+52
+52
+53
+53
+53
+55
+59
+62
+62
+61
+60
+62
+64
+68
+72
+71
+71
+69
+66
+63
+61
+61
+66
+63
+55
+48
+46
+48
+51
+54
+52
+51
+51
+49
+48
+46
+46
+45
+44
+44
+43
+44
+44
+45
+43
+43
+43
+41
+41
+42
+44
+47
+47
+48
+47
+46
+47
+46
+46
+44
+43
+42
+41
+40
+41
+42
+43
+45
+47
+48
+46
+45
+44
+42
+42
+42
+42
+43
+44
+44
+44
+42
+42
+40
+41
+41
+56
+61
+63
+58
+60
+68
+75
+76
+76
+80
+79
+79
+88
+88
+94
+106
+112
+102
+87
+63
+43
+42
+60
+81
+85
+75
+61
+49
+43
+41
+40
+39
+40
+45
+46
+49
+51
+45
+47
+59
+73
+77
+82
+81
+78
+79
+83
+80
+79
+77
+77
+82
+93
+97
+94
+91
+74
+69
+68
+72
+79
+80
+76
+72
+81
+75
+68
+81
+81
+81
+81
+81
+81
+81
+81
+82
+82
+82
+82
+82
+82
+82
+84
+90
+92
+90
+88
+87
+85
+83
+83
+83
+83
+83
+85
+87
+87
+88
+87
+85
+82
+81
+81
+81
+79
+77
+74
+66
+62
+60
+56
+54
+53
+51
+49
+49
+47
+49
+43
+45
+76
+83
+52
+43
+57
+85
+103
+101
+85
+78
+80
+65
+60
+54
+52
+54
+58
+61
+62
+65
+65
+66
+66
+67
+67
+68
+69
+82
+84
+82
+79
+76
+76
+76
+78
+72
+70
+66
+64
+64
+64
+66
+68
+70
+64
+55
+50
+50
+49
+51
+52
+51
+51
+51
+48
+49
+48
+47
+47
+46
+46
+46
+46
+45
+45
+45
+45
+42
+42
+43
+42
+43
+45
+46
+47
+47
+45
+45
+44
+44
+43
+42
+42
+41
+41
+40
+41
+42
+44
+45
+45
+45
+44
+43
+42
+41
+43
+43
+43
+44
+45
+45
+43
+42
+41
+43
+43
+59
+60
+61
+59
+63
+70
+77
+79
+77
+81
+80
+81
+89
+87
+91
+100
+81
+64
+48
+40
+48
+63
+78
+86
+69
+58
+46
+41
+44
+45
+45
+44
+43
+45
+45
+48
+52
+45
+46
+56
+70
+74
+80
+80
+78
+79
+84
+81
+77
+76
+80
+89
+97
+96
+88
+81
+65
+69
+73
+77
+77
+75
+74
+76
+80
+73
+66
+81
+81
+81
+81
+81
+81
+81
+81
+83
+83
+83
+83
+83
+83
+83
+85
+89
+89
+89
+86
+86
+82
+82
+81
+81
+81
+82
+84
+86
+88
+88
+88
+85
+82
+81
+82
+82
+81
+80
+77
+71
+67
+63
+59
+57
+54
+51
+47
+46
+45
+45
+45
+58
+82
+74
+43
+57
+59
+82
+110
+118
+104
+94
+95
+81
+70
+64
+58
+61
+62
+65
+63
+67
+66
+68
+67
+70
+68
+71
+71
+72
+73
+72
+71
+68
+68
+66
+66
+65
+66
+65
+66
+66
+64
+62
+63
+71
+63
+54
+51
+51
+48
+48
+51
+50
+49
+49
+49
+48
+49
+49
+49
+49
+49
+51
+49
+49
+47
+49
+47
+47
+45
+45
+44
+44
+42
+43
+41
+46
+46
+45
+47
+46
+46
+47
+46
+41
+40
+42
+43
+44
+43
+44
+43
+44
+43
+41
+40
+41
+41
+41
+41
+42
+44
+44
+42
+41
+41
+45
+48
+64
+60
+60
+61
+67
+72
+77
+78
+73
+79
+82
+85
+92
+80
+70
+71
+45
+41
+40
+50
+69
+81
+75
+64
+55
+45
+38
+42
+49
+52
+48
+45
+44
+45
+45
+48
+52
+45
+44
+53
+66
+70
+78
+79
+77
+79
+84
+81
+76
+79
+85
+92
+96
+91
+81
+72
+66
+71
+77
+77
+74
+71
+71
+76
+78
+72
+65
+81
+81
+81
+81
+81
+81
+81
+81
+83
+83
+83
+83
+83
+83
+83
+83
+88
+86
+86
+82
+82
+79
+79
+77
+77
+77
+79
+81
+82
+84
+86
+86
+85
+83
+83
+84
+85
+84
+81
+79
+75
+71
+65
+60
+57
+54
+51
+46
+43
+42
+43
+57
+76
+72
+60
+57
+69
+64
+73
+96
+112
+112
+101
+92
+78
+68
+63
+59
+63
+62
+62
+57
+63
+61
+64
+63
+65
+64
+67
+67
+68
+68
+70
+72
+72
+73
+73
+72
+67
+68
+69
+69
+65
+62
+58
+58
+70
+60
+51
+50
+52
+49
+48
+49
+47
+48
+49
+48
+49
+51
+52
+52
+51
+51
+52
+51
+51
+49
+51
+48
+48
+46
+46
+45
+44
+41
+42
+42
+46
+46
+45
+46
+46
+46
+46
+45
+41
+41
+42
+42
+43
+42
+43
+42
+42
+44
+42
+41
+40
+40
+42
+42
+41
+44
+45
+43
+41
+42
+47
+51
+66
+63
+61
+64
+70
+73
+74
+73
+73
+78
+79
+86
+90
+74
+55
+49
+48
+57
+67
+74
+79
+76
+62
+47
+45
+36
+33
+42
+53
+57
+54
+51
+46
+46
+45
+49
+53
+45
+42
+50
+61
+66
+75
+77
+77
+79
+85
+82
+80
+81
+87
+90
+89
+82
+74
+69
+72
+73
+75
+75
+74
+72
+70
+73
+77
+71
+64
+81
+81
+81
+81
+81
+81
+81
+81
+83
+83
+83
+83
+83
+83
+83
+83
+86
+84
+84
+82
+81
+79
+79
+77
+77
+79
+79
+81
+82
+84
+84
+84
+84
+83
+83
+83
+85
+84
+82
+80
+77
+73
+67
+62
+56
+53
+49
+46
+42
+40
+44
+71
+88
+65
+51
+78
+69
+62
+60
+71
+91
+102
+91
+72
+71
+66
+63
+62
+66
+66
+62
+55
+61
+61
+64
+65
+66
+67
+69
+70
+67
+68
+69
+69
+71
+70
+67
+63
+68
+67
+65
+62
+62
+63
+64
+67
+66
+56
+48
+52
+54
+51
+47
+50
+47
+48
+48
+49
+51
+51
+52
+53
+50
+50
+50
+50
+48
+48
+48
+48
+44
+45
+46
+46
+45
+45
+44
+44
+47
+47
+46
+44
+42
+42
+42
+40
+42
+42
+43
+45
+45
+44
+44
+43
+44
+45
+44
+42
+42
+41
+41
+44
+40
+43
+45
+43
+41
+42
+48
+54
+71
+66
+64
+68
+73
+74
+71
+71
+78
+78
+75
+77
+83
+68
+50
+44
+57
+73
+84
+81
+69
+61
+56
+52
+38
+30
+29
+41
+53
+56
+55
+53
+50
+48
+46
+49
+53
+45
+41
+49
+59
+67
+77
+78
+78
+81
+83
+82
+85
+88
+91
+90
+85
+78
+72
+68
+78
+75
+72
+73
+74
+75
+69
+69
+77
+71
+64
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+81
+81
+81
+81
+82
+82
+82
+82
+84
+84
+84
+84
+80
+81
+87
+87
+86
+84
+83
+84
+83
+81
+77
+67
+61
+56
+50
+41
+44
+36
+51
+87
+109
+101
+87
+79
+69
+69
+71
+72
+75
+75
+77
+77
+69
+69
+68
+69
+66
+61
+60
+60
+56
+57
+60
+63
+64
+67
+68
+67
+70
+68
+68
+69
+69
+68
+68
+68
+67
+64
+63
+62
+62
+61
+61
+63
+63
+58
+51
+48
+48
+50
+51
+50
+50
+51
+50
+51
+51
+51
+49
+50
+48
+46
+46
+45
+47
+46
+46
+46
+45
+45
+45
+45
+47
+47
+47
+47
+48
+48
+48
+46
+46
+46
+46
+44
+44
+44
+44
+45
+45
+44
+44
+44
+46
+46
+45
+45
+44
+43
+42
+43
+39
+44
+41
+40
+43
+41
+45
+61
+72
+74
+71
+72
+72
+74
+75
+76
+77
+75
+78
+81
+72
+58
+55
+59
+89
+81
+72
+67
+64
+59
+53
+49
+38
+35
+35
+39
+48
+53
+54
+51
+45
+45
+46
+47
+47
+46
+44
+40
+59
+70
+82
+85
+81
+83
+83
+85
+90
+101
+101
+89
+75
+71
+72
+71
+73
+75
+77
+78
+77
+75
+72
+71
+76
+68
+59
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+84
+84
+84
+84
+84
+84
+83
+82
+85
+86
+90
+90
+88
+86
+87
+89
+89
+84
+79
+72
+61
+52
+48
+37
+41
+61
+71
+66
+61
+63
+86
+84
+81
+79
+77
+77
+74
+74
+84
+71
+62
+58
+64
+65
+59
+52
+57
+57
+61
+62
+66
+68
+69
+69
+70
+68
+68
+69
+67
+68
+68
+68
+65
+64
+63
+62
+61
+61
+61
+63
+63
+60
+54
+48
+48
+47
+48
+48
+50
+51
+52
+51
+51
+49
+49
+48
+46
+45
+44
+44
+45
+44
+44
+44
+45
+45
+45
+45
+47
+47
+47
+47
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+47
+47
+47
+46
+46
+47
+47
+46
+45
+44
+44
+43
+43
+38
+44
+41
+40
+43
+40
+44
+62
+73
+76
+74
+74
+76
+77
+78
+79
+71
+72
+75
+80
+80
+76
+81
+84
+77
+71
+63
+58
+58
+58
+55
+52
+45
+41
+39
+41
+47
+50
+50
+48
+48
+48
+49
+48
+47
+46
+44
+42
+57
+68
+82
+82
+83
+82
+83
+86
+94
+101
+97
+84
+73
+70
+70
+69
+73
+74
+76
+78
+77
+75
+73
+73
+76
+66
+57
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+84
+84
+84
+84
+84
+84
+84
+80
+80
+82
+89
+92
+89
+86
+87
+96
+105
+106
+105
+98
+86
+74
+60
+46
+40
+46
+47
+40
+42
+51
+48
+49
+53
+58
+66
+74
+80
+82
+89
+78
+69
+63
+66
+67
+64
+58
+59
+60
+62
+64
+67
+70
+70
+70
+68
+68
+68
+68
+69
+69
+67
+67
+66
+66
+63
+62
+61
+61
+61
+62
+64
+63
+60
+53
+49
+45
+44
+45
+50
+49
+50
+49
+49
+49
+49
+48
+46
+44
+44
+44
+44
+44
+46
+46
+45
+45
+47
+47
+47
+47
+47
+47
+48
+48
+48
+48
+48
+47
+47
+47
+49
+49
+48
+48
+47
+47
+47
+47
+46
+46
+45
+45
+44
+43
+42
+42
+38
+43
+41
+39
+42
+39
+43
+61
+73
+73
+74
+76
+77
+78
+80
+80
+79
+80
+79
+78
+81
+85
+89
+85
+66
+58
+54
+51
+54
+57
+56
+56
+48
+45
+42
+42
+46
+48
+47
+46
+50
+50
+50
+48
+47
+48
+45
+41
+53
+64
+77
+78
+81
+82
+85
+87
+96
+96
+87
+76
+69
+69
+69
+67
+72
+74
+75
+77
+76
+74
+72
+72
+74
+66
+56
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+84
+84
+84
+84
+84
+84
+87
+84
+82
+83
+87
+90
+91
+93
+93
+105
+120
+129
+129
+126
+114
+103
+78
+62
+50
+49
+48
+44
+44
+52
+43
+42
+42
+41
+43
+47
+49
+49
+66
+74
+79
+75
+68
+66
+67
+70
+62
+63
+62
+64
+67
+68
+68
+68
+68
+68
+68
+68
+68
+68
+66
+67
+66
+65
+62
+62
+60
+60
+61
+62
+60
+63
+62
+56
+49
+44
+43
+45
+48
+49
+48
+47
+49
+47
+47
+46
+45
+44
+44
+43
+44
+44
+45
+45
+45
+45
+47
+47
+47
+47
+47
+47
+48
+48
+48
+47
+47
+47
+47
+46
+49
+48
+48
+48
+47
+47
+47
+47
+45
+45
+45
+44
+43
+42
+42
+41
+38
+43
+40
+38
+41
+38
+42
+60
+71
+74
+75
+77
+78
+80
+80
+81
+82
+85
+80
+71
+73
+79
+75
+64
+56
+52
+48
+46
+51
+55
+58
+59
+52
+50
+47
+44
+46
+46
+45
+45
+51
+53
+52
+50
+49
+47
+44
+42
+52
+62
+73
+76
+81
+84
+87
+90
+97
+91
+78
+69
+67
+69
+69
+67
+72
+73
+74
+75
+74
+73
+71
+74
+74
+64
+55
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+84
+84
+84
+84
+84
+84
+88
+92
+91
+89
+88
+93
+104
+112
+119
+134
+148
+156
+156
+153
+145
+135
+107
+83
+63
+55
+53
+50
+50
+53
+60
+57
+53
+48
+44
+43
+42
+40
+42
+56
+72
+75
+71
+73
+73
+69
+66
+66
+65
+66
+65
+65
+65
+65
+68
+70
+70
+70
+68
+68
+68
+67
+66
+65
+62
+61
+61
+61
+61
+62
+58
+59
+61
+57
+51
+45
+46
+47
+48
+47
+46
+45
+47
+45
+45
+46
+45
+45
+44
+44
+44
+43
+45
+45
+47
+47
+47
+47
+49
+49
+49
+49
+49
+49
+49
+48
+48
+47
+47
+46
+49
+49
+48
+48
+48
+47
+47
+47
+47
+46
+46
+45
+44
+43
+43
+43
+40
+45
+42
+40
+42
+39
+43
+59
+71
+72
+74
+76
+79
+80
+82
+81
+77
+79
+74
+66
+68
+72
+65
+51
+47
+46
+43
+43
+46
+51
+55
+57
+54
+53
+50
+47
+47
+46
+44
+44
+52
+53
+53
+52
+48
+47
+45
+41
+49
+58
+71
+75
+82
+86
+89
+91
+96
+87
+73
+67
+68
+71
+71
+70
+73
+74
+75
+75
+74
+73
+72
+73
+73
+66
+56
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+84
+84
+84
+84
+84
+84
+85
+90
+92
+90
+92
+103
+124
+140
+160
+174
+188
+193
+190
+186
+177
+168
+143
+114
+84
+63
+56
+51
+49
+50
+51
+51
+50
+51
+52
+56
+58
+57
+40
+47
+54
+65
+79
+91
+86
+73
+74
+70
+70
+68
+66
+66
+63
+65
+68
+70
+70
+70
+67
+67
+67
+67
+65
+65
+64
+61
+60
+60
+61
+61
+56
+57
+58
+57
+55
+48
+47
+46
+47
+47
+46
+45
+45
+45
+45
+46
+44
+44
+44
+44
+43
+43
+45
+44
+47
+47
+47
+47
+49
+49
+49
+49
+49
+49
+48
+48
+47
+46
+46
+46
+47
+47
+47
+46
+46
+46
+45
+45
+46
+46
+45
+44
+43
+43
+42
+42
+40
+44
+41
+39
+41
+38
+42
+57
+71
+72
+74
+76
+79
+78
+79
+81
+78
+76
+70
+66
+66
+63
+54
+44
+43
+42
+40
+40
+42
+45
+49
+52
+55
+53
+52
+50
+50
+47
+45
+44
+51
+53
+53
+50
+49
+46
+45
+42
+47
+55
+68
+77
+83
+89
+89
+89
+89
+79
+67
+65
+69
+70
+70
+71
+73
+73
+73
+73
+73
+72
+71
+74
+73
+64
+57
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+84
+84
+84
+84
+84
+86
+86
+88
+90
+94
+106
+128
+154
+174
+192
+208
+223
+228
+224
+218
+211
+200
+178
+151
+122
+93
+73
+58
+49
+47
+54
+55
+53
+52
+53
+51
+51
+48
+51
+50
+49
+52
+72
+95
+100
+90
+83
+79
+75
+74
+71
+68
+65
+66
+68
+70
+70
+69
+69
+68
+66
+66
+67
+64
+63
+63
+60
+60
+61
+61
+58
+58
+58
+58
+58
+52
+47
+43
+47
+46
+45
+44
+44
+44
+44
+45
+44
+44
+44
+43
+45
+45
+46
+46
+47
+47
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+47
+46
+45
+45
+46
+46
+45
+45
+45
+44
+44
+44
+45
+45
+44
+44
+43
+42
+41
+41
+39
+44
+41
+38
+41
+37
+41
+56
+71
+72
+74
+76
+78
+79
+79
+78
+78
+71
+65
+61
+58
+49
+43
+41
+43
+45
+44
+43
+41
+43
+43
+45
+52
+53
+55
+55
+53
+49
+44
+45
+48
+50
+50
+49
+50
+48
+46
+41
+43
+53
+67
+76
+86
+91
+89
+86
+80
+73
+64
+66
+70
+70
+70
+72
+74
+74
+74
+74
+73
+73
+72
+74
+73
+64
+55
+81
+81
+81
+82
+82
+83
+83
+83
+82
+82
+82
+82
+82
+82
+82
+82
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+84
+84
+84
+84
+84
+86
+94
+95
+97
+106
+127
+156
+186
+207
+207
+224
+242
+249
+246
+240
+233
+223
+198
+181
+157
+129
+98
+71
+55
+50
+50
+52
+53
+55
+55
+57
+55
+54
+53
+55
+49
+43
+54
+82
+105
+109
+92
+87
+83
+78
+75
+72
+68
+67
+70
+70
+70
+69
+69
+68
+66
+66
+67
+66
+63
+62
+62
+60
+60
+61
+61
+57
+58
+59
+58
+54
+45
+38
+47
+46
+45
+44
+44
+44
+42
+45
+44
+44
+44
+43
+45
+44
+46
+46
+47
+47
+49
+49
+49
+49
+49
+49
+49
+49
+48
+47
+46
+46
+45
+44
+45
+45
+44
+44
+44
+43
+43
+43
+45
+45
+44
+43
+42
+42
+41
+41
+39
+44
+41
+38
+40
+37
+40
+56
+71
+73
+74
+77
+79
+79
+77
+76
+68
+58
+52
+54
+50
+43
+42
+50
+48
+49
+50
+48
+46
+44
+45
+44
+51
+53
+57
+57
+55
+51
+44
+45
+46
+48
+49
+48
+49
+47
+46
+43
+42
+52
+65
+77
+86
+92
+88
+85
+73
+67
+62
+66
+70
+68
+68
+71
+74
+74
+73
+73
+73
+72
+72
+76
+73
+65
+55
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+87
+90
+93
+110
+142
+173
+197
+219
+239
+246
+249
+254
+255
+253
+250
+244
+236
+212
+199
+181
+159
+135
+105
+70
+45
+47
+48
+49
+53
+51
+48
+50
+57
+57
+58
+55
+53
+70
+106
+146
+169
+136
+112
+90
+81
+79
+76
+73
+72
+71
+75
+70
+62
+64
+74
+73
+64
+64
+64
+64
+62
+62
+60
+59
+57
+62
+57
+57
+57
+56
+53
+46
+42
+48
+47
+46
+45
+44
+43
+42
+44
+43
+45
+45
+44
+46
+45
+45
+45
+48
+48
+48
+48
+49
+49
+49
+49
+53
+52
+51
+50
+49
+47
+46
+46
+45
+45
+45
+45
+45
+45
+45
+45
+43
+47
+50
+49
+45
+42
+42
+43
+40
+46
+41
+35
+38
+37
+40
+54
+74
+75
+74
+74
+77
+81
+73
+62
+53
+53
+50
+48
+47
+48
+48
+48
+51
+51
+52
+49
+48
+47
+46
+43
+43
+45
+50
+54
+54
+52
+46
+46
+43
+46
+46
+45
+47
+46
+47
+43
+38
+49
+67
+82
+93
+95
+87
+82
+68
+68
+64
+64
+67
+70
+71
+70
+74
+78
+78
+74
+72
+75
+76
+77
+75
+66
+55
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+89
+93
+106
+131
+162
+194
+219
+239
+252
+254
+255
+255
+254
+253
+250
+249
+243
+224
+212
+197
+178
+157
+132
+99
+75
+51
+47
+46
+47
+50
+51
+53
+57
+55
+63
+69
+80
+103
+139
+174
+191
+207
+168
+123
+93
+85
+83
+77
+69
+70
+69
+72
+75
+70
+63
+63
+69
+63
+63
+64
+64
+62
+61
+60
+57
+60
+59
+57
+58
+59
+54
+49
+45
+48
+47
+46
+45
+44
+43
+44
+44
+43
+45
+45
+44
+46
+45
+45
+45
+48
+48
+48
+48
+49
+50
+50
+50
+52
+51
+50
+49
+48
+46
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+46
+48
+49
+49
+47
+44
+42
+42
+40
+42
+37
+36
+40
+36
+38
+53
+69
+76
+82
+79
+75
+68
+58
+47
+49
+48
+48
+48
+49
+49
+49
+51
+52
+53
+53
+50
+49
+47
+46
+44
+43
+46
+48
+52
+53
+52
+50
+49
+47
+46
+45
+43
+43
+43
+45
+44
+40
+51
+69
+85
+96
+98
+89
+80
+68
+67
+64
+64
+66
+69
+69
+69
+71
+75
+75
+72
+71
+74
+74
+77
+74
+66
+55
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+85
+85
+85
+85
+85
+85
+85
+85
+86
+86
+90
+95
+120
+152
+183
+210
+236
+252
+255
+255
+255
+255
+254
+252
+251
+250
+244
+231
+221
+209
+196
+180
+159
+131
+108
+69
+55
+44
+46
+52
+55
+56
+58
+57
+75
+95
+118
+144
+175
+200
+211
+217
+229
+214
+159
+97
+68
+75
+89
+85
+76
+66
+66
+69
+70
+68
+68
+63
+64
+63
+63
+64
+63
+61
+58
+58
+58
+58
+60
+60
+55
+50
+46
+48
+48
+47
+46
+45
+44
+45
+45
+45
+45
+47
+46
+46
+45
+47
+47
+49
+49
+50
+50
+50
+50
+52
+52
+50
+49
+48
+47
+46
+45
+44
+44
+45
+45
+45
+45
+45
+45
+45
+45
+49
+48
+48
+48
+48
+46
+43
+40
+41
+39
+35
+38
+42
+35
+38
+60
+74
+80
+81
+73
+63
+55
+45
+40
+42
+43
+46
+47
+49
+49
+49
+51
+52
+54
+51
+50
+50
+48
+47
+45
+43
+45
+46
+50
+52
+52
+52
+53
+51
+50
+45
+40
+40
+40
+42
+41
+39
+53
+74
+90
+102
+102
+90
+75
+67
+67
+64
+64
+66
+68
+69
+69
+70
+73
+75
+73
+73
+75
+74
+75
+72
+64
+53
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+85
+85
+85
+85
+85
+85
+86
+86
+86
+86
+91
+102
+136
+168
+193
+216
+239
+253
+255
+255
+255
+255
+251
+249
+248
+247
+243
+230
+222
+216
+206
+195
+180
+153
+134
+101
+76
+54
+48
+53
+58
+57
+55
+68
+95
+128
+153
+172
+194
+212
+221
+229
+239
+235
+207
+172
+140
+100
+66
+76
+78
+73
+65
+66
+74
+71
+62
+62
+63
+62
+63
+63
+63
+61
+61
+57
+58
+61
+63
+62
+57
+53
+50
+49
+48
+47
+46
+47
+44
+45
+45
+45
+45
+47
+46
+46
+45
+47
+47
+50
+50
+51
+50
+50
+50
+52
+52
+48
+47
+47
+46
+45
+44
+43
+43
+44
+44
+44
+44
+44
+44
+44
+44
+50
+47
+45
+46
+47
+47
+43
+39
+43
+40
+36
+40
+41
+32
+40
+69
+86
+82
+71
+58
+51
+46
+45
+46
+41
+42
+46
+47
+50
+49
+48
+48
+52
+51
+51
+50
+49
+47
+46
+46
+43
+44
+44
+46
+49
+52
+54
+56
+56
+52
+46
+39
+37
+36
+38
+39
+39
+56
+80
+100
+110
+105
+88
+69
+65
+64
+63
+63
+64
+65
+66
+66
+67
+71
+73
+72
+74
+75
+72
+73
+68
+60
+48
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+85
+85
+85
+85
+85
+85
+86
+86
+87
+87
+93
+111
+143
+172
+194
+216
+239
+254
+255
+255
+255
+252
+250
+245
+241
+237
+234
+232
+228
+225
+217
+210
+197
+173
+153
+129
+98
+66
+53
+55
+57
+57
+56
+88
+122
+159
+181
+193
+205
+221
+233
+239
+233
+226
+227
+234
+219
+162
+99
+64
+68
+78
+82
+73
+61
+59
+64
+61
+62
+63
+64
+63
+63
+63
+61
+59
+60
+64
+64
+62
+57
+53
+51
+49
+50
+49
+48
+49
+46
+47
+47
+47
+47
+47
+46
+48
+47
+47
+47
+51
+51
+51
+50
+52
+51
+51
+51
+48
+48
+47
+47
+46
+45
+45
+45
+46
+46
+46
+46
+46
+46
+46
+46
+50
+47
+45
+46
+48
+48
+45
+42
+43
+43
+40
+40
+40
+33
+45
+76
+82
+72
+56
+46
+44
+45
+46
+49
+45
+46
+47
+48
+48
+47
+45
+46
+48
+50
+49
+47
+47
+47
+46
+44
+43
+43
+44
+45
+46
+50
+53
+55
+56
+53
+47
+40
+37
+36
+37
+36
+37
+59
+87
+107
+114
+103
+81
+61
+62
+62
+62
+62
+62
+62
+64
+64
+68
+72
+74
+74
+76
+76
+71
+69
+63
+57
+46
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+85
+85
+85
+85
+85
+86
+86
+87
+88
+88
+93
+109
+133
+160
+183
+208
+232
+249
+255
+253
+252
+250
+249
+243
+237
+232
+227
+234
+232
+229
+223
+219
+205
+185
+165
+146
+114
+79
+59
+58
+61
+66
+71
+115
+148
+184
+204
+211
+219
+233
+244
+235
+244
+246
+241
+234
+229
+218
+199
+127
+81
+58
+70
+74
+60
+55
+68
+62
+63
+63
+64
+62
+62
+62
+61
+60
+63
+65
+63
+61
+56
+53
+52
+51
+50
+51
+50
+49
+48
+49
+47
+47
+47
+47
+46
+48
+47
+47
+47
+51
+50
+50
+49
+51
+50
+49
+49
+48
+47
+47
+47
+46
+46
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+48
+47
+46
+46
+47
+48
+47
+46
+42
+46
+41
+39
+43
+44
+52
+74
+64
+54
+47
+44
+47
+47
+44
+43
+46
+47
+47
+46
+46
+45
+44
+43
+44
+44
+46
+44
+46
+44
+44
+44
+43
+43
+43
+44
+43
+46
+49
+50
+53
+50
+47
+45
+41
+39
+37
+37
+37
+62
+92
+109
+108
+95
+75
+57
+60
+59
+61
+61
+59
+59
+60
+62
+67
+71
+74
+75
+76
+76
+67
+66
+56
+51
+42
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+84
+84
+85
+85
+85
+85
+85
+86
+86
+87
+88
+89
+94
+107
+122
+148
+177
+205
+226
+242
+252
+251
+249
+247
+246
+242
+236
+231
+231
+234
+235
+232
+230
+226
+214
+195
+175
+154
+125
+91
+70
+67
+75
+90
+100
+141
+168
+198
+217
+227
+235
+244
+249
+251
+248
+243
+237
+237
+240
+241
+234
+203
+144
+89
+68
+69
+70
+65
+65
+63
+63
+64
+64
+62
+61
+60
+60
+63
+64
+65
+61
+57
+53
+53
+54
+51
+52
+53
+52
+51
+48
+49
+49
+47
+47
+47
+46
+48
+47
+47
+47
+50
+50
+51
+50
+49
+48
+48
+47
+48
+47
+47
+47
+47
+46
+46
+46
+45
+45
+45
+45
+45
+45
+45
+45
+47
+48
+49
+49
+48
+49
+51
+53
+48
+52
+45
+44
+58
+67
+64
+68
+48
+46
+47
+49
+50
+46
+43
+44
+45
+45
+44
+43
+43
+43
+41
+41
+40
+41
+43
+41
+43
+41
+41
+41
+42
+41
+43
+42
+43
+44
+46
+45
+49
+48
+48
+49
+46
+42
+38
+36
+39
+63
+91
+103
+98
+84
+69
+56
+59
+59
+61
+61
+59
+59
+60
+62
+68
+72
+74
+76
+77
+75
+64
+59
+52
+47
+38
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+83
+85
+86
+86
+87
+85
+85
+85
+85
+86
+87
+90
+92
+94
+101
+114
+122
+144
+179
+209
+225
+241
+254
+250
+249
+247
+244
+242
+241
+238
+240
+239
+241
+239
+237
+233
+223
+203
+183
+155
+129
+98
+78
+76
+87
+110
+125
+162
+181
+207
+226
+238
+244
+247
+245
+247
+247
+247
+249
+244
+238
+238
+239
+225
+224
+184
+113
+71
+72
+74
+59
+64
+64
+62
+62
+61
+60
+59
+59
+62
+62
+62
+59
+53
+50
+51
+54
+53
+52
+53
+52
+51
+48
+49
+49
+47
+47
+49
+48
+48
+47
+47
+47
+49
+49
+50
+49
+48
+47
+47
+46
+48
+48
+47
+47
+47
+47
+47
+46
+45
+45
+45
+45
+45
+45
+45
+45
+46
+49
+52
+51
+50
+48
+52
+56
+53
+59
+50
+50
+74
+90
+77
+65
+49
+49
+50
+53
+48
+43
+44
+51
+43
+42
+41
+40
+40
+42
+43
+44
+41
+41
+42
+42
+42
+42
+42
+42
+44
+43
+45
+44
+44
+44
+45
+43
+48
+49
+52
+52
+51
+46
+39
+36
+42
+66
+91
+97
+88
+75
+65
+58
+59
+60
+63
+63
+60
+57
+61
+61
+69
+72
+75
+76
+78
+77
+65
+59
+52
+47
+37
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+88
+89
+90
+90
+88
+86
+78
+82
+88
+93
+92
+97
+114
+134
+146
+160
+181
+202
+223
+238
+248
+249
+253
+252
+250
+246
+242
+241
+242
+243
+242
+242
+237
+235
+231
+222
+202
+182
+155
+124
+89
+77
+88
+108
+130
+144
+178
+199
+222
+235
+242
+246
+248
+247
+252
+252
+252
+250
+250
+250
+250
+250
+248
+248
+246
+223
+159
+88
+61
+66
+69
+61
+57
+59
+63
+64
+64
+61
+56
+56
+56
+56
+53
+52
+53
+53
+53
+54
+52
+51
+50
+49
+49
+49
+49
+49
+49
+48
+47
+47
+46
+45
+46
+46
+47
+47
+46
+45
+43
+43
+47
+49
+49
+48
+48
+47
+47
+47
+46
+47
+48
+49
+48
+47
+45
+44
+45
+47
+48
+48
+48
+46
+48
+51
+50
+58
+58
+79
+92
+106
+111
+61
+46
+48
+48
+47
+47
+47
+46
+46
+45
+45
+45
+44
+44
+43
+43
+43
+45
+45
+45
+45
+45
+45
+45
+45
+46
+45
+45
+44
+44
+45
+45
+46
+50
+50
+53
+55
+54
+52
+48
+45
+46
+61
+78
+81
+72
+60
+56
+54
+62
+62
+61
+61
+60
+58
+62
+63
+71
+75
+79
+80
+82
+78
+63
+54
+42
+46
+44
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+89
+90
+92
+91
+90
+86
+81
+83
+87
+91
+95
+108
+132
+154
+180
+195
+216
+233
+244
+253
+255
+255
+251
+250
+250
+249
+244
+242
+242
+243
+241
+239
+237
+233
+229
+218
+195
+175
+151
+118
+85
+73
+85
+111
+138
+156
+188
+209
+229
+241
+245
+249
+250
+249
+252
+252
+252
+252
+252
+252
+252
+254
+255
+252
+248
+247
+230
+185
+119
+70
+65
+63
+63
+61
+56
+52
+54
+58
+55
+55
+58
+55
+54
+50
+54
+55
+55
+56
+55
+53
+52
+51
+49
+51
+50
+50
+49
+49
+48
+47
+46
+46
+45
+46
+46
+46
+46
+44
+42
+43
+47
+49
+49
+48
+48
+48
+47
+47
+44
+44
+46
+47
+49
+49
+49
+50
+48
+49
+48
+49
+47
+49
+48
+50
+54
+61
+65
+83
+101
+115
+114
+60
+46
+47
+47
+47
+46
+46
+46
+45
+45
+45
+45
+44
+44
+43
+43
+43
+46
+46
+46
+46
+46
+46
+46
+46
+47
+46
+45
+45
+45
+45
+46
+47
+48
+50
+51
+54
+54
+54
+52
+49
+49
+62
+73
+73
+64
+54
+55
+58
+64
+63
+64
+62
+60
+58
+59
+60
+69
+75
+81
+84
+84
+79
+62
+53
+45
+48
+46
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+89
+90
+92
+91
+90
+86
+85
+84
+87
+91
+99
+119
+151
+178
+203
+221
+243
+254
+255
+255
+255
+254
+251
+250
+250
+248
+243
+239
+235
+235
+236
+235
+234
+229
+225
+212
+191
+171
+146
+121
+96
+90
+105
+129
+156
+173
+202
+220
+237
+246
+249
+252
+252
+251
+252
+252
+252
+252
+252
+252
+252
+254
+253
+255
+254
+246
+244
+235
+193
+143
+60
+65
+58
+49
+59
+77
+73
+51
+55
+58
+61
+59
+55
+51
+55
+59
+57
+57
+56
+54
+53
+52
+52
+52
+52
+52
+51
+51
+50
+49
+49
+49
+48
+48
+48
+48
+47
+46
+44
+43
+47
+49
+49
+49
+48
+48
+48
+47
+46
+46
+46
+47
+48
+49
+51
+51
+52
+51
+48
+49
+50
+52
+50
+50
+55
+65
+71
+86
+109
+123
+109
+54
+45
+46
+46
+46
+45
+45
+45
+44
+45
+45
+45
+44
+44
+43
+43
+43
+46
+46
+46
+46
+46
+46
+46
+46
+46
+46
+45
+44
+44
+45
+46
+46
+45
+46
+47
+49
+50
+52
+52
+51
+51
+58
+62
+58
+50
+45
+51
+57
+64
+64
+66
+63
+61
+57
+56
+57
+68
+76
+83
+86
+84
+75
+56
+46
+45
+48
+46
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+89
+90
+92
+91
+90
+86
+86
+85
+87
+93
+105
+129
+166
+196
+208
+230
+252
+255
+254
+254
+252
+248
+252
+251
+249
+244
+238
+230
+227
+223
+226
+229
+227
+223
+220
+208
+188
+171
+149
+137
+125
+128
+145
+162
+180
+191
+218
+231
+244
+249
+251
+253
+253
+251
+252
+252
+252
+252
+252
+252
+252
+254
+253
+255
+255
+237
+230
+240
+236
+222
+173
+110
+63
+64
+75
+64
+56
+58
+54
+59
+63
+61
+57
+52
+54
+60
+59
+60
+58
+59
+57
+57
+56
+56
+52
+52
+52
+51
+51
+50
+50
+49
+48
+48
+48
+47
+46
+45
+45
+46
+50
+50
+49
+49
+49
+48
+48
+48
+51
+50
+48
+47
+47
+47
+49
+49
+54
+52
+49
+50
+51
+53
+51
+50
+54
+64
+73
+86
+111
+122
+95
+44
+44
+46
+45
+45
+45
+44
+44
+44
+45
+45
+45
+44
+44
+43
+43
+43
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+44
+44
+44
+44
+45
+45
+44
+44
+44
+45
+46
+49
+50
+51
+50
+53
+55
+49
+43
+41
+47
+52
+60
+61
+65
+64
+63
+59
+58
+58
+69
+78
+86
+88
+83
+73
+52
+40
+44
+46
+44
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+89
+90
+92
+91
+90
+86
+84
+84
+89
+96
+109
+134
+172
+202
+218
+241
+255
+255
+253
+255
+254
+250
+253
+251
+248
+240
+232
+223
+218
+213
+218
+219
+219
+217
+214
+208
+191
+177
+167
+160
+157
+167
+181
+195
+206
+215
+230
+240
+248
+250
+251
+253
+253
+250
+252
+252
+252
+252
+252
+252
+252
+252
+254
+250
+245
+243
+248
+248
+244
+234
+236
+200
+137
+80
+59
+60
+64
+60
+55
+59
+63
+61
+59
+55
+56
+59
+59
+60
+61
+61
+60
+59
+59
+59
+54
+54
+54
+53
+53
+53
+53
+52
+52
+51
+50
+49
+49
+48
+48
+48
+50
+50
+50
+49
+49
+49
+48
+48
+52
+51
+49
+48
+48
+48
+49
+50
+54
+53
+52
+53
+53
+54
+51
+50
+54
+63
+77
+87
+111
+114
+76
+40
+44
+46
+45
+45
+45
+44
+44
+44
+45
+45
+45
+44
+44
+43
+43
+43
+45
+45
+45
+45
+45
+45
+45
+45
+44
+44
+43
+43
+43
+43
+44
+44
+46
+45
+43
+43
+44
+45
+45
+47
+45
+47
+48
+45
+41
+41
+45
+47
+53
+56
+61
+64
+63
+61
+62
+63
+71
+81
+90
+90
+83
+71
+52
+37
+42
+44
+42
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+89
+90
+92
+91
+90
+86
+84
+85
+89
+97
+109
+132
+168
+199
+227
+248
+255
+255
+255
+255
+255
+250
+251
+250
+244
+234
+226
+217
+213
+209
+211
+213
+214
+212
+211
+207
+196
+184
+186
+182
+184
+193
+206
+216
+229
+237
+240
+247
+251
+251
+251
+253
+252
+250
+252
+252
+252
+252
+252
+252
+252
+252
+253
+247
+248
+253
+253
+250
+243
+239
+226
+237
+217
+147
+87
+70
+69
+59
+58
+60
+62
+63
+62
+58
+57
+57
+60
+61
+61
+59
+60
+59
+59
+59
+56
+54
+54
+54
+54
+53
+53
+53
+54
+53
+52
+50
+49
+49
+49
+50
+51
+50
+50
+50
+49
+49
+49
+49
+48
+48
+48
+49
+50
+52
+53
+54
+52
+56
+58
+59
+56
+54
+51
+52
+57
+63
+82
+91
+110
+101
+58
+42
+45
+46
+46
+46
+45
+45
+45
+44
+45
+45
+45
+44
+44
+43
+43
+43
+44
+44
+44
+44
+44
+44
+44
+44
+44
+43
+42
+42
+42
+42
+43
+44
+46
+46
+43
+43
+43
+44
+44
+43
+42
+43
+47
+47
+46
+43
+45
+44
+47
+51
+56
+58
+60
+63
+66
+68
+74
+83
+90
+90
+82
+69
+49
+37
+42
+44
+42
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+89
+90
+92
+91
+90
+86
+86
+86
+88
+93
+104
+125
+160
+190
+223
+247
+255
+255
+253
+255
+255
+246
+251
+248
+241
+232
+222
+216
+214
+211
+210
+211
+211
+209
+208
+206
+199
+190
+195
+198
+203
+216
+227
+234
+244
+251
+247
+252
+253
+251
+251
+253
+253
+250
+252
+252
+252
+252
+252
+252
+252
+252
+249
+250
+253
+253
+252
+245
+248
+253
+250
+231
+234
+232
+185
+98
+58
+73
+62
+61
+62
+64
+64
+62
+58
+55
+57
+58
+57
+58
+58
+58
+58
+60
+56
+56
+56
+56
+56
+56
+56
+56
+58
+57
+55
+53
+52
+53
+53
+54
+51
+51
+50
+50
+50
+49
+49
+49
+47
+48
+49
+51
+52
+53
+53
+53
+52
+60
+66
+67
+60
+56
+53
+55
+60
+62
+85
+94
+107
+85
+40
+46
+46
+47
+47
+47
+46
+46
+46
+45
+45
+45
+45
+44
+44
+43
+43
+43
+44
+44
+44
+44
+44
+44
+44
+44
+43
+43
+42
+41
+41
+42
+43
+43
+45
+45
+44
+44
+44
+44
+43
+44
+43
+44
+47
+49
+50
+49
+48
+46
+45
+46
+51
+53
+56
+58
+63
+66
+73
+84
+90
+88
+80
+65
+48
+37
+44
+44
+42
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+89
+90
+92
+91
+90
+86
+89
+87
+87
+90
+98
+120
+154
+184
+215
+240
+255
+254
+254
+255
+255
+244
+250
+245
+238
+229
+221
+216
+216
+214
+210
+210
+210
+206
+207
+207
+200
+195
+196
+204
+219
+235
+246
+249
+251
+252
+253
+253
+253
+252
+252
+253
+253
+251
+252
+252
+252
+252
+252
+252
+252
+250
+247
+247
+248
+250
+254
+255
+255
+250
+248
+250
+241
+226
+219
+203
+150
+91
+68
+64
+62
+65
+66
+64
+60
+53
+55
+54
+56
+55
+55
+54
+56
+56
+56
+56
+56
+56
+56
+56
+56
+56
+59
+58
+56
+54
+53
+53
+54
+55
+51
+51
+51
+50
+50
+49
+49
+49
+50
+51
+52
+53
+53
+51
+50
+49
+52
+62
+71
+72
+63
+57
+55
+58
+59
+59
+85
+94
+102
+73
+28
+48
+46
+48
+48
+47
+47
+47
+46
+46
+45
+45
+45
+44
+44
+43
+43
+43
+44
+44
+44
+44
+44
+44
+44
+44
+43
+42
+42
+41
+41
+42
+42
+43
+43
+43
+44
+45
+44
+45
+46
+44
+43
+45
+49
+51
+54
+52
+52
+49
+43
+45
+48
+50
+53
+55
+61
+63
+73
+84
+90
+87
+77
+64
+47
+35
+44
+44
+44
+86
+86
+86
+86
+86
+86
+86
+86
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+90
+91
+93
+92
+91
+87
+91
+87
+89
+96
+103
+118
+147
+176
+201
+222
+243
+254
+255
+255
+255
+249
+250
+246
+240
+235
+232
+227
+223
+216
+218
+212
+209
+210
+209
+201
+200
+202
+205
+216
+227
+237
+243
+250
+255
+255
+254
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+250
+250
+251
+253
+255
+255
+255
+255
+255
+255
+251
+243
+238
+233
+226
+217
+207
+105
+75
+58
+64
+71
+65
+58
+61
+50
+50
+51
+47
+46
+45
+49
+52
+53
+55
+56
+56
+58
+58
+57
+56
+58
+57
+57
+57
+56
+55
+55
+55
+50
+50
+51
+52
+52
+51
+51
+50
+51
+49
+57
+57
+45
+40
+39
+30
+59
+55
+48
+50
+62
+74
+68
+55
+60
+67
+90
+102
+85
+49
+35
+42
+47
+49
+48
+48
+48
+47
+47
+47
+47
+47
+47
+46
+45
+45
+45
+44
+48
+48
+47
+47
+46
+46
+46
+46
+43
+43
+43
+43
+43
+43
+42
+42
+46
+45
+45
+44
+45
+44
+45
+45
+42
+44
+47
+50
+54
+56
+60
+60
+50
+47
+45
+41
+42
+47
+56
+63
+71
+78
+87
+84
+73
+59
+46
+42
+44
+43
+44
+86
+86
+86
+86
+86
+86
+86
+86
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+90
+91
+93
+92
+91
+87
+90
+86
+89
+96
+105
+120
+150
+180
+204
+224
+244
+255
+255
+255
+252
+249
+250
+244
+239
+235
+230
+225
+221
+214
+209
+203
+202
+204
+204
+201
+202
+206
+215
+222
+233
+242
+247
+250
+253
+254
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+249
+249
+252
+255
+255
+255
+255
+255
+255
+253
+246
+242
+239
+234
+226
+215
+206
+149
+91
+67
+66
+68
+67
+64
+51
+52
+51
+51
+51
+49
+49
+49
+56
+56
+57
+58
+57
+54
+55
+58
+56
+56
+56
+55
+55
+54
+54
+54
+52
+53
+54
+54
+54
+54
+53
+53
+57
+50
+55
+56
+43
+36
+37
+33
+52
+50
+44
+42
+49
+63
+67
+66
+61
+74
+94
+95
+73
+44
+37
+47
+49
+50
+50
+50
+49
+49
+49
+49
+49
+49
+49
+48
+48
+47
+47
+47
+49
+49
+49
+48
+48
+48
+47
+47
+45
+45
+44
+44
+43
+43
+42
+42
+42
+42
+41
+41
+41
+42
+42
+43
+45
+44
+45
+47
+51
+54
+62
+63
+56
+53
+49
+46
+43
+46
+50
+54
+68
+75
+84
+82
+75
+60
+50
+44
+44
+45
+44
+86
+86
+86
+86
+86
+86
+86
+86
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+90
+91
+93
+92
+91
+87
+88
+86
+89
+97
+105
+121
+153
+184
+208
+226
+246
+255
+255
+254
+252
+248
+247
+243
+237
+233
+228
+222
+216
+209
+201
+194
+193
+198
+200
+203
+207
+215
+225
+234
+241
+247
+250
+251
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+250
+250
+253
+253
+254
+255
+255
+254
+255
+252
+247
+245
+246
+242
+236
+227
+214
+219
+208
+166
+105
+66
+60
+71
+72
+62
+50
+42
+42
+45
+51
+54
+52
+51
+52
+57
+56
+53
+55
+62
+52
+52
+52
+52
+51
+51
+51
+51
+53
+54
+54
+55
+55
+54
+53
+53
+59
+49
+55
+64
+51
+38
+40
+43
+44
+46
+42
+37
+37
+50
+65
+75
+69
+84
+97
+83
+57
+37
+40
+51
+50
+52
+52
+52
+51
+51
+51
+50
+52
+52
+51
+51
+51
+50
+50
+50
+52
+51
+51
+51
+50
+50
+50
+49
+47
+47
+46
+45
+44
+43
+42
+42
+40
+40
+40
+40
+40
+41
+42
+43
+48
+46
+43
+43
+46
+52
+60
+64
+61
+58
+55
+51
+45
+43
+42
+44
+61
+68
+77
+77
+72
+60
+52
+47
+46
+46
+45
+85
+85
+86
+86
+86
+86
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+90
+91
+93
+92
+91
+87
+88
+86
+89
+96
+104
+119
+152
+185
+208
+227
+246
+255
+255
+254
+253
+249
+246
+241
+237
+231
+226
+220
+213
+206
+192
+187
+188
+194
+199
+205
+217
+224
+239
+245
+250
+253
+252
+250
+250
+251
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+253
+253
+253
+253
+253
+254
+253
+250
+251
+250
+248
+249
+248
+248
+244
+238
+237
+228
+219
+219
+217
+188
+121
+60
+54
+53
+53
+57
+59
+54
+45
+38
+64
+58
+56
+58
+56
+48
+45
+49
+51
+51
+51
+51
+50
+50
+50
+50
+52
+53
+53
+53
+53
+52
+52
+51
+54
+47
+63
+83
+72
+52
+48
+51
+42
+45
+42
+38
+35
+44
+58
+70
+81
+92
+94
+70
+46
+37
+43
+49
+51
+53
+53
+52
+52
+51
+51
+51
+53
+52
+52
+52
+52
+52
+52
+52
+54
+54
+54
+53
+53
+53
+52
+52
+50
+50
+48
+47
+46
+44
+43
+43
+42
+42
+41
+41
+42
+43
+44
+44
+47
+45
+42
+42
+46
+49
+57
+58
+61
+59
+59
+54
+49
+44
+40
+39
+53
+59
+67
+69
+66
+59
+52
+48
+47
+47
+46
+85
+85
+85
+86
+86
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+90
+91
+93
+92
+91
+87
+88
+87
+90
+95
+101
+116
+149
+183
+206
+226
+245
+253
+255
+254
+253
+250
+248
+243
+241
+235
+229
+222
+214
+204
+191
+185
+185
+190
+200
+209
+223
+237
+248
+251
+255
+255
+254
+251
+249
+249
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+254
+255
+255
+255
+255
+254
+251
+250
+248
+246
+247
+247
+249
+251
+251
+250
+248
+234
+243
+244
+241
+235
+228
+210
+188
+163
+135
+97
+67
+53
+53
+57
+60
+55
+51
+50
+53
+57
+58
+59
+59
+49
+49
+49
+49
+49
+49
+49
+51
+54
+54
+54
+54
+54
+53
+52
+51
+51
+50
+77
+102
+90
+64
+52
+51
+42
+43
+43
+43
+40
+42
+47
+54
+91
+94
+86
+61
+46
+44
+46
+45
+51
+53
+53
+52
+52
+51
+51
+51
+52
+52
+52
+52
+52
+52
+52
+52
+56
+56
+56
+55
+55
+55
+54
+54
+53
+52
+51
+50
+49
+47
+46
+46
+46
+46
+45
+44
+44
+45
+46
+46
+45
+45
+45
+45
+49
+49
+54
+52
+57
+57
+60
+58
+54
+47
+44
+42
+46
+52
+60
+63
+62
+55
+50
+45
+46
+45
+44
+84
+84
+85
+86
+86
+87
+88
+88
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+90
+91
+93
+92
+91
+87
+88
+87
+90
+95
+99
+114
+148
+183
+209
+228
+246
+254
+255
+254
+253
+250
+248
+244
+243
+239
+232
+224
+213
+204
+189
+181
+180
+186
+197
+209
+227
+243
+253
+255
+255
+255
+252
+249
+248
+249
+250
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+254
+255
+255
+255
+255
+253
+250
+248
+245
+241
+244
+248
+250
+253
+254
+255
+255
+252
+254
+250
+241
+240
+244
+241
+237
+230
+220
+208
+189
+167
+141
+115
+99
+75
+76
+67
+50
+40
+42
+44
+42
+50
+50
+50
+50
+51
+51
+51
+51
+55
+58
+58
+57
+57
+56
+54
+54
+53
+57
+83
+103
+88
+63
+50
+44
+43
+43
+43
+46
+44
+42
+42
+46
+92
+87
+77
+59
+54
+54
+51
+45
+52
+53
+53
+53
+52
+52
+52
+52
+51
+51
+52
+52
+52
+52
+53
+53
+57
+57
+57
+57
+56
+56
+56
+55
+55
+55
+54
+53
+52
+51
+50
+50
+48
+47
+46
+45
+44
+44
+44
+44
+44
+45
+48
+49
+50
+50
+50
+45
+49
+51
+55
+58
+55
+52
+49
+48
+45
+48
+54
+58
+57
+54
+50
+45
+45
+45
+44
+84
+84
+85
+86
+86
+87
+88
+88
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+90
+91
+93
+92
+91
+87
+87
+86
+90
+95
+100
+115
+151
+187
+216
+234
+251
+255
+255
+254
+253
+249
+245
+242
+240
+236
+230
+221
+208
+199
+185
+179
+176
+180
+191
+207
+227
+242
+254
+255
+255
+255
+252
+249
+247
+248
+250
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+254
+255
+255
+255
+254
+250
+248
+243
+240
+238
+242
+246
+250
+254
+255
+255
+255
+255
+255
+255
+255
+255
+249
+240
+233
+241
+239
+237
+237
+234
+229
+223
+218
+209
+208
+180
+120
+71
+56
+53
+48
+50
+50
+50
+51
+51
+52
+52
+54
+56
+58
+58
+58
+57
+56
+55
+54
+55
+59
+76
+84
+67
+52
+48
+43
+46
+46
+47
+50
+47
+44
+49
+58
+82
+75
+70
+64
+65
+62
+57
+51
+53
+55
+55
+55
+54
+54
+54
+53
+52
+52
+52
+53
+53
+54
+54
+54
+58
+58
+58
+57
+57
+56
+56
+56
+57
+57
+56
+56
+55
+55
+54
+54
+53
+51
+50
+48
+46
+45
+46
+46
+47
+47
+48
+49
+51
+51
+50
+45
+42
+45
+50
+55
+55
+52
+50
+50
+47
+49
+54
+58
+57
+55
+51
+46
+46
+45
+44
+82
+82
+83
+84
+86
+87
+88
+88
+87
+87
+87
+87
+87
+87
+87
+87
+87
+87
+89
+91
+93
+92
+91
+87
+86
+87
+90
+96
+103
+117
+157
+194
+222
+239
+255
+255
+255
+254
+250
+246
+238
+237
+233
+229
+225
+215
+202
+195
+184
+177
+172
+177
+188
+204
+224
+242
+254
+255
+255
+255
+251
+249
+249
+250
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+252
+254
+255
+255
+255
+253
+251
+247
+244
+241
+240
+242
+246
+250
+251
+252
+255
+255
+255
+255
+255
+255
+255
+252
+251
+250
+240
+238
+236
+234
+231
+231
+234
+234
+219
+228
+197
+119
+55
+41
+47
+47
+51
+51
+52
+52
+53
+53
+54
+56
+55
+57
+57
+56
+55
+54
+53
+52
+53
+56
+65
+60
+44
+40
+46
+42
+46
+47
+50
+50
+48
+46
+59
+78
+73
+69
+67
+70
+71
+66
+59
+56
+52
+53
+53
+54
+54
+54
+55
+55
+53
+53
+53
+54
+54
+55
+55
+55
+57
+57
+58
+56
+57
+55
+56
+55
+58
+57
+58
+57
+57
+56
+57
+57
+56
+57
+52
+50
+48
+46
+47
+47
+49
+49
+46
+46
+43
+42
+41
+37
+30
+33
+43
+49
+54
+53
+53
+53
+50
+51
+53
+54
+56
+53
+48
+45
+45
+46
+45
+78
+79
+80
+81
+85
+86
+87
+88
+85
+85
+86
+86
+86
+87
+89
+88
+87
+88
+91
+93
+94
+91
+88
+85
+85
+86
+90
+93
+103
+127
+172
+208
+228
+240
+253
+255
+251
+251
+248
+243
+235
+235
+230
+221
+217
+214
+201
+189
+189
+175
+164
+169
+180
+196
+215
+231
+251
+255
+255
+255
+255
+253
+250
+251
+254
+254
+254
+254
+254
+254
+252
+252
+253
+253
+251
+250
+250
+249
+249
+249
+255
+254
+253
+253
+255
+253
+252
+248
+250
+246
+247
+250
+248
+244
+243
+249
+255
+255
+255
+255
+255
+252
+252
+253
+255
+255
+253
+249
+242
+237
+234
+232
+223
+230
+202
+114
+53
+51
+47
+45
+49
+49
+49
+49
+50
+50
+52
+52
+50
+53
+53
+54
+55
+54
+54
+53
+54
+52
+45
+39
+38
+42
+43
+41
+48
+47
+41
+40
+52
+67
+68
+62
+63
+66
+68
+70
+69
+66
+62
+59
+51
+49
+48
+48
+49
+50
+53
+54
+54
+54
+54
+54
+52
+52
+52
+52
+55
+54
+56
+53
+55
+54
+56
+55
+57
+55
+56
+55
+58
+57
+60
+61
+58
+57
+56
+52
+48
+46
+46
+48
+48
+49
+47
+45
+41
+38
+39
+39
+43
+44
+49
+52
+56
+57
+59
+57
+54
+55
+60
+59
+60
+59
+52
+44
+44
+43
+40
+77
+78
+80
+81
+83
+84
+88
+88
+86
+86
+87
+87
+87
+88
+90
+89
+88
+88
+91
+93
+94
+91
+90
+86
+87
+86
+93
+98
+110
+136
+178
+209
+227
+238
+253
+255
+253
+249
+245
+239
+236
+231
+226
+216
+211
+206
+196
+184
+175
+166
+160
+166
+181
+196
+214
+228
+254
+255
+255
+255
+255
+255
+253
+253
+254
+254
+254
+254
+254
+254
+252
+252
+253
+253
+250
+250
+250
+249
+248
+248
+253
+252
+253
+253
+255
+255
+254
+253
+253
+251
+249
+241
+229
+219
+222
+234
+253
+255
+254
+253
+251
+250
+254
+255
+255
+255
+255
+252
+244
+236
+231
+229
+223
+231
+202
+112
+51
+50
+46
+45
+47
+47
+49
+49
+50
+50
+52
+52
+50
+50
+53
+54
+55
+54
+54
+53
+53
+49
+45
+39
+40
+43
+44
+43
+43
+42
+51
+60
+64
+60
+58
+57
+61
+62
+65
+66
+66
+65
+61
+60
+54
+52
+51
+48
+49
+50
+52
+54
+54
+54
+54
+54
+52
+52
+50
+50
+55
+54
+54
+53
+53
+54
+54
+55
+55
+55
+55
+55
+56
+57
+58
+59
+63
+62
+59
+55
+53
+51
+51
+54
+55
+54
+52
+45
+41
+42
+47
+49
+59
+59
+61
+62
+63
+61
+58
+56
+57
+60
+65
+65
+67
+64
+57
+48
+42
+42
+39
+77
+78
+80
+82
+83
+85
+88
+89
+88
+88
+89
+89
+88
+89
+91
+90
+88
+89
+91
+92
+94
+91
+90
+86
+87
+84
+90
+99
+115
+142
+179
+205
+223
+235
+252
+255
+253
+248
+242
+235
+231
+224
+216
+204
+198
+192
+183
+173
+164
+161
+163
+173
+191
+206
+222
+234
+254
+255
+255
+255
+255
+255
+253
+254
+254
+254
+254
+254
+254
+254
+252
+252
+253
+252
+250
+250
+249
+249
+248
+248
+253
+251
+252
+253
+254
+255
+254
+253
+253
+251
+250
+236
+216
+204
+212
+230
+253
+255
+254
+253
+251
+250
+254
+255
+255
+255
+255
+252
+244
+236
+231
+229
+224
+231
+201
+109
+48
+48
+46
+46
+46
+47
+49
+50
+51
+50
+52
+51
+50
+50
+53
+53
+55
+54
+55
+54
+54
+49
+47
+42
+44
+46
+49
+50
+48
+52
+73
+90
+83
+61
+51
+52
+56
+57
+59
+60
+61
+62
+62
+63
+61
+58
+57
+53
+53
+53
+53
+54
+54
+54
+54
+54
+52
+52
+50
+50
+55
+55
+54
+54
+54
+54
+55
+55
+55
+55
+55
+55
+56
+57
+59
+59
+66
+65
+63
+59
+58
+56
+57
+60
+62
+59
+55
+49
+47
+51
+61
+66
+74
+74
+72
+69
+64
+58
+53
+50
+56
+61
+68
+71
+74
+70
+62
+53
+46
+46
+43
+77
+78
+80
+82
+84
+86
+89
+90
+90
+90
+91
+90
+90
+90
+92
+91
+89
+89
+91
+92
+93
+91
+90
+87
+85
+80
+85
+96
+116
+142
+173
+194
+218
+231
+250
+255
+252
+245
+237
+228
+221
+211
+201
+190
+184
+178
+170
+163
+168
+171
+179
+192
+211
+225
+239
+248
+255
+255
+255
+255
+255
+254
+253
+254
+254
+254
+254
+254
+254
+254
+252
+252
+252
+252
+250
+249
+249
+249
+247
+247
+252
+250
+251
+252
+254
+255
+254
+253
+251
+251
+250
+237
+218
+208
+217
+235
+253
+255
+254
+253
+251
+250
+254
+255
+255
+255
+255
+252
+244
+236
+230
+228
+227
+233
+201
+108
+48
+48
+48
+48
+46
+47
+50
+50
+51
+50
+51
+50
+50
+50
+52
+52
+54
+54
+56
+55
+56
+51
+50
+48
+50
+51
+55
+60
+71
+82
+105
+116
+106
+83
+65
+57
+55
+54
+55
+54
+56
+59
+60
+62
+62
+60
+60
+56
+56
+56
+55
+56
+54
+54
+54
+54
+52
+52
+50
+50
+56
+55
+54
+54
+54
+54
+55
+56
+56
+55
+55
+56
+56
+58
+59
+60
+63
+62
+61
+57
+57
+56
+57
+61
+61
+59
+55
+49
+47
+53
+63
+69
+69
+70
+69
+65
+59
+52
+47
+44
+50
+56
+66
+71
+75
+71
+62
+51
+48
+47
+44
+77
+78
+80
+82
+84
+86
+90
+91
+92
+91
+92
+91
+90
+90
+93
+91
+89
+89
+90
+91
+92
+90
+90
+87
+86
+80
+84
+96
+116
+140
+167
+184
+213
+228
+247
+253
+249
+242
+233
+223
+214
+201
+191
+182
+177
+171
+165
+161
+174
+182
+194
+208
+225
+239
+251
+255
+255
+255
+255
+255
+255
+254
+253
+255
+254
+254
+254
+254
+254
+254
+252
+252
+252
+252
+249
+249
+249
+248
+247
+247
+251
+249
+251
+252
+254
+255
+254
+253
+251
+249
+249
+241
+229
+220
+225
+238
+253
+255
+254
+253
+251
+250
+254
+255
+255
+255
+255
+252
+245
+236
+230
+227
+229
+235
+202
+109
+49
+50
+50
+51
+46
+47
+51
+51
+52
+50
+50
+49
+50
+50
+52
+52
+54
+54
+56
+57
+58
+53
+54
+54
+55
+55
+61
+68
+98
+115
+131
+129
+121
+111
+90
+65
+56
+54
+53
+51
+52
+55
+57
+59
+60
+58
+59
+56
+58
+58
+57
+58
+54
+54
+54
+54
+52
+52
+50
+50
+56
+56
+55
+54
+54
+55
+56
+56
+56
+56
+56
+56
+57
+58
+59
+60
+61
+60
+59
+55
+55
+54
+56
+59
+58
+57
+54
+49
+47
+51
+59
+63
+63
+64
+64
+61
+54
+47
+43
+42
+45
+52
+64
+69
+74
+70
+60
+49
+42
+42
+39
diff --git a/mfhdf/hrepack/image8.txt b/mfhdf/hrepack/image8.txt
new file mode 100644
index 0000000..4ba5980
--- /dev/null
+++ b/mfhdf/hrepack/image8.txt
@@ -0,0 +1,120006 @@
+components
+1
+height
+400
+width
+300
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
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+107
+103
+97
+104
+107
+108
+107
+107
+107
+97
+77
+44
+16
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+6
+11
+17
+24
+31
+40
+52
+62
+71
+79
+87
+95
+100
+104
+107
+110
+113
+115
+117
+119
+120
+121
+122
+123
+124
+124
+125
+125
+124
+124
+123
+120
+118
+113
+108
+101
+87
+75
+62
+49
+36
+21
+13
+7
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+102
+104
+106
+107
+106
+98
+101
+106
+109
+108
+108
+107
+101
+85
+56
+27
+14
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+6
+10
+15
+22
+33
+43
+53
+64
+74
+85
+93
+99
+104
+109
+113
+115
+117
+119
+120
+121
+122
+123
+124
+124
+125
+126
+126
+127
+128
+128
+129
+129
+129
+129
+129
+129
+127
+125
+122
+115
+106
+96
+84
+70
+50
+37
+25
+16
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+95
+97
+101
+104
+106
+100
+99
+104
+109
+110
+108
+108
+104
+92
+67
+38
+23
+12
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+6
+12
+18
+27
+36
+48
+63
+75
+85
+95
+103
+110
+113
+116
+117
+118
+119
+120
+120
+121
+121
+122
+122
+122
+123
+123
+124
+124
+125
+126
+126
+127
+128
+129
+129
+130
+130
+130
+131
+131
+130
+129
+127
+122
+114
+104
+85
+69
+53
+38
+25
+11
+6
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+90
+92
+95
+99
+105
+105
+98
+102
+108
+111
+110
+109
+106
+98
+79
+48
+33
+19
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+10
+17
+29
+41
+55
+69
+83
+99
+107
+112
+115
+116
+117
+118
+118
+119
+119
+120
+120
+120
+120
+120
+119
+119
+119
+119
+119
+119
+119
+120
+121
+122
+123
+124
+126
+127
+128
+129
+130
+131
+131
+131
+131
+131
+131
+129
+128
+120
+108
+91
+73
+53
+31
+18
+10
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+89
+90
+93
+96
+99
+105
+100
+98
+101
+110
+111
+110
+108
+101
+85
+68
+54
+37
+21
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+9
+16
+26
+38
+52
+74
+88
+100
+109
+114
+115
+116
+117
+117
+118
+118
+117
+117
+115
+113
+111
+110
+109
+108
+108
+108
+109
+109
+110
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+121
+123
+124
+126
+128
+129
+131
+131
+131
+131
+132
+131
+130
+127
+120
+108
+83
+62
+43
+26
+14
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+88
+89
+91
+95
+98
+104
+103
+99
+98
+106
+110
+110
+108
+102
+90
+71
+62
+50
+36
+18
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+8
+15
+29
+42
+58
+73
+88
+102
+108
+111
+114
+116
+116
+116
+116
+115
+113
+110
+108
+107
+106
+105
+105
+105
+106
+106
+107
+107
+108
+109
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+123
+124
+125
+126
+128
+129
+130
+131
+132
+132
+132
+131
+129
+126
+115
+101
+83
+63
+44
+21
+11
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+87
+88
+90
+93
+99
+103
+104
+101
+97
+99
+107
+109
+108
+103
+92
+74
+65
+57
+47
+31
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+8
+15
+25
+38
+59
+74
+88
+99
+107
+114
+115
+115
+115
+115
+113
+111
+109
+107
+105
+103
+102
+102
+102
+102
+103
+104
+105
+106
+108
+109
+111
+112
+113
+114
+116
+117
+118
+118
+119
+119
+120
+120
+120
+121
+122
+122
+123
+124
+125
+126
+128
+129
+130
+131
+132
+132
+133
+133
+133
+130
+124
+113
+99
+81
+53
+34
+20
+10
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+87
+87
+88
+92
+100
+103
+104
+103
+99
+93
+101
+104
+105
+101
+93
+75
+66
+60
+54
+44
+18
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+11
+22
+35
+51
+68
+90
+102
+110
+114
+115
+115
+115
+113
+111
+110
+106
+103
+100
+99
+98
+99
+100
+101
+102
+104
+106
+108
+110
+113
+115
+118
+120
+123
+124
+126
+128
+129
+130
+130
+130
+130
+129
+129
+128
+127
+126
+126
+126
+126
+126
+126
+127
+128
+129
+130
+131
+132
+133
+133
+134
+134
+133
+131
+125
+115
+90
+68
+46
+27
+13
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+87
+87
+88
+92
+102
+105
+105
+104
+102
+95
+90
+97
+99
+97
+93
+76
+66
+61
+57
+54
+32
+13
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+6
+12
+28
+46
+66
+86
+104
+113
+114
+115
+115
+115
+114
+112
+107
+102
+98
+95
+95
+96
+96
+98
+99
+101
+103
+106
+109
+114
+119
+124
+129
+133
+138
+142
+145
+148
+150
+152
+153
+153
+153
+152
+150
+149
+147
+144
+142
+138
+136
+133
+131
+129
+128
+128
+128
+129
+129
+130
+131
+132
+133
+134
+134
+135
+135
+134
+133
+125
+108
+84
+58
+33
+11
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+90
+90
+91
+95
+104
+108
+107
+106
+104
+102
+91
+86
+86
+89
+89
+83
+71
+63
+60
+58
+48
+25
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+13
+26
+44
+74
+94
+107
+113
+114
+115
+115
+114
+112
+108
+100
+96
+94
+93
+93
+95
+96
+97
+100
+103
+110
+117
+125
+133
+141
+151
+158
+164
+169
+174
+178
+181
+183
+185
+186
+187
+187
+187
+187
+186
+185
+183
+182
+179
+176
+172
+168
+164
+159
+154
+148
+143
+139
+136
+133
+132
+132
+132
+133
+133
+134
+135
+135
+135
+135
+134
+132
+125
+110
+87
+49
+25
+11
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+93
+96
+102
+107
+108
+107
+106
+105
+104
+96
+88
+83
+81
+82
+80
+75
+69
+64
+61
+55
+35
+16
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+9
+20
+38
+59
+81
+101
+108
+112
+114
+114
+113
+110
+105
+100
+96
+93
+92
+92
+93
+94
+98
+102
+109
+117
+127
+139
+149
+157
+164
+171
+178
+182
+185
+187
+189
+191
+192
+193
+193
+194
+194
+194
+193
+193
+193
+192
+191
+189
+188
+186
+184
+181
+179
+176
+173
+169
+164
+160
+155
+150
+143
+140
+137
+135
+134
+134
+135
+135
+135
+135
+135
+134
+132
+127
+117
+89
+61
+36
+17
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+96
+97
+101
+106
+109
+109
+107
+106
+105
+105
+101
+95
+87
+80
+77
+76
+75
+71
+67
+63
+59
+43
+23
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+9
+27
+47
+69
+88
+103
+112
+113
+113
+113
+111
+105
+100
+96
+92
+90
+91
+92
+94
+98
+103
+114
+123
+134
+145
+155
+167
+174
+179
+184
+188
+192
+193
+195
+195
+196
+196
+196
+196
+196
+195
+195
+194
+194
+193
+193
+192
+192
+191
+190
+189
+188
+186
+185
+183
+182
+179
+177
+174
+170
+166
+160
+155
+150
+145
+141
+138
+136
+136
+135
+135
+135
+135
+135
+134
+131
+117
+96
+71
+44
+22
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+99
+100
+104
+109
+110
+108
+106
+105
+105
+105
+104
+101
+95
+86
+76
+72
+72
+71
+69
+66
+62
+50
+30
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+13
+26
+55
+78
+96
+108
+112
+113
+112
+111
+108
+103
+95
+91
+89
+89
+89
+93
+97
+103
+112
+122
+139
+152
+163
+172
+180
+187
+190
+193
+195
+196
+196
+196
+196
+196
+196
+195
+194
+193
+192
+191
+189
+188
+187
+186
+186
+185
+185
+185
+185
+185
+185
+184
+184
+183
+183
+182
+181
+181
+179
+178
+174
+170
+165
+159
+153
+146
+142
+139
+137
+136
+136
+135
+135
+135
+135
+132
+123
+105
+80
+51
+19
+8
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+102
+103
+107
+110
+110
+104
+103
+103
+104
+105
+105
+105
+101
+94
+81
+70
+69
+69
+68
+67
+64
+56
+36
+15
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+14
+30
+55
+93
+104
+110
+113
+114
+112
+110
+104
+97
+90
+87
+87
+87
+89
+91
+99
+110
+124
+140
+155
+171
+180
+186
+190
+193
+195
+196
+197
+197
+197
+197
+196
+195
+193
+192
+189
+186
+184
+181
+179
+175
+173
+172
+170
+169
+169
+169
+170
+171
+173
+175
+177
+178
+179
+180
+181
+181
+181
+180
+179
+178
+178
+176
+173
+170
+162
+155
+149
+143
+139
+137
+136
+136
+135
+135
+135
+134
+129
+116
+92
+47
+23
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+103
+105
+108
+110
+110
+103
+101
+102
+103
+105
+105
+105
+103
+98
+87
+70
+68
+67
+67
+66
+65
+60
+42
+20
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+7
+23
+47
+75
+100
+109
+112
+113
+113
+111
+104
+95
+89
+86
+84
+86
+88
+92
+100
+111
+135
+151
+165
+177
+185
+191
+194
+195
+196
+197
+197
+196
+195
+194
+192
+189
+185
+181
+177
+172
+165
+159
+154
+149
+144
+138
+134
+130
+127
+125
+123
+123
+124
+125
+127
+132
+136
+141
+146
+151
+158
+164
+169
+173
+176
+177
+177
+177
+176
+175
+174
+172
+168
+163
+156
+146
+141
+138
+136
+136
+135
+135
+135
+132
+128
+104
+68
+37
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+104
+105
+107
+109
+110
+103
+101
+101
+102
+104
+104
+104
+101
+95
+86
+70
+67
+66
+66
+66
+65
+61
+44
+23
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+27
+54
+79
+97
+107
+112
+112
+111
+108
+101
+92
+87
+85
+85
+86
+90
+99
+112
+128
+144
+164
+175
+183
+188
+193
+195
+196
+196
+196
+195
+194
+192
+189
+185
+180
+173
+167
+160
+153
+145
+135
+128
+122
+115
+110
+103
+99
+95
+92
+89
+87
+87
+87
+87
+88
+91
+94
+98
+103
+108
+117
+125
+133
+141
+149
+159
+165
+170
+173
+174
+174
+173
+172
+170
+167
+161
+154
+148
+142
+138
+136
+136
+135
+134
+133
+124
+104
+76
+45
+18
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+103
+105
+107
+109
+110
+105
+102
+101
+102
+104
+104
+102
+97
+91
+84
+71
+66
+65
+65
+65
+65
+62
+46
+24
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+10
+24
+58
+82
+98
+107
+111
+112
+110
+105
+98
+91
+84
+83
+84
+87
+92
+106
+122
+138
+155
+170
+182
+188
+192
+195
+196
+196
+196
+195
+193
+191
+186
+182
+176
+169
+162
+151
+142
+133
+124
+115
+104
+97
+91
+85
+80
+76
+73
+71
+69
+67
+66
+66
+66
+66
+66
+68
+69
+72
+74
+78
+84
+89
+96
+103
+112
+125
+135
+145
+153
+161
+168
+171
+172
+172
+171
+168
+164
+159
+154
+147
+141
+138
+136
+135
+135
+133
+124
+107
+81
+48
+15
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+103
+104
+106
+108
+109
+106
+103
+102
+103
+104
+103
+99
+92
+85
+82
+74
+67
+64
+64
+65
+65
+62
+46
+24
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+10
+26
+51
+88
+101
+108
+111
+112
+109
+103
+96
+88
+84
+81
+84
+88
+95
+107
+130
+150
+165
+177
+187
+192
+195
+196
+196
+196
+195
+193
+190
+187
+182
+174
+166
+157
+148
+137
+123
+112
+103
+93
+85
+76
+71
+67
+63
+61
+59
+58
+57
+57
+57
+57
+57
+57
+57
+57
+57
+58
+58
+59
+60
+62
+64
+67
+72
+78
+88
+98
+110
+121
+134
+150
+158
+164
+168
+170
+171
+170
+168
+165
+159
+150
+144
+140
+137
+136
+135
+133
+127
+112
+85
+39
+18
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+102
+103
+105
+106
+107
+107
+105
+104
+104
+105
+104
+93
+85
+80
+80
+78
+69
+65
+64
+65
+65
+62
+45
+23
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+8
+25
+52
+86
+106
+109
+110
+111
+111
+103
+92
+85
+81
+80
+82
+87
+98
+114
+135
+161
+175
+185
+191
+195
+197
+197
+197
+196
+194
+191
+187
+182
+176
+169
+156
+144
+132
+120
+107
+91
+81
+73
+66
+61
+57
+56
+55
+55
+54
+54
+54
+54
+54
+55
+55
+55
+55
+55
+55
+56
+56
+56
+56
+57
+57
+57
+58
+59
+60
+62
+66
+72
+80
+92
+112
+129
+143
+156
+165
+170
+171
+171
+170
+169
+163
+155
+147
+141
+137
+136
+135
+134
+130
+122
+79
+42
+17
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+100
+101
+102
+103
+104
+107
+106
+106
+107
+108
+97
+85
+80
+80
+81
+80
+73
+67
+64
+65
+65
+61
+42
+19
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+9
+33
+64
+92
+106
+109
+110
+110
+107
+101
+87
+82
+79
+79
+82
+93
+110
+131
+153
+171
+186
+191
+195
+197
+197
+197
+195
+193
+190
+187
+180
+172
+162
+151
+138
+119
+104
+91
+80
+70
+61
+58
+55
+54
+53
+53
+53
+53
+53
+53
+54
+54
+54
+54
+54
+54
+54
+55
+55
+55
+55
+55
+55
+56
+56
+56
+56
+56
+57
+57
+57
+58
+59
+60
+62
+68
+76
+89
+105
+123
+145
+159
+166
+170
+170
+169
+167
+164
+157
+148
+140
+137
+136
+135
+133
+124
+94
+58
+26
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+99
+99
+99
+100
+102
+103
+105
+106
+107
+109
+91
+82
+80
+81
+82
+80
+72
+67
+65
+65
+65
+57
+36
+14
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+6
+31
+64
+88
+103
+108
+109
+109
+105
+98
+89
+81
+79
+79
+84
+93
+116
+138
+157
+174
+185
+194
+196
+197
+197
+196
+193
+191
+187
+182
+176
+164
+151
+138
+123
+108
+90
+78
+69
+63
+58
+55
+54
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+54
+54
+54
+54
+54
+54
+54
+54
+55
+55
+55
+55
+55
+55
+56
+56
+56
+56
+57
+57
+58
+58
+59
+61
+64
+69
+76
+86
+106
+124
+139
+153
+164
+168
+168
+168
+165
+160
+150
+144
+139
+136
+135
+131
+119
+94
+62
+26
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+98
+98
+97
+97
+99
+100
+103
+105
+107
+109
+88
+81
+80
+81
+81
+78
+70
+66
+65
+65
+64
+52
+30
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+21
+61
+87
+101
+107
+109
+109
+105
+98
+89
+81
+77
+79
+85
+96
+113
+142
+162
+177
+187
+194
+197
+197
+196
+195
+193
+189
+184
+178
+169
+159
+141
+125
+110
+96
+82
+69
+62
+58
+55
+53
+52
+52
+52
+52
+52
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+54
+54
+54
+54
+54
+54
+55
+55
+55
+56
+56
+56
+57
+57
+57
+58
+59
+60
+62
+66
+78
+90
+105
+122
+139
+156
+164
+168
+168
+166
+160
+154
+147
+142
+137
+135
+131
+118
+95
+61
+19
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+98
+97
+96
+95
+96
+98
+100
+103
+106
+109
+90
+82
+81
+81
+78
+74
+68
+66
+65
+66
+63
+44
+22
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+6
+19
+45
+88
+101
+107
+108
+108
+106
+98
+88
+81
+77
+78
+84
+97
+115
+138
+167
+181
+190
+195
+198
+198
+196
+194
+191
+188
+182
+174
+164
+151
+137
+114
+98
+84
+73
+64
+57
+54
+53
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+53
+53
+53
+53
+53
+53
+52
+52
+52
+52
+52
+52
+52
+53
+53
+53
+53
+53
+54
+54
+54
+55
+55
+56
+56
+56
+57
+57
+58
+58
+59
+62
+66
+75
+89
+106
+132
+148
+159
+165
+167
+166
+163
+157
+150
+143
+137
+135
+131
+120
+98
+47
+21
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+98
+97
+96
+95
+95
+96
+96
+99
+104
+109
+98
+83
+80
+80
+73
+70
+67
+66
+66
+66
+60
+33
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+15
+39
+75
+103
+106
+108
+108
+107
+99
+87
+80
+76
+75
+82
+96
+117
+141
+165
+185
+192
+196
+198
+198
+196
+193
+190
+187
+182
+172
+160
+144
+127
+109
+87
+74
+65
+58
+54
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+52
+51
+51
+51
+51
+51
+51
+51
+51
+52
+52
+52
+52
+53
+53
+54
+54
+55
+55
+56
+57
+57
+57
+58
+58
+59
+61
+65
+71
+94
+116
+136
+153
+164
+167
+168
+166
+162
+153
+141
+138
+135
+132
+126
+88
+46
+18
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+97
+97
+96
+95
+95
+95
+95
+96
+100
+107
+107
+79
+76
+80
+73
+70
+68
+67
+66
+64
+40
+17
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+14
+41
+73
+100
+107
+108
+107
+105
+99
+85
+78
+75
+76
+80
+101
+126
+150
+172
+188
+196
+198
+199
+198
+195
+191
+188
+183
+176
+167
+147
+129
+110
+92
+77
+63
+58
+54
+52
+52
+51
+51
+51
+51
+51
+51
+52
+52
+52
+52
+52
+52
+52
+52
+52
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+52
+52
+53
+53
+54
+55
+56
+56
+57
+58
+58
+59
+60
+64
+72
+87
+108
+132
+158
+165
+167
+166
+164
+157
+148
+141
+137
+134
+125
+96
+58
+23
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+97
+97
+96
+95
+95
+95
+95
+96
+98
+102
+108
+78
+75
+80
+75
+71
+69
+67
+63
+54
+23
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+8
+32
+64
+91
+104
+107
+107
+105
+99
+90
+77
+75
+76
+82
+94
+125
+150
+171
+186
+194
+198
+199
+197
+195
+191
+186
+181
+173
+162
+147
+122
+104
+87
+74
+63
+56
+54
+52
+51
+51
+51
+51
+51
+51
+51
+51
+52
+52
+52
+52
+52
+52
+52
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+52
+52
+53
+54
+54
+56
+56
+57
+58
+59
+60
+63
+70
+80
+96
+125
+144
+157
+164
+165
+164
+159
+151
+143
+138
+132
+120
+93
+58
+21
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+97
+97
+96
+96
+96
+96
+95
+95
+96
+99
+108
+80
+75
+78
+76
+72
+69
+64
+55
+38
+11
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+21
+55
+83
+101
+106
+107
+105
+99
+91
+81
+74
+75
+81
+94
+114
+149
+171
+185
+194
+198
+199
+197
+194
+191
+187
+180
+171
+158
+143
+124
+99
+83
+71
+62
+56
+53
+52
+51
+51
+51
+51
+51
+51
+51
+51
+51
+52
+52
+52
+52
+52
+51
+51
+51
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+49
+49
+49
+49
+49
+49
+50
+50
+50
+50
+50
+50
+51
+51
+51
+52
+52
+54
+54
+55
+56
+57
+58
+60
+62
+66
+73
+92
+113
+132
+149
+160
+166
+164
+159
+153
+145
+137
+132
+117
+92
+54
+14
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+96
+97
+96
+96
+96
+97
+96
+95
+95
+96
+107
+87
+77
+74
+77
+72
+67
+58
+43
+22
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+8
+41
+76
+96
+105
+107
+105
+100
+92
+83
+74
+73
+78
+91
+111
+138
+171
+186
+194
+198
+199
+198
+194
+190
+186
+181
+171
+157
+140
+121
+101
+78
+67
+59
+55
+52
+51
+51
+51
+50
+50
+50
+51
+51
+51
+51
+52
+52
+52
+52
+52
+51
+51
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+49
+49
+49
+49
+49
+48
+48
+48
+48
+48
+48
+48
+48
+48
+49
+49
+49
+50
+50
+50
+50
+51
+51
+52
+52
+53
+54
+56
+57
+58
+59
+60
+62
+69
+83
+102
+123
+145
+161
+164
+164
+161
+154
+144
+138
+132
+119
+92
+38
+15
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+96
+96
+96
+96
+96
+97
+98
+97
+95
+95
+103
+101
+83
+69
+75
+69
+61
+47
+29
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+17
+65
+91
+103
+106
+106
+102
+95
+84
+76
+72
+74
+86
+107
+133
+161
+188
+195
+198
+199
+198
+195
+190
+186
+181
+174
+158
+139
+118
+98
+79
+63
+57
+54
+52
+51
+51
+50
+50
+50
+50
+50
+51
+51
+51
+52
+52
+52
+52
+52
+51
+51
+50
+50
+50
+50
+50
+49
+49
+49
+49
+49
+49
+48
+48
+48
+47
+47
+47
+47
+47
+46
+46
+46
+46
+46
+46
+47
+47
+47
+48
+49
+49
+50
+50
+50
+51
+51
+51
+52
+53
+55
+56
+57
+58
+59
+61
+65
+75
+91
+114
+147
+159
+164
+164
+163
+155
+145
+139
+133
+125
+79
+36
+12
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+96
+96
+96
+96
+96
+97
+99
+99
+98
+95
+96
+103
+90
+72
+66
+65
+53
+36
+19
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+16
+42
+92
+101
+105
+106
+103
+94
+83
+75
+71
+72
+85
+108
+135
+162
+185
+198
+199
+198
+197
+195
+189
+184
+178
+170
+157
+132
+110
+90
+74
+62
+54
+53
+52
+51
+51
+50
+50
+50
+50
+50
+51
+51
+52
+52
+52
+52
+52
+51
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+48
+48
+47
+47
+47
+47
+47
+46
+46
+46
+46
+46
+45
+45
+45
+45
+45
+45
+45
+46
+46
+47
+48
+49
+50
+50
+51
+51
+51
+52
+53
+54
+56
+57
+59
+60
+62
+66
+74
+101
+126
+146
+160
+165
+164
+159
+150
+142
+136
+124
+88
+48
+15
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+96
+96
+96
+95
+95
+97
+99
+101
+101
+97
+96
+102
+98
+86
+65
+57
+49
+34
+18
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+10
+30
+64
+99
+104
+105
+103
+99
+87
+77
+72
+72
+76
+101
+129
+156
+179
+194
+199
+199
+197
+195
+191
+184
+178
+169
+157
+139
+111
+91
+75
+63
+56
+53
+52
+51
+51
+50
+50
+50
+50
+50
+51
+52
+52
+52
+52
+52
+52
+51
+50
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+48
+48
+47
+47
+47
+47
+47
+47
+47
+47
+46
+46
+46
+46
+46
+45
+45
+45
+45
+45
+45
+45
+45
+46
+46
+48
+49
+50
+50
+51
+51
+52
+52
+53
+54
+57
+58
+60
+62
+65
+77
+95
+117
+138
+156
+164
+163
+159
+152
+143
+133
+117
+85
+47
+13
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+95
+95
+95
+95
+95
+97
+99
+101
+103
+101
+96
+99
+101
+94
+72
+50
+41
+29
+16
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+19
+45
+82
+103
+105
+104
+100
+94
+80
+73
+72
+75
+86
+120
+149
+173
+190
+199
+199
+198
+195
+191
+186
+179
+170
+158
+141
+120
+91
+75
+64
+56
+53
+52
+51
+50
+50
+50
+50
+50
+50
+51
+51
+52
+52
+52
+52
+52
+51
+50
+50
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+47
+47
+47
+47
+46
+46
+45
+45
+44
+44
+44
+44
+45
+45
+46
+47
+49
+50
+51
+51
+51
+52
+53
+54
+56
+58
+59
+61
+66
+75
+91
+111
+134
+156
+162
+162
+159
+152
+141
+132
+113
+83
+42
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+95
+95
+95
+95
+95
+97
+99
+101
+104
+104
+98
+98
+100
+98
+84
+48
+34
+22
+13
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+8
+30
+60
+95
+105
+105
+102
+96
+88
+74
+71
+73
+82
+100
+139
+167
+186
+197
+200
+198
+196
+192
+187
+181
+172
+160
+143
+123
+100
+75
+63
+56
+53
+52
+51
+50
+50
+50
+49
+50
+50
+51
+52
+52
+53
+53
+52
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+48
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+47
+47
+46
+45
+45
+44
+44
+44
+44
+44
+45
+46
+48
+49
+50
+51
+51
+51
+52
+53
+55
+57
+59
+61
+64
+72
+85
+105
+137
+153
+161
+162
+160
+149
+141
+132
+114
+80
+25
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+95
+95
+94
+95
+95
+97
+99
+102
+104
+106
+103
+98
+99
+101
+98
+57
+33
+17
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+15
+43
+76
+101
+106
+103
+98
+91
+81
+70
+70
+77
+92
+117
+159
+183
+195
+200
+200
+196
+193
+188
+183
+176
+164
+147
+126
+104
+82
+63
+56
+53
+52
+51
+50
+50
+49
+49
+49
+50
+51
+52
+52
+53
+53
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+48
+48
+48
+48
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+50
+51
+51
+50
+50
+49
+47
+46
+45
+44
+44
+44
+44
+44
+44
+45
+47
+48
+50
+51
+51
+51
+52
+53
+54
+56
+59
+61
+63
+68
+77
+106
+134
+152
+162
+163
+160
+150
+140
+131
+119
+59
+22
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+94
+94
+95
+95
+99
+102
+104
+105
+107
+107
+102
+100
+100
+103
+89
+47
+20
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+27
+61
+92
+104
+105
+100
+93
+83
+73
+68
+74
+88
+111
+142
+182
+194
+200
+200
+198
+193
+188
+182
+175
+167
+147
+125
+102
+82
+65
+55
+53
+52
+51
+50
+49
+49
+49
+49
+50
+51
+52
+53
+53
+53
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+48
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+51
+51
+51
+52
+52
+52
+51
+50
+48
+46
+44
+44
+43
+43
+43
+44
+45
+47
+48
+50
+51
+51
+52
+52
+52
+55
+58
+60
+62
+64
+73
+93
+119
+143
+160
+163
+161
+153
+143
+133
+115
+66
+28
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+94
+94
+95
+96
+101
+103
+105
+107
+107
+108
+105
+102
+100
+102
+97
+67
+34
+9
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+9
+39
+72
+97
+104
+104
+96
+87
+78
+70
+69
+79
+99
+127
+160
+191
+198
+200
+198
+195
+190
+183
+177
+168
+157
+131
+108
+87
+70
+58
+53
+52
+51
+50
+49
+49
+49
+49
+50
+51
+52
+53
+53
+53
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+47
+47
+46
+46
+46
+46
+46
+47
+47
+48
+48
+49
+50
+51
+51
+52
+52
+53
+53
+52
+52
+50
+48
+46
+45
+44
+43
+43
+44
+44
+46
+47
+50
+51
+51
+52
+52
+53
+54
+57
+59
+62
+66
+75
+91
+114
+140
+159
+161
+159
+153
+142
+127
+101
+61
+23
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+94
+94
+95
+97
+102
+104
+106
+107
+108
+109
+108
+104
+101
+102
+101
+84
+51
+18
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+16
+51
+81
+100
+103
+102
+92
+82
+74
+69
+72
+87
+113
+144
+176
+198
+200
+199
+196
+192
+186
+179
+171
+160
+145
+115
+92
+74
+62
+55
+52
+51
+50
+50
+49
+49
+49
+50
+50
+52
+53
+53
+53
+53
+53
+51
+50
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+47
+46
+46
+45
+44
+44
+44
+44
+44
+45
+45
+46
+47
+48
+48
+50
+50
+51
+52
+52
+53
+53
+54
+53
+53
+51
+50
+48
+46
+44
+43
+43
+43
+44
+45
+47
+49
+50
+51
+52
+52
+53
+54
+56
+59
+62
+66
+74
+89
+112
+145
+156
+160
+159
+152
+136
+122
+92
+53
+15
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+94
+94
+96
+98
+103
+105
+107
+107
+108
+109
+109
+106
+103
+101
+102
+96
+68
+32
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+25
+63
+88
+102
+103
+99
+88
+78
+72
+69
+75
+97
+127
+160
+188
+202
+200
+198
+194
+189
+181
+174
+164
+150
+131
+99
+79
+65
+56
+53
+51
+51
+50
+49
+49
+49
+49
+50
+51
+53
+53
+54
+53
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+46
+45
+44
+43
+43
+43
+43
+43
+43
+44
+44
+45
+46
+46
+47
+48
+49
+50
+51
+52
+52
+53
+54
+54
+54
+54
+54
+53
+51
+49
+47
+44
+44
+43
+43
+44
+45
+47
+49
+50
+51
+52
+52
+52
+54
+56
+60
+62
+66
+72
+85
+120
+143
+156
+161
+160
+146
+135
+116
+86
+38
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+92
+93
+94
+96
+100
+105
+106
+107
+108
+108
+109
+109
+108
+106
+101
+102
+101
+83
+52
+12
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+33
+74
+95
+102
+103
+95
+83
+75
+70
+69
+80
+109
+143
+174
+197
+203
+199
+195
+191
+185
+177
+168
+155
+138
+116
+84
+68
+58
+54
+52
+51
+50
+49
+49
+49
+49
+50
+51
+52
+53
+54
+54
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+49
+48
+47
+45
+43
+42
+42
+42
+42
+42
+43
+43
+43
+44
+44
+45
+46
+47
+47
+48
+49
+50
+51
+52
+52
+53
+54
+54
+54
+55
+55
+55
+54
+53
+51
+47
+45
+44
+43
+43
+43
+44
+46
+48
+50
+52
+52
+52
+52
+53
+56
+60
+62
+65
+69
+88
+119
+143
+158
+162
+158
+144
+132
+112
+77
+15
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+92
+93
+95
+97
+102
+106
+107
+107
+107
+108
+108
+109
+109
+108
+103
+102
+102
+96
+77
+35
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+8
+49
+83
+98
+101
+101
+90
+79
+73
+70
+71
+91
+128
+162
+188
+201
+202
+196
+192
+187
+180
+170
+158
+142
+121
+96
+69
+59
+54
+52
+51
+50
+49
+48
+48
+48
+49
+51
+52
+53
+54
+54
+53
+53
+52
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+50
+49
+47
+44
+43
+42
+41
+42
+42
+42
+43
+43
+44
+45
+46
+47
+47
+48
+49
+49
+49
+50
+50
+51
+51
+52
+52
+53
+54
+54
+54
+55
+55
+55
+55
+55
+54
+52
+50
+47
+45
+43
+43
+43
+44
+45
+47
+50
+51
+52
+52
+52
+53
+55
+58
+62
+64
+69
+83
+109
+137
+157
+161
+157
+145
+131
+118
+57
+20
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+92
+94
+96
+99
+103
+107
+107
+107
+107
+107
+107
+108
+109
+108
+106
+102
+102
+100
+86
+54
+10
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+13
+60
+88
+99
+101
+100
+85
+76
+71
+70
+73
+102
+142
+174
+195
+202
+201
+194
+189
+183
+175
+164
+150
+130
+107
+83
+62
+56
+53
+52
+51
+49
+48
+48
+48
+49
+50
+52
+53
+54
+54
+54
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+49
+48
+46
+43
+42
+41
+41
+41
+42
+43
+44
+45
+46
+47
+48
+48
+49
+49
+50
+50
+50
+50
+50
+51
+51
+52
+52
+53
+53
+54
+54
+55
+55
+55
+55
+55
+55
+55
+54
+52
+50
+48
+46
+44
+43
+43
+44
+45
+48
+50
+51
+52
+52
+53
+54
+55
+58
+62
+66
+72
+86
+108
+138
+159
+159
+154
+143
+127
+94
+46
+16
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+92
+94
+96
+100
+104
+107
+107
+107
+107
+106
+106
+107
+108
+109
+108
+103
+103
+102
+94
+73
+17
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+6
+19
+69
+91
+100
+100
+98
+82
+74
+70
+71
+77
+115
+155
+183
+199
+202
+199
+191
+186
+180
+171
+157
+140
+118
+94
+73
+57
+54
+52
+51
+50
+49
+48
+48
+48
+49
+51
+52
+53
+54
+54
+54
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+49
+48
+46
+43
+41
+41
+41
+41
+42
+44
+45
+46
+47
+48
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+52
+52
+53
+54
+54
+55
+55
+55
+55
+55
+55
+55
+55
+54
+52
+50
+48
+45
+44
+43
+43
+44
+45
+48
+50
+51
+52
+53
+53
+54
+56
+58
+63
+66
+73
+87
+111
+146
+157
+158
+152
+140
+116
+75
+37
+9
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+92
+94
+97
+101
+105
+107
+107
+107
+107
+106
+105
+106
+107
+109
+109
+104
+103
+102
+99
+88
+29
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+8
+25
+77
+94
+100
+99
+95
+78
+72
+69
+72
+82
+128
+167
+190
+201
+202
+196
+188
+182
+176
+166
+150
+129
+106
+83
+64
+54
+53
+51
+50
+49
+48
+48
+48
+49
+50
+51
+53
+53
+54
+54
+53
+52
+51
+50
+50
+49
+49
+49
+49
+49
+49
+49
+50
+50
+50
+50
+48
+46
+43
+41
+40
+41
+42
+43
+44
+46
+48
+48
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+52
+53
+54
+54
+55
+55
+55
+55
+55
+55
+55
+55
+54
+53
+51
+47
+45
+44
+43
+43
+44
+46
+48
+50
+52
+53
+53
+53
+54
+56
+60
+63
+67
+73
+85
+124
+147
+157
+158
+152
+130
+103
+62
+24
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+95
+98
+102
+106
+107
+107
+107
+106
+105
+104
+105
+106
+108
+109
+105
+103
+103
+101
+97
+46
+16
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+11
+32
+84
+96
+100
+98
+93
+75
+70
+68
+73
+89
+141
+177
+196
+202
+201
+193
+186
+179
+172
+162
+141
+118
+94
+73
+59
+53
+52
+51
+50
+48
+48
+48
+48
+49
+50
+52
+53
+53
+54
+54
+53
+52
+51
+50
+50
+50
+49
+49
+49
+49
+49
+50
+50
+50
+50
+49
+46
+43
+41
+40
+40
+41
+43
+45
+47
+48
+49
+49
+49
+50
+50
+50
+50
+50
+50
+51
+51
+51
+50
+50
+50
+50
+49
+49
+49
+50
+51
+53
+53
+54
+55
+55
+55
+55
+55
+55
+55
+55
+54
+53
+50
+47
+45
+44
+43
+43
+44
+46
+48
+50
+52
+53
+53
+54
+54
+57
+61
+64
+67
+71
+93
+127
+149
+160
+160
+142
+126
+90
+47
+10
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+95
+98
+103
+107
+107
+107
+106
+106
+105
+103
+104
+105
+106
+109
+107
+104
+103
+102
+101
+65
+27
+8
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+15
+42
+90
+97
+100
+97
+88
+72
+69
+69
+78
+100
+157
+186
+199
+202
+201
+189
+182
+175
+166
+154
+128
+103
+81
+64
+55
+52
+51
+50
+49
+48
+48
+48
+49
+49
+51
+53
+53
+53
+53
+53
+53
+51
+50
+50
+50
+50
+50
+49
+49
+50
+50
+50
+50
+50
+50
+46
+42
+40
+40
+40
+42
+44
+46
+48
+48
+49
+49
+49
+50
+50
+51
+52
+53
+54
+55
+56
+56
+55
+54
+53
+51
+50
+49
+49
+48
+47
+47
+48
+50
+51
+53
+54
+54
+55
+55
+55
+55
+55
+55
+54
+52
+50
+48
+46
+44
+43
+44
+44
+46
+48
+51
+52
+53
+53
+54
+55
+58
+61
+64
+67
+73
+92
+122
+149
+161
+159
+140
+120
+88
+35
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+95
+99
+103
+107
+107
+107
+106
+105
+104
+103
+103
+104
+105
+108
+107
+104
+103
+102
+102
+78
+34
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+19
+49
+93
+98
+99
+95
+85
+70
+68
+70
+82
+109
+167
+190
+200
+201
+199
+186
+179
+171
+161
+147
+118
+93
+73
+59
+54
+52
+51
+50
+48
+48
+48
+48
+49
+50
+51
+53
+53
+53
+53
+53
+52
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+48
+42
+40
+40
+40
+41
+44
+46
+47
+48
+48
+49
+49
+50
+51
+53
+58
+62
+67
+71
+74
+77
+77
+76
+74
+71
+65
+60
+56
+52
+49
+47
+47
+47
+47
+48
+50
+51
+53
+54
+54
+55
+55
+55
+55
+54
+53
+52
+50
+47
+45
+44
+44
+44
+45
+46
+49
+51
+52
+53
+54
+55
+57
+59
+62
+65
+69
+78
+99
+126
+154
+161
+153
+136
+108
+68
+15
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+95
+99
+103
+107
+107
+107
+106
+105
+103
+103
+103
+103
+105
+108
+108
+104
+103
+103
+102
+87
+42
+15
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+7
+23
+55
+94
+98
+98
+94
+83
+69
+68
+72
+87
+118
+175
+194
+201
+201
+197
+183
+176
+168
+156
+139
+108
+85
+67
+56
+53
+51
+50
+49
+48
+48
+48
+48
+49
+50
+51
+53
+53
+53
+53
+53
+52
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+49
+45
+40
+39
+39
+40
+42
+46
+47
+48
+48
+48
+49
+51
+53
+58
+64
+73
+80
+86
+91
+96
+100
+101
+101
+100
+97
+91
+84
+76
+69
+61
+54
+50
+48
+46
+47
+48
+49
+51
+52
+53
+54
+54
+54
+54
+54
+54
+53
+51
+49
+47
+45
+44
+44
+44
+45
+48
+50
+52
+53
+53
+54
+56
+58
+60
+63
+67
+71
+82
+103
+134
+160
+159
+147
+127
+99
+34
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+96
+99
+104
+107
+107
+107
+106
+104
+103
+102
+102
+103
+104
+108
+108
+104
+103
+103
+102
+93
+50
+20
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+2
+3
+5
+6
+7
+7
+6
+5
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+8
+26
+61
+95
+98
+98
+93
+81
+69
+68
+73
+91
+126
+183
+196
+201
+200
+195
+181
+173
+164
+151
+131
+99
+77
+62
+55
+53
+51
+50
+49
+48
+48
+48
+49
+49
+50
+51
+52
+53
+53
+53
+53
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+49
+47
+42
+39
+39
+40
+41
+44
+47
+47
+48
+48
+48
+50
+54
+60
+68
+77
+88
+96
+102
+108
+112
+117
+119
+121
+121
+121
+117
+111
+103
+94
+83
+69
+61
+54
+50
+47
+47
+48
+49
+50
+52
+53
+53
+54
+54
+54
+54
+53
+52
+50
+48
+46
+44
+44
+44
+44
+46
+49
+51
+52
+53
+54
+55
+57
+59
+62
+66
+68
+72
+84
+108
+150
+159
+155
+142
+122
+61
+25
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+96
+99
+104
+107
+107
+107
+106
+104
+103
+102
+102
+102
+104
+108
+108
+105
+103
+103
+103
+97
+58
+25
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+4
+5
+6
+6
+6
+6
+5
+5
+4
+4
+4
+6
+8
+14
+18
+21
+21
+19
+14
+9
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+10
+29
+67
+96
+98
+97
+91
+79
+68
+68
+75
+95
+134
+189
+198
+202
+199
+192
+179
+170
+160
+145
+123
+90
+70
+59
+54
+52
+51
+49
+48
+48
+48
+48
+49
+50
+50
+51
+52
+52
+53
+53
+52
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+48
+45
+40
+39
+39
+40
+43
+46
+47
+47
+47
+48
+49
+54
+62
+71
+82
+90
+98
+103
+108
+112
+116
+120
+123
+125
+127
+129
+131
+131
+129
+124
+114
+96
+82
+69
+58
+50
+47
+47
+47
+48
+50
+52
+52
+53
+53
+54
+54
+53
+53
+51
+50
+47
+45
+44
+44
+44
+45
+47
+50
+52
+53
+54
+54
+56
+58
+61
+65
+68
+70
+74
+82
+127
+153
+161
+154
+134
+93
+44
+15
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+96
+99
+103
+107
+107
+107
+106
+104
+102
+102
+102
+102
+104
+108
+108
+105
+103
+103
+103
+100
+65
+30
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+9
+14
+23
+30
+36
+41
+44
+45
+44
+41
+37
+33
+28
+27
+28
+32
+41
+57
+69
+76
+79
+79
+71
+57
+41
+25
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+12
+34
+74
+97
+98
+96
+90
+77
+68
+68
+76
+99
+143
+193
+200
+202
+198
+189
+176
+167
+154
+137
+113
+80
+64
+56
+53
+52
+50
+49
+48
+48
+48
+48
+49
+50
+51
+51
+52
+52
+52
+52
+52
+51
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+49
+46
+42
+39
+38
+39
+42
+45
+46
+47
+47
+47
+49
+53
+63
+73
+81
+87
+92
+99
+103
+107
+109
+112
+115
+118
+121
+125
+128
+132
+133
+134
+134
+134
+130
+119
+104
+88
+71
+56
+50
+48
+47
+48
+50
+51
+52
+53
+53
+53
+53
+53
+52
+51
+49
+47
+45
+44
+43
+44
+46
+48
+50
+53
+54
+54
+55
+57
+59
+65
+67
+69
+70
+73
+90
+129
+152
+160
+156
+125
+77
+37
+10
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+95
+99
+103
+107
+107
+107
+106
+105
+103
+102
+102
+103
+105
+108
+108
+104
+102
+102
+103
+101
+69
+33
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+10
+20
+32
+44
+55
+65
+70
+74
+77
+79
+80
+79
+78
+76
+73
+69
+65
+64
+67
+73
+85
+91
+95
+97
+98
+96
+90
+82
+70
+53
+25
+12
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+14
+38
+78
+97
+98
+96
+89
+76
+67
+68
+77
+102
+149
+195
+200
+202
+197
+187
+174
+164
+150
+131
+106
+74
+61
+54
+52
+52
+50
+48
+48
+48
+48
+48
+49
+50
+50
+51
+51
+52
+52
+52
+52
+51
+50
+50
+50
+50
+50
+50
+50
+50
+51
+50
+48
+44
+40
+38
+38
+40
+43
+46
+46
+46
+47
+48
+51
+57
+68
+75
+81
+87
+90
+92
+91
+89
+87
+86
+86
+89
+93
+98
+105
+116
+123
+129
+133
+135
+135
+132
+126
+116
+100
+76
+63
+54
+49
+47
+48
+50
+51
+52
+52
+53
+53
+53
+52
+52
+50
+48
+46
+45
+44
+44
+45
+47
+49
+52
+54
+54
+55
+56
+58
+63
+67
+69
+70
+72
+79
+105
+135
+158
+161
+138
+104
+61
+23
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+95
+98
+103
+107
+107
+107
+107
+105
+103
+103
+102
+104
+106
+109
+108
+103
+102
+102
+104
+102
+72
+35
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+12
+23
+41
+53
+64
+73
+80
+86
+88
+90
+92
+93
+94
+94
+93
+93
+92
+90
+88
+88
+89
+92
+98
+101
+103
+105
+105
+105
+104
+101
+95
+85
+64
+43
+23
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+16
+42
+81
+97
+98
+96
+88
+75
+67
+68
+78
+104
+152
+196
+201
+202
+197
+185
+172
+162
+146
+125
+99
+69
+59
+54
+52
+51
+49
+48
+48
+48
+48
+49
+49
+50
+50
+51
+51
+51
+52
+51
+51
+51
+50
+50
+50
+50
+50
+50
+50
+51
+51
+50
+47
+43
+39
+38
+38
+41
+44
+46
+46
+46
+46
+49
+53
+60
+70
+75
+79
+81
+80
+75
+70
+67
+64
+62
+62
+64
+66
+70
+75
+86
+96
+106
+117
+127
+135
+137
+136
+132
+124
+103
+84
+68
+57
+50
+48
+49
+50
+51
+52
+53
+53
+53
+52
+52
+50
+49
+47
+45
+44
+44
+44
+46
+48
+51
+53
+54
+54
+55
+57
+61
+67
+70
+71
+72
+74
+87
+115
+145
+162
+152
+125
+85
+42
+11
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+95
+98
+102
+107
+107
+107
+107
+106
+104
+103
+103
+105
+107
+109
+108
+103
+101
+102
+104
+103
+74
+37
+7
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+11
+22
+36
+53
+74
+83
+88
+90
+91
+91
+91
+91
+92
+93
+94
+95
+96
+96
+97
+99
+99
+99
+100
+101
+103
+104
+105
+105
+106
+106
+106
+105
+105
+104
+97
+79
+54
+29
+9
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+19
+45
+84
+98
+98
+95
+88
+74
+67
+68
+79
+106
+155
+197
+202
+202
+196
+183
+170
+159
+142
+120
+93
+65
+57
+53
+52
+51
+49
+48
+48
+48
+48
+49
+49
+50
+50
+51
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+50
+50
+50
+51
+51
+50
+46
+41
+38
+37
+39
+42
+45
+46
+46
+46
+47
+49
+55
+61
+69
+73
+73
+71
+65
+56
+52
+49
+47
+47
+47
+47
+48
+49
+51
+57
+65
+76
+90
+105
+123
+131
+136
+139
+139
+128
+110
+90
+71
+57
+49
+49
+49
+50
+51
+52
+52
+53
+52
+52
+51
+49
+48
+46
+45
+44
+44
+45
+47
+50
+53
+54
+54
+55
+56
+60
+66
+70
+73
+73
+73
+76
+95
+125
+157
+162
+142
+107
+66
+23
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+95
+97
+101
+106
+107
+107
+108
+107
+105
+104
+105
+107
+109
+109
+106
+101
+101
+102
+105
+103
+75
+38
+8
+3
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+13
+34
+57
+77
+87
+90
+91
+92
+91
+90
+86
+84
+84
+83
+84
+87
+90
+93
+95
+98
+100
+101
+102
+103
+103
+104
+105
+105
+105
+105
+105
+105
+106
+106
+106
+105
+103
+93
+69
+28
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+21
+48
+85
+98
+98
+95
+88
+74
+67
+67
+79
+107
+156
+198
+202
+201
+195
+182
+168
+157
+138
+115
+88
+62
+56
+53
+52
+51
+49
+48
+48
+48
+48
+49
+49
+50
+50
+50
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+50
+50
+51
+51
+51
+49
+44
+40
+38
+37
+39
+43
+45
+46
+46
+46
+47
+50
+55
+61
+67
+67
+64
+57
+48
+45
+44
+44
+43
+43
+44
+44
+44
+44
+45
+45
+47
+50
+55
+66
+92
+114
+129
+139
+142
+142
+135
+118
+95
+71
+53
+50
+49
+49
+50
+52
+52
+52
+52
+52
+51
+50
+49
+47
+45
+44
+44
+45
+46
+49
+53
+54
+54
+55
+56
+59
+64
+70
+74
+76
+74
+74
+80
+101
+144
+164
+152
+128
+92
+41
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+92
+95
+97
+100
+106
+107
+107
+108
+108
+108
+107
+108
+108
+109
+109
+103
+100
+100
+102
+105
+102
+73
+37
+9
+6
+7
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+13
+31
+68
+82
+88
+90
+91
+88
+82
+75
+70
+65
+62
+61
+61
+62
+64
+68
+73
+79
+86
+93
+100
+102
+103
+104
+104
+104
+103
+103
+103
+102
+102
+102
+102
+103
+104
+105
+105
+104
+100
+90
+30
+10
+2
+1
+1
+3
+3
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+23
+51
+85
+98
+98
+95
+88
+75
+67
+67
+79
+107
+156
+198
+202
+201
+195
+181
+165
+153
+134
+109
+83
+59
+55
+52
+51
+50
+48
+48
+48
+48
+48
+49
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+51
+51
+51
+51
+49
+43
+39
+37
+37
+40
+44
+45
+45
+45
+45
+46
+50
+54
+59
+59
+57
+51
+46
+44
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+44
+45
+46
+51
+64
+85
+110
+133
+143
+145
+142
+131
+108
+73
+59
+52
+49
+50
+51
+52
+52
+52
+52
+52
+51
+49
+48
+46
+45
+44
+44
+45
+47
+51
+53
+54
+55
+55
+58
+62
+69
+75
+80
+79
+76
+76
+83
+103
+158
+163
+151
+121
+75
+20
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+92
+94
+96
+99
+106
+107
+107
+108
+108
+108
+109
+109
+109
+109
+108
+101
+100
+100
+102
+105
+101
+69
+36
+12
+9
+9
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+11
+29
+50
+69
+82
+87
+88
+86
+82
+74
+69
+65
+62
+60
+58
+57
+58
+59
+61
+65
+70
+77
+85
+93
+100
+101
+102
+102
+102
+103
+102
+102
+102
+102
+101
+100
+99
+99
+99
+101
+102
+103
+103
+100
+73
+34
+12
+2
+1
+2
+7
+9
+8
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+24
+52
+85
+98
+98
+95
+88
+75
+67
+68
+78
+106
+156
+198
+202
+201
+194
+180
+164
+151
+131
+105
+79
+58
+54
+52
+51
+50
+48
+48
+48
+48
+49
+49
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+48
+42
+38
+37
+37
+41
+44
+45
+45
+45
+45
+46
+49
+53
+55
+55
+51
+47
+44
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+44
+44
+46
+50
+59
+74
+97
+130
+141
+145
+142
+133
+101
+76
+61
+52
+50
+50
+51
+52
+52
+52
+52
+51
+50
+49
+47
+45
+44
+44
+45
+46
+51
+53
+54
+55
+55
+57
+61
+67
+73
+81
+83
+80
+77
+78
+85
+140
+159
+156
+136
+103
+38
+14
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+91
+94
+96
+98
+105
+107
+107
+107
+108
+109
+109
+109
+109
+108
+106
+100
+99
+100
+102
+104
+99
+65
+35
+15
+13
+12
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+20
+39
+57
+73
+84
+86
+85
+82
+78
+73
+66
+63
+60
+58
+57
+56
+56
+57
+58
+60
+64
+70
+77
+85
+94
+100
+101
+101
+102
+102
+102
+102
+101
+100
+98
+97
+96
+95
+95
+95
+96
+97
+99
+101
+103
+95
+66
+36
+11
+3
+3
+8
+15
+20
+19
+12
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+5
+24
+52
+85
+98
+98
+95
+88
+76
+67
+68
+77
+103
+154
+198
+202
+201
+194
+180
+164
+150
+128
+103
+76
+57
+54
+52
+51
+50
+48
+48
+48
+48
+49
+49
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+48
+41
+38
+37
+37
+41
+44
+45
+45
+45
+45
+45
+48
+50
+51
+51
+47
+45
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+44
+47
+54
+67
+101
+125
+139
+146
+145
+126
+99
+76
+59
+52
+50
+51
+51
+52
+52
+52
+52
+51
+49
+48
+45
+45
+44
+45
+46
+50
+53
+54
+55
+55
+56
+60
+65
+72
+81
+86
+84
+81
+78
+77
+113
+148
+159
+150
+127
+61
+26
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+89
+93
+95
+97
+104
+106
+106
+107
+108
+109
+109
+109
+108
+106
+103
+99
+98
+100
+103
+104
+96
+60
+33
+18
+17
+13
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+8
+19
+47
+69
+79
+82
+83
+82
+79
+74
+70
+67
+63
+61
+59
+58
+57
+56
+56
+56
+58
+60
+65
+71
+78
+87
+95
+101
+101
+102
+102
+103
+102
+100
+97
+95
+93
+91
+90
+90
+91
+92
+93
+93
+95
+97
+101
+102
+93
+66
+34
+11
+5
+7
+17
+29
+36
+29
+17
+8
+3
+1
+1
+1
+1
+1
+1
+1
+5
+23
+52
+85
+98
+98
+95
+89
+76
+67
+68
+76
+100
+151
+198
+202
+202
+194
+180
+163
+149
+126
+100
+74
+56
+53
+52
+51
+50
+48
+48
+48
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+48
+41
+38
+37
+37
+41
+43
+44
+44
+44
+44
+45
+47
+48
+49
+48
+45
+44
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+45
+48
+68
+99
+124
+141
+148
+144
+123
+97
+72
+56
+51
+51
+51
+52
+52
+52
+52
+51
+50
+48
+46
+45
+45
+45
+45
+49
+52
+54
+55
+55
+56
+59
+65
+72
+81
+88
+88
+85
+81
+76
+88
+132
+156
+161
+145
+86
+42
+15
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+88
+93
+95
+97
+102
+106
+106
+106
+106
+108
+108
+108
+107
+104
+99
+97
+97
+100
+103
+104
+93
+55
+32
+22
+20
+11
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+8
+24
+56
+77
+81
+82
+81
+78
+72
+70
+68
+66
+64
+63
+61
+59
+58
+57
+56
+56
+57
+59
+62
+67
+72
+79
+88
+96
+103
+105
+105
+104
+103
+99
+94
+90
+87
+85
+84
+84
+85
+87
+90
+92
+92
+93
+93
+95
+101
+102
+97
+76
+32
+10
+11
+15
+26
+50
+53
+40
+22
+7
+2
+1
+1
+1
+1
+1
+1
+4
+22
+50
+83
+98
+98
+96
+89
+77
+67
+67
+74
+97
+146
+198
+203
+202
+195
+180
+163
+148
+125
+99
+73
+56
+53
+52
+51
+50
+48
+48
+48
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+48
+41
+38
+36
+37
+41
+43
+44
+44
+44
+44
+44
+45
+47
+47
+46
+44
+44
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+43
+42
+42
+42
+42
+42
+42
+42
+42
+43
+43
+47
+67
+97
+127
+145
+149
+142
+120
+92
+65
+52
+51
+51
+51
+52
+52
+52
+51
+50
+49
+46
+45
+45
+45
+45
+48
+51
+54
+55
+55
+56
+58
+64
+71
+79
+90
+91
+89
+85
+79
+77
+115
+148
+165
+157
+113
+61
+26
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+85
+92
+94
+96
+100
+106
+106
+106
+105
+105
+106
+106
+104
+100
+96
+96
+97
+100
+103
+103
+84
+50
+32
+25
+22
+8
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+18
+46
+72
+80
+79
+75
+73
+72
+71
+69
+68
+67
+66
+65
+64
+63
+61
+59
+57
+56
+56
+59
+62
+66
+70
+78
+89
+99
+106
+107
+106
+104
+100
+95
+86
+83
+81
+80
+80
+80
+81
+83
+86
+89
+91
+92
+92
+92
+93
+94
+100
+102
+101
+96
+53
+30
+23
+26
+32
+64
+66
+58
+39
+12
+2
+1
+1
+1
+1
+1
+3
+18
+44
+79
+97
+98
+96
+91
+79
+67
+67
+72
+91
+136
+195
+202
+202
+196
+182
+164
+147
+124
+98
+71
+55
+53
+52
+51
+49
+49
+48
+49
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+48
+42
+38
+36
+36
+40
+42
+44
+44
+44
+44
+44
+44
+45
+45
+45
+44
+44
+44
+44
+44
+44
+44
+44
+43
+43
+43
+42
+42
+42
+42
+42
+41
+40
+40
+39
+40
+40
+41
+42
+43
+46
+63
+91
+128
+147
+148
+141
+123
+90
+59
+53
+51
+51
+52
+52
+52
+52
+51
+49
+47
+46
+45
+45
+45
+47
+51
+53
+55
+55
+56
+57
+63
+70
+77
+90
+93
+94
+92
+85
+76
+87
+123
+157
+164
+142
+92
+48
+16
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+83
+92
+94
+95
+98
+106
+106
+106
+104
+103
+103
+103
+100
+97
+96
+95
+98
+101
+103
+102
+76
+46
+32
+26
+21
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+24
+52
+69
+76
+76
+74
+73
+72
+72
+73
+71
+69
+68
+67
+67
+66
+64
+61
+59
+57
+57
+58
+62
+66
+70
+80
+92
+100
+105
+107
+106
+103
+97
+91
+85
+80
+78
+76
+75
+74
+75
+77
+80
+83
+87
+91
+92
+92
+92
+93
+94
+96
+99
+101
+101
+89
+71
+51
+36
+37
+51
+65
+67
+59
+40
+9
+3
+1
+1
+1
+1
+2
+15
+39
+75
+97
+98
+97
+92
+81
+68
+67
+70
+87
+127
+191
+202
+203
+197
+183
+165
+148
+125
+98
+71
+55
+53
+52
+51
+49
+49
+48
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+49
+42
+38
+36
+36
+39
+42
+43
+44
+43
+43
+43
+44
+44
+45
+45
+45
+44
+44
+44
+44
+44
+44
+44
+43
+43
+42
+42
+42
+41
+41
+41
+40
+39
+38
+37
+37
+38
+39
+41
+42
+44
+51
+68
+101
+139
+146
+146
+136
+113
+72
+59
+53
+52
+52
+52
+52
+52
+51
+50
+48
+46
+45
+45
+45
+47
+50
+53
+55
+55
+56
+57
+62
+70
+77
+89
+94
+97
+95
+91
+79
+80
+108
+142
+165
+155
+115
+69
+28
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+81
+91
+94
+95
+97
+105
+106
+106
+105
+102
+101
+100
+98
+96
+95
+96
+99
+101
+102
+99
+67
+44
+32
+26
+17
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+6
+18
+52
+70
+75
+75
+73
+74
+77
+77
+76
+75
+73
+70
+69
+69
+68
+66
+64
+61
+59
+58
+59
+62
+67
+72
+78
+90
+100
+105
+107
+106
+102
+96
+89
+83
+78
+73
+71
+69
+68
+68
+70
+72
+76
+80
+84
+90
+91
+92
+92
+93
+94
+95
+96
+99
+101
+101
+93
+79
+64
+51
+50
+61
+68
+68
+60
+28
+11
+3
+1
+1
+1
+2
+11
+32
+69
+95
+97
+97
+93
+83
+68
+67
+69
+83
+117
+186
+200
+204
+198
+185
+166
+149
+126
+99
+72
+55
+53
+51
+51
+49
+49
+49
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+50
+43
+39
+36
+36
+38
+41
+42
+43
+43
+43
+43
+43
+44
+44
+45
+44
+44
+44
+44
+44
+44
+44
+43
+43
+42
+42
+41
+40
+40
+40
+40
+39
+38
+37
+36
+35
+35
+36
+38
+41
+42
+45
+54
+75
+124
+141
+147
+143
+131
+89
+67
+56
+52
+52
+52
+52
+52
+52
+51
+48
+47
+45
+45
+45
+46
+50
+53
+55
+56
+56
+57
+62
+69
+77
+87
+95
+98
+98
+96
+84
+79
+94
+123
+161
+161
+135
+90
+44
+12
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+79
+90
+94
+94
+95
+104
+105
+106
+105
+102
+99
+98
+97
+96
+96
+97
+100
+101
+100
+93
+59
+41
+31
+24
+12
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+6
+18
+42
+74
+75
+74
+72
+75
+80
+84
+85
+82
+76
+73
+71
+70
+69
+68
+66
+64
+61
+60
+60
+63
+67
+72
+78
+86
+99
+104
+106
+105
+103
+95
+87
+81
+75
+71
+66
+63
+62
+62
+63
+65
+68
+72
+76
+81
+88
+90
+92
+92
+93
+95
+95
+95
+96
+98
+100
+100
+98
+90
+71
+60
+60
+66
+71
+72
+51
+25
+9
+3
+1
+1
+1
+8
+26
+61
+94
+97
+97
+94
+86
+70
+67
+68
+79
+107
+179
+198
+204
+199
+187
+167
+150
+127
+100
+73
+55
+53
+51
+51
+49
+49
+49
+49
+49
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+50
+45
+40
+37
+36
+37
+39
+41
+42
+43
+43
+43
+43
+43
+44
+44
+44
+44
+44
+44
+44
+44
+43
+43
+42
+41
+40
+40
+40
+39
+39
+39
+38
+38
+37
+34
+33
+33
+33
+35
+40
+41
+43
+46
+55
+103
+132
+144
+147
+143
+108
+78
+61
+53
+52
+52
+52
+52
+52
+51
+49
+47
+46
+45
+45
+46
+49
+53
+55
+56
+56
+57
+61
+68
+77
+86
+94
+99
+100
+100
+90
+81
+84
+106
+153
+164
+150
+111
+64
+21
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+77
+90
+94
+94
+94
+102
+105
+106
+105
+102
+99
+97
+96
+96
+96
+98
+100
+101
+97
+86
+50
+37
+29
+20
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+16
+39
+71
+76
+72
+70
+74
+84
+92
+92
+90
+86
+77
+73
+71
+70
+70
+68
+66
+64
+63
+62
+62
+66
+70
+77
+85
+94
+104
+105
+105
+103
+96
+84
+78
+72
+67
+61
+58
+58
+59
+60
+61
+62
+64
+67
+72
+77
+85
+89
+91
+92
+93
+95
+96
+96
+95
+94
+94
+95
+95
+94
+93
+77
+69
+67
+71
+76
+73
+46
+22
+6
+2
+1
+1
+5
+19
+52
+91
+96
+97
+95
+89
+72
+67
+67
+75
+96
+170
+196
+205
+201
+190
+170
+152
+129
+102
+75
+55
+53
+51
+51
+49
+49
+49
+49
+49
+50
+50
+50
+50
+50
+50
+50
+49
+49
+50
+50
+50
+51
+51
+51
+51
+51
+51
+51
+51
+51
+51
+46
+41
+37
+36
+37
+38
+40
+41
+42
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+44
+43
+42
+41
+40
+40
+40
+39
+39
+39
+39
+38
+38
+37
+36
+33
+32
+31
+31
+32
+37
+40
+42
+44
+46
+78
+119
+140
+147
+147
+126
+91
+68
+55
+52
+52
+52
+52
+52
+52
+49
+47
+46
+45
+45
+46
+49
+52
+55
+56
+56
+57
+61
+67
+77
+86
+93
+99
+102
+102
+96
+84
+81
+95
+138
+164
+159
+130
+86
+34
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+75
+89
+93
+93
+94
+99
+103
+105
+106
+105
+100
+98
+97
+97
+97
+100
+100
+99
+92
+74
+43
+30
+22
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+15
+43
+68
+75
+71
+70
+77
+87
+98
+101
+100
+95
+88
+81
+74
+73
+73
+72
+71
+67
+65
+64
+64
+66
+74
+85
+95
+103
+107
+106
+101
+95
+87
+79
+71
+65
+59
+56
+55
+56
+56
+56
+56
+55
+56
+57
+60
+64
+69
+77
+84
+88
+90
+92
+94
+97
+98
+98
+98
+97
+95
+93
+92
+91
+90
+83
+77
+74
+75
+79
+75
+54
+28
+7
+1
+1
+3
+12
+36
+84
+94
+97
+96
+92
+75
+69
+67
+71
+83
+155
+190
+204
+203
+193
+173
+156
+133
+106
+78
+56
+53
+51
+51
+50
+49
+49
+49
+49
+50
+50
+50
+50
+50
+50
+50
+49
+49
+50
+50
+50
+51
+51
+52
+52
+51
+51
+51
+51
+52
+51
+49
+44
+39
+37
+37
+38
+38
+39
+39
+41
+42
+42
+43
+43
+43
+43
+43
+43
+42
+41
+40
+40
+40
+40
+40
+40
+40
+40
+39
+39
+39
+38
+37
+36
+33
+31
+29
+29
+29
+33
+38
+41
+43
+44
+56
+96
+127
+145
+147
+140
+109
+81
+60
+53
+52
+52
+52
+52
+52
+50
+48
+47
+46
+46
+46
+49
+52
+55
+56
+56
+57
+60
+67
+76
+86
+91
+98
+102
+103
+102
+90
+83
+87
+109
+160
+161
+147
+114
+58
+12
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+73
+88
+93
+93
+93
+97
+101
+104
+106
+106
+102
+101
+100
+99
+99
+100
+100
+96
+85
+65
+35
+25
+17
+9
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+9
+37
+59
+72
+73
+70
+74
+85
+96
+104
+106
+104
+99
+93
+87
+81
+79
+77
+75
+72
+68
+67
+69
+74
+84
+93
+99
+101
+102
+102
+95
+88
+83
+77
+70
+59
+56
+53
+52
+51
+51
+50
+51
+51
+53
+54
+55
+57
+59
+63
+70
+77
+82
+86
+89
+92
+95
+97
+98
+99
+99
+99
+98
+97
+95
+93
+90
+84
+78
+76
+78
+77
+69
+51
+23
+3
+1
+2
+8
+24
+74
+91
+96
+96
+94
+79
+70
+67
+69
+77
+139
+182
+202
+204
+196
+177
+160
+137
+110
+81
+57
+53
+51
+51
+50
+49
+49
+49
+49
+50
+50
+51
+50
+50
+50
+50
+49
+49
+49
+50
+50
+51
+51
+52
+52
+52
+51
+51
+51
+52
+52
+50
+46
+41
+38
+37
+38
+38
+38
+38
+39
+40
+40
+41
+41
+42
+42
+41
+41
+40
+39
+39
+39
+40
+40
+40
+41
+41
+42
+42
+42
+42
+41
+40
+38
+34
+31
+29
+28
+28
+31
+36
+40
+42
+44
+51
+82
+116
+141
+147
+143
+120
+91
+66
+54
+53
+53
+53
+52
+52
+51
+49
+47
+46
+46
+46
+49
+52
+55
+56
+57
+57
+60
+66
+76
+85
+90
+96
+101
+104
+103
+95
+86
+84
+94
+151
+159
+154
+130
+80
+21
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+72
+87
+93
+93
+92
+95
+98
+103
+106
+106
+104
+102
+101
+101
+101
+101
+99
+91
+75
+53
+27
+20
+12
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+24
+53
+68
+73
+71
+70
+80
+92
+102
+107
+108
+105
+101
+97
+91
+86
+83
+81
+77
+74
+72
+77
+82
+89
+96
+101
+101
+98
+95
+92
+85
+78
+70
+63
+57
+51
+48
+47
+45
+44
+44
+44
+46
+48
+50
+52
+53
+54
+55
+57
+63
+69
+75
+81
+84
+87
+90
+93
+95
+98
+100
+101
+101
+100
+99
+97
+96
+92
+88
+83
+80
+79
+76
+67
+45
+11
+4
+2
+5
+15
+62
+86
+95
+96
+95
+82
+72
+67
+68
+73
+122
+173
+198
+205
+199
+180
+164
+141
+115
+85
+59
+54
+52
+51
+50
+49
+49
+49
+49
+50
+51
+51
+51
+50
+50
+50
+50
+49
+50
+50
+50
+51
+51
+52
+52
+52
+51
+51
+51
+52
+52
+51
+49
+44
+39
+38
+38
+38
+38
+38
+38
+38
+39
+39
+39
+40
+39
+39
+39
+39
+39
+39
+40
+40
+41
+43
+44
+44
+45
+45
+46
+46
+45
+44
+42
+37
+32
+29
+28
+28
+29
+34
+39
+42
+43
+48
+71
+105
+136
+147
+145
+128
+101
+73
+56
+53
+53
+53
+53
+52
+51
+49
+47
+46
+46
+47
+49
+52
+55
+56
+57
+57
+60
+66
+76
+85
+89
+94
+99
+104
+104
+99
+90
+83
+86
+138
+156
+158
+142
+102
+33
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+71
+87
+92
+92
+92
+93
+96
+101
+105
+106
+105
+103
+102
+102
+102
+101
+96
+83
+64
+40
+20
+14
+8
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+8
+44
+65
+73
+72
+69
+73
+87
+98
+106
+109
+108
+106
+103
+100
+95
+90
+87
+84
+82
+80
+81
+89
+95
+100
+101
+100
+96
+90
+85
+79
+72
+65
+57
+51
+46
+44
+42
+40
+38
+37
+37
+39
+41
+43
+46
+48
+50
+51
+52
+53
+56
+61
+67
+73
+78
+82
+85
+87
+91
+94
+98
+100
+101
+102
+101
+101
+100
+99
+97
+92
+84
+82
+80
+76
+66
+26
+10
+3
+4
+8
+48
+79
+93
+96
+96
+86
+74
+68
+67
+70
+107
+161
+192
+205
+202
+185
+168
+146
+120
+90
+61
+55
+52
+51
+50
+49
+49
+49
+49
+50
+51
+51
+51
+51
+50
+50
+50
+50
+50
+50
+50
+51
+51
+52
+52
+52
+52
+51
+51
+51
+52
+52
+51
+48
+42
+39
+38
+38
+38
+38
+38
+38
+38
+38
+38
+38
+38
+38
+38
+38
+39
+40
+41
+42
+44
+45
+46
+47
+47
+48
+49
+49
+49
+49
+47
+41
+34
+30
+28
+28
+29
+33
+38
+41
+43
+46
+63
+96
+130
+146
+146
+134
+108
+79
+58
+53
+53
+53
+53
+53
+51
+49
+48
+47
+47
+47
+50
+53
+55
+57
+57
+58
+60
+66
+75
+85
+88
+93
+97
+103
+104
+102
+93
+85
+84
+122
+151
+160
+150
+123
+48
+18
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+70
+86
+92
+92
+91
+91
+92
+98
+104
+106
+105
+104
+103
+103
+102
+101
+88
+71
+50
+28
+13
+9
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+6
+19
+63
+72
+73
+71
+69
+76
+92
+103
+108
+110
+108
+107
+105
+102
+99
+95
+92
+91
+90
+91
+96
+98
+99
+99
+98
+93
+89
+83
+75
+65
+52
+46
+43
+42
+40
+37
+35
+35
+34
+34
+34
+35
+36
+38
+40
+44
+46
+48
+48
+49
+50
+53
+58
+65
+71
+78
+80
+82
+84
+87
+94
+98
+101
+102
+102
+101
+101
+100
+99
+98
+91
+86
+83
+81
+78
+51
+20
+7
+4
+5
+32
+69
+88
+96
+96
+89
+77
+70
+67
+68
+92
+147
+185
+204
+204
+189
+173
+152
+126
+96
+64
+56
+52
+51
+50
+49
+49
+49
+49
+50
+51
+51
+51
+51
+51
+50
+50
+50
+50
+50
+50
+51
+51
+52
+52
+52
+52
+51
+51
+51
+52
+52
+52
+50
+47
+40
+39
+39
+39
+39
+38
+38
+38
+38
+38
+38
+38
+38
+38
+39
+41
+43
+44
+46
+47
+47
+48
+48
+48
+48
+49
+51
+52
+52
+51
+46
+38
+32
+28
+28
+29
+33
+38
+41
+43
+45
+58
+89
+124
+145
+146
+138
+114
+85
+61
+54
+53
+53
+53
+53
+52
+50
+48
+47
+47
+47
+50
+53
+56
+57
+57
+58
+61
+66
+75
+85
+88
+91
+95
+101
+104
+103
+96
+87
+83
+107
+145
+159
+156
+140
+66
+27
+8
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+69
+86
+91
+91
+91
+89
+88
+92
+98
+105
+106
+105
+105
+103
+101
+89
+71
+50
+30
+14
+7
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+16
+42
+73
+75
+72
+68
+68
+79
+95
+104
+109
+109
+109
+108
+107
+106
+105
+103
+102
+101
+100
+100
+99
+98
+97
+93
+86
+72
+63
+55
+48
+43
+40
+38
+37
+36
+35
+35
+34
+34
+34
+34
+34
+34
+34
+35
+37
+40
+42
+44
+45
+45
+45
+45
+47
+51
+56
+66
+72
+77
+80
+81
+84
+90
+95
+99
+101
+101
+101
+101
+101
+102
+101
+97
+92
+87
+85
+76
+46
+21
+6
+6
+16
+52
+79
+94
+95
+93
+81
+72
+67
+67
+78
+124
+169
+201
+207
+195
+180
+160
+136
+105
+69
+58
+53
+51
+50
+49
+49
+49
+49
+49
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+50
+50
+51
+52
+52
+52
+52
+52
+51
+51
+51
+52
+52
+52
+51
+46
+42
+40
+40
+40
+40
+40
+39
+39
+39
+39
+40
+41
+42
+44
+46
+46
+47
+47
+47
+48
+48
+48
+48
+48
+49
+51
+53
+53
+53
+50
+41
+34
+30
+29
+30
+33
+38
+41
+43
+45
+55
+84
+118
+144
+146
+140
+119
+91
+64
+54
+54
+53
+53
+53
+52
+50
+49
+48
+48
+48
+51
+54
+56
+57
+57
+58
+61
+67
+75
+84
+87
+89
+92
+97
+103
+103
+99
+91
+84
+93
+135
+155
+159
+153
+92
+42
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+68
+85
+91
+91
+90
+88
+85
+85
+90
+100
+103
+103
+101
+97
+91
+74
+53
+33
+17
+9
+6
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+9
+27
+59
+75
+74
+70
+67
+67
+80
+95
+104
+108
+109
+109
+108
+108
+107
+106
+104
+102
+101
+100
+99
+96
+91
+82
+72
+62
+51
+46
+43
+40
+38
+37
+37
+37
+38
+38
+38
+38
+38
+38
+37
+36
+35
+35
+35
+36
+38
+40
+41
+43
+43
+43
+43
+43
+44
+46
+52
+58
+64
+71
+75
+80
+83
+89
+94
+98
+99
+100
+100
+100
+100
+101
+99
+96
+93
+89
+84
+66
+39
+15
+7
+12
+38
+67
+89
+95
+94
+85
+75
+68
+67
+72
+107
+153
+193
+207
+199
+185
+167
+143
+114
+75
+61
+54
+51
+50
+49
+49
+49
+49
+49
+50
+51
+51
+51
+51
+51
+51
+50
+50
+50
+50
+50
+51
+52
+53
+53
+52
+52
+52
+51
+51
+52
+52
+52
+52
+50
+46
+43
+42
+41
+41
+42
+42
+42
+42
+43
+43
+44
+45
+46
+47
+47
+47
+47
+48
+48
+48
+48
+49
+49
+50
+52
+54
+55
+55
+51
+42
+35
+31
+30
+31
+35
+39
+42
+43
+45
+54
+83
+117
+143
+146
+141
+121
+93
+66
+55
+54
+53
+53
+53
+52
+51
+49
+48
+48
+49
+51
+54
+57
+57
+58
+58
+61
+67
+76
+83
+85
+87
+89
+94
+102
+103
+100
+94
+84
+89
+126
+150
+161
+157
+110
+55
+21
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+67
+84
+90
+91
+90
+89
+82
+79
+81
+89
+94
+95
+91
+84
+75
+51
+33
+20
+11
+7
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+17
+40
+70
+77
+72
+68
+66
+67
+80
+94
+103
+108
+109
+108
+108
+108
+107
+105
+103
+101
+99
+95
+90
+79
+70
+61
+53
+46
+41
+40
+39
+39
+40
+41
+42
+43
+44
+44
+45
+45
+44
+43
+42
+40
+38
+37
+36
+35
+37
+38
+40
+41
+42
+42
+42
+42
+42
+42
+44
+48
+52
+57
+63
+69
+74
+80
+87
+94
+98
+99
+99
+99
+99
+100
+100
+99
+96
+93
+90
+80
+56
+30
+11
+11
+27
+55
+82
+94
+94
+88
+79
+70
+66
+69
+92
+137
+181
+205
+203
+191
+174
+152
+123
+82
+65
+55
+52
+50
+49
+49
+49
+49
+49
+50
+51
+52
+52
+52
+52
+52
+51
+51
+50
+50
+50
+51
+52
+53
+53
+53
+52
+52
+51
+51
+52
+52
+52
+52
+52
+50
+47
+45
+43
+42
+43
+43
+43
+44
+44
+45
+45
+46
+46
+47
+47
+47
+47
+48
+48
+48
+49
+49
+50
+51
+54
+55
+56
+56
+51
+42
+35
+31
+31
+32
+36
+39
+42
+43
+45
+55
+83
+117
+143
+145
+141
+121
+94
+66
+55
+54
+53
+53
+53
+52
+51
+50
+49
+49
+49
+52
+55
+57
+58
+58
+58
+62
+68
+76
+82
+84
+85
+87
+91
+100
+102
+101
+96
+85
+87
+117
+144
+161
+160
+126
+69
+29
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+67
+84
+90
+90
+90
+89
+81
+74
+71
+75
+80
+80
+74
+65
+53
+28
+17
+11
+8
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+7
+27
+53
+75
+77
+70
+66
+65
+66
+80
+93
+101
+106
+107
+107
+107
+106
+104
+102
+98
+94
+89
+82
+72
+58
+50
+44
+41
+40
+40
+41
+42
+43
+44
+47
+48
+49
+49
+50
+50
+50
+50
+49
+48
+45
+43
+40
+38
+36
+36
+37
+38
+39
+41
+41
+41
+41
+41
+41
+41
+42
+43
+45
+49
+57
+62
+69
+76
+85
+94
+97
+98
+99
+99
+99
+100
+100
+99
+96
+93
+89
+73
+48
+18
+12
+19
+44
+72
+92
+93
+91
+82
+72
+66
+67
+81
+119
+166
+202
+205
+195
+181
+160
+132
+90
+69
+58
+52
+50
+49
+49
+49
+49
+49
+50
+51
+52
+52
+53
+53
+53
+52
+51
+51
+51
+51
+51
+52
+53
+53
+53
+53
+52
+52
+51
+51
+52
+52
+52
+52
+52
+51
+49
+47
+45
+44
+44
+44
+45
+45
+46
+46
+46
+47
+47
+47
+48
+48
+48
+49
+49
+50
+50
+51
+54
+56
+57
+57
+57
+51
+41
+35
+32
+32
+33
+37
+40
+43
+44
+46
+58
+86
+119
+143
+145
+140
+120
+93
+66
+55
+54
+54
+53
+53
+52
+51
+50
+49
+49
+50
+53
+56
+58
+58
+58
+59
+62
+68
+77
+81
+82
+83
+84
+87
+98
+101
+101
+97
+87
+86
+109
+138
+160
+161
+139
+83
+39
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+66
+83
+89
+90
+90
+89
+81
+71
+64
+62
+63
+58
+50
+39
+26
+17
+14
+10
+7
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+12
+37
+63
+78
+77
+68
+65
+64
+65
+78
+90
+98
+103
+105
+105
+103
+102
+99
+95
+86
+76
+66
+56
+48
+43
+42
+41
+41
+41
+45
+46
+48
+49
+49
+49
+50
+50
+50
+51
+51
+52
+52
+52
+52
+50
+48
+45
+42
+39
+36
+36
+37
+38
+40
+40
+41
+41
+41
+41
+41
+41
+41
+41
+42
+44
+47
+53
+60
+69
+84
+92
+96
+98
+98
+99
+99
+100
+99
+99
+96
+94
+87
+68
+32
+15
+17
+33
+59
+87
+93
+92
+85
+76
+67
+66
+73
+103
+146
+195
+205
+200
+188
+169
+143
+99
+75
+61
+53
+51
+50
+49
+49
+49
+49
+50
+51
+52
+53
+54
+54
+54
+53
+52
+51
+51
+51
+51
+52
+53
+53
+53
+53
+53
+52
+51
+51
+51
+52
+52
+53
+53
+52
+52
+50
+48
+47
+46
+46
+46
+46
+46
+46
+47
+47
+48
+48
+48
+48
+49
+50
+50
+51
+52
+53
+56
+58
+58
+58
+57
+48
+39
+34
+32
+32
+34
+38
+41
+43
+44
+47
+61
+91
+122
+143
+144
+138
+118
+91
+66
+55
+54
+54
+53
+53
+53
+51
+50
+50
+50
+51
+54
+57
+58
+58
+58
+59
+62
+69
+77
+80
+80
+81
+82
+84
+95
+100
+101
+98
+89
+86
+102
+132
+158
+162
+149
+97
+49
+14
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+66
+82
+88
+89
+89
+90
+87
+74
+60
+53
+49
+41
+35
+30
+24
+17
+14
+9
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+22
+50
+74
+80
+75
+67
+63
+63
+63
+71
+79
+84
+87
+88
+87
+81
+76
+70
+62
+53
+48
+45
+44
+43
+43
+44
+45
+47
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+51
+52
+52
+53
+54
+54
+54
+54
+52
+49
+46
+41
+38
+36
+36
+37
+39
+39
+40
+40
+40
+40
+40
+40
+40
+41
+41
+42
+43
+45
+48
+60
+75
+87
+95
+98
+99
+99
+99
+100
+99
+98
+97
+95
+85
+64
+23
+20
+25
+42
+74
+92
+92
+89
+82
+70
+66
+68
+85
+119
+175
+206
+204
+195
+180
+158
+114
+86
+67
+56
+51
+50
+49
+49
+49
+48
+49
+51
+52
+53
+54
+55
+55
+55
+54
+53
+52
+52
+52
+52
+53
+54
+54
+54
+53
+53
+52
+51
+51
+51
+51
+52
+52
+53
+53
+53
+53
+52
+51
+50
+49
+49
+48
+48
+48
+48
+49
+49
+49
+50
+51
+52
+52
+53
+54
+56
+59
+59
+59
+57
+53
+43
+37
+34
+34
+34
+37
+41
+43
+45
+45
+50
+70
+101
+129
+144
+144
+134
+112
+85
+63
+55
+54
+54
+54
+54
+53
+52
+51
+51
+51
+52
+56
+58
+58
+59
+59
+59
+63
+70
+77
+78
+78
+78
+78
+80
+91
+98
+100
+98
+91
+85
+95
+124
+154
+162
+156
+114
+65
+23
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+65
+81
+87
+88
+88
+90
+88
+79
+66
+54
+49
+42
+37
+32
+27
+19
+15
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+9
+33
+59
+78
+81
+74
+66
+62
+61
+61
+65
+69
+72
+72
+71
+68
+62
+58
+54
+50
+47
+45
+44
+44
+45
+46
+47
+48
+48
+49
+49
+48
+48
+48
+48
+48
+48
+48
+49
+50
+51
+52
+53
+55
+56
+57
+57
+55
+53
+50
+46
+42
+39
+37
+36
+37
+38
+38
+39
+39
+40
+40
+40
+40
+40
+41
+41
+41
+42
+43
+48
+56
+68
+82
+93
+98
+99
+99
+100
+100
+99
+98
+97
+92
+82
+39
+27
+25
+35
+59
+88
+91
+90
+85
+74
+66
+67
+76
+102
+154
+200
+204
+200
+188
+169
+127
+96
+74
+59
+52
+50
+49
+49
+49
+48
+49
+50
+52
+53
+55
+56
+56
+56
+56
+55
+53
+53
+53
+53
+53
+54
+54
+54
+54
+53
+52
+51
+51
+51
+51
+51
+52
+52
+53
+53
+53
+53
+53
+52
+52
+51
+51
+51
+51
+51
+51
+51
+52
+52
+53
+53
+54
+55
+56
+58
+59
+59
+58
+55
+49
+39
+36
+35
+35
+36
+40
+43
+44
+45
+46
+54
+80
+110
+135
+144
+143
+129
+105
+80
+61
+55
+54
+54
+54
+54
+53
+52
+52
+52
+52
+54
+57
+58
+59
+59
+59
+59
+64
+70
+77
+77
+76
+75
+76
+77
+88
+96
+99
+98
+92
+85
+92
+120
+150
+163
+159
+125
+76
+31
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+65
+80
+86
+87
+87
+89
+89
+84
+73
+59
+52
+47
+41
+36
+32
+22
+16
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+15
+43
+67
+81
+82
+73
+65
+61
+60
+59
+60
+61
+61
+60
+58
+55
+51
+49
+47
+45
+45
+45
+45
+46
+47
+48
+48
+49
+49
+48
+48
+48
+48
+48
+47
+47
+47
+48
+48
+49
+51
+52
+54
+55
+57
+58
+59
+59
+57
+55
+50
+46
+43
+40
+37
+37
+37
+38
+38
+39
+39
+39
+39
+40
+40
+40
+40
+40
+41
+41
+43
+46
+54
+65
+80
+93
+97
+99
+99
+100
+99
+98
+98
+96
+92
+59
+36
+28
+32
+46
+82
+88
+90
+87
+79
+67
+66
+70
+88
+129
+191
+202
+202
+195
+179
+141
+108
+82
+64
+54
+50
+50
+49
+49
+48
+49
+50
+51
+53
+55
+57
+57
+57
+57
+57
+55
+54
+54
+54
+54
+54
+54
+54
+54
+54
+53
+52
+51
+51
+51
+51
+51
+52
+52
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+53
+54
+54
+55
+56
+57
+58
+59
+60
+58
+55
+50
+44
+37
+36
+36
+36
+38
+42
+44
+45
+46
+48
+63
+92
+119
+139
+144
+141
+122
+97
+74
+59
+55
+54
+54
+54
+54
+53
+52
+52
+52
+53
+56
+58
+59
+59
+59
+59
+60
+65
+71
+76
+76
+74
+74
+73
+74
+85
+94
+98
+97
+93
+85
+90
+115
+145
+163
+161
+135
+88
+39
+8
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+64
+79
+85
+86
+86
+89
+89
+87
+80
+66
+57
+53
+48
+43
+39
+27
+17
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+22
+53
+74
+83
+83
+72
+65
+61
+59
+57
+56
+55
+54
+52
+50
+48
+46
+46
+45
+45
+45
+46
+47
+48
+48
+49
+49
+49
+49
+49
+49
+48
+48
+47
+47
+47
+47
+48
+48
+49
+52
+54
+55
+57
+58
+60
+61
+61
+61
+59
+54
+50
+47
+43
+40
+37
+37
+37
+38
+38
+39
+39
+39
+39
+39
+39
+39
+39
+40
+40
+41
+42
+44
+50
+62
+82
+92
+97
+99
+99
+99
+99
+98
+98
+96
+78
+49
+35
+32
+38
+72
+85
+89
+88
+83
+69
+66
+67
+78
+105
+176
+197
+204
+200
+189
+155
+122
+93
+70
+57
+51
+50
+49
+49
+48
+48
+49
+51
+53
+55
+58
+58
+59
+58
+58
+57
+56
+55
+55
+55
+55
+55
+55
+55
+55
+54
+52
+51
+51
+51
+50
+51
+51
+51
+52
+53
+53
+53
+53
+53
+54
+54
+54
+54
+54
+54
+54
+55
+55
+55
+56
+58
+59
+59
+60
+59
+56
+51
+45
+40
+36
+36
+37
+38
+41
+44
+45
+46
+48
+52
+75
+105
+128
+142
+144
+137
+113
+88
+68
+57
+55
+54
+54
+54
+54
+53
+53
+53
+53
+54
+58
+59
+60
+60
+59
+59
+60
+65
+71
+76
+76
+73
+72
+71
+72
+82
+93
+97
+97
+93
+85
+88
+111
+141
+163
+162
+143
+98
+48
+11
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+62
+78
+83
+84
+85
+87
+89
+89
+85
+76
+64
+60
+56
+52
+45
+33
+19
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+30
+62
+79
+85
+84
+71
+65
+61
+59
+56
+52
+51
+49
+47
+46
+46
+45
+45
+45
+45
+47
+48
+48
+49
+49
+50
+51
+51
+51
+51
+49
+49
+48
+47
+47
+47
+47
+48
+49
+50
+54
+57
+59
+60
+61
+62
+62
+63
+63
+62
+60
+55
+50
+46
+44
+40
+38
+38
+38
+38
+39
+39
+38
+38
+37
+37
+37
+38
+38
+39
+40
+41
+42
+43
+45
+63
+81
+92
+97
+99
+99
+99
+99
+98
+98
+91
+63
+44
+34
+35
+60
+80
+88
+89
+87
+73
+67
+66
+71
+85
+156
+190
+203
+203
+197
+169
+136
+105
+79
+61
+52
+50
+49
+49
+48
+48
+49
+50
+52
+54
+58
+59
+60
+60
+59
+58
+57
+57
+56
+56
+55
+55
+55
+55
+55
+54
+53
+52
+51
+51
+50
+50
+50
+50
+51
+52
+52
+53
+53
+53
+54
+54
+54
+55
+55
+55
+55
+55
+56
+57
+58
+59
+59
+59
+59
+56
+51
+45
+41
+38
+37
+37
+39
+41
+44
+46
+46
+47
+51
+59
+90
+119
+136
+144
+143
+130
+102
+79
+62
+55
+55
+54
+54
+54
+54
+54
+54
+54
+54
+56
+59
+60
+60
+60
+59
+59
+61
+66
+72
+75
+75
+72
+70
+70
+70
+80
+91
+96
+97
+94
+85
+87
+108
+136
+163
+163
+150
+108
+57
+15
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+60
+75
+81
+82
+82
+85
+88
+89
+88
+83
+72
+66
+62
+58
+52
+39
+21
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+9
+43
+72
+84
+86
+85
+71
+65
+62
+59
+56
+50
+48
+47
+46
+46
+46
+46
+46
+46
+47
+49
+49
+50
+51
+51
+52
+52
+52
+52
+51
+48
+47
+47
+47
+47
+48
+50
+52
+55
+58
+60
+61
+61
+62
+62
+63
+63
+64
+64
+64
+63
+61
+57
+51
+47
+44
+42
+41
+41
+40
+39
+39
+38
+38
+37
+37
+37
+37
+38
+38
+39
+40
+41
+42
+42
+44
+55
+72
+88
+97
+98
+98
+99
+98
+98
+96
+82
+59
+41
+38
+47
+71
+84
+88
+88
+80
+70
+66
+67
+72
+120
+169
+196
+206
+204
+186
+157
+125
+95
+71
+55
+52
+50
+49
+49
+48
+48
+49
+51
+53
+57
+59
+60
+61
+61
+60
+60
+59
+58
+57
+57
+57
+57
+56
+56
+55
+54
+53
+52
+51
+50
+50
+49
+49
+49
+49
+50
+50
+51
+52
+52
+53
+53
+53
+54
+55
+55
+56
+57
+57
+58
+58
+58
+57
+53
+47
+43
+40
+39
+38
+39
+41
+43
+45
+46
+47
+48
+51
+61
+78
+112
+133
+142
+143
+139
+112
+86
+68
+57
+55
+55
+55
+55
+54
+54
+54
+55
+55
+56
+59
+61
+61
+61
+60
+60
+60
+62
+67
+73
+75
+74
+70
+69
+68
+69
+77
+89
+95
+96
+94
+85
+86
+104
+131
+162
+164
+156
+119
+69
+21
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+57
+73
+79
+80
+80
+82
+86
+88
+88
+86
+78
+73
+69
+65
+59
+45
+25
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+14
+52
+77
+86
+87
+85
+71
+65
+62
+60
+56
+50
+48
+46
+46
+45
+46
+46
+47
+48
+49
+50
+50
+51
+51
+52
+52
+51
+51
+49
+48
+47
+46
+47
+48
+49
+53
+55
+57
+58
+59
+60
+61
+61
+62
+62
+63
+63
+63
+63
+63
+63
+63
+60
+57
+52
+46
+44
+43
+42
+41
+40
+40
+39
+38
+37
+37
+37
+38
+38
+38
+39
+40
+41
+41
+42
+42
+46
+55
+69
+88
+97
+98
+98
+98
+98
+97
+90
+70
+50
+40
+44
+63
+78
+87
+88
+83
+73
+67
+66
+68
+98
+149
+184
+202
+206
+196
+172
+142
+110
+82
+60
+54
+51
+49
+49
+48
+48
+49
+50
+52
+56
+58
+60
+61
+62
+62
+61
+60
+60
+59
+58
+58
+58
+58
+57
+57
+55
+54
+52
+51
+50
+49
+49
+49
+48
+48
+49
+49
+50
+50
+51
+51
+52
+52
+53
+54
+54
+55
+56
+56
+56
+55
+52
+49
+46
+43
+41
+40
+40
+40
+42
+44
+45
+46
+47
+48
+51
+60
+76
+97
+127
+138
+142
+138
+129
+96
+75
+62
+56
+55
+55
+55
+55
+55
+55
+55
+56
+57
+58
+60
+62
+62
+61
+60
+60
+60
+62
+68
+73
+74
+73
+70
+68
+68
+68
+76
+88
+94
+95
+93
+84
+86
+102
+128
+161
+165
+159
+126
+79
+27
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+55
+71
+77
+78
+77
+78
+85
+88
+88
+87
+81
+77
+74
+70
+65
+48
+26
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+18
+60
+80
+88
+89
+86
+72
+66
+63
+61
+58
+51
+48
+46
+45
+45
+46
+46
+47
+48
+50
+50
+51
+51
+51
+51
+51
+50
+49
+47
+46
+46
+48
+49
+51
+54
+56
+58
+59
+59
+60
+60
+60
+60
+60
+60
+60
+60
+60
+61
+61
+62
+62
+61
+59
+55
+50
+47
+45
+43
+42
+41
+40
+39
+38
+38
+38
+38
+39
+40
+40
+40
+40
+41
+41
+42
+42
+43
+46
+55
+70
+90
+96
+98
+98
+98
+98
+94
+79
+60
+43
+44
+56
+72
+85
+87
+85
+77
+69
+65
+65
+82
+127
+167
+196
+206
+203
+185
+159
+128
+96
+68
+58
+52
+50
+49
+48
+48
+48
+49
+50
+54
+57
+59
+61
+62
+63
+62
+62
+61
+60
+59
+59
+59
+59
+59
+58
+57
+55
+54
+52
+50
+49
+49
+48
+47
+47
+47
+47
+48
+48
+49
+49
+50
+51
+51
+52
+52
+53
+52
+52
+50
+49
+46
+44
+43
+41
+41
+41
+42
+43
+44
+46
+46
+47
+48
+50
+59
+75
+94
+115
+136
+140
+138
+130
+113
+81
+66
+58
+55
+55
+55
+55
+55
+55
+56
+56
+57
+59
+60
+62
+62
+62
+61
+60
+60
+60
+63
+69
+73
+74
+72
+69
+68
+68
+68
+75
+87
+93
+94
+93
+84
+85
+100
+125
+160
+166
+161
+133
+88
+33
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+52
+68
+74
+75
+74
+75
+82
+87
+88
+88
+84
+81
+77
+73
+68
+48
+25
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+3
+9
+23
+66
+83
+90
+90
+87
+73
+66
+63
+62
+60
+53
+48
+46
+46
+45
+46
+46
+47
+48
+49
+50
+50
+51
+50
+50
+49
+47
+47
+46
+47
+48
+51
+53
+56
+57
+58
+58
+58
+58
+58
+57
+56
+55
+55
+54
+54
+54
+55
+55
+56
+58
+59
+59
+59
+57
+53
+49
+46
+44
+43
+42
+41
+40
+39
+39
+39
+40
+41
+42
+42
+42
+42
+42
+42
+43
+43
+42
+43
+45
+52
+77
+90
+96
+98
+98
+98
+97
+86
+69
+48
+45
+52
+67
+81
+87
+86
+80
+72
+66
+64
+71
+104
+147
+185
+204
+207
+196
+175
+146
+113
+78
+64
+55
+51
+50
+49
+48
+48
+48
+49
+52
+55
+58
+61
+62
+63
+63
+63
+62
+62
+61
+60
+60
+60
+60
+59
+58
+57
+55
+54
+51
+50
+49
+48
+47
+46
+46
+45
+45
+46
+46
+47
+47
+48
+48
+48
+48
+48
+47
+46
+45
+43
+42
+42
+42
+41
+42
+43
+44
+45
+46
+47
+47
+48
+50
+58
+75
+94
+113
+130
+140
+138
+131
+117
+95
+68
+59
+56
+55
+55
+55
+56
+56
+56
+57
+58
+59
+61
+62
+63
+63
+62
+61
+60
+60
+60
+64
+69
+73
+73
+71
+69
+68
+68
+68
+75
+86
+92
+94
+92
+84
+84
+98
+123
+159
+167
+163
+138
+96
+40
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+49
+64
+70
+71
+71
+72
+79
+85
+88
+88
+85
+82
+79
+74
+67
+45
+22
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+3
+10
+26
+72
+86
+91
+91
+88
+74
+67
+64
+63
+61
+55
+50
+47
+46
+45
+46
+46
+47
+48
+49
+50
+49
+49
+48
+47
+46
+46
+46
+47
+50
+54
+56
+57
+58
+58
+58
+57
+55
+54
+52
+49
+48
+47
+47
+46
+46
+46
+47
+47
+48
+51
+52
+54
+56
+56
+55
+51
+48
+46
+44
+43
+42
+41
+40
+40
+40
+42
+43
+44
+44
+44
+44
+45
+45
+45
+44
+43
+43
+43
+44
+57
+78
+91
+97
+98
+98
+97
+91
+77
+54
+46
+49
+62
+77
+86
+86
+83
+75
+67
+63
+66
+84
+123
+167
+200
+208
+203
+189
+165
+133
+92
+72
+60
+53
+50
+49
+49
+48
+48
+48
+50
+53
+56
+60
+62
+63
+64
+64
+63
+63
+62
+61
+61
+61
+60
+60
+59
+58
+57
+55
+53
+51
+49
+48
+47
+45
+44
+44
+43
+42
+42
+42
+42
+42
+42
+42
+42
+41
+41
+41
+41
+41
+41
+41
+42
+43
+44
+45
+46
+47
+47
+48
+48
+50
+54
+75
+97
+115
+129
+138
+139
+132
+118
+99
+76
+59
+56
+55
+55
+56
+56
+56
+57
+58
+59
+60
+61
+63
+63
+63
+63
+63
+61
+60
+60
+61
+66
+70
+73
+73
+70
+68
+68
+68
+68
+74
+85
+91
+93
+91
+83
+84
+96
+121
+158
+168
+165
+143
+104
+47
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+46
+58
+64
+65
+65
+66
+74
+81
+86
+87
+85
+81
+77
+69
+58
+35
+16
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+14
+33
+76
+87
+92
+92
+90
+76
+68
+64
+63
+63
+59
+54
+49
+46
+45
+45
+45
+46
+46
+46
+46
+46
+46
+46
+46
+47
+50
+53
+55
+57
+58
+57
+57
+55
+52
+49
+47
+45
+44
+43
+43
+42
+42
+42
+43
+43
+43
+43
+43
+43
+44
+45
+46
+47
+47
+48
+48
+48
+46
+45
+43
+43
+42
+42
+42
+43
+43
+44
+44
+44
+44
+45
+46
+48
+52
+51
+49
+46
+43
+43
+44
+57
+75
+90
+97
+98
+98
+94
+83
+60
+47
+48
+58
+71
+85
+86
+85
+79
+71
+64
+63
+70
+96
+134
+178
+207
+208
+202
+187
+161
+118
+91
+71
+59
+52
+49
+49
+49
+48
+48
+48
+50
+53
+56
+59
+63
+64
+64
+64
+64
+64
+63
+63
+63
+62
+62
+61
+60
+58
+56
+54
+52
+50
+49
+47
+45
+44
+43
+42
+42
+41
+40
+40
+40
+40
+40
+40
+40
+40
+41
+42
+42
+44
+45
+46
+47
+47
+47
+47
+48
+49
+50
+54
+64
+82
+110
+124
+133
+137
+138
+128
+112
+93
+75
+60
+56
+55
+56
+56
+56
+57
+58
+59
+60
+61
+63
+64
+64
+64
+64
+64
+62
+61
+60
+60
+62
+67
+71
+73
+73
+69
+68
+68
+68
+68
+74
+84
+90
+91
+90
+83
+83
+95
+119
+157
+169
+166
+149
+113
+56
+10
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+43
+53
+58
+60
+60
+60
+66
+75
+81
+83
+82
+78
+71
+61
+48
+25
+11
+3
+1
+1
+1
+1
+1
+1
+1
+1
+2
+6
+16
+37
+79
+88
+92
+92
+91
+79
+69
+64
+63
+63
+61
+58
+54
+49
+47
+46
+46
+46
+46
+46
+46
+46
+47
+48
+51
+54
+56
+57
+57
+57
+54
+51
+49
+47
+45
+44
+43
+42
+42
+42
+42
+42
+42
+42
+42
+42
+43
+43
+43
+43
+44
+44
+45
+45
+46
+46
+46
+45
+45
+44
+43
+43
+43
+43
+43
+44
+44
+44
+45
+45
+45
+45
+46
+49
+55
+58
+57
+53
+48
+44
+43
+48
+62
+80
+94
+98
+97
+94
+84
+63
+47
+48
+56
+68
+83
+86
+85
+81
+74
+66
+62
+66
+81
+110
+155
+195
+205
+207
+198
+180
+140
+110
+86
+68
+57
+51
+50
+49
+48
+48
+48
+48
+50
+52
+55
+59
+62
+63
+64
+65
+64
+64
+64
+64
+64
+64
+63
+62
+61
+59
+56
+54
+52
+50
+48
+46
+45
+44
+43
+42
+41
+41
+41
+41
+41
+41
+42
+43
+44
+45
+46
+46
+47
+47
+47
+48
+48
+48
+48
+49
+52
+60
+73
+90
+109
+128
+133
+136
+136
+130
+109
+91
+75
+63
+57
+55
+56
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+65
+64
+64
+63
+62
+61
+61
+61
+63
+69
+72
+73
+72
+69
+68
+68
+68
+69
+74
+84
+89
+91
+89
+82
+82
+94
+118
+156
+169
+167
+152
+118
+62
+12
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+41
+48
+52
+53
+53
+51
+56
+63
+70
+73
+72
+67
+59
+48
+35
+14
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+18
+39
+81
+89
+93
+93
+91
+81
+70
+65
+63
+63
+63
+61
+58
+55
+52
+49
+48
+48
+48
+49
+50
+51
+53
+54
+56
+57
+56
+55
+53
+50
+47
+46
+44
+43
+42
+42
+41
+41
+41
+41
+42
+42
+42
+42
+42
+42
+43
+43
+43
+43
+43
+44
+44
+45
+45
+45
+45
+45
+44
+44
+44
+44
+44
+44
+44
+44
+45
+45
+45
+45
+46
+47
+49
+52
+58
+65
+65
+63
+57
+49
+44
+45
+53
+67
+87
+96
+96
+94
+85
+64
+47
+48
+54
+66
+81
+86
+86
+83
+77
+69
+63
+63
+71
+91
+129
+178
+198
+207
+206
+196
+163
+132
+104
+81
+64
+54
+51
+50
+49
+48
+48
+48
+48
+50
+52
+56
+59
+61
+63
+64
+64
+64
+64
+64
+64
+64
+64
+64
+63
+62
+59
+58
+56
+54
+52
+50
+48
+47
+46
+45
+45
+44
+44
+44
+45
+45
+46
+46
+47
+47
+48
+48
+48
+48
+48
+48
+48
+49
+51
+56
+67
+83
+99
+114
+127
+136
+136
+133
+125
+112
+89
+74
+64
+57
+55
+56
+57
+57
+58
+59
+61
+62
+63
+64
+65
+65
+65
+65
+64
+64
+63
+62
+61
+61
+61
+65
+70
+72
+73
+72
+68
+68
+68
+68
+69
+73
+83
+88
+89
+88
+81
+82
+93
+118
+156
+170
+168
+155
+124
+68
+14
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+40
+43
+45
+46
+46
+42
+43
+47
+51
+53
+53
+48
+40
+30
+20
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+19
+42
+83
+90
+93
+93
+91
+83
+72
+65
+62
+62
+63
+63
+62
+60
+58
+54
+53
+53
+53
+53
+55
+57
+58
+58
+57
+55
+52
+49
+46
+44
+42
+42
+41
+41
+41
+41
+41
+41
+41
+41
+42
+42
+42
+42
+43
+43
+43
+43
+43
+43
+44
+44
+44
+44
+45
+45
+45
+45
+45
+44
+44
+44
+44
+45
+45
+45
+45
+46
+47
+48
+49
+53
+56
+60
+65
+73
+73
+72
+68
+59
+46
+45
+47
+56
+74
+92
+93
+92
+83
+63
+47
+47
+53
+64
+80
+86
+86
+84
+79
+72
+64
+62
+65
+77
+103
+156
+184
+202
+209
+206
+184
+156
+126
+99
+76
+59
+54
+51
+50
+49
+48
+48
+48
+48
+49
+52
+55
+57
+60
+62
+63
+64
+64
+64
+64
+64
+64
+64
+64
+63
+62
+60
+59
+57
+56
+54
+52
+51
+50
+50
+49
+49
+49
+49
+49
+50
+49
+49
+49
+49
+49
+49
+48
+49
+49
+49
+52
+55
+62
+72
+92
+109
+122
+132
+136
+137
+132
+122
+107
+90
+70
+62
+58
+56
+56
+57
+58
+59
+60
+61
+63
+64
+65
+66
+66
+66
+65
+65
+64
+64
+63
+61
+61
+61
+61
+67
+71
+72
+72
+71
+68
+68
+68
+69
+69
+73
+82
+87
+88
+87
+81
+81
+93
+117
+156
+170
+169
+157
+128
+74
+17
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+38
+39
+39
+39
+39
+31
+29
+27
+26
+24
+22
+17
+12
+7
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+8
+21
+46
+84
+91
+93
+93
+91
+85
+75
+67
+61
+61
+61
+62
+62
+62
+61
+60
+60
+59
+59
+59
+59
+59
+58
+55
+50
+45
+43
+42
+42
+41
+41
+41
+41
+41
+41
+41
+41
+41
+42
+42
+42
+43
+43
+44
+44
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+45
+46
+46
+46
+46
+46
+46
+47
+47
+48
+50
+52
+56
+62
+68
+75
+79
+82
+83
+82
+80
+74
+52
+47
+46
+49
+57
+82
+87
+86
+78
+59
+45
+46
+52
+63
+79
+86
+86
+85
+81
+75
+67
+63
+63
+68
+81
+129
+165
+191
+206
+212
+202
+179
+151
+121
+93
+68
+59
+54
+51
+50
+49
+48
+48
+48
+48
+49
+50
+52
+55
+58
+61
+62
+63
+64
+64
+64
+64
+64
+64
+63
+62
+61
+61
+60
+59
+57
+56
+56
+55
+54
+53
+53
+52
+52
+51
+51
+50
+50
+49
+49
+49
+49
+49
+49
+50
+52
+59
+70
+84
+101
+123
+131
+135
+136
+137
+133
+119
+102
+84
+68
+59
+57
+56
+57
+57
+59
+60
+61
+62
+63
+65
+66
+67
+67
+67
+66
+65
+65
+64
+64
+62
+61
+61
+61
+62
+69
+72
+73
+72
+70
+68
+68
+68
+69
+70
+73
+81
+86
+87
+86
+80
+81
+93
+117
+156
+171
+169
+160
+132
+79
+20
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+37
+36
+34
+32
+30
+25
+22
+18
+15
+13
+8
+7
+5
+3
+3
+2
+2
+1
+1
+1
+1
+1
+2
+2
+3
+3
+5
+11
+24
+47
+85
+91
+93
+93
+92
+86
+77
+68
+61
+57
+58
+59
+61
+61
+61
+61
+60
+59
+58
+56
+49
+44
+42
+42
+42
+41
+41
+41
+41
+40
+40
+41
+41
+41
+41
+42
+43
+45
+46
+48
+50
+52
+54
+55
+56
+58
+58
+58
+58
+58
+58
+57
+56
+55
+53
+52
+51
+51
+50
+50
+50
+50
+51
+52
+53
+56
+59
+62
+66
+71
+80
+86
+92
+98
+105
+106
+103
+99
+95
+92
+73
+56
+48
+47
+49
+59
+66
+67
+63
+52
+44
+44
+51
+63
+79
+87
+87
+85
+82
+78
+70
+65
+62
+62
+65
+94
+131
+165
+191
+207
+212
+202
+184
+158
+129
+93
+74
+61
+54
+51
+49
+49
+48
+48
+48
+48
+48
+48
+49
+50
+52
+54
+56
+57
+59
+60
+61
+61
+62
+62
+61
+61
+60
+59
+58
+57
+56
+56
+55
+54
+53
+52
+52
+51
+50
+50
+49
+49
+49
+49
+49
+50
+52
+57
+64
+81
+97
+112
+125
+133
+135
+136
+136
+132
+124
+101
+83
+71
+63
+59
+57
+57
+58
+59
+60
+61
+63
+64
+65
+67
+68
+68
+68
+67
+67
+66
+65
+65
+64
+63
+62
+61
+61
+62
+65
+71
+72
+72
+72
+70
+68
+68
+69
+70
+71
+73
+80
+84
+86
+85
+80
+80
+92
+117
+156
+171
+170
+162
+137
+86
+23
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+37
+35
+33
+30
+28
+24
+21
+18
+14
+12
+9
+8
+7
+6
+5
+4
+3
+3
+2
+2
+2
+2
+2
+3
+3
+4
+5
+11
+24
+47
+84
+90
+93
+93
+92
+87
+78
+69
+61
+56
+54
+55
+56
+57
+57
+55
+54
+51
+49
+47
+45
+44
+43
+43
+42
+40
+40
+40
+40
+40
+42
+43
+45
+47
+49
+53
+55
+58
+60
+62
+65
+67
+69
+70
+72
+73
+74
+75
+75
+76
+76
+75
+75
+75
+74
+73
+72
+71
+71
+70
+71
+71
+73
+74
+77
+80
+84
+89
+94
+99
+107
+112
+117
+121
+124
+125
+123
+118
+111
+105
+91
+69
+55
+48
+48
+51
+53
+52
+49
+43
+41
+42
+51
+65
+80
+87
+87
+86
+83
+79
+72
+68
+64
+61
+61
+74
+104
+138
+170
+195
+210
+208
+199
+182
+158
+121
+96
+77
+64
+56
+52
+51
+50
+49
+49
+48
+48
+48
+48
+49
+50
+50
+51
+52
+53
+55
+55
+56
+56
+56
+56
+56
+56
+55
+54
+54
+53
+52
+52
+51
+50
+50
+50
+49
+49
+49
+49
+50
+51
+52
+58
+65
+74
+86
+100
+116
+124
+130
+133
+136
+135
+130
+121
+109
+93
+76
+68
+63
+59
+58
+58
+59
+60
+61
+62
+64
+66
+67
+68
+68
+69
+68
+68
+67
+67
+66
+65
+64
+64
+63
+62
+62
+62
+64
+67
+72
+72
+72
+71
+69
+69
+69
+70
+71
+71
+73
+79
+83
+85
+84
+79
+80
+92
+117
+157
+172
+171
+163
+140
+91
+26
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+37
+35
+32
+29
+27
+23
+21
+19
+17
+16
+14
+13
+12
+11
+10
+7
+6
+5
+4
+3
+3
+3
+3
+3
+3
+4
+6
+13
+26
+49
+83
+90
+93
+93
+92
+88
+80
+71
+62
+55
+52
+51
+51
+52
+52
+52
+51
+51
+50
+49
+47
+44
+41
+40
+39
+39
+40
+41
+43
+46
+49
+53
+56
+59
+61
+65
+67
+70
+72
+74
+77
+78
+80
+82
+83
+85
+86
+87
+88
+89
+90
+90
+91
+92
+92
+92
+93
+93
+93
+94
+95
+97
+99
+101
+104
+109
+113
+117
+122
+127
+133
+136
+139
+141
+143
+142
+141
+136
+129
+121
+109
+86
+66
+52
+49
+48
+47
+44
+40
+38
+38
+41
+52
+67
+81
+87
+88
+86
+84
+80
+74
+70
+66
+63
+59
+64
+82
+110
+143
+175
+202
+208
+207
+198
+183
+150
+124
+101
+82
+67
+56
+53
+52
+51
+50
+49
+49
+49
+49
+49
+49
+49
+49
+50
+50
+51
+51
+51
+51
+52
+52
+51
+51
+51
+51
+51
+50
+50
+50
+50
+49
+49
+49
+50
+51
+53
+56
+60
+66
+73
+86
+96
+106
+116
+125
+133
+135
+135
+134
+130
+120
+109
+96
+84
+73
+64
+61
+59
+59
+59
+60
+61
+62
+64
+65
+67
+68
+69
+69
+69
+69
+68
+68
+67
+66
+65
+65
+64
+63
+63
+62
+62
+64
+66
+70
+72
+72
+72
+71
+69
+69
+70
+71
+72
+72
+74
+78
+82
+83
+83
+79
+80
+92
+118
+158
+172
+171
+164
+142
+95
+29
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+36
+34
+31
+28
+27
+24
+23
+22
+21
+21
+20
+20
+19
+17
+16
+14
+11
+9
+7
+5
+4
+3
+3
+4
+4
+5
+8
+15
+29
+52
+83
+90
+93
+93
+93
+90
+83
+73
+63
+55
+50
+49
+48
+48
+49
+50
+51
+51
+51
+49
+46
+41
+37
+36
+37
+39
+42
+45
+49
+54
+60
+64
+67
+70
+73
+75
+77
+79
+81
+82
+84
+86
+88
+89
+91
+93
+94
+96
+97
+99
+100
+102
+103
+105
+106
+108
+110
+111
+113
+115
+117
+120
+123
+126
+130
+135
+139
+143
+146
+150
+153
+156
+157
+159
+159
+158
+156
+153
+147
+137
+126
+105
+81
+60
+50
+48
+45
+40
+36
+35
+36
+41
+55
+70
+83
+88
+88
+87
+85
+82
+77
+72
+69
+65
+60
+60
+66
+85
+114
+148
+186
+201
+208
+208
+201
+178
+155
+130
+106
+85
+66
+59
+55
+52
+51
+50
+50
+49
+49
+49
+49
+49
+49
+49
+49
+49
+48
+48
+48
+48
+49
+49
+49
+49
+49
+49
+49
+50
+50
+51
+52
+54
+56
+59
+63
+70
+77
+85
+94
+105
+119
+127
+134
+137
+138
+136
+133
+128
+122
+113
+95
+82
+72
+66
+62
+60
+60
+59
+60
+61
+62
+64
+65
+67
+68
+70
+70
+70
+70
+70
+69
+68
+68
+67
+66
+65
+65
+64
+63
+63
+63
+64
+66
+68
+71
+72
+72
+71
+70
+69
+69
+71
+73
+73
+74
+74
+78
+81
+82
+81
+79
+80
+92
+119
+160
+172
+172
+165
+144
+100
+31
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+36
+34
+31
+28
+27
+25
+25
+24
+24
+24
+24
+24
+24
+24
+23
+22
+20
+17
+13
+8
+5
+4
+4
+4
+5
+7
+10
+18
+33
+56
+83
+89
+92
+93
+93
+91
+86
+77
+65
+56
+51
+49
+48
+48
+50
+52
+52
+48
+41
+34
+32
+33
+34
+36
+38
+43
+49
+54
+60
+64
+69
+72
+74
+76
+78
+80
+82
+83
+85
+86
+89
+91
+92
+94
+96
+98
+100
+102
+103
+105
+107
+109
+111
+112
+114
+117
+119
+121
+124
+126
+131
+135
+139
+143
+147
+152
+155
+158
+161
+164
+167
+168
+169
+170
+171
+171
+169
+167
+163
+154
+141
+126
+100
+73
+52
+49
+45
+40
+36
+35
+36
+44
+58
+73
+84
+88
+88
+87
+86
+83
+79
+74
+71
+67
+62
+60
+59
+66
+84
+115
+162
+188
+204
+211
+212
+201
+184
+162
+137
+112
+84
+69
+60
+55
+53
+51
+51
+50
+50
+49
+49
+49
+48
+48
+48
+48
+48
+48
+48
+48
+48
+49
+49
+49
+50
+50
+51
+52
+53
+55
+60
+66
+74
+84
+95
+110
+121
+130
+136
+140
+141
+142
+141
+140
+137
+131
+120
+106
+92
+78
+67
+64
+62
+61
+60
+60
+60
+61
+62
+63
+66
+68
+69
+70
+71
+71
+71
+71
+70
+70
+69
+68
+68
+67
+66
+65
+65
+64
+64
+64
+64
+66
+68
+71
+72
+72
+72
+71
+70
+70
+70
+73
+74
+75
+75
+75
+77
+79
+81
+80
+78
+79
+93
+120
+161
+173
+172
+166
+146
+103
+34
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+36
+33
+30
+27
+27
+25
+25
+25
+25
+25
+25
+26
+25
+25
+25
+24
+24
+24
+24
+23
+17
+12
+9
+8
+12
+20
+27
+35
+44
+58
+79
+87
+91
+91
+91
+91
+89
+84
+75
+63
+54
+53
+53
+54
+54
+51
+43
+36
+31
+31
+33
+35
+36
+37
+40
+46
+52
+58
+64
+69
+74
+77
+80
+82
+85
+88
+91
+93
+96
+99
+102
+105
+107
+110
+112
+115
+117
+119
+121
+123
+125
+127
+129
+131
+133
+136
+139
+142
+145
+149
+155
+159
+162
+165
+168
+171
+172
+174
+175
+176
+177
+178
+178
+179
+179
+179
+178
+178
+176
+173
+161
+150
+130
+102
+68
+52
+48
+42
+37
+35
+37
+47
+61
+75
+85
+89
+90
+89
+87
+84
+80
+77
+74
+71
+67
+62
+60
+59
+62
+72
+113
+148
+178
+200
+210
+212
+207
+198
+184
+164
+134
+112
+92
+75
+64
+57
+55
+53
+52
+51
+51
+50
+50
+50
+50
+50
+51
+51
+52
+53
+55
+58
+61
+65
+71
+80
+89
+98
+107
+117
+129
+135
+140
+142
+144
+145
+146
+146
+145
+143
+139
+133
+123
+111
+98
+81
+73
+68
+64
+63
+62
+61
+61
+61
+61
+62
+63
+65
+67
+69
+71
+72
+72
+72
+72
+72
+71
+71
+70
+70
+69
+68
+68
+67
+66
+65
+65
+65
+65
+65
+67
+69
+71
+72
+72
+72
+71
+71
+70
+70
+72
+76
+77
+78
+77
+76
+77
+78
+79
+79
+78
+79
+93
+121
+163
+174
+173
+167
+148
+107
+37
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+37
+33
+30
+27
+26
+25
+25
+26
+26
+26
+27
+27
+28
+27
+27
+25
+24
+24
+24
+24
+23
+22
+21
+20
+22
+35
+45
+52
+57
+63
+77
+84
+89
+90
+90
+90
+89
+86
+81
+72
+63
+60
+58
+57
+54
+44
+36
+32
+32
+33
+35
+36
+37
+38
+40
+48
+55
+63
+69
+75
+81
+84
+88
+91
+94
+98
+101
+104
+107
+110
+114
+116
+119
+121
+124
+127
+129
+131
+134
+136
+139
+142
+145
+148
+152
+157
+161
+165
+168
+171
+174
+175
+176
+177
+177
+178
+179
+179
+179
+180
+180
+180
+180
+180
+180
+180
+180
+180
+180
+179
+173
+164
+150
+126
+92
+59
+51
+45
+41
+38
+39
+47
+61
+75
+86
+91
+91
+91
+89
+86
+81
+77
+75
+73
+70
+66
+62
+60
+59
+62
+80
+109
+140
+170
+195
+209
+210
+207
+201
+193
+175
+157
+139
+121
+104
+87
+78
+71
+67
+64
+62
+62
+63
+64
+66
+70
+74
+79
+85
+91
+99
+106
+112
+118
+123
+128
+131
+135
+138
+141
+143
+144
+144
+144
+143
+139
+134
+127
+120
+112
+100
+92
+85
+79
+74
+68
+65
+63
+62
+62
+61
+61
+62
+63
+64
+66
+68
+70
+71
+72
+73
+73
+73
+73
+73
+72
+72
+71
+71
+70
+69
+68
+68
+67
+67
+66
+66
+67
+67
+68
+70
+71
+72
+72
+72
+72
+71
+71
+71
+71
+74
+79
+80
+80
+79
+77
+77
+78
+78
+78
+77
+79
+94
+123
+165
+174
+173
+168
+150
+110
+39
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+38
+34
+30
+27
+26
+25
+25
+26
+26
+27
+27
+27
+28
+29
+29
+27
+25
+24
+24
+24
+24
+25
+27
+31
+35
+46
+57
+66
+72
+75
+81
+85
+87
+88
+89
+89
+89
+88
+85
+79
+70
+66
+62
+56
+49
+36
+32
+31
+32
+34
+36
+37
+38
+39
+41
+50
+59
+67
+75
+81
+87
+90
+94
+98
+101
+105
+109
+112
+115
+118
+121
+124
+126
+129
+131
+135
+137
+140
+143
+146
+150
+154
+158
+163
+167
+172
+175
+178
+179
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+181
+179
+174
+165
+148
+118
+75
+59
+49
+43
+41
+41
+48
+60
+74
+85
+92
+93
+92
+90
+87
+82
+78
+76
+74
+72
+69
+65
+62
+59
+58
+64
+80
+103
+131
+162
+191
+202
+207
+207
+205
+196
+187
+175
+163
+149
+132
+122
+114
+108
+104
+101
+101
+103
+104
+107
+112
+116
+120
+124
+128
+133
+136
+139
+141
+143
+144
+144
+144
+142
+140
+135
+130
+126
+121
+116
+108
+102
+96
+90
+84
+76
+71
+68
+66
+64
+63
+62
+62
+62
+62
+63
+64
+65
+67
+69
+71
+72
+73
+74
+74
+74
+74
+74
+74
+74
+73
+72
+72
+71
+71
+70
+69
+69
+68
+68
+68
+68
+69
+69
+70
+71
+72
+72
+72
+72
+72
+71
+71
+71
+72
+77
+82
+84
+84
+82
+77
+77
+77
+77
+77
+77
+78
+95
+125
+166
+175
+174
+168
+151
+113
+41
+15
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+40
+36
+32
+28
+26
+25
+25
+25
+26
+26
+26
+26
+27
+29
+30
+29
+26
+24
+23
+23
+23
+24
+28
+34
+39
+47
+59
+71
+81
+85
+86
+86
+87
+87
+88
+88
+88
+87
+86
+83
+76
+69
+62
+53
+42
+32
+31
+31
+32
+35
+37
+38
+39
+40
+43
+54
+64
+72
+79
+85
+91
+95
+99
+103
+107
+112
+115
+118
+121
+124
+128
+131
+133
+136
+139
+143
+146
+149
+152
+155
+161
+166
+171
+175
+178
+182
+183
+183
+183
+183
+182
+182
+182
+181
+181
+181
+181
+182
+182
+182
+182
+182
+182
+182
+182
+181
+181
+181
+181
+181
+181
+180
+176
+165
+145
+98
+72
+55
+47
+44
+44
+49
+59
+73
+85
+93
+94
+94
+92
+89
+84
+80
+77
+75
+73
+71
+69
+65
+61
+58
+59
+63
+75
+94
+120
+158
+181
+195
+203
+205
+204
+201
+197
+191
+184
+173
+165
+158
+153
+148
+145
+145
+145
+147
+148
+150
+151
+152
+151
+151
+149
+146
+144
+140
+137
+133
+130
+126
+121
+116
+108
+102
+96
+89
+83
+76
+72
+69
+67
+65
+64
+64
+63
+63
+63
+63
+63
+64
+64
+65
+67
+69
+70
+72
+73
+75
+75
+76
+76
+76
+75
+75
+75
+75
+74
+74
+73
+72
+72
+72
+71
+70
+70
+70
+70
+70
+70
+71
+71
+72
+72
+72
+72
+72
+72
+72
+71
+71
+72
+73
+81
+86
+88
+87
+86
+78
+77
+76
+76
+76
+76
+78
+96
+127
+168
+176
+174
+169
+152
+115
+43
+16
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+45
+42
+36
+30
+26
+24
+24
+24
+24
+25
+24
+24
+26
+28
+29
+29
+26
+24
+23
+23
+24
+24
+23
+23
+24
+32
+48
+64
+77
+85
+89
+89
+89
+88
+88
+87
+86
+86
+85
+83
+77
+69
+59
+48
+36
+31
+31
+31
+33
+36
+39
+40
+41
+42
+44
+57
+67
+76
+83
+89
+95
+100
+105
+109
+113
+118
+122
+125
+128
+132
+136
+139
+142
+145
+148
+153
+157
+160
+165
+169
+177
+181
+184
+186
+186
+185
+184
+184
+183
+182
+181
+181
+181
+181
+181
+182
+182
+183
+183
+184
+185
+185
+184
+184
+183
+182
+181
+181
+181
+181
+182
+182
+181
+178
+168
+127
+91
+66
+51
+46
+46
+49
+58
+71
+84
+93
+95
+95
+94
+91
+86
+82
+79
+76
+73
+72
+71
+68
+65
+60
+59
+59
+62
+68
+81
+112
+141
+167
+188
+199
+203
+201
+199
+197
+194
+190
+187
+183
+180
+176
+173
+170
+167
+165
+162
+159
+157
+154
+151
+148
+142
+135
+127
+119
+110
+98
+90
+83
+78
+73
+69
+68
+66
+65
+65
+64
+64
+64
+64
+63
+63
+63
+63
+63
+64
+65
+66
+68
+69
+71
+73
+74
+75
+76
+77
+77
+77
+77
+77
+77
+76
+76
+75
+75
+75
+74
+73
+73
+73
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+73
+75
+86
+90
+92
+92
+90
+80
+77
+76
+76
+76
+76
+78
+97
+129
+170
+176
+174
+169
+152
+117
+45
+17
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+26
+33
+36
+37
+36
+34
+32
+30
+30
+30
+32
+32
+32
+30
+29
+23
+22
+22
+22
+23
+26
+28
+28
+28
+26
+25
+27
+33
+44
+59
+77
+83
+87
+89
+89
+88
+87
+86
+84
+82
+77
+69
+59
+48
+37
+32
+32
+33
+36
+41
+42
+42
+42
+44
+49
+65
+76
+85
+92
+98
+106
+111
+116
+120
+125
+130
+134
+137
+141
+144
+149
+153
+156
+160
+163
+169
+173
+179
+184
+189
+191
+190
+190
+188
+187
+183
+181
+180
+180
+180
+180
+181
+182
+184
+186
+189
+191
+194
+196
+198
+199
+199
+199
+198
+196
+192
+188
+184
+182
+181
+181
+181
+182
+182
+181
+166
+131
+95
+66
+50
+47
+48
+54
+65
+80
+93
+96
+97
+97
+94
+89
+85
+81
+78
+75
+72
+72
+71
+69
+66
+61
+60
+59
+60
+61
+68
+84
+105
+128
+151
+175
+185
+191
+192
+192
+189
+186
+183
+179
+176
+171
+167
+163
+158
+152
+141
+131
+120
+108
+97
+84
+78
+73
+70
+67
+66
+65
+65
+64
+64
+64
+64
+64
+64
+65
+65
+65
+65
+66
+66
+67
+69
+70
+71
+73
+74
+75
+76
+77
+77
+78
+79
+79
+79
+79
+79
+78
+78
+77
+77
+76
+76
+75
+75
+75
+74
+74
+74
+74
+74
+73
+73
+73
+73
+73
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+72
+73
+74
+77
+81
+92
+97
+99
+98
+96
+84
+78
+76
+75
+75
+75
+78
+99
+132
+172
+177
+175
+169
+153
+119
+47
+18
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+16
+18
+19
+20
+21
+21
+21
+21
+22
+22
+22
+22
+22
+22
+21
+21
+21
+23
+25
+29
+34
+36
+36
+36
+35
+30
+29
+29
+33
+37
+46
+53
+61
+70
+79
+86
+87
+86
+85
+83
+78
+72
+63
+52
+41
+37
+38
+41
+44
+45
+43
+42
+43
+47
+56
+73
+83
+91
+98
+104
+112
+117
+121
+126
+130
+136
+140
+144
+148
+151
+156
+160
+163
+168
+172
+179
+184
+188
+191
+192
+192
+189
+186
+183
+180
+179
+179
+179
+180
+182
+185
+188
+190
+193
+196
+200
+203
+205
+207
+209
+210
+211
+211
+210
+209
+206
+202
+197
+192
+186
+182
+181
+182
+182
+182
+177
+157
+126
+92
+62
+49
+49
+52
+60
+74
+90
+96
+99
+99
+98
+92
+87
+83
+79
+76
+73
+72
+72
+71
+69
+65
+63
+61
+59
+59
+61
+67
+76
+89
+104
+125
+138
+149
+158
+164
+166
+166
+163
+159
+154
+145
+136
+127
+117
+107
+96
+89
+83
+79
+75
+71
+70
+68
+68
+67
+67
+68
+69
+69
+70
+71
+72
+72
+73
+74
+74
+75
+75
+76
+77
+77
+78
+78
+79
+79
+80
+80
+80
+80
+81
+80
+80
+80
+80
+79
+79
+78
+78
+77
+77
+76
+76
+75
+75
+75
+75
+74
+74
+74
+74
+74
+73
+73
+73
+73
+73
+73
+73
+73
+73
+73
+72
+72
+72
+73
+73
+75
+78
+81
+86
+97
+103
+104
+104
+101
+87
+80
+76
+75
+74
+75
+78
+100
+134
+173
+178
+175
+170
+154
+120
+48
+18
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+19
+19
+19
+19
+19
+20
+20
+20
+20
+20
+20
+20
+21
+22
+23
+25
+27
+30
+34
+37
+41
+42
+43
+42
+42
+38
+35
+33
+32
+31
+34
+37
+42
+49
+57
+65
+72
+78
+82
+82
+80
+76
+70
+63
+53
+50
+51
+52
+51
+47
+43
+42
+46
+53
+66
+81
+89
+97
+104
+110
+117
+122
+127
+132
+136
+143
+147
+151
+155
+159
+164
+167
+172
+178
+183
+189
+192
+193
+194
+192
+187
+182
+179
+178
+176
+178
+180
+183
+185
+188
+191
+194
+197
+200
+203
+207
+210
+212
+214
+215
+217
+217
+217
+217
+216
+215
+212
+208
+203
+197
+188
+184
+182
+182
+182
+181
+173
+153
+122
+86
+56
+51
+50
+55
+65
+85
+93
+98
+100
+100
+96
+90
+85
+81
+77
+74
+73
+72
+71
+70
+68
+66
+64
+61
+59
+58
+60
+63
+68
+75
+87
+97
+106
+115
+122
+127
+127
+125
+121
+116
+107
+99
+92
+86
+80
+74
+72
+70
+70
+70
+71
+72
+73
+74
+75
+76
+77
+77
+78
+79
+79
+80
+80
+81
+81
+81
+82
+82
+82
+82
+83
+83
+83
+83
+83
+82
+82
+82
+82
+82
+81
+81
+80
+80
+79
+78
+78
+78
+77
+77
+76
+76
+76
+75
+75
+75
+75
+75
+74
+74
+74
+74
+73
+73
+73
+73
+73
+73
+73
+73
+73
+73
+73
+73
+74
+75
+78
+82
+87
+92
+103
+108
+110
+110
+107
+91
+82
+77
+75
+74
+74
+78
+101
+136
+175
+179
+175
+170
+154
+121
+49
+19
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+29
+28
+28
+27
+26
+26
+25
+25
+25
+25
+25
+26
+27
+28
+30
+33
+37
+40
+42
+45
+46
+47
+47
+47
+47
+46
+43
+40
+38
+35
+34
+34
+33
+34
+37
+42
+51
+62
+70
+73
+75
+76
+74
+70
+64
+61
+59
+57
+52
+46
+42
+45
+52
+63
+76
+89
+96
+103
+110
+116
+123
+129
+134
+139
+144
+150
+154
+159
+163
+167
+172
+177
+183
+189
+193
+196
+196
+194
+191
+186
+179
+175
+174
+175
+177
+181
+184
+188
+191
+193
+196
+199
+202
+205
+209
+213
+215
+216
+218
+219
+219
+220
+220
+220
+220
+220
+219
+216
+213
+209
+199
+190
+185
+183
+182
+182
+181
+171
+151
+118
+72
+58
+51
+52
+57
+76
+88
+96
+101
+102
+100
+95
+89
+83
+78
+75
+74
+73
+72
+71
+70
+69
+67
+64
+61
+59
+59
+59
+60
+61
+64
+68
+73
+78
+84
+88
+88
+86
+84
+80
+74
+71
+70
+69
+69
+70
+71
+72
+73
+75
+77
+79
+81
+82
+83
+84
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+85
+84
+84
+84
+83
+83
+82
+82
+81
+81
+80
+80
+79
+79
+78
+78
+77
+77
+77
+76
+76
+76
+76
+75
+75
+75
+75
+75
+75
+74
+74
+74
+74
+73
+73
+73
+73
+73
+73
+74
+74
+74
+75
+76
+78
+82
+87
+93
+98
+109
+114
+116
+116
+113
+96
+84
+78
+75
+74
+74
+78
+103
+139
+176
+179
+175
+170
+154
+122
+50
+19
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+38
+38
+38
+37
+37
+36
+36
+35
+35
+35
+35
+36
+37
+39
+40
+43
+45
+46
+47
+48
+50
+50
+50
+50
+50
+49
+48
+46
+44
+42
+39
+37
+35
+34
+34
+34
+35
+37
+42
+48
+59
+65
+66
+65
+63
+58
+52
+46
+42
+40
+42
+51
+64
+76
+86
+96
+103
+110
+117
+123
+130
+136
+141
+147
+152
+158
+163
+167
+171
+175
+182
+188
+194
+198
+199
+198
+195
+189
+182
+173
+172
+172
+174
+177
+183
+189
+190
+192
+193
+194
+198
+201
+205
+210
+213
+217
+219
+220
+220
+221
+221
+221
+221
+221
+221
+221
+222
+221
+219
+216
+210
+202
+193
+185
+183
+183
+182
+181
+172
+153
+101
+72
+56
+50
+51
+63
+80
+92
+99
+103
+103
+100
+94
+87
+80
+76
+74
+73
+72
+71
+71
+71
+70
+68
+65
+61
+59
+59
+59
+60
+60
+61
+62
+63
+64
+65
+65
+65
+65
+65
+65
+66
+67
+69
+71
+74
+77
+79
+81
+83
+84
+85
+85
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+86
+85
+85
+85
+85
+85
+85
+85
+84
+84
+84
+83
+82
+82
+81
+80
+80
+79
+79
+78
+78
+78
+77
+77
+77
+77
+76
+76
+76
+76
+76
+76
+76
+76
+76
+75
+75
+75
+75
+75
+75
+75
+75
+75
+75
+75
+75
+76
+77
+78
+79
+83
+88
+94
+100
+105
+114
+120
+122
+122
+120
+101
+87
+79
+75
+73
+74
+78
+104
+141
+177
+180
+176
+170
+155
+122
+50
+19
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+51
+51
+50
+50
+50
+49
+49
+49
+49
+49
+49
+49
+50
+51
+52
+54
+55
+56
+57
+58
+60
+60
+60
+60
+60
+59
+57
+56
+54
+52
+50
+48
+46
+44
+42
+39
+38
+37
+37
+37
+38
+39
+39
+39
+39
+39
+39
+40
+42
+46
+61
+72
+81
+89
+95
+106
+113
+120
+126
+131
+139
+145
+150
+155
+161
+167
+171
+176
+180
+186
+195
+200
+201
+201
+199
+190
+177
+170
+167
+168
+172
+179
+184
+188
+190
+191
+191
+192
+193
+196
+203
+209
+213
+216
+218
+219
+219
+219
+218
+216
+213
+213
+213
+214
+216
+219
+221
+222
+223
+223
+219
+215
+207
+198
+188
+183
+183
+183
+181
+177
+147
+110
+79
+58
+50
+51
+62
+77
+91
+100
+104
+104
+102
+97
+90
+80
+76
+74
+72
+72
+71
+71
+71
+70
+69
+67
+64
+63
+61
+61
+61
+60
+60
+60
+61
+61
+62
+63
+64
+65
+68
+71
+73
+75
+76
+77
+76
+75
+73
+70
+67
+66
+66
+67
+68
+69
+71
+74
+77
+79
+81
+81
+82
+82
+83
+83
+83
+83
+83
+83
+82
+82
+82
+82
+81
+81
+80
+80
+80
+79
+79
+79
+78
+78
+78
+78
+78
+78
+78
+79
+79
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+79
+80
+80
+80
+81
+82
+83
+84
+87
+92
+97
+103
+109
+113
+121
+127
+129
+130
+128
+110
+93
+82
+76
+73
+74
+79
+106
+144
+178
+180
+176
+170
+155
+123
+51
+20
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+60
+60
+60
+60
+59
+59
+59
+59
+58
+58
+59
+59
+59
+60
+61
+62
+63
+64
+65
+65
+66
+67
+67
+67
+66
+65
+64
+63
+61
+60
+58
+56
+55
+53
+51
+49
+48
+46
+45
+43
+43
+43
+43
+43
+44
+46
+48
+52
+58
+65
+76
+83
+90
+97
+104
+114
+121
+127
+132
+138
+146
+152
+157
+162
+168
+174
+179
+184
+190
+197
+201
+202
+201
+196
+186
+171
+168
+167
+168
+173
+183
+186
+188
+189
+190
+189
+189
+191
+194
+200
+207
+211
+214
+216
+217
+215
+212
+208
+203
+199
+196
+194
+195
+196
+198
+203
+209
+215
+219
+222
+222
+220
+216
+208
+199
+187
+184
+183
+182
+181
+169
+141
+109
+80
+58
+50
+54
+63
+76
+92
+102
+103
+103
+101
+97
+88
+82
+77
+74
+72
+71
+71
+71
+70
+70
+69
+68
+66
+65
+64
+62
+61
+61
+61
+61
+62
+63
+65
+67
+70
+73
+74
+74
+73
+70
+65
+61
+57
+54
+52
+50
+49
+48
+47
+47
+49
+50
+52
+54
+56
+62
+66
+71
+74
+77
+79
+80
+81
+81
+81
+81
+81
+81
+81
+81
+80
+80
+80
+80
+79
+79
+79
+80
+80
+81
+82
+82
+83
+84
+85
+86
+86
+86
+87
+87
+87
+87
+88
+88
+87
+87
+87
+87
+86
+86
+86
+86
+86
+86
+86
+87
+88
+89
+91
+95
+99
+105
+110
+115
+118
+124
+131
+134
+135
+134
+117
+98
+84
+77
+73
+74
+79
+108
+145
+179
+180
+176
+170
+155
+123
+51
+20
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+70
+70
+69
+69
+69
+69
+68
+68
+68
+68
+68
+68
+69
+69
+70
+71
+71
+72
+72
+73
+73
+73
+73
+73
+73
+72
+71
+70
+69
+67
+65
+64
+63
+61
+60
+58
+57
+56
+55
+53
+52
+52
+52
+53
+55
+58
+62
+66
+72
+78
+86
+92
+99
+106
+113
+122
+128
+134
+139
+145
+153
+159
+164
+170
+174
+181
+187
+193
+198
+203
+203
+200
+191
+181
+171
+163
+165
+170
+176
+182
+188
+189
+189
+188
+186
+186
+187
+191
+196
+202
+209
+211
+213
+213
+211
+206
+200
+195
+190
+186
+184
+184
+185
+186
+189
+194
+198
+204
+210
+216
+222
+223
+221
+217
+209
+196
+188
+185
+183
+183
+179
+163
+138
+107
+77
+55
+52
+54
+63
+77
+95
+100
+102
+102
+100
+95
+89
+84
+79
+75
+72
+72
+71
+71
+70
+70
+69
+68
+67
+66
+64
+63
+62
+62
+63
+65
+67
+69
+71
+73
+74
+72
+69
+65
+61
+57
+55
+53
+53
+52
+52
+53
+53
+52
+51
+49
+47
+45
+44
+44
+47
+50
+54
+57
+61
+67
+70
+74
+76
+78
+79
+80
+80
+80
+80
+80
+80
+80
+80
+81
+81
+82
+83
+84
+86
+88
+89
+90
+91
+92
+93
+94
+94
+94
+95
+95
+95
+95
+95
+95
+95
+95
+94
+94
+94
+93
+93
+93
+93
+93
+94
+95
+97
+99
+102
+106
+111
+115
+119
+122
+127
+134
+138
+140
+139
+125
+103
+88
+78
+74
+74
+80
+109
+147
+180
+181
+176
+170
+154
+123
+51
+20
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+79
+79
+79
+79
+79
+78
+78
+78
+78
+78
+78
+78
+78
+78
+79
+79
+79
+80
+80
+80
+81
+81
+80
+80
+80
+79
+78
+77
+76
+75
+73
+72
+71
+70
+69
+68
+67
+66
+65
+64
+64
+64
+65
+66
+68
+72
+75
+80
+84
+89
+95
+102
+109
+115
+122
+129
+135
+141
+146
+152
+160
+166
+171
+177
+181
+189
+195
+201
+205
+205
+200
+190
+177
+165
+160
+163
+170
+178
+185
+189
+189
+188
+186
+184
+183
+183
+186
+191
+198
+204
+208
+210
+210
+208
+203
+195
+189
+184
+180
+178
+178
+180
+181
+183
+186
+189
+192
+195
+200
+207
+218
+222
+223
+222
+218
+206
+195
+188
+185
+184
+183
+178
+162
+137
+105
+69
+57
+51
+53
+61
+83
+94
+99
+101
+101
+99
+95
+91
+86
+81
+76
+74
+73
+72
+71
+71
+70
+70
+69
+68
+66
+66
+66
+66
+67
+70
+72
+74
+74
+74
+71
+66
+61
+57
+54
+53
+54
+55
+57
+59
+62
+64
+66
+67
+66
+62
+58
+53
+48
+44
+41
+40
+40
+42
+45
+51
+56
+61
+65
+69
+72
+74
+76
+77
+78
+79
+80
+80
+81
+82
+83
+85
+87
+89
+91
+94
+95
+97
+98
+99
+100
+101
+101
+102
+102
+103
+103
+103
+103
+103
+102
+102
+102
+102
+101
+101
+101
+100
+101
+101
+101
+102
+104
+106
+109
+113
+116
+120
+123
+125
+129
+137
+142
+144
+144
+133
+110
+92
+79
+74
+74
+80
+110
+149
+180
+181
+176
+169
+154
+123
+50
+19
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+89
+89
+88
+88
+88
+88
+88
+87
+87
+87
+87
+87
+87
+87
+87
+88
+88
+88
+88
+88
+88
+88
+88
+87
+87
+86
+85
+84
+83
+82
+81
+80
+79
+78
+77
+76
+76
+75
+75
+75
+75
+75
+76
+78
+80
+83
+86
+90
+94
+99
+107
+113
+119
+124
+129
+137
+142
+148
+153
+159
+167
+173
+178
+183
+188
+198
+204
+206
+206
+204
+188
+168
+159
+157
+159
+171
+182
+188
+190
+189
+187
+183
+181
+180
+180
+181
+185
+192
+198
+204
+206
+206
+205
+201
+196
+187
+182
+178
+176
+176
+177
+179
+181
+183
+186
+189
+192
+195
+198
+200
+209
+217
+222
+224
+223
+216
+205
+195
+187
+184
+184
+183
+177
+163
+137
+93
+70
+55
+49
+51
+64
+82
+94
+99
+99
+98
+96
+94
+92
+88
+83
+80
+76
+74
+73
+72
+71
+71
+71
+70
+70
+71
+72
+73
+75
+76
+76
+75
+74
+71
+62
+56
+53
+52
+52
+53
+53
+55
+56
+59
+63
+67
+72
+76
+80
+82
+80
+75
+68
+59
+48
+42
+39
+37
+37
+38
+39
+42
+45
+50
+57
+62
+66
+70
+73
+76
+78
+80
+81
+82
+84
+87
+89
+92
+95
+98
+99
+101
+102
+103
+104
+105
+106
+107
+108
+108
+109
+109
+109
+109
+109
+109
+108
+108
+108
+108
+107
+107
+107
+108
+108
+109
+110
+112
+114
+117
+119
+122
+125
+128
+131
+139
+145
+149
+149
+141
+117
+97
+81
+75
+75
+81
+111
+150
+181
+181
+176
+170
+154
+122
+50
+19
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+101
+101
+101
+101
+101
+101
+100
+100
+100
+100
+100
+99
+99
+99
+99
+99
+99
+99
+99
+99
+98
+98
+98
+97
+97
+96
+95
+94
+93
+92
+91
+90
+90
+89
+88
+88
+87
+87
+87
+87
+88
+89
+90
+92
+94
+98
+101
+105
+109
+113
+119
+124
+129
+134
+140
+147
+152
+157
+163
+169
+177
+182
+187
+193
+200
+207
+208
+206
+198
+182
+154
+153
+155
+161
+176
+189
+190
+190
+188
+183
+178
+178
+179
+179
+179
+181
+186
+192
+199
+202
+203
+203
+200
+195
+187
+178
+174
+172
+172
+174
+178
+182
+187
+192
+195
+198
+199
+199
+200
+201
+204
+209
+216
+222
+224
+223
+217
+207
+197
+187
+184
+184
+183
+179
+170
+135
+104
+78
+59
+49
+50
+59
+74
+88
+96
+95
+94
+94
+92
+91
+89
+87
+85
+83
+81
+79
+78
+78
+77
+77
+77
+78
+78
+78
+78
+77
+75
+71
+65
+57
+52
+51
+51
+52
+52
+52
+53
+53
+53
+53
+57
+63
+71
+78
+85
+91
+92
+91
+87
+81
+71
+63
+56
+49
+44
+39
+38
+38
+38
+39
+40
+42
+45
+49
+53
+60
+66
+71
+75
+79
+83
+86
+89
+92
+95
+99
+100
+102
+103
+104
+106
+107
+108
+109
+110
+111
+112
+112
+112
+113
+113
+113
+113
+113
+113
+112
+112
+113
+113
+113
+114
+115
+115
+116
+118
+120
+121
+124
+127
+130
+133
+141
+148
+153
+154
+149
+128
+105
+85
+76
+75
+82
+113
+152
+182
+182
+176
+170
+154
+121
+48
+19
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+111
+111
+111
+110
+110
+110
+110
+110
+109
+109
+109
+109
+108
+108
+108
+108
+107
+107
+107
+107
+106
+106
+105
+105
+104
+103
+103
+102
+101
+100
+99
+98
+98
+97
+96
+96
+96
+96
+96
+97
+98
+99
+100
+102
+104
+108
+111
+114
+118
+122
+128
+133
+138
+143
+147
+154
+159
+164
+170
+176
+183
+188
+194
+201
+207
+208
+206
+193
+176
+157
+150
+154
+165
+178
+187
+190
+189
+186
+181
+178
+177
+177
+177
+178
+178
+180
+187
+193
+198
+201
+202
+201
+196
+189
+180
+173
+171
+171
+174
+178
+188
+196
+202
+207
+211
+213
+213
+212
+210
+207
+206
+209
+213
+218
+223
+225
+222
+215
+206
+195
+186
+185
+184
+183
+179
+160
+133
+105
+80
+61
+49
+52
+59
+71
+84
+92
+92
+91
+90
+88
+88
+87
+86
+85
+83
+82
+81
+81
+80
+80
+80
+80
+79
+79
+78
+74
+69
+63
+57
+52
+51
+51
+51
+52
+52
+52
+52
+53
+53
+53
+56
+61
+68
+77
+87
+96
+100
+100
+98
+93
+84
+76
+68
+61
+54
+48
+45
+42
+41
+39
+40
+41
+43
+46
+49
+55
+61
+66
+71
+76
+81
+85
+89
+92
+95
+99
+101
+102
+104
+105
+107
+108
+110
+111
+112
+113
+113
+114
+114
+114
+114
+114
+114
+114
+114
+114
+114
+114
+114
+115
+115
+116
+117
+118
+119
+121
+122
+125
+129
+132
+136
+142
+150
+156
+158
+155
+136
+112
+89
+77
+76
+82
+114
+153
+182
+182
+176
+170
+153
+119
+47
+18
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+120
+120
+120
+120
+120
+120
+119
+119
+119
+119
+118
+118
+118
+117
+117
+116
+116
+116
+115
+115
+114
+114
+113
+112
+112
+111
+110
+109
+108
+108
+107
+106
+105
+105
+105
+104
+104
+105
+105
+106
+107
+108
+110
+112
+114
+117
+121
+124
+128
+132
+137
+141
+146
+150
+155
+161
+166
+171
+177
+182
+189
+196
+202
+207
+209
+206
+191
+173
+157
+147
+153
+166
+178
+187
+191
+189
+185
+180
+177
+176
+176
+176
+177
+178
+178
+181
+188
+194
+198
+200
+200
+197
+191
+183
+175
+171
+171
+173
+179
+187
+200
+208
+214
+219
+222
+223
+223
+221
+220
+217
+212
+211
+213
+216
+221
+225
+224
+220
+214
+204
+191
+187
+185
+184
+183
+175
+157
+133
+106
+81
+58
+52
+52
+58
+69
+82
+87
+87
+86
+85
+84
+84
+84
+84
+84
+83
+82
+82
+81
+81
+81
+80
+78
+77
+74
+67
+61
+56
+52
+50
+50
+50
+51
+51
+51
+51
+51
+52
+53
+53
+55
+60
+67
+77
+87
+100
+105
+107
+106
+103
+94
+86
+78
+70
+63
+56
+52
+48
+46
+44
+43
+43
+43
+45
+48
+54
+59
+64
+69
+74
+80
+85
+89
+92
+96
+99
+102
+104
+106
+107
+110
+111
+113
+114
+115
+116
+117
+117
+117
+117
+117
+117
+116
+116
+116
+116
+116
+116
+116
+116
+117
+118
+118
+119
+120
+123
+124
+127
+131
+135
+139
+144
+152
+159
+162
+159
+145
+120
+94
+78
+77
+83
+115
+153
+182
+182
+177
+170
+153
+118
+46
+17
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+130
+130
+130
+129
+129
+129
+129
+129
+128
+128
+127
+127
+127
+126
+126
+125
+125
+124
+123
+123
+122
+121
+121
+120
+119
+118
+117
+117
+116
+115
+114
+114
+113
+113
+113
+113
+113
+113
+114
+114
+116
+117
+119
+121
+123
+127
+130
+133
+137
+140
+145
+149
+153
+157
+162
+168
+173
+178
+184
+188
+196
+203
+208
+210
+208
+194
+169
+153
+145
+149
+164
+180
+188
+190
+189
+184
+179
+176
+175
+175
+176
+177
+177
+178
+179
+182
+188
+194
+197
+198
+197
+193
+186
+178
+171
+170
+172
+178
+187
+199
+212
+219
+224
+226
+228
+228
+228
+228
+227
+225
+220
+216
+215
+216
+219
+224
+225
+224
+220
+212
+198
+190
+187
+185
+185
+183
+174
+157
+134
+107
+76
+60
+53
+52
+55
+69
+77
+81
+82
+81
+79
+79
+79
+80
+80
+81
+81
+81
+81
+80
+79
+77
+75
+71
+67
+58
+53
+51
+49
+49
+50
+50
+49
+49
+48
+49
+50
+52
+53
+53
+55
+59
+67
+77
+88
+102
+109
+113
+113
+111
+102
+94
+86
+78
+71
+63
+58
+55
+52
+50
+48
+47
+47
+48
+50
+55
+60
+65
+69
+74
+80
+85
+89
+93
+97
+101
+103
+106
+108
+110
+113
+115
+116
+118
+119
+120
+121
+121
+121
+121
+120
+120
+120
+119
+119
+118
+118
+118
+118
+118
+119
+120
+120
+121
+123
+126
+127
+130
+133
+138
+143
+147
+154
+161
+165
+164
+152
+128
+100
+80
+78
+84
+115
+154
+183
+182
+177
+170
+152
+116
+44
+17
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+139
+139
+139
+139
+139
+139
+138
+138
+138
+137
+137
+136
+136
+135
+135
+134
+133
+132
+132
+131
+130
+129
+128
+128
+127
+126
+125
+124
+123
+123
+122
+122
+121
+121
+121
+121
+121
+121
+122
+123
+125
+126
+128
+130
+132
+136
+139
+142
+145
+149
+153
+157
+161
+165
+168
+174
+180
+185
+190
+194
+205
+210
+211
+209
+204
+164
+147
+142
+146
+158
+185
+190
+191
+189
+185
+177
+175
+175
+175
+175
+176
+178
+179
+180
+181
+183
+188
+193
+196
+196
+195
+190
+182
+174
+169
+170
+174
+184
+197
+210
+222
+226
+228
+229
+229
+230
+230
+229
+229
+229
+228
+223
+220
+218
+219
+223
+225
+225
+224
+219
+206
+196
+189
+186
+185
+185
+183
+175
+159
+136
+101
+78
+62
+53
+50
+55
+62
+70
+75
+75
+73
+71
+70
+70
+72
+75
+77
+78
+78
+78
+75
+72
+67
+62
+56
+50
+49
+48
+48
+49
+49
+48
+47
+46
+46
+46
+49
+51
+52
+53
+55
+59
+67
+78
+90
+105
+113
+118
+119
+117
+109
+102
+94
+86
+78
+69
+64
+60
+57
+55
+54
+54
+55
+56
+57
+60
+63
+67
+71
+75
+81
+86
+90
+94
+98
+103
+105
+108
+111
+113
+116
+118
+120
+121
+123
+124
+125
+125
+125
+125
+125
+125
+124
+124
+123
+123
+122
+122
+122
+122
+122
+123
+124
+125
+126
+129
+131
+134
+137
+142
+147
+150
+156
+163
+167
+167
+160
+136
+106
+82
+80
+85
+116
+155
+183
+182
+177
+170
+152
+114
+43
+16
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+152
+152
+152
+152
+151
+151
+151
+151
+150
+150
+149
+149
+148
+147
+147
+145
+145
+144
+143
+142
+141
+140
+139
+138
+137
+136
+135
+134
+133
+133
+132
+132
+131
+131
+131
+131
+132
+132
+133
+134
+136
+138
+140
+142
+144
+147
+150
+153
+156
+159
+163
+167
+170
+173
+177
+184
+188
+193
+198
+206
+212
+212
+208
+194
+162
+138
+138
+148
+165
+186
+191
+190
+187
+182
+176
+174
+174
+175
+176
+179
+182
+183
+183
+183
+183
+184
+188
+192
+194
+195
+193
+185
+176
+170
+169
+171
+182
+197
+211
+223
+229
+229
+229
+230
+230
+230
+230
+230
+230
+230
+229
+228
+226
+223
+221
+223
+225
+226
+226
+224
+216
+206
+196
+189
+186
+186
+186
+184
+179
+168
+141
+116
+92
+72
+57
+49
+50
+53
+57
+64
+68
+67
+65
+62
+60
+57
+58
+59
+60
+60
+59
+58
+55
+52
+49
+47
+47
+47
+47
+47
+46
+44
+43
+43
+43
+45
+48
+51
+53
+53
+55
+61
+70
+81
+93
+109
+117
+123
+125
+124
+117
+109
+101
+93
+85
+76
+70
+66
+63
+62
+61
+62
+63
+64
+66
+69
+71
+73
+76
+79
+84
+89
+94
+98
+102
+106
+109
+112
+114
+117
+120
+122
+123
+125
+126
+127
+128
+128
+129
+129
+130
+130
+130
+130
+129
+129
+129
+129
+129
+129
+130
+130
+131
+132
+134
+137
+139
+142
+144
+149
+154
+156
+160
+165
+170
+170
+166
+146
+116
+86
+82
+88
+118
+155
+183
+182
+177
+169
+150
+111
+40
+15
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+161
+161
+161
+161
+161
+161
+160
+160
+160
+159
+159
+158
+157
+156
+156
+154
+153
+152
+151
+150
+149
+148
+147
+146
+144
+143
+142
+141
+141
+140
+139
+139
+139
+139
+139
+139
+139
+140
+141
+142
+144
+146
+148
+150
+152
+156
+158
+161
+164
+166
+170
+173
+176
+180
+184
+190
+194
+199
+206
+212
+213
+209
+191
+165
+141
+136
+148
+165
+181
+190
+190
+186
+181
+177
+175
+174
+175
+178
+182
+186
+187
+187
+185
+184
+183
+184
+188
+191
+193
+193
+191
+181
+173
+169
+168
+174
+190
+206
+219
+226
+229
+229
+229
+229
+229
+229
+229
+229
+229
+230
+229
+229
+228
+226
+224
+224
+225
+226
+226
+225
+220
+212
+203
+194
+188
+186
+186
+186
+184
+180
+163
+144
+122
+100
+79
+60
+54
+52
+53
+56
+59
+60
+60
+59
+58
+55
+53
+52
+50
+49
+48
+48
+47
+46
+45
+45
+46
+46
+46
+45
+43
+42
+41
+41
+42
+46
+49
+51
+53
+54
+56
+63
+73
+85
+97
+113
+121
+127
+130
+129
+121
+113
+105
+96
+87
+78
+73
+69
+67
+66
+66
+67
+68
+70
+71
+73
+74
+76
+79
+82
+88
+93
+97
+101
+105
+109
+112
+114
+117
+120
+122
+124
+126
+127
+128
+130
+130
+131
+131
+131
+132
+132
+132
+132
+132
+133
+133
+134
+134
+135
+135
+137
+138
+139
+140
+143
+146
+149
+151
+155
+160
+162
+164
+168
+172
+172
+170
+152
+124
+91
+85
+90
+119
+156
+183
+182
+177
+169
+149
+108
+38
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+171
+171
+171
+171
+170
+170
+170
+170
+169
+169
+168
+167
+166
+166
+165
+163
+162
+161
+160
+158
+157
+156
+154
+153
+152
+151
+150
+149
+148
+148
+147
+147
+146
+146
+146
+147
+147
+148
+149
+150
+152
+154
+156
+158
+161
+164
+166
+169
+171
+173
+177
+180
+183
+186
+191
+195
+200
+206
+212
+214
+211
+193
+167
+144
+133
+144
+164
+180
+189
+190
+186
+181
+177
+175
+174
+175
+179
+185
+190
+193
+193
+192
+188
+185
+184
+184
+188
+190
+192
+192
+189
+178
+171
+168
+168
+178
+198
+213
+224
+228
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+228
+226
+225
+226
+226
+226
+226
+223
+218
+209
+200
+192
+187
+187
+187
+186
+185
+178
+165
+148
+128
+107
+82
+68
+59
+54
+53
+54
+56
+56
+57
+56
+54
+52
+49
+47
+46
+44
+43
+43
+42
+42
+43
+43
+43
+43
+42
+41
+41
+41
+41
+43
+47
+50
+52
+53
+54
+58
+67
+77
+89
+102
+117
+127
+133
+135
+134
+125
+116
+107
+98
+89
+80
+75
+72
+70
+70
+70
+71
+72
+74
+75
+76
+77
+79
+82
+86
+92
+97
+101
+104
+107
+112
+115
+117
+120
+123
+125
+127
+129
+130
+132
+133
+133
+134
+134
+134
+135
+135
+135
+135
+135
+136
+137
+138
+138
+139
+141
+142
+143
+145
+147
+150
+153
+155
+158
+161
+166
+167
+169
+171
+174
+174
+172
+158
+132
+96
+87
+92
+121
+157
+183
+182
+177
+169
+147
+105
+36
+13
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+180
+180
+180
+180
+180
+180
+180
+179
+179
+178
+177
+177
+176
+175
+174
+172
+171
+169
+168
+167
+165
+163
+162
+161
+159
+158
+157
+156
+155
+155
+154
+154
+154
+154
+154
+154
+155
+155
+157
+158
+160
+162
+164
+166
+168
+171
+174
+176
+178
+180
+184
+186
+189
+193
+196
+201
+207
+212
+215
+214
+201
+169
+145
+133
+136
+161
+180
+189
+190
+188
+180
+177
+175
+174
+175
+179
+186
+193
+199
+200
+200
+197
+191
+185
+183
+184
+187
+190
+191
+191
+186
+175
+169
+167
+168
+184
+205
+219
+227
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+228
+227
+227
+227
+227
+227
+225
+221
+215
+207
+198
+189
+188
+187
+187
+187
+186
+180
+169
+155
+136
+109
+91
+75
+64
+57
+54
+53
+54
+54
+54
+54
+52
+50
+48
+46
+44
+42
+41
+40
+40
+40
+41
+41
+41
+41
+40
+41
+41
+42
+45
+49
+52
+53
+54
+55
+61
+72
+83
+94
+106
+123
+133
+139
+141
+138
+129
+118
+108
+98
+89
+80
+76
+74
+73
+73
+73
+74
+75
+76
+77
+78
+80
+83
+86
+91
+96
+100
+104
+107
+110
+115
+118
+121
+123
+126
+129
+131
+132
+134
+135
+136
+137
+137
+138
+138
+138
+138
+138
+138
+139
+140
+140
+141
+142
+144
+145
+147
+149
+150
+152
+156
+159
+161
+164
+167
+171
+173
+174
+175
+176
+176
+175
+163
+140
+102
+91
+95
+123
+158
+183
+182
+177
+168
+146
+101
+33
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+190
+190
+190
+190
+190
+189
+189
+189
+188
+188
+187
+186
+185
+184
+183
+181
+180
+178
+177
+175
+173
+171
+169
+168
+166
+164
+163
+162
+161
+161
+160
+160
+160
+160
+160
+160
+161
+162
+163
+165
+167
+170
+172
+174
+176
+179
+181
+183
+185
+187
+189
+192
+195
+199
+201
+208
+214
+216
+215
+213
+174
+142
+131
+135
+149
+184
+189
+190
+188
+182
+176
+174
+173
+174
+177
+187
+196
+203
+207
+208
+207
+201
+193
+185
+183
+183
+187
+189
+190
+189
+184
+173
+167
+167
+169
+191
+212
+223
+228
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+228
+228
+228
+227
+227
+226
+224
+219
+213
+204
+192
+189
+187
+187
+187
+188
+187
+183
+175
+163
+140
+121
+102
+85
+70
+59
+53
+51
+51
+52
+52
+52
+51
+50
+48
+45
+43
+42
+41
+40
+40
+40
+40
+40
+40
+41
+41
+43
+45
+48
+51
+53
+54
+55
+56
+66
+78
+89
+100
+112
+130
+141
+146
+146
+143
+131
+119
+108
+97
+88
+80
+77
+76
+75
+75
+76
+76
+77
+77
+78
+80
+83
+87
+91
+96
+101
+104
+107
+111
+114
+118
+121
+124
+127
+129
+132
+134
+135
+137
+138
+139
+140
+140
+141
+141
+142
+142
+143
+143
+144
+145
+145
+146
+147
+148
+150
+151
+153
+155
+157
+160
+163
+166
+169
+172
+176
+178
+178
+178
+178
+178
+177
+168
+146
+108
+94
+99
+126
+160
+184
+182
+177
+167
+144
+97
+30
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+202
+202
+202
+202
+202
+202
+202
+202
+201
+201
+200
+199
+198
+196
+195
+193
+191
+189
+188
+186
+184
+182
+180
+179
+177
+176
+175
+174
+173
+172
+172
+171
+171
+171
+171
+172
+173
+174
+175
+177
+179
+181
+183
+185
+186
+189
+190
+192
+193
+195
+197
+200
+203
+206
+210
+217
+217
+216
+208
+185
+133
+129
+136
+154
+183
+191
+190
+186
+181
+175
+172
+172
+175
+181
+190
+202
+208
+212
+215
+215
+214
+205
+194
+185
+182
+183
+185
+187
+188
+188
+181
+171
+166
+166
+170
+199
+217
+226
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+228
+228
+228
+227
+225
+223
+219
+213
+201
+193
+189
+188
+188
+188
+188
+188
+187
+183
+172
+158
+143
+126
+108
+87
+75
+64
+57
+53
+53
+52
+52
+51
+51
+50
+48
+47
+46
+44
+43
+43
+43
+43
+43
+45
+46
+48
+50
+51
+53
+54
+55
+57
+61
+77
+89
+99
+109
+122
+143
+153
+156
+154
+147
+131
+117
+104
+93
+85
+79
+77
+76
+76
+77
+77
+78
+78
+80
+82
+87
+91
+95
+98
+102
+106
+109
+112
+116
+119
+124
+127
+129
+132
+134
+137
+138
+140
+141
+142
+143
+143
+144
+145
+146
+147
+148
+149
+150
+151
+153
+154
+155
+156
+157
+159
+160
+161
+163
+164
+167
+169
+171
+173
+176
+181
+182
+182
+182
+181
+180
+179
+173
+154
+117
+100
+104
+130
+162
+184
+181
+177
+166
+140
+91
+26
+9
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+212
+212
+212
+212
+212
+212
+212
+212
+211
+211
+210
+209
+207
+206
+205
+202
+200
+198
+196
+194
+191
+188
+186
+184
+182
+180
+179
+178
+177
+177
+177
+176
+176
+176
+177
+177
+178
+179
+181
+182
+185
+187
+189
+190
+192
+194
+196
+198
+199
+201
+204
+207
+209
+212
+215
+218
+218
+209
+189
+149
+128
+134
+153
+175
+189
+190
+187
+181
+176
+171
+171
+175
+182
+190
+199
+208
+212
+215
+216
+217
+215
+206
+195
+186
+182
+182
+184
+186
+187
+186
+180
+169
+165
+166
+171
+203
+220
+227
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+227
+226
+224
+221
+217
+207
+199
+193
+189
+188
+188
+188
+189
+189
+188
+184
+176
+166
+154
+139
+118
+104
+90
+78
+68
+59
+56
+54
+53
+52
+51
+50
+50
+49
+48
+47
+47
+47
+47
+48
+48
+49
+50
+52
+53
+54
+54
+56
+62
+71
+87
+97
+106
+118
+133
+156
+162
+163
+158
+147
+127
+112
+100
+90
+83
+78
+77
+77
+77
+78
+79
+80
+83
+85
+88
+93
+96
+99
+102
+106
+110
+113
+117
+120
+124
+128
+131
+134
+136
+138
+140
+142
+143
+144
+145
+146
+147
+148
+149
+151
+152
+154
+155
+156
+158
+159
+160
+162
+163
+164
+165
+167
+168
+169
+170
+172
+174
+175
+176
+178
+182
+184
+184
+184
+183
+182
+181
+175
+159
+123
+105
+109
+134
+164
+184
+181
+176
+164
+137
+86
+24
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+221
+221
+221
+222
+222
+222
+222
+222
+221
+221
+220
+218
+217
+215
+214
+211
+209
+207
+205
+203
+200
+197
+195
+192
+190
+187
+186
+184
+183
+183
+182
+182
+182
+182
+182
+183
+185
+186
+188
+190
+193
+195
+197
+199
+200
+202
+204
+205
+207
+208
+211
+213
+215
+216
+218
+219
+214
+192
+162
+132
+130
+150
+171
+187
+191
+188
+182
+176
+171
+169
+173
+181
+190
+199
+206
+212
+215
+216
+217
+217
+216
+207
+196
+186
+182
+182
+184
+185
+186
+185
+179
+168
+164
+165
+172
+206
+221
+228
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+228
+226
+224
+223
+220
+213
+205
+198
+192
+189
+188
+188
+189
+190
+190
+190
+187
+182
+174
+164
+147
+133
+119
+105
+92
+77
+70
+64
+59
+56
+53
+52
+51
+51
+50
+50
+50
+50
+50
+50
+51
+51
+52
+53
+54
+55
+57
+62
+71
+83
+97
+105
+116
+130
+148
+168
+171
+168
+159
+144
+121
+106
+95
+86
+81
+78
+78
+78
+79
+81
+83
+86
+88
+91
+94
+98
+101
+104
+107
+110
+115
+119
+122
+126
+129
+133
+135
+138
+140
+142
+144
+145
+146
+148
+149
+151
+152
+153
+155
+157
+159
+160
+162
+163
+165
+166
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+184
+185
+186
+186
+185
+183
+182
+178
+162
+129
+110
+114
+137
+166
+184
+181
+176
+163
+133
+81
+21
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+231
+231
+231
+231
+232
+232
+232
+232
+231
+231
+230
+229
+227
+225
+223
+220
+218
+215
+213
+210
+207
+205
+203
+200
+198
+195
+193
+192
+190
+189
+189
+188
+188
+188
+189
+191
+192
+194
+197
+199
+202
+204
+205
+207
+208
+210
+211
+212
+213
+214
+216
+217
+218
+219
+219
+217
+201
+169
+138
+127
+143
+170
+185
+190
+189
+184
+176
+171
+168
+170
+179
+189
+198
+205
+210
+214
+216
+217
+218
+218
+216
+208
+197
+187
+182
+181
+183
+184
+184
+184
+178
+168
+163
+165
+172
+208
+222
+228
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+230
+230
+230
+230
+229
+228
+226
+225
+223
+222
+217
+211
+204
+197
+191
+188
+188
+189
+189
+190
+192
+192
+190
+188
+183
+171
+160
+147
+134
+120
+103
+91
+81
+73
+66
+60
+57
+55
+53
+52
+52
+52
+51
+52
+52
+52
+53
+54
+54
+55
+58
+64
+73
+83
+94
+105
+114
+128
+145
+165
+179
+178
+170
+157
+138
+114
+100
+89
+83
+79
+78
+79
+81
+83
+85
+89
+92
+95
+97
+100
+103
+106
+109
+112
+116
+121
+124
+128
+131
+134
+137
+140
+142
+144
+145
+148
+149
+151
+152
+154
+156
+158
+160
+162
+164
+166
+168
+169
+171
+172
+174
+175
+175
+176
+177
+178
+179
+179
+180
+181
+182
+182
+183
+183
+183
+185
+186
+187
+187
+186
+185
+184
+180
+166
+135
+115
+119
+141
+168
+183
+181
+176
+161
+129
+75
+18
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+240
+241
+241
+241
+242
+242
+241
+241
+241
+241
+241
+240
+239
+237
+235
+231
+227
+223
+219
+215
+212
+209
+207
+206
+204
+202
+200
+199
+198
+197
+196
+196
+196
+197
+197
+199
+201
+203
+205
+207
+209
+210
+211
+212
+213
+214
+214
+215
+216
+217
+218
+219
+219
+220
+219
+213
+173
+142
+127
+130
+170
+186
+191
+189
+186
+179
+170
+167
+168
+173
+189
+196
+203
+208
+212
+216
+217
+218
+218
+218
+216
+209
+198
+187
+181
+181
+182
+183
+183
+183
+178
+167
+163
+164
+171
+208
+222
+228
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+230
+230
+230
+230
+230
+229
+227
+225
+224
+223
+221
+216
+209
+202
+195
+190
+188
+188
+188
+189
+191
+193
+194
+194
+193
+188
+181
+171
+161
+148
+131
+118
+106
+95
+85
+74
+68
+63
+59
+56
+54
+54
+53
+54
+54
+55
+55
+55
+56
+57
+66
+77
+87
+97
+104
+114
+127
+144
+163
+182
+187
+182
+169
+151
+129
+105
+93
+85
+80
+79
+80
+82
+85
+88
+91
+95
+98
+100
+102
+105
+108
+111
+115
+118
+122
+127
+130
+134
+137
+139
+142
+144
+146
+148
+150
+152
+154
+155
+157
+160
+163
+165
+168
+170
+172
+174
+176
+177
+178
+179
+180
+181
+182
+182
+183
+183
+184
+184
+184
+185
+185
+185
+186
+186
+186
+187
+187
+188
+188
+187
+186
+185
+181
+169
+141
+121
+124
+145
+170
+183
+181
+176
+159
+125
+70
+16
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+252
+251
+249
+246
+244
+241
+240
+239
+239
+240
+241
+241
+242
+243
+243
+242
+241
+240
+237
+233
+226
+221
+216
+212
+210
+207
+206
+205
+204
+204
+203
+203
+203
+204
+204
+206
+208
+210
+212
+214
+215
+215
+216
+216
+217
+217
+218
+219
+220
+221
+221
+221
+221
+219
+214
+162
+133
+125
+136
+166
+192
+191
+189
+185
+181
+166
+164
+166
+172
+185
+195
+201
+207
+212
+216
+218
+219
+219
+219
+219
+217
+209
+199
+189
+182
+181
+181
+182
+182
+182
+178
+168
+163
+163
+168
+206
+222
+228
+229
+229
+228
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+230
+230
+230
+230
+230
+230
+229
+227
+226
+224
+223
+222
+220
+216
+210
+202
+194
+191
+189
+188
+188
+189
+191
+193
+195
+197
+197
+195
+191
+185
+177
+163
+152
+140
+128
+117
+104
+95
+87
+81
+75
+69
+66
+64
+62
+61
+61
+62
+65
+70
+78
+90
+97
+103
+110
+118
+135
+153
+172
+187
+196
+192
+177
+157
+134
+112
+91
+84
+82
+81
+82
+87
+91
+95
+98
+100
+103
+105
+107
+110
+113
+117
+120
+124
+128
+131
+135
+138
+141
+143
+146
+148
+150
+152
+154
+157
+160
+162
+165
+168
+171
+174
+176
+178
+180
+182
+183
+185
+186
+186
+187
+187
+187
+187
+187
+187
+187
+187
+187
+187
+187
+187
+187
+187
+187
+188
+188
+188
+188
+189
+188
+187
+186
+183
+172
+147
+127
+131
+150
+172
+183
+180
+175
+155
+118
+62
+13
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+180
+181
+182
+185
+190
+194
+199
+200
+200
+198
+196
+198
+201
+205
+211
+220
+227
+233
+236
+235
+233
+230
+226
+221
+217
+213
+210
+209
+208
+207
+207
+207
+207
+208
+209
+213
+215
+216
+216
+216
+215
+215
+215
+215
+215
+217
+218
+219
+219
+216
+203
+192
+178
+161
+143
+124
+124
+141
+165
+186
+192
+189
+186
+181
+173
+162
+162
+168
+177
+188
+198
+205
+211
+215
+218
+219
+219
+219
+219
+219
+217
+211
+201
+191
+184
+180
+181
+181
+181
+181
+178
+169
+163
+161
+165
+200
+220
+227
+228
+228
+228
+228
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+229
+230
+230
+230
+230
+230
+230
+230
+229
+227
+226
+224
+223
+222
+222
+219
+214
+208
+199
+194
+191
+189
+188
+188
+190
+191
+194
+196
+198
+199
+198
+195
+190
+180
+170
+160
+149
+139
+125
+115
+107
+99
+92
+85
+81
+78
+76
+76
+78
+81
+85
+90
+96
+102
+107
+114
+125
+138
+158
+175
+189
+198
+200
+187
+165
+140
+117
+99
+86
+84
+83
+85
+89
+94
+98
+100
+103
+105
+108
+110
+113
+116
+119
+124
+128
+131
+135
+138
+142
+144
+147
+149
+151
+154
+157
+159
+162
+164
+168
+171
+174
+177
+179
+182
+184
+186
+187
+188
+188
+189
+189
+189
+189
+189
+189
+189
+189
+189
+188
+188
+188
+188
+188
+188
+188
+188
+188
+188
+188
+189
+189
+189
+189
+188
+187
+184
+174
+150
+132
+136
+154
+175
+183
+180
+174
+151
+112
+56
+10
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+148
+162
+177
+189
+197
+202
+206
+207
+207
+205
+204
+204
+204
+204
+204
+208
+214
+220
+226
+232
+235
+234
+232
+228
+224
+219
+216
+213
+212
+211
+210
+211
+212
+214
+216
+219
+218
+217
+212
+202
+197
+198
+201
+203
+203
+198
+187
+175
+160
+145
+132
+128
+125
+121
+115
+121
+140
+164
+184
+193
+190
+186
+182
+176
+164
+159
+162
+170
+180
+190
+202
+209
+214
+217
+219
+219
+219
+219
+219
+219
+218
+212
+204
+194
+186
+181
+180
+180
+181
+180
+178
+170
+163
+160
+162
+193
+216
+226
+228
+228
+228
+228
+228
+229
+229
+229
+229
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+229
+227
+226
+224
+223
+223
+222
+221
+218
+212
+203
+197
+193
+190
+189
+188
+189
+190
+192
+194
+198
+200
+201
+201
+198
+192
+185
+176
+167
+157
+144
+134
+126
+118
+111
+103
+99
+97
+95
+95
+96
+99
+102
+105
+108
+114
+122
+133
+146
+160
+179
+192
+201
+203
+198
+173
+146
+122
+103
+90
+85
+86
+88
+92
+97
+101
+104
+106
+108
+110
+114
+117
+120
+124
+127
+132
+136
+139
+142
+145
+148
+151
+153
+155
+158
+161
+164
+167
+170
+173
+177
+180
+183
+185
+187
+189
+189
+190
+191
+191
+192
+192
+192
+192
+192
+191
+191
+191
+191
+191
+190
+190
+190
+190
+190
+189
+189
+189
+189
+189
+189
+189
+189
+189
+189
+188
+188
+185
+176
+153
+137
+140
+158
+177
+183
+180
+173
+147
+105
+49
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+152
+178
+200
+216
+224
+226
+226
+226
+226
+226
+226
+225
+222
+217
+211
+207
+206
+209
+214
+223
+232
+234
+234
+232
+230
+225
+222
+219
+216
+215
+215
+216
+218
+220
+222
+217
+205
+194
+182
+165
+154
+155
+156
+157
+153
+140
+123
+105
+86
+71
+71
+80
+94
+108
+119
+141
+168
+185
+194
+193
+186
+184
+178
+169
+157
+157
+163
+172
+183
+193
+206
+213
+216
+218
+219
+219
+219
+219
+219
+219
+219
+214
+207
+197
+189
+182
+180
+180
+180
+180
+178
+171
+164
+160
+160
+184
+211
+224
+228
+228
+228
+228
+228
+228
+228
+229
+229
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+228
+227
+225
+224
+223
+223
+223
+222
+220
+215
+207
+200
+195
+192
+190
+189
+188
+189
+190
+193
+197
+200
+203
+204
+204
+200
+195
+188
+181
+172
+160
+151
+143
+136
+129
+122
+118
+116
+114
+113
+113
+114
+115
+118
+121
+131
+143
+156
+170
+182
+197
+204
+206
+201
+188
+151
+124
+105
+92
+87
+88
+91
+95
+100
+104
+108
+110
+112
+114
+117
+121
+125
+128
+132
+136
+141
+144
+147
+149
+152
+155
+157
+160
+163
+166
+170
+173
+177
+180
+183
+186
+188
+190
+192
+193
+193
+194
+194
+194
+194
+195
+195
+195
+195
+195
+194
+194
+194
+194
+194
+193
+193
+192
+192
+192
+192
+191
+191
+191
+191
+191
+190
+190
+190
+190
+189
+188
+186
+177
+156
+141
+145
+162
+179
+183
+180
+171
+143
+98
+43
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+186
+210
+221
+226
+227
+227
+226
+226
+225
+225
+225
+225
+225
+225
+224
+217
+210
+207
+207
+210
+225
+231
+234
+234
+234
+230
+228
+225
+222
+220
+221
+223
+224
+224
+222
+202
+160
+129
+109
+98
+83
+72
+62
+50
+36
+23
+23
+28
+39
+54
+80
+99
+114
+128
+143
+177
+190
+195
+193
+189
+184
+181
+172
+161
+153
+154
+162
+173
+184
+196
+210
+215
+217
+218
+218
+219
+219
+219
+219
+219
+219
+217
+210
+202
+192
+184
+181
+180
+179
+179
+178
+172
+165
+160
+158
+174
+205
+222
+228
+228
+228
+228
+227
+227
+228
+228
+229
+229
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+230
+229
+228
+226
+225
+224
+223
+223
+223
+223
+221
+218
+209
+203
+198
+194
+191
+189
+189
+189
+190
+192
+197
+200
+203
+205
+206
+205
+201
+196
+190
+184
+174
+166
+159
+152
+145
+139
+134
+131
+127
+125
+123
+123
+126
+132
+141
+159
+171
+181
+190
+199
+208
+210
+205
+192
+165
+123
+103
+92
+88
+88
+93
+98
+103
+107
+109
+112
+114
+117
+120
+124
+129
+133
+137
+141
+145
+149
+151
+154
+156
+159
+163
+166
+169
+173
+176
+181
+184
+187
+190
+192
+194
+195
+195
+196
+196
+197
+198
+198
+199
+199
+199
+199
+199
+199
+199
+199
+199
+199
+198
+198
+197
+197
+196
+196
+196
+195
+195
+194
+193
+193
+192
+192
+191
+191
+190
+189
+189
+187
+178
+159
+145
+150
+165
+180
+183
+179
+170
+138
+91
+37
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+197
+216
+224
+226
+226
+224
+223
+223
+223
+224
+224
+224
+224
+225
+225
+224
+218
+212
+207
+207
+211
+220
+228
+233
+234
+233
+232
+229
+227
+227
+230
+230
+218
+184
+115
+59
+41
+27
+18
+11
+8
+5
+4
+6
+10
+28
+49
+73
+97
+118
+135
+141
+152
+166
+185
+196
+196
+193
+189
+184
+182
+174
+162
+152
+150
+152
+160
+172
+186
+201
+214
+216
+217
+217
+217
+218
+219
+219
+219
+220
+220
+219
+215
+208
+199
+188
+183
+180
+179
+179
+178
+174
+167
+161
+158
+162
+190
+212
+226
+228
+228
+227
+227
+227
+227
+227
+228
+228
+229
+229
+229
+229
+230
+230
+230
+230
+229
+229
+229
+228
+226
+225
+224
+224
+224
+223
+223
+223
+222
+218
+210
+203
+198
+194
+191
+189
+189
+189
+190
+193
+198
+201
+204
+207
+209
+209
+207
+204
+199
+192
+183
+176
+169
+163
+157
+149
+145
+143
+141
+141
+146
+153
+162
+171
+180
+188
+194
+200
+206
+211
+211
+204
+182
+151
+117
+95
+92
+92
+94
+99
+107
+111
+114
+116
+118
+122
+125
+129
+133
+138
+143
+147
+151
+154
+157
+160
+163
+166
+169
+173
+178
+181
+185
+188
+191
+194
+196
+197
+198
+199
+200
+200
+201
+202
+203
+204
+204
+204
+205
+205
+205
+206
+206
+206
+206
+206
+206
+205
+205
+204
+204
+203
+202
+202
+201
+200
+200
+199
+198
+197
+196
+195
+194
+193
+192
+190
+189
+187
+179
+161
+151
+156
+170
+182
+183
+179
+166
+130
+80
+29
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+205
+219
+225
+226
+225
+223
+223
+223
+223
+224
+224
+224
+224
+224
+225
+225
+222
+216
+210
+207
+211
+219
+227
+232
+234
+234
+233
+232
+231
+231
+226
+189
+138
+87
+47
+24
+17
+12
+8
+6
+4
+5
+13
+27
+50
+83
+103
+120
+133
+141
+152
+162
+175
+186
+194
+197
+194
+189
+185
+183
+181
+167
+156
+149
+148
+150
+158
+172
+188
+205
+216
+216
+216
+216
+216
+217
+219
+219
+219
+220
+220
+220
+218
+214
+206
+193
+186
+182
+179
+179
+177
+175
+169
+163
+158
+159
+177
+200
+220
+227
+228
+227
+227
+227
+227
+227
+227
+227
+227
+228
+228
+228
+228
+228
+228
+228
+228
+227
+227
+226
+225
+225
+224
+224
+224
+224
+224
+223
+220
+216
+207
+201
+196
+193
+190
+189
+190
+191
+194
+197
+202
+206
+209
+211
+212
+212
+210
+207
+204
+198
+190
+184
+178
+173
+168
+164
+163
+163
+164
+167
+172
+177
+183
+188
+192
+199
+204
+209
+211
+212
+199
+171
+142
+116
+101
+94
+95
+98
+103
+108
+114
+116
+119
+122
+125
+131
+135
+140
+144
+148
+154
+157
+161
+164
+168
+173
+176
+180
+184
+187
+191
+193
+196
+197
+199
+200
+201
+202
+203
+203
+204
+205
+205
+205
+206
+206
+206
+207
+207
+207
+207
+207
+208
+208
+208
+208
+208
+208
+207
+207
+207
+207
+206
+205
+205
+204
+203
+202
+201
+200
+199
+197
+196
+195
+193
+191
+190
+187
+180
+162
+154
+160
+172
+183
+183
+178
+162
+123
+72
+24
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+207
+220
+225
+226
+225
+222
+222
+223
+224
+225
+224
+224
+224
+224
+225
+225
+223
+217
+211
+209
+211
+219
+227
+233
+234
+234
+234
+233
+230
+222
+171
+117
+70
+34
+16
+8
+6
+5
+4
+3
+6
+19
+39
+65
+92
+120
+134
+145
+153
+159
+171
+181
+190
+196
+197
+195
+190
+186
+184
+183
+176
+160
+151
+147
+147
+149
+157
+172
+191
+209
+217
+216
+215
+213
+213
+216
+218
+219
+220
+220
+220
+221
+220
+217
+212
+200
+191
+185
+180
+179
+177
+176
+172
+166
+159
+157
+166
+187
+210
+225
+228
+227
+227
+227
+227
+226
+226
+226
+226
+227
+227
+227
+227
+227
+227
+227
+226
+226
+226
+225
+225
+224
+224
+224
+224
+224
+223
+221
+217
+211
+203
+197
+194
+191
+191
+192
+194
+197
+200
+204
+208
+210
+212
+214
+214
+213
+211
+209
+206
+202
+197
+192
+188
+184
+181
+180
+179
+180
+182
+184
+189
+192
+195
+199
+203
+207
+210
+211
+206
+194
+161
+134
+114
+101
+97
+99
+104
+108
+113
+117
+121
+124
+128
+132
+136
+143
+148
+152
+156
+160
+165
+170
+174
+178
+182
+186
+190
+192
+195
+197
+199
+200
+201
+202
+203
+204
+204
+204
+205
+205
+206
+206
+206
+207
+207
+207
+207
+207
+207
+208
+208
+208
+208
+208
+209
+209
+209
+209
+209
+209
+209
+209
+209
+208
+208
+207
+206
+205
+204
+204
+202
+200
+199
+197
+194
+191
+190
+188
+180
+164
+158
+164
+175
+183
+183
+177
+158
+115
+64
+19
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+206
+220
+225
+225
+225
+222
+221
+222
+224
+225
+224
+224
+224
+224
+225
+224
+222
+217
+212
+210
+214
+222
+229
+233
+235
+234
+233
+227
+210
+180
+95
+48
+22
+11
+6
+4
+4
+4
+4
+5
+18
+45
+75
+104
+126
+143
+151
+159
+166
+175
+187
+194
+198
+198
+196
+193
+187
+185
+184
+183
+170
+155
+148
+147
+147
+148
+156
+173
+194
+213
+216
+215
+212
+211
+211
+215
+217
+219
+219
+220
+220
+221
+221
+220
+217
+207
+197
+189
+183
+179
+177
+176
+173
+169
+161
+157
+159
+173
+195
+218
+226
+227
+227
+227
+227
+226
+226
+226
+226
+226
+226
+226
+226
+226
+226
+225
+225
+225
+225
+225
+224
+224
+224
+224
+224
+223
+221
+217
+211
+205
+197
+193
+191
+190
+191
+195
+199
+202
+206
+209
+212
+213
+214
+215
+214
+213
+211
+209
+206
+204
+201
+198
+196
+194
+193
+192
+192
+193
+194
+196
+199
+201
+203
+206
+209
+211
+208
+199
+183
+159
+121
+106
+100
+100
+102
+108
+114
+118
+122
+125
+130
+134
+139
+145
+150
+157
+161
+166
+170
+174
+179
+183
+187
+191
+194
+198
+200
+201
+202
+203
+203
+203
+203
+204
+204
+204
+204
+204
+204
+204
+204
+204
+205
+205
+205
+206
+206
+207
+207
+207
+208
+208
+208
+208
+209
+209
+209
+209
+210
+210
+210
+210
+210
+210
+210
+209
+209
+208
+207
+206
+205
+203
+201
+199
+196
+192
+191
+188
+180
+165
+161
+168
+177
+184
+182
+176
+152
+106
+55
+15
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+205
+219
+225
+225
+225
+222
+221
+221
+222
+224
+225
+225
+225
+225
+225
+222
+218
+215
+213
+212
+219
+228
+233
+235
+235
+234
+230
+207
+161
+88
+28
+15
+7
+4
+3
+3
+3
+3
+5
+10
+44
+81
+110
+130
+144
+157
+166
+174
+183
+191
+198
+199
+199
+197
+194
+188
+185
+184
+184
+183
+162
+151
+147
+147
+147
+148
+156
+174
+197
+214
+216
+213
+210
+207
+208
+213
+216
+217
+219
+220
+220
+221
+221
+221
+221
+215
+205
+195
+187
+180
+177
+176
+174
+171
+165
+157
+156
+161
+176
+203
+224
+226
+227
+227
+227
+226
+226
+226
+226
+226
+226
+225
+225
+225
+225
+225
+225
+225
+225
+225
+224
+224
+224
+224
+224
+222
+216
+209
+202
+196
+190
+188
+188
+190
+192
+197
+200
+204
+207
+210
+212
+213
+214
+214
+213
+212
+210
+208
+205
+203
+201
+200
+199
+198
+197
+197
+198
+199
+201
+203
+206
+208
+210
+211
+212
+208
+193
+166
+136
+111
+102
+102
+104
+108
+114
+119
+122
+125
+128
+133
+140
+146
+152
+158
+163
+170
+176
+181
+187
+191
+196
+199
+200
+201
+202
+202
+203
+203
+204
+204
+204
+203
+203
+202
+202
+201
+201
+201
+200
+200
+199
+199
+199
+200
+201
+202
+203
+204
+205
+206
+207
+207
+208
+208
+208
+209
+209
+209
+210
+210
+210
+210
+211
+211
+211
+211
+211
+210
+209
+209
+207
+206
+204
+201
+198
+193
+192
+188
+180
+166
+164
+172
+180
+184
+182
+175
+145
+97
+47
+11
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+198
+216
+224
+225
+226
+222
+221
+221
+221
+221
+221
+221
+221
+220
+219
+217
+217
+217
+220
+225
+232
+234
+234
+234
+232
+216
+166
+106
+52
+21
+8
+4
+3
+2
+2
+3
+3
+5
+15
+39
+91
+117
+137
+152
+166
+180
+187
+193
+197
+199
+200
+199
+197
+193
+191
+186
+185
+185
+184
+180
+155
+149
+147
+147
+147
+148
+155
+176
+200
+216
+216
+210
+205
+202
+203
+208
+211
+214
+216
+218
+219
+220
+221
+221
+222
+220
+215
+207
+197
+187
+179
+177
+175
+173
+171
+161
+157
+156
+160
+171
+205
+219
+225
+227
+227
+226
+226
+226
+226
+226
+226
+225
+225
+225
+225
+225
+225
+225
+224
+224
+224
+223
+222
+220
+216
+207
+200
+194
+190
+187
+186
+186
+187
+189
+191
+195
+197
+199
+201
+202
+204
+204
+204
+204
+204
+203
+203
+202
+202
+202
+201
+201
+201
+201
+202
+204
+206
+207
+208
+208
+209
+209
+207
+201
+186
+149
+125
+111
+105
+104
+106
+111
+116
+121
+125
+132
+137
+144
+150
+157
+165
+171
+177
+182
+188
+194
+197
+199
+200
+201
+201
+202
+202
+202
+201
+199
+198
+196
+194
+192
+188
+184
+181
+177
+174
+171
+170
+169
+168
+168
+168
+169
+171
+173
+176
+180
+184
+187
+191
+195
+200
+202
+205
+206
+208
+209
+209
+209
+210
+210
+210
+210
+211
+212
+212
+212
+212
+212
+211
+211
+210
+208
+207
+204
+200
+194
+192
+188
+180
+168
+167
+176
+182
+184
+182
+171
+134
+84
+36
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+189
+211
+221
+224
+226
+224
+223
+222
+221
+221
+221
+221
+221
+221
+221
+221
+223
+226
+228
+230
+233
+232
+227
+215
+191
+127
+80
+45
+21
+9
+4
+2
+2
+2
+2
+2
+4
+14
+36
+73
+117
+139
+157
+171
+182
+191
+194
+197
+199
+200
+199
+197
+195
+193
+190
+186
+186
+186
+183
+176
+152
+150
+149
+149
+148
+149
+156
+178
+203
+216
+215
+208
+202
+198
+198
+202
+206
+209
+211
+214
+216
+218
+220
+220
+221
+221
+219
+214
+207
+196
+184
+179
+176
+174
+172
+166
+160
+157
+157
+160
+178
+201
+215
+223
+226
+226
+226
+225
+225
+225
+225
+225
+225
+225
+224
+224
+224
+223
+223
+222
+219
+216
+212
+208
+202
+196
+192
+189
+187
+186
+186
+186
+188
+189
+191
+193
+195
+196
+198
+199
+200
+201
+201
+202
+202
+202
+202
+203
+203
+203
+204
+205
+206
+206
+207
+207
+207
+207
+207
+206
+200
+187
+171
+153
+136
+120
+114
+111
+112
+116
+121
+126
+130
+134
+139
+146
+152
+159
+166
+174
+183
+188
+191
+194
+196
+199
+200
+200
+199
+198
+196
+192
+188
+184
+179
+172
+167
+162
+158
+154
+151
+149
+147
+145
+143
+141
+140
+139
+139
+139
+141
+142
+144
+146
+149
+154
+158
+163
+169
+175
+184
+189
+195
+199
+203
+206
+208
+209
+210
+210
+210
+210
+211
+211
+212
+213
+213
+212
+212
+212
+211
+210
+208
+206
+201
+195
+193
+187
+179
+169
+170
+179
+183
+184
+181
+168
+124
+73
+29
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+175
+202
+215
+221
+225
+224
+224
+223
+223
+222
+222
+222
+223
+223
+224
+225
+226
+228
+229
+228
+222
+205
+181
+149
+111
+56
+30
+14
+6
+3
+2
+1
+2
+2
+2
+3
+8
+30
+64
+104
+141
+160
+174
+185
+192
+196
+198
+199
+200
+199
+198
+196
+194
+192
+190
+186
+187
+187
+183
+173
+152
+152
+152
+151
+149
+149
+157
+180
+205
+216
+214
+205
+198
+194
+192
+195
+199
+202
+205
+208
+212
+215
+217
+218
+220
+221
+220
+218
+214
+206
+193
+185
+180
+176
+173
+170
+164
+159
+156
+155
+162
+178
+196
+211
+221
+225
+225
+225
+225
+224
+224
+223
+223
+222
+221
+220
+219
+218
+216
+214
+210
+207
+203
+199
+195
+191
+189
+188
+187
+186
+187
+188
+189
+191
+192
+195
+196
+198
+199
+200
+202
+202
+203
+204
+205
+206
+206
+206
+207
+207
+208
+208
+208
+208
+207
+205
+202
+197
+189
+180
+164
+151
+138
+126
+117
+113
+115
+117
+120
+125
+132
+138
+144
+150
+157
+167
+173
+179
+184
+189
+194
+196
+197
+198
+197
+193
+190
+185
+180
+175
+168
+163
+158
+154
+149
+144
+140
+137
+134
+132
+130
+129
+128
+128
+127
+126
+125
+125
+125
+125
+125
+126
+127
+129
+131
+134
+138
+142
+148
+154
+164
+172
+180
+188
+194
+201
+204
+207
+209
+210
+210
+210
+211
+211
+212
+213
+213
+213
+213
+213
+212
+211
+210
+207
+202
+195
+193
+187
+179
+171
+173
+181
+184
+184
+180
+163
+113
+63
+23
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+157
+188
+204
+212
+220
+222
+223
+223
+223
+223
+223
+223
+224
+224
+224
+223
+221
+217
+210
+199
+176
+145
+108
+69
+34
+11
+6
+3
+1
+1
+1
+1
+1
+1
+1
+4
+19
+54
+95
+131
+161
+177
+187
+194
+197
+198
+199
+200
+199
+199
+197
+195
+194
+193
+190
+188
+188
+188
+183
+170
+154
+155
+155
+154
+150
+149
+158
+183
+207
+216
+213
+203
+195
+190
+186
+187
+191
+193
+196
+200
+204
+209
+212
+215
+217
+220
+220
+220
+219
+215
+204
+194
+186
+180
+175
+172
+168
+163
+158
+155
+153
+160
+173
+190
+207
+220
+222
+223
+224
+223
+222
+221
+220
+219
+218
+216
+214
+212
+210
+207
+203
+200
+197
+195
+193
+191
+191
+190
+190
+191
+192
+193
+195
+197
+198
+201
+202
+203
+205
+206
+207
+207
+208
+208
+209
+209
+210
+210
+209
+209
+207
+206
+203
+200
+196
+188
+181
+171
+159
+145
+129
+122
+118
+116
+117
+120
+124
+129
+134
+139
+148
+154
+162
+170
+178
+187
+191
+195
+196
+197
+195
+193
+190
+186
+181
+173
+166
+159
+152
+145
+138
+133
+130
+127
+125
+124
+123
+123
+122
+122
+121
+121
+121
+121
+121
+121
+121
+121
+121
+120
+119
+119
+119
+119
+120
+122
+124
+127
+130
+135
+145
+154
+163
+173
+182
+192
+198
+203
+206
+209
+209
+210
+210
+211
+212
+213
+213
+214
+214
+214
+213
+212
+211
+208
+202
+196
+193
+186
+178
+173
+175
+183
+185
+183
+179
+155
+102
+53
+17
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+138
+167
+185
+197
+209
+215
+218
+220
+220
+221
+221
+221
+221
+220
+218
+212
+202
+183
+157
+123
+72
+42
+22
+10
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+8
+40
+83
+125
+154
+179
+190
+195
+197
+197
+199
+199
+199
+199
+198
+197
+196
+195
+194
+191
+189
+190
+189
+183
+168
+157
+158
+159
+157
+151
+150
+160
+185
+209
+215
+211
+201
+192
+186
+180
+179
+181
+182
+185
+189
+194
+200
+204
+208
+212
+217
+218
+220
+220
+219
+215
+206
+196
+187
+179
+174
+172
+168
+163
+156
+153
+152
+154
+162
+179
+206
+215
+221
+224
+223
+223
+221
+220
+219
+217
+214
+212
+210
+208
+206
+202
+200
+198
+196
+195
+195
+195
+197
+199
+201
+205
+207
+209
+211
+212
+213
+214
+214
+214
+214
+213
+213
+213
+212
+211
+210
+210
+209
+207
+205
+201
+195
+186
+176
+163
+146
+135
+127
+122
+119
+117
+117
+118
+120
+124
+133
+140
+148
+157
+165
+176
+183
+189
+193
+195
+197
+197
+197
+196
+193
+184
+174
+163
+152
+142
+133
+128
+126
+124
+123
+122
+122
+122
+121
+121
+121
+122
+122
+122
+123
+123
+123
+123
+123
+123
+123
+122
+122
+121
+121
+120
+119
+118
+118
+117
+117
+117
+118
+120
+122
+128
+136
+145
+156
+166
+180
+189
+196
+202
+206
+209
+209
+210
+211
+212
+213
+213
+214
+214
+214
+214
+213
+212
+209
+203
+197
+193
+186
+178
+174
+179
+185
+185
+182
+177
+146
+89
+43
+12
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+114
+131
+144
+154
+166
+173
+177
+180
+180
+178
+172
+165
+154
+139
+121
+92
+70
+50
+34
+21
+10
+6
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+23
+78
+122
+155
+176
+193
+195
+196
+197
+197
+199
+199
+199
+199
+198
+198
+198
+197
+195
+192
+191
+192
+191
+184
+169
+163
+164
+164
+160
+151
+150
+164
+188
+210
+215
+209
+198
+189
+182
+173
+169
+167
+166
+167
+170
+175
+181
+187
+193
+199
+207
+211
+215
+218
+219
+219
+216
+211
+203
+193
+181
+176
+173
+170
+167
+158
+154
+151
+150
+150
+158
+174
+191
+206
+217
+220
+221
+221
+220
+219
+218
+216
+215
+214
+213
+212
+211
+211
+212
+213
+214
+214
+215
+215
+216
+216
+216
+215
+215
+215
+214
+213
+213
+212
+210
+208
+205
+202
+198
+193
+185
+177
+169
+161
+153
+141
+135
+130
+127
+125
+124
+124
+125
+126
+128
+133
+138
+144
+149
+154
+159
+165
+171
+178
+185
+191
+194
+197
+197
+196
+188
+177
+164
+151
+139
+129
+125
+123
+122
+121
+121
+121
+121
+121
+122
+124
+126
+128
+130
+132
+136
+138
+141
+143
+146
+148
+148
+148
+148
+146
+144
+141
+139
+135
+132
+127
+124
+122
+120
+118
+116
+115
+115
+115
+115
+117
+121
+127
+135
+145
+161
+172
+183
+192
+200
+205
+207
+209
+210
+211
+212
+213
+214
+214
+215
+214
+214
+213
+210
+203
+197
+193
+185
+178
+176
+182
+186
+185
+181
+174
+130
+72
+31
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+102
+110
+115
+119
+123
+125
+122
+120
+115
+109
+100
+94
+86
+77
+67
+54
+44
+34
+25
+17
+9
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+7
+48
+105
+144
+170
+186
+195
+195
+196
+196
+197
+199
+199
+199
+199
+199
+200
+200
+198
+196
+193
+193
+194
+192
+186
+172
+168
+168
+167
+161
+150
+150
+166
+191
+211
+214
+208
+197
+188
+180
+170
+163
+159
+156
+155
+156
+158
+163
+169
+175
+182
+192
+199
+205
+211
+215
+218
+217
+215
+211
+206
+195
+186
+179
+174
+171
+166
+161
+157
+153
+150
+150
+155
+160
+167
+179
+194
+203
+210
+214
+215
+216
+216
+215
+215
+214
+214
+213
+213
+213
+213
+213
+213
+213
+212
+212
+210
+208
+205
+202
+198
+192
+187
+183
+178
+173
+167
+163
+158
+154
+150
+146
+143
+140
+137
+134
+131
+130
+128
+128
+127
+128
+130
+132
+136
+140
+146
+153
+161
+169
+177
+187
+191
+195
+197
+198
+194
+186
+175
+164
+153
+142
+136
+131
+127
+124
+122
+121
+121
+122
+123
+126
+129
+134
+139
+144
+152
+157
+162
+167
+171
+175
+178
+179
+180
+181
+182
+182
+181
+180
+179
+176
+173
+169
+164
+159
+151
+145
+138
+131
+125
+120
+117
+114
+113
+113
+113
+115
+119
+124
+133
+147
+159
+171
+182
+192
+201
+204
+207
+208
+210
+212
+213
+214
+215
+215
+215
+214
+213
+210
+203
+198
+191
+184
+178
+178
+185
+186
+184
+179
+170
+115
+59
+23
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+97
+98
+97
+95
+92
+88
+84
+80
+75
+69
+65
+61
+56
+51
+47
+42
+35
+28
+21
+12
+6
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+13
+76
+130
+162
+180
+192
+195
+195
+195
+196
+197
+199
+199
+199
+199
+200
+201
+201
+199
+197
+194
+195
+195
+194
+189
+177
+172
+172
+169
+161
+150
+150
+169
+193
+211
+214
+208
+196
+187
+178
+168
+159
+154
+148
+145
+144
+144
+147
+151
+157
+163
+174
+181
+190
+198
+205
+213
+215
+216
+215
+213
+206
+198
+190
+182
+176
+171
+168
+164
+159
+155
+151
+149
+148
+149
+154
+165
+171
+178
+183
+187
+193
+195
+197
+198
+199
+200
+199
+199
+198
+196
+194
+192
+190
+187
+184
+180
+176
+172
+169
+165
+160
+157
+153
+150
+146
+142
+140
+137
+135
+133
+132
+131
+130
+130
+130
+131
+132
+133
+135
+137
+142
+148
+154
+161
+167
+176
+182
+187
+192
+196
+197
+193
+187
+179
+171
+161
+152
+144
+135
+128
+123
+121
+120
+120
+121
+124
+128
+132
+138
+144
+152
+159
+165
+171
+176
+182
+186
+190
+193
+196
+198
+199
+200
+200
+201
+201
+201
+200
+200
+199
+197
+195
+192
+188
+184
+177
+169
+161
+152
+142
+131
+124
+118
+114
+112
+111
+111
+113
+117
+123
+135
+147
+159
+172
+184
+195
+200
+204
+207
+209
+211
+213
+214
+215
+215
+215
+215
+213
+209
+203
+198
+190
+183
+179
+180
+187
+186
+183
+176
+163
+99
+47
+17
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+89
+89
+89
+87
+83
+75
+71
+68
+66
+65
+64
+64
+63
+62
+61
+58
+54
+47
+39
+30
+16
+8
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+8
+22
+104
+151
+175
+187
+195
+195
+194
+194
+195
+198
+200
+199
+199
+200
+201
+203
+202
+200
+197
+196
+197
+197
+196
+191
+181
+176
+175
+169
+160
+149
+150
+172
+195
+212
+214
+208
+196
+186
+178
+168
+157
+151
+144
+138
+135
+132
+133
+136
+139
+144
+153
+161
+169
+179
+189
+201
+208
+212
+214
+214
+213
+209
+203
+195
+186
+178
+174
+170
+167
+163
+157
+153
+150
+147
+145
+145
+146
+148
+151
+156
+163
+167
+170
+172
+173
+174
+174
+173
+171
+169
+166
+163
+160
+156
+152
+147
+144
+141
+139
+137
+135
+134
+133
+133
+132
+132
+132
+132
+132
+133
+133
+134
+135
+136
+137
+141
+144
+148
+153
+159
+167
+174
+182
+189
+196
+201
+201
+199
+195
+191
+181
+170
+158
+145
+133
+124
+120
+118
+118
+118
+120
+122
+125
+129
+134
+142
+149
+158
+166
+174
+184
+191
+196
+199
+202
+205
+206
+207
+207
+208
+208
+209
+209
+209
+209
+209
+209
+209
+209
+209
+208
+207
+206
+204
+202
+197
+191
+184
+175
+164
+149
+137
+127
+119
+114
+110
+109
+110
+112
+115
+125
+135
+148
+161
+174
+188
+196
+201
+205
+207
+210
+212
+214
+215
+215
+215
+215
+213
+209
+203
+197
+188
+182
+180
+182
+188
+186
+182
+173
+154
+82
+36
+12
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+85
+86
+86
+85
+83
+74
+70
+67
+65
+65
+69
+73
+77
+80
+82
+78
+72
+64
+54
+41
+22
+11
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+12
+36
+129
+164
+182
+190
+196
+194
+192
+193
+195
+198
+200
+199
+199
+200
+202
+204
+203
+200
+198
+198
+199
+199
+197
+193
+185
+179
+176
+168
+158
+149
+150
+174
+197
+212
+213
+208
+196
+187
+178
+168
+157
+150
+142
+135
+131
+126
+124
+124
+125
+127
+132
+138
+146
+155
+165
+182
+194
+204
+212
+214
+215
+214
+213
+210
+204
+190
+181
+175
+171
+168
+166
+163
+160
+157
+152
+147
+145
+143
+142
+142
+141
+142
+142
+142
+142
+142
+142
+141
+141
+140
+139
+138
+137
+136
+136
+136
+135
+135
+135
+134
+134
+134
+134
+134
+134
+135
+135
+136
+137
+138
+141
+144
+147
+151
+155
+163
+171
+179
+187
+195
+203
+207
+210
+212
+211
+201
+185
+169
+153
+140
+128
+123
+119
+116
+115
+115
+115
+116
+117
+119
+125
+133
+143
+155
+167
+182
+191
+197
+201
+204
+206
+207
+208
+208
+209
+209
+209
+209
+209
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+208
+206
+201
+195
+186
+171
+157
+142
+129
+119
+111
+108
+108
+108
+110
+116
+126
+137
+150
+164
+181
+190
+198
+202
+206
+209
+212
+214
+215
+215
+215
+215
+213
+208
+203
+195
+187
+182
+182
+184
+189
+185
+180
+168
+142
+66
+26
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+83
+84
+85
+85
+84
+77
+73
+71
+71
+74
+94
+102
+106
+106
+105
+95
+86
+74
+60
+45
+25
+12
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+19
+55
+150
+175
+187
+192
+196
+193
+191
+192
+194
+198
+198
+198
+199
+201
+204
+205
+203
+201
+201
+201
+202
+202
+199
+194
+187
+178
+173
+164
+155
+148
+150
+176
+198
+212
+213
+209
+200
+190
+180
+172
+160
+152
+144
+137
+131
+126
+122
+120
+119
+118
+119
+120
+122
+126
+131
+143
+155
+170
+184
+199
+210
+213
+214
+214
+214
+212
+206
+198
+188
+179
+172
+169
+166
+165
+163
+160
+158
+156
+153
+151
+149
+147
+146
+145
+144
+143
+142
+142
+141
+140
+140
+140
+140
+140
+140
+140
+140
+141
+142
+143
+143
+144
+145
+147
+149
+152
+154
+157
+161
+167
+175
+182
+189
+195
+201
+208
+211
+213
+214
+213
+199
+180
+162
+146
+136
+129
+124
+121
+118
+116
+114
+113
+113
+113
+114
+117
+124
+134
+146
+161
+180
+190
+197
+202
+205
+207
+207
+208
+208
+209
+209
+209
+209
+209
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+211
+211
+211
+211
+211
+211
+211
+210
+210
+208
+204
+194
+182
+167
+150
+134
+117
+110
+107
+106
+106
+109
+116
+126
+138
+151
+170
+183
+192
+199
+204
+208
+211
+213
+215
+216
+216
+215
+212
+207
+202
+192
+185
+183
+183
+187
+189
+184
+177
+159
+121
+45
+16
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+83
+85
+86
+87
+86
+82
+79
+78
+81
+91
+112
+116
+117
+116
+111
+99
+87
+72
+57
+40
+23
+11
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+23
+64
+157
+177
+187
+192
+196
+193
+191
+191
+192
+195
+196
+197
+200
+203
+206
+206
+204
+203
+203
+204
+204
+202
+198
+191
+182
+172
+167
+160
+153
+148
+150
+175
+197
+211
+213
+210
+203
+196
+188
+179
+167
+158
+150
+143
+137
+130
+126
+123
+121
+119
+118
+118
+118
+119
+121
+125
+130
+138
+149
+163
+183
+195
+205
+211
+214
+214
+212
+209
+205
+200
+191
+184
+177
+172
+168
+164
+162
+160
+159
+157
+155
+153
+152
+151
+150
+149
+149
+149
+149
+148
+148
+148
+148
+148
+148
+149
+149
+150
+151
+153
+156
+159
+163
+168
+173
+180
+185
+190
+195
+199
+203
+205
+207
+208
+206
+188
+171
+159
+152
+149
+144
+139
+133
+128
+123
+119
+115
+112
+111
+111
+111
+113
+119
+128
+139
+157
+169
+179
+187
+193
+200
+203
+205
+207
+208
+208
+209
+209
+209
+210
+210
+211
+211
+211
+212
+212
+212
+213
+213
+213
+213
+213
+213
+213
+212
+212
+212
+212
+211
+211
+211
+211
+211
+211
+211
+211
+211
+210
+210
+208
+203
+195
+182
+167
+149
+126
+115
+108
+105
+104
+106
+111
+119
+130
+142
+163
+177
+188
+196
+202
+207
+211
+213
+215
+216
+216
+215
+211
+206
+201
+190
+185
+183
+185
+189
+188
+182
+172
+148
+101
+31
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+83
+86
+89
+90
+90
+87
+85
+85
+91
+107
+124
+126
+126
+122
+114
+99
+83
+66
+50
+35
+18
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+24
+68
+158
+177
+187
+192
+196
+194
+192
+191
+191
+193
+196
+198
+202
+206
+207
+207
+205
+205
+206
+206
+204
+199
+191
+181
+170
+164
+161
+156
+151
+147
+149
+173
+194
+209
+211
+210
+206
+201
+195
+189
+178
+170
+162
+155
+148
+139
+134
+130
+126
+123
+120
+118
+117
+117
+117
+117
+119
+122
+127
+135
+150
+163
+177
+190
+201
+209
+212
+213
+213
+211
+205
+200
+195
+190
+185
+178
+174
+171
+169
+166
+164
+162
+161
+160
+159
+158
+157
+157
+156
+157
+157
+158
+159
+161
+162
+166
+169
+172
+175
+178
+183
+186
+190
+193
+197
+201
+204
+205
+202
+193
+173
+167
+165
+164
+163
+153
+142
+135
+129
+126
+123
+120
+116
+113
+110
+109
+107
+108
+112
+118
+131
+142
+154
+164
+175
+188
+195
+201
+204
+206
+208
+208
+209
+209
+210
+210
+211
+211
+212
+213
+213
+214
+214
+214
+215
+215
+215
+215
+215
+216
+216
+216
+215
+215
+215
+215
+214
+214
+213
+213
+212
+212
+212
+211
+211
+211
+211
+211
+211
+210
+208
+203
+194
+181
+164
+137
+121
+111
+105
+103
+104
+108
+114
+123
+135
+155
+171
+184
+194
+201
+207
+210
+213
+215
+216
+216
+215
+210
+205
+199
+188
+185
+184
+186
+190
+186
+180
+165
+135
+82
+20
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+83
+89
+93
+95
+96
+93
+92
+94
+103
+122
+132
+133
+131
+124
+113
+93
+74
+56
+41
+28
+14
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+23
+66
+156
+175
+185
+191
+196
+196
+193
+192
+192
+194
+197
+201
+205
+208
+208
+208
+208
+208
+207
+206
+199
+188
+175
+163
+154
+154
+155
+154
+150
+146
+147
+168
+190
+206
+209
+209
+208
+205
+202
+199
+191
+185
+178
+171
+165
+154
+148
+142
+137
+132
+126
+123
+120
+118
+117
+116
+116
+116
+117
+118
+123
+132
+144
+159
+174
+191
+200
+206
+210
+212
+213
+213
+211
+208
+203
+197
+192
+188
+184
+182
+178
+177
+175
+174
+173
+172
+171
+171
+172
+172
+174
+176
+178
+180
+183
+187
+192
+196
+200
+204
+207
+206
+203
+199
+194
+189
+186
+183
+176
+162
+132
+125
+122
+122
+122
+124
+124
+123
+121
+117
+113
+109
+106
+103
+103
+108
+114
+122
+133
+145
+165
+180
+191
+199
+203
+206
+207
+208
+208
+209
+210
+210
+211
+211
+212
+213
+214
+214
+215
+216
+216
+217
+217
+217
+217
+218
+218
+218
+218
+218
+218
+218
+217
+217
+217
+217
+217
+216
+216
+215
+214
+214
+213
+212
+212
+211
+211
+211
+211
+210
+210
+208
+203
+193
+177
+149
+129
+115
+106
+102
+102
+105
+110
+118
+128
+149
+166
+181
+192
+200
+206
+210
+213
+215
+216
+217
+214
+209
+203
+196
+186
+185
+185
+188
+191
+184
+177
+156
+119
+62
+12
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+84
+93
+99
+102
+102
+99
+98
+105
+117
+134
+139
+138
+132
+121
+107
+80
+60
+44
+31
+18
+10
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+20
+58
+150
+171
+182
+189
+197
+198
+197
+195
+195
+196
+202
+206
+209
+210
+210
+210
+210
+209
+207
+203
+185
+165
+149
+138
+132
+144
+150
+151
+149
+145
+145
+162
+184
+203
+207
+208
+208
+207
+206
+206
+203
+201
+197
+192
+186
+176
+168
+160
+153
+146
+138
+132
+128
+124
+120
+117
+116
+115
+115
+115
+115
+116
+118
+123
+132
+152
+169
+184
+197
+206
+212
+214
+214
+214
+214
+214
+213
+211
+208
+204
+200
+198
+196
+195
+195
+197
+198
+200
+201
+202
+205
+207
+209
+210
+211
+212
+213
+213
+212
+212
+208
+198
+181
+160
+138
+117
+110
+108
+111
+119
+129
+136
+138
+138
+133
+126
+118
+109
+100
+96
+93
+94
+95
+99
+106
+127
+149
+169
+186
+197
+203
+205
+207
+207
+208
+208
+209
+209
+210
+211
+212
+213
+214
+215
+216
+217
+217
+217
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+218
+217
+217
+216
+215
+214
+213
+212
+211
+211
+211
+211
+210
+210
+207
+201
+189
+162
+139
+121
+108
+102
+100
+103
+107
+113
+122
+143
+163
+179
+191
+199
+206
+211
+214
+215
+216
+217
+213
+207
+201
+193
+186
+185
+187
+189
+191
+182
+173
+145
+101
+43
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+85
+99
+106
+109
+109
+108
+110
+120
+133
+143
+144
+138
+128
+111
+87
+55
+42
+29
+19
+10
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+14
+43
+133
+160
+173
+181
+192
+199
+200
+201
+202
+204
+209
+210
+211
+211
+211
+211
+209
+205
+194
+176
+141
+120
+108
+103
+103
+128
+142
+148
+148
+144
+142
+150
+172
+193
+201
+204
+206
+207
+207
+207
+207
+207
+207
+207
+206
+202
+197
+190
+183
+175
+165
+157
+150
+143
+136
+130
+125
+121
+119
+116
+115
+114
+114
+114
+114
+117
+120
+127
+136
+149
+167
+180
+192
+201
+208
+213
+216
+218
+220
+221
+221
+220
+219
+218
+217
+215
+215
+215
+215
+215
+214
+213
+212
+209
+205
+193
+175
+156
+137
+122
+106
+105
+108
+116
+129
+144
+148
+149
+149
+145
+137
+124
+111
+99
+92
+90
+89
+89
+90
+93
+102
+118
+139
+162
+183
+197
+202
+205
+206
+207
+208
+208
+209
+209
+210
+211
+213
+214
+215
+216
+217
+217
+217
+218
+218
+218
+218
+218
+218
+218
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+219
+218
+218
+218
+218
+217
+216
+215
+214
+212
+212
+211
+211
+210
+210
+210
+207
+200
+176
+151
+130
+113
+102
+99
+101
+104
+108
+116
+139
+160
+177
+190
+199
+207
+211
+214
+216
+217
+216
+211
+205
+197
+190
+186
+186
+189
+190
+189
+178
+163
+124
+73
+23
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+86
+102
+110
+113
+114
+115
+121
+131
+141
+147
+145
+134
+116
+94
+72
+53
+39
+25
+15
+8
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+9
+29
+114
+148
+163
+169
+177
+196
+202
+204
+206
+209
+211
+212
+212
+212
+211
+209
+202
+187
+166
+140
+116
+105
+98
+95
+95
+110
+132
+142
+145
+144
+140
+142
+159
+179
+191
+196
+201
+204
+205
+205
+207
+207
+208
+208
+208
+207
+205
+202
+198
+192
+183
+176
+169
+161
+154
+145
+140
+135
+130
+127
+122
+119
+117
+115
+114
+114
+115
+117
+119
+123
+129
+135
+142
+150
+159
+169
+176
+183
+188
+193
+196
+199
+200
+202
+202
+201
+198
+192
+184
+174
+160
+152
+144
+137
+130
+125
+124
+127
+131
+136
+142
+144
+145
+146
+149
+149
+141
+131
+120
+109
+101
+97
+93
+90
+89
+89
+94
+102
+114
+131
+158
+172
+184
+193
+200
+204
+206
+207
+208
+208
+209
+210
+212
+213
+214
+215
+216
+216
+217
+217
+218
+218
+218
+218
+218
+219
+219
+219
+220
+221
+222
+222
+223
+223
+224
+224
+224
+224
+224
+224
+223
+222
+221
+221
+220
+220
+219
+219
+219
+219
+219
+218
+218
+218
+217
+215
+214
+213
+212
+211
+210
+210
+210
+208
+205
+185
+160
+137
+118
+104
+99
+101
+102
+106
+113
+137
+159
+177
+191
+200
+208
+212
+215
+216
+217
+215
+209
+202
+195
+188
+186
+187
+190
+190
+185
+174
+150
+104
+53
+14
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+87
+105
+114
+117
+118
+122
+131
+141
+147
+150
+143
+126
+106
+87
+71
+57
+44
+30
+17
+9
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+16
+89
+134
+152
+156
+160
+180
+196
+203
+207
+210
+211
+212
+212
+211
+209
+198
+182
+160
+138
+121
+106
+99
+95
+92
+91
+98
+117
+133
+143
+144
+138
+137
+147
+162
+176
+182
+189
+194
+197
+198
+202
+204
+206
+207
+208
+208
+209
+208
+206
+203
+196
+191
+184
+176
+169
+159
+153
+147
+142
+139
+134
+130
+126
+123
+120
+117
+116
+114
+114
+113
+114
+116
+119
+123
+128
+134
+139
+143
+146
+149
+151
+153
+154
+154
+152
+149
+146
+143
+138
+132
+127
+127
+128
+128
+127
+129
+133
+139
+146
+152
+157
+157
+154
+148
+139
+125
+115
+107
+98
+91
+87
+87
+88
+91
+96
+107
+122
+138
+155
+171
+190
+198
+202
+205
+206
+207
+208
+209
+210
+211
+213
+214
+215
+216
+216
+217
+217
+218
+218
+218
+218
+218
+219
+220
+220
+221
+222
+223
+224
+225
+227
+227
+228
+229
+229
+230
+229
+229
+229
+229
+228
+227
+226
+225
+224
+223
+222
+221
+220
+219
+219
+219
+219
+219
+218
+217
+216
+214
+212
+211
+210
+210
+210
+209
+207
+192
+168
+144
+122
+106
+99
+100
+101
+104
+110
+137
+160
+179
+192
+201
+209
+213
+215
+216
+216
+213
+206
+199
+192
+187
+187
+189
+191
+189
+181
+169
+133
+83
+36
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+88
+109
+118
+121
+122
+130
+141
+148
+151
+151
+138
+118
+102
+90
+83
+73
+60
+45
+31
+18
+7
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+59
+115
+140
+146
+145
+157
+180
+194
+202
+207
+209
+209
+208
+205
+199
+178
+155
+135
+120
+114
+108
+104
+101
+98
+93
+93
+104
+122
+138
+143
+137
+133
+135
+143
+156
+163
+170
+176
+180
+182
+189
+193
+196
+200
+203
+205
+207
+209
+209
+208
+205
+201
+196
+190
+182
+173
+166
+159
+153
+149
+145
+142
+138
+135
+131
+126
+123
+120
+118
+117
+115
+114
+114
+114
+114
+114
+114
+115
+115
+115
+114
+114
+114
+113
+112
+111
+111
+112
+113
+115
+123
+132
+140
+148
+153
+159
+161
+163
+163
+162
+156
+149
+140
+129
+114
+96
+90
+87
+86
+86
+88
+91
+96
+105
+117
+140
+160
+177
+192
+200
+205
+206
+207
+208
+208
+209
+210
+212
+213
+214
+216
+217
+217
+217
+217
+218
+218
+218
+218
+219
+219
+220
+221
+222
+223
+225
+226
+227
+229
+230
+231
+232
+232
+233
+233
+233
+233
+233
+233
+233
+232
+231
+231
+230
+228
+227
+225
+224
+222
+221
+220
+219
+219
+219
+219
+218
+217
+215
+213
+212
+211
+210
+210
+210
+209
+197
+175
+150
+127
+107
+99
+99
+100
+103
+109
+138
+162
+180
+194
+203
+210
+214
+216
+216
+216
+211
+203
+196
+190
+187
+187
+190
+191
+187
+177
+160
+112
+62
+22
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+90
+112
+121
+124
+126
+138
+148
+153
+153
+150
+130
+113
+106
+105
+106
+105
+89
+76
+60
+39
+16
+6
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+25
+92
+127
+139
+137
+132
+149
+172
+192
+198
+204
+204
+200
+192
+178
+148
+130
+122
+118
+116
+117
+121
+121
+114
+100
+93
+95
+109
+126
+139
+140
+132
+128
+128
+133
+140
+144
+148
+153
+154
+160
+167
+174
+181
+189
+196
+202
+206
+209
+210
+211
+210
+208
+203
+196
+187
+178
+169
+161
+155
+151
+149
+147
+146
+144
+141
+138
+135
+132
+130
+126
+123
+120
+118
+116
+115
+114
+114
+113
+113
+114
+115
+117
+121
+126
+135
+141
+145
+148
+151
+155
+159
+161
+163
+165
+166
+166
+165
+163
+159
+143
+124
+108
+96
+89
+86
+85
+85
+86
+87
+95
+102
+116
+133
+154
+184
+195
+202
+205
+206
+207
+207
+208
+209
+210
+213
+215
+216
+217
+217
+217
+217
+218
+218
+218
+218
+218
+219
+220
+221
+222
+223
+224
+225
+226
+228
+229
+230
+230
+231
+232
+233
+233
+234
+234
+234
+234
+234
+234
+233
+233
+233
+232
+232
+231
+230
+229
+228
+226
+224
+221
+220
+220
+219
+219
+219
+218
+217
+215
+212
+211
+210
+210
+210
+209
+201
+180
+156
+131
+109
+99
+99
+100
+103
+109
+141
+165
+183
+196
+204
+212
+215
+216
+216
+216
+208
+200
+193
+189
+187
+188
+192
+190
+184
+173
+146
+89
+42
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+116
+126
+128
+131
+145
+153
+156
+154
+146
+124
+120
+121
+124
+125
+119
+110
+103
+92
+73
+49
+27
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+38
+90
+133
+139
+119
+117
+124
+137
+152
+159
+162
+159
+151
+136
+126
+124
+123
+125
+134
+147
+150
+152
+150
+144
+114
+100
+98
+108
+132
+140
+137
+130
+122
+121
+119
+118
+118
+118
+117
+117
+119
+122
+127
+134
+149
+164
+180
+194
+204
+211
+214
+216
+216
+213
+208
+202
+193
+183
+172
+161
+156
+152
+150
+149
+148
+147
+146
+145
+145
+144
+144
+143
+143
+143
+143
+143
+143
+144
+144
+145
+147
+149
+151
+153
+155
+155
+157
+159
+163
+167
+170
+173
+174
+174
+170
+165
+155
+142
+125
+105
+97
+91
+88
+86
+85
+87
+89
+94
+103
+118
+139
+161
+182
+197
+204
+206
+207
+207
+208
+209
+210
+212
+214
+216
+217
+217
+217
+217
+217
+218
+218
+218
+218
+219
+220
+221
+222
+223
+224
+224
+225
+226
+226
+227
+228
+229
+230
+231
+232
+232
+233
+233
+233
+233
+233
+232
+232
+232
+232
+232
+232
+232
+232
+231
+231
+230
+229
+229
+228
+225
+223
+221
+220
+220
+219
+219
+218
+216
+214
+211
+210
+210
+210
+210
+204
+186
+161
+135
+112
+100
+99
+99
+103
+112
+148
+171
+187
+199
+207
+213
+216
+217
+216
+214
+203
+195
+191
+188
+188
+191
+192
+185
+175
+166
+115
+58
+22
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+118
+129
+131
+133
+148
+155
+157
+153
+142
+128
+129
+132
+136
+137
+131
+123
+115
+105
+91
+72
+52
+32
+15
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+14
+51
+97
+135
+130
+117
+113
+117
+126
+138
+140
+138
+134
+129
+126
+126
+130
+137
+144
+150
+152
+154
+154
+154
+142
+122
+106
+101
+112
+137
+138
+132
+124
+120
+117
+114
+113
+112
+112
+110
+110
+110
+110
+111
+114
+122
+134
+149
+166
+188
+200
+207
+212
+214
+213
+211
+207
+201
+194
+179
+171
+164
+158
+154
+152
+150
+149
+148
+148
+147
+147
+146
+146
+146
+146
+147
+147
+148
+149
+150
+152
+154
+157
+159
+163
+166
+169
+172
+174
+176
+177
+177
+175
+171
+161
+149
+137
+124
+112
+99
+93
+89
+87
+86
+88
+93
+100
+110
+124
+152
+173
+188
+198
+204
+206
+207
+208
+208
+210
+212
+214
+215
+216
+217
+217
+217
+217
+217
+218
+218
+218
+219
+220
+221
+222
+222
+223
+223
+224
+224
+225
+225
+225
+226
+227
+228
+229
+229
+230
+230
+230
+230
+229
+229
+229
+229
+228
+228
+229
+229
+229
+230
+230
+230
+230
+230
+230
+229
+228
+227
+225
+223
+221
+220
+220
+219
+219
+217
+214
+212
+211
+210
+210
+210
+205
+188
+164
+137
+113
+100
+99
+99
+104
+117
+155
+176
+191
+202
+209
+214
+216
+216
+215
+210
+199
+193
+189
+188
+189
+192
+192
+182
+168
+153
+85
+38
+12
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+120
+131
+133
+135
+149
+156
+158
+153
+141
+133
+136
+140
+144
+144
+141
+135
+128
+118
+105
+85
+70
+52
+32
+12
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+22
+56
+105
+134
+125
+115
+110
+112
+120
+126
+128
+129
+128
+128
+132
+137
+143
+148
+150
+152
+154
+156
+157
+155
+142
+123
+106
+101
+122
+134
+135
+129
+121
+117
+114
+112
+111
+110
+108
+106
+105
+103
+102
+100
+101
+105
+112
+122
+145
+167
+184
+198
+207
+213
+214
+213
+211
+207
+197
+188
+179
+171
+165
+160
+157
+156
+154
+153
+152
+151
+151
+151
+151
+151
+152
+153
+154
+155
+158
+160
+163
+165
+168
+171
+174
+177
+179
+180
+181
+179
+176
+172
+165
+151
+139
+127
+115
+104
+94
+90
+88
+88
+89
+95
+103
+116
+132
+152
+180
+194
+201
+205
+206
+207
+208
+210
+211
+213
+215
+216
+217
+217
+217
+217
+217
+217
+218
+218
+219
+220
+220
+221
+222
+223
+223
+223
+223
+223
+223
+223
+223
+224
+225
+226
+227
+228
+228
+228
+228
+228
+228
+227
+227
+227
+227
+227
+227
+227
+227
+227
+228
+228
+229
+229
+229
+229
+229
+228
+228
+226
+225
+223
+221
+220
+220
+219
+218
+215
+212
+211
+210
+210
+210
+206
+189
+165
+138
+114
+101
+99
+100
+107
+123
+163
+182
+195
+204
+211
+216
+216
+216
+213
+207
+195
+191
+189
+189
+190
+193
+188
+177
+159
+132
+58
+23
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+93
+121
+132
+135
+137
+149
+156
+158
+153
+141
+137
+142
+147
+149
+150
+149
+145
+139
+130
+117
+95
+81
+67
+50
+27
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+20
+58
+117
+128
+123
+114
+109
+108
+117
+123
+128
+130
+131
+137
+142
+145
+147
+149
+151
+153
+155
+157
+158
+156
+142
+121
+100
+103
+124
+135
+136
+126
+119
+116
+113
+112
+110
+109
+108
+106
+104
+102
+97
+94
+91
+89
+88
+101
+125
+149
+171
+189
+207
+212
+213
+214
+214
+209
+203
+195
+187
+178
+170
+166
+164
+161
+160
+158
+157
+156
+156
+156
+156
+157
+158
+160
+162
+166
+168
+171
+173
+176
+179
+180
+182
+183
+183
+182
+179
+174
+167
+158
+143
+132
+120
+109
+99
+90
+89
+89
+90
+94
+105
+119
+137
+158
+180
+199
+204
+206
+207
+207
+209
+210
+212
+214
+216
+217
+217
+217
+217
+217
+217
+217
+218
+218
+219
+220
+221
+221
+222
+222
+222
+222
+222
+221
+221
+221
+221
+222
+223
+224
+226
+226
+227
+227
+227
+227
+227
+227
+227
+227
+226
+226
+226
+226
+226
+226
+226
+226
+226
+227
+228
+228
+229
+229
+228
+228
+227
+226
+224
+222
+220
+220
+219
+218
+215
+212
+211
+210
+210
+210
+206
+190
+165
+138
+115
+101
+99
+101
+110
+133
+171
+187
+199
+207
+212
+216
+216
+215
+210
+202
+192
+190
+189
+190
+191
+192
+181
+169
+146
+106
+34
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+91
+121
+133
+137
+138
+149
+156
+157
+153
+142
+141
+148
+152
+154
+154
+153
+152
+148
+141
+129
+104
+88
+75
+63
+50
+11
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+65
+114
+131
+128
+117
+106
+107
+115
+125
+132
+137
+140
+142
+144
+145
+146
+148
+150
+154
+157
+159
+158
+155
+142
+111
+93
+107
+127
+140
+137
+123
+120
+117
+114
+113
+113
+112
+112
+110
+108
+100
+95
+90
+85
+81
+77
+85
+105
+130
+157
+191
+205
+211
+213
+215
+213
+211
+207
+201
+192
+182
+176
+171
+169
+167
+164
+163
+162
+161
+161
+161
+162
+163
+165
+167
+169
+171
+174
+177
+179
+183
+185
+186
+187
+186
+183
+178
+172
+163
+153
+138
+125
+112
+101
+94
+90
+90
+92
+96
+102
+119
+140
+162
+183
+200
+205
+206
+207
+208
+209
+211
+214
+216
+217
+217
+217
+217
+217
+217
+217
+217
+218
+219
+219
+220
+221
+221
+221
+222
+221
+221
+220
+219
+219
+219
+220
+221
+222
+223
+225
+226
+226
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+226
+226
+226
+226
+226
+226
+226
+226
+226
+227
+227
+228
+228
+228
+227
+226
+225
+223
+221
+220
+220
+218
+215
+212
+211
+210
+210
+210
+206
+189
+165
+138
+115
+101
+100
+103
+116
+144
+179
+193
+203
+209
+215
+216
+216
+213
+207
+197
+190
+189
+189
+191
+193
+191
+174
+157
+129
+74
+16
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+87
+118
+133
+137
+139
+148
+156
+157
+153
+146
+146
+152
+155
+155
+155
+154
+154
+153
+152
+150
+127
+101
+82
+68
+61
+35
+12
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+34
+81
+121
+133
+127
+115
+111
+113
+118
+127
+134
+138
+139
+139
+139
+141
+145
+151
+157
+160
+160
+159
+156
+149
+99
+91
+100
+119
+141
+139
+130
+125
+122
+120
+122
+125
+127
+129
+129
+124
+117
+106
+93
+82
+74
+69
+67
+73
+91
+137
+167
+190
+204
+212
+215
+213
+213
+211
+207
+198
+189
+182
+176
+172
+169
+167
+165
+164
+163
+164
+165
+166
+169
+171
+176
+179
+182
+184
+186
+188
+188
+188
+188
+187
+182
+176
+169
+159
+148
+131
+118
+107
+98
+93
+91
+93
+97
+105
+118
+147
+170
+189
+202
+206
+207
+207
+209
+210
+212
+216
+216
+217
+217
+217
+217
+217
+217
+217
+217
+218
+219
+219
+220
+220
+220
+220
+220
+219
+218
+217
+218
+218
+219
+219
+220
+222
+223
+225
+225
+226
+226
+226
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+226
+226
+226
+226
+226
+226
+226
+227
+227
+227
+227
+226
+225
+224
+222
+221
+220
+218
+215
+212
+211
+210
+210
+210
+206
+187
+161
+135
+114
+101
+102
+109
+128
+162
+189
+199
+207
+213
+216
+216
+215
+208
+200
+192
+189
+189
+190
+192
+192
+182
+165
+136
+94
+37
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+84
+113
+130
+137
+140
+147
+155
+157
+154
+148
+149
+154
+155
+155
+154
+154
+154
+154
+155
+154
+146
+120
+93
+71
+62
+47
+21
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+10
+28
+56
+94
+119
+122
+123
+123
+123
+124
+126
+128
+128
+128
+130
+136
+142
+148
+155
+161
+161
+160
+159
+156
+132
+102
+91
+97
+114
+139
+137
+134
+130
+127
+128
+130
+132
+133
+133
+132
+131
+126
+117
+103
+81
+71
+64
+62
+63
+83
+114
+146
+177
+202
+213
+213
+213
+212
+210
+206
+202
+195
+188
+181
+176
+173
+171
+169
+168
+168
+168
+170
+172
+174
+179
+181
+184
+186
+188
+189
+189
+190
+189
+187
+182
+175
+167
+157
+145
+127
+114
+104
+97
+93
+93
+97
+105
+119
+138
+168
+187
+199
+205
+207
+208
+209
+211
+213
+215
+216
+217
+217
+217
+217
+217
+217
+217
+217
+218
+219
+219
+219
+220
+220
+219
+218
+217
+217
+217
+217
+217
+218
+219
+220
+222
+224
+225
+226
+226
+226
+226
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+226
+226
+226
+226
+226
+226
+227
+227
+226
+226
+225
+224
+222
+222
+220
+218
+215
+211
+211
+210
+210
+210
+204
+184
+158
+132
+112
+102
+103
+118
+142
+175
+195
+203
+210
+215
+216
+216
+211
+204
+196
+191
+190
+190
+191
+192
+191
+169
+152
+113
+64
+19
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+82
+107
+126
+137
+140
+147
+155
+157
+154
+149
+152
+155
+155
+155
+154
+154
+154
+155
+157
+158
+156
+138
+108
+77
+60
+52
+33
+14
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+18
+42
+70
+94
+109
+118
+123
+128
+130
+131
+131
+132
+134
+139
+144
+149
+154
+160
+161
+162
+161
+159
+150
+123
+100
+87
+92
+117
+132
+137
+137
+134
+133
+133
+134
+135
+135
+136
+136
+136
+132
+124
+103
+84
+69
+58
+52
+54
+71
+98
+133
+171
+204
+210
+213
+213
+212
+210
+208
+203
+198
+191
+183
+179
+176
+174
+172
+170
+171
+171
+173
+176
+180
+184
+186
+188
+190
+190
+191
+190
+190
+188
+181
+174
+165
+154
+142
+123
+111
+102
+96
+93
+95
+103
+116
+134
+156
+184
+198
+204
+207
+208
+209
+211
+213
+215
+216
+217
+217
+217
+217
+217
+217
+217
+217
+218
+218
+219
+219
+219
+219
+218
+217
+216
+216
+216
+216
+217
+218
+219
+221
+223
+225
+225
+226
+226
+226
+226
+226
+226
+226
+226
+226
+226
+226
+226
+227
+227
+227
+227
+227
+227
+227
+227
+227
+227
+226
+226
+226
+226
+226
+226
+226
+226
+226
+225
+224
+223
+222
+220
+217
+214
+211
+211
+210
+210
+209
+201
+179
+154
+129
+109
+104
+107
+129
+159
+185
+199
+207
+213
+216
+216
+214
+207
+199
+193
+190
+190
+191
+192
+190
+184
+160
+133
+87
+39
+9
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+81
+102
+121
+135
+141
+147
+154
+157
+155
+151
+154
+155
+155
+154
+153
+153
+154
+156
+159
+161
+161
+153
+125
+89
+58
+51
+42
+22
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+19
+48
+70
+87
+101
+117
+125
+130
+135
+139
+143
+147
+150
+153
+155
+159
+161
+162
+162
+160
+158
+145
+120
+94
+80
+89
+113
+129
+138
+140
+137
+137
+136
+136
+136
+136
+137
+139
+139
+139
+128
+106
+83
+64
+51
+43
+44
+58
+85
+124
+180
+199
+210
+214
+214
+212
+210
+208
+205
+200
+191
+186
+181
+178
+175
+173
+172
+173
+174
+177
+182
+185
+188
+191
+191
+191
+191
+191
+190
+188
+181
+173
+163
+152
+139
+120
+109
+100
+96
+94
+100
+111
+128
+149
+172
+196
+204
+207
+208
+209
+210
+213
+215
+216
+217
+217
+217
+217
+217
+217
+217
+217
+218
+218
+218
+219
+218
+218
+217
+216
+215
+215
+215
+215
+216
+218
+219
+221
+223
+225
+226
+226
+226
+226
+226
+226
+226
+226
+226
+225
+225
+225
+225
+226
+226
+226
+226
+226
+227
+227
+227
+227
+227
+227
+227
+226
+226
+226
+226
+226
+226
+226
+225
+225
+223
+223
+222
+219
+216
+213
+211
+210
+210
+210
+209
+197
+173
+148
+126
+108
+106
+115
+144
+175
+193
+203
+211
+215
+216
+216
+211
+201
+195
+191
+190
+190
+192
+191
+186
+173
+151
+107
+59
+20
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+80
+96
+115
+132
+142
+147
+154
+157
+155
+152
+155
+156
+155
+153
+153
+153
+154
+158
+162
+165
+166
+162
+143
+108
+57
+43
+43
+26
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+18
+39
+72
+91
+109
+124
+138
+151
+155
+157
+157
+157
+159
+160
+162
+162
+162
+160
+157
+144
+120
+82
+72
+79
+103
+128
+141
+142
+140
+139
+137
+136
+136
+138
+139
+141
+142
+142
+133
+110
+82
+54
+41
+37
+37
+44
+65
+133
+177
+202
+213
+215
+214
+211
+210
+208
+206
+199
+192
+187
+182
+178
+175
+174
+175
+176
+178
+183
+187
+190
+191
+192
+192
+192
+191
+190
+187
+180
+172
+162
+150
+136
+117
+106
+99
+96
+96
+105
+122
+142
+164
+186
+205
+207
+208
+209
+210
+212
+214
+216
+216
+217
+217
+217
+217
+217
+217
+217
+217
+218
+218
+218
+218
+217
+216
+215
+215
+214
+214
+215
+215
+217
+220
+223
+225
+226
+226
+226
+226
+226
+226
+225
+225
+224
+224
+224
+224
+224
+224
+224
+224
+225
+225
+225
+226
+226
+226
+227
+227
+227
+227
+227
+226
+226
+226
+225
+225
+225
+225
+225
+224
+223
+223
+222
+219
+215
+212
+210
+210
+210
+210
+209
+192
+167
+142
+120
+108
+108
+131
+162
+188
+198
+208
+214
+216
+216
+215
+205
+196
+192
+190
+190
+192
+192
+190
+181
+161
+135
+77
+33
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+81
+91
+109
+129
+143
+149
+155
+157
+156
+154
+155
+155
+154
+153
+153
+153
+155
+161
+168
+174
+175
+171
+161
+135
+85
+37
+39
+29
+14
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+7
+15
+29
+48
+72
+106
+127
+141
+151
+155
+157
+159
+160
+161
+162
+161
+160
+158
+150
+130
+77
+67
+66
+80
+113
+141
+142
+143
+142
+140
+138
+139
+140
+142
+144
+145
+143
+135
+117
+85
+44
+36
+32
+30
+31
+52
+103
+156
+197
+215
+216
+214
+212
+210
+209
+206
+202
+196
+191
+185
+180
+177
+176
+177
+178
+184
+187
+190
+192
+192
+193
+192
+192
+190
+187
+180
+171
+160
+147
+133
+114
+104
+98
+97
+100
+117
+137
+158
+180
+199
+207
+208
+209
+210
+211
+214
+216
+216
+217
+217
+217
+217
+217
+217
+217
+217
+217
+218
+217
+217
+216
+215
+214
+214
+213
+214
+214
+216
+219
+222
+225
+226
+226
+226
+226
+226
+225
+224
+224
+223
+223
+223
+223
+223
+223
+223
+222
+222
+222
+222
+222
+223
+223
+224
+225
+226
+227
+227
+227
+227
+227
+226
+225
+225
+225
+225
+225
+224
+224
+223
+223
+220
+217
+213
+211
+210
+210
+210
+208
+205
+181
+159
+133
+113
+109
+118
+159
+184
+198
+203
+214
+216
+216
+214
+210
+196
+192
+191
+191
+191
+192
+190
+179
+164
+151
+89
+38
+11
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+81
+89
+107
+128
+144
+150
+155
+157
+157
+155
+156
+155
+154
+153
+153
+153
+155
+162
+169
+177
+179
+177
+169
+148
+110
+34
+27
+22
+15
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+10
+18
+31
+59
+85
+108
+127
+140
+149
+153
+156
+158
+160
+161
+160
+159
+156
+149
+113
+79
+62
+59
+71
+115
+135
+143
+144
+143
+142
+142
+143
+144
+146
+147
+146
+140
+128
+107
+63
+41
+30
+27
+26
+33
+55
+98
+149
+196
+216
+216
+215
+213
+210
+207
+204
+200
+195
+189
+183
+180
+178
+178
+179
+184
+188
+191
+192
+193
+193
+193
+192
+190
+187
+179
+170
+159
+145
+130
+111
+102
+98
+99
+106
+126
+147
+169
+189
+203
+208
+209
+210
+211
+213
+215
+216
+216
+217
+217
+217
+217
+217
+217
+217
+217
+217
+217
+217
+216
+215
+214
+213
+213
+213
+214
+216
+219
+222
+225
+226
+226
+226
+226
+225
+224
+223
+223
+223
+223
+223
+223
+223
+222
+222
+221
+221
+220
+220
+220
+221
+221
+222
+223
+224
+225
+226
+227
+227
+227
+227
+226
+225
+225
+224
+224
+224
+224
+223
+223
+222
+219
+215
+212
+210
+210
+210
+209
+206
+199
+175
+145
+124
+113
+112
+146
+177
+193
+202
+209
+215
+216
+215
+211
+202
+193
+191
+191
+191
+192
+191
+183
+170
+151
+127
+52
+19
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+81
+87
+106
+129
+145
+151
+156
+157
+157
+155
+156
+155
+154
+153
+153
+154
+155
+161
+169
+179
+182
+180
+175
+160
+129
+38
+22
+17
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+10
+25
+46
+68
+91
+112
+129
+138
+145
+150
+154
+157
+158
+159
+158
+157
+139
+105
+74
+51
+45
+76
+112
+133
+144
+145
+145
+145
+146
+147
+149
+150
+149
+145
+136
+122
+81
+49
+31
+23
+22
+25
+32
+57
+97
+152
+205
+213
+216
+215
+212
+210
+206
+203
+199
+194
+187
+183
+181
+181
+181
+184
+189
+191
+192
+193
+193
+193
+192
+190
+187
+179
+169
+157
+144
+128
+109
+101
+99
+102
+111
+135
+157
+178
+195
+206
+209
+209
+210
+212
+214
+216
+216
+216
+216
+216
+216
+217
+217
+217
+217
+217
+217
+217
+216
+215
+214
+213
+212
+213
+213
+216
+219
+222
+224
+226
+226
+226
+225
+224
+223
+222
+222
+223
+223
+223
+223
+223
+222
+221
+220
+220
+220
+220
+220
+220
+220
+220
+221
+222
+223
+225
+226
+227
+227
+227
+226
+225
+225
+224
+224
+224
+224
+223
+223
+222
+220
+217
+213
+211
+210
+210
+209
+208
+203
+194
+161
+133
+119
+117
+126
+171
+190
+200
+206
+213
+216
+216
+212
+205
+196
+191
+191
+191
+191
+192
+187
+173
+158
+134
+91
+25
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+81
+86
+106
+130
+146
+152
+156
+158
+157
+155
+156
+154
+154
+154
+154
+154
+155
+160
+167
+178
+183
+182
+180
+169
+144
+49
+22
+13
+10
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+6
+16
+32
+52
+75
+99
+114
+126
+135
+142
+149
+153
+155
+157
+158
+154
+132
+97
+60
+34
+39
+77
+111
+136
+145
+147
+148
+149
+150
+152
+153
+152
+149
+142
+131
+98
+61
+35
+20
+17
+20
+22
+31
+54
+98
+177
+203
+214
+217
+215
+212
+209
+206
+203
+199
+192
+187
+184
+183
+183
+184
+189
+191
+193
+193
+193
+193
+192
+190
+187
+179
+169
+156
+142
+126
+108
+101
+100
+106
+117
+143
+165
+185
+200
+208
+209
+210
+211
+213
+215
+216
+216
+216
+216
+216
+216
+216
+217
+217
+217
+217
+216
+216
+215
+214
+212
+212
+212
+213
+214
+218
+221
+224
+225
+226
+225
+224
+223
+222
+221
+221
+222
+223
+223
+223
+223
+222
+221
+220
+220
+220
+220
+220
+220
+220
+220
+220
+221
+221
+223
+225
+226
+227
+227
+227
+226
+225
+224
+224
+224
+223
+223
+223
+222
+221
+218
+214
+212
+210
+210
+209
+209
+206
+199
+184
+143
+125
+119
+126
+149
+189
+198
+205
+210
+215
+216
+213
+206
+198
+192
+191
+191
+191
+191
+190
+178
+162
+142
+108
+52
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+82
+87
+108
+132
+147
+153
+157
+158
+157
+156
+156
+155
+155
+155
+155
+155
+155
+157
+162
+173
+181
+182
+181
+174
+159
+69
+25
+8
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+7
+16
+31
+58
+78
+94
+108
+120
+133
+142
+149
+154
+156
+156
+151
+126
+86
+35
+18
+34
+73
+116
+143
+147
+149
+151
+152
+154
+156
+155
+153
+148
+140
+114
+78
+44
+19
+12
+13
+18
+23
+31
+48
+130
+182
+208
+217
+216
+215
+212
+209
+205
+201
+196
+191
+187
+186
+186
+187
+190
+191
+193
+193
+193
+193
+192
+190
+187
+178
+168
+155
+140
+124
+106
+101
+102
+110
+124
+150
+172
+191
+204
+209
+210
+211
+212
+214
+215
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+215
+214
+213
+212
+212
+212
+213
+216
+220
+223
+225
+226
+226
+224
+223
+221
+221
+220
+221
+222
+223
+224
+224
+223
+221
+220
+220
+220
+220
+220
+220
+220
+220
+220
+220
+221
+222
+223
+225
+226
+227
+227
+227
+226
+225
+224
+223
+223
+223
+222
+222
+221
+220
+216
+212
+210
+210
+209
+209
+208
+204
+192
+167
+125
+121
+125
+143
+179
+199
+204
+209
+214
+216
+215
+208
+200
+193
+191
+191
+191
+191
+190
+185
+164
+152
+118
+70
+19
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+83
+90
+113
+136
+147
+154
+157
+158
+157
+156
+156
+155
+156
+157
+157
+155
+155
+155
+157
+162
+178
+182
+182
+178
+165
+86
+31
+8
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+12
+23
+38
+54
+72
+95
+114
+130
+143
+151
+155
+154
+148
+124
+71
+14
+10
+22
+54
+106
+142
+147
+151
+153
+155
+156
+155
+153
+151
+147
+126
+99
+64
+32
+11
+7
+9
+14
+21
+28
+56
+122
+175
+208
+217
+216
+215
+213
+210
+206
+201
+198
+194
+191
+190
+190
+191
+192
+193
+193
+193
+193
+192
+190
+187
+178
+167
+153
+138
+121
+105
+102
+105
+115
+131
+158
+179
+196
+206
+210
+211
+211
+213
+214
+215
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+215
+214
+213
+212
+211
+212
+213
+215
+218
+222
+224
+225
+225
+224
+222
+220
+219
+219
+220
+222
+223
+224
+224
+224
+222
+221
+220
+220
+220
+220
+220
+220
+220
+220
+220
+220
+221
+222
+224
+226
+226
+227
+227
+226
+225
+223
+223
+222
+222
+222
+221
+221
+220
+216
+212
+210
+209
+209
+209
+208
+205
+191
+167
+134
+125
+127
+150
+179
+198
+205
+211
+214
+215
+215
+208
+198
+193
+192
+191
+191
+191
+189
+181
+167
+153
+119
+69
+23
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+84
+95
+117
+139
+148
+155
+158
+158
+157
+156
+156
+156
+157
+158
+159
+157
+156
+155
+155
+158
+172
+180
+182
+179
+171
+98
+37
+10
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+8
+14
+23
+36
+60
+83
+106
+127
+141
+151
+153
+150
+134
+97
+22
+9
+9
+23
+52
+108
+133
+145
+151
+154
+155
+154
+152
+150
+146
+129
+103
+71
+38
+13
+6
+6
+9
+13
+22
+40
+79
+136
+187
+212
+216
+216
+215
+213
+210
+204
+201
+198
+195
+193
+193
+193
+193
+194
+194
+194
+193
+192
+190
+187
+178
+166
+153
+137
+120
+105
+103
+108
+119
+135
+162
+183
+198
+208
+210
+211
+212
+213
+214
+215
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+215
+214
+213
+211
+211
+212
+213
+215
+219
+223
+224
+224
+224
+223
+220
+219
+218
+219
+220
+223
+224
+224
+224
+224
+222
+221
+221
+220
+220
+220
+220
+220
+220
+220
+220
+221
+222
+224
+225
+226
+226
+226
+226
+225
+223
+222
+222
+221
+221
+221
+221
+219
+216
+212
+210
+209
+209
+208
+208
+206
+193
+169
+146
+132
+129
+151
+174
+194
+204
+210
+213
+215
+214
+211
+199
+194
+192
+192
+191
+191
+188
+180
+169
+159
+128
+76
+35
+8
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+85
+99
+122
+142
+149
+157
+159
+159
+157
+156
+156
+157
+158
+159
+159
+159
+157
+155
+155
+156
+166
+177
+182
+180
+174
+106
+42
+12
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+8
+14
+30
+51
+77
+103
+127
+144
+148
+148
+137
+109
+28
+10
+3
+7
+19
+61
+97
+124
+141
+149
+152
+152
+150
+146
+142
+127
+105
+75
+42
+14
+6
+5
+6
+8
+13
+27
+52
+98
+151
+199
+214
+216
+215
+214
+213
+208
+204
+201
+199
+197
+195
+195
+195
+194
+194
+194
+194
+193
+190
+187
+177
+166
+152
+136
+119
+105
+104
+110
+122
+138
+165
+185
+200
+208
+211
+211
+212
+213
+214
+215
+216
+216
+216
+216
+216
+216
+216
+216
+216
+216
+215
+214
+213
+212
+211
+211
+212
+213
+216
+219
+223
+223
+223
+223
+221
+218
+217
+217
+218
+220
+224
+224
+224
+224
+224
+223
+222
+222
+221
+220
+220
+220
+220
+220
+221
+222
+223
+224
+225
+226
+226
+226
+225
+224
+223
+221
+221
+221
+221
+221
+220
+218
+215
+212
+210
+208
+208
+208
+208
+206
+194
+172
+152
+138
+133
+148
+174
+192
+203
+208
+213
+214
+213
+210
+203
+194
+192
+192
+192
+192
+189
+181
+171
+158
+141
+86
+40
+13
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+87
+104
+126
+144
+150
+158
+159
+159
+157
+156
+156
+157
+159
+160
+160
+159
+159
+157
+155
+155
+161
+174
+181
+181
+175
+111
+46
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+10
+24
+45
+71
+100
+126
+135
+137
+129
+107
+31
+10
+2
+2
+3
+20
+54
+87
+116
+136
+143
+145
+144
+141
+137
+122
+104
+75
+44
+14
+5
+5
+4
+5
+6
+17
+34
+65
+112
+175
+210
+214
+216
+215
+214
+212
+207
+205
+202
+200
+197
+197
+196
+195
+195
+194
+194
+193
+191
+187
+178
+166
+151
+135
+117
+106
+106
+112
+124
+141
+167
+187
+200
+209
+211
+212
+212
+213
+214
+215
+215
+216
+216
+216
+216
+216
+216
+216
+216
+216
+215
+214
+213
+212
+211
+211
+212
+213
+216
+219
+222
+222
+222
+221
+219
+216
+216
+216
+217
+220
+224
+225
+225
+225
+225
+224
+223
+223
+222
+222
+221
+221
+221
+222
+222
+224
+225
+225
+226
+226
+226
+225
+224
+222
+221
+220
+220
+220
+220
+219
+217
+214
+211
+209
+208
+208
+208
+207
+204
+198
+174
+152
+142
+140
+144
+174
+193
+203
+209
+212
+214
+213
+210
+204
+196
+192
+192
+192
+191
+190
+182
+171
+159
+140
+109
+41
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+87
+110
+131
+147
+151
+158
+160
+159
+157
+156
+156
+158
+159
+160
+160
+160
+159
+158
+156
+155
+158
+171
+179
+181
+177
+115
+48
+14
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+14
+30
+54
+94
+107
+111
+105
+92
+29
+10
+2
+1
+1
+3
+13
+37
+71
+108
+126
+133
+134
+132
+129
+116
+98
+73
+43
+13
+4
+4
+4
+4
+4
+7
+21
+45
+81
+134
+201
+211
+215
+216
+215
+214
+211
+207
+204
+203
+199
+198
+198
+197
+196
+195
+194
+193
+191
+187
+178
+166
+151
+134
+117
+107
+108
+114
+126
+143
+169
+187
+201
+209
+211
+212
+213
+213
+214
+215
+215
+216
+216
+216
+216
+216
+216
+216
+216
+216
+215
+214
+213
+212
+211
+211
+212
+213
+216
+219
+221
+221
+221
+220
+218
+215
+215
+215
+216
+220
+224
+225
+225
+225
+225
+225
+225
+224
+224
+224
+224
+224
+224
+225
+225
+225
+226
+226
+226
+226
+225
+223
+222
+221
+220
+220
+220
+219
+217
+216
+212
+210
+208
+208
+208
+208
+207
+205
+196
+178
+149
+144
+142
+148
+168
+197
+205
+209
+212
+214
+214
+210
+203
+196
+192
+192
+192
+191
+189
+184
+171
+162
+144
+111
+58
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+89
+118
+138
+149
+152
+159
+161
+159
+157
+157
+157
+158
+159
+160
+160
+160
+160
+159
+157
+155
+157
+169
+178
+181
+177
+117
+48
+14
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+4
+7
+24
+36
+39
+37
+30
+10
+4
+2
+1
+1
+1
+2
+6
+16
+39
+80
+97
+106
+108
+106
+95
+80
+55
+29
+7
+2
+2
+3
+3
+3
+4
+7
+21
+47
+88
+169
+200
+213
+216
+216
+215
+214
+210
+207
+205
+203
+201
+199
+198
+197
+195
+194
+193
+191
+188
+178
+166
+151
+134
+117
+108
+109
+116
+127
+143
+168
+186
+200
+209
+211
+212
+213
+213
+214
+214
+215
+215
+215
+216
+216
+216
+216
+216
+216
+216
+215
+214
+213
+211
+211
+211
+211
+213
+215
+218
+220
+220
+219
+218
+216
+214
+213
+213
+215
+219
+224
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+226
+225
+225
+224
+222
+220
+220
+219
+218
+217
+215
+214
+212
+210
+208
+208
+208
+208
+207
+205
+198
+183
+166
+152
+147
+148
+161
+180
+199
+209
+211
+213
+213
+213
+208
+200
+195
+192
+192
+192
+191
+186
+180
+172
+160
+136
+94
+48
+11
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+91
+124
+143
+151
+153
+160
+161
+159
+157
+157
+157
+158
+159
+160
+160
+160
+160
+159
+157
+155
+157
+169
+178
+181
+177
+114
+46
+13
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+8
+12
+13
+12
+10
+4
+2
+1
+1
+1
+1
+1
+3
+6
+14
+37
+59
+74
+81
+82
+74
+61
+41
+20
+5
+2
+2
+2
+3
+3
+3
+5
+13
+30
+61
+133
+182
+206
+214
+216
+216
+215
+213
+210
+206
+204
+202
+201
+200
+199
+196
+195
+193
+191
+188
+179
+167
+152
+135
+118
+109
+110
+117
+128
+143
+166
+184
+198
+208
+211
+212
+213
+213
+214
+214
+215
+215
+215
+215
+216
+216
+216
+216
+216
+216
+215
+214
+213
+212
+211
+211
+211
+212
+214
+217
+218
+218
+218
+217
+215
+212
+212
+212
+213
+216
+223
+224
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+225
+224
+224
+222
+221
+220
+218
+217
+216
+215
+214
+213
+212
+210
+210
+209
+208
+208
+207
+205
+203
+190
+176
+165
+157
+152
+155
+168
+184
+199
+208
+211
+212
+213
+212
+208
+199
+195
+193
+192
+192
+189
+185
+179
+172
+163
+133
+90
+50
+19
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+94
+129
+147
+153
+154
+160
+161
+160
+158
+157
+157
+158
+159
+159
+160
+160
+160
+159
+157
+156
+157
+169
+178
+181
+176
+108
+43
+12
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+3
+2
+2
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+13
+28
+41
+51
+56
+51
+41
+27
+13
+4
+1
+1
+1
+2
+3
+3
+4
+7
+18
+39
+101
+158
+194
+212
+215
+216
+216
+215
+212
+209
+206
+204
+203
+201
+200
+197
+195
+194
+192
+188
+180
+168
+153
+136
+119
+110
+111
+117
+127
+141
+163
+181
+196
+206
+211
+212
+213
+213
+214
+214
+215
+215
+215
+215
+215
+216
+216
+216
+216
+216
+215
+214
+213
+212
+211
+211
+211
+212
+213
+215
+217
+217
+217
+216
+215
+212
+211
+211
+211
+213
+220
+223
+224
+225
+225
+225
+225
+225
+224
+224
+224
+224
+223
+223
+222
+221
+220
+218
+217
+216
+215
+214
+213
+212
+212
+210
+210
+209
+208
+208
+207
+205
+201
+195
+187
+174
+165
+159
+157
+159
+174
+189
+201
+208
+211
+212
+212
+210
+206
+201
+195
+193
+192
+191
+189
+184
+179
+171
+159
+139
+89
+48
+21
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+98
+133
+150
+155
+156
+161
+161
+160
+158
+157
+157
+158
+158
+159
+160
+160
+160
+159
+157
+156
+157
+170
+179
+181
+174
+100
+38
+10
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+7
+16
+24
+30
+28
+23
+15
+8
+3
+1
+1
+1
+1
+2
+2
+3
+4
+9
+22
+72
+128
+175
+206
+214
+215
+216
+216
+215
+212
+208
+207
+205
+203
+201
+198
+196
+194
+192
+189
+181
+170
+155
+138
+120
+111
+112
+117
+127
+139
+160
+177
+192
+204
+210
+212
+213
+213
+214
+214
+214
+214
+215
+215
+215
+215
+216
+216
+216
+216
+215
+214
+213
+212
+211
+211
+211
+211
+212
+214
+216
+216
+216
+215
+214
+211
+210
+209
+209
+210
+216
+221
+223
+224
+225
+225
+224
+224
+223
+223
+222
+222
+221
+220
+219
+217
+216
+215
+214
+213
+212
+211
+211
+210
+210
+209
+208
+208
+207
+206
+202
+197
+190
+181
+171
+163
+161
+162
+166
+175
+195
+205
+210
+212
+212
+212
+209
+205
+200
+195
+193
+192
+191
+188
+185
+178
+171
+157
+134
+99
+42
+17
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+102
+136
+151
+156
+157
+161
+161
+160
+158
+157
+157
+157
+158
+159
+159
+159
+159
+159
+157
+156
+158
+172
+180
+180
+171
+87
+32
+8
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+5
+8
+9
+7
+5
+3
+2
+1
+1
+1
+1
+1
+2
+2
+3
+4
+7
+44
+98
+154
+197
+212
+215
+216
+216
+216
+216
+211
+209
+207
+205
+202
+200
+196
+194
+192
+190
+182
+171
+157
+140
+122
+113
+113
+117
+125
+137
+156
+172
+188
+200
+208
+211
+213
+213
+214
+214
+214
+214
+214
+215
+215
+215
+215
+215
+215
+215
+215
+215
+214
+213
+212
+211
+211
+211
+212
+213
+214
+215
+215
+214
+214
+211
+209
+208
+208
+208
+210
+216
+220
+223
+224
+224
+224
+223
+222
+222
+220
+219
+218
+217
+216
+214
+213
+212
+212
+211
+211
+210
+210
+209
+209
+208
+207
+206
+204
+200
+190
+181
+174
+168
+164
+163
+164
+172
+184
+200
+210
+211
+212
+212
+212
+209
+203
+198
+195
+193
+192
+190
+187
+183
+179
+172
+159
+130
+91
+45
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+108
+137
+152
+157
+158
+162
+162
+161
+159
+157
+157
+157
+158
+158
+159
+159
+159
+158
+157
+156
+160
+175
+181
+177
+162
+65
+22
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+3
+5
+19
+58
+113
+168
+206
+214
+215
+216
+217
+217
+215
+212
+210
+208
+205
+201
+198
+195
+193
+191
+184
+174
+160
+144
+126
+114
+114
+117
+124
+133
+149
+164
+180
+193
+203
+209
+211
+213
+213
+214
+214
+214
+214
+214
+214
+215
+215
+215
+215
+215
+215
+215
+214
+214
+213
+212
+211
+211
+211
+212
+213
+213
+213
+213
+213
+211
+209
+208
+206
+206
+205
+207
+211
+215
+218
+221
+222
+221
+221
+220
+219
+218
+217
+215
+214
+213
+212
+211
+211
+210
+210
+209
+208
+207
+206
+202
+197
+192
+185
+179
+173
+170
+169
+168
+167
+176
+189
+200
+207
+211
+212
+212
+211
+209
+206
+199
+196
+194
+193
+192
+188
+184
+180
+176
+170
+145
+105
+63
+28
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+111
+138
+152
+158
+159
+162
+162
+161
+159
+158
+157
+158
+158
+158
+159
+159
+159
+158
+157
+157
+164
+178
+182
+173
+146
+47
+15
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+2
+3
+12
+38
+83
+138
+194
+212
+214
+215
+216
+217
+216
+214
+212
+210
+206
+202
+198
+196
+193
+192
+185
+176
+163
+148
+130
+116
+115
+117
+123
+131
+144
+157
+172
+186
+197
+205
+209
+212
+213
+213
+214
+214
+214
+214
+214
+214
+215
+215
+215
+215
+215
+215
+215
+214
+213
+212
+212
+211
+211
+212
+212
+212
+212
+212
+212
+211
+209
+208
+206
+205
+204
+204
+205
+207
+209
+212
+214
+216
+216
+217
+216
+215
+215
+214
+213
+211
+210
+209
+208
+207
+205
+203
+200
+197
+194
+188
+184
+181
+178
+175
+172
+172
+174
+179
+185
+196
+203
+208
+210
+211
+211
+209
+207
+204
+200
+196
+194
+192
+189
+187
+183
+180
+173
+161
+140
+92
+54
+27
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+115
+139
+152
+159
+160
+163
+163
+161
+160
+158
+158
+158
+158
+158
+158
+159
+158
+158
+157
+157
+169
+180
+181
+165
+124
+31
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+6
+23
+57
+107
+171
+208
+212
+214
+215
+217
+217
+216
+214
+211
+208
+203
+199
+196
+194
+192
+186
+178
+166
+152
+134
+118
+116
+118
+122
+128
+139
+151
+164
+178
+190
+200
+206
+209
+212
+213
+213
+214
+214
+214
+214
+214
+214
+214
+215
+215
+215
+215
+215
+214
+214
+213
+212
+212
+212
+212
+212
+212
+212
+212
+212
+211
+209
+208
+207
+205
+203
+203
+202
+203
+203
+205
+206
+207
+208
+209
+209
+208
+208
+207
+206
+205
+204
+202
+200
+199
+196
+193
+191
+188
+185
+181
+179
+177
+176
+176
+178
+181
+187
+193
+200
+207
+210
+211
+211
+210
+208
+205
+202
+199
+196
+193
+190
+188
+185
+182
+178
+169
+152
+127
+93
+45
+22
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+118
+139
+152
+159
+161
+163
+163
+162
+160
+158
+158
+158
+158
+158
+158
+159
+158
+158
+157
+159
+175
+181
+178
+154
+96
+17
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+12
+36
+77
+139
+200
+209
+213
+214
+216
+217
+216
+215
+213
+209
+204
+200
+197
+195
+193
+188
+180
+170
+156
+139
+121
+118
+118
+121
+126
+135
+144
+156
+168
+181
+194
+200
+205
+209
+212
+213
+213
+213
+213
+214
+214
+214
+214
+214
+214
+215
+215
+215
+215
+214
+214
+213
+213
+212
+212
+212
+212
+212
+212
+211
+211
+210
+209
+207
+206
+204
+203
+202
+201
+200
+200
+200
+200
+200
+200
+200
+200
+200
+199
+198
+197
+195
+194
+192
+190
+187
+185
+183
+182
+181
+179
+179
+179
+181
+183
+189
+195
+201
+206
+210
+212
+211
+210
+209
+207
+204
+200
+197
+195
+193
+189
+186
+184
+180
+177
+165
+145
+116
+81
+45
+13
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+120
+140
+152
+159
+161
+164
+164
+163
+161
+158
+158
+158
+158
+158
+158
+159
+158
+157
+158
+161
+181
+182
+173
+138
+64
+8
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+19
+49
+102
+187
+204
+212
+214
+214
+216
+216
+215
+213
+211
+205
+201
+198
+196
+194
+189
+182
+173
+161
+145
+124
+120
+119
+121
+125
+132
+138
+147
+158
+171
+185
+193
+200
+205
+209
+212
+213
+213
+213
+213
+213
+213
+214
+214
+214
+214
+214
+214
+214
+214
+214
+214
+213
+213
+212
+212
+212
+212
+211
+211
+211
+210
+209
+208
+207
+204
+203
+202
+201
+200
+198
+198
+197
+196
+195
+194
+194
+193
+192
+191
+190
+189
+188
+187
+186
+184
+184
+183
+182
+181
+182
+184
+187
+192
+198
+205
+209
+211
+211
+212
+211
+209
+207
+205
+202
+199
+196
+193
+190
+187
+184
+182
+180
+175
+167
+138
+101
+63
+31
+10
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+123
+140
+152
+159
+162
+164
+164
+164
+162
+160
+158
+158
+158
+158
+159
+159
+158
+158
+161
+170
+183
+181
+152
+100
+29
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+9
+25
+59
+145
+188
+207
+213
+214
+215
+215
+215
+214
+211
+207
+203
+200
+197
+195
+191
+186
+178
+167
+154
+132
+124
+121
+121
+124
+129
+133
+138
+146
+156
+170
+180
+188
+195
+201
+207
+210
+211
+212
+213
+213
+213
+213
+213
+213
+213
+214
+214
+214
+214
+214
+214
+214
+213
+213
+213
+212
+212
+212
+211
+211
+210
+210
+209
+208
+207
+205
+204
+202
+200
+199
+198
+197
+196
+195
+194
+193
+192
+192
+191
+190
+189
+188
+187
+187
+186
+187
+188
+191
+194
+199
+203
+207
+209
+210
+211
+211
+211
+210
+208
+206
+204
+202
+199
+197
+193
+190
+186
+184
+182
+179
+174
+164
+145
+114
+65
+34
+14
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+124
+139
+151
+159
+162
+165
+165
+164
+163
+161
+159
+159
+159
+159
+159
+159
+158
+159
+164
+177
+181
+171
+124
+64
+12
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+5
+15
+36
+103
+165
+198
+211
+213
+214
+215
+215
+214
+212
+208
+205
+201
+199
+196
+192
+188
+181
+173
+162
+141
+129
+124
+122
+124
+128
+131
+134
+139
+146
+158
+167
+176
+184
+192
+200
+204
+207
+210
+211
+212
+212
+212
+212
+213
+213
+213
+213
+213
+214
+214
+214
+214
+213
+213
+213
+213
+213
+212
+212
+212
+211
+211
+210
+210
+209
+208
+206
+205
+204
+202
+201
+200
+198
+197
+196
+195
+195
+194
+194
+193
+194
+194
+195
+195
+197
+199
+201
+203
+205
+207
+209
+209
+210
+210
+210
+209
+208
+206
+205
+202
+200
+197
+194
+190
+186
+184
+182
+180
+177
+168
+150
+124
+93
+60
+26
+13
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+125
+139
+150
+158
+162
+165
+165
+165
+164
+162
+160
+159
+159
+160
+160
+158
+158
+162
+170
+180
+179
+148
+91
+35
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+18
+68
+134
+180
+207
+213
+214
+214
+214
+214
+213
+209
+206
+203
+200
+197
+194
+190
+185
+178
+169
+150
+137
+128
+124
+124
+127
+129
+132
+135
+139
+148
+156
+164
+172
+180
+190
+196
+201
+205
+208
+210
+211
+212
+212
+212
+212
+212
+212
+212
+213
+213
+213
+213
+213
+213
+213
+213
+213
+213
+213
+212
+212
+212
+212
+211
+210
+210
+209
+208
+207
+206
+205
+204
+203
+203
+202
+201
+201
+201
+201
+201
+202
+202
+203
+204
+206
+207
+208
+209
+210
+210
+210
+209
+209
+209
+207
+206
+204
+203
+200
+197
+194
+191
+187
+184
+181
+179
+176
+170
+161
+135
+107
+77
+48
+25
+7
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+126
+139
+149
+157
+162
+165
+165
+165
+164
+163
+161
+161
+161
+161
+160
+158
+160
+167
+175
+181
+170
+115
+57
+14
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+7
+39
+98
+155
+197
+211
+213
+214
+214
+214
+213
+210
+207
+204
+201
+199
+195
+192
+188
+182
+175
+160
+146
+135
+128
+126
+126
+129
+131
+133
+135
+140
+146
+152
+160
+167
+178
+185
+191
+197
+201
+206
+208
+210
+211
+211
+211
+211
+212
+212
+212
+212
+212
+213
+213
+213
+213
+213
+213
+213
+213
+213
+213
+212
+212
+212
+212
+211
+211
+211
+211
+210
+209
+209
+209
+208
+208
+208
+208
+208
+208
+208
+209
+209
+209
+210
+210
+210
+210
+210
+210
+209
+209
+208
+207
+206
+204
+202
+200
+198
+195
+190
+187
+184
+181
+179
+176
+172
+163
+149
+128
+89
+59
+34
+16
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+127
+138
+148
+156
+161
+164
+165
+165
+165
+164
+163
+163
+162
+161
+159
+159
+163
+172
+179
+178
+149
+72
+25
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+3
+14
+61
+122
+177
+208
+213
+213
+214
+214
+214
+211
+209
+206
+203
+200
+196
+194
+190
+185
+180
+168
+156
+144
+134
+128
+128
+129
+130
+132
+133
+135
+138
+143
+148
+154
+164
+171
+179
+185
+192
+199
+203
+206
+208
+210
+210
+211
+211
+211
+211
+211
+211
+211
+212
+212
+212
+212
+212
+213
+213
+213
+213
+212
+212
+212
+212
+212
+212
+212
+212
+212
+212
+212
+211
+211
+211
+211
+211
+211
+211
+211
+211
+210
+210
+210
+210
+210
+209
+209
+208
+207
+206
+206
+204
+203
+201
+198
+194
+191
+187
+182
+180
+178
+177
+175
+169
+157
+136
+109
+76
+39
+18
+7
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+127
+138
+147
+155
+160
+163
+164
+165
+165
+164
+164
+163
+161
+159
+159
+161
+170
+174
+172
+160
+76
+28
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+7
+24
+70
+130
+191
+211
+213
+213
+214
+214
+212
+210
+208
+205
+202
+199
+196
+193
+189
+185
+178
+169
+158
+148
+138
+132
+131
+131
+132
+133
+135
+135
+137
+139
+142
+148
+154
+160
+167
+173
+182
+188
+193
+198
+202
+206
+208
+209
+209
+210
+210
+210
+210
+210
+210
+210
+211
+211
+211
+211
+211
+212
+212
+212
+212
+212
+212
+212
+212
+212
+212
+211
+211
+211
+211
+211
+211
+211
+210
+210
+210
+209
+209
+209
+208
+207
+207
+207
+206
+206
+204
+203
+200
+197
+194
+189
+185
+182
+179
+177
+176
+174
+171
+166
+156
+128
+100
+70
+42
+23
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+128
+138
+147
+153
+158
+163
+164
+164
+165
+164
+164
+162
+161
+160
+161
+167
+173
+171
+154
+111
+39
+15
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+13
+43
+89
+153
+204
+211
+213
+213
+213
+213
+211
+209
+207
+204
+201
+198
+195
+192
+188
+183
+176
+168
+159
+150
+140
+137
+135
+134
+134
+135
+136
+137
+138
+140
+143
+146
+150
+154
+160
+167
+173
+179
+184
+190
+196
+200
+203
+205
+207
+208
+209
+209
+209
+209
+209
+209
+209
+209
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+210
+209
+209
+209
+209
+209
+208
+208
+208
+207
+207
+206
+205
+204
+202
+200
+197
+194
+190
+187
+183
+179
+177
+175
+174
+172
+169
+162
+150
+133
+111
+77
+51
+31
+18
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+128
+139
+147
+152
+157
+161
+163
+164
+164
+164
+162
+161
+160
+161
+162
+170
+171
+156
+123
+73
+23
+10
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+6
+23
+56
+111
+185
+204
+212
+213
+213
+213
+212
+210
+208
+206
+203
+200
+197
+194
+191
+186
+182
+177
+170
+162
+152
+146
+143
+140
+138
+137
+138
+138
+139
+139
+141
+143
+145
+148
+151
+156
+161
+165
+170
+176
+183
+188
+192
+196
+199
+202
+204
+206
+207
+207
+208
+208
+208
+208
+208
+208
+208
+209
+209
+209
+209
+209
+209
+209
+209
+209
+209
+209
+208
+208
+208
+208
+207
+207
+207
+206
+206
+205
+204
+203
+200
+198
+196
+193
+190
+186
+183
+180
+177
+175
+173
+171
+169
+166
+161
+147
+131
+111
+89
+65
+36
+20
+11
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+129
+140
+147
+152
+155
+160
+162
+163
+164
+163
+161
+160
+161
+162
+164
+171
+162
+132
+91
+49
+19
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+10
+31
+69
+153
+190
+207
+212
+213
+213
+213
+211
+210
+208
+205
+202
+199
+197
+194
+190
+187
+183
+178
+173
+164
+158
+153
+149
+145
+142
+141
+141
+140
+141
+141
+142
+143
+145
+146
+149
+152
+155
+159
+163
+169
+174
+178
+183
+187
+193
+196
+199
+201
+203
+204
+205
+206
+206
+207
+207
+207
+207
+207
+207
+207
+207
+207
+207
+207
+207
+207
+207
+206
+206
+206
+205
+205
+204
+203
+202
+200
+199
+197
+195
+191
+188
+185
+182
+179
+176
+173
+172
+170
+169
+166
+163
+157
+148
+136
+111
+88
+66
+45
+28
+9
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+130
+141
+147
+151
+154
+159
+162
+163
+162
+160
+160
+161
+161
+163
+167
+169
+144
+107
+70
+44
+23
+11
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+12
+32
+108
+166
+198
+211
+213
+213
+213
+212
+211
+209
+207
+204
+201
+199
+196
+192
+190
+187
+185
+182
+175
+170
+166
+162
+158
+153
+150
+147
+145
+143
+142
+142
+143
+144
+145
+146
+149
+150
+152
+154
+158
+161
+165
+169
+172
+178
+182
+186
+190
+193
+197
+199
+201
+203
+204
+204
+205
+205
+205
+205
+205
+205
+205
+204
+204
+204
+204
+203
+203
+202
+201
+200
+199
+197
+196
+193
+190
+188
+185
+182
+178
+175
+173
+171
+169
+168
+167
+166
+165
+163
+157
+147
+132
+114
+91
+61
+41
+26
+15
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+131
+142
+148
+151
+153
+159
+160
+159
+159
+160
+161
+159
+159
+162
+170
+155
+117
+90
+70
+52
+25
+12
+5
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+10
+48
+109
+163
+200
+211
+212
+213
+213
+212
+211
+209
+207
+204
+202
+199
+196
+193
+191
+190
+188
+185
+182
+179
+177
+175
+172
+169
+166
+163
+159
+154
+151
+148
+146
+146
+146
+148
+149
+150
+152
+154
+155
+157
+158
+160
+162
+165
+167
+169
+172
+175
+178
+181
+184
+186
+189
+191
+192
+194
+194
+195
+195
+195
+195
+194
+194
+192
+191
+190
+188
+186
+184
+182
+180
+178
+175
+173
+171
+169
+167
+166
+165
+164
+164
+163
+161
+158
+153
+144
+131
+107
+87
+68
+49
+31
+13
+9
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+131
+143
+149
+151
+153
+158
+158
+159
+160
+161
+159
+157
+161
+167
+168
+131
+108
+95
+83
+65
+32
+16
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+24
+68
+121
+170
+203
+211
+212
+212
+212
+212
+210
+209
+206
+204
+202
+198
+196
+194
+192
+191
+190
+188
+186
+184
+183
+181
+180
+178
+176
+174
+171
+168
+164
+161
+157
+152
+151
+150
+150
+151
+153
+154
+155
+156
+158
+160
+161
+162
+164
+165
+167
+168
+169
+170
+172
+173
+174
+175
+177
+177
+178
+179
+179
+180
+180
+179
+179
+178
+177
+176
+174
+173
+171
+170
+168
+166
+165
+164
+163
+163
+162
+161
+159
+156
+152
+141
+129
+115
+100
+83
+60
+45
+32
+20
+10
+5
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+133
+144
+149
+151
+153
+157
+158
+159
+160
+160
+156
+156
+164
+168
+158
+120
+113
+110
+105
+92
+52
+27
+11
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+9
+35
+79
+130
+180
+207
+210
+212
+212
+212
+211
+210
+208
+206
+204
+201
+199
+196
+194
+193
+192
+191
+191
+190
+188
+188
+187
+186
+186
+185
+183
+181
+178
+176
+172
+167
+163
+160
+157
+155
+155
+155
+155
+156
+157
+158
+159
+160
+161
+162
+163
+163
+164
+164
+165
+165
+166
+166
+166
+167
+167
+167
+168
+168
+167
+167
+167
+166
+166
+165
+164
+163
+163
+162
+161
+160
+159
+159
+158
+157
+153
+148
+142
+134
+123
+105
+90
+73
+57
+43
+27
+19
+12
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+134
+145
+149
+151
+153
+157
+159
+161
+161
+157
+154
+160
+168
+166
+144
+121
+127
+130
+130
+123
+84
+49
+23
+7
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+12
+41
+85
+143
+194
+206
+211
+212
+212
+212
+211
+210
+208
+207
+204
+202
+199
+197
+195
+194
+193
+193
+193
+192
+192
+192
+192
+191
+191
+191
+190
+189
+188
+186
+183
+179
+175
+171
+166
+162
+161
+159
+159
+158
+159
+159
+160
+161
+161
+162
+162
+163
+163
+163
+163
+163
+162
+162
+162
+162
+161
+161
+161
+160
+160
+159
+159
+159
+158
+158
+158
+157
+157
+157
+156
+155
+154
+151
+148
+138
+128
+116
+102
+86
+65
+49
+35
+24
+15
+7
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+136
+146
+150
+151
+153
+157
+163
+163
+159
+153
+154
+169
+172
+160
+131
+135
+145
+150
+150
+148
+127
+82
+43
+15
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+13
+42
+92
+166
+195
+208
+211
+212
+212
+212
+211
+210
+209
+207
+204
+202
+200
+197
+195
+195
+194
+194
+194
+195
+195
+195
+195
+195
+195
+195
+194
+194
+193
+193
+192
+191
+189
+186
+181
+177
+172
+168
+165
+162
+161
+161
+161
+162
+162
+163
+163
+163
+163
+163
+163
+163
+162
+162
+162
+161
+161
+160
+160
+159
+159
+158
+158
+158
+157
+156
+156
+155
+154
+153
+151
+147
+141
+133
+114
+99
+83
+66
+49
+29
+18
+11
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+137
+146
+150
+151
+154
+162
+164
+161
+156
+155
+168
+177
+163
+144
+135
+153
+155
+155
+153
+151
+146
+127
+86
+41
+10
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+10
+30
+96
+151
+187
+207
+211
+211
+212
+212
+211
+210
+209
+208
+206
+204
+202
+199
+197
+196
+195
+195
+195
+196
+196
+196
+196
+196
+196
+197
+197
+197
+197
+197
+197
+197
+196
+195
+193
+192
+190
+187
+184
+181
+179
+176
+174
+172
+171
+171
+170
+170
+170
+169
+169
+169
+168
+167
+167
+166
+166
+165
+164
+163
+163
+162
+161
+160
+159
+157
+156
+154
+150
+144
+134
+120
+102
+77
+60
+44
+30
+18
+8
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+138
+146
+150
+153
+158
+167
+164
+160
+158
+162
+179
+179
+159
+140
+144
+157
+157
+156
+153
+150
+147
+139
+110
+69
+22
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+4
+12
+49
+97
+145
+185
+206
+211
+211
+212
+212
+212
+210
+209
+208
+207
+205
+203
+201
+199
+198
+197
+196
+196
+196
+196
+196
+196
+197
+197
+197
+198
+198
+198
+198
+198
+198
+198
+197
+197
+196
+196
+194
+193
+191
+190
+189
+187
+185
+184
+183
+183
+182
+181
+181
+180
+180
+179
+178
+178
+177
+177
+175
+174
+172
+170
+169
+165
+162
+159
+156
+152
+144
+132
+115
+96
+76
+52
+37
+24
+14
+7
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+139
+147
+150
+154
+162
+169
+163
+161
+164
+174
+184
+174
+154
+140
+151
+160
+160
+157
+153
+149
+146
+143
+125
+91
+38
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+20
+53
+97
+143
+183
+207
+210
+211
+212
+212
+211
+211
+210
+209
+208
+206
+205
+203
+201
+200
+199
+199
+198
+198
+197
+197
+197
+198
+198
+198
+199
+199
+199
+199
+199
+199
+199
+199
+199
+200
+199
+199
+198
+198
+198
+197
+196
+195
+194
+193
+192
+191
+191
+190
+189
+188
+187
+186
+185
+184
+181
+179
+177
+174
+171
+167
+162
+157
+150
+141
+123
+105
+86
+67
+50
+31
+20
+11
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+141
+147
+151
+156
+166
+170
+163
+164
+171
+185
+186
+166
+149
+142
+156
+163
+162
+157
+152
+147
+145
+143
+134
+107
+54
+9
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+21
+51
+92
+141
+189
+202
+209
+211
+211
+212
+211
+211
+210
+210
+209
+207
+206
+205
+204
+203
+202
+201
+200
+200
+199
+199
+199
+199
+200
+200
+200
+201
+201
+201
+200
+200
+201
+201
+201
+201
+201
+202
+202
+202
+202
+202
+202
+201
+201
+200
+199
+198
+197
+196
+194
+193
+191
+189
+186
+182
+179
+176
+172
+167
+159
+151
+142
+131
+116
+91
+72
+54
+39
+26
+15
+9
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+143
+148
+152
+158
+170
+169
+164
+168
+177
+188
+186
+157
+145
+147
+159
+164
+163
+157
+151
+145
+143
+142
+137
+117
+70
+13
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+5
+19
+44
+82
+147
+184
+203
+210
+210
+211
+212
+211
+211
+211
+210
+210
+209
+208
+207
+206
+205
+204
+203
+202
+202
+202
+202
+202
+202
+203
+203
+203
+203
+202
+202
+202
+202
+202
+201
+201
+202
+202
+203
+203
+204
+204
+204
+204
+204
+204
+203
+201
+200
+198
+195
+193
+190
+187
+184
+179
+175
+169
+162
+154
+137
+123
+107
+90
+73
+52
+37
+25
+15
+8
+5
+3
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+144
+148
+155
+163
+173
+166
+165
+173
+184
+189
+181
+150
+141
+147
+160
+161
+155
+149
+144
+143
+143
+142
+138
+122
+83
+19
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+10
+26
+68
+110
+150
+183
+204
+210
+211
+212
+212
+212
+212
+212
+211
+211
+211
+211
+211
+210
+210
+210
+209
+209
+208
+208
+208
+207
+207
+207
+206
+206
+205
+204
+203
+203
+202
+202
+202
+202
+203
+203
+203
+204
+204
+205
+205
+203
+201
+198
+195
+191
+185
+180
+172
+164
+154
+140
+128
+115
+102
+88
+71
+58
+44
+32
+23
+14
+10
+6
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+144
+149
+157
+166
+173
+164
+165
+176
+187
+190
+173
+147
+141
+146
+155
+151
+147
+144
+143
+142
+141
+140
+137
+123
+88
+21
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+9
+32
+60
+93
+127
+159
+189
+200
+206
+209
+211
+211
+212
+212
+212
+212
+212
+211
+211
+211
+211
+211
+211
+210
+210
+210
+209
+209
+208
+208
+207
+206
+205
+205
+204
+203
+202
+202
+202
+202
+203
+203
+202
+202
+201
+198
+191
+185
+178
+170
+161
+148
+138
+127
+116
+105
+89
+78
+67
+56
+45
+35
+26
+19
+13
+8
+5
+3
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+146
+150
+159
+167
+170
+162
+167
+179
+189
+189
+164
+144
+139
+143
+146
+144
+142
+142
+141
+141
+139
+139
+136
+123
+90
+23
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+11
+27
+48
+74
+104
+140
+161
+177
+189
+198
+204
+206
+208
+209
+209
+210
+210
+210
+210
+210
+210
+210
+210
+210
+209
+209
+209
+208
+208
+207
+206
+205
+204
+203
+202
+201
+201
+201
+201
+200
+199
+196
+192
+186
+178
+164
+154
+143
+131
+119
+103
+91
+80
+70
+60
+48
+39
+31
+24
+19
+13
+8
+6
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+147
+151
+159
+166
+166
+160
+170
+181
+190
+188
+156
+141
+138
+139
+139
+140
+141
+141
+140
+139
+138
+137
+135
+122
+90
+23
+8
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+7
+18
+33
+52
+83
+106
+128
+147
+163
+176
+183
+188
+192
+195
+197
+199
+200
+201
+201
+202
+202
+202
+203
+203
+203
+203
+203
+203
+203
+202
+201
+201
+200
+199
+197
+196
+195
+193
+190
+184
+177
+168
+157
+144
+126
+112
+99
+86
+74
+59
+49
+40
+32
+25
+19
+14
+9
+6
+5
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+147
+152
+160
+165
+162
+159
+174
+184
+189
+184
+148
+139
+136
+136
+137
+141
+141
+140
+139
+137
+137
+136
+133
+120
+87
+22
+7
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+3
+8
+17
+34
+50
+66
+81
+96
+115
+128
+139
+149
+157
+165
+169
+172
+175
+178
+180
+182
+184
+186
+188
+189
+190
+191
+192
+192
+192
+192
+191
+190
+189
+187
+184
+179
+174
+166
+153
+140
+126
+112
+98
+80
+67
+55
+43
+33
+24
+18
+12
+8
+5
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+147
+152
+157
+159
+155
+159
+180
+187
+183
+172
+142
+137
+136
+138
+141
+141
+141
+140
+138
+137
+136
+136
+132
+115
+77
+17
+6
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+6
+11
+18
+24
+31
+37
+41
+45
+50
+54
+60
+64
+67
+71
+74
+78
+81
+85
+89
+93
+100
+104
+108
+112
+115
+119
+121
+122
+122
+121
+117
+112
+106
+99
+91
+79
+70
+60
+50
+41
+30
+23
+17
+11
+6
+4
+2
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+145
+151
+154
+154
+152
+168
+183
+184
+176
+163
+141
+139
+139
+141
+142
+142
+141
+140
+140
+138
+137
+136
+130
+110
+67
+13
+4
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+2
+4
+6
+9
+11
+14
+15
+17
+18
+20
+22
+23
+25
+26
+28
+30
+31
+33
+35
+38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/info.txt
new file mode 100644
index 0000000..57fdc6b
--- /dev/null
+++ b/mfhdf/hrepack/info.txt
@@ -0,0 +1 @@
+-t "dset4:GZIP 6" -c "dset4:2x2"
diff --git a/mfhdf/hrepack/pal_rgb.h b/mfhdf/hrepack/pal_rgb.h
new file mode 100644
index 0000000..8c445bf
--- /dev/null
+++ b/mfhdf/hrepack/pal_rgb.h
@@ -0,0 +1,279 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+#if !defined(_PAL_RGB_H)
+#define _PAL_RGB_H
+
+unsigned char pal_rgb[256*3] = {0,0,0,
+0,0,131,
+0,0,135,
+0,0,139,
+0,0,143,
+0,0,147,
+0,0,151,
+0,0,155,
+0,0,159,
+0,0,163,
+0,0,167,
+0,0,171,
+0,0,175,
+0,0,179,
+0,0,183,
+0,0,187,
+0,0,191,
+0,0,195,
+0,0,199,
+0,0,203,
+0,0,207,
+0,0,211,
+0,0,215,
+0,0,219,
+0,0,223,
+0,0,227,
+0,0,231,
+0,0,235,
+0,0,239,
+0,0,243,
+0,0,247,
+0,0,251,
+0,0,255,
+0,0,255,
+0,3,255,
+0,7,255,
+0,11,255,
+0,15,255,
+0,19,255,
+0,23,255,
+0,27,255,
+0,31,255,
+0,35,255,
+0,39,255,
+0,43,255,
+0,47,255,
+0,51,255,
+0,55,255,
+0,59,255,
+0,63,255,
+0,67,255,
+0,71,255,
+0,75,255,
+0,79,255,
+0,83,255,
+0,87,255,
+0,91,255,
+0,95,255,
+0,99,255,
+0,103,255,
+0,107,255,
+0,111,255,
+0,115,255,
+0,119,255,
+0,123,255,
+0,127,255,
+0,131,255,
+0,135,255,
+0,139,255,
+0,143,255,
+0,147,255,
+0,151,255,
+0,155,255,
+0,159,255,
+0,163,255,
+0,167,255,
+0,171,255,
+0,175,255,
+0,179,255,
+0,183,255,
+0,187,255,
+0,191,255,
+0,195,255,
+0,199,255,
+0,203,255,
+0,207,255,
+0,211,255,
+0,215,255,
+0,219,255,
+0,223,255,
+0,227,255,
+0,231,255,
+0,235,255,
+0,239,255,
+0,243,255,
+0,247,255,
+0,251,255,
+0,255,255,
+0,255,255,
+3,255,251,
+7,255,247,
+11,255,243,
+15,255,239,
+19,255,235,
+23,255,231,
+27,255,227,
+31,255,223,
+35,255,219,
+39,255,215,
+43,255,211,
+47,255,207,
+51,255,203,
+55,255,199,
+59,255,195,
+63,255,191,
+67,255,187,
+71,255,183,
+75,255,179,
+79,255,175,
+83,255,171,
+87,255,167,
+91,255,163,
+95,255,159,
+99,255,155,
+103,255,151,
+107,255,147,
+111,255,143,
+115,255,139,
+119,255,135,
+123,255,131,
+127,255,127,
+131,255,123,
+135,255,119,
+139,255,115,
+143,255,111,
+147,255,107,
+151,255,103,
+155,255,99,
+159,255,95,
+163,255,91,
+167,255,87,
+171,255,83,
+175,255,79,
+179,255,75,
+183,255,71,
+187,255,67,
+191,255,63,
+195,255,59,
+199,255,55,
+203,255,51,
+207,255,47,
+211,255,43,
+215,255,39,
+219,255,35,
+223,255,31,
+227,255,27,
+231,255,23,
+235,255,19,
+239,255,15,
+243,255,11,
+247,255,7,
+251,255,3,
+255,255,0,
+255,251,0,
+255,247,0,
+255,243,0,
+255,239,0,
+255,235,0,
+255,231,0,
+255,227,0,
+255,223,0,
+255,219,0,
+255,215,0,
+255,211,0,
+255,207,0,
+255,203,0,
+255,199,0,
+255,195,0,
+255,191,0,
+255,187,0,
+255,183,0,
+255,179,0,
+255,175,0,
+255,171,0,
+255,167,0,
+255,163,0,
+255,159,0,
+255,155,0,
+255,151,0,
+255,147,0,
+255,143,0,
+255,139,0,
+255,135,0,
+255,131,0,
+255,127,0,
+255,123,0,
+255,119,0,
+255,115,0,
+255,111,0,
+255,107,0,
+255,103,0,
+255,99,0,
+255,95,0,
+255,91,0,
+255,87,0,
+255,83,0,
+255,79,0,
+255,75,0,
+255,71,0,
+255,67,0,
+255,63,0,
+255,59,0,
+255,55,0,
+255,51,0,
+255,47,0,
+255,43,0,
+255,39,0,
+255,35,0,
+255,31,0,
+255,27,0,
+255,23,0,
+255,19,0,
+255,15,0,
+255,11,0,
+255,7,0,
+255,3,0,
+255,0,0,
+250,0,0,
+246,0,0,
+241,0,0,
+237,0,0,
+233,0,0,
+228,0,0,
+224,0,0,
+219,0,0,
+215,0,0,
+211,0,0,
+206,0,0,
+202,0,0,
+197,0,0,
+193,0,0,
+189,0,0,
+184,0,0,
+180,0,0,
+175,0,0,
+171,0,0,
+167,0,0,
+162,0,0,
+158,0,0,
+153,0,0,
+149,0,0,
+145,0,0,
+140,0,0,
+136,0,0,
+131,0,0,
+127,0,0
+};
+ 
+#endif
+
+
+
diff --git a/mfhdf/libsrc/CMakeLists.txt b/mfhdf/libsrc/CMakeLists.txt
new file mode 100644
index 0000000..0ffb5de
--- /dev/null
+++ b/mfhdf/libsrc/CMakeLists.txt
@@ -0,0 +1,108 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_LIBSRC C CXX)
+
+#-----------------------------------------------------------------------------
+# Generate the netcdf.h file containing user settings needed by compilation
+#-----------------------------------------------------------------------------
+IF (WIN32 AND NOT CYGWIN)
+  SET (H4_WINDOWS_INCLUDE_FILE "#include <hdfi.h>")
+  SET (NETCDF_EXTERN HDFLIBAPI)
+ELSE (WIN32 AND NOT CYGWIN)
+  SET (NETCDF_EXTERN extern)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+SET (NC_OLD_FILLVALUES 0)
+
+SET (HDF4_MFHDF_LIBSRC_CSRCS
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/array.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/attr.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/cdf.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/dim.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/file.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/hdfsds.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/iarray.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/error.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/globdef.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfdatainfo.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfsd.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/nssdc.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/putget.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/putgetg.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/sharray.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/string.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/var.c
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/xdrposix.c
+)
+
+SET (HDF4_MFHDF_LIBSRC_CHDRS
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/alloc.h
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/error.h
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/local_nc.h
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdf.h
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdfi.h
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfdatainfo.h
+    ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/hdf2netcdf.h
+)
+
+IF (HDF4_ENABLE_NETCDF)
+  CONFIGURE_FILE (${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/netcdf.h.in ${HDF4_BINARY_DIR}/netcdf.h)
+  SET (HDF4_MFHDF_LIBSRC_XCHDRS ${HDF4_BINARY_DIR}/netcdf.h)
+ELSE(HDF4_ENABLE_NETCDF)
+  CONFIGURE_FILE (${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/netcdf.h.in ${HDF4_BINARY_DIR}/hdf4_netcdf.h)
+  SET (HDF4_MFHDF_LIBSRC_XCHDRS ${HDF4_BINARY_DIR}/hdf4_netcdf.h)
+ENDIF (HDF4_ENABLE_NETCDF)
+
+IF (NOT HDF4_BUILD_XDR_LIB)
+  INCLUDE_DIRECTORIES (/usr/include/rpc)
+ENDIF (NOT HDF4_BUILD_XDR_LIB)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS -DSWAP)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+ADD_LIBRARY (${HDF4_MF_LIB_TARGET} ${LIB_TYPE} ${HDF4_MFHDF_LIBSRC_CSRCS} ${HDF4_MFHDF_LIBSRC_CHDRS})
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+  TARGET_LINK_LIBRARIES (${HDF4_MF_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_C_PROPERTIES (${HDF4_MF_LIB_TARGET} " " " ")
+TARGET_LINK_LIBRARIES (${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET})
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_MF_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_MF_LIB_TARGET} ${HDF4_MF_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+    FILES
+        ${HDF4_MFHDF_LIBSRC_CHDRS} ${HDF4_MFHDF_LIBSRC_XCHDRS}
+    DESTINATION
+        ${HDF4_INSTALL_INCLUDE_DIR}
+    COMPONENT
+        headers
+)
+
+#-----------------------------------------------------------------------------
+# Add library to CMake Install : Installs lib and cmake config info
+#-----------------------------------------------------------------------------
+IF (BUILD_SHARED_LIBS)
+  INSTALL_TARGET_PDB (${HDF4_MF_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries)
+ENDIF (BUILD_SHARED_LIBS)
+  
+INSTALL (
+    TARGETS 
+        ${HDF4_MF_LIB_TARGET}
+    EXPORT 
+        ${HDF4_EXPORTED_TARGETS}
+    LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries 
+    ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
+    RUNTIME DESTINATION ${HDF4_INSTALL_BIN_DIR} COMPONENT libraries
+)
diff --git a/mfhdf/libsrc/Makefile.am b/mfhdf/libsrc/Makefile.am
new file mode 100644
index 0000000..21868b8
--- /dev/null
+++ b/mfhdf/libsrc/Makefile.am
@@ -0,0 +1,63 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+           -I$(top_srcdir)/mfhdf/libsrc   
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+
+#############################################################################
+##                          Library to build                               ##
+#############################################################################
+
+lib_LTLIBRARIES = libmfhdf.la
+
+## Information for building the "libmfhdf.la" library
+CSOURCES = array.c attr.c cdf.c dim.c file.c hdfsds.c iarray.c error.c    \
+         globdef.c mfsd.c mfdatainfo.c nssdc.c putget.c putgetg.c	\
+	 sharray.c string.c var.c xdrposix.c
+
+if HDF_BUILD_NETCDF
+FSOURCES = $(top_builddir)/mfhdf/fortran/jackets.c $(top_srcdir)/mfhdf/fortran/mfsdf.c $(top_srcdir)/mfhdf/fortran/mfsdff.f
+else
+FSOURCES = $(top_srcdir)/mfhdf/fortran/mfsdf.c $(top_srcdir)/mfhdf/fortran/mfsdff.f
+endif
+
+if HDF_BUILD_FORTRAN
+libmfhdf_la_SOURCES = $(CSOURCES) $(FSOURCES)
+else
+libmfhdf_la_SOURCES = $(CSOURCES)
+endif
+
+if HDF_BUILD_XDR
+XDRLIB = $(top_builddir)/mfhdf/xdr/libxdr.la
+libmfhdf_la_LIBADD = $(XDRLIB)
+endif
+
+if HDF_BUILD_NETCDF
+include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h netcdf.h mfhdfi.h mfdatainfo.h
+else
+include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h hdf4_netcdf.h mfhdfi.h mfdatainfo.h
+# mfdatainfo.h should be added conditionally only; should local_nc.h even be here? -BMR
+endif
+
+# The following is a workaround. Since Fortran is included in this 
+# Makefile.am, automake will always try to use the Fortran linker, even when
+# fortran has been disabled in configure. The Fortran linker gets confused 
+# when shared libraries are enabled, so when Fortran is not enabled,
+# this replaces the Fortran link macro with the C link macro.
+if HDF_BUILD_FORTRAN
+    # do nothing
+else
+    F77LINK = $(LINK)
+endif
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+DISTCLEANFILES = *.new *.hdf *.cdf *.cdl netcdf.h hdf4_netcdf.h This*
diff --git a/mfhdf/libsrc/Makefile.in b/mfhdf/libsrc/Makefile.in
new file mode 100644
index 0000000..1cdb694
--- /dev/null
+++ b/mfhdf/libsrc/Makefile.in
@@ -0,0 +1,748 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/netcdf.h.in \
+	$(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am
+F77LINK = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+subdir = mfhdf/libsrc
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = netcdf.h
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+ at HDF_BUILD_XDR_TRUE@libmfhdf_la_DEPENDENCIES = $(XDRLIB)
+am__libmfhdf_la_SOURCES_DIST = array.c attr.c cdf.c dim.c file.c \
+	hdfsds.c iarray.c error.c globdef.c mfsd.c mfdatainfo.c \
+	nssdc.c putget.c putgetg.c sharray.c string.c var.c xdrposix.c \
+	$(top_srcdir)/mfhdf/fortran/mfsdf.c \
+	$(top_srcdir)/mfhdf/fortran/mfsdff.f \
+	$(top_builddir)/mfhdf/fortran/jackets.c
+am__objects_1 = array.lo attr.lo cdf.lo dim.lo file.lo hdfsds.lo \
+	iarray.lo error.lo globdef.lo mfsd.lo mfdatainfo.lo nssdc.lo \
+	putget.lo putgetg.lo sharray.lo string.lo var.lo xdrposix.lo
+ at HDF_BUILD_NETCDF_FALSE@am__objects_2 = mfsdf.lo mfsdff.lo
+ at HDF_BUILD_NETCDF_TRUE@am__objects_2 = jackets.lo mfsdf.lo mfsdff.lo
+ at HDF_BUILD_FORTRAN_FALSE@am_libmfhdf_la_OBJECTS = $(am__objects_1)
+ at HDF_BUILD_FORTRAN_TRUE@am_libmfhdf_la_OBJECTS = $(am__objects_1) \
+ at HDF_BUILD_FORTRAN_TRUE@	$(am__objects_2)
+libmfhdf_la_OBJECTS = $(am_libmfhdf_la_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
+LTF77COMPILE = $(LIBTOOL) --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
+F77LD = $(F77)
+SOURCES = $(libmfhdf_la_SOURCES)
+DIST_SOURCES = $(am__libmfhdf_la_SOURCES_DIST)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__include_HEADERS_DIST = hdf2netcdf.h local_nc.h mfhdf.h \
+	hdf4_netcdf.h mfhdfi.h mfdatainfo.h netcdf.h
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+           -I$(top_srcdir)/mfhdf/libsrc   
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+
+#############################################################################
+#############################################################################
+lib_LTLIBRARIES = libmfhdf.la
+CSOURCES = array.c attr.c cdf.c dim.c file.c hdfsds.c iarray.c error.c    \
+         globdef.c mfsd.c mfdatainfo.c nssdc.c putget.c putgetg.c	\
+	 sharray.c string.c var.c xdrposix.c
+
+ at HDF_BUILD_NETCDF_FALSE@FSOURCES = $(top_srcdir)/mfhdf/fortran/mfsdf.c $(top_srcdir)/mfhdf/fortran/mfsdff.f
+ at HDF_BUILD_NETCDF_TRUE@FSOURCES = $(top_builddir)/mfhdf/fortran/jackets.c $(top_srcdir)/mfhdf/fortran/mfsdf.c $(top_srcdir)/mfhdf/fortran/mfsdff.f
+ at HDF_BUILD_FORTRAN_FALSE@libmfhdf_la_SOURCES = $(CSOURCES)
+ at HDF_BUILD_FORTRAN_TRUE@libmfhdf_la_SOURCES = $(CSOURCES) $(FSOURCES)
+ at HDF_BUILD_XDR_TRUE@XDRLIB = $(top_builddir)/mfhdf/xdr/libxdr.la
+ at HDF_BUILD_XDR_TRUE@libmfhdf_la_LIBADD = $(XDRLIB)
+ at HDF_BUILD_NETCDF_FALSE@include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h hdf4_netcdf.h mfhdfi.h mfdatainfo.h
+ at HDF_BUILD_NETCDF_TRUE@include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h netcdf.h mfhdfi.h mfdatainfo.h
+ at HDF_BUILD_FORTRAN_FALSE@F77LINK = $(LINK)
+
+#############################################################################
+#############################################################################
+DISTCLEANFILES = *.new *.hdf *.cdf *.cdl netcdf.h hdf4_netcdf.h This*
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .f .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/libsrc/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/libsrc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+netcdf.h: $(top_builddir)/config.status $(srcdir)/netcdf.h.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; \
+	locs=`for p in $$list; do echo $$p; done | \
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+	      sort -u`; \
+	test -z "$$locs" || { \
+	  echo rm -f $${locs}; \
+	  rm -f $${locs}; \
+	}
+libmfhdf.la: $(libmfhdf_la_OBJECTS) $(libmfhdf_la_DEPENDENCIES) $(EXTRA_libmfhdf_la_DEPENDENCIES) 
+	$(F77LINK) -rpath $(libdir) $(libmfhdf_la_OBJECTS) $(libmfhdf_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/array.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/attr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dim.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/globdef.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfsds.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/iarray.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jackets.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mfdatainfo.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mfsd.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mfsdf.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nssdc.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/putget.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/putgetg.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sharray.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/string.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/var.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrposix.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mfsdf.lo: $(top_srcdir)/mfhdf/fortran/mfsdf.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mfsdf.lo -MD -MP -MF $(DEPDIR)/mfsdf.Tpo -c -o mfsdf.lo `test -f '$(top_srcdir)/mfhdf/fortran/mfsdf.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/fortran/mfsdf.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/mfsdf.Tpo $(DEPDIR)/mfsdf.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_srcdir)/mfhdf/fortran/mfsdf.c' object='mfsdf.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mfsdf.lo `test -f '$(top_srcdir)/mfhdf/fortran/mfsdf.c' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/fortran/mfsdf.c
+
+jackets.lo: $(top_builddir)/mfhdf/fortran/jackets.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT jackets.lo -MD -MP -MF $(DEPDIR)/jackets.Tpo -c -o jackets.lo `test -f '$(top_builddir)/mfhdf/fortran/jackets.c' || echo '$(srcdir)/'`$(top_builddir)/mfhdf/fortran/jackets.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/jackets.Tpo $(DEPDIR)/jackets.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$(top_builddir)/mfhdf/fortran/jackets.c' object='jackets.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o jackets.lo `test -f '$(top_builddir)/mfhdf/fortran/jackets.c' || echo '$(srcdir)/'`$(top_builddir)/mfhdf/fortran/jackets.c
+
+.f.o:
+	$(F77COMPILE) -c -o $@ $<
+
+.f.obj:
+	$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.f.lo:
+	$(LTF77COMPILE) -c -o $@ $<
+
+mfsdff.lo: $(top_srcdir)/mfhdf/fortran/mfsdff.f
+	$(LIBTOOL)  --tag=F77 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS) -c -o mfsdff.lo `test -f '$(top_srcdir)/mfhdf/fortran/mfsdff.f' || echo '$(srcdir)/'`$(top_srcdir)/mfhdf/fortran/mfsdff.f
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool cscopelist ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-includeHEADERS install-info \
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-includeHEADERS \
+	uninstall-libLTLIBRARIES
+
+# mfdatainfo.h should be added conditionally only; should local_nc.h even be here? -BMR
+
+# The following is a workaround. Since Fortran is included in this 
+# Makefile.am, automake will always try to use the Fortran linker, even when
+# fortran has been disabled in configure. The Fortran linker gets confused 
+# when shared libraries are enabled, so when Fortran is not enabled,
+# this replaces the Fortran link macro with the C link macro.
+ at HDF_BUILD_FORTRAN_TRUE@    # do nothing
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/libsrc/alloc.h b/mfhdf/libsrc/alloc.h
new file mode 100644
index 0000000..1058765
--- /dev/null
+++ b/mfhdf/libsrc/alloc.h
@@ -0,0 +1,66 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: alloc.h 4933 2007-09-08 03:33:59Z bmribler $ */
+#ifndef _ALLOC_H_
+#define _ALLOC_H_
+
+#ifndef NO_STDLIB
+#include <stdlib.h>
+#else
+extern char *malloc();
+extern char *realloc();
+#ifndef NULL
+#define NULL  0
+#endif /* !NULL */
+#endif /* !NO_STDLIB */
+
+
+#ifdef HDF
+#define Alloc(theNum, theType) \
+	(theType *)HDmalloc(sizeof(theType) * (theNum))
+#else
+#define Alloc(theNum, theType) \
+	(theType *)malloc(sizeof(theType) * (theNum))
+#endif
+
+
+#ifndef NO_STDLIB
+#ifdef HDF
+#define Free(ptr)		HDfree((VOIDP)ptr)
+#else
+#define Free(ptr)		free(ptr)
+#define HDfree(ptr)     free(ptr)
+#endif
+#else
+/* old style free */
+#ifdef HDF
+#define Free(ptr)		(void)HDfree((char *)ptr)
+#else
+#define Free(ptr)		(void)free((char *)ptr)
+#define HDfree(ptr)     (void)free((char *)ptr)
+#endif
+#endif /* !NO_STDLIB */
+
+
+/* We need to define these to standard ones when HDF is not defined */
+#ifndef HDF
+#define HDcalloc(nelem, elsize)   calloc(nelem,elsize)
+#define HDmemset(dst,c,n)         memset(dst,c,n)
+#define HDrealloc(p,s)            realloc(p,s)
+#define HDmalloc(s)               malloc(s)
+#endif /* HDF */
+
+#define ARRAYLEN(arr) (sizeof(arr)/sizeof(arr[0]))
+
+#endif /* !_ALLOC_H_ */
diff --git a/mfhdf/libsrc/array.c b/mfhdf/libsrc/array.c
new file mode 100644
index 0000000..807cc16
--- /dev/null
+++ b/mfhdf/libsrc/array.c
@@ -0,0 +1,668 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research	     *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *									     *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: array.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+#include	<string.h>
+#include	"local_nc.h"
+#include	"alloc.h"
+
+#ifdef NO_MEM_FUNCTS
+/*
+ * internal replacement for memset
+ */
+char *
+NCmemset (s, c, n)
+     char *s;
+     int c, n;
+{
+
+  char *cp ;
+
+  for (cp = s ; cp < &s[n] ; *cp++ = c )
+	/* nada */ ;
+
+  return s ;
+
+}
+#endif
+
+/* 
+ * for a netcdf type
+ *  return the size of the on-disk representation
+ */
+int
+NC_xtypelen(type)
+nc_type	type ;
+{
+	char *nada = NULL ;
+
+	switch(type){
+	case NC_BYTE :
+	case NC_CHAR :
+		return(1) ;
+	case NC_SHORT :
+		return(2) ;
+	case NC_LONG :
+	case NC_FLOAT :
+		return(4) ;
+	case NC_DOUBLE : 
+		return(8) ;
+/* private types */
+	case NC_UNSPECIFIED :
+		return(0) ;
+	case NC_STRING :
+		return(NC_xlen_string((NC_string *)NULL)) ;
+	case NC_DIMENSION :
+		return(NC_xlen_dim((NC_dim **)&nada)) ;
+	case NC_VARIABLE :
+		return(NC_xlen_var((NC_var **)&nada)) ;
+	case NC_ATTRIBUTE :
+		return(NC_xlen_attr((NC_attr **)&nada)) ;
+	default :
+		NCadvise(NC_EBADTYPE, "NC_xtypelen: Unknown type %d", type) ;
+		return(-1) ;
+	}
+}
+
+
+/* 
+ *  private version of nctypelen 
+ */
+size_t
+NC_typelen(type)
+nc_type	type ;
+{
+	switch(type){
+	case NC_BYTE :
+	case NC_CHAR :
+		return(sizeof(char)) ;
+	case NC_SHORT :
+		return(sizeof(short)) ;
+	case NC_LONG :
+		return(sizeof(nclong)) ;
+	case NC_FLOAT :
+		return(sizeof(float)) ;
+	case NC_DOUBLE : 
+		return(sizeof(double)) ;
+/* private types */
+	case NC_STRING :
+		return(sizeof(NC_string *)) ;
+	case NC_DIMENSION :
+		return(sizeof(NC_dim *)) ;
+	case NC_VARIABLE :
+		return(sizeof(NC_var *)) ;
+	case NC_ATTRIBUTE :
+		return(sizeof(NC_attr *)) ;
+	default :
+		return(0) ;
+	}
+}
+
+/* 
+ * external interface function
+ *  this is how much space is required by the user, as in
+ *
+ *   vals = malloc(nel * nctypelen(var.type));
+ *   ncvarget (cdfid, varid, cor, edg, vals);
+ *
+ */
+int
+nctypelen(type)
+nc_type	type ;
+{
+	switch(type){
+	case NC_BYTE :
+	case NC_CHAR :
+		return(sizeof(char)) ;
+	case NC_SHORT :
+		return(sizeof(short)) ;
+	case NC_LONG :
+		return(sizeof(nclong)) ;
+	case NC_FLOAT :
+		return(sizeof(float)) ;
+	case NC_DOUBLE : 
+		return(sizeof(double)) ;
+	default :
+		NCadvise(NC_EBADTYPE, "Unknown type %d", type) ;
+		return(-1) ;
+	}
+}
+
+/* See netcdf.h for explanation of these initialzations */
+/* assert( !(USE_F_UNION && USE_F_LONG_PUN) ) ; */
+/* assert( !(USE_D_UNION && USE_D_LONG_PUN) ) ; */
+
+#ifdef USE_F_UNION
+#ifndef SWAP
+union xdr_f_union xdr_f_infs = {0x7f, 0x80, 0x00, 0x00} ;
+#else
+union xdr_f_union xdr_f_infs = {0x00, 0x00, 0x80, 0x7f} ;
+#endif /* !SWAP */
+#endif /* USE_F_UNION */
+
+#ifdef USE_D_UNION
+#ifndef SWAP
+union xdr_d_union xdr_d_infs = {0x7f, 0xf0, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00} ;
+#else
+union xdr_d_union xdr_d_infs = {0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0xf0, 0x7f} ;
+#endif /* !SWAP */
+#endif /* USE_D_UNION */
+
+#ifdef USE_F_LONG_PUN
+nclong xdr_f_infinity = 0x7f800000;
+#endif
+
+#ifdef USE_D_LONG_PUN
+#ifndef SWAP
+nclong xdr_d_infinity[2] = {0x7ff00000,0x00000000};
+#else
+nclong xdr_d_infinity[2] = {0x00000000,0x7ff00000};
+#endif /* !SWAP */
+#endif /* USE_D_LONG_PUN */
+
+/*
+ *	Fill an array region with an appropriate special value
+ */
+void
+NC_arrayfill(low, len, type)
+void *low ;	/* lower bound of area to be filled */
+size_t len ;	/* how many bytes */
+nc_type type ;
+{
+	char *hi, *lo;	/* local low and hi ptr */
+
+	lo = low;
+        hi = lo + len;
+	switch(type) {
+	case NC_BYTE :
+                HDmemset(lo, FILL_BYTE, len);
+		break ;
+	case NC_CHAR :
+                HDmemset(lo, FILL_CHAR, len);
+		break ;
+	case NC_SHORT :
+		while(lo < hi ){
+			*((short *)lo) = FILL_SHORT ;
+			lo += sizeof(short);
+		}
+		break ;
+	case NC_LONG :
+		while(lo < hi ){
+			*((nclong *)lo) = FILL_LONG ;
+			lo += sizeof(nclong) ;
+		}
+		break ;
+	case NC_FLOAT :
+		while(lo < hi ){
+			*((float *)lo) = FILL_FLOAT ;
+			lo += sizeof(float) ;
+		}
+		break ;
+	case NC_DOUBLE : 
+		while(lo < hi ){
+			/*SUPPRESS 450*/
+			*((double *)lo) = FILL_DOUBLE ;
+			lo += sizeof(double) ;
+		}
+		break ;
+	default :
+		HDmemset(lo,0xff,len) ;
+		break ;
+	}
+}
+
+
+/*
+ * Allocate a new array, returning a handle to it, NULL on error.
+ * If count is no-zero, allocate private space for the values, and,
+ * if values is non-NULL, copy them in.
+ * Else, just hook up the values passed in.
+ */
+NC_array *
+NC_new_array(type, count, values)
+nc_type type ;
+unsigned count ;
+const void *values ;
+{
+	NC_array *ret ;
+	size_t memlen ;
+
+	ret = (NC_array *)HDmalloc(sizeof(NC_array)) ;
+	if( ret == NULL )
+		goto alloc_err ;
+
+	ret->type = type ;
+	ret->szof = NC_typelen(type) ;
+#ifdef DEBUG
+  fprintf(stderr, "NC_new_array(): type=%u, NC_typelen(type)=%u\n",(unsigned)type,(unsigned)ret->szof);
+#endif
+    ret->count = count ;
+	memlen = count * ret->szof ;
+	ret->len = count * NC_xtypelen(type) ;
+#ifdef DEBUG
+  fprintf(stderr, "NC_new_array(): count=%u, memlen=%u\n",count,memlen);
+#endif
+    if( count != 0 )
+	{
+		ret->values = (Void*)HDmalloc(memlen) ;
+#ifdef DEBUG
+  fprintf(stderr, "NC_new_array(): ret->values=%p, values=%p\n",ret->values,values);
+#endif
+        if(ret->values == NULL)
+			goto alloc_err ;
+		if( values == NULL )
+		{
+			NC_arrayfill(ret->values, memlen, type) ;
+		} else {
+			/* can be dangerous */
+			(void)memcpy(ret->values, values, memlen) ;
+		}
+	} else {
+		ret->values = NULL ;
+	}
+		
+#ifdef DEBUG
+  fprintf(stderr, "NC_new_array(): ret=%p\n",ret);
+#endif
+    return(ret) ;
+alloc_err :
+	nc_serror("NC_new_array") ;
+	return(NULL) ;
+}
+
+
+/*
+ * Recyle a NC_array, if possible.
+ * EG, if there is enough space, use it, else return NULL
+ * If values is non-NULL, copy them in.
+ */
+NC_array *
+NC_re_array(old, type, count, values)
+NC_array *old ;
+nc_type type ;
+unsigned count ;
+const void *values ;
+{
+	size_t memlen ;
+	size_t szof ;
+
+	szof = NC_typelen(type) ;
+	memlen = count * szof ;
+	if(memlen > old->count * old->szof )
+		return(NULL) ; /* punt */
+	old->count = count ;
+	old->type = type ;
+	old->szof = szof ;
+	if(count != 0)
+	{
+		if( values == NULL )
+		{
+			NC_arrayfill(old->values, memlen, type) ;
+		} else {
+			/* can be dangerous */
+			(void)memcpy(old->values, values, memlen) ;
+		}
+	}
+	
+	return(old) ;
+}
+
+
+/*
+ * Free array, and, if needed, its values.
+ * 
+ * NOTE: Changed return value to return 'int' 
+ *       If successful returns SUCCEED else FAIL -GV 9/19/97
+ */
+int
+NC_free_array(array)
+NC_array *array ;
+{
+    int ret_value = SUCCEED;
+
+	if( array != NULL)
+      {
+          if(array->values != NULL)
+            {
+                switch(array->type)
+                  {
+                  case NC_UNSPECIFIED :
+                  case NC_BYTE :
+                  case NC_CHAR :
+                  case NC_SHORT :
+                  case NC_LONG :
+                  case NC_FLOAT :
+                  case NC_DOUBLE :
+                      break ;
+                  case NC_STRING  :
+                  {
+                      NC_string **sp ;
+                      sp = (NC_string **)array->values ;
+                      for(sp += array->count - 1 ;
+                          array->count > 0;
+                          array->count--)
+                        {
+                            if (FAIL == NC_free_string(*sp-- ))
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                        }
+                  }
+                  break ;
+                  case NC_DIMENSION :
+                  {
+                      NC_dim **dp ;
+                      dp = (NC_dim**)array->values ;
+                      for(dp += array->count - 1 ;
+                          array->count > 0;
+                          array->count--)
+                        {
+                            if (FAIL == NC_free_dim(*dp-- ))
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                        }
+                  }
+                  break ;
+                  case NC_VARIABLE :
+                  {
+                      NC_var **dp ;
+                      dp = (NC_var**)array->values ;
+                      for(dp += array->count - 1 ;
+                          array->count > 0;
+                          array->count--)
+                        {
+                            if (FAIL == NC_free_var(*dp-- ))
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                        }
+                  }
+                  break ;
+                  case NC_ATTRIBUTE :
+                  {
+                      NC_attr **dp ;
+                      dp = (NC_attr**)array->values ;
+                      for(dp += array->count - 1 ;
+                          array->count > 0;
+                          array->count--)
+                        {
+                            if (FAIL == NC_free_attr(*dp-- ))
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                        }
+                  }
+                  break ;
+                  default:
+                      NCadvise(NC_EBADTYPE, "Unknown type %d",array->type) ;
+                      break ;
+                  }
+
+                Free(array->values) ;
+            }
+
+          Free(array) ;
+      }
+
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+
+
+/*
+ * How much space will the xdr'd array take.
+ */
+int NC_xlen_array(array)
+NC_array *array ;
+{
+	int len = 8 ;
+	int rem ;
+	int (*xlen_funct)() =NULL;
+	Void *vp ;
+	unsigned ii ;
+
+	if(array!=NULL)
+	{
+		switch(array->type){
+		case NC_BYTE :
+		case NC_CHAR :
+			len += array->count ;
+			if( (rem = len%4) != 0)
+				len += 4 - rem ;
+			return(len) ;
+		case NC_SHORT :
+			len += array->count * 2 ;
+			if( (rem = len%4) != 0)
+				len += 4 - rem ;
+			return(len) ;
+		case NC_LONG :
+		case NC_FLOAT :
+			len += array->count * 4 ;
+			return(len) ;
+		case NC_DOUBLE :
+			len += array->count * 8 ;
+			return(len) ;
+	 	case NC_STRING  :
+			xlen_funct = NC_xlen_string ;
+			break ;
+	 	case NC_DIMENSION :
+			xlen_funct = NC_xlen_dim ;
+			break ;
+	 	case NC_VARIABLE :
+			xlen_funct = NC_xlen_var ;
+			break ;
+	 	case NC_ATTRIBUTE :
+			xlen_funct = NC_xlen_attr ;
+			break ;
+        default:
+            break;
+		}
+		vp = array->values ;
+		for(ii=0 ; ii < array->count ; ii++) 
+		{
+			len += (*xlen_funct)(vp) ;	
+			vp += array->szof ;
+		}
+	}
+	return(len) ;
+}
+
+
+/*
+ * Add a new handle on the end of and array of handles
+ */
+Void *
+NC_incr_array(array, tail)
+NC_array *array ;
+Void *tail ;
+{
+	char *ap ;
+
+	if(array == NULL)
+	{
+		NCadvise(NC_EINVAL, "increment: NULL array") ;
+		return(NULL) ;
+	}
+
+	array->values = (Void*)HDrealloc(array->values,
+		(array->count +1) * array->szof) ;
+	if(array->values == NULL)
+	{
+		nc_serror("extend_array") ;
+		return(NULL) ;
+	}
+	ap = array->values + array->szof * array->count ;
+	(void)memcpy(ap, tail, array->szof) ;
+	array->count ++ ;
+	return(array->values) ;
+}
+
+
+/*
+ * Definitely NOT Bomb proof.
+ */
+void
+NC_copy_arrayvals( target, array )
+char *target ;
+NC_array *array ;
+{
+	size_t memlen ;
+
+	memlen = array->szof * array->count ;
+	(void)memcpy(target, array->values, memlen) ;
+}
+
+
+bool_t
+xdr_NC_array(xdrs, app)
+	XDR *xdrs;
+	NC_array **app;
+{
+	bool_t (*xdr_NC_fnct)() ;
+	u_long count , *countp=NULL ;
+	nc_type type , *typep=NULL ;
+	bool_t stat ;
+	Void *vp ;
+
+	switch (xdrs->x_op) {
+	case XDR_FREE:
+		NC_free_array((*app)) ;
+		return(TRUE) ;
+	case XDR_ENCODE:
+		if(*app == NULL)
+		{
+			(*app) = NC_new_array(NC_UNSPECIFIED, (unsigned)0, 
+				(Void*)NULL) ;
+			if(*app == NULL)
+			{
+				NCadvise(NC_EXDR, "xdr_NC_array:NC_new_array") ;
+				return(FALSE) ;
+			}
+		}
+		count = (*app)->count ;
+		type = (*app)->type ;
+		/* fall into */
+	case XDR_DECODE:
+		countp = &count ;
+		typep = &type ;
+		break ;
+	}
+#ifdef USE_ENUM
+	if (! xdr_enum(xdrs, (enum_t *)typep)) {				
+		NCadvise(NC_EXDR, "xdr_NC_array:xdr_enum") ;
+		return (FALSE);
+	}
+#else
+	if (! xdr_int(xdrs, typep)) {				
+		NCadvise(NC_EXDR, "xdr_NC_array:xdr_int (enum)") ;
+		return (FALSE);
+	}
+#endif
+	if (! xdr_u_long(xdrs, countp)) {
+		NCadvise(NC_EXDR, "xdr_NC_array:xdr_u_long") ;
+		return (FALSE);
+	}
+
+	if( xdrs->x_op == XDR_DECODE )
+	{
+		if( *typep == NC_UNSPECIFIED && *countp == 0 )
+		{
+			*app = NULL ;
+			return(TRUE) ;
+		} /* else */
+		(*app) = NC_new_array(*typep, (unsigned)*countp, (Void*)NULL) ;
+		if((*app) == NULL)	
+		{
+			NCadvise(NC_EXDR, "xdr_NC_array:NC_new_array  (second call)") ;
+			return(FALSE) ;
+		}
+	}
+
+	vp = (*app)->values ;
+
+	switch(*typep){
+	case NC_UNSPECIFIED :
+	case NC_BYTE :
+	case NC_CHAR :
+		xdr_NC_fnct = xdr_opaque ;
+		goto func ;
+	case NC_SHORT :
+		xdr_NC_fnct = xdr_shorts ;
+		goto func ;
+	case NC_LONG :
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ 
+		xdr_NC_fnct = xdr_int ;
+#else
+		xdr_NC_fnct = xdr_long ;
+#endif
+		goto loop ;
+	case NC_FLOAT :
+		xdr_NC_fnct = xdr_float ;
+		goto loop ;
+	case NC_DOUBLE : 
+		xdr_NC_fnct = xdr_double ;
+		goto loop ;
+/* private types */
+	case NC_STRING :
+		xdr_NC_fnct = xdr_NC_string ;
+		goto loop ;
+	case NC_DIMENSION :
+		xdr_NC_fnct = xdr_NC_dim ;
+		goto loop ;
+	case NC_VARIABLE :
+		xdr_NC_fnct = xdr_NC_var ;
+		goto loop ;
+	case NC_ATTRIBUTE :
+		xdr_NC_fnct = xdr_NC_attr ;
+		goto loop ;
+	default :
+		{
+		NCadvise(NC_EBADTYPE, "xdr_NC_array: unknown type 0x%x", (unsigned)*typep) ;
+		return(FALSE) ;
+		}
+	}
+loop:
+	for(stat = TRUE ; stat && (count > 0) ; count--)
+	{
+		stat = (*xdr_NC_fnct)(xdrs,vp) ;	
+		vp += (*app)->szof ;
+	}
+	if ( !stat ) NCadvise(NC_EXDR, "xdr_NC_array: loop") ;
+
+	return(stat) ;
+func:
+
+	stat = (*xdr_NC_fnct)(xdrs, vp, *countp);
+	if ( !stat ) NCadvise(NC_EXDR, "xdr_NC_array: func") ;
+	return( stat );
+}
diff --git a/mfhdf/libsrc/attr.c b/mfhdf/libsrc/attr.c
new file mode 100644
index 0000000..6139fcd
--- /dev/null
+++ b/mfhdf/libsrc/attr.c
@@ -0,0 +1,584 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: attr.c 4963 2007-09-15 17:20:52Z bmribler $ */
+
+#include	<string.h> 
+#include	"local_nc.h"
+#include	"alloc.h"
+
+
+NC_attr *
+NC_new_attr(name,type,count,values)
+const char *name ;
+nc_type type ;
+unsigned count ;
+const void *values ;
+{
+	NC_attr *ret ;
+
+	ret = (NC_attr *)HDmalloc(sizeof(NC_attr)) ;
+	if( ret == NULL )
+		goto alloc_err ;
+
+	ret->name = NC_new_string((unsigned)strlen(name),name) ;
+	if( ret->name == NULL)
+		goto alloc_err ;
+
+	ret->data = NC_new_array(type, count, values) ;
+	if( ret->data == NULL)
+		goto alloc_err ;
+#ifdef HDF
+    ret->HDFtype = hdf_map_type(type);
+#endif
+	return(ret) ;
+alloc_err :
+	nc_serror("NC_new_attr") ;
+	return(NULL) ;
+}
+
+
+/*
+ * Free attr
+ *
+ * NOTE: Changed return value to return 'int' 
+ *       If successful returns SUCCEED else FAIL -GV 9/19/97
+ */
+int
+NC_free_attr(attr)
+NC_attr *attr ;
+{
+    int ret_value = SUCCEED;
+
+	if(attr != NULL)
+      {
+          if (NC_free_string(attr->name) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+              
+          if (NC_free_array(attr->data) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+
+          Free(attr) ;
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+
+
+/*
+ *  Verify that this is a user nc_type
+ */
+bool_t
+NCcktype(datatype)
+nc_type datatype ;
+{
+	switch(datatype){
+	case NC_BYTE :
+	case NC_CHAR :
+	case NC_SHORT :
+	case NC_LONG :
+	case NC_FLOAT :
+	case NC_DOUBLE :
+		return(TRUE) ;
+    default:
+        break;
+	}
+	NCadvise(NC_EBADTYPE, "Unknown type %d", datatype) ;
+	return(FALSE) ;
+}
+
+
+/*
+ * Given cdfid and varid, return handle to array of attributes
+ *  else NULL on error
+ */
+static NC_array **
+NC_attrarray( cdfid, varid )
+int cdfid ;
+int varid ;
+{
+	NC *handle ;
+	NC_array **ap ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(NULL) ;
+
+	if(varid == NC_GLOBAL) /* Global attribute, attach to cdf */
+	{
+		ap = &(handle->attrs) ;
+	}else if(handle->vars != NULL && varid >= 0 && (unsigned)varid < handle->vars->count)
+	{
+		ap = (NC_array **)handle->vars->values ;
+		ap += varid ;
+		ap = &(((NC_var *)(*ap))->attrs) ; /* Whew! */
+	} else {
+		NCadvise(NC_EINVAL, "%d is not a valid variable id", varid) ;
+		ap = NULL ;
+	}
+	return(ap) ;
+}
+
+
+/*
+ * Step thru NC_ATTRIBUTE array, seeking match on name.
+ *  return match or NULL if Not Found.
+ */
+NC_attr **
+NC_findattr(ap, name)
+NC_array **ap ;
+const char *name ;
+{
+    NC_attr **attr ;
+    unsigned attrid ;
+    size_t len ;
+    
+    if(*ap == NULL)
+        return(NULL) ;
+    
+    attr = (NC_attr **) (*ap)->values ;
+    
+    len = strlen(name) ;
+    
+    for(attrid = 0 ; attrid < (*ap)->count ; attrid++, attr++)
+	{
+            if( len == (*attr)->name->len && 
+               strncmp(name, (*attr)->name->values, len) == 0)
+                {
+                    return(attr) ; /* Normal return */
+                }
+        }
+    return(NULL) ;
+}
+
+
+/*
+ * Look up by cdfid, varid and name, return NULL if not found
+ */
+static NC_attr **
+NC_lookupattr( cdfid, varid, name, verbose)  
+int cdfid ;
+int varid ;
+const char *name ; /* attribute name */
+bool_t verbose ;
+{
+	NC_array **ap ;
+	NC_attr **attr ;
+
+	ap = NC_attrarray(cdfid, varid) ;
+	if(ap == NULL)
+		return(NULL) ;
+
+	attr = NC_findattr(ap, name ) ;
+	if(verbose && attr == NULL)
+		NCadvise(NC_ENOTATT, "attribute \"%s\" not found",name) ;
+	return( attr ) ;
+}
+
+
+/*
+ * Common code for attput and attcopy
+ */
+static int
+NC_aput(cdfid, ap, name, datatype, count, values)
+int cdfid ;
+NC_array **ap ;
+const char *name ;
+nc_type datatype ;
+unsigned count ;
+const void *values ;
+{
+	NC *handle ;
+	NC_attr *attr[1] ;
+	NC_attr **atp, *old ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(!(handle->flags & NC_RDWR))
+		return(-1) ;
+
+	if(*ap == NULL ) /* first time */
+	{
+		if( !NC_indefine(cdfid,TRUE) )
+			return(-1) ;
+
+		attr[0] = NC_new_attr(name,datatype,count,values) ;
+		if(attr[0] == NULL)
+			return(-1) ;
+		*ap = NC_new_array(NC_ATTRIBUTE,(unsigned)1, (Void*)attr) ;
+		if(*ap == NULL)
+			return(-1) ;
+		return((*ap)->count -1) ;
+	}
+	/* else */
+	if( (atp = NC_findattr(ap, name)) != NULL) /* name in use */
+	{
+		if( NC_indefine(cdfid,FALSE) )
+		{
+			old = *atp ;
+			*atp = NC_new_attr(name,datatype,count,values) ;
+			if(*atp == NULL)
+			{
+				*atp = old ;
+				return(-1) ;
+			}
+			NC_free_attr(old) ;
+			return((*ap)->count -1) ;
+		} 
+		/* else */
+		if( NC_re_array((*atp)->data, datatype,count,values) == NULL) 
+		{
+		NCadvise(NC_ENOTINDEFINE, "Can't increase size unless in define mode") ;
+			return(-1) ;
+		}
+		/* else */
+#ifdef HDF
+                (*atp)->HDFtype = hdf_map_type(datatype);
+#endif
+		if(handle->flags & NC_HSYNC)
+		{
+			handle->xdrs->x_op = XDR_ENCODE ;
+			if(!xdr_cdf(handle->xdrs, &handle) )
+				return(-1) ;
+			handle->flags &= ~(NC_NDIRTY | NC_HDIRTY) ;
+		} else
+			handle->flags |= NC_HDIRTY ;
+		return((*ap)->count -1) ;
+	} 
+	/* else */
+	if((*ap)->count >= H4_MAX_NC_ATTRS)
+	{
+		NCadvise(NC_EMAXATTS, "maximum number of attributes %d exceeded",
+			(*ap)->count ) ;
+		return(-1) ;
+	}
+	/* else */
+	if( NC_indefine(cdfid,TRUE) )
+	{
+		attr[0] = NC_new_attr(name,datatype,count,values) ;
+		if(attr[0] == NULL)
+			return(-1) ;
+		if( NC_incr_array((*ap), (Void *)attr) == NULL)
+			return(-1) ;
+		return((*ap)->count -1) ;
+	}
+	/* else */
+	return(-1) ;
+}
+
+
+int ncattput(cdfid, varid, name, datatype, count, values)
+int cdfid ;
+int varid ;
+const char *name ;
+nc_type datatype ;
+int count ;
+const ncvoid *values ;
+{
+	NC_array **ap ;
+
+	cdf_routine_name = "ncattput" ;
+
+	ap = NC_attrarray(cdfid, varid) ;
+	if(ap == NULL)
+		return(-1) ;
+
+	if(count < 0 )
+	{
+		NCadvise(NC_EINVAL, "Invalid length %d", count) ;
+		return(-1) ;
+	}
+
+	if(!NCcktype(datatype))
+		return(-1) ;
+
+	return( NC_aput(cdfid, ap, name, datatype, (unsigned)count,
+		values) ) ;
+}
+
+
+int ncattname( cdfid, varid, attnum, name)
+int cdfid ;
+int varid ;
+int attnum ;
+char *name ;
+{
+	NC_array **ap ;
+	NC_attr **attr ;
+
+	cdf_routine_name = "ncattname" ;
+
+	ap = NC_attrarray(cdfid, varid) ;
+	if(ap == NULL || *ap == NULL)
+		return(-1) ;
+
+	if( attnum < 0 || attnum >= (*ap)->count)
+	{
+		NCadvise(NC_ENOTATT, "%d is not a valid attribute id", attnum) ;
+		return(-1) ;
+	}
+
+	attr = (NC_attr **) (*ap)->values ;
+	attr += attnum ;
+#ifdef HDF
+	(void)memcpy( name, (*attr)->name->values, (*attr)->name->len) ;
+#else
+	(void)strncpy( name, (*attr)->name->values, (*attr)->name->len) ;
+#endif
+	name[(*attr)->name->len] = 0 ;
+
+	return(attnum) ;
+}
+
+
+int ncattinq( cdfid, varid, name, datatypep, countp)  
+int cdfid ;
+int varid ;
+const char *name ; /* input, attribute name */
+nc_type *datatypep ;
+int *countp ;
+{
+	NC_attr **attr ;
+
+	cdf_routine_name = "ncattinq" ;
+
+	attr = NC_lookupattr(cdfid,varid,name,TRUE) ;
+	if(attr == NULL)
+		return(-1) ;
+
+	if(datatypep != 0)
+		*datatypep = (*attr)->data->type ;
+	if(countp != 0)
+		*countp = (*attr)->data->count ;
+	return(1) ;
+}
+
+
+int ncattrename(cdfid, varid, name, newname)
+int cdfid ;
+int varid ; 
+const char *name ;
+const char *newname ;
+{
+	
+	NC *handle ;
+	NC_attr **attr ;
+	NC_string *new, *old ;
+
+	cdf_routine_name = "cdfattrrename" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(!(handle->flags & NC_RDWR))
+		return(-1) ;
+
+	attr = NC_lookupattr(cdfid,varid,name,TRUE) ;
+	if(attr == NULL)
+		return(-1) ;
+
+	if( NC_lookupattr(cdfid,varid,newname,FALSE) != NULL) /* name in use */
+		return(-1) ;
+
+	old = (*attr)->name ;
+	if( NC_indefine(cdfid,FALSE) )
+	{
+		new = NC_new_string((unsigned)strlen(newname),newname) ;
+		if( new == NULL)
+			return(-1) ;
+		(*attr)->name = new ;
+		NC_free_string(old) ;
+		return(1) ;
+	} /* else */
+	new = NC_re_string(old, (unsigned)strlen(newname),newname) ;
+	if( new == NULL)
+		return(-1) ;
+	(*attr)->name = new ;
+	if(handle->flags & NC_HSYNC)
+	{
+		handle->xdrs->x_op = XDR_ENCODE ;
+		if(!xdr_cdf(handle->xdrs, &handle) )
+			return(-1) ;
+		handle->flags &= ~(NC_NDIRTY | NC_HDIRTY) ;
+	} else
+		handle->flags |= NC_HDIRTY ;
+	return(1) ;
+}
+
+
+int ncattcopy( incdf, invar, name, outcdf, outname)
+int incdf ;
+int invar ;
+const char *name ;
+int outcdf ;
+int outname ;
+{
+	NC_attr **attr ;
+	NC_array **ap ;
+
+	cdf_routine_name = "ncattcopy" ;
+
+	attr = NC_lookupattr(incdf,invar,name,TRUE) ;
+	if(attr == NULL)
+		return(-1) ;
+	
+	ap = NC_attrarray(outcdf, outname) ;
+	if(ap == NULL)
+		return(-1) ;
+
+	return( NC_aput(outcdf, ap, name,
+		(*attr)->data->type, (*attr)->data->count,
+		(*attr)->data->values) ) ;
+}
+
+
+int ncattdel(cdfid, varid, name)
+int cdfid ;
+int varid ; 
+const char *name ;
+{
+	
+	NC_array **ap ;
+	NC_attr **attr ;
+	NC_attr *old = NULL ;
+	unsigned attrid ;
+	size_t len ;
+
+	cdf_routine_name = "ncattdel" ;
+
+	if( !NC_indefine(cdfid,TRUE) )
+		return(-1) ;
+
+	ap = NC_attrarray(cdfid, varid) ;
+	if(ap == NULL || *ap == NULL)
+		return(-1) ;
+
+	attr = (NC_attr **) (*ap)->values ;
+
+	len = strlen(name);
+	for(attrid = 0 ; attrid < (*ap)->count ; attrid++, attr++)
+	{
+		if( len == (*attr)->name->len &&
+			strncmp(name, (*attr)->name->values, len) == 0)
+		{
+			old = *attr ;
+			break ;
+		}
+	}
+	if( attrid == (*ap)->count )
+	{
+		NCadvise(NC_ENOTATT, "attribute \"%s\" not found",name) ;
+		return(-1) ;
+	}
+	/* shuffle down */
+	for(attrid++ ; attrid < (*ap)->count ; attrid++)
+	{
+		*attr = *(attr + 1) ;
+		attr++ ;
+	}
+	/* decrement count */
+	(*ap)->count-- ;
+
+	NC_free_attr(old) ;
+
+	return(1) ;
+}
+
+
+int ncattget(cdfid, varid, name, values)
+int cdfid ;
+int varid ; 
+const char *name ;
+ncvoid *values ;
+{
+	
+	NC_attr **attr ;
+
+	cdf_routine_name = "ncattget" ;
+
+	attr = NC_lookupattr(cdfid,varid,name,TRUE) ;
+	if(attr == NULL)
+		return(-1) ;
+
+	NC_copy_arrayvals((char *)values, (*attr)->data) ;
+
+	return(1) ;
+}
+
+
+bool_t
+xdr_NC_attr(xdrs, app)
+	XDR *xdrs;
+	NC_attr **app;
+{
+    bool_t ret_value;
+
+	if( xdrs->x_op == XDR_FREE)
+	{
+		NC_free_attr((*app)) ;
+		return(TRUE) ;
+	}
+
+	if( xdrs->x_op == XDR_DECODE )
+	{
+		*app = (NC_attr *)HDmalloc(sizeof(NC_attr)) ;
+		if( *app == NULL )
+		{
+			nc_serror("xdr_NC_attr") ;
+			return(FALSE) ;
+		}
+	}
+
+	if( !xdr_NC_string(xdrs, &((*app)->name)))
+		return(FALSE) ;
+	ret_value = xdr_NC_array(xdrs, &((*app)->data)) ;
+#ifdef HDF
+        (*app)->HDFtype = hdf_map_type(((*app)->data)->type);
+#endif
+	return ret_value;
+}
+
+
+/*
+ * How much space will the xdr'd attr take.
+ */
+int NC_xlen_attr(app)
+NC_attr **app ;
+{
+	int len ;
+
+	if(*app == NULL)
+		return(4) ;
+
+	len = NC_xlen_string((*app)->name) ;
+	len += NC_xlen_array((*app)->data) ;
+
+	return(len) ;
+}
diff --git a/mfhdf/libsrc/cdf.c b/mfhdf/libsrc/cdf.c
new file mode 100644
index 0000000..97e69e0
--- /dev/null
+++ b/mfhdf/libsrc/cdf.c
@@ -0,0 +1,3698 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: cdf.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+#include	"local_nc.h"
+#include	"alloc.h"
+
+#ifdef HDF
+#include    "hfile.h"
+extern intn  hdf_xdr_cdf
+   PROTO((XDR *xdrs, NC**handlep));
+
+/* A couple of local prototypes to HDF section*/
+intn hdf_cdf_clobber(NC *handle);
+
+intn hdf_close(NC *handle);
+
+static intn
+hdf_num_attrs(NC *handle,/* IN: handle to SDS */
+              int32 vg   /* IN: ref of top Vgroup */);
+
+#endif /* HDF */
+
+static bool_t NC_xdr_cdf(XDR *xdrs, NC **handlep);
+
+static int NC_free_xcdf(NC *);
+
+/* hmm we write the NDG out always for now */
+#define WRITE_NDG 1
+
+/* Debugging: define for each function you want debugging printfs */
+/* #define HDF_READ_VARS
+#define HDF_READ_ATTRS
+#define HDF_NUM_ATTRS 
+#define HDF_XDR_CDF 
+#define HDF_VG_CLOBBER 
+#define HDF_CDF_CLOBBER 
+#define HDF_CLOSE */
+
+/*
+ * Free the resources that xdr_cdf allocates
+ *
+ * NOTE: Modified to return SUCCEED / FAIL and to catch errors
+ *       -GV 9/16/97
+ */
+static int
+NC_free_xcdf(handle)
+NC *handle ;
+{
+    int ret_value = SUCCEED;
+
+    if(handle != NULL)
+      {
+          if (NC_free_array(handle->dims) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          if (NC_free_array(handle->attrs) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          if (NC_free_array(handle->vars) ==FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+}
+
+/*
+ * NOTE: Modified to return SUCCEED / FAIL and to catch errors
+ *       -GV 9/16/97
+ */
+int
+NC_free_cdf(handle)
+NC *handle ;
+{
+    int ret_value = SUCCEED;
+
+      if(handle != NULL)
+        {
+            if (NC_free_xcdf(handle) == FAIL) 
+              {
+                  ret_value = FAIL;
+                  goto done;
+              }
+            
+            /* destroy xdr struct */
+            xdr_destroy(handle->xdrs);
+            Free(handle->xdrs);
+
+#ifdef HDF
+            if(handle->file_type == HDF_FILE) 
+              {
+                if (Vend(handle->hdf_file) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                if (Hclose(handle->hdf_file) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+              }
+#endif /* HDF */
+
+            Free(handle);
+        }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+
+
+#ifdef HDF 
+/******************************************************************************/
+
+/*
+  From NASA CDF Source
+*/
+#define V2_MAGIC_NUMBER  0x0000FFFF   /* Written twice at the beginning of file */
+#define V2_MAGIC_OFFSET  0
+
+/* -------------------------------- HDiscdf -------------------------------- */
+/*
+  Return TRUE/FALSE depending on if the given file is a NASA CDF file
+*/
+intn
+HDiscdf(filename)
+const char * filename;
+{
+    
+    static const char *FUNC = "HDiscdf";
+    hdf_file_t fp;
+    uint8      b[4];
+    uint8    * bb = NULL;
+    int32      magic_num;
+    intn       ret_value = TRUE;
+  
+    fp = (hdf_file_t)HI_OPEN(filename, DFACC_READ);
+    if (OPENERR(fp)) 
+      {
+          ret_value = FALSE;
+          goto done;
+      } 
+    else 
+      {
+        if(HI_SEEK(fp, V2_MAGIC_OFFSET) == FAIL) 
+          {
+            HERROR(DFE_SEEKERROR);
+            ret_value = FALSE;
+            goto done;
+          }
+        
+        if(HI_READ(fp, b, 4) == FAIL) 
+          {
+            HERROR(DFE_READERROR);
+            ret_value = FALSE;
+            goto done;
+          }
+
+        bb = &b[0];
+
+        INT32DECODE(bb, magic_num); 
+
+        if(magic_num == V2_MAGIC_NUMBER) 
+            ret_value = TRUE;
+        else 
+            ret_value = FALSE;
+
+        HI_CLOSE(fp);
+      }
+
+done:
+    if (ret_value == FALSE)
+      { /* FALSE cleanup ?*/
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+
+
+/*
+  Model after HDiscdf
+*/
+/* -------------------------------- HDisnetcdf -------------------------------- */
+/*
+  Return TRUE if the given file is a netCDF file, FALSE otherwise.
+*/
+intn
+HDisnetcdf(filename)
+const char * filename;
+{
+    
+    static const char *FUNC = "HDisnetcdf";
+    hdf_file_t fp;
+    uint8      b[4];
+    uint8    * bb = NULL;
+    int32      magic_num;
+    intn       ret_value = TRUE;
+  
+    fp = (hdf_file_t)HI_OPEN(filename, DFACC_READ);
+    if (OPENERR(fp)) 
+      {
+        ret_value = FALSE;
+        goto done;
+      } 
+    else 
+      {
+        if(HI_READ(fp, b, 4) == FAIL) 
+          {
+              HERROR(DFE_READERROR);
+              HI_CLOSE(fp);
+              ret_value = FALSE;
+              goto done;
+          }
+
+        bb = &b[0];
+
+        INT32DECODE(bb, magic_num); 
+
+        if(magic_num == NCMAGIC) 
+            ret_value = TRUE;
+        else 
+            ret_value = FALSE;
+
+        HI_CLOSE(fp);
+    }
+
+done:
+    if (ret_value == FALSE)
+      { /* FALSE cleanup? */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+/******************************************************************************/
+#endif /* HDF */
+
+
+/*
+ * NOTE: Cleaned up to catch errors - GV 9/19/97
+ */
+NC *
+NC_new_cdf(name, mode)
+const char *name ;
+int mode ;
+{
+#ifdef HDF
+    int32 hdf_mode =  DFACC_RDWR; /* default */
+#endif
+	NC   *cdf = NULL;
+    static const char *FUNC = "NC_new_cdf";
+    NC   *ret_value = NULL;
+
+    /* allocate an NC struct */
+	cdf = (NC *)HDcalloc(1,sizeof(NC)) ;
+	if( cdf == NULL )
+      {
+          nc_serror("NC_new_cdf") ;
+          ret_value = NULL;
+          goto done;
+      }
+
+	cdf->flags = mode ;
+
+	cdf->xdrs = (XDR *)HDmalloc(sizeof(XDR)) ;
+	if( cdf->xdrs == NULL)
+      {
+          nc_serror("NC_new_cdf: xdrs") ;
+          ret_value = NULL;
+          goto done;
+      } /* else */
+	
+#ifdef HDF
+    /*
+     * See what type of file we are looking at.
+     * If we are creating a new file it will be an HDF file
+     */
+    if(mode & NC_CREAT) 
+      {
+          cdf->file_type = HDF_FILE;
+      } 
+    else 
+      {
+          if(Hishdf(name))
+              cdf->file_type = HDF_FILE;
+          else if(HDiscdf(name))
+              cdf->file_type = CDF_FILE;
+          else if(HDisnetcdf(name))
+              cdf->file_type = netCDF_FILE;
+          else
+            {
+                ret_value = NULL;
+                goto done;
+            }
+            
+#ifdef DEBUG
+          if(cdf->file_type == CDF_FILE)
+              printf("Yow!  found a CDF file\n");
+#endif
+      }
+
+    /*
+     * Set up the XDR functions that some of the netCDF old code uses
+     */
+    switch(cdf->file_type) 
+      {
+      case HDF_FILE:
+          hdf_xdrfile_create(cdf->xdrs, mode); /* return type is 'void' */
+          break;
+      case netCDF_FILE:
+          if( NCxdrfile_create( cdf->xdrs, name, mode ) < 0) 
+            {
+                ret_value = NULL;
+                goto done;
+            } 
+          break;
+      case CDF_FILE:
+          /* CDF_xdrfile_create(); */
+          /* try this, I bet it will be sufficient */
+          hdf_xdrfile_create(cdf->xdrs, mode);
+          break;
+      }
+        
+#else /* !HDF */
+    if( NCxdrfile_create( cdf->xdrs, name, mode ) < 0) 
+      {
+          ret_value = NULL;
+          goto done;
+      } 
+#endif /* !HDF */
+
+	cdf->dims = NULL ;
+	cdf->attrs = NULL ;
+	cdf->vars = NULL ;
+	cdf->begin_rec = 0 ;
+	cdf->recsize = 0 ;
+	cdf->numrecs = 0 ;
+	cdf->redefid = -1 ;
+
+#ifdef HDF 
+    /* 
+     * determine the HDF access mode 
+     */
+    switch(mode) 
+      {
+      case NC_CLOBBER   :
+          hdf_mode = DFACC_CLOBBER; break;
+      case NC_NOCLOBBER :
+          /* will handle below */
+          break;
+      case NC_WRITE     :
+          hdf_mode = DFACC_RDWR;    break;
+      case NC_NOWRITE   :
+          hdf_mode = DFACC_RDONLY;  break;
+      default:
+          hdf_mode = DFACC_RDWR;
+      }
+        
+    /*
+     * Do file type specific setup
+     */
+    switch(cdf->file_type) 
+      {
+      case HDF_FILE:  /* HDF stuff */
+
+          /* see if the file exists */
+          if(mode == NC_NOCLOBBER) 
+            {
+                if((int) Hishdf(name))
+                  { /* Need to free allocated structures.
+                       This will happen on failure cleanup. */
+                      xdr_destroy(cdf->xdrs) ; /* destroy xdr struct first */
+                      ret_value = NULL;
+                      goto done;
+                  }
+                hdf_mode = DFACC_RDWR;
+            }
+
+          /* open the file */
+          cdf->hdf_file = (int32) Hopen(name, hdf_mode, 200);
+          if(cdf->hdf_file == FAIL) 
+            {
+                ret_value = NULL;
+                goto done;
+            }
+
+          /* start Vxx access */
+          if (Vstart(cdf->hdf_file) == FAIL)
+            {
+                ret_value = NULL;
+                goto done;
+            }
+
+          cdf->hdf_mode = hdf_mode;
+          cdf->vgid = 0; /* invalid ref */
+
+	  /* copy filename only up to its length instead of FILENAME_MAX as
+	     used to be */
+          HDstrncpy(cdf->path, name, strlen(name)+1);
+          break;
+      case netCDF_FILE:
+          /* Nothing */
+          break;
+      case CDF_FILE:
+#ifdef DEBUG
+          fprintf(stderr, "About to do CDF file set up\n");
+#endif
+          cdf->cdf_fp = (hdf_file_t) HI_OPEN(name, hdf_mode);
+          if (OPENERR(cdf->cdf_fp)) 
+              HRETURN_ERROR(DFE_DENIED,NULL);
+          break;
+      }
+#endif /* HDF */
+
+    /*
+     * Read in the contents
+     */
+    if(cdf->xdrs->x_op == XDR_DECODE) /* Not NC_CREAT */
+      {
+          if(!xdr_cdf(cdf->xdrs, &cdf) )
+            {   /* free cdf struct. This cleanup is different than
+                   NC_free_xcdf(). */
+                NC_free_cdf(cdf); /* free memory, close structues,files etc*/
+                cdf = NULL;
+                ret_value = NULL ;
+                goto done;
+            }
+
+          if(NC_computeshapes(cdf) == -1)
+            {
+                ret_value = NULL;
+                goto done;
+            }
+      }
+
+    ret_value = cdf ;
+
+done:
+    if (ret_value == NULL)
+      { /* Failure cleanup */
+          if (cdf != NULL)
+            { /* handles case other than one for NC_free_cdf().
+                 These routines only free up allocted memory. */
+                NC_free_xcdf(cdf); /* no point in catching error here */
+                if (cdf->xdrs != NULL)
+                    Free(cdf->xdrs);
+                Free(cdf) ;
+            }
+      }
+     /* Normal cleanup */
+    return ret_value;
+}
+
+
+/* 
+ * Duplicate a description structure.
+ * Can only be called for 'old' extant on disk, eg, old in DATA mode.
+ *
+ * NOTE:  Cleaned up to catch errors - GV 9/19/97
+ */
+NC *
+NC_dup_cdf(name, mode, old)
+const char *name ;
+int mode ;
+NC *old ;
+{
+	NC *cdf = NULL;
+    NC *ret_value = NULL;
+
+    cdf = (NC *)HDmalloc(sizeof(NC)) ;
+	if( cdf == NULL )
+      {
+          nc_serror("NC_dup_cdf") ;
+          ret_value = NULL;
+          goto done;
+      }
+
+	cdf->flags = old->flags | NC_INDEF ;
+
+	cdf->xdrs = (XDR *)HDmalloc(sizeof(XDR)) ;
+	if( cdf->xdrs == NULL)
+      {
+          nc_serror("NC_dup_cdf: xdrs") ;
+          ret_value = NULL;
+          goto done;
+      } 
+
+	cdf->dims = NULL ;
+	cdf->attrs = NULL ;
+	cdf->vars = NULL ;
+	cdf->begin_rec = 0 ;
+	cdf->recsize = 0 ;
+	cdf->numrecs = 0 ;
+
+#ifdef HDF
+    cdf->file_type = old->file_type;
+#endif
+
+	if(NCxdrfile_create( cdf->xdrs, name, mode) < 0)
+      {
+          ret_value = NULL ;
+          goto done;
+      } 
+
+	old->xdrs->x_op = XDR_DECODE ;
+	if(!xdr_cdf(old->xdrs, &cdf) )
+      {
+          ret_value = NULL;
+          goto done;
+      }
+	if( NC_computeshapes(cdf) == -1)
+      {
+          ret_value = NULL;
+          goto done;
+      }
+
+	ret_value = cdf;
+
+done:
+    if (ret_value == NULL)
+      { /* Failure cleanup */
+          if (cdf != NULL)
+            { /* free up allocated structures */
+                if (cdf->xdrs != NULL)
+                    Free(cdf->xdrs);
+
+                NC_free_xcdf(cdf); /* don't catch error here */
+                Free(cdf);
+            }
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+
+
+int ncinquire(cdfid, ndimsp, nvarsp, nattrsp, xtendimp)
+int cdfid ;
+int *ndimsp ;
+int *nvarsp ;
+int *nattrsp ;
+int *xtendimp ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncinquire" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	
+	if(nvarsp != NULL)
+		*nvarsp = (handle->vars != NULL) ? handle->vars->count : 0 ;
+	if(nattrsp != NULL)
+		*nattrsp = (handle->attrs != NULL) ? handle->attrs->count : 0 ;
+	if(handle->dims != NULL)
+      {
+          NC_dim **dp ;
+          unsigned ii ;
+
+          if(ndimsp != NULL)
+              *ndimsp = handle->dims->count ;
+          if(xtendimp != NULL) {
+              *xtendimp = -1 ;
+
+              dp = (NC_dim**)handle->dims->values ;
+              for(ii = 0 ; ii < handle->dims->count ; ii++, dp++)
+                {
+                    if((*dp)->size == NC_UNLIMITED)
+                      {
+                          *xtendimp = ii ;
+                      }
+                }
+          }
+      } else {
+          if(ndimsp != NULL)
+              *ndimsp = 0 ;
+          if(xtendimp != NULL)
+              *xtendimp = -1 ;
+      }
+
+	return(cdfid) ;
+}
+
+/*
+ *  NOTE: modfied how errors were caught and reported - GV 9/19/97
+ */
+bool_t
+xdr_cdf(xdrs, handlep)
+	XDR *xdrs;
+	NC **handlep;
+{
+    bool_t ret_value = TRUE;
+
+#ifdef HDF    
+    switch((*handlep)->file_type) 
+      {
+      case HDF_FILE:
+          if (hdf_xdr_cdf(xdrs, handlep) == FAIL)
+              ret_value = FALSE;
+          break;
+      case netCDF_FILE:
+          ret_value = NC_xdr_cdf(xdrs, handlep);
+          break;
+      case CDF_FILE:
+          ret_value = nssdc_xdr_cdf(xdrs, handlep);
+          break;
+      default:
+          ret_value = FALSE;
+          break;
+      }
+#else /* !HDF */
+    ret_value = NC_xdr_cdf(xdrs, handlep);
+#endif /* !HDF */
+
+    return ret_value;
+}
+
+
+static bool_t
+NC_xdr_cdf(xdrs, handlep)
+	XDR *xdrs;
+	NC **handlep;
+{
+
+	u_long	magic;
+
+	if( xdrs->x_op == XDR_FREE)
+      {
+          NC_free_xcdf(*handlep) ;
+          return(TRUE) ;
+      }
+	
+	if( xdr_getpos(xdrs) != 0)
+      {
+          if( !xdr_setpos(xdrs, 0) )
+            {
+                nc_serror("Can't set position to begin") ;
+                return(FALSE) ;
+            }
+      }
+
+	/* magic number */
+	if( !xdr_u_long(xdrs, &magic) )
+      {
+          if( xdrs->x_op == XDR_DECODE)
+            {
+                NCadvise(NC_ENOTNC,
+                         "Not a netcdf file (Can't read magic number)") ;
+            }
+          else
+            {
+                /* write error */
+                nc_serror("xdr_cdf: xdr_u_long") ;
+            }
+          return(FALSE) ;
+      }
+
+	if( xdrs->x_op == XDR_DECODE && magic != NCMAGIC )
+      {
+          if(magic == NCLINKMAGIC)
+            {
+                NCadvise(NC_NOERR, "link file not handled yet") ;
+                return(FALSE) ;
+            } /* else */
+          NCadvise(NC_ENOTNC, "Not a netcdf file") ;
+          return(FALSE) ;
+      }
+
+	if( !xdr_numrecs(xdrs, *handlep))
+      {
+          NCadvise(NC_EXDR, "xdr_numrecs") ;
+          return(FALSE) ;
+      }
+	if( !xdr_NC_array(xdrs, &((*handlep)->dims)))
+      {
+          NCadvise(NC_EXDR, "xdr_cdf:dims") ;
+          return(FALSE) ;
+      }
+	if( !xdr_NC_array(xdrs, &((*handlep)->attrs)))
+      {
+          NCadvise(NC_EXDR, "xdr_cdf:attrs") ;
+          return(FALSE) ;
+      }
+	if( !xdr_NC_array(xdrs, &((*handlep)->vars)))
+      {
+          NCadvise(NC_EXDR, "xdr_cdf:vars") ;
+          return(FALSE) ;
+      }	
+	return(TRUE) ;
+}
+
+#ifdef HDF
+/*****************************************************************************
+* 
+*			NCSA HDF / netCDF Project
+*			        May, 1993
+*
+* NCSA HDF / netCDF source code and documentation are in the public domain.  
+* Specifically, we give to the public domain all rights for future
+* licensing of the source code, all resale rights, and all publishing rights.
+* 
+* We ask, but do not require, that the following message be included in all
+* derived works:
+* 
+* Portions developed at the National Center for Supercomputing Applications at
+* the University of Illinois at Urbana-Champaign.  Funding for this project 
+* has come primarily from the National Science Foundation.
+* 
+* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
+* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
+* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
+* 
+******************************************************************************
+*
+* Please report all bugs / comments to hdfhelp at ncsa.uiuc.edu
+*
+*****************************************************************************/
+
+
+/* ----------------------------------------------------------------
+** Map an NC_<type> to an HDF type
+*/
+int
+hdf_map_type(type)
+nc_type type;
+{
+
+    switch(type) 
+      {
+      case NC_UNSPECIFIED : /* be like netCDF */
+      case NC_CHAR   :
+          return DFNT_CHAR;
+      case NC_BYTE   :
+          return DFNT_INT8;
+      case NC_SHORT   :
+          return DFNT_INT16;
+      case NC_LONG   :
+          return DFNT_INT32;
+      case NC_FLOAT   :
+          return DFNT_FLOAT32;
+      case NC_DOUBLE   :
+          return DFNT_FLOAT64;
+      default:
+          return DFNT_NONE;
+      }
+
+} /* hdf_map_type */
+
+
+/* ----------------------------------------------------------------
+**  UnMap a data type.  I.e. go from an HDF type to an NC_<type>
+**  The HDF type may be in DFNT_NATIVE mode, so only look at the 
+**    bottom bits
+*/
+nc_type
+hdf_unmap_type(type)
+int type;
+{
+    switch(type & 0xff) 
+      {
+      case DFNT_CHAR        :
+      case DFNT_UCHAR       :
+          return NC_CHAR;
+      case DFNT_INT8        :
+      case DFNT_UINT8       :
+          return NC_BYTE;
+      case DFNT_INT16       :
+      case DFNT_UINT16      :
+          return NC_SHORT;
+      case DFNT_INT32       :
+      case DFNT_UINT32      :
+          return NC_LONG;
+      case DFNT_FLOAT32     :
+          return NC_FLOAT; 
+      case DFNT_FLOAT64     :
+          return NC_DOUBLE;
+      default:
+          return (nc_type)FAIL;	/* need a better legal nc_type value */
+      }
+
+} /* hdf_unmap_type */
+
+/* -----------------------------------------------------------------
+** Given a dimension id number return its hdf_ref number (Vgroup id)
+*/
+int
+hdf_get_ref(handle, i)
+NC *handle;
+int i;
+{
+  NC_array  *tmp = NULL;
+  NC_dim   **d = NULL;
+  Void      *dims = NULL;
+  
+  tmp  = handle->dims;
+  dims = handle->dims->values;
+  dims += i * tmp->szof;
+  
+  d = (NC_dim **) dims;
+  return (*d)->vgid; /* return ref of vgroup */
+} /* get_hdf_ref */
+
+
+/* ----------------------------------------------------------------
+** Given a dimension pointer return the ref of a Vdata which was
+**   newly created to represent the values the dimension takes on
+** If there is a variable with the same name as our dimension then
+**   the values the variable takes on are the values for the
+**   'steps' in the dimension.
+** Otherwise, the dimension takes on the values 0..(size -1)
+**
+** NOTE:  This may cause conflicts cuz we may get called before
+**   the variable's values are set???
+**
+** NOTE2: Someone should update the comments here. They no longer
+**        seem valid -GV 9/19/97
+*/
+int 
+hdf_create_dim_vdata(xdrs, handle, dim)
+XDR *xdrs;
+NC *handle;
+NC_dim *dim;
+{
+#ifdef LATER
+    CONSTR(FUNC,"hdf_create_dim_vdata"); 
+#endif /* LATER */
+  int   found = FALSE;
+  int   ref;
+  int32 val;
+  long  dsize;
+  int   ret_value = FAIL;
+
+#if DEBUG
+  fprintf(stderr, "hdf_create_dim_vdata I've been called\n");
+  fprintf(stderr, "handle->hdf_file = %d\n", handle->hdf_file);
+#endif
+
+#if 0
+  /* look for variable with the given name */
+  if(handle->vars) 
+    {
+        dp = (NC_var **) handle->vars->values;
+        for(ii = 0; ii < handle->vars->count; ii++, dp++)
+            if(HDstrcmp(dim->name->values, (*dp)->name->values) == 0) 
+              {
+                  /* found it */
+                  found = TRUE;
+                  break;
+              }
+    }
+#endif
+
+  if(found) 
+    {
+        /* load in the variable's values */
+#if DEBUG
+        fprintf(stderr, "Found real values for dimension %s\n", dim->name->values);
+#endif
+    } 
+  else 
+    {
+        dsize = 1;
+        val = (dim->size != NC_UNLIMITED) ? dim->size : (int32)handle->numrecs;
+        ref = VHstoredata(handle->hdf_file, "Values", (const uint8 *)&val, dsize,
+                          DFNT_INT32, dim->name->values, DIM_VALS01);
+      
+        if(ref == FAIL) 
+          {
+#ifdef DEBUG
+              fprintf(stderr, "FAILed creating Vdata %s\n", dim->name->values);
+#endif
+              ret_value = FAIL;
+              goto done;
+          }
+    }
+  
+#if DEBUG
+  fprintf(stderr, "Returning vdata pointer %d\n", ref);
+#endif
+  
+  ret_value = ref;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_create_dim_vdata */
+
+/* ----------------------------------------------------------------
+** Given a dimension pointer return the ref of an older version
+**   dim Vdata which was newly created to represent the values
+**   the dimension takes on, for backward compatibility.
+**
+**   For DIM_VALS, the values the variable takes on are the values
+**     for the 'steps' in the dimension.
+**
+*/
+int
+hdf_create_compat_dim_vdata(XDR *xdrs, 
+                            NC *handle, 
+                            NC_dim *dim, 
+                            int32 dimval_ver)
+{
+    static const char  *FUNC = "hdf_create_compat_dim_vdata";
+    int    i;
+    int    ref;
+    long   dsize;
+    int32 *val = NULL;
+    int    ret_value = FAIL;
+
+#ifdef DEBUG
+    fprintf(stderr, "hdf_create_compat_dim_vdata I've been called\n");
+    fprintf(stderr, "handle->hdf_file = %d\n", handle->hdf_file);
+    fprintf(stderr, "dim_ver = %d\n", dim_ver);
+#endif
+
+    if (dimval_ver != DIMVAL_VERSION00)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    dsize = (dim->size == NC_UNLIMITED)? 1 : dim->size;
+    if (dsize < 0)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    /* create a fake one */
+#ifdef DEBUG
+    fprintf(stderr, "Creating fake dim  ::::%s::: (%d)\n",
+            dim->name->values, dsize);
+#endif
+    /* allocate space */
+    val = (int32 *) HDmalloc(dsize * sizeof(int32));
+    if(!val) 
+      {
+          HERROR(DFE_NOSPACE);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Shouldn't a check for netCDF file be here before using handle->numrecs?
+       If the file is an HDF file, vp->numrecs should be used, right?
+       -BMR (2013-6/24) */
+    if (dim->size == NC_UNLIMITED)  
+      {
+          *val = handle->numrecs;
+      }
+    else
+      {
+          for(i = 0; i < dsize; i++) val[i] = i;
+      }
+
+    ref = VHstoredata(handle->hdf_file, "Values", (const uint8 *)val,
+                      dsize, DFNT_INT32, dim->name->values, DIM_VALS);
+    if(ref == FAIL) 
+      {
+#ifdef DEBUG
+          fprintf(stderr, "FAILed creating Vdata %s\n", dim->name->values);
+#endif
+          ret_value =  FAIL;
+          goto done;
+      }
+
+
+#ifdef DEBUG
+    fprintf(stderr, "Returning vdata pointer %d\n", ref);
+#endif
+
+    ret_value = ref;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+    if (val != NULL)
+        HDfree(val);
+
+    return ret_value;
+} /* hdf_create_compat_dim_vdata */
+
+/* ----------------------------------------------------------------
+** Write out a vdata representing an attribute
+*/
+int
+hdf_write_attr(xdrs, handle, attr)
+XDR *xdrs;
+NC *handle;
+NC_attr **attr;
+{
+    char *name = NULL;
+    Void *values = NULL;
+    int size;
+    int type;
+    int order;
+    int ret_value = SUCCEED;
+
+    name = (*attr)->name->values;
+    values = (*attr)->data->values;
+    size = (*attr)->data->count;
+    type = (*attr)->HDFtype;
+
+#if DEBUG
+    fprintf(stderr, "hdf_write_attr I've been called\n");
+    fprintf(stderr, "The attribute is called %s\n", name);
+    fprintf(stderr, "Type = %d (%d)  size  %d\n", type, (*attr)->HDFtype, size);
+    fprintf(stderr, "Value: ");
+    switch(type) 
+      {
+      case DFNT_CHAR :fprintf(stderr, " (char) %s\n", (char *) values); break;
+      case DFNT_UINT8 :fprintf(stderr, " (uint8) %d\n", (char *) values); break;
+      case DFNT_INT8 :fprintf(stderr, " (int8) %d\n", (char *) values); break;
+      case DFNT_UINT16 :fprintf(stderr, " (uint16) %d\n", (int *) values); break;
+      case DFNT_INT16 :fprintf(stderr, " (int16) %d\n", (int *) values); break;
+      case DFNT_UINT32 :fprintf(stderr, " (uint32) %d\n", (int *) values); break;
+      case DFNT_INT32 :fprintf(stderr, " (int32) %d\n", (int *) values); break;
+      case DFNT_FLOAT32 :fprintf(stderr, " (float32) %f\n", (float *) values); break;
+      case DFNT_FLOAT64 :fprintf(stderr, " (float64) %f\n", (double *) values); break;
+      default:fprintf(stderr, "???\n");
+      }
+#endif
+
+    if(type == DFNT_CHAR) 
+      {
+          order = size;
+          size = 1;
+      } 
+    else 
+      { 
+          order = 1;
+      }
+      
+    ret_value = VHstoredatam(handle->hdf_file, ATTR_FIELD_NAME, 
+                          (unsigned char *) values, size, 
+                          type, name, _HDF_ATTRIBUTE, order);
+
+#if DEBUG
+    fprintf(stderr, "hdf_write_attr returning %d\n", ret_value);
+#endif
+
+#ifdef LATER
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+#endif /* LATER */
+
+    return ret_value;
+} /* hdf_write_attr */
+
+/* ----------------------------------------------------------------
+** Write out a group representing a dimension
+*/
+int32
+hdf_write_dim(XDR *xdrs, NC *handle, NC_dim **dim, int32 cnt)
+{
+    int32 tags[100];
+    int32 refs[100];
+    int32 count;
+    const char  *class = NULL;
+    char  name[H4_MAX_NC_NAME] = "";
+    int32 ret_value = SUCCEED;
+
+#if DEBUG
+    fprintf(stderr, "hdf_write_dim I've been called\n");
+    fprintf(stderr, "The name is -- %s -- \n", (*dim)->name->values);
+#endif
+
+    /*
+     * Look up to see if there is a variable of the same name
+     *  giving values
+     */
+    count = 0;
+    tags[count] = DFTAG_VH;
+    refs[count] = hdf_create_dim_vdata(xdrs, handle, (*dim));
+    if(refs[count] == FAIL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    count++;
+
+    /* do we need to create compatible dimension? */
+    if ((*dim)->dim00_compat) 
+      {
+          tags[count] = DFTAG_VH;
+          refs[count] = hdf_create_compat_dim_vdata(xdrs, handle, (*dim), DIMVAL_VERSION00);
+          if(refs[count] == FAIL) 
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          count++;
+      } 
+
+    /* check if UNLIMITED dimension */
+    if((*dim)->size == NC_UNLIMITED) 
+        class = _HDF_UDIMENSION;
+    else
+        class = _HDF_DIMENSION;
+  
+    if(HDstrncmp((*dim)->name->values, "fakeDim", 7) == 0)
+        sprintf(name, "fakeDim%d", (int)cnt);
+    else
+        HDstrcpy(name, (*dim)->name->values);
+
+    /* write out the dimension group? */
+    (*dim)->vgid = VHmakegroup(handle->hdf_file, tags, refs, count, 
+                               name, class);
+
+    ret_value = (*dim)->vgid; /* ref of vgroup of dimension */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_write_dim */
+
+
+/* ----------------------------------------------------------------
+** Write out a group representing a variable
+** If successfull, return the id of the created Vgroup else
+**  return NULL
+*/
+int32
+hdf_write_var(xdrs, handle, var)
+XDR *xdrs;
+NC *handle;
+NC_var **var;
+{
+    NC_array  *  attrs = NULL;
+    NC_iarray *  assoc = NULL;
+    uint8        ntstring[4];
+    uint16       ref;
+    int8         outNT;
+    uint8 tbuf[2+((H4_MAX_VAR_DIMS+1)*8)];   /* temporary buffer */
+    int32 tags[H4_MAX_NC_ATTRS + H4_MAX_VAR_DIMS + 2];
+    int32 refs[H4_MAX_NC_ATTRS + H4_MAX_VAR_DIMS + 10];
+    uint16       nt_ref, rank;
+    int32     GroupID, val, vs_id;
+    uint8     *bufp = NULL;
+#ifdef LATER
+    CONSTR(FUNC,"hdf_write_var"); 
+#endif /* LATER */
+    int32      ret_value = SUCCEED;
+    register unsigned  i, count;
+    register Void *attribute = NULL;
+
+    count = 0;
+    assoc = (*var)-> assoc;
+    attrs = (*var)-> attrs;
+
+#if DEBUG
+    fprintf(stderr, "hdf_write_var I've been called\n");
+    fprintf(stderr, "handle->hdf_file = %d\n", handle->hdf_file);
+    fprintf(stderr, "The name is -- %s -- \n", (*var)->name->values);
+
+    if(assoc && assoc->count) 
+      {
+          fprintf(stderr, "value of assoc %d\n", assoc);
+          fprintf(stderr, " assoc->count %d\n", assoc->count);
+          fprintf(stderr, " asc[0] %d asc[1] %d\n", assoc->values[0], assoc->values[1]);
+      }
+#endif
+
+    /*
+     *  Get the dimension information
+     */
+    for(i = 0; i < assoc->count; i++) 
+      {
+          tags[count] = DIM_TAG;
+          refs[count] = hdf_get_ref(handle, assoc->values[i]);
+          count++;
+      }
+
+    /* 
+     * Add info for the attributes
+     */
+    if(attrs) 
+      {
+          attribute = attrs->values;
+          for(i = 0; i < attrs->count; i++) 
+            {
+                tags[count] = ATTR_TAG;
+                refs[count] = hdf_write_attr(xdrs, handle, (NC_attr **)attribute);
+                if (refs[count] == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+                attribute += attrs->szof;
+                count++;
+            }
+      }
+  
+    /*
+     *  Add info about the type of this variable
+     */
+    if ((*var)->var_type == IS_SDSVAR || (*var)->var_type == IS_CRDVAR)
+      {
+	char fields[FIELDNAMELENMAX];
+	char vsclass[H4_MAX_NC_NAME];
+
+	if ((*var)->var_type == IS_SDSVAR)
+	  {
+	    strncpy(fields, "SDS variable", 13);
+	    strncpy(vsclass, _HDF_SDSVAR, 7);
+	  }
+	else if ((*var)->var_type == IS_CRDVAR)
+	  {
+	    strncpy(fields, "Coordinate variable", 20);
+	    strncpy(vsclass, _HDF_CRDVAR, 9);
+	  }
+
+	if ((vs_id = VSattach(handle->hdf_file, -1, "w")) == FAIL)
+	  {
+	    ret_value = FAIL;
+	    goto done;
+	  }
+        if(VSsetclass(vs_id, vsclass)==FAIL)
+          {
+            ret_value = FAIL;
+            goto done;
+          }
+
+    if ( VSfdefine(vs_id, fields, DFNT_FLOAT32, 1) == FAIL)
+          {
+            ret_value = FAIL;
+            goto done;
+          }
+    if ( VSsetfields(vs_id, fields) == FAIL)
+          {
+            ret_value = FAIL;
+            goto done;
+          }
+
+	ref = VSQueryref(vs_id);
+
+	if(VSdetach(vs_id)==FAIL)
+	  {
+	    ret_value = FAIL;
+	    goto done;
+	  }
+
+	tags[count] = DFTAG_VH;
+	refs[count] = ref;
+	count++;
+      }
+
+    /*
+     * If we already have data written out include that too
+     *   (this might happen after a redef() cuz we will leave
+     *   the data sitting on the disk but clear out all the 
+     *   meta-data)
+     */
+    if((*var)->data_ref) 
+      {
+          tags[count] = (int32) DFTAG_SD;
+          refs[count] = (*var)->data_ref;
+#if DEBUG
+          fprintf(stderr, " ---- Carrying forward data with ref %d ---- \n", (*var)->data_ref);
+#endif 
+          count++;
+      } 
+  
+  
+    /*
+     * Write out a number type tag so that we can recover this 
+     *   variable's type later on
+     *
+     * by default numbers are converted to IEEE otherwise we need to save the 
+     *   machine type in the NT object
+     */
+
+    /* somone unwrap this statement....*/
+    outNT = ((*var)->HDFtype & DFNT_NATIVE)?  
+        DFKgetPNSC((*var)->HDFtype, DF_MT) : ((*var)->HDFtype & DFNT_LITEND)? 
+        DFNTF_PC :  DFNTF_IEEE;
+
+#ifdef NOT_YET
+    ref = Htagnewref(handle->hdf_file,DFTAG_NT);
+#else /* NOT_YET */
+    ref = Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+    ntstring[0] = DFNT_VERSION;                    /* version */
+    ntstring[1] = (uint8)((*var)->HDFtype & 0xff); /* type */
+    ntstring[2] = (uint8)((*var)->HDFsize * 8);    /* width (in bits) */
+    ntstring[3] = outNT;                           /* class: IEEE or machine class */
+    if(Hputelement(handle->hdf_file, DFTAG_NT, ref, ntstring, (int32) 4) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    tags[count] = DFTAG_NT;
+    refs[count] = ref;
+    nt_ref = (uint16) ref;
+    count++;
+  
+
+#ifdef WRITE_NDG
+    /* prepare to start writing ndg   */
+    if ((GroupID = DFdisetup(10)) < 0)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+  
+    /* write SD record */
+    if((*var)->data_ref)
+      {
+          if (DFdiput(GroupID, DFTAG_SD, (uint16) (*var)->data_ref) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+  
+    /* write NT tag/ref */
+    if (DFdiput(GroupID, DFTAG_NT, (uint16) ref) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* put rank & dimensions in buffer */
+    bufp = tbuf;
+    rank = assoc->count;
+    UINT16ENCODE(bufp, rank);
+    for(i = 0; i < (int)rank; i++) 
+      {
+          val = (int32) (*var)->shape[i];
+
+          /* need to fake the size of the record dimension */
+          if(val == NC_UNLIMITED) 
+            {
+                if(handle->file_type == HDF_FILE)
+                    val = (*var)->numrecs;
+                else
+                    val = handle->numrecs;
+            }
+
+          INT32ENCODE(bufp, val);
+      }
+  
+    /* "<=" used to put 1 data NT + rank scale NTs in buffer */
+    for (i = 0; i <= (int)rank; i++) 
+      {  /* scale NTs written even if no scale!*/
+          UINT16ENCODE(bufp, DFTAG_NT);
+          UINT16ENCODE(bufp, nt_ref);
+      } 
+  
+    /* write out SDD record */
+    if(Hputelement(handle->hdf_file, DFTAG_SDD, ref, tbuf, (int32) (bufp-tbuf)) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+  
+    /* write dimension record tag/ref */
+    if (DFdiput(GroupID, DFTAG_SDD,(uint16) ref) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    tags[count] = DFTAG_SDD;
+    refs[count] = ref;
+    count++;
+
+    /* Add a bogus tag so we know this NDG is really a variable */
+    if (DFdiput(GroupID, BOGUS_TAG,(uint16) ref) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* write out NDG */
+    if (DFdiwrite(handle->hdf_file, GroupID, DFTAG_NDG, (*var)->ndg_ref) < 0) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+  
+    tags[count] = DFTAG_NDG;
+    refs[count] = (*var)->ndg_ref;
+    count++;
+
+#endif /* WRITE_NDG */
+
+    /* write the vgroup for the coordinate variable */
+    (*var)->vgid = VHmakegroup(handle->hdf_file, tags, refs, count, 
+				(*var)->name->values, _HDF_VARIABLE);
+
+
+#ifdef DEBUG
+    if((*var)->vgid == FAIL) 
+      {
+          fprintf(stderr, "Failed to write variable %s\n", (*var)->name->values);
+          fprintf(stderr, "count = %d\n", count);
+          for(i = 0; i < count; i++)
+              fprintf(stderr, "i = %d   tag = %d ref = %d\n", i, tags[i], refs[i]);
+          
+          HEprint(stdout, 0);
+      }  
+#endif
+
+    ret_value =  (*var)->vgid; /* ref of vgroup of variable */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;  
+} /* hdf_write_var */
+
+
+/* ----------------------------------------------------------------
+** Write out a cdf structure
+*/
+intn
+hdf_write_xdr_cdf(xdrs, handlep)
+XDR *xdrs;
+NC **handlep;
+{
+    int32 count;
+    int status, done;
+    unsigned sz, i, j;
+    int32    *tags = NULL;
+    int32    *refs = NULL;
+    NC_dim  **dims = NULL;
+    NC_dim  **dims1 = NULL;
+    NC_array *tmp = NULL;
+    long     *dim_size_array = NULL;
+    long     *tsizeptr = NULL;
+    long      tsize;
+    uint32   *dim_hash_array = NULL;
+    uint32   *thashptr = NULL;
+    uint32   thash;
+    Void     *vars = NULL;
+    Void     *attrs = NULL;
+    intn      ret_value = SUCCEED;
+
+#if DEBUG
+    fprintf(stderr, "hdf_write_xdr_cdf i've been called op = %d \n", xdrs->x_op);
+#endif
+
+   /* Convert old scales into coordinate var values before writing
+      out any header info */
+    status = hdf_conv_scales(handlep);
+    if (status == FAIL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* count size of tag / ref arrays */
+    sz = 0;
+    if((*handlep)->dims)  
+        sz += (*handlep)->dims->count;
+    if((*handlep)->vars)  
+        sz += (*handlep)->vars->count;
+    if((*handlep)->attrs) 
+        sz += (*handlep)->attrs->count;
+
+#if DEBUG
+    fprintf(stderr, "sz = %d\n", sz);
+#endif
+
+    /* allocate tag / ref arrays */
+    tags = (int32 *) HDmalloc(sz * sizeof(int32) + 1);
+    refs = (int32 *) HDmalloc(sz * sizeof(int32) + 1);
+    if(NULL == tags || NULL == refs) 
+      {
+#ifdef DEBUG
+          fprintf(stderr, "Out of memory line %d file %s\n", __LINE__, __FILE__);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 
+    ** write out dimension arrays 
+    */
+    count = 0;
+    if((*handlep)->dims) 
+      {
+          tmp = (*handlep)->dims; 
+          dims = (NC_dim **) (*handlep)->dims->values;
+
+          tsizeptr = dim_size_array =(long *)HDmalloc(sizeof(long)*(size_t)tmp->count);
+          thashptr = dim_hash_array =(uint32 *)HDmalloc(sizeof(uint32)*(size_t)tmp->count);
+
+          if(NULL == dim_size_array || NULL == dim_hash_array) 
+            {
+#ifdef DEBUG
+                fprintf(stderr, "Out of memory line %d file %s\n", __LINE__, __FILE__);
+#endif
+                ret_value = FAIL;
+                goto done;
+            }
+
+          for(i = 0; i < tmp->count; i++,dims++) 
+            {
+                *tsizeptr++=(*dims)->size;
+                *thashptr++=(*dims)->name->hash;
+            } /* end for */
+
+          dims = (NC_dim **) (*handlep)->dims->values;
+          for(i = 0; i < tmp->count; i++) 
+            {
+
+                /* this is really ugly and should be handled another way */
+                /* make sure we don't duplicate dimensions */
+                done = FALSE;
+                dims1 = (NC_dim **) (*handlep)->dims->values;
+                tsize = dim_size_array[i];
+                thash = dim_hash_array[i];
+                tsizeptr = dim_size_array;
+                thashptr = dim_hash_array;
+
+                for(j = 0; j < i; j++) 
+                  {
+                      /* this order on the test is faster -QAK */
+                      if( thash == *thashptr 
+                          && tsize == *tsizeptr 
+                          && NC_compare_string((*dims)->name,(*dims1)->name) == 0 ) 
+                        {
+                            done = TRUE;
+                            break;
+                        }
+                      tsizeptr++;
+                      thashptr++;
+                      dims1++;
+                  }
+
+                if(!done) 
+                  {
+                      tags[count] = (int32) DIM_TAG;
+                      refs[count] = (int32) hdf_write_dim(xdrs, (*handlep), dims, count);
+                      if(refs[count] == FAIL) 
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      count++;
+                  }
+                dims++;
+            }
+      } /* end if handle->dims */
+  
+    /* 
+    ** write out variable info 
+    */
+    if((*handlep)->vars) 
+      {
+          tmp = (*handlep)->vars; 
+          vars = (*handlep)->vars->values;
+          for(i = 0; i < tmp->count; i++) 
+            {
+                tags[count] = (int32) VAR_TAG;
+                refs[count] = (int32) hdf_write_var(xdrs, (*handlep), (NC_var **)vars);
+                if(refs[count] == FAIL) 
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+                vars += tmp->szof;
+                count++;
+            }
+      }
+
+    /*
+     * write global attribute information
+     */
+    if((*handlep)->attrs) 
+      {
+          tmp = (*handlep)->attrs; 
+          attrs = (*handlep)->attrs->values;
+          for(i = 0; i < tmp->count; i++) 
+            {
+                tags[count] = (int32) ATTR_TAG;
+                refs[count] = (int32) hdf_write_attr(xdrs, (*handlep), (NC_attr **)attrs);
+                if(refs[count] == FAIL) 
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+                attrs += tmp->szof;
+                count++;
+            }
+      }
+
+#if DEBUG
+    fprintf(stderr, "About to write top level VG with %d elements\n", count);
+    {
+        int i; 
+        for(i = 0; i < count; i++) 
+            fprintf(stderr, "%d :=> %d %d\n", i, tags[i], refs[i]);
+    }
+#endif
+
+    /* write out final VGroup thang */
+    /* set the top level CDF VGroup pointer */
+    (*handlep)->vgid = VHmakegroup((*handlep)->hdf_file, tags, refs, count, 
+                                   (*handlep)->path, _HDF_CDF);
+
+
+    ret_value = (*handlep)->vgid; /* ref of final vgroup  */
+
+#ifdef DEBUG
+    fprintf(stderr, "======= Have finished writing top level VGroup #%d\n", ret_value);
+#endif
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+    if (dim_size_array != NULL)
+        HDfree(dim_size_array);
+    if (dim_hash_array != NULL)
+        HDfree(dim_hash_array);
+    if (tags != NULL)
+        HDfree(tags);
+    if (refs != NULL)
+        HDfree(refs);
+
+    return ret_value;
+} /* hdf_write_xdr_cdf */
+
+/* --------------------------------------------------------------
+** hdf_conv_scales converts old scale values into coord var values.
+** Searchs through var list for DFTAG_SDS, reads in the scale data,
+** change the ref to ndg_ref and the tag to DATA_TAG, writes the 
+** data out. 
+*/
+intn 
+hdf_conv_scales(handlep)
+NC **handlep;
+{
+    int status, scaleref, scaletag, scalelen;
+    unsigned i;
+    NC_var   **vars = NULL;
+    NC_array  *tmp = NULL;
+    uint8     *scalebuf = NULL;
+    uint8     *datap = NULL;
+    intn    ret_value = SUCCEED;
+#ifdef LATER
+    CONSTR(FUNC, "hdf_conv_scales");
+#endif /* LATER */
+
+    if ((*handlep)->vars) 
+      {
+          tmp = (*handlep)->vars;
+          vars = (NC_var **)tmp->values;
+          for (i = 0; i < tmp->count; i++)   
+            {
+                if ( ((*vars)->data_tag == DFTAG_SDS) 
+                     && ((*vars)->data_ref != (*vars)->ndg_ref)) 
+                  {
+                      /* read in scale values */
+                      scaleref = (*vars)->data_ref;
+                      scaletag = (*vars)->data_tag;
+                      scalelen = Hlength((*handlep)->hdf_file, scaletag, scaleref);
+                      if (scalelen == FAIL) 
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      if ((*vars)->data_offset == -1)  
+                        { /* this dim has no scale values */
+                            (*vars)->data_ref = 0;
+                            (*vars)->data_tag = DATA_TAG;
+                        }
+                      else 
+                        {    /* has scale values */
+                            scalebuf = (uint8 *)HDmalloc((uint32)scalelen);
+                            if (scalebuf == NULL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                            status = Hgetelement((*handlep)->hdf_file, scaletag, 
+                                                 scaleref, scalebuf); 
+                            if (status == FAIL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            (*vars)->data_tag = DATA_TAG;
+                            (*vars)->data_ref = (*vars)->ndg_ref; /* Try to stick
+                                                                     with the current way. If this ref conflicts with 
+                                                                     existing SDS, call Hnewref to get a new one. 3/25/97 */
+                            datap = scalebuf + (*vars)->data_offset;
+                            status = Hputelement((*handlep)->hdf_file, DATA_TAG,
+                                                 (*vars)->data_ref, datap, (*vars)->len);
+                            if (status == FAIL) 
+                              {
+                                  (*vars)->data_tag = scaletag;
+                                  (*vars)->data_ref = scaleref;
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                        } /* has scale values */
+                  }  /* DFTAG_SDS */
+                vars ++;
+            }
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+    if (scalebuf != NULL)
+        HDfree(scalebuf);
+
+    return ret_value;
+}
+  
+
+/* ----------------------------------------------------------------
+** Read in the dimensions out of a cdf structure
+** Return FAIL if something goes wrong
+*/
+intn 
+hdf_read_dims(XDR *xdrs, NC *handle, int32 vg)
+{
+    char vgname[H4_MAX_NC_NAME] = "";
+    char vsclass[H4_MAX_NC_CLASS] = "";
+    char vgclass[H4_MAX_NC_CLASS] = "";
+    int      id, count, i, found;
+    int      sub_id;
+    int32    dim_size;
+    NC_dim **dimension = NULL;
+    int32    dim, entries;
+    int32    vs;
+    intn      ret_value = SUCCEED;
+
+    found = FALSE;
+    count = 0;
+    id = -1;
+
+#if DEBUG
+    fprintf(stderr, "hdf_read_dims I've been called, handle->hdf_file = %d\n", handle->hdf_file);
+#endif
+
+    /*
+     * Allocate enough space in case everything is a dimension
+     */
+    count = 0;
+    dimension = (NC_dim **) HDmalloc(sizeof(NC_dim *) * Vntagrefs(vg) + 1);
+    if(NULL == dimension) 
+      {
+          /* replace it with NCadvice or HERROR?? */
+#ifdef DEBUG
+          fprintf(stderr, "Out of memory line %d file %s\n", __LINE__, __FILE__);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /*
+     * Look through for a Vgroup of class _HDF_DIMENSION
+     */
+    while((id = Vgetnext(vg, id)) != FAIL) 
+      {
+          if(Visvg(vg, id)) 
+            {
+                dim = Vattach(handle->hdf_file, id, "r");
+                if(dim == FAIL) 
+                    continue; /* why do we continue? does this failure here
+                                 not matter? -GV */
+                if (Vgetclass(dim, vgclass) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                if(!HDstrcmp(vgclass, _HDF_DIMENSION) 
+                   || !HDstrcmp(vgclass, _HDF_UDIMENSION)) 
+                  {
+                      int is_dimval, is_dimval01;
+                      /* init both flags to FALSE  */
+                      is_dimval = FALSE;
+                      is_dimval01 = FALSE;
+
+                      if (Vinquire(dim, &entries, vgname) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+      	
+                      /* 
+                       * look through for a Vdata of class DIM_VALS01 and/or DIM_VALS 
+                       * to get size 
+                       */
+                      sub_id = -1;
+                      while(((sub_id = Vgetnext(dim, sub_id)) != FAIL) ) 
+                        {
+                            if(Visvs(dim, sub_id)) 
+                              {
+                                  vs = VSattach(handle->hdf_file, sub_id, "r");
+                                  if(vs == FAIL) 
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+      
+                                  if (VSgetclass(vs, vsclass) == FAIL)
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+      
+                                  if(!HDstrcmp(vsclass, DIM_VALS)) 
+                                    {
+                                        is_dimval = TRUE;
+                                        if (HDstrcmp(vgclass, _HDF_UDIMENSION))  /* not unlimited di
+                                                                                    m */
+                                          {
+                                              if (VSQuerycount(vs, &dim_size) == FAIL)
+                                                {
+                                                    ret_value = FAIL;
+                                                    goto done;
+                                                }
+                                          }
+                                    }
+                                  if ((!HDstrcmp(vsclass, DIM_VALS01)) 
+                                      || (!HDstrcmp(vgclass, _HDF_UDIMENSION))) 
+                                    { /* DIM_VALS && _HDF_UDIMENSION */
+                                        int32 val;	/* needs a temp var since handle->numrecs */
+                                        /* may not be an int32 */
+       /* 
+          The call to VSsetfields fails for the files created with the library
+          version 3.3r1. This call is not necessary since handle vs is
+          obtained by specifying class name. 
+          Elena Pourmal 2/17/99
+
+                                        if (VSsetfields(vs, "Values") == FAIL)
+                                          {
+                                              ret_value = FAIL;
+                                              goto done;
+                                          }
+        */
+
+                                        if (VSseek(vs, 0) == FAIL)
+                                          {
+                                              ret_value = FAIL;
+                                              goto done;
+                                          }
+
+                                        /*
+                                         * This is highly dangerous since there might be multiple
+                                         * unlimited dimensions
+                                         */
+                                        if(VSread(vs, (uint8 *) &val, 1, FULL_INTERLACE) != 1)
+                                          {
+                                              ret_value = FAIL;
+                                              goto done;
+                                          }
+                                        if (!HDstrcmp(vgclass, _HDF_UDIMENSION))   
+                                          {
+                                              dim_size = NC_UNLIMITED;
+                                              handle->numrecs = val;
+                                          }
+                                        else  
+                                            dim_size = val;
+                                    }  /*  */
+
+                                  if (!HDstrcmp(vsclass, DIM_VALS01)) /* dimval01  */
+                                      is_dimval01 = TRUE;
+
+                                  if (VSdetach(vs) == FAIL)
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    } 
+
+                                  /* Is it the second dim vs of a compatible dim? */
+                                  found = FALSE;
+                                  for (i = count-1; ((i >= 0) && (!found)); i--)  
+                                    {
+                                        if (!HDstrcmp(vgname, dimension[i]->name->values) &&
+                                            (dim_size == dimension[i]->size))     {
+                                            /* vgname is the dim name. vgname may be diff from vsname */
+                                            if (is_dimval01 == TRUE && is_dimval == TRUE)
+                                                dimension[i]->dim00_compat = 1;
+                                            found = TRUE;   /* the second vs */
+                                        }
+                                    }  /* for */
+
+                                  if (!found) 
+                                    {
+                                        dimension[count] = NC_new_dim(vgname, dim_size);
+                                        if(NULL == dimension[count]) 
+                                          {
+#ifdef DEBUG
+                                              /* replace it with NCadvice or HERROR?? */
+                                              fprintf(stderr, "Can't create new dimension #%d\n", count);
+#endif
+                                              ret_value = FAIL;
+                                              goto done;
+                                          }  /*  dimension[count]  */
+#if DEBUG
+                                        fprintf(stderr, "Dimension <%s> has size %d\n", vgname, dim_size);
+#endif
+                                        if (!HDstrcmp(vsclass, DIM_VALS01)) /* dimvals01 only  */
+                                            dimension[count]->dim00_compat = 0;
+
+					/* record vgroup id here so we can use later */
+					/* Note: this is only for later file -BMR */
+					dimension[count]->vgid = id;
+
+                                        count++;
+                                    }  /* found */
+                              }    /* is vs  */
+                        }      /* while in dimension vg  */
+                  }        /* is vg  */
+
+                if (Vdetach(dim) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }  /* while */
+      }
+
+    if(count)
+      {
+          handle->dims = NC_new_array(NC_DIMENSION, count, (Void *) dimension);
+          if (handle->dims == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+    else
+        handle->dims = NULL;
+
+#if DEBUG
+    fprintf(stderr, "Created dimension array %d \n", handle->dims);
+#endif
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (handle->dims != NULL)
+            {
+                NC_free_array(handle->dims);
+                handle->dims = NULL;
+            }
+      }
+     /* Normal cleanup */
+    if (dimension != NULL)
+        HDfree(dimension);
+
+    return ret_value;
+} /* hdf_read_dims */
+
+/******************************************************************************
+ NAME 
+   hdf_num_attrs
+
+ DESCRIPTION
+   Determine number of attributes in vgroup i.e. of the SDS
+
+ RETURNS
+   returns number of attributes in vgroup if successful and FAIL
+   otherwise.
+*******************************************************************************/
+static intn
+hdf_num_attrs(NC *handle,/* IN: handle to SDS */
+              int32 vg   /* IN: ref of top Vgroup */)
+{
+    int       count = 0;
+    int       t, n;
+    int32     vs, tag;
+    int32     id = -1;
+    char      class[H4_MAX_NC_CLASS] = "";
+    intn      ret_value = FAIL;
+
+#ifdef HDF_NUM_ATTRS
+    fprintf(stderr, "hdf_num_attrs: I've been called, handle->hdf_file = %d\n", handle->hdf_file);
+#endif
+
+    n = Vntagrefs(vg);
+    if (n == FAIL)
+      {
+#ifdef HDF_NUM_ATTRS
+          fprintf(stderr,"hdf_read_attrs: Vntagrefs failed \n");
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+#ifdef HDF_NUM_ATTRS
+    fprintf(stderr,"hdf_num_attrs: Vntagrefs returned =%d \n",n);
+#endif
+
+    /*
+     * look through for a Vdata of class _HDF_ATTRIBUTE
+     */
+    for (t = 0; t < n; t++) 
+      {
+          if (Vgettagref(vg, t, &tag, &id) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      
+          if(tag == DFTAG_VH) 
+            {
+                vs = VSattach(handle->hdf_file, id, "r");
+                if(vs == FAIL) 
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+          
+                if (VSgetclass(vs, class) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                if(!HDstrcmp(class, _HDF_ATTRIBUTE)) 
+                    count++;
+
+                if (VSdetach(vs) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+      }
+  
+#ifdef HDF_NUM_ATTRS
+    fprintf(stderr, "hdf_num_attrs: number of attributes is %d \n", count);
+#endif
+
+    ret_value = count;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_num_attrs */
+
+/* ----------------------------------------------------------------
+** Read in all attributes of the current vg
+** Return NULL if something goes wrong
+** Return a pointer to the array of attributes if all goes well
+*/
+NC_array *
+hdf_read_attrs(XDR *xdrs, NC *handle, int32 vg)
+{
+    int       count, t, n;
+    int32     vs, tag, id, vsize, attr_size, nt;
+    nc_type   type;
+    char      vsname[H4_MAX_NC_NAME] = "";
+    char      fields[100] = "" ;
+    char      class[H4_MAX_NC_CLASS] = "";
+    char     *values = NULL;
+    NC_attr **attributes = NULL;
+    NC_array *Array = NULL;
+    NC_array *ret_value = NULL;
+
+    count = 0;
+    id = -1;
+
+#if DEBUG
+    fprintf(stderr, "hdf_read_attrs I've been called, handle->hdf_file = %d\n", handle->hdf_file);
+#endif
+
+    n = Vntagrefs(vg);
+    if (n == FAIL)
+      {
+#ifdef HDF_READ_ATTRS
+          fprintf(stderr,"hdf_read_attrs: Vntagrefs failed \n");
+#endif
+          ret_value = NULL;
+          goto done;
+      }
+
+#ifdef HDF_READ_ATTRS
+    fprintf(stderr,"hdf_read_attrs: Vntagrefs returned =%d \n",n);
+#endif
+
+    /*
+     * Allocate enough space in case everything is an attribute
+     */
+    count = 0;
+    attributes = (NC_attr **) HDmalloc(sizeof(NC_attr *) * n + 1);
+    if(NULL == attributes) 
+      {
+          /* replace it with NCAdvice or HERROR? */
+#ifdef HDF_READ_ATTRS
+          fprintf(stderr, "Out of memory line %d file %s\n", __LINE__, __FILE__);
+#endif
+          ret_value = NULL;
+          goto done;
+      }
+
+    /*
+     * look through for a Vdata of class _HDF_ATTRIBUTE
+     */
+    for (t = 0; t < n; t++) 
+      {
+          if (Vgettagref(vg, t, &tag, &id) == FAIL)
+            {
+                ret_value = NULL;
+                goto done;
+            }
+      
+          if(tag == DFTAG_VH) 
+            {
+                vs = VSattach(handle->hdf_file, id, "r");
+                if(vs == FAIL) 
+                  {
+                      ret_value = NULL;
+                      goto done;
+                  }
+          
+                if (VSgetclass(vs, class) == FAIL)
+                  {
+                      ret_value = NULL;
+                      goto done;
+                  }
+
+                if(!HDstrcmp(class, _HDF_ATTRIBUTE)) 
+                  {
+                      if (VSinquire(vs, &attr_size, NULL, fields, &vsize, vsname) == FAIL)
+                        {
+                            ret_value = NULL;
+                            goto done;
+                        }
+
+                      if ((nt = VFfieldtype(vs, 0)) == FAIL)
+                        {
+                            ret_value = NULL;
+                            goto done;
+                        }
+
+                      if ((type = hdf_unmap_type(nt)) == FAIL)
+                        {
+                            ret_value = NULL;
+                            goto done;
+                        }
+
+                      values = (char *) HDmalloc(vsize * attr_size + 1);
+                      if (NULL == values)
+                        {
+                            ret_value = NULL;
+                            goto done;
+                        }
+
+                      if (VSsetfields(vs, fields) == FAIL)
+                        {
+                            ret_value = NULL;
+                            goto done;
+                        }
+
+                      if (VSread(vs, (uint8 *) values, attr_size, FULL_INTERLACE) == FAIL)
+                        {
+                            ret_value = NULL;
+                            goto done;
+                        }
+
+              
+                      if(type == NC_CHAR) 
+                        {
+                            if ((attr_size = VFfieldorder(vs, 0)) == FAIL)
+                              {
+                                  ret_value = NULL;
+                                  goto done;
+                              }
+
+                            ((char *) values)[attr_size] = '\0';
+                        }
+
+                      attributes[count] = 
+                          (NC_attr *) NC_new_attr(vsname, type, attr_size, values);
+                      if(NULL == attributes[count]) 
+                        {
+                            /* replace it with NCadvice or HERROR? */
+#ifdef HDF_READ_ATTRS
+                            fprintf(stderr, "hdf_read_attrs: Can't create new attribute #%d\n", count);
+#endif
+                            ret_value = NULL;
+                            goto done;
+                        }
+                      attributes[count]->HDFtype = nt;
+              
+#ifdef HDF_READ_ATTRS
+                      fprintf(stderr, "hdf_read_attrs: Attribute <%s> has type %d and size %d\n", 
+                              vsname, type, attr_size);
+#endif
+                      /* free values and reset to NULL */
+                      HDfree(values);
+                      values = NULL;
+                      count++;
+                  } /* end if attribute ? */
+
+                if (VSdetach(vs) == FAIL)
+                  {
+                      ret_value = NULL;
+                      goto done;
+                  }
+            } /* end if DFTAG_VH */
+      } /* end for */
+  
+    /* create array of attributes */
+    if(count) 
+        Array = NC_new_array(NC_ATTRIBUTE, count, (Void *) attributes);
+
+#ifdef HDF_READ_ATTRS
+    fprintf(stderr, "hdf_read_attrs: Created attribute array %d \n", Array);
+#endif
+
+    ret_value = Array; /* return array of attributes */
+
+done:
+    if (ret_value == NULL)
+      { /* Failure cleanup */
+          if (Array != NULL)
+              NC_free_array(Array);
+      }
+     /* Normal cleanup */
+    if (values != NULL)
+        HDfree(values);
+    if (attributes != NULL)
+        HDfree(attributes);
+
+    return ret_value;
+} /* hdf_read_attrs */
+
+/* ----------------------------------------------------------------
+** Read in the variables out of a cdf structure
+** Return FAIL if something goes wrong
+**
+** Important:  We must already assume that handle->dims is set
+**   so that we can do a call to NC_var_shape() so that we can
+**   set the numrecs fields of variables (so we can fill record
+**   variables intelligently)
+*/
+intn 
+hdf_read_vars(XDR *xdrs, 
+              NC *handle, 
+              int32 vg)
+{
+    char     vgname[H4_MAX_NC_NAME] = "";
+    char     subname[H4_MAX_NC_NAME] = "";
+    char     class[H4_MAX_NC_CLASS] = "";
+    NC_var **variables = NULL;
+    NC_var  *vp = NULL;
+    int      ndims, *dims = NULL;
+    uint8    ntstring[4];
+    int      data_ref, is_rec_var, vg_size, count;
+    int32    data_count;
+    int32    HDFtype = FAIL;
+    int32    tag;
+    int32    id;
+    int32    n;
+    int32    sub_id;
+    int32    entries;
+    int32    ndg_ref = 0;
+    int32    rag_ref = 0;
+    intn     nattrs;
+    hdf_vartype_t var_type = UNKNOWN;
+    register int     t, i;
+    register nc_type type;
+    register int32   var, sub;
+    intn     ret_value = SUCCEED;
+#ifdef LATER
+    CONSTR(FUNC,"hdf_read_vars"); 
+#endif /* LATER */
+
+    count = 0;
+    id = -1;
+
+#ifdef HDF_READ_VARS
+    fprintf(stderr, "hdf_read_vars: I've been called, handle->hdf_file = %d\n", handle->hdf_file);
+#endif
+
+    /*
+     * Allocate enough space in case everything is a variable
+     */
+    count = 0;
+    variables = (NC_var **) HDmalloc(sizeof(NC_var *) * Vntagrefs(vg) + 1);
+    if(NULL == variables) 
+      {
+#ifdef HDF_READ_VARS
+          fprintf(stderr, "hdf_read_vars:Out of memory line %d file %s\n", __LINE__, __FILE__);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /*
+     * Allocate enough space in case lots of dimensions
+     */
+    dims = (int *) HDmalloc(sizeof(int) * Vntagrefs(vg) + 1);
+    if(NULL == dims) 
+      {
+#ifdef HDF_READ_VARS
+          fprintf(stderr, "hdf_read_vars:Out of memory line %d file %s\n", __LINE__, __FILE__);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /*
+     * Look through for a Vgroup of class _HDF_VARIABLE
+     */
+    if ((vg_size = Vntagrefs(vg)) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    for(i = 0; i < vg_size; i++) 
+      {
+          if (Vgettagref(vg, i, &tag, &id) == FAIL)
+            {
+#ifdef HDF_READ_VARS
+                fprintf(stderr, "hdf_read_vars:Vgettagref failed\n");
+#endif
+                ret_value = FAIL;
+                goto done;
+            }
+
+          if(tag == DFTAG_VG) 
+            {
+                var = Vattach(handle->hdf_file, id, "r");
+                if(var == FAIL) 
+                    continue; /* isn't this bad? -GV */
+          
+                if (Vgetclass(var, class) == FAIL)
+                  {
+#ifdef HDF_READ_VARS
+                      fprintf(stderr, "hdf_read_vars:Vgetclass failed\n");
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+		/* Process as below if this VGroup represents a Variable or
+		   a Coordinate Variable */
+                if(!HDstrcmp(class, _HDF_VARIABLE))
+                  {
+              
+                      /*
+                       * We have found a VGroup representing a Variable or a
+		       * a Coordinate Variable
+                       */
+                      ndims = 0;
+                      type = NC_UNSPECIFIED;
+                      data_ref = 0;
+                      data_count = 0;
+                      rag_ref = 0;
+                      is_rec_var = FALSE;
+
+                      if (Vinquire(var, &n, vgname) == FAIL)
+                        {
+#ifdef HDF_READ_VARS
+                            fprintf(stderr, "hdf_read_vars:Vinquire failed\n");
+#endif
+                            ret_value = FAIL;
+                            goto done;
+                        }
+          
+                      /*
+                       * Loop through contents looking for dimensions
+                       */
+                      for (t = 0; t < n; t++) 
+                        {
+			    char dimclass[H4_MAX_NC_CLASS] = "";
+			    char vsclass[H4_MAX_NC_CLASS] = "";
+                            if (Vgettagref(var, t, &tag, &sub_id) == FAIL)
+                              {
+#ifdef HDF_READ_VARS
+                                  fprintf(stderr, "hdf_read_vars:Vgettagref failed\n");
+#endif
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            switch(tag) 
+                              {
+                              case DFTAG_VG :   /* ------ V G R O U P ---------- */
+                                  sub = Vattach(handle->hdf_file, sub_id, "r");
+                                  if (FAIL == sub)
+                                    {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:Vattach failed\n");
+#endif
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  if (FAIL == Vgetclass(sub, dimclass))
+                                    {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:Vgetclass failed\n");
+#endif
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  if(!HDstrcmp(dimclass, _HDF_DIMENSION) 
+                                     || !HDstrcmp(dimclass, _HDF_UDIMENSION)) 
+                                    {
+                          
+                                        if(!HDstrcmp(dimclass, _HDF_UDIMENSION))
+                                            is_rec_var = TRUE;
+                          
+                                        if (FAIL == Vinquire(sub, &entries, subname))
+                                          {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:Vinquire failed\n");
+#endif
+                                              ret_value = FAIL;
+                                              goto done;
+                                          }
+                          
+                                        dims[ndims] = (int) NC_dimid( handle, subname);
+                                        if (-1 == dims[ndims]) /* should change to FAIL */
+                                          {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:NC_dimid failed\n");
+#endif
+                                              ret_value = FAIL;
+                                              goto done;
+                                          }
+
+                                        ndims++;
+                                    }
+                                  if (FAIL == Vdetach(sub))
+                                    {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:Vdetach failed\n");
+#endif
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  break;
+                              case DFTAG_VH :   /* ----- V D A T A ----- */
+                                  sub = VSattach(handle->hdf_file, sub_id, "r");
+                                  if (FAIL == sub)
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  if (FAIL == VSgetclass(sub, vsclass))
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  if(!HDstrcmp(vsclass, _HDF_SDSVAR))
+                                        var_type = IS_SDSVAR;
+                                  else if(!HDstrcmp(vsclass, _HDF_CRDVAR))
+                                        var_type = IS_CRDVAR;
+                                  else
+                                        var_type = UNKNOWN;
+
+                                  if (FAIL == VSdetach(sub))
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  break;
+                              case DFTAG_NDG :  /* ----- NDG Tag for HDF 3.2 ----- */
+                                  ndg_ref = sub_id;
+                                  break;
+                              case DFTAG_SD :   /* ------- Data Storage ------ */
+                                  data_ref = sub_id;
+                                  /* Note: apparently Hlength will fail in certain cases, but
+                                           but this okay since I believe this is because 
+                                           the data does not exist yet in the file? 
+                                           So we can't catch this error -GV*/
+                                  data_count = Hlength(handle->hdf_file, DATA_TAG, sub_id);
+#ifdef HDF_READ_VARS
+                                  fprintf(stderr, "hdf_read_vars:Hlength returned %d\n",data_count);
+#endif
+
+                                  break;
+                              case DFTAG_SDRAG : /* ----- Ragged Array index ----- */
+                                  rag_ref = sub_id;
+#ifdef HDF_READ_VARS
+                                  printf("hdf_read_vars:Lookout!  Found a ragged array element\n");
+#endif
+                                  break;
+                              case DFTAG_NT :   /* ------- Number type ------- */
+                                  if(Hgetelement(handle->hdf_file, tag, sub_id, ntstring) == FAIL)
+                                    {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:Hgetlement failed\n");
+#endif
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  HDFtype = ntstring[1];
+                                  if ((type = hdf_unmap_type(HDFtype)) == FAIL)
+                                    {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr, "hdf_read_vars:hdf_unmap_teyp failed\n");
+#endif
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  /*
+                                   * Check if data was stored in native format
+                                   * And make sure the numbertype version numbers are the same
+                                   */
+                                  if((ntstring[0] != DFNT_VERSION) 
+                                     || ((ntstring[3] != DFNTF_NONE) 
+                                         && (ntstring[3] != DFNTF_IEEE))) 
+                                    {
+                          
+                                        /* check if in native mode for a different type of machine  or external data file is LITEND */
+                                        if (ntstring[3] == DFNTF_PC)
+                                            HDFtype |= DFNT_LITEND;
+                                        else
+                                          {
+                                              if(ntstring[3] != (uint8)DFKgetPNSC(HDFtype, DF_MT)) 
+                                                {
+                                                    /* 
+                                                     * OK, we have a problem here --- is in native mode
+                                                     * for a different machine.  PUNT
+                                                     */
+                                                    goto bad_number_type; /* GOTO */
+#ifdef HDF_READ_VARS
+                                                    fprintf(stderr, "hdf_read_vars: BAD number type \n");
+#endif
+                                                } 
+                                              else 
+                                                {
+                                                    /*
+                                                     * Is in native mode but its OK --- same machine type
+                                                     */
+                                                    HDFtype |= DFNT_NATIVE;
+                                                }
+                                          }
+                                    }
+                      
+                                  break;
+                              default:
+                                  /* Do nothing */
+                                  break;
+                              }
+                        }
+          
+                      variables[count] = NC_new_var(vgname, type, ndims, dims);
+		      /* BMR: put back hdf type that was set wrong by 
+			 NC_new_var; please refer to the cvs history of 
+			 bug #172 for reason on this statement - 4/17/2001 
+		      */
+		      variables[count]->HDFtype = HDFtype;
+
+                      vp = variables[count];
+                      if(NULL == vp) 
+                        {
+#ifdef HDF_READ_VARS
+                            fprintf(stderr, "hdf_read_vars:Can't read new variable %s\n", vgname);
+#endif
+                            ret_value = FAIL;
+                            goto done;
+                        }
+              
+#ifdef HDF_READ_VARS
+                      fprintf(stderr,"hdf_read_vars:Created a variable called %s   (id %d) \n", vgname, id);
+#endif
+                      /* Read in the attributes if any */
+                      if ((nattrs = hdf_num_attrs(handle, var)) > 0)
+                          vp->attrs = hdf_read_attrs(xdrs, handle, var);
+                      else
+                          vp->attrs = NULL;
+
+#ifdef HDF_READ_VARS
+                      fprintf(stderr,"hdf_read_vars:read in %d attributes \n",nattrs );
+#endif              
+                      /* set up for easy access later */
+                      vp->vgid     = id;
+                      vp->data_ref = data_ref;
+                      vp->data_tag = DATA_TAG;
+                      vp->HDFtype  = HDFtype;
+                      vp->ndg_ref  = (uint16) ndg_ref;
+                      vp->cdf = handle; /* for NC_var_shape */
+		      vp->var_type = var_type;
+
+                      /* need to process the ragged array info here */
+                      /* QUESTION:  Load the whole rag_fill list in now??????? */
+                      if(rag_ref) 
+                        {
+                            vp->is_ragged = TRUE;
+                        }
+              
+                      if(vp->data_ref) 
+                        {
+                            /*
+                             * We have already seen data for this variable so now
+                             *  we need to worry about its numrecs field
+                             */
+                  
+                            if(is_rec_var) 
+                              {
+                                  /*
+                                   * Call NC_var_shape() so we can figure out how many
+                                   *  records have been written.  This is horribly 
+                                   *  inefficient, but the separation-of-powers gets
+                                   *  really mucked up if we wait till later...
+                                   */
+                      
+                                  if(NC_var_shape(vp, handle->dims) == -1)
+                                    {
+#ifdef HDF_READ_VARS
+                                        fprintf(stderr,"hdf_read_vars:NC_var_shape failed \n" );
+#endif              
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                      
+                                  /*
+                                   * Now figure out how many recs have been written
+                                   * For a while there was a -1 at the end of this
+                                   *   equation.  I don't remember why its there
+                                   *   (4-Nov-93)
+                                   */
+                                  vp->numrecs = data_count / vp->dsizes[0];
+                      
+#ifdef HDF_READ_VARS
+                                  fprintf(stderr, "hdf_read_vars:I have set numrecs to %d\n", vp->numrecs);
+#endif                  
+                                  /*
+                                   * Deallocate the shape info as it will be recomputed
+                                   *  at a higher level later
+                                   */
+                                  if(vp->shape != NULL)
+                                      HDfree(vp->shape);
+                                  if(vp->dsizes != NULL)
+                                      HDfree(vp->dsizes);
+				  /* Reset these two pointers to NULL after 
+				     freeing.  BMR 4/11/01 */
+				  vp->shape = NULL;
+				  vp->dsizes = NULL;
+                              } 
+                            else 
+                              {
+                                  /* Not a rec var, don't worry about it */
+                                  vp->numrecs = 1;
+                              }
+                        }  /* end vp->data_ref */
+                      count++;
+                  } /* end if vgroup class is variable */
+
+bad_number_type: /* ? */
+          
+                if (FAIL == Vdetach(var))
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+            } /* end if DTAG_VG */
+      } /* end for vg_size */
+
+    /* create array of variables */
+    if(count)
+      {
+          handle->vars = NC_new_array(NC_VARIABLE, count, (Void *) variables);
+          if (NULL == handle->vars)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+    else
+        handle->vars = NULL;
+
+#ifdef HDF_READ_VARS
+    fprintf(stderr, "hdf_read_vars: Created variable array %d \n", handle->vars);
+#endif
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+#ifdef HDF_READ_VARS
+          fprintf(stderr, "hdf_read_vars: failed to created variable array \n");
+#endif
+
+          if (handle->vars != NULL)
+              NC_free_array(handle->vars);
+      }
+     /* Normal cleanup */
+    if (variables != NULL)
+        HDfree(variables);
+    if (dims != NULL)
+        HDfree(dims);
+
+    return ret_value;
+} /* hdf_read_vars */
+
+
+/* ----------------------------------------------------------------
+** Read in a cdf structure
+*/
+intn
+hdf_read_xdr_cdf(xdrs, handlep)
+XDR *xdrs;
+NC **handlep;
+{
+#if DEBUG
+  char            vgname[H4_MAX_NC_NAME];
+  int32           entries;
+#endif
+  register int32  cdf_vg = FAIL;
+  register int    vgid = 0;
+  int             status;
+#ifdef OLD_WAY
+  register int    found;
+  char            class[H4_MAX_NC_CLASS];
+#endif /* OLD_WAY */
+  CONSTR(FUNC,"hdf_read_xdr_cdf");
+  intn            ret_value = SUCCEED;
+
+#if DEBUG
+ fprintf(stderr, "hdf_read_xdr_cdf i've been called %d\n", (*handlep)->hdf_file);
+#endif
+
+#ifdef OLD_WAY
+  /* find first thing of type _HDF_CDF */
+  vgid = -1;
+  found = FALSE;
+  while(!found 
+        && ((vgid = Vgetid((*handlep)->hdf_file, vgid)) != FAIL)) 
+    {
+        cdf_vg = Vattach((*handlep)->hdf_file, vgid, "r");
+        if(cdf_vg == FAIL) 
+          {
+            HERROR(DFE_CANTATTACH);
+            ret_value = FAIL;
+            goto done;
+          }
+        if (Vgetclass(cdf_vg, class) == FAIL)
+          { 
+              ret_value = FAIl;
+              goto done;
+          }
+
+        if(!HDstrcmp(class, _HDF_CDF)) 
+            found = TRUE;
+        else 
+          {
+            if (Vdetach(cdf_vg) == FAIL)
+              { 
+                  ret_value = FAIL;
+                  goto done;
+              }
+          }
+    }
+
+
+  if(!found)
+    {
+      ret_value = FAIL;
+      goto done;
+    }
+  
+#else /* new way */
+
+    if((vgid = Vfindclass((*handlep)->hdf_file,_HDF_CDF))!=FAIL) 
+      {
+          cdf_vg = Vattach((*handlep)->hdf_file, vgid, "r");
+          if(cdf_vg == FAIL) 
+            {
+              HERROR(DFE_CANTATTACH);
+              ret_value = FAIL;
+              goto done;
+            }
+      } /* end if */
+    else
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+#endif /* new way */
+
+  (*handlep)->vgid = vgid; /* ref of vgroup */
+
+#if DEBUG
+  Vinquire(cdf_vg, &entries, vgname);
+  fprintf(stderr, "Found _HDF_CDF : %s  (%d entries)\n", vgname, entries);
+#endif
+
+  /* read in dimensions */
+  status = hdf_read_dims(xdrs, (*handlep), cdf_vg);
+  if(status == FAIL)
+    {
+        ret_value = FAIL;
+        goto done;
+    }
+
+  /* read in variables */
+  status = hdf_read_vars(xdrs, (*handlep), cdf_vg);
+  if(status == FAIL)
+    {
+        ret_value = FAIL;
+        goto done;
+    }
+
+  /* read in attributes */
+  if(hdf_num_attrs((*handlep), cdf_vg) > 0 )
+      (*handlep)->attrs = hdf_read_attrs(xdrs, (*handlep), cdf_vg);
+  else
+      (*handlep)->attrs = NULL;
+
+  /* deatch from cdf vgroup */
+  if (FAIL == Vdetach(cdf_vg))
+    {
+        ret_value = FAIL;
+        goto done;
+    }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+          if (cdf_vg != FAIL)
+              Vdetach(cdf_vg);
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_read_xdr_cdf */
+
+/* -------------------------------------------------------------------
+** Read or write a CDF structure
+**
+** If we are reading, first try to read the information out of netCDF
+**    object stored explicitly in HDF files as netCDF objects.  If
+**    that fails try to read SDSs out of the HDF file and interpret
+**    them as netCDF information.
+*/
+intn
+hdf_xdr_cdf(xdrs, handlep)
+XDR *xdrs;
+NC **handlep;
+{
+    CONSTR(FUNC,"hdf_xdr_cdf"); /* for HERROR */
+    intn status;
+    intn ret_value = SUCCEED;
+
+#ifdef HDF_XDR_CDF
+    fprintf(stderr, "hdf_xdr_cdf: i've been called op = %d \n", xdrs->x_op);
+#endif
+
+    switch(xdrs->x_op) 
+      {
+      case XDR_ENCODE :
+          if((*handlep)->vgid) 
+            {
+                if (FAIL == hdf_cdf_clobber((*handlep)))
+                  {
+                      ret_value = FAIL; 
+                      goto done;
+                  }
+            }
+          status = hdf_write_xdr_cdf(xdrs, handlep);
+          if (FAIL == status)
+            {
+#ifdef HDF_XDR_CDF
+                fprintf(stderr, "hdf_xdr_cdf: hdf_write_xdr_cdf failed \n");
+#endif
+                ret_value = FAIL;
+                goto done;
+            }
+          break;
+      case XDR_DECODE :
+          if(FAIL == (status = hdf_read_xdr_cdf(xdrs, handlep))) 
+            {
+#ifdef HDF_XDR_CDF
+                fprintf(stderr, "hdf_xdr_cdf: hdf_read_xdr_cdf failed \n");
+                fprintf(stderr,"               going to hdf_read_sds \n");
+#endif
+                status = hdf_read_sds_cdf(xdrs, handlep);
+                if(FAIL == status)
+                  {
+#ifdef HDF_XDR_CDF
+                      fprintf(stderr, "hdf_xdr_cdf: hdf_read_sds failed \n");
+#endif
+                      HERROR(DFE_BADNDG);
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            } /* end if */
+          break;
+      case XDR_FREE   :
+          if (FAIL == NC_free_cdf((*handlep)))
+              ret_value = FAIL;
+          else
+              ret_value = SUCCEED;
+          break;
+      default:
+          ret_value = FAIL;
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+     /* Normal cleanup */
+
+    return ret_value;  
+} /* hdf_xdr_cdf */
+
+/* ---------------------- hdf_vg_clobber --------------- */
+/*
+  Delete a VGroup that is on the disk.  Basically, we will want to
+  just trash everything inside of it, making sure that any VDatas
+  with class == DATA are saved
+*/
+intn 
+hdf_vg_clobber(handle, id)
+NC *handle;
+int id;
+{
+    int   t, n;
+    int32 vg, tag, ref;
+    int32 status;
+    intn  ret_value = SUCCEED;
+
+#ifdef HDF_VG_CLOBBER
+    fprintf(stderr, "hdf_vg_clobber: has been called for vgroup ref=%d\n",id);
+#endif
+
+    /* loop through and Clobber all top level VGroups */
+
+    /* attach to top level vgroup with read access */
+    vg = Vattach(handle->hdf_file, id, "r");
+    if(FAIL == vg) 
+      {
+#ifdef HDF_VG_CLOBBER
+          fprintf(stderr,"hdf_vg_clobber: Vattach failed for vgroup ref =%d\n",id);
+          HEprint(stderr,0);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get number of members in vgroup */
+    n = Vntagrefs(vg);
+    if (FAIL == n)
+      {
+#ifdef HDF_VG_CLOBBER
+          fprintf(stderr,"hdf_vg_clobber: Vntagrefs failed \n");
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Loop though and kill stuff */
+    for (t = 0; t < n; t++) 
+      {   /* get tag/ref of elment in vgroup */
+          if (FAIL == Vgettagref(vg, t, &tag, &ref))
+            {
+#ifdef HDF_VG_CLOBBER
+                fprintf(stderr,"hdf_vg_clobber: Vgettagref failed \n");
+#endif
+                ret_value = FAIL;
+                goto done;
+            }
+
+
+#ifdef HDF_VG_CLOBBER
+          fprintf(stderr, "hdf_vg_clobber: Looking at <%d, %d> in vgroup\n", tag, ref);
+#endif
+          /* switch on the type of element: vgroup, vdata, data, 
+             everyting else */
+          switch(tag) 
+            {
+            case DFTAG_VG : /* recursive call */
+#ifdef HDF_VG_CLOBBER
+                fprintf(stderr,"hdf_vg_clobber: found a vgroup ref %d in vgroup %d\n",ref,id);
+#endif
+                /* check if vgroup exists in file before trying to delete
+                   it's members */
+                if (vexistvg(handle->hdf_file, ref) != FAIL)
+                  {
+                      if (FAIL == hdf_vg_clobber(handle, ref))
+                        {
+#ifdef HDF_VG_CLOBBER
+                            fprintf(stderr,"hdf_vg_clobber: hdf_vg_clobber failed member whose vgroup ref=%d\n",ref);
+#endif
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+                break;
+            case DFTAG_VH :
+                /* check if vdata exists in file before trying to delete it */
+                if (vexistvs(handle->hdf_file, ref) != FAIL)
+                  {
+                      status = VSdelete(handle->hdf_file, (int32) ref);
+                      if (FAIL == status)
+                        {
+#ifdef HDF_VG_CLOBBER
+                            fprintf(stderr,"hdf_vg_clobber: VSdelete failed for vdata ref=%d\n",ref);
+#endif
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+#ifdef HDF_VG_CLOBBER
+                fprintf(stderr,"hdf_vg_clobber: VSdelete deleted vdata ref=%d\n",ref);
+#endif
+                break;
+            case DFTAG_SD :
+                /*
+                 * Don't delete actual numeric data
+                 * I guess this means we save it? -GV
+                 */
+                break;
+            default: /* delete other objects given tag/ref in file */
+                if (FAIL == Hdeldd(handle->hdf_file, (uint16) tag, (uint16) ref))
+                  {
+#ifdef HDF_VG_CLOBBER
+                      fprintf(stderr,"hdf_vg_clobber: Hdeldd failed \n");
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+#ifdef HDF_VG_CLOBBER
+                fprintf(stderr,"hdf_vg_clobber: Hdeldd deleted tag/ref=%d/%d\n",tag,ref);
+#endif
+                break;
+            }
+      }
+
+    ret_value = Vdetach(vg);
+
+#ifdef HDF_VG_CLOBBER
+    fprintf(stderr, "hdf_vg_clobber: Vdetach, ret_value=%d \n",ret_value);
+#endif
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+#ifdef HDF_VG_CLOBBER
+          fprintf(stderr, "hdf_vg_clobber: failed \n");
+#endif
+      }
+     /* Normal cleanup */
+
+    return ret_value;  
+} /* hdf_vg_clobber */
+
+
+/* --------------------------- hdf_cdf_clobber ---------------------------- */
+/*
+  Delete a netCDF structure that has been already written to disk
+*/
+intn 
+hdf_cdf_clobber(handle)
+NC *handle;
+{
+    int32  vg, tag, ref;
+    int    n, t, status;
+    intn   ret_value = SUCCEED;
+
+    if(!handle->vgid) 
+      { /* okay right? */
+          ret_value = SUCCEED; /* hmm...since ref of vgroup is zero? */
+          goto done;
+      }
+
+    /* Close open VData pointers */
+    if (FAIL == hdf_close(handle))
+      {
+#ifdef HDF_CDF_CLOBBER
+          fprintf(stderr,"hdf_cdf_clobber: hdf_close failed \n");
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+#ifdef HDF_CDF_CLOBBER
+    fprintf(stderr,"hdf_cdf_clobber: closed all open vdata handles \n");
+#endif
+
+    /* loop through and Clobber all top level VGroups */
+    vg = Vattach(handle->hdf_file, handle->vgid, "r");
+    if(vg == FAIL) 
+      {
+#ifdef HDF_CDF_CLOBBER
+          fprintf(stderr,"hdf_cdf_clobber: Vattach failed for vgroup ref=%d\n",
+                  handle->vgid);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get number of members of Vgroup */
+    n = Vntagrefs(vg);
+    if (FAIL == n)
+      {
+#ifdef HDF_CDF_CLOBBER
+          fprintf(stderr,"hdf_cdf_clobber: Vntagrefs failed \n");
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Loop though and just kill everyone */
+    for (t = 0; t < n; t++) 
+      {
+          if (FAIL == Vgettagref(vg, t, &tag, &ref))
+            {
+#ifdef HDF_CDF_CLOBBER
+                fprintf(stderr,"hdf_cdf_clobber: Vgettagref failed for vgroup %d\n",
+                        handle->vgid);
+#endif
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* if this member is a vgroup destroy everything in it */
+          if(tag == DFTAG_VG) 
+            {
+#ifdef HDF_CDF_CLOBBER
+                fprintf(stderr,"hdf_cdf_clobber: member of vgroup is a vgroup,");
+                fprintf(stderr,"deleteing everything in vgroup %d \n",ref);
+#endif
+                /* check if vgroup exists in file */
+                if (vexistvg(handle->hdf_file, ref) != FAIL)
+                  {
+                      hdf_vg_clobber(handle, ref);
+                  }
+            }
+
+          switch(tag) 
+            {
+            case DFTAG_VG:
+                status = Vdelete(handle->hdf_file, (int32) ref);
+                if (FAIL == status)
+                  {
+#ifdef HDF_CDF_CLOBBER
+                      fprintf(stderr,"hdf_cdf_clobber: Vdelete failed for vgroup %d\n",
+                              ref);
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+#ifdef HDF_CDF_CLOBBER
+                fprintf(stderr,"hdf_cdf_clobber: Vdelete deleted vgroup %d\n",
+                        ref);
+#endif
+                break;
+            case DFTAG_VH:
+                status = VSdelete(handle->hdf_file, (int32) ref);
+                if (FAIL == status)
+                  {
+#ifdef HDF_CDF_CLOBBER
+                      fprintf(stderr,"hdf_cdf_clobber: VSdelete failed for vdata %d\n",
+                              ref);
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+#ifdef HDF_CDF_CLOBBER
+                fprintf(stderr,"hdf_cdf_clobber: VSdelete deleted vdata %d\n",
+                        ref);
+#endif
+                break;
+            default:
+                status = Hdeldd(handle->hdf_file, (uint16) tag, (uint16) ref);
+                if (FAIL == status)
+                  {
+#ifdef HDF_CDF_CLOBBER
+                      fprintf(stderr,"hdf_cdf_clobber: Hdeldd failed for tag/ref %d/%d\n",
+                              tag,ref);
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+#ifdef HDF_CDF_CLOBBER
+                fprintf(stderr,"hdf_cdf_clobber: Hdeldd deleted tag/ref %d/%d\n",
+                        tag,ref);
+#endif
+                break;
+            } /* end switch tag */
+      }/* end for every member in vgroup */
+
+    if (FAIL == Vdetach(vg))
+      {
+#ifdef HDF_CDF_CLOBBER
+          fprintf(stderr,"hdf_cdf_clobber: Vdetach failed for vgroup %d\n",
+                  handle->vgid);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    status = Vdelete(handle->hdf_file, (int32) handle->vgid);
+    if (FAIL == status)
+      {
+#ifdef HDF_CDF_CLOBBER
+          fprintf(stderr,"hdf_cdf_clobber: Vdelete failed for vgroup %d\n",
+                  handle->vgid);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+#ifdef HDF_CDF_CLOBBER
+    fprintf(stderr,"hdf_cdf_clobber:Clobbering VGroup %d\n\n", handle->vgid);
+#endif
+
+    handle->vgid = 0; /* reset ref of SDS vgroup to invalid ref */
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+#ifdef HDF_CDF_CLOBBER
+        fprintf(stderr,"hdf_cdf_clobber: Failed to Clobber VGroup %d\n\n", handle->vgid);
+#endif
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;    
+} /* hdf_cdf_clobber */
+
+/* -------------------------- hdf_close --------------------- */
+/*
+  We're about to close the file, do last minute HDF cleanup
+  Also dump the number of records currently instatiated into the
+  unlimited dimensions.  
+
+  BUG:  All unlimited dimensions will have the same size
+
+BMR: handle->numrecs is used to write out the dim value for all unlimited
+     dimensions without checking for netCDF file as in other places where
+     vp->numrecs is used for HDF file and handle->numrecs is used for netCDF
+     file.  I believe this is what the "BUG:" comment above means.  6/24/2013
+*/
+intn 
+hdf_close(handle)
+    NC *handle;
+{
+    NC_array  *tmp = NULL;
+    NC_var   **vp = NULL;
+    Void      *vars = NULL;
+    register   int i;
+    int        id, sub_id;
+    int32      vg, dim;
+    int32      vs;
+    char       class[H4_MAX_NC_CLASS] = "";
+    intn       ret_value = SUCCEED;
+#ifdef LATER
+    CONSTR(FUNC,"hdf_close"); 
+#endif /* LATER */
+
+#ifdef HDF_CLOSE
+    fprintf(stderr,"hdf_close: I've been called\n");
+#endif
+    
+    /* loop through and detach from variable data VDatas */
+    if(handle->vars) 
+      {
+        tmp = handle->vars; 
+        vars = handle->vars->values;
+        
+        for(i = 0; i < tmp->count; i++) 
+          {
+            vp = (NC_var **) vars;
+
+            if((*vp)->aid != FAIL)
+              {
+                if (FAIL == Hendaccess((*vp)->aid))
+                  {
+#ifdef HDF_CLOSE
+                      fprintf(stderr,"hdf_close: Hendaccess failed for vdata aid %d\n",
+                              (*vp)->aid);
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+              }
+
+            (*vp)->aid = FAIL; /* reset access id */
+            vars += tmp->szof;
+          } /* end for each variable */
+      }
+    
+    /* loop through top level looking for unlimited dimensions.
+       we write them out? -GV */
+    if(handle->flags & NC_NDIRTY) 
+      {
+        id = -1;
+        vg = Vattach(handle->hdf_file, handle->vgid, "r");
+        if (FAIL == vg)
+          {
+#ifdef HDF_CLOSE
+              fprintf(stderr,"hdf_close: Vattach failed for vgroup ref %d\n",
+                      handle->vgid);
+#endif
+              ret_value = FAIL;
+              goto done;
+          }
+
+        /* go through vgroup hierachy */
+        while((id = Vgetnext(vg, id)) != FAIL) 
+          {
+            if(Visvg(vg, id)) 
+              {
+                dim = Vattach(handle->hdf_file, id, "r");
+                if (FAIL == dim)
+                  {
+#ifdef HDF_CLOSE
+                      fprintf(stderr,"hdf_close: Vattach failed for vgroup ref %d\n",
+                              id);
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+
+                if (FAIL == Vgetclass(dim, class))
+                  {
+#ifdef HDF_CLOSE
+                      fprintf(stderr,"hdf_close: Vgetclass failed for vgroup ref %d\n",
+                              id);
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                /* look for proper vgroup */
+                if(!HDstrcmp(class, _HDF_UDIMENSION)) 
+                  {
+                    sub_id = -1;
+                    /* look for vdata in vgroup */
+                    while((sub_id = Vgetnext(dim, sub_id)) != FAIL) 
+                      {
+                        if(Visvs(dim, sub_id)) 
+                          { /* yes, attach to vdata */
+                            vs = VSattach(handle->hdf_file, sub_id, "w");
+                            if(vs == FAIL) 
+                              {
+#ifdef HDF_CLOSE
+                                  fprintf(stderr,"hdf_close: VSattach failed for vdata ref %d\n",
+                                          sub_id);
+#endif
+                                  ret_value = FAIL;
+                                  goto done;
+                                  /* HEprint(stdout, 0); */
+                              }
+                            /* get class of vdata */
+                            if (FAIL == VSgetclass(vs, class))
+                              {
+#ifdef HDF_CLOSE
+                                  fprintf(stderr,"hdf_close: VSgetclass failed for vdata ref %d\n",
+                                          sub_id);
+#endif
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            /* are these dimension vdatas? */
+                            if(!HDstrcmp(class, DIM_VALS) 
+                               || !HDstrcmp(class, DIM_VALS01)) 
+                              { /* yes */
+                                int32 val = handle->numrecs;
+
+                                if (FAIL == VSsetfields(vs, "Values"))
+                                  {
+#ifdef HDF_CLOSE
+                                      fprintf(stderr,"hdf_close: VSsetfields failed for vdata ref %d\n",
+                                              sub_id);
+#endif
+                                      ret_value = FAIL;
+                                      goto done;
+                                  }
+
+                                if (FAIL == VSseek(vs, 0))
+                                  {
+#ifdef HDF_CLOSE
+                                      fprintf(stderr,"hdf_close: VSseek failed for vdata ref %d\n",
+                                              sub_id);
+#endif
+                                      ret_value = FAIL;
+                                      goto done;
+                                  }
+
+                                /* write out dimension vdatas? */
+                                if(VSwrite(vs, (uint8 *)&val, 1, FULL_INTERLACE) != 1)
+                                  {
+#ifdef HDF_CLOSE
+                                      fprintf(stderr,"hdf_close: VSwrite failed for vdata ref %d\n",
+                                              sub_id);
+#endif
+                                      ret_value = FAIL;
+                                      goto done;
+                                  }
+
+                            }
+
+                            /* detach from vdata */
+                            if (FAIL == VSdetach(vs))
+                              {
+#ifdef HDF_CLOSE
+                                  fprintf(stderr,"hdf_close: VSdetach failed for vdata ref %d\n",
+                                          sub_id);
+#endif
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                        } /* end if vdata */
+                    } /* end while looking for vdata in vgroup */
+                } /* end if UNLIMTED dimension vgroup */
+
+                if (FAIL == Vdetach(dim))
+                  {
+                      fprintf(stderr,"hdf_close: Vdetach failed for vgroup ref %d\n",
+                              id);
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+            }/* end if vgroup */
+        } /* end if looking through toplevel vgroup hierachy */
+
+        if (FAIL == Vdetach(vg))
+          {
+#ifdef HDF_CLOSE
+              fprintf(stderr,"hdf_close: Vdetach failed for vgroup ref %d\n",
+                      handle->vgid);
+#endif
+              ret_value = FAIL;
+              goto done;
+          }
+
+    } /* end if we need to flush out unlimited dimensions? */
+
+
+done:
+  if(ret_value == FAIL)   
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+  /* Normal function cleanup */
+  return ret_value;    
+} /* hdf_close */
+
+/*******************************************************************************/                
+#endif /* HDF */
+
+/*
+ * How much space will the xdr'd NC description take.
+ *
+ */
+int NC_xlen_cdf(cdf)
+NC *cdf ;
+{
+	int len = 8 ;
+
+	if(cdf == NULL)
+		return(0) ;
+
+	len += NC_xlen_array(cdf->dims) ;
+	len += NC_xlen_array(cdf->attrs) ;
+	len += NC_xlen_array(cdf->vars) ;
+
+	return(len) ;
+}
+
+
+#define RECPOS	4L 	/* seek index of numrecs value */
+bool_t
+xdr_numrecs(xdrs, handle)
+	XDR *xdrs;
+	NC *handle;
+{
+
+#ifdef HDF
+    if(handle->file_type == HDF_FILE) 
+        return TRUE; /* hmm...why? */
+#endif
+
+	if( (handle->flags & NC_NOFILL)
+		&& xdrs->x_op == XDR_ENCODE
+		&& handle->begin_rec > 0)
+      {
+          /*
+           * we need to write something just beyond the last 
+           * record so we can successfully read back the 
+           * entire last record.
+           */
+          if( !xdr_setpos(xdrs, handle->begin_rec
+                          +  handle->numrecs * handle->recsize) )
+            {
+                nc_serror("Can't set position to EOF") ;
+                return(FALSE) ;
+            }
+#ifdef RDEBUG
+          fprintf(stderr,"\txdr_numrecs %ld = %d + %ld * %d\n",
+                  xdr_getpos(xdrs), 
+                  handle->begin_rec, handle->numrecs, handle->recsize) ;
+#endif /*  RDEBUG */
+          if( !xdr_u_long(xdrs, &(handle->numrecs)) )
+              return(FALSE) ;
+      }
+
+	if( !xdr_setpos(xdrs, RECPOS) )
+      {
+          nc_serror("Can't set position to RECPOS") ;
+          return(FALSE) ;
+      }
+	return( xdr_u_long(xdrs, &(handle->numrecs)) ) ;
+}
+
+static bool_t
+xdr_4bytes(xdrs, cp)
+XDR *xdrs ;
+char *cp ; /* at least 4 valid bytes */
+{
+      return xdr_opaque(xdrs, cp, 4) ;
+}
+
+static bool_t
+xdr_2shorts(xdrs, sp)
+XDR *xdrs ;
+short *sp ; /* at least 2 valid shorts */
+{
+      return xdr_shorts(xdrs, sp, 2) ;
+}
+
+bool_t
+xdr_NC_fill(xdrs, vp)
+XDR *xdrs ;
+NC_var *vp ;
+{
+	char fillp[2*sizeof(double)] ;
+	bool_t stat ;
+	bool_t (*xdr_NC_fnct)() ;
+	u_long alen = vp->len ;
+	NC_attr **attr = NULL ;
+
+
+	/*
+	 * set up fill value
+	 */
+	/* start with the default */
+	NC_arrayfill((Void *)fillp, (size_t)2*sizeof(double),
+                 vp->type) ;
+
+	/* 
+	 * if there is a valid user defined value, use it instead
+	 */
+	attr = NC_findattr(&vp->attrs, _FillValue) ;
+	if( attr != NULL )
+      {
+          if( (*attr)->data->type != vp->type || (*attr)->data->count != 1 )
+              NCadvise(NC_EBADTYPE, "var %s: _FillValue type mismatch",
+                       vp->name->values) ;
+          else
+            {
+                int len = NC_typelen(vp->type) ;
+                char *cp = fillp ;
+                while(cp < &fillp[sizeof(fillp) -1])
+                  {
+                      NC_copy_arrayvals(cp, (*attr)->data) ;
+                      cp += len ;
+                  }
+            }
+      }
+
+    switch(vp->type){
+    case NC_BYTE :
+    case NC_CHAR :
+        alen /= 4 ;
+        xdr_NC_fnct = xdr_4bytes ;
+        break ;
+    case NC_SHORT :
+        alen /= 4 ;
+        xdr_NC_fnct = xdr_2shorts ;
+        break ;
+    case NC_LONG :
+        alen /= 4 ;
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ 
+        xdr_NC_fnct = xdr_int ;
+#else
+        xdr_NC_fnct = xdr_long ;
+#endif
+        break ;	
+    case NC_FLOAT :
+        alen /= 4 ;
+        xdr_NC_fnct = xdr_float ;
+        break ;
+    case NC_DOUBLE : 
+        alen /= 8 ;
+        xdr_NC_fnct = xdr_double ;
+        break ;
+    default :
+        NCadvise(NC_EBADTYPE, "bad type %d", vp->type) ;
+        return(FALSE) ;
+    }
+
+    /* write out fill values */
+    for(stat = TRUE ; stat && (alen > 0) ; alen--)
+      {
+          stat = (*xdr_NC_fnct)(xdrs,fillp) ;	
+      }
+
+    if(!stat)
+      {
+          NCadvise(NC_EXDR, "xdr_NC_fill") ;
+          return(FALSE) ;
+      }
+		
+    return(TRUE) ;
+}
+
diff --git a/mfhdf/libsrc/depend b/mfhdf/libsrc/depend
new file mode 100644
index 0000000..67874ec
--- /dev/null
+++ b/mfhdf/libsrc/depend
@@ -0,0 +1,298 @@
+array.o: array.c
+array.o: local_nc.h
+array.o: netcdf.h
+array.o: ../../hdf/src//hlimits.h
+array.o: ../../hdf/src//hdf.h
+array.o: ../../hdf/src//hdfi.h
+array.o: ../../hdf/src//hntdefs.h
+array.o: ../../hdf/src//htags.h
+array.o: ../../hdf/src//hbitio.h
+array.o: ../../hdf/src//hcomp.h
+array.o: ../../hdf/src//herr.h
+array.o: ../../hdf/src//hproto.h
+array.o: ../../hdf/src//vg.h
+array.o: ../../hdf/src//hfile.h
+array.o: ../../hdf/src//tbbt.h
+array.o: alloc.h
+attr.o: attr.c
+attr.o: local_nc.h
+attr.o: netcdf.h
+attr.o: ../../hdf/src//hlimits.h
+attr.o: ../../hdf/src//hdf.h
+attr.o: ../../hdf/src//hdfi.h
+attr.o: ../../hdf/src//hntdefs.h
+attr.o: ../../hdf/src//htags.h
+attr.o: ../../hdf/src//hbitio.h
+attr.o: ../../hdf/src//hcomp.h
+attr.o: ../../hdf/src//herr.h
+attr.o: ../../hdf/src//hproto.h
+attr.o: ../../hdf/src//vg.h
+attr.o: ../../hdf/src//hfile.h
+attr.o: ../../hdf/src//tbbt.h
+attr.o: alloc.h
+cdf.o: cdf.c
+cdf.o: local_nc.h
+cdf.o: netcdf.h
+cdf.o: ../../hdf/src//hlimits.h
+cdf.o: ../../hdf/src//hdf.h
+cdf.o: ../../hdf/src//hdfi.h
+cdf.o: ../../hdf/src//hntdefs.h
+cdf.o: ../../hdf/src//htags.h
+cdf.o: ../../hdf/src//hbitio.h
+cdf.o: ../../hdf/src//hcomp.h
+cdf.o: ../../hdf/src//herr.h
+cdf.o: ../../hdf/src//hproto.h
+cdf.o: ../../hdf/src//vg.h
+cdf.o: ../../hdf/src//hfile.h
+cdf.o: ../../hdf/src//tbbt.h
+cdf.o: alloc.h
+cdftest.o: cdftest.c
+cdftest.o: netcdf.h
+cdftest.o: ../../hdf/src//hlimits.h
+cdftest.o: ../../hdf/src//hdf.h
+cdftest.o: ../../hdf/src//hdfi.h
+cdftest.o: ../../hdf/src//hntdefs.h
+cdftest.o: ../../hdf/src//htags.h
+cdftest.o: ../../hdf/src//hbitio.h
+cdftest.o: ../../hdf/src//hcomp.h
+cdftest.o: ../../hdf/src//herr.h
+cdftest.o: ../../hdf/src//hproto.h
+dim.o: dim.c
+dim.o: local_nc.h
+dim.o: netcdf.h
+dim.o: ../../hdf/src//hlimits.h
+dim.o: ../../hdf/src//hdf.h
+dim.o: ../../hdf/src//hdfi.h
+dim.o: ../../hdf/src//hntdefs.h
+dim.o: ../../hdf/src//htags.h
+dim.o: ../../hdf/src//hbitio.h
+dim.o: ../../hdf/src//hcomp.h
+dim.o: ../../hdf/src//herr.h
+dim.o: ../../hdf/src//hproto.h
+dim.o: ../../hdf/src//vg.h
+dim.o: ../../hdf/src//hfile.h
+dim.o: ../../hdf/src//tbbt.h
+dim.o: alloc.h
+error.o: error.c
+error.o: local_nc.h
+error.o: netcdf.h
+error.o: ../../hdf/src//hlimits.h
+error.o: ../../hdf/src//hdf.h
+error.o: ../../hdf/src//hdfi.h
+error.o: ../../hdf/src//hntdefs.h
+error.o: ../../hdf/src//htags.h
+error.o: ../../hdf/src//hbitio.h
+error.o: ../../hdf/src//hcomp.h
+error.o: ../../hdf/src//herr.h
+error.o: ../../hdf/src//hproto.h
+error.o: ../../hdf/src//vg.h
+error.o: ../../hdf/src//hfile.h
+error.o: ../../hdf/src//tbbt.h
+file.o: file.c
+file.o: local_nc.h
+file.o: netcdf.h
+file.o: ../../hdf/src//hlimits.h
+file.o: ../../hdf/src//hdf.h
+file.o: ../../hdf/src//hdfi.h
+file.o: ../../hdf/src//hntdefs.h
+file.o: ../../hdf/src//htags.h
+file.o: ../../hdf/src//hbitio.h
+file.o: ../../hdf/src//hcomp.h
+file.o: ../../hdf/src//herr.h
+file.o: ../../hdf/src//hproto.h
+file.o: ../../hdf/src//vg.h
+file.o: ../../hdf/src//hfile.h
+file.o: ../../hdf/src//tbbt.h
+file.o: alloc.h
+globdef.o: globdef.c
+globdef.o: netcdf.h
+globdef.o: ../../hdf/src//hlimits.h
+hdfsds.o: hdfsds.c
+hdfsds.o: local_nc.h
+hdfsds.o: netcdf.h
+hdfsds.o: ../../hdf/src//hlimits.h
+hdfsds.o: ../../hdf/src//hdf.h
+hdfsds.o: ../../hdf/src//hdfi.h
+hdfsds.o: ../../hdf/src//hntdefs.h
+hdfsds.o: ../../hdf/src//htags.h
+hdfsds.o: ../../hdf/src//hbitio.h
+hdfsds.o: ../../hdf/src//hcomp.h
+hdfsds.o: ../../hdf/src//herr.h
+hdfsds.o: ../../hdf/src//hproto.h
+hdfsds.o: ../../hdf/src//vg.h
+hdfsds.o: ../../hdf/src//hfile.h
+hdfsds.o: ../../hdf/src//tbbt.h
+hdftest.o: hdftest.c
+hdftest.o: mfhdf.h
+hdftest.o: local_nc.h
+hdftest.o: netcdf.h
+hdftest.o: ../../hdf/src//hlimits.h
+hdftest.o: ../../hdf/src//hdf.h
+hdftest.o: ../../hdf/src//hdfi.h
+hdftest.o: ../../hdf/src//hntdefs.h
+hdftest.o: ../../hdf/src//htags.h
+hdftest.o: ../../hdf/src//hbitio.h
+hdftest.o: ../../hdf/src//hcomp.h
+hdftest.o: ../../hdf/src//herr.h
+hdftest.o: ../../hdf/src//hproto.h
+hdftest.o: ../../hdf/src//vg.h
+hdftest.o: ../../hdf/src//hfile.h
+hdftest.o: ../../hdf/src//tbbt.h
+iarray.o: iarray.c
+iarray.o: local_nc.h
+iarray.o: netcdf.h
+iarray.o: ../../hdf/src//hlimits.h
+iarray.o: ../../hdf/src//hdf.h
+iarray.o: ../../hdf/src//hdfi.h
+iarray.o: ../../hdf/src//hntdefs.h
+iarray.o: ../../hdf/src//htags.h
+iarray.o: ../../hdf/src//hbitio.h
+iarray.o: ../../hdf/src//hcomp.h
+iarray.o: ../../hdf/src//herr.h
+iarray.o: ../../hdf/src//hproto.h
+iarray.o: ../../hdf/src//vg.h
+iarray.o: ../../hdf/src//hfile.h
+iarray.o: ../../hdf/src//tbbt.h
+iarray.o: alloc.h
+mfsd.o: mfsd.c
+mfsd.o: mfhdf.h
+mfsd.o: local_nc.h
+mfsd.o: netcdf.h
+mfsd.o: ../../hdf/src/trace.h
+mfsd.o: ../../hdf/src//hlimits.h
+mfsd.o: ../../hdf/src//hdf.h
+mfsd.o: ../../hdf/src//hdfi.h
+mfsd.o: ../../hdf/src//hntdefs.h
+mfsd.o: ../../hdf/src//htags.h
+mfsd.o: ../../hdf/src//hbitio.h
+mfsd.o: ../../hdf/src//hcomp.h
+mfsd.o: ../../hdf/src//herr.h
+mfsd.o: ../../hdf/src//hproto.h
+mfsd.o: ../../hdf/src//vg.h
+mfsd.o: ../../hdf/src//hfile.h
+mfsd.o: ../../hdf/src//tbbt.h
+nssdc.o: nssdc.c
+nssdc.o: local_nc.h
+nssdc.o: netcdf.h
+nssdc.o: ../../hdf/src//hlimits.h
+nssdc.o: ../../hdf/src//hdf.h
+nssdc.o: ../../hdf/src//hdfi.h
+nssdc.o: ../../hdf/src//hntdefs.h
+nssdc.o: ../../hdf/src//htags.h
+nssdc.o: ../../hdf/src//hbitio.h
+nssdc.o: ../../hdf/src//hcomp.h
+nssdc.o: ../../hdf/src//herr.h
+nssdc.o: ../../hdf/src//hproto.h
+nssdc.o: ../../hdf/src//vg.h
+nssdc.o: ../../hdf/src//hfile.h
+nssdc.o: ../../hdf/src//tbbt.h
+putget.o: putget.c
+putget.o: local_nc.h
+putget.o: netcdf.h
+putget.o: ../../hdf/src//hlimits.h
+putget.o: ../../hdf/src//hdf.h
+putget.o: ../../hdf/src//hdfi.h
+putget.o: ../../hdf/src//hntdefs.h
+putget.o: ../../hdf/src//htags.h
+putget.o: ../../hdf/src//hbitio.h
+putget.o: ../../hdf/src//hcomp.h
+putget.o: ../../hdf/src//herr.h
+putget.o: ../../hdf/src//hproto.h
+putget.o: ../../hdf/src//vg.h
+putget.o: ../../hdf/src//hfile.h
+putget.o: ../../hdf/src//tbbt.h
+putget.o: alloc.h
+putgetg.o: putgetg.c
+putgetg.o: local_nc.h
+putgetg.o: netcdf.h
+putgetg.o: ../../hdf/src//hlimits.h
+putgetg.o: ../../hdf/src//hdf.h
+putgetg.o: ../../hdf/src//hdfi.h
+putgetg.o: ../../hdf/src//hntdefs.h
+putgetg.o: ../../hdf/src//htags.h
+putgetg.o: ../../hdf/src//hbitio.h
+putgetg.o: ../../hdf/src//hcomp.h
+putgetg.o: ../../hdf/src//herr.h
+putgetg.o: ../../hdf/src//hproto.h
+putgetg.o: ../../hdf/src//vg.h
+putgetg.o: ../../hdf/src//hfile.h
+putgetg.o: ../../hdf/src//tbbt.h
+sharray.o: sharray.c
+sharray.o: local_nc.h
+sharray.o: netcdf.h
+sharray.o: ../../hdf/src//hlimits.h
+sharray.o: ../../hdf/src//hdf.h
+sharray.o: ../../hdf/src//hdfi.h
+sharray.o: ../../hdf/src//hntdefs.h
+sharray.o: ../../hdf/src//htags.h
+sharray.o: ../../hdf/src//hbitio.h
+sharray.o: ../../hdf/src//hcomp.h
+sharray.o: ../../hdf/src//herr.h
+sharray.o: ../../hdf/src//hproto.h
+sharray.o: ../../hdf/src//vg.h
+sharray.o: ../../hdf/src//hfile.h
+sharray.o: ../../hdf/src//tbbt.h
+sharray.o: alloc.h
+string.o: string.c
+string.o: local_nc.h
+string.o: netcdf.h
+string.o: ../../hdf/src//hlimits.h
+string.o: ../../hdf/src//hdf.h
+string.o: ../../hdf/src//hdfi.h
+string.o: ../../hdf/src//hntdefs.h
+string.o: ../../hdf/src//htags.h
+string.o: ../../hdf/src//hbitio.h
+string.o: ../../hdf/src//hcomp.h
+string.o: ../../hdf/src//herr.h
+string.o: ../../hdf/src//hproto.h
+string.o: ../../hdf/src//vg.h
+string.o: ../../hdf/src//hfile.h
+string.o: ../../hdf/src//tbbt.h
+string.o: alloc.h
+var.o: var.c
+var.o: local_nc.h
+var.o: netcdf.h
+var.o: ../../hdf/src//hlimits.h
+var.o: ../../hdf/src//hdf.h
+var.o: ../../hdf/src//hdfi.h
+var.o: ../../hdf/src//hntdefs.h
+var.o: ../../hdf/src//htags.h
+var.o: ../../hdf/src//hbitio.h
+var.o: ../../hdf/src//hcomp.h
+var.o: ../../hdf/src//herr.h
+var.o: ../../hdf/src//hproto.h
+var.o: ../../hdf/src//vg.h
+var.o: ../../hdf/src//hfile.h
+var.o: ../../hdf/src//tbbt.h
+var.o: alloc.h
+xdrposix.o: xdrposix.c
+xdrposix.o: netcdf.h
+xdrposix.o: ../../hdf/src//hlimits.h
+xdrposix.o: local_nc.h
+xdrposix.o: ../../hdf/src//hdf.h
+xdrposix.o: ../../hdf/src//hdfi.h
+xdrposix.o: ../../hdf/src//hntdefs.h
+xdrposix.o: ../../hdf/src//htags.h
+xdrposix.o: ../../hdf/src//hbitio.h
+xdrposix.o: ../../hdf/src//hcomp.h
+xdrposix.o: ../../hdf/src//herr.h
+xdrposix.o: ../../hdf/src//hproto.h
+xdrposix.o: ../../hdf/src//vg.h
+xdrposix.o: ../../hdf/src//hfile.h
+xdrposix.o: ../../hdf/src//tbbt.h
+xdrposix.o: mfhdf.h
+xdrstdio.o: xdrstdio.c
+xdrstdio.o: local_nc.h
+xdrstdio.o: netcdf.h
+xdrstdio.o: ../../hdf/src//hlimits.h
+xdrstdio.o: ../../hdf/src//hdf.h
+xdrstdio.o: ../../hdf/src//hdfi.h
+xdrstdio.o: ../../hdf/src//hntdefs.h
+xdrstdio.o: ../../hdf/src//htags.h
+xdrstdio.o: ../../hdf/src//hbitio.h
+xdrstdio.o: ../../hdf/src//hcomp.h
+xdrstdio.o: ../../hdf/src//herr.h
+xdrstdio.o: ../../hdf/src//hproto.h
+xdrstdio.o: ../../hdf/src//vg.h
+xdrstdio.o: ../../hdf/src//hfile.h
+xdrstdio.o: ../../hdf/src//tbbt.h
diff --git a/mfhdf/libsrc/dim.c b/mfhdf/libsrc/dim.c
new file mode 100644
index 0000000..75279a8
--- /dev/null
+++ b/mfhdf/libsrc/dim.c
@@ -0,0 +1,369 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: dim.c 5584 2011-04-13 18:25:06Z bmribler $ */
+
+#include	<string.h>
+#include	"local_nc.h"
+#include	"alloc.h"
+
+
+NC_dim *
+NC_new_dim(name,size)
+const char *name ;
+long size ;
+{
+	NC_dim *ret ;
+
+	ret = (NC_dim *)HDmalloc(sizeof(NC_dim)) ;
+	if( ret == NULL )
+		goto alloc_err ;
+
+	ret->name = NC_new_string((unsigned)strlen(name),name) ;
+	if( ret->name == NULL)
+		goto alloc_err ;
+
+	ret->size = size ;
+#ifdef HDF
+        ret->vgid = 0;	/* no vgroup representing this dimension yet -BMR 2010/12/29 */
+        ret->count = 1;
+/*        ret->dim00_compat = (size == NC_UNLIMITED)? 0 : 1;  */
+        ret->dim00_compat = 0;
+#endif /* HDF */
+	return(ret) ;
+alloc_err :
+	nc_serror("NC_new_dim") ;
+	return(NULL) ;
+}
+
+
+/*
+ * Free dim
+ *
+ * NOTE: Changed return value to return 'int' 
+ *       If successful returns SUCCEED else FAIL -GV 9/19/97
+ */
+int
+NC_free_dim(dim)
+NC_dim *dim ;
+{
+    int ret_value = SUCCEED;
+
+	if(dim != NULL)
+      {
+#ifdef HDF
+          if (dim->count > 1)
+            {
+                dim->count -=  1;
+                ret_value = SUCCEED;
+                goto done;
+            }
+#endif /* HDF */
+
+          if (NC_free_string(dim->name) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          Free(dim) ;
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+
+
+int ncdimdef(cdfid, name, size)
+int cdfid ;
+const char *name ;
+long size ;
+{
+	NC *handle ;
+	NC_dim *dim[1] ;
+	NC_dim **dp ;
+	unsigned ii ;
+	size_t len ;
+
+	cdf_routine_name = "ncdimdef" ;
+
+	if( !NC_indefine(cdfid,TRUE) )
+		return(-1) ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+	if(size < 0) /* NC_UNLIMITED #define'd as 0 */
+	{
+		NCadvise(NC_EINVAL, "Invalid size %d", size) ;
+		return(-1) ;
+	}
+
+	if(handle->dims == NULL) /* first time */
+	{
+		dim[0] = NC_new_dim(name, size) ;
+		if(dim[0] == NULL)
+			return(-1) ;
+		handle->dims = NC_new_array(NC_DIMENSION,(unsigned)1,
+			(Void *)dim) ;
+		if(handle->dims == NULL)
+			return(-1) ;
+	} else if(handle->dims->count >= H4_MAX_NC_DIMS)
+	{
+		NCadvise(NC_EMAXDIMS, "maximum number of dimensions %d exceeded",
+			handle->dims->count ) ;
+		return(-1) ;
+	} else {
+		/* check for name in use */
+		len = strlen(name) ;
+		dp = (NC_dim**)handle->dims->values ;
+		for(ii = 0 ; ii < handle->dims->count ; ii++, dp++)
+		{
+			if( len == (*dp)->name->len &&
+				strncmp(name, (*dp)->name->values, len) == 0)
+			{
+				NCadvise(NC_ENAMEINUSE, "dimension \"%s\" in use with index %d",
+					(*dp)->name->values, ii) ;
+				return(-1) ;
+			}
+			if((*dp)->size == NC_UNLIMITED && size == NC_UNLIMITED)
+			{
+				NCadvise(NC_EUNLIMIT, "NC_UNLIMITED size already in use: dimension \"%s\" (index %d)",
+					(*dp)->name->values, ii) ;
+				return(-1) ;
+			}
+		}
+
+		dim[0] = NC_new_dim(name, size) ;
+		if(dim[0] == NULL)
+			return(-1) ;
+		if( NC_incr_array(handle->dims, (Void *)dim) == NULL)
+			return(-1) ;
+	}
+	return(handle->dims->count -1) ;
+}
+
+int NC_dimid( handle, name)
+NC *handle;
+char *name;
+{
+  unsigned ii;
+  size_t len;
+  NC_dim **dp;
+
+  len = strlen(name) ;
+  dp = (NC_dim**)handle->dims->values ;
+  for(ii = 0 ; ii < handle->dims->count ; ii++, dp++)
+    {
+      if( len == (*dp)->name->len &&
+         strncmp(name, (*dp)->name->values, len) == 0)
+        return(ii) ;
+    }
+  NCadvise(NC_EBADDIM, "dim \"%s\" not found", name) ;
+  return(-1) ;
+}
+
+int ncdimid( cdfid, name)
+int cdfid ;
+const char *name ;
+{
+	NC *handle ;
+	NC_dim **dp ;
+	unsigned ii ;
+	size_t len ;
+
+	cdf_routine_name = "ncdimid" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(handle->dims == NULL)
+		return(-1) ;
+	len = strlen(name) ;
+	dp = (NC_dim**)handle->dims->values ;
+	for(ii = 0 ; ii < handle->dims->count ; ii++, dp++)
+	{
+            if( len == (*dp)->name->len &&
+               strncmp(name, (*dp)->name->values, len) == 0)
+                return(ii) ;
+	}
+	NCadvise(NC_EBADDIM, "dim \"%s\" not found", name) ;
+	return(-1) ;
+}
+
+
+int ncdiminq( cdfid, dimid, name, sizep)
+int cdfid ;
+int dimid ;
+char *name ;
+long *sizep ;
+{
+	NC *handle ;
+	NC_dim **dp ;
+
+	cdf_routine_name = "ncdiminq" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(handle->dims == NULL)
+		return(-1) ;
+	if(dimid >= handle->dims->count)
+		return(-1) ;
+
+	dp = (NC_dim**)handle->dims->values ;
+	dp += dimid ;
+
+	if(name != NULL)
+	{
+#ifdef HDF
+		(void)memcpy( name, (*dp)->name->values, 
+			(size_t)(*dp)->name->len) ;
+#else
+		(void)strncpy( name, (*dp)->name->values, 
+			(size_t)(*dp)->name->len) ;
+#endif
+		name[(*dp)->name->len] = 0 ;
+	}
+	if(sizep != 0)
+	{
+		if((*dp)->size == NC_UNLIMITED)
+			*sizep = handle->numrecs ;
+		else
+			*sizep = (*dp)->size ;	
+	}
+	return(dimid) ;
+}
+
+
+int ncdimrename(cdfid, dimid, newname)
+int cdfid ;
+int dimid ; 
+const char *newname ;
+{
+	
+	NC *handle ;
+	NC_dim **dp ;
+	NC_string *old, *new ;
+	unsigned ii ;
+	size_t len ;
+
+	cdf_routine_name = "ncdimrename" ;
+
+	handle = NC_check_id(cdfid) ;
+
+	if(handle == NULL)
+		return(-1) ;
+	if(!(handle->flags & NC_RDWR))
+		return(-1) ;
+	if(handle->dims == NULL)
+		return(-1) ;
+
+	/* check for name in use */
+	len = strlen(newname) ;
+	dp = (NC_dim**)handle->dims->values ;
+	for(ii = 0 ; ii < handle->dims->count ; ii++, dp++)
+	{
+		if( len == (*dp)->name->len  &&
+			strncmp(newname, (*dp)->name->values, len) == 0)
+		{
+			NCadvise(NC_ENAMEINUSE, "dimension \"%s\" in use with index %d",
+				(*dp)->name->values, ii) ;
+			return(-1) ;
+		}
+	}
+
+	dp = (NC_dim**)handle->dims->values ;
+	dp += dimid ;
+
+	old = (*dp)->name ;
+	if( NC_indefine(cdfid,FALSE) )
+	{
+		new = NC_new_string((unsigned)strlen(newname),newname) ;
+		if( new == NULL)
+			return(-1) ;
+		(*dp)->name = new ;
+		NC_free_string(old) ;
+		return(dimid) ;
+	} /* else */
+	new = NC_re_string(old, (unsigned)strlen(newname),newname) ;
+	if( new == NULL)
+		return(-1) ;
+	(*dp)->name = new ;
+	if(handle->flags & NC_HSYNC)
+	{
+		handle->xdrs->x_op = XDR_ENCODE ;
+		if(!xdr_cdf(handle->xdrs, &handle) )
+			return(-1) ;
+		handle->flags &= ~(NC_NDIRTY | NC_HDIRTY) ;
+	} else
+		handle->flags |= NC_HDIRTY ;
+	return(dimid) ;
+}
+
+
+bool_t
+xdr_NC_dim(xdrs, dpp)
+	XDR *xdrs;
+	NC_dim **dpp;
+{
+	if( xdrs->x_op == XDR_FREE)
+	{
+		NC_free_dim((*dpp)) ;
+		return(TRUE) ;
+	}
+
+	if( xdrs->x_op == XDR_DECODE )
+	{
+		*dpp = (NC_dim *)HDmalloc(sizeof(NC_dim)) ;
+		if( *dpp == NULL )
+		{
+			nc_serror("xdr_NC_dim") ;
+			return(FALSE) ;
+		}
+	}
+
+#ifdef HDF
+    /* hmm...what does this do? */
+    if( xdrs->x_op == XDR_DECODE )
+        (*dpp)->count = 0;
+#endif
+
+	if( !xdr_NC_string(xdrs, &((*dpp)->name)))
+		return(FALSE) ;
+	return( xdr_long(xdrs, &((*dpp)->size)) ) ;
+}
+
+
+/*
+ * How much space will the xdr'd dim take.
+ */
+int NC_xlen_dim(dpp)
+NC_dim **dpp ;
+{
+	int len = 4 ;
+	if(*dpp!=NULL)
+	{
+		len += NC_xlen_string((*dpp)->name) ;
+	}
+	return(len) ;
+}
diff --git a/mfhdf/libsrc/error.c b/mfhdf/libsrc/error.c
new file mode 100644
index 0000000..8a3e78c
--- /dev/null
+++ b/mfhdf/libsrc/error.c
@@ -0,0 +1,183 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: error.c,v 1.14 90/02/23 16:08:55 davis Exp */
+
+
+/* 
+ *   Utility Functions to implement consistant error logging
+ * mechanisms for netcdf
+ */
+
+/*LINTLIBRARY*/
+
+#ifdef NO_STDARG  /* The 4.0 release should be ANSI compliant */
+#undef NO_STDARG
+#endif
+
+#include	"local_nc.h"
+#include	<stdio.h>
+#ifndef NO_STDARG
+#include	<stdarg.h>
+#else
+/* try varargs instead */
+#include	<varargs.h>
+#endif /* !NO_STDARG */
+
+#include <errno.h>
+#if defined ERRNO_MISSING
+extern int errno;
+#endif
+
+#ifndef NO_STRERROR
+#include <string.h> /* contains prototype for ansi libc function strerror() */
+#else
+/* provide a strerror function for older unix systems */
+char *
+strerror(errnum)
+int errnum ;
+{
+	extern int sys_nerr;
+	extern const char * const sys_errlist[];
+
+	if (errnum < 0 || errnum >= sys_nerr)
+		return NULL ;
+
+	return (char *)sys_errlist[errnum] ;
+}
+#endif /* NO_STRERROR */
+
+
+#ifdef USE_doprnt_FOR_vfprintf
+/* 
+ * kludge for ze ancienne regieme
+ */
+vfprintf(stream, fmt, va_alist)
+     FILE *stream;
+     char *fmt;
+     va_dcl
+{
+
+  return _doprnt(fmt, va_alist, stream);
+
+}
+#endif
+
+
+/*
+ * Log SYSTEM errors
+ * Use where you would want to call perror(3).
+ * Calling sequence is
+ *	nc_serror(format, arg1, arg2,...)
+ * with zero or more args of types compatible with the associated format
+ * specifiers.  For example:
+ *         nc_serror("shutting down");
+ *	   nc_serror("can't open %s", file_name);
+ *         nc_serror("process %d in state %s",pid,state);
+ */
+void
+#ifndef NO_STDARG
+nc_serror(const char *fmt, ...)
+#else
+/*VARARGS1*/
+nc_serror(fmt, va_alist)
+     const char *fmt ;
+     va_dcl
+#endif /* !NO_STDARG */
+{
+    
+    if( ncopts & NC_VERBOSE ) {
+    	va_list args ;
+        static const char unknown[] = "Unknown Error";
+    	int errnum = errno;	/* save real errno in case we wipe it out */
+    	const char * cp;
+
+#ifndef NO_STDARG
+        va_start(args, fmt) ;
+#else
+        va_start(args) ;
+#endif /* !NO_STDARG */
+
+        (void) fprintf(stderr,"%s: ", cdf_routine_name);
+        (void) vfprintf(stderr,fmt,args) ;
+        va_end(args) ;
+        
+        switch(errnum) {
+	case 0 :
+            ncerr = NC_NOERR ;
+            (void) fputc('\n',stderr) ;
+            break ;
+            default :
+		ncerr = NC_SYSERR ;
+            (void) fprintf(stderr,": %s\n",
+                           (cp = strerror(errnum)) == NULL ? unknown : cp ) ;
+            break ;
+        }
+
+        (void) fflush(stderr);	/* to ensure log files are current */
+        errno = 0 ; /* ??? */
+    } /* NC_VERBOSE */
+    
+    if( ncopts & NC_FATAL ) {
+	exit(ncopts) ;
+    }
+}
+
+/*
+ * Like nc_serror above, but doesn't check for system error.
+ * Use for logging error conditions which are not system errors.
+ * Calling sequence is
+ *	NCadvise(ncerr, format, arg1, arg2,...)
+ * with zero or more args of types compatible with the associated format
+ * specifiers.  For example:
+ *         NCadvise(NC_NOERR, "just advice");
+ *         NCadvise(NC_EBADID, "%d is not a valid cdf id", cdfid);
+ */
+#ifndef NO_STDARG
+void
+NCadvise(int err, const char *fmt,...)
+#else
+/*VARARGS1*/
+void
+NCadvise(err, fmt, va_alist)
+     int err ;
+     const char *fmt ;
+     va_dcl
+#endif /* !NO_STDARG */
+{
+	va_list args ;
+
+	ncerr = err ;
+
+	if( ncopts & NC_VERBOSE )
+	{
+		(void) fprintf(stderr,"%s: ", cdf_routine_name);
+#ifndef NO_STDARG
+		va_start(args ,fmt) ;
+#else
+		va_start(args) ;
+#endif /* !NO_STDARG */
+		(void) vfprintf(stderr,fmt,args) ;
+		va_end(args) ;
+		(void) fputc('\n',stderr) ;
+		(void) fflush(stderr);	/* to ensure log files are current */
+	}
+
+	if( (ncopts & NC_FATAL) && ncerr != NC_NOERR )
+	{
+		exit(ncopts) ;
+	}
+}
diff --git a/mfhdf/libsrc/error.h b/mfhdf/libsrc/error.h
new file mode 100644
index 0000000..8812dc2
--- /dev/null
+++ b/mfhdf/libsrc/error.h
@@ -0,0 +1,31 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: error.h 5444 2010-08-25 16:40:05Z byrn $ */
+#ifndef _NC_ERROR_
+#define _NC_ERROR_
+
+#include "H4api_adpt.h"
+
+#ifndef NO_STDARG
+HDFLIBAPI void nc_serror(const char *fmt, ...) ;
+HDFLIBAPI void NCadvise(int err, const char *fmt,...) ;
+#else
+HDFLIBAPI void nc_serror() ;
+HDFLIBAPI void NCadvise() ;
+#endif /* NO_STDARG */
+
+#endif /* _NC_ERROR_ */
diff --git a/mfhdf/libsrc/file.c b/mfhdf/libsrc/file.c
new file mode 100644
index 0000000..b7aa3f3
--- /dev/null
+++ b/mfhdf/libsrc/file.c
@@ -0,0 +1,1176 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: file.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+#ifdef DEBUG
+#include <assert.h>
+#endif /* DEBUG */
+
+#include	<string.h>
+#include	<errno.h>
+#include	"local_nc.h"
+#include	"alloc.h"
+#include	"herr.h"
+
+/* obtain the maximum number of open files allowed, at the same time,
+   on the current system */
+#ifdef _WIN32
+#define MAX_SYS_OPENFILES	_getmaxstdio()
+#else
+#include <sys/resource.h>
+struct rlimit rlim;
+#define MAX_SYS_OPENFILES (                                     \
+        getrlimit((RLIMIT_NOFILE), (&rlim)),                    \
+        rlim.rlim_cur)
+#endif
+
+/* Maximum number of files can be opened at one time; subtract 3 from
+   the system allowed to account for stdin, stdout, and stderr */
+/* On AIX 6.1 system the limit is 2GB-1; it caused our library to choke.
+   For now we will use a cap H4_MAX_AVAIL_OPENFILES on the maximum number 
+   of files can be open at one time. This limit should probably
+   be in hlimits.h file in the future. EIP 2010-02-01*/
+
+#define H4_MAX_AVAIL_OPENFILES 20000
+#define MAX_AVAIL_OPENFILES  (((MAX_SYS_OPENFILES - 3) > H4_MAX_AVAIL_OPENFILES) ? H4_MAX_AVAIL_OPENFILES : (MAX_SYS_OPENFILES - 3)) 
+
+static int _curr_opened = 0 ; /* the number of files currently opened */
+/* NOTE: _ncdf might have been the number of files currently opened, yet it
+   is not decremented when ANY file is closed but only when the file that
+   has the same index as _ncdf-1 is closed.  Thus, it indicates the last
+   index in _cdfs intead of the number of files currently opened.  So, I 
+   added _curr_opened to keep track of the number of files currently opened. 
+   QAK suggested to use atom as in other interfaces and that would eliminate
+   similar issues.  - BMR - 11/03/07 */
+static int _ncdf = 0 ; /*  high water mark on open cdf's */
+static NC **_cdfs;
+
+#define HNDLE(id) (((id) >= 0 && (id) < _ncdf) ? _cdfs[(id)] : NULL)
+#define STASH(id) (((id) >= 0 && (id) < _ncdf) ?  \
+		HNDLE(_cdfs[(id)]->redefid) : NULL)
+
+#ifdef NO_STDC_REMOVE
+/* try unix 'unlink' */
+#define remove(fpath) unlink((fpath))
+#endif
+
+#ifdef DOS_FS
+#define SEP '\\' /* this separates path components on DOS */
+#endif
+#ifndef SEP
+#define SEP '/' /* default, unix */
+#endif
+
+static intn max_NC_open = H4_MAX_NC_OPEN;	/* current netCDF default */
+
+/*
+ * Resets _cdfs 
+ */
+static void
+ncreset_cdflist()
+{
+    if (_cdfs != NULL)
+    {
+	HDfree((VOIDP)_cdfs);
+	_cdfs = NULL;
+    }
+}
+
+/*
+ *  Allocates _cdfs and returns the allocated size if succeeds;
+ *  otherwise return FAIL(-1).
+ */
+intn
+NC_reset_maxopenfiles(req_max)
+intn req_max;	/* requested max to allocate */
+{
+	intn sys_limit = MAX_AVAIL_OPENFILES;
+	intn alloc_size;
+	NC **newlist;
+	intn i;
+	int ret_value = SUCCEED;
+
+        /* Verify arguments */
+        if (req_max < 0)
+        {
+            NCadvise(NC_EINVAL, "Invalid request: %d for maximum files", req_max);
+            HGOTO_DONE(-1) ;
+        }
+
+
+	/* If requested max is 0, allocate _cdfs with the default,
+	   max_NC_open, if _cdfs is not yet allocated, otherwise, keep 
+	   _cdfs as is and return the current max */
+	if (req_max == 0)
+	{
+	    if (!_cdfs)
+	    {
+		_cdfs = (NC **)HDmalloc(sizeof(NC *) * (max_NC_open));
+
+		/* If allocation fails, return 0 for no allocation */
+		if (_cdfs == NULL)
+		{
+		    /* NC_EINVAL is Invalid Argument, but must decide if
+		       we just want to return 0 without error or not */
+		    NCadvise(NC_EINVAL, "Unable to allocate a cdf list of %d elements", max_NC_open);
+		    HGOTO_DONE(-1) ;
+		}
+		else
+		    HGOTO_DONE(max_NC_open);
+	    }
+	    else  /* return the current limit */
+		HGOTO_DONE (max_NC_open);
+	} /* if req_max == 0 */
+
+	/* If the requested max is less than the current max but there are
+	   more than the requested max number of files opened, do not reset
+	   the current max, since this will cause information lost. */
+	if (req_max < max_NC_open && req_max <= _ncdf)
+	    HGOTO_DONE(max_NC_open);
+
+	/* If the requested max exceeds system limit, only allocate up
+	   to system limit */
+	if (req_max > sys_limit)
+	    alloc_size = sys_limit;
+	else
+	    alloc_size = req_max;
+
+	/* Allocate a new list */
+	newlist = (NC **)HDmalloc(sizeof(NC *) * alloc_size);
+
+	/* If allocation fails, return 0 for no allocation */
+	if (newlist == NULL)
+	{
+	    /* NC_EINVAL is Invalid Argument, but must decide if
+	       we just want to return 0 without error or not */
+	    NCadvise(NC_EINVAL, "Unable to allocate a cdf list of %d elements", alloc_size) ;
+	    HGOTO_DONE(-1) ;
+	}
+
+	/* If _cdfs is already allocated, transfer pointers over to the
+	   new list and deallocate the old list of pointers */
+	if (_cdfs != NULL)
+	{
+	    for (i=0; i < _ncdf; i++)
+		newlist[i] = _cdfs[i];
+	    HDfree(_cdfs);
+	}
+
+	/* Set _cdfs to the new list */
+	_cdfs = newlist;
+	newlist = NULL;
+
+	/* Reset current max files opened allowed in HDF to the new max */
+	max_NC_open = alloc_size;
+
+	HGOTO_DONE(max_NC_open);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+	/* Nothing yet. */
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* NC_reset_maxopenfiles */
+
+/*
+ *  Returns the current # of open files allowed
+ */
+intn
+NC_get_maxopenfiles()
+{
+	return(max_NC_open);
+} /* NC_get_maxopenfiles */
+
+/*
+ *  Returns the maximum number of open files the system allows.
+ */
+intn
+NC_get_systemlimit()
+{
+	return(MAX_AVAIL_OPENFILES);
+} /* NC_get_systemlimit */
+
+/*
+ *  Returns the number of files currently being opened.
+ */
+int
+NC_get_numopencdfs()
+{
+	return(_curr_opened);
+} /* NC_get_numopencdfs */
+
+/*
+ *  Check validity of cdf handle, return pointer to NC struct or
+ * NULL on error.
+ */
+NC *
+NC_check_id(cdfid)
+int cdfid ;
+{
+	NC *handle ;
+	
+	handle = ( cdfid >= 0 && cdfid < _ncdf) ? _cdfs[cdfid] : NULL ;
+	if(handle == NULL)
+	{
+		NCadvise(NC_EBADID, "%d is not a valid cdfid", cdfid) ;
+		return(NULL) ;
+	}
+	return(handle) ;
+}
+
+
+/*
+ *  Check to see if in define mode.
+ * If 'iserr' arg is true, advise.
+ */
+bool_t
+NC_indefine(cdfid, iserr) /* Should be a Macro ? */
+int cdfid ;
+bool_t iserr ;
+{
+	bool_t ret  ;
+	ret = (cdfid >= 0 && cdfid < _ncdf) ?
+		(bool_t)(_cdfs[cdfid]->flags & NC_INDEF) : FALSE ;
+	if(!ret && iserr)
+	{
+		if(cdfid < 0 || cdfid >= _ncdf)
+			NCadvise(NC_EBADID, "%d is not a valid cdfid", cdfid) ;
+		else
+			NCadvise(NC_ENOTINDEFINE, "%s Not in define mode",
+				_cdfs[cdfid]->path) ;
+	}
+	return(ret) ;
+}
+
+
+/*
+ *  Common code for ncopen and nccreate.
+ */
+static int
+NC_open(path, mode )
+const char	*path ;	/* file name */
+int mode ;
+{
+	NC *handle ;
+	int id;
+	intn cdfs_size;
+
+	/* Allocate _cdfs, if it is already allocated, nothing will be done */
+	if (_cdfs == NULL){
+	    if (FAIL == (cdfs_size = NC_reset_maxopenfiles(0)))
+	    {
+		NCadvise(NC_ENFILE, "Could not reset max open files limit");
+		return(-1); 
+	    }
+	}
+
+	/* find first available id */
+	for(id = 0 ; id < _ncdf; id++)
+		if( _cdfs[id] == NULL) break ;
+
+	/* if application attempts to open more files than the current max
+	   allows, increase the current max to the system limit, if it's 
+	   not at the system limit yet */
+	if(id == _ncdf && _ncdf >= max_NC_open)
+	{
+	    /* if the current max already reaches the system limit, fail */
+	    if (max_NC_open == MAX_AVAIL_OPENFILES)
+	    {
+		NCadvise(NC_ENFILE, "maximum number of open cdfs allowed already reaches system limit %d", MAX_AVAIL_OPENFILES) ;
+		return(-1); 
+	    }
+	    /* otherwise, increase the current max to the system limit */
+	    if (FAIL == NC_reset_maxopenfiles(MAX_AVAIL_OPENFILES))
+	    {
+		NCadvise(NC_ENFILE, "Could not reset max open files limit");
+		return(-1); 
+	    }
+	}
+
+	handle = NC_new_cdf(path, mode) ;
+	if( handle == NULL)
+        {
+	  /* if the failure was due to "too many open files," simply return */
+          if(errno == EMFILE)
+          {
+              nc_serror("maximum number of open files allowed has been reached\"%s\"", path) ;
+              return(-1);
+          }
+
+          if((mode & 0x0f) == NC_CLOBBER)
+            {
+		/* only attempt to remove the file if it's not currently 
+		   in use - bugzilla #376 */
+		if(!HPisfile_in_use(path))
+                    if( remove(path) != 0 )
+                	nc_serror("couldn't remove filename \"%s\"", path) ;
+            }
+          return(-1) ;
+      }
+
+	(void) strncpy(handle->path, path, FILENAME_MAX) ;
+	_cdfs[id] = handle ;
+	if(id == _ncdf)
+		_ncdf++ ;
+	_curr_opened++;
+	return(id) ;
+}
+
+
+int nccreate(path, cmode)
+const char	*path ;	/* file name */
+int 		cmode ;
+{
+	cdf_routine_name = "nccreate" ;
+
+	if(cmode & NC_CREAT)
+	{
+		return(NC_open(path, cmode)) ;
+	}
+	NCadvise(NC_EINVAL, "Bad Flag") ;
+	return(-1) ;
+}
+
+
+int ncopen(path,mode)
+const char	*path ;	/* file name */
+int 		mode ;
+{
+	cdf_routine_name = "ncopen" ;
+	if(mode & NC_CREAT)
+	{
+		NCadvise(NC_EINVAL, "Bad Flag") ;
+		return(-1) ;
+	}
+	return(NC_open(path, mode)) ;
+}
+
+
+int ncsync(id)
+int id ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncsync" ;
+
+	handle = NC_check_id(id) ; 
+	if(handle == NULL)
+		return(-1) ;
+
+	if( handle->flags & NC_INDEF )
+      {
+          NCadvise(NC_EINDEFINE, "Unfinished definition") ;
+          return(-1) ;
+      }
+
+	if(handle->flags & NC_RDWR)
+      {
+          handle->xdrs->x_op = XDR_ENCODE ;
+          if(handle->flags & NC_HDIRTY)
+            {
+                if(!xdr_cdf(handle->xdrs, &handle) )
+                    return(-1) ;
+                handle->flags &= ~(NC_NDIRTY | NC_HDIRTY) ;
+            }
+          else if(handle->flags & NC_NDIRTY)
+            {
+                if(!xdr_numrecs(handle->xdrs, handle) )
+                    return(-1) ;
+#ifdef HDF
+                if (handle->file_type != HDF_FILE)
+#endif
+                    handle->flags &= ~(NC_NDIRTY) ;
+            }
+      } 
+    else /* read only */
+      {
+          /* assert(handle->xdrs->x_op == XDR_DECODE) ; */
+          /* free the stuff in handle that xdr_cdf allocates */
+          handle->xdrs->x_op = XDR_FREE ;
+          (void) xdr_cdf(handle->xdrs, &handle) ;
+          handle->xdrs->x_op = XDR_DECODE ;
+ 
+          if(!xdr_cdf(handle->xdrs, &handle) )
+            {
+                nc_serror("xdr_cdf") ;
+                NC_free_cdf(handle) ; /* ?? what should we do now? */
+
+#if 0 /* not sure if we need this here, will check again - 1/26/08 BMR */
+		/* if the _cdf list is empty, deallocate and reset it to NULL */
+		if (_ncdf == 0)
+		    ncreset_cdflist();
+#endif
+                return(-1) ;
+            }
+          if( NC_computeshapes(handle) == -1)
+              return(-1) ;
+      }
+
+	(void) NCxdrfile_sync(handle->xdrs) ;
+
+	return(0) ;
+}
+
+
+/*
+ *  In data mode, same as ncclose ;
+ * In define mode, restore previous definition ;
+ * In create, remove the file ;
+ */
+int ncabort(cdfid)
+int cdfid ;
+{
+	NC *handle ;
+	char path[FILENAME_MAX + 1] ;
+	unsigned flags ;
+#ifdef HDF
+    intn   file_type;
+#endif
+
+	cdf_routine_name = "ncabort" ;
+
+
+	handle = NC_check_id(cdfid) ; 
+	if(handle == NULL)
+		return(-1) ;
+
+	flags = handle->flags ; /* need to save past free_cdf */
+
+	/* NC_CREAT implies NC_INDEF, in both cases need to remove handle->path */
+	if(flags & (NC_INDEF | NC_CREAT))
+        {
+          (void)strncpy(path, handle->path, FILENAME_MAX) ; /* stash path */
+          if(!(flags & NC_CREAT)) /* redef */
+            {
+                NC_free_cdf(STASH(cdfid)) ;
+
+                _cdfs[handle->redefid] = NULL ;
+                if(handle->redefid == _ncdf - 1)
+                    _ncdf-- ;
+                handle->redefid = -1 ;
+		_curr_opened--;	/* one less file currently opened */
+
+		/* if the _cdf list is empty, deallocate and reset it to NULL */
+		if (_ncdf == 0)
+		    ncreset_cdflist();
+            }
+        }
+	else if(handle->flags & NC_RDWR)
+        {
+          handle->xdrs->x_op = XDR_ENCODE ;
+          if(handle->flags & NC_HDIRTY)
+            {
+                if(!xdr_cdf(handle->xdrs, &handle) )
+                    return(-1) ;
+            }
+          else if(handle->flags & NC_NDIRTY)
+            {
+                if(!xdr_numrecs(handle->xdrs, handle) )
+                    return(-1) ;
+            }
+        }
+
+#ifdef HDF
+    file_type = handle->file_type;
+#endif
+	NC_free_cdf(handle) ; /* calls fclose */
+
+#ifdef HDF
+    switch(file_type) 
+      {
+      case netCDF_FILE:
+          if(flags & (NC_INDEF | NC_CREAT))
+            {
+                if( remove(path) != 0 )
+                    nc_serror("couldn't remove filename \"%s\"", path) ;
+            }
+          break;
+      case HDF_FILE:
+          if(flags & NC_CREAT)
+            {
+                if( remove(path) != 0 )
+                    nc_serror("couldn't remove filename \"%s\"", path) ;
+            }
+          break;
+      }
+#else
+    if(flags & (NC_INDEF | NC_CREAT))
+      {
+          if( remove(path) != 0 )
+              nc_serror("couldn't remove filename \"%s\"", path) ;
+      }
+#endif
+
+	_cdfs[cdfid] = NULL ; /* reset pointer */
+
+	/* if current file is at the top of the list, adjust the water mark */
+	if(cdfid == _ncdf - 1)
+	    _ncdf-- ;
+	_curr_opened--;	/* one less file currently being opened */
+
+	/* if the _cdf list is empty, deallocate and reset it to NULL */
+	if (_ncdf == 0)
+	    ncreset_cdflist();
+
+	return(0) ;
+} /* ncabort */
+
+
+/* 
+ * Deprecated function ;
+ */
+int ncnobuf(cdfid)
+int cdfid ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncnobuf" ;
+
+	handle = NC_check_id(cdfid) ; 
+	if(handle == NULL)
+		return(-1) ;
+/* NOOP */
+	return(0);
+}
+
+
+/*
+ * Given the path to a file "proto",
+ * we replace the filename component with
+ * a name like one would get from tmpnam(3S).
+ * (Many implementations of tmpnam insist on giving us
+ * a directory like /usr/tmp as well. Since we are making a copy which we
+ * will eventually rename() back to proto, we want the return of NCtempname
+ * and proto to dwell on the same filesystem.)
+ */
+static char *
+NCtempname(proto)
+const char *proto ;
+{
+/* NO_ACCESS defined if the OS lacks the access() function */
+#ifndef NO_ACCESS
+#	define TN_NACCES 1
+#else 
+#	define TN_NACCES 0
+#endif /* !NO_ACCESS */
+/* NO_GETPID defined if the OS lacks the getpid() function */
+#ifndef NO_GETPID
+#	define TN_NDIGITS 4
+#ifdef _WIN32
+	typedef int pid_t;
+#endif
+	pid_t getpid(void);
+	unsigned int pid ; /* OS/2 DOS (MicroSoft Lib) allows "negative" int pids */
+#else
+#	define TN_NDIGITS 0
+#endif /* !NO_GETPID */
+
+	static char seed[] = {'a','a','a', '\0'} ;
+#define TN_NSEED (sizeof(seed) -1)
+	static char tnbuf[FILENAME_MAX +1] ;
+	char *begin, *cp, *sp ;
+
+	/* assert(TN_NSEED > 0) ; */
+	strcpy(tnbuf,proto) ;
+
+#ifdef SEP
+	if ((begin = strrchr(tnbuf, SEP)) == NULL)
+		begin = tnbuf ;
+	else
+	    begin++ ;
+
+	if(&tnbuf[FILENAME_MAX] - begin <= TN_NSEED + TN_NACCES + TN_NDIGITS)
+      {
+          /* not big enough */
+          tnbuf[0] = '\0' ;
+          return tnbuf ;
+      }
+#else
+	begin = tnbuf ;
+#endif /* SEP */
+
+	*begin = '\0' ;
+	(void) strcat(begin, seed) ;
+
+	cp = begin + TN_NSEED + TN_NACCES + TN_NDIGITS ;
+#ifndef NO_GETPID
+	*cp = '\0' ;
+	pid = getpid() ;
+	while(--cp >= begin + TN_NSEED + TN_NACCES)
+      {
+          *cp = (pid % 10) + '0' ;
+          pid /= 10 ;
+      }
+#else
+	*cp-- = '\0' ;
+#endif /* !NO_GETPID */
+
+	/* update seed for next call */
+	sp = seed ;
+	while(*sp == 'z')
+		*sp++ = 'a' ;
+	if(*sp != '\0')
+		++*sp ;
+
+#ifndef NO_ACCESS
+	for(*cp = 'a' ; access(tnbuf, 0) == 0 ; )
+      {
+          if(++*cp > 'z')
+            {
+                /* ran out of tries */
+                tnbuf[0] = '\0' ;
+                return tnbuf ;
+            }
+      }
+#endif /* !NO_ACCESS */
+
+	return tnbuf ;
+}
+
+
+int ncredef(cdfid)
+int cdfid ;
+{
+	NC *handle ;
+	NC *new ;
+	int id ;
+	char *scratchfile ;
+
+	cdf_routine_name = "ncredef" ;
+
+	handle = NC_check_id(cdfid) ; 
+	if(handle == NULL)
+		return(-1) ;
+	if( handle->flags & NC_INDEF) /* in define mode already */
+      {
+          NC *stash = STASH(cdfid) ;
+          if(stash) NCadvise(NC_EINDEFINE, "%s: in define mode aleady",
+                             stash->path) ;
+          return(-1) ;
+      }
+	if(!(handle->flags & NC_RDWR))
+      {
+          NCadvise(NC_EPERM, "%s: NC_NOWRITE", handle->path) ;
+          return(-1) ;
+      }
+
+
+#ifdef HDF
+    if(handle->file_type == HDF_FILE) 
+      {
+          handle->flags |= NC_INDEF ;
+          handle->redefid = TRUE;
+          return(0);
+      }
+#endif
+
+	/* find first available id */
+	for(id = 0 ; id < _ncdf; id++)
+		if( _cdfs[id] == NULL) break ;
+
+	if(id == _ncdf && _ncdf >= max_NC_open) /* will need a new one */
+      {
+          NCadvise(NC_ENFILE, "maximum number of open cdfs %d exceeded",
+                   _ncdf) ;
+          return(-1) ;
+      }
+
+	if( ncopts & NC_NOFILL )
+      {
+          /* fill last record */
+          handle->xdrs->x_op = XDR_ENCODE ;
+          if(handle->flags & NC_NDIRTY)
+            {
+                if(!xdr_numrecs(handle->xdrs, handle) )
+                    return(-1) ;
+                handle->flags &= ~(NC_NDIRTY) ;
+            }
+      }
+
+	scratchfile = NCtempname(handle->path) ;
+
+	new = NC_dup_cdf(scratchfile, NC_NOCLOBBER, handle) ;
+	if(new == NULL)
+      {
+          return(-1) ;
+      }
+
+	handle->flags |= NC_INDEF ;
+	(void) strncpy(new->path, scratchfile, FILENAME_MAX) ;
+
+	/* put the old handle in the new id */
+	_cdfs[id] = handle ;
+	if(id == _ncdf)
+		_ncdf++ ;
+	_curr_opened++;
+
+	/* put the new handle in old id */
+	_cdfs[cdfid] = new ;
+
+	new->redefid = id ;
+
+	return(0) ;
+}
+
+
+/*
+ * Compute offsets and put into the header
+ */
+static void
+NC_begins(handle)
+NC *handle ;
+{
+	unsigned ii ;
+	u_long index = 0 ;
+	NC_var **vpp ;
+	NC_var *last = NULL ;
+
+	if(handle->vars == NULL) 
+		return ;
+
+	index = NC_xlen_cdf(handle) ;
+
+	/* loop thru vars, first pass is for the 'non-record' vars */
+	vpp = (NC_var **)handle->vars->values ;
+	for(ii = 0 ; ii < handle->vars->count ; ii++, vpp++)
+      {
+          if( IS_RECVAR(*vpp) )
+            {
+                continue ;	/* skip record variables on this pass */
+            }
+
+          (*vpp)->begin = index ;
+          index += (*vpp)->len ;
+#ifdef EDEBUG
+          NCadvise(NC_NOERR, "%s pass 1 begin %d, length %d",
+                   (*vpp)->name->values, (*vpp)->begin, (*vpp)->len) ;
+#endif /* EDEBUG */
+      }
+
+	handle->begin_rec = index ;
+	handle->recsize = 0 ;
+
+	/* loop thru vars, second pass is for the 'non-record' vars */
+	vpp = (NC_var **)handle->vars->values ;
+	for(ii = 0 ; ii < handle->vars->count ; ii++, vpp++)
+      {
+          if( !IS_RECVAR(*vpp) )
+            {
+                continue ;	/* skip non-record variables on this pass */
+            }
+
+          (*vpp)->begin = index ;
+#ifdef EDEBUG
+          NCadvise(NC_NOERR, "%s pass 2 begin %d, len %d, *dsizes %d",
+                   (*vpp)->name->values, (*vpp)->begin, index, (*vpp)->len, *(*vpp)->dsizes ) ;
+#endif /* EDEBUG */
+          index += (*vpp)->len ;
+          handle->recsize += (*vpp)->len ;
+          last = (*vpp) ;
+      }
+	/*
+	 * for special case of exactly one record variable, pack values
+	 */
+	if(last != NULL && handle->recsize == last->len)
+		handle->recsize = *last->dsizes ;
+	handle->numrecs = 0 ;
+}
+
+
+/*
+ * Copy nbytes bytes from source to target.
+ * Streams target and source should be positioned before the call.
+ * opaque I/O, no XDR conversion performed (or needed).
+ * The Macros XDR_GETBYTES and XDR_PUTBYTES may not be
+ * supported on your xdr implementation. If not, calls
+ * to xdr_opaque may be used.
+ */
+bool_t
+NC_dcpy( target, source, nbytes)
+XDR *target ;
+XDR *source ;
+long nbytes ;
+{
+/* you may wish to tune this: big on a cray, small on a PC? */
+#define NC_DCP_BUFSIZE 8192
+	char buf[NC_DCP_BUFSIZE] ;
+
+	while(nbytes > sizeof(buf))
+	{
+		if(!XDR_GETBYTES(source, buf, sizeof(buf)))
+			goto err ;
+		if(!XDR_PUTBYTES(target, buf, sizeof(buf)))
+			goto err ;
+		nbytes -= sizeof(buf) ;
+	}
+	/* we know nbytes <= sizeof(buf) at this point */
+	if(!XDR_GETBYTES(source, buf, nbytes))
+		goto err ;
+	if(!XDR_PUTBYTES(target, buf, nbytes))
+		goto err ;
+	return(TRUE) ;
+err:
+	NCadvise(NC_EXDR, "NC_dcpy") ;
+	return(FALSE) ;
+}
+
+
+/*
+ * XDR the data of varid in old, target is the new xdr strm
+ */
+static bool_t
+NC_vcpy( target, old, varid)
+XDR *target ;
+NC *old ;
+int varid ;
+{
+	NC_var **vpp ;
+	vpp = (NC_var **)old->vars->values ;
+	vpp += varid ;
+
+	if( !xdr_setpos(old->xdrs, (*vpp)->begin) )
+      {
+          NCadvise(NC_EXDR, "NC_vcpy: xdr_setpos") ;
+          return(FALSE) ;
+      }
+		
+	return(NC_dcpy(target, old->xdrs, (*vpp)->len)) ;
+}
+
+
+/*
+ * XDR the data of (varid, recnum) in old, target is the new xdr strm
+ */
+static bool_t
+NC_reccpy( target, old, varid, recnum)
+XDR *target ;
+NC *old ;
+int varid ;
+int recnum ;
+{
+	NC_var **vpp ;
+	vpp = (NC_var **)old->vars->values ;
+	vpp += varid ;
+
+	if( !xdr_setpos(old->xdrs,
+                    (*vpp)->begin + old->recsize*recnum )){
+		NCadvise(NC_EXDR, "NC_reccpy: xdr_setpos") ;
+		return(FALSE) ;
+	}
+	
+	return(NC_dcpy(target, old->xdrs, (*vpp)->len)) ;
+}
+
+
+/*
+ *  Common code for ncendef, ncclose(endef)
+ */
+static
+int NC_endef( cdfid, handle )
+int cdfid ;
+NC *handle ;
+{
+	XDR *xdrs ;
+	unsigned ii ;
+	unsigned jj = 0 ;
+	NC_var **vpp ;
+	NC *stash = STASH(cdfid) ; /* faster rvalue */
+
+#ifdef HDF
+    if(handle->file_type != HDF_FILE)
+#endif	
+        NC_begins(handle) ;
+
+	xdrs = handle->xdrs ;
+	xdrs->x_op = XDR_ENCODE ;
+
+	if(!xdr_cdf(xdrs, &handle) )
+      {
+          nc_serror("xdr_cdf") ;
+          return(-1) ;
+      }
+
+#ifdef HDF
+    /* Get rid of the temporary buffer allocated for I/O */
+    SDPfreebuf();
+
+    if(handle->file_type == HDF_FILE) 
+      {
+          handle->flags &= ~(NC_CREAT | NC_INDEF | NC_NDIRTY | NC_HDIRTY) ;
+          return(0) ;
+      }
+#endif	
+
+    if(handle->vars == NULL) 
+		goto done ;
+	
+	/* loop thru vars, first pass is for the 'non-record' vars */
+	vpp = (NC_var **)handle->vars->values ;
+	for(ii = 0 ; ii < handle->vars->count ; ii++, vpp++)
+      {
+          if( IS_RECVAR(*vpp) )
+            {
+                continue ;	/* skip record variables on this pass */
+            }
+
+#ifdef DEBUG
+          assert( (*vpp)->begin == xdr_getpos(xdrs) ) ;
+#endif /* DEBUG */
+
+          if( !(handle->flags & NC_CREAT) && stash->vars != NULL
+              && ii < stash->vars->count)
+            {
+                /* copy data */
+                if( !NC_vcpy(xdrs, stash, ii) )
+                    return(-1) ;
+                continue ;
+            } /* else */
+
+          if( !(handle->flags & NC_NOFILL) )
+              if( !xdr_NC_fill(xdrs, *vpp) )
+                  return(-1) ;
+      }
+
+	if(!(handle->flags & NC_CREAT)) /* after redefinition */
+      {
+          for(jj = 0 ; jj < stash->numrecs ; jj++)
+            {
+                vpp = (NC_var **)handle->vars->values ;
+                for(ii = 0 ; ii < handle->vars->count ; ii++, vpp++)
+                  {
+                      if( !IS_RECVAR(*vpp) )
+                        {
+                            continue ;	/* skip non-record variables on this pass */
+                        }
+                      if( stash->vars != NULL && ii < stash->vars->count)
+                        {
+                            /* copy data */
+                            if( !NC_reccpy(xdrs, stash, ii, jj) )
+                                return(-1) ;
+                            continue ;
+                        } /* else */
+                      if( !(handle->flags & NC_NOFILL) )
+                          if( !xdr_NC_fill(xdrs, *vpp) )
+                              return(-1) ;
+                  }
+            }
+          handle->numrecs = stash->numrecs ;
+          if(!xdr_numrecs(handle->xdrs, handle) )
+              return(-1) ;
+      }
+
+#ifdef EDEBUG
+	NCadvise(NC_NOERR, "begin %d, recsize %d, numrecs %d",
+             handle->begin_rec, handle->recsize, handle->numrecs) ;
+#endif /* EDEBUG */
+
+	if(!(handle->flags & NC_CREAT)) /* redefine */
+      {
+          char realpath[FILENAME_MAX + 1] ;
+          strcpy(realpath, stash->path) ;
+
+          /* close stash */
+/*                NC_free_cdf(stash) ; */
+#ifdef DOS_FS
+          xdr_destroy(handle->xdrs) ; /* close handle */
+          if( remove(realpath) != 0 )
+              nc_serror("couldn't remove filename \"%s\"", realpath) ;
+#endif
+          if( rename(handle->path, realpath) != 0)
+            {
+                nc_serror("rename %s -> %s failed", handle->path, realpath) ;
+                /* try to restore state prior to redef */
+                _cdfs[cdfid] = stash ;
+                _cdfs[handle->redefid] = NULL ;
+                if(handle->redefid == _ncdf - 1)
+                    _ncdf-- ;
+		_curr_opened--;	/* one less file currently opened */
+                NC_free_cdf(handle) ;
+
+		/* if the _cdf list is empty, deallocate and reset it to NULL */
+		if (_ncdf == 0)
+		    ncreset_cdflist();
+
+                return(-1) ;
+            }
+          (void) strncpy(handle->path, realpath, FILENAME_MAX) ;
+#ifdef DOS_FS
+          if( NCxdrfile_create( handle->xdrs, handle->path, NC_WRITE ) < 0)
+              return -1 ;
+#endif
+          NC_free_cdf(stash) ;
+          _cdfs[handle->redefid] = NULL ;
+          if(handle->redefid == _ncdf - 1)
+              _ncdf-- ;
+	  _curr_opened--;	/* one less file currently opened */
+          handle->redefid = -1 ;
+
+	  /* if the _cdf list is empty, deallocate and reset it to NULL */
+	  if (_ncdf == 0)
+	      ncreset_cdflist();
+      }
+
+done:
+	handle->flags &= ~(NC_CREAT | NC_INDEF | NC_NDIRTY | NC_HDIRTY) ;
+	return(0) ;
+}
+
+
+int ncendef( cdfid )
+int cdfid ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncendef" ;
+
+	handle = NC_check_id(cdfid) ; 
+	if(handle == NULL)
+		return(-1) ;
+	if( !NC_indefine(cdfid,TRUE) )
+		return(-1) ;
+	return( NC_endef(cdfid, handle) ) ;
+}
+
+/*
+ * This routine is called by SDend()? -GV
+ */
+int ncclose( cdfid )
+int cdfid ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncclose" ;
+
+	handle = NC_check_id(cdfid) ; 
+	if(handle == NULL)
+		return(-1) ;
+
+	if( handle->flags & NC_INDEF)
+        {
+	    if( NC_endef(cdfid, handle) == -1 )
+            {
+                return( ncabort(cdfid) ) ;
+            }
+        }
+	else if(handle->flags & NC_RDWR)
+        {
+	    handle->xdrs->x_op = XDR_ENCODE ;
+	    if(handle->flags & NC_HDIRTY)
+            {
+                if(!xdr_cdf(handle->xdrs, &handle) )
+                    return(-1) ;
+            }
+	    else if(handle->flags & NC_NDIRTY)
+            {
+                if(!xdr_numrecs(handle->xdrs, handle) )
+                    return(-1) ;
+            }
+	}
+
+#ifdef HDF
+	if(handle->file_type == HDF_FILE) 
+	    hdf_close(handle);
+#endif
+
+	NC_free_cdf(handle) ; /* calls fclose */
+
+	_cdfs[cdfid] = NULL ;	/* reset pointer */
+
+	if(cdfid == _ncdf - 1)
+	    _ncdf-- ;
+	_curr_opened--;	/* one less file currently opened */
+
+	/* if the _cdf list is empty, deallocate and reset it to NULL */
+	if (_ncdf == 0)
+	    ncreset_cdflist();
+	return(0) ;
+}
+
+int
+ncsetfill(id, fillmode)
+int id ;
+int fillmode ;
+{
+	NC *handle ;
+	int ret = 0 ;
+
+	cdf_routine_name = "ncsetfill" ;
+
+	handle = NC_check_id(id) ; 
+	if(handle == NULL)
+		return(-1) ;
+
+	if(!(handle->flags & NC_RDWR))
+      {
+          /* file isn't writable */
+          NCadvise(NC_EPERM, "%s is not writable", handle->path) ;
+          return -1 ;
+      }
+
+	ret = (handle->flags & NC_NOFILL) ? NC_NOFILL : NC_FILL ;
+
+	if(fillmode == NC_NOFILL)
+		handle->flags |= NC_NOFILL ;
+	else if(fillmode == NC_FILL)
+      {
+          if(handle->flags & NC_NOFILL)
+            {
+                /*
+                 * We are changing back to fill mode
+                 * so do a sync
+                 */
+#ifdef HDF       /* save the original x_op  */
+                enum xdr_op  xdr_op = handle->xdrs->x_op;
+                 
+                if (handle->flags & NC_RDWR)   /* make sure we can write */
+                    handle->xdrs->x_op = XDR_ENCODE; /*  to the file */
+#endif
+                if(handle->flags & NC_HDIRTY)
+                  {
+                      if(!xdr_cdf(handle->xdrs, &handle) )
+                          return(-1) ;
+                      handle->flags &= ~(NC_NDIRTY | NC_HDIRTY) ;
+                  }
+                else if(handle->flags & NC_NDIRTY)
+                  {
+                      if(!xdr_numrecs(handle->xdrs, handle) )
+                          return(-1) ;
+#ifdef HDF
+                      if (handle->file_type != HDF_FILE)
+                          handle->flags &= ~(NC_NDIRTY) ;
+#else              
+                      handle->flags &= ~(NC_NDIRTY) ;
+#endif
+                  }
+                handle->flags &= ~NC_NOFILL ;
+#ifdef HDF                /* re-store the x_op  */
+                handle->xdrs->x_op = xdr_op;
+#endif
+            }
+      }
+	else
+      {
+          NCadvise(NC_EINVAL, "Bad fillmode") ;
+          return -1 ;
+      }
+
+
+	return ret ;
+}
diff --git a/mfhdf/libsrc/globdef.c b/mfhdf/libsrc/globdef.c
new file mode 100644
index 0000000..807590b
--- /dev/null
+++ b/mfhdf/libsrc/globdef.c
@@ -0,0 +1,50 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ *
+ * $Id: globdef.c 5457 2010-09-07 17:21:51Z byrn $
+ *
+ * This file initializes all global variables.  It's a separate file in order
+ * to allow the creation of SunOS sharable-libraries.
+ */
+#include "h4config.h"
+#include "H4api_adpt.h"
+
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#include "local_nc.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+
+int ncerr = NC_NOERR ;
+
+
+/*
+ * russ's last minute whistles
+ *	The error(3) subroutines emit no messages unless NC_VERBOSE bit is on.
+ *	The error(3) subroutines call exit() when NC_FATAL bit is on.
+ */
+int ncopts = (NC_FATAL | NC_VERBOSE) ;
+
+
+/*
+ *	Set to the the name of the current interface routine by the
+ * interface routine.
+ */
+const char *cdf_routine_name = "netcdf";
diff --git a/mfhdf/libsrc/hdf2netcdf.h b/mfhdf/libsrc/hdf2netcdf.h
new file mode 100644
index 0000000..e39dde1
--- /dev/null
+++ b/mfhdf/libsrc/hdf2netcdf.h
@@ -0,0 +1,73 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: hdf2netcdf.h 5443 2010-08-24 20:52:13Z byrn $ */
+
+#include "h4config.h"
+#include "H4api_adpt.h"
+/* If we disable the HDF version of the netCDF API (ncxxx interface)
+   (--disable-netcdf configure flag; the old way was to use -DHAVE_NETCDF compilation flag)
+ ) we need to rename all the relevant function names 
+   In this version we exclude renaming the netCDF fortran API so 
+   the MFHDF side must be compilied without fortran support. */
+#ifndef H4_HAVE_NETCDF
+#define  HNAME(x)  sd_##x     /* pre-append 'sd_' to all netCDF fcn names */
+#else /* !H4_HAVE_NETCDF i.e NOT USING HDF NETCDF */
+#define  HNAME(x)   x
+#endif /* H4_HAVE_NETCDF i.e. USING HDF NETCDF */
+
+/* If using the real netCDF library and API (use --disable-netcdf configure flag))
+   need to mangle the HDF versions of netCDF API function names 
+   to not conflict w/ oriinal netCDF ones */
+#ifndef H4_HAVE_NETCDF
+#define ncerr     HNAME(ncerr)
+#define ncopts    HNAME(ncopts)
+#define nccreate  HNAME(nccreate)
+#define ncopen    HNAME(ncopen)
+#define ncredef   HNAME(ncredef)
+#define ncendef   HNAME(ncendef)
+#define ncclose   HNAME(ncclose)
+#define ncinquire HNAME(ncinquire)
+#define ncsync    HNAME(ncsync)
+#define ncabort   HNAME(ncabort)
+#define ncdimdef  HNAME(ncdimdef)
+#define ncdimid   HNAME(ncdimid)
+#define ncdiminq  HNAME(ncdiminq)
+#define ncdimrename HNAME(ncdimrename)
+#define ncvardef  HNAME(ncvardef)
+#define ncvarid   HNAME(ncvarid)
+#define ncvarinq  HNAME(ncvarinq)
+#define ncvarput1 HNAME(ncvarput1)
+#define ncvarget1 HNAME(ncvarget1)
+#define ncvarput  HNAME(ncvarput)
+#define ncvarget  HNAME(ncvarget)
+#define ncvarputs HNAME(ncvarputs)
+#define ncvargets HNAME(ncvargets)
+#define ncvarputg HNAME(ncvarputg)
+#define ncvargetg HNAME(ncvargetg)
+#define ncvarrename HNAME(ncvarrename)
+#define ncattput  HNAME(ncattput)
+#define ncattinq  HNAME(ncattinq)
+#define ncattget  HNAME(ncattget)
+#define ncattcopy HNAME(ncattcopy)
+#define ncattname HNAME(ncattname)
+#define ncattrename HNAME(ncattrename)
+#define ncattdel  HNAME(ncattdel)
+#define nctypelen HNAME(nctypelen)
+#define ncsetfill HNAME(ncsetfill)
+#define ncrecinq  HNAME(ncrecinq)
+#define ncrecget  HNAME(ncrecget)
+#define ncrecput  HNAME(ncrecput)
+#define ncnobuf   HNAME(ncnobuf) /* no prototype for this one */
+
+#endif /* !H4_HAVE_NETCDF i.e NOT USING HDF version of netCDF API */ 
diff --git a/mfhdf/libsrc/hdfnctest.c b/mfhdf/libsrc/hdfnctest.c
new file mode 100644
index 0000000..d3538e3
--- /dev/null
+++ b/mfhdf/libsrc/hdfnctest.c
@@ -0,0 +1,47 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5109 $";
+#endif
+
+#include "mfhdf.h"
+
+#include "hdftest.h"
+
+/* all test functions to be called in main */
+extern int test_unlim();
+extern int test_ncunlim();
+
+int 
+main(int argc, char *argv[])
+{
+    intn  status;      /* status flag */
+    int     num_errs = 0;    /* number of errors so far */
+
+    /* Tests reading/writing datasets with unlimited dimension via HDF
+       API (bugzilla 1378) -BMR, Jan 07, 2009 */
+    status = test_unlim();  /* in tunlim.c */
+    num_errs = num_errs + status;
+
+    /* Tests reading/writing variables with unlimited dimension via nc
+       API (bugzilla 1378) -BMR, Jan 07, 2009 */
+    status = test_ncunlim();  /* in tncunlim.c */
+    num_errs = num_errs + status;
+
+    if (num_errs == 0)
+	printf("*** HDF-nc test passes ***\n");
+    else                                                          \
+	printf("*** HDF-nc test fails ***\n");
+    return num_errs;
+}
+
diff --git a/mfhdf/libsrc/hdfsds.c b/mfhdf/libsrc/hdfsds.c
new file mode 100644
index 0000000..c96f333
--- /dev/null
+++ b/mfhdf/libsrc/hdfsds.c
@@ -0,0 +1,1840 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6043 $";
+#endif
+
+/* $Id: hdfsds.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/***************************************************************************
+ *
+ * This file contains the code to read old SDS objects out of HDF files
+ *  an pretend that they are netCDF / mutli-file SDS data objects
+ *
+ **************************************************************************/
+
+/***************************************************************************
+  General Thoughts
+
+
+  Will need to add a 'type' field to the variable stucture so that we can
+  how it was stored (basically will want to just store the tag of the object
+  as well as the ref (which is already stored)).
+  
+
+  We can use the LUF record to get names of dimensions.  If no info stored
+  int the LUF then we will need to fake it.
+
+  Will prolly be easiest to define a coordinate variable for every dimension 
+  even if it doesn't need any attributes or data values
+
+  Scales are a problem.  In HDF scales, are used to define the values for
+  the coordinate variables.  The problem is that all of the values for the
+  scales in HDF are jammed into the same tag's storage.  So, we will need
+  to add an 'offset' field to the variable record so that we know where to 
+  start reading to get the data.  If the offset == 0 then we should start
+  reading from the beginning.  If the offset == -1 then there is *NO* data
+  (since a scale may not have data specified for it).
+
+ LOCAL ROUTINES
+ ==============
+ hdf_query_seen_sdg
+ hdf_register_seen_sdg
+ hdf_read_ndgs
+
+ PUBLIC ROUTINES
+ ===============
+ hdf_read_sds_ndgs
+
+
+ NOTE: This file could use the current comments updated and more
+       comments in parts of the code. I tried my best. -GV 9/10/97
+
+ **************************************************************************/
+
+#ifdef HDF
+#include        "local_nc.h"
+
+#define SDG_MAX_INITIAL 100
+
+/* local variables */
+PRIVATE intn       sdgCurrent;
+PRIVATE intn       sdgMax;
+PRIVATE uint16     *sdgTable=NULL;
+PRIVATE uint8      *ptbuf = NULL;
+
+/* Local routines */
+PRIVATE intn hdf_query_seen_sdg
+    (uint16 ndgRef);
+
+PRIVATE intn hdf_register_seen_sdg
+    (uint16 ndgRef);
+
+PRIVATE intn hdf_read_ndgs
+    (NC *handle);
+
+/******************************************************************************
+ NAME
+   hdf_query_seen_sdg
+
+ DESCRIPTION
+   The SDG with the given ref number might be part of an SDG-NDG combo
+   if so, we return TRUE else FALSE.
+ 
+   Attempt to discover if we've seen it in the most inefficient manner
+   possible
+
+ RETURNS
+   TRUE / FALSE
+
+******************************************************************************/
+PRIVATE intn 
+hdf_query_seen_sdg(uint16 ndgRef)
+{
+    intn i;
+
+    if(!sdgTable) 
+        return FALSE;
+
+    for(i = 0; i < sdgCurrent; i++)
+      {
+        if(sdgTable[i] == ndgRef) 
+            return TRUE;
+      }
+
+    return FALSE;
+} /* hdf_query_seen_sdg */
+
+
+/******************************************************************************
+ NAME
+   hdf_register_seen_sdg
+
+ DESCRIPTION
+   The SDG with the given ref is in an SDG-NDG combo.  Add it to the seen table
+   so we don't read it twice
+
+ RETURNS
+   SUCCEED / FAIL
+
+******************************************************************************/
+PRIVATE intn 
+hdf_register_seen_sdg(uint16 sdgRef)
+{
+    intn ret_value = SUCCEED;
+
+    /* check if table is allocated */
+    if(!sdgTable) 
+      {
+          sdgMax = SDG_MAX_INITIAL;
+          sdgTable = (uint16 *) HDmalloc(sdgMax * sizeof(uint16));
+          if (sdgTable == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          sdgCurrent = 0;
+      }
+    
+    /* add ref to table */
+    sdgTable[sdgCurrent++] = sdgRef;
+    
+    /* check if we need to increase size of table */
+    if(sdgCurrent == sdgMax) 
+      {
+          sdgMax *= 2;
+          sdgTable = (uint16 *) HDrealloc((VOIDP) sdgTable, sdgMax * sizeof(uint16));
+          if (sdgTable == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_register_seen_sdg */
+
+
+/******************************************************************************
+ NAME
+   hdf_read_ndgs
+ 
+ DESCRIPTION
+   Loop through all of the NDGs in the file and create data structures for 
+   them
+
+ RETURNS
+   SUCCEED / FAIL
+ 
+******************************************************************************/
+PRIVATE intn 
+hdf_read_ndgs(NC *handle)
+{
+    static const char *FUNC = "hdf_read_ndg_dims";
+    char     tmpname[80] = "";
+    uint8    ntstring[4] = "";
+    intn     dimcount;
+    intn     dimattrcnt;
+    /* info about NDG structure */
+    int32    GroupID;
+    int32    aid;
+    int32    aid1;
+    uint16   ndgTag;
+    uint16   ndgRef;
+    uint16   sddRef;
+    uint16   lRef;
+    uint16   uRef;
+    uint16   fRef;
+    uint16   sRef;
+    uint16   sdRef;
+    uint16   tmpTag;
+    uint16   tmpRef;
+    int16    rank=0;
+    nc_type  type;
+    int32   *dimsizes = NULL;
+    int32   *scaletypes = NULL;
+    int32    HDFtype;
+    intn     dim;
+    intn     max_thangs;
+    intn     current_dim;
+    intn     current_var;
+    intn     current_attr;
+    intn    *vardims = NULL;
+    /* info about netCDF structures */
+    NC_dim  **dims = NULL;   /* hold list of dimensions as we create it */
+    NC_var  **vars = NULL;   /* hold variable list as we create it      */
+    NC_attr **attrs = NULL;  /* hold attribute list as we create it     */
+    NC_attr  *dimattrs[10];  /* for LUF and anno_label, anno_desc, 10 is enough */
+    uint8    *labelbuf = NULL; /* label should not be used as var name due to non-uniqueness  */
+    uint8    *scalebuf = NULL; /* buffer to store scale info */
+    uint8    *unitbuf = NULL;  /* buffer to store unit info */
+    uint8    *formatbuf = NULL; /* buffer to store format info */
+    uint8    *coordbuf = NULL; /* buffer to store coord system info */
+    intn      new_dim;   /* == new dim so create coord variable     */
+    /* random book-keeping */
+    intn      i;
+    intn      status;
+    intn      tag_index;
+    uint8    *p = NULL;
+    uint8     tBuf[128] = "";
+    intn      scale_offset;   /* current offset into the scales record for the
+                            current dimension's values */
+    intn      ret_value = SUCCEED;
+
+    /*
+     *  Allocate the array to store the dimensions
+     */
+    max_thangs  = 100; /* what is this limit ? */
+
+    dims = (NC_dim **) HDmalloc(sizeof(NC_dim *) * max_thangs);
+    if(NULL == dims) 
+      {
+          HERROR(DFE_NOSPACE);
+          ret_value = FAIL;
+          goto done;
+      }
+    
+    vars = (NC_var **) HDmalloc(sizeof(NC_var *) * max_thangs);
+    if(NULL == vars) 
+      {
+          HERROR(DFE_NOSPACE);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    attrs = (NC_attr **) HDmalloc(sizeof(NC_attr *) * max_thangs);
+    if(NULL == attrs) 
+      {
+          HERROR(DFE_NOSPACE);
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Check if temproray buffer has been allocated */
+    if (ptbuf == NULL)
+      {
+          ptbuf = (uint8 *)HDmalloc(TBUF_SZ * sizeof(uint8));
+          if (ptbuf == NULL)
+            {
+                HERROR(DFE_NOSPACE);
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+
+    /* no dimensions or variables yet */
+    current_dim = 0;
+    current_var = 0;
+    dimcount = 0;
+
+    for(tag_index = 0; tag_index < 2; tag_index++) 
+      {
+
+          if(tag_index == 0)
+              ndgTag = DFTAG_NDG;
+          else
+              ndgTag = DFTAG_SDG;
+
+          /*
+           * Start from the beginning and look though
+           */
+          aid = Hstartread(handle->hdf_file, ndgTag, DFREF_WILDCARD);
+          if(aid == FAIL) 
+              continue; /* hmm if we fail we continue the loop? */
+        
+          /*
+           * Loop through all of the NDGs in the file
+           */
+          status = SUCCEED;
+          while (status == SUCCEED) 
+            {
+                uint16 ntTag;
+                uint16 ntRef;
+            
+                if(HQuerytagref(aid, &ndgTag, &ndgRef) == FAIL) 
+                  {
+#ifdef DEBUG
+                      fprintf(stderr, "Call to Hinquire failed\n");
+#endif
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                /* Test if its an SDG-NDG which we've processed already */
+                if((ndgTag == DFTAG_SDG) && (hdf_query_seen_sdg(ndgRef))) 
+                  {
+                      status = Hnextread(aid, ndgTag, DFREF_WILDCARD, DF_CURRENT);  
+                      continue; /* go to next element */
+                  }
+                
+                /* OK, now we need to get the relevant dimension structure */
+#ifdef DEBUG
+                printf("Found NDG at %d %d\n", ndgTag, ndgRef);
+#endif
+            
+                /* read the group into memory */
+                if ((GroupID = DFdiread(handle->hdf_file, ndgTag, ndgRef)) < 0) 
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            
+                sddRef = lRef = uRef = fRef = sRef = sdRef = 0;
+            
+                /* default number type is Float32 */
+                type    = NC_FLOAT; 
+                HDFtype = DFNT_FLOAT32;
+            
+                /* no attributes found yet */
+                current_attr = 0;
+            
+                /* no meta-data seen yet */
+                labelbuf = unitbuf = scalebuf = formatbuf = NULL;
+            
+                /*
+                 * Loop through the members of the group looking for stuff
+                 *
+                 * NOTE:  Only generate attributes for meta-data which does
+                 *        not depend on the rank of the data since we can not
+                 *        be sure that we get the rank first.  
+                 *        If the meta-data depends on the rank, just remember the
+                 *        ref number and read the element once this while loop
+                 *        is finished.
+                 */
+
+                while (!DFdiget(GroupID, &tmpTag, &tmpRef)) 
+                  {
+                      switch(tmpTag) 
+                        {
+                        case DFTAG_SDD:
+                            aid1 = Hstartread(handle->hdf_file, tmpTag, tmpRef);
+                            if (aid1 == FAIL)
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            /* read rank */
+                            if (Hread(aid1, (int32) 2, ptbuf) == FAIL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            p = ptbuf;
+                            INT16DECODE(p, rank);
+                    
+                            /* get space for dimensions */
+                            dimsizes = (int32 *) HDmalloc((uint32) rank * sizeof(int32));
+                            if (dimsizes == NULL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            vardims = (intn *) HDmalloc((uint32) rank * sizeof(intn));
+                            if (vardims == NULL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            scaletypes = (int32 *) HDmalloc((uint32) rank * sizeof(int32));
+                            if (scaletypes == NULL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                    
+                            /* read dimension record */
+                            if (Hread(aid1, (int32) 4 * rank, ptbuf) == FAIL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            p = ptbuf;
+                            for (i = 0; i < rank; i++)
+                                INT32DECODE(p, dimsizes[i]);
+                    
+                          /* read tag/ref of NT */
+                            if (Hread(aid1,(int32) 4,  ptbuf) == FAIL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                            p = ptbuf;
+                            UINT16DECODE(p, ntTag);
+                            UINT16DECODE(p, ntRef);
+                    
+                            /* read actual NT */
+                            if (Hgetelement(handle->hdf_file, ntTag, ntRef, ntstring) == FAIL)
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                    
+                            HDFtype = ntstring[1];
+                            if ((type = hdf_unmap_type(HDFtype)) == FAIL)
+                              {
+#ifdef DEBUG
+                                  /* replace it with NCAdvice or HERROR? */
+                                  fprintf(stderr "hdf_read_ndgs: hdf_unmap_type failed for %d\n", HDFtype);
+#endif
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            /* test if data was stored in native format of different 
+                             machine or in the LITEND format, and make sure the
+                             numbertype version numbers are the same */
+                            if ((ntstring[0] != DFNT_VERSION) 
+                                || ((ntstring[3] != DFNTF_NONE) 
+                                    && (ntstring[3] != DFNTF_IEEE)))  
+                              {
+                                  if (ntstring[3] == DFNTF_PC)  /* Little Endian */
+                                      HDFtype |= DFNT_LITEND;
+                                  else  
+                                    {   /* same machine type?  */
+                                        if (ntstring[3] == DFKgetPNSC(HDFtype, DF_MT))  
+                                            HDFtype |= DFNT_NATIVE;
+                                        else  /* different machine */
+                                          {
+                                              ret_value = FAIL;
+                                              goto done;
+                                          }
+                                    }  /* machine type */
+                              }   /* Little Endian */
+
+                            /* read in scale NTs */
+                            for(i = 0; i < rank; i++) 
+                              {
+                                  if (Hread(aid1,(int32) 4,  ptbuf) == FAIL) 
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                                  p = ptbuf;
+                                  UINT16DECODE(p, ntTag);
+                                  UINT16DECODE(p, ntRef);
+                        
+                                  /* read NT of this scale (dimension) */
+                                  if (Hgetelement(handle->hdf_file, ntTag, ntRef, ntstring) == FAIL)
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                        
+                                  scaletypes[i] = ntstring[1];
+                                  /* check native format and LITEND */
+                                  if ((ntstring[0] != DFNT_VERSION) 
+                                      || ((ntstring[3] != DFNTF_NONE) 
+                                          && (ntstring[3] != DFNTF_IEEE)))  
+                                    {
+                                        if (ntstring[3] == DFNTF_PC)  /* Little Endian */
+                                            scaletypes[i] |= DFNT_LITEND;
+                                        else  
+                                          {   /* same machine type?  */
+                                              if (ntstring[3] == DFKgetPNSC(HDFtype, DF_MT))
+                                                  scaletypes[i] |= DFNT_NATIVE;
+                                              else  /* different machine */
+                                                {
+                                                    ret_value = FAIL;
+                                                    goto done;
+                                                }
+                                          }  /* scale machine type */
+                                    }    /* Little Endian */
+                              }
+                    
+                            sddRef = tmpRef;    /* prepare for a new dim var */
+                            if (Hendaccess(aid1) == FAIL)
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                    
+                            break;
+                    
+                        case DFTAG_SDL:       /* label */
+                            lRef = tmpRef;
+                            break;
+                    
+                        case DFTAG_SDU:       /* unit */
+                            uRef = tmpRef;
+                            break;
+                    
+                        case DFTAG_SDF:       /* format */
+                            fRef = tmpRef;
+                            break;
+
+                        case DFTAG_SDC:       /* coord  */
+                            /*
+                             * DFTAG_SDC => 'cordsys'
+                             */
+                        { 
+                            int len;
+
+                            len = Hlength(handle->hdf_file, DFTAG_SDC, tmpRef);
+                            if (len == FAIL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            coordbuf = (uint8 *) HDmalloc((uint32) len + 1);
+                            if (NULL == coordbuf) 
+                              {
+                                  HERROR(DFE_NOSPACE);
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            if (Hgetelement(handle->hdf_file, DFTAG_SDC, tmpRef, coordbuf) == FAIL)
+                              {
+                                  HDfreespace((VOIDP)coordbuf);
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            coordbuf[len] = '\0';
+                            if (coordbuf[0] != '\0')  
+                              {
+                                  attrs[current_attr] =
+                                      (NC_attr *) NC_new_attr(_HDF_CoordSys,
+                                                              NC_CHAR, HDstrlen(coordbuf), coordbuf);
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_CHAR;
+                              }
+
+                            HDfreespace((VOIDP)coordbuf);
+                        }
+                        break;
+
+                        case DFTAG_SDS:       /* scales */
+                            sRef = tmpRef;
+                            break;
+                    
+                        case DFTAG_SD:        /* actual data */
+                            sdRef = tmpRef;
+                            break;
+                    
+                        case DFTAG_CAL:        /* calibration info */
+                            /* 
+                           * DFTAG_CAL => 'scale_factor', 'add_offset', 'scale_factor_err', 
+                           *              'add_offset_err'
+                           */
+                            if (Hgetelement(handle->hdf_file, tmpTag, tmpRef, ptbuf) == FAIL)
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                    
+                            if (Hlength(handle->hdf_file, tmpTag, tmpRef) == 36) 
+                              {
+                                  /* DFNT_FLOAT64 based calibration */
+                        
+                                  if (FAIL == DFKconvert((VOIDP)ptbuf, 
+                                             (VOIDP) tBuf, 
+                                             DFNT_FLOAT64, 4, DFACC_READ, 0, 0))
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                        
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_ScaleFactor, 
+                                                              NC_DOUBLE, 
+                                                              1, 
+                                                              (Void *) &(tBuf[0]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT64; 
+
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_ScaleFactorErr, 
+                                                              NC_DOUBLE, 
+                                                              1, 
+                                                              (Void *) &(tBuf[8]));    
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT64;
+ 
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_AddOffset, 
+                                                              NC_DOUBLE, 
+                                                              1, 
+                                                              (Void *) &(tBuf[16]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT64;
+
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_AddOffsetErr, 
+                                                              NC_DOUBLE, 
+                                                              1, 
+                                                              (Void *) &(tBuf[24]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT64;
+
+                                /* don't forget number_type  */
+                                  if (FAIL == DFKconvert((VOIDP)(ptbuf + 32),
+                                             (VOIDP) tBuf,
+                                             DFNT_INT32, 1, DFACC_READ, 0,0))
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+
+                                  attrs[current_attr] =
+                                      (NC_attr *) NC_new_attr(_HDF_CalibratedNt,
+                                                              NC_LONG,
+                                                              1,
+                                                              (Void *) &(tBuf[0]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_INT32;
+
+                              } 
+                            else 
+                              {
+                                  /* DFNT_FLOAT32 based calibration */
+
+                                  if (FAIL == DFKconvert((VOIDP)ptbuf, 
+                                             (VOIDP)tBuf, 
+                                             DFNT_FLOAT32, 4, DFACC_READ, 0, 0))
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+                        
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_ScaleFactor, 
+                                                              NC_FLOAT, 
+                                                              1, 
+                                                              (Void *) &(tBuf[0]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT32;
+ 
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_ScaleFactorErr, 
+                                                              NC_FLOAT, 
+                                                              1, 
+                                                              (Void *) &(tBuf[4]));    
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT32;
+
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_AddOffset, 
+                                                              NC_FLOAT, 
+                                                              1, 
+                                                              (Void *) &(tBuf[8]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT32;
+
+                                  attrs[current_attr] = 
+                                      (NC_attr *) NC_new_attr(_HDF_AddOffsetErr, 
+                                                              NC_FLOAT, 
+                                                              1, 
+                                                              (Void *) &(tBuf[12]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_FLOAT32;
+
+                                  /* don't forget number_type  */
+                                  if (FAIL == DFKconvert((VOIDP)(ptbuf + 16),
+                                             (VOIDP) tBuf,
+                                             DFNT_INT16, 1, DFACC_READ, 0,0))
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+
+
+                                  attrs[current_attr] =
+                                      (NC_attr *) NC_new_attr(_HDF_CalibratedNt,
+                                                              NC_SHORT,
+                                                              1,
+                                                              (Void *) &(tBuf[0]));
+
+                                  if (NULL == attrs[current_attr])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      attrs[current_attr++]->HDFtype = DFNT_INT16;
+                              }
+                    
+                            break;
+                    
+                        case DFTAG_SDM:        /* valid range info */
+                    
+                            if (Hgetelement(handle->hdf_file, tmpTag, tmpRef, ptbuf) == FAIL)
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                    
+                            if (FAIL == DFKconvert((VOIDP)ptbuf, 
+                                       (VOIDP)tBuf, 
+                                       HDFtype, 2, DFACC_READ, 0, 0))
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                    
+                            attrs[current_attr] = 
+                                (NC_attr *) NC_new_attr(_HDF_ValidMax, 
+                                                        type, 
+                                                        1, 
+                                                        (Void *) tBuf);
+
+                            if (NULL == attrs[current_attr])
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                            else
+                                attrs[current_attr++]->HDFtype = HDFtype;
+                    
+                            attrs[current_attr] = 
+                                (NC_attr *) NC_new_attr(_HDF_ValidMin, 
+                                                        type, 
+                                                        1, 
+                                                        (Void *) &(tBuf[DFKNTsize(HDFtype|DFNT_NATIVE)]));
+
+                            if (NULL == attrs[current_attr])
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                            else
+                                attrs[current_attr++]->HDFtype = HDFtype;
+                            break;
+
+                        case DFTAG_SDLNK:
+                            if(ndgTag == DFTAG_SDG) 
+                                continue; /* continue processing? */
+
+                            if (Hgetelement(handle->hdf_file, tmpTag, tmpRef, ptbuf) == FAIL) 
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                            else 
+                              {
+                                  uint16 sdgTag, sdgRef;
+
+                                  p = ptbuf;
+                        
+                                  /* the first two are for the NDG tag/ref */
+                                  UINT16DECODE(p, sdgTag);
+                                  UINT16DECODE(p, sdgRef);
+                        
+                                  /* now the ones we're interested in */
+                                  UINT16DECODE(p, sdgTag);
+                                  UINT16DECODE(p, sdgRef);
+
+                                  if (hdf_register_seen_sdg(sdgRef) == FAIL)
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                              }
+
+                            break;
+                    
+                        default:
+                            break;
+                        } /* end switch 'tmpTag */
+                  }     /* end while 'DFdiget()'*/
+            
+                if(lRef) 
+                  {
+                      int len;
+                
+                      /*
+                       *  Add three NULLS to the end to account for a bug in HDF 3.2r1-3
+                       */
+
+                      len = Hlength(handle->hdf_file, DFTAG_SDL, lRef);
+                      if(len == FAIL) 
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      labelbuf = (uint8 *) HDmalloc((uint32) len + 3);
+                      if(NULL == labelbuf) 
+                        {
+                            HERROR(DFE_NOSPACE);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      if(Hgetelement(handle->hdf_file, DFTAG_SDL, lRef, labelbuf) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      labelbuf[len + 2] = '\0';
+                      labelbuf[len + 1] = '\0';
+                      labelbuf[len + 0] = '\0';
+                
+                  } 
+                else 
+                    labelbuf = NULL;
+            
+                if(uRef) 
+                  {
+                      int len;
+                
+                      len = Hlength(handle->hdf_file, DFTAG_SDU, uRef);
+                      if(len == FAIL) 
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      unitbuf = (uint8 *) HDmalloc((uint32) len+3);
+                      if(NULL == unitbuf) 
+                        {
+                            HERROR(DFE_NOSPACE);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      if(Hgetelement(handle->hdf_file, DFTAG_SDU, uRef, unitbuf) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      unitbuf[len + 2] = '\0';
+                      unitbuf[len + 1] = '\0';
+                      unitbuf[len + 0] = '\0';
+                  } 
+                else 
+                    unitbuf = NULL;
+           
+                if(fRef) 
+                  {
+                      int len;
+
+                      len = Hlength(handle->hdf_file, DFTAG_SDF, fRef);
+                      if(len == FAIL) 
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      formatbuf = (uint8 *) HDmalloc((uint32) len+3);
+                      if(NULL == formatbuf) 
+                        {
+                            HERROR(DFE_NOSPACE);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      if(Hgetelement(handle->hdf_file, DFTAG_SDF, fRef, formatbuf) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      formatbuf[len + 2] = '\0';
+                      formatbuf[len + 1] = '\0';
+                      formatbuf[len + 0] = '\0';
+                  } 
+                else
+                    formatbuf = NULL;
+ 
+                if(sRef) 
+                  {
+                      int len;
+                
+                      len = Hlength(handle->hdf_file, DFTAG_SDS, sRef);
+                      if(len == FAIL) 
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      scalebuf = (uint8 *) HDmalloc((uint32) len);
+                      if(NULL == scalebuf) 
+                        {
+                            HERROR(DFE_NOSPACE);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      if(Hgetelement(handle->hdf_file, DFTAG_SDS, sRef, scalebuf) == FAIL)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                  } 
+                else 
+                    scalebuf = NULL;
+            
+                /* skip over the garbage at the beginning */
+                scale_offset = rank * sizeof(uint8);
+            
+                for (dim = 0; dim < rank; dim++) 
+                  {
+                      intn this_dim     = FAIL;
+                      char *labelvalue  = NULL;
+                      char *unitvalue = NULL;
+                      char *formatvalue = NULL;
+
+                      /* now loop though each dimension
+                         - get the size from dimsize[i]
+                         - lref will give the ref of the label descriptor to see if 
+                         has a real name else fake one based on the label of the NDG
+                         - look at uref for units information and fref for formating 
+                         info store both of these as attributes of the coordinate 
+                         variable
+                         - Promote the dimension to a variable if any of the LUF or
+                         scales is assigned to this dimentsion. 
+                         - The dimension variable name is the same as the dimension 
+                         record name, fakeDim<dim count>.
+                         */
+               
+                      new_dim = FAIL; 
+                      tmpname[0] = '\0';
+                
+                      if(lRef) 
+                        {
+                            labelvalue = (char *) labelbuf;
+                            for(i = 0; i < dim + 1; i++) 
+                                labelvalue += HDstrlen(labelvalue) + 1;
+                            if (labelvalue[0] != '\0') 
+                                new_dim = SUCCEED;
+                        }
+                
+                      if(uRef) 
+                        {
+                            unitvalue = (char *) unitbuf;
+                            for(i = 0; i < dim + 1; i++) 
+                                unitvalue += HDstrlen(unitvalue) + 1;
+                            if (unitvalue[0] != '\0') 
+                                new_dim = SUCCEED;
+                        }
+
+                      if(fRef) 
+                        {
+                            formatvalue = (char *) formatbuf;
+                            for(i = 0; i < dim + 1; i++) 
+                                formatvalue += HDstrlen(formatvalue) + 1;
+                            if (formatvalue[0] != '\0') 
+                                new_dim = SUCCEED;
+                        }
+
+                      sprintf(tmpname, "fakeDim%d", dimcount++);
+                
+                      this_dim = current_dim++;
+                      if(current_dim == max_thangs) 
+                        {
+                            /* need to allocate more space */    
+                            max_thangs *= 2;
+                            dims = (NC_dim **) HDrealloc((VOIDP) dims, sizeof(NC_dim *) * max_thangs);
+                            if(NULL == dims) 
+                              {
+                                  HERROR(DFE_NOSPACE);
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            vars = (NC_var **) HDrealloc((VOIDP) vars, sizeof(NC_var *) * max_thangs);
+                            if(NULL == vars) 
+                              {
+                                  HERROR(DFE_NOSPACE);
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                        }
+
+                      /*
+                       * Create a new dimension record for each dimension. 
+                       * Each NC_dim takes 8 bytes in memory. 
+                       */
+                      dims[this_dim] = NC_new_dim(tmpname, dimsizes[dim]);
+                      if (NULL == dims[this_dim])
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      /* 
+                       * It looks like were gonna have to do the variable define
+                       *    here too cuz we need to remember the indicies of where
+                       *    we put the dimensions
+                       */
+                
+                      vardims[dim] = (intn) this_dim;
+                
+                
+                      /*
+                       * Look at the scale NTs since the scales may have different number 
+                       *   types
+                       * Promote the dimension to a variable, but only if it has meta-data
+                       *   stored with it.  
+                       */
+                      if(new_dim || (scalebuf && scalebuf[dim])) 
+                        {
+                            nc_type stype;
+
+                            if ((stype = hdf_unmap_type(scaletypes[dim])) == FAIL)
+                              {
+#ifdef DEBUG
+                                  /* replace it with NCAdvice or HERROR? */
+                                  fprintf(stderr "hdf_read_ndgs: hdf_unmap_type failed for %d\n", scaletypes[dim]);
+#endif
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            vars[current_var] = NC_new_var(tmpname, 
+                                                           stype,
+                                                           1, 
+                                                           &this_dim);
+                            if (NULL == vars[current_var])
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+
+                            vars[current_var]->data_tag = DFTAG_SDS;  /* not normal data */
+                            vars[current_var]->data_ref = sRef;
+                            vars[current_var]->HDFtype  = scaletypes[dim];
+#ifdef NOT_YET
+                            vars[current_var]->ndg_ref  = Htagnewref(handle->hdf_file,DFTAG_NDG);
+#else /* NOT_YET */
+                            vars[current_var]->ndg_ref  = Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+			    /* Indicate that it is unknown whether the current
+			       variable is an SDS or a coordinate variable.
+			       bugzilla 624 - BMR - 05/16/2007 */
+			    /* vars[current_var]->var_type  = UNKNOWN; */ 
+			    /* It looks like this is a dimension variable for sure! -BMR 10/26/2010 */
+			    vars[current_var]->var_type  = IS_CRDVAR;
+
+                            /*
+                             * See if a scales record has been stored and if there have
+                             *   been scale values provided
+                             */
+                            if((scalebuf) && (scalebuf[dim])) 
+                              {
+                                  vars[current_var]->numrecs = dimsizes[dim];
+                                  vars[current_var]->data_offset = scale_offset;
+                                  scale_offset += dimsizes[dim] * DFKNTsize(scaletypes[dim]);
+                              } 
+                            else 
+                              {
+                                  vars[current_var]->data_offset = -1;  /* no values */
+                              }
+                            /*
+                             * Convert dimstrs into attributes  
+                             * label -- "long_name" (cuz SDsetdimstrs() assigns "long_name" to label)
+                             * unit  -- "units"
+                             * format -- "format"
+                             */
+
+                            /* label => "long_name"  */
+                            dimattrcnt = 0;
+                            if (labelvalue && HDstrlen((char *)labelvalue) > 0) 
+                              {
+                                  dimattrs[dimattrcnt] =
+                                      (NC_attr *) NC_new_attr(_HDF_LongName, NC_CHAR,
+                                                              HDstrlen((char *)labelvalue),
+                                                              (Void *) labelvalue);
+
+                                  if (NULL == dimattrs[dimattrcnt])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      dimattrs[dimattrcnt++]->HDFtype = DFNT_CHAR;
+                              }
+
+                            /* Units => 'units' */
+                            if(unitvalue && HDstrlen((char *)unitvalue) > 0) 
+                              {
+                                  dimattrs[dimattrcnt] =
+                                      (NC_attr *) NC_new_attr(_HDF_Units, NC_CHAR,
+                                                              HDstrlen((char *)unitvalue),
+                                                              (Void *) unitvalue);
+
+                                  if (NULL == dimattrs[dimattrcnt])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      dimattrs[dimattrcnt++]->HDFtype = DFNT_CHAR;
+                              }
+
+                            /* Fomrat => 'format' */
+                            if(formatvalue && HDstrlen((char *)formatvalue) > 0) 
+                              {
+                                  dimattrs[dimattrcnt] =
+                                      (NC_attr *) NC_new_attr(_HDF_Format, NC_CHAR,
+                                                              HDstrlen((char *)formatvalue),
+                                                              (Void *) formatvalue);
+
+                                  if (NULL == dimattrs[dimattrcnt])
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                                  else
+                                      dimattrs[dimattrcnt++]->HDFtype = DFNT_CHAR;
+                              }
+
+                            /*
+                             * Add the attributes to the variable
+                             */
+                            if(dimattrcnt)
+                              {
+                                vars[current_var]->attrs = NC_new_array(NC_ATTRIBUTE,
+                                                                        dimattrcnt,
+                                                                        (Void *) dimattrs);
+                                  if (NULL == vars[current_var]->attrs)
+                                    {
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                              }
+                            else
+                                vars[current_var]->attrs = NULL;
+
+                            current_var++;  
+
+                            if(current_var == max_thangs) 
+                              {
+                                  /* need to allocate more space */    
+                                  max_thangs *= 2;
+
+                                  dims = (NC_dim **) HDrealloc((VOIDP)dims, sizeof(NC_dim *) * max_thangs);
+                                  if(NULL == dims) 
+                                    {
+                                        HERROR(DFE_NOSPACE);
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                        
+                                  vars = (NC_var **) HDrealloc((VOIDP)vars, sizeof(NC_var *) * max_thangs);
+                                  if(NULL == vars) 
+                                    {
+                                        HERROR(DFE_NOSPACE);
+                                        ret_value = FAIL;
+                                        goto done;
+                                    }
+                              }
+                        } /* end if 'new_dim' */
+                  } /* end for 'dim' */
+            
+                /*
+                 * Should the LUF-label be mapped as attr of "longname", to be consistent
+                 *   with the dim vars? 8/18/94
+                 * Should the annotation-label mapped to attr "anno-label", if "longname"
+                 *   has been taken by LUF-label?  8/18/94.
+                 *   
+                 * (If there is a data label use that as the variable name else) 
+                 * Use the reference number of the NDG as part of
+                 *    a made up name (Label is mapped as attr "longname" 9/2/94).
+                 *
+                 * Convert spaces in the name to underscores (yuck) otherwise
+                 *    ncgen will barf on ncdumped files)
+                 */
+#if 0
+                /* if(labelbuf && (labelbuf[0] != '\0')) 
+                   {
+                   char *c;
+                   for(c = (char *)labelbuf; *c; c++)
+                   if((*c) == ' ') (*c) = '_';
+
+                   vars[current_var] = NC_new_var((char *) labelbuf, type, (int) rank, vardims);
+                   } 
+                   else 
+                   { */
+#endif
+
+                sprintf(tmpname, "Data-Set-%d", ndgRef); 
+                vars[current_var] = NC_new_var(tmpname, type, (int) rank, vardims);
+                if (NULL == vars[current_var])
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+#if 0
+                /*   } */
+#endif 
+                /*
+                 * Fill in extra information so it will be easier to backtrack
+                 *    when the user wants to lift data out
+                 */
+                vars[current_var]->data_tag = DATA_TAG;
+                vars[current_var]->data_ref = sdRef;
+                vars[current_var]->HDFtype  = HDFtype;
+
+		/* Indicate that it is unknown whether the current variable 
+		   is an SDS or a coordinate variable.  bugzilla 624 - BMR - 
+		   05/16/2007 */
+                vars[current_var]->var_type  = UNKNOWN;
+
+
+                /*
+                 * NOTE:  If the user changes the file and saves setting this
+                 *   to ndgRef will blow away the old ndgs (but they will get
+                 *   rewritten).  Otherwise calls to SDidtoref() will return
+                 *   bogus values
+                 */
+                vars[current_var]->ndg_ref  = ndgRef; 
+
+                /*
+                 * --------------------------------------------
+                 * Convert HDF meta-data into netCDF attributes
+                 * --------------------------------------------
+                 */
+            
+                /*
+                 * If there is an annotation put in 'remarks'
+                 */
+            
+                {
+                    /* Re-vamped desc annotation handling to use new ANxxx interface 
+                     *  -georgev 6/11/97 */
+                    int32  an_handle   = FAIL;
+                    int32  *ddescs    = NULL;
+                    char   *ann_desc  = NULL;
+                    int32  ann_len;
+                    intn   num_ddescs;
+                    char   hremark[30] = ""; /* should be big enough for new attribute */
+
+                    /* start Annotation inteface */
+                    if ((an_handle = ANstart(handle->hdf_file)) == FAIL)
+                      {
+                          ret_value = FAIL;
+                          goto done_adesc; 
+                      }
+
+                    /* Get number of data descs with this tag/ref */
+                    num_ddescs = ANnumann(an_handle, AN_DATA_DESC, ndgTag, ndgRef);
+#ifdef AN_DEBUG
+                    fprintf(stderr,"SDS has %d descs \n", num_ddescs);
+#endif
+                    if (num_ddescs != 0)
+                      {
+                          /* allocate space for list of desc annotation id's with this tag/ref */
+                          if ((ddescs = (int32 *)HDmalloc(num_ddescs * sizeof(int32))) == NULL)
+                            {
+#ifdef AN_DEBUG
+                                fprintf(stderr,"failed to allocate space for %d descs \n", num_ddescs);
+#endif
+                                ret_value = FAIL;
+                                goto done_adesc;
+                            }
+
+                          /* get list of desc annotations id's with this tag/ref */
+                          if (ANannlist(an_handle, AN_DATA_DESC, ndgTag, ndgRef, ddescs) != num_ddescs)
+                            {
+#ifdef AN_DEBUG
+                                fprintf(stderr,"failed to get %d descs list \n", num_ddescs);
+#endif
+                                ret_value = FAIL;
+                                goto done_adesc;
+                            }
+
+                          /* loop through desc list. */
+                          for (i = 0; i < num_ddescs; i++)
+                            {
+                                if ((ann_len = ANannlen(ddescs[i])) == FAIL)
+                                  {
+#ifdef AN_DEBUG
+                                      fprintf(stderr,"failed to get %d desc  length \n", i);
+#endif
+                                      ret_value = FAIL;
+                                      goto done_adesc;
+                                  }
+        
+                                /* allocate space for desc */
+                                if (ann_desc == NULL)
+                                  {
+                                      if ((ann_desc = (char *)HDmalloc((ann_len+1)*sizeof(char))) == NULL)
+                                        {
+#ifdef AN_DEBUG
+                                            fprintf(stderr,"failed to allocate space for desc %d \n", i);
+#endif
+                                            ret_value = FAIL;
+                                            goto done_adesc;
+                                        }
+                                      HDmemset(ann_desc,'\0', ann_len+1);
+                                  }
+      
+                                /* read desc */
+                                if (ANreadann(ddescs[i], ann_desc, ann_len+1) == FAIL)
+                                  {
+#ifdef AN_DEBUG
+                                      fprintf(stderr,"failed to read %d desc \n", i);
+#endif
+                                      ret_value = FAIL;
+                                      goto done_adesc;
+                                  }
+
+                                /* make unique attribute */
+                                sprintf(hremark,"%s-%d",_HDF_Remarks,i+1);
+                            
+                                /* add it as a attribute */
+                                attrs[current_attr] = 
+                                    (NC_attr *) NC_new_attr(hremark, 
+                                                            NC_CHAR, 
+                                                            HDstrlen(ann_desc), 
+                                                            ann_desc);
+
+                                if (NULL == attrs[current_attr])
+                                  {
+                                      ret_value = FAIL;
+                                      goto done_adesc;
+                                  }
+                                else
+                                    attrs[current_attr++]->HDFtype = DFNT_CHAR;
+
+                                /* end access */
+                                ANendaccess(ddescs[i]);
+
+                                /* free buffer */
+                                if(ann_desc != NULL)
+                                  {
+                                      HDfree(ann_desc);
+                                      ann_desc = NULL;
+                                  }
+                            }
+
+                      } /* end if descs */
+
+                  done_adesc: /* GOTO Label */
+                    /* cleanup */
+                    if(ddescs != NULL)
+                        HDfree(ddescs);
+
+                    if(an_handle != FAIL)
+                        ANend(an_handle);
+
+                    /* check for error during ANxxx processing */
+                    if (ret_value == FAIL)
+                        goto done; /* error so return */
+
+                } /* end annotation description conversion */
+            
+                /*
+                 * If there is a label put in attr 'anno_label' (note: NOT 'long_name' 9/2/94)
+                 */
+                {
+                    /* Re-vamped label annotation handling to use new ANxxx interface 
+                     *  -georgev 6/11/97 */
+                    int32  an_handle   = FAIL;
+                    int32  *dlabels    = NULL;
+                    char   *ann_label  = NULL;
+                    int32  ann_len;
+                    intn   num_dlabels;
+                    char   hlabel[30] = ""; /* should be big enough for new attribute */
+
+                    /* start Annotation inteface */
+                    if ((an_handle = ANstart(handle->hdf_file)) == FAIL)
+                      {
+                          ret_value = FAIL;
+                          goto done_alabel;
+                      }
+
+                    /* Get number of data labels with this tag/ref */
+                    num_dlabels = ANnumann(an_handle, AN_DATA_LABEL, ndgTag, ndgRef);
+#ifdef AN_DEBUG
+                    fprintf(stderr,"SDS has %d labels \n", num_dlabels);
+#endif
+
+                    if (num_dlabels != 0)
+                      {
+                          /* allocate space for list of label annotation id's with this tag/ref */
+                          if ((dlabels = (int32 *)HDmalloc(num_dlabels * sizeof(int32))) == NULL)
+                            {
+#ifdef AN_DEBUG
+                                fprintf(stderr,"failed to allocate space for %d labels \n", num_dlabels);
+#endif
+                                ret_value = FAIL;
+                                goto done_alabel;
+                            }
+
+                          /* get list of label annotations id's with this tag/ref */
+                          if (ANannlist(an_handle, AN_DATA_LABEL, ndgTag, ndgRef, dlabels) != num_dlabels)
+                            {
+#ifdef AN_DEBUG
+                                fprintf(stderr,"failed to get %d label list \n", num_dlabels);
+#endif
+                                ret_value = FAIL;
+                                goto done_alabel;
+                            }
+
+                          /* loop through label list */
+                          for (i = 0; i < num_dlabels; i++)
+                            {
+                                if ((ann_len = ANannlen(dlabels[i])) == FAIL)
+                                  {
+#ifdef AN_DEBUG
+                                      fprintf(stderr,"failed to get %d label  length \n", i);
+#endif
+                                      ret_value = FAIL;
+                                      goto done_alabel;
+                                  }
+        
+                                /* allocate space for label */
+                                if (ann_label == NULL)
+                                  {
+                                      if ((ann_label = (char *)HDmalloc((ann_len+1)*sizeof(char))) == NULL)
+                                        {
+#ifdef AN_DEBUG
+                                            fprintf(stderr,"failed to allocate space for label %d \n", i);
+#endif
+                                            ret_value = FAIL;
+                                            goto done_alabel;
+                                        }
+                                      HDmemset(ann_label,'\0', ann_len+1);
+                                  }
+      
+                                /* read label */
+                                if (ANreadann(dlabels[i], ann_label, ann_len+1) == FAIL)
+                                  {
+#ifdef AN_DEBUG
+                                      fprintf(stderr,"failed to read %d label \n", i);
+#endif
+                                      ret_value = FAIL;
+                                      goto done_alabel;
+                                  }
+
+                                /* make unique attribute */
+                                sprintf(hlabel,"%s-%d",_HDF_AnnoLabel,i+1);
+
+                                /* add as atriburte */
+                                attrs[current_attr] = 
+                                    (NC_attr *) NC_new_attr(hlabel, 
+                                                            NC_CHAR, 
+                                                            HDstrlen(ann_label), 
+                                                            ann_label);
+
+                                if (NULL == attrs[current_attr])
+                                  {
+                                      ret_value = FAIL;
+                                      goto done_alabel;
+                                  }
+                                else
+                                    attrs[current_attr++]->HDFtype = DFNT_CHAR;
+
+                                /* end access */
+                                ANendaccess(dlabels[i]);
+
+                                /* free buffer */
+                                if(ann_label != NULL)
+                                  {
+                                      HDfree(ann_label);
+                                      ann_label = NULL;
+                                  }
+                            }
+
+                      } /* end if labels */
+
+                  done_alabel: /* GOTO Label */
+                    /* cleanup */
+                    if(dlabels != NULL)
+                        HDfree(dlabels);
+
+                    if(an_handle != FAIL)
+                        ANend(an_handle);
+
+                    /* check for error during ANxxx processing */
+                    if (ret_value == FAIL)
+                        goto done; /* error so return */
+                } /* end annotation label processing */
+            
+                /* 
+                 * Label => 'long_name'
+                 */
+                if(labelbuf && (labelbuf[0] != '\0')) 
+                  {
+                      attrs[current_attr] =
+                          (NC_attr *) NC_new_attr(_HDF_LongName,
+                                                  NC_CHAR,
+                                                  HDstrlen((char *)labelbuf),
+                                                  (Void *) labelbuf);
+
+                      if (NULL == attrs[current_attr])
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      else
+                          attrs[current_attr++]->HDFtype = DFNT_CHAR;
+                  }
+ 
+                /*
+                 * Units => 'units'
+                 */
+                if(unitbuf && (unitbuf[0] != '\0')) 
+                  {
+                      attrs[current_attr] = 
+                          (NC_attr *) NC_new_attr(_HDF_Units, 
+                                                  NC_CHAR, 
+                                                  HDstrlen((char *)unitbuf), 
+                                                  (Void *) unitbuf);
+
+                      if (NULL == attrs[current_attr])
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      else
+                          attrs[current_attr++]->HDFtype = DFNT_CHAR;
+                  }
+            
+                /*
+                 * (Don't do format cuz HDF doesn't distinguish between C and Fortran
+                 * Actually, it seems HDF Format == netCDF Fortran Format)
+                 * Don't use 'C_format' or 'FORTRAN_format'
+                 * Format => 'format'
+                 */
+                if(formatbuf && (formatbuf[0] != '\0')) 
+                  {
+                      attrs[current_attr] =
+                          (NC_attr *) NC_new_attr(_HDF_Format,
+                                                  NC_CHAR,
+                                                  HDstrlen((char *)formatbuf),
+                                                  (Void *) formatbuf);
+
+                      if (NULL == attrs[current_attr])
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                      else
+                          attrs[current_attr++]->HDFtype = DFNT_CHAR;
+                  }
+
+            
+                /*
+                 * Add the attributes to the variable
+                 */ 
+                if(current_attr)
+                  {
+                    vars[current_var]->attrs = NC_new_array(NC_ATTRIBUTE, 
+                                                            current_attr,
+                                                            (Void *) attrs);
+
+                      if (NULL == vars[current_var]->attrs)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+                else
+                    vars[current_var]->attrs = NULL;
+            
+
+            
+                current_var++;
+
+                if(current_var == max_thangs) 
+                  {
+                      /* need to allocate more space */    
+                      max_thangs *= 2;
+                
+                      dims = (NC_dim **) HDrealloc((VOIDP) dims, sizeof(NC_dim *) * max_thangs);
+                      if(NULL == dims) 
+                        {
+                            HERROR(DFE_NOSPACE);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      vars = (NC_var **) HDrealloc((VOIDP) vars, sizeof(NC_var *) * max_thangs);
+                      if(NULL == vars) 
+                        {
+                            HERROR(DFE_NOSPACE);
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                  }
+            
+                /*
+                 * De-allocate temporary storage
+                 */
+                if(labelbuf != NULL)  
+                    HDfree((VOIDP)labelbuf);
+                if(scalebuf != NULL)
+                    HDfree((VOIDP)scalebuf);
+                if(unitbuf != NULL)  
+                    HDfree((VOIDP)unitbuf);
+                if(formatbuf != NULL)  
+                    HDfree((VOIDP)formatbuf);
+                if (dimsizes != NULL)
+                    HDfree((VOIDP)dimsizes);
+                if (vardims != NULL)
+                    HDfree((VOIDP)vardims);
+                if (scaletypes != NULL)
+                    HDfree((VOIDP)scaletypes);
+            
+                /*
+                 * Look for the next DataSet
+                 */
+                status = Hnextread(aid, ndgTag, DFREF_WILDCARD, DF_CURRENT);
+            
+            } /* while (more NDGs) */
+        
+          if (Hendaccess(aid) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+        
+          /*
+           * Set up the structures in the proper form
+           */
+          if(current_dim)
+            {
+              handle->dims = NC_new_array(NC_DIMENSION, current_dim, (Void *) dims);
+              if (NULL == handle->dims)
+                {
+                    ret_value = FAIL;
+                    goto done;
+                }
+            }
+          else
+              handle->dims = NULL;
+        
+          if(current_var)
+            {
+              handle->vars = NC_new_array(NC_VARIABLE, current_var, (Void *) vars);
+              if (NULL == handle->vars)
+                {
+                    ret_value = FAIL;
+                    goto done;
+                }
+            }
+          else
+              handle->vars = NULL;
+        
+      } /* outermost for loop to loop between NDGs and SDGs */
+
+done:
+    if (ret_value == FAIL)
+      { /* FAIL cleanup? */
+          if(labelbuf != NULL)  
+              HDfree((VOIDP)labelbuf);
+          if(scalebuf != NULL)
+              HDfree((VOIDP)scalebuf);
+          if(unitbuf != NULL)  
+              HDfree((VOIDP)unitbuf);
+          if(formatbuf != NULL)  
+              HDfree((VOIDP)formatbuf);
+          if (dimsizes != NULL)
+              HDfree((VOIDP)dimsizes);
+          if (vardims != NULL)
+              HDfree((VOIDP)vardims);
+          if (scaletypes != NULL)
+              HDfree((VOIDP)scaletypes);
+
+      }
+    /* Normal cleanup */
+    if (dims != NULL)
+        HDfree((VOIDP)dims);
+    if (vars != NULL)
+        HDfree((VOIDP)vars);
+    if (attrs != NULL)
+        HDfree((VOIDP)attrs);
+
+    return ret_value;
+} /* hdf_read_ndgs */
+
+
+/******************************************************************************
+ NAME
+   hdf_read_sds_cdf
+ 
+ DESCRIPTION
+   Read SDSs out of an HDF file an pretend like they are netCDF objects
+   We can already assume that the file is open and that it is in fact
+   an HDF file
+
+ RETURNS
+   SUCCEED / FAIL
+ 
+******************************************************************************/
+int
+hdf_read_sds_cdf(XDR *xdrs, 
+                 NC **handlep)
+{
+    int32  status;
+    NC     *handle = NULL;
+    intn  ret_value = SUCCEED;
+    
+    /* 
+     * go through and treat each SDS as a separate varibiable 
+     */
+
+    /* 
+     * should we try to create an unlimited dimension somehow ???
+     */
+    
+    /* we haven't seen any SDG-NDG combos yet */
+    HDfreenclear(sdgTable);
+
+    handle = (*handlep);
+    if(NULL == handle) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    status = hdf_read_ndgs(handle);
+    if(status == FAIL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* deallocate SDG-NDG space */
+    if(sdgTable != NULL) 
+        HDfree((VOIDP)sdgTable);
+
+    sdgTable = NULL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_read_sds_cdf */
+
+#endif /* HDF */
diff --git a/mfhdf/libsrc/iarray.c b/mfhdf/libsrc/iarray.c
new file mode 100644
index 0000000..b41b3b7
--- /dev/null
+++ b/mfhdf/libsrc/iarray.c
@@ -0,0 +1,133 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: iarray.c 4963 2007-09-15 17:20:52Z bmribler $ */
+
+#include	"local_nc.h"
+#include	"alloc.h"
+
+
+NC_iarray *
+NC_new_iarray(count, values)
+unsigned count ;
+const int *values ;           /* VAX C doesn't like values[] */
+{
+	NC_iarray *ret ;
+	int *ip ;
+	size_t memlen ;
+
+	ret = (NC_iarray *)HDmalloc(sizeof(NC_iarray)) ;
+	if( ret == NULL )
+		goto alloc_err ;
+	ret->count = count ;
+	if(count != 0 ) /* allocate */
+      {
+          memlen = count * sizeof(int) ;
+          ret->values = (int *)HDmalloc(memlen) ;
+          if(ret->values == NULL)
+              goto alloc_err ;
+          if(values != NULL) /* copy them in */
+            {
+                for(ip = ret->values ; count > 0; count--)
+                    *ip++ = *values++ ;
+            }
+      } else {
+          ret->values = NULL ;
+      }
+	
+	return(ret) ;
+    alloc_err :
+        nc_serror("NC_new_iarray") ;
+	return(NULL) ;
+}
+
+
+/*
+ * Free iarray, and, if needed, its values.
+ *
+ * NOTE: Changed return value to return 'int' 
+ *       If successful returns SUCCEED else FAIL -GV 9/19/97
+ */
+int
+NC_free_iarray(iarray)
+NC_iarray *iarray ;
+{
+    int ret_value = SUCCEED;
+
+	if(iarray != NULL)
+      {
+          if(iarray->values != NULL)
+              Free(iarray->values) ;
+          Free(iarray) ;
+      }
+
+    return ret_value;
+}
+
+
+bool_t
+xdr_NC_iarray(xdrs, ipp)
+	XDR *xdrs;
+	NC_iarray **ipp;
+{
+	int *ip ;
+	u_long count ;
+	bool_t stat = TRUE ;
+
+	switch (xdrs->x_op) {
+	case XDR_FREE:
+		NC_free_iarray((*ipp)) ;
+		return(TRUE) ;
+	case XDR_DECODE:
+		/* need the length to pass to new */
+		if (! xdr_u_long(xdrs, &count)) {
+			return (FALSE);
+		}
+		(*ipp) = NC_new_iarray((unsigned)count, (int *)NULL) ;
+		if((*ipp) == NULL)
+			return(FALSE) ;
+		/* then deal with the array */
+		for( ip = (*ipp)->values ; (count > 0 ) && stat ; count-- )
+			stat = xdr_int(xdrs, ip++ ) ;
+		return(stat) ;
+	case XDR_ENCODE:
+		/* first deal with the length */
+		count = (*ipp)->count ;
+		if (! xdr_u_long(xdrs, &count) ) {
+			return (FALSE);
+		}
+		/* then deal with the array */
+		for(ip = (*ipp)->values  ; (count > 0 ) && stat ; count--)
+			stat = xdr_int(xdrs, ip++ ) ;
+		return(stat) ;
+	}
+	return(FALSE) ;
+}
+
+
+/*
+ * How much space will the xdr'd iarray take.
+ */
+int NC_xlen_iarray(iarray)
+NC_iarray *iarray ;
+{
+	int len = 4 ;
+	if(iarray!=NULL)
+	{
+		len += iarray->count * 4 ;
+	}
+	return(len) ;
+}
diff --git a/mfhdf/libsrc/local_nc.h b/mfhdf/libsrc/local_nc.h
new file mode 100644
index 0000000..039e084
--- /dev/null
+++ b/mfhdf/libsrc/local_nc.h
@@ -0,0 +1,800 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: local_nc.h 6043 2014-01-21 21:09:03Z acheng $ */
+#ifndef _LOCAL_NC_
+#define _LOCAL_NC_
+
+#include "H4api_adpt.h"
+/*
+ *	netcdf library 'private' data structures, objects and interfaces
+ */
+
+#include	<stddef.h> /* size_t */
+#include	<stdio.h> /* FILENAME_MAX */
+
+#ifndef FILENAME_MAX
+#define FILENAME_MAX  255
+#endif
+
+/* Do we have systeme XDR files */
+#ifndef  NO_SYS_XDR_INC 
+#include	<rpc/types.h>
+#include	<rpc/xdr.h>
+#else    /* NO_SYS_XDR_INC */
+#include      <types.h>  /* <types.h */
+#include      <xdr.h>    /* <xdr.h> */
+#endif /* NO_SYSTEM_XDR_INCLUDES */
+
+#include "H4api_adpt.h"
+#ifdef H4_HAVE_NETCDF
+#include	"netcdf.h" /* needed for defs of nc_type, ncvoid, ... */
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+/* ptr argument type in internal functions */
+#define Void    char
+
+/*
+** Include HDF stuff
+*/
+#ifdef HDF
+
+#include "hdf.h"
+#include "vg.h"
+#include "hfile.h"
+#include "mfhdfi.h"
+
+#define ATTR_TAG  DFTAG_VH
+#define DIM_TAG   DFTAG_VG
+#define VAR_TAG   DFTAG_VG
+#define DATA_TAG  DFTAG_SD
+#define BOGUS_TAG ((uint16) 721)
+
+#if 0
+#define ATTRIBUTE         "Attr0.0"
+#define VARIABLE          "Var0.0"
+#define DIMENSION         "Dim0.0"
+#define UDIMENSION        "UDim0.0"
+#define DIM_VALS          "DimVal0.0" 
+#define DIM_VALS01        "DimVal0.1"
+#define CDF               "CDF0.0"
+/* DATA is defined in DTM. Change DATA to DATA0 *
+#define DATA              "Data0.0"
+*/
+#define DATA0             "Data0.0"
+#define ATTR_FIELD_NAME   "VALUES"
+#endif
+
+#define DIMVAL_VERSION00  0  /* <dimsize> fake values */
+#define DIMVAL_VERSION01  1  /* 1 elt with value of <dimsize>  */
+#define BLOCK_MULT  64    /* multiplier for bytes in linked blocks */
+#define MAX_BLOCK_SIZE  65536    /* maximum size of block in linked blocks */
+#define BLOCK_COUNT 128   /* size of linked block pointer objects  */
+
+#endif /* HDF */
+
+/* from cdflib.h CDF 2.3 */
+#ifndef MAX_VXR_ENTRIES
+#define MAX_VXR_ENTRIES                 10
+#endif /* MAX_VXR_ENTRIES */
+
+#ifdef HDF
+/* VIX record for CDF variable data storage */
+typedef struct vix_t_def {
+    int32              nEntries;                    /* number of entries in this vix */
+    int32              nUsed;                       /* number of entries containing valid data */
+    int32              firstRec[MAX_VXR_ENTRIES];   /* number of first records */
+    int32              lastRec[MAX_VXR_ENTRIES];    /* number of last records */
+    int32              offset[MAX_VXR_ENTRIES];     /* file offset of records */
+    struct vix_t_def * next;                        /* next one in line */
+} vix_t;
+#endif /* HDF */
+
+/* like, a discriminated union in the sense of xdr */
+typedef struct {
+	nc_type type ;		/* the discriminant */
+	size_t len ;		/* the total length originally allocated */
+	size_t szof ;		/* sizeof each value */
+	unsigned count ;	/* length of the array */
+	Void *values ;		/* the actual data */
+} NC_array ;
+
+/* Counted string for names and such */
+/* 
+
+  count is the actual size of the buffer for the string
+  len is the length of the string in the buffer
+  
+  count != len when a string is resized to something smaller
+
+*/
+#ifdef HDF
+#define NC_compare_string(s1,s2) ((s1)->hash!=(s2)->hash ? 1 : HDstrcmp((s1)->values,(s2)->values))
+#endif /* HDF */
+
+typedef struct {
+	unsigned count ;
+    unsigned len ; 
+#ifdef HDF
+    uint32 hash;        /* [non-perfect] hash value for faster comparisons */
+#endif /* HDF */
+	char *values ;
+} NC_string ;
+
+/* Counted array of ints for assoc list */
+typedef struct {
+	unsigned count ;
+	int *values ;
+} NC_iarray ;
+
+/* NC dimension stucture */
+typedef struct {
+	NC_string *name ;
+    long size ;
+#ifdef HDF
+    int32 dim00_compat;   /* compatible with Dim0.0 */
+	int32 vgid;   /* id of the Vgroup representing this dimension */
+    int32 count;  /* Number of pointers to this dimension */
+#endif
+} NC_dim ;
+
+/* NC attribute */
+typedef struct {
+	NC_string	*name ;
+	NC_array	*data ;
+#ifdef HDF
+	int32           HDFtype; /* it should be in NC_array *data. However, */
+                             /* NC.dims and NC.vars are NC_array too. */
+#endif
+} NC_attr ;
+
+typedef struct {
+	char path[FILENAME_MAX + 1] ;
+	unsigned flags ;
+	XDR *xdrs ;
+	long begin_rec ; /* (off_t) postion of the first 'record' */
+	unsigned long recsize ; /* length of 'record' */
+	int redefid ;
+	/* below gets xdr'd */
+	unsigned long numrecs ; /* number of 'records' allocated */
+	NC_array *dims ;
+	NC_array *attrs ;
+	NC_array *vars ;
+#ifdef HDF
+	int32 hdf_file;
+    int file_type;
+    int32 vgid;
+    int hdf_mode; /* mode we are attached for */
+    hdf_file_t cdf_fp; /* file pointer used for CDF files */
+#endif
+} NC ;
+
+/* NC variable: description and data */
+typedef struct {
+	NC_string *name ;	/* name->values shows data set's name */
+	NC_iarray *assoc ;	/* user definition */
+	unsigned long *shape ;	/* compiled info (Each holds a dimension size. -BMR) */
+	unsigned long *dsizes ;	/* compiled info (Each element holds the amount of space
+			needed to hold values in that dimension, e.g., first dimension
+			size is 10, value type is int32=4, then dsizes[0]=4*10=40. -BMR) */
+	NC_array *attrs;	/* list of attribute structures */
+	nc_type type ;		/* the discriminant */
+	unsigned long len ;	/* the total length originally allocated */
+	size_t szof ;		/* sizeof each value */
+	long begin ;		/* seek index, often an off_t */
+#ifdef HDF
+	NC *cdf;	/* handle of the file where this var belongs to  */
+	int32 vgid;	/* id of the variable's Vgroup */
+	uint16 data_ref;/* ref of the variable's data storage (if exists), default 0 */
+	uint16 data_tag;/* tag of the variable's data storage (if exists), default DATA_TAG */
+	uint16 ndg_ref; /* ref of ndg for this dataset */
+	hdf_vartype_t var_type; /* type of this variable, default UNKNOWN
+			IS_SDSVAR == this var is an SDS variable 
+			IS_CRDVAR == this var is a coordinate variable 
+			UNKNOWN == because the var was created prior to this distinction.
+	This is to distinguish b/w a one-dim data set and a coord var of the same name.
+	It's less riskier than using a flag and change the file format, I think. -BMR */
+	intn   data_offset; /* non-traditional data may not begin at 0 */
+	int32  block_size;  /* size of the blocks for unlimited dim. datasets, default -1 */
+	int numrecs;	/* number of records this has been filled up to, for unlimited dim */
+	int32 aid;	/* aid for DFTAG_SD data */
+	int32 HDFtype;	/* type of this variable as HDF thinks */
+	int32 HDFsize;	/* size of this variable as HDF thinks */
+    /* These next two flags control when space in the file is allocated
+        for a new dataset.  They are used (currently) in SDwritedata() and
+        hdf_get_vp_aid() to allocate the full length of a new fixed-size dataset
+        which is not writing fill values, instead of letting them get created
+        as an "appendable" dataset and probably get converted into a linked-
+        block special element when they don't need to be one */
+	int32   created;    /* BOOLEAN == is newly created */
+	int32   set_length; /* BOOLEAN == needs length set */
+	int32   is_ragged;  /* BOOLEAN == is a ragged array */
+	int32 * rag_list;   /* size of ragged array lines */
+	int32   rag_fill;   /* last line in rag_list to be set */
+	vix_t * vixHead;    /* list of VXR records for CDF data storage */
+#endif
+} NC_var ;
+
+#define IS_RECVAR(vp) \
+	((vp)->shape != NULL ? (*(vp)->shape == NC_UNLIMITED) : 0 )
+
+#define netCDF_FILE  0
+#define HDF_FILE     1
+#define CDF_FILE     2
+
+HDFLIBAPI const char *cdf_routine_name ; /* defined in lerror.c */
+
+               /*  C D F 1 */
+#define	NCMAGIC	0x43444601
+                       /*  C D L 1 */
+#define	NCLINKMAGIC	0x43444c01
+
+/* #ifndef HDF *//* HDF has already worked out if we have prototypes */
+#ifdef HDF
+#define PROTOTYPE
+#endif
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+/* #endif */ /* HDF */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* If using the real netCDF library and API (when --disable-netcdf configure flag is used)
+   need to mangle the HDF versions of netCDF API function names 
+   to not conflict w/ oriinal netCDF ones */
+#ifndef H4_HAVE_NETCDF
+#define nc_serror        HNAME(nc_serror)
+#define NCadvise         HNAME(NCadvise)
+#define NC_computeshapes HNAME(NC_computeshapes)
+#define NC_xtypelen      HNAME(NC_xtypelen)
+#define NC_xlen_array    HNAME(NC_xlen_array)
+#define NC_xlen_attr     HNAME(NC_xlen_attr)
+#define NC_xlen_cdf      HNAME(NC_xlen_cdf)
+#define NC_xlen_dim      HNAME(NC_xlen_dim)
+#define NC_xlen_iarray   HNAME(NC_xlen_iarray)
+#define NC_xlen_string   HNAME(NC_xlen_string)
+#define NC_xlen_var      HNAME(NC_xlen_var)
+#define NCmemset         HNAME(NCmemset)
+#define NC_arrayfill     HNAME(NC_arrayfill)
+#define NC_copy_arrayvals HNAME(NC_copy_arrayvals)
+#define NC_free_array    HNAME(NC_free_array)
+#define NC_free_attr     HNAME(NC_free_attr)
+#define NC_free_cdf      HNAME(NC_free_cdf)
+#define NC_free_dim      HNAME(NC_free_dim)
+#define NC_free_iarray   HNAME(NC_free_iarray)
+#define NC_free_string   HNAME(NC_free_string)
+#define NC_free_var      HNAME(NC_free_var)
+#define NC_incr_array    HNAME(NC_incr_array)
+#define NC_dimid         HNAME(NC_dimid)
+#define NCcktype         HNAME(NCcktype)
+#define NC_indefine      HNAME(NC_indefine)
+#define xdr_cdf          HNAME(xdr_cdf)
+#define xdr_numrecs      HNAME(xdr_numrecs)
+#define xdr_shorts       HNAME(xdr_shorts)
+#define xdr_NC_array     HNAME(xdr_NC_array)
+#define xdr_NC_attr      HNAME(xdr_NC_attr)
+#define xdr_NC_dim       HNAME(xdr_NC_dim)
+#define xdr_NC_fill      HNAME(xdr_NC_fill)
+#define xdr_NC_iarray    HNAME(xdr_NC_iarray)
+#define xdr_NC_string    HNAME(xdr_NC_string)
+#define xdr_NC_var       HNAME(xdr_NC_var)
+#define NC_typelen       HNAME(NC_typelen)
+#define NC_check_id      HNAME(NC_check_id)
+#define NC_dup_cdf       HNAME(NC_dup_cdf)
+#define NC_new_cdf       HNAME(NC_new_cdf)
+#define NC_new_array     HNAME(NC_new_array)
+#define NC_re_array      HNAME(NC_re_array)
+#define NC_new_attr      HNAME(NC_new_attr)
+#define NC_findattr      HNAME(NC_findattr)
+#define NC_new_dim       HNAME(NC_new_dim)
+#define NC_new_iarray    HNAME(NC_new_iarray)
+#define NC_new_string    HNAME(NC_new_string)
+#define NC_re_string     HNAME(NC_re_string)
+#define NC_hlookupvar    HNAME(NC_hlookupvar)
+#define NC_new_var       HNAME(NC_new_var)
+#define NCvario          HNAME(NCvario)
+#define NCcoordck        HNAME(NCcoordck)
+#define xdr_NCvshort     HNAME(xdr_NCvshort)
+#define NC_dcpy          HNAME(NC_dcpy)
+#define NCxdrfile_sync   HNAME(NCxdrfile_sync)
+#define NCxdrfile_create HNAME(NCxdrfile_create)
+#ifdef HDF
+#define NCgenio          HNAME(NCgenio)      /* from putgetg.c */
+#define NC_var_shape     HNAME(NC_var_shape) /* from var.c */
+#endif
+#endif /* !H4_HAVE_NETCDF ie. NOT USING HDF version of netCDF ncxxx API */
+
+#define nncpopt           H4_F77_FUNC(ncpopt, NCPOPT)
+#define nncgopt           H4_F77_FUNC(ncgopt, NCGOPT)
+#define nnccre            H4_F77_FUNC(nccre, NCCRE)
+#define nncopn            H4_F77_FUNC(ncopn, NCOPN)
+#define nncddef           H4_F77_FUNC(ncddef, NCDDEF)
+#define nncdid            H4_F77_FUNC(ncdid, NCDID)
+#define nncvdef           H4_F77_FUNC(ncvdef, NCVDEF)
+#define nncvid            H4_F77_FUNC(ncvid, NCVID)
+#define nnctlen           H4_F77_FUNC(nctlen, NCTLEN)
+#define nncclos           H4_F77_FUNC(ncclos, NCCLOS)
+#define nncredf           H4_F77_FUNC(ncredf, NCREDF)
+#define nncendf           H4_F77_FUNC(ncendf, NCENDF)
+#define nncinq            H4_F77_FUNC(ncinq, NCINQ)
+#define nncsnc            H4_F77_FUNC(ncsnc, NCSNC)
+#define nncabor           H4_F77_FUNC(ncabor, NCABOR)
+#define nncdinq           H4_F77_FUNC(ncdinq, NCDINQ)
+#define nncdren           H4_F77_FUNC(ncdren, NCDREN)
+#define nncvinq           H4_F77_FUNC(ncvinq, NCVINQ)
+#define nncvpt1           H4_F77_FUNC(ncvpt1, NCVPT1)
+#define nncvp1c           H4_F77_FUNC(ncvp1c, NCVP1C)
+#define nncvpt            H4_F77_FUNC(ncvpt, NCVPT)
+#define nncvptc           H4_F77_FUNC(ncvptc, NCVPTC)
+#define nncvptg           H4_F77_FUNC(ncvptg, NCVPTG)
+#define nncvpgc           H4_F77_FUNC(ncvpgc, NCVPGC)
+#define nncvgt1           H4_F77_FUNC(ncvgt1, NCVGT1)
+#define nncvg1c           H4_F77_FUNC(ncvg1c, NCVG1C)
+#define nncvgt            H4_F77_FUNC(ncvgt, NCVGT)
+#define nncvgtc           H4_F77_FUNC(ncvgtc, NCVGTC)
+#define nncvgtg           H4_F77_FUNC(ncvgtg, NCVGTG)
+#define nncvggc           H4_F77_FUNC(ncvggc, NCVGGC)
+#define nncvren           H4_F77_FUNC(ncvren, NCVREN)
+#define nncapt            H4_F77_FUNC(ncapt, NCAPT)
+#define nncaptc           H4_F77_FUNC(ncaptc, NCAPTC)
+#define nncainq           H4_F77_FUNC(ncainq, NCAINQ)
+#define nncagt            H4_F77_FUNC(ncagt, NCAGT)
+#define nncagtc           H4_F77_FUNC(ncagtc, NCAGTC)
+#define nncacpy           H4_F77_FUNC(ncacpy, NCACPY)
+#define nncanam           H4_F77_FUNC(ncanam, NCANAM)
+#define nncaren           H4_F77_FUNC(ncaren, NCAREN)
+#define nncadel           H4_F77_FUNC(ncadel, NCADEL)
+#define nncsfil           H4_F77_FUNC(ncsfil, NCSFIL)
+
+#ifdef WIN32
+HDFFCLIBAPI void nncpopt
+    PROTO((int* val));
+HDFFCLIBAPI void nncgopt
+    PROTO((int* val));
+HDFFCLIBAPI int nnccre
+    PROTO((char* pathname, int* clobmode, int* rcode, int pathnamelen));
+HDFFCLIBAPI int nncopn
+    PROTO((char* pathname, int* rwmode, int* rcode, int pathnamelen));
+HDFFCLIBAPI int nncddef
+    PROTO((int* cdfid, char* dimname, int* dimlen, int* rcode, int dimnamelen));
+HDFFCLIBAPI int nncdid
+    PROTO((int* cdfid, char* dimname, int* rcode, int dimnamelen));
+HDFFCLIBAPI int nncvdef
+    PROTO((int* cdfid, char* varname, int* datatype, int* ndims, int* dimarray, int* rcode, int varnamelen));
+HDFFCLIBAPI int nncvid
+    PROTO((int* cdfid, char* varname, int* rcode, int varnamelen));
+HDFFCLIBAPI int nnctlen
+    PROTO((int* datatype, int* rcode));
+HDFFCLIBAPI void nncclos
+    PROTO((int* cdfid, int* rcode));
+HDFFCLIBAPI void nncredf
+    PROTO((int* cdfid, int* rcode));
+HDFFCLIBAPI void nncendf
+    PROTO((int* cdfid, int* rcode));
+HDFFCLIBAPI void nncinq
+    PROTO((int* cdfid, int* ndims, int* nvars, int* natts, int* recdim, int* rcode));
+HDFFCLIBAPI void nncsnc
+    PROTO((int* cdfid, int* rcode));
+HDFFCLIBAPI void nncabor
+    PROTO((int* cdfid, int* rcode));
+HDFFCLIBAPI void nncdinq
+    PROTO((int* cdfid, int* dimid, char* dimname, int* size, int* rcode, int dimnamelen));
+HDFFCLIBAPI void nncdren
+    PROTO((int* cdfid, int* dimid, char* dimname, int* rcode, int dimnamelen));
+HDFFCLIBAPI void nncvinq
+    PROTO((int* cdfid, int* varid, char* varname, int* datatype, int* ndims, int* dimarray, int* natts, int* rcode, int varnamelen));
+HDFFCLIBAPI void nncvpt1
+    PROTO((int* cdfid, int* varid, int* indices, void* value, int* rcode));
+HDFFCLIBAPI void nncvp1c
+    PROTO((int* cdfid, int* varid, int* indices, char* chval, int* rcode, int chvallen));
+HDFFCLIBAPI void nncvpt
+    PROTO((int* cdfid, int* varid, int* start, int* count, void* value, int* rcode));
+HDFFCLIBAPI void nncvptc
+    PROTO((int* cdfid, int* varid, int* start, int* count, char* string, int* lenstr, int* rcode, int stringlen));
+HDFFCLIBAPI void nncvptg
+    PROTO((int* cdfid, int* varid, int* start, int* count, int* stride, int* basis, void* value, int* rcode));
+HDFFCLIBAPI void nncvpgc
+    PROTO((int* cdfid, int* varid, int* start, int* count, int* stride, int* basis, char* string, int* rcode, int stringlen));
+HDFFCLIBAPI void nncvgt1
+    PROTO((int* cdfid, int* varid, int* indices, void* value, int* rcode));
+HDFFCLIBAPI void nncvg1c
+    PROTO((int* cdfid, int* varid, int* indices, char* chval, int* rcode, int chvallen));
+HDFFCLIBAPI void nncvgt
+    PROTO((int* cdfid, int* varid, int* start, int* count, void* value, int* rcode));
+HDFFCLIBAPI void nncvgtc
+    PROTO((int* cdfid, int* varid, int* start, int* count, char* string, int* lenstr, int* rcode, int stringlen));
+HDFFCLIBAPI void nncvgtg
+    PROTO((int* cdfid, int* varid, int* start, int* count, int* stride, int* basis, void* value, int* rcode));
+HDFFCLIBAPI void nncvggc
+    PROTO((int* cdfid, int* varid, int* start, int* count, int* stride, int* basis, char* string, int* rcode, int stringlen));
+HDFFCLIBAPI void nncvren
+    PROTO((int* cdfid, int* varid, char* varname, int* rcode, int varnamelen));
+HDFFCLIBAPI void nncapt
+    PROTO((int* cdfid, int* varid, char* attname, int* datatype, int* attlen, void* value, int* rcode, int attnamelen));
+HDFFCLIBAPI void nncaptc
+    PROTO((int* cdfid, int* varid, char* attname, int* datatype, int* lenstr, char* string, int* rcode, int attnamelen, int stringlen));
+HDFFCLIBAPI void nncainq
+    PROTO((int* cdfid, int* varid, char* attname, int* datatype, int* attlen, int* rcode, int attnamelen));
+HDFFCLIBAPI void nncagt
+    PROTO((int* cdfid, int* varid, char* attname, void* value, int* rcode, int attnamelen));
+HDFFCLIBAPI void nncagtc
+    PROTO((int* cdfid, int* varid, char* attname, char* string, int* lenstr, int* rcode, int attnamelen, int stringlen));
+HDFFCLIBAPI void nncacpy
+    PROTO((int* incdfid, int* invarid, char* attname, int* outcdfid, int* outvarid, int* rcode, int attnamelen));
+HDFFCLIBAPI void nncanam
+    PROTO((int* cdfid, int* varid, int* attnum, char* attname, int* rcode, int attnamelen));
+HDFFCLIBAPI void nncaren
+    PROTO((int* cdfid, int* varid, char* attname, char* newname, int* rcode, int attnamelen, int newnamelen));
+HDFFCLIBAPI void nncadel
+    PROTO((int* cdfid, int* varid, char* attname, int* rcode, int attnamelen));
+HDFFCLIBAPI int nncsfil
+    PROTO((int* cdfid, int* fillmode, int* rcode));
+#endif
+
+HDFLIBAPI void		nc_serror			PROTO((
+	const char *fmt,
+	...
+)) ;
+HDFLIBAPI void		NCadvise			PROTO((
+	int err,
+	const char *fmt,
+	...
+)) ;
+
+HDFLIBAPI int        NC_computeshapes	PROTO((
+    NC		*handle
+));
+HDFLIBAPI int        NC_xtypelen		PROTO((
+    nc_type	type
+));
+HDFLIBAPI int        NC_xlen_array		PROTO((
+    NC_array	*array
+));
+HDFLIBAPI int        NC_xlen_attr		PROTO((
+    NC_attr	**app
+));
+HDFLIBAPI int        NC_xlen_cdf		PROTO((
+    NC		*cdf
+));
+HDFLIBAPI int        NC_xlen_dim		PROTO((
+    NC_dim	**dpp
+));
+HDFLIBAPI int        NC_xlen_iarray	PROTO((
+    NC_iarray	*iarray
+));
+HDFLIBAPI int        NC_xlen_string	PROTO((
+    NC_string	*cdfstr
+));
+HDFLIBAPI int        NC_xlen_var		PROTO((
+    NC_var	**vpp
+));
+
+HDFLIBAPI char       *NCmemset		PROTO((
+    char	*s,
+    int		c,
+    int		n
+));
+
+HDFLIBAPI void       NC_arrayfill		PROTO((
+    void	*lo,
+    size_t	len,
+    nc_type	type
+));
+HDFLIBAPI void       NC_copy_arrayvals	PROTO((
+    char	*target,
+    NC_array	*array
+));
+HDFLIBAPI int       NC_free_array		PROTO((
+    NC_array	*array
+));
+HDFLIBAPI int       NC_free_attr		PROTO((
+    NC_attr	*attr
+));
+HDFLIBAPI int       NC_free_cdf		PROTO((
+    NC		*handle
+));
+HDFLIBAPI int       NC_free_dim		PROTO((
+    NC_dim	*dim
+));
+HDFLIBAPI int       NC_free_iarray	PROTO((
+    NC_iarray	*iarray
+));
+HDFLIBAPI int       NC_free_string	PROTO((
+    NC_string	*cdfstr
+));
+HDFLIBAPI int       NC_free_var		PROTO((
+    NC_var	*var
+));
+
+HDFLIBAPI Void      *NC_incr_array		PROTO((
+    NC_array	*array,
+    Void	*tail
+));
+
+HDFLIBAPI int       NC_dimid               PROTO((
+    NC          *handle,
+    char        *name
+));
+HDFLIBAPI bool_t     NCcktype		PROTO((
+    nc_type	datatype
+));
+HDFLIBAPI bool_t     NC_indefine		PROTO((
+    int		cdfid,
+    bool_t	iserr
+));
+HDFLIBAPI bool_t     xdr_cdf		PROTO((
+    XDR		*xdrs,
+    NC		**handlep
+));
+HDFLIBAPI bool_t     xdr_numrecs		PROTO((
+    XDR		*xdrs,
+    NC		*handle
+));
+HDFLIBAPI bool_t     xdr_shorts		PROTO((
+    XDR		*xdrs,
+    short	*sp,
+    u_int	cnt
+));
+HDFLIBAPI bool_t     xdr_NC_array		PROTO((
+    XDR		*xdrs,
+    NC_array	**app
+));
+HDFLIBAPI bool_t     xdr_NC_attr		PROTO((
+    XDR		*xdrs,
+    NC_attr	**app
+));
+HDFLIBAPI bool_t     xdr_NC_dim		PROTO((
+    XDR		*xdrs,
+    NC_dim	**dpp
+));
+HDFLIBAPI bool_t     xdr_NC_fill		PROTO((
+    XDR		*xdrs,
+    NC_var	*vp
+));
+HDFLIBAPI bool_t     xdr_NC_iarray		PROTO((
+    XDR		*xdrs,
+    NC_iarray	**ipp
+));
+HDFLIBAPI bool_t     xdr_NC_string		PROTO((
+    XDR		*xdrs,
+    NC_string	**spp
+));
+HDFLIBAPI bool_t     xdr_NC_var		PROTO((
+    XDR		*xdrs,
+    NC_var	**vpp
+));
+
+HDFLIBAPI size_t     NC_typelen		PROTO((
+    nc_type	type
+));
+
+HDFLIBAPI NC        *NC_check_id		PROTO((
+    int		cdfid
+));
+HDFLIBAPI NC        *NC_dup_cdf		PROTO((
+    const char *name,
+	int     mode,
+    NC		*old
+));
+HDFLIBAPI NC        *NC_new_cdf		PROTO((
+    const char *name,
+    int		mode
+));
+HDFLIBAPI NC_array  *NC_new_array		PROTO((
+    nc_type	type,
+    unsigned	count,
+    const void	*values
+));
+HDFLIBAPI NC_array  *NC_re_array		PROTO((
+    NC_array	*old,
+    nc_type	type,
+    unsigned	count,
+    const void	*values
+));
+HDFLIBAPI NC_attr  *NC_new_attr        PROTO((
+    const char *name,
+    nc_type type,
+    unsigned count ,
+    const void *values
+));
+HDFLIBAPI NC_attr  **NC_findattr		PROTO((
+    NC_array	**ap,
+    const char	*name
+));
+HDFLIBAPI NC_dim    *NC_new_dim		PROTO((
+    const char	*name,
+    long	size
+));
+HDFLIBAPI NC_iarray *NC_new_iarray		PROTO((
+    unsigned	count,
+    const int		values[]
+));
+HDFLIBAPI NC_string *NC_new_string		PROTO((
+    unsigned	count,
+    const char	*str
+));
+HDFLIBAPI NC_string *NC_re_string		PROTO((
+    NC_string	*old,
+    unsigned	count,
+    const char	*str
+));
+HDFLIBAPI NC_var    *NC_hlookupvar		PROTO((
+    NC		*handle,
+    int		varid
+));
+HDFLIBAPI NC_var    *NC_new_var		PROTO((
+    const char	*name,
+    nc_type	type,
+    int		ndims,
+    const int		*dims
+));
+HDFLIBAPI int	NCvario			PROTO((
+	NC *handle,
+	int varid,
+	const long *start,
+	const long *edges,
+	void *values
+));
+HDFLIBAPI bool_t	NCcoordck	PROTO((
+	NC *handle,
+	NC_var *vp, 
+	const long *coords
+));
+HDFLIBAPI bool_t xdr_NCvshort    PROTO((
+        XDR *xdrs,
+        unsigned which,
+        short *values
+));
+HDFLIBAPI bool_t	NC_dcpy			PROTO((
+	XDR *target,
+	XDR *source,
+	long nbytes
+));
+HDFLIBAPI int NCxdrfile_sync
+    PROTO((XDR *xdrs));
+
+HDFLIBAPI int NCxdrfile_create
+    PROTO((XDR *xdrs,const char *path,int ncmode));
+
+#ifdef HDF
+/* this routine is found in 'xdrposix.c' */
+HDFLIBAPI void hdf_xdrfile_create
+    PROTO(( XDR *xdrs, int ncop));
+
+HDFLIBAPI intn hdf_fill_array
+    PROTO((Void  * storage,int32 len,Void  * value,int32 type));
+
+HDFLIBAPI intn hdf_get_data
+    PROTO((NC *handle,NC_var *vp));
+
+HDFLIBAPI int32 hdf_get_vp_aid
+    PROTO((NC *handle, NC_var *vp));
+
+HDFLIBAPI int hdf_map_type
+    PROTO((nc_type ));
+
+HDFLIBAPI nc_type hdf_unmap_type
+    PROTO((int ));
+
+HDFLIBAPI intn hdf_get_ref
+    PROTO((NC *,int ));
+
+HDFLIBAPI intn hdf_create_dim_vdata
+    PROTO((XDR *,NC *,NC_dim *));
+
+HDFLIBAPI intn hdf_create_compat_dim_vdata
+    PROTO((XDR *xdrs, NC *handle, NC_dim *dim, int32 dimval_ver));
+
+HDFLIBAPI intn hdf_write_attr
+    PROTO((XDR *,NC *,NC_attr **));
+
+HDFLIBAPI int32 hdf_write_dim
+    PROTO((XDR *,NC *,NC_dim **,int32));
+
+HDFLIBAPI int32 hdf_write_var
+    PROTO((XDR *,NC *,NC_var **));
+
+HDFLIBAPI intn hdf_write_xdr_cdf
+    PROTO((XDR *,NC **));
+
+HDFLIBAPI intn hdf_conv_scales
+    PROTO((NC **));
+
+HDFLIBAPI intn hdf_read_dims
+    PROTO((XDR *,NC *,int32 ));
+
+HDFLIBAPI NC_array *hdf_read_attrs
+    PROTO((XDR *,NC *,int32 ));
+
+HDFLIBAPI intn hdf_read_vars
+    PROTO((XDR *,NC *,int32 ));
+
+HDFLIBAPI intn hdf_read_xdr_cdf
+    PROTO((XDR *,NC **));
+
+HDFLIBAPI intn hdf_xdr_cdf
+    PROTO((XDR *,NC **));
+
+HDFLIBAPI intn hdf_vg_clobber
+    PROTO((NC *,int ));
+
+HDFLIBAPI intn hdf_cdf_clobber
+    PROTO((NC *));
+
+HDFLIBAPI intn hdf_close
+    PROTO((NC *));
+
+HDFLIBAPI intn hdf_read_sds_dims
+    PROTO((NC *));
+
+HDFLIBAPI intn hdf_read_sds_cdf
+    PROTO((XDR *,NC **));
+
+HDFLIBAPI intn SDPfreebuf PROTO((void));
+
+HDFLIBAPI intn NCgenio
+    PROTO((NC *handle, int varid, const long *start, const long *count,
+        const long *stride, const long *imap, void *values));
+
+HDFLIBAPI intn NC_var_shape
+    PROTO((NC_var *var,NC_array *dims));
+
+HDFLIBAPI intn NC_reset_maxopenfiles
+    PROTO((intn req_max));
+
+HDFLIBAPI intn NC_get_maxopenfiles
+    PROTO(());
+
+HDFLIBAPI intn NC_get_systemlimit
+    PROTO(());
+
+HDFLIBAPI int NC_get_numopencdfs
+    PROTO(());
+
+/* CDF stuff. don't need anymore? -GV */
+HDFLIBAPI nc_type cdf_unmap_type
+    PROTO((int type));
+
+HDFLIBAPI bool_t nssdc_read_cdf
+    PROTO((XDR *xdrs, NC **handlep));
+
+HDFLIBAPI bool_t nssdc_write_cdf
+   PROTO((XDR *xdrs, NC **handlep));
+
+HDFLIBAPI bool_t nssdc_xdr_cdf
+    PROTO((XDR *xdrs, NC **handlep));
+
+HDFLIBAPI intn HDiscdf
+    (const char *filename);
+
+HDFLIBAPI intn HDisnetcdf
+    (const char *filename);
+
+#endif /* HDF */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LOCAL_NC_ */
diff --git a/mfhdf/libsrc/mfdatainfo.c b/mfhdf/libsrc/mfdatainfo.c
new file mode 100644
index 0000000..3e3ab51
--- /dev/null
+++ b/mfhdf/libsrc/mfdatainfo.c
@@ -0,0 +1,916 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* NOTE: this file and other "datainfo" related files will be configured so
+   that this feature will not be built by default. -BMR
+   Update: THG and NASA had decided to include all features developed for the
+     HDF Mapping Project in the library -BMR (~Jan 2011) */
+
+/******************************************************************************
+FILE
+  mfdatainfo.c
+
+  This file contains the multi-file SD interface functions that provide
+  information about location and size of raw data.  This type of information
+  will allow applications to extract raw data from an HDF file without the
+  use of HDF4 library.  These features were developed to support the HDF4
+  Mapping project (2010-2011.)
+
+  As with the rest of the SD API, these functions have names beginning with SD.
+
+EXPORTED ROUTINES
+-----------------
+
+  SDgetdatainfo       -- retrieves location and size of an SDS' data
+  SDgetattdatainfo    -- retrieves location and size of an attribute's data
+  SDgetoldattdatainfo -- retrieves location and size of an old-style attribute's data
+  SDgetanndatainfo    -- retrieves location and size of an annotation's data
+
+LOCAL ROUTINES
+--------------
+  get_attr_tag        -- Convert the name of an attribute to its associated hdf tag
+
+ ******************************************************************************/
+
+#include "local_nc.h"
+
+#ifdef HDF
+
+#ifndef DATAINFO_MASTER
+#define DATAINFO_MASTER
+#endif
+#include "mfhdf.h"
+
+#ifdef H4_HAVE_LIBSZ          /* we have the szip library */
+#include "szlib.h"
+#endif
+
+#ifndef MFSD_INTERNAL
+#define MFSD_INTERNAL
+#endif
+
+#ifdef MFSD_INTERNAL
+/* Local function prototypes */
+#include "mfprivate.h"
+#endif
+
+PRIVATE intn get_attr_tag(char *attr_name, uint16* attr_tag);
+
+/******************************************************************************
+ NAME
+    SDgetdatainfo -- Retrieves location and size of data blocks.
+ USAGE
+    intn SDgetdatainfo(sdsid, chk_coord, start_block, info_count, offsetarray, lengtharray)
+  int32 sdsid    IN: dataset ID
+  int32 *chk_coord  IN: chunk coord array or NULL for non-chunk SDS
+  int32 start_block  IN: indicating where to start reading offsets
+  uintn info_count  IN: number of data blocks the arrays can hold
+  int32 *offsetarray  OUT: array for offsets
+  int32 *lengtharray  OUT: array for lengths
+ RETURNS
+    The number of data blocks retrieved if successful and FAIL, otherwise.
+
+ DESCRIPTION
+    SDgetdatainfo retrieves two lists, one containing offsets to sdsid's data
+    blocks and the other containing the lengths of those blocks.
+
+    If start_block is 0, SDgetdatainfo will start getting data info from the
+    beginning of the data set's data.  If start_block is greater than the
+    number of blocks in the data set's data, SDgetdatainfo will return FAIL.
+
+    When both offsetarray and lengtharray lists are NULL, SDgetdatainfo will
+    call HDgetdatainfo passing in NULLs to return the actual number of blocks
+    in the data set's data.  Otherwise, it will pass in non-NULL arrays to
+    retrieve the offset and length of data blocks in the specified data set.
+    The non-NULL lists are assumed to be allocated sufficiently for holding
+    info_count values.
+
+    If info_count is larger than the actual number of offsets/lengths starting
+    at start_block to the end of the data, then only the actual number
+    offsets/lengths will be retrieved.
+
+ MODIFICATION
+    BMR - 2010/07/14: Revised to combine SDgetdatainfo and SDgetdatainfo_count
+
+ ******************************************************************************/
+intn
+SDgetdatainfo(int32 sdsid, int32 *chk_coord, uintn start_block,
+        uintn info_count, int32 *offsetarray, int32 *lengtharray)
+{
+    CONSTR(FUNC, "SDgetdatainfo");    /* for HGOTO_ERROR */
+    NC     *handle;
+    NC_var *var;
+    intn    count = FAIL; /* number of data blocks */
+    intn    ret_value = 0;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate arguments */
+
+    /* Getting only offsets or lengths is not allowed */
+    if ((offsetarray != NULL && lengtharray == NULL) ||
+            (offsetarray == NULL && lengtharray != NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Just in case user forgot to allocate buffers */
+    if ((offsetarray == NULL && lengtharray == NULL) && (info_count > 0))
+        HGOTO_ERROR(DFE_NOTENOUGH, FAIL);
+
+    /* Get NC_var record */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+    if(handle->vars == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If the data ref# of the SDS is 0, there is no storage is created yet */
+    if (var->data_ref == 0)
+    {
+        count = 0; /* no blocks */
+    }
+    else
+    {
+        /* If both arrays are NULL, get the number of data blocks and return */
+        if (offsetarray == NULL && lengtharray == NULL)
+        {
+            count = HDgetdatainfo(handle->hdf_file, var->data_tag,
+                    var->data_ref, chk_coord, start_block, info_count, NULL, NULL);
+            if (count == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+        }
+
+        /* Application requests actual offsets/lengths */
+        else
+        {
+            count = HDgetdatainfo(handle->hdf_file, var->data_tag,
+                    var->data_ref, chk_coord, start_block, info_count,
+                    offsetarray, lengtharray);
+            if (count == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+        }
+    }
+    /* Returning number of data blocks */
+    ret_value = count;
+    done:
+    if (ret_value == FAIL)
+    { /* Failure cleanup */
+    }
+    /* Normal cleanup */
+    return ret_value;
+} /* SDgetdatainfo */
+
+
+/******************************************************************************
+ NAME
+    SDgetattdatainfo -- Retrieves location and size of attribute's data.
+ USAGE
+    intn SDgetattdatainfo(id, attrindex, offset, length)
+  int32 id    IN: file ID, SDS ID, or dimension ID
+  int32 attrindex    IN: index of the attribute being inquired
+  int32 *offset    OUT: offset of attribute's data
+  int32 *length    OUT: length of attribute's data
+ RETURNS
+    The number of data blocks retrieved, which should be 1, if successful
+    and FAIL, otherwise.
+
+ DESCRIPTION
+    There are attributes created by SD API functions and those created by
+    the DFSD API functions.  When the searched attribute was created by the
+    SD API, the attribute would be stored in a vdata.  Thus, SDgetattdatainfo
+    will use VSgetdatainfo to get the location and length of the attribute's.
+
+    When the searched attribute was created by the DFSD API, it would
+    be stored with the SDS via an attribute tag/ref pair.  Refer to
+    the function header of SDgetoldattdatainfo for more details.
+    The application will need to call SDgetoldattdatainfo to get data
+    info for this type of attributes.  Thus, SDgetattdatainfo will
+    return to caller with error code DFE_NOVGREP so caller can call
+    SDgetoldattdatainfo to get to its attributes directly from the file.
+
+ MODIFICATION
+    2010/10/14: Revised to remove the parameter attrname because, for hmap
+  project, it makes sense to just provide the attribute index. -BMR
+
+ ******************************************************************************/
+intn
+SDgetattdatainfo(int32 id, int32 attrindex, int32 *offset, int32 *length)
+{
+    CONSTR(FUNC, "SDgetattdatainfo");
+    NC     *handle;
+    NC_var *var;
+    NC_dim *dim;
+    int32   vg_ref=0,  /* ref# of the VG representing a file, SDS, or dim */
+            n_elements,  /* number of elements in the file/SDS/dim vgroup */
+            vs_id=-1,  /* VS id, needed while looking for _HDF_ATTRIBUTE */
+            vg_id=-1,  /* id of the file/SDS/dimension vgroup */
+            var_idx;  /* index of the variable representing the given dim */
+    char    vsclass[H4_MAX_NC_CLASS] = "", /* vs class, is it _HDF_ATTRIBUTE? */
+            attrname[H4_MAX_NC_CLASS] = "",/* name of the given attribute */
+            vsname[H4_MAX_NC_CLASS] = "";  /* vs name to see if it's the inquired attr's name*/
+    int32   ntype=0,  /* need these because SDattrinfo doesn't... */
+            count=0;  /* ...take NULL pointers for not needed arguments */
+    int     ii;
+    intn    status,  /* returned value */
+    found,  /* TRUE when attribute is found */
+    ret_value = SUCCEED;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate arguments */
+
+    /* Both buffers must be allocated */
+    if (offset == NULL || length == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Index must be positive */
+    if (attrindex < 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get the attribute's name */
+    status = SDattrinfo(id, attrindex, attrname, &ntype, &count);
+
+    /* Check if the id given is a file id, or SDS id, or dimension id, and get
+       appropriate info structure */
+    handle = SDIhandle_from_id(id, CDFTYPE);
+
+    /* not a file id */
+    if(handle == NULL)
+    {
+        /* then check if it's SDS id */
+        handle = SDIhandle_from_id(id, SDSTYPE);
+        /* not an SDS id */
+        if(handle == NULL)
+        {
+            /* then check if it's a dimension id */
+            handle = SDIhandle_from_id(id, DIMTYPE);
+
+            /* not a dimension id either, return with an error */
+            if(handle == NULL)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            /* dimension id is given, get the dimension info */
+            dim = SDIget_dim(handle, id);
+            if(dim == NULL)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            /* look for the variable representing this dimension,
+       ie. coordinate variable */
+            var_idx = SDIgetcoordvar(handle, dim, id, (int32)0);
+            if(var_idx == FAIL)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            /* get the variable object */
+            var = NC_hlookupvar(handle, var_idx);
+            if(var == NULL)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            /* get the ref number of the vgroup representing this dim */
+            vg_ref = var->vgid;
+
+            /* If this dimension is not represented by a vgroup (old dimension,
+               HDF 3.2, released in 1993) return to caller with error code
+               DFE_NOVGREP so caller can call SDgetoldattdatainfo to get
+               to its attributes directly from the file */
+            if (vg_ref == 0)
+                HGOTO_DONE(DFE_NOVGREP);
+        }
+        /* SDS id is given */
+        else
+        {
+            /* get the variable record */
+            if(handle->vars == NULL)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+            var = SDIget_var(handle, id);
+            if(var == NULL)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            /* get the reference number of the vgroup representing this SDS */
+            vg_ref = var->vgid;
+
+            /* If this data set is not represented by a vgroup (old data set,
+               HDF 3.2, released in 1993) return to caller with error code
+               DFE_NOVGREP so caller can call SDgetoldattdatainfo to get
+               to its attributes directly from the file */
+            if (vg_ref == 0)
+                HGOTO_DONE(DFE_NOVGREP);
+        }
+    }
+    /* File id is given */
+    else
+    {
+        /* make sure it is an HDF file */
+        if(handle->file_type != HDF_FILE)
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+
+        /* get the reference number of the vgroup representing the file */
+        vg_ref = handle->vgid;
+
+        /* I believe file did not have the case of old pre-defined attributes,
+     so no special handling for DFE_NOVGREP here. -BMR 2011/1/11 */
+
+        /* Validate the vgroup ref# */
+        if (vg_ref == 0) HGOTO_ERROR(DFE_ARGS, FAIL);
+    }
+
+    /* Get access to the vgroup and get the number of elements belong to it */
+    vg_id = Vattach(handle->hdf_file, vg_ref, "r");
+    if(vg_id == FAIL) 
+        HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+    n_elements = Vntagrefs(vg_id);
+    if (n_elements == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Look through the vgroup for vdatas of class _HDF_ATTRIBUTE.  If one is
+       found, check to see if its name matches the searched attribute.  If it
+       matches, use VSgetdatainfo to get offset and length of the attribute's
+       data, then set flag to terminate the search */
+    found = FALSE;
+    for (ii = 0; ii < n_elements && !found; ii++) 
+    {
+        int32 elem_tag, elem_ref;
+
+        /* get current tag/ref */
+        if (Vgettagref(vg_id, ii, &elem_tag, &elem_ref) == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* current element is a vdata */
+        if(elem_tag == DFTAG_VH) 
+        {
+            vs_id = VSattach(handle->hdf_file, elem_ref, "r");
+            if(vs_id == FAIL) 
+                HGOTO_ERROR(DFE_CANTATTACH, FAIL);
+
+            /* get the vdata's class */
+            if (VSgetclass(vs_id, vsclass) == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+            /* current vdata represents an attribute */
+            if(!HDstrcmp(vsclass, _HDF_ATTRIBUTE)) 
+            {
+                /* get the vdata's name */
+                if (VSgetname(vs_id, vsname) == FAIL)
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+                /* the searched attribute if found */
+                if (!HDstrcmp(attrname, vsname))
+                {
+                    intn info_count=0;
+
+                    /* get offset/length of attribute's data */
+                    info_count = VSgetdatainfo(vs_id, 0, 1, offset, length);
+
+                    /* attribute data should only be in 1 block */
+                    if (info_count != 1) /* attribute data should only be in 1 block */
+                        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+                    /* set flag to terminate the search, and return info count*/
+                    found = TRUE;
+                    ret_value = info_count;
+                }
+            }
+            /* Close access to vdata */
+            if (VSdetach(vs_id) == FAIL)
+                HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+            vs_id = -1;
+        }
+    }
+    /* Close access to the vgroup */
+    if (Vdetach(vg_id) == FAIL)
+        HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+
+    done:
+    if (ret_value == FAIL)
+    { /* Failure cleanup */
+        if (vs_id != -1)
+            if (VSdetach(vs_id) == FAIL)
+                HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+        if (vg_id != -1)
+            if (Vdetach(vg_id) == FAIL)
+                HGOTO_ERROR(DFE_CANTDETACH, FAIL);
+    }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDgetattdatainfo */
+
+
+/******************************************************************************
+ NAME
+    get_attr_tag -- Convert the name of a pre-defined attribute to its
+         associated hdf tag (Private)
+ USAGE
+    intn get_attr_tag(attr_name, *attr_tag)
+  char *attr_name    IN: name of the luf attributes
+  uint16 *attr_tag  OUT: associated tag of luf
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    In older files, when there were only pre-defined attributes, an attribute
+    was not stored in vdata, but was located by an attribute tag/ref pair,
+    which is an element of the group that represents the SDS.  The values of
+    the SDS's attribute are followed by the values of its dimensions'
+    attributes, each separated by a null character.
+
+    This function gives the associated tag of an attributes so that
+    application can use tag/ref to read the attribute string.
+
+ ******************************************************************************/
+PRIVATE intn 
+get_attr_tag(char *attr_name, uint16* attr_tag)
+{
+    intn ret_value = SUCCEED;
+
+    if (HDstrcmp(_HDF_LongName, attr_name) == 0)
+        *attr_tag = DFTAG_SDL;
+    else if (HDstrcmp(_HDF_Units, attr_name) == 0)
+        *attr_tag = DFTAG_SDU;
+    else if (HDstrcmp(_HDF_Format, attr_name) == 0)
+        *attr_tag = DFTAG_SDF;
+    else if (HDstrcmp(_HDF_CoordSys, attr_name) == 0)
+        *attr_tag = DFTAG_SDC;
+    else if ((HDstrcmp(_HDF_ValidMin, attr_name) == 0) ||
+            (HDstrcmp(_HDF_ValidMax, attr_name) == 0) ||
+            (HDstrcmp(_HDF_ValidRange, attr_name) == 0))
+        *attr_tag = DFTAG_SDM;
+    else if (HDstrcmp(_FillValue, attr_name) == 0)
+        *attr_tag = DFTAG_FV;
+    else if ((HDstrcmp(_HDF_CalibratedNt, attr_name) == 0)
+            || (HDstrcmp(_HDF_ScaleFactor, attr_name) == 0)
+            || (HDstrcmp(_HDF_ScaleFactorErr, attr_name) == 0)
+            || (HDstrcmp(_HDF_AddOffset, attr_name) == 0)
+            || (HDstrcmp(_HDF_AddOffsetErr, attr_name) == 0))
+        *attr_tag = DFTAG_CAL;
+    /* We need to decide how to handle this attribute when we see it...
+    else 
+            case DFTAG_SDLNK:
+     */
+    else
+    {
+        ret_value = FAIL;
+        fprintf(stderr, "get_attr_tag: attr_name = <%s> is not recognized currently\n", attr_name);
+    }
+    return ret_value;
+} /* get_attr_tag */
+
+/******************************************************************************
+ NAME
+    SDgetoldattdatainfo -- Retrieves location and size of old predefined
+         attribute's data.
+ USAGE
+    intn SDgetoldattdatainfo(id, sdsid, attr_name, offset, length)
+  int32 dim_id    IN: dimension ID
+  int32 sdsid    IN: ID of dataset the dim belongs to
+  char *attr_name    IN: name of the attribute being inquired
+  int32 *offset    OUT: buffer for offset
+  int32 *length    OUT: buffer for length
+ RETURNS
+    The number of data blocks retrieved, which should be 1, if successful
+    and FAIL, otherwise.
+
+ DESCRIPTION
+    In some older files, when data sets and dimensions were not stored as
+    vgroup yet, the pre-defined attributes that belong to the data sets
+    and dimensions were written as followed:
+  attr_tag/attr_ref specify offset and length of the attribute string
+  such as:
+    "<SDS attribute values>null<dim0 attribute values>null<dim1 attribute values>null..."
+
+  Some examples of attr_tag are: (refer to htags.h for more)
+  DFTAG_SDL for Labels attribute
+  DFTAG_SDU for Units attribute
+  ...
+
+    SDgetoldattdatainfo retrieves the offset and length of the attribute that
+    belongs to a data set or a dimension.  Note that only Label, Units, and
+    Format (LUF) are applicable to dimensions.  The other attributes are only
+    available to the data set.
+
+ DESIGN NOTE:
+    This function could be modified to return lists of offsets and lengths
+    for attributes of data set and dimension in one call, in the case of LUF.
+    That approach would reduce the need to go over the attribute strings
+    multiple times for each dimension.  However, it is pending on how the map
+    writer uses the function. -BMR (2011/1/13)  It seemed to suit the writer
+    so we stay with this design at this time. -BMR (2011/3/1)
+
+ MODIFICATION
+    2011/1/11: Revised to handle offset/length of SDS' attribute too. -BMR
+
+ ******************************************************************************/
+intn
+SDgetoldattdatainfo(int32 dim_id, int32 sdsid, char  *attr_name,
+        int32 *offset, int32 *length)
+{
+    CONSTR(FUNC, "SDgetoldattdatainfo");
+    NC     *handle;
+    NC_var *var;
+    int32   off, len,
+    dim_att_len=0,
+    sdsluf_len=0,
+    offp = 0;
+    char   *lufbuf=NULL, *lufp=NULL;
+    uint16  att_tag, att_ref;
+    intn    dimidx_infile=0, dimidx_invar=0;
+    intn    isdim = 0;
+    int     ii;
+    intn    status,  /* returned value */
+    ret_value = 0;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Both buffers must be allocated */
+    if (offset == NULL || length == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Attribute name must be provided */
+    if (attr_name == NULL || attr_name[0] == '\0')
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check if a dimension ID is given then set flag */
+    handle = SDIhandle_from_id(dim_id, DIMTYPE);
+    if(handle != NULL)
+        isdim = 1;
+
+    /* Check if the given dataset ID really is a dataset ID; dataset ID
+       must always be available */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get the variable object of the dataset */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If this variable doesn't have a valid NDG ref, we cannot proceed */
+    if (var->ndg_ref == 0)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    att_tag = 0;
+    att_ref = var->ndg_ref; /* all elements of this var have the same ref# */
+
+    /* Convert a predefined attribute name into its corresponding HDF tag */
+    status = get_attr_tag(attr_name, &att_tag);
+    if (status == FAIL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if (att_tag != 0 && att_ref != 0)
+    {
+        /* Get offset/length of the attribute values. */
+        off = Hoffset(handle->hdf_file, att_tag, att_ref);
+        if (off == FAIL)
+            HGOTO_ERROR(DFE_BADOFFSET, FAIL);
+
+        len = Hlength(handle->hdf_file, att_tag, att_ref);
+        if (len == FAIL)
+            HGOTO_ERROR(DFE_BADLEN, FAIL);
+
+        /* If the attribute pointed to by "off" and "len" is a LUF string, which
+         includes LUFs of the data set and its dimensions all together, then
+         parse the string to obtain offsets/lengths of the data set's LUF and
+         of the dimensions' LUFs.
+         Otherwise, return "off" and "len" for the inquired attribute. */
+
+        if (att_tag != DFTAG_SDL && att_tag != DFTAG_SDU && att_tag != DFTAG_SDF)
+        {
+            *offset = off;
+            *length = len;
+            HGOTO_DONE(1);
+        }
+
+        if (len == 0)
+        {
+            HGOTO_DONE(0);
+        }
+
+        /* Read the luf string */
+        lufbuf = (char *)HDmalloc(len+1);
+        if (lufbuf == NULL)
+            HGOTO_ERROR(DFE_NOSPACE, FAIL);
+        Hgetelement(handle->hdf_file, att_tag, att_ref, lufbuf);
+
+        /*
+         * Parse the luf string to obtain the offset/length of the requested luf
+         */
+        /* Start at the beginning of the data set's luf */
+        lufp = lufbuf;
+
+        /* Get the length of the data set's luf */
+        sdsluf_len = HDstrlen(lufbuf);
+
+        /* If data set's attribute is being inquired, then return with offset
+         and length of the SDS' attribute's data only */
+        if (!isdim)
+        {
+            *offset = off;
+            *length = sdsluf_len;
+        }
+
+        /* If a dimension's attribute is being inquired, then continue parsing
+         the attribute string to get the appropriate dimension's attribute */
+        else
+        {
+            char *dim_att=NULL; /* to hold a dimension's attribute */
+
+            /* Move cursor forward to the first dimension's attribute */
+            lufp += sdsluf_len + 1;
+
+            /* Convert dimension id back to index */
+            dimidx_infile = dim_id & 0xffff;
+
+            /* The dimidx_infile is the index of the dimension relative to the
+           file.  We need to find the index of dim within the variable */
+            dimidx_invar = -1;
+            for (ii = 0; ii < var->assoc->count && dimidx_invar != ii; ii++)
+                if (var->assoc->values[ii] == dimidx_infile)
+                    dimidx_invar = ii;
+
+            /* Walk through each dimension to find requested luf */
+            offp = 0; /* offset pointer */
+            for (ii = 0; ii <= dimidx_invar; ii++)
+            {
+                /* NOTE: Should make tests for all cases to make sure all
+                     empty attributes are covered -BMR */
+
+                /* If dimension doesn't have attribute, its attr len is 0 */
+                if (HDstrlen(lufp) == 0)
+                    dim_att_len = 0;
+                /* If dimension has attribute, calculate its attr length */
+                else
+                {
+                    dim_att = (char *)HDmalloc(HDstrlen(lufp) + 1);
+                    if (dim_att == NULL)
+                        HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+                    /* Extract current dimension's attribute */
+                    HDstrcpy(dim_att, (char *) lufp);
+                    dim_att[HDstrlen(lufp)] = 0;
+                    dim_att_len = HDstrlen(dim_att);
+                }
+
+                /* Move forward if this is not the dim we're looking for */
+                if (ii != dimidx_invar)
+                {
+                    /* move cursor forward to the next dimension's attribute */
+                    lufp += dim_att_len + 1;  /* <- 1 is for the NULL */
+
+                    /* add the length to the offset so far */
+                    offp += dim_att_len + 1;
+                }
+                if (dim_att != NULL)
+                {
+                    HDfree(dim_att);
+                    dim_att = NULL;
+                }
+            }
+
+            /* Calculate offset and length of the requested dimension's luf   */
+            /* - off: offset where luf string starts, returned by Hoffset     */
+            /* - sdsluf_len: length of the dataset luf + 1 for the null space */
+            /* - offp: offset accummulated of all dimension lufs before the   */
+            /*   requested one */
+            *offset = off + sdsluf_len + 1 + offp;
+            *length = dim_att_len;
+        }
+        ret_value = 1;
+    }
+    if (lufbuf) HDfree(lufbuf);
+
+    done:
+    if (ret_value == FAIL)
+    { /* Failure cleanup */
+        if (lufbuf) HDfree(lufbuf);
+    }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDgetoldattdatainfo */
+
+
+/******************************************************************************
+ NAME
+    SDgetanndatainfo -- Retrieves location and size of annotations' data.
+ USAGE
+    intn SDgetanndatainfo(sdsid, annot_type, size, offsetarray, lengtharray)
+  int32 sdsid    IN: SDS ID
+  ann_type annot_type  IN: type of annotations to retrieve data info
+  uintn size    IN: size of offsetarray and lengtharray
+  int32 *offsetarray  OUT: offsets of annotations' data
+  int32 *lengtharray  OUT: lengths of annotations' data
+ RETURNS
+    The number of annotation data info retrieved, if successful
+    and FAIL, otherwise.
+
+ DESCRIPTION
+    SDgetanndatainfo retrieves the location and size specifying data of the
+    annotations of the specified type from the dataset.  There may be more
+    than one annotations, but each annotation has only one block of data.
+
+ IMPORTANT NOTE
+    If caller provides buffers that are smaller than the number of annotations
+    then SDgetanndatainfo only fills the buffers up to its size, and returns
+    the number of annotations retrieved.  That means, the rest of the
+    annotations are not retrievable.  However, this function is designed for
+    hmap writer at this point, and such insufficient buffers situation is not
+    anticipated, beside the fact that we're running out of time.  In the future,
+    or when such need arises, the function should be modified to include
+    another parameter to allow retrieving partial annotations.
+    -BMR 2011/1/9
+
+ ******************************************************************************/
+intn SDgetanndatainfo(int32 sdsid, ann_type annot_type, uintn size, int32* offsetarray, int32* lengtharray)
+{
+    CONSTR(FUNC, "SDgetanndatainfo");
+    int32   file_id=FAIL,  /* file, AN API, annotation IDs */
+            an_id=FAIL,
+            ann_id=FAIL;
+    NC     *handle = NULL;  /* file structure */
+    NC_var *var = NULL;    /* variable structure of sds, to get NDG ref */
+    int32  *dannots = NULL,  /* list of data annotation IDs */
+            n_flabels = 0,  /* number of file labels */
+            n_fdescs = 0,  /* number of file descriptions */
+            n_dlabels = 0,  /* number of object labels */
+            n_ddescs = 0;  /* number of file descriptions */
+    uint16  elem_tag, elem_ref; /* tag/ref of dataset's NDG */
+    intn    num_annots,    /* number of annotation of requested type */
+    ii,
+    ret_value = 0;
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Validate array size */
+    if (size == 0 && (offsetarray != NULL && lengtharray != NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Getting only offsets or lengths is not allowed */
+    if ((offsetarray != NULL && lengtharray == NULL) ||
+            (offsetarray == NULL && lengtharray != NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check if the given id is a file id */
+    handle = SDIhandle_from_id(sdsid, CDFTYPE);
+
+    /* It is a file id, process its annotations appropriately */
+    if (handle != NULL)
+    {
+        /* Open file to start Annotation inteface */
+        if ((file_id = Hopen(handle->path, DFACC_READ, 0)) == FAIL)
+            HGOTO_ERROR(DFE_BADOPEN, FAIL);
+        if ((an_id = ANstart(file_id)) == FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+        /* Validate annotation type */
+        if (annot_type != AN_FILE_LABEL && annot_type != AN_FILE_DESC)
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+
+        /* Get numbers of file annotations */
+        ret_value = ANfileinfo(an_id, &n_flabels, &n_fdescs, &n_dlabels, &n_ddescs);
+        if (ret_value == FAIL)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        if (annot_type == AN_FILE_LABEL)
+            num_annots = n_flabels;
+        else
+            num_annots = n_fdescs;
+
+        if (num_annots < 0)
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+        /* If offsets and lengths are not desired, return the number of annots */
+        if (offsetarray == NULL || lengtharray == NULL)
+            HGOTO_DONE(num_annots);
+
+        /* If more annotations than space in user's buffers, only fill up buffers */
+        if ((uintn)num_annots > size)
+            num_annots = size;
+
+        /* Get offset/length of each annotation of the specified type */
+        for (ii = 0; ii < num_annots; ii++)
+        {
+            intn status;
+
+            /* Get access to an annotation of the specified type */
+            ann_id = ANselect(an_id, ii, annot_type);
+            if (ann_id == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+            /* Get annotation's offset and length */
+            ret_value = ANgetdatainfo(ann_id, &offsetarray[ii], &lengtharray[ii]);
+            /* Close the annotation (now, just in case ANgetdatainfo failed) */
+            status = ANendaccess(ann_id);
+
+            if (ret_value == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+            if (status == FAIL)
+                HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+        }
+    }
+    /* Not a file ID */
+    else
+    {
+        /* Check if the given dataset ID really is a dataset ID */
+        handle = SDIhandle_from_id(sdsid, SDSTYPE);
+        if(handle != NULL)
+        {
+            /* Validate annotation type */
+            if (annot_type != AN_DATA_LABEL && annot_type != AN_DATA_DESC)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            /* Get the NDG ref of this dataset */
+            elem_ref = SDidtoref(sdsid);
+            elem_tag = DFTAG_NDG;
+
+            /* If this var doesn't have a valid NDG ref, we cannot proceed */
+            if (elem_ref <= 0)
+                HGOTO_ERROR(DFE_ARGS, FAIL);
+
+            /* Open file to start Annotation inteface */
+            if ((file_id = Hopen(handle->path, DFACC_READ, 0)) == FAIL)
+                HGOTO_ERROR(DFE_BADOPEN, FAIL);
+            if ((an_id = ANstart(file_id)) == FAIL)
+                HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+            /* Get number of data descs or labels with this tag/ref */
+            num_annots = ANnumann(an_id, annot_type, elem_tag, elem_ref);
+            if (num_annots == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL)
+                else if (num_annots == 0) /* then try SDG */
+                {
+                    elem_tag = DFTAG_SDG;
+                    num_annots = ANnumann(an_id, annot_type, elem_tag, elem_ref);
+
+                    /* If there are no SDG annotations either then return 0 */
+                    if (num_annots == 0)
+                        HGOTO_DONE(0);
+                }
+
+            /* If offsets/lengths are not desired, return the number of annots */
+            if (offsetarray == NULL || lengtharray == NULL)
+                HGOTO_DONE(num_annots);
+
+            /* If more annotations than space in user's buffers, only fill up buffers */
+            if (num_annots > size)
+                num_annots = size;
+
+            /* Allocate space for list of annotation IDs on this tag/ref */
+            if ((dannots = (int32 *)HDmalloc(num_annots * sizeof(int32))) == NULL)
+                HGOTO_ERROR(DFE_NOSPACE, FAIL);
+
+            /* Get list of annotations IDs on this tag/ref */
+            if (ANannlist(an_id, annot_type, elem_tag, elem_ref, dannots) == FAIL)
+                HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            /* Note: these ann IDs seem to be closed by HAdestroy_group() but
+    I'm not sure.  MFAN needs to take care of them if not. -BMR */
+
+            /* Loop through the annotation list and get their offsets/lengths */
+            for (ii = 0; ii < num_annots; ii++)
+            {
+                /* Get annotation's offset and length */
+                ret_value = ANgetdatainfo(dannots[ii], &offsetarray[ii], &lengtharray[ii]);
+                if (ret_value == FAIL)
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+            }
+        } /* ID is an SDS */
+    } /* Not a file ID */
+
+    /* Return the number of annotations retrieved */
+    ret_value = num_annots;
+
+    done:
+    if (ret_value == FAIL)
+    { /* Failure cleanup */
+    }
+    /* Normal cleanup */
+
+    /* Release allocated memory */
+    if (dannots) HDfree(dannots);
+
+    /* Terminate access to the AN API and close the file if they are opened */
+    if(an_id != FAIL)
+        ANend(an_id);
+    if(file_id != FAIL)
+        Hclose(file_id);
+
+    return ret_value;
+} /* SDgetanndatainfo */
+
+#endif /* HDF */
diff --git a/mfhdf/libsrc/mfdatainfo.h b/mfhdf/libsrc/mfdatainfo.h
new file mode 100644
index 0000000..dbbb70d
--- /dev/null
+++ b/mfhdf/libsrc/mfdatainfo.h
@@ -0,0 +1,47 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef MFDATAINFO_H
+#define MFDATAINFO_H
+
+#include "H4api_adpt.h"
+
+/* Activate raw datainfo interface - added for hmap project in 2010 */
+#if defined DATAINFO_MASTER || defined DATAINFO_TESTER
+
+#if defined c_plusplus || defined __cplusplus
+extern      "C"
+{
+#endif                          /* c_plusplus || __cplusplus */
+
+/* Public functions for getting raw data information */
+
+HDFLIBAPI intn SDgetdatainfo
+    (int32 sdsid, int32 *chk_coord, uintn start_block, uintn info_count,
+	int32 *offsetarray, int32 *lengtharray);
+
+HDFLIBAPI intn SDgetattdatainfo
+    (int32 id, int32 attrindex, int32 *offset, int32 *length);
+
+HDFLIBAPI intn SDgetoldattdatainfo
+    (int32 dimid, int32 sdsid, char *attr_name, int32 *offset, int32 *length);
+
+HDFLIBAPI intn SDgetanndatainfo
+    (int32 sdsid, ann_type annot_type, uintn size, int32* offsetarray,
+	int32* lengtharray);
+
+#if defined c_plusplus || defined __cplusplus
+}
+#endif /* c_plusplus || __cplusplus */
+#endif /* DATAINFO_MASTER || DATAINFO_TESTER */
+#endif /* _MF_DATAINFO */
diff --git a/mfhdf/libsrc/mfhdf.h b/mfhdf/libsrc/mfhdf.h
new file mode 100644
index 0000000..5451519
--- /dev/null
+++ b/mfhdf/libsrc/mfhdf.h
@@ -0,0 +1,500 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: mfhdf.h 6031 2014-01-17 05:54:32Z bmribler $ */
+
+#ifndef _MFSD_H_
+#define _MFSD_H_
+
+#ifndef HDF
+#define HDF 1
+#endif
+
+#include "H4api_adpt.h"
+
+/* change this back if it causes problems on other machines than the Alhpa-QAK */
+/* Reverse back to the previous way. AKC */
+#include "hdf.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+#ifdef OLD_WAY
+#include "local_nc.h"
+#endif /* OLD_WAY */
+
+#include "mfhdfi.h"
+#include "mfdatainfo.h"
+
+#define SD_UNLIMITED NC_UNLIMITED /* use this as marker for unlimited dimension */
+#define SD_NOFILL    NC_NOFILL
+#define SD_FILL      NC_FILL
+#define SD_DIMVAL_BW_COMP   1
+#define SD_DIMVAL_BW_INCOMP  0
+#define SD_RAGGED    -1  /* marker for ragged dimension */
+
+/* used to indicate the type of the variable at an index */
+typedef struct hdf_varlist
+{
+    int32 var_index;     /* index of the current variable */
+    hdf_vartype_t var_type; /* type of a variable (IS_SDSVAR, IS_CRDVAR, or UNKNOWN */
+} hdf_varlist_t;
+
+/* enumerated types for various types of ids in SD interface */
+typedef enum
+{
+    NOT_SDAPI_ID = -1,	/* not an SD API id */
+    SD_ID = 0,		/* SD id */
+    SDS_ID,		/* SDS id */
+    DIM_ID		/* Dimension id */
+} hdf_idtype_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+HDFLIBAPI int32 SDstart
+    (const char *name, int32 accs);
+
+HDFLIBAPI intn SDend
+    (int32 fid);
+
+HDFLIBAPI intn SDfileinfo
+    (int32 fid, int32 *datasets, int32 *attrs);
+
+HDFLIBAPI int32 SDselect
+    (int32 fid, int32 idx);
+
+HDFLIBAPI intn SDgetinfo
+    (int32 sdsid, char *name, int32 *rank, int32 *dimsizes, 
+           int32 *nt, int32 *nattr);
+
+#ifndef __CSTAR__
+HDFLIBAPI intn SDreaddata
+    (int32 sdsid, int32 *start, int32 *stride, int32 *end, void * data);
+#endif
+
+HDFLIBAPI uint16 SDgerefnumber
+    (int32 sdsid);
+
+HDFLIBAPI int32 SDnametoindex
+    (int32 fid, const char *name);
+
+HDFLIBAPI intn SDnametoindices
+    (int32 fid, const char *name, hdf_varlist_t *var_list);
+
+HDFLIBAPI intn SDgetnumvars_byname
+    (int32 fid, const char *name, int32 *n_vars);
+
+HDFLIBAPI intn SDgetrange
+    (int32 sdsid, void * pmax, void * pmin);
+
+HDFLIBAPI int32 SDcreate
+    (int32 fid, const char *name, int32 nt, int32 rank, int32 *dimsizes);
+
+HDFLIBAPI int32 SDgetdimid
+    (int32 sdsid, intn number);
+
+HDFLIBAPI intn SDsetdimname
+    (int32 id, const char *name);
+
+HDFLIBAPI intn SDendaccess
+    (int32 id);
+
+HDFLIBAPI intn SDsetrange
+    (int32 sdsid, void * pmax, void * pmin);
+
+HDFLIBAPI intn SDsetattr
+    (int32 id, const char *name, int32 nt, int32 count, const void * data);
+
+HDFLIBAPI intn SDattrinfo
+    (int32 id, int32 idx, char *name, int32 *nt, int32 *count);
+
+HDFLIBAPI intn SDreadattr
+    (int32 id, int32 idx, void * buf);
+
+#ifndef __CSTAR__
+HDFLIBAPI intn SDwritedata
+    (int32 sdsid, int32 *start, int32 *stride, int32 *end, void * data);
+#endif
+
+HDFLIBAPI intn SDsetdatastrs
+    (int32 sdsid, const char *l, const char *u, const char *f, const char *c);
+
+HDFLIBAPI intn SDsetcal
+    (int32 sdsid, float64 cal, float64 cale, float64 ioff,
+               float64 ioffe, int32 nt);
+
+HDFLIBAPI intn SDsetfillvalue
+    (int32 sdsid, void * val);
+
+HDFLIBAPI intn SDgetfillvalue
+    (int32 sdsid, void * val);
+
+HDFLIBAPI intn SDsetfillmode
+    (int32 id, intn fillmode);
+
+HDFLIBAPI intn SDgetdatastrs
+    (int32 sdsid, char *l, char *u, char *f, char *c, intn len);
+
+HDFLIBAPI intn SDgetcal
+    (int32 sdsid, float64 *cal, float64 *cale, float64 *ioff, 
+               float64 *ioffe, int32 *nt);
+
+HDFLIBAPI intn SDsetdimstrs
+    (int32 id, const char *l, const char *u, const char *f);
+
+HDFLIBAPI intn SDsetdimscale
+    (int32 id, int32 count, int32 nt, void * data);
+
+HDFLIBAPI intn SDgetdimscale
+    (int32 id, void * data);
+
+HDFLIBAPI intn SDdiminfo
+    (int32 id, char *name, int32 *size, int32 *nt, int32 *nattr);
+
+HDFLIBAPI intn SDgetdimstrs
+    (int32 id, char *l, char *u, char *f, intn len);
+
+HDFLIBAPI intn SDgetexternalfile
+    (int32 id, intn buf_size, char *ext_filename, int32 *offset);
+
+HDFLIBAPI intn SDgetexternalinfo
+    (int32 id, uintn buf_size, char *ext_filename, int32 *offset, int32 *length);
+
+HDFLIBAPI intn SDsetexternalfile
+    (int32 id, const char *filename, int32 offset);
+
+HDFLIBAPI intn SDsetnbitdataset
+    (int32 id, intn start_bit, intn bit_len, intn sign_ext, intn fill_one);
+
+HDFLIBAPI intn SDsetcompress
+    (int32 id, comp_coder_t type, comp_info *c_info);
+
+HDFLIBAPI intn SDgetcompress
+    (int32 id, comp_coder_t* type, comp_info *c_info);
+
+HDFLIBAPI intn SDgetcompinfo
+    (int32 id, comp_coder_t* type, comp_info *c_info);
+
+HDFLIBAPI intn SDgetcomptype
+    (int32 id, comp_coder_t* type);
+
+HDFLIBAPI int32 SDfindattr
+    (int32 id, const char *attrname);
+
+HDFLIBAPI int32 SDidtoref
+    (int32 id);
+
+HDFLIBAPI int32 SDreftoindex
+    (int32 fid, int32 ref);
+
+HDFLIBAPI int32 SDisrecord
+    (int32 id);
+
+HDFLIBAPI intn SDiscoordvar
+    (int32 id);
+
+HDFLIBAPI intn SDsetaccesstype
+    (int32 id, uintn accesstype);
+
+HDFLIBAPI intn SDsetblocksize
+    (int32 sdsid, int32 block_size);
+
+HDFLIBAPI intn SDgetblocksize
+    (int32 sdsid, int32 *block_size);
+
+HDFLIBAPI intn SDsetdimval_comp
+    (int32 dimid, intn compt_mode);
+
+HDFLIBAPI intn SDisdimval_bwcomp
+    (int32 dimid);
+
+HDFLIBAPI int32 SDcheckempty
+    (int32 sdsid, intn *emptySDS);
+
+HDFLIBAPI hdf_idtype_t SDidtype
+    (int32 an_id);
+
+HDFLIBAPI intn SDreset_maxopenfiles
+    (intn req_max);
+
+HDFLIBAPI intn SDget_maxopenfiles
+    (intn *curr_max, intn *sys_limit);
+
+HDFLIBAPI intn SDget_numopenfiles
+    ();
+
+HDFLIBAPI intn SDgetdatasize
+    (int32 sdsid, int32 *comp_size, int32 *uncomp_size);
+
+HDFLIBAPI intn SDgetfilename
+    (int32 fid, char *filename);
+
+HDFLIBAPI intn SDgetnamelen
+    (int32 sdsid, uint16 *name_len);
+
+/*====================== Chunking Routines ================================*/
+
+/* For defintion of HDF_CHUNK_DEF union see hproto.h since 
+   this defintion is also used by GRs. */
+
+/******************************************************************************
+ NAME
+      SDsetchunk   -- make SDS a chunked SDS
+
+ DESCRIPTION
+      This routine makes the SDS a chunked SDS according to the chunk
+      definition passed in.
+
+      The dataset currently cannot be special already.  i.e. NBIT,
+      COMPRESSED, or EXTERNAL. This is an Error.
+
+      The defintion of the HDF_CHUNK_DEF union with relvant fields is:
+
+      typedef union hdf_chunk_def_u
+      {
+         int32   chunk_lengths[H4_MAX_VAR_DIMS];  Chunk lengths along each dimension
+
+         struct 
+          {   
+            int32     chunk_lengths[H4_MAX_VAR_DIMS]; Chunk lengths along each dimension
+            int32     comp_type;                   Compression type 
+            comp_info cinfo;                       Compression info struct 
+          }comp;
+
+      } HDF_CHUNK_DEF
+
+      The simplist is the 'chunk_lengths' array specifiying chunk 
+      lengths for each dimension where the 'flags' argument set to 
+      'HDF_CHUNK';
+
+      COMPRESSION is set by using the 'HDF_CHUNK_DEF' structure to set the
+      appropriate compression information along with the required chunk lengths
+      for each dimension. The compression information is the same as 
+      that set in 'SDsetcompress()'. The bit-or'd'flags' argument' is set to 
+      'HDF_CHUNK | HDF_COMP'.
+
+      See the example in pseudo-C below for further usage.
+
+      The maximum number of Chunks in an HDF file is 65,535.
+
+      The dataset currently cannot have an UNLIMITED dimension.
+
+      The performance of the SDxxx interface with chunking is greatly
+      affected by the users access pattern over the dataset and by
+      the maximum number of chunks set in the chunk cache. The cache contains 
+      the Least Recently Used(LRU cache replacment policy) chunks. See the
+      routine SDsetchunkcache() for further info on the chunk cache and how 
+      to set the maximum number of chunks in the chunk cache. A default chunk 
+      cache is always created.
+
+      The following example shows the organization of chunks for a 2D array.
+      e.g. 4x4 array with 2x2 chunks. The array shows the layout of
+           chunks in the chunk array.
+
+            4 ---------------------                                           
+              |         |         |                                                 
+        Y     |  (0,1)  |  (1,1)  |                                       
+        ^     |         |         |                                      
+        |   2 ---------------------                                       
+        |     |         |         |                                               
+        |     |  (0,0)  |  (1,0)  |                                      
+        |     |         |         |                                           
+        |     ---------------------                                         
+        |     0         2         4                                       
+        ---------------> X                                                       
+                                                                                
+        --Without compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                                                                    
+        -- Set chunk lengths --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2; 
+
+        -- Set Chunking -- 
+        SDsetchunk(sdsid, chunk_def, HDF_CHUNK);                      
+         ......                                                                  
+        }                                                                           
+
+        --With compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                
+        -- Set chunk lengths first --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2;
+
+        -- Set compression --
+        chunk_def.comp.cinfo.deflate.level = 9;
+        chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+
+        -- Set Chunking with Compression --
+        SDsetchunk(sdsid, chunk_def, HDF_CHUNK | HDF_COMP);                      
+         ......                                                                  
+        }                                                                           
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn SDsetchunk
+    (int32 sdsid,             /* IN: sds access id */
+     HDF_CHUNK_DEF chunk_def, /* IN: chunk definition */
+     int32 flags              /* IN: flags */);
+
+/******************************************************************************
+ NAME
+     SDgetchunkinfo -- get Info on SDS
+
+ DESCRIPTION
+     This routine gets any special information on the SDS. If its chunked,
+     chunked and compressed or just a regular SDS. Currently it will only
+     fill the array of chunk lengths for each dimension as specified in
+     the 'HDF_CHUNK_DEF' union. It does not tell you the type of compression
+     used or the compression parameters. You can pass in a NULL for 'chunk_def'
+     if don't want the chunk lengths for each dimension.
+     Additionaly if successfull it will return a bit-or'd value in 'flags' 
+     indicating if the SDS is:
+
+     Chunked                  -> flags = HDF_CHUNK
+     Chunked and compressed   -> flags = HDF_CHUNK | HDF_COMP 
+     Non-chunked              -> flags = HDF_NONE
+  
+     e.g. 4x4 array - Pseudo-C
+     {
+     int32   rcdims[3];
+     HDF_CHUNK_DEF rchunk_def;
+     int32   cflags;
+     ...
+     rchunk_def.chunk_lengths = rcdims;
+     SDgetchunkinfo(sdsid, &rchunk_def, &cflags);
+     ...
+     }
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn SDgetchunkinfo
+    (int32 sdsid,              /* IN: sds access id */
+     HDF_CHUNK_DEF *chunk_def, /* IN/OUT: chunk definition */
+     int32 *flags              /* IN/OUT: flags */);
+
+/******************************************************************************
+ NAME
+     SDwritechunk  -- write the specified chunk to the SDS
+
+ DESCRIPTION
+     This routine writes a whole chunk of data to the chunked SDS 
+     specified by chunk 'origin' for the given SDS and can be used
+     instead of SDwritedata() when this information is known. This
+     routine has less overhead and is much faster than using SDwritedata().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See SDsetchunk() for a description of the organization of chunks in an SDS.
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn SDwritechunk
+    (int32 sdsid,      /* IN: sds access id */
+     int32 *origin,    /* IN: origin of chunk to write */
+     const void *datap /* IN: buffer for data */);
+
+/******************************************************************************
+ NAME
+     SDreadchunk   -- read the specified chunk to the SDS
+
+ DESCRIPTION
+     This routine reads a whole chunk of data from the chunked SDS
+     specified by chunk 'origin' for the given SDS and can be used
+     instead of SDreaddata() when this information is known. This
+     routine has less overhead and is much faster than using SDreaddata().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See SDsetchunk() for a description of the organization of chunks in an SDS.
+
+ RETURNS
+        SUCCEED/FAIL
+******************************************************************************/
+HDFLIBAPI intn SDreadchunk
+    (int32 sdsid,      /* IN: sds access id */
+     int32 *origin,    /* IN: origin of chunk to read */
+     void  *datap      /* IN/OUT: buffer for data */);
+
+/******************************************************************************
+NAME
+     SDsetchunkcache -- maximum number of chunks to cache 
+
+DESCRIPTION
+     Set the maximum number of chunks to cache.
+
+     The cache contains the Least Recently Used(LRU cache replacment policy) 
+     chunks. This routine allows the setting of maximum number of chunks that 
+     can be cached, 'maxcache'.
+
+     The performance of the SDxxx interface with chunking is greatly
+     affected by the users access pattern over the dataset and by
+     the maximum number of chunks set in the chunk cache. The number chunks 
+     that can be set in the cache is process memory limited. It is a good 
+     idea to always set the maximum number of chunks in the cache as the 
+     default heuristic does not take into account the memory available for 
+     the application.
+
+     By default when the SDS is promoted to a chunked element the 
+     maximum number of chunks in the cache 'maxcache' is set to the number of
+     chunks along the last dimension.
+
+     The values set here affects the current object's caching behaviour.
+
+     If the chunk cache is full and 'maxcache' is greater then the
+     current 'maxcache' value, then the chunk cache is reset to the new
+     'maxcache' value, else the chunk cache remains at the current
+     'maxcache' value.
+
+     If the chunk cache is not full, then the chunk cache is set to the
+     new 'maxcache' value only if the new 'maxcache' value is greater than the
+     current number of chunks in the cache.
+
+     Use flags argument of 'HDF_CACHEALL' if the whole object is to be cached 
+     in memory, otherwise pass in zero(0). Currently you can only
+     pass in zero.
+
+    See SDsetchunk() for a description of the organization of chunks in an SDS.
+
+RETURNS
+     Returns the 'maxcache' value for the chunk cache if successful 
+     and FAIL otherwise
+******************************************************************************/
+HDFLIBAPI intn SDsetchunkcache
+    (int32 sdsid,     /* IN: sds access id */
+     int32 maxcache,  /* IN: max number of chunks to cache */
+     int32 flags      /* IN: flags = 0, HDF_CACHEALL */);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MFSD_H_ */
diff --git a/mfhdf/libsrc/mfhdfi.h b/mfhdf/libsrc/mfhdfi.h
new file mode 100644
index 0000000..7363e2f
--- /dev/null
+++ b/mfhdf/libsrc/mfhdfi.h
@@ -0,0 +1,28 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id: mfhdfi.h 5009 2007-12-27 16:49:20Z bmribler $ */
+
+#ifndef _MFHDFI_H
+#define _MFHDFI_H
+
+/* enumerated type used to specify whether a variable is an SDS, coordinate
+   variable, or its type is unknown because it was created before HDF4.2r2 */
+typedef enum
+{
+    IS_SDSVAR=0,        /* variable is an actual SDS */
+    IS_CRDVAR=1,        /* variable is a coordinate variable */
+    UNKNOWN=2           /* variable is created before HDF4.2r2, unknown type */
+} hdf_vartype_t;
+
+#endif /* _MFHDFI_H */
diff --git a/mfhdf/libsrc/mfprivate.h b/mfhdf/libsrc/mfprivate.h
new file mode 100644
index 0000000..170db89
--- /dev/null
+++ b/mfhdf/libsrc/mfprivate.h
@@ -0,0 +1,48 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/******************************************************************************
+file - mfprivate.h
+
+  This file contains prototypes of private functions that are implemented
+  in mfsd.c.  Some of them are used by new functions in mfdatainfo.c.
+  The new file mfdatainfo.c keeps raw-data-information related functions
+  separately from the rest of the API.  These functions were introduced by
+  the hmap project.
+
+  Aug 8, 2010 -BMR
+******************************************************************************/
+
+/* Get the dimension record */
+NC_dim * SDIget_dim (NC *handle, int32 id);
+
+/* Get the handle from this object */
+NC * SDIhandle_from_id (int32 id, intn typ);
+
+/* Get the variable record */
+NC_var *SDIget_var (NC *handle, int32 sdsid);
+
+/* Put an attribute in an attribute list */
+intn SDIputattr (NC_array **ap, const char *name, int32 nt, intn count, const void * data);
+
+/* Get index of coordinate variable */
+int32 SDIgetcoordvar (NC *handle, NC_dim *dim, int32 id, int32 nt);
+
+/* Free a variables AID */
+int32 SDIfreevarAID (NC * handle, int32 index);
+
+/* Get the attribute list */
+intn SDIapfromid (int32 id, NC ** handlep, NC_array *** app);
+
+/* Check permission on the file */
+int SDI_can_clobber (const char *name);
+
diff --git a/mfhdf/libsrc/mfsd.c b/mfhdf/libsrc/mfsd.c
new file mode 100644
index 0000000..5b5db7b
--- /dev/null
+++ b/mfhdf/libsrc/mfsd.c
@@ -0,0 +1,7907 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 6036 $";
+#endif
+
+/* $Id: mfsd.c 6036 2014-01-20 17:28:01Z acheng $ */
+
+/******************************************************************************
+file - mfsd.c
+
+  This file contains the HDF/netCDF based multi-file interface for SDSs
+
+  All of the routines that make up this interface have names beginning
+  with SD.  Routines beginning with SDI are internal routines and
+  should not be used outside of this module.
+
+  Defining SDDEBUG will print status messages to stderr
+
+SD interface:
+------------------
+
+	--- open a file ---
+fid    = SDstart(file name, access);
+
+        --- get number of data sets and number of attributes in the file ---
+status = SDfileinfo(fid, *n_datasets, *n_attrs); 
+        
+	--- select a data set for access ---
+sdsid  = SDselect(fid, i, ...);   0 <= i < n_datasets
+
+        --- return the name, rank, dimsizes, #of attr, datatype ---
+status = SDgetinfo(sdsid, ...); 
+
+status = SDreaddata(sdsid, ...);
+
+status = SDgetrange(sdsid, ...);
+
+status = SDend(fid);
+
+status = SDisdimval_bwcomp(dimid);
+
+	--- check whether a data set is empty
+status = SDcheckempty(sdsid, ...);
+
+        --- retrieve the compression information of an SDS
+status = SDgetcompinfo(sdsid, ...);
+
+        --- retrieve the compression method of an SDS
+status = SDgetcomptype(sdsid, ...);
+
+        --- retrieve the compressed and uncompressed sizes of an SDS' data
+status = SDgetdatasize(sdsid, ...);
+
+        --- take an id and determine if it is an SD id, SDS id, dim id, ---
+        --- or none of the above ---
+id_type = SDidtype(an_id);
+
+	--- reset the maximum number of files can be opened at a time.
+max_files = SDreset_maxopenfiles(req_max);
+
+	--- retrieve the current number of opened files allowed in HDF and
+	--- the maximum number of opened files allowed on a system.
+status = SDget_maxopenfiles(&curr_max, &sys_limit);
+
+	--- return the number of files currently being opened.
+num_files = SDget_numopenfiles();
+
+	--- get the number of variables in the file having the given name.
+status = SDgetnumvars_byname(fid,...);
+
+	--- map a dataset name to an index.
+index = SDnametoindex(int32 fid,...);
+
+	--- retrieve a list of variables having the given name.
+status = SDnametoindices(fid,...);
+
+NOTE: This file needs to have the comments cleaned up for most of the
+       functions here. -GV 9/10/97
+
+******************************************************************************/
+
+#include "local_nc.h"
+
+#ifdef HDF
+#include "mfhdf.h"
+#include "hfile.h"
+
+#ifdef H4_HAVE_LIBSZ          /* we have the szip library */
+#include "szlib.h"
+#ifndef MIN
+#define MIN(a,b)    (((a)<(b)) ? (a) : (b))
+#endif
+#endif
+/* for Chunk debugging */
+/*
+#define CHK_DEBUG
+*/
+
+#ifndef MFSD_INTERNAL
+#define MFSD_INTERNAL
+#endif
+
+#ifdef MFSD_INTERNAL
+/* Private function prototypes */
+#include "mfprivate.h"
+#endif
+
+/* Whether we've installed the library termination function yet for this interface */
+PRIVATE intn library_terminate = FALSE;
+
+#ifdef MFSD_INTERNAL
+/******************************************************************************
+ NAME
+	SDIhandle_from_id -- get the handle from this object
+
+ DESCRIPTION
+    Map an ID to the handle for this file
+
+ RETURNS
+    NULL or the handle
+
+******************************************************************************/
+NC *
+SDIhandle_from_id(int32 id, /* IN: an object (file, dim, dataset) ID */
+                  intn  typ /* IN: IN: the type of ID this is */)
+{
+    int32 tmp;
+    NC   *ret_value = NULL;
+
+    /* check that it is the proper type of id */
+    tmp = (id >> 16) & 0x0f;
+    if(tmp != typ)
+      {
+        ret_value = NULL;
+        goto done;
+      }
+
+    /* get the file from top 12 bits*/
+    tmp = (id >> 20) & 0xfff;
+    ret_value = NC_check_id((int)tmp);
+
+done:
+    if (ret_value == NULL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDIhandle_from_id */
+
+
+/******************************************************************************
+ NAME
+	SDIget_var -- get the variable record
+
+ DESCRIPTION
+    Map an ID and a handle to the NC_var object for this dataset
+
+ RETURNS
+    NULL or the variable object
+
+******************************************************************************/
+NC_var *
+SDIget_var(NC   *handle, /* IN: the handle for this file */
+           int32 sdsid   /* IN: a dataset ID */)
+{
+    int32      varid;
+    NC_array **ap = NULL;
+    NC_var    *ret_value = NULL;
+
+    /* varid is low 16bits of sdsid */
+    varid = sdsid & 0xffff;
+
+    if(handle->vars != NULL 
+       && varid >= 0 
+       && varid < handle->vars->count) 
+      {
+        ap = (NC_array **)handle->vars->values;
+        ap += varid;
+      } 
+    else 
+      {
+        ret_value = NULL;
+        goto done;
+      }
+    
+    ret_value = ((NC_var *)*ap);
+
+done:
+    if (ret_value == NULL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDIget_var */
+
+
+/******************************************************************************
+ NAME
+	SDIget_dim -- get the dimension record
+
+ DESCRIPTION
+    Map an ID and a handle to the NC_dim object for this dimension
+
+ RETURNS
+    NULL or the variable object
+
+******************************************************************************/
+NC_dim *
+SDIget_dim(NC   *handle,/* IN: the handle for this file */
+           int32 id     /* IN: a dimension ID */)
+{
+    int32      dimindex;
+    NC_array **ap = NULL;
+    NC_dim    *ret_value = NULL;
+
+    /* dimindex is low 16bits of id */
+    dimindex = id & 0xffff;
+
+    if(handle->dims != NULL 
+       && dimindex >= 0 
+       && dimindex < handle->dims->count) 
+      {
+        ap = (NC_array **)handle->dims->values;
+        ap += dimindex;
+      } 
+    else 
+      {
+        ret_value = NULL;
+        goto done;
+      }
+    
+    ret_value = ((NC_dim *)*ap);
+
+done:
+    if (ret_value == NULL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDIget_dim */
+#endif /* MFSD_INTERNAL */
+
+/******************************************************************************
+ NAME
+	SDIstart -- initialize the SD interface
+
+ DESCRIPTION
+    Register the atexit callback function, etc.
+
+ RETURNS
+    SUCCEED/FAIL
+******************************************************************************/
+static intn
+SDIstart(void)
+{
+    CONSTR(FUNC, "SDIstart");    /* for HGOTO_ERROR */
+    intn        ret_value = SUCCEED;
+
+    /* Don't call this routine again... */
+    library_terminate = TRUE;
+
+    /* Install atexit() library cleanup routine */
+    if (HPregister_term_func(&SDPfreebuf) != 0)
+          HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+done:
+    if(ret_value == FAIL)
+    { /* Error condition cleanup */
+
+    } /* end if */
+
+    /* Normal function cleanup */
+    return(ret_value);
+} /* end SDIstart() */
+
+#ifdef MFSD_INTERNAL
+
+/******************************************************************************
+ NAME
+	SDI_can_clobber -- check permission on the file
+
+ DESCRIPTION
+    Check the file permissions.  If OK to clobber the file, return 1,
+    else return 0. 
+    Called by SDstart.
+
+ RETURNS
+    1 if OK to clobber
+    0 if not OK to overwrite
+
+******************************************************************************/
+int SDI_can_clobber(const char *name)
+{
+    int res;
+    struct stat buf;
+    FILE *ff;
+
+    res = stat(name, &buf);
+
+    if (res < 0) {
+        /* no such file, OK to try to create it */
+	return(1);
+    }
+
+    ff = HI_OPEN(name, DFACC_RDWR);
+
+    if (ff != NULL) {
+        /* OK to open for write, so OK to clobber it */
+        HI_CLOSE(ff);
+	return(1);
+    } 
+
+    /* no permission to write, don't do the create */
+    return(0);
+}
+#endif /* MFSD_INTERNAL */
+
+/******************************************************************************
+ NAME
+	SDstart -- open a file
+
+ DESCRIPTION
+    Open a file by calling ncopen() or nccreate() and return a
+    file ID to the file.
+
+ RETURNS
+    A file ID or FAIL
+
+******************************************************************************/
+int32
+SDstart(const char *name,   /* IN: file name to open */
+        int32       HDFmode /* IN: access mode to open file with */)
+{
+    CONSTR(FUNC, "SDstart");    /* for HGOTO_ERROR */
+    intn    cdfid;
+    int32   fid;
+    intn    NCmode;
+    NC     *handle = NULL;
+    int32   ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDstart: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* turn off annoying crash on error stuff */
+    ncopts = 0;
+
+    /* Perform global, one-time initialization */
+    if (library_terminate == FALSE)
+        if(SDIstart()==FAIL)
+            HGOTO_ERROR(DFE_CANTINIT, FAIL);
+
+    /* check access mode */
+    if(HDFmode & DFACC_WRITE)
+        NCmode = NC_RDWR;
+    else
+        NCmode = NC_NOWRITE;
+
+    if(HDFmode & DFACC_CREATE) 
+      { /* create file */
+        if(!SDI_can_clobber(name)) 
+            HGOTO_ERROR(DFE_DENIED, FAIL);
+        cdfid = nccreate(name, NC_CLOBBER);
+      } 
+    else 
+      { /* open the file */
+        cdfid = ncopen(name, NCmode);
+      }
+
+    /* check if bad create/open */
+    if(cdfid == -1) 
+    {
+        /* catch what's on the stack; this is to catch specific error code,
+           when the failure was due to "too many open files" -BMR- 2006/11/1 */
+        int16 err = HEvalue(1);
+        HGOTO_ERROR(err, FAIL);
+    }
+
+    /* hmm.....*/
+    handle = NC_check_id(cdfid);
+    if(handle == NULL) 
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* set in 'define' mode? */
+    handle->flags &= ~(NC_INDEF);
+
+    /* create file id to return */
+    fid = (((int32) cdfid) << 20) + (((int32) CDFTYPE) << 16) + cdfid;
+
+    ret_value = fid;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;
+} /* SDstart */
+
+
+/******************************************************************************
+ NAME
+	SDend -- close a file
+
+ DESCRIPTION
+    Close the file
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/
+intn
+SDend(int32 id /* IN: file ID of file to close */)
+{
+    intn  cdfid;
+    NC   *handle = NULL;
+    intn  ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDend: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get id? */
+    cdfid = (intn)id & 0xffff;
+
+#ifndef SYNC_ON_EACC
+
+    /* get the handle */
+    handle = SDIhandle_from_id(id, CDFTYPE);
+    if(handle == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* make sure we can write to the file */
+    if(handle->flags & NC_RDWR) 
+      {
+
+        handle->xdrs->x_op = XDR_ENCODE;
+
+        /* see if the meta-data needs to be updated */
+        if(handle->flags & NC_HDIRTY) 
+          {
+            if(!xdr_cdf(handle->xdrs, &handle))
+              {
+                ret_value = FAIL;
+                goto done;
+              }
+
+            handle->flags &= ~(NC_NDIRTY | NC_HDIRTY);
+          } 
+        else 
+          {
+
+            /* see if the numrecs info needs updating */
+              if(handle->flags & NC_NDIRTY) 
+                {
+                    if(!xdr_numrecs(handle->xdrs, handle))
+                      {
+                          ret_value = FAIL;
+                          goto done;
+                      }
+
+                    if (handle->file_type != HDF_FILE)
+                        handle->flags &= ~(NC_NDIRTY);
+                }
+          }
+      }
+
+#endif /* SYNC_ON_EACC */
+
+    /* call netCDF close */
+    ret_value = ncclose(cdfid);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;
+} /* SDend */
+
+
+/******************************************************************************
+ NAME
+	SDfileinfo -- get info about an open file
+
+ DESCRIPTION
+    Return the number of datasets and global attributes in the file.
+    NOTE:  the number of datasets includes coordinate variable
+    datasets.  The routine SDiscoordvar() should be used if the
+    distinction is important.
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/
+intn
+SDfileinfo(int32  fid,     /* IN:  file ID */
+           int32 *datasets,/* OUT: number of datasets in the file */
+           int32 *attrs    /* OUT: number of global attributes */)
+{
+    NC   *handle = NULL;
+    intn  ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDnumber: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* check that fid is valid and get file structure */
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDnumber: looked up handle as %d\n", handle);
+#endif
+
+    /* get number of data sets and global attributes */
+    *(int32 *)datasets = ((handle->vars != NULL) ? handle->vars->count : 0);
+    *(int32 *)attrs    = ((handle->attrs != NULL) ? handle->attrs->count : 0);
+
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;
+} /* SDfileinfo */
+
+
+/******************************************************************************
+ NAME
+	SDselect -- get a dataset ID
+
+ DESCRIPTION
+    Return an id for the index-th data set in the file
+
+    We've got 32bits, the current ID looks like:
+
+    sdsID:
+        
+        32           20       16               0
+        ----------------------------------------
+        |  fid       | id-type| position index |
+        ----------------------------------------
+        
+    fid is the netCDF based file ID (i.e. from ncopen).  ID type
+    is SDSTYPE defined in mfhdf.h and position index is the 
+    position in the file of this dataset.
+
+    The position index is zero based
+
+ RETURNS
+   An ID to a dataset else FAIL
+        
+******************************************************************************/
+int32
+SDselect(int32 fid,  /* IN: file ID */
+         int32 index /* IN: index of dataset to get ID for */)
+{
+    NC    *handle = NULL;
+    int32  sdsid;         /* the id we're gonna build */
+    int32  ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDselect: I've been called (index: %d) \n", index);
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* check that fid is valid */
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* check that a data set with this index exists */
+    if(handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    if((unsigned)index >= handle->vars->count)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* create SDS id to return */
+    sdsid  = (((int32) fid & 0xffff) << 20) + (((int32) SDSTYPE) << 16) + index;
+
+    ret_value = sdsid;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;
+} /* SDselect */
+
+/******************************************************************************
+ NAME
+	SDgetinfo -- get info about a dataset
+
+ DESCRIPTION
+    The user is repsonsible for allocating space to hold
+    the dataset name.  It can be at most H4_MAX_NC_NAME 
+    characters in length.  NULL can be passed for any of
+    of the parameters if it is not required.
+
+    dimsizes should be an array to hold the dimension sizes
+    a dataset can have at most H4_MAX_VAR_DIMS dimensions.
+
+ RETURNS
+        SUCCEED / FAIL
+
+******************************************************************************/ 
+intn
+SDgetinfo(int32  sdsid,   /* IN:  dataset ID */
+          char  *name,    /* OUT: name of the dataset */
+          int32 *rank,    /* OUT: rank of the dataset */
+          int32 *dimsizes,/* OUT: array of dimension siszes */ 
+          int32 *nt,      /* OUT: number type of data */
+          int32 *nattrs   /* OUT: the number of local attributes */)
+{
+    CONSTR(FUNC, "SDgetinfo");    /* for HGOTO_ERROR */
+    intn    i;
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetinfo: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* obtain the variable structure */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get sds name if it's requested */
+    if(name != NULL) 
+      {
+          HDmemcpy(name, var->name->values, var->name->len);
+          name[var->name->len] = '\0';
+      }
+
+    /* get sds' rank if it is requested */
+    if(rank != NULL)
+	*rank = var->assoc->count;
+
+    /* get sds' number type if it is requested */
+    if(nt != NULL)
+    {
+	if(!var->HDFtype)
+	    *nt    = hdf_map_type(var->type);
+	else
+	    *nt    = var->HDFtype;
+    }
+
+    /* get sds' number of attributes if it is requested */
+    if(nattrs != NULL)
+	*nattrs = (var->attrs ? var->attrs->count : 0);
+
+    /* get sds' dimension sizes if they are requested */
+    if(dimsizes != NULL)
+    {
+	for(i = 0; i < var->assoc->count; i++)
+	    dimsizes[i] = (int32) var->shape[i];
+
+	if(dimsizes[0] == NC_UNLIMITED) 
+	{
+	    if(handle->file_type == HDF_FILE)
+		dimsizes[0] = var->numrecs;
+	    else
+		dimsizes[0] = handle->numrecs;
+	}
+    }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDgetinfo */
+
+
+/******************************************************************************
+ NAME
+	SDreaddata -- read a hyperslab of data
+
+ DESCRIPTION
+    Read a hyperslab of data from the given variable.
+
+ RETURNS
+     SUCCEED / FAIL
+ 
+******************************************************************************/
+intn
+SDreaddata(int32  sdsid,  /* IN:  dataset ID */
+           int32 *start,  /* IN:  coords of starting point */
+           int32 *stride, /* IN:  stride along each dimension */
+           int32 *end,    /* IN:  number of values to read per dimension */
+           void  *data    /* OUT: data buffer */)
+{
+    CONSTR(FUNC, "SDreaddata");    /* for HGOTO_ERROR */
+    NC     *handle = NULL;
+    NC_dim *dim = NULL;
+    intn    varid;
+    int32   status;
+    comp_coder_t comp_type=COMP_CODE_INVALID;
+    uint32  comp_config;
+    NC_var * var;
+#ifdef BIG_LONGS
+    long    Start[H4_MAX_VAR_DIMS];
+    long    End[H4_MAX_VAR_DIMS];
+    long    Stride[H4_MAX_VAR_DIMS];
+#else
+    long    *Start = NULL;
+    long    *End   = NULL;
+    long    *Stride = NULL;
+#endif
+    intn    ret_value = SUCCEED;
+
+    /* This decides how a dataset with unlimited dimension is read along the
+       unlimited dimension; the behavior is different between SD and nc APIs */
+    cdf_routine_name = "SDreaddata";
+
+    /* Clear error stack */
+    HEclear();
+    
+    /* Validate arguments */
+    if((start == NULL) || (end == NULL) || (data == NULL))
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get the NC_dim or NC_var depending on which id is given */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          handle = SDIhandle_from_id(sdsid, DIMTYPE);
+          if(handle == NULL) 
+	      HGOTO_ERROR(DFE_ARGS, FAIL);
+
+          dim = SDIget_dim(handle, sdsid);
+      }
+
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Dev note: empty SDS should have been checked here and SDreaddata would
+       have failed, but since it wasn't, for backward compatibility, we won't
+       do it now either. -BMR 2011 */
+
+    /* Check if compression method is enabled */
+
+    /* Make sure that the file is an HDF file before checking about compression */
+    if(handle->file_type == HDF_FILE) /* bug HDFFR-473 */
+    {
+	status = HCPgetcomptype(handle->hdf_file, var->data_tag, var->data_ref,
+                &comp_type);
+
+	if (status != FAIL)
+	    if (comp_type != COMP_CODE_NONE && comp_type != COMP_CODE_INVALID)
+	    {
+		/* Must have decoder to read data */
+		HCget_config_info( comp_type , &comp_config);
+		if ((comp_config & COMP_DECODER_ENABLED) == 0)
+		{ /* decoder not present?? */
+		    HGOTO_ERROR(DFE_BADCODER, FAIL);
+		}
+	    }
+	/* The case status=FAIL is not handled, not sure if it's intentional. -BMR */
+    } /* file is HDF */
+
+    /* Get ready to read */
+    handle->xdrs->x_op = XDR_DECODE ;
+   
+    /* 
+     * Figure out the index of the variable to read from,
+     * the user might have passed us a dimension, in which
+     * case we want to reade from its coordinate variable
+     */
+    if(dim) 
+      {
+          varid = SDIgetcoordvar(handle, dim, (int32)(sdsid & 0xffff), (int32) 0);
+      } 
+    else 
+      {
+          /* Derive the variable index from the SDS id, using the formula
+             described in SDselect */
+          varid = (intn)sdsid & 0xffff;
+      }
+
+    /*
+     * In general, (long) == int32 
+     * In cases where it doesn't we need to convert
+     */
+#ifdef BIG_LONGS
+    {
+        int i;
+        for(i = 0; i < var->assoc->count; i++) 
+          {
+            Start[i]  = (long) start[i];
+            End[i]    = (long) end[i];
+            if(stride) 
+                Stride[i] = (long) stride[i];
+          }
+    }
+
+#else
+
+    Start  = (long *)start;
+    End    = (long *)end;
+    Stride = (long *)stride;
+
+#endif
+
+    /* Validate stride value if given - make sure we don't try to "stride" */
+    /* beyond the dimension's end */
+    if(stride != NULL)
+    {
+        int i;
+	int32 dimsize = (int32) var->shape[0];
+
+	/* Validate stride value of first dimension separately to catch */
+	/* unlimited dimension situation */
+	if (var->shape[0] == NC_UNLIMITED)
+	{
+	    /* get the actual size */
+	    if(handle->file_type == HDF_FILE)
+		dimsize = var->numrecs;
+	    else
+		dimsize = handle->numrecs;
+	}
+	if ((Stride[0]*(End[0]-1)) >= (dimsize-Start[0]))
+	    HGOTO_ERROR(DFE_ARGS, FAIL);
+
+	/* Validate subsequent dimensions if dataset is multi-dim */
+	for(i = 1; i < var->assoc->count; i++)
+	     if ((Stride[i]*(End[i]-1)) >= ((int32)var->shape[i]-Start[i]))
+		HGOTO_ERROR(DFE_ARGS, FAIL);
+    }
+
+    /* Call the readg routines if a stride is given */
+    if(stride == NULL)
+        status = NCvario(handle, varid, Start, End, (Void *)data);
+    else
+        status = NCgenio(handle, varid, Start, End, Stride, NULL, (Void *)data);
+
+    if(status == -1)
+        ret_value = FAIL;
+    else
+        ret_value = SUCCEED;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDreaddata */
+
+
+/******************************************************************************
+ NAME
+	SDnametoindex -- map a dataset name to an index
+
+ DESCRIPTION
+    Given a data set name return the index (not ID) of the 
+    first data set whose name matches.
+
+    There can be multiple data sets with the same name.  In 
+    such a case, we only ever return the index of the first
+    such dataset.
+    Wildcards are not supported
+
+ RETURNS
+        Index of a dataset or FAIL
+
+******************************************************************************/
+int32
+SDnametoindex(int32 fid,  /* IN: file ID */
+              const char *name  /* IN: name of dataset to search for */)
+{
+    unsigned ii;
+    intn     len;
+    NC      *handle = NULL;
+    NC_var **dp = NULL;
+    int32    ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDnametoindex: I've been called\n");
+#endif
+
+
+    /* check that fid is valid */
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    len = HDstrlen(name) ;
+    dp = (NC_var**)handle->vars->values ;
+    for(ii = 0 ; ii < handle->vars->count ; ii++, dp++) 
+      {
+        if( len == (*dp)->name->len 
+            && HDstrncmp(name, (*dp)->name->values, HDstrlen(name)) == 0) 
+          {
+            ret_value = (int32)ii;
+            goto done;
+          }
+      }
+
+    ret_value = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDnametoindex */
+
+
+/******************************************************************************
+ NAME
+	SDgetnumvars_byname -- get the number of variables in the file having 
+			the given name.
+
+ DESCRIPTION
+    Given a data set name, retrieve the number of variables in the file having
+    the same name.  Sometime, more than one SDS are named 'name' or a 
+    dimension of the SDS 'name' is also named 'name.'  The user can use
+    this function to find out how many of those having the same name.
+
+ RETURNS
+        SUCCEED / FAIL
+
+ MODIFICATION
+
+******************************************************************************/
+intn
+SDgetnumvars_byname(int32 fid,  /* IN: file ID */
+              const char *name,  /* IN: name of dataset to search for */
+	      int32* n_vars)
+{
+    unsigned ii;
+    intn     len;
+    int32    count = 0;
+    NC      *handle = NULL;
+    NC_var **dp = NULL;
+    intn     ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetnumvars_byname: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* check that fid is valid */
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    len = HDstrlen(name) ;
+    dp = (NC_var**)handle->vars->values ;
+    for(ii = 0 ; ii < handle->vars->count; ii++, dp++) 
+      {
+        if( len == (*dp)->name->len 
+            && HDstrncmp(name, (*dp)->name->values, HDstrlen(name)) == 0) 
+	    count++;
+      }
+    *n_vars = count;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDgetnumvars_byname */
+
+
+/******************************************************************************
+ NAME
+	SDnametoindices -- retrieves a list of variables having the given name.
+
+ DESCRIPTION
+    Given a data set name, retrieve a list of structures, each of which 
+    contains the index of a variable whose name matches the given name, and 
+    the type of the variable, which is either data set (IS_SDSVAR) or 
+    coordinate variable (IS_CRDVAR,) or (UNKNOWN.)  UNKNOW is for data 
+    created before the fix of a data corruption bug due to the library's
+    inability to distinguish between those two types of variables.  The
+    fix was available starting in HDF4.2r2.
+
+    This API is added to allow the user to examine all the variables having
+    the given name and decide the correct one to gain access on.
+
+ RETURNS
+        SUCCEED / FAIL
+
+ MODIFICATION
+
+******************************************************************************/
+intn
+SDnametoindices(int32 fid,  /* IN: file ID */
+		const char *name,  /* IN: name of dataset to search for */
+		hdf_varlist_t* var_list)
+{
+    unsigned ii;
+    intn     len;
+    NC      *handle = NULL;
+    NC_var **dp = NULL;
+    hdf_varlist_t* varlistp;
+    int32    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDnametoindices: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* check that fid is valid */
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    len = HDstrlen(name) ;
+    dp = (NC_var**)handle->vars->values ;
+    varlistp = var_list;
+    for(ii = 0 ; ii < handle->vars->count; ii++, dp++) 
+      {
+        if( len == (*dp)->name->len 
+            && HDstrncmp(name, (*dp)->name->values, HDstrlen(name)) == 0) 
+	  {
+	    varlistp->var_index = (int32)ii;
+	    varlistp->var_type = (*dp)->var_type;
+	    varlistp++;
+	  }
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDnametoindices */
+
+
+/******************************************************************************
+ NAME
+	SDgetrange -- simulate a call to DFSDgetrange
+
+ DESCRIPTION
+    If a "valid_range" attribute is provided return its 
+    values in pmax and pmin.  Else if both a "valid max" 
+    AND a "vaild min" exist return their values in pmax and pmin.
+
+    Arrgghh, in HDF it was assumed that the max and min values 
+    were of the same data type as the rest of the data.  So 
+    the user would know the amount of storage to send to get 
+    back the max and min values.  This is not the case with 
+    netCDF.  This routine will only work if they are already 
+    the same number types.
+
+ RETURNS
+    On error or missing attributes return FAIL else SUCCEED.
+
+******************************************************************************/
+intn
+SDgetrange(int32 sdsid, /* IN:  dataset ID */
+           void * pmax,  /* OUT: valid max */
+           void * pmin   /* OUT: valid min */)
+{
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    NC_attr **attr = NULL;
+    NC_attr **attr1 = NULL;
+    NC_attr **attr2 = NULL;
+    NC_array *array = NULL;
+    intn      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetrange: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_ValidRange);
+    if((attr != NULL) && ((*attr)->data->type == var->type)) 
+      {
+        /* BUG: this may be a pointer to a pointer */
+        array = (NC_array *) (*attr)->data;
+        HDmemcpy(pmin, array->values, array->szof);
+        HDmemcpy(pmax, array->values + array->szof, array->szof);
+      } 
+    else 
+      {
+        attr1 = (NC_attr **) NC_findattr(&(var->attrs), "valid_max");
+        attr2 = (NC_attr **) NC_findattr(&(var->attrs), "valid_min");
+        
+        if((attr1 == NULL) || (attr2 == NULL)) 
+          {
+#ifdef SDDEBUG
+            fprintf(stderr, "No dice on range info (missing at least one)\n");
+#endif   
+            ret_value = FAIL;
+            goto done;
+          }
+
+        if(((*attr1)->HDFtype != var->HDFtype) 
+           || ((*attr2)->HDFtype != var->HDFtype)) 
+          {
+#ifdef SDDEBUG
+            fprintf(stderr, "No dice on range info (wrong types)\n");
+#endif   
+            ret_value = FAIL;
+            goto done;
+          }
+
+        NC_copy_arrayvals((char *)pmax, (*attr1)->data) ;
+        NC_copy_arrayvals((char *)pmin, (*attr2)->data) ;
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;
+} /* SDgetrange */
+
+
+/* -------------------------- CREATION INTERFACE -------------------------- */
+/*
+
+        --- create a new data set ---
+sdsid   = SDcreate(fid, name, numbertype, rank, dimsizes);
+
+        --- associate a name with a dimension.  If a prev sdsid is ---
+        --- provided then it is assumed that the current dimension is the ---
+        --- same as the dimension with the same name of the previous sds ---
+status  = SDsetdim(sdsid, dimnumber, dimname, [prev sdsid] );
+
+        --- note that it will be possible to store values for a ---
+        --- dimension without having to name it ---
+status  = SDsetdimvalues(sdsid, dimnumber, numbertype, count, data);
+
+        --- set the units and format strings ---
+status  = SDsetdimstrs(sdsid, dimnumber, unitstr, formatstr);
+
+        --- we will need an SDendaccess() so that we know when it ---
+        --- is safe to write the information out in this case ---
+status  = SDendaccess(sdsid);
+
+        --- set fill mode for a file open for write
+cur_mode = SDsetfillmode(fid, fillmode);
+
+        --- set dimval backward compatible  for write
+status  = SDsetdimval_comp(dimid, compt_mode);
+ 
+*/
+
+/******************************************************************************
+ NAME
+	SDcreate -- create a new dataset
+
+ DESCRIPTION
+    Simulate a call to ncvardef without having to be in 
+    define mode.  name can be at most H4_MAX_NC_NAME
+    characters.  Rank can be at most H4_MAX_VAR_DIMS
+
+    It looks like for the call to NC_new_var() we need to 
+    have dimension IDs already.  So I guess we should just 
+    create the fake dimensions now and when optional 
+    information comes in (i.e.  name, tying to other 
+    dimensions) we'll go in and modify the structure in place.
+    This is gonna be heinous.  Please do not attempt this at home
+    See SDselect() for a discussion on how SDS IDs are set up.
+
+ RETURNS
+    An ID to the new dataset else FAIL
+
+******************************************************************************/
+int32
+SDcreate(int32  fid,      /* IN: file ID */
+         const char  *name, /* IN: dataset name */
+         int32  nt,       /* IN: dataset number type */
+         int32  rank,     /* IN: rank of dataset */
+         int32 *dimsizes  /* IN: array of dimension sizes */)
+{
+    intn     i;
+    NC      *handle = NULL;
+    NC_var  *var = NULL;
+    NC_dim  *newdim = NULL;
+    int32    sdsid;
+    nc_type  nctype;
+    char     dimname[H4_MAX_NC_NAME];
+    intn     num;
+    intn    *dims = NULL;
+    intn     is_ragged;
+    int32    ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDcreate: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* check that fid is valid */
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* fudge the name since its optional */
+    if((name == NULL) || (name[0] == ' ') || (name[0] == '\0'))
+        name = "DataSet";
+
+    /* check if its a ragged array.
+       Why is this code still here? -GV */
+    if((rank > 1) && dimsizes[rank - 1] == SD_RAGGED) 
+      {
+#ifdef DEBUG
+        printf("YOW!  We have a ragged array kids: %s\n", name);
+#endif
+        rank--;
+        is_ragged = TRUE;
+      } 
+    else 
+      {
+        is_ragged = FALSE;        
+      }
+
+    /* make fake dimensions which may or may not be over-ridden later */
+    dims = (intn *) HDmalloc(rank * sizeof(intn));
+    if(dims == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    if(rank > H4_MAX_VAR_DIMS)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    for(i = 0; i < rank; i++) 
+      {
+
+          num = (handle->dims ? handle->dims->count : 0);
+          sprintf(dimname, "fakeDim%d", num);
+          newdim = (NC_dim *) NC_new_dim(dimname, dimsizes[i]);
+          if(newdim == NULL) 
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+
+          if(handle->dims == NULL) 
+            { /* first time */
+                handle->dims = NC_new_array(NC_DIMENSION,(unsigned)1, (Void *)&newdim);
+                if(handle->dims == NULL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            } 
+          else 
+            {
+                if( NC_incr_array(handle->dims, (Void *)&newdim) == NULL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+
+          dims[i] = (intn) handle->dims->count -1;
+
+      } /* end for 'i < rank' */
+
+    /* create the actual variable */
+    if ((nctype = hdf_unmap_type((int)nt)) == FAIL)
+      {
+#ifdef SDDEBUG
+          /* replace it with NCAdvice or HERROR? */
+          fprintf(stderr "SDcreate: hdf_unmap_type failed for %d\n", nt);
+#endif
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = (NC_var *) NC_new_var(name, nctype, (int)rank, dims);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    
+    /* Set the "newly created" & "set length" flags for use in SDwritedata */
+    var->created=TRUE;
+    var->set_length=FALSE;
+
+    /* Indicate that this variable is an actual sds, not a coordinate 
+	variable (bugzilla 624) - BMR - 05/14/2007 */
+    var->var_type=IS_SDSVAR;
+
+    /* NC_new_var strips off "nativeness" add it back in if appropriate */
+    var->HDFtype = nt;
+    if (FAIL == (var->HDFsize = DFKNTsize(nt)))
+      {
+          ret_value    = FAIL;
+          goto done;
+      } 
+
+    var->cdf     = handle; /* set cdf before calling NC_var_shape */
+    /* get a new NDG ref for this sucker */
+#ifdef NOT_YET
+    var->ndg_ref = Htagnewref(handle->hdf_file,DFTAG_NDG);
+#else /* NOT_YET */
+    var->ndg_ref = Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+
+    /* set ragged status. Why is this still here -GV */
+    var->is_ragged = is_ragged;
+    
+    /* no ragged array info stored yet */
+    if(var->is_ragged) 
+      {
+        var->rag_list = NULL;
+        var->rag_fill = 0;
+      }
+
+    /* add it to the handle */
+    if(handle->vars == NULL) 
+      { /* first time */
+          handle->vars = NC_new_array(NC_VARIABLE,(unsigned)1, (Void *)&var);
+          if(handle->vars == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      } 
+    else 
+      {
+          if(handle->vars->count >= H4_MAX_NC_VARS) 
+            {
+                ret_value = FAIL;
+                goto done;
+            } 
+          else 
+            {
+                if( NC_incr_array(handle->vars, (Void *)&var) == NULL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  } 
+            }
+      }
+
+    /* compute all of the shape information */
+    if(NC_var_shape(var, handle->dims) == -1)
+      {
+          ret_value = FAIL;
+          goto done;
+      } 
+
+    /* create a handle we can give back to the user */
+    sdsid  = (((int32) fid) << 20) + (((int32) SDSTYPE) << 16);
+    sdsid += handle->vars->count -1;
+
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+    /* free dims */
+    HDfree(dims);
+
+    ret_value = sdsid;
+
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDcreate */
+
+
+/******************************************************************************
+ NAME
+	SDgetdimid -- get a dimension ID
+
+ DESCRIPTION
+    Given an sdsid and a dimension number return a 
+    dimid.  Index is a ZERO based quantity
+
+    The dimID looks similar to the sdsID except DIMTYPE 
+    is substituted for SDSTYPE as the id-type:
+
+    dimID:
+        
+        32           20       16               0
+        ----------------------------------------
+        |  fid       | id-type| position index |
+        ----------------------------------------
+
+ RETURNS
+        An ID to the dimension else FAIL
+        
+******************************************************************************/
+int32
+SDgetdimid(int32 sdsid,  /* IN: dataset ID */
+           intn  number  /* IN: index of dimension, in the SDS, ie. <= rank-1 */)
+{
+    CONSTR(FUNC, "SDgetdimid");    /* for HGOTO_ERROR */
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    int32   id;
+    int32   dimindex; /* index of dim in the file, ie. dims of all SDSs */
+    int32   ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetdimid: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* sanity check args */
+    if(number < 0) 
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get the handle */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get the variable */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* check if enough / too many dims */
+    if((var->assoc == NULL) || (var->assoc->count < (unsigned)number))
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get the dim number out of the assoc array */
+    if (var->assoc->values == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+    dimindex = var->assoc->values[number];
+
+    /* build the dim id */
+    id  = (sdsid & 0xfff00000) + (((int32) DIMTYPE) << 16) + dimindex;
+
+    ret_value = id;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDgetdimid */
+
+
+/******************************************************************************
+ NAME
+	SDsetdimname -- give a name to a dimension
+
+ DESCRIPTION
+    Set the name of a dimension -- at most H4_MAX_NC_NAME characters.  
+    If this name is already in use we should point to the 
+    existing dimension with that name.  If the sizes are 
+    different return an error.  If this dimension already has
+    a name throw it out and use the new one.
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/
+intn
+SDsetdimname(int32  id,   /* IN: dataset ID */
+             const char  *name  /* IN: dimension name */)
+{
+    NC         *handle = NULL;
+    NC_dim     *dim = NULL;
+    NC_dim    **dp = NULL;
+    NC_string  *old = NULL;
+    NC_string  *new = NULL;
+    NC_array  **ap = NULL;
+    size_t      len;
+    unsigned    ii;
+    intn        ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetdimname: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(id, DIMTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get the dimension structure */
+    dim = SDIget_dim(handle, id);
+    if(dim == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* check for name in use */
+    len = HDstrlen(name) ;
+    dp = (NC_dim**)handle->dims->values ;
+    for(ii = 0 ; ii < handle->dims->count ; ii++, dp++) 
+      {
+          if( len == (*dp)->name->len 
+              && HDstrncmp(name, (*dp)->name->values, HDstrlen(name)) == 0) 
+            {
+                if(dim != (*dp)) 
+                  {
+                      /* a dimension with this name already exists */
+                      /* so change to point to it */
+                      if(dim->size != (*dp)->size)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      ap = (NC_array **) handle->dims->values;
+                      ap += id & 0xffff;
+                      NC_free_dim(dim);
+                      (*dp)->count += 1;
+                      (*ap) = (NC_array *) (*dp);
+                      ret_value = SUCCEED;
+                      goto done;
+                  }
+            }
+      }
+    
+    /* throw out the old name if it exists and create a new one */
+    old = dim->name;
+    new = NC_new_string((unsigned)HDstrlen(name),name);
+    if(new == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    dim->name = new;
+    NC_free_string(old);
+    
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDsetdimname */
+
+
+/******************************************************************************
+ NAME
+	SDendaccess -- close a sds ID
+
+ DESCRIPTION
+    Close down this access ID to a data object
+
+    Usually, this will do nothing.  However, if the meta-data 
+    has changed and SYNC_ON_EACC is defiend flush it all out 
+    to disk.
+
+ RETURNS
+        SUCCEED / FAIL          
+
+******************************************************************************/
+intn
+SDendaccess(int32 id /* IN: dataset ID */)
+{
+    NC     *handle;
+    int32   ret_value = SUCCEED;
+	
+#ifdef SDDEBUG
+    fprintf(stderr, "SDendaccess: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+#ifdef SYNC_ON_EACC
+
+    /* make sure we can write to the file */
+    if(handle->flags & NC_RDWR) 
+      {
+          handle->xdrs->x_op = XDR_ENCODE;
+
+          /* see if the meta-data needs to be updated */
+          if(handle->flags & NC_HDIRTY) 
+            {
+                if(!xdr_cdf(handle->xdrs, &handle) )
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                handle->flags &= ~(NC_NDIRTY | NC_HDIRTY);
+            } 
+          else 
+            {
+                /* see if the numrecs info needs updating */
+                if(handle->flags & NC_NDIRTY) 
+                  {
+                      if(!xdr_numrecs(handle->xdrs, handle) )
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      handle->flags &= ~(NC_NDIRTY);
+                  }
+            }
+      }
+
+#else 
+
+    /* free the AID */
+    ret_value = SDIfreevarAID(handle, id & 0xffff);
+     
+#endif /* SYNC_ON_EACC */
+  
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDendaccess */
+
+#ifdef MFSD_INTERNAL
+
+/******************************************************************************
+ NAME
+	SDIputattr -- put an attribute in an attribute list
+
+ DESCRIPTION
+    Common code for adding an attribute to an attribute list.
+    The list gets created if it had previously been empty
+
+ RETURNS
+     SUCCEED / FAIL
+
+******************************************************************************/
+intn
+SDIputattr(NC_array **ap,   /* IN/OUT: attribute list */
+           const char *name, /* IN:     attribute name */
+           int32      nt,   /* IN:     attribute number type */
+           intn       count,/* IN:     number of attribute values */
+           const void *      data  /* IN:     attribute values */)
+{
+    NC_attr *attr = NULL;
+    NC_attr **atp = NULL;
+    NC_attr *old = NULL;
+    nc_type  type;   /* unmap -- HDF type to NC type */
+    intn     ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDIputattr: I've been called\n");
+#endif
+    
+    if ((type = hdf_unmap_type((int)nt)) == FAIL)
+      {
+          /* replace it with NCAdvice or HERROR? */
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(*ap == NULL) 
+      { /* first time */
+          attr = (NC_attr *) NC_new_attr(name,type,(unsigned)count,data) ;
+          if(attr == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+
+          attr->HDFtype = nt; /* Add HDFtype  */
+          *ap = NC_new_array(NC_ATTRIBUTE,(unsigned)1, (Void*)&attr) ;
+          if(*ap == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+    else
+      {
+          if((atp = NC_findattr(ap, name)) != NULL) 
+            { /* name in use */
+                old = *atp ;
+                *atp = (NC_attr *) NC_new_attr(name,type,(unsigned)count,data);
+                if(*atp == NULL) 
+                  {
+                      *atp = old;
+                      ret_value = FAIL;
+                      goto done;
+                  }
+                (*atp)->HDFtype = nt; /* Add HDFtype  */
+                NC_free_attr(old);
+            }
+          else   
+            {
+                if((*ap)->count >= H4_MAX_NC_ATTRS) 
+                  {  /* Too many */
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                /* just add it */
+                attr = (NC_attr *) NC_new_attr(name,type,(unsigned)count,data);
+                attr->HDFtype = nt; /* Add HDFtype  */
+                if(attr == NULL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+                if(NC_incr_array((*ap), (Void *)&attr) == NULL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+      }
+        
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDIputattr */
+
+#endif /* MFSD_INTERNAL */
+
+/******************************************************************************
+ NAME
+	SDsetrange -- simulate a call to DFSDsetrange
+
+ DESCRIPTION
+    Store range info for this variable in the valid_range 
+    attribute.  If that attribute already exists overwrite 
+    the current values.  It is assumed that the values are 
+    the same type as the data set.
+
+    It is up to the user to decide what is meant by the
+    "valid" max and min.
+
+ RETURNS
+    On error FAIL else SUCCEED.
+
+******************************************************************************/
+intn
+SDsetrange(int32 sdsid, /* IN: dataset ID */
+           void * pmax,  /* IN: valid max */
+           void * pmin   /* IN: valid min */)
+{
+    NC      *handle = NULL;
+    NC_var  *var = NULL;
+    uint8    data[80];
+    intn     sz;
+    intn     ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetrange: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if((pmax == NULL) || (pmin == NULL))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* move data values over */
+    if (FAIL == (sz = DFKNTsize(var->HDFtype | DFNT_NATIVE)))
+      {
+          ret_value    = FAIL;
+          goto done;
+      } 
+
+    HDmemcpy(data, pmin, sz);
+    HDmemcpy(data + sz, pmax, sz);
+
+    /* call common code */
+    if(SDIputattr(&var->attrs, _HDF_ValidRange, var->HDFtype, (intn) 2, data) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetrange */
+
+#ifdef MFSD_INTERNAL
+/******************************************************************************
+ NAME
+	SDIapfromid -- get the attribute list
+
+ DESCRIPTION
+    Given a ID figure out what the handle and attribute 
+    list pointer are for that object.
+
+ RETURNS
+     On error FAIL else SUCCEED.
+
+******************************************************************************/
+intn
+SDIapfromid(int32       id,      /* IN:  object ID */
+            NC        **handlep, /* IN:  handle for this file */
+            NC_array ***app      /* OUT: attribute list */)
+{
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    NC_dim *dim = NULL;
+    int32   varid;
+    intn    ret_value = SUCCEED;
+
+    /* see if its a variable ID */
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle != NULL) 
+      { 
+          /* find the variable */
+          var = SDIget_var(handle, id);
+          if(var == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+
+          (*app) = &(var->attrs);
+          (*handlep) = handle;
+          ret_value = SUCCEED;
+          goto done;
+      } 
+
+    /* see if its a file ID */
+    handle = SDIhandle_from_id(id, CDFTYPE);
+    if(handle != NULL) 
+      {
+          (*app) = &(handle->attrs);
+          (*handlep) = handle;
+          ret_value = SUCCEED;
+          goto done;
+      }
+
+    /* see if its a dimension ID */
+    handle = SDIhandle_from_id(id, DIMTYPE);
+    if(handle != NULL) 
+      {
+          /* find the dimension */
+          dim = SDIget_dim(handle, id);
+          if(dim == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* get index of coordinate variable */
+          varid = SDIgetcoordvar(handle, dim, (int32)(id & 0xffff), (int32) 0);
+
+          /* get the variable object */
+          var = NC_hlookupvar(handle, varid);
+          if(var == NULL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+
+
+          (*app) = &(var->attrs);
+          (*handlep) = handle;
+          ret_value = SUCCEED;
+          goto done;
+      }
+
+    ret_value = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDIapfromid */
+
+#endif /* MFSD_INTERNAL */
+
+/******************************************************************************
+ NAME
+   SDsetattr -- user level function to create and set an attribute
+
+ DESCRIPTION
+   Given an ID and an attribute defintion attach the atrribute 
+   to the thing represented by the ID.  For starters, the valid 
+   IDs could be variable, file or dimesnion IDs
+
+ RETURNS
+   On error FAIL else SUCCEED.
+
+******************************************************************************/
+intn
+SDsetattr(int32 id,    /* IN: object ID */
+          const char *name,  /* IN: attribute name */
+          int32 nt,    /* IN: attribute number type */
+          int32 count, /* IN: number of attribute values */
+          const void * data   /* IN: attribute values */)
+{
+    NC_array **ap = NULL;
+    NC        *handle = NULL;
+    intn       sz;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetattr: I've been called\n");
+#endif
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Sanity check args */
+    if(name == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* This release doesn't support native number types for attr  */
+    if (nt & DFNT_NATIVE) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Only positive count is valid (bug HDFFR-989) -BMR */
+    if (count <= 0)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Make sure that count is less than MAX_ORDER(Vdata)
+           and total size is less than MAX_FIELD_SIZE(Vdata) */
+    if (FAIL == (sz = DFKNTsize(nt)))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if ((count > MAX_ORDER) ||
+        ((count * sz) > MAX_FIELD_SIZE))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* determine what type of ID we've been given */
+    if(SDIapfromid(id, &handle, &ap) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* still no handle ? */
+    if(handle == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    
+    /* hand over to SDIputattr */
+         
+    if(SDIputattr(ap, name, nt, count, data) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;        
+} /* SDsetattr */
+
+
+/******************************************************************************
+ NAME
+	SDattrinfo -- get info about an attribute
+
+ DESCRIPTION
+    Inquire about an attribute.  Attribute indexes are zero based.
+
+    Given the ID of the attribute's parent and the attribute's 
+    index return the number type, name and count of the attribute 
+    so the user knows how much space to provide to read it
+
+ RETURNS
+        On error FAIL else SUCCEED.
+******************************************************************************/
+intn
+SDattrinfo(int32  id,    /* IN:  object ID */
+           int32  index, /* IN:  attribute index */
+           char  *name,  /* OUT: attribute name */
+           int32 *nt,    /* OUT: attribute number type */
+           int32 *count  /* OUT: number of attribute values */)
+{
+    CONSTR(FUNC, "SDattrinfo");    /* for HGOTO_ERROR */
+    NC_array  *ap = NULL;
+    NC_array **app = NULL;
+    NC_attr  **atp = NULL;
+    NC        *handle = NULL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDattrinfo: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* sanity check args */
+    if((name == NULL) || (nt == NULL) || (count == NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* determine what type of ID we've been given */
+    if(SDIapfromid(id, &handle, &app) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    ap = (*app);
+    if((ap == NULL) || (index >= ap->count))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 
+     * ap is the proper attribute list now look up something with this
+     *  name
+     */
+    atp = (NC_attr **) ((char *)ap->values + index * ap->szof);
+    if(*atp == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* move the information over */
+    if(name != NULL) 
+      {
+#if 0
+          HDstrncpy(name, (*atp)->name->values, (*atp)->name->len);
+#endif
+          HDmemcpy(name, (*atp)->name->values, (*atp)->name->len);
+          name[(*atp)->name->len] = '\0';
+      }
+
+    *count = (*atp)->data->count;
+    *nt = (*atp)->HDFtype;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDattrinfo */
+
+
+/******************************************************************************
+ NAME
+	SDreadattr -- read an attribute's values
+
+ DESCRIPTION
+    Read the actual contents of the given attribute
+    Assume that the user has called SDinqattr() and so 
+    has allocated sufficient space
+
+ RETURNS
+    On error FAIL else SUCCEED.
+
+******************************************************************************/
+intn
+SDreadattr(int32 id,    /* IN:  object ID */
+           int32 index, /* IN:  attribute index */
+           void * buf    /* OUT: data buffer  */)
+{
+    CONSTR(FUNC, "SDreadattr");    /* for HGOTO_ERROR */
+    NC_array  *ap = NULL;
+    NC_array **app = NULL;
+    NC_attr  **atp = NULL;
+    NC        *handle = NULL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDreadattr: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* sanity check args */
+    if(buf == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* determine what type of ID we've been given */
+    if(SDIapfromid(id, &handle, &app) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    ap = (*app);
+    if((ap == NULL) || (index >= ap->count))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 
+     * ap is the proper attribute list now look up something with this
+     *  index
+     */
+    atp = (NC_attr **) ((char *)ap->values + index * ap->szof);
+    if(*atp == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* move the information over */
+    HDmemcpy(buf, (*atp)->data->values, (*atp)->data->count * (*atp)->data->szof);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDreadattr */
+
+
+/******************************************************************************
+ NAME
+	SDwritedata -- write a hyperslab of data
+
+ DESCRIPTION
+    Write out a chunk o data.  Except for the line setting the 
+    XDR op-code this is exactly the same as SDreaddata().  The 
+    two routines should really be combined at some point
+
+ RETURNS
+    SUCCEED / FAIL
+ 
+******************************************************************************/
+intn
+SDwritedata(int32  sdsid,  /* IN: dataset ID */
+            int32 *start,  /* IN: coords of starting point */
+            int32 *stride, /* IN: stride along each dimension */
+            int32 *end,    /* IN: number of values to write per dimension */
+            void *  data    /* IN: data buffer */)
+{
+    CONSTR(FUNC, "SDwritedata");    /* for HGOTO_ERROR */
+    intn    varid;
+    int32   status;
+    comp_coder_t comp_type;
+    uint32  comp_config;
+    NC_var *var;
+    NC     *handle = NULL;
+    NC_dim *dim = NULL;
+#ifdef BIG_LONGS
+    long    Start[H4_MAX_VAR_DIMS];
+    long    End[H4_MAX_VAR_DIMS];
+    long    Stride[H4_MAX_VAR_DIMS];
+#else
+    long   *Start = NULL;
+    long   *End = NULL;
+    long   *Stride = NULL;
+#endif
+    intn    no_strides = 0;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDwritedata: I've been called\n");
+#endif
+
+    /* this decides how a dataset with unlimited dimension is written along the
+       unlimited dimension; the behavior is different between SD and nc APIs */
+    cdf_routine_name = "SDwritedata";
+
+    /* clear error stack */
+    HEclear();
+
+    if((start == NULL) || (end == NULL) || (data == NULL))
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+        handle = SDIhandle_from_id(sdsid, DIMTYPE);
+        if(handle == NULL) 
+            HGOTO_ERROR(DFE_ARGS, FAIL);
+
+        dim = SDIget_dim(handle, sdsid);
+      }
+
+    if(handle->vars == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, sdsid);
+
+    if(var == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Check if compression method is enabled */
+
+    /* Make sure that the file is an HDF file before checking about compression */
+    if(handle->file_type == HDF_FILE) /* bug HDFFR-473 */
+    {
+	status = HCPgetcomptype(handle->hdf_file, var->data_tag, var->data_ref,
+                &comp_type);
+
+	if (status != FAIL)
+	    if (comp_type != COMP_CODE_NONE && comp_type != COMP_CODE_INVALID)
+	    {
+		/* Must have encoder to write data */
+		HCget_config_info( comp_type , &comp_config);
+		if ((comp_config & COMP_ENCODER_ENABLED) == 0)
+		{ /* encoder not present?? */
+		    HGOTO_ERROR(DFE_BADCODER, FAIL);
+		}
+	    }
+	/* The case status=FAIL is not handled, not sure if it's intentional. -BMR */
+    } /* file is HDF */
+
+    /* get ready to write */
+    handle->xdrs->x_op = XDR_ENCODE;
+    
+    /* 
+     * figure out the index of the variable to write to
+     * the user might have passed us a dimension, in which
+     * case we want to write to its coordinate variable
+     */
+    if(dim) 
+      {
+        varid = SDIgetcoordvar(handle, dim, (int32)(sdsid & 0xffff), (int32) 0);
+      } 
+    else 
+      {
+        /* oops, how do we know this ? */
+        varid = (intn)sdsid & 0xffff;
+      }
+
+    /* Check for strides all set to '1', so it acts like NULL was passed */
+    if(stride!=NULL)
+      {
+        int i;
+        NC_var *var = SDIget_var(handle, sdsid);
+
+        if(var == NULL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+
+        no_strides=1;
+        /* if the stride for any dim. is not '1', real stride processing has to occur */
+        for(i = 0; i < var->assoc->count; i++) 
+          {
+              if(stride[i]!=1)    
+                  no_strides=0;
+          }
+      } /* end if */
+
+    /*
+     * In general, (long) == int32 
+     * In cases where it doesn't we need to convert
+     */
+#ifdef BIG_LONGS
+
+    {
+        int i;
+        NC_var *var = SDIget_var(handle, sdsid);
+
+        if(var == NULL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+        
+        for(i = 0; i < var->assoc->count; i++) 
+          {
+            Start[i]  = (long) start[i];
+            End[i]    = (long) end[i];
+            if(stride) 
+                Stride[i] = (long) stride[i];
+          }
+    }
+
+#else
+
+    Start  = (long *)start;
+    End    = (long *)end;
+    Stride = (long *)stride;
+
+#endif
+
+    /* Check if this data is being written out to a newly created dataset */
+    {
+        NC_var *var = SDIget_var(handle, sdsid);
+
+        if(var->created) {
+            if(!IS_RECVAR(var) && (handle->flags & NC_NOFILL) ) {
+              var->set_length=TRUE;
+            } /* end if */
+            var->created=FALSE;
+        } /* end if */
+    }
+
+    /* call the writeg routines if a stride is given */
+    if(stride == NULL || no_strides==1)
+        status = NCvario(handle, varid, Start, End, (Void *)data);
+    else
+        status = NCgenio(handle, varid, Start, End, Stride, NULL, data);
+
+    if(status == -1)
+        ret_value = FAIL;
+    else
+        ret_value = SUCCEED;
+            
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDwritedata */
+
+
+/******************************************************************************
+ NAME
+	SDsetdatastrs -- set "data strings"
+
+ DESCRIPTION
+    Store information about the 'label', 'units', 'format' and 
+    'cordsys' attributes of a dataset.  All of the values 
+    are optional.  If no string is desired NULL should be passed 
+    in its place.  
+
+ RETURNS
+    SUCCEED / FAIL 
+
+******************************************************************************/
+intn
+SDsetdatastrs(int32 sdsid, /* IN: dataset ID */
+              const char *l,     /* IN: label string ("long_name") */
+              const char *u,     /* IN: units string ("units") */
+              const char *f,     /* IN: format string ("format") */
+              const char *c      /* IN: coordsys string ("coordsys") */)
+{
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetdatastrs: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(l && l[0] != '\0') 
+      {
+        if(SDIputattr(&var->attrs, _HDF_LongName, DFNT_CHAR, 
+                      (intn) HDstrlen(l), l) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+
+    if(u && u[0] != '\0') 
+      {
+        if(SDIputattr(&var->attrs, _HDF_Units, DFNT_CHAR, 
+                      (intn) HDstrlen(u), u) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+
+    if(f && f[0] != '\0') 
+      {
+        if(SDIputattr(&var->attrs, _HDF_Format, DFNT_CHAR, 
+                      (intn) HDstrlen(f), f) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+    
+    if(c && c[0] !='\0') 
+      {
+        if(SDIputattr(&var->attrs, _HDF_CoordSys, DFNT_CHAR, 
+                      (intn) HDstrlen(c), c) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+    
+    /* make sure it gets reflected in the file */
+    if(l || u || f || c)
+        handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetdatastrs */
+
+
+/******************************************************************************
+ NAME
+	SDsetcal -- set calibration information
+
+ DESCRIPTION
+    Store calibration information.  What is the formula? Good question -GV
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/
+intn
+SDsetcal(int32   sdsid,/* IN: dataset ID */
+         float64 cal,  /* IN: multiplicative factor */
+         float64 cale, /* IN: multiplicative factor error */
+         float64 ioff, /* IN: integer offset */
+         float64 ioffe,/* IN: integer offset error */
+         int32   nt    /* IN: number type of uncalibrated data */)
+{
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetcal: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+    
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(SDIputattr(&var->attrs, _HDF_ScaleFactor, DFNT_FLOAT64, 
+                  (intn) 1, &cal) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(SDIputattr(&var->attrs, _HDF_ScaleFactorErr, DFNT_FLOAT64, 
+                  (intn) 1, &cale) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(SDIputattr(&var->attrs, _HDF_AddOffset, DFNT_FLOAT64, 
+                  (intn) 1, &ioff) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(SDIputattr(&var->attrs, _HDF_AddOffsetErr, DFNT_FLOAT64, 
+                  (intn) 1, &ioffe) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(SDIputattr(&var->attrs, _HDF_CalibratedNt, DFNT_INT32, 
+                  (intn) 1, &nt) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetcal */
+
+
+/******************************************************************************
+ NAME
+	SDsetfillvalue -- set the fill value
+
+ DESCRIPTION
+    Set the fill value for this data set.  The fill value 
+    is assumed to have the same number type as the dataset
+
+ RETURNS
+    SUCCEED / FAIL 
+
+******************************************************************************/
+intn
+SDsetfillvalue(int32 sdsid, /* IN: dataset ID */
+               void * val    /* IN: fillvalue */)
+{
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetfillvalue: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(SDIputattr(&var->attrs, _FillValue, var->HDFtype, 
+                  (intn) 1, val) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetfillvalue */
+
+
+/******************************************************************************
+ NAME
+	SDgetfillvalue -- get the fill value
+
+ DESCRIPTION
+    Retreive the fill value for this data set if one has been
+    stored.  The fill value has the same number type as the
+    dataset
+
+ RETURNS
+    SUCCEED / FAIL
+ 
+******************************************************************************/
+intn
+SDgetfillvalue(int32 sdsid, /* IN:  dataset ID */
+               void * val    /* OUT: fillvalue */)
+{
+    CONSTR(FUNC, "SDgetfillvalue");    /* for HGOTO_ERROR */
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    NC_attr **attr = NULL;
+    intn      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetfillvalue: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    /* sanity check args */
+    if(val == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    attr = (NC_attr **) NC_findattr(&(var->attrs), _FillValue);
+    if(attr == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    NC_copy_arrayvals((char *)val, (*attr)->data) ;    
+    
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDgetfillvalue */
+
+
+/******************************************************************************
+ NAME
+	SDgetdatastrs -- get "data strings"
+
+ DESCRIPTION
+    Read information about the 'label', 'units', 'format' and 
+    'cordsys' attributes of a dataset.  All of the values 
+     are optional.  If no string is desired NULL should be passed 
+     in its place.  Assume all buffers are len bytes long.
+
+ RETURNS
+    SUCCEED / FAIL
+ 
+******************************************************************************/
+intn
+SDgetdatastrs(int32 sdsid, /* IN:  dataset ID */
+              char *l,     /* OUT: label string ("long_name") */
+              char *u,     /* OUT: units string ("units") */
+              char *f,     /* OUT: format string ("format") */
+              char *c,     /* OUT: coordsys string ("coordsys") */
+              intn  len    /* IN:  buffer length */)
+{
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    NC_attr **attr = NULL;
+    intn      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetdatastrs: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(l) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_LongName);
+          if(attr != NULL) 
+            {
+                if((*attr)->data->count < (unsigned)len)
+                  {
+                      HDstrncpy((char *)l, (*attr)->data->values,(*attr)->data->count );
+                      l[(*attr)->data->count] = '\0';
+                  }
+                else
+                    HDstrncpy((char *)l, (*attr)->data->values,len );
+            } 
+          else 
+              l[0] = '\0';
+      }
+
+    if(u) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_Units);
+          if(attr != NULL) 
+            {
+                if((*attr)->data->count < (unsigned)len)
+                  {
+                      HDstrncpy((char *)u, (*attr)->data->values,(*attr)->data->count );
+                      u[(*attr)->data->count] = '\0';
+                  }
+                else
+                    HDstrncpy((char *)u, (*attr)->data->values, len);
+
+            } 
+          else 
+              u[0] = '\0';
+      }
+
+    if(f) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_Format);
+          if(attr != NULL) 
+            {
+                if((*attr)->data->count < (unsigned)len)
+                  {
+                      HDstrncpy((char *)f, (*attr)->data->values, (*attr)->data->count);
+                      f[(*attr)->data->count] = '\0';
+                  }
+                else
+                    HDstrncpy((char *)f, (*attr)->data->values, len);
+            } 
+          else 
+              f[0] = '\0';
+      }
+
+    if(c) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_CoordSys);
+          if(attr != NULL) 
+            {
+                if((*attr)->data->count < (unsigned)len)
+                  {
+                      HDstrncpy((char *)c, (*attr)->data->values, (*attr)->data->count);
+                      c[(*attr)->data->count] = '\0';
+                  }
+                else
+                    HDstrncpy((char *)c, (*attr)->data->values, len);
+
+            } 
+          else 
+              c[0] = '\0';
+      }
+        
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDgetdatastrs */
+
+
+/******************************************************************************
+ NAME
+	SDgetcal -- get calibration information
+
+ DESCRIPTION
+    Retreive calibration information.  What is the formula?
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/
+intn
+SDgetcal(int32    sdsid, /* IN:  dataset ID */
+         float64 *cal,   /* OUT: multiplicative factor */
+         float64 *cale,  /* OUT: multiplicative factor error */
+         float64 *ioff,  /* OUT: integer offset  */
+         float64 *ioffe, /* OUT: integer offset error */
+         int32   *nt     /* OUT: number type of uncalibrated data */)
+{
+    NC       *handle = NULL;
+    NC_var   *var    = NULL;
+    NC_attr **attr   = NULL;
+    intn      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetcal: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_ScaleFactor);
+    if(attr == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    NC_copy_arrayvals((char *)cal, (*attr)->data) ;    
+
+    attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_ScaleFactorErr);
+    if(attr == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    NC_copy_arrayvals((char *)cale, (*attr)->data) ;    
+
+    attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_AddOffset);
+    if(attr == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    NC_copy_arrayvals((char *)ioff, (*attr)->data) ;    
+
+    attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_AddOffsetErr);
+    if(attr == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    NC_copy_arrayvals((char *)ioffe, (*attr)->data) ;    
+
+    attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_CalibratedNt);
+    if(attr == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    NC_copy_arrayvals((char *)nt, (*attr)->data) ;    
+        
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDgetcal */
+
+#ifdef MFSD_INTERNAL
+/******************************************************************************
+ NAME
+	SDgetcoordvar -- get index of coordinate variable
+
+ DESCRIPTION
+    Given a dimension return the index of its coordinate variable
+    creating one if needed.  If we need to create a variable and an nt
+    is not supplied (i.e. is equal to zero) use 32bit floats.
+        
+    If the variable already exists and the existing nt is different
+    from the supplied one (and the supplied one is not zero) replace
+    the nt by the new one.  ID is needed so that we can set the 
+    dimension of the variable correctly if we need to.  Yuck.
+
+ RETURNS
+     A variable index or FAIL on error
+
+******************************************************************************/ 
+int32
+SDIgetcoordvar(NC     *handle, /* IN: file handle */
+               NC_dim *dim,    /* IN: dimension to find coord var of */
+               int32   id,     /* IN: dimension ID */
+               int32   nt      /* IN: number type to use if new variable*/)
+{ 
+    unsigned      ii;
+    unsigned      len;
+    nc_type    nctype;
+    intn       dimindex;
+    NC_string *name = NULL;
+    NC_var   **dp = NULL;
+    NC_var    *var = NULL;
+    int32      ret_value = FAIL;
+
+    /* look for a variable with the same name */
+    name = dim->name;
+    len = dim->name->len;
+    dp = (NC_var**)handle->vars->values ;
+    for(ii = 0 ; ii < handle->vars->count ; ii++, dp++) 
+      {
+	/* eliminate vars with rank > 1, coord vars only have rank 1 */
+	if((*dp)->assoc->count == 1) 
+            if( len == (*dp)->name->len 
+              && HDstrncmp(name->values, (*dp)->name->values, (size_t)len) == 0) 
+		/* only proceed if the file is a netCDF file (bugz 1644)
+		   or if this variable is a coordinate var or when
+		   the status is unknown due to its being created prior to
+		   the fix of bugzilla 624 - BMR 05/14/2007 */
+		if ((handle->file_type != HDF_FILE) ||
+		    (*dp)->var_type == IS_CRDVAR || (*dp)->var_type == UNKNOWN)
+		{
+		    /* see if we need to change the number type */
+		    if((nt != 0) && (nt != (*dp)->type)) 
+		    {
+#ifdef SDDEBUG
+                      fprintf(stderr, "SDIgetcoordvar redefining type\n");
+#endif
+                      if (((*dp)->type = hdf_unmap_type((int)nt)) == FAIL)
+                        {
+#ifdef SDDEBUG
+                            /* replace it with NCAdvice or HERROR? */
+                            fprintf(stderr "SDIgetcoordvar: hdf_unmap_type failed for %d\n", nt);
+#endif
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      (*dp)->HDFtype = nt;
+                      (*dp)->cdf = handle;
+                      /* don't forget to reset the sizes  */
+                      (*dp)->szof = NC_typelen((*dp)->type);
+                      if (FAIL == ((*dp)->HDFsize = DFKNTsize(nt)))
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                
+                      /* recompute all of the shape information */
+                      /* BUG: this may be a memory leak ??? */
+                      if(NC_var_shape((*dp), handle->dims) == -1)
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                  }
+
+                ret_value = ii; /* found it? */
+                goto done;
+            }
+      }
+
+    /* create a new var with this dim as only coord */
+    if(nt == 0) 
+        nt = DFNT_FLOAT32;
+
+    if ((nctype = hdf_unmap_type((int)nt)) == FAIL)
+      {
+          /* replace it with NCAdvice or HERROR? */
+          ret_value = FAIL;
+          goto done;
+      }
+
+    dimindex = (intn)id;
+    var = (NC_var *) NC_new_var(name->values, nctype, (unsigned)1, &dimindex);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Set flag to indicate that this variable is a coordinate variable -
+       BMR - 05/14/2007 */
+    var->var_type = IS_CRDVAR; 
+
+    /* BMR: put back hdf type that was set wrong by NC_new_var; please refer
+       to the cvs history of bug #172 for reason on this statement - 4/17/01*/
+    var->HDFtype = nt;
+
+    /* get a new NDG ref for this sucker */
+#ifdef NOT_YET
+    var->ndg_ref = Htagnewref(handle->hdf_file,DFTAG_NDG);
+#else /* NOT_YET */
+    var->ndg_ref = Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+
+    /* add it to the handle */
+    if(handle->vars->count >= H4_MAX_NC_VARS)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var->cdf = handle; /* set cdf before calling NC_var_shape */
+    /* compute all of the shape information */
+    if(NC_var_shape(var, handle->dims) == -1)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(NC_incr_array(handle->vars, (Void *)&var) == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+    
+    ret_value = handle->vars->count - 1;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDIgetcoordvar */
+
+#endif /* MFSD_INTERNAL */
+
+/******************************************************************************
+ NAME
+	SDsetdimstrs -- set "dimension strings"
+
+ DESCRIPTION
+    Store information about the 'label', 'units' and 'format' 
+    attributes of a dimension.  All three of the values are optional.  
+    If no string is desired NULL should be passed in its place.
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/ 
+intn
+SDsetdimstrs(int32 id, /* IN: dimension ID */
+             const char *l,  /* IN: label string ("long_name") */
+             const char *u,  /* IN: units string ("units") */
+             const char *f   /* IN: format string ("format") */)
+{
+    intn       varid;
+    NC        *handle = NULL;
+    NC_dim    *dim = NULL;
+    NC_var    *var = NULL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetdimstrs: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(id, DIMTYPE);
+    if(handle == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the dimension structure */
+    dim = SDIget_dim(handle, id);
+    if(dim == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* look for a variable with the same name */
+    varid = (intn)SDIgetcoordvar(handle, dim, (int32)(id & 0xffff), (int32)0);
+    if(varid == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the variable object */
+    var = NC_hlookupvar(handle, varid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* set the attributes */
+    if(l && l[0] != '\0')
+      {
+        if(SDIputattr(&var->attrs, _HDF_LongName, DFNT_CHAR,
+                      (intn) HDstrlen(l), l) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+
+    if(u && u[0] != '\0')
+      {
+        if(SDIputattr(&var->attrs, _HDF_Units, DFNT_CHAR,
+                      (intn) HDstrlen(u), u) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+
+    if(f && f[0] != '\0')
+      {
+        if(SDIputattr(&var->attrs, _HDF_Format, DFNT_CHAR,
+                      (intn) HDstrlen(f), f) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetdimstrs */
+
+#ifdef MFSD_INTERNAL
+/******************************************************************************
+ NAME
+	SDIfreevarAID -- free a variables AID
+
+ DESCRIPTION
+    Free the AID of the variable with the given index
+
+ RETURNS
+    SUCCEED / FAIL 
+
+******************************************************************************/
+int32
+SDIfreevarAID(NC   *handle, /* IN: file handle */
+              int32 index   /* IN: variable index */)
+{
+    NC_array **ap = NULL;
+    NC_var    *var = NULL;
+    int32      ret_value = SUCCEED;
+
+    if(handle == NULL || !handle->vars)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(index < 0 || index > handle->vars->count)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    ap = (NC_array **)handle->vars->values;
+    ap += index;
+
+    var = (NC_var *) *ap;
+
+    if(var->aid != 0 && var->aid != FAIL)
+      {
+        if (Hendaccess(var->aid) == FAIL)
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+
+    var->aid = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDIfreevarAID */
+#endif /* MFSD_INTERNAL */ 
+
+/******************************************************************************
+ NAME
+	SDsetdimscale -- store scale information for the dimension
+
+ DESCRIPTION
+    Store information about the 'scales' of a dimension.  Dimensions
+    do not have to have the same number type as the dataset.
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/ 
+intn
+SDsetdimscale(int32 id,    /* IN: dimension ID */
+              int32 count, /* IN: number of values */
+              int32 nt,    /* IN: number type of data */
+              void * data   /* IN: scale values */)
+{
+    NC        *handle = NULL;
+    NC_dim    *dim = NULL;
+    int32      status;
+    intn       varid;
+    long       start[1];
+    long       end[1];
+    intn       ret_value = SUCCEED;
+	
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetdimscales: I've been called\n");
+#endif
+
+    /* this decides how a dataset with unlimited dimension is written along the
+       unlimited dimension; the behavior is different between SD and nc APIs */
+    cdf_routine_name = "SDsetdimscales";
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(id, DIMTYPE);
+    if(handle == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the dimension structure */
+    dim = SDIget_dim(handle, id);
+    if(dim == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* sanity check, if not SD_UNLIMITED */
+    if( dim->size != 0 && count != dim->size)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* look for a variable with the same name */
+    varid = (intn)SDIgetcoordvar(handle, dim, id & 0xffff, nt);
+    if(varid == -1)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* store the data */
+    handle->xdrs->x_op = XDR_ENCODE;
+    start[0] = 0;
+    end[0]   = count;
+    status = NCvario(handle, varid, start, end, (Void *)data);
+    if(status == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* free the AID */
+    status = SDIfreevarAID(handle, varid);
+    if(status == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* make sure it gets reflected in the file */
+    handle->flags |= NC_HDIRTY;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetdimscale */
+
+
+/******************************************************************************
+ NAME
+	SDgetdimscale -- get scale information for the dimension
+
+ DESCRIPTION
+    Retreive the scale information stored with a dimension.  It is 
+    assumed that the user has called SDdiminfo() and that the data 
+    array is long enough to hold the values.
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/ 
+intn 
+SDgetdimscale(int32 id,   /* IN:  dimension ID */
+              void * data  /* OUT: scale values */)
+{
+    NC        *handle = NULL;
+    NC_dim    *dim = NULL;
+    NC_var    *vp = NULL;
+    int32      status;
+    intn       varid;
+    long       start[1];
+    long       end[1];
+    intn       ret_value = SUCCEED;
+	
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetdimscale: I've been called\n");
+#endif
+
+    /* this decides how a dataset with unlimited dimension is read along the
+       unlimited dimension; the behavior is different between SD and nc APIs */
+    cdf_routine_name = "SDgetdimscale";
+
+    /* clear error stack */
+    HEclear();
+
+    /* sanity check args */
+    if(data == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the handle */
+    handle = SDIhandle_from_id(id, DIMTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the dimension structure */
+    dim = SDIget_dim(handle, id);
+    if(dim == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* look for a variable with the same name */
+    /* assume type Float32 can be over-ridden later */
+    varid = (intn)SDIgetcoordvar(handle, dim, (int32)(id & 0xffff), (int32)0);
+    if(varid == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* store the data */
+    handle->xdrs->x_op = XDR_DECODE;
+    start[0] = 0;
+    if (dim->size != 0)
+        end[0] = dim->size;
+    else   
+      {
+        if (handle->file_type != HDF_FILE)
+            end[0] = handle->numrecs;
+        else   
+          {
+            vp = SDIget_var(handle, varid);
+            if (vp == NULL)
+              {
+                  ret_value = FAIL;
+                  goto done;
+              }
+
+            end[0] = vp->numrecs;
+          }
+      }
+  
+    status = NCvario(handle, varid, start, end, (Void *)data);
+    if(status == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* free the AID */
+    status = SDIfreevarAID(handle, varid);
+    if(status == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDgetdimscale */
+
+
+/******************************************************************************
+ NAME
+	SDdiminfo -- get info about a dimension
+
+ DESCRIPTION
+    Return basic information about a dimension (name, sizes, number
+    of attributes, number type, etc...) The user is repsonsible for 
+    allocating space to hold the dataset name.  It can be at most 
+    H4_MAX_NC_NAME characters in length.  NULL can be passed for the 
+    name if it is not required.
+
+ RETURNS
+    SUCCEED / FAIL
+
+******************************************************************************/ 
+intn
+SDdiminfo(int32  id,    /* IN:  dimension ID */
+          char  *name,  /* OUT: name of the dimension */
+          int32 *size,  /* OUT: size of the dimension */
+          int32 *nt,    /* OUT: number type of scales */
+          int32 *nattr  /* OUT: the number of local attributes */)
+{
+    NC      *handle = NULL;
+    NC_dim  *dim = NULL;
+    NC_var   *var = NULL;
+    NC_var **dp = NULL;
+    intn     ii;
+    intn     len;
+    int32    varid;
+    int      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDdiminfo: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(id, DIMTYPE);
+    if(handle == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+ 
+    if(handle->dims == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    dim = SDIget_dim(handle, id);
+    if(dim == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(name != NULL) 
+      {
+#if 0
+        HDstrncpy(name, dim->name->values, dim->name->len);
+#endif
+        HDmemcpy(name, dim->name->values, dim->name->len);
+        name[dim->name->len] = '\0';
+      } 
+    else 
+        name = dim->name->values;
+
+    /* Get dimension's size, which is the one application provided at SDcreate.
+       Application must use SDgetinfo to get current size of unlimited dim */
+    *size = dim->size;
+
+    /* assuming no number type and no attributes */
+    *nt    = 0;
+    *nattr = 0;
+
+    /* In HDF files, number type and attribute info are only stored in the
+       coordinate var of the dimension; so, if there is no coord var associated
+       with the dimension being inquired, these info will not be available. */
+    if(handle->vars) 
+      {
+          len = dim->name->len;
+          dp = (NC_var**)handle->vars->values;
+          for(ii = 0 ; ii < handle->vars->count ; ii++, dp++) 
+            {
+	      /* eliminate vars with rank > 1, coord vars only have rank 1 */
+	      if((*dp)->assoc->count == 1) 
+	      {
+		 /* check if this variable matches the searched name */
+                 if( len == (*dp)->name->len 
+                    && HDstrncmp(name, (*dp)->name->values, (*dp)->name->len) == 0)
+		 {
+		    if (handle->file_type == HDF_FILE) /* HDF file */
+		    {
+			/* only proceed if this variable is a coordinate var or
+			when its status is unknown due to its being created
+			prior to the fix of bugzilla 624 - BMR - 05/14/2007 */
+			if ((*dp)->var_type == IS_CRDVAR ||
+			    (*dp)->var_type == UNKNOWN)
+			{
+			    *nt = ((*dp)->numrecs ? (*dp)->HDFtype : 0);
+			    *nattr = ((*dp)->attrs ? (*dp)->attrs->count : 0);
+			    goto done;
+			}
+		    }
+		    else /* netCDF file */
+		    {
+			*nt = (*dp)->HDFtype;
+			*nattr = ((*dp)->attrs ? (*dp)->attrs->count : 0);
+			goto done;
+		    }
+		 } /* name matched */
+	      } /* rank = 1 */
+            }
+      }
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDdiminfo */
+
+
+/******************************************************************************
+ NAME
+	SDgetdimstrs -- get "data strings"
+
+ DESCRIPTION
+    Read as many of the dimension strings as possible.  Assume that 
+    if a pointer is not NULL that we have len bytes that we can use 
+    to return the values
+
+ RETURNS
+     SUCCEED / FAIL 
+
+******************************************************************************/ 
+intn
+SDgetdimstrs(int32 id,  /* IN:  dataset ID */
+             char *l,   /* OUT: label string ("long_name") */
+             char *u,   /* OUT: units string ("units") */
+             char *f,   /* OUT: format string ("format") */
+             intn  len  /* IN:  buffer length */)
+{
+    CONSTR(FUNC, "SDgetdimstrs");    /* for HGOTO_ERROR */
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    NC_var  **dp = NULL;
+    NC_dim   *dim = NULL;
+    NC_attr **attr = NULL;
+    char     *name = NULL;
+    int32     ii;
+    int32     namelen;
+    intn      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetdimstrs: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    /* sanity check args */
+    if(len < 0) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    handle = SDIhandle_from_id(id, DIMTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    dim = SDIget_dim(handle, id);
+    if(dim == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* need to get a pointer to the var now */
+    var = NULL;
+    if(handle->vars) 
+      {
+          name = dim->name->values;
+          namelen = HDstrlen(name);
+          dp = (NC_var**)handle->vars->values;
+          for(ii = 0 ; ii < handle->vars->count ; ii++, dp++) 
+            {
+	      /* eliminate vars with rank > 1, coord vars only have rank 1 */
+	      if((*dp)->assoc->count == 1) 
+                  if( namelen == (*dp)->name->len 
+                    && HDstrncmp(name, (*dp)->name->values, HDstrlen(name)) == 0)
+	      /* because a dim was given, make sure that this is a coord var */
+		  /* if it is an SDS, the function will fail */
+		  if ((*dp)->var_type == IS_SDSVAR)
+		      HGOTO_ERROR(DFE_ARGS, FAIL)
+	          /* only proceed if this variable is a coordinate var or when
+		      its status is unknown due to its being created prior to
+		      the fix of bugzilla 624 - BMR - 05/14/2007 */
+		  else
+		  /* i.e., (*dp)->var_type == IS_CRDVAR || 
+			   (*dp)->var_type == UNKNOWN) */ 
+                  {
+                      var = (*dp);
+                  }
+            }
+      }
+
+    if(var != NULL)
+    {
+    if(l) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_LongName);
+          if(attr != NULL) 
+            {
+                intn minlen;
+                minlen = ((unsigned)len > (*attr)->data->count)? (*attr)->data->count: (unsigned)len;
+                HDstrncpy((char *)l, (*attr)->data->values, minlen);
+                if((*attr)->data->count < (unsigned)len)
+                    l[(*attr)->data->count] = '\0';
+            } 
+          else 
+              l[0] = '\0';
+      }
+
+    if(u) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_Units);
+          if(attr != NULL) 
+            {
+                intn minlen;
+                minlen = (len > (*attr)->data->count)? (*attr)->data->count: (unsigned)len;
+                HDstrncpy((char *)u, (*attr)->data->values, minlen);
+                if((*attr)->data->count < (unsigned)len)
+                    u[(*attr)->data->count] = '\0';
+            } 
+          else 
+              u[0] = '\0';
+      }
+
+    if(f) 
+      {
+          attr = (NC_attr **) NC_findattr(&(var->attrs), _HDF_Format);
+          if(attr != NULL) 
+            {
+                intn minlen;
+                minlen = (len > (*attr)->data->count)? (*attr)->data->count: (unsigned)len;
+                HDstrncpy((char *)f, (*attr)->data->values, minlen);
+                if((*attr)->data->count < (unsigned)len)
+                    f[(*attr)->data->count] = '\0';
+            } 
+          else 
+              f[0] = '\0';
+      }
+    }
+    /* the given dimension is not a coordinate variable, that means it
+       doesn't have attribute attached to it, because if it did, then it
+       would have been promoted to be a coordinate variable. */
+    else
+    {
+      if(l) l[0] = '\0';
+
+      if(u) u[0] = '\0';
+
+      if(f) f[0] = '\0';
+    }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDgetdimstrs */
+
+
+/******************************************************************************
+ NAME
+	SDsetexternalfile -- store info in a separate file
+ USAGE
+	int32 SDsetexternalfile(id, filename, offset)
+        int32   id;                  
+        const char  * filename;            
+        int32   offset;              
+
+ DESCRIPTION
+    Specify that the actual data for this dataset be stored in a 
+    separate file (and "external file" in HDF terms).
+
+    Only the data (as in SDwritedata()) will be stored externally.  
+    Attributes and such will still be in the main file
+
+    IMPORTANT:  It is the user's responsibility to see that the 
+    separate files are transported when the main file is moved.
+
+    IMPORTANT:  This can only be called *once* for a given dataset.  
+    The HDF utility 'hdfpack' may be able to undo it.
+
+    IMPORTANT:  This will only work on datasets stored in HDF files.
+
+    FORTRAN	- sfsextf
+
+ RETURNS
+    SUCCEED/FAIL
+
+******************************************************************************/ 
+intn 
+SDsetexternalfile(int32 id,       /* IN: dataset ID */
+                  const char *filename, /* IN: name of external file */
+                  int32 offset    /* IN: offset in external file */)
+{
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    intn      status;
+    int       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetexternalfile: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    if(NULL == filename || offset < 0)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* already exists */
+    if(var->data_ref) 
+      {
+          /* no need to give a length since the element already exists */
+          status = (intn)HXcreate(handle->hdf_file, (uint16)DATA_TAG, 
+                                  (uint16) var->data_ref,
+                                  filename, offset, (int32)0);
+      } 
+    else 
+      {
+          int32   length;
+
+          /* look up the length */
+          length = var->len;
+
+          /* element doesn't exist so we need a reference number */
+#ifdef NOT_YET
+          var->data_ref = Htagnewref(handle->hdf_file,DATA_TAG);
+#else /* NOT_YET */
+          var->data_ref = Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+          if(var->data_ref == 0)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+
+          /* need to give a length since the element does not exist yet */
+          status = (intn)HXcreate(handle->hdf_file, (uint16)DATA_TAG, 
+                                  (uint16) var->data_ref,
+                                  filename, offset, length);
+
+      }
+
+    if(status != FAIL) 
+      {
+          if((var->aid != 0) && (var->aid != FAIL))
+            {
+                if (Hendaccess(var->aid) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+            }
+
+          var->aid = status;
+          ret_value = SUCCEED;
+      }
+    else
+        ret_value = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetexternalfile */
+
+
+/******************************************************************************
+ NAME
+	SDgetexternalinfo -- retrieves external file and data information
+ USAGE
+	int32 SDgetexternalinfo(id, buf_size, filename, offset, length)
+        int32 id;                  
+	intn  buf_size;
+        char  *ext_filename;            
+        int32 *offset;              
+        int32 *length;              
+
+ DESCRIPTION
+    SDgetexternalinfo gets the external file's name and the external data's
+    offset and length, which specify the location and size of the data in
+    the external file.
+
+    buf_size specifies the size of the buffer ext_filename.  When buf_size
+    is 0, SDgetexternalinfo will simply return the length of the external file
+    name, and not the file name itself.
+
+    When the element is not special, SDgetexternalinfo will return
+    0.  If the element is SPECIAL_EXT, but the external file name
+    doesn't exist, SDgetexternalinfo will return FAIL.
+
+    IMPORTANT:  It is the user's responsibility to see that the 
+    external files are located in the same directory with the main
+    file.  SDgetexternalinfo does not check that.
+
+ RETURNS
+    Returns length of the external file name or FAIL.  If the SDS
+    does not have external element, this length will be 0.
+
+******************************************************************************/ 
+intn 
+SDgetexternalinfo(int32 id,      /* IN: dataset ID */
+              uintn buf_size,    /* IN: size of buffer for external file name */
+              char *ext_filename,/* IN: buffer for external file name */
+              int32 *offset,     /* IN: offset in external file */
+              int32 *length      /* IN: length of external data */)
+{
+    CONSTR(FUNC, "SDgetexternalinfo");    /* for HGOTO_ERROR */
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    int32   aid = FAIL;
+    intn    actual_fname_len = 0;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetexternalinfo: I've been called\n");
+#endif
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Get the var structure of the SDS */
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* SDS exists */
+    if(var->data_ref) 
+    {
+	int32 retcode=0;
+	sp_info_block_t info_block;    /* special info block */
+	HDmemset(&info_block, 0, sizeof(sp_info_block_t));
+
+	/* Get the access id and then its special info */
+	aid = Hstartread(handle->hdf_file, var->data_tag, var->data_ref);
+	if (aid == FAIL) /* catch FAIL from Hstartread */
+	    HGOTO_ERROR(DFE_ARGS, FAIL);
+	retcode = HDget_special_info(aid, &info_block);
+
+        /* When HDget_special_info returns FAIL, it could be the element is not
+           special or some failure occur internally, info_block.key will be
+           FAIL in the former case */
+        if (retcode == FAIL)
+        {
+            if (info_block.key == FAIL)
+                ret_value = 0;  /* not a special elem, no external file name */
+
+            /* Some failure occurred in HDget_special_info */
+            else
+                HGOTO_ERROR(DFE_ARGS, FAIL)
+        }
+
+	/* If the SDS has external element, get the external info */
+        else if (info_block.key == SPECIAL_EXT)
+        {
+	    /* If the file name is not available, something must be wrong,
+		so we need to report it. */
+            if (info_block.path == NULL || HDstrlen(info_block.path) <= 0)
+		ret_value = FAIL;
+            else
+            {
+                intn tmp_len = info_block.length_file_name;
+
+                /* If caller requests the length of the external file name
+                   only, return the length */
+                if (buf_size == 0)
+                    actual_fname_len  = tmp_len;
+                else
+                {
+                    /* Caller requests file name, so buffer must not be NULL */
+                    if (ext_filename == NULL)
+                        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+		    /* Compute the length of the name to be returned: if
+		       requested buffer size is smaller, use that value for
+		       name's length, but that means file name could be
+		       truncated! */
+                    actual_fname_len  = (intn)buf_size < tmp_len ? (intn)buf_size : tmp_len;
+
+                    /* Get the name */
+                    HDstrncpy(ext_filename, info_block.path, actual_fname_len);
+
+                    /* Get offset/length of the external data if requested */
+                    if (offset != NULL)
+                        *offset = info_block.offset;
+                    if (length != NULL)
+                        *length = info_block.length;
+                } /* buf_size != 0 */
+		ret_value = actual_fname_len ;
+            }
+        }
+	/* Special but not external, so no external file name */
+        else
+            ret_value = 0;
+
+	/* End access to the aid */
+	if (Hendaccess(aid) == FAIL)
+	    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    } 
+    else /* SDS doesn't exist */
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+	/* End access to the aid if neccessary */
+	if (aid != FAIL)
+	    Hendaccess(aid);
+      }
+    /* Normal cleanup */
+    return ret_value;    
+} /* SDgetexternalinfo */
+
+
+/******************************************************************************
+ NAME
+	SDgetexternalfile -- retrieves external file information
+ USAGE
+	int32 SDgetexternalfile(id, filename, offset)
+        int32 id;                  
+	intn  buf_size;
+        char  *filename;            
+        int32 *offset;              
+
+ DESCRIPTION
+    SDgetexternalfile uses HDget_special_info to get the external
+    file's name and offset, which indicates where the data starts
+    in the external file.
+
+    When the element is not special, SDgetexternalfile will return
+    0.  If the element is SPECIAL_EXT, but the external file name
+    doesn't exist, SDgetexternalfile will fail.
+
+    IMPORTANT:  It is the user's responsibility to see that the 
+    separate files are transported when the main file is moved.
+
+    FORTRAN	N/A
+
+ RETURNS
+    Returns length of the external file name or FAIL.  If the SDS
+    does not have external element, the length will be 0.
+
+******************************************************************************/ 
+intn 
+SDgetexternalfile(int32 id,       /* IN: dataset ID */
+                  intn buf_size,   /* IN: name of external file */
+                  char *ext_filename, /* IN: name of external file */
+                  int32 *offset    /* IN: offset in external file */)
+{
+    CONSTR(FUNC, "SDgetexternalfile");    /* for HGOTO_ERROR */
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    intn    actual_len = 0;
+    int     ret_value = 0;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetexternalfile: I've been called\n");
+#endif
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Get the var structure */
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* SDS exists */
+    if(var->data_ref) 
+    {
+	int32 aid=-1;
+	int32 retcode=0;
+	sp_info_block_t info_block;    /* special info block */
+
+	/* Get the access id and then its special info */
+	aid = Hstartread(handle->hdf_file, var->data_tag, var->data_ref);
+	retcode = HDget_special_info(aid, &info_block);
+
+	/* If the SDS has external element, return the external file info */
+        if (info_block.key == SPECIAL_EXT)
+        {
+	    /* If the file name is not available, the file is probably
+		corrupted, so we need to report it. */
+            if (info_block.path == NULL || HDstrlen(info_block.path) <= 0)
+                ret_value = FAIL;
+            else
+            {
+                size_t ext_file_len = HDstrlen(info_block.path);
+
+                /* If caller requests the length of the external file name
+                   only, return the length */
+                if (buf_size == 0)
+                    actual_len = (intn)ext_file_len;
+                else
+                {
+                    /* Caller requests file name, so buffer must not be NULL */
+                    if (ext_filename == NULL)
+                        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+                    /* Get the name and its length */
+                    HDstrncpy(ext_filename, info_block.path, buf_size);
+                    actual_len = buf_size < ext_file_len ? buf_size : ext_file_len;
+
+                    /* Get the offset in the external file if it's requested */
+                    if (offset != NULL)
+                        *offset = info_block.offset;
+                } /* buf_size != 0 */
+		ret_value = actual_len;
+            }
+        }
+	/* Not external */
+        else
+            ret_value = FAIL;
+
+	/* End access to the aid */
+	if (Hendaccess(aid) == FAIL)
+	    HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    } 
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    return ret_value;    
+} /* SDgetexternalfile */
+
+
+/******************************************************************************
+ NAME
+	SDsetnbitdataset -- Create/convert a dataset to n-bit representation
+
+
+ DESCRIPTION
+    Specify that the actual data for this dataset be represented as a
+    n-bit dataset internally in the HDF file.
+
+    The start_bit parameter determines the lowest bit to write out,
+    the bit_len parameter determines how many bits to write out.  The
+    bits in the data include the lowest bit (start_bit) and count up
+    bit_len-1 bits to write out.  For example, starting at bit 2
+    and writing 4 bits from the following bit data, "01111011", would
+    write out the bit data, "1110", to the dataset on disk.
+
+    The sign_ext parameter determines whether the top bit (highest bit #)
+    is used to sign extend the bits whether data is read back from the
+    disk.  The fill_one parameter is used to determine whether to
+    fill the "background bits" (the bits not in the data written to the
+    file) with 1's or 0's when the data is read back from the file.
+
+    Only the data (as in SDwritedata()) will be stored in n-bit
+    representation.  Attributes and such will still be stored normally.
+
+    IMPORTANT:  This will only work on datasets stored in HDF files.
+
+    NOTE: n-bit "compression" is described more fully in the cnbit.c file.
+
+ RETURNS
+    SUCCEED/FAIL
+
+******************************************************************************/ 
+intn 
+SDsetnbitdataset(int32 id,       /* IN: dataset ID */
+                 intn start_bit, /* IN: starting bit offset (lowest=0) */
+                 intn bit_len,   /* IN: # of bits to write */
+                 intn sign_ext,  /* IN: Whether to sign extend */
+                 intn fill_one   /* IN: Whether to fill background w/1's */)
+{
+    NC        *handle = NULL;
+    NC_var    *var = NULL;
+    model_info m_info;  /* modeling information for the HCcreate() call */
+    comp_info  c_info;  /* "compression" information for the HCcreate() call */
+    intn       status;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetnbitdataset: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    if(start_bit < 0 || bit_len <= 0)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* set up n-bit parameters */
+    c_info.nbit.nt        = var->HDFtype;
+    c_info.nbit.sign_ext  = sign_ext;
+    c_info.nbit.fill_one  = fill_one;
+    c_info.nbit.start_bit = start_bit;
+    c_info.nbit.bit_len   = bit_len;
+
+#ifdef SDDEBUG
+    printf("SDsetnbitdata(): nt=%d, sign_ext=%d, fill_one=%d, start_bit=%d, bit_len=%d\n",(intn)c_info.nbit.nt,(intn)c_info.nbit.sign_ext,(intn)c_info.nbit.fill_one,(intn)c_info.nbit.start_bit,(intn)c_info.nbit.bit_len);
+#endif
+    if(!var->data_ref) 
+      {   /* doesn't exist */
+#ifdef SDDEBUG
+          printf("SDsetnbitdata(): dataset doesn't exist\n");
+#endif
+
+          /* element doesn't exist so we need a reference number */
+#ifdef NOT_YET
+          var->data_ref=Htagnewref(handle->hdf_file,DATA_TAG);
+#else /* NOT_YET */
+          var->data_ref=Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+          if(var->data_ref == 0)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      } /* end if */
+
+    status=(intn)HCcreate(handle->hdf_file,(uint16)DATA_TAG,
+                          (uint16) var->data_ref,COMP_MODEL_STDIO,&m_info,
+                          COMP_CODE_NBIT, &c_info);
+
+#ifdef SDDEBUG
+    printf("SDsetnbitdata(): HCcreate() status=%d\n",(intn)status);
+#endif
+    if(status != FAIL) 
+      {
+          if((var->aid != 0) && (var->aid != FAIL))
+            {
+                if (Hendaccess(var->aid) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+
+          var->aid = status;
+      } /* end if */
+
+    ret_value = status;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetnbitdataset */
+
+#ifdef H4_HAVE_LIBSZ          /* we have the library */
+
+/******************************************************************************
+ NAME
+	SDsetup_szip_parms -- check and set parameters for szip compression
+              int32 id;            IN: the  varid
+              NC *handle;          IN: the SD handle
+              comp_info *c_info;   IN/OUT: the compression settings 
+              int32 *cdims;        IN: the chunk dims, NULL if not chunked
+
+ DESCRIPTION
+     Collect the parameters and call HCPcszip_setup_parms to set the
+     computed szip paramters.
+
+ RETURNS
+    SUCCEED/FAIL
+
+******************************************************************************/ 
+intn 
+SDsetup_szip_parms( int32 id, NC *handle, comp_info *c_info, int32 *cdims)
+{
+    NC_dim    *dim;     /* to check if the dimension is unlimited */
+    int32      dimindex;/* to obtain the NC_dim record */
+    NC_var    *var; 
+    int32 ndims;
+    int i;
+    int32 xdims[H4_MAX_VAR_DIMS];
+    int32 nt;
+    intn       ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    ndims = var->assoc->count; 
+	for (i = 0; i < ndims; i++) {
+		dimindex = var->assoc->values[i];
+		dim = SDIget_dim(handle, dimindex);
+		xdims[i] = dim->size;
+	}
+
+    nt = var->HDFtype;
+	
+    ret_value = HCPsetup_szip_parms( c_info, nt, 1, ndims, xdims, cdims);
+
+done:
+	return(ret_value);
+}
+#endif
+/******************************************************************************
+ NAME
+	SDsetcompress -- Create/convert a dataset to compressed representation
+
+ DESCRIPTION
+    Specify a compression scheme for an SD dataset.
+
+    Valid compression types available for this interface are listed in
+    hcomp.h as COMP_nnnn.
+
+    IMPORTANT:  This will only work on datasets stored in HDF files.
+
+ RETURNS
+    SUCCEED/FAIL
+
+******************************************************************************/ 
+intn 
+SDsetcompress(int32 id,                /* IN: dataset ID */
+              comp_coder_t comp_type,  /* IN: the type of compression to 
+					  perform on the next image */
+              comp_info *c_info        /* IN: ptr to compression info struct*/)
+{
+    CONSTR(FUNC, "SDsetcompress");    /* for HGOTO_ERROR */
+    NC        *handle;
+    NC_var    *var;
+    NC_dim    *dim;     /* to check if the dimension is unlimited */
+    int32      dimindex;/* to obtain the NC_dim record */
+    model_info m_info;  /* modeling information for the HCcreate() call */
+    comp_info c_info_x;  /* local copy */
+    uint32  comp_config;
+    intn       status = FAIL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetcompress: I've been called\n");
+#endif /* SDDEBUG */
+
+    /* clear error stack */
+    HEclear();
+
+    if (comp_type < COMP_CODE_NONE || comp_type >= COMP_CODE_INVALID)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Must have encoder to set compression */
+    HCget_config_info(comp_type, &comp_config);
+    if ((comp_config & COMP_ENCODER_ENABLED) == 0) {
+	/* encoder not present?? */
+	HGOTO_ERROR(DFE_NOENCODER, FAIL);
+    }
+    HDmemcpy(&c_info_x,c_info,sizeof(comp_info));
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* disallow setting compress for SDS with rank = 0 - BMR, bug #1045 */
+    if(var->shape == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* unlimited dimensions don't work with compression */
+        /* Get the index of the SDS' first dimension from the list of indices
+         * branching out from NC_var.  This index indicates where this dim
+         * is in the "dims" list branching out from NC. */
+        dimindex = var->assoc->values[0];
+
+        /* Retrieve the NC_dim record to check for unlimited dimension */
+        dim = SDIget_dim(handle, dimindex);
+        if(dim == NULL)
+        {
+            ret_value = FAIL;
+            goto done;
+        }
+
+        /* If this dimension is unlimited, then return FAIL; the subsequent
+         * writing of this SDS will write uncompressed data */
+        if (dim->size == SD_UNLIMITED)
+        {
+            ret_value = FAIL;
+            goto done;
+        }
+#ifdef H4_HAVE_LIBSZ          /* we have the library */
+	if (comp_type == COMP_CODE_SZIP) {
+	   if (SDsetup_szip_parms( id, handle, &c_info_x, NULL) == FAIL) {
+		HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	    }
+	}
+#else
+	/* no SZIP */
+/* probably covered by test at start */
+	if (comp_type == COMP_CODE_SZIP) {
+		HGOTO_ERROR(DFE_BADCODER, FAIL);
+	}
+#endif /* H4_HAVE_LIBSZ          */
+
+#ifdef SDDEBUG
+    printf("SDsetcompress(): var->data_ref=%d\n",(int)var->data_ref);
+#endif /* SDDEBUG */
+    if(!var->data_ref) 
+      {   /* doesn't exist */
+#ifdef SDDEBUG
+          printf("SDsetcompress(): dataset doesn't exist\n");
+#endif /* SDDEBUG */
+
+          /* element doesn't exist so we need a reference number */
+#ifdef NOT_YET
+          var->data_ref=Htagnewref(handle->hdf_file,DATA_TAG);
+#else /* NOT_YET */
+          var->data_ref=Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+          if(var->data_ref == 0)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      } /* end if */
+
+    status=(intn)HCcreate(handle->hdf_file,(uint16)DATA_TAG,
+                          (uint16) var->data_ref,COMP_MODEL_STDIO,&m_info,
+                          comp_type, &c_info_x);
+
+#ifdef SDDEBUG
+    printf("SDsetcompress(): HCcreate() status=%d\n",(intn)status);
+    if(status==FAIL)
+        HEprint(stderr,0);
+#endif /* SDDEBUG */
+
+    if(status != FAIL) 
+      {
+          if((var->aid != 0) && (var->aid != FAIL))
+            {
+                if (Hendaccess(var->aid) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+
+          var->aid = status;
+      } /* end if */
+
+    /* Insert data tag/ref into the variable's Vgroup */
+    if(var->vgid) 
+      {
+          int32 vg;
+
+          /* attach to the variable's Vgroup */
+          vg = Vattach(handle->hdf_file, var->vgid, "w");
+          if(vg == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+        
+          /* add new Vdata to existing Vgroup */
+          if (Vaddtagref(vg, (int32) DATA_TAG, (int32) var->data_ref) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+        
+          /* detach from the variable's VGroup --- will no longer need it */
+          if (Vdetach(vg) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+
+    /* added a new object -- make sure we flush the header */
+    handle->flags |= NC_HDIRTY;
+            
+    ret_value = (status != FAIL ? SUCCEED : FAIL);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetcompress */
+
+#ifndef H4_NO_DEPRECATED_SYMBOLS
+
+/******************************************************************************
+ NAME
+	SDgetcompress -- Retrieves compression information of a dataset
+
+ DESCRIPTION
+    This routine uses HCPgetcompress to retrieve the compression type
+    and the compression information of the identified dataset.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ MODIFICATION
+    July 2001: Added to fix bug #307 - BMR 
+    Apr 2005:  This function has incorrect behavior and is replaced by 
+	       SDgetcompinfo.  SDgetcompress will be removed in the future.
+
+******************************************************************************/ 
+intn 
+SDgetcompress(int32     id,     /* IN: dataset ID */
+              comp_coder_t*    comp_type,   /* OUT: the type of compression */
+              comp_info* c_info)/* OUT: ptr to compression information 
+				structure for storing the retrieved info */
+{
+    CONSTR(FUNC, "SDgetcompress");    /* for HGOTO_ERROR */
+    NC        *handle;
+    NC_var    *var;
+    intn       status = FAIL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetcompress: I've been called\n");
+#endif /* SDDEBUG */
+
+    /* clear error stack */
+    HEclear();
+
+    if(comp_type == NULL || c_info == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, id);
+    if(var == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef SDDEBUG
+    printf("SDgetcompress(): var->data_ref=%d, var->aid=%d\n",(int)var->data_ref, (int)var->aid);
+#endif /* SDDEBUG */
+    if(!var->data_ref) 
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* use lower-level routine to get the compression information */
+    status = HCPgetcompress(handle->hdf_file, var->data_tag, var->data_ref, 
+		comp_type, c_info);
+    if(status==FAIL) HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDgetcompress */
+
+#endif /* H4_NO_DEPRECATED_SYMBOLS */
+
+/******************************************************************************
+ NAME
+	SDgetcompinfo -- Retrieves compression information of a dataset
+
+ DESCRIPTION
+    This routine uses HCPgetcompinfo to retrieve the compression type
+    and the compression information of the identified dataset.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ MODIFICATION
+    July 2001: Added to fix bug #307 - BMR (from SDgetcompress)
+    Apr 2005:  This function was actually created at this time, but it is
+	       almost a duplicate of SDgetcompress, which is intended to be 
+	       removed in the future, due to its incorrect behavior.  The
+	       only difference is the call to the low-level routine,
+	       HCPgetcompinfo, instead of HCPgetcompress.
+
+******************************************************************************/ 
+intn 
+SDgetcompinfo(int32 sdsid,     /* IN: dataset ID */
+              comp_coder_t*    comp_type,   /* OUT: the type of compression */
+              comp_info* c_info)/* OUT: ptr to compression information 
+				structure for storing the retrieved info */
+{
+    CONSTR(FUNC, "SDgetcompinfo");    /* for HGOTO_ERROR */
+    NC        *handle;
+    NC_var    *var;
+    intn       status = FAIL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetcompinfo: I've been called\n");
+#endif /* SDDEBUG */
+
+    /* clear error stack */
+    HEclear();
+
+    if(comp_type == NULL || c_info == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+#ifdef SDDEBUG
+    printf("SDgetcompinfo(): var->data_ref=%d, var->aid=%d\n",(int)var->data_ref, (int)var->aid);
+#endif /* SDDEBUG */
+    /* return with SUCCEED if the data set is empty and not compressed; when
+       the data set is set compressed, the data has a valid reference number */
+    if(!var->data_ref) 
+    {
+	*comp_type = COMP_CODE_NONE;
+	HGOTO_DONE(SUCCEED);
+    }
+
+    /* use lower-level routine to get the compression information */
+    status = HCPgetcompinfo(handle->hdf_file, var->data_tag, var->data_ref, 
+		comp_type, c_info);
+
+    if(status==FAIL) HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDgetcompinfo */
+
+/******************************************************************************
+ NAME
+	SDgetcomptype -- Retrieves compression method of a dataset
+
+ DESCRIPTION
+    This routine uses HCPgetcomptype to retrieve the compression type
+    of the identified dataset.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ MODIFICATION
+    Dec 2007: Added to work around the problem where an external library is 
+	      missing, SDgetcompinfo will fail.  This new API will not need
+	      to get the compression information but only the compression type,
+	      which sometime is the only thing an application needs - BMR
+
+******************************************************************************/ 
+intn 
+SDgetcomptype(int32 sdsid,		/* IN: dataset ID */
+              comp_coder_t* comp_type	/* OUT: the type of compression */)
+{
+    CONSTR(FUNC, "SDgetcomptype");    /* for HGOTO_ERROR */
+    NC        *handle;
+    NC_var    *var;
+    intn       status = FAIL;
+    intn       ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetcomptype: I've been called\n");
+#endif /* SDDEBUG */
+
+    /* clear error stack */
+    HEclear();
+
+    if(comp_type == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* return with SUCCEED if the data set is empty and not compressed - when
+       the data set was set to be compressed, the data would have had a 
+       valid reference number even there was no data written */
+    if(!var->data_ref) 
+    {
+	*comp_type = COMP_CODE_NONE;
+	HGOTO_DONE(SUCCEED);
+    }
+
+    /* use lower-level routine to get the compression method */
+    status = HCPgetcomptype(handle->hdf_file, var->data_tag, var->data_ref, 
+		comp_type);
+
+    if(status==FAIL) HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDgetcomptype */
+
+/******************************************************************************
+ NAME
+	SDgetdatasize -- Retrieves the sizes of original and compressed data.
+
+ DESCRIPTION
+    This routine uses HCPgetdatasize to retrievethe original data and 
+    compressed data sizes of the identified dataset.  At least of the OUT
+    arguments must be non-null and a null argument will be unchanged.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ MODIFICATION
+
+******************************************************************************/ 
+intn 
+SDgetdatasize(int32 sdsid,		/* IN: dataset ID */
+              int32* comp_size,		/* OUT: size of compressed data */
+              int32* orig_size)		/* OUT: size of original data */
+
+{
+    CONSTR(FUNC, "SDgetdatasize");    /* for HGOTO_ERROR */
+    NC     *handle;
+    NC_var *var;
+    int32  *comp_size_tmp=NULL, *orig_size_tmp=NULL;
+    intn   status = FAIL;
+    intn   ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* must have at least one non-null argument */
+    if (comp_size == NULL && orig_size == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* allocate temporary buffers so user's arguments can be kept intact 
+       until finished */
+    if (comp_size != NULL)
+        comp_size_tmp = (int32 *) HDmalloc(sizeof(int32));
+    if (orig_size != NULL)
+        orig_size_tmp = (int32 *) HDmalloc(sizeof(int32));
+
+    /* get NC_var record */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+    if(handle->vars == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL) HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* if the data ref# of the SDS is 0, it indicates that the SDS has 
+	not been written with data because no storage is created 
+	for the SDS data */
+    if (var->data_ref == 0)
+    {
+	*comp_size_tmp = *orig_size_tmp = 0;
+    }
+    else
+    {
+	/* use lower-level routine to get the data sizes */
+	status = HCPgetdatasize(handle->hdf_file, var->data_tag, var->data_ref, 
+		comp_size_tmp, orig_size_tmp);
+	if (status == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+    /* Return the requested sizes */
+    if (comp_size != NULL)
+        *comp_size = *comp_size_tmp;
+    if (orig_size != NULL)
+        *orig_size = *orig_size_tmp;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    if (comp_size_tmp != NULL)
+        HDfree(comp_size_tmp);
+    if (orig_size_tmp != NULL)
+        HDfree(orig_size_tmp);
+
+    return ret_value;    
+} /* SDgetdatasize */
+
+
+/******************************************************************************
+ NAME
+	SDfindattr -- find an attribute's index by name
+
+ DESCRIPTION
+    Given an ID to an object and an attribute name return the index 
+    of the attribute with that name.  This does not support any
+    form of wildcards / regular expressions
+
+ RETURNS
+     An attribute index or FAIL
+
+******************************************************************************/ 
+int32
+SDfindattr(int32 id,       /* IN: object ID */
+           const char *attrname  /* IN: attribute name */)
+{
+    NC_array  *ap = NULL;
+    NC_array **app = NULL;
+    NC_attr  **attr = NULL;
+    NC        *handle = NULL;
+    int32      attrid;
+    size_t      len;
+    int32      ret_value = FAIL;
+
+    /* clear error stack */
+    HEclear();
+
+    /* determine what type of ID we've been given */
+    if(SDIapfromid(id, &handle, &app) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    ap = (*app);
+    if(ap == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* 
+     * ap is the proper attribute list now look up something with this
+     *  name
+     */
+
+    attr = (NC_attr **) ap->values;
+    len = HDstrlen(attrname);
+    
+    for(attrid = 0 ; attrid < ap->count ; attrid++, attr++)
+      {
+          if( len == (*attr)->name->len 
+              && HDstrncmp(attrname, (*attr)->name->values, HDstrlen(attrname)) == 0)
+            {
+                ret_value = attrid ; /* found it */
+                goto done;
+            }
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;        
+} /* SDfindattr */
+
+
+/******************************************************************************
+ NAME
+	SDidtoref -- get a unique reference number for this dataset
+
+ DESCRIPTION
+    Given an index return the ref of the associated NDG for 
+    inclusion in Vgroups and annotations
+
+ RETURNS
+     A reference number or FAIL
+
+******************************************************************************/
+int32
+SDidtoref(int32 id /* IN: dataset ID */)
+{
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    int32     ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDidtoref: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    ret_value = (int32) var->ndg_ref;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDidtoref */
+
+
+/******************************************************************************
+ NAME
+	SDreftoindex -- map a reference number to a dataset index
+
+ DESCRIPTION
+    Given a ref number return the index of the cooresponding dataset
+
+ RETURNS
+    A dataset index or FAIL
+
+******************************************************************************/
+int32
+SDreftoindex(int32 fid, /* IN: file ID */
+             int32 ref  /* IN: reference number */)
+{
+    NC       *handle = NULL;
+    NC_var  **dp = NULL;
+    intn      ii;
+    int32     ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDreftoindex: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    dp = (NC_var**) handle->vars->values;
+    for(ii = 0 ; ii < handle->vars->count ; ii++, dp++)
+      {
+        if((*dp)->ndg_ref == ref)
+          {
+            ret_value = ii;
+            goto done;
+          }
+      }
+    
+    ret_value = FAIL;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDreftoindex */
+
+
+/******************************************************************************
+ NAME
+	SDisrecord -- check is var is a record variable
+
+ DESCRIPTION
+    Return TRUE if the dataset in question is a record variable
+    else FALSE
+
+ RETURNS
+    TRUE/FALSE
+
+******************************************************************************/
+int32
+SDisrecord(int32 id /* IN: dataset ID */)
+{
+    NC       *handle;
+    NC_var   *var;
+    int32     ret_value = TRUE;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDisrecord: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    if(var->shape == NULL)
+      {
+        ret_value = TRUE; /* EP thinks it should return true - BMR, bug #1045 */
+        goto done;
+      }
+
+    if(var->shape[0] == SD_UNLIMITED)
+        ret_value = TRUE;
+    else
+        ret_value = FALSE;
+
+done:
+    if (ret_value == FALSE)
+      { /* FALSE cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDisrecord */
+
+
+/******************************************************************************
+ NAME
+	SDiscoordvar -- check is var is a coord var
+
+ DESCRIPTION
+    Return TRUE if the dataset in question is a coordinate variable
+
+ RETURNS
+     TRUE/FALSE
+
+******************************************************************************/
+intn
+SDiscoordvar(int32 id /* IN: dataset ID */)
+{
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    NC_dim   *dim = NULL;
+    int32     dimindex;
+    intn      ret_value = TRUE;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDiscoordvar: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    /* check whether this var is an SDS or a coordinate variable, then 
+       return the appropriate value (if and else if) */
+    if (var->var_type == IS_SDSVAR)
+      {
+        ret_value = FALSE;
+        goto done;
+      }
+
+    else if(var->var_type == IS_CRDVAR)
+      {
+        ret_value = TRUE;
+        goto done;
+      }
+
+    /* whether or not this var is a coord var is unknown because the data was
+       created by earlier version of the library which did not distinguish
+       the two kinds of variables, SDS variable and coordinate variables.
+       (see bugzilla 624) - BMR - 05/14/2007 */
+    else  /* proceed exactly as before the fix of bugzilla 624 is available */
+      {
+	dimindex = var->assoc->values[0];
+
+	dim = SDIget_dim(handle, dimindex);
+	if(dim == NULL)
+	  {
+	    ret_value = FALSE;
+	    goto done;
+	  }
+
+	if(var->name->len != dim->name->len)
+	  {
+	    ret_value = FALSE;
+	    goto done;
+	  }
+
+	if(HDstrcmp(var->name->values, dim->name->values))
+	  {
+	    ret_value = FALSE;
+	    goto done;
+	  }
+
+	ret_value = TRUE;
+      }
+
+done:
+    if (ret_value == FALSE)
+      { /* FALSE cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDiscoordvar */
+
+
+#if 0
+/* ---------------------------- RAGGED ARRAYS ----------------------------- */
+/*
+
+  Ragged arrays are a cross between datasets and index structures.  The
+  basic idea is that all but one of the dimensions is constant.  The
+  other dimension can vary over the course of the dataset.  This is
+  useful for storing equalarea grids and for making alogrithms much
+  more complex.  
+
+  Ragged arrays can be multi-dimensional and, eventually, record variables
+  too.  A 2-dimensional ragged array would look like:
+
+  **********
+  ********
+  *********    <---------- This is a line
+  *****
+  ***
+  *********
+  *******
+
+  The above ragged array has 7 "lines" the "line length" of the fifth line is 
+  three.  It is not necessary to set all of the line lengths at the same time
+  nor retreive them all at the same time.   However, to specify the line
+  length for line X, the length must be specified for all Y < X (is this
+  really necessary?)
+
+  Internally, the above ragged array would be stored as a one-dimensional
+  dataset.  In addition, there will be a rag_fill array that contains the
+  line lengths.  This rag_fill array will get written to a separate
+  structure in the file (tag DFTAG_SDRAG).
+
+*/
+/* ------------------------------------------------------------------------ */
+
+
+/******************************************************************************
+  Set the lengths of the lines of a ragged array.
+
+  Currently, these lines must be specified in increasing order (i.e. can't
+  use hyperslab type locations to set them).  This should probably be made
+  nicer once everything else works.
+
+******************************************************************************/
+int32
+SDsetrag(int32 sdsid, 
+         int32 low, 
+         int32 count, 
+         int32 *sizes)
+{
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    int32     ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetrag: I've been called\n");
+#endif
+    
+    /* clear error stack */
+    HEclear();
+
+    /* get the variable */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, sdsid);
+    if((var == NULL) || (var->is_ragged == FALSE))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* verify writing to a valid area */
+    if(var->rag_fill != low) 
+      {
+        printf("var->rag_fill %d    low %d\n", var->rag_fill, low); 
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* allocate some space for the ragged dimension if needed */
+    /* BUG: will need to be changed for ragged records */
+    if(var->rag_list == NULL) 
+      {
+        var->rag_list = (int32 *) HDmalloc(sizeof(int32) * var->dsizes[0]);
+        if(var->rag_list == NULL) 
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+      }
+
+    /* copy over the new values */
+    HDmemcpy(&(var->rag_list[low]), sizes, sizeof(int32) * count);
+    
+    /* update count */
+    var->rag_fill += count;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetrag */
+
+#endif /* 0 */
+
+
+/******************************************************************************
+ NAME
+	SDsetaccesstype -- set the I/O access type of an SD
+
+ DESCRIPTION
+    Set the type of I/O (serial, parallel, ...) for accessing the
+	data of the SD.  Access types can be DFACC_SERIAL, DFACC_PARALLEL,
+	DFACC_DEFAULT.
+
+ RETURNS
+    Return SUCCEED if the SD data can be accessed via accesstype.
+	Otherwise return FAIL.
+
+******************************************************************************/	
+intn 
+SDsetaccesstype(int32 id,         /* IN: dataset ID */
+                uintn accesstype  /* IN: access type */)
+{
+    NC       *handle = NULL;
+    NC_var   *var = NULL;
+    intn      ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetaccesstype: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    switch (accesstype)
+      {
+        case DFACC_DEFAULT:
+        case DFACC_SERIAL:
+        case DFACC_PARALLEL:
+            break;
+        default:
+            ret_value = FAIL;
+            goto done;
+      }
+
+    handle = SDIhandle_from_id(id, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->vars == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    var = SDIget_var(handle, id);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* if aid is not valid yet, there is no access_rec setup yet. */
+    /* Go ahead and try set it up. */
+    if(var->aid == FAIL && hdf_get_vp_aid(handle, var) == FAIL)
+        ret_value = FAIL;
+    else 
+        ret_value = (intn)Hsetaccesstype(var->aid, accesstype);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetaccesstype */
+
+
+/******************************************************************************
+ NAME
+	SDsetblocksize -- set the size of the linked blocks created.
+
+ DESCRIPTION
+    Set the size of the blocks used for storing the data for unlimited
+	dimension datasets.  This is used when creating new datasets only,
+	it does not have any affect on existing datasets.  The block_size 
+	should probably be set to a multiple of the "slice" size.
+
+ RETURNS
+    SUCCEED/FAIL
+
+******************************************************************************/
+intn
+SDsetblocksize(int32 sdsid,      /* IN: dataset ID */
+               int32 block_size  /* IN: size of the block in bytes */)
+{
+    NC      *handle = NULL;
+    NC_var  *var = NULL;
+    intn     ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetblocksize: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the variable */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* set the block size */
+    var->block_size = block_size;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;    
+} /* SDsetblocksize */
+
+
+/******************************************************************************
+ NAME
+	SDgetblocksize -- get the size of the linked blocks.
+
+ DESCRIPTION
+    Get the size of the blocks to be used for storing data of unlimited
+	dimension datasets.
+
+ RETURNS
+    SUCCEED/FAIL
+
+******************************************************************************/
+intn
+SDgetblocksize(int32 sdsid,      /* IN: dataset ID */
+               int32 *block_size /* OUT: size of the block in bytes */)
+{
+    CONSTR(FUNC, "SDgetblocksize");    /* for HGOTO_ERROR */
+    NC      *handle = NULL;
+    NC_var  *var = NULL;
+    int32    block_length = -1;
+    int32    temp_aid = -1;
+    intn     ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetblocksize: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get the variable */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* Get access id using data tag/ref.  Fail if data ref has not been defined;
+       this happens when SDgetblocksize is called when no data has been written
+       or no special element has been created. -BMR, 2013/12/17 */
+    temp_aid = var->aid;	/* use temp to avoid messing up var->aid. -BMR */
+    if (temp_aid == FAIL)
+    {
+	if (var->data_ref == 0)		/* no data means no linked-block storage */
+            HGOTO_ERROR(DFE_GENAPP, FAIL);
+
+	/* Start read access on the element to acquire access id */
+        temp_aid = Hstartread(handle->hdf_file, var->data_tag, var->data_ref);
+        if(temp_aid == FAIL) /* catch FAIL from Hstartread */
+            HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+    /* Use internal routine to do the actual retrieval */
+    if (HLgetblockinfo(temp_aid, &block_length, NULL) == FAIL)
+        HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    if (block_length > 0)
+	*block_size = block_length;
+
+    /* End access to the temp_aid only when var->aid is -1, so we won't end
+       access var->aid if it was valid. */
+    if (var->aid == FAIL && temp_aid != FAIL)
+	Hendaccess(temp_aid);
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+	if (var->aid == FAIL && temp_aid != FAIL)
+	    Hendaccess(temp_aid);
+      }
+    /* Normal cleanup */
+    return ret_value;    
+} /* SDgetblocksize */
+
+
+/******************************************************************************
+ NAME
+   SDsetfillmode -- set fill mode as fill or nofill
+
+ DESCRIPTION
+   Calls ncsetfill().
+
+ RETURNS
+   The current fill mode of the file, or FAIL for error.
+
+******************************************************************************/
+intn
+SDsetfillmode(int32 sd_id,  /* IN: HDF file ID, returned from SDstart */
+              intn fillmode /* IN: Desired fill mode for the file,
+                                   either SD_FILL or SD_NOFILL.
+                                   SD_FILL is the default mode. */)
+{
+    NC     *handle = NULL;
+    intn    cdfid;
+    intn    ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetfillmode: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(sd_id, CDFTYPE);
+    if(handle == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    cdfid = (intn)sd_id & 0xffff;
+    ret_value = ncsetfill(cdfid, fillmode);
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetfillmode() */
+
+/******************************************************************************
+ NAME
+    SDsetdimval_comp -- set dimval backward compatibility
+
+ DESCRIPTION
+
+ RETURNS
+    SUCCEED/FAIL
+
+******************************************************************************/
+intn
+SDsetdimval_comp(int32 dimid,    /* IN: dimension ID, returned from SDgetdimid */
+                 intn comp_mode  /* IN: backward compatibility:
+                                    SD_DIMVAL_BW_COMP -- compatible
+                                    SD_DIMVAL_BW_INCOMP -- incompatible.
+                                    (defined in mfhdf.h ) */)
+{
+    NC      *handle = NULL;
+    NC_dim  *dim = NULL;
+    intn     ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDsetdimval_comp: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(dimid, DIMTYPE);
+    if(handle == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the dimension structure */
+    dim = SDIget_dim(handle, dimid);
+    if(dim == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+/*    if (dim->size != SD_UNLIMITED  
+        && dim->dim00_compat != comp_mode )  
+*/
+    if (dim->dim00_compat != comp_mode)
+      {
+        dim->dim00_compat = comp_mode;
+
+        /* make sure it gets reflected in the file */
+        handle->flags |= NC_HDIRTY;
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDsetdimval_comp */
+
+
+/******************************************************************************
+ NAME
+   SDisdimval_bwcomp -- get dimval backward compatibility
+
+ DESCRIPTION
+
+ RETURNS
+    SD_DIMVAL_BW_COMP if dimval is backward compatible;
+    SD_DIMVAL_BW_INCOMP for not compatible; FAIL for error. 
+
+******************************************************************************/
+intn
+SDisdimval_bwcomp(int32 dimid /* IN: dimension ID, returned from SDgetdimid */)
+{
+    NC      *handle = NULL;
+    NC_dim  *dim = NULL;
+    intn    ret_value = FAIL;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDisdimval_bwcomp: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(dimid, DIMTYPE);
+    if(handle == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get the dimension structure */
+    dim = SDIget_dim(handle, dimid);
+    if(dim == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+/* Default is incompatible. Return dim->dim00_compat.
+    if (dim->size == SD_UNLIMITED) 
+        ret_value = SD_DIMVAL_BW_COMP;
+    else 
+*/
+    ret_value = dim->dim00_compat; 
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;    
+} /* SDisdimval_bwcomp */
+
+/*====================== Chunking Routines ================================*/
+
+/******************************************************************************
+ NAME
+      SDsetchunk  -- make SDS a chunked SDS
+
+ DESCRIPTION
+      This routine makes the SDS a chunked SDS according to the chunk
+      definiton passed in.
+
+      The dataset currently cannot be special already.  i.e. NBIT,
+      COMPRESSED, or EXTERNAL. This is an Error.
+
+      The defintion of the HDF_CHUNK_DEF union with relvant fields is:
+
+      typedef union hdf_chunk_def_u
+      {
+         int32   chunk_lengths[H4_MAX_VAR_DIMS];  Chunk lengths along each dimension
+
+         struct 
+          {   
+            int32     chunk_lengths[H4_MAX_VAR_DIMS]; Chunk lengths along each dimension
+            int32     comp_type;                   Compression type 
+            comp_info cinfo;                       Compression info struct 
+          }comp;
+
+      } HDF_CHUNK_DEF
+
+      The variable agruement 'flags' is a bit-or'd value which can currently be
+      'HDF_CHUNK' or 'HDF_CHUNK | HDF_COMP'.
+
+      The simplist is the 'chunk_lengths' array specifiying chunk 
+      lengths for each dimension where the 'flags' argument set to 
+      'HDF_CHUNK';
+
+      COMPRESSION is set by using the 'HDF_CHUNK_DEF' union to set the
+      appropriate compression information along with the required chunk lengths
+      for each dimension. The compression information is the same as 
+      that set in 'SDsetcompress()'. The bit-or'd 'flags' argument' is set to 
+      'HDF_CHUNK | HDF_COMP'.
+
+      See the example in pseudo-C below for further usage.
+
+      The maximum number of Chunks in an HDF file is 65,535.
+
+      The dataset currently cannot have an UNLIMITED dimension.
+
+      The performance of the SDxxx interface with chunking is greatly
+      affected by the users access pattern over the dataset and by
+      the maximum number of chunks set in the chunk cache. The cache contains 
+      the Least Recently Used(LRU cache replacment policy) chunks. See the
+      routine SDsetchunkcache() for further info on the chunk cache and how 
+      to set the maximum number of chunks in the chunk cache. A default chunk 
+      cache is always created.
+
+      The following example shows the organization of chunks for a 2D array.
+      e.g. 4x4 array with 2x2 chunks. The array shows the layout of
+           chunks in the chunk array.
+
+            4 ---------------------                                           
+              |         |         |                                                 
+        Y     |  (0,1)  |  (1,1)  |                                       
+        ^     |         |         |                                      
+        |   2 ---------------------                                       
+        |     |         |         |                                               
+        |     |  (0,0)  |  (1,0)  |                                      
+        |     |         |         |                                           
+        |     ---------------------                                         
+        |     0         2         4                                       
+        ---------------> X                                                       
+
+        --Without compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                                                                    
+        -- Set chunk lengths --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2; 
+
+        -- Set Chunking -- 
+        SDsetchunk(sdsid, chunk_def, HDF_CHUNK);                      
+         ......                                                                  
+        }                                                                           
+
+        --With compression--:
+        {                                                                    
+        HDF_CHUNK_DEF chunk_def;
+                                                                            
+        .......                
+        -- Set chunk lengths first --                                                    
+        chunk_def.chunk_lengths[0]= 2;                                                     
+        chunk_def.chunk_lengths[1]= 2;
+
+        -- Set compression --
+        chunk_def.comp.cinfo.deflate.level = 9;
+        chunk_def.comp.comp_type = COMP_CODE_DEFLATE;
+
+        -- Set Chunking with Compression --
+        SDsetchunk(sdsid, chunk_def, HDF_CHUNK | HDF_COMP);                      
+         ......                                                                  
+        }                                                                           
+
+        NOTE:
+           This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+        -GeorgeV
+******************************************************************************/
+intn 
+SDsetchunk(int32         sdsid,     /* IN: sds access id */
+           HDF_CHUNK_DEF chunk_def, /* IN: chunk definition */
+           int32         flags      /* IN: flags */)
+{
+    CONSTR(FUNC, "SDsetchunk");    /* for HGOTO_ERROR */
+    NC        *handle = NULL;      /* file handle */
+    NC_var    *var    = NULL;      /* SDS variable */
+    NC_attr  **fill_attr = NULL;   /* fill value attribute */
+    HCHUNK_DEF chunk[1];           /* H-level chunk defintion */
+    HDF_CHUNK_DEF *cdef   = NULL;  /* SD Chunk definition */
+    model_info minfo;              /* dummy model info struct */
+    comp_info  cinfo;              /* compression info - NBIT */
+    uint32 comp_config;
+    int32     *cdims    = NULL;    /* array of chunk lengths */
+    int32      fill_val_len = 0;   /* fill value length */
+    void      *fill_val    = NULL; /* fill value */
+    int32      ndims    = 0;       /* # dimensions i.e. rank */
+    uint8      nlevels  = 1;       /* default # levels is 1 */
+    int8       platntsubclass;     /* the machine type of the current platform */
+    int8       outntsubclass;      /* the data's machine type */
+    uintn      convert;            /* whether to convert or not */
+    int32 tBuf_size = 0;	   /* conversion buffer size */
+    void  *tBuf = NULL;		   /* buffer used for conversion */
+    intn       i;                  /* loop variable */
+    intn       ret_value = SUCCEED;   /* return value */
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: called  \n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+     /* make sure this is cleared */
+     memset(chunk,0,sizeof(chunk[0]));
+    /* Check some args */
+
+    /* get file handle and verify it is an HDF file 
+       we only handle dealing with SDS only not coordinate variables */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE || handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get variable from id */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* disallow setting chunk for SDS with rank = 0 - BMR, bug #1045 */
+    if(var->shape == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* Decide type of defintion passed in  */
+    switch (flags)
+      {
+      case HDF_CHUNK: /* case where chunk_def only has chunk lengths */
+          cdef  = (HDF_CHUNK_DEF *)&chunk_def;
+          cdims = cdef->chunk_lengths;
+          chunk[0].chunk_flag = 0;  /* nothing set for this now */
+          chunk[0].comp_type = COMP_CODE_NONE; /* nothing set */
+          chunk[0].model_type = COMP_MODEL_STDIO; /* Default */
+          chunk[0].cinfo = &cinfo; /* dummy */
+          chunk[0].minfo = &minfo; /* dummy */
+          break;
+      case (HDF_CHUNK | HDF_COMP):
+      /*  EIP 9/11/03 
+       *  We have to take special care if SZIP library is not available;
+       *  For all other compression types do
+       */
+          cdef  = (HDF_CHUNK_DEF *)&chunk_def;
+
+    HCget_config_info( (comp_coder_t)cdef->comp.comp_type , &comp_config);
+    if ((comp_config & (COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED)) == 0) {
+	/* coder not present?? */
+	    HGOTO_ERROR(DFE_NOENCODER, FAIL);
+    }
+    if ((comp_config & COMP_ENCODER_ENABLED) == 0) {
+	/* encoder not present?? */
+	HGOTO_ERROR(DFE_BADCODER, FAIL);
+    }
+      if ((comp_coder_t)cdef->comp.comp_type != COMP_CODE_SZIP) {
+          cdims = cdef->comp.chunk_lengths;
+          chunk[0].chunk_flag = SPECIAL_COMP;  /* Compression */
+          chunk[0].comp_type  = (comp_coder_t)cdef->comp.comp_type; 
+          chunk[0].model_type = COMP_MODEL_STDIO; /* Default */
+          chunk[0].cinfo = &cdef->comp.cinfo; 
+          chunk[0].minfo = &minfo; /* dummy */
+       }
+       else /* requested compression is SZIP */
+
+#ifdef H4_HAVE_LIBSZ          /* we have the library */
+          {
+           cdims = cdef->comp.chunk_lengths;
+           chunk[0].chunk_flag = SPECIAL_COMP;  /* Compression */
+           chunk[0].comp_type  = (comp_coder_t)cdef->comp.comp_type; 
+           chunk[0].model_type = COMP_MODEL_STDIO; /* Default */
+           chunk[0].minfo = &minfo; /* dummy */
+    	   HDmemcpy(&cinfo,&(cdef->comp.cinfo),sizeof(comp_info));
+	   if ( SDsetup_szip_parms( sdsid, handle, &cinfo, cdims) == FAIL ) {
+	       HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	   }
+              chunk[0].cinfo = &cinfo; 
+          }
+#else                         /* we do not have the SZIP library */
+          {
+		HGOTO_ERROR(DFE_BADCODER, FAIL);
+          }
+#endif /* H4_HAVE_LIBSZ */
+
+          break;
+      case (HDF_CHUNK | HDF_NBIT):
+          cdef  = (HDF_CHUNK_DEF *)&chunk_def;
+          cdims = cdef->nbit.chunk_lengths;
+          chunk[0].chunk_flag = SPECIAL_COMP;  /* NBIT is a type of compression */
+          chunk[0].comp_type  = COMP_CODE_NBIT;   /* Nbit compression? */
+          chunk[0].model_type = COMP_MODEL_STDIO; /* Default */
+          /* set up n-bit parameters */
+          cinfo.nbit.nt        = var->HDFtype;
+          cinfo.nbit.sign_ext  = cdef->nbit.sign_ext;
+          cinfo.nbit.fill_one  = cdef->nbit.fill_one;
+          cinfo.nbit.start_bit = cdef->nbit.start_bit;
+          cinfo.nbit.bit_len   = cdef->nbit.bit_len;
+          chunk[0].cinfo = &cinfo; 
+          chunk[0].minfo = &minfo; /* dummy */
+          break;
+      default:
+          ret_value = FAIL;
+          goto done;
+      }
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: does data ref exist?  \n");
+#endif
+    /* Does data exist yet */
+    if(!var->data_ref) 
+      {   /* doesn't exist */
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: data ref does not exist  \n");
+#endif
+          /* element doesn't exist so we need a reference number */
+          var->data_ref=Hnewref(handle->hdf_file);
+          if(var->data_ref == 0)
+            {
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: failed to get data ref  \n");
+#endif
+              ret_value = FAIL;
+              goto done;
+            }
+      } 
+    else /* data ref exists, Error since can't convert existing SDS to chunked */
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* Now start setting chunk info */
+    ndims = var->assoc->count; /* set number of dims i.e. rank */
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: got data ref, ndims =%d  \n",ndims);
+#endif
+
+    /* allocate space for chunk dimensions */
+    if ((chunk[0].pdims = (DIM_DEF *)HDmalloc(ndims*sizeof(DIM_DEF))) == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* initialize datset/chunk sizes using CHUNK defintion structure */
+    chunk[0].chunk_size = 1;
+    chunk[0].num_dims = ndims;
+
+/* Developer's note: should move unlim check to the beginning and clean up this for loop */
+    for (i = 0; i < ndims; i++)
+      {   /* get dimension length from shape arrays */
+          /* check if dimension in unlimited since we don't 
+             handle that yet */
+          if (var->shape[i] != SD_UNLIMITED)
+              chunk[0].pdims[i].dim_length = (int32) var->shape[i];
+          else
+            { /* UNLIMITED dimension case */
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: unlimited dimension case  \n");
+    fflush(stderr);
+#endif
+                ret_value = FAIL;
+                goto done;
+            }
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: (int32) var->shape[%d]=%d\n",i,(int32) var->shape[i]);
+    fflush(stderr);
+#endif
+          /* set chunk lengths */
+          if (cdims[i] >= 1)
+              chunk[0].pdims[i].chunk_length = cdims[i];
+          else
+            { /* chunk length is less than 1 */
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: chunk length less than 1, cdims[%d]=%d \n",i,cdims[i]);
+    fflush(stderr);
+#endif
+                ret_value = FAIL;
+                goto done;
+            }
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: cdims[%d]=%d \n",i,cdims[i]);
+    fflush(stderr);
+#endif          
+          /* Data distribution along dimensions 
+          *  Check dimension length agains chunk length */
+          if (cdims[i] == (int32)var->shape[i])
+              chunk[0].pdims[i].distrib_type = 0;     /* NONE */
+          else
+              chunk[0].pdims[i].distrib_type = 1;     /* BLOCK */
+
+          /* compute chunk size */
+          chunk[0].chunk_size *= cdims[i];
+      } /* end for ndims */
+
+    /* Set number type size i.e. size of data type */
+    chunk[0].nt_size = var->HDFsize;
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: var->HDFsize=%d\n",var->HDFsize);
+    fflush(stderr);
+#endif
+    /* allocate space for fill value whose number type is the same as
+       the dataset */
+    fill_val_len = var->HDFsize;
+    if ((fill_val = (void *)HDmalloc(fill_val_len)) == NULL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    /* get fill value if one is set for this Dataset.
+       The number type is the same as that for the dataset. */
+    fill_attr = (NC_attr **) NC_findattr(&(var->attrs), _FillValue);
+    if(fill_attr != NULL)
+      {
+          NC_copy_arrayvals((char *)fill_val, (*fill_attr)->data) ;    
+      }
+    else /* copy standard default fill value for now */
+      {
+        void *p = fill_val;
+
+        switch(var->HDFtype & 0xff) 
+          {
+          case DFNT_CHAR:
+          case DFNT_UCHAR:
+              *((uint8 *)p) = FILL_CHAR;
+              break;
+          case DFNT_INT8:
+          case DFNT_UINT8:
+              *((int8 *)p) = FILL_BYTE;
+              break;
+          case DFNT_INT16:
+          case DFNT_UINT16:
+              *((int16 *)p) = FILL_SHORT;
+              break;
+          case DFNT_INT32:
+          case DFNT_UINT32:
+              *((int32 *)p) = FILL_LONG;
+              break;
+          case DFNT_FLOAT32:
+              *((float32 *)p) = FILL_FLOAT;
+              break;
+          case DFNT_FLOAT64:
+              *((float64 *)p) = FILL_DOUBLE;
+              break;
+        default:
+            ret_value = FAIL;
+            goto done;
+        }
+      }
+
+    /* figure out if fill value has to be converted */
+    if (FAIL == (platntsubclass = DFKgetPNSC(var->HDFtype, DF_MT)))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+ 
+    if (DFKisnativeNT(var->HDFtype))
+      {
+        if (FAIL == (outntsubclass = DFKgetPNSC(var->HDFtype, DF_MT)))
+          {
+              ret_value = FAIL;
+              goto done;
+          }
+       }
+    else
+      {
+          outntsubclass = DFKislitendNT(var->HDFtype) ? DFNTF_PC : DFNTF_HDFDEFAULT;
+      }
+            
+    convert = (uintn)(platntsubclass != outntsubclass);
+
+    /* make sure our tmp buffer is big enough to hold fill value */
+    if(convert && tBuf_size < fill_val_len) 
+      {
+          if(tBuf != NULL) 
+              HDfree(tBuf);
+          tBuf_size = fill_val_len;
+          tBuf      = HDmalloc(tBuf_size);
+          if(tBuf == NULL) 
+            {
+                tBuf_size = 0;
+                ret_value    = FAIL;
+                goto done;
+            } /* end if */
+      } /* end if */
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: get ready to create, convert=%d\n",convert);
+#endif
+    if (convert)
+      { /* convert fill value */
+          if (FAIL == DFKconvert(fill_val, tBuf, var->HDFtype,
+                                (uint32) (fill_val_len/var->HDFsize), DFACC_WRITE, 0, 0))
+            {
+                ret_value    = FAIL;
+                goto done;
+            } 
+
+        /* check to see already special.
+           Error if already special since doubly special elements are
+           not yet handled. HMCcreate should catch this....*/
+        /* Create SDS as chunked element  */
+        ret_value = HMCcreate(handle->hdf_file,       /* HDF file handle */
+                           (uint16)DATA_TAG,       /* Data tag */
+                           (uint16) var->data_ref, /* Data ref */
+                           nlevels,                /* nlevels */
+                           fill_val_len,           /* fill value length */
+                           tBuf,           /* fill value */
+                           (HCHUNK_DEF *)chunk      /* chunk definition */);
+      }
+    else /* no need to convert fill value */
+      {
+          /* check to see already special.
+             Error if already special since doubly special elements are
+             not yet handled. HMCcreate should catch this....*/
+          /* Create SDS as chunked element  */
+          ret_value = HMCcreate(handle->hdf_file,       /* HDF file handle */
+                             (uint16)DATA_TAG,       /* Data tag */
+                             (uint16) var->data_ref, /* Data ref */
+                             nlevels,                /* nlevels */
+                             fill_val_len,           /* fill value length */
+                             fill_val,       /* fill value */
+                             (HCHUNK_DEF *)chunk      /* chunk definition */);
+      }
+
+#ifdef CHK_DEBUG
+    fprintf(stderr,"SDsetchunk: ret_value =%d \n", ret_value);
+#endif
+    /* check return */
+    if(ret_value != FAIL) 
+      { /* close old aid and set new one
+         ..hmm......maybe this is for the doubly specail hack since
+         this code framework came from SDsetcompress()....*/
+          if((var->aid != 0) && (var->aid != FAIL))
+            {
+              if (Hendaccess(var->aid) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+            }
+
+          var->aid = ret_value;
+          ret_value = SUCCEED; /* re-set to successful */
+      } /* end if */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    /* free fill value */
+    if (fill_val != NULL)
+        HDfree(fill_val);
+    if (tBuf != NULL)
+        HDfree(tBuf);
+
+    /* free chunk dims */
+    if (chunk[0].pdims != NULL)
+        HDfree(chunk[0].pdims);
+
+
+    return ret_value;
+} /* SDsetchunk */
+
+/******************************************************************************
+ NAME
+     SDgetchunkinfo_old -- get Info on SDS
+
+ DESCRIPTION
+     This routine gets any special information on the SDS. If its chunked,
+     chunked and compressed or just a regular SDS. Currently it will only
+     fill the array of chunk lengths for each dimension as specified in
+     the 'HDF_CHUNK_DEF' union. It does not tell you the type of compression
+     or the compression parameters used. You can pass in a NULL for 'chunk_def'
+     if don't want the chunk lengths for each dimension.
+     If successfull it will return a bit-or'd value in 'flags' indicating 
+     if the SDS is  chunked(HDF_CHUNK), chunked and compressed(HDF_CHUNK | HDF_COMP) 
+     or non-chunked(HDF_NONE).
+ 
+     e.g. 4x4 array - Pseudo-C
+     {
+     HDF_CHUNK_DEF rchunk_def;
+     int32   cflags;
+     ...
+     SDgetchunkinfo_old(sdsid, &rchunk_def, &cflags);
+     ...
+     }
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+        -GeorgeV
+******************************************************************************/
+intn 
+SDgetchunkinfo_old(int32          sdsid,      /* IN: sds access id */
+               HDF_CHUNK_DEF *chunk_def,  /* IN/OUT: chunk definition */
+               int32         *flags       /* IN/OUT: flags */)
+{
+    NC       *handle = NULL;       /* file handle */
+    NC_var   *var    = NULL;       /* SDS variable */
+    sp_info_block_t info_block;    /* special info block */
+    int16     special;             /* Special code */
+    intn      i;                   /* loop variable */
+    intn      ret_value = SUCCEED; /* return value */
+
+    /* clear error stack */
+    HEclear();
+
+    /* Check args */
+
+    /* get file handle and verify it is an HDF file 
+       we only handle dealing with SDS only not coordinate variables */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE || handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get variable from id */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+     /* Data set is empty and not special */
+    if(var->data_ref == 0)
+      {
+	*flags = HDF_NONE; /* regular SDS */
+	ret_value = SUCCEED;
+	goto done;
+      }
+
+    /* Check to see if data aid exists? i.e. may need to create a ref for SDS */
+    if(var->aid == FAIL && hdf_get_vp_aid(handle, var) == FAIL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* inquire about element */
+    ret_value = Hinquire(var->aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {   /* make sure it is chunked element */
+          if (special == SPECIAL_CHUNKED)
+            { /* get info about chunked element */
+             if ((ret_value = HDget_special_info(var->aid, &info_block)) != FAIL)
+               {   /* Does user want chunk lengths back? */
+                   if (chunk_def != NULL)
+                     {
+                         /* we assume user has allocat space for chunk lengths */
+                         /* copy chunk lengths over */
+                         for (i = 0; i < info_block.ndims; i++)
+                           {
+                               chunk_def->chunk_lengths[i] = info_block.cdims[i];
+                           }
+                     }
+                   /* dont forget to free up info is special info block 
+                      This space was allocated by the library */
+                   HDfree(info_block.cdims);
+
+                   /* Check to see if compressed.
+                      Currently we don't fill in the 'comp' structure 
+                      because currently only the information about the 
+                      compression type is available in get compression
+                      info code and not the parameters that went along. */
+                   switch(info_block.comp_type)
+                     {
+                     case COMP_CODE_NONE:
+                         *flags = HDF_CHUNK;
+                         break;
+                     case COMP_CODE_NBIT:
+                         *flags = (HDF_CHUNK | HDF_NBIT);
+                         break;
+                     default:
+                         *flags = (HDF_CHUNK | HDF_COMP);
+                         break;
+                     }
+               }
+            }
+          else /* not special chunked element */
+            {
+              *flags = HDF_NONE; /* regular SDS */
+            }
+      }
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+
+    return ret_value;
+} /* SDgetchunkinfo_old() */
+
+
+/******************************************************************************
+ NAME
+     SDgetchunkinfo -- get Info on SDS
+
+ DESCRIPTION
+     This routine gets any special information on the SDS. If its chunked,
+     chunked and compressed or just a regular SDS. Currently it will only
+     fill the array of chunk lengths for each dimension as specified in
+     the 'HDF_CHUNK_DEF' union. It does not tell you the type of compression
+     or the compression parameters used. You can pass in a NULL for 'chunk_def'
+     if don't want the chunk lengths for each dimension.
+     If successfull it will return a bit-or'd value in 'flags' indicating 
+     if the SDS is  chunked(HDF_CHUNK), chunked and compressed(HDF_CHUNK | HDF_COMP) 
+     or non-chunked(HDF_NONE).
+ 
+     e.g. 4x4 array - Pseudo-C
+     {
+     HDF_CHUNK_DEF rchunk_def;
+     int32   cflags;
+     ...
+     SDgetchunkinfo(sdsid, &rchunk_def, &cflags);
+     ...
+     }
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+        -GeorgeV
+
+ MODIFICATION
+	Jun, 2009: Added compression type and compression parameters.- BMR
+
+******************************************************************************/
+intn 
+SDgetchunkinfo(int32          sdsid,      /* IN: sds access id */
+               HDF_CHUNK_DEF *chunk_def,  /* IN/OUT: chunk definition */
+               int32         *flags       /* IN/OUT: flags */)
+{
+    CONSTR(FUNC, "SDgetchunkinfo");    /* for HGOTO_ERROR */
+    NC       *handle = NULL;       /* file handle */
+    NC_var   *var    = NULL;       /* SDS variable */
+    sp_info_block_t info_block;    /* special info block */
+    comp_coder_t comp_type;
+    comp_info c_info;
+    int16     special;             /* Special code */
+    intn      i;                   /* loop variable */
+    intn      ret_value = SUCCEED; /* return value */
+
+    /* Clear error stack */
+    HEclear();
+
+    /* Check args */
+
+    /* Get file handle and verify it is an HDF file 
+       we only handle dealing with SDS only not coordinate variables */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE || handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* Get variable from id */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+	 HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* If SDsetchunk had been called for this SDS, data_ref would have been a
+       valid one.  This is the case where data set is empty and not special */
+    if(var->data_ref == 0)
+      {
+	*flags = HDF_NONE; /* regular SDS */
+	ret_value = SUCCEED;
+	goto done;
+      }
+
+#ifdef added_by_mistake
+    /* Replaced this if statement by if (var->aid == FAIL) because it seemed
+       that hdf_get_vp_aid was called here by mistake (perhaps, copy/paste.)
+       For more info, see SVN log messages and bug HDFFR-171. -BMR, 2011/10 */
+
+    /* Check if data aid exists; if not, set up an access elt for reading */
+    if(var->aid == FAIL && hdf_get_vp_aid(handle, var) == FAIL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+#endif
+
+    /* Need to get access id for the subsequent calls */
+    if (var->aid == FAIL)
+    {
+	var->aid = Hstartread(handle->hdf_file, var->data_tag, var->data_ref);
+	if(var->aid == FAIL) /* catch FAIL from Hstartread */
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+    /* Inquire about element's specialness */
+    ret_value = Hinquire(var->aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value == FAIL)
+	HGOTO_ERROR(DFE_INTERNAL, FAIL);
+
+    /* Make sure it is chunked element */
+    if (special == SPECIAL_CHUNKED)
+    {   /* Get info about chunked element */
+	if ((ret_value = HDget_special_info(var->aid, &info_block)) != FAIL)
+	{   /* Does user want chunk/comp info back? */
+		/* If no compression, fill in chunk length, otherwise, fill
+		   in chunk length and compression info. */
+	    switch(info_block.comp_type) {
+	      case COMP_CODE_NONE:
+		  *flags = HDF_CHUNK;
+
+                  /* if chunk info is requested */
+		  if (chunk_def != NULL)
+		  {
+		      /* copy chunk lengths over */
+                      for (i = 0; i < info_block.ndims; i++)
+                           chunk_def->chunk_lengths[i] = info_block.cdims[i];
+		  }
+                  break;
+
+	      case COMP_CODE_NBIT:
+                  *flags = (HDF_CHUNK | HDF_NBIT);
+
+                  /* if chunk info is requested */
+		  if (chunk_def != NULL)
+		  {
+		      /* copy chunk lengths over */
+                      for (i = 0; i < info_block.ndims; i++)
+                          chunk_def->nbit.chunk_lengths[i] = info_block.cdims[i];
+		      /* get the NBIT compression info */
+		      ret_value = HCPgetcompinfo(handle->hdf_file,
+					var->data_tag, var->data_ref,
+					&comp_type, &c_info);
+		      /* For backward compatibility, it will not fail here.
+			 However, the compression information parameters will
+			 be set to -1 to indicate that there are no compression
+			 information retrieved - BMR - 2009/06 */
+		      if (ret_value == FAIL)
+		      {
+			  chunk_def->nbit.start_bit =
+			  chunk_def->nbit.bit_len =
+			  chunk_def->nbit.sign_ext =
+			  chunk_def->nbit.fill_one = -1;
+		      }
+		      else
+		      {
+			  chunk_def->nbit.start_bit = c_info.nbit.start_bit;
+			  chunk_def->nbit.bit_len = c_info.nbit.bit_len;
+			  chunk_def->nbit.sign_ext = c_info.nbit.sign_ext;
+			  chunk_def->nbit.fill_one = c_info.nbit.fill_one;
+		      }
+		  }
+                  break;
+
+	      default:
+                  *flags = (HDF_CHUNK | HDF_COMP);
+
+                  /* if chunk info is requested */
+		  if (chunk_def != NULL)
+		  {
+		      /* copy chunk lengths over */
+                      for (i = 0; i < info_block.ndims; i++)
+                      {
+                          chunk_def->comp.chunk_lengths[i] = info_block.cdims[i];
+                      }
+
+		      /* get the compression info */
+		      ret_value = HCPgetcompinfo(handle->hdf_file,
+					var->data_tag, var->data_ref,
+					&comp_type, &c_info);
+
+		      /* For backward compatibility, it will not fail here.
+			 However, the compression information parameters will
+			 be set to -1 to indicate that there are no compression
+			 information retrieved - EIP/BMR - 2010/02 */
+		      if (ret_value == FAIL)
+		      {
+			  chunk_def->comp.comp_type = info_block.comp_type;
+			  switch (info_block.comp_type)
+			  {
+			    case COMP_CODE_NBIT:
+				chunk_def->comp.cinfo.nbit.nt =
+				chunk_def->comp.cinfo.nbit.sign_ext =
+				chunk_def->comp.cinfo.nbit.fill_one =
+				chunk_def->comp.cinfo.nbit.start_bit =
+				chunk_def->comp.cinfo.nbit.bit_len = -1;
+				break;
+
+			    case COMP_CODE_SKPHUFF:
+				chunk_def->comp.cinfo.skphuff.skp_size = -1;
+				break;
+
+			    case COMP_CODE_DEFLATE:
+				chunk_def->comp.cinfo.deflate.level = -1;
+				break;
+
+			    case COMP_CODE_SZIP:
+				chunk_def->comp.cinfo.szip.pixels =
+				chunk_def->comp.cinfo.szip.pixels_per_scanline =
+				chunk_def->comp.cinfo.szip.options_mask =
+				chunk_def->comp.cinfo.szip.bits_per_pixel =
+				chunk_def->comp.cinfo.szip.pixels_per_block = -1;
+				break;
+
+        /* What about JPEG? - BMR */
+			    default:  /* no additional info needed */
+				break;
+			  }  /* end switch */
+		      }
+		      else
+		      {
+			  HDmemcpy(&(chunk_def->comp.cinfo), &c_info, sizeof(comp_info));
+			  chunk_def->comp.comp_type = (int32)comp_type;
+		      }
+		  }  /* chunk_def != NULL */
+                  break; /* default */
+                } /* end of switch info_block.comp_type */
+            /* Free up info in special info block, allocated by the library */
+            HDfree(info_block.cdims);
+	}
+    }
+    else /* not special chunked element */
+    {
+	    *flags = HDF_NONE; /* regular SDS */
+    }
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* SDgetchunkinfo() */
+
+
+/******************************************************************************
+ NAME
+     SDwritechunk   -- write the specified chunk to the SDS
+
+ DESCRIPTION
+     This routine writes a whole chunk of data to the chunked SDS 
+     specified by chunk 'origin' for the given SDS and can be used
+     instead of SDwritedata() when this information is known. This
+     routine has less overhead and is much faster than using SDwritedata().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See SDsetchunk() for a description of the organization of chunks in an SDS.
+
+     NOTE:
+           This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+       -GeorgeV
+******************************************************************************/
+intn 
+SDwritechunk(int32       sdsid, /* IN: access aid to SDS */
+             int32      *origin,/* IN: origin of chunk to write */
+             const void *datap  /* IN: buffer for data */)
+{
+    CONSTR(FUNC, "SDwritechunk");    /* for HGOTO_ERROR */
+    NC        *handle = NULL;   /* file handle */
+    NC_var    *var    = NULL;   /* SDS variable */
+    int16      special;         /* Special code */
+    int32      csize;           /* phsical chunk size */
+    uint32     byte_count;      /* bytes to write */
+    int8       platntsubclass;  /* the machine type of the current platform */
+    int8       outntsubclass;   /* the data's machine type */
+    uintn      convert;         /* whether to convert or not */
+    comp_coder_t comp_type;
+    uint32  comp_config;
+    int32 status;
+    intn       i;
+    sp_info_block_t info_block; /* special info block */
+    uint32 tBuf_size = 0;	/* conversion buffer size */
+    void  *tBuf = NULL;		/* buffer used for conversion */
+    intn       ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    info_block.cdims = NULL;
+
+    /* Check args */
+    if (origin == NULL || datap == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get file handle and verify it is an HDF file 
+       we only handle writinng to SDS only not coordinate variables */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE || handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+
+    /* get variable from id */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* Check to see if data aid exists? i.e. may need to create a ref for SDS */
+    if(var->aid == FAIL && hdf_get_vp_aid(handle, var) == FAIL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* Check compression method is enabled */
+    status = HCPgetcomptype(handle->hdf_file, var->data_tag, var->data_ref,
+                &comp_type);
+
+    if (status != FAIL)
+	if (comp_type != COMP_CODE_NONE && comp_type != COMP_CODE_INVALID)
+      {
+	/* Must have encoder to write */
+        HCget_config_info( comp_type , &comp_config);
+        if ((comp_config & COMP_ENCODER_ENABLED) == 0) {
+	    /* encoder not present?? */
+	    HGOTO_ERROR(DFE_BADCODER, FAIL);
+          }
+      }
+
+    /* inquire about element */
+    ret_value = Hinquire(var->aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {
+          if (special == SPECIAL_CHUNKED)
+            {  /* yes */
+
+                /* get ready to write */
+                handle->xdrs->x_op = XDR_ENCODE;
+
+                /* get info about chunked element */
+                if ((ret_value = HDget_special_info(var->aid, &info_block)) != FAIL)
+                  {   
+                      /* calcualte chunk size  */
+                      csize = 1;
+                      for (i = 0; i < info_block.ndims; i++)
+                          csize *= info_block.cdims[i];
+
+                      /* adjust for number type size */
+                      csize *= var->HDFsize;
+
+                      /* figure out if data needs to be converted */
+                      byte_count = csize;
+
+                      if (FAIL == (platntsubclass = DFKgetPNSC(var->HDFtype, DF_MT)))
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      if (DFKisnativeNT(var->HDFtype))
+                        {
+                            if (FAIL == (outntsubclass = DFKgetPNSC(var->HDFtype, DF_MT)))
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                        }
+                      else
+                        {
+                            outntsubclass = DFKislitendNT(var->HDFtype) ? DFNTF_PC : DFNTF_HDFDEFAULT;
+                        }
+
+                      convert = (uintn)(platntsubclass != outntsubclass);
+
+                      /* make sure our tmp buffer is big enough to hold everything */
+                      if(convert && tBuf_size < byte_count) 
+                        {
+                            if(tBuf != NULL) 
+                                HDfree(tBuf);
+                            tBuf_size = byte_count;
+                            tBuf      = HDmalloc(tBuf_size);
+                            if(tBuf == NULL) 
+                              {
+                                  tBuf_size = 0;
+                                  ret_value    = FAIL;
+                                  goto done;
+                              } /* end if */
+                        } /* end if */
+
+                      /* Write chunk out, */
+                      if(convert) 
+                        {
+#ifdef CHK_DEBUG
+        fprintf(stderr,"SDwritechunk: convert, var->HDFsize=%d, var->HDFtype=%d \n",
+                var->HDFsize, var->HDFtype);
+#endif
+                            /* convert it */
+                            if (FAIL == DFKconvert((VOIDP)datap, tBuf, var->HDFtype,
+                                                  (byte_count/var->HDFsize), DFACC_WRITE, 0, 0))
+                              {
+                                  ret_value    = FAIL;
+                                  goto done;
+                              } 
+
+                            /* write it out now */
+                            if ((ret_value = HMCwriteChunk(var->aid, origin, tBuf)) 
+                                != FAIL)
+                              {
+                                  ret_value = SUCCEED;
+                              }
+
+                            goto done; /* done */
+                        } /* end if */
+                      else 
+                        {
+                          if ((ret_value = HMCwriteChunk(var->aid, origin, datap)) 
+                              != FAIL)
+                            {
+                                ret_value = SUCCEED;
+                            }
+
+                          goto done; /* done */
+                        }
+                  } /* end if get special info block */
+            }
+          else /* not special CHUNKED */
+              ret_value = FAIL;
+      } /* end if Hinquire */
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    /* dont forget to free up info is special info block 
+       This space was allocated by the library */
+    if (info_block.cdims != NULL)
+        HDfree(info_block.cdims);
+
+    if (tBuf != NULL)
+        HDfree(tBuf);
+
+    return ret_value;
+} /* SDwritechunk() */
+
+/******************************************************************************
+ NAME
+     SDreadchunk   -- read the specified chunk to the SDS
+
+ DESCRIPTION
+     This routine reads a whole chunk of data from the chunked SDS
+     specified by chunk 'origin' for the given SDS and can be used
+     instead of SDreaddata() when this information is known. This
+     routine has less overhead and is much faster than using SDreaddata().
+
+     Origin specifies the co-ordinates of the chunk according to the chunk
+     position in the overall chunk array.
+
+     'datap' must point to a whole chunk of data.
+
+     See SDsetchunk() for a description of the organization of chunks in an SDS.
+
+     NOTE:
+         This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+ RETURNS
+        SUCCEED/FAIL
+
+ AUTHOR 
+       -GeorgeV
+******************************************************************************/
+intn 
+SDreadchunk(int32  sdsid,  /* IN: access aid to SDS */
+            int32 *origin, /* IN: origin of chunk to write */
+            void  *datap   /* IN/OUT: buffer for data */)
+{
+    CONSTR(FUNC, "SDreadchunk");    /* for HGOTO_ERROR */
+    NC        *handle = NULL;   /* file handle */
+    NC_var    *var    = NULL;   /* SDS variable */
+    int16      special;         /* Special code */
+    int32      csize;           /* phsical chunk size */
+    uint32     byte_count;      /* bytes to read */
+    int8       platntsubclass;  /* the machine type of the current platform */
+    int8       outntsubclass;   /* the data's machine type */
+    uintn      convert;         /* whether to convert or not */
+    comp_coder_t comp_type;
+    uint32  comp_config;
+    int32 status;
+    intn       i;
+    sp_info_block_t info_block; /* special info block */
+    uint32 tBuf_size = 0; /* conversion buffer size */
+    void  *tBuf = NULL; /* buffer used for conversion */
+    intn       ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    info_block.cdims = NULL;
+
+    /* Check args */
+    if (origin == NULL || datap == NULL)
+        HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    /* get file handle and verify it is an HDF file 
+       we only handle reading from SDS only not coordinate variables */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE || handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get variable from id */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* Dev note: empty SDS should have been checked here and SDreadchunk would
+       have failed, but since it wasn't, for backward compatibility, we won't
+       do it now either. -BMR 2011 */
+
+#ifdef added_by_mistake
+    /* Replaced this if statement by if (var->aid == FAIL) because it seemed
+       that hdf_get_vp_aid was called here by mistake (perhaps, copy/paste.)
+       For more info, see SVN log messages and bug HDFFR-171. -BMR, 2011/10 */
+
+    /* Check to see if data aid exists? i.e. may need to create a ref for SDS */
+    if(var->aid == FAIL && hdf_get_vp_aid(handle, var) == FAIL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+#endif
+
+    /* Check compression method is enabled */
+    status = HCPgetcomptype(handle->hdf_file, var->data_tag, var->data_ref,
+                &comp_type);
+
+    if (status != FAIL)
+	if (comp_type != COMP_CODE_NONE && comp_type != COMP_CODE_INVALID)
+      {
+	/* Must have decoder to read data */
+        HCget_config_info( comp_type , &comp_config);
+        if ((comp_config & COMP_DECODER_ENABLED) == 0) {
+	    /* decoder not present?? */
+	    HGOTO_ERROR(DFE_BADCODER, FAIL);
+          }
+      }
+
+    /* Need to get access id for the following calls */
+    if (var->aid == FAIL)
+    {
+	var->aid = Hstartread(handle->hdf_file, var->data_tag, var->data_ref);
+        if(var->aid == FAIL) /* catch FAIL from Hstartread */
+            HGOTO_ERROR(DFE_NOMATCH, FAIL);
+    }
+
+    /* inquire about element */
+    ret_value = Hinquire(var->aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {
+          if (special == SPECIAL_CHUNKED)
+            {  /* yes */
+                /* get ready to read */
+                handle->xdrs->x_op = XDR_DECODE;
+
+                /* get info about chunked element */
+                if ((ret_value = HDget_special_info(var->aid, &info_block)) != FAIL)
+                  {   
+                      /* calcualte chunk size  */
+                      csize = 1;
+                      for (i = 0; i < info_block.ndims; i++)
+                          csize *= info_block.cdims[i];
+
+                      /* adjust for number type size */
+                      csize *= var->HDFsize;
+
+                      /* figure out if data needs to be converted */
+                      byte_count = csize;
+
+                      if (FAIL == (platntsubclass = DFKgetPNSC(var->HDFtype, DF_MT)))
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+
+                      if (DFKisnativeNT(var->HDFtype))
+                        {
+                            if (FAIL == (outntsubclass = DFKgetPNSC(var->HDFtype, DF_MT)))
+                              {
+                                  ret_value = FAIL;
+                                  goto done;
+                              }
+                        }
+                      else
+                        {
+                            outntsubclass = DFKislitendNT(var->HDFtype) ? DFNTF_PC : DFNTF_HDFDEFAULT;
+                        }
+
+                      convert = (uintn)(platntsubclass != outntsubclass);
+
+                      /* make sure our tmp buffer is big enough to hold everything */
+                      if(convert && tBuf_size < byte_count) 
+                        {
+                            if(tBuf != NULL) 
+                                HDfree(tBuf);
+                            tBuf_size = byte_count;
+                            tBuf      = HDmalloc(tBuf_size);
+                            if(tBuf == NULL) 
+                              {
+                                  tBuf_size = 0;
+                                  ret_value = FAIL;
+                                  goto done;
+                              } /* end if */
+                        } /* end if */
+
+                      /* read chunk in */
+                      if(convert) 
+                        {
+#ifdef CHK_DEBUG
+        fprintf(stderr,"SDreadchunk: convert, var->HDFsize=%d, var->HDFtype=%d \n",
+                var->HDFsize, var->HDFtype);
+#endif
+                            /* read it in */
+                            if ((ret_value = HMCreadChunk(var->aid, origin, tBuf)) 
+                                != FAIL)
+                                {
+                                    /* convert chunk */
+                                    if (FAIL == DFKconvert(tBuf, datap, var->HDFtype,
+                                                         (byte_count/var->HDFsize), DFACC_READ, 0, 0))
+                                      {
+                                          ret_value = FAIL;
+                                          goto done;
+                                      }
+
+                                    ret_value = SUCCEED;
+                                }
+
+                            goto done; /* done */
+                        } /* end if */
+                      else 
+                        {
+                          if ((ret_value = HMCreadChunk(var->aid, origin, datap))
+                              != FAIL)
+                            {
+                              ret_value = SUCCEED;
+                            }
+
+                          goto done; /* done */
+                        }
+                  } /* end if get special info block */
+            }
+          else /* not special CHUNKED */
+              ret_value = FAIL;
+      } /* end if Hinquire */
+
+    /* End access to the access id */
+    if(Hendaccess(var->aid)==FAIL)
+        HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    var->aid = FAIL;
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+        /* End access to the aid if neccessary */
+        if (var->aid != FAIL)
+        {
+            Hendaccess(var->aid);
+            var->aid = FAIL;
+        }
+      }
+    /* Normal cleanup */
+    /* dont forget to free up info in special info block 
+       This space was allocated by the library */
+    if (info_block.cdims != NULL)
+        HDfree(info_block.cdims);
+
+    if (tBuf != NULL)
+        HDfree(tBuf);
+
+    return ret_value;
+} /* SDreadchunk() */
+
+/******************************************************************************
+NAME
+     SDsetchunkcache - maximum number of chunks to cache 
+
+DESCRIPTION
+     Set the maximum number of chunks to cache.
+
+     The cache contains the Least Recently Used(LRU cache replacment policy) 
+     chunks. This routine allows the setting of maximum number of chunks that 
+     can be cached, 'maxcache'.
+
+     The performance of the SDxxx interface with chunking is greatly
+     affected by the users access pattern over the dataset and by
+     the maximum number of chunks set in the chunk cache. The number chunks 
+     that can be set in the cache is process memory limited. It is a good 
+     idea to always set the maximum number of chunks in the cache as the 
+     default heuristic does not take into account the memory available for 
+     the application.
+
+     By default when the SDS is promoted to a chunked element the 
+     maximum number of chunks in the cache 'maxcache' is set to the number of
+     chunks along the last dimension.
+
+     The values set here affects the current SDS object's caching behaviour.
+
+     If the chunk cache is full and 'maxcache' is greater then the
+     current 'maxcache' value, then the chunk cache is reset to the new
+     'maxcache' value, else the chunk cache remains at the current
+     'maxcache' value.
+
+     If the chunk cache is not full, then the chunk cache is set to the
+     new 'maxcache' value only if the new 'maxcache' value is greater than the
+     current number of chunks in the cache.
+
+     Use flags argument of 'HDF_CACHEALL' if the whole object is to be cached 
+     in memory, otherwise pass in zero(0). Currently you can only
+     pass in zero.
+
+     See SDsetchunk() for a description of the organization of chunks in an SDS.
+     
+     NOTE:
+          This routine directly calls a Special Chunked Element fcn HMCxxx.
+
+RETURNS
+     Returns the 'maxcache' value for the chunk cache if successful 
+     and FAIL otherwise
+
+AUTHOR 
+      -GeorgeV
+******************************************************************************/
+intn
+SDsetchunkcache(int32 sdsid,     /* IN: access aid to mess with */
+                int32 maxcache,  /* IN: max number of chunks to cache */
+                int32 flags      /* IN: flags = 0, HDF_CACHEALL */)
+{
+    NC       *handle = NULL;        /* file handle */
+    NC_var   *var    = NULL;        /* SDS variable */
+    int16     special;              /* Special code */
+    intn      ret_value = SUCCEED;
+
+    /* clear error stack */
+    HEclear();
+
+    /* Check args */
+    if (maxcache < 1 )
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    if (flags != 0 && flags != HDF_CACHEALL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get file handle and verify it is an HDF file 
+       we only handle dealing with SDS only not coordinate variables */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL || handle->file_type != HDF_FILE || handle->vars == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get variable from id */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* Check to see if data aid exists? i.e. may need to create a ref for SDS */
+    if(var->aid == FAIL && hdf_get_vp_aid(handle, var) == FAIL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* inquire about element */
+    ret_value = Hinquire(var->aid, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &special);
+    if (ret_value != FAIL)
+      {
+          if (special == SPECIAL_CHUNKED)
+              ret_value = HMCsetMaxcache(var->aid, maxcache, flags); /* set cache*/
+          else
+              ret_value = FAIL;
+      }
+
+  done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDsetchunkcache() */
+
+
+/******************************************************************************
+ NAME
+	SDcheckempty -- checks whether an SDS is empty
+
+ DESCRIPTION
+    Given an sdsid, set the second parameter, emptySDS, to TRUE if the 
+    SDS has not been written with data, and FALSE, otherwise. 
+
+ RETURNS
+    SUCCEED/FAIL
+
+ PROGRAMMER
+    bmribler - 9-01-98
+        
+ MODIFICATION
+    bmribler - 9/29/2004
+        When the SDS is not a special element, we only need to check
+        its data ref# to decide whether it has data written, but
+        when the SDS is a special element, it still has a valid
+        data ref# even though it doesn't have data, we'll then need
+        to perform a more detailed check.  Added more detailed checks.
+
+******************************************************************************/
+int32
+SDcheckempty(int32 sdsid,  /* IN: dataset ID */
+	     intn  *emptySDS /* TRUE if SDS is empty */)
+{
+    CONSTR(FUNC, "SDcheckempty");	/* for HGOTO_ERROR */
+    NC     *handle = NULL;		/* file record struct */
+    NC_var *var = NULL;			/* variable record struct */
+    int32   ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDcheckempty: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* get the handle */
+    handle = SDIhandle_from_id(sdsid, SDSTYPE);
+    if(handle == NULL) 
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* get the variable */
+    var = SDIget_var(handle, sdsid);
+    if(var == NULL)
+      {
+        ret_value = FAIL;
+        goto done;
+      }
+
+    /* assume that the SDS is not empty until proving otherwise */
+    *emptySDS = FALSE;
+
+    /* if the data ref# of the SDS is 0, it indicates that the SDS has 
+	not been written with data because no storage is created 
+	for the SDS data */
+    if (var->data_ref == 0)
+    {
+        *emptySDS = TRUE;
+    }
+    else
+    { /* data_ref is not 0, so must check on special SDSs to determine if
+	 the SDS is empty */
+	/* check for unlimited dimension, assuming that unlimited dimension is
+	   still not allowed with other specialness, according to GeorgeV */
+	if (var->shape != NULL && var->shape[0] == NC_UNLIMITED)
+	{
+	    /* if data has been written, var->numrecs will show the size 
+	       of the unlimited dimension */
+	    if(var->numrecs <= 0)
+		*emptySDS = TRUE;
+	}
+	/* handle other specialness via lower level functions */
+	else
+	{
+	    ret_value = HDcheck_empty(handle->hdf_file, var->data_tag, 
+				      var->data_ref, emptySDS);
+	    if (ret_value == FAIL) HGOTO_ERROR(DFE_INTERNAL, FAIL);
+	}
+    } /* var->data_ref != 0 */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* SDcheckempty */
+
+/******************************************************************************
+ NAME
+	SDidtype -- returns the type of an id
+
+ DESCRIPTION
+    Given an id, return its type, which is either an SD id, an SDS id, or
+    a dimension id, or indicate that it is not a valid SD API id.
+
+ RETURNS
+    A value of type hdf_idtype_t, which can be either of the following:
+    SD_ID, SDS_ID, DIM_ID, NOT_SDAPI_ID.
+
+ PROGRAMMER
+    bmribler - 1-19-2005
+        
+ MODIFICATION
+
+******************************************************************************/
+hdf_idtype_t
+SDidtype(int32 an_id)
+{
+    NC     *handle = NULL;	/* file record struct */
+    hdf_idtype_t ret_value = NOT_SDAPI_ID;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDidtype: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* Assuming that the id is an SD id, get and check the handle */
+    handle = SDIhandle_from_id(an_id, CDFTYPE);
+
+    /* If it is, indicate so */
+    if(handle != NULL)
+	ret_value = SD_ID;
+
+    /* otherwise, check further... */
+    else
+    {
+	/* Assuming that it is an SDS id, get and check the handle */
+	handle = SDIhandle_from_id(an_id, SDSTYPE);
+
+	/* If it is, indicate so */
+	if(handle != NULL)
+            ret_value = SDS_ID;
+
+	/* otherwise, check if it is a dimension id, or just not valid */
+	else
+	{
+            handle = SDIhandle_from_id(an_id, DIMTYPE);
+            if(handle != NULL)
+		ret_value = DIM_ID;
+	    else
+		ret_value = NOT_SDAPI_ID;
+        }
+    }
+    return ret_value;
+} /* SDidtype */
+
+/******************************************************************************
+ NAME
+	SDreset_maxopenfiles -- resets the maximum number of files can be
+				opened at a time.
+
+ DESCRIPTION
+    Uses NC local function NC_reset_maxopenfiles to change the maximum 
+    number of opened files allowed.  This involves re-allocating of the 
+    internal cdf list.
+
+ RETURNS
+    The current maximum number of opened files allowed, or FAIL, if 
+    unable to reset it.
+
+ PROGRAMMER
+    bmribler - 9-06-2005
+        
+ MODIFICATION
+
+******************************************************************************/
+intn
+SDreset_maxopenfiles(intn req_max)
+{
+    CONSTR(FUNC, "SDreset_maxopenfiles");	/* for HGOTO_ERROR */
+    intn ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDreset_maxopenfiles: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* Reset the max NC open and re-allocate cdf list appropriately */
+    ret_value = NC_reset_maxopenfiles(req_max);
+
+    if (ret_value == 0)
+	/* no successful allocation */
+	HGOTO_ERROR(DFE_NOSPACE, FAIL);  /* must change DFE_NOSPACE to something else, if the other case of returning 0 exists??? */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* SDreset_maxopenfiles */
+
+/******************************************************************************
+ NAME
+	SDget_maxopenfiles -- retrieves the current number of opened files
+			      allowed in HDF and the maximum number of opened 
+			      files allowed on a system.
+
+ DESCRIPTION
+    Uses NC_get_maxopenfiles.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ PROGRAMMER
+    bmribler - 9-06-2005
+        
+ MODIFICATION
+
+******************************************************************************/
+intn
+SDget_maxopenfiles(intn *curr_max,  /* OUT: current # of open files allowed */
+		   intn *sys_limit) /* OUT: max # of open files allowed on 
+					a system */
+{
+    CONSTR(FUNC, "SDget_maxopenfiles");	/* for HGOTO_ERROR */
+    intn ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDget_maxopenfiles: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* Retrieve the current max and the system limit */
+    if (curr_max != NULL)
+    {
+	*curr_max = NC_get_maxopenfiles();
+	if (*curr_max == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+    if (sys_limit != NULL)
+    {
+	*sys_limit = NC_get_systemlimit();
+	if (*sys_limit == FAIL)
+	    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+    }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+    return ret_value;
+} /* SDget_maxopenfiles */
+
+/******************************************************************************
+ NAME
+	SDget_numopenfiles -- returns the number of files currently being 
+			      opened.
+
+ DESCRIPTION
+    Uses NC_get_numopencdfs.
+
+ RETURNS
+    The number of files currently being opened or FAIL.
+
+ PROGRAMMER
+    bmribler - 9-06-2005
+        
+ MODIFICATION
+
+******************************************************************************/
+intn
+SDget_numopenfiles()
+{
+    intn ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDget_numopenfiles: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    ret_value = (intn)NC_get_numopencdfs();
+    return ret_value;
+} /* SDget_numopenfiles */
+
+/******************************************************************************
+ NAME
+	SDgetfilename -- retrieves the name of the file given its ID.
+
+ DESCRIPTION
+    Given an ID to a file, returns its name via parameter 'filename.'
+    The user is repsonsible for allocating sufficient space to hold
+    the file name.  It can be at most H4_MAX_NC_NAME characters in 
+    length.
+
+ RETURNS
+    Length of the file name, without '\0', on success, and FAIL, otherwise.
+
+ PROGRAMMER
+    bmribler - 9-06-2005
+        
+ MODIFICATION
+
+******************************************************************************/ 
+intn
+SDgetfilename(int32 fid,       /* IN:  file ID */
+              char  *filename  /* OUT: name of the file */)
+{
+    CONSTR(FUNC, "SDgetfilename");    /* for HGOTO_ERROR */
+    NC     *handle = NULL;
+    intn    len;
+    intn    ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetfilename: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* check that fid is valid */
+    handle = SDIhandle_from_id(fid, CDFTYPE);
+    if(handle == NULL)
+	HGOTO_ERROR(DFE_ARGS, FAIL);
+
+    len = HDstrlen(handle->path);
+    if(filename != NULL) 
+    {
+        HDmemcpy(filename, handle->path, len);
+        filename[len] = '\0';
+    }
+    ret_value = len;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDgetfilename */
+
+/******************************************************************************
+ NAME
+	SDgetnamelen -- retrieves the length of the name of a file, a dataset,
+			or a dimension.
+
+DESCRIPTION
+    Given an id, retrieves the length of its name.
+
+RETURNS
+   SUCCEED/FAIL
+
+ PROGRAMMER
+    bmribler - 9-14-2006
+        
+ MODIFICATION
+
+******************************************************************************/ 
+intn
+SDgetnamelen(int32 id,		/* IN:  object ID */
+             uint16 *name_len	/* OUT: buffer for name's length */)
+{
+    CONSTR(FUNC, "SDgetnamelen");    /* for HGOTO_ERROR */
+    NC     *handle = NULL;
+    NC_var *var = NULL;
+    NC_dim *dim = NULL;
+    intn   ret_value = SUCCEED;
+
+#ifdef SDDEBUG
+    fprintf(stderr, "SDgetnamelen: I've been called\n");
+#endif
+
+    /* clear error stack */
+    HEclear();
+
+    /* Assuming that the id is an SD id, get the file handle */
+    handle = SDIhandle_from_id(id, CDFTYPE);
+
+    /* If it is, obtain the file name's length */
+    if(handle != NULL)
+	*name_len = (uint16)HDstrlen(handle->path);
+
+    /* otherwise, check further... */
+    else
+    {
+	/* Assuming that it is an id of an SDS, get its file handle */
+	handle = SDIhandle_from_id(id, SDSTYPE);
+
+	/* If it is, get the NC_var record, and obtain the SDS name's length */
+	if(handle != NULL)
+	{
+	    var = SDIget_var(handle, id);
+	    if(var == NULL)
+		HGOTO_ERROR(DFE_ARGS, FAIL);
+	    *name_len = (uint16)var->name->len;
+	}
+
+	/* otherwise, check if it is a dimension id, or just not valid */
+	else
+	{
+            handle = SDIhandle_from_id(id, DIMTYPE);
+            if(handle != NULL)
+	    {
+		dim = SDIget_dim(handle, id);
+		if(dim == NULL) 
+		    HGOTO_ERROR(DFE_ARGS, FAIL);
+		*name_len = (uint16)dim->name->len;
+	    }
+	    else	/* invalid id */
+		HGOTO_ERROR(DFE_ARGS, FAIL);
+        }
+    }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+    /* Normal cleanup */
+
+    return ret_value;
+} /* SDgetnamelen */
+
+#endif /* HDF */
diff --git a/mfhdf/libsrc/netcdf.h.in b/mfhdf/libsrc/netcdf.h.in
new file mode 100644
index 0000000..13f1af3
--- /dev/null
+++ b/mfhdf/libsrc/netcdf.h.in
@@ -0,0 +1,579 @@
+/* Generated automatically from netcdf.h.in by configure. */
+/*
+ *	Copyright 1993, University Corporation for Atmospheric Research
+ *
+ *  Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies, that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of UCAR/Unidata not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission.  UCAR makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.  It is
+ * provided with no support and without obligation on the part of UCAR
+ * Unidata, to assist in its use, correction, modification, or enhancement.
+ *
+ */
+/* "$Id: netcdf.h.in 6036 2014-01-20 17:28:01Z acheng $" */
+
+#ifndef _NETCDF_
+#define _NETCDF_
+
+#include "H4api_adpt.h"
+
+/*
+ * The definitions ncvoid, USE_ENUM, and MAX_NC_OPEN, may need to be set
+ * properly for your installation.
+ */
+
+/*
+ * Argument type in user functions (deprecated, backward compatibility)
+ */
+#ifndef UD_NO_VOID
+#define ncvoid    void
+#else
+/* system doesn't have void type */
+#define ncvoid    char
+#endif
+
+
+/*
+ *   If xdr_enum works properly on your system, you can define 
+ * USE_ENUM so that nc_type is an enum. 
+ * Otherwise, delete this definition so that the nc_type is
+ * an int and the valid values are #defined.
+ */
+#ifndef __APPLE__
+/* xdr_enum does not work properly for Mac Lion using the Apple GCC compiler
+i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
+ */
+/* Do not use it for all Macs for now. See ticket HDFFR-1318. */
+/* So define USE_ENUM only if this is not an APPLE. */
+#define USE_ENUM
+#endif
+
+
+/*
+ * The following macro is provided for backward compatibility only.  If you
+ * are a new user of netCDF, then you may safely ignore it.  If, however,
+ * you have an existing archive of netCDF files that use default
+ * floating-point fill values, then you should know that the definition of
+ * the default floating-point fill values changed with version 2.3 of the
+ * netCDF package.  Prior to this release, the default floating-point fill
+ * values were not very portable:  their correct behavior depended not only
+ * upon the particular platform, but also upon the compilation
+ * environment.  This led to the definition of new, default floating-point
+ * fill values that are portable across all platforms and compilation
+ * environments.  If you wish, however, to obtain the old, non-portable
+ * floating-point fill values, then the following macro should have a true
+ * value PRIOR TO BUILDING THE netCDF LIBRARY.
+ *
+ * Implementation details are contained in the section below on fill values.
+ */
+#define NC_OLD_FILLVALUES	0
+
+/*
+ * 	Fill values
+ * These values are stuffed into newly allocated space as appropriate.
+ * The hope is that one might use these to notice that a particular datum
+ * has not been set.
+ */
+
+#define FILL_BYTE	((char)-127)		/* Largest Negative value */
+#define FILL_CHAR	((char)0)
+#define FILL_SHORT	((short)-32767)
+#define FILL_LONG	((long)-2147483647)
+
+#if !NC_OLD_FILLVALUES
+
+#   define FILL_FLOAT	9.9692099683868690e+36 /* near 15 * 2^119 */
+#   define FILL_DOUBLE	9.9692099683868690e+36
+
+#else	/* NC_OLD_FILLVALUES below */
+
+/*
+ * This section is provided for backward compatibility only.  Using
+ * XDR infinities for floating-point fill values has caused more problems
+ * than it has solved.  We encourage you to define your own data-specific
+ * fill values rather than use default ones (see `_FillValue' below).
+ * If, however, you *must* use default fill values, then you should use
+ * the above fill values rather than the ones in this section.
+ */
+
+/*
+ * XDR_F_INFINITY is a float value whose EXTERNAL (xdr)
+ * represention is ieee floating infinity.
+ * XDR_D_INFINITY is a double value whose EXTERNAL (xdr)
+ * represention is ieee double floating point infinity.
+ * These are used as default fill values below.
+ *
+ * This section shows three techniques for setting these:
+ *  Direct assignment (vax, cray) - works for non IEEE machines
+ *		Doesn't work when IEEE machines don't allow
+ *      float or double constants whose values are infinity.
+ *  Use of a union (preferred portable method) - should work on
+ *      any ANSI compiler with IEEE floating point representations,
+ *      modulo byte order and sizeof() considerations.
+ *  Use of pointer puns - may work with many older compilers
+ *      which don't allow intialization of unions.
+ *      Often doesn't work with compilers which have strict
+ *      alignment rules.
+ */ 
+
+    /* Direct assignment. All cases should be mutually exclusive */
+
+#ifdef notdef /* you might want to try these, on an IEEE machine */
+#define XDR_D_INFINITY	1.797693134862315900e+308
+#define XDR_F_INFINITY	3.40282357e+38
+#endif
+
+#ifdef __STDC__
+    /* Use of a union, assumes IEEE representation and 1 byte unsigned char */
+
+#ifndef    XDR_D_INFINITY
+#define USE_D_UNION
+     union xdr_d_union {unsigned char bb[8]; double dd;} ;
+     extern union xdr_d_union xdr_d_infs ;  /* instantiated in array.c */
+#define XDR_D_INFINITY    (xdr_d_infs.dd)
+#endif /* !XDR_D_INFINITY */
+
+#ifndef    XDR_F_INFINITY
+#define USE_F_UNION
+     union xdr_f_union {unsigned char bb[4]; float ff;} ;
+     extern union xdr_f_union xdr_f_infs ;  /* instantiated in array.c */
+#define  XDR_F_INFINITY    (xdr_f_infs.ff)
+#endif /* !XDR_F_INFINITY */
+
+
+#else /* __STDC__ */
+    /* Use of a pointer pun, assumes IEEE representation, 4 byte long */
+
+#ifndef    XDR_D_INFINITY
+#define USE_D_LONG_PUN
+     extern long xdr_d_infinity[] ;  /* instantiated in array.c */
+#define XDR_D_INFINITY *(double *)xdr_d_infinity
+#endif /* !XDR_D_INFINITY */
+
+#ifndef    XDR_F_INFINITY
+#define USE_F_LONG_PUN
+     extern long xdr_f_infinity ;  /* instantiated in array.c */
+#define XDR_F_INFINITY *((float *)&xdr_f_infinity)
+#endif /* !XDR_F_INFINITY */
+
+#endif /* __STDC__ */
+
+/* End of INFINITY           section */
+
+#define FILL_FLOAT	XDR_F_INFINITY	/* IEEE Infinity */
+#define FILL_DOUBLE	XDR_D_INFINITY
+
+#endif	/* NC_OLD_FILLVALUES above */
+
+
+/*
+ *  masks for the struct NC flags field; passed in as 'mode' arg to
+ * nccreate and ncopen.
+ *
+ */
+#define NC_RDWR  1		/* read/write, 0 => readonly */
+#define NC_CREAT 2		/* in create phase, cleared by ncendef */
+#define NC_EXCL  4		/* on create, don't destroy existing file */
+#define NC_INDEF 8		/* in define mode, cleared by ncendef */
+#define NC_NSYNC 0x10	/* synchronise numrecs on change */
+#define NC_HSYNC 0x20	/* synchronise whole header on change */
+#define NC_NDIRTY 0x40	/* numrecs has changed */
+#define NC_HDIRTY 0x80  /* header info has changed */
+#define NC_NOFILL 0x100	/* Don't fill vars on endef and increase of record */
+#define NC_LINK 0x8000	/* isa link */
+
+#define NC_FILL 0	/* argument to ncsetfill to clear NC_NOFILL */
+
+/*
+ * 'mode' arguments for nccreate and ncopen
+ */
+#define NC_NOWRITE   0
+#define NC_WRITE     NC_RDWR
+#define NC_CLOBBER   (NC_INDEF | NC_CREAT | NC_RDWR)
+#define NC_NOCLOBBER (NC_INDEF | NC_EXCL | NC_CREAT | NC_RDWR)
+
+/*
+ * 'size' argument to ncdimdef for an unlimited dimension
+ */
+#define NC_UNLIMITED 0L
+
+/*
+ * attribute id to put/get a global attribute
+ */
+#define NC_GLOBAL -1
+
+#ifndef HDF
+/*
+ * This can be as large as the maximum number of stdio streams
+ * you can have open on your system.
+ */
+#define MAX_NC_OPEN 32
+
+/*
+ * These maximums are enforced by the interface, to facilitate writing
+ * applications and utilities.  However, nothing is statically allocated to
+ * these sizes internally.
+ */
+#define MAX_NC_DIMS 5000	 /* max dimensions per file */
+#define MAX_NC_ATTRS 3000	 /* max global or per variable attributes */
+#define MAX_NC_VARS 5000	 /* max variables per file */
+#define MAX_NC_NAME 256		 /* max length of a name */
+#define MAX_VAR_DIMS 32          /* max per variable dimensions */
+
+/*
+ * Added feature. 
+ * If you wish a variable to use a different value than the above
+ * defaults, create an attribute with the same type as the variable
+ * and the following reserved name. The value you give the attribute
+ * will be used as the fill value for that variable.
+ */
+#define _FillValue	"_FillValue"
+
+#else /* HDF */
+
+#include "hlimits.h"  /* Hard coded constants for HDF library */
+
+#endif /* HDF */
+
+#ifdef USE_ENUM
+/*
+ *  The netcdf data types
+ */
+typedef enum {
+	NC_UNSPECIFIED, /* private */
+	NC_BYTE,
+	NC_CHAR,
+	NC_SHORT,
+	NC_LONG,
+	NC_FLOAT,
+	NC_DOUBLE,
+	/* private */
+	NC_BITFIELD,
+	NC_STRING,
+	NC_IARRAY,
+	NC_DIMENSION,
+	NC_VARIABLE,
+	NC_ATTRIBUTE
+} nc_type ;
+#else
+typedef int nc_type ;
+#define	NC_UNSPECIFIED 0 /* private */
+#define	NC_BYTE 1
+#define	NC_CHAR 2
+#define	NC_SHORT 3
+#define	NC_LONG 4
+#define	NC_FLOAT 5
+#define	NC_DOUBLE 6
+	/* private */
+#define	NC_BITFIELD 7
+#define	NC_STRING 8
+#define	NC_IARRAY 9
+#define	NC_DIMENSION 10
+#define	NC_VARIABLE 11
+#define	NC_ATTRIBUTE 12
+#endif
+
+
+/*
+ * C data types corresponding to netCDF data types:
+ */
+/* Don't use these or the C++ interface gets confused
+typedef char  ncchar;
+typedef char  ncbyte;
+typedef short ncshort;
+typedef float ncfloat;
+typedef double        ncdouble;
+*/
+
+/* 
+ * Variables/attributes of type NC_LONG should use the C type 'nclong'
+ */
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+/*
+ * LP64 (also known as 4/8/8) denotes long and pointer as 64 bit types.
+ * http://www.unix.org/version2/whatsnew/lp64_wp.html
+ */
+typedef int     nclong;   
+#else
+typedef long    nclong;         /* default, compatible type */
+#endif
+
+
+/*
+ * Global netcdf error status variable
+ *  Initialized in error.c
+ */
+#define	NC_NOERR	0	/* No Error */
+#define	NC_EBADID	1	/* Not a netcdf id */
+#define	NC_ENFILE	2	/* Too many netcdfs open */
+#define	NC_EEXIST	3	/* netcdf file exists && NC_NOCLOBBER */
+#define	NC_EINVAL	4	/* Invalid Argument */
+#define	NC_EPERM	5	/* Write to read only */
+#define	NC_ENOTINDEFINE	6	/* Operation not allowed in data mode */
+#define	NC_EINDEFINE	7	/* Operation not allowed in define mode */
+#define	NC_EINVALCOORDS	8	/* Coordinates out of Domain */
+#define	NC_EMAXDIMS	9	/* MAX_NC_DIMS exceeded */
+#define	NC_ENAMEINUSE	10	/* String match to name in use */
+#define NC_ENOTATT	11	/* Attribute not found */
+#define	NC_EMAXATTS	12	/* MAX_NC_ATTRS exceeded */
+#define NC_EBADTYPE	13	/* Not a netcdf data type */
+#define NC_EBADDIM	14	/* Invalid dimension id */
+#define NC_EUNLIMPOS	15	/* NC_UNLIMITED in the wrong index */
+#define	NC_EMAXVARS	16	/* MAX_NC_VARS exceeded */
+#define NC_ENOTVAR	17	/* Variable not found */
+#define NC_EGLOBAL	18	/* Action prohibited on NC_GLOBAL varid */
+#define NC_ENOTNC	19	/* Not a netcdf file */
+#define NC_ESTS         20      /* In Fortran, string too short */
+#define NC_EMAXNAME     21      /* MAX_NC_NAME exceeded */
+#define NC_ENTOOL       NC_EMAXNAME   /* Backward compatibility */
+#define NC_EUNLIMIT     22      /* NC_UNLIMITED size already in use */
+
+#define	NC_EXDR		32	/* */
+#define	NC_SYSERR	-1
+
+#include "hdf2netcdf.h"
+HDFLIBAPI int ncerr ;
+
+/*
+ * Global options variable. Used to determine behavior of error handler.
+ *  Initialized in lerror.c
+ */
+#define	NC_FATAL	1
+#define	NC_VERBOSE	2
+
+HDFLIBAPI int ncopts ;	/* default is (NC_FATAL | NC_VERBOSE) */
+
+#ifndef HAVE_PROTOTYPES
+#   if defined(__STDC__) || defined(__GNUC__) || defined(__cplusplus) || defined(c_plusplus)
+#       define	HAVE_PROTOTYPES
+#   endif
+#endif
+
+#undef PROTO
+#ifdef HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+HDFLIBAPI int nccreate	PROTO((
+    const char*	path,
+    int		cmode
+));
+HDFLIBAPI int ncopen	PROTO((
+    const char*	path,
+    int		mode
+));
+HDFLIBAPI int ncredef	PROTO((
+    int		cdfid
+));
+HDFLIBAPI int ncendef	PROTO((
+    int		cdfid
+));
+HDFLIBAPI int ncclose	PROTO((
+    int		cdfid
+));
+HDFLIBAPI int ncinquire	PROTO((
+    int		cdfid,
+    int*	ndims,
+    int*	nvars,
+    int*	natts, 
+    int*	recdim
+));
+HDFLIBAPI int ncsync	PROTO((
+    int		cdfid
+));
+HDFLIBAPI int ncabort	PROTO((
+    int		cdfid
+));
+HDFLIBAPI int ncnobuf	PROTO((
+    int		cdfid
+));
+HDFLIBAPI int ncdimdef	PROTO((
+    int		cdfid,
+    const char*	name,
+    long	length
+));
+HDFLIBAPI int ncdimid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+HDFLIBAPI int ncdiminq	PROTO((
+    int		cdfid,
+    int		dimid,
+    char*	name,
+    long*	length
+));
+HDFLIBAPI int ncdimrename	PROTO((
+    int		cdfid,
+    int		dimid,
+    const char*	name
+));
+HDFLIBAPI int ncvardef	PROTO((
+    int		cdfid,
+    const char*	name,
+    nc_type	datatype, 
+    int		ndims,
+    const int*	dim
+));
+HDFLIBAPI int ncvarid	PROTO((
+    int		cdfid,
+    const char*	name
+));
+HDFLIBAPI int ncvarinq	PROTO((
+    int		cdfid,
+    int		varid,
+    char*	name,
+    nc_type*	datatype,
+    int*	ndims,
+    int*	dim,
+    int*	natts
+));
+HDFLIBAPI int ncvarput1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    const void*	value
+));
+HDFLIBAPI int ncvarget1	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	coords,
+    void*	value
+));
+HDFLIBAPI int ncvarput	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+HDFLIBAPI int ncvarget	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count, 
+    void*	value
+));
+HDFLIBAPI int ncvarputs	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+HDFLIBAPI int ncvargets	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    void*	values
+));
+HDFLIBAPI int ncvarputg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void* values
+));
+HDFLIBAPI int ncvargetg	PROTO((
+    int		cdfid,
+    int		varid,
+    const long*	start,
+    const long*	count,
+    const long*	stride,
+    const long*	imap,
+    void*	values
+));
+HDFLIBAPI int ncvarrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+HDFLIBAPI int ncattput	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type	datatype,
+    int		len,
+    const void*	value
+));
+HDFLIBAPI int ncattinq	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    nc_type*	datatype,
+    int*	len
+));
+HDFLIBAPI int ncattget	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    void*	value
+));
+HDFLIBAPI int ncattcopy	PROTO((
+    int		incdf,
+    int		invar,
+    const char*	name, 
+    int		outcdf,
+    int		outvar
+));
+HDFLIBAPI int ncattname	PROTO((
+    int		cdfid,
+    int		varid,
+    int		attnum,
+    char*	name
+));
+HDFLIBAPI int ncattrename	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name, 
+    const char*	newname
+));
+HDFLIBAPI int ncattdel	PROTO((
+    int		cdfid,
+    int		varid,
+    const char*	name
+));
+HDFLIBAPI int nctypelen	PROTO((
+    nc_type	datatype
+));
+HDFLIBAPI int ncsetfill	PROTO((
+    int		cdfid,
+    int		fillmode
+));
+HDFLIBAPI int ncrecinq		PROTO((
+    int		cdfid,
+    int*	nrecvars,
+    int*	recvarids,
+    long*	recsizes
+));
+HDFLIBAPI int ncrecget		PROTO((
+    int		cdfid,
+    long	recnum,
+    void**	datap
+));
+HDFLIBAPI int ncrecput		PROTO((
+    int		cdfid,
+    long	recnum,
+    void* * datap
+));
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NETCDF_ */
diff --git a/mfhdf/libsrc/nssdc.c b/mfhdf/libsrc/nssdc.c
new file mode 100644
index 0000000..213aded
--- /dev/null
+++ b/mfhdf/libsrc/nssdc.c
@@ -0,0 +1,902 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "local_nc.h"
+#ifdef HDF
+#include "hfile.h"
+
+/* constants/macros pulled out of the CDF library source */
+#define V2_CDR_OFFSET     8
+#define VDRzVDR_RFUe_LEN  128
+#define CDF_VAR_NAME_LEN  64
+#define CDF_ATTR_NAME_LEN 64
+#define CDF_FORMAT_BIT    1       /* format: set = single file,
+                                           clear = multi file */
+
+#define rVAR_RECVARY_BIT        0       /* record variance:
+                                             set = VARY,
+                                             clear = NOVARY */
+#define rVAR_PADVALUE_BIT       1       /* pad value:
+                                             set = specified,
+                                             clear = not specified (use
+                                                     default) */
+#define zVAR_RECVARY_BIT        0       /* record variance:
+                                             set = VARY,
+                                             clear = NOVARY */
+#define zVAR_PADVALUE_BIT       1       /* pad value:
+                                             set = specified,
+                                             clear = not specified (use
+                                                     default) */
+
+#define bitset(a,bit)     (a & (1 << bit))
+#define CDF_INT1     (long) 1
+#define CDF_INT2     (long) 2
+#define CDF_INT4     (long) 4
+
+#define CDF_UINT1    (long) 11
+#define CDF_UINT2    (long) 12
+#define CDF_UINT4    (long) 14
+
+#define CDF_REAL4    (long) 21
+#define CDF_REAL8    (long) 22
+
+#define CDF_EPOCH    (long) 31                  /* NSSDC standard */
+
+#define CDF_BYTE     (long) 41                  /* same as CDF_INT1 (signed) */
+#define CDF_FLOAT    (long) 44                  /* same as CDF_REAL4 */
+#define CDF_DOUBLE   (long) 45                  /* same as CDF_REAL8 */
+
+#define CDF_CHAR     (long) 51                  /* a "string" data type */
+#define CDF_UCHAR    (long) 52                  /* a "string" data type */
+
+#define NETWORK_ENCODING        1L
+#define SUN_ENCODING            2L
+#define VAX_ENCODING            3L
+#define DECSTATION_ENCODING     4L
+#define SGi_ENCODING            5L
+#define IBMPC_ENCODING          6L
+#define IBMRS_ENCODING          7L
+#define HOST_ENCODING           8L
+#define HP_ENCODING             11L
+#define NeXT_ENCODING           12L
+#define ALPHAOSF1_ENCODING      13L
+#define ALPHAVMSd_ENCODING      14L
+#define ALPHAVMSg_ENCODING      15L
+
+
+/* ---------------------------- cdf_unmap_type ---------------------------- */
+/*
+  UnMap a data type.  I.e. go from a CDF type to an NC_<type>
+*/
+nc_type
+  cdf_unmap_type(type)
+int type;
+{
+
+    switch(type & 0xff) {
+    case CDF_CHAR        :
+    case CDF_UCHAR       :
+        return NC_CHAR;
+    case CDF_BYTE        :
+    case CDF_INT1        :
+    case CDF_UINT1       :
+        return NC_BYTE;
+    case CDF_INT2        :
+    case CDF_UINT2       :
+        return NC_SHORT;
+    case CDF_INT4        :
+    case CDF_UINT4       :
+        return NC_LONG;
+    case CDF_REAL4       : 
+    case CDF_FLOAT       :
+        return NC_FLOAT; 
+    case CDF_REAL8       : 
+    case CDF_DOUBLE      :
+    case CDF_EPOCH       :
+        return NC_DOUBLE;
+    default:
+        return (nc_type) FAIL;	/* need to return a better (legal) value */
+  }
+
+} /* cdf_unmap_type */
+
+/* ---------------------------- nssdc_read_cdf ---------------------------- */
+/*
+  Read a NC structure out of a CDF file
+*/
+bool_t
+nssdc_read_cdf(xdrs, handlep)
+     XDR *  xdrs;
+     NC  ** handlep;
+{
+
+    NC     * handle;
+    uint8    buffer[1000];
+    uint8  * b;
+    int32    dummy;
+    static const char   * FUNC = "nssdc_read_cdf";
+    hdf_file_t fp;
+    intn     i, j;
+    int32    rank, current_var, current_dim, hdftype;
+    nc_type  nctype;
+    intn     dims[H4_MAX_VAR_DIMS];
+    int32    dim_sz[H4_MAX_VAR_DIMS];
+    NC_dim * dim_rec[H4_MAX_VAR_DIMS];
+    NC_var * vars[H4_MAX_NC_VARS];
+    NC_var * var = NULL;    /* shorthand for vars[current_var] */
+    vix_t  * end;
+
+    /* interesting stuff in CDR record */
+    int32   gdrOffset, vers, release, encoding, flags, inc;
+
+    /* interesting stuff in GDR record */
+    int32   varNext, zVarNext, adrNext, numRVars, numAttrs, maxRec;
+    int32   numDims, numZVars;
+
+    /* interesting stuff in VDR record */
+    int32   nt, vMaxRec, vxrNext, VXRtail, vFlags, numElem, num;
+    char    name[CDF_VAR_NAME_LEN + 1];
+
+    /* interesting stuff in ADR record */
+    int32   scope, aedrNext, aedzNext;
+
+    /* interesting stuff in AEDR record */
+    int32   count;
+
+#if DEBUG
+    fprintf(stderr, "nssdc_read_cdf i've been called\n");
+#endif
+
+    handle = (*handlep);
+    fp = handle->cdf_fp;
+    current_var = 0;
+
+    /* 
+     * pull in the CDR and see what we want out of it 
+     */
+    if (HI_SEEK(fp, V2_CDR_OFFSET) == FAIL)
+        HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+    
+    if (HI_READ(fp, buffer, 12 * sizeof(int32)) == FAIL)
+       HRETURN_ERROR(DFE_READERROR,FALSE);
+
+    b = buffer;
+    INT32DECODE(b, dummy);      /* record size */
+    INT32DECODE(b, dummy);      /* record type */
+    INT32DECODE(b, gdrOffset);  /* offset of GDR record */
+    INT32DECODE(b, vers);       /* version number */
+    INT32DECODE(b, release);    /* release number */
+    INT32DECODE(b, encoding);   /* type of encoding */
+    INT32DECODE(b, flags);      /* special flags (uint32????) */
+    INT32DECODE(b, dummy);      /* rfuA */
+    INT32DECODE(b, dummy);      /* rfuB */
+    INT32DECODE(b, inc);        /* increment - do we care?? */
+    INT32DECODE(b, dummy);      /* rfuD */
+    INT32DECODE(b, dummy);      /* rfuE */
+
+    /*
+     * Only handle single file implementations for now
+     */
+    if(!bitset(flags, CDF_FORMAT_BIT)) {
+#ifdef DEBUG
+        fprintf(stderr, "We are only able to handle single-file CDFs.  Sorry.\n");
+#endif
+        return (FALSE);
+    }
+
+    /* Check the encoding */
+    if((encoding != NETWORK_ENCODING) &&
+       (encoding != SUN_ENCODING)     && 
+       (encoding != SGi_ENCODING)     &&      
+       (encoding != IBMRS_ENCODING)   && 
+       (encoding != HP_ENCODING)) {
+#ifdef DEBUG
+        fprintf(stderr, "We are only able to handle IEEE encoded files.  Sorry.\n");
+#endif
+        return (FALSE);
+    }
+       
+    /* 
+     * pull in the GDR and see what we want out of it 
+     */
+    if (HI_SEEK(fp, gdrOffset) == FAIL)
+        HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+    
+    if (HI_READ(fp, buffer, 15 * sizeof(int32)) == FAIL)
+       HRETURN_ERROR(DFE_READERROR,FALSE);
+
+    b = buffer;
+    INT32DECODE(b, dummy);      /* record size */
+    INT32DECODE(b, dummy);      /* record type */
+    INT32DECODE(b, varNext);    /* start of next R variable */
+    INT32DECODE(b, zVarNext);   /* start of Zvariables */
+    INT32DECODE(b, adrNext);    /* start of attributes */
+    INT32DECODE(b, dummy);      /* eof */
+    INT32DECODE(b, numRVars);   /* number of R variables */
+    INT32DECODE(b, numAttrs);   /* number of attributes */
+    INT32DECODE(b, maxRec);     /* dunno */
+    INT32DECODE(b, numDims);    /* number of dimensions */
+    INT32DECODE(b, numZVars);   /* number of Z variables */
+    INT32DECODE(b, dummy);      /* rfuB */
+    INT32DECODE(b, dummy);      /* rfuC */
+    INT32DECODE(b, dummy);      /* rfuD */
+    INT32DECODE(b, dummy);      /* rfuE */
+
+    /* 
+     * dimension sizes are here 
+     */
+    if(numDims > H4_MAX_VAR_DIMS)
+        return FALSE;
+
+    if (HI_READ(fp, buffer, numDims * sizeof(int32)) == FAIL)
+       HRETURN_ERROR(DFE_READERROR,FALSE);
+
+#ifdef DEBUG
+    fprintf(stderr,"File version %d.%d\n", (int)vers, (int)release);
+    fprintf(stderr," rVars %d, Attrs %d, zVars %d\n", (int)numRVars, (int)numAttrs, (int)numZVars);
+    fprintf(stderr," Dims %d, maxRec %d\n", (int)numDims, (int)maxRec);
+#endif
+
+    /*
+     * For each rVariable dimension size create a new dimension object
+     */
+    b = buffer;
+    current_dim = 0;
+    for(i = 0; i < numDims; i++) {
+        char tmpname[80];
+        INT32DECODE(b, dim_sz[i]);
+        sprintf(tmpname, "CDFdim%d_%d", i, (int)dim_sz[i]);
+        dim_rec[current_dim++] = NC_new_dim(tmpname, dim_sz[i]);
+
+#ifdef DEBUG
+        fprintf(stderr,"Created dimension %s\n", tmpname);
+#endif
+    }
+
+    /* 
+     * Loop over Rvariables and read them in
+     */
+    while(varNext != 0) {
+
+#ifdef DEBUG
+        fprintf(stderr,"Variable %d seeking to %d\n", (int)current_var, (int)varNext);
+#endif
+
+        if (HI_SEEK(fp, varNext) == FAIL)
+            HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+
+        if (HI_READ(fp, buffer, 4) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+
+        b = buffer;
+        INT32DECODE(b, dummy);      /* record size */
+        dummy -= 4;
+            
+        if (HI_READ(fp, buffer, dummy) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+        
+        b = buffer;
+        INT32DECODE(b, dummy);      /* record type */
+        INT32DECODE(b, varNext);    /* start of next R variable */
+        INT32DECODE(b, nt);         /* number type */
+        INT32DECODE(b, vMaxRec);    /* number of records for this variable */
+        INT32DECODE(b, vxrNext);    /* start of VXR recrods */
+        INT32DECODE(b, VXRtail);    /* ??? */
+        INT32DECODE(b, vFlags);     /* variable flags <---- record variance in here */
+        INT32DECODE(b, dummy);      /* rfuA */
+        INT32DECODE(b, dummy);      /* rfuB */
+        INT32DECODE(b, dummy);      /* rfuC */
+        INT32DECODE(b, dummy);      /* rfuF */
+        b += VDRzVDR_RFUe_LEN;      /* reserved field */
+        INT32DECODE(b, numElem);    /* == 1 unless string variable */
+        INT32DECODE(b, num);        /* */
+        INT32DECODE(b, dummy);      /* rfuD */
+        INT32DECODE(b, dummy);      /* nextEndRecs */
+
+        HDmemcpy(name, b, CDF_VAR_NAME_LEN);
+        name[CDF_VAR_NAME_LEN] = '\0';
+        b += CDF_VAR_NAME_LEN;
+
+        j = 0;
+        while((name[j] != ' ') && (name[j] != '\0')) j++;
+        name[j] = '\0';
+
+#ifdef DEBUG
+        fprintf(stderr,"\tName %s nt %d vMaxRec %d\n", name, (int)nt, (int)vMaxRec);
+        fprintf(stderr,"\tNext var at %d\n", (int)varNext);
+#endif
+
+        /*
+         *  Figure out which dimensions are meaningful
+         *  If we vary in the record dimension it is reflected in the variable's
+         *    flags
+         *  Variance in the other dimensions is specified singly as int32 
+         *    quantities in the file
+         *  Only define the variable in terms of dimensions in which it varies
+         */
+        rank = 0;
+
+        if(bitset(vFlags, rVAR_RECVARY_BIT)) {
+            char dimname[1000];
+            sprintf(dimname, "%s_REC", name);
+            if(numElem > 1)
+                dim_rec[current_dim] = NC_new_dim(dimname, numElem);
+            else
+                if(maxRec > 0)
+                    dim_rec[current_dim] = NC_new_dim(dimname, maxRec);
+                else
+                    dim_rec[current_dim] = NC_new_dim(dimname, NC_UNLIMITED);
+
+            dims[rank++] = current_dim++;
+        }
+        
+        for(j = 0; j < numDims; j++) {
+            INT32DECODE(b, dummy);
+            if(dummy) 
+                dims[rank++] = j;
+        }
+
+        /* map the CDF type into a netCDF type */
+        nctype = cdf_unmap_type(nt);
+
+        /* define the variable */
+        var = vars[current_var] = NC_new_var((char *) name, nctype, (int) rank, dims);
+        if(var == NULL)
+            HRETURN_ERROR(DFE_NOSPACE, FALSE);
+
+#ifdef DEBUG
+        fprintf(stderr,"Was able to call NC_new_var()\n");
+#endif
+        
+        /* if it is unsigned at least set the HDFtype to reflect it */
+        switch(nt) {
+        case CDF_UINT1:
+            var->HDFtype = DFNT_UINT8;    break;
+        case CDF_UINT2:
+            var->HDFtype = DFNT_UINT16;   break;  
+        case CDF_UINT4:
+            var->HDFtype = DFNT_UINT32;   break;
+        default:
+            break;
+        }
+
+        /*
+         *  Read the pad value if applicable
+         */
+        if(bitset(vFlags, rVAR_PADVALUE_BIT)) {
+            /* need to pull the pad value out of the file at current location */
+            /* make into _Fillvalue attribute */
+        }
+        
+        /*
+         *  Mess with setting up VXR records
+         */
+
+        var->vixHead = end = NULL;
+        while(vxrNext != 0) {
+            vix_t * vix;
+
+            vix = (vix_t *)HDmalloc(sizeof(vix_t));
+            if(vix == NULL) 
+                HRETURN_ERROR(DFE_NOSPACE,FALSE);
+            
+            /* stick vix at the end of our list and update end pointer */
+            if(end == NULL)
+                var->vixHead = end = vix;
+            else
+                end = end->next = vix;
+
+            vix->next = NULL;
+
+#ifdef DEBUG
+            fprintf(stderr, "Reading a VXR record at %d\n", (int)vxrNext);
+#endif
+            /*
+             * Read the next record out of the file 
+             */
+            if (HI_SEEK(fp, vxrNext) == FAIL)
+                HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+            
+            if (HI_READ(fp, buffer, 4) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+            
+            b = buffer;
+            INT32DECODE(b, dummy);      /* record size */
+            dummy -= 4;
+            
+            if (HI_READ(fp, buffer, dummy) == FAIL)
+                HRETURN_ERROR(DFE_READERROR,FALSE);
+            
+            b = buffer;
+            INT32DECODE(b, dummy);         /* record type */
+            INT32DECODE(b, vxrNext);       /* next VXR record */
+            INT32DECODE(b, vix->nEntries); /* number of entries */
+            INT32DECODE(b, vix->nUsed);    /* number of used entries */
+
+            for(i = 0; i < vix->nEntries; i++)
+                INT32DECODE(b, vix->firstRec[i]);
+            for(i = 0; i < vix->nEntries; i++)
+                INT32DECODE(b, vix->lastRec[i]);
+            for(i = 0; i < vix->nEntries; i++)
+                INT32DECODE(b, vix->offset[i]);
+
+#ifdef DEBUG
+            for(i = 0; i < vix->nEntries; i++)
+                fprintf(stderr, "\t%d %d %d\n", (int)vix->firstRec[i], (int)vix->lastRec[i], (int)vix->offset[i]);
+            fprintf(stderr, "Next record at %d\n", (int)vxrNext);
+#endif
+
+        }
+
+        current_var++;
+
+    }
+
+    /* 
+     * Loop over Zvariables and read them in
+     */
+    while(zVarNext != 0) {
+
+#ifdef DEBUG
+        fprintf(stderr,"zVariable %d seeking to %d\n", i, (int)zVarNext);
+#endif
+
+        if (HI_SEEK(fp, zVarNext) == FAIL)
+            HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+
+        if (HI_READ(fp, buffer, 4) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+
+        b = buffer;
+        INT32DECODE(b, dummy);      /* record size */
+        dummy -= 4;
+            
+        if (HI_READ(fp, buffer, dummy) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+        
+        b = buffer;
+        INT32DECODE(b, dummy);      /* record type */
+        INT32DECODE(b, zVarNext);    /* start of next R variable */
+        INT32DECODE(b, nt);         /* number type */
+        INT32DECODE(b, vMaxRec);    /* dunno */
+        INT32DECODE(b, vxrNext);    /* start of VXR records */
+        INT32DECODE(b, VXRtail);    /* ??? */
+        INT32DECODE(b, vFlags);     /* variable flags <---- record variance in here */
+        INT32DECODE(b, dummy);      /* rfuA */
+        INT32DECODE(b, dummy);      /* rfuB */
+        INT32DECODE(b, dummy);      /* rfuC */
+        INT32DECODE(b, dummy);      /* rfuF */
+        b += VDRzVDR_RFUe_LEN;      /* reserved field */
+        INT32DECODE(b, numElem);    /* */
+        INT32DECODE(b, num);        /* */
+        INT32DECODE(b, dummy);      /* rfuD */
+        INT32DECODE(b, dummy);      /* nextEndRecs */
+
+        HDmemcpy(name, b, CDF_VAR_NAME_LEN);
+        name[CDF_VAR_NAME_LEN] = '\0';
+        b += CDF_VAR_NAME_LEN;
+
+        j = 0;
+        while((name[j] != ' ') && (name[j] != '\0')) j++;
+        name[j] = '\0';
+
+        /* MORE STUFF */
+#ifdef DEBUG
+        fprintf(stderr,"\tName %s nt %d vMaxRec %d\n", name, (int)nt, (int)vMaxRec);
+#endif
+
+        /*
+         * Get the number of dimensions defined with this dataset
+         * This is not necessarily the rank since we may not vary in
+         *   some of them.  In that case, do not create dimension 
+         *   objects for them.
+         */
+        INT32DECODE(b, numDims);        /* number of dimensions */
+
+        /* 
+         * read dimension sizes
+         * figure out which ones are actually used
+         * create dimension objects for the dimensions that are used
+         */
+        for(j = 0; j < numDims; j++)
+            INT32DECODE(b, dim_sz[j]);
+
+        rank = 0;
+        for(j = 0; j < numDims; j++) {
+            INT32DECODE(b, dummy);
+            if(dummy) {
+                char dimname[1000];
+                sprintf(dimname, "%s%d_%d", name, (int)rank, (int)dim_sz[j]);
+                dim_rec[current_dim] = NC_new_dim(dimname, dim_sz[j]);
+                dims[rank++] = current_dim++;
+            }
+        }
+
+#ifdef DEBUG
+        fprintf(stderr,"\trank %d numDims %d\n", (int)rank, (int)numDims);
+#endif
+
+        /* map the CDF type into a netCDF type */
+        nctype = cdf_unmap_type(nt);
+
+        /* define the variable */
+        var = vars[current_var] = NC_new_var((char *) name, nctype, (int) rank, dims);
+        if(var == NULL)
+            return (FALSE);
+        
+        /* if it is unsigned at least set the HDFtype to reflect it */
+        switch(nt) {
+        case CDF_UINT1:
+            var->HDFtype = DFNT_UINT8;            break;
+        case CDF_UINT2:
+            var->HDFtype = DFNT_UINT16;           break;  
+        case CDF_UINT4:
+            var->HDFtype = DFNT_UINT32;           break;
+        default:
+            break;
+        } 
+
+
+        /* what's up with PadValues ??? */
+
+
+        /*
+         *  Mess with setting up VXR records
+         */
+        var->vixHead = end = NULL;
+        while(vxrNext != 0) {
+            vix_t * vix;
+
+            vix = (vix_t *)HDmalloc(sizeof(vix_t));
+            if(vix == NULL) 
+                HRETURN_ERROR(DFE_NOSPACE,FALSE);
+            
+            /* stick vix at the end of our list and update end pointer */
+            if(end == NULL)
+                var->vixHead = end = vix;
+            else
+                end = end->next = vix;
+
+            vix->next = NULL;
+
+#ifdef DEBUG
+            fprintf(stderr, "Reading a VXR record at %d\n", (int)vxrNext);
+#endif
+            /*
+             * Read the next record out of the file 
+             */
+            if (HI_SEEK(fp, vxrNext) == FAIL)
+                HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+            
+            if (HI_READ(fp, buffer, 4) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+            
+            b = buffer;
+            INT32DECODE(b, dummy);      /* record size */
+            dummy -= 4;
+            
+            if (HI_READ(fp, buffer, dummy) == FAIL)
+                HRETURN_ERROR(DFE_READERROR,FALSE);
+            
+            b = buffer;
+            INT32DECODE(b, dummy);         /* record type */
+            INT32DECODE(b, vxrNext);       /* next VXR record */
+            INT32DECODE(b, vix->nEntries); /* number of entries */
+            INT32DECODE(b, vix->nUsed);    /* number of used entries */
+
+            for(i = 0; i < vix->nEntries; i++)
+                INT32DECODE(b, vix->firstRec[i]);
+            for(i = 0; i < vix->nEntries; i++)
+                INT32DECODE(b, vix->lastRec[i]);
+            for(i = 0; i < vix->nEntries; i++)
+                INT32DECODE(b, vix->offset[i]);
+
+#ifdef DEBUG
+            for(i = 0; i < vix->nEntries; i++)
+                fprintf(stderr, "\t%d %d %d\n", (int)vix->firstRec[i], (int)vix->lastRec[i], (int)vix->offset[i]);
+            fprintf(stderr, "Next record at %d\n", (int)vxrNext);
+#endif
+
+        }
+
+        current_var++;
+
+    } /* loop over zVariabes */
+
+    /* 
+     * Loop over Attributes and read them in
+     */
+    for(i = 0; i < numAttrs; i++) {
+
+#ifdef DEBUG
+        fprintf(stderr,"Attribute %d seeking to %d\n", i, (int)adrNext);
+#endif
+        
+        if (HI_SEEK(fp, adrNext) == FAIL)
+            HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+
+        if (HI_READ(fp, buffer, 4) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+
+        b = buffer;
+        INT32DECODE(b, dummy);      /* record size */
+        dummy -= 4;
+            
+        if (HI_READ(fp, buffer, dummy) == FAIL)
+            HRETURN_ERROR(DFE_READERROR,FALSE);
+
+        b = buffer;
+        INT32DECODE(b, dummy);      /* record type */
+        INT32DECODE(b, adrNext);    /* start of next ADR record */
+        INT32DECODE(b, aedrNext);   /* start of next AEDR object */
+        INT32DECODE(b, scope);      /* scope 1==global 2==local */
+        INT32DECODE(b, dummy);      /* num */
+        INT32DECODE(b, dummy);      /* numR */
+        INT32DECODE(b, dummy);      /* maxR */
+        INT32DECODE(b, dummy);      /* rfuA */
+        INT32DECODE(b, aedzNext);   /* AzEDRhread */
+        INT32DECODE(b, dummy);      /* NumZ */
+        INT32DECODE(b, dummy);      /* MaxZ */
+        INT32DECODE(b, dummy);      /* rfuE */
+
+        HDmemcpy(name, b, CDF_ATTR_NAME_LEN);
+        name[CDF_ATTR_NAME_LEN] = '\0';
+
+#ifdef DEBUG
+        fprintf(stderr,"\tname %s (%s) data at %d\n", name, (scope == 1 ? "global" : "local"), (int)aedrNext);
+        fprintf(stderr,"\taedrNext %d    aedzNext %d\n", (int)aedrNext, (int)aedzNext);
+        
+#endif
+
+        /*
+         * Read in the AEDR records now and add them to the appropriate object
+         */
+        while(aedrNext != 0) {
+            NC_array ** ap;
+            NC_attr  *  attr[1];
+            char     *  tBuf;
+            int32       bsize;
+
+            if (HI_SEEK(fp, aedrNext) == FAIL)
+                HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+            
+            if (HI_READ(fp, buffer, 4) == FAIL)
+                HRETURN_ERROR(DFE_READERROR,FALSE);
+            
+            b = buffer;
+            INT32DECODE(b, dummy);      /* record size */
+            dummy -= 4;
+            
+            if (HI_READ(fp, buffer, dummy) == FAIL)
+                HRETURN_ERROR(DFE_READERROR,FALSE);
+
+            b = buffer;
+            INT32DECODE(b, dummy);      /* record type */
+            INT32DECODE(b, aedrNext);   /* start of next AEDR record */
+            INT32DECODE(b, num);        /* attr (?) number */
+            INT32DECODE(b, nt);         /* number type */
+            INT32DECODE(b, num);        /* var (?) number */
+            INT32DECODE(b, count);      /* number of elements */
+            INT32DECODE(b, dummy);      /* rfuA */
+            INT32DECODE(b, dummy);      /* rfuB */
+            INT32DECODE(b, dummy);      /* rfuC */
+            INT32DECODE(b, dummy);      /* rfuD */
+            INT32DECODE(b, dummy);      /* rfuE */
+
+            /* map the CDF type into a netCDF type */
+            nctype  = cdf_unmap_type(nt);
+            hdftype = hdf_map_type(nctype);
+
+            bsize = nctypelen(nctype) * count;
+            tBuf = (char *)HDmalloc((uint32) bsize);
+
+            /* convert attrbute values and create attr object */
+            DFKconvert((VOIDP) b, (VOIDP) tBuf, hdftype, count, DFACC_READ, 0, 0);
+            attr[0] = NC_new_attr(name, nctype, count, tBuf);
+            HDfree(tBuf);
+
+            /* make sure we got a vaild attribute */
+            if(attr[0] == NULL)
+                return (FALSE);
+
+            /* find the appropriate attribute list */
+            if(scope == 1) {
+                /* global attribute */
+                ap = &(handle->attrs);
+            } else {
+                /* local --- find the appropriate variable */
+                ap = &(vars[num]->attrs);
+#ifdef DEBUG
+        fprintf(stderr,"\tAdding %s (%s) to var %d \n", name, (scope == 1 ? "global" : "local"), (int)num);
+#endif
+            }
+
+            /* add the attribute to the list */
+            if(*ap == NULL) { 
+                /* first time */
+                (*ap) = NC_new_array(NC_ATTRIBUTE,(unsigned)1, (Void*)attr);
+                if((*ap) == NULL)
+                    return (FALSE);
+            } else {
+                if(NC_incr_array((*ap), (Void *)attr) == NULL)
+                    return (FALSE);
+            }
+        } /* AEDR loop */
+
+        /*
+         * Read in the AEDZ records now and add them to the appropriate object
+         * It is not clear to me how these are different from aedr records 
+         *   except for that they are for Zvariables rather than Rvariables.
+         *   Any other reasons?????
+         */
+        while(aedzNext != 0) {
+            NC_array ** ap;
+            NC_attr  *  attr[1];
+            char     *  tBuf;
+            int32       bsize;
+
+#ifdef DEBUG
+        fprintf(stderr,"\tReading aedz from %d\n", (int)aedzNext);
+#endif
+
+            if (HI_SEEK(fp, aedzNext) == FAIL)
+                HRETURN_ERROR(DFE_SEEKERROR,FALSE);
+            
+            if (HI_READ(fp, buffer, 4) == FAIL)
+                HRETURN_ERROR(DFE_READERROR,FALSE);
+            
+            b = buffer;
+            INT32DECODE(b, dummy);      /* record size */
+            dummy -= 4;
+            
+            if (HI_READ(fp, buffer, dummy) == FAIL)
+                HRETURN_ERROR(DFE_READERROR,FALSE);
+
+            b = buffer;
+            INT32DECODE(b, dummy);      /* record type */
+            INT32DECODE(b, aedzNext);   /* start of next AEDR record */
+            INT32DECODE(b, num);        /* attr (?) number */
+            INT32DECODE(b, nt);         /* number type */
+            INT32DECODE(b, num);        /* var (?) number */
+            INT32DECODE(b, count);      /* number of elements */
+            INT32DECODE(b, dummy);      /* rfuA */
+            INT32DECODE(b, dummy);      /* rfuB */
+            INT32DECODE(b, dummy);      /* rfuC */
+            INT32DECODE(b, dummy);      /* rfuD */
+            INT32DECODE(b, dummy);      /* rfuE */
+
+            /* map the CDF type into a netCDF type */
+            nctype  = cdf_unmap_type(nt);
+            hdftype = hdf_map_type(nctype);
+
+            bsize = nctypelen(nctype) * count;
+            tBuf = (char *)HDmalloc((uint32) bsize);
+
+            /* convert attrbute values and create attr object */
+            DFKconvert((VOIDP) b, (VOIDP) tBuf, hdftype, count, DFACC_READ, 0, 0);
+            attr[0] = NC_new_attr(name, nctype, count, tBuf);
+            HDfree(tBuf);
+
+            /* make sure we got a vaild attribute */
+            if(attr[0] == NULL)
+                return (FALSE);
+
+            /* find the appropriate attribute list */
+            if(scope == 1) {
+                /* global attribute */
+                ap = &(handle->attrs);
+            } else {
+                /* local --- find the appropriate variable */
+                ap = &(vars[num]->attrs);
+#ifdef DEBUG
+        fprintf(stderr,"\tAdding %s (%s) to Zvar %d \n", name, (scope == 1 ? "global" : "local"), (int)num);
+#endif
+            }
+
+            /* add the attribute to the list */
+            if(*ap == NULL) { 
+                /* first time */
+                (*ap) = NC_new_array(NC_ATTRIBUTE,(unsigned)1, (Void*)attr);
+                if((*ap) == NULL)
+                    return (FALSE);
+            } else {
+                if(NC_incr_array((*ap), (Void *)attr) == NULL)
+                    return (FALSE);
+            }
+        } /* AEDZ loop */
+
+
+    } /* ADR loop */
+
+    /*
+     * Set up the dimension list
+     */
+    if(current_dim)
+        handle->dims = NC_new_array(NC_DIMENSION, current_dim, (Void *) dim_rec);
+    else
+        handle->dims = NULL;
+
+    /* 
+     * Set up the variable list define the variables 
+     */
+    if(current_var)
+        handle->vars = NC_new_array(NC_VARIABLE, current_var, (Void *) vars);
+    else
+        handle->vars = NULL;
+
+    return (TRUE);
+        
+} /* nssdc_read_cdf */
+
+
+/* ---------------------------- nssdc_write_cdf ---------------------------- */
+/*
+  Write a NC structure out to a CDF file
+*/
+bool_t
+nssdc_write_cdf(xdrs, handlep)
+     XDR *  xdrs;
+     NC  ** handlep;
+{
+#if DEBUG
+    fprintf(stderr, "nssdc_write_cdf i've been called\n");
+#endif
+
+#ifdef DEBUG
+    fprintf(stderr, "We are sorry, we currently do not support writing to\n");
+    fprintf(stderr, "CDF files.  If you would like to see this capabilities\n");
+    fprintf(stderr, "please contact the HDF group at NCSA.\n");
+#endif
+
+    return (FALSE);
+        
+} /* nssdc_write_cdf */
+
+
+/* ---------------------------- nssdc_xdr_cdf ----------------------------- */
+/*
+  Handle basic I/O of the NC structure.
+  CDF analogue of hdf_xdr_cdf and NC_xdr_cdf
+*/
+bool_t
+nssdc_xdr_cdf(xdrs, handlep)
+     XDR *  xdrs;
+     NC  ** handlep;
+{
+
+    int status;
+
+#if DEBUG
+    fprintf(stderr, "nssdc_xdr_cdf i've been called op = %d \n", xdrs->x_op);
+#endif
+    
+    switch(xdrs->x_op) {
+    case XDR_ENCODE :
+        status = nssdc_write_cdf(xdrs, handlep);
+        break;
+    case XDR_DECODE :
+        status = nssdc_read_cdf(xdrs, handlep);
+        break;
+    case XDR_FREE   :
+        NC_free_cdf((*handlep));
+        status = TRUE;
+        break;
+    default:
+        status = TRUE;
+    }
+    
+    return (status);
+  
+} /* nssdc_xdr_cdf */
+
+#endif /* HDF */
diff --git a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c
new file mode 100644
index 0000000..527a882
--- /dev/null
+++ b/mfhdf/libsrc/putget.c
@@ -0,0 +1,2777 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: putget.c 6032 2014-01-17 18:13:52Z acheng $ */
+
+#include	<string.h>
+#include	"local_nc.h"
+#include	"alloc.h"
+#ifdef HDF
+#include    "hfile.h"    /* Ugh!  We need the defs for HI_READ and HI_SEEK */
+
+/* Local function prototypes */
+static bool_t nssdc_xdr_NCvdata
+       (NC *handle,NC_var *vp,u_long where,nc_type type,uint32 count,
+        void * values);
+
+static intn hdf_xdr_NCvdata
+    (NC *handle,NC_var *vp,u_long where,nc_type type,uint32 count,
+        void * values);
+
+static intn hdf_xdr_NCv1data
+    (NC *handle,NC_var *vp,u_long where,nc_type type,void * values);
+
+int32 hdf_get_vp_aid
+    (NC *handle, NC_var *vp);
+
+static intn SDIresizebuf(void * *buf,int32 *buf_size,int32 size_wanted);
+
+#endif /* HDF */
+
+static const long *NCvcmaxcontig(NC *, NC_var *, const long *, const long *);
+
+/*
+ * If you use ./xdrstdio.c rather than ./xdrposix.c as
+ * your bottom layer, the you may need to #define XDRSTDIO
+ */
+
+#ifndef HDF
+#define MIN(mm,nn) (((mm) < (nn)) ? (mm) : (nn))
+#define MAX(mm,nn) (((mm) > (nn)) ? (mm) : (nn))
+#endif /* HDF */
+
+/* #define VDEBUG */
+/* #define DEBUG */
+/* #define CDEBUG */
+
+#ifdef VDEBUG
+/*
+ * Print the values of an array of longs
+ */
+int arrayp(label, count, array)
+const char *label ;
+unsigned count ;
+const long array[] ;
+{
+	fprintf(stderr, "%s", label) ;
+	fputc('\t',stderr) ;	
+	for(; count > 0 ; count--, array++)
+		fprintf(stderr," %ld", *array) ;
+	fputc('\n',stderr) ;	
+}
+#endif /* VDEBUG */
+
+#define xdr_NCsetpos(xdrs, pos) xdr_setpos((xdrs),(pos))
+
+/*
+ * Check if an ncxxx function has called the current function
+ */
+static bool_t nc_API(caller)
+const char *caller;
+{
+    char *nc_api=NULL;
+    nc_api = strstr(caller, "nc");
+    if (nc_api == caller)
+        return TRUE;
+}
+
+/*
+ * At the current position, add a record containing the fill values.
+ */
+static bool_t
+NCfillrecord(xdrs, vpp, numvars)
+XDR *xdrs ;
+NC_var **vpp ;
+unsigned numvars ;
+{
+	unsigned ii ;
+
+	for(ii = 0 ; ii < numvars ; ii++, vpp++)
+	{
+		if( !IS_RECVAR(*vpp) )
+		{
+			continue ;	/* skip non-record variables */
+		}
+
+		/* compute sub size */
+		if( !xdr_NC_fill(xdrs, *vpp) )
+			return(FALSE) ;
+	}
+	return(TRUE) ;
+}
+
+
+/*
+ * Check whether coords are valid for the variable.
+ * For 'record' variables:
+ *    + if the accessing is writing, add and fill records out with
+ *	user-provided fill values or predefined fill values to the
+ *	requested recno == coords[0], as a side effect.
+ *    + if the accessing is reading, fill records with fill values up
+ *	to the requested recno when an nc API (ie. ncvarget) leads to
+ *	this, and flag as an error when an SD API (ie. SDreaddata) does.
+ *    + update NC_var.numrecs to reflect the filled records
+ *    + update NC.numrecs to NC_var.numrecs if NC_var.numrecs is larger
+ * -BMR, 12/09/2008
+ */
+bool_t
+NCcoordck(handle, vp, coords)
+NC *handle ;
+NC_var *vp ; 
+const long *coords ;
+{
+	const long *ip ;
+	unsigned long *up ;
+	const long *boundary ;
+	long unfilled ;	/* number of records that need to be filled */
+
+	boundary = NULL;	/* assuming no boundary check is needed */
+	if( IS_RECVAR(vp) )
+      {
+      /* For the variable with unlimited dimension we need to check that 
+         the size of the first dimension is non-negative, there is no
+         upper bound for it; the sizes of the rest of the dimensions are 
+         checked as for the regular fixed size variable (see the "for" loop 
+         further down) 
+                                                    EIP 01/13/09    */
+
+	/* Check that first dimension is non-negative */
+          if(*coords < 0)
+              goto bad ;
+
+        /* Set up boundary to check the rest of the dims if there are more than one dim */
+        if (vp->assoc->count > 1)
+	    boundary = coords + 1 ;
+
+      } else
+          boundary = coords ;	/* no unlimited, boundary starts at first dim */
+	
+    if (boundary != NULL) /* no unlimited dim or unlimited dim and more than one dim */
+    {
+	up = vp->shape + vp->assoc->count - 1 ;	/* pointer for dimension sizes */
+	ip = coords + vp->assoc->count - 1 ;	/* pointer for start coords */
+
+#ifdef CDEBUG
+	fprintf(stderr,"	NCcoordck: coords %p, *coords %ld, count %ld, ip %p, boundary %p, *ip %ld\n",
+            coords, *coords, vp->assoc->count, ip , boundary, *ip) ;
+#endif /* CDEBUG */
+	/* for each dimension, check if starting coord is within dim size */
+	for( ; ip >= boundary ; ip--, up--)
+	{
+#ifdef CDEBUG
+          fprintf(stderr,"	NCcoordck: ip %p, *ip %ld, up %p, *up %lu\n",
+                  ip, *ip, up, *up ) ;
+#endif /* CDEBUG */
+          if( *ip < 0 || *ip >= (long)*up )
+              goto bad ;
+	}
+    } /* more than one dim */
+
+    /* Reset ip to coords for subsequent use */
+    ip = coords;
+
+    /********************************************************************/
+    /* The following block (#ifdef HDF) is for hdf4 API and hdf4/nc API */
+    /********************************************************************/
+
+#ifdef HDF
+    /* If file is an HDF file (ie., not netCDF, created with HDF API or
+	HDF/nc API) and the variable has unlimited dimension */
+    if(handle->file_type == HDF_FILE && IS_RECVAR(vp)) 
+      {
+          void     *strg = NULL;
+          void     *strg1 = NULL;
+          NC_attr **attr = NULL;
+          int count, byte_count;
+          int len;
+            
+        /* Determine if fill values need to be written.  For example, if
+           vp's numrecs is 5, and the accessed index is 8 (*ip), then recs
+           #5,6,7 will be filled with fill value.  Note: maybe '<' should be
+	   "<=", but adding it alone caused ill-effects so a through study
+	   is needed, plus '<' doesn't really cause problem, it just meant
+	   when unfilled = 0, we'll fill 0 record below. -BMR, 12/8/2008*/
+          if((unfilled = *ip - vp->numrecs) < 0) 
+              return TRUE;   
+
+#ifdef CDEBUG
+fprintf(stderr, "NCcoordck: check 3.6, unfilled=%d\n",unfilled);
+#endif /* CDEBUG */
+
+        /* If we get here from an nc API, then reading beyond the end of the
+           current variable will write fill values to the gap between the end
+           of this variable and the max numrecs in the file.  It will only fail
+           for reading beyond the end if the calling function is from the SD
+           API. */
+
+          /* check to see if we are trying to read beyond the end */
+          if(handle->xdrs->x_op != XDR_ENCODE)
+	  {
+	     if (!nc_API(cdf_routine_name)) /* from an SD API call */
+                  goto bad ; /* cannot read beyond the end of var */
+	     else	/* from an nc API call */
+		if (*ip >= handle->numrecs)
+                  goto bad ; /* only fail if reading pass max numrecs in file */
+	  }
+
+          /* If NOFILL is not requested, proceed to write fill values */
+          if ((handle->flags & NC_NOFILL) == 0) 
+            {
+                /* make sure we can write to this variable */
+                if(vp->aid == FAIL && hdf_get_vp_aid(handle, vp) == FAIL) 
+                    return(FALSE);
+            
+		/* strg and strg1 are to hold fill value and its conversion */
+                len = (vp->len / vp->HDFsize) * vp->szof;
+                strg = (Void *) HDmalloc(len);
+                strg1 = (Void *) HDmalloc(len);
+                if (NULL == strg || NULL == strg1)
+                    return FALSE;
+
+		/* Find the attribute _FillValue to get the user's fill value */
+                attr = NC_findattr(&vp->attrs, _FillValue);
+
+		/* If the attribute is found, fill strg with the fill value */
+                if(attr != NULL)
+                    HDmemfill(strg,(*attr)->data->values,vp->szof,(vp->len/vp->HDFsize));
+		/* otherwise, fill strg with predefined fill values such as
+                FILL_SHORT, FILL_BYTE,... */
+                else 
+                    NC_arrayfill(strg, len, vp->type);
+
+#ifdef DEBUG
+                fprintf(stderr, "Going to fill in record %d for variable %s\n", *ip,
+                        vp->name->values);
+#endif
+
+#ifdef OLD_WAY
+                count = vp->dsizes[0] / NC_typelen(vp->type);
+#endif
+
+                /*
+                 * Seek to correct location
+                 */
+                byte_count = vp->len;
+                count = byte_count / vp->HDFsize;
+
+                if (FAIL == Hseek(vp->aid, (vp->numrecs) * byte_count, DF_START))
+                    return FALSE;
+
+#ifdef DEBUG
+                fprintf(stderr,"Filling %d bytes starting at %d\n", 
+                       byte_count * unfilled, (vp->numrecs) * byte_count);
+#endif  
+
+                /*
+                 * Write out the values
+                 */
+                if (FAIL == DFKconvert(strg, strg1, vp->HDFtype, count, DFACC_WRITE, 0, 0))
+                    return FALSE;
+
+		/* Write fill value to each record for all "unfilled" records */
+                for(; unfilled >= 0; unfilled--, vp->numrecs++)
+                  {
+                      if (FAIL == Hwrite(vp->aid, byte_count, (uint8 *) strg1))
+                          return FALSE;
+                  }
+
+#ifdef DEBUG
+                fprintf(stderr, "WROTE %d values at location %d (numrecs = %d)\n",
+                        count, *ip * count, vp->numrecs);
+#endif
+                HDfree(strg);
+                HDfree(strg1);
+            } /* !SD_NOFILL  */
+
+        vp->numrecs = MAX(vp->numrecs, (*ip + 1));    /* if NOFILL  */
+#ifdef CDEBUG
+fprintf(stderr, "NCcoordck: check 10.0, vp->numrecs=%d\n",vp->numrecs);
+#endif /* CDEBUG */
+        if((*ip + 1) > (long)(handle->numrecs)) 
+          {
+              handle->numrecs = *ip + 1;
+              handle->flags |= NC_NDIRTY;
+          }
+
+        return (TRUE);
+    }
+#endif /* HDF */
+
+    /**********************************************/
+    /* The following block is for netCDF API file */
+    /**********************************************/
+
+    if( IS_RECVAR(vp) && (unfilled = *ip - handle->numrecs) >= 0 )
+      {
+          /* check to see if we are trying to read beyond the end */
+          if(handle->xdrs->x_op != XDR_ENCODE)
+              goto bad ;
+          /* else */
+
+          handle->flags |= NC_NDIRTY ;
+          if( handle->flags & NC_NOFILL )
+            {
+                /* Go directly to jail, do not pass go */
+                handle->numrecs = *ip + 1 ;
+            }
+          else
+            {
+                /* fill out new records */
+                if( !xdr_NCsetpos(handle->xdrs,
+                                  handle->begin_rec + handle->recsize*handle->numrecs) )
+                  {
+                      nc_serror("NCcoordck seek, var %s", vp->name->values) ;
+                      return(FALSE) ;
+                  }
+                for( ; unfilled >= 0 ; unfilled--, handle->numrecs++)
+                  {
+                      if( !NCfillrecord(handle->xdrs,
+                                        (NC_var **)handle->vars->values, handle->vars->count) )
+                        {
+                            nc_serror("NCcoordck fill, var %s, rec %ld",
+                                      vp->name->values, handle->numrecs) ;
+                            return(FALSE) ;
+                        }
+                  }
+            }
+          if(handle->flags & NC_NSYNC) /* write out header->numrecs NOW */
+            {
+                if(!xdr_numrecs(handle->xdrs, handle) )
+                    return(FALSE) ;
+                handle->flags &= ~NC_NDIRTY ;
+            }
+      }
+
+	return(TRUE) ;
+bad:
+#ifdef VDEBUG
+	arrayp("\t\tcoords", vp->assoc->count, coords) ;
+	arrayp("\t\tmax", vp->assoc->count, vp->shape) ;
+#endif /* VDEBUG */
+	NCadvise(NC_EINVALCOORDS, "%s: Invalid Coordinates", vp->name->values) ;
+	return(FALSE) ;
+}
+
+
+/* 
+ * Translate the (variable, coords) pair into a seek index
+ */
+static u_long
+NC_varoffset(handle, vp, coords)
+NC *handle ;
+NC_var *vp ; 
+const long *coords ;
+{
+    u_long offset ;
+    const long *ip  ;
+    unsigned long *up ;
+    const long *boundary ;
+#ifdef HDF
+    vix_t * vix;
+    intn    i;
+#endif
+    
+    if(vp->assoc->count == 0) /* 'scaler' variable */
+        return(vp->begin) ;
+    
+    if( IS_RECVAR(vp) )
+        boundary = coords + 1 ;
+    else
+        boundary = coords ;
+    
+    up = vp->dsizes + vp->assoc->count - 1 ;
+    ip = coords + vp->assoc->count - 1 ;
+    for(offset = 0 ; ip >= boundary ; ip--, up--)
+        offset += *up * *ip ;
+    
+    if( IS_RECVAR(vp) ) 
+      {
+#ifdef HDF
+          switch(handle->file_type) 
+            {
+            case HDF_FILE:
+                return( vp->dsizes[0] * *coords + offset) ;
+            case netCDF_FILE:
+                return( vp->begin + handle->recsize * *coords + offset) ;
+            case CDF_FILE:
+#ifdef DEBUG
+                fprintf(stderr, "Yow!  Don't do CDF records yet\n");
+#endif
+                return (0);
+            }
+#else /* !HDF */
+          return( vp->begin + handle->recsize * *coords + offset) ;
+#endif /* !HDF */
+      } 
+    else 
+      {
+#ifdef HDF
+          switch(handle->file_type) 
+            {
+            case HDF_FILE:
+                return (offset);
+            case netCDF_FILE:
+                return (vp->begin + offset);
+            case CDF_FILE:
+                if((vix = vp->vixHead) == NULL)
+                    return (-1);
+            
+                /* 
+                 * Record data is stored in chunks.  the firstRec and lastRec
+                 *  fields give the indicies of the first and last records
+                 *  stored in a given chunk and the offset gives the offset in
+                 *  the file of where that chunk starts.  The local variable
+                 *  'offset' gives the offset into the entire variable space
+                 *  where we want to read.  To map find the correct location
+                 *  we need to find the correct chunk and then get our offset
+                 *  within that chunk
+                 */
+                while(vix) 
+                  {
+                      for(i = 0; i < vix->nUsed; i++) 
+                        {
+                            if((vix->firstRec[i] <= *coords) && (vix->lastRec[i] >= *coords)) {
+                                /* found the record we want */
+                                return (offset + vix->offset[i] - vix->firstRec[i] * vp->dsizes[0] + 8);
+                            }
+                        } /* loop over user entries in current vix record */
+                      vix = vix->next;
+                  } /* loop over all vix records */
+                break;
+            }
+#else /* !HDF */
+          return (vp->begin + offset);
+#endif /* !HDF */
+      }
+    
+    /* should never get to here */
+    return (0);
+    
+} /* NC_varoffset */
+
+
+/*
+ * xdr 1 - 3 bytes, leaving adjoining bytes within the word ok.
+ * (minimum unit of io is 4 bytes)
+ */
+static bool_t
+xdr_NCvbyte(xdrs, rem, count, values)
+XDR *xdrs ;
+unsigned rem ;
+unsigned count ;
+char *values ;
+{
+	char buf[4] ;
+	u_long origin=0 ;
+    enum xdr_op  x_op = xdrs->x_op ; /* save state */
+
+	if(x_op == XDR_ENCODE)
+      {
+          /*
+           * Since we only read/write multiples of four bytes,
+           * We will read in the word to change one byte in it.
+           */
+          origin = xdr_getpos( xdrs ) ;
+#ifdef XDRSTDIO
+          /*
+           * N.B. : "a file positioning function must be called between
+           * a write and a read or vice versa"
+           *		- limitations of stdio, open for update
+           */
+          if( !xdr_setpos(xdrs, origin) ) 
+              return(FALSE) ;
+#endif /* XDRSTDIO */
+          /* next op is a get */
+          xdrs->x_op = XDR_DECODE ;
+      }
+
+    if(!xdr_opaque(xdrs, buf, 4))
+      {
+          /* get failed, assume we are trying to read off the end */
+#ifdef XDRSTDIO
+          /*
+           * N.B. 2 : Violates layering,
+           * assumes stdio under xdr.
+           * This clause could be safely replaced with
+           * just the 'memset' line.
+           */
+          if(feof((FILE*)xdrs->x_private)) /* NC_NOFILL */
+            {
+                /* failed because we tried to read
+                 * beyond EOF
+                 */
+                clearerr((FILE*)xdrs->x_private) ;
+                (void)HDmemset(buf, 0, sizeof(buf)) ;
+            }
+          else
+            {
+                NCadvise(NC_EXDR, "xdr_NCvbyte") ;
+                xdrs->x_op = x_op ;
+                return(FALSE) ;
+            }
+#else
+          (void)HDmemset(buf, 0, sizeof(buf)) ;
+#endif /* XDRSTDIO */
+      }
+
+    if(x_op == XDR_ENCODE) /* back to encode */
+        xdrs->x_op = x_op ;
+
+	while(count-- != 0)
+      {
+          if(x_op == XDR_ENCODE)
+              buf[rem] = *values ;
+          else
+              *values = buf[rem] ;
+	
+          rem++ ;
+          values++ ;
+      }
+
+	if(x_op == XDR_ENCODE)
+      {
+          if( !xdr_setpos(xdrs, origin) )
+              return(FALSE) ;
+          if( !xdr_opaque(xdrs, buf, 4))
+              return(FALSE) ;
+      }
+
+	return(TRUE) ;
+}
+
+
+/*
+ * xdr a short leaving adjoining short within the word ok.
+ * (minimum unit of io is 4 bytes)
+ */
+bool_t
+xdr_NCvshort(xdrs, which, values)
+XDR *xdrs ;
+unsigned which ;
+short *values ;
+{
+    unsigned char buf[4] ; /* unsigned is important here */
+    u_long origin=0;
+    enum xdr_op  x_op = xdrs->x_op ; /* save state */
+
+    if(x_op == XDR_ENCODE)
+      {
+          origin = xdr_getpos( xdrs ) ;
+#ifdef XDRSTDIO
+          /* See N.B. above */
+          if( !xdr_setpos(xdrs, origin) )
+              return(FALSE) ;
+#endif /* XDRSTDIO */
+          /* next op is a get */
+          xdrs->x_op = XDR_DECODE ;
+      }
+
+    if(!xdr_opaque(xdrs, (caddr_t)buf, 4))
+      {
+          /* get failed, assume we are trying to read off the end */
+#ifdef XDRSTDIO
+          /* See N.B. 2 above */
+          if(feof((FILE*)xdrs->x_private)) /* NC_NOFILL */
+            {
+                /* failed because we tried to read
+                 * beyond EOF
+                 */
+                clearerr((FILE*)xdrs->x_private) ;
+                (void)memset(buf, 0, sizeof(buf)) ;
+            }
+          else
+            {
+                NCadvise(NC_EXDR, "xdr_NCvbyte") ;
+                xdrs->x_op = x_op ;
+                return(FALSE) ;
+            }
+#else
+          (void)HDmemset(buf, 0, sizeof(buf)) ;
+#endif /* XDRSTDIO */
+      }
+
+    if(x_op == XDR_ENCODE) /* back to encode */
+        xdrs->x_op = x_op ;
+ 
+    if(which != 0) which = 2 ;
+
+    if(xdrs->x_op == XDR_ENCODE)
+      {
+          buf[which +1] = *values % 256 ;
+          buf[which] = (*values >> 8) ;
+
+          if( !xdr_setpos(xdrs, origin) )
+              return(FALSE) ;
+          if( !xdr_opaque(xdrs, (caddr_t)buf, 4))
+              return(FALSE) ;
+      }
+    else
+      {
+          *values = ((buf[which] & 0x7f) << 8) + buf[which + 1] ;
+          if(buf[which] & 0x80)
+            {
+                /* extern is neg */
+                *values -= 0x8000 ;
+            }
+      }
+    return(TRUE) ;
+}
+
+
+/*
+ * xdr a single datum of type 'type' at 'where'
+ */
+static bool_t 
+xdr_NCv1data(xdrs, where, type, values)
+XDR *xdrs ;
+u_long where ;
+nc_type type ;
+Void *values ;
+{
+	u_long rem=0 ;
+
+	switch(type){
+	case NC_BYTE :
+	case NC_CHAR :
+	case NC_SHORT :
+		rem = where%4 ;
+		where -= rem ; /* round down to nearest word */
+		break ;
+    default:
+        break;
+	}
+	if( !xdr_NCsetpos(xdrs, where) )
+		return(FALSE) ;
+
+	switch(type){
+	case NC_BYTE :
+	case NC_CHAR :
+		return( xdr_NCvbyte(xdrs, (unsigned)rem, (unsigned)1,
+                            (char *)values) ) ;
+	case NC_SHORT :
+		return( xdr_NCvshort(xdrs, (unsigned)rem/2, (short *)values) ) ;
+	case NC_LONG :
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__ 
+		return( xdr_int(xdrs, (nclong *)values) ) ;
+#else
+		return( xdr_long(xdrs, (nclong *)values) ) ;
+#endif
+	case NC_FLOAT :
+		return( xdr_float(xdrs, (float *)values) ) ;
+	case NC_DOUBLE : 
+		return( xdr_double(xdrs, (double *)values) ) ;
+    default:
+        break;
+	}
+	return(FALSE) ;
+}
+
+/*****************************************************************************
+* 
+*			NCSA HDF / netCDF Project
+*			       May, 1993
+*
+* NCSA HDF / netCDF source code and documentation are in the public domain.  
+* Specifically, we give to the public domain all rights for future
+* licensing of the source code, all resale rights, and all publishing rights.
+* 
+* We ask, but do not require, that the following message be included in all
+* derived works:
+* 
+* Portions developed at the National Center for Supercomputing Applications at
+* the University of Illinois at Urbana-Champaign.  Funding for this project 
+* has come primarily from the National Science Foundation.
+* 
+* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
+* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
+* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
+* 
+******************************************************************************
+*
+* Please report all bugs / comments to hdfhelp at ncsa.uiuc.edu
+*
+*****************************************************************************/
+
+#ifdef HDF
+
+PRIVATE int32 tBuf_size = 0;
+PRIVATE int32 tValues_size = 0;
+PRIVATE int8  *tBuf = NULL;
+PRIVATE int8  *tValues = NULL;
+
+/* ------------------------------ SDPfreebuf ------------------------------ */
+/*
+    Throw away the temporary buffer we've allocated 
+*/
+intn 
+SDPfreebuf()
+{
+    int ret_value = SUCCEED;
+
+    if(tBuf != NULL)
+      {
+          HDfree(tBuf);
+          tBuf = NULL;
+          tBuf_size = 0;
+      } /* end if */
+
+    if(tValues != NULL)
+      {
+          HDfree(tValues);
+          tValues = NULL;
+          tValues_size = 0;
+      } /* end if */
+
+#ifdef LATER
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+#endif /* LATER */
+
+    return ret_value;
+}
+
+/* ------------------------------ SDIresizebuf ------------------------------ */
+/*
+    Resize a temporary buffer to the proper size
+*/
+static intn 
+SDIresizebuf(void * *buf,int32 *buf_size,int32 size_wanted)
+{
+    intn ret_value = SUCCEED;
+
+    if(*buf_size < size_wanted)
+      {
+        if(*buf)
+            HDfree(*buf);
+        *buf_size = size_wanted;
+        *buf = HDmalloc(size_wanted);
+        if (*buf == NULL) 
+          {
+            *buf_size=0;
+            ret_value = FAIL;
+            goto done;
+          } /* end if */
+      } /* end if */
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* end SDIresizebuf() */
+
+#define MAX_SIZE 1000000
+
+/* ------------------------- hdf_get_data ------------------- */
+/*
+ * Given a variable vgid return the id of a valid data storage
+ * If no data storage is found, hdf_get_data returns DFREF_NONE(0).
+ * OLD WAY: Create and fill in the VS as a side effect if it doesn't
+ *          exist yet <- not any more
+ *
+ * NEW WAY: we delay filling until data is  written out -QAK
+ * 
+ */
+intn 
+hdf_get_data(handle, vp)
+NC *handle;
+NC_var *vp;
+{
+    int32     vg = FAIL;
+    int32     vsid = DFREF_NONE;
+    int32     tag, t, n;
+    int       ret_value = DFREF_NONE;
+    
+#ifdef DEBUG 
+    fprintf(stderr, "hdf_get_data I've been called\n");
+#endif
+    
+    if(NULL == handle) 
+      {
+          ret_value = DFREF_NONE;
+          goto done;
+      }
+
+    if(NULL == vp) 
+      {
+          ret_value = DFREF_NONE;
+          goto done;
+      }
+
+    /* 
+     * if it is stored as NDGs we can't do any better than what was
+     *    originally stored in vp->data_ref
+     */
+    if(vp->data_tag == DFTAG_SDS)
+      {
+          ret_value = vp->data_ref;
+          goto done;
+      }
+    
+    if(vp->vgid) 
+      {
+          /* attach to the variable's Vgroup */
+          vg = Vattach(handle->hdf_file, vp->vgid, "r");
+          if(FAIL == vg)
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+        
+          /* loop through looking for a data storage object */
+          n = Vntagrefs(vg);
+          if(FAIL == n)
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+
+          for(t = 0; t < n; t++) 
+            {
+                if (FAIL == Vgettagref(vg, t, &tag, &vsid))
+                  {
+                      ret_value = DFREF_NONE;
+                      goto done;
+                  }
+
+                if(tag == DATA_TAG) 
+                  {   /* detach */
+                      if (FAIL == Vdetach(vg))
+                        {
+                            ret_value = DFREF_NONE;
+                            goto done;
+                        }
+                      ret_value = vsid;
+                      goto done;
+                  } /* end if */
+            }
+          /* don't forget to let go of vgroup */
+          if (FAIL == Vdetach(vg))
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+      }
+    
+    /* are we only in read-only mode? */
+    if(handle->hdf_mode == DFACC_RDONLY)
+      { /* yes, not good */
+          ret_value = DFREF_NONE;
+          goto done;
+      }
+  
+    /* 
+     * create a new data storage object
+     */
+#ifdef DEBUG
+    fprintf(stderr, "--- Creating new data storage (len = %d) --- \n", vp->len);
+    fprintf(stderr, "shape[0]= %d shape[1]= %d\n", vp->shape[0], vp->shape[1]);
+    fprintf(stderr, "dsize[0]= %d dsize[1]= %d\n", vp->dsizes[0], vp->dsizes[1]);
+#endif  
+    
+    
+    /* --------------------------------------
+     *
+     * allocate new data storage 
+     *
+     * --------------------------------------
+     */
+
+#ifdef NOT_YET
+    vsid = Htagnewref(handle->hdf_file,DATA_TAG);
+#else /* NOT_YET */
+    vsid = Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+#ifdef DEBUG
+    fprintf(stderr, "--- Allocating new data storage szof=%d, to_do=%d\n",(int)vp->szof, (int)to_do);
+    fprintf(stderr, "byte_count=%d\n", (int)byte_count);
+#endif  
+
+    /* if it is a record var might as well make it linked blocks now */
+    if(IS_RECVAR(vp)) 
+      {
+          int32 block_size; /* the size of the linked blocks to use */
+
+          /* The block size is calculated according to the following heuristic: */
+          /*   First, the block size the user set is used, if set. */
+          /*   Second, the block size is calculated according to the size being */
+          /*           written times the BLOCK_MULT value, in order to make */
+          /*           bigger blocks if the slices are very small. */
+          /*   Third, the calculated size is check if it is bigger than the */
+          /*           MAX_BLOCK_SIZE value so that huge empty blocks are not */
+          /*           created.  If the calculated size is greater than */
+          /*           MAX_BLOCK_SIZE, then MAX_BLOCK_SIZE is used */
+          /* These are very vague heuristics, but hopefully they should avoid */
+          /* some of the past problems... -QAK */
+          if(vp->block_size != (-1)) /* use value the user provided, if available */
+              block_size = vp->block_size;
+          else 
+            { /* try figuring out a good value using some heuristics */
+		/* User's suggested fix for bug #602 - Apr, 2005 */
+                /* This check avoids overflowing the int32 block_size */
+                /* if the user has a huge value for vp->len */ 
+                if(vp->len > MAX_BLOCK_SIZE)
+                    block_size = MAX_BLOCK_SIZE;
+                else
+                  {
+                    block_size = vp->len*BLOCK_MULT;
+                    if (block_size > MAX_BLOCK_SIZE)
+                        block_size = MAX_BLOCK_SIZE;
+                  }
+            } /* end else */
+
+          vp->aid = HLcreate(handle->hdf_file, DATA_TAG, vsid, block_size,
+                             BLOCK_COUNT);
+          if(vp->aid == FAIL) 
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+
+          if(Hendaccess(vp->aid) == FAIL) 
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+      }
+
+    if(vp->vgid) 
+      {
+          /* attach to the variable's Vgroup */
+          vg = Vattach(handle->hdf_file, vp->vgid, "w");
+          if(vg == FAIL)
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+        
+          /* add new Vdata to existing Vgroup */
+          if (FAIL == Vaddtagref(vg, (int32) DATA_TAG, (int32) vsid))
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+
+        
+          /* detach from the variable's VGroup --- will no longer need it */
+          if (FAIL == Vdetach(vg))
+            {
+                ret_value = DFREF_NONE;
+                goto done;
+            }
+      }
+        
+#ifdef DEBUG 
+    fprintf(stderr, "Done with the DATA Vdata returning id %d\n", vsid);
+#endif
+
+    vp->aid = FAIL;
+
+    /* added a new object -- make sure we flush the header */
+    handle->flags |= NC_HDIRTY;
+            
+    ret_value = vsid;
+
+done:
+    if (ret_value == DFREF_NONE)
+      { /* Failure cleanup */
+          if (vg != FAIL)
+            {                
+                Vdetach(vg); /* no point in catch error here if we fail */
+            }
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_get_data */
+
+
+/* ---------------------------- hdf_get_vp_aid ---------------------------- */
+/*
+
+  Return an AID for the current variable.  Return FAIL on error SUCCEED on success
+
+*/
+int32
+hdf_get_vp_aid(handle, vp)
+NC        * handle;
+NC_var    * vp;
+{
+    int32 ret_value = SUCCEED;
+
+    /* attach to proper data storage*/
+    if(!vp->data_ref)
+        vp->data_ref = hdf_get_data(handle, vp);
+
+    /*
+     * Fail if there is no data
+     */
+    if(vp->data_ref == DFREF_NONE) 
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if(handle->hdf_mode == DFACC_RDONLY)
+        vp->aid = Hstartread(handle->hdf_file, vp->data_tag, vp->data_ref);
+    else
+      {
+#ifdef OLD_WAY
+          vp->aid = Hstartwrite(handle->hdf_file, vp->data_tag, vp->data_ref, 0);
+#else /* OLD_WAY */
+        if(!IS_RECVAR(vp)) {
+          vp->aid = Hstartaccess(handle->hdf_file, vp->data_tag, vp->data_ref, DFACC_WRITE);
+          if(vp->set_length==TRUE) {
+              Hsetlength(vp->aid,vp->len);
+              vp->set_length=FALSE;
+          }
+        }
+        else
+          vp->aid = Hstartaccess(handle->hdf_file, vp->data_tag, vp->data_ref, DFACC_WRITE|DFACC_APPENDABLE);
+#endif /* OLD_WAY */
+      }
+    
+    ret_value = vp->aid;
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_get_vp_aid */
+
+ 
+/* --------------------------- hdf_xdr_NCvdata ---------------------------- */
+/*
+ *  Read / write 'count' items of contiguous data of type 'type' at 'where'
+ *
+ * If we are not already attached to the VData representing the
+ *  data attach to it now.  Since attaching / detaching is so
+ *  slow, stay attached for future reads / writes.  As a result,
+ *  we must always attach with write access.
+ *
+ * The calling routine is responsible for calling DFKsetNT() as required.
+ */
+static intn
+hdf_xdr_NCvdata(NC *handle, 
+                NC_var *vp, 
+                u_long where, 
+                nc_type type, 
+                uint32 count, 
+                void * values)
+{
+    NC_attr **attr = NULL;  /* pointer to the fill-value attribute */
+    int32  status;
+    int32  byte_count;	/* total # of bytes of data to be processed */
+    int32  elements_left=0;/* number of elements still left to be processed */
+    int32  data_size;	/* size of data block being processed in bytes */
+    int32  new_count;	/* computed by dividing number of elements 'count' by 2 since 'count' is too big to allocate temporary buffer */
+    int32  bytes_left;
+    int32  elem_length;	/* length of the element pointed to */
+    int8   platntsubclass;  /* the machine type of the current platform */
+    int8   outntsubclass;   /* the data's machine type */
+    uintn  convert;         /* whether to convert or not */
+    uint8 *pvalues;	    /* pointer to traverse user's buffer "values" */
+    int16  isspecial;
+    intn   ret_value = SUCCEED;
+    int32 alloc_status = FAIL;	/* no successful allocation yet */
+
+#ifdef DEBUG
+    fprintf(stderr, "hdf_xdr_NCvdata I've been called : %s\n", vp->name->values);
+#endif
+
+#ifdef DEBUG 
+    fprintf(stderr, "Where = %d  count = %d\n", where, count);
+#endif
+    
+
+    if(vp->aid == FAIL 
+       && hdf_get_vp_aid(handle, vp) == FAIL) 
+      {
+          /*
+           * Fail if there is no data *AND* we were trying to read...
+           * Otherwise, we should fill with the fillvalue
+           */
+          if(vp->data_ref == 0) 
+            {
+                if(handle->hdf_mode == DFACC_RDONLY) 
+                  {
+                      if(vp->data_tag == DATA_TAG || vp->data_tag == DFTAG_SDS) 
+                        {
+                            if((attr = NC_findattr(&vp->attrs, _FillValue))!= NULL)
+                                HDmemfill(values,(*attr)->data->values,vp->szof,count);
+                            else 
+                                NC_arrayfill(values, count * vp->szof, vp->type);
+                        }
+
+                      ret_value = SUCCEED;
+                      goto done;
+                  } 
+                else 
+                  {
+                      ret_value =  FAIL;
+                      goto done;
+                  }
+            }
+      }
+
+    /* 
+       Figure out if the tag/ref is a compressed special-element with no data.
+       This "template" tag/ref is treated as if the tag/ref doesn't exist at
+       all:  reading from it fills a memory buffer and returns it to the user
+       and writing to it fills up the buffer around the block to write.
+    */
+    if(Hinquire(vp->aid,NULL,NULL,NULL,&elem_length,NULL,NULL,NULL,&isspecial) == FAIL)
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+#ifdef DEBUG 
+    fprintf(stderr, "vp->aid=%d, length=%ld, byte_count=%ld\n", 
+            (int)vp->aid, (long)elem_length, (long)byte_count);
+#endif
+    /* Check for zero-length compressed special element, i.e. a template */
+    if(elem_length <= 0)
+      {
+          attr = NC_findattr(&vp->attrs, _FillValue);
+
+          /* Check for reading from template & fill memory buffer with fill-value */
+          if(handle->xdrs->x_op == XDR_DECODE) 
+            {
+                if(attr != NULL)
+                    HDmemfill(values,(*attr)->data->values,vp->szof,count);
+                else 
+                    NC_arrayfill(values, count * vp->szof, vp->type);
+
+                ret_value = SUCCEED; /* we are done */
+                goto done;
+            } /* end if */
+      } /* end if */
+
+    /* Collect all the number-type size information, etc. */
+    byte_count = count * vp->HDFsize;
+
+#if 0 /* old way */
+    platntsubclass = DFKgetPNSC(vp->HDFtype, DF_MT); 
+    outntsubclass = DFKisnativeNT(vp->HDFtype) ? DFKgetPNSC(vp->HDFtype, DF_MT)
+	    : (DFKislitendNT(vp->HDFtype) ? DFNTF_PC : DFNTF_HDFDEFAULT);
+#else /* new way */
+    if (FAIL == (platntsubclass = DFKgetPNSC(vp->HDFtype, DF_MT)))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    if (DFKisnativeNT(vp->HDFtype))
+      {
+          if (FAIL == (outntsubclass = DFKgetPNSC(vp->HDFtype, DF_MT)))
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+      }
+    else
+      {
+          outntsubclass = DFKislitendNT(vp->HDFtype) ? DFNTF_PC : DFNTF_HDFDEFAULT;
+      }
+
+#endif
+    convert= (uintn)(platntsubclass!=outntsubclass);
+
+/* BMR - bug#268: removed the block here that attempted to allocation
+large amount of space and failed.  The allocation is not incorporated
+in the reading values, writing values, and writing fill values parts in
+this routine */
+
+#ifdef DEBUG
+    fprintf(stderr, "hdf_xdr_NCvdata: tBuf_size=%d, tBuf=%p\n",(int)tBuf_size,tBuf);
+#endif
+
+    /* 
+     * It may be the case that the current does NOT begin at the start of the
+     *   data-object which is storing it.  In that case compute the correct 
+     *   location.
+     * QAK: This shouldn't be an issue for compressed template objects.
+     */
+#ifdef DEBUG
+    fprintf(stderr, "hdf_xdr_NCvdata: vp->data_offset=%d, where=%d\n",(int)vp->data_offset,(int)where);
+#endif
+
+    if(vp->data_offset > 0) 
+      {
+          where += vp->data_offset;
+          /* if the dataset doesn't exist yet, we need to fill in the dimension scale info */
+          if(elem_length <= 0 && (handle->flags & NC_NOFILL) == 0)
+          {
+	  /* BMR: work around for the low memory problem by repeatedly 
+             processing smaller amount blocks of data */
+
+             /* compute the data block size and the # of elements*/
+             data_size = MAX( byte_count, where ); 
+             new_count = vp->data_offset/vp->HDFsize; 
+
+	     /* attempt to allocate the entire amount needed first, data_size bytes */
+	     alloc_status = SDIresizebuf((void **)&tBuf, &tBuf_size, data_size );
+
+	     /* if fail to allocate, repeatedly calculate a new amount
+	     and allocate until success or until no more memory available */
+	     while( alloc_status == FAIL )
+		{
+		   new_count = new_count / 2;	/* try smaller number of elements */
+                   if( new_count <= 0 )  /* unable to allocate any memory */
+                   {
+                      ret_value = FAIL;
+                      goto done;
+                   }
+		  /* re-calculate the size of the data block using smaller # of elements */
+		   data_size = new_count * vp->szof;
+		   alloc_status = SDIresizebuf((void **)&tBuf,&tBuf_size, data_size);
+		} /* while trying to allocate */
+
+                /* assume that all elements are to be processed */
+		elements_left = vp->data_offset/vp->HDFsize;
+
+		/* repeatedly read, convert, and store blocks of data_size 
+                   bytes of data into the user's buffer until no more elements 
+                   left */
+		while( elements_left > 0 )
+		{
+                   /* Fill the temporary buffer with the fill-value */
+                   if(attr != NULL)
+                      HDmemfill(tBuf,(*attr)->data->values,vp->szof, new_count);
+                   else 
+                      NC_arrayfill(tBuf, data_size, vp->type);
+
+                   /* convert the fill-values, if necessary */
+                   if(convert) 
+                   {
+                      if (FAIL == DFKconvert(tBuf, tBuf, vp->HDFtype, (uint32)new_count, DFACC_WRITE, 0, 0))
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }
+                   } /* end if convert */
+
+                   /* Write the fill-values out */
+                   status = Hwrite(vp->aid, data_size, tBuf);
+                   if (data_size == status)
+                   {
+                      ret_value = FAIL;
+                      goto done;
+                   }
+
+		   /* compute the number of elements left to be processed */
+		   elements_left = elements_left - new_count;
+
+		   /* adjust the # of elements in the final block and
+		      compute that block's size if necessary */
+		   if( elements_left > 0 && elements_left < new_count )
+		   {
+		      new_count = elements_left; 
+		      data_size = new_count * vp->szof;
+		   }
+	        } /* while more elements left to be processed */
+
+	        SDPfreebuf();  /* free tBuf and tValues if any exists */
+	       /* end of BMR part */
+            } /* end if */
+      } /* end if */
+    
+#ifdef DEBUG
+    fprintf(stderr, "hdf_xdr_NCvdata vp->aid=%d, where=%d\n",
+            (int)vp->aid,(int)where);
+#endif
+    /* if we get here and the length is 0, we need to fill in the initial set of fill-values */
+    if(elem_length <= 0 && where > 0)
+      { /* fill in the lead sequence of bytes with the fill values */
+          if((handle->flags & NC_NOFILL)==0 || isspecial==SPECIAL_COMP)
+            {
+                int32 buf_size = where;
+                int32 chunk_size;
+		int32 tempbuf_size;	/* size to allocate buffer tBuf */
+                uint8 *write_buf = NULL;
+                uint32 fill_count;	/* number of fill values */
+
+		/* this block is to work around the failure caused by
+		   allocating a large chunk for the temporary buffers.
+		   First, try to allocate the desired chunk for both
+		   buffers; if any allocation fails, reduce the chunk size
+		   in half and try again until both buffers are
+		   successfully allocated - BMR */ 
+
+		chunk_size = MIN(buf_size, MAX_SIZE);   /* initial chunk size */
+		alloc_status = FAIL;
+
+                /* while any allocation fails */
+		while( alloc_status == FAIL )
+		{
+		/* try to allocate the buffer to hold the fill values after conversion */
+		   alloc_status = SDIresizebuf((void * *)&tValues,&tValues_size,chunk_size);
+		   /* then, if successful, try to allocate the temporary
+		   buffer that holds the fill values before conversion */
+                   if( alloc_status != FAIL)
+		   {
+		      /* calculate the size needed to allocate tBuf by
+		         first calculating the number of fill values that
+		         cover the chunk in buffer tValues after conversion... */
+		      fill_count = chunk_size/vp->HDFsize;
+
+		      /* then use that number to compute the size of
+		         the buffer to hold fill_count fill values of type
+		         vp->szof, i.e., before conversion */
+		      tempbuf_size = fill_count * vp->szof;
+		      alloc_status = SDIresizebuf((void **)&tBuf,&tBuf_size, tempbuf_size);
+		   } /* if first allocation successes */
+					
+		   if( alloc_status == FAIL )      /* if any allocations fail */
+		      chunk_size = chunk_size / 2;  /* try smaller chunk size */
+
+                   if( chunk_size <= 0 )  /* unable to allocate any memory */
+                   {
+                      ret_value = FAIL;
+                      goto done;
+                   }
+		} /* while any allocation fails */
+
+		/* Fill the temporary buffer tBuf with the fill-value
+		  specified in the attribute if one exists, otherwise,
+		  with the default value */ 
+                if(attr != NULL)
+                    HDmemfill(tBuf,(*attr)->data->values, vp->szof, fill_count);
+                else 
+                    NC_arrayfill(tBuf, tempbuf_size, vp->type);
+
+		/* convert the fill-values, if necessary, and store
+		them in the buffer tValues */
+                if(convert)
+                {
+                   if (FAIL == DFKconvert(tBuf, tValues, vp->HDFtype, fill_count, DFACC_WRITE, 0, 0))
+                     {
+                         ret_value = FAIL;
+                         goto done;
+                     }    
+                   write_buf=(uint8 *)tValues;
+                } /* end if */
+                else
+                   write_buf=(uint8 *)tBuf;
+
+                do {
+                    /* Write the fill-values out */
+                    status = Hwrite(vp->aid, chunk_size, write_buf);
+                    if (status != chunk_size)
+                      {
+                          ret_value = FAIL;
+                          goto done;
+                      }    
+
+                    /* reduce the bytes to be written */
+                    buf_size -= chunk_size;
+
+		    /* to take care of the last piece of data */
+		    chunk_size = MIN( chunk_size, buf_size );
+                } while (buf_size > 0);
+            } /* end if */
+          else
+            { /* don't write fill values, just seek to the correct location */
+                if(Hseek(vp->aid, where, DF_START) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }    
+            } /* end else */
+      } /* end if */
+    else
+      { /* position ourselves correctly */
+
+#ifdef DEBUG
+          fprintf(stderr, "hdf_xdr_NCvdata: Check 2.0\n");
+#endif
+          if(elem_length > 0)
+            {
+                if( Hseek(vp->aid, where, DF_START) == FAIL)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }    
+            }
+    
+#ifdef DEBUG
+    fprintf(stderr, "hdf_xdr_NCvdata after Hseek(), byte_count=%d\n",(int)byte_count);
+#endif
+    
+      } /* end else */
+
+    /* Read or write the data into / from values */
+    if(handle->xdrs->x_op == XDR_DECODE)  /* the read case */
+    {
+       if(convert) /* if data need to be converted for this platform */
+       {
+          data_size = byte_count; /* use data_size; preserve the byte count */
+          new_count = count;     /* use new_count; preserve the # of elements */
+
+          /* attempt to allocate the entire amount needed first */
+          alloc_status = SDIresizebuf((void **)&tBuf,&tBuf_size, data_size );
+
+	  /* if fail to allocate, repeatedly calculate a new amount and
+	     allocate until success or until no memory available */
+          while( alloc_status == FAIL )
+          {
+             new_count = new_count / 2;  /* try smaller number of elements */
+             if( new_count <= 0 )  /* unable to allocate any memory */
+             {
+                ret_value = FAIL;
+                goto done;
+             }
+
+             /* re-calculate the size of the data block */
+             data_size = new_count * vp->szof;
+             alloc_status = SDIresizebuf((void **)&tBuf,&tBuf_size, data_size);
+          }
+
+	  /* repeatedly read, convert, and store blocks of data_size
+	     bytes of data into the user's buffer until no more elements
+	     left */
+
+	    /* number of elements left to be processed */
+            elements_left = count;
+
+	    /* put a ptr at the beginning of the user buffer for read data */
+	    pvalues = values;
+
+	    while( elements_left > 0 )
+             {
+                status = Hread(vp->aid, data_size, tBuf);
+                if(status != data_size)  /* amount read != amount specified */
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }    
+                /* convert and store new_count elements in tBuf into 
+                   the buffer values, pointed to by pvalues */
+                if (FAIL == DFKconvert(tBuf, pvalues, vp->HDFtype, (uint32) new_count, DFACC_READ, 0, 0))
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }
+
+		/* compute the number of elements left to be processed */
+                elements_left = elements_left - new_count;
+
+		/* adjust the # of elements in the final block and
+                   compute that block's size if necessary */
+                if( elements_left > 0 && elements_left < new_count )
+                {
+                   new_count = elements_left; 
+                   data_size = new_count * vp->szof;
+                }
+
+		/* advance pvalues on buffer "values" for next batch of data */
+		pvalues = pvalues + data_size;
+              } /* while more elements left to be processed */
+
+              SDPfreebuf();  /* free tBuf and tValues if any exist */
+            } /* end if convert */
+          else  /* no convert, read directly into the user's buffer */
+            {
+                status = Hread(vp->aid, byte_count, values);
+                if(status != byte_count)
+                  {
+                      ret_value = FAIL;
+                      goto done;
+                  }    
+            } /* end else */
+      } /* end if XDR_DECODE */
+    else 
+      {/* XDR_ENCODE */
+          if(convert) /* if data need to be converted for this platform */
+          {
+             data_size = byte_count; /* use data_size; preserve the byte count*/
+             new_count = count;  /* use new_count; preserve the # of elements */
+
+             /* attempt to allocate the entire amount needed first */
+             alloc_status = SDIresizebuf((void **)&tBuf,&tBuf_size, data_size);
+
+             /* if fail to allocate, repeatedly calculate a new amount and 
+                allocate until success or no more memory left */
+             while( alloc_status == FAIL )
+             {
+                new_count = new_count / 2;  /* try smaller number of elements */
+                if( new_count <= 0 )  /* unable to allocate any memory */
+                {
+                   ret_value = FAIL;
+                   goto done;
+                }
+
+                /* re-calculate the size of the data block */ 
+                data_size = new_count * vp->HDFsize;
+                alloc_status = SDIresizebuf((void **)&tBuf,&tBuf_size, data_size);
+             }
+
+            /* repeatedly convert, store blocks of data_size bytes of data
+               from the user's buffer into the temporary buffer, and write 
+               out the temporary buffer until no more bytes left */
+
+	    /* number of elements left to be processed */
+            elements_left = count;
+
+	     /* put a ptr at the beginning of the user buffer for read data */
+	    pvalues = values;
+
+            while( elements_left > 0 )
+            {
+               /* convert new_count elements in the user's buffer values and 
+                  write them into the temporary buffer */
+               if (FAIL == DFKconvert(pvalues, tBuf, vp->HDFtype, (uint32) new_count, DFACC_WRITE, 0, 0))
+               {
+                   ret_value = FAIL;
+                   goto done;
+               }    
+               status = Hwrite(vp->aid, data_size, tBuf);
+               if(status != data_size) 
+               {
+                   ret_value = FAIL;
+                   goto done;
+               }    
+		/* compute the number of elements left to be processed */
+                elements_left = elements_left - new_count;
+
+		/* adjust the # of elements in the final block and
+                   compute that block's size if necessary */
+                if( elements_left > 0 && elements_left < new_count )
+                {
+                   new_count = elements_left; 
+                   data_size = new_count * vp->szof;
+                }
+
+		/* advance pvalues on buffer "values" for next batch of data */
+		pvalues = pvalues + data_size;
+              } /* while more elements left to be processed */
+
+            SDPfreebuf();  /* free tBuf and tValues if any exist */
+            } /* end if convert */
+          else 
+          { /* no convert, write directly from the user's buffer */
+              status = Hwrite(vp->aid, byte_count, values);
+
+	      if(status != byte_count) 
+	      {
+		ret_value = FAIL;
+		goto done;
+	      }
+          } /* no convert */
+      } /* XDR_ENCODE */
+
+    /* if we get here and the length is 0, we need to finish writing out the fill-values */
+    bytes_left = vp->len - (where + byte_count);
+#ifdef DEBUG
+    fprintf(stderr, "hdf_xdr_NCvdata: bytes_left=%d\n",(int)bytes_left);
+#endif
+    if(elem_length <= 0 && bytes_left > 0)
+      {
+          if((handle->flags & NC_NOFILL) == 0 || isspecial == SPECIAL_COMP)
+          {
+             int32 buf_size = bytes_left;
+             int32 chunk_size;
+             int32 tempbuf_size;    /* num of bytes to allocate buffer tBuf */
+             uint8 *write_buf = NULL;
+             uint32 fill_count;     /* number of fill values */
+
+	     /* this block is to work around the failure caused by
+	        allocating a large chunk for the temporary buffers.
+	        First, try to allocate the desired chunk for both buffers;
+	        if any allocation fails, reduce the chunk size in half and
+	        try again until both buffers are successfully allocated - BMR */
+
+		chunk_size = MIN(buf_size, MAX_SIZE); /* initial chunk size */
+
+		/* while any allocation fails */ 
+		alloc_status = FAIL;
+                while( alloc_status == FAIL ) 
+                {
+                   /* first, try to allocate the buffer to hold the fill 
+                      values after conversion */
+                   alloc_status = SDIresizebuf((void * *)&tValues,&tValues_size,chunk_size);
+
+		   /* then, if successful, try to allocate the temporary
+		      buffer that holds the fill values before conversion */
+		      if( alloc_status != FAIL)
+                   {
+		      /* calculate the size needed to allocate tBuf
+		         by first calculating the number of fill values that
+			 cover the chunk in buffer tValues after conversion...*/
+		      fill_count = chunk_size/vp->HDFsize;
+
+                      /* then use that number to compute the size of the 
+                         buffer to hold fill_count fill values of type 
+			 vp->szof, i.e., before conversion */
+                      tempbuf_size = fill_count * vp->szof;
+                      alloc_status = SDIresizebuf((void **)&tBuf,&tBuf_size, tempbuf_size);
+                   } /* if first allocation successes */
+                                        
+                   if( alloc_status == FAIL ) /* if any allocations fail */
+                      chunk_size = chunk_size / 2; /* try smaller chunk size */
+
+                   if( chunk_size <= 0 )  /* unable to allocate any memory */
+                   {
+                      ret_value = FAIL;
+                      goto done;
+                   }
+
+                } /* while any allocation fails */
+
+                /* Fill the temporary buffer tBuf with the fill-value specified                    in the attribute if one exists, otherwise, with the default value */
+                if(attr != NULL)
+                    HDmemfill(tBuf,(*attr)->data->values, vp->szof, fill_count);
+                else 
+                    NC_arrayfill(tBuf, tempbuf_size, vp->type);
+
+                /* convert the fill-values, if necessary, and store them in the buffer tValues */
+                if(convert) 
+                  {
+                      if (FAIL == DFKconvert(tBuf, tValues, vp->HDFtype, fill_count, DFACC_WRITE, 0, 0))
+                        {
+                            ret_value = FAIL;
+                            goto done;
+                        }    
+                      write_buf=(uint8 *)tValues;
+                  } /* end if */
+                else
+                    write_buf=(uint8 *)tBuf;
+
+                do {
+                    /* Write the fill-values out */
+                    status = Hwrite(vp->aid, chunk_size, write_buf);
+                    if (status != chunk_size)
+                      {
+                          ret_value = FAIL;
+                          goto done;
+                      }    
+
+                    /* reduce the bytes still to be written */
+                    buf_size -= chunk_size;
+
+                    /* to take care of the last piece of data */
+                    chunk_size = MIN( chunk_size, buf_size );
+                } while (buf_size > 0);
+            } /* end if */
+      } /* end if */
+
+#ifdef DEBUG
+    fprintf(stderr, " * * * Done with call to xdr_NCvdata * * *\n");
+#endif
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_xdr_NCvdata */
+
+
+/* ------------------------- hdf_xdr_NCv1data ------------------- */
+/*
+ * read / write a single datum of type 'type' at 'where'
+ * This is designed to replace the xdr based routine of the
+ *  similar name
+ * Return TRUE if everything worked, else FALSE
+ */
+static intn
+hdf_xdr_NCv1data(handle, vp, where, type, values)
+NC      * handle;
+NC_var  * vp;
+u_long    where;
+nc_type   type;
+void *values;
+{
+
+    intn ret_value = SUCCEED;
+
+    
+    if (FAIL == DFKsetNT(vp->HDFtype))
+      {
+          ret_value = FAIL;
+          goto done;
+      }
+
+    ret_value = hdf_xdr_NCvdata(handle, vp, where, type, 1, values); 
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+} /* hdf_xdr_NCv1data */
+
+/* -------------------------- nssdc_xdr_NCvdata --------------------------- */
+/*
+ *  Read / write 'count' items of contiguous data of type 'type' at 'where'
+ *    out of a CDF file
+ *
+ * The calling routine is responsible for calling DFKsetNT() as required.
+ *
+ * NOTE: Do we really care about CDF anymore since we don't support 
+ *       it 100 percent -GV
+ */
+static bool_t
+nssdc_xdr_NCvdata(NC *handle, 
+                  NC_var *vp, 
+                  u_long where, 
+                  nc_type type, 
+                  uint32 count, 
+                  void * values)
+{
+    int32 status;
+    int32 byte_count;
+
+#ifdef DEBUG
+    fprintf(stderr, "nssdc_xdr_NCvdata I've been called : %s\n", vp->name->values);
+    fprintf(stderr, "Where = %d  count = %d\n", where, count);
+    fprintf(stderr, "nssdc_xdr_NCvdata I've been called : %s reading %d from %d\n", 
+            vp->name->values, count, where);
+#endif
+
+    /* position ourselves correctly */
+    status = HI_SEEK((hdf_file_t) handle->cdf_fp, where);
+    if(status == FAIL)
+        return(FALSE);
+    
+    /* make sure our tmp buffer is big enough to hold everything */
+    byte_count = count * vp->HDFsize;
+    if(SDIresizebuf((void * *)&tBuf,&tBuf_size,byte_count)==FAIL)
+        return(FALSE);
+
+#ifdef DEBUG
+    fprintf(stderr, "\tbyte_count %d   vp->HDFsize %d\n", byte_count, vp->HDFsize);
+#endif
+
+#ifdef DEBUG
+    fprintf(stderr, " * * * Done with call to nssdc_xdr_NCvdata * * *\n");
+#endif
+    
+    return(TRUE);
+    
+} /* nssdc_xdr_NCvdata */
+
+
+#endif /* HDF */
+
+
+static
+int NCvar1io(handle, varid, coords, value)
+NC *handle ;
+int varid ;
+const long *coords ;
+Void *value ;
+{
+	NC_var *vp ;
+	u_long offset ;
+
+	if(handle->flags & NC_INDEF )
+		return(-1) ;
+	if(handle->vars == NULL)
+		return(-1) ;
+
+	vp = NC_hlookupvar( handle, varid ) ;
+	if(vp == NULL)
+		return(-1) ;
+
+	if(vp->assoc->count == 0) /* 'scaler' variable */
+      {
+#ifdef HDF
+          switch(handle->file_type) 
+            {
+            case HDF_FILE:
+           
+                if (FAIL == hdf_xdr_NCv1data(handle, vp, vp->begin, vp->type, value))
+                    return -1;
+                else
+                    return 0;
+            case netCDF_FILE:
+                return(xdr_NCv1data(handle->xdrs, vp->begin, vp->type, value) ?
+                       0 : -1 ) ;
+            }
+#else /* !HDF */
+          return(
+              xdr_NCv1data(handle->xdrs, vp->begin, vp->type, value) ?
+              0 : -1 ) ;
+#endif /* !HDF */
+      }
+
+	if( !NCcoordck(handle, vp, coords) )
+		return(-1) ;
+
+	offset = NC_varoffset(handle, vp, coords) ;
+		
+#ifdef VDEBUG
+	NCadvise(NC_NOERR, "%s offset %d, numrecs %d",
+             vp->name->values, offset, vp->numrecs) ;
+	arrayp("shape", vp->assoc->count, vp->shape) ;
+	arrayp("coords", vp->assoc->count, coords) ;
+#endif /* VDEBUG */
+        
+#ifdef HDF
+    switch(handle->file_type) {
+    case HDF_FILE:
+        if(FAIL == hdf_xdr_NCv1data(handle, vp, offset, vp->type, value))
+            return(-1) ;
+        break;
+    case netCDF_FILE:
+        if( !xdr_NCv1data(handle->xdrs, offset, vp->type, value))
+            return(-1) ;
+        break;
+    }
+#else /* !HDF */
+    if( !xdr_NCv1data(handle->xdrs, offset, vp->type, value))
+        return(-1) ;
+#endif /* !HDF */
+        
+	return(0) ;
+}
+
+
+int ncvarput1(cdfid, varid, coords, value)
+int cdfid ;
+int varid ;
+const long *coords ;
+const ncvoid *value ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvarput1" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+    if(!(handle->flags & NC_RDWR))
+      {
+          NCadvise(NC_EPERM, "%s: NC_NOWRITE", handle->path) ;
+          return(-1) ;
+      }
+	handle->xdrs->x_op = XDR_ENCODE ;
+
+	return( NCvar1io(handle, varid, coords, value) ) ;
+}
+
+int ncvarget1(cdfid, varid, coords, value)
+int cdfid ;
+int varid ;
+const long *coords ;
+ncvoid *value ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvarget1" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+	handle->xdrs->x_op = XDR_DECODE ;
+
+	return( NCvar1io(handle, varid, coords, (Void *)value) ) ;
+}
+
+
+/*
+ * xdr 'count' items of contiguous data of type 'type' at 'where'
+ */
+static bool_t 
+xdr_NCvdata(xdrs, where, type, count, values)
+XDR *xdrs ;
+u_long where ;
+nc_type type ;
+unsigned count ;
+Void *values ;
+{
+	u_long rem = 0 ;
+	bool_t (*xdr_NC_fnct)() ;
+	bool_t stat ;
+	size_t szof ;
+
+	switch(type){
+	case NC_BYTE :
+	case NC_CHAR :
+	case NC_SHORT :
+		rem = where%4 ;
+		where -= rem ; /* round down to nearest word */
+		break ;
+    default:
+        break;
+	}
+	if( !xdr_NCsetpos(xdrs, where) )
+		return(FALSE) ;
+
+	switch(type){
+	case NC_BYTE :
+	case NC_CHAR :
+		if(rem != 0)
+		{
+			unsigned vcount = MIN(count, 4 - rem) ;
+			if(!xdr_NCvbyte(xdrs, (unsigned)rem, vcount, values) )
+				return(FALSE) ;
+			values += vcount ;
+			count -= vcount ;
+		}
+
+		rem = count%4 ; /* tail remainder */
+		count -= rem ;
+		if(!xdr_opaque(xdrs, values, count))
+			return(FALSE) ;
+
+		if(rem != 0)
+		{
+			values += count ;
+			if( !xdr_NCvbyte(xdrs, (unsigned)0, (unsigned)rem ,
+				values) )
+				return(FALSE) ;
+		 	return(TRUE) ;	
+		} /* else */
+		return(TRUE) ;
+	case NC_SHORT :
+		if(rem != 0)
+		{
+			if(!xdr_NCvshort(xdrs, (unsigned)1, (short *)values) )
+				return(FALSE) ;
+			values += sizeof(short) ;
+			count -= 1 ;
+		}
+		rem = count%2 ; /* tail remainder */
+		count -= rem ;
+		if(!xdr_shorts(xdrs, (short *)values, count))
+			return(FALSE) ;
+		if(rem != 0)
+		{
+			values += (count * sizeof(short)) ;
+			return( xdr_NCvshort(xdrs, (unsigned)0,
+				(short *)values) ) ;
+		} /* else */
+		return(TRUE) ;
+	case NC_LONG :
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+		xdr_NC_fnct = xdr_int ;
+#else
+		xdr_NC_fnct = xdr_long ;
+#endif
+		szof = sizeof(nclong) ;
+		break ;
+	case NC_FLOAT :
+		xdr_NC_fnct = xdr_float ;
+		szof = sizeof(float) ;
+		break ;
+	case NC_DOUBLE : 
+		xdr_NC_fnct = xdr_double ;
+		szof = sizeof(double) ;
+		break ;
+	default :
+		return(FALSE) ;
+	}
+	for(stat = TRUE ; stat && (count > 0) ; count--)
+	{
+		stat = (*xdr_NC_fnct)(xdrs,values) ;	
+		values += szof ;
+	}
+	return(stat) ;
+}
+
+
+/*
+ *  For a "hypercube" put/get, compute the largest contiguous block
+ */
+static const long *
+NCvcmaxcontig(handle, vp, origin, edges)
+NC *handle ;
+NC_var *vp ;
+const long *origin ;
+const long *edges ;
+{
+	const long *edp, *orp ;
+	unsigned long *boundary, *shp ;
+	int partial=0;
+
+	if( IS_RECVAR(vp) )
+	{
+		/*     one dimensional   &&  the only 'record' variable  */
+		if(vp->assoc->count == 1 && handle->recsize <= vp->len)
+		{
+				return(edges) ;
+		} /* else */
+		boundary = vp->shape +1 ;
+	}
+	else
+		boundary = vp->shape ;
+
+	/* find max contiguous */
+	shp = vp->shape + vp->assoc->count - 1 ; /* points to last dimension */
+	edp = edges + vp->assoc->count - 1 ;     /* points to last edge */
+	orp = origin + vp->assoc->count - 1 ;
+
+	/* Traverse shp back to the begining of boundary while checking that
+	   each edge is within limit between start coord and max of dimension */
+	for( ; shp >= boundary ; shp--,edp--,orp--)
+	{
+	    if(*edp > *shp - *orp || *edp < 0 )
+	    {
+		NCadvise(NC_EINVAL, "Invalid edge length %d", *edp) ;
+		return(NULL) ;
+	    }
+	    /* Mark that the writing is partial when any edge is smaller than the
+               matching dimension */
+	    if(*edp < *shp )
+	    {
+		partial=1;
+		break ;
+		/* Why do we want to break here?  What if the later edge is out
+		   of limit and we break out as soon as a smaller edge is reached? -BMR */
+	    }
+	}
+	/* When all dimensions have been checked and shp has passed the first element
+	   in boundary and into undefined location, so did edp in edges, move edp
+	   forward once to point to the first element in edges.  -BMR, 4/15/2013 */
+	if(shp < boundary) /* made it all the way */
+		edp++ ;
+
+    /*
+     *   This little check makes certain that if complete "slices" of the
+     *  regular dimensions of an unlimited dimension dataset are being written
+     *  out, it's ok to write out a "block" of all those slices at once. -QAK
+     */
+/*	if( IS_RECVAR(vp) && (edp-1==edges) && !partial)
+        edp=edges;
+*/
+
+	/* shp, edp reference last index s.t. shape[ii] == edge[ii] */
+	return(edp) ;
+}
+
+
+static
+int NCsimplerecio(handle, vp, start, edges, values)
+NC *handle ;
+NC_var *vp ;
+const long *start ;
+const long *edges ;
+Void *values ;
+{
+	long offset ;
+	long newrecs ;
+
+	/* 'start' should be verified as valid upon prior to entry to this
+	 * routine
+	 */
+	if(*edges <= 0)
+      {
+          NCadvise(NC_EINVALCOORDS, "%s: Invalid edge length %ld",
+                   vp->name->values, *edges) ;
+          return -1 ;
+      }
+
+        /* check to see if we are trying to read beyond the end;
+           Modification: (BMR - 11/10/2006) - replaced "handle->numrecs"
+           with "vp->numrecs" to fix bug 525, ie. writing two unlimited
+           1D datasets without closing the file in between the two writes
+           caused the second dataset to contain garbage. */
+	/* After fixing HDFFR-1385, need to reassess this issue. -BMR */
+	newrecs = (*start + *edges) - vp->numrecs ;
+	if(handle->xdrs->x_op != XDR_ENCODE && newrecs > 0)
+      {
+          NCadvise(NC_EINVALCOORDS, "%s: Invalid Coordinates",
+                   vp->name->values) ;
+          return -1 ;
+      }
+
+	offset = NC_varoffset(handle, vp, start) ;
+#ifdef VDEBUG
+	fprintf(stderr, "\t\t %s offset %ld, *edges %lu\n",
+            vp->name->values, offset, *edges ) ;
+	arrayp("\t\t coords", vp->assoc->count, start) ;
+#endif
+
+	if(newrecs > 0)
+		handle->flags |= NC_NDIRTY ;
+
+#ifdef HDF
+    switch(handle->file_type) 
+      {
+      case HDF_FILE:
+          DFKsetNT(vp->HDFtype);
+          if(FAIL == hdf_xdr_NCvdata(handle, vp,
+                                     offset, vp->type, 
+                                     (uint32)*edges, values))
+              return(-1) ;
+          break;
+      case CDF_FILE:
+          DFKsetNT(vp->HDFtype);
+          if(!nssdc_xdr_NCvdata(handle, vp,
+                                offset, vp->type, 
+                                (uint32)*edges, values))
+              return(-1) ;
+          break;
+      case netCDF_FILE:
+          if(!xdr_NCvdata(handle->xdrs,
+                          offset, vp->type, 
+                          (unsigned)*edges, values))
+              return(-1) ;
+          break;
+      }
+#else /* !HDF */
+    if(!xdr_NCvdata(handle->xdrs,
+                    offset, vp->type, 
+                    (unsigned)*edges, values))
+        return(-1) ;
+#endif /* !HDF */
+        
+#ifdef HDF
+	if(newrecs > 0)
+      {
+	/* Update var's numrecs first and then handle->numrecs if the first
+	   exceeds the latter (part of bugzilla 1378, i.e., JIRA HDFFR-167)
+	   - BMR, 12/30/2008 */
+	  vp->numrecs += newrecs;
+	  handle->numrecs = MAX(vp->numrecs, handle->numrecs);
+          if(handle->flags & NC_NSYNC) /* write out header->numrecs NOW */
+            {
+                if(!xdr_numrecs(handle->xdrs, handle) )
+                    return(-1) ;
+                handle->flags &= ~NC_NDIRTY ;
+            }
+      }
+#endif
+	return(0) ;
+}
+
+
+/*
+ * The following routine is not `static' because it is used by the `putgetg'
+ * module for generalized hyperslab access.
+ */
+int NCvario(handle, varid, start, edges, values)
+NC *handle ;
+int varid ;
+const long *start ;
+const long *edges ;
+void *values ;
+{
+
+	NC_var *vp ;
+	const long *edp0, *edp ;
+	unsigned long iocount ;
+
+	if(handle->flags & NC_INDEF)
+		return(-1) ;
+
+	/* find the variable */
+	if(handle->vars == NULL)
+		return(-1) ;
+	vp = NC_hlookupvar( handle, varid ) ;
+	if(vp == NULL)
+		return(-1) ;
+
+#ifdef VDEBUG
+	fprintf(stderr, "Entering NCvario, variable %s\n", vp->name->values ) ;
+	arrayp("start", vp->assoc->count, start) ;
+	arrayp("edges", vp->assoc->count, edges) ;
+#endif /* VDEBUG */
+
+#ifdef HDF
+    if(handle->file_type != netCDF_FILE)
+      {
+          if (FAIL == DFKsetNT(vp->HDFtype))
+              return -1;
+      }
+#endif
+
+	if(vp->assoc->count == 0) /* 'scaler' variable */
+      {
+#ifdef HDF
+          switch(handle->file_type) 
+            {
+            case HDF_FILE:
+                if (FAIL == hdf_xdr_NCv1data(handle, vp, vp->begin, vp->type, values))
+                    return -1;
+                else
+                    return 0;
+            case netCDF_FILE:
+                return(xdr_NCv1data(handle->xdrs, vp->begin, vp->type, values) ?
+                       0 : -1 ) ;
+            }
+#else /* !HDF */
+          return(xdr_NCv1data(handle->xdrs, vp->begin, vp->type, values) ?
+                 0 : -1 ) ;
+#endif /* !HDF */
+      }
+
+	if( !NCcoordck(handle, vp, start) )
+		return(-1) ;
+
+	if( IS_RECVAR(vp) 
+		&& vp->assoc->count == 1
+		&& handle->recsize <= vp->len)
+      {
+          /* one dimensional   &&  the only 'record' variable  */
+          return(NCsimplerecio(handle, vp, start, edges, values)) ;
+      }
+
+	/* find max contiguous, check sanity of edges */
+	edp0 = NCvcmaxcontig(handle, vp, start, edges) ;
+	if(edp0 == NULL)
+		return(-1) ;
+#ifdef VDEBUG
+	fprintf(stderr, "edp0\t%ld\n", (unsigned long)edp0 - (unsigned long)edges) ;
+#endif /* VDEBUG */
+
+	/* now accumulate max count for a single io operation */
+	edp = edges + vp->assoc->count - 1 ; /* count is > 0 at this point */
+	iocount = 1 ;
+	for( ; edp >= edp0 ; edp--)
+		iocount *= *edp ;
+	/* now edp = edp0 - 1 */
+
+	{ /* inline */
+        long  coords[H4_MAX_VAR_DIMS], upper[H4_MAX_VAR_DIMS];
+        long  *cc ;
+        const long *mm ;
+        u_long offset ;
+        size_t szof = nctypelen(vp->type) ;
+
+        /* copy in starting indices */
+        cc = coords ;
+        mm = start ;
+        while(cc < &coords[vp->assoc->count] )
+            *cc++ = *mm++ ;
+#ifdef VDEBUG
+        arrayp("coords", vp->assoc->count, coords) ;
+#endif
+
+        /* set up in maximum indices */
+        cc = upper ;
+        mm = coords ;
+        edp = edges ;
+        while(cc < &upper[vp->assoc->count] )
+            *cc++ = *mm++ + *edp++ ;
+#ifdef VDEBUG
+        arrayp("upper", vp->assoc->count, upper) ;
+#endif
+
+        /* ripple counter */
+        cc = coords ;
+        mm = upper ;
+        while(*coords < *upper)
+          {
+#ifdef VDEBUG
+              fprintf(stderr, "\t*cc %ld, *mm %ld\n",
+                      *cc, *mm) ;
+#endif /* VDEBUG */
+              while( *cc < *mm )
+                {
+#ifdef VDEBUG
+                    fprintf(stderr, "\t\tedp0 %p, edges %p, mm %p, &upper[] %p\n",
+                            edp0, edges, mm, &upper[edp0-edges-1]) ;
+#endif /* VDEBUG */
+                    if(edp0 == edges || mm == &upper[edp0-edges-1])
+                      {
+                          /* doit */
+                          if( !NCcoordck(handle, vp, coords) )
+                              return(-1) ;
+                          offset = NC_varoffset(handle, vp, coords) ;
+#ifdef VDEBUG
+                          fprintf(stderr, "\t\t %s offset %lu, iocount %lu\n",
+                                  vp->name->values, offset, iocount ) ;
+                          arrayp("\t\t coords", vp->assoc->count, coords) ;
+#endif
+
+#ifdef HDF
+                          switch(handle->file_type) 
+                            {
+                            case HDF_FILE:
+                                if(FAIL == hdf_xdr_NCvdata(handle, vp,
+                                                           offset, vp->type, 
+                                                           (uint32)iocount, values))
+                                    return(-1) ;
+                                break;
+                            case CDF_FILE:
+                                if(!nssdc_xdr_NCvdata(handle, vp,
+                                                      offset, vp->type, 
+                                                      (uint32)iocount, values))
+                                    return(-1) ;
+                                break;
+                            case netCDF_FILE:
+                                if(!xdr_NCvdata(handle->xdrs,
+                                                offset, vp->type, 
+                                                (unsigned)iocount, values))
+                                    return(-1) ;
+                                break;
+                            }
+#else /* !HDF */
+                          if(!xdr_NCvdata(handle->xdrs,
+                                          offset, vp->type, 
+                                          (unsigned)iocount, values))
+                              return(-1) ;
+#endif /* !HDF */
+                                
+                          values = (void *)((const uint8 *)values + iocount * szof);
+                          (*cc) += (edp0 == edges ? iocount : 1) ;
+#ifdef VDEBUG
+                          fprintf(stderr, "\t\t *cc %ld, *mm %ld  continue\n",
+                                  *cc, *mm) ;
+#endif /* VDEBUG */
+                          continue ;
+                      }
+                    cc++ ;
+                    mm++ ;
+#ifdef VDEBUG
+                    fprintf(stderr, "\t\t*cc %ld, *mm %ld\n",
+                            *cc, *mm) ;
+#endif /* VDEBUG */
+                }
+#ifdef VDEBUG
+              fprintf(stderr, "\tcc %p, coords %p\n",
+                      cc, coords) ;
+#endif /* VDEBUG */
+              if(cc == coords)
+                {
+#ifdef VDEBUG
+                    fprintf(stderr, "\t break\n") ;
+#endif /* VDEBUG */
+                    break ;
+                }
+              *cc = start[ cc - coords ] ;
+              cc-- ;
+              mm-- ;
+              (*cc)++ ;
+#ifdef VDEBUG
+              fprintf(stderr, "\t*coords %ld, *upper %ld\n",
+                      *coords, *upper) ;
+#endif
+          }
+#ifdef VDEBUG
+        arrayp("coords", vp->assoc->count, coords) ;
+        arrayp("upper", vp->assoc->count, upper) ;
+        fprintf(stderr,"vp->numrecs=%d\n",vp->numrecs);
+        fprintf(stderr,"upper[0]=%d\n",upper[0]);
+#endif
+        /*
+         * This is a kludge to work around the fact the NCcoordck() doesn't
+         * get the upper limits on the slab to write out -QAK
+         */
+        if(upper[0] > vp->numrecs)
+            vp->numrecs=upper[0];
+	} /* end inline */
+
+#ifdef NOTNOW
+    /* Albert and I agree that this check below makes perfect sense, but it
+     * causes the ncdiminq test to fail for unlimited length dimensions.
+     * Perhaps someone with more time can look into this later.  -QAK
+     * Perhaps it is only true for netCDF files. -BMR (2013-06-24)
+     */
+/* HDFFR-1385: the fix for this bug may fix this problem too.-BMR */
+	if (handle->numrecs < vp->numrecs)
+	    handle->numrecs = vp->numrecs;
+#endif /* NOTNOW */
+
+#ifdef VDEBUG
+	fprintf(stderr, "Exiting NCvario\n") ;
+#endif /* VDEBUG */
+	return(0) ;
+}
+
+
+int ncvarput(cdfid, varid, start, edges, values)
+int cdfid ;
+int varid ;
+const long *start ;
+const long *edges ;
+ncvoid *values ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvarput" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+    if(!(handle->flags & NC_RDWR))
+      {
+          NCadvise(NC_EPERM, "%s: NC_NOWRITE", handle->path) ;
+          return(-1) ;
+      }
+	handle->xdrs->x_op = XDR_ENCODE ;
+
+	return( NCvario(handle, varid, start, edges, values) ) ;
+}
+
+
+/* --------------------------- NC_fill_buffer ---------------------------- */
+/*
+ *  Fills the provided array with user-defined fill value _FillValue or
+ *  the default one.  The buffer size to be filled is computed using the
+ *  provided parameter 'edges'.
+ *  -BMR, 2013/8/29
+ */
+int NC_fill_buffer(handle, varid, edges, values)
+NC *handle;		/* file structure */
+int varid;		/* var number in handle->vars list */
+const long *edges;	/* size of the array's edges */
+void *values;		/* buffer to be filled */
+{
+    NC_var *vp ;
+    NC_attr **attr;
+    unsigned long buf_size;
+    int ii;
+
+    /* Find the variable structure */
+    if(handle->vars == NULL)
+	return(-1);
+    vp = NC_hlookupvar(handle, varid);
+    if(vp == NULL)
+	return(-1);
+
+    /* Compute the size of the buffer using the edges */
+    buf_size = 1;
+    for (ii = 0; ii < vp->assoc->count; ii++)
+	buf_size = buf_size * edges[ii];
+
+    /* Find user-defined fill-value and fill the buffer with it */
+    attr = NC_findattr(&vp->attrs, _FillValue);
+    if(attr != NULL)
+	if (HDmemfill(values,(*attr)->data->values,vp->szof,buf_size) == NULL)
+	    return(-1);
+    /* If no user-defined fill-value, fill the buffer with default fill-value */
+    else
+	NC_arrayfill(values, buf_size * vp->szof, vp->type);
+    return 0;
+}
+
+
+/* ---------------------------- ncvarget ----------------------------- */
+/*
+ *  Reads data from the variable 'varid'.  The starting position and size
+ *  of the data are specified by parameters 'start' and 'edges'.
+ *  
+ *  If the requested size exceeds the boundary of the actual data, ncvarget
+ *  will fill the provided buffer with user-defined fill values or the
+ *  default fill values (via NC_fill_buffer.)
+ *
+ *  If the requested size exceeds not only the boundary of the actual data,
+ *  but also the maximum number of records in the file, ncvarget will fail.
+ *
+ *  -BMR, 2013/8/29
+ */
+int ncvarget(cdfid, varid, start, edges, values)
+int cdfid ;
+int varid ;
+const long *start ;
+const long *edges ;
+ncvoid *values ;
+{
+	NC *handle;
+	NC_var *vp;
+	int  status = 0;
+
+	cdf_routine_name = "ncvarget";
+
+	/* Get the file handle */
+	handle = NC_check_id(cdfid);
+	if(handle == NULL)
+		return(-1);
+
+	/* Fill the buffer with fill-values before passing it into NCvario to
+	   read the requested data */
+	status = NC_fill_buffer(handle, varid, edges, values);
+	if (status == FAIL)
+            return(-1);
+
+	handle->xdrs->x_op = XDR_DECODE ;
+
+	return(NCvario(handle, varid, start, edges, (Void *)values));
+}
+
+/* This is the original ncvarget.  Keep for a while just in case. -BMR
+int ncvarget(cdfid, varid, start, edges, values)
+int cdfid ;
+int varid ;
+const long *start ;
+const long *edges ;
+ncvoid *values ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvarget" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+	handle->xdrs->x_op = XDR_DECODE ;
+
+	return( NCvario(handle, varid, start, edges, (Void *)values) ) ;
+}
+ */ 
+
+/* Begin recio */
+
+/*
+ * Returns number of record variables in an open netCDF file,
+ * Optionally fills an array of record variable handles.
+ * Optionally fills an array of record variable ids.
+ * Returns -1 on error.
+ */
+static int
+NCnumrecvars(handle, vpp, recvarids)
+     NC *handle;
+     NC_var **vpp;
+	 int *recvarids;
+{
+	NC_var **dp ;
+	int ii ;
+	int nrecvars = 0;
+
+	if(handle->vars == NULL)
+		return -1 ;
+
+	dp = (NC_var**)handle->vars->values ;
+	for(ii = 0 ; ii < handle->vars->count ; ii++, dp++)
+	{
+		if(IS_RECVAR((*dp)))
+		{
+			if(vpp != NULL)
+				vpp[nrecvars] = *dp ;
+			if(recvarids != NULL)
+				recvarids[nrecvars] = ii ;
+			nrecvars++ ;
+		}
+	}
+	return nrecvars ;
+}
+
+
+static long
+NCelemsPerRec(vp)
+NC_var *vp ;
+{
+	long nelems = 1 ;
+	int jj ;
+	for(jj = 1 ; jj < vp->assoc->count ; jj++)	
+		nelems *= vp->shape[jj] ;
+	return nelems ;
+}
+
+
+/*
+ * Retrieves the number of record variables, the record variable ids, and the
+ * record size of each record variable.  If any pointer to info to be returned
+ * is null, the associated information is not returned.  Returns -1 on error.
+ */
+int
+ncrecinq(cdfid, nrecvars, recvarids, recsizes)
+int cdfid ;
+int *nrecvars ;
+int *recvarids ;
+long *recsizes ;
+{
+	NC *handle ;
+	int nrvars ;
+	NC_var *rvp[H4_MAX_NC_VARS] ; 
+
+	cdf_routine_name = "ncrecinq" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	
+	nrvars = NCnumrecvars(handle, rvp, recvarids) ;
+	if(nrvars == -1)
+		return -1 ;
+
+	if(nrecvars != NULL)
+		*nrecvars = nrvars;
+	
+	if(recsizes != NULL)
+	{
+		int ii ;
+		for(ii = 0 ; ii < nrvars ; ii++)
+		{
+			recsizes[ii] = nctypelen(rvp[ii]->type) * NCelemsPerRec(rvp[ii]) ;
+		}
+	}
+	return nrvars ;
+}
+
+
+static int
+NCrecio(handle, recnum, datap)
+NC *handle ;
+long recnum ;
+Void **datap ;
+{
+	int nrvars ;
+	NC_var *rvp[H4_MAX_NC_VARS] ; 
+	int ii ;
+	long coords[H4_MAX_VAR_DIMS];
+	u_long offset ;
+	unsigned iocount ;
+
+	nrvars = NCnumrecvars(handle, rvp, (int*) NULL) ;
+	if(nrvars == -1)
+		return -1 ; /* TODO: what error message ?*/
+
+	memset(coords, 0, sizeof(coords)) ;
+	coords[0] = recnum ;
+	for(ii = 0 ; ii < nrvars ; ii++)
+      {
+          if(datap[ii] == NULL)
+              continue ;
+          /* else */
+          offset = NC_varoffset(handle, rvp[ii], coords) ;
+          iocount = NCelemsPerRec(rvp[ii]) ;
+
+#ifdef HDF
+          switch(handle->file_type) 
+            {
+            case HDF_FILE:
+                DFKsetNT(rvp[ii]->HDFtype);
+                if(FAIL == hdf_xdr_NCvdata(handle, rvp[ii],
+                                           offset, rvp[ii]->type, 
+                                           (uint32)iocount, datap[ii]))
+                    return(-1) ;
+                break;
+            case CDF_FILE:
+                DFKsetNT(rvp[ii]->HDFtype);
+                if(!nssdc_xdr_NCvdata(handle, rvp[ii],
+                                      offset, rvp[ii]->type, 
+                                      (uint32)iocount, datap[ii]))
+                    return(-1) ;
+                break;
+            case netCDF_FILE:
+                if(!xdr_NCvdata(handle->xdrs,
+                                offset, rvp[ii]->type, 
+                                iocount, datap[ii]))
+                    return(-1) ;
+                break;
+            }
+#else /* !HDF */
+          if(!xdr_NCvdata(handle->xdrs,
+                          offset, rvp[ii]->type, 
+                          iocount, datap[ii]))
+              return(-1) ;
+#endif /* !HDF */
+
+      }
+	return 0 ;
+}
+
+
+/*
+ * Write one record's worth of data, except don't write to variables for which
+ * the address of the data to be written is null.  Return -1 on error.
+ */
+int
+ncrecput(cdfid, recnum, datap)
+int cdfid ;
+long recnum ;
+ncvoid * *datap ;
+{
+	NC *handle ;
+	long unfilled ;
+
+	cdf_routine_name = "ncrecput" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(handle->flags & NC_INDEF )
+		return(-1) ;
+
+	if((unfilled = recnum - handle->numrecs) >= 0)
+	{
+		handle->flags |= NC_NDIRTY ;
+		if( handle->flags & NC_NOFILL )
+		{
+			/* Go directly to jail, do not pass go */
+			handle->numrecs = recnum + 1 ;
+		}
+		else
+		{
+			/* fill out new records */
+			if( !xdr_NCsetpos(handle->xdrs,
+					handle->begin_rec + handle->recsize*handle->numrecs) )
+			{
+				nc_serror("seek, rec %ld", handle->numrecs) ;
+				return(FALSE) ;
+			}
+			for( ; unfilled >= 0 ; unfilled--, handle->numrecs++)
+			{
+				if( !NCfillrecord(handle->xdrs,
+						(NC_var **)handle->vars->values, handle->vars->count) )
+				{
+					nc_serror("NCfillrec, rec %ld", handle->numrecs) ;
+					return(FALSE) ;
+				}
+			}
+		}
+		if(handle->flags & NC_NSYNC) /* write out header->numrecs NOW */
+		{
+			if(!xdr_numrecs(handle->xdrs, handle) )
+				return(FALSE) ;
+			handle->flags &= ~NC_NDIRTY ;
+		}
+	}
+
+	handle->xdrs->x_op = XDR_ENCODE ;
+
+	return( NCrecio(handle, recnum, (Void **)datap) ) ;
+}
+
+
+/*
+ * Read one record's worth of data, except don't read from variables for which
+ * the address of the data to be read is null.  Return -1 on error;
+ */
+int
+ncrecget(cdfid, recnum, datap)
+int cdfid ;
+long recnum ;
+ncvoid **datap ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncrecget" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(handle->flags & NC_INDEF )
+		return(-1) ;
+
+	handle->xdrs->x_op = XDR_DECODE ;
+
+	return( NCrecio(handle, recnum, (Void **)datap) ) ;
+}
diff --git a/mfhdf/libsrc/putgetg.c b/mfhdf/libsrc/putgetg.c
new file mode 100644
index 0000000..8e7bc80
--- /dev/null
+++ b/mfhdf/libsrc/putgetg.c
@@ -0,0 +1,270 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ *
+ *	This file supports netCDF variable I/O for generalized hyperslabs.
+ *	A generalized hyperslab is one in which the locations of the
+ *	memory-resident data values may be arbitrary, though they are 
+ *	constrained to have a regular structure.  In addition, the values 
+ *	of the netCDF variable may be accessed using non-unity strides.
+ *
+ *	$Id: putgetg.c 4963 2007-09-15 17:20:52Z bmribler $
+ */
+
+#include	"local_nc.h"
+
+
+/*
+ * Perform I/O on a generalized hyperslab.  The efficiency of this
+ * implementation is dependent upon caching in the lower layers.
+ */
+#ifndef HDF
+    static 
+#endif
+int
+NCgenio(handle, varid, start, count, stride, imap, values)
+    NC		*handle;
+    int		varid;
+    const long	*start;		/* NULL => first corner */
+    const long	*count;		/* NULL => everything following start[] */
+    const long	*stride;	/* NULL => unity strides */
+    const long	*imap;		/* NULL => same structure as netCDF variable */
+    void	*values ;
+{
+    int		maxidim;	/* maximum dimensional index */
+    NC_var	*vp	= NC_hlookupvar( handle, varid );
+
+    if (vp == NULL)
+	return(-1) ;
+
+    maxidim = vp->assoc->count - 1;
+
+    if (maxidim < 0) {
+	/*
+	 * The variable is a scalar; consequently, there's only one thing 
+	 * to get and only one place to put it.  (Why was I called?)
+	 */
+	return NCvario(handle, varid, start, count, values);
+
+    } else {
+	/*
+	 * The variable is an array.
+	 */
+	int	idim;
+	char	*valp	= values;
+	long	mycount[H4_MAX_VAR_DIMS];
+	long	mystart[H4_MAX_VAR_DIMS];
+	long	mystride[H4_MAX_VAR_DIMS];
+	long	myimap[H4_MAX_VAR_DIMS];
+	long	iocount[H4_MAX_VAR_DIMS];	/* count vector for NCvario() */
+	long	stop[H4_MAX_VAR_DIMS];	/* stop indexes */
+	long	length[H4_MAX_VAR_DIMS];	/* edge lengths in bytes */
+
+	/*
+	 * Verify stride argument.
+	 */
+	for (idim = 0; idim <= maxidim; ++idim) {
+	    if (stride != NULL && stride[idim] < 1) {
+		NCadvise(NC_EINVAL, "Non-positive stride");
+		return(-1) ;
+	    }
+	}
+
+	/*
+	 * Initialize I/O parameters.
+	 */
+	for (idim = maxidim; idim >= 0; --idim) {
+	    mystart[idim]	= start != NULL
+				    ? start[idim]
+				    : 0;
+	    mycount[idim]	= count != NULL
+				    ? count[idim]
+				    : idim == 0 && IS_RECVAR(vp)
+					? handle->numrecs - mystart[idim]
+					: vp->shape[idim] - mystart[idim];
+	    mystride[idim]	= stride != NULL 
+				    ? stride[idim]
+				    : 1;
+	    myimap[idim]	= imap != NULL 
+				    ? imap[idim]
+				    : idim == maxidim
+					? vp->szof
+					: myimap[idim+1] * mycount[idim+1];
+
+	    iocount[idim]	= 1;
+	    length[idim]	= myimap[idim] * mycount[idim];
+	    stop[idim]		= mystart[idim] + mycount[idim]*mystride[idim];
+	}
+
+	/*
+	 * As an optimization, adjust I/O parameters when the fastest 
+	 * dimension has unity stride both externally and internally.
+	 * In this case, the user could have called a simpler routine
+	 * (i.e. ncvarget() or ncvarput()).
+	 */
+	if (mystride[maxidim] == 1 && myimap[maxidim] == vp->szof) {
+	    iocount[maxidim]	= mycount[maxidim];
+	    mystride[maxidim]	= mycount[maxidim];
+	    myimap[maxidim]	= length[maxidim];
+	}
+
+	/*
+	 * Perform I/O.  Exit when done.
+	 */
+	for (;;) {
+	    int		iostat	= NCvario(handle, varid, mystart, iocount, 
+					  (Void*)valp);
+
+	    if (iostat != 0)
+		return iostat;
+
+	    /*
+	     * The following code permutes through the variable's external
+	     * start-index space and it's internal address space.  At the 
+	     * UPC, this algorithm is commonly called `odometer code'.
+	     */
+	    idim = maxidim;
+	carry:
+	    valp		+= myimap[idim];
+	    mystart[idim]	+= mystride[idim];
+	    if (mystart[idim] >= stop[idim]) {
+		mystart[idim]	 = start[idim];
+		valp		-= length[idim];
+		if (--idim < 0)
+		    return 0;
+		goto carry;
+	    }
+	}				/* I/O loop */
+    }					/* variable is array */
+}
+
+
+/*
+ * Generalized hyperslab output.
+ */
+    int
+ncvarputg(cdfid, varid, start, count, stride, imap, values)
+int cdfid ;
+int varid ;
+const long *start ;
+const long *count ;
+const long *stride ;
+const long *imap ;
+ncvoid *values ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvarputg" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+	if(!(handle->flags & NC_RDWR))
+	{
+		NCadvise(NC_EPERM, "%s: NC_NOWRITE", handle->path) ;
+		return(-1) ;
+	}
+	handle->xdrs->x_op = XDR_ENCODE ;
+
+	return NCgenio(handle, varid, start, count, stride, imap, values);
+}
+
+
+/*
+ * Generalized hyperslab input.
+ */
+    int
+ncvargetg(cdfid, varid, start, count, stride, imap, values)
+int cdfid ;
+int varid ;
+const long *start ;
+const long *count ;
+const long *stride ;
+const long *imap ;
+ncvoid *values ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvargetg" ;
+
+	handle = NC_check_id(cdfid) ;
+	if (handle == NULL)
+		return(-1) ;
+
+	handle->xdrs->x_op = XDR_DECODE ;
+
+	return NCgenio(handle, varid, start, count, 
+		       stride, imap, (Void*)values);
+}
+
+
+/*
+ * Stride-oriented hyperslab output.
+ */
+    int
+ncvarputs(cdfid, varid, start, count, stride, values)
+int cdfid ;
+int varid ;
+const long *start ;
+const long *count ;
+const long *stride ;
+ncvoid *values ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvarputs" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+	if(!(handle->flags & NC_RDWR))
+	{
+		NCadvise(NC_EPERM, "%s: NC_NOWRITE", handle->path) ;
+		return(-1) ;
+	}
+	handle->xdrs->x_op = XDR_ENCODE ;
+
+	return NCgenio(handle, varid, start, count, stride, NULL, values);
+}
+
+
+/*
+ * Stride-oriented hyperslab input.
+ */
+    int
+ncvargets(cdfid, varid, start, count, stride, values)
+int cdfid ;
+int varid ;
+const long *start ;
+const long *count ;
+const long *stride ;
+ncvoid *values ;
+{
+	NC *handle ;
+
+	cdf_routine_name = "ncvargets" ;
+
+	handle = NC_check_id(cdfid) ;
+	if (handle == NULL)
+		return(-1) ;
+
+	handle->xdrs->x_op = XDR_DECODE ;
+
+	return NCgenio(handle, varid, start, count, 
+		       stride, (long*)0, (Void*)values);
+}
diff --git a/mfhdf/libsrc/sharray.c b/mfhdf/libsrc/sharray.c
new file mode 100644
index 0000000..e24093d
--- /dev/null
+++ b/mfhdf/libsrc/sharray.c
@@ -0,0 +1,116 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: sharray.c 4963 2007-09-15 17:20:52Z bmribler $ */
+
+#include	"local_nc.h"
+#include	"alloc.h"
+
+/* you may wish to tune this: big on a cray, small on a PC? */
+#define NC_SHRT_BUFSIZ 8192
+#define NC_NSHRTS_PER (NC_SHRT_BUFSIZ/2) /* number of netshorts the buffer holds */
+
+/*
+ * internal function, bulk xdr of an even number of shorts, less than NC_NSHRTS_PER
+ */
+static
+bool_t
+NCxdr_shortsb(xdrs, sp, nshorts)
+	XDR *xdrs;
+	short *sp;
+	u_int nshorts ;
+{
+	unsigned char buf[NC_SHRT_BUFSIZ] ;
+	unsigned char *cp ;
+	unsigned int nbytes = nshorts * 2;
+
+	/* assert(nshorts <= NC_NSHRTS_PER) ; */
+	/* assert(nshorts > 0) ; */
+
+	if(xdrs->x_op == XDR_ENCODE)
+	{
+		for(cp = buf ; cp < &buf[nbytes] ; sp++, cp += 2 )
+		{
+			*(cp +1) = *sp % 256 ;
+			*cp = (*sp >> 8) ;
+		}
+	}
+
+	if(!xdr_opaque(xdrs, (caddr_t)buf, nbytes))
+		return FALSE ;
+	
+	if(xdrs->x_op == XDR_DECODE)
+	{
+		for(cp = buf ; cp < &buf[nbytes] ; sp++, cp += 2 )
+		{
+			*sp = ((*cp & 0x7f) << 8) + *(cp +1) ;
+			if(*cp & 0x80)
+			{
+				/* extern is neg */
+				*sp -= 0x8000 ;
+			}
+		}
+	}
+
+	return TRUE ;
+}
+
+
+/*
+ * Translate an array of cnt short integers at sp.
+ */
+bool_t
+xdr_shorts(xdrs, sp, cnt)
+	XDR *xdrs;
+	short *sp;
+	u_int cnt ;
+{
+	int odd ; /* 1 if cnt is odd, 0 otherwise */
+
+	if(cnt == 0)
+		return TRUE ;	/* ? */
+
+	odd = cnt % 2 ;
+	if(odd) 
+		cnt-- ;
+	/* cnt is even, odd is set if apropos */
+
+	while(cnt > NC_NSHRTS_PER)
+	{
+		if(!NCxdr_shortsb(xdrs, sp, NC_NSHRTS_PER))
+			return FALSE ;
+		/* else */
+		sp += NC_NSHRTS_PER ;
+		cnt -= NC_NSHRTS_PER ;
+	}
+
+	/* we know cnt <= NC_NSHRTS_PER at this point */
+
+	if(cnt != 0)
+	{
+		if(!NCxdr_shortsb(xdrs, sp, cnt))
+			return FALSE ;
+		/* else */
+		sp += cnt ;
+		cnt = 0 ;
+	}
+
+	if(odd)
+		if(!xdr_NCvshort(xdrs, 0, sp))
+			return FALSE ;
+
+	return TRUE ;
+}
diff --git a/mfhdf/libsrc/string.c b/mfhdf/libsrc/string.c
new file mode 100644
index 0000000..223596b
--- /dev/null
+++ b/mfhdf/libsrc/string.c
@@ -0,0 +1,233 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: string.c 4963 2007-09-15 17:20:52Z bmribler $ */
+
+#include	<string.h>
+#include	"local_nc.h"
+#include	"alloc.h"
+
+#ifdef HDF
+static uint32 
+compute_hash(unsigned count, 
+             const char *str)
+{
+    uint32 ret=0;
+    uint32 temp;
+
+     /* check if string is NULL */
+     if (str == NULL)
+         return ret;
+
+    while(count > sizeof(uint32))
+      {
+          HDmemcpy(&temp,str,sizeof(uint32));
+          ret   += temp;
+          str   += sizeof(uint32);
+          count -= sizeof(uint32);
+      } /* end while */
+
+    if(count > 0)
+      {
+          temp=0;
+          HDmemcpy(&temp,str,count);
+          ret+=temp;
+      } /* end if */
+    return(ret);
+} /* end compute_hash() */
+#endif /* HDF */
+
+NC_string *
+NC_new_string(count, str)
+unsigned count ;
+const char *str ;
+{
+	NC_string *ret ;
+	size_t memlen ;
+
+	if(count > H4_MAX_NC_NAME)
+      {
+          NCadvise(NC_EMAXNAME,
+                   "string \"%c%c%c%c%c%c ...\"  length %d exceeds %d",
+                   str[0], str[1], str[2], str[3], str[4], str[5],
+                   count,  H4_MAX_NC_NAME ) ;
+          return NULL ;
+      }
+
+
+	ret = (NC_string *)HDmalloc(sizeof(NC_string)) ;
+	if( ret == NULL )
+		goto alloc_err ;
+	ret->count = count ;
+    ret->len   = count ;
+#ifdef HDF
+    ret->hash = compute_hash(count,str);
+#endif /* HDF */
+	if(count != 0 ) /* allocate */
+      {
+          memlen = count + 1 ;
+          ret->values = (char *)HDmalloc(memlen) ;
+          if(ret->values == NULL)
+              goto alloc_err ;
+          if(str != NULL)
+            {
+#ifdef HDF
+                memcpy(ret->values, str, (size_t)count) ;
+#else
+                (void)strncpy(ret->values, str, count) ;
+#endif
+                ret->values[count] = 0 ;
+            }
+      } else { /* use what what you were given */
+          ret->values = NULL ;
+      }
+	
+	return(ret) ;
+    alloc_err :
+        nc_serror("NC_new_string") ;
+	if(ret != NULL) HDfree(ret) ;
+	return(NULL) ;
+}
+
+
+/*
+ * Free string, and, if needed, its values.
+ *
+ * NOTE: Changed return value to return 'int' 
+ *       If successful returns SUCCEED else FAIL -GV 9/19/97
+ */
+int
+NC_free_string(cdfstr)
+NC_string *cdfstr ;
+{
+    int ret_value = SUCCEED;
+
+	if(cdfstr != NULL)
+      {
+          if(cdfstr->values != NULL)
+              Free(cdfstr->values) ;
+          Free(cdfstr) ;
+      }
+
+#ifdef LATER
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+#endif /* LATER */
+
+    return ret_value;
+}
+
+
+NC_string *
+NC_re_string(old, count, str)
+NC_string *old ;
+unsigned count ;
+const char *str ;
+{
+	if(old->count < count) /* punt */
+      {
+          NCadvise(NC_ENOTINDEFINE,
+                   "Must be in define mode to increase name length %d",
+                   old->count) ;
+          return(NULL) ;
+      }
+
+    if (str == NULL)
+        return NULL;
+
+	(void)memcpy(old->values, str, count) ;
+	(void)memset(old->values + count, 0, (int)old->count - (int)count +1) ;
+        
+    /* make sure len is always == to the string length */
+    old->len = count ;
+#ifdef HDF
+    old->hash = compute_hash(count,str);
+#endif /* HDF */
+
+	return(old) ;
+}
+
+bool_t
+xdr_NC_string(xdrs, spp)
+	XDR *xdrs;
+	NC_string **spp;
+{
+	u_long count ;
+        int status ;
+
+	switch (xdrs->x_op) {
+	case XDR_FREE:
+		NC_free_string((*spp)) ;
+		return(TRUE) ;
+	case XDR_DECODE:
+		/* need the length to pass to new */
+		if (! xdr_u_long(xdrs, &count)) {
+			return (FALSE);
+		}
+		if( count == 0)
+		{
+		   *spp = NULL ;
+		   return(TRUE) ;
+		} /* else */
+		(*spp) = NC_new_string((unsigned)count, (const char *)NULL) ;
+		if((*spp) == NULL)
+			return(FALSE) ;
+		(*spp)->values[count] = 0 ;
+		/* then deal with the characters */
+		status = xdr_opaque(xdrs, (*spp)->values, (*spp)->count);
+
+                /* might be padded */
+                (*spp)->len = strlen((*spp)->values);
+                return(status);
+	case XDR_ENCODE:
+		/* first deal with the length */
+		if(*spp == NULL)
+		{
+			count = 0 ;
+			return( xdr_u_long(xdrs, &count) ) ;
+		} /* else */
+		count = (*spp)->count ;
+		if (! xdr_u_long(xdrs, &count) ) {
+			return (FALSE);
+		}
+		/* then deal with the characters */
+		return (xdr_opaque(xdrs, (*spp)->values, (*spp)->count));
+	}
+	return(FALSE) ;
+}
+
+
+/*
+ * How much space will the xdr'd string take.
+ *
+ */
+int NC_xlen_string(cdfstr)
+NC_string *cdfstr ;
+{
+	int len = 4 ;
+	int rem ;
+	if(cdfstr!=NULL)
+	{
+		len += cdfstr->count ;
+		if( (rem = len%4) != 0)
+			len += 4 - rem ;
+	}
+	return(len) ;
+}
diff --git a/mfhdf/libsrc/var.c b/mfhdf/libsrc/var.c
new file mode 100644
index 0000000..b23d19b
--- /dev/null
+++ b/mfhdf/libsrc/var.c
@@ -0,0 +1,924 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1993, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*	$Id: var.c 5981 2013-12-16 16:27:16Z bmribler $ */
+
+#include	<string.h>
+#include	"local_nc.h"
+#include	"alloc.h"
+
+#ifdef NOT_USED
+static int ncvarcpy(int, int, int);
+#endif /* NOT_USED */
+
+NC_var *
+NC_new_var(name,type,ndims,dims)
+const char *name ;
+nc_type type ;
+int ndims ;
+const int *dims ;
+{
+	NC_var *ret ;
+
+	ret = (NC_var *)HDcalloc(1,sizeof(NC_var)) ;
+	if( ret == NULL )
+		goto alloc_err ;
+
+	ret->name = NC_new_string((unsigned)strlen(name),name) ;
+	if( ret->name == NULL)
+		goto alloc_err ;
+
+	ret->assoc = NC_new_iarray((unsigned)ndims, dims) ;
+	if( ret->assoc == NULL)
+		goto alloc_err ;
+
+	ret->shape = NULL ;
+	ret->dsizes = NULL ;
+	ret->attrs = NULL ;
+	ret->type = type ;
+	ret->len = 0 ;
+	ret->szof = NC_typelen(type) ;
+	ret->begin = 0 ;
+
+#ifdef HDF
+        ret->vgid = 0;
+        ret->data_ref = 0;
+        ret->data_tag = DATA_TAG;  /* Assume normal data unless set   */
+        ret->data_offset = 0;      /* Assume data starts at beginning */
+        ret->block_size = -1;      /* start off with no block size set */
+        ret->numrecs = 0;	   /* Only used in unlimited dimension case */
+        ret->aid = FAIL;
+        ret->ndg_ref = 0;
+        ret->var_type = UNKNOWN;   /* Unknown whether this var is an SDS or a coord var */
+        ret->HDFtype = hdf_map_type(type);
+        ret->HDFsize = DFKNTsize(ret->HDFtype);
+        ret->is_ragged = FALSE;
+        ret->created = FALSE;      /* This is set in SDcreate() if it's a new SDS */
+        ret->set_length = FALSE;   /* This is set in SDwritedata() if the data needs its length set */
+#endif
+
+	return(ret) ;
+alloc_err :
+	nc_serror("NC_new_var") ;
+	return(NULL) ;
+}
+
+
+/*
+ * Free var
+ *
+ * NOTE: Changed return value to return 'int' 
+ *       If successful returns SUCCEED else FAIL -GV 9/19/97
+ */
+intn
+NC_free_var(var)
+NC_var *var ;
+{
+    intn ret_value = SUCCEED;
+
+	if(var != NULL)
+      {
+          if (NC_free_string(var->name) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          if (NC_free_iarray(var->assoc) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          if(var->shape != NULL)
+              Free(var->shape) ;
+          if(var->dsizes != NULL)
+              Free(var->dsizes) ;
+
+          if (NC_free_array(var->attrs) == FAIL)
+            {
+                ret_value = FAIL;
+                goto done;
+            }
+          Free(var) ;
+      }
+
+done:
+    if (ret_value == FAIL)
+      { /* Failure cleanup */
+
+      }
+     /* Normal cleanup */
+
+    return ret_value;
+}
+
+
+/*
+ * 'compile' the shape and len of a variable
+ *  return -1 on error
+ */
+#ifndef HDF
+static 
+#endif
+int NC_var_shape(var, dims)
+NC_var *var ;
+NC_array *dims;
+{
+	unsigned long *shape, *dsizes ;
+	int ii ;
+	unsigned long *shp, *dsp, *op ;
+	int *ip ;
+	NC_dim **dp ;
+	size_t xszof ;
+
+#ifdef HDF
+	xszof = var->HDFsize ; 
+#else
+	xszof = NC_xtypelen(var->type) ;
+#endif
+
+	/* Fixed memory leaks reported in bug# 418. BMR - Apr 8, 01 */
+
+	/*
+	 * Allocate the shape array
+	 */
+	ii = var->assoc->count ;
+	if(ii == 0)
+	{
+		/* scalar var, len == szof */
+		var->len = xszof ;
+		goto out ;
+	}
+	shape = (unsigned long *)HDmalloc(ii * sizeof(unsigned long)) ;
+	if(shape == NULL)
+	{
+		nc_serror("NC_var_shape") ;
+		return(-1) ;
+	}
+
+	/*
+	 * use the user supplied dimension indices
+	 * to determine the shape
+	 */
+	for(ip = var->assoc->values, op = shape
+		; ii > 0 ; ii--)
+	{
+		if(*ip < 0 || *ip >= ((dims != NULL) ? dims->count : 1) )
+		{
+			NCadvise(NC_EBADDIM, "Bad dimension id %d", *ip) ;
+			Free(shape) ;
+			return(-1) ;
+		}
+		dp = (NC_dim **)dims->values + *ip ;
+		*op = (*dp)->size ;
+		if(*op == NC_UNLIMITED && ii != var->assoc->count )
+		{
+			NCadvise(NC_EUNLIMPOS, "NC_UNLIMITED size applied to index other than 0 %d",
+				var->assoc->count - ii) ;
+			Free(shape) ;
+			return(-1) ;
+		}
+		op++ ; ip++ ;
+	}
+
+	/* Free memory if this var already has shape previously allocated */
+	if(var->shape != NULL)
+            Free(var->shape);
+	var->shape = shape ;
+
+	/*
+	 * Allocate the dsizes array
+	 */
+	ii = var->assoc->count ;
+	dsizes = (unsigned long *)HDmalloc(ii * sizeof(unsigned long)) ;
+	if(dsizes == NULL)
+	{
+            Free(shape) ;
+            var->shape = NULL;
+	    nc_serror("NC_var_shape") ;
+	    return(-1) ;
+	}
+
+	/* Free memory if this var already has dsizes previously allocated */
+	if(var->dsizes != NULL)
+            Free(var->dsizes);
+	var->dsizes = dsizes ;
+
+	/* 
+	 * Compute var->len and the dsizes
+	 */
+	shp = shape + var->assoc->count - 1 ; /* count is > 0 here */
+	dsp = dsizes + var->assoc->count - 1 ;
+	var->len = (*shp) ? (*shp) : 1 ; /* boundary condition for rec */
+	var->len = var->len * xszof ;
+	if(dsp != NULL) *dsp = xszof ;
+
+	for( shp--, dsp-- ; shp >= shape ; shp--,dsp--)
+	{
+		*dsp = var->len ;
+		if(shp != shape || *shp ) /* include last mult for non-rec vars */
+			var->len *= *shp ;
+	}
+
+out :
+/* don't round-up for HDF-encoded files */
+#ifdef HDF
+	if (var->cdf->file_type != HDF_FILE)
+#endif
+ 
+	switch(var->type) {
+	case NC_BYTE :
+	case NC_CHAR :
+	case NC_SHORT :
+		if( var->len%4 != 0 )
+		{
+			var->len += 4 - var->len%4 ; /* round up */
+	/*		*dsp += 4 - *dsp%4 ; */
+		}
+    default:
+        break;
+	}
+
+#if 0
+	NCadvise(NC_NOERR, "%s var->len %d, var->szof %d",
+		var->name->values, var->len, var->szof) ;
+	arrayp("\tshape", var->assoc->count, var->shape) ;
+	arrayp("\tdsizes", var->assoc->count, var->dsizes) ;
+#endif
+	return(var->assoc->count) ;
+}
+
+
+int ncvardef(cdfid, name, type, ndims, dims)
+int cdfid ;
+const char *name ;
+nc_type type ;
+int ndims ;
+const int dims[] ;
+{
+	NC *handle ;
+	NC_var *var[1] ;
+	NC_var **dp ;
+	int ii ;
+	int len ;
+
+	cdf_routine_name = "ncvardef" ;
+
+	if( !NC_indefine(cdfid,TRUE) )
+		return(-1) ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+
+	if(!NCcktype(type))
+		return(-1) ;
+
+	if(ndims < 0) /* 0 => scalar */
+      {
+          NCadvise(NC_EINVAL, "Number of dimensions %d < 0", ndims) ;
+          return(-1) ;
+      } 
+
+	if(ndims > 0 )
+      {
+          if(handle->dims == NULL || ndims > handle->dims->count )
+            {
+                NCadvise(NC_EINVAL, "Invalid number of dimensions %d > %d",
+                         ndims, (handle->dims != NULL) ? handle->dims->count : 0) ;
+                return(-1) ;
+            }
+      }
+
+	if(handle->vars == NULL) /* first time */
+      {
+          var[0] = NC_new_var(name,type,ndims,dims) ;
+          if(var[0] == NULL)
+              return(-1) ;
+          handle->vars = NC_new_array(NC_VARIABLE,(unsigned)1,
+                                      (Void *)var) ;
+          if(handle->vars == NULL)
+              return(-1) ;
+      } else if(handle->vars->count >= H4_MAX_NC_VARS)
+        {
+            NCadvise(NC_EMAXVARS, "maximum number of variables %d exceeded",
+                     handle->vars->count ) ;
+            return(-1) ;
+        } else {
+            /* check for name in use */
+            len = strlen(name) ;
+            dp = (NC_var**)handle->vars->values ;
+            for(ii = 0 ; ii < handle->vars->count ; ii++, dp++)
+              {
+                  if( len == (*dp)->name->len &&
+                      strncmp(name, (*dp)->name->values, len) == 0)
+                    {
+                        NCadvise(NC_ENAMEINUSE, "variable \"%s\" in use with index %d",
+                                 (*dp)->name->values, ii) ;
+                        return(-1) ;
+                    }
+              }
+            var[0] = NC_new_var(name,type,ndims,dims) ;
+            if(var[0] == NULL)
+                return(-1) ;
+            if( NC_incr_array(handle->vars, (Void *)var) == NULL)
+                return(-1) ;
+        }
+#ifdef HDF
+    (*var)->cdf = handle; /* for NC_var_shape */
+#endif
+	if( NC_var_shape(*var, handle->dims) != -1)
+      {
+#ifdef HDF
+#ifdef NOT_YET
+          (*var)->ndg_ref = Htagnewref(handle->hdf_file,DFTAG_NDG);
+#else /* NOT_YET */
+          (*var)->ndg_ref = Hnewref(handle->hdf_file);
+#endif /* NOT_YET */
+#endif            
+          return(handle->vars->count -1) ;
+      }
+    /* unwind */
+	handle->vars->count-- ;
+	NC_free_var(var[0]) ;
+	return(-1) ;
+}
+
+
+/*
+ * Recompute the shapes of all variables
+ * Sets handle->begin_rec to start of first record variable
+ * returns -1 on error
+ */
+int NC_computeshapes( handle )
+NC *handle ;
+{
+	NC_var **vbase, **vpp ;
+	NC_var *first = NULL ;
+
+	handle->begin_rec = 0 ;
+	handle->recsize = 0 ;
+
+	if(handle->vars == NULL)
+		return(0) ;
+	vbase = (NC_var **)handle->vars->values ;
+	for( vpp =  vbase ;
+         vpp < &vbase[handle->vars->count] ;
+         vpp ++)
+      {
+#ifdef HDF
+          (*vpp)->cdf= handle;
+#endif
+
+          if( NC_var_shape(*vpp, handle->dims) == -1)
+              return(-1) ;
+          if(IS_RECVAR(*vpp))	
+            {
+                if(first == NULL)	
+                    first = *vpp ;
+                handle->recsize += (*vpp)->len ;
+            }
+      }
+	if(first != NULL)
+      {
+          handle->begin_rec = first->begin ;
+          /*
+           * for special case of exactly one record variable, pack values
+           */
+          if(handle->recsize == first->len)
+              handle->recsize = *first->dsizes ;
+      }
+	return(handle->vars->count) ;
+}
+
+
+int ncvarid( cdfid, name)
+int cdfid ;
+const char *name ;
+{
+	NC *handle ;
+	NC_var **dp ;
+	int ii ;
+	int len ;
+
+	cdf_routine_name = "ncvarid" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(handle->vars == NULL)
+		return(-1) ;
+	len = strlen(name) ;
+	dp = (NC_var**)handle->vars->values ;
+	for(ii = 0 ; ii < handle->vars->count ; ii++, dp++)
+	{
+		if( len == (*dp)->name->len &&
+			strncmp(name, (*dp)->name->values, len) == 0)
+		{
+			return(ii) ;
+		}
+	}
+	NCadvise(NC_ENOTVAR, "variable \"%s\" not found", name) ;
+	return(-1) ;
+}
+
+
+/*
+ * Given valid handle and varid, return var
+ *  else NULL on error
+ */
+NC_var *
+NC_hlookupvar( handle, varid )
+NC *handle ;
+int varid ;
+{
+	NC_array **ap ;
+
+	if(varid == NC_GLOBAL) /* Global is error in this context */
+	{
+		return(NULL) ;
+	}else if(handle->vars != NULL && varid >= 0 && varid < handle->vars->count)
+	{
+		ap = (NC_array **)handle->vars->values ;
+		ap += varid ;
+	} else {
+		NCadvise(NC_ENOTVAR, "%d is not a valid variable id", varid) ;
+		return( NULL ) ;
+	}
+	return((NC_var *)*ap) ;
+}
+
+
+/*
+ * Given cdfid and varid, return var
+ *  else NULL on error
+ */
+static NC_var *
+NC_lookupvar( cdfid, varid )
+int cdfid ;
+int varid ;
+{
+	NC *handle ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(NULL) ;
+
+	return(NC_hlookupvar(handle,varid)) ;
+}
+
+
+int ncvarinq( cdfid, varid, name, typep, ndimsp, dims, nattrsp)  
+int cdfid ;
+int varid ;
+char *name ;
+nc_type *typep ;
+int *ndimsp ;
+int dims[] ;
+int *nattrsp ;
+{
+	NC_var *vp ;
+	int ii ;
+
+	cdf_routine_name = "ncvarinq" ;
+
+	vp = NC_lookupvar( cdfid, varid ) ;
+	if(vp == NULL)
+		return(-1) ;
+
+	if(name != NULL)
+	{
+#ifdef HDF
+		(void)memcpy( name, vp->name->values, vp->name->len) ;
+#else
+		(void)strncpy( name, vp->name->values, vp->name->len) ;
+#endif
+		name[vp->name->len] = 0 ;
+	}
+
+	if(typep != NULL)
+		*typep = vp->type ;
+	if(ndimsp != NULL)
+	{
+		*ndimsp = vp->assoc->count ;
+	}
+	if(dims != NULL)
+	{
+		for(ii = 0 ; ii < vp->assoc->count ; ii++)
+		{
+			dims[ii] = vp->assoc->values[ii] ;
+		}
+	}
+	if(nattrsp != NULL)
+	{
+		if( vp->attrs != NULL)
+		{
+			*nattrsp = vp->attrs->count ;
+		} else {
+			*nattrsp = 0 ;
+		}
+	}
+
+	return(varid) ;
+}
+
+
+int ncvarrename(cdfid, varid, newname)
+int cdfid ;
+int varid ; 
+const char *newname ;
+{
+	
+	NC *handle ;
+	NC_var **vpp ;
+	int ii ;
+	int len ;
+	NC_string *old, *new ;
+
+	cdf_routine_name = "ncvarrename" ;
+
+	handle = NC_check_id(cdfid) ;
+	if(handle == NULL)
+		return(-1) ;
+	if(!(handle->flags & NC_RDWR))
+		return(-1) ;
+
+	/* check for name in use */
+	len = strlen(newname) ;
+	vpp = (NC_var**)handle->vars->values ;
+	for(ii = 0 ; ii < handle->vars->count ; ii++, vpp++)
+	{
+		if( len == (*vpp)->name->len &&
+			strncmp(newname, (*vpp)->name->values, len) == 0)
+		{
+			NCadvise(NC_ENAMEINUSE, "variable name \"%s\" in use with index %d",
+				(*vpp)->name->values, ii) ;
+			return(-1) ;
+		}
+	}
+
+	if(varid == NC_GLOBAL) /* Global is error in this context */
+	{
+		NCadvise(NC_EGLOBAL, "action prohibited on NC_GLOBAL varid") ;
+		return(-1) ;
+	}else if(handle->vars != NULL && varid >= 0 && varid < handle->vars->count)
+	{
+		vpp = (NC_var **)handle->vars->values ;
+		vpp += varid ;
+	} else {
+		NCadvise(NC_ENOTVAR, "%d is not a valid variable id", varid) ;
+		return( -1 ) ;
+	}
+
+	old = (*vpp)->name ;
+	if( NC_indefine(cdfid,TRUE) )
+	{
+		new = NC_new_string((unsigned)strlen(newname),newname) ;
+		if( new == NULL)
+			return(-1) ;
+		(*vpp)->name = new ;
+		NC_free_string(old) ;
+		return(varid) ;
+	} /* else */
+	new = NC_re_string(old, (unsigned)strlen(newname),newname) ;
+	if( new == NULL)
+		return(-1) ;
+	if(handle->flags & NC_HSYNC)
+	{
+		handle->xdrs->x_op = XDR_ENCODE ;
+		if(!xdr_cdf(handle->xdrs, &handle) )
+			return(-1) ;
+		handle->flags &= ~(NC_NDIRTY | NC_HDIRTY) ;
+	} else
+		handle->flags |= NC_HDIRTY ;
+	return(varid) ;
+}
+
+
+#ifdef NOT_USED 
+/*
+ * Given valid handle, name string, and length of the name, get a var.
+ *  else NULL on error
+ */
+static NC_var *
+NC_hvarid(handle, name, namelen)
+NC *handle ;
+const char *name ;
+int namelen ;
+{
+	NC_var **dp ;
+	int ii ;
+	if(handle->vars == NULL)
+		return NULL ;
+	dp = (NC_var**)handle->vars->values ;
+	for(ii = 0 ; ii < handle->vars->count ; ii++, dp++)
+	{
+		if( namelen == (*dp)->name->len &&
+				strncmp(name, (*dp)->name->values, namelen) == 0)
+		{
+			return(*dp) ; /* normal exit */
+		}
+	}
+	return NULL ; /* not found */
+}
+
+
+/*
+ * Copy the values of a variable from an input netCDF to an output netCDF.
+ * Input and output var assummed to have the same shape.
+ * return -1 on error.
+ *
+ * This function added to support the netcdf operators. The interface
+ * is not documented. We plan to supercede it with something more
+ * general in a future release.
+ */
+static int
+ncvarcpy(incdf, varid, outcdf)
+int             incdf;
+int             varid;
+int             outcdf;
+{
+	NC *inhandle, *outhandle ;
+	NC_var *invp, *outvp ;
+	int ndims ;
+	int ii ;
+
+	cdf_routine_name = "ncvarcpy" ;
+
+	inhandle = NC_check_id(incdf) ; 
+	if(inhandle == NULL)
+		return(-1) ;
+
+	if(inhandle->flags & NC_INDEF)
+	{
+		NCadvise(NC_EINDEFINE, "%s in define mode.", inhandle->path) ;
+		return(-1) ;
+	}
+
+	outhandle = NC_check_id(outcdf) ; 
+	if(outhandle == NULL)
+		return(-1) ;
+
+	if(!(outhandle->flags & NC_RDWR))
+	{
+		/* output file isn't writable */
+		NCadvise(NC_EPERM, "%s is not writable", outhandle->path) ;
+		return -1 ;
+	}
+
+	if(outhandle->flags & NC_INDEF)
+	{
+		NCadvise(NC_EINDEFINE, "%s in define mode.", outhandle->path) ;
+		return(-1) ;
+	}
+
+	/* find the variable in the input cdf */
+	if(inhandle->vars == NULL
+			|| (invp = NC_hlookupvar(inhandle, varid )) == NULL)
+	{
+		NCadvise(NC_ENOTVAR, "%s: varid %d not found",
+			inhandle->path, varid) ;
+		return(-1) ;
+	}
+
+	/* find the variable in the output cdf */
+	outvp = NC_hvarid(outhandle, invp->name->values, invp->name->len) ;
+	if(outvp == NULL)
+	{
+		NCadvise(NC_ENOTVAR, "%s: variable %s not found",
+			outhandle->path, invp->name->values) ;
+		return(-1) ;
+	}
+
+	/* can we even attempt to copy without conversion? */
+	if(outvp->type != invp->type)
+	{
+		NCadvise(NC_EINVAL,
+			"Input and output variables must be same type") ;
+		return -1 ;
+	}
+
+	ndims = invp->assoc->count ;
+
+	if (ndims == 0)
+	{
+	/* special case scalar vars */
+		if(outvp->assoc->count != 0)
+		{
+			NCadvise(NC_EINVAL,
+				"Input and output variables must be same shape") ;
+			return -1 ;
+		}
+
+	}
+	else
+	{
+		long end[H4_MAX_VAR_DIMS] ;
+		memcpy(end, invp->shape, ndims * sizeof(unsigned long)) ;
+		if(IS_RECVAR(invp))
+		{
+			/* assert(*end == 0) ; */
+			*end = inhandle->numrecs ;
+		}
+	
+		for(ii = 0 ; ii < ndims ; ii++)
+			end[ii] -- ;
+		/* at this point, end is the largest valid coord of invp */
+		if( !NCcoordck(outhandle, outvp, end) )
+		{
+			NCadvise(NC_EINVAL,
+				"Input and output variables not conformable") ;
+			return -1 ;
+		}
+		/* Fill is side effect of NCcoordck */
+	}
+
+	/* four cases, really not neccessary here, left for future generalization */
+	if(IS_RECVAR(invp))
+	{
+		if(IS_RECVAR(outvp))
+		{
+			long outoff, inoff ;
+			/* both input and output are rec vars */
+			/* check that input fits in output. (per record) */
+			if(invp->len > outvp->len)
+			{
+				NCadvise(NC_EINVALCOORDS,
+					"Output var smaller than input") ;
+				return -1 ;
+			}
+			/* copy the data */
+			outoff = outhandle->begin_rec + outvp->begin ;
+			inoff = inhandle->begin_rec + invp->begin ;
+			outhandle->flags |= NC_NDIRTY ;
+			for(ii=0 ; ii < inhandle->numrecs ; ii++)
+			{
+				if(!xdr_setpos(outhandle->xdrs, outoff))
+				{
+					NCadvise(NC_EXDR, "%s: xdr_setpos", 
+						outhandle->path) ;
+					return -1 ;
+				}
+				if(!xdr_setpos(inhandle->xdrs, inoff))
+				{
+					NCadvise(NC_EXDR, "%s: xdr_setpos", 
+						inhandle->path) ;
+					return -1 ;
+				}
+				/* copy data */
+				if(!NC_dcpy(outhandle->xdrs, inhandle->xdrs, invp->len))
+					return(-1) ;
+				outoff += outhandle->recsize ;
+				inoff += inhandle->recsize ;
+			}
+		}
+		else
+		{
+			NCadvise(NC_EINVAL,
+				"Input and output variables must be same shape") ;
+			return -1 ;
+		}
+	}
+	else
+	{
+		if(IS_RECVAR(outvp))
+		{
+			/* input not rec var, output is rec var */
+			NCadvise(NC_EINVAL,
+				"Input and output variables must be same shape") ;
+			return -1 ;
+		}
+		else
+		{
+			/* both input and output are not rec vars */
+			/* check that input fits in output. */
+			if(invp->len > outvp->len)
+			{
+				NCadvise(NC_EINVALCOORDS,
+					"Output var smaller than input") ;
+				return -1 ;
+			}
+			if(!xdr_setpos(outhandle->xdrs, outvp->begin))
+			{
+				NCadvise(NC_EXDR, "%s: xdr_setpos", 
+					outhandle->path) ;
+				return -1 ;
+			}
+			if(!xdr_setpos(inhandle->xdrs, invp->begin))
+			{
+				NCadvise(NC_EXDR, "%s: xdr_setpos", 
+					inhandle->path) ;
+				return -1 ;
+			}
+			/* copy data */
+			outhandle->flags |= NC_NDIRTY ;
+			if(!NC_dcpy(outhandle->xdrs, inhandle->xdrs, invp->len))
+				return(-1) ;
+		}
+	}
+	return 0 ;
+}
+#endif /* NOT_USED */
+
+
+bool_t
+xdr_NC_var(xdrs, vpp)
+	XDR *xdrs;
+	NC_var **vpp;
+{
+	u_long begin ;
+
+	if( xdrs->x_op == XDR_FREE)
+	{
+		NC_free_var((*vpp)) ;
+		return(TRUE) ;
+	}
+
+	if( xdrs->x_op == XDR_DECODE )
+	{
+		*vpp = (NC_var *)HDcalloc(1,sizeof(NC_var)) ;
+		if( *vpp == NULL )
+		{
+			nc_serror("xdr_NC_var") ;
+			return(FALSE) ;
+		}
+	}
+
+	if( !xdr_NC_string(xdrs, &((*vpp)->name)))
+		return(FALSE) ;
+	if( !xdr_NC_iarray(xdrs, &((*vpp)->assoc)))
+		return(FALSE) ;
+	if( !xdr_NC_array(xdrs, &((*vpp)->attrs)))
+		return(FALSE) ;
+
+#ifdef USE_ENUM
+	if (! xdr_enum(xdrs, (enum_t *)&((*vpp)->type)) ) {
+		return (FALSE);
+	}
+#else
+	if (! xdr_int(xdrs, &((*vpp)->type)) ) {
+		return (FALSE);
+	}
+#endif
+	if (! xdr_u_long(xdrs, &((*vpp)->len)) ) {
+		return (FALSE);
+	}
+
+	if( xdrs->x_op == XDR_DECODE )
+		(*vpp)->szof = NC_typelen((*vpp)->type) ;
+
+	if( xdrs->x_op == XDR_ENCODE )
+ 		begin = (*vpp)->begin ;
+	if (! xdr_u_long(xdrs, &begin))
+		return (FALSE);
+	if( xdrs->x_op == XDR_DECODE )
+		(*vpp)->begin = begin ;
+
+#ifdef HDF
+
+        if( xdrs->x_op == XDR_DECODE ) {
+            
+            (*vpp)->HDFtype = hdf_map_type((*vpp)->type);
+            (*vpp)->HDFsize = DFKNTsize((*vpp)->HDFtype);
+            (*vpp)->aid = FAIL;
+            (*vpp)->is_ragged = FALSE;
+                
+        }
+
+#endif
+
+	return( TRUE ) ;
+}
+
+
+/*
+ * How much space will the xdr'd var take.
+ *
+ */
+int NC_xlen_var(vpp)
+NC_var **vpp ;
+{
+	int len ;
+
+	if(*vpp == NULL)
+		return(4) ;
+
+	len = NC_xlen_string((*vpp)->name) ;
+	len += NC_xlen_iarray((*vpp)->assoc) ;
+	len += NC_xlen_array((*vpp)->attrs) ;
+	len += 12 ;
+
+	return(len) ;
+}
diff --git a/mfhdf/libsrc/xdrposix.c b/mfhdf/libsrc/xdrposix.c
new file mode 100644
index 0000000..8bd6b18
--- /dev/null
+++ b/mfhdf/libsrc/xdrposix.c
@@ -0,0 +1,688 @@
+/*
+ * XDR implementation on POSIX file interface, with buffering
+ *
+ * Copyright (C) 1992, University Corp for Atmospheric Research
+ *
+ * This set of routines implements a XDR on a POSIX file descriptor.
+ * XDR_ENCODE serializes onto the descriptor, XDR_DECODE de-serializes
+ * from the descriptor. As in stdio, we buffer i/o. This XDR is most
+ * useful when the descriptor actually represents a file. It
+ * corrects some performance problems with xdrstdio_getpos() and
+ * xdrstdio_getpos() in the xdr_stdio implementation.
+ *
+ * -glenn
+ */
+/* $Id: xdrposix.c 6043 2014-01-21 21:09:03Z acheng $ */
+
+/*
+ * 32-bit integer on the host architecture (on the CRAY, this is actually 64
+ * bits; however, a pointer to this type is still passed to the XDR functions
+ * x_getlong() and x_putlong(), so, on that platform, it doesn't matter if
+ * the following isn't 32-bits):
+ */
+#ifndef NETLONG
+#   define NETLONG  long
+#endif
+typedef NETLONG     netlong;
+#undef  NETLONG
+
+#   if defined MSDOS || defined WINNT || defined _WIN32
+#       include <io.h>
+#   else
+#       include <unistd.h>
+#   endif
+#   include <fcntl.h>
+
+#include <sys/types.h>
+
+#include <string.h>
+#include "local_nc.h" /* prototypes for NCadvis, nc_error */
+		      /* also obtains <stdio.h>, <rpc/types.h>, &
+		       * <rpc/xdr.h> */
+/*EIP #include "netcdf.h" */ 
+#include "mfhdf.h"
+
+#if !(defined DOS_FS) 
+        typedef u_int ncpos_t ;  /* all unicies */
+#else
+      typedef off_t ncpos_t ;
+#endif
+
+typedef struct {
+    int fd;         /* the file descriptor */   
+    int mode;       /* file access mode, O_RDONLY, etc */
+    int isdirty ;
+    off_t page ;
+    int nread ;     /* number of bytes succesfully read */
+    int nwrote ;    /* number of bytes last write */
+    int cnt ;       /* number of valid bytes in buffer */
+    unsigned char *ptr;         /* next byte */
+#ifdef DOS_FS
+#define BIOBUFSIZ   512
+#else
+#define BIOBUFSIZ   8192
+#endif
+    unsigned char base[BIOBUFSIZ];      /* the data buffer */
+} biobuf;
+
+
+static void
+free_biobuf(abuf)
+biobuf *abuf;
+{
+    if(abuf != NULL)
+	HDfree((VOIDP)abuf) ;
+}
+
+
+static biobuf *
+new_biobuf(fd, fmode)
+int fd;
+int fmode;
+{
+    biobuf *biop ;
+
+    biop = (biobuf *)HDmalloc(sizeof(biobuf)) ;
+    if(biop == NULL)
+        return NULL ;
+    biop->fd = fd ;
+
+    biop->mode = fmode ;
+
+    biop->isdirty = 0 ;
+    biop->page = 0 ;
+    biop->nread = 0 ;
+    biop->nwrote = 0 ;
+    biop->cnt = 0 ;
+    memset(biop->base, 0, ((size_t)(BIOBUFSIZ))) ;
+    biop->ptr = biop->base ;
+
+    return biop ;
+}
+
+
+static int
+rdbuf(biop)
+biobuf *biop;
+{
+    memset(biop->base, 0, ((size_t)(BIOBUFSIZ))) ;
+
+    if(biop->mode & O_WRONLY)
+    {
+        biop->cnt = 0 ;
+    }
+    else
+    {
+        if(biop->nwrote != BIOBUFSIZ)
+        {
+            /* last write wasn't a full block, adjust position ahead */
+            if(lseek(biop->fd, biop->page * BIOBUFSIZ, SEEK_SET) == ((off_t)-1))
+                return -1 ;
+        }
+        biop->nread = biop->cnt = read(biop->fd, (VOIDP)biop->base, BIOBUFSIZ) ;
+    }
+    biop->ptr = biop->base ;
+    return biop->cnt ;
+}
+
+
+static int
+wrbuf(biop)
+biobuf *biop;
+{
+
+    if(!((biop->mode & O_WRONLY) || (biop->mode & O_RDWR))
+        || biop->cnt == 0) 
+    {
+        biop->nwrote = 0 ;
+    }
+    else
+    {
+        if(biop->nread != 0)
+        {
+            /* if we read something, we have to adjust position back */
+            if(lseek(biop->fd, biop->page * BIOBUFSIZ, SEEK_SET) == ((off_t)-1))
+                return -1 ;
+        }
+        biop->nwrote = write(biop->fd, (VOIDP)biop->base, biop->cnt) ;
+    }
+    biop->isdirty = 0 ;
+
+    return biop->nwrote ;
+}
+
+static int
+nextbuf(biop)
+biobuf *biop;
+{
+    if(biop->isdirty)
+    {
+        if(wrbuf(biop) < 0)
+            return -1 ;
+    }
+
+    biop->page++ ;
+
+    /* read it in */
+    if(rdbuf(biop) < 0 )
+        return -1 ;
+
+    return biop->cnt ;
+}
+
+
+#define CNT(p) ((p)->ptr - (p)->base)
+/* # of unread bytes in buffer */
+#define REM(p) ((p)->cnt - CNT(p)) 
+/* available space for write in buffer */
+#define BREM(p) (BIOBUFSIZ - CNT(p))
+
+static int
+bioread(biop, ptr, nbytes)
+biobuf *biop;
+unsigned char *ptr;
+int nbytes;
+{
+    int ngot = 0 ;
+    size_t rem ; 
+
+    if(nbytes == 0)
+        return 0 ;  
+
+    while(nbytes > (rem = REM(biop)))
+    {
+        if(rem > 0)
+        {
+            (void) memcpy(ptr, biop->ptr, rem) ;
+            ptr += rem ;
+            nbytes -= rem ;
+            ngot += rem ;
+        }
+        if(nextbuf(biop) <= 0)
+            return ngot ;
+    }
+    /* we know nbytes <= REM at this point */
+    (void) memcpy(ptr, biop->ptr, (size_t)nbytes) ;
+    biop->ptr += nbytes ;
+    ngot += nbytes ;
+    return ngot ;
+}
+
+
+static int
+biowrite(biop, ptr, nbytes)
+biobuf *biop;
+unsigned char *ptr;
+int nbytes;
+{
+    size_t rem ;
+    int nwrote = 0 ;
+    int cnt ;
+
+    if(!((biop->mode & O_WRONLY) || (biop->mode & O_RDWR)))
+        return -1 ;
+
+    while(nbytes > (rem = BREM(biop)))
+    {
+        if(rem > 0)
+        {
+            (void) memcpy(biop->ptr, ptr, rem) ;
+            biop->isdirty = !0 ;
+            biop->cnt = BIOBUFSIZ ;
+            ptr += rem ;
+            nbytes -= rem ;
+            nwrote += rem ;
+        }
+        if(nextbuf(biop) < 0)
+            return nwrote ;
+    }
+    /* we know nbytes <= BREM at this point */
+    (void) memcpy(biop->ptr, ptr, (size_t)nbytes) ;
+    biop->isdirty = !0 ;
+    biop->ptr += nbytes ;
+    if((cnt = CNT(biop)) > biop->cnt)
+        biop->cnt = cnt ;
+    nwrote += nbytes ;
+
+    return nwrote ;
+}
+
+
+static bool_t   xdrposix_getlong();
+static bool_t   xdrposix_putlong();
+#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || defined __powerpc64__
+static bool_t   xdrposix_getint();
+static bool_t   xdrposix_putint();
+#endif
+static bool_t   xdrposix_getbytes();
+static bool_t   xdrposix_putbytes();
+static ncpos_t  xdrposix_getpos();
+static bool_t   xdrposix_setpos();
+#if (_MIPS_SZLONG == 64)
+static long *    xdrposix_inline();
+#else
+#if (defined __sun && defined _LP64)
+static rpc_inline_t *    xdrposix_inline();
+#else
+#if ((defined __x86_64__ ) && !(defined __sun && defined _LP64)) || defined __powerpc64__
+static int32_t *    xdrposix_inline();
+#else
+#if (defined __alpha )
+static int *    xdrposix_inline();
+#else
+static netlong *    xdrposix_inline(); 
+#endif
+#endif
+#endif
+#endif
+static void xdrposix_destroy();
+
+/*
+ * Ops vector for posix type XDR
+ */
+static struct xdr_ops   xdrposix_ops = {
+    xdrposix_getlong,   /* deserialize a 32-bit int */
+    xdrposix_putlong,   /* serialize a 32-bit int */
+#if (_MIPS_SZLONG == 64)
+    /* IRIX64 has 64 bits long and 32 bits int. */
+    /* It defines two extra entries for get/put int. */
+    xdrposix_getint,   /* deserialize a 32-bit int */
+    xdrposix_putint,   /* serialize a 32-bit int */
+#endif
+    xdrposix_getbytes,  /* deserialize counted bytes */
+    xdrposix_putbytes,  /* serialize counted bytes */
+    xdrposix_getpos,    /* get offset in the stream */
+    xdrposix_setpos,    /* set offset in the stream */
+    xdrposix_inline,    /* prime stream for inline macros */
+#if (defined __sun && defined _LP64) || defined __x86_64__ || defined __powerpc64__
+    xdrposix_destroy,   /* destroy stream */
+#if !(defined __x86_64__) && !(defined __powerpc64__) || (defined  __sun && defined _LP64) /* i.e. we are on SUN/Intel in 64-bit mode */
+    NULL,               /* no xdr_control function defined */
+#endif 
+    /* Solaris 64-bit (arch=v9 and arch=amd64) has 64 bits long and 32 bits int. */
+    /* It defines the two extra entries for get/put int. here */
+    xdrposix_getint,   /* deserialize a 32-bit int */
+    xdrposix_putint    /* serialize a 32-bit int */
+#else
+#ifdef AIX5L64
+    xdrposix_destroy,
+    NULL,
+    NULL,
+    xdrposix_getint,
+    xdrposix_putint
+#else /*AIX5L64 */
+    xdrposix_destroy    /* destroy stream */
+#endif /*AIX5L64 */
+#endif
+};
+
+
+/*
+ * Fake an XDR initialization for HDF files
+ */
+void
+hdf_xdrfile_create(xdrs, ncop)
+     XDR *xdrs;
+     int ncop;
+{
+    biobuf *biop = new_biobuf(-1, 0) ;
+    
+    if(ncop & NC_CREAT)
+        xdrs->x_op = XDR_ENCODE;
+    else
+        xdrs->x_op = XDR_DECODE;
+        
+    xdrs->x_ops = &xdrposix_ops;
+    xdrs->x_private = (caddr_t) biop;
+    
+} /* hdf_xdrfile_create */
+
+
+/*
+ * Initialize a posix xdr stream.
+ * Sets the xdr stream handle xdrs for use on the file descriptor fd.
+ * Operation flag is set to op.
+ */
+static int
+xdrposix_create(xdrs, fd, fmode, op)
+    XDR *xdrs;
+    int fd;
+    int fmode;
+    enum xdr_op op;
+{
+
+    biobuf *biop = new_biobuf(fd, fmode) ;
+#ifdef XDRDEBUG
+fprintf(stderr,"xdrposix_create(): xdrs=%p, fd=%d, fmode=%d, op=%d\n",xdrs,fd,fmode,(int)op);
+fprintf(stderr,"xdrposix_create(): after new_biobuf(), biop=%p\n",biop);
+#endif
+    xdrs->x_op = op;
+    xdrs->x_ops = &xdrposix_ops;
+    xdrs->x_private = (caddr_t) biop ;
+    /* unused */
+    xdrs->x_handy = 0;
+    xdrs->x_base = 0;
+    if(biop == NULL)
+        return -1 ;
+    
+    /* if write only, or just created (empty), done */
+    if((biop->mode & O_WRONLY)
+            || (biop->mode & O_CREAT))
+        return 0 ;
+
+#ifdef XDRDEBUG
+fprintf(stderr,"xdrposix_create(): before rdbuf()\n");
+#endif
+    /* else, read the first bufferful */
+    return( rdbuf(biop) ) ;
+}
+
+/*
+ * "sync" a posix xdr stream.
+ */
+static int
+xdrposix_sync(xdrs)
+    XDR *xdrs;
+{
+    biobuf *biop = (biobuf *)xdrs->x_private ;
+    if(biop->isdirty)
+    {
+        /* flush */
+        if(wrbuf(biop) < 0)
+            return -1 ;
+    }
+
+    biop->nwrote = 0 ; /* force seek in rdbuf */
+
+    /* read it in */
+    if(rdbuf(biop) < 0 )
+        return -1 ;
+
+    return biop->cnt ;
+}
+
+
+/*
+ * Destroy a posix xdr stream.
+ * Cleans up the xdr stream handle xdrs previously set up by xdrposix_create.
+ */
+static void
+xdrposix_destroy(xdrs)
+    XDR *xdrs;
+{
+    /* flush */
+    biobuf *biop = (biobuf *)xdrs->x_private ;
+    if(biop->isdirty)
+    {
+        (void) wrbuf(biop) ;
+    }
+    if(biop->fd != -1) 
+            (void) close(biop->fd) ;
+    free_biobuf(biop);
+}
+
+static bool_t
+xdrposix_getlong(xdrs, lp)
+    XDR *xdrs;
+#if (defined __alpha) 
+    int *lp;
+#else
+    long *lp;
+#endif
+{
+    unsigned char *up = (unsigned char *)lp ;
+#if (defined AIX5L64 || defined __powerpc64__ || (defined __hpux && __LP64__))  
+    *lp = 0 ;
+    up += (sizeof(long) - 4) ;
+#endif
+    if(bioread((biobuf *)xdrs->x_private, up, 4) < 4)
+        return (FALSE);
+#ifdef SWAP
+    *lp =  ntohl(*lp);
+#endif
+    return (TRUE);
+}
+
+static bool_t
+xdrposix_putlong(xdrs, lp)
+    XDR *xdrs;
+#if (defined __alpha) 
+    int *lp;
+#else
+    long *lp;
+#endif
+{
+
+    unsigned char *up = (unsigned char *)lp ;
+#ifdef SWAP
+    netlong mycopy = htonl(*lp);
+    up = (unsigned char *)&mycopy;
+#endif
+#if (defined AIX5L64  || defined __powerpc64__ || (defined __hpux && __LP64__))
+    up += (sizeof(long) - 4) ;
+#endif
+
+    if (biowrite((biobuf *)xdrs->x_private, up, 4) < 4)
+        return (FALSE);
+    return (TRUE);
+}
+
+static bool_t
+xdrposix_getbytes(xdrs, addr, len)
+    XDR *xdrs;
+    caddr_t addr;
+#if (defined __alpha) || (defined __hpux && defined __ia64)
+    int len;
+#else
+    u_int len;
+#endif
+{
+
+    if ((len != 0)
+            && (bioread((biobuf *)xdrs->x_private, (unsigned char *)addr, (int)len) != len))
+        return (FALSE);
+    return (TRUE);
+}
+
+static bool_t
+xdrposix_putbytes(xdrs, addr, len)
+    XDR *xdrs;
+    caddr_t addr;
+#if (defined __alpha) || (defined __hpux && defined __ia64)
+    int len;
+#else
+    u_int len;
+#endif
+{
+
+    if ((len != 0)
+            && (biowrite((biobuf *)xdrs->x_private, (unsigned char *)addr, (int)len) != len))
+        return (FALSE);
+    return (TRUE);
+}
+
+static ncpos_t
+xdrposix_getpos(xdrs)
+    XDR *xdrs;
+{
+
+    biobuf *biop = (biobuf *)xdrs->x_private ;
+    return (BIOBUFSIZ * biop->page + CNT(biop));
+}
+
+static bool_t
+xdrposix_setpos(xdrs, pos) 
+    XDR *xdrs;
+    ncpos_t pos;
+{ 
+    biobuf *biop = (biobuf *)xdrs->x_private ;
+    off_t page ;
+    int index ;
+    int nread ;
+    page = pos / BIOBUFSIZ ;
+    index = pos % BIOBUFSIZ ;
+    if(page != biop->page)
+    {
+        if(biop->isdirty)
+        {
+            if( wrbuf(biop) < 0)
+                return FALSE ;
+        }
+        if(page != biop->page +1)
+            biop->nwrote = 0 ; /* force seek in rdbuf */
+
+        biop->page = page ;
+    
+        nread = rdbuf(biop) ;
+        if(nread < 0
+                || ((biop->mode & O_RDONLY) && nread < index))
+            return FALSE ;
+    }
+    biop->ptr = biop->base + index ;
+    return TRUE ;
+}
+
+/*ARGSUSED*/
+#if (_MIPS_SZLONG == 64)
+static long *
+#else
+#if (defined __sun && defined _LP64)
+static rpc_inline_t *
+#else
+#if (defined  __alpha)
+static int* 
+#else
+#if ((defined  __x86_64__) && !(defined __sun && defined _LP64)) || defined __powerpc64__
+static int32_t * 
+#else
+static netlong * 
+#endif
+#endif
+#endif
+#endif
+xdrposix_inline(xdrs, len)
+    XDR *xdrs;
+#if (defined  __alpha) || (defined __hpux && defined __ia64)
+int 
+#else
+    u_int
+#endif
+          len;
+
+{
+
+    /*
+     * Must do some work to implement this: must insure
+     * enough data in the underlying posix buffer,
+     * that the buffer is aligned so that we can indirect through a
+     * netlong *, and stuff this pointer in xdrs->x_buf.
+     */
+    return (NULL);
+}
+
+#if (_MIPS_SZLONG == 64) || (defined __sun && defined _LP64) || defined AIX5L64  || defined __x86_64__ || defined __powerpc64__
+
+static bool_t
+xdrposix_getint(xdrs, lp)
+    XDR *xdrs;
+    int *lp;
+{
+    unsigned char *up = (unsigned char *)lp ;
+    if(bioread((biobuf *)xdrs->x_private, up, 4) < 4)
+        return (FALSE);
+#ifdef SWAP
+    *lp = ntohl(*lp);
+#endif
+    return (TRUE);
+}
+
+static bool_t
+xdrposix_putint(xdrs, lp)
+    XDR *xdrs;
+    int *lp;
+{
+
+    unsigned char *up = (unsigned char *)lp ;
+#ifdef SWAP
+    netlong mycopy = htonl(*lp);
+    up = (unsigned char *)&mycopy;
+#endif
+    if (biowrite((biobuf *)xdrs->x_private, up, 4) < 4)
+        return (FALSE);
+    return (TRUE);
+}
+#endif /* end of xdrposix_put(get)int */
+
+int
+NCxdrfile_sync(xdrs)
+XDR *xdrs ;
+{
+    return xdrposix_sync(xdrs) ;
+}
+
+int
+NCxdrfile_create(xdrs, path, ncmode)
+XDR *xdrs ;
+const char *path ;
+int ncmode ;
+{
+    int fmode ;
+    int  fd ;
+    enum xdr_op op ;
+
+#ifdef XDRDEBUG
+fprintf(stderr,"NCxdrfile_create(): XDR=%p, path=%s, ncmode=%d\n",xdrs,path,ncmode);
+#endif
+    switch(ncmode & 0x0f) {
+    case NC_NOCLOBBER :
+        fmode = O_RDWR | O_CREAT | O_EXCL ;
+        break ;
+    case NC_CLOBBER :
+        fmode = O_RDWR | O_CREAT | O_TRUNC ;
+        break ;
+    case NC_WRITE :
+        fmode = O_RDWR ;
+        break ;
+    case NC_NOWRITE :
+        fmode = O_RDONLY ;
+        break ;
+    default:
+        NCadvise(NC_EINVAL, "Bad flag %0x", ncmode & 0x0f) ;
+        return(-1) ;
+    }
+#ifdef DOS_FS
+    /*
+     * set default mode to binary to suppress the expansion of
+     * 0x0f into CRLF
+     */
+    if(_fmode != O_BINARY)
+        _fmode = O_BINARY ;
+#endif
+    fd = open(path, fmode, 0666) ;
+#ifdef XDRDEBUG
+fprintf(stderr,"NCxdrfile_create(): fmode=%d, fd=%d\n",fmode,fd);
+#endif
+    if( fd == -1 )
+    {
+        nc_serror("filename \"%s\"", path) ;
+        return(-1) ;
+    } /* else */
+
+    if( ncmode & NC_CREAT )
+    {
+        op = XDR_ENCODE ;
+    } else {
+        op = XDR_DECODE ;
+    }
+    
+#ifdef XDRDEBUG
+fprintf(stderr,"NCxdrfile_create(): before xdrposix_create()\n");
+#endif
+    if(xdrposix_create(xdrs, fd, fmode, op) < 0)
+        return -1 ;
+    /* else */
+#ifdef XDRDEBUG
+fprintf(stderr,"NCxdrfile_create(): after xdrposix_create()\n");
+#endif
+    return fd ;
+}
diff --git a/mfhdf/libsrc/xdrstdio.c b/mfhdf/libsrc/xdrstdio.c
new file mode 100644
index 0000000..5c68b00
--- /dev/null
+++ b/mfhdf/libsrc/xdrstdio.c
@@ -0,0 +1,347 @@
+#if !defined(lint)
+static char rcsid[] = "$Id: xdrstdio.c 510 1993-05-03 21:27:09Z chouck $";
+#endif
+
+/*
+ * xdr_stdio.c, XDR implementation on standard i/o file.
+ *
+ * This set of routines implements a XDR on a stdio stream.
+ * XDR_ENCODE serializes onto the stream, XDR_DECODE de-serializes
+ * from the stream.
+ *
+ * Based on Sun sources from the portable distribution:
+ *
+ * @(#)xdr_stdio.c	1.1 87/11/04 3.9 RPCSRC
+ * @(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ *  UCAR/Unidata modifications for netcdf:
+ *  	_destroy closes the stream.
+ *      current stream position cached in x_public
+ *			 (assumes caddr_t can hold a long)
+ *      last op cached in x_handy
+ */
+
+#include <stdio.h>
+#include "local_nc.h" /* prototypes for NCadvis, nc_error */
+		      /* also obtains <stdio.h>, <rpc/types.h>, &
+		       * <rpc/xdr.h> */
+#ifdef DOS_FS
+#include    <fcntl.h>   /* O_BINARY */
+#define USE_BFLAG
+#endif
+
+#ifdef USE_XDRNCSTDIO
+
+
+#define XDRNC_LASTOP(xdrs) (*((enum xdr_op*)&((xdrs)->x_handy)))
+#define XDRNC_POS(xdrs) (*((long*)&((xdrs)->x_public)))
+
+
+static bool_t	xdrNCstdio_getlong();
+static bool_t	xdrNCstdio_putlong();
+static bool_t	xdrNCstdio_getbytes();
+static bool_t	xdrNCstdio_putbytes();
+static u_long	xdrNCstdio_getpos();
+static bool_t	xdrNCstdio_setpos();
+static long *	xdrNCstdio_inline();
+static void	xdrNCstdio_destroy();
+
+/*
+ * Ops vector for stdio type XDR
+ */
+static struct xdr_ops	xdrNCstdio_ops = {
+	xdrNCstdio_getlong,	/* deserialize a long int */
+	xdrNCstdio_putlong,	/* serialize a long int */
+	xdrNCstdio_getbytes,	/* deserialize counted bytes */
+	xdrNCstdio_putbytes,	/* serialize counted bytes */
+	xdrNCstdio_getpos,	/* get offset in the stream */
+	xdrNCstdio_setpos,	/* set offset in the stream */
+	xdrNCstdio_inline,	/* prime stream for inline macros */
+	xdrNCstdio_destroy	/* destroy stream */
+};
+
+/*
+ * Initialize a stdio xdr stream.
+ * Sets the xdr stream handle xdrs for use on the stream file.
+ * Operation flag is set to op.
+ */
+void
+xdrNCstdio_create(xdrs, file, op)
+	XDR *xdrs;
+	FILE *file;
+	enum xdr_op op;
+{
+
+	xdrs->x_op = op;
+	xdrs->x_ops = &xdrNCstdio_ops;
+	xdrs->x_private = (caddr_t)file;
+	xdrs->x_handy = 0;
+	xdrs->x_base = 0;
+	XDRNC_LASTOP(xdrs) = XDR_FREE ;
+	XDRNC_POS(xdrs) = ftell(file) ;
+}
+
+/*
+ * Destroy a NCstdio xdr stream.
+ * Cleans up the xdr stream handle xdrs previously set up by xdrNCstdio_create.
+ * This function closes the stream.
+ */
+static void
+xdrNCstdio_destroy(xdrs)
+	XDR *xdrs;
+{
+	(void)fclose((FILE *)xdrs->x_private);
+}
+
+static bool_t
+xdrNCstdio_getlong(xdrs, lp)
+	XDR *xdrs;
+	long *lp;
+{
+	if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+	{
+		XDRNC_POS(xdrs) = ftell((FILE *)xdrs->x_private);
+		return (FALSE);
+	}
+#ifdef SWAP
+	*lp = ntohl(*lp);
+#endif
+	XDRNC_POS(xdrs) += sizeof(long) ;
+	return (TRUE);
+}
+
+static bool_t
+xdrNCstdio_putlong(xdrs, lp)
+	XDR *xdrs;
+	long *lp;
+{
+#ifdef SWAP
+	long mycopy = htonl(*lp);
+	lp = &mycopy;
+#endif
+	if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+	{
+		XDRNC_POS(xdrs) = ftell((FILE *)xdrs->x_private);
+		return (FALSE);
+	}
+	XDRNC_POS(xdrs) += sizeof(long) ;
+	return (TRUE);
+}
+
+static bool_t
+xdrNCstdio_getbytes(xdrs, addr, len)
+	XDR *xdrs;
+	caddr_t addr;
+	u_int len;
+{
+	if ((len != 0) && (fread(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
+	{
+		XDRNC_POS(xdrs) = ftell((FILE *)xdrs->x_private);
+		return (FALSE);
+	}
+	XDRNC_POS(xdrs) += len ;
+	return (TRUE);
+}
+
+static bool_t
+xdrNCstdio_putbytes(xdrs, addr, len)
+	XDR *xdrs;
+	caddr_t addr;
+	u_int len;
+{
+	if ((len != 0) && (fwrite(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
+	{
+		XDRNC_POS(xdrs) = ftell((FILE *)xdrs->x_private);
+		return (FALSE);
+	}
+	XDRNC_POS(xdrs) += len ;
+	return (TRUE);
+}
+
+static u_long
+xdrNCstdio_getpos(xdrs)
+	XDR *xdrs;
+{
+	XDRNC_POS(xdrs) = ftell((FILE *)xdrs->x_private);
+	return ((u_long)XDRNC_POS(xdrs));
+}
+
+static bool_t
+xdrNCstdio_setpos(xdrs, pos) 
+	XDR *xdrs;
+	u_long pos;
+{ 
+	if(xdrs->x_op == XDRNC_LASTOP(xdrs) && pos == XDRNC_POS(xdrs))
+		return TRUE ;
+	/* else */
+	XDRNC_LASTOP(xdrs) = xdrs->x_op ;
+	if (fseek((FILE *)xdrs->x_private,(long)pos, 0) < 0)
+	{
+		XDRNC_POS(xdrs) = ftell((FILE *)xdrs->x_private);
+		return (FALSE);
+	}
+	/* else */
+	XDRNC_POS(xdrs) = pos ;
+	return TRUE ;
+}
+
+/*ARGSUSED*/
+static long *
+xdrNCstdio_inline(xdrs, len)
+	XDR *xdrs;
+	u_int len;
+{
+
+	/*
+	 * Must do some work to implement this: must insure
+	 * enough data in the underlying stdio buffer,
+	 * that the buffer is aligned so that we can indirect through a
+	 * long *, and stuff this pointer in xdrs->x_buf.  Doing
+	 * a fread or fwrite to a scratch buffer would defeat
+	 * most of the gains to be had here and require storage
+	 * management on this buffer, so we don't do this.
+	 */
+	return (NULL);
+}
+#else
+
+/*
+ * Destroy a stdio xdr stream.
+ * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
+ * This function closes the stream, while the default
+ * library function, xdrstdio_destroy() which merely flushes it.
+ */
+static void
+xdrNCstdio_destroy(xdrs)
+	XDR *xdrs;
+{
+	(void)fclose((FILE *)xdrs->x_private);
+}
+
+static bool_t
+xdrNCstdio_setpos(xdrs, pos) 
+	XDR *xdrs;
+	u_long pos;
+{ 
+
+	static XDR *last = NULL ;
+	static enum xdr_op lastop = XDR_FREE ;
+
+	if(xdrs == last && xdrs->x_op == lastop && pos == xdr_getpos(xdrs))
+		return TRUE ;
+	/* else */
+	last = xdrs ;
+	lastop = xdrs->x_op ;
+	if (fseek((FILE *)xdrs->x_private,(long)pos, 0) < 0)
+	{
+		return (FALSE);
+	}
+	/* else */
+	return TRUE ;
+}
+
+#endif /* USE_XDRNCSTDIO */
+
+
+/********/
+
+#include <unistd.h> /* access(), F_OK */
+#ifndef F_OK
+#define F_OK    0
+#endif
+
+#include "netcdf.h" /* NC_ */
+#include "local_nc.h" /* prototypes for NCadvis, nc_error */
+
+#ifndef USE_BFLAG 	/* Doesn't Understand the "b" (binary flag to fopen) */
+#define CREAT_FOPENFLAGS "w+"
+#define WRITE_FOPENFLAGS "r+"
+#define NOWRITE_FOPENFLAGS "r"
+#else
+#define CREAT_FOPENFLAGS "w+b"
+#define WRITE_FOPENFLAGS "r+b"
+#define NOWRITE_FOPENFLAGS "rb"
+#endif /* !USE_BFLAG */
+
+
+/*
+ * "sync" (flush) xdr stream.
+ */
+int
+NCxdrfile_sync(xdrs)
+	XDR *xdrs;
+{
+	/* assumes xdrstdio, violates layering */
+	FILE *fp = (FILE *)xdrs->x_private ;
+	if(fflush(fp) == 0)
+		return 0 ; /* success */
+	/* else, failure */
+	return -1 ; 
+}
+
+
+int
+NCxdrfile_create(xdrs, path, ncmode)
+XDR *xdrs ;
+const char *path ;
+int ncmode ;
+{
+	char *fmode ;
+	FILE *fp ;
+	enum xdr_op op ;
+
+	switch(ncmode & 0x0f) {
+	case NC_NOCLOBBER :
+		if( access(path, F_OK) != -1 )
+		{
+			NCadvise(NC_EEXIST, "\"%s\": File exists", path) ;
+			return(-1) ;
+		}
+		/* fall into */
+	case NC_CLOBBER :
+		fmode = CREAT_FOPENFLAGS ;
+		break ;
+	case NC_WRITE :
+		fmode = WRITE_FOPENFLAGS ;
+		break ;
+	case NC_NOWRITE :
+		fmode = NOWRITE_FOPENFLAGS ;
+		break ;
+	default:
+		NCadvise(NC_EINVAL, "Bad flag %0x", ncmode & 0x0f) ;
+		return(-1) ;
+	}
+
+#ifdef DOS_FS
+	/*
+ 	 * set default mode to binary to suppress the expansion of
+	 * 0x0f into CRLF
+	 */
+	if(_fmode != O_BINARY)
+		_fmode = O_BINARY ;
+#endif
+	fp = fopen(path, fmode) ;
+	if( fp == NULL )
+	{
+		nc_serror("filename \"%s\"", path) ;
+		return(-1) ;
+	} /* else */
+
+	if( ncmode & NC_CREAT )
+	{
+		op = XDR_ENCODE ;
+	} else {
+		op = XDR_DECODE ;
+	}
+	
+#ifndef USE_XDRNCSTDIO
+	xdrstdio_create(xdrs, fp, op) ;
+	xdrs->x_ops->x_destroy = xdrNCstdio_destroy ;
+	xdrs->x_ops->x_setpostn = xdrNCstdio_setpos ;
+#else
+	xdrNCstdio_create(xdrs, fp, op) ;
+#endif
+
+	return fileno(fp) ;
+}
diff --git a/mfhdf/ncdump/CMakeLists.txt b/mfhdf/ncdump/CMakeLists.txt
new file mode 100644
index 0000000..72fa42d
--- /dev/null
+++ b/mfhdf/ncdump/CMakeLists.txt
@@ -0,0 +1,61 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_NCDUMP)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+SET (ncdump_SRCS
+    ${HDF4_MFHDF_NCDUMP_SOURCE_DIR}/dumplib.c
+    ${HDF4_MFHDF_NCDUMP_SOURCE_DIR}/ncdump.c
+    ${HDF4_MFHDF_NCDUMP_SOURCE_DIR}/vardata.c
+    ${HDF4_SOURCE_DIR}/mfhdf/util/getopt.c
+)
+  
+ADD_EXECUTABLE (ncdump ${ncdump_SRCS})
+TARGET_C_PROPERTIES (ncdump " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (ncdump ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET} )
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (ncdump ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_NAMING (ncdump ${LIB_TYPE})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+
+INSTALL_PROGRAM_PDB (ncdump ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+
+INSTALL (
+    TARGETS
+        ncdump
+    RUNTIME DESTINATION
+        ${HDF4_INSTALL_TOOLS_BIN_DIR}
+    COMPONENT
+        toolsapplications
+)
+
+
diff --git a/mfhdf/ncdump/CMakeTests.cmake b/mfhdf/ncdump/CMakeTests.cmake
new file mode 100644
index 0000000..76528eb
--- /dev/null
+++ b/mfhdf/ncdump/CMakeTests.cmake
@@ -0,0 +1,76 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME NCDUMP-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        test0.nc
+        test1.nc
+        test1.cdl
+        test2.cdl
+)
+IF (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (NCDUMP-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+ELSE (NOT "${last_test}" STREQUAL "")
+  SET_TESTS_PROPERTIES (NCDUMP-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "NCDUMP-clearall-objects")
+
+#-- Copy all the data files from the test directory into the source directory
+#MESSAGE (STATUS " Copying ${HDF4_MFHDF_NCDUMP_SOURCE_DIR}/test0.cdl to ${PROJECT_BINARY_DIR}/")
+ADD_CUSTOM_COMMAND (
+    TARGET     ncdump
+    POST_BUILD
+    COMMAND    ${CMAKE_COMMAND}
+    ARGS       -E copy_if_different ${HDF4_MFHDF_NCDUMP_SOURCE_DIR}/test0.cdl ${PROJECT_BINARY_DIR}/test0.cdl
+)
+
+IF (NCGEN_UTILITY)
+  ADD_TEST (
+      NAME NCDUMP-test0.nc
+      COMMAND $<TARGET_FILE:ncgen> -o test0.nc -n test0.cdl
+  )
+  SET_TESTS_PROPERTIES (NCDUMP-test0.nc PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  SET (last_test "NCDUMP-test0.nc")
+
+  ADD_TEST (
+      NAME NCDUMP-test1.cdl
+      COMMAND "${CMAKE_COMMAND}"
+          -D "TEST_PROGRAM=$<TARGET_FILE:ncdump>"
+          -D "TEST_ARGS:STRING=test0.nc"
+          -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+          -D "TEST_OUTPUT=test1.cdl"
+          -D "TEST_EXPECT=0"
+          -D "TEST_SKIP_COMPARE=TRUE"
+          -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+  )
+  SET_TESTS_PROPERTIES (NCDUMP-test1.cdl PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  SET (last_test "NCDUMP-test1.cdl")
+
+  ADD_TEST (
+      NAME NCDUMP-test1.nc
+      COMMAND $<TARGET_FILE:ncgen> -o test1.nc -n test1.cdl
+  )
+  SET_TESTS_PROPERTIES (NCDUMP-test1.nc PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  SET (last_test "NCDUMP-test1.nc")
+
+  ADD_TEST (
+      NAME NCDUMP-test2.cdl
+      COMMAND "${CMAKE_COMMAND}"
+          -D "TEST_PROGRAM=$<TARGET_FILE:ncdump>"
+          -D "TEST_ARGS:STRING=-n;test0;test1.nc"
+          -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+          -D "TEST_OUTPUT=test2.cdl"
+          -D "TEST_EXPECT=0"
+          -D "TEST_REFERENCE=test1.cdl"
+          -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+  )
+  SET_TESTS_PROPERTIES (NCDUMP-test2.cdl PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  SET (last_test "NCDUMP-test2.cdl")
+ENDIF (NCGEN_UTILITY)
diff --git a/mfhdf/ncdump/Makefile.am b/mfhdf/ncdump/Makefile.am
new file mode 100644
index 0000000..af388be
--- /dev/null
+++ b/mfhdf/ncdump/Makefile.am
@@ -0,0 +1,39 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+## Add ncdump specific linker flags here
+ncdump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+TEST_SCRIPT = testncdump.sh
+check_SCRIPTS = testncdump.sh
+
+bin_PROGRAMS = ncdump
+man1_MANS = ncdump.1
+
+## Information for building the "ncdump" program
+ncdump_SOURCES = dumplib.c ncdump.c vardata.c
+ncdump_LDADD = $(LIBMFHDF) $(LIBHDF)
+ncdump_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += test0.nc nctest0.cdl
+
+DISTCLEANFILES =
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/ncdump/Makefile.in b/mfhdf/ncdump/Makefile.in
new file mode 100644
index 0000000..b50ba0a
--- /dev/null
+++ b/mfhdf/ncdump/Makefile.in
@@ -0,0 +1,888 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/testncdump.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+bin_PROGRAMS = ncdump$(EXEEXT)
+TESTS = $(TEST_SCRIPT)
+subdir = mfhdf/ncdump
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = testncdump.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_ncdump_OBJECTS = dumplib.$(OBJEXT) ncdump.$(OBJEXT) \
+	vardata.$(OBJEXT)
+ncdump_OBJECTS = $(am_ncdump_OBJECTS)
+ncdump_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ncdump_LDFLAGS) \
+	$(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(ncdump_SOURCES)
+DIST_SOURCES = $(ncdump_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man1_MANS)
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog test0.nc nctest0.cdl
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+ncdump_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+#############################################################################
+TEST_SCRIPT = testncdump.sh
+check_SCRIPTS = testncdump.sh
+man1_MANS = ncdump.1
+ncdump_SOURCES = dumplib.c ncdump.c vardata.c
+ncdump_LDADD = $(LIBMFHDF) $(LIBHDF)
+ncdump_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+DISTCLEANFILES = 
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/ncdump/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/ncdump/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+testncdump.sh: $(top_builddir)/config.status $(srcdir)/testncdump.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+ncdump$(EXEEXT): $(ncdump_OBJECTS) $(ncdump_DEPENDENCIES) $(EXTRA_ncdump_DEPENDENCIES) 
+	@rm -f ncdump$(EXEEXT)
+	$(ncdump_LINK) $(ncdump_OBJECTS) $(ncdump_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dumplib.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncdump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardata.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-man1: $(man1_MANS)
+	@$(NORMAL_INSTALL)
+	@list1='$(man1_MANS)'; \
+	list2=''; \
+	test -n "$(man1dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.1[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@list='$(MANS)'; if test -n "$$list"; then \
+	  list=`for p in $$list; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+	  if test -n "$$list" && \
+	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+	    echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
+	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+	    echo "       typically 'make maintainer-clean' will remove them" >&2; \
+	    exit 1; \
+	  else :; fi; \
+	else :; fi
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-binPROGRAMS clean-generic clean-libtool cscopelist \
+	ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-man1 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-binPROGRAMS uninstall-man \
+	uninstall-man1
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/ncdump/depend b/mfhdf/ncdump/depend
new file mode 100644
index 0000000..1603bda
--- /dev/null
+++ b/mfhdf/ncdump/depend
@@ -0,0 +1,28 @@
+dumplib.o: dumplib.c
+dumplib.o: ../../mfhdf/libsrc/netcdf.h
+dumplib.o: ../../hdf/src//hlimits.h
+dumplib.o: dumplib.h
+ncdump.o: ncdump.c
+ncdump.o: ../../mfhdf/libsrc/local_nc.h
+ncdump.o: ../../mfhdf/libsrc/netcdf.h
+ncdump.o: ../../hdf/src//hlimits.h
+ncdump.o: ../../hdf/src//hdf.h
+ncdump.o: ../../hdf/src//hdfi.h
+ncdump.o: ../../hdf/src//hntdefs.h
+ncdump.o: ../../hdf/src//htags.h
+ncdump.o: ../../hdf/src//hbitio.h
+ncdump.o: ../../hdf/src//hcomp.h
+ncdump.o: ../../hdf/src//herr.h
+ncdump.o: ../../hdf/src//hproto.h
+ncdump.o: ../../hdf/src//vg.h
+ncdump.o: ../../hdf/src//hfile.h
+ncdump.o: ../../hdf/src//tbbt.h
+ncdump.o: ncdump.h
+ncdump.o: dumplib.h
+ncdump.o: vardata.h
+vardata.o: vardata.c
+vardata.o: ../../mfhdf/libsrc/netcdf.h
+vardata.o: ../../hdf/src//hlimits.h
+vardata.o: ncdump.h
+vardata.o: dumplib.h
+vardata.o: vardata.h
diff --git a/mfhdf/ncdump/dumplib.c b/mfhdf/ncdump/dumplib.c
new file mode 100644
index 0000000..f18c7e8
--- /dev/null
+++ b/mfhdf/ncdump/dumplib.c
@@ -0,0 +1,231 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *   $Id: dumplib.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef NO_STDARG
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include"h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "dumplib.h"
+
+/*
+ * Print error message to stderr, don't exit
+ */
+#ifndef NO_STDARG
+void
+error(const char *fmt, ...)
+#else
+/*VARARGS1*/
+void
+error(fmt, va_alist)
+     const char *fmt ;
+     va_dcl
+#endif
+{
+    va_list args ;
+
+    (void) fprintf(stderr,"*** %s: ", progname);
+
+#ifndef NO_STDARG
+    va_start(args, fmt) ;
+#else
+    va_start(args) ;
+#endif
+    (void) vfprintf(stderr,fmt,args) ;
+    va_end(args) ;
+
+    (void) fprintf(stderr, "\n") ;
+    (void) fflush(stderr);	/* to ensure log files are current */
+}
+
+#define LINEPIND	"    "	/* indent of continued lines */
+
+static int linep;
+static int max_line_len;
+
+void
+set_indent(in)
+     int in;
+{
+    linep = in;
+}
+
+
+void
+set_max_len(len)
+     int len;
+{
+    max_line_len = len-2;
+}
+
+
+void
+lput(cp)
+     const char *cp;
+{
+    int nn = strlen(cp);
+
+    if (nn+linep > max_line_len && nn > 2) {
+	(void) fputs("\n", stdout);
+	(void) fputs(LINEPIND, stdout);
+	linep = strlen(LINEPIND);
+    }
+    (void) fputs(cp,stdout);
+    linep += nn;
+}
+
+
+static char *formats[] =
+{
+    "%d",			/* bytes, shorts */
+    "%s",			/* char arrays as strings */
+    "%ld",			/* longs */
+    "%.7g ",			/* floats */
+    "%.15g"			/* doubles */
+};
+
+
+/* In case different formats specified with -d option, set them here. */
+void
+set_formats(flt, dbl)
+     char *flt;
+     char *dbl;
+{
+    strcpy(formats[3], flt);
+    strcpy(formats[4], dbl);
+}
+
+
+static char *
+has_c_format_att(ncid, varid)
+    int ncid;			/* netcdf id */
+    int varid;			/* variable id */
+{
+    nc_type cfmt_type;
+    int cfmt_len;
+    int savopts;
+#define C_FMT_NAME	"C_format" /* name of C format attribute */
+#define	MAX_CFMT_LEN	100	/* max length of C format attribute */
+    static char cfmt[MAX_CFMT_LEN];
+    
+    /*
+     * turn off error handling, we expect ncattinq to fail if there is no
+     * C_format attribute
+     */
+    savopts = ncopts;
+    ncopts = 0;
+    if (ncattinq(ncid, varid, "C_format", &cfmt_type, &cfmt_len) != -1) {
+	ncopts = savopts;	/* restore error handling */
+	if (cfmt_type == NC_CHAR && cfmt_len > 0 && cfmt_len < MAX_CFMT_LEN) {
+	    if (ncattget(ncid, varid, "C_format", (void *)cfmt) != -1)
+	      return &cfmt[0];
+	}
+    }
+    ncopts = savopts;		/* restore error handling */
+    return 0;
+}
+
+
+/*
+ * Determine print format to use for each value for this variable.  Use value
+ * of attribute C_format if it exists, otherwise a sensible default.
+ */
+const char *
+get_fmt(ncid, varid, type)
+     int ncid;			/* netcdf id */
+     int varid;			/* variable id */
+     nc_type type;		/* netCDF data type */
+{
+    char *c_format_att = has_c_format_att(ncid, varid);
+
+    /* If C_format attribute exists, return it */
+    if (c_format_att)
+      return c_format_att;    
+
+    /* Otherwise return sensible default. */
+    switch (type) {
+      case NC_BYTE:
+	return formats[0];
+      case NC_CHAR:
+	return formats[1];
+      case NC_SHORT:
+	return formats[0];
+      case NC_LONG:
+ 	return formats[2];
+      case NC_FLOAT:
+	return formats[3];
+      case NC_DOUBLE:
+	return formats[4];
+      default:
+	error("pr_vals: bad type");
+    return NULL;
+    }
+}
+
+
+static vnode*
+newvnode()
+{
+    vnode *newvp = (vnode*) malloc(sizeof(vnode));
+    
+    if (!newvp) {
+	error("out of memory!");
+	exit(EXIT_FAILURE);
+    }
+    return newvp;
+}
+
+
+vnode*
+newvlist()
+{
+    vnode *vp = newvnode();
+
+    vp -> next = 0;
+    vp -> id = -1;		/* bad id */
+
+    return vp;
+}
+
+
+void
+varadd(vlist, varid)
+     vnode* vlist;
+     int varid;
+{
+    vnode *newvp = newvnode();
+    
+    newvp -> next = vlist -> next;
+    newvp -> id = varid;
+    vlist -> next = newvp;
+}
+
+
+int
+varmember(vlist, varid)
+     vnode* vlist;
+     int varid;
+{
+    vnode *vp = vlist -> next;
+
+    for (; vp ; vp = vp->next)
+      if (vp->id == varid)
+	return 1;
+    return 0;    
+}
+
diff --git a/mfhdf/ncdump/dumplib.h b/mfhdf/ncdump/dumplib.h
new file mode 100644
index 0000000..9de6b32
--- /dev/null
+++ b/mfhdf/ncdump/dumplib.h
@@ -0,0 +1,96 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: dumplib.h 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+extern char *progname;		/* for error messages */
+
+#ifndef EXIT_FAILURE
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#endif
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Print error message to stderr, don't exit */
+#ifndef MIPSEL /* punt */
+#ifndef NO_STDARG
+extern void error(const char *fmt, ...);
+#else
+extern void error();
+#endif
+#endif
+
+/*
+extern void	error		PROTO((
+				       char *fmt,
+				       ...
+				       ));
+*/
+
+/* set position in line before lput() calls */
+extern void	set_indent	PROTO((
+				       int indent
+				       ));
+
+/* set maximum line length */
+extern void	set_max_len	PROTO((
+				       int len
+				       ));
+
+/* splits lines to keep them short */
+extern void	lput		PROTO((
+				       const char *string
+				       ));
+
+/* In case different formats specified with -d option, set them here. */
+extern void	set_formats	PROTO((
+				       char *flt_fmt,
+				       char *dbl_fmt
+				       ));
+
+/* Determine print format to use for each value for this variable. */
+const char *		get_fmt		PROTO((
+				       int ncid,
+				       int varid,
+				       nc_type type
+				       ));
+
+/* structure for list of variables specified with -v option */
+struct vnode
+{
+    struct vnode* next;
+    int id;
+};
+typedef struct vnode vnode;
+
+/* Get new variable list */
+extern vnode*	newvlist	PROTO((
+				       void
+				       ));
+
+/* Add a variable id to variable list */
+extern void	varadd		PROTO((
+				       vnode* vlist,
+				       int varid
+				       ));
+
+/* Test if a variable id is in variable list */
+extern int	varmember	PROTO((
+				       vnode* vlist,
+				       int varid
+				       ));
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mfhdf/ncdump/ncdump.1 b/mfhdf/ncdump/ncdump.1
new file mode 100644
index 0000000..3b53597
--- /dev/null
+++ b/mfhdf/ncdump/ncdump.1
@@ -0,0 +1,171 @@
+.\" $Id: ncdump.1 2364 1996-03-26 22:34:11Z georgev $
+.TH NCDUMP 1 "$Date: 1996-03-26 16:34:11 -0600 (Tue, 26 Mar 1996) $" "Printed: \n(yr-\n(mo-\n(dy" "UNIDATA UTILITIES"
+.SH NAME
+ncdump \- Convert netCDF files to ASCII form (CDL)
+.SH SYNOPSIS
+.ft B
+.HP
+ncdump
+.nh
+\%[-c]
+\%[-h]
+\%[-v \fIvar1,...\fP]
+\%[-b \fIlang\fP]
+\%[-f \fIlang\fP]
+\%[-l \fIlen\fP]
+\%[-n \fIname\fP]
+\%[-d \fIf_digits[,d_digits]\fP]
+\%\fIfile\fP
+.hy
+.ft
+.SH DESCRIPTION
+\fBncdump\fP generates an ASCII representation of a specified netCDF file on
+standard output.  The ASCII representation is in a form called CDL
+(``network Common Data form Language'') that can be viewed, edited, or serve
+as input to \fBncgen\fP.  \fBncgen\fP is a companion program that can
+generate a binary netCDF file from a CDL file.  Hence \fBncgen\fP and
+\fBncdump\fP can be used as inverses to transform the data representation
+between binary and ASCII representations.  See \fBncgen\fP for a description
+of CDL and netCDF representations.
+.LP
+\fBncdump\fP defines a default format used for each type of netCDF data, but
+this can be changed if a `C_format' attribute is defined for a netCDF
+variable.  In this case, \fBncdump\fP will use the `C_format' attribute to
+format each value.  For example, if floating-point data for the netCDF
+variable `Z' is known to be accurate to only three significant digits, it
+would be appropriate to use the variable attribute
+.RS
+.HP
+Z:C_format = "%.3g"
+.RE
+.LP
+\fBncdump\fP may also be used as a simple browser for netCDF data
+files, to display the dimension names and sizes; variable names, types,
+and shapes; attribute names and values; and optionally, the values of
+data for all variables or selected variables in a netCDF file.
+.SH OPTIONS
+.IP "\fB-c\fP"
+Show the values of \fIcoordinate\fP variables (variables that are also
+dimensions) as well as the declarations of all dimensions, variables, and
+attribute values.  Data values of non-coordinate variables are not included
+in the output.  This is the most suitable option to use for a brief look at
+the structure and contents of a netCDF file.
+.IP "\fB-h\fP"
+Show only the \fIheader\fP information in the output, that is the
+declarations of dimensions, variables, and attributes but no data values for
+any variables.  The output is identical to using the \fB-c\fP option except
+that the values of coordinate variables are not included.  (At most one of
+\fB-c\fP or \fB-h\fP options may be present.)
+.IP "\fB-v\fP \fIvar1,...,varn\fP"
+The output will include data values for the specified variables, in addition
+to the declarations of all dimensions, variables, and attributes.  One or
+more variables must be specified by name in the comma-delimited list
+following this option.  The list must be a single argument to the command,
+hence cannot contain blanks or other white space characters.  The named
+variables must be valid netCDF variables in the input-file.  The default,
+without this option and in the absence of the \fB-c\fP or \fB-h\fP
+options, is to include data values for \fIall\fP variables in the output.
+.IP "\fB-b\fP \fIlang\fP"
+A brief annotation in the form of a CDL comment (text beginning with the
+characters ``//'') will be included in the data section of the output for
+each `row' of data, to help identify data values for multidimensional
+variables.  If \fIlang\fP begins with `C' or `c', then C language
+conventions will be used (zero-based indices, last dimension varying
+fastest).  If \fIlang\fP begins with `F' or `f', then Fortran language
+conventions will be used (one-based indices, first dimension varying
+fastest).  In either case, the data will be presented in the same order;
+only the annotations will differ.  This option is useful for browsing
+through large volumes of multidimensional data.
+.IP "\fB-f\fP \fIlang\fP"
+Full annotations in the form of trailing CDL comments (text beginning with
+the characters ``//'') for every data value (except individual characters in
+character arrays) will be included in the data section.  If \fIlang\fP
+begins with `C' or `c', then C language conventions will be used (zero-based
+indices, last dimension varying fastest).  If \fIlang\fP begins with `F' or
+`f', then Fortran language conventions will be used (one-based indices,
+first dimension varying fastest).  In either case, the data will be
+presented in the same order; only the annotations will differ.  This option
+may be useful for piping data into other filters, since each data value
+appears on a separate line, fully identified.
+.IP "\fB-l\fP \fIlen\fP"
+Changes the default maximum line length (80) used in formatting lists of
+non-character data values.
+.IP "\fB-n\fP \fIname\fP"
+CDL requires a name for a netCDF data set, for use by \fBncgen -b\fP in
+generating a default netCDF file name.  By default, \fIncdump\fP constructs
+this name from the last component of the pathname of the input netCDF file
+by stripping off any extension it has.  Use the \fB-n\fP option to specify a
+different name.  Although the output file name used by \fBncgen -b\fP can be
+specified, it may be wise to have \fIncdump\fP change the default name to
+avoid inadvertantly overwriting a valuable netCDF file when using
+\fBncdump\fP, editing the resulting CDL file, and using \fBncgen -b\fP to
+generate a new netCDF file from the edited CDL file.
+.IP "\fB-d\fP \fIfloat_digits[,double_digits]\fP"
+Specifies default number of significant digits to use in displaying
+floating-point or double precision data values for variables that don't have
+a `C_format' attribute.  Floating-point data will be displayed with
+\fIfloat_digits\fP significant digits.  If \fIdouble_digits\fP is also
+specified, double-precision values will be displayed with that many
+significant digits.  If a variable has a `C_format' attribute, that
+overrides any specified floating-point default.  In the absence of any
+\fB-d\fP specifications, floating-point and double-precision data are
+displayed with 7 and 15 significant digits respectively.  CDL files can be
+made smaller if less precision is required.  If both floating-point and
+double-presision precisions are specified, the two values must appear
+separated by a comma (no blanks) as a single argument to the command.
+If you really want every last bit of precision from the netCDF file
+represented in the CDL file for all possible floating-point values, you will
+have to specify this with \fB-d 9,17\fP (according to Theorem 15 of the
+paper listed under REFERENCES).
+
+.SH EXAMPLES
+.LP
+Look at the structure of the data in the netCDF file `\fBfoo.nc\fP':
+.RS
+.HP
+ncdump -c foo.nc
+.RE
+.LP
+Produce an annotated CDL version of the structure and data in the
+netCDF file `\fBfoo.nc\fP', using C-style indexing for the annotations:
+.RS
+.HP
+ncdump -b c foo.nc > foo.cdl
+.RE
+.LP
+Output data for only the variables `uwind' and `vwind' from the netCDF file
+`\fBfoo.nc\fP', and show the floating-point data with only three significant
+digits of precision:
+.RS
+.HP
+ncdump -v uwind,vwind -d 3 foo.nc
+.RE
+.LP
+Produce a fully-annotated (one data value per line) listing of the data for
+the variable `omega', using Fortran conventions for indices, and changing the
+netCDF dataset name in the resulting CDL file to `omega':
+.RS
+.HP
+ncdump -v omega -f fortran -n omega foo.nc > Z.cdl
+.RE
+.SH REFERENCES
+ \fIWhat
+Every Computer Scientist should Know About Floating-Point Arithmetic\fP, D.
+Goldberg, \fBACM Computing Surveys, Vol. 23, No. 1\fP, March 1991, pp. 5-48.
+
+.SH "SEE ALSO"
+.LP
+.BR ncgen (1),
+.BR netcdf (3)
+.SH BUGS
+.LP
+Character arrays that contain a null-byte are treated like C strings, so no
+characters after the null byte appear in the output.
+
+Multidimensional character string arrays are not handled well, since the CDL
+syntax for breaking a long character string into several shorter lines is
+weak.
+
+There should be a way to specify that the data should be displayed in
+`record' order, that is with the all the values for `record' variables
+together that have the same value of the record dimension.
diff --git a/mfhdf/ncdump/ncdump.c b/mfhdf/ncdump/ncdump.c
new file mode 100644
index 0000000..aa68645
--- /dev/null
+++ b/mfhdf/ncdump/ncdump.c
@@ -0,0 +1,741 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/README file for copying and redistribution conditions.
+ *   $Id: ncdump.c 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "local_nc.h"
+
+#include "ncdump.h"
+#include "dumplib.h"
+#include "vardata.h"
+
+static const char * type_name(nc_type type);
+
+char *progname;
+struct ncdim dims[H4_MAX_NC_DIMS]; /* dimensions */
+long vdims[H4_MAX_NC_DIMS];	/* dimension sizes for a single variable */
+
+static void
+usage()
+{
+#define USAGE   "\
+  [-V]             Display version of the HDF4 library and exit\n\
+  [-c]             Coordinate variable data and header information\n\
+  [-h]             Header information only, no data\n\
+  [-u]             Replace nonalpha-numerics in names with underscores\n\
+  [-v var1[,...]]  Data for variable(s) <var1>,... only\n\
+  [-b [c|f]]       Brief annotations for C or Fortran indices in data\n\
+  [-f [c|f]]       Full annotations for C or Fortran indices in data\n\
+  [-l len]         Line length maximum in data section (default 80)\n\
+  [-n name]        Name for netCDF (default derived from file name)\n\
+  [-d n[,n]]       Approximate floating-point values with less precision\n\
+  file             File name of input netCDF file\n"
+
+    (void) fprintf(stderr,
+		   "%s [-V|-c|-h|-u] [-v ...] [[-b|-f] [c|f]] [-l len] [-n name] [-d n[,n]] file\n%s",
+		   progname,
+		   USAGE);
+    exit(EXIT_FAILURE);
+}
+
+
+/* 
+ * convert pathname of netcdf file into name for cdl unit, by taking 
+ * last component of path and stripping off any extension.
+ */
+static char *
+name_path(path)
+     char *path;
+{
+    char *cp, *new;
+
+#ifdef MSDOS
+#define FILE_DELIMITER '\\'
+#endif    
+#ifndef FILE_DELIMITER /* default to unix */
+#define FILE_DELIMITER '/'
+#endif
+    cp = strrchr(path, FILE_DELIMITER);
+    if (cp == 0)		/* no delimiter */
+      cp = path;
+    else			/* skip delimeter */
+      cp++;
+    new = (char *) malloc((unsigned) (strlen(cp)+1));
+    if (new == 0) {
+	error("out of memory!");
+	exit(EXIT_FAILURE);
+    }
+    (void) strcpy(new, cp);	/* copy last component of path */
+    if ((cp = strrchr(new, '.')) != NULL)
+      *cp = '\0';		/* strip off any extension */
+    return new;
+}
+
+static const char *
+type_name(type)
+     nc_type type;
+{
+    switch (type) {
+      case NC_BYTE:
+	return "byte";
+      case NC_CHAR:
+	return "char";
+      case NC_SHORT:
+	return "short";
+      case NC_LONG:
+	return "long";
+      case NC_FLOAT:
+	return "float";
+      case NC_DOUBLE:
+	return "double";
+      default:
+	error("type_name: bad type %d", type);
+	return "bogus";
+    }
+}
+
+/*
+ * Remove trailing zeros (after decimal point) but not trailing decimal
+ * point from ss, a string representation of a floating-point number that
+ * might include an exponent part.
+ */
+static void
+tztrim(ss)
+     char *ss;			/* returned string representing dd */
+{
+    char *cp, *ep;
+    
+    cp = ss;
+    if (*cp == '-')
+        cp++;
+    while(isdigit((int)*cp) || *cp == '.')
+        cp++;
+    if (*--cp == '.')
+        return;
+    ep = cp+1;
+    while (*cp == '0')
+        cp--;
+    cp++;
+    if (cp == ep)
+        return;
+    while (*ep)
+        *cp++ = *ep++;
+    *cp = '\0';
+    return;
+}
+ 
+/*
+ * Print list of attribute values.  Attribute values must be printed with
+ * explicit type tags, because their types are not declared.
+ */
+static void
+pr_att_vals(type, len, vals)
+     nc_type type;
+     int len;
+     void *vals;
+{
+    int iel;
+    union {
+	char *cp;
+	short *sp;
+	nclong *lp;
+	float *fp;
+	double *dp;
+    } gp;
+    char *sp;
+    unsigned char uc;
+    char gps[30];		/* for ascii of a float or double precision */
+    char *f_fmt = "%#.8g";
+    char *d_fmt = "%#.16g";
+
+    switch (type) {
+      case NC_BYTE:
+	gp.cp = (char *) vals;
+	for (iel = 0; iel < len; iel++)
+	  if (isprint(uc = *gp.cp++ & 0377))
+	    Printf ("'%c'%s", uc, iel<len-1 ? ", " : "");
+	  else
+	    Printf ("'\\%o'%s", uc, iel<len-1 ? ", " : "");
+	break;
+      case NC_CHAR:
+	gp.cp = (char *) vals;
+	Printf ("\"");
+	/* adjust len so trailing nulls don't get printed */
+	sp = gp.cp + len - 1;
+	while (*sp-- == '\0' && len > 0)
+	    len--;
+	for (iel = 0; iel < len; iel++)
+	  switch (uc = *gp.cp++ & 0377) {
+	    case '\b':
+	      Printf ("\\b");
+	      break;
+	    case '\f':
+	      Printf ("\\f");
+	      break;
+	    case '\n':		/* generate linebreaks after new-lines */
+	      Printf ("\\n\",\n    \"");
+	      break;
+	    case '\r':
+	      Printf ("\\r");
+	      break;
+	    case '\t':
+	      Printf ("\\t");
+	      break;
+	    case '\v':
+	      Printf ("\\v");
+	      break;
+	    case '\\':
+	      Printf ("\\\\");
+	      break;
+	    case '\'':
+	      Printf ("\\'");
+	      break;
+	    case '\"':
+	      Printf ("\\\"");
+	      break;
+	    default:
+	      Printf ("%c",uc);
+	      break;
+	  }
+	Printf ("\"");
+	break;
+      case NC_SHORT:
+	gp.sp = (short *) vals;
+	for (iel = 0; iel < len; iel++)
+	  Printf ("%ds%s",*gp.sp++,iel<len-1 ? ", " : "");
+	break;
+      case NC_LONG:
+	gp.lp = (nclong *) vals;
+	for (iel = 0; iel < len; iel++)
+	  Printf ("%d%s",(int)*gp.lp++,iel<len-1 ? ", " : "");
+	break;
+      case NC_FLOAT:
+	gp.fp = (float *) vals;
+	for (iel = 0; iel < len; iel++) {
+	    int ll;
+	    (void) sprintf(gps, f_fmt, * gp.fp++);
+	    /* append a trailing "f" for floating-point attributes */
+	    ll = strlen(gps);
+	    gps[ll + 1] = '\0';
+	    gps[ll] = 'f';
+            tztrim(gps);	/* trim trailing 0's after '.' */
+	    Printf ("%s%s", gps, iel<len-1 ? ", " : "");
+	}
+	break;
+      case NC_DOUBLE:
+	gp.dp = (double *) vals;
+	for (iel = 0; iel < len; iel++) {
+	    (void) sprintf(gps, d_fmt, *gp.dp++);
+	    tztrim(gps);	/* trim trailing 0's after '.' */
+	    Printf ("%s%s", gps, iel<len-1 ? ", " : "");
+	}
+	break;
+      default:
+	error("pr_att_vals: bad type");
+    }
+}
+
+/*
+ * fixstr
+ *
+ * 	If the string contains characters other than alpha-numerics,
+ * 	an underscore, or a hyphen, convert it to an underscore.
+ *
+ * Modification:
+ *	- Added "fix_str" to determine whether the conversion should be
+ *	  carried out, based on user's request. - bug #934, BMR 7/3/2005
+ */
+char *fixstr(char *str, bool fix_str)
+{
+#ifndef __GNUC__ 
+    char *strdup(const char *);
+#endif  /* linux */
+	char *new_str, *ptr;
+
+	if (!str)
+		return NULL;
+
+	ptr = new_str = strdup(str);
+
+	if (!ptr) {
+		error("Out of memory!");
+		return NULL;
+	}
+
+	if (fix_str)
+	{
+	    for (; *ptr; ptr++)
+		if (!isalnum(*ptr) && *ptr != '_' && *ptr != '-')
+			*ptr = '_';
+	}
+
+	return new_str;
+}
+
+static void
+do_ncdump(char *path, struct fspec* specp)
+/*     char *path;
+     struct fspec* specp;
+*/
+{
+	int ndims;			/* number of dimensions */
+	int nvars;			/* number of variables */
+	int ngatts;			/* number of global attributes */
+	int xdimid;			/* id of unlimited dimension */
+	int dimid;			/* dimension id */
+	int varid;			/* variable id */
+	struct ncvar var;		/* variable */
+	struct ncatt att;		/* attribute */
+	int id;				/* dimension number per variable */
+	int ia;				/* attribute number */
+	int iv;				/* variable number */
+	int is_coord;			/* true if variable is a coordinate variable */
+	int isempty = 0;		/* true if an old hdf dim has no scale values */
+
+	int ncid = ncopen(path, NC_NOWRITE); /* netCDF id */
+	vnode* vlist = newvlist();	/* list for vars specified with -v option */
+
+	/* don't crash on error */
+	ncopts = 0;
+
+	if (ncid == -1) { 
+		error("ncopen failed on %s", path);
+		return;
+	}
+
+	/*
+	 * If any vars were specified with -v option, get list of associated
+	 * variable ids
+	 */
+	for (iv = 0; iv < specp->nlvars; iv++) {
+		varid = ncvarid(ncid, specp->lvars[iv]);
+		varadd(vlist, varid);
+	}
+
+	/* if name not specified, derive it from path */
+	if (specp->name == NULL)
+		specp->name = name_path (path);
+
+	Printf ("netcdf %s {\n", specp->name);
+
+	/*
+	 * get number of dimensions, number of variables, number of global
+	 * atts, and dimension id of unlimited dimension, if any
+	 */
+	(void)ncinquire(ncid, &ndims, &nvars, &ngatts, &xdimid);
+
+	/* get dimension info */
+	if (ndims > 0) {
+		Printf ("dimensions:\n");
+
+		for (dimid = 0; dimid < ndims; dimid++) {
+			char *fixed_str;
+
+			(void)ncdiminq(ncid, dimid, dims[dimid].name,
+				       &dims[dimid].size);
+			fixed_str = fixstr(dims[dimid].name, specp->fix_str);
+
+			if (!fixed_str && dims[dimid].name) {
+				/* strdup(3) failed */
+				(void) ncclose(ncid);
+				return;
+			}
+
+			if (dimid == xdimid)
+				Printf ("\t%s = %s ; // (%d currently)\n",
+					fixed_str, "UNLIMITED",
+					(int)dims[dimid].size);
+			else
+				Printf ("\t%s = %ld ;\n",
+					fixed_str, dims[dimid].size);
+
+			free(fixed_str);
+		}
+	}
+
+	Printf ("\nvariables:\n");
+
+	/* get variable info, with variable attributes */
+	for (varid = 0; varid < nvars; varid++) {
+		char *fixed_var;
+
+		(void) ncvarinq(ncid, varid, var.name, &var.type, &var.ndims,
+				var.dims, &var.natts);
+		fixed_var = fixstr(var.name, specp->fix_str);
+
+		if (!fixed_var && var.name) {
+			/* strdup(3) failed */
+			(void) ncclose(ncid);
+			return;
+		}
+
+		Printf ("\t%s %s", type_name(var.type), fixed_var);
+
+		if (var.ndims > 0)
+			Printf ("(");
+
+		for (id = 0; id < var.ndims; id++) {
+			char *fixed_dim = fixstr(dims[var.dims[id]].name, 
+						 specp->fix_str);
+
+			if (!fixed_dim && dims[var.dims[id]].name) {
+				/* strdup(3) failed */
+			 	(void) ncclose(ncid);
+				free(fixed_var);
+				return;
+			}
+
+			Printf ("%s%s", fixed_dim,
+				id < var.ndims - 1 ? ", " : ")");
+			free(fixed_dim);
+		}
+
+		Printf (" ;\n");
+
+		/* get variable attributes */
+		for (ia = 0; ia < var.natts; ia++) {
+			char *fixed_att;
+
+			(void) ncattname(ncid, varid, ia, att.name);
+			fixed_att = fixstr(att.name, specp->fix_str);
+
+			if (!fixed_att) {
+				(void) ncclose(ncid);
+				free(fixed_var);
+				return;
+			}
+
+			Printf ("\t\t%s:%s = ", fixed_var, fixed_att);
+			(void) ncattinq(ncid, varid, att.name,
+					&att.type, &att.len);
+			att.val = (void *) malloc((unsigned)att.len * nctypelen(att.type));
+
+			if (!att.val) {
+				error("Out of memory!");
+				(void) ncclose(ncid);
+				free(fixed_att);
+				free(fixed_var);
+				return;
+			}
+
+			(void) ncattget(ncid, varid, att.name, att.val);
+			pr_att_vals(att.type, att.len, att.val);
+			Printf (" ;\n");
+			free(att.val);
+			free(fixed_att);
+		}
+
+		free(fixed_var);
+	}
+
+	/* get global attributes */
+	if (ngatts > 0)
+		Printf ("\n// global attributes:\n");
+
+	for (ia = 0; ia < ngatts; ia++) {
+		char *fixed_att;
+
+		(void) ncattname(ncid, NC_GLOBAL, ia, att.name);
+		fixed_att = fixstr(att.name, specp->fix_str);
+
+		if (!fixed_att) {
+			(void) ncclose(ncid);
+			return;
+		}
+
+		Printf ("\t\t:%s = ", fixed_att);
+
+		(void) ncattinq(ncid, NC_GLOBAL, att.name,
+				&att.type, &att.len);
+		att.val = malloc((unsigned)(att.len * nctypelen(att.type)));
+
+		if (!att.val) {
+			error("Out of memory!");
+			(void) ncclose(ncid);
+			free(fixed_att);
+			return;
+		}
+
+		(void) ncattget(ncid, NC_GLOBAL, att.name, att.val);
+		pr_att_vals(att.type, att.len, att.val);
+		Printf (" ;\n");
+		free(att.val);
+		free(fixed_att);
+	}
+
+	if (! specp->header_only) {
+		if (nvars > 0)
+			Printf ("\ndata:\n");
+
+		/* output variable data */
+		for (varid = 0; varid < nvars; varid++) {
+			/* if var list specified, test for membership */
+			if (specp->nlvars > 0 && ! varmember(vlist, varid))
+				continue;
+
+			(void) ncvarinq(ncid, varid, var.name, &var.type,
+					&var.ndims, var.dims, &var.natts);
+
+			if (specp->coord_vals) {
+				/* Find out if this is a coordinate variable */
+				is_coord = 0;
+
+				for (dimid = 0; dimid < ndims; dimid++) {
+					if (strcmp(dims[dimid].name, var.name) == 0 &&
+						var.ndims == 1) {
+						is_coord = 1;
+						break;
+					}
+				}
+
+				if (! is_coord)
+					/* don't get data for non-coordinate vars */
+					continue;
+			}
+
+			/*
+			 * Only get data for variable if it is not a record variable,
+			 * or if it is a record variable and at least one record has
+			 * been written.
+			 */
+#ifdef HDF
+			/* skip the dimension vars which have dim strings only.  */
+			{
+				NC *handle ;
+				NC_var *vp;
+#ifdef OLD_WAY
+				NC_var *NC_hlookupvar() ;          
+#endif /* OLD_WAY */
+
+				isempty = 0;
+				handle = NC_check_id(ncid);
+
+				if (handle->file_type == HDF_FILE)  {
+					vp = NC_hlookupvar(handle, varid) ;
+					/* This is set up to take care of
+					 * cases where an array has been
+					 * defined but no data */
+					/* has yet been added. */
+					if ((vp->data_tag == DFTAG_SDS ||
+						vp->data_tag == DFTAG_SD) &&
+						(vp->data_ref == 0))  
+						isempty = 1;  
+				}
+			}
+
+#endif /* HDF */
+			if (isempty)
+				continue;
+
+			if (var.ndims == 0 || var.dims[0] != xdimid || dims[xdimid].size != 0) {
+				/* Collect variable's dim sizes */
+				for (id = 0; id < var.ndims; id++)
+					vdims[id] = dims[var.dims[id]].size;
+
+				if (vardata(&var, vdims, ncid, varid, specp) == -1) {
+					error("can't output data for variable %s", var.name);
+					(void) ncclose(ncid);
+					return;
+				}
+			}
+		}
+	}
+
+	Printf ("}\n");
+	(void) ncclose(ncid);
+}
+
+static void
+make_lvars(optarg, fspecp)
+     char *optarg;
+     struct fspec* fspecp;
+{
+    char *cp = optarg;
+    int nvars = 1;
+    char ** cpp;
+
+    /* compute number of variable names in comma-delimited list */
+    fspecp->nlvars = 1;
+    while (*cp++)
+      if (*cp == ',')
+ 	nvars++;
+
+    fspecp->lvars = (char **) malloc(nvars * sizeof(char*));
+    if (!fspecp->lvars) {
+	error("out of memory");
+	exit(EXIT_FAILURE);
+    }
+
+    cpp = fspecp->lvars;
+    /* copy variable names into list */
+    for (cp = strtok(optarg, ",");
+	 cp != NULL;
+	 cp = strtok((char *) NULL, ",")) {
+	
+	*cpp = (char *) malloc(strlen(cp) + 1);
+	if (!*cpp) {
+	    error("out of memory");
+	    exit(EXIT_FAILURE);
+	}
+	strcpy(*cpp, cp);
+	cpp++;
+    }
+    fspecp->nlvars = nvars;
+}
+
+
+/*
+ * Extract the significant-digits specifiers from the -d argument on the
+ * command-line and update the default data formats appropriately.
+ */
+static void
+set_sigdigs(optarg)
+     char *optarg;
+{
+    char *ptr = optarg;
+    char *ptr2 = 0;
+    long flt_digits = 7;	/* default floating-point digits */
+    long dbl_digits = 15;	/* default double-precision digits */
+    char flt_fmt[6];
+    char dbl_fmt[6];
+
+    if (optarg != 0 && strlen(optarg) > 0 && optarg[0] != ',')
+        flt_digits=strtol(optarg, &ptr, 10);
+
+    if (flt_digits < 1 || flt_digits > 10) {
+	error("unreasonable value for float significant digits: %d",
+	      flt_digits);
+	exit(EXIT_FAILURE);
+    }
+    if (*ptr == ',')
+      dbl_digits = strtol(ptr+1, &ptr2, 10);
+    if (ptr2 == ptr+1 || dbl_digits < 1 || dbl_digits > 20) {
+	error("unreasonable value for double significant digits: %d",
+	      dbl_digits);
+	exit(EXIT_FAILURE);
+    }
+    (void) sprintf(flt_fmt, "%%.%dg", (int)flt_digits);
+    (void) sprintf(dbl_fmt, "%%.%dg", (int)dbl_digits);
+    set_formats(flt_fmt, dbl_fmt);
+}
+
+
+int
+main(argc, argv)
+int argc;
+char *argv[];
+{
+    extern int optind;
+    extern int opterr;
+    extern char *optarg;
+    static struct fspec fspec =	/* defaults, overridden on command line */
+      {
+	  0,			/* construct netcdf name from file name */
+	  false,		/* print header info only, no data? */
+	  false,		/* just print coord vars? */
+	  false,		/* brief  comments in data section? */
+	  false,		/* full annotations in data section?  */
+	  false,		/* replace nonalpha-numeric with underscore?  */
+	  LANG_NONE,		/* language conventions for indices */
+	  0,			/* if -v specified, number of variables */
+	  0			/* if -v specified, list of variable names */
+	  };
+    int c;
+    int i;
+    int max_len = 80;		/* default maximum line length */
+
+    opterr = 1;
+    progname = argv[0];
+    
+    if (1 == argc)             /* if no arguments given, print help and exit */
+      usage();
+
+    while ((c = getopt(argc, argv, "b:cf:hul:n:v:d:V")) != EOF)
+      switch(c) {
+	case 'V':		/* display version of the library */
+	  printf("%s, %s\n\n", argv[0], LIBVER_STRING );
+	  exit(EXIT_SUCCESS);
+	case 'h':		/* dump header only, no data */
+	  fspec.header_only = true;
+	  break;
+	case 'c':		/* header, data only for coordinate dims */
+	  fspec.coord_vals = true;
+	  break;
+	case 'n':		/*
+				 * provide different name than derived from
+				 * file name
+				 */
+	  fspec.name = optarg;
+	  break;
+	case 'u':		/* replace nonalpha-numerics with underscores */
+	  fspec.fix_str = true;
+	  break;
+	case 'b':		/* brief comments in data section */
+	  fspec.brief_data_cmnts = true;
+	  switch (tolower(optarg[0])) {
+	    case 'c':
+	      fspec.data_lang = LANG_C;
+	      break;
+	    case 'f':
+	      fspec.data_lang = LANG_F;
+	      break;
+	    default:
+	      error("invalid value for -b option: %s", optarg);
+	      exit(EXIT_FAILURE);
+	  }
+	  break;
+	case 'f':		/* full comments in data section */
+	  fspec.full_data_cmnts = true;
+	  switch (tolower(optarg[0])) {
+	    case 'c':
+	      fspec.data_lang = LANG_C;
+	      break;
+	    case 'f':
+	      fspec.data_lang = LANG_F;
+	      break;
+	    default:
+	      error("invalid value for -b option: %s", optarg);
+	      exit(EXIT_FAILURE);
+	  }
+	  break;
+	case 'l':		/* maximum line length */
+	  max_len = strtol(optarg, 0, 0);
+	  if (max_len < 10) {
+	      error("unreasonably small line length specified: %d", max_len);
+	      exit(EXIT_FAILURE);
+	  }
+	  break;
+	case 'v':		/* variable names */
+	  /* make list of names of variables specified */
+	  make_lvars (optarg, &fspec);
+	  break;
+	case 'd':		/* specify precision for floats */
+#ifdef OLD_WAY
+	  set_sigdigs(optarg, &fspec);
+#else /* OLD_WAY */
+	  set_sigdigs(optarg);
+#endif /* OLD_WAY */
+	  break;
+	case '?':
+	  usage();
+	  break;
+      }
+
+    set_max_len(max_len);
+    
+    argc -= optind;
+    argv += optind;
+
+    i = 0;
+    do {		
+	if (argc > 0)
+	  do_ncdump(argv[i], &fspec);
+    } while (++i < argc);
+    return EXIT_SUCCESS;
+}
diff --git a/mfhdf/ncdump/ncdump.h b/mfhdf/ncdump/ncdump.h
new file mode 100644
index 0000000..0f77cda
--- /dev/null
+++ b/mfhdf/ncdump/ncdump.h
@@ -0,0 +1,89 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncdump.h 4928 2007-09-06 21:48:49Z epourmal $
+ *********************************************************************/
+
+#define  Printf  (void) printf
+
+typedef enum {false=0, true=1} bool;
+
+struct ncdim {			/* dimension */
+    char name[H4_MAX_NC_NAME];
+    long size;
+};
+
+struct ncvar {			/* variable */
+    char name[H4_MAX_NC_NAME];
+    nc_type type;
+    int ndims;
+    int dims[H4_MAX_VAR_DIMS];
+    int natts;
+};
+
+struct ncatt {			/* attribute */
+    int var;
+    char name[H4_MAX_NC_NAME];
+    nc_type type;
+    int len;
+    void *val;
+};
+
+typedef
+enum {LANG_NONE, LANG_C, LANG_F} Nclang; 
+
+struct fspec {			/* specification for how to format dump */
+    char *name;			/*
+				 * name specified with -n or derived from file
+				 * name
+				 */
+    bool header_only;		/*
+				 * if true, don't print any variable data
+				 */
+    bool coord_vals;		/*
+				 * if true, print header and coordinate
+				 * dimension values (values of variables that
+				 * are also dimensions), but no other variable
+				 * data
+				 */
+    bool brief_data_cmnts;	/*
+				 * if true, put // comments in data section
+				 * identifying variable and indices, useful for
+				 * navigating through large multi-dimensional
+				 * data lists.
+				 */
+    bool full_data_cmnts;	/*
+				 * if true, put // comments in data section
+				 * identifying every value, useful for
+				 * navigating through large multi-dimensional
+				 * data lists.
+				 */
+    bool fix_str;		/*
+				 * if true, replace nonalpha-numeric 
+				 * characters in a name with underscores
+				 */
+    Nclang data_lang;		/*
+				 * Specifies index conventions used in data
+				 * comments, either LANG_C (C, 0-based, column
+				 * major) or LANG_F (Fortran, 1-based, row
+				 * major)
+				 */
+    int nlvars;			/*
+				 * Number of variables specified with -v option
+				 * on command line
+				 */
+    char** lvars;		/*
+				 * list of variable names specified with -v
+				 * option on command line
+				 */
+};
+
+#ifdef OLD_WAY
+extern int getopt               PROTO((
+                                       int argc,
+                                       char **argv,
+                                       char *opts
+                                ));
+
+#endif /* HP9000 */
+
diff --git a/mfhdf/ncdump/test0.cdl b/mfhdf/ncdump/test0.cdl
new file mode 100644
index 0000000..3924885
--- /dev/null
+++ b/mfhdf/ncdump/test0.cdl
@@ -0,0 +1,47 @@
+netcdf test0 {
+
+dimensions:
+	i = 2;
+	j = 3;
+	k = unlimited;
+        l = 3 ;
+
+variables:
+	char broiled(i,j,l);
+		broiled:acc = 'a';
+		broiled:act = "text string\n\t123";
+		broiled:acb = '\n';
+		broiled:acs = -40s ;
+		broiled:acl = 17000 ;
+		broiled:acf = -2.0f, 1.f, 0.0f ;
+		broiled:acd = -1.0, 2.7182818284590455;
+	byte the_bullet(i,j);
+	short order(i,j);
+	long shot(i,j);
+	float a_loan(i,j);
+	double entendre(i,j);
+	char cscalar;
+	double dscalar;
+	char cnodata(k);
+	byte bnodata(i);
+	short snodata(i);
+	long lnodata(i);
+	float fnodata(i);
+	double dnodata(k,i,j);
+	int i(i);
+	float j(j);
+	byte l(l);
+
+	:glob = "Global attribute" ;
+
+data:
+	broiled = "indistinguishable" ;
+	the_bullet = -127,0,127,128,255;
+	order = 1s, 2s, 3s, 4s, 5s, 6s;
+	shot = 2, 3, 4, 5, 6, 7 ;
+	a_loan = 3.f, 4.f, 5.f, 6.f, 7.f, 1.0e12f ;
+	entendre = '\4', 5s, 6, 7.0f, 8.0, 1.0e30 ;
+	i = 10, 20;
+	j = 2, 4, 6;
+	l = 10, 9, 8;
+}
diff --git a/mfhdf/ncdump/testncdump.sh.in b/mfhdf/ncdump/testncdump.sh.in
new file mode 100755
index 0000000..345b11c
--- /dev/null
+++ b/mfhdf/ncdump/testncdump.sh.in
@@ -0,0 +1,123 @@
+#! /bin/sh
+# Tests for the ncdump tool
+
+srcdir=@srcdir@
+currentdir=`pwd`
+
+# Definitions of commands and variables
+NCDUMP='ncdump'                  # The tool name
+NCDUMP_BIN="${TESTS_ENVIRONMENT} "`pwd`/$NCDUMP       # The path of the tool binary
+
+RM='rm -f'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+
+nerrors=0
+verbose=yes
+
+$CP $srcdir/test0.cdl ./nctest0.cdl
+
+# Print message with formats according to message level ($1)
+MESG() {
+  level=$1
+  shift
+  case $level in
+    0)
+      echo '============================='
+      echo $*
+      echo '============================='
+      ;;
+    3)
+      echo '-----------------------------'
+      echo $*
+      echo '-----------------------------'
+      ;;
+    6)
+      echo "*** $* ***"
+      ;;
+    *)
+      echo "MESG(): Unknown level ($level)"
+      exit 1
+      ;;
+  esac
+}
+
+# Report the result and exit
+FINISH()
+{
+    if [ $nerrors -eq 0 ]
+    then
+        MESG 0 "All ncdump tests passed"
+    else
+        MESG 0 "ncdump tests failed: $nerrors"
+    fi
+    exit $nerrors
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+   SPACES="                                                               "
+   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Run a test and print PASS or *FAIL*.  If a test fails then increment
+# the `nerrors' global variable
+#
+RUN() {
+   # Run test.
+
+   ${TESTS_ENVIRONMENT} ../ncgen/ncgen -o test0.nc -n nctest0.cdl
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+
+   ${TESTS_ENVIRONMENT} $NCDUMP_BIN test0.nc > test1.cdl
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+
+   ${TESTS_ENVIRONMENT} ../ncgen/ncgen -o test1.nc -n test1.cdl
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+
+   ${TESTS_ENVIRONMENT} $NCDUMP_BIN -n test0 test1.nc > test2.cdl
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+
+   $CMP test1.cdl test2.cdl
+   cmpval=$?
+   if [ "$cmpval" = 0 ] ; then
+       echo " PASSED"
+   else
+       echo "*FAILED*"
+       nerrors="`expr $nerrors + 1`"
+   fi
+   $RM -f test1.nc test1.cdl test2.cdl
+}
+
+##############################################################################
+###                       T H E   T E S T S                                ###
+##############################################################################
+
+# Print a beginning banner
+MESG 0 "Running ncdump tests"
+
+# compare output
+RUN
+
+# End of test, return exit code
+FINISH
+    
\ No newline at end of file
diff --git a/mfhdf/ncdump/vardata.c b/mfhdf/ncdump/vardata.c
new file mode 100644
index 0000000..aea6ce0
--- /dev/null
+++ b/mfhdf/ncdump/vardata.c
@@ -0,0 +1,597 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vardata.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include <netcdf.h>
+#else
+#include <hdf4_netcdf.h>
+#endif
+
+#include "ncdump.h"
+#include "dumplib.h"
+#include "vardata.h"
+
+/*
+ * Function from ncdump.c. "Fixes" variable names to remove spaces and other
+ * "illegal" characters.
+ */
+extern char *fixstr(char *str, bool fix_str);
+
+static void annotate
+    PROTO((struct ncvar *vp,struct fspec *fsp,long cor[], long iel));
+
+#define	STREQ(a, b)	(*(a) == *(b) && strcmp((a), (b)) == 0)
+
+/*
+ * Print a row of variable values.  Makes sure output lines aren't too long
+ * by judiciously inserting newlines. 
+ */
+static void
+pr_vals(vp, len, fmt, more, lastrow, vals)
+     struct ncvar *vp;		/* variable */
+     long len;			/* number of values to print */
+     char *fmt;			/*
+				 * printf format used for each value.  If
+				 * nc_type is NC_CHAR and this is NULL,
+				 * character arrays will be printed as strings
+				 * enclosed in quotes.
+				 */
+     bool more;			/*
+				 * true if more data will follow, so add
+				 * trailing comma
+				 */
+     bool lastrow;		/*
+				 * true if this is the last row for this
+				 * variable, so terminate with ";" instead of
+				 * ","
+				 */
+     void *vals;		/* pointer to block of values */
+{
+    long iel;
+    union {
+	char *cp;
+	short *sp;
+	nclong *lp;
+	float *fp;
+	double *dp;
+    } gp;
+    char *sp;
+    unsigned char uc;
+    float fill_float;
+    double fill_double;
+    char sout[100];		/* temporary string for each encoded output */
+
+    fill_float = FILL_FLOAT;	/* static initialization hits ultrix cc bug */
+    fill_double = FILL_DOUBLE;
+    switch (vp->type) {
+      case NC_BYTE:
+	gp.cp = (char *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    (void) sprintf(sout, fmt, *gp.cp++);
+	    (void) strcat(sout, ", ");
+	    lput(sout);
+	}
+	(void) sprintf(sout, fmt, *gp.cp++);
+	lput(sout);
+	break;
+      case NC_CHAR:
+	gp.cp = (char *) vals;
+	if (fmt == 0 || STREQ(fmt,"%s") || STREQ(fmt,"")) { /* as string */
+	    Printf("\"");
+	    /* adjust len so trailing nulls don't get printed */
+	    sp = gp.cp + len;
+	    while (len > 0 && *--sp == '\0')
+	      len--;
+	    for (iel = 0; iel < len; iel++)
+	      switch (uc = *gp.cp++ & 0377) {
+		case '\b':
+		  Printf("\\b");
+		  break;
+		case '\f':
+		  Printf("\\f");
+		  break;
+		case '\n':	/* generate linebreaks after new-lines */
+		  Printf("\\n\",\n    \"");
+		  break;
+		case '\r':
+		  Printf("\\r");
+		  break;
+		case '\t':
+		  Printf("\\t");
+		  break;
+		case '\v':
+		  Printf("\\v");
+		  break;
+		case '\\':
+		  Printf("\\\\");
+		  break;
+		case '\'':
+		  Printf("\\\'");
+		  break;
+		case '\"':
+		  Printf("\\\"");
+		  break;
+		default:
+		  if (isprint(uc))
+		    Printf("%c",uc);
+		  else
+		    Printf("\\%.3o",uc);
+		  break;
+	      }
+	    Printf("\"");
+	} else {		/* use format from C_format attribute */
+	    for (iel = 0; iel < len-1; iel++) {
+		(void) sprintf(sout, fmt, *gp.cp++);
+		(void) strcat(sout, ", ");
+		lput(sout);
+	    }
+	    (void) sprintf(sout, fmt, *gp.cp++);
+	    lput(sout);
+	}
+	break;
+      case NC_SHORT:
+	gp.sp = (short *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    (void) sprintf(sout, fmt, *gp.sp++);
+	    (void) strcat(sout, ", ");
+	    lput(sout);
+	}
+	(void) sprintf(sout, fmt, *gp.sp++);
+	lput(sout);
+	break;
+      case NC_LONG:
+	gp.lp = (nclong *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    (void) sprintf(sout, fmt, *gp.lp++);
+	    (void) strcat(sout, ", ");
+	    lput(sout);
+	}
+	(void) sprintf(sout, fmt, *gp.lp++);
+	lput(sout);
+	break;
+      case NC_FLOAT:
+	gp.fp = (float *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    if (*gp.fp >= fill_float)
+	      (void) sprintf(sout, "FloatInf, ");
+	    else {
+		(void) sprintf(sout, fmt, *gp.fp);
+		(void) strcat(sout, ", ");
+	    }
+	    lput(sout);
+	    gp.fp++;
+	}
+	if (*gp.fp >= fill_float)
+	  (void) sprintf(sout, "FloatInf");
+	else
+	  (void) sprintf(sout, fmt, *gp.fp);
+	lput(sout);
+	gp.fp++;
+	break;
+      case NC_DOUBLE:
+	gp.dp = (double *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    if (*gp.dp >= fill_double)
+	      (void) sprintf(sout, "DoubleInf, ");
+	    else {
+		(void) sprintf(sout, fmt, *gp.dp);
+		(void) strcat(sout, ", ");
+	    }
+	    lput(sout);
+	    gp.dp++;
+	}
+	if (*gp.dp >= fill_double)
+	  (void) sprintf(sout, "DoubleInf");
+	else
+	  (void) sprintf(sout, fmt, *gp.dp);
+	lput(sout);
+	gp.dp++;
+	break;
+      default:
+	error("pr_vals: bad type");
+    }
+    if (more) {
+	lput(", ");
+    } else {
+	if(lastrow) {
+	    lput(" ;");
+	    lput("\n");
+	} else {
+	    lput(",\n");
+	    lput("  ");
+	}
+    }
+}
+
+
+/*
+ * print last delimiter in each line before annotation (, or ;)
+ */
+static void
+lastdelim (more, lastrow)
+     bool more;
+     bool lastrow;
+{
+    if (more) {
+	Printf(", ");
+    } else {
+	if(lastrow) {
+	    Printf(";");
+	} else {
+	    Printf(",");
+	}
+    }
+}
+
+
+/*
+ * Annotates a value in data section with var name and indices in comment
+ */
+static void
+annotate(vp, fsp, cor, iel)
+     struct ncvar *vp;		/* variable */
+     struct fspec* fsp;		/* formatting specs */
+     long cor[];		/* corner coordinates */
+     long iel;			/* which element in current row */
+{
+    int vrank = vp->ndims;
+    int id;
+    
+    /* print indices according to data_lang */
+    (void) printf("  // %s(", vp->name);
+    switch (fsp->data_lang) {
+      case LANG_C:
+	/* C variable indices */
+	for (id = 0; id < vrank-1; id++)
+	  Printf("%d,", (int)cor[id]);
+	Printf("%d", (int)(cor[id] + iel));
+	break;
+      case LANG_F:
+	/* Fortran variable indices */
+	Printf("%d", (int)(cor[vrank-1] + iel + 1));
+	for (id = vrank-2; id >=0 ; id--) {
+	    Printf(",%d", (int)(1 + cor[id]));
+	}
+	break;
+    }
+    Printf(")\n    ");
+}
+
+
+/*
+ * Print a number of commented variable values, where the comments for each
+ * value identify the variable, and each dimension index.
+ */
+static void
+pr_cvals(vp, len, fmt, more, lastrow, vals, fsp, cor)
+     struct ncvar *vp;		/* variable */
+     long len;			/* number of values to print */
+     char *fmt;			/*
+				 * printf format used for each value.  If
+				 * nc_type is NC_CHAR and this is NULL,
+				 * character arrays will be printed as strings
+				 * enclosed in quotes.
+				 */
+     bool more;			/*
+				 * true if more data for this row will follow,
+				 * so add trailing comma
+				 */
+     bool lastrow;		/*
+				 * true if this is the last row for this
+				 * variable, so terminate with ";" instead of
+				 * ","
+				 */
+     void *vals;		/* pointer to block of values */
+     struct fspec* fsp;		/* formatting specs */
+     long cor[];		/* corner coordinates */
+{
+    long iel;
+    union {
+	char *cp;
+	short *sp;
+	nclong *lp;
+	float *fp;
+	double *dp;
+    } gp;
+    char *sp;
+    unsigned char uc;
+    float fill_float;
+    double fill_double;
+
+    fill_float = FILL_FLOAT;	/* static initialization hits ultrix cc bug */
+    fill_double = FILL_DOUBLE;
+    switch (vp->type) {
+      case NC_BYTE:
+	gp.cp = (char *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    Printf(fmt, *gp.cp++);
+	    Printf(", ");
+	    annotate (vp, fsp, cor, iel);
+	}
+	Printf(fmt, *gp.cp++);
+	lastdelim (more, lastrow);
+	annotate (vp, fsp, cor, iel);
+	break;
+      case NC_CHAR:
+	gp.cp = (char *) vals;
+	if (fmt == 0 || STREQ(fmt,"%s") || STREQ(fmt,"")) { /* as string */
+	    Printf("\"");
+	    /* adjust len so trailing nulls don't get printed */
+	    sp = gp.cp + len;
+	    while (len > 0 && *--sp == '\0')
+	      len--;
+	    for (iel = 0; iel < len; iel++)
+	      switch (uc = *gp.cp++ & 0377) {
+		case '\b':
+		  Printf("\\b");
+		  break;
+		case '\f':
+		  Printf("\\f");
+		  break;
+		case '\n':	/* generate linebreaks after new-lines */
+		  Printf("\\n\",\n    \"");
+		  break;
+		case '\r':
+		  Printf("\\r");
+		  break;
+		case '\t':
+		  Printf("\\t");
+		  break;
+		case '\v':
+		  Printf("\\v");
+		  break;
+		case '\\':
+		  Printf("\\\\");
+		  break;
+		case '\'':
+		  Printf("\\\'");
+		  break;
+		case '\"':
+		  Printf("\\\"");
+		  break;
+		default:
+		  if (isprint(uc))
+		    Printf("%c",uc);
+		  else
+		    Printf("\\%.3o",uc);
+		  break;
+	      }
+	    Printf("\"");
+	    annotate (vp, fsp, cor, 0);
+	} else {		/* use format from C_format attribute */
+	    for (iel = 0; iel < len-1; iel++) {
+		Printf(fmt, *gp.cp++);
+		Printf(", ");
+		annotate (vp, fsp, cor, iel);
+	    }
+	    Printf(fmt, *gp.cp++);
+	    lastdelim (more, lastrow);
+	    annotate (vp, fsp, cor, iel);
+	}
+	break;
+      case NC_SHORT:
+	gp.sp = (short *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    Printf(fmt, *gp.sp++);
+	    Printf(", ");
+	    annotate (vp, fsp, cor, iel);
+	}
+	Printf(fmt, *gp.sp++);
+	lastdelim (more, lastrow);
+	annotate (vp, fsp, cor, iel);
+	break;
+      case NC_LONG:
+	gp.lp = (nclong *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    Printf(fmt, *gp.lp++);
+	    Printf(", ");
+	    annotate (vp, fsp, cor, iel);
+	}
+	Printf(fmt, *gp.lp++);
+	lastdelim (more, lastrow);
+	annotate (vp, fsp, cor, iel);
+	break;
+      case NC_FLOAT:
+	gp.fp = (float *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    if (*gp.fp >= fill_float)
+	      Printf("FloatInf");
+	    else
+	      Printf(fmt, *gp.fp);
+	    Printf(",");
+	    annotate (vp, fsp, cor, iel);
+	    gp.fp++;
+	}
+	if (*gp.fp >= fill_float)
+	  Printf("FloatInf");
+	else
+	  Printf(fmt, *gp.fp);
+	lastdelim (more, lastrow);
+	annotate (vp, fsp, cor, iel);
+	gp.fp++;
+	break;
+      case NC_DOUBLE:
+	gp.dp = (double *) vals;
+	for (iel = 0; iel < len-1; iel++) {
+	    if (*gp.dp >= fill_double)
+	      Printf("DoubleInf");
+	    else {
+		Printf(fmt, *gp.dp);
+	    }
+	    Printf(",");
+	    annotate (vp, fsp, cor, iel);
+	    gp.dp++;
+	}
+	if (*gp.dp >= fill_double)
+	  Printf("DoubleInf");
+	else
+	  Printf(fmt, *gp.dp);
+	lastdelim (more, lastrow);
+	annotate (vp, fsp, cor, iel);
+	gp.dp++;
+	break;
+      default:
+	error("pr_vals: bad type");
+    }
+}
+
+
+/*
+ * Updates a vector of ints, odometer style.  Returns 0 if odometer
+ * overflowed, else 1.
+ */
+static int
+upcorner(dims,ndims,odom,add)
+     long *dims;		/* The "odometer" limits for each dimension  */
+     int ndims;			/* Number of dimensions */
+     long* odom;		/* The "odometer" vector to be updated */
+     long* add;			/* A vector to "add" to odom on each update */
+{
+    int id;
+    int ret = 1;
+
+    for (id = ndims-1; id > 0; id--) {
+	odom[id] += add[id];
+	if(odom[id] >= dims[id]) {
+	    odom[id-1]++;
+	    odom[id] -= dims[id];
+	}
+    }
+    odom[0] += add[0];
+    if (odom[0] >= dims[0])
+      ret = 0;
+    return ret;
+}
+
+
+int
+vardata(vp, vdims, ncid, varid, fsp)
+     struct ncvar *vp;		/* variable */
+     long vdims[];		/* variable dimension sizes */
+     int ncid;			/* netcdf id */
+     int varid;			/* variable id */
+     struct fspec* fsp;		/* formatting specs */
+{
+    long cor[H4_MAX_VAR_DIMS];	/* corner coordinates */
+    long edg[H4_MAX_VAR_DIMS];	/* edges of hypercube */
+    long add[H4_MAX_VAR_DIMS];	/* "odometer" increment to next "row"  */
+#define VALBUFSIZ 8192
+    double vals[VALBUFSIZ/sizeof(double)] ; /* aligned buffer */
+    int gulp = VALBUFSIZ/nctypelen(vp->type);
+
+    int id;
+    int ir;
+    long nels;
+    long ncols;
+    long nrows;
+    int vrank = vp->ndims;
+    char *fixed_var;
+
+    /* printf format used to print each value */
+    const char *fmt = get_fmt(ncid, varid, vp->type);
+
+    nels = 1;
+    for (id = 0; id < vrank; id++) {
+	cor[id] = 0;
+	edg[id] = 1;
+	nels *= vdims[id];	/* total number of values for variable */
+    }
+
+    fixed_var = fixstr(vp->name, fsp->fix_str);
+
+    if (vrank <= 1) {
+	Printf("\n %s = ", fixed_var);
+	set_indent (strlen(fixed_var) + 4);
+    } else {
+	Printf("\n %s =\n  ", fixed_var);
+	set_indent (2);
+    }
+
+    if (vrank < 1) {
+	ncols = 1;
+    } else {
+	ncols = vdims[vrank-1];	/* size of "row" along last dimension */
+	edg[vrank-1] = vdims[vrank-1];
+	for (id = 0; id < vrank; id++)
+	  add[id] = 0;
+	if (vrank > 1)
+	  add[vrank-2] = 1;
+    }
+    nrows = nels/ncols;		/* number of "rows" */
+    
+    for (ir = 0; ir < nrows; ir++) {
+	/*
+	 * rather than just printing a whole row at once (which might exceed
+	 * the capacity of MSDOS platforms, for example), we break each row
+	 * into smaller chunks, if necessary.
+	 */
+	long corsav=0;
+	long left = ncols;
+	bool lastrow;
+
+	if (vrank > 0) {
+	    corsav = cor[vrank-1];
+	    if (fsp->brief_data_cmnts != false
+		&& vrank > 1
+		&& left > 0) {	/* print brief comment with indices range */
+		Printf("// %s(",fixed_var);
+		switch (fsp->data_lang) {
+		  case LANG_C:
+		    /* print brief comment with C variable indices */
+		    for (id = 0; id < vrank-1; id++)
+		      Printf("%d,", (int)cor[id]);
+		    if (vdims[vrank-1] == 1)
+		      Printf("0");
+		    else
+		      Printf(" 0-%d", (int)vdims[vrank-1]-1);
+		    break;
+		  case LANG_F:
+		    /* print brief comment with Fortran variable indices */
+		    if (vdims[vrank-1] == 1)
+		      Printf("1");
+		    else
+		      Printf("1-%d ",(int)vdims[vrank-1]);
+		    for (id = vrank-2; id >=0 ; id--) {
+			Printf(",%d", (int)(1 + cor[id]));
+		    }
+		    break;
+		}
+		Printf(")\n    ");
+		set_indent(4);
+	    }
+	}
+	lastrow = (ir == nrows-1) ? true:false;
+	while (left > 0) {
+	    long toget = left < gulp ? left : gulp;
+	    if (vrank > 0)
+	      edg[vrank-1] = toget;
+	    (void) ncvarget (ncid, varid, cor, edg, (void *) vals);
+	    if (fsp->full_data_cmnts)
+	      pr_cvals(vp, toget, fmt, left > toget, lastrow, (void *) vals,
+		       fsp, cor);
+	    else
+	      pr_vals(vp, toget, fmt, left > toget, lastrow, (void *) vals);
+	    left -= toget;
+	    if (vrank > 0)
+	      cor[vrank-1] += toget;
+	}
+	if (vrank > 0)
+	  cor[vrank-1] = corsav;
+	if (ir < nrows-1)
+	  if (!upcorner(vdims,vp->ndims,cor,add))
+	    error("vardata: odometer overflowed!");
+	set_indent(2);
+    }
+
+    free(fixed_var);
+    return 0;
+}
diff --git a/mfhdf/ncdump/vardata.h b/mfhdf/ncdump/vardata.h
new file mode 100644
index 0000000..7b9c53c
--- /dev/null
+++ b/mfhdf/ncdump/vardata.h
@@ -0,0 +1,31 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vardata.h 2364 1996-03-26 22:34:11Z georgev $
+ *********************************************************************/
+
+extern char *progname;		/* for error messages */
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Output the data for a single variable, in CDL syntax. */
+extern int	vardata		PROTO((
+				       struct ncvar*, /* variable */
+				       long [], /* variable dimension sizes */
+				       int, /* netcdf id */
+				       int, /* variable id */
+				       struct fspec* /* formatting specs */
+				       ));
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mfhdf/ncgen/CMakeLists.txt b/mfhdf/ncgen/CMakeLists.txt
new file mode 100644
index 0000000..cb2690d
--- /dev/null
+++ b/mfhdf/ncgen/CMakeLists.txt
@@ -0,0 +1,71 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_NCGEN)
+
+INCLUDE_DIRECTORIES (
+    ${HDF4_HDFSOURCE_DIR}
+    ${HDF4_MFHDFSOURCE_DIR}
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS(-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+SET (ncgen_SRCS
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/close.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/escapes.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/generate.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/genlib.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/getfill.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/init.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/load.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/main.c
+    ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/ncgentab.c
+)
+IF (WIN32 AND NOT CYGWIN)
+  SET (ncgen_SRCS ${ncgen_SRCS} ${HDF4_SOURCE_DIR}/mfhdf/util/getopt.c)
+ENDIF (WIN32 AND NOT CYGWIN)
+ 
+ADD_EXECUTABLE (ncgen ${ncgen_SRCS})
+TARGET_C_PROPERTIES (ncgen " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (ncgen ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET} )
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (ncgen ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_NAMING (ncgen ${LIB_TYPE})
+
+IF (BUILD_TESTING)
+  INCLUDE (CMakeTests.cmake)
+ENDIF (BUILD_TESTING)
+
+##############################################################################
+##############################################################################
+###           I N S T A L L A T I O N                                      ###
+##############################################################################
+##############################################################################
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL_PROGRAM_PDB (ncgen ${HDF4_INSTALL_TOOLS_BIN_DIR} toolsapplications)
+
+INSTALL (
+    TARGETS
+        ncgen
+    RUNTIME DESTINATION
+        ${HDF4_INSTALL_TOOLS_BIN_DIR}
+    COMPONENT
+        toolsapplications
+)
diff --git a/mfhdf/ncgen/CMakeTests.cmake b/mfhdf/ncgen/CMakeTests.cmake
new file mode 100644
index 0000000..c271390
--- /dev/null
+++ b/mfhdf/ncgen/CMakeTests.cmake
@@ -0,0 +1,144 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+  # Remove any output file left over from previous test run
+  ADD_TEST (
+      NAME NCGEN-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          ctest0.nc
+          ctest1.cdl
+          ftest0.nc
+          ftest1.cdl
+          ncgentab.c
+          ncgentab.h
+          ncgenyy.c
+          netcdf.inc
+          test0.c
+          test0.f
+          test0.nc
+          test1.cdl
+          test1.nc
+          test2.cdl
+  )
+  IF (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (NCGEN-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  ELSE (NOT "${last_test}" STREQUAL "")
+    SET_TESTS_PROPERTIES (NCGEN-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+  ENDIF (NOT "${last_test}" STREQUAL "")
+  SET (last_test "NCGEN-clearall-objects")
+
+  #-- Copy all the data files from the test directory into the source directory
+  #MESSAGE (STATUS " Copying ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/test0.cdl to ${PROJECT_BINARY_DIR}/")
+  ADD_CUSTOM_COMMAND (
+      TARGET     ncgen
+      POST_BUILD
+      COMMAND    ${CMAKE_COMMAND}
+      ARGS       -E copy_if_different ${HDF4_MFHDF_NCGEN_SOURCE_DIR}/test0.cdl ${PROJECT_BINARY_DIR}/test0.cdl
+  )
+
+#-- Adding test for ncgen
+ADD_TEST (
+    NAME NCGEN-test0.nc
+    COMMAND $<TARGET_FILE:ncgen> -b -o test0.nc test0.cdl
+)
+SET_TESTS_PROPERTIES (NCGEN-test0.nc PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+SET (last_test "NCGEN-test0.nc")
+
+ADD_TEST (
+    NAME NCGEN-test1.cdl
+    COMMAND "${CMAKE_COMMAND}"
+        -D "TEST_PROGRAM=$<TARGET_FILE:ncdump>"
+        -D "TEST_ARGS:STRING=-n;test1;test0.nc"
+        -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+        -D "TEST_OUTPUT=test1.cdl"
+        -D "TEST_EXPECT=0"
+        -D "TEST_SKIP_COMPARE=TRUE"
+        -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+)
+SET_TESTS_PROPERTIES (NCGEN-test1.cdl PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+SET (last_test "NCGEN-test1.cdl")
+
+ADD_TEST (
+    NAME NCGEN-test1.nc
+    COMMAND $<TARGET_FILE:ncgen> -b test1.cdl
+)
+SET_TESTS_PROPERTIES (NCGEN-test1.nc PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+SET (last_test "NCGEN-test1.nc")
+
+ADD_TEST (
+    NAME NCGEN-test2.cdl
+    COMMAND "${CMAKE_COMMAND}"
+        -D "TEST_PROGRAM=$<TARGET_FILE:ncdump>"
+        -D "TEST_ARGS:STRING=test1.nc"
+        -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+        -D "TEST_OUTPUT=test2.cdl"
+        -D "TEST_EXPECT=0"
+        -D "TEST_REFERENCE=test1.cdl"
+        -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+)
+SET_TESTS_PROPERTIES (NCGEN-test2.cdl PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+SET (last_test "NCGEN-test2.cdl")
+
+#
+#ctest0$(EXEEXT):        ncgen$(EXEEXT) $(srcdir)/test0.cdl
+#    $(TESTS_ENVIRONMENT) ./ncgen -c -o ctest0.nc $(srcdir)/test0.cdl > test0.c
+#    $(COMPILE) -c -o ctest0$(EXEEXT).o test0.c
+#    $(LINK) ctest0$(EXEEXT).o $(ctest0_LDADD) $(LDFLAGS) $(SHLIBLOC) $(LIBS)
+
+ADD_TEST (
+    NAME NCGEN-ctest0
+    COMMAND "${CMAKE_COMMAND}"
+        -D "TEST_PROGRAM=$<TARGET_FILE:ncgen>"
+        -D "TEST_ARGS:STRING=-c;-o;ctest0.nc;test0.cdl"
+        -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+        -D "TEST_OUTPUT=test0.c"
+        -D "TEST_EXPECT=0"
+        -D "TEST_SKIP_COMPARE=TRUE"
+        -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+)
+SET_TESTS_PROPERTIES (NCGEN-ctest0 PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+SET (last_test "NCGEN-ctest0")
+#
+## Test the "-c" option of ncgen
+#c-check:    b-check ctest0
+#    $(TESTS_ENVIRONMENT) ./ctest0        # tests `-c' option, creates ctest0.nc
+#    $(TESTS_ENVIRONMENT) $(NCDUMP) -n test1 ctest0.nc > ctest1.cdl
+#    @if $(DIFF) test1.cdl ctest1.cdl; then                              \
+#      echo "*** ncgen -c test successful ***";                          \
+#    else                                                                \
+#      echo "*** ncgen -c test failed  ***";                             \
+#    fi
+
+IF (HDF4_BUILD_FORTRAN)
+#
+#ftest0$(EXEEXT):        ncgen$(EXEEXT) test0.cdl netcdf.inc
+#    $(TESTS_ENVIRONMENT) ./ncgen -f -o ftest0.nc $(srcdir)/test0.cdl > test0.f
+#    $(F77) $(FFLAGS) -o $@ test0.f $(LDFLAGS) $(SHLIBLOC) $(LIBS)
+  ADD_TEST (
+      NAME NCGEN-ftest0
+      COMMAND "${CMAKE_COMMAND}"
+          -D "TEST_PROGRAM=$<TARGET_FILE:ncgen>"
+          -D "TEST_ARGS:STRING=-f;-o;ftest0.nc;test0.cdl"
+          -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+          -D "TEST_OUTPUT=test0.f"
+          -D "TEST_EXPECT=0"
+          -D "TEST_SKIP_COMPARE=TRUE"
+          -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+  )
+  SET_TESTS_PROPERTIES (NCGEN-ftest0 PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
+  SET (last_test "NCGEN-ftest0")
+# Test the "-f" option of ncgen
+#f-check:    b-check ftest0
+#    $(TESTS_ENVIRONMENT) ./ftest0
+#    $(TESTS_ENVIRONMENT) $(NCDUMP) -n test1 ftest0.nc > ftest1.cdl
+#    @if $(DIFF) test1.cdl ftest1.cdl; then                              \
+#      echo "*** ncgen -f test successful ***";                          \
+#    else                                                                \
+#      echo "*** ncgen -f test failed (but roundoff differences are OK) ***"; \
+#    fi
+ENDIF (HDF4_BUILD_FORTRAN)
diff --git a/mfhdf/ncgen/Makefile.am b/mfhdf/ncgen/Makefile.am
new file mode 100644
index 0000000..a07c7a9
--- /dev/null
+++ b/mfhdf/ncgen/Makefile.am
@@ -0,0 +1,107 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+if HDF_BUILD_SHARED
+    SHLIBLOC = $(top_builddir)/mfhdf/libsrc/.libs/libmfhdf.$(SHARED_EXTENSION) $(top_builddir)/hdf/src/.libs/libdf.$(SHARED_EXTENSION)
+else
+    SHLIBLOC = $(top_builddir)/mfhdf/libsrc/.libs/libmfhdf.a $(top_builddir)/hdf/src/.libs/libdf.a
+endif
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+## Add ncgen specific linker flags here
+ncgen_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+bin_PROGRAMS = ncgen
+
+if HDF_BUILD_NETCDF
+if HDF_BUILD_FORTRAN
+noinst_PROGRAMS = ctest0 ftest0
+else 
+noinst_PROGRAMS = ctest0
+endif
+else
+noinst_PROGRAMS = ctest0
+endif
+
+## Information for building the "ncgen" program
+ncgen_SOURCES = close.c escapes.c generate.c genlib.c getfill.c init.c      \
+                load.c main.c ncgentab.c
+ncgen_LDADD = $(LIBMFHDF) $(LIBHDF)
+ncgen_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+ctest0_SOURCES=
+ctest0_LDADD = $(LIBMFHDF) $(LIBHDF)
+
+ftest0_SOURCES=
+
+## Recipe for building the ncgentab.c file
+##ncgentab.c ncgentab.h: ncgen.h ncgen.y ncgenyy.c
+##	$(YACC) -d $(srcdir)/ncgen.y
+##	mv y.tab.c ncgentab.c
+##	mv y.tab.h ncgentab.h
+
+##ncgenyy.c: ncgen.l
+##	$(LEX) $(srcdir)/ncgen.l
+##	mv lex.yy.c ncgenyy.c
+
+#############################################################################
+##                            Documentation                                ##
+#############################################################################
+
+man1_MANS = ncgen.1
+
+#############################################################################
+##                   Testing -- Here there be dragons.                     ##
+#############################################################################
+NCDUMP=$(top_builddir)/mfhdf/ncdump/ncdump
+
+check_PROGRAMS = ctest0
+if HDF_BUILD_NETCDF
+if HDF_BUILD_FORTRAN
+check_PROGRAMS += ftest0
+
+netcdf.inc:
+	ln -s $(top_builddir)/mfhdf/fortran/$@ .
+
+ftest0$(EXEEXT):		ncgen$(EXEEXT) test0.cdl netcdf.inc
+	$(TESTS_ENVIRONMENT) ./ncgen -f -o ftest0.nc $(srcdir)/test0.cdl > test0.f
+	$(F77) $(FFLAGS) -o $@ test0.f $(LDFLAGS) $(SHLIBLOC) $(LIBS)
+endif
+endif
+
+ctest0$(EXEEXT):		ncgen$(EXEEXT) $(srcdir)/test0.cdl
+	$(TESTS_ENVIRONMENT) ./ncgen -c -o ctest0.nc $(srcdir)/test0.cdl > test0.c
+	$(COMPILE) -c -o ctest0$(EXEEXT).o test0.c
+	$(LINK) ctest0$(EXEEXT).o $(ctest0_LDADD) $(LDFLAGS) $(SHLIBLOC) $(LIBS)
+
+TEST_SCRIPT = testncgen.sh
+check_SCRIPTS = testncgen.sh
+
+#############################################################################
+##                            Miscellaneous                                ##
+#############################################################################
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += ctest1.cdl ftest1.cdl \
+                 test0.nc test1.cdl test1.nc test2.cdl
+
+DISTCLEANFILES = ctest0$(EXEEXT) ctest0.nc ftest0$(EXEEXT) ftest0.nc    \
+                 netcdf.inc test0.c test0.f
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/ncgen/Makefile.in b/mfhdf/ncgen/Makefile.in
new file mode 100644
index 0000000..60d773f
--- /dev/null
+++ b/mfhdf/ncgen/Makefile.in
@@ -0,0 +1,963 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/testncgen.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+bin_PROGRAMS = ncgen$(EXEEXT)
+ at HDF_BUILD_FORTRAN_FALSE@@HDF_BUILD_NETCDF_TRUE at noinst_PROGRAMS = ctest0$(EXEEXT)
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE at noinst_PROGRAMS = ctest0$(EXEEXT) \
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE@	ftest0$(EXEEXT)
+ at HDF_BUILD_NETCDF_FALSE@noinst_PROGRAMS = ctest0$(EXEEXT)
+check_PROGRAMS = ctest0$(EXEEXT) $(am__EXEEXT_1)
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE at am__append_1 = ftest0
+TESTS = $(TEST_SCRIPT)
+subdir = mfhdf/ncgen
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = testncgen.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE at am__EXEEXT_1 = ftest0$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_ctest0_OBJECTS =
+ctest0_OBJECTS = $(am_ctest0_OBJECTS)
+ctest0_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+am_ftest0_OBJECTS =
+ftest0_OBJECTS = $(am_ftest0_OBJECTS)
+ftest0_LDADD = $(LDADD)
+am_ncgen_OBJECTS = close.$(OBJEXT) escapes.$(OBJEXT) \
+	generate.$(OBJEXT) genlib.$(OBJEXT) getfill.$(OBJEXT) \
+	init.$(OBJEXT) load.$(OBJEXT) main.$(OBJEXT) \
+	ncgentab.$(OBJEXT)
+ncgen_OBJECTS = $(am_ncgen_OBJECTS)
+ncgen_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ncgen_LDFLAGS) \
+	$(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(ctest0_SOURCES) $(ftest0_SOURCES) $(ncgen_SOURCES)
+DIST_SOURCES = $(ctest0_SOURCES) $(ftest0_SOURCES) $(ncgen_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man1_MANS)
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog ctest1.cdl ftest1.cdl test0.nc \
+	test1.cdl test1.nc test2.cdl
+ at HDF_BUILD_SHARED_FALSE@SHLIBLOC = $(top_builddir)/mfhdf/libsrc/.libs/libmfhdf.a $(top_builddir)/hdf/src/.libs/libdf.a
+ at HDF_BUILD_SHARED_TRUE@SHLIBLOC = $(top_builddir)/mfhdf/libsrc/.libs/libmfhdf.$(SHARED_EXTENSION) $(top_builddir)/hdf/src/.libs/libdf.$(SHARED_EXTENSION)
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+ncgen_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
+ncgen_SOURCES = close.c escapes.c generate.c genlib.c getfill.c init.c      \
+                load.c main.c ncgentab.c
+
+ncgen_LDADD = $(LIBMFHDF) $(LIBHDF)
+ncgen_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+ctest0_SOURCES = 
+ctest0_LDADD = $(LIBMFHDF) $(LIBHDF)
+ftest0_SOURCES = 
+
+#############################################################################
+#############################################################################
+man1_MANS = ncgen.1
+
+#############################################################################
+#############################################################################
+NCDUMP = $(top_builddir)/mfhdf/ncdump/ncdump
+TEST_SCRIPT = testncgen.sh
+check_SCRIPTS = testncgen.sh
+DISTCLEANFILES = ctest0$(EXEEXT) ctest0.nc ftest0$(EXEEXT) ftest0.nc    \
+                 netcdf.inc test0.c test0.f
+
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/ncgen/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/ncgen/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+testncgen.sh: $(top_builddir)/config.status $(srcdir)/testncgen.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+ at HDF_BUILD_FORTRAN_FALSE@ftest0$(EXEEXT): $(ftest0_OBJECTS) $(ftest0_DEPENDENCIES) $(EXTRA_ftest0_DEPENDENCIES) 
+ at HDF_BUILD_FORTRAN_FALSE@	@rm -f ftest0$(EXEEXT)
+ at HDF_BUILD_FORTRAN_FALSE@	$(LINK) $(ftest0_OBJECTS) $(ftest0_LDADD) $(LIBS)
+ at HDF_BUILD_NETCDF_FALSE@ftest0$(EXEEXT): $(ftest0_OBJECTS) $(ftest0_DEPENDENCIES) $(EXTRA_ftest0_DEPENDENCIES) 
+ at HDF_BUILD_NETCDF_FALSE@	@rm -f ftest0$(EXEEXT)
+ at HDF_BUILD_NETCDF_FALSE@	$(LINK) $(ftest0_OBJECTS) $(ftest0_LDADD) $(LIBS)
+ncgen$(EXEEXT): $(ncgen_OBJECTS) $(ncgen_DEPENDENCIES) $(EXTRA_ncgen_DEPENDENCIES) 
+	@rm -f ncgen$(EXEEXT)
+	$(ncgen_LINK) $(ncgen_OBJECTS) $(ncgen_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/close.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/escapes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/generate.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genlib.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getfill.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/init.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/load.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ncgentab.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-man1: $(man1_MANS)
+	@$(NORMAL_INSTALL)
+	@list1='$(man1_MANS)'; \
+	list2=''; \
+	test -n "$(man1dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.1[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@list='$(MANS)'; if test -n "$$list"; then \
+	  list=`for p in $$list; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+	  if test -n "$$list" && \
+	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+	    echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
+	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+	    echo "       typically 'make maintainer-clean' will remove them" >&2; \
+	    exit 1; \
+	  else :; fi; \
+	else :; fi
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+	clean-libtool clean-noinstPROGRAMS cscopelist ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-man1 install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS uninstall-man uninstall-man1
+
+
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE at netcdf.inc:
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE@	ln -s $(top_builddir)/mfhdf/fortran/$@ .
+
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE at ftest0$(EXEEXT):		ncgen$(EXEEXT) test0.cdl netcdf.inc
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE@	$(TESTS_ENVIRONMENT) ./ncgen -f -o ftest0.nc $(srcdir)/test0.cdl > test0.f
+ at HDF_BUILD_FORTRAN_TRUE@@HDF_BUILD_NETCDF_TRUE@	$(F77) $(FFLAGS) -o $@ test0.f $(LDFLAGS) $(SHLIBLOC) $(LIBS)
+
+ctest0$(EXEEXT):		ncgen$(EXEEXT) $(srcdir)/test0.cdl
+	$(TESTS_ENVIRONMENT) ./ncgen -c -o ctest0.nc $(srcdir)/test0.cdl > test0.c
+	$(COMPILE) -c -o ctest0$(EXEEXT).o test0.c
+	$(LINK) ctest0$(EXEEXT).o $(ctest0_LDADD) $(LDFLAGS) $(SHLIBLOC) $(LIBS)
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/ncgen/README b/mfhdf/ncgen/README
new file mode 100644
index 0000000..a475f50
--- /dev/null
+++ b/mfhdf/ncgen/README
@@ -0,0 +1,19 @@
+This directory contains source code for ncgen, a netCDF utility that
+converts a CDL description of a netCDF file into a netCDF file, or that
+generates the C or FORTRAN source code required to create the netCDF
+file.  Before compiling the sources in this directory, you must have
+already made the netCDF library from the ../src directory.
+
+For VMS, first make sure you have compiled [-.util]getopt.c, then type
+"@make".  The make.com, make.opt, and *-vms files are for VMS only.
+
+For Microsoft MSDOS and OS/2 platforms, use the msoft.mk Makefile.
+
+To test ncgen, you should first make sure the appropriate FORTRAN
+jackets are compiled and installed in the netCDF library.  Then "make
+test" will test creating a netCDF file from a test CDL file (in
+test0.cdl), creating the same netCDF file by generating C code and
+running it, and finally creating the same netCDF file by generating
+FORTRAN code and running it.  If your FORTRAN compiler understands BYTE
+declarations, you can uncomment the byte declarations and data in
+test0.cdl before testing ncgen.
diff --git a/mfhdf/ncgen/close.c b/mfhdf/ncgen/close.c
new file mode 100644
index 0000000..a6fc926
--- /dev/null
+++ b/mfhdf/ncgen/close.c
@@ -0,0 +1,55 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: close.c 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+#include <stdio.h>
+#include "ncgen.h"
+#ifdef EIP
+#include "genlib.h"
+#endif
+
+extern void fline(), cline();
+extern int netcdf_flag;
+extern int c_flag;
+extern int fortran_flag;
+
+static void
+cl_netcdf()
+{
+    if (ncclose(ncid) == -1)
+      derror ("error closing netcdf");
+}
+
+#define fpr    (void) fprintf
+
+static void
+cl_c()
+{
+    cline("   ncclose (ncid);");
+    cline("   return 0;");
+    cline("}");
+}
+
+
+static void
+cl_fortran()
+{
+    fline("call ncclos (ncid, iret)");
+    fline("end");
+}
+
+
+
+void
+close_netcdf()
+{
+    if (netcdf_flag)
+      cl_netcdf();		/* close netcdf */
+    if (c_flag)			/* create C code to close netcdf */
+      cl_c();
+    if (fortran_flag)		/* create Fortran code to close netcdf */
+      cl_fortran();
+}
+
diff --git a/mfhdf/ncgen/depend b/mfhdf/ncgen/depend
new file mode 100644
index 0000000..a099fa8
--- /dev/null
+++ b/mfhdf/ncgen/depend
@@ -0,0 +1,42 @@
+close.o: close.c
+close.o: ncgen.h
+close.o: ../../mfhdf/libsrc/netcdf.h
+close.o: ../../hdf/src//hlimits.h
+close.o: generic.h
+close.o: genlib.h
+escapes.o: escapes.c
+generate.o: generate.c
+generate.o: ncgen.h
+generate.o: ../../mfhdf/libsrc/netcdf.h
+generate.o: ../../hdf/src//hlimits.h
+generate.o: generic.h
+generate.o: genlib.h
+genlib.o: genlib.c
+genlib.o: genlib.h
+getfill.o: getfill.c
+getfill.o: ../../mfhdf/libsrc/netcdf.h
+getfill.o: ../../hdf/src//hlimits.h
+getfill.o: generic.h
+getfill.o: genlib.h
+init.o: init.c
+init.o: ncgen.h
+init.o: ../../mfhdf/libsrc/netcdf.h
+init.o: ../../hdf/src//hlimits.h
+init.o: generic.h
+load.o: load.c
+load.o: ncgen.h
+load.o: ../../mfhdf/libsrc/netcdf.h
+load.o: ../../hdf/src//hlimits.h
+load.o: generic.h
+load.o: genlib.h
+main.o: main.c
+main.o: genlib.h
+msofttab.o: msofttab.c
+msofttab.o: ncgen.h
+msofttab.o: ../../mfhdf/libsrc/netcdf.h
+msofttab.o: ../../hdf/src//hlimits.h
+msofttab.o: generic.h
+msofttab.o: msoftyy.c
+msofttab.o: msofttab.h
+msoftyy.o: msoftyy.c
+msoftyy.o: msofttab.h
diff --git a/mfhdf/ncgen/escapes.c b/mfhdf/ncgen/escapes.c
new file mode 100644
index 0000000..50ee748
--- /dev/null
+++ b/mfhdf/ncgen/escapes.c
@@ -0,0 +1,92 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: escapes.c 3226 1997-11-05 19:41:13Z koziol $
+ *********************************************************************/
+
+#include <stdlib.h>
+
+/*
+ * "Expands" valid escape sequences in yystring (read by lex) into the
+ * apropriate characters in termstring.  For example, the two character
+ * sequence "\t" in yystring would be converted into a single tab character
+ * in termstring.  On return, termstring is properly terminated.
+ */
+
+void
+expand_escapes(termstring, yytext, yyleng)
+     char *termstring;		/* returned, with escapes expanded */
+     char *yytext;
+     int yyleng;
+{
+    char *s, *t, *endp;
+    
+    yytext[yyleng-1]='\0';	/* don't copy quotes */
+    /* expand "\" escapes, e.g. "\t" to tab character  */
+    s = termstring;
+    t = yytext+1;
+    while(*t) {
+	if (*t == '\\') {
+	    t++;
+	    switch (*t) {
+	      case 'a':
+		*s++ = '\007'; t++; /* will use '\a' when STDC */
+		break;
+	      case 'b':
+		*s++ = '\b'; t++;
+		break;
+	      case 'f':
+		*s++ = '\f'; t++;
+		break;
+	      case 'n':
+		*s++ = '\n'; t++;
+		break;
+	      case 'r':
+		*s++ = '\r'; t++;
+		break;
+	      case 't':
+		*s++ = '\t'; t++;
+		break;
+	      case 'v':
+		*s++ = '\v'; t++;
+		break;
+	      case '\\':
+		*s++ = '\\'; t++;
+		break;
+	      case '?':
+		*s++ = '\177'; t++;
+		break;
+	      case '\'':
+		*s++ = '\''; t++;
+		break;
+	      case '\"':
+		*s++ = '\"'; t++;
+		break;
+	      case 'x':
+		t++; /* now t points to one or more hex digits */
+		*s++ = (char) strtol(t, &endp, 16);
+		t = endp;
+		break;
+	      case '0':
+	      case '1':
+	      case '2':
+	      case '3':
+	      case '4':
+	      case '5':
+	      case '6':
+	      case '7':
+		/* t now points to octal digits */
+		*s++ = (char) strtol(t, &endp, 8);
+		t = endp;
+		break;
+	      default:
+		*s++ = *t++;
+		break;
+	    }
+	} else {
+	    *s++ = *t++;
+	}
+    }
+    *s = '\0';
+    return;
+}
diff --git a/mfhdf/ncgen/generate.c b/mfhdf/ncgen/generate.c
new file mode 100644
index 0000000..42a2cc1
--- /dev/null
+++ b/mfhdf/ncgen/generate.c
@@ -0,0 +1,1066 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: generate.c 6032 2014-01-17 18:13:52Z acheng $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include "ncgen.h"
+#include "genlib.h"
+
+extern char *netcdf_name; /* output netCDF filename, if on command line. */
+
+static const char *ncftype(nc_type);
+static const char *ftypename(nc_type);
+static char *cstring(nc_type, void *, int);
+
+extern int netcdf_flag;
+extern int c_flag;
+extern int fortran_flag;
+
+/* create netCDF from in-memory structure */
+static void
+gen_netcdf(filename)
+     char *filename;		/* name for output netcdf file */
+{
+    int idim, ivar, iatt;
+    int istat;
+    int dimids[H4_MAX_NC_DIMS];
+    int varids[H4_MAX_NC_VARS];
+
+    ncid = nccreate (filename, NC_CLOBBER);
+
+    /* define dimensions from info in dims array */
+    for (idim = 0; idim < ndims; idim++) {
+	dimids[idim] = ncdimdef(ncid, dims[idim].name, dims[idim].size);
+	if (dimids[idim] == -1)
+	  derror("error defining dimension %s of size %ld",
+		 dims[idim].name,dims[idim].size);
+    }
+
+    /* define variables from info in vars array */
+    for (ivar = 0; ivar < nvars; ivar++) {
+	varids[ivar] = ncvardef (ncid,
+				  vars[ivar].name,
+				  vars[ivar].type,
+				  vars[ivar].ndims,
+				  vars[ivar].dims);
+	if (varids[ivar] == -1)
+	  derror("error defining variable %s", vars[ivar].name);
+    }
+
+    /* define attributes from info in atts array */
+    for (iatt = 0; iatt < natts; iatt++) {
+	istat = ncattput(ncid,
+			  (atts[iatt].var == -1) ? NC_GLOBAL : atts[iatt].var,
+			  atts[iatt].name,
+			  atts[iatt].type,
+			  atts[iatt].len,
+			  atts[iatt].val);
+	if (istat == -1)
+	  derror("error defining attribute %s for variable %s",
+		 atts[iatt].name,vars[atts[ivar].var].name);
+    }
+
+    istat = ncendef (ncid);
+    if (istat == -1) {
+	derror("error returned from ncendef, exiting ...");
+	exit(2);
+    }
+}
+
+/*
+ * Output a C statement.
+ */
+void
+cline(stmnt)
+     const char *stmnt;
+{
+    FILE *cout = stdout;
+    
+    fputs(stmnt, cout);
+    fputs("\n", cout);
+}
+
+
+/* generate C code for creating netCDF from in-memory structure */
+static void
+gen_c(filename)
+     char *filename;
+{
+    int idim, ivar, iatt, jatt, itype, maxdims;
+    int scalar_atts, vector_atts;
+    char *val_string;
+    char stmnt[C_MAX_STMNT];
+    char s2[H4_MAX_NC_NAME + 2];
+
+    static const char *ctypes[] = {"char","short","nclong","float","double"};
+    int ntypes = (sizeof ctypes) / (sizeof ctypes[0]);
+
+    /* wrap in main program */
+    cline("#include \"h4config.h\"");
+    cline("#ifdef H4_HAVE_NETCDF");
+    cline("#include \"netcdf.h\"");
+    cline("#else");
+    cline("#include \"hdf4_netcdf.h\"");
+    cline("#endif");
+/*    cline("#include \"netcdf.h\""); */
+    cline("");
+    cline("int");
+    sprintf(stmnt, "main() {\t\t\t/* create %s */", filename);
+    cline(stmnt);
+
+    /* create necessary declarations */
+    cline("");
+    cline("   int  ncid;\t\t\t/* netCDF id */");
+
+    if (ndims > 0) {
+	cline("");
+	cline("   /* dimension ids */");
+	strcpy(stmnt, "   int  ");
+	for (idim = 0; idim < ndims; idim++) {
+	    sprintf(s2,
+		    "%s_dim%s",
+		    dims[idim].name,
+		    idim == ndims-1 ? ";" : ", ");
+	    if (strlen(stmnt) + strlen(s2) >= C_MAX_STMNT) {
+		if (idim < ndims-1) {
+		    stmnt[strlen(stmnt)-2] = '\0'; /* truncate trailing ", " */
+		    strcat(stmnt, ";");
+		    cline(stmnt);
+		    strcpy(stmnt, "   int  ");
+		}
+	    }
+	    strcat(stmnt, s2);
+	}
+	cline(stmnt);
+    }
+
+    maxdims = 0;	/* most dimensions of any variable */
+    for (ivar = 0; ivar < nvars; ivar++)
+      if (vars[ivar].ndims > maxdims)
+	maxdims = vars[ivar].ndims;
+
+    if (nvars > 0) {
+	cline("");
+	cline("   /* variable ids */");
+	strcpy(stmnt, "   int  ");
+	for (ivar = 0; ivar < nvars; ivar++) {
+	    sprintf(s2, "%s_id%s",
+		    vars[ivar].name,
+		    ivar == nvars-1 ? ";" : ", ");
+	    if (strlen(stmnt) + strlen(s2) >= C_MAX_STMNT) {
+		if (ivar < nvars-1) {
+		    stmnt[strlen(stmnt)-2] = '\0'; /* truncate trailing ", " */
+		    strcat(stmnt, ";");
+		    cline(stmnt);
+		    strcpy(stmnt, "   int  ");
+		}
+	    }
+	    strcat(stmnt, s2);
+	}
+	cline(stmnt);
+
+	if (maxdims > 0) {	/* we have dimensioned variables */
+	    cline("");
+	    cline("   /* variable shapes */");
+	    sprintf(stmnt, "   int dims[%d];", maxdims);
+	    cline(stmnt);
+	}
+    }
+
+    /* determine if any containers for scalar attributes needed */
+    scalar_atts = 0;
+    for (iatt = 0; iatt < natts; iatt++) {
+	if (atts[iatt].len == 1) {
+	    scalar_atts = 1;
+	    break;
+	}
+    }
+    if (scalar_atts) {
+	cline("");
+	cline("   /* containers for scalar attributes */");
+	for (itype = 0; itype < ntypes; itype++) {
+	    for (iatt = 0; iatt < natts; iatt++) {
+		char type_name[12]; /* big enough for longest c typename */
+		(void) strcpy(type_name,ncctype(atts[iatt].type));
+		if (atts[iatt].len == 1 &&
+		    strcmp(type_name,ctypes[itype]) == 0) {
+		    sprintf(stmnt, "   %s  %s_val;", type_name, type_name);
+		    cline(stmnt);
+		    break;
+		}
+	    }
+	}
+    }
+
+    /* determine if we need any attribute vectors */
+    vector_atts = 0;
+    for (iatt = 0; iatt < natts; iatt++) {
+	if (atts[iatt].len > 1 && atts[iatt].type != NC_CHAR) {
+	    vector_atts = 1;
+	    break;
+	}
+    }
+    if (vector_atts) {
+	cline("");
+	cline("   /* attribute vectors */");
+	for (iatt = 0; iatt < natts; iatt++) {
+	    if (atts[iatt].len > 1 && atts[iatt].type != NC_CHAR) {
+		sprintf(stmnt,
+		    "   %s  %s_%s[%d];",
+		    ncctype(atts[iatt].type),
+		    atts[iatt].var == -1 ? "cdf" : vars[atts[iatt].var].name,
+		    atts[iatt].name,
+		    atts[iatt].len);
+		cline(stmnt);
+	    }
+	}
+    }
+
+    /* create netCDF file, uses NC_CLOBBER mode */
+    cline("");
+    cline("   /* enter define mode */");
+    sprintf(stmnt,
+	    "   ncid = nccreate(\"%s\", NC_CLOBBER);",
+	    filename);
+    cline(stmnt);
+    
+    /* define dimensions from info in dims array */
+    if (ndims > 0) {
+	cline("");
+	cline("   /* define dimensions */");
+    }
+    for (idim = 0; idim < ndims; idim++) {
+	if (dims[idim].size == NC_UNLIMITED)
+	  sprintf(stmnt,
+		  "   %s_dim = ncdimdef(ncid, \"%s\", NC_UNLIMITED);",
+		  dims[idim].name,
+		  dims[idim].name);
+	else
+	  sprintf(stmnt,
+		  "   %s_dim = ncdimdef(ncid, \"%s\", %dL);",
+		  dims[idim].name,dims[idim].name,
+		  (int)dims[idim].size);
+	cline(stmnt);
+    }
+
+    /* define variables from info in vars array */
+    if (nvars > 0) {
+	cline("");
+	cline("   /* define variables */");
+	for (ivar = 0; ivar < nvars; ivar++) {
+	    cline("");
+	    for (idim = 0; idim < vars[ivar].ndims; idim++) {
+		sprintf(stmnt,
+			"   dims[%d] = %s_dim;",
+			idim,
+			dims[vars[ivar].dims[idim]].name);
+		cline(stmnt);
+	    }
+	    if (vars[ivar].ndims > 0) {	/* a dimensioned variable */
+		sprintf(stmnt,
+			"   %s_id = ncvardef (ncid, \"%s\", %s, %d, dims);",
+			vars[ivar].name,
+			vars[ivar].name,
+			nctype(vars[ivar].type),
+			vars[ivar].ndims);
+	    } else {		/* a scalar */
+		sprintf(stmnt,
+			"   %s_id = ncvardef (ncid, \"%s\", %s, %d, 0);",
+			vars[ivar].name,
+			vars[ivar].name,
+			nctype(vars[ivar].type),
+			vars[ivar].ndims);
+	    }
+	    cline(stmnt);
+	}
+    }
+    
+    /* define attributes from info in atts array */
+    if (natts > 0) {
+	cline("");
+	cline("   /* assign attributes */");
+	for (iatt = 0; iatt < natts; iatt++) {
+	    if (atts[iatt].type == NC_CHAR && atts[iatt].len > 1) { /* string */
+		val_string = cstrstr((char *) atts[iatt].val,
+				     (long)atts[iatt].len);
+		sprintf(stmnt,
+			"   ncattput (ncid, %s%s, \"%s\", NC_CHAR, %d, (void *)%s);",
+			atts[iatt].var == -1 ? "NC_GLOBAL" : vars[atts[iatt].var].name,
+			atts[iatt].var == -1 ? "" : "_id",
+			atts[iatt].name,
+			atts[iatt].len,
+			val_string);
+		cline(stmnt);
+		free (val_string);
+	    }
+	    else if (atts[iatt].len <= 1) {	/* scalar attribute */
+		val_string = cstring(atts[iatt].type, atts[iatt].val, 0);
+		sprintf(stmnt, "   %s_val = %s;",
+			ncctype(atts[iatt].type),
+			val_string);
+		cline(stmnt);
+		sprintf(stmnt,
+			"   ncattput (ncid, %s%s, \"%s\", %s, %d,(void *) &%s_val);",
+			atts[iatt].var == -1 ? "NC_GLOBAL" : vars[atts[iatt].var].name,
+			atts[iatt].var == -1 ? "" : "_id",
+			atts[iatt].name,
+			nctype(atts[iatt].type),
+			atts[iatt].len,
+			ncctype(atts[iatt].type));
+		cline(stmnt);
+		free (val_string);
+	    }
+	    else {			/* vector attribute */
+		for (jatt = 0; jatt < atts[iatt].len ; jatt++) {
+		    val_string = cstring(atts[iatt].type,atts[iatt].val,jatt);
+		    sprintf(stmnt, "   %s_%s[%d] = %s;",
+			    atts[iatt].var == -1 ? "cdf" : vars[atts[iatt].var].name,
+			    atts[iatt].name,
+			    jatt, 
+			    val_string);
+		    cline(stmnt);
+		    free (val_string);
+		}
+		
+		sprintf(stmnt,
+			"   ncattput (ncid, %s%s, \"%s\", %s, %d, (void *) %s_%s);",
+			atts[iatt].var == -1 ? "NC_GLOBAL" : vars[atts[iatt].var].name,
+			atts[iatt].var == -1 ? "" : "_id",
+			atts[iatt].name,
+			nctype(atts[iatt].type),
+			atts[iatt].len,
+			atts[iatt].var == -1 ? "cdf" : vars[atts[iatt].var].name,
+			atts[iatt].name);
+		cline(stmnt);
+	    }
+	}
+    }
+    cline("");
+    cline("   /* leave define mode */");
+    cline("   ncendef (ncid);");
+}
+
+/*
+ * From a long line FORTRAN statment, generates the necessary FORTRAN
+ * lines with continuation characters in column 6.  If stmnt starts with "*",
+ * it is treated as a one-line comment.  Statement labels are *not* handled,
+ * but since we don't generate any labels, we don't care.
+ */
+void
+fline(stmnt)
+     const char *stmnt;
+{
+    FILE *fout = stdout;
+    int len = strlen(stmnt);
+    int line = 0;
+    static char cont[] = {	/* continuation characters */
+	' ', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+	'+', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'};
+    
+    if(stmnt[0] == '*') {
+	fputs(stmnt, fout);
+	fputs("\n", fout);
+	return;
+    }
+
+    while (len > 0) {
+	if (line >= FORT_MAX_LINES)
+	  derror("FORTRAN statement too long: %s",stmnt);
+	(void) fprintf(fout, "     %c", cont[line++]);
+	(void) fprintf(fout, "%.66s\n", stmnt);
+	len -= 66;
+	if (len > 0)
+	  stmnt += 66;
+    }
+}
+
+
+/* generate FORTRAN code for creating netCDF from in-memory structure */
+static void
+gen_fortran(filename)
+     char *filename;
+{
+    int idim, ivar, iatt, jatt, itype, maxdims;
+    int vector_atts;
+    char *val_string;
+    char stmnt[FORT_MAX_STMNT];
+    char s2[H4_MAX_NC_NAME + 2];
+    /* Need how many netCDF types there are, because we create an array
+     * for each type of attribute. */
+    int ntypes = 6;		/* number of netCDF types, NC_BYTE, ... */
+    nc_type types[6];		/* at least ntypes */
+    const char *ftypes[NC_DOUBLE + 1];
+    int max_atts[NC_DOUBLE + 1];
+
+    types[0] = NC_BYTE;
+    types[1] = NC_CHAR;
+    types[2] = NC_SHORT;
+    types[3] = NC_LONG;
+    types[4] = NC_FLOAT;
+    types[5] = NC_DOUBLE;
+    ftypes[(int) NC_BYTE] = "byte";
+    ftypes[(int) NC_CHAR] = "char";
+    ftypes[(int) NC_SHORT] = "short";
+    ftypes[(int) NC_LONG] = "nclong";
+    ftypes[(int) NC_FLOAT] = "float";
+    ftypes[(int) NC_DOUBLE] = "double";
+
+    /* wrap in main program */
+#ifdef MSDOS
+    printf("$include: \"msoft.int\"\n");
+#endif
+    sprintf(stmnt, "program fgennc");
+    fline(stmnt);
+#ifdef MSDOS
+    printf("$include: \"netcdf.inc\"\n");
+#else
+    fline("include 'netcdf.inc'");
+#endif
+
+    /* create necessary declarations */
+    fline("integer  iret");
+    fline("* netCDF id");
+    fline("integer  ncid");
+
+    if (ndims > 0) {
+	fline("* dimension ids");
+	strcpy(stmnt, "integer  ");
+	for (idim = 0; idim < ndims; idim++) {
+	    sprintf(s2, "%sdim%s", dims[idim].name,
+		    idim == ndims-1 ? "" : ", ");
+	    if (strlen(stmnt) + strlen(s2) >= FORT_MAX_STMNT) {
+		if (idim < ndims-1) {
+		    stmnt[strlen(stmnt)-2] = '\0'; /* truncate trailing ", " */
+		    fline(stmnt);
+		    strcpy(stmnt,"integer  ");
+		}
+	    }
+	    strcat(stmnt, s2);
+	}
+	fline(stmnt);
+    }
+
+    maxdims = 0;		/* most dimensions of any variable */
+    for (ivar = 0; ivar < nvars; ivar++)
+      if (vars[ivar].ndims > maxdims)
+	maxdims = vars[ivar].ndims;
+
+    if (nvars > 0) {
+	fline("* variable ids");
+	strcpy(stmnt,"integer  ");
+	for (ivar = 0; ivar < nvars; ivar++) {
+	    sprintf(s2, "%sid%s", vars[ivar].name,
+		    ivar == nvars-1 ? "" : ", ");
+	    if (strlen(stmnt) + strlen(s2) >= FORT_MAX_STMNT) {
+		if (ivar < nvars-1) {
+		    stmnt[strlen(stmnt)-2] = '\0'; /* truncate trailing ", " */
+		    fline(stmnt);
+		    strcpy(stmnt,"integer  ");
+		}
+	    }
+	    strcat(stmnt, s2);
+	}
+	fline(stmnt);
+
+	if (maxdims > 0) {	/* we have dimensioned variables */
+	    fline("* variable shapes");
+	    sprintf(stmnt, "integer dims(%d)", maxdims);
+	    fline(stmnt);
+	}
+    }
+
+    fline("* corners and edge lengths");
+#ifdef MSDOS
+    sprintf(stmnt, "integer*4 corner(%d), edges(%d)", maxdims, maxdims);
+#else
+    sprintf(stmnt, "integer corner(%d), edges(%d)", maxdims, maxdims);
+#endif
+    fline(stmnt);
+
+    /* declarations for variables to be initialized */
+    if (nvars > 0) {		/* we have variables */
+	fline("* data variables");
+	for (ivar = 0; ivar < nvars; ivar++) {
+	    if (vars[ivar].type != NC_CHAR) {
+		if (vars[ivar].ndims == 0) { /* scalar */
+		    sprintf(stmnt, "%s %s", ncftype(vars[ivar].type),
+			    vars[ivar].name);
+		    fline(stmnt);
+		} else {
+		    sprintf(stmnt, "%s %s(", ncftype(vars[ivar].type),
+			    vars[ivar].name);
+		    /* reverse dimensions for FORTRAN */
+		    for (idim = vars[ivar].ndims-1; idim > 0; idim--) {
+			sprintf(s2, "%d,", (int)dims[vars[ivar].dims[idim]].size);
+			strcat(stmnt, s2);
+		    }
+		    if (vars[ivar].dims[0] == rec_dim)
+		      sprintf(s2, "%d)", 1);
+		    else
+		      sprintf(s2, "%d)", (int)dims[vars[ivar].dims[0]].size);
+		    strcat(stmnt, s2);
+		    fline(stmnt);
+		}
+	    } else {		/* for strings, declare multi-char variable */
+		int dimprod = 1;
+		for (idim = vars[ivar].ndims-1; idim > 0; idim--)
+		  dimprod *= dims[vars[ivar].dims[idim]].size;
+		if (vars[ivar].ndims != 0) { /* not a scalar */
+		    if (vars[ivar].dims[0] != rec_dim)
+		      dimprod *= dims[vars[ivar].dims[0]].size;
+		}
+		sprintf(stmnt, "%s*%d %s", ncftype(vars[ivar].type),
+			dimprod,
+			vars[ivar].name);
+		fline(stmnt);
+	    }
+	}
+    }
+
+    /* determine what attribute vectors needed */
+    for (itype = 0; itype < ntypes; itype++)
+      max_atts[(int)types[itype]] = 0;
+
+    vector_atts = 0;
+    for (iatt = 0; iatt < natts; iatt++) {
+	if (atts[iatt].len > max_atts[(int) atts[iatt].type]) {
+	    max_atts[(int)atts[iatt].type] = atts[iatt].len;
+	    vector_atts = 1;
+	}
+    }
+    if (vector_atts) {
+	fline("* attribute vectors");
+	for (itype = 0; itype < ntypes; itype++) {
+	    if (types[itype] != NC_CHAR && max_atts[(int)types[itype]] > 0) {
+		sprintf(stmnt, "%s  %sval(%d)", ncftype(types[itype]),
+			ftypes[(int)types[itype]],
+			max_atts[(int)types[itype]]);
+		fline(stmnt);
+	    }
+	}
+    }
+    
+    /* create netCDF file, uses NC_CLOBBER mode */
+    fline("* enter define mode");
+    sprintf(stmnt, "ncid = nccre (\'%s\', NCCLOB, iret)", filename);
+    fline(stmnt);
+    
+    /* define dimensions from info in dims array */
+    if (ndims > 0)
+      fline("* define dimensions");
+    for (idim = 0; idim < ndims; idim++) {
+	if (dims[idim].size == NC_UNLIMITED)
+	  sprintf(stmnt, "%sdim = ncddef(ncid, \'%s\', NCUNLIM, iret)",
+		  dims[idim].name,dims[idim].name);
+	else
+	  sprintf(stmnt, "%sdim = ncddef(ncid, \'%s\', %d, iret)",
+		  dims[idim].name,dims[idim].name,(int)dims[idim].size);
+	fline(stmnt);
+    }
+	  
+    /* define variables from info in vars array */
+    if (nvars > 0) {
+	fline("* define variables");
+	for (ivar = 0; ivar < nvars; ivar++) {
+	    for (idim = 0; idim < vars[ivar].ndims; idim++) {
+		sprintf(stmnt, "dims(%d) = %sdim",
+			vars[ivar].ndims - idim, /* reverse dimensions */
+			dims[vars[ivar].dims[idim]].name);
+		fline(stmnt);
+	    }
+	    if (vars[ivar].ndims > 0) {	/* a dimensioned variable */
+		sprintf(stmnt, 
+			"%sid = ncvdef (ncid, \'%s\', %s, %d, dims, iret)",
+			vars[ivar].name,
+			vars[ivar].name,
+			ftypename(vars[ivar].type),
+			vars[ivar].ndims);
+	    } else {		/* a scalar */
+		sprintf(stmnt, 
+			"%sid = ncvdef (ncid, \'%s\', %s, %d, 0, iret)",
+			vars[ivar].name,
+			vars[ivar].name,
+			ftypename(vars[ivar].type),
+			vars[ivar].ndims);
+	    }
+	    fline(stmnt);
+	}
+    }
+
+    /* define attributes from info in atts array */
+    if (natts > 0) {
+	fline("* assign attributes");
+	for (iatt = 0; iatt < natts; iatt++) {
+	    if (atts[iatt].type == NC_CHAR && atts[iatt].len > 1) { /* string */
+		val_string = fstrstr((char *) atts[iatt].val,
+				     (long)atts[iatt].len);
+		sprintf(stmnt, 
+			"call ncaptc(ncid, %s%s, \'%s\', NCCHAR, %d, %s, iret)",
+			atts[iatt].var == -1 ? "NCGLOBAL" : vars[atts[iatt].var].name,
+			atts[iatt].var == -1 ? "" : "id",
+			atts[iatt].name,
+			atts[iatt].len,
+			val_string);
+		fline(stmnt);
+		free(val_string);
+	    } else {
+		for (jatt = 0; jatt < atts[iatt].len ; jatt++) {
+		    val_string = fstring(atts[iatt].type,atts[iatt].val,jatt);
+		    sprintf(stmnt, "%sval(%d) = %s",
+			    ftypes[(int)atts[iatt].type],
+			    jatt+1, 
+			    val_string);
+		    fline(stmnt);
+		    free (val_string);
+		}
+	    
+		sprintf(stmnt,
+			"call ncapt(ncid, %s%s, \'%s\', %s, %d, %sval, iret)",
+			atts[iatt].var == -1 ? "NCGLOBAL" : vars[atts[iatt].var].name,
+			atts[iatt].var == -1 ? "" : "id",
+			atts[iatt].name,
+			ftypename(atts[iatt].type),
+			atts[iatt].len,
+			ftypes[(int)atts[iatt].type]);
+		fline(stmnt);
+	    }
+	}
+    }
+    fline("* leave define mode");
+    fline("call ncendf(ncid, iret)");
+}
+
+
+/* return C name for netCDF type, given type code */
+const char *
+nctype(type)
+     nc_type type;			/* netCDF type code */
+{
+    switch (type) {
+      case NC_BYTE:
+	return "NC_BYTE";
+      case NC_CHAR:
+	return "NC_CHAR";
+      case NC_SHORT:
+	return "NC_SHORT";
+      case NC_LONG:
+	return "NC_LONG";
+      case NC_FLOAT:
+	return "NC_FLOAT";
+      case NC_DOUBLE:
+	return "NC_DOUBLE";
+      default:
+	derror("nctype: bad type code");
+	return NULL;
+    }
+}
+
+
+/* return FORTRAN name for netCDF type, given type code */
+static const char *
+ftypename(type)
+     nc_type type;			/* netCDF type code */
+{
+    switch (type) {
+      case NC_BYTE:
+	return "NCBYTE";
+      case NC_CHAR:
+	return "NCCHAR";
+      case NC_SHORT:
+	return "NCSHORT";
+      case NC_LONG:
+	return "NCLONG";
+      case NC_FLOAT:
+	return "NCFLOAT";
+      case NC_DOUBLE:
+	return "NCDOUBLE";
+      default:
+	derror("ftypename: bad type code");
+	return NULL;
+    }
+}
+
+
+/* return C type name for netCDF type, given type code */
+
+const char *
+ncctype(type)
+     nc_type type;			/* netCDF type code */
+{
+    switch (type) {
+      case NC_BYTE:
+	return "char";
+      case NC_CHAR:
+	return "char";
+      case NC_SHORT:
+	return "short";
+      case NC_LONG:
+	return "nclong";
+      case NC_FLOAT:
+	return "float";
+      case NC_DOUBLE:
+	return "double";
+      default:
+	derror("ncctype: bad type code");
+	return NULL;
+    }
+}
+
+
+/* return Fortran type name for netCDF type, given type code */
+
+static const char *
+ncftype(type)
+     nc_type type;		/* netCDF type code */
+{
+    switch (type) {
+      case NC_BYTE:
+	return "byte";		/* non-standard */
+      case NC_CHAR:
+	return "character";
+      case NC_SHORT:
+	return "integer*2";
+      case NC_LONG:
+#ifdef MSDOS
+	return "integer*4";
+#else
+	return "integer";
+#endif
+      case NC_FLOAT:
+	return "real";
+      case NC_DOUBLE:
+	return "double precision";
+      default:
+	derror("ncctype: bad type code");
+	return NULL;
+
+    }
+}
+
+
+/*
+ * Given a netcdf type, a pointer to a vector of values of that type,
+ * and the index of the vector element desired, returns a pointer to a
+ * malloced string representing the value in C.
+ */
+
+static char *
+cstring(type,valp, num)
+     nc_type type;			/* netCDF type code */
+     void *valp;		/* pointer to vector of values */
+     int num;			/* element of vector desired */
+{
+    static char *cp, *sp, ch;
+    char *bytep;
+    short *shortp;
+    nclong *longp;
+    float *floatp;
+    double *doublep;
+
+    switch (type) {
+      case NC_CHAR:
+	sp = cp = (char *) emalloc (7);
+	*cp++ = '\'';
+	ch = *((char *)valp + num);
+	switch (ch) {
+	  case '\b': *cp++ = '\\'; *cp++ = 'b'; break;
+	  case '\f': *cp++ = '\\'; *cp++ = 'f'; break;
+	  case '\n': *cp++ = '\\'; *cp++ = 'n'; break;
+	  case '\r': *cp++ = '\\'; *cp++ = 'r'; break;
+	  case '\t': *cp++ = '\\'; *cp++ = 't'; break;
+	  case '\v': *cp++ = '\\'; *cp++ = 'v'; break;
+	  case '\\': *cp++ = '\\'; *cp++ = '\\'; break;
+/*, tj	  case '\?': *cp++ = '\\'; *cp++ = '?'; break; */
+	  case '\'': *cp++ = '\\'; *cp++ = '\''; break;
+	  default:
+/*, tj	    if (ch < '\040' || ch > '\176') { */ /* assumes ASCII */
+	    if (!isprint((unsigned char)ch)) {
+		static char octs[] = "01234567";
+		int rem = ((unsigned char)ch)%64;
+		*cp++ = '\\';
+		*cp++ = octs[((unsigned char)ch)/64]; /* to get, e.g. '\177' */
+		*cp++ = octs[rem/8];
+		*cp++ = octs[rem%8];
+	    } else {
+		*cp++ = ch;
+	    }
+	    break;
+	}
+	*cp++ = '\'';
+	*cp = '\0';
+	return sp;
+	
+      case NC_BYTE:
+	cp = (char *) emalloc (7);
+	bytep = (char *)valp;
+	(void) sprintf(cp,"'\\%o'", * (bytep + num) & 0xff);
+	return cp;
+
+      case NC_SHORT:
+	cp = (char *) emalloc (10);
+	shortp = (short *)valp;
+	(void) sprintf(cp,"%d",* (shortp + num));
+	return cp;
+
+      case NC_LONG:
+	cp = (char *) emalloc (20);
+	longp = (nclong *)valp;
+	(void) sprintf(cp,"%d",(int)* (longp + num));
+	return cp;
+
+      case NC_FLOAT:
+	cp = (char *) emalloc (20);
+	floatp = (float *)valp;
+	(void) sprintf(cp,"%.8g",* (floatp + num));
+	return cp;
+
+      case NC_DOUBLE:
+	cp = (char *) emalloc (20);
+	doublep = (double *)valp;
+	(void) sprintf(cp,"%.16g",* (doublep + num));
+	return cp;
+
+      default:
+	derror("cstring: bad type code");
+	return 0;
+    }
+}
+
+
+/*
+ * Given a netcdf type, a pointer to a vector of values of that type,
+ * and the index of the vector element desired, returns a pointer to a
+ * malloced string representing the value in FORTRAN.
+ */
+char *
+fstring(type,valp, num)
+     nc_type type;			/* netCDF type code */
+     void *valp;		/* pointer to vector of values */
+     int num;			/* element of vector desired */
+{
+    static char *cp, *sp;
+    char ch;
+    short *shortp;
+    nclong *longp;
+    float *floatp;
+    double *doublep;
+
+    switch (type) {
+      case NC_CHAR:
+      case NC_BYTE:
+	sp = cp = (char *) emalloc (10);
+	ch = *((char *)valp + num);
+	if (isprint((unsigned char)ch)) {
+	    *cp++ = '\'';
+	    *cp++ = ch;
+	    *cp++ = '\'';
+	    *cp = '\0';
+	} else {
+	    sprintf(cp,"%d",(unsigned char)ch); /* char(%d) ? */
+	}
+	return sp;
+
+      case NC_SHORT:
+	cp = (char *) emalloc (10);
+	shortp = (short *)valp;
+	(void) sprintf(cp,"%d",* (shortp + num));
+	return cp;
+
+      case NC_LONG:
+	cp = (char *) emalloc (20);
+	longp = (nclong *)valp;
+	(void) sprintf(cp,"%d",(int)* (longp + num));
+	return cp;
+
+      case NC_FLOAT:
+	cp = (char *) emalloc (20);
+	floatp = (float *)valp;
+	(void) sprintf(cp,"%.8g",* (floatp + num));
+	return cp;
+
+      case NC_DOUBLE:
+	cp = (char *) emalloc (20);
+	doublep = (double *)valp;
+	(void) sprintf(cp,"%.16g",* (doublep + num));
+	return cp;
+
+      default:
+	derror("fstring: bad type code");
+	return 0;
+    }
+}
+
+
+/*
+ * Given a pointer to a counted string, returns a pointer to a malloced string
+ * representing the string as a C constant.
+ */
+char *
+cstrstr(valp, len)
+     char *valp;		/* pointer to vector of characters*/
+     long len;			/* number of characters in valp */
+{
+    static char *sp;
+    char *cp;
+    char *istr, *istr0;		/* for null-terminated copy */
+
+    if(4*len+3 != (unsigned)(4*len+3)) {
+	derror("too much character data!");
+	exit(9);
+    }
+    istr0 = istr = (char *) emalloc((int)len + 1);
+    strncpy(istr, (char *) valp, (int)len);
+    istr[len] = '\0';
+
+    sp = cp = (char *) emalloc(4*(int)len+3);
+
+    *cp++ = '"';
+    while (*istr != '\0') {
+	switch (*istr) {
+	  case '\b': *cp++ = '\\'; *cp++ = 'b'; break;
+	  case '\f': *cp++ = '\\'; *cp++ = 'f'; break;
+	  case '\n': *cp++ = '\\'; *cp++ = 'n'; break;
+	  case '\r': *cp++ = '\\'; *cp++ = 'r'; break;
+	  case '\t': *cp++ = '\\'; *cp++ = 't'; break;
+	  case '\v': *cp++ = '\\'; *cp++ = 'v'; break;
+	  case '\\': *cp++ = '\\'; *cp++ = '\\'; break;
+/*, tj	  case '\?': *cp++ = '\\'; *cp++ = '?'; break; */
+	  case '\'': *cp++ = '\\'; *cp++ = '\''; break;
+	  default:
+/*, tj	    if (*istr < '\040' || *istr > '\176') { */ /* assumes ASCII */
+	    if (!isprint((unsigned char)*istr)) {
+		static char octs[] = "01234567";
+		int rem = ((unsigned char)*istr)%64;
+		*cp++ = '\\';
+		*cp++ = octs[((unsigned char)*istr)/64]; /* to get, e.g. '\177' */
+		*cp++ = octs[rem/8];
+		*cp++ = octs[rem%8];
+	    } else {
+		*cp++ = *istr;
+	    }
+	    break;
+	}
+	istr++;
+    }
+    *cp++ = '"';
+    *cp = '\0';
+    free(istr0);
+    return sp;
+}
+
+
+/*
+ * Given a pointer to a counted string (not necessarily null-terminated),
+ * returns a pointer to a malloced string representing the string as a
+ * FORTRAN string expression.  For example, the string "don't" would yield
+ * the FORTRAN string "'don''t'", and the string "ab\ncd" would yield
+ * "'ab'//char(10)//'cd'".
+ */
+char *
+fstrstr(str, ilen)
+     char *str;			/* pointer to vector of characters */
+     long ilen;			/* number of characters in istr */
+{
+    static char *ostr;
+    char *cp, tstr[12];
+    int was_print = 0;		/* true if last character was printable */
+    char *istr, *istr0;		/* for null-terminated copy */
+
+
+    if(12*ilen != (unsigned)(12*ilen)) {
+	derror("too much character data!");
+	exit(9);
+    }
+    istr0 = istr = (char *) emalloc((int)ilen + 1);
+    strncpy(istr, (char *) str, (int)ilen);
+    istr[ilen] = '\0';
+    
+    ostr = cp = (char *) emalloc(12*(int)ilen);
+    *ostr = '\0';
+    if (*istr == '\0') {	/* empty string input, not legal in FORTRAN */
+	strcat(ostr,"' '");
+	free(istr0);
+	return ostr;
+    }
+    if (isprint((unsigned char)*istr)) {	/* handle first character in input */
+	*cp++ = '\'';
+	if (*istr == '\'') {
+	    *cp++ = '\'';
+	    *cp++ = '\'';
+	} else {
+	    *cp++ = *istr;
+	}
+	*cp = '\0';
+	was_print = 1;
+    } else {
+	sprintf(tstr, "char(%d)", (unsigned char)*istr);
+	strcat(cp, tstr);
+	cp += strlen(tstr);
+	was_print = 0;
+    }
+    istr++;
+
+    while (*istr != '\0') {	/* handle subsequent characters in input */
+	if (isprint((unsigned char)*istr)) {
+	    if (! was_print) {
+		strcat(cp, "//'");
+		cp += 3;
+	    }
+	    if (*istr == '\'') {
+		*cp++ = '\'';
+		*cp++ = '\'';
+	    } else {
+		*cp++ = *istr;
+	    }
+	    *cp = '\0';
+	    was_print = 1;
+	} else {
+	    if (was_print) {
+		*cp++ = '\'';
+		*cp = '\0';
+	    }
+	    sprintf(tstr, "//char(%d)", (unsigned char)*istr);
+	    strcat(cp, tstr);
+	    cp += strlen(tstr);
+	    was_print = 0;
+	}
+	istr++;
+    }
+    if (was_print)
+      *cp++ = '\'';
+    *cp = '\0';
+    free(istr0);
+    return ostr;
+}
+
+
+/* invoke netcdf calls (or generate C or Fortran code) to create netcdf
+ * from in-memory structure. */
+void
+define_netcdf(netcdfname)
+     char *netcdfname;
+{
+    char *filename;		/* output file name */
+    
+    if (netcdf_name) {		/* name given on command line */
+	filename = netcdf_name;
+    } else {			/* construct name from CDL name */
+	filename = (char *) emalloc(strlen(netcdfname) + 5);
+	(void) strcpy(filename,netcdfname);
+	if (netcdf_flag == 1)
+	  (void) strcat(filename,".nc"); /* new, favored extension */
+	else if (netcdf_flag == -1)
+	  (void) strcat(filename,".cdf"); /* old, deprecated extension */
+    }
+    if (netcdf_flag)
+      gen_netcdf(filename);	/* create netcdf */
+    if (c_flag)			/* create C code to create netcdf */
+      gen_c(filename);
+    if (fortran_flag)		/* create Fortran code to create netcdf */
+      gen_fortran(filename);
+}
diff --git a/mfhdf/ncgen/generic.h b/mfhdf/ncgen/generic.h
new file mode 100644
index 0000000..3b3e46d
--- /dev/null
+++ b/mfhdf/ncgen/generic.h
@@ -0,0 +1,13 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: generic.h 2365 1996-03-26 22:43:35Z georgev $
+ *********************************************************************/
+
+union generic {			/* used to hold any kind of fill_value */
+    double doublev;
+    float floatv;
+    nclong longv;
+    short shortv;
+    char charv;
+};
diff --git a/mfhdf/ncgen/genlib.c b/mfhdf/ncgen/genlib.c
new file mode 100644
index 0000000..455a5a7
--- /dev/null
+++ b/mfhdf/ncgen/genlib.c
@@ -0,0 +1,96 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: genlib.c 3226 1997-11-05 19:41:13Z koziol $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef NO_STDARG
+#include	<stdarg.h>
+#else
+/* try varargs instead */
+#include	<varargs.h>
+#endif /* !NO_STDARG */
+
+#include "ncgen.h"
+#include "genlib.h"
+
+int	lineno = 1;
+int	derror_count = 0;
+
+
+/*
+ * For logging error conditions.
+ */
+#ifndef NO_STDARG
+void
+derror(const char *fmt, ...)
+#else
+/*VARARGS1*/
+void
+derror(fmt, va_alist)
+     const char *fmt ;		/* error-message printf-style format */
+     va_dcl			/* variable number of error args, if any */
+#endif /* !NO_STDARG */
+{
+    va_list args ;
+
+
+    if (lineno == 1)
+      (void) fprintf(stderr,"%s: %s: ", progname, cdlname);
+    else  
+      (void) fprintf(stderr,"%s: %s line %d: ", progname, cdlname, lineno);
+
+#ifndef NO_STDARG
+    va_start(args ,fmt) ;
+#else
+    va_start(args) ;
+#endif /* !NO_STDARG */
+
+    (void) vfprintf(stderr,fmt,args) ;
+    va_end(args) ;
+
+    (void) fputc('\n',stderr) ;
+    (void) fflush(stderr);	/* to ensure log files are current */
+    derror_count++;
+}
+
+
+void *
+emalloc (size)			/* check return from malloc */
+int size;
+{
+    void   *p;
+
+    if (size < 0) {
+        derror ("negative arg to emalloc: %d", size);
+	return 0;
+    }
+    p = (void *) malloc ((unsigned) size);
+    if (p == 0) {
+	derror ("out of memory\n");
+	exit(3);
+    }
+    return p;
+}
+
+void *
+erealloc (ptr,size)		/* check return from realloc */
+     void *ptr;
+     int size;
+{
+    void *p;
+
+    if (size < 0) {
+        derror ("negative arg to realloc");
+	return 0;
+    }
+    p = (void *) realloc ((char *) ptr, (unsigned) size);
+
+    if (p == 0) {
+ 	derror ("out of memory");
+	exit(3);
+    }
+    return p;
+}
diff --git a/mfhdf/ncgen/genlib.h b/mfhdf/ncgen/genlib.h
new file mode 100644
index 0000000..cae96d9
--- /dev/null
+++ b/mfhdf/ncgen/genlib.h
@@ -0,0 +1,92 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: genlib.h 3226 1997-11-05 19:41:13Z koziol $
+ *********************************************************************/
+
+extern char	*progname;	/* for error messages */
+extern char	*cdlname;	/* for error messages */
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MIPSEL /* punt */
+#ifndef NO_STDARG
+extern void derror(const char *fmt, ...);
+#else
+extern void derror();
+#endif
+#endif
+
+/*
+extern void	derror		PROTO((
+				       char *fmt,
+				       ...
+				       ));
+*/
+
+extern void	*emalloc	PROTO((
+				       int size
+				       ));
+extern void	*erealloc	PROTO((
+				       void *ptr,
+				       int size
+				       ));
+extern void     usage           PROTO((
+                                       void
+                                       ));
+
+extern void     yyerror         PROTO((
+                                       char *
+                                       ));
+
+extern int      yyparse         PROTO((
+                                       void
+                                       ));
+
+extern void     put_variable    PROTO((
+                                       void *
+                                       ));
+#ifdef OLD_WAY
+extern int      getopt          PROTO((
+                                       int  argc,
+                                       char **argv,
+                                       char *opts
+                                       ))
+#endif
+
+/* generate.c */
+void cline(const char *stmnt);
+void fline(const char *stmnt);
+const char *nctype(nc_type);
+const char *ncctype(nc_type);
+char *cstrstr(char *, long);
+char *fstrstr(char *, long);
+char *fstring(nc_type, void *, int);
+void define_netcdf(char *netcdfname);
+
+/* load.c */
+void load_netcdf(void *rec_start);
+
+/* getfill.c */
+void nc_fill(nc_type , long , void *, union generic );
+void nc_getfill(nc_type , union generic *);
+void nc_putfill(nc_type , void *, union generic *);
+
+/* init.c */
+void init_netcdf(void);
+
+/* close.c */
+void close_netcdf(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mfhdf/ncgen/getfill.c b/mfhdf/ncgen/getfill.c
new file mode 100644
index 0000000..d58ff57
--- /dev/null
+++ b/mfhdf/ncgen/getfill.c
@@ -0,0 +1,131 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: getfill.c 3862 2000-08-29 13:57:05Z koziol $
+ *********************************************************************/
+
+#include "mfhdf.h"
+#include "generic.h"
+#include "genlib.h"
+
+/*
+ * Given netCDF type, return a default fill_value appropriate for
+ * that type.
+ */
+void
+nc_getfill(type, gval)
+     nc_type type;
+     union generic *gval;
+{
+    switch(type) {
+      case NC_CHAR:
+	gval->charv = FILL_CHAR;
+	return;
+      case NC_BYTE:
+	gval->charv = FILL_BYTE;
+	return;
+      case NC_SHORT:
+	gval->shortv = FILL_SHORT;
+	return;
+      case NC_LONG:
+	gval->longv = FILL_LONG;
+	return;
+      case NC_FLOAT:
+	gval->floatv = FILL_FLOAT;
+	return;
+      case NC_DOUBLE:
+	gval->doublev = FILL_DOUBLE;
+	return;
+      default:
+	derror("nc_getfill: unrecognized type");
+    }
+}
+
+void
+nc_fill(type, num, datp, fill_val)
+     nc_type type;			/* netcdf type code  */
+     long num;			/* number of values to fill */
+     void *datp;		/* where to start filling */
+     union generic fill_val;	/* value to use */
+{
+    char *char_valp=NULL;		/* pointers used to accumulate data values */
+    short *short_valp=NULL;
+    nclong *long_valp=NULL;
+    float *float_valp=NULL;
+    double *double_valp=NULL;
+
+    switch (type) {
+      case NC_CHAR:
+      case NC_BYTE:
+	char_valp = (char *) datp;
+	break;
+      case NC_SHORT:
+	short_valp = (short *) datp;
+	break;
+      case NC_LONG:
+	long_valp = (nclong *) datp;
+	break;
+      case NC_FLOAT:
+	float_valp = (float *) datp;
+	break;
+      case NC_DOUBLE:
+	double_valp = (double *) datp;
+	break;
+      default:
+        break;
+    }
+    while (num--) {
+	switch (type) {
+	  case NC_CHAR:
+	  case NC_BYTE:
+	    *char_valp++ = fill_val.charv;
+	    break;
+	  case NC_SHORT:
+	    *short_valp++ = fill_val.shortv;
+	    break;
+	  case NC_LONG:
+	    *long_valp++ = fill_val.longv;
+	    break;
+	  case NC_FLOAT:
+	    *float_valp++ = fill_val.floatv;
+	    break;
+	  case NC_DOUBLE:
+	    *double_valp++ = fill_val.doublev;
+	    break;
+      default:
+        break;
+	}
+    }
+}
+
+
+/*
+ * Given netCDF type, put a value of that type into a fill_value
+ */
+void
+nc_putfill(type, val, gval)
+     nc_type type;
+     void *val;			/* value of type to be put */
+     union generic *gval;	/* where the value is to be put */
+{
+    switch(type) {
+      case NC_CHAR:
+      case NC_BYTE:
+	gval->charv = *(char *)val;
+	return;
+      case NC_SHORT:
+	gval->shortv = *(short *)val;
+	return;
+      case NC_LONG:
+	gval->longv = *(nclong *)val;
+	return;
+      case NC_FLOAT:
+	gval->floatv = *(float *)val;
+	return;
+      case NC_DOUBLE:
+	gval->doublev = *(double *)val;
+	return;
+      default:
+	derror("nc_putfill: unrecognized type");
+    }
+}
diff --git a/mfhdf/ncgen/init.c b/mfhdf/ncgen/init.c
new file mode 100644
index 0000000..71cf094
--- /dev/null
+++ b/mfhdf/ncgen/init.c
@@ -0,0 +1,42 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: init.c 4928 2007-09-06 21:48:49Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include "ncgen.h"
+#include "genlib.h"
+
+extern int netcdf_flag;
+extern int c_flag;
+extern int fortran_flag;
+
+struct dims dims[H4_MAX_NC_DIMS];		/* table of netcdf dimensions */
+
+int ncid;			/* handle for netCDF */
+int ndims;			/* number of dimensions declared for netcdf */
+int nvars;			/* number of variables declared for netcdf */
+int natts;			/* number of attributes */
+int nvdims;			/* number of dimensions for variables */
+int dimnum;			/* dimension number index for variables */
+int varnum;			/* variable number index for attributes */
+int valnum;			/* value number index for attributes */
+int rec_dim;			/* number of the unlimited dimension, if any */
+long var_len;			/* variable length (product of dimensions) */
+int var_size;			/* size of each element of variable */
+long netcdf_record_number;	/* current record number for variables */
+
+struct vars vars[H4_MAX_NC_VARS];	/* should be a malloc'ed list, not an array */
+
+struct atts atts[H4_MAX_NC_ATTRS];	/* should be a malloc'ed list, not an array */
+
+extern void clearout();
+
+void
+init_netcdf() {			/* initialize global counts, flags */
+    clearout();			/* reset symbol table to empty */
+    ndims = 0;
+    nvars = 0;
+    rec_dim = -1;		/* means no unlimited dimension (yet) */
+}
diff --git a/mfhdf/ncgen/load.c b/mfhdf/ncgen/load.c
new file mode 100644
index 0000000..d5d47c8
--- /dev/null
+++ b/mfhdf/ncgen/load.c
@@ -0,0 +1,525 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: load.c 4928 2007-09-06 21:48:49Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "ncgen.h"
+#include "genlib.h"
+
+extern int netcdf_flag;
+extern int c_flag;
+extern int fortran_flag;
+
+void
+load_netcdf(rec_start)	/* write out record from in-memory structure */
+     void *rec_start;
+{
+    int idim;
+    int istat=0;
+    long coords[H4_MAX_VAR_DIMS];
+    long edges[H4_MAX_VAR_DIMS];
+    char *charvalp=NULL;
+    short *shortvalp=NULL;
+    nclong *longvalp=NULL;
+    float *floatvalp=NULL;
+    double *doublevalp=NULL;
+
+    /* load values into variable */
+
+    switch (vars[varnum].type) {
+      case NC_CHAR:
+      case NC_BYTE:
+	charvalp = (char *) rec_start;
+	break;
+      case NC_SHORT:
+	shortvalp = (short *) rec_start;
+	break;
+      case NC_LONG:
+	longvalp = (nclong *) rec_start;
+	break;
+      case NC_FLOAT:
+	floatvalp = (float *) rec_start;
+	break;
+      case NC_DOUBLE:
+	doublevalp = (double *) rec_start;
+	break;
+      default:
+        break;
+    }
+    /* initialize coords to upper left corner (0,0,0,...) */
+    if (vars[varnum].dims[0] == rec_dim) {
+	coords[0] = netcdf_record_number;
+	edges[0] = 1;
+    }
+    else {
+	coords[0] = 0;
+	edges[0] = dims[vars[varnum].dims[0]].size;
+    }
+
+    for (idim = 1; idim < vars[varnum].ndims; idim++) {
+	coords[idim] = 0;
+	edges[idim] = dims[vars[varnum].dims[idim]].size;
+    }
+    
+    switch (vars[varnum].type) {
+      case NC_CHAR:
+      case NC_BYTE:
+	istat = ncvarput (ncid,varnum,coords,edges,(void *)charvalp);
+	break;
+      case NC_SHORT:
+	istat = ncvarput (ncid,varnum,coords,edges,(void *)shortvalp);
+	break;
+      case NC_LONG:
+	istat = ncvarput (ncid,varnum,coords,edges,(void *)longvalp);
+	break;
+      case NC_FLOAT:
+	istat = ncvarput (ncid,varnum,coords,edges,(void *)floatvalp);
+	break;
+      case NC_DOUBLE:
+	istat = ncvarput (ncid,varnum,coords,edges,(void *)doublevalp);
+	break;
+      default:
+        break;
+    }
+    if (istat == -1)
+      derror("error putting value for variable %s",vars[varnum].name);
+}
+
+
+#define fpr    (void) fprintf
+
+/*
+ * Remove trailing zeros (after decimal point) but not trailing decimal
+ * point from ss, a string representation of a floating-point number that
+ * might include an exponent part.
+ */
+    static void
+    tztrim(ss)
+char *ss;			/* returned string representing dd */
+{
+    char *cp, *ep;
+    
+    cp = ss;
+    if (*cp == '-')
+        cp++;
+    while(isdigit((int)*cp) || *cp == '.')
+        cp++;
+    if (*--cp == '.')
+        return;
+    ep = cp+1;
+    while (*cp == '0')
+        cp--;
+    cp++;
+    if (cp == ep)
+        return;
+    while (*ep)
+        *cp++ = *ep++;
+    *cp = '\0';
+    return;
+}
+
+
+/* generate C to put netCDF record from in-memory data */
+static void
+gen_load_c(rec_start)
+     void *rec_start;
+{
+    int idim, ival;
+    char *val_string;
+    char *charvalp=NULL;
+    short *shortvalp=NULL;
+    nclong *longvalp=NULL;
+    float *floatvalp=NULL;
+    double *doublevalp=NULL;
+    char stmnt[C_MAX_STMNT];
+    int stmnt_len;
+    char s2[H4_MAX_NC_NAME + 2];
+
+    /* initialize coords to upper left corner (rec_num,0,0,...) */
+    cline("");
+    sprintf(stmnt, "   {\t\t\t/* store %s */", vars[varnum].name);
+    cline(stmnt);
+
+    if (vars[varnum].ndims > 0) {
+	sprintf(stmnt, "    static long %s_start[] = {", vars[varnum].name);
+	if (vars[varnum].dims[0] == rec_dim)
+	  sprintf(s2, "%ld%s",
+		  netcdf_record_number,
+		  0 < vars[varnum].ndims-1 ? ", " : "};");
+	else
+	  sprintf(s2, "%d%s",
+		  0,
+		  0 < vars[varnum].ndims-1 ? ", " : "};");
+	strcat(stmnt, s2);
+	for (idim = 1; idim < vars[varnum].ndims; idim++) {
+	    sprintf(s2, "%d%s",
+		    0,
+		    idim < vars[varnum].ndims-1 ? ", " : "};");
+	    strcat(stmnt, s2);
+	}
+	cline(stmnt);
+	
+	/* initialize edge lengths from upper left corner */
+	sprintf(stmnt, "    static long %s_edges[] = {", vars[varnum].name);
+	if (vars[varnum].dims[0] == rec_dim)
+	  sprintf(s2, "%d%s",
+		  1,
+		  0 < vars[varnum].ndims-1 ? ", " : "};");
+	else
+	  sprintf(s2, "%ld%s",
+		  dims[vars[varnum].dims[0]].size,
+		  0 < vars[varnum].ndims-1 ? ", " : "};");
+	strcat(stmnt, s2);
+	for (idim = 1; idim < vars[varnum].ndims; idim++) {
+	    sprintf(s2, "%ld%s",
+		    dims[vars[varnum].dims[idim]].size,
+		    idim < vars[varnum].ndims-1 ? ", " : "};");
+	    strcat(stmnt, s2);
+	}
+	cline(stmnt);
+	
+	/* load variable with data values using static initialization */
+	sprintf(stmnt, "    static %s %s[] = {",
+		ncctype(vars[varnum].type),
+		vars[varnum].name);
+	
+	stmnt_len = strlen(stmnt);
+	switch (vars[varnum].type) {
+	  case NC_CHAR:
+	    val_string = cstrstr((char *) rec_start, var_len);
+	    sprintf(s2, "%s", val_string);
+	    strcat(stmnt, s2);
+	    free(val_string);
+	    break;
+	  default:
+	    switch (vars[varnum].type) {
+	      case NC_BYTE:
+		charvalp = (char *) rec_start;
+		break;
+	      case NC_SHORT:
+		shortvalp = (short *) rec_start;
+		break;
+	      case NC_LONG:
+		longvalp = (nclong *) rec_start;
+		break;
+	      case NC_FLOAT:
+		floatvalp = (float *) rec_start;
+		break;
+	      case NC_DOUBLE:
+		doublevalp = (double *) rec_start;
+		break;
+          default:
+            break;
+	    }
+            for (ival = 0; ival < var_len-1; ival++) {
+		switch (vars[varnum].type) {
+		  case NC_BYTE:
+			sprintf(s2, "%d, ", *charvalp++);
+		    break;
+		  case NC_SHORT:
+			sprintf(s2, "%d, ", *shortvalp++);
+		    break;
+		  case NC_LONG:
+			sprintf(s2, "%d, ", (int)*longvalp++);
+		    break;
+		  case NC_FLOAT:
+			sprintf(s2, "%.8g, ", *floatvalp++);
+		    break;
+		  case NC_DOUBLE:
+                        sprintf(s2, "%#.16g", *doublevalp++);
+                        tztrim(s2);
+			strcat(s2, ", ");
+		    break;
+          default:
+            break;
+		}
+		stmnt_len += strlen(s2);
+		if (stmnt_len < C_MAX_STMNT)
+		  strcat(stmnt, s2);
+		else {
+		    cline(stmnt);
+		    strcpy(stmnt,s2);
+		    stmnt_len = strlen(stmnt);
+		}
+	    }
+	    for (;ival < var_len; ival++) {
+		switch (vars[varnum].type) {
+		  case NC_BYTE:
+			sprintf(s2, "%d", *charvalp);
+		    break;
+		  case NC_SHORT:
+			sprintf(s2, "%d", *shortvalp);
+		    break;
+		  case NC_LONG:
+			sprintf(s2, "%d", (int)*longvalp);
+		    break;
+		  case NC_FLOAT:
+			sprintf(s2, "%.8g", *floatvalp);
+		    break;
+		  case NC_DOUBLE:
+ 			sprintf(s2, "%#.16g", *doublevalp++);
+			tztrim(s2);
+                        break;
+          default:
+            break;
+		}
+		stmnt_len += strlen(s2);
+		if (stmnt_len < C_MAX_STMNT)
+		  strcat(stmnt, s2);
+		else {
+		    cline(stmnt);
+		    strcpy(stmnt,s2);
+		    stmnt_len = strlen(stmnt);
+		}
+	    }
+	    break;
+	}
+	strcat(stmnt,"};");
+	cline(stmnt);
+	sprintf(stmnt,
+		"    ncvarput(ncid, %s_id, %s_start, %s_edges, (void *)%s);",
+		vars[varnum].name,
+		vars[varnum].name,
+		vars[varnum].name,
+		vars[varnum].name);
+	cline(stmnt);
+	cline("   }");
+    } else {			/* scalar variables */
+	/* load variable with data values using static initialization */
+	sprintf(stmnt, "    static %s %s = {",
+		ncctype(vars[varnum].type),
+		vars[varnum].name);
+	
+	switch (vars[varnum].type) {
+	  case NC_CHAR:
+	    val_string = cstrstr((char *) rec_start, var_len);
+	    sprintf(s2, "%s", val_string);
+	    strcat(stmnt, s2);
+	    free(val_string);
+	    break;
+	  case NC_BYTE:
+	    charvalp = (char *) rec_start;
+	    sprintf(s2, "%d", *charvalp);
+	    strcat(stmnt, s2);
+	    break;
+	  case NC_SHORT:
+	    shortvalp = (short *) rec_start;
+	    sprintf(s2, "%d", *shortvalp);
+	    strcat(stmnt, s2);
+	    break;
+	  case NC_LONG:
+	    longvalp = (nclong *) rec_start;
+	    sprintf(s2, "%d", (int)*longvalp);
+	    strcat(stmnt, s2);
+	    break;
+	  case NC_FLOAT:
+	    floatvalp = (float *) rec_start;
+	    sprintf(s2, "%.8g", *floatvalp);
+	    strcat(stmnt, s2);
+	    break;
+	  case NC_DOUBLE:
+	    doublevalp = (double *) rec_start;
+ 	    sprintf(s2, "%#.16g", *doublevalp++);
+ 	    tztrim(s2);
+	    strcat(stmnt, s2);
+	    break;
+      default:
+        break;
+	}
+	strcat(stmnt,"};");
+	cline(stmnt);
+	sprintf(stmnt,
+		"    ncvarput1(ncid, %s_id, (long *)0, (void *)&%s);",
+		vars[varnum].name,
+		vars[varnum].name);
+	cline(stmnt);
+	cline("   }");
+    }
+}
+
+/*
+ * Add to a partial Fortran statement, checking if it's too long.  If it is too
+ * long, output the first part of it as a single statement with continuation
+ * characters and start a new (probably invalid) statement with the remainder.
+ * This will cause a Fortran compiler error, but at least all the information
+ * will be available.
+ */
+static void
+fstrcat(s, t, slenp)
+     char *s;			/* source string of stement being built */
+     char *t;			/* string to be appended to source */
+     long *slenp;		/* pointer to length of source string */
+{
+    *slenp += strlen(t);
+    if (*slenp >= FORT_MAX_STMNT) {
+	derror("FORTRAN statement too long: %s",s);
+	fline(s);
+	strcpy(s, t);
+	*slenp = strlen(s);
+    } else {
+	strcat(s, t);
+    }
+}
+
+
+static void
+gen_load_fortran(rec_start)  /* make Fortran to put record */
+     void *rec_start;
+{
+    int idim, ival;
+    char *val_string;
+    char *charvalp;
+    short *shortvalp;
+    nclong *longvalp;
+    float *floatvalp;
+    double *doublevalp;
+    char stmnt[FORT_MAX_STMNT];
+    long stmnt_len;
+    char s2[H4_MAX_NC_NAME + 2];
+
+    /* initialize coords to upper left corner (1,1,...,rec_num) */
+    sprintf(stmnt, "* store %s", vars[varnum].name);
+    fline(stmnt);
+
+    if (vars[varnum].ndims > 0) {
+	for (idim = 1; idim < vars[varnum].ndims; idim++) {
+	    sprintf(stmnt, "corner(%d) = 1", idim);
+	    fline(stmnt);
+	}
+	if (vars[varnum].dims[0] == rec_dim) {
+	    sprintf(stmnt, "corner(%d) = %d", idim, (int)(netcdf_record_number+1));
+	    fline(stmnt);
+	} else {
+	    sprintf(stmnt, "corner(%d) = 1", idim);
+	    fline(stmnt);
+	}
+	for (idim = vars[varnum].ndims-1; idim > 0; idim--) {
+	    sprintf(stmnt, "edges(%d) = %d", vars[varnum].ndims - idim,
+		    (int)dims[vars[varnum].dims[idim]].size);
+	    fline(stmnt);
+	}
+	if (vars[varnum].dims[0] == rec_dim) {
+	    sprintf(stmnt, "edges(%d) = 1", vars[varnum].ndims - idim);
+	    fline(stmnt);
+	} else {
+	    sprintf(stmnt, "edges(%d) = %d", vars[varnum].ndims - idim,
+		    (int)dims[vars[varnum].dims[0]].size);
+	    fline(stmnt);
+	}
+    } else {			/* scalar variables */
+	fline("corner(1) = 1");
+	fline("edges(1) = 1");
+    }
+
+    /* load variable with data values  */
+    if (vars[varnum].type != NC_CHAR) {
+	sprintf(stmnt, "data %s /",vars[varnum].name);
+	stmnt_len = strlen(stmnt);
+	switch (vars[varnum].type) {
+	  case NC_BYTE:
+	    charvalp = (char *) rec_start;
+	    for (ival = 0; ival < var_len-1; ival++) {
+		val_string = fstring(NC_BYTE,(void *)charvalp++,0);
+		sprintf(s2, "%s, ", val_string);
+		fstrcat(stmnt, s2, &stmnt_len);
+		free(val_string);
+	    }
+	    val_string = fstring(NC_BYTE,(void *)charvalp++,0);
+	    fstrcat(stmnt, val_string, &stmnt_len);
+	    free(val_string);
+	    break;
+	  case NC_SHORT:
+	    shortvalp = (short *) rec_start;
+	    for (ival = 0; ival < var_len-1; ival++) {
+		sprintf(s2, "%d, ", *shortvalp++);
+		fstrcat(stmnt, s2, &stmnt_len);
+	    }
+	    sprintf(s2, "%d", *shortvalp);
+	    fstrcat(stmnt, s2, &stmnt_len);
+	    break;
+	  case NC_LONG:
+	    longvalp = (nclong *) rec_start;
+	    for (ival = 0; ival < var_len-1; ival++) {
+		sprintf(s2, "%d, ", (int)*longvalp++);
+		fstrcat(stmnt, s2, &stmnt_len);
+	    }
+	    sprintf(s2, "%d", (int)*longvalp);
+	    fstrcat(stmnt, s2, &stmnt_len);
+	    break;
+	  case NC_FLOAT:
+	    floatvalp = (float *) rec_start;
+	    for (ival = 0; ival < var_len-1; ival++) {
+		sprintf(s2, "%.8g, ", *floatvalp++);
+		fstrcat(stmnt, s2, &stmnt_len);
+	    }
+	    sprintf(s2, "%.8g", *floatvalp);
+	    fstrcat(stmnt, s2, &stmnt_len);
+	    break;
+	  case NC_DOUBLE:
+	    doublevalp = (double *) rec_start;
+	    for (ival = 0; ival < var_len-1; ival++) {
+ 		sprintf(s2, "%#.16g", *doublevalp++);
+ 		tztrim(s2);
+		fstrcat(s2, ", ", &stmnt_len);
+		fstrcat(stmnt, s2, &stmnt_len);
+	    }
+ 	    sprintf(s2, "%#.16g", *doublevalp++);
+ 	    tztrim(s2);
+	    fstrcat(stmnt, s2, &stmnt_len);
+	    break;
+      default:
+        break;
+	}
+	fstrcat(stmnt, "/", &stmnt_len);
+	fline(stmnt);
+	
+	sprintf(stmnt, "call ncvpt(ncid, %sid, corner, edges, %s, iret)",
+		vars[varnum].name, vars[varnum].name);
+    } else {			/* for strings, call ncvptc() */
+	int dimprod = 1;
+
+	val_string = fstrstr((char *) rec_start, var_len);
+	sprintf(stmnt, "%s = %s",vars[varnum].name, val_string);
+	free(val_string);
+	stmnt_len = strlen(stmnt);
+	fstrcat(stmnt, " // char(0)", &stmnt_len);
+	fline(stmnt);
+	for (idim = vars[varnum].ndims-1; idim > 0; idim--)
+	  dimprod *= dims[vars[varnum].dims[idim]].size;
+	if (vars[varnum].dims[0] != rec_dim)
+	  dimprod *= dims[vars[varnum].dims[0]].size;
+	
+	sprintf(stmnt, "call ncvptc(ncid, %sid, corner, edges, %s, %d, iret)",
+		vars[varnum].name, vars[varnum].name, dimprod);
+    }
+    fline(stmnt);
+}
+
+
+/* invoke netcdf calls (or generate C or Fortran code) to load netcdf variable
+ * from in-memory data.  Assumes following global variables set from yacc
+ * parser:
+ * int varnum        - number of variable to be loaded.
+ * struct vars[varnum] - structure containing info on variable, specifically
+ *                     name, type, ndims, dims, fill_value, has_data
+ * int rec_dim       - id of record dimension, or -1 if none
+ * struct dims[]     - structure containing name and size of dimensions.
+ * int netcdf_record_number - number of current record for this variable.
+ */
+void
+put_variable(rec_start)
+     void *rec_start;		/* points to data to be loaded  */
+{
+    if (netcdf_flag)
+      load_netcdf(rec_start);	/* put variable values (one record's worth) */
+    if (c_flag)		/* create C code to put values */
+      gen_load_c(rec_start);
+    if (fortran_flag)		/* create Fortran code to put values */
+      gen_load_fortran(rec_start);
+}
+
diff --git a/mfhdf/ncgen/main.c b/mfhdf/ncgen/main.c
new file mode 100644
index 0000000..c5bde7d
--- /dev/null
+++ b/mfhdf/ncgen/main.c
@@ -0,0 +1,121 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: main.c 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef __hpux
+#include <locale.h>
+#endif
+    
+#include "ncgen.h"
+#include "genlib.h"
+
+char *progname;			/* for error messages */
+char *cdlname;
+
+int c_flag;
+int fortran_flag;
+int netcdf_flag;
+char *netcdf_name = NULL;	/* name of output netCDF file to write */
+
+extern FILE *yyin, *yyout;
+
+void usage()
+{
+    derror("Usage: %s [-V] [ -b ] [ -c ] [ -f ] [ -o outfile]  [ file ... ]",
+	   progname);
+    exit(8);
+}
+
+int
+main(argc, argv)
+int argc;
+char *argv[];
+{
+    extern int optind;
+    extern int opterr;
+    extern char *optarg;
+    int c;
+    FILE *fp;
+
+    yyin=stdin;
+    yyout=stdout;
+#ifdef __hpux
+    setlocale(LC_CTYPE,"");
+#endif
+    
+#ifdef MDEBUG
+	malloc_debug(2) ;	/* helps find malloc/free errors on Sun */
+#endif /* MDEBUG */
+
+    opterr = 1;			/* print error message if bad option */
+    progname = argv[0];
+    cdlname = "-";
+
+    c_flag = 0;
+    fortran_flag = 0;
+    netcdf_flag = 0;
+
+    while ((c = getopt(argc, argv, "Vbcfno:")) != EOF)
+      switch(c) {
+	case 'V':		/* for c output */
+	  printf("%s, %s\n\n", argv[0], LIBVER_STRING );;
+	  exit(EXIT_SUCCESS);
+	case 'c':		/* for c output */
+	  c_flag = 1;
+	  break;
+	case 'f':		/* for fortran output */
+	  fortran_flag = 1;
+	  break;
+	case 'b':		/* for binary netcdf output, ".nc" extension */
+	  netcdf_flag = 1;
+	  break;
+	case 'n':		/* old version of -b, uses ".cdf" extension */
+	  netcdf_flag = -1;
+	  break;
+	case 'o':		/* to explicitly specify output name */
+	  netcdf_flag = 1;
+	  netcdf_name = (char *) emalloc(strlen(optarg)+1);
+	  if (! netcdf_name) {
+	      derror ("%s: out of memory", progname);
+	      exit(1);
+	  }
+	  strcpy(netcdf_name,optarg);
+	  break;
+	case '?':
+	  usage();
+	  break;
+      }
+
+    if (fortran_flag && c_flag) {
+	derror("Only one of -c or -f may be specified");
+	exit(8);
+      }
+
+    argc -= optind;
+    argv += optind;
+
+    if (argc > 1) {
+	derror ("%s: only one input file argument permitted",progname);
+	exit(6);
+    }
+
+    fp = stdin;
+    if (argc > 0 && strcmp(argv[0], "-") != 0) {
+	if ((fp = fopen(argv[0], "r")) == NULL) {
+	    derror ("can't open file %s for reading: ", argv[0]);
+	    perror("");
+	    exit(7);
+	}
+	cdlname = (char *) emalloc(1 + strlen(argv[0]));
+	strcpy(cdlname, argv[0]);
+    }
+    yyin = fp;
+    return (yyparse());
+}
+
diff --git a/mfhdf/ncgen/ncgen.1 b/mfhdf/ncgen/ncgen.1
new file mode 100644
index 0000000..0b7f5f9
--- /dev/null
+++ b/mfhdf/ncgen/ncgen.1
@@ -0,0 +1,361 @@
+.\" $Id: ncgen.1 2365 1996-03-26 22:43:35Z georgev $
+.TH NCGEN 1 "$Date: 1996-03-26 16:43:35 -0600 (Tue, 26 Mar 1996) $" "Printed: \n(yr-\n(mo-\n(dy" "UNIDATA UTILITIES"
+.SH NAME
+ncgen \- From a CDL file generate a netCDF file, a C program, or a Fortran
+program
+.SH SYNOPSIS
+.HP
+ncgen
+.nh
+\%[-b]
+\%[-c]
+\%[-f]
+\%[-n]
+\%[-o \fIoutput_file\fP]
+\%\fIinput_file\fP
+.hy
+.ft
+.SH DESCRIPTION
+\fBncgen\fP generates either a netCDF file, or C or Fortran source code to
+create a netCDF file.  The input to \fBncgen\fP is a description of a netCDF
+file in a small language known as CDL (network Common Data form Language),
+described below.
+If no options are specified in invoking \fBncgen\fP, it merely checks the
+syntax of the input CDL file, producing error messages for
+any violations of CDL syntax.  Other options can be used to create the
+corresponding netCDF file, to generate a C program that uses the netCDF C
+interface to create the netCDF file, or to generate a Fortran program that
+uses the netCDF Fortran interface to create the same netCDF file.
+.LP
+\fBncgen\fP may be used with the companion program \fBncdump\fP to perform
+some simple operations on netCDF files.  For example, to rename a dimension
+in a netCDF file, use \fBncdump\fP to get a CDL version of the netCDF file,
+edit the CDL file to change the name of the dimensions, and use \fBncgen\fP
+to generate the corresponding netCDF file from the edited CDL file.
+.SH OPTIONS
+.IP "\fB-b\fP"
+Create a (binary) netCDF file.  If the \fB-o\fP option is absent, a default
+file name will be constructed from the netCDF name (specified after the
+\fBnetcdf\fP keyword in the input) by appending the `.nc' extension.  If a
+file already exists with the specified name, it will be overwritten.
+.IP "\fB-c\fP"
+Generate
+.B C
+source code that will create a netCDF file
+matching the netCDF specification.  The C source code is written to
+standard output.
+.IP "\fB-f\fP"
+Generate
+.B Fortran
+source code that will create a netCDF file
+matching the netCDF specification.  The Fortran source code is written
+to standard output.
+.IP "\fB-o\fP \fRoutputfile\fP"
+Name for the netCDF file created.  If this option is specified, it implies
+the "\fB-b\fP" option.  (This option is necessary because netCDF files
+cannot be written directly to standard output, since standard output is not
+seekable.)
+.IP "\fB-n\fP"
+Like \fB-b\fP option, except creates netCDF file with the obsolete `.cdf'
+extension instead of the `.nc' extension, in the absence of an output
+filename specified by the \fB-O\fP option.  This option is only supported
+for backward compatibility.
+.SH EXAMPLES
+.LP
+Check the syntax of the CDL file `\fBfoo.cdl\fP':
+.RS
+.HP
+ncgen foo.cdl
+.RE
+.LP
+From the CDL file `\fBfoo.cdl\fP', generate an equivalent binary netCDF file
+named `\fBx.nc\fP':
+.RS
+.HP
+ncgen -o x.nc foo.cdl
+.RE
+.LP
+From the CDL file `\fBfoo.cdl\fP', generate a C program containing the
+netCDF function invocations necessary to create an equivalent binary netCDF
+file named `\fBx.nc\fP':
+.RS
+.HP
+ncgen -c -o x.nc foo.cdl
+.RE
+.LP
+.SH USAGE
+.SS "CDL Syntax Summary"
+.LP
+Below is an example of CDL syntax, describing a netCDF file with several
+named dimensions (lat, lon, and time), variables (Z, t, p, rh, lat, lon,
+time), variable attributes (units, long_name, valid_range, _FillValue), and
+some data.  CDL keywords are in boldface.  (This example is intended to
+illustrate the syntax; a real CDL file would have a more complete set of
+attributes so that the data would be more completely self-describing.)
+
+.RS
+.nf
+\fBnetcdf\fP foo {  // an example netCDF specification in CDL
+
+\fBdimensions\fP:
+	lat = 10, lon = 5, time = \fBunlimited\fP ;
+
+\fBvariables\fP:
+	\fBlong\fP    lat(lat), lon(lon), time(time);
+	\fBfloat\fP   Z(time,lat,lon), t(time,lat,lon);
+	\fBdouble\fP  p(time,lat,lon);
+	\fBlong\fP    rh(time,lat,lon);
+
+	// variable attributes
+	lat:long_name = "latitude";
+	lat:units = "degrees_north";
+	lon:long_name = "longitude";
+	lon:units = "degrees_east";
+	time:units = "seconds since 1992-1-1 00:00:00";
+	Z:units = "geopotential meters";
+	Z:valid_range = 0., 5000.;
+	p:_FillValue = -9999.;
+	rh:_FillValue = -1;
+
+\fBdata\fP:
+	lat   = 0, 10, 20, 30, 40, 50, 60, 70, 80, 90;
+	lon   = -140, -118, -96, -84, -52;
+}
+.fi
+.RE
+.LP
+All CDL statements are terminated by a semicolon.  Spaces, tabs,
+and newlines can be used freely for readability.
+Comments may follow the characters `//' on any line.
+.LP
+A CDL description consists of three optional parts: \fIdimensions\fP,
+\fIvariables\fP, and \fIdata\fP, beginning with the keyword
+.BR dimensions: ,
+.BR variables: ,
+and
+.BR data ,
+respectively.
+The variable part may contain \fIvariable
+declarations\fP and \fIattribute assignments\fP.
+.LP
+A netCDF \fIdimension\fP is used to define the shape of one or more of the
+multidimensional variables contained in the netCDF file.  A netCDF
+dimension has a name and a size.  At most one dimension in a netCDF file
+can have the \fBunlimited\fP size, which means a variable using this
+dimension can grow to any length (like a record number in a file).
+.LP
+A \fIvariable\fP represents a multidimensional array of values of the
+same type.  A variable has a name, a data type, and a shape described
+by its list of dimensions.  Each variable may also have associated
+\fIattributes\fP (see below) as well as data values.  The name, data
+type, and shape of a variable are specified by its declaration in the
+\fIvariable\fP section of a CDL description.  A variable may have the same
+name as a dimension; by convention such a variable is one-dimensional
+and contains coordinates of the dimension it names.  Dimensions need
+not have corresponding variables.
+.LP
+A netCDF \fIattribute\fP contains information about a netCDF variable or
+about the whole netCDF dataset.  Attributes are used
+to specify such properties as units, special values, maximum and
+minimum valid values, scaling factors, offsets, and parameters.  Attribute
+information is represented by single values or arrays of values.  For
+example, "units" is an attribute represented by a character array such
+as "celsius".  An attribute has an associated variable, a name,
+a data type, a length, and a value.  In contrast to variables that are
+intended for data, attributes are intended for metadata (data about
+data).
+.LP
+In CDL, an attribute is designated by a variable and attribute name,
+separated by `:'.  It is possible to assign \fIglobal\fP attributes
+not associated with any variable to the netCDF as a whole by using
+`:' before the attribute name.  The data type of an attribute in CDL
+is derived from the type of the value assigned to it.  The length of
+an attribute is the number of data values assigned to it, or the
+number of characters in the character string assigned to it.  Multiple
+values are assigned to non-character attributes by separating the
+values with commas.  All values assigned to an attribute must be of
+the same type.
+.LP
+The names for CDL dimensions, variables, and attributes must begin with an
+alphabetic character or `_', and subsequent characters may be alphanumeric
+or `_' or `-'.
+.LP
+The optional \fIdata\fP section of a CDL specification is where
+netCDF variables may be initialized.  The syntax of an initialization
+is simple: a variable name, an equals sign, and a
+comma-delimited list of constants (possibly separated by spaces, tabs
+and newlines) terminated with a semicolon.  For multi-dimensional
+arrays, the last dimension varies fastest.  Thus row-order rather than
+column order is used for matrices.  If fewer values are supplied than
+are needed to fill a variable, it is extended with a type-dependent
+`fill value', which can be overridden by supplying a value for a
+distinguished variable attribute named `_FillValue'.  The
+types of constants need not match the type declared for a variable;
+coercions are done to convert integers to floating point, for example.
+
+.SS "Primitive Data Types"
+.LP
+.RS
+.nf
+\fBchar\fP	characters
+\fBbyte\fP	8-bit data
+\fBshort\fP	16-bit signed integers
+\fBlong\fP	32-bit signed integers
+\fBint\fP	(synonymous with \fBlong\fP)
+\fBfloat\fP	IEEE single precision floating point (32 bits)
+\fBreal\fP	(synonymous with \fBfloat\fP)
+\fBdouble\fP	IEEE double precision floating point (64 bits)
+.fi
+.RE
+.LP
+Except for the added data-type \fBbyte\fP and the lack of
+\fBunsigned\fP,
+CDL supports the same primitive data types as C.
+The names for the primitive data types are reserved words in CDL,
+so the names of variables, dimensions, and attributes must not be
+type names.  In declarations, type names may be specified
+in either upper or lower case.
+.LP
+Bytes differ from characters in that they are intended to hold a full eight
+bits of data, and the zero byte has no special significance, as it
+does for character data.
+\fBncgen\fP converts \fBbyte\fP declarations to \fBchar\fP
+declarations in the output C code and to the nonstandard \fBBYTE\fP
+declaration in output Fortran code.
+.LP
+Shorts can hold values between -32768 and 32767.
+\fBncgen\fP converts \fBshort\fP declarations to \fBshort\fP
+declarations in the output C code and to the nonstandard \fBINTEGER*2\fP
+declaration in output Fortran code.
+.LP
+Longs can hold values between -2147483648 and 2147483647.
+\fBncgen\fP converts \fBlong\fP declarations to \fBlong\fP
+declarations in the output C code and to \fBINTEGER\fP
+declarations in output Fortran code.  \fBint\fP and \fBinteger\fP are
+accepted as synonyms for \fBlong\fP in CDL declarations.
+Now that there are platforms with 64-bit representations for C longs, it may
+be better to use the \fBint\fP synonym to avoid confusion.
+.LP
+Floats can hold values between about -3.4+38 and 3.4+38.  Their
+external representation is as 32-bit IEEE normalized single-precision
+floating point numbers.  \fBncgen\fP converts \fBfloat\fP
+declarations to \fBfloat\fP declarations in the output C code and to
+\fBREAL\fP declarations in output Fortran code.  \fBreal\fP is accepted
+as a synonym for \fBfloat\fP in CDL declarations.
+.LP
+Doubles can hold values between about -1.7+308 and 1.7+308.  Their
+external representation is as 64-bit IEEE standard normalized
+double-precision floating point numbers.  \fBncgen\fP converts
+\fBdouble\fP declarations to \fBdouble\fP declarations in the output C
+code and to \fBDOUBLE PRECISION\fP declarations in output Fortran
+code.
+.LP
+.SS "CDL Constants"
+.LP
+Constants assigned to attributes or variables may be of any of the
+basic netCDF types.  The syntax for constants is similar to C syntax,
+except that type suffixes must be appended to shorts and floats to
+distinguish them from longs and doubles.
+.LP
+A \fIbyte\fP constant is represented by a single character or multiple
+character escape sequence enclosed in single quotes.  For example,
+.RS
+.nf
+ 'a'		// ASCII `a'
+ '\\0'		// a zero byte
+ '\\n'		// ASCII newline character
+ '\\33'		// ASCII escape character (33 octal)
+ '\\x2b'	// ASCII plus (2b hex)
+ '\\377'	// 377 octal = 255 decimal, non-ASCII
+.fi
+.RE
+.LP
+Character constants are enclosed in double quotes.  A character array
+may be represented as a string enclosed in double quotes.  The usual C
+string escape conventions are honored.  For example
+.RS
+.nf
+"a"		// ASCII `a'
+"Two\\nlines\\n"	// a 10-character string with two embedded newlines
+"a bell:\\007"	// a string containing an ASCII bell
+.fi
+.RE
+Note that the netCDF character array "a" would fit in a one-element
+variable, since no terminating NULL character is assumed.  However, a zero
+byte in a character array is interpreted as the end of the significant
+characters by the \fBncdump\fP program, following the C convention.
+Therefore, a NULL byte should not be embedded in a character string unless
+at the end: use the \fIbyte\fP data type instead for byte arrays that
+contain the zero byte.  NetCDF and CDL have no string type, but only
+fixed-length character arrays, which may be multi-dimensional.
+.LP
+\fIshort\fP integer constants are intended for representing 16-bit
+signed quantities.  The form of a \fIshort\fP constant is an integer
+constant with an `s' or `S' appended.  If a \fIshort\fP constant
+begins with `0', it is interpreted as octal, except that if it begins with
+`0x', it is interpreted as a hexadecimal constant.  For example:
+.RS
+.nf
+-2s	// a short -2
+0123s	// octal
+0x7ffs  //hexadecimal
+.fi
+.RE
+.LP
+\fILong\fP integer constants are intended for representing 32-bit signed
+quantities.  The form of a \fIlong\fP constant is an ordinary integer
+constant, although it is acceptable to append an optional `l' or
+`L'.  If a \fIlong\fP constant begins with `0', it is interpreted as
+octal, except that if it begins with `0x', it is interpreted as a hexadecimal
+constant.  Examples of valid \fIlong\fP constants include:
+.RS
+.nf
+-2
+1234567890L
+0123		// octal
+0x7ff		// hexadecimal
+.fi
+.RE
+.LP
+Floating point constants of type \fIfloat\fP are appropriate for representing
+floating point data with about seven significant digits of precision. 
+The form of a \fIfloat\fP constant is the same as a C floating point
+constant with an `f' or `F' appended.  For example the following
+are all acceptable \fIfloat\fP constants:
+.RS
+.nf
+-2.0f
+3.14159265358979f	// will be truncated to less precision
+1.f
+.1f
+.fi
+.RE
+.LP
+Floating point constants of type \fIdouble\fP are appropriate for
+representing floating point data with about sixteen significant digits
+of precision.  The form of a \fIdouble\fP constant is the same as a C
+floating point constant.  An optional `d' or `D' may be appended.
+For example the following are all acceptable \fIdouble\fP constants:
+.RS
+.nf
+-2.0
+3.141592653589793
+1.0e-20
+1.d
+.fi
+.RE
+
+.SH BUGS
+.LP
+The programs generated by \fBncgen\fP when using the \fB-c\fP or \fB-f\fP
+use initialization statements to store data in variables, and will fail to
+produce compilable programs if you try to use them for large datasets, since
+the resulting statements may exceed the line length or number of
+continuation statements permitted by the compiler.
+.LP
+The CDL syntax makes it easy to assign what looks like an array of
+variable-length strings to a netCDF variable, but the strings will simply be
+concatenated into a single array of characters, since netCDF cannot
+represent an array of variable-length strings in one netCDF variable.
+.LP
+NetCDF and CDL do not yet support a type corresponding to a 64-bit integer.
diff --git a/mfhdf/ncgen/ncgen.h b/mfhdf/ncgen/ncgen.h
new file mode 100644
index 0000000..dff78cb
--- /dev/null
+++ b/mfhdf/ncgen/ncgen.h
@@ -0,0 +1,53 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncgen.h 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+#include "local_nc.h"
+#include "generic.h"		/* defines union generic */
+
+#define H4_MAX_NC_ATTSIZE    2000	/* max size in bytes of an attribute */
+#define MAXTRST		   500	/* maximum size of a single string value */
+#define FORT_MAX_LINES	20	/* max lines in FORTRAN statement */
+#define	FORT_MAX_STMNT	66*FORT_MAX_LINES /* max chars in FORTRAN statement */
+#define C_MAX_STMNT	FORT_MAX_STMNT /* until we fix to break up C lines */
+
+/* Why is STREQ re-defined in multiple places? (hdf.h, then here, msoftyy.c,
+   and vms_yy.c) -> compiler warnings. -BMR, Jul 17, 2012 */
+#define STREQ(a, b)     (*(a) == *(b) && strcmp((a), (b)) == 0)
+
+extern struct dims {			/* dimensions */
+    long size;
+    char *name;
+} dims[H4_MAX_NC_DIMS];		/* table of netcdf dimensions */
+
+extern int ncid;		/* handle for netCDF */
+extern int ndims;		/* number of dimensions declared for netcdf */
+extern int nvars;		/* number of variables declared for netcdf */
+extern int natts;		/* number of attributes */
+extern int nvdims;		/* number of dimensions for variables */
+extern int dimnum;		/* dimension number index for variables */
+extern int varnum;		/* variable number index for attributes */
+extern int valnum;		/* value number index for attributes */
+extern int rec_dim;		/* number of the unlimited dimension, if any */
+extern long var_len;		/* variable length (product of dimensions) */
+extern int var_size;		/* size of each element of variable */
+extern long netcdf_record_number; /* current record number for variables */
+
+extern struct vars {		/* variables */
+    char *name;
+    nc_type type;
+    int ndims;
+    int dims[H4_MAX_VAR_DIMS];	/* should be a malloc'ed list, not an array */
+    union generic fill_value;	/* set to value of _FillValue attribute */
+    int has_data;		/* 1 if data specified, 0 otherwise */
+} vars[H4_MAX_NC_VARS];		/* should be a malloc'ed list, not an array */
+
+extern struct atts {
+    int var;			/* number of variable for this attribute */
+    char *name;
+    nc_type type;
+    int len;
+    void *val;
+} atts[H4_MAX_NC_ATTRS];		/* should be a malloc'ed list, not an array */
diff --git a/mfhdf/ncgen/ncgen.l b/mfhdf/ncgen/ncgen.l
new file mode 100644
index 0000000..917a72b
--- /dev/null
+++ b/mfhdf/ncgen/ncgen.l
@@ -0,0 +1,170 @@
+%{
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncgen.l 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+#define	STREQ(a, b)	(*(a) == *(b) && strcmp((a), (b)) == 0)
+
+/* lex specification for tokens for ncgen */
+
+char errstr[100];		/* for short error messages */
+extern long strtol();
+void expand_escapes();
+
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include "ncgentab.h"
+%}
+
+escquote	\\\"
+nonquotes	([^"]|{escquote})*
+exp		([eE][+-]?[0-9]+)
+%%
+\/\/.*		/* comment */ ;
+
+\"{nonquotes}\"		{
+			 if(yyleng > MAXTRST) {
+				yyerror("string too long, truncated\n");
+			        yytext[MAXTRST-1] = '\0';
+			 }
+			 expand_escapes(termstring,yytext,yyleng);
+		 	 return (TERMSTRING);
+		        }
+
+float|FLOAT|real|REAL	{return (FLOAT_K);}
+char|CHAR		{return (CHAR_K);}
+byte|BYTE		{return (BYTE_K);}
+short|SHORT		{return (SHORT_K);}
+long|LONG|int|INT|integer|INTEGER	{return (LONG_K);}
+double|DOUBLE		{return (DOUBLE_K);}
+unlimited|UNLIMITED	{long_val = -1;
+			 return (NC_UNLIMITED_K);}
+
+dimensions:|DIMENSIONS:	{return (DIMENSIONS);}
+variables:|VARIABLES:	{return (VARIABLES);}
+data:|DATA:		{return (DATA);}
+(netcdf|NETCDF|netCDF)[^\{]+	{
+		char *s = (char*)yytext+strlen("netcdf");
+		char *t = (char*)yytext+yyleng-1;
+		while (isspace(*s))
+			s++;
+		while (isspace(*t))
+			t--;
+		t++;
+		netcdfname = (char *) emalloc(t-s+1);
+		(void) strncpy(netcdfname, s, t-s);
+		netcdfname[t-s] = '\0';
+		return (NETCDF);
+		}
+
+DoubleInf|-?NaN	{    /* double missing values */
+		double_val = FILL_DOUBLE;  /* IEEE double infinity */
+		return (DOUBLE_CONST);
+		}
+
+FloatInf|Infinity|Inf	{    /* float missing values */
+		float_val = FILL_FLOAT;  /* IEEE float infinity */
+		return (FLOAT_CONST);
+		}
+[A-Za-z_][A-Za-z_0-9-]*	{
+		if ((yylval = lookup(yytext)) == NULL) {
+			yylval = install(yytext);
+			}
+		return (IDENT);
+		}
+
+\n		{
+		lineno++ ;
+		}
+[+-]?[0-9]*\.[0-9]*{exp}?[LlDd]?|[+-]?[0-9]*{exp}[LlDd]? {
+		if (sscanf((char*)yytext, "%le", &double_val) != 1) {
+		    sprintf(errstr,"bad long or double constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+                return (DOUBLE_CONST);
+                }
+[+-]?[0-9]*\.[0-9]*{exp}?[Ff]|[+-]?[0-9]*{exp}[Ff] {
+		if (sscanf((char*)yytext, "%e", &float_val) != 1) {
+		    sprintf(errstr,"bad float constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+                return (FLOAT_CONST);
+                }
+[+-]?[0-9]+[sS]|0[xX][0-9a-fA-F]+[sS] {
+		if (sscanf((char*)yytext, "%hd", &short_val) != 1) {
+		    sprintf(errstr,"bad short constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		return (SHORT_CONST);
+	        }
+[+-]?[1-9][0-9]*[lL]?|0[lL]? {
+		/* machines where doubles have more precision than longs. */
+		/*
+		 * Because strtol and sscanf with "%ld" may silently give
+		 * bad results from undetected overflow for strings like
+		 * "30000000000", we scan as double first.
+		 */
+		double dd;
+		if (sscanf((char*)yytext, "%le", &dd) != 1) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__
+		if (dd < INT_MIN  ||  dd > INT_MAX) 
+#else
+		if (dd < LONG_MIN  ||  dd > LONG_MAX) 
+#endif
+                {
+		    double_val = dd;
+		    return DOUBLE_CONST;
+		} else {
+		    long_val = dd;
+		    return LONG_CONST;
+		}
+	        }
+0[xX]?[0-9a-fA-F]+[lL]? {
+		long dd;
+		if (sscanf((char*)yytext, "%li", &dd) != 1) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		long_val = dd;
+		return LONG_CONST;
+	        }
+\'[^\\]\'          {
+	        (void) sscanf((char*)&yytext[1],"%c",&byte_val);
+		return (BYTE_CONST);
+                }
+\'\\[0-7][0-7]?[0-7]?\'  {
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 8);
+		return (BYTE_CONST);
+                }
+\'\\x[0-9a-fA-F][0-9a-fA-F]?\'  {
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 16);
+		return (BYTE_CONST);
+                }
+\'\\.\'        {
+	       switch ((char)yytext[2]) {
+	          case 'a': byte_val = '\007'; break; /* not everyone under-
+						       * stands '\a' yet */
+     	          case 'b': byte_val = '\b'; break;
+		  case 'f': byte_val = '\f'; break;
+		  case 'n': byte_val = '\n'; break;
+		  case 'r': byte_val = '\r'; break;
+		  case 't': byte_val = '\t'; break;
+		  case 'v': byte_val = '\v'; break;
+		  case '\\': byte_val = '\\'; break;
+		  case '?': byte_val = '\177'; break;
+		  case '\'': byte_val = '\''; break;
+		  default: byte_val = (char)yytext[2];
+	           }
+		return (BYTE_CONST);
+                }
+
+[ \t\f]+	{/* whitespace */ ;
+		}
+.		return (yytext[0]) ;
diff --git a/mfhdf/ncgen/ncgen.y b/mfhdf/ncgen/ncgen.y
new file mode 100644
index 0000000..372d0e4
--- /dev/null
+++ b/mfhdf/ncgen/ncgen.y
@@ -0,0 +1,740 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncgen.y 4928 2007-09-06 21:48:49Z epourmal $
+ *********************************************************************/
+
+/* yacc source for "ncgen", a netCDL parser and netCDF generator */
+
+%{
+#ifndef lint
+static char SccsId[] = "$Id: ncgen.y 4928 2007-09-06 21:48:49Z epourmal $";
+#endif
+#include        <string.h>
+#include	<stdlib.h>
+#include        "ncgen.h"
+
+typedef struct Symbol {		/* symbol table entry */
+	char    	*name;
+	struct Symbol   *next;
+	unsigned	is_dim : 1;	/* appears as netCDF dimension */
+	unsigned	is_var : 1;	/* appears as netCDF variable */
+	unsigned	is_att : 1;	/* appears as netCDF attribute */
+	int             dnum;	        /* handle as a dimension */
+	int             vnum;	        /* handle as a variable */
+	} *YYSTYPE1;
+
+#define YYSTYPE YYSTYPE1
+YYSTYPE install(), lookup();
+YYSTYPE symlist;		/* symbol table: linked list */
+
+void init_netcdf();		/* initializes netcdf counts (e.g. nvars) */
+void define_netcdf();		/* generates all define mode stuff */
+void load_netcdf();		/* generates variable puts */
+void close_netcdf();		/* generates close */
+
+void derror();			/* varargs message emitter */
+void *emalloc(), *erealloc();	/* malloc that checks for memory exhausted */
+void clearout();		/* initializes symbol table */
+void nc_getfill();		/* to get fill value for various types */
+void nc_putfill();		/* to get fill value for various types */
+void nc_fill();		/* fills a generic array with a value */
+int  put_variable();            /* invoke nc calls or generate code to put */
+                                /* variable values            */
+extern int derror_count;	/* counts errors in netcdf definition */
+extern int lineno;		/* line number for error messages */
+
+static int not_a_string;	/* whether last constant read was a string */
+static char termstring[MAXTRST]; /* last terminal string read */
+static double double_val;	/* last double value read */
+static float float_val;		/* last float value read */
+static nclong long_val;		/* last long value read */
+static short short_val;		/* last short value read */
+static char char_val;		/* last char value read */
+static char byte_val;		/* last byte value read */
+
+static nc_type type_code;	/* holds declared type for variables */
+static nc_type atype_code;	/* holds derived type for attributes */
+static char *netcdfname;	/* to construct netcdf file name */
+static void *att_space;		/* pointer to block for attribute values */
+static nc_type valtype;		/* type code for list of attribute values  */
+
+static char *char_valp;		/* pointers used to accumulate data values */
+static char *byte_valp;
+static short *short_valp;
+static nclong *long_valp;
+static float *float_valp;
+static double *double_valp;
+static void *rec_cur;		/* pointer to where next data value goes */
+static void *rec_start;		/* start of space for a record of data */
+%}
+
+/* DECLARATIONS */
+
+%token
+	NC_UNLIMITED_K /* keyword for unbounded record dimension */
+	BYTE_K	    /* keyword for byte datatype */
+	CHAR_K	    /* keyword for char datatype */
+	SHORT_K	    /* keyword for short datatype */
+	LONG_K	    /* keyword for long datatype */
+	FLOAT_K	    /* keyword for float datatype */
+	DOUBLE_K    /* keyword for double datatype */
+	IDENT	    /* name for a dimension, variable, or attribute */
+	TERMSTRING  /* terminal string */
+	BYTE_CONST  /* byte constant */
+	CHAR_CONST  /* char constant */
+	SHORT_CONST /* short constant */
+	LONG_CONST  /* long constant */
+	FLOAT_CONST /* float constant */
+	DOUBLE_CONST /* double constant */
+	DIMENSIONS  /* keyword starting dimensions section, if any */
+	VARIABLES   /* keyword starting variables section, if any */
+	NETCDF      /* keyword declaring netcdf name */
+	DATA        /* keyword starting data section, if any */
+
+%start	ncdesc /* start symbol for grammar */
+
+%%
+
+/* RULES */
+
+ncdesc:	NETCDF
+		'{'
+		   { init_netcdf(); }
+                dimsection	/* dimension declarations */
+                     {
+                       if (ndims > H4_MAX_NC_DIMS)
+                         derror("Too many dimensions");
+                   }
+                vasection	/* variable and attribute declarations */
+		   {
+		       if (derror_count == 0)
+			 define_netcdf(netcdfname);
+		   }
+		datasection     /* data, variables loaded as encountered */
+                '}'
+		   {
+		       if (derror_count == 0)
+			 close_netcdf();
+		   }
+		;
+dimsection:     /* empty */
+		| DIMENSIONS dimdecls
+		;
+dimdecls:       dimdecline ';'
+		| dimdecls dimdecline ';'
+		;
+dimdecline:     dimdecl
+                | dimdecline ',' dimdecl
+                ;
+dimdecl:        dimd '=' LONG_CONST
+		   { if (long_val <= 0)
+			 derror("negative dimension size");
+		     dims[ndims].size = long_val;
+		     ndims++;
+		   }
+                | dimd '=' NC_UNLIMITED_K
+		   {  if (rec_dim != -1)
+			 derror("only one NC_UNLIMITED dimension allowed");
+		     rec_dim = ndims; /* the unlimited (record) dimension */
+		     dims[ndims].size = NC_UNLIMITED;
+		     ndims++;
+		   }
+                ;
+dimd:           dim
+		   { if ($1->is_dim == 1) {
+		        derror( "duplicate dimension declaration for %s",
+		                $1->name);
+		     }
+	             $1->is_dim = 1;
+		     $1->dnum = ndims;
+		     dims[ndims].name = (char *) emalloc(strlen($1->name)+1);
+		     (void) strcpy(dims[ndims].name, $1->name);
+		   }
+                ;
+dim:		IDENT
+		;
+vasection:      /* empty */
+		| VARIABLES vadecls
+		;
+vadecls:        vadecl ';'
+                | vadecls vadecl ';'
+                ;
+vadecl:         vardecl | attdecl
+                ;
+vardecl:        type varlist
+                ;
+type:             BYTE_K  { type_code = NC_BYTE; }
+		| CHAR_K  { type_code = NC_CHAR; }
+		| SHORT_K  { type_code = NC_SHORT; }
+		| LONG_K  { type_code = NC_LONG; }
+		| FLOAT_K  { type_code = NC_FLOAT; }
+		| DOUBLE_K  { type_code = NC_DOUBLE; }
+		;
+varlist:        varspec
+                | varlist ',' varspec
+                ;
+varspec:        var
+		   {
+		    if (nvars >= H4_MAX_NC_VARS)
+		       derror("too many variables");
+		    nvdims = 0;
+		    /* make sure variable not re-declared */
+		    if ($1->is_var == 1) {
+		       derror( "duplicate variable declaration for %s",
+		               $1->name);
+		    }
+	            $1->is_var = 1;
+		    $1->vnum = nvars;
+		    vars[nvars].name = (char *) emalloc(strlen($1->name)+1);
+		    (void) strcpy(vars[nvars].name, $1->name);
+		    vars[nvars].type = type_code;
+		    /* set default fill value.  You can override this with
+		     * the variable attribute "_FillValue". */
+		    nc_getfill(type_code, &vars[nvars].fill_value);
+		    vars[nvars].has_data = 0; /* has no data (yet) */
+		   }
+		dimspec
+		   {
+		    vars[nvars].ndims = nvdims;
+		    nvars++;
+		   }
+		;
+var:            IDENT
+                ;
+dimspec:	/* empty */
+		| '(' dimlist ')'
+		;
+dimlist:        vdim
+                | dimlist ',' vdim
+                ;
+vdim:		dim
+		   {
+		    if (nvdims >= H4_MAX_VAR_DIMS) {
+		       derror("%s has too many dimensions",vars[nvars].name);
+		    }
+		    if ($1->is_dim == 1)
+		       dimnum = $1->dnum;
+		    else {
+		       derror( "%s is not declared as a dimension",
+			       $1->name);
+	               dimnum = ndims;
+		    }
+		    if (rec_dim != -1 && dimnum == rec_dim && nvdims != 0) {
+		       derror("unlimited dimension must be first");
+		    }
+		    vars[nvars].dims[nvdims] = dimnum;
+                    nvdims++;
+		   }
+		;
+attdecl:        att
+		   {
+		       valnum = 0;
+		       valtype = NC_UNSPECIFIED;
+		       /* get a large block for attributes, realloc later */
+		       att_space = emalloc(H4_MAX_NC_ATTSIZE);
+		       /* make all kinds of pointers point to it */
+		       char_valp = (char *) att_space;
+		       byte_valp = (char *) att_space;
+		       short_valp = (short *) att_space;
+		       long_valp = (nclong *) att_space;
+		       float_valp = (float *) att_space;
+		       double_valp = (double *) att_space;
+		   }
+		'=' attvallist
+		   {
+		       if (natts >= H4_MAX_NC_ATTRS)
+			 derror("too many attributes");
+		       atts[natts].var = varnum ;
+		       atts[natts].type = valtype;
+		       atts[natts].len = valnum;
+		       /* shrink space down to what was really needed */
+		       att_space = erealloc(att_space, valnum*nctypelen(valtype));
+		       atts[natts].val = att_space;
+		       if (STREQ(atts[natts].name, _FillValue)) {
+			   nc_putfill(atts[natts].type,
+				       atts[natts].val,
+				       &vars[atts[natts].var].fill_value);
+		       }
+		       natts++;
+		   }
+                ;
+att:            avar ':' attr
+                |    ':' attr
+		   {
+		    varnum = -1;  /* handle of "global" attribute */
+		   }
+                ;
+
+avar:           var
+		   { if ($1->is_var == 1)
+		       varnum = $1->vnum;
+		    else {
+		      derror("%s not declared as a variable, fatal error",
+			     $1->name);
+		      YYABORT;
+		      }
+		   }
+		;
+attr:		IDENT
+		   {
+		       atts[natts].name = (char *) emalloc(strlen($1->name)+1);
+		       (void) strcpy(atts[natts].name,$1->name);
+		   }
+		;
+attvallist:     aconst
+                | attvallist ',' aconst
+                ;
+aconst:		attconst
+		   {
+		    if (valtype == NC_UNSPECIFIED)
+		      valtype = atype_code;
+		    if (valtype != atype_code)
+		      derror("values for attribute must be all of same type");
+		   }
+		;
+
+attconst:      CHAR_CONST
+                   {
+		       atype_code = NC_CHAR;
+		       *char_valp++ = char_val;
+		       valnum++;
+		   }
+	       | TERMSTRING
+		   {
+		       atype_code = NC_CHAR;
+		       {
+			   /* don't null-terminate attribute strings */
+			   int len = strlen(termstring);
+			   valnum += len;
+			   (void)strncpy(char_valp,termstring,len);
+			   char_valp += len;
+		       }
+		   }
+                | BYTE_CONST
+                   {
+		       atype_code = NC_BYTE;
+		       *byte_valp++ = byte_val;
+		       valnum++;
+		   }
+                | SHORT_CONST
+                   {
+		       atype_code = NC_SHORT;
+		       *short_valp++ = short_val;
+		       valnum++;
+		   }
+                | LONG_CONST
+                   {
+		       atype_code = NC_LONG;
+		       *long_valp++ = long_val;
+		       valnum++;
+		   }
+                | FLOAT_CONST
+                   {
+		       atype_code = NC_FLOAT;
+		       *float_valp++ = float_val;
+		       valnum++;
+		   }
+                | DOUBLE_CONST
+                   {
+		       atype_code = NC_DOUBLE;
+		       *double_valp++ = double_val;
+		       valnum++;
+		   }
+                ;
+
+datasection:    /* empty */
+		| DATA datadecls
+		;
+
+datadecls:      datadecl ';'
+                | datadecls datadecl ';'
+                ;
+datadecl:       avar
+		   {
+		       valtype = vars[varnum].type; /* variable type */
+		       valnum = 0;	/* values accumulated for variable */
+		       vars[varnum].has_data = 1;
+		       /* compute dimensions product (size of a "record") */
+		       var_size = nctypelen(valtype);
+		       if (vars[varnum].ndims == 0)
+			   var_len = 1;
+		       else if (vars[varnum].dims[0] == rec_dim) {
+			   var_len = 1; /* one record for unlimited vars */
+			   netcdf_record_number = 0;
+		       }
+		       else
+			 var_len = dims[vars[varnum].dims[0]].size;
+		       for(dimnum = 1; dimnum < vars[varnum].ndims; dimnum++)
+			 var_len = var_len*dims[vars[varnum].dims[dimnum]].size;
+		       /* allocate memory for a record of variable data */
+		       if (var_len*var_size != (unsigned)(var_len*var_size)) {
+			   derror("too much data for this machine");
+			   exit(9);
+		       }
+		       rec_start = malloc ((unsigned)(var_len*var_size));
+		       if (rec_start == 0) {
+			   derror ("out of memory\n");
+			   exit(3);
+		       }
+		       rec_cur = rec_start;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   char_valp = (char *) rec_start;
+			   break;
+			 case NC_BYTE:
+			   byte_valp = (char *) rec_start;
+			   break;
+			 case NC_SHORT:
+			   short_valp = (short *) rec_start;
+			   break;
+			 case NC_LONG:
+			   long_valp = (nclong *) rec_start;
+			   break;
+			 case NC_FLOAT:
+			   float_valp = (float *) rec_start;
+			   break;
+			 case NC_DOUBLE:
+			   double_valp = (double *) rec_start;
+			   break;
+		       }
+		 }
+		'=' constlist
+                   {
+		       if (valnum > 0 && valnum < var_len) { /* leftovers */
+			   nc_fill(valtype,
+				    var_len - valnum,
+				    rec_cur,
+				    vars[varnum].fill_value);
+			   /* put out record of var_len values */
+			   if (derror_count == 0)
+			     put_variable(rec_start);
+		       }
+		       free ((char *) rec_start);
+		 }
+                ;
+constlist:      dconst
+                | constlist ',' dconst
+                ;
+dconst:
+                   {
+		       if(valnum >= var_len) {
+			   derror("too many values for this variable");
+			   exit (4);
+		       }
+		       not_a_string = 1;
+                   }
+                const
+		   {
+		       if (not_a_string) {
+			   switch (valtype) {
+			     case NC_CHAR:
+			       rec_cur = (void *) char_valp;
+			       break;
+			     case NC_BYTE:
+			       rec_cur = (void *) byte_valp;
+			       break;
+			     case NC_SHORT:
+			       rec_cur = (void *) short_valp;
+			       break;
+			     case NC_LONG:
+			       rec_cur = (void *) long_valp;
+			       break;
+			     case NC_FLOAT:
+			       rec_cur = (void *) float_valp;
+			       break;
+			     case NC_DOUBLE:
+			       rec_cur = (void *) double_valp;
+			       break;
+			   }
+		       }
+		       if (valnum >= var_len) {
+			   /* put out record of var_len elements */
+			   if (derror_count == 0)
+			     put_variable(rec_start);
+			   /* if this variable is unbounded, reset for */
+			   /* next record */
+			   if (vars[varnum].dims[0] == rec_dim) {
+			       valnum = 0;
+			       netcdf_record_number++;
+			       rec_cur = rec_start;
+			       switch (valtype) {
+				 case NC_CHAR:
+				   char_valp = (char *) rec_start;
+				   break;
+				 case NC_BYTE:
+				   byte_valp = (char *) rec_start;
+				   break;
+				 case NC_SHORT:
+				   short_valp = (short *) rec_start;
+				   break;
+				 case NC_LONG:
+				   long_valp = (nclong *) rec_start;
+				   break;
+				 case NC_FLOAT:
+				   float_valp = (float *) rec_start;
+				   break;
+				 case NC_DOUBLE:
+				   double_valp = (double *) rec_start;
+				   break;
+			       }
+			   }
+		       }
+		 }
+		;
+
+const:         CHAR_CONST
+                   {
+		       atype_code = NC_CHAR;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = char_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = char_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = char_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = char_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = char_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = char_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+	       | TERMSTRING
+		   {
+		       not_a_string = 0;
+		       atype_code = NC_CHAR;
+		       {
+			   int len = strlen(termstring);
+
+			   valnum += len;
+			   if(valnum > var_len) {
+			       derror("string won't fit in this variable");
+			       exit (5);
+			   }
+			   switch (valtype) {
+			     case NC_CHAR:
+			       (void)strncpy(char_valp,termstring,len);
+			       char_valp += len;
+			       rec_cur = (void *) char_valp;
+			       break;
+			     case NC_BYTE:
+			       (void)strncpy(byte_valp,termstring,len);
+			       byte_valp += len;
+			       rec_cur = (void *) byte_valp;
+			       break;
+			     case NC_SHORT:
+			     case NC_LONG:
+			     case NC_FLOAT:
+			     case NC_DOUBLE:
+			       derror("string value invalid for %s variable",
+				      nctype(valtype));
+			       break;
+			   }
+		       }
+		   }
+                | BYTE_CONST
+                   {
+		       atype_code = NC_BYTE;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = byte_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = byte_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = byte_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = byte_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = byte_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = byte_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+                | SHORT_CONST
+                   {
+		       atype_code = NC_SHORT;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = short_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = short_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = short_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = short_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = short_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = short_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+                | LONG_CONST
+                   {
+		       atype_code = NC_LONG;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = long_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = long_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = long_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = long_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = long_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = long_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+                | FLOAT_CONST
+                   {
+		       atype_code = NC_FLOAT;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = float_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = float_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = float_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = float_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = float_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = float_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+                | DOUBLE_CONST
+                   {
+		       atype_code = NC_DOUBLE;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = double_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = double_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = double_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = double_val;
+			   break;
+			 case NC_FLOAT:
+			   if (double_val == FILL_DOUBLE)
+			     *float_valp++ = FILL_FLOAT;
+			   else
+			     *float_valp++ = double_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = double_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+                ;
+
+/* END OF RULES */
+
+%%
+
+/* PROGRAMS */
+
+/* get lexical input routine generated by lex  */
+#include "ncgenyy.c"
+
+void derror();
+
+yyerror(s)	/* called for yacc syntax error */
+     char *s;
+{
+	derror(s);
+}
+
+#ifndef yywrap
+int
+yywrap()			/* returns 1 on EOF if no more input */
+{
+    return  1;
+}
+#endif /* yywrap() */
+
+
+/* Symbol table operations for ncgen tool */
+
+YYSTYPE lookup(sname)       /* find sname in symbol table (linear search) */
+char *sname;
+{
+    YYSTYPE sp;
+    for (sp = symlist; sp != (YYSTYPE) 0; sp = sp -> next)
+	if (STREQ(sp -> name, sname)) {
+	    return sp;
+	}
+    return 0;			/* 0 ==> not found */
+}
+
+YYSTYPE install(sname)  /* install sname in symbol table */
+char *sname;
+{
+    YYSTYPE sp;
+
+    sp = (YYSTYPE) emalloc (sizeof (struct Symbol));
+    sp -> name = (char *) emalloc (strlen (sname) + 1);/* +1 for '\0' */
+    (void) strcpy (sp -> name, sname);
+    sp -> next = symlist;	/* put at front of list */
+    sp -> is_dim = 0;
+    sp -> is_var = 0;
+    sp -> is_att = 0;
+    symlist = sp;
+    return sp;
+}
+
+void
+clearout()	/* reset symbol table to empty */
+{
+    YYSTYPE sp, tp;
+    for (sp = symlist; sp != (YYSTYPE) 0;) {
+	tp = sp -> next;
+	free (sp -> name);
+	free ((char *) sp);
+	sp = tp;
+    }
+    symlist = 0;
+}
diff --git a/mfhdf/ncgen/ncgentab.c b/mfhdf/ncgen/ncgentab.c
new file mode 100644
index 0000000..3610709
--- /dev/null
+++ b/mfhdf/ncgen/ncgentab.c
@@ -0,0 +1,2409 @@
+/* A Bison parser, made by GNU Bison 2.3.  */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Bison version.  */
+#define YYBISON_VERSION "2.3"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Using locations.  */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     NC_UNLIMITED_K = 258,
+     BYTE_K = 259,
+     CHAR_K = 260,
+     SHORT_K = 261,
+     LONG_K = 262,
+     FLOAT_K = 263,
+     DOUBLE_K = 264,
+     IDENT = 265,
+     TERMSTRING = 266,
+     BYTE_CONST = 267,
+     CHAR_CONST = 268,
+     SHORT_CONST = 269,
+     LONG_CONST = 270,
+     FLOAT_CONST = 271,
+     DOUBLE_CONST = 272,
+     DIMENSIONS = 273,
+     VARIABLES = 274,
+     NETCDF = 275,
+     DATA = 276
+   };
+#endif
+/* Tokens.  */
+#define NC_UNLIMITED_K 258
+#define BYTE_K 259
+#define CHAR_K 260
+#define SHORT_K 261
+#define LONG_K 262
+#define FLOAT_K 263
+#define DOUBLE_K 264
+#define IDENT 265
+#define TERMSTRING 266
+#define BYTE_CONST 267
+#define CHAR_CONST 268
+#define SHORT_CONST 269
+#define LONG_CONST 270
+#define FLOAT_CONST 271
+#define DOUBLE_CONST 272
+#define DIMENSIONS 273
+#define VARIABLES 274
+#define NETCDF 275
+#define DATA 276
+
+
+
+
+/* Copy the first part of user declarations.  */
+#line 9 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+
+#ifndef lint
+static char SccsId[] = "$Id: ncgen.y 4928 2007-09-06 21:48:49Z epourmal $";
+#endif
+#include        <string.h>
+#include	<stdlib.h>
+#include        "ncgen.h"
+
+typedef struct Symbol {		/* symbol table entry */
+	char    	*name;
+	struct Symbol   *next;
+	unsigned	is_dim : 1;	/* appears as netCDF dimension */
+	unsigned	is_var : 1;	/* appears as netCDF variable */
+	unsigned	is_att : 1;	/* appears as netCDF attribute */
+	int             dnum;	        /* handle as a dimension */
+	int             vnum;	        /* handle as a variable */
+	} *YYSTYPE1;
+
+#define YYSTYPE YYSTYPE1
+YYSTYPE install(), lookup();
+YYSTYPE symlist;		/* symbol table: linked list */
+
+void init_netcdf();		/* initializes netcdf counts (e.g. nvars) */
+void define_netcdf();		/* generates all define mode stuff */
+void load_netcdf();		/* generates variable puts */
+void close_netcdf();		/* generates close */
+
+void derror();			/* varargs message emitter */
+void *emalloc(), *erealloc();	/* malloc that checks for memory exhausted */
+void clearout();		/* initializes symbol table */
+void nc_getfill();		/* to get fill value for various types */
+void nc_putfill();		/* to get fill value for various types */
+void nc_fill();		/* fills a generic array with a value */
+int  put_variable();            /* invoke nc calls or generate code to put */
+                                /* variable values            */
+extern int derror_count;	/* counts errors in netcdf definition */
+extern int lineno;		/* line number for error messages */
+
+static int not_a_string;	/* whether last constant read was a string */
+static char termstring[MAXTRST]; /* last terminal string read */
+static double double_val;	/* last double value read */
+static float float_val;		/* last float value read */
+static nclong long_val;		/* last long value read */
+static short short_val;		/* last short value read */
+static char char_val;		/* last char value read */
+static char byte_val;		/* last byte value read */
+
+static nc_type type_code;	/* holds declared type for variables */
+static nc_type atype_code;	/* holds derived type for attributes */
+static char *netcdfname;	/* to construct netcdf file name */
+static void *att_space;		/* pointer to block for attribute values */
+static nc_type valtype;		/* type code for list of attribute values  */
+
+static char *char_valp;		/* pointers used to accumulate data values */
+static char *byte_valp;
+static short *short_valp;
+static nclong *long_valp;
+static float *float_valp;
+static double *double_valp;
+static void *rec_cur;		/* pointer to where next data value goes */
+static void *rec_start;		/* start of space for a record of data */
+
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations.  */
+
+
+/* Line 216 of yacc.c.  */
+#line 211 "y.tab.c"
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(msgid) dgettext ("bison-runtime", msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions.  */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int i)
+#else
+static int
+YYID (i)
+    int i;
+#endif
+{
+  return i;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#     ifndef _STDLIB_H
+#      define _STDLIB_H 1
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's `empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined _STDLIB_H \
+       && ! ((defined YYMALLOC || defined malloc) \
+	     && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef _STDLIB_H
+#    define _STDLIB_H 1
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yytype_int16 yyss;
+  YYSTYPE yyvs;
+  };
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)		\
+      do					\
+	{					\
+	  YYSIZE_T yyi;				\
+	  for (yyi = 0; yyi < (Count); yyi++)	\
+	    (To)[yyi] = (From)[yyi];		\
+	}					\
+      while (YYID (0))
+#  endif
+# endif
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack)					\
+    do									\
+      {									\
+	YYSIZE_T yynewbytes;						\
+	YYCOPY (&yyptr->Stack, Stack, yysize);				\
+	Stack = &yyptr->Stack;						\
+	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+	yyptr += yynewbytes / sizeof (*yyptr);				\
+      }									\
+    while (YYID (0))
+
+#endif
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  4
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   70
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  30
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  39
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  71
+/* YYNRULES -- Number of states.  */
+#define YYNSTATES  101
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   276
+
+#define YYTRANSLATE(YYX)						\
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+static const yytype_uint8 yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+      27,    28,     2,     2,    25,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,    29,    24,
+       2,    26,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    22,     2,    23,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const yytype_uint8 yyprhs[] =
+{
+       0,     0,     3,     4,     5,     6,    16,    17,    20,    23,
+      27,    29,    33,    37,    41,    43,    45,    46,    49,    52,
+      56,    58,    60,    63,    65,    67,    69,    71,    73,    75,
+      77,    81,    82,    86,    88,    89,    93,    95,    99,   101,
+     102,   107,   111,   114,   116,   118,   120,   124,   126,   128,
+     130,   132,   134,   136,   138,   140,   141,   144,   147,   151,
+     152,   157,   159,   163,   164,   167,   169,   171,   173,   175,
+     177,   179
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
+static const yytype_int8 yyrhs[] =
+{
+      31,     0,    -1,    -1,    -1,    -1,    20,    22,    32,    35,
+      33,    41,    34,    61,    23,    -1,    -1,    18,    36,    -1,
+      37,    24,    -1,    36,    37,    24,    -1,    38,    -1,    37,
+      25,    38,    -1,    39,    26,    15,    -1,    39,    26,     3,
+      -1,    40,    -1,    10,    -1,    -1,    19,    42,    -1,    43,
+      24,    -1,    42,    43,    24,    -1,    44,    -1,    53,    -1,
+      45,    46,    -1,     4,    -1,     5,    -1,     6,    -1,     7,
+      -1,     8,    -1,     9,    -1,    47,    -1,    46,    25,    47,
+      -1,    -1,    49,    48,    50,    -1,    10,    -1,    -1,    27,
+      51,    28,    -1,    52,    -1,    51,    25,    52,    -1,    40,
+      -1,    -1,    55,    54,    26,    58,    -1,    56,    29,    57,
+      -1,    29,    57,    -1,    49,    -1,    10,    -1,    59,    -1,
+      58,    25,    59,    -1,    60,    -1,    13,    -1,    11,    -1,
+      12,    -1,    14,    -1,    15,    -1,    16,    -1,    17,    -1,
+      -1,    21,    62,    -1,    63,    24,    -1,    62,    63,    24,
+      -1,    -1,    56,    64,    26,    65,    -1,    66,    -1,    65,
+      25,    66,    -1,    -1,    67,    68,    -1,    13,    -1,    11,
+      -1,    12,    -1,    14,    -1,    15,    -1,    16,    -1,    17,
+      -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const yytype_uint16 yyrline[] =
+{
+       0,   103,   103,   105,   110,   101,   121,   122,   124,   125,
+     127,   128,   130,   136,   144,   155,   157,   158,   160,   161,
+     163,   163,   165,   167,   168,   169,   170,   171,   172,   174,
+     175,   178,   177,   203,   205,   206,   208,   209,   211,   231,
+     230,   262,   263,   269,   279,   285,   286,   288,   297,   303,
+     314,   320,   326,   332,   338,   346,   347,   350,   351,   354,
+     353,   416,   417,   420,   420,   486,   511,   544,   569,   594,
+     619,   644
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "$end", "error", "$undefined", "NC_UNLIMITED_K", "BYTE_K", "CHAR_K",
+  "SHORT_K", "LONG_K", "FLOAT_K", "DOUBLE_K", "IDENT", "TERMSTRING",
+  "BYTE_CONST", "CHAR_CONST", "SHORT_CONST", "LONG_CONST", "FLOAT_CONST",
+  "DOUBLE_CONST", "DIMENSIONS", "VARIABLES", "NETCDF", "DATA", "'{'",
+  "'}'", "';'", "','", "'='", "'('", "')'", "':'", "$accept", "ncdesc",
+  "@1", "@2", "@3", "dimsection", "dimdecls", "dimdecline", "dimdecl",
+  "dimd", "dim", "vasection", "vadecls", "vadecl", "vardecl", "type",
+  "varlist", "varspec", "@4", "var", "dimspec", "dimlist", "vdim",
+  "attdecl", "@5", "att", "avar", "attr", "attvallist", "aconst",
+  "attconst", "datasection", "datadecls", "datadecl", "@6", "constlist",
+  "dconst", "@7", "const", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
+static const yytype_uint16 yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+     275,   276,   123,   125,    59,    44,    61,    40,    41,    58
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    30,    32,    33,    34,    31,    35,    35,    36,    36,
+      37,    37,    38,    38,    39,    40,    41,    41,    42,    42,
+      43,    43,    44,    45,    45,    45,    45,    45,    45,    46,
+      46,    48,    47,    49,    50,    50,    51,    51,    52,    54,
+      53,    55,    55,    56,    57,    58,    58,    59,    60,    60,
+      60,    60,    60,    60,    60,    61,    61,    62,    62,    64,
+      63,    65,    65,    67,    66,    68,    68,    68,    68,    68,
+      68,    68
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     0,     0,     0,     9,     0,     2,     2,     3,
+       1,     3,     3,     3,     1,     1,     0,     2,     2,     3,
+       1,     1,     2,     1,     1,     1,     1,     1,     1,     1,
+       3,     0,     3,     1,     0,     3,     1,     3,     1,     0,
+       4,     3,     2,     1,     1,     1,     3,     1,     1,     1,
+       1,     1,     1,     1,     1,     0,     2,     2,     3,     0,
+       4,     1,     3,     0,     2,     1,     1,     1,     1,     1,
+       1,     1
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       0,     0,     0,     2,     1,     6,     0,     3,    15,     7,
+       0,    10,     0,    14,    16,     0,     8,     0,     0,     0,
+       4,     9,    11,    13,    12,    23,    24,    25,    26,    27,
+      28,    33,     0,    17,     0,    20,     0,    43,    21,    39,
+       0,    55,    44,    42,     0,    18,    22,    29,    31,     0,
+       0,     0,     0,    19,     0,    34,     0,    41,    59,    56,
+       0,     5,    30,     0,    32,    49,    50,    48,    51,    52,
+      53,    54,    40,    45,    47,     0,     0,    57,    38,     0,
+      36,     0,    63,    58,     0,    35,    46,    60,    61,     0,
+      37,    63,    66,    67,    65,    68,    69,    70,    71,    64,
+      62
+};
+
+/* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     2,     5,    14,    41,     7,     9,    10,    11,    12,
+      13,    20,    33,    34,    35,    36,    46,    47,    55,    37,
+      64,    79,    80,    38,    49,    39,    40,    43,    72,    73,
+      74,    52,    59,    60,    75,    87,    88,    89,    99
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -57
+static const yytype_int8 yypact[] =
+{
+       7,    -2,    38,   -57,   -57,    21,    30,   -57,   -57,    30,
+      -1,   -57,    15,   -57,    23,    12,   -57,    30,     6,    -4,
+     -57,   -57,   -57,   -57,   -57,   -57,   -57,   -57,   -57,   -57,
+     -57,   -57,    33,    -4,    20,   -57,    35,   -57,   -57,   -57,
+      17,    26,   -57,   -57,    24,   -57,    25,   -57,   -57,    27,
+      33,    35,    28,   -57,    35,    22,     0,   -57,   -57,    35,
+      31,   -57,   -57,    30,   -57,   -57,   -57,   -57,   -57,   -57,
+     -57,   -57,    29,   -57,   -57,    32,    36,   -57,   -57,    -6,
+     -57,     0,   -57,   -57,    30,   -57,   -57,    34,   -57,    18,
+     -57,   -57,   -57,   -57,   -57,   -57,   -57,   -57,   -57,   -57,
+     -57
+};
+
+/* YYPGOTO[NTERM-NUM].  */
+static const yytype_int8 yypgoto[] =
+{
+     -57,   -57,   -57,   -57,   -57,   -57,   -57,    43,    39,   -57,
+     -56,   -57,   -57,    37,   -57,   -57,   -57,     3,   -57,   -28,
+     -57,   -57,   -23,   -57,   -57,   -57,   -41,    13,   -57,   -19,
+     -57,   -57,   -57,     5,   -57,   -57,   -26,   -57,   -57
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If zero, do what YYDEFACT says.
+   If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -1
+static const yytype_uint8 yytable[] =
+{
+      25,    26,    27,    28,    29,    30,    31,    78,    48,    23,
+      58,    65,    66,    67,    68,    69,    70,    71,    58,    84,
+       3,    24,    85,    16,    17,    32,    48,     1,    78,    92,
+      93,    94,    95,    96,    97,    98,    21,    17,     4,     6,
+       8,    18,    19,    42,    45,    31,    50,    51,    53,    63,
+      54,    61,    15,    56,    81,    77,    22,    62,    82,    91,
+      83,    90,    86,    57,    76,   100,     0,     0,     0,     0,
+      44
+};
+
+static const yytype_int8 yycheck[] =
+{
+       4,     5,     6,     7,     8,     9,    10,    63,    36,     3,
+      51,    11,    12,    13,    14,    15,    16,    17,    59,    25,
+      22,    15,    28,    24,    25,    29,    54,    20,    84,    11,
+      12,    13,    14,    15,    16,    17,    24,    25,     0,    18,
+      10,    26,    19,    10,    24,    10,    29,    21,    24,    27,
+      25,    23,     9,    26,    25,    24,    17,    54,    26,    25,
+      24,    84,    81,    50,    59,    91,    -1,    -1,    -1,    -1,
+      33
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,    20,    31,    22,     0,    32,    18,    35,    10,    36,
+      37,    38,    39,    40,    33,    37,    24,    25,    26,    19,
+      41,    24,    38,     3,    15,     4,     5,     6,     7,     8,
+       9,    10,    29,    42,    43,    44,    45,    49,    53,    55,
+      56,    34,    10,    57,    43,    24,    46,    47,    49,    54,
+      29,    21,    61,    24,    25,    48,    26,    57,    56,    62,
+      63,    23,    47,    27,    50,    11,    12,    13,    14,    15,
+      16,    17,    58,    59,    60,    64,    63,    24,    40,    51,
+      52,    25,    26,    24,    25,    28,    59,    65,    66,    67,
+      52,    25,    11,    12,    13,    14,    15,    16,    17,    68,
+      66
+};
+
+#define yyerrok		(yyerrstatus = 0)
+#define yyclearin	(yychar = YYEMPTY)
+#define YYEMPTY		(-2)
+#define YYEOF		0
+
+#define YYACCEPT	goto yyacceptlab
+#define YYABORT		goto yyabortlab
+#define YYERROR		goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror.  This remains here temporarily
+   to ease the transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+
+#define YYFAIL		goto yyerrlab
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)					\
+do								\
+  if (yychar == YYEMPTY && yylen == 1)				\
+    {								\
+      yychar = (Token);						\
+      yylval = (Value);						\
+      yytoken = YYTRANSLATE (yychar);				\
+      YYPOPSTACK (1);						\
+      goto yybackup;						\
+    }								\
+  else								\
+    {								\
+      yyerror (YY_("syntax error: cannot back up")); \
+      YYERROR;							\
+    }								\
+while (YYID (0))
+
+
+#define YYTERROR	1
+#define YYERRCODE	256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)				\
+    do									\
+      if (YYID (N))                                                    \
+	{								\
+	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
+	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
+	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
+	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
+	}								\
+      else								\
+	{								\
+	  (Current).first_line   = (Current).last_line   =		\
+	    YYRHSLOC (Rhs, 0).last_line;				\
+	  (Current).first_column = (Current).last_column =		\
+	    YYRHSLOC (Rhs, 0).last_column;				\
+	}								\
+    while (YYID (0))
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+   This macro was not mandated originally: define only if we know
+   we won't break user code: when these are the locations we know.  */
+
+#ifndef YY_LOCATION_PRINT
+# if YYLTYPE_IS_TRIVIAL
+#  define YY_LOCATION_PRINT(File, Loc)			\
+     fprintf (File, "%d.%d-%d.%d",			\
+	      (Loc).first_line, (Loc).first_column,	\
+	      (Loc).last_line,  (Loc).last_column)
+# else
+#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments.  */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)			\
+do {						\
+  if (yydebug)					\
+    YYFPRINTF Args;				\
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
+do {									  \
+  if (yydebug)								  \
+    {									  \
+      YYFPRINTF (stderr, "%s ", Title);					  \
+      yy_symbol_print (stderr,						  \
+		  Type, Value); \
+      YYFPRINTF (stderr, "\n");						  \
+    }									  \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
+{
+  if (!yyvaluep)
+    return;
+# ifdef YYPRINT
+  if (yytype < YYNTOKENS)
+    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+  YYUSE (yyoutput);
+# endif
+  switch (yytype)
+    {
+      default:
+	break;
+    }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
+{
+  if (yytype < YYNTOKENS)
+    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+  YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+#else
+static void
+yy_stack_print (bottom, top)
+    yytype_int16 *bottom;
+    yytype_int16 *top;
+#endif
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; bottom <= top; ++bottom)
+    YYFPRINTF (stderr, " %d", *bottom);
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)				\
+do {								\
+  if (yydebug)							\
+    yy_stack_print ((Bottom), (Top));				\
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+    YYSTYPE *yyvsp;
+    int yyrule;
+#endif
+{
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  unsigned long int yylno = yyrline[yyrule];
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+	     yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      fprintf (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+		       &(yyvsp[(yyi + 1) - (yynrhs)])
+		       		       );
+      fprintf (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)		\
+do {					\
+  if (yydebug)				\
+    yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef	YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+

+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined __GLIBC__ && defined _STRING_H
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+    const char *yystr;
+#endif
+{
+  YYSIZE_T yylen;
+  for (yylen = 0; yystr[yylen]; yylen++)
+    continue;
+  return yylen;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+    char *yydest;
+    const char *yysrc;
+#endif
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYSIZE_T yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+	switch (*++yyp)
+	  {
+	  case '\'':
+	  case ',':
+	    goto do_not_strip_quotes;
+
+	  case '\\':
+	    if (*++yyp != '\\')
+	      goto do_not_strip_quotes;
+	    /* Fall through.  */
+	  default:
+	    if (yyres)
+	      yyres[yyn] = *yyp;
+	    yyn++;
+	    break;
+
+	  case '"':
+	    if (yyres)
+	      yyres[yyn] = '\0';
+	    return yyn;
+	  }
+    do_not_strip_quotes: ;
+    }
+
+  if (! yyres)
+    return yystrlen (yystr);
+
+  return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into YYRESULT an error message about the unexpected token
+   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
+   including the terminating null byte.  If YYRESULT is null, do not
+   copy anything; just return the number of bytes that would be
+   copied.  As a special case, return 0 if an ordinary "syntax error"
+   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
+   size calculation.  */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+  int yyn = yypact[yystate];
+
+  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+    return 0;
+  else
+    {
+      int yytype = YYTRANSLATE (yychar);
+      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+      YYSIZE_T yysize = yysize0;
+      YYSIZE_T yysize1;
+      int yysize_overflow = 0;
+      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+      int yyx;
+
+# if 0
+      /* This is so xgettext sees the translatable formats that are
+	 constructed on the fly.  */
+      YY_("syntax error, unexpected %s");
+      YY_("syntax error, unexpected %s, expecting %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+      char *yyfmt;
+      char const *yyf;
+      static char const yyunexpected[] = "syntax error, unexpected %s";
+      static char const yyexpecting[] = ", expecting %s";
+      static char const yyor[] = " or %s";
+      char yyformat[sizeof yyunexpected
+		    + sizeof yyexpecting - 1
+		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+		       * (sizeof yyor - 1))];
+      char const *yyprefix = yyexpecting;
+
+      /* Start YYX at -YYN if negative to avoid negative indexes in
+	 YYCHECK.  */
+      int yyxbegin = yyn < 0 ? -yyn : 0;
+
+      /* Stay within bounds of both yycheck and yytname.  */
+      int yychecklim = YYLAST - yyn + 1;
+      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+      int yycount = 1;
+
+      yyarg[0] = yytname[yytype];
+      yyfmt = yystpcpy (yyformat, yyunexpected);
+
+      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+	  {
+	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+	      {
+		yycount = 1;
+		yysize = yysize0;
+		yyformat[sizeof yyunexpected - 1] = '\0';
+		break;
+	      }
+	    yyarg[yycount++] = yytname[yyx];
+	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+	    yysize_overflow |= (yysize1 < yysize);
+	    yysize = yysize1;
+	    yyfmt = yystpcpy (yyfmt, yyprefix);
+	    yyprefix = yyor;
+	  }
+
+      yyf = YY_(yyformat);
+      yysize1 = yysize + yystrlen (yyf);
+      yysize_overflow |= (yysize1 < yysize);
+      yysize = yysize1;
+
+      if (yysize_overflow)
+	return YYSIZE_MAXIMUM;
+
+      if (yyresult)
+	{
+	  /* Avoid sprintf, as that infringes on the user's name space.
+	     Don't have undefined behavior even if the translation
+	     produced a string with the wrong number of "%s"s.  */
+	  char *yyp = yyresult;
+	  int yyi = 0;
+	  while ((*yyp = *yyf) != '\0')
+	    {
+	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+		{
+		  yyp += yytnamerr (yyp, yyarg[yyi++]);
+		  yyf += 2;
+		}
+	      else
+		{
+		  yyp++;
+		  yyf++;
+		}
+	    }
+	}
+      return yysize;
+    }
+}
+#endif /* YYERROR_VERBOSE */
+

+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+    const char *yymsg;
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
+{
+  YYUSE (yyvaluep);
+
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+  switch (yytype)
+    {
+
+      default:
+	break;
+    }
+}
+

+
+/* Prevent warnings from -Wmissing-prototypes.  */
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The look-ahead symbol.  */
+int yychar;
+
+/* The semantic value of the look-ahead symbol.  */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+    void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+  
+  int yystate;
+  int yyn;
+  int yyresult;
+  /* Number of tokens to shift before error messages enabled.  */
+  int yyerrstatus;
+  /* Look-ahead token as an internal (translated) token number.  */
+  int yytoken = 0;
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+  /* Three stacks and their tools:
+     `yyss': related to states,
+     `yyvs': related to semantic values,
+     `yyls': related to locations.
+
+     Refer to the stacks thru separate pointers, to allow yyoverflow
+     to reallocate them elsewhere.  */
+
+  /* The state stack.  */
+  yytype_int16 yyssa[YYINITDEPTH];
+  yytype_int16 *yyss = yyssa;
+  yytype_int16 *yyssp;
+
+  /* The semantic value stack.  */
+  YYSTYPE yyvsa[YYINITDEPTH];
+  YYSTYPE *yyvs = yyvsa;
+  YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+
+  YYSIZE_T yystacksize = YYINITDEPTH;
+
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY;		/* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss;
+  yyvsp = yyvs;
+
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+	/* Give user a chance to reallocate the stack.  Use copies of
+	   these so that the &'s don't force the real ones into
+	   memory.  */
+	YYSTYPE *yyvs1 = yyvs;
+	yytype_int16 *yyss1 = yyss;
+
+
+	/* Each stack pointer address is followed by the size of the
+	   data in use in that stack, in bytes.  This used to be a
+	   conditional around just the two extra args, but that might
+	   be undefined if yyoverflow is a macro.  */
+	yyoverflow (YY_("memory exhausted"),
+		    &yyss1, yysize * sizeof (*yyssp),
+		    &yyvs1, yysize * sizeof (*yyvsp),
+
+		    &yystacksize);
+
+	yyss = yyss1;
+	yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyexhaustedlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+	goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+	yystacksize = YYMAXDEPTH;
+
+      {
+	yytype_int16 *yyss1 = yyss;
+	union yyalloc *yyptr =
+	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+	if (! yyptr)
+	  goto yyexhaustedlab;
+	YYSTACK_RELOCATE (yyss);
+	YYSTACK_RELOCATE (yyvs);
+
+#  undef YYSTACK_RELOCATE
+	if (yyss1 != yyssa)
+	  YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+		  (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+	YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+  /* Do appropriate processing given the current state.  Read a
+     look-ahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to look-ahead token.  */
+  yyn = yypact[yystate];
+  if (yyn == YYPACT_NINF)
+    goto yydefault;
+
+  /* Not known => get a look-ahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = YYLEX;
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yyn == 0 || yyn == YYTABLE_NINF)
+	goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the look-ahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+  /* Discard the shifted token unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
+
+  yystate = yyn;
+  *++yyvsp = yylval;
+
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     `$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+        case 2:
+#line 103 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { init_netcdf(); }
+    break;
+
+  case 3:
+#line 105 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+                       if (ndims > H4_MAX_NC_DIMS)
+                         derror("Too many dimensions");
+                   }
+    break;
+
+  case 4:
+#line 110 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       if (derror_count == 0)
+			 define_netcdf(netcdfname);
+		   }
+    break;
+
+  case 5:
+#line 116 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       if (derror_count == 0)
+			 close_netcdf();
+		   }
+    break;
+
+  case 12:
+#line 131 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { if (long_val <= 0)
+			 derror("negative dimension size");
+		     dims[ndims].size = long_val;
+		     ndims++;
+		   }
+    break;
+
+  case 13:
+#line 137 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {  if (rec_dim != -1)
+			 derror("only one NC_UNLIMITED dimension allowed");
+		     rec_dim = ndims; /* the unlimited (record) dimension */
+		     dims[ndims].size = NC_UNLIMITED;
+		     ndims++;
+		   }
+    break;
+
+  case 14:
+#line 145 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { if ((yyvsp[(1) - (1)])->is_dim == 1) {
+		        derror( "duplicate dimension declaration for %s",
+		                (yyvsp[(1) - (1)])->name);
+		     }
+	             (yyvsp[(1) - (1)])->is_dim = 1;
+		     (yyvsp[(1) - (1)])->dnum = ndims;
+		     dims[ndims].name = (char *) emalloc(strlen((yyvsp[(1) - (1)])->name)+1);
+		     (void) strcpy(dims[ndims].name, (yyvsp[(1) - (1)])->name);
+		   }
+    break;
+
+  case 23:
+#line 167 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { type_code = NC_BYTE; }
+    break;
+
+  case 24:
+#line 168 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { type_code = NC_CHAR; }
+    break;
+
+  case 25:
+#line 169 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { type_code = NC_SHORT; }
+    break;
+
+  case 26:
+#line 170 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { type_code = NC_LONG; }
+    break;
+
+  case 27:
+#line 171 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { type_code = NC_FLOAT; }
+    break;
+
+  case 28:
+#line 172 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { type_code = NC_DOUBLE; }
+    break;
+
+  case 31:
+#line 178 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		    if (nvars >= H4_MAX_NC_VARS)
+		       derror("too many variables");
+		    nvdims = 0;
+		    /* make sure variable not re-declared */
+		    if ((yyvsp[(1) - (1)])->is_var == 1) {
+		       derror( "duplicate variable declaration for %s",
+		               (yyvsp[(1) - (1)])->name);
+		    }
+	            (yyvsp[(1) - (1)])->is_var = 1;
+		    (yyvsp[(1) - (1)])->vnum = nvars;
+		    vars[nvars].name = (char *) emalloc(strlen((yyvsp[(1) - (1)])->name)+1);
+		    (void) strcpy(vars[nvars].name, (yyvsp[(1) - (1)])->name);
+		    vars[nvars].type = type_code;
+		    /* set default fill value.  You can override this with
+		     * the variable attribute "_FillValue". */
+		    nc_getfill(type_code, &vars[nvars].fill_value);
+		    vars[nvars].has_data = 0; /* has no data (yet) */
+		   }
+    break;
+
+  case 32:
+#line 198 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		    vars[nvars].ndims = nvdims;
+		    nvars++;
+		   }
+    break;
+
+  case 38:
+#line 212 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		    if (nvdims >= H4_MAX_VAR_DIMS) {
+		       derror("%s has too many dimensions",vars[nvars].name);
+		    }
+		    if ((yyvsp[(1) - (1)])->is_dim == 1)
+		       dimnum = (yyvsp[(1) - (1)])->dnum;
+		    else {
+		       derror( "%s is not declared as a dimension",
+			       (yyvsp[(1) - (1)])->name);
+	               dimnum = ndims;
+		    }
+		    if (rec_dim != -1 && dimnum == rec_dim && nvdims != 0) {
+		       derror("unlimited dimension must be first");
+		    }
+		    vars[nvars].dims[nvdims] = dimnum;
+                    nvdims++;
+		   }
+    break;
+
+  case 39:
+#line 231 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       valnum = 0;
+		       valtype = NC_UNSPECIFIED;
+		       /* get a large block for attributes, realloc later */
+		       att_space = emalloc(H4_MAX_NC_ATTSIZE);
+		       /* make all kinds of pointers point to it */
+		       char_valp = (char *) att_space;
+		       byte_valp = (char *) att_space;
+		       short_valp = (short *) att_space;
+		       long_valp = (nclong *) att_space;
+		       float_valp = (float *) att_space;
+		       double_valp = (double *) att_space;
+		   }
+    break;
+
+  case 40:
+#line 245 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       if (natts >= H4_MAX_NC_ATTRS)
+			 derror("too many attributes");
+		       atts[natts].var = varnum ;
+		       atts[natts].type = valtype;
+		       atts[natts].len = valnum;
+		       /* shrink space down to what was really needed */
+		       att_space = erealloc(att_space, valnum*nctypelen(valtype));
+		       atts[natts].val = att_space;
+		       if (STREQ(atts[natts].name, _FillValue)) {
+			   nc_putfill(atts[natts].type,
+				       atts[natts].val,
+				       &vars[atts[natts].var].fill_value);
+		       }
+		       natts++;
+		   }
+    break;
+
+  case 42:
+#line 264 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		    varnum = -1;  /* handle of "global" attribute */
+		   }
+    break;
+
+  case 43:
+#line 270 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    { if ((yyvsp[(1) - (1)])->is_var == 1)
+		       varnum = (yyvsp[(1) - (1)])->vnum;
+		    else {
+		      derror("%s not declared as a variable, fatal error",
+			     (yyvsp[(1) - (1)])->name);
+		      YYABORT;
+		      }
+		   }
+    break;
+
+  case 44:
+#line 280 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atts[natts].name = (char *) emalloc(strlen((yyvsp[(1) - (1)])->name)+1);
+		       (void) strcpy(atts[natts].name,(yyvsp[(1) - (1)])->name);
+		   }
+    break;
+
+  case 47:
+#line 289 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		    if (valtype == NC_UNSPECIFIED)
+		      valtype = atype_code;
+		    if (valtype != atype_code)
+		      derror("values for attribute must be all of same type");
+		   }
+    break;
+
+  case 48:
+#line 298 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_CHAR;
+		       *char_valp++ = char_val;
+		       valnum++;
+		   }
+    break;
+
+  case 49:
+#line 304 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_CHAR;
+		       {
+			   /* don't null-terminate attribute strings */
+			   int len = strlen(termstring);
+			   valnum += len;
+			   (void)strncpy(char_valp,termstring,len);
+			   char_valp += len;
+		       }
+		   }
+    break;
+
+  case 50:
+#line 315 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_BYTE;
+		       *byte_valp++ = byte_val;
+		       valnum++;
+		   }
+    break;
+
+  case 51:
+#line 321 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_SHORT;
+		       *short_valp++ = short_val;
+		       valnum++;
+		   }
+    break;
+
+  case 52:
+#line 327 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_LONG;
+		       *long_valp++ = long_val;
+		       valnum++;
+		   }
+    break;
+
+  case 53:
+#line 333 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_FLOAT;
+		       *float_valp++ = float_val;
+		       valnum++;
+		   }
+    break;
+
+  case 54:
+#line 339 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_DOUBLE;
+		       *double_valp++ = double_val;
+		       valnum++;
+		   }
+    break;
+
+  case 59:
+#line 354 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       valtype = vars[varnum].type; /* variable type */
+		       valnum = 0;	/* values accumulated for variable */
+		       vars[varnum].has_data = 1;
+		       /* compute dimensions product (size of a "record") */
+		       var_size = nctypelen(valtype);
+		       if (vars[varnum].ndims == 0)
+			   var_len = 1;
+		       else if (vars[varnum].dims[0] == rec_dim) {
+			   var_len = 1; /* one record for unlimited vars */
+			   netcdf_record_number = 0;
+		       }
+		       else
+			 var_len = dims[vars[varnum].dims[0]].size;
+		       for(dimnum = 1; dimnum < vars[varnum].ndims; dimnum++)
+			 var_len = var_len*dims[vars[varnum].dims[dimnum]].size;
+		       /* allocate memory for a record of variable data */
+		       if (var_len*var_size != (unsigned)(var_len*var_size)) {
+			   derror("too much data for this machine");
+			   exit(9);
+		       }
+		       rec_start = malloc ((unsigned)(var_len*var_size));
+		       if (rec_start == 0) {
+			   derror ("out of memory\n");
+			   exit(3);
+		       }
+		       rec_cur = rec_start;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   char_valp = (char *) rec_start;
+			   break;
+			 case NC_BYTE:
+			   byte_valp = (char *) rec_start;
+			   break;
+			 case NC_SHORT:
+			   short_valp = (short *) rec_start;
+			   break;
+			 case NC_LONG:
+			   long_valp = (nclong *) rec_start;
+			   break;
+			 case NC_FLOAT:
+			   float_valp = (float *) rec_start;
+			   break;
+			 case NC_DOUBLE:
+			   double_valp = (double *) rec_start;
+			   break;
+		       }
+		 }
+    break;
+
+  case 60:
+#line 403 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       if (valnum > 0 && valnum < var_len) { /* leftovers */
+			   nc_fill(valtype,
+				    var_len - valnum,
+				    rec_cur,
+				    vars[varnum].fill_value);
+			   /* put out record of var_len values */
+			   if (derror_count == 0)
+			     put_variable(rec_start);
+		       }
+		       free ((char *) rec_start);
+		 }
+    break;
+
+  case 63:
+#line 420 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       if(valnum >= var_len) {
+			   derror("too many values for this variable");
+			   exit (4);
+		       }
+		       not_a_string = 1;
+                   }
+    break;
+
+  case 64:
+#line 428 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       if (not_a_string) {
+			   switch (valtype) {
+			     case NC_CHAR:
+			       rec_cur = (void *) char_valp;
+			       break;
+			     case NC_BYTE:
+			       rec_cur = (void *) byte_valp;
+			       break;
+			     case NC_SHORT:
+			       rec_cur = (void *) short_valp;
+			       break;
+			     case NC_LONG:
+			       rec_cur = (void *) long_valp;
+			       break;
+			     case NC_FLOAT:
+			       rec_cur = (void *) float_valp;
+			       break;
+			     case NC_DOUBLE:
+			       rec_cur = (void *) double_valp;
+			       break;
+			   }
+		       }
+		       if (valnum >= var_len) {
+			   /* put out record of var_len elements */
+			   if (derror_count == 0)
+			     put_variable(rec_start);
+			   /* if this variable is unbounded, reset for */
+			   /* next record */
+			   if (vars[varnum].dims[0] == rec_dim) {
+			       valnum = 0;
+			       netcdf_record_number++;
+			       rec_cur = rec_start;
+			       switch (valtype) {
+				 case NC_CHAR:
+				   char_valp = (char *) rec_start;
+				   break;
+				 case NC_BYTE:
+				   byte_valp = (char *) rec_start;
+				   break;
+				 case NC_SHORT:
+				   short_valp = (short *) rec_start;
+				   break;
+				 case NC_LONG:
+				   long_valp = (nclong *) rec_start;
+				   break;
+				 case NC_FLOAT:
+				   float_valp = (float *) rec_start;
+				   break;
+				 case NC_DOUBLE:
+				   double_valp = (double *) rec_start;
+				   break;
+			       }
+			   }
+		       }
+		 }
+    break;
+
+  case 65:
+#line 487 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_CHAR;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = char_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = char_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = char_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = char_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = char_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = char_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+    break;
+
+  case 66:
+#line 512 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       not_a_string = 0;
+		       atype_code = NC_CHAR;
+		       {
+			   int len = strlen(termstring);
+
+			   valnum += len;
+			   if(valnum > var_len) {
+			       derror("string won't fit in this variable");
+			       exit (5);
+			   }
+			   switch (valtype) {
+			     case NC_CHAR:
+			       (void)strncpy(char_valp,termstring,len);
+			       char_valp += len;
+			       rec_cur = (void *) char_valp;
+			       break;
+			     case NC_BYTE:
+			       (void)strncpy(byte_valp,termstring,len);
+			       byte_valp += len;
+			       rec_cur = (void *) byte_valp;
+			       break;
+			     case NC_SHORT:
+			     case NC_LONG:
+			     case NC_FLOAT:
+			     case NC_DOUBLE:
+			       derror("string value invalid for %s variable",
+				      nctype(valtype));
+			       break;
+			   }
+		       }
+		   }
+    break;
+
+  case 67:
+#line 545 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_BYTE;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = byte_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = byte_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = byte_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = byte_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = byte_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = byte_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+    break;
+
+  case 68:
+#line 570 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_SHORT;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = short_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = short_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = short_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = short_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = short_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = short_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+    break;
+
+  case 69:
+#line 595 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_LONG;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = long_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = long_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = long_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = long_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = long_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = long_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+    break;
+
+  case 70:
+#line 620 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_FLOAT;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = float_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = float_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = float_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = float_val;
+			   break;
+			 case NC_FLOAT:
+			   *float_valp++ = float_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = float_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+    break;
+
+  case 71:
+#line 645 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+    {
+		       atype_code = NC_DOUBLE;
+		       switch (valtype) {
+			 case NC_CHAR:
+			   *char_valp++ = double_val;
+			   break;
+			 case NC_BYTE:
+			   *byte_valp++ = double_val;
+			   break;
+			 case NC_SHORT:
+			   *short_valp++ = double_val;
+			   break;
+			 case NC_LONG:
+			   *long_valp++ = double_val;
+			   break;
+			 case NC_FLOAT:
+			   if (double_val == FILL_DOUBLE)
+			     *float_valp++ = FILL_FLOAT;
+			   else
+			     *float_valp++ = double_val;
+			   break;
+			 case NC_DOUBLE:
+			   *double_valp++ = double_val;
+			   break;
+		       }
+		       valnum++;
+		   }
+    break;
+
+
+/* Line 1267 of yacc.c.  */
+#line 2130 "y.tab.c"
+      default: break;
+    }
+  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+
+
+  /* Now `shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if ! YYERROR_VERBOSE
+      yyerror (YY_("syntax error"));
+#else
+      {
+	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+	  {
+	    YYSIZE_T yyalloc = 2 * yysize;
+	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
+	    if (yymsg != yymsgbuf)
+	      YYSTACK_FREE (yymsg);
+	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+	    if (yymsg)
+	      yymsg_alloc = yyalloc;
+	    else
+	      {
+		yymsg = yymsgbuf;
+		yymsg_alloc = sizeof yymsgbuf;
+	      }
+	  }
+
+	if (0 < yysize && yysize <= yymsg_alloc)
+	  {
+	    (void) yysyntax_error (yymsg, yystate, yychar);
+	    yyerror (yymsg);
+	  }
+	else
+	  {
+	    yyerror (YY_("syntax error"));
+	    if (yysize != 0)
+	      goto yyexhaustedlab;
+	  }
+      }
+#endif
+    }
+
+
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse look-ahead token after an
+	 error, discard it.  */
+
+      if (yychar <= YYEOF)
+	{
+	  /* Return failure if at end of input.  */
+	  if (yychar == YYEOF)
+	    YYABORT;
+	}
+      else
+	{
+	  yydestruct ("Error: discarding",
+		      yytoken, &yylval);
+	  yychar = YYEMPTY;
+	}
+    }
+
+  /* Else will try to reuse look-ahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+
+  /* Pacify compilers like GCC when the user code never invokes
+     YYERROR and the label yyerrorlab therefore never appears in user
+     code.  */
+  if (/*CONSTCOND*/ 0)
+     goto yyerrorlab;
+
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (yyn != YYPACT_NINF)
+	{
+	  yyn += YYTERROR;
+	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+	    {
+	      yyn = yytable[yyn];
+	      if (0 < yyn)
+		break;
+	    }
+	}
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+	YYABORT;
+
+
+      yydestruct ("Error: popping",
+		  yystos[yystate], yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  *++yyvsp = yylval;
+
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+  if (yychar != YYEOF && yychar != YYEMPTY)
+     yydestruct ("Cleanup: discarding lookahead",
+		 yytoken, &yylval);
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+		  yystos[*yyssp], yyvsp);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+  if (yymsg != yymsgbuf)
+    YYSTACK_FREE (yymsg);
+#endif
+  /* Make sure YYID is used.  */
+  return YYID (yyresult);
+}
+
+
+#line 676 "../../../hdf4/mfhdf/ncgen/ncgen.y"
+
+
+/* PROGRAMS */
+
+/* get lexical input routine generated by lex  */
+#include "ncgenyy.c"
+
+void derror();
+
+yyerror(s)	/* called for yacc syntax error */
+     char *s;
+{
+	derror(s);
+}
+
+#ifndef yywrap
+int
+yywrap()			/* returns 1 on EOF if no more input */
+{
+    return  1;
+}
+#endif /* yywrap() */
+
+
+/* Symbol table operations for ncgen tool */
+
+YYSTYPE lookup(sname)       /* find sname in symbol table (linear search) */
+char *sname;
+{
+    YYSTYPE sp;
+    for (sp = symlist; sp != (YYSTYPE) 0; sp = sp -> next)
+	if (STREQ(sp -> name, sname)) {
+	    return sp;
+	}
+    return 0;			/* 0 ==> not found */
+}
+
+YYSTYPE install(sname)  /* install sname in symbol table */
+char *sname;
+{
+    YYSTYPE sp;
+
+    sp = (YYSTYPE) emalloc (sizeof (struct Symbol));
+    sp -> name = (char *) emalloc (strlen (sname) + 1);/* +1 for '\0' */
+    (void) strcpy (sp -> name, sname);
+    sp -> next = symlist;	/* put at front of list */
+    sp -> is_dim = 0;
+    sp -> is_var = 0;
+    sp -> is_att = 0;
+    symlist = sp;
+    return sp;
+}
+
+void
+clearout()	/* reset symbol table to empty */
+{
+    YYSTYPE sp, tp;
+    for (sp = symlist; sp != (YYSTYPE) 0;) {
+	tp = sp -> next;
+	free (sp -> name);
+	free ((char *) sp);
+	sp = tp;
+    }
+    symlist = 0;
+}
+
diff --git a/mfhdf/ncgen/ncgentab.h b/mfhdf/ncgen/ncgentab.h
new file mode 100644
index 0000000..a1d4cfc
--- /dev/null
+++ b/mfhdf/ncgen/ncgentab.h
@@ -0,0 +1,95 @@
+/* A Bison parser, made by GNU Bison 2.3.  */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     NC_UNLIMITED_K = 258,
+     BYTE_K = 259,
+     CHAR_K = 260,
+     SHORT_K = 261,
+     LONG_K = 262,
+     FLOAT_K = 263,
+     DOUBLE_K = 264,
+     IDENT = 265,
+     TERMSTRING = 266,
+     BYTE_CONST = 267,
+     CHAR_CONST = 268,
+     SHORT_CONST = 269,
+     LONG_CONST = 270,
+     FLOAT_CONST = 271,
+     DOUBLE_CONST = 272,
+     DIMENSIONS = 273,
+     VARIABLES = 274,
+     NETCDF = 275,
+     DATA = 276
+   };
+#endif
+/* Tokens.  */
+#define NC_UNLIMITED_K 258
+#define BYTE_K 259
+#define CHAR_K 260
+#define SHORT_K 261
+#define LONG_K 262
+#define FLOAT_K 263
+#define DOUBLE_K 264
+#define IDENT 265
+#define TERMSTRING 266
+#define BYTE_CONST 267
+#define CHAR_CONST 268
+#define SHORT_CONST 269
+#define LONG_CONST 270
+#define FLOAT_CONST 271
+#define DOUBLE_CONST 272
+#define DIMENSIONS 273
+#define VARIABLES 274
+#define NETCDF 275
+#define DATA 276
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
diff --git a/mfhdf/ncgen/ncgenyy.c b/mfhdf/ncgen/ncgenyy.c
new file mode 100644
index 0000000..1c5a095
--- /dev/null
+++ b/mfhdf/ncgen/ncgenyy.c
@@ -0,0 +1,1962 @@
+/* A lexical scanner generated by flex*/
+
+/* Scanner skeleton version:
+ * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+/* Windows does not have unistd.h */
+#ifdef H4_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif	/* __STDC__ */
+#endif	/* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator).  This
+ * avoids problems with code like:
+ *
+ * 	if ( condition_holds )
+ *		yyless( 5 );
+ *	else
+ *		do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		*yy_cp = yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
+		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* Some routines like yy_flex_realloc() are emitted as static but are
+   not called by all lexers. This generates warnings in some compilers,
+   notably GCC. Arrange to suppress these. */
+#ifdef __GNUC__
+#define YY_MAY_BE_UNUSED __attribute__((unused))
+#else
+#define YY_MAY_BE_UNUSED
+#endif
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+	};
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars;		/* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1;		/* whether we need to initialize */
+static int yy_start = 0;	/* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin.  A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! yy_current_buffer ) \
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	yy_current_buffer->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	yytext_ptr = yy_bp; \
+	yyleng = (int) (yy_cp - yy_bp); \
+	yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+	yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 29
+#define YY_END_OF_BUFFER 30
+static yyconst short int yy_accept[241] =
+    {   0,
+        0,    0,   30,   28,   27,   17,   28,   28,   28,   28,
+       18,   28,   21,   21,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   27,    0,
+        2,    0,    0,    0,   18,    0,   21,    0,    0,   18,
+       18,    0,   19,    1,   22,   22,   22,   21,   20,    0,
+       21,   21,   16,   16,   16,   16,   16,   16,   16,    0,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,    2,   23,    0,    0,
+
+        0,   18,    0,    0,   18,    1,   22,   18,   22,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,    7,
+       15,   16,   16,   14,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,    7,   16,   16,   16,   16,   16,
+       16,   26,   24,    0,    0,   18,   14,   18,   19,   18,
+        5,    4,   16,   16,   16,   16,   16,   16,   16,   16,
+        7,   16,    3,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   16,   24,    0,   25,    0,
+       12,   16,   16,   16,   16,   16,   16,   16,    6,   16,
+       16,   16,   16,   16,   16,   16,   16,   16,   16,    8,
+
+       16,   16,   16,   16,   16,   16,   16,   16,   16,   16,
+       16,   16,   16,   16,   16,   13,   13,   16,   16,   16,
+       16,   16,   16,   16,   15,   16,   16,   16,   16,   16,
+       16,    9,   16,   16,   16,   16,   11,   16,   10,    0
+    } ;
+
+static yyconst int yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    2,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    1,    4,    1,    1,    1,    1,    5,    1,
+        1,    1,    6,    1,    7,    8,    9,   10,   11,   11,
+       11,   11,   11,   11,   11,   12,   12,   13,    1,    1,
+        1,    1,    1,    1,   14,   15,   16,   17,   18,   19,
+       20,   21,   22,   23,   23,   24,   25,   26,   27,   23,
+       23,   28,   29,   30,   31,   32,   23,   33,   34,   23,
+        1,   35,    1,    1,   23,    1,   36,   37,   38,   39,
+
+       40,   41,   42,   43,   44,   23,   23,   45,   46,   47,
+       48,   23,   23,   49,   50,   51,   52,   53,   23,   54,
+       55,   23,   56,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst int yy_meta[57] =
+    {   0,
+        1,    1,    2,    1,    3,    1,    4,    1,    1,    5,
+        5,    5,    1,    5,    5,    5,    5,    5,    5,    4,
+        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
+        4,    4,    4,    4,    1,    5,    5,    5,    5,    5,
+        5,    4,    4,    4,    4,    4,    4,    4,    4,    4,
+        4,    4,    4,    4,    4,    6
+    } ;
+
+static yyconst short int yy_base[251] =
+    {   0,
+        0,    0,  411,  465,  408,  465,   53,  374,   50,   55,
+       86,  399,  124,  171,    0,  373,  385,   58,   64,   54,
+       53,  378,   41,  386,  382,  376,  387,  344,  355,   65,
+      352,  347,  338,  345,  344,  340,  335,  345,  378,   79,
+      465,   80,  374,   76,    0,  180,    0,  110,  342,    0,
+      465,  139,  465,    0,  123,  194,  160,  465,  465,    0,
+        0,  465,    0,  347,  362,  345,  349,  342,  320,   81,
+      174,  235,  344,  322,  339,  327,  341,  336,  338,  349,
+      335,  335,  323,  299,  313,  296,  299,  292,  295,  291,
+      294,  289,  303,  290,  292,  287,   98,  465,  330,  113,
+
+      329,  271,  307,  203,  307,    0,  465,  212,  130,  314,
+      302,  315,  310,  312,  288,    0,    0,  309,  286,  303,
+      276,  295,  298,    0,  289,  283,  287,  286,  267,  257,
+      269,  264,  266,  266,  261,  258,   73,  254,  249,  253,
+      252,  465,  465,  217,  289,  465,  465,    0,    0,  465,
+        0,    0,  280,  266,  267,  244,  257,  235,  265,  237,
+        0,  262,    0,  248,  252,  261,  260,  225,  226,  219,
+      227,  251,  228,  215,  219,  228,  465,  258,  465,  257,
+      465,  232,  242,  218,  234,  237,  206,  230,    0,  226,
+      228,  192,  201,  200,  220,  197,  193,  198,  211,    0,
+
+      210,  179,  197,  173,  352,  187,  186,  164,  158,  152,
+      156,  172,  150,  155,  139,    0,  387,  175,  169,  128,
+      133,  118,  129,  111,    0,  127,  108,   82,   89,   69,
+       83,    0,   95,   57,   81,   69,  465,   56,  465,  465,
+      422,  428,  431,  436,  442,   59,  446,  449,  454,  459
+    } ;
+
+static yyconst short int yy_def[251] =
+    {   0,
+      240,    1,  240,  240,  240,  240,  241,  242,  240,  240,
+      240,  240,  240,  240,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  240,  241,
+      240,  241,  240,  244,   11,  240,   14,  240,  240,   11,
+      240,  240,  240,  245,   13,   55,   56,  240,  240,  246,
+       14,  240,  243,  243,  243,  243,  243,  243,  243,  240,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  241,  240,  240,  240,
+
+      247,  240,  240,  240,  240,  245,  240,   57,  246,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  240,  240,  240,  248,  240,  240,   56,   56,  240,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  240,  240,  240,  240,
+      240,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+
+      243,  243,  243,  243,  249,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  250,  249,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  243,  243,  243,  243,
+      243,  243,  243,  243,  243,  243,  240,  243,  240,    0,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240
+    } ;
+
+static yyconst short int yy_nxt[522] =
+    {   0,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+       14,   14,    4,   15,   16,   17,   18,   19,   20,   15,
+       15,   21,   15,   22,   15,   23,   15,   24,   25,   15,
+       26,   27,   15,   15,    4,   15,   28,   29,   30,   19,
+       31,   15,   15,   32,   33,   15,   34,   15,   35,   36,
+       15,   37,   38,   15,   15,    4,   41,   45,   78,   46,
+       47,   47,   45,  109,   46,   47,   47,   48,  239,   70,
+       71,   66,   48,   72,   72,   72,   79,   73,   75,   67,
+       49,  239,   41,   97,   68,  100,  100,   42,  172,   48,
+      102,  102,  102,  237,   48,   50,   50,   50,   74,   76,
+
+       86,   41,   51,   52,   53,   69,  238,  237,   87,   51,
+      173,  236,   88,   42,   42,   70,   70,  143,  235,  102,
+      102,  102,  144,  144,   51,   52,   53,  232,  234,  101,
+       51,   45,   42,   55,   55,   55,  233,   56,   56,   56,
+       56,   57,   56,  232,  104,  104,  107,   58,  105,  105,
+      105,  124,   59,  107,  231,  240,   60,  230,   59,   56,
+       56,   56,   56,   57,   56,   70,   70,  107,   58,  108,
+      108,  108,  229,   59,  107,  228,  240,   60,   45,   59,
+       61,   61,   61,   72,   72,   72,  227,   45,   48,   46,
+       46,   46,  226,  225,   62,  225,  224,   48,  223,   59,
+
+      222,  240,  221,   56,   56,   56,  161,  220,   59,  219,
+       48,   56,  105,  105,  105,   62,  218,  240,  240,   48,
+       59,  177,  240,  215,  161,  214,  178,  178,  148,   59,
+      149,  213,  212,   56,  211,  150,  210,  205,  205,  209,
+      200,  208,  207,  240,   72,   72,   72,  206,  205,  204,
+      148,  116,  149,  117,  203,  202,  150,  201,  116,  200,
+      199,  179,  177,  198,  197,  189,  196,  195,  194,  163,
+      193,  192,  181,  116,  191,  117,  190,  189,  188,  116,
+      102,  102,  102,  187,  186,  185,  163,  146,  184,   53,
+      183,  182,  181,  179,  146,  176,  175,  174,  163,  161,
+
+      171,  170,  169,  168,  167,  152,  151,  166,  165,  146,
+      164,   53,  163,  162,  161,  146,  105,  105,  105,  160,
+      159,  158,  157,   51,  156,   53,  155,  154,  153,  152,
+       51,  151,  147,  142,  142,  141,  140,  139,  138,  137,
+      136,  135,  134,  133,  132,   51,  131,   53,  130,  129,
+      128,   51,  216,  216,  216,  216,  216,  216,  127,  216,
+      216,  126,  125,  124,  216,  123,  122,  121,  120,  119,
+      118,  115,  114,  113,  112,  111,  110,  103,   98,   39,
+       96,   95,   94,   93,   92,   91,  216,  216,  216,  216,
+      216,  216,  216,   90,  216,  216,   89,   85,   84,  216,
+
+       83,   82,   81,   80,   77,   65,   64,   54,   44,   39,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  216,   40,   40,   40,   40,   40,   40,   43,   43,
+       43,   43,   43,   43,   63,   63,   99,  240,   99,   99,
+       99,   99,  106,  240,  106,  106,  106,  106,  145,  240,
+      145,  180,  240,  180,  217,  217,  217,  217,  217,  216,
+      216,  216,  216,  216,    3,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240
+    } ;
+
+static yyconst short int yy_chk[522] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    7,    9,   23,    9,
+        9,    9,   10,  246,   10,   10,   10,    9,  238,   19,
+       19,   18,   10,   19,   19,   19,   23,   20,   21,   18,
+       10,  236,   40,   42,   18,   44,   44,    7,  137,    9,
+       70,   70,   70,  235,   10,   11,   11,   11,   20,   21,
+
+       30,   97,   11,   11,   11,   18,  234,  233,   30,   11,
+      137,  231,   30,   40,   42,   48,   48,  100,  230,   48,
+       48,   48,  100,  100,   11,   11,   11,  229,  228,   44,
+       11,   13,   97,   13,   13,   13,  227,   13,   13,   13,
+       13,   13,   13,  226,   52,   52,   55,   13,   52,   52,
+       52,  224,   13,  109,  223,   55,   13,  222,  109,   13,
+       13,   13,   13,   13,   13,   57,   57,   55,   13,   57,
+       57,   57,  221,   13,  109,  220,   55,   13,   14,  109,
+       14,   14,   14,   71,   71,   71,  219,   46,   14,   46,
+       46,   46,  218,  215,   14,  214,  213,   46,  212,   14,
+
+      211,   56,  210,   56,   56,   56,  209,  208,   46,  207,
+       14,   56,  104,  104,  104,   14,  206,  108,  108,   46,
+       14,  144,   56,  204,  203,  202,  144,  144,  108,   46,
+      108,  201,  199,   56,  198,  108,  197,  196,  195,  194,
+      193,  192,  191,   56,   72,   72,   72,  190,  188,  187,
+      108,   72,  108,   72,  186,  185,  108,  184,   72,  183,
+      182,  180,  178,  176,  175,  174,  173,  172,  171,  170,
+      169,  168,  167,   72,  166,   72,  165,  164,  162,   72,
+      102,  102,  102,  160,  159,  158,  157,  102,  156,  102,
+      155,  154,  153,  145,  102,  141,  140,  139,  138,  136,
+
+      135,  134,  133,  132,  131,  130,  129,  128,  127,  102,
+      126,  102,  125,  123,  122,  102,  105,  105,  105,  121,
+      120,  119,  118,  105,  115,  105,  114,  113,  112,  111,
+      105,  110,  103,  101,   99,   96,   95,   94,   93,   92,
+       91,   90,   89,   88,   87,  105,   86,  105,   85,   84,
+       83,  105,  205,  205,  205,  205,  205,  205,   82,  205,
+      205,   81,   80,   79,  205,   78,   77,   76,   75,   74,
+       73,   69,   68,   67,   66,   65,   64,   49,   43,   39,
+       38,   37,   36,   35,   34,   33,  205,  217,  217,  217,
+      217,  217,  217,   32,  217,  217,   31,   29,   28,  217,
+
+       27,   26,   25,   24,   22,   17,   16,   12,    8,    5,
+        3,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,  217,  241,  241,  241,  241,  241,  241,  242,  242,
+      242,  242,  242,  242,  243,  243,  244,    0,  244,  244,
+      244,  244,  245,    0,  245,  245,  245,  245,  247,    0,
+      247,  248,    0,  248,  249,  249,  249,  249,  249,  250,
+      250,  250,  250,  250,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240,  240,  240,  240,  240,  240,  240,  240,  240,  240,
+      240
+    } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+#define INITIAL 0
+#line 2 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: ncgen.l 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+#define	STREQ(a, b)	(*(a) == *(b) && strcmp((a), (b)) == 0)
+
+/* lex specification for tokens for ncgen */
+
+char errstr[100];		/* for short error messages */
+extern long strtol();
+void expand_escapes();
+
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include "ncgentab.h"
+#line 587 "lex.yy.c"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines.  This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( yy_current_buffer->yy_is_interactive ) \
+		{ \
+		int c = '*', n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+		  && ferror( yyin ) ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+YY_DECL
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp = NULL, *yy_bp = NULL;
+	register int yy_act;
+
+#line 25 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+
+#line 740 "lex.yy.c"
+
+	if ( yy_init )
+		{
+		yy_init = 0;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! yy_start )
+			yy_start = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = stdin;
+
+		if ( ! yyout )
+			yyout = stdout;
+
+		if ( ! yy_current_buffer )
+			yy_current_buffer =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+
+		yy_load_buffer_state();
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = yy_c_buf_p;
+
+		/* Support of yytext. */
+		*yy_cp = yy_hold_char;
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = yy_start;
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				yy_last_accepting_state = yy_current_state;
+				yy_last_accepting_cpos = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 241 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 465 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+
+do_action:	/* This label is used only to access EOF actions. */
+
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = yy_hold_char;
+			yy_cp = yy_last_accepting_cpos;
+			yy_current_state = yy_last_accepting_state;
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 26 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+/* comment */ ;
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 28 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+			 if(yyleng > MAXTRST) {
+				yyerror("string too long, truncated\n");
+			        yytext[MAXTRST-1] = '\0';
+			 }
+			 expand_escapes(termstring,yytext,yyleng);
+		 	 return (TERMSTRING);
+		        }
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 37 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (FLOAT_K);}
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 38 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (CHAR_K);}
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 39 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (BYTE_K);}
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 40 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (SHORT_K);}
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 41 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (LONG_K);}
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 42 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (DOUBLE_K);}
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 43 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{long_val = -1;
+			 return (NC_UNLIMITED_K);}
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 46 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (DIMENSIONS);}
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 47 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (VARIABLES);}
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 48 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{return (DATA);}
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 49 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		char *s = (char*)yytext+strlen("netcdf");
+		char *t = (char*)yytext+yyleng-1;
+		while (isspace(*s))
+			s++;
+		while (isspace(*t))
+			t--;
+		t++;
+		netcdfname = (char *) emalloc(t-s+1);
+		(void) strncpy(netcdfname, s, t-s);
+		netcdfname[t-s] = '\0';
+		return (NETCDF);
+		}
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 63 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{    /* double missing values */
+		double_val = FILL_DOUBLE;  /* IEEE double infinity */
+		return (DOUBLE_CONST);
+		}
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 68 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{    /* float missing values */
+		float_val = FILL_FLOAT;  /* IEEE float infinity */
+		return (FLOAT_CONST);
+		}
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 72 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		if ((yylval = lookup(yytext)) == NULL) {
+			yylval = install(yytext);
+			}
+		return (IDENT);
+		}
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 79 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		lineno++ ;
+		}
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 82 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		if (sscanf((char*)yytext, "%le", &double_val) != 1) {
+		    sprintf(errstr,"bad long or double constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+                return (DOUBLE_CONST);
+                }
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 89 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		if (sscanf((char*)yytext, "%e", &float_val) != 1) {
+		    sprintf(errstr,"bad float constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+                return (FLOAT_CONST);
+                }
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 96 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		if (sscanf((char*)yytext, "%hd", &short_val) != 1) {
+		    sprintf(errstr,"bad short constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		return (SHORT_CONST);
+	        }
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 103 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		/* machines where doubles have more precision than longs. */
+		/*
+		 * Because strtol and sscanf with "%ld" may silently give
+		 * bad results from undetected overflow for strings like
+		 * "30000000000", we scan as double first.
+		 */
+		double dd;
+		if (sscanf((char*)yytext, "%le", &dd) != 1) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+
+#if defined __alpha || (_MIPS_SZLONG == 64) || defined __ia64 || (defined __sun && defined _LP64) || defined AIX5L64 || defined __x86_64__ || __powerpc64__
+		if (dd < INT_MIN  ||  dd > INT_MAX) 
+#else
+		if (dd < LONG_MIN  ||  dd > LONG_MAX) 
+#endif
+                {
+		    double_val = dd;
+		    return DOUBLE_CONST;
+		} else {
+		    long_val = dd;
+		    return LONG_CONST;
+		}
+	        }
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 129 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		long dd;
+		if (sscanf((char*)yytext, "%li", &dd) != 1) {
+		    sprintf(errstr,"bad long constant: %s",(char*)yytext);
+		    yyerror(errstr);
+		}
+		long_val = dd;
+		return LONG_CONST;
+	        }
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 138 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+	        (void) sscanf((char*)&yytext[1],"%c",&byte_val);
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 142 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 8);
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 146 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+		byte_val = strtol((char*)&yytext[2], (char **) 0, 16);
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 150 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{
+	       switch ((char)yytext[2]) {
+	          case 'a': byte_val = '\007'; break; /* not everyone under-
+						       * stands '\a' yet */
+     	          case 'b': byte_val = '\b'; break;
+		  case 'f': byte_val = '\f'; break;
+		  case 'n': byte_val = '\n'; break;
+		  case 'r': byte_val = '\r'; break;
+		  case 't': byte_val = '\t'; break;
+		  case 'v': byte_val = '\v'; break;
+		  case '\\': byte_val = '\\'; break;
+		  case '?': byte_val = '\177'; break;
+		  case '\'': byte_val = '\''; break;
+		  default: byte_val = (char)yytext[2];
+	           }
+		return (BYTE_CONST);
+                }
+	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 168 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+{/* whitespace */ ;
+		}
+	YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 170 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+return (yytext[0]) ;
+	YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 171 "../../../hdf4/mfhdf/ncgen/ncgen.l"
+ECHO;
+	YY_BREAK
+#line 1078 "lex.yy.c"
+case YY_STATE_EOF(INITIAL):
+	yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between yy_current_buffer and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			yy_n_chars = yy_current_buffer->yy_n_chars;
+			yy_current_buffer->yy_input_file = yyin;
+			yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state();
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++yy_c_buf_p;
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = yy_c_buf_p;
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer() )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				yy_did_buffer_switch_on_eof = 0;
+
+				if ( yywrap() )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				yy_c_buf_p =
+					yytext_ptr + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				yy_c_buf_p =
+				&yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+				yy_current_state = yy_get_previous_state();
+
+				yy_cp = yy_c_buf_p;
+				yy_bp = yytext_ptr + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+	} /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+	{
+	register char *dest = yy_current_buffer->yy_ch_buf;
+	register char *source = yytext_ptr;
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( yy_current_buffer->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+	else
+		{
+		int num_to_read =
+			yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+			YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = yy_current_buffer;
+
+			int yy_c_buf_p_offset =
+				(int) (yy_c_buf_p - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					yy_flex_realloc( (void *) b->yy_ch_buf,
+							 b->yy_buf_size + 2 );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = yy_current_buffer->yy_buf_size -
+						number_to_move - 1;
+#endif
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+			yy_n_chars, num_to_read );
+
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	if ( yy_n_chars == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart( yyin );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			yy_current_buffer->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	yy_n_chars += number_to_move;
+	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+	return ret_val;
+	}
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+	{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+
+	yy_current_state = yy_start;
+
+	for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			yy_last_accepting_state = yy_current_state;
+			yy_last_accepting_cpos = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 241 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+	}
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+	{
+	register int yy_is_jam;
+	register char *yy_cp = yy_c_buf_p;
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		yy_last_accepting_state = yy_current_state;
+		yy_last_accepting_cpos = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 241 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 240);
+
+	return yy_is_jam ? 0 : yy_current_state;
+	}
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+	{
+	register char *yy_cp = yy_c_buf_p;
+
+	/* undo effects of setting up yytext */
+	*yy_cp = yy_hold_char;
+
+	if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = yy_n_chars + 2;
+		register char *dest = &yy_current_buffer->yy_ch_buf[
+					yy_current_buffer->yy_buf_size + 2];
+		register char *source =
+				&yy_current_buffer->yy_ch_buf[number_to_move];
+
+		while ( source > yy_current_buffer->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		yy_current_buffer->yy_n_chars =
+			yy_n_chars = yy_current_buffer->yy_buf_size;
+
+		if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+
+	yytext_ptr = yy_bp;
+	yy_hold_char = *yy_cp;
+	yy_c_buf_p = yy_cp;
+	}
+#endif	/* ifndef YY_NO_UNPUT */
+
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+	{
+	int c;
+
+	*yy_c_buf_p = yy_hold_char;
+
+	if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+			/* This was really a NUL. */
+			*yy_c_buf_p = '\0';
+
+		else
+			{ /* need more input */
+			int offset = yy_c_buf_p - yytext_ptr;
+			++yy_c_buf_p;
+
+			switch ( yy_get_next_buffer() )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart( yyin );
+
+					/* fall through */
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap() )
+						return EOF;
+
+					if ( ! yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					yy_c_buf_p = yytext_ptr + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
+	*yy_c_buf_p = '\0';	/* preserve yytext */
+	yy_hold_char = *++yy_c_buf_p;
+
+
+	return c;
+	}
+#endif /* YY_NO_INPUT */
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+	{
+	if ( ! yy_current_buffer )
+		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+	yy_init_buffer( yy_current_buffer, input_file );
+	yy_load_buffer_state();
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+	{
+	if ( yy_current_buffer == new_buffer )
+		return;
+
+	if ( yy_current_buffer )
+		{
+		/* Flush out information for old buffer. */
+		*yy_c_buf_p = yy_hold_char;
+		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+		yy_current_buffer->yy_n_chars = yy_n_chars;
+		}
+
+	yy_current_buffer = new_buffer;
+	yy_load_buffer_state();
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	yy_did_buffer_switch_on_eof = 1;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+	{
+	yy_n_chars = yy_current_buffer->yy_n_chars;
+	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+	yyin = yy_current_buffer->yy_input_file;
+	yy_hold_char = *yy_c_buf_p;
+	}
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+	{
+	YY_BUFFER_STATE b;
+
+	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer( b, file );
+
+	return b;
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+	{
+	if ( ! b )
+		return;
+
+	if ( b == yy_current_buffer )
+		yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		yy_flex_free( (void *) b->yy_ch_buf );
+
+	yy_flex_free( (void *) b );
+	}
+
+
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+	{
+	yy_flush_buffer( b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+	b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+	b->yy_is_interactive = 0;
+#else
+	b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+	}
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+	{
+	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == yy_current_buffer )
+		yy_load_buffer_state();
+	}
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+	{
+	YY_BUFFER_STATE b;
+
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	yy_switch_to_buffer( b );
+
+	return b;
+	}
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+	{
+	int len;
+	for ( len = 0; yy_str[len]; ++len )
+		;
+
+	return yy_scan_bytes( yy_str, len );
+	}
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+	{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = len + 2;
+	buf = (char *) yy_flex_alloc( n );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+	for ( i = 0; i < len; ++i )
+		buf[i] = bytes[i];
+
+	buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = yy_scan_buffer( buf, n );
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+	}
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+	{
+	if ( yy_start_stack_ptr >= yy_start_stack_depth )
+		{
+		yy_size_t new_size;
+
+		yy_start_stack_depth += YY_START_STACK_INCR;
+		new_size = yy_start_stack_depth * sizeof( int );
+
+		if ( ! yy_start_stack )
+			yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+		else
+			yy_start_stack = (int *) yy_flex_realloc(
+					(void *) yy_start_stack, new_size );
+
+		if ( ! yy_start_stack )
+			YY_FATAL_ERROR(
+			"out of memory expanding start-condition stack" );
+		}
+
+	yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+	BEGIN(new_state);
+	}
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+	{
+	if ( --yy_start_stack_ptr < 0 )
+		YY_FATAL_ERROR( "start-condition stack underflow" );
+
+	BEGIN(yy_start_stack[yy_start_stack_ptr]);
+	}
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+	{
+	return yy_start_stack[yy_start_stack_ptr - 1];
+	}
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+	{
+	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+	}
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+		yytext[yyleng] = yy_hold_char; \
+		yy_c_buf_p = yytext + n; \
+		yy_hold_char = *yy_c_buf_p; \
+		*yy_c_buf_p = '\0'; \
+		yyleng = n; \
+		} \
+	while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+	{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+	}
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+	{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+	}
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+	{
+	return (void *) malloc( size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+	{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+	}
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+	{
+	free( ptr );
+	}
+
+#if YY_MAIN
+int main()
+	{
+	yylex();
+	return 0;
+	}
+#endif
+#line 171 "../../../hdf4/mfhdf/ncgen/ncgen.l"
diff --git a/mfhdf/ncgen/test0.cdl b/mfhdf/ncgen/test0.cdl
new file mode 100644
index 0000000..f168d6f
--- /dev/null
+++ b/mfhdf/ncgen/test0.cdl
@@ -0,0 +1,40 @@
+netcdf test0 {
+
+dimensions:
+	i = 2;
+	j = 3;
+	k = unlimited;
+        l = 3 ;
+
+variables:
+	char bears(i,j,l);
+		bears:act = "text string\n\t123";
+//		bears:acb = '\n';	// "byte" type not in some FORTRANs
+		bears:acs = -40s ;
+		bears:acl = 17000 ;
+		bears:acf = -2.0f, 1.f, 0.0f ;
+		bears:acd = -1.0, 0.75 ;
+//	byte dust(i,j);			// "byte" type
+	short order(i,j);
+	long shot(i,j);
+	float aloan(i,j);
+	double cross(i,j);
+	int i(i);
+	float j(j);
+	short l(l);
+
+	:history = "This is an example of a multi-line global\n",
+		   "attribute.  It could be used for representing the\n",
+		   "processing history of the data, for example." ;
+
+data:
+	bears = "indistinguishable" ;
+//	dust = -127,0,127,128,255;	// "byte" type
+	order = 1s, 2s, 3s, 4s, 5s, 6s;
+	shot = 2, 3, 4, 5, 6, 7 ;
+	aloan = 3.f, 4.f, 5.f, 6.f, 7.f, 1.0e12f ;
+	cross = '\4', 5s, 0.000244140625, 7.0f, 8.0, 1.0e10 ;
+	i = 10, 20;
+	j = 2, 4, 6;
+	l = 10, 9, 8;
+}
diff --git a/mfhdf/ncgen/testncgen.sh.in b/mfhdf/ncgen/testncgen.sh.in
new file mode 100755
index 0000000..44c32b2
--- /dev/null
+++ b/mfhdf/ncgen/testncgen.sh.in
@@ -0,0 +1,140 @@
+#! /bin/sh
+# Tests for ncgen
+
+srcdir=@srcdir@
+
+NCDUMP='../ncdump/ncdump'
+
+RM='rm -f'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+
+nerrors=0
+verbose=yes
+
+# Print message with formats according to message level ($1)
+MESG() {
+  level=$1
+  shift
+  case $level in
+    0)
+      echo '============================='
+      echo $*
+      echo '============================='
+      ;;
+    3)
+      echo '-----------------------------'
+      echo $*
+      echo '-----------------------------'
+      ;;
+    6)
+      echo "*** $* ***"
+      ;;
+    *)
+      echo "MESG(): Unknown level ($level)"
+      exit 1
+      ;;
+  esac
+}
+
+
+# Report the result and exit
+FINISH()
+{
+    if [ $nerrors -eq 0 ]
+    then
+        MESG 0 "All ncgen tests passed"
+    else
+        MESG 0 "ncgen tests failed: $nerrors"
+    fi
+    exit $nerrors
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+   SPACES="                                                               "
+   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+bcheck() {
+   ## Test the "-b" option of ncgen
+   ${TESTS_ENVIRONMENT} ./ncgen -b test1.cdl
+   ${TESTS_ENVIRONMENT} $NCDUMP test1.nc > test2.cdl
+   $DIFF test1.cdl test2.cdl
+   RET=$?
+   if [ $RET -eq 0 ]; then
+      echo "*** ncgen -b test successful ***"
+   else 
+      echo "*** ncgen -b test failed ***"
+      nerrors="`expr $nerrors + 1`"
+   fi
+}
+
+ccheck() {
+   ## Test the "-c" option of ncgen
+   ${TESTS_ENVIRONMENT} ./ctest0        # tests `-c' option, creates ctest0.nc
+   ${TESTS_ENVIRONMENT} $NCDUMP -n test1 ctest0.nc > ctest1.cdl
+   $DIFF test1.cdl ctest1.cdl
+   RET=$?
+   if [ $RET -eq 0 ]; then
+      echo "*** ncgen -c test successful ***"
+   else
+      echo "*** ncgen -c test failed  ***"
+      nerrors="`expr $nerrors + 1`"
+   fi
+}
+
+fcheck() {
+   ## Test the "-f" option of ncgen
+   ${TESTS_ENVIRONMENT} ./ftest0
+   ${TESTS_ENVIRONMENT} $NCDUMP -n test1 ftest0.nc > ftest1.cdl
+   $DIFF test1.cdl ftest1.cdl
+   RET=$?
+   if [ $RET -eq 0 ]; then
+      echo "*** ncgen -f test successful ***"
+   else
+      echo "*** ncgen -f test failed (but roundoff differences are OK) ***"
+      nerrors="`expr $nerrors + 1`"
+   fi
+}
+
+# Run a test and print PASS or *FAIL*.  If a test fails then increment
+# the `nerrors' global variable
+#
+RUN() {
+   # create test files
+   ${TESTS_ENVIRONMENT} ./ncgen -b -o test0.nc $srcdir/test0.cdl
+   ${TESTS_ENVIRONMENT} $NCDUMP -n test1 test0.nc > test1.cdl
+
+   # Run test.
+   if [ $HDF_BUILD_NETCDF -ne 0 ]; then
+      if [ $HDF_BUILD_FORTRAN -ne 0 ]; then
+         bcheck
+         ccheck
+         fcheck
+      else
+         bcheck
+         ccheck
+      fi
+   else
+      bcheck
+      ccheck
+   fi
+}
+
+##############################################################################
+###                       T H E   T E S T S                                ###
+##############################################################################
+
+# Print a beginning banner
+MESG 0 "Running ncgen tests"
+
+# compare output
+RUN
+
+# End of test, return exit code
+FINISH
+    
\ No newline at end of file
diff --git a/mfhdf/nctest/CMakeLists.txt b/mfhdf/nctest/CMakeLists.txt
new file mode 100644
index 0000000..486fd2c
--- /dev/null
+++ b/mfhdf/nctest/CMakeLists.txt
@@ -0,0 +1,70 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_NCTEST)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+SET (nctest_SRCS
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/add.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/atttests.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/cdftests.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/dimtests.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/driver.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/emalloc.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/error.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/misctest.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/rec.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/slabs.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/val.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/varget_unlim.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/varget.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/vargetg.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/varput.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/varputg.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/vardef.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/vartests.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/vputget.c
+    ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/vputgetg.c
+)
+  
+ADD_EXECUTABLE (nctest ${nctest_SRCS})
+TARGET_C_PROPERTIES (nctest " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (nctest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET} )
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (nctest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+TARGET_NAMING (nctest ${LIB_TYPE})
+ 
+#-- Copy all the dat files from the test directory into the source directory
+SET (HDF4_NC_TEST_FILES
+    test_unlim.cdl
+    test_unlim.nc
+)
+ 
+FOREACH (h4_file ${HDF4_NC_TEST_FILES})
+  SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+  #MESSAGE (STATUS " Copying ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
+  ADD_CUSTOM_COMMAND (
+      TARGET     nctest 
+      POST_BUILD
+      COMMAND    ${CMAKE_COMMAND}
+      ARGS       -E copy_if_different ${HDF4_MFHDF_NCTEST_SOURCE_DIR}/${h4_file} ${dest}
+  )
+      
+ENDFOREACH (h4_file ${HDF4_NC_TEST_FILES})
+
+INCLUDE (CMakeTests.cmake)
diff --git a/mfhdf/nctest/CMakeTests.cmake b/mfhdf/nctest/CMakeTests.cmake
new file mode 100644
index 0000000..c5e0dc4
--- /dev/null
+++ b/mfhdf/nctest/CMakeTests.cmake
@@ -0,0 +1,19 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME NC_TEST-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        test.nc
+        test2.nc
+)
+
+#-- Adding test for nctest
+ADD_TEST (NAME NC_TEST-nctest COMMAND $<TARGET_FILE:nctest>)
+SET_TESTS_PROPERTIES (NC_TEST-nctest PROPERTIES DEPENDS NC_TEST-clearall-objects LABELS ${PROJECT_NAME})
diff --git a/mfhdf/nctest/Makefile.am b/mfhdf/nctest/Makefile.am
new file mode 100644
index 0000000..a46252f
--- /dev/null
+++ b/mfhdf/nctest/Makefile.am
@@ -0,0 +1,37 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+#############################################################################
+##                          Programs to build                              ##
+#############################################################################
+
+TEST_PROG = nctest
+check_PROGRAMS = nctest
+
+# Information for building the "ncgen" program
+nctest_SOURCES = add.c atttests.c cdftests.c dimtests.c driver.c emalloc.c  \
+                 error.c misctest.c rec.c slabs.c val.c varget_unlim.c      \
+                 varget.c vargetg.c varput.c varputg.c vardef.c vartests.c  \
+                 vputget.c vputgetg.c
+nctest_LDADD = $(LIBMFHDF) $(LIBHDF)
+nctest_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += test2.nc test.nc
+
+DISTCLEANFILES =
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/nctest/Makefile.in b/mfhdf/nctest/Makefile.in
new file mode 100644
index 0000000..0bb5103
--- /dev/null
+++ b/mfhdf/nctest/Makefile.in
@@ -0,0 +1,778 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+check_PROGRAMS = nctest$(EXEEXT)
+TESTS = $(am__EXEEXT_1)
+subdir = mfhdf/nctest
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am_nctest_OBJECTS = add.$(OBJEXT) atttests.$(OBJEXT) \
+	cdftests.$(OBJEXT) dimtests.$(OBJEXT) driver.$(OBJEXT) \
+	emalloc.$(OBJEXT) error.$(OBJEXT) misctest.$(OBJEXT) \
+	rec.$(OBJEXT) slabs.$(OBJEXT) val.$(OBJEXT) \
+	varget_unlim.$(OBJEXT) varget.$(OBJEXT) vargetg.$(OBJEXT) \
+	varput.$(OBJEXT) varputg.$(OBJEXT) vardef.$(OBJEXT) \
+	vartests.$(OBJEXT) vputget.$(OBJEXT) vputgetg.$(OBJEXT)
+nctest_OBJECTS = $(am_nctest_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(nctest_SOURCES)
+DIST_SOURCES = $(nctest_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+am__EXEEXT_1 = nctest$(EXEEXT)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog test2.nc test.nc
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+
+#############################################################################
+#############################################################################
+TEST_PROG = nctest
+
+# Information for building the "ncgen" program
+nctest_SOURCES = add.c atttests.c cdftests.c dimtests.c driver.c emalloc.c  \
+                 error.c misctest.c rec.c slabs.c val.c varget_unlim.c      \
+                 varget.c vargetg.c varput.c varputg.c vardef.c vartests.c  \
+                 vputget.c vputgetg.c
+
+nctest_LDADD = $(LIBMFHDF) $(LIBHDF)
+nctest_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+DISTCLEANFILES = 
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/nctest/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/nctest/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+nctest$(EXEEXT): $(nctest_OBJECTS) $(nctest_DEPENDENCIES) $(EXTRA_nctest_DEPENDENCIES) 
+	@rm -f nctest$(EXEEXT)
+	$(LINK) $(nctest_OBJECTS) $(nctest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/atttests.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdftests.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dimtests.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/driver.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/emalloc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misctest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rec.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slabs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/val.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardef.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varget_unlim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vargetg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varput.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varputg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vartests.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputget.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputgetg.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-checkPROGRAMS clean-generic clean-libtool \
+	cscopelist ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/nctest/README b/mfhdf/nctest/README
new file mode 100644
index 0000000..735f63a
--- /dev/null
+++ b/mfhdf/nctest/README
@@ -0,0 +1,37 @@
+This directory contains source code for nctest, an extensive test
+program for the entire netCDF library.  Before compiling the sources in
+this directory, you must have already made the netCDF library from the
+../src directory.
+
+For UNIX, just type "make".  Then, when "nctest" is successfully made,
+invoke it with "nctest".
+
+Output from the test program should look like the following:
+--- Testing nccreate ...
+--- Testing ncopen ...
+--- Testing ncredef ...
+--- Testing ncendef ...
+--- Testing ncclose ...
+--- Testing ncinquire ...
+--- Testing ncsync ...
+--- Testing ncabort ...
+--- Testing ncdimdef ...
+--- Testing ncdimid ...
+--- Testing ncdiminq ...
+--- Testing ncdimrename ...
+--- Testing ncvardef ...
+--- Testing ncvarid ...
+--- Testing ncvarinq ...
+--- Testing ncvarput1 ...
+--- Testing ncvarget1 ...
+--- Testing ncvarput ...
+--- Testing ncvarget ...
+--- Testing ncvarrename ...
+--- Testing ncattput ...
+--- Testing ncattinq ...
+--- Testing ncattget ...
+--- Testing ncattcopy ...
+--- Testing ncattname ...
+--- Testing ncattrename ...
+--- Testing ncattdel ...
+--- Testing nctypelen ...
diff --git a/mfhdf/nctest/add.c b/mfhdf/nctest/add.c
new file mode 100644
index 0000000..d6b7807
--- /dev/null
+++ b/mfhdf/nctest/add.c
@@ -0,0 +1,217 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: add.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+/* 
+ * utility functions to update in-memory netcdf by adding new 
+ * dimensions, variables, and attributes.
+ */
+#include <stdio.h>
+#include <string.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"
+#include "add.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+struct netcdf test;		/*
+				 * in-memory netcdf structure, kept in sync
+				 * with disk netcdf
+				 */
+
+void
+add_dim (test, idim)		/* add the dimension idim to the netcdf test */
+     struct netcdf *test;
+     struct cdfdim *idim;
+{
+    static char pname[] = "add_dim";
+
+    if (test->ndims >= H4_MAX_NC_DIMS) {
+	(void)fprintf(stderr,
+		      "%s: too many dimensions (%d)", pname, test->ndims);
+	return;
+    }
+    test->dims[test->ndims].size = idim->size;
+    test->dims[test->ndims].name = (char *) emalloc(strlen(idim->name) + 1);
+    (void) strcpy(test->dims[test->ndims].name, idim->name);
+    if (idim->size == NC_UNLIMITED)
+      test->xdimid = test->ndims;
+    test->ndims++;
+}
+
+void
+add_var (test, ivar)		/* add the variable ivar to the netcdf test */
+     struct netcdf *test;
+     struct cdfvar *ivar;
+{
+    static char pname[] = "add_var";
+    int i;
+
+    if (test->nvars >= H4_MAX_NC_VARS) {
+	(void)fprintf(stderr,
+		      "%s: too many variables (%d)", pname, test->nvars);
+	return;
+    }
+
+    test->vars[test->nvars].name = (char *) emalloc(strlen(ivar->name) + 1);
+    (void) strcpy(test->vars[test->nvars].name, ivar->name);
+    test->vars[test->nvars].type = ivar->type;
+    test->vars[test->nvars].ndims = ivar->ndims;
+    test->vars[test->nvars].dims = (int *) emalloc(sizeof(int)*ivar->ndims);
+    for (i = 0; i < ivar->ndims; i++)
+      test->vars[test->nvars].dims[i] = ivar->dims[i];
+    test->vars[test->nvars].natts = 0;
+    test->nvars++;
+}
+
+void
+add_att (test, varid, iatt)	/* add attribute iatt to the netcdf test */
+     struct netcdf *test;
+     int varid;			/* variable id */
+     struct cdfatt *iatt;
+{
+    static char pname[] = "add_att";
+    int ia;			/* attribute number */
+
+    if (test->natts >= MAX_TEST_ATTS) {
+	(void)fprintf(stderr,
+		      "%s: too many attributes (%d)", pname, test->natts);
+	return;
+    }
+
+    /* if already defined, change existing attribute and return */
+    for (ia = 0; ia < test->natts ; ia++) {
+	if (test->atts[ia].var == varid &&
+	    strcmp(test->atts[ia].name, iatt->name) == 0) {
+	    test->atts[ia].type = iatt->type;
+	    test->atts[ia].len = iatt->len;
+	    test->atts[ia].val = iatt->val;
+	    return;
+	}
+    }
+    /* otherwise, add new attribute to list */
+    test->atts[test->natts].var = varid;
+    test->atts[test->natts].name = (char *) emalloc(strlen(iatt->name) + 1);
+    (void) strcpy(test->atts[test->natts].name, iatt->name);
+    test->atts[test->natts].type = iatt->type;
+    test->atts[test->natts].len = iatt->len;
+    test->atts[test->natts].val = iatt->val;
+    test->natts++;
+    if (varid == NC_GLOBAL)
+      test->ngatts++;
+    else
+      test->vars[varid].natts++;
+}
+
+
+void
+add_reset(test)			/* reset in-memory netcdf test to empty */
+     struct netcdf *test;
+{
+    test->ndims = 0;
+    test->nvars = 0;
+    test->natts = 0;
+    test->ngatts = 0;
+    test->xdimid = -1;		/* no unlimited dimension */
+}
+
+
+void
+del_att (test, varid, iatt)	/* delete attribute iatt in the netcdf test */
+     struct netcdf *test;
+     int varid;			/* variable id */
+     struct cdfatt *iatt;
+{
+    static char pname[] = "del_att";
+    int ia, ib;			/* attribute number */
+
+    for (ia = 0; ia < test->natts ; ia++) { /* find attribute to delete */
+	if (test->atts[ia].var == varid &&
+	    strcmp(test->atts[ia].name, iatt->name) == 0) {
+	    Free(test->atts[ia].name);
+            for (ib = ia+1; ib < test->natts; ib++) { /* move down */
+		test->atts[ib-1].var =   test->atts[ib].var;
+		test->atts[ib-1].name =  test->atts[ib].name;
+		test->atts[ib-1].type =  test->atts[ib].type;
+		test->atts[ib-1].len =   test->atts[ib].len;
+		test->atts[ib-1].val =   test->atts[ib].val;
+	    }
+	    test->natts--;
+	    if (varid == NC_GLOBAL)
+	      test->ngatts--;
+	    else
+	      test->vars[varid].natts--;
+	    return;
+	}
+    }
+    /* not found */
+    (void) fprintf(stderr, "%s: no such attribute as (%s, %s)", pname,
+		   test->vars[varid].name, iatt->name);
+}
+
+void
+add_data(test, varid, start, edges) /* keep max record written updated */
+     struct netcdf *test;
+     int varid;
+     long start[];
+     long edges[];
+{
+    if (varid != test->xdimid)	/* not a record variable */
+      return;
+    if (start[0] + edges[0] > test->dims[test->xdimid].size)
+      test->dims[test->xdimid].size = start[0] + edges[0];
+}
+
+
+void
+errvar(cdfp, varp)
+     struct netcdf *cdfp;
+     struct cdfvar *varp;
+{
+    const char *types;
+    int id;
+
+    switch (varp->type) {
+      case NC_BYTE:
+	types = "NC_BYTE";
+	break;
+      case NC_CHAR:
+	types = "NC_CHAR";
+	break;
+      case NC_SHORT:
+	types = "NC_SHORT";
+	break;
+      case NC_LONG:
+	types = "NC_LONG";
+	break;
+      case NC_FLOAT:
+	types = "NC_FLOAT";
+	break;
+      case NC_DOUBLE:
+	types = "NC_DOUBLE	";
+	break;
+      default:
+	types = "UNKNOWN";
+	break;
+    }
+
+    (void) fprintf(stderr,"  name=%s  type=%s  dims=(",
+		   varp->name, types);
+    for (id = 0; id < varp->ndims; id++)
+      (void) fprintf(stderr, "%d%s",
+		     (int)cdfp->dims[varp->dims[id]].size,
+		     id < varp->ndims - 1 ? ", " : "");
+    (void) fprintf(stderr, ")\n");
+}
diff --git a/mfhdf/nctest/add.h b/mfhdf/nctest/add.h
new file mode 100644
index 0000000..81a080f
--- /dev/null
+++ b/mfhdf/nctest/add.h
@@ -0,0 +1,65 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: add.h 2365 1996-03-26 22:43:35Z georgev $
+ *********************************************************************/
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* add a dimension to an in-memory netcdf structure */
+extern void	add_dim		PROTO((
+				       struct netcdf *,
+				       struct cdfdim *
+				       ));
+
+/* add a variable var to an in-memory netcdf structure */
+extern void	add_var		PROTO((
+				       struct netcdf *,
+				       struct cdfvar *
+				       ));
+
+/* add an attribute att to an in-memory netcdf structure */
+extern void	add_att		PROTO((
+				       struct netcdf *,
+				       int,
+				       struct cdfatt *
+				       ));
+
+/* reset in-memory netcdf structure to empty */
+extern void	add_reset	PROTO((
+				       struct netcdf *
+				       ));
+
+/* delete an attribute att from an in-memory netcdf structure */
+extern void	del_att		PROTO((
+				       struct netcdf *,
+				       int,
+				       struct cdfatt *
+				       ));
+
+/* keep max record written updated */
+extern void	add_data	PROTO((
+				       struct netcdf *,
+				       int,
+				       long [],
+				       long []
+				       ));
+
+/* display info about variable, for error messages */
+extern void	errvar		PROTO((
+				       struct netcdf *,
+				       struct cdfvar *
+				       ));
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mfhdf/nctest/atttests.c b/mfhdf/nctest/atttests.c
new file mode 100644
index 0000000..46e2587
--- /dev/null
+++ b/mfhdf/nctest/atttests.c
@@ -0,0 +1,1377 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: atttests.c 6043 2014-01-21 21:09:03Z acheng $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "error.h"
+#include "alloc.h"
+#include "emalloc.h"
+#include "tests.h"
+#include "val.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define LEN_OF(array) ((sizeof array) / (sizeof array[0]))
+
+
+/*
+ * Test ncattput
+ *    check that new attribute put works in define mode
+ *    check that NC_GLOBAL variable id works
+ *    check that changing type of existing attribute works in define mode
+ *    check that increasing length of attribute works in define mode
+ *    check that changing value of existing attribute works in define mode
+ *    try with bad datatype, should fail
+ *    try with negative length, should fail
+ *    try increasing length of attribute in data mode, should fail
+ *    try putting new attribute in data mode, should fail
+ *    check that changing type of existing attribute works in data mode
+ *    check that decreasing length of attribute works in data mode
+ *    check that changing value of existing attribute works in data mode
+ *    try with bad variable handle, should fail
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncattput(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncattput";
+    int cdfid;			/* netcdf id */
+    int ndims;			/* number of dimensions */
+    int nvars;			/* number of variables */
+    int ngatts_prev, ngatts;	/* number of global attributes */
+    int xdimid;			/* id of unlimited dimension */
+    int ia, id;
+    static char byte_vals[] = {'a', 'b'};
+    static char char_vals[] = "chars";
+    static short short_vals[] = {-999, 0, 999};
+    static nclong long_vals[] = {10, 20};
+    static float float_vals[] = {1.5, 2.5, 3.5 };
+    static double double_vals[] = {4.5, 5.5, 6.5, 7.5};
+    /* 
+     * test attributes; it is important for this test that the size 
+     * required for the attribute values increases monotonically.
+     */
+    static struct cdfatt atts[] = {
+	{___, "att0", NC_BYTE, LEN_OF(byte_vals), (void *) byte_vals},
+	{___, "att1", NC_CHAR, LEN_OF(char_vals), (void *) char_vals},
+	{___, "att2", NC_SHORT, LEN_OF(short_vals), (void *) short_vals},
+	{___, "att3", NC_LONG, LEN_OF(long_vals), (void *) long_vals},
+	{___, "att4", NC_FLOAT, LEN_OF(float_vals), (void *) float_vals},
+	{___, "att5", NC_DOUBLE, LEN_OF(double_vals), (void *) double_vals}
+    };
+    int na = LEN_OF(atts);	/* number of test attributes */
+    int ww_id;			/* variable id */
+    static struct cdfvar ww =	/* new variable */
+      {"ww", NC_LONG, 1, ___, 0};
+    static struct cdfatt tmp;	/* attribute */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* get count of global attributes */
+    if (ncinquire(cdfid, &ndims, &nvars, &ngatts, &xdimid) == -1) {
+	error("%s: ncinquire failed", pname);
+	ncclose(cdfid); return;
+    }
+    ngatts_prev = ngatts;
+    /* in define mode, add global attributes of every type */
+    for (ia = 0; ia < na; ia++) {
+	if (ncattput(cdfid, NC_GLOBAL, atts[ia].name, atts[ia].type,
+		      atts[ia].len, atts[ia].val) == -1) {
+	    error("%s: ncattput of NC_GLOBAL attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	add_att(&test, NC_GLOBAL, &atts[ia]); /* keep in-memory netcdf updated */
+    }
+    /* make sure count of global attributes has been updated */
+    if (ncinquire(cdfid, &ndims, &nvars, &ngatts, &xdimid) == -1) {
+	error("%s: ncinquire failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ngatts != ngatts_prev + na) {
+	error("%s: number of global = %d, expected %d",
+	      pname, ngatts, ngatts_prev + na);
+	nerrs++;
+    }
+    /* check with ncattinq and ncattget that NC_GLOBAL attributes put OK */
+    for (ia = 0; ia < na; ia++) {
+	if (ncattinq(cdfid, NC_GLOBAL, atts[ia].name,
+		      &tmp.type, &tmp.len) == -1) {
+	    error("%s: ncattinq of global attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	if (atts[ia].type != tmp.type || atts[ia].len != tmp.len) {
+	    error("%s: NC_GLOBAL ncattinq got unexpected type or len",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	/* allocate space to hold the attribute value to be retrieved */
+	tmp.val = emalloc(atts[ia].len * nctypelen(atts[ia].type));
+	if (ncattget(cdfid, NC_GLOBAL, atts[ia].name, tmp.val) == -1) {
+	    error("%s: ncattget of variable attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	if (val_cmp(tmp.type, tmp.len, tmp.val, atts[ia].val) != 0) {
+	    error("%s: ncattget got bad values after put of NC_GLOBAL attrs",
+		  pname);
+	    nerrs++;
+	}
+	Free ((char *) tmp.val);
+    }
+    /* add a variable, then variable attributes of every type */
+    ww.dims = (int *) emalloc(sizeof(int) * ww.ndims);
+    for (id = 0; id < ww.ndims; id++)
+      ww.dims[id] = id;
+    if ((ww_id = ncvardef(cdfid,
+			   ww.name, ww.type, ww.ndims, ww.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &ww);	/* keep in-memory netcdf in sync */
+    for (ia = 0; ia < na; ia++) {
+	if (ncattput(cdfid, ww_id,
+		      atts[ia].name, atts[ia].type, atts[ia].len, atts[ia].val)
+	    == -1) {
+	    error("%s: ncattput of variable attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	add_att(&test, ww_id, &atts[ia]); /* keep in-memory netcdf updated */
+    }
+    /* check with ncattinq and ncattget that variable attributes put OK */
+    for (ia = 0; ia < na; ia++) {
+	if (ncattinq(cdfid, ww_id, atts[ia].name,
+		      &tmp.type, &tmp.len) == -1) {
+	    error("%s: ncattinq of variable attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	if (atts[ia].type != tmp.type || atts[ia].len != tmp.len) {
+	    error("%s: ncattinq for new attribute got bad type or len",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	/* allocate space to hold the attribute value to be retrieved */
+	tmp.val = emalloc(atts[ia].len * nctypelen(atts[ia].type));
+	if (ncattget(cdfid, ww_id, atts[ia].name, tmp.val) == -1) {
+	    error("%s: ncattget of variable attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	if (val_cmp(tmp.type, tmp.len, tmp.val, atts[ia].val) != 0) {
+	    error("%s: ncattget got bad values after put of variable attrs",
+		  pname);
+	    nerrs++;
+	}
+	Free ((char *)tmp.val);
+    }
+    /*
+     * check that changing type of existing attribute, increasing 
+     * length of attribute, and changing value of existing attribute 
+     * work OK in define mode.
+     */
+    tmp.name = (char *) emalloc(H4_MAX_NC_NAME);
+    for (ia = 1; ia < na; ia++) {
+	if (ncattput(cdfid, ww_id, atts[ia-1].name, atts[ia].type,
+		      atts[ia].len, atts[ia].val) == -1) {
+	    error("%s: ncattput of larger attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	tmp.var = atts[ia].var;
+	(void) strcpy (tmp.name, atts[ia-1].name);
+	tmp.type = atts[ia].type;
+	tmp.len = atts[ia].len;
+	tmp.val = atts[ia].val;
+	add_att(&test, ww_id, &tmp); /* keep in-memory netcdf updated */
+    }
+    /* check with ncattinq and ncattget that variable attributes put OK */
+    for (ia = 1; ia < na; ia++) {
+	if (ncattinq(cdfid, ww_id, atts[ia-1].name,
+		      &tmp.type, &tmp.len) == -1) {
+	    error("%s: ncattinq of larger attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	if (atts[ia].type != tmp.type || atts[ia].len != tmp.len) {
+	    error("%s: ncattinq for larger attribute got bad type or len",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	/* allocate space to hold the attribute value to be retrieved */
+	tmp.val = emalloc(atts[ia].len * nctypelen(atts[ia].type));
+	if (ncattget(cdfid, ww_id, atts[ia-1].name, tmp.val) == -1) {
+	    error("%s: ncattget of variable attribute failed", pname);
+	    ncclose(cdfid); return;
+	}
+	if (val_cmp(tmp.type, tmp.len, tmp.val, atts[ia].val) != 0) {
+	    error("%s: ncattget got bad values after put of larger attrs",
+		  pname);
+	    nerrs++;
+	}
+	Free ((char *) tmp.val);
+    }
+    /* try with bad datatype, should fail */
+    if (ncattput(cdfid, ww_id, "bogus_att1", BAD_TYPE,
+		  atts[0].len, atts[0].val) != -1) {
+	error("%s: ncattput should fail with bad type", pname);
+	nerrs++;
+    }
+    /* try with negative length, should fail */
+    if (ncattput(cdfid, ww_id, "bogus_att2", atts[0].type,
+		  -1, atts[0].val) != -1) {
+	error("%s: ncattput should fail with bad length", pname);
+	nerrs++;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode try increasing length of attribute, should fail */
+    if (ncattput(cdfid, ww_id, atts[0].name, atts[0].type,
+		  atts[0].len + 10, atts[0].val) != -1) {
+	error("%s: ncattput should fail with increased length in data mode",
+	      pname);
+	nerrs++;
+	/* reset to correct length for later tests */
+	if (ncattput(cdfid, ww_id, atts[0].name, atts[0].type,
+		      atts[0].len, atts[0].val) != -1) {
+	    error("%s: ncattput failed to reset length in data mode", pname);
+	    nerrs++;
+	}
+    }
+    /* try creating new attribute in data mode, should fail */
+    if (ncattput(cdfid, ww_id, "new_name", atts[0].type,
+		  atts[0].len, atts[0].val) != -1) {
+	error("%s: ncattput of new attribute in data mode should fail",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    /* 
+     * check that changing type of existing attribute, decreasing 
+     * length of attribute, and changing value of existing attribute 
+     * work OK in data mode
+     */
+    for (ia = 0; ia < na - 1; ia++) {
+	if (ncattput(cdfid, ww_id, atts[ia+1].name, atts[ia].type,
+		      atts[ia].len, atts[ia].val) == -1) {
+	    error("%s: ncattput of smaller attribute failed in data mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	tmp.var = atts[ia].var;
+	(void) strcpy (tmp.name, atts[ia+1].name);
+	tmp.type = atts[ia].type;
+	tmp.len = atts[ia].len;
+	tmp.val = atts[ia].val;
+	add_att(&test, ww_id, &tmp); /* keep in-memory netcdf updated */
+    }
+    /* check with ncattinq and ncattget that variable attributes put OK */
+    for (ia = 0; ia < na - 1; ia++) {
+	if (ncattinq(cdfid, ww_id, atts[ia+1].name, &tmp.type, &tmp.len)
+	    == -1) {
+	    error("%s: ncattinq of variable attribute failed in data mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (atts[ia].type != tmp.type || atts[ia].len != tmp.len) {
+	    error("%s: VARIABLE ncattinq got bad type or len in data mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	/* allocate space to hold the attribute value to be retrieved */
+	tmp.val = emalloc(atts[ia].len * nctypelen(atts[ia].type));
+	if (ncattget(cdfid, ww_id, atts[ia+1].name, tmp.val) == -1) {
+	    error("%s: ncattget of variable attribute failed in data mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (val_cmp(tmp.type, tmp.len, tmp.val, atts[ia].val) != 0) {
+	    error("%s: ncattget got bad values in data mode", pname);
+	    nerrs++;
+	}
+	Free ((char *)tmp.val);
+    }
+    /* try with bad variable handle, should fail */
+    if (ncattput(cdfid, test.nvars, atts[0].name, atts[0].type, atts[0].len,
+		  atts[0].val) != -1) {
+	error("%s: ncattput should fail with bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netcdf handle, should fail */
+    if (ncattput(cdfid, ww_id, atts[0].name, atts[0].type, atts[0].len,
+		  atts[0].val) != -1) {
+	error("%s: ncattput should fail with bad netcdf handle", pname);
+	ncclose(cdfid); return;
+    }
+    Free(tmp.name);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncattinq
+ *    check returned values of properly created attributes
+ *    try with nonexisting attribute, check error
+ *    try with bad variable handle, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncattinq(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncattinq";
+    int cdfid;			/* netcdf id */
+    int ia, id;			/* attribute number */
+    nc_type type;
+    int len;
+    int vv_id;			/* variable id */
+    static struct cdfvar vv =	/* new variable */
+      {"vv", NC_SHORT, 2, ___, 0};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* in data mode, check all attributes against test netcdf */
+    for (ia = 0; ia < test.natts; ia++) {
+	if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name,
+		      &type, &len) == -1) {
+	    error("%s: ncattinq failed", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	if (type != test.atts[ia].type) {
+	    error("%s: ncattinq returned wrong type", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	if (len != test.atts[ia].len) {
+	    error("%s: ncattinq returned wrong len", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+    }
+
+    /* enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add a variable */
+    vv.dims = (int *) emalloc(sizeof(int) * vv.ndims);
+    for (id = 0; id < vv.ndims; id++)
+      vv.dims[id] = id;		/* assumes vv.ndims <= test.ndims */
+    if ((vv_id = ncvardef(cdfid, vv.name, vv.type, vv.ndims, vv.dims))
+	== -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &vv);	/* keep in-memory netcdf in sync */
+
+    /* try with nonexisting attribute, should fail */
+    if (ncattinq(cdfid, vv_id, "nonesuch", &type, &len) != -1) {
+	error("%s: ncattinq should fail with nonexisting attribute", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with bad variable handle, should fail */
+    if (ncattinq(cdfid, test.nvars, test.atts[0].name, &type, &len) != -1) {
+	error("%s: ncattinq should fail with bad variable id", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode check all attributes against test netcdf */
+    for (ia = 0; ia < test.natts; ia++) {
+	if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name,
+		      &type, &len) == -1) {
+	    error("%s: ncattinq in define mode failed", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	if (type != test.atts[ia].type) {
+	    error("%s: ncattinq in define mode returned wrong type", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	if (len != test.atts[ia].len) {
+	    error("%s: ncattinq in define mode returned wrong len", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    if (ncattinq(cdfid, NC_GLOBAL, test.atts[0].name, &type, &len) != -1) {
+	error("%s: ncattinq should fail with bad cdfid", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncattget
+ *    check that NC_GLOBAL variable id works
+ *    check in both modes
+ *    check that proper call worked after ncattput
+ *    try with bad variable handle, check error
+ *    try with nonexisting attribute, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncattget(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    int cdfid;			/* netcdf id */
+    int ia, id;
+    static struct cdfatt tmp;	/* attribute */
+    int uu_id;			/* variable id */
+    static struct cdfvar uu =	/* variable */
+      {"uu", NC_LONG, 2, ___, 0};
+    static nclong uumax = 1000;	/* attribute value */
+    static struct cdfatt vmax = /* attribute */
+	{___, "valid_max", NC_LONG, 1, (void *) &uumax};
+
+    static char pname[] = "test_ncattget";
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* add a variable */
+    uu.dims = (int *) emalloc(sizeof(int) * uu.ndims);
+    for (id = 0; id < uu.ndims; id++)
+      uu.dims[id] = id;
+    if ((uu_id = ncvardef(cdfid,
+			   uu.name, uu.type, uu.ndims, uu.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &uu);	/* keep in-memory netcdf in sync */
+
+    /* add an attribute */
+    if (ncattput(cdfid, uu_id,
+		  vmax.name, vmax.type, vmax.len, vmax.val)
+	== -1) {
+	error("%s: ncattput of variable attribute failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, uu_id, &vmax); /* keep in-memory netcdf updated */
+
+    /* in define mode, check all attributes values against test netcdf */
+    for (ia = 0; ia < test.natts; ia++) {
+	if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name,
+		      &tmp.type, &tmp.len) == -1) {
+	    error("%s: ncattinq in define mode failed", pname);
+	    ncclose(cdfid); return;
+	}
+	if (tmp.type != test.atts[ia].type) {
+	    error("%s: ncattinq in define mode returned wrong type", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	if (tmp.len != test.atts[ia].len) {
+	    error("%s: ncattinq in define mode returned wrong len", pname);
+	    ncclose(cdfid); return;
+	}
+	/* allocate space to hold the attribute value to be retrieved */
+	tmp.val = emalloc(tmp.len * nctypelen(tmp.type));
+	if (ncattget(cdfid, test.atts[ia].var, test.atts[ia].name, tmp.val)
+	    == -1) {
+	    error("%s: ncattget of variable attribute failed in define mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (val_cmp(tmp.type, tmp.len, tmp.val, test.atts[ia].val) != 0) {
+	    error("%s: ncattget got bad values in define mode", pname);
+	    error("   cdfid=%d, varname=%s, attname=%s, type=%d, len=%d",
+		  cdfid, test.vars[test.atts[ia].var].name,
+		  test.atts[ia].name, test.atts[ia].type, test.atts[ia].len);
+	    (void)fprintf(stderr,"should have got:");
+	    val_out(test.atts[ia].type, test.atts[ia].len,
+			   test.atts[ia].val);
+	    (void)fprintf(stderr,"    instead got:");
+	    val_out(tmp.type, tmp.len, tmp.val);
+	    nerrs++;
+	}
+	Free ((char *)tmp.val);
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+
+    /* in data mode, check all attributes values against test netcdf */
+    for (ia = 0; ia < test.natts; ia++) {
+	if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name,
+		      &tmp.type, &tmp.len) == -1) {
+	    error("%s: ncattinq failed", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	if (tmp.type != test.atts[ia].type) {
+	    error("%s: ncattinq returned wrong type", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	if (tmp.len != test.atts[ia].len) {
+	    error("%s: ncattinq returned wrong len", pname);
+	    ncclose(cdfid);
+	    return;
+	}
+	/* allocate space to hold the attribute value to be retrieved */
+	tmp.val = emalloc(tmp.len * nctypelen(tmp.type));
+	if (ncattget(cdfid, test.atts[ia].var, test.atts[ia].name, tmp.val)
+	    == -1) {
+	    error("%s: ncattget of variable attribute failed in data mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (val_cmp(tmp.type, tmp.len, tmp.val, test.atts[ia].val) != 0) {
+	    error("%s: ncattget got bad values in data mode", pname);
+	    error("   cdfid=%d, varname=%s, attname=%s, type=%d, len=%d",
+		  cdfid, test.vars[test.atts[ia].var].name,
+		  test.atts[ia].name, test.atts[ia].type, test.atts[ia].len);
+	    (void)fprintf(stderr,"should have got:");
+	    val_out(test.atts[ia].type, test.atts[ia].len,
+			   test.atts[ia].val);
+	    (void)fprintf(stderr,"    instead got:");
+	    val_out(tmp.type, tmp.len, tmp.val);
+	    nerrs++;
+	}
+	Free ((char *)tmp.val);
+    }
+    /* try with bad variable handle, should fail */
+    if (ncattget(cdfid, test.nvars, vmax.name, vmax.val) != -1) {
+	error("%s: ncattget should fail with bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    /* try getting non-existent attribute, should fail */
+    if (ncattget(cdfid, uu_id, "nonesuch", vmax.val) != -1) {
+	error("%s: ncattget should fail with nonexistant attribute", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netcdf handle, should fail */
+    if (ncattget(cdfid, uu_id, vmax.name, vmax.val) != -1) {
+	error("%s: ncattput should fail with bad netcdf handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncattcopy
+ *    check that NC_GLOBAL variable for source or target works
+ *    check that new attribute put works with target in define mode
+ *    check that old attribute put works with target in data mode
+ *    check that changing type and length of an attribute work OK
+ *    try with same cdfid for source and target, different variables
+ *    try with same cdfid for source and target, same variable
+ *    try with nonexisting attribute, check error
+ *    try with bad source or target netCDF handles, check error
+ *    try with bad source or target variable handle, check error
+ */
+void
+test_ncattcopy(path1, path2)
+     char *path1;		/* name of input netcdf file to open */
+     char *path2;		/* name of output netcdf file to create */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncattcopy";
+    int cdfid, cdfid2;		/* netcdf id */
+    int id;			/* dimension id */
+    int tt_id;			/* variable id */
+    static struct cdfvar tt =	/* new variable for source netcdf */
+      {"tt", NC_LONG, 1, ___, 0};
+    int tu_id, tu2_id;		/* variable ids */
+    static struct cdfvar tu =	/* new variable for target netcdf */
+      {"tu", NC_DOUBLE, 2, ___, 0};
+    static double double_vals[] = {-1., -2.};
+    static float float_vals[] = {-1., -2.};
+    static struct cdfatt att = 	/* attribute */
+ 	{___, "att", NC_DOUBLE, LEN_OF(double_vals), (void *) double_vals};
+    static struct cdfatt att2 =	/* attribute */
+ 	{___, "att", NC_FLOAT, LEN_OF(float_vals), (void *) float_vals};
+    static struct cdfatt tmp; 	/* attribute */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path1, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened OK, enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed on source", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add a global attribute, a variable and an attribute */
+    if (ncattput(cdfid, NC_GLOBAL, att.name, att.type, att.len, att.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, NC_GLOBAL, &att); /* keep in-memory netcdf consistent */
+    tt.dims = (int *) emalloc(sizeof(int) * tt.ndims);
+    for (id=0; id < tt.ndims; id++)
+      tt.dims[0] = id;
+    if ((tt_id=ncvardef(cdfid, tt.name, tt.type, tt.ndims, tt.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &tt);	/* keep in-memory netcdf consistent */
+    if (ncattput(cdfid, tt_id, att.name, att.type, att.len, att.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, tt_id, &att); /* keep in-memory netcdf consistent */
+
+    tu.dims = (int *) emalloc(sizeof(int) * tu.ndims);
+    for (id = 0; id < tu.ndims; id++)
+	tu.dims[id] = id;
+    if ((tu_id=ncvardef(cdfid, tu.name, tu.type, tu.ndims, tu.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &tu);	/* keep in-memory netcdf consistent */
+    if (ncattput(cdfid, tu_id, att.name, att.type, att.len, att.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, tu_id, &att); /* keep in-memory netcdf consistent */
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* first (source) netcdf is in data mode */
+    /* create second netCDF to copy attributes to */
+    if ((cdfid2 = nccreate(path2, NC_CLOBBER)) == -1) {
+	error("%s: nccreate failed", pname);
+	return;
+    }
+    /* create dimensions and variable in second netcdf */
+    for (id = 0; id < tu.ndims; id++)	{ /* copy dimensions from source */
+	if ((tu.dims[id] =ncdimdef(cdfid2, test.dims[id].name,
+				    test.dims[id].size)) == -1) {
+	    error("%s: ncdimdef failed", pname);
+	    ncclose(cdfid); ncclose(cdfid2); return;
+	}
+    }
+    if ((tu2_id=ncvardef(cdfid2, tu.name, tu.type, tu.ndims, tu.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* try copying NC_GLOBAL attribute from source to target */
+    if (ncattcopy(cdfid, NC_GLOBAL, att.name, cdfid2, NC_GLOBAL) == -1) {
+	error("%s: ncattcopy on NC_GLOBAL attribute '%s' failed",
+	      pname, att.name);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* check that copy worked with ncattinq and ncattget */
+    if (ncattinq(cdfid2, NC_GLOBAL, att.name, &tmp.type, &tmp.len) == -1) {
+	error("%s: ncattinq of NC_GLOBAL attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (att.type != tmp.type || att.len != tmp.len) {
+	error("%s: NC_GLOBAL ncattinq got unexpected type or len", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* allocate space to hold the attribute value to be retrieved */
+    tmp.val = emalloc(att.len * nctypelen(att.type));
+    if (ncattget(cdfid2, NC_GLOBAL, att.name, tmp.val) == -1) {
+	error("%s: ncattget of variable attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (val_cmp(tmp.type, tmp.len, tmp.val, att.val) != 0) {
+	error("%s: ncattget got bad values after put of NC_GLOBAL attrs",
+	      pname);
+	nerrs++;
+    }
+    Free ((char *) tmp.val);
+    /* try copying variable attribute from source to target */
+    if (ncattcopy(cdfid, tt_id, att.name, cdfid2, tu2_id) == -1) {
+	error("%s: ncattcopy failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* check that copy worked with ncattinq and ncattget */
+    if (ncattinq(cdfid2, tu2_id, att.name, &tmp.type, &tmp.len) == -1) {
+	error("%s: ncattinq of variable attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (att.type != tmp.type || att.len != tmp.len) {
+	error("%s: variable ncattinq got unexpected type or len", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* allocate space to hold the attribute value to be retrieved */
+    tmp.val = emalloc(att.len * nctypelen(att.type));
+    if (ncattget(cdfid2, tu2_id, att.name, tmp.val) == -1) {
+	error("%s: ncattget of variable attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (val_cmp(tmp.type, tmp.len, tmp.val, att.val) != 0) {
+	error("%s: ncattget got bad values after copy of variable attrs",
+	      pname);
+	nerrs++;
+    }
+    Free ((char *) tmp.val);
+
+    /* 
+     * check that old attribute put works with target in data mode, 
+     * also checks that changing type and length of an attribute works OK
+     */
+    if (ncendef (cdfid2) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* change attribute to shorter attribute */
+    if (ncattput(cdfid, NC_GLOBAL, att2.name, att2.type, att2.len, att2.val)
+	== -1) {
+	error("%s: ncattput of shorter NC_GLOBAL attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    add_att(&test, NC_GLOBAL, &att2); /* keep in-memory netcdf consistent */
+    /* copy shorter attribute on existing attribute */
+    if (ncattcopy(cdfid, NC_GLOBAL, att2.name, cdfid2, tu2_id) == -1) {
+	error("%s: ncattcopy of shorter attribute on old attribute failed",
+	      pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* check that copy worked with ncattinq and ncattget */
+    if (ncattinq(cdfid2, tu2_id, att2.name, &tmp.type, &tmp.len) == -1) {
+	error("%s: ncattinq of variable attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (att2.type != tmp.type || att2.len != tmp.len) {
+	error("%s: variable ncattinq got unexpected type or len", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* allocate space to hold the attribute value to be retrieved */
+    tmp.val = emalloc(att2.len * nctypelen(att2.type));
+    if (ncattget(cdfid2, tu2_id, att2.name, tmp.val) == -1) {
+	error("%s: ncattget of variable attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (val_cmp(tmp.type, tmp.len, tmp.val, att2.val) != 0) {
+	error("%s: ncattget got bad values after copy of variable attrs",
+	      pname);
+	nerrs++;
+    }
+    Free ((char *) tmp.val);
+
+    /* try copying with same source and target netcdf, different variables */
+    /* copy shorter attribute on existing attribute */
+    if (ncattcopy(cdfid, NC_GLOBAL, att2.name, cdfid, tu_id) == -1) {
+	error("%s: ncattcopy of shorter NC_GLOBAL attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    add_att(&test, tu_id, &att2); /* keep in-memory netcdf consistent */
+    /* check that copy worked with ncattinq and ncattget */
+    if (ncattinq(cdfid, tu_id, att2.name, &tmp.type, &tmp.len) == -1) {
+	error("%s: ncattinq of variable attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (att2.type != tmp.type || att2.len != tmp.len) {
+	error("%s: variable ncattinq got unexpected type or len", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* allocate space to hold the attribute value to be retrieved */
+    tmp.val = emalloc(att2.len * nctypelen(att2.type));
+    if (ncattget(cdfid, tu_id, att2.name, tmp.val) == -1) {
+	error("%s: ncattget of variable attribute failed", pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (val_cmp(tmp.type, tmp.len, tmp.val, att2.val) != 0) {
+	error("%s: ncattget got bad values after copy of variable attrs",
+	      pname);
+	nerrs++;
+    }
+    Free ((char *) tmp.val);
+
+    /* try with same cdfid for source and target, same variable */
+    if (ncattcopy(cdfid, tu_id, att.name, cdfid, tu_id) == -1) {
+	error("%s: ncattcopy failed with identical source and target",
+	      pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* try with nonexisting attribute, check error */
+    if (ncattcopy(cdfid, tt_id, "nonesuch", cdfid, tu_id) != -1) {
+	error("%s: ncattcopy should fail with bad attribute name",
+	      pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    /* try with bad source or target variable handle, check error */
+    if (ncattcopy(cdfid, test.nvars, att.name, cdfid, tu_id) != -1) {
+	error("%s: ncattcopy should fail with bad source variable id",
+	      pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (ncattcopy(cdfid, tt_id, att.name, cdfid, 2) != -1) {
+	error("%s: ncattcopy should fail with bad target variable id",
+	      pname);
+	ncclose(cdfid); ncclose(cdfid2); return;
+    }
+    if (ncclose (cdfid2) == -1) {
+	error("%s: ncclose failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with bad source or target netCDF handles, check error */
+    if (ncattcopy(cdfid, tt_id, att.name, cdfid2, tu_id) != -1) {
+	error("%s: ncattcopy should fail with bad target netcdf id",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    if (ncattcopy(cdfid, tt_id, att.name, cdfid2, tu_id) != -1) {
+	error("%s: ncattcopy should fail with bad netcdf id", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncattname
+ *    check that NC_GLOBAL variable id works
+ *    check in both modes
+ *    check that proper call worked after ncattput
+ *    try with bad netCDF handle, check error
+ *    try with bad variable handle, check error
+ *    try with bad attribute number, check error
+ */
+void
+test_ncattname(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncattname";
+    int cdfid;			/* netcdf id */
+    struct cdfatt tmp;		/* attributes */
+    int ia, ib;			/* attribute numbers */
+    int iv;			/* variable id */
+    static short short_vals[] = {3, 4, 5};
+    static struct cdfatt att = 	/* attribute */
+ 	{___, ___, NC_SHORT, LEN_OF(short_vals), (void *) short_vals};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened OK, enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* for each NC_GLOBAL attribute, get name and compare with expected name */
+    att.name = (char *) emalloc(H4_MAX_NC_NAME);
+    ib = 0;
+    for (ia = 0; ia < test.ngatts; ia++) {
+	if (ncattname(cdfid, NC_GLOBAL, ia, att.name) == -1) {
+	    error("%s: ncattname failed on global attribute", pname);
+	    ncclose(cdfid); return;
+	}
+	/* find number of next global attribute */
+	while (ib < test.natts && test.atts[ib].var != NC_GLOBAL)
+	  ib++;
+	if (ib >= test.natts) {
+	    error("%s: test problem, expected global attribute not found",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (strcmp(att.name, test.atts[ib].name) != 0) {
+	    error("%s: NC_GLOBAL attribute name `%s' instead of expected `%s'",
+		  pname, att.name, test.atts[ib].name);
+	    nerrs++;
+	}
+	ib++;
+    }
+    /* for each variable attribute, get name and compare with expected name */
+    for (iv = 0; iv < test.nvars; iv++) {
+	ib = 0;
+	for (ia = 0; ia < test.vars[iv].natts; ia++) {
+	    if (ncattname(cdfid, iv, ia, att.name) == -1) {
+		error("%s: ncattname failed on variable attribute", pname);
+		ncclose(cdfid); return;
+	    }
+	    /* find number of next attribute */
+	    while (ib < test.natts && test.atts[ib].var != iv)
+	      ib++;
+	    if (ib >= test.natts) {
+		error("%s: problem  in test, expected attribute not found",
+		      pname);
+		ncclose(cdfid); return;
+	    }
+	    if (strcmp(att.name, test.atts[ib].name) != 0) {
+		error("%s: variable '%s' name `%s' instead of expected `%s'",
+		      pname, test.vars[iv].name, att.name, test.atts[ib].name);
+		nerrs++;
+	    }
+	    ib++;
+	}
+    }
+    /* in define mode, add a global attribute */
+    (void) strcpy(att.name,"attx");
+    if (ncattput(cdfid, NC_GLOBAL, att.name, att.type, att.len, att.val)
+	== -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, NC_GLOBAL, &att); /* keep in-memory netcdf consistent */
+    /* test that ncattname works immediately after ncattput */
+    tmp.name = (char *) emalloc(H4_MAX_NC_NAME);
+    if (ncattname(cdfid, NC_GLOBAL, test.ngatts-1, tmp.name) == -1) {
+	error("%s: ncattname failed on variable attribute", pname);
+	ncclose(cdfid); return;
+    }
+    if (strcmp(att.name, tmp.name) != 0) {
+	error("%s: immediate NC_GLOBAL name `%s' instead of expected `%s'",
+	      pname, tmp.name, att.name);
+	nerrs++;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode */
+    /* for each NC_GLOBAL attribute, get name and compare with expected name */
+    ib = 0;
+    for (ia = 0; ia < test.ngatts; ia++) {
+	if (ncattname(cdfid, NC_GLOBAL, ia, att.name) == -1) {
+	    error("%s: ncattname failed on global attribute", pname);
+	    ncclose(cdfid); return;
+	}
+	/* find number of next global attribute */
+	while (ib < test.natts && test.atts[ib].var != NC_GLOBAL)
+	  ib++;
+	if (ib >= test.natts) {
+	    error("%s: test problem, expected global attribute not found",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (strcmp(att.name, test.atts[ib].name) != 0) {
+	    error("%s: NC_GLOBAL attribute name `%s' instead of expected `%s'",
+		  pname, att.name, test.atts[ib].name);
+	    nerrs++;
+	}
+	ib++;
+    }
+    /* for each variable attribute, get name and compare with expected name */
+    for (iv = 0; iv < test.nvars; iv++) {
+	ib = 0;
+	for (ia = 0; ia < test.vars[iv].natts; ia++) {
+	    if (ncattname(cdfid, iv, ia, att.name) == -1) {
+		error("%s: ncattname failed on variable attribute", pname);
+		ncclose(cdfid); return;
+	    }
+	    /* find number of next attribute */
+	    while (ib < test.natts && test.atts[ib].var != iv)
+	      ib++;
+	    if (ib >= test.natts) {
+		error("%s: problem  in test, expected attribute not found",
+		      pname);
+		ncclose(cdfid); return;
+	    }
+	    if (strcmp(att.name, test.atts[ib].name) != 0) {
+		error("%s: variable '%s' name `%s' instead of expected `%s'",
+		      pname, test.vars[iv].name, att.name, test.atts[ib].name);
+		nerrs++;
+	    }
+	    ib++;
+	}
+    }
+    /* try with bad variable handle, check error */
+    if (ncattname(cdfid, test.nvars, 0, att.name) != -1) {
+	error("%s: ncattname should fail with bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with bad attribute number, check error */
+    if (ncattname(cdfid, NC_GLOBAL, -1, att.name) != -1) {
+	error("%s: ncattname should fail with negative number", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncattname(cdfid, NC_GLOBAL, test.ngatts, att.name) != -1) {
+	error("%s: ncattname should fail with too-high number", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	nerrs++;
+	return;
+    }
+    /* try with bad netCDF handle, check error */
+    if (ncattname(cdfid, NC_GLOBAL, 0, att.name) != -1) {
+	error("%s: ncattname shoul fail with bad cdfid", pname);
+	nerrs++;
+    }
+    Free (tmp.name);
+    Free (att.name);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncattrename
+ *    check that proper rename worked with ncattinq, ncattget
+ *    try renaming to existing attribute name, check error
+ *    try with nonexisting attribute, check error
+ *    try with bad variable handle, check error
+ *    try in data mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncattrename(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncattrename";
+    int cdfid;			/* netcdf id */
+    static char newname[] = "shorter";
+    static char longername[] = "longer_name";
+    struct cdfatt tmp;		/* attributes */
+    static short short_vals[] = {3, 4, 5};
+    static struct cdfatt atty =	/* attribute */
+ 	{___, "long_name", NC_SHORT, LEN_OF(short_vals), (void *) short_vals};
+    static struct cdfatt attz =	/* attribute */
+ 	{___, "arggh", NC_SHORT, LEN_OF(short_vals), (void *) short_vals};
+    int ynum;			/* attribute number */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened OK, enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add two attributes */
+    if (ncattput(cdfid, NC_GLOBAL, atty.name, atty.type, atty.len,
+		  atty.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, NC_GLOBAL, &atty); /* keep in-memory netcdf in sync */
+    ynum = test.natts-1;	/* number of attribute just put */
+    if (ncattput(cdfid, NC_GLOBAL, attz.name, attz.type, attz.len,
+		  attz.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, NC_GLOBAL, &attz); /* keep in-memory netcdf in sync */
+
+    /* rename first attribute to shorter name */
+    if (ncattrename(cdfid, NC_GLOBAL, atty.name, newname) == -1) {
+	error("%s: ncattrename failed", pname);
+	ncclose(cdfid); return;
+    }
+    (void) strcpy(test.atts[ynum].name, newname); /* keep test consistent */
+    /* check new name with ncattinq */
+    if (ncattinq(cdfid, NC_GLOBAL, newname, &tmp.type, &tmp.len) == -1) {
+	error("%s: ncattinq of renamed attribute failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (atty.type != tmp.type || atty.len != tmp.len) {
+	error("%s: NC_GLOBAL ncattinq got unexpected type or len", pname);
+	ncclose(cdfid); return;
+    }
+    /* allocate space to hold the attribute value to be retrieved */
+    tmp.val = emalloc(atty.len * nctypelen(atty.type));
+    if (ncattget(cdfid, NC_GLOBAL, newname, tmp.val) == -1) {
+	error("%s: ncattget of variable attribute failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (val_cmp(tmp.type, tmp.len, tmp.val, atty.val) != 0) {
+	error("%s: ncattget got bad values after rename attrs", pname);
+	nerrs++;
+    }
+    if (ncattinq(cdfid, NC_GLOBAL, atty.name, &tmp.type, &tmp.len) != -1) {
+	error("%s: ncattrename left attribute with old name", pname);
+	ncclose(cdfid); return;
+    }
+    /* try to rename second attribute same as first, should fail */
+    if (ncattrename(cdfid, NC_GLOBAL, attz.name, newname) != -1) {
+	error("%s: ncattrename should have failed with used name", pname);
+	ncclose(cdfid); return;
+    }
+    /* try to rename second attribute with a longer name */
+    if (ncattrename(cdfid, NC_GLOBAL, attz.name, longername) == -1) {
+	error("%s: ncattrename failed with longer name", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with bad variable handle, check for failure */
+    if (ncattrename(cdfid, test.nvars, newname, atty.name) != -1) {
+	error("%s: ncattrename should have failed on bad variable id", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with bad attribute name, check for failure */
+    if (ncattrename(cdfid, NC_GLOBAL, "nonesuch", newname) != -1) {
+	error("%s: ncattrename should have failed on bad attribute name",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode change name to even shorter and check value */
+    if (ncattrename(cdfid, NC_GLOBAL, newname, "short") == -1) {
+	error("%s: ncattrename to shorter name failed in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncattrename(cdfid, NC_GLOBAL, "short", "plugh") == -1) {
+	error("%s: ncattrename to same length failed in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncattget(cdfid, NC_GLOBAL, "plugh", tmp.val) == -1) {
+	error("%s: ncgetatt of renamed attribute failed in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    if (val_cmp(tmp.type, tmp.len, tmp.val, atty.val) != 0) {
+	error("%s: ncattget got bad values after data mode rename", pname);
+	nerrs++;
+    }
+    Free ((char *) tmp.val);
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* should fail, since bad handle */
+    if (ncattrename(cdfid, NC_GLOBAL, newname, atty.name) != -1) {
+	error("%s: ncattrename should fail with bad cdfid", pname);
+	ncclose(cdfid); return;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncattdel
+ *    check that proper delete worked	
+ *    try with bad netCDF handle, check error
+ *    try with bad variable handle, check error
+ *    try with nonexisting attribute, check error
+ *    try in data mode, check error
+ */
+void
+test_ncattdel(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncattdel";
+    int cdfid;			/* netcdf id */
+    static short short_vals[] = {-1, -2, -3 };
+    static struct cdfatt yaa =	/* attribute */
+ 	{___, "yet_another_attribute", NC_SHORT, LEN_OF(short_vals),
+	   (void *) short_vals};
+    int id;			/* dimension id */
+    int yav_id;			/* variable id */
+    static struct cdfvar yav =	/* new variable for target netcdf */
+      {"yet_another_variable", NC_DOUBLE, 2, ___, 0};
+    struct cdfvar vtmp;		/* variable */
+    struct cdfatt atmp;		/* attribute */
+    int ndims;			/* number of dimensions */
+    int nvars;			/* number of variables */
+    int ngatts1, ngatts2;	/* number of global attributes */
+    int natts;			/* number of variable attributes */
+    int xdimid;			/* id of unlimited dimension */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened OK, enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add global attribute, variable, variable attribute */
+    if (ncattput(cdfid, NC_GLOBAL, yaa.name, yaa.type, yaa.len, yaa.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, NC_GLOBAL, &yaa); /* keep in-memory netcdf in sync */
+    yav.dims = (int *) emalloc(sizeof(int) * yav.ndims);
+    for (id = 0; id < yav.ndims; id++)
+	yav.dims[id] = id;
+    if ((yav_id=ncvardef(cdfid, yav.name, yav.type, yav.ndims, yav.dims))
+	== -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &yav);	/* keep in-memory netcdf consistent */
+    if (ncattput(cdfid, yav_id, yaa.name, yaa.type, yaa.len, yaa.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, yav_id, &yaa); /* keep in-memory netcdf consistent */
+
+    /* get number of global attributes, number of attributes for variable */
+    if (ncinquire(cdfid, &ndims, &nvars, &ngatts1, &xdimid) == -1) {
+	error("%s: ncinquire in data mode failed", pname);
+	ncclose(cdfid); return;
+    }
+    vtmp.dims = (int *) emalloc(sizeof(int) * H4_MAX_VAR_DIMS);
+    vtmp.name = (char *) emalloc(H4_MAX_NC_NAME);
+    if (ncvarinq(cdfid, yav_id, vtmp.name, &vtmp.type, &vtmp.ndims, vtmp.dims,
+		  &natts) == -1) {
+	error("%s: ncvarinq failed", pname);
+	ncclose(cdfid); return;
+    }    
+
+    /* delete global attribute and check that it's gone */
+    if (ncattdel(cdfid, NC_GLOBAL, yaa.name) == -1) {
+	error("%s: ncattdel failed", pname);
+	ncclose(cdfid); return;
+    }
+    del_att(&test, NC_GLOBAL, &yaa); /* keep in-memory netcdf consistent */
+    if (ncinquire(cdfid, &ndims, &nvars, &ngatts2, &xdimid) == -1) {
+	error("%s: ncinquire failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ngatts2 != ngatts1 - 1) {
+	error("%s: NC_GLOBAL attribute deleted, but ngatts did not decrement",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncattinq(cdfid, NC_GLOBAL, yaa.name, &atmp.type, &atmp.len) != -1) {
+	error("%s: ncattinq on deleted NC_GLOBAL attribute should fail", pname);
+	ncclose(cdfid); return;
+    }
+
+    /* delete variable attribute and check that it's gone */
+    if (ncattdel(cdfid, yav_id, yaa.name) == -1) {
+	error("%s: ncattdel failed", pname);
+	ncclose(cdfid); return;
+    }
+    del_att(&test, yav_id, &yaa); /* keep in-memory netcdf consistent */
+    if (ncvarinq(cdfid, yav_id, vtmp.name, &vtmp.type, &vtmp.ndims,
+		  vtmp.dims, &vtmp.natts) == -1) {
+	error("%s: ncvarinq failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (vtmp.natts != natts - 1) {
+	error("%s: NC_GLOBAL attribute deleted, but ngatts did not decrement",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncattinq(cdfid, yav_id, yaa.name, &atmp.type, &atmp.len) != -1) {
+	error("%s: ncattinq on deleted variable attribute should fail",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    /* re-add global attribute, variable, variable attribute */
+    if (ncattput(cdfid, NC_GLOBAL, yaa.name, yaa.type, yaa.len, yaa.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, NC_GLOBAL, &yaa); /* keep in-memory netcdf in sync */
+    if (ncattput(cdfid, yav_id, yaa.name, yaa.type, yaa.len, yaa.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, yav_id, &yaa); /* keep in-memory netcdf consistent */
+    /* try on nonexistent attribute, should fail */
+    if (ncattdel(cdfid, yav_id, "nonesuch") != -1) {
+	error("%s: ncattdel should fail on bogus attribute", pname);
+	ncclose(cdfid); return;
+    }
+    /* try on bad variable id, should fail */
+    if (ncattdel(cdfid, test.nvars, yaa.name) != -1) {
+	error("%s: ncattdel should fail on bad variable id", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode, should fail */
+    if (ncattdel(cdfid, NC_GLOBAL, yaa.name) != -1) {
+	error("%s: ncattdel in data mode should fail", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try on bad netcdf handle, should fail */
+    if (ncattdel(cdfid, yav_id, yaa.name) != -1) {
+	error("%s: ncattdel should fail on bad netcdf id", pname);
+	nerrs++;
+    }
+    Free((char *)vtmp.dims);
+    Free(vtmp.name);
+    Free((char *)yav.dims);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/cdftests.c b/mfhdf/nctest/cdftests.c
new file mode 100644
index 0000000..1053393
--- /dev/null
+++ b/mfhdf/nctest/cdftests.c
@@ -0,0 +1,784 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: cdftests.c 6036 2014-01-20 17:28:01Z acheng $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+#include "testcdf.h"		/* defines in-memory test netcdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define LEN_OF(array) ((sizeof array) / (sizeof array[0]))
+
+
+/*
+ * Test nccreate
+ *    create a netcdf with no data, close it, test that it can be opened
+ *    try again with NC_CLOBBER mode, check that no errors occurred
+ *    try again with NC_NOCLOBBER mode, check error return
+ * On exit, netcdf files are closed.
+ * Uses: nccreate, ncendef, ncclose, ncopen.
+ */
+void
+test_nccreate(path)
+     char *path;		/* name of cdf file to create */
+{
+    int nerrs = 0;
+    static char pname[] = "test_nccreate";
+    int cdfid;
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = nccreate(path, NC_CLOBBER)) == -1) {
+	error("%s: nccreate failed to NC_CLOBBER", pname);
+	return;
+    }
+    /* created OK */
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	nerrs++;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	nerrs++;
+    }
+    if ((cdfid = ncopen(path, NC_NOWRITE)) == -1) {
+	error("%s: ncopen of newly created netcdf failed", pname);
+	return;
+    }
+    /* opened OK */
+    if (ncclose (cdfid) == -1) {
+	error("%s: second ncclose failed", pname);
+	nerrs++;
+    }
+    /* this call should fail, since we're using NC_NOCLOBBER mode */
+    if ((cdfid = nccreate(path, NC_NOCLOBBER)) != -1) {
+	error("%s: nccreate failed to honor NC_NOCLOBBER mode", pname);
+	nerrs++;
+    }
+
+    /* Initialize in-memory netcdf to empty */
+    add_reset(&test);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/* 
+ * Test ncopen
+ *    try to open a non-existent netCDF, check error return
+ *    open a netCDF with NC_WRITE mode, write something, close it
+ *    open a netCDF with NC_NOWRITE mode, write something and check error
+ *    try to open a netcdf twice, check whether returned cdf ids different
+ * On exit, netcdf files are closed.
+ * Uses: ncopen, ncredef, ncattput, ncendef, ncclose.
+ */
+void
+test_ncopen(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncopen";
+    int cdfid0, cdfid1;
+    static char title_val[] = "test netcdf";
+    static char xpath[] = "tooth-fairy.cdf"; /* must not exist */
+    static struct cdfatt title = /* attribute */
+      {NC_GLOBAL, "title", NC_CHAR, LEN_OF (title_val), (void *) title_val};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if((cdfid0 = ncopen(xpath, NC_NOWRITE)) != -1) {
+	error("%s: ncopen should fail opening nonexistent file",
+	      pname);
+	return;
+    }
+    if((cdfid0 = ncopen(xpath, NC_WRITE)) != -1) {
+	error("%s: ncopen should fail writing nonexistent file",
+	      pname);
+	return;
+    }
+    if ((cdfid0 = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed with NC_WRITE mode", pname);
+	return;
+    }
+    /* opened */
+    if (ncredef(cdfid0) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid0); return;
+    }
+    /* in define mode */
+    if (ncattput(cdfid0, NC_GLOBAL, "title", NC_CHAR, title.len, title.val)
+	== -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid0); return;
+    }
+    add_att(&test, NC_GLOBAL, &title); /* keep in-memory netcdf updated */
+    if (ncendef (cdfid0) == -1) {
+	error("%s: ncendef failed after ncattput", pname);
+	ncclose(cdfid0); return;
+    }
+    if (ncclose (cdfid0) == -1) {
+	error("%s: ncclose failed in NC_WRITE mode", pname);
+	return;
+    }
+
+    if ((cdfid0 = ncopen(path, NC_NOWRITE)) == -1) {
+	error("%s: ncopen failed with NC_NOWRITE mode", pname);
+	return;
+    }
+    /* opened */
+    /* this should fail, since in NC_NOWRITE mode */
+    if (ncredef(cdfid0) != -1) {
+	error("%s: cdredef should fail after NC_NOWRITE open", pname);
+	ncclose(cdfid0); return;
+    }
+
+    if ((cdfid1 = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: second ncopen failed", pname);
+	nerrs++;
+    }
+    else
+    {
+	    /* second open OK */
+	    if (cdfid0 == cdfid1) {
+		error("%s: ncopen should return new cdfid on second open",
+		      pname);
+		nerrs++;
+	    }
+	    if (ncclose (cdfid1) == -1) {
+		error("%s: ncclose failed to close after second open", pname);
+		nerrs++;
+	    }
+    }
+
+    if (ncclose (cdfid0) == -1) {
+	error("%s: ncclose failed in NC_NOWRITE mode", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncredef
+ *    open a netCDF, enter define mode, add dimension, variable, attribute
+ *    try ncredef from within define mode, check error
+ *    leave define mode and close, releasing netcdf handle
+ *    try ncredef with old handle, check error
+ * On exit netcdf files are closed.
+ * Uses: ncopen, ncredef, ncdimdef, ncvardef, ncattput, ncclose 
+ */
+void
+test_ncredef(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncredef";
+    int cdfid;			/* netcdf id */
+    int ii_dim;			/* dimension id */
+    static struct cdfdim ii =	/* dimension */
+      {"ii", 4};
+    int aa_id;			/* variable id */
+    static struct cdfvar aa =	/* variable */
+      {"aa", NC_LONG, 1, ___, 0};
+    static char units_val[] = "furlongs";
+    static struct cdfatt aa_units = /* attribute */
+      {___, "units", NC_CHAR, LEN_OF(units_val), (void *)units_val};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened OK, enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode OK, add a dimension */
+    if ((ii_dim = ncdimdef(cdfid, ii.name, ii.size)) == -1) {
+	error("%s: ncdimdef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_dim(&test, &ii);	/* keep in-memory netcdf in sync */
+
+    /* dimension added OK, add a variable */
+    aa.dims = (int *)emalloc(sizeof(int) * aa.ndims);
+    aa.dims[0] = ii_dim;
+    if ((aa_id = ncvardef(cdfid, aa.name, aa.type,
+			   aa.ndims, aa.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &aa);	/* keep in-memory netcdf in sync */
+
+    /* variable added OK, add a variable attribute */
+    aa_units.var = aa_id;
+    if (ncattput(cdfid, aa_units.var, aa_units.name,
+		  aa_units.type, aa_units.len, (void *) aa_units.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, aa_id, &aa_units); /* keep in-memory netcdf in sync */
+
+    if (ncredef(cdfid) != -1) {
+	error("%s: cdredef in define mode should have failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    if (ncredef(cdfid) != -1) {
+	error("%s: ncredef failed to report bad cdf handle", pname);
+	nerrs++;
+    }
+    Free ((char *)aa.dims);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/* 
+ * Test ncendef
+ *    check return from proper cdfendif after define mode
+ *    try ncendef when in data mode, check error
+ *    try ncendef with bad handle, check error
+ *  On exit netcdf files are closed.
+ * Uses: ncopen, ncredef, ncdimdef, ncvardef, ncattput, ncendef, ncclose
+ */
+void
+test_ncendef(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncendef";
+    int cdfid;			/* netcdf id */
+    int jj_dim, kk_dim;		/* dimension ids */
+    int bb_id;			/* variable id */
+    static struct cdfdim kk =	/* dimension */
+      {"kk", 3};
+    static struct cdfdim jj =	/* dimension */
+      {"jj", 3};
+    static struct cdfvar bb =	/* variable */
+      {"bb", NC_LONG, 2, ___, 0};
+    static float bb_rangev[2] = {0., 100.}; /* attribute vector */
+    static struct cdfatt bb_range = /* attribute */
+      {___, "valid_range", NC_FLOAT, LEN_OF(bb_rangev), (void *)bb_rangev};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened */
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add dimensions */
+    if ((jj_dim = ncdimdef(cdfid, jj.name, jj.size)) == -1 ||
+	(kk_dim = ncdimdef(cdfid, kk.name, kk.size)) == -1) {
+	error("%s: ncdimdef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_dim(&test, &jj);	/* keep in-memory netcdf in sync */
+    add_dim(&test, &kk);	/* keep in-memory netcdf in sync */
+    
+    /* dimensions added OK, add a variable */
+    bb.dims = (int *) emalloc(sizeof(int) * bb.ndims);
+    bb.dims[0] = kk_dim;
+    bb.dims[1] = jj_dim;
+    if ((bb_id = ncvardef(cdfid, bb.name, bb.type,
+			   bb.ndims, bb.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &bb);	/* keep in-memory netcdf in sync */
+    
+    /* variable added OK, add a variable attribute */
+    if (ncattput(cdfid, bb_id, bb_range.name, bb_range.type, bb_range.len,
+		  (void *) bb_range.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_att(&test, bb_id, &bb_range); /* keep in-memory netcdf in sync */
+    
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode */
+    if (ncendef (cdfid) != -1) { /* should fail in data mode */
+	error("%s: ncendef in data mode should have failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* should fail on a bad handle */
+    if (ncendef (cdfid) != -1) {
+	error("ncendef failed to report bad netcdf handle");
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/* 
+ * Test ncclose
+ *    try on open netCDF
+ *    try in define mode and data mode
+ *    try with bad handle, check error
+ *  On exit netcdf files are closed.
+ */
+void
+test_ncclose(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncclose";
+    int cdfid;			/* netcdf id */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened */
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode */
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose in define mode failed", pname);
+	nerrs++;
+    }
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* in data mode */
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	nerrs++;
+    }
+    if (ncclose (cdfid) != -1) { /* should fail, since cdfid is a bad handle */
+	error("%s: ncclose failed to report bad cdf handle ", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/* 
+ * Test ncinquire
+ *    try in data mode, check returned values
+ *    try in define mode, after adding an unlimited dimension, variable
+ *    try with bad handle, check error
+ *  On exit netcdf files are closed.
+ */
+void
+test_ncinquire(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncinquire";
+    int cdfid;			/* netcdf id */
+    int ndims;			/* number of dimensions */
+    int nvars;			/* number of variables */
+    int ngatts;			/* number of global attributes */
+    int xdimid;			/* id of unlimited dimension */
+    int rec_dim;		/* dimension id */
+    static struct cdfdim rec =	/* dimension */
+      {"rec", NC_UNLIMITED};
+    static struct cdfdim dims[] = { /* dimensions */
+	{"i1", 5},{"i2", 3},{"i3", 7}
+    };
+    int id, nd = LEN_OF(dims);	/* number of dimensions */
+    int dimids[LEN_OF(dims)];
+    int cc_id;			/* variable id */
+    static struct cdfvar cc[] =	{ /* record variables of various sizes */
+	{"cc", NC_LONG, 1, ___, 0},
+	{"cd", NC_SHORT, 2, ___, 0},
+	{"ce", NC_FLOAT, 3, ___, 0}
+    };
+    int iv;
+    int nv = LEN_OF(cc);	/* number of record variables */
+    static char units_val[] = "moles";
+    static struct cdfatt cc_units = /* attribute */
+      {___, "units", NC_CHAR, LEN_OF(units_val), (void *)units_val};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened, in data mode */
+    if (ncinquire(cdfid, &ndims, &nvars, &ngatts, &xdimid) == -1) {
+	error("%s: ncinquire in data mode failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* compare returned with expected values */
+    if (ndims != test.ndims) {
+	error("%s: ndims returned as %d, expected %d",
+	    pname, ndims, test.ndims);
+	nerrs++;
+    }
+    if (nvars != test.nvars) {
+	error("%s: nvars returned as %d, expected %d",
+	    pname, nvars, test.nvars);
+	nerrs++;
+    }
+    if (ngatts != test.ngatts) {
+	error("%s: ngatts returned as %d, expected %d",
+	    pname, ngatts, test.ngatts);
+	nerrs++;
+    }
+    if (xdimid != test.xdimid) {
+	error("%s: xdimid returned as %d, expected %d",
+	    pname, xdimid, test.xdimid);
+	nerrs++;
+    }
+
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* add dimensions */
+    for (id = 0; id < nd; id++) {
+	if ((dimids[id] = ncdimdef(cdfid, dims[id].name, dims[id].size))
+	    == -1) {
+	    error("%s: ncdimdef failed on normal dimension", pname);
+	    ncclose(cdfid); return;
+	}
+	add_dim(&test, &dims[id]);
+    }
+
+    /* add an unlimited dimension */
+    if ((rec_dim = ncdimdef(cdfid, rec.name, rec.size)) == -1) {
+	error("%s: ncdimdef failed on NC_UNLIMITED dimension", pname);
+	ncclose(cdfid); return;
+    }
+    add_dim(&test, &rec);
+
+    /* add some record variables */
+    for (iv = 0; iv < nv; iv++) {
+	cc[iv].dims = (int *) emalloc(sizeof(int) * cc[iv].ndims);
+	cc[iv].dims[0] = rec_dim; /* first dimension unlimited */
+	for (id = 1; id < cc[iv].ndims; id++)
+	  cc[iv].dims[id] = dimids[id];
+	if ((cc_id = ncvardef(cdfid, cc[iv].name, cc[iv].type,
+			       cc[iv].ndims, cc[iv].dims)) == -1) {
+	    error("%s: ncvardef failed", pname);
+	    ncclose(cdfid); return;
+	}
+	add_var(&test, &cc[iv]);
+
+	/* add a variable attribute */
+	if (ncattput(cdfid, cc_id, cc_units.name, cc_units.type,
+		      cc_units.len, (void *) cc_units.val) == -1) {
+	    error("%s: ncattput failed", pname);
+	    ncclose(cdfid); return;
+	}
+	add_att(&test, cc_id, &cc_units);
+    }
+    /* try calling from define mode, compare returned values to expected */
+    if (ncinquire(cdfid, &ndims, &nvars, &ngatts, &xdimid) == -1) {
+	error("%s: ncinquire in define mode failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* compare returned with expected values */
+    if (ndims != test.ndims) {
+	error("%s: ndims returned as %d, expected %d",
+	    pname, ndims, test.ndims);
+	nerrs++;
+    }
+    if (nvars != test.nvars) {
+	error("%s: nvars returned as %d, expected %d",
+	    pname, nvars, test.nvars);
+	nerrs++;
+    }
+    if (ngatts != test.ngatts) {
+	error("%s: ngatts returned as %d, expected %d",
+	    pname, ngatts, test.ngatts);
+	nerrs++;
+    }
+    if (xdimid != test.xdimid) {
+	error("%s: xdimid returned as %d, expected %d",
+	    pname, xdimid, test.xdimid);
+	nerrs++;
+    }
+
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* should fail, since bad handle */
+    if (ncinquire (cdfid, &ndims, &nvars, &ngatts, &xdimid) != -1) {
+	error("%s: ncinquire failed to report bad netcdf handle ", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncsync
+ *    try in define mode, check error
+ *    try writing with one handle, reading with another on same netCDF
+ *    try with bad handle, check error
+ *  On exit netcdf files are closed.
+ */
+void
+test_ncsync(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncsync";
+    int cdfid0, cdfid1;		/* netcdf ids */
+    int ll_dim;			/* dimension id */
+    static struct cdfdim ll =	/* dimension */
+      {"ll", 3};
+    int dd_id;			/* variable id */
+    static struct cdfvar dd =	/* variable */
+      {"dd", NC_SHORT, 1, ___, 0};
+    static short dd_fill_valv[] = {-999};
+    static struct cdfatt dd_fill_val = /* attribute */
+      {___, "fill_value", NC_SHORT, LEN_OF(dd_fill_valv), (void *) dd_fill_valv};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if ((cdfid0 = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen in NC_WRITE mode failed", pname);
+	return;
+    }
+
+    /* opened */
+    if (ncredef(cdfid0) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid0); return;
+    }
+    /* in define mode, add a dimension, variable, and attribute */
+    if ((ll_dim = ncdimdef(cdfid0, ll.name, ll.size)) == -1) {
+	error("%s: ncdimdef failed", pname);
+	ncclose(cdfid0);
+	return;
+    }
+    add_dim(&test, &ll);
+
+    dd.dims = (int *) emalloc(sizeof(int) * dd.ndims);
+    dd.dims[0] = ll_dim;
+    if ((dd_id=ncvardef(cdfid0, dd.name, dd.type, dd.ndims, dd.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid0);
+	return;
+    }
+    add_var(&test, &dd);
+
+    if (ncattput(cdfid0, dd_id, dd_fill_val.name, dd_fill_val.type,
+		  dd_fill_val.len, (void *) dd_fill_val.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid0);
+	return;
+    }
+    add_att(&test, dd_id, &dd_fill_val);
+
+    if (ncsync (cdfid0) != -1) {
+	error("%s: ncsync in define mode should fail", pname);
+	nerrs++;
+    }
+
+    if (ncendef (cdfid0) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid0); return;
+    }
+    /* in data mode */
+    if (ncsync (cdfid0) == -1) {
+	error("%s: ncsync in data mode failed", pname);
+	nerrs++;
+    }
+
+    /* put some data into a variable */
+    {
+	static long dd_start[] = {0};
+	static long dd_edges[] = {2};
+	static short dd_vals[] = {1, 2};
+	short got_vals[2];
+
+	if (ncvarput(cdfid0,dd_id,dd_start,dd_edges,(void *)dd_vals) == -1) {
+	    error("%s: ncvarput failed", pname);
+	    ncclose(cdfid0);
+	    return;
+	}
+	add_data(&test,dd_id,dd_start,dd_edges); /* keep test in sync */
+	if (ncsync (cdfid0) == -1) {
+	    error("%s: ncsync after putting data failed", pname);
+	    nerrs++;
+	}
+
+	if ((cdfid1 = ncopen(path, NC_NOWRITE)) == -1) {
+	    error("%s: second ncopen failed", pname);
+	    nerrs++;
+	} else {
+		if (cdfid0 == cdfid1) {
+		    error("%s: second ncopen should return distinct handle",
+			  pname);
+		    nerrs++;
+		}	/* read data just put after a sync, should succeed */
+		if (ncvarget(cdfid1,dd_id,dd_start,dd_edges,(void *)got_vals)
+		    == -1) {
+		    error("%s: ncvarget failed", pname);
+		    nerrs++;
+		}
+		if (dd_vals[0] != got_vals[0] || dd_vals[1] != got_vals[1]) {
+		    error("%s: ncvarget succeeded but data values wrong",
+			  pname);
+		}
+   		if (ncclose (cdfid1) == -1) {
+		    error("%s: ncclose failed", pname);
+		    nerrs++;
+		}
+	    }
+    }
+    if (ncclose (cdfid0) == -1) {
+	error("%s: ncclose failed", pname);
+	nerrs++;
+    }
+    if (ncsync (cdfid0) != -1) { /* should fail, since cdfid0 is bad handle */
+	error("%s: ncsync failed to report bad cdf handle ", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncabort
+ *    try in define mode, check that file was deleted
+ *    try after writing variable
+ *    try with bad handle, check error
+ *  On exit netcdf files are closed.
+ */
+void
+test_ncabort(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncabort";
+    static char fpath[] = "ufo.cdf";
+    static short attv[] = {3};
+    static struct cdfatt att = /* attribute */
+      {___, "temp", NC_SHORT, LEN_OF(attv), (void *) attv};
+    int cdfid;			/* netcdf id */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened */
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add a new global attribute */
+    if (ncattput(cdfid, NC_GLOBAL, att.name, att.type, att.len, att.val) == -1) {
+	error("%s: ncattput failed", pname);
+	ncclose(cdfid); return;
+    }
+
+    /* abort in define mode, should restore to state before define mode */
+    if (ncabort(cdfid) == -1) {
+	error("%s: ncabort in define mode failed", pname);
+	ncclose(cdfid); return;
+    }
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen after ncabort failed", pname);
+	return;
+    }
+    /* check that new global attribute was not added */
+    if (ncattinq(cdfid, NC_GLOBAL, att.name, &att.type, &att.len) != -1) {
+	error("%s: ncabort should have restored state before ncredef", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode not being created, should just close */
+    if (ncabort(cdfid) == -1) {
+	error("%s: ncabort in define mode failed", pname);
+	return;
+    }
+    if ((cdfid = nccreate(fpath, NC_CLOBBER)) == -1) {
+	error("%s: nccreate failed to NC_CLOBBER", pname);
+	return;
+    }
+    /* in define mode being created, should delete */
+    if (ncabort(cdfid) == -1) {
+	error("%s: ncabort after nccreate failed", pname);
+	return;
+    }
+    /* check with ncopen that file doesn't exist */
+    if (ncopen(fpath, NC_NOWRITE) != -1) {
+	error("%s: ncabort deleted file, but ncopen found it", pname);
+	return;
+    }
+    if (ncabort(cdfid) != -1) {	/* should fail, cdfid is bad handle */
+	error("%s: ncclose failed to report bad cdf handle ", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/depend b/mfhdf/nctest/depend
new file mode 100644
index 0000000..329fc49
--- /dev/null
+++ b/mfhdf/nctest/depend
@@ -0,0 +1,293 @@
+add.o: add.c
+add.o: ../../mfhdf/libsrc/netcdf.h
+add.o: ../../hdf/src//hlimits.h
+add.o: testcdf.h
+add.o: ../../hdf/src//hdf.h
+add.o: ../../hdf/src//hdfi.h
+add.o: ../../hdf/src//hntdefs.h
+add.o: ../../hdf/src//htags.h
+add.o: ../../hdf/src//hbitio.h
+add.o: ../../hdf/src//hcomp.h
+add.o: ../../hdf/src//herr.h
+add.o: ../../hdf/src//hproto.h
+add.o: add.h
+add.o: ../../mfhdf/libsrc/alloc.h
+add.o: emalloc.h
+atttests.o: atttests.c
+atttests.o: ../../mfhdf/libsrc/netcdf.h
+atttests.o: ../../hdf/src//hlimits.h
+atttests.o: testcdf.h
+atttests.o: ../../hdf/src//hdf.h
+atttests.o: ../../hdf/src//hdfi.h
+atttests.o: ../../hdf/src//hntdefs.h
+atttests.o: ../../hdf/src//htags.h
+atttests.o: ../../hdf/src//hbitio.h
+atttests.o: ../../hdf/src//hcomp.h
+atttests.o: ../../hdf/src//herr.h
+atttests.o: ../../hdf/src//hproto.h
+atttests.o: add.h
+atttests.o: error.h
+atttests.o: ../../mfhdf/libsrc/alloc.h
+atttests.o: emalloc.h
+atttests.o: tests.h
+atttests.o: val.h
+cdftests.o: cdftests.c
+cdftests.o: ../../mfhdf/libsrc/netcdf.h
+cdftests.o: ../../hdf/src//hlimits.h
+cdftests.o: testcdf.h
+cdftests.o: ../../hdf/src//hdf.h
+cdftests.o: ../../hdf/src//hdfi.h
+cdftests.o: ../../hdf/src//hntdefs.h
+cdftests.o: ../../hdf/src//htags.h
+cdftests.o: ../../hdf/src//hbitio.h
+cdftests.o: ../../hdf/src//hcomp.h
+cdftests.o: ../../hdf/src//herr.h
+cdftests.o: ../../hdf/src//hproto.h
+cdftests.o: add.h
+cdftests.o: error.h
+cdftests.o: tests.h
+cdftests.o: ../../mfhdf/libsrc/alloc.h
+cdftests.o: emalloc.h
+dimtests.o: dimtests.c
+dimtests.o: ../../mfhdf/libsrc/netcdf.h
+dimtests.o: ../../hdf/src//hlimits.h
+dimtests.o: testcdf.h
+dimtests.o: ../../hdf/src//hdf.h
+dimtests.o: ../../hdf/src//hdfi.h
+dimtests.o: ../../hdf/src//hntdefs.h
+dimtests.o: ../../hdf/src//htags.h
+dimtests.o: ../../hdf/src//hbitio.h
+dimtests.o: ../../hdf/src//hcomp.h
+dimtests.o: ../../hdf/src//herr.h
+dimtests.o: ../../hdf/src//hproto.h
+dimtests.o: add.h
+dimtests.o: error.h
+dimtests.o: tests.h
+dimtests.o: ../../mfhdf/libsrc/alloc.h
+dimtests.o: emalloc.h
+driver.o: driver.c
+driver.o: ../../mfhdf/libsrc/netcdf.h
+driver.o: ../../hdf/src//hlimits.h
+driver.o: tests.h
+emalloc.o: emalloc.c
+emalloc.o: error.h
+emalloc.o: ../../hdf/src//hdf.h
+emalloc.o: ../../hdf/src//hdfi.h
+emalloc.o: ../../hdf/src//hlimits.h
+emalloc.o: ../../hdf/src//hntdefs.h
+emalloc.o: ../../hdf/src//htags.h
+emalloc.o: ../../hdf/src//hbitio.h
+emalloc.o: ../../hdf/src//hcomp.h
+emalloc.o: ../../hdf/src//herr.h
+emalloc.o: ../../hdf/src//hproto.h
+emalloc.o: emalloc.h
+error.o: error.c
+error.o: ../../mfhdf/libsrc/netcdf.h
+error.o: ../../hdf/src//hlimits.h
+error.o: error.h
+error.o: ../../hdf/src//hdf.h
+error.o: ../../hdf/src//hdfi.h
+error.o: ../../hdf/src//hntdefs.h
+error.o: ../../hdf/src//htags.h
+error.o: ../../hdf/src//hbitio.h
+error.o: ../../hdf/src//hcomp.h
+error.o: ../../hdf/src//herr.h
+error.o: ../../hdf/src//hproto.h
+misctest.o: misctest.c
+misctest.o: ../../mfhdf/libsrc/netcdf.h
+misctest.o: ../../hdf/src//hlimits.h
+misctest.o: testcdf.h
+misctest.o: ../../hdf/src//hdf.h
+misctest.o: ../../hdf/src//hdfi.h
+misctest.o: ../../hdf/src//hntdefs.h
+misctest.o: ../../hdf/src//htags.h
+misctest.o: ../../hdf/src//hbitio.h
+misctest.o: ../../hdf/src//hcomp.h
+misctest.o: ../../hdf/src//herr.h
+misctest.o: ../../hdf/src//hproto.h
+misctest.o: add.h
+misctest.o: error.h
+rec.o: rec.c
+rec.o: ../../mfhdf/libsrc/netcdf.h
+rec.o: ../../hdf/src//hlimits.h
+rec.o: testcdf.h
+rec.o: ../../hdf/src//hdf.h
+rec.o: ../../hdf/src//hdfi.h
+rec.o: ../../hdf/src//hntdefs.h
+rec.o: ../../hdf/src//htags.h
+rec.o: ../../hdf/src//hbitio.h
+rec.o: ../../hdf/src//hcomp.h
+rec.o: ../../hdf/src//herr.h
+rec.o: ../../hdf/src//hproto.h
+rec.o: val.h
+rec.o: error.h
+rec.o: tests.h
+rec.o: ../../mfhdf/libsrc/alloc.h
+rec.o: emalloc.h
+slabs.o: slabs.c
+slabs.o: ../../mfhdf/libsrc/netcdf.h
+slabs.o: ../../hdf/src//hlimits.h
+slabs.o: testcdf.h
+slabs.o: ../../hdf/src//hdf.h
+slabs.o: ../../hdf/src//hdfi.h
+slabs.o: ../../hdf/src//hntdefs.h
+slabs.o: ../../hdf/src//htags.h
+slabs.o: ../../hdf/src//hbitio.h
+slabs.o: ../../hdf/src//hcomp.h
+slabs.o: ../../hdf/src//herr.h
+slabs.o: ../../hdf/src//hproto.h
+slabs.o: add.h
+slabs.o: error.h
+slabs.o: tests.h
+slabs.o: ../../mfhdf/libsrc/alloc.h
+slabs.o: emalloc.h
+val.o: val.c
+val.o: ../../mfhdf/libsrc/netcdf.h
+val.o: ../../hdf/src//hlimits.h
+val.o: testcdf.h
+val.o: ../../hdf/src//hdf.h
+val.o: ../../hdf/src//hdfi.h
+val.o: ../../hdf/src//hntdefs.h
+val.o: ../../hdf/src//htags.h
+val.o: ../../hdf/src//hbitio.h
+val.o: ../../hdf/src//hcomp.h
+val.o: ../../hdf/src//herr.h
+val.o: ../../hdf/src//hproto.h
+val.o: val.h
+val.o: error.h
+vardef.o: vardef.c
+vardef.o: ../../mfhdf/libsrc/netcdf.h
+vardef.o: ../../hdf/src//hlimits.h
+vardef.o: testcdf.h
+vardef.o: ../../hdf/src//hdf.h
+vardef.o: ../../hdf/src//hdfi.h
+vardef.o: ../../hdf/src//hntdefs.h
+vardef.o: ../../hdf/src//htags.h
+vardef.o: ../../hdf/src//hbitio.h
+vardef.o: ../../hdf/src//hcomp.h
+vardef.o: ../../hdf/src//herr.h
+vardef.o: ../../hdf/src//hproto.h
+vardef.o: add.h
+vardef.o: error.h
+vardef.o: tests.h
+vardef.o: ../../mfhdf/libsrc/alloc.h
+vardef.o: emalloc.h
+varget.o: varget.c
+varget.o: ../../mfhdf/libsrc/netcdf.h
+varget.o: ../../hdf/src//hlimits.h
+varget.o: testcdf.h
+varget.o: ../../hdf/src//hdf.h
+varget.o: ../../hdf/src//hdfi.h
+varget.o: ../../hdf/src//hntdefs.h
+varget.o: ../../hdf/src//htags.h
+varget.o: ../../hdf/src//hbitio.h
+varget.o: ../../hdf/src//hcomp.h
+varget.o: ../../hdf/src//herr.h
+varget.o: ../../hdf/src//hproto.h
+varget.o: error.h
+varget.o: tests.h
+varget.o: ../../mfhdf/libsrc/alloc.h
+varget.o: emalloc.h
+vargetg.o: vargetg.c
+vargetg.o: ../../mfhdf/libsrc/netcdf.h
+vargetg.o: ../../hdf/src//hlimits.h
+vargetg.o: testcdf.h
+vargetg.o: ../../hdf/src//hdf.h
+vargetg.o: ../../hdf/src//hdfi.h
+vargetg.o: ../../hdf/src//hntdefs.h
+vargetg.o: ../../hdf/src//htags.h
+vargetg.o: ../../hdf/src//hbitio.h
+vargetg.o: ../../hdf/src//hcomp.h
+vargetg.o: ../../hdf/src//herr.h
+vargetg.o: ../../hdf/src//hproto.h
+vargetg.o: error.h
+vargetg.o: tests.h
+vargetg.o: ../../mfhdf/libsrc/alloc.h
+vargetg.o: emalloc.h
+varput.o: varput.c
+varput.o: ../../mfhdf/libsrc/netcdf.h
+varput.o: ../../hdf/src//hlimits.h
+varput.o: testcdf.h
+varput.o: ../../hdf/src//hdf.h
+varput.o: ../../hdf/src//hdfi.h
+varput.o: ../../hdf/src//hntdefs.h
+varput.o: ../../hdf/src//htags.h
+varput.o: ../../hdf/src//hbitio.h
+varput.o: ../../hdf/src//hcomp.h
+varput.o: ../../hdf/src//herr.h
+varput.o: ../../hdf/src//hproto.h
+varput.o: val.h
+varput.o: error.h
+varput.o: tests.h
+varput.o: ../../mfhdf/libsrc/alloc.h
+varput.o: emalloc.h
+varputg.o: varputg.c
+varputg.o: ../../mfhdf/libsrc/netcdf.h
+varputg.o: ../../hdf/src//hlimits.h
+varputg.o: testcdf.h
+varputg.o: ../../hdf/src//hdf.h
+varputg.o: ../../hdf/src//hdfi.h
+varputg.o: ../../hdf/src//hntdefs.h
+varputg.o: ../../hdf/src//htags.h
+varputg.o: ../../hdf/src//hbitio.h
+varputg.o: ../../hdf/src//hcomp.h
+varputg.o: ../../hdf/src//herr.h
+varputg.o: ../../hdf/src//hproto.h
+varputg.o: val.h
+varputg.o: error.h
+varputg.o: tests.h
+varputg.o: ../../mfhdf/libsrc/alloc.h
+varputg.o: emalloc.h
+vartests.o: vartests.c
+vartests.o: ../../mfhdf/libsrc/netcdf.h
+vartests.o: ../../hdf/src//hlimits.h
+vartests.o: testcdf.h
+vartests.o: ../../hdf/src//hdf.h
+vartests.o: ../../hdf/src//hdfi.h
+vartests.o: ../../hdf/src//hntdefs.h
+vartests.o: ../../hdf/src//htags.h
+vartests.o: ../../hdf/src//hbitio.h
+vartests.o: ../../hdf/src//hcomp.h
+vartests.o: ../../hdf/src//herr.h
+vartests.o: ../../hdf/src//hproto.h
+vartests.o: add.h
+vartests.o: error.h
+vartests.o: tests.h
+vartests.o: ../../mfhdf/libsrc/alloc.h
+vartests.o: emalloc.h
+vputget.o: vputget.c
+vputget.o: ../../mfhdf/libsrc/netcdf.h
+vputget.o: ../../hdf/src//hlimits.h
+vputget.o: testcdf.h
+vputget.o: ../../hdf/src//hdf.h
+vputget.o: ../../hdf/src//hdfi.h
+vputget.o: ../../hdf/src//hntdefs.h
+vputget.o: ../../hdf/src//htags.h
+vputget.o: ../../hdf/src//hbitio.h
+vputget.o: ../../hdf/src//hcomp.h
+vputget.o: ../../hdf/src//herr.h
+vputget.o: ../../hdf/src//hproto.h
+vputget.o: add.h
+vputget.o: val.h
+vputget.o: error.h
+vputget.o: tests.h
+vputget.o: ../../mfhdf/libsrc/alloc.h
+vputget.o: emalloc.h
+vputgetg.o: vputgetg.c
+vputgetg.o: ../../mfhdf/libsrc/netcdf.h
+vputgetg.o: ../../hdf/src//hlimits.h
+vputgetg.o: testcdf.h
+vputgetg.o: ../../hdf/src//hdf.h
+vputgetg.o: ../../hdf/src//hdfi.h
+vputgetg.o: ../../hdf/src//hntdefs.h
+vputgetg.o: ../../hdf/src//htags.h
+vputgetg.o: ../../hdf/src//hbitio.h
+vputgetg.o: ../../hdf/src//hcomp.h
+vputgetg.o: ../../hdf/src//herr.h
+vputgetg.o: ../../hdf/src//hproto.h
+vputgetg.o: add.h
+vputgetg.o: val.h
+vputgetg.o: error.h
+vputgetg.o: tests.h
+vputgetg.o: ../../mfhdf/libsrc/alloc.h
+vputgetg.o: emalloc.h
diff --git a/mfhdf/nctest/dimtests.c b/mfhdf/nctest/dimtests.c
new file mode 100644
index 0000000..5b7109a
--- /dev/null
+++ b/mfhdf/nctest/dimtests.c
@@ -0,0 +1,407 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: dimtests.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+/* 
+ * Test ncdimdef
+ *    try in data mode, check error
+ *    check that returned id is one more than previous id
+ *    try adding same dimension twice, check error
+ *    try with illegal sizes, check error
+ *    make sure unlimited size works, shows up in ncinquire(...,*xtendim)
+ *    try to define a second unlimited dimension, check error
+ */
+void
+test_ncdimdef(path)
+     char *path;		/* name of writable netcdf to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncdimdef";
+    int cdfid;			/* netcdf id */
+    static struct cdfdim mm =	/* dimension */
+      {"mm", 1};		/* 1 should be a valid dimension size */
+    static struct cdfdim nn =	/* dimension */
+      {"bogus", ___};		/* used for testing invalid dimension sizes */
+    static struct cdfdim rec =	/* dimension */
+      {"rec", NC_UNLIMITED};
+    int ndims;			/* number of dimensions */
+    int nvars;			/* number of variables */
+    int natts;			/* number of attributes */
+    int xdimid;			/* id of unlimited dimension, or -1 if none */
+    int dimid;			/* dimension id */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened, defining a dimension should fail in data mode */
+    if (ncdimdef(cdfid, mm.name, mm.size) != -1) {
+	error("%s: ncdimdef should have failed in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    /* enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode OK, add a dimension */
+    if ((dimid = ncdimdef(cdfid, mm.name, mm.size)) == -1) {
+	error("%s: ncdimdef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_dim(&test, &mm);	/* keep in-memory netcdf in sync */
+    /* check that dim id returned is one more than previous dim id */
+    if (dimid != test.ndims - 1) {
+	error("%s: ncdimdef returned %d for dim id, expected %d",
+	      pname, dimid, test.ndims-1);
+	ncclose(cdfid); return;
+    }
+
+    /* try adding same dimension again, this should fail */
+    if (ncdimdef(cdfid, mm.name, mm.size) != -1) {
+	error("%s: ncdimdef should not have allowed redefinition", pname);
+	ncclose(cdfid); return;
+    }
+    /* try adding dimension with negative size, this should fail */
+    if (ncdimdef(cdfid, nn.name, (long) -10) != -1) {
+	error("%s: ncdimdef should not allow negative size dimension", pname);
+	ncclose(cdfid); return;
+    }
+    /* if there is not already an unlimited size dimension, try adding one */
+    if (ncinquire(cdfid, &ndims, &nvars, &natts, &xdimid) == -1) {
+	error("%s: ncinquire failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (xdimid == -1) {
+	if (ncdimdef(cdfid, rec.name, rec.size) == -1) {
+	    error("%s: ncdimdef failed on NC_UNLIMITED dimension", pname);
+	    ncclose(cdfid); return;
+	}
+	add_dim(&test, &rec);
+    }
+    /* try adding another unlimited dimension, which should fail */
+    if (ncdimdef(cdfid, "rec2", rec.size) != -1) {
+	error("%s: ncdimdef should not allow second NC_UNLIMITED dimension",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    if (ncdimdef(cdfid, "rec2", rec.size) != -1) {
+	error("%s: ncdimdef should fail on bad netCDF id", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncdimid
+ *    check return with defined dimension in both modes
+ *    try with undefined dimension, check error
+ *    check return with unlimited size dimension
+ *    try with bad handle, check error
+ */
+void
+test_ncdimid(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncdimid";
+    int cdfid;			/* netcdf id */
+    int nn_dim;			/* dimension id */
+    static struct cdfdim nn =	/* dimension */
+      {"nn", 1};		/* 1 should be a valid dimension size */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened, enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode OK, add a dimension */
+    if ((nn_dim = ncdimdef(cdfid, nn.name, nn.size)) == -1) {
+	error("%s: ncdimdef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_dim(&test, &nn);	/* keep in-memory netcdf in sync */
+    /* check id returned for name matches id returned from definition */
+    if (ncdimid(cdfid, nn.name) != nn_dim) {
+	error("%s: ncdimid returned wrong value in define mode", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode, check returned id for dimension just added */
+    if (ncdimid(cdfid, nn.name) != nn_dim) {
+	error("%s: ncdimid returned wrong value in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with undefined dimension, should fail */
+    if (ncdimid(cdfid, "easter-bunny") != -1) {
+	error("%s: ncdimid with bogus name should have failed ", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with unlimited dimension, assumed to be "rec" from earlier calls */
+    if (ncdimid(cdfid, "rec") != test.xdimid) {
+	error("%s: ncdimid returned bad value for record dimension", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try on bad handle, should fail */
+    if (ncdimid(cdfid, nn.name) != -1) {
+	error("%s: ncdimid failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncdiminq
+ *    try in both modes
+ *    check returned name and size against defined name and size	
+ *    try with bad dimension handle, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncdiminq(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncdiminq";
+    int cdfid;			/* netcdf id */
+    int dimid;			/* dimension id */
+    struct cdfdim dim;		/* dimension */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened, in data mode */
+    dim.name = (char *) emalloc(H4_MAX_NC_NAME);
+    for (dimid = 0 ; dimid < test.ndims; dimid++) { /* loop on all dim ids */
+	if (ncdiminq(cdfid, dimid, dim.name, &dim.size) == -1) {
+	    error("%s: ncdiminq in data mode failed on dim id %d",
+		  pname, dimid);
+	    ncclose(cdfid); return;
+	}
+	/* compare returned with expected values */
+	if (strcmp(dim.name, test.dims[dimid].name) != 0) {
+	    error("%s: ncdiminq (data mode), name %s, expected %s for id = %d",
+		pname, dim.name, test.dims[dimid].name, dimid);
+	    nerrs++;
+	}
+	if (dim.size != test.dims[dimid].size) {
+	    error("%s: ncdiminq (data mode), size %d, expected %d for id = %d",
+		pname, dim.size, test.dims[dimid].size, dimid);
+	    nerrs++;
+	}
+    }
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, compare returned with expected values again */
+    for (dimid = 0 ; dimid < test.ndims; dimid++) { /* loop on all dim ids */
+	if (ncdiminq(cdfid, dimid, dim.name, &dim.size) == -1) {
+	    error("%s: ncdiminq in define mode failed on dim id %d",
+		  pname, dimid);
+	    ncclose(cdfid); return;
+	}
+	/* compare returned with expected values */
+	if (strcmp(dim.name, test.dims[dimid].name) != 0) {
+	    error("%s: ncdiminq (define), name %s, expected %s for id = %d",
+		pname, dim.name, test.dims[dimid].name, dimid);
+	    nerrs++;
+	}
+	if (dim.size != test.dims[dimid].size) {
+	    error("%s: ncdiminq (define), size %d, expected %d for id = %d",
+		pname, dim.size, test.dims[dimid].size, dimid);
+	    nerrs++;
+	}
+    }
+    /* try with bad dimension handles, check for failure */
+    if (ncdiminq(cdfid, -1, dim.name, &dim.size) != -1 ||
+	ncdiminq(cdfid, test.ndims, dim.name, &dim.size) != -1) {
+	error("%s: ncdiminq should have failed on bad dimension ids",
+	      pname, dimid);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* should fail, since bad handle */
+    if (test.ndims >= 1) {	/* if any dimensions have been defined */
+	if (ncdiminq (cdfid, 0, dim.name, &dim.size) != -1) {
+	    error("%s: ncdiminq failed to report bad netcdf handle ", pname);
+	    nerrs++;
+	}
+    }
+    Free(dim.name);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}    
+    
+/*
+ * Test ncdimrename
+ *    check that proper rename worked with ncdiminq
+ *    try renaming to existing dimension name, check error
+ *    try with bad dimension handle, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncdimrename(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncdimrename";
+    int cdfid;			/* netcdf id */
+    int pp_dim;			/* dimension id */
+    static struct cdfdim pp =	/* dimension */
+      {"pp", 7};
+    static char newname[H4_MAX_NC_NAME] = /* dimension name */
+      "new_name";
+    struct cdfdim dim;		/* dimension */
+    static struct cdfdim qq =	/* dimension */
+      {"qq", 10};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened */
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add two dimensions */
+    if ((pp_dim = ncdimdef(cdfid, pp.name, pp.size)) == -1) {
+	error("%s: ncdimdef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_dim(&test, &pp);	/* keep in-memory netcdf in sync */
+    if (ncdimdef(cdfid, qq.name, qq.size) == -1) {
+	error("%s: ncdimdef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_dim(&test, &qq);	/* keep in-memory netcdf in sync */
+    /* rename first dimension */
+    if (ncdimrename(cdfid, pp_dim, newname) == -1) {
+	error("%s: ncdimrename failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* check new name with ncdiminq */
+    dim.name = (char *) emalloc(H4_MAX_NC_NAME);
+    if (ncdiminq(cdfid, pp_dim, dim.name, &dim.size) == -1) {
+	error("%s: ncdiminq failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (strcmp(dim.name,pp.name) == 0) {
+	error("%s: ncdimrename failed to change name", pname);
+	ncclose(cdfid); return;
+    }
+    if (strcmp(dim.name,newname) != 0) {
+	error("%s: ncdimrename changed name to %s instead of %s",
+	      pname, dim.name, newname);
+	ncclose(cdfid); return;
+    }
+    test.dims[pp_dim].name = (char *) erealloc((void *)test.dims[pp_dim].name,
+					      strlen(newname)+1);
+    (void) strcpy(test.dims[pp_dim].name, newname); /* keep test consistent */
+    /* try to rename second dimension same as first, should fail */
+    if (ncdimrename(cdfid, pp_dim, qq.name) != -1) {
+	error("%s: ncdimrename should have failed with used name", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with bad dimension handles, check for failure */
+    if (ncdimrename(cdfid, -1, dim.name) != -1 ||
+	ncdimrename(cdfid, test.ndims, dim.name) != -1) {
+	error("%s: ncdimrename should have failed on bad dimension ids",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode, restore old name */
+    if (ncdimrename(cdfid, pp_dim, pp.name) == -1) {
+	error("%s: ncdimrename failed in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    test.dims[pp_dim].name = (char *) erealloc((void *)test.dims[pp_dim].name,
+					      strlen(pp.name)+1);
+    (void) strcpy(test.dims[pp_dim].name, pp.name); /* keep test consistent */
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* should fail, since bad handle */
+    if (ncdimrename (cdfid, 0, dim.name) != -1) {
+	error("%s: ncdimrename failed to report bad netcdf handle ", pname);
+	nerrs++;
+    }
+    Free (dim.name);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/driver.c b/mfhdf/nctest/driver.c
new file mode 100644
index 0000000..676f952
--- /dev/null
+++ b/mfhdf/nctest/driver.c
@@ -0,0 +1,152 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: driver.c 6043 2014-01-21 21:09:03Z acheng $
+ *********************************************************************/
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "tests.h"
+
+/* #define MDEBUG 1 */
+
+  /*
+   * Test driver for netCDF implementation.  This program performs
+   * tests against the netCDF specification for all user-level
+   * functions in an implementation of the netCDF library.  Must be
+   * invoked from a directory in which the invoker has write
+   * permission.
+   */
+
+#if defined TEST_PC || defined TEST_WIN
+#include <stdio.h>
+FILE *dbg_file;
+#endif
+
+#include <stdlib.h>
+
+#ifdef PROTOTYPE
+int main(int argc, char *argv[])
+#else
+int main(argc, argv)
+int argc;
+char *argv[];
+#endif
+{
+    static char testfile[] = "test.nc";
+    static char unlim_testfile_name[] = "test_unlim.nc";
+    char *unlim_testfile;
+
+    int name_size;
+    char *srcdir;
+
+#if defined TEST_PC || defined TEST_WIN
+    dbg_file=fopen("test.dbg","w+");
+#endif
+
+#ifdef MDEBUG
+    malloc_debug(2);
+#endif /* MDEBUG */
+
+    ncopts &= ~NC_FATAL;	/* make errors nonfatal */
+    ncopts &= ~NC_VERBOSE;	/* turn off error messages */
+    ncopts |= NC_VERBOSE;	/* turn  error messages on--AKC */
+    ncopts &= ~NC_VERBOSE;	/* turn off error messages */
+
+    test_nccreate(testfile);
+
+    test_ncopen(testfile);
+
+    test_ncredef(testfile);
+
+    test_ncendef(testfile);
+
+    test_ncclose(testfile);
+
+    test_ncinquire(testfile);
+#if (!defined _MSC_VER) || (_MSC_VER < 1400)
+    test_ncsync(testfile);
+#endif
+    test_ncabort(testfile);
+
+    test_ncdimdef(testfile);
+
+    test_ncdimid(testfile);
+
+    test_ncdiminq(testfile);
+
+    test_ncdimrename(testfile);
+
+    test_ncvardef(testfile);
+
+    test_ncvarid(testfile);
+
+    test_ncvarinq(testfile);
+
+    test_ncvarput1(testfile);
+
+    test_ncvarget1(testfile);
+
+    test_ncvarput(testfile);
+
+    test_ncvarget(testfile);
+
+    name_size = strlen(unlim_testfile_name) + 1;
+    srcdir = getenv("srcdir");
+
+    if (srcdir)
+        name_size += strlen(srcdir) + 1;
+
+    unlim_testfile = calloc(name_size, 1);
+
+    if (srcdir) {
+        strcpy(unlim_testfile, srcdir);
+
+        if (srcdir[strlen(srcdir) - 1] != '/')
+            strcat(unlim_testfile, "/");
+    }
+
+    strcat(unlim_testfile, unlim_testfile_name);
+    test_ncvarget_unlim(unlim_testfile);
+    free(unlim_testfile);
+
+    test_ncvarputg(testfile);
+
+    test_ncvargetg(testfile);
+
+    test_ncrecinq(testfile);
+
+    test_ncrecput(testfile);
+
+    test_ncrecget(testfile);
+
+    test_ncvarrename(testfile);
+
+    test_ncattput(testfile);
+
+    test_ncattinq(testfile);
+
+    test_ncattget(testfile);
+
+    test_ncattcopy(testfile, "test2.nc");
+
+    test_ncattname(testfile);
+
+    test_ncattrename(testfile);
+
+    test_ncattdel(testfile);
+
+    test_nctypelen();
+
+#if defined TEST_PC || defined TEST_WIN
+    fclose(dbg_file);
+#endif
+#define EXIT_SUCCESS 0
+    return EXIT_SUCCESS;
+}
+
diff --git a/mfhdf/nctest/emalloc.c b/mfhdf/nctest/emalloc.c
new file mode 100644
index 0000000..f6c4709
--- /dev/null
+++ b/mfhdf/nctest/emalloc.c
@@ -0,0 +1,63 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: emalloc.c 2365 1996-03-26 22:43:35Z georgev $
+ *********************************************************************/
+
+/*LINTLIBRARY*/
+#include <stdio.h>
+#include <stdlib.h>
+#include "error.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+void *
+emalloc (size)			/* check return from malloc */
+int size;
+{
+    void   *p;
+
+    if (size < 0) {
+        error ("negative arg to emalloc: %d", size);
+	return 0;
+    }
+    if (size == 0)
+      return 0;
+#ifdef HDF
+    p = (void *) HDmalloc((uint32)size);
+#else
+    p = (void *) malloc ((unsigned) size);
+#endif
+    if (p == 0) {
+	error ("out of memory\n");
+	exit (1);
+    }
+    return p;
+}
+
+void *
+erealloc (ptr,size)		/* check return from realloc */
+     void *ptr;
+     int size;
+{
+    void *p;
+
+    if (size < 0) {
+        error ("negative arg to realloc");
+	return 0;
+    }
+#ifdef HDF
+    p = (void *) HDrealloc((VOIDP) ptr, (uint32) size);
+#else
+    p = (void *) realloc ((char *) ptr, (unsigned) size);
+#endif
+
+    if (p == 0) {
+ 	error ("out of memory");
+	exit(1);
+    }
+    return p;
+}
+
diff --git a/mfhdf/nctest/emalloc.h b/mfhdf/nctest/emalloc.h
new file mode 100644
index 0000000..e714e6b
--- /dev/null
+++ b/mfhdf/nctest/emalloc.h
@@ -0,0 +1,30 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: emalloc.h 2365 1996-03-26 22:43:35Z georgev $
+ *********************************************************************/
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void	*emalloc	PROTO((
+				       int size
+				       ));
+
+extern void	*erealloc	PROTO((
+				       void *ptr,
+				       int size
+				       ));
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/mfhdf/nctest/error.c b/mfhdf/nctest/error.c
new file mode 100644
index 0000000..a06e2b6
--- /dev/null
+++ b/mfhdf/nctest/error.c
@@ -0,0 +1,78 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: error.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+
+#ifndef NO_STDARG
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "error.h"
+
+int	error_count = 0;
+
+/*
+ * Use for logging error conditions.
+ */
+#ifndef NO_STDARG
+void
+error(const char *fmt, ...)
+#else
+/*VARARGS1*/
+void
+error(fmt, va_alist)
+     const char *fmt ;
+     va_dcl
+#endif
+{
+    va_list args ;
+
+    (void) fprintf(stderr,"*** ");
+
+#ifndef NO_STDARG
+    va_start(args, fmt) ;
+#else
+    va_start(args) ;
+#endif
+    (void) vfprintf(stderr,fmt,args) ;
+    va_end(args) ;
+
+    (void) fprintf(stderr, "\n") ;
+    error_count++;
+}
+
+
+/*
+ * Turn off netCDF library handling of errors.  Caller must check all error
+ * returns after calling this, until on_errs() is called.
+ */
+void
+off_errs()
+{
+    ncopts &= ~NC_FATAL;	/* make errors nonfatal */
+    ncopts &= ~NC_VERBOSE;	/* turn off error messages */
+}
+
+
+/*
+ * Let netCDF library handle subsequent errors.  Callers don't need to check
+ * error returns after this.  (This is the initial default.)
+ */
+void
+on_errs()
+{
+    ncopts |= NC_FATAL;		/* make errors fatal */
+    ncopts |= NC_VERBOSE;	/* library prints error messages */
+}
diff --git a/mfhdf/nctest/error.h b/mfhdf/nctest/error.h
new file mode 100644
index 0000000..eb98c5b
--- /dev/null
+++ b/mfhdf/nctest/error.h
@@ -0,0 +1,59 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: error.h 3226 1997-11-05 19:41:13Z koziol $
+ *********************************************************************/
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Print error message to stderr, don't exit */
+#ifndef NO_STRARG
+extern void derror(const char *fmt, ...);
+#else
+extern void derror();
+#endif
+
+#ifndef NO_STDARG
+extern void	error		PROTO((
+				       const char *fmt,
+				       ...
+				       ));
+#else  /* VARARGS1 */
+extern void     error           PROTO((
+                                       const char *fmt,
+                                       va_dcl
+                                       ));
+#endif
+
+/*
+ * Turn off netCDF library handling of errors.  Caller must check all error
+ * returns after calling this, until on_errs() is called.
+ */
+extern void	off_errs	PROTO((
+				       void
+				       ));
+
+/*
+ * Let netCDF library handle subsequent errors.  Callers don't need to check
+ * error returns after this.  (This is the initial default.)
+ */
+extern void	on_errs		PROTO((
+				       void
+				       ));
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mfhdf/nctest/misctest.c b/mfhdf/nctest/misctest.c
new file mode 100644
index 0000000..93c6639
--- /dev/null
+++ b/mfhdf/nctest/misctest.c
@@ -0,0 +1,64 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: misctest.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "error.h"
+#include "tests.h"
+
+
+/*
+ * Test nctypelen
+ *    try with bad datatype, check error
+ *    check returned values for each proper datatype
+ */
+void
+test_nctypelen()
+{
+    int nerrs = 0;
+    static char pname[] = "test_nctypelen";
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if (nctypelen(NC_BYTE) != sizeof(char)) {
+	error("%s: nctypelen failed for NC_BYTE", pname);
+	nerrs++;
+    }
+    if (nctypelen(NC_CHAR) != sizeof(char)) {
+	error("%s: nctypelen failed for NC_CHAR", pname);
+	nerrs++;
+    }
+    if (nctypelen(NC_SHORT) != sizeof(short)) {
+	error("%s: nctypelen failed for NC_SHORT", pname);
+	nerrs++;
+    }
+    if (nctypelen(NC_LONG) != sizeof(nclong)) {
+	error("%s: nctypelen failed for NC_LONG", pname);
+	nerrs++;
+    }
+    if (nctypelen(NC_FLOAT) != sizeof(float)) {
+	error("%s: nctypelen failed for NC_FLOAT", pname);
+	nerrs++;
+    }
+    if (nctypelen(NC_DOUBLE) != sizeof(double)) {
+	error("%s: nctypelen failed for NC_DOUBLE", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/msoft.mk b/mfhdf/nctest/msoft.mk
new file mode 100644
index 0000000..9b190f7
--- /dev/null
+++ b/mfhdf/nctest/msoft.mk
@@ -0,0 +1,196 @@
+#  Copyright 1993, UCAR/Unidata
+#
+#  DOS and OS/2 Makefile for netcdf exhaustive test on PS/2
+#
+#  NOTE:  Set the definition of the OS2 macro to match OS as follows:
+#         OS2 = 0     -> DOS
+#         OS2 = 1     -> OS/2
+
+!INCLUDE ..\macros.mk
+
+AR       = LIB
+ARFLAGS  =
+
+LINK      = link
+LFLAGS    = /st:10000 /SEG:256 /nod
+
+INCDIR    =  ..\libsrc
+HDFINCDIR =  \hdf\hdf\include
+INCLUDES  = /I$(INCDIR) /I$(HDFINCDIR)
+
+BINDIR    = $(DESTDIR)\bin
+LIBDIR    = $(DESTDIR)\lib
+NCTESTLIB = nctest.lib
+NETCDFLIB = ..\libsrc\netcdf.lib
+CLIB      = llibc7.lib oldnames.lib
+!IF $(OS2)
+OS2LIB    = os2.lib
+!ELSE
+OS2LIB    =
+!ENDIF
+XDRLIB    = ..\xdr\xdr.lib
+HDFLIB    = \hdf\hdf\lib\df.lib
+LIBS      = $(NCTESTLIB) $(NETCDFLIB) $(XDRLIB) $(OS2LIB) $(HDFLIB) $(CLIB)
+
+.c.obj:
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
+
+GOAL = nctest.exe
+
+SRCS =  varget.c vargetg.c varput.c varputg.c vardef.c vartests.c \
+	vputget.c vputgetg.c driver.c cdftests.c dimtests.c rec.c \
+	atttests.c misctest.c add.c error.c emalloc.c val.c slabs.c
+
+MAIN =  driver.obj
+
+OBJS =  varget.obj vargetg.obj varput.obj varputg.obj vardef.obj vartests.obj \
+	vputget.obj vputgetg.obj cdftests.obj dimtests.obj rec.obj \
+	atttests.obj misctest.obj add.obj error.obj emalloc.obj val.obj \
+	slabs.obj
+
+LOBJS1 =  -+varget.obj -+vargetg.obj -+varput.obj -+varputg.obj -+vardef.obj \
+          -+vartests.obj -+vputget.obj
+LOBJS2 =  -+vputgetg.obj -+cdftests.obj -+dimtests.obj -+rec.obj \
+	  -+atttests.obj -+misctest.obj
+LOBJS3 =  -+add.obj -+error.obj -+emalloc.obj -+val.obj -+slabs.obj
+
+all:	$(GOAL)
+
+test:	$(GOAL) FORCE
+	$(GOAL)
+
+FORCE:
+
+$(GOAL): $(MAIN) $(NCTESTLIB) $(NETCDFLIB) $(XDRLIB)
+    $(LINK) $(LFLAGS) @nctest.lnk
+#    $(LINK) $(LFLAGS) $(MAIN)+(vartests+cdftests+dimtests+atttests+misctest),$(GOAL),, at nctest.lnk;
+#    $(LINK) $(LFLAGS) $(MAIN),$(GOAL),, at nctest.lnk;
+
+$(NCTESTLIB):	$(OBJS)
+	$(AR) $@ $(ARFLAGS) $(LOBJS1),LIB.LST;
+	$(AR) $@ $(ARFLAGS) $(LOBJS2),LIB.LST;
+	$(AR) $@ $(ARFLAGS) $(LOBJS3),LIB.LST;
+
+install:
+
+clean:
+	rm -f *.obj *.lst *.map *.bak nctest.lib nctest.exe *.cdf
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+add.obj: add.c
+add.obj: ../libsrc/netcdf.h
+add.obj: ./testcdf.h
+add.obj: ./add.h
+add.obj: ./emalloc.h
+atttests.obj: atttests.c
+atttests.obj: ../libsrc/netcdf.h
+atttests.obj: ./testcdf.h
+atttests.obj: ./add.h
+atttests.obj: ./error.h
+atttests.obj: ./emalloc.h
+atttests.obj: ./tests.h
+atttests.obj: ./val.h
+bug.obj: bug.c
+bug.obj: ../libsrc/netcdf.h
+cdftests.obj: cdftests.c
+cdftests.obj: ../libsrc/netcdf.h
+cdftests.obj: ./testcdf.h
+cdftests.obj: ./add.h
+cdftests.obj: ./error.h
+cdftests.obj: ./tests.h
+dimtests.obj: dimtests.c
+dimtests.obj: ../libsrc/netcdf.h
+dimtests.obj: ./testcdf.h
+dimtests.obj: ./add.h
+dimtests.obj: ./error.h
+dimtests.obj: ./tests.h
+driver.obj: driver.c
+driver.obj: ../libsrc/netcdf.h
+driver.obj: ./tests.h
+emalloc.obj: emalloc.c
+emalloc.obj: ./error.h
+emalloc.obj: ./emalloc.h
+error.obj: error.c
+error.obj: ../libsrc/netcdf.h
+error.obj: ./error.h
+fixed1.obj: fixed1.c
+fixed1.obj: ../libsrc/netcdf.h
+fixed2.obj: fixed2.c
+fixed2.obj: ../libsrc/netcdf.h
+misctest.obj: misctest.c
+misctest.obj: ../libsrc/netcdf.h
+misctest.obj: ./testcdf.h
+misctest.obj: ./add.h
+misctest.obj: ./error.h
+nctime.obj: nctime.c
+nctime.obj: ../libsrc/netcdf.h
+nctime0.obj: nctime0.c
+nctime0.obj: ../libsrc/netcdf.h
+rec.obj: rec.c
+rec.obj: ../libsrc/netcdf.h
+rec.obj: ./testcdf.h
+rec.obj: ./val.h
+rec.obj: ./error.h
+rec.obj: ./tests.h
+slabs.obj: slabs.c
+slabs.obj: ../libsrc/netcdf.h
+slabs.obj: ./testcdf.h
+slabs.obj: ./add.h
+slabs.obj: ./error.h
+slabs.obj: ./tests.h
+val.obj: val.c
+val.obj: ../libsrc/netcdf.h
+val.obj: ./testcdf.h
+val.obj: ./val.h
+val.obj: ./error.h
+vardef.obj: vardef.c
+vardef.obj: ../libsrc/netcdf.h
+vardef.obj: ./testcdf.h
+vardef.obj: ./add.h
+vardef.obj: ./error.h
+vardef.obj: ./tests.h
+varget.obj: varget.c
+varget.obj: ../libsrc/netcdf.h
+varget.obj: ./testcdf.h
+varget.obj: ./error.h
+varget.obj: ./tests.h
+vargetg.obj: vargetg.c
+vargetg.obj: ../libsrc/netcdf.h
+vargetg.obj: ./testcdf.h
+vargetg.obj: ./error.h
+vargetg.obj: ./tests.h
+varput.obj: varput.c
+varput.obj: ../libsrc/netcdf.h
+varput.obj: ./testcdf.h
+varput.obj: ./val.h
+varput.obj: ./error.h
+varput.obj: ./tests.h
+varputg.obj: varputg.c
+varputg.obj: ../libsrc/netcdf.h
+varputg.obj: ./testcdf.h
+varputg.obj: ./val.h
+varputg.obj: ./error.h
+varputg.obj: ./tests.h
+vartests.obj: vartests.c
+vartests.obj: ../libsrc/netcdf.h
+vartests.obj: ./testcdf.h
+vartests.obj: ./add.h
+vartests.obj: ./error.h
+vartests.obj: ./tests.h
+vputget.obj: vputget.c
+vputget.obj: ../libsrc/netcdf.h
+vputget.obj: ./testcdf.h
+vputget.obj: ./add.h
+vputget.obj: ./val.h
+vputget.obj: ./error.h
+vputget.obj: ./tests.h
+vputget.obj: ./emalloc.h
+vputgetg.obj: vputgetg.c
+vputgetg.obj: ../libsrc/netcdf.h
+vputgetg.obj: ./testcdf.h
+vputgetg.obj: ./add.h
+vputgetg.obj: ./val.h
+vputgetg.obj: ./error.h
+vputgetg.obj: ./tests.h
+vputgetg.obj: ./emalloc.h
diff --git a/mfhdf/nctest/nctest.def b/mfhdf/nctest/nctest.def
new file mode 100644
index 0000000..6b7b1fc
--- /dev/null
+++ b/mfhdf/nctest/nctest.def
@@ -0,0 +1,62 @@
+;
+; CL.DEF - Default .def file for C Windows applications
+;
+; Copyright (C) Microsoft Corp 1991.  All rights reserved.
+;
+
+NAME           WINDOWAPI
+
+;
+; The NAME statement tells the linker that a Windows application is being
+; built. The linker supplies the actual name of the application from the
+; base name of the executable file.
+;
+
+EXETYPE        WINDOWS 3.0
+
+;
+; The EXETYPE statement tells the linker to build a Windows 3.0 executable
+; file.  This statement should be used in all applications built with
+; C 7.0 for Windows 3.0.
+;
+
+PROTMODE
+
+;
+; The PROTMODE statement tells the linker to mark the application for execution
+; in Windows standard or enhanced mode.
+;
+
+CODE           PRELOAD MOVEABLE DISCARDABLE
+DATA           PRELOAD MOVEABLE
+
+;
+; The CODE and DATA statements set the attributes of the applications CODE and
+; DATA segments.
+;
+
+HEAPSIZE       1024
+STACKSIZE      8096
+
+;
+; The HEAPSIZE and STACKSIZE statements set the applications near heap and
+; stack sizes.  The values specified are recomended for QuickWin applications.
+;
+
+;
+; Uncomment these lines for DLL module definition file model.
+;
+;EXPORTS
+; WEP @1 RESIDENTNAME
+;
+;SEGMENTS 'WEP_TEXT' FIXED PRELOAD
+;
+;
+; The above section should be uncommented if this .DEF file is to be used as
+; a model for a C 7.0 dynamic-link library (DLL) .DEF file.  The WEP
+; routine is included in the C 7.0 startup code, but the symbol must
+; be explicitly exported. If a DLL already has a user-defined WEP routine,
+; the routine should be renamed _WEP.  The startup code will call _WEP,
+; if present, during DLL termination. For additional information concerning
+; the WEP function, see the C 7.0 and Windows 3.0 SDK documentation.
+;
diff --git a/mfhdf/nctest/nctest.lnk b/mfhdf/nctest/nctest.lnk
new file mode 100644
index 0000000..4910f3c
--- /dev/null
+++ b/mfhdf/nctest/nctest.lnk
@@ -0,0 +1,5 @@
+driver vartests cdftests dimtests atttests misctest
+nctest /noi
+nctest
+nctest.lib ..\libsrc\netcdf.lib ..\xdr\xdr.lib  \hdf\hdf\lib\df.lib /NOD:llibce llibcewq libw
+nctest
diff --git a/mfhdf/nctest/nctest.mak b/mfhdf/nctest/nctest.mak
new file mode 100644
index 0000000..17ca355
--- /dev/null
+++ b/mfhdf/nctest/nctest.mak
@@ -0,0 +1,370 @@
+# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+!IF "$(CFG)" == ""
+CFG=Win32 Debug
+!MESSAGE No configuration specified.  Defaulting to Win32 Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line.  For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "nctest.mak" CFG="Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+################################################################################
+# Begin Project
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "WinRel"
+# PROP BASE Intermediate_Dir "WinRel"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : $(OUTDIR)/nctest.exe $(OUTDIR)/nctest.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /O2 /I "..\xdr" /I "..\libsrc" /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "NO_SYS_XDR_INC" /D "HDF" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\xdr" /I "..\libsrc" /I "..\..\hdf\src"\
+ /I "..\..\hdf\jpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "NO_SYS_XDR_INC" /D\
+ "HDF" /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"nctest.bsc" 
+
+$(OUTDIR)/nctest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=$(INTDIR)/nctest.def
+LINK32_OBJS= \
+	$(INTDIR)/varput.obj \
+	$(INTDIR)/emalloc.obj \
+	$(INTDIR)/vargetg.obj \
+	$(INTDIR)/vartests.obj \
+	$(INTDIR)/vardef.obj \
+	$(INTDIR)/vputget.obj \
+	$(INTDIR)/misctest.obj \
+	$(INTDIR)/slabs.obj \
+	$(INTDIR)/varget.obj \
+	$(INTDIR)/vputgetg.obj \
+	$(INTDIR)/driver.obj \
+	$(INTDIR)/add.obj \
+	$(INTDIR)/rec.obj \
+	$(INTDIR)/dimtests.obj \
+	$(INTDIR)/cdftests.obj \
+	$(INTDIR)/val.obj \
+	$(INTDIR)/error.obj \
+	$(INTDIR)/varputg.obj \
+	$(INTDIR)/atttests.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:no /PDB:$(OUTDIR)/"nctest.pdb" /MACHINE:I386\
+ /DEF:".\nctest.def" /OUT:$(OUTDIR)/"nctest.exe" 
+
+$(OUTDIR)/nctest.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "WinDebug"
+# PROP BASE Intermediate_Dir "WinDebug"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : $(OUTDIR)/nctest.exe $(OUTDIR)/nctest.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /Zi /Od /I "..\xdr" /I "..\libsrc" /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "NO_SYS_XDR_INC" /D "HDF" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\xdr" /I "..\libsrc" /I\
+ "..\..\hdf\src" /I "..\..\hdf\jpeg" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D\
+ "NO_SYS_XDR_INC" /D "HDF" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"nctest.pdb" /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"nctest.bsc" 
+
+$(OUTDIR)/nctest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=$(INTDIR)/nctest.def
+LINK32_OBJS= \
+	$(INTDIR)/varput.obj \
+	$(INTDIR)/emalloc.obj \
+	$(INTDIR)/vargetg.obj \
+	$(INTDIR)/vartests.obj \
+	$(INTDIR)/vardef.obj \
+	$(INTDIR)/vputget.obj \
+	$(INTDIR)/misctest.obj \
+	$(INTDIR)/slabs.obj \
+	$(INTDIR)/varget.obj \
+	$(INTDIR)/vputgetg.obj \
+	$(INTDIR)/driver.obj \
+	$(INTDIR)/add.obj \
+	$(INTDIR)/rec.obj \
+	$(INTDIR)/dimtests.obj \
+	$(INTDIR)/cdftests.obj \
+	$(INTDIR)/val.obj \
+	$(INTDIR)/error.obj \
+	$(INTDIR)/varputg.obj \
+	$(INTDIR)/atttests.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\xdr\win32xdr.lib ..\libsrc\win32cdf.lib\
+ ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO\
+ /SUBSYSTEM:console /INCREMENTAL:yes /PDB:$(OUTDIR)/"nctest.pdb" /DEBUG\
+ /MACHINE:I386 /DEF:".\nctest.def" /OUT:$(OUTDIR)/"nctest.exe" 
+
+$(OUTDIR)/nctest.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Group "Source Files"
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\varput.c
+
+$(INTDIR)/varput.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\nctest.def
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\tests.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\emalloc.c
+
+$(INTDIR)/emalloc.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vargetg.c
+
+$(INTDIR)/vargetg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\emalloc.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vartests.c
+
+$(INTDIR)/vartests.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vardef.c
+
+$(INTDIR)/vardef.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vputget.c
+
+$(INTDIR)/vputget.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\misctest.c
+
+$(INTDIR)/misctest.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\slabs.c
+
+$(INTDIR)/slabs.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\varget.c
+
+$(INTDIR)/varget.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\testcdf.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\vputgetg.c
+
+$(INTDIR)/vputgetg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\driver.c
+
+$(INTDIR)/driver.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\add.c
+
+$(INTDIR)/add.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\add.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\rec.c
+
+$(INTDIR)/rec.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dimtests.c
+
+$(INTDIR)/dimtests.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\cdftests.c
+
+$(INTDIR)/cdftests.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\val.c
+
+$(INTDIR)/val.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\val.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\error.c
+
+$(INTDIR)/error.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\error.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\varputg.c
+
+$(INTDIR)/varputg.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\atttests.c
+
+$(INTDIR)/atttests.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################
diff --git a/mfhdf/nctest/nctest.project.hqx b/mfhdf/nctest/nctest.project.hqx
new file mode 100644
index 0000000..3fbf5a4
--- /dev/null
+++ b/mfhdf/nctest/nctest.project.hqx
@@ -0,0 +1,649 @@
+(This file must be converted with BinHex 4.0)
+
+:$QjMG'9cG#j`FQpUC at 0d!%e08(*$9dP&!!!!!(Mf!!!!!2EjBfp[E!!!!!)!!!!
+S!!"cS!!!FmJ!!!8Z!!!!-`%!!!!!!!!!!!!!!!!#!!!!!a5h!!)!!!!!!!!!!JG
+`B at 0VB@GP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#h"KBfYKCf8ZFhPY!!!!!!!
+!!!!!!!!!!!!!!!!!!!!08hPcG'9Y3faKFh0PF`!!!!!!!!!!!!!!!!!!!!!!!!!
+&!3$rr`!!!!!!!!!!rrm"!3%"!3!!!!!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!!'*`FQ9Q!!cI5J!
+!!$%!!!!!!!!!!$3K!!!!1("bC at B!#qZK!!!!-J!!!!!!!!!!0&N!!!!0F(*PCJ!
+-(XF!!!!c!!!!!!!!!!!dCJ!!!"4`FQ9Q!![YG`!!!$3!!!!!!!!!!"'+!!!!#R"
+bC at B!$'rU!!!!03!!!!!!!!!!Dmm!!!$%F(*PCJ!-kBF!!!!f!!!!!!!!!!"XN`!
+!!4C`FQ9Q!!`G%J!!!$F!!!!!!!!!!'fT!!!!ZR"bC at B!$18J!!!!1!!!!!!!!!!
+!03d!!!!ZF(*PCJ!,pUd!!!!j!!!!!!!!!!"ZB`!!!Ja`FQ9Q!!a at 6!!!!$S!!24
+C!!!:
diff --git a/mfhdf/nctest/rec.c b/mfhdf/nctest/rec.c
new file mode 100644
index 0000000..4f0c367
--- /dev/null
+++ b/mfhdf/nctest/rec.c
@@ -0,0 +1,618 @@
+/*********************************************************************
+ *   Copyright 1993, University Corporation for Atmospheric Research
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: rec.c 5207 2009-08-05 04:18:22Z bmribler $
+ *********************************************************************/
+
+#include <stdio.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "val.h"
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define VARS 100
+
+/*
+ * Returns number of record variables in an open netCDF file, and an array of
+ * the record variable ids, if the array parameter is non-null.  Returns -1 on
+ * error.
+ */
+static int
+numrecvars(ncid, recvarids)
+     int ncid;
+     int *recvarids;     
+{
+    int ndims, iv, nvars;
+    int nrecvars;
+    int recdimid;
+    int dimids[H4_MAX_VAR_DIMS];
+
+    if (ncinquire(ncid, NULL, &nvars, NULL, &recdimid) == -1)
+      return -1;
+    if (recdimid == -1)
+      return 0;
+    nrecvars = 0;
+    for (iv = 0; iv < nvars; iv++) {
+	if (ncvarinq(ncid, iv, NULL, NULL, &ndims, dimids, NULL) == -1)
+	  return -1;
+	if (ndims > 0 && dimids[0] == recdimid) {
+	    if (recvarids)
+	      recvarids[nrecvars] = iv;
+	    nrecvars++;
+	}
+    }
+    return nrecvars;
+}
+
+
+/*
+ * Returns record size (in bytes) of the record variable with a specified
+ * variable id.  Returns 0 if not a record variable.  Returns -1 on error.
+ */
+static long
+ncrecsize(ncid,vid)
+     int ncid;
+     int vid;
+{
+    int recdimid;
+    nc_type type;
+    int ndims;
+    int dimids[H4_MAX_VAR_DIMS];
+    int id;
+    long size;
+
+    if (ncinquire(ncid, NULL, NULL, NULL, &recdimid) == -1)
+      return -1;
+    if (ncvarinq(ncid, vid, 0, &type, &ndims, dimids, NULL) == -1)
+      return -1;
+    if (ndims == 0 || dimids[0] != recdimid)
+      return 0;
+    size = nctypelen(type);
+    for (id = 1; id < ndims; id++) {
+	long len;
+	(void) ncdiminq(ncid, dimids[id], 0, &len);
+	size *= len;
+    }
+    return size;
+}
+
+
+/*
+ * Retrieves the number of record variables, the record variable ids, and the
+ * record size of each record variable.  If any pointer to info to be returned
+ * is null, the associated information is not returned.  Returns -1 on error.
+ * This is the same as the ncrecinq() in the library, except that can handle
+ * errors better.
+ */
+static int
+recinq(ncid, nrecvars, recvarids, recsizes)
+     int ncid;
+     int *nrecvars;
+     int *recvarids;
+     long *recsizes;
+{
+    int iv;
+    int rvarids[VARS];
+    int nrvars = numrecvars(ncid, rvarids);
+
+    if (nrvars == -1)
+      return -1;
+
+    if (nrecvars)
+      *nrecvars = nrvars;
+    if (recvarids)
+      for (iv = 0; iv < nrvars; iv++)
+	recvarids[iv] = rvarids[iv];
+    if (recsizes)
+      for (iv = 0; iv < nrvars; iv++)
+	recsizes[iv] = ncrecsize(ncid, rvarids[iv]);
+    return 0;
+}
+
+
+/*
+ * Test ncrecinq
+ *    try in both data and define modes
+ *    check returned values against independently computed values
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncrecinq(path)
+     char *path;		/* name of netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncrecinq";
+    int ncid;
+    int nrvars;			/* number of record variables */
+    int rvarids[VARS];	/* id of each record variable */
+    long rvarsizes[VARS]; /* record size of each record variable */
+    int tnrvars;		/* true number of record variables */
+    int trvarids[VARS];	/* true id of each record variable */
+    long trvarsizes[VARS]; /* true rec size of each record variable */
+    int iv;
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((ncid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+
+    /* First compute independently what ncrecinq should return */
+    if (recinq(ncid, &tnrvars, trvarids, trvarsizes) == -1) {
+	error("%s: recinq failed", pname);
+	ncclose(ncid);
+	return;
+    }
+
+    /* check that ncrecinq() returns correct information in data mode */
+    if (ncrecinq(ncid, &nrvars, rvarids, rvarsizes) == -1) {
+	error("%s: ncrecinq failed", pname);
+	ncclose(ncid);
+	return;
+    }
+
+    if (nrvars != tnrvars) {
+	error("ncrecinq returned wrong number of rec vars, %d != %d",
+	      nrvars, tnrvars);
+	nerrs++;
+    }
+
+    for (iv = 0; iv < nrvars; iv++) {
+	if (rvarids[iv] != trvarids[iv]) {
+	    error("ncrecinq returned wrong record id for var %d",
+		  trvarids[iv]);
+	    nerrs++;
+	}
+	if (rvarsizes[iv] != trvarsizes[iv]) {
+	    error("ncrecinq returned wrong record size for var %d",
+		  trvarids[iv]);
+	    nerrs++;
+	}
+    }
+
+    if (ncredef(ncid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(ncid);
+	return;
+    }
+    /* check that ncrecinq() returns correct information in define mode too */
+    if (ncrecinq(ncid, &nrvars, rvarids, rvarsizes) == -1) {
+	error("%s: ncrecinq failed in define mode", pname);
+	ncclose(ncid);
+	return;
+    }
+    if (nrvars != tnrvars) {
+	error("define mode, ncrecinq returned wrong num of rec vars, %d != %d",
+	      nrvars, tnrvars);
+	nerrs++;
+    }
+    for (iv = 0; iv < nrvars; iv++) {
+	if (rvarids[iv] != trvarids[iv]) {
+	    error("define mode, ncrecinq returned wrong record id for var %d",
+		  trvarids[iv]);
+	    nerrs++;
+	}
+	if (rvarsizes[iv] != trvarsizes[iv]) {
+	    error("define mode, ncrecinq returned wrong rec size for var %d",
+		  trvarids[iv]);
+	    nerrs++;
+	}
+    }
+
+    if (ncclose (ncid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+
+    if (ncrecinq(ncid, &nrvars, rvarids, rvarsizes) != -1) {
+	error("%s: ncrecinq failed to report bad handle", pname);
+	nerrs++;
+    }
+    
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Retrieves the dimension sizes of a variable with a specified variable id in
+ * an open netCDF file.  Returns -1 on error.
+ */
+static int
+dimsizes(ncid, varid, sizes)
+     int ncid;
+     int varid;
+     long *sizes;
+{
+    int ndims;
+    int id;
+    int dimids[H4_MAX_VAR_DIMS];
+
+    if (ncvarinq(ncid, varid, 0, NULL, &ndims, dimids, NULL) == -1)
+      return -1;
+    if (ndims == 0 || sizes == 0)
+      return 0;
+    for (id = 0; id < ndims; id++)
+      (void) ncdiminq(ncid, dimids[id], 0, &sizes[id]);
+    return 0;
+}
+
+
+/*
+ * Write one record's worth of data, except don't write to variables for which
+ * the address of the data to be written is NULL.  Return -1 on error.  This is
+ * the same as the ncrecput() in the library, except that can handle errors
+ * better.
+ */
+static int
+recput(ncid, recnum, datap)
+     int ncid;
+     long recnum;
+     void **datap;
+{
+    int iv;
+    int rvids[VARS];
+    int nrvars = numrecvars(ncid, rvids);
+    long start[H4_MAX_VAR_DIMS];
+    long edges[H4_MAX_VAR_DIMS];
+
+    if (nrvars == -1)
+      return -1;
+
+    start[0] = recnum;
+    for (iv = 1; iv < nrvars; iv++)
+	start[iv] = 0;
+
+    for (iv = 0; iv < nrvars; iv++) {
+	if (datap[iv] != 0) {
+	    (void) dimsizes(ncid, rvids[iv], edges);
+	    edges[0] = 1;		/* only 1 record's worth */
+	    if (ncvarput(ncid, rvids[iv], start, edges, datap[iv]) == -1)
+	      return -1;
+	}
+    }    
+    return 0;
+}
+
+
+/*
+ * Read one record's worth of data, except don't read from variables for which
+ * the address of the data to be read is null.  Return -1 on error.  This is
+ * the same as the ncrecget() in the library, except that can handle errors
+ * better.
+ */
+static int
+recget(ncid, recnum, datap)
+     int ncid;
+     long recnum;
+     void **datap;
+{
+    int iv;
+    int rvids[VARS];
+    int nrvars = numrecvars(ncid, rvids);
+    long start[H4_MAX_VAR_DIMS];
+    long edges[H4_MAX_VAR_DIMS];
+
+    if (nrvars == -1)
+      return -1;
+
+    start[0] = recnum;
+    for (iv = 1; iv < nrvars; iv++)
+	start[iv] = 0;
+
+    for (iv = 0; iv < nrvars; iv++) {
+	if (datap[iv] != 0) {
+	    (void) dimsizes(ncid, rvids[iv], edges);
+	    edges[0] = 1;		/* only 1 record's worth */
+	    if (ncvarget(ncid, rvids[iv], start, edges, datap[iv]) == -1)
+	      return -1;
+	}
+    }    
+    return 0;
+}
+
+
+/*
+ * Test ncrecput
+ *    check that proper call works putting all recoerd variables
+ *    try putting only a proper subset of variables
+ *    try putting the empty subset of variables
+ *    try in define mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncrecput(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncrecput";
+    int nrvars;			/* number of record variables */
+    int rvarids[VARS];	/* id of each record variable */
+    long rvarsizes[VARS]; /* record size of each record variable */
+    int ncid;			/* netcdf id */
+    void *datap[VARS];	/* array of address pointers for rec vars */
+    void *datar[VARS];	/* pointers for comparison data */
+    long recnum = 1;		/* we'll write the second record */
+    int iv;
+    long recsize[VARS];	/* record size in data elements */
+    nc_type vartype[VARS];
+    void *zeros[VARS];
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((ncid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+
+    if (ncrecinq(ncid, &nrvars, rvarids, rvarsizes) == -1) {
+	error("%s: ncrecinq failed", pname);
+	ncclose(ncid);
+	return;
+    }
+
+    /* get a block of data of the right type for each record variable */
+    for (iv = 0; iv < nrvars; iv++) {
+	datap[iv] = emalloc(rvarsizes[iv]);
+	datar[iv] = emalloc(rvarsizes[iv]); /* for comparison values */
+	if (ncvarinq(ncid, rvarids[iv], 0, &vartype[iv], NULL, NULL, NULL) == -1) {
+	    error("%s: ncvarinq failed", pname);
+	    ncclose(ncid);
+	    return;
+	}
+	recsize[iv] = rvarsizes[iv]/nctypelen(vartype[iv]);
+	/* Fill data blocks with 0,1,2,3,... */
+	val_fill(vartype[iv], recsize[iv], datap[iv]);
+	/* Zero out comparison data */
+	val_fill_zero(vartype[iv], recsize[iv], datar[iv]);
+    }
+
+    /* Zero data in recnum record, before trying to put non-zero data */
+    if (recput(ncid, recnum, datar) == -1) {
+	error("%s: recput failed", pname);
+	ncclose(ncid);
+	return;
+    }
+
+    /* opened in data mode, try putting a complete record */
+    if (ncrecput(ncid, recnum, datap) == -1) {
+	error("%s: ncrecput failed on complete record", pname);
+	nerrs++;
+    }
+
+    /* Check that right values were put */
+    if (recget(ncid, recnum, datar) == -1) {
+	error("%s: recget failed", pname);
+	nerrs++;
+    }
+    for (iv = 0; iv < nrvars; iv++) {
+	if (val_cmp(vartype[iv], recsize[iv], datap[iv], datar[iv]) != 0) {
+	    error("%s: bad values written by recput", pname);
+	    nerrs++;
+	}
+	val_fill_zero(vartype[iv], recsize[iv], datap[iv]);
+	val_fill_zero(vartype[iv], recsize[iv], datar[iv]);
+	zeros[iv] = 0;
+    }
+    
+    if (nrvars > 0) {
+	void *datap0 = datap[0];
+
+	/* put a partial record, everything but first record variable */
+	datap[0] = 0;
+	val_fill(vartype[0], recsize[0], datar[0]);
+	if (ncrecput(ncid, recnum, datap) == -1) {
+	    error("%s: ncrecput failed on partial record", pname);
+	    nerrs++;
+	}
+
+	/* Check right values were put, first record variable undisturbed */
+	datap[0] = datap0;
+	if (recget(ncid, recnum, datap) == -1) {
+	    error("%s: recget failed after partial record put", pname);
+	    nerrs++;
+	}
+	for (iv = 0; iv < nrvars; iv++) {
+	    if (val_cmp(vartype[iv], recsize[iv], datap[iv], datar[iv]) != 0) {
+		error("%s: bad values written by partial recput", pname);
+		nerrs++;
+	    }
+	}
+    }
+
+    /* Put an empty record, check that values remain undisturbed */
+    if (ncrecput(ncid, recnum, zeros) == -1) {
+	error("%s: ncrecput failed on empty record", pname);
+	nerrs++;
+    }
+    if (recget(ncid, recnum, datap) == -1) {
+	error("%s: recget failed after empty record put", pname);
+	nerrs++;
+    }
+    for (iv = 0; iv < nrvars; iv++) {
+	if (val_cmp(vartype[iv], recsize[iv], datap[iv], datar[iv]) != 0) {
+	    error("%s: bad values written by empty recput", pname);
+	    nerrs++;
+	}
+    }
+
+    /* try in define mode, check error */
+    if (ncredef(ncid) == -1) {
+	error("%s: ncredef failed", pname);
+ 	ncclose(ncid);
+	return;
+    }
+
+    if (ncrecput(ncid, recnum, datap) != -1) {
+	error("%s: ncrecput should fail in define mode", pname);
+	nerrs++;
+    }
+
+    /* try with bad netCDF handle, check error */
+    if (ncclose (ncid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    if (ncrecput(ncid, recnum, datap) != -1) {
+	error("%s: ncrecput failed to report bad handle", pname);
+	nerrs++;
+    }
+    for (iv = 0; iv < nrvars; iv++) {
+	Free(datap[iv]);
+	Free(datar[iv]);
+    }
+
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncrecget
+ *    check that proper call works getting all record variables
+ *    try getting only a proper subset of variables
+ *    try getting the empty subset of variables
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncrecget(path)
+     char *path;		/* name of netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncrecget";
+    int nrvars;			/* number of record variables */
+    int rvarids[VARS];	/* id of each record variable */
+    long rvarsizes[VARS]; /* record size of each record variable */
+    int ncid;			/* netcdf id */
+    void *datap[VARS];	/* array of address pointers for rec vars */
+    void *datar[VARS];	/* pointers for comparison data */
+    long recnum = 1;		/* we'll write the second record */
+    int iv;
+    long recsize[VARS];	/* record size in data elements */
+    nc_type vartype[VARS];
+    void *zeros[VARS];
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((ncid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+
+    if (ncrecinq(ncid, &nrvars, rvarids, rvarsizes) == -1) {
+	error("%s: ncrecinq failed", pname);
+	ncclose(ncid);
+	return;
+    }
+
+    /* get a block of data of the right type for each record variable */
+    for (iv = 0; iv < nrvars; iv++) {
+	datap[iv] = emalloc(rvarsizes[iv]);
+	datar[iv] = emalloc(rvarsizes[iv]); /* for comparison values */
+	if (ncvarinq(ncid, rvarids[iv], 0, &vartype[iv], NULL, NULL, NULL) == -1) {
+	    error("%s: ncvarinq failed", pname);
+	    ncclose(ncid);
+	    return;
+	}
+	recsize[iv] = rvarsizes[iv]/nctypelen(vartype[iv]);
+	/* Fill data blocks with 0,1,2,3,... */
+	val_fill(vartype[iv], recsize[iv], datap[iv]);
+	/* Zero out comparison data */
+	val_fill_zero(vartype[iv], recsize[iv], datar[iv]);
+    }
+
+    if (recput(ncid, recnum, datap) == -1) {
+	error("%s: recput failed", pname);
+	ncclose(ncid);
+	return;
+    }
+
+    /* opened in data mode, try getting a complete record */
+    if (recget(ncid, recnum, datap) == -1) {
+	error("%s: recget failed on complete record", pname);
+	nerrs++;
+    }
+    if (ncrecget(ncid, recnum, datar) == -1) {
+	error("%s: ncrecget failed on complete record", pname);
+	nerrs++;
+    }
+
+    for (iv = 0; iv < nrvars; iv++) {
+	if (val_cmp(vartype[iv], recsize[iv], datap[iv], datar[iv]) != 0) {
+	    error("%s: bad values written by recget", pname);
+	    nerrs++;
+	}
+	val_fill_zero(vartype[iv], recsize[iv], datap[iv]);
+	val_fill_zero(vartype[iv], recsize[iv], datar[iv]);
+	zeros[iv] = 0;
+    }
+    
+    if (nrvars > 0) {
+	void *datap0 = datap[0];
+	void *datar0 = datar[0];
+
+	/* get a partial record, everything but first record variable */
+	datap[0] = 0;
+	if (ncrecget(ncid, recnum, datap) == -1) {
+	    error("%s: ncrecget failed on partial record", pname);
+	    nerrs++;
+	}
+	datar[0] = 0;
+	if (recget(ncid, recnum, datar) == -1) {
+	    error("%s: recget failed on partial record", pname);
+	    nerrs++;
+	}
+	/* Check right values were got, first record variable undisturbed */
+	datap[0] = datap0;
+	datar[0] = datar0;
+	for (iv = 0; iv < nrvars; iv++) {
+	    if (val_cmp(vartype[iv], recsize[iv], datap[iv], datar[iv]) != 0) {
+		error("%s: bad values read by partial recget", pname);
+		nerrs++;
+	    }
+	}
+    }
+
+    /* Get an empty record */
+    if (ncrecget(ncid, recnum, zeros) == -1) {
+	error("%s: ncrecget failed on empty record", pname);
+	nerrs++;
+    }
+
+    /* try with bad netCDF handle, check error */
+    if (ncclose (ncid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    if (ncrecget(ncid, recnum, datap) != -1) {
+	error("%s: ncrecget failed to report bad handle", pname);
+	nerrs++;
+    }
+    for (iv = 0; iv < nrvars; iv++) {
+	Free(datap[iv]);
+	Free(datar[iv]);
+    }
+
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/slabs.c b/mfhdf/nctest/slabs.c
new file mode 100644
index 0000000..f8c1f75
--- /dev/null
+++ b/mfhdf/nctest/slabs.c
@@ -0,0 +1,463 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: slabs.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define LEN_OF(array) ((sizeof array) / (sizeof array[0]))
+/* dimension sizes */
+#define NDIMS   4		/* number of dimensions */
+#define WSIZE	7		/* sizes of dimensions */
+#define XSIZE	5
+#define YSIZE   6
+#define ZSIZE   4
+/* Added new function for character and byte so we will not overflow; pgcc
+   compiler screamed at VF macro */
+#define VFC(w)  (1000*w[0]+100*w[1]+10*w[2]+w[3])%64 + 48
+/* Any function that maps dimension values 1-1 to values is OK here */
+#define VF(w)  (1000*w[0]+100*w[1]+10*w[2]+w[3])
+#define NVARS   6		/* number of variables */
+
+
+/*
+ * Fill typed array element with specified value, that is
+ * 	
+ * 	v[ii] = val;
+ */
+static void
+val_stuff(type, v, ii, val)	/* v[ii] = val */
+     nc_type type;		/* netcdf type of v, NC_BYTE, ..., NC_DOUBLE */
+     void *v;			/* array of specified type */
+     int ii;			/* it's v[ii] we want to store into */
+     long val;			/* value to store */
+{
+    static char pname[] = "val_stuff";
+#ifdef WRONG_for_PGCC /* This way caused a lot of problems for PGI CC compiler
+                         EIP 2004/12/15 */
+    union gp {
+	char cp[1];
+	short sp[1];
+	nclong lp[1];
+	float fp[1];
+	double dp[1];
+    } *gp;
+
+    gp = (union gp *) v;
+    switch (type) {
+    case NC_BYTE:
+    case NC_CHAR:
+	gp->cp[ii] = (char) val;
+	break;
+    case NC_SHORT:
+        gp->sp[ii] = (short)val;
+	break;
+    case NC_LONG:
+	gp->lp[ii] = (nclong)val;
+	break;
+    case NC_FLOAT:
+        gp->fp[ii] = (float)val;
+	break;
+    case NC_DOUBLE:
+	gp->dp[ii] = val;
+	break;
+    default:
+	error("%s: bad type, test program error", pname);
+#endif /*WRONG_for_PGCC*/
+    switch (type) {
+    case NC_BYTE:
+    case NC_CHAR:
+	((char *)v)[ii] = (char) val;
+	break;
+    case NC_SHORT:
+        ((short *)v)[ii] = (short)val;
+	break;
+    case NC_LONG:
+	((nclong *)v)[ii] = (nclong)val;
+	break;
+    case NC_FLOAT:
+        ((float *)v)[ii] = (float)val;
+	break;
+    case NC_DOUBLE:
+	((double *)v)[ii] = (double)val;
+	break;
+    default:
+	error("%s: bad type, test program error", pname);
+    }
+}
+
+
+/*
+ * Compare typed array element with specified value, that is return
+ *
+ * 	(v[ii] != val)
+ *
+ * returns 0 if equal, 1 if not equal 
+ */
+
+static int
+val_diff(type, v, ii, val)	/* v[ii] != val */
+     nc_type type;		/* netcdf type of v, NC_BYTE, ..., NC_DOUBLE */
+     void *v;			/* array of specified type */
+     int ii;			/* it's v[ii] we want to compare */
+     long val;			/* value to compare with */
+{
+    static char pname[] = "val_diff";
+#ifdef WRONG_for_PGCC /* This way caused a lot of problems for PGI CC compiler
+                         EIP 2004/12/15 */
+    union gp {
+	char cp[1];
+	short sp[1];
+	nclong lp[1];
+	float fp[1];
+	double dp[1];
+    } *gp;
+
+    gp = (union gp *) v;
+    switch (type) {
+      case NC_BYTE:
+      case NC_CHAR:
+	return (gp->cp[ii] != (char) val);
+      case NC_SHORT:
+	return (gp->sp[ii] != (short) val);
+      case NC_LONG:
+	return (gp->lp[ii] != (nclong) val);
+      case NC_FLOAT:
+	return (gp->fp[ii] != (float) val);
+      case NC_DOUBLE:
+	return (gp->dp[ii] != (double) val);
+      default:
+	error("%s: bad type, test program error", pname);
+	return (-1);
+#endif /*WRONG_for_PGCC*/
+    switch (type) {
+      case NC_BYTE:
+      case NC_CHAR:
+	return (((char*)v)[ii] != (char) val);
+      case NC_SHORT:
+	return (((short*)v)[ii] != (short) val);
+      case NC_LONG:
+	return (((nclong*)v)[ii] != (nclong) val);
+      case NC_FLOAT:
+	return (((float*)v)[ii] != (float) val);
+      case NC_DOUBLE:
+	return (((double*)v)[ii] != (double) val);
+      default:
+	error("%s: bad type, test program error", pname);
+	return (-1);
+    }
+}
+
+
+/*
+ * For each type of variable, put a four-dimensional hypercube of values
+ * with a single call to ncvarput.  Then use ncvarget to retrieve a single
+ * interior value, an interior vector of values along each of the four
+ * dimensions, an interior plane of values along each of the six pairs of
+ * dimensions, and an interior cube of values along each of the four
+ * triples of dimensions.  In each case, compare the retrieved values with
+ * the written values.
+ */
+
+int
+test_slabs(cdfid)
+     int cdfid;			/* handle of netcdf open and in data mode */
+{
+    int nerrs = 0;
+    static char pname[] = "test_slabs";
+    static struct cdfdim dims[NDIMS] = {
+	{"w", WSIZE},
+	{"x", XSIZE},
+	{"y", YSIZE},
+	{"z", ZSIZE}
+    };
+    int dimids[NDIMS];		/* dimension ids */
+    long corner[NDIMS], edge[NDIMS], point[NDIMS];
+
+    static struct cdfvar va[NVARS] = { /* variables of all types */
+	{"bytevar", NC_BYTE, NDIMS, ___, 0},
+	{"charvar", NC_CHAR, NDIMS, ___, 0},
+	{"shortvar", NC_SHORT, NDIMS, ___, 0},
+	{"longvar", NC_LONG, NDIMS, ___, 0},
+	{"floatvar", NC_FLOAT, NDIMS, ___, 0},
+	{"doublevar", NC_DOUBLE, NDIMS, ___, 0},
+    };
+    void *v;
+
+    int varid[NVARS], iv;			/* variable id */
+    int idim, jdim, kdim, ldim;
+    int iw, ix, iy, iz, ii, jj, kk;
+
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return 1;
+    }
+
+    /* back in define mode OK, now add dimensions */
+
+    for (idim = 0; idim < NDIMS; idim++) {
+	dimids[idim] = ncdimdef(cdfid, dims[idim].name, dims[idim].size);
+	if (dimids[idim] == -1) {
+	    error("%s: ncdimdef failed", pname);
+	    ncclose(cdfid);
+	    return 1;
+	}
+	add_dim(&test, &dims[idim]);
+    }
+
+    /* define a multi-dimensional variable of each type */
+
+    for (iv = 0; iv < NVARS; iv++) {
+	va[iv].dims = (int *) emalloc(sizeof(int) * va[iv].ndims);
+	for (idim = 0; idim < va[iv].ndims; idim++)
+	  va[iv].dims[idim] = dimids[idim];
+	varid[iv] = ncvardef(cdfid, va[iv].name, va[iv].type, va[iv].ndims,
+			     va[iv].dims);
+	if (varid[iv] == -1) {
+	    error("%s: ncvardef failed", pname);
+	    ncclose(cdfid); return 1;
+	}
+	add_var(&test, &va[iv]); /* keep in-memory netcdf in sync */
+    }
+
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return 1;
+    }
+
+    for (iv = 0; iv < NVARS; iv++) { /* test each type of variable */
+        
+	v = emalloc(WSIZE*XSIZE*YSIZE*ZSIZE * nctypelen(va[iv].type));
+	/* fill it with values using a function of dimension indices */
+	ii = 0;
+	for (iw=0; iw < WSIZE; iw++) {
+	    corner[0] = iw;
+	    for (ix=0; ix < XSIZE; ix++) {
+		corner[1] = ix;
+		for (iy=0; iy < YSIZE; iy++) {
+		    corner[2] = iy;
+		    for (iz=0; iz < ZSIZE; iz++) {
+			corner[3] = iz;
+			/* v[ii++] = VF(corner); */
+                        if (va[iv].type == NC_BYTE || va[iv].type == NC_CHAR) 
+			val_stuff(va[iv].type, v, ii, VFC(corner));
+                        else
+                        val_stuff(va[iv].type, v, ii, VF(corner));
+			ii++;
+		    }
+		}
+	    }
+	}
+ 	
+	for (idim = 0; idim < NDIMS; idim++) {
+	    corner[idim] = 0;
+	    edge[idim] = dims[idim].size;
+	}
+      
+	/* ncvarput the whole variable */
+	if (ncvarput(cdfid, varid[iv], corner, edge, (void *) v) == -1) {
+	    error("%s: ncvarput failed", pname);
+	    nerrs++;
+	}
+
+	add_data(&test, varid[iv], corner, edge); /* keep test in sync */
+	/*
+	 * For several combinations of fixed dimensions, get a slab and compare
+	 * values to function values.
+	 */
+
+	/* get an interior point */
+	for (idim=0; idim < NDIMS; idim++) {
+	    corner[idim] = dims[idim].size/2;
+	    edge[idim] = 1;
+	    point[idim] = corner[idim];
+	}
+	if (ncvarget(cdfid, varid[iv], corner, edge, (void *) v) == -1) {
+	    error("%s: ncvarget of one point failed", pname);
+	    nerrs++;
+	}
+	/* if (v[0] != VF(point)) */
+        if (va[iv].type == NC_BYTE || va[iv].type == NC_CHAR) {
+
+	if (val_diff(va[iv].type, v, 0, VFC(point))) {
+	    error("%s: ncvarget got wrong value for point", pname);
+	    nerrs++;
+        }
+        }
+        else
+        {
+	if (val_diff(va[iv].type, v, 0, VF(point))) {
+	    error("%s: ncvarget got wrong value for point", pname);
+	    nerrs++;
+	}
+        }
+	 /*endif NC_BYTE || NC_CHAR */
+                
+	/* get an interior vector in each direction */
+	for (idim=0; idim < NDIMS; idim++) {
+	    for (jdim=0; jdim < NDIMS; jdim++) {
+		corner[jdim] = dims[jdim].size/2;
+		edge[jdim] = 1;
+		point[jdim] = corner[jdim];
+	    }
+	    corner[idim] = 1;		/* get vector along dimension idim */
+	    edge[idim] = dims[idim].size - 2;
+	    if (ncvarget(cdfid, varid[iv], corner, edge, (void *) v) == -1) {
+		error("%s: ncvarget of vector failed", pname);
+		nerrs++;
+	    }
+	    for (ii=corner[idim]; ii <= edge[idim]; ii++) {
+		point[idim] = ii;
+		/* if (v[ii-1] != VF(point)) */
+        if (va[iv].type == NC_BYTE || va[iv].type == NC_CHAR){ 
+		if (val_diff(va[iv].type, v, ii-1, VFC(point))) {
+		    error("%s: ncvarget got wrong value for vector", pname);
+		    nerrs++;
+		}
+                }
+        else
+                {
+		if (val_diff(va[iv].type, v, ii-1, VF(point))) {
+		    error("%s: ncvarget got wrong value for vector", pname);
+		    nerrs++;
+		}
+                }
+	    }
+	}
+
+	/* get an interior plane in each direction */
+	for (idim=0; idim < NDIMS; idim++) {
+	    for (jdim=idim+1; jdim < NDIMS; jdim++) {
+		for (kdim=0; kdim < NDIMS; kdim++) { /* reset corners and edges */
+		    corner[kdim] = dims[kdim].size/2;
+		    edge[kdim] = 1;
+		    point[kdim] = corner[kdim];
+		}
+		corner[idim] = 1;	/* interior plane along dimensions idim jdim */
+		corner[jdim] = 1;
+		edge[idim] = dims[idim].size - 2;
+		edge[jdim] = dims[jdim].size - 2;
+		if (ncvarget(cdfid, varid[iv], corner, edge, (void *) v) == -1) {
+		    error("%s: ncvarget of plane failed", pname);
+		    nerrs++;
+		}
+		for (ii=corner[idim]; ii <= edge[idim]; ii++) {
+		    for (jj=corner[jdim]; jj <= edge[jdim]; jj++) {
+			point[idim] = ii;
+			point[jdim] = jj;
+			/* if (v[(ii-1)*edge[jdim]+jj-1] != VF(point)) { */
+        if (va[iv].type == NC_BYTE || va[iv].type == NC_CHAR) {
+			if (val_diff(va[iv].type, v,
+				     (ii-1)*(int)edge[jdim]+jj-1, VFC(point))) {
+			    error("%s: ncvarget got wrong value in plane", pname);
+			    error("idim=%d,jdim=%d,ii=%d,jj=%d",
+				  idim,
+				  jdim,
+				  ii,
+				  jj);
+			    nerrs++;
+			}
+                        }
+         else
+                        {
+			if (val_diff(va[iv].type, v,
+				     (ii-1)*(int)edge[jdim]+jj-1, VF(point))) {
+			    error("%s: ncvarget got wrong value in plane", pname);
+			    error("idim=%d,jdim=%d,ii=%d,jj=%d",
+				  idim,
+				  jdim,
+				  ii,
+				  jj);
+			    nerrs++;
+			}
+                        }
+		    }
+		}
+	    }
+	}
+	
+	/* get an interior cube in each direction */
+	for (idim=0; idim < NDIMS; idim++) {
+	    for (jdim=idim+1; jdim < NDIMS; jdim++) {
+		for (kdim=jdim+1; kdim < NDIMS; kdim++) {
+		    for (ldim=0; ldim < NDIMS; ldim++) { /* reset corners, edges */
+			corner[ldim] = dims[ldim].size/2;
+			edge[ldim] = 1;
+			point[ldim] = corner[ldim];
+		    }
+		    corner[idim] = 1;	/* intr. cube along idim jdim kdim */
+		    corner[jdim] = 1;
+		    corner[kdim] = 1;
+		    edge[idim] = dims[idim].size - 2;
+		    edge[jdim] = dims[jdim].size - 2;
+		    edge[kdim] = dims[kdim].size - 2;
+		    if (ncvarget(cdfid, varid[iv], corner, edge, (void *) v) == -1) {
+			error("%s: ncvarget of cube failed", pname);
+			nerrs++;
+		    }
+		    for (ii=corner[idim]; ii <= edge[idim]; ii++) {
+			for (jj=corner[jdim]; jj <= edge[jdim]; jj++) {
+			    for (kk=corner[kdim]; kk <= edge[kdim]; kk++) {
+				point[idim] = ii;
+				point[jdim] = jj;
+				point[kdim] = kk;
+				/* if (v[((ii-1)*edge[jdim]+jj-1)*
+				   edge[kdim]+kk-1] != VF(point)) { */
+        if (va[iv].type == NC_BYTE || va[iv].type == NC_CHAR) {
+				if (val_diff(va[iv].type,v,
+					     ((ii-1)*(int)edge[jdim]+jj-1)*
+					     (int)edge[kdim]+kk-1,VFC(point))) {
+				    error("%s: ncvarget got wrong value in cube", pname);
+				    error("idim=%d,jdim=%d,kdim=%d,ii=%d,jj=%d,kk=%d",
+					  idim,
+					  jdim,
+					  kdim,
+					  ii,
+					  jj,
+					  kk);
+				    nerrs++;
+				}
+                                }
+         else
+                                {
+				if (val_diff(va[iv].type,v,
+					     ((ii-1)*(int)edge[jdim]+jj-1)*
+					     (int)edge[kdim]+kk-1,VF(point))) {
+				    error("%s: ncvarget got wrong value in cube", pname);
+				    error("idim=%d,jdim=%d,kdim=%d,ii=%d,jj=%d,kk=%d",
+					  idim,
+					  jdim,
+					  kdim,
+					  ii,
+					  jj,
+					  kk);
+				    nerrs++;
+				}
+                                }
+			    }
+			}
+		    }
+		}
+	    }
+	}
+	Free((char *)v);
+   } 
+    return nerrs;
+}
+
diff --git a/mfhdf/nctest/test_unlim.cdl b/mfhdf/nctest/test_unlim.cdl
new file mode 100644
index 0000000..c6ad739
--- /dev/null
+++ b/mfhdf/nctest/test_unlim.cdl
@@ -0,0 +1,31 @@
+netcdf new {
+dimensions:
+	x    = 2;
+	y    = 3;
+	time = UNLIMITED ; // (12 currently)
+variables:
+        float a(x,y);
+	int date(time) ;
+	int time(time) ;
+        short b(time, y, x);
+data:
+ a = 1.0, 2.0, 3.0, 4.0, 5.0, 6.0;
+
+ date = 840116, 840214, 840316, 840415, 840516, 840615, 840716, 840816, 
+    840915, 841016, 841115, 841216 ;
+
+ time = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ;
+  
+ b = 1, 1, 2, 2, 3, 3,
+     4, 4, 5, 5, 6, 6,
+     7, 7, 8, 8, 9, 9,
+    10, 10, 11, 11, 12, 12,
+    13, 13, 14, 14, 15, 15,
+    16, 16, 17, 17, 18, 18,
+    19, 19, 20, 20, 21, 22,
+    23, 23, 24, 24, 25, 25,
+    26, 26, 27, 27, 28, 28,
+    29, 29, 30, 30, 31, 31,
+    32, 32, 33, 33, 34, 34,
+    35, 35, 36, 36, 37, 37 ;
+}
diff --git a/mfhdf/nctest/test_unlim.nc b/mfhdf/nctest/test_unlim.nc
new file mode 100644
index 0000000..56d8176
Binary files /dev/null and b/mfhdf/nctest/test_unlim.nc differ
diff --git a/mfhdf/nctest/testcdf.h b/mfhdf/nctest/testcdf.h
new file mode 100644
index 0000000..8809132
--- /dev/null
+++ b/mfhdf/nctest/testcdf.h
@@ -0,0 +1,67 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: testcdf.h 4997 2007-11-15 18:12:15Z epourmal $
+ *********************************************************************/
+
+/*
+ * In-memory structure holding netcdf structure for comparing with
+ * on-disk netcdf.  Whenever a disk netcdf is updated in the test
+ * package, this structure should be updated at the same time, to keep
+ * them in sync.
+ */
+
+
+#include <stdlib.h>
+#ifdef HDF
+#include "mfhdf.h"
+#endif
+#define ___ 0			/* marker for structure place-holder */
+#define BAD_TYPE  NC_UNSPECIFIED /* must be distinct from valid types */
+
+#ifdef DELETE_CHUNK
+void *emalloc();
+void *erealloc();
+#endif
+
+struct cdfdim {			/* dimension */
+    char *name;
+    long size;
+};
+
+struct cdfvar {			/* variable */
+    char *name;
+    nc_type type;
+    int ndims;
+    int *dims;
+    int natts;
+};
+
+struct cdfatt {			/* attribute */
+    int var;
+    char *name;
+    nc_type type;
+    int len;
+    void *val;
+};
+
+#define MAX_TEST_DIMS 32
+#define MAX_TEST_VARS 32
+#define MAX_TEST_ATTS 32
+
+struct netcdf {
+    int ndims;			/* number of dimensions declared for netcdf */
+    int nvars;			/* number of variables declared for netcdf */
+    int natts;			/* number of attributes */
+    int ngatts;			/* number of global attributes */
+    int xdimid;			/* number of the unlimited dimension, if any */
+    struct cdfdim dims[MAX_TEST_DIMS]; /* dimensions */
+    struct cdfvar vars[MAX_TEST_VARS]; /* variables */
+    struct cdfatt atts[MAX_TEST_ATTS]; /* attributes */
+};
+
+
+extern struct netcdf test;	/*
+				 * in-memory netcdf structure, kept in sync
+				 * with disk netcdf
+				 */
diff --git a/mfhdf/nctest/tests.h b/mfhdf/nctest/tests.h
new file mode 100644
index 0000000..bb64af3
--- /dev/null
+++ b/mfhdf/nctest/tests.h
@@ -0,0 +1,132 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: tests.h 4445 2003-12-10 21:15:54Z epourmal $
+ *********************************************************************/
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void	test_nccreate	PROTO((
+				       char*
+				       ));
+extern void	test_ncopen	PROTO((
+				       char*
+				       ));
+extern void	test_ncredef	PROTO((
+				       char*
+				       ));
+extern void	test_ncendef	PROTO((
+				       char*
+				       ));
+extern void	test_ncclose	PROTO((
+				       char*
+				       ));
+extern void	test_ncinquire	PROTO((
+				       char*
+				       ));
+extern void	test_ncsync	PROTO((
+				       char*
+				       ));
+extern void	test_ncabort	PROTO((
+				       char*
+				       ));
+extern void	test_ncdimdef	PROTO((
+				       char*
+				       ));
+extern void	test_ncdimid	PROTO((
+				       char*
+				       ));
+extern void	test_ncdiminq	PROTO((
+				       char*
+				       ));
+extern void	test_ncdimrename	PROTO((
+					       char*
+					       ));
+extern void	test_ncvardef	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarid	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarinq	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarput1	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarget1	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarput	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarget	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarputg	PROTO((
+				       char*
+				       ));
+extern void	test_ncvargetg	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarget_unlim	PROTO((
+				       char*
+				       ));
+extern void	test_ncrecinq	PROTO((
+				       char*
+				       ));
+extern void	test_ncrecput	PROTO((
+				       char*
+				       ));
+extern void	test_ncrecget	PROTO((
+				       char*
+				       ));
+extern void	test_ncvarrename	PROTO((
+					       char*
+					       ));
+extern void	test_ncattput	PROTO((
+				       char*
+				       ));
+extern void	test_ncattinq	PROTO((
+				       char*
+				       ));
+extern void	test_ncattget	PROTO((
+				       char*
+				       ));
+extern void	test_ncattcopy	PROTO((
+				       char*,
+				       char*
+				       ));
+extern void	test_ncattname	PROTO((
+				       char*
+				       ));
+extern void	test_ncattrename	PROTO((
+					       char*
+					       ));
+extern void	test_ncattdel	PROTO((
+				       char*
+				       ));
+extern void	test_nctypelen	PROTO((
+				       ));
+extern int test_varputget   PROTO((
+                        int
+                        ));
+extern int  test_varputgetg PROTO((
+				       int
+				       ));
+extern int	test_slabs	PROTO((
+				       int
+				       ));
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mfhdf/nctest/val.c b/mfhdf/nctest/val.c
new file mode 100644
index 0000000..52b6415
--- /dev/null
+++ b/mfhdf/nctest/val.c
@@ -0,0 +1,251 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: val.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"
+#include "val.h"
+#include "error.h"
+
+
+/* fill typed value block with values of specified type */
+void
+val_fill(type, len, vals)
+     nc_type type;		/* netcdf type, NC_BYTE, ..., NC_DOUBLE */
+     long len;			/* number of elements to fill with */
+     void *vals;		/* start of first block of values */
+{
+    static char pname[] = "val_fill";
+    int iel;
+    union {
+	char *cp;
+	short *sp;
+	nclong *lp;
+	float *fp;
+	double *dp;
+    } gp;
+
+    switch (type) {
+      case NC_BYTE:
+      case NC_CHAR:
+	gp.cp = (char *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.cp++ = (char) iel;
+	break;
+      case NC_SHORT:
+	gp.sp = (short *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.sp++ = (short) (iel - len/2); /* negative and positive values */
+	break;
+      case NC_LONG:
+	gp.lp = (nclong *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.lp++ = (nclong) (iel - len/2);
+	break;
+      case NC_FLOAT:
+	gp.fp = (float *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.fp++ = (float) (iel+1);
+	break;
+      case NC_DOUBLE:
+	gp.dp = (double *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.dp++ = (double) (iel - len/2);
+	break;
+      default:
+	error("%s: bad type, test program error", pname);
+    }
+}
+
+
+/* fill typed value block with zeros of specified type */
+void
+val_fill_zero(type, len, vals)
+     nc_type type;		/* netcdf type, NC_BYTE, ..., NC_DOUBLE */
+     long len;			/* number of elements to fill with */
+     void *vals;		/* start of first block of values */
+{
+    static char pname[] = "val_fill_zero";
+    int iel;
+    union {
+	char *cp;
+	short *sp;
+	long *lp;
+	float *fp;
+	double *dp;
+    } gp;
+
+    switch (type) {
+      case NC_BYTE:
+      case NC_CHAR:
+	gp.cp = (char *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.cp++ = (char) 0;
+	break;
+      case NC_SHORT:
+	gp.sp = (short *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.sp++ = (short) 0;
+	break;
+      case NC_LONG:
+	gp.lp = (long *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.lp++ = (long) 0;
+	break;
+      case NC_FLOAT:
+	gp.fp = (float *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.fp++ = (float) 0;
+	break;
+      case NC_DOUBLE:
+	gp.dp = (double *) vals;
+	for (iel = 0; iel < len; iel++)
+	  *gp.dp++ = (double) 0;
+	break;
+      default:
+	error("%s: bad type, test program error", pname);
+    }
+}
+
+
+
+/* 
+ * compare two typed value blocks, return 0 if equal, 1+n otherwise, 
+ * where n is the index of the first differing element.
+ */
+int
+val_cmp (type, len, v1, v2)
+     nc_type type;		/* netcdf type, NC_BYTE, ..., NC_DOUBLE */
+     long len;			/* number of elements of type to compare */
+     void *v1;			/* start of first block of values */
+     void *v2;			/* start of second block of values */
+{
+    static char pname[] = "val_cmp";
+    int iel;
+    union {
+	char *cp;
+	short *sp;
+	nclong *lp;
+	float *fp;
+	double *dp;
+    } gp, hp;
+
+    switch (type) {
+      case NC_CHAR:
+      case NC_BYTE:
+	gp.cp = (char *) v1;
+	hp.cp = (char *) v2;
+	for (iel = 0; iel < len; iel++) {
+	    if (*gp.cp != *hp.cp)
+	      return (iel + 1);
+	    gp.cp++;
+	    hp.cp++;
+	}
+	break;
+      case NC_SHORT:
+	gp.sp = (short *) v1;
+	hp.sp = (short *) v2;
+	for (iel = 0; iel < len; iel++) {
+	    if (*gp.sp != *hp.sp)
+	      return (iel + 1);
+	    gp.sp++;
+	    hp.sp++;
+	}
+	break;
+      case NC_LONG:
+	gp.lp = (nclong *) v1;
+	hp.lp = (nclong *) v2;
+	for (iel = 0; iel < len; iel++) {
+	    if (*gp.lp != *hp.lp)
+	      return (iel + 1);
+	    gp.lp++;
+	    hp.lp++;
+	}
+	break;
+      case NC_FLOAT:
+	gp.fp = (float *) v1;
+	hp.fp = (float *) v2;
+	for (iel = 0; iel < len; iel++) {
+	    if (*gp.fp != *hp.fp)
+	      return (iel + 1);
+	    gp.fp++;
+	    hp.fp++;
+	}
+	break;
+      case NC_DOUBLE:
+	gp.dp = (double *) v1;
+	hp.dp = (double *) v2;
+	for (iel = 0; iel < len; iel++) {
+	    if (*gp.dp != *hp.dp)
+	      return (iel + 1);
+	    gp.dp++;
+	    hp.dp++;
+	}
+	break;
+      default:
+	error("%s: bad type, test program error", pname);
+    }
+    return 0;			/* all values agree */
+}
+
+
+/* print typed value block with values of specified type */
+void
+val_out(type, len, vals)
+     nc_type type;		/* netcdf type, NC_BYTE, ..., NC_DOUBLE */
+     long len;			/* number of elements to fill with */
+     void *vals;		/* start of first block of values */
+{
+    static char pname[] = "val_oout";
+    int iel;
+    union {
+	char *cp;
+	short *sp;
+	nclong *lp;
+	float *fp;
+	double *dp;
+    } gp;
+
+    (void) fprintf(stderr,"   ");
+    switch (type) {
+      case NC_BYTE:
+      case NC_CHAR:
+	gp.cp = (char *) vals;
+	for (iel = 0; iel < len; iel++)
+	  (void)fprintf(stderr,"%d%s",*gp.cp++,iel<len-1 ? ", " : "");
+	break;
+      case NC_SHORT:
+	gp.sp = (short *) vals;
+	for (iel = 0; iel < len; iel++)
+	  (void)fprintf(stderr,"%d%s",*gp.sp++,iel<len-1 ? ", " : "");
+	break;
+      case NC_LONG:
+	gp.lp = (nclong *) vals;
+	for (iel = 0; iel < len; iel++)
+	  (void)fprintf(stderr,"%d%s",(int)*gp.lp++,iel<len-1 ? ", " : "");
+	break;
+      case NC_FLOAT:
+	gp.fp = (float *) vals;
+	for (iel = 0; iel < len; iel++)
+	  (void)fprintf(stderr,"%g%s",*gp.fp++,iel<len-1 ? ", " : "");
+	break;
+      case NC_DOUBLE:
+	gp.dp = (double *) vals;
+	for (iel = 0; iel < len; iel++)
+	  (void)fprintf(stderr,"%g%s",*gp.dp++,iel<len-1 ? ", " : "");
+	break;
+      default:
+	error("%s: bad type, test program error", pname);
+    }
+    (void) putc('\n',stderr);
+}
diff --git a/mfhdf/nctest/val.h b/mfhdf/nctest/val.h
new file mode 100644
index 0000000..6360759
--- /dev/null
+++ b/mfhdf/nctest/val.h
@@ -0,0 +1,51 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: val.h 2365 1996-03-26 22:43:35Z georgev $
+ *********************************************************************/
+
+#undef PROTO
+#ifndef NO_HAVE_PROTOTYPES 
+#   define	PROTO(x)	x
+#else
+#   define	PROTO(x)	()
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* fill typed value block with values of specified type */
+extern	void	val_fill	PROTO((
+				       nc_type ,
+				       long,
+				       void *
+				       ));
+
+/* fill typed value block with zeros of specified type */
+extern	void	val_fill_zero	PROTO((
+				       nc_type ,
+				       long,
+				       void *
+				       ));
+
+/* 
+ * compare two typed value blocks, return 0 if equal, 1+n otherwise, 
+ * where n is the index of the first differing element.
+ */
+extern	int	val_cmp		PROTO((
+				       nc_type ,
+				       long,
+				       void *,
+				       void *
+				       ));
+
+/* print typed value block with values of specified type */
+extern	void	val_out		PROTO((
+				       nc_type ,
+				       long,
+				       void *
+				       ));
+#ifdef __cplusplus
+}
+#endif
diff --git a/mfhdf/nctest/vardef.c b/mfhdf/nctest/vardef.c
new file mode 100644
index 0000000..772ada6
--- /dev/null
+++ b/mfhdf/nctest/vardef.c
@@ -0,0 +1,306 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vardef.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define LEN_OF(array) ((sizeof array) / (sizeof array[0]))
+#ifdef HDF
+#define  EPS64          ((float64)1.0E-14)
+#define  EPS32          ((float32)1.0E-7)
+#endif
+
+/*
+ * Test ncvardef
+ *    check that proper define worked with ncvarinq
+ *    check that returned id is one more than previous id
+ *    try redefining an existing variable, check error
+ *    try adding scalar variable (no dimensions)
+ *    try with bad datatype, check error
+ *    try with bad number of dimensions, check error
+ *    try with bad dimension ids, check error
+ *    try in data mode, check error
+ */
+void
+test_ncvardef(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    int cdfid;			/* netcdf id */
+    static char pname[] = "test_ncvardef";
+    int id, iv;
+    static struct cdfvar va[] = { /* variables of all shapes and sizes */
+	{"bytev", NC_BYTE, 6, ___, 0},
+	{"charv", NC_CHAR, 5, ___, 0},
+	{"shortv", NC_SHORT, 4, ___, 0},
+	{"longv", NC_LONG, 3, ___, 0},
+	{"floatv", NC_FLOAT, 2, ___, 0},
+	{"doublev", NC_DOUBLE, 1, ___, 0},
+	{"scalarv", NC_DOUBLE, 0, ___, 0}
+    };
+    int nv = LEN_OF(va);	/* number of variables to define */
+    int va_id[LEN_OF(va)];	/* variable ids */
+    static struct cdfvar tmp =	/* variable for testing bad types, etc. */
+	{"tmpv", NC_DOUBLE, 1, ___, 0};
+    /* if d5 >= 91 in following, problem on machines with 16-bit ints ??? */
+    static struct cdfdim di[] = { /* a bunch of dimensions */
+	{"d0", 2}, {"d1",3}, {"d2",5}, {"d3", 6}, {"d4", 4}, {"d5", 31}};
+    int nd = LEN_OF(di);	/* number of dimensions */
+    int di_id[LEN_OF(di)];	/* dimension ids */
+    
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened, defining a variable should fail in data mode */
+    if (ncvardef(cdfid, va[0].name, va[0].type, va[0].ndims, va[0].dims)
+	!= -1) {
+	error("%s: ncvardef should have failed in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    /* enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+
+    /* Add nd more dimensions */
+    for (id = 0; id < nd; id++) {
+	if ((di_id[id] = ncdimdef(cdfid, di[id].name, di[id].size)) == -1) {
+	    error("%s: ncdimdef failed for %s, size %d",
+		  pname, di[id].name, di[id].size);
+	    ncclose(cdfid); return;
+	}
+	add_dim(&test, &di[id]);	/* keep in-memory netcdf in sync */
+    }
+
+    tmp.dims = (int *) emalloc(sizeof(int) * H4_MAX_VAR_DIMS);
+    tmp.name = (char *) emalloc(H4_MAX_NC_NAME);
+
+    /* in define mode, add variables of each type with various shapes */
+    for (iv = 0; iv < nv; iv++) {
+	/* set shape to use subset of dimensions previously defined */
+	va[iv].dims = (int *) emalloc(sizeof(int) * va[iv].ndims);
+	for (id = 0; id < va[iv].ndims; id++)
+	  va[iv].dims[id] = di_id[id];
+	if ((va_id[iv] = ncvardef(cdfid, va[iv].name, va[iv].type,
+				  va[iv].ndims, va[iv].dims)) == -1) {
+	    error("%s: ncvardef failed", pname);
+	    errvar(&test,&va[iv]); /* prints details about variable */
+	    ncclose(cdfid); return;
+	}
+	add_var(&test, &va[iv]); /* keep in-memory netcdf in sync */
+	/* check that var id returned is one more than previous var id */
+	if (va_id[iv] != test.nvars - 1) {
+	    error("%s: ncvardef returned %d for var id, expected %d",
+		  pname, va_id[iv], test.nvars-1);
+	    ncclose(cdfid); return;
+	}
+	/* use ncvarinq to get values just set and compare values */
+	if (ncvarinq(cdfid, va_id[iv], tmp.name, &tmp.type,
+		      &tmp.ndims, tmp.dims, &tmp.natts) == -1) {
+	    error("%s: ncvarinq failed", pname);
+	    errvar(&test,&va[iv]); /* prints details about variable */
+	    ncclose(cdfid); return;
+	}
+	if (strcmp(tmp.name, va[iv].name) != 0 ||
+	    tmp.type != va[iv].type ||
+	    tmp.ndims != va[iv].ndims ||
+	    tmp.natts != va[iv].natts) {
+	    error("%s: ncvardef and ncvarinq don't agree for %s",
+		  pname, va[iv].name);
+	    nerrs++;
+	    errvar(&test,&va[iv]);
+	    errvar(&test,&tmp);
+	}
+	for (id = 0; id < va[iv].ndims; id++) {
+	    if (tmp.dims[id] != va[iv].dims[id]) {
+	    error("%s: ncvardef and ncvarinq don't agree on shape of %s",
+		  pname, va[iv].name);
+	    nerrs++;
+	    errvar(&test,&va[iv]);
+	    errvar(&test,&tmp);
+	    }
+	}
+    }
+    /* try adding same variable again, this should fail */
+    if (ncvardef(cdfid, va[0].name, va[0].type,
+		  va[0].ndims, va[0].dims) != -1) {
+	error("%s: ncvardef should not allow redefinition", pname);
+	ncclose(cdfid); return;
+    }
+    /* try bad type, should fail */
+    if (ncvardef(cdfid, "badtype", BAD_TYPE, va[0].ndims, va[0].dims) != -1) {
+	error("%s: ncvardef should have failed on bad type", pname);
+	ncclose(cdfid); return;
+    }
+    /* try bad ndims, should fail */
+    if (ncvardef(cdfid, "badndims", va[0].type, -1, va[0].dims) != -1) {
+	error("%s: ncvardef should have failed on bad ndims", pname);
+	ncclose(cdfid); return;
+    }
+    /* try bad ids in dims vector, should fail */
+    id = va[0].dims[0];
+    va[0].dims[va[0].ndims-1] = -1;
+    if (ncvardef(cdfid, "baddims", va[0].type, va[0].ndims, va[0].dims)
+	!= -1) {
+	error("%s: ncvardef should have failed on negative dim id in dims",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+
+    /* try reading a value of each type, should get appropriate fill value */
+    for (iv = 0; iv < nv; iv++) {
+	static long where[] = {0,0,0,0,0,0};
+
+	switch(va[iv].type) {
+	  case NC_BYTE:
+	    {
+		char val, fillval = FILL_BYTE;
+		if (ncvarget1(cdfid, va_id[iv], where, (void *) &val) != -1) {
+		    if (val != fillval) {
+			error("%s: unwritten byte not FILL_BYTE", pname);
+			nerrs++;
+		    }
+		} else {
+		    error("%s: ncvarget1 failure for byte", pname);
+		    nerrs++;
+		}
+	    }
+	    break;
+	  case NC_CHAR:
+	    {
+		char val, fillval = FILL_CHAR;
+		if (ncvarget1(cdfid, va_id[iv], where, (void *) &val) != -1) {
+		    if (val != fillval) {
+			error("%s: unwritten char not FILL_CHAR", pname);
+			nerrs++;
+		    }
+		} else {
+		    error("%s: ncvarget1 failure for char", pname);
+		    nerrs++;
+		}
+	    }
+	    break;
+	  case NC_SHORT:
+	    {
+		short val, fillval = FILL_SHORT;
+		if (ncvarget1(cdfid, va_id[iv], where, (void *) &val) != -1) {
+		    if (val != fillval) {
+			error("%s: unwritten short not FILL_SHORT", pname);
+			nerrs++;
+		    }
+		} else {
+		    error("%s: ncvarget1 failure for short", pname);
+		    nerrs++;
+		}
+	    }
+	    break;
+	  case NC_LONG:
+	    {
+		nclong val, fillval;
+                val = 0;
+                fillval = 0;
+                fillval = FILL_LONG;
+		if (ncvarget1(cdfid, va_id[iv], where, (void *) &val) != -1) {
+		    if ((nclong) val != (nclong) fillval) {
+                        nclong a, b;
+
+printf("\n\n Was expecting %d instead got a %d\n", (int)fillval, (int)val);
+                        a = (nclong) val;
+                        b = (nclong) fillval;
+printf("\n\n After cast %d %d\n", (int)a, (int)b);
+
+			error("%s: unwritten long not FILL_LONG", pname);
+			nerrs++;
+		    }
+		} else {
+		    error("%s: ncvarget1 failure for long", pname);
+		    nerrs++;
+		}
+	    }
+	    break;
+	  case NC_FLOAT:
+	    {
+		float val, fillval = FILL_FLOAT;
+		if (ncvarget1(cdfid, va_id[iv], where, (void *) &val) != -1) {
+#ifdef HDF
+            if (fabs((double)(val - fillval)) > fabs((double)(fillval*EPS32)))
+#else /*!HDF */
+		    if (val != fillval)
+#endif
+            {
+                error("%s: unwritten float not FILL_FLOAT", pname);
+                nerrs++;
+                }
+        } else {
+            error("%s: ncvarget1 failure for float", pname);
+            nerrs++;
+        }
+	    }
+	    break;
+	  case NC_DOUBLE:
+	    {
+		double val, fillval = FILL_DOUBLE;
+		if (ncvarget1(cdfid, va_id[iv], where, (void *) &val) != -1) {
+#ifdef HDF
+           if (fabs((double)(val - fillval)) > fabs((double)(fillval*EPS64)))
+#else  /* !HDF */
+		    if (val != fillval)
+#endif /* !HDF */
+            {
+            error("%s: unwritten double not FILL_DOUBLE", pname);
+            nerrs++;
+            }
+        } else {
+            error("%s: ncvarget1 failure for double", pname);
+            nerrs++;
+        }
+	    }
+	    break;
+        default:
+            break;
+	}
+    }
+
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    Free ((char *) tmp.dims);
+    Free (tmp.name);
+    for (iv = 0; iv < nv; iv++)
+      if (va[iv].dims)
+	Free((char *) va[iv].dims);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/varget.c b/mfhdf/nctest/varget.c
new file mode 100644
index 0000000..955e515
--- /dev/null
+++ b/mfhdf/nctest/varget.c
@@ -0,0 +1,147 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: varget.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+
+/*
+ * Test ncvarget
+ *    check that proper call worked after ncvarput
+ *    try with negative coords, edges, check error
+ *    try with too-large coords, edges, check error
+ *    try with bad variable handle, check error
+ *    try in define mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncvarget(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarget";
+    int cdfid;			/* netcdf id */
+    int iv;			/* variable id */
+    struct cdfhc {		/* a hypercube with generic values */
+	long cor[H4_MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[H4_MAX_VAR_DIMS];	/* netcdf edge lengths to upper corner */
+	void *vals;		/* pointer to block of values */
+    } hc;			/* test hypercube */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened in data mode, try putting and getting hypercubes of each type */
+    nerrs += test_varputget (cdfid);
+
+    /* try putting hypercube and getting various interior slabs */
+    nerrs += test_slabs (cdfid);
+    
+    /* find a variable with at least one dimension */
+    iv = 0;
+    while (test.vars[iv].ndims <= 0 && iv < test.nvars)
+      iv++;
+    if (iv < test.nvars) {	/* iv is varid of variable with dimensions */
+	int tmp;
+	/* set coords */
+	int id;			/* dimension id */
+	for (id = 0; id < test.vars[iv].ndims; id++) {
+	    hc.cor[id] = 0;
+	    hc.edg[id] = 1;
+	}
+	/* get space for vals */
+	hc.vals = emalloc(nctypelen(test.vars[iv].type) + 8);
+
+	id = test.vars[iv].ndims - 1;
+	tmp = hc.cor[id];
+	hc.cor[id] = -1;	/* try negative coordinate, should fail */
+	if(ncvarget (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarget should fail for negative corner", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.cor[id] = tmp;
+	tmp = hc.edg[id];
+	hc.edg[id] = -1;	/* try negative edge, should fail */
+	if(ncvarget (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarget should fail for negative edge", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.edg[id] = tmp;
+
+	{ 
+		long mqv = test.vars[iv].ndims -1 ;
+		int dim = test.vars[iv].dims[mqv] ;
+
+	tmp = hc.cor[mqv];
+	hc.cor[mqv] = test.dims[dim].size; /* try big coordinate, should fail */
+	if(ncvarget (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarget should fail for too-high coordinate", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.cor[mqv] = tmp;
+	tmp = hc.edg[mqv];
+	hc.edg[mqv] = test.dims[dim].size + 1; /* try big edge, should fail */
+	if(ncvarget (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarget should fail for too-high edge", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.edg[mqv] = tmp;
+	} /* mqv block */
+
+	if (ncredef(cdfid) == -1) {
+	    error("%s: ncredef failed", pname);
+	    ncclose(cdfid); return;
+	}
+	/* try in define mode, should fail */
+	if(ncvarget (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarget should fail in define mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (ncendef (cdfid) == -1) {
+	    error("%s: ncendef failed", pname);
+	    ncclose(cdfid); return;
+	}
+    }
+    /* try with bad variable handle, should fail */
+    if(ncvarget (cdfid, -1, hc.cor, hc.edg, hc.vals) != -1) {
+	error("%s: ncvarget should fail for bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netCDF handle, should fail */
+    if(ncvarget (cdfid, 0, hc.cor, hc.edg, hc.vals) != -1) {
+	error("%s: ncvarget failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    Free ((char *)hc.vals);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/varget_unlim.c b/mfhdf/nctest/varget_unlim.c
new file mode 100644
index 0000000..2c6e746
--- /dev/null
+++ b/mfhdf/nctest/varget_unlim.c
@@ -0,0 +1,168 @@
+/*
+ * This tests uses HDF NetCDF APIs to read the NetCDF file test_unlim.nc
+ * generated with the NetCDF Library v3.5 from test_unlim.cdl
+ */
+    
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"            /* defines in-memory test cdf structure */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF  
+#include "hdf.h" 
+#endif  
+
+float a_val[2][3] = {
+                      {1.0, 2.0, 3.0}, 
+                      {4.0, 5.0, 6.0}
+                    };
+int   date_val[12] = {840116, 840214, 840316, 840415, 840516, 840615, 840716, 840816,
+                      840915, 841016, 841115, 841216 };
+int   time_val[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
+short b_val[][3][2] = {
+                      {{1, 1}, {2, 2}, {3, 3}},
+                      {{4, 4}, {5, 5}, {6, 6}},
+                      {{7, 7}, {8, 8}, {9, 9}},
+                      {{10, 10}, {11, 11}, {12, 12}},
+                      {{13, 13}, {14, 14}, {15, 15}},
+                      {{16, 16}, {17, 17}, {18, 18}},
+                      {{19, 19}, {20, 20}, {21, 22}},
+                      {{23, 23}, {24, 24}, {25, 25}},
+                      {{26, 26}, {27, 27}, {28, 28}},
+                      {{29, 29}, {30, 30}, {31, 31}},
+                      {{32, 32}, {33, 33}, {34, 34}},
+                      {{35, 35}, {36, 36}, {37, 37}}
+                                                    };
+/*
+ * Test ncvarget for variables with unlimited dimensions (bug #897)
+ */
+void
+test_ncvarget_unlim(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarget_unlim";
+    
+    int status;
+    int ncid;
+    int var_id;
+    float a[2][3];
+    int date[12];
+    int time[12];
+    short val[12][3][2];
+    long start[3], count[3];
+    int i, j, n;
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+	if ((ncid = ncopen(path, NC_NOWRITE)) == -1) {
+             error("%s: ncopen failed", pname);
+             return;
+        }
+
+/* Reading 3D array with unlimited dimension */
+
+	var_id = ncvarid( ncid, "b");
+        start[0] = 0;
+        start[1] = 0;
+        start[2] = 0;
+        count[0] = 12;
+        count[1] = 3;
+        count[2] = 2;
+	
+        if(status = ncvarget (ncid, var_id, start, count, val) == -1) {
+           error("%s: ncvarget failed for variable b in ", pname);
+           ncclose(ncid);
+           return;
+        }
+           
+        for (n=0; n <12 ; n++) {
+         for (i=0; i <3; i++)   {
+          for (j=0; j<2 ; j++)   {
+             if (val[n][i][j] != b_val[n][i][j]) {
+             nerrs++;
+             printf(" Wrong value of variable b at index %d,%d,%d\n", n,i,j);
+             }
+          }
+         }
+        }
+
+/* Reading 2D array */
+
+	var_id = ncvarid( ncid, "a");
+        start[0] = 0;
+        start[1] = 0;
+        count[0] = 2;
+        count[1] = 3;
+	
+        if(status = ncvarget (ncid, var_id, start, count, a) == -1) {
+           error("%s: ncvarget failed for variable a in ", pname);
+           ncclose(ncid);
+           return;
+        }
+           
+         for (i=0; i <2; i++)   {
+          for (j=0; j<3 ; j++)   {
+             if (a[i][j] != a_val[i][j]) {
+             nerrs++;
+             printf(" Wrong value of variable a at index %d,%d\n", i,j);
+             }
+          }
+         }
+        
+
+/* Reading 1D array with unlimited dimension */
+
+	var_id = ncvarid( ncid, "date");
+        start[0] = 0;
+        count[0] = 12;
+	
+        if(status = ncvarget (ncid, var_id, start, count, date) == -1) {
+           error("%s: ncvarget failed for variable date in ", pname);
+           ncclose(ncid);
+           return;
+        }
+           
+        for (n=0; n <12 ; n++) {
+             if (date[n] != date_val[n]) {
+             nerrs++;
+             printf(" Wrong value of variable date at index %d\n", n);
+             }
+        }
+
+/* Reading 1D array with unlimited dimension */
+
+	var_id = ncvarid( ncid, "time");
+        start[0] = 0;
+        count[0] = 12;
+	
+        if(status = ncvarget (ncid, var_id, start, count, time) == -1) {
+           error("%s: ncvarget failed varaible time in ", pname);
+           ncclose(ncid);
+           return;
+        }
+           
+        for (n=0; n <12 ; n++) {
+             if (time[n] != time_val[n]) {
+             nerrs++;
+             printf(" Wrong value of variable time at index %d\n", n);
+             }
+        }
+
+	status = ncclose(ncid);
+
+
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/vargetg.c b/mfhdf/nctest/vargetg.c
new file mode 100644
index 0000000..c9fc11e
--- /dev/null
+++ b/mfhdf/nctest/vargetg.c
@@ -0,0 +1,154 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vargetg.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+
+/*
+ * Test ncvargetg
+ *    check that proper call worked after ncvarputg
+ *    try with negative coords, edges, check error
+ *    try with non-positive strides, check error
+ *    try with too-large coords, edges, check error
+ *    try with bad variable handle, check error
+ *    try in define mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncvargetg(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvargetg";
+    int cdfid;			/* netcdf id */
+    int iv;			/* variable id */
+    struct cdfhc {		/* a hypercube with generic values */
+	long cor[H4_MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[H4_MAX_VAR_DIMS];	/* netcdf edge lengths to upper corner */
+	void *vals;		/* pointer to block of values */
+    } hc;			/* test hypercube */
+    long strides[H4_MAX_VAR_DIMS];	/* external, I/O strides */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened in data mode, try putting and getting hypercubes of each type */
+    nerrs += test_varputgetg (cdfid);
+
+    /* find a variable with at least one dimension */
+    iv = 0;
+    while (test.vars[iv].ndims <= 0 && iv < test.nvars)
+      iv++;
+    if (iv < test.nvars) {	/* iv is varid of variable with dimensions */
+	long	tmp;
+	int	id;		/* dimension id */
+
+	/* set coords and strides */
+	for (id = 0; id < test.vars[iv].ndims; id++) {
+	    hc.cor[id] = 0;
+	    hc.edg[id] = 1;
+	    strides[id] = 1;
+	}
+
+	/* get space for vals */
+	hc.vals = emalloc(nctypelen(test.vars[iv].type) + 8);
+
+#	define TEST_FAILS(varid) \
+	    (ncvarputg(cdfid, varid, hc.cor, hc.edg, \
+		       strides, (long*)NULL, hc.vals) != -1)
+
+	id = test.vars[iv].ndims - 1;
+	tmp = hc.cor[id];
+	hc.cor[id] = -1;	/* try negative coordinate, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvargetg should fail for negative corner", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.cor[id] = tmp;
+	tmp = hc.edg[id];
+	hc.edg[id] = -1;	/* try negative edge, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvargetg should fail for negative edge", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.edg[id] = tmp;
+	tmp = hc.cor[id];
+	hc.cor[id] = test.dims[id].size; /* try big coordinate, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvargetg should fail for too-high coordinate", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.cor[id] = tmp;
+	tmp = hc.edg[id];
+	hc.edg[id] = test.dims[id].size + 1; /* try big edge, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvargetg should fail for too-high edge", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.edg[id] = tmp;
+	tmp = strides[id];
+	strides[id] = -1; /* try non-positive stride, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvargetg should fail for non-positive stride", pname);
+	    ncclose(cdfid); return;
+	}
+	strides[id] = tmp;
+
+	if (ncredef(cdfid) == -1) {
+	    error("%s: ncredef failed", pname);
+	    ncclose(cdfid); return;
+	}
+	/* try in define mode, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvargetg should fail in define mode",
+		  pname);
+	    ncclose(cdfid); return;
+	}
+	if (ncendef (cdfid) == -1) {
+	    error("%s: ncendef failed", pname);
+	    ncclose(cdfid); return;
+	}
+    }
+    /* try with bad variable handle, should fail */
+    if (TEST_FAILS(-1)) {
+	error("%s: ncvargetg should fail for bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netCDF handle, should fail */
+    if (TEST_FAILS(0)) {
+	error("%s: ncvargetg failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    Free ((char *)hc.vals);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/varput.c b/mfhdf/nctest/varput.c
new file mode 100644
index 0000000..d856311
--- /dev/null
+++ b/mfhdf/nctest/varput.c
@@ -0,0 +1,153 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: varput.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "val.h"
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+
+/*
+ * Test ncvarput
+ *    check that proper call worked with ncvarget
+ *    try with negative coords, edges, check error
+ *    try with too-large coords, edges, check error
+ *    try with bad variable handle, check error
+ *    try in define mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncvarput(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarput";
+    int cdfid;			/* netcdf id */
+    int iv;			/* variable id */
+    struct cdfhc {		/* a hypercube with generic values */
+	long cor[H4_MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[H4_MAX_VAR_DIMS];	/* netcdf edge lengths to upper corner */
+	void *vals;		/* pointer to block of values */
+    } hc;			/* test hypercube */
+    int tmp;
+    int id;			/* dimension id */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    /* handle case where struct netcdf test is uninitialised */
+    hc.cor[0] = 0 ;
+    hc.edg[0] = 1 ;
+    hc.vals = 0 ;
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+
+    /* opened in data mode, try putting and getting hypercubes of each type */
+    nerrs += test_varputget (cdfid);	/* prints messages for discrepencies */
+    
+    /* find a variable with at least one dimension */
+    iv = 0;
+    while (test.vars[iv].ndims <= 0 && iv < test.nvars)
+      iv++;
+    if (iv < test.nvars) {	/* iv is first varid of var with dimensions */
+	/* set coords */
+	for (id = 0; id < test.vars[iv].ndims; id++) {
+	    hc.cor[id] = 0;
+	    hc.edg[id] = 1;
+	}
+	/* fill in vals with value of appropriate type */
+	hc.vals = emalloc(nctypelen(test.vars[iv].type));
+	val_fill(test.vars[iv].type, 1, hc.vals);
+
+	id = test.vars[iv].ndims - 1;
+	tmp = hc.cor[id];
+	hc.cor[id] = -1;	/* try negative coordinate, should fail */
+	if(ncvarput (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarput should fail for negative corner", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.cor[id] = tmp;
+	tmp = hc.edg[id];
+	hc.edg[id] = -1;	/* try negative edge, should fail */
+	if(ncvarput (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarput should fail for negative edge", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.edg[id] = tmp;
+	{ 
+		long mqv = test.vars[iv].ndims -1 ;
+		int dim = test.vars[iv].dims[mqv] ;
+
+		tmp = hc.cor[mqv];
+		hc.cor[mqv] = test.dims[dim].size; /* try big coordinate, should fail */
+		if(ncvarput (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+		    error("%s: ncvarput should fail for too-high coordinate", pname);
+		    ncclose(cdfid); return;
+		}
+		hc.cor[mqv] = tmp;
+	
+		tmp = hc.edg[mqv];
+		hc.edg[mqv] = test.dims[dim].size + 1; /* try big edge, should fail */
+		if(ncvarput (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+		    error("%s: ncvarput should fail for too-high edge", pname);
+		    ncclose(cdfid); return;
+		}
+		hc.edg[mqv] = tmp;
+	}
+
+	if (ncredef(cdfid) == -1) {
+	    error("%s: ncredef failed", pname);
+	    ncclose(cdfid); return;
+	}
+	/* try in define mode, should fail */
+	if(ncvarput (cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) {
+	    error("%s: ncvarput should fail in define mode", pname);
+	    ncclose(cdfid); return;
+	}
+	if (ncendef (cdfid) == -1) {
+	    error("%s: ncendef failed", pname);
+	    ncclose(cdfid); return;
+	}
+    }
+    else
+	error("\"struct netcdf test\" uninitialized, no tests performed") ;
+    /* try with bad variable handle, should fail */
+    if(ncvarput (cdfid, -1, hc.cor, hc.edg, hc.vals) != -1) {
+	error("%s: ncvarput should fail for bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netCDF handle, should fail */
+    if(ncvarput (cdfid, 0, hc.cor, hc.edg, hc.vals) != -1) {
+	error("%s: ncvarput failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    if(hc.vals) Free ((char *)hc.vals);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/varputg.c b/mfhdf/nctest/varputg.c
new file mode 100644
index 0000000..a6b081f
--- /dev/null
+++ b/mfhdf/nctest/varputg.c
@@ -0,0 +1,156 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: varputg.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "val.h"
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+/*
+ * Test ncvarputg
+ *    check that proper call worked with ncvargetg
+ *    try with negative coords, edges, check error
+ *    try with too-large coords, edges, check error
+ *    try with non-positive strides, check error
+ *    try with bad variable handle, check error
+ *    try in define mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncvarputg(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarputg";
+    int cdfid;			/* netcdf id */
+    int iv;			/* variable id */
+    struct cdfhc {		/* a hypercube with generic values */
+	long cor[H4_MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[H4_MAX_VAR_DIMS];	/* netcdf edge lengths to upper corner */
+	void *vals;		/* pointer to block of values */
+    } hc;			/* test hypercube */
+    long tmp;
+    int id;			/* dimension id */
+    long strides[H4_MAX_VAR_DIMS];	/* external, I/O strides */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+
+    /* opened in data mode, try putting and getting hypercubes of each type.
+     * prints out messages for discrepencies */
+    nerrs += test_varputgetg (cdfid);
+
+    /* find a variable with at least one dimension */
+    iv = 0;
+    while (test.vars[iv].ndims <= 0 && iv < test.nvars)
+      iv++;
+    if (iv < test.nvars) {	/* iv is first varid of var with dimensions */
+
+	/* set coords and strides */
+	for (id = 0; id < test.vars[iv].ndims; id++) {
+	    hc.cor[id] = 0;
+	    hc.edg[id] = 1;
+	    strides[id] = 1;
+	}
+
+	/* fill in vals with value of appropriate type */
+	hc.vals = emalloc(nctypelen(test.vars[iv].type));
+	val_fill(test.vars[iv].type, 1, hc.vals);
+
+#	define TEST_FAILS(varid) \
+	    (ncvarputg(cdfid, varid, hc.cor, hc.edg, \
+		       strides, (long*)NULL, hc.vals) != -1)
+
+	id = test.vars[iv].ndims - 1;
+	tmp = hc.cor[id];
+	hc.cor[id] = -1;	/* try negative coordinate, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvarputg should fail for negative corner", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.cor[id] = tmp;
+	tmp = hc.edg[id];
+	hc.edg[id] = -1;	/* try negative edge, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvarputg should fail for negative edge", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.edg[id] = tmp;
+	tmp = hc.cor[id];
+	hc.cor[id] = test.dims[id].size; /* try big coordinate, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvarputg should fail for too-high coordinate", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.cor[id] = tmp;
+	tmp = hc.edg[id];
+	hc.edg[id] = test.dims[id].size + 1; /* try big edge, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvarputg should fail for too-high edge", pname);
+	    ncclose(cdfid); return;
+	}
+	hc.edg[id] = tmp;
+	tmp = strides[id];
+	strides[id] = -1; /* try non-positive stride, * should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvarputg should fail for non-positive stride", pname);
+	    ncclose(cdfid); return;
+	}
+	strides[id] = tmp;
+
+	if (ncredef(cdfid) == -1) {
+	    error("%s: ncredef failed", pname);
+	    ncclose(cdfid); return;
+	}
+	/* try in define mode, should fail */
+	if (TEST_FAILS(iv)) {
+	    error("%s: ncvarputg should fail in define mode", pname);
+	    ncclose(cdfid); return;
+	}
+	if (ncendef (cdfid) == -1) {
+	    error("%s: ncendef failed", pname);
+	    ncclose(cdfid); return;
+	}
+    }
+    /* try with bad variable handle, should fail */
+    if (TEST_FAILS(-1)) {
+	error("%s: ncvarputg should fail for bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netCDF handle, should fail */
+    if (TEST_FAILS(0)) {
+	error("%s: ncvarputg failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    Free ((char *)hc.vals);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/vartests.c b/mfhdf/nctest/vartests.c
new file mode 100644
index 0000000..cb8caf0
--- /dev/null
+++ b/mfhdf/nctest/vartests.c
@@ -0,0 +1,673 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vartests.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define LEN_OF(array) ((sizeof array) / (sizeof array[0]))
+#define min(A, B)	((A) < (B) ? (A) : (B))
+#define max(A, B)	((A) > (B) ? (A) : (B))
+
+
+/*
+ * Test ncvarid
+ *    check that proper variable handle returned in both modes
+ *    try with undefined name, check error
+ *    try with bad handle, check error
+ */
+void
+test_ncvarid(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarid";
+    int cdfid;			/* netcdf id */
+    int id;
+    int varid;			/* variable id */
+    static struct cdfvar xx =	/* variable */
+      {"xx", NC_FLOAT, 1, ___, 0};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened, enter define mode */
+    if (ncredef(cdfid) == -1) {
+	error("%s: cdredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add a variable */
+    xx.dims = (int *) emalloc(sizeof(int) * xx.ndims);
+    for (id = 0; id < xx.ndims; id++)
+      xx.dims[id] = id;
+    if ((varid = ncvardef(cdfid,
+			   xx.name, xx.type, xx.ndims, xx.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &xx);	/* keep in-memory netcdf in sync */
+
+    /* check id returned for name matches id returned from definition */
+    if (ncvarid(cdfid, xx.name) != varid) {
+	error("%s: ncvarid returned wrong value in define mode", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode, check returned id for variable just added */
+    if (ncvarid(cdfid, xx.name) != varid) {
+	error("%s: ncvarid returned wrong value in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with undefined variable, should fail */
+    if (ncvarid(cdfid, "santa-claus") != -1) {
+	error("%s: ncvarid with bogus name should have failed ", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try on bad handle, should fail */
+    if (ncvarid(cdfid, xx.name) != -1) {
+	error("%s: ncvarid failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncvarinq
+ *    try in both modes
+ *    check returned values against defined values
+ *    try with bad variable handle, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncvarinq(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarinq";
+    int cdfid;			/* netcdf id */
+    int varid;			/* variable id */
+    struct cdfvar var;		/* variable */
+    int idim;
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened, in data mode */
+    var.dims = (int *) emalloc(sizeof(int) * H4_MAX_VAR_DIMS);
+    var.name = (char *) emalloc(H4_MAX_NC_NAME);
+    for (varid = 0 ; varid < test.nvars; varid++) { /* loop on all var ids */
+	if (ncvarinq(cdfid, varid, var.name, &var.type,
+		      &var.ndims, var.dims, &var.natts) == -1) {
+	    error("%s: ncvarinq in data mode failed on var id %d",
+		  pname, varid);
+	    ncclose(cdfid); return;
+	}
+	/* compare returned with expected values */
+	if (strcmp(var.name, test.vars[varid].name) != 0) {
+	    error("%s: ncvarinq (data mode), name %s, expected %s for id = %d",
+		  pname, var.name, test.vars[varid].name, varid);
+	    nerrs++;
+	}
+	if (var.type != test.vars[varid].type) {
+	    error("%s: ncvarinq (data mode), type %d, expected %d for id = %d",
+		  pname, var.type, test.vars[varid].type, varid);
+	    nerrs++;
+	}
+	if (var.ndims != test.vars[varid].ndims) {
+	    error("%s: ncvarinq (data mode), ndims %d, expected %d for id = %d",
+		  pname, var.ndims, test.vars[varid].ndims, varid);
+	    nerrs++;
+	}
+	else {			/* if ndims OK, compare dims */
+	    for (idim = 0; idim < var.ndims; idim++)
+	      if (var.dims[idim] != test.vars[varid].dims[idim]) {
+		  error("%s: ncvarinq (data mode), dims[%d]=%d, expected %d",
+			pname, idim, var.dims[idim],
+			test.vars[varid].dims[idim]);
+		  nerrs++;
+	      }
+	}
+    }
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, compare returned with expected values again */
+    for (varid = 0 ; varid < test.nvars; varid++) { /* loop on all var ids */
+	if (ncvarinq(cdfid, varid, var.name, &var.type,
+		      &var.ndims, var.dims, &var.natts) == -1) {
+	    error("%s: ncvarinq in data mode failed on var id %d",
+		  pname, varid);
+	    ncclose(cdfid); return;
+	}
+	if (strcmp(var.name, test.vars[varid].name) != 0) {
+	    error("%s: ncvarinq (define mode), name %s, expected %s for id = %d",
+		  pname, var.name, test.vars[varid].name, varid);
+	    nerrs++;
+	}
+	if (var.type != test.vars[varid].type) {
+	    error("%s: ncvarinq (define mode), type %d, expected %d for id = %d",
+		  pname, var.type, test.vars[varid].type, varid);
+	    nerrs++;
+	}
+	if (var.ndims != test.vars[varid].ndims) {
+	    error("%s: ncvarinq (define mode), ndims %d, expected %d for id = %d",
+		  pname, var.ndims, test.vars[varid].ndims, varid);
+	    nerrs++;
+	}
+	else {			/* if ndims OK, compare dims */
+	    for (idim = 0; idim < var.ndims; idim++)
+	      if (var.dims[idim] != test.vars[varid].dims[idim]) {
+		  error("%s: ncvarinq (define mode), dims[%d]=%d, expected %d",
+			pname, idim, var.dims[idim],
+			test.vars[varid].dims[idim]);
+		  nerrs++;
+	      }
+	}
+    }
+    /* try with bad variable handles, check for failure */
+    if (ncvarinq(cdfid, -1, var.name, &var.type,
+		      &var.ndims, var.dims, &var.natts) != -1 ||
+	ncvarinq(cdfid, test.nvars, var.name, &var.type,
+		      &var.ndims, var.dims, &var.natts) != -1) {
+	error("%s: ncvarinq should have failed on bad variable ids",
+	      pname, varid);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* should fail, since bad handle */
+    if (test.nvars >= 1) {	/* if any variables have been defined */
+	if (ncvarinq(cdfid, varid, var.name, &var.type,
+		      &var.ndims, var.dims, &var.natts) != -1) {
+	    error("%s: ncvarinq failed to report bad netcdf handle ", pname);
+	    nerrs++;
+	}
+    }
+    Free((char *) var.dims);
+    Free(var.name);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+struct cdfelm {			/* coordinates and generic value */
+    long coords[H4_MAX_VAR_DIMS];
+    union generic {
+	char by;
+	char ch;
+	short sh;
+	nclong lo;
+	float fl;
+	double db;
+    } val;
+};
+
+
+/* 
+ * Test both ncvarput1 and ncvarget1 with all types of data
+ *    use points in "lower-left", "middle", and "upper-right"
+ *    for each existing variable, put values of its type at each point
+ *    get values and compare with put values
+ */
+static int
+test_varputget1(cdfid)
+     int cdfid;			/* handle of netcdf open and in data mode */
+{
+    int nerrs = 0;
+    static char pname[] = "test_varputget1";
+    int id, ie, iv;
+    int ne = 3;			/* number of test points */
+    struct cdfelm elm[3];	/* coordinates and values of test points */
+    static long edges[] = {1};
+    void *voidp=NULL;
+    void *tmpp=NULL;
+    char chval;
+    short shval;
+    nclong loval;
+    float flval;
+    double dbval;
+
+    for (iv = 0; iv < test.nvars; iv++)	{ /* for each var in netcdf */
+	for (id = 0; id < test.vars[iv].ndims; id++) { /* set corners */
+	    int dsize;		/* max dimension size, used for u-r corner */
+	    /* "lower-left" corner */
+	    elm[0].coords[id] = 0;
+	    /* if unlimited dimension, choose record 3 for max, arbitrarily */
+	    dsize = test.dims[test.vars[iv].dims[id]].size;
+	    if (dsize == NC_UNLIMITED)
+	      dsize = 3;
+	    /* middle */
+	    elm[1].coords[id] = dsize / 2;
+	    /* "upper-right" corner */
+	    elm[2].coords[id] = dsize - 1;
+	}
+	for (ie = 0; ie < ne; ie++) { /* for each of ne points */
+	    switch (test.vars[iv].type) { /* get values of right type to put */
+	      case NC_BYTE:
+	      case NC_CHAR:
+		elm[ie].val.by = (char) (ie+1);
+		voidp = (void *) &elm[ie].val.by;
+		tmpp = (void *) &chval;
+		break;
+	      case NC_SHORT:
+		elm[ie].val.sh = (short) (ie-1);
+		voidp = (void *) &elm[ie].val.sh;
+		tmpp = (void *) &shval;
+		break;
+	      case NC_LONG:
+		elm[ie].val.lo = (nclong) (ie-3);
+		voidp = (void *) &elm[ie].val.lo;
+		tmpp = (void *) &loval;
+		break;
+	      case NC_FLOAT:
+		elm[ie].val.fl = (float) (ie+1);
+		voidp = (void *) &elm[ie].val.fl;
+		tmpp = (void *) &flval;
+		break;
+	      case NC_DOUBLE:
+		elm[ie].val.db = (double) (ie-1);
+		voidp = (void *) &elm[ie].val.db;
+		tmpp = (void *) &dbval;
+		break;
+	      default:
+		error("%s: bad type, test program error", pname);
+	    }
+	    if(ncvarput1 (cdfid, iv, elm[ie].coords, voidp) == -1) {
+		error("%s: ncvarput1 failed for point %d, variable %s",
+		      pname, ie, test.vars[iv].name);
+		ncclose(cdfid); return 1;
+	    }
+	    add_data(&test, iv, elm[ie].coords, edges); /* keep test in sync */
+
+	    if(ncvarget1 (cdfid, iv, elm[ie].coords, tmpp) == -1) {
+		error("%s: ncvarget1 failed for point %d, variable %s",
+		      pname, ie, test.vars[iv].name);
+		ncclose(cdfid); return 1;
+	    }
+	    switch (test.vars[iv].type) { /* compare values of right type */
+	      case NC_BYTE:
+	      case NC_CHAR:
+		if (elm[ie].val.by != chval) {
+		    error("%s: ncvarget1 returned char %d, expected %d",
+			  pname, chval, elm[ie].val.by);
+		    nerrs++;
+		}
+		break;
+	      case NC_SHORT:
+		if (elm[ie].val.sh != shval) {
+		    error("%s: ncvarget1 returned short %d, expected %d",
+			  pname, shval, elm[ie].val.sh);
+		    nerrs++;
+		}
+		break;
+	      case NC_LONG:
+		if (elm[ie].val.lo != loval) {
+		    error("%s: ncvarget1 returned long %ld, expected %d",
+			  pname, loval, elm[ie].val.lo);
+		    nerrs++;
+		}
+		break;
+	      case NC_FLOAT:
+		if (elm[ie].val.fl != flval) {
+		    error("%s: ncvarget1 returned float %g, expected %g",
+			  pname, flval, elm[ie].val.fl);
+		    nerrs++;
+		}
+		break;
+	      case NC_DOUBLE:
+		if (elm[ie].val.db != dbval) {
+		    error("%s: ncvarget1 returned double %g, expected %g",
+			  pname, dbval, elm[ie].val.db);
+		    nerrs++;
+		}
+		break;
+	      default:
+		error("%s: bad type, test program error", pname);
+	    }
+	}
+    }
+    return nerrs;
+}
+
+
+/*
+ * Test ncvarput1
+ *    check that proper call worked with ncvarget1
+ *    try with negative coords, check error
+ *    try with too-large coords, check error
+ *    try with bad variable handle, check error
+ *    try in define mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncvarput1(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarput1";
+    int cdfid;			/* netcdf id */
+    int iv;			/* variable id */
+    struct cdfelm elm;		/* coordinates and value of test point */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened in data mode, try putting and getting values of each type */
+    nerrs += test_varputget1 (cdfid);	/* tests ncvarput1 and ncvarget1 */
+
+    /* find a variable with at least one dimension */
+    iv = 0;
+    while (test.vars[iv].ndims <= 0 && iv < test.nvars)
+      iv++;
+    if (iv < test.nvars) {	/* iv is varid of variable with dimensions */
+	/* set coords */
+	int id;			/* dimension id */
+	for (id = 0; id < test.vars[iv].ndims; id++)
+	  elm.coords[id] = 0;
+	/* try invalid coordinates, should fail */
+	elm.coords[test.vars[iv].ndims/2] = -1;
+	if(ncvarput1 (cdfid, iv, elm.coords, (void *) &elm.val) != -1) {
+	    error("%s: ncvarput1 should fail for negative coordinate", pname);
+	    ncclose(cdfid); return;
+	}
+	elm.coords[test.vars[iv].ndims/2] =
+	  test.dims[test.vars[iv].dims[test.vars[iv].ndims/2]].size;
+	if(ncvarput1 (cdfid, iv, elm.coords, (void *) &elm.val) != -1) {
+	    error("%s: ncvarput1 should fail for too-high coordinate", pname);
+	    ncclose(cdfid); return;
+	}
+    }
+    /* try with bad variable handle, should fail */
+    if(ncvarput1 (cdfid, -1, elm.coords, (void *) &elm.val) != -1 ||
+       ncvarput1 (cdfid, test.nvars, elm.coords, (void *) &elm.val) != -1) {
+	error("%s: ncvarput1 should fail for bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* try in define mode, should fail */
+    if (test.nvars > 0)
+      if(ncvarput1 (cdfid, 0, elm.coords, (void *) &elm.val) != -1) {
+	  error("%s: ncvarput1 should fail in define mode", pname);
+	  ncclose(cdfid); return;
+      }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netCDF handle, should fail */
+    if(ncvarput1 (cdfid, 0, elm.coords, (void *) &elm.val) != -1) {
+	error("%s: ncvarput1 failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncvarget1
+ *    check that proper call worked after ncvarput1
+ *    try with negative coords, check error
+ *    try with too-large coords, check error
+ *    try with bad variable handle, check error
+ *    try in define mode, check error
+ *    try with bad netCDF handle, check error
+ */
+void
+test_ncvarget1(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarget1";
+    int cdfid;			/* netcdf id */
+    int iv;			/* variable id */
+    struct cdfelm elm;		/* coordinates and value of test point */
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened in data mode, try putting and getting values of each type */
+    nerrs += test_varputget1 (cdfid);	/* tests ncvarput1 and ncvarget1 */
+
+    /* find a variable with at least one dimension */
+    iv = 0;
+    while (test.vars[iv].ndims <= 0 && iv < test.nvars)
+      iv++;
+    if (iv < test.nvars) {	/* iv is varid of variable with dimensions */
+	/* set coords */
+	int id;			/* dimension id */
+	for (id = 0; id < test.vars[iv].ndims; id++)
+	  elm.coords[id] = 0;
+	/* try invalid coordinates, should fail */
+	elm.coords[test.vars[iv].ndims/2] = -1;
+	if(ncvarget1 (cdfid, iv, elm.coords, (void *) &elm.val) != -1) {
+	    error("%s: ncvarget1 should fail for negative coordinate", pname);
+	    ncclose(cdfid); return;
+	}
+	elm.coords[test.vars[iv].ndims/2] =
+	  test.dims[test.vars[iv].dims[test.vars[iv].ndims/2]].size;
+	if(ncvarget1 (cdfid, iv, elm.coords, (void *) &elm.val) != -1) {
+	    error("%s: ncvarget1 should fail for too-high coordinate", pname);
+	    ncclose(cdfid); return;
+	}
+    }
+    /* try with bad variable handle, should fail */
+    if(ncvarget1 (cdfid, -1, elm.coords, (void *) &elm.val) != -1 ||
+       ncvarget1 (cdfid, test.nvars, elm.coords, (void *) &elm.val) != -1) {
+	error("%s: ncvarget1 should fail for bad variable handle", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* try in define mode, should fail */
+    if (test.nvars > 0)
+      if(ncvarget1 (cdfid, 0, elm.coords, (void *) &elm.val) != -1) {
+	  error("%s: ncvarget1 should fail in define mode",
+		pname);
+	  ncclose(cdfid); return;
+      }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* try with bad netCDF handle, should fail */
+    if(ncvarget1 (cdfid, 0, elm.coords, (void *) &elm.val) != -1) {
+	error("%s: ncvarget1 failed to report bad netcdf handle", pname);
+	nerrs++;
+    }
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
+
+
+/*
+ * Test ncvarrename
+ *    check that proper rename worked with ncvarinq
+ *    try with bad netCDF handle, check error
+ *    try in data mode, check error
+ *    try with bad variable handle, check error
+ *    try renaming to existing variable name, check error
+ */
+void
+test_ncvarrename(path)
+     char *path;		/* name of writable netcdf file to open */
+{
+    int nerrs = 0;
+    static char pname[] = "test_ncvarrename";
+    int cdfid;			/* netcdf id */
+    int id;			/* dimension id */
+    int yy_id;			/* variable id */
+    static struct cdfvar yy =	/* variable */
+      {"old_name", NC_SHORT, 1, ___, 0};
+    static char newname[] = "yyy"; /* variable name */
+    static char shortname[] = "yy"; /* variable name */
+    struct cdfvar var;		/* variable */
+    static struct cdfvar zz =	/* variable */
+      {"zz", NC_BYTE, 2, ___, 0};
+
+    (void) fprintf(stderr, "*** Testing %s ...\t", &pname[5]);
+
+    if ((cdfid = ncopen(path, NC_WRITE)) == -1) {
+	error("%s: ncopen failed", pname);
+	return;
+    }
+    /* opened */
+    if (ncredef(cdfid) == -1) {
+	error("%s: ncredef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in define mode, add two variables */
+    yy.dims = (int *) emalloc(sizeof(int) * yy.ndims);
+    for (id = 0; id < yy.ndims; id++)
+      yy.dims[id] = id;
+    if ((yy_id = ncvardef(cdfid,
+			   yy.name, yy.type, yy.ndims, yy.dims)) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &yy);	/* keep in-memory netcdf in sync */
+    zz.dims = (int *) emalloc(sizeof(int) * zz.ndims);
+    for (id = 0; id < zz.ndims; id++)
+      zz.dims[id] = id;
+    if (ncvardef(cdfid, zz.name, zz.type, zz.ndims, zz.dims) == -1) {
+	error("%s: ncvardef failed", pname);
+	ncclose(cdfid); return;
+    }
+    add_var(&test, &zz);	/* keep in-memory netcdf in sync */
+
+    /* rename first variable */
+    if (ncvarrename(cdfid, yy_id, newname) == -1) {
+	error("%s: ncvarrename failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* check new name with ncvarid, ncvarinq */
+    if (yy_id != ncvarid(cdfid, newname)) {
+        error("%s: lookup by name failed after ncvarrename", pname);
+    }
+    var.dims = (int *) emalloc(sizeof(int) * H4_MAX_VAR_DIMS);
+    var.name = (char *) emalloc(H4_MAX_NC_NAME);
+    if (ncvarinq(cdfid, yy_id, var.name,
+		  &var.type, &var.ndims, var.dims, &var.natts) == -1) {
+	error("%s: ncvarinq failed", pname);
+	ncclose(cdfid); return;
+    }
+    if (strcmp(var.name,yy.name) == 0) {
+	error("%s: ncvarrename failed to change name", pname);
+	ncclose(cdfid); return;
+    }
+    if (strcmp(var.name,newname) != 0) {
+	error("%s: ncvarrename changed name to %s instead of %s",
+	      pname, var.name, newname);
+	ncclose(cdfid); return;
+    }
+    (void) strcpy(test.vars[yy_id].name, newname); /* keep test consistent */
+    /* try to rename second variable same as first, should fail */
+    if (ncvarrename(cdfid, yy_id, zz.name) != -1) {
+	error("%s: ncvarrename should have failed with used name", pname);
+	ncclose(cdfid); return;
+    }
+    /* try with bad variable handles, check for failure */
+    if (ncvarrename(cdfid, -1, var.name) != -1 ||
+	ncvarrename(cdfid, test.nvars, var.name) != -1) {
+	error("%s: ncvarrename should have failed on bad variable ids",
+	      pname);
+	ncclose(cdfid); return;
+    }
+    if (ncendef (cdfid) == -1) {
+	error("%s: ncendef failed", pname);
+	ncclose(cdfid); return;
+    }
+    /* in data mode */
+    if (ncvarrename(cdfid, yy_id, "a_longer_name") != -1) {
+	error("%s: ncvarrename to longer should fail in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    if (ncvarrename(cdfid, yy_id, shortname) == -1) {
+	error("%s: ncvarrename to shorter should succeed in data mode", pname);
+	ncclose(cdfid); return;
+    }
+    (void) strcpy(test.vars[yy_id].name, shortname); /* keep test consistent */
+    if (ncclose (cdfid) == -1) {
+	error("%s: ncclose failed", pname);
+	return;
+    }
+    /* should fail, since bad handle */
+    if (ncvarrename (cdfid, 0, var.name) != -1) {
+	error("%s: ncvarrename failed to report bad netcdf handle ", pname);
+	nerrs++;
+    }
+    Free(var.name);
+    Free((char *)var.dims);
+    if (nerrs > 0)
+      (void) fprintf(stderr,"FAILED! ***\n");
+    else
+      (void) fprintf(stderr,"ok ***\n");
+}
diff --git a/mfhdf/nctest/vputget.c b/mfhdf/nctest/vputget.c
new file mode 100644
index 0000000..3ffd451
--- /dev/null
+++ b/mfhdf/nctest/vputget.c
@@ -0,0 +1,135 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vputget.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "val.h"
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define max(A, B)	((A) > (B) ? (A) : (B))
+
+
+/* 
+ * For every variable in open netcdf, puts and gets three hypercubes 
+ * of data of the appropriate type, comparing values from get to 
+ * values put to check that both ncvarput and ncvarget worked.  The 
+ * three hypercubes are
+ *    - a large hypercube from (0, 0, ...) to the far corner (diagonally 
+ *      opposite (0, 0, ...),
+ *    - a size 1 hypercube from the far corner with edge lengths of 1 
+ *      in every direction, and
+ *    - a hypercube starting about 1/3 of the way along the diagonal
+ *      from (0,0,...) extending 1/3 of the way in every direction 
+ *      toward the far corner.
+ */
+
+int
+test_varputget(cdfid)
+     int cdfid;			/* handle of netcdf open and in data mode */
+{
+    int nerrs = 0;
+    static char pname[] = "test_varputget";
+    int id, ie, iv;		/* loop indices */
+    int ne = 3;			/* number of test hypercubes for each var */
+    struct cdfhc {		/* a hypercube with generic values */
+	long cor[H4_MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[H4_MAX_VAR_DIMS];	/* netcdf edge lengths to upper corner */
+	void *vals;		/* pointer to block of values */
+    } hc[3], tmp;		/* test hypercubes */
+    int nel[3];			/* number of elements in hypercube */
+
+    for (iv = 0; iv < test.nvars; iv++)	{ /* for each var in netcdf */
+	for (ie = 0; ie < ne; ie++)
+	  nel[ie] = 1;		/* to compute space for hypercube values */
+
+	for (id = 0; id < test.vars[iv].ndims; id++) { /* set cubes */
+
+	    /* max dimension size, 5 for records */
+	    int dsize = test.dims[test.vars[iv].dims[id]].size;
+	    if (dsize == NC_UNLIMITED)
+	      dsize = 5;
+
+	    /* start at "lower-left" corner, do whole variable */
+	    hc[0].cor[id] = 0;
+	    hc[0].edg[id] = dsize;
+	    nel[0] *= hc[0].edg[id];
+
+	    /* start at "upper-right" corner, do one point */
+	    hc[1].cor[id] = dsize - 1;
+	    hc[1].edg[id] = 1;
+	    nel[1] *= hc[1].edg[id];
+
+	    /* start about 1/3 way along diagonal, do 1/3 in each direction */
+	    hc[2].cor[id] = dsize/3;
+	    hc[2].edg[id] = max (dsize/3, 1);
+	    nel[2] *= hc[2].edg[id];
+	}
+	for (ie = 0; ie < ne; ie++) { /* for each of ne points */
+
+	    /* allocate space for the cube of values */
+	    hc[ie].vals = emalloc(nel[ie]*nctypelen(test.vars[iv].type) + 8);
+	    tmp.vals = emalloc(nel[ie]*nctypelen(test.vars[iv].type) + 8);
+
+	    /* fill allocated space with different values of right type */
+	    val_fill(test.vars[iv].type, nel[ie], hc[ie].vals);
+
+		if(ncvarput (cdfid, iv, hc[ie].cor, hc[ie].edg, hc[ie].vals)
+		   == -1) {
+		    error("%s: ncvarput failed for point %d, variable %s",
+			  pname, ie, test.vars[iv].name);
+		    nerrs++;
+		    errvar(&test, &test.vars[iv]);
+		    (void)fprintf(stderr,"  corner = (");
+		    for (id = 0 ; id < test.vars[iv].ndims; id++)
+		      (void)fprintf(stderr,"%d%s",(int)hc[ie].cor[id],
+				    (id < test.vars[iv].ndims-1) ? ", " : "");
+		    (void)fprintf(stderr,")\n");
+		    (void)fprintf(stderr,"  edge = (");
+		    for (id = 0 ; id < test.vars[iv].ndims; id++)
+		      (void)fprintf(stderr,"%d%s",(int)hc[ie].edg[id],
+				    (id < test.vars[iv].ndims-1) ? ", " : "");
+		    (void)fprintf(stderr,")\n");
+		}
+		else {
+		    add_data(&test, iv, hc[ie].cor, hc[ie].edg); /* keep test in sync */
+		    if(ncvarget (cdfid, iv, hc[ie].cor, hc[ie].edg, tmp.vals)
+		       == -1) {
+			error("%s: ncvarget failed for point %d, variable %s",
+			      pname, ie, test.vars[iv].name);
+			nerrs++;
+		    }
+		    else {
+			if (val_cmp(test.vars[iv].type, nel[ie],
+				    hc[ie].vals, tmp.vals) != 0) {
+			    error("%s: bad values returned from ncvarget",
+				  pname);
+			    nerrs++;
+			    errvar(&test, &test.vars[iv]); /* describe var */
+			}
+		    }
+		}
+	    Free ((char *) hc[ie].vals);
+	    Free ((char *) tmp.vals);
+	}
+    }
+    return nerrs;
+}
diff --git a/mfhdf/nctest/vputgetg.c b/mfhdf/nctest/vputgetg.c
new file mode 100644
index 0000000..74ea7c1
--- /dev/null
+++ b/mfhdf/nctest/vputgetg.c
@@ -0,0 +1,180 @@
+/*********************************************************************
+ *   Copyright 1993, UCAR/Unidata
+ *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
+ *   $Id: vputgetg.c 4998 2007-11-16 03:14:03Z epourmal $
+ *********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "h4config.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#include "testcdf.h"		/* defines in-memory test cdf structure */
+#include "add.h"		/* functions to update in-memory netcdf */
+#include "val.h"
+#include "error.h"
+#include "tests.h"
+#include "alloc.h"
+#include "emalloc.h"
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+#define max(A, B)	((A) > (B) ? (A) : (B))
+
+/* 
+ * For every variable in open netcdf, puts and gets three hypercubes 
+ * of data of the appropriate type, comparing values from get to 
+ * values put to check that both ncvarputg and ncvargetg worked.  The 
+ * three hypercubes are
+ *    - a large hypercube from (0, 0, ...) to the far corner (diagonally 
+ *      opposite (0, 0, ...),
+ *    - a size 1 hypercube from the far corner with edge lengths of 1 
+ *      in every direction, and
+ *    - a hypercube starting about 1/3 of the way along the diagonal
+ *      from (0,0,...) extending 1/3 of the way in every direction 
+ *      toward the far corner.
+ */
+
+int
+test_varputgetg(cdfid)
+     int cdfid;			/* handle of netcdf open and in data mode */
+{
+    int nerrs = 0;
+    static char pname[] = "test_varputgetg";
+    int id, ie, iv;		/* loop indices */
+    int ne = 3;			/* number of test hypercubes for each var */
+    struct cdfhc {		/* a hypercube with generic values */
+	long cor[H4_MAX_VAR_DIMS];	/* netcdf coordinates for lower corner */
+	long edg[H4_MAX_VAR_DIMS];	/* netcdf edge lengths to upper corner */
+	void *vals;		/* pointer to block of values */
+    } hc[3], tmp;		/* test hypercubes */
+    long nel[3];		/* number of elements in hypercube */
+    long strides[H4_MAX_VAR_DIMS];	/* external strides */
+    long basis[H4_MAX_VAR_DIMS];	/* internal array, element-access 
+				   basis vector */
+
+    for (iv = 0; iv < test.nvars; iv++)	{ /* for each var in netcdf */
+	long	tmpbasis;
+
+	for (ie = 0; ie < ne; ie++)
+	  nel[ie] = 1;		/* to compute space for hypercube values */
+
+	/*
+	 * The following macro returns the size of a dimension for a
+	 * variable with a maximum  dimension size of 5 for the record
+	 * dimension.
+	 */
+#	define EXTNPTS(varid, idim)	\
+	    (test.dims[test.vars[varid].dims[id]].size == NC_UNLIMITED \
+		? 5 \
+		: test.dims[test.vars[varid].dims[id]].size)
+#	define STRIDE(idim)		(idim + 2)
+#	define INTNPTS(extnpts, idim)	(1 + (extnpts - 1) / STRIDE(idim))
+
+
+	for (id = 0; id < test.vars[iv].ndims; id++) { /* set cubes */
+	    strides[id]	= STRIDE(id);
+
+	    /* start at "lower-left" corner, do whole variable */
+	    hc[0].cor[id] = 0;
+	    hc[0].edg[id] = INTNPTS(EXTNPTS(iv, id), id);
+	    nel[0] *= hc[0].edg[id];
+
+	    /* start at "upper-right" corner, do one point */
+	    hc[1].cor[id] = EXTNPTS(iv, id) - 1;
+	    hc[1].edg[id] = 1;
+	    nel[1] *= hc[1].edg[id];
+
+	    /* start about 1/3 way along diagonal, do 1/3 in each direction */
+	    hc[2].cor[id] = EXTNPTS(iv, id)/3;
+	    hc[2].edg[id] = INTNPTS(max(EXTNPTS(iv, id)/3, 1), id);
+	    nel[2] *= hc[2].edg[id];
+	}
+	for (ie = 0; ie < ne; ie++) { /* for each of ne points */
+	    int nelms = nel[ie]*nctypelen(test.vars[iv].type) + 8;
+	    /* allocate space for the cube of values */
+	    hc[ie].vals = emalloc(nelms);
+	    tmp.vals = emalloc(nelms);
+
+	    /* fill allocated space with different values of right type */
+	    val_fill(test.vars[iv].type, nel[ie], hc[ie].vals);
+
+	    /*
+	     * Set internal-array element-access basis vector to be negative 
+	     * of natural storage so as to access the elements of the array
+	     * backwards.
+	     */
+	    tmpbasis	= nctypelen(test.vars[iv].type);
+	    for (id = test.vars[iv].ndims-1; id >= 0; --id) {
+		basis[id]	 = -tmpbasis;
+		tmpbasis	*= hc[ie].edg[id];
+	    }
+
+	    if(ncvarputg (cdfid, iv, hc[ie].cor, hc[ie].edg, 
+			  strides, basis, 
+			  (char*)hc[ie].vals+(nel[ie]-1)*
+			      nctypelen(test.vars[iv].type))
+	       == -1) {
+		error("%s: ncvarputg failed for point %d, variable %s",
+		      pname, ie, test.vars[iv].name);
+		nerrs++;
+		errvar(&test, &test.vars[iv]);
+		(void)fprintf(stderr,"  corner = (");
+		for (id = 0 ; id < test.vars[iv].ndims; id++)
+		  (void)fprintf(stderr,"%d%s",(int)hc[ie].cor[id],
+				(id < test.vars[iv].ndims-1) ? ", " : "");
+		(void)fprintf(stderr,")\n");
+		(void)fprintf(stderr,"  edge = (");
+		for (id = 0 ; id < test.vars[iv].ndims; id++)
+		  (void)fprintf(stderr,"%d%s",(int)hc[ie].edg[id],
+				(id < test.vars[iv].ndims-1) ? ", " : "");
+		(void)fprintf(stderr,")\n");
+		(void)fprintf(stderr,"  external strides = (");
+		for (id = 0 ; id < test.vars[iv].ndims; id++)
+		  (void)fprintf(stderr,"%d%s",(int)strides[id],
+				(id < test.vars[iv].ndims-1) ? ", " : "");
+		(void)fprintf(stderr,")\n");
+		(void)fprintf(stderr,"  internal basis vector = (");
+		for (id = 0 ; id < test.vars[iv].ndims; id++)
+		  (void)fprintf(stderr,"%d%s",(int)basis[id],
+				(id < test.vars[iv].ndims-1) ? ", " : "");
+		(void)fprintf(stderr,")\n");
+	    } else {
+		long	dsize[H4_MAX_VAR_DIMS];
+
+		for (id = 0; id < test.vars[iv].ndims; id++)
+		    dsize[id]	= EXTNPTS(iv, id);
+		add_data(&test, iv, hc[ie].cor, dsize);
+						    /* keep test in sync */
+		if(ncvargetg (cdfid, iv, hc[ie].cor, hc[ie].edg, 
+			      strides, basis,
+			      (char*)tmp.vals+(nel[ie]-1)*
+				  nctypelen(test.vars[iv].type))
+		   == -1) {
+		    error("%s: ncvargetg failed for point %d, variable %s",
+			  pname, ie, test.vars[iv].name);
+		    nerrs++;
+		}
+		else {
+		    if (val_cmp(test.vars[iv].type, nel[ie],
+				hc[ie].vals, tmp.vals) != 0) {
+			error("%s: bad values returned from ncvargetg",
+			      pname);
+			nerrs++;
+			errvar(&test, &test.vars[iv]); /* describe var */
+		    }
+		}
+	    }
+
+	    Free ((char *) hc[ie].vals);
+	    Free ((char *) tmp.vals);
+	}
+    }
+    return nerrs;
+}
diff --git a/mfhdf/test/CMakeLists.txt b/mfhdf/test/CMakeLists.txt
new file mode 100644
index 0000000..0d45560
--- /dev/null
+++ b/mfhdf/test/CMakeLists.txt
@@ -0,0 +1,112 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_TEST)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDFSOURCE_DIR})
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (HDF4_BUILD_XDR_LIB)
+  IF (WIN32 AND NOT CYGWIN)
+    ADD_DEFINITIONS (-DNO_SYS_XDR_INC)
+  ENDIF (WIN32 AND NOT CYGWIN)
+  INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+SET (hdftest_SRCS
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/hdftest.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tchunk.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tcomp.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tcoordvar.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tdim.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/temptySDSs.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tattributes.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tfile.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tmixed_apis.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tnetcdf.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/trank0.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tsd.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tsdsprops.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tszip.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tattdatainfo.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tdatainfo.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tdatasizes.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tutils.c
+)
+
+#-- Adding test for hdftest
+ADD_EXECUTABLE (hdftest ${hdftest_SRCS})
+TARGET_NAMING (hdftest ${LIB_TYPE})
+TARGET_C_PROPERTIES (hdftest " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hdftest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET} ${LINK_LIBS})
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hdftest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+#-- Copy all the dat files from the test directory into the source directory
+SET (HDF4_REFERENCE_TEST_FILES
+    sds_szipped.dat
+    smallslice.0000.nc
+    test1.nc
+)
+
+FOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+   SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+   #MESSAGE(STATUS " Copying ${HDF4_MFHDF_TEST_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
+   ADD_CUSTOM_COMMAND (
+     TARGET     hdftest
+     POST_BUILD
+     COMMAND    ${CMAKE_COMMAND}
+     ARGS       -E copy_if_different ${HDF4_MFHDF_TEST_DIR}/${h4_file} ${dest}
+     )
+ENDFOREACH (h4_file ${HDF4_REFERENCE_TEST_FILES})
+
+#-- Adding test for cdftest
+ADD_EXECUTABLE (cdftest ${HDF4_MFHDF_TEST_SOURCE_DIR}/cdftest.c)
+TARGET_NAMING (cdftest ${LIB_TYPE})
+TARGET_C_PROPERTIES (cdftest " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (cdftest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (cdftest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+#-- Copy all the dat files from the test directory into the source directory
+SET (HDF4_REFERENCE2_TEST_FILES
+    testout.sav
+)
+
+FOREACH (h4_file ${HDF4_REFERENCE2_TEST_FILES})
+   SET (dest "${PROJECT_BINARY_DIR}/${h4_file}")
+   #MESSAGE(STATUS " Copying ${HDF4_MFHDF_TEST_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
+   ADD_CUSTOM_COMMAND (
+     TARGET     cdftest
+     POST_BUILD
+     COMMAND    ${CMAKE_COMMAND}
+     ARGS       -E copy_if_different ${HDF4_MFHDF_TEST_DIR}/${h4_file} ${dest}
+     )
+ENDFOREACH (h4_file ${HDF4_REFERENCE2_TEST_FILES})
+
+#-- Adding test for hdfnctest
+SET (hdfnctest_SRCS
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/hdfnctest.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tunlim.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tncunlim.c
+    ${HDF4_MFHDF_TEST_SOURCE_DIR}/tncvargetfill.c
+)
+
+ADD_EXECUTABLE (hdfnctest ${hdfnctest_SRCS})
+TARGET_NAMING (hdfnctest ${LIB_TYPE})
+TARGET_C_PROPERTIES (hdfnctest " " " ")
+IF (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hdfnctest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+ELSE (HDF4_BUILD_XDR_LIB)
+  TARGET_LINK_LIBRARIES (hdfnctest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+ENDIF (HDF4_BUILD_XDR_LIB)
+
+INCLUDE (CMakeTests.cmake)
diff --git a/mfhdf/test/CMakeTests.cmake b/mfhdf/test/CMakeTests.cmake
new file mode 100644
index 0000000..15690bd
--- /dev/null
+++ b/mfhdf/test/CMakeTests.cmake
@@ -0,0 +1,134 @@
+
+##############################################################################
+##############################################################################
+###           T E S T I N G                                                ###
+##############################################################################
+##############################################################################
+
+##############################################################################
+##############################################################################
+###           T H E   T E S T S                                            ###
+##############################################################################
+##############################################################################
+# Remove any output file left over from previous test run
+ADD_TEST (
+    NAME MFHDF_TEST-clearall-objects
+    COMMAND    ${CMAKE_COMMAND}
+        -E remove 
+        b150.hdf
+        bug376.hdf
+        cdfout.new
+        cdfout.new.err
+        chkbit.hdf
+        chktst.hdf
+        comptst1.hdf
+        comptst2.hdf
+        comptst3.hdf
+        comptst4.hdf
+        comptst5.hdf
+        comptst6.hdf
+        comptst7.hdf
+        datainfo_chk.hdf
+        datainfo_chkcmp.hdf
+        datainfo_cmp.hdf
+        datainfo_extend.hdf
+        datainfo_nodata.hdf
+        datainfo_simple.hdf
+        datasizes.hdf
+        dim.hdf
+        emptySDSs.hdf
+        extfile.hdf
+        exttst.hdf
+        idtypes.hdf
+        multidimvar.nc
+        nbit.hdf
+        onedimmultivars.nc
+        onedimonevar.nc
+        scaletst.hdf
+        sds1_dim1_samename.hdf
+        sds2_dim1_samename.hdf
+        SDS_8_sziped.hdf
+        SDS_16_sziped.hdf
+        SDS_32_sziped.hdf
+        sds_compressed.hdf
+        SD_externals
+        SDS_fl32_sziped.hdf
+        SDS_fl64_sziped.hdf
+        sds_szipped.hdf
+        SDSchunkedsziped.hdf
+        SDSchunkedsziped3d.hdf
+        SDSlongname.hdf
+        SDSunlimitedsziped.hdf
+        test.cdf
+        test1.hdf
+        test2.hdf
+        test_arguments.hdf
+        'This file name has quite a few characters because it is used to test the fix of bugzilla 1331. It has to be at least this long to see.'
+        Unlim_dim.hdf
+        Unlim_inloop.hdf
+        vars_samename.hdf
+        tdfanndg.hdf
+        tdfansdg.hdf
+)
+
+ADD_TEST (NAME hdftest COMMAND $<TARGET_FILE:hdftest>)
+SET (passRegex "HDF-SD test passes")
+SET_PROPERTY (TEST hdftest PROPERTY PASS_REGULAR_EXPRESSION "${passRegex}")
+SET_TESTS_PROPERTIES (hdftest PROPERTIES DEPENDS MFHDF_TEST-clearall-objects LABELS ${PROJECT_NAME})
+
+ADD_TEST (NAME cdftest COMMAND "${CMAKE_COMMAND}"
+            -D "TEST_PROGRAM=$<TARGET_FILE:cdftest>"
+            -D "TEST_ARGS:STRING="
+            -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+            -D "TEST_OUTPUT=cdfout.new"
+            -D "TEST_EXPECT=0"
+            -D "TEST_REFERENCE=testout.sav"
+            -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+)
+SET_TESTS_PROPERTIES (cdftest PROPERTIES DEPENDS hdftest LABELS ${PROJECT_NAME})
+
+ADD_TEST (NAME hdfnctest COMMAND $<TARGET_FILE:hdfnctest>)
+SET (NCpassRegex "HDF-nc test passes")
+SET_PROPERTY (TEST hdfnctest PROPERTY PASS_REGULAR_EXPRESSION "${NCpassRegex}")
+SET_TESTS_PROPERTIES (hdfnctest PROPERTIES DEPENDS cdftest LABELS ${PROJECT_NAME})
+
+#-- Adding test for xdrtest
+IF (HDF4_BUILD_XDR_LIB)
+  ADD_EXECUTABLE (xdrtest ${HDF4_MFHDF_XDR_DIR}/xdrtest.c)
+  TARGET_NAMING (xdrtest ${LIB_TYPE})
+  TARGET_C_PROPERTIES (xdrtest " " " ")
+  TARGET_LINK_LIBRARIES (xdrtest ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} ${HDF4_MF_XDR_LIB_TARGET})
+
+  IF (CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     xdrtest 
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_XDR_DIR}/xdrtest.cyg ${PROJECT_BINARY_DIR}/xdrtest.out
+    )
+  ELSE (CYGWIN)
+    ADD_CUSTOM_COMMAND (
+        TARGET     xdrtest 
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_MFHDF_XDR_DIR}/xdrtest.out ${PROJECT_BINARY_DIR}/xdrtest.out
+    )
+  ENDIF (CYGWIN)
+
+  IF (HDF4_ENABLE_USING_MEMCHECKER)
+    ADD_TEST (NAME xdrtest COMMAND $<TARGET_FILE:xdrtest>)
+  ELSE (HDF4_ENABLE_USING_MEMCHECKER)
+    ADD_TEST (
+        NAME xdrtest
+        COMMAND "${CMAKE_COMMAND}"
+            -D "TEST_PROGRAM=$<TARGET_FILE:xdrtest>"
+            -D "TEST_ARGS:STRING="
+            -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+            -D "TEST_OUTPUT=xdrtest.tst"
+            -D "TEST_EXPECT=0"
+            -D "TEST_REFERENCE=xdrtest.out"
+            -P "${HDF4_RESOURCES_DIR}/runTest.cmake"
+    )
+  ENDIF (HDF4_ENABLE_USING_MEMCHECKER)
+  SET_TESTS_PROPERTIES (xdrtest PROPERTIES DEPENDS hdfnctest LABELS ${PROJECT_NAME})
+ENDIF (HDF4_BUILD_XDR_LIB)
diff --git a/mfhdf/test/Makefile.am b/mfhdf/test/Makefile.am
new file mode 100644
index 0000000..c9bc063
--- /dev/null
+++ b/mfhdf/test/Makefile.am
@@ -0,0 +1,45 @@
+#############################################################################
+##                      Setup for building programs                        ##
+#############################################################################
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc	\
+	 -I$(top_builddir)/mfhdf/libsrc
+DEFINES=-DNDEBUG -DHDF
+AM_CPPFLAGS=$(INCLUDES) $(DEFINES)
+
+#############################################################################
+##                              Testing                                    ##
+#############################################################################
+
+TEST_PROG = cdftest hdfnctest hdftest
+TEST_SCRIPT = testmfhdf.sh
+check_PROGRAMS = cdftest hdfnctest hdftest
+check_SCRIPTS = testmfhdf.sh
+
+cdftest_SOURCES = cdftest.c
+cdftest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@ $(XDRLIB)
+
+hdfnctest_SOURCES = hdfnctest.c tutils.c tncvargetfill.c tunlim.c	\
+		    tncunlim.c
+hdfnctest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@ $(XDRLIB)
+
+hdftest_SOURCES = hdftest.c tutils.c tchunk.c tcomp.c tcoordvar.c	\
+		  tdim.c temptySDSs.c tattributes.c tfile.c		\
+		  tmixed_apis.c tnetcdf.c trank0.c tsd.c tsdsprops.c	\
+		  tszip.c tattdatainfo.c tdatainfo.c tdatasizes.c
+hdftest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@ $(XDRLIB)
+
+#############################################################################
+##                          And the cleanup                                ##
+#############################################################################
+
+CHECK_CLEANFILES += *.new *.hdf *.cdf *.cdl netcdf.h This* onedimmultivars.nc \
+               onedimonevar.nc multidimvar.nc SD_externals
+
+DISTCLEANFILES =
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/test/Makefile.in b/mfhdf/test/Makefile.in
new file mode 100644
index 0000000..a6ceaf3
--- /dev/null
+++ b/mfhdf/test/Makefile.in
@@ -0,0 +1,806 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#############################################################################
+#############################################################################
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/testmfhdf.sh.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+check_PROGRAMS = cdftest$(EXEEXT) hdfnctest$(EXEEXT) hdftest$(EXEEXT)
+TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT)
+subdir = mfhdf/test
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES = testmfhdf.sh
+CONFIG_CLEAN_VPATH_FILES =
+am_cdftest_OBJECTS = cdftest.$(OBJEXT)
+cdftest_OBJECTS = $(am_cdftest_OBJECTS)
+cdftest_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+am_hdfnctest_OBJECTS = hdfnctest.$(OBJEXT) tutils.$(OBJEXT) \
+	tncvargetfill.$(OBJEXT) tunlim.$(OBJEXT) tncunlim.$(OBJEXT)
+hdfnctest_OBJECTS = $(am_hdfnctest_OBJECTS)
+hdfnctest_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+am_hdftest_OBJECTS = hdftest.$(OBJEXT) tutils.$(OBJEXT) \
+	tchunk.$(OBJEXT) tcomp.$(OBJEXT) tcoordvar.$(OBJEXT) \
+	tdim.$(OBJEXT) temptySDSs.$(OBJEXT) tattributes.$(OBJEXT) \
+	tfile.$(OBJEXT) tmixed_apis.$(OBJEXT) tnetcdf.$(OBJEXT) \
+	trank0.$(OBJEXT) tsd.$(OBJEXT) tsdsprops.$(OBJEXT) \
+	tszip.$(OBJEXT) tattdatainfo.$(OBJEXT) tdatainfo.$(OBJEXT) \
+	tdatasizes.$(OBJEXT)
+hdftest_OBJECTS = $(am_hdftest_OBJECTS)
+hdftest_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(cdftest_SOURCES) $(hdfnctest_SOURCES) $(hdftest_SOURCES)
+DIST_SOURCES = $(cdftest_SOURCES) $(hdfnctest_SOURCES) \
+	$(hdftest_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+am__EXEEXT_1 = cdftest$(EXEEXT) hdfnctest$(EXEEXT) hdftest$(EXEEXT)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+
+#############################################################################
+#############################################################################
+CHECK_CLEANFILES = *.chkexe *.chklog *.new *.hdf *.cdf *.cdl netcdf.h \
+	This* onedimmultivars.nc onedimonevar.nc multidimvar.nc \
+	SD_externals
+INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc	\
+	 -I$(top_builddir)/mfhdf/libsrc
+
+DEFINES = -DNDEBUG -DHDF
+AM_CPPFLAGS = $(INCLUDES) $(DEFINES)
+
+#############################################################################
+#############################################################################
+TEST_PROG = cdftest hdfnctest hdftest
+TEST_SCRIPT = testmfhdf.sh
+check_SCRIPTS = testmfhdf.sh
+cdftest_SOURCES = cdftest.c
+cdftest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@ $(XDRLIB)
+hdfnctest_SOURCES = hdfnctest.c tutils.c tncvargetfill.c tunlim.c	\
+		    tncunlim.c
+
+hdfnctest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@ $(XDRLIB)
+hdftest_SOURCES = hdftest.c tutils.c tchunk.c tcomp.c tcoordvar.c	\
+		  tdim.c temptySDSs.c tattributes.c tfile.c		\
+		  tmixed_apis.c tnetcdf.c trank0.c tsd.c tsdsprops.c	\
+		  tszip.c tattdatainfo.c tdatainfo.c tdatasizes.c
+
+hdftest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@ $(XDRLIB)
+DISTCLEANFILES = 
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/test/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+testmfhdf.sh: $(top_builddir)/config.status $(srcdir)/testmfhdf.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+cdftest$(EXEEXT): $(cdftest_OBJECTS) $(cdftest_DEPENDENCIES) $(EXTRA_cdftest_DEPENDENCIES) 
+	@rm -f cdftest$(EXEEXT)
+	$(LINK) $(cdftest_OBJECTS) $(cdftest_LDADD) $(LIBS)
+hdfnctest$(EXEEXT): $(hdfnctest_OBJECTS) $(hdfnctest_DEPENDENCIES) $(EXTRA_hdfnctest_DEPENDENCIES) 
+	@rm -f hdfnctest$(EXEEXT)
+	$(LINK) $(hdfnctest_OBJECTS) $(hdfnctest_LDADD) $(LIBS)
+hdftest$(EXEEXT): $(hdftest_OBJECTS) $(hdftest_DEPENDENCIES) $(EXTRA_hdftest_DEPENDENCIES) 
+	@rm -f hdftest$(EXEEXT)
+	$(LINK) $(hdftest_OBJECTS) $(hdftest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdftest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfnctest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdftest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tattdatainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tattributes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tchunk.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tcomp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tcoordvar.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tdatainfo.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tdatasizes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tdim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/temptySDSs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tfile.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tmixed_apis.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tncunlim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tncvargetfill.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tnetcdf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trank0.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tsd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tsdsprops.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tszip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tunlim.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tutils.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile all-local
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-checkPROGRAMS clean-generic clean-libtool \
+	cscopelist ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/test/cdftest.c b/mfhdf/test/cdftest.c
new file mode 100644
index 0000000..591ad81
--- /dev/null
+++ b/mfhdf/test/cdftest.c
@@ -0,0 +1,704 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright 1988, University Corporation for Atmospheric Research           *
+ * See netcdf/COPYRIGHT file for copying and redistribution conditions.      *
+ *                                                                           *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static char mrcsid[] = "Id: cdftest.c,v 1.11 1994/01/10 23:07:27 chouck Exp ";
+
+/*
+ *	 Program to create a cdf, exercise all cdf functions.
+ *  Creates cdf, stuff it full of numbers, closes it. Then
+ *  reopens it, and checks for consistancy.
+ *  Leaves the file around afterwards.
+ *
+ *	Based on a program to test the nasa look-alike program,
+ * so not the most appropropriate test. See ../nctest for a
+ * complete spec test.
+ */
+
+#define REDEF
+/* #define SYNCDEBUG */
+/* #define NOBUF */
+#include <stdio.h>
+#include "h4config.h"
+#include "H4api_adpt.h"
+#ifdef H4_HAVE_NETCDF
+#include "netcdf.h"
+#else
+#include "hdf4_netcdf.h"
+#endif
+
+#ifdef HDF
+#include "hdf.h"
+#endif
+
+# define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__, __LINE__);exit(1);}}
+
+#define CDFMAXSHORT	32767
+#define CDFMAXLONG		2147483647
+#define  CDFMAXBYTE	127
+
+#include <errno.h>
+#if defined ERRNO_MISSING
+extern int errno;
+#endif
+
+#define FILENAME		"test.cdf"
+#define	NUM_DIMS 	3
+#define DONT_CARE	-1
+/* make these numbers big when you want to give this a real workout */
+#define NUM_RECS	8
+#define SIZE_1		7
+#define SIZE_2		8
+
+struct {
+	int num_dims ;
+	int num_vars ;
+	int num_attrs ;
+	int xtendim ;
+} cdesc[1] ;
+
+struct {
+	char mnem[H4_MAX_NC_NAME] ;
+	nc_type type ;
+	int ndims ;
+	int dims[H4_MAX_VAR_DIMS] ;
+	int num_attrs ;
+} vdesc[1] ;
+
+struct {
+	char mnem[H4_MAX_NC_NAME] ;
+	nc_type type ;
+	int len ;
+} adesc[1] ;
+
+union getret
+{
+    char            by[8] ;
+    short           sh[4] ;
+    nclong          lng[2] ;
+    float           fl[2] ;
+    double          dbl;
+} ;
+
+static void
+chkgot(type, got, check)
+nc_type type ;
+union getret got ;
+double check ;
+{
+	switch(type){
+	case NC_BYTE :
+		assert( (char)check == got.by[0] ) ;
+		break ;
+	case NC_SHORT :
+		assert( (short)check == got.sh[0] ) ;
+		break ;
+	case NC_LONG :
+		assert( (nclong)check == got.lng[0] ) ;
+		break ;
+	case NC_FLOAT :
+		assert( (float)check == got.fl[0] ) ;
+		break ;
+	case NC_DOUBLE :
+		assert( check == got.dbl ) ;
+		break ;
+	}
+}
+
+const char *fname = FILENAME ;
+
+
+int num_dims = NUM_DIMS ;
+long sizes[] = { NC_UNLIMITED, SIZE_1 , SIZE_2 } ;
+const char *dim_names[] = { "record", "ixx", "iyy"} ;
+
+static void
+createtestdims(cdfid, num_dims, sizes, dim_names)
+int cdfid ;
+int num_dims ;
+long *sizes ;
+const char *dim_names[] ;
+{
+	while(num_dims--)
+	{
+		assert( ncdimdef(cdfid, *dim_names++, *sizes) >= 0) ;
+		sizes++ ;
+	}
+
+}
+
+static void
+testdims(cdfid, num_dims, sizes, dim_names)
+int cdfid ;
+int num_dims ;
+long *sizes ;
+const char *dim_names[] ;
+{
+	int ii ;
+	long size ;
+	char cp[H4_MAX_NC_NAME] ;
+	for(ii=0 ; ii < num_dims ; ii++, sizes++)
+	{
+		assert( ncdiminq(cdfid, ii, cp, &size) >= 0) ;
+		if( size != *sizes)
+			fprintf(stderr, "%d: %ld != %ld\n",
+				(int)ii, (long)size, (long)*sizes) ;
+		assert( size == *sizes) ;
+		assert( strcmp(cp, *dim_names++) == 0) ;
+	}
+
+}
+
+
+
+const char *reqattr[] = {
+	"UNITS",
+	"VALIDMIN",
+	"VALIDMAX",
+	"SCALEMIN",
+	"SCALEMAX",
+	"FIELDNAM",
+	_FillValue
+} ;
+#define NUM_RATTRS	6
+
+struct tcdfvar {
+	const char *mnem;
+	nc_type type;
+	const char *fieldnam;
+	double validmin;
+	double validmax;
+	double scalemin;
+	double scalemax;
+	const char *units;
+	int ndims ;
+	int dims[NUM_DIMS];
+} testvars[]  = {
+#define Byte_id 0
+	{ "Byte", NC_BYTE, "Byte sized integer variable",
+		-CDFMAXBYTE, CDFMAXBYTE, -CDFMAXBYTE, CDFMAXBYTE , "ones",
+			2, {0,1,DONT_CARE} },
+#define Short_id 1
+	{ "Short", NC_SHORT, "Short variable",
+		-CDFMAXSHORT, CDFMAXSHORT, -CDFMAXSHORT, CDFMAXSHORT , "ones",
+			2, {0, 2, DONT_CARE }},
+#define Long_id 2
+	{ "Long", NC_LONG, "Long Integer variable",
+		-CDFMAXLONG, CDFMAXLONG, -CDFMAXLONG, CDFMAXLONG, "ones",
+			2, {1, 2, DONT_CARE}},
+#define Float_id 3
+	{ "Float", NC_FLOAT, "Single Precision Floating Point variable",
+		-CDFMAXLONG, CDFMAXLONG, -CDFMAXLONG, CDFMAXLONG, "flots",
+			3, {0, 1, 2 }},
+#define Double_id 4
+	{ "Double", NC_DOUBLE, "Double Precision Floating Point variable",
+		-CDFMAXLONG, CDFMAXLONG, -CDFMAXLONG, CDFMAXLONG, "dflots",
+			3, {0, 1, 2 }},
+} ;
+#define	NUM_TESTVARS	5
+
+static void
+createtestvars(id, testvars, count )
+int id ;
+struct tcdfvar *testvars ;
+int count ;
+{
+	int ii ;
+	struct tcdfvar *vp = testvars ;
+
+	for(ii = 0 ; ii < count ; ii++, vp++ )
+	{
+		assert(ncvardef(id, vp->mnem, vp->type, vp->ndims, vp->dims) == ii ) ; 
+
+	 	assert(
+			ncattput(id,ii,reqattr[0],NC_CHAR,strlen(vp->units), vp->units)
+			== 0) ; 
+	 	assert(
+			ncattput(id,ii,reqattr[1],NC_DOUBLE,1,
+				(ncvoid*)&(vp->validmin))
+			== 1) ; 
+	 	assert(
+			ncattput(id,ii,reqattr[2],NC_DOUBLE,1,
+				(ncvoid*)&(vp->validmax))
+			== 2) ; 
+	 	assert(
+			ncattput(id,ii,reqattr[3],NC_DOUBLE,1,
+				(ncvoid*)&(vp->scalemin))
+			== 3) ; 
+	 	assert(
+			ncattput(id,ii,reqattr[4],NC_DOUBLE,1,
+				(ncvoid*)&(vp->scalemax))
+			== 4) ; 
+	 	assert(
+			ncattput(id,ii,reqattr[5],NC_CHAR,strlen(vp->fieldnam), vp->fieldnam)
+			== 5) ; 
+	}
+}
+
+static void
+parray(label, count, array)
+char *label ;
+unsigned count ;
+long array[] ;
+{
+	fprintf(stdout, "%s", label) ;
+	fputc('\t',stdout) ;	
+	for(; count > 0 ; count--, array++)
+		fprintf(stdout," %d", (int)*array) ;
+}
+
+static void
+fill_seq(id)
+int id ;
+{
+    long vindices[NUM_DIMS];
+	long *cc, *mm ;
+	float val ;
+	int ii = 0 ;
+
+	sizes[0] = NUM_RECS ;
+	/* zero the indices */
+
+	cc = vindices;
+	while (cc <= &vindices[num_dims-1])
+		*cc++ = 0; 
+
+	/* ripple counter */
+	cc = vindices;
+	mm = sizes;
+	while (*vindices < *sizes)
+	{
+	    while (*cc < *mm)
+	    {
+		if (mm == &sizes[num_dims - 1])
+		{
+	val = ii ;
+#ifdef VDEBUG
+	parray("indices", NUM_DIMS, vindices) ;
+	printf("\t val %f\n", val) ;
+#endif
+	assert( ncvarput1(id, Float_id, vindices, (ncvoid*)&val) != -1) ;
+		    (*cc)++; ii++ ;
+		    continue;
+		}
+		cc++;
+		mm++;
+	    }
+		if(cc == vindices)
+			break ;
+	    *cc = 0;
+	    cc--;
+	    mm--;
+	    (*cc)++;
+	}
+}
+
+static void
+check_fill_seq(id)
+int id ;
+{
+    long vindices[NUM_DIMS];
+	long *cc, *mm ;
+	union getret got ;
+	int ii = 0;
+	float val ;
+
+	sizes[0] = NUM_RECS ;
+	cc = vindices;
+	while (cc <= &vindices[num_dims-1])
+		*cc++ = 0; 
+
+	/* ripple counter */
+	cc = vindices;
+	mm = sizes;
+	while (*vindices < *sizes)
+	{
+	    while (*cc < *mm)
+	    {
+		if (mm == &sizes[num_dims - 1])
+		{
+	if(ncvarget1(id, Float_id, vindices, (ncvoid*)&got) == -1) 
+		goto bad_ret ;
+	val = ii ;
+	if(val != got.fl[0])
+	{
+		parray("indices", (unsigned)NUM_DIMS, vindices) ;
+		printf("\t%f != %f\n", val, got.fl[0]) ;
+	}
+		    (*cc)++; ii++ ;
+		    continue;
+		}
+		cc++;
+		mm++;
+	    }
+		if(cc == vindices)
+			break ;
+	    *cc = 0;
+	    cc--;
+	    mm--;
+	    (*cc)++;
+	}
+	return ;
+bad_ret :
+	printf("couldn't get a var in check_fill_seq() %d\n",
+		(int)ii) ;
+	return ;
+}
+
+long	indices[][3] = {
+	{0, 1, 3},
+	{0, 3, 0},
+	{1, 2, 3},
+	{3, 2, 1},
+	{2, 1, 3},
+	{1, 0, 0},
+	{0, 0, 0},
+} ;
+
+char chs[] = {'A','B', ((char)0xff) } ;
+long s_start[] = {0,1};
+long s_edges[] = {NUM_RECS, SIZE_1 - 1};
+char sentence[NUM_RECS* SIZE_1 -1] =
+	"The red death had long devastated the country." ;
+short shs[] = {97, 99} ;
+nclong birthday = 82555 ;
+#define M_E	2.7182818284590452354
+float e = (float)M_E ;
+double pinot = 3.25 ;
+double zed = 0.0 ;
+
+#if defined TEST_PC || defined TEST_WIN
+#include <stdio.h>
+FILE *dbg_file;
+#endif
+
+#ifdef PROTOTYPE
+int main(int argc, char *argv[])
+#else
+int main(argc, argv)
+int argc;
+char *argv[];
+#endif
+{
+	int ret ;
+	int	 id ;
+	char new[256];
+#ifdef SYNCDEBUG
+	char *str = "one" ;
+#endif
+	int ii ;
+	long iilong ;
+	struct tcdfvar *tvp = testvars ;
+	union getret got ;
+
+#if defined TEST_PC || defined TEST_WIN
+    dbg_file=fopen("test.dbg","w+");
+#endif
+
+#ifdef MDEBUG
+	malloc_debug(2) ;
+#endif /* MDEBUG */
+	ncopts =  NC_VERBOSE ; /* errors non fatal */
+
+
+	id = nccreate(fname,NC_NOCLOBBER) ;
+	if( id == -1 ) {
+		fprintf(stderr, "trying again\n") ;
+		id = nccreate(fname,NC_CLOBBER) ;
+	}
+	if( id == -1 ) 
+		exit(errno) ;
+
+#ifdef NOBUF
+	assert( ncnobuf(id) != 1 ) ;
+#endif /* NOBUF */
+	
+	assert( ncattput(id, NC_GLOBAL,
+		"TITLE", NC_CHAR, 12, "another name") != -1) ;
+	assert( ncattget(id, NC_GLOBAL,
+		"TITLE", (ncvoid*)new) != -1) ;
+/*	printf("title 1 \"%s\"\n", new) ; */
+	assert( ncattput(id, NC_GLOBAL,
+		"TITLE", NC_CHAR, strlen(fname), fname) != -1) ;
+	assert( ncattget(id, NC_GLOBAL,
+		"TITLE", (ncvoid*)new) != -1) ;
+	new[strlen(fname)] = 0 ;
+/*	printf("title 2 \"%s\"\n", new) ; */
+	assert( strcmp(fname, new) == 0) ;
+	assert( ncattput(id, NC_GLOBAL,
+		"RCSID", NC_CHAR, strlen(mrcsid), (ncvoid*)mrcsid) != -1) ;
+
+	createtestdims(id, NUM_DIMS, sizes, dim_names) ;
+	testdims(id, NUM_DIMS, sizes, dim_names) ;
+
+	createtestvars(id, testvars, NUM_TESTVARS) ; 
+
+ 	{
+ 	long lfill = -1 ; double dfill = -9999 ;
+ 	assert( ncattput(id, Long_id,
+ 		_FillValue, NC_LONG, 1, (ncvoid*)&lfill) != -1) ;
+ 	assert( ncattput(id, Double_id,
+ 		_FillValue, NC_DOUBLE, 1, (ncvoid*)&dfill ) != -1) ;
+ 	}
+
+#ifdef REDEF
+	assert( ncendef(id) != -1 ) ;
+	assert( ncvarput1(id, Long_id, indices[3], (ncvoid *)&birthday) 
+		!= -1 ) ;
+	fill_seq(id) ;
+	assert( ncredef(id) != -1 ) ;
+#endif
+
+	assert( ncdimrename(id,1, "IXX") >= 0) ;
+	assert( ncdiminq(id, 1, new, &iilong) >= 0) ;
+	printf("dimrename: %s\n", new) ;
+	assert( ncdimrename(id,1, dim_names[1]) >= 0) ;
+
+#ifdef ATTRX
+	assert( ncattrename(id, 1, "UNITS", "units") != -1) ;
+	assert( ncattdel(id, 4, "FIELDNAM") != -1) ;
+	assert( ncattdel(id, 2, "SCALEMIN") != -1) ;
+	assert( ncattdel(id, 2, "SCALEMAX") != -1) ;
+#endif /* ATTRX */
+
+	assert( ncendef(id) != -1 ) ;
+
+#ifndef REDEF
+	fill_seq(id) ;
+	assert( ncvarput1(id, Long_id, indices[3],(char *)&birthday) != -1 ) ;
+#endif
+
+	assert( ncvarput(id, Byte_id, s_start, s_edges, (ncvoid*)sentence)
+		!= -1 ) ;
+
+	assert( ncvarput1(id, Byte_id, indices[6], (ncvoid*)(chs+1)) != -1 ) ;
+	assert( ncvarput1(id, Byte_id, indices[5], (ncvoid*)chs) != -1 ) ;
+	assert( ncvarput1(id, Short_id, indices[4],(ncvoid *)shs) != -1 ) ;
+	assert( ncvarput1(id, Float_id, indices[2],(ncvoid *)&e) != -1 ) ;
+	assert( ncvarput1(id, Double_id, indices[1],(ncvoid *)&zed) != -1 ) ;
+	assert( ncvarput1(id, Double_id, indices[0], (ncvoid *)&pinot) != -1 );
+
+
+#ifdef SYNCDEBUG
+	printf("Hit Return to sync\n");
+	gets(str);
+	ncsync(id,0) ;
+	printf("Sync done. Hit Return to continue\n");
+	gets(str);
+#endif /* SYNCDEBUG */
+
+	ret = ncclose(id) ;
+	printf("ncclose ret = %d\n\n", (int)ret) ;
+
+
+/*
+ *	read it
+ */
+	id = ncopen(fname,NC_NOWRITE) ;
+	if( id == -1 )
+	{
+		printf("Could not open %s\n", fname );
+		exit(1) ;
+	}
+	printf("reopen id = %d for filename %s\n",
+		(int)id, fname) ;
+
+#ifdef NOBUF
+	assert( ncnobuf(id) != 1 ) ;
+#endif /* NOBUF */
+
+	/*	NC	*/ 
+	printf("NC ") ;
+	assert( ncinquire(id, &(cdesc->num_dims), &(cdesc->num_vars),
+		&(cdesc->num_attrs), &(cdesc->xtendim) ) == id) ;
+	if(cdesc->num_dims != num_dims )
+	{
+		printf(" num_dims  : %d != %d\n", (int)cdesc->num_dims, (int)num_dims ) ; 
+		exit(1) ;
+	}
+	assert(cdesc->num_vars == NUM_TESTVARS) ;
+	printf("done\n") ;
+	
+	/*	GATTR	*/
+	printf("GATTR ") ;
+	assert(cdesc->num_attrs == 2) ;
+
+	assert( ncattname(id, NC_GLOBAL, 0, adesc->mnem) == 0) ;
+	assert(strcmp("TITLE",adesc->mnem) == 0) ;
+	assert( ncattinq(id, NC_GLOBAL, adesc->mnem, &(adesc->type), &(adesc->len)) != -1) ;
+	assert( adesc->type == NC_CHAR ) ;
+	assert( adesc->len == strlen(fname) ) ;
+	assert( ncattget(id, NC_GLOBAL, "TITLE", (ncvoid *)new) != -1) ;
+	new[adesc->len] = 0 ;
+	assert( strcmp(fname, new) == 0) ;
+/*	printf("Global %s %s\n", adesc->mnem, new) ; */
+
+	assert( ncattname(id, NC_GLOBAL, 1, adesc->mnem) == 1) ;
+	assert(strcmp("RCSID",adesc->mnem) == 0) ;
+	assert( ncattinq(id, NC_GLOBAL, adesc->mnem, &(adesc->type), &(adesc->len)) != -1) ;
+	assert( adesc->type == NC_CHAR ) ;
+	assert( adesc->len == strlen(mrcsid) ) ;
+	assert( ncattget(id, NC_GLOBAL, "RCSID", (ncvoid *)new) != -1) ;
+	new[adesc->len] = 0 ;
+	assert( strcmp(mrcsid, new) == 0) ;
+/*	printf("Global %s %s\n", adesc->mnem, new) ; */
+
+	/*	VAR	*/
+	printf("VAR ") ;
+	assert( cdesc->num_vars == NUM_TESTVARS ) ;
+
+	for(ii = 0 ; ii < cdesc->num_vars ; ii++, tvp++ ) 
+	{
+		int jj ;
+		assert( ncvarinq(id, ii,
+			vdesc->mnem,
+			&(vdesc->type),
+			&(vdesc->ndims),
+			vdesc->dims,
+			&(vdesc->num_attrs)) == ii) ;
+		if(strcmp(tvp->mnem , vdesc->mnem) != 0)
+		{
+			printf("attr %d mnem mismatch %s, %s\n",
+				(int)ii, tvp->mnem, vdesc->mnem) ;
+			continue ;
+		}
+		if(tvp->type != vdesc->type)
+		{
+			printf("attr %d type mismatch %d, %d\n",
+				(int)ii, tvp->type, (int)vdesc->type) ;
+			continue ;
+		}
+		for(jj = 0 ; jj < vdesc->ndims ; jj++ )
+		{
+			if(tvp->dims[jj] != vdesc->dims[jj] )
+			{
+		printf(
+		"inconsistant dim[%d] for variable %d: %d != %d\n",
+		(int)jj, (int)ii, (int)tvp->dims[jj], (int)vdesc->dims[jj] ) ;
+			continue ;
+			}
+		}
+
+		/* VATTR */
+		printf("VATTR\n") ;
+		for(jj=0 ; jj<vdesc->num_attrs ; jj++ ) 
+		{
+			assert( ncattname(id, ii, jj, adesc->mnem) == jj) ;
+			if( strcmp(adesc->mnem, reqattr[jj]) != 0 )
+			{
+				printf("var %d attr %d mismatch %s != %s\n",
+					(int)ii, (int)jj, adesc->mnem, reqattr[jj] ) ;
+				break ;
+			}
+		}
+
+		if( ncattinq(id, ii, reqattr[0], &(adesc->type), &(adesc->len))
+			!= -1) {
+		assert( adesc->type == NC_CHAR ) ;
+		assert( adesc->len == strlen(tvp->units) ) ;
+	 	assert( ncattget(id,ii,reqattr[0],(ncvoid *)new) != -1) ; 
+		new[adesc->len] = 0 ;
+		assert( strcmp(tvp->units, new) == 0) ;
+		}
+
+		if(
+			ncattinq(id, ii, reqattr[1], &(adesc->type), &(adesc->len))
+			!= -1)
+		{
+		assert( adesc->type == NC_DOUBLE ) ;
+		assert( adesc->len == 1 ) ;
+	 	assert( ncattget(id,ii,reqattr[1],(ncvoid *)&got) != -1) ; 
+		chkgot(adesc->type, got, tvp->validmin) ;
+		}
+
+		if(
+			ncattinq(id, ii, reqattr[2], &(adesc->type), &(adesc->len))
+			!= -1)
+		{
+		assert( adesc->type == NC_DOUBLE ) ;
+		assert( adesc->len == 1 ) ;
+	 	assert( ncattget(id,ii,reqattr[2],(ncvoid *)&got) != -1) ; 
+		chkgot(adesc->type, got, tvp->validmax) ;
+		}
+
+		if(
+			ncattinq(id, ii, reqattr[3], &(adesc->type), &(adesc->len))
+			!= -1)
+		{
+		assert( adesc->type == NC_DOUBLE ) ;
+		assert( adesc->len ==1 ) ;
+	 	assert( ncattget(id,ii,reqattr[3],(ncvoid *)&got) != -1) ; 
+		chkgot(adesc->type, got, tvp->scalemin) ;
+		}
+
+		if(
+			ncattinq(id, ii, reqattr[4], &(adesc->type), &(adesc->len))
+			!= -1)
+		{
+		assert( adesc->type == NC_DOUBLE ) ;
+		assert( adesc->len == 1 ) ;
+	 	assert( ncattget(id,ii,reqattr[4],(ncvoid *)&got) != -1) ; 
+		chkgot(adesc->type, got, tvp->scalemax) ;
+		}
+
+		if( ncattinq(id, ii, reqattr[5], &(adesc->type), &(adesc->len)) != -1)
+		{
+		assert( adesc->type == NC_CHAR ) ;
+		assert( adesc->len == strlen(tvp->fieldnam) ) ;
+	 	assert( ncattget(id,ii,reqattr[5],(ncvoid *)new) != -1) ; 
+		new[adesc->len] = 0 ;
+		assert( strcmp(tvp->fieldnam, new) == 0) ;
+		}
+	}
+
+	printf("fill_seq ") ;
+	check_fill_seq(id) ;
+	printf("Done\n") ;
+
+	assert( ncvarget1(id, Double_id, indices[0], (ncvoid *)&got) != -1) ;
+	printf("got val = %f\n", got.dbl ) ;
+
+	assert( ncvarget1(id, Double_id, indices[1], (ncvoid *)&got) != -1) ;
+	printf("got val = %f\n", got.dbl ) ;
+
+	assert( ncvarget1(id, Float_id, indices[2], (ncvoid *)&got) != -1) ;
+	printf("got val = %f\n", got.fl[0] ) ;
+
+	assert( ncvarget1(id, Long_id, indices[3], (ncvoid *)&got) != -1) ;
+	printf("got val = %ld\n", (long)got.lng[0] ) ;
+
+	assert( ncvarget1(id, Short_id, indices[4], (ncvoid *)&got) != -1) ;
+	printf("got val = %d\n", (int)got.sh[0] ) ;
+
+	assert( ncvarget1(id, Byte_id, indices[5], (ncvoid *)&got) != -1) ;
+	printf("got val = %c (0x%02x) \n", got.by[0] , got.by[0]) ;
+
+	assert( ncvarget1(id, Byte_id, indices[6], (ncvoid *)&got) != -1) ;
+	printf("got val = %c (0x%02x) \n", got.by[0], got.by[0] ) ;
+
+	/* (void)memset(new,0,256) ; */
+	{ char *cp = new; for(; cp < &new[sizeof(new)-1] ; *cp++ = 0) ; }
+	assert( ncvarget(id, Byte_id, s_start, s_edges, (ncvoid *)new) != -1 ) ;
+	printf("got val = \"%s\"\n", new) ;
+
+	ret = ncclose(id) ;
+	printf("re ncclose ret = %d\n", (int)ret) ;
+
+#if defined TEST_PC || defined TEST_WIN
+    fclose(dbg_file);
+#endif
+	return 0;
+}
+
diff --git a/mfhdf/test/cdftest.mak b/mfhdf/test/cdftest.mak
new file mode 100644
index 0000000..1991a9c
--- /dev/null
+++ b/mfhdf/test/cdftest.mak
@@ -0,0 +1,153 @@
+# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+!IF "$(CFG)" == ""
+CFG=Win32 Debug
+!MESSAGE No configuration specified.  Defaulting to Win32 Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line.  For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "cdftest.mak" CFG="Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+################################################################################
+# Begin Project
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "WinRel"
+# PROP BASE Intermediate_Dir "WinRel"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : $(OUTDIR)/cdftest.exe $(OUTDIR)/cdftest.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /O2 /I "..\xdr" /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "NO_SYS_XDR_INC" /D "HDF" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\xdr" /I "..\..\hdf\src" /I\
+ "..\..\hdf\jpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "NO_SYS_XDR_INC" /D\
+ "HDF" /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"cdftest.bsc" 
+
+$(OUTDIR)/cdftest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/cdftest.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\xdr\win32xdr.lib win32cdf.lib ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\xdr\win32xdr.lib win32cdf.lib ..\..\hdf\src\win32hdf.lib\
+ ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no\
+ /PDB:$(OUTDIR)/"cdftest.pdb" /MACHINE:I386 /OUT:$(OUTDIR)/"cdftest.exe" 
+
+$(OUTDIR)/cdftest.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "WinDebug"
+# PROP BASE Intermediate_Dir "WinDebug"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : $(OUTDIR)/cdftest.exe $(OUTDIR)/cdftest.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /Zi /Od /I "..\xdr" /I "..\..\hdf\src" /I "..\..\hdf\jpeg" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "NO_SYS_XDR_INC" /D "HDF" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "..\xdr" /I "..\..\hdf\src" /I\
+ "..\..\hdf\jpeg" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "NO_SYS_XDR_INC" /D\
+ "HDF" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"cdftest.pdb" /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"cdftest.bsc" 
+
+$(OUTDIR)/cdftest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/cdftest.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\xdr\win32xdr.lib win32cdf.lib ..\..\hdf\src\win32hdf.lib ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib ..\xdr\win32xdr.lib win32cdf.lib ..\..\hdf\src\win32hdf.lib\
+ ..\..\hdf\jpeg\win32jpg.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes\
+ /PDB:$(OUTDIR)/"cdftest.pdb" /DEBUG /MACHINE:I386 /OUT:$(OUTDIR)/"cdftest.exe" 
+
+$(OUTDIR)/cdftest.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Group "Source Files"
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\cdftest.c
+
+$(INTDIR)/cdftest.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################
diff --git a/mfhdf/test/gen_sds_szipped.c b/mfhdf/test/gen_sds_szipped.c
new file mode 100644
index 0000000..f00f377
--- /dev/null
+++ b/mfhdf/test/gen_sds_szipped.c
@@ -0,0 +1,128 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * This program generates the data file "sds_szipped.dat" which contains
+ * some szipped compressed SDSs. (currently only one dataset but more can be 
+ * added for future tests.)  This data file is used by the following test
+ * files:
+ *	tcomp.c: to test getting compression information with only decoder
+ *	tdatasizes.c: to test getting compressed data size with only decoder
+ *
+ * This program must be compiled with an h4cc version that was built with 
+ * szip encoder enabled. (2008-10-09 - BMR)
+ *
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define FILE_NAME      "sds_szipped.dat"
+#define SDS1_NAME      "TwoDimsInt32"
+#define X_LENGTH       5
+#define Y_LENGTH       16
+#define RANK           2
+
+/*
+ * Generate szipped data to test reading szipped data and compression info.
+ */
+intn main()
+{
+    /************************* Variable declaration **************************/
+
+    int32     sd_id, sds_id, sds_index;
+    intn      status;
+    int32     comp_type;    /* Compression flag */
+    comp_info c_info;   /* Compression structure */
+    int32     start[2], edges[2], dim_sizes[2];
+    int32     pixels_per_scanline;
+    intn      num_errs = 0;    /* number of errors in compression test so far */
+    int       i, j;
+    int32     data[Y_LENGTH][X_LENGTH]={
+				100,100,200,200,300,
+				0, 0, 0, 0, 0,
+				100,100,200,200,300,
+				400,300,200,100,0,
+				300,300,  0,400,300,
+				300,300,  0,400,300,
+				300,300,  0,400,300,
+				0,  0,600,600,300,
+				500,500,600,600,300,
+				0,  0,600,600,300,
+				0,  0,600,600,300,
+				0,  0,600,600,300,
+				0,  0,600,600,300,
+				500,500,600,600,300,
+				500,500,600,600,300,
+				500,500,600,600,300 };
+
+
+    /********************* End of variable declaration ***********************/
+
+    dim_sizes[0] = Y_LENGTH;
+    dim_sizes[1] = X_LENGTH;
+
+    /* Create the file and initialize the SD interface. */
+    sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Define the location and size of the data set to be written to the file. */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Create 3rd data set for SZIP compression. */
+    sds_id = SDcreate (sd_id, SDS1_NAME, DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Set data set SDS1_NAME to use SZIP compression. */
+    comp_type = COMP_CODE_SZIP;
+    pixels_per_scanline = dim_sizes[1];
+    c_info.szip.pixels = dim_sizes[0]*dim_sizes[1];;
+    c_info.szip.pixels_per_block = 2;
+    if(pixels_per_scanline >=2048)
+	c_info.szip.pixels_per_scanline = 512;
+    else
+	c_info.szip.pixels_per_scanline = dim_sizes[1];
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 64;
+
+    status = SDsetcompress (sds_id, comp_type, &c_info); 
+    CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write the stored data to the 3rd data set. */
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the 3rd data set. */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* main */
+
+#endif /* HDF */
diff --git a/mfhdf/test/hdfnctest.c b/mfhdf/test/hdfnctest.c
new file mode 100644
index 0000000..c9e07f5
--- /dev/null
+++ b/mfhdf/test/hdfnctest.c
@@ -0,0 +1,53 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5109 $";
+#endif
+
+#include "mfhdf.h"
+
+#include "hdftest.h"
+
+/* all test functions to be called in main */
+extern int test_unlim();
+extern int test_ncunlim();
+extern int test_ncvargetfill();
+
+int 
+main(int argc, char *argv[])
+{
+    intn  status;          /* status flag */
+    int   num_errs = 0;    /* number of errors so far */
+
+    /* Tests reading/writing datasets with unlimited dimension via HDF
+       API (bugzilla 1378) -BMR, Jan 07, 2009 */
+    status = test_unlim();  /* in tunlim.c */
+    num_errs = num_errs + status;
+
+    /* Tests reading/writing variables with unlimited dimension via nc
+       API (bugzilla 1378) -BMR, Jan 07, 2009 */
+    status = test_ncunlim();  /* in tncunlim.c */
+    num_errs = num_errs + status;
+
+    /* Tests ncvarget in filling fill-values where appropriate (HDFFR-1390)
+       -BMR, Sep 05, 2013 */
+    status = test_ncvargetfill();  /* in tncvargetfill.c */
+    num_errs = num_errs + status;
+
+    if (num_errs == 0)
+	printf("*** HDF-nc test passes ***\n");
+    else                                                          \
+	printf("*** HDF-nc test fails ***\n");
+    return num_errs;
+}
+
diff --git a/mfhdf/test/hdftest.c b/mfhdf/test/hdftest.c
new file mode 100644
index 0000000..c6f5ec7
--- /dev/null
+++ b/mfhdf/test/hdftest.c
@@ -0,0 +1,1660 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5218 $";
+#endif
+
+/* $Id: hdftest.c 5218 2009-08-29 04:21:49Z bmribler $ */
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define UFOFILE   "file.UFO"  /* non-existing file */
+#define FILE1     "test1.hdf"
+#define FILE2     "test2.hdf"
+#define EXTTST    "exttst.hdf"    /* main file for external file test */
+#define EXTFILE   "SD_externals"  /* external file created in test */
+#define NBITFILE  "nbit.hdf"
+#define COMPFILE1 "comptst1.hdf"
+#define COMPFILE2 "comptst2.hdf"
+#define COMPFILE3 "comptst3.hdf"
+#define COMPFILE4 "comptst4.hdf"
+#define COMPFILE5 "comptst5.hdf"
+#define COMPFILE6 "comptst6.hdf"
+#define COMPFILE7 "comptst7.hdf"
+#define CHKFILE   "chktst.hdf"    /* Chunking test file */
+#define CNBITFILE "chknbit.hdf"   /* Chunking w/ NBIT compression */
+
+/* Which tests to run? */
+#define EXTERNAL_TEST 
+#define NBIT_TEST 
+#define COMP_TEST 
+#define CHUNK_TEST
+/*  commented out for now because of 'long' handling on 64-bit
+    machines by this version of the netCDF library is broken. 
+    The new version of the netCDF library(2.4.3?) has fixed 
+    this I think. To fix it here requires merging in those fixes.*/
+
+#define NETCDF_READ_TEST 
+
+/* all test functions to be called in main */
+extern int test_netcdf_reading();
+extern int test_szip_compression();
+extern int test_checkempty();
+extern int test_idtest();
+/* extern int test_sd(); - removed temporarily, see note in main(...) */
+extern int test_mixed_apis();
+extern int test_files();
+extern int test_SDSprops();
+extern int test_coordvar();
+extern int test_chunk();
+extern int test_compression();
+extern int test_dimension();
+extern int test_attributes();
+extern int test_datasizes();
+extern int test_datainfo();
+extern int test_att_ann_datainfo();
+
+int 
+main(int argc, char *argv[])
+{
+    int32 f1, f2, fext, fnbit; /* File handles */
+    int32 nt;                /* Number type */
+    int32 dimsize[10];       /* dimension sizes */
+    int32 newsds, newsds2, newsds3; /* SDS handles */
+    int32 sdsid;                 /* SDS handle */
+    int32 noextsds;              /* no external SDS id */
+    int32 dimid, dimid1, dimid2; /* Dimension handles */
+    int32 num_sds;               /* number of SDS in file */
+    int32 num_gattr;             /* Number of global attributes */
+    int32 offset;                /* offset for ? */
+    int32 index;       /* Index of dataset in file */
+    int32 ival;
+    int32 sdid;        /* another SDS handle */
+    int32 rank;        /* rank of SDS */
+    intn  status;      /* status flag */
+    intn  i;           /* loop variables */
+    intn  nattrs;      /* Number of attributes again? */
+    char name[90];
+    char text[256];
+    int32   start[10], end[10], stride[10]; /* start, end, stride arrays */
+    int32   scale[10];
+    char    l[80], u[80], fmt[80], c[80];
+    int32   count;
+    int32   fillval, readval;
+    int32   idata[100];
+    int32   rdata[100];
+    int16   sdata[100], outdata[100];
+    int32   ndg_saved_ref;  /* used to save a ref of an SDS in one of the test */
+    uint8   iuval;
+    float32 data[1000], max, min, imax, imin;
+    float64 cal, cale, ioff, ioffe;
+    int     num_errs = 0;    /* number of errors so far */
+
+    ncopts = NC_VERBOSE;
+
+    /* Testing SDstart */
+    /* Try start non-existing file with RDONLY and RDWR. Both should fail. */
+    f1 = SDstart(UFOFILE, DFACC_RDONLY);
+
+    if (f1 != FAIL)
+      {
+          fprintf(stderr, "SDstart(..., RDONLY) should fail\n");
+          num_errs++;
+          SDend(f1);
+      }
+
+    f1 = SDstart(UFOFILE, DFACC_RDWR);
+    if (f1 != FAIL)
+      {
+          fprintf(stderr, "SDstart(..., RDWR) should fail\n");
+          num_errs++;
+          SDend(f1);
+      }
+
+    /* -------hmm what are testing here?----------------- */
+
+    /* Create two files */
+    f1 = SDstart(FILE1, DFACC_CREATE);
+    CHECK(f1, FAIL, "SDstart");
+
+    f2 = SDstart(FILE2, DFACC_CREATE);
+    CHECK(f2, FAIL, "SDstart");
+
+    /* whats in these empty files */
+    status = SDfileinfo(f1, &num_sds, &num_gattr);
+    CHECK(status, FAIL, "SDfileinfo");
+
+    if(num_gattr != 0) 
+      {
+          fprintf(stderr, "File %s still has stuff in it\n", FILE1);
+          num_errs++;
+      }
+
+    /* create a 4 by 8 dataset called DataSetAlpha in file test1.hdf */
+    dimsize[0] = 4;
+    dimsize[1] = 8;
+    newsds = SDcreate(f1, "DataSetAlpha", DFNT_FLOAT32, 2, dimsize);
+    CHECK(newsds, FAIL, "SDcreate: Failed to create a new data set DataSetAlpha ");
+
+    /* save the ref number for the first dataset --- will check at very end */
+    ndg_saved_ref = SDidtoref(newsds);
+    CHECK(ndg_saved_ref, 0, "SDidtoref: Failed to get NDG ref for DataSetAlpha ");
+
+    /* create datatset DataSetGamma in file test1.hdf */
+    newsds3 = SDcreate(f1, "DataSetGamma", DFNT_FLOAT64, 1, dimsize);
+    CHECK(newsds3, FAIL, "SDcreate:Failed to create a new data set gamma");
+
+    /* get info on number of datasets and global attributes in file */
+    status = SDfileinfo(f1, &num_sds, &num_gattr);
+    CHECK(status, FAIL, "SDfileinfo");
+
+    if(num_sds != 2) 
+      {
+        fprintf(stderr, "Wrong number of datasets in file 1\n");
+        num_errs++;
+      }
+
+    /* get dimension handle for first dimension? of DataSetGamma */
+    dimid = SDgetdimid(newsds3, 0);
+    CHECK(dimid, FAIL, "SDgetdimid:Failed to get dimension id");
+
+    /* reset the dimension name to Mydim? */
+    status = SDsetdimname(dimid, "MyDim");
+    CHECK(status, FAIL, "SDsetdimname: Failed to set dimension name to 'MyDim'");
+
+    /* Set dimension attribute to 'TRUE' */
+    status = SDsetattr(dimid, "DimensionAttribute", DFNT_CHAR8, 4, "TRUE");
+    CHECK(status, FAIL, "SDsetattr: Failed to set Dimension attribute");
+    
+    /* hmm. look it back up again. */
+    status = SDfindattr(dimid, "DimensionAttribute");
+    if(status != 0) 
+      {
+        fprintf(stderr, "SDfindattr: Bad index for finding 'DimensionAttribute' %d\n",
+                status);
+        num_errs++;
+      }
+
+    /* Find out info about first atribute for dimension  */
+    status = SDattrinfo(dimid, (int32) 0, name, &nt, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+
+    /* read first attribute in, assume CHAR here. */
+    status = SDreadattr(dimid, 0, text);
+    CHECK(status, FAIL, "SDreadattr");
+    
+    /* Compare value reterieved to what was written */
+    if(HDstrncmp(text, "TRUE", count)) 
+      {
+        fprintf(stderr, "SDreadattr: Invalid dimension attribute read <%s>\n", text);
+        num_errs++;
+      }
+
+    /* get First dimension of dataset 'DataSetAlpha' */
+    dimid = SDgetdimid(newsds, 0);
+    CHECK(dimid, FAIL, "SDgetdimid: Failed to get dimension id");
+
+    /* Set this name of this dimension to 'Mydim' */
+    status = SDsetdimname(dimid, "MyDim");
+    CHECK(status, FAIL, "SDsetdimname");
+
+
+    /* Set the scales for this dimension also */
+    scale[0] = 1;
+    scale[1] = 5;
+    scale[2] = 7;
+    scale[3] = 24;
+    status = SDsetdimscale(dimid, 4, DFNT_INT32, (VOIDP) scale);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /* Set the dimension strings for the dimension also */
+    status = SDsetdimstrs(dimid, "DimLabel", NULL, "TheFormat");
+    CHECK(status, FAIL, "SDsetdimstrs");
+
+    /* verify that we can read the dimensions values with SDreaddata */
+    start[0] = 0;
+    end[0]   = 4;
+    status = SDreaddata(dimid, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* compare retrieved values for scale */
+    for(i = 0; i < 4; i++) 
+      {
+        if(idata[i] != scale[i]) 
+          {
+              fprintf(stderr, "SDreaddata() returned %ld not %ld in location %d\n", 
+                      (long)idata[i], (long)scale[i], i);
+              num_errs++;
+          }
+      }
+
+    /* hmm...lets store an attribute here for the dimension */
+    max = (float32)3.1415;
+    status = SDsetattr(dimid, "DimAttr", DFNT_FLOAT32, 1, (VOIDP) &max);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* lets make sure we can read it too */
+    status = SDattrinfo(dimid, 3, name, &nt, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+
+    if(nt != DFNT_FLOAT32) 
+      {
+        fprintf(stderr, "Wrong number type for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    if(count != 1) 
+      {
+        fprintf(stderr, "Wrong count for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    if(strcmp(name, "DimAttr")) 
+      {
+        fprintf(stderr, "Wrong name for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    /* get second dimension of data set 'DataSetAlpha' */
+    dimid2 = SDgetdimid(newsds, 1);
+    CHECK(dimid2, FAIL, "SDgetdimid: Failed to get second dimension id");
+
+    /* lets store an attribute for the dimension without explicitly 
+       creating the coord var first */
+    ival = -256;
+    status = SDsetattr(dimid2, "Integer", DFNT_INT32, 1, (VOIDP) &ival);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* lets make sure we can read it too */
+    status = SDattrinfo(dimid2, 0, name, &nt, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+
+    if(nt != DFNT_INT32) 
+      {
+        fprintf(stderr, "Wrong number type for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    if(count != 1) 
+      {
+        fprintf(stderr, "Wrong count for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    if(strcmp(name, "Integer")) 
+      {
+        fprintf(stderr, "Wrong name for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    /* read dimension attribute back in */
+    ival = 0;
+    status = SDreadattr(dimid2, 0, (VOIDP) &ival);
+    CHECK(status, FAIL, "SDreatattr");
+    
+    if(ival != -256) 
+      {
+        fprintf(stderr, "Wrong value for SDreadattr(dim)\n");
+        num_errs++;
+      }
+
+    /* add an unsigned integer as an dimension attribute */
+    iuval = 253;
+    status = SDsetattr(dimid2, "UnsignedInteger", DFNT_UINT8, 1, (VOIDP) &iuval);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* lets make sure we can read it too */
+    status = SDattrinfo(dimid2, 1, name, &nt, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+
+    if(nt != DFNT_UINT8) 
+      {
+        fprintf(stderr, "Wrong number type for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    if(count != 1) 
+      {
+        fprintf(stderr, "Wrong count for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    if(strcmp(name, "UnsignedInteger")) 
+      {
+        fprintf(stderr, "Wrong name for SDattrinfo(dim)\n");
+        num_errs++;
+      }
+
+    /* read second dimension attribute back in */
+    iuval = 0;
+    status = SDreadattr(dimid2, 1, (VOIDP) &iuval);
+    CHECK(status, FAIL, "SDreatattr");
+    
+    if(iuval != 253) 
+      {
+        fprintf(stderr, "Wrong value for SDreadattr(dim)\n");
+        num_errs++;
+      }
+
+    /* Find index of data set 'DataSetAlpha' in file test1.hdf */
+    status = SDnametoindex(f1, "DataSetAlpha");
+    if(status != 0) 
+      {
+        fprintf(stderr, "Couldn't find data set in file 1\n");
+        num_errs++;
+      }
+
+    /* Try finding data set in test2.hdf, should fail? */
+    status = SDnametoindex(f2, "DataSetAlpha");
+    if(status != FAIL) 
+      {
+        fprintf(stderr, "Found data set in wrong file 2\n");
+        num_errs++;
+      }
+
+    /* Try finding non-existent dataset in file, should fail */
+    status = SDnametoindex(f1, "BogusDataSet");
+    if(status != FAIL) 
+      {
+        fprintf(stderr, "Found bogus data set in file 1\n");
+        num_errs++;
+      }
+
+    /* Set fill value for data set 'DataSetAlpha' assume we still have valid
+       handle at this point...*/
+    max = -17.5;
+    status = SDsetfillvalue(newsds, (VOIDP) &max);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* initialize array to write out */
+    for(i = 0; i < 10; i++)
+        data[i] = (float32) i;
+
+    /* write out (1,1)->(3,3) array out */ 
+    start[0] = start[1] = 1;
+    end[0]   = end[1]   = 3;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* set the range for data set 'DataSetAlpha' */
+    max = (float32)10.0;
+    min = (float32)4.6;
+    status = SDsetrange(newsds, (VOIDP) &max, (VOIDP) &min);
+    CHECK(status, FAIL, "SDsetrange");
+
+    /* Brillant...., retrieve it right back....*/
+    status = SDgetrange(newsds, (VOIDP) &imax, (VOIDP) &imin);
+    CHECK(status, FAIL, "SDsetrange");
+
+    /* set a character attribute for data set 'DataSetAlpha' */
+    status = SDsetattr(newsds, "spam", DFNT_CHAR8, 6, "Hi mom");
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Set the data strings for data set 'DataSetAlpha' */
+    status = SDsetdatastrs(newsds, "TheLabel", "TheUnits", NULL, "TheCordsys");
+    CHECK(status, FAIL, "SDsetdatastrs");
+
+    /* Brilliant.....retrieve them right back */
+    status = SDgetdatastrs(newsds, l, u, fmt, c, 80);
+    CHECK(status, FAIL, "SDgetdatastrs");
+
+    if(HDstrcmp(l, "TheLabel")) 
+      {
+        fprintf(stderr, "Bogus label returned (%s)\n", l);
+        num_errs++;
+      }
+    if(HDstrcmp(u, "TheUnits")) 
+      {
+        fprintf(stderr, "Bogus units returned (%s)\n", u);
+        num_errs++;
+      }
+    if(HDstrcmp(fmt, "")) 
+      {
+        fprintf(stderr, "Bogus format returned\n");
+        num_errs++;
+      }
+    if(HDstrcmp(c, "TheCordsys")) 
+      {
+        fprintf(stderr, "Bogus cordsys returned\n");
+        num_errs++;
+      }
+
+    /* retrieve CHAR attribute for 'DataSetAlpha' */
+    status = SDfindattr(newsds, "spam");
+    if(status != 2) 
+      {
+        fprintf(stderr, "Bad index for SDfindattr\n");
+        num_errs++;
+      }
+
+    /* retrieve non-existent CHAR attribute for 'DataSetAlpha'. 
+       Should fail. */
+    status = SDfindattr(newsds, "blarf");
+    if(status != FAIL) 
+      {
+        fprintf(stderr, "SDfindattr found non-existant attribute\n");
+        num_errs++;
+      }
+
+    /* hmm....set global attributes for File 'test1.hdf' */
+    status = SDsetattr(f1, "F-attr", DFNT_CHAR8, 10, "globulator");
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* get info about the global attribute just created....*/
+    status = SDattrinfo(f1, (int32) 0, name, &nt, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+
+    /* read this global attribute back in ....*/
+    status = SDreadattr(f1, 0, text);
+    CHECK(status, FAIL, "SDreadattr");
+    
+    if(HDstrncmp(text, "globulator", count)) 
+      {
+        fprintf(stderr, "Invalid global attribute read <%s>\n", text);
+        num_errs++;
+      }
+
+    /* Get number of SDS and global attributes in file 'test2.hdf'.
+       It should be empty...*/
+    status = SDfileinfo(f2, &num_sds, &num_gattr);
+    if(num_sds != 0) 
+      {
+        fprintf(stderr, "File2 still has stuff in it\n");
+        num_errs++;
+      }
+
+    /* Set calibration info for dataset 'DataSetGamma' in file 'test1.hdf' */
+    cal   = 1.0;
+    cale  = 5.0;
+    ioff  = 3.0;
+    ioffe = 2.5;
+    nt    = DFNT_INT8;
+    status = SDsetcal(newsds3, cal, cale, ioff, ioffe, nt);
+    CHECK(status, FAIL, "SDsetcal");
+
+    /* create a record variable in file 'test2.hdf' */
+    dimsize[0] = SD_UNLIMITED;
+    dimsize[1] = 6;
+    newsds2 = SDcreate(f2, "DataSetBeta", DFNT_INT16, 2, dimsize);
+    CHECK(newsds2, FAIL, "SDcreate: Failed to create new data set 'DataSetBeta'");
+
+    /* get info on number of SDSs and global attributes in file 'test2.hdf'
+       There should be only 1 SDS */
+    status = SDfileinfo(f2, &num_sds, &num_gattr);
+    if(num_sds != 1) 
+      {
+        fprintf(stderr, "Wrong number of datasets in file 2\n");
+        num_errs++;
+      }
+
+    for(i = 0; i < 50; i++)
+        sdata[i] = i;
+
+
+    /* Write data to dataset 'DataSetBeta' in file 'test2.hdf' */
+    start[0] = start[1] = 0;
+    end[0]   = 8;
+    end[1]   = 6;
+    status = SDwritedata(newsds2, start, NULL, end, (VOIDP) sdata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Now read part of an earlier dataset,'DataSetAlpha', 
+       back in from file 'test1.hdf' */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 3;
+    status = SDreaddata(newsds, start, NULL, end, (VOIDP) data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* verify the data values retrieved from 'DataSetAlpha' */
+    if(data[0] != -17.5) 
+      {
+        fprintf(stderr, "Wrong value returned loc 0: %f\n",(float)data[0]);
+        num_errs++;
+      }
+    if(data[3] != -17.5) 
+      {
+        fprintf(stderr, "Wrong value returned loc 3: %f\n",(float)data[3]);
+        num_errs++;
+      }
+    if(data[5] != 1.0) 
+      {
+        fprintf(stderr, "Wrong value returned loc 5: %f\n",(float)data[5]);
+        num_errs++;
+      }
+    if(data[6] != -17.5) 
+      {
+        fprintf(stderr, "Wrong value returned loc 6: %f\n",(float)data[6]);
+        num_errs++;
+      }
+    if(data[8] != 4.0) 
+      {
+        fprintf(stderr, "Wrong value returned loc 8: %f\n",(float)data[8]);
+        num_errs++;
+      }
+
+    for(i = 0; i < 50; i++)
+        outdata[i] = 0;
+
+    /* read data back in from 'DataSetBeta' from file 'test2.hdf' */
+    start[0] = start[1] = 1;
+    end[0]   = 3;
+    end[1]   = 3;
+    stride[0] = 2;
+    stride[1] = 2;
+    status = SDreaddata(newsds2, start, stride, end, (VOIDP) outdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    { /* verify read values; should be
+    7 9 11 19 21 23 31 33 35 */
+      int i,j; /* indexing the two dimensions */
+      int k,l; /* counters = number of elements read on each dimension */
+      int m=0; /* indexing the outdata array */
+      for(i = 1,l=0; l<3; i=i+2,l++)
+  for (j =(i*6)+1,k=0; k<3; j=j+2,k++,m++)
+  {
+      if (m < 10) /* number of elements read is 9 */
+      if (outdata[m] != sdata[j])
+      {
+    fprintf(stderr, "line %d, wrong value: should be %d, got %d\n",
+                           __LINE__, sdata[j], outdata[m]);
+    num_errs++;
+      }
+  }
+    }
+
+    /* why do we set calibration info and then use SDgetcal() 
+       on dataset 'DataSetGamma' ? */
+    cal   = 1.0;
+    cale  = 5.0;
+    ioff  = 3.0;
+    ioffe = 2.5;
+    nt    = DFNT_INT8;
+    status = SDgetcal(newsds3, &cal, &cale, &ioff, &ioffe, &nt);
+    CHECK(status, FAIL, "SDgetcal");
+
+    /* Verify calibration data for data set 'DataSetGamma' */
+    if(cal != 1.0) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_errs++;
+      }
+
+    if(cale != 5.0) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_errs++;
+      }
+
+    if(ioff != 3.0) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_errs++;
+      }
+
+    if(ioffe != 2.5) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_errs++;
+      }
+
+    if(nt != DFNT_INT8) 
+      {
+        fprintf(stderr, "Wrong calibration info\n");
+        num_errs++;
+      }
+
+    /* end access to data set 'DataSetAlpha' */
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* end access to data set 'DataSetBeta' */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* end access to data set 'DataSetGamma' */
+    status = SDendaccess(newsds3);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close access to file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /* Close access to file 'test2.hdf' */
+    status = SDend(f2);
+    CHECK(status, FAIL, "SDend");
+
+
+    /*
+     * New set of tests?.....
+     */
+
+    /* test SDsetfillmode   */
+    /* test fixed size SDS   */
+    /* create an empty SDS, set SD_NOFILL.
+       Change the fill mode to SD_FILL, and write a slab of data */
+
+    /* open file 'test1.hdf' */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart (again)");
+
+    /* Set fill mode on file to not write out fill values */
+    status = SDsetfillmode(f1, SD_NOFILL);
+    CHECK(status, FAIL, "SDsetfillmode: (SD_NOFILL)");
+
+    /* Create data set 'FIXED1' in file test1.hdf */
+    dimsize[0]=5;
+    dimsize[1]=6;
+    sdid = SDcreate(f1, "FIXED1", DFNT_INT32, 2, dimsize);
+    CHECK(sdid, FAIL, "SDcreate:Fail to create data set 'FIXED1' in 'test1.hdf'");
+
+    for (i=0; i<30; i++)
+        idata[i] = i+100;
+
+    /* Set fill value attribute for data set 'FIXED1' using SDsetattr().
+       Same affect as using SDsetfillvalue(). */
+    fillval = -300;
+    status = SDsetattr(sdid, "_FillValue", DFNT_INT32, 1,
+               (VOIDP) &fillval); /* can use SDsetfillvalue */
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Test get compression info when the data set is empty and not set
+       to be compressed */
+    {
+  comp_coder_t comp_type;  /* type of compression */
+  comp_info cinfo;  /* compression information */
+  status = SDgetcompinfo(sdid, &comp_type, &cinfo);
+  CHECK(status, FAIL, "SDgetcompinfo");
+  VERIFY(comp_type, COMP_CODE_NONE, "SDgetcompinfo");
+    }
+
+    /* end access to data set 'FIXED1' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* get index of dataset in file 'test1.hdf' called 'FIXED1' */
+    index = SDnametoindex(f1, "FIXED1");
+    CHECK(index, FAIL, "SDnametoindex");
+
+    /* Select data set 'FIXED1' based on it's index */
+    sdid = SDselect(f1, index);
+    CHECK(sdid, FAIL, "SDselect");
+
+    /* change the fill mode for the file back to writing out the fill
+       values. */
+    status = SDsetfillmode(f1, SD_FILL);
+    CHECK(status, FAIL, "SDsetfillmode");
+
+    /* Write data to data set 'FIXED1'.
+       Note that SD_FILL mode is on. */
+    start[0]=2;
+    start[1]=0;
+    end[0]=1;
+    end[1]=6;
+    status = SDwritedata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata: (SD_FILL)");
+
+    /* Test get compression info when the data set is not empty and 
+       compressed */
+    {
+  comp_coder_t comp_type;  /* type of compression */
+  comp_info cinfo;  /* compression information */
+  status = SDgetcompinfo(sdid, &comp_type, &cinfo);
+  CHECK(status, FAIL, "SDgetcompinfo");
+  VERIFY(comp_type, COMP_CODE_NONE, "SDgetcompinfo");
+    }
+
+    /* end access to data set 'FIXED1' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* set the fill mode for 'test1.hdf' to no-fill */
+    status = SDsetfillmode(f1, SD_NOFILL);
+    CHECK(status, FAIL, "SDsetfillmode (SD_NOFILL)");
+
+    /* create a data set 'FIXED' in file 'test1.hdf' */
+    sdid = SDcreate(f1, "FIXED", DFNT_INT32, 2, dimsize);
+    CHECK(sdid,FAIL,"SDcreate:Failed to create data set 'FIXED' in file 'test1.hdf'");
+
+    for (i=0; i<30; i++)
+        idata[i] = i+100;
+
+    /* Set fill value for data set 'FIXED' using SDsetfillvalue() */
+    fillval = -300;
+    status = SDsetfillvalue(sdid, (VOIDP) &fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* write out the first 2 records to data set 'FIXED' with SD_NOFILL mode */
+    start[0]=2;
+    start[1]=0;
+    end[0]=1;
+    end[1]=6;
+    status = SDwritedata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata: (SD_NOFILL)");
+
+    /* end access to data set 'FIXED' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /* open again, write record 4 with SD_FILL mode */
+    /* fill values already written out in the first SDwritedata,
+       fillmode changes should not affect the fill values */
+
+    /* open file 'test1.hdf' */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart: test1.hdf");
+
+    /* Set fill mode to SD_FILL */
+    status = SDsetfillmode(f1, SD_FILL);
+    CHECK(status, FAIL, "SDsetfillmode: (SD_FILL)");
+
+    /* get index of data set 'FIXED' */
+    index = SDnametoindex(f1, "FIXED");
+    CHECK(index, FAIL, "SDnametoindex: (FIXED)");
+
+    /* Select the data set 'FIXED' based on its index */
+    sdid = SDselect(f1, index);
+    CHECK(sdid, FAIL, "SDselect: (FIXED)");
+
+    /* Get its fill value */
+    status = SDgetfillvalue(sdid, &readval);
+    CHECK(status, FAIL, "SDgetfillvalue: (FIXED)");
+    VERIFY(readval, -300, "SDgetfillvalue");
+
+    /* Write record 4 */
+    start[0]=4;
+    start[1]=0;
+    end[0]=1;
+    end[1]=6;
+    status = SDwritedata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata (SD_FILL)");
+
+    /* end access to data set 'FIXED' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /* read back and check fill values */
+
+    /* open file 'test1.hdf' back up */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart: test1.hdf");
+
+    /* get index of data set 'FIXED' */
+    index = SDnametoindex(f1, "FIXED");
+    CHECK(index, FAIL, "SDnametoindex (FIXED)");
+
+    /* Select the data set 'FIXED' based on its index */
+    sdid = SDselect(f1, index);
+    CHECK(sdid, FAIL, "SDselect (FIXED)");
+
+    /* read data back in from data set 'FIXED' */
+    start[0]=0;
+    start[1]=0;
+    end[0]=5;
+    end[1]=6;
+    status = SDreaddata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDreaddata(FIXED)");
+
+    /* verify the data */
+    for (i=12; i<18; i++)  
+      {
+        if ((idata[i] != 100 + (i-12)) ||
+            (idata[i+12] != 100 + (i-12))) 
+          {
+           fprintf(stderr, "line %d, wrong value: should be %d, got %d %d\n",
+                           __LINE__,100 + i-12, (int)idata[i], (int)idata[i+12]);
+           num_errs++;
+          }
+      }
+    
+    for (i=18; i<24; i++)  
+      {
+        if (idata[i] ==fillval) 
+          {
+           fprintf(stderr, "line %d, wrong value: should not be %d, got %d\n",
+                           __LINE__,(int)fillval, (int)idata[i]);
+           num_errs++;
+          }
+      }
+
+    /* end access to data set 'FIXED' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* read back in data set 'FIXED1' , with fill values */
+
+    /* get index of data set 'FIXED1' from file 'test1.hdf' */
+    index = SDnametoindex(f1, "FIXED1");
+    CHECK(index, FAIL, "SDnametoindex (FIXED1)");
+
+    /* select dataset 'FIXED1' based on its index in the file */
+    sdid = SDselect(f1, index);
+    CHECK(sdid, FAIL, "SDselect (FIXED1)");
+
+    /* read data from data set 'FIXED1' */
+    start[0]=0;
+    start[1]=0;
+    end[0]=5;
+    end[1]=6;
+    status = SDreaddata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDreaddata(FIXED)");
+
+    /* verify the data */
+    for (i=12; i<18; i++)  
+      {
+        if (idata[i] != (100 + (i-12)))  
+          {
+           fprintf(stderr, "line %d, wrong value: should be %d, got %d \n",
+                           __LINE__, 100 + i-12, (int)idata[i]);
+           num_errs++;
+          }
+      }
+
+    for (i=18; i<24; i++)  
+      {
+        if (idata[i] != fillval) 
+          {
+           fprintf(stderr, "line %d, wrong value: should be %d, got %d\n",
+                           __LINE__, (int)fillval, (int)idata[i]);
+           num_errs++;
+          }
+      }
+
+    /* end access to data set 'FIXED1' in file 'test1.hdf' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+   /* 
+    * test UNLIMITED size SDS   
+    */
+
+    /* open file 'test1.hdf' */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart (file1)");
+
+    /* set fill mode to no-fill */
+    status = SDsetfillmode(f1, SD_NOFILL);
+    CHECK(status, FAIL, "SDsetfillmode (SD_NOFILL)");
+
+    /* Set first dimension to UNLIMITED.
+       Create data set 'UNLIMITED_SDS' in file 'test1.hdf' */
+    dimsize[0]=SD_UNLIMITED;
+    dimsize[1]=6;
+    sdid = SDcreate(f1, "UNLIMITED_SDS", DFNT_INT32, 2, dimsize);
+    CHECK(sdid, FAIL, "SDcreate:Failed to create data set 'UNLIMITED_SDS' in file 'test1.hdf'");
+
+    for (i=0; i<24; i++)
+        idata[i] = i;
+
+    /* Set fill value for data set 'UNLIMITED_SDS' */
+    fillval = -300;
+    status = SDsetfillvalue(sdid, (VOIDP) &fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* write out the third record with SD_NOFILL mode on */
+    start[0]=2;
+    start[1]=0;
+    end[0]=1;
+    end[1]=6;
+    status = SDwritedata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata: (SD_NOFILL, UNLIMITED)");
+
+    /* end access to data set 'UNLIMITED_SDS' in file 'test1.hdf' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /* open again, write record 4 with SD_FILL mode */
+
+    /* open file 'test1.hdf' again */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart: test1.hdf");
+
+    /* set fill mode to SD_FILL */
+    status = SDsetfillmode(f1, SD_FILL);
+    CHECK(status, FAIL, "SDsetfillmode: (SD_FILL)");
+
+    /* get index of data set 'UNLIMITED_SDS' */
+    index = SDnametoindex(f1, "UNLIMITED_SDS");
+    CHECK(index, FAIL, "SDnametoindex: (UNLIMITED)");
+
+    /* select data set 'UNLIMITED_SDS' based on its index in the file */
+    sdid = SDselect(f1, index);
+    CHECK(sdid, FAIL, "SDselect: (UNLIMITED)");
+
+    /* write 4?th record to data set */
+    start[0]=4;
+    start[1]=0;
+    end[0]=1;
+    end[1]=6;
+    status = SDwritedata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata: (SD_FILL)");
+
+    /* end access to data set 'UNLIMITED_SDS' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /* read back and check fill values */
+
+    /* open file 'test1.hdf' again */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart: (test1.hdf)");
+
+    /* get index of data set 'UNLIMITED_SDS' */
+    index = SDnametoindex(f1, "UNLIMITED_SDS");
+    CHECK(index, FAIL, "SDnametoindex: (UNLIMITED_SDS)");
+
+    /* select data set 'UNLIMITED_SDS' based on it's index in the file */
+    sdid = SDselect(f1, index);
+    CHECK(sdid, FAIL, "SDselect: (UNLIMITED_SDS)");
+
+    /* read data from data set 'UNLIMITED_SDS' */
+    start[0]=0;
+    start[1]=0;
+    end[0]=5;
+    end[1]=6;
+    status = SDreaddata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata(NO_FILL)");
+
+    /* verify the data */
+    for (i=12; i<18; i++)  
+      {
+        if ((idata[i] != (i-12)) || (idata[i+12] != (i-12))) 
+          {
+           fprintf(stderr, "line %d, wrong value for %d: should be %d, got %d\n",
+                           __LINE__, i-12, (int)idata[i], (int)idata[i+12]);
+           num_errs++;
+          }
+      }
+
+    for (i=18; i<24; i++)  
+      {
+        if (idata[i] !=fillval) 
+          {
+           fprintf(stderr, "line %d, wrong value: should be %d, got %d\n",
+                           __LINE__, (int)fillval, (int)idata[i]);
+           num_errs++;
+          }
+      }
+
+    /* end access to data set 'UNLIMITED_SDS' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+   /* 
+    * test SDsetdimval_incomp() 
+    */
+
+    /* open file 'test1.hdf' */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart (file1)");
+
+    /* set first dimension to be UNLIMITED.
+       Create data set 'dimval_1_compat' */
+    dimsize[0]=SD_UNLIMITED;
+    dimsize[1]=6;
+    sdid = SDcreate(f1, "dimval_1_compat", DFNT_INT32, 2, dimsize);
+    CHECK(sdid,FAIL,"SDcreate:Failed to create data set 'dimval_1_compat' in file 'test1.hdf'");
+
+    /* get handle for first dimension of data set 'dimval_1_compat' */
+    dimid=SDgetdimid(sdid, 0);
+    CHECK(dimid, FAIL, "SDgetdimid");
+
+    /* get handle for second dimension of data set 'dimval_1_compat' */
+    dimid1=SDgetdimid(sdid, 1);
+    CHECK(dimid1, FAIL, "SDgetdimid");
+
+    /* set second dimension as being backward compatible, default is
+       non-compatible  */
+    status = SDsetdimval_comp(dimid1, SD_DIMVAL_BW_COMP);
+    CHECK(status, FAIL, "SDsetdimval_comp");
+
+    for (i=0; i<6; i++)
+        scale[i]=i*5;
+
+    /* set the scale for the second dimension */
+    status = SDsetdimscale(dimid1, 6, DFNT_INT32, scale);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    for (i=0; i<24; i++)
+        idata[i] = i;
+
+    /* write data to data set 'dimval_1_compat' in file 'test1.hdf' */
+    start[0]=0;
+    start[1]=0;
+    end[0]=4;
+    end[1]=6;
+    status = SDwritedata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* end access to data set 'dimval_1_compat' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /* read back and change dimval compatibility  */
+
+    /* open file 'test1.hdf' again */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart: (again2)");
+
+    /* get index of data set 'dimval_1_compat' in file 'test1.hdf' */
+    index = SDnametoindex(f1, "dimval_1_compat");
+    CHECK(index,FAIL,"SDnametoindex: failed to get index for data set 'dimval_non_compat' in file 'test1.hdf'");
+
+    /* select data set 'dimval_1_compat' based on it's index in file */
+    sdid = SDselect(f1, index);
+    CHECK(sdid,FAIL,"SDselect:Failed to select data set 'dimval_1_compat' in file 'test1.hdf'");
+
+    /* info on data set 'dimval_1_compat' */
+    status = SDgetinfo(sdid, name, (int32 *)&rank, dimsize, &nt, (int32 *)&nattrs);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* verify correctness of information */
+    if (rank!=2 || dimsize[0]!=4 || dimsize[1]!=6 || nt!=DFNT_INT32) 
+      {
+        fprintf(stderr, "SDgetinfo returned wrong values\n");
+          num_errs++;
+      }
+
+    /* get handle for first dimension of data set 'dimval_1_compat' */
+    dimid=SDgetdimid(sdid,0);
+    CHECK(dimid, FAIL, "SDgetdimid");
+
+    /* get dimension info for first dimension */
+    status = SDdiminfo(dimid, name, (int32 *)&dimsize[0], &nt, (int32 *)&nattrs);
+    CHECK(status, FAIL, "SDdiminfo");
+
+    /* verify correctness of information */
+    if (dimsize[0]!=SD_UNLIMITED || nt!= 0 )  
+      {
+          fprintf(stderr, "SDdiminfo returned wrong values\n");
+          num_errs++;
+      }
+    /* is it backward non-compatible? */
+    status = SDisdimval_bwcomp(dimid);
+    if (status != SD_DIMVAL_BW_INCOMP)
+       { 
+           fprintf(stderr, "SDisdimvalcomp returned wrong value for dimension.\n");
+            num_errs++;
+       }
+    /* re-set first dimension as backward compatible */
+    status = SDsetdimval_comp(dimid, SD_DIMVAL_BW_COMP);
+    CHECK(status, FAIL, "SDsetdimval_comp");
+
+    /* get handle for second dimension of data set 'dimval_1_compat' */
+    dimid1=SDgetdimid(sdid,1);
+    CHECK(dimid1, FAIL, "SDgetdimid");
+
+    /* get dimension info for second dimension */
+    status = SDdiminfo(dimid1, name, (int32 *)&dimsize[1], &nt, (int32 *)&nattrs);
+    CHECK(status, FAIL, "SDdiminfo");
+
+    /* verify correctness of information */
+    if (dimsize[1]!=6 || nt!= DFNT_INT32 )  
+      {
+          fprintf(stderr, "Failed on SDgetinfo call\n");
+          num_errs++;
+      }
+
+    /* read data back from data set 'dimval_1_compat' */
+    status = SDreaddata(sdid, start, NULL, end, (VOIDP)idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* verify data */
+    for (i=0; i<24; i++)  
+      {
+        if (idata[i] != i) 
+          {
+           fprintf(stderr, "line %d, wrong value: should be %d, got %d\n",
+                           __LINE__, i, (int)idata[i]);
+           num_errs++;
+          }
+      }
+
+    /* see if second dimension is backward compatible. 
+       should be compatible */
+    status = SDisdimval_bwcomp(dimid1);
+    if (status != SD_DIMVAL_BW_COMP)  
+      {
+          fprintf(stderr, "SDisdimvalcomp returned wrong value for dimension\n");
+          num_errs++;
+      }
+
+    /* re-set second dimension as backward non-compatible */
+    status = SDsetdimval_comp(dimid1, SD_DIMVAL_BW_INCOMP);
+    CHECK(status, FAIL, "SDsetdimval_comp");
+
+    /* end access to data set 'dimval_1_compat' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /* open one last time to check that NDG ref has been constant */
+    /* check SDsetdimval_compat */
+
+    /* open file 'test1.hdf' again */
+    f1 = SDstart(FILE1, DFACC_RDWR);
+    CHECK(f1, FAIL, "SDstart (again3)");
+
+    /* get index of data set 'dimval_1_compat' in file 'test1.hdf' */
+    index = SDnametoindex(f1, "dimval_1_compat");
+    CHECK(index,FAIL,"SDnametoindex: failed to get index for data set 'dimval_1_compat' in file 'test1.hdf'");
+
+    /* select data set 'dimval_1_compat' based on it's index in file */
+    sdid = SDselect(f1, index);
+    CHECK(sdid,FAIL,"SDselect:Failed to select data set 'dimval_1_compat' in file 'test1.hdf'");
+
+    /* info on data set 'dimval_1_compat' */
+    status = SDgetinfo(sdid, name, (int32 *)&rank, dimsize, &nt, (int32 *)&nattrs);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* verify correctness of information */
+    if (rank!=2 || dimsize[0]!=4 || dimsize[1]!=6 || nt!=DFNT_INT32) 
+      {
+        fprintf(stderr, "SDgetinfo returned wrong values\n");
+          num_errs++;
+      }
+
+    /* get handle for second dimension of data set 'dimval_1_compat' */
+    dimid1=SDgetdimid(sdid,1);
+    CHECK(dimid1, FAIL, "SDgetdimid");
+
+    /* get dimension info for second dimension */
+    status = SDdiminfo(dimid1, name, (int32 *)&dimsize[1], &nt, (int32 *)&nattrs);
+    CHECK(status, FAIL, "SDdiminfo");
+
+    /* verify correctness of information */
+    if (dimsize[1]!=6 || nt!= DFNT_INT32 )  
+      {
+          fprintf(stderr, "Failed on SDgetinfo call\n");
+          num_errs++;
+      }
+
+    /* see if second dimensionis backward compatible. 
+       should be backward non-compatible */
+    status = SDisdimval_bwcomp(dimid1);
+    if (status != SD_DIMVAL_BW_INCOMP)  
+      {
+          fprintf(stderr, "SDisdimvalcomp returned wrong value\n");
+          num_errs++;
+      }
+    /* re-set second dimension as backward compatible */
+    status = SDsetdimval_comp(dimid1, SD_DIMVAL_BW_COMP);
+    CHECK(status, FAIL, "SDsetdimval_comp");
+    /* end access to data set 'dimval_1_compat' */
+    status = SDendaccess(sdid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /*
+     * used saved ref at the begining to retrieve the data set
+     */
+    
+    /* get the index of the data set to which this 'ref' belongs to */
+    index = SDreftoindex(f1, ndg_saved_ref);
+    CHECK(index,FAIL,"SDreftoindex: failed to get index for 'ndg_saved_ref'");
+
+    /* get handle for this data set (DataSetAlpha) */
+    sdsid = SDselect(f1, index);
+    CHECK(sdsid,FAIL,"SDselect: Failed to get handle for data set 'DataSetAlpha' ");
+
+    /* check if ref of this is the same as the one saved earlier */
+    if(ndg_saved_ref != SDidtoref(sdsid)) 
+      {
+        fprintf(stderr, "Saved NDG ref != to SDindextoref of same\n");
+        num_errs++;
+      }
+
+    /* end access to data set 'DataSetAlpha' in file 'test1.hdf' */    
+    status = SDendaccess(sdsid);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'test1.hdf' */
+    status = SDend(f1);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Test the External File storage stuff
+     */
+
+    /* Create file 'exttst.hdf' */
+    fext = SDstart(EXTTST, DFACC_CREATE);
+    CHECK(fext, FAIL, "SDstart");
+
+    /* Create data set 'ExteneralDataSet' in file 'exttst.hdf' */
+    nt = DFNT_INT32 | DFNT_NATIVE;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fext, "ExternalDataSet", nt, 2, dimsize);
+    CHECK(newsds, FAIL, "SDcreate: Failed to create a new data set 'ExternalDataSet' for external promotion");
+
+    /* initialize data to write out */
+    for(i = 0; i < 25; i++)
+        idata[i] = i;
+
+    /* Write data to all of data set 'ExternalDataSet' in file 'exttst.hdf' */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Now promote data set 'ExternalDataSet' to an external data set
+       in the file 'extfile.hdf' */
+    status = SDsetexternalfile(newsds, EXTFILE, 0);
+    CHECK(status, FAIL, "SDsetexternalfile");
+
+    for(i = 0; i < 10; i++)
+        idata[i] = i * 10;
+
+    /* Now write data to part of newly promoted data set 'ExternalDataSet'
+       which is now an external data set */
+    start[0] = start[1] = 0;
+    end[0]   = 2;
+    end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* end access to data set 'ExternalDataSet' */
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush external info to file 'exttst.hdf' */
+    status = SDend(fext);
+    CHECK(status, FAIL, "SDend");
+
+    /* Open file 'exttst.hdf' again */
+    fext = SDstart(EXTTST, DFACC_RDWR);
+    CHECK(fext, FAIL, "SDstart (again)");
+
+    /* Create a "wrapper" data set in file 'exttst.hdf'. i.e. a data set 
+       that will point to data in an already existing external file */
+    dimsize[0] = 3;
+    dimsize[1] = 3;
+    newsds2 = SDcreate(fext, "WrapperDataSet", nt, 2, dimsize);
+    CHECK(newsds2, FAIL, "SDcreate:Failed to create a new data set('WrapperDataSet') for external wrapping");
+
+    /* Promote the regular data set to a "wrapper" one by making
+       it point to where the real data is in the external file 'extfile.hdf'.
+       Note that only a subset of the real data('ExternalDataSet') is pointed to
+       by the "wrapper" data set. */
+    offset = DFKNTsize(nt) * 2;
+    status = SDsetexternalfile(newsds2, EXTFILE, offset);
+    CHECK(status, FAIL, "SDsetexternalfile");
+
+    /* now read data back from this "wrapper" data set */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 3;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* verify data read back in */
+    for(i = 0; i < 8; i++)
+      {
+        if(idata[i] != (i + 2) * 10) 
+          {
+            fprintf(stderr, "Bogus val in loc %d in wrapper dset want %d  got %ld\n", 
+        i, (i + 2) * 10, (long)idata[i]);
+            num_errs++;
+          }
+      }
+
+    if(idata[8] != 10) 
+      {
+        fprintf(stderr, "Bogus val in last loc in wrapper dset want 10  got %ld\n",
+    (long)idata[8]);
+        num_errs++;
+      }
+
+    /* End access to data set "WrapperDataSet" */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+ 
+    /* Create data set 'NoExteneralDataSet' in file 'exttst.hdf' */
+    nt = DFNT_INT32 | DFNT_NATIVE;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    noextsds = SDcreate(fext, "NoExternalDataSet", nt, 2, dimsize);
+    CHECK(noextsds, FAIL, "SDcreate: Failed to create a new data set 'NoExternalDataSet' for testing SDSgetexternalfile on a non-external element");
+
+    /* initialize data to write out */
+    for(i = 0; i < 25; i++)
+        idata[i] = i;
+
+    /* Write data to all of data set 'NoExternalDataSet' in file 'exttst.hdf' */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(noextsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    status = SDendaccess(noextsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close file 'exttst.hdf' */
+    status = SDend(fext);
+    CHECK(status, FAIL, "SDend");
+
+    /* Test getting external file info on data set "ExternalDataSet" and test
+       not able to get external file info on data set "NoExternalDataSet" */
+    {
+  intn name_len=0;
+  char *extfile_name;
+  int32 offset=0, length=0;
+  int32 sds_id, sds_index;
+
+  /* Open file 'exttst.hdf' again */
+  fext = SDstart(EXTTST, DFACC_RDWR);
+  CHECK(fext, FAIL, "SDstart (again)");
+
+  /* Get index of "ExternalDataSet" and get access to it */
+  sds_index = SDnametoindex(fext, "ExternalDataSet");
+  CHECK(sds_index, FAIL, "SDnametoindex");
+  sds_id = SDselect(fext, sds_index);
+  CHECK(sds_id, FAIL, "SDselect");
+
+  /* Call SDgetexternalfile the first time passing in 0 for external
+     file name length to get the actual length - SDgetexternalfile is
+     deprecated as of 4.2.7 */
+  name_len = SDgetexternalfile(sds_id, 0, NULL, NULL);
+  VERIFY(name_len, (intn)HDstrlen(EXTFILE), "SDgetexternalfile");
+
+  extfile_name = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+  CHECK_ALLOC(extfile_name, "extfile_name", "SDgetexternalfile");
+  HDmemset(extfile_name, '\0', name_len+1);
+
+  /* Call SDgetexternalfile again and get the external file info */
+  name_len = SDgetexternalfile(sds_id, name_len+1, extfile_name, &offset);
+  VERIFY(name_len, (intn)HDstrlen(EXTFILE), "SDgetexternalfile");
+  VERIFY_CHAR(EXTFILE, extfile_name, "SDgetexternalfile");
+
+  /* Call SDgetexternalinfo the first time passing in 0 for external
+     file name length to get the actual length */
+  name_len = SDgetexternalinfo(sds_id, 0, NULL, NULL, NULL);
+  VERIFY(name_len, (intn)HDstrlen(EXTFILE), "SDgetexternalinfo");
+
+  /* Test passing in NULL pointer for external file name buffer, should
+     fail gracefully */
+  {
+      char *null_buffer=NULL;
+      intn ret_code=0;
+      ret_code = SDgetexternalinfo(sds_id, name_len+1, null_buffer, &offset, &length);
+      VERIFY(ret_code, FAIL, "SDgetexternalinfo");
+  }
+
+  extfile_name = (char *) HDmalloc(sizeof(char *) * (name_len+1));
+  CHECK_ALLOC(extfile_name, "extfile_name", "SDgetexternalinfo");
+  HDmemset(extfile_name, '\0', name_len+1);
+
+  /* Call SDgetexternalinfo again and get the external file info */
+  name_len = SDgetexternalinfo(sds_id, name_len+1, extfile_name, &offset, &length);
+  VERIFY(name_len, (intn)HDstrlen(EXTFILE), "SDgetexternalinfo");
+  VERIFY_CHAR(EXTFILE, extfile_name, "SDgetexternalinfo");
+
+  /* Test passing in smaller buffer for external file name than actual;
+     name should be truncated */
+  {
+      char *short_name = (char *) HDmalloc(sizeof(char *) * (name_len));
+      HDmemset(short_name, '\0', name_len);
+      HDstrncpy(short_name, EXTFILE, name_len-2);
+      HDmemset(extfile_name, '\0', name_len);
+
+      /* Call SDgetexternalinfo again with smaller buffer size and verify
+         that SDgetexternalinfo reads the name truncated to the given
+         buffer size*/
+      name_len = SDgetexternalinfo(sds_id, name_len-2, extfile_name, &offset, &length);
+      VERIFY(name_len, (intn)HDstrlen(extfile_name), "SDgetexternalinfo");
+      VERIFY_CHAR(short_name, extfile_name, "SDgetexternalinfo");
+      HDfree(short_name);
+  }
+
+  status = SDendaccess(sds_id);
+  CHECK(status, FAIL, "SDendaccess");
+
+  /* Get index of "NoExternalDataSet" and get access to it */
+  sds_index = SDnametoindex(fext, "NoExternalDataSet");
+  CHECK(sds_index, FAIL, "SDnametoindex");
+  sds_id = SDselect(fext, sds_index);
+  CHECK(sds_id, FAIL, "SDselect");
+
+  /* Call SDgetexternalfile on the SDS that doesn't have external
+     element, should fail - SDgetexternalfile is deprecated as of
+     4.2.7 */
+  name_len = SDgetexternalfile(sds_id, 0, NULL, NULL);
+  VERIFY(name_len, FAIL, "SDgetexternalfile");
+
+  /* Call SDgetexternalinfo on the SDS that doesn't have external
+     element, should return 0 for length of external file name */
+  name_len = SDgetexternalinfo(sds_id, 0, NULL, NULL, NULL);
+  VERIFY(name_len, 0, "SDgetexternalinfo");
+
+  status = SDendaccess(sds_id);
+  CHECK(status, FAIL, "SDendaccess");
+
+  /* Close file 'exttst.hdf' */
+  status = SDend(fext);
+  CHECK(status, FAIL, "SDend");
+    }
+
+
+#ifdef NBIT_TEST
+
+    /*
+     * Test the N-Bit storage stuff
+     */
+
+    /* Create file 'nbit.hdf' */
+    fnbit = SDstart(NBITFILE, DFACC_CREATE);
+    CHECK(fnbit, FAIL, "SDstart");
+
+    /* Create data set 'NBitDataSet' in file 'nbit.hdf' */
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fnbit, "NBitDataSet", nt, 2, dimsize);
+    CHECK(newsds,FAIL,"SDcreate:Failed to create a new data set('NBitDataSet') for n-bit testing");
+
+    /* Initialize data to write out */
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+    /* Promote the data set 'NBitDataSet' to an NBIT data set */
+    status = SDsetnbitdataset(newsds,6,7,FALSE,FALSE);
+    CHECK(status, FAIL, "SDsetnbitdataset");
+
+    /* Write data to the NBIT data set 'NBitDataSet' */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* end access to NBIT data set 'NBitDataSet' */
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush n-bit info to file.
+       hmm... */
+    status = SDend(fnbit);
+    CHECK(status, FAIL, "SDend");
+
+    /* read the n-bit data back in */
+    fnbit = SDstart(NBITFILE, DFACC_RDWR);
+    CHECK(fnbit, FAIL, "SDstart (again)");
+
+    /* Select the NBIT data set back in, assume it is the first one */
+    newsds2 = SDselect(fnbit, 0);
+    CHECK(newsds2, FAIL,"SDselect:Failed to select a data set for n-bit access");
+
+    /* read data back in from the NBIT data set */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* verify the data */
+    for(i = 0; i < 25; i++)
+      {
+        if((idata[i]&0x7f) != rdata[i]) 
+          {
+            fprintf(stderr,"Bogus val in loc %d in n-bit dset want %ld got %ld\n",
+        i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+          }
+      }
+
+    /* end access to NBIT data set */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* close file 'nbit.hdf' */
+    status = SDend(fnbit);
+    CHECK(status, FAIL, "SDend");
+
+#endif /* NBIT_TEST */
+
+#ifdef COMP_TEST
+    /*
+     * Test the compressed storage routines
+     */
+    status = test_compression();
+    CHECK(status, FAIL, "test_compression");
+    num_errs = num_errs + status;
+
+#endif /* COMP_TEST */
+
+#ifdef CHUNK_TEST
+    status = test_chunk();
+    CHECK(status, FAIL, "test_chunk");
+    num_errs = num_errs + status;
+#endif /* CHUNK_TEST */
+
+#ifdef NETCDF_READ_TEST
+    status = test_netcdf_reading();
+    CHECK(status, FAIL, "test_netcdf_reading");
+    num_errs = num_errs + status;
+#endif /* NETCDF_READ_TEST */
+
+    /* BMR: Added a test routine dedicated for testing dimensions.  A
+       test on SDsetdimscale for an unsigned type was added while I was
+       fixing bug #172.  I didn't want to add this test into the already
+       very long main program so, instead, I added this routine, which can
+       be appended with other dimension tests in the future.  Also, some
+       day, the main program can be shortened and some of its dimension-related
+       tests can be moved into this test routine (in tdims.c) - 04/18/01 */
+    status = test_dimensions();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing SDcheckempty. 09/17/04 */
+    status = test_checkempty();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing attributes (currently
+  only SDsetattr with count=0, more will be moved here eventually
+  (in tattributes.c) - 05/31/11 */
+    status = test_attributes();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing SDgetdatasize (in 
+       tdatasizes.c) - 09/17/08 */
+    status = test_datasizes();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing SDgetdatainfo (in 
+       tdatainfo.c) - 03/20/10 */
+    status = test_datainfo();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing SDgetattdatainfo
+       and SDgetanndatainto (in tattdatainfo.c) - 1/7/10 */
+    status = test_att_ann_datainfo();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing SDidtype (in tidtypes.c)
+       -01/21/05.  Changed file name to tmixed_apis.c and added tests for
+       Vgetvgroups, VSgetvdatas, and Vgisinternal -2011 & 01/2012 */
+    status = test_mixed_apis();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing miscellaneous 
+       file-related APIs (in tfiles.c) - 10/12/05 */
+    status = test_files();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing the behavior of
+     * several functions when the SDS has rank=0. (in trank0.c) - 02/4/05 */
+    /* BMR: SDcreate fails on Copper when rank=0.  EP decided to remove
+     * this test until further study can be made on this feature.
+    status = test_rank0();
+    num_errs = num_errs + status; */
+
+    /* BMR: Added a test routine dedicated for testing functionality 
+       related to SDS' properties (in tsdsprops.c) - 09/12/06 */
+    status = test_SDSprops();
+    num_errs = num_errs + status;
+
+    /* BMR: Added a test routine dedicated for testing functionality 
+       related to coordinate variables (in tcoordvar.c) - 05/21/07 */
+    status = test_coordvar();
+    num_errs = num_errs + status;
+
+    /* BMR: Verifies that some functions will not fail even though SZIP 
+       library is not present or only decoder is available. */
+    status = test_szip_compression();  /* in tszip.c */
+    num_errs = num_errs + status;
+
+    /* BMR: This test fails on some systems when the user are logged in
+     * as root.  We decided to comment it out until further work can be
+     * attempted. (in tsd.c) 11/04/05 */
+    /* status = test_sd(); */
+    /* num_errs = num_errs + status; */
+
+    if (num_errs == 0)
+        printf("*** HDF-SD test passes ***\n");
+    else                                                          \
+        printf("*** HDF-SD test fails ***\n");
+
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/hdftest.h b/mfhdf/test/hdftest.h
new file mode 100644
index 0000000..5a7fc02
--- /dev/null
+++ b/mfhdf/test/hdftest.h
@@ -0,0 +1,51 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * The name of the test is printed by saying TESTING("something") which will
+ * result in the string `Testing something' being flushed to standard output.
+ * If a test passes, fails, or is skipped then the PASSED(), H4_FAILED(), or
+ * SKIPPED() macro should be called.  After H4_FAILED(), the caller
+ * should print additional information to stdout indented by at least four
+ * spaces.
+ */
+#define TESTING(WHAT)   {printf("Testing %-62s",WHAT); fflush(stdout);}
+#define PASSED()        {puts(" PASSED");fflush(stdout);}
+#define H4_FAILED()     {puts("*FAILED*");fflush(stdout);}
+#define H4_WARNING()    {puts("*WARNING*");fflush(stdout);}
+#define SKIPPED()       {puts(" -SKIP-");fflush(stdout);}
+
+/* Check status value and print error message */
+#define CHECK(status, fail_value, name) {if(status == fail_value) { \
+    fprintf(stderr, "*** Routine %s FAILED at line %d ***\n", name, __LINE__); num_errs++;}}
+
+/* Check status value and print error message, including index */
+#define CHECK_IND(status, fail_value, name, index) {if(status == fail_value) { \
+    fprintf(stderr, "*** Routine %s FAILED at line %d for SDS index %d ***\n", name, __LINE__, index); num_errs++;}}
+
+/* Verify that a value is as expected and, if not, print error message */
+#define VERIFY(item, value, test_name) {if(item != value) { \
+    fprintf(stderr, "*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", test_name, (long)item,(int)__LINE__,__FILE__); num_errs++;}}
+
+/* Verify that a value of type char* is as expected and, if not, print 
+   error message */
+#define VERIFY_CHAR(item, value, test_name) {if(HDstrcmp(item, value) != 0) { \
+    fprintf(stderr, "*** UNEXPECTED VALUE from %s is <%s> at line %4d in %s\n", test_name, item,(int)__LINE__,__FILE__); num_errs++;}}
+
+/* Used to validate that 'buffer' has been successfully allocated */
+#define CHECK_ALLOC(buffer, buf_name, func_name ) { \
+    if (buffer == NULL) {\
+        fprintf(stderr,"in %s: space allocation for %s failed.  Terminated!\n",\
+                func_name, buf_name ); \
+        exit(1); }  \
+}
diff --git a/mfhdf/test/sds_szipped.dat b/mfhdf/test/sds_szipped.dat
new file mode 100644
index 0000000..f6460cd
Binary files /dev/null and b/mfhdf/test/sds_szipped.dat differ
diff --git a/mfhdf/test/smallslice.0000.nc b/mfhdf/test/smallslice.0000.nc
new file mode 100644
index 0000000..13a4b9b
Binary files /dev/null and b/mfhdf/test/smallslice.0000.nc differ
diff --git a/mfhdf/test/tattdatainfo.c b/mfhdf/test/tattdatainfo.c
new file mode 100644
index 0000000..4200c47
--- /dev/null
+++ b/mfhdf/test/tattdatainfo.c
@@ -0,0 +1,1109 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tattdatainfo.c - tests the functions SDgetattdatainfo, SDgetoldattdatainfo,
+ *		    and SDgetanndatainfo.
+ * Structure of the file:
+ *    test_attdatainfo - test driver
+ *	test_attrs     - tests getting SDS attribute's data info
+ *	test_annots    - tests getting SDS annotation's data info
+ *	test_dfsdattrs - tests getting data info of old attributes added by
+ *			 DFSD API
+ * -BMR, Jul 2010
+****************************************************************************/
+
+#ifndef DATAINFO_TESTER
+#define DATAINFO_TESTER /* to include mfdatainfo.h */
+#endif
+
+#include "mfhdf.h"
+#include "hdftest.h"
+
+static intn test_attrs();
+static intn test_dfannots();
+static intn test_dfsdattrs();
+
+/* Reads character string data from HDF file without the use of HDF4 library */
+intn readnoHDF_char(const char *filename, const int32 offset, const int32 length, const char *orig_buf);
+
+#define ATTR_FILE     "attdatainfo.hdf"	/* data file */
+#define X_LENGTH      10
+#define Y_LENGTH      10
+#define RANK          2
+#define ISFIRST    (int)1
+#define NOTFIRST   (int)0
+
+/****************************************************************************
+   Name: test_attrs() - tests getting attribute's data info
+
+   Description:
+	This routine creates and writes data to non-special SDSs and verifies
+	data and data information with SDgetattdatainfo.  The tests include
+	the following SDSs:
+	- a 2-dim 5x8 element SDS, float32, with no data
+	- a 1-dim 10-element SDS, int32, with 10 values
+	- a 2-dim 5x8 element SDS, float32, with 5x8 values
+	- a 1-dim 20-element SDS, char, with 20 values
+	SDgetattdatainfo will retrieve the number of blocks in the data sets
+	and the offsets and lengths of the blocks.  Then the data will be read
+	back from the file at the previously retrieved offsets/lengths, without
+	the use of the HDF4 library, and will be verified against the original
+	data buffers.
+
+   BMR - Jul 2010
+ ****************************************************************************/
+#define SDS1_NAME	"First SDS"
+#define SDS2_NAME	"Second SDS"
+#define RANK1		1
+#define RANK2		2
+#define LENGTH1_X	10
+#define LENGTH2_X	5
+#define LENGTH2_Y	8
+#define LENGTH3_X	21
+#define FILE_ATTR_NAME "File_contents"
+#define SDS_ATTR_NAME1  "Valid_range 1"
+#define SDS_ATTR_NAME2  "Valid_range 2"
+#define DIM_ATTR_NAME  "Dim_metric"
+
+static intn test_attrs()
+{
+    int32 sd_id, sds_id, dim_id, dim_idx, att_idx;
+    int32 dimsizes[2], starts[2], edges[2], rank=0;
+    int32 data1[LENGTH1_X];
+    float data2[LENGTH2_X][LENGTH2_Y];
+    char  data3[LENGTH3_X], outdata3[LENGTH3_X];
+    char  sds_name[20];
+    uintn info_count = 0;
+    int32 n_values, nattrs;
+    int32 offset=0, length=0;
+   char8   file_values[] = "Storm_track_data";
+   float32 sds_values[2] = {2., 10.};
+   float32 sds_values_out[2];
+   char8   dim_values[]  = "Seconds";
+    intn  status;
+    int   ii, jj;
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(ATTR_FILE, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "test_attrs: SDstart");
+
+    /* Set an attribute that describes the file contents. */
+    n_values = 16;
+    status = SDsetattr (sd_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values,
+                       (VOIDP)file_values);
+    CHECK(status, FAIL, "SDsetattr")
+
+    /***************************************************************
+     Create and write non-special SDSs
+     ***************************************************************/
+
+    /* Create a 2x2 data set called "EmptyDataset" */
+    dimsizes[0] = LENGTH2_X;
+    dimsizes[1] = LENGTH2_Y;
+
+    /*
+     * Create a 1-dim 10-element SDS, type int32, then write 10 values
+     * to it
+     */
+    dimsizes[0] = LENGTH1_X;
+    sds_id = SDcreate (sd_id, SDS1_NAME, DFNT_INT32, RANK1, dimsizes);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    for (ii=0; ii < LENGTH1_X; ii++)
+	data1[ii] = 1000 * ii;
+
+    starts[0] = 0;
+    edges[0] = LENGTH1_X;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP)data1);
+    CHECK(status, FAIL, "SDwritedata");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Assign two attributes to the first SDS. */
+    n_values  = 2;
+    status = SDsetattr (sds_id, SDS_ATTR_NAME1, DFNT_FLOAT32, n_values,
+                       (VOIDP)sds_values);
+    CHECK(status, FAIL, "SDsetattr")
+    n_values = 7;
+    status = SDsetattr (sds_id, SDS_ATTR_NAME2, DFNT_CHAR8, n_values,
+                       (VOIDP)dim_values);
+    CHECK(status, FAIL, "SDsetattr")
+
+    /* 
+     * Create a 2-dim 5x8 element SDS, type float32, then write 5x8 values
+     * to it
+     */
+    dimsizes[0] = LENGTH2_X;
+    dimsizes[1] = LENGTH2_Y;
+    sds_id = SDcreate (sd_id, SDS2_NAME, DFNT_FLOAT32, RANK2, dimsizes);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    for (ii=0; ii < LENGTH2_X; ii++)
+	for (jj=0; jj < LENGTH2_Y; jj++)
+	    data2[ii][jj] = 500.50 * (ii+jj);
+
+    starts[0] = 0;
+    starts[1] = 0;
+    edges[0] = LENGTH2_X;
+    edges[1] = LENGTH2_Y;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP)data2);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Get the the second dimension identifier of the SDS. */
+    dim_idx = 1;
+    dim_id = SDgetdimid (sds_id, dim_idx);
+    CHECK(dim_id, FAIL, "SDgetdimid")
+
+    /* Set an attribute of the dimension that specifies the dimension metric. */
+    n_values = 7;
+    status = SDsetattr (dim_id, DIM_ATTR_NAME, DFNT_CHAR8, n_values,
+                       (VOIDP)dim_values);
+    CHECK(status, FAIL, "SDsetattr")
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /***********************************************************************
+     Read data info for later accessing data without the use of HDF4 library
+     ***********************************************************************/
+
+    /* Re-open the file */
+    sd_id = SDstart(ATTR_FILE, DFACC_RDWR);
+    CHECK(sd_id, FAIL, "test_attrs: SDstart");
+
+    /* Open the second data set, verify that number of data block is 1, then
+	retrieve and record the offset/length */
+    sds_id = SDselect(sd_id, 0);
+    CHECK(sds_id, FAIL, "test_attrs: SDselect SDS index 1");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, sds_name, NULL, NULL, NULL, &nattrs);
+    CHECK(status, FAIL, "test_attrs: SDgetinfo SDS index 0");
+    VERIFY(nattrs, 2, "test_attrs: SDgetinfo SDS index 0");
+
+    for (att_idx=0; att_idx < nattrs; att_idx++)
+    {
+	status = SDgetattdatainfo(sds_id, att_idx, &offset, &length);
+	CHECK(status, FAIL, "test_attrs: SDgetattdatainfo");
+    }
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /******************************************************************
+     Read data using previously obtained data info without HDF4 library
+     ******************************************************************/
+
+#if 0
+    /* Open file and read in data without using SD API */
+    {
+	int   fd;		/* for open */
+	int32 ret32;		/* for DFKconvert */
+	int   ret;		/* for fabs */
+        ssize_t readlen=0;	/* for read */
+        int32 *readibuf, *readibuf_swapped;
+        float *readfbuf, *readfbuf_swapped;
+        char *readcbuf, *readcbuf_swapped;
+	char readfbuf_str[12], data2_str[12]; /* for comparing readfbuf values */
+        uint32 n_values;
+	int ii, jj, kk;
+
+	/* Open the file for reading without SD API */
+	fd = open(ATTR_FILE, O_RDONLY);
+	if (fd == -1)
+	{
+	    fprintf(stderr, "test_attrs: unable to open file %s", ATTR_FILE);
+	    num_errs++;
+            return num_errs;
+	}
+
+	/* Forward to the position of the data of SDS at index 1 */
+        if (lseek(fd, (off_t)sds1_info.offsets[0], SEEK_SET) == -1)
+        {
+            fprintf(stderr, "test_attrs: unable to seek offset %d\n",
+                (int)sds1_info.offsets[0]);
+	    num_errs++;
+            return num_errs;
+        }
+
+	/* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds1_info.n_values * sizeof(int32));
+        readibuf_swapped = (int32 *) HDmalloc(sds1_info.n_values * sizeof(int32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP)readibuf, (size_t)sds1_info.lengths[0]);
+	CHECK(readlen, FAIL, "DFKconvert");
+
+	ret32 = DFKconvert(readibuf, readibuf_swapped, sds1_info.numtype,
+				 (uint32)sds1_info.n_values, DFACC_WRITE, 0, 0);
+	CHECK(ret32, FAIL, "DFKconvert");
+
+	if (ret32 > 0)
+	{
+            /* Compare data read without SD API against the original buffer */
+            for (ii = 0; ii < sds1_info.n_values; ii++)
+            {
+		if (readibuf_swapped[ii] != data1[ii])
+		    fprintf(stderr, "At value# %d: written = %d read = %d\n",
+					 ii, data1[ii], readibuf_swapped[ii]);
+            }
+	}
+
+	/* Forward to the position of the data of SDS at index 2 */
+        if (lseek(fd, (off_t)sds2_info.offsets[0], SEEK_SET) == -1)
+        {
+            fprintf(stderr, "test_attrs: unable to seek offset %d\n",
+                (int)sds2_info.offsets[0]);
+	    num_errs++;
+            return num_errs;
+        }
+
+	/* Allocate buffers for SDS' data */
+        readfbuf = (float32 *) HDmalloc(sds2_info.n_values * sizeof(float32));
+        readfbuf_swapped = (float32 *) HDmalloc(sds2_info.n_values * sizeof(float32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP)readfbuf, (size_t)sds2_info.lengths[0]);
+	CHECK(readlen, FAIL, "DFKconvert");
+
+	ret32 = DFKconvert(readfbuf, readfbuf_swapped, sds2_info.numtype,
+				 (uint32)sds2_info.n_values, DFACC_WRITE, 0, 0);
+	CHECK(ret32, FAIL, "DFKconvert");
+
+        /* Compare data read without SD API against the original buffer */
+	kk = 0;
+	for (jj = 0; jj < sds2_info.dimsizes[0]; jj++)
+            for (ii = 0; ii < sds2_info.dimsizes[1]; ii++)
+            {
+		/* Flag if the two numbers are not close enough */
+		if (fabs(readfbuf_swapped[kk] - data2[jj][ii]) > 0.00001)
+		    fprintf(stderr, "At value# %d: written = %f read = %f\n",
+				 ii, data2[jj][ii], readfbuf_swapped[kk]);
+		if (kk < sds2_info.n_values) kk++;
+            }
+
+	/* Forward to the position of the data of SDS at index 3 */
+        if (lseek(fd, (off_t)sds3_info.offsets[0], SEEK_SET) == -1)
+        {
+            fprintf(stderr, "test_attrs: unable to seek offset %d\n",
+                (int)sds3_info.offsets[0]);
+	    num_errs++;
+            return num_errs;
+        }
+
+	/* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds3_info.n_values * sizeof(int32));
+        readibuf_swapped = (int32 *) HDmalloc(sds3_info.n_values * sizeof(int32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP)readibuf, (size_t)sds3_info.lengths[0]);
+	CHECK(readlen, FAIL, "DFKconvert");
+
+	ret32 = DFKconvert(readibuf, readibuf_swapped, sds3_info.numtype,
+				 (uint32)sds3_info.n_values, DFACC_WRITE, 0, 0);
+	CHECK(ret32, FAIL, "DFKconvert");
+
+	if (ret32 > 0)
+	{
+            /* Compare data read without SD API against the original buffer */
+            for (ii = 0; ii < sds3_info.n_values; ii++)
+            {
+		if (readibuf_swapped[ii] != data3[ii])
+		    fprintf(stderr, "At value# %d: written = %d read = %d\n",
+					 ii, data3[ii], readibuf_swapped[ii]);
+            }
+	}
+
+	if (close(fd) == -1)
+	{
+	    fprintf(stderr, "test_attrs: unable to close file %s", ATTR_FILE);
+	    num_errs++;
+            return num_errs;
+	}
+    }
+    free_info(&sds1_info);
+    free_info(&sds2_info);
+    free_info(&sds3_info);
+#endif
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_attrs */
+
+
+/***************************************************************************
+   Test getting data info of annotations from DFAN
+   There are several utility functions to help generating and verifying the
+   data.  The actual test function is test_dfannots() that follows those.
+***************************************************************************/
+#define DFAN_NDG_FILE "tdfanndg.hdf"
+#define DFAN_SDG_FILE "tdfansdg.hdf" /* only for SDG annotation tests */
+#define MAXLEN_LAB     50
+#define MAXLEN_DESC   200
+#define ROWS           10
+#define COLS           10
+#define REPS           2
+
+/* Utility functions: */
+/* to generate data set's data */
+static VOID gen2Dfloat (int height, int width, float *data);
+/* to verify data of labels and descriptions */
+static intn check_lab_desc (char* fname, uint16 tag, uint16 ref, char *label, char *desc);
+
+/****************************************************************
+**
+**  gen2Dfloat:  generate 2-D data array
+**
+****************************************************************/
+static      VOID
+gen2Dfloat(int height, int width, float *data)
+{
+    int         i, j;
+    float      *pdata;
+
+    /* store one value per row, increasing by one for each row */
+    pdata = data;
+    for (i = 0; i < height; i++)
+        for (j = 0; j < width; j++)
+            *pdata++ = (float) (i + 1);
+
+}
+
+/****************************************************************
+**
+**  check_lab_desc:  read and compare label and description
+**                   with expected ones
+**
+****************************************************************/
+static      intn
+check_lab_desc(char* fname, uint16 tag, uint16 ref, char *label, char *desc)
+{
+    int32       inlablen, indesclen, ret;
+    char        inlabel[MAXLEN_LAB], *indesc;
+    intn num_errs=0;
+
+    inlablen = DFANgetlablen(fname, tag, ref);
+    CHECK(inlablen, FAIL, "check_lab_desc: DFANgetlablen");
+
+    ret = DFANgetlabel(fname, tag, ref, inlabel, MAXLEN_LAB);
+    CHECK(ret, FAIL, "check_lab_desc: DFANgetlabel");
+    VERIFY_CHAR(inlabel, label, "check_lab_desc: DFANgetlabel");
+
+    indesclen = DFANgetdesclen(fname, tag, ref);
+    CHECK(indesclen, FAIL, "check_lab_desc: DFANgetdesclen");
+    if (indesclen >= 0)
+    {
+        indesc = (char *) HDmalloc(indesclen + 1);
+        ret = DFANgetdesc(fname, tag, ref, indesc, MAXLEN_DESC);
+        CHECK(ret, FAIL, "check_lab_desc: DFANgetdesc");
+
+        indesc[indesclen] = '\0';
+        VERIFY_CHAR(indesc, desc, "check_lab_desc: DFANgetdesc");
+        HDfree((VOIDP) indesc);
+    }
+    return(num_errs);
+}
+
+/****************************************************************
+**
+**  add_sdfile_annotations: Adds file labels and descriptions with
+**	DFAN API, then reads them back and verifies that they are
+**      written correctly.  This function also creates the file.
+**
+****************************************************************/
+intn add_sdfile_annotations()
+{
+    int32  file_id;
+    char   labels[2][MAXLEN_LAB], descs[2][MAXLEN_DESC], tempstr[MAXLEN_DESC];
+    intn   ret;
+    intn num_errs=0;
+
+/* set up file labels and descriptions */
+
+    HDstrcpy(labels[0], "File Label #1");
+    HDstrcpy(labels[1], "File Label #2");
+    HDstrcpy(descs[0], "File Descr #1: This is a file label, added\n");
+    HDstrcat(descs[0], "       by the DFAN interface...**END SDS 1 DESCR**\n");
+    HDstrcpy(descs[1], "File Descr #2: This is another file label added\n");
+    HDstrcat(descs[1], "       by the DFAN API as well.**END SDS 2 DESCR**\n");
+
+/********  Write file labels and descriptions *********/
+
+    file_id = Hopen(DFAN_NDG_FILE, DFACC_CREATE, 0);
+    if (file_id == FAIL)
+        printf("\nUnable to open file %s for writing.\n\n", DFAN_NDG_FILE);
+
+    ret = DFANaddfid(file_id, labels[0]);
+    CHECK(ret, FAIL, "DFANaddfid");
+
+    ret = DFANaddfid(file_id, labels[1]);
+    CHECK(ret, FAIL, "DFANaddfid");
+
+    ret = DFANaddfds(file_id, descs[0], (int32)HDstrlen(descs[0]));
+    CHECK(ret, FAIL, "DFANaddfds");
+
+    ret = DFANaddfds(file_id, descs[1], (int32)HDstrlen(descs[1]));
+    CHECK(ret, FAIL, "DFANaddfds");
+
+    if (FAIL == Hclose(file_id))
+        printf("\nUnable to close file %s after writing.\n\n", DFAN_NDG_FILE);
+
+/********  Read file labels *********/
+
+    file_id = Hopen(DFAN_NDG_FILE, DFACC_READ, 0);
+    if (file_id == FAIL)
+        printf("\n\nUnable to open file %s for reading.\n\n", DFAN_NDG_FILE);
+
+    ret = DFANgetfidlen(file_id, ISFIRST);
+    CHECK(ret, FAIL, "DFANgetfidlen");
+    VERIFY(ret, strlen(labels[0]), "DFANgetfidlen first file label");
+
+    ret = DFANgetfid(file_id, tempstr, MAXLEN_LAB, ISFIRST);
+    CHECK(ret, FAIL, "DFANgetfid");
+    VERIFY_CHAR(labels[0], tempstr, "DFANgetfid first file label");
+
+    ret = DFANgetfidlen(file_id, NOTFIRST);
+    CHECK(ret, FAIL, "DFANgetfidlen");
+    VERIFY(ret, strlen(labels[1]), "DFANgetfidlen second file label");
+
+    ret = DFANgetfid(file_id, tempstr, MAXLEN_LAB, NOTFIRST);
+    CHECK(ret, FAIL, "DFANgetfid");
+    VERIFY_CHAR(labels[1], tempstr, "DFANgetfid second file label");
+
+/********  Read file descriptions *********/
+
+    ret = DFANgetfdslen(file_id, ISFIRST);
+    CHECK(ret, FAIL, "DFANgetfdslen");
+    VERIFY(ret, strlen(descs[0]), "DFANgetfdslen first file description");
+
+    ret = DFANgetfds(file_id, tempstr, MAXLEN_DESC, ISFIRST);
+    CHECK(ret, FAIL, "DFANgetfds");
+    VERIFY_CHAR(tempstr, descs[0], "DFANgetfds first file description");
+
+    ret = DFANgetfdslen(file_id, NOTFIRST);
+    CHECK(ret, FAIL, "DFANgetfdslen");
+    VERIFY(ret, strlen(descs[1]), "DFANgetfdslen second file description");
+
+    ret = DFANgetfds(file_id, tempstr, MAXLEN_DESC, NOTFIRST);
+    CHECK(ret, FAIL, "DFANgetfds");
+    VERIFY_CHAR(tempstr, descs[1], "DFANgetfds second file description");
+
+    if (FAIL == Hclose(file_id))
+        printf("\n\nUnable to close file %s after reading.\n\n", DFAN_NDG_FILE);
+
+    return (num_errs);
+} /* add_sdfile_annotations */
+
+
+/****************************************************************
+**
+**  add_sdsNDG_annotations: Adds data labels and descriptions with
+**	DFAN API, then reads them back and verifies that they are
+**	written correctly.  The data object in this function is 
+**	DFTAG_NDG.
+**
+****************************************************************/
+intn add_sdsNDG_annotations()
+{
+    char        labels[2][MAXLEN_LAB], descs[2][MAXLEN_DESC];
+    uint16      refnum;
+    int32       ret;
+    intn        rank;
+    int         jj;
+    int32       dimsizes[2];
+    float      *data;
+    intn num_errs=0;
+
+/* set up object labels and descriptions */
+
+    HDstrcpy(labels[0], "Object label #1: sds");
+    HDstrcpy(labels[1], "Object label #2: sds");
+    HDstrcpy(descs[0], "Object Descr #1: 1 2 3 4 5 6 7 8 9 10 11 12 \n");
+    HDstrcat(descs[0], "       13 14 15 16 17 18 19 20 **END SDS 1 DESCR**\n");
+    HDstrcpy(descs[1], "Object Descr #2: a b c d e f g h i j k l m n o p \n");
+    HDstrcat(descs[1], "       q r s t u v w x y z ??? **END SDS 2 DESCR**\n");
+
+/***** generate float array *****/
+
+    data = (float *) HDmalloc(ROWS * COLS * sizeof(float));
+    dimsizes[0] = ROWS;
+    dimsizes[1] = COLS;
+
+    /* Generate data for data sets */
+    gen2Dfloat(ROWS, COLS, data);
+
+    /* Set rank and dimension sizes for subsequent SDSs */
+    ret = DFSDsetdims(2, dimsizes);
+
+    /********  Write labels and descriptions *********/
+
+    /* Write REPS data sets and add a label and a description to each data set */
+    for (jj = 0; jj < REPS; jj++)
+    {
+        /* write out scientific data set */
+        ret = DFSDadddata(DFAN_NDG_FILE, 2, dimsizes, (VOIDP) data);
+        CHECK(ret, FAIL, "add_sdsNDG_annotations: DFSDadddata");
+        refnum = DFSDlastref();
+
+        /* Add label and description to this data set */
+        ret = DFANputlabel(DFAN_NDG_FILE, DFTAG_NDG, refnum, labels[jj]);
+        CHECK(ret, FAIL, "add_sdsNDG_annotations: DFANputlabel");
+
+        ret = DFANputdesc(DFAN_NDG_FILE, DFTAG_NDG, refnum,
+                              descs[jj], (int32)HDstrlen(descs[jj]));
+        CHECK(ret, FAIL, "add_sdsNDG_annotations: DFANputdesc");
+    }
+
+    /********  Read labels and descriptions *********/
+    for (jj = 0; jj < REPS; jj++)
+    {
+        ret = DFSDgetdims(DFAN_NDG_FILE, &rank, dimsizes, 3);
+        CHECK(ret, FAIL, "add_sdsNDG_annotations: DFSDgetdims");
+        refnum = DFSDlastref();
+
+        /* Verify data of labels and descriptions */
+        num_errs = check_lab_desc(DFAN_NDG_FILE, DFTAG_NDG, refnum, labels[jj], descs[jj]);
+    }
+    HDfree((VOIDP) data);
+
+    return (num_errs);
+} /* add_sdsNDG_annotations */
+
+/****************************************************************
+**
+**  add_sdsSDG_annotations: Adds data labels and descriptions with
+**	DFAN API, then reads them back and verifies that they are
+**	written correctly.  The data object in this function is 
+**	DFTAG_SDG.
+**
+****************************************************************/
+intn add_sdsSDG_annotations()
+{
+    char        labsds[MAXLEN_LAB], labris[MAXLEN_LAB], descsds[MAXLEN_DESC],
+                descris[MAXLEN_DESC];
+    uint8       pal[768];
+    uint16      refnum;
+    int32       ret;
+    intn        rank;
+    int         j;
+    int32       dimsizes[2];
+    float      *data;
+    intn num_errs=0;
+
+/* set up object labels and descriptions */
+
+    HDstrcpy(labsds, "sdsSDG label #1: sds");
+    HDstrcpy(descsds, "sdsSDG Descr #1: 1  2  3  4  5  6  7  8  9 10 11 12 \n");
+    HDstrcat(descsds, "             13 14 15 16 17 18 19 20 **END SDS DESCR**\n");
+    HDstrcpy(descris, "sdsSDG Descr #2: A B C D E F G H I J K L \n");
+    HDstrcat(descris, "                M N O **END IMAGE DESCR **\n");
+
+/***** generate float array and image *****/
+
+    data = (float *) HDmalloc(ROWS * COLS * sizeof(float));
+
+    dimsizes[0] = ROWS;
+    dimsizes[1] = COLS;
+
+    gen2Dfloat(ROWS, COLS, data);
+
+    ret = DFSDsetdims(2, dimsizes);
+
+/********  Write labels and descriptions *********/
+    for (j = 0; j < REPS; j++)
+      {
+
+          /* write out scientific data set */
+          ret = DFSDadddata(DFAN_SDG_FILE, 2, dimsizes, (VOIDP) data);
+
+            {   /* write out annotations for 2 out of every 3 */
+                refnum = DFSDlastref();
+                ret = DFANputlabel(DFAN_SDG_FILE, DFTAG_SDG, refnum, labsds);
+                ret = DFANputdesc(DFAN_SDG_FILE, DFTAG_SDG, refnum,
+                                  descsds, (int32)HDstrlen(descsds));
+            }
+      }
+
+/********  Read labels and descriptions *********/
+
+    for (j = 0; j < REPS; j++)
+      {
+          ret = DFSDgetdims(DFAN_SDG_FILE, &rank, dimsizes, 3);
+          refnum = DFSDlastref();
+
+          if ((j % 3) != 0)     /* read in annotations for 2 out of every 3 */
+              num_errs = check_lab_desc(DFAN_SDG_FILE, DFTAG_SDG, refnum, labsds, descsds);
+      }
+
+    HDfree((VOIDP) data);
+    return 0;
+}
+
+/****************************************************************
+**
+**  get_ann_datainfo: Gets data info of annotations and verifies
+**	against the provided offsets/lengths.
+**
+****************************************************************/
+intn get_ann_datainfo(
+		int32 id,
+		ann_type annot_type,
+		int32 *chk_offsets,
+		int32 *chk_lengths)
+{
+    int32 *offsetarray=NULL, *lengtharray=NULL;
+    int32 num_annots;
+    intn  ii, num_errs = 0;
+
+    num_annots = SDgetanndatainfo(id, annot_type, 0, NULL, NULL);
+    CHECK(num_annots, FAIL, "get_ann_datainfo: SDgetanndatainfo annot_type with NULL buffers");
+
+    if (num_annots > 0)
+    {
+	offsetarray = (int32 *)HDmalloc(num_annots * sizeof(int32));
+	if (offsetarray == NULL) exit(-1);
+	lengtharray = (int32 *)HDmalloc(num_annots * sizeof(int32));
+	if (lengtharray == NULL) exit(-1);
+
+	num_annots = SDgetanndatainfo(id, annot_type, num_annots,
+			offsetarray, lengtharray);
+        CHECK(num_annots, FAIL, "get_ann_datainfo: SDgetanndatainfo");
+
+	/* Verify offsets and lengths of annotations */
+	for (ii = 0; ii < num_annots; ii++)
+	{
+	    VERIFY(offsetarray[ii], chk_offsets[ii], "get_ann_datainfo: SDgetanndatainfo");
+	    VERIFY(lengtharray[ii], chk_lengths[ii], "get_ann_datainfo: SDgetanndatainfo");
+	}
+
+	HDfree(offsetarray);
+	HDfree(lengtharray);
+    }
+    return(num_errs);
+}
+
+/***************************************************************************
+   Name: test_dfannots() - tests getting data info of annotations from DFAN
+
+   Description:
+	This routine uses several utility routines to
+	- create various file's and data's annotations
+	- retrieve and verify the offsets/lengths of these annotations
+   BMR - Feb 2011
+***************************************************************************/
+static int test_dfannots(void)
+{
+    int32 sd_id, sds_id, sds_index;
+    intn  ii, status, num_annots;
+    int32 n_datasets, n_file_attr, n_attrs; 
+    int32 *offsetarray=NULL, *lengtharray=NULL;
+    int32 chk_offsets[10], chk_lengths[10];
+    int32 num_labels = 0,      /* number of file or object labels */
+          num_descs = 0;       /* number of file or object descriptions */
+    intn  num_errs = 0;
+
+    /* Add file annotations */
+    status = add_sdfile_annotations();
+    if (status > 0)
+        fprintf(stderr, "test_dfannots: errors while adding file annotations\n");
+
+    /* Add SDS annotations via NDG */
+    status = add_sdsNDG_annotations();
+    if (status > 0)
+        fprintf(stderr, "test_dfannots: errors while adding NDG annotations\n");
+
+    /* Add SDS annotations via SDG in a separate file */
+    status = add_sdsSDG_annotations();
+    if (status > 0)
+        fprintf(stderr, "test_dfannots: errors while adding SDG annotations\n");
+
+    /**********************************************************************
+     * Using SD API to get offset/length of data from file annotations    *
+     * and data set annotations in file DFAN_NDG_FILE to test NDG annots  *
+     **********************************************************************/
+
+    /* Open the file and initialize the SD interface. */
+    sd_id = SDstart(DFAN_NDG_FILE, DFACC_READ);
+    CHECK(sd_id, FAIL, "test_dfannots: SDstart");
+
+    /* BMR: need better checking algorithm here! */
+
+    /* Get data info of file labels and verify them against chk_offsets and
+	chk_lengths */
+    chk_offsets[0] = 307; chk_offsets[1] = 294; /* verified with UNIX command */
+    chk_lengths[0] = 13; chk_lengths[1] = 13;   /* "od --format=a" */
+    status = get_ann_datainfo(sd_id, AN_FILE_LABEL, chk_offsets, chk_lengths);
+    if (status > 0)
+        fprintf(stderr, "test_dfannots: errors while verifying annotations\n");
+
+    /* Get data info of file descs and verify them against chk_offsets and
+	chk_lengths */
+    chk_offsets[0] = 414; chk_offsets[1] = 320; /* verified with UNIX command */
+    chk_lengths[0] = 99; chk_lengths[1] = 94;   /* "od --format=a" */
+    status = get_ann_datainfo(sd_id, AN_FILE_DESC, chk_offsets, chk_lengths);
+    if (status > 0)
+        fprintf(stderr, "test_dfannots: errors while verifying annotations\n");
+
+    /* Obtain information about the file. */ 
+    status = SDfileinfo(sd_id, &n_datasets, &n_file_attr);
+    CHECK(status, FAIL, "test_dfannots: SDfileinfo");
+
+    /* Get annotation information of each SDS in the file. */
+    for (sds_index=0; sds_index< n_datasets; sds_index++) 
+    {
+	sds_id = SDselect (sd_id, sds_index);
+        CHECK(sds_id, FAIL, "test_dfannots: SDselect");
+
+        /* Only data sets have annotations */
+        if (!SDiscoordvar(sds_id))
+        {
+            /* Get data info of object descs and verify them against
+               chk_offsets and chk_lengths */
+	    if (sds_index == 2) /* first data set, not dimension var */
+	    {
+                chk_offsets[0] = 987; /* verified with UNIX */
+		chk_lengths[0] = 96; /* command "od --format=a" */
+	    }
+	    else if (sds_index == 5) /* second data set, not dimension var */
+	    {
+                chk_offsets[0] = 1729; /* verified with UNIX */
+		chk_lengths[0] = 101; /* command "od --format=a" */
+	    }
+					
+            status = get_ann_datainfo(sds_id, AN_DATA_DESC, chk_offsets, chk_lengths);
+	    if (status > 0)
+	        fprintf(stderr, "test_dfannots: errors while verifying annotations\n");
+
+            /* Get data info of object labels and verify them against
+               chk_offsets and chk_lengths */
+	    if (sds_index == 2) /* first data set */
+	    {
+                chk_offsets[0] = 963; /* verified with UNIX */
+		chk_lengths[0] = 20; /* command "od --format=a" */
+	    }
+	    else if (sds_index == 5) /* second data set */
+	    {
+                chk_offsets[0] = 1705; /* verified with UNIX */
+		chk_lengths[0] = 20; /* command "od --format=a" */
+	    }
+            status = get_ann_datainfo(sds_id, AN_DATA_LABEL, chk_offsets, chk_lengths);
+	    if (status > 0)
+	        fprintf(stderr, "test_dfannots: errors while verifying annotations\n");
+        } /* SDS is not coordinate var */
+
+        /* Terminate access to the selected data set. */
+        status = SDendaccess(sds_id);
+        CHECK(status, FAIL, "test_dfannots: SDendaccess");
+    } /* for each data set */
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_dfannots: SDend");
+
+    /**********************************************************************
+     * Using SD API to get offset/length of data from file annotations    *
+     * and data set annotations in file DFAN_NDG_FILE to test NDG annots  *
+     * -Not doing now because there are no such data in NASA files and we *
+     * are running out of time.                                           *
+     **********************************************************************/
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}
+
+/***************************************************************************
+   Name: test_dfsdattrs() - tests getting data info of attributes from DFSD
+
+   Description:
+	This routine creates and writes a dataset and several attributes with
+	the DFSD API to test the API function SDgetoldattdatainfo.
+	In the DFSD API, an SDS attribute is stored using tag/ref approach,
+	unlike the newer attributes which were introduced in Apr, 1993 and are
+	stored in Vdatas.  The dimension attributes are stored following the
+	SDS attribute.  All attributes are separated by null characters.
+
+	In this test, SDgetoldattdatainfo will retrieve the offsets and lengths
+	of several attributes.  Then the data will be read back from the file
+	at the retrieved offsets/lengths, without the use of the HDF4 library,
+	and will be verified against the original data buffers.
+
+   BMR - Mar 2011
+***************************************************************************/
+#define OLDATTFILE "tdfsdatts.hdf"
+#define XX  6
+#define YY  6
+
+/* Compares a string against the original buffer, returns 0 if equals, or -1 */
+intn compare(const char *outstring, const char *instring);
+
+static intn test_dfsdattrs()
+{
+    int         i, j, ret;
+    intn        rank;
+    int32       dims[2], num_datasets;
+    float32     f32[XX][YY], tf32[XX][YY];
+    intn info_count=0;
+    int32 offset=0, length=0;
+    int32 fid=-1, sdsid=-1, dimid=-1;
+    intn status=0;
+    intn num_errs = 0; /* number of errors so far */
+    const char *datalabel = "Datalabel", *dataunit = "Dataunit", *datafmt = "Datafmt",
+               *coordsys = "coordsys";
+    char        in_datalabel[256], in_dataunit[256], in_datafmt[256], in_coordsys[256];
+
+    const char  *dimlabels[2], *dimunits[2], *dimfmts[2];
+    char        in_dimlabels[2][256], in_dimunits[2][256], in_dimfmts[2][256];
+    /*
+    float32  scplnf32[XX] = {(float32) 0.0, (float32) 100.0, (float32) 0.1,
+			(float32) 101.0, (float32) 0.2, (float32) 102.0};
+    float32  scrowf32[YY] = {(float32) 0.0, (float32) 10.0, (float32) 20.0,
+			(float32) 1.0, (float32) 11.0, (float32) 21.0};
+    uncomment these when the calls to DFSDsetdimscale are uncommented.
+    */ 
+
+    rank = 2;
+    dims[0] = XX;
+    dims[1] = YY;
+
+    dimlabels[0] = "";
+    dimunits[0] = "c_dim1_unit";
+    dimfmts[0] = "c_dim1_fmt";
+
+    dimlabels[1] = "c_dim2_label";
+    dimunits[1] = "c_dim2_unit";
+    dimfmts[1] = "c_dim2_fmt";
+
+    for (i = 0; i < XX; i++)
+    {
+	for (j = 0; j < YY; j++)
+	{
+	    f32[i][j] = (float32)((i * XX) + j);   /* range: 0 ~ 4-billion */
+	}
+    }
+
+    ret = DFSDsetdims(rank, dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+    /* individual files */
+
+    ret = DFSDsetNT(DFNT_NFLOAT32);
+    CHECK(ret, FAIL, "DFSDsetNT");
+    ret = DFSDsetdims(rank, dims);
+    CHECK(ret, FAIL, "DFSDsetdims");
+
+    /* Set attributes to the dataset and its dimensions */
+    ret = DFSDsetdatastrs(datalabel, dataunit, datafmt, coordsys);
+    CHECK(ret, FAIL, "DFSDsetdatastrs");
+    ret = DFSDsetdimstrs(1, dimlabels[0], dimunits[0], dimfmts[0]);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+    ret = DFSDsetdimstrs(2, dimlabels[1], dimunits[1], dimfmts[1]);
+    CHECK(ret, FAIL, "DFSDsetdimstrs");
+
+    /* Note: Setting attribute to a dimension with DFSD API doesn't make the
+	dimension become a coordinate variable, only setting dimension scale
+	does.  Thus, when no setting scale is done, the dumper will not show
+	the dimension variables.  However, the dimension attributes are there
+	and SDgetoldattdatainfo will still find them.  For a demo, the two
+	calls to DFSDsetdimscale can be uncommented, then dumper will show
+	the dimension variables and their attributes. -BMR, Mar 13, 2011 */
+
+    /* Set dimension scales */
+    /*
+    ret = DFSDsetdimscale(1, dims[0], (VOIDP) scplnf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+
+    ret = DFSDsetdimscale(2, dims[1], (VOIDP) scrowf32);
+    CHECK(ret, FAIL, "DFSDsetdimscale");
+    */ 
+
+    /* Write/Read data to/from SDS */
+    ret = DFSDputdata(OLDATTFILE, rank, dims, (VOIDP) f32);
+    CHECK(ret, FAIL, "DFSDputdata");
+    ret = DFSDgetdata(OLDATTFILE, rank, dims, (VOIDP) tf32);
+    CHECK(ret, FAIL, "DFSDgetdata");
+
+    /* Read attributes from the dataset and its dimensions */
+    ret = DFSDgetdatastrs(in_datalabel, in_dataunit, in_datafmt, in_coordsys);
+    CHECK(ret, FAIL, "DFSDgetdatastrs");
+    ret = DFSDgetdimstrs(1, in_dimlabels[0], in_dimunits[0], in_dimfmts[0]);
+    CHECK(ret, FAIL, "DFSDgetdimstrs");
+    ret = DFSDgetdimstrs(2, in_dimlabels[1], in_dimunits[1], in_dimfmts[1]);
+    CHECK(ret, FAIL, "DFSDgetdimstrs");
+
+    /* Verify a few */
+    ret = compare(in_datalabel, datalabel);	/* SDS' label */
+    CHECK(ret, FAIL, "compare");
+    ret = compare(in_dimunits[0], dimunits[0]); /* first dim's units */
+    CHECK(ret, FAIL, "compare");
+    ret = compare(in_dimlabels[1], dimlabels[1]); /* first dim's label */
+    CHECK(ret, FAIL, "compare");
+
+    /* Using SD API to get the offsets and lengths of various attributes, then
+       read them from the file without the use of HDF4 library and verify them
+       against the original buffers */
+
+    /* Open the file with SD API */
+    fid = SDstart(OLDATTFILE, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Get the first dataset (and only one) */
+    sdsid = SDselect(fid, 0);
+    CHECK(sdsid, FAIL, "SDselect");
+
+    /* Test SDgetoldattdatainfo with dataset's attribute string _HDF_LongName */
+    info_count = SDgetoldattdatainfo(0, sdsid, _HDF_LongName, &offset, &length);
+    CHECK(info_count, FAIL, "SDgetoldattdatainfo");
+    status = readnoHDF_char(OLDATTFILE, offset, length, datalabel);
+    CHECK(status, FAIL, "readnoHDF_char");
+
+    /* Test with attribute string _HDF_LongName of dataset's first dimension */
+    dimid = SDgetdimid(sdsid, 0);
+    CHECK(dimid, FAIL, "SDgetdimid");
+    info_count = SDgetoldattdatainfo(dimid, sdsid, _HDF_LongName, &offset, &length);
+    CHECK(info_count, FAIL, "SDgetoldattdatainfo");
+    /* This dimension doesn't have an _HDF_LongName attribute, so length must be 0,
+	and readnoHDF_char will not be needed to verify the attribute values */
+    VERIFY(length, 0, "SDgetoldattdatainfo");
+
+    /* Test with attribute string _HDF_Format of dataset's second dimension */
+    dimid = SDgetdimid(sdsid, 1);
+    CHECK(dimid, FAIL, "SDgetdimid");
+    info_count = SDgetoldattdatainfo(dimid, sdsid, _HDF_Format, &offset, &length);
+    CHECK(info_count, FAIL, "SDgetoldattdatainfo");
+    status = readnoHDF_char(OLDATTFILE, offset, length, dimfmts[1]);
+    CHECK(status, FAIL, "readnoHDF_char");
+
+    /* Test with dataset's attribute string _HDF_CoordSys */
+    info_count = SDgetoldattdatainfo(0, sdsid, _HDF_CoordSys, &offset, &length);
+    CHECK(info_count, FAIL, "SDgetoldattdatainfo");
+    status = readnoHDF_char(OLDATTFILE, offset, length, coordsys);
+    CHECK(status, FAIL, "readnoHDF_char");
+    /* Note: coordsys' length has 1 more than the number of actual chars.  We'll
+       need to study that to document better. */
+
+    /* Terminate access to the dataset and close the file */
+    status = SDendaccess(sdsid);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    return(num_errs);
+}
+
+intn compare(const char *outstring, const char *instring)
+{
+    intn status = 0;
+    if (HDstrcmp(outstring, instring) != 0)
+    {
+        fprintf(stderr, ">>> Test failed for %s\n", outstring);
+        fprintf(stderr, "    Input string =  %s\n", instring);
+	status = -1;
+    }
+    return(status);
+}
+
+/*******************************************************************
+  Name: readnoHDF_char - utility routine to read and verify character
+			data without HDF4 library
+
+  Description:
+	readnoHDF_char opens the file and reads in data at the specified
+	offset.  The read data is compared against the original data passed
+	by caller.  If any mis-match occurs, an error message will be
+	displayed but the process will continue.
+
+  Parameters:
+	char *filename	IN: name of the file
+	int32 offset	IN: where to start read data
+	int32 length	IN: how long to read the data
+	char *orig_buf	IN: original data buffer to compare against
+
+  Return value:
+	SUCCEED/FAIL
+  BMR - Jul 2010
+********************************************************************/
+intn readnoHDF_char(const char *filename, const int32 offset, const int32 length, const char *orig_buf)
+{
+    FILE  *fd;		/* file descriptor */
+    size_t readlen=0;	/* number of bytes actually read */
+    char *readcbuf;
+    intn ret_value = SUCCEED;
+
+    /* Open the file for reading without SD API */
+    fd = fopen(filename, "r");
+    if (fd == NULL)
+    {
+	fprintf(stderr, "readnoHDF_char: unable to open file %s", filename);
+        exit(1);
+    }
+
+    /* Forward to the position of the first block of data */
+    if (fseek(fd, (off_t)offset, SEEK_SET) == -1)
+    {
+        fprintf(stderr, "readnoHDF_char: unable to seek offset %d\n",
+                (int)offset);
+        exit(1);
+    }
+
+    /* Allocate buffers for SDS' data */
+    readcbuf = (char *) HDmalloc(length * sizeof(char));
+    CHECK_ALLOC(readcbuf, "readcbuf", "readnoHDF_char" );
+
+    /* Read in this block of data */
+    readlen = fread((void*)readcbuf, 1, length, fd);
+    if (readlen > 0)
+    {
+        /* Compare data read without HDF4 lib against the original buffer */
+	if (HDstrncmp(readcbuf, orig_buf, readlen) != 0)
+	    fprintf(stderr, "Failure: non-HDF reading got different values than written values\n   >>> written = %s\n   >>> read = %s\n", orig_buf, readcbuf);
+    }
+    HDfree(readcbuf);
+
+    /* Close the file */
+    if (fclose(fd) == -1)
+    {
+	fprintf(stderr, "readnoHDF_char: unable to close file %s", filename);
+        exit(1);
+    }
+    return ret_value;
+}
+
+/* Test driver for testing the public functions SDgetattdatainfo(),
+   SDgetoldattdatainfo(), and SDgetanndatainfo() */
+extern int test_att_ann_datainfo()
+{
+    intn status;
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("getting location info of attr and annot data (tattdatainfo.c)");
+
+    /* Test getting data info of attributes for SDSs */
+    num_errs = num_errs + test_attrs();
+
+    /* Test getting data info of annotations added by DFAN API */
+    num_errs = num_errs + test_dfannots();
+
+    /* Test getting data info of annotations added by AN API */
+     /* num_errs = num_errs + test_mfannots(); not needed right now
+ */ 
+
+    /* Test getting data info of old attributes added by DFSD API */
+    num_errs += test_dfsdattrs();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
diff --git a/mfhdf/test/tattributes.c b/mfhdf/test/tattributes.c
new file mode 100644
index 0000000..e228263
--- /dev/null
+++ b/mfhdf/test/tattributes.c
@@ -0,0 +1,292 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tattributes.c - tests attribute features
+ *	(currently only SDsetattr with count = 0)
+ * Structure of the file:
+ *    test_attributes - test driver
+ *	  test_count - tests that SDsetattr fails when the parameter
+ *		"count" is set to 0.  (HDFFD-989 and 227: SDsetattr didn't
+ *		fail but, eventually, SDend did)
+ *
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+/********************************************************************
+   Name: test_count() - tests that SDsetattr fails when the parameter
+			"count" is passed into SDsetattr as 0 and the
+			requested attribute is not created.
+
+   Description:
+	In the past, when the parameter "count" was set to 0, SDsetattr
+	didn't fail but, eventually, SDend failed when the vdata storing
+	the attribute was being created.  With the knowledge that existing
+	applications would have failed eventually at SDend if such calls
+	existed, and if SDend failure is not detected, the file will be
+	corrupted, we decided to change so that SDsetattr now fails when
+	"count" is 0.
+
+        The main contents of the test are listed below.
+
+
+
+
+	- create a one-dim SDS, named VAR1_NAME
+	- name its dimension VAR1_NAME
+	- get file information and verify that there is only 1 variable, 
+	  dataset VAR1_NAME
+	- set attribute to dimension "Variable 1" (SDsetattr)
+	- set attribute to SDS "Variable 1" (SDsetattr)
+	- get file information and verify that there are 2 variable, 
+	  dataset VAR1_NAME and coordinate variable VAR1_NAME
+	- write data to the SDS
+	- close all and reopen the file
+	- open dataset "Variable 1" (SDnametoindex)
+	- verify that this variable is not a coordinate variable (SDiscoordvar)
+	- read and verify its attribute information and values
+	- get access to the dataset's first dimension
+	- read and verify its attribute information and values
+	- read data and verify that the data is not corrupted
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - May 18, 2007
+*********************************************************************/
+
+#define FILE_SATTR	"tattributes.hdf"
+#define VAR1_NAME	"Variable 1"
+#define DIM1_NAME	"Dimension 1"
+#define ATTR1_NAME	"Attribute Dimension 1"
+#define ATTR2_NAME	"Attribute SDS 1"
+#define ATTR3_NAME	"Attribute Zero"
+#define ATTR1_VAL       "This is a good attr"
+#define ATTR2_VAL       "This is a another attr"
+#define ATTR1_LEN	20
+#define ATTR2_LEN	23
+#define ATTR3_LEN	5
+#define ATTR_ZERO	"ZERO"
+#define ATTR_LEN_ZERO	0
+
+static intn test_count(void)
+{
+    char  sds_name[20], dim_name[20];
+    float32 sds1_data[] = {0.1, 2.3, 4.5, 6.7, 8.9};
+    float32 out_data[5];
+    int32 dimsize[1], size;
+    int32 sds_id, file_id, dim_id, index;
+    int32 start=0, stride=1;
+    int32 attr_data [5] = {101,102,103,104,105}, scale1_out[5];
+    int32 ntype, rank, count;
+    int32 n_datasets=0, n_file_attrs=0, nattrs=0;
+    intn  status =0;
+    hdf_varlist_t* var_list;
+    intn  is_coord = FALSE;
+    char  attr_name[H4_MAX_NC_NAME], attr_values[80];
+    intn  num_errs = 0;         /* number of errors so far */
+
+    file_id = SDstart(FILE_SATTR, DFACC_CREATE);
+    CHECK(file_id, FAIL, "SDstart");
+
+    /* Create a one-dim dataset named VAR1_NAME, of type DFNT_FLOAT32. */
+    dimsize[0] = 5;
+    sds_id = SDcreate(file_id, VAR1_NAME, DFNT_FLOAT32, 1, dimsize);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Set the dimension name. */
+    dim_id = SDgetdimid(sds_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+    status = SDsetdimname(dim_id, DIM1_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Attempt to set a string attr to dim passing in count=0, should fail. */
+    status = SDsetattr(dim_id, ATTR_ZERO, DFNT_CHAR8, ATTR_LEN_ZERO, ATTR1_VAL);
+    VERIFY(status, FAIL, "SDsetattr");
+
+    /* To verify that this attribute is not created, SDend must be called and
+       the file is opened again. */
+
+    /* Close dataset and file. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Open the file again to check attributes */
+    file_id = SDstart(FILE_SATTR, DFACC_RDWR);
+    CHECK(file_id, FAIL, "SDstart");
+
+    /* Get index of dataset VAR1_NAME */
+    index = SDnametoindex(file_id, VAR1_NAME);
+    CHECK(index, FAIL, "SDnametoindex");
+
+    sds_id = SDselect(file_id, index);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /* Get access to the SDS' first dimension. */
+    dim_id = SDgetdimid(sds_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+
+    /* Get dimension information to verify there are no attrs set */
+    status = SDdiminfo (dim_id, dim_name, &size, &ntype, &nattrs );
+    VERIFY(nattrs, 0, "SDdiminfo");
+
+    /* Set an attribute to dimension DIM1_NAME. */
+    status = SDsetattr(dim_id, ATTR1_NAME, DFNT_CHAR8, ATTR1_LEN, ATTR1_VAL);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Attempt to set a string attr to SDS passing in count=0, should fail. */
+    status = SDsetattr(sds_id, ATTR_ZERO, DFNT_CHAR8, ATTR_LEN_ZERO, ATTR2_VAL);
+    VERIFY(status, FAIL, "SDsetattr");
+
+    /* Attempt to set a float attr to SDS passing in count=0, should fail. */
+    status = SDsetattr(sds_id, ATTR_ZERO, DFNT_FLOAT32, ATTR_LEN_ZERO, ATTR2_VAL);
+    VERIFY(status, FAIL, "SDsetattr");
+
+    /* Close the file and reopen it to verify the number of attributes for SDS
+       and for the dimension. */
+
+    /* Close dataset and file. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Open the file again to check attributes */
+    file_id = SDstart(FILE_SATTR, DFACC_RDWR);
+    CHECK(file_id, FAIL, "SDstart");
+
+    /* Get index of dataset VAR1_NAME */
+    index = SDnametoindex(file_id, VAR1_NAME);
+    CHECK(index, FAIL, "SDnametoindex");
+
+    sds_id = SDselect(file_id, index);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /* Get access to the SDS' first dimension. */
+    dim_id = SDgetdimid(sds_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+
+    /* Get dimension information to verify there is one attribute set */
+    status = SDdiminfo (dim_id, dim_name, &size, &ntype, &nattrs );
+    VERIFY(nattrs, 1, "SDdiminfo");
+
+    /* Get SDS info to verify there is no SDS attribute yet. */
+    status = SDgetinfo(sds_id, sds_name, &rank, dimsize, &ntype, &nattrs);
+    VERIFY(nattrs, 0, "SDsetattr");
+
+    /* Set an attribute to dataset VAR1_NAME. */
+    status = SDsetattr(sds_id, ATTR2_NAME, DFNT_CHAR8, ATTR2_LEN, ATTR2_VAL);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Write data to the SDS */
+    status = SDwritedata(sds_id, &start, &stride, dimsize, (VOIDP)sds1_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Close dataset and file. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Open the file again to check attributes */
+    file_id = SDstart(FILE_SATTR, DFACC_RDWR);
+    CHECK(file_id, FAIL, "SDstart");
+
+    /* Get index of dataset VAR1_NAME */
+    index = SDnametoindex(file_id, VAR1_NAME);
+    CHECK(index, FAIL, "SDnametoindex");
+
+    sds_id = SDselect(file_id, index);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /* Get dataset information to verify that there is one attribute set. */
+    status = SDgetinfo(sds_id, sds_name, &rank, dimsize, &ntype, &nattrs);
+    VERIFY(nattrs, 1, "SDsetattr");
+
+    /* Read and verify the information of the SDS' first attribute. */
+    status = SDattrinfo(sds_id, 0, attr_name, &ntype, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+    VERIFY(count, ATTR2_LEN, "SDattrinfo");
+    VERIFY(HDstrncmp(attr_name, ATTR2_NAME, 14), 0, "SDattrinfo");
+
+    /* Read and verify the values of the SDS' first attribute. */
+    status = SDreadattr(sds_id, 0, attr_values);
+    CHECK(status, FAIL, "SDreadattr");
+
+    if (HDstrncmp(attr_values, ATTR2_VAL, ATTR2_LEN) != 0)
+    {
+	fprintf(stderr, "Unmatched attribute values for SDS %s: is <%s>, should be <%s>\n", VAR1_NAME, attr_values, ATTR2_VAL);
+	num_errs++;
+    }
+
+    /* Get access to the SDS' first dimension. */
+    dim_id = SDgetdimid(sds_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+
+    /* Get dimension information to verify number of attrs */
+    status = SDdiminfo (dim_id, dim_name, &size, &ntype, &nattrs );
+    VERIFY(nattrs, 1, "SDattrinfo");
+
+    /* Read and verify the information of the dimension's first attribute. */
+    status = SDattrinfo(dim_id, 0, attr_name, &ntype, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+    VERIFY(count, ATTR1_LEN, "SDattrinfo");
+    VERIFY(HDstrncmp(attr_name, ATTR1_NAME, ATTR1_LEN), 0, "SDattrinfo");
+
+    /* Read and verify the values of the dimension's first attribute. */
+    status = SDreadattr(dim_id, 0, attr_values);
+    CHECK(status, FAIL, "SDreadattr");
+
+    if (HDstrncmp(attr_values, ATTR1_VAL, ATTR1_LEN) != 0)
+    {
+	fprintf(stderr, "Unmatched attribute values for dimension %s: is <%s>, should be <%s>\n", VAR1_NAME, attr_values, ATTR1_VAL);
+	num_errs++;
+    }
+
+    /* Close dataset and file. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_count */
+
+
+/* Test driver for testing SD attributes. */
+extern int
+test_attributes()
+{
+    intn num_errs = 0;         /* number of errors */
+
+    /* Output message about test being performed */
+    TESTING("various setting attribute features (tattributes.c)");
+
+    /* test when count is passed into SDsetattr as 0 */
+    num_errs = num_errs + test_count();
+
+    if (num_errs == 0)
+        PASSED();
+
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/tchunk.c b/mfhdf/test/tchunk.c
new file mode 100644
index 0000000..29dba52
--- /dev/null
+++ b/mfhdf/test/tchunk.c
@@ -0,0 +1,1661 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define CHKFILE   "chktst.hdf"    /* Chunking test file */
+#define CNBITFILE "chknbit.hdf"   /* Chunking w/ NBIT compression */
+
+/* Dimensions of slab */
+static int32  edge_dims[3]  = {2, 3, 4};  /* size of slab dims */
+static int32  start_dims[3] = {0, 0, 0};  /* starting dims  */
+static int32  d_dims[3]     = {2, 3, 4};
+static int32  cdims[3]      = {1, 2, 3};  /* chunk lengths */
+
+/* Chunk teseting - arrays for chunk writes */
+/* float32 arrays */
+#ifdef NOT_USED
+static float32  chunk1_f32[4] =
+        {(float32) 0.0, (float32) 1.0, (float32) 2.0, (float32) 3.0};
+
+static float32  chunk2_f32[4] =
+        {(float32) 10.0, (float32) 11.0, (float32) 12.0, (float32) 13.0};
+
+static float32  chunk3_f32[4] =
+        {(float32) 20.0, (float32) 21.0, (float32) 22.0, (float32) 23.0};
+
+static float32  chunk4_f32[4] =
+        {(float32) 100.0, (float32) 101.0, (float32) 102.0, (float32) 103.0};
+
+static float32  chunk5_f32[4] =
+        {(float32) 110.0, (float32) 111.0, (float32) 112.0, (float32) 113.0};
+
+static float32  chunk6_f32[4] =
+        {(float32) 120.0, (float32) 121.0, (float32) 122.0, (float32) 123.0};
+
+/* uint16 arrays */
+static uint16  chunk1_u16[4] =        { 0, 1, 2, 3};
+
+static uint16  chunk2_u16[4] =        { 10, 11, 12, 13};
+
+static uint16  chunk3_u16[4] =        { 20, 21, 22, 23};
+
+static uint16  chunk4_u16[4] =        { 100, 101, 102, 103};
+
+static uint16  chunk5_u16[4] =        { 110, 111, 112, 113};
+
+static uint16  chunk6_u16[4] =        { 120, 121, 122, 123};
+#endif /* NOT_USED */
+
+/* uint16 chunk arrays used in example 1 */
+static uint16  chunk1_2u16[6] = {11, 21, 
+                                 12, 22, 
+                                 13, 23};
+
+static uint16  chunk2_2u16[6] = {31, 41, 
+                                 32, 42, 
+                                 33, 43};
+
+static uint16  chunk3_2u16[6] = {14, 24, 
+                                 15, 25, 
+                                 16, 26};
+
+static uint16  chunk4_2u16[6] = {34, 44, 
+                                 35, 45, 
+                                 36, 46};
+
+static uint16  chunk5_2u16[6] = {17, 27, 
+                                 18, 28, 
+                                 19, 29};
+
+static uint16  chunk6_2u16[6] = {37, 47, 
+                                 38, 48, 
+                                 39, 49};
+
+/* for visual layout in Example 1*/
+static uint16  u16_2data[9][4] =
+{ 
+   {11, 21, 31, 41},
+   {12, 22, 32, 42},
+   {13, 23, 33, 43},
+   {14, 24, 34, 44},
+   {15, 25, 35, 45},
+   {16, 26, 36, 46},
+   {17, 27, 37, 47},
+   {18, 28, 38, 48},
+   {19, 29, 39, 49},
+};
+
+/* for comparison in example 1 */
+static uint16 u16_2cdata[5][2] =
+{
+  {23, 33},
+  {24, 34},
+  {25, 35},
+  {26, 36},
+  {27, 37}
+};
+
+/* uint8 arrays */
+static uint8  chunk1_u8[4] = { 0, 1, 2, 3};
+
+static uint8  chunk2_u8[4] = { 10, 11, 12, 13};
+
+static uint8  chunk3_u8[4] = { 20, 21, 22, 23};
+
+static uint8  chunk4_u8[4] = { 100, 101, 102, 103};
+
+static uint8  chunk5_u8[4] = { 110, 111, 112, 113};
+
+static uint8  chunk6_u8[4] = { 120, 121, 122, 123};
+
+/* data arrays layed out in memory  */
+/* for comparison */
+static float32  f32_data[2][3][4] =
+{
+    {
+        {(float32) 0.0, (float32) 1.0, (float32) 2.0, (float32) 3.0},
+        {(float32) 10.0, (float32) 11.0, (float32) 12.0, (float32) 13.0},
+        {(float32) 20.0, (float32) 21.0, (float32) 22.0, (float32) 23.0}},
+    {
+        {(float32) 100.0, (float32) 101.0, (float32) 102.0, (float32) 103.0},
+        {(float32) 110.0, (float32) 111.0, (float32) 112.0, (float32) 113.0},
+        {(float32) 120.0, (float32) 121.0, (float32) 122.0, (float32) 123.0}}};
+
+static uint16  u16_data[2][3][4] =
+{
+    {
+        { 0, 1, 2, 3},
+        { 10, 11, 12, 13},
+        { 20, 21, 22, 23}},
+    {
+        { 100, 101, 102, 103},
+        { 110, 111, 112, 113},
+        { 120, 121, 122, 123}}};
+
+static uint8  u8_data[2][3][4] =
+{
+    {
+        { 0, 1, 2, 3},
+        { 10, 11, 12, 13},
+        { 20, 21, 22, 23}},
+    {
+        { 100, 101, 102, 103},
+        { 110, 111, 112, 113},
+        { 120, 121, 122, 123}}};
+
+extern int
+test_chunk()
+{
+    int32 fchk; /* File handles */
+    int32 nt;                /* Number type */
+    int32 dimsize[10];       /* dimension sizes */
+    int32   newsds1, newsds2, newsds3, newsds4, newsds5, 
+	    newsds6, newsds7, newsds8;   /* Chunked SDS ids */
+    float32 inbuf_f32[2][3][4];  /* float32 Data array read from from file */
+    uint16  inbuf_u16[2][3][4];  /* uint16 Data array read from from file */
+    uint16  inbuf1_2u16[9][4];   /* Data array read for Example 1 */
+    uint16  inbuf_2u16[5][2];    /* Data array read for Example 1 */
+    uint8   inbuf_u8[2][3][4];   /* uint8 Data array read from from file */
+    uint8   ru8_data[4];         /* chunk input buffer */
+    int32   *rcdims;             /* for SDgetchunkinfo() */
+    uint16  fill_u16 = 0;        /* fill value */
+    HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+    HDF_CHUNK_DEF chunk_def_out; /* Chunk defintion set */ 
+    HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+    comp_coder_t comp_type;      /* to retrieve compression type into */
+    comp_info cinfo;             /* compression information structure */
+    int32   cflags;              /* chunk flags */
+    int32   c_flags;             /* chunk flags to set */
+    int32   c_flags_out;         /* chunk flags retrieved */
+    int32   index;       /* Index of dataset in file */
+    intn    status;      /* status flag */
+    intn    i,j,k;       /* loop variables */
+    int32   start[10], end[10]; /* start, end, stride arrays */
+    int32   idata[100];
+    int32   rdata[100];
+    float32 max;
+    int     num_errs = 0;    /* number of errors so far */
+
+    /* Output message about test being performed */
+    TESTING("create/read/write chunked datasets (tchunk.c)");
+
+    /* Create file 'chktst.hdf' */
+    fchk = SDstart(CHKFILE, DFACC_CREATE);
+    CHECK(fchk, FAIL, "SDstart");
+
+    /* 
+     * Test 1. Create a 9x4 SDS of uint16 in file 1 
+     *         With chunks of 3x2, will create 6 chunks.
+     */
+    d_dims[0] = 9;
+    d_dims[1] = 4;
+    newsds1 = SDcreate(fchk, "DataSetChunked_2D_1", DFNT_UINT16, 2, d_dims);
+    if(newsds1 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. Failed to create a new data set \n");
+        num_errs++;
+        goto test2;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds1, (VOIDP) &fill_u16);
+    CHECK(status, FAIL, "Chunk Test 1. SDsetfillvalue");
+
+    /* Added to verify that the problem reported in bug HDFFR-5 is gone.  The
+       fix was actually done for and documented in bug HDFFR-171.  It is
+       verified here that SDsetchunk works properly after SDgetchunkinfo
+       being called on an empty SDS prior to SDsetchunk. -BMR, 2011/10/25 */
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds1, NULL, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 1. SDgetchunkinfo on empty SDS");
+    VERIFY(c_flags_out, (HDF_NONE), "Chunk Test 1. SDgetchunkinfo on empty SDS");
+
+    /* Create chunked SDS 
+       chunk is 3x2 which will create 6 chunks */
+    cdims[0] = chunk_def.chunk_lengths[0] = 3;
+    cdims[1] = chunk_def.chunk_lengths[1] = 2;
+    status = SDsetchunk(newsds1, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. Failed to create new chunked data set\n");
+        num_errs++;
+        goto test2;
+      }
+
+    /* Check getting chunked/compressed flag only with SDgetchunkinfo */
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds1, NULL, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 1. SDgetchunkinfo");
+    VERIFY(c_flags_out, (HDF_CHUNK), "Chunk Test 1. SDgetchunkinfo");
+
+    /* Check getting compression info with SDgetchunkinfo */
+    HDmemset(&chunk_def_out, 0, sizeof(HDF_CHUNK_DEF));
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds1, &chunk_def_out, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 1. SDgetchunkinfo");
+    VERIFY(chunk_def_out.chunk_lengths[0], chunk_def.chunk_lengths[0], "SDgetchunkinfo");
+    VERIFY(chunk_def_out.chunk_lengths[1], chunk_def.chunk_lengths[1], "SDgetchunkinfo");
+
+    /* Set Chunk cache to hold 2 chunks */
+    status = SDsetchunkcache(newsds1, 2, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. SDsetchunkcache failed\n");
+        num_errs++;
+        goto test2;
+      }
+
+
+    /* Write data */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    edge_dims[0] = 9;
+    edge_dims[1] = 4;
+    status = SDwritedata(newsds1, start_dims, NULL, edge_dims, (VOIDP) u16_2data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. Failed to write u16_2data to new chunked data set\n");
+        num_errs++;
+        goto test2;
+      }
+
+    /* read a portion of data back in using SDreaddata*/
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    edge_dims[0] = 9;
+    edge_dims[1] = 4;
+    status = SDreaddata(newsds1, start_dims, NULL, edge_dims, (VOIDP) inbuf1_2u16);
+    CHECK(status, FAIL, "Chunk Test 1. SDreaddata");
+    for (i = 0; i < 9; i++)
+      {
+        for (j = 0; j < 4; j++)
+          {
+              if (inbuf1_2u16[i][j] != u16_2data[i][j])
+                {
+                    fprintf(stderr,"Chunk Test 1. inbuf1_2u16[%d][%d]=%d,",
+                            i,j,inbuf1_2u16[i][j]);
+                    fprintf(stderr,"u16_cdata[%d][%d]=%d,",
+                            i,j,u16_2data[i][j]);
+                    fprintf(stderr,"\n");
+                    num_errs++;
+                }
+          }
+      }
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds1, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 1. SDgetchunkinfo failed \n");
+        num_errs++;
+        goto test2;
+      }
+
+    rcdims = rchunk_def.chunk_lengths;
+
+    /* check chunk lengths and to see if SDS is chunked */
+    if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+      {
+        fprintf(stderr, "Chunk Test 1. SDgetchunkinfo returned wrong values\n");
+        num_errs++;
+        goto test2;
+      }
+
+    /* Close down this SDS*/    
+    status = SDendaccess(newsds1);
+    CHECK(status, FAIL, "Chunk Test 1. SDendaccess");
+
+    /* 
+      Test 2. 2-D 9x4 SDS of uint16 with 3x2 chunks
+                 Write data using SDwritechunk().
+                 Read data using SDreaddata().
+    */
+  test2:
+
+    /* create a  9x4 SDS of uint16 in file 1 */
+    d_dims[0] = 9;
+    d_dims[1] = 4;
+    newsds2 = SDcreate(fchk, "DataSetChunked_2D_2", DFNT_UINT16, 2, d_dims);
+    if(newsds2 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2. Failed to create a new data set \n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds2, (VOIDP) &fill_u16);
+    CHECK(status, FAIL, "Chunk Test 2. SDsetfillvalue");
+
+    /* Create chunked SDS 
+       chunk is 3x2 which will create 6 chunks */
+    cdims[0] = chunk_def.chunk_lengths[0] = 3;
+    cdims[1] = chunk_def.chunk_lengths[1] = 2;
+    status = SDsetchunk(newsds2, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2. Failed to create new chunked data set\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Set Chunk cache to hold 2 chunks */
+    status = SDsetchunkcache(newsds2, 2, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDsetchunkcache failed\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Write data use SDwriteChunk */
+
+    /* Write chunk 1 */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    status = SDwritechunk(newsds2, start_dims, (VOIDP) chunk1_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 1\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Write chunk 4 */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    status = SDwritechunk(newsds2, start_dims, (VOIDP) chunk4_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 4\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Write chunk 2 */
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    status = SDwritechunk(newsds2, start_dims, (VOIDP) chunk2_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 2\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Write chunk 5 */
+    start_dims[0] = 2;
+    start_dims[1] = 0;
+    status = SDwritechunk(newsds2, start_dims, (VOIDP) chunk5_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 5\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Write chunk 3 */
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    status = SDwritechunk(newsds2, start_dims, (VOIDP) chunk3_2u16);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 3\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Write chunk 6 */
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    status = SDwritechunk(newsds2, start_dims, (VOIDP) chunk6_2u16);
+     if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDwritechunk failed to write chunk 6\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* read a portion of data back in using SDreaddata
+       i.e  5x2 subset of the whole array */
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    edge_dims[0] = 5;
+    edge_dims[1] = 2;
+    status = SDreaddata(newsds2, start_dims, NULL, edge_dims, (VOIDP) inbuf_2u16);
+    CHECK(status, FAIL, "Chunk Test 2. SDreaddata");
+   /* This 5x2 array should look somethink like this
+         {{23, 24, 25, 26, 27},
+          {33, 34, 35, 36, 37}}    
+    */
+    for (i = 0; i < 5; i++)
+      {
+        for (j = 0; j < 2; j++)
+          {
+              if (inbuf_2u16[i][j] != u16_2cdata[i][j])
+                {
+                    fprintf(stderr,"Chunk Test 2. inbuf_2u16[%d][%d]=%d,",
+                            i,j,inbuf_2u16[i][j]);
+                    fprintf(stderr,"u16_2cdata[%d][%d]=%d,",
+                            i,j,u16_2cdata[i][j]);
+                    fprintf(stderr,"\n");
+                    num_errs++;
+                }
+          }
+      }
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds2, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 2.SDgetchunkinfo failed \n");
+        num_errs++;
+        goto test3;
+      }
+
+    rcdims = rchunk_def.chunk_lengths;
+
+    /* check chunk lengths and see if SDS is chunked */
+    if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cflags != HDF_CHUNK)
+      {
+        fprintf(stderr, "Chunk Test 2.SDgetchunkinfo returned wrong values\n");
+        num_errs++;
+        goto test3;
+      }
+
+    /* Close down this SDS*/    
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "Chunk Test 2. SDendaccess");
+
+    /* 
+     * Next 3 differnet number types are tested with 3-D arrays
+     */
+  test3:
+    /* 
+     * Test 3. create a new chunked SDS of float32 in file 1 
+     */
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    newsds3 = SDcreate(fchk, "DataSetChunked_3D_1", DFNT_FLOAT32, 3, d_dims);
+    if(newsds3 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 3. Failed to create a new 3D float32 data set \n");
+        num_errs++;
+        goto test4;
+      }
+
+    max = 0.0;
+    status = SDsetfillvalue(newsds3, (VOIDP) &max);
+    CHECK(status, FAIL, "Chunk Test 3. SDsetfillvalue");
+
+    /* Set chunking */
+    cdims[0] = chunk_def.chunk_lengths[0] = 1;
+    cdims[1] = chunk_def.chunk_lengths[1] = 2;
+    cdims[2] = chunk_def.chunk_lengths[2] = 3;
+    status = SDsetchunk(newsds3, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 3. Failed to create new chunked data set\n");
+        num_errs++;
+        goto test4;
+      }
+
+    /* Write data out */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDwritedata(newsds3, start_dims, NULL, edge_dims, (VOIDP) f32_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 3. Failed to write f32_data to new chunked data set\n");
+        num_errs++;
+        goto test4;
+      }
+
+    /* read data back in */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDreaddata(newsds3, start_dims, NULL, edge_dims, (VOIDP) inbuf_f32);
+    CHECK(status, FAIL, "Chunk Test 3. SDreaddata");
+
+    for (i = 0; i < d_dims[0]; i++)
+      {
+        for (j = 0; j < d_dims[1]; j++)
+          {
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (inbuf_f32[i][j][k] != f32_data[i][j][k])
+                    {
+                        fprintf(stderr,"Chunk Test 3. inbuf_f32[%d][%d][%d]=%f,",
+                                i,j,k,inbuf_f32[i][j][k]);
+                        fprintf(stderr,"f32_data[%d][%d][%d]=%f,",
+                                i,j,k,f32_data[i][j][k]);
+                        fprintf(stderr,"\n");
+                        num_errs++;
+                    }
+              }
+          }
+      }
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds3);
+    CHECK(status, FAIL, "Chunk Test 3. SDendaccess");
+
+
+    /* 
+     * Test 4. Create a new chunked SDS of uint16 in file 1 
+     */
+  test4:
+
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    newsds4 = SDcreate(fchk, "DataSetChunked_3D_2", DFNT_UINT16, 3, d_dims);
+    if(newsds4 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. Failed to set a new uint16 3D data set chunked\n");
+        num_errs++;
+        goto test5;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds4, (VOIDP) &fill_u16);
+    CHECK(status, FAIL, "Chunk Test 4. SDsetfillvalue");
+
+    /* Set chunking, chunk is 1x2x3 */
+    cdims[0] = chunk_def.chunk_lengths[0] = 1;
+    cdims[1] = chunk_def.chunk_lengths[1] = 2;
+    cdims[2] = chunk_def.chunk_lengths[2] = 3;
+    status = SDsetchunk(newsds4, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. Failed to create new chunked data set\n");
+        num_errs++;
+        goto test5;
+      }
+
+    /* Set Chunk cache */
+    status = SDsetchunkcache(newsds4, 4, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. SDsetchunkcache failed\n");
+        num_errs++;
+        goto test5;
+      }
+
+    /* Write data */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDwritedata(newsds4, start_dims, NULL, edge_dims, (VOIDP) u16_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. Failed to write u16_data to new chunked data set\n");
+        num_errs++;
+        goto test5;
+      }
+
+    /* read data back in */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDreaddata(newsds4, start_dims, NULL, edge_dims, (VOIDP) inbuf_u16);
+    CHECK(status, FAIL, "Chunk Test 4. SDreaddata");
+    for (i = 0; i < d_dims[0]; i++)
+      {
+        for (j = 0; j < d_dims[1]; j++)
+          {
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (inbuf_u16[i][j][k] != u16_data[i][j][k])
+                    {
+                        fprintf(stderr,"Chunk Test 4. inbuf_u16[%d][%d][%d]=%d,",
+                                i,j,k,inbuf_u16[i][j][k]);
+                        fprintf(stderr,"u16_data[%d][%d][%d]=%d,",
+                                i,j,k,u16_data[i][j][k]);
+                        fprintf(stderr,"\n");
+                        num_errs++;
+                    }
+              }
+          }
+      }
+    /* Check getting chunked flag */
+    status = SDgetchunkinfo(newsds4, NULL, &cflags);
+    CHECK(status, FAIL, "Chunk Test 4. SDgetchunkinfo");
+    VERIFY(cflags, HDF_CHUNK, "Chunk Test 4. SDgetchunkinfo");
+
+    /* Check chunk info */
+    status = SDgetchunkinfo(newsds4, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 4. SDgetchunkinfo failed \n");
+        num_errs++;
+        goto test5;
+      }
+
+    rcdims = rchunk_def.chunk_lengths;
+
+    if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] || cdims[2] != rcdims[2] 
+        || cflags != HDF_CHUNK)
+      {
+        fprintf(stderr, "Chunk Test 4. SDgetchunkinfo returned wrong values\n");
+        num_errs++;
+        goto test5;
+      }
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds4);
+    CHECK(status, FAIL, "Chunk Test 4. SDendaccess");
+
+
+    /* 
+     * Test 5. Create a new chunked SDS of uint8 in file 1 
+     */
+  test5:
+
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    newsds5 = SDcreate(fchk, "DataSetChunked_3D_3", DFNT_UINT8, 3, d_dims);
+    if(newsds5 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. Failed to set a new uint8 3D data set chunked\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* Set chunking, chunk is 1x1x4 */
+    cdims[0] = chunk_def.chunk_lengths[0] = 1;
+    cdims[1] = chunk_def.chunk_lengths[1] = 1;
+    cdims[2] = chunk_def.chunk_lengths[2] = 4;
+    status = SDsetchunk(newsds5, chunk_def, HDF_CHUNK);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. Failed to create new chunked data set\n");
+        num_errs++;
+        goto test6;
+      }
+
+#if 0
+    /* Write data using SDwritedata() */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDwritedata(newsds5, start_dims, NULL, edge_dims, (VOIDP) wu8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. Failed to write wu8_data to new chunked data set\n");
+        num_errs++;
+        goto test6;
+      }
+#endif
+
+    /* Write data use SDwriteChunk */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds5, start_dims, (VOIDP) chunk1_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDwritechunk failed to write chunk 1\n");
+        num_errs++;
+        goto test6;
+      }
+
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds5, start_dims, (VOIDP) chunk4_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDwritechunk failed to write chunk 4\n");
+        num_errs++;
+        goto test6;
+      }
+
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds5, start_dims, (VOIDP) chunk2_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDwritechunk failed to write chunk 2\n");
+        num_errs++;
+        goto test6;
+      }
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds5, start_dims, (VOIDP) chunk5_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDwritechunk failed to write chunk 5\n");
+        num_errs++;
+        goto test6;
+      }
+
+    start_dims[0] = 0;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds5, start_dims, (VOIDP) chunk3_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDwritechunk failed to write chunk 3\n");
+        num_errs++;
+        goto test6;
+      }
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds5, start_dims, (VOIDP) chunk6_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDwritechunk failed to write chunk 6\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* read data back in */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDreaddata(newsds5, start_dims, NULL, edge_dims, (VOIDP) inbuf_u8);
+    CHECK(status, FAIL, "Chunk Test 5. SDreaddata");
+    for (i = 0; i < d_dims[0]; i++)
+      {
+        for (j = 0; j < d_dims[1]; j++)
+          {
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (inbuf_u8[i][j][k] != u8_data[i][j][k])
+                    {
+                        fprintf(stderr,"Chunk Test 5. inbuf_u8[%d][%d][%d]=%d,",
+                                i,j,k,inbuf_u8[i][j][k]);
+                        fprintf(stderr,"u8_data[%d][%d][%d]=%d,",
+                                i,j,k,u8_data[i][j][k]);
+                        fprintf(stderr,"\n");
+                        num_errs++;
+                    }
+              }
+          }
+      }
+
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds5, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDreadchunk failed to read chunk 1\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk1_u8[i])
+            {
+                printf("Chunk Test 5. chunk1_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk1_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds5, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDreadchunk failed to read chunk 2\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk2_u8[i])
+            {
+                printf("Chunk Test 5. chunk2_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk2_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+    start_dims[0] = 0;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds5, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDreadchunk failed to read chunk 3\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk3_u8[i])
+            {
+                printf("Chunk Test 5. chunk3_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk3_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds5, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDreadchunk failed to read chunk 4\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk4_u8[i])
+            {
+                printf("Chunk Test 5. chunk4_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk4_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds5, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDreadchunk failed to read chunk 5\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk5_u8[i])
+            {
+                printf("Chunk Test 5. chunk5_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk5_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds5, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 5. SDreadchunk failed to read chunk 6\n");
+        num_errs++;
+        goto test6;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk6_u8[i])
+            {
+                printf("Chunk Test 5. chunk6_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk6_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds5);
+    CHECK(status, FAIL, "Chunk Test 5. SDendaccess");
+
+
+    /* ---------------------------------------------------------------
+     *  Chunking with Compression 
+     ----------------------------------------------------------------*/
+
+
+    /* 
+     * Test 6. Create a new chunked SDS of uint8 in file 1 
+     *         Compress using Skipping Huffman. Write using SDwriteChunk
+     *         Read back in using SDreaddata and SDreadChunk. 
+     *	       Retrieve and verify the compression information.
+     *         Use Skipping Huffman compression
+     *         Note: a template is created first then the SDS 
+     *               is re-slected for writing/reading.
+     */
+  test6:
+
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    newsds6 = SDcreate(fchk, "DataSetChunked_3D_SKIP_HUF_2", DFNT_UINT8, 3, d_dims);
+    if(newsds6 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. Failed to set a new uint8 3D data set chunked\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Set chunking, chunk is 1x1x4 */
+    cdims[0] = chunk_def.comp.chunk_lengths[0] = 1;
+    cdims[1] = chunk_def.comp.chunk_lengths[1] = 1;
+    cdims[2] = chunk_def.comp.chunk_lengths[2] = 4;
+#if 0
+    chunk_def.comp.comp_type = COMP_CODE_RLE;
+#endif
+    chunk_def.comp.comp_type = COMP_CODE_SKPHUFF; /* Skipping Huffman */
+    chunk_def.comp.cinfo.skphuff.skp_size = sizeof(uint16);
+    status = SDsetchunk(newsds6, chunk_def, HDF_CHUNK | HDF_COMP);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. Failed to create new chunked, Skipping Huffman compressed data set\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Close down SDS ie. template creation*/    
+    status = SDendaccess(newsds6);
+    CHECK(status, FAIL, "Chunk Test 6. SDendaccess");
+
+    newsds6 = FAIL;
+
+    /* Select same SDS again, first get index */
+    if ((index = SDnametoindex(fchk,"DataSetChunked_3D_SKIP_HUF_2")) == FAIL)
+      {
+          fprintf(stderr, "Chunk Test 6. SDnametoindex  Failed for  Skipping Huffman compressed data set\n");
+          num_errs++;
+          goto test7;
+      }
+
+    if ((newsds6 = SDselect(fchk,index)) == FAIL)
+      {
+          fprintf(stderr, "Chunk Test 6. SDselect Failed to re-select new chunked, Skipping Huffman compressed data set\n");
+          num_errs++;
+          goto test7;
+      }
+
+    /*
+     * Retrieve and verify the compression type
+     */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds6, &comp_type);
+    CHECK(status, FAIL, "Chunk Test 6. SDgetcomptype");
+    VERIFY(comp_type, chunk_def.comp.comp_type, "Chunk Test 6. SDgetcomptype");
+
+    /*
+     * Retrieve and verify the compression info - bug# 307, 10/10/01 - BMR
+     * Updated: SDgetcompress replaced by SDgetcompinfo - bugzilla# 130,
+     *		4/17/05 -BMR
+     */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompinfo(newsds6, &comp_type, &cinfo);
+    CHECK(status, FAIL, "Chunk Test 6. SDgetcompinfo");
+    VERIFY(comp_type, chunk_def.comp.comp_type, "Chunk Test 6. SDgetcompinfo");
+    VERIFY(cinfo.skphuff.skp_size, chunk_def.comp.cinfo.skphuff.skp_size, "Chunk Test 6. SDgetcompinfo");
+
+    /* Write data use SDwriteChunk */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds6, start_dims, (VOIDP) chunk1_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDwritechunk failed to write chunk 1\n");
+        num_errs++;
+        goto test7;
+      }
+
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds6, start_dims, (VOIDP) chunk4_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDwritechunk failed to write chunk 4\n");
+        num_errs++;
+        goto test7;
+      }
+
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds6, start_dims, (VOIDP) chunk2_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDwritechunk failed to write chunk 2\n");
+        num_errs++;
+        goto test7;
+      }
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds6, start_dims, (VOIDP) chunk5_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDwritechunk failed to write chunk 5\n");
+        num_errs++;
+        goto test7;
+      }
+
+    start_dims[0] = 0;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds6, start_dims, (VOIDP) chunk3_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDwritechunk failed to write chunk 3\n");
+        num_errs++;
+        goto test7;
+      }
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDwritechunk(newsds6, start_dims, (VOIDP) chunk6_u8);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDwritechunk failed to write chunk 6\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* read data back in */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDreaddata(newsds6, start_dims, NULL, edge_dims, (VOIDP) inbuf_u8);
+    CHECK(status, FAIL, "Chunk Test 6. SDreaddata");
+    for (i = 0; i < d_dims[0]; i++)
+      {
+        for (j = 0; j < d_dims[1]; j++)
+          {
+            for (k = 0; k < d_dims[2]; k++)
+              {
+                  if (inbuf_u8[i][j][k] != u8_data[i][j][k])
+                    {
+                        fprintf(stderr,"Chunk Test 6. inbuf_u8[%d][%d][%d]=%d,",
+                                i,j,k,inbuf_u8[i][j][k]);
+                        fprintf(stderr,"u8_data[%d][%d][%d]=%d,",
+                                i,j,k,u8_data[i][j][k]);
+                        fprintf(stderr,"\n");
+                        num_errs++;
+                    }
+              }
+          }
+      }
+
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds6, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDreadchunk failed to read chunk 1\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk1_u8[i])
+            {
+                printf("Chunk Test 6. chunk1_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk1_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds6, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDreadchunk failed to read chunk 2\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk2_u8[i])
+            {
+                printf("Chunk Test 6. chunk2_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk2_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+    start_dims[0] = 0;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds6, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDreadchunk failed to read chunk 3\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk3_u8[i])
+            {
+                printf("Chunk Test 6. chunk3_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk3_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds6, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "SDreadchunk failed to read chunk 4\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk4_u8[i])
+            {
+                printf("Chunk Test 6. chunk4_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk4_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds6, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDreadchunk failed to read chunk 5\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk5_u8[i])
+            {
+                printf("Chunk Test 6. chunk5_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk5_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDreadchunk(newsds6, start_dims, (VOIDP) ru8_data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 6. SDreadchunk failed to read chunk 6\n");
+        num_errs++;
+        goto test7;
+      }
+
+    /* Verify chunk */
+    for (i = 0; i < 4; i++)
+       {
+          if (ru8_data[i] != chunk6_u8[i])
+            {
+                printf("Chunk Test 6. chunk6_u8: Wrong data at %d, out %d in %d\n", 
+                 i, chunk6_u8[i], ru8_data[i]);
+                num_errs++;
+            }
+       }
+
+    /* Check getting chunked/compressed flag only with SDgetchunkinfo */
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds6, NULL, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 6. SDgetchunkinfo");
+    VERIFY(c_flags_out, (HDF_CHUNK | HDF_COMP), "Chunk Test 6. SDgetchunkinfo");
+
+    /* Check getting compression info with SDgetchunkinfo */
+    HDmemset(&chunk_def_out, 0, sizeof(HDF_CHUNK_DEF));
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds6, &chunk_def_out, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 6. SDgetchunkinfo");
+    VERIFY(chunk_def_out.comp.comp_type, comp_type, "Chunk Test 6. SDgetchunkinfo");
+    VERIFY(chunk_def_out.comp.cinfo.skphuff.skp_size, chunk_def.comp.cinfo.skphuff.skp_size, "Chunk Test 6. chunkinfo_new");
+    VERIFY(c_flags_out, (HDF_CHUNK | HDF_COMP), "Chunk Test 6. SDgetchunkinfo");
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds6);
+    CHECK(status, FAIL, "Chunk Test 6. SDendaccess");
+
+    newsds6 = FAIL;
+
+    /* Select same SDS again, first get index */
+    if ((index = SDnametoindex(fchk,"DataSetChunked_3D_SKIP_HUF_2")) == FAIL)
+      {
+          fprintf(stderr, "Chunk Test 6. SDnametoindex  Failed for  Skipping Huffman compressed data set\n");
+          num_errs++;
+          goto test7;
+      }
+
+    if ((newsds6 = SDselect(fchk,index)) == FAIL)
+      {
+          fprintf(stderr, "Chunk Test 6. SDselect Failed to re-select new chunked, Skipping Huffman compressed data set\n");
+          num_errs++;
+          goto test7;
+      }
+
+    /*
+     * Retrieve and verify the compression type
+     */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds6, &comp_type);
+    CHECK(status, FAIL, "Chunk Test 6. SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "Chunk Test 6. SDgetcomptype");
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds6);
+    CHECK(status, FAIL, "Chunk Test 6. SDendaccess");
+
+
+    /* 
+     * Test 7. Create a  9x4 SDS of uint16 in file 1 
+     *         Write using SDwritedata, read back in using SDreaddata
+     *         Use GZIP compression.
+     */
+  test7:
+
+    d_dims[0] = 9;
+    d_dims[1] = 4;
+    newsds7 = SDcreate(fchk, "DataSetChunked_2D_GZIP_1", DFNT_UINT16, 2, d_dims);
+    if(newsds7 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. Failed to create a new 2D uint16 data set \n");
+        num_errs++;
+        goto test8;
+      }
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(newsds7, (VOIDP) &fill_u16);
+    CHECK(status, FAIL, "Chunk Test 7. SDsetfillvalue");
+
+    /* Create chunked SDS 
+       chunk is 3x2 which will create 6 chunks.
+       Use GZIP compression */
+    cdims[0] = chunk_def.comp.chunk_lengths[0] = 3;
+    cdims[1] = chunk_def.comp.chunk_lengths[1] = 2;
+#if 0
+    chunk_def.comp.comp_type = COMP_CODE_RLE;   /* RLE */
+
+    chunk_def.comp.comp_type = COMP_CODE_SKPHUFF; /* Skipping Huffman */
+    chunk_def.comp.cinfo.skphuff.skp_size = sizeof(uint16);
+#endif
+    chunk_def.comp.comp_type = COMP_CODE_DEFLATE; /* GZIP */
+    chunk_def.comp.cinfo.deflate.level = 6;
+
+    status = SDsetchunk(newsds7, chunk_def, HDF_CHUNK | HDF_COMP);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. Failed to create new chunked, GZIP Compressed data set\n");
+        num_errs++;
+        goto test8;
+      }
+
+    /* Set Chunk cache to hold 2 chunks */
+    status = SDsetchunkcache(newsds7, 2, 0);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. SDsetchunkcache failed\n");
+        num_errs++;
+        goto test8;
+      }
+
+    /* Check getting chunked/compressed flag only with SDgetchunkinfo */
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds7, NULL, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 7. SDgetchunkinfo");
+    VERIFY(c_flags_out, (HDF_CHUNK | HDF_COMP), "Chunk Test 7. SDgetchunkinfo");
+
+    HDmemset(&chunk_def_out, 0, sizeof(HDF_CHUNK_DEF));
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds7, &chunk_def_out, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 7. SDgetchunkinfo");
+    VERIFY(chunk_def_out.comp.cinfo.deflate.level, chunk_def.comp.cinfo.deflate.level, "Chunk Test 7. SDgetchunkinfo");
+    VERIFY(c_flags_out, (HDF_CHUNK | HDF_COMP), "Chunk Test 7. SDgetchunkinfo");
+
+    /* Write data */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    edge_dims[0] = 9;
+    edge_dims[1] = 4;
+    status = SDwritedata(newsds7, start_dims, NULL, edge_dims, (VOIDP) u16_2data);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. Failed to write u16_2data to new chunked data set\n");
+        num_errs++;
+        goto test8;
+      }
+
+    /* read a portion of data back in using SDreaddata*/
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    edge_dims[0] = 9;
+    edge_dims[1] = 4;
+    status = SDreaddata(newsds7, start_dims, NULL, edge_dims, (VOIDP) inbuf1_2u16);
+    CHECK(status, FAIL, "Chunk Test 7. SDreaddata");
+    for (i = 0; i < 9; i++)
+      {
+        for (j = 0; j < 4; j++)
+          {
+              if (inbuf1_2u16[i][j] != u16_2data[i][j])
+                {
+                    fprintf(stderr,"Chunk Test 7. inbuf1_2u16[%d][%d]=%d,",
+                            i,j,inbuf1_2u16[i][j]);
+                    fprintf(stderr,"u16_cdata[%d][%d]=%d,",
+                            i,j,u16_2data[i][j]);
+                    fprintf(stderr,"\n");
+                    num_errs++;
+                }
+          }
+      }
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds7, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 7. SDgetchunkinfo failed \n");
+        num_errs++;
+        goto test8;
+      }
+
+    rcdims = rchunk_def.comp.chunk_lengths;
+
+    /* check chunk lengths and see if SDS is compressed and chunked */
+    if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] 
+        || cflags != (HDF_CHUNK | HDF_COMP))
+      {
+        fprintf(stderr, "Chunk Test 7. SDgetchunkinfo returned wrong values\n");
+        num_errs++;
+        goto test8;
+      }
+
+    /* Close down this SDS*/    
+    status = SDendaccess(newsds7);
+    CHECK(status, FAIL, "Chunk Test 7. SDendaccess");
+
+    /*
+     * Added to test getting compression information for chunked SDS - 
+     * bug# 307, 10/10/01 - BMR
+     */
+    /* Select same SDS again, first get index */
+    if ((index = SDnametoindex(fchk,"DataSetChunked_2D_GZIP_1")) == FAIL)
+      {
+          fprintf(stderr, "Chunk Test 7. SDnametoindex  Failed for GZIP compressed data set\n");
+          num_errs++;
+          goto test8;
+      }
+
+    if ((newsds7 = SDselect(fchk,index)) == FAIL)
+      {
+          fprintf(stderr, "Chunk Test 7. SDselect Failed to re-select new chunked, GZIP compressed data set\n");
+          num_errs++;
+          goto test8;
+      }
+
+    /*
+     * Retrieve and verify the compression info - bug# 307, 10/10/01 - BMR
+     * Updated: SDgetcompress replaced by SDgetcompinfo - bugzilla# 130,
+     *		4/17/05 -BMR
+     */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompinfo(newsds7, &comp_type, &cinfo);
+    CHECK(status, FAIL, "Chunk Test 6. SDgetcompinfo");
+    VERIFY(comp_type, chunk_def.comp.comp_type, "Chunk Test 6. SDgetcompinfo");
+    VERIFY(cinfo.deflate.level, chunk_def.comp.cinfo.deflate.level, "Chunk Test 6. SDgetcompinfo");
+
+    /*
+     * Retrieve and verify the compression type
+     */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds7, &comp_type);
+    CHECK(status, FAIL, "Chunk Test 7. SDgetcomptype");
+    VERIFY(comp_type, chunk_def.comp.comp_type, "Chunk Test 7. SDgetcomptype");
+
+    /* Close down SDS*/    
+    status = SDendaccess(newsds7);
+    CHECK(status, FAIL, "Chunk Test 7. SDendaccess");
+
+
+    /* Close down file 'chktst.hdf' */
+    status = SDend(fchk);
+    CHECK(status, FAIL, "SDend");
+
+    /* ---------------------------------------------------------------
+     *  Chunking with NBIT Compression 
+     ----------------------------------------------------------------*/
+
+    /*
+     * Chunking with NBIT
+     */
+  test8:
+
+    /* Create file */
+    fchk = SDstart(CNBITFILE, DFACC_CREATE);
+    CHECK(fchk, FAIL, "Chunk Test 8. SDstart");
+
+    /* Create dataset */
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds8 = SDcreate(fchk, "Chunked_NBitDataSet", nt, 2, dimsize);
+    if(newsds8 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. SDcreate Failed to create a new chunked, nbit data set \n");
+        num_errs++;
+        goto done;
+      }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+    /* Create chunked SDS with NBIT compression.
+       chunk is 2x2 which will create 9 chunks.*/
+    cdims[0] = chunk_def.nbit.chunk_lengths[0] = 2;
+    cdims[1] = chunk_def.nbit.chunk_lengths[1] = 2;
+    chunk_def.nbit.start_bit = 6;
+    chunk_def.nbit.bit_len   = 7;
+    chunk_def.nbit.sign_ext  = FALSE;
+    chunk_def.nbit.fill_one  = FALSE;
+    c_flags = HDF_CHUNK | HDF_NBIT;
+    status = SDsetchunk(newsds8, chunk_def, c_flags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. SDsetchunk Failed to create new chunked, NBIT data set\n");
+        num_errs++;
+        goto done;
+      }
+
+    /* write out the data */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds8, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "Chunk Test 8. SDwritedata");
+
+    /* Check getting chunked/compressed flag only with SDgetchunkinfo */
+    c_flags_out = 0;
+    status = SDgetchunkinfo(newsds8, NULL, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 8. SDgetchunkinfo");
+    VERIFY(c_flags_out, (HDF_CHUNK | HDF_NBIT), "Chunk Test 8. SDgetchunkinfo");
+
+    /* Check getting compression info with SDgetchunkinfo */
+    c_flags_out = 0;
+    HDmemset(&chunk_def_out, 0, sizeof(HDF_CHUNK_DEF));
+    status = SDgetchunkinfo(newsds8, &chunk_def_out, &c_flags_out);
+    CHECK(status, FAIL, "Chunk Test 8. SDgetchunkinfo");
+    VERIFY(c_flags_out, (HDF_CHUNK | HDF_NBIT), "Chunk Test 8. SDgetchunkinfo");
+    VERIFY(chunk_def_out.nbit.start_bit, chunk_def.nbit.start_bit, "Chunk Test 8. SDgetchunkinfo");
+    VERIFY(chunk_def_out.nbit.bit_len, chunk_def.nbit.bit_len, "Chunk Test 8. SDgetchunkinfo");
+    VERIFY(chunk_def_out.nbit.sign_ext, chunk_def.nbit.sign_ext, "Chunk Test 8. SDgetchunkinfo");
+    VERIFY(chunk_def_out.nbit.fill_one, chunk_def.nbit.fill_one, "Chunk Test 8. SDgetchunkinfo");
+
+    /* end access to SDS */
+    status = SDendaccess(newsds8);
+    CHECK(status, FAIL, "Chunk Test 8. SDendaccess");
+
+    /* need to close to flush n-bit info to file */
+    status = SDend(fchk);
+    CHECK(status, FAIL, "Chunk Test 8. SDend");
+
+    /* open file again */
+    fchk = SDstart(CNBITFILE, DFACC_RDWR);
+    CHECK(fchk, FAIL, "Chunk Test 8. SDstart (again)");
+
+    /* Select SDS */
+    newsds8 = SDselect(fchk, 0);
+    if(newsds8 == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. Failed to select a data set for n-bit access\n");
+        num_errs++;
+        goto done;
+      }
+
+    /* read the n-bit data back in */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds8, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "Chunk Test 8. SDreaddata");
+
+    /* Verify the data */
+    for(i = 0; i < 25; i++)
+      {
+        if((idata[i]&0x7f) != rdata[i]) 
+          {
+            fprintf(stderr,"Chunk Test 8. Bogus val in loc %d in n-bit dset want %ld got %ld\n",
+		    i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+          }
+      }
+
+    /* Get chunk lengths */
+    status = SDgetchunkinfo(newsds8, &rchunk_def, &cflags);
+    if(status == FAIL) 
+      {
+        fprintf(stderr, "Chunk Test 8. SDgetchunkinfo failed \n");
+        num_errs++;
+        goto done;
+      }
+
+    rcdims = rchunk_def.nbit.chunk_lengths;
+
+    /* check chunk lengths and see if SDS is nbit-compressed and chunked */
+    if (cdims[0] != rcdims[0] || cdims[1] != rcdims[1] 
+        || cflags != (HDF_CHUNK | HDF_NBIT))
+      {
+        fprintf(stderr, "Chunk Test 8. SDgetchunkinfo returned wrong values\n");
+        fprintf(stderr, "Chunk Test 8. cflags =%d \n",(int)cflags);
+        fprintf(stderr, "Chunk Test 8. cdims[%d] =%d \n", 0, (int)cdims[0]);
+        fprintf(stderr, "Chunk Test 8. cdims[%d] =%d \n", 1, (int)cdims[1]);
+        fprintf(stderr, "Chunk Test 8. rcdims[%d] =%d \n", 0, (int)rcdims[0]);
+        fprintf(stderr, "Chunk Test 8. rcdims[%d] =%d \n", 1, (int)cdims[1]);
+        num_errs++;
+        goto done;
+      }
+    /*
+     * Retrieve and verify the compression type
+     */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds8, &comp_type);
+    CHECK(status, FAIL, "Chunk Test 8. SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_NBIT, "Chunk Test 8. SDgetcomptype");
+
+    /*
+     * Retrieve and verify the compression info - bug# 307, 10/10/01 - BMR
+     * Updated: SDgetcompress replaced by SDgetcompinfo - bugzilla# 130,
+     *		4/17/05 -BMR
+     */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompinfo(newsds8, &comp_type, &cinfo);
+    CHECK(status, FAIL, "Chunk Test 8. SDgetcompinfo");
+
+    /* Note: the struct nbit in the union HDF_CHUNK_DEF seems like an extra
+	thing since comp_info also has nbit, but the HDF_CHUNK_DEF.nbit was
+	used to set the compression info so it's also used here to verify */ 
+    VERIFY(comp_type, COMP_CODE_NBIT, "Chunk Test 8. SDgetcompinfo");
+    VERIFY(cinfo.nbit.sign_ext, chunk_def.nbit.sign_ext, "Chunk Test 8. SDgetcompinfo");
+    VERIFY(cinfo.nbit.fill_one, chunk_def.nbit.fill_one, "Chunk Test 8. SDgetcompinfo");
+    VERIFY(cinfo.nbit.start_bit, chunk_def.nbit.start_bit, "Chunk Test 8. SDgetcompinfo");
+    VERIFY(cinfo.nbit.bit_len, chunk_def.nbit.bit_len, "Chunk Test 8. SDgetcompinfo");
+    /* end of test for bug# 307 and bugzilla# 130 */
+
+    /* end access to SDS */
+    status = SDendaccess(newsds8);
+    CHECK(status, FAIL, "Chunk Test 8. SDendaccess");
+
+    /* close file */
+    status = SDend(fchk);
+    CHECK(status, FAIL, "Chunk Test 8. SDend");
+
+    if (num_errs == 0)
+        PASSED();
+
+  done:
+    return num_errs;
+} /* test_chunk() */
+#endif /* HDF */
diff --git a/mfhdf/test/tcomp.c b/mfhdf/test/tcomp.c
new file mode 100644
index 0000000..2f7c078
--- /dev/null
+++ b/mfhdf/test/tcomp.c
@@ -0,0 +1,845 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tcomp.c - tests various compression functionality
+ * Structure of the file:
+ *    test_compression - test driver
+ *	  test_various_comps - creates several data sets with different
+ *		compression methods.
+ *
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+/********************************************************************
+   Name: test_various_comps() - creates several data sets with different
+		compression methods.
+
+   Description:
+	This function creates and writes data to 3 data sets using three
+	compression methods, deflate, skipping huffman, and szip, in that
+	order.  The output file can be used to test display tools like
+	hdp.
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - May 18, 2007
+*********************************************************************/
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+
+#define FILE_NAME      "sds_compressed.hdf"
+#define SDS1_NAME      "SDSgzip"
+#define SDS2_NAME      "SDSskiphuff"
+#define SDS3_NAME      "SDSszip"
+#define X_LENGTH       5
+#define Y_LENGTH       16
+#define RANK           2
+
+
+static intn
+test_various_comps()
+{
+    /************************* Variable declaration **************************/
+
+    int32     sd_id, sds_id, sds_index;
+    intn      status;
+    int32     comp_type;    /* Compression flag */
+    comp_info c_info;   /* Compression structure */
+    int32     start[2], edges[2], dim_sizes[2];
+    int32     data[Y_LENGTH][X_LENGTH];
+    int32     pixels_per_scanline;
+    intn      num_errs = 0;    /* number of errors in compression test so far */
+    int       i, j;
+
+    /********************* End of variable declaration ***********************/
+
+    /* Buffer array data and define array dimensions. */
+    for (j = 0; j < Y_LENGTH; j++) 
+    {
+	for (i = 0; i < X_LENGTH; i++)
+		data[j][i] = (i + j) + 1;
+    }
+    dim_sizes[0] = Y_LENGTH;
+    dim_sizes[1] = X_LENGTH;
+
+    /* Create the file and initialize the SD interface. */
+    sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Define the location and size of the data set to be written to the file. */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Create 1st data set for GZIP compression. */ 
+    sds_id = SDcreate (sd_id, SDS1_NAME, DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Set data set SDS1_NAME to use GZIP compression. */
+    HDmemset(&c_info, 0, sizeof(c_info));
+    comp_type = COMP_CODE_DEFLATE;
+    c_info.deflate.level = 6;
+    status = SDsetcompress (sds_id, comp_type, &c_info); 
+    CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write the stored data to the 1st data set. */
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the 1st data set. */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Create 2nd data set for Skipping Huffman compression. */
+    sds_id = SDcreate (sd_id, SDS2_NAME, DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Set data set SDS2_NAME to use Skipping Huffman compression. */
+    HDmemset(&c_info, 0, sizeof(c_info));
+    comp_type = COMP_CODE_SKPHUFF;
+    c_info.skphuff.skp_size = 4;
+    status = SDsetcompress (sds_id, comp_type, &c_info); 
+    CHECK(status, FAIL, "SDsetcompress");
+ 
+    /* Write the stored data to the 2nd data set. */
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the 2nd data set. */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+#ifdef H4_HAVE_SZIP_ENCODER     /* we have szip library with encoder */
+    /* Create 3rd data set for SZIP compression. */
+    sds_id = SDcreate (sd_id, SDS3_NAME, DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Set data set SDS3_NAME to use SZIP compression. */
+    comp_type = COMP_CODE_SZIP;
+    pixels_per_scanline = dim_sizes[1];
+    c_info.szip.pixels = dim_sizes[0]*dim_sizes[1];;
+    c_info.szip.pixels_per_block = 2;
+    if(pixels_per_scanline >=2048)
+	c_info.szip.pixels_per_scanline = 512;
+    else
+	c_info.szip.pixels_per_scanline = dim_sizes[1];
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 64;
+    status = SDsetcompress (sds_id, comp_type, &c_info); 
+    CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write the stored data to the 3rd data set. */
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the 3rd data set. */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+#endif
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_various_comps */
+
+#define COMPFILE1 "comptst1.hdf"
+#define COMPFILE2 "comptst2.hdf"
+#define COMPFILE3 "comptst3.hdf"
+#define COMPFILE4 "comptst4.hdf"
+#define COMPFILE5 "comptst5.hdf"
+#define COMPFILE6 "comptst6.hdf"
+#define COMPFILE7 "comptst7.hdf"
+static int
+test_compressed_data()
+{
+    int32 fcomp; /* File handle */
+    int32 index;             /* Index of a dataset */
+    int32 nt;                /* Number type */
+    int32 dimsize[10];       /* dimension sizes */
+    int32 newsds, newsds2; 	/* SDS handles */
+    comp_coder_t comp_type;	/* to retrieve compression type into */
+    comp_info cinfo;            /* compression information structure */
+    int32 idata[100];
+    int32 rdata[100];
+    int32 fillval;
+    intn  i;
+    intn  num_errs = 0;    /* number of errors in compression test so far */
+    intn  status;      /* status flag */
+    int32 start[10], end[10]; /* start and end arrays */
+
+    /*
+     * Writing 1st compressed dataset, basic skipping huffman.
+     */
+    fcomp = SDstart(COMPFILE1, DFACC_CREATE);
+    CHECK(fcomp, FAIL, "SDstart");
+
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fcomp, "CompDataSet1", nt, 2, dimsize);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to create a new data set for compression testing\n");
+        num_errs++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+    /* Set the dataset to be compressed with skipping huffman */
+    cinfo.skphuff.skp_size=4;
+    status = SDsetcompress(newsds,COMP_CODE_SKPHUFF,&cinfo);
+    CHECK(status, FAIL, "SDcompress");
+
+    /* Test get compression info when the data set is empty but set to be
+       compressed */
+    status = SDgetcompinfo(newsds, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "SDgetcompinfo");
+
+    /* Only get the compression method and verify it */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds, &comp_type);
+    CHECK(status, FAIL, "SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "SDgetcomptype");
+
+    /* Write data to the dataset */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* End access to the dataset */
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Read and verify the compressed data and information
+     */
+    fcomp = SDstart(COMPFILE1, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    /*
+     * Retrieve and verify the compression info - bug# 307, 9/7/01 - BMR
+     */
+#ifndef H4_NO_DEPRECATED_SYMBOLS /* Jan 9, 2013 */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompress(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompress");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "SDgetcompress");
+    VERIFY(cinfo.skphuff.skp_size, 4, "SDgetcompress");
+#endif /* H4_NO_DEPRECATED_SYMBOLS */
+
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompinfo(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "SDgetcompinfo");
+    VERIFY(cinfo.skphuff.skp_size, 4, "SDgetcompinfo");
+
+    /* Only get the compression method and verify it */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds2, &comp_type);
+    CHECK(status, FAIL, "SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "SDgetcomptype");
+
+    /* Read and verify the compressed data */
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(idata[i] != rdata[i]) {
+            fprintf(stderr,"thisone: Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    /* End access to the dataset and the file */
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Writing 2nd compressed dataset, partially filled & skipping huffman
+     */
+    fcomp = SDstart(COMPFILE2, DFACC_CREATE);
+    CHECK(fcomp, FAIL, "SDstart");
+
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fcomp, "CompDataSet2", nt, 2, dimsize);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to create a new data set for compression testing\n");
+        num_errs++;
+    }
+
+    /* Set fill value */
+    fillval=43;
+    status = SDsetfillvalue(newsds,(VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Set the dataset to be compressed with skipping huffman */
+    cinfo.skphuff.skp_size=4;
+    status = SDsetcompress(newsds,COMP_CODE_SKPHUFF,&cinfo);
+    CHECK(status, FAIL, "SDsetcompress");
+
+    /* fill the array with the standard info */
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+    /* overwrite selected portions with the fill value */
+    for(i = 0; i < 5; i++)
+        idata[i] = fillval;
+    for(i = 20; i < 25; i++)
+        idata[i] = fillval;
+
+    /* Write to the dataset */
+    start[0] = 1;
+    start[1] = 0;
+    end[0]   = 3;
+    end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) &idata[5]);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* End access to the datase */
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Read and verify the compressed data and information
+     */
+    fcomp = SDstart(COMPFILE2, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    /* Get the dataset by its name */
+    index = SDnametoindex(fcomp, "CompDataSet2");
+    CHECK(index, FAIL, "SDnametoindex");
+
+    newsds2 = SDselect(fcomp, index);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(idata[i] != rdata[i]) {
+            fprintf(stderr,"Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Creating 3rd compressed dataset, compressed template & skipping huffman
+     */
+    fcomp = SDstart(COMPFILE3, DFACC_CREATE);
+    CHECK(fcomp, FAIL, "SDstart");
+
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fcomp, "CompDataSet3", nt, 2, dimsize);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to create a new data set for compression testing\n");
+        num_errs++;
+    }
+
+    fillval=56;
+    status = SDsetfillvalue(newsds,(VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    cinfo.skphuff.skp_size=4;
+    status = SDsetcompress(newsds,COMP_CODE_SKPHUFF,&cinfo);
+    CHECK(status, FAIL, "SDsetcompress");
+
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Read the compressed data back in
+     */
+    fcomp = SDstart(COMPFILE3, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(fillval != rdata[i]) {
+            fprintf(stderr,"Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Creating 4th compressed dataset, compressed template read, then 
+     * partial write & skipping huffman
+     */
+    fcomp = SDstart(COMPFILE4, DFACC_CREATE);
+    CHECK(fcomp, FAIL, "SDstart");
+
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fcomp, "CompDataSet4", nt, 2, dimsize);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to create a new data set for compression testing\n");
+        num_errs++;
+    }
+
+    fillval=67;
+    status = SDsetfillvalue(newsds,(VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    cinfo.skphuff.skp_size=4;
+    status = SDsetcompress(newsds,COMP_CODE_SKPHUFF,&cinfo);
+    CHECK(status, FAIL, "SDsetcompress");
+
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Read the compressed data back in
+     */
+    fcomp = SDstart(COMPFILE4, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(fillval != rdata[i]) {
+            fprintf(stderr,"Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Modifying first compressed dataset.
+     */
+    fcomp = SDstart(COMPFILE4, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+    /* fill the array with the standard info */
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+    /* overwrite selected portions with the fill value */
+    for(i = 0; i < 10; i++)
+        idata[i] = fillval;
+    for(i = 20; i < 25; i++)
+        idata[i] = fillval;
+
+    start[0] = 2;
+    start[1] = 0;
+    end[0]   = 2;
+    end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) &idata[10]);
+    CHECK(status, FAIL, "SDwritedata");
+
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    fcomp = SDstart(COMPFILE4, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(idata[i] != rdata[i]) {
+            fprintf(stderr,"Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Writing 5th compressed dataset, basic RLE.
+     */
+    fcomp = SDstart(COMPFILE5, DFACC_CREATE);
+    CHECK(fcomp, FAIL, "SDstart");
+
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fcomp, "CompDataSet5", nt, 2, dimsize);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to create a new data set for compression testing\n");
+        num_errs++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+    status = SDsetcompress(newsds,COMP_CODE_RLE,&cinfo);
+    CHECK(status, FAIL, "SDcompress");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Read the compressed data back in.
+     */
+    fcomp = SDstart(COMPFILE5, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    /*
+     * Retrieve and verify the compression info - bug# 307, 9/7/01 - BMR
+     */
+#ifndef H4_NO_DEPRECATED_SYMBOLS /* Jan 9, 2013 */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompress(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompress");
+    VERIFY(comp_type, COMP_CODE_RLE, "SDgetcompress");
+#endif /* H4_NO_DEPRECATED_SYMBOLS */
+
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompinfo(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_RLE, "SDgetcompinfo");
+
+    /* Only get the compression method and verify it */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds2, &comp_type);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_RLE, "SDgetcompinfo");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(idata[i] != rdata[i]) {
+            fprintf(stderr,"Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Writing 6th compressed dataset, no encoding
+     */
+    fcomp = SDstart(COMPFILE6, DFACC_CREATE);
+    CHECK(fcomp, FAIL, "SDstart");
+
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fcomp, "CompDataSet6", nt, 2, dimsize);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to create a new data set for compression testing\n");
+        num_errs++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+    status = SDsetcompress(newsds,COMP_CODE_NONE,&cinfo);
+    CHECK(status, FAIL, "SDcompress");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Read the compressed data back in.
+     */
+    fcomp = SDstart(COMPFILE6, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    /*
+     * Retrieve and verify the compression info - bug# 307, 9/7/01 - BMR
+     */
+#ifndef H4_NO_DEPRECATED_SYMBOLS /* Jan 9, 2013 */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompress(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompress");
+    VERIFY(comp_type, COMP_CODE_NONE, "SDgetcompress");
+#endif /* H4_NO_DEPRECATED_SYMBOLS */
+
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompinfo(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_NONE, "SDgetcompinfo");
+
+    /* Only get the compression method and verify it */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds2, &comp_type);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_NONE, "SDgetcompinfo");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(idata[i] != rdata[i]) {
+            fprintf(stderr,"Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Writing 7th compressed dataset, deflate encoding.
+     */
+    fcomp = SDstart(COMPFILE7, DFACC_CREATE);
+    CHECK(fcomp, FAIL, "SDstart");
+
+    nt = DFNT_INT32;
+    dimsize[0] = 5;
+    dimsize[1] = 5;
+    newsds = SDcreate(fcomp, "CompDataSet7", nt, 2, dimsize);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to create a new data set for compression testing\n");
+        num_errs++;
+    }
+
+    for(i = 0; i < 25; i++)
+        idata[i] = i*10;
+
+    cinfo.deflate.level=6;
+    status = SDsetcompress(newsds,COMP_CODE_DEFLATE,&cinfo);
+    CHECK(status, FAIL, "SDcompress");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDwritedata(newsds, start, NULL, end, (VOIDP) idata);
+    CHECK(status, FAIL, "SDwritedata");
+
+    status = SDendaccess(newsds);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* need to close to flush compressed info to file */
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Read the compressed data back in.
+     */
+    fcomp = SDstart(COMPFILE7, DFACC_RDWR);
+    CHECK(fcomp, FAIL, "SDstart (again)");
+
+    newsds2 = SDselect(fcomp, 0);
+    if(newsds == FAIL) {
+        fprintf(stderr, "Failed to select a data set for compressed access\n");
+        num_errs++;
+    }
+
+    /*
+     * Retrieve and verify the compression info - bug# 307, 9/7/01 - BMR
+     */
+#ifndef H4_NO_DEPRECATED_SYMBOLS /* Jan 9, 2013 */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompress(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompress");
+    VERIFY(comp_type, COMP_CODE_DEFLATE, "SDgetcompress");
+    VERIFY(cinfo.deflate.level, 6, "SDgetcompress");
+#endif /* H4_NO_DEPRECATED_SYMBOLS */
+
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+    status = SDgetcompinfo(newsds2, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_DEFLATE, "SDgetcompinfo");
+    VERIFY(cinfo.deflate.level, 6, "SDgetcompinfo");
+
+    /* Only get the compression method and verify it */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(newsds2, &comp_type);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_DEFLATE, "SDgetcompinfo");
+
+    start[0] = start[1] = 0;
+    end[0]   = end[1]   = 5;
+    status = SDreaddata(newsds2, start, NULL, end, (VOIDP) rdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for(i = 0; i < 25; i++)
+        if(idata[i] != rdata[i]) {
+            fprintf(stderr,"Bogus val in loc %d in compressed dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]);
+            num_errs++;
+        }
+
+    status = SDendaccess(newsds2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fcomp);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+
+}   /* end test_compressed_data */
+
+extern int
+test_compression()
+{
+    intn num_errs = 0;         /* number of errors */
+
+    /* Output message about test being performed */
+    TESTING("create/read/write compressed datasets (tcomp.c)");
+
+    /* create various data sets with different compression methods */
+    num_errs = num_errs + test_various_comps();
+
+    /* test writing and reading data sets with compression */
+    num_errs = num_errs + test_compressed_data();
+
+    if (num_errs == 0)
+        PASSED();
+
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/tcoordvar.c b/mfhdf/test/tcoordvar.c
new file mode 100644
index 0000000..89f76ad
--- /dev/null
+++ b/mfhdf/test/tcoordvar.c
@@ -0,0 +1,654 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tcoordvar.c - tests some aspects of coordinate variables
+ * Structure of the file:
+ *    test_coordvar - test driver
+ *	  test_dim1_SDS1 - tests that data is not corrupted when the
+ *		dimension of SDS #1 is named the same as that of SDS #1.
+ *		(previous bug: writing to the dimension would corrupt the SDS) 
+ *
+ *	  test_dim1_SDS2 - tests that data is not corrupted when the
+ *		dimension of SDS #1 is named the same as that of SDS #2.
+ *		(previous bug: writing to the SDS #2 would corrupt the 
+ *		 dimension)
+ *
+ *	  test_named_vars - tests that all variables of a given name are 
+ *		account for.
+ *		(problem: SDnametoindex only returns the first SDS of the
+ *		inquired name.  Two new APIs provide number of all variables
+ *		of the same name and retrieve a list of indices of the
+ *		named variables.)
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+/********************************************************************
+   Name: test_dim1_SDS1() - tests that data is not corrupted when a 
+			dimension is named the same as its SDS.
+
+   Description:
+	In the past, naming a dimension the same as its SD and writing
+	dimension scale to it will corrupt the SDS' data.  This routine 
+	tests the provided fix (bugzilla 624) for this situation.
+
+        The main contents are listed below.  Note that when a function name
+	appears in the parentheses, it indicates that the associate step 
+	specificly tests the changes made to that function.
+
+	- create a one-dim SDS, named VAR1_NAME
+	- name its dimension VAR1_NAME
+	- get file information and verify that there is only 1 variable, 
+	  dataset VAR1_NAME
+	- set attribute to dimension "Variable 1" (SDsetattr)
+	- set attribute to SDS "Variable 1" (SDsetattr)
+	- get file information and verify that there are 2 variable, 
+	  dataset VAR1_NAME and coordinate variable VAR1_NAME
+	- write data to the SDS
+	- close all and reopen the file
+	- open dataset "Variable 1" (SDnametoindex)
+	- verify that this variable is not a coordinate variable (SDiscoordvar)
+	- read and verify its attribute information and values
+	- get access to the dataset's first dimension
+	- read and verify its attribute information and values
+	- read data and verify that the data is not corrupted
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - May 18, 2007
+*********************************************************************/
+
+#define VAR1_NAME	"Variable 1"
+#define ATTR1_NAME	"Attribute Dimension 1"
+#define ATTR2_NAME	"Attribute SDS 1"
+#define ATTR1_VAL	"This is a coord var"
+#define ATTR2_VAL	"This is not a coord var"
+#define ATTR1_LEN	19
+#define ATTR2_LEN	23
+#define FILE1		"sds1_dim1_samename.hdf"
+
+static intn test_dim1_SDS1(void)
+{
+    char  sds_name[20];
+    float32 sds1_data[] = {0.1, 2.3, 4.5, 6.7, 8.9};
+    float32 out_data[5];
+    int32 dimsize[1];
+    int32 sds_id, file_id, dim_id, index;
+    int32 start=0, stride=1;
+    int32 scale1 [5] = {101,102,103,104,105}, scale1_out[5];
+    int32 num_type, array_rank, count;
+    int32 n_datasets, n_file_attrs, n_local_attrs, n_vars = 0;
+    intn  datanum, ranknum, status =0, i, idx, idx1, idx2;
+    hdf_varlist_t* var_list;
+    intn  is_coord = FALSE;
+    char  attr_name[H4_MAX_NC_NAME], attr_values[80];
+    intn  num_errs = 0;         /* number of errors so far */
+
+    file_id = SDstart(FILE1, DFACC_CREATE);
+    CHECK(file_id, FAIL, "SDstart");
+
+    /* Create a one-dim dataset named VAR1_NAME, of type DFNT_FLOAT32. */
+    dimsize[0] = 5;
+    sds_id = SDcreate(file_id, VAR1_NAME, DFNT_FLOAT32, 1, dimsize);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Set the dimension name to be the same as its dataset. */
+    dim_id = SDgetdimid(sds_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+    status = SDsetdimname(dim_id, VAR1_NAME);
+     /* status = SDsetdimname(dim_id, VAR1_NAME);
+ */ 
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Get file info and verify that there is 1 dataset in the file. */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 1, "SDfileinfo");
+
+    /* Set an attribute to dimension VAR1_NAME. */
+    status = SDsetattr(dim_id, ATTR1_NAME, DFNT_CHAR8, ATTR1_LEN, ATTR1_VAL);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Set an attribute to dataset VAR1_NAME. */
+    status = SDsetattr(sds_id, ATTR2_NAME, DFNT_CHAR8, ATTR2_LEN, ATTR2_VAL);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Get file info and verify that there are 2 datasets in the file:
+       1 SDS and 1 coordinate variable (because of SDsetattr dim) */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 2, "SDfileinfo");
+
+    /* Write data to the SDS */
+    status = SDwritedata(sds_id, &start, &stride, dimsize, (VOIDP)sds1_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Close dataset and file. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Open the file again to check its data */
+    file_id = SDstart(FILE1, DFACC_RDWR);
+    CHECK(file_id, FAIL, "SDstart");
+
+    /* Check variable type and attributes of each element in the file */
+
+    /* Get the number of variables of name VAR1_NAME */
+    status = SDgetnumvars_byname(file_id, VAR1_NAME, &n_vars);
+
+    if (n_vars == 1)
+    {
+	/* Get index of dataset VAR1_NAME */
+	index = SDnametoindex(file_id, VAR1_NAME);
+	CHECK(index, FAIL, "SDnametoindex");
+    }
+    else
+    {
+	/* Get the list of all variables of named VAR1_NAME */
+	var_list = (hdf_varlist_t *)HDmalloc(n_vars * sizeof(hdf_varlist_t));
+	status = SDnametoindices(file_id, VAR1_NAME, var_list);
+
+	/* In this case, the first variable is a dataset */
+	for (idx = 0; idx < n_vars; idx++)
+	{
+	    if (var_list[idx].var_type == IS_SDSVAR)
+	    {
+		index = var_list[idx].var_index;
+		VERIFY(index, 0, "SDnametoindices");
+	    }
+	}
+    }
+
+    sds_id = SDselect(file_id, index);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /* Verify that this variable is a dataset. */
+    is_coord = SDiscoordvar(sds_id);
+    VERIFY(is_coord, FALSE, "SDiscoordvar");
+
+    /* Read and verify the information of the SDS' first attribute. */
+    status = SDattrinfo(sds_id, 0, attr_name, &num_type, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+    VERIFY(count, ATTR2_LEN, "SDattrinfo");
+    VERIFY(HDstrncmp(attr_name, ATTR2_NAME, 14), 0, "SDattrinfo");
+
+    /* Read and verify the values of the SDS' first attribute. */
+    status = SDreadattr(sds_id, 0, attr_values);
+    CHECK(status, FAIL, "SDreadattr");
+
+    if (HDstrncmp(attr_values, ATTR2_VAL, ATTR2_LEN) != 0)
+    {
+	fprintf(stderr, "Unmatched attribute values for SDS %s: is <%s>, should be <%s>\n", VAR1_NAME, attr_values, ATTR2_VAL);
+	num_errs++;
+    }
+
+    /* Get access to the SDS' first dimension. */
+    dim_id = SDgetdimid(sds_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+
+    /* Read and verify the information of the dimension's first attribute. */
+    status = SDattrinfo(dim_id, 0, attr_name, &num_type, &count);
+    CHECK(status, FAIL, "SDattrinfo");
+    VERIFY(count, 19, "SDattrinfo");
+    VERIFY(HDstrncmp(attr_name, ATTR1_NAME, 21), 0, "SDattrinfo");
+
+    /* Read and verify the values of the dimension's first attribute. */
+    status = SDreadattr(dim_id, 0, attr_values);
+    CHECK(status, FAIL, "SDreadattr");
+
+    if (HDstrncmp(attr_values, ATTR1_VAL, ATTR1_LEN) != 0)
+    {
+	fprintf(stderr, "Unmatched attribute values for dimension %s: is <%s>, should be <%s>\n", VAR1_NAME, attr_values, ATTR1_VAL);
+	num_errs++;
+    }
+
+    /* Verify again that the number of datasets in the file is 2, 1 SDS and
+       1 coordinate variable */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 2, "SDfileinfo");
+    VERIFY(n_file_attrs, 0, "SDfileinfo");
+
+    /* Read and verify the dataset's data */
+    status = SDreaddata (sds_id, &start, NULL, dimsize, &out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for (idx1 = 0; idx1 < dimsize[0]; idx1++)
+        if (out_data[idx1] != sds1_data[idx1])
+	{
+	    fprintf(stderr, "Read value (%f) differs from written (%f) at [%d]\n", out_data[idx1], idx1);
+		num_errs++;
+	}
+
+    /* Close dataset and file. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_dim1_SDS1 */
+
+
+/********************************************************************
+   Name: test_dim1_SDS2() - tests that data is not corrupted when a 
+			dimension is named the same as that of another SDS.
+
+   Description:
+	In the past, naming a dimension the same as an SDS and writing
+	dimension scale to it will corrupt the SDS' data.  This routine 
+	tests the provided fix (bugzilla 624) for this situation.
+
+        The main contents are listed below.  Note that when a function name
+	appears in the parentheses, it indicates that the associate step 
+	specificly tests the changes made to that function.
+
+	- create a one-dim SDS, named "Variable 1"
+	- name its dimension "Variable 2"
+	- create a two-dim SDS, named "Variable 2", and write data to it
+	- set dimension scale to dimension "Variable 2" (SDsetdimscale)
+	- write data to dataset "Variable 1"
+	- close all and reopen the file
+	- open dataset "Variable 1" (SDnametoindex)
+	- get/verify the first dimension's scales of SDS (SDgetdimscale)
+	- open dataset "Variable 2" (SDnametoindex)
+	- read data and verify that the data is not corrupted
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - May 18, 2007
+*********************************************************************/
+
+#define VAR1_NAME "Variable 1"
+#define VAR2_NAME "Variable 2"
+#define FILE2 "sds2_dim1_samename.hdf"
+
+static intn test_dim1_SDS2(void)
+{
+    char  sds_name[20];
+    float32 sds1_data[] = {0.1, 2.3, 4.5, 6.7, 8.9};
+    float32 sds2_data[2][3] = {{0.1, 2.3, 4.5}, {4.5, 6.7, 8.9}};
+    int32 dimsize[1], dimsize2[2];
+    int32 sds1_id, sds2_id, file_id, dim_id, index;
+    int32 start=0, stride=1, stat;
+    int32 start2[2]={0,0}, stride2[2]={1,1};
+    int32 scale1 [5] = {101,102,103,104,105}, scale1_out[5];
+    int32 num_type, array_rank, attributes;
+    int32 n_datasets, n_file_attrs, n_local_attrs;
+    float32 out_data2[2][3];
+    intn  datanum, ranknum, status =0, i, idx, idx1, idx2;
+    intn  num_errs = 0;         /* number of errors so far */
+
+    file_id = SDstart(FILE2, DFACC_CREATE);
+    CHECK(file_id, FAIL, "SDstart");
+
+    dimsize[0] = 5;
+    dimsize2[0] = 2;
+    dimsize2[1] = 3;
+    sds1_id = SDcreate(file_id, VAR1_NAME, DFNT_FLOAT32, 1, dimsize);
+    CHECK(sds1_id, FAIL, "SDcreate");
+
+    /* Set the dimension name to be the same as the next dataset (not 
+       created yet) */
+    dim_id = SDgetdimid(sds1_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+
+    status = SDsetdimname(dim_id, VAR2_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Get file info and verify that there is 1 dataset in the file */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 1, "SDfileinfo");
+
+    /* Create and write data to the second dataset VAR2_NAME */
+    sds2_id = SDcreate(file_id, VAR2_NAME, DFNT_FLOAT32, 2, dimsize2);
+    CHECK(sds2_id, FAIL, "SDcreate");
+
+    stat = SDwritedata(sds2_id, start2, stride2, dimsize2, sds2_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    status = SDendaccess(sds2_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Get file info and verify that there are 2 datasets in the file. */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 2, "SDfileinfo");
+
+    /* Write values to the dimension VAR2_NAME (same name as VAR2_NAME) */
+    status = SDsetdimscale (dim_id, dimsize[0], DFNT_INT32, scale1);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /* Get file info and verify that there are 3 datasets in the file:
+       2 SDS and 1 coordinate variable */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 3, "SDfileinfo");
+
+    /* Close dataset and file */
+    status = SDendaccess(sds1_id);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Open the file again to check its data */
+    file_id = SDstart(FILE2, DFACC_RDWR);
+    CHECK(file_id, FAIL, "SDstart");
+
+    /* Verify dimension scale of the first dimension of SDS VAR1_NAME */
+
+    /* Get access to dataset VAR1_NAME */
+    index = SDnametoindex(file_id, VAR1_NAME);
+    CHECK(index, FAIL, "SDnametoindex");
+
+    sds1_id = SDselect(file_id, index);
+    CHECK(sds1_id, FAIL, "SDselect");
+
+    /* Get access to its first dimension */
+    dim_id = SDgetdimid(sds1_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+
+    /* Get dimension scale and verify the values */
+    status = SDgetdimscale (dim_id, scale1_out);
+    CHECK(status, FAIL, "SDgetdimscale");
+
+    for (idx = 0; idx < dimsize[0]; idx++)
+        if (scale1_out[idx] != scale1[idx])
+	{
+	    fprintf(stderr, "Read value (%d) differs from written (%d) at [%d]\n", scale1_out[idx], scale1[idx], idx);
+	    num_errs++;
+	}
+    /* End verifying dimension scale */
+
+    /* Verify dimension scale of the first dimension of SDS VAR1_NAME */
+
+    /* Get access to dataset VAR2_NAME */
+    index = SDnametoindex(file_id, VAR2_NAME);
+    CHECK(index, FAIL, "SDnametoindex");
+
+    sds2_id = SDselect(file_id, index);
+    CHECK(sds2_id, FAIL, "SDselect");
+
+    /* Get dataset's info and verify them */
+    status = SDgetinfo(sds2_id, sds_name, &array_rank, dimsize2,
+                                        &num_type, &n_local_attrs);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(array_rank, 2, "SDfileinfo");
+    VERIFY(num_type, DFNT_FLOAT32, "SDfileinfo");
+    VERIFY(n_local_attrs, 0, "SDfileinfo");
+
+    /* Read and verify the dataset's data */
+    status = SDreaddata (sds2_id, start2, NULL, dimsize2, &out_data2);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for (idx1 = 0; idx1 < dimsize2[0]; idx1++)
+	for (idx2 = 0; idx2 < dimsize2[1]; idx2++)
+	{
+            if (out_data2[idx1][idx2] != sds2_data[idx1][idx2])
+	    {
+		fprintf(stderr, "Read value (%f) differs from written (%f) at [%d][%d]\n", out_data2[idx1][idx2], sds2_data[idx1][idx2], idx1, idx2);
+		num_errs++;
+	    }
+	}
+
+    /* Verify again that the number of datasets in the file is 3, 2 SDSs and
+       1 coordinate variable */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 3, "SDfileinfo");
+
+    status = SDendaccess(sds1_id);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(sds2_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_dim1_SDS2 */
+
+
+/********************************************************************
+   Name: test_named_vars() - tests that data is not corrupted when a 
+			dimension is named the same as that of another SDS.
+
+   Description:
+	In the past, SDnametoindex returns the index of the first variable
+	of the inquired name although there might be more than one variable
+	having such name.  After the fix of bugzilla 624, SDnametoindex was
+	modified to return the first SDS variable of the given name if the 
+	name is not unique.  Two new APIs, SDgetnumvars_byname and 
+	SDnametoindices, will provide the number of variables of a given
+	name, and a list of indices for those variables.  This test will
+	concentrate on these new APIs.
+
+        The main contents are listed below:
+
+	- create two two-dim SDS, named "Common Name"  <- 2 "Common Name"s
+	- create a one-dim SDS, named "One Dimension"  <- 1 "One Dimension"
+	- name its dimension "Common Name"  <- still 2 "Common Name"s
+	- set dimension scale to dimension "Common Name"  <- 3 "Common Name"s
+	- create a one-dim SDS, named "One Dimension"  <- 2 "One Dimension"s
+	- name its dimension "Another Name"
+	- create a one-dim SDS, named "Another Name"  <- still 1 "Another Name"s
+	- set attribute to dimension "Another Name"  <- 2 "Another Name"s
+	- close all and reopen the file
+	- open dataset "Common Name" (SDnametoindex)
+	- this will have two dimensions
+	- get number of variables of name "Common Name" and verify that it's 3
+	- get the list of indices of "Common Name" and it should be
+		[0, IS_SDSVAR], [1, IS_SDSVAR], [3, IS_CRDVAR]
+	- get number of variables of name "Another Name" and verify that it's 2
+	- get the list of indices of "Another Name" and it should be
+		[5, IS_SDSVAR], [6, IS_CRDVAR]
+	- get/verify the dimension scales of dimension "Common Name"
+	- get/verify the attribute value of dimension "Another Name"
+
+        The file contains these items:
+        Index   Var Type	Name	Dimensions
+          0     SDS             "Common Name"   2-dim
+          1     SDS             "Common Name"   2-dim
+          2     SDS             "One Dimension" 1-dim
+          3     Coordinate      "Common Name"   1-dim
+          4     SDS             "One Dimension" 1-dim
+          5     SDS             "Another Name"  1-dim
+          6     Coordinate      "Another Name"  1-dim
+
+        If someone changes the file contents in this test, please update
+        this table appropriately.
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 30, 2007
+*********************************************************************/
+
+#define COMMON_NAME "Common Name"
+#define ONEDIM_NAME "One Dimension"
+#define ANOTHER_NAME "Another Name"
+#define FILE3 "vars_samename.hdf"
+
+static intn test_named_vars(void)
+{
+    char  sds_name[20];
+    float32 sds1_data[] = {0.1, 2.3, 4.5, 6.7, 8.9};
+    float32 sds2_data[2][3] = {{0.1, 2.3, 4.5}, {4.5, 6.7, 8.9}};
+    int32 dimsize[1], dimsize2[2];
+    int32 sds_id, sds1_id, sds2_id, sds3_id, sds4_id, sds5_id;
+    int32 file_id, dim_id, index;
+    int32 start=0, stride=1, stat;
+    int32 start2[2]={0,0}, stride2[2]={1,1};
+    int32 scale1 [5] = {101,102,103,104,105}, scale1_out[5];
+    int32 array_rank;
+    int32 n_datasets, n_file_attrs, n_local_attrs, n_vars=0;
+    float32 out_data2[2][3];
+    intn  datanum, ranknum, status =0, idx, idx1, idx2;
+    intn  is_coordvar=FALSE;
+    hdf_varlist_t *allvars, *varlistp;
+    intn  num_errs = 0;         /* number of errors so far */
+    char  line[40];
+    char  contents[7][40]={
+          "#0 SDS        2-dim 'Common Name'",
+          "#1 SDS        2-dim 'Common Name'",
+          "#2 SDS        1-dim 'One Dimension'",
+          "#3 Coordinate 1-dim 'Common Name'",
+          "#4 SDS        1-dim 'One Dimension'",
+          "#5 SDS        1-dim 'Another Name'",
+          "#6 Coordinate 1-dim 'Another Name'"};
+
+    file_id = SDstart(FILE3, DFACC_CREATE);
+    CHECK(file_id, FAIL, "SDstart");
+
+    dimsize2[0] = 2;
+    dimsize2[1] = 3;
+
+    /* Create first COMMON_NAME data set. */
+    sds1_id = SDcreate(file_id, COMMON_NAME, DFNT_FLOAT32, 2, dimsize2);
+    CHECK(sds1_id, FAIL, "SDcreate");
+    status = SDendaccess(sds1_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Create second COMMON_NAME data set. */
+    sds2_id = SDcreate(file_id, COMMON_NAME, DFNT_FLOAT32, 2, dimsize2);
+    CHECK(sds2_id, FAIL, "SDcreate");
+    status = SDendaccess(sds2_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    dimsize[0] = 5;
+    sds3_id = SDcreate(file_id, ONEDIM_NAME, DFNT_FLOAT32, 1, dimsize);
+    CHECK(sds3_id, FAIL, "SDcreate");
+
+    /* Set the dimension name to be the same as the previous 2 datasets */
+    dim_id = SDgetdimid(sds3_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+    status = SDsetdimname(dim_id, COMMON_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Get file info and verify that there are 3 datasets in the file */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 3, "SDfileinfo");
+
+    /* Write values to the dimension COMMON_NAME (same name as first 2 datasets) */
+    status = SDsetdimscale (dim_id, dimsize[0], DFNT_INT32, scale1);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /* Get file info and verify that there are 4 datasets in the file */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 4, "SDfileinfo");
+
+    dimsize[0] = 8;
+    sds4_id = SDcreate(file_id, ONEDIM_NAME, DFNT_FLOAT32, 1, dimsize);
+    CHECK(sds4_id, FAIL, "SDcreate");
+
+    /* Set the dimension name to be the same as the previous 2 datasets */
+    dim_id = SDgetdimid(sds4_id, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+    status = SDsetdimname(dim_id, ANOTHER_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    sds5_id = SDcreate(file_id, ANOTHER_NAME, DFNT_FLOAT32, 1, dimsize);
+    CHECK(sds5_id, FAIL, "SDcreate");
+
+    /* Get file info and verify that there are 6 datasets in the file */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 6, "SDfileinfo");
+
+    status = SDsetattr(dim_id, ATTR1_NAME, DFNT_CHAR8, ATTR1_LEN, ATTR1_VAL);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Get file info and verify that there are 7 datasets in the file */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 7, "SDfileinfo");
+
+    /* Verify again that the number of datasets in the file is 7 */
+    status = SDfileinfo(file_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_datasets, 7, "SDfileinfo");
+
+    /* There are 3 variables of name COMMON_NAME */
+    status = SDgetnumvars_byname(file_id, COMMON_NAME, &n_vars);
+    CHECK(status, FAIL, "SDfileinfo");
+    VERIFY(n_vars, 3, "SDfileinfo");
+
+    allvars = (hdf_varlist_t *)HDmalloc(n_vars * sizeof(hdf_varlist_t));
+    status = SDnametoindices(file_id, COMMON_NAME, allvars);
+    CHECK(status, FAIL, "SDfileinfo");
+
+    /* Compare file contents with predefined text to verify */
+    for (idx = 0; idx < n_datasets; idx++)
+    {
+
+	sds_id = SDselect(file_id, idx);
+	CHECK(sds_id, FAIL, "SDselect");
+	status = SDgetinfo(sds_id, sds_name, &array_rank, NULL, NULL, NULL);
+	CHECK(status, FAIL, "SDgetinfo");
+	is_coordvar = SDiscoordvar(sds_id);
+	if (is_coordvar)
+	    sprintf(line,"#%d Coordinate %d-dim '%s'\n", idx, array_rank, 
+								sds_name);
+	else
+	    sprintf(line,"#%d SDS        %d-dim '%s'\n", idx, array_rank, 
+								sds_name);
+
+	if (strncmp(contents[idx], line, strlen(contents[idx])) != 0)
+	{
+	    fprintf(stderr, "File contents are incorrect in testing variable types at variable of index %d\n", idx);
+	}
+    }
+
+    status = SDend(file_id); 
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_named_vars */
+
+/* Test driver for testing various coordinate variable features. */
+extern int
+test_coordvar()
+{
+    intn num_errs = 0;         /* number of errors */
+
+    /* Output message about test being performed */
+    TESTING("various coordinate variable features (tcoordvar.c)");
+
+    /* test when a dimension being named the same as an SDS */
+    num_errs = num_errs + test_dim1_SDS1();
+    num_errs = num_errs + test_dim1_SDS2();
+    num_errs = num_errs + test_named_vars();
+
+    if (num_errs == 0)
+        PASSED();
+
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/tdatainfo.c b/mfhdf/test/tdatainfo.c
new file mode 100644
index 0000000..50bfd11
--- /dev/null
+++ b/mfhdf/test/tdatainfo.c
@@ -0,0 +1,1783 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tdatainfo.c - tests the function SDgetdatainfo.
+ * Structure of the file:
+ *    test_datainfo - test driver
+ *  test_nonspecial_SDSs - tests nonspecial SDSs
+ *  test_compressed_SDSs - tests compressed SDSs without closing file
+ *  test_empty_SDSs      - tests on empty chunked and chunked/comp SDSs
+ *  test_chunked_partial - tests on chunked and partially written SDS
+ *  test_chkcmp_SDSs     - tests chunked/compressed SDSs
+ *  test_extend_SDSs     - tests SDSs with unlimited dimensions
+ * -BMR, Jul 2010
+ ****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef H4_HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef H4_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#include <fcntl.h>
+#include <math.h>
+#ifdef H4_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if WIN32
+#define snprintf sprintf_s
+#define ssize_t int32
+#endif 
+
+#ifndef DATAINFO_TESTER
+#define DATAINFO_TESTER /* to include mfdatainfo.h */
+#endif
+
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+
+#include "hdftest.h"
+
+static intn test_nonspecial_SDSs();
+static intn test_compressed_SDSs();
+static intn test_empty_SDSs();
+static intn test_chunked_partial();
+static intn test_chkcmp_SDSs();
+static intn test_extend_SDSs();
+
+#define SIMPLE_FILE     "datainfo_simple.hdf"  /* data file */
+#define X_LENGTH      10
+#define Y_LENGTH      10
+#define RANK          2
+
+typedef struct {
+    int32 numtype; /* number type of the SDS' data */
+    int32 n_values; /* number of values the SDS can hold */
+    int32* offsets; /* offset(s) of data block(s) */
+    int32* lengths; /* length(s) of data block(s) */
+    int32* dimsizes;/* sizes of dimensions */
+} t_hdf_datainfo_t;
+
+/* alloc_info is a utility function that allocates hdf_datainfo_t's members*/
+intn alloc_info(t_hdf_datainfo_t *info, uintn info_count, int32 n_dims) {
+    HDmemset(info, 0, sizeof(info));
+    info->offsets = (int32 *) HDmalloc(info_count * sizeof(int32));
+    if (info->offsets == NULL)
+        return -1;
+    info->lengths = (int32 *) HDmalloc(info_count * sizeof(int32));
+    if (info->lengths == NULL)
+        return -1;
+    info->dimsizes = (int32 *) HDmalloc(n_dims * sizeof(int32));
+    if (info->dimsizes == NULL)
+        return -1;
+    return 0;
+}
+
+void free_info(t_hdf_datainfo_t *info) {
+    if (info != NULL) {
+        if (info->offsets != NULL)
+            HDfree(info->offsets);
+        if (info->lengths != NULL)
+            HDfree(info->lengths);
+        if (info->dimsizes != NULL)
+            HDfree(info->dimsizes);
+    }
+}
+
+/* This is used to temporarily verify results.  Will remove when finallized. */
+static void print_info(char* name, uintn info_count, t_hdf_datainfo_t data_info) {
+    int ii;
+
+    fprintf(stderr, "offset/length of '%s'\n", name);
+    for (ii = 0; ii < info_count; ii++)
+        fprintf(stderr, "%d: %d   %d\n", ii, data_info.offsets[ii],
+                data_info.lengths[ii]);
+}
+
+/* Calculates the number of values in an SDS using the dimensions and rank */
+static int32 comp_n_values(int32 rank, int32 *dimsizes) {
+    int ii;
+    int32 n_values = 1;
+    for (ii = 0; ii < rank; ii++)
+        n_values = n_values * dimsizes[ii];
+    return (n_values);
+}
+
+/****************************************************************************
+ Name: test_nonspecial_SDSs() - tests non-special SDSs
+
+ Description:
+ This routine creates and writes data to non-special SDSs and verifies
+ data and data information with SDgetdatainfo.  The tests include
+ the following SDSs:
+ - a 2-dim 5x8 element SDS, float32, with no data
+ - a 1-dim 10-element SDS, int32, with 10 values
+ - a 2-dim 5x8 element SDS, float32, with 5x8 values
+ - a 1-dim 20-element SDS, char, with 20 values
+ SDgetdatainfo will retrieve the number of blocks in the datasets
+ and the offsets and lengths of the blocks.  Then the data will be read
+ back from the file at the previously retrieved offsets/lengths, without
+ the use of the HDF4 library, and will be verified against the original
+ data buffers.
+
+ BMR - Jul 2010
+ ****************************************************************************/
+#define SDS1_NAME  "Simple_data_1dim_int32"
+#define SDS2_NAME  "Simple_data_2dims_float32"
+#define SDS3_NAME  "Simple_data_1dim_char"
+#define RANK1    1
+#define RANK2    2
+#define LENGTH1_X  10
+#define LENGTH2_X  5
+#define LENGTH2_Y  8
+#define LENGTH3_X  21
+
+static intn test_nonspecial_SDSs() {
+    int32 sd_id, sds_id;
+    int32 dimsizes[2], starts[2], edges[2], rank = 0;
+    int32 data1[LENGTH1_X];
+    float data2[LENGTH2_X][LENGTH2_Y];
+    char data3[LENGTH3_X], outdata3[LENGTH3_X];
+    int32 offset1, length1, offset2, length2, offset3, length3;
+    t_hdf_datainfo_t sds1_info, sds2_info, sds3_info;
+    uintn info_count = 0;
+    intn status;
+    int ii, jj;
+    intn num_errs = 0; /* number of errors so far */
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(SIMPLE_FILE, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "test_nonspecial_SDSs: SDstart");
+
+    /***************************************************************
+     Create and write non-special SDSs
+     ***************************************************************/
+
+    /* Create a 2x2 dataset called "EmptyDataset" */
+    dimsizes[0] = LENGTH2_X;
+    dimsizes[1] = LENGTH2_Y;
+    sds_id = SDcreate(sd_id, "EmptyDataset", DFNT_FLOAT32, 2, dimsizes);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /* Open that first dataset and verify that number of data block is 0 */
+    sds_id = SDselect(sd_id, 0);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDselect");
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_nonspecial_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 0, "test_nonspecial_SDSs: SDgetdatainfo");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /*
+     * Create a 1-dim 10-element SDS, type int32, then write 10 values
+     * to it
+     */
+    dimsizes[0] = LENGTH1_X;
+    sds_id = SDcreate(sd_id, SDS1_NAME, DFNT_INT32, RANK1, dimsizes);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate");
+
+    for (ii = 0; ii < LENGTH1_X; ii++)
+        data1[ii] = 1000 * ii;
+
+    starts[0] = 0;
+    edges[0] = LENGTH1_X;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data1);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDwritedata");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /* 
+     * Create a 2-dim 5x8 element SDS, type float32, then write 5x8 values
+     * to it
+     */
+    dimsizes[0] = LENGTH2_X;
+    dimsizes[1] = LENGTH2_Y;
+    sds_id = SDcreate(sd_id, SDS2_NAME, DFNT_FLOAT32, RANK2, dimsizes);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate");
+
+    for (ii = 0; ii < LENGTH2_X; ii++)
+        for (jj = 0; jj < LENGTH2_Y; jj++)
+            data2[ii][jj] = 500.50 * (ii + jj);
+
+    starts[0] = 0;
+    starts[1] = 0;
+    edges[0] = LENGTH2_X;
+    edges[1] = LENGTH2_Y;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data2);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDwritedata");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /* 
+     * Create a 1-dim 20-element SDS, type char, then write 20 values
+     * to it
+     */
+    dimsizes[0] = LENGTH3_X;
+    sds_id = SDcreate(sd_id, SDS3_NAME, DFNT_CHAR, RANK1, dimsizes);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate");
+
+    strcpy(data3, "The data of 3rd SDS.");
+
+    starts[0] = 0;
+    edges[0] = LENGTH3_X;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data3);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDwritedata");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /***********************************************************************
+     Read data info for later accessing data without the use of HDF4 library
+     ***********************************************************************/
+
+    /* Open the second dataset, verify that number of data block is 1, then
+     retrieve and record the offset/length */
+    sds_id = SDselect(sd_id, 1);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDselect SDS index 1");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_nonspecial_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_nonspecial_SDSs: SDgetdatainfo");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetinfo SDS index 1");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds1_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, &rank, sds1_info.dimsizes, &(sds1_info.numtype), NULL);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetinfo SDS index 1");
+
+    /* Record number of values the SDS can have */
+    sds1_info.n_values = comp_n_values(rank, sds1_info.dimsizes);
+
+    /* Retrieve the offset and length of the data block */
+    status = SDgetdatainfo(sds_id, NULL, 0, info_count, sds1_info.offsets, sds1_info.lengths);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetdatainfo");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /* Open the third dataset, verify that number of data block is 1, then
+     retrieve and record the offset/length */
+    sds_id = SDselect(sd_id, 2);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDselect SDS index 2");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_nonspecial_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_nonspecial_SDSs: SDgetdatainfo");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetinfo SDS index 1");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds2_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds2_info.dimsizes, &(sds2_info.numtype), NULL);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetinfo SDS index 2");
+
+    /* Record number of values the SDS can have */
+    sds2_info.n_values = comp_n_values(rank, sds2_info.dimsizes);
+
+    /* Retrieve the offset and length of the data block */
+    status = SDgetdatainfo(sds_id, NULL, 0, info_count, sds2_info.offsets, sds2_info.lengths);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetdatainfo");
+
+    /* Close SDS index 2 */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /* Open the last dataset, verify that number of data block is 1, then
+     retrieve and record the offset/length */
+    sds_id = SDselect(sd_id, 3);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDselect SDS index 3");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_nonspecial_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_nonspecial_SDSs: SDgetdatainfo");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetinfo SDS index 1");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds3_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds3_info.dimsizes, &(sds3_info.numtype), NULL);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetinfo SDS index 3");
+
+    /* Record number of values the SDS can have */
+    sds3_info.n_values = comp_n_values(rank, sds3_info.dimsizes);
+
+    /* Retrieve the offset and length of the data block */
+    status = SDgetdatainfo(sds_id, NULL, 0, info_count, sds3_info.offsets, sds3_info.lengths);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDgetdatainfo");
+
+    /* Close SDS index 3 */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDend");
+
+    /******************************************************************
+     Read data using previously obtained data info without HDF4 library
+     ******************************************************************/
+
+    /* Open file and read in data without using SD API */
+    {
+        int fd; /* for open */
+        int32 ret32; /* for DFKconvert */
+        int ret; /* for fabs */
+        ssize_t readlen = 0; /* for read */
+        int32 *readibuf, *readibuf_swapped;
+        float *readfbuf, *readfbuf_swapped;
+        char *readcbuf, *readcbuf_swapped;
+        char readfbuf_str[12], data2_str[12]; /* for comparing readfbuf values */
+        uint32 n_values;
+        int ii, jj, kk;
+
+        /* Open the file for reading without SD API */
+        fd = open(SIMPLE_FILE, O_RDONLY);
+        if (fd == -1) {
+            fprintf(stderr, "test_nonspecial_SDSs: unable to open file %s", SIMPLE_FILE);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Forward to the position of the data of SDS at index 1 */
+        if (lseek(fd, (off_t) sds1_info.offsets[0], SEEK_SET) == -1) {
+            fprintf(stderr, "test_nonspecial_SDSs: unable to seek offset %d\n",
+                    (int) sds1_info.offsets[0]);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds1_info.n_values * sizeof(int32));
+        readibuf_swapped = (int32 *) HDmalloc(sds1_info.n_values * sizeof(int32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP) readibuf, (size_t) sds1_info.lengths[0]);
+        CHECK(readlen, FAIL, "DFKconvert");
+
+        ret32 = DFKconvert(readibuf, readibuf_swapped, sds1_info.numtype,
+                           (uint32) sds1_info.n_values, DFACC_WRITE, 0, 0);
+        CHECK(ret32, FAIL, "DFKconvert");
+
+        if (ret32 > 0) {
+            /* Compare data read without SD API against the original buffer */
+            for (ii = 0; ii < sds1_info.n_values; ii++) {
+                if (readibuf_swapped[ii] != data1[ii])
+                    fprintf(stderr, "At value# %d: written = %d read = %d\n",
+                            ii, data1[ii], readibuf_swapped[ii]);
+            }
+        }
+        HDfree (readibuf_swapped);
+        HDfree (readibuf);
+
+        /* Forward to the position of the data of SDS at index 2 */
+        if (lseek(fd, (off_t) sds2_info.offsets[0], SEEK_SET) == -1) {
+            fprintf(stderr, "test_nonspecial_SDSs: unable to seek offset %d\n",
+                    (int) sds2_info.offsets[0]);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Allocate buffers for SDS' data */
+        readfbuf = (float32 *) HDmalloc(sds2_info.n_values * sizeof(float32));
+        readfbuf_swapped = (float32 *) HDmalloc(sds2_info.n_values * sizeof(float32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP) readfbuf, (size_t) sds2_info.lengths[0]);
+        CHECK(readlen, FAIL, "DFKconvert");
+
+        ret32 = DFKconvert(readfbuf, readfbuf_swapped, sds2_info.numtype,
+                           (uint32) sds2_info.n_values, DFACC_WRITE, 0, 0);
+        CHECK(ret32, FAIL, "DFKconvert");
+
+        /* Compare data read without SD API against the original buffer */
+        kk = 0;
+        for (jj = 0; jj < sds2_info.dimsizes[0]; jj++)
+            for (ii = 0; ii < sds2_info.dimsizes[1]; ii++) {
+                /* Flag if the two numbers are not close enough */
+                if (fabs(readfbuf_swapped[kk] - data2[jj][ii]) > 0.00001)
+                    fprintf(stderr, "At value# %d: written = %f read = %f\n",
+                            ii, data2[jj][ii], readfbuf_swapped[kk]);
+                if (kk < sds2_info.n_values)
+                    kk++;
+            }
+        HDfree (readfbuf_swapped);
+        HDfree (readfbuf);
+
+        /* Forward to the position of the data of SDS at index 3 */
+        if (lseek(fd, (off_t) sds3_info.offsets[0], SEEK_SET) == -1) {
+            fprintf(stderr, "test_nonspecial_SDSs: unable to seek offset %d\n",
+                    (int) sds3_info.offsets[0]);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds3_info.n_values * sizeof(int32));
+        readibuf_swapped = (int32 *) HDmalloc(sds3_info.n_values * sizeof(int32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP) readibuf, (size_t) sds3_info.lengths[0]);
+        CHECK(readlen, FAIL, "DFKconvert");
+
+        ret32 = DFKconvert(readibuf, readibuf_swapped, sds3_info.numtype,
+                           (uint32) sds3_info.n_values, DFACC_WRITE, 0, 0);
+        CHECK(ret32, FAIL, "DFKconvert");
+
+        if (ret32 > 0) {
+            /* Compare data read without SD API against the original buffer */
+            for (ii = 0; ii < sds3_info.n_values; ii++) {
+                if (readibuf_swapped[ii] != data3[ii])
+                    fprintf(stderr, "At value# %d: written = %d read = %d\n",
+                            ii, data3[ii], readibuf_swapped[ii]);
+            }
+        }
+        HDfree (readibuf_swapped);
+        HDfree (readibuf);
+
+        if (close(fd) == -1) {
+            fprintf(stderr, "test_nonspecial_SDSs: unable to close file %s", SIMPLE_FILE);
+            num_errs++;
+            return num_errs;
+        }
+    }
+    free_info(&sds1_info);
+    free_info(&sds2_info);
+    free_info(&sds3_info);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_nonspecial_SDSs */
+
+/****************************************************************************
+ Name: test_compressed_SDSs() - tests compressed SDSs
+
+ Description:
+ This routine creates and writes data to compressed SDSs and verifies
+ data and data information with SDgetdatainfo.  The tests include
+ the following SDSs:
+ - a 2-dim 5x8 element SDS, float32, NBIT compression, no data
+ - a 1-dim 10-element SDS, int32, Deflate compression, with 10 values
+ - a 2-dim 5x8 element SDS, float32, SZIP compression, with 5x8 values
+ - a 1-dim 20-element SDS, char, Skipping Huffman compression,
+ with 20 values
+
+ SDgetdatainfo will retrieve the number of blocks in the datasets
+ and the offsets and lengths of the blocks.  Then the data will be read
+ back from the file at the previously retrieved offsets/lengths, without
+ the use of the HDF4 library, and will be verified against the original
+ data buffers.
+
+ BMR - Jul 2010
+ ****************************************************************************/
+#define  COMP_FILE  "datainfo_cmp.hdf"  /* data file */
+static intn test_compressed_SDSs()
+{
+    int32 sd_id, sds_id, esds_id, usds_id;
+    int32 starts[2], edges[2], dimsizes[2], rank = 0;
+    comp_coder_t comp_type; /* Compression flag */
+    comp_info c_info; /* Compression structure */
+    int8 data[Y_LENGTH][X_LENGTH];
+    int32 data1[LENGTH1_X];
+    float data2[LENGTH2_X][LENGTH2_Y];
+    char data3[LENGTH3_X];
+    t_hdf_datainfo_t sds1_info, sds2_info, sds3_info;
+    int32 offset = 0, length = 0;
+    int32 pixels_per_scanline;
+    uintn info_count = 0;
+    intn status;
+    int ii, jj;
+    int num_errs = 0; /* number of errors so far */
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(COMP_FILE, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "test_compressed_SDSs: SDstart");
+
+    /***************************************************************
+     Create and write compressed SDSs
+     ***************************************************************/
+
+    /* Create data set 'NBit-No-Data' */
+    dimsizes[0] = LENGTH2_X;
+    dimsizes[1] = LENGTH2_Y;
+    sds_id = SDcreate(sd_id, "NBit-No-Data", DFNT_INT32, 2, dimsizes);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDcreate 'NBit-No-Data'");
+
+    /* Promote the data set 'NBit-No-Data' to an NBIT data set */
+    status = SDsetnbitdataset(sds_id, 6, 7, FALSE, FALSE);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDsetnbitdataset");
+
+    /* End access to 'NBit-No-Data' */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess");
+
+    /*
+     * Create a 1-dim 10-element SDS, type int32, set Deflate compression,
+     * then write 10 values to it
+     */
+    dimsizes[0] = LENGTH1_X;
+    sds_id = SDcreate(sd_id, "Deflate-Data", DFNT_INT32, RANK1, dimsizes);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDcreate 'Deflate-Data'");
+
+    comp_type = COMP_CODE_DEFLATE;
+    HDmemset(&c_info, 0, sizeof(c_info));
+    c_info.deflate.level = 6;
+    status = SDsetcompress(sds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDsetcompress 'Deflate-Data'");
+
+    for (ii = 0; ii < LENGTH1_X; ii++)
+        data1[ii] = 1000 * ii;
+
+    starts[0] = 0;
+    edges[0] = LENGTH1_X;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data1);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDwritedata 'Deflate-Data'");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess 'Deflate-Data'");
+
+    for (ii = 0; ii < LENGTH2_X; ii++)
+        for (jj = 0; jj < LENGTH2_Y; jj++)
+            data2[ii][jj] = 500.50 * (ii + jj);
+
+#ifdef H4_HAVE_SZIP_ENCODER
+    /* 
+     * Create a 2-dim 5x8 element SDS, type float32, set SZIP compression,
+     * then write 5x8 values to it
+     */
+    dimsizes[0] = LENGTH2_X;
+    dimsizes[1] = LENGTH2_Y;
+    sds_id = SDcreate(sd_id, "SZIP-Data", DFNT_FLOAT32, RANK2, dimsizes);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDcreate 'SZIP-Data'");
+
+    comp_type = COMP_CODE_SZIP;
+    HDmemset(&c_info, 0, sizeof(c_info));
+    pixels_per_scanline = dimsizes[1];
+    c_info.szip.pixels = dimsizes[0] * dimsizes[1];
+    ;
+    c_info.szip.pixels_per_block = 2;
+    if (pixels_per_scanline >= 2048)
+        c_info.szip.pixels_per_scanline = 512;
+    else
+        c_info.szip.pixels_per_scanline = dimsizes[1];
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 64;
+    status = SDsetcompress(sds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDsetcompress 'SZIP-Data'");
+
+    starts[0] = starts[1] = 0;
+    edges[0] = LENGTH2_X;
+    edges[1] = LENGTH2_Y;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data2);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDwritedata 'SZIP-Data'");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess 'SZIP-Data'");
+#else /* SZIP lib not available */
+    /* 
+     * Create a 2-dim 5x8 element SDS, type float32, set SZIP compression,
+     * then write 5x8 values to it
+     */
+    dimsizes[0] = LENGTH2_X;
+    dimsizes[1] = LENGTH2_Y;
+    sds_id = SDcreate (sd_id, "NBIT-Data", DFNT_FLOAT32, RANK2, dimsizes);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDcreate 'NBIT-Data'");
+
+    /* Promote the data set 'NBit-No-Data' to an NBIT data set */
+    status = SDsetnbitdataset(sds_id, 6, 7, FALSE, FALSE);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDsetnbitdataset");
+
+    /* Initialize data to write out */
+    /* for(ii = 0; ii < LENGTH2_X*LENGTH2_Y; ii++)
+     idata[ii] = ii*10;
+     */
+
+    /* Write data to the NBIT data set 'NBitDataSet' */
+    starts[0] = starts[1] = 0;
+    edges[0] = LENGTH2_X;
+    edges[1] = LENGTH2_Y;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP)data2);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDwritedata");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess 'SZIP-Data'");
+#endif /* SZIP lib available */
+
+    /* 
+     * Create a 1-dim 20-element SDS, type char, set Skipping Huffman
+     * compression, then write 20 values to it
+     */
+    dimsizes[0] = LENGTH3_X;
+    sds_id = SDcreate(sd_id, "SKPHUFF-Data", DFNT_CHAR, RANK1, dimsizes);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDcreate 'SKPHUFF-Data'");
+
+    HDmemset(&c_info, 0, sizeof(c_info));
+    comp_type = COMP_CODE_SKPHUFF;
+    c_info.skphuff.skp_size = 4;
+    status = SDsetcompress(sds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDsetcompress 'SKPHUFF-Data'");
+
+    strcpy(data3, "The data of 3rd SDS.");
+
+    starts[0] = 0;
+    edges[0] = LENGTH3_X;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data3);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDwritedata 'SKPHUFF-Data'");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess 'SKPHUFF-Data'");
+
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDend COMP_FILE");
+
+    /***********************************************************************
+     Read data info for later accessing data without the use of HDF4 library
+     ***********************************************************************/
+
+    /* Open the file to get data info of the SDSs */
+    sd_id = SDstart(COMP_FILE, DFACC_RDONLY);
+    CHECK(sd_id, FAIL, "test_compressed_SDSs: SDstart COMP_FILE");
+
+    /* Open the first dataset, verify that number of data block is 0, then
+     verify its compression type is NBIT */
+    sds_id = SDselect(sd_id, 0);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDselect SDS index 0");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_compressed_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 0, "test_compressed_SDSs: SDgetdatainfo");
+
+    comp_type = COMP_CODE_INVALID; /* reset variables before retrieving info */
+    status = SDgetcomptype(sds_id, &comp_type);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_NBIT, "test_compressed_SDSs: SDgetcomptype");
+
+    /* Open the second dataset, verify that number of data block is 1, verify
+     its comp type is Deflate, then retrieve and record the offset/length */
+    sds_id = SDselect(sd_id, 1);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDselect SDS index 1");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_compressed_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_compressed_SDSs: SDgetdatainfo");
+
+    comp_type = COMP_CODE_INVALID; /* reset variables before retrieving info */
+    status = SDgetcomptype(sds_id, &comp_type);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_DEFLATE, "test_compressed_SDSs: SDgetcomptype");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetinfo SDS index 1");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds1_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds1_info.dimsizes, &(sds1_info.numtype), NULL);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetinfo SDS index 1");
+
+    /* Record number of values the SDS can have */
+    sds1_info.n_values = comp_n_values(rank, sds1_info.dimsizes);
+
+    /* Retrieve the offset and length of the data block */
+    status = SDgetdatainfo(sds_id, NULL, 0, info_count, sds1_info.offsets, sds1_info.lengths);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetdatainfo");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess");
+
+    /* Open the third dataset, verify that number of data block is 1, verify its
+     comp type is SZIP or NBIT, then retrieve and record the offset/length */
+    sds_id = SDselect(sd_id, 2);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDselect SDS index 2");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_compressed_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_compressed_SDSs: SDgetdatainfo");
+
+    comp_type = COMP_CODE_INVALID; /* reset variables before retrieving info */
+    status = SDgetcomptype(sds_id, &comp_type);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetcomptype");
+#ifdef H4_HAVE_SZIP_ENCODER
+    VERIFY(comp_type, COMP_CODE_SZIP, "test_compressed_SDSs: SDgetcomptype");
+#else
+    VERIFY(comp_type, COMP_CODE_NBIT, "test_compressed_SDSs: SDgetcomptype");
+#endif
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetinfo SDS index 2");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds2_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds2_info.dimsizes, &(sds2_info.numtype), NULL);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetinfo SDS index 2");
+
+    /* Record number of values the SDS can have */
+    sds2_info.n_values = comp_n_values(rank, sds2_info.dimsizes);
+
+    /* Retrieve the offset and length of the data block */
+    status = SDgetdatainfo(sds_id, NULL, 0, info_count, sds2_info.offsets, sds2_info.lengths);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetdatainfo");
+
+    /* Close SDS index 2 */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess");
+
+    /* Open the third dataset, verify that number of data block is 1, verify
+     its comp type is Skipping Huffman, then retrieve and record the
+     offset/length */
+    sds_id = SDselect(sd_id, 3);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDselect SDS index 3");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_compressed_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_compressed_SDSs: SDgetdatainfo");
+
+    comp_type = COMP_CODE_INVALID; /* reset variables before retrieving info */
+    status = SDgetcomptype(sds_id, &comp_type);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_SKPHUFF, "test_compressed_SDSs: SDgetcomptype");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetinfo SDS index 3");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds3_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds3_info.dimsizes, &(sds3_info.numtype), NULL);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetinfo SDS index 3");
+
+    /* Record number of values the SDS can have */
+    sds3_info.n_values = comp_n_values(rank, sds3_info.dimsizes);
+
+    /* Retrieve the offset and length of the data block */
+    status = SDgetdatainfo(sds_id, NULL, 0, info_count, sds3_info.offsets, sds3_info.lengths);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDgetdatainfo");
+
+    /* Close SDS index 3 */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess");
+
+    /* Close the file */
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDend");
+
+    /******************************************************************
+     Read data using previously obtained data info without HDF4 library
+     ******************************************************************/
+
+#if 0
+    /* Open file and read in data without using SD API */
+    {
+        int fd; /* for open */
+        off_t ret; /* for lseek */
+        int32 ret32; /* for DFKconvert */
+        ssize_t readlen=0; /* for read */
+        int32 *readibuf, *readibuf_swapped;
+        float *readfbuf, *readfbuf_swapped;
+        char *readcbuf, *readcbuf_swapped;
+        uint32 n_values;
+        int ii, jj, kk;
+
+        /* Open the file for reading without SD API */
+        fd = open(SIMPLE_FILE, O_RDONLY);
+        if (fd == -1)
+        {
+            fprintf(stderr, "test_compressed_SDSs: unable to open file %s", SIMPLE_FILE);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Forward to the position of the data of SDS at index 1 */
+        if (lseek(fd, (off_t)sds1_info.offsets[0], SEEK_SET) == -1)
+        {
+            fprintf(stderr, "test_compressed_SDSs: unable to seek offset %d\n",
+                    (int)sds1_info.offsets[0]);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds1_info.n_values * sizeof(int32));
+        readibuf_swapped = (int32 *) HDmalloc(sds1_info.n_values * sizeof(int32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP)readibuf, (size_t)sds1_info.lengths[0]);
+        CHECK(readlen, FAIL, "DFKconvert");
+
+        ret32 = DFKconvert(readibuf, readibuf_swapped, sds1_info.numtype,
+                (uint32)sds1_info.n_values, DFACC_WRITE, 0, 0);
+        CHECK(ret32, FAIL, "DFKconvert");
+
+        if (ret32 > 0)
+        {
+            /* Compare data read without SD API against the original buffer */
+            for (ii = 0; ii < sds1_info.n_values; ii++)
+            {
+                if (readibuf_swapped[ii] != data1[ii])
+                fprintf(stderr, "At value# %d: written = %d read = %d\n",
+                        ii, data1[ii], readibuf_swapped[ii]);
+            }
+        }
+
+        /* Forward to the position of the data of SDS at index 2 */
+        if (lseek(fd, (off_t)sds2_info.offsets[0], SEEK_SET) == -1)
+        {
+            fprintf(stderr, "test_compressed_SDSs: unable to seek offset %d\n",
+                    (int)sds2_info.offsets[0]);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds2_info.n_values * sizeof(int32));
+        readibuf_swapped = (int32 *) HDmalloc(sds2_info.n_values * sizeof(int32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP)readibuf, (size_t)sds2_info.lengths[0]);
+        CHECK(readlen, FAIL, "DFKconvert");
+
+        ret32 = DFKconvert(readibuf, readibuf_swapped, sds2_info.numtype,
+                (uint32)sds2_info.n_values, DFACC_WRITE, 0, 0);
+        CHECK(ret32, FAIL, "DFKconvert");
+
+        if (ret32 > 0)
+        {
+            /* Compare data read without SD API against the original buffer */
+            for (ii = 0; ii < sds2_info.n_values; ii++)
+            {
+                if (readibuf_swapped[ii] != data2[ii])
+                fprintf(stderr, "At value# %d: written = %d read = %d\n",
+                        ii, data2[ii], readibuf_swapped[ii]);
+            }
+        }
+
+        /* Forward to the position of the data of SDS at index 3 */
+        if (lseek(fd, (off_t)sds3_info.offsets[0], SEEK_SET) == -1)
+        {
+            fprintf(stderr, "test_compressed_SDSs: unable to seek offset %d\n",
+                    (int)sds3_info.offsets[0]);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds3_info.n_values * sizeof(int32));
+        readibuf_swapped = (int32 *) HDmalloc(sds3_info.n_values * sizeof(int32));
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP)readibuf, (size_t)sds3_info.lengths[0]);
+        CHECK(readlen, FAIL, "DFKconvert");
+
+        ret32 = DFKconvert(readibuf, readibuf_swapped, sds3_info.numtype,
+                (uint32)sds3_info.n_values, DFACC_WRITE, 0, 0);
+        CHECK(ret32, FAIL, "DFKconvert");
+
+        if (ret32 > 0)
+        {
+            /* Compare data read without SD API against the original buffer */
+            for (ii = 0; ii < sds3_info.n_values; ii++)
+            {
+                if (readibuf_swapped[ii] != data3[ii])
+                fprintf(stderr, "At value# %d: written = %d read = %d\n",
+                        ii, data3[ii], readibuf_swapped[ii]);
+            }
+        }
+
+        if (close(fd) == -1)
+        {
+            fprintf(stderr, "test_compressed_SDSs: unable to close file %s", SIMPLE_FILE);
+            num_errs++;
+            return num_errs;
+        }
+    }
+#endif
+    free_info(&sds1_info);
+    free_info(&sds2_info);
+    free_info(&sds3_info);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_compressed_SDSs */
+
+/*
+ * Test with empty SDSs.  This routine creates a "Chunked Empty" SDS and a
+ * "Chunked Compressed Empty" SDS then uses SDgetdatainfo to get the
+ * number of blocks for data, which should be 0.
+ */
+/****************************************************************************
+ Name: test_empty_SDSs() - tests special but empty SDSs
+
+ Description:
+ This routine creates special SDSs but does not write data to any of
+ the SDSs, then uses SDgetdatainfo to verify that the number of data
+ blocks of each SDS is 0.
+
+ BMR - Jul 2010
+ ****************************************************************************/
+#define X_LENGTH2  4
+#define Y_LENGTH2  9
+#define CHK_X      3
+#define CHK_Y      2
+#define NUM_SDS    3
+#define  NODATA_FILE  "datainfo_nodata.hdf"  /* data file */
+
+static intn test_empty_SDSs()
+{
+    int32 sd_id, sds_id, sds_index;
+    int32 dimsizes[RANK];
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */
+    int32 flag;
+    uintn info_count = 0;
+    comp_coder_t comp_type; /* Compression flag */
+    comp_info c_info; /* Compression structure */
+    int ii, jj;
+    intn status;
+    int num_errs = 0; /* number of errors so far */
+
+    /* Use the same file as in test_compressed_SDSs */
+    sd_id = SDstart(NODATA_FILE, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "test_empty_SDSs: SDstart");
+
+    /*
+     * Create compressed, chunked, chunked/compressed, and expandible SDSs
+     * without writing data to any of them
+     */
+    dimsizes[0] = Y_LENGTH2;
+    dimsizes[1] = X_LENGTH2;
+
+    /* Contiguous-No-Data */
+    sds_id = SDcreate(sd_id, "Contiguous-No-Data", DFNT_INT16, RANK, dimsizes);
+    CHECK(sds_id, FAIL, "test_empty_SDSs: SDcreate 'Contiguous-No-Data'");
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_empty_SDSs: SDendaccess 'Contiguous-No-Data'");
+
+    /* Compressed-No-Data */
+    sds_id = SDcreate(sd_id, "Compressed-No-Data", DFNT_INT16, RANK, dimsizes);
+    CHECK(sds_id, FAIL, "test_empty_SDSs: SDcreate 'Compressed-No-Data'");
+
+    HDmemset(&c_info, 0, sizeof(c_info));
+    comp_type = COMP_CODE_SKPHUFF;
+    c_info.skphuff.skp_size = 4;
+    status = SDsetcompress(sds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "test_empty_SDSs: SDsetcompress 'Compressed-No-Data'");
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_empty_SDSs: SDendaccess 'Compressed-No-Data'");
+
+    /* Extend-No-Data */
+    dimsizes[0] = SD_UNLIMITED;
+    sds_id = SDcreate(sd_id, "Extend-No-Data", DFNT_INT16, RANK, dimsizes);
+    CHECK(sds_id, FAIL, "test_empty_SDSs: SDcreate 'Extend-No-Data'");
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_empty_SDSs: SDendaccess 'Extend-No-Data'");
+
+    /* Verify that the number of data block is 0 for all data sets */
+    for (ii = 0; ii < NUM_SDS; ii++)
+    {
+  sds_id = SDselect(sd_id, ii);
+  CHECK_IND(sds_id, FAIL, "test_empty_SDSs: SDselect", ii);
+
+  info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+  CHECK_IND(info_count, FAIL, "test_empty_SDSs: SDgetdatainfo", ii);
+  VERIFY(info_count, 0, "test_empty_SDSs: SDgetdatainfo");
+
+  status = SDendaccess(sds_id);
+  CHECK_IND(status, FAIL, "test_empty_SDSs: SDendaccess", ii);
+    }
+
+    /* Close the file */
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_empty_SDSs: SDend");
+
+    /* Reopen the file and check again to make sure that it is still correct
+     after flushing the metadata */
+    sd_id = SDstart(NODATA_FILE, DFACC_READ);
+    CHECK(sd_id, FAIL, "test_empty_SDSs: SDstart");
+
+    /* Verify that the number of data block is 0 for all data sets */
+    for (ii = 0; ii < NUM_SDS; ii++) {
+        sds_id = SDselect(sd_id, ii);
+        CHECK_IND(sds_id, FAIL, "test_empty_SDSs: SDselect", ii);
+
+        info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+        CHECK_IND(info_count, FAIL, "test_empty_SDSs: SDgetdatainfo", ii);
+        VERIFY(info_count, 0, "test_empty_SDSs: SDgetdatainfo");
+
+        status = SDendaccess(sds_id);
+        CHECK_IND(status, FAIL, "test_empty_SDSs: SDendaccess", ii);
+    }
+    /* Close the file */
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_empty_SDSs: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_empty_SDSs */
+
+/****************************************************************************
+ Name: test_chunked_partial() - tests writing partially to chunked SDSs
+
+ Description:
+ This routine creates and writes data to compressed SDSs and verifies
+ data and data information with SDgetdatainfo.  The tests include
+ the following SDSs:
+ - a 2-dim 5x8 element SDS, float32, NBIT compression, no data
+ - a 1-dim 10-element SDS, int32, Deflate compression, with 10 values
+ - a 2-dim 5x8 element SDS, float32, SZIP compression, with 5x8 values
+ - a 1-dim 20-element SDS, char, Skipping Huffman compression,
+ with 20 values
+
+ SDgetdatainfo will retrieve the number of blocks in the datasets
+ and the offsets and lengths of the blocks.  Then the data will be read
+ back from the file at the previously retrieved offsets/lengths, without
+ the use of the HDF4 library, and will be verified against the original
+ data buffers.
+
+ BMR - Jul 2010
+ ****************************************************************************/
+#define  CHK_FILE  "datainfo_chk.hdf"  /* data file */
+static intn test_chunked_partial()
+{
+    int32 sd_id, sds_id, sds_index;
+    int32 dimsizes[RANK], origin[RANK], starts[RANK], rank = 0, edges[RANK];
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */
+    int32 flag; /* Chunking flag */
+    int32 fill_value = -2; /* Fill value */
+    uintn info_count = 0;
+    t_hdf_datainfo_t sds_info;
+    int32 *offarray = NULL, *lenarray = NULL;
+    int32 data[Y_LENGTH][X_LENGTH];
+    int fd; /* for open */
+    int ii, jj, chk_num;
+    int num_errs = 0; /* number of errors so far */
+    intn status;
+
+    /* Declare chunks data type and initialize some of them. */
+    int32 chunk1[CHK_X][CHK_Y] = { { 4, 4 }, { 4, 4 }, { 4, 4 } };
+
+    int32 chunk3[CHK_X][CHK_Y] = { { 3, 3 }, { 3, 3 }, { 3, 3 } };
+
+    int32 chunk_1dim[10] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(CHK_FILE, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "test_chunked_partial: SDstart");
+
+    /* Initialize chunk size */
+    HDmemset(&c_def, 0, sizeof(c_def));
+    c_def.chunk_lengths[0] = 10;
+
+    /*
+     -  Create a 1-dim 100-element SDS with chunk size 10, write 2 chunks, first and last, close it
+     -  Create a 2-dim (5x5)-element non-special SDS, write all the data, close it
+     -  Call SDgetdatainfo on the first dataset to locate the data written (what about fill values?)
+     -  Open first SDS then write 1 more chunk after the first chunk
+     -  Call SDgetdatainfo (investigate!)
+     */
+    /* Create a one-dim chunked SDS to be written partially */
+    dimsizes[0] = 100;
+    sds_id = SDcreate(sd_id, "Chunked-Partial-Data", DFNT_INT32, RANK1, dimsizes);
+    CHECK(sds_id, FAIL, "test_chunked_partial: SDcreate");
+
+    /* Fill the SDS array with fill value */
+    /*  status = SDsetfillvalue(sds_id, (VOIDP)&fill_value);
+     CHECK(status, FAIL, "test_chunked_partial: SDsetfillvalue");
+     */
+
+    /* Set info for chunking */
+    status = SDsetchunk(sds_id, c_def, HDF_CHUNK);
+    CHECK(status, FAIL, "test_chunked_partial: SDsetchunk");
+
+    /* Write partially to 'Chunked-Partial-Data' and check the sizes */
+
+    /* Write the chunk with the coordinates (0) */
+    origin[0] = 0;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk_1dim);
+    CHECK(status, FAIL, "test_chunked_partial: SDwritechunk");
+
+    /* Write the chunk with the coordinates (4) */
+    origin[0] = 4;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk_1dim);
+    CHECK(status, FAIL, "test_chunked_partial: SDwritechunk");
+
+    /* Terminate access to 'Chunked-Partial-Data' */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chunked_partial: SDendaccess");
+
+    /* Create a 2x2 dataset called 'Non-Special-Data 1' */
+    dimsizes[0] = Y_LENGTH;
+    dimsizes[1] = X_LENGTH;
+    sds_id = SDcreate(sd_id, "Non-Special-Data 1", DFNT_INT32, 2, dimsizes);
+    CHECK(sds_id, FAIL, "test_chunked_partial: SDcreate");
+
+    /* Initialize data for the dataset */
+    for (jj = 0; jj < Y_LENGTH; jj++) {
+        for (ii = 0; ii < X_LENGTH; ii++)
+            data[jj][ii] = (ii + jj) + 1;
+    }
+
+    /* Write the stored data to the dataset */
+    starts[0] = starts[1] = 0;
+    edges[0] = dimsizes[0];
+    edges[1] = dimsizes[1];
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data);
+    CHECK(status, FAIL, "test_chunked_partial: SDwritedata");
+
+    /* Get access to the chunked SDS that was written partially earlier */
+    sds_index = SDnametoindex(sd_id, "Chunked-Partial-Data");
+    CHECK(sds_index, FAIL, "test_chunked_partial: SDnametoindex");
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_chunked_partial: SDselect 'Chunked-Partial-Data'");
+
+    /* Verify that only two chunks had been written */
+#if 0 /* need to figure out how to test this feature */
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_chunked_partial: SDgetdatainfo");
+    VERIFY(info_count, 2, "test_chunked_partial: SDgetdatainfo");
+#endif
+
+    /* Write another chunk at the coordinate (6) */
+    origin[0] = 6;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk_1dim);
+    CHECK(status, FAIL, "test_chunked_partial: SDwritechunk");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chunked_partial: SDendaccess");
+
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_chunked_partial: SDselect 'Chunked-Partial-Data'");
+
+    /* Verify new number of chunks written */
+#if 0 /* need to figure out how to test this feature */
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_chunked_partial: SDgetdatainfo");
+    VERIFY(info_count, 3, "test_chunked_partial: SDgetdatainfo");
+#endif
+
+    /* Retrieve the offset and length of the chunks */
+
+    /* Get SDS' rank to know how much to allocate space for sds_info */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_chunked_partial: SDgetinfo");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds_info.dimsizes, &(sds_info.numtype), NULL);
+    CHECK(status, FAIL, "test_chunked_partial: SDgetinfo");
+
+    /* Record number of values the SDS can have */
+    sds_info.n_values = 1 * 10; /* chunk has 1 dim of size 10 */
+
+#if 0 /* need to figure out how to test this feature */
+    status = SDgetdatainfo(sds_id, NULL, 0, info_count, sds_info.offsets, sds_info.lengths);
+    CHECK(status, FAIL, "test_chunked_partial: SDgetdatainfo");
+#endif
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chunked_partial: SDendaccess");
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_chunked_partial: SDend");
+
+    /* Open file and read in data without using SD API */
+    fd = open(CHK_FILE, O_RDONLY);
+    if (fd == -1) {
+        fprintf(stderr, "test_chunked_partial: unable to open file %s", CHK_FILE);
+        num_errs++;
+        return num_errs;
+    }
+
+    /* Read each chunk and compare values */
+    for (chk_num = 0; chk_num < info_count; chk_num++) {
+        off_t ret; /* for lseek */
+        int32 ret32; /* for DFKconvert */
+        ssize_t readlen = 0; /* for read */
+        int32 *readibuf, *readibuf_swapped;
+        float *readfbuf, *readfbuf_swapped;
+        char *readcbuf, *readcbuf_swapped;
+        uint32 n_values;
+        int ii, jj, kk;
+
+        /* Forward to the position of the data of the SDS */
+        if (lseek(fd, (off_t) sds_info.offsets[chk_num], SEEK_SET) == -1) {
+            fprintf(stderr, "test_chunked_partial: unable to seek offset %d\n",
+                    (int) sds_info.offsets[chk_num]);
+            num_errs++;
+            return num_errs;
+        }
+
+        /* Allocate buffers for SDS' data */
+        readibuf = (int32 *) HDmalloc(sds_info.lengths[chk_num]);
+        readibuf_swapped = (int32 *) HDmalloc(sds_info.lengths[chk_num]);
+        /* readibuf = (int32 *) HDmalloc(sds_info.n_values * sizeof(int32));
+         readibuf_swapped = (int32 *) HDmalloc(sds_info.n_values * sizeof(int32));
+         */
+        /* Read in this block of data */
+        readlen = read(fd, (VOIDP) readibuf, (size_t) sds_info.lengths[chk_num]);
+        CHECK(readlen, FAIL, "test_chunked_partial: read");
+
+        ret32 = DFKconvert(readibuf, readibuf_swapped, sds_info.numtype, 10, DFACC_WRITE, 0, 0);
+        /* (uint32)sds_info.n_values, DFACC_WRITE, 0, 0);
+         */
+        CHECK(ret32, FAIL, "test_chunked_partial: DFKconvert");
+
+        /* Compare data read without SD API against the original buffer */
+        for (ii = 0; ii < sds_info.n_values; ii++) {
+            if (readibuf_swapped[ii] != chunk_1dim[ii])
+                fprintf(stderr, "At value# %d: written = %d read = %d\n", ii,
+                        chunk_1dim[ii], readibuf_swapped[ii]);
+        }
+        HDfree (readibuf_swapped);
+        HDfree (readibuf);
+    }
+    free_info(&sds_info);
+
+    if (close(fd) == -1) {
+        fprintf(stderr, "test_chunked_partial: unable to close file %s", CHK_FILE);
+        num_errs++;
+        return num_errs;
+    }
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_chunked_partial */
+
+/*
+ * Test with chunked and compressed SDS.  This routine creates 
+ * "Chunked-Deflate-Data" and "Chunked-NoDeflate-Data" SDSs and writes the same
+ * data to both.  It will then use SDgetdatainfo to verify the number of
+ * data blocks.
+ */
+#define CHKCMP_FILE     "datainfo_chkcmp.hdf"  /* data file */
+static intn test_chkcmp_SDSs()
+{
+    int32 sd_id, sds_id, sds_index;
+    int32 cmpsds_id, cmpsds_index;
+    int32 flag, maxcache, new_maxcache;
+    int32 dimsizes[RANK], origin[RANK], rank = 0;
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */
+    t_hdf_datainfo_t sds_info, cmpsds_info;
+    int32 fill_value = 0; /* Fill value */
+    int32 comp_size1 = 0, uncomp_size1 = 0;
+    int32 comp_size2 = 0, uncomp_size2 = 0;
+    int32 chk_coord[2];
+    uintn info_count = 0;
+    intn status;
+    int num_errs = 0; /* number of errors so far */
+
+    /* Declare chunks data type and initialize some of them. */
+    int16 chunk1[CHK_X][CHK_Y] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
+
+    int16 chunk3[CHK_X][CHK_Y] = { { 3, 3 }, { 3, 3 }, { 3, 3 } };
+
+    int32 chunk2[CHK_X][CHK_Y] = { { 2, 2 }, { 2, 2 }, { 2, 2 } };
+
+    /* Initialize chunk size */
+    HDmemset(&c_def, 0, sizeof(c_def));
+    c_def.chunk_lengths[0] = CHK_X;
+    c_def.chunk_lengths[1] = CHK_Y;
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(CHKCMP_FILE, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "test_chkcmp_SDSs: SDstart");
+
+    /* Create Y_LENGTH2 x X_LENGTH2 SDS */
+    dimsizes[0] = Y_LENGTH2;
+    dimsizes[1] = X_LENGTH2;
+    cmpsds_id = SDcreate(sd_id, "Chunked-Deflate-Data", DFNT_INT32, RANK, dimsizes);
+    CHECK(cmpsds_id, FAIL, "test_chkcmp_SDSs: SDcreate");
+
+    sds_id = SDcreate(sd_id, "Chunked-NoDeflate-Data", DFNT_INT32, RANK, dimsizes);
+    CHECK(sds_id, FAIL, "test_chkcmp_SDSs: SDcreate");
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue(cmpsds_id, (VOIDP) &fill_value);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetfillvalue");
+
+    status = SDsetfillvalue(sds_id, (VOIDP) &fill_value);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetfillvalue");
+
+    /* Set info for chunking and compression */
+    HDmemset(&c_def, 0, sizeof(c_def));
+    c_def.chunk_lengths[0] = CHK_X;
+    c_def.chunk_lengths[1] = CHK_Y;
+
+    flag = HDF_CHUNK | HDF_COMP;
+    c_def.comp.comp_type = COMP_CODE_DEFLATE;
+    c_def.comp.cinfo.deflate.level = 6;
+    status = SDsetchunk(cmpsds_id, c_def, flag);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetchunk");
+
+    HDmemset(&c_def, 0, sizeof(c_def));
+    c_def.chunk_lengths[0] = CHK_X;
+    c_def.chunk_lengths[1] = CHK_Y;
+
+    flag = HDF_CHUNK;
+    status = SDsetchunk(sds_id, c_def, flag);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetchunk");
+
+    /* Set chunk cache to hold maximum of 3 chunks
+     maxcache = 1;
+     new_maxcache = SDsetchunkcache(cmpsds_id, maxcache, 0);
+     CHECK(new_maxcache, FAIL, "test_chkcmp_SDSs: SDsetchunkcache");
+
+     new_maxcache = SDsetchunkcache(sds_id, maxcache, 0);
+     CHECK(new_maxcache, FAIL, "test_chkcmp_SDSs: SDsetchunkcache");
+     */
+    /* Terminate access to the dataset before writing data to it. */
+    status = SDendaccess(cmpsds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess");
+
+    /* Re-select the datasets, write chunks using SDwritechunk function, then
+     check their data sizes */
+
+    /* Get index of dataset using its name */
+    cmpsds_index = SDnametoindex(sd_id, "Chunked-Deflate-Data");
+    CHECK(cmpsds_index, FAIL, "test_chkcmp_SDSs: SDnametoindex");
+    sds_index = SDnametoindex(sd_id, "Chunked-NoDeflate-Data");
+    CHECK(sds_index, FAIL, "test_chkcmp_SDSs: SDnametoindex");
+
+    /* Select the datasets for access */
+    cmpsds_id = SDselect(sd_id, cmpsds_index);
+    CHECK(cmpsds_id, FAIL, "test_chkcmp_SDSs: SDselect");
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_chkcmp_SDSs: SDselect");
+
+    /* Write the chunk with the coordinates (0,0) */
+    origin[0] = 0;
+    origin[1] = 0;
+    status = SDwritechunk(cmpsds_id, origin, (VOIDP) chunk1);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk");
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk1);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk");
+
+    /* Write the chunk with the coordinates (1,0) */
+    origin[0] = 1;
+    origin[1] = 0;
+    status = SDwritechunk(cmpsds_id, origin, (VOIDP) chunk3);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk");
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk3);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk");
+
+    /* Write the chunk with the coordinates (0,1) */
+    origin[0] = 0;
+    origin[1] = 1;
+    status = SDwritechunk(cmpsds_id, origin, (VOIDP) chunk2);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk");
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk2);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk");
+
+    /* Terminate access to the datasets */
+    status = SDendaccess(cmpsds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess");
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess");
+
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDend");
+
+    /* Retrieve the offset and length of the chunks of both SDSs */
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(CHKCMP_FILE, DFACC_RDWR);
+    CHECK(sd_id, FAIL, "test_chkcmp_SDSs: SDstart");
+
+    /* Open dataset 'Chunked-Deflate-Data' */
+    cmpsds_id = SDselect(sd_id, cmpsds_index);
+    CHECK(cmpsds_id, FAIL, "test_chkcmp_SDSs: SDselect");
+
+    /* Open dataset 'Chunked-NoDeflate-Data' */
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_chkcmp_SDSs: SDselect");
+
+    /*
+     * "Chunked-NoDeflate-Data"
+     */
+    chk_coord[0] = chk_coord[1] = 0;
+    info_count = SDgetdatainfo(sds_id, chk_coord, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_chkcmp_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_chkcmp_SDSs: SDgetdatainfo");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetinfo SDS index 3");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds_info.dimsizes, &(sds_info.numtype), NULL);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetinfo");
+
+    /* Record number of values the SDS can have */
+    sds_info.n_values = comp_n_values(rank, sds_info.dimsizes);
+
+    status = SDgetdatainfo(sds_id, chk_coord, 0, info_count, sds_info.offsets, sds_info.lengths);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetdatainfo");
+
+    free_info(&sds_info);
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess");
+
+    /*
+     * "Chunked-Deflate-Data"
+     */
+    chk_coord[0] = 0;
+    chk_coord[1] = 1;
+    info_count = SDgetdatainfo(cmpsds_id, chk_coord, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_chkcmp_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 1, "test_chkcmp_SDSs: SDgetdatainfo");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(cmpsds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetinfo");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&cmpsds_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(cmpsds_id, NULL, NULL, cmpsds_info.dimsizes, &(cmpsds_info.numtype), NULL);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetinfo");
+
+    /* Record number of values the SDS can have */
+    cmpsds_info.n_values = comp_n_values(rank, cmpsds_info.dimsizes);
+
+    status = SDgetdatainfo(cmpsds_id, chk_coord, 0, info_count, cmpsds_info.offsets, cmpsds_info.lengths);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetdatainfo");
+
+    free_info(&cmpsds_info);
+
+    status = SDendaccess(cmpsds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess");
+
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_chkcmp_SDSs */
+
+/*
+ * Test SDSs with unlimited dimensions.  This routine creates SDSs with
+ * unlimited dimensions, writes data to them, and use SDgetdatainfo to
+ * verify the number of data blocks.
+ */
+#define EXTEND_FILE     "datainfo_extend.hdf"  /* data file */
+#define BLOCK_SIZE	400
+static intn test_extend_SDSs()
+{
+    int32 sd_id, sds_id, sds_index;
+    int32 dimsizes[2], starts[2], edges[2], rank = 0;
+    int32 dimsize1[1], start1[1], edges1[1];
+    int32 data1[Y_LENGTH][X_LENGTH];
+    int32 data2[Y_LENGTH][X_LENGTH];
+    int32 data3[Y_LENGTH][X_LENGTH];
+    float fdata[Y_LENGTH];
+    int32 output[Y_LENGTH * 3][X_LENGTH];
+    uintn info_count = 0;
+    t_hdf_datainfo_t sds_info;
+    int32 *offarray = NULL, *lenarray = NULL;
+    int32  block_size = 0;
+    intn status;
+    int i, j, kk;
+    int num_errs = 0; /* number of errors so far */
+
+    /* Initialize data for the dataset */
+    for (j = 0; j < Y_LENGTH; j++)
+        for (i = 0; i < X_LENGTH; i++)
+            data1[j][i] = (i + j) + 1;
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(EXTEND_FILE, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "test_extend_SDSs: SDstart");
+
+    /* Create a 2x2 dataset called "Extend-Data 1" */
+    dimsizes[0] = SD_UNLIMITED;
+    dimsizes[1] = X_LENGTH;
+    sds_id = SDcreate(sd_id, "Extend-Data 1", DFNT_INT32, RANK2, dimsizes);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDcreate");
+
+    status = SDsetblocksize(sds_id, BLOCK_SIZE); /* to force linked blocks */
+    CHECK(status, FAIL, "test_extend_SDSs: SDsetblocksize");
+
+    /* Write the first batch of data to the dataset */
+    starts[0] = starts[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data1);
+    CHECK(status, FAIL, "test_extend_SDSs: SDwritedata");
+
+    /* Get the block size of "Extend-Data 1" right after writing data */
+    status = SDgetblocksize(sds_id, &block_size);
+    CHECK(status, FAIL, "test_extend_SDSs: SDgetblocksize");
+    VERIFY(block_size, BLOCK_SIZE, "SDgetblocksize");
+
+    /* Check data. */
+    HDmemset(&output, 0, sizeof(output));
+    status = SDreaddata(sds_id, starts, NULL, edges, (VOIDP) output);
+    CHECK(status, FAIL, "test_extend_SDSs: SDreaddata");
+
+    /* Verify first batch of data in the unlimited dimension SDS */
+    for (j = 0; j < Y_LENGTH; j++)
+        for (i = 0; i < X_LENGTH; i++)
+            if (output[j][i] != data1[j][i])
+                fprintf(stderr, "Read value (%d) differs from written (%d) at [%d,%d]\n",
+                        output[j][i], data1[j][i], j, i);
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+
+    /* Create another dataset with 1 unlimited dimension */
+    sds_id = SDcreate(sd_id, "Extend-Data 2", DFNT_FLOAT64, RANK1, dimsizes);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDcreate");
+
+    /* Define the location and size of the data to be written to the dataset */
+    start1[0] = 0;
+    edges1[0] = Y_LENGTH;
+
+    /* Write the stored data to 'Extend-Data 2' */
+    status = SDwritedata(sds_id, start1, NULL, edges1, (VOIDP) fdata);
+    CHECK(status, FAIL, "test_extend_SDSs: SDwritedata");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+
+    /* Select the dataset "Extend-Data 1", then write more data to it */
+    sds_index = SDnametoindex(sd_id, "Extend-Data 1");
+    CHECK(sds_index, FAIL, "test_extend_SDSs: SDnametoindex");
+
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDselect");
+
+    /* Get the block size of "Extend-Data 1" */
+    status = SDgetblocksize(sds_id, &block_size);
+    CHECK(status, FAIL, "test_extend_SDSs: SDgetblocksize");
+    VERIFY(block_size, BLOCK_SIZE, "SDgetblocksize");
+
+    /* Initialize second batch of data for the extendable dataset */
+    for (j = 0; j < Y_LENGTH; j++)
+        for (i = 0; i < X_LENGTH; i++)
+            data2[j][i] = (i + j) + 10;
+
+    /* Append the stored data to dataset "Extend-Data 1" */
+    starts[0] = Y_LENGTH;
+    starts[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data2);
+    CHECK(status, FAIL, "test_extend_SDSs: SDwritedata");
+
+    /* Initialize third batch of data for the extendable dataset */
+    for (j = 0; j < Y_LENGTH; j++)
+        for (i = 0; i < X_LENGTH; i++)
+            data3[j][i] = (i + j) + 100;
+
+    starts[0] = Y_LENGTH + Y_LENGTH;
+    starts[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+    status = SDwritedata(sds_id, starts, NULL, edges, (VOIDP) data3);
+    CHECK(status, FAIL, "test_extend_SDSs: SDwritedata");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+
+    /* Open "Extend-Data 1" again and check data. */
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDselect");
+
+    starts[0] = 0;
+    starts[1] = 0;
+    edges[0] = Y_LENGTH + Y_LENGTH + Y_LENGTH;
+    edges[1] = X_LENGTH;
+    HDmemset(&output, 0, sizeof(output));
+    status = SDreaddata(sds_id, starts, NULL, edges, (VOIDP) output);
+    CHECK(status, FAIL, "test_extend_SDSs: SDreaddata");
+
+    /* Check data against first batch */
+    for (j = 0; j < Y_LENGTH; j++)
+        for (i = 0; i < X_LENGTH; i++)
+            if (output[j][i] != data1[j][i])
+                fprintf(stderr,
+       "Read value (%d) differs from written (%d) at [%d,%d]\n",
+       output[j][i], data1[j][i], j, i);
+
+    /* Check against second batch */
+    kk = Y_LENGTH;
+    for (j = 0; j < Y_LENGTH; j++, kk++)
+        for (i = 0; i < X_LENGTH; i++)
+            if (output[kk][i] != data2[j][i])
+                fprintf(stderr, "Read value (%d) differs from written (%d) at [%d,%d]\n",
+                        output[kk][i], data2[j][i], kk, i);
+
+    /* Check against third batch */
+    kk = Y_LENGTH+Y_LENGTH;
+    for (j = 0; j < Y_LENGTH; j++, kk++)
+        for (i = 0; i < X_LENGTH; i++)
+            if (output[kk][i] != data3[j][i])
+                fprintf(stderr, "Read value (%d) differs from written (%d) at [%d,%d]\n",
+                        output[kk][i], data3[j][i], kk, i);
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+
+    /* Select the dataset "Extend-Data 1", then get offsets and lengths of
+     its data blocks */
+    sds_index = SDnametoindex(sd_id, "Extend-Data 1");
+    CHECK(sds_index, FAIL, "test_extend_SDSs: SDnametoindex");
+
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDselect");
+
+    info_count = SDgetdatainfo(sds_id, NULL, 0, 0, NULL, NULL);
+    CHECK(info_count, FAIL, "test_extend_SDSs: SDgetdatainfo");
+    VERIFY(info_count, 3, "test_extend_SDSs: SDgetdatainfo");
+
+    /* Get SDS' rank */
+    status = SDgetinfo(sds_id, NULL, &rank, NULL, NULL, NULL);
+    CHECK(status, FAIL, "test_extend_SDSs: SDgetinfo");
+
+    /* Allocate space to record the SDS' data info for later use */
+    alloc_info(&sds_info, info_count, rank);
+
+    /* Get SDS' information */
+    status = SDgetinfo(sds_id, NULL, NULL, sds_info.dimsizes, &(sds_info.numtype), NULL);
+    CHECK(status, FAIL, "test_extend_SDSs: SDgetinfo");
+
+    /* Record number of values the SDS can have */
+    sds_info.n_values = comp_n_values(rank, sds_info.dimsizes);
+
+    /* Get offsets and lengths of the data */
+    info_count = SDgetdatainfo(sds_id, NULL, 0, info_count, sds_info.offsets, sds_info.lengths);
+
+    { /* Verify the offsets and lengths returned by SDgetdatainfo */
+      /* NOTE: if "datainfo_extend.hdf" is changed, the following
+         initialization of the offsets must be updated accordingly. -BMR */
+      int32 check_offsets[3] = {2776, 3962, 4362};
+      int32 check_lengths[3] = {400, 400, 400};
+      VERIFY(info_count, 3, "test_extend_SDSs: SDgetdatainfo");
+      for (kk = 0; kk < info_count; kk++)
+      {
+  if (sds_info.offsets[kk] != check_offsets[kk])
+      fprintf(stderr,
+    "test_extend_SDSs: incorrect offset %d for block #%d\n",
+    sds_info.offsets[kk], kk);
+  if (sds_info.lengths[kk] != check_lengths[kk])
+      fprintf(stderr,
+    "test_extend_SDSs: incorrect length %d for block #%d\n",
+    sds_info.lengths[kk], kk);
+      } } /* done verifying offsets and lengths */
+
+    /* Release memory */
+    free_info(&sds_info);
+
+    /* Close this SDS and the SD interface */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDend");
+
+    /*
+     * Reopen the file and verify that "Extend-Data 1" has the correct
+     * block size that was set earlier.
+     */
+
+    /* Create the file and initialize the SD interface */
+    sd_id = SDstart(EXTEND_FILE, DFACC_RDONLY);
+    CHECK(sd_id, FAIL, "test_extend_SDSs: SDstart");
+
+    /* Select the dataset "Extend-Data 1" */
+    sds_index = SDnametoindex(sd_id, "Extend-Data 1");
+    CHECK(sds_index, FAIL, "test_extend_SDSs: SDnametoindex");
+
+    sds_id = SDselect(sd_id, sds_index);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDselect");
+
+    /* Verify that the block size is still as set earlier */
+    status = SDgetblocksize(sds_id, &block_size);
+    CHECK(status, FAIL, "test_extend_SDSs: SDgetblocksize");
+    VERIFY(block_size, BLOCK_SIZE, "SDgetblocksize");
+
+    /* Close this SDS and the SD interface */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_extend_SDSs */
+
+/* Test driver for testing the public function SDgetdatainfo. */
+extern int test_datainfo() {
+    intn status;
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("getting location info of data (tdatainfo.c)");
+
+    /* Test nonspecial SDSs */
+    num_errs = num_errs + test_nonspecial_SDSs();
+
+    /* Test compressed SDSs */
+    num_errs = num_errs + test_compressed_SDSs();
+
+    /* Test chunked empty SDSs */
+    num_errs = num_errs + test_empty_SDSs();
+
+    /* Test chunked_partial SDSs */
+    num_errs = num_errs + test_chunked_partial();
+
+    /* Test chunked SDSs */
+    num_errs = num_errs + test_chkcmp_SDSs();
+
+    /* Test extendable SDSs */
+    num_errs = num_errs + test_extend_SDSs();
+
+    if (num_errs == 0)
+        PASSED();
+    return num_errs;
+}
diff --git a/mfhdf/test/tdatasizes.c b/mfhdf/test/tdatasizes.c
new file mode 100644
index 0000000..0d2d6b9
--- /dev/null
+++ b/mfhdf/test/tdatasizes.c
@@ -0,0 +1,628 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tdatasizes.c - tests the API SDgetdatasize.
+ * Structure of the file:
+ *    test_datasizes - test driver
+ *	  test_nonspecial_SDSs - tests nonspecial SDSs
+ *	  test_compressed_SDSs - tests compressed SDSs without closing file
+ *	  test_empty_SDSs      - tests on empty chunked and chunked/comp SDSs
+ *	  test_chunked_partial - tests on chunked and partially written SDS
+ *	  test_chkcmp_SDSs     - tests chunked/compressed SDSs
+ *	  test_extend_SDSs     - tests SDSs with unlimited dimensions
+ *    check_datasizes - utility routine that calls SDgetdatasize and verifies 
+ *		the retrieved data sizes.
+ * NOTE: At this time, SDgetdatasize will not return the correct compressed
+ *	size unless SDreaddata or SDendaccess is called between SDwritedata
+ *	and SDgetdatasize.
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define FILE_NAME     "datasizes.hdf"	/* data file to test empty SDSs */
+#define X_LENGTH      10
+#define Y_LENGTH      10
+#define RANK          2
+
+/* Utility routine that selects that named SDS, then calls SDgetdatasize
+ * and verifies the returned values. */
+static void check_datasizes(
+		int32 fid, 		/* file id */
+		char* sds_name, 	/* name of the inquired SDS */
+		int32 comp_size_check, 	/* expected compressed data size */
+		int32 uncomp_size_check,/* expected non-compressed data size */
+		int* ret_num_errs	/* current number of errors */ )
+{
+    int32 sds_id, sds_index;
+    intn status;
+    int num_errs = 0;
+    char mesg[80];
+    int32 uncomp_size=0, comp_size=0;
+
+    /* Get index of dataset using its name */
+    sds_index = SDnametoindex(fid, sds_name);
+    sprintf(mesg, "check_datasizes: SDnametoindex (%s)", sds_name);
+    CHECK(sds_index, FAIL, mesg);
+
+    /* Select the dataset */
+    sds_id = SDselect(fid, sds_index);
+    CHECK(sds_id, FAIL, "check_datasizes: SDselect");
+
+    /* The retrieved values from SDgetdatasize are verified against 
+       'comp_size_check' and 'uncomp_size_check' */
+    status = SDgetdatasize(sds_id, &comp_size, &uncomp_size);
+    sprintf(mesg, "SDgetdatasize: SDS named (%s)", sds_name);
+    CHECK(status, FAIL, mesg);
+    VERIFY(comp_size, comp_size_check, mesg);
+    VERIFY(uncomp_size, uncomp_size_check, mesg);
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "check_datasizes: SDendaccess");
+
+    *ret_num_errs = num_errs;
+}   /* check_datasizes */
+
+/* Test non-special SDSs.  This routine creates non-special SDSs, writes
+ * data to one of the SDSs, and checks the sizes returned by SDgetdatasize
+ */
+static intn test_nonspecial_SDSs(int32 fid)
+{
+    int32 sds_id;
+    int32 dimsize[2], start[2], edges[2];
+    int32 data[Y_LENGTH][X_LENGTH];
+    intn  status;
+    int   i, j;
+    int   num_errs = 0;		/* number of errors so far */
+
+    /* Initialize data for the dataset */
+    for (j = 0; j < Y_LENGTH; j++) {
+        for (i = 0; i < X_LENGTH; i++)
+            data[j][i] = (i + j) + 1;
+    }
+
+    /* Create a 2x2 dataset called "EmptyDataset" */
+    dimsize[0] = Y_LENGTH;
+    dimsize[1] = X_LENGTH;
+    sds_id = SDcreate(fid, "EmptyDataset", DFNT_FLOAT32, 2, dimsize);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate 'EmptyDataset'");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /* Check that this SDS is empty */
+    check_datasizes(fid, "EmptyDataset", 0, 0, &num_errs);
+
+    /* Create another 2x2 dataset called "WrittenDataset" */
+    sds_id = SDcreate(fid, "WrittenDataset", DFNT_INT32, 2, dimsize);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate 'WrittenDataset'");
+
+    /* Define the location and size of the data to be written to the dataset */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Write the stored data to the dataset */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDwritedata");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_nonspecial_SDSs: SDendaccess");
+
+    /* Check the size of the data of this SDS */
+    check_datasizes(fid, "WrittenDataset", Y_LENGTH*X_LENGTH*SIZE_INT32, Y_LENGTH*X_LENGTH*SIZE_INT32, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_nonspecial_SDSs */
+
+/* Test compressed SDSs.  This routine creates "Compressed-No-Data" and creates
+ * and writes to "CompressedData" and "Non-CompressedData" SDSs.  It will then
+ * check the sizes returned from SDgetdatasize calls.
+ */
+static intn test_compressed_SDSs(int32 fid)
+{
+    int32     sds_id, esds_id, usds_id;
+    int32     start[2], edges[2], dim_sizes[2];
+    comp_coder_t comp_type;    /* Compression flag */
+    comp_info c_info;	   /* Compression structure */
+    int32     data[Y_LENGTH][X_LENGTH];
+    intn      status;
+    int       i, j;
+    int   num_errs = 0;   /* number of errors so far */
+
+    /* Buffer array data and define array dimensions */
+    for (j = 0; j < Y_LENGTH; j++)
+    {
+        for (i = 0; i < X_LENGTH; i++)
+                data[j][i] = (i + j) + 1;
+    }
+    dim_sizes[0] = Y_LENGTH;
+    dim_sizes[1] = X_LENGTH;
+
+    /* Create datasets, one to be written with data, the other not */
+    sds_id = SDcreate(fid, "CompressedData", DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "test_compressed_SDSs: SDcreate 'CompressedData'");
+
+    esds_id = SDcreate(fid, "Compressed-No-Data", DFNT_INT32, RANK, dim_sizes);
+    CHECK(esds_id, FAIL, "test_compressed_SDSs: SDcreate 'Compressed-No-Data'");
+
+    usds_id = SDcreate(fid, "Non-CompressedData", DFNT_INT32, RANK, dim_sizes);
+    CHECK(usds_id, FAIL, "test_compressed_SDSs: SDcreate 'Non-CompressedData'");
+
+    comp_type = COMP_CODE_DEFLATE;
+    c_info.deflate.level = 6;
+    status = SDsetcompress(sds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDsetcompress 'CompressedData'");
+
+    status = SDsetcompress(esds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDsetcompress 'Compressed-No-Data'");
+
+    /* Define the location and size of the dataset to be written to the file */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Write the stored data to the compressed dataset */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDwritedata");
+ 
+    /* Write the stored data to the dataset non-compressed dataset */
+    status = SDwritedata(usds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDwritedata");
+ 
+     /* Close the SDSs */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess 'CompressedData'");
+
+    status = SDendaccess(esds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess 'Compressed-No-Data'");
+
+    status = SDendaccess(usds_id);
+    CHECK(status, FAIL, "test_compressed_SDSs: SDendaccess 'Non-CompressedData'");
+
+    /* Check the size of the data of this SDS - 59 is from examining previously */
+    check_datasizes(fid, "CompressedData", 59, Y_LENGTH*X_LENGTH*SIZE_INT32, &num_errs);
+
+    /* Check the size of the data of this SDS */
+    check_datasizes(fid, "Compressed-No-Data", 0, 0, &num_errs);
+
+    /* Check the size of the data of this SDS */
+    check_datasizes(fid, "Non-CompressedData", Y_LENGTH*X_LENGTH*SIZE_INT32, Y_LENGTH*X_LENGTH*SIZE_INT32, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_compressed_SDSs */
+
+/* Test with empty SDSs.  This routine creates a "Chunked Empty" SDS and a
+ * "Chunked Compressed Empty" SDS then uses SDgetdatasize to verify that they
+ * don't have data.
+ */
+
+#define X_LENGTH2  4
+#define Y_LENGTH2  9
+#define CHK_X      3
+#define CHK_Y      2
+
+static intn test_empty_SDSs(int32 fid)
+{
+    int32         ch_sds_id, chcp_sds_id;
+    int32         dim_sizes[RANK];
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */ 
+    int32         flag;
+    intn          status;
+    int           num_errs = 0;   /* number of errors so far */
+
+    c_def.chunk_lengths[0] = CHK_X;
+    c_def.chunk_lengths[1] = CHK_Y;
+
+    /* Create Y_LENGTH2 x X_LENGTH2 empty chunked and chunked/compressed SDSs */
+    dim_sizes[0] = Y_LENGTH2;
+    dim_sizes[1] = X_LENGTH2;
+    ch_sds_id = SDcreate(fid, "Chunked Empty", DFNT_INT16, RANK, dim_sizes);
+    CHECK(ch_sds_id, FAIL, "test_empty_SDSs: SDcreate 'Chunked Empty'");
+
+    chcp_sds_id = SDcreate(fid, "Chunked Compressed Empty", DFNT_INT16, RANK, dim_sizes);
+    CHECK(chcp_sds_id, FAIL, "test_empty_SDSs: SDcreate 'Chunked Compressed Empty'");
+
+    /* Set info for chunking */
+    flag = HDF_CHUNK;
+    status = SDsetchunk(ch_sds_id, c_def, flag);
+    CHECK(status, FAIL, "test_empty_SDSs: SDsetchunk");
+
+    /* Set info for chunking and compression */
+    flag = HDF_CHUNK | HDF_COMP;
+    c_def.comp.comp_type = COMP_CODE_DEFLATE;
+    c_def.comp.cinfo.deflate.level = 6;
+    status = SDsetchunk(chcp_sds_id, c_def, flag);
+    CHECK(status, FAIL, "test_empty_SDSs: SDsetchunk");
+
+    /* Terminate access to the datasets */
+    status = SDendaccess(ch_sds_id);
+    CHECK(status, FAIL, "test_empty_SDSs: SDendaccess 'Chunked Empty'");
+    status = SDendaccess(chcp_sds_id);
+    CHECK(status, FAIL, "test_empty_SDSs: SDendaccess 'Chunked Compressed Empty'");
+
+    /* Check the size of the data of 'Chunked Empty' */
+    check_datasizes(fid, "Chunked Empty", 0, 0, &num_errs);
+
+    /* Check the size of the data of 'Chunked Compressed Empty' */
+    check_datasizes(fid, "Chunked Compressed Empty", 0, 0, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_empty_SDSs */
+
+/* Test with chunked and partially written SDS.  This routine creates a 
+ * "Chunked Not Empty" SDS and writes some chunks but not all to it.  It will
+ * then call SDgetdatasize to verify the sizes.
+ */
+static intn test_chunked_partial(int32 fid)
+{
+    int32         sds_id, sds_index;
+    int32         dim_sizes[RANK], origin[RANK];
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */ 
+    int32         flag; /* Chunking flag */
+    int16         fill_value = 0;   /* Fill value */
+    intn          status;
+    int           num_errs = 0;   /* number of errors so far */
+
+    /* Declare chunks data type and initialize some of them. */
+    int16 chunk1[CHK_X][CHK_Y] = { {1, 1},
+                           {1, 1},
+                           {1, 1} }; 
+
+    int16 chunk3[CHK_X][CHK_Y] = { {3, 3},
+                           {3, 3},
+                           {3, 3} }; 
+
+    /* Initialize chunk size */
+    HDmemset(&c_def, 0, sizeof(c_def)) ;
+    c_def.chunk_lengths[0] = CHK_X;
+    c_def.chunk_lengths[1] = CHK_Y;
+
+    /* Create Y_LENGTH2 x X_LENGTH2 SDS */
+    dim_sizes[0] = X_LENGTH2;
+    dim_sizes[1] = Y_LENGTH2;
+    sds_id = SDcreate(fid, "Chunked Not Empty", DFNT_INT16, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "test_chunked_partial: SDcreate 'Chunked Not Empty'");
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue(sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "test_chunked_partial: SDsetfillvalue");
+
+    /* Set info for chunking */
+    flag = HDF_CHUNK;
+    status = SDsetchunk(sds_id, c_def, flag);
+    CHECK(status, FAIL, "test_chunked_partial: SDsetchunk");
+
+    /* Write partially to 'Chunked Not Empty' and check the sizes */
+
+    /* Write the chunk with the coordinates (0,0) */
+    origin[0] = 0;
+    origin[1] = 0;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk1);
+    CHECK(status, FAIL, "test_chunked_partial: SDwritechunk");
+
+    /* Write the chunk with the coordinates (1,0) */
+    origin[0] = 1;
+    origin[1] = 0;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk3);
+    CHECK(status, FAIL, "test_chunked_partial: SDwritechunk");
+
+    /* Terminate access to the "Chunked Not Empty" dataset */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chunked_partial: SDendaccess 'Chunked Not Empty'");
+
+    /* Check the size of the data of this SDS - only chunked, not compressed,
+       so both values should be the same; there are two chunks of size
+       CHK_X*CHK_Y in type int16 written */
+    check_datasizes(fid, "Chunked Not Empty", CHK_X*CHK_Y*SIZE_INT16*2, CHK_X*CHK_Y*SIZE_INT16*2, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_chunked_partial */
+
+/* Test with chunked and compressed SDS.  This routine creates 
+ * "ChunkedDeflateData" and "ChunkedNoDeflateData" SDSs and writes the same
+ * data to both.  It will then use SDgetdatasize to verify the sizes.
+ */
+static intn test_chkcmp_SDSs(int32 fid)
+{
+    int32         sds_id, sds_index;
+    int32         cmpsds_id, cmpsds_index;
+    int32         flag, maxcache, new_maxcache;
+    int32         dim_sizes[RANK], origin[RANK];
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */ 
+    int32         fill_value = 0;   /* Fill value */
+    int32	  comp_size1=0, uncomp_size1=0;
+    int32	  comp_size2=0, uncomp_size2=0;
+    intn          status;
+    int           num_errs = 0;   /* number of errors so far */
+
+    /* Declare chunks data type and initialize some of them. */
+    int16 chunk1[CHK_X][CHK_Y] = { {1, 1},
+                           {1, 1},
+                           {1, 1} }; 
+
+    int16 chunk3[CHK_X][CHK_Y] = { {3, 3},
+                           {3, 3},
+                           {3, 3} }; 
+
+    int32 chunk2[CHK_X][CHK_Y] = { {2, 2},
+                           {2, 2},
+                           {2, 2} }; 
+
+    /* Initialize chunk size */
+    HDmemset(&c_def, 0, sizeof(c_def)) ;
+    c_def.chunk_lengths[0] = CHK_X;
+    c_def.chunk_lengths[1] = CHK_Y;
+
+    /* Create Y_LENGTH2 x X_LENGTH2 SDS */
+    dim_sizes[0] = Y_LENGTH2;
+    dim_sizes[1] = X_LENGTH2;
+    cmpsds_id = SDcreate(fid, "ChunkedDeflateData", DFNT_INT32, RANK, dim_sizes);
+    CHECK(cmpsds_id, FAIL, "test_chkcmp_SDSs: SDcreate 'ChunkedDeflateData'");
+
+    sds_id = SDcreate(fid, "ChunkedNoDeflateData", DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "test_chkcmp_SDSs: SDcreate 'ChunkedNoDeflateData'");
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue(cmpsds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetfillvalue 'ChunkedDeflateData'");
+
+    status = SDsetfillvalue(sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetfillvalue 'ChunkedNoDeflateData'");
+
+    /* Set info for chunking and compression */
+    flag = HDF_CHUNK | HDF_COMP;
+    c_def.comp.comp_type = COMP_CODE_DEFLATE;
+    c_def.comp.cinfo.deflate.level = 6;
+    status = SDsetchunk(cmpsds_id, c_def, flag);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetchunk 'ChunkedDeflateData'");
+
+    /* Set info for chunking and compression */
+    HDmemset(&c_def, 0, sizeof(c_def)) ;
+    c_def.chunk_lengths[0] = CHK_X;
+    c_def.chunk_lengths[1] = CHK_Y;
+
+    flag = HDF_CHUNK;
+    status = SDsetchunk(sds_id, c_def, flag);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDsetchunk 'ChunkedNoDeflateData'");
+
+    /* Set chunk cache to hold maximum of 3 chunks */
+    maxcache = 3;
+    flag = 0;
+    new_maxcache = SDsetchunkcache(cmpsds_id, maxcache, flag);
+    CHECK(new_maxcache, FAIL, "test_chkcmp_SDSs: SDsetchunkcache 'ChunkedDeflateData'");
+
+    new_maxcache = SDsetchunkcache(sds_id, maxcache, flag);
+    CHECK(new_maxcache, FAIL, "test_chkcmp_SDSs: SDsetchunkcache 'ChunkedNoDeflateData'");
+
+    /* Terminate access to the dataset before writing data to it. */
+    status = SDendaccess(cmpsds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess 'ChunkedDeflateData'");
+
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess 'ChunkedNoDeflateData'");
+
+    /* Check that this SDS is still empty after the call to SDsetchunk */
+    check_datasizes(fid, "ChunkedDeflateData", 0, 0, &num_errs);
+    check_datasizes(fid, "ChunkedNoDeflateData", 0, 0, &num_errs);
+
+    /* Re-select the datasets, write chunks using SDwritechunk function, then
+       check their data sizes */
+
+    /* Get index of dataset using its name */
+    cmpsds_index = SDnametoindex(fid, "ChunkedDeflateData");
+    CHECK(cmpsds_index, FAIL, "test_chkcmp_SDSs: SDnametoindex 'ChunkedDeflateData'");
+
+    sds_index = SDnametoindex(fid, "ChunkedNoDeflateData");
+    CHECK(sds_index, FAIL, "test_chkcmp_SDSs: SDnametoindex 'ChunkedNoDeflateData'");
+
+    /* Select the datasets for access */
+    cmpsds_id = SDselect(fid, cmpsds_index);
+    CHECK(cmpsds_id, FAIL, "test_chkcmp_SDSs: SDselect 'ChunkedDeflateData'");
+    sds_id = SDselect(fid, sds_index);
+    CHECK(cmpsds_id, FAIL, "test_chkcmp_SDSs: SDselect 'ChunkedNoDeflateData'");
+
+    /* Write the chunk with the coordinates (0,0) */
+    origin[0] = 0;
+    origin[1] = 0;
+    status = SDwritechunk(cmpsds_id, origin, (VOIDP) chunk1);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk 'ChunkedDeflateData'");
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk1);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk 'ChunkedNoDeflateData'");
+
+    /* Write the chunk with the coordinates (1,0) */
+    origin[0] = 1;
+    origin[1] = 0;
+    status = SDwritechunk(cmpsds_id, origin, (VOIDP) chunk3);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk 'ChunkedDeflateData'");
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk3);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk 'ChunkedNoDeflateData'");
+
+    /* Write the chunk with the coordinates (0,1) */
+    origin[0] = 0;
+    origin[1] = 1;
+    status = SDwritechunk(cmpsds_id, origin, (VOIDP) chunk2);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk 'ChunkedDeflateData'");
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk2);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDwritechunk 'ChunkedNoDeflateData'");
+
+    /* Terminate access to the datasets */
+    status = SDendaccess(cmpsds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess 'ChunkedDeflateData'");
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDendaccess 'ChunkedNoDeflateData'");
+
+    /* Verify the compressed and non-compressed data sizes of the datasets */
+
+    /* Open dataset 'ChunkedDeflateData' */
+    cmpsds_id = SDselect(fid, cmpsds_index);
+    CHECK(cmpsds_id, FAIL, "test_chkcmp_SDSs: SDselect 'ChunkedDeflateData'");
+
+    /* Get the data sizes */
+    status = SDgetdatasize(cmpsds_id, &comp_size1, &uncomp_size1);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetdatasize 'ChunkedDeflateData'");
+
+    /* Open dataset 'ChunkedNoDeflateData' */
+    sds_id = SDselect(fid, sds_index);
+    CHECK(sds_id, FAIL, "test_chkcmp_SDSs: SDselect 'ChunkedNoDeflateData'");
+
+    /* Get the data sizes */
+    status = SDgetdatasize(sds_id, &comp_size2, &uncomp_size2);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetdatasize 'ChunkedNoDeflateData'");
+
+    /* Non-compressed data sizes of the two datasets should be the same */
+    VERIFY(uncomp_size1, uncomp_size2, "test_chkcmp_SDSs: non-compressed data sizes might be incorrect");
+
+    /* In this test, compressed data size should be smaller than non-compressed
+       data size */
+    if (comp_size1 >= uncomp_size1)
+    {
+	printf("*** Routine test_chkcmp_SDSs: FAILED at line %d ***\n", __LINE__);
+	printf("    In this test, compressed data size (%d) should be smaller than non-compressed data size (%d)\n", comp_size1, uncomp_size1);
+	num_errs++;
+    }
+
+    /* Terminate access to the data sets. */
+    status = SDendaccess(sds_id);
+    CHECK(sds_id, FAIL, "test_chkcmp_SDSs: SDendaccess 'ChunkedNoDeflateData'");
+
+    status = SDendaccess(cmpsds_id);
+    CHECK(sds_id, FAIL, "test_chkcmp_SDSs: SDendaccess 'ChunkedDeflateData'");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_chkcmp_SDSs */
+
+/* Test SDSs with unlimited dimensions.  This routine creates SDSs with
+   unlimited dimensions, writes data to it, and checks the sizes returned 
+   by SDgetdatasize
+ */
+static intn test_extend_SDSs(int32 fid)
+{
+    int32 sds_id, sds_index;
+    int32 dimsize[2], start[2], edges[2];
+    int32 dimsize1[1], start1[1], edges1[1];
+    int32 data[Y_LENGTH][X_LENGTH];
+    float fdata[Y_LENGTH];
+    int32 output[Y_LENGTH][X_LENGTH];
+    intn  status;
+    int   i, j;
+    int   num_errs = 0;		/* number of errors so far */
+
+    /* Initialize data for the dataset */
+    for (j = 0; j < Y_LENGTH; j++) {
+        for (i = 0; i < X_LENGTH; i++)
+            data[j][i] = (i + j) + 1;
+    }
+
+    /* Create a 2x2 dataset called "EmptyDataset" */
+    dimsize[0] = SD_UNLIMITED;
+    dimsize[1] = X_LENGTH;
+    sds_id = SDcreate(fid, "AppendableDataset 1", DFNT_INT32, 2, dimsize);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDcreate 'AppendableDataset 1'");
+
+    /* Write the stored data to the dataset */
+    start[0] = start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDwritedata");
+
+    /* Check data. */
+    HDmemset(&output, 0, sizeof(output));
+    status = SDreaddata(sds_id, start, NULL, edges, (VOIDP)output);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDreaddata");
+    /* Initialize data for the dataset */
+    for (j = 0; j < Y_LENGTH; j++)
+        for (i = 0; i < X_LENGTH; i++)
+	    if (output[j][i] != data[j][i])
+		fprintf(stderr, "Read value (%d) differs from written (%d) at [%d,%d]\n", output[j][i], data[j][i], j, i);
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+
+    /* Check that this SDS is empty */
+    check_datasizes(fid, "AppendableDataset 1", Y_LENGTH*X_LENGTH*SIZE_INT32, Y_LENGTH*X_LENGTH*SIZE_INT32, &num_errs);
+
+    /* Create another dataset with 1 unlimited dimension */
+    sds_id = SDcreate(fid, "AppendableDataset 2", DFNT_FLOAT64, 1, dimsize);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDcreate 'AppendableDataset 2'");
+
+    /* Define the location and size of the data to be written to the dataset */
+    start1[0] = 0;
+    edges1[0] = Y_LENGTH;
+
+    /* Write the stored data to the dataset */
+    status = SDwritedata(sds_id, start1, NULL, edges1, (VOIDP)fdata);
+    CHECK(sds_id, FAIL, "test_extend_SDSs: SDwritedata");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_extend_SDSs: SDendaccess");
+
+    /* Check the size of the data of this SDS */
+    check_datasizes(fid, "AppendableDataset 2", Y_LENGTH*SIZE_FLOAT64, Y_LENGTH*SIZE_FLOAT64, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_extend_SDSs */
+
+/* Test driver for testing the API SDgetdatasize. */
+extern int test_datasizes()
+{
+    int32 fid;
+    intn status;
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("getting data size of special data (tdatasizes.c)");
+
+    /* Open the file and initialize the SD interface */
+    fid = SDstart(FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "test_datasizes: SDstart");
+
+    /* Test nonspecial SDSs */
+    num_errs = num_errs + test_nonspecial_SDSs(fid);
+    /* Test compressed SDSs */
+    num_errs = num_errs + test_compressed_SDSs(fid);
+    /* Test chunked empty SDSs */
+    num_errs = num_errs + test_empty_SDSs(fid);
+    /* Test chunked_partial SDSs */
+    num_errs = num_errs + test_chunked_partial(fid);
+    /* Test chunked SDSs */
+    num_errs = num_errs + test_chkcmp_SDSs(fid);
+    /* Test extendable SDSs */
+    num_errs = num_errs + test_extend_SDSs(fid);
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "test_datasizes: SDend");
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/tdim.c b/mfhdf/test/tdim.c
new file mode 100644
index 0000000..cd71389
--- /dev/null
+++ b/mfhdf/test/tdim.c
@@ -0,0 +1,792 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+/********************************************************************
+   HISTORY:
+   - 04/18/01
+   This test is added to test SDsetdimscale while fixing bug #172.
+   Beside the fact that the main program was already very long, adding
+   this separate test routine will also define a place for additional
+   dimension tests to be appended in the future.  Also, hopefully, some
+   day, the main program can be shortened and some of its
+   dimension-related tests can be moved into this test routine.
+
+   - 07/28/09 
+   Moved tests in test_dimensions into smaller subtests and added test
+   for SDgetdimstrs.  The structure of this file becomes:
+	test_dimensions
+	    test_dim_basics
+	    test_dim_scales
+	    test_dim_strs
+*********************************************************************/
+
+/********************************************************************
+   Name: test_dim_basics()
+
+   Description: 
+	This test routine is used to test various dimension operations.
+	The main contents include:
+	- creates SDS #1 of size LENGTH0xLENGTH1, and sets values to its dims
+	- creates SDS #2 of size LENGTH2xLENGTH3, and sets values to its 
+		first dimension
+
+	The followings are included in this test routine:
+	- SDgetdimid
+	- SDsetdimname
+	- SDdiminfo
+
+   Return value:
+	The number of errors occurred in this routine.
+
+*********************************************************************/
+#define BASIC_FILE  "dim.hdf"
+#define LENGTH0 15		/* dimensions of SDSs #1 and #3 */
+#define LENGTH1 10
+#define LENGTH2 2		/* dimensions of SDSs #2 and #4 */
+#define LENGTH3 3
+#define RANK2 	2		/* ranks */
+#define DS0_NAME "HDF Data 0"	/* SDS #1 name */
+#define DS1_NAME "HDF Data 1"	/* SDS #2 name */
+#define DIM0_NAME "Dimension 0"	/* name of first SDS' first dim */
+#define DIM1_NAME "Dimension 1"	/* name of first SDS' second dim */
+#define DIM2_NAME "Dimension 2"	/* name of second SDS' first dim */
+#define DIM3_NAME "Dimension 3"	/* name of third SDS' first dim */
+
+static intn test_basic_dim()
+{
+    int32  fid, sds_id, status, dim0_id, dim1_id, sds_idx;
+    int32  dims[2], start[2], edges[2], rank;
+    int16  array1_data[LENGTH0][LENGTH1];	/* data for first SDS */
+    uint32 array2_data[LENGTH2][LENGTH3];	/* data for second SDS */
+    int32  dim_sizes[H4_MAX_VAR_DIMS];		/* read dimensions */
+    intn   i, j;
+    int32  array_rank, num_type, attributes;
+    char   dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME];
+    uint8  scale0 [] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,255};
+    int16  scale1 [] = {0,1,2,3,4,5,6,7,8,9};
+    char8  scale2 [] = {'d','i','m','2'}, scale2_out[4];
+    float32 scalef[] = {1., 2., 3., 4.};
+    int32  size, dim_data_type, dim_num_attrs;
+    int    num_errs = 0;    /* number of errors so far */
+
+    /* Create the file defined by BASIC_FILE and initiate the SD interface. */
+    fid = SDstart(BASIC_FILE, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /*
+     * Add a LENGTH0 x LENGTH1 array, which is named by DS0_NAME and of
+     * type 16-bit signed integer, to the file... 
+     */
+
+    /* Define the rank and dimensions of the data set. */
+    rank = RANK2;
+    dims[0] = LENGTH0;
+    dims[1] = LENGTH1;
+
+    /* Create the array data set. */
+    sds_id = SDcreate(fid, DS0_NAME, DFNT_INT16, rank, dims);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /*
+     * Settings for the first dimension.  Note that all these settings
+     * are done before writing the data to the dataset; just to make sure
+     * that it's possible...
+     */
+
+    /* Get the first dimension id */
+    dim0_id = SDgetdimid(sds_id, 0);
+    CHECK(dim0_id, FAIL, "SDgetdimid");
+
+    /* Set the first dimension name to the name defined by DIM0_NAME */
+    status = SDsetdimname(dim0_id, DIM0_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Set scale of type unsigned int-8 for the first dimension */
+    status = SDsetdimscale(dim0_id, dims[0], DFNT_UINT8, scale0);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /* Read the first dimension and verify its information */
+    status = SDdiminfo(dim0_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(strcmp(dim_name, DIM0_NAME), 0, "SDdiminfo");
+    VERIFY(size, dims[0], "SDdiminfo");
+    VERIFY(dim_data_type, DFNT_UINT8, "SDdiminfo"); /* bug #172 is fixed! */
+    VERIFY(dim_num_attrs, 0, "SDdiminfo");
+
+    /* 
+     * Write the data to the dataset...
+     */
+
+    /* Fill the buffer with values. */
+    for (j = 0; j < LENGTH0; j++) {
+        for (i = 0; i < LENGTH1; i++)
+            array1_data[j][i] = (i + j) + 1;
+    }
+    /* Define the area for writing to the dataset */
+    for (i = 0; i < rank; i++) {
+        start[i] = 0;
+        edges[i] = dims[i];
+    }
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)array1_data); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Re-open BASIC_FILE in W mode */
+    fid = SDstart(BASIC_FILE, DFACC_WRITE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Look for DS0_NAME dataset */
+    sds_idx = SDnametoindex(fid, DS0_NAME);
+    CHECK(sds_idx, FAIL, "SDnametoindex");
+
+    /* Select that dataset */
+    sds_id = SDselect(fid, sds_idx);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /* Get info of the dataset and verify them: it is a LENGTH0 x LENGTH1 
+       array of type DFNT_INT16 and is named by DS0_NAME */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(strcmp(name, DS0_NAME), 0, "SDgetinfo");
+    VERIFY(array_rank, rank, "SDgetinfo");
+    VERIFY(num_type, DFNT_INT16, "SDgetinfo");
+    VERIFY(dim_sizes[0], LENGTH0, "SDgetinfo");
+    VERIFY(dim_sizes[1], LENGTH1, "SDgetinfo");
+
+    /*
+     * Setting name for the second dimension
+     */
+
+    /* Get the second dimension id */
+    dim1_id = SDgetdimid(sds_id, 1);
+    CHECK(dim1_id, FAIL, "SDgetdimid");
+
+    /* Set the second dimension name to the name defined by DIM1_NAME */
+    status = SDsetdimname(dim1_id, DIM1_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Read the second dimension and verify its information; since the
+       scale of this dimension is not set yet, its number type should be 0 */
+    status = SDdiminfo(dim1_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(strcmp(dim_name, DIM1_NAME), 0, "SDdiminfo");
+    VERIFY(size, dims[1], "SDdiminfo");
+    VERIFY(dim_data_type, 0, "SDdiminfo");
+    VERIFY(dim_num_attrs, 0, "SDdiminfo");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /*
+     * Add another dataset to the file; this dataset is a LENGTH2 x LENGTH3
+     * array, named by DS1_NAME and of type 32-bit unsigned integer...
+     */
+
+    /* Define the rank and dimensions of the data set */
+    rank = RANK2;
+    dims[0] = LENGTH2;
+    dims[1] = LENGTH3;
+
+    for (i = 0; i < rank; i++)
+        edges[i] = dims[i];
+
+    /* Create the data set */
+    sds_id = SDcreate(fid, DS1_NAME, DFNT_UINT32, rank, dims);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /*
+     * Verify the default name of the first dimension, then set it to the
+     * name DIM2_NAME and verify its new name.
+     */
+
+    /* Get the first dimension id */
+    dim0_id = SDgetdimid(sds_id, 0);
+    CHECK(dim0_id, FAIL, "SDgetdimid");
+
+    status = SDdiminfo(dim0_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(HDstrcmp(dim_name, "fakeDim2"), 0, "SDdiminfo");
+
+    /* Set the first dimension name to DIM2_NAME */
+    status = SDsetdimname(dim0_id, DIM2_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Verify new name. */
+    status = SDdiminfo(dim0_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(strcmp(dim_name, DIM2_NAME), 0, "SDdiminfo");
+    VERIFY(size, dims[0], "SDdiminfo");
+    VERIFY(dim_data_type, 0, "SDdiminfo");
+    VERIFY(dim_num_attrs, 0, "SDdiminfo");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "test_dimensions: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+
+} /* test_dim_basics */
+
+
+/********************************************************************
+   Name: test_dim_scales()
+
+   Description: 
+	This test routine is used to test dimension scale operations.
+	The main contents include:
+	- creates SDS #1 of size LENGTH0xLENGTH1, and sets values to its dims
+	- creates SDS #2 of size LENGTH2xLENGTH3, and sets values to its 
+		first dimension
+
+	The followings are included in this test routine:
+	- SDgetdimscale
+        - SDsetdimscale with the following situations:  (NOT all done yet)
+        	+ not called before SDdiminfo 
+		+ called with number type=0 -> type is then set to DFNT_FLOAT32
+        	+ called with an unsigned number type
+ 		+ called with the dataset's number type 
+ 		+ called before writing data to dataset
+ 		+ called after closing dataset and file, and then 
+		  reopening
+
+   Return value:
+	The number of errors occurred in this routine.
+
+*********************************************************************/
+#define	SCALES_FILE	"scaletst.hdf"	/* file to test dimension scales */
+
+static intn test_dim_scales()
+{
+    int32  fid, sds_id, status, dim0_id, dim1_id, sds_idx;
+    int32  dims[2], start[2], edges[2], rank;
+    int16  array1_data[LENGTH0][LENGTH1];	/* data for first SDS */
+    uint32 array2_data[LENGTH2][LENGTH3];	/* data for second SDS */
+    int32  dim_sizes[H4_MAX_VAR_DIMS];		/* read dimensions */
+    intn   i, j;
+    int32  array_rank, num_type, attributes;
+    char   dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME];
+    uint8  scale0 [] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,255};
+    int16  scale1 [] = {0,1,2,3,4,5,6,7,8,9};
+    char8  scale2 [] = {'d','i','m','2'}, scale2_out[4];
+    float32 scalef[] = {1., 2., 3., 4.};
+    int32  size, dim_data_type, dim_num_attrs;
+    int    num_errs = 0;    /* number of errors so far */
+
+    /* Create the file defined by SCALES_FILE and initiate the SD interface. */
+    fid = SDstart(SCALES_FILE, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /*
+     * Add a LENGTH0 x LENGTH1 array, which is named by DS0_NAME and of
+     * type 16-bit signed integer, to the file... 
+     */
+
+    /* Define the rank and dimensions of the data set. */
+    rank = RANK2;
+    dims[0] = LENGTH0;
+    dims[1] = LENGTH1;
+
+    /* Create the array data set. */
+    sds_id = SDcreate(fid, DS0_NAME, DFNT_INT16, rank, dims);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Get the first dimension id */
+    dim0_id = SDgetdimid(sds_id, 0);
+    CHECK(dim0_id, FAIL, "SDgetdimid");
+
+    /* Set the first dimension name to DIM0_NAME */
+    status = SDsetdimname(dim0_id, DIM0_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Set scale of type unsigned int-8 for the first dimension */
+    status = SDsetdimscale(dim0_id, dims[0], DFNT_UINT8, scale0);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /* 
+     * Write the data to the dataset...
+     */
+
+    /* Fill the buffer with values. */
+    for (j = 0; j < LENGTH0; j++) {
+        for (i = 0; i < LENGTH1; i++)
+            array1_data[j][i] = (i + j) + 1;
+    }
+    /* Define the area for writing to the dataset */
+    for (i = 0; i < rank; i++) {
+        start[i] = 0;
+        edges[i] = dims[i];
+    }
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)array1_data); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Re-open SCALES_FILE in W mode */
+    fid = SDstart(SCALES_FILE, DFACC_WRITE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Look for DS0_NAME dataset */
+    sds_idx = SDnametoindex(fid, DS0_NAME);
+    CHECK(sds_idx, FAIL, "SDnametoindex");
+
+    /* Select that dataset */
+    sds_id = SDselect(fid, sds_idx);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /* Get info of the dataset and verify its dimensions */
+    status = SDgetinfo(sds_id, NULL, &array_rank, dim_sizes, &num_type, NULL);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(array_rank, rank, "SDgetinfo");
+    VERIFY(num_type, DFNT_INT16, "SDgetinfo");
+    VERIFY(dim_sizes[0], LENGTH0, "SDgetinfo");
+    VERIFY(dim_sizes[1], LENGTH1, "SDgetinfo");
+
+    /*
+     * Check dimension's number type before setting scales
+     */
+
+    /* Get the second dimension id */
+    dim1_id = SDgetdimid(sds_id, 1);
+    CHECK(dim1_id, FAIL, "SDgetdimid");
+
+    /* Set the second dimension name to DIM1_NAME */
+    status = SDsetdimname(dim1_id, DIM1_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Read the second dimension and verify its information; since the
+       scale of this dimension is not set yet, the number type should be 0 */
+    status = SDdiminfo(dim1_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(dim_data_type, 0, "SDdiminfo");
+
+    /* Set dimension scale for the second dimension; its type will be the
+       same as that of the dataset */
+    status = SDsetdimscale(dim1_id, dim_sizes[1], num_type, scale1);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /* Read the second dimension and verify its number type; since the
+       scale of this dimension is now set, the number type should be the
+       same as its dataset, i.e. num_type above */
+    status = SDdiminfo(dim1_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(dim_data_type, num_type, "SDdiminfo");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /*
+     * Add another dataset to the file; this dataset is a LENGTH2 x LENGTH3
+     * array, named by DS1_NAME and of type 32-bit unsigned integer...
+     */
+
+    /* Define the rank and dimensions of the data set */
+    rank = RANK2;
+    dims[0] = LENGTH2;
+    dims[1] = LENGTH3;
+
+    for (i = 0; i < rank; i++)
+        edges[i] = dims[i];
+
+    /* Create the data set */
+    sds_id = SDcreate(fid, DS1_NAME, DFNT_UINT32, rank, dims);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Fill the stored-data array with values. */
+    for (j = 0; j < LENGTH2; j++) {
+        for (i = 0; i < LENGTH3; i++)
+            array2_data[j][i] = 10 * (j + i);
+    }
+
+    /* Write the data stored in the array 'array2_data' to the dataset */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)array2_data); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Get info of the dataset and verify its type */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(strcmp(name, DS1_NAME), 0, "SDgetinfo");
+    VERIFY(array_rank, rank, "SDgetinfo");
+    VERIFY(num_type, DFNT_UINT32, "SDgetinfo");
+    VERIFY(dim_sizes[0], LENGTH2, "SDgetinfo");
+    VERIFY(dim_sizes[1], LENGTH3, "SDgetinfo");
+
+    /*
+     * Verify that when 0 is passed into SDsetdimscale for number type, then
+     * the number type of the dimension scale will be set to DFNT_FLOAT32.
+     */
+
+    /* Get the first dimension id */
+    dim0_id = SDgetdimid(sds_id, 0);
+    CHECK(dim0_id, FAIL, "SDgetdimid");
+
+    /* Set the first dimension name to DIM2_NAME */
+    status = SDsetdimname(dim0_id, DIM2_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Pass 0 into SDsetdimscale for number type */
+    status = SDsetdimscale(dim0_id, dims[0], 0, scalef); 
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    status = SDdiminfo(dim0_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(strcmp(dim_name, DIM2_NAME), 0, "SDdiminfo");
+    VERIFY(dim_data_type, DFNT_FLOAT32, "SDdiminfo");
+
+    /* 
+     * Now, set dimension scale for that first dimension again, but this
+     * time, to 8-bit signed char; then verify the type and the scale values 
+     */
+
+    /* Set scale of type 8-bit signed char for this dimension */
+    status = SDsetdimscale(dim0_id, dims[0], DFNT_CHAR, scale2);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /* Read the info of this dimension and verify its new number type */ 
+    status = SDdiminfo(dim0_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(dim_data_type, DFNT_CHAR, "SDdiminfo");
+
+    /* Read dimension scale values and verify them */
+    status = SDgetdimscale(dim0_id, (VOIDP)scale2_out);
+    CHECK(status, FAIL, "SDgetdimscale");
+    for(i=0; i < LENGTH2; i++)
+	VERIFY(scale2_out[i], scale2[i], "SDgetdimscale");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "test_dimensions: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+
+} /* test_dim_scales */
+
+/********************************************************************
+   Name: test_dim_strs()
+
+   Description: 
+	This test routine is used to test SDsetdimstrs and SDgetdimstrs.i
+	It uses BASIC_FILE.
+	The main contents include:
+	- creates SDS #3 of size LENGTH0xLENGTH1 and named DS2_NAME
+	- then sets/gets all predefined attributes to/from first dimension
+	- tries to get predefined attributes from second dimension,
+	  should get '\0' as first character in the parameters
+	- now sets just 1 predefined attribute to second dimension then
+	  tries to call SDgetdimstrs again
+	- creates SDS #4 of size LENGTH4 x LENGTH5 and named DS3_NAME
+	- set dim scales to the first dimension, named DIM3_NAME
+	- now, test that SDgetdimstrs returns strings containing '\0' for
+	  this coordinate variable because SDsetdimstrs had not been called
+	  on it.
+
+   Return value:
+	The number of errors occurred in this routine.
+
+*********************************************************************/
+#define LENGTH4 4
+#define LENGTH5 5
+#define RANK4 	4
+#define DS2_NAME "HDF Data 2"	/* SDS #3 name */
+#define DS3_NAME "HDF Data 3"	/* SDS #4 name */
+#define LABEL	"DimLabel"
+#define UNITS	"Units"
+#define FORMAT	"TheFormat"
+#define DIMSTRS_LEN	20	/* length of the dimension string buffers */
+static intn test_dim_strs()
+{
+    int32  fid, sds_id, status, dim0_id, dim1_id, sds_idx, coord_var_id;
+    int32  dims[2], start[2], edges[2], rank;
+    int16  array1_data[LENGTH0][LENGTH1];	/* data for first SDS */
+    uint32 array2_data[LENGTH2][LENGTH3];	/* data for second SDS */
+    int32  dim_sizes[H4_MAX_VAR_DIMS];		/* read dimensions */
+    intn   i, j;
+    int32  array_rank, num_type, attributes;
+    char   dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME];
+    uint8  scale0 [] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,255};
+    int16  scale1 [] = {0,1,2,3,4,5,6,7,8,9};
+    char8  scale2 [] = {'d','i','m','2'}, scale2_out[4];
+    float32 scalef[] = {1., 2., 3., 4.};
+    int32  size, dim_data_type, dim_num_attrs;
+    char   label[DIMSTRS_LEN], unit[DIMSTRS_LEN], format[DIMSTRS_LEN];
+    int    num_errs = 0;    /* number of errors so far */
+
+    /* Open the file defined by BASIC_FILE and initiate the SD interface. */
+    fid = SDstart(BASIC_FILE, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    /*
+     * Add a LENGTH0 x LENGTH1 array, which is named by DS2_NAME and of
+     * type 16-bit signed integer, to the file... 
+     */
+
+    /* Define the rank and dimensions of the data set. */
+    rank = RANK2;
+    dims[0] = LENGTH0;
+    dims[1] = LENGTH1;
+
+    /* Create the array data set. */
+    sds_id = SDcreate(fid, DS2_NAME, DFNT_INT16, rank, dims);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /*
+     * Settings predefined attributes for the first dimension.
+     */
+
+    /* Get the first dimension id */
+    dim0_id = SDgetdimid(sds_id, 0);
+    CHECK(dim0_id, FAIL, "SDgetdimid");
+
+    /* Set the dimension strings for the dimension */
+    status = SDsetdimstrs(dim0_id, LABEL, UNITS, FORMAT);
+    CHECK(status, FAIL, "SDsetdimstrs");
+
+    /* Read the first dimension and verify its information */
+    status = SDdiminfo(dim0_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY(size, dims[0], "SDdiminfo");
+    VERIFY(dim_data_type, DFNT_NONE, "SDdiminfo"); /* number type not set */
+    VERIFY(dim_num_attrs, 3, "SDdiminfo");
+
+    /* 
+     * Write the data stored in the array 'array1_data' to the dataset...
+     */
+
+    /* Fill the buffer with values. */
+    for (j = 0; j < LENGTH0; j++) {
+        for (i = 0; i < LENGTH1; i++)
+            array1_data[j][i] = (i + j) + 1;
+    }
+
+    /* Define the area for writing to the dataset */
+    for (i = 0; i < rank; i++) {
+        start[i] = 0;
+        edges[i] = dims[i];
+    }
+
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)array1_data); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Re-open BASIC_FILE in W mode and select the dataset named by DS0_NAME */
+    fid = SDstart(BASIC_FILE, DFACC_WRITE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Look for DS0_NAME dataset */
+    sds_idx = SDnametoindex(fid, DS2_NAME);
+    CHECK(sds_idx, FAIL, "SDnametoindex");
+
+    /* Select that dataset */
+    sds_id = SDselect(fid, sds_idx);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /*
+     * Verify predefined attributes of the first dimension of this dataset.
+     * They were set previously.
+     */
+
+    /* Get the first dimension id */
+    dim0_id = SDgetdimid(sds_id, 0);
+    CHECK(dim0_id, FAIL, "SDgetdimid");
+
+    /* Get and verify the predefined attributes label, unit, and format */
+    status = SDgetdimstrs(dim0_id, label, unit, format, DIMSTRS_LEN);
+    CHECK(status, FAIL, "SDgetdimstrs");
+    VERIFY_CHAR(label, LABEL, "SDgetdimstrs");
+    VERIFY_CHAR(unit, UNITS, "SDgetdimstrs");
+    VERIFY_CHAR(format, FORMAT, "SDgetdimstrs");
+
+    /*
+     * Verify that the second dimension of SDS DS2_NAME does not have
+     * predefined attributes 
+     */
+
+    /* Get the second dimension id */
+    dim1_id = SDgetdimid(sds_id, 1);
+    CHECK(dim1_id, FAIL, "SDgetdimid");
+
+    /* Get and verify that predefined attributes label, unit, and format 
+       are not assigned to this dimension */
+    HDmemset(label, 0, DIMSTRS_LEN);
+    HDmemset(unit, 0, DIMSTRS_LEN);
+    HDmemset(format, 0, DIMSTRS_LEN);
+    status = SDgetdimstrs(dim1_id, label, unit, format, DIMSTRS_LEN);
+    CHECK(status, FAIL, "SDgetdimstrs");
+    VERIFY(label[0], '\0', "SDgetdimstrs");
+    VERIFY(unit[0], '\0', "SDgetdimstrs");
+    VERIFY(format[0], '\0', "SDgetdimstrs");
+
+    /* Assign predefined attribute UNITS to this dimension and check again. */
+    status = SDsetdimstrs(dim1_id, NULL, UNITS, NULL);
+    CHECK(status, FAIL, "SDsetdimstrs");
+
+    /* Get and verify that only the predefined attributes unit is assigned
+       to this dimension */
+    status = SDgetdimstrs(dim1_id, label, unit, format, DIMSTRS_LEN);
+    CHECK(status, FAIL, "SDgetdimstrs");
+    VERIFY(label[0], '\0', "SDgetdimstrs");
+    VERIFY_CHAR(unit, UNITS, "SDgetdimstrs");
+    VERIFY(format[0], '\0', "SDgetdimstrs");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /*
+     * Test that a dimension is a coordinate variable but does not have
+     * predefined attributes Label, Unit, or Format assigned to it.
+     */
+
+    /*
+     * Add another dataset to the file; this dataset is a LENGTH4 x LENGTH5
+     * array, named by DS3_NAME and of type 32-bit unsigned integer...
+     */
+
+    /* Define the rank and dimensions of the data set */
+    rank = RANK2;
+    dims[0] = LENGTH4;
+    dims[1] = LENGTH5;
+
+    for (i = 0; i < rank; i++)
+        edges[i] = dims[i];
+
+    /* Create the data set */
+    sds_id = SDcreate(fid, DS3_NAME, DFNT_UINT32, rank, dims);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Fill the stored-data array with values. */
+    for (j = 0; j < LENGTH2; j++) {
+        for (i = 0; i < LENGTH3; i++)
+            array2_data[j][i] = 10 * (j + i);
+    }
+
+    /* Write the data stored in the array 'array2_data' to the dataset */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)array2_data); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Get the first dimension id */
+    dim0_id = SDgetdimid(sds_id, 0);
+    CHECK(dim0_id, FAIL, "SDgetdimid");
+
+    /* Set the first dimension name to the name defined by DIM3_NAME */
+    status = SDsetdimname(dim0_id, DIM3_NAME);
+    CHECK(status, FAIL, "SDsetdimname");
+
+    /* Set dimension scale for that first dimension.  It is now should be
+       a coordinate variable. */
+    status = SDsetdimscale(dim0_id, dims[0], DFNT_CHAR, scale2);
+    CHECK(status, FAIL, "SDsetdimscale");
+
+    /*
+     * Get access to that coordinate variable and verify its information
+     */
+    /* Look for DIM3_NAME dataset */
+    sds_idx = SDnametoindex(fid, DIM3_NAME);
+    CHECK(sds_idx, FAIL, "SDnametoindex");
+
+    /* Select that coordinate variable */
+    coord_var_id = SDselect(fid, sds_idx);
+    CHECK(coord_var_id, FAIL, "SDselect");
+
+    /* Get info of the coord var and verify them: it is a LENGTH4 x LENGTH5 
+       array of type DFNT_CHAR and is named by DIM3_NAME */
+    status = SDgetinfo(coord_var_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(strcmp(name, DIM3_NAME), 0, "SDgetinfo");
+    VERIFY(array_rank, 1, "SDgetinfo");
+    VERIFY(num_type, DFNT_CHAR, "SDgetinfo");
+    VERIFY(dim_sizes[0], dims[0], "SDgetinfo");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(coord_var_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Get and verify that predefined attributes label, unit, and format 
+       are not assigned to this dimension */
+    HDmemset(label, 0, DIMSTRS_LEN);
+    HDmemset(unit, 0, DIMSTRS_LEN);
+    HDmemset(format, 0, DIMSTRS_LEN);
+    status = SDgetdimstrs(dim0_id, label, unit, format, DIMSTRS_LEN);
+    CHECK(status, FAIL, "SDgetdimstrs");
+    VERIFY(label[0], '\0', "SDgetdimstrs");
+    VERIFY(unit[0], '\0', "SDgetdimstrs");
+    VERIFY(format[0], '\0', "SDgetdimstrs");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "test_dimensions: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+
+} /* test_dim_strs */
+
+/* Test driver for testing dimension functionality */
+extern int test_dimensions()
+{
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("functionality of dimensions (tdim.c)");
+
+    /* Test basic dimension functionality */
+    num_errs = num_errs + test_basic_dim();
+
+    /* Test dimension scale functionality */
+    num_errs = num_errs + test_dim_scales();
+
+    /* Test SD[set/get]dimstrs */
+    num_errs = num_errs + test_dim_strs();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
+    
+#endif /* HDF */
diff --git a/mfhdf/test/temptySDSs.c b/mfhdf/test/temptySDSs.c
new file mode 100644
index 0000000..1303767
--- /dev/null
+++ b/mfhdf/test/temptySDSs.c
@@ -0,0 +1,583 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * temptySDS.c - tests the API SDcheckempty.
+ * Structure of the file:
+ *    test_checkempty - test driver
+ *	  test_nonspecial_SDSs - tests nonspecial SDSs without closing file
+ *	  test_compressed_SDSs - tests compressed SDSs without closing file
+ *	  test_chunked_SDSs    - tests chunked SDSs without closing file
+ *	  test_unlimited_SDSs  - tests unlimited dim SDSs without closing file
+ *	  test_with_existing_file - tests all SDSs in file after closing the
+ *	  			 file and reopening it
+ *    check_empty_SDS - utility routine that calls SDcheckempty and verifies
+ *		values
+ *    check_getchunkinfo - utility routine that calls SDgetchunkinfo and
+ *		verifies that function did not fail on empty SDS and the file
+ *		is opened as read-only. (bug HDFFR-171, -BMR 2011/10/23)
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define FILE_NAME     "emptySDSs.hdf"	/* data file to test empty SDSs */
+#define X_LENGTH      10
+#define Y_LENGTH      10
+#define RANK          2
+
+/* Utility routine that selects that named SDS, then calls SDcheckempty
+ * and verifies the returned values. */
+static void check_empty_SDS(
+		int32 fid, 		/* file id */
+		char* sds_name, 	/* name of the inquired SDS */
+		int32 verify_value, 	/* expected value of 'emptySDS' from SDcheckempty */
+		int* ret_num_errs	/* current number of errors */ )
+{
+    int32 sds_id, sds_index, status_32;
+    intn status, emptySDS;
+    int num_errs = 0;
+    char mesg[80];
+
+    /* Get index of dataset using its name */
+    sds_index = SDnametoindex(fid, sds_name);
+    sprintf(mesg, "In check_empty_SDS: SDnametoindex (%s)", sds_name);
+    CHECK(sds_index, FAIL, mesg);
+
+    /* Select the dataset */
+    sds_id = SDselect(fid, sds_index);
+    CHECK(sds_id, FAIL, "In check_empty_SDS: SDselect");
+
+    /* The returned value from SDcheckempty is CHECKed for FAIL and
+       'emptySDS' is verified to be verify_value, which can be TRUE or FALSE. */
+    status_32 = SDcheckempty( sds_id, &emptySDS);
+    CHECK(status_32, FAIL, "SDcheckempty");
+    VERIFY(emptySDS, verify_value, "SDcheckempty");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In check_empty_SDS: SDendaccess");
+
+    *ret_num_errs = num_errs;
+}   /* check_empty_SDS */
+
+/* Utility routine that selects that named SDS, then calls SDgetchunkinfo and
+ * verify the returned values.  The routine also verifies that SDgetchunkinfo
+ * did not fail when the file is opened as read-only (bug HDFFR-171) */
+static void check_getchunkinfo(
+		int32 fid, 		/* file id */
+		char* sds_name, 	/* name of the inquired SDS */
+		int32 verify_value, 	/* expected value of 'flags' from SDgetchunkinfo */
+		int* ret_num_errs	/* current number of errors */ )
+{
+    int32 sds_id, sds_index;
+    HDF_CHUNK_DEF c_def_out; /* Chunking definitions */
+    int32 comp_flag, c_flags;
+    intn status;
+    int num_errs = 0;
+    char mesg[80];
+
+    /* Get index of dataset using its name */
+    sds_index = SDnametoindex(fid, sds_name);
+    sprintf(mesg, "In check_getchunkinfo: SDnametoindex (%s)", sds_name);
+    CHECK(sds_index, FAIL, mesg);
+
+    /* Select the dataset */
+    sds_id = SDselect(fid, sds_index);
+    CHECK(sds_id, FAIL, "In check_getchunkinfo: SDselect");
+
+    /* The returned value from SDgetchunkinfo is CHECKed for FAIL and
+       'c_flags' is VERIFied to be verify_value, which can be HDF_NONE,
+       HDF_CHUNK, or HDF_CHUNK | HDF_COMP. */
+    status = SDgetchunkinfo (sds_id, &c_def_out, &c_flags);
+    CHECK(status, FAIL, "SDgetchunkinfo");
+    VERIFY(c_flags, verify_value, "SDgetchunkinfo");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In check_getchunkinfo: SDendaccess");
+
+    *ret_num_errs = num_errs;
+}   /* check_getchunkinfo */
+
+/* Test non-special SDSs.  This routine creates non-special SDSs, writes
+ * data to one of the SDSs, and checks for emptiness on each without closing
+ * the file. */
+static intn 
+test_nonspecial_SDSs(int32 fid)
+{
+    int32 sds_id;
+    int32 dimsize[2], start[2], edges[2];
+    int32 data[Y_LENGTH][X_LENGTH];
+    intn  status;
+    int   i, j;
+    int   num_errs = 0;		/* number of errors so far */
+
+    /* Initialize data for the dataset */
+    for (j = 0; j < Y_LENGTH; j++) {
+        for (i = 0; i < X_LENGTH; i++)
+            data[j][i] = (i + j) + 1;
+    }
+
+    /* Create a 2x2 dataset called "EmptyDataset" */
+    dimsize[0] = Y_LENGTH;
+    dimsize[1] = X_LENGTH;
+    sds_id = SDcreate(fid, "EmptyDataset", DFNT_FLOAT32, 2, dimsize);
+    CHECK(sds_id, FAIL, "In test_nonspecial_SDSs: SDcreate 'EmptyDataset'");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In test_nonspecial_SDSs: SDendaccess");
+
+    /* Check that this SDS is empty */
+    check_empty_SDS(fid, "EmptyDataset", TRUE, &num_errs);
+
+    /* Create another 2x2 dataset called "WrittenDataset" */
+    sds_id = SDcreate(fid, "WrittenDataset", DFNT_INT32, 2, dimsize);
+    CHECK(sds_id, FAIL, "In test_nonspecial_SDSs: SDcreate 'WrittenDataset'");
+
+    /* Define the location and size of the data to be written to the dataset */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Write the stored data to the dataset */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(sds_id, FAIL, "In test_nonspecial_SDSs: SDwritedata");
+
+    /* Close this SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In test_nonspecial_SDSs: SDendaccess");
+
+    /* Check that this SDS is NOT empty */
+    check_empty_SDS(fid, "WrittenDataset", FALSE, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_nonspecial_SDSs */
+
+/* Test compressed SDSs.  This routine creates compressed SDSs, writes
+ * data to one of the SDSs, and checks for emptiness on each without closing
+ * the file. */
+static intn
+test_compressed_SDSs(int32 fid)
+{
+    int32     sds_id, esds_id;
+    int32     start[2], edges[2], dim_sizes[2];
+    int32     comp_type;    /* Compression flag */
+    comp_info c_info;	   /* Compression structure */
+    int32     data[Y_LENGTH][X_LENGTH];
+    intn      status;
+    int       i, j;
+    int   num_errs = 0;   /* number of errors so far */
+
+    /* Buffer array data and define array dimensions */
+    for (j = 0; j < Y_LENGTH; j++)
+    {
+        for (i = 0; i < X_LENGTH; i++)
+                data[j][i] = (i + j) + 1;
+    }
+    dim_sizes[0] = Y_LENGTH;
+    dim_sizes[1] = X_LENGTH;
+
+    /* Create datasets, one to be written with data, the other not */
+    sds_id = SDcreate(fid, "CompressedData", DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "In test_compressed_SDSs: SDcreate 'CompressedData'");
+
+    esds_id = SDcreate(fid, "Compressed-No-Data", DFNT_INT32, RANK, dim_sizes);
+    CHECK(esds_id, FAIL, "In test_compressed_SDSs: SDcreate 'Compressed-No-Data'");
+
+    comp_type = COMP_CODE_DEFLATE;
+    c_info.deflate.level = 6;
+    status = SDsetcompress(sds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "In test_compressed_SDSs: SDsetcompress 'CompressedData'");
+
+    status = SDsetcompress(esds_id, comp_type, &c_info);
+    CHECK(status, FAIL, "In test_compressed_SDSs: SDsetcompress 'Compressed-No-Data'");
+
+    /* Define the location and size of the dataset to be written to the file */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Write the stored data to the dataset */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "In test_compressed_SDSs: SDwritedata");
+ 
+     /* Close the SDSs */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In test_compressed_SDSs: SDendaccess 'CompressedData'");
+
+    status = SDendaccess(esds_id);
+    CHECK(status, FAIL, "In test_compressed_SDSs: SDendaccess 'Compressed-No-Data'");
+
+    /* Check that this SDS is NOT empty */
+    check_empty_SDS(fid, "CompressedData", FALSE, &num_errs);
+
+    /* Check that this SDS is empty */
+    check_empty_SDS(fid, "Compressed-No-Data", TRUE, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_compressed_SDSs */
+
+/* Test chunked SDSs.  This routine creates chunked SDSs, writes data
+ * to one of the SDSs, and checks for emptiness on each without closing
+ * the file. */
+
+#define X_CHUNKED_LENGTH      4
+#define Y_CHUNKED_LENGTH      9
+
+static intn
+test_chunked_SDSs(int32 fid)
+{
+    int32         sds_id, esds_id, sds_index;
+    int32         flag, maxcache, new_maxcache;
+    int32         dim_sizes[RANK], origin[RANK];
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */ 
+    int32         comp_flag;
+    int16         fill_value = 0;   /* Fill value */
+    intn          status;
+    int           num_errs = 0;   /* number of errors so far */
+
+    /* Declare chunks data type and initialize some of them. */
+    int16 chunk1[3][2] = { 1, 1,
+                           1, 1,
+                           1, 1 }; 
+
+    int16 chunk2[3][2] = { 2, 2,
+                           2, 2,
+                           2, 2 }; 
+
+    int16 chunk3[3][2] = { 3, 3,
+                           3, 3,
+                           3, 3 }; 
+
+    int16 chunk6[3][2] = { 6, 6,
+                           6, 6,
+                           6, 6 };
+
+
+    c_def.chunk_lengths[0] = 3;
+    c_def.chunk_lengths[1] = 2;
+
+    /* Create Y_CHUNKED_LENGTH x X_CHUNKED_LENGTH SDS */
+    dim_sizes[0] = Y_CHUNKED_LENGTH;
+    dim_sizes[1] = X_CHUNKED_LENGTH;
+    esds_id = SDcreate(fid, "Chunked-No-Data", DFNT_INT16, RANK, dim_sizes);
+    CHECK(esds_id, FAIL, "In test_chunked_SDSs: SDcreate 'Chunked-No-Data'");
+
+    /* Set info for chunking */
+    comp_flag = HDF_CHUNK;
+    status = SDsetchunk(esds_id, c_def, comp_flag);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDsetchunk");
+
+    /* Terminate access to the "Chunked-No-Data" dataset */
+    status = SDendaccess(esds_id);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDendaccess 'Chunked-No-Data'");
+
+    /* Check that this SDS is empty */
+    check_empty_SDS(fid, "Chunked-No-Data", TRUE, &num_errs);
+
+    /* Create another Y_CHUNKED_LENGTH x X_CHUNKED_LENGTH SDS but this 
+       one will be written with chunks */
+    sds_id = SDcreate(fid, "ChunkedData", DFNT_INT16, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "In test_chunked_SDSs: SDcreate 'ChunkedData'");
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue(sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDsetfillvalue");
+
+    /* Set info for chunking */
+    comp_flag = HDF_CHUNK;
+    status = SDsetchunk(sds_id, c_def, comp_flag);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDsetchunk");
+
+    /* Set chunk cache to hold maximum of 3 chunks */
+    maxcache = 3;
+    flag = 0;
+    new_maxcache = SDsetchunkcache(sds_id, maxcache, flag);
+    CHECK(new_maxcache, FAIL, "In test_chunked_SDSs: SDsetchunkcache");
+
+    /* Terminate access to the dataset then check if it's empty - and it 
+       should be, before writing data to it. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDendaccess");
+
+    /* Check that this SDS is still empty after the call to SDsetchunk */
+    check_empty_SDS(fid, "ChunkedData", TRUE, &num_errs);
+
+    /* Re-select the "ChunkedData" SDS, then write chunks using SDwritechunk 
+       function */
+
+    /* Get index of dataset using its name */
+    sds_index = SDnametoindex(fid, "ChunkedData");
+    CHECK(sds_index, FAIL, "In test_chunked_SDSs: SDnametoindex");
+
+    /* Select the dataset */
+    sds_id = SDselect(fid, sds_index);
+    CHECK(sds_id, FAIL, "In test_chunked_SDSs: SDselect");
+
+    /* Write the chunk with the coordinates (0,0) */
+    origin[0] = 0;
+    origin[1] = 0;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk1);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDwritechunk");
+
+    /* Write the chunk with the coordinates (1,0) */
+    origin[0] = 1;
+    origin[1] = 0;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk3);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDwritechunk");
+
+    /* Write the chunk with the coordinates (0,1) */
+    origin[0] = 0;
+    origin[1] = 1;
+    status = SDwritechunk(sds_id, origin, (VOIDP) chunk2);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDwritechunk");
+
+    /* Terminate access to the dataset */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In test_chunked_SDSs: SDendaccess");
+
+    /* Check that this SDS is NOT empty */
+    check_empty_SDS(fid, "ChunkedData", FALSE, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_chunked_SDSs */
+
+/* Test unlimited dimension SDSs.  This routine creates unlimited 
+ * dimension SDSs, writes data to one of the SDSs, and checks for 
+ * emptiness on each without closing the file. */
+static intn
+test_unlimited_SDSs(int32 fid)
+{
+    int32 sds_id, esds_id, sds_index;
+    int32 dim_sizes[2];
+    int32 data[Y_LENGTH][X_LENGTH], append_data[X_LENGTH];
+    int32 start[2], edges[2];
+    intn  status;
+    int   i, j;
+    int   num_errs = 0;   /* number of errors so far */
+
+    /* Data initialization */
+    for (j = 0; j < Y_LENGTH; j++) 
+    {
+        for (i = 0; i < X_LENGTH; i++)
+           data[j][i] = (i + 1) + (j + 1);
+    }
+
+    /* Define dimensions of the array. Make the first dimension 
+       appendable by defining its length to be unlimited */
+    dim_sizes[0] = SD_UNLIMITED;
+    dim_sizes[1] = X_LENGTH;
+
+    /* Create the array datasets */
+    esds_id = SDcreate(fid, "Appendable-No-Data", DFNT_INT32, RANK, dim_sizes);
+    CHECK(esds_id, FAIL, "In test_unlimited_SDSs: SDcreate 'Appendable-No-Data'");
+
+    sds_id = SDcreate(fid, "AppendableData", DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "In test_unlimited_SDSs: SDcreate 'AppendableData'");
+
+    /* Terminate access to the dataset "Appendable-No-Data" */
+    status = SDendaccess(esds_id);
+
+    /* Define the location and the size of the data to be written 
+       to the second dataset  */
+    start[0] = start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Write the data */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data);
+    CHECK(status, FAIL, "In test_unlimited_SDSs: SDwritedata");
+
+    /* Terminate access to the unlimited dataset */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In test_unlimited_SDSs: SDendaccess");
+
+    /* Check that this SDS is NOT empty */
+    check_empty_SDS(fid, "AppendableData", FALSE, &num_errs);
+
+    /* Store the array values to be appended to the dataset */
+    for (i = 0; i < X_LENGTH; i++)
+        append_data[i] = 1000 + i;
+
+    /* Get index of the dataset using its name */
+    sds_index = SDnametoindex(fid, "AppendableData");
+    CHECK(sds_index, FAIL, "In test_unlimited_SDSs: SDnametoindex");
+
+    /* Select the "AppendableData" dataset */
+    sds_id = SDselect(fid, sds_index);
+    CHECK(sds_id, FAIL, "In test_unlimited_SDSs: SDselect 'AppendableData'");
+
+    /* Check if selected SDS is unlimited. If it is not, then terminate 
+       access to the SDS */
+    if (SDisrecord(sds_id)) 
+    {
+        /* Define the location of the append to start at the first column 
+         * of the 11th row of the dataset and to stop at the end of the
+         * eleventh row.  */
+        start[0] = Y_LENGTH;
+        start[1] = 0;
+        edges[0] = 1;
+        edges[1] = X_LENGTH;
+
+        /* Append data to the dataset */
+        status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)append_data);
+        CHECK(status, FAIL, "In test_unlimited_SDSs: SDwritedata");
+    }
+
+    /* Terminate access to the dataset */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "In test_unlimited_SDSs: SDendaccess");
+
+    /* Check that this SDS is NOT empty */
+    check_empty_SDS(fid, "AppendableData", FALSE, &num_errs);
+
+    /* Check that this SDS is empty */
+    check_empty_SDS(fid, "Appendable-No-Data", TRUE, &num_errs);
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_unlimited_SDSs */
+
+/* This function checks which of the SDSs in the file are empty/written,
+ * just as in the previous individual tests.  The difference is these
+ * SDSs are read back in after the file is closed and reopened. */
+static intn 
+test_with_existing_file()
+{
+    int32 fid;
+    intn status;
+    int   num_errs = 0;		/* number of errors so far */
+
+    /* Open the file and initialize the SD interface */
+    fid = SDstart(FILE_NAME, DFACC_READ);
+    CHECK(fid, FAIL, "In test_with_existing_file: SDstart");
+
+    /* Check that SDS named "EmptyDataset" is empty */
+    check_empty_SDS(fid, "EmptyDataset", TRUE, &num_errs);
+
+    /* Check that SDS named "AppendableData" is NOT empty */
+    check_empty_SDS(fid, "AppendableData", FALSE, &num_errs);
+
+    /* Check that SDS named "Appendable-No-Data" is empty */
+    check_empty_SDS(fid, "Appendable-No-Data", TRUE, &num_errs);
+
+    /* Check that SDS named "CompressedData" is NOT empty */
+    check_empty_SDS(fid, "CompressedData", FALSE, &num_errs);
+
+    /* Check that SDS named "Compressed-No-Data" is empty */
+    check_empty_SDS(fid, "Compressed-No-Data", TRUE, &num_errs);
+
+    /* Check that SDS named "ChunkedData" is NOT empty */
+    check_empty_SDS(fid, "ChunkedData", FALSE, &num_errs);
+
+    /* Check that SDS named "Chunked-No-Data" is empty */
+    check_empty_SDS(fid, "Chunked-No-Data", TRUE, &num_errs);
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "In test_with_existing_file: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_with_existing_file */
+
+/* This function verifies that the bug HDFFR-171 is fixed.  It opens
+   the file as read-only, then calls SDgetchunkinfo on some empty SDS's.
+   SDgetchunkinfo should not fail and should return HDF_NONE for the flag.
+   -BMR 2011/10/20. */
+static intn 
+test_getchunkinfo()
+{
+    int32 fid;
+    intn status;
+    int num_errs = 0;		/* number of errors so far */
+
+    /* Open the file and initialize the SD interface */
+    fid = SDstart(FILE_NAME, DFACC_RDONLY);
+    CHECK(fid, FAIL, "In check_getchunkinfo: SDstart");
+
+    /* Check that SDS named "EmptyDataset" is empty */
+    check_getchunkinfo(fid, "EmptyDataset", HDF_NONE, &num_errs);
+
+    /* Check that SDS named "AppendableData" is NOT empty */
+    check_getchunkinfo(fid, "AppendableData", HDF_NONE, &num_errs);
+
+    /* Check that SDS named "Appendable-No-Data" is empty */
+    check_getchunkinfo(fid, "Appendable-No-Data", HDF_NONE, &num_errs);
+
+    /* Check that SDS named "CompressedData" is NOT empty */
+    check_getchunkinfo(fid, "CompressedData", HDF_NONE, &num_errs);
+
+    /* Check that SDS named "Compressed-No-Data" is empty */
+    check_getchunkinfo(fid, "Compressed-No-Data", HDF_NONE, &num_errs);
+
+    /* Check that SDS named "ChunkedData" is NOT empty */
+    check_getchunkinfo(fid, "ChunkedData", HDF_CHUNK, &num_errs);
+
+    /* Check that SDS named "Chunked-No-Data" is empty */
+    check_getchunkinfo(fid, "Chunked-No-Data", HDF_CHUNK, &num_errs);
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "In check_getchunkinfo: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_getchunkinfo */
+
+/* Test drive for testing the API SDcheckempty. */
+extern int
+test_checkempty()
+{
+    int32 fid;
+    intn status;
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("functions involving empty data sets (temptySDSs.c)");
+
+    /* Open the file and initialize the SD interface */
+    fid = SDstart(FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "In test_checkempty: SDstart");
+
+    num_errs = num_errs + test_nonspecial_SDSs(fid);
+    num_errs = num_errs + test_compressed_SDSs(fid);
+    num_errs = num_errs + test_chunked_SDSs(fid);
+    num_errs = num_errs + test_unlimited_SDSs(fid);
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "In test_checkempty: SDend");
+
+    /* This function will reopen the file and check the SDSs in it */
+    num_errs = num_errs + test_with_existing_file();
+
+    /* This function will reopen the file as read-only to test SDgetchunkinfo
+       on empty SDS's */
+    num_errs = num_errs + test_getchunkinfo();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/test1.nc b/mfhdf/test/test1.nc
new file mode 100644
index 0000000..d65c20f
Binary files /dev/null and b/mfhdf/test/test1.nc differ
diff --git a/mfhdf/test/testmfhdf.sh.in b/mfhdf/test/testmfhdf.sh.in
new file mode 100755
index 0000000..3684eda
--- /dev/null
+++ b/mfhdf/test/testmfhdf.sh.in
@@ -0,0 +1,106 @@
+#! /bin/sh
+# Tests for the hdiff tool
+
+srcdir=@srcdir@
+
+CMP='cmp -s'
+DIFF='diff -c'
+
+nerrors=0
+verbose=yes
+
+# Print message with formats according to message level ($1)
+MESG() {
+  level=$1
+  shift
+  case $level in
+    0)
+      echo '============================='
+      echo $*
+      echo '============================='
+      ;;
+    3)
+      echo '-----------------------------'
+      echo $*
+      echo '-----------------------------'
+      ;;
+    6)
+      echo "*** $* ***"
+      ;;
+    *)
+      echo "MESG(): Unknown level ($level)"
+      exit 1
+      ;;
+  esac
+}
+
+
+# Report the result and exit
+FINISH()
+{
+    if [ $nerrors -eq 0 ]
+    then
+        MESG 0 "All mfhdf tests passed"
+    else
+        MESG 0 "mfhdf tests failed: $nerrors"
+    fi
+    exit $nerrors
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+   SPACES="                                                               "
+   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Run a test and print PASS or *FAIL*.  If a test fails then increment
+# the `nerrors' global variable
+#
+RUN() {
+   # Run test.
+   # Tflops interprets "$@" as "" when no parameter is given (e.g., the
+   # case of missing file name).  Changed it to use $@ till Tflops fixes it.
+
+   MESG 0 "HDF-SD C interface tests"
+   ${TESTS_ENVIRONMENT} ./hdftest
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+   
+   MESG 0 "HDF-nc C interface tests"
+   ${TESTS_ENVIRONMENT} ./hdfnctest
+   RET=$?
+   if [ $RET -eq 1 ]; then
+      echo "*FAILED*"
+      nerrors="`expr $nerrors + 1`"
+   fi
+   
+   MESG 0 "netCDF formatted tests"
+   ${TESTS_ENVIRONMENT} ./cdftest > cdfout.new
+   cmd="$DIFF cdfout.new $srcdir/testout.sav";                \
+   echo $cmd;                                                   \
+   if $cmd; then                                                \
+      echo "*** netCDF passes formatted test ***";                \
+   else                                                          \
+      echo "*** netCDF fails formatted test ***";                 \
+      echo "The above differences are OK if small"
+   fi
+}
+
+##############################################################################
+###                       T H E   T E S T S                                ###
+##############################################################################
+
+# Print a beginning banner
+MESG 0 "Running mfhdf tests"
+
+# compare output
+RUN
+
+# End of test, return exit code
+FINISH
+    
\ No newline at end of file
diff --git a/mfhdf/test/testout.sav b/mfhdf/test/testout.sav
new file mode 100644
index 0000000..5568b31
--- /dev/null
+++ b/mfhdf/test/testout.sav
@@ -0,0 +1,21 @@
+dimrename: IXX
+ncclose ret = 0
+
+reopen id = 0 for filename test.cdf
+NC done
+GATTR VAR VATTR
+VATTR
+VATTR
+VATTR
+VATTR
+fill_seq indices	 1 2 3	75.000000 != 2.718282
+Done
+got val = 3.250000
+got val = 0.000000
+got val = 2.718282
+got val = 82555
+got val = 97
+got val = A (0x41) 
+got val = B (0x42) 
+got val = "The red death had long devastated the country."
+re ncclose ret = 0
diff --git a/mfhdf/test/tfile.c b/mfhdf/test/tfile.c
new file mode 100644
index 0000000..a9ba0a5
--- /dev/null
+++ b/mfhdf/test/tfile.c
@@ -0,0 +1,392 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifdef RCSID
+static char RcsId[] = "@(#)$Revision: 5218 $";
+#endif
+
+/* $Id: tfile.c 5218 2009-08-29 04:21:49Z bmribler $ */
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+/********************************************************************
+   Name: test_file_inuse() - tests preventing of an in-use file being 
+			     removed at cleanup time.
+
+   Description: 
+	Sometime, when an error occurs, the cleanup process attempts to 
+	remove a file, which might still be in use (part of bugzilla #376.)  
+	The routine test_file_inuse is to test the fix that provides the 
+	underlaying call to HPisfile_in_use, which should successfully 
+	determines whether a file is still in use before an attempt to remove.
+
+	The main contents include:
+	- a loop that repeatedly calls SDstart/DFACC_CREATE; only the first
+	  SDstart succeeds, the subsequent ones should fail.
+	- SDcreate, SDwritedata, SDendaccess follow
+	- outside of that loop is another loop to call SDend corresponding
+	  to the previous SDstart's
+	- then, at the end, the file will be reopened; if the file doesn't
+	  exist and causes SDstart to fail, the test will fail.
+
+	Before the fix, when the 2nd SDstart/DFACC_CREATE was called and
+	failed because the file was being in use from the first call to
+	SDstart/DFACC_CREATE, the cleaning process removed the file.
+
+   Return value:
+	The number of errors occurred in this routine.
+
+   BMR - Jun 22, 2005
+*********************************************************************/
+
+#define FILE_NAME     "bug376.hdf"	/* data file to test */
+#define DIM0 10
+
+static intn
+test_file_inuse()
+{
+    int32 file_id, sd_id[5], sds_id[5];
+    intn statusn;
+    int32 dims[1], start[1], edges[1], rank;
+    int16 array_data[DIM0];
+    char* names[5] = {"data1", "data2", "data3", "data4", "data5"};
+    intn i, j;
+    intn      num_errs = 0;     /* number of errors so far */
+
+    for (i=0; i<5; i++)
+    {
+        /* Create and open the file and initiate the SD interface. */
+        sd_id[i] = SDstart(FILE_NAME, DFACC_CREATE);
+	if (i == 0) {
+	    CHECK(sd_id[i], FAIL, "SDstart"); } /* 1st SDstart must pass */
+	else {
+	    VERIFY(sd_id[i], FAIL, "SDstart"); }
+	/* subsequent SDstart should fail, which causes the following calls
+	   to fail as well */
+
+        /* Define the rank and dimensions of the data sets to be created. */
+        rank = 1;
+        dims[0] = DIM0;
+        start[0] = 0;
+        edges[0] = DIM0;
+
+        /* Create the array data set. */
+        sds_id[i] = SDcreate(sd_id[i], names[i], DFNT_INT16, rank, dims);
+	if (i == 0) {
+	    CHECK(sds_id[i], FAIL, "SDcreate"); } /* 1st SDcreate must pass */
+	else
+	    VERIFY(sds_id[i], FAIL, "SDcreate");
+
+        /* Fill the stored-data array with values. */
+        for (j = 0; j < DIM0; j++) {
+                        array_data[j] = (i + 1)*(j + 1);
+        }
+
+	/* Write data to the data set */
+	statusn = SDwritedata(sds_id[i], start, NULL, edges, (VOIDP)array_data);
+	if (i == 0) {
+	    CHECK(statusn, FAIL, "SDwritedata"); } /* 1st SDwritedata must pass */
+	else
+	    VERIFY(statusn, FAIL, "SDwritedata");
+
+        /* Terminate access to the data sets. */
+        statusn = SDendaccess(sds_id[i]);
+	if (i == 0) {
+	    CHECK(statusn, FAIL, "SDendaccess"); } /* 1st SDendaccess must pass */
+	else
+	    VERIFY(statusn, FAIL, "SDendaccess");
+
+    } /* for i */
+
+    for (i=0; i<5; i++)
+    {
+        /* Terminate access to the SD interface and close the file. */
+        statusn = SDend (sd_id[i]);
+	if (i == 0) {
+	    CHECK(statusn, FAIL, "SDend"); } /* 1st SDend must pass */
+	else
+	    VERIFY(statusn, FAIL, "SDend");
+    }
+
+    /* Try to open the file, which should exist */
+    file_id = SDstart(FILE_NAME, DFACC_RDWR);
+    CHECK(file_id, FAIL, "SDstart");
+
+    statusn = SDend (file_id);
+    CHECK(statusn, FAIL, "SDend");
+
+    return num_errs;
+}   /* test_file_inuse */
+
+/********************************************************************
+   Name: test_max_open_files() - tests the new API SDreset_maxopenfiles,
+				SDget_maxopenfiles, SDget_numopenfiles,
+				and SDgetfilename.
+
+   Description: 
+	There were multiple requests from the users to increase the maximum
+	number of opened files allowed.  SDreset_maxopenfiles is added to
+	allow the user to reset that value.  The current default value is 32.
+	This API can be called anytime to increase it.  This test routine will 
+	carry out the following tests:
+
+	- Get the current max, should be the default (32,) and the system limit
+	- Reset current max to an arbitrary number that is larger than the 
+	  default and verify
+	- Try to create more files than the current max and all should 
+	  succeed, because NC_open resets the current max to system limit 
+	  automatically, when the number of opened files exceeds the current
+	  max
+	- Get the current max and system limit and verify, current max 
+	  should be the system limit
+	- Get the current max another way, it should be the system limit again
+	- Get the current number of files being opened
+	- Reset current max to a value that is smaller than the current
+	  number of opened files; it shouldn't reset
+	- Reset current max again to a value that is smaller than the
+	  current max but larger than the current number of opened files,
+	  that should work for there is no information loss
+	- Try to create more files up to the system limit or NUM_FILES_HI,
+	  because the arrays have max NUM_FILES_HI elements in this test
+	- Close all the files, then try opening all again to verify their 
+	  names, this is to test bugzilla 440
+
+   Return value:
+	The number of errors occurred in this routine.
+
+   BMR - Oct 14, 2005
+*********************************************************************/
+
+#define NUM_FILES_LOW 35
+#define NUM_FILES_HI  1024
+
+static int test_max_open_files()
+{
+    int32 fids[NUM_FILES_HI];		/* holds IDs of opened files */
+    char  filename[NUM_FILES_HI][10];	/* holds generated file names */
+    char  readfname[H4_MAX_NC_NAME];	/* file name retrieved from file id */
+    intn  index, status,
+	  curr_max, 	/* curr maximum number of open files allowed in HDF */
+	  sys_limit, 	/* maximum number of open files allowed by system */
+	  curr_max_bk,  /* back up of curr_max */
+	  curr_opened,	/* number of files currently being opened */
+	  temp_limit,	/* temp var - num of files to be opened in this test */
+	  num_errs = 0;	/* number of errors so far */
+
+    /* Get the current max and system limit */
+    status = SDget_maxopenfiles(&curr_max, &sys_limit);
+    CHECK(status, FAIL, "test_maxopenfiles: SDget_maxopenfiles");
+    VERIFY(curr_max, H4_MAX_NC_OPEN, "test_maxopenfiles: SDreset_maxopenfiles");
+
+    /* Reset current max to an arbitrary number and check */
+    curr_max = SDreset_maxopenfiles(33);
+    CHECK(status, FAIL, "test_maxopenfiles: SDreset_maxopenfiles");
+    VERIFY(curr_max, 33, "test_maxopenfiles: SDreset_maxopenfiles");
+
+    /* Try to create more files than the default max (currently, 32) and
+       all should succeed */
+    for (index=0; index < NUM_FILES_LOW; index++)
+    {
+	/* Create a file */
+	sprintf(filename[index], "file%i", index);
+	fids[index] = SDstart(filename[index], DFACC_CREATE);
+	CHECK(fids[index], FAIL, "test_maxopenfiles: SDstart");
+    }
+
+    /* Verify that NUM_FILES_LOW files are opened */
+    curr_opened = SDget_numopenfiles();
+    VERIFY(curr_opened, NUM_FILES_LOW, "test_maxopenfiles: SDget_numopenfiles");
+
+    /* Now randomly close 3 files and check number of opened files */
+    status = SDend(fids[5]);
+    CHECK(status, FAIL, "test_maxopenfiles: SDend");
+    status = SDend(fids[15]);
+    CHECK(status, FAIL, "test_maxopenfiles: SDend");
+    status = SDend(fids[25]);
+    CHECK(status, FAIL, "test_maxopenfiles: SDend");
+    curr_opened = SDget_numopenfiles();
+    VERIFY(curr_opened, NUM_FILES_LOW-3, "test_maxopenfiles: SDget_numopenfiles");
+
+    /* Get the current max and system limit */
+    status = SDget_maxopenfiles(&curr_max, &sys_limit);
+    CHECK(status, FAIL, "test_maxopenfiles: SDget_maxopenfiles");
+    VERIFY(curr_max, sys_limit, "test_maxopenfiles: SDreset_maxopenfiles");
+
+    /* Get the current max another way, it should be the system limit */
+    curr_max = SDreset_maxopenfiles(0);
+    VERIFY(curr_max, sys_limit, "test_maxopenfiles: SDreset_maxopenfiles");
+
+    /* Reopen the 3 files above, and check the number of opened files again */
+    fids[5] = SDstart(filename[5], DFACC_RDWR);
+    CHECK(fids[5], FAIL, "test_maxopenfiles: SDstart");
+    fids[15] = SDstart(filename[15], DFACC_RDWR);
+    CHECK(fids[15], FAIL, "test_maxopenfiles: SDstart");
+    fids[25] = SDstart(filename[25], DFACC_RDWR);
+    CHECK(fids[25], FAIL, "test_maxopenfiles: SDstart");
+    curr_opened = SDget_numopenfiles();
+    VERIFY(curr_opened, NUM_FILES_LOW, "test_maxopenfiles: SDget_numopenfiles");
+
+    /* Reset current max to a value that is smaller than the current 
+       number of opened files; it shouldn't reset */
+    curr_max_bk = curr_max;
+    curr_max = SDreset_maxopenfiles(curr_opened-1);
+    VERIFY(curr_max, curr_max_bk, "test_maxopenfiles: SDreset_maxopenfiles");
+
+    /* Reset current max again to a value that is smaller than the 
+       current max but larger than the current number of opened files, 
+       that should work for there is no information loss */
+    curr_max = SDreset_maxopenfiles(curr_opened+3);
+    VERIFY(curr_max, curr_opened+3, "test_maxopenfiles: SDreset_maxopenfiles");
+
+    /* Try to create more files up to the system limit or NUM_FILES_HI,
+       because the arrays have max NUM_FILES_HI elements in this test */
+    temp_limit = sys_limit / 2;
+    temp_limit = temp_limit > NUM_FILES_HI ? NUM_FILES_HI : temp_limit;
+    for (index=NUM_FILES_LOW; index < temp_limit; index++)
+    {
+        /* Create a file */
+	sprintf(filename[index], "file%i", index);
+	fids[index] = SDstart(filename[index], DFACC_CREATE);
+
+        /* if SDstart fails due to "too many open files," then adjust
+           temp_limit so that further failure can be prevented, i.e.
+           following SDend and SDstart */
+        if ((fids[index] == FAIL) && (HEvalue(1) == DFE_TOOMANY))
+            temp_limit = index;
+
+        /* only CHECK returned value from SDstart if the failure wasn't
+           because of "too many open files" -BMR 2006/11/01 */
+        else
+            CHECK(fids[index], FAIL, "test_maxopenfiles: SDstart");
+    }
+
+    /* Close all the files, then try opening all again to verify their 
+       names, this is to test bugzilla 440 */
+    for (index=0; index < temp_limit; index++)
+    {
+	status = SDend(fids[index]);
+	CHECK(status, FAIL, "test_maxopenfiles: SDend");
+
+	fids[index] = SDstart(filename[index], DFACC_RDWR);
+	CHECK(fids[index], FAIL, "test_maxopenfiles: SDstart");
+    }
+
+    /* Verify their names */
+    for (index=0; index < temp_limit; index++)
+    {
+	status = SDgetfilename(fids[index], readfname);
+	CHECK(status, FAIL, "test_maxopenfiles: SDgetfilename");
+
+	/* Verify the file name retrieved against the original */
+	if (HDstrcmp(readfname, filename[index]))
+	{
+	    fprintf(stderr, "SDgetfilename: incorrect file being opened - expected <%s>, retrieved <%s>\n", filename[index], readfname);
+	}
+    }
+
+    /* Close then remove all the files */
+    for (index=0; index < temp_limit; index++)
+    {
+	status = SDend(fids[index]);
+	CHECK(status, FAIL, "test_maxopenfiles: SDend");
+	remove(filename[index]);
+    }
+    return num_errs;
+}
+
+/********************************************************************
+   Name: test_longfilename() - tests that the library can handle a very
+				long file name (bugzilla 1331.)
+
+   Description: 
+	The main contents include:
+	- create a file with very long name
+	- create a dataset and close it (this is to activate the failure)
+	- SDend to close the file, and it would cause segfault before the
+	  fix was applied.
+
+   Return value:
+	The number of errors occurred in this routine.
+
+   BMR - Jan 16, 2009
+*********************************************************************/
+
+#define NX 2
+#define NY 3
+static int
+test_longfilename()
+{
+    int32 fid;                  /* file id */
+    int32 dset1;                /* dataset ids */
+    int32 dims[2];              /* variable shapes */
+    int   ii;
+    char dsname[10];
+    char filename[256];
+    intn  status = 0;           /* status returned by called functions */
+    intn  num_errs = 0;         /* number of errors so far */
+
+    strcpy(dsname, "dataset 1");
+    strcpy(filename, "This file name has quite a few characters because it is used to test the fix of bugzilla 1331. It has to be at least this long to see.");
+
+    /* enter define mode */
+    fid = SDstart(filename, DFACC_CREATE);
+    CHECK(fid, FAIL, "test_longfilename: SDstart");
+
+    /* Define dimension of the data set to be created. */
+    dims[0] = NX;
+    dims[1] = NY;
+
+    /* Create a dataset to reproduce the problem before the fix */
+    dset1 = SDcreate(fid, dsname, DFNT_FLOAT32, 2, dims);
+    CHECK(dset1, FAIL, "test_longfilename: SDcreate");
+
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "test_longfilename: SDendaccess");
+
+    status = SDend(fid);
+    CHECK(fid, FAIL, "test_longfilename: SDend");
+
+    return num_errs;
+}
+
+
+/* Test driver for testing miscellaneous file related APIs. */
+extern int
+test_files()
+{
+    intn num_errs = 0;         /* number of errors */
+
+    /* Output message about test being performed */
+    TESTING("miscellaneous file related functions (tfile.c)");
+
+    /* test that an in-use file is not removed in certain failure 
+       cleanup. 06/21/05 - bugzilla 376 - BMR */
+    num_errs = num_errs + test_file_inuse();
+
+    /* test APIs that were added for fixing bugzilla 396 and 440.  
+       09/07/05 - BMR */
+    num_errs = num_errs + test_max_open_files();
+
+    /* test the fix of bugzzila 1331. 01/16/09 - BMR */
+    num_errs = num_errs + test_longfilename();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
+
+#endif /* HDF */
+
diff --git a/mfhdf/test/tmixed_apis.c b/mfhdf/test/tmixed_apis.c
new file mode 100644
index 0000000..1c0bc4c
--- /dev/null
+++ b/mfhdf/test/tmixed_apis.c
@@ -0,0 +1,562 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tmixed_apis.c - tests the API functions:
+ *	SDidtype
+ *	Vgetvgroups
+ *	VSgetvdatas
+ *	Vgisinternal
+ * Structure of the file:
+ *    test_mixed_apis - test driver
+ *	  test_SDAPI_ids    - tests SDidtype on SD API ids: sd, sds, dim ids
+ *	  test_nonSDAPI_ids - tests SDidtype on non SD API ids and invalid id
+ *	  test_vdatavgroups - tests Vgetvgroups and VSgetvdatas
+ *	  test_vgisinternal - tests Vgisinternal
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define IDTYPE_FILE     "idtypes.hdf"	/* data file to test ID types */
+#define X_LENGTH      10
+#define Y_LENGTH      10
+#define RANK          2
+
+/*
+ Tests SDidtype on SD API ids: sd, sds, dim ids
+*/
+static intn
+test_SDAPI_ids()
+{
+    int32     fid, dset1, dset2, dim_id;
+    int32     dimsize[RANK];
+    hdf_idtype_t id_type;
+    intn      status;
+    intn      num_errs = 0;         /* number of errors so far */
+
+    /* Create a file */
+    fid = SDstart(IDTYPE_FILE, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Create an X_LENGTH by Y_LENGTH dataset, called DataSet_1 */
+    dimsize[0] = X_LENGTH;
+    dimsize[1] = Y_LENGTH;
+    dset1 = SDcreate(fid, "DataSet_1", DFNT_INT32, RANK, dimsize);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    /* Create another X_LENGTH by Y_LENGTH dataset, called DataSet_2 */
+    dset2 = SDcreate(fid, "DataSet_2", DFNT_FLOAT64, RANK, dimsize);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Test SDidtype on the second dataset */
+    id_type = SDidtype(dset2);
+    VERIFY(id_type, SDS_ID, "SDidtype: id_type");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Re-open the file to test SDidtype more */
+    fid = SDstart(IDTYPE_FILE, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Test SDidtype on the SD id */
+    id_type = SDidtype(fid);
+    VERIFY(id_type, SD_ID, "SDidtype: id_type");
+
+    /* Get access to the first dataset and test SDidtype on the SDS id */
+    dset1 = SDselect(fid, 0);
+    CHECK(dset1, FAIL, "SDselect");
+    id_type = SDidtype(dset1);
+    VERIFY(id_type, SDS_ID, "SDidtype: id_type");
+
+    /* Get access to the second dataset and test SDidtype on the SDS id */
+    dset2 = SDselect(fid, 1);
+    CHECK(dset2, FAIL, "SDselect");
+    id_type = SDidtype(dset2);
+    VERIFY(id_type, SDS_ID, "SDidtype: id_type");
+
+    /* Get dimension handle for first dimension of DataSet_1 and test
+       SDidtype on the dimension id */
+    dim_id = SDgetdimid(dset1, 0);
+    CHECK(dim_id, FAIL, "SDgetdimid");
+    id_type = SDidtype(dim_id);
+    VERIFY(id_type, DIM_ID, "SDidtype dim_id");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_SDAPI_ids */
+
+/*
+ Tests SDidtype on non SD API ids and invalid id.
+*/
+static intn
+test_nonSDAPI_ids ()
+{
+    int32     fid, gr_id, vdata_id, ri_id;
+    int32     vdata_ref;
+    intn      status;
+    int32     dims[2]={4,5};    /* dimensions for the empty image */
+    hdf_idtype_t id_type;
+    intn      num_errs = 0;     /* number of errors so far */
+
+    /* Open the HDF file */
+    fid = Hopen(IDTYPE_FILE, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen: tidtype.hdf");
+
+    /* Initialize HDF for subsequent vdata access */
+    status = Vstart(fid);
+    CHECK(status, FAIL, "Vstart");
+
+    /* Create a new vdata and give it a name */
+    vdata_id = VSattach(fid, -1, "w");
+    CHECK(vdata_id, FAIL, "VSattach");
+    status = VSsetname(vdata_id, "Vdata_1");
+    CHECK(status, FAIL, "VSsetname");
+
+    /* Terminate access to the vdata */
+    status = VSdetach(vdata_id);
+    CHECK(status, FAIL, "VSdetach");
+
+    /* Terminate access to the Vxxx interface and close the file */
+    status = Vend(fid);
+    CHECK(status, FAIL, "Vend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Open the HDF file again to test SDidtype */
+    fid = Hopen(IDTYPE_FILE, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen: tidtype.hdf");
+
+    /* Initialize HDF for subsequent vdata accesses */
+    status = Vstart(fid);
+    CHECK(status, FAIL, "Vstart");
+
+    /* Get access to the vdata "Vdata_1" via its reference number */
+    vdata_ref = VSfind(fid, "Vdata_1");
+    CHECK(vdata_ref, FAIL, "VSfind");
+    vdata_id = VSattach(fid, vdata_ref, "w");
+    CHECK(vdata_id, FAIL, "VSattach");
+
+    /* Test SDidtype on the vdata id */
+    id_type = SDidtype(vdata_id);
+    VERIFY(id_type, NOT_SDAPI_ID, "SDidtype: id_type");
+
+    /* Terminate access to the vdata */
+    status = VSdetach(vdata_id);
+    CHECK(status, FAIL, "VSdetach");
+
+    /* Terminate access to the Vxxx interface and close the file */
+    status = Vend(fid);
+    CHECK(status, FAIL, "Vend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Test SDidtype on a GR raster image */
+
+    /* Open file and initialize the GR interface */
+    fid = Hopen(IDTYPE_FILE, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen: tidtype.hdf");
+    gr_id = GRstart(fid);
+    CHECK(gr_id, FAIL, "GRstart");
+
+    /* Create an empty image with default fill value */
+    ri_id = GRcreate(gr_id, "Empty Image", 3, DFNT_FLOAT32, 
+		MFGR_INTERLACE_PIXEL, dims);
+    CHECK(ri_id, FAIL, "GRcreate");
+
+    /* Test SDidtype on the GR raster image id */
+    id_type = SDidtype(ri_id);
+    VERIFY(id_type, NOT_SDAPI_ID, "SDidtype: id_type");
+
+    /* Close the image */
+    status = GRendaccess(ri_id);
+    CHECK(status, FAIL, "GRendaccess");
+
+    /* Shut down the GR interface and close the file */
+    status = GRend(gr_id);
+    CHECK(status, FAIL, "GRend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_nonSDAPI_ids */
+
+
+/****************************************************************************
+ * test_vdatavgroups - tests the API functions Vgetvgroups and VSgetvdatas.
+ *   - Create an SD file and several datasets
+ *   - Set attributes to some dimensions to promote them to coordinate
+ *	  variables, which will be represented by internally created vgroups.
+ *	  The datasets are also represented by internally created vgroups
+ *   - Close the file then re-open it with V API
+ *   - Create several vgroups and vdatas then close the file
+ *   - The file now contains beside the vgroups and vdatas previously created
+ *	by the application.
+ *	+ a vgroup of class CDF0.0 to represent the SD file
+ *	+ various vgroups of class "Var0.0" for SDSs and coordinate variables
+ *	+ various vdatas of class "Dim0.0" for dimensions
+ *	+ various vdatas of class "Attr0.0" for attributes
+ *	+ and more
+ *   - Reopen the file using V API
+ *   - Verify that Vgetvgroups and VSgetvdatas return only the vgroups and
+ *     vdatas that were created by the application.
+ * Mar 4, 2011 -BMR
+****************************************************************************/
+/* data file to test getting vgs/vds from an SD file */
+#define VVS_FILE   "tvdatasvgroups_SD.hdf"
+#define ATTR1_NAME  "Valid_range 1"
+#define ATTR2_NAME  "Unit"
+#define X_LENGTH    10
+#define Y_LENGTH    10
+#define RANK        2
+#define NUM_VGS     3
+#define NUM_VDS     1
+
+static intn
+test_vdatavgroups()
+{
+    int32   fid, dset1, dset2, dset3, dimid, vgroup_id, vdata_id;
+    int32   num_allvgroups, num_allvdatas;
+    intn    num_vgroups, num_vdatas;
+    int32   dimsize[RANK];
+    float32 att1_values[2] = {2., 10.};
+    char8   att2_values[]  = "Seconds";
+    uint16 *refarray=NULL;
+    uint16  name_len=0;
+    intn    ii, status;
+    char   *vg_name=NULL, vd_name[10];
+    const char   *check_vg_names[3] = {"Vgroup_1", "Vgroup_2", "Vgroup_3"};
+    const char   *check_vd_names[1] = {"Vdata_1"};
+    intn    num_errs = 0;     /* number of errors so far */
+
+    /* Create a file */
+    fid = SDstart(VVS_FILE, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Create an X_LENGTH by Y_LENGTH dataset, called DataSet_1 */
+    dimsize[0] = X_LENGTH;
+    dimsize[1] = Y_LENGTH;
+    dset1 = SDcreate(fid, "DataSet_1", DFNT_INT32, RANK, dimsize);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    /* Set attribute to first dimension of first data set */
+    dimid = SDgetdimid (dset1, 0);
+    CHECK(dimid, FAIL, "SDgetdimid");
+    status = SDsetattr (dimid, ATTR1_NAME, DFNT_FLOAT32, 2, (VOIDP)att1_values);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Create another X_LENGTH by Y_LENGTH dataset, called DataSet_2 */
+    dset2 = SDcreate(fid, "DataSet_2", DFNT_FLOAT64, RANK, dimsize);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Set attribute to second dimension of second data set */
+    dimid = SDgetdimid (dset2, 1);
+    CHECK(dimid, FAIL, "SDgetdimid");
+    status = SDsetattr (dimid, ATTR2_NAME, DFNT_CHAR, 7, (VOIDP)att2_values);
+    CHECK(status, FAIL, "SDsetattr");
+
+    /* Create another X_LENGTH by Y_LENGTH dataset, called DataSet_2 */
+    dset3 = SDcreate(fid, "DataSet_3", DFNT_FLOAT64, RANK, dimsize);
+    CHECK(dset3, FAIL, "SDcreate");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset3);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Open the HDF file and initialize the V interface */
+    fid = Hopen(VVS_FILE, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen: tidtype.hdf");
+    status = Vstart(fid);
+    CHECK(status, FAIL, "Vstart");
+
+    /*   num_allvgroups = Hnumber(fid, DFTAG_VG);
+    CHECK(num_allvgroups, FAIL, "Hnumber");
+    keep for debugging only */ 
+
+    /* Get the number of user-created vgroups */
+    num_vgroups = Vgetvgroups(fid, 0, 0, NULL);
+    CHECK(num_vgroups, FAIL, "Vgetvgroups");
+    VERIFY(num_vgroups, 0, "Vgetvgroups");
+
+    /* There are internally created vds because of attributes and dimensions */
+    num_allvdatas = Hnumber(fid, DFTAG_VH);
+    CHECK(num_allvdatas, FAIL, "Hnumber");
+    CHECK(num_allvdatas, 0, "Hnumber");  /* so num_allvdatas shouldn't be 0 */
+
+    /* Get the number of user-created vdatas */
+    num_vdatas = VSgetvdatas(fid, 0, 0, NULL);
+    CHECK(num_vdatas, FAIL, "VSgetvdatas");
+    VERIFY(num_vdatas, 0, "VSgetvdatas");
+
+    /* Create several vgroups and vdatas and give them a name */
+    vgroup_id = Vattach(fid, -1, "w");
+    CHECK(vgroup_id, FAIL, "Vattach");
+    status = Vsetname(vgroup_id, "Vgroup_1");
+    CHECK(status, FAIL, "Vsetname");
+    status = Vdetach(vgroup_id);
+    CHECK(status, FAIL, "Vdetach");
+
+    vgroup_id = Vattach(fid, -1, "w");
+    CHECK(vgroup_id, FAIL, "Vattach");
+    status = Vsetname(vgroup_id, "Vgroup_2");
+    CHECK(status, FAIL, "Vsetname");
+    status = Vdetach(vgroup_id);
+    CHECK(status, FAIL, "Vdetach");
+
+    vgroup_id = Vattach(fid, -1, "w");
+    CHECK(vgroup_id, FAIL, "Vattach");
+    status = Vsetname(vgroup_id, "Vgroup_3");
+    CHECK(status, FAIL, "Vsetname");
+    status = Vdetach(vgroup_id);
+    CHECK(status, FAIL, "Vdetach");
+
+    vdata_id = VSattach(fid, -1, "w");
+    CHECK(vdata_id, FAIL, "VSattach");
+    status = VSsetname(vdata_id, "Vdata_1");
+    CHECK(status, FAIL, "VSsetname");
+    status = VSdetach(vdata_id);
+    CHECK(status, FAIL, "VSdetach");
+
+    /* Terminate access to the Vxxx interface and close the file */
+    status = Vend(fid);
+    CHECK(status, FAIL, "Vend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Open the HDF file again to test Vgetvgroups */
+    fid = Hopen(VVS_FILE, DFACC_RDWR, 0);
+    CHECK(fid, FAIL, "Hopen: tidtype.hdf");
+    status = Vstart(fid);
+    CHECK(status, FAIL, "Vstart");
+
+    /* Get the number of user-created vgroups */
+    num_vgroups = Vgetvgroups(fid, 0, 0, NULL);
+    CHECK(num_vgroups, FAIL, "Vgetvgroups");
+    VERIFY(num_vgroups, NUM_VGS, "Vgetvgroups");
+
+    /* Allocate sufficient memory to hold the list of user-created vg refs */
+    refarray = (uint16 *)HDmalloc(sizeof(uint16) * num_vgroups);
+    CHECK(refarray, NULL, "HDmalloc: no space");
+
+    /* Now, get the user-created vgroup refs */
+    status = Vgetvgroups(fid, 0, num_vgroups, refarray);
+    CHECK(status, FAIL, "Vgetvgroups");
+    VERIFY(status, num_vgroups, "Vgetvgroups");
+
+    /* Verify the name of these user-created vgroups */
+    for (ii = 0; ii < num_vgroups; ii++)
+    {
+	vgroup_id = Vattach(fid, refarray[ii], "r");
+	CHECK(vgroup_id, FAIL, "Vattach");
+
+	status = Vgetnamelen(vgroup_id, &name_len);
+	CHECK(status, FAIL, "Vgetnamelen");
+
+	vg_name = (char *)HDmalloc((sizeof(char) * name_len) + 1);
+	CHECK(vg_name, NULL, "HDmalloc: no space");
+
+	status = Vgetname(vgroup_id, vg_name);
+	CHECK(status, FAIL, "Vgetname");
+
+	VERIFY_CHAR(vg_name, check_vg_names[ii], "");
+
+	if (strncmp(vg_name, check_vg_names[ii], name_len) != 0)
+	    fprintf(stderr, "vg %d: name is %s, should be %s\n", ii, vg_name, check_vg_names[ii]);
+	status = Vdetach(vgroup_id);
+	CHECK(status, FAIL, "Vdetach");
+    }
+
+    /* Get the number of user-created vdatas */
+    num_vdatas = VSgetvdatas(fid, 0, 0, NULL);
+    CHECK(num_vdatas, FAIL, "VSgetvdatas");
+    VERIFY(num_vdatas, NUM_VDS, "VSgetvdatas");
+
+    /* Allocate sufficient memory to hold the list of user-created vd refs */
+    refarray = (uint16 *)HDmalloc(sizeof(uint16) * num_vdatas);
+    CHECK(refarray, NULL, "HDmalloc: no space");
+
+    /* Now, get the user-created vdata refs */
+    status = VSgetvdatas(fid, 0, num_vdatas, refarray);
+    CHECK(num_vdatas, FAIL, "VSgetvdatas");
+    VERIFY(status, num_vdatas, "VSgetvdatas");
+
+    /* Verify the name of these user-created vdatas */
+    for (ii = 0; ii < num_vdatas; ii++)
+    {
+	vdata_id = VSattach(fid, refarray[ii], "r");
+	CHECK(vdata_id, FAIL, "VSattach");
+
+	status = VSgetname(vdata_id, vd_name);
+	CHECK(status, FAIL, "VSgetname");
+
+	VERIFY_CHAR(vd_name, check_vd_names[ii], "");
+
+	if (strncmp(vd_name, check_vd_names[ii], name_len) != 0)
+	    fprintf(stderr, "vd %d: name is %s, should be %s\n", ii, vd_name, check_vd_names[ii]);
+	status = VSdetach(vdata_id);
+	CHECK(status, FAIL, "VSdetach");
+    }
+
+    /* Terminate access to the Vxxx interface and close the file */
+    status = Vend(fid);
+    CHECK(status, FAIL, "Vend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_vdatavgroups */
+
+
+/****************************************************************************
+ * test_vgisinternal - tests the API function Vgisinternal
+ *   - Use the existing files created by test_vdatavgroups
+ *   - Get the number of vgroups in the file
+ *   - For each vgroup, verify that it is internal or not
+ * Jan 6, 2012 -BMR
+****************************************************************************/
+
+#define VVS_FILE   "tvdatasvgroups_SD.hdf"
+#define GR_FILE    "grtdfui83.hdf"
+static intn
+test_vgisinternal()
+{
+    int32   fid, vgroup_id;
+    intn    is_internal = FALSE;
+    int32   vref = -1;
+    intn    ii, status;
+    char    internal_array1[20] = {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
+                         TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE};
+    char    internal_array2[9] = {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
+			 TRUE, TRUE};
+    intn    num_errs = 0;     /* number of errors so far */
+
+    /* Open the HDF file and initialize the V interface */
+    fid = Hopen(VVS_FILE, DFACC_READ, 0);
+    CHECK(fid, FAIL, "Hopen: tvdatasvgroups_SD.hdf");
+    status = Vstart(fid);
+    CHECK(status, FAIL, "Vstart");
+
+    ii = 0;
+    while ((vref = Vgetid(fid, vref)) != FAIL)
+    {     /* until no more vgroups */
+	vgroup_id = Vattach(fid, vref, "r"); /* attach to vgroup */
+
+	/* Test that the current vgroup is or is not internal as specified in
+	   the array */
+	is_internal = Vgisinternal(vgroup_id);
+	CHECK(is_internal, FAIL, "Vgisinternal");
+	VERIFY(is_internal, internal_array1[ii], "Vgisinternal");
+
+	status = Vdetach(vgroup_id);
+	CHECK(status, FAIL, "Vdetach");
+
+	ii++;
+    }
+
+    /* Terminate access to the V interface and close the file */
+    status = Vend(fid);
+    CHECK(status, FAIL, "Vend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Use a GR file to test Vgisinternal on internal vgroups */
+
+    /* Open the old HDF file and initialize the V interface */
+    fid = Hopen(IDTYPE_FILE, DFACC_READ, 0);
+    CHECK(fid, FAIL, "Hopen: idtypes.hdf");
+    status = Vstart(fid);
+    CHECK(status, FAIL, "Vstart");
+
+    ii = 0;
+    while ((vref = Vgetid(fid, vref)) != FAIL)
+    {     /* until no more vgroups */
+	vgroup_id = Vattach(fid, vref, "r"); /* attach to vgroup */
+
+	/* Test that the current vgroup is or is not internal as specified in
+	   the array */
+	is_internal = Vgisinternal(vgroup_id);
+	CHECK(is_internal, FAIL, "Vgisinternal");
+  	VERIFY(is_internal, internal_array2[ii], "Vgisinternal");
+
+	status = Vdetach(vgroup_id);
+	CHECK(status, FAIL, "Vdetach");
+
+	ii++; /* increment vgroup index */
+    }
+
+    /* Terminate access to the V interface and close the file */
+    status = Vend(fid);
+    CHECK(status, FAIL, "Vend");
+    status = Hclose(fid);
+    CHECK(status, FAIL, "Hclose");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_vgisinternal */
+
+
+/* Test driver for testing the API functions SDidtype, Vgetvgroups, 
+   VSgetvdatas, and Vgisinternal. */
+extern int
+test_mixed_apis()
+{
+    intn num_errs = 0;         /* number of errors */
+
+    /* Output message about test being performed */
+    TESTING("a mix of SD, V, and VS functions (tmixed_apis.c)");
+
+    num_errs = num_errs + test_SDAPI_ids();
+    num_errs = num_errs + test_nonSDAPI_ids();
+
+    /* Test Vgetvgroups and VSgetvdatas */
+    num_errs = num_errs + test_vdatavgroups();
+
+    /* Test Vgisinternal */
+    num_errs = num_errs + test_vgisinternal();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/tncunlim.c b/mfhdf/test/tncunlim.c
new file mode 100644
index 0000000..4ce6854
--- /dev/null
+++ b/mfhdf/test/tncunlim.c
@@ -0,0 +1,876 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tncunlim.c - tests reading/writing variables with unlimited dimension using
+ *		nc API.  The tests here are added to test the behavior of the
+ *		library when dealing with unlimited dimensions via nc API.  The
+ *		tests show that the data is correctly written/read when:
+ *		+ data added immediately after last record
+ *		+ data added skipping one or more records
+ *		+ data overridden existing data
+ *		+ data read pass the end of that variable but not the max in 
+ *		  all the variables in the file (on going)
+ *
+ * Structure of the file:
+ *    test_ncunlim - test driver
+ *        test_1dim_singlevar - tests on a single variable with only 1 dimension
+ *        test_1dim_multivars - tests on multiple variables with only 1 dimension
+ *        test_multidim_singlevar - tests on single variable with multiple dimensions
+ * BMR - Dec 22, 2008
+****************************************************************************/
+
+#include "mfhdf.h"
+#include "hdftest.h"
+
+/********************************************************************
+   Name: test_1dim_singlevar() - tests on a single variable with only 1 dimension
+
+   Description:
+        The main contents include:
+        - write 4 elements starting at index 0
+        - append 2 elements starting at index 6, that is indices 4 and 5 will
+	  be written with fill value
+        - append 3 elements immediately at the end of the data
+        - overwrite indices 0 and 1
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 22, 2008
+*********************************************************************/
+
+#define DIM0 20
+#define FILENAME1 "onedimonevar.nc"
+static int test_1dim_singlevar()
+{
+    int   ncid;			/* file id */
+    int   varid;		/* variable id */
+    int   time_dim;		/* unlimited dimension */
+    int   dims[1];		/* variable shapes */
+    long  dimsize = 0;		/* dimension size buffer */
+    short outdata[DIM0];	/* data read back */
+    char  varname[11];		/* variable name */
+    nc_type rh_type;		/* variable type */
+    int   rh_ndims;		/* number of dims */
+    int   rh_dims[H4_MAX_VAR_DIMS];	/* variable shape */
+    int   rh_natts;		/* number of attributes */
+    int   ii;
+    short fillval = 99;		/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data; the first two elements will
+	be changed to "1,2" later for the last test. */
+    short result[] = {320,301,301,302,99,99,30,31,801,802,803};
+
+    /* Enter define mode */
+    ncid = nccreate(FILENAME1, NC_CLOBBER);
+    CHECK(ncid, -1, "nccreate");
+
+    /* Variables will be filled with fill values when data is missing */
+    status = ncsetfill(ncid, NC_FILL);
+    CHECK(status, -1, "ncsetfill");
+
+    /* Define the unlimited dimension */
+    time_dim = ncdimdef(ncid, "time", NC_UNLIMITED);
+    CHECK(status, -1, "ncdimdef");
+
+    /* Define the variable */
+    dims[0] = time_dim;
+    varid = ncvardef (ncid, "Variable 1", NC_SHORT, 1, dims);
+    CHECK(varid, -1, "ncvardef");
+
+    /* write the fill value attribute */
+    status = ncattput(ncid, varid, "_FillValue", NC_SHORT, 1, &fillval );
+    CHECK(status, -1, "ncattput");
+
+    /* leave define mode */
+    status = ncendef (ncid);
+    CHECK(status, -1, "ncendef");
+
+    {  /* write data the first time */
+	long rh_start[] = {0};	/* starting writing at beginning, index 0 */
+	long rh_edges[] = {4};	/* four elements */
+	short data[] = { 320,301,301,302};
+
+	/* write 4 elements starting at index 0 */
+	status = ncvarput(ncid, varid, rh_start, rh_edges, (void *)data);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get variable information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    /* Close file */
+    status = ncclose (ncid);
+    CHECK(status, -1, "ncclose");
+
+    /* Open file for reading and writing */
+    ncid = ncopen(FILENAME1, NC_RDWR);
+    CHECK(ncid, -1, "ncopen");
+
+    /* Get access to the variable */
+    varid = ncvarid(ncid, "Variable 1");
+    CHECK(varid, -1, "ncvarid");
+
+    /* Get and verify variable info and size of the unlimited dimension again */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    { /* read and verify data of the variable */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* verify data, should be "320 301 301 302" */
+	for (ii = 0; ii < dimsize; ii++) {
+	    if (outdata[ii] != result[ii])
+                fprintf(stderr,"test_1dim_singlevar: Read data %d doesn't match input %d at index %d\n", outdata[ii], result[ii], ii);
+	}
+    } /* end read data */
+
+    {  /* Append data to variable pass the end */
+	long rh_start[] = {6};	/* the end is 3 */
+	long rh_edges[] = {2};	/* two elements */
+	short data[] = { 30,31};
+
+	/* write 2 values starting at index 6 */
+	status = ncvarput(ncid, varid, rh_start, rh_edges, (void *)data);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get and verify variable info and size of the unlimited dimension again */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 8, "ncdiminq");
+
+    { /* read variable after appending with gap */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* verify data, should be "320,301,301,302,99,99,30,31" where 99 is 
+	   fillvalue */
+	for (ii = 0; ii < edges[0]; ii++) {
+	    if (outdata[ii] != result[ii])
+                fprintf(stderr,"test_1dim_singlevar: Read data %d doesn't match input %d at index %d\n", outdata[ii], result[ii], ii);
+	}
+    } /* end read data */
+
+    {  /* write variable immediately pass the end */
+	long rh_start[] = {0};
+	long rh_edges[] = {3};
+	short data[] = { 801,802,803};
+	rh_start[0] = dimsize;	/* starting immediatly pass dimension size */
+
+	/* write 3 elements to the variable starting at 'dimsize' */
+	status = ncvarput(ncid, varid, rh_start, rh_edges, (void *)data);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get and verify variable info and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 11, "ncdiminq");
+
+    { /* read variable */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0+2);
+	status = ncvarget(ncid, varid, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* verify data, should be "320,301,301,302,99,99,30,31,801,802,803"
+	   where 99 is fill value */
+	for (ii = 0; ii < edges[0]; ii++) {
+	    if (outdata[ii] != result[ii])
+                fprintf(stderr,"test_1dim_singlevar: Read data %d doesn't match input %d at index %d\n", outdata[ii], result[ii], ii);
+	}
+    } /* end read data */
+
+    {  /* write variable to override current values */
+	long rh_start[] = {0};	/* starting at the beginning */
+	long rh_edges[] = {2};	/* two values */
+	short data[] = { 1,2};
+
+	/* write 2 elements overriding the first two values */
+	status = ncvarput(ncid, varid, rh_start, rh_edges, (void *)data);
+	CHECK(status, -1, "ncvarput");
+
+	/* change expected data too */
+	result[0] = 1;
+	result[1] = 2;
+    }
+
+    /* Get and verify variable info and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 11, "ncdiminq");
+
+    { /* read and verify data */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize;
+
+	HDmemset(outdata, 0, DIM0+2);
+	status = ncvarget(ncid, varid, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* verify data, should be "1,2,301,302,99,99,30,31,801,802,803"
+	   where 99 is fill value, and first and second values are new */
+	for (ii = 0; ii < edges[0]; ii++) {
+	    if (outdata[ii] != result[ii])
+                fprintf(stderr,"test_1dim_singlevar: Read data %d doesn't match input %d at index %d\n", outdata[ii], result[ii], ii);
+	}
+    } /* end read data */
+
+    /* Close file */
+    status = ncclose(ncid);
+    CHECK(status, -1, "ncclose");
+
+    return 0;
+} /* test_1dim_singlevar */
+
+
+/********************************************************************
+   Name: test_1dim_multivars() - tests reading/writing on multiple variables,
+	each has 1 dimension
+
+   Description:
+        The main contents include:
+        - write 4 elements starting at index 0 to variable #1
+        - write 2 elements starting at index 0 to variable #2
+	- close file and reopen for read/write
+	- append 2 elements to variable #1, immediately after last written record
+	- write 3 elements to variable #2, starting at index 4
+	- append 3 elements to variable #1, skipping 5 records after the last
+	  written record
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 22, 2008
+*********************************************************************/
+
+#define FILENAME2 "onedimmultivars.nc"
+static int test_1dim_multivars()
+{
+    int   ncid;			/* file id */
+    int   varid1, varid2;	/* variable id */
+    int   time_dim;		/* unlimited dimension */
+    int   dims[1];		/* variable shapes */
+    long  dimsize = 0;		/* dimension size buffer */
+    short outdata[DIM0];	/* data read back */
+    char  varname[11];		/* variable name */
+    nc_type rh_type;		/* variable type */
+    int   rh_ndims;		/* number of dims */
+    int   rh_dims[H4_MAX_VAR_DIMS];	/* variable shape */
+    int   rh_natts;		/* number of attributes */
+    int   ii;
+    short var1_fillval=-1;	/* fill value for the variable */
+    short var2_fillval=-2;	/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data; the first two elements will
+	be changed to "1,2" later for the last test. */
+    short result1[] = {300,301,302,303,400,401,-1,-1,-1,-1,-1,-1,500,501,502};
+    short result2[] = {102,104,-2,-2,200,201,202,-2,-2,-2,-2,-2,-2,-2,-2};
+
+    /* Enter define mode */
+    ncid = nccreate(FILENAME2, NC_CLOBBER);
+    CHECK(ncid, -1, "nccreate");
+
+    /* Variables will be filled with fill values when data is missing */
+    status = ncsetfill(ncid, NC_FILL);
+    CHECK(status, -1, "ncsetfill");
+
+    /* Define the unlimited dimension */
+    time_dim = ncdimdef(ncid, "time", NC_UNLIMITED);
+    CHECK(time_dim, -1, "ncdimdef");
+
+    /* Define two 1-dim variables, named "Variable 1" and "Variable 2" */
+    dims[0] = time_dim;
+    varid1 = ncvardef (ncid, "Variable 1", NC_SHORT, 1, dims);
+    CHECK(varid1, -1, "ncvardef");
+    varid2 = ncvardef (ncid, "Variable 2", NC_SHORT, 1, dims);
+    CHECK(varid2, -1, "ncvardef");
+
+    /* write the fill value attribute of the two variables */
+    status = ncattput(ncid, varid1, "_FillValue", NC_SHORT, 1, &var1_fillval);
+    CHECK(status, -1, "ncattput");
+    status = ncattput(ncid, varid2, "_FillValue", NC_SHORT, 1, &var2_fillval);
+    CHECK(status, -1, "ncattput");
+
+    /* leave define mode */
+    status = ncendef (ncid);
+    CHECK(status, -1, "ncendef");
+
+    {  /* Write data to both variables */
+	long rh_start[] = {0};
+	long rh_edges[] = {4};
+	short data1[] = { 300,301,302,303};
+	short data2[] = { 102, 104};
+
+	/* write 4 elements to Variable 1 starting at index 0 */
+	status = ncvarput(ncid, varid1, rh_start, rh_edges, (void *)data1);
+	CHECK(status, -1, "ncvarput");
+
+	/* write 2 elements to Variable 2 starting at index 0 */
+	rh_edges[0] = 2;
+	status = ncvarput(ncid, varid2, rh_start, rh_edges, (void *)data2);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get Variable 1's information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid1, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    /* Get Variable 2's information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid2, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    /* Close file */
+    status = ncclose (ncid);
+    CHECK(status, -1, "ncclose");
+
+    /* Open file for reading and writing */
+    ncid = ncopen(FILENAME2, NC_RDWR);
+    CHECK(ncid, -1, "ncopen");
+
+    /* Get access to the two variables */
+    varid1 = ncvarid(ncid, "Variable 1");
+    CHECK(varid1, -1, "ncvarid");
+    varid2 = ncvarid(ncid, "Variable 2");
+    CHECK(varid2, -1, "ncvarid");
+
+    /* Get Variable 1's information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid1, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    /* Get Variable 2's information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid2, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    { /* Read data of the variables */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0);
+
+	/* Read and verify data of Variable 1 */
+	status = ncvarget(ncid, varid1, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data of Variable 1, should be "320 301 301 302" */
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result1[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 1\n", outdata[ii], result1[ii], ii);
+	}
+
+	/* Read and verify data of Variable 2 */
+	edges[0] = 2;	/* only reading what written to this variable so far */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid2, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data of Variable 2, should be "102 104" */
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result2[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 2\n", outdata[ii], result2[ii], ii);
+	}
+
+	/* Try to read again but up to the max number of records, 4 in this case
+	   because the other variable in the file has 4 elements written */
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid2, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data of Variable 2, should be "102 104 -2 -2" */
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result2[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 2\n", outdata[ii], result2[ii], ii);
+	}
+    } /* end read data */
+
+    {  /* Write to variable immediately after last written record */
+	long rh_start[] = {0};
+	long rh_edges[] = {2};
+	short data2[] = {400, 401};
+
+	/* Write 2 elements to Variable 1 at index 'dimsize' */
+	rh_start[0] = dimsize;
+	status = ncvarput(ncid, varid1, rh_start, rh_edges, (void *)data2);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get information of Variable 1 and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid1, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 6, "ncdiminq");
+
+    { /* Read variables */
+	long start[] = {0};
+	long edges[] = {0};
+	/* Current data of Variable 2 should look like this, because of the 
+	   extension with fill value to match the max number of records in 
+	   the file */
+	short tempresult[] = {102,104,-2,-2,-2,-2};
+
+	/* Read up to max number of records in the file */
+	edges[0] = dimsize;
+
+	/* Read and verify data of Variable 1 */
+	/* read data should be: 300  301  302  303  400  401 */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid1, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result1[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 1\n", outdata[ii], result1[ii], ii);
+	}
+
+	/* Read and verify data of Variable 2 */
+	/* read data should be: 102  104  -2  -2  -2  -2 */
+edges[0] = 2;
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid2, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != tempresult[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 2\n", outdata[ii], result2[ii], ii);
+	}
+    } /* end read data */
+
+    {  /* Append to variable with gap */
+	long rh_start[] = {4};
+	long rh_edges[] = {3};
+	short data2[] = {200, 201, 202};
+
+	/* Write 3 elements to Variable 2 at index 4 */
+	status = ncvarput(ncid, varid2, rh_start, rh_edges, (void *)data2);
+	CHECK(status, -1, "ncvarget");
+    }
+
+    /* Get variable information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid2, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 7, "ncdiminq");
+
+    { /* Read both variables */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize-1;
+
+	/* Read and verify data of Variable 1 */
+	/* read data should be: 300  301  302  303  400  401  -1 */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid1, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result1[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 1\n", outdata[ii], result1[ii], ii);
+	}
+
+	/* Read and verify data of Variable 1 */
+	/* read data should be: 102  104  -2  -2  200  201  202 */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid2, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result2[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 2\n", outdata[ii], result2[ii], ii);
+	}
+    } /* end read data */
+
+    {  /* Append to a variable, with gap */
+	long rh_start[] = {0};
+	long rh_edges[] = {3};
+	short data2[] = {500, 501, 502};
+	rh_start[0] = dimsize+5;
+
+	/* Write 3 elements to Variable 1 at index 'dimsize+5', leaving a gap
+	   of 5 records that will be filled with fill value */
+	status = ncvarput(ncid, varid1, rh_start, rh_edges, (void *)data2);
+	CHECK(status, -1, "ncvarput");
+	/* data now: 300 301 302 303 400 401 -1 -1 -1 -1 -1 -1 500 501 502 */
+    }
+
+    /* Get variable information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid2, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 15, "ncdiminq");
+
+    { /* Read both variables */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize;
+
+	/* Read and verify data of Variable 1; read data should be: */
+	/* 300 301 302 303 400 401 -1 -1 -1 -1 -1 -1 500 501 502    */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid1, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result1[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 1\n", outdata[ii], result1[ii], ii);
+	}
+
+	/* Read and verify data of Variable 2; read data should be: */
+	/* 102 104 -2 -2 200 201 202 -2 -2 -2 -2 -2 -2 -2 -2 */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid2, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	for (ii = 0; ii < edges[0]; ii++) {
+            if (outdata[ii] != result2[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d in Variable 2\n", outdata[ii], result2[ii], ii);
+	}
+    } /* end read data */
+
+#if NOTRUN
+/* The following test is to verify that attempting to read pass the maximum 
+   number of records in the file will fail.  However, because ncvarget leads
+   to the internal function NCcoordck which uses NCadvise to display the 
+   error and exit() so the test is disabled but the code should remain here 
+   for future testing. -BMR, Dec 30, 2008 */
+    { /* Read both variables pass the end by 2 records, should fail */
+	long start[] = {0};
+	long edges[1];
+	edges[0] = dimsize+2;
+
+	/* read data of Variable 1; should fail */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid1, start, edges, outdata);
+	VERIFY(status, -1, "ncvarget");
+
+	/* read data of Variable 1; should fail */
+	HDmemset(outdata, 0, DIM0);
+	status = ncvarget(ncid, varid2, start, edges, outdata);
+	VERIFY(status, -1, "ncvarget");
+
+    } /* end read data */
+#endif
+
+    /* Close file */
+    status = ncclose(ncid);
+    CHECK(status, -1, "ncclose");
+
+    return num_errs;
+} /* test_1dim_multivars */
+
+
+/********************************************************************
+   Name: test_multidim_singlevar() - tests on a single variable with more
+	than one dimension
+
+   Description:
+        The main contents include:
+	- create a 3-D variable with 1 unlimited dimension and the others 3x2
+        - write 4x1x1 elements starting at index {0,0,0}
+        - append 2x1x1 elements along the unlimited dimension starting at 
+	  index 6, that is slabs at indices 4 and 5 will be written with fill 
+	  value
+        - append 1x3x2 elements immediately at the end of the data
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 22, 2008
+*********************************************************************/
+
+#define DIM1 3
+#define DIM2 2
+#define FILENAME3 "multidimvar.nc"
+static int test_multidim_singlevar()
+{
+    int   ncid;			/* file id */
+    int   varid;		/* variable id */
+    int   time_dim;		/* unlimited dimension */
+    int   dim1, dim2;		/* other dimension ids */
+    int   dims[3];		/* variable shapes */
+    long  dimsize = 0,		/* unlimited dimension size */
+	  dimsize1 = 0, dimsize2 = 0; /* other dimension sizes */
+    short outdata[DIM0][DIM1][DIM2];	/* data read back */
+    char  varname[12];		/* variable name */
+    nc_type rh_type;		/* variable type */
+    int   rh_ndims;		/* number of dims */
+    int   rh_dims[H4_MAX_VAR_DIMS];	/* variable shape */
+    int   rh_natts;		/* number of attributes */
+    int   ii, jj, kk;
+    short fillval = -3;		/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data; the first two elements will
+	be changed to "1,2" later for the last test. */
+    short result[DIM0][DIM1][DIM2] = {300,-3,-3,-3,-3,-3,301,-3,-3,-3,-3,-3,302,-3,-3,-3,-3,-3,303,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,400,-3,-3,-3,-3,-3,401,-3,-3,-3,-3,-3,800,801,802,803,804,805};
+
+    /* Enter define mode */
+    ncid = nccreate(FILENAME3, NC_CLOBBER);
+    CHECK(ncid, -1, "nccreate");
+
+    /* variables will be filled with fill values when data is missing */
+    status = ncsetfill(ncid, NC_FILL);
+    CHECK(status, -1, "ncsetfill");
+
+    /* Define the unlimited dimension */
+    time_dim = ncdimdef(ncid, "time", NC_UNLIMITED);
+    CHECK(status, -1, "ncdimdef");
+    dim1 = ncdimdef(ncid, "dimension 1", 3L);
+    CHECK(dim1, -1, "ncdimdef");
+    dim2 = ncdimdef(ncid, "dimension 2", 2L);
+    CHECK(dim2, -1, "ncdimdef");
+
+    /* Define the variable */
+    dims[0] = time_dim;
+    dims[1] = dim1;
+    dims[2] = dim2;
+    varid = ncvardef (ncid, "Variable 3D", NC_SHORT, 3, dims);
+    CHECK(varid, -1, "ncvardef");
+
+    /* Write the fill value attribute */
+    status = ncattput(ncid, varid, "_FillValue", NC_SHORT, 1, &fillval);
+    CHECK(status, -1, "ncattput");
+
+    /* Leave define mode */
+    status = ncendef (ncid);
+    CHECK(status, -1, "ncendef");
+
+    {  /* Write data the first time */
+	long rh_start[] = {0,0,0};	/* starting writing at beginning */
+	long rh_edges[] = {4,1,1};	/* 4x1x1 slab */
+	short data[] = {300,301,302,303};
+
+	/* Write 4 elements starting at index 0 */
+	status = ncvarput(ncid, varid, rh_start, rh_edges, (void *)data);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get variable information and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    /* Close file */
+    status = ncclose (ncid);
+    CHECK(status, -1, "ncclose");
+
+    /* Open file for reading and writing */
+    ncid = ncopen(FILENAME3, NC_RDWR);
+    CHECK(ncid, -1, "ncopen");
+
+    /* Get access to the variable */
+    varid = ncvarid(ncid, "Variable 3D");
+    CHECK(varid, -1, "ncvarid");
+
+    /* Get and verify variable info and size of the unlimited dimension again */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 4, "ncdiminq");
+
+    status = ncdiminq(ncid, rh_dims[1], 0, &dimsize1);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize1, DIM1, "ncdiminq");
+
+    status = ncdiminq(ncid, rh_dims[2], 0, &dimsize2);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize2, DIM2, "ncdiminq");
+
+    { /* Read and verify data of the variable */
+	long start[] = {0,0,0};
+	long edges[] = {0,DIM1,DIM2};
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0*DIM1*DIM2);
+	status = ncvarget(ncid, varid, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data, should be:
+		300  -3     301  -3     302  -3     303  -3
+		 -3  -3      -3  -3      -3  -3      -3  -3
+		 -3  -3      -3  -3      -3  -3      -3  -3
+		unlimited dimension ---->
+		(-3 is fill value)
+	*/
+
+	for (ii = 0; ii < edges[0]; ii++) 
+	for (jj = 0; jj < DIM1; jj++)
+	for (kk = 0; kk < DIM2; kk++)
+	    if (outdata[ii][jj][kk] != result[ii][jj][kk])
+                fprintf(stderr,"test_multidim_singlevar: Read data %d doesn't match input %d at indices %d,%d,%d\n", outdata[ii][jj][kk], result[ii][jj][kk], ii,jj,kk);
+    } /* end read data */
+
+    {  /* Append data to variable pass the end */
+	long rh_start[] = {6,0,0};	/* the end is 3 */
+	long rh_edges[] = {2,1,1};	/* two slabs */
+	short data[] = { 400,401};
+
+	/* Write 2 values starting at index 6 */
+	status = ncvarput(ncid, varid, rh_start, rh_edges, (void *)data);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get and verify variable info and size of the unlimited dimension again */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 8, "ncdiminq");
+
+    { /* Read variable after appending with gap */
+	long start[] = {0,0,0};
+	long edges[] = {0,DIM1,DIM2};
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0*DIM1*DIM2);
+	status = ncvarget(ncid, varid, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* verify data, should be
+		300  -3     301  -3     302  -3     303  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+
+		... -3  -3      -3  -3     400  -3     401  -3
+		... -3  -3      -3  -3      -3  -3      -3  -3
+		... -3  -3      -3  -3      -3  -3      -3  -3
+		unlimited dimension ---->
+		(-3 is fill value)
+	*/
+	for (ii = 0; ii < edges[0]; ii++) 
+	for (jj = 0; jj < DIM1; jj++)
+	for (kk = 0; kk < DIM2; kk++)
+	    if (outdata[ii][jj][kk] != result[ii][jj][kk])
+                fprintf(stderr,"test_multidim_singlevar: Read data %d doesn't match input %d at indices %d,%d,%d\n", outdata[ii][jj][kk], result[ii][jj][kk], ii,jj,kk);
+    } /* end read data */
+
+    {  /* Write variable immediately pass the end */
+	long rh_start[] = {0,0,0};	/* the end is 3 */
+	long rh_edges[] = {1,3,2};	/* two elements */
+	short data[] = {800,801,802,803,804,805};
+	rh_start[0] = dimsize;	/* starting immediatly pass dimension size */
+
+	/* Write 3 elements to the variable starting at 'dimsize' */
+	status = ncvarput(ncid, varid, rh_start, rh_edges, (void *)data);
+	CHECK(status, -1, "ncvarput");
+    }
+
+    /* Get and verify variable info and size of the unlimited dimension */
+    status = ncvarinq (ncid, varid, varname, &rh_type, &rh_ndims, rh_dims, &rh_natts);
+    CHECK(status, -1, "ncvarinq");
+    status = ncdiminq(ncid, rh_dims[0], 0, &dimsize);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dimsize, 9, "ncdiminq");
+
+    { /* read variable */
+	long start[] = {0,0,0};
+	long edges[] = {0,DIM1,DIM2};
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, DIM0*DIM1*DIM2);
+	status = ncvarget(ncid, varid, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* verify data, should be
+		300  -3     301  -3     302  -3     303  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+
+		... -3  -3      -3  -3     400  -3     401  -3     800 801
+		... -3  -3      -3  -3      -3  -3      -3  -3     802 803
+		... -3  -3      -3  -3      -3  -3      -3  -3     804 805
+		unlimited dimension ---->
+		(-3 is fill value)
+	*/
+	for (ii = 0; ii < edges[0]; ii++) 
+	for (jj = 0; jj < DIM1; jj++)
+	for (kk = 0; kk < DIM2; kk++)
+	    if (outdata[ii][jj][kk] != result[ii][jj][kk])
+                fprintf(stderr,"test_multidim_singlevar: Read data %d doesn't match input %d at indices %d,%d,%d\n", outdata[ii][jj][kk], result[ii][jj][kk], ii,jj,kk);
+    } /* end read data */
+
+    /* Close file */
+    status = ncclose(ncid);
+    CHECK(status, -1, "ncclose");
+
+    return 0;
+}
+
+
+/* Test driver for testing reading/writing variables with unlimited dimension 
+   using nc API. */
+extern int test_ncunlim()
+{
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("read/write variables with unlimited dims via nc API (tncunlim.c)");
+
+    /* Test single variable with 1 unlimited dimension */
+    num_errs = num_errs + test_1dim_singlevar();
+
+    /* Test multiple variables with 1 unlimited dimension */
+    num_errs = num_errs + test_1dim_multivars();
+
+    /* Test multiple variables with multiple dimensions */
+    num_errs = num_errs + test_multidim_singlevar();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
diff --git a/mfhdf/test/tncvargetfill.c b/mfhdf/test/tncvargetfill.c
new file mode 100644
index 0000000..8f924a0
--- /dev/null
+++ b/mfhdf/test/tncvargetfill.c
@@ -0,0 +1,745 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tncvargetfill.c - tests that ncvarget fills user buffers with fill-values
+ *		where data is not present.
+ *		The tests show that the fill-values are filled correctly in
+ *		the following situations:
+ *		+ reading passed written data of a variable but still less
+ *		  than the maximum number of records in the file
+ *		+ reading passed the maximum number of records in the file
+ *
+ * Structure of the file:
+ *    test_vargetfill - test driver
+ *        test_1dim_multivars - tests on multiple variables with only 1 dimension
+ *        test_multidims      - tests on variables with multiple dimensions
+ *	  test_readings       - tests reading passed written data and max number
+ *				of records in the file.
+ *
+ * BMR - Aug, 2013
+****************************************************************************/
+
+#include "mfhdf.h"
+#include "hdftest.h"
+
+#define DIM0 20	/* this value is used to declare larger buffer for when
+		   reading past the maximum number of records in the file */
+
+/********************************************************************
+   Name: test_1dim_multivars() - tests reading/writing on multiple variables,
+	each has 1 dimension
+
+   Description:
+        The main contents include:
+        - write 4 elements to var #1, starting at index 0
+        - write 2 elements to var #2, starting at index 0
+        - add 2 more elements to var #1, starting at idx 6, skipping 2 elems
+	- close file and reopen for using nc API
+	- read var #1, data should show fill-values are in the skipping elems
+	- read var #2, data should show all fill-values after first 2 elems
+	  written previously, until idx 6, which is the max numrecs in the file
+
+   Return value:
+        The number of errors occurred in this test.
+   BMR - Sep 4, 2013
+*********************************************************************/
+
+#define FILENAME1 "onedimmultivars.hdf"
+#define SDS1_NAME "Variable 1"
+#define SDS2_NAME "Variable 2"
+#define	D1_NUMRECS	8
+#define	D2_NUMRECS	2
+static int test_1dim_multivars()
+{
+    int32 fid;			/* file id */
+    int32 dset1, dset2;		/* dataset ids */
+    int32 dimsizes[1];		/* dimension size buffer */
+    int32 start[1],		/* where to start writing */
+	  edges[1];		/* length of data to be read/written */
+    int32 rank = 1;		/* rank of the 1-D data sets */
+    int16 outdata[DIM0];	/* data read back */
+    int16 fillval1 = -1;	/* fill value for the variable */
+    int16 fillval2 = -2;	/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data */
+    int16 sdresult1[] = {300,301,302,303,-1,-1,306,307};
+    int16 sdresult2[] = {102,104};
+    int16 ncresult1[] = {300,301,302,303,-1,-1,306,307}; /* same as sd result */
+    int16 ncresult2[] = {102,104,-2,-2,-2,-2,-2,-2};
+
+    /* Create a new file */
+    fid = SDstart(FILENAME1, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Define an unlimited dimension and rank for the data sets */
+    dimsizes[0] = SD_UNLIMITED;
+    rank = 1;
+
+    /* Create two 1-D array data sets */
+    dset1 = SDcreate(fid, SDS1_NAME, DFNT_INT16, rank, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+    dset2 = SDcreate(fid, SDS2_NAME, DFNT_INT16, rank, dimsizes);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Data sets will be filled with fill-values when data is missing */
+    status = SDsetfillvalue(dset1, (VOIDP)&fillval1);
+    CHECK(status, FAIL, "SDsetfillvalue");
+    status = SDsetfillvalue(dset2, (VOIDP)&fillval2);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    { /* Add data */
+	int16 data[] = {300, 301, 302, 303};
+	int16 appdata[] = {306, 307};
+	int16 data2[] = {102, 104};
+
+	/* Write 4 elements to first data set starting at index 0 */
+	start[0] = 0;
+	edges[0] = 4;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+
+	/* Write 2 elements to second data set starting at index 0 */
+	start[0] = 0;
+	edges[0] = 2;
+	status = SDwritedata(dset2, start, NULL, edges, (VOIDP)data2);
+	CHECK(status, FAIL, "SDwritedata");
+
+	/* Add 2 more elements to first dataset starting at index 6, i.e.,
+	   skipping 2 elements, which will be filled with fill-values. */
+	start[0] = 6;
+	edges[0] = 2;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)appdata);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get info of the first data set, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset1, D1_NUMRECS, sdresult1);
+
+    /* Get info of the second dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset2, D2_NUMRECS, sdresult2);
+
+    /* Close the data sets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /*****************************************************
+     * Read and verify data of the variables with nc API *
+     *****************************************************/
+    {
+	long start[1];		/* where to start reading */
+	long edges[1];		/* length of data to be read */
+	int   ncid;		/* file id */
+	int   var1id, var2id;	/* variable ids */
+	long  dimsize = 0;	/* dimension size buffer */
+	short outdata[DIM0];	/* data read back */
+	int   rh_ndims;		/* number of dims */
+	int   rh_dims[H4_MAX_VAR_DIMS];	/* variable shape */
+	char  varname[H4_MAX_NC_NAME];	/* variable name */
+	int   ii;
+
+	/* Open the file for reading and writing with nc API */
+	ncid = ncopen(FILENAME1, NC_RDWR);
+	CHECK(ncid, -1, "ncopen");
+
+	/* Verify variable info and data of first variable */
+
+	/* Get access to the first variable, named SDS1_NAME */
+	var1id = ncvarid(ncid, SDS1_NAME);
+	CHECK(var1id, -1, "ncvarid");
+
+	/* Get and verify variable info and size of the unlim dimension again */
+	status = ncvarinq(ncid, var1id, varname, NULL, &rh_ndims, rh_dims, NULL);
+	CHECK(status, -1, "ncvarinq");
+	status = ncdiminq(ncid, rh_dims[0], NULL, &dimsize);
+	CHECK(status, -1, "ncdiminq");
+	VERIFY(dimsize, D1_NUMRECS, "ncdiminq");
+
+	/* Read the entire variable */
+	start[0] = 0;
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, edges[0]);
+	status = ncvarget(ncid, var1id, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data, should be as ncresult1: 300 301 301 302 -1 -1 306 307 */
+	for (ii = 0; ii < dimsize; ii++) {
+  	    if (outdata[ii] != ncresult1[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d\n", outdata[ii], ncresult1[ii], ii);
+	}
+
+	/* Verify variable info and data of second variable */
+
+	/* Get access to the second variable, named SDS2_NAME */
+	var2id = ncvarid(ncid, SDS2_NAME);
+	CHECK(var2id, -1, "ncvarid");
+
+	/* Get and verify variable info and size of the unlim dimension again */
+	status = ncvarinq(ncid, var2id, varname, NULL, &rh_ndims, rh_dims, NULL);
+	CHECK(status, -1, "ncvarinq");
+	status = ncdiminq(ncid, rh_dims[0], NULL, &dimsize);
+	CHECK(status, -1, "ncdiminq");
+	VERIFY(dimsize, D1_NUMRECS, "ncdiminq"); /* Note: only 2 written, but
+		netCDF uses the max number of records in the file for all unlim
+		dims in the file */
+
+	start[0] = 0;
+	edges[0] = dimsize;
+	HDmemset(outdata, 0, edges[0]);
+	status = ncvarget(ncid, var2id, start, edges, outdata);
+	CHECK(status, -1, "ncvarget");
+
+	/* verify data, should be as in ncresult2: "102 104 -2 -2 -2 -2" */
+	for (ii = 0; ii < dimsize; ii++) {
+  	    if (outdata[ii] != ncresult2[ii])
+                fprintf(stderr,"test_1dim_multivars: Read data %d doesn't match input %d at index %d\n", outdata[ii], ncresult2[ii], ii);
+	}
+    } /* end read data */
+
+    return 0;
+}   /* test_1dim_multivars */
+
+
+/********************************************************************
+   Name: test_multidims() - tests on variables with more than one dimension
+
+   Description:
+        The main contents include:
+	- create a 3-D variable, named VAR3D, with the first dimension
+	  unlimited and the others have sizes 3x2
+	- create 2 1-D variables, named VAR1D and VAREMPTY, both have UDim
+        - write 4x1x1 elements to VAR3D, starting at index {0,0,0}
+	- write 4 elements to VAR1D starting at index 2
+	- close and reopen the file
+        - append 1x3x2 elements along the unlimited dimension starting at 
+	  index {7,0,0}, i.e., slabs at indices 4, 5 and 6 will be written with
+	  fill-value
+	- create another 1-D variable, named VARDOZEN, and write 12 values
+	  to it -> 12 became the new max number of records in the file
+	- close and reopen the file in nc API
+	- read and verify VAR3D, its buffer should have fill-values between
+	  elements 9-12
+	- read and verify VAR1D, its buffer should have fill-values after the
+	  6th element
+	- read and verify VAREMPTY, its buffer should contain all 12 fill-values
+
+   Return value:
+        The number of errors occurred in this routine.
+   BMR - Sep 4, 2013
+*********************************************************************/
+
+#define DIM00 10
+#define DIM1 3
+#define DIM2 2
+#define RANK3 3
+#define RANK1 1
+#define MAX_NUMRECS 12
+#define FILENAME2 "multidimmixed.hdf"
+#define VAR3D "Variable 3D"
+#define VAR1D "Variable 1D"
+#define VAREMPTY "Variable EMPTY"
+#define VARDOZEN "Variable Dozen Records"
+static int test_multidims()
+{
+    int32 fid;			/* file id */
+    int32 dset1, dset2, dset3;	/* dataset ids */
+    int32 dset_index;		/* dataset index */
+    int32 dimsizes3D[3];		/* dimension size buffer for first SDS */
+    int32 dimsize1D[1];		/* dimension size buffer for second SDS */
+    int32 start[3],		/* where to start reading */
+	  edges[3];		/* length of data to be read */
+    int16 outdata3D[DIM0][DIM1][DIM2];	/* 3-D data read back */
+    int16 outdata1D[DIM0];	/* 1-D data read back */
+    int16 *outdata3;		/* for dynamically allocated buffer */
+    int16 fillval1 = -3;	/* fill value for the 3-D variable */
+    int16 fillval2 = -1;	/* fill value for the 1-D variable */
+    int16 fillval3 = -10;	/* fill value for the 1-D variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data */
+    int16 result3D[DIM00][DIM1][DIM2] = {300,-3,-3,-3,-3,-3,301,-3,-3,-3,-3,-3,302,-3,-3,-3,-3,-3,303,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,800,801,802,803,804,805};
+    int16 ncresult1D[] = {-1,-1,300,301,302,303,-1,-1,-1};
+    int16 sdresult1D[] = {-1,-1,300,301,302,303};
+
+    /* Create a new file */
+    fid = SDstart(FILENAME2, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Define dimensions of the data sets to be created */
+    dimsizes3D[0] = SD_UNLIMITED;
+    dimsizes3D[1] = DIM1;
+    dimsizes3D[2] = DIM2;
+    dimsize1D[0] = SD_UNLIMITED;
+
+    /* Create array data sets */
+    dset1 = SDcreate(fid, VAR3D, DFNT_INT16, RANK3, dimsizes3D);	/* 3-D */
+    CHECK(dset1, FAIL, "SDcreate");
+    dset2 = SDcreate(fid, VAR1D, DFNT_INT16, RANK1, dimsize1D);	/* 1-D */
+    CHECK(dset2, FAIL, "SDcreate");
+    dset3 = SDcreate(fid, VAREMPTY, DFNT_INT16, RANK1, dimsize1D);	/* 1-D */
+    CHECK(dset3, FAIL, "SDcreate");
+
+    /* Datasets will be filled with fill values when data is missing */
+    status = SDsetfillvalue(dset1, (VOIDP)&fillval1);
+    CHECK(status, FAIL, "SDsetfillvalue");
+    status = SDsetfillvalue(dset2, (VOIDP)&fillval2);
+    CHECK(status, FAIL, "SDsetfillvalue");
+    status = SDsetfillvalue(dset3, (VOIDP)&fillval3);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    { /* Add data to first data set */
+	int16 data[] = {300, 301, 302, 303};
+
+	/* Write 4 elements starting at index 0 */
+	start[0] = start[1] = start[2] = 0; /* starting writing at {0,0,0} */
+	edges[0] = 4;	/* 4x1x1 slab */
+	edges[1] = 1;
+	edges[2] = 1;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its dimension */
+    status = SDgetinfo(dset1, NULL, NULL, dimsizes3D, NULL, NULL);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(dimsizes3D[0], 4, "SDgetinfo");
+
+    /* Read and verify data of the dataset */
+    start[0] = start[1] = start[2] = 0;
+    edges[0] = dimsizes3D[0];
+    edges[1] = dimsizes3D[1];
+    edges[2] = dimsizes3D[2];
+    outdata3 = (int16 *)HDmalloc(edges[0]*edges[1]*edges[2]*sizeof(int16));
+    status = SDreaddata(dset1, start, NULL, edges, (VOIDP) outdata3);
+    CHECK(status, FAIL, "SDreaddata");
+
+    status = HDmemcmp(outdata3, result3D, edges[0]*edges[1]*edges[2]*sizeof(int16));
+    VERIFY(status, 0, "HDmemcmp");
+
+    { /* Add data to second data set, i.e. 1-D var */
+	int16 data[] = {300, 301, 302, 303};
+
+	/* Write 4 elements starting at index 2 */
+	start[0] = 2;	/* skip first two elements */
+	edges[0] = 4;	/* write 4 elements */
+	status = SDwritedata(dset2, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Close the data sets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset3);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Reopen file and data set VAR3D */
+    fid = SDstart(FILENAME2, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+    dset_index = SDnametoindex(fid, VAR3D);
+    CHECK(dset_index, FAIL, "SDnametoindex");
+    dset1 = SDselect(fid, dset_index);
+    CHECK(dset1, FAIL, "SDselect");
+
+    { /* Append data to the dataset pass the end */
+	int16 data[] = {800,801,802,803,804,805};
+
+	start[0] = 7;
+	start[1] = start[2] = 0; /* writing at {7,0,0} */
+	edges[0] = 1;
+	edges[1] = DIM1;
+	edges[2] = DIM2; 
+
+	/* Write 1 slab starting at index 7 */
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* VAR3D now has 8 (D1_NUMRECS) records */
+
+    /* Get information of the dataset, and verify its dimension */
+    status = SDgetinfo(dset1, NULL, NULL, dimsizes3D, NULL, NULL);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(dimsizes3D[0], D1_NUMRECS, "SDgetinfo");
+
+    /* Read and verify data of the dataset */
+    start[0] = start[1] = start[2] = 0;
+    edges[0] = dimsizes3D[0];
+    edges[1] = dimsizes3D[1];
+    edges[2] = dimsizes3D[2];
+    status = SDreaddata(dset1, start, NULL, edges, (VOIDP) outdata3D);
+    CHECK(status, FAIL, "SDreaddata");
+
+    status = HDmemcmp(outdata3D, result3D, edges[0]*edges[1]*edges[2]*sizeof(int16));
+    VERIFY(status, 0, "HDmemcmp");
+
+	/* Data should be
+		300  -3     301  -3     302  -3     303  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+
+		... -3  -3      -3  -3      -3  -3      800 801
+		... -3  -3      -3  -3      -3  -3      802 803
+		... -3  -3      -3  -3      -3  -3      804 805
+		unlimited dimension ---->
+		(-3 is fill value)
+	*/
+
+    /* Reopen the 1-D dataset VAR1D */
+    dset_index = SDnametoindex(fid, VAR1D);
+    CHECK(dset_index, FAIL, "SDnametoindex");
+    dset2 = SDselect(fid, dset_index);
+    CHECK(dset2, FAIL, "SDselect");
+
+    /* Read and verify data of the dataset.  Data should be: -1 -1 300 301 302 303 */
+    start[0] = 0;
+    edges[0] = dimsize1D[0];
+    status = SDreaddata(dset2, start, NULL, edges, (VOIDP) outdata1D);
+    CHECK(status, FAIL, "SDreaddata");
+
+    status = HDmemcmp(outdata1D, sdresult1D, edges[0]*sizeof(int16));
+    VERIFY(status, 0, "HDmemcmp");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Create the fourth data set, named VARDOZEN and with unlimited
+       dimension.  This data set will have more records than the current
+       number of records in the file. */
+    dimsize1D[0] = SD_UNLIMITED;
+    dset1 = SDcreate(fid, VARDOZEN, DFNT_INT16, RANK1, dimsize1D);
+    CHECK(dset3, FAIL, "SDcreate");
+
+    { /* Write data to the fourth dataset, exceeding the current number of
+	 records in the file */
+	int16 data[] = {1,2,3,4,5,6,7,8,9,10,11,12};
+
+	/* Write 12 elements starting at index 0 */
+	start[0] = 0;
+	edges[0] = 12;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+
+    /*****************************************************
+     * Read and verify data of the variables with nc API *
+     *****************************************************/
+    {
+	long  start[3];
+	long  edges[3];
+	int   ncid;                 /* file id */
+	int   var1id, var2id, var3id;       /* variable ids */
+	long  dims[3];              /* dimension size buffer */
+	int   rh_ndims;		/* number of dims */
+	int   rh_dims[H4_MAX_VAR_DIMS];	/* variable shape */
+	char  varname[H4_MAX_NC_NAME];	/* variable name */
+	int   ii;
+
+	/* After the fourth data set (VARDOZEN) was added, the maximum number
+	   of records became 12.  Thus, the results must be changed to reflect
+	   the behavior in nc API. */
+    int16 result3D[DIM0][DIM1][DIM2] = {300,-3,-3,-3,-3,-3,301,-3,-3,-3,-3,-3,302,-3,-3,-3,-3,-3,303,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,800,801,802,803,804,805, -3,-3,-3,-3,-3,-3, -3,-3,-3,-3,-3,-3, -3,-3,-3,-3,-3,-3, -3,-3,-3,-3,-3,-3};
+    int16 ncresult1D[] = {-1,-1,300,301,302,303,-1,-1,-1,-1,-1,-1};
+    int16 ncresult1Ddozen[] = {-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10};
+    int16 sdresult1D[] = {-1,-1,300,301,302,303};
+
+	/* Open the file with nc API */
+	ncid = ncopen(FILENAME2, NC_RDWR);
+	CHECK(ncid, -1, "ncopen");
+
+	/* Verify variable info and data of first data set */
+
+	/* Get access to the variable VAR3D */
+	var1id = ncvarid(ncid, VAR3D);
+	CHECK(var1id, -1, "ncvarid");
+
+	/* Get variable info */
+	status = ncvarinq(ncid, var1id, varname, NULL, &rh_ndims, rh_dims, NULL);
+	CHECK(status, -1, "ncvarinq");
+	VERIFY(rh_ndims, RANK3, "ncvarinq");
+	for (ii = 0; ii < rh_ndims; ii++)
+	{
+	    status = ncdiminq(ncid, rh_dims[ii], NULL, &dims[ii]);
+	    CHECK(status, -1, "ncdiminq");
+
+	    /* Initialize parameters for reading data */
+	    edges[ii] = dims[ii];
+	    start[ii] = 0;
+	}
+
+	/* Get data */
+	HDmemset(outdata3D, 0, edges[0]*edges[1]*edges[2]*sizeof(int16));
+	status = ncvarget(ncid, var1id, start, edges, outdata3D);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data */
+	status = HDmemcmp(outdata3D, result3D, edges[0]*edges[1]*edges[2]*sizeof(int16));
+	VERIFY(status, 0, "HDmemcmp");
+
+	/* Verify variable info and data of second data set */
+
+	/* Get access to the second variable VAR1D */
+	var2id = ncvarid(ncid, VAR1D);
+	CHECK(var2id, -1, "ncvarid");
+
+	/* Get and verify variable info */
+	status = ncvarinq(ncid, var2id, varname, NULL, &rh_ndims, rh_dims, NULL);
+	CHECK(status, -1, "ncvarinq");
+
+	status = ncdiminq(ncid, rh_dims[0], NULL, &dims[0]);
+	CHECK(status, -1, "ncdiminq");
+	VERIFY(dims[0], MAX_NUMRECS, "ncdiminq"); /* Note: only written up
+		to 6th element, but netCDF uses the max number of records in
+		the file, which is currently 12, due to data set VARDOZEN */
+
+	/* Get data */
+	edges[0] = dims[0];
+	HDmemset(outdata1D, 0, edges[0]*sizeof(int16));
+	status = ncvarget(ncid, var2id, start, edges, outdata1D);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data, should be "-1,-1,300,301,302,303,-1,-1,-1,-1,-1,-1".
+	   The first two -1s are due to the skipped elements by SDwritedata.
+	   The last six -1s are added by nc API to match the max numrecs in
+	   the file. */
+	for (ii = 0; ii < dims[0]; ii++) {
+  	    if (outdata1D[ii] != ncresult1D[ii])
+                fprintf(stderr,"test_1dims: at line %d- Read data %d doesn't match input %d at index %d\n", __LINE__, outdata1D[ii], ncresult1D[ii], ii);
+	}
+
+	/* Get access to the second variable */
+	var3id = ncvarid(ncid, VAREMPTY);
+	CHECK(var3id, -1, "ncvarid");
+
+	/* Get and verify variable info */
+	status = ncvarinq(ncid, var3id, varname, NULL, &rh_ndims, rh_dims, NULL);
+	CHECK(status, -1, "ncvarinq");
+
+	status = ncdiminq(ncid, rh_dims[0], NULL, &dims[0]);
+	CHECK(status, -1, "ncdiminq");
+	VERIFY(dims[0], MAX_NUMRECS, "ncdiminq");	/* Note: no data
+		written, but netCDF uses the max number of records in the file
+		for all unlim dims in the file */
+
+	/* Get data */
+	start[0] = 0;
+	edges[0] = dims[0];
+	HDmemset(outdata1D, 0, edges[0]*sizeof(int16));
+	status = ncvarget(ncid, var3id, start, edges, outdata1D);
+	CHECK(status, -1, "ncvarget");
+
+	/* Verify data */
+	status = HDmemcmp(outdata1D, ncresult1Ddozen, edges[0]*sizeof(int16));
+	VERIFY(status, 0, "HDmemcmp");
+    } /* end read data with nc API */
+
+    return 0;
+}
+
+
+/***************************************************************************
+   Name: test_readings() - tests reading passed actually written data and then
+		passed the maximum number of records in the file with nc API.
+
+   Description:
+        - open the file and data sets using nc API
+	- read VAR3D passing actually written data, then verify that data is
+	  read and fill-values are filled correctly
+	- read VAR3D passing the max number of records, and function will fail
+	- do the same for VAR1D
+
+   Return value:
+        The number of errors occurred in this test.
+   BMR - Sep 4, 2013
+*********************************************************************/
+static int test_readings(long max_numrecs)
+{
+    int   ncid;                 /* file id */
+    int   var1id, var2id, var3id; /* variable ids */
+    long  start[3];
+    long  edges[3];
+    long  dims[3];              /* dimension size buffer */
+    int   rh_ndims;             /* number of dims */
+    int   rh_dims[H4_MAX_VAR_DIMS];     /* variable shape */
+    char  varname[H4_MAX_NC_NAME];	/* variable name */
+    int   ii, jj, kk;
+    int16 outdata3D[DIM0][DIM1][DIM2];	/* 3-D data read back */
+    int16 outdata1D[DIM0];	/* 1-D data read back */
+    int32 dimsizes3D[3];		/* dimension size buffer for first SDS */
+    int32 dimsize1D[1];		/* dimension size buffer for second SDS */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data */
+
+    /* data resulted from reading at start=[4,0,0] for edges=[6,1,1] */
+    int16 result3D_start400_edge611[DIM0][DIM1][DIM2] = {-3,-3,-3,800,-3,-3};
+
+    /* data resulted from reading at start=[4] for edges=[6] */
+    int16 result1D_start4_edge6[] = {302,303,-1,-1,-1,-1};
+
+    /* Open the file for reading and writing with nc API */
+    ncid = ncopen(FILENAME2, NC_RDWR);
+    CHECK(ncid, -1, "ncopen");
+
+    /* Verify variable info and data of first data set */
+
+    /* Get access to the variable VAR3D */
+    var1id = ncvarid(ncid, VAR3D);
+    CHECK(var1id, -1, "ncvarid");
+
+    /* Initialize dimensions to compare */
+    dimsizes3D[0] = max_numrecs;
+    dimsizes3D[1] = DIM1;
+    dimsizes3D[2] = DIM2;
+
+    /* Get variable dimensions */
+    status = ncvarinq(ncid, var1id, varname, NULL, &rh_ndims, rh_dims, NULL);
+    CHECK(status, -1, "ncvarinq");
+    VERIFY(rh_ndims, RANK3, "ncvarinq");
+    for (ii = 0; ii < rh_ndims; ii++)
+    {
+	    status = ncdiminq(ncid, rh_dims[ii], NULL, &dims[ii]);
+	    CHECK(status, -1, "ncdiminq");
+	    VERIFY(dims[ii], dimsizes3D[ii], "ncdiminq");
+
+	    /* Initialize parameters for reading data */
+	    edges[ii] = dims[ii];
+	    start[ii] = 0;
+    }
+
+    /* Data written by SD API:
+		{300,-3,-3,-3,-3,-3,
+		 301,-3,-3,-3,-3,-3,
+		 302,-3,-3,-3,-3,-3,
+		 303,-3,-3,-3,-3,-3,
+		 -3,-3,-3,-3,-3,-3,
+		 -3,-3,-3,-3,-3,-3,
+		 -3,-3,-3,-3,-3,-3,
+		 800,801,802,803,804,805} */
+
+    /* Read data pass the written data, but before max numrecs in the file */
+    start[0] = 4;
+    start[1] = start[2] = 0;
+    edges[0] = 6;
+    edges[1] = 1; edges[2] = 1;
+    HDmemset(outdata3D, 0, edges[0]*edges[1]*edges[2]*sizeof(int16));
+    status = ncvarget(ncid, var1id, start, edges, outdata3D);
+    CHECK(status, -1, "ncvarget");
+
+    /* Verify data, should be "-3,-3,-3,800,-3,-3".  The first
+	   four values are the actual values from the variable.  The last
+	   two -3s are added by nc API to fill up to the provided buffer.
+	   Note that the first three -3s were filled at the writing time due
+	   to skipping during writing */
+
+    /* Verify data */
+    status = HDmemcmp(outdata3D, result3D_start400_edge611, edges[0]*edges[1]*edges[2]*sizeof(int16));
+    VERIFY(status, 0, "HDmemcmp");
+
+    /* Read data pass the max numrecs in the file, ncvarget should fail */
+    start[0] = 4;
+    start[1] = start[2] = 0;
+    edges[0] = 10;
+    edges[1] = edges[2] = 1;
+    HDmemset(outdata3D, 0, edges[0]*edges[1]*edges[2]*sizeof(int16));
+    status = ncvarget(ncid, var1id, start, edges, outdata3D);
+    VERIFY(status, -1, "ncvarget");
+
+    /* Read 2nd variable passing its written data and then passing the
+	file's max numrecs */
+
+    /* Get access to the second variable */
+    var2id = ncvarid(ncid, VAR1D);
+    CHECK(var2id, -1, "ncvarid");
+
+    /* Get and verify variable info */
+    status = ncvarinq(ncid, var2id, varname, NULL, &rh_ndims, rh_dims, NULL);
+    CHECK(status, -1, "ncvarinq");
+
+    status = ncdiminq(ncid, rh_dims[0], NULL, &dims[0]);
+    CHECK(status, -1, "ncdiminq");
+    VERIFY(dims[0], MAX_NUMRECS, "ncdiminq"); /* Note: only written up to 6th
+		element, but netCDF uses the max number of records in the file,
+		which is 12 currently */
+
+    /* Data written by SD API: {-1,-1,300,301,302,303} */
+
+    /* Read data pass the written data, but before max numrecs in the file */
+    start[0] = 4;
+    edges[0] = 6;
+    HDmemset(outdata1D, 0, edges[0]*sizeof(int16));
+    status = ncvarget(ncid, var2id, start, edges, outdata1D);
+    CHECK(status, -1, "ncvarget");
+
+    /* Verify data, should be "302,303,-1,-1,-1,-1".  The first
+	   two values are the actual values from the variable.  The last
+	   four -1s are added by nc API to fill up to the provided buffer. */
+
+    /* Read data pass the max numrecs in the file, ncvarget should fail */
+    start[0] = 4;
+    edges[0] = 10;
+    HDmemset(outdata1D, 0, edges[0]*sizeof(int16));
+    status = ncvarget(ncid, var2id, start, edges, outdata1D);
+    VERIFY(status, -1, "ncvarget");
+
+    return 0;
+}
+
+/* Test driver for testing ncvarget in filling fill-values where appropriate */
+extern int test_ncvargetfill()
+{
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("ncvarget fills buffer when reading UDim HDF data sets (tncvarget.c)");
+
+    /* Test multiple variables with 1 unlimited dimension */
+    num_errs = num_errs + test_1dim_multivars();
+
+    /* Test multiple variables with multiple dimensions */
+    num_errs = num_errs + test_multidims();
+
+    /* Test reading passed written data and maximum numrecs in the file */
+    /* Note: MAX_NUMRECS is the number of records written to data set VARDOZEN
+	in test_multidims; it is the maximum number of records in FILENAME2
+	that is going to be read by this test_readings */
+    num_errs = num_errs + test_readings(MAX_NUMRECS);
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
diff --git a/mfhdf/test/tnetcdf.c b/mfhdf/test/tnetcdf.c
new file mode 100644
index 0000000..0a5a795
--- /dev/null
+++ b/mfhdf/test/tnetcdf.c
@@ -0,0 +1,242 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define NETCDF_READ_TEST
+
+#ifdef NETCDF_READ_TEST
+
+/* Get the srcdir string to locate the input files */
+#define srcdir getenv("srcdir")
+
+/********************************************************************
+   Name: test_read_dim() - tests reading a dimension scale in a netCDF file.
+
+   Description:
+        The fix to detect a dimension scale/coordinate variable in HDF file
+	caused incorrect result when attempting to retrieve the dimension
+	scale's number type from a netCDF file (bugzilla #1644.)
+	This test verifies that the number type of dimension scale is
+	retrieved correctly after the fix.
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Sep 23, 2009
+*********************************************************************/
+
+/* Note: This file was generated by the netCDF ncgen tool from a CDL
+   file.  The CDL file was first generated by the netCDF ncdump tool
+   from the netCDF file slice.0000.nc in bugzilla 1644 report; then
+   it was edited to change the dimensions to much smaller values. */
+#define NC_FILE  "smallslice.0000.nc"
+
+static intn test_read_dim()
+{
+    int32 fid, sds_id, status, dim1_id;
+    int32 dim_sizes[H4_MAX_VAR_DIMS];		/* read dimensions */
+    intn  ii;
+    int32 array_rank, num_type, attributes;
+    char  dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME];
+    int32 size, dim_data_type, dim_num_attrs;
+    char  testfile[512] = "";
+    intn  num_errs = 0;    /* number of errors so far */
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(NC_FILE) + 1) < sizeof(testfile))) 
+    {
+        strcpy(testfile, srcdir);
+        strcat(testfile, "/");
+    }
+
+    /* Windows doesn't set srcdir, and generates files in a different relative
+       path, so we need to special case here.  It is best to look for the
+       testfile in the same path, and the Windows test script will make sure
+       to put it there first.  - SJW 2007/09/19 */
+#ifndef _WIN32
+    /* This is to get to the file when the library was built without
+       srcdir option and the test is ran by ./hdftest in the src directory
+       hdf4/mfhdf/libsrc instead of by make check.  - BMR 2007/08/09 */
+    if (srcdir == NULL)
+	strcpy(testfile, "./");
+#endif /* _WIN32 */
+
+    strcat(testfile, NC_FILE);
+
+    /* Create the file defined by BASIC_FILE and initiate the SD interface. */
+    fid = SDstart(testfile, DFACC_READ);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Access first dataset to see what it is */
+    sds_id = SDselect(fid, 0);
+    CHECK(sds_id, FAIL, "SDselect");
+
+    /* Get info of the dataset and verify them: it is a LENGTH0 x LENGTH1 
+       array of type DFNT_INT16 and is named by DS0_NAME */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Get the first dimension id */
+    dim1_id = SDgetdimid(sds_id, 0);
+    CHECK(dim1_id, FAIL, "SDgetdimid");
+
+    /* Read the dimension information */
+    status = SDdiminfo(dim1_id, dim_name, &size, &dim_data_type, &dim_num_attrs);
+    CHECK(status, FAIL, "SDdiminfo");
+    VERIFY_CHAR(dim_name, "LON", "SDdiminfo");
+    VERIFY(dim_data_type, 6, "SDdiminfo");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "test_dimensions: SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+
+} /* test_read_dim */
+
+static int16  netcdf_u16[2][3] = {{1, 2, 3}, 
+                                   {4, 5, 6}};
+
+/* Tests reading of netCDF file 'test1.nc' using the SDxxx inteface.
+   Note not all features of reading SDS from netCDF files are tested here.
+   Hopefully more tests will be added over time as needed/required. */
+extern intn
+test_netcdf_reading()
+{
+    int32 sd_id;
+    int32 sds_id;
+    int32 n_datasets;
+    int32 n_file_attrs;
+    int32 index;
+    int32 rank;
+    int32 num_type;
+    int32 attributes;
+    int32 dim_sizes[H4_MAX_VAR_DIMS];
+    int32 start[H4_MAX_VAR_DIMS];
+    int32 edges[H4_MAX_VAR_DIMS];
+    int16 array_data[2][3];
+    char  name[H4_MAX_NC_NAME];
+    int32 status;
+    intn  i, j;
+    intn  num_errs = 0;    /* number of errors so far */
+    const char *basename = "test1.nc";
+    char  testfile[512] = "";
+
+    /* Output message about test being performed */
+    TESTING("reading of netCDF file using the SDxxx inteface (tnetcdf.c)");
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(basename) + 1) < sizeof(testfile))) 
+    {
+        strcpy(testfile, srcdir);
+        strcat(testfile, "/");
+    }
+
+    /* Windows doesn't set srcdir, and generates files in a different relative
+       path, so we need to special case here.  It is best to look for the
+       testfile in the same path, and the Windows test script will make sure
+       to put it there first.  - SJW 2007/09/19 */
+#ifndef _WIN32
+    /* This is to get to the file 'test1.nc' when the library was built without
+       srcdir option and the test is ran by ./hdftest in the src directory
+       hdf4/mfhdf/libsrc instead of by make check.  - BMR 2007/08/09 */
+    if (srcdir == NULL)
+	strcpy(testfile, "./");
+#endif /* _WIN32 */
+
+    strcat(testfile, basename);
+
+    /* Open the file 'test1.nc' and initialize the SD interface. */
+    sd_id = SDstart(testfile, DFACC_RDONLY);
+    CHECK(sd_id, FAIL, "netCDF Read Test 1. SDstart failed on file test1.nc");
+
+    /* Determine the contents of the file. */
+    status = SDfileinfo(sd_id, &n_datasets, &n_file_attrs);
+    CHECK(status, FAIL, "netCDF Read Test 1. SDfileinfo failed on file test1.nc");
+
+    /* There should be 8 datasets in the file and 1 file level attribute */
+    if (n_datasets != 8 )
+      {
+          fprintf(stderr,"netCDF Read Test 1: SDfileinfo returned wrong number of datasets in file test1.nc \n");
+          num_errs++;
+      }
+
+    if (n_file_attrs != 1 )
+      {
+          fprintf(stderr,"netCDF Read Test 1: SDfileinfo returned wrong number of file attributes in file test1.nc \n");
+          num_errs++;
+      }
+
+    /* Access and find the 2-dim dataset of data-type shorts(DFNT_INT16). 
+       in the file while querying every data set in the file. 
+       There should only be one dataset that matches and is named 'order'.*/
+    for (index = 0; index < n_datasets; index++) 
+      {
+          sds_id = SDselect(sd_id, index);
+          CHECK(sds_id, FAIL, "netCDF Read Test 1. SDselect failed for dataset in  file test1.nc");
+
+          status = SDgetinfo(sds_id, name, &rank, dim_sizes, &num_type, &attributes);
+          CHECK(status, FAIL, "netCDF Read Test 1. SDgetinfo failed for dataset in  file test1.nc");
+
+          /* look for the dataset 'order' based on rank and number type */
+          if (rank == 2 && num_type == (int32)DFNT_INT16)
+            { /* should only be one of these */
+                start[0] =  start[1] = 0; 
+                edges [0] = dim_sizes[0];
+                edges [1] = dim_sizes[1];
+                status = SDreaddata (sds_id, start, NULL, edges, (VOIDP) array_data);
+                CHECK(status, FAIL, "netCDF Read Test 1. SDreaddata failed for dataset in  file test1.nc");
+
+                /* check the data against our buffer 'netcdf_u16[][]' */
+                for (j = 0; j < dim_sizes[0]; j++ )
+                  {
+                      for (i = 0; i < dim_sizes[1]; i++)
+                        {
+                            if (array_data[j][i] != netcdf_u16[j][i])
+                              {
+                                  fprintf(stderr,"netCDF Read Test 1: bogus val read: wanted netcdf[%d][%d]=%d, read array[%d][%d]=%d \n",
+                                          j,i,netcdf_u16[j][i], j,i, array_data[j][i] );
+                              }
+                        } /* end for inner */
+                  } /* end for outer */
+            }
+
+          /* end access to this SDS */
+          status = SDendaccess(sds_id);
+          CHECK(status, FAIL, "netCDF Read Test 1. SDendaccess failed for dataset in  file test1.nc");
+      } /* end querying every dataset in file */
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "netCDF Read Test 1. SDend failed for file test1.nc");
+
+    /* Test reading dimension scale - bugzilla 1644 */
+    num_errs = num_errs + test_read_dim();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+} /* test_netcdf_reading() */
+#endif /* NETCDF_READ_TEST */
+
+
+#endif /* HDF */
diff --git a/mfhdf/test/trank0.c b/mfhdf/test/trank0.c
new file mode 100644
index 0000000..facf3e3
--- /dev/null
+++ b/mfhdf/test/trank0.c
@@ -0,0 +1,164 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * trank0.c - tests that several APIs behave "correctly" when an SDS has 
+ * 		rank = 0.
+ * Structure of the file:
+ *    test_rank0 - test routine, called in hdftest.c
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+#define FILE_NAME     "trank0.hdf"	/* data file to test for rank=0 */
+#define X_LENGTH      3
+#define Y_LENGTH      3
+#define RANK          0
+
+/* Test routine for testing the several APIs with SDS having rank = 0. */
+extern int
+test_rank0()
+{
+    int32     fid, sds1_id, sds2_id, sds_id;
+    int32     dim_sizes[2], array_rank, num_type, attributes;
+    int32     start[2], edges[2];
+    comp_coder_t comp_type;	/* to retrieve compression type into */
+    comp_info c_info;		/* compression information structure */
+    int32     comp_flag;	/* compression flag */
+    HDF_CHUNK_DEF c_def;	/* Chunking definitions */
+    int32     buf[Y_LENGTH][X_LENGTH], buf_dup[Y_LENGTH][X_LENGTH];
+    intn      i, j, status;
+    int32     status_32;
+    intn      num_errs = 0;	/* number of errors so far */
+
+    /* Output message about test being performed */
+    TESTING("several APIs with SDS having rank = 0 (trank0.c)");
+
+    /* Create a file */
+    fid = SDstart(FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "test_rank0: SDstart");
+
+    /**** Verify that SDsetcompress fails when dataset has rank 0 ****/
+
+    /* Create an X_LENGTH by Y_LENGTH dataset, called DataSet_1 */
+    dim_sizes[0] = X_LENGTH;
+    dim_sizes[1] = Y_LENGTH;
+    sds1_id = SDcreate(fid, "DataSet_1", DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds1_id, FAIL, "test_rank0: SDcreate");
+
+    /* Attempt to set compress but should fail */
+    comp_type = COMP_CODE_DEFLATE;
+    c_info.deflate.level = 6;
+    status = SDsetcompress(sds1_id, comp_type, &c_info);
+    VERIFY(status, FAIL, "test_rank0: SDsetcompress");
+
+    /**** Verify that SDsetchunk fails when dataset has rank 0 ****/
+
+    /* Create an X_LENGTH by Y_LENGTH dataset, called DataSet_2 */
+    sds2_id = SDcreate(fid, "DataSet_2", DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds2_id, FAIL, "test_rank0: SDcreate");
+
+    /* Attempt to set chunk but should fail */
+    HDmemset(&c_def, 0, sizeof(HDF_CHUNK_DEF));
+    comp_flag = HDF_CHUNK;
+    status = SDsetchunk(sds_id, c_def, comp_flag);
+    VERIFY(status, FAIL, "test_rank0: SDsetchunk");
+
+     /* Close the SDSs */
+    status = SDendaccess(sds1_id);
+    CHECK(status, FAIL, "test_rank0: SDendaccess");
+    status = SDendaccess(sds2_id);
+    CHECK(status, FAIL, "test_rank0: SDendaccess");
+
+    /**** Verify that SDwritedata fails when dataset has rank 0 ****/
+
+    /* Initialize buffer and its copy, so later can verify that the buffer
+       is not corrupted */
+    for (j=0; j<Y_LENGTH; j++)
+    {
+        for (i=0; i<X_LENGTH; i++)
+	{
+	    buf[j][i] = i;
+	    buf_dup[j][i] = i;
+	}
+    }
+    /* Select the first dataset */
+    sds_id = SDselect(fid, 0);
+    CHECK(sds_id, FAIL, "test_rank0: SDselect");
+
+    /* Define the location and size of the dataset to be written to the file */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+
+    /* Write the stored data to the dataset */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)buf);
+    VERIFY(status, FAIL, "test_rank0:SDwritedata");
+
+     /* Close the SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_rank0: SDendaccess");
+
+    /**** Verify that SDreaddata doesn't corrupt user's buffer, when dataset 
+	  has rank 0; at this time, it does (buf[0][0] changed), but EP said
+    	  to just document it for now 2/8/05 - BMR ****/
+
+    /* Select the first dataset */
+    sds_id = SDselect(fid, 0);
+    CHECK(sds_id, FAIL, "test_rank0: SDselect");
+
+    /* Read the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = Y_LENGTH;
+    edges[1] = X_LENGTH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)buf);
+    CHECK(status, FAIL, "test_rank0: SDreaddata");
+
+     /* Close the SDS */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_rank0: SDendaccess");
+
+    /**** Verify various functions ****/
+
+    /* Select the second dataset */
+    sds_id = SDselect(fid, 1);
+    CHECK(sds_id, FAIL, "test_rank0: SDselect");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, NULL, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "test_rank0: SDgetinfo");
+    VERIFY(array_rank, 0, "test_rank0: SDgetinfo");
+
+    /* Verify that SDisrecord doesn't cause seg. fault */
+    status_32 = SDisrecord(sds_id);
+    VERIFY(status_32, TRUE, "test_rank0: SDisrecord");
+
+     /* Close the SDSs */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "test_rank0: SDendaccess");
+
+    /* Close the SD interface */
+    status = SDend(fid);
+    CHECK(status, FAIL, "test_rank0: SDend");
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/tsd.c b/mfhdf/test/tsd.c
new file mode 100644
index 0000000..a51543b
--- /dev/null
+++ b/mfhdf/test/tsd.c
@@ -0,0 +1,86 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tsd.c - tests SDstart for file with no write permission
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+#include "hfile.h"
+
+#define FILE_NAME     "sdtest.hdf"	/* data file to test ID types */
+
+extern int
+test_sd()
+{
+    int32     fid;
+    intn      status;
+#ifdef _WIN32
+    int mode;
+#else
+    mode_t mode;
+#endif
+
+    FILE *ff;
+    intn      num_errs = 0;         /* number of errors so far */
+
+    /* Output message about test being performed */
+    TESTING("SDstart for file with no write permission (tsd.c)");
+
+    /* delete the file just to be sure */
+    unlink(FILE_NAME);
+
+    /* Create a file */
+    fid = SDstart(FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+#ifdef _WIN32
+    mode = _S_IREAD;
+#else
+    mode =  S_IRUSR;
+#endif
+
+    status = chmod(FILE_NAME, mode);
+    CHECK(status, FAIL, "chmod");
+
+    /* Create a protected file */
+    fid = SDstart(FILE_NAME, DFACC_CREATE);
+    VERIFY(fid, FAIL, "second SDstart");
+
+    ff = HI_OPEN(FILE_NAME, DFACC_READ);
+    CHECK(ff, NULL, "fopen");
+    
+    if (ff != NULL) {
+	    HI_CLOSE(ff);
+    }
+
+#ifdef _WIN32
+    mode = _S_IWRITE;
+#else
+    mode =  S_IWUSR;
+#endif
+
+    status = chmod(FILE_NAME, mode);
+    CHECK(status, FAIL, "chmod");
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}   /* test_SDAPI_ids */
+#endif /* HDF */
diff --git a/mfhdf/test/tsdsprops.c b/mfhdf/test/tsdsprops.c
new file mode 100644
index 0000000..1d36370
--- /dev/null
+++ b/mfhdf/test/tsdsprops.c
@@ -0,0 +1,773 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tsdsprops.c - tests functionality regarding an SDS' properties, such
+ *		 name, dimensions, type, size,...
+ * Structure of the file:
+ *    test_SDSprops - test driver
+ *	  test_SDSnames    - tests that an SDS name can be more than 
+ *		previously hardcoded at 64 characters; now length is variable.
+ *	  test_unlim_dim - tests that writing two unlimited 1D datasets,
+ *		without closing the file between writes, will not cause the
+ *		second dataset to contain garbage anymore. (bug 525)
+ *	  test_unlim_inloop - tests that appending unlimited data to more 
+ *		than one dataset within a loop stores data correctly. (bug 801)
+ *	  test_valid_args - tests that when some invalid argments were passed
+ *		into an API, they can be caught and handled properly.
+ *		(bugzilla 150)
+****************************************************************************/
+
+#include "mfhdf.h"
+
+#ifdef HDF
+
+#include "hdftest.h"
+
+/***************************************************************************
+   Name: test_SDSnames() - tests that SDS name is no longer restricted to 
+			   64 characters only. (bugzilla 516)
+   Description:
+	The main contents include:
+	- create data sets with very short and very long names
+	- close the file, then reopen it, get SDS' info, and verify the names
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Oct 2006
+****************************************************************************/
+
+#define FILE_NAME     "SDSlongname.hdf"	/* data file to test SDS names */
+#define X_LENGTH      10
+#define Y_LENGTH      10
+#define RANK          2
+#define NAME_LEN1     93	/* the length of longname_ds below */
+#define NAME_LEN2     1		/* the length of shortname_ds below */
+
+#define	longname_ds	"The name of this dataset is long, and it is used to test the new variable length name feature"
+#define	shortname_ds	"A"
+
+static intn
+test_SDSnames()
+{
+    int32  fid, dset1, dset2;
+    int32  rank, dtype, nattrs, dimsizes[RANK];
+    char*  ds_name;
+    uint16 name_len;
+    intn   status;
+    intn   num_errs = 0;         /* number of errors so far */
+
+    /* Create a file */
+    fid = SDstart(FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Create an X_LENGTH by Y_LENGTH dataset, called DataSet_1 */
+    dimsizes[0] = X_LENGTH;
+    dimsizes[1] = Y_LENGTH;
+    dset1 = SDcreate(fid, longname_ds, DFNT_INT32, RANK, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    dset2 = SDcreate(fid, shortname_ds, DFNT_INT32, RANK, dimsizes);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Re-open the file to check on the SDS name */
+    fid = SDstart(FILE_NAME, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Get access to the first dataset */
+    dset1 = SDselect(fid, 0);
+    CHECK(dset1, FAIL, "SDselect");
+
+    /* Get and verify the length of its name */
+    status = SDgetnamelen(dset1, &name_len);
+    CHECK(status, FAIL, "SDgetnamelen");
+    VERIFY(name_len, NAME_LEN1, "SDgetnamelen");
+
+    /* Allocate buffer to get its name */
+    ds_name = (char *)HDmalloc(name_len+1);
+    CHECK(ds_name, NULL, "HDmalloc");
+
+    /* Get information of the first dataset, and verify its name */
+    status = SDgetinfo(dset1, ds_name, &rank, dimsizes, &dtype, &nattrs);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY_CHAR(ds_name, longname_ds, "SDgetinfo");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Release allocated memory */
+    HDfree(ds_name);
+
+    /* Get access to the second dataset */
+    dset2 = SDselect(fid, 1);
+    CHECK(dset2, FAIL, "SDselect");
+
+    /* Get and verify the length of its name */
+    name_len = 0;
+    status = SDgetnamelen(dset2, &name_len);
+    CHECK(status, FAIL, "SDgetnamelen");
+    VERIFY(name_len, NAME_LEN2, "SDgetnamelen");
+
+    /* Allocate buffer to get its name */
+    ds_name = (char *)HDmalloc(name_len+1);
+    CHECK(ds_name, NULL, "HDmalloc");
+
+    /* Get information of the second dataset, and verify its name */
+    status = SDgetinfo(dset2, ds_name, &rank, dimsizes, &dtype, &nattrs);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY_CHAR(ds_name, shortname_ds, "SDgetinfo");
+
+    /* Close the datasets */
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Release allocated memory */
+    HDfree(ds_name);
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of, so far */
+    return num_errs;
+}   /* test_SDSnames */
+
+/***************************************************************************
+   Name: test_unlim_dim() - tests that writing two unlimited 1D datasets,
+			    without closing the file between writes, will 
+			    not cause the second dataset to contain garbage 
+			    anymore. (bug 525)
+   Description:
+	The main contents include:
+	- create and write to two datasets
+	- append data to both without closing anything
+	- close the datasets and the file
+	- reopen the file, get the data sets and their info
+	- read and verify the data
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Oct 2005
+****************************************************************************/
+
+#define UD_FILE_NAME  "Unlim_dim.hdf"	/* data file to test unlimited dim */
+#define DS1_NAME "data 1"
+#define DS2_NAME "data 2"
+#define DIM0 10
+
+static intn
+test_unlim_dim()
+{
+    int32 fid, dset1, dset2;
+    int32 rank, start[1], edges[1], dtype, nattrs, dimsizes[1];
+    int16 array_data[DIM0],	/* data to be written to both datasets */
+	  append_data[DIM0],	/* data to be appended to both datasets */
+	  outdata[DIM0+DIM0], outdata1[DIM0+DIM0]; /* data read */
+    char  ds_name[20];
+    intn  idx, status;
+    intn  num_errs = 0;         /* number of errors so far */
+
+    /* Create a file */
+    fid = SDstart(UD_FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Define the rank and dimensions of the data set to be created. */
+    rank = 1;
+    dimsizes[0] = SD_UNLIMITED;
+
+    /* Create two array data sets. */
+    dset1 = SDcreate(fid, DS1_NAME, DFNT_INT16, rank, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    dset2 = SDcreate(fid, DS2_NAME, DFNT_INT16, rank, dimsizes);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Fill the stored-data array with values. */
+    for (idx = 0; idx < DIM0; idx++) {
+	array_data[idx] = idx + 1;
+    }
+
+    /* Define the location, pattern, and size of the data sets */
+    start[0] = 0;
+    edges[0] = DIM0;
+
+    status = SDwritedata(dset1, start, NULL, edges, (VOIDP)array_data);
+    CHECK(status, FAIL, "SDwritedata");
+    status = SDwritedata(dset2, start, NULL, edges, (VOIDP)array_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Store array values to be appended */
+    for (idx = 0; idx <DIM0; idx++)
+	append_data[idx] = DIM0 + idx;
+
+    /* Define the location of the append */
+    start[0] = DIM0; /* start from the end of the previous write */
+    edges[0] = DIM0; /* append the same number of elements as the write */
+
+    /* Append data to file */
+    status = SDwritedata (dset1, start, NULL, edges, (VOIDP) append_data);
+    CHECK(status, FAIL, "SDwritedata");
+    status = SDwritedata (dset2, start, NULL, edges, (VOIDP) append_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Re-open the file to check on the SDS names */
+    fid = SDstart(UD_FILE_NAME, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Get access to the datasets */
+    dset1 = SDselect(fid, 0);
+    CHECK(dset1, FAIL, "SDselect");
+    dset2 = SDselect(fid, 1);
+    CHECK(dset1, FAIL, "SDselect");
+
+    /* Get information of the first dataset, and verify its name */
+    status = SDgetinfo(dset1, ds_name, &rank, dimsizes, &dtype, &nattrs);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Define the location to read */
+    start[0] = 0;
+    edges[0] = DIM0+DIM0;
+
+    /* Read and check first dataset */
+    status = SDreaddata(dset1, start, NULL, edges, (VOIDP) outdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for (idx = 0; idx < DIM0; idx++) {
+	VERIFY(outdata[idx], array_data[idx], "SDreaddata first dataset");
+    }
+    for (idx = DIM0; idx < edges[0]; idx++) {
+	VERIFY(outdata[idx], append_data[idx-DIM0], "SDreaddata first dataset");
+    }
+
+    /* Read and check second dataset */
+    status = SDreaddata(dset2, start, NULL, edges, (VOIDP) outdata1);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for (idx = 0; idx < DIM0; idx++) {
+	VERIFY(outdata1[idx], array_data[idx], "SDreaddata first dataset");
+    }
+    for (idx = DIM0; idx < edges[0]; idx++) {
+	VERIFY(outdata1[idx], append_data[idx-DIM0], "SDreaddata first dataset");
+    }
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the datasets */
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of, so far */
+    return num_errs;
+}   /* test_unlim_dim */
+
+/***************************************************************************
+   Name: test_unlim_inloop() - tests that appending unlimited data to more
+			    than one dataset within a loop stores data
+			    correctly. (bug 801)
+   Description:
+	The main contents include:
+	- create two data sets 
+	- write to the data sets in a loop
+	- close the file, then reopen it
+	- in another loop, read the data sets and verify their data
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Oct 2005
+****************************************************************************/
+
+#define UDIL_FILE_NAME  "Unlim_inloop.hdf" /* file to test unlim dims in loop */
+#define SIZE 5 
+#define N_DSETS 2 
+#define RANK1 1 
+
+static intn
+test_unlim_inloop()
+{
+    int32   fid;
+    int32   sds_id[N_DSETS];
+    int32   start[RANK1], edges[RANK1], rank, dimsizes[RANK1];
+    int32   dtype, nattrs;
+    char    sds_name[20];
+    int     i, n_writes; /* number of times writing to the data sets */
+    /*int32   n,m, mm;*/
+    intn    status;
+    float64 array_data[SIZE];
+    intn    num_errs = 0;         /* number of errors so far */
+
+    /* Create a file */
+    fid = SDstart(UDIL_FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    dimsizes[0] = SD_UNLIMITED;
+
+    /* Create N_DSETS data sets in a loop */
+    for(i = 0; i < N_DSETS; i++) {
+        sprintf(sds_name,"test%d",i);
+        sds_id[i] = SDcreate (fid, sds_name, DFNT_FLOAT64, 1, dimsizes);
+        CHECK(sds_id[i], FAIL, "SDcreate");
+
+        status = SDendaccess (sds_id[i]);
+        CHECK(status, FAIL, "SDendaccess");
+     }
+
+    /* Making up data to write */
+    for (i = 0; i < SIZE; i++) {
+	array_data[i] = i + 1;
+    } 
+
+    /* write and append to the data sets */
+    n_writes = 0;
+    edges[0] = SIZE;
+    while (n_writes < 2)
+    {
+	/* i.e, start at 0 first time and at SIZE second time*/
+	start[0] = SIZE * n_writes;
+
+	for (i = 0; i < N_DSETS; i++) 
+	{
+	    sds_id[i] = SDselect(fid, i);
+	    CHECK(sds_id[i], FAIL, "SDselect");
+
+	    status = SDwritedata(sds_id[i], start, NULL, edges, (VOIDP)array_data);
+	    CHECK(status, FAIL, "SDwritedata");
+
+	    status = SDendaccess (sds_id[i]);
+	    CHECK(status, FAIL, "SDendaccess");
+	}
+	n_writes++;
+    }
+
+    /* close the file */
+    status = SDend (fid);
+    CHECK(status, FAIL, "SDcreate");
+
+    /* Re-open the file to check on the SDS name */
+    fid = SDstart(UDIL_FILE_NAME, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    for (i = 0; i < N_DSETS; i++)
+    {
+	float64 outdata[SIZE*2];
+
+	/* Get access to the datasets */
+	sds_id[i] = SDselect(fid, i);
+
+	/* Get information of the first dataset, and verify its name */
+	status = SDgetinfo(sds_id[i], sds_name, &rank, dimsizes, &dtype, &nattrs);
+	CHECK(status, FAIL, "SDgetinfo");
+
+	/* Define the location to read */
+	start[0] = 0;
+	edges[0] = SIZE * n_writes;
+
+	/* Read and check first dataset */
+	status = SDreaddata(sds_id[i], start, NULL, edges, (VOIDP) outdata);
+	CHECK(status, FAIL, "SDreaddata");
+
+	/* Verify the read data */
+	n_writes = 0;
+	while (n_writes < 2)
+	{
+	    intn in, out;
+	    for (in = 0, out = 0+(SIZE*n_writes); in < SIZE; in++, out++) {
+                VERIFY(outdata[out], array_data[in], "SDreaddata");
+	    }
+	    n_writes++;
+	}
+
+	/* Close the datasets */
+	status = SDendaccess(sds_id[i]);
+	CHECK(status, FAIL, "SDendaccess");
+    }
+
+    /* close the file */
+    status = SDend (fid);
+    CHECK(status, FAIL, "SDcreate");
+
+    /* Return the number of errors that's been kept track of, so far */
+    return num_errs;
+}   /* test_unlim_inloop */
+
+/***************************************************************************
+   Name: test_valid_args() - tests that when some invalid argments were passed
+			    into an API, they can be caught and handled 
+			    properly. (bugzilla 150)
+   Description:
+	The main contents include:
+	- create a data set of size X_LENGTH x Y_LENGTH
+	- write to the data set
+	- close the file, then reopen it
+	- read the dataset giving a stride value, that goes beyong the 
+	  dimension size
+	- when SDreaddata failed, try to check for error code DFE_ARGS and
+	  handle the failure properly
+	- close all.
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Sep 2007
+****************************************************************************/
+
+#define ARGS_FILE_NAME  "test_arguments.hdf" /* file to test validating args */
+
+static intn
+test_valid_args()
+{
+    int32 fid, dset1, dset2;
+    int32 start[2], edges[2], dtype, nattrs, dimsizes[2], rank, strides[2];
+    int16 array_data[X_LENGTH][Y_LENGTH], /* data to be written to datasets */
+	  outdata[X_LENGTH][Y_LENGTH];    /* data read */
+    char  ds_name[20];
+    intn  idxx, idxy, status;
+    intn  num_errs = 0;         /* number of errors so far */
+
+    /* Create a file */
+    fid = SDstart(ARGS_FILE_NAME, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Create two array data sets. */
+    dimsizes[0] = X_LENGTH;
+    dimsizes[1] = Y_LENGTH;
+    dset1 = SDcreate(fid, DS1_NAME, DFNT_INT16, RANK, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    dimsizes[0] = SD_UNLIMITED;
+    dset2 = SDcreate(fid, DS2_NAME, DFNT_INT16, RANK, dimsizes);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Fill the stored-data array with values. */
+    for (idxx = 0; idxx < X_LENGTH; idxx++) {
+	for (idxy = 0; idxy < Y_LENGTH; idxy++) {
+	    array_data[idxx][idxy] = idxx*idxy + 1;
+    }}
+
+    /* Define the location, pattern, and size of the data sets */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = X_LENGTH;
+    edges[1] = Y_LENGTH;
+
+    status = SDwritedata(dset1, start, NULL, edges, (VOIDP)array_data);
+    CHECK(status, FAIL, "SDwritedata");
+    status = SDwritedata(dset2, start, NULL, edges, (VOIDP)array_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Re-open the file to check on the SDS names */
+    fid = SDstart(ARGS_FILE_NAME, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Get access to the datasets */
+    dset1 = SDselect(fid, 0);
+    CHECK(dset1, FAIL, "SDselect");
+    dset2 = SDselect(fid, 1);
+    CHECK(dset1, FAIL, "SDselect");
+
+    /* Get information of the first dataset, and verify its name */
+    status = SDgetinfo(dset1, ds_name, &rank, dimsizes, &dtype, &nattrs);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Define the location to read */
+    strides[0] = X_LENGTH;	/* simulate a mistake here, should have -1 */
+    strides[1] = Y_LENGTH-1;
+
+    /* Attempt to read first dataset, it should fail with invalid an 
+	argument error */
+    status = SDreaddata(dset1, start, strides, edges, (VOIDP) outdata);
+    VERIFY(status, FAIL, "SDreaddata");
+    VERIFY(HEvalue(1), DFE_ARGS, "SDreaddata");
+
+    /* Show that the error was also caught for the dataset with unlimited 
+	dimension */
+    status = SDreaddata(dset2, start, strides, edges, (VOIDP) outdata);
+    VERIFY(status, FAIL, "SDreaddata");
+    VERIFY(HEvalue(1), DFE_ARGS, "SDreaddata");
+
+    /* Close the datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the datasets */
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of, so far */
+    return num_errs;
+}   /* test_valid_args */
+
+/*******************************************************************
+   Name: test_valid_args2() - tests that when some invalid argments were passed
+			    into SDreaddata, causing the function to attempt
+			    to read beyond the dimension size, can be caught 
+			    and handled properly. (more for bugzilla 150)
+   Description:
+	The main contents include:
+	- creates a file and three datasets:
+	  + "data1" dimsizes=[1] int32 read the one element
+	  + "data2" dimsizes=[202,271]
+	  + "data3" dimsizes=[10,3,2]
+	- close the file and reopen it to check reading data
+	- read the datasets as followed to test error checkings on parameters
+	  + "data1" - attempts to read with incorrect stride value
+	  + "data1" - attempts to read with incorrect count value
+	  + "data1" - reads again with all arguments in bounds
+	  + "data2" - attempts to read with strides[1]=D2_Y (correct: D2_Y-1)
+	  + "data2" - attempts to read with count[1]=3 (correct: 2)
+	  + "data3" - attempts to read with incorrect combination of stride and count
+	  + "data3" - reads again with all arguments in bounds
+                                                                 
+********************************************************************/
+#define D1_X 1
+#define D2_X 202
+#define D2_Y 271
+#define D3_X 10
+#define D3_Y 3
+#define D3_Z 2
+
+/* Helper function to test_valid_args2 creates and writes to a dataset */
+intn makeSDS(int32 sd_id, char* name, int32 dtype, int32 rank, 
+	     int32* dimsizes, int32* start, int32* strides, 
+	     int32* count, void* data)
+{
+    int32 sds_id;
+    intn status;
+    intn  num_errs = 0;         /* number of errors so far */
+
+    /* Create the named dataset */
+    sds_id = SDcreate(sd_id, name, dtype, rank, dimsizes);
+    CHECK(sds_id, FAIL, "SDcreate");
+
+    /* Write to it */
+    status = SDwritedata(sds_id, start, strides, count, data); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the array. */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    return (status);
+}
+
+static intn
+test_valid_args2()
+{
+    int32 sd_id, sds_id;
+    int32 dim[1], dims2[2], dims3[3], d1start[1], d2start[2], d3start[3];
+    int32 d1count[1], d2count[2], d3count[3];
+    int32 d1stride[1], d2stride[2], d3stride[3];
+    float32 data1=32.0, outdata1;
+    int32 data2[D2_X][D2_Y], outdata2[D2_X][D2_Y];
+    int16 data3[D3_X][D3_Y][D3_Z], outdata3[D3_X][D3_Y][D3_Z];
+    intn i, j, k, status;
+    intn  num_errs = 0;         /* number of errors so far */
+
+    /* Create and open the file and initiate the SD interface. */
+    sd_id = SDstart("b150.hdf", DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create the first dataset */
+    dim[0] = D1_X;
+    d1start[0] = 0;
+    d1count[0] = 1;
+    data1 = 32.0;
+    status = makeSDS(sd_id, "data1", DFNT_FLOAT32, 1, dim, d1start, NULL, d1count, &data1);
+    CHECK(status, FAIL, "makeSDS data1");
+
+    /* Create and write to second dataset */
+    dims2[0] = D2_X;
+    dims2[1] = D2_Y;
+    d2start[0] = d2start[1] = 0;
+    d2count[0] = dims2[0];
+    d2count[1] = dims2[1];
+    for (i = 0; i < D2_X; i++)
+	for (j = 0; j < D2_Y; j++)
+	    data2[i][j] = i * j;
+
+    status = makeSDS(sd_id, "data2", DFNT_INT32, 2, dims2, d2start, NULL, d2count, data2);
+    CHECK(status, FAIL, "makeSDS data2");
+
+
+    /* Create and write to third dataset */
+    dims3[0] = D3_X;
+    dims3[1] = D3_Y;
+    dims3[2] = D3_Z;
+    d3start[0] = d3start[1] = d3start[2] = 0;
+    d3count[0] = dims3[0];
+    d3count[1] = dims3[1];
+    d3count[2] = dims3[2];
+    for (i = 0; i < D3_X; i++)
+	for (j = 0; j < D3_Y; j++)
+	    for (k = 0; k < D3_Z; k++)
+		data3[i][j][k] = i * j * k;
+
+    status = makeSDS(sd_id, "data3", DFNT_INT16, 3, dims3, d3start, NULL, d3count, data3);
+    CHECK(status, FAIL, "makeSDS data3");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Reopen the file and read in some of the data */
+    sd_id = SDstart("b150.hdf", DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Read first dataset with incorrect stride value, but shouldn't fail */
+    sds_id = SDselect(sd_id, 0);
+    d1start[0] = 0;
+    d1stride[0] = 2; /* irrelevant because only 1 value to be read */
+    d1count[0] = 1;
+    status = SDreaddata(sds_id, d1start, d1stride, d1count, &outdata1);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Read first dataset with incorrect count value */
+    d1start[0] = 0;
+    d1stride[0] = 1;
+    d1count[0] = 2; /* array only has 1 value */
+    status = SDreaddata(sds_id, d1start, d1stride, d1count, &outdata1);
+    VERIFY(status, FAIL, "SDreaddata");
+
+    /* Read again with "correct" arguments */
+    d1count[0] = 1;
+    status = SDreaddata(sds_id, d1start, d1stride, d1count, &outdata1);
+    CHECK(status, FAIL, "SDreaddata");
+    VERIFY(outdata1, data1, "SDreaddata first dataset");
+
+    /* Terminate access to the first dataset */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Read second dataset with out of bound stride */
+    sds_id = SDselect(sd_id, 1);
+    d2start[0] = d2start[0] = 0;
+    d2stride[0] = 1;
+    d2stride[1] = D2_Y;  /* should be D2_Y - 1 */
+    d2count[0] = D2_X;
+    d2count[1] = 2;
+    status = SDreaddata(sds_id, d2start, d2stride, d2count, (VOIDP)outdata2);
+    VERIFY(status, FAIL, "SDreaddata");
+
+    /* Read second dataset with too many values requested */
+    d2stride[1] = D2_Y - 1;
+    d2count[1] = 3;	/* should be 2 */
+    status = SDreaddata(sds_id, d2start, d2stride, d2count, (VOIDP)outdata2);
+    VERIFY(status, FAIL, "SDreaddata");
+
+    /* Terminate access to the second dataset */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Read third dataset with too many values requested */
+    sds_id = SDselect(sd_id, 2);
+    d3start[0] = 1;
+    d3start[1] = d3start[2] = 0;
+    d3stride[0] = 3;
+    d3stride[1] = 2;
+    d3stride[2] = 1;
+    d3count[0] = 4;  /* should be 3 max or smaller stride */
+    d3count[1] = 2;
+    d3count[2] = 2;
+    status = SDreaddata(sds_id, d3start, d3stride, d3count, (VOIDP)outdata3);
+    VERIFY(status, FAIL, "SDreaddata");
+
+    /* Read again with "correct" arguments */
+    d3start[0] = 1;
+    d3start[1] = d3start[2] = 0;
+    d3stride[0] = 3;
+    d3stride[1] = 2;
+    d3stride[2] = 1;
+    d3count[0] = 3;
+    d3count[1] = 2;
+    d3count[2] = 2;
+    status = SDreaddata(sds_id, d3start, d3stride, d3count, (VOIDP)outdata3);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Terminate access to the third dataset */
+    status = SDendaccess(sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend(sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of, so far */
+    return num_errs;
+} /* test_valid_args2 */
+
+/* Test driver for testing various SDS' properties. */
+extern int
+test_SDSprops()
+{
+    intn num_errs = 0;         /* number of errors */
+
+    /* Output message about test being performed */
+    TESTING("various SDS' properties (tsdsprops.c)");
+
+    num_errs = num_errs + test_SDSnames();
+    num_errs = num_errs + test_unlim_dim();
+    num_errs = num_errs + test_unlim_inloop();
+    num_errs = num_errs + test_valid_args();
+    num_errs = num_errs + test_valid_args2();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
+
+#endif /* HDF */
diff --git a/mfhdf/test/tszip.c b/mfhdf/test/tszip.c
new file mode 100644
index 0000000..8b7e3ff
--- /dev/null
+++ b/mfhdf/test/tszip.c
@@ -0,0 +1,1477 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "mfhdf.h"
+#include "hdftest.h"
+#ifdef H4_HAVE_LIBSZ
+#include "szlib.h"
+#endif
+
+#define FILE_NAME8	"SDS_8_sziped.hdf"
+#define FILE_NAME16	"SDS_16_sziped.hdf"
+#define FILE_NAME32	"SDS_32_sziped.hdf"
+#define FILE_NAMEfl32	"SDS_fl32_sziped.hdf"
+#define FILE_NAMEfl64	"SDS_fl64_sziped.hdf"
+#define SDS_NAME	"SzipedData"
+
+#define RANK		2
+#define WIDTH		6
+#define LENGTH		9
+
+#ifdef H4_HAVE_SZIP_ENCODER /* only compile all these test functions when 
+				encoder is available */
+static intn test_szip_SDS8bit()
+{
+   /************************* Variable declaration **************************/
+
+   int32	sd_id, sds_id;
+   intn 	status;
+   int32	dim_sizes[2], array_rank, num_type, attributes;
+   char 	name[H4_MAX_NC_NAME];
+   comp_info 	c_info;
+   int32        start[2], edges[2];
+   int8         fill_value = 0; /* Fill value */
+   int          i,j;
+   int    	num_errs = 0;   /* number of errors so far */
+   comp_coder_t comp_type;      /* to retrieve compression type into */
+   comp_info    cinfo;          /* compression information structure */
+   int8         out_data[LENGTH][WIDTH];
+   int8         in_data[LENGTH][WIDTH]={
+	   			 1,1,2,2,3,4,
+	   			 1,1,2,2,3,4,
+				 1,1,2,2,3,4,
+				 3,3,0,4,3,4,
+				 3,3,0,4,3,4,
+				 3,3,0,4,3,4,
+				 0,0,6,6,3,4,
+				 5,5,6,6,3,4,
+				 0,0,6,6,3,4};
+
+    /********************* End of variable declaration ***********************/
+
+    /* Create the file and initialize SD interface */
+    sd_id = SDstart (FILE_NAME8, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create the SDS */
+    dim_sizes[0] = LENGTH;
+    dim_sizes[1] = WIDTH;
+    sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT8, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    for (i = 0; i < RANK; i++) {
+	start[i] = 0;
+	edges[i] = dim_sizes[i];
+	}
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Initialization for SZIP */
+    c_info.szip.pixels_per_block = 2;
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 0;
+    c_info.szip.pixels = 0;
+    c_info.szip.pixels_per_scanline = 0;
+
+    /* Set the compression */
+    status = SDsetcompress (sds_id, COMP_CODE_SZIP, &c_info);
+       CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write data to the SDS */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file to 
+       flush the compressed info to the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+    * Verify the compressed data
+    */
+
+    /* Reopen the file and select the first SDS */
+    sd_id = SDstart (FILE_NAME8, DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    sds_id = SDselect (sd_id, 0);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for szip compression testing");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Retrieve compression informayion about the dataset */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&c_info, 0, sizeof(c_info)) ;
+
+    status = SDgetcompinfo(sds_id, &comp_type, &c_info);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_SZIP, "SDgetcompinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = LENGTH;
+    edges[1] = WIDTH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Compare read data against input data */
+    for (j=0; j<LENGTH; j++) 
+    {
+        for (i=0; i<WIDTH; i++)
+	    if (out_data[j][i] != in_data[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in compressed dset, want %ld got %ld\n", j, i, (long)in_data[j][i], (long)out_data[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+} /* test_szip_SDS8bit */
+
+static intn test_szip_SDS16bit()
+{
+    /************************* Variable declaration **************************/
+
+    int32	sd_id, sds_id;
+    intn 	status;
+    int32	dim_sizes[2], array_rank, num_type, attributes;
+    char	name[H4_MAX_NC_NAME];
+    comp_info	c_info;
+    int32       start[2], edges[2];
+    int16       fill_value = 0;   /* Fill value */
+    int         i,j;
+    int		num_errs = 0;    /* number of errors so far */
+    int16	out_data[LENGTH][WIDTH];
+    int16	in_data[LENGTH][WIDTH]={
+	   			 100,100,200,200,300,400,
+	   			 100,100,200,200,300,400,
+				 100,100,200,200,300,400,
+				 300,300,  0,400,300,400,
+				 300,300,  0,400,300,400,
+				 300,300,  0,400,300,400,
+				   0,  0,600,600,300,400,
+				 500,500,600,600,300,400,
+				   0,  0,600,600,300,400};
+
+    /********************* End of variable declaration ***********************/
+
+    /* Create the file and initialize SD interface */
+    sd_id = SDstart (FILE_NAME16, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create the SDS */
+    dim_sizes[0] = LENGTH;
+    dim_sizes[1] = WIDTH;
+    sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT16, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    for (i = 0; i < RANK; i++) {
+	start[i] = 0;
+	edges[i] = dim_sizes[i];
+	}
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Initialize for SZIP */
+    c_info.szip.pixels_per_block = 2;
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 0;
+    c_info.szip.pixels = 0;
+    c_info.szip.pixels_per_scanline = 0;
+
+    /* Set the compression */
+    status = SDsetcompress (sds_id, COMP_CODE_SZIP, &c_info);
+       CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write data to the SDS */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file to 
+       flush the compressed info to the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+    * Verify the compressed data
+    */
+
+    /* Reopen the file and select the first SDS */
+    sd_id = SDstart (FILE_NAME16, DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    sds_id = SDselect (sd_id, 0);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for szip compression testing");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = LENGTH;
+    edges[1] = WIDTH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Compare read data against input data */
+    for (j=0; j<LENGTH; j++) 
+    {
+        for (i=0; i<WIDTH; i++)
+	    if (out_data[j][i] != in_data[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in compressed dset, want %ld got %ld\n", j, i, (long)in_data[j][i], (long)out_data[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_szip_SDS16bit */
+
+static intn test_szip_SDS32bit()
+{
+    /************************* Variable declaration **************************/
+
+    int32	sd_id, sds_id;
+    intn 	status;
+    int32	dim_sizes[2], array_rank, num_type, attributes;
+    char	name[H4_MAX_NC_NAME];
+    comp_info	c_info;
+    int32       start[2], edges[2];
+    int32       fill_value = 0;   /* Fill value */
+    int         i,j;
+    int		num_errs = 0;    /* number of errors so far */
+    int32	out_data[LENGTH][WIDTH];
+    int32	in_data[LENGTH][WIDTH]={
+	   			 100,100,200,200,300,400,
+	   			 100,100,200,200,300,400,
+				 100,100,200,200,300,400,
+				 300,300,  0,400,300,400,
+				 300,300,  0,400,300,400,
+				 300,300,  0,400,300,400,
+				   0,  0,600,600,300,400,
+				 500,500,600,600,300,400,
+				   0,  0,600,600,300,400};
+
+    /********************* End of variable declaration ***********************/
+
+    /* Create the file and initialize SD interface */
+    sd_id = SDstart (FILE_NAME32, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create the SDS */
+    dim_sizes[0] = LENGTH;
+    dim_sizes[1] = WIDTH;
+    sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    for (i = 0; i < RANK; i++) {
+	start[i] = 0;
+	edges[i] = dim_sizes[i];
+	}
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Initialize for SZIP */
+    c_info.szip.pixels_per_block = 2;
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 0;
+    c_info.szip.pixels = 0;
+    c_info.szip.pixels_per_scanline = 0;
+
+    /* Set the compression */
+    status = SDsetcompress (sds_id, COMP_CODE_SZIP, &c_info);
+    CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write data to the SDS */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file to 
+       flush the compressed info to the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+    * Verify the compressed data
+    */
+
+    /* Reopen the file and select the first SDS */
+    sd_id = SDstart (FILE_NAME32, DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    sds_id = SDselect (sd_id, 0);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for szip compression testing");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = LENGTH;
+    edges[1] = WIDTH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Compare read data against input data */
+    for (j=0; j<LENGTH; j++) 
+    {
+        for (i=0; i<WIDTH; i++)
+	    if (out_data[j][i] != in_data[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in compressed dset, want %ld got %ld\n", j, i, (long)in_data[j][i], (long)out_data[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_szip_SDS32bit */
+
+static intn test_szip_SDSfl32bit()
+{
+    /************************* Variable declaration **************************/
+
+    int32	sd_id, sds_id;
+    intn 	status;
+    int32	dim_sizes[2], array_rank, num_type, attributes;
+    char	name[H4_MAX_NC_NAME];
+    comp_info	c_info;
+    int32       start[2], edges[2];
+    float32     fill_value = 0;   /* Fill value */
+    int         i,j;
+    int		num_errs = 0;    /* number of errors so far */
+    float32	out_data[LENGTH][WIDTH];
+    float32	in_data[LENGTH][WIDTH]={
+	   			 100.0,100.0,200.0,200.0,300.0,400.0,
+	   			 100.0,100.0,200.0,200.0,300.0,400.0,
+				 100.0,100.0,200.0,200.0,300.0,400.0,
+				 300.0,300.0,  0.0,400.0,300.0,400.0,
+				 300.0,300.0,  0.0,400.0,300.0,400.0,
+				 300.0,300.0,  0.0,400.0,300.0,400.0,
+				   0.0,  0.0,600.0,600.0,300.0,400.0,
+				 500.0,500.0,600.0,600.0,300.0,400.0,
+				   0.0,  0.0,600.0,600.0,300.0,400.0};
+
+    /********************* End of variable declaration ***********************/
+
+    /* Create the file and initialize SD interface */
+    sd_id = SDstart (FILE_NAMEfl32, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create the SDS */
+    dim_sizes[0] = LENGTH;
+    dim_sizes[1] = WIDTH;
+    sds_id = SDcreate (sd_id, SDS_NAME, DFNT_FLOAT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    for (i = 0; i < RANK; i++) {
+	start[i] = 0;
+	edges[i] = dim_sizes[i];
+	}
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Initialize for SZIP */
+    c_info.szip.pixels_per_block = 2;
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 0;
+    c_info.szip.pixels = 0;
+    c_info.szip.pixels_per_scanline = 0;
+
+    /* Set the compression */
+    status = SDsetcompress (sds_id, COMP_CODE_SZIP, &c_info);
+    CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write data to the SDS */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file to 
+       flush the compressed info to the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+    * Verify the compressed data
+    */
+
+    /* Reopen the file and select the first SDS */
+    sd_id = SDstart (FILE_NAMEfl32, DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    sds_id = SDselect (sd_id, 0);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for szip compression testing");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = LENGTH;
+    edges[1] = WIDTH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Compare read data against input data */
+    for (j=0; j<LENGTH; j++) 
+    {
+        for (i=0; i<WIDTH; i++)
+	    if (out_data[j][i] != in_data[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in compressed dset, want %ld got %ld\n", j, i, (long)in_data[j][i], (long)out_data[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_szip_SDSfl32bit */
+
+static intn test_szip_SDSfl64bit()
+{
+    /************************* Variable declaration **************************/
+
+    int32	sd_id, sds_id;
+    intn 	status;
+    int32	dim_sizes[2], array_rank, num_type, attributes;
+    char	name[H4_MAX_NC_NAME];
+    comp_info	c_info;
+    int32       start[2], edges[2];
+    float64     fill_value = 0;   /* Fill value */
+    int         i,j;
+    int		num_errs = 0;    /* number of errors so far */
+    float64	out_data[LENGTH][WIDTH];
+    float64	in_data[LENGTH][WIDTH]={
+	   			 100.0,100.0,200.0,200.0,300.0,400.0,
+	   			 100.0,100.0,200.0,200.0,300.0,400.0,
+				 100.0,100.0,200.0,200.0,300.0,400.0,
+				 300.0,300.0,  0.0,400.0,300.0,400.0,
+				 300.0,300.0,  0.0,400.0,300.0,400.0,
+				 300.0,300.0,  0.0,400.0,300.0,400.0,
+				   0.0,  0.0,600.0,600.0,300.0,400.0,
+				 500.0,500.0,600.0,600.0,300.0,400.0,
+				   0.0,  0.0,600.0,600.0,300.0,400.0};
+
+    /********************* End of variable declaration ***********************/
+
+    /* Create the file and initialize SD interface */
+    sd_id = SDstart (FILE_NAMEfl64, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create the SDS */
+    dim_sizes[0] = LENGTH;
+    dim_sizes[1] = WIDTH;
+    sds_id = SDcreate (sd_id, SDS_NAME, DFNT_FLOAT64, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    for (i = 0; i < RANK; i++) {
+	start[i] = 0;
+	edges[i] = dim_sizes[i];
+	}
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Initialization for SZIP */
+    c_info.szip.pixels_per_block = 2;
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 0;
+    c_info.szip.pixels = 0;
+    c_info.szip.pixels_per_scanline = 0;
+
+    /* Set the compression */
+    status = SDsetcompress (sds_id, COMP_CODE_SZIP, &c_info);
+    CHECK(status, FAIL, "SDsetcompress");
+
+    /* Write data to the SDS */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file to 
+       flush the compressed info to the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file and select the first SDS */
+    sd_id = SDstart (FILE_NAMEfl64, DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    sds_id = SDselect (sd_id, 0);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for szip compression testing");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = LENGTH;
+    edges[1] = WIDTH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Compare read data against input data */
+    for (j=0; j<LENGTH; j++) 
+    {
+        for (i=0; i<WIDTH; i++)
+	    if (out_data[j][i] != in_data[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in compressed dset, want %ld got %ld\n", j, i, (long)in_data[j][i], (long)out_data[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_szip_SDSfl64bit */
+
+
+#define FILE_NAME	"SDSchunkedsziped.hdf"
+#define SDS_NAME_CH	"ChunkedData"
+#define RANK_CH         2	/* rank of the chunked data set */
+#define WIDTH_CH 	4	/* width of the chunked data set */
+#define LENGTH_CH	9	/* length of the chunked data set */
+#define CWIDTH		2	/* width of the chunk */
+#define CLENGTH		3	/* length of the chunk */
+
+static intn test_szip_chunk()
+{
+   /************************* Variable declaration **************************/
+
+   int32         sd_id, sds_id, sds_index;
+   intn          status;
+   int32         flag, maxcache, new_maxcache;
+   int32         dim_sizes[2], origin[2];
+   HDF_CHUNK_DEF c_def; /* Chunking definitions */ 
+   HDF_CHUNK_DEF c_def_out; /* Chunking definitions */ 
+   int32         c_flags, c_flags_out;
+   int32         all_data[LENGTH_CH][WIDTH_CH];
+   int32         start[2], edges[2];
+   int32	 comp_size=0, uncomp_size=0;
+   int32         chunk_out[CLENGTH][CWIDTH];
+   int32         row[CWIDTH] = { 5, 5 };
+   int32         column[CLENGTH] = { 4, 4, 4 };
+   int32         fill_value = 0;   /* Fill value */
+   comp_coder_t  comp_type;        /* to retrieve compression type into */
+   comp_info     cinfo;            /* compression information structure */
+   int    	 num_errs = 0;     /* number of errors so far */
+   int           i,j;
+
+   /*
+   * Define all chunks.  Note that chunks 4 & 5 are not used to write,
+   * only to verify the read data.  The 'row' and 'column' are used
+   * to write in the place of these chunks.
+   */
+          int32 chunk1[CLENGTH][CWIDTH] = { 1, 1,
+                                            1, 1,
+                                            1, 1 }; 
+
+          int32 chunk2[CLENGTH][CWIDTH] = { 2, 2,
+                                            2, 2,
+                                            2, 2 }; 
+
+          int32 chunk3[CLENGTH][CWIDTH] = { 3, 3,
+                                            3, 3,
+                                            3, 3 }; 
+
+          int32 chunk4[CLENGTH][CWIDTH] = { 0, 4,
+                                            0, 4,
+                                            0, 4 }; 
+
+          int32 chunk5[CLENGTH][CWIDTH] = { 0, 0,
+                                            5, 5,
+                                            0, 0 }; 
+
+          int32 chunk6[CLENGTH][CWIDTH] = { 6, 6,
+                                            6, 6,
+                                            6, 6 };
+
+
+    /* Initialize chunk lengths. */
+    c_def.comp.chunk_lengths[0] = CLENGTH;
+    c_def.comp.chunk_lengths[1] = CWIDTH;
+
+    /* Create the file and initialize SD interface. */
+    sd_id = SDstart (FILE_NAME, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create LENGTH_CHxWIDTH_CH SDS. */
+    dim_sizes[0] = LENGTH_CH;
+    dim_sizes[1] = WIDTH_CH;
+    sds_id = SDcreate (sd_id, SDS_NAME_CH,DFNT_INT32, RANK_CH, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for chunking/szip compression testing");
+
+    /* Fill the SDS array with the fill value. */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Set parameters for Chunking/SZIP */
+    c_def.comp.comp_type = COMP_CODE_SZIP;
+    c_def.comp.cinfo.szip.pixels_per_block = 2;
+
+    c_def.comp.cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_def.comp.cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    c_def.comp.cinfo.szip.bits_per_pixel = 0;
+    c_def.comp.cinfo.szip.pixels = 0;
+    c_def.comp.cinfo.szip.pixels_per_scanline = 0;
+    c_flags = HDF_CHUNK | HDF_COMP;
+    status = SDsetchunk (sds_id, c_def, c_flags);
+       CHECK(status, FAIL, "SDsetchunk");
+
+    /* Set chunk cache to hold maximum of 3 chunks. */
+    maxcache = 3;
+    flag = 0;
+    new_maxcache = SDsetchunkcache (sds_id, maxcache, flag);
+    CHECK(new_maxcache, FAIL, "SDsetchunkcache");
+
+    HDmemset(&c_def_out, 0, sizeof(HDF_CHUNK_DEF));
+    c_flags_out = 0;
+    status = SDgetchunkinfo(sds_id, &c_def_out, &c_flags_out);
+    CHECK(status, FAIL, "SDgetchunkinfo");
+    VERIFY(c_flags_out, c_flags, "SDgetchunkinfo");
+    VERIFY(c_def_out.comp.comp_type, COMP_CODE_SZIP, "SDgetchunkinfo");
+
+    /* 
+     * Write chunks using SDwritechunk function.  Chunks can be written 
+     * in any order. 
+     */
+
+    /* Write the chunk with the coordinates (0,0). */
+    origin[0] = 0;
+    origin[1] = 0;
+    status = SDwritechunk (sds_id, origin, (VOIDP) chunk1);
+    CHECK(status, FAIL, "SDwritechunk");
+
+    /* Write the chunk with the coordinates (1,0). */
+    origin[0] = 1;
+    origin[1] = 0;
+    status = SDwritechunk (sds_id, origin, (VOIDP) chunk3);
+    CHECK(status, FAIL, "SDwritechunk");
+
+    /* Write the chunk with the coordinates (0,1). */
+    origin[0] = 0;
+    origin[1] = 1;
+    status = SDwritechunk (sds_id, origin, (VOIDP) chunk2);
+    CHECK(status, FAIL, "SDwritechunk");
+
+    /* Write chunk with the coordinates (1,2) using SDwritedata function. */
+    start[0] = 6;
+    start[1] = 2;
+    edges[0] = 3;
+    edges[1] = 2;
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP) chunk6); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Fill second column in the chunk with the coordinates (1,1) using 
+     * SDwritedata function. */
+    start[0] = 3;
+    start[1] = 3;
+    edges[0] = 3;
+    edges[1] = 1;
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP) column); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Fill second row in the chunk with the coordinates (0,2) using 
+     * SDwritedata function. */
+    start[0] = 7;
+    start[1] = 0;
+    edges[0] = 1;
+    edges[1] = 2;
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP) row); 
+    CHECK(status, FAIL, "SDwritedata");
+           
+    /* Terminate access to the data set. */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file and access the first data set. */
+    sd_id = SDstart (FILE_NAME, DFACC_READ);
+    sds_index = 0;
+    sds_id = SDselect (sd_id, sds_index);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for chunking/szip compression testing");
+
+    /* Retrieve compression information about the dataset */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+
+    status = SDgetcompinfo(sds_id, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_SZIP, "SDgetcompinfo");
+
+    /* Retrieve compression method alone from the dataset */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(sds_id, &comp_type);
+    CHECK(status, FAIL, "SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_SZIP, "SDgetcomptype");
+
+    /* Read the entire data set using SDreaddata function. */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = LENGTH_CH;
+    edges[1] = WIDTH_CH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)all_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* 
+    * This is how the entire array should look like:
+    *
+    *          1 1 2 2
+    *          1 1 2 2
+    *          1 1 2 2
+    *          3 3 0 4
+    *          3 3 0 4
+    *          3 3 0 4
+    *          0 0 6 6
+    *          5 5 6 6
+    *          0 0 6 6
+    */
+
+    /* Read chunk #4 with the coordinates (1,1) and verify it. */
+    origin[0] = 1;
+    origin[1] = 1;    	
+    status = SDreadchunk (sds_id, origin, chunk_out);
+    CHECK(status, FAIL, "SDreadchunk");
+
+    for (j=0; j<CLENGTH; j++) 
+    {
+	for (i=0; i<CWIDTH; i++) 
+	{
+	    if (chunk_out[j][i] != chunk4[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in chunk #4, want %ld got %ld\n", j, i, chunk4[j][i], chunk_out[j][i]);
+		num_errs++;
+	    }
+	}
+    }
+
+    /* 
+    * Read chunk #5 with the coordinates (2,0) and verify it.
+    */
+    origin[0] = 2;
+    origin[1] = 0;    	
+    status = SDreadchunk (sds_id, origin, chunk_out);
+    CHECK(status, FAIL, "SDreadchunk");
+
+    for (j=0; j<CLENGTH; j++) 
+    {
+	for (i=0; i<CWIDTH; i++) 
+	    if (chunk_out[j][i] != chunk5[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in chunk #5, want %ld got %ld\n", j, i, chunk5[j][i], chunk_out[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Get the data sizes */
+    status = SDgetdatasize(sds_id, &comp_size, &uncomp_size);
+    CHECK(status, FAIL, "test_chkcmp_SDSs: SDgetdatasize");
+
+    /* Terminate access to the data set. */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_szip_chunk */ 
+
+
+#define FILE_NAME_3D	"SDSchunkedsziped3d.hdf"
+#define SDS_NAME_CH3D	"3D Chunked Szipped"
+#define SDS_NAME_CH0	"3D Chunked Szipped Empty"
+#define RANK_CH3        3	/* rank of the chunked data set */
+#define SDS_DIM1 	4	/* first dimension of the chunked data set */
+#define SDS_DIM0	9	/* second dimension of the chunked data set */
+#define SDS_DIM2	11	/* third dimension of the chunked data set */
+#define CHK_DIM0	9	/* first dimension of the chunk */
+#define CHK_DIM1	2	/* second dimension of the chunk */
+#define CHK_DIM2	2	/* third dimension of the chunk */
+
+int16         all_data[SDS_DIM0][SDS_DIM1][SDS_DIM2];
+int16         out_data[SDS_DIM0][SDS_DIM1][SDS_DIM2];
+
+static intn test_szip_chunk_3d()
+{
+    /************************* Variable declaration **************************/
+
+    int32         sd_id, sds_id0, sds_id, sds_index;
+    intn          status;
+    int32         dim_sizes[3];
+    HDF_CHUNK_DEF c_def; /* Chunking definitions */ 
+    HDF_CHUNK_DEF c_def_out; /* Chunking definitions */ 
+    int32         c_flags, c_flags_out;
+    int32         start[3], edges[3];
+    int16         fill_value = 0;   /* Fill value */
+    comp_coder_t  comp_type;        /* to retrieve compression type into */
+    comp_info     cinfo;            /* compression information structure */
+    int    	  num_errs = 0;     /* number of errors so far */
+    int           i,j,k;
+
+    for (i = 0; i < SDS_DIM0; i++) {
+	for (j = 0; j < SDS_DIM1; j++) {
+	    for (k = 0; k < SDS_DIM2; k++) {
+		out_data[i][j][k] = i*100+j*10+k;
+    }}}
+
+    /* Initialize chunk lengths. */
+    c_def.comp.chunk_lengths[0] = CHK_DIM0;
+    c_def.comp.chunk_lengths[1] = CHK_DIM1;
+    c_def.comp.chunk_lengths[2] = CHK_DIM2;
+
+    /* Create the file and initialize SD interface. */
+    sd_id = SDstart (FILE_NAME_3D, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create SDS_DIM0xSDS_DIM1 SDS. */
+    dim_sizes[0] = SDS_DIM0;
+    dim_sizes[1] = SDS_DIM1;
+    dim_sizes[2] = SDS_DIM2;
+    sds_id = SDcreate (sd_id, SDS_NAME_CH3D, DFNT_INT16, RANK_CH3, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for chunking/szip compression testing");
+
+    /* Create a similar SDS and will make it chunked, but will not 
+       write data to it */
+    sds_id0 = SDcreate (sd_id, SDS_NAME_CH0, DFNT_INT16, RANK_CH3, dim_sizes);
+    CHECK(sds_id0, FAIL, "SDcreate:Failed to create a data set for chunking/szip compression testing");
+
+    /* Fill the SDS array with the fill value. */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Set parameters for Chunking/SZIP */
+    c_def.comp.comp_type = COMP_CODE_SZIP;
+    c_def.comp.cinfo.szip.pixels_per_block = 2;
+
+    c_def.comp.cinfo.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_def.comp.cinfo.szip.options_mask |= SZ_MSB_OPTION_MASK;
+    c_def.comp.cinfo.szip.bits_per_pixel = 2;
+    c_def.comp.cinfo.szip.pixels = 16;
+    c_def.comp.cinfo.szip.pixels_per_scanline = 2;
+    c_flags = HDF_CHUNK | HDF_COMP;
+    status = SDsetchunk (sds_id0, c_def, c_flags);
+    status = SDsetchunk (sds_id, c_def, c_flags);
+    CHECK(status, FAIL, "SDsetchunk");
+
+    start[0] = 0;
+    start[1] = 0;
+    start[2] = 0;
+    edges[0] = SDS_DIM0;
+    edges[1] = SDS_DIM1;
+    edges[2] = SDS_DIM2;
+    status = SDwritedata (sds_id, start, NULL, edges, (VOIDP) out_data); 
+    CHECK(status, FAIL, "SDwritedata");
+
+    HDmemset(&c_def_out, 0, sizeof(HDF_CHUNK_DEF));
+    c_flags_out = 0;
+    status = SDgetchunkinfo(sds_id0, &c_def_out, &c_flags_out);
+    CHECK(status, FAIL, "SDgetchunkinfo");
+    VERIFY(c_flags_out, c_flags, "SDgetchunkinfo");
+    VERIFY(c_def_out.comp.comp_type, COMP_CODE_SZIP, "SDgetchunkinfo");
+
+    HDmemset(&c_def_out, 0, sizeof(HDF_CHUNK_DEF));
+    c_flags_out = 0;
+    status = SDgetchunkinfo(sds_id, &c_def_out, &c_flags_out);
+    CHECK(status, FAIL, "SDgetchunkinfo");
+    VERIFY(c_flags_out, c_flags, "SDgetchunkinfo");
+    VERIFY(c_def_out.comp.comp_type, COMP_CODE_SZIP, "SDgetchunkinfo");
+
+    /* Terminate access to the data sets. */
+    status = SDendaccess (sds_id0);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+     * Verify the compressed data
+     */
+
+    /* Reopen the file and access the first data set. */
+    sd_id = SDstart (FILE_NAME_3D, DFACC_READ);
+    sds_index = 0;
+    sds_id = SDselect (sd_id, sds_index);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for chunking/szip compression testing");
+
+    /* Retrieve compression information about the dataset */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    HDmemset(&cinfo, 0, sizeof(cinfo)) ;
+
+    status = SDgetcompinfo(sds_id, &comp_type, &cinfo);
+    CHECK(status, FAIL, "SDgetcompinfo");
+    VERIFY(comp_type, COMP_CODE_SZIP, "SDgetcompinfo");
+
+    /* Retrieve compression method alone from the dataset */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(sds_id, &comp_type);
+    CHECK(status, FAIL, "SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_SZIP, "SDgetcomptype");
+
+    start[0] = 0;
+    start[1] = 0;
+    start[2] = 0;
+    edges[0] = SDS_DIM0;
+    edges[1] = SDS_DIM1;
+    edges[2] = SDS_DIM2;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)all_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    for (i = 0; i < SDS_DIM0; i++) {
+	for (j = 0; j < SDS_DIM1; j++) {
+	    for (k = 0; k < SDS_DIM2; k++) {
+	    if (out_data[i][j][k] != all_data[i][j][k])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d][%d] want %ld got %ld\n", i, j,k, out_data[i][j][k], all_data[i][j][k]);
+		num_errs++;
+	    }
+	    }
+	}
+    }
+
+    /* Terminate access to the data set. */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file. */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}   /* test_szip_chunk_3D */ 
+
+/* 
+ * At this time, the use of SZIP compression with unlimited dimension SDSs
+ * is unavailable.  This test program is to verify that the feature is 
+ * correctly disabled.
+ */
+#define FILE_NAME_UNLIM	"SDSunlimitedsziped.hdf"
+#define SDS_NAME_UNLIM	"UnlimitedData"
+static intn test_szip_unlimited()
+{
+    /************************* Variable declaration **************************/
+
+    int32	sd_id, sds_id;
+    intn 	status;
+    int32	dim_sizes[2], array_rank, num_type, attributes;
+    char	name[H4_MAX_NC_NAME];
+    comp_info	c_info;
+    int32       start[2], edges[2];
+    int32       fill_value = 0;   /* Fill value */
+    int         i,j;
+    int		num_errs = 0;    /* number of errors so far */
+    int32	out_data[LENGTH][WIDTH];
+    int32	in_data[LENGTH][WIDTH]={
+	   			 100,100,200,200,300,400,
+	   			 100,100,200,200,300,400,
+				 100,100,200,200,300,400,
+				 300,300,  0,400,300,400,
+				 300,300,  0,400,300,400,
+				 300,300,  0,400,300,400,
+				   0,  0,600,600,300,400,
+				 500,500,600,600,300,400,
+				   0,  0,600,600,300,400};
+
+    /********************* End of variable declaration ***********************/
+
+    /* Create the file and initialize SD interface */
+    sd_id = SDstart (FILE_NAME_UNLIM, DFACC_CREATE);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Create the SDS */
+    dim_sizes[0] = SD_UNLIMITED;
+    dim_sizes[1] = WIDTH;
+    sds_id = SDcreate (sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes);
+    CHECK(sds_id, FAIL, "SDcreate:Failed to create a data set for szip compression testing");
+
+    /* Define the location, pattern, and size of the data set */
+    for (i = 0; i < RANK; i++) {
+	start[i] = 0;
+	}
+    edges[0] = LENGTH;
+    edges[1] = WIDTH;
+
+    /* Fill the SDS array with the fill value */
+    status = SDsetfillvalue (sds_id, (VOIDP)&fill_value);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Initialize for SZIP */
+    c_info.szip.pixels_per_block = 2;
+
+    c_info.szip.options_mask = SZ_EC_OPTION_MASK;
+    c_info.szip.options_mask |= SZ_RAW_OPTION_MASK;
+    c_info.szip.bits_per_pixel = 0;
+    c_info.szip.pixels = 0;
+    c_info.szip.pixels_per_scanline = 0;
+
+    /* Attempting to set SZIP compression will fail because SZIP is 
+     * not available with unlimited dimension yet */
+    status = SDsetcompress (sds_id, COMP_CODE_SZIP, &c_info);
+    VERIFY(status, FAIL, "SDsetcompress");
+
+    /* Write data to the SDS; data will be uncompressed */
+    status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)in_data);
+    CHECK(status, FAIL, "SDwritedata");
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file to 
+       flush the compressed info to the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /*
+    * Verify the written data
+    */
+
+    /* Reopen the file and select the first SDS */
+    sd_id = SDstart (FILE_NAME_UNLIM, DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    sds_id = SDselect (sd_id, 0);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for testing szip compression with unlimited dimension");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the data set */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = LENGTH;
+    edges[1] = WIDTH;
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Compare read data against input data */
+    for (j=0; j<LENGTH; j++) 
+    {
+        for (i=0; i<WIDTH; i++)
+	    if (out_data[j][i] != in_data[j][i])
+	    {
+		fprintf(stderr,"Bogus val in loc [%d][%d] in compressed dset, want %ld got %ld\n", j, i, (long)in_data[j][i], (long)out_data[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_szip_unlimited */
+
+#endif /* only compile all the above test functions when encoder is available */
+
+
+/********************************************************************
+   Name: test_getszipinfo() - verifies that some functions will not 
+		fail even though SZIP library is not present or only 
+		decoder is available.
+
+   Description:
+	In the past, some SD APIs will fail if szlib was not present.  These
+	functions have been revised so that they are no longer depending on 
+	SZIP library.  New APIs are designed to function correctly as well.
+	The functions below are being tested here:
+	- SDgetcomptype
+	- SDgetdatasize
+
+	This test function opens an existing file containing datasets with 
+	SZIP compression and verifies that the above APIs will work with or 
+	without SZIP library.
+
+	The input file, sds_szipped.dat, is generated by the program
+	mfhdf/libsrc/gen_sds_szipped.c
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Oct 10, 2008
+*********************************************************************/
+
+#define SZIP_FILE	"sds_szipped.dat" /* generated by gen_sds_szipped.c */
+#define SDS1_NAME	"TwoDimsInt32"
+#define RANK		2
+#define SZ_WIDTH	5
+#define SZ_LENGTH	16
+
+static intn test_getszipinfo()
+{
+    /************************* Variable declaration **************************/
+
+    int32	sd_id, sds_id, sds_index;
+    intn 	status;
+    int32	dim_sizes[2], array_rank, num_type, attributes;
+    char	name[H4_MAX_NC_NAME];
+    comp_info	c_info;
+    int32       start[2], edges[2];
+    comp_coder_t comp_type;
+    int32	comp_size, uncomp_size, orig_size;
+    int16       fill_value = 0;   /* Fill value */
+    int         i,j;
+    int		num_errs = 0;    /* number of errors so far */
+    char	testfile[512] = "";
+    int32      *out_data = NULL;
+    char *basename = "sds_szipped.dat";
+
+    /********************* End of variable declaration ***********************/
+
+    /* Make the name for the test file */
+    make_datafilename(basename, testfile, sizeof(testfile));
+
+    /* Open the file and select dataset SDS1_NAME */
+    sd_id = SDstart (testfile, DFACC_RDONLY);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    sds_index = SDnametoindex(sd_id, SDS1_NAME);
+    CHECK(sds_index, FAIL, "SDnametoindex");
+
+    sds_id = SDselect (sd_id, sds_index);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for szip compression testing");
+
+    /* Retrieve and verify information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(array_rank, RANK, "SDgetinfo");
+    VERIFY(dim_sizes[0], SZ_LENGTH, "SDgetinfo");
+    VERIFY(dim_sizes[1], SZ_WIDTH, "SDgetinfo");
+    VERIFY(num_type, DFNT_INT32, "SDgetinfo");
+    VERIFY(attributes, 0, "SDgetinfo");
+
+    /* Get the compression method and verify it */
+    comp_type = COMP_CODE_INVALID;  /* reset variables before retrieving info */
+    status = SDgetcomptype(sds_id, &comp_type);
+    CHECK(status, FAIL, "SDgetcomptype");
+    VERIFY(comp_type, COMP_CODE_SZIP, "SDgetcomptype");
+
+    /* Get the compressed data size and non-compressed data size */
+    status = SDgetdatasize(sds_id, &comp_size, &uncomp_size);
+    CHECK(status, FAIL, "SDgetdatasize");
+
+    /* Compute the uncompressed/original size of the data for comparision */
+    orig_size = SZ_WIDTH * SZ_LENGTH * SIZE_INT32;
+    VERIFY(uncomp_size, orig_size, "SDgetdatasize");
+
+    /* In this test, compressed data size should be smaller than non-compressed
+       data size */
+    if (comp_size >= uncomp_size)
+    {
+        printf("*** Routine test_getszipinfo: FAILED at line %d ***\n", __LINE__);
+        printf("    In this test, compressed data size (%d) should be smaller than non-compressed data size (%d)\n", comp_size, uncomp_size);
+        num_errs++;
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_getszipinfo */
+
+
+/********************************************************************
+   Name: test_getszipdata() - verifies that SZIP compressed data can be read
+		when either SZIP library encoder or only decoder is present
+
+   Description:
+	This test function opens the existing file "sds_szipped.dat" that 
+	contains a dataset with SZIP compression and verifies that the SZIP 
+	compressed data can be read with or without the encoder as long as
+	the szlib is available.
+
+	The input file, sds_szipped.dat, is generated by the program
+	mfhdf/libsrc/gen_sds_szipped.c
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Oct 10, 2008
+*********************************************************************/
+
+#ifdef H4_HAVE_LIBSZ	/* needed to read data, either decoder or encoder */
+static intn test_getszipdata()
+{
+    /************************* Variable declaration **************************/
+
+    int32	sd_id, sds_id;
+    intn 	status;
+    int32	dim_sizes[2], array_rank, num_type, attributes;
+    char	name[H4_MAX_NC_NAME];
+    comp_info	c_info;
+    int32       start[2], edges[2];
+    int16       fill_value = 0;   /* Fill value */
+    int         i,j;
+    int		num_errs = 0;    /* number of errors so far */
+    int32       out_data[SZ_LENGTH][SZ_WIDTH];
+    char	testfile[512] = "";
+    char       *basename = "sds_szipped.dat";
+
+    /* data to compare against read data from sds_szipped.dat */
+    int32	in_data[SZ_LENGTH][SZ_WIDTH]={
+                                100,100,200,200,300,
+                                0, 0, 0, 0, 0,
+                                100,100,200,200,300,
+                                400,300,200,100,0,
+                                300,300,  0,400,300,
+                                300,300,  0,400,300,
+                                300,300,  0,400,300,
+                                0,  0,600,600,300,
+                                500,500,600,600,300,
+                                0,  0,600,600,300,
+                                0,  0,600,600,300,
+                                0,  0,600,600,300,
+                                0,  0,600,600,300,
+                                500,500,600,600,300,
+                                500,500,600,600,300,
+                                500,500,600,600,300 };
+
+    /********************* End of variable declaration ***********************/
+
+    /* Make the name for the test file */
+    make_datafilename(basename, testfile, sizeof(testfile));
+
+    /* Open the file */
+    sd_id = SDstart (testfile, DFACC_READ);
+    CHECK(sd_id, FAIL, "SDstart");
+
+    /* Get the first SDS */
+    sds_id = SDselect (sd_id, 0);
+    CHECK(sds_id, FAIL, "SDselect:Failed to select a data set for szip compression testing");
+
+    /* Retrieve information of the data set */
+    status = SDgetinfo(sds_id, name, &array_rank, dim_sizes, &num_type, &attributes);
+    CHECK(status, FAIL, "SDgetinfo");
+
+    /* Prepare for reading */
+    start[0] = 0;
+    start[1] = 0;
+    edges[0] = dim_sizes[0];
+    edges[1] = dim_sizes[1];
+
+    /* Wipe out the output buffer */
+    HDmemset(&out_data, 0, sizeof(out_data));
+
+    /* Read the data set */
+    status = SDreaddata (sds_id, start, NULL, edges, (VOIDP)out_data);
+    CHECK(status, FAIL, "SDreaddata");
+
+    /* Compare read data against input data */
+    for (j=0; j<SZ_LENGTH; j++) 
+    {
+        for (i=0; i<SZ_WIDTH; i++)
+	     if (out_data[j][i] != in_data[j][i])
+	    {
+		 fprintf(stderr,"This one: Bogus val in loc [%d][%d] in compressed dset, want %ld got %ld\n", j, i, (long)in_data[j][i], (long)out_data[j][i]);
+		num_errs++;
+	    }
+    }
+
+    /* Terminate access to the data set */
+    status = SDendaccess (sds_id);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Terminate access to the SD interface and close the file */
+    status = SDend (sd_id);
+    CHECK(status, FAIL, "SDend");
+
+    /* Return the number of errors that's been kept track of so far */
+    return num_errs;
+}  /* test_getszipdata */
+#endif /* ifdef H4_HAVE_LIBSZ */
+
+/* 
+ * Test drive for testing the szip compression feature with SD interface 
+ */
+extern int 
+test_szip_compression ()
+{
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("szip compression for datasets (tszip.c)");
+
+#ifdef H4_HAVE_SZIP_ENCODER
+    /* Test creating and writing SZIP compressed data only when szlib encoder
+	is available */
+    num_errs = num_errs + test_szip_SDS8bit();
+    num_errs = num_errs + test_szip_SDS16bit();
+    num_errs = num_errs + test_szip_SDS32bit();
+    num_errs = num_errs + test_szip_SDSfl32bit();
+    num_errs = num_errs + test_szip_SDSfl64bit();
+    num_errs = num_errs + test_szip_chunk();
+    num_errs = num_errs + test_szip_unlimited();
+    num_errs = num_errs + test_szip_chunk_3d();
+#else
+    /* printf("Test creating and writing SZIP compressed data \tSKIPPED\n"); */
+#endif
+
+#ifdef H4_HAVE_LIBSZ
+    /* Test reading szipped data when szlib is available, either with encoder
+	or only decoder */
+    num_errs = num_errs + test_getszipdata();
+#else
+    /* printf("Test reading SZIP compressed data \tSKIPPED\n"); */
+#endif
+
+    /* Test reading szip compression information and should pass with or 
+	without SZIP library */
+    num_errs = num_errs + test_getszipinfo();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
diff --git a/mfhdf/test/tunlim.c b/mfhdf/test/tunlim.c
new file mode 100644
index 0000000..4417774
--- /dev/null
+++ b/mfhdf/test/tunlim.c
@@ -0,0 +1,749 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/****************************************************************************
+ * tunlim.c - tests reading/writing variables with unlimited dimension using
+ *		SD API.  The tests here are added to test the behavior of the
+ *		library when dealing with unlimited dimensions with nc API.  The
+ *		tests show that the data is correctly written when:
+ *		+ data added immediately after last record
+ *		+ data added skipping one or more records
+ *		+ data overridden existing data
+ *		+ data read pass the end of that variable but not the max in 
+ *		  all the variables in the file
+ *
+ * Structure of the file:
+ *    test_unlim - test driver
+ *        test_1dim_singlevar - tests on a single variable with only 1 dimension
+ *        test_1dim_multivars - tests on multiple variables with only 1 dimension
+ *        test_multidim_singlevar - tests on single variable with multiple
+ *		dimensions
+ *	  test_1dim_multivars_addon - tests multiple 1-dim variables that were
+ *		added on to existing file
+ *
+ * BMR - Dec 30, 2008
+****************************************************************************/
+
+#include "mfhdf.h"
+#include "hdftest.h"
+
+#define DIM0 20
+
+/********************************************************************
+   Name: verify_info_data() - utility function that verifies the unlimited
+		dimension's size and the variable's data.
+
+   Description:
+	This utility function carries out the following tasks:
+        - SDgetinfo to get the size of the unlimited dimension
+	- SDreaddata to read the variable up to the unlimited dimension's size,
+	  that is the max number of records in the file
+	- HDmemcmp to verify that the read buffer is as expected
+
+	It is used by only test_1dim_singlevar, test_1dim_multivars, and 
+	test_1dim_multivars_addon because it only handles 1-dim dataset and
+	number type int16.  It can be revised for multi-dim datasets or 
+	any number types, if desired.
+
+   Return value:
+        The number of errors occurred in this routine.
+   BMR - Dec 30, 2008
+
+   Note: This function will be moved to tutils.c; must decide what
+	 to do about the data type and sizes, so that the approach
+	 will be consistent within the test suite.  Right now, test
+	 tncvargetfill.c is using it from here.
+   BMR - Sep 4, 2013
+*********************************************************************/
+
+int verify_info_data(
+	int32 sds_id,
+	int32 expected_dimsize,
+	int16 *result)
+{
+    int32 dimsizes[1];		/* dimension size buffer */
+    int32 start[1],		/* where to start reading */
+	  edges[1];		/* length of data to be read/written */
+    char  info[40];		/* holds brief info where failure occurs */
+    int16 outdata[DIM0];	/* data read back */
+    char  ds_name[20];		/* dataset name */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors */
+
+    /* Get information of the first dataset, and verify its dimension */
+    status = SDgetinfo(sds_id, ds_name, NULL, dimsizes, NULL, NULL);
+    sprintf(info, "%s on <%s>", "SDgetinfo", ds_name);
+    CHECK(status, FAIL, info);
+    VERIFY(dimsizes[0], expected_dimsize, info);
+
+    /* Read back data and verify */
+    start[0] = 0;
+    edges[0] = dimsizes[0];
+    status = SDreaddata(sds_id, start, NULL, edges, (VOIDP) outdata);
+    sprintf(info, "%s on <%s>", "SDreaddata", ds_name);
+    CHECK(status, FAIL, info);
+
+    /* Verify read data by comparing the output buffer against expected data */
+    status = HDmemcmp(outdata, result, edges[0] * SIZE_INT16);
+    if (status != 0)
+	fprintf(stderr,"%s: Read data doesn't match input\n");
+
+    /* Return the number of errors occurred here */
+    return(num_errs);
+}
+
+/********************************************************************
+   Name: test_1dim_singlevar() - tests on a single variable with only 1 dimension
+
+   Description:
+        The main contents include:
+        - write 4 elements starting at index 0
+        - try reading 2 elements pass the end, should fail
+        - append 2 elements starting at index 6, that is indices 4 and 5 will
+	  be written with fill value
+        - append 3 elements immediately at the end of the data
+        - overwrite indices 0 and 1
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 30, 2008
+*********************************************************************/
+
+#define FILENAME1 "onedimonevar.nc"
+static int test_1dim_singlevar()
+{
+    int32 fid;			/* file id */
+    int32 dset1;		/* dataset ids */
+    int32 dimsizes[1];		/* dimension size buffer */
+    int32 start[1],		/* where to start writing */
+	  edges[1];		/* length of data to be read/written */
+    int16 fillval = 99;		/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data; the first two elements will
+	be changed to "1,2" later for the last test. */
+    int16 result[] = {300,301,302,303,99,99,30,31,801,802,803};
+
+    /* enter define mode */
+    fid = SDstart(FILENAME1, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Define dimension of the data set to be created. */
+    dimsizes[0] = SD_UNLIMITED;
+
+    /* Create an array data sets. */
+    dset1 = SDcreate(fid, "Variable 1", DFNT_INT16, 1, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    /* Datasets will be filled with fill values when data is missing */
+    status = SDsetfillvalue(dset1, (VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    { /* Add data */
+	int16 data[] = {300, 301, 302, 303};
+
+	/* Write 4 elements starting at index 0 */
+	start[0] = 0;
+	edges[0] = 4;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its data and dim size */
+    num_errs = num_errs + verify_info_data(dset1, 4, result);
+
+    { /* Append data to dataset pass the end */
+	int16 data[] = {30, 31};
+
+	/* Write 2 values starting at index 6 */
+	start[0] = 6;
+	edges[0] = 2;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its dimension */
+    num_errs = num_errs + verify_info_data(dset1, 8, result);
+
+    { /* Append data to dataset at the end */
+	int16 data[] = {801,802,803};
+
+	/* Write 3 values starting at index 8, at the end */
+	start[0] = 8;
+	edges[0] = 3;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its dimension */
+    num_errs = num_errs + verify_info_data(dset1, 11, result);
+
+    { /* Override the first 2 elements */
+	int16 data[] = {1,2};
+
+	/* Write 2 values starting at 0 */
+	start[0] = 0;
+	edges[0] = 2;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Modify the first 2 elements of the result buffer appropriately */
+    result[0] = 1;
+    result[1] = 2;
+
+    /* Get information of the dataset, and verify its dimension */
+    num_errs = num_errs + verify_info_data(dset1, 11, result);
+
+    /* Close the dataset */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    return 0;
+}
+
+/********************************************************************
+   Name: test_1dim_multivars() - tests reading/writing on multiple variables,
+	each has 1 dimension
+
+   Description:
+        The main contents include:
+        - write 4 elements starting at index 0 to variable #1
+        - write 2 elements starting at index 0 to variable #2
+	- close file and reopen for read/write
+	- append 2 elements to variable #1, immediately after last written record
+	- write 3 elements to variable #2, starting at index 4
+	- append 3 elements to variable #1, skipping 5 records after the last
+	  written record
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 22, 2008
+*********************************************************************/
+
+#define FILENAME2 "onedimmultivars.nc"
+static int test_1dim_multivars()
+{
+    int32 fid;			/* file id */
+    int32 dset1, dset2;		/* dataset ids */
+    int32 dimsizes[1];		/* dimension size buffer */
+    int32 start[1],		/* where to start writing */
+	  edges[1];		/* length of data to be read/written */
+    int16 outdata[DIM0];	/* data read back */
+    int16 fillval1 = -1;	/* fill value for the variable */
+    int16 fillval2 = -2;	/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data */
+    int16 result1[] = {300,301,302,303,-1,-1,400,401,500,501,502};
+    int16 result2[] = {102,104,-2,-2,-2,-2,-2,-2,200,201,202,800,801,802,803};
+
+    /* enter define mode */
+    fid = SDstart(FILENAME2, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Define dimension of the data set to be created. */
+    dimsizes[0] = SD_UNLIMITED;
+
+    /* Create two array data sets. */
+    dset1 = SDcreate(fid, "Variable 1", DFNT_INT16, 1, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+    dset2 = SDcreate(fid, "Variable 2", DFNT_INT16, 1, dimsizes);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Datasets will be filled with fill values when data is missing */
+    status = SDsetfillvalue(dset1, (VOIDP)&fillval1);
+    CHECK(status, FAIL, "SDsetfillvalue");
+    status = SDsetfillvalue(dset2, (VOIDP)&fillval2);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    { /* Add data */
+	int16 data[] = {300, 301, 302, 303};
+	int16 data2[] = {102, 104};
+
+	/* Write 4 elements to first dataset starting at index 0 */
+	start[0] = 0;
+	edges[0] = 4;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+
+	/* Write 2 elements to second dataset starting at index 0 */
+	edges[0] = 2;
+	status = SDwritedata(dset2, start, NULL, edges, (VOIDP)data2);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the first dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset1, 4, result1);
+
+    /* Get information of the second dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset2, 2, result2);
+
+    /* Try reading pass the end, should fail */
+    edges[0] = 6;
+    status = SDreaddata(dset1, start, NULL, edges, (VOIDP) outdata);
+    VERIFY(status, FAIL, "SDreaddata");
+
+    { /* Append data to first dataset pass the end */
+	int16 data[] = {400, 401};
+
+	/* Write 2 values starting at index 6 */
+	start[0] = 6;
+	edges[0] = 2;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the first dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset1, 8, result1);
+
+    /* Get information of the second dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset2, 2, result2);
+
+    { /* Append data to first dataset at the end */
+	int16 data[] = {500,501,502};
+
+	/* Write 3 values starting at index 8 */
+	start[0] = 8;
+	edges[0] = 3;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the first dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset1, 11, result1);
+
+    { /* Append data to second dataset pass its end */
+	int16 data[] = {200, 201, 202};
+
+	/* Write 2 values starting at index 8 */
+	start[0] = 8;
+	edges[0] = 3;
+	status = SDwritedata(dset2, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the second dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset2, 11, result2);
+
+    { /* Append data to second dataset at its end */
+	int16 data[] = {800, 801, 802, 803};
+
+	/* Write 2 values starting at index 11 */
+	start[0] = 11;
+	edges[0] = 4;
+	status = SDwritedata(dset2, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the first dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset1, 11, result1);
+
+    /* Get information of the second dataset, and verify its data and dimsize */
+    num_errs = num_errs + verify_info_data(dset2, 15, result2);
+
+    /* Close the dataset */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    return 0;
+}
+
+
+/********************************************************************
+   Name: test_multidim_singlevar() - tests on a single variable with more
+	than one dimension
+
+   Description:
+        The main contents include:
+	- create a 3-D variable with 1 unlimited dimension and the others 3x2
+        - write 4x1x1 elements starting at index {0,0,0}
+        - append 2x1x1 elements along the unlimited dimension starting at 
+	  index 6, that is slabs at indices 4 and 5 will be written with fill 
+	  value
+        - append 1x3x2 elements immediately at the end of the data
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 22, 2008
+*********************************************************************/
+
+#define DIM00 10
+#define DIM1 3
+#define DIM2 2
+#define FILENAME3 "multidimvar.nc"
+static int test_multidim_singlevar()
+{
+    int32 fid;			/* file id */
+    int32 dset1;		/* dataset id */
+    int32 dset_index;		/* dataset index */
+    int32 dimsizes[3];		/* dimension size buffer */
+    int32 start[3],		/* where to start reading */
+	  edges[3];		/* length of data to be read */
+    int16 outdata[DIM0][DIM1][DIM2];	/* data read back */
+    int16 fillval = -3;		/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data */
+    int16 result[DIM00][DIM1][DIM2] = {300,-3,-3,-3,-3,-3,301,-3,-3,-3,-3,-3,302,-3,-3,-3,-3,-3,303,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,400,-3,-3,-3,-3,-3,401,-3,-3,-3,-3,-3,800,801,802,803,804,805};
+
+    /* result data to compare against read data; the first two elements will
+	be changed to "1,2" later for the last test. */
+
+    /* enter define mode */
+    fid = SDstart(FILENAME3, DFACC_CREATE);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Define dimension of the data set to be created. */
+    dimsizes[0] = SD_UNLIMITED;
+    dimsizes[1] = DIM1;
+    dimsizes[2] = DIM2;
+
+    /* Create an array data sets. */
+    dset1 = SDcreate(fid, "Variable 3D", DFNT_INT16, 3, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    /* Datasets will be filled with fill values when data is missing */
+    status = SDsetfillvalue(dset1, (VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    { /* Add data */
+	int16 data[] = {300, 301, 302, 303};
+	int32 startw[3], edgesw[3];
+
+	/* Write 4 elements starting at index 0 */
+	startw[0] = startw[1] = startw[2] = 0; /* starting writing at {0,0,0} */
+	edgesw[0] = 4;	/* 4x1x1 slab */
+	edgesw[1] = 1;
+	edgesw[2] = 1;
+	status = SDwritedata(dset1, startw, NULL, edgesw, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its dimension */
+    status = SDgetinfo(dset1, NULL, NULL, dimsizes, NULL, NULL);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(dimsizes[0], 4, "SDgetinfo");
+
+    /* Read and verify data of the dataset */
+    start[0] = start[1] = start[2] = 0;
+    edges[0] = dimsizes[0];
+    edges[1] = DIM1;
+    edges[2] = DIM2;
+    status = SDreaddata(dset1, start, NULL, edges, (VOIDP) outdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    status = HDmemcmp(outdata, result, edges[0]*DIM1*DIM2*sizeof(int16));
+    VERIFY(status, 0, "HDmemcmp");
+
+    /* Close the dataset */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Reopen file and dataset */
+    fid = SDstart(FILENAME3, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+    dset_index = SDnametoindex(fid, "Variable 3D");
+    CHECK(dset_index, FAIL, "SDnametoindex");
+    dset1 = SDselect(fid, dset_index);
+    CHECK(dset1, FAIL, "SDselect");
+
+    { /* Append data to the dataset pass the end */
+	int16 data[] = {400, 401};
+	int32 startw[3], edgesw[3];
+
+	startw[0] = 6;	/* the end is at 3 */
+	startw[1] = startw[2] = 0; /* writing at {6,0,0} */
+	edgesw[0] = 2;	/* two slabs */
+	edgesw[1] = edgesw[2] = 1; 
+
+	/* Write 2 slabs starting at index 6 */
+	status = SDwritedata(dset1, startw, NULL, edgesw, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its dimension */
+    status = SDgetinfo(dset1, NULL, NULL, dimsizes, NULL, NULL);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(dimsizes[0], 8, "SDgetinfo");
+
+    /* Read and verify data of the dataset */
+    /* start[], edges[1], and edges[2] same as last reading */
+    edges[0] = dimsizes[0];
+    status = SDreaddata(dset1, start, NULL, edges, (VOIDP) outdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    status = HDmemcmp(outdata, result, edges[0]*DIM1*DIM2*sizeof(int16));
+    VERIFY(status, 0, "HDmemcmp");
+
+    { /* Append data to the dataset at the end */
+	int16 data[] = {800,801,802,803,804,805};
+	int32 startw[3], edgesw[3];
+
+	startw[0] = dimsizes[0];	/* writing at the end */
+	startw[1] = startw[2] = 0; /* writing at {8,0,0} */
+	edgesw[0] = 1;	/* 1 slab */
+	edgesw[1] = DIM1;
+	edgesw[2] = DIM2; 
+
+	/* Write 2 slabs starting at index 8 */
+	status = SDwritedata(dset1, startw, NULL, edgesw, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its dimension */
+    status = SDgetinfo(dset1, NULL, NULL, dimsizes, NULL, NULL);
+    CHECK(status, FAIL, "SDgetinfo");
+    VERIFY(dimsizes[0], 9, "SDgetinfo");
+
+    /* Read and verify data of the dataset */
+    /* start[], edges[1], and edges[2] same as last reading */
+    edges[0] = dimsizes[0];
+    status = SDreaddata(dset1, start, NULL, edges, (VOIDP) outdata);
+    CHECK(status, FAIL, "SDreaddata");
+
+    status = HDmemcmp(outdata, result, edges[0]*DIM1*DIM2*sizeof(int16));
+    VERIFY(status, 0, "HDmemcmp");
+
+	/* data should be
+		300  -3     301  -3     302  -3     303  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+		 -3  -3      -3  -3      -3  -3      -3  -3 ...
+
+		... -3  -3      -3  -3     400  -3     401  -3     800 801
+		... -3  -3      -3  -3      -3  -3      -3  -3     802 803
+		... -3  -3      -3  -3      -3  -3      -3  -3     804 805
+		unlimited dimension ---->
+		(-3 is fill value)
+	*/
+
+    /* Close the dataset */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    return 0;
+}
+
+
+/********************************************************************
+   Name: test_1dim_multivars_addon() - tests adding unlimited dimension
+		dataset to an existing file
+
+   Description:
+        The main contents include:
+	- open FILENAME2
+	- create a 1-dim unlimited dimension dataset
+	- close the file, then reopen it
+	- open the previous dataset and create another one
+        - write 4 elements to first and 3 to second, starting at index 0
+        - append 2 elements to first dataset, starting at index 6, that 
+	  is passed the end
+        - append 3 elements to first dataset, immediately at the end of
+	  the data
+	- append 3 elements to second dataset, skipping 5 elements
+	- verify data in various places
+
+   Return value:
+        The number of errors occurred in this routine.
+
+   BMR - Dec 30, 2008
+*********************************************************************/
+
+static int test_1dim_multivars_addon()
+{
+    int32 fid;			/* file id */
+    int32 dset1, dset2;		/* dataset ids */
+    int32 dset_index;		/* dataset index */
+    int32 dimsizes[1];		/* dimension size buffer */
+    int32 start[1],		/* where to start writing */
+	  edges[1];		/* length of data to be read/written */
+    int16 fillval = -3;		/* fill value for the variable */
+    intn  status = 0;		/* returned by called functions */
+    intn  num_errs = 0;		/* number of errors so far */
+
+    /* result data to compare against read data */
+    int16 result3[] = {300,301,302,303,-3,-3,30,31,801,802,803};
+    int16 result4[] = {300,301,302,-3,-3,-3,-3,-3,801,802,803};
+
+    /* enter define mode */
+    fid = SDstart(FILENAME2, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+
+    /* Define dimension of the data set to be created. */
+    dimsizes[0] = SD_UNLIMITED;
+
+    /* Create an array data sets. */
+    dset1 = SDcreate(fid, "Variable 3", DFNT_INT16, 1, dimsizes);
+    CHECK(dset1, FAIL, "SDcreate");
+
+    /* Datasets will be filled with fill values when data is missing */
+    status = SDsetfillvalue(dset1, (VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    /* Close dataset and file */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    /* Reopen file and dataset */
+    fid = SDstart(FILENAME2, DFACC_RDWR);
+    CHECK(fid, FAIL, "SDstart");
+    dset_index = SDnametoindex(fid, "Variable 3");
+    CHECK(dset_index, FAIL, "SDnametoindex");
+    dset1 = SDselect(fid, dset_index);
+    CHECK(dset1, FAIL, "SDselect");
+
+    /* Create another dataset */
+    dset2 = SDcreate(fid, "Variable 4", DFNT_INT16, 1, dimsizes);
+    CHECK(dset2, FAIL, "SDcreate");
+
+    /* Datasets will be filled with fill values when data is missing */
+    status = SDsetfillvalue(dset2, (VOIDP)&fillval);
+    CHECK(status, FAIL, "SDsetfillvalue");
+
+    { /* Add data */
+	int16 data[] = {300, 301, 302, 303};
+
+	/* Write 4 elements to "Variable 3" starting at index 0 */
+	start[0] = 0;
+	edges[0] = 4;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+
+	/* Write 3 elements to "Variable 4" starting at index 0 */
+	edges[0] = 3;
+	status = SDwritedata(dset2, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the datasets, and verify their data and dim sizes */
+    num_errs = num_errs + verify_info_data(dset1, 4, result3);
+    num_errs = num_errs + verify_info_data(dset2, 3, result4);
+
+    { /* Append data to "Variable 3" pass the end */
+	int16 data[] = {30, 31};
+
+	/* Write 2 values starting at index 6, skipping indices 4 and 5 */
+	start[0] = 6;
+	edges[0] = 2;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the dataset, and verify its data and dim size */
+    num_errs = num_errs + verify_info_data(dset1, 8, result3);
+
+    { /* Append data to "Variable 3" again, but right at the end */
+	int16 data[] = {801,802,803};
+
+	/* Write 3 values starting at index 8, at the end */
+	start[0] = 8;
+	edges[0] = 3;
+	status = SDwritedata(dset1, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of "Variable 3", and verify its dimension */
+    num_errs = num_errs + verify_info_data(dset1, 11, result3);
+
+    { /* Append data to "Variable 4" at an arbitrary index, skipping a few */
+	int16 data[] = {801,802,803};
+
+	/* Write 3 values starting at index 8, at the end */
+	start[0] = 8;
+	edges[0] = 3;
+	status = SDwritedata(dset2, start, NULL, edges, (VOIDP)data);
+	CHECK(status, FAIL, "SDwritedata");
+    }
+
+    /* Get information of the "Variable 4" and verify its data and dim size */
+    num_errs = num_errs + verify_info_data(dset2, 11, result4);
+
+    { /* Read and verify data from dataset "Variable 2" that was created in
+	 test_1dim_multivars */
+	int32 dset;
+	int16 result2[] = {102,104,-2,-2,-2,-2,-2,-2,200,201,202,800,801,802,803};
+
+	/* Get access to dataset "Variable 2" */
+	dset_index = SDnametoindex(fid, "Variable 2");
+	CHECK(dset_index, FAIL, "SDnametoindex");
+	dset = SDselect(fid, dset_index);
+	CHECK(dset, FAIL, "SDselect");
+
+	/* Get its information and verify its data and dimension size */
+	num_errs = num_errs + verify_info_data(dset, 15, result2);
+
+	/* Close "Variable 2" */
+	status = SDendaccess(dset);
+	CHECK(status, FAIL, "SDendaccess");
+    } /* end reading "Variable 2" */
+
+    /* Close all datasets */
+    status = SDendaccess(dset1);
+    CHECK(status, FAIL, "SDendaccess");
+    status = SDendaccess(dset2);
+    CHECK(status, FAIL, "SDendaccess");
+
+    /* Close the file */
+    status = SDend(fid);
+    CHECK(status, FAIL, "SDend");
+
+    return 0;
+} /* test_1dim_multivars_addon */
+
+
+/* Test driver for testing reading/writing variables with unlimited dimension 
+   using SD API. */
+extern int test_unlim()
+{
+    int num_errs = 0;
+
+    /* Output message about test being performed */
+    TESTING("read/write datasets with unlimited dims via SD API (tunlim.c)");
+
+    /* Test single variable with 1 unlimited dimension */
+    num_errs = num_errs + test_1dim_singlevar();
+
+    /* Test multiple variables with 1 unlimited dimension */
+    num_errs = num_errs + test_1dim_multivars();
+
+    /* Test multiple variables with multiple dimensions */
+    num_errs = num_errs + test_multidim_singlevar();
+
+    /* Test multiple variables created at different time */
+    num_errs = num_errs + test_1dim_multivars_addon();
+
+    if (num_errs == 0) PASSED();
+    return num_errs;
+}
diff --git a/mfhdf/test/tutils.c b/mfhdf/test/tutils.c
new file mode 100644
index 0000000..2def652
--- /dev/null
+++ b/mfhdf/test/tutils.c
@@ -0,0 +1,56 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF.  The full HDF 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      *
+ * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
+ * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "mfhdf.h"
+#include "hdftest.h"
+
+/* Generate the correct name for the test file, by prepending the source path
+   if it exists, otherwise, assume it is the local directory */
+   /* NOTE: should move all utilities into mfutil.c or something like that */
+intn make_datafilename(char* basename, char* testfile, unsigned int size)
+{
+    char *srcdir = getenv("srcdir");
+    char *tempfile = NULL;
+
+    tempfile = (char *) HDmalloc(sizeof(char *) * (size+1));
+    HDmemset(tempfile, '\0', size+1);
+
+    /* Generate the correct name for the test file, by prepending the source path */
+    if (srcdir && ((strlen(srcdir) + strlen(basename) + 1) < size))
+    {
+        strcpy(tempfile, srcdir);
+        strcat(tempfile, "/");
+    }
+
+    /* Windows doesn't set srcdir, and generates files in a different relative
+       path, so we need to special case here.  It is best to look for the
+       testfile in the same path, and the Windows test script will make sure
+       to put it there first.  - SJW 2007/09/19 (from tnetcdf.c) */
+#ifndef _WIN32
+    /* This is to get to the file when the library was built without srcdir
+       option and the test is ran by ./hdftest in the test src directory
+       instead of by make check.  - BMR 2007/08/09 */
+    if (srcdir == NULL)
+        strcpy(tempfile, "./");
+#endif /* _WIN32 */
+
+    /* Name of data file */
+    strcat(tempfile, basename);
+
+    /* Verify that file name is not NULL */
+    if (tempfile == NULL || tempfile[0] == '\0')
+        return FAIL;
+
+    /* File name is generated, return it */
+    HDstrcpy(testfile, tempfile);
+    return SUCCEED;
+}
diff --git a/mfhdf/util/getopt.c b/mfhdf/util/getopt.c
new file mode 100644
index 0000000..bd99e6a
--- /dev/null
+++ b/mfhdf/util/getopt.c
@@ -0,0 +1,78 @@
+/*LINTLIBRARY*/
+#define NULL	0
+#define EOF	(-1)
+
+#ifdef HDF
+#define ERR(s, c)	if(opterr){\
+	char errbuf[2];\
+	errbuf[0] = c; errbuf[1] = '\n';\
+	(void) write(2, argv[0], strlen(argv[0]));\
+	(void) write(2, s, strlen(s));\
+	(void) write(2, errbuf, 2);}
+
+#include <string.h>
+#else
+#define ERR(s, c)	if(opterr){\
+	extern int strlen(), write();\
+	char errbuf[2];\
+	errbuf[0] = c; errbuf[1] = '\n';\
+	(void) write(2, argv[0], strlen(argv[0]));\
+	(void) write(2, s, strlen(s));\
+	(void) write(2, errbuf, 2);}
+
+extern int      strcmp();
+extern char    *strchr();
+#endif
+
+int             opterr = 1;
+int             optind = 1;
+int             optopt;
+char           *optarg;
+
+int
+getopt(argc, argv, opts)
+    int             argc;
+    char          **argv, *opts;
+{
+    static int      sp = 1;
+    register int    c;
+    register char  *cp;
+
+    if (sp == 1)
+	if (optind >= argc ||
+	    argv[optind][0] != '-' || argv[optind][1] == '\0')
+	    return (EOF);
+	else if (strcmp(argv[optind], "--") == NULL) {
+	    optind++;
+	    return (EOF);
+	}
+    optopt = c = argv[optind][sp];
+    if (c == ':' || (cp = strchr(opts, c)) == NULL) {
+	ERR(": unknown option, -", c);
+	if (argv[optind][++sp] == '\0') {
+	    optind++;
+	    sp = 1;
+	}
+	return ('?');
+    }
+    if (*++cp == ':') {
+	if (argv[optind][sp + 1] != '\0')
+	    optarg = &argv[optind++][sp + 1];
+	else if (++optind >= argc) {
+	    ERR(": argument missing for -", c);
+	    sp = 1;
+	    return ('?');
+	}
+	else
+	    optarg = argv[optind++];
+	sp = 1;
+    }
+    else {
+	if (argv[optind][++sp] == '\0') {
+	    sp = 1;
+	    optind++;
+	}
+	optarg = NULL;
+    }
+    return (c);
+}
diff --git a/mfhdf/util/msoft.mk b/mfhdf/util/msoft.mk
new file mode 100644
index 0000000..6530eef
--- /dev/null
+++ b/mfhdf/util/msoft.mk
@@ -0,0 +1,21 @@
+#  Copyright 1989, University Corporation for Atmospheric Research
+#
+#	DOS and OS/2 makefile for utility routine used by the netCDF
+#
+
+CC     = cl
+CFLAGS = /c /AL /Za
+
+OBJS = getopt.obj
+
+all:	getopt.obj
+
+getopt.obj: getopt.c
+	$(CC) $(CFLAGS) getopt.c
+
+test:
+install:
+
+clean:
+	rm -f *.bak getopt.obj
+
diff --git a/mfhdf/util/win32utl.mak b/mfhdf/util/win32utl.mak
new file mode 100644
index 0000000..3b93ba9
--- /dev/null
+++ b/mfhdf/util/win32utl.mak
@@ -0,0 +1,140 @@
+# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+!IF "$(CFG)" == ""
+CFG=Win32 Debug
+!MESSAGE No configuration specified.  Defaulting to Win32 Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line.  For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "util.mak" CFG="Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+################################################################################
+# Begin Project
+CPP=cl.exe
+
+!IF  "$(CFG)" == "Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "WinRel"
+# PROP BASE Intermediate_Dir "WinRel"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : .\util.lib .\util.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HDF" /D "NO_SYS_XDR_INC" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HDF"\
+ /D "NO_SYS_XDR_INC" /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"util.bsc" 
+
+.\util.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	.\getopt.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"util.lib" 
+
+.\util.lib : $(OUTDIR)  $(DEF_FILE) $(LIB32_OBJS)
+    $(LIB32) @<<
+  $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "WinDebug"
+# PROP BASE Intermediate_Dir "WinDebug"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : .\util.lib .\util.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /Z7 /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /Z7 /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HDF" /D "NO_SYS_XDR_INC" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Z7 /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D\
+ "HDF" /D "NO_SYS_XDR_INC" /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"util.bsc" 
+
+.\util.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	.\getopt.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"util.lib" 
+
+.\util.lib : $(OUTDIR)  $(DEF_FILE) $(LIB32_OBJS)
+    $(LIB32) @<<
+  $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Group "Source Files"
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\getopt.c
+
+.\getopt.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################
diff --git a/mfhdf/xdr/CMakeLists.txt b/mfhdf/xdr/CMakeLists.txt
new file mode 100644
index 0000000..5f9ca90
--- /dev/null
+++ b/mfhdf/xdr/CMakeLists.txt
@@ -0,0 +1,50 @@
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4_MFHDF_XDR C CXX)
+
+SET (HDF4_MFHDF_XDR_SRCS
+    ${HDF4_MFHDF_XDR_SOURCE_DIR}/xdr.c
+    ${HDF4_MFHDF_XDR_SOURCE_DIR}/xdrfloat.c
+    ${HDF4_MFHDF_XDR_SOURCE_DIR}/xdrstdio.c
+    ${HDF4_MFHDF_XDR_SOURCE_DIR}/xdrarray.c
+)
+
+SET (HDF4_MFHDF_XDR_HDRS
+    ${HDF4_MFHDF_XDR_SOURCE_DIR}/xdr.h
+    ${HDF4_MFHDF_XDR_SOURCE_DIR}/types.h
+)
+
+INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
+INCLUDE_DIRECTORIES (${HDF4_MFHDF_XDR_DIR})
+
+ADD_DEFINITIONS (-DHDF)
+
+IF (WIN32 AND NOT CYGWIN)
+  ADD_DEFINITIONS (-DDOS_FS -DNO_SYS_XDR_INC)
+ENDIF (WIN32 AND NOT CYGWIN)
+
+IF (MSVC)
+  ADD_LIBRARY (${HDF4_MF_XDR_LIB_TARGET} ${LIB_TYPE} ${HDF4_MFHDF_XDR_SRCS} ${HDF4_MFHDF_XDR_HDRS})
+  TARGET_LINK_LIBRARIES (${HDF4_MF_XDR_LIB_TARGET} "ws2_32.lib")
+ELSE (MSVC)
+  ADD_LIBRARY (${HDF4_MF_XDR_LIB_TARGET} ${LIB_TYPE} ${HDF4_MFHDF_XDR_SRCS} ${HDF4_MFHDF_XDR_HDRS} )
+ENDIF (MSVC)
+TARGET_C_PROPERTIES (${HDF4_MF_XDR_LIB_TARGET} " " " ")
+SET_GLOBAL_VARIABLE (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_MF_XDR_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_MF_XDR_LIB_TARGET} ${HDF4_MF_XDR_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add library to CMake Install : Installs lib and cmake config info
+#-----------------------------------------------------------------------------
+IF (BUILD_SHARED_LIBS)
+  INSTALL_TARGET_PDB (${HDF4_MF_XDR_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries)
+ENDIF (BUILD_SHARED_LIBS)
+  
+INSTALL (
+    TARGETS 
+        ${HDF4_MF_XDR_LIB_TARGET}
+    EXPORT 
+        ${HDF4_EXPORTED_TARGETS}
+    LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
+    ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
+    RUNTIME DESTINATION ${HDF4_INSTALL_BIN_DIR} COMPONENT libraries
+)
diff --git a/mfhdf/xdr/Makefile.am b/mfhdf/xdr/Makefile.am
new file mode 100644
index 0000000..72e6b75
--- /dev/null
+++ b/mfhdf/xdr/Makefile.am
@@ -0,0 +1,22 @@
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# XDR Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+## Setup the different includes and preprocessor #defines we need.
+INCLUDES=-I$(top_srcdir)/hdf/src
+
+# XDR Library
+lib_LTLIBRARIES = libxdr.la
+libxdr_la_SOURCES = xdr.c xdrfloat.c xdrstdio.c xdrarray.c
+include_HEADERS = xdr.h types.h
+
+# Test program. Link using libxdr.la
+check_PROGRAMS = xdrtest
+TEST_PROG = xdrtest
+xdrtest_SOURCES = xdrtest.c
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/xdr/Makefile.in b/mfhdf/xdr/Makefile.in
new file mode 100644
index 0000000..131c7b2
--- /dev/null
+++ b/mfhdf/xdr/Makefile.in
@@ -0,0 +1,841 @@
+# Makefile.in generated by automake 1.12.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+#
+# XDR Library Makefile(.in)
+#
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/bin/depcomp \
+	$(top_srcdir)/bin/mkinstalldirs \
+	$(top_srcdir)/config/commence.am \
+	$(top_srcdir)/config/conclude.am
+check_PROGRAMS = xdrtest$(EXEEXT)
+TESTS = $(am__EXEEXT_1)
+subdir = mfhdf/xdr
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libxdr_la_LIBADD =
+am_libxdr_la_OBJECTS = xdr.lo xdrfloat.lo xdrstdio.lo xdrarray.lo
+libxdr_la_OBJECTS = $(am_libxdr_la_OBJECTS)
+am_xdrtest_OBJECTS = xdrtest.$(OBJEXT)
+xdrtest_OBJECTS = $(am_xdrtest_OBJECTS)
+xdrtest_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
+depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libxdr_la_SOURCES) $(xdrtest_SOURCES)
+DIST_SOURCES = $(libxdr_la_SOURCES) $(xdrtest_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+am__EXEEXT_1 = xdrtest$(EXEEXT)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_FORTRAN = @BUILD_FORTRAN@
+BUILD_NETCDF = @BUILD_NETCDF@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CC_VERSION = @CC_VERSION@
+CFLAGS = @CFLAGS@
+CONFIG_DATE = @CONFIG_DATE@
+CONFIG_MODE = @CONFIG_MODE@
+CONFIG_USER = @CONFIG_USER@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F77_VERSION = @F77_VERSION@
+FFLAGS = @FFLAGS@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GREP = @GREP@
+H4_VERSION = @H4_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LL_PATH = @LL_PATH@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_STATIC_EXEC = @LT_STATIC_EXEC@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NEQN = @NEQN@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SETX = @SETX@
+SET_MAKE = @SET_MAKE@
+SHARED_EXTENSION = @SHARED_EXTENSION@
+SHELL = @SHELL@
+STATIC_EXEC = @STATIC_EXEC@
+STATIC_SHARED = @STATIC_SHARED@
+STRIP = @STRIP@
+SZIP_INFO = @SZIP_INFO@
+TBL = @TBL@
+TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
+UNAME_INFO = @UNAME_INFO@
+USE_COMP_SZIP = @USE_COMP_SZIP@
+VERSION = @VERSION@
+YACC = @YACC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Shell commands used in Makefiles
+RM = rm -f
+CP = cp
+
+# Libraries to link to while building
+LIBHDF = $(top_builddir)/hdf/src/libdf.la
+LIBMFHDF = $(top_builddir)/mfhdf/libsrc/libmfhdf.la
+H4CC = ${DESTDIR}$(bindir)/h4cc
+H4FC = ${DESTDIR}$(bindir)/h4fc
+ at HDF_BUILD_XDR_TRUE@XDR_ADD = -R$(abs_top_builddir)/mfhdf/xdr/.libs
+ at HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = -R$(abs_top_builddir)/mfhdf/libsrc/.libs -R$(abs_top_builddir)/hdf/src/.libs $(XDR_ADD)
+ACLOCAL_AMFLAGS = "-I m4"
+
+# .chkexe files are used to mark tests that have run successfully.
+# .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
+INCLUDES = -I$(top_srcdir)/hdf/src
+
+# XDR Library
+lib_LTLIBRARIES = libxdr.la
+libxdr_la_SOURCES = xdr.c xdrfloat.c xdrstdio.c xdrarray.c
+include_HEADERS = xdr.h types.h
+TEST_PROG = xdrtest
+xdrtest_SOURCES = xdrtest.c
+
+# Automake needs to be taught how to build lib, progs, and tests targets.
+# These will be filled in automatically for the most part (e.g.,
+# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG
+# variables are supplied to allow the user to force targets to
+# be built at certain times. 
+LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES)                 \
+      $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
+
+PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS)   \
+        $(EXTRA_PROG)
+
+chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+AM_SH_LOG_FLAGS = 
+TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
+TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/xdr/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign mfhdf/xdr/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+$(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am:
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; \
+	locs=`for p in $$list; do echo $$p; done | \
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+	      sort -u`; \
+	test -z "$$locs" || { \
+	  echo rm -f $${locs}; \
+	  rm -f $${locs}; \
+	}
+libxdr.la: $(libxdr_la_OBJECTS) $(libxdr_la_DEPENDENCIES) $(EXTRA_libxdr_la_DEPENDENCIES) 
+	$(LINK) -rpath $(libdir) $(libxdr_la_OBJECTS) $(libxdr_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+xdrtest$(EXEEXT): $(xdrtest_OBJECTS) $(xdrtest_DEPENDENCIES) $(EXTRA_xdrtest_DEPENDENCIES) 
+	@rm -f xdrtest$(EXEEXT)
+	$(LINK) $(xdrtest_OBJECTS) $(xdrtest_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdr.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrarray.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrfloat.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrstdio.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrtest.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist:  $(HEADERS) $(SOURCES) $(LISP)
+	list='$(SOURCES) $(HEADERS) $(LISP)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) all-local
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \
+	clean clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool cscopelist ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-includeHEADERS install-info install-info-am \
+	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
+
+# lib/progs/tests targets recurse into subdirectories. build-* targets
+# build files in this directory.
+build-lib: $(LIB)
+build-progs: $(LIB) $(PROGS)
+build-tests: $(LIB) $(PROGS) $(chk_TESTS)
+
+# General rule for recursive building targets.
+# BUILT_SOURCES contain targets that need to be built before anything else
+# in the directory (e.g., for Fortran type detection)
+lib progs tests check-s :: $(BUILT_SOURCES)
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# General rule for recursive cleaning targets.  Like the rule above,
+# but doesn't require building BUILT_SOURCES.
+check-clean ::
+	@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
+	@for d in X $(SUBDIRS); do                                             \
+	    if test $$d != X && test $$d != .; then                           \
+	        (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;     \
+	    fi;                                                               \
+	done
+
+# Tell Automake to build tests when the user types `make all' (this is
+# not its default behavior).  Also build EXTRA_LIB and EXTRA_PROG since
+# Automake won't build them automatically, either.
+all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
+
+# make install-doc doesn't do anything outside of doc directory, but
+# Makefiles should recognize it.
+# UPDATE: docs no longer reside in this build tree, so this target
+# is depreciated.
+install-doc uninstall-doc:
+	@echo "Nothing to be done."
+
+# clean up files generated by tests so they can be re-run.
+build-check-clean:
+	$(RM) -rf $(CHECK_CLEANFILES)
+
+# run check-clean whenever mostlyclean is run
+mostlyclean-local: build-check-clean
+
+# check-install is just a synonym for installcheck
+check-install: installcheck
+
+# Run each test in order, passing $(TEST_FLAGS) to the program.
+# Since tests are done in a shell loop, "make -i" does apply inside it.
+#
+# Note that targets in chk_TESTS (defined above) will be built when the user
+# types 'make tests' or 'make check', but only programs in TEST_PROG,
+# or TEST_SCRIPT will actually be executed.
+check-TESTS: test
+
+test _test:
+	@$(MAKE) build-check-s
+
+# Actual execution of check-s.
+build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	   echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
+	fi
+	@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
+	@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then      \
+	    echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
+	fi
+
+_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
+
+# The dummy.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_PROG_CHKEXE) dummy.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
+	   tname=$(@:.chkexe_=)$(EXEEXT);\
+	   log=$(@:.chkexe_=.chklog); \
+	   echo ""; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "----------------------------" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "----------------------------" >> $${log}; \
+	      srcdir="$(srcdir)" \
+		 $(TIME) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+		 && touch $(@:.chkexe_=.chkexe) || \
+		 (cat $${log} && false) || exit 1; \
+	      echo "----------------------------" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      cat $${log}; \
+	   fi; \
+	fi
+
+# The dummysh.chkexe here prevents the target from being
+# empty if there are no tests in the current directory.
+# $${log} is the log file.
+# $${tname} is the name of test.
+$(TEST_SCRIPT_CHKSH) dummysh.chkexe_:
+	@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
+	   cmd=$(@:.chkexe_=);\
+	   tname=`basename $$cmd`;\
+	   chkname=`basename $(@:.chkexe_=.chkexe)`;\
+	   log=`basename $(@:.chkexe_=.chklog)`; \
+	   echo "============================"; \
+	   if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
+	      echo "No need to test $${tname} again."; \
+	   else \
+	      echo "============================" > $${log}; \
+	      if test "X$(FORTRAN_API)" = "Xyes"; then \
+	         echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      else \
+	         echo "Testing $${tname} $(TEST_FLAGS)"; \
+	         echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+	      fi; \
+	      echo "============================" >> $${log}; \
+	      srcdir="$(srcdir)" \
+	         $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
+	         && touch $${chkname} || \
+	         (cat $${log} && false) || exit 1; \
+	      echo "" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+	      echo "============================" >> $${log}; \
+	      echo "Finished testing $${tname} $(TEST_FLAGS)"; \
+	      cat $${log}; \
+	   fi; \
+	   echo "============================"; \
+	fi
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/mfhdf/xdr/NOTICE.h b/mfhdf/xdr/NOTICE.h
new file mode 100644
index 0000000..1a66d5f
--- /dev/null
+++ b/mfhdf/xdr/NOTICE.h
@@ -0,0 +1,28 @@
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part.  Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ * 
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ * 
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ * 
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ * 
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ * 
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California  94043
+ */
diff --git a/mfhdf/xdr/README b/mfhdf/xdr/README
new file mode 100644
index 0000000..664f24f
--- /dev/null
+++ b/mfhdf/xdr/README
@@ -0,0 +1,76 @@
+$Id: README 468 1993-04-21 21:54:36Z chouck $
+
+Mon Apr 17 18:40:07 MDT 1989
+
+This directory contains materials copyrighted by Sun Microsystems, Inc.
+Please read "NOTICE.h"
+
+This is the minimum subset of RPCSRC 3.9 needed to build the netcdf library.
+It is included here for those systems which lack xdr support.
+If your system already has these xdr routines, by all means use them.
+Unix systems which suport the Network File System (NFS) usually have these
+routines in the 'c' library, /usr/lib/libc.a,
+so you don't need to link in any additional libraries.
+Another candididate is librpclib.a in /usr/lib or /usr/local/lib.
+
+The complete RPCSRC distribution may be obtained from Sun or
+from the sun-spots archive at rice.edu.
+
+If you must build this portion of the system, make xdrtest. 
+Running it should produce output like the contents of
+testout.sav on standard output.
+N.B **** For the double precision numbers, the last three
+decimal digits will vary between vaxes and ieee machines. *****
+Running xdrtest will also produce the file "test.xdr".
+Once standard out looks good, then do a binary comparison of the
+files "test.xdr" and "test_xdr.sav".
+(On unix you enter, 'cmp test.xdr test_xdr.sav').
+If the files are byte for byte identical, you are okay.
+
+
+On VAX/VMS, you WILL probably have to build this directory.
+The following files are only used on vms:
+	descrip.mms - The immoral equivalent of a Makefile
+	htonl.mar - 'Host To Network Long', in VAX Macro
+	ntohl.mar - 'Network To Host Long', in VAX Macro
+Because the stdio implementation in vax C runtime library is so poor,
+this code runs 3 times slower on vms than under Ultrix on the same
+Microvax.  If someone were very civic minded they would rewrite the
+file xdrstdio.c as xdr_qio.c. (This is not as bad as it sounds,
+the similar thing has already been done for MacOS Toolbox calls.)
+The file netcdf/src/file.c would also need to be changed ...
+Otherwise, hammer on DEC to get there C language support together.
+
+
+Notes:
+
+Fri Sep 23 10:11:14 MDT 1988
+
+The return value of xdr_getpos and the corresponding argument to xdr_setpos
+changed from 'u_int' to 'u_long' (fpos_t??) in anticipation of problems
+on micros where sizeof(int) < sizeof(long). OK with Steve Nahm at sun.
+
+
+Thu Mar  9 22:23:00 MDT 1989
+
+Added support for architectures where sizeof(enum) == sizeof(char)
+in xdr.c:xdr_enum. Note that, as written this is a runtime !?! check...
+
+
+Mon Apr 17 15:08:05 MDT 1989
+
+The Iris computers seem to put the xdr routines in /usr/lib/libsun.a.
+EG, you don't need to build the ones here.
+You may have to muck around to get the include files right on an iris.
+Also may need libbsd.a.
+
+
+Wed Apr 26 19:48:46 MDT 1989
+
+Fix to xdr_float.c:xdr_float:"#ifdef vax" to handle values less than 
+2^^-127 properly.
+
+
+May 1989
+
+Added MIPSEL #ifdef for ieee, byte swapped machines like DECstations.
diff --git a/mfhdf/xdr/byteordr.c b/mfhdf/xdr/byteordr.c
new file mode 100644
index 0000000..772facf
--- /dev/null
+++ b/mfhdf/xdr/byteordr.c
@@ -0,0 +1,72 @@
+/*
+ * Example: Use the standard library version instead, if you have one.
+ */
+
+/* switch the order of the bytes in a long integer */
+long ntohl(i_in)
+long i_in;
+{
+	long i_out;
+	register unsigned char *inptr, *outptr;
+
+	inptr = (unsigned char *) &i_in;
+	outptr = (unsigned char *) &i_out;
+
+	outptr[3] = inptr[0];
+	outptr[2] = inptr[1];
+	outptr[1] = inptr[2];
+	outptr[0] = inptr[3];
+
+	return(i_out);
+}
+
+/* switch the order of the bytes in a long integer */
+long htonl(i_in)
+long i_in;
+{
+	long i_out;
+	register unsigned char *inptr, *outptr;
+
+	inptr = (unsigned char *) &i_in;
+	outptr = (unsigned char *) &i_out;
+
+	outptr[3] = inptr[0];
+	outptr[2] = inptr[1];
+	outptr[1] = inptr[2];
+	outptr[0] = inptr[3];
+
+	return(i_out);
+}
+
+
+/* switch the order of the bytes in a short integer */
+short ntohs(i_in)
+short i_in;
+{
+	short i_out;
+	register unsigned char *inptr, *outptr;
+
+	inptr = (unsigned char *) &i_in;
+	outptr = (unsigned char *) &i_out;
+
+	outptr[1] = inptr[0];
+	outptr[0] = inptr[1];
+
+	return(i_out);
+}
+
+/* switch the order of the bytes in a short integer */
+short htons(i_in)
+short i_in;
+{
+	short i_out;
+	register unsigned char *inptr, *outptr;
+
+	inptr = (unsigned char *) &i_in;
+	outptr = (unsigned char *) &i_out;
+
+	outptr[1] = inptr[0];
+	outptr[0] = inptr[1];
+
+	return(i_out);
+}
diff --git a/mfhdf/xdr/depend b/mfhdf/xdr/depend
new file mode 100644
index 0000000..f22774a
--- /dev/null
+++ b/mfhdf/xdr/depend
@@ -0,0 +1,50 @@
+byteordr.o: byteordr.c
+xdr.o: xdr.c
+xdr.o: types.h
+xdr.o: xdr.h
+xdr.o: ../../hdf/src//hdf.h
+xdr.o: ../../hdf/src//hdfi.h
+xdr.o: ../../hdf/src//hlimits.h
+xdr.o: ../../hdf/src//hntdefs.h
+xdr.o: ../../hdf/src//htags.h
+xdr.o: ../../hdf/src//hbitio.h
+xdr.o: ../../hdf/src//hcomp.h
+xdr.o: ../../hdf/src//herr.h
+xdr.o: ../../hdf/src//hproto.h
+xdrarray.o: xdrarray.c
+xdrarray.o: types.h
+xdrarray.o: xdr.h
+xdrarray.o: ../../hdf/src//hdf.h
+xdrarray.o: ../../hdf/src//hdfi.h
+xdrarray.o: ../../hdf/src//hlimits.h
+xdrarray.o: ../../hdf/src//hntdefs.h
+xdrarray.o: ../../hdf/src//htags.h
+xdrarray.o: ../../hdf/src//hbitio.h
+xdrarray.o: ../../hdf/src//hcomp.h
+xdrarray.o: ../../hdf/src//herr.h
+xdrarray.o: ../../hdf/src//hproto.h
+xdrfloat.o: xdrfloat.c
+xdrfloat.o: types.h
+xdrfloat.o: xdr.h
+xdrfloat.o: ../../hdf/src//hdf.h
+xdrfloat.o: ../../hdf/src//hdfi.h
+xdrfloat.o: ../../hdf/src//hlimits.h
+xdrfloat.o: ../../hdf/src//hntdefs.h
+xdrfloat.o: ../../hdf/src//htags.h
+xdrfloat.o: ../../hdf/src//hbitio.h
+xdrfloat.o: ../../hdf/src//hcomp.h
+xdrfloat.o: ../../hdf/src//herr.h
+xdrfloat.o: ../../hdf/src//hproto.h
+xdrstdio.o: xdrstdio.c
+xdrstdio.o: types.h
+xdrstdio.o: xdr.h
+xdrstdio.o: ../../hdf/src//hdf.h
+xdrstdio.o: ../../hdf/src//hdfi.h
+xdrstdio.o: ../../hdf/src//hlimits.h
+xdrstdio.o: ../../hdf/src//hntdefs.h
+xdrstdio.o: ../../hdf/src//htags.h
+xdrstdio.o: ../../hdf/src//hbitio.h
+xdrstdio.o: ../../hdf/src//hcomp.h
+xdrstdio.o: ../../hdf/src//herr.h
+xdrstdio.o: ../../hdf/src//hproto.h
+xdrtest.o: xdrtest.c
diff --git a/mfhdf/xdr/htonl.mar b/mfhdf/xdr/htonl.mar
new file mode 100644
index 0000000..41e8689
--- /dev/null
+++ b/mfhdf/xdr/htonl.mar
@@ -0,0 +1,9 @@
+	.TITLE	htonl
+
+	.entry	htonl,^m<>
+	rotl	#-8,4(ap),r0
+	insv	r0,#16,#8,r0
+	movb	7(ap),r0
+	ret
+
+	.end
diff --git a/mfhdf/xdr/msoft.mk b/mfhdf/xdr/msoft.mk
new file mode 100644
index 0000000..b6ee37f
--- /dev/null
+++ b/mfhdf/xdr/msoft.mk
@@ -0,0 +1,64 @@
+#   Copyright 1989, University Corporation for Atmospheric Research
+#
+#	PC Makefile for eXternal Data Representation library routines
+#		used by the netCDF.
+#
+#  NOTE:  Set the definition of the OS2 macro to match OS as follows:
+#         OS2 = 0     -> DOS
+#         OS2 = 1     -> OS/2
+
+!INCLUDE ..\macros.mk
+
+AR       = LIB
+ARFLAGS  =
+
+LINK     = link
+LFLAGS   = /nod
+
+INCDIR   = .
+INCLUDES = /I$(INCDIR) /I\hdf\hdf\include
+
+LIBDIR   = $(DESTDIR)\lib
+
+XDRLIB   = xdr.lib
+!IF $(OS2)
+OS2LIB    = os2.lib
+!ELSE
+OS2LIB    =
+!ENDIF
+LIBS     = $(XDRLIB) llibe7.lib $(OS2LIB)
+
+XDROBJS  = xdr.obj xdrarray.obj xdrfloat.obj xdrstdio.obj byteordr.obj
+XDRLOBJS = -+xdr -+xdrarray -+xdrfloat -+xdrstdio -+byteordr
+
+all:		$(XDRLIB)
+
+$(XDRLIB): $(XDROBJS)
+	$(AR) $@ $(ARFLAGS) $(XDRLOBJS),LIB.LST;
+
+test:		xdrtest.exe FORCE
+	xdrtest
+
+FORCE:
+
+xdrtest.exe: xdrtest.obj $(XDROBJS)
+	$(LINK) $(LFLAGS) xdrtest.obj,,,$(LIBS);
+
+install:
+	copy $(XDRLIB) $(LIBDIR)
+
+clean:
+	rm -f *.obj *.map *.lst *.bak xdr.lib xdrtest.exe test.xdr
+
+xdr.obj: xdr.c types.h xdr.h
+	$(CC) $(CFLAGS) $(INCLUDES) xdr.c
+xdrfloat.obj: xdrfloat.c types.h xdr.h
+	$(CC) $(CFLAGS) $(INCLUDES) xdrfloat.c
+xdrstdio.obj: xdrstdio.c types.h xdr.h
+	$(CC) $(CFLAGS) $(INCLUDES) xdrstdio.c
+xdrarray.obj: xdrarray.c types.h xdr.h
+	$(CC) $(CFLAGS) $(INCLUDES) xdrarray.c
+xdrtest.obj: xdrtest.c types.h xdr.h
+	$(CC) $(CFLAGS) $(INCLUDES) xdrtest.c
+byteordr.obj: byteordr.c
+	$(CC) $(CFLAGS) byteordr.c
diff --git a/mfhdf/xdr/ntohl.mar b/mfhdf/xdr/ntohl.mar
new file mode 100644
index 0000000..e1dd56f
--- /dev/null
+++ b/mfhdf/xdr/ntohl.mar
@@ -0,0 +1,9 @@
+	.TITLE	ntohl
+
+	.entry	ntohl,^m<>
+	rotl	#-8,4(ap),r0
+	insv	r0,#16,#8,r0
+	movb	7(ap),r0
+	ret
+
+	.end
diff --git a/mfhdf/xdr/test_xdr.sav b/mfhdf/xdr/test_xdr.sav
new file mode 100644
index 0000000..06e8dd0
Binary files /dev/null and b/mfhdf/xdr/test_xdr.sav differ
diff --git a/mfhdf/xdr/testout.sav b/mfhdf/xdr/testout.sav
new file mode 100644
index 0000000..474fdf1
--- /dev/null
+++ b/mfhdf/xdr/testout.sav
@@ -0,0 +1,22 @@
+string: Hiya sailor. New in town?
+unsigned bytes: 254 255 0 1 2 0 0 0 
+ints: 5 6 7 8 9 
+unsigned ints: 65535 65534 0 1 2 
+LONG: 82555
+longs: -4 -3 -2 -1 0 
+unsigned longs: 65535 65534 0 1 2 
+floats:
+	 1.001250e+02
+	 1.002500e+02
+	 1.003750e+02
+	 1.005000e+02
+	 1.006250e+02
+
+doubles:
+	 8.388608250000e+06
+	 4.194304125000e+06
+	 2.097152062500e+06
+	 1.048576031250e+06
+	 5.242880156250e+05
+
+enums: 0 1 2 3 4 
diff --git a/mfhdf/xdr/types.h b/mfhdf/xdr/types.h
new file mode 100644
index 0000000..9133909
--- /dev/null
+++ b/mfhdf/xdr/types.h
@@ -0,0 +1,50 @@
+/* @(#)types.h  1.2 87/11/07 3.9 RPCSRC */
+/*      @(#)types.h 1.18 87/07/24 SMI      */
+/*
+ * Rpc additions to <sys/types.h>
+ */
+#ifndef __TYPES_RPC_HEADER__
+#define __TYPES_RPC_HEADER__
+
+#define bool_t  int
+#define enum_t  int
+#ifdef FALSE
+#undef FALSE
+#endif /* FALSE */
+#define FALSE   (0)
+#ifdef TRUE
+#undef TRUE
+#endif /* TRUE */
+#define TRUE    (1)
+#define __dontcare__    -1
+#ifndef NULL
+#   define NULL 0
+#endif
+
+#if defined __STDC__ || defined PC || defined _WINDOWS || defined _WIN32
+#define STDC_INCLUDES
+#endif
+
+#ifdef STDC_INCLUDES
+#include <stddef.h>
+#include <stdlib.h>
+#else
+extern char *malloc();
+#endif
+
+#define mem_alloc(bsize)    malloc(bsize)
+#define mem_free(ptr, bsize)    free(ptr)
+
+#if defined unix | defined __unix
+#ifndef makedev /* ie, we haven't already included it */
+#include <sys/types.h>
+#endif
+#else /* !unix */
+typedef unsigned char   u_char;
+typedef unsigned short  u_short;
+typedef unsigned int    u_int;
+typedef unsigned long   u_long;
+typedef char *  caddr_t;
+#endif /* !unix */
+
+#endif /* !__TYPES_RPC_HEADER__ */
diff --git a/mfhdf/xdr/win32xdr.mak b/mfhdf/xdr/win32xdr.mak
new file mode 100644
index 0000000..acf5f26
--- /dev/null
+++ b/mfhdf/xdr/win32xdr.mak
@@ -0,0 +1,190 @@
+# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+!IF "$(CFG)" == ""
+CFG=Win32 Debug
+!MESSAGE No configuration specified.  Defaulting to Win32 Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line.  For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "win32xdr.mak" CFG="Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+################################################################################
+# Begin Project
+CPP=cl.exe
+
+!IF  "$(CFG)" == "Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "WinRel"
+# PROP BASE Intermediate_Dir "WinRel"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : .\win32xdr.lib .\win32xdr.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS"\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32xdr.bsc" 
+
+.\win32xdr.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	.\xdrstdio.obj \
+	.\xdrarray.obj \
+	.\xdrfloat.obj \
+	.\xdr.obj \
+	.\byteordr.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32xdr.lib" 
+
+.\win32xdr.lib : $(OUTDIR)  $(DEF_FILE) $(LIB32_OBJS)
+    $(LIB32) @<<
+  $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "WinDebug"
+# PROP BASE Intermediate_Dir "WinDebug"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : .\win32xdr.lib .\win32xdr.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /Z7 /YX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /Z7 /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Z7 /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS"\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"win32xdr.bsc" 
+
+.\win32xdr.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LIB32=lib.exe
+DEF_FLAGS=
+DEF_FILE=
+LIB32_OBJS= \
+	.\xdrstdio.obj \
+	.\xdrarray.obj \
+	.\xdrfloat.obj \
+	.\xdr.obj \
+	.\byteordr.obj
+# ADD BASE LIB32 /NOLOGO
+# ADD LIB32 /NOLOGO
+LIB32_FLAGS=/NOLOGO /OUT:$(OUTDIR)\"win32xdr.lib" 
+
+.\win32xdr.lib : $(OUTDIR)  $(DEF_FILE) $(LIB32_OBJS)
+    $(LIB32) @<<
+  $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Group "Source Files"
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\xdrstdio.c
+
+.\xdrstdio.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\xdrarray.c
+
+.\xdrarray.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\xdrfloat.c
+
+.\xdrfloat.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\types.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\xdr.c
+
+.\xdr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\xdr.h
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\byteordr.c
+
+.\byteordr.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################
diff --git a/mfhdf/xdr/xdr.c b/mfhdf/xdr/xdr.c
new file mode 100644
index 0000000..616d592
--- /dev/null
+++ b/mfhdf/xdr/xdr.c
@@ -0,0 +1,551 @@
+/* @(#)xdr.c	1.1 87/11/04 3.9 RPCSRC */
+#if !defined(lint) && defined(SCCSIDS)
+static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
+#endif
+
+/*
+ * xdr.c, Generic XDR routines implementation.
+ *
+ * Copyright (C) 1986, Sun Microsystems, Inc.
+ *
+ * These are the "generic" xdr routines used to serialize and de-serialize
+ * most common data items.  See xdr.h for more info on the interface to
+ * xdr.
+ */
+
+#include <stdio.h>
+#include <string.h> 
+#include "types.h"
+#include "xdr.h"
+
+/*
+ * constants specific to the xdr "protocol"
+ */
+#define XDR_FALSE	((long) 0)
+#define XDR_TRUE	((long) 1)
+#define LASTUNSIGNED	((u_int) 0-1)
+
+/*
+ * for unit alignment
+ */
+static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
+
+/*
+ * Free a data structure using XDR
+ * Not a filter, but a convenient utility nonetheless
+ */
+void
+xdr_free(proc, objp)
+	xdrproc_t proc;
+	char *objp;
+{
+	XDR x;
+	
+	x.x_op = XDR_FREE;
+	(*proc)(&x, objp);
+}
+
+/*
+ * XDR nothing
+ */
+bool_t
+xdr_void(void /* xdrs, addr */)
+	/* XDR *xdrs; */
+	/* caddr_t addr; */
+{
+
+	return (TRUE);
+}
+
+/*
+ * XDR integers
+ */
+bool_t
+xdr_int(xdrs, ip)
+	XDR *xdrs;
+	int *ip;
+{
+
+#ifdef lint
+	(void) (xdr_short(xdrs, (short *)ip));
+	return (xdr_long(xdrs, (long *)ip));
+#else
+	if (sizeof (int) == sizeof (long)) {
+		return (xdr_long(xdrs, (long *)ip));
+	} else {
+		return (xdr_short(xdrs, (short *)ip));
+	}
+#endif
+}
+
+/*
+ * XDR unsigned integers
+ */
+bool_t
+xdr_u_int(xdrs, up)
+	XDR *xdrs;
+	u_int *up;
+{
+
+#ifdef lint
+	(void) (xdr_u_short(xdrs, (u_short *)up));
+	return (xdr_u_long(xdrs, (u_long *)up));
+#else
+	if (sizeof (u_int) == sizeof (u_long)) {
+		return (xdr_u_long(xdrs, (u_long *)up));
+	} else {
+		return (xdr_u_short(xdrs, (u_short *)up));
+	}
+#endif
+}
+
+/*
+ * XDR long integers
+ * same as xdr_u_long - open coded to save a proc call!
+ */
+bool_t
+xdr_long(xdrs, lp)
+	register XDR *xdrs;
+	long *lp;
+{
+
+	if (xdrs->x_op == XDR_ENCODE)
+		return (XDR_PUTLONG(xdrs, lp));
+
+	if (xdrs->x_op == XDR_DECODE)
+		return (XDR_GETLONG(xdrs, lp));
+
+	if (xdrs->x_op == XDR_FREE)
+		return (TRUE);
+
+	return (FALSE);
+}
+
+/*
+ * XDR unsigned long integers
+ * same as xdr_long - open coded to save a proc call!
+ */
+bool_t
+xdr_u_long(xdrs, ulp)
+	register XDR *xdrs;
+	u_long *ulp;
+{
+
+	if (xdrs->x_op == XDR_DECODE)
+		return (XDR_GETLONG(xdrs, (long *)ulp));
+	if (xdrs->x_op == XDR_ENCODE)
+		return (XDR_PUTLONG(xdrs, (long *)ulp));
+	if (xdrs->x_op == XDR_FREE)
+		return (TRUE);
+	return (FALSE);
+}
+
+/*
+ * XDR short integers
+ */
+bool_t
+xdr_short(xdrs, sp)
+	register XDR *xdrs;
+	short *sp;
+{
+	long l;
+
+	switch (xdrs->x_op) {
+
+	case XDR_ENCODE:
+		l = (long) *sp;
+		return (XDR_PUTLONG(xdrs, &l));
+
+	case XDR_DECODE:
+		if (!XDR_GETLONG(xdrs, &l)) {
+			return (FALSE);
+		}
+		*sp = (short) l;
+		return (TRUE);
+
+	case XDR_FREE:
+		return (TRUE);
+	}
+	return (FALSE);
+}
+
+/*
+ * XDR unsigned short integers
+ */
+bool_t
+xdr_u_short(xdrs, usp)
+	register XDR *xdrs;
+	u_short *usp;
+{
+	u_long l;
+
+	switch (xdrs->x_op) {
+
+	case XDR_ENCODE:
+		l = (u_long) *usp;
+		return (XDR_PUTLONG(xdrs, &l));
+
+	case XDR_DECODE:
+		if (!XDR_GETLONG(xdrs, &l)) {
+			return (FALSE);
+		}
+		*usp = (u_short) l;
+		return (TRUE);
+
+	case XDR_FREE:
+		return (TRUE);
+	}
+	return (FALSE);
+}
+
+
+/*
+ * XDR a char
+ */
+bool_t
+xdr_char(xdrs, cp)
+	XDR *xdrs;
+	char *cp;
+{
+	int i;
+
+	i = (*cp);
+	if (!xdr_int(xdrs, &i)) {
+		return (FALSE);
+	}
+	*cp = i;
+	return (TRUE);
+}
+
+/*
+ * XDR an unsigned char
+ */
+bool_t
+xdr_u_char(xdrs, cp)
+	XDR *xdrs;
+	char *cp;
+{
+	u_int u;
+
+	u = (*cp);
+	if (!xdr_u_int(xdrs, &u)) {
+		return (FALSE);
+	}
+	*cp = u;
+	return (TRUE);
+}
+
+/*
+ * XDR booleans
+ */
+bool_t
+xdr_bool(xdrs, bp)
+	register XDR *xdrs;
+	bool_t *bp;
+{
+	long lb;
+
+	switch (xdrs->x_op) {
+
+	case XDR_ENCODE:
+		lb = *bp ? XDR_TRUE : XDR_FALSE;
+		return (XDR_PUTLONG(xdrs, &lb));
+
+	case XDR_DECODE:
+		if (!XDR_GETLONG(xdrs, &lb)) {
+			return (FALSE);
+		}
+		*bp = (lb == XDR_FALSE) ? FALSE : TRUE;
+		return (TRUE);
+
+	case XDR_FREE:
+		return (TRUE);
+	}
+	return (FALSE);
+}
+
+/*
+ * XDR enumerations
+ */
+bool_t
+xdr_enum(xdrs, ep)
+	XDR *xdrs;
+	enum_t *ep;
+{
+#ifndef lint
+	enum sizecheck { SIZEVAL };	/* used to find the size of an enum */
+
+	/*
+	 * enums are treated as ints
+	 */
+	if (sizeof (enum sizecheck) == sizeof (long)) {
+		return (xdr_long(xdrs, (long *)ep));
+	} else if (sizeof (enum sizecheck) == sizeof (short)) {
+		return (xdr_short(xdrs, (short *)ep));
+	} else if (sizeof (enum sizecheck) == sizeof (char)) {
+		return (xdr_char(xdrs, (char *)ep));
+	} else {
+		return (FALSE);
+	}
+#else
+	(void) (xdr_char(xdrs, (char *)ep));
+	(void) (xdr_short(xdrs, (short *)ep));
+	return (xdr_long(xdrs, (long *)ep));
+#endif
+}
+
+/*
+ * XDR opaque data
+ * Allows the specification of a fixed size sequence of opaque bytes.
+ * cp points to the opaque object and cnt gives the byte length.
+ */
+bool_t
+xdr_opaque(xdrs, cp, cnt)
+	register XDR *xdrs;
+	caddr_t cp;
+	register u_int cnt;
+{
+	register u_int rndup;
+	static crud[BYTES_PER_XDR_UNIT];
+
+	/*
+	 * if no data we are done
+	 */
+	if (cnt == 0)
+		return (TRUE);
+
+	/*
+	 * round byte count to full xdr units
+	 */
+	rndup = cnt % BYTES_PER_XDR_UNIT;
+	if (rndup > 0)
+		rndup = BYTES_PER_XDR_UNIT - rndup;
+
+	if (xdrs->x_op == XDR_DECODE) {
+		if (!XDR_GETBYTES(xdrs, cp, cnt)) {
+			return (FALSE);
+		}
+		if (rndup == 0)
+			return (TRUE);
+		return (XDR_GETBYTES(xdrs, crud, rndup));
+	}
+
+	if (xdrs->x_op == XDR_ENCODE) {
+		if (!XDR_PUTBYTES(xdrs, cp, cnt)) {
+			return (FALSE);
+		}
+		if (rndup == 0)
+			return (TRUE);
+		return (XDR_PUTBYTES(xdrs, xdr_zero, rndup));
+	}
+
+	if (xdrs->x_op == XDR_FREE) {
+		return (TRUE);
+	}
+
+	return (FALSE);
+}
+
+/*
+ * XDR counted bytes
+ * *cpp is a pointer to the bytes, *sizep is the count.
+ * If *cpp is NULL maxsize bytes are allocated
+ */
+bool_t
+xdr_bytes(xdrs, cpp, sizep, maxsize)
+	register XDR *xdrs;
+	char **cpp;
+	register u_int *sizep;
+	u_int maxsize;
+{
+	register char *sp = *cpp;  /* sp is the actual string pointer */
+	register u_int nodesize;
+
+	/*
+	 * first deal with the length since xdr bytes are counted
+	 */
+	if (! xdr_u_int(xdrs, sizep)) {
+		return (FALSE);
+	}
+	nodesize = *sizep;
+	if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) {
+		return (FALSE);
+	}
+
+	/*
+	 * now deal with the actual bytes
+	 */
+	switch (xdrs->x_op) {
+
+	case XDR_DECODE:
+		if (nodesize == 0) {
+			return (TRUE);
+		}
+		if (sp == NULL) {
+			*cpp = sp = (char *)mem_alloc(nodesize);
+		}
+		if (sp == NULL) {
+			(void) fprintf(stderr, "xdr_bytes: out of memory\n");
+			return (FALSE);
+		}
+		/* fall into ... */
+
+	case XDR_ENCODE:
+		return (xdr_opaque(xdrs, sp, nodesize));
+
+	case XDR_FREE:
+		if (sp != NULL) {
+			mem_free(sp, nodesize);
+			*cpp = NULL;
+		}
+		return (TRUE);
+	}
+	return (FALSE);
+}
+
+/*
+ * Implemented here due to commonality of the object.
+ */
+bool_t
+xdr_netobj(xdrs, np)
+	XDR *xdrs;
+	struct netobj *np;
+{
+
+	return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ));
+}
+
+/*
+ * XDR a descriminated union
+ * Support routine for discriminated unions.
+ * You create an array of xdrdiscrim structures, terminated with
+ * an entry with a null procedure pointer.  The routine gets
+ * the discriminant value and then searches the array of xdrdiscrims
+ * looking for that value.  It calls the procedure given in the xdrdiscrim
+ * to handle the discriminant.  If there is no specific routine a default
+ * routine may be called.
+ * If there is no specific or default routine an error is returned.
+ */
+bool_t
+xdr_union(xdrs, dscmp, unp, choices, dfault)
+	register XDR *xdrs;
+	enum_t *dscmp;		/* enum to decide which arm to work on */
+	char *unp;		/* the union itself */
+	struct xdr_discrim *choices;	/* [value, xdr proc] for each arm */
+	xdrproc_t dfault;	/* default xdr routine */
+{
+	register enum_t dscm;
+
+	/*
+	 * we deal with the discriminator;  it's an enum
+	 */
+	if (! xdr_enum(xdrs, dscmp)) {
+		return (FALSE);
+	}
+	dscm = *dscmp;
+
+	/*
+	 * search choices for a value that matches the discriminator.
+	 * if we find one, execute the xdr routine for that value.
+	 */
+	for (; choices->proc != NULL_xdrproc_t; choices++) {
+		if (choices->value == dscm)
+			return ((*(choices->proc))(xdrs, unp, LASTUNSIGNED));
+	}
+
+	/*
+	 * no match - execute the default xdr routine if there is one
+	 */
+	return ((dfault == NULL_xdrproc_t) ? FALSE :
+	    (*dfault)(xdrs, unp, LASTUNSIGNED));
+}
+
+
+/*
+ * Non-portable xdr primitives.
+ * Care should be taken when moving these routines to new architectures.
+ */
+
+
+/*
+ * XDR null terminated ASCII strings
+ * xdr_string deals with "C strings" - arrays of bytes that are
+ * terminated by a NULL character.  The parameter cpp references a
+ * pointer to storage; If the pointer is null, then the necessary
+ * storage is allocated.  The last parameter is the max allowed length
+ * of the string as specified by a protocol.
+ */
+bool_t
+xdr_string(xdrs, cpp, maxsize)
+	register XDR *xdrs;
+	char **cpp;
+	u_int maxsize;
+{
+	register char *sp = *cpp;  /* sp is the actual string pointer */
+	u_int size;
+	u_int nodesize;
+
+	/*
+	 * first deal with the length since xdr strings are counted-strings
+	 */
+	switch (xdrs->x_op) {
+	case XDR_FREE:
+		if (sp == NULL) {
+			return(TRUE);	/* already free */
+		}
+		/* fall through... */
+	case XDR_ENCODE:
+		size = strlen(sp);
+		break;
+	}
+	if (! xdr_u_int(xdrs, &size)) {
+		return (FALSE);
+	}
+	if (size > maxsize) {
+		return (FALSE);
+	}
+	nodesize = size + 1;
+
+	/*
+	 * now deal with the actual bytes
+	 */
+	switch (xdrs->x_op) {
+
+	case XDR_DECODE:
+		if (nodesize == 0) {
+			return (TRUE);
+		}
+		if (sp == NULL)
+			*cpp = sp = (char *)mem_alloc(nodesize);
+		if (sp == NULL) {
+			(void) fprintf(stderr, "xdr_string: out of memory\n");
+			return (FALSE);
+		}
+		sp[size] = 0;
+		/* fall into ... */
+
+	case XDR_ENCODE:
+		return (xdr_opaque(xdrs, sp, size));
+
+	case XDR_FREE:
+		mem_free(sp, nodesize);
+		*cpp = NULL;
+		return (TRUE);
+	}
+	return (FALSE);
+}
+
+/* 
+ * Wrapper for xdr_string that can be called directly from 
+ * routines like clnt_call
+ */
+bool_t
+xdr_wrapstring(xdrs, cpp)
+	XDR *xdrs;
+	char **cpp;
+{
+	if (xdr_string(xdrs, cpp, LASTUNSIGNED)) {
+		return (TRUE);
+	}
+	return (FALSE);
+}
diff --git a/mfhdf/xdr/xdr.def b/mfhdf/xdr/xdr.def
new file mode 100644
index 0000000..8694957
--- /dev/null
+++ b/mfhdf/xdr/xdr.def
@@ -0,0 +1,24 @@
+LIBRARY XDR
+EXPORTS
+ xdr_free
+ xdr_void
+ xdr_int
+ xdr_u_int
+ xdr_long
+ xdr_u_long
+ xdr_short
+ xdr_u_short
+ xdr_char
+ xdr_u_char
+ xdr_bool
+ xdr_enum
+ xdr_opaque
+ xdr_bytes
+ xdr_netobj
+ xdr_union
+ xdr_string
+ xdr_wrapstring
+ xdr_array
+ xdr_vector
+ xdr_float
+ xdr_double
\ No newline at end of file
diff --git a/mfhdf/xdr/xdr.h b/mfhdf/xdr/xdr.h
new file mode 100644
index 0000000..2ee293d
--- /dev/null
+++ b/mfhdf/xdr/xdr.h
@@ -0,0 +1,254 @@
+/* @(#)xdr.h	1.1 87/11/04 3.9 RPCSRC */
+/*      @(#)xdr.h 1.19 87/04/22 SMI      */
+/*
+ * xdr.h, External Data Representation Serialization Routines.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+
+#ifndef __XDR_HEADER__
+#define __XDR_HEADER__
+
+#include "H4api_adpt.h"
+/*
+ * XDR provides a conventional way for converting between C data
+ * types and an external bit-string representation.  Library supplied
+ * routines provide for the conversion on built-in C data types.  These
+ * routines and utility routines defined here are used to help implement
+ * a type encode/decode routine for each user-defined type.
+ *
+ * Each data type provides a single procedure which takes two arguments:
+ *
+ *	bool_t
+ *	xdrproc(xdrs, argresp)
+ *		XDR *xdrs;
+ *		<type> *argresp;
+ *
+ * xdrs is an instance of a XDR handle, to which or from which the data
+ * type is to be converted.  argresp is a pointer to the structure to be
+ * converted.  The XDR handle contains an operation field which indicates
+ * which of the operations (ENCODE, DECODE * or FREE) is to be performed.
+ *
+ * XDR_DECODE may allocate space if the pointer argresp is null.  This
+ * data can be freed with the XDR_FREE operation.
+ *
+ * We write only one procedure per data type to make it easy
+ * to keep the encode and decode procedures for a data type consistent.
+ * In many cases the same code performs all operations on a user defined type,
+ * because all the hard work is done in the component type routines.
+ * decode as a series of calls on the nested data types.
+ */
+/*
+ * Xdr operations.  XDR_ENCODE causes the type to be encoded into the
+ * stream.  XDR_DECODE causes the type to be extracted from the stream.
+ * XDR_FREE can be used to release the space allocated by an XDR_DECODE
+ * request.
+ */
+enum xdr_op {
+	XDR_ENCODE=0,
+	XDR_DECODE=1,
+	XDR_FREE=2
+};
+
+/*
+ * This is the number of bytes per unit of external data.
+ */
+#define BYTES_PER_XDR_UNIT	(4)
+#define RNDUP(x)  ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
+		    * BYTES_PER_XDR_UNIT)
+
+/*
+ * A xdrproc_t exists for each data type which is to be encoded or decoded.
+ *
+ * The second argument to the xdrproc_t is a pointer to an opaque pointer.
+ * The opaque pointer generally points to a structure of the data type
+ * to be decoded.  If this pointer is 0, then the type routines should
+ * allocate dynamic storage of the appropriate size and return it.
+ * bool_t	(*xdrproc_t)(XDR *, caddr_t *);
+ */
+typedef	bool_t (*xdrproc_t)();
+
+/*
+ * The XDR handle.
+ * Contains operation which is being applied to the stream,
+ * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
+ * and two private fields for the use of the particular impelementation.
+ */
+typedef struct {
+	enum xdr_op	x_op;		/* operation; fast additional param */
+	struct xdr_ops {
+		bool_t	(*x_getlong)();	/* get a long from underlying stream */
+		bool_t	(*x_putlong)();	/* put a long to " */
+		bool_t	(*x_getbytes)();/* get some bytes from " */
+		bool_t	(*x_putbytes)();/* put some bytes to " */
+		u_long	(*x_getpostn)();/* returns bytes off from beginning */
+		bool_t  (*x_setpostn)();/* lets you reposition the stream */
+		long *	(*x_inline)();	/* buf quick ptr to buffered data */
+		void	(*x_destroy)();	/* free privates of this xdr_stream */
+	} *x_ops;
+	caddr_t 	x_public;	/* users' data */
+	caddr_t		x_private;	/* pointer to private data */
+	caddr_t 	x_base;		/* private used for position info */
+	int		x_handy;	/* extra private word */
+} XDR;
+
+/*
+ * Operations defined on a XDR handle
+ *
+ * XDR		*xdrs;
+ * long		*longp;
+ * caddr_t	 addr;
+ * u_int	 len;
+ * u_int	 pos;
+ */
+#define XDR_GETLONG(xdrs, longp)			\
+	(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
+#define xdr_getlong(xdrs, longp)			\
+	(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
+
+#define XDR_PUTLONG(xdrs, longp)			\
+	(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
+#define xdr_putlong(xdrs, longp)			\
+	(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
+
+#define XDR_GETBYTES(xdrs, addr, len)			\
+	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
+#define xdr_getbytes(xdrs, addr, len)			\
+	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
+
+#define XDR_PUTBYTES(xdrs, addr, len)			\
+	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
+#define xdr_putbytes(xdrs, addr, len)			\
+	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
+
+#define XDR_GETPOS(xdrs)				\
+	(*(xdrs)->x_ops->x_getpostn)(xdrs)
+#define xdr_getpos(xdrs)				\
+	(*(xdrs)->x_ops->x_getpostn)(xdrs)
+
+#define XDR_SETPOS(xdrs, pos)				\
+	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
+#define xdr_setpos(xdrs, pos)				\
+	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
+
+#define	XDR_INLINE(xdrs, len)				\
+	(*(xdrs)->x_ops->x_inline)(xdrs, len)
+#define	xdr_inline(xdrs, len)				\
+	(*(xdrs)->x_ops->x_inline)(xdrs, len)
+
+#define	XDR_DESTROY(xdrs)				\
+	if ((xdrs)->x_ops->x_destroy) 			\
+		(*(xdrs)->x_ops->x_destroy)(xdrs)
+#define	xdr_destroy(xdrs)				\
+	if ((xdrs)->x_ops->x_destroy) 			\
+		(*(xdrs)->x_ops->x_destroy)(xdrs)
+
+/*
+ * Support struct for discriminated unions.
+ * You create an array of xdrdiscrim structures, terminated with
+ * a entry with a null procedure pointer.  The xdr_union routine gets
+ * the discriminant value and then searches the array of structures
+ * for a matching value.  If a match is found the associated xdr routine
+ * is called to handle that part of the union.  If there is
+ * no match, then a default routine may be called.
+ * If there is no match and no default routine it is an error.
+ */
+#define NULL_xdrproc_t ((xdrproc_t)0)
+struct xdr_discrim {
+	int	value;
+	xdrproc_t proc;
+};
+
+/*
+ * In-line routines for fast encode/decode of primitve data types.
+ * Caveat emptor: these use single memory cycles to get the
+ * data from the underlying buffer, and will fail to operate
+ * properly if the data is not aligned.  The standard way to use these
+ * is to say:
+ *	if ((buf = XDR_INLINE(xdrs, count)) == NULL)
+ *		return (FALSE);
+ *	<<< macro calls >>>
+ * where ``count'' is the number of bytes of data occupied
+ * by the primitive data types.
+ *
+ * N.B. and frozen for all time: each data type here uses 4 bytes
+ * of external representation.
+ */
+#define IXDR_GET_LONG(buf)		((long)ntohl((u_long)*(buf)++))
+#define IXDR_PUT_LONG(buf, v)		(*(buf)++ = (long)htonl((u_long)v))
+
+#define IXDR_GET_BOOL(buf)		((bool_t)IXDR_GET_LONG(buf))
+#define IXDR_GET_ENUM(buf, t)		((t)IXDR_GET_LONG(buf))
+#define IXDR_GET_U_LONG(buf)		((u_long)IXDR_GET_LONG(buf))
+#define IXDR_GET_SHORT(buf)		((short)IXDR_GET_LONG(buf))
+#define IXDR_GET_U_SHORT(buf)		((u_short)IXDR_GET_LONG(buf))
+
+#define IXDR_PUT_BOOL(buf, v)		IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_ENUM(buf, v)		IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_U_LONG(buf, v)		IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_SHORT(buf, v)		IXDR_PUT_LONG((buf), ((long)(v)))
+#define IXDR_PUT_U_SHORT(buf, v)	IXDR_PUT_LONG((buf), ((long)(v)))
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * These are the "generic" xdr routines.
+ */
+XDRLIBAPI void     xdr_free(xdrproc_t , char *);
+XDRLIBAPI bool_t	xdr_void(void);
+XDRLIBAPI bool_t	xdr_int(XDR *, int *);
+XDRLIBAPI bool_t	xdr_u_int(XDR *, u_int *);
+XDRLIBAPI bool_t	xdr_long(XDR *, long *);
+XDRLIBAPI bool_t	xdr_u_long(XDR *, u_long *);
+XDRLIBAPI bool_t	xdr_short(XDR *, short *);
+XDRLIBAPI bool_t	xdr_u_short(XDR *, u_short *);
+XDRLIBAPI bool_t	xdr_bool(XDR *, bool_t *);
+XDRLIBAPI bool_t	xdr_enum(XDR *, enum_t *);
+XDRLIBAPI bool_t	xdr_array(XDR *, caddr_t *, u_int *, u_int, u_int, xdrproc_t );
+XDRLIBAPI bool_t	xdr_bytes(XDR *, char **, u_int *, u_int);
+XDRLIBAPI bool_t	xdr_opaque(XDR *, caddr_t , u_int );
+XDRLIBAPI bool_t	xdr_string(XDR *, char **, u_int);
+XDRLIBAPI bool_t	xdr_union(XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t );
+XDRLIBAPI bool_t	xdr_char(XDR *, char *);
+XDRLIBAPI bool_t	xdr_u_char(XDR *, char *);
+XDRLIBAPI bool_t	xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t );
+XDRLIBAPI bool_t	xdr_float(XDR *, float *);
+XDRLIBAPI bool_t	xdr_double(XDR *, double *);
+XDRLIBAPI bool_t	xdr_reference();
+XDRLIBAPI bool_t	xdr_pointer();
+XDRLIBAPI bool_t	xdr_wrapstring(XDR *, char **);
+
+/*
+ * Common opaque bytes objects used by many rpc protocols;
+ * declared here due to commonality.
+ */
+#define MAX_NETOBJ_SZ 1024 
+struct netobj {
+	u_int	n_len;
+	char	*n_bytes;
+};
+typedef struct netobj netobj;
+XDRLIBAPI bool_t   xdr_netobj(XDR *,struct netobj *);
+
+/*
+ * These are the public routines for the various implementations of
+ * xdr streams.
+ */
+XDRLIBAPI void   xdrmem_create();		/* XDR using memory buffers */
+XDRLIBAPI void   xdrstdio_create(XDR *, FILE *, enum xdr_op );	/* XDR using stdio library */
+XDRLIBAPI void   xdrrec_create();		/* XDR pseudo records for tcp */
+XDRLIBAPI bool_t xdrrec_endofrecord();	/* make end of xdr record */
+XDRLIBAPI bool_t xdrrec_skiprecord();	/* move to beginning of next record */
+XDRLIBAPI bool_t xdrrec_eof();		/* true if no more input */
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef HDF
+#include "hdf.h"
+#endif /* HDF */
+
+#endif /* !__XDR_HEADER__ */
diff --git a/mfhdf/xdr/xdrarray.c b/mfhdf/xdr/xdrarray.c
new file mode 100644
index 0000000..efdd221
--- /dev/null
+++ b/mfhdf/xdr/xdrarray.c
@@ -0,0 +1,126 @@
+/* @(#)xdr_array.c	1.1 87/11/04 3.9 RPCSRC */
+#if !defined(lint) && defined(SCCSIDS)
+static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
+#endif
+
+/*
+ * xdr_array.c, Generic XDR routines impelmentation.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * These are the "non-trivial" xdr primitives used to serialize and de-serialize
+ * arrays.  See xdr.h for more info on the interface to xdr.
+ */
+
+#include <stdio.h>
+#include <string.h> /* for memset() */
+
+#include "types.h"
+#include "xdr.h"
+
+#define LASTUNSIGNED	((u_int)0-1)
+
+
+/*
+ * XDR an array of arbitrary elements
+ * *addrp is a pointer to the array, *sizep is the number of elements.
+ * If addrp is NULL (*sizep * elsize) bytes are allocated.
+ * elsize is the size (in bytes) of each element, and elproc is the
+ * xdr procedure to call to handle each element of the array.
+ */
+bool_t
+xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
+	register XDR *xdrs;
+	caddr_t *addrp;		/* array pointer */
+	u_int *sizep;		/* number of elements */
+	u_int maxsize;		/* max numberof elements */
+	u_int elsize;		/* size in bytes of each element */
+	xdrproc_t elproc;	/* xdr routine to handle each element */
+{
+	register u_int i;
+	register caddr_t target = *addrp;
+	register u_int c;  /* the actual element count */
+	register bool_t stat = TRUE;
+	register u_int nodesize;
+
+	/* like strings, arrays are really counted arrays */
+	if (! xdr_u_int(xdrs, sizep)) {
+		return (FALSE);
+	}
+	c = *sizep;
+	if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) {
+		return (FALSE);
+	}
+	nodesize = c * elsize;
+
+	/*
+	 * if we are deserializing, we may need to allocate an array.
+	 * We also save time by checking for a null array if we are freeing.
+	 */
+	if (target == NULL)
+		switch (xdrs->x_op) {
+		case XDR_DECODE:
+			if (c == 0)
+				return (TRUE);
+			*addrp = target = mem_alloc(nodesize);
+			if (target == NULL) {
+				(void) fprintf(stderr, 
+					"xdr_array: out of memory\n");
+				return (FALSE);
+			}
+			(void)memset(target, 0, nodesize);
+			break;
+
+		case XDR_FREE:
+			return (TRUE);
+	}
+	
+	/*
+	 * now we xdr each element of array
+	 */
+	for (i = 0; (i < c) && stat; i++) {
+		stat = (*elproc)(xdrs, target);
+		target += elsize;
+	}
+
+	/*
+	 * the array may need freeing
+	 */
+	if (xdrs->x_op == XDR_FREE) {
+		mem_free(*addrp, nodesize);
+		*addrp = NULL;
+	}
+	return (stat);
+}
+
+/*
+ * xdr_vector():
+ *
+ * XDR a fixed length array. Unlike variable-length arrays,
+ * the storage of fixed length arrays is static and unfreeable.
+ * > basep: base of the array
+ * > size: size of the array
+ * > elemsize: size of each element
+ * > xdr_elem: routine to XDR each element
+ */
+bool_t
+xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
+	register XDR *xdrs;
+	register char *basep;
+	register u_int nelem;
+	register u_int elemsize;
+	register xdrproc_t xdr_elem;	
+{
+	register u_int i;
+	register char *elptr;
+
+	elptr = basep;
+	for (i = 0; i < nelem; i++) {
+		if (! (*xdr_elem)(xdrs, elptr)) {
+			return(FALSE);
+		}
+		elptr += elemsize;
+	}
+	return(TRUE);	
+}
+
diff --git a/mfhdf/xdr/xdrfloat.c b/mfhdf/xdr/xdrfloat.c
new file mode 100644
index 0000000..563c9b3
--- /dev/null
+++ b/mfhdf/xdr/xdrfloat.c
@@ -0,0 +1,301 @@
+/* @(#)xdr_float.c	1.1 87/11/04 3.9 RPCSRC */
+#if !defined(lint) && defined(SCCSIDS)
+static char sccsid[] = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
+#endif
+
+/*
+ * xdr_float.c, Generic XDR routines impelmentation.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * These are the "floating point" xdr routines used to (de)serialize
+ * most common data items.  See xdr.h for more info on the interface to
+ * xdr.
+ */
+
+#include <stdio.h>
+
+
+#include "types.h"
+#include "xdr.h"
+
+#if defined(i386) | defined(__i386)
+#define SWAP_DOUBLES
+#endif
+#ifdef MIPSEL
+#define SWAP_DOUBLES
+#endif
+#ifdef MSDOS
+#define SWAP_DOUBLES
+#endif
+#ifdef __FreeBSD__
+#define SWAP_DOUBLES
+#endif
+#if defined _WIN32 | defined WINNT
+#define SWAP_DOUBLES
+#endif
+
+/*
+ * NB: Not portable.
+ * Only two cases handled here:
+ *	IEEE floating point and Vaxen
+ */
+
+#ifdef vax
+
+/* What IEEE single precision floating point looks like on a Vax */
+struct	ieee_single {
+	unsigned int	mantissa: 23;
+	unsigned int	exp     : 8;
+	unsigned int	sign    : 1;
+};
+
+/* Vax single precision floating point */
+struct	vax_single {
+	unsigned int	mantissa1 : 7;
+	unsigned int	exp       : 8;
+	unsigned int	sign      : 1;
+	unsigned int	mantissa2 : 16;
+};
+
+#define VAX_SNG_BIAS	0x81
+#define IEEE_SNG_BIAS	0x7f
+
+static struct sgl_limits {
+	struct vax_single s;
+	struct ieee_single ieee;
+} max = {
+	{ 0x7f, 0xff, 0x0, 0xffff },	/* Max Vax */
+	{ 0x0, 0xff, 0x0 }		/* Max IEEE */
+};
+static struct sgl_limits min = {
+	{ 0x0, 0x0, 0x0, 0x0 },	/* Min Vax */
+	{ 0x0, 0x0, 0x0 }		/* Min IEEE */
+} ;
+#endif /* vax */
+
+bool_t
+xdr_float(xdrs, fp)
+	register XDR *xdrs;
+	register float *fp;
+{
+#ifdef vax
+	struct ieee_single is;
+	struct vax_single vs, *vsp;
+	struct sgl_limits *lim;
+	int i;
+#endif
+	switch (xdrs->x_op) {
+
+	case XDR_ENCODE:
+#ifndef vax
+		return (XDR_PUTLONG(xdrs, (long *)fp));
+#else
+		vs = *((struct vax_single *)fp);
+
+		switch(vs.exp){
+		case 0 :
+			/* all vax float with zero exponent map to zero */
+			is = min.ieee ;
+			break ;
+		case 2 :
+		case 1 :
+			/* These will map to subnormals */
+			is.exp = 0 ;
+			is.mantissa = (vs.mantissa1 << 16) | vs.mantissa2;
+			/* lose some precision */
+			is.mantissa >>= 3 - vs.exp ;
+			is.mantissa += (1 << (20 + vs.exp)) ;
+			break ;
+		case 0xff : /* max.s.exp */
+			if( vs.mantissa2 == max.s.mantissa2
+				&& vs.mantissa1 == max.s.mantissa1)
+			{
+				/* map largest vax float to ieee infinity */
+				is = max.ieee ;
+				break ;
+			} /* else, fall thru */
+		default :
+			is.exp = vs.exp - VAX_SNG_BIAS + IEEE_SNG_BIAS;
+			is.mantissa = (vs.mantissa1 << 16) | vs.mantissa2;
+		}
+
+		is.sign = vs.sign;
+		return (XDR_PUTLONG(xdrs, (long *)&is));
+#endif
+
+	case XDR_DECODE:
+#ifndef vax
+		return (XDR_GETLONG(xdrs, (long *)fp));
+#else
+		vsp = (struct vax_single *)fp;
+		if (!XDR_GETLONG(xdrs, (long *)&is))
+			return (FALSE);
+
+		switch(is.exp) {
+		case 0 :
+			if(is.mantissa == min.ieee.mantissa)
+			{
+				*vsp = min.s ;
+			} else {
+				unsigned tmp = is.mantissa >> 20 ;
+				if(tmp >= 4) {
+					vsp->exp = 2 ;
+				} else if (tmp >= 2) {
+					vsp->exp = 1 ;
+				} else {
+					*vsp = min.s ;
+					break ;
+				} /* else */
+				tmp = is.mantissa - (1 << (20 + vsp->exp )) ;
+				tmp <<= 3 - vsp->exp ;
+				vsp->mantissa2 = tmp ;
+				vsp->mantissa1 = (tmp >> 16);
+			}
+			break ;
+		case 0xfe :
+		case 0xff :
+			*vsp = max.s ;
+			break ;
+		default :
+			vsp->exp = is.exp - IEEE_SNG_BIAS + VAX_SNG_BIAS;
+			vsp->mantissa2 = is.mantissa;
+			vsp->mantissa1 = (is.mantissa >> 16);
+		}
+
+		vsp->sign = is.sign;
+		return (TRUE);
+#endif
+
+	case XDR_FREE:
+		return (TRUE);
+	}
+	return (FALSE);
+}
+
+/*
+ * This routine works on Suns (Sky / 68000's) and Vaxen.
+ */
+
+#ifdef vax
+/* What IEEE double precision floating point looks like on a Vax */
+struct	ieee_double {
+	unsigned int	mantissa1 : 20;
+	unsigned int	exp       : 11;
+	unsigned int	sign      : 1;
+	unsigned int	mantissa2 : 32;
+};
+
+/* Vax double precision floating point */
+struct  vax_double {
+	unsigned int	mantissa1 : 7;
+	unsigned int	exp       : 8;
+	unsigned int	sign      : 1;
+	unsigned int	mantissa2 : 16;
+	unsigned int	mantissa3 : 16;
+	unsigned int	mantissa4 : 16;
+};
+
+#define VAX_DBL_BIAS	0x81
+#define IEEE_DBL_BIAS	0x3ff
+#define MASK(nbits)	((1 << nbits) - 1)
+
+static struct dbl_limits {
+	struct	vax_double d;
+	struct	ieee_double ieee;
+} dbl_limits[2] = {
+	{{ 0x7f, 0xff, 0x0, 0xffff, 0xffff, 0xffff },	/* Max Vax */
+	{ 0x0, 0x7ff, 0x0, 0x0 }},			/* Max IEEE */
+	{{ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},		/* Min Vax */
+	{ 0x0, 0x0, 0x0, 0x0 }}				/* Min IEEE */
+};
+
+#endif /* vax */
+
+
+bool_t
+xdr_double(xdrs, dp)
+	register XDR *xdrs;
+	double *dp;
+{
+	register long *lp;
+#ifdef vax
+	struct	ieee_double id;
+	struct	vax_double vd;
+	register struct dbl_limits *lim;
+	int i;
+#endif
+
+	switch (xdrs->x_op) {
+
+	case XDR_ENCODE:
+#ifndef vax
+		lp = (long *)dp;
+#else
+		vd = *((struct vax_double *)dp);
+		for (i = 0, lim = dbl_limits;
+			i < sizeof(dbl_limits)/sizeof(struct dbl_limits);
+			i++, lim++) {
+			if ((vd.mantissa4 == lim->d.mantissa4) &&
+				(vd.mantissa3 == lim->d.mantissa3) &&
+				(vd.mantissa2 == lim->d.mantissa2) &&
+				(vd.mantissa1 == lim->d.mantissa1) &&
+				(vd.exp == lim->d.exp)) {
+				id = lim->ieee;
+				goto shipit;
+			}
+		}
+		id.exp = vd.exp - VAX_DBL_BIAS + IEEE_DBL_BIAS;
+		id.mantissa1 = (vd.mantissa1 << 13) | (vd.mantissa2 >> 3);
+		id.mantissa2 = ((vd.mantissa2 & MASK(3)) << 29) |
+				(vd.mantissa3 << 13) |
+				((vd.mantissa4 >> 3) & MASK(13));
+	shipit:
+		id.sign = vd.sign;
+		lp = (long *)&id;
+#endif
+#ifndef SWAP_DOUBLES
+		return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp));
+#else /* SWAP_DOUBLES */
+		return (XDR_PUTLONG(xdrs, lp+1) && XDR_PUTLONG(xdrs, lp));
+#endif /* SWAP_DOUBLES */
+
+	case XDR_DECODE:
+#ifndef vax
+		lp = (long *)dp;
+#ifndef SWAP_DOUBLES
+		return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp));
+#else /* SWAP_DOUBLES */
+		return (XDR_GETLONG(xdrs, lp+1) && XDR_GETLONG(xdrs, lp));
+#endif /* SWAP_DOUBLES */
+#else
+		lp = (long *)&id;
+		if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))
+			return (FALSE);
+		for (i = 0, lim = dbl_limits;
+			i < sizeof(dbl_limits)/sizeof(struct dbl_limits);
+			i++, lim++) {
+			if ((id.mantissa2 == lim->ieee.mantissa2) &&
+				(id.mantissa1 == lim->ieee.mantissa1) &&
+				(id.exp == lim->ieee.exp)) {
+				vd = lim->d;
+				goto doneit;
+			}
+		}
+		vd.exp = id.exp - IEEE_DBL_BIAS + VAX_DBL_BIAS;
+		vd.mantissa1 = (id.mantissa1 >> 13);
+		vd.mantissa2 = ((id.mantissa1 & MASK(13)) << 3) |
+				(id.mantissa2 >> 29);
+		vd.mantissa3 = (id.mantissa2 >> 13);
+		vd.mantissa4 = (id.mantissa2 << 3);
+	doneit:
+		vd.sign = id.sign;
+		*dp = *((double *)&vd);
+		return (TRUE);
+#endif
+
+	case XDR_FREE:
+		return (TRUE);
+	}
+	return (FALSE);
+}
diff --git a/mfhdf/xdr/xdrlib.project.hqx b/mfhdf/xdr/xdrlib.project.hqx
new file mode 100644
index 0000000..492a3b1
--- /dev/null
+++ b/mfhdf/xdr/xdrlib.project.hqx
@@ -0,0 +1,2016 @@
+(This file must be converted with BinHex 4.0)
+
+:$RKNFQaTBLj`FQpUC at 0d!%e08(*$9dP&!!!!!APK!!!!!)T,Bfp[E!!!!!)!!!!
+S!!&VJ`!"DkX!!!ff!!!!K`%!!!!!!!!!!!!!!!!&!3$rr`!!!!!!!!!!rrm"!3%
+"!3!!!!!H!3%!!!!!!!!!!*QC!!!rrcrr2rm!!3!*"Ne[EQ&ME`!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!%!#J!#J(#!S!!+!!+!F)#J!!!!!!!!!!!!!!!!!!
+!!!!"!!!"!*8"EJ(#!Zi!!`!$X+N!!2i%!!!!)J!!!*X!!!#F!!!!R3!!!*i!!!#
+A!!!!QJ!!!*m!!!#J!!!!S3!!!*B!!!#C!!!!SJ!!!+-!!!#N!!!!T3!!!+B!!!#
+R!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!!#ifF(*PCJ!6m`N!!!$I!!!!!!!!!!!((3!!!!4`FQ9Q!"051`!!!1!
+!!!!!!!!!!!FK!!!!'("bC at B!%q*3!!!!i3!!!!!!!!!!"cN!!!!+F(*PCJ!81l!
+!!!$L!!!!!!!!!!!(3`!!!!j`FQ9Q!"2p&`!!!1-!!!!!!!!!!!G4!!!!aR"bC at B
+!%e81!!!!j!!!!!!!!!!!#"F!!!!iF(*PCJ!6EhS!!!$P!!!!!!!!!!!)6`!!!!a
+`FQ9Q!"3B'3!!!1B!!!!!!!!!!!dD!!!"fR"bC at B!&$am!!!!j`!!!!!!!!!!#,)
+!!!!-F(*PCJ!81kS!!!$S!!!!!!!!!!!A6`!!!'*`FQ9Q!"0*I!!!!1N!!!!!!!!
+!!"Ha!!!!1("bC at B!%kC"!!!!kJ!!!!!!!!!!#,i!!!!0F(*PCJ!82-m!!!$V!!!
+!!!!!!!!1p!!!!"4`FQ9Q!"0-[3!!!1`!!!!!!!!!!!M,!!!!#R"bC at B!&!b2!!!
+!l3!!!!!!!!!!)AN!!!$%F(*PCJ!6N!#3!!!!!1i!!!!!!!!!!#)p!!!"&R"bC at B
+!%r$4!!!!l`!!!!!!!!!!+U-!!!#kF(*PCJ!82Bd!!!$`!!!!!!!!!!!4j3!!!#j
+`FQ9Q!"2iZ3!!!2%!!!!!!!!!!#YG!!!#$("bC at B!&$eG!!!!mJ!!+8i!!!:
diff --git a/mfhdf/xdr/xdrstdio.c b/mfhdf/xdr/xdrstdio.c
new file mode 100644
index 0000000..3c0d4fc
--- /dev/null
+++ b/mfhdf/xdr/xdrstdio.c
@@ -0,0 +1,176 @@
+/* @(#)xdr_stdio.c  1.1 87/11/04 3.9 RPCSRC */
+#if !defined(lint) && defined(SCCSIDS)
+static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
+#endif
+
+/*
+ * xdr_stdio.c, XDR implementation on standard i/o file.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * This set of routines implements a XDR on a stdio stream.
+ * XDR_ENCODE serializes onto the stream, XDR_DECODE de-serializes
+ * from the stream.
+ */
+
+#include <stdio.h>
+#include "types.h"
+#if !(defined MSDOS || defined WINNT || defined _WIN32)
+#        include <netinet/in.h>     /* for htonl() */
+#else
+#     if !(defined WINNT) & !defined _WIN32
+           extern long ntohl(long i_in);
+           extern long htonl(long i_in);
+           extern short ntohs(short i_in);
+           extern short htons(short i_in);
+#      else
+#          include <winsock.h>
+#      endif /* WINNT */
+#endif
+#include "xdr.h"
+
+static bool_t   xdrstdio_getlong(XDR *, long *);
+static bool_t   xdrstdio_putlong(XDR *, long *);
+static bool_t   xdrstdio_getbytes(XDR *, caddr_t, u_int );
+static bool_t   xdrstdio_putbytes(XDR *, caddr_t, u_int );
+static u_long   xdrstdio_getpos(XDR *);
+static bool_t   xdrstdio_setpos(XDR *, u_long);
+static long *   xdrstdio_inline(XDR *, u_int);
+static void xdrstdio_destroy(XDR *);
+
+/*
+ * Ops vector for stdio type XDR
+ */
+static struct xdr_ops   xdrstdio_ops = {
+    xdrstdio_getlong,   /* deseraialize a long int */
+    xdrstdio_putlong,   /* seraialize a long int */
+    xdrstdio_getbytes,  /* deserialize counted bytes */
+    xdrstdio_putbytes,  /* serialize counted bytes */
+    xdrstdio_getpos,    /* get offset in the stream */
+    xdrstdio_setpos,    /* set offset in the stream */
+    xdrstdio_inline,    /* prime stream for inline macros */
+    xdrstdio_destroy    /* destroy stream */
+};
+
+/*
+ * Initialize a stdio xdr stream.
+ * Sets the xdr stream handle xdrs for use on the stream file.
+ * Operation flag is set to op.
+ */
+void
+xdrstdio_create(xdrs, file, op)
+    register XDR *xdrs;
+    FILE *file;
+    enum xdr_op op;
+{
+
+    xdrs->x_op = op;
+    xdrs->x_ops = &xdrstdio_ops;
+    xdrs->x_private = (caddr_t)file;
+    xdrs->x_handy = 0;
+    xdrs->x_base = 0;
+}
+
+/*
+ * Destroy a stdio xdr stream.
+ * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
+ */
+static void
+xdrstdio_destroy(xdrs)
+    register XDR *xdrs;
+{
+    (void)fflush((FILE *)xdrs->x_private);
+    /* xx should we close the file ?? */
+}
+
+static bool_t
+xdrstdio_getlong(xdrs, lp)
+    XDR *xdrs;
+    register long *lp;
+{
+    if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+	return (FALSE);
+
+#ifndef mc68000
+    *lp = ntohl(*lp);
+#endif
+    return (TRUE);
+}
+
+static bool_t
+xdrstdio_putlong(xdrs, lp)
+    XDR *xdrs;
+    long *lp;
+{
+
+#ifndef mc68000
+    long mycopy = htonl(*lp);
+    lp = &mycopy;
+#endif
+
+    if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+	return (FALSE);
+
+    return (TRUE);
+}
+
+static bool_t
+xdrstdio_getbytes(xdrs, addr, len)
+    XDR *xdrs;
+    caddr_t addr;
+    u_int len;
+{
+
+    if ((len != 0) && (fread(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
+        return (FALSE);
+    return (TRUE);
+}
+
+static bool_t
+xdrstdio_putbytes(xdrs, addr, len)
+    XDR *xdrs;
+    caddr_t addr;
+    u_int len;
+{
+
+    if ((len != 0) && (fwrite(addr, (int)len, 1, (FILE *)xdrs->x_private) != 1))
+        return (FALSE);
+    return (TRUE);
+}
+
+static u_long
+xdrstdio_getpos(xdrs)
+    XDR *xdrs;
+{
+
+    return ((u_long)ftell((FILE *)xdrs->x_private));
+}
+
+static bool_t
+xdrstdio_setpos(xdrs, pos) 
+    XDR *xdrs;
+    u_long pos;
+{ 
+
+    return ((fseek((FILE *)xdrs->x_private,(long)pos, 0) < 0) ?
+        FALSE : TRUE);
+}
+
+/*ARGSUSED*/
+static long *
+xdrstdio_inline(xdrs, len)
+    XDR *xdrs;
+    u_int len;
+{
+
+    /*
+     * Must do some work to implement this: must insure
+     * enough data in the underlying stdio buffer,
+     * that the buffer is aligned so that we can indirect through a
+     * long *, and stuff this pointer in xdrs->x_buf.  Doing
+     * a fread or fwrite to a scratch buffer would defeat
+     * most of the gains to be had here and require storage
+     * management on this buffer, so we don't do this.
+     */
+    return (NULL);
+}
diff --git a/mfhdf/xdr/xdrtest.c b/mfhdf/xdr/xdrtest.c
new file mode 100644
index 0000000..1a393cf
--- /dev/null
+++ b/mfhdf/xdr/xdrtest.c
@@ -0,0 +1,375 @@
+/*
+ * 	Copyright 1988, University Corporation for Atmospheric Research
+ *		Not for Resale. All copies to include this notice.
+ */
+
+/*
+ * This program tests only the xdr library functionality required by netCDF.
+ *  'xdr_vector' is not used by the netCDF, it is used here for convenience.
+ */
+#include <stdio.h>
+#include <sys/types.h>	/* for <netinet/in.h> on some systems */
+#if !defined MSDOS & !defined _WIN32
+#include <netinet/in.h>	/* for htonl() */
+#endif
+
+/*
+ * The following is necessary because the assert() macro *must* be defined
+ * for the proper operation of this program.
+ */
+#undef NDEBUG
+
+#if 0
+#define NDEBUG
+# ifndef NDEBUG
+# define _assert(ex)	{if (!(ex)){(void)fprintf(stderr,"Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);exit(1);}}
+# define assert(ex)	_assert(ex)
+# else
+# define _assert(ex)	ex
+# define assert(ex)	ex
+# endif
+#else
+#include <assert.h>
+#endif
+
+#include <types.h>
+#ifndef    NO_SYS_XDR_INC
+#include <xdr.h>
+#else
+#include "xdr.h"
+#endif
+
+#define TESTFILE "test.xdr"
+/* if this is NOT defined, then the program just reads the file */
+#define CREATE
+
+#ifdef __FreeBSD__
+#define EPSILON .005
+#else /* __FreeBSD__ */
+#define EPSILON .0005
+#endif /* __FreeBSD__ */
+
+int main(ac,av)
+int ac ;
+char *av[] ;
+{
+	int ii ;
+	const char *fname ;
+	FILE *F ;
+	XDR xdrs[1] ;
+	u_int count ;
+	u_int szof ;
+
+	/* some random numbers, divisible by 4 and less than 32k */
+	static u_int seeks[] = 
+	{
+		   16828 ,
+		    8448 ,
+		   20632 ,
+		    8124 ,
+		   16764 ,
+		   17232 ,
+		    3476 ,
+		   28168 , /* +(5 * sizeof(double) + (5 * sizeof(enum) */
+		   /* */
+		   28108 ,
+		   16796 ,
+		   10968 ,
+		   24104 ,
+		   30560 ,
+		   16880 ,
+		   17260 ,
+		   12556 ,
+	} ;
+
+	u_int poses[9] ;
+	int jj = 0 ;
+
+	static char text[32] ={ "Hiya sailor. New in town?" };
+	char got_s[32] ;
+
+	static unsigned char bytes[8] = { 254, 255, 0, 1, 2} ;
+	unsigned char *bp , got_ab[8] ;
+
+	static int ints[5] = { 5, 6, 7, 8, 9} ;
+	int *ip , got_ip[5] ;
+
+	static unsigned int u_ints[5] = {
+		((unsigned)65535),
+		((unsigned)65534),
+		((unsigned)0),
+		((unsigned)1),
+		((unsigned)2)
+	} ;
+	int *uip , got_uip[5] ;
+
+	long lnum = 82555 ;
+
+	static long longs[5] = { -4, -3, -2, -1, 0} ;
+	long *lp , got_al[5] ;
+
+	static unsigned long u_longs[5] = {
+		((unsigned)65535),
+		((unsigned)65534),
+		((unsigned)0),
+		((unsigned)1),
+		((unsigned)2)
+	} ;
+	long *ulp , got_aul[5] ;
+
+	static float floats[5] = { 100.125, 100.25, 100.375, 100.5, 100.625 } ;
+	float *fp , got_af[5] ;
+
+	/* These all require 25 bits: 2^(25-i)+1/2^i, i = 2, 3, ..., 6 */
+	static double doubles[5] = { 8388608.25, 4194304.125, 2097152.0625,
+				       1048576.03125, 524288.015625 } ;
+
+	double *dp , got_ad[5] ;
+
+	typedef enum {ZERO_E, ONE_E, TWO_E, THREE_E, FOUR_E} encount ;
+	static encount encounts[5] = {ZERO_E, ONE_E, TWO_E, THREE_E, FOUR_E} ;
+	encount *ep , got_ep[5] ;
+
+
+#ifdef MDEBUG
+	malloc_debug(2) ;
+#endif
+	fname = TESTFILE ;
+	if(ac > 1)
+	{
+		fname = av[1] ;
+	} 
+#ifdef CREATE
+/* Create */
+
+#ifdef __STDC__
+	F = fopen(fname,"wb") ;
+#else
+	F = fopen(fname,"w") ;
+#endif
+	if( F == NULL)
+	{
+		perror("fopen failed") ;
+		exit(-1) ;
+	}
+
+	/* fill the file so seeks will work even on non-virtual machines */
+	for(ii=0 ; ii< 28227 ; ii++)
+	{
+		assert( putc(0, F) != EOF ) ;
+	}
+
+	xdrstdio_create(xdrs, F, XDR_ENCODE) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	assert( xdr_opaque(xdrs, text, sizeof(text))) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	assert( xdr_opaque(xdrs, (caddr_t)bytes, sizeof(bytes))) ;
+
+	/* no setpos, just for variety */
+	szof = sizeof(int) ;
+	count = sizeof(ints)/sizeof(int) ;
+	assert( xdr_vector(xdrs, (char *)ints, count, szof, xdr_int)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(unsigned int) ;
+	count = sizeof(u_ints)/sizeof(unsigned int) ;
+	assert( xdr_vector(xdrs, (char *)u_ints, count, szof, xdr_u_int)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	assert( xdr_long(xdrs, &lnum)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(long) ;
+	count = sizeof(longs)/sizeof(long) ;
+	assert( xdr_vector(xdrs, (char *)longs, count, szof, xdr_long)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(unsigned long) ;
+	count = sizeof(u_longs)/sizeof(unsigned long) ;
+	assert( xdr_vector(xdrs, (char *)u_longs, count, szof, xdr_u_long)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(float) ;
+	count = sizeof(floats)/sizeof(float) ;
+	assert( xdr_vector(xdrs, (char *)floats, count, szof, xdr_float)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(double) ;
+	count = sizeof(doubles)/sizeof(double) ;
+	assert( xdr_vector(xdrs, (char *)doubles, count, szof, xdr_double)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+	/* again no setpos  */
+	szof = sizeof(encount) ;
+	count = sizeof(encounts)/sizeof(encount) ;
+	assert( xdr_vector(xdrs, (char *)encounts, count, szof, xdr_enum)) ;
+	poses[jj++] = xdr_getpos(xdrs) ;
+
+#if 0
+	/* stdio performance check */
+	count = 8192 ;
+	for( lnum = 0 ; lnum < count ; lnum++)
+	{
+		assert( xdr_long(xdrs, &lnum) ) ;
+	}
+#endif
+
+/* flush, rewind  and reopen */
+
+	assert(fflush((FILE *)xdrs->x_private) != EOF) ; /* xdr_destroy(xdrs) */
+
+	assert(fclose(F) != EOF) ;
+#endif /* CREATE */
+#ifdef __STDC__
+	F = fopen(fname,"rb") ;
+#else
+	F = fopen(fname,"r") ;
+#endif
+	if( F == NULL)
+	{
+		perror("fopen failed") ;
+		exit(-1) ;
+	}
+	xdrstdio_create(xdrs, F, XDR_DECODE) ;
+
+	jj = 0 ;
+
+/* check contents */
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	assert( xdr_opaque(xdrs, got_s, sizeof(text))) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("string: %s\n", got_s) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	assert( xdr_opaque(xdrs, (caddr_t)got_ab, sizeof(bytes))) ;
+	printf("unsigned bytes: ");
+	for(ii = 0, bp = got_ab ;
+			ii < sizeof(bytes) ; ii++, bp++)
+	{
+		printf("%u ", *bp) ;
+		assert( *bp == bytes[ii] ) ;
+	}
+	putchar('\n') ;
+
+	szof = sizeof(int) ;
+	count = sizeof(ints)/sizeof(int) ;
+	assert( xdr_vector(xdrs, (char *)got_ip, count, szof, xdr_int)) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("ints: ");
+	for(ii = 0, ip = got_ip ;
+			ii < (int)count ; ii++, ip++)
+	{
+		printf("%d ", *ip) ;
+		assert( *ip == ints[ii] ) ;
+	}
+	putchar('\n') ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(unsigned int) ;
+	count = sizeof(u_ints)/sizeof(unsigned int) ;
+	assert( xdr_vector(xdrs, (char *)got_uip, count, szof, xdr_u_int)) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("unsigned ints: ");
+	for(ii = 0, uip = got_uip ;
+			ii < (int)count ; ii++, uip++)
+	{
+		printf("%u ", *uip) ;
+		assert( *uip == u_ints[ii] ) ;
+	}
+	putchar('\n') ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	assert( xdr_long(xdrs, got_al)) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("LONG: %ld\n", *got_al) ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(long) ;
+	count = sizeof(longs)/sizeof(long) ;
+	assert( xdr_vector(xdrs, (char *)got_al, count, szof, xdr_long)) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("longs: ");
+	for(ii = 0, lp = got_al ;
+			ii < (int)count ; ii++, lp++)
+	{
+		printf("%ld ", got_al[ii]) ;
+		assert( got_al[ii] == longs[ii] ) ;
+	}
+	putchar('\n') ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(unsigned long) ;
+	count = sizeof(u_longs)/sizeof(unsigned long) ;
+	assert( xdr_vector(xdrs, (char *)got_aul, count, szof, xdr_u_long)) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("unsigned longs: ");
+	for(ii = 0, ulp = got_aul ;
+			ii < (int)count ; ii++, ulp++)
+	{
+		printf("%lu ", *ulp) ;
+		assert( *ulp == u_longs[ii] ) ;
+	}
+	putchar('\n') ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(float) ;
+	count = sizeof(floats)/sizeof(float) ;
+	assert( xdr_vector(xdrs, (char *)got_af, count, szof, xdr_float)) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("floats:\n");
+	for(ii = 0, fp = got_af ;
+			ii < (int)count ; ii++, fp++)
+	{
+		printf("\t% .6e\n", *fp) ;
+		assert( *fp < floats[ii] + EPSILON &&  *fp > floats[ii] - EPSILON ) ;
+	}
+	putchar('\n') ;
+
+	assert( xdr_setpos(xdrs, seeks[jj])) ;
+	szof = sizeof(double) ;
+	count = sizeof(doubles)/sizeof(double) ;
+	assert( xdr_vector(xdrs, (char *)got_ad, count, szof, xdr_double)) ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	printf("doubles:\n");
+	for(ii = 0, dp = got_ad ;
+			ii < (int)count ; ii++, dp++)
+	{
+		printf("\t% .12e\n", *dp) ;
+		assert( (*dp < doubles[ii] + EPSILON) && (*dp > doubles[ii] - EPSILON )) ;
+	}
+	putchar('\n') ;
+
+	szof = sizeof(encount) ;
+	count = sizeof(encounts)/sizeof(encount) ;
+	assert( xdr_vector(xdrs, (char *)got_ep, count, szof, xdr_enum)) ;
+	printf("enums: ");
+	for(ii = 0, ep = got_ep ;
+			ii < (int)count ; ii++, ep++)
+	{
+		printf("%d ", (int)*ep) ;
+		assert( *ep == encounts[ii] ) ;
+	}
+	putchar('\n') ;
+	assert( poses[jj++] = xdr_getpos(xdrs) ) ;
+	
+#if 0
+	/* stdio performance check */
+	count = 8192 ;
+	for( ii = 0 ; ii < count ; ii++)
+	{
+		assert( xdr_long(xdrs, got_al) ) ;
+		assert( *got_al == ii ) ;
+	}
+#endif
+	exit(0) ;
+}
diff --git a/mfhdf/xdr/xdrtest.cyg b/mfhdf/xdr/xdrtest.cyg
new file mode 100644
index 0000000..474fdf1
--- /dev/null
+++ b/mfhdf/xdr/xdrtest.cyg
@@ -0,0 +1,22 @@
+string: Hiya sailor. New in town?
+unsigned bytes: 254 255 0 1 2 0 0 0 
+ints: 5 6 7 8 9 
+unsigned ints: 65535 65534 0 1 2 
+LONG: 82555
+longs: -4 -3 -2 -1 0 
+unsigned longs: 65535 65534 0 1 2 
+floats:
+	 1.001250e+02
+	 1.002500e+02
+	 1.003750e+02
+	 1.005000e+02
+	 1.006250e+02
+
+doubles:
+	 8.388608250000e+06
+	 4.194304125000e+06
+	 2.097152062500e+06
+	 1.048576031250e+06
+	 5.242880156250e+05
+
+enums: 0 1 2 3 4 
diff --git a/mfhdf/xdr/xdrtest.mak b/mfhdf/xdr/xdrtest.mak
new file mode 100644
index 0000000..974f92f
--- /dev/null
+++ b/mfhdf/xdr/xdrtest.mak
@@ -0,0 +1,149 @@
+# Microsoft Visual C++ Generated NMAKE File, Format Version 2.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+!IF "$(CFG)" == ""
+CFG=Win32 Debug
+!MESSAGE No configuration specified.  Defaulting to Win32 Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "Win32 Release" && "$(CFG)" != "Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line.  For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "xdrtest.mak" CFG="Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+################################################################################
+# Begin Project
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "WinRel"
+# PROP BASE Intermediate_Dir "WinRel"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : $(OUTDIR)/xdrtest.exe $(OUTDIR)/xdrtest.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /YX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\
+ /Fo$(INTDIR)/ /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"xdrtest.bsc" 
+
+$(OUTDIR)/xdrtest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/xdrtest.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib win32xdr.lib /NOLOGO /SUBSYSTEM:console /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib win32xdr.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:no\
+ /PDB:$(OUTDIR)/"xdrtest.pdb" /MACHINE:I386 /OUT:$(OUTDIR)/"xdrtest.exe" 
+
+$(OUTDIR)/xdrtest.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "WinDebug"
+# PROP BASE Intermediate_Dir "WinDebug"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+OUTDIR=.
+INTDIR=.
+
+ALL : $(OUTDIR)/xdrtest.exe $(OUTDIR)/xdrtest.bsc
+
+# ADD BASE CPP /nologo /ML /W3 /GX /Zi /YX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /c
+# ADD CPP /nologo /ML /W3 /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c
+# SUBTRACT CPP /YX /Fr
+CPP_PROJ=/nologo /ML /W3 /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D\
+ "_CONSOLE" /Fo$(INTDIR)/ /Fd$(OUTDIR)/"xdrtest.pdb" /c 
+CPP_OBJS=
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+BSC32_SBRS= \
+	
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o$(OUTDIR)/"xdrtest.bsc" 
+
+$(OUTDIR)/xdrtest.bsc : $(OUTDIR)  $(BSC32_SBRS)
+LINK32=link.exe
+DEF_FILE=
+LINK32_OBJS= \
+	$(INTDIR)/xdrtest.obj
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib win32xdr.lib /NOLOGO /SUBSYSTEM:console /DEBUG /MACHINE:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib win32xdr.lib /NOLOGO /SUBSYSTEM:console /INCREMENTAL:yes\
+ /PDB:$(OUTDIR)/"xdrtest.pdb" /DEBUG /MACHINE:I386 /OUT:$(OUTDIR)/"xdrtest.exe" 
+
+$(OUTDIR)/xdrtest.exe : $(OUTDIR)  $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cpp{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+.cxx{$(CPP_OBJS)}.obj:
+   $(CPP) $(CPP_PROJ) $<  
+
+################################################################################
+# Begin Group "Source Files"
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\xdrtest.c
+
+$(INTDIR)/xdrtest.obj :  $(SOURCE)  $(INTDIR)
+
+# End Source File
+# End Group
+# End Project
+################################################################################
diff --git a/mfhdf/xdr/xdrtest.opt b/mfhdf/xdr/xdrtest.opt
new file mode 100644
index 0000000..d2ce356
--- /dev/null
+++ b/mfhdf/xdr/xdrtest.opt
@@ -0,0 +1 @@
+sys$library:vaxcrtl.exe/share
diff --git a/mfhdf/xdr/xdrtest.out b/mfhdf/xdr/xdrtest.out
new file mode 100644
index 0000000..6655528
--- /dev/null
+++ b/mfhdf/xdr/xdrtest.out
@@ -0,0 +1,22 @@
+string: Hiya sailor. New in town?
+unsigned bytes: 254 255 0 1 2 0 0 0 
+ints: 5 6 7 8 9 
+unsigned ints: 65535 65534 0 1 2 
+LONG: 82555
+longs: -4 -3 -2 -1 0 
+unsigned longs: 65535 65534 0 1 2 
+floats:
+	 1.001250e+002
+	 1.002500e+002
+	 1.003750e+002
+	 1.005000e+002
+	 1.006250e+002
+
+doubles:
+	 8.388608250000e+006
+	 4.194304125000e+006
+	 2.097152062500e+006
+	 1.048576031250e+006
+	 5.242880156250e+005
+
+enums: 0 1 2 3 4 
diff --git a/mfhdf/xdr/xdrtest.project.hqx b/mfhdf/xdr/xdrtest.project.hqx
new file mode 100644
index 0000000..8149d29
--- /dev/null
+++ b/mfhdf/xdr/xdrtest.project.hqx
@@ -0,0 +1,515 @@
+(This file must be converted with BinHex 4.0)
+
+:$hKNFR4PFh3ZF(*[DQ9MG!"069"b3eG*43!!!!"IjJ!!!!","Q0[Ef`!!!!#!!!
+!+!!!@T!!!!"DZ!!!"5i!!!!c!3!!!!!!!!!!!!!!!!)!!!!$&,F!!J!!!!!!!!!
+#"h"KBfYKCf8!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!,F'&MDf&RC5jcH at d!!!!
+!!!!!!!!!!!!!!!!!!!!!!!e6HA0dC at e$E'&cFf9c!!!!!!!!!!!!!!!!!!!!!!!
+!!!8"!2rr!!!!!!!!!!$rr`%"!3%"!!!!!"i"!3!!!!!!!!!!QCN!!$rr2rmrr`!
+"!!N'6 at pZB@0[!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!3!+!!+!F)#J!!
+S!!S"`J+!!!!!!!!!!!!!!!!!!!!!!!%!!!%!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!)"!!!$!!-!!3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!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Q9Q!!23Y3!!!#d!!!!!!!!!!#cU!!!!$("bC at B!!l-F!!!!,J!!!!!!!!!
+!0Lm!!!(DF(*PCJ!%HR8!!!![!!!!!!!!!!!XpJ!!!!a`FQ9Q!!2h5!!!!$!!!!!
+!!!!!!$J*!!!!BR"bC at B!!pd3!!!!-3!!!!!!!!!!1'X!!!!iF(*PCJ!%Fp-!!!!
+b!!!!!!!!!!!Y!J!!!!e`FQ9Q!!4lPJ!!!$-!!!!!!!!!!#d2!!!!&("bC at B!"!P
+3!!!!0!!!!!!!!!!!,Ed!!!!+F(*PCJ!%Sl`!!!!e!!!!!!!!!!!iS`!!!-4`FQ9
+Q!!2VeJ!!!$B!!!!!!!!!!$PR!!!"&R"bC at B!"(Yr!!!!0`!!!!!!!!!!1Rd!!!#
+kF(*PCJ!%,[8!!!!i!!!!!!!!!!!l0`!!!#j`FQ9Q!!3mI!!!!$N!!!!!!!!!!&I
++!!!#$("bC at B!"$b8!!!!1J!!jTN!!!:
diff --git a/move-if-change b/move-if-change
new file mode 100755
index 0000000..ee9e355
--- /dev/null
+++ b/move-if-change
@@ -0,0 +1,15 @@
+#!/bin/sh
+if
+test -r $2
+then
+if
+cmp $1 $2 > /dev/null
+then
+echo $2 is unchanged
+rm -f $1
+else
+mv -f $1 $2
+fi
+else
+mv -f $1 $2
+fi
diff --git a/release_notes/HISTORY.txt b/release_notes/HISTORY.txt
new file mode 100644
index 0000000..0a1e96a
--- /dev/null
+++ b/release_notes/HISTORY.txt
@@ -0,0 +1,5321 @@
+==========================================================================
+=                                                                        =
+=       This files conatins a history of the HDF4.* releases.            =
+=                                                                        =
+=       To find information about a particular release search            =
+=       for %%%4.#.# string, for example 4.2.6, or                       =
+=       for %%%4.#r# string, for example 4.1r2, prior to 2010.           =
+=       List of all releases is at the top of this file.                 =
+=                                                                        =
+=       Documents in this file refer to several *.txt files that were    =
+=       originally stored in the release_notes directory of the HDF4     =
+=       source tree. Those file are now combined into one misc_docs.txt  =
+=       file in the same directory.                                      =
+=                                                                        =
+==========================================================================    
+
+List of the HDF4 releases
+
+4.2.9          February	 2013
+4.2.8          August	 2012
+4.2.7          February	 2012
+4.2.6          June	 2011
+4.2.5          February  2010
+4.2r4          January   2009
+4.2r3          January   2008
+4.2r2          October   2007
+4.2r1          February  2005
+4.2r0          December  2003
+4.2r0-Beta     September 2003
+4.1r5          November  2001
+4.1r4          October   2000
+4.1r3          May       1999
+4.1r2          March     1998 
+4.1r1          February  1997
+4.1b1          December  1996 
+4.0r2          July      1996 
+4.0r1          February  1996
+4.0b2          November  1995
+4.0b1          July      1995 
+4.0.alpha      November  1994
+
+
+==========================================================================    
+
+%%%4.2.9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+HDF version 4.2.9 released on 2013-02-07
+=============================================
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2.8 and HDF 4.2.9.
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2.9.
+
+The HDF 4.2.9 documentation can be found on the The HDF Group's website
+at:
+    http://www.hdfgroup.org/doc.html
+
+Previous versions of the documentation are available from the FTP server:
+
+    ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+    http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+    http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Configuration
+- Support for new platforms and compilers
+- Bugs fixed since HDF 4.2.8
+  -- Configuration
+  -- Library
+  -- Utilities
+- Documentation
+- Platforms tested
+- Known problems
+
+
+New features and changes
+========================
+   Configuration
+   ============= 
+   - The macro H4_NO_DEPRECATED_SYMBOLS was added to handle deprecated
+     functions/features.  To use deprecated functions/features, the library
+     must be configured with option HDF4_ENABLE_DEPRECATED_SYMBOLS.
+     (ADB, BMR 2013/1/25)
+     
+
+Support for new platforms and compilers
+=======================================
+   - Ported to Mac OSX 10.8 (Mountain Lion) with Clang as the default C
+     compiler. (AKC 2013/1/19)
+
+   - Ported to Mac OSX 10.8 (Mountain Lion) with Intel compilers.
+               (EIP 2013/02/05)
+
+Bugs fixed since HDF 4.2.8
+=========================
+   Configuration
+   =============
+   - Cygwin >= 1.7.7; The SunRPC of the glibc has been replaced by a TI-RPC 
+     (Transport Independent RPC) library to support IPv6. Configure has been 
+     updated to look for the tirpc library instead of rpc. (ADB 2012/11/09)
+
+   Library
+   ========= 
+   - SDgetcompress is now deprecated and not available by default.  Its
+     availability can be activated using option HDF4_ENABLE_DEPRECATED_SYMBOLS.
+     (BMR 2012/1/25)
+   - Some memory leaks were fixed. (BMR 2012/10/01)
+
+   Utilities
+   ========= 
+   - Vnattrs/Vattrinfo/Vgetattr are replaced with Vnattrs2/Vattrinfo2/Vgetattr2
+     in various tools to ensure attributes that are not created by Vsetattr
+     can still be detected and accessed.  The Reference Manual and User's Guide
+     provide details about this issue. (BMR 2012/12/25)
+
+
+Documentation
+=============
+   - The Reference Manual and User's Guide have minor updates.
+   - The Specification and Developer's Guide is extensively updated.
+
+
+Platforms tested
+================
+
+This version has been tested in the following platforms:
+
+   Linux 2.6.32-279.19.1         gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
+   .el6.ppc64 #1                 GNU Fortran (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
+   SMP ppc64 GNU/Linux           IBM XL Fortran for Linux, V13.1 (64-bit mode)
+   (ostrich)
+
+   Linux 2.6.18-308.13.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
+      SMP i686 i386              GNU Fortran (GCC) 4.1.2 20080704
+   (jam)                             (Red Hat 4.1.2-52)
+                                 pgcc and pgf90 11.9-0 32-bit target 
+                                 on x86 Linux -tp penryn
+                                 Intel(R) C Compiler, Version 12.1.0 20110811
+                                 Intel(R) Fortran Compiler, Version 12.1.0
+
+   Linux 2.6.18-308.24.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
+      SMP x86_64 GNU/Linux       GNU Fortran (GCC) 4.1.2 20080704 
+   (koala)                           (Red Hat 4.1.2-52)
+                                 icc (ICC) 12.1.0 20110811
+                                 ifort (IFORT) 12.1.0 20110811
+                                 pgcc and pgf90 11.9-0 64-bit target 
+                                 on x86-64 Linux -tp nehalem
+
+   SunOS 5.10 32- and 64-bit     Sun C 5.9 SunOS_sparc Patch 124867-16 2010/08/11 
+   (linew)                       Sun Fortran 95 8.3 SunOS_sparc Patch 127000-13 2010/01/26
+                                 Sun C 5.11 SunOS_sparc 2010/08/13
+                                 Sun Fortran 95 8.5 SunOS_sparc 2010/08/13
+
+   SunOS 5.11 32- and 64-bit     Sun C 5.12 SunOS_sparc 2011/11/16 
+   (emu)                              (see "Known problem" section)
+                                 Sun Fortran 95 8.6 SunOS_sparc 2011/11/16
+
+   Windows 7                     Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3)
+                                      compiler and gfortran)
+
+   Windows 7 x64                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Cygwin(CYGWIN_NT-6.1 1.7.15(0.260/5/3) gcc(4.5.3)
+                                      compiler and gfortran)
+
+   MAC OS X Intel 10.6.8         icc (ICC) 12.1 Build 20120928
+   (64-bit)                      ifort (IFORT) 12.1 Build 20120928
+   Darwin 10.8.0                 i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+   (fred)                        GNU Fortran (GCC) 4.6.2 20111019
+                                 Apple clang version 1.7 (tags/Apple/clang-77)
+                                 (based on LLVM 2.9svn)
+                             
+   MAC OS X Intel 10.7.5         i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1
+   (64 bit)                      GNU Fortran (GCC) 4.6.2 20111019
+   Darwin 11.4.2                 icc and ifort Version 13.0 Build 20121010              
+   (duck)                        Apple clang version 3.0
+                                 (tags/Apple/clang-211.12) (based on LLVM 3.0svn)
+
+   Mac OS X 10.8.2               Apple LLVM version 4.2 (clang-425.0.24) 
+   Darwin 12.2.0                 gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 
+   (wren)                        gfortran GNU Fortran (GCC) 4.6.2
+                                 icc and ifort Version 13.0.1.119 Build 20121010
+
+   Debian6.0.3 2.6.32-5-686 #1 SMP i686 GNU/Linux
+                                 gcc (Debian 4.4.5-8) 4.4.5
+                                 GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+   Debian6.0.3 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux
+                                 gcc (Debian 4.4.5-8) 4.4.5
+                                 GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+   Fedora17 3.5.2-1.fc17.i6866 #1 SMP i686 i686 i386 GNU/Linux
+                                 gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)
+                                 GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)
+
+   Fedora17 3.5.2-1.fc17.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
+                                 gcc (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)
+                                 GNU Fortran (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)
+
+   SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux
+                                 gcc (SUSE Linux) 4.7.1
+                                 GNU Fortran (SUSE Linux) 4.7.1
+
+   SUSE 12.2 3.4.6-2.10-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux
+                                 gcc (SUSE Linux) 4.7.1
+                                 GNU Fortran (SUSE Linux) 4.7.1 
+
+   Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP i686 GNU/Linux
+                                 gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+                                 GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+
+   Ubuntu 12.04 3.2.0-29-generic #46-Ubuntu SMP x86_64 GNU/Linux
+                                 gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+                                 GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+
+
+Known problems
+==============
+o  On SunOS 5.11, the -xc99 flag has to be used with the cc compiler to avoid
+   compilation errors.  Future releases will automatically detect the system and
+   add the flag. (HDFFR-1361) EIP - 2013/02/05
+
+o  For Mac OS X 10.7 Lion and on 10.8 Mountain Lion, several tests fail with
+   GCC, Intel and Clang compilers.  Currently, this situation is detected and
+   -O0 level optimization is used.  We will work on the issue for the next
+   release. (HDFFR-1358,1327,1358) EIP - 2013/02/05
+
+o  On IBM PowerPC 64, hdftest fails when gcc 4.4.6 is used with -O3 optimization 
+   level. 
+
+o  When building in AIX systems, if CC is xlc with -qlanglvl=ansi, configure
+   will fail when checking for the jpeglib.h header due to the duplicated
+   macro definition of HAVE_STDLIB_H.  This is because some newer builds
+   of the jpeg library have HAVE_STDLIB_H defined in the jconfig.h header file.
+   Without the -qlanglvl=ansi, some older xlc versions (e.g., V7.0) still 
+   fail, but newer xlc versions (e.g., V9.0) pass.  AKC - 2010/02/17
+
+o  When building on Linux/UNIX platforms, the szip shared library files must
+   be in the system library path.  This can be done by adding a link to
+   the libsz.* files in the /usr/lib folder or by adding the library
+   location to the LD_LIBRARY_PATH environment variable.
+      Ex. export LD_LIBRARY_PATH=path_to_szip_lib:$LD_LIBRARY_PATH
+   Optionally, one can use the static szip library files by adding '-static'
+   to the CFLAGS environment variable.
+   
+o  Existing data written by an HDF4 Library prior to HDF 4.2r2:
+   When a one-dimensional SDS and a dimension scale have
+   the same name, subsequent accesses to the dimension scale or to the
+   SDS might produce undesired results because the libraries could not
+   distinguish between the two objects.  In the case of writing, data
+   might even be corrupted.  For example, SDS data might be written to a
+   dimension variable or vice versa.
+
+   HDF4 Library Releases 4.2r2 and later make a distinction between an SDS
+   and a dimension variable.  However, as with older versions, these recent
+   versions are unable to detect such conflicts in files created by earlier 
+   releases.  It is therefore STRONGLY recommended to check for such name 
+   duplication before working with data created with a pre-4.2r2 library.
+
+   The functions SDgetnumvars_byname and SDnametoindices are provided
+   to help detect such name conflicts and select the correct object to
+   access, respectively; see the HDF Reference Manual entries for
+   further details.
+
+o  This release does not support VMS systems.
+
+o  N-bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+o  In order for the API SDgetdatasize to get the correct compressed size
+   of the data, the dataset needs to be closed (SDendaccess) or read
+   (SDreaddata) after being written and before SDgetdatasize is called.
+
+
+%%%4.2.8%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+HDF version 4.2.8 released on 2012-08-03
+===================================================
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2.7 and HDF 4.2.8.
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2.8.
+
+The HDF 4.2.8 documentation can be found on the The HDF Group's FTP server:
+
+    ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+    http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+    http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Source distribution
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF 4.2.7
+  -- Configuration
+  -- Library
+  -- Utilities
+- Documentation
+- Platforms tested
+- Known problems
+
+
+New features and changes
+========================
+   Source distribution
+   ===================
+   - [None.  PPM - YYYY/MM/DD]
+
+   Configuration
+   ============= 
+   - [None]
+     
+   Library
+   ========= 
+   - It was discovered by the HDF Mapping Project that there were certain
+     type of palettes that cannot be retrieved by existing functions.  A new
+     function, GRgetpalinfo, was added to allow applications to get information
+     about palettes.  Please refer to the HDF User's Guide and Reference Manual
+     for more information regarding this palette issue.  BMR - 2012/07/26
+
+   - It was also discovered that the IMCOMP compression was not detected.
+     Although IMCOMP is no longer supported in new data, HDF still needs to
+     detect IMCOMP compression from existing data.  We added COMP_CODE_IMCOMP
+     to comp_coder_t with value 12 (same as COMP_IMCOMP.)  The library and
+     hdp now can detect IMCOMP compression.  However, writing IMCOMP compressed
+     images is not allowed.  BMR - 2012/07/26
+
+   - Added GRgetcomptype to return image's compression, which can include
+     IMCOMP.  BMR - 2012/07/26
+
+   Test
+   ====
+   - [None]
+
+   Utilities
+   ========= 
+   - [None]
+
+
+Support for new platforms and compilers
+=======================================
+   -  Mac OS X 10.7.4 with GNU gcc and gfortran compilers
+
+
+Bugs fixed since HDF 4.2.7
+=========================
+   Configuration
+   =============
+   - Add config/apple-darwin11.4.0 customized for Mac OS X 10.7 Lion. This one
+     set production CFLAGS to -O0 to eliminate the test errors encountered in
+     Lion systems only. This one lets HDF4 to be build and run in Lion systems.
+     More investigate needed to locate the exact locations of the errors.
+     (HDFFR-1327 and HDFFR-1328) AKC - 2012/07/03
+
+   - The USE_ENUM in mfhdf/libsrc/netcdf.h, which is copied from
+     config/netcdf-apple.h, which generated an error due to xdr_enum overwrote
+     memory outside of its designated enum variable. This happened only to the
+     apple provided compiler (i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1).
+     We decided to not define USE_ENUM for all apple OS for now. (HDFFR-1318)
+     AKC - 2012/07/01
+
+   Library
+   ========= 
+   - [None]
+
+   Utilities
+   ========= 
+   - Added test file IMCOMP.hdf and sample file dumpgr-20.out for IMCOMP test
+     for testing the detection of IMCOMP compressed image in hdp.
+     BMR - 2012/07/26
+
+
+Documentation
+==============
+   - The Reference Manual and User's Guide have been updated to include
+     new functions:
+     + GRgetpalinfo
+     + GRgetcomptype
+     BMR - 2012/07/26
+
+
+Platforms tested
+================
+
+This version has been tested in the following platforms:
+
+   Linux 2.6.32-279.2.1         gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
+   .el6.ppc64 #1                GNU Fortran (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
+   SMP ppc64 GNU/Linux          IBM XL Fortran for Linux, V13.1 (64-bit mode)
+   (ostrich)
+
+   Linux 2.6.18-194.3.1.el5 #1   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
+      SMP i686 i386              GNU Fortran (GCC) 4.1.2 20080704
+   (jam)                             (Red Hat 4.1.2-52)
+                                 pgcc and pgf90 11.9-0 32-bit target 
+                                 on x86 Linux -tp penryn
+                                 Intel(R) C Compiler, Version 12.1.0 20110811
+                                 Intel(R) Fortran Compiler, Version 12.1.0
+
+   Linux 2.6.18-274.17.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51)
+      SMP x86_64 GNU/Linux       GNU Fortran (GCC) 4.1.2 20080704 
+   (koala)                           (Red Hat 4.1.2-51)
+                                 icc (ICC) 12.1.0 20110811
+                                 ifort (IFORT) 12.1.0 20110811
+                                 pgcc and pgf90 11.9-0 64-bit target 
+                                 on x86-64 Linux -tp nehalem
+
+   SunOS 5.10 32- and 64-bit     Sun C 5.9 SunOS_sparc Patch 124867-16 2010/08/11 
+   (linew)                       Sun Fortran 95 8.3 SunOS_sparc Patch 127000-13 2010/01/26
+
+   Xeon Linux 2.6.32.24-0.2.1.2230.2.PTF-default
+      #1 SMP x86_64              Intel(R) C Compiler Version 11.1.073 20100806
+      SGI Altix UV               Intel(R) Fortran Compiler Version 11.1.073
+   (ember)                       gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973
+                                 GNU Fortran (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
+
+   Windows 7                     Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Cygwin(1.7.15 native gcc(4.5.3) compiler and gfortran)
+
+   Windows 7 x64                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Cygwin(1.7.15 native gcc(4.5.3) compiler and gfortran)
+                                 
+   MAC OS X Intel 10.6.8         Darwin 10.8.0
+   (32 bit)                      i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+   (tejeda)                      GNU Fortran (GCC) 4.6.1
+                                 icc (ICC) 12.1.0 20110811
+                                 ifort (IFORT) 12.1.0 20110811
+
+   MAC OS X Intel 10.6.8         Darwin 10.8.0
+   (64 bit)                      icc (ICC) 12.1.0 20110811 
+   (fred)                        ifort (IFORT) 12.1.0 20110811 
+                                 i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+                                 GNU Fortran (GCC) 4.6.2
+                             
+   MAC OS X Intel 10.7.4         Darwin 11.4.0
+   (64 bit)                      i686-apple-darwin11-llvm-gcc-4.2.1 (GCC) 4.2.1
+   (hdf-duck)                    gcc (GCC) 4.6.2
+                                 GNU Fortran (GCC) 4.6.2
+
+    Debian6.0.3 2.6.32-5-686 #1 SMP i686 GNU/Linux
+                                  gcc (Debian 4.4.5-8) 4.4.5
+                                  GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+    Debian6.0.3 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux
+                                  gcc (Debian 4.4.5-8) 4.4.5
+                                  GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+    Fedora15 3.2.9-2.fc16.i686.PAE #1 SMP i686 i686 i386 GNU/Linux
+                                  gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
+                                  GNU Fortran (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
+
+    Fedora15 3.2.9-2.fc16.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
+                                  gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
+                                  GNU Fortran (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
+
+    SUSE 12.1 3.1.9-1.4-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux
+                                  gcc (SUSE Linux) 4.6.2
+                                  GNU Fortran (SUSE Linux) 4.6.2
+
+    SUSE 12.1 3.1.9-1.4-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux
+                                  gcc (SUSE Linux) 4.6.2
+                                  GNU Fortran (SUSE Linux) 4.6.2 
+
+    Ubuntu 11.10 3.2.0-26-generic #23-Ubuntu SMP i686 GNU/Linux
+                                  gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+                                  GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+
+    Ubuntu 11.10 3.2.0-26-generic #23-Ubuntu SMP x86_64 GNU/Linux
+                                  gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+                                  GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
+
+
+Known problems
+==============
+
+o  For Mac OS X 10.7 Lion, the test suite on the mfhdf side encounter 2 erros,
+   when optimization is used, whether with the Apple GCC compiler or with the
+   GNU GCC compiler.  CFLAGS must be set to use no optimization (-O0 or -g) to
+   avoid these failures.  config/apple-darwin11.4.0 is added to direct configure
+   to use -O0 for CFLAGS for Mac OS X 10.7 Lion. We hope to fix the bug in the
+   next release.  (HDFFR-1327 and HDFFR-1328) AKC - 2012/07/03
+
+o  On IBM PowerPC 64 hdftest fails when gcc 4.4.6 is used with -O3 optimization level. 
+
+o  When building in AIX systems, if CC is xlc with -qlanglvl=ansi, configure
+   will fail when checking for the jpeglib.h header due to the duplicated
+   macro definition of HAVE_STDLIB_H.  This is because some newer builds
+   of jpeg library have HAVE_STDLIB_H defined in the jconfig.h header file.
+   Without the -qlanglvl=ansi, some older xlc (e.g., V7.0) still fails but
+   newer xlc (e.g., V9.0) passes.  AKC - 2010/02/17
+
+o  When building on Linux/UNIX platforms, the szip shared library files must
+   be in the system library path. This can be done by adding a link to
+   the libsz.* files in the /usr/lib folder or by adding the library
+   location to the LD_LIBRARY_PATH environment variable.
+      Ex. export LD_LIBRARY_PATH=path_to_szip_lib:$LD_LIBRARY_PATH
+   Optionally, one can use the static szip library files by adding '-static'
+   to the CFLAGS environment variable.
+   
+o  Existing data written by an HDF4 Library prior to HDF 4.2r2:
+   When a one-dimensional SDS and a dimension scale have
+   the same name, subsequent accesses to the dimension scale or to the
+   SDS might produce undesired results because the libraries could not
+   distinguish between the two objects.  In the case of writing, data
+   might even be corrupted.  For example, SDS data might be written to a
+   dimension variable or vice versa.
+
+   HDF4 Library Releases 4.2r2 and later make a distinction between an SDS
+   and a dimension variable.  However, as with older versions, these recent
+   versions are unable to detect such conflicts in files created by earlier 
+   releases.  It is therefore STRONGLY recommended to check for such name 
+   duplication before working with data created with a pre-4.2r2 library.
+
+   The functions SDgetnumvars_byname and SDnametoindices are provided
+   to help detect such name conflicts and select the correct object to
+   access, respectively; see the HDF Reference Manual entries for
+   further details.
+
+o  This release does not support VMS systems.
+
+o  N-bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+o  In order for the API SDgetdatasize to get the correct compressed size
+   of the data, the dataset needs to be closed (SDendaccess) or read
+   (SDreaddata) after being written and before SDgetdatasize is called.
+
+
+%%%4.2.7%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+HDF version 4.2.7 released on 2012-02-06
+===================================================
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2.6 and HDF 4.2.7.
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2.7.
+
+The HDF 4.2.7 documentation can be found on the The HDF Group's FTP server:
+
+    ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+    http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+    http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Source distribution
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF4.2.6
+  -- Utilities
+  -- Library
+  -- Configuration
+- Documentation
+- Platforms tested
+- Known problems
+
+
+New features and changes
+========================
+   Source distribution
+   ===================
+   - None
+
+
+   Configuration
+   ============= 
+   - Fortran fort_ps folders are now obsolete, and VS2008 project
+     files have been updated.
+     CMake was tested on Windows, Linux, and Cygwin.
+     ADB - 2012/1/20
+     
+   Library
+   ========= 
+   - Fortran fort_ps folders are obsolete and have been removed.
+     ADB - 2012/1/20
+   - VSgetexternalfile and SDgetexternalfile are superseded by VSgetexternalinfo
+     and SDgetexternalinfo because their prototypes missed the parameter
+     "length" for external data length.  (part 1 in bug HDFFR-1297)
+     BMR - 2012/1/15
+   - Visinternal is superseded by Vgisinternal, which allows the handling of
+     special cases in old data.  (part 2 in bug HDFFR-1297)
+     BMR - 2012/1/15
+   - Fortran wrappers vfgvgroups and vsfgvdatas have been added for 
+     Vgetvgroups and VSgetvdatas, respectively.
+     MSB - 2012/1/5
+
+   Test
+   ====
+   - The following files were added:
+     ./hdf/test/test_files/README: special notes on data files in this directory
+     ./hdf/test/test_files/grtdfui83.hdf: file to test old data situations
+     ./mfhdf/test/tutils.c: added to provide common code for various tests
+     BMR - 2011/1/21
+
+   - The following file was removed:
+     ./mfhdf/test/tidtypes.c: changed to tmixed_apis.c for broader contents
+     BMR - 2011/1/21
+
+   Utilities
+   ========= 
+   - The following files were added:
+     ./mfhdf/dumper/testfiles/Roy.nc: file to test skipping compression check
+      in a netCDF file
+     ./mfhdf/dumper/testfiles/dumpsds-18.out: output of testing netCDF file
+     ./hdf/test/tvnameclass.c: tests issues involving vgroup/vdata names/classes
+     BMR - 2011/1/21
+
+
+Support for new platforms and compilers
+=======================================
+   -  IBM XL Fortran for Linux 64-bit, V13.1 on Linux PowerPC 64
+      EIP - 2012-02-01
+
+Bugs fixed since HDF4.2.6
+=========================
+   Utilities
+   ========= 
+   - hrepack: Version HDF4 2.6 does not allow the combination of unlimited 
+     dimensions and compression, which is wrong. 
+   - Freeing incorrect buffers caused segfault.  It was previously commented
+     out, thus resulted in memory leaks.  This is now fixed.  (HDFFR-479)
+     BMR - 2011/11/3
+   - hdp: fixed to skip netCDF files when checking for compression.  (HDFFR-473)
+     BMR - 2011/11/1
+
+
+   Library
+   ========= 
+   - SDgetchunkinfo and SDreadchunk failed on an empty SDS when the file is
+     opened as read-only (HDFFR-171).  This is now fixed.
+     BMR - 2011/10/20
+   - SDcheckempty was fixed to return "empty" when detecting a pair of
+     DFTAG_SD/<valid ref> that is associated with offset=INVALID_OFFSET and
+     length=INVALID_LENGTH.
+     BMR - 2011/10/9
+   - Vgetclass and Vgetname were fixed to return vgclass and vgname with null
+     terminated character when the class or name is not set. (HDFFR-1288)
+     BMR - 2011/9/19
+
+
+   Configuration
+   =============
+   - [None]
+
+
+Documentation
+==============
+   - The Reference Manual and User's Guide have been updated to include 
+     new functions:
+     + VSgetexternalinfo and SDgetexternalinfo
+     + Vgisinternal
+     + Fortran wrappers vfgvgroups and vsfgvdatas
+     BMR - 2012/1/22
+
+
+Platforms tested
+================
+
+This version has been tested in the following platforms:
+
+   Linux 2.6.32-220.2.1         gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
+   .el6.ppc64 #1                GNU Fortran (GCC) 4.4.6 20110731 
+   SMP ppc64 GNU/Linux          IBM XL Fortran for Linux, V13.1 (64-bit mode)
+   (ostrich)
+
+   Linux 2.6.18-194.3.1.el5 #1   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
+      SMP i686 i386              GNU Fortran (GCC) 4.1.2 20080704
+   (jam)                             (Red Hat 4.1.2-51)
+                                 pgcc and pgf90 11.8-0 32-bit target 
+                                 on x86 Linux -tp penryn
+                                 Intel(R) C Compiler, Version 12.0.4 20110427
+                                 Intel(R) Fortran Compiler, Version 12.0.4
+
+   Linux 2.6.18-274.17.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51)
+      SMP x86_64 GNU/Linux       GNU Fortran (GCC) 4.1.2 20080704 
+   (koala)                           (Red Hat 4.1.2-51)
+                                 icc (ICC) 12.0.4 20110427
+                                 ifort (IFORT) 12.0.4 20110427
+                                 pgcc and pgf90 11.8-0 64-bit target 
+                                 on x86-64 Linux -tp nehalem
+
+   SunOS 5.10 32- and 64-bit     Sun C 5.9 SunOS_sparc Patch 124867-16 2010/08/11 
+   (linew)                       Sun Fortran 95 8.3 SunOS_sparc Patch 127000-13 2010/01/26
+
+   Xeon Linux 2.6.32.24-0.2.1.2230.2.PTF-default
+      #1 SMP x86_64              Intel(R) C Compiler Version 11.1.073 20100806
+      SGI Altix UV               Intel(R) Fortran Compiler Version 11.1.073
+   (ember)
+
+   Windows XP                    Visual Studio 2008 w/ Intel Fortran 10.1 (project files)
+                                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Cygwin(1.7.9 native gcc(4.5.3) compiler and gfortran)
+
+   Windows XP x64                Visual Studio 2008 w/ Intel Fortran 10.1 (project files)
+                                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Cygwin(1.7.9 native gcc(4.5.3) compiler and gfortran)
+
+   Windows 7                     Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+
+   Windows 7 x64                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 
+   MAC OS X Intel 10.6.8         Darwin 10.8.0
+   (32 bit)                      i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+   (tejeda)                      GNU Fortran (GCC) 4.6.1
+                                 icc (ICC) 12.1.0 20110811
+                                 ifort (IFORT) 12.1.0 20110811
+
+   MAC OS X Intel 10.6.8         Darwin 10.8.0
+   (64 bit)                      icc (ICC) 12.1.0 20110811 
+   (fred)                        ifort (IFORT) 12.1.0 20110811 
+                                 i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+                                 GNU Fortran (GCC) 4.6.1
+                             
+
+    Debian6.0.3 2.6.32-5-686 #1 SMP i686 GNU/Linux
+                                  gcc (Debian 4.4.5-8) 4.4.5
+                                  GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+    Debian6.0.3 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux
+                                  gcc (Debian 4.4.5-8) 4.4.5
+                                  GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+    Fedora15 2.6.41.4-1.fc15.i686.PAE #1 SMP i686 i686 i386 GNU/Linux
+                                  gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)
+                                  GNU Fortran (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)
+
+    Fedora15 2.6.41.4-1.fc15.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
+                                  gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)
+                                  GNU Fortran (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)
+
+    SUSE 11.4 2.6.37.6-0.9-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux
+                                  gcc (SUSE Linux) 4.5.1 20101208
+                                  GNU Fortran (SUSE Linux) 4.5.1 20101208
+
+    SUSE 11.4 2.6.37.6-0.9-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux
+                                  gcc (SUSE Linux) 4.5.1 20101208
+                                  GNU Fortran (SUSE Linux) 4.5.1 20101208
+
+    Ubuntu 11.10 3.0.0-14-generic #23-Ubuntu SMP i686 GNU/Linux
+                                  gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
+                                  GNU Fortran (Ubuntu/Linaro 4.6.4-9ubuntu3) 4.6.1
+
+    Ubuntu 11.10 3.0.0-14-generic #23-Ubuntu SMP x86_64 GNU/Linux
+                                  gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
+                                  GNU Fortran (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
+
+
+Known problems
+==============
+
+o  On IBM PowerPC 64 hdftest fails when gcc 4.4.6 is used with -O3 optimization level. 
+
+o  When building in AIX systems, if CC is xlc with -qlanglvl=ansi, configure
+   fails when checking for the jpeglib.h header due to the duplicated
+   macro definition of HAVE_STDLIB_H.  This is because some newer builds
+   of jpeg library have HAVE_STDLIB_H defined in the jconfig.h header file.
+   Without the -qlanglvl=ansi, some older xlc (e.g., V7.0) still fails but
+   newer xlc (e.g., V9.0) passes.  AKC - 2010/02/17
+
+o  When building on Linux/UNIX platforms, the szip shared library files must
+   be in the system library path. This can be done by adding a link to
+   the libsz.* files in the /usr/lib folder or by adding the library
+   location to the LD_LIBRARY_PATH environment variable.
+      Ex. export LD_LIBRARY_PATH=path_to_szip_lib:$LD_LIBRARY_PATH
+   Optionally, one can use the static szip library files by adding '-static'
+   to the CFLAGS environment variable.
+   
+o  Existing data written by an HDF4 Library prior to HDF 4.2r2:
+   When a one-dimensional SDS and a dimension scale have
+   the same name, subsequent accesses to the dimension scale or to the
+   SDS might produce undesired results because the libraries could not
+   distinguish between the two objects.  In the case of writing, data
+   might even be corrupted.  For example, SDS data might be written to a
+   dimension variable or vice versa.
+
+   HDF4 Library Releases 4.2r2 and later make a distinction between an SDS
+   and a dimension variable.  However, as with older versions, these recent
+   versions are unable to detect such conflicts in files created by earlier 
+   releases.  It is therefore STRONGLY recommended to check for such name 
+   duplication before working with data created with a pre-4.2r2 library.
+
+   The functions SDgetnumvars_byname and SDnametoindices are provided
+   to help detect such name conflicts and select the correct object to
+   access, respectively; see the HDF Reference Manual entries for
+   further details.
+
+o  This release does not support VMS systems.
+
+o  N-bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+o  In order for the API SDgetdatasize to get the correct compressed size
+   of the data, the dataset needs to be closed (SDendaccess) or read
+   (SDreaddata) after being written and before SDgetdatasize is called.
+
+
+%%%4.2.6%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+HDF version 4.2.6 released on 2011-06-15
+===================================================
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2.5 and HDF 4.2.6.
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2.6.
+
+The HDF 4.2.6 documentation can be found on the The HDF Group's FTP server:
+
+    ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+    http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+    http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Source distribution
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF4.2.5
+  -- Utilities
+  -- Library
+  -- Configuration
+- Documentation
+- Platforms tested
+- Known problems
+
+
+New features and changes
+========================
+   Source distribution
+   ===================
+   - [None]
+
+   Configuration
+   ============= 
+   - CMake support has been added. Current version recommemded is CMake 2.8.4.
+     ADB - 2011/06/14
+
+   - Specified explicit version of the netCDF API (v 2.3.2) used by HDF in
+     configure help and in configuration SUMMARY.
+     
+   Library
+   ========= 
+   - Prior to HDF version 4.2.6, passing 0 for count caused failure; however,
+     the failure did not occur in SDsetattr but was delayed until SDend.  This
+     can potentially cause file corruption.  Starting from release 4.2.6,
+     SDsetattr will fail when count is 0. BMR - 2011/06/09
+
+   - The function Vnattrs only processes attributes created by Vsetattr.  It is
+     not aware of attributes created by the pre-Vsetattr methods.  The following
+     functions are added to work around the limitation of Vnattrs:
+     + Vnattrs2 gives number of new- and old-style attributes
+     + Vattrinfo2 gives information about an old or new style attribute
+     + Vgetattr2 reads values of an old or new style attribute
+     BMR - 2011/06/09
+
+   - The following functions were added to support the HDF4 Mapping
+     project specifically:
+     + VSgetdatainfo gives offsets/lengths of a vdata's data
+     + ANgetdatainfo gives offset/length of an annotation's data
+     + SDgetdatainfo gives offsets/lengths of a data set's data
+     + GRgetdatainfo gives offsets/lengths of a raster image's data
+     + VSgetattdatainfo gives offset/length of vdata attribute's data
+     + VGgetattdatainfo gives offset/length of vgroup attribute's data
+     + GRgetattdatainfo gives offset/length of raster image attribute's data
+     + SDgetattdatainfo gives offset/length of data set attribute's data
+     + SDgetoldattdatainfo gives offset/length of a pre-defined attribute in
+       old format
+     + SDgetanndatainfo gives offset/lenth of an annotation belonging to an SDS
+     + Vgetvgroups gives a list of user-created vgroups
+     + VSgetvdatas gives a list of user-created vdatas
+     + VSofclass gives a list of vdatas of a specific class
+     + Hgetntinfo gives some information about a number type
+     + GR2bmapped indicates whether a raster image should be mapped
+     BMR - 2011/06/09
+
+   - Two functions are added to provide information of an external file:
+     VSgetexternalfile for a vdata and SDgetexternalfile for a data set.
+     BMR - 2011/06/09
+
+
+   Utilities
+   ========= 
+   - [None]
+
+Support for new platforms and compilers
+=======================================
+   - [None]
+
+Bugs fixed since HDF4.2.5
+=========================
+   Utilities
+   ========= 
+   - hdp dumpvd and dumpsds now provide the name of the external file in the
+     error message when reading fails due to missing the external file.
+     BMR - 2011/06/10
+   - The problem where hdiff displays zeroes for Vdata values that are non-zero
+     had been fixed.  BMR - 2011/06/09
+   - hdp had been fixed for the problems of
+     + dumpvd printing Name/Class incorrectly
+     + dumprig giving wrong info about RIS24 and palettes
+     + dumpvg missing some items in the Graphical representation
+     BMR - 2011/06/09
+
+
+   Library
+   ========= 
+   - The JPEG test failure due to the different versions of the JPEG library
+     had been fixed.  HDF4 is expected to build and pass regression tests for
+     any version of the JPEG library available on the user's systems. 
+     BMR - 2011/06/09
+
+
+   Configuration
+   =============
+   - [None]
+
+
+Documentation
+==============
+The updated HDF Reference Manual is now available in HTML format.
+
+Platforms tested
+================
+
+This version has been tested in the following platforms:
+
+   Linux 2.6.18-194.3.1.el5 #1   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
+      SMP i686 i386              G95 (GCC 4.0.3 (g95 0.92!) Jun 24 2009)
+   (jam)                         g77 (GCC) 3.4.6 20060404
+                                 pgcc and pgf90 10.6-0 32-bit target 
+                                 on x86 Linux -tp penryn
+                                 Intel(R) C Compiler, Version 11.1
+                                 Intel(R) Fortran Compiler, Version 11.1
+                                 GNU Fortran (GCC) 4.1.2 20080704
+                                 (Red Hat 4.1.2-50)
+
+
+   Linux 2.6.18-238.9.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50)
+      SMP x86_64 GNU/Linux       G95 (GCC 4.0.3 (g95 0.93!) Apr 21 2010)
+   (koala)                       icc (ICC) 12.0.3 20110309
+                                 ifort (IFORT) 12.0.3 20110309
+                                 pgcc and pgf90 11.3-0 64-bit target 
+                                 on x86-64 Linux -tp nehalem
+                                 GNU Fortran (GCC) 4.1.2 20080704 
+                                 (Red Hat 4.1.2-50)
+
+   SunOS 5.10 32- and 64-bit     Sun C 5.9 SunOS_sparc Patch 124867-16 
+   (linew)                       Sun Fortran 95 8.3 SunOS_sparc 
+                                 Patch 127000-13 
+
+   Xeon Linux 2.6.32.24-0.2.1.2230.2.PTF-default
+      #1 SMP x86_64              Intel(R) C Compiler Version 11.1.073
+      SGI Altix UV               Intel(R) Fortran Compiler Version 11.1.073
+   (ember)
+
+   AIX 6.1 (32/64 bit)           IBM XL C/C++ for AIX, V11.1
+   (NCSA bp-login)               IBM XL Fortran for AIX, V13.1
+
+   Windows XP                    Visual Studio 2008 w/ Intel Fortran 10.1 (project files)
+                                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 (cmake)
+                                 Cygwin(1.7.7 native gcc(4.3.4) compiler and gfortran)
+
+   Windows XP x64                Visual Studio 2008 w/ Intel Fortran 10.1 (project files)
+                                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 (cmake)
+                                 Cygwin(1.7.7 native gcc(4.3.4) compiler and gfortran)
+
+   Windows 7                     Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+
+   Windows 7 x64                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 
+   MAC OS X Intel 10.6.2         Darwin 10.7.0
+   (32 bit)                      i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+   (tejeda)                      GNU Fortran (GCC) 4.4.0 20090123
+
+   MAC OS X Intel 10.6.2         Darwin 10.7.0
+   (64 bit)                      Intel C icc (ICC) 12.0 20101110
+   (fred)                        Intel Fortran ifort (IFORT) 12.0 20101110 
+                                 i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+                                 GNU Fortran (GCC) 4.6.0
+                             
+
+   Debian6.01 2.6.32-5-686 #1 SMP i686 GNU/Linux
+                                 gcc (Debian 4.4.5-8) 4.4.5
+                                 GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+   Debian6.01 2.6.32-5-amd64 #1 SMP x86_64 GNU/Linux
+                                 gcc (Debian 4.4.5-8) 4.4.5
+                                 GNU Fortran (Debian 4.4.5-8) 4.4.5
+
+   Fedora14 2.6.35.12-88.fc14.i686.PAE #1 SMP i686 i686 i386 GNU/Linux
+                                 gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
+                                 GNU Fortran (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
+
+   Fedora14 2.6.35.12-88.fc14.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
+                                 gcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
+                                 GNU Fortran (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
+
+   SUSE 11.4 2.6.37.1-1.2-desktop #1 SMP PREEMPT i686 i686 i386 GNU/Linux
+                                 gcc (SUSE Linux) 4.5.1 20101208
+                                 GNU Fortran (SUSE Linux) 4.5.1 20101208
+
+   SUSE 11.4 2.6.37.1-1.2-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux
+                                 gcc (SUSE Linux) 4.5.1 20101208
+                                 GNU Fortran (SUSE Linux) 4.5.1 20101208
+
+   Ubuntu 10.10 2.6.35-28-generic #50-Ubuntu SMP i686 GNU/Linux
+                                 gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
+                                 GNU Fortran (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
+
+   Ubuntu 10.10 2.6.35-28-generic #50-Ubuntu SMP x86_64 GNU/Linux
+                                 gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
+                                 GNU Fortran (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
+
+
+Known problems
+==============
+
+o  Wnen buidling in AIX systems, if CC is xlc with -qlanglvl=ansi, configure
+   fails when checking for the jpeglib.h header due to the duplicated
+   macro definition of HAVE_STDLIB_H.  This is because some newer builds
+   of jpeg library has HAVE_STDLIB_H defined in its jconfig.h header file.
+   Without the -qlanglvl=ansi, some older xlc (e.g., V7.0) still fails but
+   newer xlc (e.g., V9.0) passes.  AKC - 2010/02/17
+
+o  When building on Linux/UNIX platforms, the szip shared library files must
+   be in the system library path. This can be done by adding a link to
+   the libsz.* files into the /usr/lib folder or by adding the library
+   location to the LD_LIBRARY_PATH environment variable.
+      Ex. export LD_LIBRARY_PATH=path_to_szip_lib:$LD_LIBRARY_PATH
+   Optionally, one can use the static szip library files by adding '-static'
+   to the CFLAGS environment variable.
+   
+o  Existing data written by an HDF4 Library prior to HDF 4.2r2:
+   When a one-dimensional SDS and a dimension scale were created with
+   the same name, subsequent accesses to the dimension scale or to the
+   SDS might corrupt the data.
+
+   HDF4 Library Releases 4.2r2 and later do not allow this conflict to
+   occur.  On the other hand, recent libraries are also unable to detect
+   such conflicts that already exist in a file.  It is therefore STRONGLY
+   recommended to check for such name duplication before working with data 
+   created with a pre-4.2r2 library. 
+
+   The functions SDgetnumvars_byname and SDnametoindices are provided
+   to help detect such name conflicts and select the correct object to
+   access, respectively; see the HDF Reference Manual entries for 
+   further details.
+
+o  This release does not support VMS systems.
+
+o  N-Bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+o  In order for the API SDgetdatasize to get the correct compressed size
+   of the data, the dataset needs to be closed (SDendaccess) or read
+   (SDreaddata), after being written and before SDgetdatasize is called.
+ 
+
+%%%4.2.5%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+HDF version 4.2.5 released on Wed Feb 24 13:00:16 CST 2010
+===================================================
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2.4 and HDF 4.2.5
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2.5
+
+The HDF 4.2.5 documentation can be found on the The HDF Group's FTP server:
+
+     ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+     http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+     http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Source distribution
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF4.2.4
+  -- Utilities
+  -- Library
+  -- Configuration
+- Documentation
+- Platforms tested
+- Known problems
+- Appendix: List of the removed files
+
+
+New features and changes
+========================
+    Source distribution
+    ===================
+    - For the complete list of the removed obsolete files see Appendix.
+    - Removed obsolete mfhdf/port and mfhdf/c++ directories and related 
+      code
+        (EIP - 2010/1/18)
+    - Removed obsolete hdf/fmpool directory and related code
+    - Removed obsolete constants PCIO, WINIO, PAGEBIFIO, and WINNTIO from
+      hdfi.h and hfile.h 
+        (EIP - 2009/12/31)
+    - INSTALL* files were moved to the release_notes directory
+        (EIP - 2009/12/29)
+    - SD tests were moved from mfhdf/libsrc to mfhdf/test.
+	  (BMR - 2009/09/10)
+
+    Configuration
+    ============= 
+    - Added a configure check that will fail when jpeg version 7 is
+      used, as this is not yet supported in HDF4. (MAM - 2010/01/28)
+    - Configure suite now built with the following versions of the autotools:
+        Automake 1.11.1, Autoconf 2.65, and Libtool 2.2.6b  
+        (MAM - 2009/12/14)
+
+    Library
+    ========= 
+    - SDgetchunkinfo now contains compression type and compression
+      information.  If failure occurs while getting compression information,
+      the associate compression parameters will be set to -1 to indicate
+      that no compression information is retrieved, instead of SDgetchunkinfo
+      simply fails.  This is to support backward compatibily.
+      (BMR - 2010/02/04)
+    - Vgroup name and class name can now be more than the previous limit
+      of 64 characters.  Two public functions are provided for applications
+      to be able to allocate sufficient space for these items.
+        int32 Vgetnamelen (int32 vkey, uint16 *name_len);
+        int32 Vgetclassnamelen (int32 vkey, uint16 *classname_len);
+      Please refer to the Reference Manual and User's Guide for details.
+      (BMR - 2010/01/27)
+    - SDreset_maxopenfiles allows users to reset the number of the files that 
+      can be open at the same time to the system limit minus 3. On AIX 6.1
+      system limit is 2GB-1 causing HDF4 to choke. Source code was modified 
+      to put a cap on the system limit to not exceed 
+      H4_MAX_AVAIL_OPENFILES (currently 20000).  (EIP - 2010/02/01) 
+    - "make installcheck" builds and tests examples using h4cc and h4fc
+      scripts (MAM, BMR and MSB - 2009/12)
+    - HDF Fortran examples were added to hdf/fortran/examples. 
+      (MAM - 2009/12/14)
+    - SD examples were added to mfhdf/examples.  (BMR - 2009/08/28)
+    - HDF C examples were added to hdf/examples.  (BMR - 2009/11/07)
+
+    Test
+    ====
+    - Added tests for GRfindattr, GRattrinfo, and GRgetattr (BMR - 2009/11/15)
+    - Moved SD tests out of mfhdf/libsrc into the new directory mfhdf/test
+      (BMR - 2009/09/10)
+
+    Utilities
+    ========= 
+    - Added flag -k to hdp dumpsds to keep the order of the outputted
+      SDSs the same as the order they were specified on the command
+      line.  The default (without -k) is SDSs are printed in the order
+      in which they were added to the file (ie., indices.) (BMR - 2010/02/03)
+    - Added -V flag to hdiff, hrepack, hdfimport, ncdump and ncgen; 
+      when specified, tool prints library version string and exits.
+          (EIP - 2010/01/28) 
+    - Hrepack: set default value for JPEG's quality factor to 75 to
+      prevent image distortion when the factor is not provided by user
+      (BMR - 2010/01/14)
+ 
+    Daily Test and Release
+    ======================
+    Added h4vers and release scripts and Snapshot Release capability.
+
+Support for new platforms and compilers
+=======================================
+   Added support for 64-bit Mac Intel with gcc, gfortran and Intel C
+   and Fortran compilers.
+   Added support for AIX 6.1 using IBM XL C and Fortran compilers.
+   (EIP - 2010/1/29)
+
+Bugs fixed since HDF4.2.4
+=========================
+    Utilities
+    ========= 
+        - None 
+
+    Library
+    ========= 
+    - The problem where incorrect result occurred when attempting
+      to retrieve the dimension scale's number type from a netCDF file
+      was fixed (bugzilla #1644.) (BMR - 2009/09/25)
+    - The problem where pieces of an image get written multiple times
+      at different locations in the 2-D array had been fixed.  The
+      cause was the pointer to user's buffer was not advanced properly.
+      This was part of bugzilla 1547.  (BMR - 2009/06/10)
+    - The problem which SDgetdimstrs failed if there are no attributes
+      attached to the dimension had been fixed.  SDgetdimstrs now returns
+      the attribute strings containing '\0' for the first character, as
+      specified in the documentation. (BMR - 2009/08/28)
+
+
+    Configuration
+    =============
+    - The mfhdf/ncgen/Makefile.in now has $(EXEEXT) appended to the ncgen
+      program whenever it is referenced in a build rule dependency. This 
+      fixes some compile problems on Cygwin, where the .exe is necessary.
+      (MAM - 2009/12/17). 
+    - Configure will now fail if the yacc or flex utilities are not available
+      (as opposed to failing sometime during make when they are used).
+      (MAM - 2009/12/17).
+    - Configure will now properly check for the rpc library when on
+      Cygwin, and fail gracefully if it is not found. (MAM - 2009/12/17)
+    - Configure will no longer try to use a Fortran compiler to set up
+      aspects of the build environment when Fortran has been disabled, as
+      configure now deliberately sets the F77 environment variable to 'no'
+      when Fortran is disabled. This should no longer cause build problems 
+      on Cygwin when no Fortran compiler is available. (MAM - 2009/12/14)
+    - './configure --help' will now correctly indicate that shared libraries
+      are disabled by default. (MAM - 2009/12/14)
+    
+        
+
+Documentation
+==============
+The updated HDF Reference Manual is now available in HTML format.
+
+Platforms tested
+================
+
+HDF 4.2.5 has been tested in the following platforms:
+
+    FreeBSD 6.3-STABLE i386       gcc 3.4.6 [FreeBSD] 20060305
+    (duty)                        f77 (gcc) 3.4.6
+                                  gcc (GCC) 4.4.4 20100126 (prerelease)
+                                  GNU Fortran (GCC) 4.4.4 20100126
+                                  (prerelease) 
+
+    FreeBSD 6.3-STABLE amd64      gcc 3.4.6 [FreeBSD] 20060305
+    (liberty)                     f77 (gcc) 3.4.6
+                                  gcc (GCC) 4.4.4 20100126 (prerelease)
+                                  GNU Fortran (GCC) 4.4.4 20100126
+                                  (prerelease)
+
+
+    Linux jam 2.6.18-164.el5 #1   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
+         SMP i686 i386            G95 (GCC 4.0.3 (g95 0.92!) Jun 24 2009)
+    (jam)                         g77 (GCC) 3.4.6 20060404
+                                  pgcc and pgf90 8.0-5 32-bit target 
+                                  on x86 Linux -tp penryn
+                                  Intel(R) C Compiler, Version 11.0
+                                  Intel(R) Fortran Compiler, Version 11.0
+
+
+    Linux 2.6.18-164.11.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
+        SMP x86_64 GNU/Linux      G95 (GCC 4.0.3 (g95 0.92!) Jun 24 2009)
+    (amani)                       icc (ICC) 11.1 20090827
+                                  ifort (IFORT) 11.1 20090827
+                                  pgcc and pgf90 9.0-4 64-bit target 
+                                  on x86-64 Linux -tp k8-64e
+                                  GNU Fortran (GCC) 4.1.2 20080704 
+                                  (Red Hat 4.1.2-46)
+
+    SunOS 5.10 32- and 64-bit     Sun C 5.9 SunOS_sparc Patch 124867-12 
+    (linew)                       Sun Fortran 95 8.3 SunOS_sparc 
+                                  Patch 127000-12 
+
+    Linux 2.6.16.54-0.2.5 #1      Intel(R) C Compiler Version 10.1.017
+        Altix SMP ia64            Intel(R) Fortran Itanium(R) Version 10.1.017
+    (cobalt)                      SGI MPI 1.16
+
+    Xeon Linux 2.6.18-92.1.10.el5_lustre.1.6.6smp-perfctr
+         #2 SMP x86_64            Intel(R) C Compiler Version 10.0.026
+    (abe)                         Intel(R) Fortran Compiler Version 10.0.026
+
+    IA-64 Linux 2.4.21.SuSE_292.til1
+        ia64
+    (NCSA tg-login)               Intel(R) C Compiler Version 8.1.037
+                                  Intel(R) Fortran Compiler Version 8.1.033
+
+    AIX 5.3 (32/64 bit)           IBM XL C/C++ for AIX, V9.0
+    (LLNL Up)                     IBM XL Fortran for AIX, V11.1
+
+    AIX 6.1 (32/64 bit)           IBM XL C/C++ for AIX, V10.1
+    (NCSA bp-login)               IBM XL Fortran for AIX, V12.1
+
+    Windows XP                    Visual Studio 2005 (with Intel Fortran 9.1/10.1)
+                                  Visual Studio 2008 (with Intel Fortran 10.1)
+                                  cygwin (gcc 4.3.4)
+
+    Windows XP(64 bit)            Visual Studio 2005 (with Intel Fortran 9.1/10.1)
+                                  Visual Studio 2008 (with Intel Fortran 10.1)
+                                  
+    Windows Vista                 Visual Studio 2008 (with Intel Fortran 10.1)
+                                  
+    Windows Vista(64 bit)         Visual Studio 2008 (with Intel Fortran 10.1)
+                                  
+    MAC OS X Intel 10.6.2         Darwin 10.2.0
+                                  Intel C icc (ICC) 11.1 20091130
+                                  Intel Fortran ifort (IFORT) 11.1 20091130 
+                                  i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1
+                                  GNU Fortran (GCC) 4.5.0 20090910
+                              
+
+    Linux 2.6.31.12-174.2.3.fc12.x86_64 #1 SMP 
+        x86_64 GNU/Linux          gcc (GCC) 4.4.2
+     (Fedora 12)                  gfortran GNU Fortran (GCC) 4.4.2 20091222 
+                                                       (Red Hat 4.4.2-20)
+    Linux 2.6.31-17-generic #54-Ubuntu SMP 
+        x86_64 GNU/Linux          gcc (GCC) 4.4.1
+     (Ubuntu 9.10)                gfortran GNU Fortran (GCC) 4.4.1 
+                                                       
+    Linux 2.6.31.8-0.1-desktop #1 SMP 
+        x86_64 GNU/Linux          gcc (GCC) 4.4.1
+     (OpenSuse 11.2)              gfortran GNU Fortran (GCC) 4.4.1 
+
+
+Known problems
+==============
+
+o  Wnen buidling in AIX systems, if CC is xlc with -qlanglvl=ansi, configure
+   fails when checking for the jpeglib.h header due to the duplicated
+   macro definition of HAVE_STDLIB_H.  This is because some newer builds
+   of jpeg library has HAVE_STDLIB_H defined in its jconfig.h header file.
+   Without the -qlanglvl=ansi, some older xlc (e.g., V7.0) still fails but
+   newer xlc (e.g., V9.0) passes. (AKC - 2010/02/17)
+
+o  When building on Linux/UNIX platforms, the szip shared library files must
+   be in the system library path. This can be done by adding a link to
+   the libsz.* files into the /usr/lib folder or by adding the library
+   location to the LD_LIBRARY_PATH environment variable.
+      Ex. export LD_LIBRARY_PATH=path_to_szip_lib:$LD_LIBRARY_PATH
+   Optionally, one can use the static szip library files by adding '-static'
+   to the CFLAGS environment variable.
+   
+o  Existing data written by an HDF4 Library prior to HDF 4.2r2:
+   When a one-dimensional SDS and a dimension scale were created with
+   the same name, subsequent accesses to the dimension scale or to the
+   SDS might corrupt the data.
+
+   HDF4 Library Releases 4.2r2 and later do not allow this conflict to
+   occur.  On the other hand, recent libraries are also unable to detect
+   such conflicts that already exist in a file.  It is therefore STRONGLY
+   recommended to check for such name duplication before working with data 
+   created with a pre-4.2r2 library. 
+
+   The functions SDgetnumvars_byname and SDnametoindices are provided
+   to help detect such name conflicts and select the correct object to
+   access, respectively; see the HDF Reference Manual entries for 
+   further details.
+
+o  This release does not support VMS systems.
+
+o  N-Bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+o  In order for the API SDgetdatasize to get the correct compressed size
+   of the data, the dataset needs to be closed (SDendaccess) or read
+   (SDreaddata), after being written and before SDgetdatasize is called.
+
+  
+Appendix: List of the removed files 
+===================================
+
+	mfhdf/CHANGES
+	mfhdf/CUSTOMIZE
+	mfhdf/INSTALL
+	mfhdf/MANIFEST
+	mfhdf/ORIGIN
+	mfhdf/README
+	mfhdf/README.HDF
+	mfhdf/README.HDF.33
+	mfhdf/VERSION
+	mfhdf/macros.mk
+	mfhdf/mfhdf.mak
+	mfhdf/msoft.mk 
+ 
+
+        mfhdf/c++/README
+        mfhdf/c++/example.c
+        mfhdf/c++/example.cc
+        mfhdf/c++/example.cdl
+        mfhdf/c++/expected
+        mfhdf/c++/nc.info
+        mfhdf/c++/nc.txn
+        mfhdf/c++/nctst.cc
+        mfhdf/c++/ncvalues.cc
+        mfhdf/c++/ncvalues.hh
+        mfhdf/c++/netcdf.cc
+        mfhdf/c++/netcdf.hh
+
+	mfhdf/fortran/fortc
+	mfhdf/fortran/fortc1.sed
+	mfhdf/fortran/fortc2.sed
+	mfhdf/fortran/ftest.lnk
+	mfhdf/fortran/msoft/
+
+	mfhdf/fortran/Linux.m4
+	mfhdf/fortran/README
+	mfhdf/fortran/aix.m4
+	mfhdf/fortran/common.m4
+	mfhdf/fortran/convex.m4
+	mfhdf/fortran/craympp.m4
+	mfhdf/fortran/descrip.mms
+	mfhdf/fortran/freebsd.m4
+	mfhdf/fortran/fujivp.m4
+	mfhdf/fortran/hpux.m4
+	mfhdf/fortran/irix.m4
+	mfhdf/fortran/msoft.m4
+	mfhdf/fortran/msoft.mk
+	mfhdf/fortran/osf.m4
+	mfhdf/fortran/solaris.m4
+	mfhdf/fortran/sunos.m4
+	mfhdf/fortran/ultrix.m4
+	mfhdf/fortran/unicos.m4
+	mfhdf/fortran/vax-ultrix.m4
+	mfhdf/fortran/vms.m4
+	mfhdf/libsrc/README
+
+	mfhdf/libsrc/cdftest.c
+	mfhdf/libsrc/cdftest.mak
+	mfhdf/libsrc/cdftest.project.hqx
+	mfhdf/libsrc/descrip.mms
+	mfhdf/libsrc/gen_sds_szipped.c
+	mfhdf/libsrc/hdftest.c
+	mfhdf/libsrc/hdftest.h
+	mfhdf/libsrc/hdftest.mak
+	mfhdf/libsrc/hdftest.project.hqx
+	mfhdf/libsrc/htons.mar
+	mfhdf/libsrc/mfhdflib.project.hqx
+	mfhdf/libsrc/msoft.mk
+	mfhdf/libsrc/ntohs.mar
+	mfhdf/libsrc/sds_szipped.dat
+	mfhdf/libsrc/tchunk.c
+	mfhdf/libsrc/tcomp.c
+	mfhdf/libsrc/tcoordvar.c
+	mfhdf/libsrc/tdatasizes.c
+	mfhdf/libsrc/tdim.c
+	mfhdf/libsrc/temptySDSs.c
+	mfhdf/libsrc/tfile.c
+	mfhdf/libsrc/tidtypes.c
+	mfhdf/libsrc/tncunlim.c
+	mfhdf/libsrc/tnetcdf.c
+	mfhdf/libsrc/trank0.c
+	mfhdf/libsrc/tsd.c
+	mfhdf/libsrc/tsdsprops.c
+	mfhdf/libsrc/tszip.c
+	mfhdf/libsrc/tunlim.c
+	mfhdf/libsrc/win32cdf.h
+	mfhdf/libsrc/win32cdf.mak
+
+        mfhdf/ncdump/ncdump.mak
+        mfhdf/ncdump/msoft.mk
+        mfhdf/ncdump/msofttab.c
+        mfhdf/ncdump/ctest0.mak
+        mfhdf/ncdump/ncdump.lnk
+
+        mfhdf/ncgen/test0.lnk
+        mfhdf/ncgen/ncgen.opt
+        mfhdf/ncgen/msoft.mk
+        mfhdf/ncgen/ncgen.mak
+        mfhdf/ncgen/ctest0.mak
+        mfhdf/ncgen/descrip.mms
+
+
+        mfhdf/port/COPYRIGHT
+        mfhdf/port/CUSTOMIZE
+        mfhdf/port/HISTORY
+        mfhdf/port/Makefile.am
+        mfhdf/port/Makefile.in
+        mfhdf/port/VERSION
+        mfhdf/port/aclocal.m4
+        mfhdf/port/configure
+        mfhdf/port/configure.in
+        mfhdf/port/depend
+        mfhdf/port/mast_mk.in
+        mfhdf/port/master.mk.in
+        mfhdf/port/uddummy.c
+        mfhdf/port/udposix.h.in
+        mfhdf/port/udposixh.in
+        mfhdf/port/which
+
+	hdf/COPYING
+	hdf/COPYRIGHT
+	hdf/README
+	hdf/README.33r4
+
+        hdf/fmpool/Makefile.in
+	hdf/fmpool/README
+	hdf/fmpool/cdefs.h
+	hdf/fmpool/compat.h
+	hdf/fmpool/config.guess
+	hdf/fmpool/config.sub
+	hdf/fmpool/configure
+	hdf/fmpool/configure.in
+	hdf/fmpool/fmpio.3
+	hdf/fmpool/fmpio.c
+	hdf/fmpool/fmpio.h
+	hdf/fmpool/fmpool.3
+	hdf/fmpool/fmpool.c
+	hdf/fmpool/fmpool.h
+	hdf/fmpool/fmptypes.h
+	hdf/fmpool/move-if-change
+	hdf/fmpool/queue.h
+	hdf/fmpool/test_fmpio.c
+	hdf/fmpool/tfmpio_read.c
+	hdf/fmpool/tfmpio_write.c
+
+	hdf/fmpool/config/fmpaix.h
+	hdf/fmpool/config/fmpalpha.h
+	hdf/fmpool/config/fmpconvex.h
+	hdf/fmpool/config/fmpdec.h
+	hdf/fmpool/config/fmpfbsd.h
+	hdf/fmpool/config/fmpfujivp.h
+	hdf/fmpool/config/fmphpux.h
+	hdf/fmpool/config/fmpia64.h
+	hdf/fmpool/config/fmpirix32.h
+	hdf/fmpool/config/fmpirix4.h
+	hdf/fmpool/config/fmpirix5.h
+	hdf/fmpool/config/fmpirix6.h
+	hdf/fmpool/config/fmplinux.h
+	hdf/fmpool/config/fmpmac.h
+	hdf/fmpool/config/fmpsolaris.h
+	hdf/fmpool/config/fmpsun.h
+	hdf/fmpool/config/fmpt3e.h
+	hdf/fmpool/config/fmpunicos.h
+	hdf/fmpool/config/mh-aix
+	hdf/fmpool/config/mh-alpha
+	hdf/fmpool/config/mh-convex
+	hdf/fmpool/config/mh-decstation
+	hdf/fmpool/config/mh-fbsd
+	hdf/fmpool/config/mh-fujivp
+	hdf/fmpool/config/mh-hpux
+	hdf/fmpool/config/mh-ia64
+	hdf/fmpool/config/mh-irix32
+	hdf/fmpool/config/mh-irix4
+	hdf/fmpool/config/mh-irix5
+	hdf/fmpool/config/mh-irix6
+	hdf/fmpool/config/mh-linux
+	hdf/fmpool/config/mh-mac
+	hdf/fmpool/config/mh-solaris
+	hdf/fmpool/config/mh-sun
+	hdf/fmpool/config/mh-t3e
+	hdf/fmpool/config/mh-unicos
+
+	hdf/src/hdf.bld
+	hdf/src/hdflib.project.hqx
+	hdf/src/hdfnof.bld
+	hdf/src/hdfnofw3.lbc
+	hdf/src/hdfnofwc.lbc
+	hdf/src/hdfw386.lbc
+	hdf/src/hdfwcc.lbc
+	hdf/src/makepc.386
+        hdf/src/makepc.msc
+	hdf/src/makepc.wcc
+	hdf/src/makewin.msc
+	hdf/src/win32hdf.mak
+
+        hdf/util/fp2hdf.mak
+	hdf/util/hdf24to8.mak
+	hdf/util/hdf2jpeg.mak
+	hdf/util/hdf8to24.mak
+	hdf/util/hdfcomp.mak
+	hdf/util/hdfed.mak
+	hdf/util/hdfls.mak
+	hdf/util/hdfpack.mak
+	hdf/util/hdftopal.mak
+	hdf/util/hdftor8.mak
+	hdf/util/hdfunpac.mak
+	hdf/util/jpeg2hdf.mak
+	hdf/util/makepc.386
+	hdf/util/makepc.msc
+	hdf/util/paltohdf.mak
+	hdf/util/r8tohdf.mak
+	hdf/util/ristosds.mak
+	hdf/util/vcompat.mak
+	hdf/util/vmake.mak
+	hdf/util/vshow.mak
+
+	hdf/test/MAKECOM.OLD
+	hdf/test/makepc.386
+	hdf/test/makepc.msc
+	hdf/test/makewin.msc
+	hdf/test/makewin.new
+	hdf/test/testhdf.386
+	hdf/test/testhdf.def
+	hdf/test/testhdf.lnk
+	hdf/test/testhdf.pc
+	hdf/test/testhdf.project.hqx
+	hdf/test/win32tst.mak
+
+
+ 
+%%%4.2r4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+                          HDF 4.2 Release 4  
+                          =================
+                          January 25, 2009
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2r3 and HDF 4.2r4
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2r4
+
+The HDF 4.2r4 documentation can be found on the The HDF Group's FTP server:
+
+     ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+     http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+     http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF4.2r3
+  -- Utilities
+  -- Library
+  -- Configuration
+- Documentation
+- Platforms tested
+- Known problems
+
+
+New features and changes
+========================
+    Configuration
+    ============= 
+        - Automake 1.10.1 used to generate Makefile.in files, and 
+          Autoconf 2.61 used to generate configure script. MAM - 2008/10/09
+        - Libtool support (2.2.6a) has been added, and HDF4 shared C 
+          libraries can now be built. To build, use the --enable-shared 
+          configuration flag. This needs to be used in conjunction with 
+          the --disable-fortran flag, as Fortran shared libraries are not 
+          supported. Shared libraries are disabled by default. 
+          MAM - 2008/10/09
+        - Added SZIP information to end of configure summary, which indicates
+          whether SZIP is present and, if SZIP is present, whether the SZIP
+          encoder is present.  MAM - 2008/10/06
+
+    Library
+    ========= 
+        - Added new API SDgetdatasize to retrieve the compressed and original
+          sizes of an SDS' data.  Its limitation is listed in the "Known 
+          problems" section at the end of this document.
+          intn SDgetdatasize(int32 sdsid, int32* comp_size, int32* orig_size)
+                sdsid     - IN: dataset ID
+                comp_size - OUT: size of compressed data
+                orig_size - OUT: size of original data 
+          BMR - 2008/10/15
+
+        - The following Fortran APIs were added in this release:
+                sfgetname
+                sfgetnamelen
+                sfgmaxopenf
+                sfgnumopenf
+                sfrmaxopenf
+                sfidtype
+                sfgnvars_byname
+                sfn2indices
+          Please see HDF Reference Manual for functions description.
+          Note: These APIs are not available on Windows.
+
+    Utilities
+    ========= 
+        - hrepack output now includes dataset compression ratios.
+          PVN - 2008/10/30
+        - hdp now displays various parameters of Gzip, Szip, and Skipping
+          Huffman compressions when a dataset is compressed. (Bugzilla 1202)
+          BMR - 2008/10/03
+
+
+Support for new platforms and compilers
+=======================================
+        Linux 2.6.27 x86_64 Fedora 10 with GNU C and gfortran
+                            Ubuntu 8.10 with GNU C and gfortran
+                            OpenSuse 11.1 with GNU C and gfortran
+
+        Mac Intel with GNU C, gfortran, g95 and Intel 10.1 32-bit 
+        C and Fortran compilers
+
+          Note: Only the 32-bit version of the Intel compiler is supported. 
+
+          One has to run configuration scripts, which can be found under 
+          the bin directories in the Intel compiler installation directory 
+          tree (e.g., /opt/intel/cc/10.1.006/bin/iccvars.csh and 
+          /opt/intel/fc/10.1.006/bin/ifortvars.csh), to enable the
+          32-bit version of the compiler before configuring and building HDF4.
+
+          Known problems: 
+          Due to a known bug in the Intel 10.1 icc compiler, one has to use
+          -no-multibyte-chars flag with icc. O0 flag with ifort is required
+          to build Fortran APIs and tests. This restriction is probably due
+          to very old Fortran code and will be lifted for future releases.  
+        
+
+Bugs fixed since HDF4.2r3
+=========================
+    Utilities
+    ========= 
+        - hrepack previously failed to preserve unlimited dataset dimensions; 
+          they are now preserved.  PVN - 2008/11/19
+
+    Library
+    ========= 
+        - SDreaddata now checks for out-of-range values in the parameter 
+          'stride' and fails when invalid values are given (Bugzilla 150.)  
+          This bug was actually fixed right before the HDF4.2r2 release.  
+          BMR - 2008/07/14
+        - Reading a record variable using nc API fills the buffer with fill
+          values up to the maximum number of records of all unlimited
+          dimension variables in the file, as in netCDF.  It used to fail
+          before (Bugzilla 1378.) - BMR 2009/01/21
+        - When the file name is too long, some SD APIs caused a segmentation 
+          fault (Bugzilla 1331.)  This problem is now fixed. - BMR 2009/01/23
+
+    Configuration
+    ============= 
+        - hdiff_array.c now gets linked against libm.a library. 
+
+Documentation
+==============
+The updated HDF Reference Manual is now available in HTML format.
+
+Platforms tested
+================
+
+HDF 4.2 Release 4 has been tested on the following platforms:
+
+    FreeBSD 6.3-STABLE i386       gcc 3.4.6 [FreeBSD] 20060305
+    (duty)                        g++ 3.4.6 [FreeBSD] 20060305
+                                  f77 (gcc) 3.4.6
+                                  gcc 4.2.5 20080702
+                                  g++ 4.2.5 20080702
+                                  gfortran 4.2.5 20080702
+
+    FreeBSD 6.3-STABLE amd64      gcc 3.4.6 [FreeBSD] 20060305
+    (liberty)                     g++ 3.4.6 [FreeBSD] 20060305
+                                  f77 (gcc) 3.4.6
+                                  gcc 4.2.5 20080702
+                                  g++ 4.2.5 20080702
+                                  gfortran 4.2.5 20080702
+
+    IRIX64 6.5                    MIPSpro cc 7.4.4m
+    (ucar mop1 64 & n32)          F90 MIPSpro 7.4.4m
+
+
+    Linux 2.6.18-92.1.22.el5xen   gcc (GCC) 4.1.2 20071124
+         #1 SMP i686 i686 i386    gG95 (GCC 4.0.3 (g95 0.92!) July 1 2008)
+    (jam)                         g77 (GCC) 3.4.6 20060404
+                                  PGI C, Fortran, C++ 7.2-5 32-bit
+                                  Intel(R) C Compiler for 32-bit
+                                      applications, Version 10.1.018
+                                  Intel(R) Fortran Compiler for 32-bit
+                                      applications, Version 10.1.018
+
+    Linux 2.6.9-42.0.10.ELsmp #1  gcc (GCC) 3.4.6
+         SMP i686 i386            g++ (GCC) 3.4.6
+    (kagiso)                      G95 (GCC 4.0.3 (g95 0.92!) April 18 2007)
+
+    Linux 2.6.16.46-0.12-debug #1 Intel(R) C Compiler Version 10.0.025
+        SMP ia64 GNU/Linux        Intel(R) Fortran Itanium(R) Version 10.0.025
+    (ucar hir1)
+
+    Linux 2.6.16.46-0.14-smp #1   gcc (GCC) 4.1.2 20070115 (SUSE Linux)
+        SMP x86_64 GNU/Linux      G95 (GCC 4.0.3 (g95 0.92!) July 1 2008)
+    (smirom)                      Intel(R) C Compiler for Intel(R) EM64T Ver.
+10.1.013
+                                  Intel(R) Fortran Intel(R) EM64T Ver.
+10.1.013
+                                  PGI C, Fortran Version 7.2-1
+                                         for 64-bit target on x86-64
+
+    Linux 2.6.16.54-0.2.5 #1      Intel(R) C Compiler Version 10.1.017
+        Altix SMP ia64            Intel(R) Fortran Itanium(R) Version 10.1.017
+    (cobalt)                      SGI MPI 1.16
+
+    SunOS 5.10 32- and 64-bit     Sun WorkShop 6 update 2 C 5.8
+                                  Patch 121015-06
+    (linew)                       Sun WorkShop 6 update 2 Fortran 95 8.2
+                                  Patch 121019-09
+
+    Xeon Linux 2.6.18-92.1.10.el5_lustre.1.6.6smp-perfctr
+         #2 SMP x86_64            Intel(R) C Compiler Version 10.0.026
+    (abe)                         Intel(R) Fortran Compiler Version 10.0.026
+
+    IA-64 Linux 2.4.21.SuSE_292.til1
+        ia64
+    (NCSA tg-login)               Intel(R) C Compiler Version 8.1.037
+                                  Intel(R) Fortran Compiler Version 8.1.033
+
+
+    Windows XP                    Visual Studio 6.0
+                                  Visual Studio .NET (with Intel Fortran 9.1)
+                                  Visual Studio 2005 (with Intel Fortran 9.1/10.1)
+                                  Visual Studio 2008 (with Intel Fortran 10.1)
+                                  cygwin (gcc 3.4.4 and g95 0.90!)
+
+    Windows XP(64 bit)            Visual Studio 2005 (with Intel Fortran 9.1/10.1)
+                                  Visual Studio 2008 (with Intel Fortran 10.1)
+                                  
+    Windows Vista                 Visual Studio 2008 (with Intel Fortran 10.1)
+                                  cygwin (gcc 3.4.4 and g95 0.90!)
+                                  
+    Windows Vista(64 bit)         Visual Studio 2008 (with Intel Fortran 10.1)
+                                  
+    MAC OS X Intel                Darwin 9.4.0
+                                  i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1
+                                  G95 (GCC 4.0.3 (g95 0.91!) Apr 24 2008)
+                                  gfortran GNU Fortran (GCC) 4.3.0 20070810
+                                  Intel 10.1 32-bit version
+
+    Linux 2.6.27.9-159.fc10.x86_64 #1 SMP 
+        x86_64 GNU/Linux          gcc (GCC) 4.3.2
+     (Fedora 10)                  gfortran GNU Fortran (GCC) 4.3.2 20081105 
+                                                       (Red Hat 4.3.2-7)
+    Linux 2.6.27-9-generic #1 SMP 
+        x86_64 GNU/Linux          gcc (GCC) 4.3.2
+     (Ubuntu 8.10)                gfortran GNU Fortran (GCC) 4.3.2 
+                                                       
+    Linux 2.6.27.7-9-default #1 SMP 
+        x86_64 GNU/Linux          gcc (GCC) 4.3.2
+     (OpenSuse 11.1)              gfortran GNU Fortran (GCC) 4.3.2 
+
+
+Known problems
+==============
+
+o  Existing data written by an HDF4 Library prior to HDF 4.2r2:
+   When a one-dimensional SDS and a dimension scale were created with
+   the same name, subsequent accesses to the dimension scale or to the
+   SDS might corrupt the data.
+
+   HDF4 Library Releases 4.2r2 and later do not allow this conflict to
+   occur.  On the other hand, recent libraries are also unable to detect
+   such conflicts that already exist in a file.  It is therefore STRONGLY
+   recommended to check for such name duplication before working with data 
+   created with a pre-4.2r2 library. 
+
+   The functions SDgetnumvars_byname and SDnametoindices are provided
+   to help detect such name conflicts and select the correct object to
+   access, respectively; see the HDF Reference Manual entries for 
+   further details.
+
+o  This release does not support VMS systems.
+
+o  N-Bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+o  In order for the new API SDgetdatasize to get the correct compressed size
+   of the data, the dataset needs to be closed (SDendaccess) or read
+   (SDreaddata), after being written and before SDgetdatasize is called.
+
+o  On a fedora x86_64 GNU/Linux machine with gfortran 4.3.2, the flag
+   -fno-range-check needs to be used to work around old code.
+   
+o  On Windows with Visual Studio .NET 2003, a minor bug in the hdfnctest test
+    causes it to fail.  The failure is non-critical, and so the test has been
+    disabled by default for all Windows compilers.
+   
+==========================================================================    
+ 
+%%%4.2r3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+                          HDF 4.2 Release 3
+                          =================
+                          January 28, 2008
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2r2 and HDF 4.2r3.  
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2r3.
+
+The HDF 4.2r3 documentation can be found on the THG ftp server:
+
+     ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+     http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+     http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF4.2r2
+  -- Utilities
+  -- Library
+  -- Configuration
+- Documentation
+- Platforms tested
+- Known problems
+
+
+New features and changes
+========================
+    Configuration
+    ============= 
+    None 
+
+    Library
+    ========= 
+
+	- Modified the HDF4 mfhdf library and configure to work in the 
+	  absence of the NetCDF-3 header files when the HDF4 library 
+	  is configured with the --disable-netcdf flag. This feature is 
+	  required when building the ESDIS Toolkit in the presence of the
+	  NetCDF-3 library. In this case, the HDF4 file netcdf.h is used 
+	  to build the HDF4 libraries and is installed under the name 
+	  "hdf4_netcdf.h" to avoid a name clash with the NetCDF-3 file 
+	  netcdf.h.
+							EIP 2007-10-30
+
+	- Note that the previous change to SDnametoindex was backed out.  It 
+	  only returns the first variable of the requested name, as did the 
+	  original version of this function.  The variable can be an SDS or 
+	  a coordinate variable.  With this behavior, if there is more than
+	  one variable with the same name in the file, care must be taken to
+	  retrieve the desired variable.  Please see new APIs in the next 
+	  item for a way to handle non-uniquely named variables.  The behavior 
+	  of SDnametoindex will be documented in FAQs, documentation, and the
+	  newsletter.
+							BMR 2008-01-17
+
+	- Added new APIs to SD interface:
+	  + SDgetnumvars_byname: Given a name, returns the number of 
+	    variables in a file with that same name.
+	  + SDnametoindices: Given a name, returns a list of indices of 
+	    all the variables in a file with that same name.
+	  With these new APIs, users can determine when an SDS name or 
+	  a coordinate variable's name is not unique, retrieve the named 
+	  variables, and examine them.
+							BMR 2008-01-17
+
+    Utilities
+    ========= 
+        None 
+
+
+Support for new platforms and compilers
+=======================================
+        
+    Support for Windows XP 64-bit with Visual Studio 2005 and 
+    Intel Fortran compiler was added. 
+
+Bugs fixed since HDF4.2r2
+=========================
+    Utilities
+    ========= 
+        None
+
+    Library
+    ========= 
+        None
+
+    Configuration
+    ============= 
+       - libhdf4.settings file was not installed by make install command;
+         fixed
+                                                         EIP, 2007-10-09
+
+
+Documentation
+==============
+     Descriptions of the new functions SDgetnumvars_byname and SDnametoindices
+     have been added to the documentation. 
+
+
+Platforms tested
+================
+
+HDF 4.2 Release 3 has been tested on the following platforms:
+
+                                  
+    AIX 5.2 (32/64 bit)           xlc 8.0.0.11
+    (datstar)                     xlf 10.01.0000.0002
+
+    FreeBSD 6.2 (32- and 64-bit)  gcc  and f77 GNU 3.4.6
+    (duty and liberty)            GNU Fortran (GCC) 4.2.3 20080123 
+
+    IRIX64 6.5                    MIPSpro cc 7.4.4m
+    (ucar mop1 64 & n32)          F90 MIPSpro 7.4.4m 
+
+    Linux 2.4.21-47.ELsmp #1 SMP  gcc and g77 3.2.3
+        i686 i386 GNU/Linux
+    (osage)
+
+    Linux 2.6.9-42.0.10.ELsmp #1  gcc (GCC) 3.4.6
+        SMP i686 i386             G95 (GCC 4.0.3 (g95 0.91!) April 18 2007)
+    (kagiso)                      PGI C, Fortran 7.0-7 32-bit 
+                                  icc (ICC) 9.1 
+                                  Intel(R) Fortran Compiler for 32-bit 
+                                      applications, Version 9.1 
+
+    Linux 2.6.16.46-0.12-debug #1 Intel(R) C++ Version 10.0.025
+        SMP ia64 GNU/Linux        Intel(R) Fortran Itanium(R) Version 10.0.025
+    (ucar hir1)                   
+
+    Linux 2.6.16.46-0.14-smp #1   Intel(R) C for Intel(R) EM64T Ver. 9.1.037
+        SMP x86_64 GNU/Linux      Intel(R) Fortran Intel(R) EM64T Ver. 9.1.031
+    (smirom)                      gcc (GCC) 4.1.2 20070115 (SUSE Linux)
+                                  G95 (GCC 4.0.3 (g95 0.91!) Apr 19 2007)
+
+    Linux 2.6.5-7.283-rtgfx Altix Intel(R) C++ Version 9.0.032
+        SMP ia64                  Intel(R) Fortran Itanium(R) Version 9.0.033
+    (cobalt)                      
+
+    SunOS 5.8 32- and 64-bit      Sun WorkShop 6 update 2 C 5.3
+    (sol)                         Sun WorkShop 6 update 2 Fortran 77 5.3
+
+    SunOS 5.10 32- and 64-bit     Sun WorkShop 6 update 2 C 5.8 
+                                  Patch 121015-06
+    (linew)                       Sun WorkShop 6 update 2 Fortran 95 8.2
+                                  Patch 121019-09 
+
+    IA-64 Linux 2.4.21.SuSE_292.til1
+        ia64                      
+    (NCSA tg-login)               Intel(R) C++ Version 8.1.037
+                                  Intel(R) Fortran Compiler Version 8.1.033
+
+    Windows XP                    Visual Studio 6.0
+                                  Visual Studio .NET (with Intel Fortran 9.1)
+                                  Visual Studio 2005 (with Intel Fortran 9.1)
+                                  cygwin (gcc 3.4.4)
+
+    Windows XP(64 bit)            Visual Studio 2005(with Intel Fortran 9.1)
+                                  
+    Windows Vista                 Visual Studio 2005 (no fortran)
+                                  
+    MAC OS X Intel                Darwin 8.10.1
+                                  i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1
+                                  g95 0.91
+                                  gfortran GNU Fortran (GCC) 4.3.0 20070518
+
+
+Known problems
+==============
+
+o  hdfcomp fails on HPUX 11.23 for the 64-bit version of the library.
+
+o  This release does not support VMS systems.
+
+o  N-Bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  For existing data prior to HDF 4.2r2, when a one-dimensional SDS has the 
+   same name as the dimension scale, subsequent accesses to the dimension scale
+   or the SDS might produce undesired results.  It is recommended to check
+   for name duplication first.  See "New features and changes" section for 
+   details.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+%%%4.2r2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+
+                          HDF 4.2 Release 2
+                          October 4, 2007
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2r1 and
+HDF 4.2r2.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.2r2.
+
+The HDF 4.2r2 documentation can be found on the THG ftp server 
+(ftp.hdfgroup.org) in the directory:
+
+     ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the FAQ for this
+release for more information about HDF.  Also see the home page 
+for HDF at:
+
+     http://hdfgroup.org/
+
+If you have any questions or comments, please send them to:
+
+     help at hdfgroup.org
+
+CONTENTS
+
+- New features and changes
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF4.2r1
+  -- Utilities
+  -- Library
+- Documentation
+- Platforms tested
+- Known problems
+
+New features and changes
+========================
+    Configuration
+    ============= 
+        - The default installation directory name was changed from "NewHDF" 
+          to "hdf4".                            EIP - 2007/08/06
+        - Introduced --enable-netcdf configure flag to provide an option to
+          enable/disable "HDF4-NetCDF"-like interfaces. By default, the 
+          HDF4 netcdf feature is enabled.  Use the --disable-netcdf 
+          configuration flag to build HDF4 C and Fortran libraries that can 
+          be used by NetCDF-3 applications. There is no longer a need to 
+          specify the -DHAVE_NETCDF compilation flag.  This feature is not 
+          yet supported on Windows.             EIP - 2007/09/05
+        - Updated versions of autotools. HDF4 now uses automake 1.10.0,
+          autoconf 2.61, and libtool 1.5.22.    MAM - 2007/7/25.
+        - The Fortran part of the HDF4 library uses the F77_FUNC macro to 
+          mangle names of C functions called from Fortran APIs. This should 
+          help with HDF4 code portability to different Fortran compilers.
+                                                EIP - 2006/12/19
+     
+    Library
+    ========= 
+        - SZIP compression is supported now for GR C interfaces
+                                                EIP - 2007/09/15
+        - Added new Fortran function hconfinf that determines whether the 
+          SZIP compression method is present and whether encoding is available.
+        - Added support for SZIP compression in Fortran.
+                                                EIP - 2007/09/01
+        - The following APIs were added; see "Bugs fixed" section for details.
+          SDreset_maxopenfiles -- Resets the maximum number of files that can 
+                  be open at a time.
+          SDget_maxopenfiles -- Retrieves the current number of open files
+                  allowed in HDF and the maximum number of open files allowed 
+                  on a system.
+          SDget_numopenfiles -- Returns the number of files currently open.
+          SDgetcompinfo -- Replaces SDgetcompress.
+          GRgetcompinfo -- Replaces GRgetcompress.
+          SDgetfilename -- Retrieves the name of the file, given its ID.
+          SDgetnamelen -- Retrieves the name length of the object, given its ID.
+          Note: Fortran wrappers for these new APIs are not available in this 
+          release.  BMR - 2007/09/23
+        - SDS and vgroup names are no longer limited to 64 characters
+          (Bugzilla #516).  Note that when an older version of the library 
+          reads a new name that is longer than 64 characters, the name will
+          contain some garbage after 64 characters.  BMR - 2006/10/12
+        - User reported that SDreaddata went into an infinite loop when 
+          reading some corrupted compressed data.  This problem is fixed.
+          Two new error codes were added, consequently:
+                DFE_READCOMP  - when the zlib function returns
+                        Z_ERRNO        (-1) or
+                        Z_STREAM_ERROR (-2) or
+                        Z_DATA_ERROR   (-3) or
+                        Z_MEM_ERROR    (-4) or
+                        Z_BUF_ERROR    (-5)
+
+                DFE_COMPVERSION - when the zlib function returns
+                        Z_VERSION_ERROR (-6)
+
+
+    Utilities
+    ========= 
+        - hrepack repacks by hyperslabs for large (non-compressed) datasets.
+                                                         PVN - 2007/7/10
+        - hdiff enables reading by hyperslabs. This feature was added to 
+          handle very large datasets, where available memory is a isssue. 
+                                                         PVN - 2007/6/13
+        - hdiff now shows indices in multidimensional array notation. 
+                                                         PVN - 2007/4/5
+        - hdiff now shows the name of the array when printing differences. 
+                                                         PVN - 2007/4/5
+        - hdiff now shows a list of all objects in verbose mode. 
+                                                         PVN - 2007/4/5
+        - hdiff return code is now 1 if differences are found, 0 if no
+          differences are found, and -1 for an error.    PVN - 2007/4/5
+        - hdiff has a new option, -p, for relative error. See usage. 
+                                                         PVN - 2007/4/5
+        - hrepack now prints chunk information along with the compression 
+          type in verbose mode.                          PVN - 2007/4/5
+         
+
+Support for new platforms and compilers
+=======================================
+        - Added support for gfortran and g95 on Mac Intel.
+                                       EIP 2007/09/14
+        - Added support for gfortran on FreeBSD for both 32- and 64-bit. 
+        - Added support for FreeBSD on AMD64 with gcc compilers.
+                                       EIP 2007/05/24
+        - Added support for MAC OS X Intel with gcc and g95 compilers.
+        - Added support for SUNOS 5.10 on Intel with SUN compilers (32- and
+          64-bit modes).               EIP 2006/12/14
+        - Added support for HPUX 11.23 (32- and 64-bit modes).
+                                        EIP 2006/12/19
+
+Bugs fixed since HDF4.2r1
+=========================
+     Utilities
+    ========= 
+        - hrepack: Repeated vgroup insertions (duplicated links) were not being 
+          replicated.  PVN - 2007/9/10
+        - hrepack: Improved performance for large number of SDSs, through the 
+          elimination of redundant file open calls.  PVN - 2007/4/5
+        - hrepack: Fixed a bug in the -t option so that it now accepts multiple
+          comma-separated names.  PVN - 2007/4/5
+        - hrepack: Now duplicates dimension SDSs that are not accessed from any 
+          other SDSs.  PVN - 2007/4/5
+        - hrepack: Fixed a bug that caused the unchunking of a dataset when
+          uncompressing was requested.  PVN - 2007/4/5
+
+    Library
+    ========= 
+        - Added display of the compression method to hdp dumpsds and dumpgr
+          (Bugzilla #130).  BMR - 2005/4/4
+        - The current SDgetcompress and GRgetcompress APIs have severe flaws.
+          Two new APIs, SDgetcompinfo and GRgetcompinfo, were added to 
+          provide better functionality and will eventually replace 
+          SDgetcompress and GRgetcompress.  BMR - 2005/4/4
+        - Applied user's patch to fix bug #602.  BMR - 2005/4/23
+        - Added a switch ('u') to ncdump to replace nonalpha-numeric characters
+          with underscores.  Thus, the SDS names won't be changed automatically 
+          unless the user so requests (Access bug #934/Bugzilla #381).
+          BMR - 2005/7/17
+        - In HDF4.2r0, SDwritedata failed when the SDS had rank=0 (bug #1045).
+          This change was retracted; writing to an SDS with rank=0 is allowed 
+          again.  BMR - 2005/8/23
+        - When a dimension has the same name as an SDS, depending on the
+          order in which they were created, either the SDS or the dimension
+          will be corrupted if certain operations occur, such as a SDsetdimscale
+          or SDsetattr call to the dimension.  With this bugfix, the current 
+          situation can be summarized as below:
+              + Data that has already been corrupted cannot be recovered.
+              + For existing data that has not yet been corrupted, the problem 
+                has been fixed for multi-dimensional SDSs only.  If the SDS had
+                only one dimension, the results of subsequent accesses to the 
+                dimension would still be unpredictable (Bugzilla #328).  
+                BMR - 2005/8/23
+              + For future data, the problem has been fixed (Bugzilla #624).
+                BMR - 2007/6/24
+        - Allowing the maximum number of open files to be increased revealed
+          a problem: having more than 255 files open will cause file
+          corruption (Bugzilla #440).  Specifically, file number (255*m)+n 
+          will overwrite file number n, where n is [0..255] and m is [1..p], 
+          where (255*p) <= maximum system allowed.  This problem is fixed.
+          In addition, a new API is added for convenience:
+                SDgetfilename -- retrieves the name of the file given its ID.
+          BMR - 2005/10/05
+        - Prior to this release, the maximum number of files that can be open
+          at the same time was only 32. This limit was implemented as a 
+          defined constant in the library, which users could not change without 
+          recompiling the library. In this release, if this limit is reached, 
+          the library will increase it to the system limit, minus 3 to account 
+          for stdin, stdout, and stderr.  In addition, three APIs are added 
+          for more flexibility (Bugzilla #396/Access bug #935):  
+                SDreset_maxopenfiles -- Resets the maximum number of files 
+                        that can be open at a time.
+                SDget_maxopenfiles -- Retrieves the current number of open 
+                        files allowed in HDF and the maximum number of open 
+                        files allowed on a system.
+                SDget_numopenfiles -- Returns the number of files currently 
+                        open.
+          Note:
+            (1) Because there are also stdin, stdout, and stderr, the maximum
+                limit that can be set must only be (system limit) - 3.
+            (2) If the system maximum limit is reached, the library will 
+                push the error code DFE_TOOMANY onto the error stack.
+                The user application can detect this after an SDstart fails.
+          BMR - 2005/10/21
+        - The problem where ncgen failed with "too many attributes" on 
+          some user files is fixed (Bugzilla #373).  BMR - 2005/10/28
+        - The problem where SDcheckempty returns "not empty" for empty 
+          chunked and compressed datasets is fixed (Bugzilla #218).
+          BMR - 2005/10/31
+        - If a VSgetattr was called twice for an attribute, the second call 
+          would fail (Bugzilla #486).  This problem is fixed.  BMR - 2005/12/30
+        - A bug with reading metadata in hdfimport is fixed (Bugzilla #558).
+          BMR - 2006/9/23
+        - The problem of writing to two unlimited 1-D arrays is fixed
+          (Access bug #525).  BMR - 2006/11/11
+
+Documentation
+==============
+    Documentation contains multiple bug fixes and improvements. 
+
+Platforms tested
+================
+
+HDF 4.2 Release 2 has been tested on the following platforms:
+
+                                  
+    AIX 5.3 (32/64 bit)           xlc 7.0.0.0
+    (copper)                      xlf 9.1.0.3
+
+    FreeBSD 6.2 (32- and 64-bit)  gcc  and f77 GNU 3.4.6
+    (duty and liberty)            GNU Fortran (GCC) 4.2.2 20070905 
+
+    HP-UX B.11.23 (32- and 64-bit)HP aC++/ANSI C B3910B A.06.02
+    (sirius)                      HP F90 v3.1 
+
+    IRIX64 6.5                    MIPSpro cc 7.4.4m
+    (ucar mop1 64 & n32)          F90 MIPSpro 7.4.4m 
+
+    Linux 2.4.21-47.ELsmp #1 SMP  gcc and f77 3.2.3
+        i686 i386 GNU/Linux
+    (osage)
+
+    Linux 2.6.9-42.0.10.ELsmp #1  gcc (GCC) 3.4.6
+        SMP i686 i386             G95 (GCC 4.0.3 (g95 0.91!) Nov 21 2006)
+    (kagiso)                      PGI C, Fortran, C++ 6.2-5 32-bit 
+                                  icc (ICC) 9.1 
+                                  Intel(R) Fortran Compiler for 32-bit 
+                                      applications, Version 9.1 
+
+    Linux 2.6.16.46-0.12-debug #1 
+        SMP ia64 GNU/Linux        Intel(R) C++ Version 10.0.025
+    (ucar hir1)                   Intel(R) Fortran Itanium(R) Version 10.0.025
+
+    Linux 2.6.16.46-0.14-smp #1   Intel(R) C++ for Intel(R) EM64T Ver. 9.1.037
+        SMP x86_64 GNU/Linux      Intel(R) Fortran Intel(R) EM64T Ver. 9.1.031
+    (smirom)                      gcc (GCC) 4.1.2 20070115 (SUSE Linux)
+                                  G95 (GCC 4.0.3 (g95 0.91!) Apr 19 2007)
+
+    Linux 2.6.5-7.283-rtgfx Altix 
+        SMP ia64                  Intel(R) C++ Version 9.0
+    (cobalt)                      Intel(R) Fortran Itanium(R) Version 9.0
+
+
+    SunOS 5.8 32- and 64-bit      Sun WorkShop 6 update 2 C 5.3
+    (sol)                         Sun WorkShop 6 update 2 Fortran 95 6.2
+
+    SunOS 5.10 32- and 64-bit     Sun WorkShop 6 update 2 C 5.8
+    (linew)                       Sun WorkShop 6 update 2 Fortran 95 8.2
+                                  Patch 121019-06 
+
+
+    IA-64 Linux 2.4.21.SuSE_292.til1
+        ia64                      gcc (GCC) 3.2.2
+    (NCSA tg-login)               Intel(R) C++ Version 8.0
+                                  Intel(R) Fortran Compiler Version 8.0
+
+    Windows XP                    Visual Studio 6.0
+                                  Visual Studio .NET (with Intel Fortran 9.1)
+                                  Visual Studio 2005 (with Intel Fortran 9.1)
+                                  cygwin (gcc 3.4.4)
+                                  
+    Windows Vista                 Visual Studio 2005 (no fortran)
+                                  
+    MAC OS X Intel                Darwin 8.10.1
+                                  i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1
+                                  g95 0.91
+                                  gfortran GNU Fortran (GCC) 4.3.0 20070518
+
+                                  
+
+Known problems
+==============
+
+o  hdfcomp fails on HPUX 11.23 for the 64-bit version of the library
+
+o  This release does not support VMS systems.
+
+o  N-Bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When a one-dimensional SDS has the same name as the dimension, subsequent
+   accesses to the dimension produce unpredictable results.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with JPEG built with gcc causes JPEG library 
+   tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+%%%4.2r1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+                          HDF 4.2 Release 1
+                            February, 2005
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2r0 and
+HDF 4.2r1.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.2r1
+
+The HDF 4.2r1 documentation can be found on the NCSA ftp server 
+(ftp.ncsa.uiuc.edu) in the directory:
+
+     ftp://hdf.ncsa.uiuc.edu/HDF/Documentation/
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look
+at the home page for HDF at:
+
+     http://hdf.ncsa.uiuc.edu/
+
+If you have any questions or comments, please send them to:
+
+     hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+  -- Configuration
+  -- Library
+  -- Utilities
+- Support for new platforms and compilers
+- Bugs fixed since HDF4.2r1
+- Documentation
+- Platforms Tested
+- Known problems
+
+New Features and Changes:
+========================
+    Configuration
+    ============= 
+     
+     * By default HDF4 libraies and utilities are installed under 
+       <source_dir>/NewHDF
+                                               12/01/2004 EIP
+     * Windows configuration, build and testing procedures have been changed. 
+       Please see INSTALL_WINDOWS.txt file for more information
+                                               02/12/2005 EIP 
+    Library
+    ========= 
+    * New API SDidtype was added to the library (bug #766)
+                                               01/23/2005 EIP for BMR
+    * HCgetcompress renamed to HCPgetcompress
+    * New API HCget_config_info added
+    * The default chunk cache size was changed for 2D and higher
+      chunks
+    * Pablo instumentation was removed
+   
+    Utilities
+    ========= 
+     * hdiff and hrepack are supported on Windows.
+     * Substantial performance improvements in hdiff and hrepack
+
+Support for new platforms and compilers
+=======================================
+     * Fortran IBM xlf v 8.1 and Absoft f95 version 8.2 compilers 
+       are supported on Mac OSX.
+                                                          12/07/2004 EIP
+     * Absoft Fortran compiler f95 version 9.0 is supported on Linux 2.4 
+                                                          12/07/2004 EIP
+     * PGI C and Fortran compilers are supported on Linux 2.4 
+     * Intel C and Fortran compilers are supported on Linux 2.4
+     * AMD Opteron is supported
+
+
+Bugs fixed since HDF4.2r0
+=========================
+ * VERY IMPORTANT:
+   Data compressed with SZIP may be corrupted; fixed. For more
+   information see "HDF4.2r1 SZIP Release Notes" available at
+   http://hdf.ncsa.uiuc.edu/doc_resource/SZIP/SZIP_HDF4_2r1.pdf
+                                            02/12/2005 EIP 
+ * Fortran couldn't read names with spaces when NetCDF interfaces
+   were used; fixed
+                                            02/12/2005 EIP
+ * Library failed to compile in presence of the NetCDF library; fixed
+                                            11/22/2004 EIP
+ * h4fc couldn't create object files; fixed 
+
+                                            01/23/2005 EIP
+ * When rank of SDS is 0, some SD APIs give segmentation fault (bug 1045);
+   fixed
+                                            01/23/2005 EIP for BMR
+ * Some GR images with special elements are read in as duplicate
+   (bug 814); fixed
+                                            02/14/2005 BMR
+
+ * Many bugs fixed in hdiff and hrepack utilities
+
+Documentation
+==============
+   Documentation contains multiple bug fixes and improvements. 
+
+Platforms Tested
+================
+
+HDF 4.2 Release 1 has been tested on the following platforms:
+
+    AIX 5.1  (32 and 64-bit)      xlc 6.0.0.6
+                                  xlf 8.1.1.6
+    AIX 5.2  (32 and 64-bit)      xlc 6.0.0.8
+                                  xlf 8.1.1.7
+    Cray SV1 10.0.1.2             Cray Standard C Version 6.6.0.3.6
+                                  Cray Fortran: Version 3.6.0.3.1
+    Cray TS IEEE                  Cray Standard C Version 6.4.0.3
+                                  Cray Fortran: Version 3.4.0.0
+
+    FreeBSD 4.9                   gcc 2.95.4
+                                  GNU Fortran 0.5.25 
+    HP-UX B.11.00                 HP C  HP92453-01 A.11.01.20 
+                                  HP F90 v2.4
+                                  HP ANSI C++ B3910B A.03.13
+
+    IRIX64 6.5 (64 & n32)         MIPSpro cc 7.3.1.3m
+                                  F90 MIPSpro 7.3.1.3m 
+
+    Linux 2.4.20.28               gcc 2.96, GNU Fortran 0.5.25,
+                                  Absoft Fortran 9.0
+                                  Intel(R) C++ and Fortran Compilers 
+                                  Version 8.1
+    Linux 2.4.21-268-smp #1 SMP x86_64 (AMD)
+                                  gcc 3.3.1
+                                  GNU Fortran (GCC) 3.3.1
+                                  Intel(R) C++ and Fortran Compilers
+                                  Version 8.1
+                                  PGI C and Fortran Compilers Version 5.2-1
+    Linux 2.4.21-27.0.1.ELsmp #1 SMP
+                                  gcc 3.2.3
+                                  PGI C and Fortran Compilers Version 5.2-1 
+
+    Linux 2.4.21-sgi303rp05012313_10138 (Altix) 
+                                  Intel C++ and Intel Fortran Verison 8.1
+    
+    Linux 2.4.20-31.9smp_perfctr_lustre (IA-32)
+                                  Intel(R) C++ Version 8.0
+                                  Intel(R) Fortran Compiler Version 8.0
+    Linux 2.4.21.SuSE_241.bef1 (IA-64)
+                                  Intel(R) C++ Version 8.0
+                                  Intel(R) Fortran Compiler Version 8.0
+   
+    OSF1 V5.1                     Compaq C V6.5-303 
+				  HP Fortran V5.5A-3548
+                                  HP Fortran Compiler X5.5A-4085-48E1K
+
+    SunOS 5.7(32 and 64 bit)      WorkShop Compilers 5.0 98/12/15 C 5.0
+     (Solaris 2.7)                
+                                  WorkShop Compilers 5.0 99/09/16 FORTRAN 77 5.0 patch 107596-03
+                                  gcc 3.2.2
+                                  g77 GNU Fortran (GCC 3.2.2) 3.2.2 
+    SunOS 5.8(32 and 64 bit)      Sun WorkShop 6 update 2 C 5.3
+     (Solaris 2.8)                Sun WorkShop 6 update 2 Fortran 77 5.3 
+
+    SunOS 5.9 (32 and 64 bit)     Sun C 5.6 compiler, Sun Fortran 95 8.0
+
+    Windows 2000 (NT5.0)          MSVC++ 6.0
+                                  DEC Visual Fortran 6.0
+                                  Intel C and F90 compilers version 7.1
+    Windows XP                    MSVC++.NET, Intel Fortran 8.1 (static libraries only)
+    MAC OS X Darwin 7.7           gcc  3.3
+                                  IBM Fortran xlf 8.1
+                                  Absoft Fortran 8.2
+                                  
+                                  
+
+Known problems
+==============
+
+o  SZIP Library is not available for Crays SV1 and TS
+   Fortran APIs do not support SZIP compression.
+
+o SZIP compression cannot be used with GR interfaces. For more information
+  see "HDF4.2r1 SZIP Release Notes" available at 
+  http://hdf.ncsa.uiuc.edu/doc_resource/SZIP/SZIP_HDF4_2r1.pdf
+
+o  This release doesn't support VMS system.
+
+o  N-Bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets doesn't work.
+
+o  SDgetdimscale incorrectly returns FAIL and or returns incorrect data
+   when the associated SDS has the same name as the dimension.
+
+o  When using PGI compilers make sure that JPEG library is also compiled with 
+   PGI C compiler; linking with JPEG built with gcc causes JPEG library tests
+   to fail.  To bypass the problem
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+          where $PGI_JPEG_INSTALL_DIR points to the installtion directory
+          for the PGI-compiled JPEG library:
+
+          setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use  --with-jpeg=$PGI_JPEG_INSTALL_DIR
+         configure flag to configure with the PGI-compiled JPEG library:
+
+          ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+%%%4.2r0%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+                          HDF 4.2 Release 0
+                           December 2003
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.1r5 and
+HDF 4.2r0.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.2r0
+
+The HDF 4.2r0 documentation can be found on the NCSA ftp server 
+(ftp.ncsa.uiuc.edu) in the directory:
+
+     ftp://hdf.ncsa.uiuc.edu/HDF/Documentation/
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look
+at the home page for HDF at:
+
+     http://hdf.ncsa.uiuc.edu/
+
+If you have any questions or comments, please send them to:
+
+     hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Support for new platforms
+- Bugs fixed since HDF4.1r5
+- Documentation
+- Platforms Tested
+- Known problems
+
+New Features and Changes:
+========================
+
+o IMPORTANT: HDF4 HAS A NEW CONFIGURATION 
+
+  ZLIB and JPEG libraries were removed from the HDF4 distribution source.
+  ZLIB and JPEG have to be installed on the system before HDF4 library
+  can be built or HDF4 precompiled binaries can be used.
+  Please read INSTALL in the top HDF4 directory for instructions
+  how to build the HDF4 library and applications.
+
+o HDF4 has an optional SZIP compression method; in order to use SZIP compression,
+  SZIP library has to be installed on the system. Please refer to the INSTALL 
+  file for instructions on how to build with/without the SZIP Library.
+  SZIP in HDF4 is free for non-commercial use; 
+  see http://hdf.ncsa.uiuc.edu/doc_resource/SZIP/Commercial_szip.html 
+  for information regarding commercial use. 
+
+  For more information about SZIP compression
+  see http://hdf.ncsa.uiuc.edu/doc_resource/SZIP/ and 
+  the "HDF4 Reference Manual" entries for the GRsetcompress and 
+  SDsetcompress functions. 
+
+o IMPORTANT note about prebuild binaries:
+
+  NCSA precompiled binaries has SZIP compression method enabled for all platforms
+  except Crays T3E and SV1 and Linux 2.4 SuSE x86_64. To use the binaries download
+  the SZIP library from http://hdf.ncsa.uiuc.edu/doc_resource/SZIP/
+
+o The following new tools have been added
+
+      hrepack
+      hdiff
+      hdfimport
+
+  See "HDF4 Reference Manual" in the HDF 4.2r0 documentation set for more
+  information.
+
+o fp2hdf is removed. It is replaced with hdfimport.
+
+o Helper scripts to facilitate HDF4 installation and compilation were added:
+  
+      h4cc   - to compile C application with the HDF4 Libraries
+      h4fc   - to compiler Fortran applications with the HDF4 Libraries
+      h4redeploy - to fix binary installation
+
+  See "HDF4 Reference Manual" in the HDF 4.2r0 documentation set for more
+  information.
+
+Support for new platforms 
+=========================
+
+o HDF4 was ported to the following platforms
+
+      AIX 5.1 64-bit version
+      MacOSX
+      Linux 2.4 RH8 and RH9 
+      Linux 2.4 RH8 64-bit, SuSE 64-bit
+      Linux 2.4 ia64
+      Linux 2.4 SGI (Altrix)
+
+
+Bugs fixed since HDF4.1r5
+=========================
+
+1. "hdp dumpgr" and "hdp dumpsds" have two new options:
+        -g to suppress the data of global (or file) attributes
+        -l to suppress the data of local attributes
+
+2. The problem where hdp failed on a very long file name has been
+   fixed. (bug #693)
+
+3. The problem where VSinquire failed when being called on a vdata
+   that had no fields defined, has been fixed. (bug #626)
+
+4. When the values of VGNAMELENMAX and VSNAMELENMAX are changed
+   the hdp output doesn't reflect the change. This problem is 
+   now fixed. (bug #606)
+
+5. hdp dumpvg sometimes failed when reading a file that had a vgroup 
+   being inserted into another.  This has been fixed. (bug #477)
+
+6. hdf2gif failed when a user tried it on JPEG compressed images. (Bug #601).
+   The problem is now fixed. An error message is displayed if the image is not
+   8-bit. If the image is 24-bit, the message suggests using hdf2jpeg.
+
+7. ncdump failed to read NetCDF files 3.5 when there was more than one variable
+   with unlimited dimensions. Fixed.
+
+8. The NetCDF part of the HDF4 library was not ported to Compaq True64 system. 
+   Fixed.
+
+9. The hdp commands dumpsds, dumpgr, dumpvd, and dumpvg now display an 
+    informative message when a non-HDF file is given as input. (Bug #817)
+
+10. The compilation warnings and error on the macro HDFclose are fixed.
+    (Bug #818)
+
+Documentation
+==============
+
+    Entries for new utilities hdiff, hrepack, hdfimport and helper
+    scripts h4cc, h4fc, and h4redeply were added to the Reference Manual.
+
+Platforms Tested
+================
+
+HDF 4.2 Release 0 has been tested on the following platforms:
+
+    AIX 5.1  (32 and 64-bit)      xlc 6.0.0.2
+                                  xlf 8.1.1
+    Cray T3E sn6606 2.0.6.08      Cray Standard C Version 6.6.0.2
+                                  Cray Fortran Version 3.6.0.2
+    Cray SV1 sn9617 10.0.1.2      Cray Standard C Version 6.6.0.2
+                                  Cray Fortran Version 3.6.0.2
+    FreeBSD 4.9                   gcc 2.95.4
+                                  g++ 2.95.4
+    HP-UX B.11.00                 HP C  HP92453-01 A.11.01.20 
+                                  HP F90 v2.4
+                                  HP ANSI C++ B3910B A.03.13
+    IRIX64 6.5 (64 & n32)         MIPSpro cc 7.3.1.3m
+                                  F90 MIPSpro 7.3.1.3m 
+    Linux 2.4.20-20.7 (RH8)       gcc 3.3.1
+                                  Intel(R) C++ Version 7.1
+                                  Intel(R) Fortran Compiler Version 7.1
+    Linux 2.4.20-20.9 (RH9)       gcc 3.2.2
+    Linux 2.4.21-2.9.5ws x86_64   gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-16)
+                                  g77 based on gcc version 3.2.3
+    Linux 2.4.19-SMP #1 x86_64    gcc version 3.3.2 (SuSE Linux)
+                                  g77 version 3.3.2
+    OSF1 V5.1                     Compaq C V6.4-014
+				  Compaq Fortran V5.5-1877
+    SunOS 5.7(32 and 64 bit)      WorkShop Compilers 5.0 98/12/15 C 5.0
+     (Solaris 2.7)                WorkShop Compilers 5.0 98/10/25 
+                                  FORTRAN 77 5.0
+                                  gcc 3.2.2
+                                  g77 GNU Fortran (GCC 3.2.2) 3.2.2 
+    SunOS 5.8(32 and 64 bit)      Sun WorkShop 6 update 2 C 5.3
+     (Solaris 2.8)                Sun WorkShop 6 update 2 Fortran 77 5.3 
+
+    IA-32 Linux 2.4.9-31pctr      Intel(R) C++ Version 7.0
+                                  Intel(R) Fortran Compiler Version 7.0
+                                  
+    IA-64 Linux 2.4.16 ia64       Intel(R) C++ Version 7.0
+                                  Intel(R) Fortran Compiler Version 7.0
+    IA-64 Linux 2.4.19-SMP        Intel(R) C++  Version 7.1
+                                  Intel(R) Fortran Compiler Version 7.1
+                                  gcc 3.2
+                                  g77 GNU Fortran (GCC 3.2) 3.2
+    IA-64 Linux 2.4.21-sgi        Intel(R) C++  Version 7.1
+    (Altrix)                      Intel(R) Fortran Compiler Version 7.1
+    Windows 2000 (NT5.0)          MSVC++ 6.0
+                                  DEC Visual Fortran 6.0
+                                  Intel C and F90 compilers version 7.1
+    Windows XP                    MSVC++.NET
+    MAC OS X                      Darwin 6.8
+                                  gcc Apple Computer, Inc. GCC 
+                                  version 1175, based on gcc version 3.1
+                                  
+
+Known problems
+==============
+
+o  SZIP Library is not available for Crays SV1 and T3E
+   Fortran APIs do not support SZIP compression.
+
+o  NetCDF tests nctest (C) and ftest (Fortran) fail to read from NetCDF 3.5 files
+
+o  On Linux RH8 64-bit SZIP tests fail if library is compiled in production
+   mode. All tests pass in the debug mode.
+
+o  This release doesn't support VMS system.
+
+o  On Linux with gcc compilers Fortran NetCDF APIs cannot read attributes, variables,
+   and dimensions when name contain spaces.
+
+o  HDF4 Library cannot be built with PGI compilers.
+
+o  N-Bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets doesn't work.
+
+o  --prefix defines where the installation path is.  This version has
+   the default set as /usr/local which is different from previous versions.
+
+o  New utilities hdiff and hrepack are not available for Windows 2000.
+
+%%%4.2r0-Beta%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                          ABOUT HDF 4.2 Release 0-Beta
+                               September 2003
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.1r5 and
+HDF 4.2r0-Beta.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.2r0-Beta
+
+The HDF 4.2r0-Beta documentation can be found on the NCSA ftp server 
+(ftp.ncsa.uiuc.edu) in the directory:
+
+     /HDF/pub/outgoing/hdf4/4.2-Beta/
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look
+at the home page for HDF at:
+
+     http://hdf.ncsa.uiuc.edu/
+
+If you have any questions or comments, please send them to:
+
+     hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+
+New Features and Changes:
+========================
+
+o ZLIB and JPEG libraries were removed from the HDF4 distribution source.
+  Please read INSTALL-4.2r0-Beta in the top HDF4 directory for instructions
+  how to build HDF4 Library and applications.
+
+o HDF4 has an optional SZIP compression; please refer to the INSTALL-4.2r0-Beta 
+  file for instructions how to build with/without the SZIP Library.
+  SZIP in HDF4 is free for non-commercial use; 
+  see http://hdf.ncsa.uiuc.edu/doc_resource/SZIP/Commercial_szip.html 
+  for information regarding commercial use. 
+
+  For more information about SZIP compression
+  see http://hdf.ncsa.uiuc.edu/HDF5/doc_resource/SZIP/ and the "HDF4 Reference Manual"
+  entries for the GRsetcompress and SDsetcompress functions. 
+
+o The following new tools have been added
+
+      hrepack
+      hdiff
+      hdfimport
+
+  See "HDF4 Reference Manual" in the HDF 4.2r0-Beta documentation set for more
+  information.
+
+o HDF4 was ported to the following platforms
+
+      AIX 5.1 64-bit version
+      MacOSX
+      Linux 2.4 RH8 and RH9
+
+Please refer to the bugs_fixed.txt file for more details on bugs that were 
+fixed.
+
+
+Platforms Tested:
+================
+
+HDF 4.2 Release 0-Beta has been tested on the following platforms:
+
+   FreeBSD 4.9
+   HP-UX B.11.00 
+   AIX 5.1 (32 and 64-bit)
+   IRIX64 6.5 (-n32, -64)
+   Linux 2.4
+   Solaris 2.7, 2.8 (32 and 64-bit)
+   MacOSX
+
+   No precompiled binaries is available for this release.
+
+
+
+%%%4.1r5%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                          ABOUT HDF 4.1 Release 5 
+                               November 2001 
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.1r4 and
+HDF 4.1r5.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.1r5.
+
+The HDF 4.1r5 documentation can be found on the NCSA ftp server 
+(ftp.ncsa.uiuc.edu) in the directory:
+
+     /HDF/HDF/Documentation/HDF4.1r5/
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look
+at the home page for HDF at:
+
+     http://hdf.ncsa.uiuc.edu/
+
+If you have any questions or comments, please send them to:
+
+     hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+
+New Features and Changes:
+========================
+
+o The following Vdata routines were added:
+
+     VSsetblocksize/vsfsetblsz -- sets the block size of the 
+                                  linked-block element.
+     VSsetnumblocks/vsfsetnmbl -- sets the number of blocks for 
+                                  a linked-block element.
+     VSgetblockinfo/vsfgetblinfo -- retrieves the block size and the number 
+                                    of blocks of a linked-block element.
+
+o  Two routines were added to get compression information for the SD and
+   GR interfaces, including chunked elements: SDgetcompress/sfgcompress 
+   and GRgetcompress/mggcompress. 
+
+   Note: 
+
+   - For a JPEG image, GRgetcompress only returns the compression type, not 
+     the compression information (i.e, quantity and force_baseline).  This 
+     information is not currently retrievable.
+
+   - Getting compression type for JPEG chunked images is not working yet.
+
+o  "hdp dumpgr" has a new option, -pd, to print palette data only.  Also,
+   whenever option -p or -pd is given, only palettes are printed, and no 
+   images or file attributes. 
+
+o  A new FORTRAN function, heprntf (HEprint), was added.  It takes two
+   arguments: file name and level.  If the file name string has 0 length,
+   then error messages will be printed to standard output. 
+
+o  On Windows, the unresolved symbol (error_top) error has been fixed when 
+   calling HEclear and linking with the DLL.  Users who want to use the HDF 
+   DLL should define HDFAPDLL in their applications.  Simply go to Project 
+   Settings and add HDFAPDLL as the predefined constant.
+
+o  A memory leak in the netCDF portion of the HDF/mfhdf distribution
+   was fixed. 
+
+o  The "#define NULL" was removed since ANSI C compilers are required to
+   define NULL.
+
+o  When using "hdp dumpgr", data was being printed in the range of 0-250
+   when it should have been between 0-168.  This problem is now fixed.
+
+Please refer to the bugs_fixed.txt file for more details on bugs that were 
+fixed.
+
+
+Platforms Tested:
+================
+
+HDF 4.1 Release 5 has been tested on the following platforms:
+
+   Cray SV1 10.0.0.8
+   Cray T3E sn6711 2.0.5.55                     
+   Compaq Tru64 Unix (OSF1) 5.1
+   DEC Alpha/OpenVMS AXP 7.2-1
+   FreeBSD 4.4
+   HP-UX B.11.00 
+   IBM SP 4.3
+   IRIX 6.5 
+   IRIX64 6.5 (-n32, -64)
+   Linux 2.2.18smp
+   Solaris 2.7, 2.8
+   Windows NT/98/2000
+
+For more information on the platforms that were tested and for
+which we provide pre-compiled binaries, please refer to the following
+web page (accessible from the HDF home page):
+
+     http://hdf.ncsa.uiuc.edu/platforms.html
+
+Know problmes:
+
+Writing n-bit datasets from FORTRAN with the SD interface is not working.
+
+SDgetchunkinfo does not return compression coding or modelling type.
+
+Using both fill-values and compression on SD datasets is not currently
+working, don't use one or the other.
+
+Dumping compressed Vdatas with vshow or hdp is not working.
+
+Reading or writing compressed images with the GR interface is not working.
+
+
+
+%%%4.1r4%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                          ABOUT HDF 4.1 Release 4
+                                October 2000 
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.1r3 and
+HDF 4.1r4.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.1r4.
+
+The HDF 4.1r4 documentation can be found on the NCSA ftp server 
+(ftp.ncsa.uiuc.edu) in the directory:
+
+     /HDF/HDF/Documentation/HDF4.1r4/
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look
+at the home page for HDF at:
+
+     http://hdf.ncsa.uiuc.edu/
+
+If you have any questions or comments, please send them to:
+
+     hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+- Known Problems
+
+New Features and Changes:
+========================
+
+This release focuses on new features and changes added to the
+GR interface.
+
+o Two new utilities have been added to HDF, gif2hdf and hdf2gif.
+  The gif2hdf utility will convert a GIF image into an HDF file
+  containing a GR image. The hdf2gif utility will convert an HDF GR 
+  image into a GIF image. 
+  
+o Chunking and chunking with compression have been added to the
+  GR interface.
+
+o JPEG compression with the GR interface was not working properly.
+  This problem has been fixed.
+
+Several hdp options have been added:
+  
+o Added -s option to dumpgr and dumpsds to allow printing data 
+  as a stream instead of breaking the lines at 65 characters. 
+
+o Added option -c to dumpgr and dumpsds to allow printing clean output 
+  for attributes with type DFNT_CHAR. With this option, hdp will print 
+  space characters, such as horizontal tabs, CRs, and LFs, as they are 
+  instead of "\digit" (still the default.)  This option also prints "..." 
+  for one or more null characters among the data.
+
+o Added option -l to dumpgr to allow printing data in different interlace
+  modes.
+
+
+Platforms Tested:
+================
+
+HDF 4.1 Release 4 has been tested on the following platforms:
+
+   Cray J90  (available after initial 4.1r4 release)
+   Cray T3E                      
+   DEC Alpha/Digital Unix
+   DEC Alpha/OpenVMS
+   Exemplar
+   FreeBSD
+   HP-UX 
+   IRIX 
+   IRIX64 (-n32, -64)
+   Linux
+   Solaris
+   Solaris x86
+   SP
+   Windows NT/98/2000
+
+For more information on the platforms that were tested and for
+which we provide pre-compiled binaries, please refer to the following
+web page (accessible from the HDF home page):
+
+     http://hdf.ncsa.uiuc.edu/platforms.html
+
+
+Known Problems:
+==============
+
+o The ncgen utility fails on the IBM SP.
+
+
+%%%4.1r3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                          ABOUT HDF 4.1 Release 3
+                               May 7, 1999
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.1r2 and
+HDF 4.1r3.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.1r3.
+The release notes provide more in-depth information concerning
+the topics discussed here.  The HDF 4.1r3 documentation can be
+found on the NCSA ftp server (ftp.ncsa.uiuc.edu) in the directory:
+
+     /HDF/HDF/Documentation/HDF4.1r3
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look
+at the home page for HDF at:
+
+     http://hdf.ncsa.uiuc.edu/
+
+If you have any questions or comments, please send them to:
+
+     hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+- Known Problems
+- Acknowledgements
+
+New Features and Changes:
+========================
+
+o HDF 4.1r2 was unable to properly read HDF SDSs created with HDF 3.3x.
+  It did not read the correct SDS names.  This problem has been fixed.
+
+o Many problems have been fixed with the GR interface, including the
+  following:
+
+  - The GR interface can now read compressed files created with the 
+    DFR8 and DF24 interfaces, except for those which were compressed 
+    with IMCOMP compression.
+  
+  - The GR interface can read and write images compressed with RLE, 
+    GZIP and Skipping Huffman compression methods.
+
+  - Palettes can now be written and read properly with the GR interface.
+
+  - 24-bit raster images can now be read by the GR interface.
+
+o You can now create an SDS with a name up to 256 characters in length.
+  The previous limit was 64.
+
+o HDF now supports IJP JPEG version 6b and Gzip version 1.1.3.
+
+o Numerous hdp problems have been fixed, including the following:
+
+  - hdp no longer fails on an HDF file which contains a vdata that no 
+    records have been written to.
+
+  - hdp no longer fails on the PC and Mactinosh dumping large SDSs.
+
+  - GR file attributes can now be displayed.
+
+  - A palette can now be dumped with the GR command.
+
+o SDfileinfo no longer returns the wrong number of datasets for old
+  files created with the DFSD interface.
+
+o This will be the last release that SunOS 4.1.4 is supported.
+
+Check the ./bugs_fixed.txt for other changes that are not listed
+here.
+
+Platforms Tested:
+================
+
+HDF 4.1 Release 3 has been tested on the following platforms:
+
+   Cray J90                  
+   Cray T90 (CFP, IEEE)         
+   Cray T3E                      
+   DEC Alpha/Digital Unix
+   DEC Alpha/OpenVMS
+   DEC Alpha NT
+   VAX OpenVMS
+   Exemplar
+   FreeBSD
+   HP-UX 10.2
+   IRIX 6.5
+   IRIX64 6.5 (-n32, -64)
+   Linux
+   Macintosh 
+   Solaris
+   Solaris x86
+   SP
+   SunOS 4.1.4
+   Windows NT/95
+
+For more information on the platforms that were tested and for
+which we provide pre-compiled binaries, please refer to the following
+web page (accessible from the HDF home page):
+
+     http://hdf.ncsa.uiuc.edu/platforms.html
+
+
+Known Problems:
+==============
+
+o On Alpha OpenVMS version 6.2, the DF.OLB and MFHDF.OLB Libraries 
+  should be created with optimization turned off. Otherwise hdftest 
+  fails (the sfgichnk function returns incorrect information).
+
+o On VAX Open VMS 6.2, the ncgen utility core dumps and an error occurs
+  when reading GR image data with user-defined fill values.
+
+o If you encounter problems building on a platform, please be sure to
+  check the INSTALL file at the top of the HDF source tree, in case 
+  these problems are documented in section 2.5, Platform-specific Notes.
+
+o On the NT, the hdp utility fails in the debug version when using the 
+  list command.
+
+Acknowledgements:
+================
+
+Fortner Software LLC ("Fortner") created the reference implementations
+for the Macintosh and Windows NT/95 of the HDF 4.1r3 library.  For more 
+information, please refer to the macintosh.txt and windows.txt files in 
+the ./release_notes/ directory.
+
+
+%%%4.1r2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                        ABOUT HDF 4.1 Release 2 
+                            March 16, 1998
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.1r1 and
+HDF 4.1r2.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.1r2.
+The release notes provide more in-depth information concerning
+the topics discussed here.  The HDF 4.1r2 documentation can be
+found on the NCSA ftp server (ftp.ncsa.uiuc.edu) in the directory:
+
+     /HDF/Documentation/HDF4.1r2
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look
+at the home page for HDF at:
+
+     http://hdf.ncsa.uiuc.edu/
+
+If you have any questions or comments, please send them to:
+
+     hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+- Known Problems
+- Important Fixes
+- Acknowledgements
+
+New Features and Changes:
+========================
+
+o Data chunking is now supported with the GR interface.  New routines
+  for creating and manipulating chunked GR images have been added.  Please
+  refer to the ./release_notes/new_functions.txt file and HDF Reference 
+  Manual for information on using chunked GRs.
+
+o In previous releases, many C routines existed for which there were  
+  no Fortran counterparts.  With HDF 4.1r2, we have added a Fortran 
+  routine for most C routines.  Please check the 
+  ./release_notes/new_functions.txt file for a list of the new 
+  functions added to HDF.
+
+o This is the first release in which the Java Products (the Java-based
+  HDF Viewer (JHV) and the Java HDF interface (JHI)) are incorporated in 
+  the HDF release itself.  For information on the Java Products, please
+  refer to the HDF home page under Information about HDF
+  (http://hdf.ncsa.uiuc.edu/about.html).
+
+o In the SD interface, HDF now defaults to ONLY storing the new version 
+  of the dimension representation added in HDF 4.0r1. 
+
+  When the dimension representation was changed in 4.0r1, the HDF library 
+  defaulted to include both the new and old dimension representations in 
+  an HDF file.  Now, this new dimension representation is stored by default.
+  The SDsetdimval_comp function can be used to change the dimension 
+  representation stored.
+ 
+  Following is a detailed description of the difference between the
+  new and old representations:
+
+    Prior to HDF 4.0r1, a vgroup was used to represent a dimension.  The 
+    vgroup had a single field vdata with a class of "DimVal0.0".  The vdata 
+    had <dimension size> number of records, with each record having a fake 
+    value from 0, 1, 2 ... , (<dimension size> - 1).  The fake values were 
+    not really required and took up a large amount of space. For applications 
+    that created large one dimensional array datasets, the disk space taken by 
+    these fake values almost doubled the size of the HDF file. In order to omit 
+    the fake values, the new version for a dimension vdata was implemented.
+ 
+    The new version uses the same structure as the old version.  The
+    only differences are that the vdata has only 1 record with a value
+    of <dimension size> and that the vdata's class is "DimVal0.1",  to
+    distinguish it from the old version.
+
+o Platforms dropped with this release:  Cray Y-MP, T3D, and Linux (a.out)  
+
+o Extensive changes have been made to the Reference Manual and User's
+  Guide.  The updated Reference Manual is available with this release.  The
+  updated User's Guide will be available in the near future.
+
+
+Platforms Tested:
+================
+
+HDF 4.1 Release 2 has been tested on the following platforms:
+
+   Cray T90 (CFP, IEEE)            IRIX 6.2 
+   Cray T3E                        IRIX64 6.4 (-n32, -64)
+   DEC Alpha/Digital Unix          Linux (elf) 
+   Exemplar                        Solaris  
+   FreeBSD                         Solaris x86 
+   HP-UX 9.03                      SP2 
+   HP-UX 10.2                      SunOS 
+   IRIX 5.3                   
+
+** The Windows NT/95, Macintosh, Dec Alpha OpenVMS and VAX OpenVMS 
+   releases are not available with this release of HDF4.1r2.  Separate 
+   releases for these platforms will be available in the near future. 
+
+For more information on the platforms that were tested and for
+which we provide pre-compiled binaries, please refer to the following
+web page (accessible from the HDF home page):
+
+     http://hdf.ncsa.uiuc.edu/platforms.html
+
+Known Problems:
+==============
+
+o Writing n-bit datasets from FORTRAN with the SD interface is not working.
+
+o SDgetchunkinfo does not return compression coding or modeling type.
+
+o Using both fill-values and compression on SD datasets is not currently
+  working; don't use one or the other.
+
+o Dumping compressed Vdatas with vshow or hdp is not working.
+
+o Reading or writing compressed images with the GR interface is not working.
+
+o With the GR interface, you cannot create a raster image without writing data 
+  to it.
+
+
+Important Fixes:
+===============
+
+o HDF no longer core dumps when reading a NetCDF file.
+
+o HDF now supports little-endian conversion for VAX and Dec 
+  Alpha OpenVMS.
+
+o The problems that occurred on the Cray with HDF 4.1r1 have
+  been corrected.
+
+See the ./release_notes/bugs_fixed.txt file for more information
+on bugs fixed in this release.
+
+Acknowledgements:
+================
+
+Fortner Software LLC ("Fortner") created the reference implementations
+for Macintosh and Windows NT/95 of the HDF 4.1r2 library, which will
+be available in the near future.  For more information, please refer to 
+the macintosh.txt and windows.txt files [in the ./release_notes/ directory]. 
+(see above).
+
+==================new_functions.txt==================================
+
+This file contains a list of the new functions added with HDF 4.1r2.
+The functions in parenthesis were already present in the HDF library,
+and are included for clarity.
+
+C                     FORTRAN                 Description
+--------------------------------------------------------------------------------
+
+(SDsetcompress)       sfscompress             compresses SDS
+
+(SDwritechunk)        sfwchnk                 writes the specified chunk of
+                                              NUMERIC data to the SDS
+
+(SDwritechunk)        sfwcchnk                writes the specified chunk of
+                                              CHARACTER data to the SDS
+
+(SDreadchunk)         sfrchnk                 reads the specified chunk of
+                                              NUMERIC data to the SDS
+
+(SDreadchunk)         sfrcchnk                reads the specified chunk of
+                                              CHARACTER data to the SDS
+ 
+(SDsetchunk)          sfschnk                 makes the SDS a chunked SDS
+ 
+(SDsetchunkcache)     sfscchnk                sets the maximum number of chunks
+                                              to cache
+ 
+(SDgetchunkinfo)      sfgichnk                gets info on SDS
+
+(SDsetblocksize)      sfsblsz                 sets block size 
+
+(SDisrecord)          sfisrcrd                checks if an SDS is unlimited
+
+
+
+(GRsetcompress)       mgscompress             compresses raster image
+
+GRsetchunk            mgschnk                 makes a raster image a chunked
+                                              raster image
+
+GRgetchunkinfo        mggichnk                gets info on a raster image
+
+GRsetchunkcache       mgscchnk                sets the maximum number of chunks
+                                              to cache
+
+
+(Hgetlibversion)      hglibver                gets version of the HDF Library
+
+(Hgetfileversion)     hgfilver                gets version of the HDF file
+
+
+Vdeletetagref        vfdtr                    deletes tag/ref pair ( HDF object)
+                                              from a vgroup
+
+(VSfindclass)        vsffcls                  finds class with a specified 
+                                              name in a vdata
+
+VSdelete             vsfdlte                  deletes a vdata
+
+Vdelete              vdelete                  deletes a vgroup
+
+
+
+=====================================================================
+
+
+%%%4.1r1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                            ABOUT HDF4.1 Release 1
+                              February 21, 1997
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.0r2 and
+HDF 4.1r1.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.1r1.
+The release notes provide more in-depth information concerning 
+the topics discussed here.  The HDF 4.1r1 documentation can be 
+found on the NCSA ftp server (ftp.ncsa.uiuc.edu) in the directory:
+
+     /HDF/Documentation/HDF4.1r1
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look 
+at the home page for HDF at: 
+
+    http://hdf.ncsa.uiuc.edu/  
+
+If you have any questions or comments, please send them to:
+
+         hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+- Known Problems
+- Important Fixes
+
+
+New Features and Changes:
+========================
+
+o Attributes are now supported in both the vdata and vgroup 
+  APIs.  In the vdata API, attributes can be attached to either 
+  vdata fields or vdatas; in the vgroup API, attributes can be 
+  attached to vgroups.  This new functionality can also be used
+  to attach attributes to vdatas and vgroups created by earlier
+  versions of the HDF library.  However, the old versions of
+  the HDF library cannot read the new version vdatas and vgroups.
+  A vdata/vgroup having attributes will become a new version 
+  vdata/vgroup.  For more information, please refer to the file 
+  ../release_notes/vattr.txt, the man pages for the new functions, 
+  and the HDF 4.1 User's Guide.
+
+o Data chunking is now supported in SD scientific data sets.  
+  When data chunking is used, an n-dimensional SDS is stored 
+  as a series of n-dimensional chunks, improving performance on 
+  certain types of partial read operations.
+
+  New routines for creating and manipulating chunked SD 
+  scientific data sets have been provided, and two preexisting 
+  SD I/O routines, SDreaddata and SDwritedata, have also been 
+  modified to work with chunked SDSs.  For more information, please 
+  refer to the file ../release_notes/sd_chunk_examples.txt, the man
+  page for sd_chunk, and the HDF 4.1 User's Guide.
+
+o Due to certain limitations in the way compressed SDS datasets are stored, 
+  data which has been compressed is not completely writable in ways that 
+  uncompressed datasets are.  The "rules" for writing to a compressed 
+  dataset are as follows:
+
+    (1) Write an entire dataset that is to be compressed.  i.e. build the
+        dataset entirely in memory, then write it out with a single call.
+ 
+    (2) Append to a compressed dataset.  i.e. write to a compressed dataset
+        that has already been written out by adding to the unlimited
+        dimension for that dataset.
+ 
+    (3) For users of HDF 4.1, write to any subset of a compressed dataset
+        that is also chunked.  
+
+  Please refer to the HDF 4.1 User's Guide for more information.
+
+o HDF now creates free format FORTRAN include files.  In order to make 
+  FORTRAN 90 programs be able to use HDF include files (*.inc), HDF4.1r1 
+  creates F90 versions of these files during the 'make' process on UNIX 
+  platforms, by replacing 'C' or 'c' in column 1 with '!'.  Continuation 
+  lines in hdf.inc have been eliminated. The F90 version files are named 
+  as hdf.f90, dffunc.f90 and netcdf.f90.
+
+o Several performance improvements have been added. Test programs on SPARC
+  20/Solaris 2.5 show that when creating an hdf file with 2500 3D (10x10x10)
+  float32 SDSs, the program execution speed is improved by 2.5 - 4.8 times,
+  and SDend is faster by 4.3 - 20 times.
+
+o A new function, SDsetfillmode, has been added.  It can be used to prevent 
+  SDwritedata from pre-filling the dataset with a user defined or default 
+  fill value, so that better performance can be obtained.
+
+o SGI has changed some compiler default settings in IRIX 6.2.
+  We decided to explicitly define the settings of various ABI related
+  options.  For the 64 bit OS ("uname -s" returns IRIX64), HDF uses
+  "-64 -mips4" code.  For the traditional 32 bit OS ("uname -s" returns
+  IRIX), HDF uses "-32 -mips2".  To use n32 mode on IRIX64, HDF uses
+  "-n32 -mips3" code.  Note that in the previous release (4.0r2), HDF
+  used only "-n32".  In IRIX 6.1 and before, "-n32" defaulted to
+  "-mips4" code but in IRIX 6.2, it defaults to mips3 or mips4 code.
+  We decided to explicitly set it to "-n32 -mips3".  Therefore,
+  applications linking with the HDF library must be compiled with
+  the same explicit ABI options.
+
+o This will be the last release that we support the CM5.
+
+  HDF 4.1 Beta 1 USERS ONLY
+  -------------------------
+
+o The SD chunking routine names were changed to be more consistent
+  with the SD interface. The names of the routines are now in lower
+  case, after the two initial "SD" characters.  For example,
+  SDwriteChunk() has been changed to SDwritechunk().
+
+o The _HDF_ENTIRE_VDATA variable has been changed to _HDF_VDATA.
+  For those users already using it, a macro called _HDF_ENTIRE_VDATA
+  has been added, which is defined as _HDF_VDATA.
+
+o You can now create an empty compressed SDS.
+
+  Please refer to the ../release_notes/bugs_fixed.txt file for changes 
+  in this release.
+ 
+Platforms Tested:
+================
+
+HDF 4.1 Release 1 has been tested on the following platforms:
+
+  CM5 Parallel I/O, 4.1.3_U1
+  DEC Alpha/Digital Unix 3.2
+  DEC Alpha/OpenVMS AXP 6.2
+  DEC VAX OpenVMS 6.2
+  Exemplar 9.03
+  Free BSD 2.2
+  HP-UX 9.03
+  HP-UX 10.10
+  IRIX 5.3
+  IRIX 6.2_64
+  IRIX 6.2_n32 
+  IRIX 6.4_64
+  IRIX 6.4_n32
+  Linux A.OUT 1.2.4
+  Linux ELF 2.0.27 (C only)
+  Macintosh PowerPC (C only) 
+  SP2 4.1
+  Solaris 2.5
+  Solaris_x86 2.5 (C only)
+  SunOS 4.1.3
+  Windows NT/95 (C only)
+
+Known Problems:
+==============
+
+o With the SD interface, you are unable to overwrite
+  existing compressed data, that is not stored in
+  "chunked" form.  This is due to compression algorithms 
+  not being suitable for "local" modifications in a compressed 
+  datastream.   
+
+o There are no plans to add the DF24writeref function 
+  to the DF24 interface.  This function will be removed
+  from the documentation.
+
+Important Fixes:
+===============
+
+o If you opened a file in Read Only mode with the SD interface
+  (using SDstart), it would create the file if the file did not
+  exist.  This no longer occurs.
+
+o HDF 4.0r2 did not recognize JPEG images created by HDF 3.3r4.
+  This has been fixed.
+
+See the ../release_notes/bugs_fixed.txt file for more information
+on bugs fixed in this release.
+
+
+%%%4.1b1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                            ABOUT HDF4.1 Beta 1
+                              December 6, 1996
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.0r2 and
+HDF 4.1b1.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.1b1.
+The release notes provide more in-depth information concerning 
+the topics discussed here.  For documentation, please refer
+to the HDF 4.0r2 documentation which can be found on the NCSA 
+ftp server (ftp.ncsa.uiuc.edu) in the directory 
+/HDF/Documentation/HDF4.0r2.
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look 
+at the home page for HDF at: 
+
+    http://hdf.ncsa.uiuc.edu/  
+
+If you have any questions or comments, please send them to:
+
+         hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+- Known Problems
+- Important Fixes
+
+
+New Features and Changes:
+-------------------------
+
+o Attributes are now supported in both the vdata and vgroup 
+  APIs.  In the vdata API, attributes can be attached to either 
+  vdata fields or vdatas; in the vgroup API, attributes can be 
+  attached to vgroups.  This new functionality can be used
+  to attach attributes to vdatas and vgroups created by earlier
+  versions of the HDF library.  However, the old versions of
+  the HDF library cannot read the new version vdatas and vgroups.
+  A vdata/vgroup having attributes will become a new version 
+  vdata/vgroup.  For more information, please refer to the file 
+  ../release_notes/vattr.txt, as well as the man pages for the
+  new functions.
+
+o Data chunking is now supported in SD scientific data sets.  
+  When data chunking is used, an n-dimensional SDS is stored 
+  as a series of n-dimensional chunks, improving performance on 
+  certain types of partial read operations.
+
+  New routines for creating and manipulating chunked SD 
+  scientific data sets have been provided, and two preexisting 
+  SD I/O routines, SDreaddata and SDwritedata, have also been 
+  modified to work with chunked SDSs.  For more information, please 
+  refer to the file ../release_notes/sd_chunk_examples.txt, as
+  well as the man page for sd_chunk.
+
+  More information will be included in the HDF 4.1 documentation,
+  which will be available with the release of HDF 4.1.  
+
+o Due to certain limitations in the way compressed SDS datasets are stored, 
+  data which has been compressed is not completely writable in ways that 
+  uncompressed datasets are.  The "rules" for writing to a compressed 
+  dataset are as follows:
+
+    (1) Write an entire dataset that is to be compressed.  i.e. build the
+        dataset entirely in memory, then write it out with a single call.
+ 
+    (2) Append to a compressed dataset.  i.e. write to a compressed dataset
+        that has already been written out by adding to the unlimited
+        dimension for that dataset.
+ 
+    (3) For users of HDF 4.1, write to any subset of a compressed dataset
+        that is also chunked.  
+
+  Please refer to the ../release_notes/comp_SDS.txt file for more information.
+
+o A new file, ../release_notes/compile.txt, contains instructions on
+  compiling applications on the supported platforms.  If you encounter
+  problems with it, please let us know at hdfhelp at ncsa.uiuc.edu. 
+
+o SGI has changed some compiler default settings in IRIX 6.2.
+  We decided to explicitly define the settings of various ABI related
+  options.  For the 64 bit OS ("uname -s" returns IRIX64), HDF uses
+  "-64 -mips4" code.  For the traditional 32 bit OS ("uname -s" returns
+  IRIX), HDF uses "-32 -mips2".  To use n32 mode on IRIX64, HDF uses
+  "-n32 -mips3" code.  Note that in the previous release (4.0r2), HDF
+  used only "-n32".  In IRIX 6.1 and before, "-n32" defaulted to
+  "-mips4" code but in IRIX 6.2, it defaults to mips3 or mips4 code.
+  We decided to explicitly set it to "-n32 -mips3".  Therefore,
+  applications linking with the HDF library must be compiled with
+  the same explicit ABI options.
+
+Platforms Tested:
+-----------------
+
+HDF 4.1b1 has been tested on the following platforms:
+
+  DEC Alpha/Digital Unix 3.2
+  DEC Alpha/OpenVMS AXP v6.2
+  DEC VAX OpenVMS v6.2
+  Free BSD 2.2
+  HP-UX 9.03
+  IRIX 5.3
+  IRIX 6.2_64
+  IRIX 6.2_n32 
+  Linux ELF 1.2.13 (C only)
+  Macintosh PowerPC (C only) (not ready yet)
+  SP2 4.1
+  Solaris 2.5
+  SunOS 4.1.3
+  Windows NT/95 (C only)
+  YMP 9.0.2asC
+
+Known Problems:
+---------------
+
+o With the SD interface, you are unable to overwrite
+  existing compressed data, that is not stored in
+  "chunked" form.  This is due to compression algorithms 
+  not being suitable for "local" modifications in a compressed 
+  datastream.  For more information, please refer to 
+  the ../release_notes/comp_SDS.txt file. 
+
+o With 4.0r1p1, you could type "hdp list -a <HDF file>
+  to get a list of the file attributes associated with
+  a file.  This does not currently work.
+
+o There are no plans to add the DF24writeref function 
+  to the DF24 interface.  This function will be removed
+  from the documentation.
+
+o When running "make test" on OpenVMS, Test 3 (float32) of the 
+  chunking tests fails, and has therefore been commented out.
+
+o When running the tests on Window NT/95, Test 2 (uint16) of the
+  chunking tests fails, and will be commented out.
+ 
+
+Important Fixes:
+----------------
+
+o If you opened a file in Read Only mode with the SD interface
+  (using SDstart), it would create the file if the file did not
+  exist.  This no longer occurs.
+
+o HDF 4.0r2 did not recognize JPEG images created by HDF 3.3r4.
+  This has been fixed.
+
+See the ../release_notes/bug_fixed.txt file for more information
+on bugs fixed in this release.
+
+
+%%%4.0r2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                            ABOUT HDF4.0 Release 2
+                                July 19, 1996
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.0r1p1 and
+HDF 4.0r2.  It is written for people who are familiar with
+previous releases of HDF and wish to migrate to HDF 4.0r2.
+The documentation and release notes provide more in-depth 
+information concerning the topics discussed here.  The HDF 4.0
+documentation can be found on the NCSA ftp server in the
+directory /HDF/Documentation/HDF4.0/Users_Guide.
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look 
+at the home page for HDF at: 
+
+    http://hdf.ncsa.uiuc.edu/  
+
+If you have any questions or comments, please send them to:
+
+         hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- New Features and Changes
+- Platforms Tested
+- Known Problems
+
+
+New Features and Changes:
+-------------------------
+
+o HDF now supports unlimited number of access IDs and files IDs.
+
+o The vdata field size limit has been increased from 32000 to 65535.
+
+o The hdp utility has been updated to:
+   - view a GR object
+   - recognize the new compression methods
+   - view descriptive annotations
+   - display the library version of the HDF file
+
+o SDsetattr and GRsetattr now check for both MAX_ORDER and 
+  MAX_FIELD_SIZE.
+
+o The handling of DFNT_CHAR in all Fortran interfaces has been 
+  cleaned up.  See release_notes/Fortran_APIs.txt for more 
+  information.
+
+o When appending compressed data onto the end of an unlimited
+  dimension SDS, the SD interface no longer writes the fill-values
+  in locations where they will immediately be over-written by data.
+  This was done for the compression layer, but has the added
+  enhancement of improving performance.
+
+o On the Cray, there were boundary problems when foreign data did not
+  start from the 64-bit boundary.  This has been fixed.
+
+o There are no longer the following name collisions with the HDF 
+  libraries:
+     -  AVS (HPread, HPwrite)
+     -  Windows SDK (_hread) 
+     -  ODL library (_HDF_<constant>)
+
+o The 32-bit mode for IRIX 6.1 previously used the '-32' option which
+  produces mips1 code.  It has been changed to use '-n32' which
+  produces mips4 code.  This runs faster on the Power Challenges.
+  Users who must use the '-32' option can link their code with
+  the IRIX 5.3 HDF library.
+
+o The compression problems have been fixed when using HDF on IRIX 6.1 
+  with the -n32 (see Known Problems below).
+
+o The zlib and jpeg libraries have been updated.  The versions included
+  with HDF 4.0 Release 2 are:
+
+      zlib version 1.0.2
+      jpeg version 6a (7-Feb-96)
+       
+o The hdfls utility has been updated to:
+    - support the new compression modes
+    - display the library version of the HDF file
+
+o Support for the 16-bit architecture has been pulled out of HDF.
+
+o The directories separator in the directory variable used by the
+  function HXsetdir (Fortran equivalent: hxsdir) is the verticle bar
+  ('|') now.  It used to be the colon (':') symbol, but a colon is
+  a legal symbol for a file pathname in the MacOS system.
+
+o The code has been rearranged so that most applications' binaries
+  will be smaller.
+
+o A new routine, VSfpack(), has been added.  Please see the HDF man
+  page on how to use this routine.
+
+o A new routine, GRluttoref(), has been added.  Please see the HDF man
+  page on how to use this routine. 
+
+o Several internal problems have been fixed with the GR interface.
+
+
+Changes in Compiling the Source Code:
+
+o A new compile option, '-DHAVE_NETCDF', has been added, to avoid conflicts 
+  in linking the HDF/MFHDF library with the original netCDF library. 
+  This is only available for the C-interface.  However, keep in 
+  mind that you cannot read/write HDF files using the netCDF libraries.  
+  See section 2.4.3.2 in the INSTALL file for more information.  
+
+o When compiling and installing HDF, the default location to place the
+  binaries, has been changed from /usr/local/bin to NewHDF in the
+  source directory.  For example, assuming the library source is loaded 
+  at /usr/local/src/hdf, the following commands will result in the HDF 
+  binaries being placed in the directory /usr/local/src/hdf/dev/NewHDF.
+
+        cd dev
+        ./configure -v
+        make 
+        make test
+        make install
+
+o The Fortran test output has been cleaned up and shortened, when 
+  running "make test".  Previously, the Fortran tests on the hdf/
+  side consisted of multiple Fortran programs invoked by a C frontend.  
+  The test programs were changed to subroutines and combined as one 
+  Fortran program.  The C frontend was also changed to produce a 
+  'directive' file, called fortest.arg, which contains directives to 
+  run the Fortran test program.
+
+
+Platforms Tested:
+-----------------
+
+HDF 4.0r2 has been tested on the following platforms:
+
+  AIX                           Linux ELF
+  C90                           MAC 
+  CM5                           SP2  (single node)
+  Digital Unix 3.2              Solaris_2.4
+  Exemplar 9.03                 Solaris 2.5
+  Free BSD                      Solaris_x86 2.4  (C only)
+  Fujitsu  (C only)             SunOS 4.1.4
+  HP-UX                         T3D  (C only)
+  IRIX 6.1 w/-n32 bit option    VMS
+  IRIX 6.1 w/-64 bit option     Windows NT/95
+  IRIX 5.3                      YMP
+  Linux A.OUT                   
+
+
+Known Problems:
+---------------
+
+o On the SunOS platform, there is a bug when using sfscal()/sfgcal() 
+  routines with gcc and f77.
+ 
+o On the VMS platform, there is a bug with float64 data.
+
+o For IRIX 6.1, the stdio.h file gives a false warning message if both 
+  the '-n32' and '-ansi' options are used for the C compiler.  We have 
+  temporarily removed the '-ansi' option from our autoconfiguration
+  for the Irix6_32 system, to avoid these messages.  We have verified
+  that the culprit in stdio.h has been corrected in IRIX 6.2, and plan
+  to put the '-ansi' option back in our next release.
+
+o The compression tests produce errors for FLOAT32 data if the '-O'
+  option is used on IRIX 6.1, for both the '-64' bit and '-n32'
+  bit modes.  It did not produce errors when using the '-32' bit 
+  option or when not using the '-O' option.  We are unsure whether the 
+  errors are due to the compression code or the IRIX C optimizer.  For 
+  now, we have chosen to compile the HDF library without the '-O' option, 
+  while we investigate the problem. 
+
+%%%4.0r1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                    ABOUT HDF4.0 Release 1
+                       February 7, 1996
+
+INTRODUCTION
+
+This document describes the differences between HDF4.0r1 and
+HDF3.3r4.  It is written for people who are familiar with 
+previous releases of HDF and wish to migrate to HDF4.0r1.
+The documentation and release notes provide more in-depth 
+information concerning the topics discussed here.  The HDF 4.0
+documentation can be found on the NCSA ftp server in the
+directory /HDF/Documentation/HDF4.0/Users_Guide.  For more 
+history behind the implementation of the items listed here, 
+refer to the ABOUT_4.0.alpha, ABOUT_4.0b1 and ABOUT_4.0b2 files.
+
+First-time HDF users are encouraged to read the FAQ in this
+release for more information about HDF.  Users can also look 
+at the home page for HDF at: 
+
+    http://hdf.ncsa.uiuc.edu/  
+
+If you have any questions or comments, please send them to:
+
+         hdfhelp at ncsa.uiuc.edu
+
+CONTENTS
+
+- Important Changes (that will affect you) 
+- New Features and Changes
+- Changes in Utilities
+- Known Problems
+
+
+Important Changes: 
+-----------------
+
+  1. Several changes have been made to the libraries in HDF4.0
+     which affect the way that users compile and link their
+     programs:
+
+      * The mfhdf library has been renamed to libmfhdf.a from 
+        libnetcdf.a in previous releases.
+
+      * HDF 4.0 libraries now use v5 of the Independent JPEG Group 
+        (IJG) JPEG file access library.
+
+      * Gzip library libz.a is added in HDF4.0r1, in order to 
+        support "deflate" style compression of any object in 
+        HDF files.
+
+     Due to these changes, users are required to specify four
+     libraries when compiling and linking a program:  libmfhdf.a,
+     libdf.a, libjpeg.a and libz.a, even if your program
+     does not use JPEG or GZIP compression.  For example:
+
+     For C:
+
+        cc -o myprog myprog.c -I<path of include files> \
+              <path of libmfhdf.a> <path of libdf.a> \
+              <path of libjpeg.a> <path of libz.a>
+       or
+  
+        cc -o myprog myprog.c -I<path of include files> \
+              -L<path of libraries> -lmfhdf -ldf -ljpeg -lz
+
+     For FORTRAN:
+
+        f77 -o myprog myprog.f <path of libmfhdf.a> \
+              <path of libdf.a> <path of libjpeg.a> \
+              <path of libz.a>
+       or
+   
+        f77 -o myprog myprog.f -L<path of libraries> \
+              -lmfhdf -ldf  -ljpeg -lz
+
+     NOTE: The order of the libraries is important: libmfhdf.a
+           first, then libdf.a, followed by libjpeg.a and libz.a.
+     
+     This is also discussed in Items 1, 2, and 3 of the New 
+     Features and Changes section of this document.
+
+  2. The HDF 4.0 library will ONLY compile with ANSI C compilers.
+     See Item 4 in the New Features and Changes section of this
+     document for more information.
+
+  3. The HDF library and netCDF library on Unix systems can now be 
+     automatically configured and built with one command.  See Item 5 
+     in the New Features and Changes section of this document for more
+     information.
+
+  4. In HDF 4.0, the FORTRAN programs dffunct.i and constant.i
+     have been changed to dffunct.inc and hdf.inc.  See Item 16 in
+     the New Features and Changes section of this document for more 
+     information.
+  
+  5. Platforms tested on: IRIX (5.3, 6.1 (32 bit and 64 bit)), 
+     SunOS 4.1.4, Solaris (ver 2.4, 2.5), Solaris x86, 
+     HP-UX, Digital Unix, AIX, LINUX (A.OUT), CM5, YMP,
+     FreeBSD, C90, Exemplar, Open VMS, and SP2 (single node only). 
+
+     HDF 4.0 is not yet available on the Macintosh for HDF4.0r1.
+
+  6. The HDF 4.0 binaries for each tested platform are available. 
+     Unix binaries are located in the bin/ directory.  Binaries for 
+     Windows NT are located in the zip/ directory. 
+     
+
+New Features and Changes:
+------------------------
+
+  1. Changes to the mfhdf library
+     The mfhdf library has been renamed to libmfhdf.a from libnetcdf.a 
+     in previous releases. To link a program with HDF4.0r1
+     libraries, four libraries are required:  libmfhdf.a, libdf.a, 
+     libjpeg.a and libz.a. 
+
+     See Item 1 of 'Important Changes' for examples of how you would 
+     compile and link your programs.
+
+  2. JPEG Group v5b library
+     HDF Version 4.0 libraries now use v5 of the Independent 
+     JPEG Group (IJG) JPEG file access library.
+
+     The JPEG library will need to be linked with user's 
+     applications whether they are compressed with JPEG or not.
+
+     See Item 1 of 'Important Changes' for examples of how you would 
+     compile and link your programs.
+
+  3. Gzip library added
+     New with this release is support for gzip "deflate" style 
+     compression of any object in an HDF file.  This is supported 
+     through the standard compression interface function calls 
+     (HCcreate, SDsetcompress, GRsetcompress).  The ABOUT_4.0b2 
+     file contains additional information on this. 
+
+     See Item 1 of 'Important Changes' for examples of how you would 
+     compile and link your programs.
+
+  4. ANSI C only
+     As was previously noted in the HDF newsletters, this release 
+     of the HDF library will compile only with ANSI C compilers. 
+     This shift to ANSI C compliance has been accompanied by a large 
+     clean up in the source code. An attempt has been made to remove 
+     all warnings and informational messages that the compilers on 
+     supported platforms occasionally emit, but this may not be 
+     completely clean for all user sites. 
+
+  5. Auto configuration 
+     Both the HDF library and netCDF library on Unix systems now use 
+     the same configure script and can be configured uniformally with 
+     one command. See the README and the INSTALL files at the top 
+     level of HDF4.0r1 for detailed instructions on configuration and 
+     installation.
+
+     A consequence of the auto configuration is that on UNIX systems 
+     without FORTRAN installed, the top level config/mh-<sys> will 
+     need to have the 'FC' macros defined to "NONE" for correct 
+     configuration. 
+     
+  6. New version of dimension record
+     In HDF4.0b1 and previous releases of the SDS interface, a vgroup 
+     was used to represent a dimension.  The vgroup had a single field 
+     vdata with a class of "DimVal0.0".  The vdata had <dimension size> 
+     number of records, with each record having a fake value from 
+     0, 1, 2 ... , (<dimension size> - 1).  The fake values were not 
+     really required and took up a large amount of space. For 
+     applications that created large one dimensional array datasets, the 
+     disk space taken by these fake values almost doubled the size of the 
+     HDF file. In order to omit the fake values, a new version of 
+     dimension vdata was implemented.
+
+     The new version uses the same structure as the old version.  The 
+     only differences are that the vdata has only 1 record with a value
+     of <dimension size> and that the vdata's class is "DimVal0.1",  to
+     distinguish it from the old version.
+
+     No change was made in unlimited dimensions.
+
+     Functions added to support this are:
+     
+       - SDsetdimval_comp -- sets backward compatibility mode for a 
+         dimension.  The default mode is compatible in HDF4.0r1, and 
+         will be incompatible in HDF4.1. See the man page of 
+         SDsetdimval_comp(3) for detail.
+
+       - SDisdimval_bwcomp(dimid) -- gets the backward compatibility
+         mode of a dimension. See the man page of SDisdimval_bwcomp(3) 
+         for detail.
+
+  7. Reading CDF files
+     With HDF 4.0 limited support for reading CDF files was added to 
+     the library. This support is still somewhat in the development 
+     stage and is therefore limited. 
+
+     To begin with, unlike the netCDF merger, the CDF API is not 
+     supported. Rather, the SD and netCDF APIs can be used to access 
+     information pulled out of CDF files. 
+
+     The type of files supported are limited to CDF 2.X files. The 
+     header information is different between CDF 1.X and 2.X files. In 
+     addition, all of the files must be stored as single-file CDFs in 
+     network encoding. 
+
+     If there is user demand, and support, the types of CDF files 
+     that are readable may be increased in the future. 
+
+  8. Parallel I/O interface on CM5 
+     An extension using the parallel IO in CM5 has been added to
+     the SDS interface. Initial tests have resulted in about
+     25 MBytes/second IO throughput using the SDA (Scalable
+     Disk Array) file system. The library provides interfaces
+     for both C* and CMF programming languages. The ABOUT_4.0.alpha
+     file has more information concerning this.
+
+     Users will find some examples in the directory
+     mfhdf/CM5/Examples.
+
+     The parallel I/O interface stores scientific datasets in
+     external files.  New options have been added to hdfls and
+     hdfpack to handle them.  A new utility, hdfunpac, was
+     created for external files handling, too. 
+
+  9. Support for SGI Power Challenge running IRIX6.1 
+     Power Challenge is now supported, both in the native 64-bit 
+     and the 32-bit objects modes.  Note that the Power Challenge 
+     native 64 bits objects use 64 bits long integers. Users should
+     be careful when using the netcdf interface.  They should declare 
+     their variables as "nclong", not "long". 
+
+ 10. Multi-file Annotation Interface (ANxxx)
+     The multi-file annotation Interface is for accessing 
+     file labels and descriptions, and object labels and 
+     descriptions. It allows users to keep open more than 
+     one file at a time, and to access more than one 
+     annotation at a time.  It also allows multiple labels 
+     and multiple descriptions to be applied to an HDF object 
+     or HDF file. 
+   
+ 11. Multi-file Raster Image (GRxxx) interface
+     The new Generic Raster (GR) interface provides a set of 
+     functions for manipulating raster images of all kinds.  
+     This interface allows users to keep open more than one 
+     file at a time, and to "attach" more than one raster 
+     image at a time.  It supports a general framework 
+     for attributes within the RIS data-model, allowing 
+     'name = value' style metadata.  It allows access to 
+     subsamples and subsets of images.  
+ 
+     The GRreqlutil and GRreqimageil functions allow for different 
+     methods of interlacing images in memory.  The images are 
+     interlaced in memory only, and are actually written to disk in 
+     "pixel" interlacing.
+
+ 12. Compression for HDF SDS
+     Two new compression functions have been added to the SD
+     interface for HDF 4.0:  SDsetcompress and SDsetnbitdataset.
+
+     SDsetcompress allows users to compress a scientific dataset 
+     using any of several compression methods.  Initially three 
+     schemes, RLE encoding, an adaptive Huffman compression 
+     algorithm,  and  gzip 'deflation' compression are available. 
+
+     SDsetnbitdataset allows for storing a scientific dataset 
+     using integers whose size is any number of bits between 1 and 
+     32 (instead of being restricted to 8, 16 or 32-bit sizes). 
+     Access to the data stored in an n-bit data item is transparent
+     to the calling program.  The ABOUT_4.0.alpha file has an in-depth
+     description concerning this ("n-bit SDS" listed under Item 2).  
+
+ 13. External Path Handling
+     New functions have been added to allow applications to 
+     specify directories to create or search for external 
+     files.  
+     
+      - HXsetcreatedir (hxscdir for FORTRAN) 
+      - HXsetdir (hxsdir for FORTRAN)
+
+ 14. I/O performance improvement 
+     HDF 4.0 unofficially supports file page buffering.  With HDF 4.1
+     it will be officially supported.  The file page buffering allows 
+     the file to be mapped to user memory on a per page basis i.e. a 
+     memory pool of the file.  With regards to the file system, page 
+     sizes can be allocated based on the file system page-size or 
+     in a multiple of the file system page-size. This allows for fewer 
+     pages to be managed as well as accommodating the user's file usage 
+     pattern.  See the top level INSTALL file and the 
+     release_notes/page_buf.txt file for creating the library with
+     this support and using it.
+     
+ 15. Improvement in memory usage and general optimizations
+     Considerable effort was put into this release (since the b2 
+     release) to reduce the amount of memory used per file and by the 
+     library in general.  In general terms, we believe that the library 
+     should have at least half as large of a memory footprint during 
+     the course of its execution and is more frugal about allocating 
+     large chunks of memory.
+ 
+     Much time was spent optimizing the low-level HDF routines for this 
+     release to be faster than they have been in the past also.  
+     Applications which make use of files with many (1000+) datasets 
+     should notice significant improvements in execution speed.
+ 
+ 16. In hdf/ there are two files for FORTRAN programs to include
+     the values and functions defined in HDF. They were
+     originally named as constant.i and dffunct.i. The extension .i
+     caused problems on some machines since *.i is used by cc as
+     an "intermediate" file produced by the cpp preprocessor. In
+     HDF 4.0 dffunct.i has been changed to dffunct.inc, and constant.i 
+     has been changed to hdf.inc. Users' existing FORTRAN application
+     programs need to make the corresponding changes, if they
+     include the .i files, in order to compile with HDF4.0. 
+
+ 17. Limits file
+     A new file, limits.txt, has been added to the ftp server.  
+     It is aimed at HDF applications programmers and defines the
+     upper bounds of HDF 4.0. This information is also found in the
+     hdf/src/hlimits.h file.  Refer to the ABOUT_4.0.alpha for 
+     historical information concerning this.
+
+ 18. Pablo available
+     HDF4.0 supports creating an instrumented version of the HDF 
+     library(libdf-inst.a). This library, along with the Pablo 
+     performance data capture libraries, can be used to gather data 
+     about I/O behavior and procedure execution times.  See the top
+     level INSTALL file and the hdf/pablo/README.Pablo file for
+     further information.
+
+ 19. Support for the IBM SP-2 
+     The HDF library has been ported to run in a single SP2 node.
+     It does not support the parallel or distributed computing for
+     multiple SP-2 nodes yet.
+
+ 20. Miscellaneous fixes
+
+     - To avoid conflicts with C++, internal structures' fields which
+       were named 'new' have been renamed.
+
+     - The maximum number of fields in a vdata now is decided by 
+       VSFIELDMAX.
+
+     - The platform number subclass problem when an external data file 
+       was in Little_endian format has been fixed.
+
+     - Unlimited dimension was not handled correctly by the HDF3.3r4
+       FORTRAN interface.  This problem has been fixed in HDF4.0r1.
+
+Changes to utilities:
+--------------------
+
+   o hdf/util/ristosds 
+     Ristosds now converts several raster images into a 3D uint8, 
+     instead of float32, SDS. 
+
+   o hdf/util/hdfls
+     New options have been added to support the parallel I/O
+     interface on CM5.
+
+   o hdf/util/hdfpack
+     New options have been added to support the parallel I/O
+     interface on CM5.
+
+   o hdf/util/hdfunpac
+     This is a new utility for external file handling for the
+     parallel I/O interface on CM5.
+
+   o mfhdf/dumper/hdp
+     Hdp is a new command line utility designed for quick display of 
+     contents and data objects.  It can list the contents of hdf files 
+     at various levels with different details.  It can also dump the 
+     data of one or more specific objects in the file.  See hdp.txt in 
+     the release notes for more information.
+
+Known Problems:
+--------------
+
+   o On the IRIX4 platform, fp2hdf creates float32 and float64 values
+     incorrectly.   
+
+   o On the SP2, the hdp command gives a false message of "Failure to
+     allocate space" when the hdf file has no annotations to list. 
+
+   o On the C90, hdfed fails inconsistently when opening hdf files
+     more than once in the same hdfed session.
+
+   o Currently there is a problem in re-writing data in the middle
+     of compressed objects.
+  
+   o VMS gives an error on the test for Little Endian float64.
+
+   o If the external element test in hdf/test/testhdf fails
+     and there is no subdirectory "testdir" in hdf/test/,
+     create one via "mkdir" and run the test again. (The
+     "testdir" should have been created by "make". But
+     the "make" in some old systems does not support the
+     creation commands.)
+
+%%%4.0b2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                ABOUT HDF4.0 Beta 2
+                   Nov 14, 1995
+ 
+CONTENTS
+ 
+     1. The mfhdf side library is renamed to libmfhdf.a,
+        versus libnetcdf.a in previous releases
+     2. New version of dimension record  
+     3. New features
+        GR interface
+        Gzip library is added
+        Unified configuration of library
+        I/O performance improvement
+     4. New functions added
+        Fortran functions hxscdir and hxsdir         
+        SDsetdimval_comp
+        SDisdimval_bwcomp
+     5. SGI Power Challenge running IRIX6.1 is now supported
+     6. Pablo available  
+     7. Platforms tested
+     8. Changes in release notes 
+     9. Bug fixes and Known problems
+
+
+1. The mfhdf side library is renamed to libmfhdf.a, versus libnetcdf.a 
+   in previous releases. To link a program with HDF4.0b2 libraries, 
+   one needs four libraries, libmfhdf.a, libdf.a, libjpeg.a and libz.a 
+   (see "Gzip library is added" in item 3 below):
+
+      cc -o myprog myprog.c -I<path of include files> \
+            libmfhdf.a libdf.a libjpeg.a libz.a
+
+   Note, the order of the libraries is important.
+
+2. New version of dimension record  
+   HDF4.0b1 and previous releases use a vgroup to represent a dimension.
+   The vgroup has a single field vdata with class "DimVal0.0".
+   The vdata has <dimension size> number of records, each record has a
+   fake value from 0, 1, 2 ... , (<dimension size> - 1 ). The fake values
+   are not really required and take a lot of space. For applications that
+   create large one dimensional array datasets the disk space taken by
+   these fake values almost double the size of the HDF file. In order to
+   omit the fake values, a new version of dimension vdata is proposed.
+
+   The new version uses the same structure as the old version. The only
+   differences are that the vdata has only 1 record with value
+   <dimension size> and that the vdata's class is "DimVal0.1" to
+   distinguish it from the old version. 
+
+   No change is made in Unlimited dimensions. 
+   
+   See file dimval.txt in subdirectoy release_notes/ of HDF4.0b2 release
+   for our policy on the backward compatibility of this dimension version.
+
+3. New features
+   . New with this beta release is the support for different methods of
+     interlacing images in memory.  This feature is supported through the 
+     GRreqlutil and GRreqimageil functions rescribed in the mf_ris.txt 
+     document in this directory.  Please note that the images are 
+     interlaced in memory only, all images are actually written to disk 
+     in "pixel" interlacing.
+
+   . Gzip library is added
+     New with this release is support for gzip "deflate" style compression
+     of any object in an HDF file.  This is supported through the standard
+     compression interface function calls (HCcreate, SDsetcompress,
+     GRsetcompress) by using the COMP_CODE_DEFLATE parameter for the coding
+     type.  The comp_info structure has a new member, deflate.level, which
+     specifies how much effort to expend trying to compress data.  Values
+     for deflate.level must be between 1-9, with 1 being small amounts of
+     effort (time) and 9 being maximum effort (most time and compression),
+     the default value is 6.
+     Currently, due to our use of the gzip "zlib" library for support of
+     this feature, users must link with the "libz.a" library produced by
+     zlib.  (See item1 above). 
+
+          cc -o myprog myprog.c -I<path of include files> \
+                  libmfhdf.a libdf.a libjpeg.a libz.a
+
+     Note, the order of the libraries is important. 
+
+     Also, this method of compression currently has several known bugs 
+     when used on a 64-bit architecture (DEC Alpha processors, Cray 
+     machines, and SGI Power Challenge machines in 64-bit "mode").
+
+   . Unified configuration of library
+     Both sides of the library now use the same configure script and
+     can be configured uniformly through one makefile fragment. Please
+     see the top-level INSTALL file in the distribution for further 
+     details.
+
+   . I/O performance improvement 
+     This version of the distribution also has preliminary support for 
+     file page buffering. Note that is a *Beta* release and is not 
+     supported officially. As such it is is provided as is.
+     The file page buffering allows the file to be mapped to user memory on 
+     a per page basis i.e a memory pool of the file. With regards to the 
+     file system, page sizes can be allocated based on the file system 
+     page-size or if the user wants in some multiple of the file system 
+     page-size. This allows for fewer pages to be managed along with 
+     accommodating the users file usage pattern. Please see the 
+     documentation in 'release_notes/page_buf.txt'.
+     
+     We have also reduced the memory requirements for several of the 
+     internal HDF library data structures, for greater efficiency. 
+
+4. Functions added
+   . Fortran interface functions added for the set external path features.
+     They are hxscdir and hxsdir.  See the man page of HXsetcreatedir(3)
+     and HXsetdir(3) for detail.
+   . SDsetdimval_comp -- sets backward compatibility mode for a dimension.
+     The default mode is compatible in HDF4.0b2, and will be 
+     incompatible in HDF4.1. See the man page of SDsetdimval_comp(3)
+     for detail. 
+   . SDisdimval_bwcomp(dimid) -- gets the backward compatibility mode
+     of a dimension. See the man page of SDisdimval_bwcomp(3) for
+     detail. 
+
+5. SGI Power Challenge running IRIX6.1 is now supported
+   Power Challenge is now supported, both in the native 64-bit and the 
+   32-bit objects modes.  Note that the Power Challenge native 64 bits 
+   objects use 64 bits long integers, users should be careful when using 
+   the netcdf interface.  They should declare their variables as "nclong", 
+   not "long".
+
+6. Pablo available  
+   This version of the distribution has support to create an 
+   instrumented version of the HDF library(libdf-inst.a). This 
+   library along the Pablo performance data capture libraries 
+   can be used to gather data about I/O behaviour and procedure 
+   execution times. Please see the documentation 
+   release_notes/Pablo.txt in the distribution for further details.
+
+7. Platforms tested
+    HDF4.0b2 has been tested on the following systems:
+    SunOS 4.1.3, SunOS 5.3 and 5.4(Solaris 2.3 and 2.4), 
+    Linux_a.out, Linux_elf, SGI/IRIX5.2, SGI/IRIX5.3,
+    SGI Power Challenge/IRIX6.1 (32- and 64-bit), HP/UX 9.01,
+    IBM RS6000/AIX, Cray C90, Cray YMP, DEC alpha/UNIX (OSF), 
+    DecStation/MIPSEL (ncdump doesn't work), Free BSD 2.0, 
+    Solaris_x86, Convex Exemplar/HPUX, and CM5 parallel I/O. 
+    See the INSTALL file at the top level of HDF4.0b2 for more 
+    details.
+
+8.  Changes in release notes
+    The directory release_notes/ contains writeups for the alpha
+    and beta releases of HDF4.0. Those files can be used as temporary
+    documents for HDF4.0 before the official documentation is 
+    available. 
+
+    Newly added: ABOUT_4.0b2, Pablo.txt, dimval.txt, and page_buf.txt
+    Files changed: bug_fixed.txt and parallel_CM5.txt.
+    AOUBT_4.0.alpha is also included. 
+
+9. Fixes and Known problems
+
+   Problems fixed:
+     . To avoid conflicts with C++, internal structures' fields which
+       were named 'new' have been renamed.
+     . Maximum number of fields in a vdata now is decided by VSFIELDMAX.
+     . Vshow and hdp are fixed. Now they can handle as many fields 
+       as defined by VSFIELDMAX.
+     . Fixed platform number subclass problem when external data file was
+       in Little_endian format. 
+     . A file hdf/src/hlimits.h has been added to hold definitions for
+       maximum number of open files and other limits. 
+     . Miscelianeous fixes
+   
+   Known problems:
+     . Hfidinquire not included in binaries
+     . Gzip doesn't work on 64-bit machines.
+     . Currently there is a problem in appending data to compressed objects.  
+     . Hfidinquire is in the source code, but it is not included in the
+       pre-compiled code. If your program uses Hfidinquire, you need to
+       re-compile libdf.a. 
+
+
+%%%4.0b1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+               ABOUT HDF4.0 Beta 1
+                 July 25, 1995
+
+CONTENTS
+
+    1. New features in the HDF4.0 Beta 1 release
+    2. Bugs fixed and known problems
+    3. Platforms tested
+    4. Installation of HDF4.0 Beta 1 on WindowsNT/95
+    5. Known problems in compilation, testing and
+       installation of HDF4.0b1
+    6. Installing without FORTRAN support
+
+1. New features in HDF4.0 Beta 1 release
+
+   o Auto configuration 
+     It is now possible to automatically configure and build 
+     both the HDF library and netCDF library with one command. 
+     See the README and the INSTALL files at the top level of 
+     HDF4.0beta1 for detailed instructions on configuring and 
+     installation.
+     
+   o Multi-file Annotation Interface (ANxxx)
+
+     The multi-file annotation Interface is for accessing 
+     file labels and descriptions, and object labels and 
+     descriptions. It allows users to keep open more than 
+     one file at a time, and to access more than one 
+     annotation at a time.  It also allows multiple labels 
+     and multiple descriptions to be applied to an HDF object 
+     or HDF file. 
+   
+     A draft of the documentation for this interface is in 
+            ./mf_anno.txt.
+
+   o Multi-file Raster Image (GRxxx) interface
+     The new Generic Raster (GR) interface provides a set of 
+     functions for manipulating raster images of all kinds.  
+     This interface allows users to keep open more than one 
+     file at a time, and to "attach" more than one raster 
+     image at a time.  It supports a general framework 
+     for attributes within the RIS data-model, allowing 
+     'name = value' style metadata.  It allows access to 
+     subsamples and subsets of images.  HDF4.0beta1 includes
+     a C interface only. The Fortran interface will be available 
+     in the next release. 
+ 
+     A draft of the documentation for this interface is in 
+            ./mf_ris.txt.
+
+   o New Compression Algorithms and interface
+     A new low-level compression interface has been added to 
+     HDF which allows any data-object to be compressed 
+     using a variety of algorithms.  Currently only two 
+     compression algorithms are supported: Run-Length 
+     Encoding (RLE) and adaptive Huffman.
+  
+     A draft of the documentation for this interface is in 
+            ./compression.txt
+
+   o JPEG Group v5b library
+     HDF Version 4.0 libraries now use v5 of the Independent 
+     JPEG Group (IJG) JPEG file access library. For more details
+     about JPEG library see
+ 
+            ./JPEG_v5b.txt 
+
+     The JPEG library will need to be linked with a user's 
+     applications whether they are compressed with JPEG or not.
+
+     For example on a SUN SPARC, if the .h files are in the 
+     directory "incdir", and all libraries are in "libdir,"
+     the following command should be used to compile a 
+     C program "myprog.c":
+
+     cc -DSUN -DHDF -Iincdir myprog.c libdir/libnetcdf.a \
+         libdir/libdf.a  /libdir/libjpeg.a -o myprog
+
+     or
+
+     cc -DSUN -DHDF -Iincdir myprog.c -L libdir -lnetcdf \
+         -ldf -ljpeg -o myprog
+
+     Note that the order is important: libnetcdf.a must occur first,
+     then libdf.a, and then libjpeg.a.
+  
+     For FORTRAN programs, use command line:
+
+      f77 -o myprogf myprogf.f libdir/libnetcdf.a \
+         libdir/libdf.a libdir/libjpeg.a
+
+    or
+
+      f77 -o myprogf myprogf.f -L libdir -lnetcdf -ldf -ljpeg
+  
+     Note that the order is important: libnetcdf.a, then libdf.a 
+     and then libjpeg.a.
+ 
+   o Compression for HDF SDS (not completely working)
+     Work is almost complete on the addition of two
+     new compression functions to the SD interface. 
+
+     One function, which still has some known bugs, will 
+     allow users to compress a scientific dataset using 
+     any of several compression methods.  Initially two 
+     schemes,  RLE encoding and an adaptive Huffman 
+     compression algorithms, will be available. 
+
+     A second function is available for storing a scientific 
+     dataset using integers whose size is any number of bits 
+     between 1 and 32 (instead of being restricted to 8, 16 
+     or 32-bit sizes). 
+
+     A draft of the documentation for these functions is in
+            ./comp_SDS.txt
+
+
+   o External Path Handling
+     New functions have been added to allow applications to 
+     specify directories to create or search for external 
+     files. More explanation can be found in:
+   
+            ./external_path.txt.
+ 
+          
+   o Parallel I/O for the CM5
+     An extension using the parallel I/O facilities on a  CM5 
+     has been added to the SDS interface.  Initial tests have 
+     resulted in about 25 MBytes/second I/O throughput using the 
+     SDA (Scalable Disk Array) file system. The library 
+     provides interfaces for both C* and CMF programming
+     languages. See:
+
+            ./parallel_CM5.txt for details.
+
+
+   o HDF dumper
+     Hdp is a command line utility designed for quick 
+     display of contents and data of HDF3.3 objects, RIS, 
+     SDS, Vdata, and Vgroup. It can list the contents of 
+     hdf files at various levels with different details. 
+     It can also dump the data of one or more specific 
+     objects in the file.  See:
+
+            ./hdp.txt for details.
+
+     Currently hdp works on SunOS and LINUX only. 
+
+2. Bugs fixed and known problems
+
+  Several bugs or problems, such as failure in setting 
+  and getting scales for unlimited dimensions, missing 
+  Fortran version of VSQxxxx functions, failure in 
+  defining more than 36 fields in Vdatas, etc. were 
+  fixed in this beta release. For more details about
+  fixed and un-fixed bugs and problems please see:
+  
+            ./bug_fixed.txt.
+
+3. HDF4.0 Beta 1 has been tested on the following systems:
+SunOS 4.1.3, SunOS 5.3 (Solaris 2.3), Linux, SGI/IRIX5.3, 
+SGI Power Challenge/IRIX6.0 (32-bit mode only), HP/UX 9.01, 
+IBM RS6000/AIX (C only), C3880/ConvexOS,11.0, CM5, Cray C90,
+DEC alpha/OSF (C only), DecStation/MIPSEL (C only), Windows NT,
+Free BSD 2.0, and Convex Exemplar/HPUX. See the INSTALL 
+file at the top level of HDF4.0b1 for more details.
+
+4. Installing HDF4.0 Beta 1 on Windows NT and Windows 95
+Since Windows NT, Windows '95 (Chicago) and Windows 3.1 
+(with the Win 32s extensions) all are designed to run 
+the same 32-bit code, we have decided to support only 
+32-bit libraries and code on the MS-Windows platform.  
+To build the HDF, JPEG and netCDF libraries and utilities, 
+follow the instructions listed in:
+
+            ./install_winNT.txt. 
+   
+5. Known problems in compilation,testing and installation
+   of HDF4.0b1:
+
+   . On SunOS, tsdmmsf.f in hdf/test/fortest fails
+   . On C90, mfhdf/fortran test doesn't configure correctly.
+     The adaptive Huffman algorithm does not work right 
+     either.  Due to this problem, when running 
+     hdf/test/testhdf the test module comp prints out 
+     error messages.  
+   . On DecStation/MIPSEL, ncdump gives a segmentation fault.
+   . The Fortran interface has not been tested on IBM RS6000, 
+     DecStation/MIPSEL, and Dec Alpha/OSF because a Fortran 
+     compiler is not available on those machines in our group.
+   . If the external element test in hdf/test/testhdf fails 
+     and there is no subdirectory "testdir" in hdf/test/, 
+     create one via "mkdir" and run the test again. (The 
+     "testdir" should have been created by "make". But 
+     the "make" in some old systems does not support the 
+     creation commands.)
+   . A bug was found in the "mfhdf.h" file late in the testing
+     stage. The error occured in the CM5 parallel I/O 
+     extension only. The fix is not included in the source
+     release, but it is avalable in the binary release for 
+     the CM5 version.  Please retrieve the fix there. 
+   . SDsetcompress does not work correctly.
+   . Hdp now works on SunOS and LINUX only. Commands dumpsds, 
+     dumpvd and dumpvg have different problems on other platforms.
+     See mfhdf/dumper/README for more details. 
+
+6. Installing without FORTRAN support:
+   . On UNIX systems without a FORTRAN system installed, 
+     the config/mh-<sys> will need to have the 'FC' macros 
+     defined to "NONE" for correct configuration and the 
+     target "allnofortran" should be used to build the 
+     distribution, instead of the target "all".
+
+
+%%%4.0alpha%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+                            ABOUT_4.0.alpha
+
+This file was last updated: November 8, 1994 
+
+
+INTRODUCTION 
+
+This is a preliminary document describing the differences
+between HDF4.0 (Alpha) and HDF3.3r3. It is written for people
+who already use HDF3.3r3 or earlier versions and wish to be
+HDF4.0 Alpha testers. Special emphasis is given to changes
+that might be required in existing code. 
+
+The files ABOUT_3.3r3, ABOUT_3.3r2 and ABOUT_3.3r1 which were 
+released along with previous releases contain detailed
+descriptions of HDF3.3. Those files can be found in this 
+directory. First-time HDF users are encouraged to read the FAQ 
+file in directory HDF/ for more information about HDF and where 
+to get HDF documentation. 
+
+If you have any questions or comments, please send them to: 
+
+hdfhelp at ncsa.uiuc.edu. 
+
+Contents 
+
+1. Changes in include file names for FORTRAN programs 
+2. New features supported by HDF4.0 
+      ANSI C only 
+      n-bit SDS 
+      Reading CDF files 
+      Parallel I/O interface on CM5 
+      Installing HDF Libraries With CM5 Parallel IO Extension 
+3. Changes in HDF utilities 
+      hdp -- HDF dumper 
+      ristosds 
+      hdfls 
+      hdfpack 
+      hdfunpac 
+4. Platforms tested 
+5. Limits of the current release 
+
+1. Changes in include file names for FORTRAN programs
+
+   In hdf/ there are two files for FORTRAN programs to include
+   the values and functions defined in HDF. They were
+   originally named as constant.i and dffunct.i. The extension .i
+   causes problems on some machines since *.i is used by cc as
+   an "intermediate" file produced by the cpp preprocessor. In
+   HDF 4.0 dffunct.i is changed to dffunct.inc, and constant.i is
+   changed to hdf.inc. Users' existing FORTRAN application
+   programs need to make the corresponding changes, if they
+   include the .i files, in order to compile with HDF4.0. 
+
+2. New Features supported by HDF4.0
+
+   ANSI C only
+
+      As previously noted in the HDF newsletters, the next
+      major release of the HDF library will compile only with
+      ANSI C compilers. Backward compatibility will be
+      provided through an ANSI->K&R filter which will need to
+      be run on each source file in order to convert the ANSI
+      style code into K&R style code. Currently the entire HDF
+      library has been converted to ANSI code, but the filter
+      is not yet in place. Future alpha releases may have the
+      code filter in place, but it will definitely be in place
+      for the first beta release. This shift to ANSI C
+      compliance has been accompanied by a large cleanup in
+      the source code. An attempt has been made to remove all
+      warnings and informational messages that the compilers
+      on supported platforms occasionally emit, but this may
+      not be completely clean for all user sites. 
+
+   n-bit SDS
+
+      Support for n-bit integer data has been incorporated
+      into this release of the HDF library. The n-bit support
+      is currently incorporated into the call to
+      SDsetnbitdataset, future releases may incorporate high
+      level access through the DFSD interface also. Access to
+      the data stored in an n-bit data item is transparent to
+      the calling program. 
+
+      For example to store an unsigned 12-bit integer (which
+      is represented unpacked in memory as an unsigned 16-bit
+      integer), with no sign extension or bit filling and
+      which starts at bit 14 (counting from the right with bit
+      zero being the lowest) the following setup & call would
+      be appropriate: 
+
+      intn sign_ext = FALSE; 
+
+      intn fill_one = FALSE; 
+
+      intn start_bit= 14; 
+
+      intn bit_len = 12; 
+
+      SDsetnbitdataset(sds_id,start_bit,bit_len,sign_ext,fill_one); 
+
+      Further reads and writes to this dataset would
+      transparently convert the 16-bit unsigned integers from
+      memory into 12-bit unsigned integers stored on disk. The
+      corresponding FORTRAN function name is sfsnbit which
+      takes the same parameters in the same order.
+
+      A breakdown of the parameters to the SDsetnbitdataset
+      call is as follows: 
+
+      int32 sds_id - The id of a scientific dataset returned from
+      SDcreate or SDselect. intn start_bit - This value
+      determines the bit position of the highest end of the
+      n-bit data to write out. Bits in all number- types are
+      counted from the right starting with 0. For example, in
+      the following bit data, "01111011", bits 2 and 7 are set
+      to 0 and all the other bits are set to one. 
+
+      intn bit_len - The number of bits in the n-bit data to
+      write, including the starting bit, counting towards the
+      right (i.e. lower bit numbers). For example, starting at
+      bit 5 and writing 4 bits from the following bit data,
+      "01111011", would write out the bit data, "1110", to the
+      dataset on disk. 
+
+      intn sign_ext - Whether to use the top bit of the n-bit
+      data to sign-extend to the highest bit in the memory
+      representation of of the data. For example, if 9-bit
+      signed integer data is being extracted from bits 17-25
+      (nt=DFNT_INT32, start_bit=25, bit_len=9, see below for
+      full information about start_bit & bit_len parameters)
+      and the bit in position 25 is a 1, then when the data is
+      read back in from the disk, bits 26-31 will be set to a
+      1, otherwise bit 25 will be a zero and bits 26-31 will
+      be set to 0. This bit-filling takes higher precendence
+      (i.e. is performed after) the fill_one (see below)
+      bit-filling. 
+
+      intn fill_one - Whether to fill the "background" bits with
+      1's or 0's. The "background" bits of a n-bit dataset are
+      those bits in the in-memory representation which fall
+      outside of the actuall n-bit field stored on disk. For
+      example, if 5 bits of an unsigned 16-bit integer
+      (in-memory) dataset located in bits 5-9 are written to
+      disk with the fill_one parameter set to TRUE (or 1),
+      then when the data is read back into memory at a future
+      time, bits 0-4 and 10-15 would be set to 1. If the same
+      5-bit data was written with a fill_one value of FALSE
+      (or 0), then bits 0-4 and 10-15 would be set to 0. This
+      setting has a lower precedence (i.e. is performed first)
+      than the sign_ext setting. For example, using the
+      sign_ext example above, bits 0-16 and 26-31 will first
+      be set to either 1 or 0 based on the fill_one parameter,
+      and then bits 26-31 will be set to 1 or 0 based on
+      bit-25's value. 
+
+   Reading CDF files
+
+      With HDF 4.0 limited support for reading CDF files was
+      added to the library. This support is still somewhat in
+      the development stage and is therefore limited. 
+
+      To begin with, unlike the netCDF merger, the CDF API is
+      not supported. Rather, the SD and netCDF APIs can be
+      used to access information pulled out of CDF files. 
+
+      The type of files supported are limited to CDF 2.X
+      files. The header information is different between CDF
+      1.X and 2.X files. In addition, all of the files must be
+      stored as single-file CDFs in network encoding. 
+
+      If there is user demand, and support, the types of CDF
+      files readable may be increased in the future. 
+
+   Parallel I/O interface on CM5 
+
+      An extension using the parallel IO in CM5 is added to
+      the SDS interface. Initial tests have resulted in about
+      25 MBytes/second IO throughput using the SDA (Scalable
+      Disk Array) file system. The library provides interfaces
+      for both C* and CMF programming languages. Read the
+      section "Installing HDF Libraries With CM5 Parallel IO
+      Extension" below for specific installation instructions.
+
+      Users will find some examples in the directory
+      mfhdf/CM5/Examples. Please send comments, bugs reports,
+      etc. to acheng at ncsa.uiuc.edu. 
+
+      The parallel I/O interface stores scientific datasets in
+      external files. New options have been added to hdfls and
+      hdfpack to handle them. A new utility program, hdfunpac,
+      is created for external files handling too. See the man
+      pages for details. 
+
+   Installing HDF Libraries With CM5 Parallel IO Extension
+
+      The current alpha version requires two major steps to
+      install the HDF libraries (libdf.a and libnetcdf.a). Works
+      are in progress to make it simpler in the production
+      release. Bear with us for now. 
+
+      1) Compile and install the ordinary HDF libraries,
+      include files and utilities according to the
+      instructions for a Sun Microsystem machine. 
+
+      2) To make the HDF library with CM5 parallel IO
+      extension: There are two new libraries, libdfcm5.a and
+      libnetcdfcm5.a that are similar to libdf.a and
+      libnetcdf.a. 
+
+      For libdf.a 
+
+              cd hdf
+              cp MAKE.CM5 Makefile
+              cp src/Makefile.CM5 src/Makefile
+              make libdf          # create the parallel IO libdf.a
+               # to install it in /usr/local/lib
+              cp src/libdf.a /usr/local/lib/libdfcm5.a
+              ranlib /usr/local/lib/libdfcm5.a
+           
+
+      For libnetcdf.a 
+
+              cd mfhdf
+              # edit CUSTOMIZE to use "gcc" as the CC compiler
+              # and add "-DCM5" to the CFLAGS variable.
+              ./configure
+              (cd libsrc; make )      # compile the library
+              # to install it in /usr/local/lib
+              cp libsrc/libnetcdf.a /usr/local/lib/libnetcdfcm5.a
+              ranlib /usr/local/lib/libnetcdfcm5.a
+           
+
+3. Changes in HDF utilities
+
+   hdp -- HDF dumper 
+      A new utility hdp is under development to list contents
+      of HDF files and to dump data of HDF objects. A
+      prototype is included in HDF4.0 Alpha for users to play
+      with and comment on. Development will continue based on
+      users' feedback. More information is contained in
+      HDF/HDF4.0.alpha/mfhdf/dumper/README. 
+
+   ristosds 
+      Ristosds now converts several raster images into a 3D
+      uint8, instead of float32, SDS. 
+
+   hdfls 
+      New options to recognize external elements. 
+
+   hdfpack 
+      New options to pack external elements back into the main
+      file. 
+
+   hdfunpac 
+      New utility program to unpack scientific datasets to
+      external elements. Can be used to prepare for CM5
+      parallel IO access. 
+
+4. HDF 4.0 Alpha has been tested on the following machines
+
+   Platform                'base library'              HDF/netCDF
+   ---------------------------------------------------------------
+   Sun4/SunOs                    X                         X
+   Sun4/SOLARIS                  X                         X
+   IBM/RS6000                    X                         X
+   SGI/IRIX4                     X                         X
+   Convex/ConvexOS *             X                         X
+   Cray Y-MP/UNICOS              X                         X
+   Cray/C90                      X                         X
+   NeXT/NeXTSTEP                 X                         X
+   HP/UX 9.01                    X                         X
+   DecStation/MIPSEL             X                         X
+   IBM PC - MSDOS               **                        ***
+   IBM PC - Windows 3.1         **                        ***
+   IBM PC - Windows NT           X                         X
+   DEC Alpha/OSF                 X                         X
+   CM5/                          X                         X
+
+   Fujitsu VP/UXPM               X
+   Intel i860                    X
+   Mac/MacOS 
+   VMS
+
+    * When compiling the mfhdf section of the library on a Convex3 you will
+      need to set the environment variable 'MACHINE' to 'c3' before running
+      the configure script.
+
+    ** There is no FORTRAN support for either PC version of HDF4.0 Alpha
+
+    *** The netCDF half of the HDF/netCDF merger is not working correctly,
+         but the multi-file SD interface is working correctly.
+
+5. Limits of the current release
+
+   Sometimes it is important for HDF users to be aware of
+   certain limits in using HDF files and HDF libraries. This
+   section is aimed at HDF applications programmers and
+   reflects upperbounds as of HDF 4.0. 
+
+   Limits that are #define'd are fully capitalized and the
+   file where the symbol is defined is given in parentheses at
+   the end of the sentence. If the #define's are changed in
+   order to meet the needs of an application, it is important
+   to make sure that all other users, who would share the HDF
+   library and the hdf files of the application, are aware of
+   the changes. 
+
+   If a limit has no #define, the size of the maximum storage
+   allocated for that item is given; it would, generally,
+   require a large amount of modification of the HDF library
+   to change. 
+
+   If a limit is listed as a number type (e.g. int16) then it
+   refers to the largest number that can be represented using
+   that type. That is: 
+
+           int16 -- 32,767
+           int32 -- 2,147,483,647.
+
+   H-Level Limits
+   --------------
+
+      MAX_FILE files open at a single time (hfile.h) 
+      MAX_ACC access records open at a single time (hfile.h) 
+      int16 total tags (fixed) 
+      int32 max length and offset of an element in an HDF file (fixed) 
+
+   Vgroup Limits
+   -------------
+      MAX_VFILE vset files open at a single time (hdf.h)
+      int16 elements in a Vgroup (fixed) 
+      VGNAMELENMAX max length of a Vgroup name or class (vg.h) 
+
+   Vdata Limits
+   ------------
+      MAX_VFILE vset files open at a single time (hdf.h)
+      VSFIELDMAX fields in a Vdata (hdf.h) 
+      FIELDNAMELENMAX characters in a single field name (hdf.h) 
+      MAX_ORDER max field order in a Vdata (hdf.h) 
+      VSNAMELENMAX max length of a Vdata name or class (hdf.h) 
+      int16 max width in bytes of a Vdata record. (fixed) 
+      Vdatas can have a maximum field width of MAX_FIELD_SIZE bytes. (hdf.h)
+           
+   Raster Images
+   -------------
+      int32 width or height of a raster image. (fixed) 
+
+   SD Limits
+   ---------
+      MAX_VAR_DIMS dimensions per dataset (defined in netcdf.h
+          included by mfhdf.h) 
+      int32 maximum dimension length (fixed) 
+      MAX_NC_ATTRS attributes for a given object (defined in netcdf.h 
+          included by mfhdf.h) 
+      MAX_NC_NAME maximum length of a name of a dataset 
+          (defined in netcdf.h included by mfhdf.h) 
+
+   Other Convensions / Issues
+   --------------------------
+      Some utility programs (e.g. ncgen) expect dataset names to be 
+      composed of only alphanumeric, '-' and '_' characters. 
+
diff --git a/release_notes/INSTALL b/release_notes/INSTALL
new file mode 100644
index 0000000..9ee8064
--- /dev/null
+++ b/release_notes/INSTALL
@@ -0,0 +1,192 @@
+
+    Installation Instructions for HDF4 on Unix and Mac OSX Platforms
+    ===================================================================
+
+CONTENTS
+
+1. Third-party Software Requirements
+2. Optional Szip Compression Library
+3. HDF4 Source Code and Precompiled Binaries 
+4. Unix and Mac OSX Configuration and Build
+5. Using HDF/MFHDF Libraries with the netCDF Library (libnetcdf.a)
+
+
+
+1. Third-party Software Requirements
+   =================================
+
+C and Fortran compilers. If a Fortran compiler is not available, use 
+the --disable-fortran configure flag to build the HDF4 C library and 
+utilties. For the list of the supported compilers see RELEASE.txt in the 
+release_notes directory.
+
+JPEG Distribution Release 6b or Later (libjpeg.a(so)). The source code can 
+be downloaded from http://www.ijg.org/.
+
+ZLIB 1.1.4(libz.a) or later. The source code and binaries may be 
+downloaded from http://www.gzip.org/. They are also available on 
+The HDF Group's FTP server at ftp://ftp.hdfgroup.org/lib-external/zlib/.
+
+
+
+2. Optional Szip Compression Library
+   =================================
+
+HDF4 may be configured to use the Szip compression Library. For more 
+information about the Szip library, see http://hdfgroup.org/doc_resource/SZIP/.
+
+The Szip compression library is free for non-commercial use; see 
+http://hdfgroup.org/doc_resource/SZIP/Commercial_szip.html for information 
+regarding commercial use.
+
+
+
+3. HDF4 Source Code and Precompiled Binaries
+   =========================================
+
+The HDF Group (THG) provides a "tar source ball" and precompiled binaries 
+from the company's FTP server at these locations: 
+
+    ftp://ftp.hdfgroup.org/HDF/HDF_Current/src
+    ftp://ftp.hdfgroup.org/HDF/HDF_Current/bin 
+   
+Starting with the HDF 4.2.6 release, binaries are packed  with the ZLIB, 
+JPEG, and Szip libraries used to build the binaries. 
+
+HDF4 prebuilt utilties come with Szip compression. To use these binaries, 
+you must install the Szip Library on your system. 
+
+Precompiled Szip binaries can be downloaded from:
+
+    ftp://ftp.hdfgroup.org/lib-external/szip/2.0/bin/
+
+Source code for the Szip library can be found on the same server:
+    ftp://ftp.hdfgroup.org/lib-external/szip/2.1/src
+
+To build the Szip library, follow the instructions in the Szip source code 
+distribution.
+
+
+
+4. Unix and Mac OSX Configuration and Build
+   =======================================
+
+See RELEASE.txt in the release_docs/ subdirectory for the list of platforms 
+tested for this release.
+
+Before You Start:
+
+   1)  Make sure that the ZLIB and JPEG libraries are installed on your
+       system.
+
+   2)  Optional: Install the Szip version 2.1 library (you may use 
+       Szip 2.0 binaries). 
+
+   3)  Extract the source from the hdf-X.Y.Z.tar file and change
+       directory to hdf-X.Y.Z.
+
+To Configure:
+
+   4)  Use the configure command in the top level HDF4 directory hdf-X.Y.Z:
+
+       ./configure --with-zlib=/path_to_ZLIB_install_directory 
+                   --with-jpeg=/path_to_JPEG_install_directory 
+                   <--with-szlib=/path_to_SZIP_install_directory>
+                   --prefix=/path_to_HDF4_install_directory
+
+       * Please note that when the szlib option is not used, the Szip 
+         library will not be configured in and Szip compression will not 
+         be enabled.
+       * If your system has the ZLIB and/or JPEG libraries installed under a
+         system library directory (such as /usr/lib), configure will
+         automatically find the library. In this case, the corresponding
+         configure flag may be omitted.
+       * Note that --prefix defines where the installation path is.
+         The default is set as <hdf4_build_directory>/hdf4.
+
+To Build and Test:
+
+   5)  To build the library:
+
+       gmake >& gmake.out
+
+   6)  To build and run the tests:
+
+       gmake check >& check.out
+
+To Install:
+
+   7)  To install the HDF4 library and tools:
+
+       gmake install
+
+   8)  To install C and Fortran examples
+    
+       gmake install-examples
+
+   9)  To test the installation 
+
+       gmake installcheck
+
+   10) By default, the current configuration uses vendor compilers; to use
+       another compiler, run the following commands before running configure: 
+
+       setenv CC   "foo -flags"
+       setenv F77  "fffoo -flags"
+
+       See the configure help page (configure --help) for a list of
+       environment variables that have an affect on building the library.
+
+   11) You may build HDF4 in a directory other than hdf-X.Y.Z by using
+       the "srcdir" option. Simply create a build directory and type:
+
+       <path_to_hdf-X.Y.Z>/configure ...
+
+       where "..." are your configuration options.
+
+
+
+5. Using HDF/MFHDF Libraries with the netCDF Library (libnetcdf.a)
+   ===============================================================
+
+   To use the HDF/MFHDF libraries (libdf.a, libmfhdf.a) with the 
+   netCDF library (libnetcdf.a), the HDF4 distribution must be configured 
+   with the --disable-netcdf configuration flag. 
+
+   When this flag is used, the HDF versions of the C netCDF functions 
+   (as of netCDF version 2.3.2) are renamed from ncxxx to sd_ncxxx, 
+   and HDF Fortran netCDF wrappers are disabled to avoid name clashes with 
+   the netCDF C and Fortran functions from libnetcdf.a.
+
+   Please report all problems to help at hdfgroup.org.
+
+
+6. Windows Configuration and Build
+   =======================================
+
+See RELEASE.txt in the release_docs/ subdirectory for the list of platforms 
+tested for this release.
+
+We now recommend that users build, test, and install HDF4 using CMake.
+
+Instructions for building and testing HDF4 using CMake can be found in the
+INSTALL_CMake.txt file found in this folder.
+
+For instructions on building and testing an application with HDF4, see the 
+USING_HDF4_CMake.txt file found in this folder.
+
+Users who want to build and run an application with HDF4 in Visual Studio
+without using CMake should consult the USING_HDF4_VS.txt file.
+
+Additional Third-party Software Requirements:
+
+   1)  Flex and Bison programs are required to build the ncgen utility.
+   
+   2)  Recommended is the Win flex-bison project, a port of Flex & Bison tools 
+       to the Windows platform. Download from:
+           http://sourceforge.net/projects/winflexbison
+
+   3)  CMake version 2.8.11.1 or higher is needed to use Win flex-bison. 
+       Using an earlier version of CMake will require renaming the executables
+       without the "win_" prefix.
+
diff --git a/release_notes/INSTALL_CMake.txt b/release_notes/INSTALL_CMake.txt
new file mode 100644
index 0000000..c465a46
--- /dev/null
+++ b/release_notes/INSTALL_CMake.txt
@@ -0,0 +1,930 @@
+************************************************************************
+* Build and Install the HDF4 C/C++ Library with CMake                  *
+************************************************************************
+
+                     Table of Contents
+                     
+Section I:   Quick Step Building HDF4 Libraries with CMake Script Mode 
+Section II:  Quick Step Building HDF4 Libraries with CMake Command Mode
+Section III: Preconditions
+Section IV:  Building HDF4 C/Fortran Libraries with CMake
+Section V:   All Options for HDF4 C/Fortran Libraries with CMake
+Section VI:  User-defined Options for HDF4 Libraries with CMake
+Section VII: APPENDIX
+
+************************************************************************
+
+
+
+========================================================================
+I. Quick Step Building HDF4 Libraries with CMake script mode
+========================================================================
+This short set of instructions is written for users who want to quickly 
+build the HDF4 Library and tools from the HDF4 source code package 
+using the CMake tools. HDF Group recommends using a ctest script to build
+HDF4.
+
+To build HDF4 with the SZIP, ZLIB and JPEG external libraries you will need to:
+
+    1. Create a directory for your development; myhdfstuff.
+    
+    2. Create a directory for the HDF4 source; hdf4.2.10 in myhdfstuff.
+
+    3. Download the SZip.tar.gz, ZLib.tar.gz, and JPEG.tar.gz to your 
+       development directory, (See Section VII: APPENDIX for instructions). 
+       All are needed if building with external libraries; do not uncompress them.
+       
+    4. Download or create the CTestScript.cmake file in your development 
+       directory, (See Section VII: APPENDIX for instructions and an example).   
+          
+    5. Download or create a platform configuration file in your development 
+       directory, (See Section VII: APPENDIX for instructions and an example). 
+       This file calls CTestScript.cmake; the platform configuration file can 
+       be modified. CTestScript.cmake file should not be modified.    
+
+    6. From your development directory execute the CTest Script with the 
+       following options:
+
+        ctest -S <configuration file>,<hdf4src> -C Release -VV -O hdf4.log
+
+    7. This will create an install package in the myhdfstuff/hdf4.2.10/build folder.
+
+    Where:
+        "configuration file" is the platform configuration file from step 5;
+          HDF4WindowsCMake.cmake, HDF4LinuxCMake.cmake, or HDF4MacCMake.cmake
+          can be downloaded from the HDF Group website.
+        "hdf4src" is the uncompressed HDF4 source code directory. No path 
+          should be specified.
+        
+        The -S option uses the script version of ctest.
+        
+        The value for the -C option (as shown above, "-C Release") must 
+        match the setting for CTEST_BUILD_CONFIGURATION in the platform 
+        configuration file.
+        
+        The -VV option is for verbose; Use -V for less verbose.
+        
+        The "-O hdf4.log" option saves the output to a log file hdf4.log.
+
+
+========================================================================
+II. Quick Step Building HDF4 Libraries with CMake command line mode
+========================================================================
+This short set of instructions is written for users who want to quickly 
+build the HDF4 Library and tools from the HDF4 source code package 
+using the CMake command line tools.
+       
+   A. Windows Quick Step Building HDF4 Libraries with CMake Using VS2010
+
+      Go through these steps:
+
+      1. Locate the source files in:
+         c:\MyHDFstuff\hdf4
+      
+      2. Create a build folder at:
+         c:\MyHDFstuff\hdf4\build
+      
+      3. Open a command prompt at:
+         c:\MyHDFstuff\hdf4\build
+      
+      4. Configure the C library, tools, and tests with this command:
+         cmake -G "Visual Studio 10" -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"
+            -DHDF4_PACKAGE_EXTLIBS:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON 
+            -DHDF4_BUILD_UTILS:BOOL=ON -DBUILD_TESTING:BOOL=ON 
+            -DCMAKE_INSTALL_PREFIX:PATH="." ..
+         The two dots on the end of the command is the location of the source.
+      
+      5. Build the C library, tools, and tests with this command:
+         cmake --build . --config Release
+      
+      6. Test the C library and tools with this command:
+         ctest . -C Release
+      
+      7. Create an install image with this command:
+         cpack -C Release CPackConfig.cmake
+      
+      8. Install with this command:
+         HDF4.2.x-win32.exe
+      
+   B. Linux Quick Step Building HDF4 Libraries with CMake Using GCC
+      
+      Go through these steps:
+      
+      1. Locate the source files in:
+         ~/MyHDFstuff/hdf4
+      
+      2. Create a build folder at:
+         ~/MyHDFstuff/hdf4/build
+      
+      3. Open a command prompt at:
+         ~/MyHDFstuff/hdf4/build
+      
+      4. Configure the C library, tools, and tests with this command:
+         cmake -G "Unix Makefiles" -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"
+            -DHDF4_PACKAGE_EXTLIBS:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON
+            -DHDF4_BUILD_UTILS:BOOL=ON -DBUILD_TESTING:BOOL=ON 
+            -DCMAKE_INSTALL_PREFIX:PATH="." ..
+         The two dots on the end of the command is the location of the source.
+      
+      5. Build the C library, tools, and tests with this command:
+         cmake --build . --config Release
+      
+      6. Test the C library and tools with this command:
+         ctest . -C Release
+      
+      7. Create an install image with this command:
+         cpack -C Release CPackConfig.cmake
+      
+      8. Install with this command:
+         HDF4.2.x-Linux.sh
+
+
+
+========================================================================
+III. Preconditions                                                           
+========================================================================
+
+   1. We suggest you obtain the latest CMake for Windows from the Kitware
+      web site. The HDF 4.2.x product requires a minimum CMake version of 
+      2.8.10.
+                                                                         
+   2. HDF4 requires Zlib and JPEG. Szip is optional. Use one of the choices
+      below:
+      A. Download the binary packages and install them in a central location. 
+         For example on Windows, create a folder extlibs and install the 
+         packages there. This will require telling CMake where the include 
+         and binary files are located.
+         
+      B. Use source packages from an SVN server by adding the following CMake 
+         options:
+         
+            HDF4_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"
+            JPEG_SVN_URL:STRING="http://some_location/jpeg/trunk"
+            ZLIB_SVN_URL:STRING="http://some_location/zlib/trunk"
+            SZIP_SVN_URL:STRING="http://some_location/szip/trunk"
+            
+         where "some_location" is the URL to the SVN repository.
+         
+      C. (Preferred) Use source packages from a compressed file by adding the
+         following CMake options:
+         
+            HDF4_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
+            JPEG_TGZ_NAME:STRING="jpeg_src.ext"
+            ZLIB_TGZ_NAME:STRING="zlib_src.ext"
+            SZIP_TGZ_NAME:STRING="szip_src.ext"
+            TGZPATH:STRING="some_location"
+            
+         where "some_location" is the URL or full path to the compressed 
+         file and ext is the type of compression file. See the appendix at 
+         the bottom of this file for downloading the files.
+                                                                         
+   3. If you are building under CYGWIN set the following option;
+            HDF4_BUILD_XDR_LIB:BOOL=ON
+                                    
+   4. If you are building on Apple Darwin platforms, you should add the 
+      following options:
+      
+      A. Compiler choice - use xcode by setting the ENV variables of CC and 
+         CXX.
+         
+      B. Shared Fortran is not supported, build static:
+      
+            BUILD_SHARED_LIBS:BOOL=OFF
+            
+      C. Additional options:
+      
+            CMAKE_ANSI_CFLAGS:STRING=-fPIC
+            CTEST_USE_LAUNCHERS:BOOL=ON
+            CMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF         
+   
+   5. Windows developers should install NSIS to create an executable install image 
+      with CPack. Visual Studio Express users will not be able to package 
+      HDF4 into an executable install image executable. Use the HDF4_NO_PACKAGES option.
+   
+   6. Developers can copy the config/cmake/cacheinit.cmake file and alter 
+      the settings for the developers' environment. Then the only options 
+      needed on the command line are those options that are different. An 
+      example using the HDF default cache file is:
+      
+        cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 10" \
+          -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF4_BUILD_EXAMPLES:BOOL=OFF ..
+
+Notes: CMake and HDF4
+
+   1. Using CMake for building and using HDF4 is under active development. 
+      While we have attempted to provide error-free files, please 
+      understand that development with CMake has not been extensively 
+      tested outside of HDF. The CMake specific files may change
+      before the next release.
+            
+   2. CMake support for HDF4 development should be usable on any 
+      system where CMake is supported. Please send us any comments on 
+      how CMake support can be improved on any system. Visit the 
+      KitWare site for more information about CMake.
+            
+   3. Build and test results can be submitted to our CDash server at:
+                 cdash.hdfgroup.uiuc.edu. 
+      Please read the HDF and CDash document at:
+                 www.hdfgroup.org/CDash/HowToSubmit. 
+            
+   4. See the appendix at the bottom of this file for examples of using
+      a ctest script for building and testing. Using a ctest script is
+      preferred because of its flexibility.
+            
+Notes: CMake in General
+
+   1. More information about using CMake can be found at the KitWare site at 
+      www.cmake.org.
+         
+   2. CMake uses the command line; however, the visual CMake tool is 
+      available for the configuration step. The steps are similar for
+      all the operating systems supported by CMake.
+
+
+
+========================================================================
+IV. Building HDF4 C/Fortran Libraries with CMake command line mode
+========================================================================
+
+This section provides more details on building the HDF4 C/Fortran Libraries
+with CMake using the CMake command line tools, go through these five steps:
+
+   1. Run CMake
+   2. Configure the cache settings
+   3. Build HDF4
+   4. Test HDF4
+   5. Packaging HDF4 (create install image)
+
+These five steps are described in detail below.
+
+========================================================================
+
+   1. Run CMake
+
+      The visual CMake executable is named "cmake-gui.exe" on Windows and 
+      should be available in your Start menu. For Linux, Unix, and Mac users 
+      the executable is named "cmake-gui" and can be found where CMake was 
+      installed. 
+      
+      Specify the source and build directories. 
+      
+      ***** Make the build and source directories different. ******
+      
+      For example on Windows, if the source is at c:\MyHDFstuff\hdf4, 
+      then use c:\MyHDFstuff\hdf4\build or c:\MyHDFstuff\build\hdf4 as the 
+      build directory.
+      
+      RECOMMENDED:
+        Users can perform the configuration step without using the visual 
+        cmake-gui program. We use the file cacheinit.cmake in the 
+        config/cmake folder for our testing. This file enables all of the 
+        basic options, and we turn specific options on or off for testing 
+        using the following command line within the build directory:
+        
+        cmake -C <sourcepath>/config/cmake/cacheinit.cmake -G "<generator>"  [-D<options>]  <sourcepath>
+        
+        Where <sourcepath> is:
+            the relative path to the source folder.
+        
+        <generator> is:    
+            * Borland Makefiles
+            * MSYS Makefiles
+            * MinGW Makefiles
+            * NMake Makefiles
+            * Unix Makefiles
+            * Visual Studio 11
+            * Visual Studio 11 Win64
+            * Visual Studio 10
+            * Visual Studio 10 Win64
+            * Visual Studio 6
+            * Visual Studio 7
+            * Visual Studio 7 .NET 2003
+            * Visual Studio 8 2005
+            * Visual Studio 8 2005 Win64
+            * Visual Studio 9 2008
+            * Visual Studio 9 2008 Win64
+
+        <options> is:
+            * SZIP_INCLUDE_DIR:PATH=<path to szip includes directory>
+            * SZIP_LIBRARY:FILEPATH=<path to szip/library file>
+            * ZLIB_INCLUDE_DIR:PATH=<path to zlib includes directory>
+            * ZLIB_LIBRARY:FILEPATH=<path to zlib/library file>
+            * JPEG_INCLUDE_DIR:PATH=<path to jpeg includes directory>
+            * JPEG_LIBRARY:FILEPATH=<path to jpeg/library file>
+            * <HDF4OPTION>:BOOL=[ON | OFF]
+
+        <cacheinit.cmake> is:
+            # This is the CMakeCache file.
+            ########################
+            # EXTERNAL cache entries
+            ########################
+            SET (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
+            SET (BUILD_TESTING ON CACHE BOOL "Build HDF4 Unit Testing" FORCE)
+            SET (HDF4_BUILD_EXAMPLES ON CACHE BOOL "Build HDF4 Library Examples" FORCE)
+            SET (HDF4_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE)
+            SET (HDF4_BUILD_TOOLS ON CACHE BOOL "Build HDF4 Tools" FORCE)
+            SET (HDF4_BUILD_UTILS ON CACHE BOOL "Build HDF4 Library Utilities" FORCE)
+            SET (HDF4_ENABLE_NETCDF ON CACHE BOOL "Build HDF4 versions of NetCDF-3 APIS" FORCE)
+            SET (HDF4_BUILD_XDR_LIB OFF CACHE BOOL "Build HDF4 XDR Library" FORCE)
+            SET (HDF4_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)" FORCE)
+            SET (MPIEXEC_MAX_NUMPROCS "3" CACHE STRING "Minimum number of processes for HDF parallel tests" FORCE)
+            SET (HDF4_ENABLE_JPEG_LIB_SUPPORT ON CACHE BOOL "Enable Jpeg library" FORCE)
+            SET (HDF4_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE)
+            SET (HDF4_ENABLE_SZIP_SUPPORT ON CACHE BOOL "Use SZip Filter" FORCE)
+            SET (HDF4_ENABLE_SZIP_ENCODING ON CACHE BOOL "Use SZip Encoding" FORCE)
+            SET (HDF4_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE)
+            SET (HDF4_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE)
+            SET (HDF4_PACKAGE_EXTLIBS OFF CACHE BOOL "(WINDOWS)CPACK - include external libraries" FORCE)
+            SET (HDF4_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
+            SET (HDF4_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building" FORCE)
+            SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
+            SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
+            SET (JPEG_SVN_URL "http://svn.hdfgroup.uiuc.edu/jpeg/branches/jpeg8b" CACHE STRING "Use JPEG from HDF repository" FORCE)
+            SET (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
+            SET (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
+            SET (JPEG_TGZ_NAME "JPEG8b.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE)
+
+   2. Configure the cache settings
+
+      2.1  Visual CMake users, click the Configure button. If this is the 
+           first time you are running cmake-gui in this directory, you will 
+           be prompted for the generator you wish to use (for example on 
+           Windows, Visual Studio 11, to use Visual Studio 2012). CMake will read in the 
+           CMakeLists.txt files from the source directory and display options 
+           for the HDF4 project. After the first configure, you can adjust 
+           the cache settings and/or specify the locations of other programs.
+      
+           Any conflicts or new values will be highlighted by the configure
+           process in red. Once you are happy with all the settings and 
+           there are no more values in red, click the Generate button to 
+           produce the appropriate build files. 
+      
+           On Windows, if you are using a Visual Studio generator, the 
+           solution and project files will be created in the build folder.
+      
+           On Linux, if you are using the Unix Makefiles generator, the 
+           Makefiles will be created in the build folder.
+
+      2.2  Recommended command line example on Windows in 
+           the C:\MyHDFstuff\hdf4\build directory:
+      
+            cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 10" \
+            -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF4_ENABLE_Z_LIB_SUPPORT:BOOL=OFF ..
+
+      2.3  On Windows, if you are using a Visual Studio Express version, you 
+           must be sure that the following two options are correctly 
+           set/unset:
+           
+           HDF4_NO_PACKAGES:BOOL=ON
+           HDF4_USE_FOLDERS:BOOL=OFF
+           
+   3. Build HDF4
+   
+      On Windows, you can build HDF4 using either the Visual Studio Environment 
+      or the command line. The command line can be used on all platforms:
+      Windows, Linux, Unix, and Mac.
+
+      To build from the command line, navigate to your build directory and
+      execute the following:
+          
+            cmake --build . --config {Debug | Release}     
+              
+      NOTE: "--config {Debug | Release}" may be optional on your platform. We
+            recommend choosing either Debug or Release on Windows.                                                                                      
+             
+      3.1  If you wish to use the Visual Studio environment, open the solution 
+           file in your build directory. Be sure to select either Debug or 
+           Release, and then build the solution.
+             
+      3.2.1  The external libraries (zlib, Szip, and jpeg) can be configured
+           to allow building the libraries by downloading from an SVN repository.
+           The option is 'HDF4_ALLOW_EXTERNAL_SUPPORT'; by adding the following
+           configuration option:
+           
+               -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"
+               
+           The options to control the SVN URL (config/cmake/cacheinit.cmake file) 
+           are:
+           
+               JPEG_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/jpeg/branches/jpeg8b"
+               ZLIB_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/zlib/trunk"
+               SZIP_SVN_URL:STRING="http://svn.hdfgroup.uiuc.edu/szip/trunk"
+               
+           These should be changed to your location.
+           
+      3.2.2  Or the external libraries (zlib, Szip, and jpeg) can be configured
+           to allow building the libraries by using a compressed file.
+           The option is 'HDF4_ALLOW_EXTERNAL_SUPPORT' and is enabled by 
+           adding the following configuration option:
+           
+               -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ"
+               
+           The options to control the SVN URL (config/cmake/cacheinit.cmake 
+           file) are:
+           
+               JPEG_TGZ_NAME:STRING="jpeg_src.ext"
+               ZLIB_TGZ_NAME:STRING="zlib_src.ext"
+               SZIP_TGZ_NAME:STRING="szip_src.ext"
+               TGZPATH:STRING="some_location"
+               
+            where "some_location/xxxx_src.ext" is the URL or full path to 
+            the compressed file and where ext is the type of the compression 
+            file such as .bz2, .tar, .tar.gz, .tgz, or .zip.
+
+   4. Test HDF4
+
+      To test the build, navigate to your build directory and execute:
+      
+              ctest . -C {Debug | Release}
+              
+      NOTE: "-C {Debug | Release}" may be optional on your platform. We
+            recommend choosing either Debug or Release to match the build
+            step on Windows.                                                                                      
+
+   5. Packaging HDF4 (create an install image)
+   
+      To package the build into a simple installer using the NullSoft 
+      installer NSIS on Windows, or into compressed files (.tar.gz, .sh, 
+      .zip), use the CPack tool.
+
+      To package the build, navigate to your build directory and execute:
+      
+              cpack -C {Debug | Release} CPackConfig.cmake
+      
+      NOTES: 
+      
+      See note 8 below for NSIS information. 
+      
+      Also, if you are using a Visual Studio Express version or do not 
+      want to enable the packaging components, set HDF4_NO_PACKAGES 
+      to ON (on the command line add -DHDF4_NO_PACKAGES:BOOL=ON)
+           
+   6. The files that support building HDF4 with CMake are all of the files 
+      in the config/cmake folder, the CMakeLists.txt and CMakeTests.cmake 
+      files in each source folder, and CTestConfig.cmake. CTestConfig.cmake 
+      is specific to the internal testing performed by The HDF Group. It 
+      should be altered for the user's installation and needs. The 
+      cacheinit.cmake file settings are used by The HDF Group for daily 
+      testing. It should be altered/ignored for the user's installation and 
+      requirements.
+
+   7. More information about using CMake can be found at the KitWare site at 
+      www.cmake.org.
+
+   8. The Nullsoft Scriptable Install System (NSIS) is an open source 
+      installation system. It was created by the WinAmp authors to distribute 
+      that application, but it is now a general-purpose system which anyone 
+      might use. NSIS installers recognize /S for silent installation and 
+      /D=dir to specify the "output directory", which is where the program 
+      will be installed. These options are case-sensitive, so be sure to 
+      type them in upper case. 
+
+
+
+========================================================================
+V. All Options for HDF4 C/Fortran Libraries with CMake
+========================================================================
+
+In the options listed below, there are three columns of information: 
+Option Name, Option Description, and Option Default.
+
+---------------- General Build Options ---------------------
+BUILD_SHARED_LIBS  "Build Shared Libraries"    OFF
+BUILD_TESTING      "Build HDF4 Unit Testing"   OFF
+
+---------------- HDF4 Build Options ---------------------
+HDF4_BUILD_EXAMPLES "Build HDF4 Library Examples"          OFF
+HDF4_BUILD_FORTRAN  "Build FORTRAN support"                ON
+HDF4_BUILD_TOOLS    "Build HDF4 Tools"                     OFF
+HDF4_BUILD_UTILS    "Build HDF4 Utilities"                 OFF
+HDF4_BUILD_XDR_LIB  "Build HDF4 XDR Library"               OFF
+HDF4_ENABLE_NETCDF  "Build HDF4 versions of NetCDF-3 APIS" ON
+
+---------------- HDF4 Advanced Options ---------------------
+HDF4_DISABLE_COMPILER_WARNINGS "Disable compiler warnings"                                    OFF
+HDF4_ENABLE_COVERAGE           "Enable code coverage for Libraries and Programs"              OFF
+HDF4_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols"                         ON
+HDF4_ENABLE_LARGE_FILE         "Enable support for large (64-bit) files on Linux."            ON
+HDF4_ENABLE_PARALLEL           "Enable parallel build (requires MPI)"                         OFF
+HDF4_NO_PACKAGES               "Do not include CPack Packaging"                               OFF
+HDF4_PACKAGE_EXTLIBS           "CPACK - include external libraries"                           OFF
+HDF4_USE_FOLDERS               "Enable folder grouping of projects in IDEs."                  OFF
+IF (APPLE) 
+    HDF4_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path"  OFF
+IF (WIN32 AND NOT CYGWIN) 
+    HDF_LEGACY_NAMING          "Use Legacy Names for Libraries and Programs" OFF
+
+---------------- External Library Options ---------------------
+HDF4_ALLOW_EXTERNAL_SUPPORT  "Allow External Library Building"        "NO"
+HDF4_ENABLE_JPEG_LIB_SUPPORT "Enable libjpeg"                         ON
+HDF4_ENABLE_SZIP_SUPPORT     "Use SZip Filter"                        OFF
+HDF4_ENABLE_Z_LIB_SUPPORT    "Enable Zlib Filters"                    ON
+JPEG_USE_EXTERNAL            "Use External Library Building for JPEG" 0
+SZIP_USE_EXTERNAL            "Use External Library Building for SZIP" 0
+ZLIB_USE_EXTERNAL            "Use External Library Building for ZLIB" 0
+IF (HDF4_ENABLE_SZIP_SUPPORT) 
+    HDF4_ENABLE_SZIP_ENCODING "Use SZip Encoding"      OFF
+
+
+
+========================================================================
+VI. User-defined Options for HDF4 Libraries with CMake
+========================================================================
+
+Support for user-defined macros and options has been added. The file
+UserMacros.cmake has an example of the technique. In the folder 
+config/cmake/UserMacros is an implementation for Windows Visual Studio
+users for linking libraries to the static CRT - Windows_MT.cmake. 
+
+Copy the contents of the file, both macro and option, into the 
+UserMacros.cmake file. Then enable the option to the CMake configuration,
+build, and test process.
+
+========================================================================
+VII. APPENDIX
+========================================================================
+
+Below are examples of the ctest scripts used by The HDF Group.
+The examples are for a Linux machine, but the same scripts can be used on 
+a Windows machine by adjusting the CTEST_CMAKE_GENERATOR option in the
+product specific script.
+
+NOTE: these files are available at the HDF web site:
+    http://www.hdfgroup.org/release4/cmakebuild.html
+
+    CTestScript.cmake
+    SZip.tar.gz
+    ZLib.tar.gz
+    JPEG.tar.gz
+    
+    HDF4WindowsCMake.cmake
+    HDF4LinuxCMake.cmake
+    HDF4MacCMake.cmake
+
+
+
+========================================================================
+CTestScript.cmake                                                       
+========================================================================
+
+The CTestScript.cmake script shown below is a common ctest script that 
+is used to build, test, and package HDF4 Library files.
+
+
+
+cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+########################################################
+# This dashboard is maintained by The HDF Group
+# For any comments please contact cdashhelp at hdfgroup.org
+#
+########################################################
+# ----------------------------------------------------------- 
+# -- Get environment
+# ----------------------------------------------------------- 
+if(NOT SITE_OS_NAME)
+  ## machine name not provided - attempt to discover with uname
+  ## -- set hostname
+  ## --------------------------
+  find_program(HOSTNAME_CMD NAMES hostname)
+  exec_program(${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
+  set(CTEST_SITE  "${HOSTNAME}${CTEST_SITE_EXT}")
+  find_program(UNAME NAMES uname)
+  macro(getuname name flag)
+    exec_program("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
+  endmacro(getuname)
+ 
+  getuname(osname -s)
+  getuname(osrel  -r)
+  getuname(cpu    -m)
+  message("Dashboard script uname output: ${osname}-${osrel}-${cpu}\n")
+
+  set(CTEST_BUILD_NAME  "${osname}-${osrel}-${cpu}")
+  if(USE_AUTOTOOLS)
+    set(CTEST_BUILD_NAME  "AT-${CTEST_BUILD_NAME}")
+  endif(USE_AUTOTOOLS)
+  if(SITE_BUILDNAME_SUFFIX)
+    set(CTEST_BUILD_NAME  "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}")
+  endif(SITE_BUILDNAME_SUFFIX)
+  set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS}")
+else(NOT SITE_OS_NAME)
+  ## machine name provided
+  ## --------------------------
+  if(CMAKE_HOST_UNIX)
+    set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}")
+  else(CMAKE_HOST_UNIX)
+    set(CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}")
+  endif(CMAKE_HOST_UNIX)
+  if(SITE_BUILDNAME_SUFFIX)
+    set(CTEST_BUILD_NAME ${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX})
+  endif(SITE_BUILDNAME_SUFFIX)
+  set(BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
+endif(NOT SITE_OS_NAME)
+ 
+#-----------------------------------------------------------------------------
+# MAC machines need special option
+#-----------------------------------------------------------------------------
+if(APPLE)
+  # Compiler choice
+  execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
+  set(ENV{CC} "${XCODE_CC}")
+  set(ENV{CXX} "${XCODE_CXX}")
+
+  if(NOT NO_MAC_FORTRAN)
+    # Shared fortran is not supported, build static 
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
+  else(NOT NO_MAC_FORTRAN)
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
+  endif(NOT NO_MAC_FORTRAN)
+
+  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
+endif(APPLE)
+
+#-----------------------------------------------------------------------------
+## cygwin does not handle the find_package() call
+## --------------------------
+if(NOT SITE_CYGWIN})
+  find_package (Subversion)
+  set(CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}")
+else(NOT SITE_CYGWIN})
+  set(CTEST_UPDATE_COMMAND "/usr/bin/svn")
+endif(NOT SITE_CYGWIN})
+ 
+#-----------------------------------------------------------------------------
+set(NEED_REPOSITORY_CHECKOUT 0)
+set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
+if(CTEST_USE_TAR_SOURCE)
+  ## Uncompress source if tar file provided
+  ## --------------------------
+  if(WIN32)
+    set(CTEST_7Z_COMMAND "C:/Program Files/7-Zip/7z.exe")
+    message("extracting... [${CTEST_7Z_COMMAND} x ${CTEST_USE_TAR_SOURCE}.zip]")
+    execute_process(COMMAND ${CTEST_7Z_COMMAND} x ${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
+  else(WIN32)
+    message("extracting... [${CTEST_CMAKE_COMMAND} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]")
+    execute_process(COMMAND tar -xvf ${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
+  endif(WIN32)
+ 
+  if(NOT rv EQUAL 0)
+    message("extracting... [error-(${rv}) clean up]")
+    file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
+    message(FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed")
+  endif(NOT rv EQUAL 0)
+     
+  file(RENAME ${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY})
+  set(LOCAL_SKIP_UPDATE "TRUE")
+else(CTEST_USE_TAR_SOURCE)
+  ## use subversion to get source
+  ## --------------------------
+  if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
+    set(NEED_REPOSITORY_CHECKOUT 1)
+  endif(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
+ 
+  if(${NEED_REPOSITORY_CHECKOUT})
+    set(CTEST_CHECKOUT_COMMAND
+      "${CTEST_UPDATE_COMMAND} co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r HEAD")
+  else(${NEED_REPOSITORY_CHECKOUT})
+    set(CTEST_CHECKOUT_COMMAND "${CTEST_UPDATE_COMMAND} update")
+  endif(${NEED_REPOSITORY_CHECKOUT})
+endif(CTEST_USE_TAR_SOURCE)
+ 
+#-----------------------------------------------------------------------------
+## Clear the build directory
+## --------------------------
+set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
+file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
+#include(${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake)
+ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+
+# Use multiple CPU cores to build
+include(ProcessorCount)
+ProcessorCount(N)
+if(NOT N EQUAL 0)
+  if(NOT WIN32)
+    set(CTEST_BUILD_FLAGS -j${N})
+  endif(NOT WIN32)
+  set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
+endif()
+ 
+#-----------------------------------------------------------------------------
+# Send the main script as a note.
+if(USE_AUTOTOOLS)
+  ## autotools builds need to use make and does not use the cacheinit.cmake file
+  ## -- make command
+  ## -----------------
+  find_program(MAKE NAMES make)
+ 
+  list(APPEND CTEST_NOTES_FILES
+    "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
+    "${CMAKE_CURRENT_LIST_FILE}"
+  )
+else(USE_AUTOTOOLS)
+  list(APPEND CTEST_NOTES_FILES
+    "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
+    "${CMAKE_CURRENT_LIST_FILE}"
+    "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake"
+  )
+endif(USE_AUTOTOOLS)
+ 
+#-----------------------------------------------------------------------------
+# Check for required variables.
+# --------------------------
+foreach(req
+    CTEST_CMAKE_GENERATOR
+    CTEST_SITE
+    CTEST_BUILD_NAME
+  )
+  if(NOT DEFINED ${req})
+    message(FATAL_ERROR "The containing script must set ${req}")
+  endif(NOT DEFINED ${req})
+endforeach(req)
+ 
+#-----------------------------------------------------------------------------
+# Initialize the CTEST commands
+#------------------------------
+if(USE_AUTOTOOLS)
+  set(CTEST_CONFIGURE_COMMAND  "${CTEST_SOURCE_DIRECTORY}/configure ${ADD_BUILD_OPTIONS}")
+  set(CTEST_BUILD_COMMAND      "${MAKE} ${CTEST_BUILD_FLAGS}")
+  ## -- CTest Config
+  #configure_file($ENV{HOME}/CTestConfiguration/CTestConfig.cmake    ${CTEST_SOURCE_DIRECTORY}/CTestConfig.cmake)
+  configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake)
+  ## -- CTest Testfile
+#  configure_file(${CTEST_SCRIPT_DIRECTORY}/CTestTestfile.cmake ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake)
+  file(WRITE ${CTEST_BINARY_DIRECTORY}/CTestTestfile.cmake "ADD_TEST(makecheck \"${MAKE}\" \"${CTEST_BUILD_FLAGS}\" \"-i\" \"check\")")
+else(USE_AUTOTOOLS)
+  if(LOCAL_MEMCHECK_TEST)
+    find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
+    set (CTEST_CONFIGURE_COMMAND
+        "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+    )
+  else(LOCAL_MEMCHECK_TEST)
+    find_program(CTEST_COVERAGE_COMMAND NAMES gcov)
+    set (CTEST_CONFIGURE_COMMAND
+        "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
+    )
+  endif(LOCAL_MEMCHECK_TEST)
+endif(USE_AUTOTOOLS)
+ 
+#-----------------------------------------------------------------------------
+## -- set output to english
+set($ENV{LC_MESSAGES}  "en_EN")
+ 
+# Print summary information.
+foreach(v
+    CTEST_SITE
+    CTEST_BUILD_NAME
+    CTEST_SOURCE_DIRECTORY
+    CTEST_BINARY_DIRECTORY
+    CTEST_CMAKE_GENERATOR
+    CTEST_BUILD_CONFIGURATION
+    CTEST_GIT_COMMAND
+    CTEST_CHECKOUT_COMMAND
+    CTEST_CONFIGURE_COMMAND
+    CTEST_SCRIPT_DIRECTORY
+    CTEST_USE_LAUNCHERS
+  )
+  set(vars "${vars}  ${v}=[${${v}}]\n")
+endforeach(v)
+message("Dashboard script configuration:\n${vars}\n")
+ 
+#-----------------------------------------------------------------------------
+#-----------------------------------------------------------------------------
+  ## NORMAL process
+  ## -- LOCAL_UPDATE updates the source folder from svn
+  ## -- LOCAL_SUBMIT reports to CDash server
+  ## -- LOCAL_SKIP_TEST skips the test process (only builds)
+  ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing
+  ## -- LOCAL_COVERAGE_TEST executes code coverage process
+  ## --------------------------
+  CTEST_START (${MODEL} TRACK ${MODEL})
+  if(LOCAL_UPDATE)
+    CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}")
+  endif(LOCAL_UPDATE)
+  CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}")
+  CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}")
+  if(LOCAL_SUBMIT)
+    CTEST_SUBMIT (PARTS Update Configure Notes)
+  endif(LOCAL_SUBMIT)
+   CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
+  if(LOCAL_SUBMIT)
+    CTEST_SUBMIT (PARTS Build)
+  endif(LOCAL_SUBMIT)
+  if(NOT LOCAL_SKIP_TEST)
+    if(NOT LOCAL_MEMCHECK_TEST)
+      CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
+      if(LOCAL_SUBMIT)
+        CTEST_SUBMIT (PARTS Test)
+      endif(LOCAL_SUBMIT)
+    if(res GREATER 0)
+      message(FATAL_ERROR "Failed tests: ${res}\n")
+    endif(res GREATER 0)
+    else(NOT LOCAL_MEMCHECK_TEST)
+      CTEST_MEMCHECK (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args})
+      if(LOCAL_SUBMIT)
+        CTEST_SUBMIT (PARTS MemCheck)
+      endif(LOCAL_SUBMIT)
+    endif(NOT LOCAL_MEMCHECK_TEST)
+    if(LOCAL_COVERAGE_TEST)
+      CTEST_COVERAGE (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
+      if(LOCAL_SUBMIT)
+        CTEST_SUBMIT (PARTS Coverage)
+      endif(LOCAL_SUBMIT)
+    endif(LOCAL_COVERAGE_TEST)
+  endif(NOT LOCAL_SKIP_TEST)
+  if(NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE)
+    ##-----------------------------------------------
+    ## Package the product
+    ##-----------------------------------------------
+    execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V
+      WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
+      RESULT_VARIABLE cpackResult
+      OUTPUT_VARIABLE cpackLog
+      ERROR_VARIABLE cpackLog.err
+    )
+    file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}")
+    if(cpackResult GREATER 0)
+      message(FATAL_ERROR "Failed packaging: ${cpackResult}\n")
+    endif(cpackResult GREATER 0)
+  endif(NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE)
+#-----------------------------------------------------------------------------
+ 
+message("DONE:CTestScript")
+
+
+========================================================================
+ctest
+========================================================================
+
+Below is an example of the ctest script used by The HDF Group. The
+CTestScript.cmake file used by this script is shown above. Adjust the values 
+as necessary. Note that the source folder is entered on the command line 
+and the build folder is created as a sub-folder.
+
+
+
+############################################################################
+# Product specific script, HDF4Static.cmake, that uses the 
+# CTestScript.cmake file (see above). Usage:
+# "ctest -S HDF4Static.cmake,hdf4 -C Release -O hdf4static.log"
+# where hdf4 is the source folder relative to the location of these scripts
+############################################################################
+cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG})
+set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build)
+set(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}")
+set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
+set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
+set(MODEL "Experimental")
+
+####### Following Line is one of [Release, RelWithDebInfo, Debug] #############
+set(CTEST_BUILD_CONFIGURATION "RelWithDebInfo")
+######### Following describes computer ############
+set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
+
+##  Set the following to unique id your computer  ##
+set(CTEST_SITE "LINUX.XXXX")
+## following is optional to describe build ##
+set(SITE_BUILDNAME_SUFFIX "RWDI-SHARED")
+####################################################
+
+##### Following controls CDash submission  #####
+#set(LOCAL_SUBMIT "TRUE")
+##### Following controls test process  #####
+#set(LOCAL_SKIP_TEST "TRUE")
+#set(LOCAL_MEMCHECK_TEST "TRUE")
+#set(LOCAL_COVERAGE_TEST "TRUE")
+##### Following controls cpack command  #####
+set(LOCAL_NO_PACKAGE "TRUE")
+##### Following controls source update  #####
+#set(LOCAL_UPDATE "TRUE")
+set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf4/branches/hdf4_2_10")
+#uncomment to use a compressed source file *.tgz
+#set(CTEST_USE_TAR_SOURCE "hdf-4.2.10")
+############################################
+
+####  Change default configuration of options in config/cmake/cacheinit.cmake file ###
+### uncomment and change the following line for more configuration options
+#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:XXX=XXX")
+### uncomment the following line to build static libraries
+#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF")
+### ext libs from svn
+#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING=SVN")
+### ext libs from tgz
+set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}")
+### Create install package with external libraries (szip, zlib, szip)
+set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_PACKAGE_EXTLIBS:BOOL=ON")
+### disable test program builds
+#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF")
+### disable packaging
+#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF4_NO_PACKAGES:BOOL=ON")
+############################################
+
+include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
+
+
+
+========================================================================
+For further assistance, send email to help at hdfgroup.org
+========================================================================
+
+========================================================================
diff --git a/release_notes/INSTALL_CYGWIN.txt b/release_notes/INSTALL_CYGWIN.txt
new file mode 100644
index 0000000..ac904d8
--- /dev/null
+++ b/release_notes/INSTALL_CYGWIN.txt
@@ -0,0 +1,161 @@
+************************************************************************
+         HDF4 Build and Install Instructions for Cygwin
+************************************************************************
+
+This document is a instruction on how to build, test and install HDF4 libary on 
+Cygwin.  See detailed information in hdf4/INSTALL. 
+
+NOTE: hdf4 can be built with CMake, see the INSTALL_CMake.txt file for more guidance.
+
+Preconditions:
+--------------
+
+1. Installed Cygwin 1.7.25 or higher
+
+   To install the Cygwin net release, go to http://www.cygwin.com and 
+   click on "setup-x86.exe" (32-bit installation) under the heading
+    "Current Cygwin DLL version". This will download a GUI 
+   installer called setup-x86.exe which can be run to download a complete 
+   Cygwin installation via the internet. Then follow the instructions 
+   on each screen to install Cygwin.
+
+   Cygwin uses packages to manage installing various software. Users can 
+   choose to install or uninstall certain packages by running setup.exe.
+   http://www.cygwin.com/packages/ provides detailed information about 
+   Cygwin packages.
+
+   Most required dependencies can be satisfied by installing all packages in
+   the "Devel" category.  However, please verify that you have installed all
+   packages listed below.
+
+2. Compilers, Libraries and Utilities Installed
+
+   2.1 Compilers Supported
+    
+    The following compilers are supported by HDF4 and included in the Cygwin
+    package system:
+       gcc (4.7.3), which includes:
+            gcc4-core    : C compiler
+            gcc4-g++     : C++ compiler
+            gcc4-fortran : fortran compiler
+            
+
+   2.1.1 Using Compilers Not Supported
+       
+       By default the current configuration uses vendor compilers; to use
+        another compiler run the following commands before running
+        configure: 
+ 
+        setenv CC   "foo -flags"
+        setenv F77  "fffoo -flags"
+ 
+        See the configure help page (configure --help) for a list of
+        environment variables that have an affect on building the
+        library.
+        
+    2.2 Libraries Installed
+    
+    The following libraries are required to build HDF4:
+    
+        libjpeg-devel   : JPEG library
+        tirpc           : RPC library
+        zlib            : Zlib compression library
+
+    Back in 2005, the SunRPC of the glibc has been replaced by a TI-RPC 
+    (Transport Independent RPC) library to support IPv6. Note that HDF4 configure 
+    expects to find the library with the name libtirpc.a, since Cygwin 1.7.7.
+
+    HDF4 also requires xdr support which is not provided by the Cygwin
+    version of tirpc.  HDF4 provides a library for xdr support when the 
+    configure flag --enable-hdf4-xdr is specified (see note 3 in the section
+    "Build, Test and Install HDF4 on Cygwin").
+    
+    HDF4 may be configured to use the SZIP compression Library.
+    For more information about the SZIP library, see
+
+               http://hdfgroup.org/doc_resource/SZIP/ 
+
+    The SZIP compression library is free for non-commercial use; 
+    see http://hdfgroup.org/doc_resource/SZIP/Commercial_szip.html
+    for information regarding commercial use.   
+
+    The szip library is not distributed with the Cygwin packaging system.
+    However, a recent Cygwin binary can be found at:
+        ftp://ftp.hdfgroup.org/lib-external/szip/2.0/bin/cygwin/
+
+    
+    2.3 Additional Utilities
+    
+    The following standard utilities are also required to build and test HDF4:
+        
+        bison           : yacc implementation
+        diffutils       : diff command
+        flex            : flex utility
+        make            : make utility
+    
+    2.4 Alternate Build Process
+    
+    Download the CMake package and follow the notes in the "INSTALL_CMake.txt" 
+    file to build HDF4 with the CMake utilities.
+        
+        
+        
+Build, Test and Install HDF4 on Cygwin
+--------------------------------------
+
+Notes: Use the configure command in the top level HDF4 directory.
+
+1. HDF4 Source code and precompiled binaries
+     
+   HDF provides "tar source ball" and precompiled binaries from 
+   the HDF ftp server (ftp.hdfgroup.org) in the directories:
+
+         ftp://ftp.hdfgroup.org/HDF/HDF_Current/src
+         ftp://ftp.hdfgroup.org/HDF/HDF_Current/bin 
+  
+2. Unpacking the distribution
+
+   gzip -cd <HDF-X.Y.Z.tar.gz>| tar xvf -
+
+3. To configure 
+     
+       ./configure <--disable-fortran> 
+                   --enable-hdf4-xdr
+                   --with-zlib=/path_to_ZLIB_install_directory 
+                   --with-jpeg=/path_to_JPEG_install_directory 
+                   <--with-szlib=/path_to_SZIP_install_directory>
+                   --prefix=/path_to_HDF4_install_directory
+
+       * Please note that when szlib option is not used, SZIP Library will not
+         be configured in and SZIP compression will not be enabled.
+       * If your system has ZLIB and/or JPEG libraries installed under a
+         system library directory (such as /usr/lib), configure will
+         automatically find the library. In this case, the corresponding
+         configure flag may be omitted.
+       * Note that --prefix defines where the installation path is.
+         The default is set as <hdf4_build_directory>/NewHDF 
+
+4. To Build and Test:
+
+  4.1 To build the library
+
+        make >& make.out
+
+  4.2 To build and run the tests
+
+        make check >& check.out
+
+5. To Install:
+
+         make install
+
+
+Acknowledgements:
+-----------------
+HDF group would like to thank Xinmin Hua(NASA/GSFC) for his help to 
+make HDF4 work on Cygwin.  
+
+-----------------------------------------------------------------------
+
+Need Further assistance, email help at hdfgroup.org
+
diff --git a/release_notes/INSTALL_WINDOWS.txt b/release_notes/INSTALL_WINDOWS.txt
new file mode 100644
index 0000000..cee0284
--- /dev/null
+++ b/release_notes/INSTALL_WINDOWS.txt
@@ -0,0 +1,16 @@
+
+***********************************************************************
+*            HDF4 Build and Install Instructions for Windows          *
+*                         (Full Version)                              *
+***********************************************************************
+
+We now recommend that users build, test, and install HDF4 using CMake.
+
+Instructions for building and testing HDF4 using CMake can be found in the
+INSTALL_CMake.txt file found in this folder.
+
+For instructions on building and testing an application with HDF4, see the 
+USING_HDF4_CMake.txt file found in this folder.
+
+Users who want to build and run an application with HDF4 in Visual Studio
+without using CMake should consult the USING_HDF4_VS.txt file.
diff --git a/release_notes/RELEASE.txt b/release_notes/RELEASE.txt
new file mode 100644
index 0000000..859cc5a
--- /dev/null
+++ b/release_notes/RELEASE.txt
@@ -0,0 +1,298 @@
+HDF version 4.2.10 released on 2014-02-09
+==============================================
+
+INTRODUCTION
+
+This document describes the differences between HDF 4.2.9 and HDF 4.2.10.
+It is written for people who are familiar with previous releases of HDF 
+and wish to migrate to HDF 4.2.10.
+
+The HDF 4.2.10 documentation can be found on the The HDF Group's website
+at:
+    http://www.hdfgroup.org/doc.html
+
+Previous versions of the documentation are available from the FTP server:
+
+    ftp://ftp.hdfgroup.org/HDF/Documentation/
+
+First-time HDF users are encouraged to read the HDF FAQ, which can be
+reached from the HDF product home page:
+  
+    http://hdfgroup.org/products/hdf4/
+
+If you have any questions or comments, please see the HDF Support page:
+
+    http://hdfgroup.org/services/support.html
+
+CONTENTS
+
+- New features and changes
+  -- Configuration
+- Support for new platforms and compilers
+- Bugs fixed since HDF 4.2.9
+  -- Configuration
+  -- Library
+  -- Utilities
+- Documentation
+- Platforms tested
+- Known problems
+
+
+New features and changes
+========================
+   Configuration
+   ============= 
+   CMake - Added support to create dmg bundles on Mac.
+     (ADB 2013/9/12)
+   CMake - Added support to use Windows /MT option.
+     (ADB 2013/6/10)
+     
+
+Support for new platforms and compilers
+=======================================
+    - Visual Studio 2012 w/ Intel Fortran 13 on Windows 7 and Windows 8
+    - Mac OS X Mavericks with clang and gfortran
+
+
+Bugs fixed since HDF 4.2.9
+=========================
+   Configuration
+   =============
+   - Removed the requirement of yacc/lex like tools. The ncgenXXX.* files
+     generated files from yacc and lex input files are pre-created in the
+     source code to build the ncgen tool. The msoft*.[ch] files were for
+     Windows build but was out of dated. Cmake uses the pre-created files
+     instead. See known problem below. (AKC 2014/02/02 HDFFR-1419)
+
+   - Removed old Macintosh platform codes that are not used any more.
+     (AKC 2014/01/21 HDFFR-1340)
+
+   - Changed Mac platforms to use the Apple supported clang compiler as the
+     default C compiler. (AKC 2014/01/15 HDFFR-1318)
+
+   - Removed the following individual platform specific files and have them to
+     be produced by configure using corresponding *.in files.
+     mfhdf/libsrc/config/netcdf-XXX.h    by mfhdf/libsrc/netcdf.h.in
+     mfhdf/fortran/config/ftest-XXX.f    by mfhdf/fortran/ftest.f.in
+     mfhdf/fortran/config/jackets-XXX.c  by mfhdf/fortran/jackets.c.in
+     mfhdf/fortran/config/netcdf-XXX.inc by mfhdf/fortran/netcdf.inc.in
+     (AKC 2013/12/31 HDFFR-1320/476)
+
+   - The following platforms are old and no longer available. Removed their
+     support code from the configure files:
+     alpha, convex, dec, fujivp, hpux, ia64, irix32, irix4, irix5, irix6, mac,
+     solarisx86, sun, t3e, unicos. (AKC 2013/12/26 HDFFR-1320)
+
+   - Removed -Xc (strict ansi standard) from the default CFLAGS of Solaris
+     since the latest Sun Compiler version 5.11 and 5.12 have a conflict with
+     the system header file. Since the current versions of C compiler should be
+     at least ANSI (aka C89) compliant, the removal of -Xc should be safe. This
+     also fixes a previous known problem of needing to use -xc99 to build HDF4.
+     (AKC 2013/12/20 HDFFR-1361)
+
+   - CMake - Changed name of TGZ_PATH to TGZPATH.
+           (ADB 2013/9/12)
+   - CMake - Removed extra flag POSIX_SOURCE as it caused failures on Apple Mac
+     builds. (ADB 2013/8/7)
+
+   Library
+   ========= 
+   - SDsetblocksize and VSsetblocksize would not change the block size if
+     the sds/vdata did not use linked-block before it was closed.  The
+     problem is now fixed.  (BMR 2013/1/15 - HDFFR-1357)
+
+   - Patches from user are applied to the C test to correct an overflow variable
+     and to the Fortran source for some missing declarations.
+     (BMR/EP 2014/1/15 - HDFFR-1367)
+
+   - Examples GR_write_chunks.c and GR_read_chunks.c were added. 
+     (BMR 2014/12/30 - HDFFR-1402)
+
+
+   Utilities
+   ========= 
+   - ncdump displayed garbage in place of fill-values when a variable had
+     unlimited dimension and had been written with less number of records
+     than the largest number of records in the file.  This is now fixed.
+     (BMR 2014/12/16 - HDFFR-1390)
+
+
+Documentation
+=============
+   - None
+
+
+Platforms tested
+================
+
+This version has been tested in the following platforms:
+
+   Linux 2.6.32-358.18.1         gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
+   .el6.ppc64 #1                 GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
+   SMP ppc64 GNU/Linux           IBM XL Fortran for Linux, V13.1 (64-bit mode)
+   (ostrich)
+
+   Linux 2.6.18-308.13.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52)
+      SMP i686 i386              GNU Fortran (GCC) 4.1.2 20080704
+   (jam)                             (Red Hat 4.1.2-52)
+                                 pgcc and pgf90 13.7-0 32-bit target 
+                                 on x86 Linux -tp penryn
+                                 Intel(R) C Compiler, Version 13.1.3 20130607
+                                 Intel(R) Fortran Compiler, Version 13.1.3
+
+   Linux 2.6.18-308.24.1.el5 #1  gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
+      SMP x86_64 GNU/Linux       GNU Fortran (GCC) 4.1.2 20080704 
+   (koala)                           (Red Hat 4.1.2-54)
+                                 icc (ICC) 13.1.3 20130607
+                                 ifort (IFORT) 13.1.3 20130607
+                                 pgcc and pgf90 13.7-0 64-bit target 
+                                 on x86-64 Linux -tp nehalem
+
+   Linux 2.6.32-431.el6.x86_64   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
+      #1 SMP x86_64 GNU/Linux    GNU Fortran (GCC) 4.4.7 20120313 
+   (platypus)                        (Red Hat 4.4.7-4)
+                                 icc (ICC) 13.1.3 20130607
+                                 ifort (IFORT) 13.1.3 20130607
+   
+   SunOS 5.11 32- and 64-bit     Sun C 5.12 SunOS_sparc 2011/11/16 
+   (emu)                              (see "Known problem" section)
+                                 Sun Fortran 95 8.6 SunOS_sparc 2011/11/16
+
+   Windows 7                     Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Visual Studio 2012 w/ Intel Fortran 13 (cmake)
+                                 Cygwin(CYGWIN_NT-6.1 1.7.25(0.270/5/3) gcc(4.7.3) compiler and gfortran)
+                                 (cmake and autotools)
+
+   Windows 7 x64                 Visual Studio 2008 w/ Intel Fortran 11.1 (cmake)
+                                 Visual Studio 2010 w/ Intel Fortran 12 (cmake)
+                                 Visual Studio 2012 w/ Intel Fortran 13 (cmake)
+
+   Windows 8                     Visual Studio 2012 w/ Intel Fortran 13 (cmake)
+
+   Windows 8 x64                 Visual Studio 2012 w/ Intel Fortran 13 (cmake)
+
+   Mac OS X Intel 10.6.8         Apple clang version 1.7 from Xcode 3.2.6
+   Darwin 10.8.0                 gfortran GNU Fortran (GCC) 4.6.2
+   (fred)                        icc and ifort Version 12.1.6 20120928
+                             
+   Mac OS X 10.7.5		 Apple clang version 3.0 from Xcode 4.6.1
+   Darwin 11.4.2                 gfortran GNU Fortran (GCC) 4.6.2
+   (duck)                        icc and ifort Version 13.0.3 20130606
+
+   Mac OS X 10.8.5               Apple clang version 4.2 from Xcode 4.6.1
+   Darwin 12.2.0                 gfortran GNU Fortran (GCC) 4.6.2
+   (wren)                        icc and ifort Version 13.0.3 20130606
+
+   Mac OS X 10.8.5               Apple clang version 5.0 from Xcode 5.0.2
+   Darwin 12.2.0                 gfortran GNU Fortran (GCC) 4.6.2
+   (swallow,kite)                icc and ifort Version 14.0.1 20131010
+
+   Mac OS X 10.9.1               Apple LLVM version 5.0 (clang-500.2.79)
+   Darwin 13.0.0                 (based on LLVM 3.3svn)
+                                 gfortran GNU Fortran (GCC) 4.6.2 
+         
+
+   Debian7.2.0 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
+                                 gcc (Debian 4.7.2-5) 4.7.2
+                                 GNU Fortran (Debian 4.7.2-5) 4.7.2
+                                 (cmake and autotools)
+
+   Fedora20 3.11.10-301.fc20.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
+                                 gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
+                                 GNU Fortran (GCC) 4.8.2 20130603 (Red Hat 4.8.2-7)
+                                 (cmake and autotools)
+
+   SUSE 13.1 3.11.6-4-desktop #1 SMP PREEMPT x86_64 x86_64 x86_64 GNU/Linux
+                                 gcc (SUSE Linux) 4.8.1
+                                 GNU Fortran (SUSE Linux) 4.8.1
+                                 (cmake and autotools)
+
+   Ubuntu 13.10 3.11.0-13-generic #20-Ubuntu SMP x86_64 GNU/Linux
+                                 gcc (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1
+                                 GNU Fortran (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1
+                                 (cmake and autotools)
+
+
+Known problems
+==============
+o  CMake builds in Windows uses the same pre-generated ncgen*.[ch] files from
+   the yacc/lex input files. The generated file, ncgenyy.c, uses the <unistd.h>
+   header file that Windows does not support.  This must be blocked out in
+   order for Windows to use it. (AKC 2014-02-03 HDFFR-1424).
+
+o  CMake "make install" fails installing the tools:
+    Use CPack to create an install package.
+   ADB - 2014/02/03
+
+o  CMake does not install these man pages:
+	hdf.1, ncdump.1, ncgen.1
+   AKC/BMR - 2014/02/02
+
+o  For Mac OS X 10.7 Lion and on 10.8 Mountain Lion, several tests fail with
+   GCC, Intel and Clang compilers.  Currently, this situation is detected and
+   -O0 level optimization is used.  We will work on the issue for the next
+   release. (HDFFR-1318,1358) EIP - 2013/02/05
+
+o  On IBM PowerPC 64, hdftest fails when gcc 4.4.6 is used with -O3 optimization 
+   level. 
+
+o  When building in AIX systems, if CC is xlc with -qlanglvl=ansi, configure
+   will fail when checking for the jpeglib.h header due to the duplicated
+   macro definition of HAVE_STDLIB_H.  This is because some newer builds
+   of the jpeg library have HAVE_STDLIB_H defined in the jconfig.h header file.
+   Without the -qlanglvl=ansi, some older xlc versions (e.g., V7.0) still 
+   fail, but newer xlc versions (e.g., V9.0) pass.  AKC - 2010/02/17
+
+o  When building on Linux/UNIX platforms, the szip shared library files must
+   be in the system library path.  This can be done by adding a link to
+   the libsz.* files in the /usr/lib folder or by adding the library
+   location to the LD_LIBRARY_PATH environment variable.
+      Ex. export LD_LIBRARY_PATH=path_to_szip_lib:$LD_LIBRARY_PATH
+   Optionally, one can use the static szip library files by adding '-static'
+   to the CFLAGS environment variable.
+   
+o  Existing data written by an HDF4 Library prior to HDF 4.2r2:
+   When a one-dimensional SDS and a dimension scale have
+   the same name, subsequent accesses to the dimension scale or to the
+   SDS might produce undesired results because the libraries could not
+   distinguish between the two objects.  In the case of writing, data
+   might even be corrupted.  For example, SDS data might be written to a
+   dimension variable or vice versa. (bugzilla #624)
+
+   HDF4 Library Releases 4.2r2 and later make a distinction between an SDS
+   and a dimension variable.  However, as with older versions, these recent
+   versions are unable to detect such conflicts in files created by earlier 
+   releases.  It is therefore STRONGLY recommended to check for such name 
+   duplication before working with data created with a pre-4.2r2 library.
+
+   The functions SDgetnumvars_byname and SDnametoindices are provided
+   to help detect such name conflicts and select the correct object to
+   access, respectively; see the HDF Reference Manual entries for
+   further details.
+   FB - 2009/01/26
+   BMR - revised 2011/06/24
+
+o  N-bit compression is not supported with Fortran APIs.
+
+o  Using both fill-value and compression on SD datasets does not work.
+
+o  When using PGI compilers, make sure that the JPEG library is also compiled 
+   with a PGI C compiler; linking with a JPEG library built with gcc causes 
+   JPEG library tests to fail.  To bypass the problem:
+
+       x Set LIBS flag to $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+         where $PGI_JPEG_INSTALL_DIR points to the installation directory
+         for the PGI-compiled JPEG library:
+
+         setenv LIBS $PGI_JPEG_INSTALL_DIR/lib/libjpeg.a
+
+       x Use the --with-jpeg=$PGI_JPEG_INSTALL_DIR configure flag to 
+         configure with the PGI-compiled JPEG library:
+
+         ./configure --with-jpeg=$PGI_JPEG_INSTALL_DIR --with-zlib....
+
+o  In order for the API SDgetdatasize to get the correct compressed size
+   of the data, the dataset needs to be closed (SDendaccess) or read
+   (SDreaddata) after being written and before SDgetdatasize is called.
+   BMR - 2008/11/22
diff --git a/release_notes/USING_CMake_Examples.txt b/release_notes/USING_CMake_Examples.txt
new file mode 100644
index 0000000..1d9afc8
--- /dev/null
+++ b/release_notes/USING_CMake_Examples.txt
@@ -0,0 +1,96 @@
+************************************************************************
+* Build and Test HDF4 Examples with CMake                              *
+************************************************************************
+
+This short set of instructions is for users who want to quickly 
+test the installation of HDF4 by using the CMake tools to build
+and test the HDF4 examples. These instructions will show
+the default usage and then present common changes for non-default
+installations.
+
+For more information, see the USING_HDF4_CMake.txt file.
+
+More information about using CMake can be found at the KitWare 
+site at www.cmake.org.
+
+CMake uses the command line, and these instructions use the script
+method of the ctest command.
+
+
+
+========================================================================
+I. Preconditions                                                           
+========================================================================
+
+   1. We suggest you obtain the latest CMake for Windows from the Kitware
+      web site. The HDF 4.2.x product requires a minimum CMake version 
+      of 2.8.10.
+                                                                         
+   2. You have installed the HDF4 Library built with CMake by executing 
+      the HDF Install Utility (the *.exe file in the binary package for 
+      Windows or the *.sh file on Linux). If you are using a Windows platform, 
+      you can obtain a pre-built Windows binary from The HDF Group's website 
+      at www.hdfgroup.org. See the "Common Changes to the 
+      HDF4_Examples.cmake File" section below for the line to change the 
+      location.
+                                                                         
+   3. On Windows, you have installed the 7Zip package. See the "Common 
+      Changes to the HDF4_Examples.cmake File" section below for the line 
+      to change the command.
+
+
+
+========================================================================
+II. Building HDF4 Examples with CMake
+========================================================================
+
+Confirm that these files are in the HDF4 install directory:
+
+       HDF4Examples-0.1.1-Source.zip (or HDF4Examples-0.1.1-Source.tar.gz)
+       HDF4_Examples.cmake
+       
+Run the default installation process:
+
+       Create a directory to run the examples, i.e. \test_hdf4.
+       
+       Copy HDF4Examples-0.1.1-Source.zip(.tar.gz) to this directory, do NOT 
+       unzip.
+       
+       Copy HDF4_Examples.cmake to this directory.
+       
+       Edit line 8 of the HDF4_Examples.cmake file, and change the INSTALLDIR 
+       to the HDF4 install location.
+       
+       Execute from this directory:
+       
+          ctest -S HDF4_Examples.cmake,HDF4Examples-0.1.1-Source -C Release -O test.log
+
+       The script will uncompress the examples file 
+       HDF4Examples-0.1.1-Source.zip (.tar.gz), and create a build directory 
+       inside the HDF4Examples-0.1.1-Source directory. It will then configure, 
+       build, and execute the examples. All of the log files will be found 
+       under the build\Testing\Temporary directory; check these for errors.
+       
+       The amount of script information can be increased by adding -V to the 
+       ctest command. Even more information can be shown by adding -VV instead 
+       of -V.
+
+
+
+========================================================================
+III. Common Changes to the HDF4_Examples.cmake File
+========================================================================
+
+Line 8: change the INSTALLDIR to a different HDF4 install location.
+
+Line 14: uncomment to allow Mac machines to build shared examples.
+
+Line 15: comment to build and test Fortran examples.
+
+Line 16: uncomment to build and test Fortran examples with the F2003 
+option.
+
+Line 68: change the CTEST_7Z_COMMAND to a different unzip program.
+
+
+
diff --git a/release_notes/USING_HDF4_CMake.txt b/release_notes/USING_HDF4_CMake.txt
new file mode 100644
index 0000000..dfa200a
--- /dev/null
+++ b/release_notes/USING_HDF4_CMake.txt
@@ -0,0 +1,285 @@
+************************************************************************
+* Build and Install HDF4 Applications with CMake                       *
+************************************************************************
+
+This short set of instructions is for users who want to quickly build HDF4 
+applications using the CMake tools. Users can adapt these instructions for 
+their own applications. For more information, see the "Minimum C Project 
+Files for CMake" section.
+       
+More information about using CMake can be found at the KitWare site at 
+www.cmake.org.
+         
+CMake uses the command line; however, the visual CMake tool is available 
+for the configuration step. The steps are similar for all of the operating 
+systems supported by CMake.
+       
+Notes:
+
+1. Using CMake for building and using HDF4 is under active development. 
+   While we have attempted to provide error-free files, please understand 
+   that development with CMake has not been extensively tested outside 
+   of HDF. The CMake specific files may change before the next release.
+            
+2. CMake for HDF4 development should be usable on any system where CMake 
+   is supported. Please send us any comments on how CMake support can be 
+   improved on any system. 
+            
+3. See the appendix at the bottom of this file for an example of using a 
+   ctest script for building and testing. See CMake.txt for more information.
+
+
+
+========================================================================
+I. Preconditions                                                           
+========================================================================
+
+   1. We suggest you obtain the latest CMake for Windows from the Kitware
+      web site. The HDF 4.2.x product requires a minimum CMake version 
+      of 2.8.10.
+                                                                         
+   2. You have installed the HDF4 Library built with CMake by executing 
+      the HDF Install Utility (the *.exe file in the binary package for 
+      Windows). If you are using a Windows platform, you can obtain a 
+      pre-built Windows binary from The HDF Group's website at 
+      www.hdfgroup.org.
+
+   3. Set the environment variable HDF4_DIR to the installed location of 
+      the config files for HDF4. On Windows: 
+      
+            HDF4_DIR=C:/Program Files/HDF_Group/HDF/4.2.x/cmake/hdf4
+      
+      (Note there are no quote characters used on Windows and all platforms
+      use forward slashes)
+
+   4. Created separate source and build directories (CMake commands are 
+      executed in the build directory).
+
+   5. Created a CMakeLists.txt file(s) for your source. See Section III 
+      below.
+
+
+
+========================================================================
+II. Building HDF4 Applications with CMake
+========================================================================
+
+Go through these steps to build HDF4 applications with CMake.
+
+   1. Run CMake
+   2. Configure the cache settings
+   3. Build HDF4 applications
+   4. Test HDF4 applications
+
+These steps are described in more detail below.
+
+The files that support building with CMake are all of the files in the 
+config/cmake folder, the CMakeLists.txt files in each source folder, and 
+CTestConfig.cmake. CTestConfig.cmake is specific to the internal testing 
+performed by The HDF Group. It should be altered for the user's 
+installation and needs. The cacheinit.cmake file settings are used by
+The HDF Group for daily testing. It should be altered/ignored for the user's 
+installation and needs. 
+
+
+
+
+   1. Run CMake
+
+      The visual CMake executable is named "cmake-gui.exe" on Windows and 
+      should be available in your Start menu. For Linux, Unix, and Mac 
+      users the executable is named "cmake-gui" and can be found where 
+      CMake was installed. 
+      
+      Specify the source and build directories. Make the build and source 
+      directories different. For example on Windows, if the source is at 
+      c:\MyHDFstuff\hdf4, then use c:\MyHDFstuff\hdf4\build or 
+      c:\MyHDFstuff\build\hdf4 for the build directory. 
+      
+      PREFERRED:
+        Users can perform the configuration step without using the visual 
+        cmake-gui program. The following is an example command line 
+        configuration step executed within the build directory:
+        
+        cmake -G "<generator>"  [-D<options>]  <sourcepath>
+        
+        Where <generator> is    
+            * Borland Makefiles
+            * MSYS Makefiles
+            * MinGW Makefiles
+            * NMake Makefiles
+            * Unix Makefiles
+            * Visual Studio 11
+            * Visual Studio 11 Win64
+            * Visual Studio 10
+            * Visual Studio 10 Win64
+            * Visual Studio 6
+            * Visual Studio 7
+            * Visual Studio 7 .NET 2003
+            * Visual Studio 8 2005
+            * Visual Studio 8 2005 Win64
+            * Visual Studio 9 2008
+            * Visual Studio 9 2008 Win64
+
+        <options> is:
+            * BUILD_TESTING:BOOL=ON
+            * USE_SHARED_LIBS:BOOL=[ON | OFF]
+
+   2. Configure the cache settings
+
+      2.1  Visual CMake users should click the Configure button. If this is 
+           the first time you are running cmake-gui in this directory, you 
+           will be prompted for the generator you wish to use (for example 
+           on Windows, Visual Studio 10). CMake will read in the CMakeLists.txt 
+           files from the source directory and display options for the HDF4 
+           project. After the first configure, you can adjust the cache 
+           settings and/or specify locations of other programs.
+      
+           Any conflicts or new values will be highlighted by the configure
+           process in red. Once you are happy with all the settings and there 
+           are no more values in red, click the Generate button to produce 
+           the appropriate build files. 
+      
+           On Windows, if you are using a Visual Studio generator, the 
+           solution and project files will be created in the build folder.
+      
+           On Linux, if you are using the Unix Makefiles generator, the 
+           Makefiles will be created in the build folder.
+
+      2.2  A command-line example on Windows can be run from the 
+           c:\MyHDFstuff\hdf4\build directory:
+      
+           cmake -G "Visual Studio 10" -DBUILD_TESTING:BOOL=ON -DUSE_SHARED_LIBS:BOOL=ON ..
+
+   3. Build HDF4 applications
+   
+      On Windows, you can build HDF4 applications using either the Visual 
+      Studio Environment or the command line. The command line is normally 
+      used on Linux, Unix, and Mac.
+
+      To build from the command line, navigate to your build directory and
+      execute the following:
+          
+              cmake --build . --config {Debug | Release}     
+              
+      NOTE: "--config {Debug | Release}" may be optional on your platform. We
+            recommend choosing either Debug or Release on Windows. If you are
+            using the pre-built binaries from HDF, use Release.                                                                                     
+             
+      3.1  If you wish to use the Visual Studio environment, open the solution 
+           file in your build directory. Be sure to select either Debug or 
+           Release and build the solution.
+             
+   4. Test HDF4 applications
+
+      To test the build, navigate to your build directory and execute:
+      
+              ctest . -C {Debug | Release}
+              
+      NOTE: "-C {Debug | Release}" may be optional on your platform. We
+            recommend choosing either Debug or Release to match the build
+            step on Windows.                                                                                      
+
+
+
+========================================================================
+III. Minimum C Project Files for CMake
+========================================================================
+
+Create a CMakeLists.txt file at the source root. Include the following 
+text in the file:
+
+##########################################################
+cmake_minimum_required (VERSION 2.8.10)
+PROJECT (HDF4MyApp C CXX)
+
+FIND_PACKAGE (HDF4 NAMES hdf4)
+# FIND_PACKAGE (HDF4) # Find non-cmake built HDF4
+INCLUDE_DIRECTORIES (${HDF4_INCLUDE_DIR})
+SET (LINK_LIBS ${LINK_LIBS} ${HDF4_LIBRARIES})
+
+SET (example hdf_example)
+
+ADD_EXECUTABLE (${example} ${PROJECT_SOURCE_DIR}/${example}.c)
+TARGET_C_PROPERTIES (${example} " " " ")
+TARGET_LINK_LIBRARIES (${example} ${LINK_LIBS})
+
+ENABLE_TESTING ()
+INCLUDE (CTest)
+
+ADD_TEST (NAME test_example COMMAND ${example})
+##########################################################
+
+
+
+========================================================================
+IV. APPENDIX
+========================================================================
+
+Below is an example of the ctest script used by The HDF Group. See the
+Appendix in the INSTALL_CMake.txt file for the CTestScript.cmake file used
+by this script. Adjust the values as necessary. Note that the source folder
+is entered on the command line and the build folder is created as a sub-folder.
+Windows should adjust the forward slash to double backslashes, except for
+the HDF_DIR environment variable.
+
+Note: these files are available at the HDF web site:
+
+    http://www.hdfgroup.org/HDF4/release/cmakebuild.html
+    CTestScript.cmake
+    HDF4ExamplesWindowsbinaryCMake.cmake
+
+
+
+========================================================================
+ctest
+========================================================================
+
+############################################################################
+# Product specific script, HDF4Example.cmake, that uses the 
+# CTestScript.cmake file (see Appendix in the CMake.txt). Usage:
+# "ctest -S HDF4Example.cmake,hdf4Examples -C Release -O hdf4EX.log"
+# where hdf4Examples is the source folder relative to the location of these scripts
+############################################################################
+
+cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+
+set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
+set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG})
+set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build)
+set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
+set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
+set(CTEST_BUILD_CONFIGURATION "Release")
+set(MODEL "Experimental")
+
+# build generator name, see cmake generator list
+set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
+
+# machine description, can be removed on Linux
+set(CTEST_SITE "machine.domain")
+set(SITE_OS_NAME "os name")
+set(SITE_OS_VERSION "os version")
+set(SITE_OS_BITS "os size")
+set(SITE_COMPILER_NAME "compiler name")
+set(SITE_COMPILER_VERSION "compiler version")
+
+# needed for source updates, change as required
+set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf4-examples/trunk")
+
+set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/hdfExamples-4.2.x")
+
+# location of the installed hdf4 (cmake configuration folder)
+set(ENV{HDF4_DIR} "/usr/share/cmake/hdf4")
+
+include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
+
+message("DONE")
+#################################################################################
+
+
+
+========================================================================
+For further assistance, send email to help at hdfgroup.org
+========================================================================
+
+
diff --git a/release_notes/USING_HDF4_VS.txt b/release_notes/USING_HDF4_VS.txt
new file mode 100644
index 0000000..0628a84
--- /dev/null
+++ b/release_notes/USING_HDF4_VS.txt
@@ -0,0 +1,86 @@
+
+***********************************************************************
+*  HDF4 Build and Install Suggestions for Windows and Visual Studio   *
+*                         (Full Version)                              *
+***********************************************************************
+
+These suggestions are for Visual Studio users.
+
+Instructions for building and testing HDF4 applications using CMake can 
+be found in the USING_HDF4_CMake.txt file found in this folder.
+
+The following two sections are helpful if you do not use CMake to build 
+your applications.
+                                                                        
+==========================================================================
+Using Visual Studio 2010 with HDF4 Libraries Built with Visual Studio 2010
+==========================================================================
+
+   1. Set up the path to the external libraries and headers.
+
+      The path settings will need to be in the project property sheets per 
+      project. Go to "Project" and select "Properties", find "Configuration 
+      Properties", and then "VC++ Directories".
+          
+      1.1 If you are building on 64-bit Windows, find the "Platform" dropdown
+          and select "x64".
+              
+      1.2 Add the header path to the "Include Directories" setting.
+          
+      1.3 Add the library path to the "Library Directories" setting.
+          
+      1.4 Select Linker->Input and beginning with the
+          "Additional Dependencies" line, enter the library names. The
+          external libraries should be listed first followed by the HDF4
+          libraries. For example, enter:
+
+          jpeg.lib szip.lib zlib.lib hdfdll.lib mfhdfdll.lib
+
+                                                                         
+==========================================================================
+Using Visual Studio 2008 with HDF4 Libraries Built with Visual Studio 2008
+==========================================================================
+
+   2. Set up the path to the external libraries and headers
+
+      Invoke Microsoft Visual Studio and go to "Tools" and select "Options", 
+      find "Projects", and then "VC++ Directories".
+      
+      2.1 If you are building on 64-bit Windows, find the "Platform" dropdown
+          and select "x64".
+
+      2.2 Find the box "Show directories for", choose "Include files", add the 
+          header path (i.e., c:\Program Files\HDF_Group\HDF4\1.8.x\include)
+          to the included directories.
+
+      2.3 Find the box "Show directories for", choose "Library files", add the
+          library path (i.e., c:\Program Files\HDF_Group\HDF4\1.8.x\lib)
+          to the library directories.
+          
+      2.4 For Fortran libraries, you will also need to setup the path for 
+          the Intel Fortran compiler.
+          
+      2.5 Select Project->Properties->Linker->Input and beginning with the
+          "Additional Dependencies" line, enter the library names. The
+          external libraries should be listed first followed by the HDF4
+          libraries. For example, enter:
+
+          jpeg.lib szip.lib zlib.lib hdfdll.lib mfhdfdll.lib
+
+========================================================================
+3. Helpful Pointers
+========================================================================
+
+    3.1 FAQ
+    
+    Many other common questions and hints are located online and being updated
+    in the HDF4 FAQ.  For Windows-specific questions, please see:
+    
+        http://www.hdfgroup.org/HDF4/windows/faq.html
+        
+    For all other general questions, you can look in the general FAQ:
+    
+        http://hdfgroup.org/HDF4-FAQ.html
+    
+************************************************************************
+ Please send email to help at hdfgroup.org for further assistance.
diff --git a/release_notes/bugs_fixed.txt b/release_notes/bugs_fixed.txt
new file mode 100644
index 0000000..1228f5e
--- /dev/null
+++ b/release_notes/bugs_fixed.txt
@@ -0,0 +1,345 @@
+This file contains some historical information; please do not edit.
+                                                        EIP 2007-09-23
+For bugs fixed in the current release see RELEASE.txt file
+For bugs fixed in all releases after HDF4.2r0-Beta see HISTORY.txt file.
+
+HDF4.2r0-Beta
+========
+1. "hdp dumpgr" and "hdp dumpsds" have two new options:
+        -g to suppress the data of global (or file) attributes
+        -l to suppress the data of local attributes
+
+2. The problem where hdp failed on very long file name has been
+   fixed. (bug #693)
+
+3. The problem where VSinquire failed when being called on a vdata
+   that has no fields defined, has been fixed. (bug #626)
+
+4. A user attempted to change the values of VGNAMELENMAX and VSNAMELENMAX
+   to 256 for her own use, but the hdp output showed that the change was
+   not in effect.  This problem is now fixed. (bug #606)
+
+5. hdp dumpvg failed sometimes when reading a file that has a vgroup 
+   being inserted into another.  This has been fixed. (bug #477)
+
+6. fp2hdf when used with -p option did the opposite of what it was supposed
+   to do with palette files. This problem is now fixed. (bug #800). However
+   the utility hdfimport should be used in the future instead of fp2hdf.
+
+7. hdf2gif failed when a user tried it on JPEG compressed images. (Bug #601).
+   The problem is now fixed. An error message is displayed if the image is not
+   8-bit. If the image is 24-bit, the message suggests using hdf2jpeg.
+
+8. ncdump failed to read NetCDF files 3.5 when there were more than one variable
+   with unlimited dimensions. Fixed.
+
+9. NetCDF part of the HDF4 Library was not ported to Compaq True64 system. Fixed.
+
+10. The hdp commands dumpsds, dumpgr, dumpvd, and dumpvg now display an 
+    informative message when a non-HDF file is given as input. (Bug #817)
+
+11. The compilation warnings and error on the macro HDFclose are fixed.
+    (Bug #818)
+
+HDF4.1r5
+========
+1. The following VS routines are added as requested (bug #267):
+     VSsetblocksize/vsfsetblsz -- sets the block size of the linked-block element.
+     VSsetnumblocks/vsfsetnmbl -- sets the number of blocks for 
+                                  a linked-block element.
+     VSgetblockinfo/vsfgetblinfo -- retrieves the block size and the 
+                                    number of blocks of a linked-block element.
+
+2. When using SDsetdimscale to set the data type for a dimension to 
+   an unsigned type, the type became signed inadvertently (bug #172).  
+   This problem is now fixed.
+
+3. The memory leak in the netCDF part of the HDF/mfhdf distribution
+   is fixed. (bug #418)
+
+4. When using "hdp dumpgr", data was being printed in the range of 0-250
+   when it should be 0-168 (bug #422).  This problem is now fixed.
+
+5. hdp dumpgr has a new option to print palette data only -pd.  Also,
+   whenever option -p or -pd is given, only palettes are printed, no 
+   images nor file attributes. (bug #439)
+
+6. The "#define NULL" was removed since ANSI C compilers are required to
+   define NULL. (bug #448)
+
+7. Giving NULL to the fieldname argument in VSsetfields now returns
+   FAIL instead of causing segmentation fault. (bug #554)
+
+8. Giving a NULL to the argument name in several name setting routines
+   now returns FAIL instead of causing segmentation fault. (bug #514)
+
+9. Two routines were added to get compression information for the SD and
+   GR interfaces, including chunked elements: SDgetcompress/sfgcompress 
+   and GRgetcompress/mggcompress. (bug #307)  
+   Note: 
+   - for a JPEG image, GRgetcompress only returns the compression type, not 
+     the compression information (i.e, quantity and force_baseline) because 
+     this information currently is not retrievable.
+   - getting compression type for JPEG chunked images is not working yet.
+
+10.  Added new fortran function heprntf (HEprint) that takes two
+     arguments: file name and level. If file name string has 0 length
+     error messages will be printed to the standard output. 
+
+11.  Fix the linking bug of unresolved symbol(error_top) DLL when HEclear 
+     was called by users. Users who want to use hdf DLL should define HDFAPDLL 
+     in their applications. Simply going to project setting and adding HDFAPDLL
+     as the predefined constant should work.
+
+HDF4.1r4
+========
+1. Fixed GR JPEG compression problem.
+2. Added -s, -c and -l options to hdp.
+
+HDF4.1r3
+=========
+1. HDF 4.1r2 was unable to properly read HDF SDSs created with HDF 3.3x.
+   It did not read the correct SDS names.  This problem has been fixed.
+2. Many problems with the GR interface were fixed:
+   - The GR interface can now read compressed files created with the
+     DFR8 and DF24 interfaces, except for those which were compressed
+     with IMCOMP compression.
+   - The GR interface can read and write images compressed with RLE,
+     GZIP and Skipping Huffman compression methods.
+   - Palettes can now be written and read properly with the GR interface.
+   - 24-bit raster images can now be read by the GR interface.
+3. You can now create an SDS with a name up to 256 characters in length.
+   The previous limit was 64.
+4. SDfileinfo no longer returns the wrong number of datasets for old
+   files created with the DFSD interface.
+5. The Vdata/Vgroup interfaces in HDF did not check return values, which
+   caused problems on the Macintosh, and could have potentially caused
+   problems on all platforms.  HDF now checks all return values properly.
+6. Several missing Fortran functions have been added to the
+  ./include/dffunc.inc file.
+7. Calling SDreaddata after setting the fill value and before doing
+   an SDendaccess and SDend caused a core dump on IRIX6.x with the
+   -64 bit option.  This problem has been fixed.
+8. Many hdp fixes were made:
+   - Options 'o' and 'b' or 'x': it used to be that you had to give -o
+     in order for -b or -x to be valid; now you can just give -b or -x
+     and the output will go to the screen.  Basically, you can have either
+     binary or ASCII text to the screen now where it used to be just ASCII.
+   - Options (-r,-i,-n,-c) can be given on the same command line; previously
+     the last option overrode all the previous ones.
+   - Added printing of GR file attributes (bug #192)
+   - Added printing of a palette to the dumpgr command (bug #252) with the new
+     option -p
+       -p : print palette info and data
+       -p -h : print palette info
+       -p -d : print palette data
+   - Added printing of SD file attributes to the dumpsds command
+   - The -c option for dumpvd used to only show the first vdata; now all vdatas
+     of the same class show for option -c.  Also, multiple class names listed
+     with this option are searched; they used to be ignored.
+   - Added printing file annotations to the dumpvd command.
+   - Improved output wording for the dumpvd command.  For example, <Undefine>
+     gets printed instead of nothing, or FULL_INTERLACE/NO_INTERLACE is printed
+     instead of "0/1".
+   - In one case the dumpvg command would get into an infinite loop.  This
+     problem has been fixed.
+   - With the dumpvg command, all vgroups of the same class show for option -c;
+     previously only the first one was shown.  Also, multiple class names listed
+     with this option are now searched; they used to be ignored.
+   - File annotations can now be printed with the dumpvg command.
+   - With the dumpvg command, occasionally a core dump occurred when printing
+     the Graphical Representation part if multiple hdf files were given.  This
+     has been fixed.
+
+HDF4.1r2
+========
+1. The hdp utility can now dump data properly to a binary file (using
+   the -b option).
+2. HDF no longer core dumps when reading a NetCDF file.
+3. HDF now supports little-endian conversion for VAX and Dec Alpha OpenVMS.
+4. The SD interface can now properly handle writing to a one-dimensional
+   array that is unlimited.
+5. The SD interface can now properly handle attributes with a data type
+   of Little Endian.
+6. HDF will no longer fail if you write data to a vdata that had no data 
+   written to it when it was first created.
+7. The problems that occurred on the Crays with HDF 4.1r1 have been
+   corrected.
+
+HDF4.1r1
+========
+1. A bug was fixed where you would receive an error if you changed the 
+   name of a Vdata to a name that was longer than the original name.
+2. The FORTRAN equivalents have been added for several ANxx utility routines 
+   (ANget_tagref, ANid2tagref ...).
+3. A bug was fixed where old data (DFSD) in native and little endian format 
+   could not be read by the SD interface correctly.
+4. The variable _HDF_ENTIRE_VDATA has been changed to _HDF_VDATA, to avoid 
+   confusion.  This variable had been added to HDF 4.1b1.  For those
+   users who are already using it, a macro called  _HDF_ENTIRE_VDATA has been
+   added, which is defined as _HDF_VDATA.
+5. SD_FILL and SD_NOFILL were added as file fillmodes.   
+6. In HDF 4.0r2, you could create an empty compressed SDS.  With 4.1b1 you
+   could not.  This was fixed in the 4.1 release. 
+7. There was a bug in hdp where 'hdp list -a' did not list the file attributes. 
+   This was fixed.
+8. In 4.1b1, the SD chunking routine names contained upper case characters
+   after the initial two "SD" characters (for eg. SDwriteChunk).  With 4.1r1
+   the SD chunking routine names were changed to lower case after the
+   initial "SD" characters, to be consistent with the SD interface 
+   naming scheme (for eg. SDwritechunk). 
+
+HDF4.1b1
+========
+1. If you opened a file in read only mode with the SD interface,
+   it would create the file if the file did not exist. This has been fixed.
+2. There was a problem with GRstart, which caused GRend to
+   trigger a segmentation fault when it was called twice.
+   This has been fixed.
+3. DFNT_UCHAR has been added to hdf_unmap_type.  
+4. A problem was fixed in HDc2fstr, which caused garbage to
+   be attached to a converted string.
+5. The multi-file annotation functions were added to dffunc.inc.
+6. A bug was fixed in the DFPnpals function, where it would return
+   the wrong number of palettes.
+7. A problem was fixed with the gzip compression, where an error
+   occurred if you attempted to write to an SDS that you have created, and 
+   then performed an SDendaccess, followed by a SDselect.
+8. HDF4.0r2 did not recognize JPEG images created by HDF 3.3r4.  This
+   has been fixed.
+9. The newest SGI cc compiler (7.0) has eliminated the compression code
+   errors when '-O' option is used.
+
+HDF4.0r2
+========
+1. SDstart (<non-existent file>, DFACC_RDWR) no longer fails.
+   It will create a file now.
+2. When appending compressed data onto the end of an unlimited
+   dimension SDS, the SD interface no longer writes the fill-
+   values in locations where they will immediately be over-
+   written by data.
+3. dfkcray.c, IEG2JPEG and JPEG2IEG do not work if the foreign
+   data does not start from the 64-bit boundary.
+4. On IRIX 6.1 with -n32,  hdf/test/comp.c gave error messages.
+   Fix: Not to use '-O' option (for now).
+5. Problem when running 'make test' on UNICOS has been fixed
+   (bug was in hdf/util/he_main.c).
+6. The RIG tag was not getting written out when creating a
+   GR object, so you couldn't view it with "hdp list". The hdp
+   command has been updated.
+
+HDF4.0r1p1
+==========
+1. Fixed a bug in SDS interface which caused a wrong
+   number of records for UNLIMITED dimensions when 
+   ncsync was called to write data to hdf files. 
+2. A bug has been fixed in the UNLIMITED dimension record 
+   to improve backward compatibility.
+3. Parameter 'class' in vffndcls() has been changed to 
+   'vgclass' to avoid conflicts with C++ reserved word 
+   'class'.
+
+HDF4.0r1
+========
+1. Fixed Fortran character string handling under UNICOS. 
+2. Added checks on the return values of HDmalloc calls. 
+3. The automatic test of hdf utilities (in hdf/util/) 
+   is added to the Makefile and will be executed by 
+   'make test' at the top level. 
+4. Thanks to Mark W. Dalton for his contribution to the fix
+   of the adaptive Huffman compression on the CRAY YMP. 
+   His fix is merged into 4.0r1.
+5. Added check in SDsetattr() to make sure that the argument 
+   'count' < MAX_ORDER.
+
+HDF4.0b2
+========
+1. To avoid conflicts with C++, field name 'new' in vgroup_desc 
+   of vg.h is changed to 'new_vg', and in accrec_t 'new' of 
+   hfile.h is changed to 'new_elem'.
+2. Fixed the max number of fields of vdata in vparse.c, vshow.c 
+   and show.c (in mfhdf/dumper/). Now vshow and hdp can dump
+   VSFIELDMAX number of fields. 
+3. Fixed platform number subclass problem when external data file was
+   written in Little_endian format (IBM-PC). 
+4. Fixed the core-dump on some machines when writing large number of 
+   big SDS by holding the buffer instead of freeing it every time.
+5. The max number of files which can be open at one time was defined
+   in hdf.h, hfile.h and netcdf.h. Now there is only one definition
+   by MAX_FILE in hdf/src/hlimits.h.
+6. A bug in SDsetnbitdataset is fixed. 
+7. Uninitialized memory reads in SDIputattr and hdf_create_dim_vdata
+    are fixed. 
+
+HDF4.0b1
+========
+1. Added support to unsigned integers for attributes.
+2. Bug fixed in SDsetdimscale if dim strings or other attributes already
+   assigned to that dimension and if the size of the number type
+   is not 4 bytes. 
+3. Bug fixed in SDgetdimscale.  For dimensions that have no dim scale 
+   SDgetdimscale now returns 0 for nt to indicate that  no-scale was assigned.
+4. Several buffers allocated by Hxxxx, SDxxxx, and VSxxxx functions were 
+   used through the entire excecution time of HDF application programs.
+   In previous releases those buffers were not freed by HDF. Some debugging 
+   tools list those buffers as memory leaks. In HDF4.0b1 those buffers are freed
+   by HDF when the programs exit. The fix doesn't work on SunOS.  
+5. Added Fortran version of VSQueryxxxx and VSfind:
+     vsqfnelt -- VSQuerycount
+     vsqfintr -- VSQueryinterlace
+     vsqfflds -- VSQueryfields
+     vsqfvsiz -- VSQuerysize
+     vsqfname -- VSQueryname
+     vsffnd   -- VSfind
+6.  SDsetdimscale () did not set scales for unlimited dimension. 
+    After appending records to the unlimited dimension, the number of 
+    records was not updated.  The bug is fixed. 
+7.  In previous releases, the Vdata interface couldn't define more than 36 
+    fields even though VSFIELDMAX was defined as 64 in hdf.h. 
+    The bug is fixed. Now the maximum number of fields is decided by
+    VSFIELDMAX. 
+8.  The Fortran function sfgdinfo now returns nattr correctly.
+9.  hdfrseq is moved out from the HDF release. It is now available on the NCSA
+    ftp server in directory: /HDF/contrib/NCSA/hdfrseq/.
+10. If the same file is accessed twice with DFSDputdata (i.e. the file 
+    is first destroyed), the first call to DFANputlabel after the second 
+    call to DFSDputdata fails. To fix this problem, a new function 
+    DFANclear has been added. 
+    -----------------------------------------------------------------
+    Name:    DFANclear
+    Purpose: Clear DFAN interface
+    Inputs:  void
+    Returns: SUCCEED if ok; FAIL otherwise.
+    Remarks: When a file is re-created in a single run, user should
+             call DFANclear() before the file is re-created to reset DFAN 
+             interface structures.
+    Example: 
+             main()
+             {
+                  int ret;
+                  dump(0);  /* DFSDputdata("myfile.hdf",...) is called  */
+                            /* in dump() to create myfile.hdf  */
+                  ret = DFANclear();
+                  dump(1);  /* DFSDputdata("myfile.hdf",...) is called  */
+                            /* again to re-create a file with the same  */
+                            /* name myfile.hdf  */
+             }
+
+11. A bug is fixed in SDgetcal, which failed in getting number_type from 
+    old hdf files, created by DFSDxxxx calls.  
+12. hdf.inc missing constants and commas
+13. HDgettagname() can't recognize DFTAG_FV and DFTAG_COMPRESSED
+    in hkit.c  
+14. fp2hdf is back in hdf/util/.
+
+--------------------------------------------------------------
+
+Known problems:
+1. Need Fortran version of VFfieldxxxx functions.
+2. Need an easy way to append to a vdata. One solution would be 
+   to make all FULL_INTERLACE vdatas appendable.
+3. Need a high level function to create external Vdata, similar to 
+   SDsetexternalfile(). 
+4. SDxxxx interface creates dummy values for dimension records. 
+   For multi-dimensional SDS this isn't too bad. However, for 
+   1-D SDS it doubles the size of the file. 
diff --git a/release_notes/misc_docs.txt b/release_notes/misc_docs.txt
new file mode 100644
index 0000000..9b25af2
--- /dev/null
+++ b/release_notes/misc_docs.txt
@@ -0,0 +1,3525 @@
+
+This file was created for the HDF4.2r0. release to store the documents
+that were in the release_notes directory of the main HDF4 source tree
+since the 4.0.alpha release. See also HISTORY.txt file for more information.
+
+File contains the following *.txt files:
+
+
+Fortran_APIs.txt
+JPEG.txt
+Pablo.txt
+comp_SDS.txt
+compile.txt
+compression.txt
+dimval.txt
+external_path.txt
+hdp.txt
+install_winNT.txt
+macintosh.txt
+mf_anno.txt
+mf_ris.txt
+new_functions.txt
+page_buf.txt
+sd_chunk_examples.txt
+vattr.txt
+windows.txt
+
+To search for a particular document use "filename.txt=" string, for example 
+to seach for the beginning of the new_functions.txt file,
+use "new_functions.txt=" string
+
+================================Fortran_APIs.txt============================
+
+Problem:
+========
+
+In HDF4.0r1 and previous versions of HDF several Fortran 
+routines declared a formal parameter as character*(*) or 
+integer while the actual parameter was a character or 
+a numeric type. This caused problems on some systems, 
+such as VMS and T3D. 
+
+With HDF 4.0r2 and later releases, these routines have either 
+been replaced by 2 routines, one for character type parameters 
+and another for numeric type parameters; or, a new routine has 
+been added for char type parameters and the old routine is used 
+for numeric type parameters only. Those routines that were replaced 
+by two routines should be phased out in the future. However, in 
+order to not break currently working applications they are 
+still supported. New applications should use the new routines. 
+
+Routines and parameters affected:
+================================
+1. Write vdata
+
+Old:
+    vsfwrit(vsid, databuf, n_rec, interlace)
+        character*(*) databuf
+
+HDF4.0r2:
+    
+    Write to a vdata from a character buffer:
+      vsfwrtc(vsid, cbuf, n_rec, interlace) 
+           character*(*) cbuf
+    Write to a vdata from an integer buffer (for numeric values):
+      vsfwrt(vsid, buf, n_rec, interlace)  
+           integer  buf
+
+2. Read vdata
+ 
+Old:
+    vsfread(vsid, buf, n_recs, interlace)
+         character*(*) buf
+HDF4.0r2:
+    Read records into a character buffer:
+      vsfrdc(vsid, cbuf, n_recs, interlace)
+          character*(*) cbuf
+    Read records into an integer buffer (for numeric values):
+      vsfrd(vsid, buf, n_recs, interlace)
+          integer buf
+
+3. High level function for creating a single field single
+   component vdata
+ 
+Old:
+    vhfsd(f, field, buf, n, dtype, vsname, vsclass)
+         integer buf
+HDF4.0r2:
+    Store a simple character dataset in a vdata:
+      vhfscd(f,field,cbuf,n,dtype,vsname,vsclass)
+         character*(*) cbuf
+    Store a simple numeric dataset in a vdata
+      vhfsd(f, field, buf, n, dtype, vsname, vsclass)
+         integer buf
+
+4. High level function for creating a single field multi-
+   component vdata
+Old:
+    vhfsdm (f,field,buf,n,dtype,vsname,vsclass,order)
+         integer buf
+HDF4.0r2:
+    Store an aggregate char dataset in a vadata:      
+      vhfscdm (f,field,cbuf,n,dtype,vsname,vsclass,order)
+         character*(*) cbuf
+    Store a simple numeric dataset in a vdata
+      vhfsdm(f,field,buf,n,dtype,vsname,vsclass,order)
+         integer buf
+
+5. Write GR image
+Old:
+    mgwrimg(riid, start,stride,count,data)
+      <valid numeric type> data
+HDF4.0r2:
+    Write character type image data
+     mgwcimg(riid, start, stride, count, cdata)
+         character*(*)  cdata
+    Write numeric type image data
+      mgwrimg(riid, start,stride,count,data)
+      <valid numeric type> data
+
+6. Read GR image
+Old:
+    mgrdimg(riid,start,stride,count,data)
+      integer data
+HDF4.0r2:
+    Read character type image data
+      mgrcimg(riid,start,stride,count,cdata)
+          character*(*) cdata
+    Read numeric type image data
+      mgrdimg(riid,start,stride,count,data)
+          <valid numeric type> data
+
+7. Write LUT
+Old:
+    mgwrlut(lutid,ncomp,data_type,interlace,nentries,data)
+      <valid numeric type> data
+HDF4.0r2:
+    Write character type palette:
+      mgwclut(lutid,ncomp,data_type,interlace,nentries,cdata)
+          character*(*) cdata
+    Write numeric type palette:
+      mgwrlut(lutid,ncomp,data_type,interlace,nentries,data)
+          <valid numeric type> data
+
+8. Read LUT
+Old:
+    mgrdlut(lutid, data)
+      <valid numeric type> data
+HDF4.0r2:
+    Read char type palette:
+      mgrclut(lutid,cdata)
+        character*(*) cdata
+    Read numeric type palette:
+      mgrdlut(lutid, data) 
+        <valid numeric type> data
+
+9. Set GR attribute
+Old:
+    mgsattr(riid, name, nt, count, data)
+      character*(*) data
+HDF4.0r2:
+    Add char type attribute to a raster image
+      mgscatt(riid, name, nt, count, cdata)
+        character*(*) cdata
+    Add a numeric attribute to a raster image
+      mgsnatt(riid, name, nt, count, data)
+        integer data
+
+10. Get GR attribute
+Old:
+    mggattr(riid, index, data)
+      <valid numeric type> data
+HDF4.0r2:
+    Get a char type attribute:
+      mggcatt(riid, index, cdata)
+        character*(*) cdata
+    Get a numeric type attribute:
+      mggnatt(riid, index, data)
+        integer data
+
+11. Write SDS data
+Old:
+    sfwdata(sdsid,start,stride,end,values)
+      <valid numeric type> values
+HDF4.0r2
+    Write char type SDS data
+      sfwcdata(sdsid,start,stride,end,cvalues)
+        character*(*) cvalues
+    Write numeric type SDS data
+      sfwdata(sdsid,start,stride,end,values)
+        <valid numeric type> values
+
+12. Read SDS data
+Old:
+    sfrdata(sdsid,start,stride,end,values)
+      <valid numeric type> values
+HDF4.0r2
+    Read char type SDS data
+      sfrcdata(sdsid,start,stride,end,cvalues)
+        character*(*) cvalues
+    Read numeric type SDS data
+      sfrdata(sdsid,start,stride,end,values)
+        <valid numeric type> values
+
+13. Add an attribute to an object in SD interface
+Old:
+    sfsattr(id, name, nt, count, data)
+      character*(*) data
+HDF4.0r2
+    Add a char type attribute to an object
+      sfscatt(id, name, nt, count, cdata)
+        character*(*) cdata
+    Add a numeric type attribute to an object
+      sfsnatt(id, name,nt, count,data)
+        integer data
+
+14. Get contents of an attribute
+Old:
+    sfrattr(id, index, buf)
+      <valid numeric type> buf
+HDF4.0r2:
+    Get a char type attribute
+      sfrcatt(id, index, cbuf)
+        character*(*) cbuf
+    Get a numeric type attribute
+      sfrnatt(id, index, buf)
+        <valid numeric type> buf   
+
+15. Set fill value
+Old:
+    sfsfill(id, val)
+      <valid numeric type> val
+HDF4.0r2
+    Set a char type fill value
+      sfscfill(id, cval)
+        character cval
+    Set a numeric type fill value
+      sfsfill(id, val)
+        <valid numeric type> val
+
+16. Get fill value
+Old:
+    sfgfill(id, val)
+      <valid numeric type> val
+HDF4.0r2
+    Get char type fill value
+      sfgcfill(id, cval)
+        character cval
+    Get numeric type fill value
+      sfgfill(id, val)
+        <valid numeric type> val
+
+
+============================================================================
+================================JPEG.txt====================================
+
+Independant JPEG Group library
+    Version 4.1b of the HDF-netCDF library uses v6a of the Independent
+JPEG Group (IJG) JPEG file access library.  For most users of the HDF library,
+this will be completely transparent.  For users who are integrating the HDF
+library into an existing application which uses the IJG's JPEG library, linking
+with the HDF library is now much simpler and should be completely painless.
+The JPEG library will need to be linked with user's applications when raster
+images are being used (whether they are compressed with JPEG or not).
+
+     cc -o <myprog> myprog.c -I<include path> <path for libmfhdf.a> \
+           <path for libdf.a> <path for libjpeg.a>
+
+     Note: order of the libraries is important, the mfhdf library must be first
+and be followed by the hdf library.
+============================================================================
+================================Pablo.txt===================================
+
+
+Pablo Instrumentation of HDF
+===========================
+    This version of the distribution has support to create an instrumented 
+    version of the HDF library(libdf-inst.a). This library along with
+    the Pablo performance data capture libraries can be used to gather data
+    about I/O behavior and procedure execution times.  
+
+    More detailed documentation on how to use the instrumented version of
+    the HDF library with Pablo can be found in the Pablo directory 
+    '$(toplevel)/hdf/pablo'. 
+     See the provided '$(toplevel)/hdf/pablo/README.Pablo'
+     and the Postscript file '$(toplevel)/hdf/pablo/Pablo.ps'.
+
+    At this time only an instrumented version of the core HDF library libdf.a 
+    can be created. Future versions will have support for the SDxx interface
+    found in libmfhdf.a. Current interfaces supported are ANxx, GRxx, DFSDxx,
+    DFANxx, DFPxx, DFR8xx, DF24xx, Hxx, Vxx, and VSxx.
+
+    To enable the creation of an instrumented library the following section
+    in the makefile fragment($(toplevel)/config/mh-<os>) must be uncommented 
+    and set.
+
+    # ------------ Macros for Pablo Instrumentation  --------------------
+    # Uncomment the following lines to create a Pablo Instrumentation
+    # version of the HDF core library called 'libdf-inst.a'
+    # See the documentation in the directory 'hdf/pablo' for further 
+    # information about Pablo and what platforms it is supported on
+    # before enabling. 
+    # You need to set 'PABLO_INCLUDE' to the Pablo distribution 
+    # include directory to get the files 'IOTrace.h' and 'IOTrace_SD.h'.
+    #PABLO_FLAGS  = -DHAVE_PABLO
+    #PABLO_INCLUDE = -I/hdf2/Pablo/Instrument.HP/include
+
+    After setting these values you must re-run the top-level 'configure' script.
+    Make sure that your start from a clean re-build(i.e. 'make clean') after
+    re-running the toplevel 'configure' script and then run 'make'.
+    Details on running configure can be found in the section
+    'General Configuration/Installation - Unix' found in the top-level 
+    installation file '$(toplevel)/INSTALL'.
+============================================================================
+================================comp_SDS.txt================================
+
+Limitations of compressed SDS datasets
+    Due to certain limitations in the way compressed datasets are stored, data
+which has been compressed is not completely writable in ways that uncompressed
+datasets are.  The "rules" for writing to a compressed dataset are as follows:
+
+    (1) Write an entire dataset that is to be compressed.  I.e. build the
+        dataset entirely in memory, then write it out with a single call.
+ 
+    (2) Append to a compressed dataset.  I.e. write to a compressed dataset
+        that has already been written out by adding to the unlimited
+        dimension for that dataset.
+ 
+    (3) For users of HDF 4.1, write to any subset of a compressed dataset
+        that is also chunked.
+
+    Generally speaking, these mean that it is impossible to overwrite existing
+compressed data which is not stored in "chunked" form.  This is due to 
+compression algorithms not being suitable for "local" modifications in a
+compressed datastream.  Please send questions about compression to the
+general HDF support e-mail address:  hdfhelp at ncsa.uiuc.edu
+
+Compression for HDF SDS
+The SDsetcompress and SDsetnbitdataset functions are used as
+higher-level routines to access the HCcreate function (HCcreate is described
+in the reference manual).  SDsetnbitdataset allows for the storage of 1-32 bit 
+integer values (instead of being restricted to 8, 16 or 32-bit sizes) in a
+scientific dataset. SDsetcompress can be used to compress a scientific dataset
+through the SD interface instead of dropping down to the lower-level H
+interface.
+
+N-bit SDS using SDsetnbitdataset:
+
+    The interface to SDsetnbitdataset is described below:
+
+    intn SDsetnbitdataset(sds_id,start_bit,bit_len,sign_ext,fill_one); 
+
+    int32 sds_id - The id of a scientific dataset returned from SDcreate or
+        SDselect.
+        
+    intn start_bit - This value determines the bit position of the highest end
+        of the n-bit data to write out. Bits in all number-types are counted
+        from the right starting with 0. For example, in the following bit data,
+        "01111011", bits 2 and 7 are set to 0 and all the other bits are set to
+        one. 
+
+    intn bit_len - The number of bits in the n-bit data to write, including the
+        starting bit, counting towards the right (i.e. lower bit numbers). For
+        example, starting at bit 5 and writing 4 bits from the following bit
+        data, "01111011", would write out the bit data, "1110", to the dataset
+        on disk. 
+
+    intn sign_ext - Whether to use the top bit of the n-bit data to sign-extend
+        to the highest bit in the memory representation of the data. For
+        example, if 9-bit signed integer data is being extracted from bits
+        17-25 (nt=DFNT_INT32, start_bit=25, bit_len=9, see below for full
+        information about start_bit & bit_len parameters) and the bit in
+        position 25 is a 1, then when the data is read back in from the disk,
+        bits 26-31 will be set to a 1, otherwise bit 25 will be a zero and bits
+        26-31 will be set to 0. This bit-filling takes higher precedence (i.e.
+        is performed after) the fill_one (see below) bit-filling. 
+
+    intn fill_one - Whether to fill the "background" bits with 1's or 0's.
+        The "background" bits of a n-bit dataset are those bits in the
+        in-memory representation which fall outside of the actual n-bit field
+        stored on disk. For example, if 5 bits of an unsigned 16-bit integer
+        (in-memory) dataset located in bits 5-9 are written to disk with the
+        fill_one parameter set to TRUE (or 1), then when the data is read back
+        into memory at a future time, bits 0-4 and 10-15 would be set to 1. If
+        the same 5-bit data was written with a fill_one value of FALSE (or 0),
+        then bits 0-4 and 10-15 would be set to 0.  This setting has a lower
+        precedence (i.e. is performed first) than the sign_ext setting. For
+        example, using the sign_ext example above, bits 0-16 and 26-31 will
+        first be set to either 1 or 0 based on the fill_one parameter, and then
+        bits 26-31 will be set to 1 or 0 based on bit-25's value. 
+    
+    RETURNS - SUCCEED (0) or FAIL (-1) for success/failure.
+
+    The corresponding FORTRAN function name is sfsnbit which takes the
+    same parameters in the same order.
+
+    For example, to store an unsigned 12-bit integer (which is represented
+    unpacked in memory as an unsigned 16-bit integer), with no sign extension
+    or bit filling and which starts at bit 14 (counting from the right with bit
+    zero being the lowest) the following setup & call would be appropriate: 
+
+    intn sign_ext = FALSE; 
+    intn fill_one = FALSE; 
+    intn start_bit= 14; 
+    intn bit_len = 12; 
+    SDsetnbitdataset(sds_id,start_bit,bit_len,sign_ext,fill_one); 
+
+    Further reads and writes to this dataset would transparently convert the
+    16-bit unsigned integers from memory into 12-bit unsigned integers stored
+    on disk.
+
+    More details about this function can be found in the HDF library reference
+    manual.
+
+Compressed SDS data using SDsetcompress:
+
+        The SDsetcompress function call contains a subset of the parameters to
+the HCcreate function call described in compression.txt and performs the same
+types of compression.
+
+    The interface to SDsetcompress is described below:
+
+    intn SDsetcompress(sds_id,comp_type,c_info);
+
+    int32 sds_id - The id of a scientific dataset returned from SDcreate or
+        SDselect.
+
+    int32 comp_type - The type of compression to encode the dataset with.
+        The values are the same as for HCcreate:
+            COMP_CODE_NONE - for no compression
+            COMP_CODE_RLE - for RLE encoding
+            COMP_CODE_SKPHUFF - for adaptive Huffman
+            COMP_CODE_DEFLATE - for gzip 'deflation'
+
+    comp_info *c_info - Information needed for the encoding type chosen.
+        For COMP_CODE_NONE and COMP_CODE_RLE, this is unused and can be set to
+        NULL.  For COMP_CODE_SKPHUFF, the structure skphuff in this union needs
+        information about the size of the data elements in bytes (see example
+        below).  For COMP_CODE_DEFLATE, the structure deflate in this union
+        need information about "effort" to try to compress with (see example
+        below).  For more information about the types of compression 
+        see the compression.txt document in this directory.
+
+    RETURNS - SUCCEED (0) or FAIL (-1) for success/failure.
+
+    Similarly to the HCcreate function, SDsetcompress can be used to create
+    compressed dataset or to compress existing ones.
+
+    For example, to compress unsigned 16-bit integer data using the adaptive
+    Huffman algorithm, the following setup and call would be used:
+
+    comp_info c_info;
+    c_info.skphuff.skp_size=sizeof(uint16);
+    SDsetcompress(sds_id,COMP_CODE_SKPHUFF,&c_info);
+
+    Further reads and writes to this dataset would transparently convert the
+    16-bit unsigned integers from memory into a compressed representation on
+    disk.
+
+    For example, to compress a dataset using the gzip deflation algorithm, with
+    the maximum effort to compress the data, the following setup and call would
+    be used:
+
+    comp_info c_info;
+    c_info.deflate.level=9;
+    SDsetcompress(sds_id,COMP_CODE_DEFLATE,&c_info);
+
+    Currently, SDsetcompress is limited to creating new datasets or appending
+    new slices/slabs onto existing datasets.  Overwriting existing data in a
+    dataset will be supported at some point in the future.
+
+    More details about this function can be found in the HDF library reference
+    manual.
+
+============================================================================
+================================compile.txt=================================
+
+ 
+COMPILING A PROGRAM
+                  
+Following are instructions for compiling an application program on the 
+platforms supported by HDF, using the binaries that we provide.  For
+Unix, the information on options to specify comes from the configuration 
+files (mh-*) in the HDF source code (under ../HDF4.1r5/config).   
+
+In general, you compile your program as shown below.  If your platform is 
+not specified in the section, "INSTRUCTIONS FOR SPECIFIC PLATFORMS", then 
+use these instructions.  If you are unable to compile your program on Unix, 
+please check the configuration file for your platform for the correct 
+options.
+
+C:
+    cc -o <your program> <your program>.c -I<path for hdf include directory>\
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+   or
+
+    cc -o <your program> <your program>.c -I<path for hdf include directory> \
+          <path for libmfhdf.a>  <path for libdf.a> \
+          <path for libjpeg.a> <path for libz.a>
+
+FORTRAN:
+    f77 -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+   
+   or
+   
+    f77 -o <your program> <your program>.f  \
+          <path for libmfhdf.a>  <path for libdf.a> \
+          <path for libjpeg.a> <path for libz.a>
+
+NOTE: The order of the libraries is important: libmfhdf.a first,
+followed by libdf.a, then libjpeg.a and libz.a.  The libjpeg.a
+library is optional.
+
+INSTRUCTIONS FOR SPECIFIC PLATFORMS
+===================================
+
+Cray:
+----
+C:
+    cc  -O -s -o <your program> <your program>.c \  
+        -I<path for hdf include directory> \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f90 -O 1 -o <your program> <your program>.f  \
+         -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+Dec Alpha/Digital Unix:
+----------------------
+C:
+    cc -Olimit 2048 -std1 -o <your program> <your program>.c \
+       -I<path for hdf include directory>\
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f77 -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+ 
+Dec Alpha/OpenVMS AXP:
+---------------------
+   To compile your programs, prog.c and prog1.for, with the HDF library, 
+   mfhdf.olb, df.olb, and libz.olb are required.  The libjpeg.olb library 
+   is optional.
+
+   cc/opt/nodebug/define=(HDF,VMS)/nolist/include=<dir for include> prog.c
+   fort prog1.for
+   link/nodebug/notraceback/exec=prog.exe  prog.obj, prog1.obj, -
+         <dir for lib>mfhdf/lib -
+         <dir for lib>df/lib, <dir for lib>libjpeg/lib,  -
+         <dir for lib>libz/lib, sys$library:vaxcrtl/lib
+
+   NOTE: The order of the libraries is important: mfhdf.olb first,
+   followed by df.olb then libjpeg.olb and libz.olb.
+
+Exemplar:
+--------
+C:
+    cc -ext -nv -no <your program> <your program>.c \
+       -I<path for hdf include directory> \
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    fc  -sfc -72 -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+   NOTE: These instructions are for Convex/HP Exemplar machines running
+   versions of the OS ealier than 10.x.  For machines running version
+   10.x of HP-UX, follow the instructions for HP-UX 10.2.
+
+FreeBSD:
+-------
+C:
+    cc -ansi -Wall -pedantic -o <your program> <your program>.c \  
+        -I<path for hdf include directory> \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f77 -O -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+ 
+HP-UX:
+-----
+C:
+    cc -Ae -s -o <your program> <your program>.c \
+       -I<path for hdf include directory> \
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f77 -s -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+ 
+
+IRIX 6.x:
+--------
+C:
+    cc -ansi -n32 -mips3 -O -s -o <your program> <your program>.c  \
+       -I<path for hdf include directory>\
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f90 -n32 -mips3 -O -s -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+IRIX64 with 64-bit mode:
+------------------------
+C:
+    cc -ansi -64 -mips4 -O -s -o <your program> <your program>.c  \
+       -I<path for hdf include directory>\
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f77 -64 -mips4 -O -s -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+  
+IRIX64 with n32-bit mode:
+-------------------------
+C:
+    cc -ansi -n32 -mips4 -O -s -o <your program> <your program>.c \
+     -I<path for hdf include directory> \
+     -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f77 -n32 -mips4 -O -s -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+Linux:
+-----
+C:
+    gcc -ansi -D_BSD_SOURCE -o <your program> <your program>.c \  
+        -I<path for hdf include directory> \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    g77 -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+Solaris:
+-------
+   The -lnsl is necessary in order to include the xdr library.
+
+C:
+    cc -Xc -xO2 -o <your program> <your program>.c  \
+       -I<path for hdf include directory>\
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz \
+       -L/usr/lib -lnsl
+
+FORTRAN:
+    f77 -O -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz \
+        -L/usr/lib -lnsl
+
+Solaris_x86 (C only):
+--------------------
+    The -lnsl is necessary in order to include the xdr library.
+
+    gcc -ansi -O -o <your program> <your program>.c \
+        -I<path for hdf include directory> \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz  \
+        -L/usr/lib -lnsl
+
+SP:
+---
+C:
+    xlc -qlanglvl=ansi -O -o <your program> <your program>.c \
+        -I<path for hdf include directory> \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f77 -O -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+
+T3E:
+---
+C:
+    
+    cc -X m -s -o <your program> <your program>.c \
+       -I<path for hdf include directory>\
+       -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+FORTRAN:
+    f90 -X m -Wl"-Dpermok=yes" -Wl"-s" -o <your program> <your program>.f  \
+        -L<path for hdf libraries> -lmfhdf -ldf -ljpeg -lz
+
+
+Windows NT/98/2000:
+------------------
+Using Microsoft Visual C++ version 6.x:
+
+Under Tools->Options, select the folder, Directories:
+   Under "Show directories for", select "Include files".
+   Add the following directories:
+      C:<path to HDF includes>\INCLUDE  
+
+Under "Show directories for", select "Library files":
+   Add the following directories:
+      C:<path to HDF libs>\LIB        
+
+Under Project->Settings, select folder, Link:
+   Add the following libraries to the beginning of the list of
+   Object/Library Modules:
+         hd415.lib hm415.lib (single-threaded release version)
+         hd415d.lib hm415d.lib (single-threaded debug version)
+
+         hd415m.lib hm415m.lib (multi-threaded release version)
+         hd415md.lib hm415md.lib (multi-threaded debug version)
+
+
+
+============================================================================
+================================compression.txt=============================
+
+Compression Algorithms and interface
+
+    The low-level compression interface allows any data object to be 
+compressed using a variety of algorithms.  This is completely transparent 
+to users once the data has been compressed initially - further data written
+to an object or read from it are compressed or decompressed internally to
+the library, without user intervention.  (For information on compressing
+SDS datasets, see the ../release_notes/comp_SDS.txt file.)  
+
+Currently only three compression algorithms are supported: Run-Length Encoding 
+(RLE), adaptive Huffman, and an LZ-77 dictionary coder (the gzip 'deflation' 
+algorithm).  Plans for future algorithms include an Lempel/Ziv-78 dictionary 
+coding, an arithmetic coder and a faster Huffman algorithm.
+
+    The public interface for this routine is contained in the user-level
+function call, HCcreate.  The interface to HCcreate is described below:
+
+int32 HCcreate(id,tag,ref,model_type,m_info,coder_type,c_info);
+    int32 id;                IN: the file id to create the data in (from Hopen)
+    uint16 tag,ref;          IN: the tag/ref pair of the data object which
+                                    is to be compressed
+    comp_model_t model_type; IN: the type of modeling to use, currently
+                                    only COMP_MODEL_STDIO is supported, which
+                                    indicates data is transferred in the
+                                    same way as C I/O functions operate.
+    model_info *m_info;      IN: Information needed for the modeling type chosen
+                                    Nothing needed for COMP_MODEL_STDIO,
+                                    so NULL can be used.
+    comp_coder_t coder_type; IN: the type of encoding to use from the following:
+                                    COMP_CODE_NONE - for no compression
+                                    COMP_CODE_RLE - for RLE encoding
+                                    COMP_CODE_SKPHUFF - for adaptive Huffman
+                                    COMP_CODE_DEFLATE - for gzip 'deflation'
+    comp_info *c_info;       IN: Information needed for the encoding type chosen
+                                    For COMP_CODE_NONE and COMP_CODE_RLE,
+                                    this is unused and can be set to NULL.
+                                    For COMP_CODE_SKPHUFF, the structure skphuff
+                                    in this union needs information about the
+                                    size of the data elements in bytes (see
+                                    examples below).
+                                    For COMP_CODE_DEFLATE, the structure deflate
+                                    in this union needs information about the
+                                    "effort" to encode data with.  Higher
+                                    values of 'level' member indicate more
+                                    compression effort.  Values may range from
+                                    0 (minimal compression, fastest time) to
+                                    9 (maximum compression, slowest time).
+    RETURNS
+        Return an AID to the newly created compressed element, FAIL on error.
+
+    HCcreate will compress an existing data object with the specified 
+compression method, or it can create a new data object which will contain
+compressed data when it is written to.  In either case, Hendaccess must be
+called to release the AID allocated by HCcreate.  In the first two examples
+below the datasets already exist, in the final example the dataset is created
+by the HCcreate call.  There is currently no FORTRAN equivalent for this
+function.  More details about this function can be found in the HDF reference
+manual.
+
+The following example shows how to compress a scientific dataset data object
+(which is composed of multi-dimensional 32-bit integer data) using the
+adaptive Huffman encoding:
+    {
+        int32 aid;
+        comp_info c_info;
+
+        c_info.skphuff.skp_size=sizeof(int32);
+        aid=HCcreate(file_id, DFTAG_SD, ref, COMP_MODEL_STDIO, NULL, 
+            COMP_CODE_SKPHUFF,&c_info);
+        .
+        .
+        <access data object>
+        .
+        .
+        Hendaccess(aid);
+    }
+
+The following example shows show to compress a raster image data object
+using the RLE algorithm:
+    {
+        int32 aid;
+
+        aid=HCcreate(file_id, DFTAG_RI, ref, COMP_MODEL_STDIO, NULL, 
+            COMP_CODE_RLE,NULL);
+        .
+        .
+        <access data object>
+        .
+        .
+        Hendaccess(aid);
+    }
+
+The following example shows how to create a new data object whose data
+will compressed as it is written:
+    {
+        int32 aid;
+
+        aid=HCcreate(file_id, DFTAG_RI, ref, COMP_MODEL_STDIO, NULL, 
+            COMP_CODE_RLE,NULL);
+        .
+        .
+        Hwrite(aid,len,data);
+        .
+        .
+        Hendaccess(aid);
+    }
+============================================================================
+================================dimval.txt==================================
+
+             New Version of Dimension Values
+             ===============================
+
+HDF4.0b1 and previous releases use a vgroup to represent a dimension.
+The vgroup has a single field vdata with class "DimVal0.0".
+The vdata has <dimension size> number of records, each record has a 
+fake value from 0, 1, 2 ... , (<dimension size> - 1 ). The fake values 
+are not really required and take a lot of space. For applications that 
+create large one dimensional array datasets the disk space taken by 
+these fake values almost double the size of the HDF file. In order to 
+omit the fake values, a new version of dimension vdata has been proposed.
+
+The new version uses the same structure as the old version. The only
+differences are that the vdata has only 1 record with value 
+<dimension size> and that the vdata's class is "DimVal0.1" to 
+distinguish it from the old version.
+
+However, existing tools and utilities which were compiled with the old
+version can't recognize the new dimensions of hdf files created using
+HDF4.0b2 or later version. This could cause problems for HDF users.
+To solve this problem, we are planning to implement a transitional 
+policy:
+
+1. Starting from HDF4.0b2 both versions of the dimension will be
+   created by default. The old tools recognize the "DimVal0.0" 
+   dimension.
+2. A new function SDsetdimval_comp (sfsdmvc) is added which can 
+   be called for a specific dimension to suppress the creation 
+   of the "DimVal0.0" vdata for that dimension. Users who store 
+   big 1D arrays should use this function to create "DimVal0.1" 
+   only.  See the man page for sdsetdimval_comp.3. 
+3. A new function SDisdimval_bwcomp (sfisdmvc) is added which 
+   can be called to get the current compatibility mode of a 
+   dimension. See the man page for sdisdimval_bwcomp.3. 
+4. HDF4.0b2 and later version of HDF libraries can recognize both
+   old and new versions of dimensions. This means old HDF files can 
+   always be read by new HDF libraries.
+5. HDF4.1 will create only "DimVal0.1" by default and function 
+   SDsetdimval_comp should be called if "DimVal0.0" is also desired.  
+   The transition time period is ended.
+6. Existing tools and utilities should be re-compiled with HDF4.0b2
+   or later releases during that transition time period.
+7. A new utility will be written to remove redundant "DimVal0.0" from 
+   the files created during the transition time period.
+8. A new utility will be written to convert "DimVal0.1" to "DimVal0.0"
+   for special cases.
+
+Please send bug reports, comments and suggestions to hdfhelp at ncsa.uiuc.edu.
+
+
+============================================================================
+================================external_path.txt===========================
+
+User Settable File Location for External Elements
+
+Users sometimes encounter situations (e.g., disk space shortage,
+different filesystem names) that the external file containing the data
+of the external element has to reside in a directory different from the
+one it was created.  The user may set up symbolic pointers to forward
+the file locations but this does not work if the external filename is
+an absolute path type containing directory components that do not exist
+in the local system.
+
+A new feature is added such that an application can provide a list of
+directories for the HDF library to search for the external file.  This
+is set by the function call HXsetdir or via the environment variable
+$HDFEXTDIR.  See the man page HXsetdir(3) for details.
+
+A similar feature is also added to direct the HDF library to create the
+external file of a _new_ external element in the given directory.  An
+example for the need of this feature is that an application wants to
+create multiple external element files with certain naming conventions
+(e.g., Data950101, Data950102) while all these files share a common
+parent directory (project123/DataVault).  Different users will have a
+different choice of the common parent directory.  This can be set by
+the function call HXsetcreatedir or the environment variable
+$HDFEXTCREATEDIR.  See the man page for HXsetcreatedir (1) for detail.
+
+============================================================================
+================================hdp.txt=====================================
+
+           hdp -- HDF dumper 
+
+
+NAME
+     hdp - HDF dumper
+
+SYNOPSIS
+     hdp [hdp options] hdp command [command options] <filename list>
+
+DESCRIPTION
+     
+     hdp is a command line utility designed for quick display of 
+     contents and data of HDF3.3 objects. It can list the contents 
+     of hdf files at various levels with different details. It can 
+     also dump the data of one or more specific objects in the file. 
+
+
+HDP OPTIONS
+
+    Currently, there is only one option.
+
+    -H  Display usage information about the specified command.
+        If no command is specified, -H lists all available commands.
+
+
+HDP COMMANDS
+
+     hdp currently has two types of commands: list and dump. Other 
+     types of commands such as those for editing may be added in the
+     future.
+     
+     hdp list <filename list>
+         lists contents of files in <filename list> 
+
+     hdp dumpsds <filename list>
+         displays data of NDGs and SDGs in the listed files.
+
+     hdp dumpvd <filename list>
+         displays data of vdatas in the listed files.
+   
+     hdp dumpvg <filename list>
+         displays data of objects in vgroups in the listed files.
+
+     hdp dumprig <filename list>
+         displays data of RIGs in the listed files.
+
+     hdp dumpgr <filename list>
+         displays data of general RIGs in the listed files.
+
+HDP COMMAND OPTIONS
+
+(Note: options preceeded by an * have not yet been implemented.)
+
+
+     hdp list [format options] [content ops] [filter ops] [order ops] 
+	      <filename list>
+     --------------------------------------------------------------------------
+
+      Format options
+          decide how the info of objects will be presented on the screen.
+       
+        -s  (short format) under each tag #, all ref's of that tag are listed
+            in one or more lines, same as the output of hdfls. (default)
+
+        -l  (long format) one object per line. Each line contains tag-name, 
+            tag/ref and the index of this tag in the file.(e.g., the ith NDG 
+	    in the file).
+
+        -d  debug format, one object per line. Each line contains tag_name,
+            tag/ref, index, offset, and length, same as the output of hdfls -d.
+
+	no	tagname	   tag	  ref	index/tag	offset	length
+        --      -------    ---    ---   ---------       ------  ------
+
+	1	DFTAG_NT   106      2      1          
+        2       DFTAG_SD   701      3      1
+        ...
+
+
+         Content options
+              allow contents be displayed.
+  
+            -n  display the name or label of the object, if there is any.
+                -n puts you in -l format automatically.
+
+            -c  display the class of the object, if there is any. -l format.
+
+            -a  display description of the object, if there is any. -l format.
+
+         Filter options
+              select certain type of objects to display, default is all.
+
+            -g  display groups only. Objects which do not belong to 
+                any group will not be displayed. Nested groups will be
+                displayed in tree format.
+
+            -t <number>  display objects with specified tag number . e.g. 
+                         720 for NDG.
+            -t <name>    display objects with specified tag name.
+
+         Order options
+              sort the output list in different orders.
+ 
+            -ot  by tag # (default)
+            -of  by the order in file DDlist.
+            -og  by group
+            -on  by name(label)
+
+    hdp dumpsds [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which SDS to dump.
+
+             -i <index> dump SDS's with indices specified in <index>; 
+			  indices correspond to the order of the SDS in the file
+             -r <ref>    dump SDS's with reference numbers specified in <ref>
+             -n <name>   dump SDS's with names specified in <name>
+             -a           dump all SDS's in the file. (default)
+
+	     Options -i, -r, and -n can be used inclusively to specify
+	     different SDS's.
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only, no tag/ref 
+
+	     These options are exclusive.
+
+          Output options
+
+             -o <filename> specify <filename> as output file name
+             -b            binary output
+             -x            ascii text output (default)
+
+	     Options -b and -x are exclusive, but each can be used with
+	     option -o.
+
+	  Format options
+	     -c    print space characters as they are, not \digit
+	     -g    do not print data of file (global) attributes
+	     -l    do not print data of local attributes
+	     -s    do not add carriage return to a long line - dump as a stream
+
+	     Options in this category can be used inclusively.
+
+	  Note: Any combination of an option from each of the categories can
+		be used as long as the criteria of that category are met.
+
+    hdp dumpvd [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which vdata to dump.
+
+             -i <index>   dump vdatas with indices in <index>; indices 
+			  correspond to the order of the vdatas in the 
+			  files
+             -r <ref>     dump vdatas with reference numbers specified in
+			  <ref>
+             -n <name>    dump vdatas with names specified in <name>
+             -c <class>   dump vdatas with classes specified in <class>
+             -a           dump all vdatas in the file. (default)
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only, no tag/ref
+             -f <fields> dump data of specified fields
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+           * -b         binary file
+             -t         text ascii file (default)
+
+    hdp dumpvg [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which vgroups to dump.
+
+             -i <index>   dump vgroups with indices specified in <index>; 
+			  indices correspond to the order of the vgroups 
+			  specified in the files
+             -r <ref>     dump vgroups with reference numbers specified in <ref>
+             -n <name>    dump vgroups with names specified in <name>
+             -c <class>   dump vgroups with classes specified in <class>
+             -a           dump all vgroups in the file. (default)
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+           * -b         binary file
+             -t         text ascii file (default)
+
+    Note: Unless the "-d" option is specified, a graphical representation of
+	  the file will be given after the data has been displayed. 
+
+    hdp dumprig [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which RIG to dump.
+
+             -i <index>   dump RIGs with indices specified in <index>; 
+			  indices correspond to the order of the RIGs 
+			  specified in the files
+             -r <ref>     dump RIGs with reference numbers specified in <ref>
+             -a           dump all RIGs in the file. (default)
+             -m  8|24     dump the RIGs of 8-bit or 24-bit. By default all
+                             RIGs in the file will be dumped
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+             -b         binary file
+             -t         text ascii file (default)
+
+    hdp dumpgr [filter ops] [contents ops] [output ops] <filename list>
+    --------------------------------------------------------------------
+         Filter options
+              specify which general RIGs to dump.
+
+             -i <index>   dump general RIG's with indices specified in 
+                          <index>; indices correspond to the order of 
+                          the RIG in the file
+             -r <ref>     dump general RIG's with reference numbers 
+                          specified in <ref>
+             -n <name>    dump general RIG's with names specified in <name>
+             -a           dump all general RIG's in the file. (default)
+
+          Content options
+
+             -v    display everything including all annotations (default)
+             -h    header only, no annotation for elements or data
+             -d    data only, no tag/ref
+
+          Output options
+
+             -o <fn>    specify fn as output file name
+             -b         binary file
+             -t         ascii text file (default)
+
+          Note: any combination of an option from each of the three categories
+                can be used; but no more than one option from one category is
+                allowed.
+============================================================================
+================================install_winNT.txt===========================
+
+      Install HDF4.1 Release 2 on Windows NT and Windows 95, and Alpha NT.
+
+Since Windows NT, Windows '95 (Chicago) and Windows 3.1
+(with the Win 32s extensions) all are designed to run the same 32-bit code, our 
+decision is to support only 32-bit libraries and code on the MS-Windows 
+platform. We are not planning on supporting any 16-bit versions in the 
+foreseeable future.
+
+The instructions which follow assume that you will be using one of 
+the 'zip' files that we provide, either the binary code release
+(hdf41r2.zip) or the source code release (hdf41r2s.zip).
+In building HDF from source code you may select between 
+two build environment options depending on your
+application and environment needs.  Each option has it's own zip file:
+
+
+Option I, (select Win32nof.zip)
+Test and Utility configuration : HDF library, tests, and utilities, no fortran,
+available for Win32 Intel platform only.
+
+Option II, (select Win32full.zip)
+Full configuration : HDF library, tests, and utilities, with fortran
+This version has been built and tested using DEC Visual Fortran on both
+the Win32 Intel platform and the Win32 Alpha platform.
+
+
+
+Building from Binary Code Release (hdf41r2.zip)
+===============================================
+To install the HDF, JPEG, zlib and mfhdf libraries and utilities, 
+it is assumed that you have done the following:
+      
+
+      1. Create a directory structure to unpack the library. For 
+      example: 
+
+	    c:\					(any drive)
+           MyHDFstuff\				(any folder name)
+
+      2. Copy the binary archive (HDF41r2.zip) to that directory 
+      and unpack it by running WinZip on HDF41r2.zip (the binary archive).
+      This should create a directory called 'HDF41r2' which 
+      contains the following files and directories.
+
+            c:\MyHDFstuff\HDF41r2\lib             ( Debug and Release versions of HDF libraries )
+            c:\MyHDFstuff\HDF41r2\include         ( HDF include files )
+            c:\MyHDFstuff\HDF41r2\bin             ( HDF utilities files )
+            c:\MyHDFstuff\HDF41r2\release_notes   ( release notes )
+            c:\MyHDFstuff\HDF41r2\install_NT_95   ( this file)
+
+      
+      3. If you are building an application that uses the HDF library 
+         the following locations will need to be specified for locating
+         header files and linking in the HDF libraries:
+ 
+            C:\MyHDFstuff\HDF41r2\lib
+            C:\MyHDFstuff\HDF41r2\include
+
+
+
+
+
+Building from Source Code Release (hdf41r2s.zip)
+===============================================
+
+STEP I:  Preconditions
+
+To build the HDF, JPEG, zlib and mfhdf libraries and utilities, 
+it is assumed that you have done the following:
+      
+      1. Installed MicroSoft Developer Studio, and Visual C++ 5.0.
+         Visual Fortran 5.0 is needed if you are going to build the
+         full HDF Library with Fortran support.
+
+      2. Set up a directory structure to unpack the library. For 
+      example: 
+
+	    c:\					(any drive)
+           MyHDFstuff\				(any folder name)
+
+      3. Copy the source distribution archive to that directory 
+      and unpack it using the appropriate archiver options to
+      create a directory  hierarchy.
+         
+      Run WinZip on HDF41r2s.zip (the entire source tree).
+      This should create a directory called 'HDF41r2' which 
+      contains several files and directories.
+      
+      ( Note for those using the Win32 Alpha platform:
+        If you do not have a Winzip utility for your Alpha system
+        you can download the needed executables from: 
+        http://www.cdrom.com/pub/infozip ) 
+       
+STEP II: Select Installation type and Build.
+
+You may select one of 2 ways to build the HDF library and 
+utilities, depending on your environment and application needs.
+
+Option I, (select Win32nof.zip)
+Test and Utility configuration : HDF library, tests, and utilities, no fortran
+
+Option II, (select Win32full.zip)
+Full configuration : HDF library, tests, and utilities, with fortran
+
+
+
+STEP III: Follow Instructions for Option I, or II
+
+
+INSTRUCTIONS FOR OPTION I, TEST AND UTILITY INSTALLATION, NO FORTRAN
+                 (Win32 Intel platform only)
+
+	*** Builds hdf library, hdf utilities, 
+	*** test programs and batch files. No fortran code.
+ 
+        1. You will use Win32nof.zip 
+           Unpack dev\win32nof.zip in directory dev\
+           
+            Run WinZip on 
+               c:\myHDFstuff\HDF41r2\Win32nof.zip
+               This archive contains a Developer Studio project "dev" and 
+               two batch files. 
+               40 project files (*.dsp files) will be created when 
+               Win32nof.zip is expanded.
+
+         2. Invoke Microsoft Visial C++ 5.0, go to "File" and select
+            "Open Workspace" option. 
+            Then open  c:\myHDFstuff\HDF41r2\dev.dsw workspace. 
+
+	 3. Select "Build", then Select "Set Active Configuration".
+            Select "dev -- Win32Debug" as active configuration.
+            Select "Build" and "Build dev.exe" to
+            build the Debug version of the HDF41r2 tree.
+
+	 4. Select "Build", then Select "Set Active Configuration".
+            Select "dev -- Win32Release" as active configuration.
+            Select "Build" and "Build dev.exe" to
+            build the Release version of the HDF41r2 tree.
+	
+         5. In command prompt window run the test batch file 
+            win32noftst.bat in directory HDF41r2\.
+
+         6. If all tests passed, run the installation batch file 
+       win32ins.bat in directory HDF41r2\. Commands in this file will create
+       subdirectories bin\, include\ and lib\ in HDF41r2\. The bin dirctory
+       will contain the HDF utilities, the include directory will contain 
+       header files, and the lib directory will contain:
+               jpeg.lib     - JPEG Library
+               jpegd.lib    - JPEG Library with DEBUG option
+               libsrc.lib   - multi-file SDS Inteface routines
+               libsrcd.lib  - multi-file SDS Inteface routines with DEBUG option
+               src.lib      - multi-file Vdata Interface
+                                         Vgroup Interface
+                                         AN Interface
+                                         GR Interface routines
+               srcd.lib     - multi-file Vdata Interface
+                                         Vgroup Interface
+                                         AN Interface
+                                         GR Interface routines with DEBUG option
+               xdr.lib      - XDR Library
+               xdrd.lib     - XDR Library with DEBUG option
+               zlib.lib     - GNU Zip Library 
+               zlibd.lib    - GNU Zip Library with DEBUG option 
+  
+
+INSTRUCTIONS FOR OPTION II, FULL INSTALLATION WITH FORTRAN
+
+        
+	*** Builds the hdf library, hdf utility programs, test programs,
+	*** and batch files. Includes fortran source code to be
+        *** compiled with Digital Visual Fortran on either a Win32 Intel
+        *** machine or a Win32 Alpha machine.
+
+	1. Unpack HDF41r2\Win32full.zip in directory HDF41r2\. 
+         
+        2. Invoke Microsoft Visial C++ 5.0, go to "File" and select
+           "Open Workspace" option. 
+           Then open  c:\myHDFstuff\HDF41r2\dev.dsw workspace. 
+
+        3. Select "Build", then Select "Set Active Configuration".
+           Select as the active configuration "dev -- Win32Debug" 
+           if you have a Win32 Intel processor OR 
+           select "dev-Win32AlphaDbg" if you have a Win32 Alpha processor. 
+           Select "Build" and "Build dev.exe" to
+           build the Debug version of the HDF41r2 tree.
+           You will see that Digital Visual Fortran compiler is invoked
+           by Visual C++ Development environment in compiling the fortran code.
+
+        4. Select "Build", then Select "Set Active Configuration".
+           Select as the active configuration"dev -- Win32Release"
+           if you have a Win32 Intel processor OR
+           select "dev-Win32AlphaRel" if you have a Win32 Alpha processor.
+           Select "Build" and "Build dev.exe" to
+           build the Release version of the HDF41r2 tree.
+		
+        5. In command prompt window run the test batch file which
+       resides in the HDF41r2 directory.
+       Run win32tst.bat if you have a Win32 Intel platform OR 
+       run win32ALPHAtst.bat if you have the Win32 Alpha platform.
+
+	6. If all tests passed, run the installation batch file which
+       resides in the HDF41r2 directory
+       Run win32ins.bat if you have a Win32 Intel platform OR
+       run win32ALPHAins.bat if you have a Win32 Alpha platform.
+       Commands in these files will create
+       subdirectories bin\, include\ and lib\ in HDF41r2\. The bin dirctory
+       will contain the HDF utilities, include directory will contain 
+       header files, and the lib directory will contain:
+               jpeg.lib     - JPEG Library
+               jpegd.lib    - JPEG Library with DEBUG option
+               libsrc.lib   - multi-file SDS Inteface routines
+               libsrcd.lib  - multi-file SDS Inteface routines with DEBUG option               src.lib      - multi-file Vdata Interface
+                                         Vgroup Interface
+                                         AN Interface
+                                         GR Interface routines
+               srcd.lib     - multi-file Vdata Interface
+                                         Vgroup Interface
+                                         AN Interface
+               xdrd.lib     - XDR Library with DEBUG option
+               zlib.lib     - GNU Zip Library 
+               zlibd.lib    - GNU Zip Library with DEBUG option
+ 
+
+
+STEP IV:
+
+BUILDING AN APPLICATION USING THE HDF LIBRARY - SOME HELPFUL POINTERS
+=====================================================================
+
+If you are building an application that uses the HDF library 
+the following locations will need to be specified for locating
+header files and linking in the HDF libraries:
+ 
+            <top-level HDF directory>\lib
+            <top-level HDF directory>\include
+
+where <top-level HDF directory> may be C:\myHDFstuff\dev or C:\MyHDFstuff\HDF41r2\
+
+Please refer to the <top-level HDF directory>\release_notes\compile.txt file
+for more information on compiling an application with the HDF libraries.
+
+
+MORE HELPFUL POINTERS
+=====================
+(as described in terms of installing the  nofortran configuration)
+
+Here are some notes that may be of help if you are not familiar
+with using the Visual C++ Development Environment.
+
+Project name and location issues: 
+         The files in Win32nof.zip must end up in the HDF41r2\ directory
+         installed by HDF41r2s.zip
+
+         If you must install dev.dsw and dev.dsp in 
+         another directory, relative to HDF41r2\ , you will be asked to
+	 locate the above 5 sub-project files, when you open the
+	 project dev.dsw.
+	 
+	 If you want to rename dev (the entire project),
+	 you will need to modify two files
+	 dev.dsw and dev.dsp as text
+	 (contrary to the explicit warnings in the files).
+
+	 You can also modify dev.dsw and dev.dsp
+	 as text, to allow these 2 files to be installed
+	 in another directory.
+
+
+
+  Settings... details:
+  If you create your own project, the necessary settings can be
+  read from the dev.dsp file(as text), or from the
+  Project Settings in the Developer Studio project settings 
+dialog.
+
+    Project
+	  Settings
+	      C/C++
+		  Category
+		     PreProcessor
+			 Code Generation
+			    Use run-time Library
+				   These are all set to use Single-Threaded.
+				   or Single-Threaded debug.
+
+
+
+
+============================================================================
+================================macintosh.txt===============================
+
+Fortner Software LLC ("Fortner") created the reference implementation for
+Macintosh of the HDF 4.1r3 library, providing C-language bindings to all
+4.1r3 features.
+
+The Macintosh reference implementation of the HDF 4.1r3 library was implemented
+and tested on a PowerMac Model 7600/120 running MacOS 8.5.1 using Metrowerks
+CodeWarrior Pro1.  The library has also been run on a PowerMac G3.  
+
+Fortner cannot be certain that the libraries will run on other versions of
+Macintoshes (or clones) or MacOS versions, or when built using other
+development tools.  (In particular, this Macintosh implementation has not
+addressed use with non-PowerPC versions of Macintosh [i.e., 680x0-based
+Macintoshes]).  Migrating the Macintosh reference implementation to other
+development and/or run-time environments is the responsibility of the
+library user.
+
+First-time HDF users are encouraged to read the FAQ in this release for
+more information about HDF.  Users can also look at the home page for HDF
+at:
+
+    http://hdf.ncsa.uiuc.edu/
+
+Please send questions, comments, and recommendations regarding the
+Macintosh version of the HDF library to:
+
+    hdfhelp at ncsa.uiuc.edu
+ 
+
+============================================================================
+================================mf_anno.txt=================================
+
+ Annotation access through the Multi-file Annotation Interface(ANxxx)
+ ==================================================================== 
+
+ These routines are for accessing file labels, file descriptions, data
+labels and data descriptions(i.e. all are annotations). General access
+requires the routines Hopen() and ANstart() to be called first and the 
+last call to be ANend() and Hclose() which ends annotation handling on the file
+and closes the file. Basic annotation manipulation involes dealing
+with  handles(ann_id's) foreach annotation and annotation interface 
+handle(an_id). 
+
+
+NOTES: 
+  Note that the annotation types are enumerated. 
+  TYPE here refers to file/data label/description types 
+  They are AN_FILE_LABEL, AN_FILE_DESC, AN_DATA_LABEL, AN_DATA_DESC
+  The tag/ref refers to data tag/ref.
+
+  AN_DATA_LABEL = 0, /* Data label */
+  AN_DATA_DESC  = 1, /* Data description */
+  AN_FILE_LABEL = 2, /* File label */
+  AN_FILE_DESC  = 3  /* File description */ 
+
+In C-code you need to declare the annotation type using the 
+enumerated type defintion.
+
+e.g. C-code fragment to write a File label
+
+#include "hdf.h"
+...
+..
+char fname[10] = {"ann.hdf"};
+char *file_lab[1] = {"File label #1: This is a file label"};
+
+int32   file_id; /* file id */
+int32   an_id;   /* annotation interface id */
+int32   ann_id;  /* annotation id */
+ann_type myanntype;  /* annotation type */
+
+/* Start Annotation inteface and create file */
+file_id = Hopen(fname, DFACC_CREATE,0);
+an_id = ANstart(file_id);
+
+/* Set annotation type to file label */
+myanntype = AN_FILE_LABEL;
+
+/* Create id for file label */
+ann_id = ANcreatef(an_id, myanntype);
+
+/* Write file label */
+ANwriteann(ann_id, file_lab[0], HDstrlen(file_lab[0]));
+
+/* end access to file label */
+ANendaccess(ann_id);
+
+/* end access to file and close it*/
+ANend(an_id);
+Hclose(file_id);
+....
+...
+
+NOTE: You could also call ANcreatef() like this 
+        ANcreatef(an_handle, AN_FILE_LABEL);
+      without using the intermediate variable.
+
+ ROUTINES NEEDED:
+================
+ Hopen    - Opening the file, returns a file handle
+ Hclose   - Close the file.
+ 
+ NEW ROUTINES:
+===============
+ ANstart     - open file for annotation handling, returns annotation
+               interface id
+ ANfileinfo  - get number of file/data annotations in file. Indices returned
+               are used in ANselect() calls.
+ ANend       - end access to annotation handling on file
+ ANcreate    - create a new data annotation and return an id(ann_id)
+ ANcreatef   - create a new file annotation and return an id(ann_id)
+ ANselect    - returns an annotation id(ann_id) from index for 
+               a particular annotation TYPE. This id is then used for
+               calls like ANwriteann(), ANreadann(), ANannlen(),..etc
+ ANnumann:   - return number of annotations that match TYPE/tag/ref
+ ANannlist:  - return list of id's(ann_id's) that match TYPE/tag/ref
+ ANannlen:   - get length of annotation given id(ann_id)
+ ANreadann:  - read annotation given id(ann_id)
+ ANwriteann: - write annotation given id(ann_id)
+ ANendaccess - end access to annotation using id(ann_id)
+
+
+Routines:
+----------
+
+C:
+/* ------------------------------- ANstart -------------------------------- 
+ NAME
+	ANstart -- open file for annotation handling
+ USAGE
+	int32 ANstart(file_id)
+        int32  file_id;    IN: file id
+
+ RETURNS
+        An annotation interface ID or FAIL
+ DESCRIPTION
+        Start annotation handling on the file and return an interface id.
+
+ 
+Fortran: afstart(file_id)
+
+/*------------------------------- ANfileinfo ----------------------------
+ NAME
+    ANfileinfo
+ PURPOSE
+    Report high-level information about the ANxxx interface for a given file.
+ USAGE
+    intn ANfileinfo(an_id, n_file_label, n_file_desc, n_data_label, n_data_desc)
+        int32 an_id;          IN:  annotation interface ID
+        int32 *n_file_label;  OUT: the # of file labels
+        int32 *n_file_desc;   OUT: the # of file descriptions
+        int32 *n_data_label;  OUT: the # of data labels
+        int32 *n_data_desc;   OUT: the # of data descriptions
+ RETURNS
+    SUCCEED/FAIL
+ DESCRIPTION
+    Reports general information about the number of file and data
+    annotations in the file. This routine is generally used to find
+    the range of acceptable indices for ANselect calls.
+
+Fortran: affileinfo(an_id, num_flabel, num_fdesc, num_dlabel, num_ddesc)
+
+/* -------------------------------- ANend ---------------------------------
+ NAME
+	ANend -- close annotation handling on a file
+ USAGE
+	int32 ANend(an_id)
+        int32 an_id;         IN: annotation interface ID for the file
+ RETURNS
+        SUCCEED / FAIL
+ DESCRIPTION
+      Closes annotation handling on the gvien annotation interface id.
+
+
+Fortran: afend(an_id)
+
+/* ------------------------------ ANcreate ---------------------------- 
+ NAME
+	ANcreate - create a new data annotation and return an id
+ USAGE
+	int32 ANcreate(an_id, tag, ref, type )
+        int32 an_id;    IN: annotation interface ID
+        uint16 tag;     IN: tag of item to be assigned annotation
+        uint16 ref;     IN: reference number of itme to be assigned ann
+        ann_type  type: IN: AN_DATA_LABEL for data labels, 
+                            AN_DATA_DESC for data descriptions,
+ RETURNS
+        An ID to an annotation which can either be a label or description
+ DESCRIPTION
+        Creates a data annotation, returns an 'ann_id' to work with the new 
+        annotation which can either be a label or description.
+
+
+Fortran: afcreate(an_id, tag, ref, type)
+
+/* ------------------------------ ANcreatef ---------------------------- 
+ NAME
+	ANcreatef - create a new file annotation and return an id
+ USAGE
+	int32 ANcreatef(an_id, type )
+        int32 an_id;    IN: annotation interface ID
+        ann_type  type: IN:  AN_FILE_LABEL for file labels,
+                             AN_FILE_DESC for file descritpions.
+ RETURNS
+        An ID to an annotation which can either be a file label or description
+ DESCRIPTION
+        Creates a file annotation, returns an 'ann_id' to work with the new 
+        file annotation which can either be a label or description.
+
+Fortran: afcreatef(an_id, type)
+
+
+/* ------------------------------- ANselect ------------------------------- 
+ NAME
+	ANselect -- get an annotation ID from index of 'type'
+ USAGE
+	int32 ANselect(an_id, index, type)
+        int32 an_id;    IN: annotation interface ID
+        int32 index;    IN: index of annottion to get ID for
+        ann_type  type: IN: AN_DATA_LABEL for data labels, 
+                            AN_DATA_DESC for data descriptions,
+                            AN_FILE_LABEL for file labels,
+                            AN_FILE_DESC for file descritpions.
+ RETURNS
+        An ID to an annotation type which can either be a label or description 
+ DESCRIPTION
+        The position index is ZERO based
+
+Fortran: afselect(an_id, index, type)
+
+
+/*------------------------------- ANnumann ---------------------------------
+ NAME
+   ANnumann -- find number of annotation of 'type' that 
+                 match the given element tag/ref 
+ USAGE
+       intn  ANnumann(an_id, type, elem_tag, elem_ref)
+       int32  an_id;     IN: annotation interface ID
+       int    type:      IN: AN_DATA_LABEL for data labels, 
+                             AN_DATA_DESC for data descriptions,
+                             AN_FILE_LABEL for file labels,
+                             AN_FILE_DESC for file descritpions.
+       uint16 elem_tag,: IN: tag of item of which this is annotation
+       uint16 elem_ref;  IN: ref of item of which this is annotation
+ RETURNS
+       number of annotation found if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Find number of annotation of 'type' for the given element 
+       tag/ref pair. Here an element is either a file label/desc or
+       data label/desc.
+
+
+Fortran: afnumann(an_id, type, tag, ref)
+
+
+/*--------------------------------------------------------------------------
+ NAME
+   ANannlist -- generate list of annotation ids of 'type' that 
+                 match the given element tag/ref 
+ USAGE
+       intn  ANannlist(an_id, type, elm_tag, elem_ref, ann_list[])
+       int32  an_id;     IN: annotation interface ID
+       ann_type  type:   IN: AN_DATA_LABEL for data labels, 
+                             AN_DATA_DESC for data descriptions,
+                             AN_FILE_LABEL for file labels,
+                             AN_FILE_DESC for file descritpions.
+       uint16 elem_tag,: IN: tag of element of which this is annotation
+       uint16 elem_ref;  IN: ref of element of which this is annotation
+       int32  ann_list[]; OUT: array of ann_id's that match criteria.
+ RETURNS
+       number of annotations ids found if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Find and generate list of annotation ids of 'type' for the given 
+       element tag/ref pair
+
+
+Fortran: afannlist(an_id,type, tag, ref, alist[])
+
+
+
+/*--------------------------------------------------------------------------
+ NAME
+       ANannlen -- get length of annotation givne annotation id
+ USAGE
+       int32 ANannlen(ann_id)
+       int32 ann_id;   IN: annotation id
+ RETURNS
+       length of annotation if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Get the length of the annotation specified.
+
+
+Fortran: afannlen(ann_id)
+
+/*--------------------------------------------------------------------------
+ NAME
+       ANwriteann -- write annotation given ann_id
+ USAGE
+       intn ANwriteann(ann_id, ann, ann_len)
+       char *ann_id;   IN: annotation id
+       char *ann;      IN: annotation to write
+       int32 ann_len;  IN: length of annotation
+
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Checks for pre-existence of given annotation, replacing old one if it
+       exists. Writes out annotation.
+
+Fortran: afwriteann(ann_id, ann, annlen)
+
+
+
+/*--------------------------------------------------------------------------
+ NAME
+       ANreadann -- read annotation given ann_id
+ USAGE
+       intn ANreadann(ann_id, ann, maxlen)
+       int32 ann_id;   IN: annotation id (handle)
+       char *ann;     OUT: space to return annotation in
+       int32 maxlen;   IN: size of space to return annotation in
+ RETURNS
+       SUCCEED (0) if successful and FAIL (-1) otherwise
+ DESCRIPTION
+       Gets tag and ref of annotation.  Finds DD for that annotation.
+       Reads the annotation, taking care of NULL terminator, if necessary.
+       
+
+Fortran: afreadann(ann_id, ann, maxlen)
+
+
+
+/* ----------------------------------------------------------------------- 
+ NAME
+	ANendaccess -- end access to an annotation given it's id
+ USAGE
+	intn ANendaccess(ann_id)
+        int32 an_id;    IN: annotation id
+ RETURNS
+        SUCCEED or FAIL
+ DESCRIPTION
+        Terminates access to an annotation. 
+
+
+Fortran: afendaccess(ann_id)
+
+
+ 
+
+
+
+============================================================================
+================================mf_ris.txt==================================
+
+                  The multi-file RIS interface
+                  =============================
+
+Contents:
+
+ Introduction
+ How to access files and images in the new interface
+ "Name = value" attributes in the new interface
+ Dealing with annotations in the new interface
+ Work not yet completed, bugs, limitations
+ A listing or routines
+ Descriptions of GR routines
+   File level interface
+   Dataset Manipulation
+   ID/Ref/Index Functions
+   Interlace Request Functions
+   LUT/Palette I/O Functions
+   Special Element Functions
+   Attribute Functions
+
+
+Introduction
+============
+The new Generic Raster (GR) interface provides a set of functions for
+manipulating raster images of all kinds.  This new interface is meant to
+replace the older RIS8 and RIS24 interfaces, although these older
+interfaces will continue to be supported.
+
+Generic raster images are composed of "pixels" which can have multiple
+components, including but not limited to 8-bit unsigned integers.  Each image
+can have multiple palettes associated with it and other 'attributes' in the
+same "name=value" style as the SD*() routines have.
+
+
+The new GR interface was motivated by a number of needs:
+
+o  The need for multi-file, multi-object access to raster images, allowing
+users to keep open more than one file at a time, and to "attach" more than
+one raster image at a time.
+
+o  A need to further integrate the netCDF data-model with the HDF data-models.
+
+o  A need for a more general framework for attributes within the RIS
+data-model (allowing 'name = value' style metadata).
+
+o  A need to be able to access subsamples and subsets of images.
+
+
+IMPORTANT:  The added functionality represented by this new interface has
+necessitated a change in how raster images are physically represented on
+disk.   As a result programs using the old single-file RIS interfaces will
+only be able to read the data out of files produced by the new interface.
+The metadata / attributes will not be accessible.
+
+The following chart represents what can be done with the various interfaces
+available in HDF 4.0b1:
+
+              old RIS-API    new GR-API
+
+old RIS         CRW             CRW
+HDF files
+
+new RIS          r              CRW
+HDF files
+
+'R' means read, 'W' means write and 'C' means create.  Entries with dashes
+'-' represent functionality which has not yet been implemented.  'r' stands
+for the ability to only read the data, not the metadata.
+
+
+Work not yet completed, bugs, limitations
+===========================================
+
+Misc. stuff left to do:
+    Deal with special elements for images.
+    GRrename for images.
+    GRsetflags to suppress writing fill data and to suppress fillvalue attr.
+
+Features not supported:
+    Full support for multiple palettes with each RI.
+    Support for named palettes with each RI.
+    Support for palettes with non-standard formats.
+    Deletion of attributes or images (would require changing the way index
+        numbers are handled)
+
+Other limitations:
+   Currently the following design limitations are still in place:
+   1 - Cannot have pixels or palette entries which contain mixed variable
+        types, i.e. all the pixel/palette components must be of the same
+        number type.
+   2 - Currently all the components must be of valid HDF number types,
+        fractional bytes (i.e. 6-bit components) or 'plain' multiple byte values
+        are not handled, although they can be packed into the next larger
+        sized number type in order to hold them.
+
+
+
+How to access files and images in the new interface
+======================================================
+
+
+Here are the steps involved in accessing images in the new interface:
+
+1. Open or create the file using Hopen.  This provides you with a file ID to
+be used in step 2.
+
+2. Activate the GR interface for the file with the file ID obtained from
+step 1, using GRstart.  This provides you with a GR interface ID (GR ID).
+
+3. Optionally obtain information about the raster images in the file and
+global GR attributes using GRfileinfo.  Use the GR ID from step 2 to refer
+to the image file.
+
+4. Optionally find the index of a raster image, by name using
+GRnametoindex, or by reference number using GRreftoindex.
+
+5. Select for access an image with a given index, using GRselect for each
+image.  Each call to GRselect returns a raster image ID (RI ID) for
+subsequent accesses involving the corresponding image.
+
+5. Access the image by its RI ID, using routines such as GRgetiminfo (to
+get information about the image) and GRreadimage (to read all or part of an
+image).
+
+6. Terminate access to a given image using GRendaccess.
+
+7. Terminate access to the GR interface for the file, using GRend.
+
+8. Close the file using Hclose.
+
+Notice that in the GR interface, images are identified in several ways.
+Before an image is accessible ("attached"), it is identified by index,
+name, and reference number. The index describes the relative position of
+the image in the file. The name is a character string associated with the
+image, and the reference number is a unique integer.  An image's name is
+assigned by the program when it is created, and the reference number is
+assigned by the HDF library when it is created. After an image is attached
+, it is identified by an raster image identifier, or RI ID.
+
+The following code fragment illustrates the steps involved in accessing the
+image in a file and printing information about them.
+
+
+    /* Open the file and initialize the GR interface */
+    hdf_file_id=Hopen(TESTFILE,DFACC_RDWR,0);
+    grid=GRstart(hdf_file_id);
+
+    /* Obtain information about the images in the file */
+    GRfileinfo(grid,&n_datasets,&n_attrs);
+
+    /* Attach to each image and print information about it */
+    for(i=0; i<n_datasets; i++)
+      {
+          riid=GRselect(grid,i);
+          GRgetiminfo(riid,NULL,&ncomp,&nt,&il,dimsizes,&n_attrs);
+
+          printf("%d: riid=%ld: ncomp=%ld, nt=%ld, il=%ld,
+                    dim[0]=%ld, dim[1]=%ld, n_attrs=%ld\n",
+                    i, riid, ncomp, nt, il, dimsizes[0],
+                    dimsizes[1], n_attrs);
+
+          /* Detach from the image */
+          GRendaccess(riid);
+      } /* end for */
+
+    /* Shut down the GR interface and close the file */
+    GRend(grid);
+    Hclose(hdf_file_id);
+
+
+
+"Name = value" attributes in the new interface
+===============================================
+
+Attributes of the form "name = value" were introduced in HDF 3.3, but at
+that time they were available only for SDSs and files.  In HDF 4.0 we have
+added the ability to attach local and global attributes to raster images
+and raster image dimensions.
+
+An attribute's "name" is a string, and "value" is the associated value or
+values.  If an attribute contains more than one value, all values must be
+of the same type.  For example the attribute 'valid_range' attribute might
+be assigned values the maximum and minimum valid values for a given image.
+
+Raster attributes can be "local" or "global."  A local raster image
+attribute is one that applies to one raster image only. Global raster image
+attributes apply to all of the images in a file.
+
+Attributes for raster images are created by the routine GRsetattr.
+Existing attributes are selected by giving an object pointer and an
+attribute index.  The functions GRattrinfo, GRfindattr, and GRgetattr may
+be used in combination to read attributes and their values.  GRattrinfo
+gets the name , number type, and number of values for an attribute with a
+given index.  GRfindattr gets the index of an attribute with a given name,
+and GRreadattr reads the values associate with an attribute with a given
+index.
+
+The following example illustrates how to attach GR image attributes, and
+also GR global (file) attributes.
+
+    /* Open file and initialize the GR interface */
+    hdf_file_id=Hopen(TESTFILE,DFACC_RDWR,0);
+    grid=GRstart(hdf_file_id);
+
+    /* Create a global attribute  -- applies to all rasters in the file */
+    HDstrcpy(attr_name,"Test1");
+    HDstrcpy(u8_attr,"Attribute value 1");
+    GRsetattr(grid,attr_name,DFNT_UINT8,HDstrlen(u8_attr)+1,u8_attr);
+
+    GRfileinfo(grid,&n_datasets,&n_attrs);
+
+    /* select every image in the file, and
+       assign a local attribute to each */
+    for(i=0; i<n_datasets; i++)
+      {
+          /* Attach to image with index==i */
+          riid=GRselect(grid,i);
+
+          /* Create an attribute for the image */
+          HDstrcpy(attr_name,"Image1");
+          HDstrcpy(u8_attr,"Attribute value 1");
+          GRsetattr(riid,attr_name,DFNT_UINT8,HDstrlen(u8_attr)+1,u8_attr);
+
+          GRgetiminfo(riid,NULL,&ncomp,&nt,&il,dimsizes,&n_attrs);
+
+          printf("%d: riid=%ld: ncomp=%ld, nt=%ld, il=%ld, dim[0]=%ld,
+                  dim[1]=%ld, n_attrs=%ld\n",i,riid,ncomp,nt,il,
+                  dimsizes[0], dimsizes[1],n_attrs);
+
+                for(j=0; j<n_attrs; j++)
+                  {
+                    GRattrinfo(riid,j,attr_name,&nt,&ncomp);
+
+                    GRgetattr(riid,j,u8_attr);
+                    printf("Image #%d Attribute #%d: Name=%s, Value=%s\n",
+                             i,j,attr_name,u8_attr);
+                  } /* end for */
+
+          /* Detach from the image */
+          GRendaccess(riid);
+      } /* end for */
+
+    /* Shut down the GR interface */
+    GRend(grid);
+
+    /* Close the file */
+    Hclose(hdf_file_id);
+
+
+
+Dealing with annotations in the new interface
+================================================
+
+The new GR interface allows you to reference rasters explicitly, by "GR
+id".  A GR id is different from its reference number.  Since annotation
+routines attach annotations to objects by reference number, there needs to
+be a mechanism for determining the reference number of a raster image,
+given its id. This is made possible by the addition of the routine
+GRidtoref.
+
+A similar problem occurs when going the other way.  For example, a call to
+DFANlabellist returns the reference numbers of objects that are
+annotated.  If those objects are RISs (i.e. they have the tag DFTAG_RIG),
+we need to map the reference numbers to the corresponding images.  For
+this, a two-step process is required.  You can use the function
+GRreftoindex to get the index, or position, of the dataset that has a
+certain reference number, then you use the routine GRselect to get the id
+for the image in that position.
+
+
+A listing or routines
+======================
+
+File/Interface Functions:
+int32 GRstart(int32 hdf_file_id)
+    - Initializes the GR interface for a particular file. Returns a 'grid' to
+        specify the GR group to operate on.
+intn GRfileinfo(int32 grid, int32 *n_datasets, int32 *n_attrs)
+    - Returns information about the datasets and "global" attributes for the
+        GR interface.
+intn GRend(int32 grid)
+    - Terminates multi-file GR access for a file.
+
+Image I/O Functions:
+int32 GRcreate(int32 grid,char *name,int32 ncomp,int32 nt,int32 il,int32
+dimsizes[2])
+    - Defines a raster image in a file.  Returns a 'riid' to work with the new
+        raster image.
+int32 GRselect(int32 grid,int32 index)
+    - Selects an existing RI to operate on.
+int32 GRnametoindex(int32 grid,char *name)
+    - Maps a RI name to an index which is returned.
+intn GRgetiminfo(int32 riid,char *name,int32 *ncomp,int32 *nt,int32
+*il,int32 dimsizes[2],int32 *n_attr)
+    - Gets information about an RI which has been selected/created.
+intn GRwriteimage(int32 riid,int32 start[2],int32 stride[2],int32
+count[2],VOIDP data)
+    - Writes image data to an RI.  Partial dataset writing and subsampling is
+        allowed, but only with the dimensions of the dataset (ie. no UNLIMITED
+        dimension support)
+intn GRreadimage(int32 riid,int32 start[2],int32 stride[2],int32
+count[2],VOIDP data)
+    - Read image data from an RI.  Partial reads and subsampling are allowed.
+intn GRendaccess(int32 riid)
+    - End access to an RI.
+
+Dimension Functions:
+int32 GRgetdimid(int32 riid,int32 index)
+    - Get a dimension id ('dimid') for an RI to assign atrributes to. [Later]
+intn GRsetdimname(int32 dimid,char *name)
+    - Set the name of a dimension. [Later]
+int32 GRdiminfo(int32 dimid,char *name,int32 *size,int32 *n_attr)
+    - Get information about the dimensions attributes and size. [Later]
+
+ID/Ref/Index Functions:
+uint16 GRidtoref(int32 riid)
+    - Maps an riid to a reference # for annotating or including in a Vgroup.
+int32 GRreftoindex(int32 hdf_file_id,uint16 ref)
+    - Maps the reference # of an RI into an index which can be used with
+        GRselect.
+
+Interlace Request Functions:
+intn GRreqlutil(int32 riid,intn il)
+    - Request that the next LUT read from an RI have a particular interlace.
+intn GRreqimageil(int32 riid,intn il)
+    - Request that the image read from an RI have a particular interlace.
+
+LUT/Palette I/O Functions:
+int32 GRgetlutid(int32 riid,int32 index)
+    - Get a palette id ('palid') for an RI.
+intn GRgetlutinfo(int32 riid,int32 *ncomp,int32 *nt,int32 *il,int32 *nentries)
+    - Gets information about a palette.
+intn GRwritelut(int32 riid,int32 ncomps,int32 nt,int32 il,int32
+nentries,VOIDP data)
+    - Writes out a palette for an RI.
+intn GRreadlut(int32 palid,VOIDP data)
+    - Reads a palette from an RI.
+
+Special Element Functions:
+int32 GRsetexternalfile(int32 riid,char *filename,int32 offset)
+    - Makes the image data of an RI into an external element special element.
+intn GRsetaccesstype(int32 riid,uintn accesstype)
+    - Sets the access for an RI to be either serial or parallel I/O.
+intn GRsetcompress(int32 riid,int32 comp_type,comp_info *cinfo)
+    - Makes the image data of an RI into a compressed special element.
+
+Attribute Functions:
+intn GRsetattr(int32 dimid|riid|grid,char *name,int32 attr_nt,int32
+count,VOIDP data)
+    - Write an attribute for an object.
+int32 GRattrinfo(int32 dimid|riid|grid,int32 index,char *name,int32
+*attr_nt,int32 *count)
+    - Get attribute information for an object.
+intn GRgetattr(int32 dimid|riid|grid,int32 index,VOIDP data)
+    - Read an attribute for an object.
+int32 GRfindattr(int32 dimid|riid|grid,char *name)
+    - Get the index of an attribute with a given name for an object.
+
+
+
+Routine Descriptions
+====================
+
+Most of the routines in the GR interface return a status value of type intn
+(native integers).  If the status is equal to SUCCEED the routine completed
+successfully.  If it is equal to FAIL an error occurred, information about
+the error may be available by calling HEprint(filestream, 0).  SUCCEED and
+FAIL are defined in hdf.h for C users and in constant.i for Fortran
+programs.
+
+All IDs (hdf_file_id, grid, riid) are int32 quantities.
+
+Prototypes for these functions can be found in the file hproto.h
+
+Routines that can be called from C are all of the form GRxxx
+
+More details about all the routines below can be found in the HDF reference
+manual.
+
+
+File level interface:
+=====================
+
+These routines initialize and de-initialize the GR interface, and provide
+information about the raster images in a file.
+
+GRstart
+-------
+    Initialize the GR*() interface for a given HDF file.
+ USAGE
+    int32 GRstart(hdf_file_id)
+        int32 hdf_file_id;          IN: file ID from Hopen
+ RETURNS
+    Return grid (GR ID) on success, or FAIL
+ DESCRIPTION
+    Initializes the GR*() interface to operate on the HDF file which was
+    specified by hdf_file_id.  This routine must be called before any further
+    GR*() routines are called for a file.
+
+GRfileinfo
+----------
+    Report high-level information about the GR*() interface for a given file.
+ USAGE
+    intn GRfileinfo(grid, n_datasets, n_attrs)
+        int32 grid;                 IN: GR ID to get information about
+        int32 *n_datasets;          OUT: the # of GR datasets in a file
+        int32 *n_attrs;             OUT: the # of "global" GR attributes
+ RETURNS
+    SUCCEED/FAIL
+ DESCRIPTION
+    Reports general information about the number of datasets and "global"
+    attributes for the GR interface.  This routine is generally used to find
+    the range of acceptable indices for GRselect calls.
+
+
+GRend
+-----
+    Terminate the GR*() interface for a given HDF file.
+ USAGE
+    intn GRend(grid)
+        int32 grid;          IN: GR ID from GRstart
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Terminates access to the GR*() interface for a file.
+
+
+DataSet Manipulation
+=====================
+
+GRcreate
+--------
+    Create a new raster image.
+
+ USAGE
+    int32 GRcreate(grid, name, ncomp, nt, il, dimsizes)
+        int32 grid;         IN: GR ID from GRstart
+        char *name;         IN: Name of raster image to create
+        int32 ncomp;        IN: Number of components in image
+        int32 nt;           IN: Number type of each component
+        int32 il;           IN: Interlace of the components in the image
+        int32 dimsizes[2];  IN: Dimensions of the new image
+
+ RETURNS
+    A valid riid (Raster-Image ID) on success, or FAIL.
+
+ DESCRIPTION
+    Creates a new raster image in a file.
+
+ASSUMPTIONS
+    All components must be the same number-type.
+
+
+GRselect
+--------
+    Select a raster image to operate on.
+ USAGE
+    int32 GRselect(grid,index)
+        int32 grid;          IN: GR ID from GRstart
+        int32 index;         IN: Which raster image to select (indexed from 0)
+ RETURNS
+    A valid riid (Raster-Image ID) on success, or FAIL.
+
+ DESCRIPTION
+    Selects a raster image from the file to work on.  This ID is needed for
+    all operations on the image dataset, including reading/writing data,
+    annotations, etc.
+
+
+
+GRnametoindex
+-------------
+    Map a raster image name to an index.
+ USAGE
+    int32 GRnametoindex(grid,name)
+        int32 grid;          IN: GR ID from GRstart
+        char *name;          IN: Name of raster image to search for
+ RETURNS
+    A valid index on success, or FAIL.
+
+ DESCRIPTION
+    Searches for a raster image based on the name provided.  This routine
+    maps from names of raster images to indices inside the GR group.
+
+GRgetiminfo
+-----------
+    Gets information about a raster image.
+
+ USAGE
+    intn GRgetiminfo(riid,name,ncomp,nt,il,dimsizes,n_attr)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        char *name;         OUT: name of raster image
+        int32 *ncomp;       OUT: number of components in image
+        int32 *nt;          OUT: number type of components
+        int32 *il;          OUT: interlace of the image
+        int32 *dimsizes;    OUT: size of each dimension
+        int32 *n_attr;      OUT: the number of attributes for the image
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Looks up information about an image which has been selected or created
+    with the GR routines.  Each of the parameters can be NULL, in which case
+    that piece of information will not be retrieved.
+
+GRwriteimage
+------------
+    Writes raster data to an image
+
+ USAGE
+    intn GRwriteimage(riid,start,stride,edge,data)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        int32 start[2];     IN: array containing the offset in the image of the
+                                image data to write out
+        int32 stride[2];    IN: array containing interval of data being written
+                                along each edge.  strides of 0 are illegal
+                                (and generate an error)
+                                ie. stride of 1 in each dimension means
+                                writing contiguous data, stride of 2 means
+                                writing every other element out along an edge.
+        int32 count[2];     IN: number of elements to write out along each edge.
+        VOIDP data;         IN: pointer to the data to write out.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Writes image data to an RI.  Partial dataset writing and subsampling is
+        allowed, but only within the dimensions of the dataset (ie. no UNLIMITED
+        dimension support)
+
+ ASSUMPTIONS
+    If the stride parameter is set to NULL, a stride of 1 will be assumed.
+
+
+GRreadimage
+-----------
+    Read raster data for an image
+
+ USAGE
+    intn GRreadimage(riid,start,stride,edge,data)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        int32 start[2];     IN: array containing the offset in the image of the
+                                image data to read in
+        int32 stride[2];    IN: array containing interval of data being read
+                                along each edge.  strides of 0 are illegal
+                                (and generate an error)
+                                ie. stride of 1 in each dimension means
+                                reading contiguous data, stride of 2 means
+                                reading every other element out along an edge.
+        int32 count[2];     IN: number of elements to read in along each edge.
+        VOIDP data;         IN: pointer to the data to read in.
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Read image data from an RI.  Partial dataset reading and subsampling is
+        allowed.
+
+ASSUMPTIONS
+    If the stride parameter is set to NULL, a stride of 1 will be assumed.
+
+
+
+GRendaccess
+-----------
+    End access to an RI.
+
+ USAGE
+    intn GRendaccess(riid)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    End access to an RI.  Further attempts to access the RI ID will result in
+    an error.
+
+
+Dimension Functions
+===================
+(these have not been completed)
+
+
+ID/Ref/Index Functions
+======================
+
+GRidtoref
+---------
+    Maps an RI ID to a reference # for annotating or including in a Vgroup.
+
+ USAGE
+    uint16 GRidtoref(riid)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+
+ RETURNS
+    A valid reference # on success or FAIL
+
+ DESCRIPTION
+    Maps an riid to a reference # for annotating or including in a Vgroup.
+
+
+GRreftoindex
+------------
+    Maps the reference # of an RI into an index which can be used with GRselect.
+
+ USAGE
+    int32 GRreftoindex(grid,ref)
+        int32 grid;         IN: GR ID from GRstart
+        uint16 ref;         IN: reference number of raster image to map to index
+
+ RETURNS
+    A valid index # on success or FAIL
+
+ DESCRIPTION
+    Maps the reference # of an RI into an index which can be used with GRselect.
+
+
+Interlace Request Functions
+===========================
+
+
+GRreqlutil
+----------
+    Request that the next LUT read from an RI have a particular interlace.
+
+ USAGE
+    intn GRreqlutil(riid,il)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        intn il;            IN: interlace for next LUT.  From the following
+                                values (found in mfgr.h):
+                      MFGR_INTERLACE_PIXEL      - pixel interlacing
+                      MFGR_INTERLACE_LINE       - line interlacing
+                      MFGR_INTERLACE_COMPONENT  - component/plane interlacing
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Request that the next LUT read from an RI have a particular interlace.
+
+
+
+GRreqimageil
+------------
+    Request that the image read from an RI have a particular interlace.
+
+ USAGE
+    intn GRreqimageil(riid,il)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        intn il;            IN: interlace for next RI.  From the following
+                                values (found in mfgr.h):
+                      MFGR_INTERLACE_PIXEL      - pixel interlacing
+                      MFGR_INTERLACE_LINE       - line interlacing
+                      MFGR_INTERLACE_COMPONENT  - component/plane interlacing
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Request that the image read from an RI have a particular interlace.
+
+
+
+
+LUT/Palette I/O Functions
+=========================
+
+GRgetlutid
+----------
+    Get a LUT id ('lutid') for an RI.
+
+ USAGE
+    int32 GRgetlutid(riid,index)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        int32 lut_index;    IN: Which LUT image to select (indexed from 0)
+
+ RETURNS
+    Valid LUT ID on success, FAIL on failure
+
+ DESCRIPTION
+    Get a LUT id ('lutid') for accessing LUTs in an RI.
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Currently only supports one LUT per image, at index 0 and LUTID==RIID.
+
+
+
+
+intn GRgetlutinfo(int32 riid,int32 *ncomp,int32 *nt,int32 *il,int32 *nentries)
+    - Gets information about a palette.
+
+
+
+GRwritelut
+----------
+    Writes out a LUT for an RI.
+
+ USAGE
+    intn GRwritelut(riid,name,ncomps,nt,il,nentries,data)
+        int32 lutid;        IN: LUT ID from GRgetlutid
+        char *name;         IN: name of LUT image
+        int32 ncomp;        IN: number of components in LUT
+        int32 nt;           IN: number type of components
+        int32 il;           IN: interlace of the LUT
+        int32 nentries;     IN: the number of entries for the LUT
+        VOIDP data;         IN: LUT data to write out
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Writes out a LUT for an RI.
+
+
+GRreadlut
+---------
+    Reads a LUT from an RI.
+
+ USAGE
+    intn GRreadlut(lutid,data)
+        int32 lutid;        IN: LUT ID from GRgetlutid
+        VOIDP data;         IN: buffer for LUT data read in
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Reads a LUT from an RI.
+
+
+
+
+Special Element Functions
+=========================
+
+
+GRsetexternalfile
+-----------------
+    Makes the image data of an RI into an external element special element.
+
+ USAGE
+    intn GRsetexternalfile(riid,filename,offset)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        char *filename;     IN: name of the external file
+        int32 offset;       IN: offset in the external file to store the image
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Makes the image data of an RI into an external element special element.
+        Cause the actual data for a dataset to be stored in an
+        external file.  This can only be done once for any given
+        dataset and it is the user's responsibility to make sure the
+        external datafile is transported when the "header" file is
+        moved.  The offset is the number of byte from the beginning of
+        the file where the data should be stored.  This routine can
+        only be called on HDF 3.3 files (i.e. calling on an XDR-based
+        netCDF file that was opened with the multi-file interface will
+        fail).
+
+
+
+
+
+GRsetaccesstype
+---------------
+    Sets the access for an RI to be either serial or parallel I/O.
+
+ USAGE
+    intn GRsetaccesstype(riid,accesstype)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        uintn accesstype;   IN: access type for image data, from the following
+                                values:
+                                    DFACC_SERIAL - for serial access
+                                    DFACC_PARALLEL - for parallel access
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Sets the access for an RI to be either serial or parallel I/O.
+
+
+
+
+GRsetcompress
+-------------
+    Compressed the image data of an RI.
+
+ USAGE
+    intn GRsetcompress(riid,comp_type,cinfo)
+        int32 riid;         IN: RI ID from GRselect/GRcreate
+        int32 comp_type;    IN: type of compression, from list in hcomp.h
+        comp_info *cinfo;   IN: compression specific information
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Compressed the image data of an RI.
+    (Makes the image data of an RI into a compressed special element)
+
+
+
+
+Attribute Functions
+===================
+
+GRsetattr
+---------
+    Write an attribute for an object.
+
+ USAGE
+    intn GRsetattr(dimid|riid|grid,name,attr_nt,count,data)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        char *name;             IN: name of attribute
+        int32 attr_nt;          IN: number-type of attribute
+        int32 count;            IN: number of entries of the attribute
+        VOIDP data;             IN: attribute data to write
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Write an attribute for an object (function will figure out ID type).
+
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+    Currently does not allow changing NT of an existing attribute.
+
+
+
+
+GRattrinfo
+----------
+    Get attribute information for an object.
+
+ USAGE
+    intn GRattrinfo(dimid|riid|grid,index,name,attr_nt,count)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        int32 index;            IN: index of the attribute for info
+        char *name;             OUT: name of attribute
+        int32 attr_nt;          OUT: number-type of attribute
+        int32 count;            OUT: number of entries of the attribute
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Get attribute information for an object.
+
+
+
+
+GRgetattr
+---------
+    Read an attribute for an object.
+
+ USAGE
+    intn GRgetattr(dimid|riid|grid,index,data)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        int32 index;            IN: index of the attribute for info
+        VOIDP data;             OUT: data read for attribute
+
+ RETURNS
+    SUCCEED/FAIL
+
+ DESCRIPTION
+    Read an attribute for an object.
+
+
+
+
+GRfindattr
+----------
+    Get the index of an attribute with a given name for an object.
+
+ USAGE
+    int32 GRfindattr(int32 dimid|riid|grid,char *name)
+        int32 dimid|riid|grid;  IN: DIM|RI|GR ID
+        char *name;             IN: name of attribute to search for
+
+ RETURNS
+    Valid index for an attribute on success, FAIL on failure
+
+ DESCRIPTION
+    Get the index of an attribute with a given name for an object.
+
+
+
+
+
+
+
+
+============================================================================
+================================new_functions.txt===========================
+
+This file contains a list of the new functions added with HDF 4.1r2.
+The functions in parenthesis were already present in the HDF library,
+and are included for clarity.
+
+C                     FORTRAN                 Description
+--------------------------------------------------------------------------------
+
+(SDsetcompress)       sfscompress             compresses SDS
+
+(SDwritechunk)        sfwchnk                 writes the specified chunk of
+                                              NUMERIC data to the SDS
+
+(SDwritechunk)        sfwcchnk                writes the specified chunk of
+                                              CHARACTER data to the SDS
+
+(SDreadchunk)         sfrchnk                 reads the specified chunk of
+                                              NUMERIC data to the SDS
+
+(SDreadchunk)         sfrcchnk                reads the specified chunk of
+                                              CHARACTER data to the SDS
+ 
+(SDsetchunk)          sfschnk                 makes the SDS a chunked SDS
+ 
+(SDsetchunkcache)     sfscchnk                sets the maximum number of chunks
+                                              to cache
+ 
+(SDgetchunkinfo)      sfgichnk                gets info on SDS
+
+(SDsetblocksize)      sfsblsz                 sets block size 
+
+(SDisrecord)          sfisrcrd                checks if an SDS is unlimited
+
+
+
+(GRsetcompress)       mgscompress             compresses raster image
+
+GRsetchunk            mgschnk                 makes a raster image a chunked
+                                              raster image
+
+GRgetchunkinfo        mggichnk                gets info on a raster image
+
+GRsetchunkcache       mgscchnk                sets the maximum number of chunks
+                                              to cache
+
+
+(Hgetlibversion)      hglibver                gets version of the HDF Library
+
+(Hgetfileversion)     hgfilver                gets version of the HDF file
+
+
+Vdeletetagref        vfdtr                    deletes tag/ref pair ( HDF object)
+                                              from a vgroup
+
+(VSfindclass)        vsffcls                  finds class with a specified 
+                                              name in a vdata
+
+VSdelete             vsfdlte                  deletes a vdata
+
+Vdelete              vdelete                  deletes a vgroup
+
+
+
+============================================================================
+================================page_buf.txt================================
+
+****************************** Beta Version *********************************
+File Caching(Beta release)
+=================================
+    This version of the distribution has preliminary support for file caching.
+
+*NOTE*: This version is NOT officially supported on all platforms
+        and has not been extensively tested. As such it is provided as is.
+        It will be supported officially in a later release.
+
+    The file caching allows the file to be mapped to user memory on 
+    a per page basis i.e a memory pool of the file. With regards to the 
+    file system, page sizes can be allocated based on the file system page-size 
+    or if the user wants in some multiple of the file system page-size. This 
+    allows for fewer pages to be managed along with accommodating the users file
+    usage pattern.
+
+    The current version supports setting the page-size and number of pages
+    in the memory pool through user C-routines(Fortran will be added in the
+    next release). The default is 8192 bytes for page-size and 1 for number 
+    of pages in the pool.
+
+    Two user C-routines are provided: one to set the values for page-size and
+    number of pages to cache, and the other to inquire the current values being 
+    used for the pagesize and number of pages cached.
+
+    Routines:(The names may change in the future...)
+    -------------------------------------------------
+    Hmpset(int pagesize, int maxcache, int flags)
+    --------------------------------------------
+    o  Set the pagesize and maximum number of pages to cache on the next
+       open/create of a file. A pagesize that is a power of 2 is recommended.
+       'pagesize' must be greater than MIN_PAGESIZE(512) bytes and 
+       'maxcache' must be greater than or equal to 1. Valid values
+       for both arguments are required when using this call.
+
+       The values set here only affect the next open/creation of a file and
+       do not change a particular file's paging behaviour after it has been
+       opened or created. This maybe changed in a later release.
+
+       Use flags argument of 'MP_PAGEALL' if the whole file is to be cached
+       in memory otherwise pass in zero. In this case the value for 'maxcache'
+       is ignored. You must pass in a valid value for 'pagesize' when
+       using the flag 'MP_PAGEALL'. 
+ 
+    Hmpget(int *pagesize, int *maxcache, int flags)
+    ----------------------------------------------
+    o   This gets the last pagesize and maximum number of pages cached for
+        the last open/create of a file. The 'flags' variable is not used.
+    
+    In this version a new file memory pool is created for every file that is
+    created/opened and can not be shared. Future versions will allow sharing 
+    of the file memory pool with other threads/processes.
+
+    To enable the creation of a library using page caching the following 
+    section in the makefile fragment($(toplevel)/config/mh-<os>) must be 
+    uncommented and set.
+
+    # ------------ Macros for Shared Memory File Buffer Pool(fmpool) ------
+    # Uncomment the following lines to enable shared memory file buffer pool
+    # version of the HDF core library libdf.a. Please read the
+    # documentation before enabling this feature.
+    #FMPOOL_FLAGS  = -DHAVE_FMPOOL
+
+    After setting these values you must re-run  the toplevel 'configure' script.
+    Make sure that your start from a clean re-build(i.e. 'make clean') after
+    re-running the toplevel 'configure' script and then run 'make'.
+    Details on running configure can be found in the section
+    'General Configuration/Installation - Unix' in the installation file 
+    '$(toplevel)/INSTALL'.
+
+    The file caching version of libdf.a is automatically tested
+    when the regular HDF and netCDF tests are run. The page caching
+    version has been tested only on a few UNIX platforms and is NOT
+    available for the Macintosh ,IBM-PC(Windows NT/95) or VMS.
+
+****************************** Beta Version *********************************
+============================================================================
+================================sd_chunk_examples.txt=======================
+
+/**************************************************************************
+File: sd_chunk_examples.c
+
+  Examples for writing/reading SDS with Chunking and Chunking w/ Compression.
+   - Sample C-code using SDS chunking routines. 
+   - No real error checking is done and the value of 'status' should 
+     be checked for proper values.
+
+5 Examples are shown, 1 for 2-D array, 3 for 3-D arrays and
+                      1 for 2-D array with compression..
+
+  Example 1. 2-D 9x4 SDS of uint16 with 3x2 chunks
+             Write data using SDwritechunk().
+             Read data using SDreaddata().
+
+  Example 2. 3-D 2x3x4 SDS of uint16 with 2x3x2 chunks
+             Write data using SDwritedata().
+             Read data using SDreaddata().
+
+  Example 3. 3-D 2x3x4 SDS of uint16 with 1x1x4 chunks
+             Write data using SDwritechunk().
+             Read data using SDreaddata().
+
+  Example 4. 3-D 2x3x4 SDS of uint16 with 1x1x4 chunks
+             Write data using SDwritedata().
+             Read data using SDreadchunk().
+
+  Example 5. 2-D 9x4 SDS of uint16 with 3x2 chunks with GZIP compression.
+             Write data using SDwritechunk().
+             Read data using SDreaddata().
+
+Author - GeorgeV
+Date   - 11/25/96
+********************************************************************/
+
+#include "mfhdf.h"
+
+/* arrays holding dim info for datasets */
+static int32  d_dims[3]     = {2, 3, 4};  /* data dimensions */
+static int32  edge_dims[3]  = {0, 0, 0};  /* edge dims */
+static int32  start_dims[3] = {0, 0, 0};  /* starting dims  */
+
+/* data arrays layed out in memory  */
+
+/* used in Example 1 and 5 */
+static uint16  u16_2data[9][4] =
+{ 
+   {11, 21, 31, 41},
+   {12, 22, 32, 42},
+   {13, 23, 33, 43},
+   {14, 24, 34, 44},
+   {15, 25, 35, 45},
+   {16, 26, 36, 46},
+   {17, 27, 37, 47},
+   {18, 28, 38, 48},
+   {19, 29, 39, 49},
+};
+
+/* uint16 3x2 chunk arrays used in example 1 and 5*/
+static uint16  chunk1_2u16[6] = {11, 21, 
+                                 12, 22, 
+                                 13, 23};
+
+static uint16  chunk2_2u16[6] = {31, 41, 
+                                 32, 42, 
+                                 33, 43};
+
+static uint16  chunk3_2u16[6] = {14, 24, 
+                                 15, 25, 
+                                 16, 26};
+
+static uint16  chunk4_2u16[6] = {34, 44, 
+                                 35, 45, 
+                                 36, 46};
+
+static uint16  chunk5_2u16[6] = {17, 27, 
+                                 18, 28, 
+                                 19, 29};
+
+static uint16  chunk6_2u16[6] = {37, 47, 
+                                 38, 48, 
+                                 39, 49};
+
+
+/* uint16 1x1x4 chunk arrays used in example 3 */
+static uint16  chunk1_3u16[4] =  { 0, 1, 2, 3};
+
+static uint16  chunk2_3u16[4] =  { 10, 11, 12, 13};
+
+static uint16  chunk3_3u16[4] =  { 20, 21, 22, 23};
+
+static uint16  chunk4_3u16[4] =  { 100, 101, 102, 103};
+
+static uint16  chunk5_3u16[4] =  { 110, 111, 112, 113};
+
+static uint16  chunk6_3u16[4] =  { 120, 121, 122, 123};
+
+
+/* Used in Examples 2 and 4 */
+static uint16  u16_3data[2][3][4] =
+{
+    {
+        { 0, 1, 2, 3},
+        { 10, 11, 12, 13},
+        { 20, 21, 22, 23}},
+    {
+        { 100, 101, 102, 103},
+        { 110, 111, 112, 113},
+        { 120, 121, 122, 123}}};
+
+/*
+ * Main routine
+ */
+int main(int argc, char *argv[])
+{
+   int32 f1;                    /* file handle */
+   int32 sdsid;                 /* SDS handle */
+   uint16  inbuf_3u16[2][3][4]; /* Data array read for Example 2 and 3*/
+   uint16  inbuf_2u16[5][2];    /* Data array read for Example 1 */
+   uint16  ru16_3data[4];       /* whole chunk input buffer */
+   uint16  fill_u16 = 0;        /* fill value */
+   HDF_CHUNK_DEF chunk_def;     /* Chunk defintion set */ 
+   HDF_CHUNK_DEF rchunk_def;    /* Chunk defintion read */ 
+   int32   cflags;              /* chunk flags */
+   comp_info cinfo;             /* compression info */
+   intn status;
+
+   ncopts = NC_VERBOSE;
+
+    /* create file */
+    f1 = SDstart("chunk.hdf", DFACC_CREATE);
+
+    /* 
+      Example 1. 2-D 9x4 SDS of uint16 with 3x2 chunks
+                 Write data using SDwritechunk().
+                 Read data using SDreaddata().
+    */
+
+    /* create a  9x4 SDS of uint16 in file 1 */
+    d_dims[0] = 9;
+    d_dims[1] = 4;
+    sdsid = SDcreate(f1, "DataSetChunked_1", DFNT_UINT16, 2, d_dims);
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(sdsid, (VOIDP) &fill_u16);
+
+    /* Create chunked SDS 
+       chunk is 3x2 which will create 6 chunks */
+    chunk_def.chunk_lengths[0] = 3;
+    chunk_def.chunk_lengths[1] = 2;
+    status = SDsetchunk(sdsid, chunk_def, HDF_CHUNK);
+
+    /* Set Chunk cache to hold 3 chunks */
+    status = SDsetchunkcache(sdsid, 3, 0);
+
+    /* Write data use SDwritechunk */
+
+    /* Write chunk 1 */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk1_2u16);
+
+    /* Write chunk 4 */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk4_2u16);
+
+    /* Write chunk 2 */
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk2_2u16);
+
+    /* Write chunk 5 */
+    start_dims[0] = 2;
+    start_dims[1] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk5_2u16);
+
+    /* Write chunk 3 */
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk3_2u16);
+
+    /* Write chunk 6 */
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk6_2u16);
+ 
+    /* read a portion of data back in using SDreaddata
+       i.e  5x2 subset of the whole array */
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    edge_dims[0] = 5;
+    edge_dims[1] = 2;
+    status = SDreaddata(sdsid, start_dims, NULL, edge_dims, (VOIDP) inbuf_2u16);
+
+   /* This 5x2 array should look somethink like this
+         {{23, 24, 25, 26, 27},
+          {33, 34, 35, 36, 37}}    
+    */
+
+    /* Get chunk information */
+    status = SDgetchunkinfo(sdsid, &rchunk_def, &cflags);
+
+
+    /* Close down this SDS*/    
+    status = SDendaccess(sdsid);
+
+    /* 
+      Example 2. 3-D 2x3x4 SDS of uint16 with 2x3x2 chunks
+                 Write data using SDwritedata().
+                 Read data using SDreaddata().
+    */
+
+    /* create a new 2x3x4 SDS of uint16 in file 1 */
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    sdsid = SDcreate(f1, "DataSetChunked_2", DFNT_UINT16, 3, d_dims);
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(sdsid, (VOIDP) &fill_u16);
+
+    /* Create chunked SDS
+       chunk is 2x3x2 which will create 2 chunks */
+    chunk_def.chunk_lengths[0] = 2;
+    chunk_def.chunk_lengths[1] = 2;
+    chunk_def.chunk_lengths[2] = 3;
+    status = SDsetchunk(sdsid, chunk_def, HDF_CHUNK);
+
+    /* Set Chunk cache to hold 2 chunks*/
+    status = SDsetchunkcache(sdsid, 2, 0);
+
+    /* Write data using SDwritedata*/
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDwritedata(sdsid, start_dims, NULL, edge_dims, (VOIDP) u16_3data);
+
+    /* read data back in using SDreaddata*/
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDreaddata(sdsid, start_dims, NULL, edge_dims, (VOIDP) inbuf_3u16);
+
+    /* Verify the data in inbuf_3u16 against u16_3data[] */
+
+    /* Get chunk information */
+    status = SDgetchunkinfo(sdsid, &rchunk_def, &cflags);
+
+    /* Close down this SDS*/    
+    status = SDendaccess(sdsid);
+
+    /* 
+      Example 3. 3-D 2x3x4 SDS of uint16 with 1x1x4 chunks
+                 Write data using SDwritechunk().
+                 Read data using SDreaddata().
+    */
+
+    /* Now create a new 2x3x4 SDS of uint16 in file 'chunk.hdf' */
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    sdsid = SDcreate(f1, "DataSetChunked_3", DFNT_UINT16, 3, d_dims);
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(sdsid, (VOIDP) &fill_u16);
+
+    /* Create chunked SDS 
+       chunk is 1x1x4 which will create 6 chunks */
+    chunk_def.chunk_lengths[0] = 1;
+    chunk_def.chunk_lengths[1] = 1;
+    chunk_def.chunk_lengths[2] = 4;
+    status = SDsetchunk(sdsid, chunk_def, HDF_CHUNK);
+
+    /* Set Chunk cache to hold 4 chunks*/
+    status = SDsetchunkcache(sdsid, 4, 0);
+
+    /* Write data use SDwritechunk */
+
+    /* Write chunk 1 */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk1_3u16);
+
+    /* Write chunk 4 */
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk4_3u16);
+
+    /* Write chunk 2 */
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk2_3u16);
+
+    /* Write chunk 5 */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk5_3u16);
+
+    /* Write chunk 3 */
+    start_dims[0] = 0;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk3_3u16);
+
+    /* Write chunk 6 */
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk6_3u16);
+ 
+    /* read data back in using SDreaddata*/
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDreaddata(sdsid, start_dims, NULL, edge_dims, (VOIDP) inbuf_3u16);
+
+    /* Verify the data in inbuf_3u16 against u16_3data[] */
+
+    /* Close down this SDS*/    
+    status = SDendaccess(sdsid);
+
+
+    /* 
+      Example 4. 3-D 2x3x4 SDS of uint16 with 1x1x4 chunks
+                 Write data using SDwritedata().
+                 Read data using SDreadchunk().
+    */
+
+    /* Now create a new 2x3x4 SDS of uint16 in file 'chunk.hdf' */
+    d_dims[0] = 2;
+    d_dims[1] = 3;
+    d_dims[2] = 4;
+    sdsid = SDcreate(f1, "DataSetChunked_4", DFNT_UINT16, 3, d_dims);
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(sdsid, (VOIDP) &fill_u16);
+
+    /* Create chunked SDS
+       chunk is 1x1x4 which will create 6 chunks */
+    chunk_def.chunk_lengths[0] = 1;
+    chunk_def.chunk_lengths[1] = 1;
+    chunk_def.chunk_lengths[2] = 4;
+    status = SDsetchunk(sdsid, chunk_def, HDF_CHUNK);
+
+    /* Set Chunk cache to hold 4 chunks */
+    status = SDsetchunkcache(sdsid, 4, 0);
+
+    /* Write data using SDwritedata*/
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    edge_dims[0] = 2;
+    edge_dims[1] = 3;
+    edge_dims[2] = 4;
+    status = SDwritedata(sdsid, start_dims, NULL, edge_dims, (VOIDP) u16_3data);
+
+    /* read data back in using SDreadchunk and verify against
+       the chunk arrays chunk1_3u16[] ... chunk6_3u16[] */
+
+    /* read chunk 1 */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDreadchunk(sdsid, start_dims, (VOIDP) ru16_3data);
+
+    /* read chunk 2 */
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDreadchunk(sdsid, start_dims, (VOIDP) ru16_3data);
+
+    /* read chunk 3 */
+    start_dims[0] = 0;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDreadchunk(sdsid, start_dims, (VOIDP) ru16_3data);
+
+    /* read chunk 4 */
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    start_dims[2] = 0;
+    status = SDreadchunk(sdsid, start_dims, (VOIDP) ru16_3data);
+
+    /* read chunk 5 */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    start_dims[2] = 0;
+    status = SDreadchunk(sdsid, start_dims, (VOIDP) ru16_3data);
+
+    /* read chunk 6 */
+    start_dims[0] = 1;
+    start_dims[1] = 2;
+    start_dims[2] = 0;
+    status = SDreadchunk(sdsid, start_dims, (VOIDP) ru16_3data);
+
+    /* Close down this SDS*/    
+    status = SDendaccess(sdsid);
+
+
+    /* 
+      Example 5. 2-D 9x4 SDS of uint16 with 3x2 chunks with GZIP compression
+                 Write data using SDwritechunk().
+                 Read data using SDreaddata().
+    */
+
+    /* create a  9x4 SDS of uint16 in file 1 */
+    d_dims[0] = 9;
+    d_dims[1] = 4;
+    sdsid = SDcreate(f1, "DataSetChunked_1", DFNT_UINT16, 2, d_dims);
+
+    /* set fill value */
+    fill_u16 = 0;
+    status = SDsetfillvalue(sdsid, (VOIDP) &fill_u16);
+
+    /* Create chunked SDS 
+       chunk is 3x2 which will create 6 chunks 
+       Compression set will be GZIP. 
+       Note that 'chunk_def' is a union. 
+       See the man page 'sd_chunk.3' for more info on the union. */
+    chunk_def.comp.chunk_lengths[0] = 3;
+    chunk_def.comp.chunk_lengths[1] = 2;
+    chunk_def.comp.comp_type = COMP_CODE_DEFLATE; /* GZIP */
+    chunk_def.comp.cinfo.deflate.level = 6;       /* Level */
+
+    /* set Chunking with Compression */
+    status = SDsetchunk(sdsid, chunk_def, HDF_CHUNK | HDF_COMP);
+
+    /* Set Chunk cache to hold 3 chunks */
+    status = SDsetchunkcache(sdsid, 3, 0);
+
+    /* Write data use SDwritechunk 
+       NOTE: This is the recommended way when using Compression */
+
+    /* Write chunk 1 */
+    start_dims[0] = 0;
+    start_dims[1] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk1_2u16);
+
+    /* Write chunk 4 */
+    start_dims[0] = 1;
+    start_dims[1] = 1;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk4_2u16);
+
+    /* Write chunk 2 */
+    start_dims[0] = 0;
+    start_dims[1] = 1;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk2_2u16);
+
+    /* Write chunk 5 */
+    start_dims[0] = 2;
+    start_dims[1] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk5_2u16);
+
+    /* Write chunk 3 */
+    start_dims[0] = 1;
+    start_dims[1] = 0;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk3_2u16);
+
+    /* Write chunk 6 */
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    status = SDwritechunk(sdsid, start_dims, (VOIDP) chunk6_2u16);
+ 
+    /* read a portion of data back in using SDreaddata
+       i.e  5x2 subset of the whole array */
+    start_dims[0] = 2;
+    start_dims[1] = 1;
+    edge_dims[0] = 5;
+    edge_dims[1] = 2;
+    status = SDreaddata(sdsid, start_dims, NULL, edge_dims, (VOIDP) inbuf_2u16);
+
+   /* This 5x2 array should look somethink like this
+         {{23, 24, 25, 26, 27},
+          {33, 34, 35, 36, 37}}    
+    */
+
+    /* Get chunk information */
+    status = SDgetchunkinfo(sdsid, &rchunk_def, &cflags);
+
+    /* Close down this SDS*/    
+    status = SDendaccess(sdsid);
+
+    /* Close down SDS interface */
+    status = SDend(f1);
+
+}
+============================================================================
+================================vattr.txt===================================
+
+        Vgroup and vdata attributes 
+                   9/8/96
+ 
+Vdata/vgroup version
+--------------------
+Previously (up to HDF4.0r2), the vdata and vgroup version was 3, 
+VSET_VERSION.  With attributes added, the version number has been 
+changed to 4, VSET_NEW_VERSION. For backward compatibility, a vdata 
+or a vgroup will still have version number 3 if it has no attribute(s) 
+assigned. 
+
+Attribute
+---------
+An attribute has a name, data type, a number of values and the 
+values.  All values of an attribute should be of the same data type.
+For example, 10 characters, or 2 32-bit integers.
+
+Any number of attributes can be assigned to a vgroup, a vdata 
+(entire vdata) or any field of a vdata.  An attribute name should be 
+unique in its scope.  For example, a field attribute name 
+should be unique among all attributes of that field. 
+
+Attributes in HDF files
+-----------------------
+Attributes will be stored in vdatas.  The vdata's name is
+the attribute name specified by the user. Its class is 
+"Attr0.0", _HDF_ATTRIBUTE.  
+
+All attributes of a vgroup or a vdata will be included in 
+the vgroup represented by DFTAG_VG,  or the vdata header,
+DFTAG_VH. 
+ 
+Vdata/Vgroup attribute routines (see man pages for more info)
+----------------------------------------------------------
+  intn VSfindex(int32 vsid, char *fieldname, int32 *fldindex)
+       find out the index of a field given the field name.
+  intn VSsetattr(int32 vsid, int32 findex, char *attrname, 
+                 int32 datatype, int32 count, VOIDP values)
+       set attr for a field of a vdata or for the vdata.
+       if the attr already exists the new values will replace
+          the current ones, provided the datatype and order
+          have not been changed.
+  intn VSnattrs(int32 vsid)
+       total number of attr for a vdata and its fields
+  int32 VSfnattrs(int32 vsid, int32 findex) 
+       number of attrs for a vdata or a field of it
+  intn VSfindattr(int32 vsid, int32 findex, char *attrname)
+       get index of an attribute with a given name
+  intn VSattrinfo(int32 vsid, int32 findex, intn attrindex,
+                  char *name, int32 *datatype, int32 *count,
+                    int32 *size);
+       get info about an attribute
+  intn VSgetattr(int32 vsid, int32 findex, intn attrindex, 
+                 VOIDP values)
+       get values of an attribute
+  intn VSisattr(int32 vsid)
+       test if a vdata is an attribute of other object
+  intn Vsetattr(int32 vgid,  char *attrname, int32 datatype,
+                int32 count, VOIDP values) 
+       set attr for a vgroup
+  intn Vnattrs(int32 vgid)
+       number of attrs for a vgroup
+  intn Vfindattr(int32 vgid, char *attrname)
+       get index of an attribute with a given name
+  intn Vattrinfo(int32 vgid, intn attrindex, char *name, 
+                 int32 *datatype, int32 *count, int32 *size)
+       get info about an attribute
+  intn Vgetattr(int32 vgid, intn attrindex, VOIDP values)
+       get values of an attribute
+  int32 Vgetversion(int32 vgid)
+       get vset version of a vgroup
+  ( int32 VSgetversion(int32 vsid) already exists.) 
+
+Changes in the vdata header in HDF files :
+------------------------------------------
+1. If attributes or other new features are assigned:
+     o version number will be VSET_NEW_VERSION (4, 
+         defined in vg.h)
+     o the new DFTAG_VH looks like:
+           
+       interlace  number_records hdf_rec_size n_fields
+         2 bytes        4              2           2
+       datatype_field_n offset_field_n order_field_n fldnmlen_n
+         2*n_fields        2*n_fields     2*n_fields  2*n_fields
+       fldnm_n namelen name classlen class extag exref version
+                 2            2             2     2      2
+       more  flags  < nattrs  field_index attr0_tag/ref 
+        2      4         4         4         2/2        
+       field_index  attr1_tag/ref ...> version  more extra_byte
+             4           2/2          
+ 
+   If no attributes or other new features were assigned, 
+       version number is still VSET_VERSION and the old 
+       vdata header will be written out.
+
+2. In the old implementation the 'version' and 'more' fields
+   follow the 'exref' field. In order to not break existing
+   applications the new implementation keeps these two
+   fields and adds a duplication of 'version' and 'more'
+   at the end, along with an extra byte which was not 
+   documented in the old documentation. 
+
+3. The field "flags" of  uint32: 
+           bit 0 -- has attr
+           bit 1 -- 15  -- unused.
+     o Fields follow the 'flags' are:
+           total_number_of_attrs this vdata has  (4 bytes)
+           vs_attr_list  (#_attrs * 8 bytes (4+2+2))
+            (field_index, attr_vdata_tag, attr_vdata_ref) 
+       the flags and attribute fields are added after the 
+           first 'more' fields.
+ 
+Changes in the vgroup data in HDF files 
+---------------------------------------
+1. If has attribute(s):
+      o add a flag field, uint16,
+          bit 0 -- has attr
+          bit 1-15  -- unused.
+      o version number will be changed to 4 
+      o fields following the flag are:
+          number_of_attrs 
+          vg_attr_list 
+        the above fields are added preceding the version field
+      o vg_attr_list consists of a list of attribute_tag/ref
+         pairs
+   If no attribute:
+      No changes in vgroup data and version number is still 3
+============================================================================
+================================windows.txt=================================
+
+Fortner Software LLC ("Fortner") created the reference implementation for
+Windows of the HDF 4.1r3 library, providing C-language bindings to all
+4.1r3 features.
+
+The Windows reference implementation of the 4.1r3 library was implemented
+and tested on a Pentium PC running Windows95 4.00.950 using Microsoft
+Developers Studio 97 Visual C++ Version 5.00.   The library has also been
+run on Pentium PC running WindowsNT version 4.0.
+
+Fortner cannot be certain that the libraries will run on other versions of
+Windows or when built using other development tools.  (In particular, this
+Windows implementation has not addressed use with Windows 3.x, or non-PC
+versions of WindowsNT).  Migrating the Windows reference implementation to
+other development and/or run-time environments is the responsibility of the
+library user.
+
+First-time HDF users are encouraged to read the FAQ in this release for
+more information about HDF.  Users can also look at the home page for HDF
+at:
+
+    http://hdf.ncsa.uiuc.edu/
+
+Please send questions, comments, and recommendations regarding the Windows
+version of the HDF library to:
+
+    hdfhelp at ncsa.uiuc.edu
+ 
+============================================================================
diff --git a/upstream/HDF4.2r4.tar.gz b/upstream/HDF4.2r4.tar.gz
deleted file mode 100644
index 7a3f5ee..0000000
Binary files a/upstream/HDF4.2r4.tar.gz and /dev/null differ

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/hdf4.git



More information about the Pkg-grass-devel mailing list